[Scummvm-git-logs] scummvm master -> ea0d27d4961ba86dcdf1d35eac0002f1ac670cf1
sev-
noreply at scummvm.org
Mon Sep 26 17:52:52 UTC 2022
This automated email contains information about 17 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
98ef900668 SAGA2: Rename class variables in gdraw.h
b590a8af74 SAGA2: Rename class variables in gpointer.h
c64a61dbd7 SAGA2: Rename class variables in grabinfo.h
89102aefa8 SAGA2: Rename class variables in grequest.cpp
1a67f6146b SAGA2: Rename class variables in gtextbox.h
e39360e667 SAGA2: Rename class variables in imagcach.h
56d0d75216 SAGA2: Rename class variables in interp.cpp
7b69970c82 SAGA2: Fix class variable names in intrface.h
f3a751e947 SAGA2: Rename class variables in mapfeatr.h
9bb65c95fe SAGA2: Fix class variable names in messager.h
b8632b0a91 SAGA2: Rename class variables in modal.h
c2d795f63c SAGA2: Rename class variables in motion.h
1d5f9486b2 SAGA2: Rename class variables in msgbox.h
4921ae88c2 SAGA2: Rename class variables in objects.h
9834c6e321 SAGA2: Rename class variables in objproto.h
307bd92ea8 SAGA2: Remove non-portable log-related code
ea0d27d496 SAGA2: Rename class variables in panel.h
Commit: 98ef900668ee804987c98bb9a748b53c122cdad7
https://github.com/scummvm/scummvm/commit/98ef900668ee804987c98bb9a748b53c122cdad7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:25+02:00
Commit Message:
SAGA2: Rename class variables in gdraw.h
Changed paths:
engines/saga2/automap.cpp
engines/saga2/blitters.cpp
engines/saga2/button.cpp
engines/saga2/console.cpp
engines/saga2/display.cpp
engines/saga2/dispnode.cpp
engines/saga2/document.cpp
engines/saga2/floating.cpp
engines/saga2/gdraw.cpp
engines/saga2/gdraw.h
engines/saga2/gpointer.cpp
engines/saga2/grabinfo.cpp
engines/saga2/gtext.cpp
engines/saga2/gtextbox.cpp
engines/saga2/intrface.cpp
engines/saga2/mouseimg.cpp
engines/saga2/panel.cpp
engines/saga2/playmode.cpp
engines/saga2/speech.cpp
engines/saga2/sprite.cpp
engines/saga2/tile.cpp
engines/saga2/tileload.cpp
engines/saga2/towerfta.cpp
engines/saga2/vbacksav.cpp
engines/saga2/vbacksav.h
engines/saga2/vdraw.h
engines/saga2/vwdraw.cpp
diff --git a/engines/saga2/automap.cpp b/engines/saga2/automap.cpp
index da49dda657d..a3747719700 100644
--- a/engines/saga2/automap.cpp
+++ b/engines/saga2/automap.cpp
@@ -389,7 +389,7 @@ void AutoMap::drawClipped(
if (!_extent.overlap(clipRect)) return;
// clear out the buffer
- memset(_tPort.map->data, 0, _sumMapArea.width * _sumMapArea.height);
+ memset(_tPort._map->_data, 0, _sumMapArea.width * _sumMapArea.height);
// draw the parts of the panel
WindowDecoration *dec;
@@ -419,7 +419,7 @@ void AutoMap::drawClipped(
// Blit the pixelmap to the main screen
port.setMode(drawModeMatte);
- port.bltPixels(*_tPort.map,
+ port.bltPixels(*_tPort._map,
0, 0,
_extent.x, _extent.y,
_sumMapArea.width, _sumMapArea.height);
@@ -461,7 +461,7 @@ void AutoMap::createSmallMap() {
int16 tileSumWidthHalved = kTileSumWidth / 2;
// Set up pixel map to blit summary data from
- map.size = Point16(kTileSumWidth, kTileSumHeight);
+ map._size = Point16(kTileSumWidth, kTileSumHeight);
// optimizations done based on these numbers
assert(sumSize == 64); // opt:2
@@ -494,10 +494,10 @@ void AutoMap::createSmallMap() {
if (mtile & metaTileVisited)
if (_autoMapCheat || (mtile & metaTileVisited)) {
// get the tile data
- map.data = &_summaryData[(mtile & ~metaTileVisited) << 6];
+ map._data = &_summaryData[(mtile & ~metaTileVisited) << 6];
// blit this tile onto the temp surface
- TBlit(_tPort.map,
+ TBlit(_tPort._map,
&map,
x,
y);
diff --git a/engines/saga2/blitters.cpp b/engines/saga2/blitters.cpp
index 244502ed56b..1a9d2b0e12a 100644
--- a/engines/saga2/blitters.cpp
+++ b/engines/saga2/blitters.cpp
@@ -70,9 +70,9 @@ void _HLine(uint8 *dstPtr, uint32 width, uint32 color) {
}
void unpackImage(gPixelMap &map, int16 width, int16 rowCount, int8 *srcData) {
- int8 *dest = (int8 *)map.data;
+ int8 *dest = (int8 *)map._data;
int16 bytecount = (width + 1) & ~1;
- int16 rowMod = map.size.x - bytecount;
+ int16 rowMod = map._size.x - bytecount;
while (rowCount--) {
for (int16 k = 0; k < bytecount;) {
@@ -107,8 +107,8 @@ void unpackImage(gPixelMap *map, int32 width, int32 rowCount, int8 *srcData) {
#define DEBUGPACK 0
void unpackSprite(gPixelMap *map, uint8 *sprData, uint32 dataSize) {
- byte *dst = map->data;
- int bytes = map->size.x * map->size.y;
+ byte *dst = map->_data;
+ int bytes = map->_size.x * map->_size.y;
bool fail = false;
if (!sprData) {
@@ -129,7 +129,7 @@ void unpackSprite(gPixelMap *map, uint8 *sprData, uint32 dataSize) {
if (bytes < trans) {
#if DEBUGPACK
- warning("unpackSprite: too many trans %d < %d for %dx%d (src %d bytes)", bytes, trans, map->size.x, map->size.y, dataSize);
+ warning("unpackSprite: too many trans %d < %d for %dx%d (src %d bytes)", bytes, trans, map->_size.x, map->_size.y, dataSize);
#endif
fail = true;
break;
@@ -150,7 +150,7 @@ void unpackSprite(gPixelMap *map, uint8 *sprData, uint32 dataSize) {
}
if (bytes < fill) {
#if DEBUGPACK
- warning("unpackSprite: too many fill %d < %d for %dx%d (src %d bytes)", bytes, fill, map->size.x, map->size.y, dataSize);
+ warning("unpackSprite: too many fill %d < %d for %dx%d (src %d bytes)", bytes, fill, map->_size.x, map->_size.y, dataSize);
#endif
fill = bytes;
fail = true;
@@ -177,12 +177,12 @@ void unpackSprite(gPixelMap *map, uint8 *sprData, uint32 dataSize) {
if (fail) {
#if DEBUGPACK
Graphics::Surface surf;
- surf.w = map->size.x;
- surf.h = map->size.y;
- surf.pitch = map->size.x;
+ surf.w = map->_size.x;
+ surf.h = map->_size.y;
+ surf.pitch = map->_size.x;
surf.format = Graphics::PixelFormat::createFormatCLUT8();
- surf.setPixels(map->data);
+ surf.setPixels(map->_data);
surf.debugPrint();
#endif
@@ -204,7 +204,7 @@ void drawTile(gPixelMap *map, int32 x, int32 y, int32 height, uint8 *srcData, bo
if (point.x + SAGA_ISOTILE_WIDTH < 0)
return;
- if (point.x - SAGA_ISOTILE_WIDTH >= map->size.x)
+ if (point.x - SAGA_ISOTILE_WIDTH >= map->_size.x)
return;
tilePointer = srcData;
@@ -213,15 +213,15 @@ void drawTile(gPixelMap *map, int32 x, int32 y, int32 height, uint8 *srcData, bo
drawPoint.y -= height;
- if (drawPoint.y >= map->size.y)
+ if (drawPoint.y >= map->_size.y)
return;
readPointer = tilePointer;
- lowBound = MIN((int)(drawPoint.y + height), (int)map->size.y);
+ lowBound = MIN((int)(drawPoint.y + height), (int)map->_size.y);
for (row = drawPoint.y; row < lowBound; row++) {
widthCount = 0;
if (row >= 0) {
- drawPointer = map->data + drawPoint.x + (row * map->size.x);
+ drawPointer = map->_data + drawPoint.x + (row * map->_size.x);
col = drawPoint.x;
for (;;) {
bgRunCount = *readPointer++;
@@ -244,7 +244,7 @@ void drawTile(gPixelMap *map, int32 x, int32 y, int32 height, uint8 *srcData, bo
col += colDiff;
}
- colDiff = map->size.x - col;
+ colDiff = map->_size.x - col;
if (colDiff > 0) {
int countDiff = fgRunCount - count;
if (colDiff > countDiff)
@@ -281,14 +281,14 @@ void drawTile(gPixelMap *map, int32 x, int32 y, int32 height, uint8 *srcData, bo
// Compute dirty rect
int rectX = MAX<int>(drawPoint.x, 0);
int rectY = MAX<int>(drawPoint.y, 0);
- int rectX2 = MIN<int>(drawPoint.x + SAGA_ISOTILE_WIDTH, map->size.x);
+ int rectX2 = MIN<int>(drawPoint.x + SAGA_ISOTILE_WIDTH, map->_size.x);
int rectY2 = lowBound;
debugC(3, kDebugTiles, "Rect = (%d,%d,%d,%d)", rectX, rectY, rectX2, rectY2);
#if 0
Graphics::Surface sur;
- sur.create(map->size.x, map->size.y, Graphics::PixelFormat::createFormatCLUT8());
- sur.setPixels(map->data);
+ sur.create(map->_size.x, map->_size.y, Graphics::PixelFormat::createFormatCLUT8());
+ sur.setPixels(map->_data);
//sur.debugPrint();
g_system->copyRectToScreen(sur.getPixels(), sur.pitch, 0, 0, sur.w, sur.h);
g_system->updateScreen();
@@ -301,8 +301,8 @@ void maskTile(gPixelMap *map, int32 x, int32 y, int32 height, uint8 *srcData) {
}
void TBlit(gPixelMap *dstMap, gPixelMap *srcMap, int32 xpos, int32 ypos) {
- int16 w = srcMap->size.x;
- int16 h = srcMap->size.y;
+ int16 w = srcMap->_size.x;
+ int16 h = srcMap->_size.y;
int32 offset = 0;
if (ypos < 0) {
@@ -317,18 +317,18 @@ void TBlit(gPixelMap *dstMap, gPixelMap *srcMap, int32 xpos, int32 ypos) {
xpos = 0;
}
- if (w > dstMap->size.x - xpos)
- w = dstMap->size.x - xpos;
- if (h > dstMap->size.y - ypos)
- h = dstMap->size.y - ypos;
+ if (w > dstMap->_size.x - xpos)
+ w = dstMap->_size.x - xpos;
+ if (h > dstMap->_size.y - ypos)
+ h = dstMap->_size.y - ypos;
if (w < 0 || h < 0)
return;
- int16 dstMod = dstMap->size.x - w;
- int16 srcMod = srcMap->size.x - w;
+ int16 dstMod = dstMap->_size.x - w;
+ int16 srcMod = srcMap->_size.x - w;
- byte *srcPtr = srcMap->data + offset;
- byte *dstPtr = dstMap->data + xpos + ypos * dstMap->size.x;
+ byte *srcPtr = srcMap->_data + offset;
+ byte *dstPtr = dstMap->_data + xpos + ypos * dstMap->_size.x;
for (int16 y = 0; y < h; y++) {
for (int16 x = 0; x < w; x++) {
@@ -349,12 +349,12 @@ void TBlit4(gPixelMap *d, gPixelMap *s, int32 x, int32 y) {
}
void compositePixels(gPixelMap *compMap, gPixelMap *sprMap, int32 xpos, int32 ypos, byte *lookup) {
- byte *srcPtr = sprMap->data;
- byte *dstPtr = compMap->data + xpos + ypos * compMap->size.x;
- int16 rowMod = compMap->size.x - sprMap->size.x;
+ byte *srcPtr = sprMap->_data;
+ byte *dstPtr = compMap->_data + xpos + ypos * compMap->_size.x;
+ int16 rowMod = compMap->_size.x - sprMap->_size.x;
- for (int16 y = 0; y < sprMap->size.y; y++) {
- for (int16 x = 0; x < sprMap->size.x; x++) {
+ for (int16 y = 0; y < sprMap->_size.y; y++) {
+ for (int16 x = 0; x < sprMap->_size.x; x++) {
byte c = *srcPtr++;
if (c == 0)
@@ -367,15 +367,15 @@ void compositePixels(gPixelMap *compMap, gPixelMap *sprMap, int32 xpos, int32 yp
}
void compositePixelsRvs(gPixelMap *compMap, gPixelMap *sprMap, int32 xpos, int32 ypos, byte *lookup) {
- byte *srcPtr = sprMap->data + sprMap->bytes();
- byte *dstPtr = compMap->data + xpos + (ypos + sprMap->size.y) * compMap->size.x;
+ byte *srcPtr = sprMap->_data + sprMap->bytes();
+ byte *dstPtr = compMap->_data + xpos + (ypos + sprMap->_size.y) * compMap->_size.x;
- int16 rowMod = compMap->size.x + sprMap->size.x;
+ int16 rowMod = compMap->_size.x + sprMap->_size.x;
- for (int16 y = 0; y < sprMap->size.y; y++) {
+ for (int16 y = 0; y < sprMap->_size.y; y++) {
dstPtr -= rowMod;
- for (int16 x = 0; x < sprMap->size.x; x++) {
+ for (int16 x = 0; x < sprMap->_size.x; x++) {
byte c = *--srcPtr;
if (c == 0)
diff --git a/engines/saga2/button.cpp b/engines/saga2/button.cpp
index 8ab5a059509..4b27ca9aebe 100644
--- a/engines/saga2/button.cpp
+++ b/engines/saga2/button.cpp
@@ -319,13 +319,13 @@ void GfxSpriteImage::drawClipped(gPort &port,
// if there's a sprite present
gPixelMap map;
- //map.size = Point16( extent.height, extent.width );
- map.size = _sprPtr->size;
+ //map._size = Point16( extent.height, extent.width );
+ map._size = _sprPtr->size;
- map.data = (uint8 *)malloc(map.bytes() * sizeof(uint8));
- if (map.data == nullptr) return;
+ map._data = (uint8 *)malloc(map.bytes() * sizeof(uint8));
+ if (map._data == nullptr) return;
- memset(map.data, 0, map.bytes());
+ memset(map._data, 0, map.bytes());
// Render the sprite into the bitmap image sequence
ExpandColorMappedSprite(map, _sprPtr, _objColors);
@@ -333,9 +333,9 @@ void GfxSpriteImage::drawClipped(gPort &port,
port.setMode(drawModeMatte);
port.bltPixels(map, 0, 0,
_extent.x - offset.x, _extent.y - offset.y,
- map.size.x, map.size.y);
+ map._size.x, map._size.y);
- free(map.data);
+ free(map._data);
}
/* ===================================================================== *
diff --git a/engines/saga2/console.cpp b/engines/saga2/console.cpp
index 23d8ae06f3a..81112d4d4f4 100644
--- a/engines/saga2/console.cpp
+++ b/engines/saga2/console.cpp
@@ -408,13 +408,13 @@ bool Console::cmdDumpMap(int argc, const char **argv) {
debugPrintf("Usage: %s <Map Size Multiplier>\n", argv[0]);
else {
gPixelMap drawMap;
- drawMap.size = _vm->_tileDrawMap.size * atoi(argv[1]);
- drawMap.data = new uint8[drawMap.bytes()]();
+ drawMap._size = _vm->_tileDrawMap._size * atoi(argv[1]);
+ drawMap._data = new uint8[drawMap.bytes()]();
drawMetaTiles(drawMap);
Graphics::Surface sur;
- sur.create(drawMap.size.x, drawMap.size.y, Graphics::PixelFormat::createFormatCLUT8());
- sur.setPixels(drawMap.data);
+ sur.create(drawMap._size.x, drawMap._size.y, Graphics::PixelFormat::createFormatCLUT8());
+ sur.setPixels(drawMap._data);
Common::String pngFile = Common::String::format("%s-mapdump.png", _vm->getMetaEngine()->getName());
Common::DumpFile dump;
@@ -427,7 +427,7 @@ bool Console::cmdDumpMap(int argc, const char **argv) {
dump.close();
- delete[] drawMap.data;
+ delete[] drawMap._data;
}
return true;
diff --git a/engines/saga2/display.cpp b/engines/saga2/display.cpp
index 5980b62f8c5..806b1a3001e 100644
--- a/engines/saga2/display.cpp
+++ b/engines/saga2/display.cpp
@@ -249,7 +249,7 @@ void reDrawScreen() {
* ===================================================================== */
void blackOut() {
- g_vm->_mainPort.drawMode = drawModeReplace;
+ g_vm->_mainPort._drawMode = drawModeReplace;
g_vm->_mainPort.setColor(0); // fill screen with color
g_vm->_mainPort.fillRect(Rect16(0, 0, 640, 480));
g_vm->_pal->lightsOut();
diff --git a/engines/saga2/dispnode.cpp b/engines/saga2/dispnode.cpp
index fa3236f1368..24899c995ec 100644
--- a/engines/saga2/dispnode.cpp
+++ b/engines/saga2/dispnode.cpp
@@ -793,10 +793,10 @@ void DisplayNode::drawObject() {
Point16 indicatorCoords;
gPixelMap &indicator = *mouseCursors[kMouseCenterActorIndicatorImage];
- indicatorCoords.x = _hitBox.x + fineScroll.x + (_hitBox.width - indicator.size.x) / 2;
- indicatorCoords.y = _hitBox.y + fineScroll.y - indicator.size.y - 2;
+ indicatorCoords.x = _hitBox.x + fineScroll.x + (_hitBox.width - indicator._size.x) / 2;
+ indicatorCoords.y = _hitBox.y + fineScroll.y - indicator._size.y - 2;
- TBlit(g_vm->_backPort.map, &indicator, indicatorCoords.x, indicatorCoords.y);
+ TBlit(g_vm->_backPort._map, &indicator, indicatorCoords.x, indicatorCoords.y);
}
}
diff --git a/engines/saga2/document.cpp b/engines/saga2/document.cpp
index 485ebd5974f..e03d25209f5 100644
--- a/engines/saga2/document.cpp
+++ b/engines/saga2/document.cpp
@@ -561,10 +561,10 @@ void CDocument::renderText() {
if (NewTempPort(tPort, bltRect.width, bltRect.height)) {
// clear out the text buffer
int16 i, k;
- uint8 *buffer = (uint8 *)tPort.map->data;
+ uint8 *buffer = (uint8 *)tPort._map->_data;
- for (i = 0; i < tPort.map->size.x; i++) {
- for (k = 0; k < tPort.map->size.y; k++) {
+ for (i = 0; i < tPort._map->_size.x; i++) {
+ for (k = 0; k < tPort._map->_size.y; k++) {
*buffer++ = 0;
}
}
@@ -634,7 +634,7 @@ void CDocument::renderText() {
g_vm->_pointer->hide();
- port.bltPixels(*tPort.map, 0, 0,
+ port.bltPixels(*tPort._map, 0, 0,
bltRect.x, bltRect.y,
bltRect.width, bltRect.height);
diff --git a/engines/saga2/floating.cpp b/engines/saga2/floating.cpp
index c62017a23b2..fc5e05caa98 100644
--- a/engines/saga2/floating.cpp
+++ b/engines/saga2/floating.cpp
@@ -440,8 +440,8 @@ void gImageButton::drawClipped(gPort &port, const Point16 &offset, const Rect16
0,
_extent.x - offset.x,
_extent.y - offset.y,
- currentImage->size.x,
- currentImage->size.y);
+ currentImage->_size.x,
+ currentImage->_size.y);
}
/* ===================================================================== *
@@ -621,7 +621,7 @@ void updateWindowSection(const Rect16 &r) {
Point16 animOffset(kTileRectX - fineScroll.x, kTileRectY);
// Detects that program is shutting down and aborts the blit
- if (g_vm->_tileDrawMap.data == nullptr)
+ if (g_vm->_tileDrawMap._data == nullptr)
return;
if (!checkTileAreaPort()) return;
@@ -633,10 +633,10 @@ void updateWindowSection(const Rect16 &r) {
// Allocate a temporary pixel map and gPort
- tempMap.size.x = clip.width;
- tempMap.size.y = clip.height;
- tempMap.data = new uint8[tempMap.bytes()]();
- if (tempMap.data == nullptr)
+ tempMap._size.x = clip.width;
+ tempMap._size.y = clip.height;
+ tempMap._data = new uint8[tempMap.bytes()]();
+ if (tempMap._data == nullptr)
return;
tempPort.setMap(&tempMap);
@@ -693,7 +693,7 @@ void updateWindowSection(const Rect16 &r) {
clip.x, clip.y, clip.width, clip.height);
g_vm->_pointer->show(g_vm->_mainPort, clip);
g_vm->_mainPort.setMode(drawModeMatte);
- delete[] tempMap.data;
+ delete[] tempMap._data;
}
void drawFloatingWindows(gPort &port, const Point16 &offset, const Rect16 &clip) {
diff --git a/engines/saga2/gdraw.cpp b/engines/saga2/gdraw.cpp
index 4fd12f92ec8..1689d401d22 100644
--- a/engines/saga2/gdraw.cpp
+++ b/engines/saga2/gdraw.cpp
@@ -34,16 +34,16 @@ namespace Saga2 {
void gPort::setMap(gPixelMap *newmap, bool inverted) {
- map = newmap;
- clip = Rect16(0, 0, map->size.x, map->size.y);
+ _map = newmap;
+ _clip = Rect16(0, 0, _map->_size.x, _map->_size.y);
// Added by Talin to support inverted maps
if (inverted) {
- baseRow = map->data + map->bytes() - map->size.x;
- rowMod = -map->size.x;
+ _baseRow = _map->_data + _map->bytes() - _map->_size.x;
+ _rowMod = -_map->_size.x;
} else {
- baseRow = map->data;
- rowMod = map->size.x;
+ _baseRow = _map->_data;
+ _rowMod = _map->_size.x;
}
}
@@ -114,11 +114,11 @@ void gPort::setState(gPenState &state) {
**********************************************************************
*/
void gPort::getState(gPenState &state) {
- state.fgPen = fgPen;
- state.bgPen = bgPen;
- state.olPen = olPen;
- state.shPen = shPen;
- state.drawMode = drawMode;
+ state.fgPen = _fgPen;
+ state.bgPen = _bgPen;
+ state.olPen = _olPen;
+ state.shPen = _shPen;
+ state.drawMode = _drawMode;
}
/****** gdraw.cpp/gPort::fillRect *********************************
@@ -163,32 +163,32 @@ void gPort::getState(gPenState &state) {
void gPort::fillRect(const Rect16 r) {
Rect16 sect;
- sect = intersect(clip, r); // intersect with clip rect
- sect.x += origin.x; // apply origin translate
- sect.y += origin.y;
+ sect = intersect(_clip, r); // intersect with clip rect
+ sect.x += _origin.x; // apply origin translate
+ sect.y += _origin.y;
if (!sect.empty()) { // if result is non-empty
- uint8 *addr = baseRow + sect.y * rowMod + sect.x;
+ uint8 *addr = _baseRow + sect.y * _rowMod + sect.x;
- if (drawMode == drawModeComplement) { // Complement drawing mode
+ if (_drawMode == drawModeComplement) { // Complement drawing mode
for (int h = sect.height;
h > 0;
h--,
- addr += rowMod) {
+ addr += _rowMod) {
uint16 w = sect.width;
uint8 *put = addr;
- while (w--) *put++ ^= fgPen;
+ while (w--) *put++ ^= _fgPen;
}
} else {
- _FillRect(addr, rowMod, sect.width, sect.height, fgPen);
+ _FillRect(addr, _rowMod, sect.width, sect.height, _fgPen);
/*
for (int h = sect.height;
h > 0;
h--,
- addr += rowMod)
+ addr += _rowMod)
{
- memset( addr, fgPen, sect.width );
+ memset( addr, _fgPen, sect.width );
}
*/
}
@@ -287,20 +287,20 @@ void gPort::hLine(int16 x, int16 y, int16 width) {
// Temporarily convert the coords into a rectangle, for
// easy clipping
- sect = intersect(clip, Rect16(x, y, width, 1));
- sect.x += origin.x; // apply origin translate
- sect.y += origin.y;
+ sect = intersect(_clip, Rect16(x, y, width, 1));
+ sect.x += _origin.x; // apply origin translate
+ sect.y += _origin.y;
if (!sect.empty()) { // if result is non-empty
- if (drawMode == drawModeComplement) {
- uint8 *addr = baseRow + (y + origin.y) * rowMod + x + origin.x;
+ if (_drawMode == drawModeComplement) {
+ uint8 *addr = _baseRow + (y + _origin.y) * _rowMod + x + _origin.x;
- while (sect.width--) *addr++ ^= fgPen;
+ while (sect.width--) *addr++ ^= _fgPen;
} else {
- _HLine(baseRow + sect.y * rowMod + sect.x, sect.width, fgPen);
+ _HLine(_baseRow + sect.y * _rowMod + sect.x, sect.width, _fgPen);
- /* memset( baseRow + sect.y * rowMod + sect.x,
- fgPen,
+ /* memset( _baseRow + sect.y * _rowMod + sect.x,
+ _fgPen,
sect.width );
*/
}
@@ -349,25 +349,25 @@ void gPort::vLine(int16 x, int16 y, int16 height) {
// Just for laughs, we'll do the clipping a different way
- if (x < clip.x || x >= clip.x + clip.width) return;
- if (y < clip.y) y = clip.y;
- if (bottom > clip.y + clip.height) bottom = clip.y + clip.height;
+ if (x < _clip.x || x >= _clip.x + _clip.width) return;
+ if (y < _clip.y) y = _clip.y;
+ if (bottom > _clip.y + _clip.height) bottom = _clip.y + _clip.height;
// And now, draw the line
- if (drawMode == drawModeComplement) {
- for (addr = baseRow + (y + origin.y) * rowMod + x + origin.x;
+ if (_drawMode == drawModeComplement) {
+ for (addr = _baseRow + (y + _origin.y) * _rowMod + x + _origin.x;
y < bottom;
y++) {
- *addr ^= fgPen;
- addr += rowMod;
+ *addr ^= _fgPen;
+ addr += _rowMod;
}
} else {
- for (addr = baseRow + (y + origin.y) * rowMod + x + origin.x;
+ for (addr = _baseRow + (y + _origin.y) * _rowMod + x + _origin.x;
y < bottom;
y++) {
- *addr = fgPen;
- addr += rowMod;
+ *addr = _fgPen;
+ addr += _rowMod;
}
}
}
@@ -439,53 +439,53 @@ void gPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
int16 errTerm;
- int16 clipRight = clip.x + clip.width,
- clipBottom = clip.y + clip.height;
+ int16 clipRight = _clip.x + _clip.width,
+ clipBottom = _clip.y + _clip.height;
uint8 *addr;
if (x1 > x2) { // drawing left
- if (x1 < clip.x || x2 >= clipRight) return;
- if (x2 < clip.x || x1 >= clipRight) clipNeeded = true;
+ if (x1 < _clip.x || x2 >= clipRight) return;
+ if (x2 < _clip.x || x1 >= clipRight) clipNeeded = true;
xDir = xMove = -1; // amount to adjust address
xAbs = x1 - x2; // length of line
} else { // drawing right
- if (x2 < clip.x || x1 >= clipRight) return;
- if (x1 < clip.x || x2 >= clipRight) clipNeeded = true;
+ if (x2 < _clip.x || x1 >= clipRight) return;
+ if (x1 < _clip.x || x2 >= clipRight) clipNeeded = true;
xDir = xMove = 1; // amount to adjust address
xAbs = x2 - x1; // length of line
}
if (y1 > y2) { // drawing up
- if (y1 < clip.y || y2 >= clipBottom) return;
- if (y2 < clip.y || y1 >= clipBottom) clipNeeded = true;
+ if (y1 < _clip.y || y2 >= clipBottom) return;
+ if (y2 < _clip.y || y1 >= clipBottom) clipNeeded = true;
yDir = -1;
yAbs = y1 - y2;
- yMove = -rowMod;
+ yMove = -_rowMod;
} else { // drawing down
- if (y2 < clip.y || y1 >= clipBottom) return;
- if (y1 < clip.y || y2 >= clipBottom) clipNeeded = true;
+ if (y2 < _clip.y || y1 >= clipBottom) return;
+ if (y1 < _clip.y || y2 >= clipBottom) clipNeeded = true;
yDir = 1;
yAbs = y2 - y1;
- yMove = rowMod;
+ yMove = _rowMod;
}
- addr = baseRow + (y1 + origin.y) * rowMod + x1 + origin.x;
+ addr = _baseRow + (y1 + _origin.y) * _rowMod + x1 + _origin.x;
if (clipNeeded) { // clipping versions
if (xAbs > yAbs) {
errTerm = yAbs - (xAbs >> 1);
for (i = xAbs + 1; i > 0; i--) {
- if (x1 >= clip.x && x1 < clipRight
- && y1 >= clip.y && y1 < clipBottom) {
- if (drawMode == drawModeComplement)
- *addr ^= fgPen;
- else *addr = fgPen;
+ if (x1 >= _clip.x && x1 < clipRight
+ && y1 >= _clip.y && y1 < clipBottom) {
+ if (_drawMode == drawModeComplement)
+ *addr ^= _fgPen;
+ else *addr = _fgPen;
}
if (errTerm > 0) {
@@ -502,11 +502,11 @@ void gPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
errTerm = xAbs - (yAbs >> 1);
for (i = yAbs + 1; i > 0; i--) {
- if (x1 >= clip.x && x1 < clipRight
- && y1 >= clip.y && y1 < clipBottom) {
- if (drawMode == drawModeComplement)
- *addr ^= fgPen;
- else *addr = fgPen;
+ if (x1 >= _clip.x && x1 < clipRight
+ && y1 >= _clip.y && y1 < clipBottom) {
+ if (_drawMode == drawModeComplement)
+ *addr ^= _fgPen;
+ else *addr = _fgPen;
}
if (errTerm > 0) {
@@ -525,9 +525,9 @@ void gPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
errTerm = yAbs - (xAbs >> 1);
for (i = xAbs + 1; i > 0; i--) {
- if (drawMode == drawModeComplement)
- *addr ^= fgPen;
- else *addr = fgPen;
+ if (_drawMode == drawModeComplement)
+ *addr ^= _fgPen;
+ else *addr = _fgPen;
if (errTerm > 0) {
y1 += yDir;
@@ -543,9 +543,9 @@ void gPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
errTerm = xAbs - (yAbs >> 1);
for (i = yAbs + 1; i > 0; i--) {
- if (drawMode == drawModeComplement)
- *addr ^= fgPen;
- else *addr = fgPen;
+ if (_drawMode == drawModeComplement)
+ *addr ^= _fgPen;
+ else *addr = _fgPen;
if (errTerm > 0) {
x1 += xDir;
@@ -609,19 +609,19 @@ void gPort::bltPixels(
uint8 *src_line,
*dst_line;
- sect = intersect(clip, r);
+ sect = intersect(_clip, r);
if (!sect.empty()) { // if result is non-empty
src_x += sect.x - r.x;
src_y += sect.y - r.y;
- src_line = src.data + src_y * src.size.x + src_x;
- dst_line = baseRow
- + (sect.y + origin.y) * rowMod
- + sect.x + origin.x;
+ src_line = src._data + src_y * src._size.x + src_x;
+ dst_line = _baseRow
+ + (sect.y + _origin.y) * _rowMod
+ + sect.x + _origin.x;
- if (drawMode == drawModeMatte) { // Matte drawing mode
- for (int h = sect.height; h > 0; h--, src_line += src.size.x, dst_line += rowMod) {
+ if (_drawMode == drawModeMatte) { // Matte drawing mode
+ for (int h = sect.height; h > 0; h--, src_line += src._size.x, dst_line += _rowMod) {
uint8 *src_ptr = src_line,
*dst_ptr = dst_line;
@@ -632,13 +632,13 @@ void gPort::bltPixels(
dst_ptr++, src_ptr++;
}
}
- } else if (drawMode == drawModeColor) { // Color drawing mode
+ } else if (_drawMode == drawModeColor) { // Color drawing mode
// Draws single color, except where
for (int h = sect.height; // src pixels are transparent
h > 0;
h--,
- src_line += src.size.x,
- dst_line += rowMod) {
+ src_line += src._size.x,
+ dst_line += _rowMod) {
uint8 *src_ptr = src_line,
*dst_ptr = dst_line;
@@ -646,29 +646,29 @@ void gPort::bltPixels(
w > 0;
w--) {
if (*src_ptr++)
- *dst_ptr++ = fgPen;
+ *dst_ptr++ = _fgPen;
else
dst_ptr++;
}
}
- } else if (drawMode == drawModeReplace) { // Replacement drawing mode
- for (int h = sect.height; h > 0; h--, src_line += src.size.x, dst_line += rowMod) {
+ } else if (_drawMode == drawModeReplace) { // Replacement drawing mode
+ for (int h = sect.height; h > 0; h--, src_line += src._size.x, dst_line += _rowMod) {
memcpy(dst_line, src_line, sect.width);
}
- } else if (drawMode == drawModeComplement) { // Complement drawing mode
+ } else if (_drawMode == drawModeComplement) { // Complement drawing mode
// Inverts pixels, except where
for (int h = sect.height; // src is transparent
h > 0;
h--,
- src_line += src.size.x,
- dst_line += rowMod) {
+ src_line += src._size.x,
+ dst_line += _rowMod) {
uint8 *src_ptr = src_line,
*dst_ptr = dst_line;
for (int w = sect.width;
w > 0;
w--) {
- if (*src_ptr++) *dst_ptr++ ^= fgPen;
+ if (*src_ptr++) *dst_ptr++ ^= _fgPen;
else dst_ptr++;
}
}
@@ -735,24 +735,24 @@ void gPort::bltPixelMask(
*dst_line,
*msk_line;
- sect = intersect(clip, r);
+ sect = intersect(_clip, r);
if (!sect.empty()) { // if result is non-empty
src_x += sect.x - r.x;
src_y += sect.y - r.y;
- src_line = src.data + src_y * src.size.x + src_x;
- msk_line = msk.data + src_y * msk.size.x + src_x;
- dst_line = baseRow
- + (sect.y + origin.y) * rowMod
- + sect.x + origin.x;
+ src_line = src._data + src_y * src._size.x + src_x;
+ msk_line = msk._data + src_y * msk._size.x + src_x;
+ dst_line = _baseRow
+ + (sect.y + _origin.y) * _rowMod
+ + sect.x + _origin.x;
for (int h = sect.height;
h > 0;
h--,
- src_line += src.size.x,
- dst_line += rowMod,
- msk_line += msk.size.x) {
+ src_line += src._size.x,
+ dst_line += _rowMod,
+ msk_line += msk._size.x) {
uint8 *src_ptr = src_line,
*dst_ptr = dst_line,
*msk_ptr = msk_line;
@@ -817,15 +817,15 @@ void gPort::scrollPixels(
uint8 *src_ptr,
*dst_ptr;
- sect = intersect(clip, r);
+ sect = intersect(_clip, r);
if (dx == 0 && dy == 0) return;
if (!sect.empty()) { // if result is non-empty
uint16 w = sect.width,
h = sect.height,
- mod = rowMod;
- Point16 src(sect.x + origin.x, sect.y + origin.y),
- dst(sect.x + origin.x, sect.y + origin.y);
+ mod = _rowMod;
+ Point16 src(sect.x + _origin.x, sect.y + _origin.y),
+ dst(sect.x + _origin.x, sect.y + _origin.y);
if (dx > 0) {
dst.x += dx;
@@ -846,8 +846,8 @@ void gPort::scrollPixels(
if (w <= 0 || h <= 0) return;
if (src.y > dst.y || (src.y == dst.y && src.x > dst.x)) {
- src_ptr = baseRow + src.y * mod + src.x;
- dst_ptr = baseRow + dst.y * mod + dst.x;
+ src_ptr = _baseRow + src.y * mod + src.x;
+ dst_ptr = _baseRow + dst.y * mod + dst.x;
mod -= w;
@@ -857,8 +857,8 @@ void gPort::scrollPixels(
dst_ptr += mod;
}
} else {
- src_ptr = baseRow + (src.y + h - 1) * mod + src.x + w;
- dst_ptr = baseRow + (dst.y + h - 1) * mod + dst.x + w;
+ src_ptr = _baseRow + (src.y + h - 1) * mod + src.x + w;
+ dst_ptr = _baseRow + (dst.y + h - 1) * mod + dst.x + w;
mod -= w;
@@ -915,14 +915,14 @@ void gPort::scrollPixels(
*/
void mapImage(gPixelMap &from, gPixelMap &to, gPen map[]) {
int32 bytes = to.bytes();
- uint8 *get = from.data,
- *put = to.data;
+ uint8 *get = from._data,
+ *put = to._data;
while (bytes--) *put++ = map[*get++];
}
void mapImage(gPort &from, gPort &to, gPen map[]) {
- mapImage(*from.map, *to.map, map);
+ mapImage(*from._map, *to._map, map);
}
/* ======================================================================= *
@@ -969,9 +969,9 @@ bool NewTempPort(gPort &port, int width, int height) {
map = (gPixelMap *)TempAlloc(width * height + sizeof(gPixelMap));
if (map != nullptr) {
- map->data = (uint8 *)(map + 1);
- map->size.x = width;
- map->size.y = height;
+ map->_data = (uint8 *)(map + 1);
+ map->_size.x = width;
+ map->_size.y = height;
port.setMap(map);
return true;
} else
@@ -1006,8 +1006,8 @@ bool NewTempPort(gPort &port, int width, int height) {
**********************************************************************
*/
void DisposeTempPort(gPort &port) {
- if (port.map) TempFree(port.map);
- port.map = nullptr;
+ if (port._map) TempFree(port._map);
+ port._map = nullptr;
}
} // end of namespace Saga2
diff --git a/engines/saga2/gdraw.h b/engines/saga2/gdraw.h
index dcf79f4c7a5..6bc98c33a2c 100644
--- a/engines/saga2/gdraw.h
+++ b/engines/saga2/gdraw.h
@@ -55,16 +55,16 @@ struct StaticPixelMap {
class gPixelMap {
public:
- Extent16 size; // image size
- uint8 *data;
+ Extent16 _size; // image size
+ uint8 *_data;
- gPixelMap() : data(nullptr) {}
+ gPixelMap() : _data(nullptr) {}
- gPixelMap(StaticPixelMap m) : size(m.size), data(m.data) {}
+ gPixelMap(StaticPixelMap m) : _size(m.size), _data(m.data) {}
// Compute the number of bytes in the pixel map
int32 bytes() {
- return size.x * size.y;
+ return _size.x * _size.y;
}
};
@@ -75,13 +75,13 @@ public:
// constructors:
gStaticImage() {
- size.x = size.y = 0;
- data = NULL;
+ _size.x = _size.y = 0;
+ _data = NULL;
}
gStaticImage(int w, int h, uint8 *buffer) {
- size.x = w;
- size.y = h;
- data = buffer;
+ _size.x = w;
+ _size.y = h;
+ _data = buffer;
}
};
@@ -90,16 +90,16 @@ public:
// remap to a new palette by calling the global remap() function.
class gMappedImage : public gPixelMap {
- static gMappedImage *head; // first image in map chain
+ static gMappedImage *_head; // first image in map chain
- gMappedImage *next; // next image to remap
- gPixelMap original;
+ gMappedImage *_next; // next image to remap
+ gPixelMap _original;
public:
// Constructor and destructor
gMappedImage(int w, int h, uint8 *buffer);
virtual ~gMappedImage() {
- if (data) free(data);
+ if (_data) free(_data);
}
static void remap(gPen[]);
};
@@ -177,39 +177,39 @@ enum text_positions {
class gPort {
public:
- gPixelMap *map; // pointer to map
+ gPixelMap *_map; // pointer to map
// Added by Talin to speed up rendering and allow inverted
// gPorts for WinG compatibility
- uint8 *baseRow; // address of row 0
- int16 rowMod; // modulus or row
-
- Point16 origin; // origin drawing point
- Rect16 clip; // clip region DrawPort
- gPen fgPen, // current foregroung pen
- bgPen, // current drawing mode
- olPen, // text outline pen
- shPen; // text shadow pen
- gPen *penMap; // indirect pen map
- enum draw_modes drawMode; // current drawing mode
- Point16 penPos; // current pen position
- gFont *font; // current font
- int16 textSpacing; // extra space between characters
- uint16 textStyles; // text style bits
+ uint8 *_baseRow; // address of row 0
+ int16 _rowMod; // modulus or row
+
+ Point16 _origin; // origin drawing point
+ Rect16 _clip; // clip region DrawPort
+ gPen _fgPen, // current foregroung pen
+ _bgPen, // current drawing mode
+ _olPen, // text outline pen
+ _shPen; // text shadow pen
+ gPen *_penMap; // indirect pen map
+ enum draw_modes _drawMode; // current drawing mode
+ Point16 _penPos; // current pen position
+ gFont *_font; // current font
+ int16 _textSpacing; // extra space between characters
+ uint16 _textStyles; // text style bits
// Constructor
gPort() {
- map = nullptr;
- baseRow = nullptr;
+ _map = nullptr;
+ _baseRow = nullptr;
- rowMod = 0;
- penMap = nullptr;
- drawMode = drawModeMatte;
- font = nullptr;
- textSpacing = 0;
- textStyles = 0;
- fgPen = bgPen = olPen = shPen = 0;
+ _rowMod = 0;
+ _penMap = nullptr;
+ _drawMode = drawModeMatte;
+ _font = nullptr;
+ _textSpacing = 0;
+ _textStyles = 0;
+ _fgPen = _bgPen = _olPen = _shPen = 0;
}
virtual ~gPort() {}
@@ -221,43 +221,43 @@ public:
// Direct colors
void setColor(gPen color) {
- fgPen = color;
+ _fgPen = color;
}
void setBgColor(gPen color) {
- bgPen = color;
+ _bgPen = color;
}
void setShadowColor(gPen color) {
- shPen = color;
+ _shPen = color;
}
void setOutlineColor(gPen color) {
- olPen = color;
+ _olPen = color;
}
// Indirect colors
void setPenMap(gPen *pmap) {
- penMap = pmap;
+ _penMap = pmap;
}
void setIndirectColor(uint8 color) {
- fgPen = penMap[color];
+ _fgPen = _penMap[color];
}
void setIndirectBgColor(uint8 color) {
- bgPen = penMap[color];
+ _bgPen = _penMap[color];
}
void setIndirectShColor(uint8 color) {
- shPen = penMap[color];
+ _shPen = _penMap[color];
}
void setIndirectOLColor(uint8 color) {
- olPen = penMap[color];
+ _olPen = _penMap[color];
}
// modes & styles
void setMode(enum draw_modes mode) {
- drawMode = mode;
+ _drawMode = mode;
}
void setStyle(int style) {
- textStyles = style;
+ _textStyles = style;
}
// Pen states
@@ -268,41 +268,41 @@ public:
// REM: calc intersection of pixel map rect...
void setClip(const Rect16 &newclip) {
- clip = newclip;
+ _clip = newclip;
}
void getClip(Rect16 &r) {
- r = clip;
+ r = _clip;
}
void setOrigin(Point16 pt) {
- origin = pt;
+ _origin = pt;
}
Point16 getOrigin() {
- return origin;
+ return _origin;
}
// Pen position movement
void move(int16 x, int16 y) {
- penPos.x += x;
- penPos.y += y;
+ _penPos.x += x;
+ _penPos.y += y;
}
void move(Vector16 v) {
- penPos += v;
+ _penPos += v;
}
void moveTo(int16 x, int16 y) {
- penPos.x = x;
- penPos.y = y;
+ _penPos.x = x;
+ _penPos.y = y;
}
void moveTo(Point16 p) {
- penPos = p;
+ _penPos = p;
}
// Simple drawing functions
// REM: This should clip!
virtual void clear() {
- memset(map->data, (int)fgPen, (int)map->bytes());
+ memset(_map->_data, (int)_fgPen, (int)_map->bytes());
}
// Functions to set a single pixel
@@ -310,28 +310,28 @@ public:
// with drawing mode?
virtual void setPixel(int16 x, int16 y, gPen color) {
- if (x >= clip.x && x < clip.x + clip.width
- && y >= clip.y && y < clip.y + clip.height) {
- baseRow[(y + origin.y) * rowMod + x + origin.x] = color;
+ if (x >= _clip.x && x < _clip.x + _clip.width
+ && y >= _clip.y && y < _clip.y + _clip.height) {
+ _baseRow[(y + _origin.y) * _rowMod + x + _origin.x] = color;
}
}
void setPixel(int16 x, int16 y) {
- setPixel(x, y, fgPen);
+ setPixel(x, y, _fgPen);
}
void setPixel(Point16 p, gPen color) {
setPixel(p.x, p.y, color);
}
void setPixel(Point16 p) {
- setPixel(p.x, p.y, fgPen);
+ setPixel(p.x, p.y, _fgPen);
}
// pixel query functions
virtual gPen getPixel(int16 x, int16 y) {
- return baseRow[(y + origin.y) * rowMod + x + origin.x];
+ return _baseRow[(y + _origin.y) * _rowMod + x + _origin.x];
}
virtual gPen getPixel(Point16 p) {
- return baseRow[(p.y + origin.y) * rowMod + p.x + origin.x];
+ return _baseRow[(p.y + _origin.y) * _rowMod + p.x + _origin.x];
}
// Rectangle fill functions
@@ -359,22 +359,22 @@ public:
line(from.x, from.y, to.x, to.y);
}
void drawTo(int16 x, int16 y) {
- line(penPos.x, penPos.y, x, y);
- penPos.x = x;
- penPos.y = y;
+ line(_penPos.x, _penPos.y, x, y);
+ _penPos.x = x;
+ _penPos.y = y;
}
void drawTo(Point16 to) {
- line(penPos, to);
- penPos = to;
+ line(_penPos, to);
+ _penPos = to;
}
void draw(int16 x, int16 y) {
- line(penPos.x, penPos.y, penPos.x + x, penPos.y + y);
- penPos.x += x;
- penPos.y += y;
+ line(_penPos.x, _penPos.y, _penPos.x + x, _penPos.y + y);
+ _penPos.x += x;
+ _penPos.y += y;
}
void draw(Vector16 v) {
- line(penPos, v);
- penPos += v;
+ line(_penPos, v);
+ _penPos += v;
}
// Blitting functions
@@ -395,10 +395,10 @@ public:
// Text rendering functions
void setFont(gFont *newFont) {
- font = newFont;
+ _font = newFont;
}
void setTextSpacing(int16 fs) {
- textSpacing = fs;
+ _textSpacing = fs;
}
private:
diff --git a/engines/saga2/gpointer.cpp b/engines/saga2/gpointer.cpp
index ba9375780c8..42161f15960 100644
--- a/engines/saga2/gpointer.cpp
+++ b/engines/saga2/gpointer.cpp
@@ -52,8 +52,8 @@ gMousePointer::gMousePointer(gDisplayPort &port) {
}
gMousePointer::~gMousePointer() {
- if (saveMap.data)
- free(saveMap.data);
+ if (saveMap._data)
+ free(saveMap._data);
}
// Init & status check
@@ -167,19 +167,19 @@ void gMousePointer::setImage(
if (pointerImage != &img
|| x != offsetPosition.x
|| y != offsetPosition.y
- || img.size != saveMap.size) {
+ || img._size != saveMap._size) {
offsetPosition.x = x;
offsetPosition.y = y;
hide();
- if (saveMap.data)
- free(saveMap.data);
- saveMap.size = img.size;
- saveMap.data = (uint8 *)malloc(img.bytes());
+ if (saveMap._data)
+ free(saveMap._data);
+ saveMap._size = img._size;
+ saveMap._data = (uint8 *)malloc(img.bytes());
pointerImage = &img;
currentPosition = pos + offsetPosition;
- CursorMan.replaceCursor(img.data, img.size.x, img.size.y, -x, -y, 0);
+ CursorMan.replaceCursor(img._data, img._size.x, img._size.y, -x, -y, 0);
CursorMan.showMouse(true);
show();
}
diff --git a/engines/saga2/grabinfo.cpp b/engines/saga2/grabinfo.cpp
index 53a71a95d0f..01babeb3848 100644
--- a/engines/saga2/grabinfo.cpp
+++ b/engines/saga2/grabinfo.cpp
@@ -38,9 +38,9 @@ namespace Saga2 {
GrabInfo::GrabInfo() {
- pointerMap.size.x = 0;
- pointerMap.size.y = 0;
- pointerMap.data = nullptr;
+ pointerMap._size.x = 0;
+ pointerMap._size.y = 0;
+ pointerMap._data = nullptr;
// null out the "held" object
grabId = Nothing;
@@ -56,8 +56,8 @@ GrabInfo::GrabInfo() {
}
GrabInfo::~GrabInfo() {
- if (pointerMap.data != nullptr)
- delete[] pointerMap.data;
+ if (pointerMap._data != nullptr)
+ delete[] pointerMap._data;
}
// set the move count based on val and whether the object is
@@ -173,9 +173,9 @@ uint8 GrabInfo::setIntent(uint8 in) {
// Make the object given into the mouse pointer
void GrabInfo::setIcon() {
assert(
- pointerMap.size.x == 0
- && pointerMap.size.y == 0
- && pointerMap.data == nullptr);
+ pointerMap._size.x == 0
+ && pointerMap._size.y == 0
+ && pointerMap._data == nullptr);
assert(grabObj != nullptr && isObject(grabObj));
@@ -201,8 +201,8 @@ void GrabInfo::setIcon() {
// Build the current color table for the object
grabObj->getColorTranslation(mainColors);
- pointerMap.size = spr->size;
- pointerMap.data = mapData;
+ pointerMap._size = spr->size;
+ pointerMap._data = mapData;
pointerOffset.x = - spr->size.x / 2;
pointerOffset.y = - spr->size.y / 2;
@@ -216,11 +216,11 @@ void GrabInfo::setIcon() {
void GrabInfo::clearIcon() {
assert(grabObj == nullptr);
- if (pointerMap.data != nullptr) {
- delete[] pointerMap.data;
- pointerMap.size.x = 0;
- pointerMap.size.y = 0;
- pointerMap.data = nullptr;
+ if (pointerMap._data != nullptr) {
+ delete[] pointerMap._data;
+ pointerMap._size.x = 0;
+ pointerMap._size.y = 0;
+ pointerMap._data = nullptr;
}
}
diff --git a/engines/saga2/gtext.cpp b/engines/saga2/gtext.cpp
index 0c5a672ebda..b925315571a 100644
--- a/engines/saga2/gtext.cpp
+++ b/engines/saga2/gtext.cpp
@@ -30,9 +30,6 @@ namespace Saga2 {
#define textStyleBar (textStyleUnderBar|textStyleHiLiteBar)
-#define TempAlloc malloc
-#define TempFree free
-
/* ============================================================================ *
Text Blitting Routines
* ============================================================================ */
@@ -288,73 +285,73 @@ void gPort::drawStringChars(
int16 x; // current x position
uint8 *buffer, // buffer to render to
*uBuffer; // underline buffer
- uint16 drowMod = dest.size.x; // row modulus of dest
+ uint16 drowMod = dest._size.x; // row modulus of dest
int16 i; // loop index
- uint8 underbar = (textStyles & textStyleBar) != 0;
+ uint8 underbar = (_textStyles & textStyleBar) != 0;
bool underscore;
int16 underPos;
// the address to start rendering pixels to.
- underPos = font->baseLine + 2;
- if (underPos > font->height) underPos = font->height;
- buffer = dest.data + (ypos * drowMod);
+ underPos = _font->baseLine + 2;
+ if (underPos > _font->height) underPos = _font->height;
+ buffer = dest._data + (ypos * drowMod);
uBuffer = buffer + (underPos * drowMod);
// draw drop-shadow, if any
- if (textStyles & textStyleShadow) {
+ if (_textStyles & textStyleShadow) {
x = xpos - 1;
s = str;
- if (textStyles & textStyleOutline) { // if outlining
+ if (_textStyles & textStyleOutline) { // if outlining
for (i = 0; i < len; i++) {
drawchar = *s++; // draw thick drop shadow
- x += font->charKern[drawchar];
- DrawChar3x3Outline(font, drawchar, x, buffer, shPen, drowMod);
- x += font->charSpace[drawchar] + textSpacing;
+ x += _font->charKern[drawchar];
+ DrawChar3x3Outline(_font, drawchar, x, buffer, _shPen, drowMod);
+ x += _font->charSpace[drawchar] + _textSpacing;
}
- } else if (textStyles & textStyleThickOutline) { // if outlining
+ } else if (_textStyles & textStyleThickOutline) { // if outlining
for (i = 0; i < len; i++) {
drawchar = *s++; // draw thick drop shadow
- x += font->charKern[drawchar];
- DrawChar5x5Outline(font, drawchar, x, buffer, shPen, drowMod);
- x += font->charSpace[drawchar] + textSpacing;
+ x += _font->charKern[drawchar];
+ DrawChar5x5Outline(_font, drawchar, x, buffer, _shPen, drowMod);
+ x += _font->charSpace[drawchar] + _textSpacing;
}
} else {
for (i = 0; i < len; i++) {
drawchar = *s++; // draw thick drop shadow
- x += font->charKern[drawchar];
- DrawChar(font, drawchar, x, buffer + drowMod,
- shPen, drowMod);
- x += font->charSpace[drawchar] + textSpacing;
+ x += _font->charKern[drawchar];
+ DrawChar(_font, drawchar, x, buffer + drowMod,
+ _shPen, drowMod);
+ x += _font->charSpace[drawchar] + _textSpacing;
}
}
}
// draw outline, if any
- if (textStyles & textStyleOutline) { // if outlining
+ if (_textStyles & textStyleOutline) { // if outlining
x = xpos;
s = str;
for (i = 0; i < len; i++) {
drawchar = *s++; // draw thick text
- x += font->charKern[drawchar];
- DrawChar3x3Outline(font, drawchar, x, buffer - drowMod,
- olPen, drowMod);
- x += font->charSpace[drawchar] + textSpacing;
+ x += _font->charKern[drawchar];
+ DrawChar3x3Outline(_font, drawchar, x, buffer - drowMod,
+ _olPen, drowMod);
+ x += _font->charSpace[drawchar] + _textSpacing;
}
- } else if (textStyles & textStyleThickOutline) { // if thick outlining
+ } else if (_textStyles & textStyleThickOutline) { // if thick outlining
x = xpos;
s = str;
for (i = 0; i < len; i++) {
drawchar = *s++; // draw extra thick text
- x += font->charKern[drawchar];
- DrawChar5x5Outline(font, drawchar, x, buffer - drowMod * 2,
- olPen, drowMod);
- x += font->charSpace[drawchar] + textSpacing;
+ x += _font->charKern[drawchar];
+ DrawChar5x5Outline(_font, drawchar, x, buffer - drowMod * 2,
+ _olPen, drowMod);
+ x += _font->charSpace[drawchar] + _textSpacing;
}
}
@@ -362,24 +359,24 @@ void gPort::drawStringChars(
x = xpos;
s = str;
- underscore = textStyles & textStyleUnderScore ? true : false;
+ underscore = _textStyles & textStyleUnderScore ? true : false;
for (i = 0; i < len; i++) {
int16 last_x = x;
- uint8 color = fgPen;
+ uint8 color = _fgPen;
drawchar = *s++; // draw thick drop shadow
if (drawchar == '_' && underbar) {
len--;
drawchar = *s++;
- if (textStyles & textStyleUnderBar)
+ if (_textStyles & textStyleUnderBar)
underscore = true;
- if (textStyles & textStyleHiLiteBar)
- color = bgPen;
+ if (_textStyles & textStyleHiLiteBar)
+ color = _bgPen;
}
- x += font->charKern[drawchar];
- DrawChar(font, drawchar, x, buffer, color, drowMod);
- x += font->charSpace[drawchar] + textSpacing;
+ x += _font->charKern[drawchar];
+ DrawChar(_font, drawchar, x, buffer, color, drowMod);
+ x += _font->charSpace[drawchar] + _textSpacing;
if (underscore) { // draw underscore
uint8 *put = uBuffer + last_x;
@@ -389,7 +386,7 @@ void gPort::drawStringChars(
*put++ = color;
}
- if (!(textStyles & textStyleUnderScore))
+ if (!(_textStyles & textStyleUnderScore))
underscore = false;
}
}
@@ -407,7 +404,7 @@ int16 gPort::drawClippedString(
int16 clipWidth = 0, // width of clipped string
clipLen; // chars to draw
gPixelMap tempMap; // temp buffer for text
- uint8 underbar = (textStyles & textStyleBar) != 0;
+ uint8 underbar = (_textStyles & textStyleBar) != 0;
int16 xoff = 0, // offset for outlines
yoff = 0; // offset for outlines
int16 penMove = 0; // keep track of pen movement
@@ -423,16 +420,16 @@ int16 gPort::drawClippedString(
if (drawchar == '_' && underbar) {
drawchar = s[1];
- charwidth = font->charKern[drawchar]
- + font->charSpace[drawchar] + textSpacing;
+ charwidth = _font->charKern[drawchar]
+ + _font->charSpace[drawchar] + _textSpacing;
- if (xpos + charwidth >= clip.x)
+ if (xpos + charwidth >= _clip.x)
break;
s++;
} else {
- charwidth = font->charKern[drawchar]
- + font->charSpace[drawchar] + textSpacing;
- if (xpos + charwidth >= clip.x)
+ charwidth = _font->charKern[drawchar]
+ + _font->charSpace[drawchar] + _textSpacing;
+ if (xpos + charwidth >= _clip.x)
break;
}
@@ -453,17 +450,17 @@ int16 gPort::drawClippedString(
if (drawchar == '_' && underbar)
continue;
- clipWidth += font->charKern[drawchar]
- + font->charSpace[drawchar] + textSpacing;
+ clipWidth += _font->charKern[drawchar]
+ + _font->charSpace[drawchar] + _textSpacing;
- if (xpos > clip.x + clip.width)
+ if (xpos > _clip.x + _clip.width)
break;
}
// Handle special case of negative kern value of 1st character
- if (font->charKern[(byte)s[0]] < 0) {
- int16 kern = - font->charKern[(byte)s[0]];
+ if (_font->charKern[(byte)s[0]] < 0) {
+ int16 kern = - _font->charKern[(byte)s[0]];
clipWidth += kern; // increase size of map to render
xoff += kern; // offset text into map right
@@ -472,49 +469,49 @@ int16 gPort::drawClippedString(
// Set up a temporary bitmap to hold the string.
- tempMap.size.x = clipWidth;
- tempMap.size.y = font->height;
+ tempMap._size.x = clipWidth;
+ tempMap._size.y = _font->height;
// Adjust the size and positioning of the temp map due
// to text style effects.
- if (textStyles & textStyleOutline) {
+ if (_textStyles & textStyleOutline) {
xoff = yoff = 1;
xpos--;
ypos--;
- tempMap.size.x += 2;
- tempMap.size.y += 2;
- } else if (textStyles & textStyleThickOutline) {
+ tempMap._size.x += 2;
+ tempMap._size.y += 2;
+ } else if (_textStyles & textStyleThickOutline) {
xoff = yoff = 2;
xpos -= 2;
ypos -= 2;
- tempMap.size.x += 4;
- tempMap.size.y += 4;
+ tempMap._size.x += 4;
+ tempMap._size.y += 4;
}
- if (textStyles & (textStyleShadow | textStyleUnderScore | textStyleUnderBar)) {
- tempMap.size.x += 1;
- tempMap.size.y += 1;
+ if (_textStyles & (textStyleShadow | textStyleUnderScore | textStyleUnderBar)) {
+ tempMap._size.x += 1;
+ tempMap._size.y += 1;
}
- if (textStyles & textStyleItalics) {
- int n = (font->height - font->baseLine - 1) / 2;
+ if (_textStyles & textStyleItalics) {
+ int n = (_font->height - _font->baseLine - 1) / 2;
if (n > 0) xpos += n;
- tempMap.size.x += tempMap.size.y / 2;
+ tempMap._size.x += tempMap._size.y / 2;
}
// Allocate a temporary bitmap
if (tempMap.bytes() == 0)
return 0;
- tempMap.data = (uint8 *)TempAlloc(tempMap.bytes());
- if (tempMap.data != nullptr) {
+ tempMap._data = (uint8 *)malloc(tempMap.bytes());
+ if (tempMap._data != nullptr) {
// Fill the buffer with background pen if we're
// not doing a transparent blit.
- memset(tempMap.data,
- (drawMode == drawModeReplace) ? bgPen : 0,
+ memset(tempMap._data,
+ (_drawMode == drawModeReplace) ? _bgPen : 0,
tempMap.bytes());
// Draw the characters into the buffer
@@ -523,34 +520,34 @@ int16 gPort::drawClippedString(
// apply slant if italics
- if (textStyles & textStyleItalics) {
- int n = (font->height - font->baseLine - 1) / 2;
+ if (_textStyles & textStyleItalics) {
+ int n = (_font->height - _font->baseLine - 1) / 2;
int shift = (n > 0 ? n : 0);
- int flag = (font->height - font->baseLine - 1) & 1;
+ int flag = (_font->height - _font->baseLine - 1) & 1;
shift = -shift;
- for (int k = font->height - 1; k >= 0; k--) {
+ for (int k = _font->height - 1; k >= 0; k--) {
if (shift < 0) {
- uint8 *dest = tempMap.data + k * tempMap.size.x,
+ uint8 *dest = tempMap._data + k * tempMap._size.x,
*src = dest - shift;
int j;
- for (j = 0; j < tempMap.size.x + shift; j++) {
+ for (j = 0; j < tempMap._size.x + shift; j++) {
*dest++ = *src++;
}
- for (; j < tempMap.size.x; j++) {
+ for (; j < tempMap._size.x; j++) {
*dest++ = 0;
}
} else if (shift > 0) {
- uint8 *dest = tempMap.data + (k + 1) * tempMap.size.x,
+ uint8 *dest = tempMap._data + (k + 1) * tempMap._size.x,
*src = dest - shift;
int j;
- for (j = 0; j < tempMap.size.x - shift; j++) {
+ for (j = 0; j < tempMap._size.x - shift; j++) {
*--dest = *--src;
}
- for (; j < tempMap.size.x; j++) {
+ for (; j < tempMap._size.x; j++) {
*--dest = 0;
}
}
@@ -565,9 +562,9 @@ int16 gPort::drawClippedString(
bltPixels(tempMap, 0, 0,
xpos, ypos,
- tempMap.size.x, tempMap.size.y);
+ tempMap._size.x, tempMap._size.y);
- TempFree(tempMap.data);
+ free(tempMap._data);
}
// Now, we still need to scan the rest of the string
@@ -580,8 +577,8 @@ int16 gPort::drawClippedString(
if (drawchar == '_' && underbar)
continue;
- penMove += font->charKern[drawchar]
- + font->charSpace[drawchar] + textSpacing;
+ penMove += _font->charKern[drawchar]
+ + _font->charSpace[drawchar] + _textSpacing;
}
return penMove;
@@ -627,7 +624,7 @@ void gPort::drawText(
length = strlen(str);
if (length > 0)
- penPos.x += drawClippedString(str, length, penPos.x, penPos.y);
+ _penPos.x += drawClippedString(str, length, _penPos.x, _penPos.y);
}
/********* gtext.cpp/gPort::drawTextInBox *********************************
@@ -690,16 +687,16 @@ void gPort::drawTextInBox(
int16 height, width;
int16 x, y;
Rect16 newClip,
- saveClip = clip;
+ saveClip = _clip;
- if (!font)
+ if (!_font)
return;
- height = font->height;
- width = TextWidth(font, str, length, textStyles);
+ height = _font->height;
+ width = TextWidth(_font, str, length, _textStyles);
- if (textStyles & (textStyleUnderScore | textStyleUnderBar)) {
- if (font->baseLine + 2 >= font->height)
+ if (_textStyles & (textStyleUnderScore | textStyleUnderBar)) {
+ if (_font->baseLine + 2 >= _font->height)
height++;
}
@@ -723,7 +720,7 @@ void gPort::drawTextInBox(
// Calculate clipping region
- clip = intersect(clip, r);
+ _clip = intersect(_clip, r);
// Draw the text
@@ -732,7 +729,7 @@ void gPort::drawTextInBox(
// Restore the clipping region
- clip = saveClip;
+ _clip = saveClip;
}
// Attach to gFont?
diff --git a/engines/saga2/gtextbox.cpp b/engines/saga2/gtextbox.cpp
index 101621e7719..065d980391b 100644
--- a/engines/saga2/gtextbox.cpp
+++ b/engines/saga2/gtextbox.cpp
@@ -855,7 +855,7 @@ void gTextBox::handleTimerTick(int32 tick) {
SAVE_GPORT_STATE(port); // save pen color, etc.
g_vm->_pointer->hide(port, _extent); // hide mouse pointer
- port.setPenMap(port.penMap);
+ port.setPenMap(port._penMap);
port.setStyle(0);
port.setColor(blinkState ? blinkColor0 : blinkColor1);
port.fillRect(editRect.x + blinkX - ((blinkWide + 1) / 2), editRect.y + 1, blinkWide, editRect.height - 1);
@@ -906,7 +906,7 @@ void gTextBox::drawContents() {
if (hilit || editing) {
// fill in the editing field's background color
- editRectFill(tPort, port.penMap);
+ editRectFill(tPort, port._penMap);
}
if (selected) { // if panel is selected
@@ -974,7 +974,7 @@ void gTextBox::drawContents() {
// Blit the pixelmap to the main screen
port.setMode(drawModeMatte);
- port.bltPixels(*tPort.map, 0, 0,
+ port.bltPixels(*tPort._map, 0, 0,
editRect.x + 1, editRect.y + 1,
editRect.width, editRect.height);
blinkStart = 0;
@@ -1060,7 +1060,7 @@ void gTextBox::drawAll(gPort &port,
tempPort.setColor(fontColorFore);
// font
- oldFont = tempPort.font;
+ oldFont = tempPort._font;
tempPort.setFont(textFont);
@@ -1091,7 +1091,7 @@ void gTextBox::drawAll(gPort &port,
port.setMode(drawModeMatte);
- port.bltPixels(*tempPort.map, 0, 0,
+ port.bltPixels(*tempPort._map, 0, 0,
_extent.x + 1, _extent.y + 1,
bufRect.width, bufRect.height);
diff --git a/engines/saga2/intrface.cpp b/engines/saga2/intrface.cpp
index 74c313c275d..29a79e7c81a 100644
--- a/engines/saga2/intrface.cpp
+++ b/engines/saga2/intrface.cpp
@@ -426,7 +426,7 @@ void CPlaqText::draw() {
// save pen color, etc.
SAVE_GPORT_STATE(port);
- oldFont = port.font;
+ oldFont = port._font;
// setup the port
port.setMode(drawModeMatte);
@@ -878,8 +878,8 @@ CManaIndicator::CManaIndicator(gPanelList &list) : GfxCompImage(list,
}
// init the save map
- savedMap.size = Extent16(xSize, ySize);
- savedMap.data = new uint8[savedMap.bytes()];
+ savedMap._size = Extent16(xSize, ySize);
+ savedMap._data = new uint8[savedMap.bytes()];
}
CManaIndicator::~CManaIndicator() {
@@ -892,8 +892,8 @@ CManaIndicator::~CManaIndicator() {
g_vm->_imageCache->releaseImage(wellImage);
// release the saved map
- if (savedMap.data)
- delete[] savedMap.data;
+ if (savedMap._data)
+ delete[] savedMap._data;
}
// this method provides a rect for any of the six mana regions of the control
@@ -977,21 +977,21 @@ void CManaIndicator::drawClipped(gPort &port,
return;
// set the blit surface to a flat black
- memset(tempPort.map->data, 24, tempPort.map->bytes());
+ memset(tempPort._map->_data, 24, tempPort._map->bytes());
// draw the well
drawCompressedImage(tempPort, Point16(wellX, wellY), wellImage);
// make a mixing plane and blank it
- mixMap.size = Extent16(xSize, ySize);
- mixMap.data = new uint8[mixMap.bytes()]();
+ mixMap._size = Extent16(xSize, ySize);
+ mixMap._data = new uint8[mixMap.bytes()]();
// make a temp plane and blank it
- tempMap.size = Extent16(xSize, ySize);
- tempMap.data = new uint8[tempMap.bytes()]();
+ tempMap._size = Extent16(xSize, ySize);
+ tempMap._data = new uint8[tempMap.bytes()]();
// clear out the blit surfaces
- memset(mixMap.data, 0, mixMap.bytes());
- memset(tempMap.data, 0, tempMap.bytes());
+ memset(mixMap._data, 0, mixMap.bytes());
+ memset(tempMap._data, 0, tempMap.bytes());
// draw as glyph
tempPort.setMode(drawModeMatte);
@@ -1003,34 +1003,34 @@ void CManaIndicator::drawClipped(gPort &port,
ImageHeader *ringHdr = (ImageHeader *)ringImages[manaLines[i].ringImageIndex];
// set the buffer blit area to the image size
- starMap.size = starHdr->size;
- ringMap.size = ringHdr->size;
+ starMap._size = starHdr->size;
+ ringMap._size = ringHdr->size;
// see if it's compressed
if (starHdr->compress) {
// allocation of the temp buffer
- starMap.data = new uint8[starMap.bytes()]();
+ starMap._data = new uint8[starMap.bytes()]();
// if it is then upack it to spec'ed coords.
- unpackImage(&starMap, starMap.size.x, starMap.size.y, starHdr->data);
- } else starMap.data = (uint8 *)starHdr->data;
+ unpackImage(&starMap, starMap._size.x, starMap._size.y, starHdr->data);
+ } else starMap._data = (uint8 *)starHdr->data;
// see if it's compressed
if (ringHdr->compress) {
// allocation of the temp buffer
- ringMap.data = new uint8[ringMap.bytes()]();
+ ringMap._data = new uint8[ringMap.bytes()]();
// if it is then upack it to spec'ed coords.
- unpackImage(&ringMap, ringMap.size.x, ringMap.size.y, ringHdr->data);
- } else ringMap.data = (uint8 *)ringHdr->data;
+ unpackImage(&ringMap, ringMap._size.x, ringMap._size.y, ringHdr->data);
+ } else ringMap._data = (uint8 *)ringHdr->data;
// now blit the rings to the mixing surface
TBlit(&mixMap, &ringMap, manaLines[i].ringPos.x, manaLines[i].ringPos.y);
TBlit(&tempMap, &starMap, manaLines[i].starPos.x, manaLines[i].starPos.y);
// now do a peusdo-log additive thing to the images
- uint8 *dst = (uint8 *)mixMap.data;
- uint8 *src = (uint8 *)tempMap.data;
+ uint8 *dst = (uint8 *)mixMap._data;
+ uint8 *src = (uint8 *)tempMap._data;
// get the least common dinominator for size ( should be equal )
uint16 bufferSize = MIN(mixMap.bytes(), tempMap.bytes());
@@ -1050,29 +1050,29 @@ void CManaIndicator::drawClipped(gPort &port,
// for each color index possible, match correct color value
// at dest buffer
compositePixels(
- tempPort.map,
+ tempPort._map,
&mixMap,
0,
0,
manaColorMap[i]);
// clear out the mixing surfaces
- memset(mixMap.data, 0, mixMap.bytes());
- memset(tempMap.data, 0, tempMap.bytes());
+ memset(mixMap._data, 0, mixMap.bytes());
+ memset(tempMap._data, 0, tempMap.bytes());
// dispose the temporary gPixelMap
if (starHdr->compress)
- delete[] starMap.data;
+ delete[] starMap._data;
if (ringHdr->compress)
- delete[] ringMap.data;
+ delete[] ringMap._data;
}
// save this frame
- TBlit(&savedMap, tempPort.map, 0, 0);
+ TBlit(&savedMap, tempPort._map, 0, 0);
// Blit the pixelmap to the main screen
port.setMode(drawModeMatte);
- port.bltPixels(*tempPort.map, 0, 0,
+ port.bltPixels(*tempPort._map, 0, 0,
_extent.x - offset.x, _extent.y - offset.y,
xSize, ySize);
@@ -1081,10 +1081,10 @@ void CManaIndicator::drawClipped(gPort &port,
// dispose of temporary pixelmap
DisposeTempPort(tempPort);
- if (mixMap.data)
- delete[] mixMap.data;
- if (tempMap.data)
- delete[] tempMap.data;
+ if (mixMap._data)
+ delete[] mixMap._data;
+ if (tempMap._data)
+ delete[] tempMap._data;
g_vm->_pointer->show();
}
@@ -1346,7 +1346,7 @@ void writePlaqText(gPort &port,
va_list argptr;
Rect16 workRect;
int16 cnt;
- gFont *oldFont = port.font;
+ gFont *oldFont = port._font;
va_start(argptr, msg);
cnt = vsprintf(lineBuf, msg, argptr);
@@ -1397,7 +1397,7 @@ void writePlaqTextPos(gPort &port,
char lineBuf[128];
va_list argptr;
Point16 drawPos;
- gFont *oldFont = port.font;
+ gFont *oldFont = port._font;
va_start(argptr, msg);
vsprintf(lineBuf, msg, argptr);
diff --git a/engines/saga2/mouseimg.cpp b/engines/saga2/mouseimg.cpp
index 8fc6bdbb912..c26be411bf1 100644
--- a/engines/saga2/mouseimg.cpp
+++ b/engines/saga2/mouseimg.cpp
@@ -130,9 +130,9 @@ void initCursors() {
mouseImage = mouseCursors[kMouseArrowImage];
gaugeImage = new gPixelMap;
- gaugeImage->size.x = gaugeImageWidth;
- gaugeImage->size.y = gaugeImageHeight;
- gaugeImage->data = gaugeImageBuffer;
+ gaugeImage->_size.x = gaugeImageWidth;
+ gaugeImage->_size.y = gaugeImageHeight;
+ gaugeImage->_data = gaugeImageBuffer;
textImage = new gPixelMap;
combinedImage = new gPixelMap;
@@ -155,8 +155,8 @@ void createStackedImage(gPixelMap **newImage, int *newImageCenter, gPixelMap **i
*newImage = new gPixelMap;
- (*newImage)->size.x = 0;
- (*newImage)->size.y = 0;
+ (*newImage)->_size.x = 0;
+ (*newImage)->_size.y = 0;
*newImageCenter = 0;
for (int i = 0; i < images; i++) {
@@ -167,21 +167,21 @@ void createStackedImage(gPixelMap **newImage, int *newImageCenter, gPixelMap **i
for (int i = 0; i < images; i++) {
int16 rightImageBoundary;
- (*newImage)->size.y += imageArray[i]->size.y;
+ (*newImage)->_size.y += imageArray[i]->_size.y;
- rightImageBoundary = *newImageCenter + (imageArray[i]->size.x - imageCenterArray[i]);
+ rightImageBoundary = *newImageCenter + (imageArray[i]->_size.x - imageCenterArray[i]);
- if (rightImageBoundary > (*newImage)->size.x)
- (*newImage)->size.x = rightImageBoundary;
+ if (rightImageBoundary > (*newImage)->_size.x)
+ (*newImage)->_size.x = rightImageBoundary;
}
- (*newImage)->size.y += images - 1;
+ (*newImage)->_size.y += images - 1;
int newImageBytes = (*newImage)->bytes();
- (*newImage)->data = (uint8 *)malloc(newImageBytes) ;
+ (*newImage)->_data = (uint8 *)malloc(newImageBytes) ;
- memset((*newImage)->data, 0, newImageBytes);
+ memset((*newImage)->_data, 0, newImageBytes);
int newImageRow = 0;
for (int i = 0; i < images; i++) {
@@ -189,7 +189,7 @@ void createStackedImage(gPixelMap **newImage, int *newImageCenter, gPixelMap **i
TBlit((*newImage), currentImage, *newImageCenter - imageCenterArray[i], newImageRow);
- newImageRow += currentImage->size.y + 1;
+ newImageRow += currentImage->_size.y + 1;
}
}
@@ -198,8 +198,8 @@ void createStackedImage(gPixelMap **newImage, int *newImageCenter, gPixelMap **i
inline void disposeStackedImage(gPixelMap **image) {
if (*image) {
- free((*image)->data);
- (*image)->data = nullptr;
+ free((*image)->_data);
+ (*image)->_data = nullptr;
delete *image;
*image = nullptr;
@@ -212,7 +212,7 @@ inline void disposeStackedImage(gPixelMap **image) {
// image.
void cleanupMousePointer() {
- if (combinedImage->data != nullptr)
+ if (combinedImage->_data != nullptr)
disposeStackedImage(&combinedImage);
}
@@ -224,7 +224,7 @@ void setupMousePointer() {
int combinedImageCenter;
imageArray[0] = mouseImage;
- imageCenterArray[0] = mouseImage->size.x / 2;
+ imageCenterArray[0] = mouseImage->_size.x / 2;
if (mouseText[0] != '\0') {
imageArray[imageIndex] = textImage;
@@ -234,16 +234,16 @@ void setupMousePointer() {
if (showGauge) {
imageArray[imageIndex] = gaugeImage;
- imageCenterArray[imageIndex] = gaugeImage->size.x / 2;
+ imageCenterArray[imageIndex] = gaugeImage->_size.x / 2;
imageIndex++;
}
- if (combinedImage->data != nullptr)
+ if (combinedImage->_data != nullptr)
disposeStackedImage(&combinedImage);
createStackedImage(&combinedImage, &combinedImageCenter, imageArray, imageCenterArray, imageIndex);
- imageOffset.x = combinedImageCenter - mouseImage->size.x / 2;
+ imageOffset.x = combinedImageCenter - mouseImage->_size.x / 2;
imageOffset.y = 0;
// Set the combined image as the new mouse cursor
@@ -282,9 +282,9 @@ inline void disposeText() {
if (textImage == nullptr)
return;
- if (textImage->data != nullptr) {
- free(textImage->data);
- textImage->data = nullptr;
+ if (textImage->_data != nullptr) {
+ free(textImage->_data);
+ textImage->_data = nullptr;
}
}
@@ -298,14 +298,14 @@ void setNewText(char *text) {
Common::strlcpy(mouseText, text, maxMouseTextLen);
// Compute the size of the text bitmap
- textImage->size.y = mainFont->height + 2;
- textImage->size.x = TextWidth(mainFont, text, -1, 0) + 2;
+ textImage->_size.y = mainFont->height + 2;
+ textImage->_size.x = TextWidth(mainFont, text, -1, 0) + 2;
// Allocate a new buffer for the text image bitmap
int16 textImageBytes = textImage->bytes();
- textImage->data = (uint8 *)malloc(textImageBytes);
- memset(textImage->data, 0, textImageBytes);
+ textImage->_data = (uint8 *)malloc(textImageBytes);
+ memset(textImage->_data, 0, textImageBytes);
gPort textImagePort; // gPort used to draw text onto bitmap
@@ -325,12 +325,12 @@ void setNewText(char *text) {
Point16 mousePos;
g_vm->_pointer->getImageCurPos(mousePos);
- int mouseImageCenter = mousePos.x + mouseImageOffset.x + mouseImage->size.x / 2;
- textImageCenteredCol = textImage->size.x / 2;
+ int mouseImageCenter = mousePos.x + mouseImageOffset.x + mouseImage->_size.x / 2;
+ textImageCenteredCol = textImage->_size.x / 2;
if (mouseImageCenter - textImageCenteredCol < 5) {
textImageCenteredCol = mouseImageCenter - 5;
- } else if (mouseImageCenter + (textImage->size.x - textImageCenteredCol) >= screenWidth - 5) {
- textImageCenteredCol = textImage->size.x - ((screenWidth - 5) - mouseImageCenter);
+ } else if (mouseImageCenter + (textImage->_size.x - textImageCenteredCol) >= screenWidth - 5) {
+ textImageCenteredCol = textImage->_size.x - ((screenWidth - 5) - mouseImageCenter);
}
}
@@ -399,7 +399,7 @@ void setMouseGauge(int numerator, int denominator) {
for (int x = 0; x < gaugeImageWidth; x++) {
uint8 *gaugeMap = x < gaugePos + 1 ? gaugeColorMap : gaugeGrayMap;
- gaugeImageBuffer[gaugeImageIndex] = gaugeMap[mouseCursors[kMouseGaugeImage]->data[gaugeImageIndex]];
+ gaugeImageBuffer[gaugeImageIndex] = gaugeMap[mouseCursors[kMouseGaugeImage]->_data[gaugeImageIndex]];
gaugeImageIndex++;
}
diff --git a/engines/saga2/panel.cpp b/engines/saga2/panel.cpp
index ae11f56a502..9690d62c053 100644
--- a/engines/saga2/panel.cpp
+++ b/engines/saga2/panel.cpp
@@ -195,8 +195,8 @@ void gPanel::drawTitle(enum text_positions placement) {
if (imageLabel) {
img = (const gPixelMap *)title;
- r.width = img->size.x;
- r.height = img->size.y;
+ r.width = img->_size.x;
+ r.height = img->_size.y;
} else {
r.width = TextWidth(mainFont, title, -1, textStyleUnderBar);
r.height = mainFont->height;
@@ -400,7 +400,7 @@ gWindow::gWindow(const Rect16 &box, uint16 ident, const char saveName[], AppFunc
// Set up the window's gPort
windowPort.setFont(mainFont);
- windowPort.setPenMap(globalPort->penMap);
+ windowPort.setPenMap(globalPort->_penMap);
/* if (windowFeatures & windowBackSaved) // backsave data under window
{
@@ -500,11 +500,11 @@ void gWindow::setPos(Point16 pos) {
// We also need to set up the window's port in a similar fashion.
- windowPort.origin.x = _extent.x;
- windowPort.origin.y = _extent.y;
+ windowPort._origin.x = _extent.x;
+ windowPort._origin.y = _extent.y;
// set port's clip
- newClip = intersect(_extent, g_vm->_mainPort.clip);
+ newClip = intersect(_extent, g_vm->_mainPort._clip);
newClip.x -= _extent.x;
newClip.y -= _extent.y;
windowPort.setClip(newClip);
diff --git a/engines/saga2/playmode.cpp b/engines/saga2/playmode.cpp
index a996359fa47..b67e5f8784d 100644
--- a/engines/saga2/playmode.cpp
+++ b/engines/saga2/playmode.cpp
@@ -134,19 +134,19 @@ hResContext *imageRes; // image resource handle
// Initialize the Play mode
bool checkTileAreaPort() {
- if (g_vm->_gameRunning && g_vm->_tileDrawMap.data == nullptr) {
+ if (g_vm->_gameRunning && g_vm->_tileDrawMap._data == nullptr) {
// Allocate back buffer for tile rendering
- g_vm->_tileDrawMap.size.x = (kTileRectWidth + kTileWidth - 1) & ~kTileDXMask;
- g_vm->_tileDrawMap.size.y = (kTileRectHeight + kTileWidth - 1) & ~kTileDXMask;
- g_vm->_tileDrawMap.data = new uint8[g_vm->_tileDrawMap.bytes()]();
+ g_vm->_tileDrawMap._size.x = (kTileRectWidth + kTileWidth - 1) & ~kTileDXMask;
+ g_vm->_tileDrawMap._size.y = (kTileRectHeight + kTileWidth - 1) & ~kTileDXMask;
+ g_vm->_tileDrawMap._data = new uint8[g_vm->_tileDrawMap.bytes()]();
}
- return g_vm->_tileDrawMap.data != nullptr;
+ return g_vm->_tileDrawMap._data != nullptr;
}
void clearTileAreaPort() {
- if (g_vm->_gameRunning && g_vm->_tileDrawMap.data != nullptr) {
- _FillRect(g_vm->_tileDrawMap.data, g_vm->_tileDrawMap.size.x, g_vm->_tileDrawMap.size.x, g_vm->_tileDrawMap.size.y, 0);
+ if (g_vm->_gameRunning && g_vm->_tileDrawMap._data != nullptr) {
+ _FillRect(g_vm->_tileDrawMap._data, g_vm->_tileDrawMap._size.x, g_vm->_tileDrawMap._size.x, g_vm->_tileDrawMap._size.y, 0);
}
Rect16 rect(0, 0, 640, 480);
@@ -268,9 +268,9 @@ void PlayModeCleanup() {
CleanupUserControls();
// Deallocate back buffer for tile rendering
- if (g_vm->_tileDrawMap.data) {
- delete[] g_vm->_tileDrawMap.data;
- g_vm->_tileDrawMap.data = nullptr;
+ if (g_vm->_tileDrawMap._data) {
+ delete[] g_vm->_tileDrawMap._data;
+ g_vm->_tileDrawMap._data = nullptr;
}
if (objPointerMap.data) {
@@ -305,26 +305,26 @@ void drawCompressedImage(gPort &port, const Point16 pos, void *image) {
ImageHeader *hdr = (ImageHeader *)image;
gPixelMap map;
- map.size = hdr->size;
+ map._size = hdr->size;
if (hdr->compress) {
- map.data = new uint8[map.bytes()];
- if (map.data == nullptr)
+ map._data = new uint8[map.bytes()];
+ if (map._data == nullptr)
return;
- unpackImage(&map, map.size.x, map.size.y, hdr->data);
+ unpackImage(&map, map._size.x, map._size.y, hdr->data);
} else
- map.data = (uint8 *)hdr->data;
+ map._data = (uint8 *)hdr->data;
port.setMode(drawModeMatte);
port.bltPixels(map, 0, 0,
pos.x, pos.y,
- map.size.x, map.size.y);
+ map._size.x, map._size.y);
if (hdr->compress)
- delete[] map.data;
+ delete[] map._data;
}
void drawCompressedImageGhosted(gPort &port, const Point16 pos, void *image) {
@@ -333,27 +333,27 @@ void drawCompressedImageGhosted(gPort &port, const Point16 pos, void *image) {
uint8 *row;
int16 x, y;
- map.size = hdr->size;
+ map._size = hdr->size;
- map.data = new uint8[map.bytes()];
- if (map.data == nullptr)
+ map._data = new uint8[map.bytes()];
+ if (map._data == nullptr)
return;
if (hdr->compress)
- unpackImage(&map, map.size.x, map.size.y, hdr->data);
+ unpackImage(&map, map._size.x, map._size.y, hdr->data);
else
- memcpy(map.data, hdr->data, map.bytes());
+ memcpy(map._data, hdr->data, map.bytes());
- for (y = 0, row = map.data; y < map.size.y; y++, row += map.size.x) {
- for (x = (y & 1); x < map.size.x; x += 2) row[x] = 0;
+ for (y = 0, row = map._data; y < map._size.y; y++, row += map._size.x) {
+ for (x = (y & 1); x < map._size.x; x += 2) row[x] = 0;
}
port.setMode(drawModeMatte);
port.bltPixels(map, 0, 0,
pos.x, pos.y,
- map.size.x, map.size.y);
+ map._size.x, map._size.y);
- delete[] map.data;
+ delete[] map._data;
}
void drawCompressedImageToMap(gPixelMap &map, void *image) {
@@ -361,14 +361,14 @@ void drawCompressedImageToMap(gPixelMap &map, void *image) {
ImageHeader *hdr = (ImageHeader *)image;
// set the buffer blit area to the image size
- map.size = hdr->size;
+ map._size = hdr->size;
// see if it's compressed
if (hdr->compress) {
// if it is then upack it to spec'ed coords.
- unpackImage(&map, map.size.x, map.size.y, hdr->data);
+ unpackImage(&map, map._size.x, map._size.y, hdr->data);
} else
- map.data = (uint8 *)hdr->data;
+ map._data = (uint8 *)hdr->data;
}
diff --git a/engines/saga2/speech.cpp b/engines/saga2/speech.cpp
index a5b76fe61c2..8fc6944e93d 100644
--- a/engines/saga2/speech.cpp
+++ b/engines/saga2/speech.cpp
@@ -330,13 +330,13 @@ bool Speech::setupActive() {
// Compute height of bitmap based on number of lines of text.
// Include 4 for outline width
bounds.height =
- (speechLineCount * (_textPort.font->height + lineLeading))
+ (speechLineCount * (_textPort._font->height + lineLeading))
+ outlineWidth * 2;
// Blit to temp bitmap
- _speechImage.size.x = bounds.width;
- _speechImage.size.y = bounds.height;
- _speechImage.data = new uint8[_speechImage.bytes()]();
+ _speechImage._size.x = bounds.width;
+ _speechImage._size.y = bounds.height;
+ _speechImage._data = new uint8[_speechImage.bytes()]();
_textPort.setMap(&_speechImage);
y = outlineWidth; // Plus 2 for Outlines
@@ -374,7 +374,7 @@ bool Speech::setupActive() {
_textPort.bltPixels(
BulletImage, 0, 0,
- _textPort.penPos.x, _textPort.penPos.y + 1,
+ _textPort._penPos.x, _textPort._penPos.y + 1,
BulletImage.size.x, BulletImage.size.y);
_textPort.move(bulletWidth, 0);
@@ -392,7 +392,7 @@ bool Speech::setupActive() {
lineText += dChars;
}
- y += _textPort.font->height + lineLeading;
+ y += _textPort._font->height + lineLeading;
}
if (speechButtonCount > 0) {
@@ -521,8 +521,8 @@ void Speech::dispose() {
wakeUpThread(thread, selectedButton);
// De-allocate the speech data
- delete[] _speechImage.data;
- _speechImage.data = nullptr;
+ delete[] _speechImage._data;
+ _speechImage._data = nullptr;
// Clear the number of active buttons
speechLineCount = speechButtonCount = 0;
@@ -556,7 +556,7 @@ void updateSpeech() {
sp->setupActive();
// If speech failed to set up, then skip it
- if (sp->_speechImage.data == nullptr) {
+ if (sp->_speechImage._data == nullptr) {
sp->dispose();
return;
}
@@ -677,8 +677,8 @@ int16 buttonWrap(
// Add to pixel length
charPixels
- = textPort.font->charKern[c]
- + textPort.font->charSpace[c];
+ = textPort._font->charKern[c]
+ + textPort._font->charSpace[c];
}
linePixels += charPixels;
@@ -733,8 +733,8 @@ int16 buttonWrap(
} else { // Any other character
// Add to pixel length
charPixels
- = textPort.font->charKern[c]
- + textPort.font->charSpace[c];
+ = textPort._font->charKern[c]
+ + textPort._font->charSpace[c];
}
buttonPixels += charPixels;
@@ -770,7 +770,7 @@ int16 pickButton(
|| buttonCount < 1) // no buttons defined
return 0;
- pickLine = pt.y / (textPort.font->height + lineLeading);
+ pickLine = pt.y / (textPort._font->height + lineLeading);
if (pickLine >= numLines) return 0;
// Strange algorithm:
@@ -1065,7 +1065,7 @@ APPFUNC(cmdClickSpeech) {
case gEventMouseDown:
if ((sp = speechList.currentActive()) != nullptr) {
- sp->selectedButton = pickSpeechButton(ev.mouse, sp->_speechImage.size.x, sp->_textPort);
+ sp->selectedButton = pickSpeechButton(ev.mouse, sp->_speechImage._size.x, sp->_textPort);
}
break;
diff --git a/engines/saga2/sprite.cpp b/engines/saga2/sprite.cpp
index 849f762780f..2e4a1b89da0 100644
--- a/engines/saga2/sprite.cpp
+++ b/engines/saga2/sprite.cpp
@@ -193,10 +193,10 @@ void DrawCompositeMaskedSprite(
// Build a temporary bitmap to composite the sprite within
- compMap.size.x = xMax - xMin;
- compMap.size.y = yMax - yMin;
- compMap.data = (uint8 *)getQuickMem(compMap.bytes());
- memset(compMap.data, 0, compMap.bytes());
+ compMap._size.x = xMax - xMin;
+ compMap._size.y = yMax - yMin;
+ compMap._data = (uint8 *)getQuickMem(compMap.bytes());
+ memset(compMap._data, 0, compMap.bytes());
// Calculate the offset from the upper-left corner of
// our composite map to the origin point where the sprites
@@ -213,9 +213,9 @@ void DrawCompositeMaskedSprite(
// Create a temp map for the sprite to unpack in
- sprMap.size = sp->size;
- if (sprMap.size.x <= 0 || sprMap.size.y <= 0) continue;
- sprMap.data = (uint8 *)getQuickMem(compMap.bytes());
+ sprMap._size = sp->size;
+ if (sprMap._size.x <= 0 || sprMap._size.y <= 0) continue;
+ sprMap._data = (uint8 *)getQuickMem(compMap.bytes());
// Unpack the sprite into the temp map
@@ -238,7 +238,7 @@ void DrawCompositeMaskedSprite(
org.y + sc->offset.y + sp->offset.y,
sc->colorTable);
}
- freeQuickMem(sprMap.data);
+ freeQuickMem(sprMap._data);
}
// do terrain masking
@@ -254,10 +254,10 @@ void DrawCompositeMaskedSprite(
visiblePixels;
bool isObscured;
- tempMap.size = compMap.size;
- tempMap.data = (uint8 *)getQuickMem(compMapBytes);
+ tempMap._size = compMap._size;
+ tempMap._data = (uint8 *)getQuickMem(compMapBytes);
- memcpy(tempMap.data, compMap.data, compMapBytes);
+ memcpy(tempMap._data, compMap._data, compMapBytes);
drawTileMask(
Point16(xMin, yMin),
@@ -266,7 +266,7 @@ void DrawCompositeMaskedSprite(
visiblePixels = 0;
for (int i = 0; i < compMapBytes; i++) {
- if (compMap.data[i] != 0) {
+ if (compMap._data[i] != 0) {
visiblePixels++;
if (visiblePixels > 10) break;
}
@@ -274,24 +274,24 @@ void DrawCompositeMaskedSprite(
isObscured = visiblePixels <= 10;
if (isObscured) {
- memcpy(compMap.data, tempMap.data, compMapBytes);
+ memcpy(compMap._data, tempMap._data, compMapBytes);
effects |= sprFXGhosted;
}
if (obscured != nullptr) *obscured = isObscured;
- freeQuickMem(tempMap.data);
+ freeQuickMem(tempMap._data);
}
}
// Check if location is underwater
if (loc.z < 0) {
- uint8 *submergedArea = &compMap.data[(-loc.z < compMap.size.y ?
- (compMap.size.y + loc.z)
- * compMap.size.x :
+ uint8 *submergedArea = &compMap._data[(-loc.z < compMap._size.y ?
+ (compMap._size.y + loc.z)
+ * compMap._size.x :
0)];
- uint16 submergedSize = &compMap.data[compMap.bytes()] -
+ uint16 submergedSize = &compMap._data[compMap.bytes()] -
submergedArea;
memset(submergedArea, 0, submergedSize);
@@ -299,12 +299,12 @@ void DrawCompositeMaskedSprite(
// Add in "ghost" effects
if (effects & sprFXGhosted) {
- uint32 *dstRow = (uint32 *)compMap.data;
+ uint32 *dstRow = (uint32 *)compMap._data;
uint32 mask = (yMin & 1) ? 0xff00ff00 : 0x00ff00ff;
- for (y = 0; y < compMap.size.y; y++) {
- for (x = 0; x < compMap.size.x; x += 4) {
+ for (y = 0; y < compMap._size.y; y++) {
+ for (x = 0; x < compMap._size.x; x += 4) {
*dstRow++ &= mask;
}
mask = ~mask;
@@ -313,9 +313,9 @@ void DrawCompositeMaskedSprite(
// Blit to the port
- TBlit(port.map, &compMap, xMin, yMin);
+ TBlit(port._map, &compMap, xMin, yMin);
- freeQuickMem(compMap.data);
+ freeQuickMem(compMap._data);
}
void DrawSprite(
@@ -325,8 +325,8 @@ void DrawSprite(
gPixelMap sprMap; // sprite map
// Create a temp map for the sprite to unpack in
- sprMap.size = sp->size;
- sprMap.data = (uint8 *)getQuickMem(sprMap.bytes());
+ sprMap._size = sp->size;
+ sprMap._data = (uint8 *)getQuickMem(sprMap.bytes());
// Unpack the sprite into the temp map
unpackSprite(&sprMap, sp->_data, sp->_dataSize);
@@ -337,9 +337,9 @@ void DrawSprite(
0, 0,
destPoint.x + sp->offset.x,
destPoint.y + sp->offset.y,
- sprMap.size.x, sprMap.size.y);
+ sprMap._size.x, sprMap._size.y);
- freeQuickMem(sprMap.data);
+ freeQuickMem(sprMap._data);
}
// Draw a single sprite with no masking, but with color mapping.
@@ -353,15 +353,15 @@ void DrawColorMappedSprite(
sprReMap; // remapped sprite map
// Create a temp map for the sprite to unpack in
- sprMap.size = sp->size;
- sprMap.data = (uint8 *)getQuickMem(sprMap.bytes());
- sprReMap.size = sp->size;
- sprReMap.data = (uint8 *)getQuickMem(sprReMap.bytes());
+ sprMap._size = sp->size;
+ sprMap._data = (uint8 *)getQuickMem(sprMap.bytes());
+ sprReMap._size = sp->size;
+ sprReMap._data = (uint8 *)getQuickMem(sprReMap.bytes());
// Unpack the sprite into the temp map
unpackSprite(&sprMap, sp->_data, sp->_dataSize);
- memset(sprReMap.data, 0, sprReMap.bytes());
+ memset(sprReMap._data, 0, sprReMap.bytes());
// remap the sprite to the color table given
compositePixels(
@@ -377,10 +377,10 @@ void DrawColorMappedSprite(
0, 0,
destPoint.x + sp->offset.x,
destPoint.y + sp->offset.y,
- sprReMap.size.x, sprReMap.size.y);
+ sprReMap._size.x, sprReMap._size.y);
- freeQuickMem(sprReMap.data);
- freeQuickMem(sprMap.data);
+ freeQuickMem(sprReMap._data);
+ freeQuickMem(sprMap._data);
}
// Draw a single sprite with no masking, but with color mapping.
@@ -393,8 +393,8 @@ void ExpandColorMappedSprite(
sprReMap; // remapped sprite map
// Create a temp map for the sprite to unpack in
- sprMap.size = sp->size;
- sprMap.data = (uint8 *)getQuickMem(sprMap.bytes());
+ sprMap._size = sp->size;
+ sprMap._data = (uint8 *)getQuickMem(sprMap.bytes());
// Unpack the sprite into the temp map
unpackSprite(&sprMap, sp->_data, sp->_dataSize);
@@ -407,7 +407,7 @@ void ExpandColorMappedSprite(
0,
colorTable);
- freeQuickMem(sprMap.data);
+ freeQuickMem(sprMap._data);
}
// Unpacks a sprite for a moment and returns the value of a
@@ -422,20 +422,20 @@ uint8 GetSpritePixel(
uint8 result;
// Create a temp map for the sprite to unpack in
- sprMap.size = sp->size;
- sprMap.data = (uint8 *)getQuickMem(sprMap.bytes());
+ sprMap._size = sp->size;
+ sprMap._data = (uint8 *)getQuickMem(sprMap.bytes());
// Unpack the sprite into the temp map
unpackSprite(&sprMap, sp->_data, sp->_dataSize);
// Map the coords to the bitmap and return the pixel
if (flipped) {
- result = sprMap.data[testPoint.y * sprMap.size.x
- + sprMap.size.x - testPoint.x];
+ result = sprMap._data[testPoint.y * sprMap._size.x
+ + sprMap._size.x - testPoint.x];
} else {
- result = sprMap.data[testPoint.y * sprMap.size.x + testPoint.x];
+ result = sprMap._data[testPoint.y * sprMap._size.x + testPoint.x];
}
- freeQuickMem(sprMap.data);
+ freeQuickMem(sprMap._data);
return result;
}
@@ -472,14 +472,14 @@ uint16 visiblePixelsInSprite(
xMax = (xMax + 31) & ~31;
// Build a temporary bitmap to composite the sprite within
- compMap.size.x = xMax - xMin;
- compMap.size.y = yMax - yMin;
- compMap.data = (uint8 *)getQuickMem(compBytes = compMap.bytes());
- memset(compMap.data, 0, compBytes);
+ compMap._size.x = xMax - xMin;
+ compMap._size.y = yMax - yMin;
+ compMap._data = (uint8 *)getQuickMem(compBytes = compMap.bytes());
+ memset(compMap._data, 0, compBytes);
// Build bitmap in which to unpack the sprite
- sprMap.size = sp->size;
- sprMap.data = (uint8 *)getQuickMem(sprMap.bytes());
+ sprMap._size = sp->size;
+ sprMap._data = (uint8 *)getQuickMem(sprMap.bytes());
unpackSprite(&sprMap, sp->_data, sp->_dataSize);
@@ -512,15 +512,15 @@ uint16 visiblePixelsInSprite(
// count the visible pixels in the composite map
for (i = 0, visiblePixels = 0; i < compBytes; i++)
- if (compMap.data[i]) visiblePixels++;
+ if (compMap._data[i]) visiblePixels++;
#if DEBUG*0
WriteStatusF(8, "Visible pixels = %u", visiblePixels);
#endif
- freeQuickMem(sprMap.data);
+ freeQuickMem(sprMap._data);
- freeQuickMem(compMap.data);
+ freeQuickMem(compMap._data);
return visiblePixels;
}
diff --git a/engines/saga2/tile.cpp b/engines/saga2/tile.cpp
index 1f453c2ec65..c21b07c8e46 100644
--- a/engines/saga2/tile.cpp
+++ b/engines/saga2/tile.cpp
@@ -2510,7 +2510,7 @@ inline void drawMetaRow(gPixelMap &drawMap, TilePoint coords, Point16 pos) {
int16 layerLimit;
for (;
- pos.x < drawMap.size.x + kMetaDX;
+ pos.x < drawMap._size.x + kMetaDX;
coords.u++,
coords.v--,
uOrg += kPlatformWidth,
@@ -2577,7 +2577,7 @@ inline void drawMetaRow(gPixelMap &drawMap, TilePoint coords, Point16 pos) {
p->highestPixel = kTileHeight * (kPlatformWidth - 1) + kMaxTileHeight * 2 + 64;
if (pos.y <= 0
- || pos.y - p->highestPixel >= drawMap.size.y)
+ || pos.y - p->highestPixel >= drawMap._size.y)
continue;
*put++ = p;
@@ -2813,7 +2813,7 @@ void drawMetaTiles(gPixelMap &drawMap) {
// (replace 256 constant with better value)
for (;
- metaPos.y < drawMap.size.y + kMetaTileHeight * 4 ;
+ metaPos.y < drawMap._size.y + kMetaTileHeight * 4 ;
baseCoords.u--,
baseCoords.v--
) {
@@ -2954,8 +2954,8 @@ void maskPlatform(
int16 vOrg) { // for TAG search
int16 u, v;
- int16 right = sMap.size.x,
- bottom = sMap.size.y;
+ int16 right = sMap._size.x,
+ bottom = sMap._size.y;
Point16 tilePos;
@@ -3087,7 +3087,7 @@ void maskMetaRow(
int16 layerLimit;
for (;
- pos.x < sMap.size.x + kMetaDX;
+ pos.x < sMap._size.x + kMetaDX;
coords.u++,
coords.v--,
relLoc.u += kPlatUVSize,
@@ -3156,7 +3156,7 @@ void maskMetaRow(
p->highestPixel = kTileHeight * (kPlatformWidth - 1) + kMaxTileHeight + 192;
if (pos.y <= 0
- || pos.y - p->highestPixel >= sMap.size.y)
+ || pos.y - p->highestPixel >= sMap._size.y)
continue;
*put++ = p;
@@ -3221,7 +3221,7 @@ void drawTileMask(
// (replace 256 constant with better value)
for (;
- metaPos.y < sMap.size.y + kMetaTileHeight * 4 ;
+ metaPos.y < sMap._size.y + kMetaTileHeight * 4 ;
baseCoords.u--,
baseCoords.v--
) {
@@ -4415,7 +4415,7 @@ void updateMainDisplay() {
void drawMainDisplay() {
- // draws tiles to g_vm->_tileDrawMap.data
+ // draws tiles to g_vm->_tileDrawMap._data
drawMetaTiles(g_vm->_tileDrawMap);
// Draw sprites onto back buffer
@@ -4433,10 +4433,10 @@ void drawMainDisplay() {
// Blit it all onto the screen
drawPage->writePixels(
rect,
- g_vm->_tileDrawMap.data
+ g_vm->_tileDrawMap._data
+ fineScroll.x
- + fineScroll.y * g_vm->_tileDrawMap.size.x,
- g_vm->_tileDrawMap.size.x);
+ + fineScroll.y * g_vm->_tileDrawMap._size.x,
+ g_vm->_tileDrawMap._size.x);
updateFrameCount();
}
diff --git a/engines/saga2/tileload.cpp b/engines/saga2/tileload.cpp
index b9f7554c127..996b7daedc7 100644
--- a/engines/saga2/tileload.cpp
+++ b/engines/saga2/tileload.cpp
@@ -68,8 +68,8 @@ void drawPlatform(
int16 uOrg, // for TAG search
int16 vOrg) { // for TAG search
- int16 right = drawMap.size.x,
- bottom = drawMap.size.y;
+ int16 right = drawMap._size.x,
+ bottom = drawMap._size.y;
Point16 tilePos;
diff --git a/engines/saga2/towerfta.cpp b/engines/saga2/towerfta.cpp
index 09f33a9a29f..c4be01048ed 100644
--- a/engines/saga2/towerfta.cpp
+++ b/engines/saga2/towerfta.cpp
@@ -258,10 +258,10 @@ TERMINATOR(termDisplayPort) {
INITIALIZER(initPanelSystem) {
initPanels(g_vm->_mainPort);
- if (g_vm->_mainPort.map == nullptr) {
+ if (g_vm->_mainPort._map == nullptr) {
gPixelMap *tmap = new gPixelMap;
- tmap->size = Point16(screenWidth, screenHeight);
- tmap->data = new uint8[tmap->bytes()];
+ tmap->_size = Point16(screenWidth, screenHeight);
+ tmap->_data = new uint8[tmap->bytes()];
g_vm->_mainPort.setMap(tmap);
}
return true;
diff --git a/engines/saga2/vbacksav.cpp b/engines/saga2/vbacksav.cpp
index aaf3cf7384b..94c515d3bda 100644
--- a/engines/saga2/vbacksav.cpp
+++ b/engines/saga2/vbacksav.cpp
@@ -37,10 +37,10 @@ gBackSave::gBackSave(const Rect16 &extent) {
// Set up the image structure for the video page
- savedPixels.size.x = savedRegion.width;
- savedPixels.size.y = savedRegion.height;
-// savedPixels.data = (uint8 *)malloc( savedPixels.bytes() );
- savedPixels.data = (uint8 *)malloc(savedPixels.bytes());
+ savedPixels._size.x = savedRegion.width;
+ savedPixels._size.y = savedRegion.height;
+// savedPixels._data = (uint8 *)malloc( savedPixels.bytes() );
+ savedPixels._data = (uint8 *)malloc(savedPixels.bytes());
// Initialize the graphics port
@@ -65,7 +65,7 @@ gBackSave::gBackSave(const Rect16 &extent) {
**********************************************************************
*/
gBackSave::~gBackSave() {
- free(savedPixels.data);
+ free(savedPixels._data);
}
/********* vbacksav.cpp/gBackSave::save ******************************
@@ -83,10 +83,10 @@ gBackSave::~gBackSave() {
**********************************************************************
*/
void gBackSave::save(gDisplayPort &port) {
- if (!saved && savedPixels.data) {
+ if (!saved && savedPixels._data) {
port.protoPage.readPixels(savedRegion,
- savedPixels.data,
- savedPixels.size.x);
+ savedPixels._data,
+ savedPixels._size.x);
saved = true;
}
}
@@ -106,10 +106,10 @@ void gBackSave::save(gDisplayPort &port) {
**********************************************************************
*/
void gBackSave::restore(gDisplayPort &port) {
- if (saved && savedPixels.data) {
+ if (saved && savedPixels._data) {
port.protoPage.writePixels(savedRegion,
- savedPixels.data,
- savedPixels.size.x);
+ savedPixels._data,
+ savedPixels._size.x);
saved = false;
}
}
diff --git a/engines/saga2/vbacksav.h b/engines/saga2/vbacksav.h
index 0b0d07ceaa6..4b2f973b2cd 100644
--- a/engines/saga2/vbacksav.h
+++ b/engines/saga2/vbacksav.h
@@ -49,7 +49,7 @@ public:
savedRegion.y = pos.y;
}
bool valid() {
- return savedPixels.data != NULL;
+ return savedPixels._data != NULL;
}
};
diff --git a/engines/saga2/vdraw.h b/engines/saga2/vdraw.h
index 837f3ad993a..428d65b6f46 100644
--- a/engines/saga2/vdraw.h
+++ b/engines/saga2/vdraw.h
@@ -42,7 +42,7 @@ public:
void fillRect(const Rect16 r);
void clear() {
- protoPage.fillRect(clip, fgPen);
+ protoPage.fillRect(_clip, _fgPen);
}
// Blitting functions
diff --git a/engines/saga2/vwdraw.cpp b/engines/saga2/vwdraw.cpp
index ded1539fd7c..c06e5f3713c 100644
--- a/engines/saga2/vwdraw.cpp
+++ b/engines/saga2/vwdraw.cpp
@@ -36,15 +36,15 @@ vDisplayPage *drawPage;
void gDisplayPort::fillRect(const Rect16 r) {
Rect16 sect;
- sect = intersect(clip, r); // intersect with clip rect
- sect.x += origin.x; // apply origin translate
- sect.y += origin.y;
+ sect = intersect(_clip, r); // intersect with clip rect
+ sect.x += _origin.x; // apply origin translate
+ sect.y += _origin.y;
if (!sect.empty()) { // if result is non-empty
- if (drawMode == drawModeComplement) // Complement drawing mode
- protoPage.invertRect(sect, fgPen);
+ if (_drawMode == drawModeComplement) // Complement drawing mode
+ protoPage.invertRect(sect, _fgPen);
else
- protoPage.fillRect(sect, fgPen); // regular drawing mode
+ protoPage.fillRect(sect, _fgPen); // regular drawing mode
}
}
@@ -62,34 +62,34 @@ void gDisplayPort::bltPixels(
sect;
uint8 *src_line;
- if (clip.empty())
- clip = Rect16(0, 0, map->size.x, map->size.y);
- sect = intersect(clip, r);
+ if (_clip.empty())
+ _clip = Rect16(0, 0, _map->_size.x, _map->_size.y);
+ sect = intersect(_clip, r);
if (!sect.empty()) { // if result is non-empty
src_x += sect.x - r.x;
src_y += sect.y - r.y;
- src_line = src.data + src_y * src.size.x + src_x;
+ src_line = src._data + src_y * src._size.x + src_x;
- sect.x += origin.x;
- sect.y += origin.y;
+ sect.x += _origin.x;
+ sect.y += _origin.y;
- switch (drawMode) {
+ switch (_drawMode) {
case drawModeMatte: // use transparency
- protoPage.writeTransPixels(sect, src_line, src.size.x);
+ protoPage.writeTransPixels(sect, src_line, src._size.x);
break;
case drawModeReplace: // don't use transparency
- protoPage.writePixels(sect, src_line, src.size.x);
+ protoPage.writePixels(sect, src_line, src._size.x);
break;
case drawModeColor: // solid color, use transparency
- protoPage.writeColorPixels(sect, src_line, src.size.x, fgPen);
+ protoPage.writeColorPixels(sect, src_line, src._size.x, _fgPen);
break;
case drawModeComplement: // blit in complement mode
- protoPage.writeComplementPixels(sect, src_line, src.size.x, fgPen);
+ protoPage.writeComplementPixels(sect, src_line, src._size.x, _fgPen);
break;
default:
- error("bltPixels: Unknown drawMode: %d", drawMode);
+ error("bltPixels: Unknown drawMode: %d", _drawMode);
}
}
}
@@ -103,15 +103,15 @@ void gDisplayPort::scrollPixels(
if (dx == 0 && dy == 0) // quit of nothing to do
return;
- sect = intersect(clip, r); // apply cliping rect
+ sect = intersect(_clip, r); // apply cliping rect
if (!sect.empty()) { // if result is non-empty
Rect16 srcRect,
dstRect;
gPixelMap tempMap;
- sect.x += origin.x;
- sect.y += origin.y;
+ sect.x += _origin.x;
+ sect.y += _origin.y;
srcRect = dstRect = sect; // make copies of rect
if (dx > 0) {
@@ -137,21 +137,21 @@ void gDisplayPort::scrollPixels(
// Allocate temp map to hold scrolled pixels
- tempMap.size.x = srcRect.width;
- tempMap.size.y = srcRect.height;
- tempMap.data = (uint8 *)malloc(tempMap.bytes());
+ tempMap._size.x = srcRect.width;
+ tempMap._size.y = srcRect.height;
+ tempMap._data = (uint8 *)malloc(tempMap.bytes());
#if 0
- if (!tempMap.data) fatal("Out of memory.\n");
+ if (!tempMap._data) fatal("Out of memory.\n");
#endif
// Blit scrolled pixels to system ram and back to SVGA
- protoPage.readPixels(srcRect, tempMap.data, tempMap.size.x);
- protoPage.writePixels(dstRect, tempMap.data, tempMap.size.x);
+ protoPage.readPixels(srcRect, tempMap._data, tempMap._size.x);
+ protoPage.writePixels(dstRect, tempMap._data, tempMap._size.x);
// dispose of temp pixel map
- free(tempMap.data);
+ free(tempMap._data);
}
}
@@ -205,7 +205,7 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
yMove = protoPage.size.x;
}
- if (clipNeeded) { // clipping versions
+ if (_clipNeeded) { // clipping versions
if (xAbs > yAbs) {
errTerm = yAbs - (xAbs >> 1);
@@ -242,7 +242,7 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
}
}
- offset = (y1 + origin.y) * protoPage.size.x + x1 + origin.x;
+ offset = (y1 + _origin.y) * protoPage.size.x + x1 + _origin.x;
bank = offset >> 16;
protoPage.setWriteBank(bank);
@@ -258,8 +258,8 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
if (drawMode == drawModeComplement) {
svgaWriteAddr[offset]
- = svgaReadAddr[offset] ^ fgPen;
- } else svgaWriteAddr[offset] = fgPen;
+ = svgaReadAddr[offset] ^ _fgPen;
+ } else svgaWriteAddr[offset] = _fgPen;
if (errTerm >= 0) {
y1 += yDir;
@@ -292,8 +292,8 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
if (drawMode == drawModeComplement) {
svgaWriteAddr[offset]
- = svgaReadAddr[offset] ^ fgPen;
- } else svgaWriteAddr[offset] = fgPen;
+ = svgaReadAddr[offset] ^ _fgPen;
+ } else svgaWriteAddr[offset] = _fgPen;
if (errTerm >= 0) {
x1 += xDir;
@@ -319,7 +319,7 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
}
}
} else { // non-clipping versions
- offset = (y1 + origin.y) * protoPage.size.x + x1 + origin.x;
+ offset = (y1 + _origin.y) * protoPage.size.x + x1 + _origin.x;
bank = offset >> 16;
@@ -333,8 +333,8 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
for (i = xAbs + 1; i > 0; i--) {
if (drawMode == drawModeComplement) {
svgaWriteAddr[offset]
- = svgaReadAddr[offset] ^ fgPen;
- } else svgaWriteAddr[offset] = fgPen;
+ = svgaReadAddr[offset] ^ _fgPen;
+ } else svgaWriteAddr[offset] = _fgPen;
if (errTerm >= 0) {
y1 += yDir;
@@ -364,8 +364,8 @@ void gDisplayPort::line(int16 x1, int16 y1, int16 x2, int16 y2) {
for (i = yAbs + 1; i > 0; i--) {
if (drawMode == drawModeComplement) {
svgaWriteAddr[offset]
- = svgaReadAddr[offset] ^ fgPen;
- } else svgaWriteAddr[offset] = fgPen;
+ = svgaReadAddr[offset] ^ _fgPen;
+ } else svgaWriteAddr[offset] = _fgPen;
if (errTerm >= 0) {
x1 += xDir;
Commit: b590a8af7465e1d1ee219156e8dc6417d5c67078
https://github.com/scummvm/scummvm/commit/b590a8af7465e1d1ee219156e8dc6417d5c67078
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:25+02:00
Commit Message:
SAGA2: Rename class variables in gpointer.h
Changed paths:
engines/saga2/gpointer.cpp
engines/saga2/gpointer.h
diff --git a/engines/saga2/gpointer.cpp b/engines/saga2/gpointer.cpp
index 42161f15960..6542b358aef 100644
--- a/engines/saga2/gpointer.cpp
+++ b/engines/saga2/gpointer.cpp
@@ -31,29 +31,29 @@
namespace Saga2 {
gMousePointer::gMousePointer(gDisplayPort &port) {
- hideCount = 0; // pointer not hidden
+ _hideCount = 0; // pointer not hidden
// initialize coords
- offsetPosition.x = offsetPosition.y = 0;
- currentPosition.x = currentPosition.y = 0;
+ _offsetPosition.x = _offsetPosition.y = 0;
+ _currentPosition.x = _currentPosition.y = 0;
// a backsave extent of 0 means not saved
- saveExtent.width = saveExtent.height = 0;
- shown = 0;
+ _saveExtent.width = _saveExtent.height = 0;
+ _shown = 0;
// set up the backsave port
- savePort.setMap(&saveMap);
- savePort.setMode(drawModeReplace);
+ _savePort.setMap(&_saveMap);
+ _savePort.setMode(drawModeReplace);
- videoPort = &port;
+ _videoPort = &port;
// no imagery at this time.
- pointerImage = nullptr;
+ _pointerImage = nullptr;
}
gMousePointer::~gMousePointer() {
- if (saveMap._data)
- free(saveMap._data);
+ if (_saveMap._data)
+ free(_saveMap._data);
}
// Init & status check
@@ -63,38 +63,38 @@ bool gMousePointer::init(Point16 pointerLimits) {
// Private routine to draw the mouse pointer image
void gMousePointer::draw() {
- if (hideCount < 1) {
+ if (_hideCount < 1) {
CursorMan.showMouse(true);
- shown = 1;
+ _shown = 1;
} else
- shown = 0;
+ _shown = 0;
}
// Private routine to restore the mouse pointer image
void gMousePointer::restore() {
- if (shown) {
+ if (_shown) {
// blit from the saved map to the current position.
CursorMan.showMouse(false);
// A height of zero means backsave is invalid
- shown = 0;
+ _shown = 0;
}
}
// Makes the mouse pointer visible
void gMousePointer::show() {
- assert(hideCount > 0);
+ assert(_hideCount > 0);
- if (--hideCount == 0) {
+ if (--_hideCount == 0) {
draw();
}
}
// Makes the mouse pointer invisible
void gMousePointer::hide() {
- if (hideCount++ == 0) {
+ if (_hideCount++ == 0) {
restore();
}
}
@@ -106,8 +106,8 @@ void gMousePointer::show(gPort &port, Rect16 r) {
r.x += org.x;
r.y += org.y;
- if (saveExtent.overlap(r)) {
- if (--hideCount == 0) {
+ if (_saveExtent.overlap(r)) {
+ if (--_hideCount == 0) {
draw();
}
@@ -117,15 +117,15 @@ void gMousePointer::show(gPort &port, Rect16 r) {
// Makes the mouse pointer visible
int gMousePointer::manditoryShow() {
int rv = 0;
- while (hideCount > 0) {
+ while (_hideCount > 0) {
show();
rv++;
}
- while (hideCount < 0) {
+ while (_hideCount < 0) {
hide();
rv--;
}
- if (!shown)
+ if (!_shown)
draw();
return rv;
}
@@ -138,8 +138,8 @@ void gMousePointer::hide(gPort &port, Rect16 r) {
r.x += org.x;
r.y += org.y;
- if (saveExtent.overlap(r)) {
- if (hideCount++ == 0) {
+ if (_saveExtent.overlap(r)) {
+ if (_hideCount++ == 0) {
restore();
CursorMan.showMouse(false);
}
@@ -148,11 +148,11 @@ void gMousePointer::hide(gPort &port, Rect16 r) {
// Moves the mouse pointer to a new position
void gMousePointer::move(Point16 pos) {
- Point16 offsetPos = pos + offsetPosition;
+ Point16 offsetPos = pos + _offsetPosition;
- if (offsetPos != currentPosition) {
+ if (offsetPos != _currentPosition) {
restore();
- currentPosition = offsetPos;
+ _currentPosition = offsetPos;
draw();
}
}
@@ -162,22 +162,22 @@ void gMousePointer::setImage(
gPixelMap &img,
int x,
int y) {
- Point16 pos = currentPosition - offsetPosition;
+ Point16 pos = _currentPosition - _offsetPosition;
- if (pointerImage != &img
- || x != offsetPosition.x
- || y != offsetPosition.y
- || img._size != saveMap._size) {
- offsetPosition.x = x;
- offsetPosition.y = y;
+ if (_pointerImage != &img
+ || x != _offsetPosition.x
+ || y != _offsetPosition.y
+ || img._size != _saveMap._size) {
+ _offsetPosition.x = x;
+ _offsetPosition.y = y;
hide();
- if (saveMap._data)
- free(saveMap._data);
- saveMap._size = img._size;
- saveMap._data = (uint8 *)malloc(img.bytes());
- pointerImage = &img;
- currentPosition = pos + offsetPosition;
+ if (_saveMap._data)
+ free(_saveMap._data);
+ _saveMap._size = img._size;
+ _saveMap._data = (uint8 *)malloc(img.bytes());
+ _pointerImage = &img;
+ _currentPosition = pos + _offsetPosition;
CursorMan.replaceCursor(img._data, img._size.x, img._size.y, -x, -y, 0);
CursorMan.showMouse(true);
diff --git a/engines/saga2/gpointer.h b/engines/saga2/gpointer.h
index 674a95918f5..6d531cf83b2 100644
--- a/engines/saga2/gpointer.h
+++ b/engines/saga2/gpointer.h
@@ -31,15 +31,15 @@
namespace Saga2 {
class gMousePointer {
- gPixelMap *pointerImage, // pointer to current mouse image
- saveMap; // memory to backsave to
- gPort savePort; // port to save to
- gDisplayPort *videoPort; // port to render to
- Rect16 saveExtent; // extent of backsave
- int16 hideCount; // mouse hiding nesting level
- Point16 currentPosition, // where real coords are
- offsetPosition; // center of mouse image
- bool shown; // mouse currently shown
+ gPixelMap *_pointerImage, // pointer to current mouse image
+ _saveMap; // memory to backsave to
+ gPort _savePort; // port to save to
+ gDisplayPort *_videoPort; // port to render to
+ Rect16 _saveExtent; // extent of backsave
+ int16 _hideCount; // mouse hiding nesting level
+ Point16 _currentPosition, // where real coords are
+ _offsetPosition; // center of mouse image
+ bool _shown; // mouse currently shown
void draw();
void restore();
@@ -59,22 +59,22 @@ public:
void move(Point16 pos); // move the pointer
void setImage(gPixelMap &img, int x, int y); // set the pointer imagery
bool isShown() {
- return shown;
+ return _shown;
}
int16 hideDepth() {
- return hideCount;
+ return _hideCount;
}
gPixelMap *getImage(Point16 &offset) {
- offset = offsetPosition;
- return pointerImage;
+ offset = _offsetPosition;
+ return _pointerImage;
}
gPixelMap *getImageCurPos(Point16 &curPos) {
- curPos = currentPosition;
- return pointerImage;
+ curPos = _currentPosition;
+ return _pointerImage;
}
gPixelMap *getSaveMap(Rect16 &save) {
- save = saveExtent;
- return &saveMap;
+ save = _saveExtent;
+ return &_saveMap;
}
};
Commit: c64a61dbd7f7e68a26ead819625e70f72bbdb3fb
https://github.com/scummvm/scummvm/commit/c64a61dbd7f7e68a26ead819625e70f72bbdb3fb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:26+02:00
Commit Message:
SAGA2: Rename class variables in grabinfo.h
Changed paths:
engines/saga2/grabinfo.cpp
engines/saga2/grabinfo.h
diff --git a/engines/saga2/grabinfo.cpp b/engines/saga2/grabinfo.cpp
index 01babeb3848..197331acb61 100644
--- a/engines/saga2/grabinfo.cpp
+++ b/engines/saga2/grabinfo.cpp
@@ -38,36 +38,36 @@ namespace Saga2 {
GrabInfo::GrabInfo() {
- pointerMap._size.x = 0;
- pointerMap._size.y = 0;
- pointerMap._data = nullptr;
+ _pointerMap._size.x = 0;
+ _pointerMap._size.y = 0;
+ _pointerMap._data = nullptr;
// null out the "held" object
- grabId = Nothing;
- grabObj = nullptr;
- intentDoable = true;
- intention = WalkTo;
+ _grabId = Nothing;
+ _grabObj = nullptr;
+ _intentDoable = true;
+ _intention = WalkTo;
- textBuf[0] = '\0';
- displayGauge = false;
+ _textBuf[0] = '\0';
+ _displayGauge = false;
- gaugeNumerator = gaugeDenominator = 0;
- moveCount = 1;
+ _gaugeNumerator = _gaugeDenominator = 0;
+ _moveCount = 1;
}
GrabInfo::~GrabInfo() {
- if (pointerMap._data != nullptr)
- delete[] pointerMap._data;
+ if (_pointerMap._data != nullptr)
+ delete[] _pointerMap._data;
}
// set the move count based on val and whether the object is
// mergeable or not.
void GrabInfo::setMoveCount(int16 val) {
- if (grabObj) {
- if (grabObj->proto()->flags & ResourceObjectPrototype::objPropMergeable) {
- moveCount = val;
+ if (_grabObj) {
+ if (_grabObj->proto()->flags & ResourceObjectPrototype::objPropMergeable) {
+ _moveCount = val;
} else {
- moveCount = 1;
+ _moveCount = 1;
}
}
}
@@ -89,23 +89,23 @@ void GrabInfo::grabObject(GameObject *obj, Intent in, int16 count) {
setMoveCount(count);
// Get address of object
- grabObj = obj;
- grabId = grabObj->thisID();
+ _grabObj = obj;
+ _grabId = _grabObj->thisID();
// set the number of items
setMoveCount(count);
// get the original location
- from = grabObj->getLocation();
- from.context = grabObj->IDParent();
+ _from = _grabObj->getLocation();
+ _from.context = _grabObj->IDParent();
// de-link the object
- grabObj->move(Location(Nowhere, Nothing));
+ _grabObj->move(Location(Nowhere, Nothing));
setIcon();
setIntent(in);
// Display the name of the grabbed object under the mouse cursor
- grabObj->objCursorText(objText, bufSize, moveCount);
+ _grabObj->objCursorText(objText, bufSize, _moveCount);
setMouseText(objText);
clearMouseGauge();
@@ -132,20 +132,20 @@ void GrabInfo::copyObject(GameObject *obj, Intent in, int16 count) {
setMoveCount(count);
// Get address of object, and address of object prototype
- grabObj = obj;
- grabId = grabObj->thisID();
+ _grabObj = obj;
+ _grabId = _grabObj->thisID();
// set the number of items
setMoveCount(count);
- from = Nowhere;
- from.context = Nothing;
+ _from = Nowhere;
+ _from.context = Nothing;
setIcon();
setIntent(in);
// Display the name of the grabbed object under the mouse cursor
- grabObj->objCursorText(objText, bufSize, moveCount);
+ _grabObj->objCursorText(objText, bufSize, _moveCount);
setMouseText(objText);
clearMouseGauge();
@@ -155,13 +155,13 @@ void GrabInfo::copyObject(GameObject *obj, Intent in, int16 count) {
// Set a new intention. All changes to intention must use this function.
uint8 GrabInfo::setIntent(uint8 in) {
// If intention isn't being changed, return immediately
- if (intention != (Intent)in) {
+ if (_intention != (Intent)in) {
// Intention has changed to None
- if (in == (uint8)None && intention != None) g_vm->_pointer->hide();
+ if (in == (uint8)None && _intention != None) g_vm->_pointer->hide();
// Intention has changed from None
- else if (in != (uint8)None && intention == None) g_vm->_pointer->show();
+ else if (in != (uint8)None && _intention == None) g_vm->_pointer->show();
- intention = (Intent)in;
+ _intention = (Intent)in;
// Set new cursor
setCursor();
}
@@ -173,11 +173,11 @@ uint8 GrabInfo::setIntent(uint8 in) {
// Make the object given into the mouse pointer
void GrabInfo::setIcon() {
assert(
- pointerMap._size.x == 0
- && pointerMap._size.y == 0
- && pointerMap._data == nullptr);
+ _pointerMap._size.x == 0
+ && _pointerMap._size.y == 0
+ && _pointerMap._data == nullptr);
- assert(grabObj != nullptr && isObject(grabObj));
+ assert(_grabObj != nullptr && isObject(_grabObj));
Sprite *spr;
ProtoObj *proto;
@@ -186,10 +186,10 @@ void GrabInfo::setIcon() {
int32 mapBytes;
// Get address of object, and address of object prototype
- proto = grabObj->proto();
+ proto = _grabObj->proto();
// Get address of sprite
- spr = proto->getSprite(grabObj, ProtoObj::objAsMousePtr, moveCount).sp;
+ spr = proto->getSprite(_grabObj, ProtoObj::objAsMousePtr, _moveCount).sp;
mapBytes = spr->size.x * spr->size.y;
if ((mapData
@@ -199,38 +199,38 @@ void GrabInfo::setIcon() {
memset(mapData, 0, mapBytes);
// Build the current color table for the object
- grabObj->getColorTranslation(mainColors);
+ _grabObj->getColorTranslation(mainColors);
- pointerMap._size = spr->size;
- pointerMap._data = mapData;
+ _pointerMap._size = spr->size;
+ _pointerMap._data = mapData;
- pointerOffset.x = - spr->size.x / 2;
- pointerOffset.y = - spr->size.y / 2;
+ _pointerOffset.x = - spr->size.x / 2;
+ _pointerOffset.y = - spr->size.y / 2;
// Render the sprite into the bitmap
- ExpandColorMappedSprite(pointerMap, spr, mainColors);
+ ExpandColorMappedSprite(_pointerMap, spr, mainColors);
} else
error("Unable to allocate mouse image buffer");
}
void GrabInfo::clearIcon() {
- assert(grabObj == nullptr);
+ assert(_grabObj == nullptr);
- if (pointerMap._data != nullptr) {
- delete[] pointerMap._data;
- pointerMap._size.x = 0;
- pointerMap._size.y = 0;
- pointerMap._data = nullptr;
+ if (_pointerMap._data != nullptr) {
+ delete[] _pointerMap._data;
+ _pointerMap._size.x = 0;
+ _pointerMap._size.y = 0;
+ _pointerMap._data = nullptr;
}
}
// Changes cursor image to reflect the current state of the cursor based
-// on the intention and intentDoable data members.
+// on the _intention and _intentDoable data members.
void GrabInfo::setCursor() {
- if (intentDoable) {
- switch (intention) {
+ if (_intentDoable) {
+ switch (_intention) {
case None:
- // If intention has been changed to none then the
+ // If _intention has been changed to none then the
// pointer has already been hidden.
break;
case WalkTo:
@@ -243,7 +243,7 @@ void GrabInfo::setCursor() {
setMouseImage(kMouseGrabPtrImage, -7, -7);
break;
case Drop:
- setMouseImage(pointerMap, pointerOffset.x, pointerOffset.y);
+ setMouseImage(_pointerMap, _pointerOffset.x, _pointerOffset.y);
break;
case Use:
setMouseImage(kMouseUsePtrImage, -7, -7);
@@ -258,27 +258,27 @@ void GrabInfo::setCursor() {
break;
}
} else {
- // indicate current intention is not doable
+ // indicate current _intention is not doable
setMouseImage(kMouseXPointerImage, -7, -7);
}
}
void GrabInfo::placeObject(const Location &loc) {
- grabObj->move(loc);
+ _grabObj->move(loc);
// Turn off state variables
- grabObj = nullptr;
- grabId = Nothing;
- intentDoable = true;
+ _grabObj = nullptr;
+ _grabId = Nothing;
+ _intentDoable = true;
setIntent(WalkTo);
clearIcon();
// Display the saved text
- setMouseText(textBuf[0] != '\0' ? textBuf : nullptr);
+ setMouseText(_textBuf[0] != '\0' ? _textBuf : nullptr);
// Display the saved gauge data
- if (displayGauge)
- setMouseGauge(gaugeNumerator, gaugeDenominator);
+ if (_displayGauge)
+ setMouseGauge(_gaugeNumerator, _gaugeDenominator);
else
clearMouseGauge();
}
@@ -286,34 +286,34 @@ void GrabInfo::placeObject(const Location &loc) {
// this should be use to return the object to the container
// and/or remove the object from the cursor.
void GrabInfo::replaceObject() {
- if (grabObj == nullptr)
+ if (_grabObj == nullptr)
return;
// if actually attached to cursor, replace
- if (grabObj->IDParent() == Nothing) {
+ if (_grabObj->IDParent() == Nothing) {
// ContainerView *updateView;
- grabObj->move(from);
+ _grabObj->move(_from);
// Update the ContainerView from which the object came
-// updateView = ContainerView::findPane( grabObj->parent() );
+// updateView = ContainerView::findPane( _grabObj->parent() );
// if ( updateView != nullptr )
// ( updateView->getWindow() )->update( updateView->getExtent() );
}
// Turn off state variables
- grabObj = nullptr;
- grabId = Nothing;
- intentDoable = true;
+ _grabObj = nullptr;
+ _grabId = Nothing;
+ _intentDoable = true;
setIntent(WalkTo);
clearIcon();
// Display the saved text
- setMouseText(textBuf[0] != '\0' ? textBuf : nullptr);
+ setMouseText(_textBuf[0] != '\0' ? _textBuf : nullptr);
// Display the saved gauge data
- if (displayGauge)
- setMouseGauge(gaugeNumerator, gaugeDenominator);
+ if (_displayGauge)
+ setMouseGauge(_gaugeNumerator, _gaugeDenominator);
else
clearMouseGauge();
}
@@ -324,29 +324,29 @@ void GrabInfo::replaceObject() {
// text pointer will simply be saved.
void GrabInfo::setText(const char *txt) {
if ((txt != nullptr) && strlen(txt)) {
- Common::strlcpy(textBuf, txt, bufSize);
- if (grabObj == nullptr)
- setMouseText(textBuf);
+ Common::strlcpy(_textBuf, txt, bufSize);
+ if (_grabObj == nullptr)
+ setMouseText(_textBuf);
} else {
- textBuf[0] = '\0';
- if (grabObj == nullptr)
+ _textBuf[0] = '\0';
+ if (_grabObj == nullptr)
setMouseText(nullptr);
}
}
// request a change to the mouse gauge
void GrabInfo::setGauge(int16 numerator, int16 denominator) {
- displayGauge = true;
- gaugeNumerator = numerator;
- gaugeDenominator = denominator;
- if (grabObj == nullptr)
- setMouseGauge(gaugeNumerator, gaugeDenominator);
+ _displayGauge = true;
+ _gaugeNumerator = numerator;
+ _gaugeDenominator = denominator;
+ if (_grabObj == nullptr)
+ setMouseGauge(_gaugeNumerator, _gaugeDenominator);
}
// clear the mouse gauge
void GrabInfo::clearGauge() {
- displayGauge = false;
- if (grabObj == nullptr) clearMouseGauge();
+ _displayGauge = false;
+ if (_grabObj == nullptr) clearMouseGauge();
}
// FIXME: This code is specific to Dinotopia. Was disabled for some time and needs updating
diff --git a/engines/saga2/grabinfo.h b/engines/saga2/grabinfo.h
index 6e87a1945ce..c2b6d5742df 100644
--- a/engines/saga2/grabinfo.h
+++ b/engines/saga2/grabinfo.h
@@ -58,24 +58,24 @@ private:
protected:
// bitmaps for pointer
- gPixelMap pointerMap;
- Point16 pointerOffset; // mouse ptr hotspot
+ gPixelMap _pointerMap;
+ Point16 _pointerOffset; // mouse ptr hotspot
- Location from; // where the item was last
+ Location _from; // where the item was last
- ObjectID grabId; // which object picked by mouse
- GameObject *grabObj; // object being dragged
- Intent intention; // pickup state
- bool intentDoable; // is intention doable?
+ ObjectID _grabId; // which object picked by mouse
+ GameObject *_grabObj; // object being dragged
+ Intent _intention; // pickup state
+ bool _intentDoable; // is intention doable?
// (i.e. display red X cursor)
- bool displayGauge; // indicates wether or not to show
+ bool _displayGauge; // indicates wether or not to show
// the gauge
- int16 gaugeNumerator, // values to be displayed on the
- gaugeDenominator; // gauge
+ int16 _gaugeNumerator, // values to be displayed on the
+ _gaugeDenominator; // gauge
- int16 moveCount; // number of items being moved in cursor
+ int16 _moveCount; // number of items being moved in cursor
- char textBuf[bufSize];
+ char _textBuf[bufSize];
// internal grab commonality
void setIcon();
@@ -96,7 +96,7 @@ public:
// mergeable or not.
void setMoveCount(int16 val);
int16 getMoveCount() {
- return moveCount;
+ return _moveCount;
}
// put object into mouse ptr
@@ -108,26 +108,26 @@ public:
// non-destructive reads of the state
uint8 getIntent() {
- return intention;
+ return _intention;
}
bool getDoable() {
- return intentDoable;
+ return _intentDoable;
}
// changes to GrabInfo state
uint8 setIntent(uint8 in);
void setDoable(bool doable) {
- if (doable != intentDoable) {
- intentDoable = doable;
+ if (doable != _intentDoable) {
+ _intentDoable = doable;
setCursor();
}
}
GameObject *getObject() {
- return grabObj;
+ return _grabObj;
}
ObjectID getObjectId() {
- return grabId;
+ return _grabId;
}
// free the cursor
Commit: 89102aefa815b23031fb1521104ecd1a1b1e2fae
https://github.com/scummvm/scummvm/commit/89102aefa815b23031fb1521104ecd1a1b1e2fae
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:26+02:00
Commit Message:
SAGA2: Rename class variables in grequest.cpp
Changed paths:
engines/saga2/grequest.cpp
diff --git a/engines/saga2/grequest.cpp b/engines/saga2/grequest.cpp
index 2ecb3020f9d..3213ff852df 100644
--- a/engines/saga2/grequest.cpp
+++ b/engines/saga2/grequest.cpp
@@ -80,10 +80,10 @@ static void handleRequestEvent(gEvent &ev) {
class ModalDialogWindow : public ModalWindow {
- int16 titleCount;
- Point16 titlePos[maxLines];
- char *titleStrings[maxLines];
- char titleBuf[maxText];
+ int16 _titleCount;
+ Point16 _titlePos[maxLines];
+ char *_titleStrings[maxLines];
+ char _titleBuf[maxText];
void positionText(
char *windowText,
@@ -121,28 +121,28 @@ void ModalDialogWindow::positionText(
int16 fontHeight = mainFont->height;
// make a copy of the window text string
- vsprintf(titleBuf, windowText, args);
+ vsprintf(_titleBuf, windowText, args);
// break up the title text string
- titleCount = SplitString(titleBuf, titleStrings, maxLines, '\n');
+ _titleCount = SplitString(_titleBuf, _titleStrings, maxLines, '\n');
yPos = textArea.y +
- ((textArea.height - titleCount * fontHeight) >> 1);
+ ((textArea.height - _titleCount * fontHeight) >> 1);
yPos = MAX(yPos, textArea.y);
maxY = textArea.y + textArea.height - fontHeight;
- for (i = 0; i < titleCount; i++, yPos += fontHeight) {
+ for (i = 0; i < _titleCount; i++, yPos += fontHeight) {
if (yPos < maxY) {
- titlePos[i].y = yPos;
- titlePos[i].x =
+ _titlePos[i].y = yPos;
+ _titlePos[i].x =
textArea.x +
((textArea.width -
- TextWidth(mainFont, titleStrings[i], -1, 0))
+ TextWidth(mainFont, _titleStrings[i], -1, 0))
>> 1);
- } else titleCount = i;
+ } else _titleCount = i;
}
- } else titleCount = 0;
+ } else _titleCount = 0;
}
@@ -195,18 +195,18 @@ void ModalDialogWindow::drawClipped(
port.fillRect(rect);
port.setFont(textFont);
- for (i = 0; i < titleCount; i++) {
- Point16 textPos = origin + titlePos[i];
+ for (i = 0; i < _titleCount; i++) {
+ Point16 textPos = origin + _titlePos[i];
port.moveTo(textPos + Point16(-1, -1));
port.setColor(2);
- port.drawText(titleStrings[i], -1);
+ port.drawText(_titleStrings[i], -1);
port.moveTo(textPos + Point16(1, 1));
port.setColor(14);
- port.drawText(titleStrings[i], -1);
+ port.drawText(_titleStrings[i], -1);
port.moveTo(textPos);
port.setColor(8);
- port.drawText(titleStrings[i], -1);
+ port.drawText(_titleStrings[i], -1);
}
ModalWindow::drawClipped(port, offset, r);
@@ -217,7 +217,7 @@ void ModalDialogWindow::drawClipped(
* ===================================================================== */
class ModalRequestWindow : public ModalDialogWindow {
- char buttonBuf[maxButtonText];
+ char _buttonBuf[maxButtonText];
static Rect16 getTextArea(const Rect16 &r) {
return Rect16(2, 2, r.width - 4, r.height - mainFont->height - 12);
@@ -253,10 +253,10 @@ ModalRequestWindow::ModalRequestWindow(
int16 fontHeight = mainFont->height;
- Common::strlcpy(buttonBuf, (buttonText ? buttonText : "_OK"), sizeof(buttonBuf));
+ Common::strlcpy(_buttonBuf, (buttonText ? buttonText : "_OK"), sizeof(_buttonBuf));
// break up the button text string
- buttonCount = SplitString(buttonBuf, buttonStrings, maxButtons, '|');
+ buttonCount = SplitString(_buttonBuf, buttonStrings, maxButtons, '|');
extraSpace = r.width - buttonWidth * buttonCount;
Commit: 1a67f6146bf75bccc0d71328f8bbda63bbde8a4f
https://github.com/scummvm/scummvm/commit/1a67f6146bf75bccc0d71328f8bbda63bbde8a4f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:26+02:00
Commit Message:
SAGA2: Rename class variables in gtextbox.h
Changed paths:
engines/saga2/gtextbox.cpp
engines/saga2/gtextbox.h
diff --git a/engines/saga2/gtextbox.cpp b/engines/saga2/gtextbox.cpp
index 065d980391b..ba300bbebc5 100644
--- a/engines/saga2/gtextbox.cpp
+++ b/engines/saga2/gtextbox.cpp
@@ -168,63 +168,63 @@ gTextBox::gTextBox(
int16 i;
- hilit = false;
- noUndo = false;
-
- index = 0; // index into string array ( which string )
- maxLen = length;
- flags = flg;
- currentLen[index] = buffer ? strlen(buffer) : 0;
- cursorPos = anchorPos = scrollPixels = 0;
- undoBuffer = new char[maxLen + 1]();
- textFont = font;
- oldFont = nullptr;
- fontHeight = height;
- fontOffset = fontHeight + 2;
-
- fontColorFore = FGColor;
- fontColorBack = BGColor;
- fontColorHilite = HLColor;
- fontColorBackHilite = BGHLColor;
- cursorColor = CRColor;
- linesPerPage = (box.height / fontOffset);
- endLine = clamp(0, (index + linesPerPage), numEditLines);
- oldMark = -1;
-
- displayOnly = noEditing;
- editing = false;
- editRect = box;
- editRect.height = fontHeight;
- inDrag = false;
- onEnter = cmdEnter;
- onEscape = cmdEscape;
- isActiveCtl = false;
+ _hilit = false;
+ _noUndo = false;
+
+ _index = 0; // index into string array ( which string )
+ _maxLen = length;
+ _flags = flg;
+ _currentLen[_index] = buffer ? strlen(buffer) : 0;
+ _cursorPos = _anchorPos = _scrollPixels = 0;
+ _undoBuffer = new char[_maxLen + 1]();
+ _textFont = font;
+ _oldFont = nullptr;
+ _fontHeight = height;
+ _fontOffset = _fontHeight + 2;
+
+ _fontColorFore = FGColor;
+ _fontColorBack = BGColor;
+ _fontColorHilite = HLColor;
+ _fontColorBackHilite = BGHLColor;
+ _cursorColor = CRColor;
+ _linesPerPage = (box.height / _fontOffset);
+ _endLine = clamp(0, (_index + _linesPerPage), numEditLines);
+ _oldMark = -1;
+
+ _displayOnly = noEditing;
+ _editing = false;
+ _editRect = box;
+ _editRect.height = _fontHeight;
+ _inDrag = false;
+ _onEnter = cmdEnter;
+ _onEscape = cmdEscape;
+ _isActiveCtl = false;
selected = 0;
- parent = &list;
+ _parent = &list;
- blinkStart = 0;
- blinkX = 0;
- blinkState = 0;
+ _blinkStart = 0;
+ _blinkX = 0;
+ _blinkState = 0;
// set the filedStrings pointer
- fieldStrings = stringBufs;
+ _fieldStrings = stringBufs;
// get the size of each string
for (i = 0; i < numEditLines; i++) {
- exists[i] = ((stringBufs[i][0] & 0x80) == 0);
+ _exists[i] = ((stringBufs[i][0] & 0x80) == 0);
stringBufs[i][0] &= 0x7F;
- currentLen[i] = MIN<int>(editLen, strlen(stringBufs[i]));
+ _currentLen[i] = MIN<int>(editLen, strlen(stringBufs[i]));
}
- internalBuffer = false;
- fullRedraw = true;
- index = 0;
+ _internalBuffer = false;
+ _fullRedraw = true;
+ _index = 0;
enSelect(0);
- if (!displayOnly) {
- cursorPos = 0;
- anchorPos = currentLen[index];
+ if (!_displayOnly) {
+ _cursorPos = 0;
+ _anchorPos = _currentLen[_index];
}
- fullRedraw = true;
+ _fullRedraw = true;
}
//-----------------------------------------------------------------------
@@ -232,8 +232,8 @@ gTextBox::gTextBox(
gTextBox::~gTextBox() {
deSelect();
selected = 0;
- if (undoBuffer) {
- delete[] undoBuffer;
+ if (_undoBuffer) {
+ delete[] _undoBuffer;
}
}
@@ -264,8 +264,8 @@ gTextBox::~gTextBox() {
**********************************************************************
*/
bool gTextBox::insertText(char *newText, int length) {
- int16 selStart = MIN(cursorPos, anchorPos),
- selWidth = ABS(cursorPos - anchorPos),
+ int16 selStart = MIN(_cursorPos, _anchorPos),
+ selWidth = ABS(_cursorPos - _anchorPos),
selEnd = selStart + selWidth;
if (length == -1) length = strlen(newText);
@@ -273,28 +273,28 @@ bool gTextBox::insertText(char *newText, int length) {
// If inserting the text would make the string too long,
// then don't insert it.
- if (currentLen[index] - selWidth + length >= maxLen) return false;
+ if (_currentLen[_index] - selWidth + length >= _maxLen) return false;
// Move the text after the selection to where it will be
// after the insertion.
- if (selEnd < currentLen[index]) {
- memmove(fieldStrings[index] + selStart + length,
- fieldStrings[index] + selEnd,
- currentLen[index] - selEnd);
+ if (selEnd < _currentLen[_index]) {
+ memmove(_fieldStrings[_index] + selStart + length,
+ _fieldStrings[_index] + selEnd,
+ _currentLen[_index] - selEnd);
}
// Move the inserted text, if any, to the opening
if (length > 0) {
- memmove(fieldStrings[index] + selStart, newText, length);
+ memmove(_fieldStrings[_index] + selStart, newText, length);
}
// Set the insertion point to the end of the new text.
- cursorPos = anchorPos = selStart + length;
- currentLen[index] += (length - selWidth);
- fieldStrings[index][currentLen[index]] = '\0';
+ _cursorPos = _anchorPos = selStart + length;
+ _currentLen[_index] += (length - selWidth);
+ _fieldStrings[_index][_currentLen[_index]] = '\0';
return true;
}
@@ -323,13 +323,13 @@ bool gTextBox::insertText(char *newText, int length) {
**********************************************************************
*/
void gTextBox::setText(char *newText) {
- int16 len = MIN((int)(strlen(newText)), (int)(maxLen - 1));
+ int16 len = MIN((int)(strlen(newText)), (int)(_maxLen - 1));
- cursorPos = 0;
- anchorPos = currentLen[index];
+ _cursorPos = 0;
+ _anchorPos = _currentLen[_index];
insertText(newText, len);
- cursorPos = anchorPos = 0;
+ _cursorPos = _anchorPos = 0;
if (window.isOpen()) drawContents();
}
@@ -337,10 +337,10 @@ void gTextBox::setText(char *newText) {
//-----------------------------------------------------------------------
void gTextBox::setEditExtent(const Rect16 &r) {
- editRect.x = r.x;
- editRect.y = r.y;
- editRect.width = r.width;
- editRect.height = r.height;
+ _editRect.x = r.x;
+ _editRect.y = r.y;
+ _editRect.width = r.width;
+ _editRect.height = r.height;
}
@@ -352,12 +352,12 @@ bool gTextBox::activate(gEventType why) {
notify(why, 0); // notify App of successful hit
return true;
}
- isActiveCtl = true;
+ _isActiveCtl = true;
if (!selected) {
- enSelect(index);
+ enSelect(_index);
}
selected = 1;
- fullRedraw = true;
+ _fullRedraw = true;
draw();
if (why == gEventNone)
return true;
@@ -368,26 +368,26 @@ bool gTextBox::activate(gEventType why) {
void gTextBox::deactivate() {
selected = 0;
- isActiveCtl = false;
+ _isActiveCtl = false;
draw();
- fullRedraw = true;
+ _fullRedraw = true;
gPanel::deactivate();
}
//-----------------------------------------------------------------------
void gTextBox::prepareEdit(int which) {
- if (!displayOnly) {
- if (undoBuffer) memcpy(undoBuffer, fieldStrings[which], currentLen[which] + 1);
- undoLen = currentLen[which];
+ if (!_displayOnly) {
+ if (_undoBuffer) memcpy(_undoBuffer, _fieldStrings[which], _currentLen[which] + 1);
+ _undoLen = _currentLen[which];
}
}
//-----------------------------------------------------------------------
bool gTextBox::changed() {
- if (undoBuffer && editing) {
- return memcmp(undoBuffer, fieldStrings[index], currentLen[index] + 1);
+ if (_undoBuffer && _editing) {
+ return memcmp(_undoBuffer, _fieldStrings[_index], _currentLen[_index] + 1);
}
return false;
}
@@ -395,10 +395,10 @@ bool gTextBox::changed() {
//-----------------------------------------------------------------------
void gTextBox::commitEdit() {
- if (undoBuffer && changed()) {
- memcpy(undoBuffer, fieldStrings[index], currentLen[index] + 1);
- undoLen = currentLen[index];
- cursorPos = anchorPos = currentLen[index];
+ if (_undoBuffer && changed()) {
+ memcpy(_undoBuffer, _fieldStrings[_index], _currentLen[_index] + 1);
+ _undoLen = _currentLen[_index];
+ _cursorPos = _anchorPos = _currentLen[_index];
notify(gEventNewValue, 1); // tell app about new value
}
}
@@ -407,9 +407,9 @@ void gTextBox::commitEdit() {
//-----------------------------------------------------------------------
void gTextBox::revertEdit() {
- if (undoBuffer && changed()) {
- cursorPos = anchorPos = currentLen[index] = undoLen;
- memcpy(fieldStrings[index], undoBuffer, currentLen[index] + 1);
+ if (_undoBuffer && changed()) {
+ _cursorPos = _anchorPos = _currentLen[_index] = _undoLen;
+ memcpy(_fieldStrings[_index], _undoBuffer, _currentLen[_index] + 1);
notify(gEventNewValue, 0); // tell app about new value
}
}
@@ -422,58 +422,58 @@ void gTextBox::revertEdit() {
void gTextBox::scroll(int8 req) {
int16 indexReq = req;
- int16 oldIndex = index;
- int16 visOld = (oldIndex - (endLine - linesPerPage));
- int16 visBase = endLine;
+ int16 oldIndex = _index;
+ int16 visOld = (oldIndex - (_endLine - _linesPerPage));
+ int16 visBase = _endLine;
int16 visIndex;
indexReq = clamp(0, indexReq, numEditLines);
- visIndex = (indexReq - (visBase - linesPerPage));
+ visIndex = (indexReq - (visBase - _linesPerPage));
if (ABS(oldIndex - indexReq) < 2) {
if (visIndex < 0) {
visBase--;
visIndex++;
- } else if (visIndex >= linesPerPage) {
+ } else if (visIndex >= _linesPerPage) {
visBase++;
visIndex--;
}
} else {
- while (visIndex >= linesPerPage) {
- visBase = clamp(linesPerPage, visBase + linesPerPage, numEditLines);
- visIndex = (indexReq - (visBase - linesPerPage));
+ while (visIndex >= _linesPerPage) {
+ visBase = clamp(_linesPerPage, visBase + _linesPerPage, numEditLines);
+ visIndex = (indexReq - (visBase - _linesPerPage));
}
while (visIndex < 0) {
- visBase = clamp(linesPerPage, visBase - linesPerPage, numEditLines);
- visIndex = (indexReq - (visBase - linesPerPage));
+ visBase = clamp(_linesPerPage, visBase - _linesPerPage, numEditLines);
+ visIndex = (indexReq - (visBase - _linesPerPage));
}
}
- if (endLine != visBase) {
- fullRedraw = true;
+ if (_endLine != visBase) {
+ _fullRedraw = true;
}
- endLine = visBase;
+ _endLine = visBase;
if (visIndex != visOld) {
- Rect16 textBoxExtent = editRect;
+ Rect16 textBoxExtent = _editRect;
- // setup the editing extent
- textBoxExtent.y = (fontOffset * visIndex) + _extent.y;
+ // setup the _editing extent
+ textBoxExtent.y = (_fontOffset * visIndex) + _extent.y;
setEditExtent(textBoxExtent);
- fullRedraw = true;
+ _fullRedraw = true;
}
}
//-----------------------------------------------------------------------
void gTextBox::deSelect(bool commit) {
- if (index >= 0 && editing) {
+ if (_index >= 0 && _editing) {
if (commit)
commitEdit();
else
revertEdit();
- editing = false;
- fullRedraw = true;
+ _editing = false;
+ _fullRedraw = true;
}
}
@@ -481,25 +481,25 @@ void gTextBox::deSelect(bool commit) {
void gTextBox::enSelect(int which) {
scroll(which);
- index = which;
- if (!displayOnly) {
+ _index = which;
+ if (!_displayOnly) {
prepareEdit(which);
- editing = true;
- cursorPos = 0;
- anchorPos = currentLen[index];
+ _editing = true;
+ _cursorPos = 0;
+ _anchorPos = _currentLen[_index];
} else {
- hilit = true;
+ _hilit = true;
}
}
//-----------------------------------------------------------------------
void gTextBox::reSelect(int which) {
- if (which != index) {
+ if (which != _index) {
deSelect(false);
draw();
enSelect(which);
- fullRedraw = true;
+ _fullRedraw = true;
}
}
@@ -509,34 +509,34 @@ void gTextBox::reSelect(int which) {
void gTextBox::selectionMove(int howMany) {
int8 newIndex;
- newIndex = clamp(0, index + howMany, numEditLines - 1);
+ newIndex = clamp(0, _index + howMany, numEditLines - 1);
#ifndef ALLOW_BAD_LOADS
- if (displayOnly) {
+ if (_displayOnly) {
int i = newIndex;
if (howMany > 0) {
- while (!exists[i] && i < numEditLines - 1) i++;
- if (!exists[i]) {
+ while (!_exists[i] && i < numEditLines - 1) i++;
+ if (!_exists[i]) {
i = newIndex;
- while (!exists[i] && i > 0) i--;
+ while (!_exists[i] && i > 0) i--;
}
- if (exists[i])
+ if (_exists[i])
newIndex = i;
} else {
- while (!exists[i] && i > 0) i--;
- if (!exists[i]) {
+ while (!_exists[i] && i > 0) i--;
+ if (!_exists[i]) {
i = newIndex;
- while (!exists[i] && i < numEditLines - 1) i++;
+ while (!_exists[i] && i < numEditLines - 1) i++;
}
- if (exists[i])
+ if (_exists[i])
newIndex = i;
}
}
#endif
reSelect(newIndex);
- if (!displayOnly) {
- cursorPos = 0;
- anchorPos = currentLen[index];
+ if (!_displayOnly) {
+ _cursorPos = 0;
+ _anchorPos = _currentLen[_index];
}
draw();
@@ -548,13 +548,13 @@ void gTextBox::selectionMove(int howMany) {
//-----------------------------------------------------------------------
void gTextBox::scrollUp() {
- selectionUp(linesPerPage - 2);
+ selectionUp(_linesPerPage - 2);
}
//-----------------------------------------------------------------------
void gTextBox::scrollDown() {
- selectionDown(linesPerPage - 2);
+ selectionDown(_linesPerPage - 2);
}
//-----------------------------------------------------------------------
@@ -570,21 +570,21 @@ bool gTextBox::pointerHit(gPanelMessage &msg) {
if (Rect16(0, 0, _extent.width, _extent.height).ptInside(pos)) {
int8 newIndex;
// get the position of the line
- newIndex = clamp(0, pos.y / fontOffset, linesPerPage - 1);
- newIndex = (endLine - (linesPerPage - newIndex));
+ newIndex = clamp(0, pos.y / _fontOffset, _linesPerPage - 1);
+ newIndex = (_endLine - (_linesPerPage - newIndex));
- if (index != newIndex)
+ if (_index != newIndex)
reSelect(newIndex);
- if (editing) {
- if (textFont) {
- newPos = WhichIChar(textFont, (uint8 *)fieldStrings[index], msg.pickPos.x - 3, currentLen[index]);
+ if (_editing) {
+ if (_textFont) {
+ newPos = WhichIChar(_textFont, (uint8 *)_fieldStrings[_index], msg.pickPos.x - 3, _currentLen[_index]);
} else {
- newPos = WhichIChar(mainFont, (uint8 *)fieldStrings[index], msg.pickPos.x - 3, currentLen[index]);
+ newPos = WhichIChar(mainFont, (uint8 *)_fieldStrings[_index], msg.pickPos.x - 3, _currentLen[_index]);
}
if (msg.leftButton) {
- if (cursorPos != newPos || anchorPos != newPos) {
- anchorPos = newPos;
- cursorPos = newPos;
+ if (_cursorPos != newPos || _anchorPos != newPos) {
+ _anchorPos = newPos;
+ _cursorPos = newPos;
}
}
draw();
@@ -606,17 +606,17 @@ void gTextBox::pointerDrag(gPanelMessage &msg) {
int16 newPos;
if (msg.leftButton) {
- if (textFont) {
- newPos = WhichIChar(textFont, (uint8 *)fieldStrings[index], msg.pickPos.x - 3, currentLen[index]);
+ if (_textFont) {
+ newPos = WhichIChar(_textFont, (uint8 *)_fieldStrings[_index], msg.pickPos.x - 3, _currentLen[_index]);
} else {
- newPos = WhichIChar(mainFont, (uint8 *)fieldStrings[index], msg.pickPos.x - 3, currentLen[index]);
+ newPos = WhichIChar(mainFont, (uint8 *)_fieldStrings[_index], msg.pickPos.x - 3, _currentLen[_index]);
}
- inDrag = true;
- if (cursorPos != newPos) {
- //if (newPos<cursorPos)
- cursorPos = newPos;
+ _inDrag = true;
+ if (_cursorPos != newPos) {
+ //if (newPos<_cursorPos)
+ _cursorPos = newPos;
//else
- // anchorPos = newPos ;
+ // _anchorPos = newPos ;
}
draw();
}
@@ -629,7 +629,7 @@ void gTextBox::pointerDrag(gPanelMessage &msg) {
void gTextBox::pointerRelease(gPanelMessage &msg) {
if (!msg.leftButton) {
- inDrag = false;
+ _inDrag = false;
draw();
}
}
@@ -639,14 +639,14 @@ void gTextBox::pointerRelease(gPanelMessage &msg) {
bool gTextBox::keyStroke(gPanelMessage &msg) {
gPort &port = window.windowPort;
- int16 selStart = MIN(cursorPos, anchorPos),
- selWidth = ABS(cursorPos - anchorPos);
+ int16 selStart = MIN(_cursorPos, _anchorPos),
+ selWidth = ABS(_cursorPos - _anchorPos);
uint16 key = msg.key;
// Process the various keystrokes...
- if (editing && cursorPos > anchorPos) {
- cursorPos = anchorPos;
- anchorPos = cursorPos;
+ if (_editing && _cursorPos > _anchorPos) {
+ _cursorPos = _anchorPos;
+ _anchorPos = _cursorPos;
}
switch (key) {
@@ -659,76 +659,76 @@ bool gTextBox::keyStroke(gPanelMessage &msg) {
return true;
case Common::KEYCODE_PAGEUP:
- selectionUp(linesPerPage);
+ selectionUp(_linesPerPage);
return true;
case Common::KEYCODE_PAGEDOWN:
- selectionDown(linesPerPage);
+ selectionDown(_linesPerPage);
return true;
}
if (key == Common::ASCII_RETURN) { // return key
- if (editing) {
+ if (_editing) {
commitEdit();
- if (!(flags & textBoxStayActive))
+ if (!(_flags & textBoxStayActive))
deactivate(); // deactivate the text box
}
- if (onEnter != nullptr) {
+ if (_onEnter != nullptr) {
gEvent ev;
ev.eventType = gEventKeyDown ;
ev.value = 1;
- ev.panel = parent;
- (*onEnter)(ev);
+ ev.panel = _parent;
+ (*_onEnter)(ev);
}
return true;
} else if (key == Common::ASCII_ESCAPE) { // escape key
revertEdit();
deactivate(); // deactivate the text box
- if (onEscape != nullptr) {
+ if (_onEscape != nullptr) {
gEvent ev;
ev.eventType = gEventKeyDown ;
ev.value = 1;
ev.value = 1;
- ev.panel = this; //parent;
- (*onEscape)(ev);
+ ev.panel = this; //_parent;
+ (*_onEscape)(ev);
}
- if (flags & textBoxNoFilter)
+ if (_flags & textBoxNoFilter)
return false;
return true;
- } else if (editing) {
+ } else if (_editing) {
switch (key) {
case Common::KEYCODE_LEFT:
- if (anchorPos > 0)
- anchorPos--;
+ if (_anchorPos > 0)
+ _anchorPos--;
if (!(msg.qualifier & qualifierShift))
- cursorPos = anchorPos;
+ _cursorPos = _anchorPos;
break;
case Common::KEYCODE_RIGHT:
- if (anchorPos < currentLen[index])
- anchorPos++;
+ if (_anchorPos < _currentLen[_index])
+ _anchorPos++;
if (!(msg.qualifier & qualifierShift))
- cursorPos = anchorPos;
+ _cursorPos = _anchorPos;
break;
case Common::KEYCODE_HOME:
- cursorPos = 0;
- anchorPos = 0;
+ _cursorPos = 0;
+ _anchorPos = 0;
break;
case Common::KEYCODE_END:
- cursorPos = currentLen[index];
- anchorPos = currentLen[index];
+ _cursorPos = _currentLen[_index];
+ _anchorPos = _currentLen[_index];
break;
case Common::KEYCODE_z: // Alt-Z
if (msg.qualifier & (qualifierControl | qualifierAlt)) {
- if (undoBuffer) {
- cursorPos = anchorPos = currentLen[index] = undoLen;
- memcpy(fieldStrings[index], undoBuffer, currentLen[index] + 1);
+ if (_undoBuffer) {
+ _cursorPos = _anchorPos = _currentLen[_index] = _undoLen;
+ memcpy(_fieldStrings[_index], _undoBuffer, _currentLen[_index] + 1);
notify(gEventAltValue, 0); // tell app about new value
}
} else {
@@ -748,27 +748,27 @@ bool gTextBox::keyStroke(gPanelMessage &msg) {
}
// Delete N chars
- memmove(fieldStrings[index] + selStart,
- fieldStrings[index] + selStart + selWidth,
- currentLen[index] - (selStart + selWidth));
- cursorPos = anchorPos = selStart; // adjust cursor pos
- currentLen[index] -= selWidth; // adjust str len
+ memmove(_fieldStrings[_index] + selStart,
+ _fieldStrings[_index] + selStart + selWidth,
+ _currentLen[_index] - (selStart + selWidth));
+ _cursorPos = _anchorPos = selStart; // adjust cursor pos
+ _currentLen[_index] -= selWidth; // adjust str len
notify(gEventAltValue, 0); // tell app about new value
break;
case Common::KEYCODE_DELETE:
if (selWidth == 0) { // if insertion point
// don't delete if at end
- if (selStart >= currentLen[index]) return false;
+ if (selStart >= _currentLen[_index]) return false;
selWidth = 1; // delete 1 char
}
// Delete N chars
- memmove(fieldStrings[index] + selStart,
- fieldStrings[index] + selStart + selWidth,
- currentLen[index] - (selStart + selWidth));
- cursorPos = anchorPos = selStart; // adjust cursor pos
- currentLen[index] -= selWidth; // adjust str len
+ memmove(_fieldStrings[_index] + selStart,
+ _fieldStrings[_index] + selStart + selWidth,
+ _currentLen[_index] - (selStart + selWidth));
+ _cursorPos = _anchorPos = selStart; // adjust cursor pos
+ _currentLen[_index] -= selWidth; // adjust str len
notify(gEventAltValue, 0); // tell app about new value
break;
@@ -776,7 +776,7 @@ bool gTextBox::keyStroke(gPanelMessage &msg) {
return false;
default:
- if (flags & textBoxNoFilter)
+ if (_flags & textBoxNoFilter)
return false;
if (key >= Common::KEYCODE_SPACE && // 32 (First printable character)
@@ -793,8 +793,8 @@ bool gTextBox::keyStroke(gPanelMessage &msg) {
}
}
- if (editing) {
- fieldStrings[index][currentLen[index]] = '\0';
+ if (_editing) {
+ _fieldStrings[_index][_currentLen[_index]] = '\0';
// Now, redraw the contents.
@@ -825,14 +825,14 @@ bool gTextBox::tabSelect() {
char *gTextBox::getLine(int8 stringIndex) {
// return the save name
- return fieldStrings[stringIndex];
+ return _fieldStrings[stringIndex];
}
//-----------------------------------------------------------------------
char *gTextBox::selectedText(int &length) {
- length = ABS(cursorPos - anchorPos);
- return fieldStrings[index] + MIN(cursorPos, anchorPos);
+ length = ABS(_cursorPos - _anchorPos);
+ return _fieldStrings[_index] + MIN(_cursorPos, _anchorPos);
}
//-----------------------------------------------------------------------
@@ -844,26 +844,26 @@ void gTextBox::timerTick(gPanelMessage &msg) {
//-----------------------------------------------------------------------
void gTextBox::handleTimerTick(int32 tick) {
- if (selected && !displayOnly && editing && !inDrag) {
- if (blinkStart == 0) {
- blinkState = 0;
- blinkStart = tick;
+ if (selected && !_displayOnly && _editing && !_inDrag) {
+ if (_blinkStart == 0) {
+ _blinkState = 0;
+ _blinkStart = tick;
return;
}
- if (tick - blinkStart > blinkTime) {
+ if (tick - _blinkStart > blinkTime) {
gPort &port = window.windowPort;
SAVE_GPORT_STATE(port); // save pen color, etc.
g_vm->_pointer->hide(port, _extent); // hide mouse pointer
port.setPenMap(port._penMap);
port.setStyle(0);
- port.setColor(blinkState ? blinkColor0 : blinkColor1);
- port.fillRect(editRect.x + blinkX - ((blinkWide + 1) / 2), editRect.y + 1, blinkWide, editRect.height - 1);
+ port.setColor(_blinkState ? blinkColor0 : blinkColor1);
+ port.fillRect(_editRect.x + _blinkX - ((blinkWide + 1) / 2), _editRect.y + 1, blinkWide, _editRect.height - 1);
g_vm->_pointer->show(port, _extent); // show mouse pointer
- blinkState = !blinkState;
- blinkStart = tick;
+ _blinkState = !_blinkState;
+ _blinkStart = tick;
}
}
}
@@ -873,8 +873,8 @@ void gTextBox::handleTimerTick(int32 tick) {
void gTextBox::editRectFill(gPort &fillPort, gPen *pen) {
fillPort.setPenMap(pen);
fillPort.setStyle(0);
- fillPort.setColor(fontColorBackHilite);
- fillPort.fillRect(0, 0, editRect.width, editRect.height);
+ fillPort.setColor(_fontColorBackHilite);
+ fillPort.fillRect(0, 0, _editRect.width, _editRect.height);
}
@@ -882,30 +882,30 @@ void gTextBox::editRectFill(gPort &fillPort, gPen *pen) {
void gTextBox::drawContents() {
int16 cPos, aPos;
- assert(textFont);
- assert(fontColorBack != -1);
+ assert(_textFont);
+ assert(_fontColorBack != -1);
gPort &port = window.windowPort,
tPort;
- cPos = MIN(cursorPos, anchorPos);
- aPos = MAX(cursorPos, anchorPos);
+ cPos = MIN(_cursorPos, _anchorPos);
+ aPos = MAX(_cursorPos, _anchorPos);
// Allocate a temporary pixel map and render into it.
- if (NewTempPort(tPort, editRect.width, editRect.height)) {
+ if (NewTempPort(tPort, _editRect.width, _editRect.height)) {
int16 cursorX,
anchorX = 0,
- hiliteX,
- hiliteWidth,
+ _hiliteX,
+ _hiliteWidth,
textHeight_;
- textHeight_ = fontHeight;
+ textHeight_ = _fontHeight;
- if (hilit || editing) {
- // fill in the editing field's background color
+ if (_hilit || _editing) {
+ // fill in the _editing field's background color
editRectFill(tPort, port._penMap);
}
@@ -913,38 +913,38 @@ void gTextBox::drawContents() {
// Determine the pixel position of the cursor and
// anchor positions.
- if (!displayOnly) {
+ if (!_displayOnly) {
if (cPos == aPos) {
// If it's an insertion point, then make the cursor
// 1 pixel wide. (And blink it...)
- cursorX = TextWidth(textFont, fieldStrings[index], cPos, 0);
+ cursorX = TextWidth(_textFont, _fieldStrings[_index], cPos, 0);
anchorX = cursorX + 1;
} else {
if (cPos == 0) {
cursorX = 0;
} else {
- cursorX = TextWidth(textFont, fieldStrings[index], cPos, 0) + 1;
+ cursorX = TextWidth(_textFont, _fieldStrings[_index], cPos, 0) + 1;
}
if (aPos == 0) {
anchorX = 0;
} else {
- anchorX = TextWidth(textFont, fieldStrings[index], aPos, 0) + 1;
+ anchorX = TextWidth(_textFont, _fieldStrings[_index], aPos, 0) + 1;
}
}
// Adjust the scrolling of the text string
- if (scrollPixels > cursorX) {
- scrollPixels = cursorX;
- } else if (scrollPixels + (editRect.width - 1) < cursorX) {
- scrollPixels = cursorX - (editRect.width - 1);
+ if (_scrollPixels > cursorX) {
+ _scrollPixels = cursorX;
+ } else if (_scrollPixels + (_editRect.width - 1) < cursorX) {
+ _scrollPixels = cursorX - (_editRect.width - 1);
}
// Adjust the cursor positions to match the scroll
- cursorX -= scrollPixels;
- anchorX -= scrollPixels;
+ cursorX -= _scrollPixels;
+ anchorX -= _scrollPixels;
#ifdef BADINTERFACE
// If it's a selection, then check to see if either
// end of the selection is after the last character,
@@ -952,33 +952,33 @@ void gTextBox::drawContents() {
// the end in the highlight.
if (cPos != aPos) {
- if (cPos == currentLen[index]) cursorX = editRect.width;
- if (aPos == currentLen[index]) anchorX = editRect.width;
+ if (cPos == _currentLen[_index]) cursorX = _editRect.width;
+ if (aPos == _currentLen[_index]) anchorX = _editRect.width;
}
#endif
- hiliteX = MIN(cursorX, anchorX);
- hiliteWidth = MAX(cursorX, anchorX) - hiliteX;
+ _hiliteX = MIN(cursorX, anchorX);
+ _hiliteWidth = MAX(cursorX, anchorX) - _hiliteX;
- tPort.setColor(cursorColor); // draw the highlight
- tPort.fillRect(hiliteX, 0, hiliteWidth, editRect.height);
+ tPort.setColor(_cursorColor); // draw the highlight
+ tPort.fillRect(_hiliteX, 0, _hiliteWidth, _editRect.height);
}
}
// set up the font
- tPort.setFont(textFont);
- tPort.setColor(fontColorHilite);
+ tPort.setFont(_textFont);
+ tPort.setColor(_fontColorHilite);
- tPort.moveTo(-scrollPixels, (editRect.height - textHeight_ + 1) / 2);
- tPort.drawText(fieldStrings[index], currentLen[index]);
+ tPort.moveTo(-_scrollPixels, (_editRect.height - textHeight_ + 1) / 2);
+ tPort.drawText(_fieldStrings[_index], _currentLen[_index]);
// Blit the pixelmap to the main screen
port.setMode(drawModeMatte);
port.bltPixels(*tPort._map, 0, 0,
- editRect.x + 1, editRect.y + 1,
- editRect.width, editRect.height);
- blinkStart = 0;
- blinkX = anchorX;
+ _editRect.x + 1, _editRect.y + 1,
+ _editRect.width, _editRect.height);
+ _blinkStart = 0;
+ _blinkX = anchorX;
DisposeTempPort(tPort); // dispose of temporary pixelmap
}
@@ -991,27 +991,27 @@ void gTextBox::drawClipped() {
Rect16 rect = window.getExtent();
#if 0
- if (!inDrag && cursorPos > anchorPos) {
- int16 t = cursorPos;
- cursorPos = anchorPos;
- anchorPos = cursorPos;
+ if (!_inDrag && _cursorPos > _anchorPos) {
+ int16 t = _cursorPos;
+ _cursorPos = _anchorPos;
+ _anchorPos = _cursorPos;
}
#endif
- WriteStatusF(11, "Entry %d[%d] (%d:%d)", index, currentLen[index], cursorPos, anchorPos);
+ WriteStatusF(11, "Entry %d[%d] (%d:%d)", index, _currentLen[_index], _cursorPos, _anchorPos);
SAVE_GPORT_STATE(port); // save pen color, etc.
g_vm->_pointer->hide(port, _extent); // hide mouse pointer
- if (fullRedraw) {
+ if (_fullRedraw) {
drawAll(port, Point16(0, 0), Rect16(0, 0, rect.width, rect.height));
- fullRedraw = false;
+ _fullRedraw = false;
}
- if (editing) {
+ if (_editing) {
drawContents(); // draw the string
drawTitle(textPosLeft); // draw the title
- } else if (displayOnly && hilit) {
+ } else if (_displayOnly && _hilit) {
drawContents();
} else {
drawAll(port, Point16(0, 0), Rect16(0, 0, rect.width, rect.height));
@@ -1027,7 +1027,7 @@ void gTextBox::drawClipped() {
void gTextBox::drawAll(gPort &port,
const Point16 &offset,
const Rect16 &) {
- assert(textFont);
+ assert(_textFont);
gPort tempPort;
Rect16 bufRect = Rect16(0, 0, 0, 0);
@@ -1045,47 +1045,47 @@ void gTextBox::drawAll(gPort &port,
workRect.y -= offset.y;
- if (endLine != oldMark || fullRedraw) {
+ if (_endLine != _oldMark || _fullRedraw) {
// setup the tempPort
tempPort.setMode(drawModeMatte);
// if the text is going to change
- tempPort.setColor(fontColorBack);
+ tempPort.setColor(_fontColorBack);
tempPort.fillRect(workRect);
// draw as glyph
tempPort.setMode(drawModeMatte);
// pen color black
- tempPort.setColor(fontColorFore);
+ tempPort.setColor(_fontColorFore);
// font
- oldFont = tempPort._font;
+ _oldFont = tempPort._font;
- tempPort.setFont(textFont);
+ tempPort.setFont(_textFont);
- for (i = (endLine - linesPerPage); i < endLine; i++) {
+ for (i = (_endLine - _linesPerPage); i < _endLine; i++) {
assert(i >= 0 && i <= numEditLines);
// move to new text pos
tempPort.moveTo(workRect.x, workRect.y);
// pen color black
- tempPort.setColor(((i != index) && exists[i]) ? fontColorFore : textDisable);
+ tempPort.setColor(((i != _index) && _exists[i]) ? _fontColorFore : textDisable);
// draw the text
- tempPort.drawText(fieldStrings[i]);
+ tempPort.drawText(_fieldStrings[i]);
//increment the position
- workRect.y += fontOffset;
+ workRect.y += _fontOffset;
}
- oldMark = endLine;
+ _oldMark = _endLine;
// reset the old font
- tempPort.setFont(oldFont);
+ tempPort.setFont(_oldFont);
// Blit the pixelmap to the main screen
diff --git a/engines/saga2/gtextbox.h b/engines/saga2/gtextbox.h
index bbce442ef72..7706b44673c 100644
--- a/engines/saga2/gtextbox.h
+++ b/engines/saga2/gtextbox.h
@@ -64,55 +64,55 @@ extern StaticRect editBaseRect;
class gTextBox : public gControl {
private:
- char **fieldStrings;
- char *undoBuffer; // undo buffer for editing
- bool internalBuffer;
+ char **_fieldStrings;
+ char *_undoBuffer; // undo buffer for editing
+ bool _internalBuffer;
// editor values
- uint16 maxLen,
- currentLen[numEditLines],
- exists[numEditLines],
- undoLen,
- cursorPos,
- anchorPos,
- scrollPixels;
- uint16 flags;
+ uint16 _maxLen,
+ _currentLen[numEditLines],
+ _exists[numEditLines],
+ _undoLen,
+ _cursorPos,
+ _anchorPos,
+ _scrollPixels;
+ uint16 _flags;
// text display values
- int8 fontOffset;
- int8 linesPerPage;
- int8 index;
- int8 endLine;
- int8 oldMark;
+ int8 _fontOffset;
+ int8 _linesPerPage;
+ int8 _index;
+ int8 _endLine;
+ int8 _oldMark;
// font settings
- gFont *textFont;
- gFont *oldFont;
- int8 fontHeight;
- int8 fontColorFore;
- int8 fontColorBack;
- int8 fontColorHilite;
- byte fontColorBackHilite;
- byte cursorColor;
- int32 blinkStart;
- int16 blinkX;
- int8 blinkState;
+ gFont *_textFont;
+ gFont *_oldFont;
+ int8 _fontHeight;
+ int8 _fontColorFore;
+ int8 _fontColorBack;
+ int8 _fontColorHilite;
+ byte _fontColorBackHilite;
+ byte _cursorColor;
+ int32 _blinkStart;
+ int16 _blinkX;
+ int8 _blinkState;
// editing switch values
- bool displayOnly;
- bool editing;
- Rect16 editRect;
- bool hilit;
- bool noUndo;
- bool fullRedraw;
- bool inDrag;
- bool isActiveCtl;
+ bool _displayOnly;
+ bool _editing;
+ Rect16 _editRect;
+ bool _hilit;
+ bool _noUndo;
+ bool _fullRedraw;
+ bool _inDrag;
+ bool _isActiveCtl;
- AppFunc *onEnter;
- AppFunc *onEscape;
+ AppFunc *_onEnter;
+ AppFunc *_onEscape;
- gPanelList *parent; // window
+ gPanelList *_parent; // window
protected:
@@ -197,7 +197,7 @@ public:
char *getLine(int8);
int8 getIndex() {
- return index;
+ return _index;
}
void killChanges() {
Commit: e39360e66749292c44f83a823ffa653589950dd8
https://github.com/scummvm/scummvm/commit/e39360e66749292c44f83a823ffa653589950dd8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:26+02:00
Commit Message:
SAGA2: Rename class variables in imagcach.h
Changed paths:
engines/saga2/imagcach.cpp
engines/saga2/imagcach.h
diff --git a/engines/saga2/imagcach.cpp b/engines/saga2/imagcach.cpp
index bf7c9a155c7..e2b01f7ff63 100644
--- a/engines/saga2/imagcach.cpp
+++ b/engines/saga2/imagcach.cpp
@@ -32,30 +32,30 @@ namespace Saga2 {
CImageNode::CImageNode(hResContext *con, uint32 resID) {
if (con) {
- image = LoadResource(con, resID, "CImageNode Allocation");
- resourceID = resID;
- contextID = con->getResID();
- requested = 0; // zero request for this node at creation
+ _image = LoadResource(con, resID, "CImageNode Allocation");
+ _resourceID = resID;
+ _contextID = con->getResID();
+ _requested = 0; // zero request for this node at creation
} else {
- image = nullptr;
- resourceID = 0;
- contextID = 0;
- requested = 0;
+ _image = nullptr;
+ _resourceID = 0;
+ _contextID = 0;
+ _requested = 0;
}
}
CImageNode::~CImageNode() {
- if (image) {
- free(image);
- image = nullptr;
+ if (_image) {
+ free(_image);
+ _image = nullptr;
}
}
// figures out if the requested image is the same as this one
bool CImageNode::isSameImage(hResContext *con, uint32 resID) {
if (con) {
- if (con->getResID() == contextID &&
- resourceID == resID) {
+ if (con->getResID() == _contextID &&
+ _resourceID == resID) {
return true; // match
}
}
@@ -65,7 +65,7 @@ bool CImageNode::isSameImage(hResContext *con, uint32 resID) {
bool CImageNode::isSameImage(void *imagePtr) {
// if the image passed has the same address as the image in the node...
- if (imagePtr == image) {
+ if (imagePtr == _image) {
return true;
}
@@ -75,10 +75,10 @@ bool CImageNode::isSameImage(void *imagePtr) {
// return true if this node needs to be deleted
bool CImageNode::releaseRequest() {
// the number of requests on this resource goes down by one
- requested--;
+ _requested--;
// if that was the last request, release this node
- if (requested <= 0) {
+ if (_requested <= 0) {
return true;
}
@@ -87,8 +87,8 @@ bool CImageNode::releaseRequest() {
}
void *CImageNode::getImagePtr() {
- requested++;
- return image;
+ _requested++;
+ return _image;
}
/* ===================================================================== *
diff --git a/engines/saga2/imagcach.h b/engines/saga2/imagcach.h
index 401b150f06c..9e70012baca 100644
--- a/engines/saga2/imagcach.h
+++ b/engines/saga2/imagcach.h
@@ -34,11 +34,11 @@ namespace Saga2 {
class CImageNode {
private:
- uint32 contextID; // ID of context
- uint32 resourceID; // RES_ID of image
+ uint32 _contextID; // ID of context
+ uint32 _resourceID; // RES_ID of image
- uint16 requested; // the number of allocation requests made to node
- void *image; // the image
+ uint16 _requested; // the number of allocation requests made to node
+ void *_image; // the image
public:
CImageNode(hResContext *con, uint32 resID);
@@ -48,7 +48,7 @@ public:
bool isSameImage(hResContext *con, uint32 resID);
bool isSameImage(void *imagePtr);
uint16 getNumRequested() {
- return requested;
+ return _requested;
}
bool releaseRequest();
};
Commit: 56d0d75216e986d580d5604f2b3ead85d991883f
https://github.com/scummvm/scummvm/commit/56d0d75216e986d580d5604f2b3ead85d991883f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:26+02:00
Commit Message:
SAGA2: Rename class variables in interp.cpp
Changed paths:
engines/saga2/interp.cpp
diff --git a/engines/saga2/interp.cpp b/engines/saga2/interp.cpp
index 3f24eb80040..3f30350655d 100644
--- a/engines/saga2/interp.cpp
+++ b/engines/saga2/interp.cpp
@@ -470,27 +470,27 @@ uint8 *Thread::strAddress(int strNum) {
// RandomGenerator class - a random number generator class for function
// objects which each maintain a local seed.
class RandomGenerator {
- uint32 a; // seed
- static const uint32 b; // arbitrary constant
+ uint32 _a; // seed
+ static const uint32 _b; // arbitrary constant
public:
- RandomGenerator() : a(1) {
+ RandomGenerator() : _a(1) {
}
RandomGenerator(uint16 seed) {
- a = (uint32)seed << 16;
+ _a = (uint32)seed << 16;
}
void seed(uint16 seed) {
- a = (uint32)seed << 16;
+ _a = (uint32)seed << 16;
}
uint16 operator()() {
- a = (a * b) + 1;
- return a >> 16;
+ _a = (_a * _b) + 1;
+ return _a >> 16;
}
};
-const uint32 RandomGenerator::b = 31415821;
+const uint32 RandomGenerator::_b = 31415821;
//-----------------------------------------------------------------------
// A restricted random function
Commit: 7b69970c822c06c39d65a013c74adf4fe67a40fe
https://github.com/scummvm/scummvm/commit/7b69970c822c06c39d65a013c74adf4fe67a40fe
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:26+02:00
Commit Message:
SAGA2: Fix class variable names in intrface.h
Changed paths:
engines/saga2/intrface.cpp
engines/saga2/intrface.h
engines/saga2/motion.cpp
engines/saga2/uidialog.cpp
diff --git a/engines/saga2/intrface.cpp b/engines/saga2/intrface.cpp
index 29a79e7c81a..34f8ad5d892 100644
--- a/engines/saga2/intrface.cpp
+++ b/engines/saga2/intrface.cpp
@@ -62,7 +62,7 @@ extern uint8 fixedColors[16];
class gArmorIndicator : public GfxCompImage {
public:
- ArmorAttributes attr;
+ ArmorAttributes _attr;
void drawClipped(gPort &,
const Point16 &,
const Rect16 &) override;
@@ -71,9 +71,9 @@ public:
gArmorIndicator(gPanelList &list, const Rect16 &box, void *img, uint16 ident, AppFunc *cmd = nullptr)
: GfxCompImage(list, box, img, ident, cmd) {
- attr.damageAbsorbtion = 0;
- attr.damageDivider = 1;
- attr.defenseBonus = 0;
+ _attr.damageAbsorbtion = 0;
+ _attr.damageDivider = 1;
+ _attr.defenseBonus = 0;
}
};
@@ -181,7 +181,7 @@ const char *enchantmentNames[] = {
class gEnchantmentDisplay : public gControl {
- uint8 iconFlags[iconCount];
+ uint8 _iconFlags[iconCount];
void drawClipped(gPort &, const Point16 &, const Rect16 &) override;
void pointerMove(gPanelMessage &msg) override;
@@ -190,7 +190,7 @@ public:
gEnchantmentDisplay(gPanelList &list, uint16 ident, AppFunc *cmd = nullptr)
: gControl(list, Rect16(0, 0, 630, 18), nullptr, ident, cmd) {
- memset(iconFlags, 0, sizeof iconFlags);
+ memset(_iconFlags, 0, sizeof(_iconFlags));
}
};
@@ -229,7 +229,7 @@ APPFUNC(cmdManaInd);
User control metrics
* ===================================================================== */
-// position arrays for all buttons on the individual panels
+// position arrays for all _buttons on the individual panels
static const StaticRect topBox[numButtons] = {
/* portrait */ { 489, 22 + (yContOffset * 0), 65, 72 },
/* agress */ { 559, 86 + (yContOffset * 0), 28, 27 },
@@ -269,7 +269,7 @@ static const StaticRect botBox[numButtons] = {
GfxCompButton *optBtn;
gEnchantmentDisplay *enchDisp;
-// brother buttons
+// brother _buttons
GfxOwnerSelCompButton *julBtn;
GfxOwnerSelCompButton *phiBtn;
GfxOwnerSelCompButton *kevBtn;
@@ -344,13 +344,13 @@ static const StaticRect *views[] = {
botBox
};
-// individual indicators/buttons
+// individual indicators/_buttons
static const StaticRect menConBtnRect = {485, 265, 44, 43};
// options button
static const StaticRect optBtnRect = {20, 445, 26, 15};
-// brother buttons and frame
+// brother _buttons and frame
static const StaticRect broBtnRect = {481, 450, 144, 11};
static const StaticRect julBtnRect = {482, 451, 44, 9};
static const StaticRect phiBtnRect = {531, 451, 44, 9};
@@ -399,16 +399,16 @@ CPlaqText::CPlaqText(gPanelList &list,
AppFunc *cmd)
: gControl(list, box, msg, ident, cmd) {
if (strlen(msg) <= bufSize) {
- strcpy(lineBuf, msg);
+ strcpy(_lineBuf, msg);
} else {
- *lineBuf = '\0';
+ *_lineBuf = '\0';
}
- textFacePal = pal;
- buttonFont = font;
- textRect = box;
- textPosition = textPos;
- oldFont = nullptr;
+ _textFacePal = pal;
+ _buttonFont = font;
+ _textRect = box;
+ _textPosition = textPos;
+ _oldFont = nullptr;
}
void CPlaqText::enable(bool abled) {
@@ -426,31 +426,31 @@ void CPlaqText::draw() {
// save pen color, etc.
SAVE_GPORT_STATE(port);
- oldFont = port._font;
+ _oldFont = port._font;
// setup the port
port.setMode(drawModeMatte);
- port.setFont(buttonFont);
+ port.setFont(_buttonFont);
g_vm->_pointer->hide(port, _extent); // hide mouse pointer
drawClipped(port, Point16(0, 0), Rect16(0, 0, rect.width, rect.height));
g_vm->_pointer->show(port, _extent); // show mouse pointer
// reset the old font
- port.setFont(oldFont);
+ port.setFont(_oldFont);
}
void CPlaqText::drawClipped(gPort &port,
const Point16 &offset,
const Rect16 &r) {
if (_extent.overlap(r)) {
- if (*lineBuf) {
- textRect = _extent;
- textRect.x -= offset.x;
- textRect.y -= offset.y;
+ if (*_lineBuf) {
+ _textRect = _extent;
+ _textRect.x -= offset.x;
+ _textRect.y -= offset.y;
- writePlaqText(port, textRect, buttonFont, textPosition, textFacePal, selected, lineBuf);
+ writePlaqText(port, _textRect, _buttonFont, _textPosition, _textFacePal, selected, _lineBuf);
}
}
}
@@ -471,14 +471,14 @@ CPortrait::CPortrait(GfxMultCompButton **portraits,
assert(portraits[i]);
};
- buttons = portraits; // set the pointer for class
- indivButton = indivPort; // set the individual portrait
- numButtons = numPorts; // number of buttons per pointer
+ _buttons = portraits; // set the pointer for class
+ _indivButton = indivPort; // set the individual portrait
+ _numButtons = numPorts; // number of buttons per pointer
_numViews = numBrothers; // number of pointers for whole array
// start off in a normal facial state
for (uint16 i = 0; i < _numViews + 1; i++) {
- currentState[i] = kPortraitNormal;
+ _currentState[i] = kPortraitNormal;
}
}
@@ -489,16 +489,16 @@ void CPortrait::setPortrait(uint16 brotherID) {
if (brotherID == uiIndiv) {
WriteStatusF(4, " Brother id %d", brotherID);
- indivButton->setCurrent(currentState[brotherID]);
- indivButton->invalidate();
+ _indivButton->setCurrent(_currentState[brotherID]);
+ _indivButton->invalidate();
} else {
- buttons[brotherID]->setCurrent(currentState[brotherID]);
- buttons[brotherID]->invalidate();
+ _buttons[brotherID]->setCurrent(_currentState[brotherID]);
+ _buttons[brotherID]->invalidate();
}
}
void CPortrait::set(uint16 brotherID, PortraitType type) {
- currentState[brotherID] = type;
+ _currentState[brotherID] = type;
setPortrait(brotherID);
}
@@ -506,10 +506,10 @@ void CPortrait::set(uint16 brotherID, PortraitType type) {
void CPortrait::ORset(uint16 brotherID, PortraitType type) { // brotherID = post 0
assert(brotherID < _numViews + 1);
- if (type == currentState[brotherID]) {
- currentState[brotherID] = kPortraitNormal;
+ if (type == _currentState[brotherID]) {
+ _currentState[brotherID] = kPortraitNormal;
} else {
- currentState[brotherID] = type;
+ _currentState[brotherID] = type;
}
// set this button to the new state
@@ -598,132 +598,132 @@ CStatusLine::CStatusLine(gPanelList &list,
AppFunc *cmd) :
CPlaqText(list, box, msg, font, textPos, pal, ident, cmd) {
- lineDisplayed = false;
- queueHead = queueTail = 0;
+ _lineDisplayed = false;
+ _queueHead = _queueTail = 0;
- for (int i = 0; i < ARRAYSIZE(lineQueue); i++) {
- lineQueue[i].text = nullptr;
- lineQueue[i].frameTime = 0;
+ for (int i = 0; i < ARRAYSIZE(_lineQueue); i++) {
+ _lineQueue[i].text = nullptr;
+ _lineQueue[i].frameTime = 0;
}
- waitAlarm._basetime = waitAlarm._duration = 0;
- minWaitAlarm._basetime = minWaitAlarm._duration = 0;
+ _waitAlarm._basetime = _waitAlarm._duration = 0;
+ _minWaitAlarm._basetime = _minWaitAlarm._duration = 0;
}
CStatusLine::~CStatusLine() {
- while (queueTail != queueHead) {
- assert(lineQueue[queueTail].text != nullptr);
+ while (_queueTail != _queueHead) {
+ assert(_lineQueue[_queueTail].text != nullptr);
- delete[] lineQueue[queueTail].text;
- queueTail = bump(queueTail);
+ delete[] _lineQueue[_queueTail].text;
+ _queueTail = bump(_queueTail);
}
}
void CStatusLine::setLine(char *msg, uint32 frameTime) { // frametime def
- uint8 newHead = bump(queueHead);
+ uint8 newHead = bump(_queueHead);
- if (newHead != queueTail) {
+ if (newHead != _queueTail) {
size_t msgLen = strlen(msg);
- if ((lineQueue[queueHead].text = new char[msgLen + 1]()) != nullptr) {
- strcpy(lineQueue[queueHead].text, msg);
- lineQueue[queueHead].frameTime = frameTime;
- queueHead = newHead;
+ if ((_lineQueue[_queueHead].text = new char[msgLen + 1]()) != nullptr) {
+ strcpy(_lineQueue[_queueHead].text, msg);
+ _lineQueue[_queueHead].frameTime = frameTime;
+ _queueHead = newHead;
}
}
}
void CStatusLine::experationCheck() {
- if (lineDisplayed
- && (waitAlarm.check()
- || (queueTail != queueHead && minWaitAlarm.check()))) {
+ if (_lineDisplayed
+ && (_waitAlarm.check()
+ || (_queueTail != _queueHead && _minWaitAlarm.check()))) {
enable(false);
window.update(_extent);
- lineDisplayed = false;
+ _lineDisplayed = false;
}
- if (!lineDisplayed && queueTail != queueHead) {
+ if (!_lineDisplayed && _queueTail != _queueHead) {
// enable the control
enable(true);
// set up the time for this message
- waitAlarm.set(lineQueue[queueTail].frameTime);
- minWaitAlarm.set(lineQueue[queueTail].frameTime / 5);
+ _waitAlarm.set(_lineQueue[_queueTail].frameTime);
+ _minWaitAlarm.set(_lineQueue[_queueTail].frameTime / 5);
// copy upto the buffer's size in chars
- Common::strlcpy(lineBuf, lineQueue[queueTail].text, bufSize);
- lineBuf[bufSize - 1] = '\0';
+ Common::strlcpy(_lineBuf, _lineQueue[_queueTail].text, bufSize);
+ _lineBuf[bufSize - 1] = '\0';
// free the queue text buffer
- delete[] lineQueue[queueTail].text;
- lineQueue[queueTail].text = nullptr;
+ delete[] _lineQueue[_queueTail].text;
+ _lineQueue[_queueTail].text = nullptr;
// bump the queue tail
- queueTail = bump(queueTail);
+ _queueTail = bump(_queueTail);
// draw the new textline
window.update(_extent);
- lineDisplayed = true;
+ _lineDisplayed = true;
}
}
void CStatusLine::clear() {
enable(false);
window.update(_extent);
- lineDisplayed = false;
+ _lineDisplayed = false;
- queueHead = queueTail = 0;
+ _queueHead = _queueTail = 0;
}
/* ===================================================================== *
CMassWeightInterface: mass and weight allowence indicators
* ===================================================================== */
-bool CMassWeightIndicator::bRedraw;
+bool CMassWeightIndicator::_bRedraw;
CMassWeightIndicator::CMassWeightIndicator(gPanelList *panel, const Point16 &pos, uint16 type, bool death) {
// set up the position of this indicator
- backImagePos = pos;
- massPiePos = backImagePos;
- bulkPiePos = backImagePos;
+ _backImagePos = pos;
+ _massPiePos = _backImagePos;
+ _bulkPiePos = _backImagePos;
- massPiePos.x += massPieXOffset;
- massPiePos.y += massPieYOffset;
- bulkPiePos.x += bulkPieXOffset;
- bulkPiePos.y += bulkPieYOffset;
+ _massPiePos.x += massPieXOffset;
+ _massPiePos.y += massPieYOffset;
+ _bulkPiePos.x += bulkPieXOffset;
+ _bulkPiePos.y += bulkPieYOffset;
- bRedraw = true; // this MUST be true or the indicators will not draw the first time
+ _bRedraw = true; // this MUST be true or the indicators will not draw the first time
// attach the resource context
- containerRes = resFile->newContext(containerGroupID, "container context");
+ _containerRes = resFile->newContext(containerGroupID, "container context");
// setup mass/bulk indicator imagery
if (death) {
- massBulkImag = g_vm->_imageCache->requestImage(containerRes, MKTAG('D', 'J', 'B', massBulkResNum));
+ _massBulkImag = g_vm->_imageCache->requestImage(_containerRes, MKTAG('D', 'J', 'B', massBulkResNum));
- pieIndImag = loadImageRes(containerRes, pieIndResNum, numPieIndImages, 'D', 'A', 'J');
+ _pieIndImag = loadImageRes(_containerRes, pieIndResNum, numPieIndImages, 'D', 'A', 'J');
} else {
- massBulkImag = g_vm->_imageCache->requestImage(containerRes, MKTAG('G', 'J', 'B', massBulkResNum));
+ _massBulkImag = g_vm->_imageCache->requestImage(_containerRes, MKTAG('G', 'J', 'B', massBulkResNum));
- pieIndImag = loadImageRes(containerRes, pieIndResNum, numPieIndImages, 'G', 'A', 'J');
+ _pieIndImag = loadImageRes(_containerRes, pieIndResNum, numPieIndImages, 'G', 'A', 'J');
}
// attach controls to the indivControls panel
// these butttons will get deactivated along with the panel
- pieMass = new GfxCompImage(*panel,
- Rect16(massPiePos.x, massPiePos.y, pieXSize, pieYSize),
- pieIndImag,
+ _pieMass = new GfxCompImage(*panel,
+ Rect16(_massPiePos.x, _massPiePos.y, pieXSize, pieYSize),
+ _pieIndImag,
numPieIndImages,
0,
type,
cmdMassInd);
- pieBulk = new GfxCompImage(*panel,
- Rect16(bulkPiePos.x, bulkPiePos.y, pieXSize, pieYSize),
- pieIndImag,
+ _pieBulk = new GfxCompImage(*panel,
+ Rect16(_bulkPiePos.x, _bulkPiePos.y, pieXSize, pieYSize),
+ _pieIndImag,
numPieIndImages,
0,
type,
@@ -731,25 +731,25 @@ CMassWeightIndicator::CMassWeightIndicator(gPanelList *panel, const Point16 &pos
// mass/bulk back image
new GfxCompImage(*panel,
- Rect16(backImagePos.x, backImagePos.y, backImageXSize, backImageYSize),
- massBulkImag,
+ Rect16(_backImagePos.x, _backImagePos.y, backImageXSize, backImageYSize),
+ _massBulkImag,
uiIndiv,
nullptr);
// release resource context
- if (containerRes) {
- resFile->disposeContext(containerRes);
- containerRes = nullptr;
+ if (_containerRes) {
+ resFile->disposeContext(_containerRes);
+ _containerRes = nullptr;
}
- currentMass = 0;
- currentBulk = 0;
+ _currentMass = 0;
+ _currentBulk = 0;
// if this is something other then the ready containers
if (type > 1) {
- containerObject = (GameObject *)panel->userData;
+ _containerObject = (GameObject *)panel->userData;
} else {
- containerObject = nullptr;
+ _containerObject = nullptr;
}
g_vm->_indList.push_back(this);
@@ -758,8 +758,8 @@ CMassWeightIndicator::CMassWeightIndicator(gPanelList *panel, const Point16 &pos
CMassWeightIndicator::~CMassWeightIndicator() {
g_vm->_indList.remove(this);
- unloadImageRes(pieIndImag, numPieIndImages);
- g_vm->_imageCache->releaseImage(massBulkImag);
+ unloadImageRes(_pieIndImag, numPieIndImages);
+ g_vm->_imageCache->releaseImage(_massBulkImag);
}
/*****************************************************************************
@@ -768,17 +768,17 @@ CMassWeightIndicator::~CMassWeightIndicator() {
** mass and bulk of the current ( single mode ) player
**/
void CMassWeightIndicator::recalculate() {
- assert(pieMass);
- assert(pieBulk);
+ assert(_pieMass);
+ assert(_pieBulk);
uint16 mass = getMassPieDiv();
uint16 bulk = getBulkPieDiv();
uint16 retMass, retBulk;
- if (containerObject) {
- setMassPie(retMass = getWeightRatio(containerObject, mass, false));
- setBulkPie(retBulk = getBulkRatio(containerObject, bulk, false));
+ if (_containerObject) {
+ setMassPie(retMass = getWeightRatio(_containerObject, mass, false));
+ setBulkPie(retBulk = getBulkRatio(_containerObject, bulk, false));
} else {
setMassPie(retMass = getWeightRatio(g_vm->_playerList[getCenterActorPlayerID()]->getActor(), mass, false));
setBulkPie(retBulk = getBulkRatio(g_vm->_playerList[getCenterActorPlayerID()]->getActor(), bulk, false));
@@ -791,13 +791,13 @@ void CMassWeightIndicator::recalculate() {
** weight/bulk control ( so it refreshes )
**/
void CMassWeightIndicator::update() {
- if (bRedraw == true) {
+ if (_bRedraw == true) {
for (Common::List<CMassWeightIndicator *>::iterator it = g_vm->_indList.begin(); it != g_vm->_indList.end(); ++it) {
(*it)->recalculate();
(*it)->invalidate();
}
- bRedraw = false;
+ _bRedraw = false;
}
}
@@ -830,70 +830,70 @@ CManaIndicator::CManaIndicator(gPanelList &list) : GfxCompImage(list,
assert(resFile);
// init the resource handle with the mana resource group
- resContext = resFile->newContext(MKTAG('M', 'A', 'N', 'A'), "mana context");
+ _resContext = resFile->newContext(MKTAG('M', 'A', 'N', 'A'), "mana context");
// load star images
- starImages = loadImageRes(resContext, starResNum, numStars, 'S', 'T', 'A');
+ _starImages = loadImageRes(_resContext, starResNum, numStars, 'S', 'T', 'A');
// load in the ring images
- ringImages = loadImageRes(resContext, ringResNum, numRings, 'R', 'N', 'G');
+ _ringImages = loadImageRes(_resContext, ringResNum, numRings, 'R', 'N', 'G');
- backImage = g_vm->_imageCache->requestImage(resContext, MKTAG('B', 'A', 'C', 'K'));
+ _backImage = g_vm->_imageCache->requestImage(_resContext, MKTAG('B', 'A', 'C', 'K'));
- wellImage = g_vm->_imageCache->requestImage(resContext, MKTAG('W', 'E', 'L', 'L'));
+ _wellImage = g_vm->_imageCache->requestImage(_resContext, MKTAG('W', 'E', 'L', 'L'));
// hmm this could be cleaner...
- starRingEndPos[0] = Point16(redEndX, redEndY);
- starRingEndPos[1] = Point16(orangeEndX, orangeEndY);
- starRingEndPos[2] = Point16(yellowEndX, yellowEndY);
- starRingEndPos[3] = Point16(greenEndX, greenEndY);
- starRingEndPos[4] = Point16(blueEndX, blueEndY);
- starRingEndPos[5] = Point16(violetEndX, violetEndY);
-
- starSizes[0] = Point16(star1XSize, star1YSize);
- starSizes[1] = Point16(star2XSize, star2YSize);
- starSizes[2] = Point16(star3XSize, star3YSize);
- starSizes[3] = Point16(star4XSize, star4YSize);
- starSizes[4] = Point16(star5XSize, star5YSize);
- starSizes[5] = Point16(star6XSize, star6YSize);
- starSizes[6] = Point16(star7XSize, star7YSize);
-
- ringSizes[0] = Point16(ring1XSize, ring1YSize);
- ringSizes[1] = Point16(ring2XSize, ring2YSize);
- ringSizes[2] = Point16(ring3XSize, ring3YSize);
- ringSizes[3] = Point16(ring4XSize, ring4YSize);
- ringSizes[4] = Point16(ring5XSize, ring5YSize);
- ringSizes[5] = Point16(ring6XSize, ring6YSize);
- ringSizes[6] = Point16(ring7XSize, ring7YSize);
+ _starRingEndPos[0] = Point16(redEndX, redEndY);
+ _starRingEndPos[1] = Point16(orangeEndX, orangeEndY);
+ _starRingEndPos[2] = Point16(yellowEndX, yellowEndY);
+ _starRingEndPos[3] = Point16(greenEndX, greenEndY);
+ _starRingEndPos[4] = Point16(blueEndX, blueEndY);
+ _starRingEndPos[5] = Point16(violetEndX, violetEndY);
+
+ _starSizes[0] = Point16(star1XSize, star1YSize);
+ _starSizes[1] = Point16(star2XSize, star2YSize);
+ _starSizes[2] = Point16(star3XSize, star3YSize);
+ _starSizes[3] = Point16(star4XSize, star4YSize);
+ _starSizes[4] = Point16(star5XSize, star5YSize);
+ _starSizes[5] = Point16(star6XSize, star6YSize);
+ _starSizes[6] = Point16(star7XSize, star7YSize);
+
+ _ringSizes[0] = Point16(ring1XSize, ring1YSize);
+ _ringSizes[1] = Point16(ring2XSize, ring2YSize);
+ _ringSizes[2] = Point16(ring3XSize, ring3YSize);
+ _ringSizes[3] = Point16(ring4XSize, ring4YSize);
+ _ringSizes[4] = Point16(ring5XSize, ring5YSize);
+ _ringSizes[5] = Point16(ring6XSize, ring6YSize);
+ _ringSizes[6] = Point16(ring7XSize, ring7YSize);
// get rid of resource context
- resFile->disposeContext(resContext);
- resContext = nullptr;
+ resFile->disposeContext(_resContext);
+ _resContext = nullptr;
// set update checks to nominal values
for (uint16 i = 0; i < numManaTypes; i++) {
- currentMana[i] = -1;
- currentBaseMana[i] = -1;
+ _currentMana[i] = -1;
+ _currentBaseMana[i] = -1;
}
// init the save map
- savedMap._size = Extent16(xSize, ySize);
- savedMap._data = new uint8[savedMap.bytes()];
+ _savedMap._size = Extent16(xSize, ySize);
+ _savedMap._data = new uint8[_savedMap.bytes()];
}
CManaIndicator::~CManaIndicator() {
// release images
- unloadImageRes(starImages, numStars);
- unloadImageRes(ringImages, numRings);
+ unloadImageRes(_starImages, numStars);
+ unloadImageRes(_ringImages, numRings);
// release back image
- g_vm->_imageCache->releaseImage(backImage);
- g_vm->_imageCache->releaseImage(wellImage);
+ g_vm->_imageCache->releaseImage(_backImage);
+ g_vm->_imageCache->releaseImage(_wellImage);
// release the saved map
- if (savedMap._data)
- delete[] savedMap._data;
+ if (_savedMap._data)
+ delete[] _savedMap._data;
}
// this method provides a rect for any of the six mana regions of the control
@@ -954,12 +954,12 @@ void CManaIndicator::drawClipped(gPort &port,
// draw the saved image to the port
port.setMode(drawModeMatte);
- port.bltPixels(savedMap, 0, 0,
+ port.bltPixels(_savedMap, 0, 0,
_extent.x - offset.x, _extent.y - offset.y,
xSize, ySize);
// draw the frame
- drawCompressedImage(port, Point16(_extent.x - offset.x, _extent.y - offset.y), backImage);
+ drawCompressedImage(port, Point16(_extent.x - offset.x, _extent.y - offset.y), _backImage);
// and finish
return;
@@ -980,7 +980,7 @@ void CManaIndicator::drawClipped(gPort &port,
memset(tempPort._map->_data, 24, tempPort._map->bytes());
// draw the well
- drawCompressedImage(tempPort, Point16(wellX, wellY), wellImage);
+ drawCompressedImage(tempPort, Point16(wellX, wellY), _wellImage);
// make a mixing plane and blank it
mixMap._size = Extent16(xSize, ySize);
@@ -999,8 +999,8 @@ void CManaIndicator::drawClipped(gPort &port,
// draw each star and ring with color remap
for (uint16 i = 0; i < numManaTypes; i++) {
// get the header for the image pointer passed
- ImageHeader *starHdr = (ImageHeader *)starImages[manaLines[i].starImageIndex];
- ImageHeader *ringHdr = (ImageHeader *)ringImages[manaLines[i].ringImageIndex];
+ ImageHeader *starHdr = (ImageHeader *)_starImages[_manaLines[i].starImageIndex];
+ ImageHeader *ringHdr = (ImageHeader *)_ringImages[_manaLines[i].ringImageIndex];
// set the buffer blit area to the image size
starMap._size = starHdr->size;
@@ -1025,8 +1025,8 @@ void CManaIndicator::drawClipped(gPort &port,
} else ringMap._data = (uint8 *)ringHdr->data;
// now blit the rings to the mixing surface
- TBlit(&mixMap, &ringMap, manaLines[i].ringPos.x, manaLines[i].ringPos.y);
- TBlit(&tempMap, &starMap, manaLines[i].starPos.x, manaLines[i].starPos.y);
+ TBlit(&mixMap, &ringMap, _manaLines[i].ringPos.x, _manaLines[i].ringPos.y);
+ TBlit(&tempMap, &starMap, _manaLines[i].starPos.x, _manaLines[i].starPos.y);
// now do a peusdo-log additive thing to the images
uint8 *dst = (uint8 *)mixMap._data;
@@ -1068,7 +1068,7 @@ void CManaIndicator::drawClipped(gPort &port,
}
// save this frame
- TBlit(&savedMap, tempPort._map, 0, 0);
+ TBlit(&_savedMap, tempPort._map, 0, 0);
// Blit the pixelmap to the main screen
port.setMode(drawModeMatte);
@@ -1077,7 +1077,7 @@ void CManaIndicator::drawClipped(gPort &port,
xSize, ySize);
// now blit the frame on top of it all.
- drawCompressedImage(port, Point16(_extent.x - offset.x, _extent.y - offset.y), backImage);
+ drawCompressedImage(port, Point16(_extent.x - offset.x, _extent.y - offset.y), _backImage);
// dispose of temporary pixelmap
DisposeTempPort(tempPort);
@@ -1106,7 +1106,7 @@ bool CManaIndicator::needUpdate(PlayerActor *player) {
baseManaAmount = baseStatsRef.mana(i);
// check for new data
- if (manaAmount != currentMana[i] || baseManaAmount != currentBaseMana[i]) {
+ if (manaAmount != _currentMana[i] || baseManaAmount != _currentBaseMana[i]) {
return true;
}
}
@@ -1133,18 +1133,18 @@ bool CManaIndicator::update(PlayerActor *player) {
baseManaAmount = baseStatsRef.mana(i);
// check for new data
- if (manaAmount != currentMana[i] || baseManaAmount != currentBaseMana[i]) {
+ if (manaAmount != _currentMana[i] || baseManaAmount != _currentBaseMana[i]) {
newData = true;
- currentMana[i] = manaAmount;
- currentBaseMana[i] = baseManaAmount;
+ _currentMana[i] = manaAmount;
+ _currentBaseMana[i] = baseManaAmount;
}
// get manaLine info ( which star/ring image, and position on screen )
// from getStarInfo which takes the mana type index ( i ),
// current mana total, and the player base mana
if (newData == true) {
- getManaLineInfo(i, manaAmount, baseManaAmount, &manaLines[i]);
+ getManaLineInfo(i, manaAmount, baseManaAmount, &_manaLines[i]);
}
}
@@ -1175,12 +1175,12 @@ void CManaIndicator::getManaLineInfo(uint16 index,
// Calculate the positions of the mana stars, and which images to use.
manaInfo.starPos = LERP(basePos,
- starRingEndPos[index],
+ _starRingEndPos[index],
(int32)maxLevel,
(int32)manaAmount);
manaInfo.ringPos = LERP(basePos,
- starRingEndPos[index],
+ _starRingEndPos[index],
(int32)maxLevel,
(int32)baseManaAmount);
@@ -1188,10 +1188,10 @@ void CManaIndicator::getManaLineInfo(uint16 index,
manaInfo.ringImageIndex = clamp(0, baseManaAmount * numStars / maxLevel, numRings - 1);
// now do centering correct for images
- manaInfo.starPos.x -= starSizes[manaInfo.starImageIndex].x / 2;
- manaInfo.starPos.y -= starSizes[manaInfo.starImageIndex].y / 2;
- manaInfo.ringPos.x -= ringSizes[manaInfo.ringImageIndex].x / 2;
- manaInfo.ringPos.y -= ringSizes[manaInfo.ringImageIndex].y / 2;
+ manaInfo.starPos.x -= _starSizes[manaInfo.starImageIndex].x / 2;
+ manaInfo.starPos.y -= _starSizes[manaInfo.starImageIndex].y / 2;
+ manaInfo.ringPos.x -= _ringSizes[manaInfo.ringImageIndex].x / 2;
+ manaInfo.ringPos.y -= _ringSizes[manaInfo.ringImageIndex].y / 2;
// return the manaLineInfo struct info about mana star ring
*info = manaInfo;
@@ -1205,37 +1205,37 @@ CHealthIndicator::CHealthIndicator(AppFunc *cmd) {
uint16 i;
// init the resource handle with the image group context
- healthRes = resFile->newContext(imageGroupID, "health imagery context");
+ _healthRes = resFile->newContext(imageGroupID, "health imagery context");
// load in health star imagery
- starImag = loadButtonRes(healthRes, starStart, starNum, 'S', 'T', 'A');
+ _starImag = loadButtonRes(_healthRes, starStart, starNum, 'S', 'T', 'A');
// load in the health star border
- starFrameImag = g_vm->_imageCache->requestImage(healthRes, MKTAG('B', 'T', 'N', starFrameResNum));
+ _starFrameImag = g_vm->_imageCache->requestImage(_healthRes, MKTAG('B', 'T', 'N', starFrameResNum));
// set the image indexes to nominal startup values
for (i = 0; i < numControls + 1; i++) {
- imageIndexMemory[i] = -1;
+ _imageIndexMemory[i] = -1;
}
// setup the id's for each of the stars
- starIDs[0] = uiJulian;
- starIDs[1] = uiPhillip;
- starIDs[2] = uiKevin;
+ _starIDs[0] = uiJulian;
+ _starIDs[1] = uiPhillip;
+ _starIDs[2] = uiKevin;
// health controls for the trio view
// deallocated with panel
for (i = 0; i < numControls; i++) {
- starBtns[i] = new GfxCompImage(*trioControls,
+ _starBtns[i] = new GfxCompImage(*trioControls,
Rect16(starXPos,
starYPos + starYOffset * i,
starXSize,
starYSize),
- starImag,
+ _starImag,
starNum,
starInitial,
- starIDs[i],
+ _starIDs[i],
cmd);
@@ -1245,7 +1245,7 @@ CHealthIndicator::CHealthIndicator(AppFunc *cmd) {
frameYPos + starYOffset * i,
frameXSize,
frameYSize),
- starFrameImag,
+ _starFrameImag,
0,
nullptr);
@@ -1253,12 +1253,12 @@ CHealthIndicator::CHealthIndicator(AppFunc *cmd) {
}
// health control for individual mode
// deallocated with panel
- indivStarBtn = new GfxCompImage(*indivControls,
+ _indivStarBtn = new GfxCompImage(*indivControls,
Rect16(starXPos,
starYPos,
starXSize,
starYSize),
- starImag,
+ _starImag,
starNum,
starInitial,
uiIndiv,
@@ -1270,24 +1270,24 @@ CHealthIndicator::CHealthIndicator(AppFunc *cmd) {
frameYPos,
frameXSize,
frameYSize),
- starFrameImag,
+ _starFrameImag,
0,
nullptr);
// release resource context
- if (healthRes) {
- resFile->disposeContext(healthRes);
- healthRes = nullptr;
+ if (_healthRes) {
+ resFile->disposeContext(_healthRes);
+ _healthRes = nullptr;
}
}
CHealthIndicator::~CHealthIndicator() {
// release star imagery
- unloadImageRes(starImag, starNum);
+ unloadImageRes(_starImag, starNum);
// release star frame imagery
- g_vm->_imageCache->releaseImage(starFrameImag);
+ g_vm->_imageCache->releaseImage(_starFrameImag);
}
// Recalculate and update the health star for a particular brother
@@ -1305,11 +1305,11 @@ void CHealthIndicator::updateStar(GfxCompImage *starCtl, int32 bro, int32 baseVi
imageIndex = (int16)(sqrt((double)MAX((int32)0, curVitality)) * maxStar) / sqrt((double)baseVitality);
// prevent needless draws
- if (imageIndexMemory[bro] != imageIndex) {
+ if (_imageIndexMemory[bro] != imageIndex) {
starCtl->setCurrent(imageIndex);
starCtl->invalidate();
- imageIndexMemory[bro] = imageIndex;
+ _imageIndexMemory[bro] = imageIndex;
}
}
@@ -1319,7 +1319,7 @@ void CHealthIndicator::update() {
int16 baseVitality = g_vm->_playerList[translatePanID(uiIndiv)]->getBaseStats().vitality;
int16 currVitality = g_vm->_playerList[translatePanID(uiIndiv)]->getEffStats()->vitality;
- updateStar(indivStarBtn, uiIndiv, baseVitality, currVitality);
+ updateStar(_indivStarBtn, uiIndiv, baseVitality, currVitality);
} else {
for (uint16 i = 0; i < numControls; i++) {
@@ -1327,7 +1327,7 @@ void CHealthIndicator::update() {
int16 baseVitality = g_vm->_playerList[i]->getBaseStats().vitality;
int16 currVitality = g_vm->_playerList[i]->getEffStats()->vitality;
- updateStar(starBtns[i], i, baseVitality, currVitality);
+ updateStar(_starBtns[i], i, baseVitality, currVitality);
}
}
}
@@ -1346,7 +1346,7 @@ void writePlaqText(gPort &port,
va_list argptr;
Rect16 workRect;
int16 cnt;
- gFont *oldFont = port._font;
+ gFont *_oldFont = port._font;
va_start(argptr, msg);
cnt = vsprintf(lineBuf, msg, argptr);
@@ -1384,7 +1384,7 @@ void writePlaqText(gPort &port,
workRect.y++;
port.drawTextInBox(lineBuf, cnt, workRect, textPos, Point16(0, 0));
- port.setFont(oldFont);
+ port.setFont(_oldFont);
}
void writePlaqTextPos(gPort &port,
@@ -1397,7 +1397,7 @@ void writePlaqTextPos(gPort &port,
char lineBuf[128];
va_list argptr;
Point16 drawPos;
- gFont *oldFont = port._font;
+ gFont *_oldFont = port._font;
va_start(argptr, msg);
vsprintf(lineBuf, msg, argptr);
@@ -1449,7 +1449,7 @@ void writePlaqTextPos(gPort &port,
port.drawText(lineBuf, -1);
- port.setFont(oldFont);
+ port.setFont(_oldFont);
}
@@ -1580,7 +1580,7 @@ void SetupUserControls() {
enchDisp = new gEnchantmentDisplay(*playControls, 0);
- // setup the trio user cntl buttons
+ // setup the trio user cntl _buttons
for (n = 0; n < kNumViews; n++) {
// portrait button
portBtns[n] = new GfxMultCompButton(*trioControls, views[n][index++],
@@ -1615,7 +1615,7 @@ void SetupUserControls() {
index = 0;
}
- // individual control buttons
+ // individual control _buttons
// portrait button
indivPortBtn = new GfxMultCompButton(*indivControls, views[0][index++],
@@ -1645,7 +1645,7 @@ void SetupUserControls() {
namePlateFrameImag, 0, nullptr);
// setup the portrait object
- Portrait = new CPortrait(portBtns, // portrait buttons
+ Portrait = new CPortrait(portBtns, // portrait _buttons
indivPortBtn,
numPortImages,// num of images per button
kNumViews); // number of brothers
@@ -1654,12 +1654,12 @@ void SetupUserControls() {
// mental container button
menConBtn = new GfxCompButton(*indivControls, menConBtnRect, menConBtnImag, numBtnImages, uiIndiv, cmdBrain);
- // brother selection buttons >>> need to replace these with sticky buttons
+ // brother selection _buttons >>> need to replace these with sticky _buttons
julBtn = new GfxOwnerSelCompButton(*indivControls, julBtnRect, julBtnImag, numBtnImages, uiJulian, cmdBroChange);
phiBtn = new GfxOwnerSelCompButton(*indivControls, phiBtnRect, phiBtnImag, numBtnImages, uiPhillip, cmdBroChange);
kevBtn = new GfxOwnerSelCompButton(*indivControls, kevBtnRect, kevBtnImag, numBtnImages, uiKevin, cmdBroChange);
- // frame for brother buttons
+ // frame for brother _buttons
broBtnFrame = new GfxCompImage(*indivControls, broBtnRect, broBtnFrameImag, uiIndiv, nullptr);
// make the mana indicator
@@ -1707,7 +1707,7 @@ void CleanupButtonImages() {
// dealloc the imag for the option button
unloadImageRes(optBtnImag, numBtnImages);
- // dealloc brother's indiv mode buttons
+ // dealloc brother's indiv mode _buttons
unloadImageRes(julBtnImag, numBtnImages);
unloadImageRes(phiBtnImag, numBtnImages);
unloadImageRes(kevBtnImag, numBtnImages);
@@ -1831,17 +1831,17 @@ void setEnchantmentDisplay() {
if (enchDisp) enchDisp->setValue(getCenterActorPlayerID());
}
-// sets the individual brother control state buttons
+// sets the individual brother control state _buttons
void setIndivBtns(uint16 brotherID) { // top = 0, mid = 1, bot = 2
g_vm->_indivControlsFlag = true;
// set the indiv bro
indivBrother = brotherID;
- // set all the individual brother buttons to the correct states
+ // set all the individual brother _buttons to the correct states
indivCenterBtn->select(centerBtns[brotherID]->isSelected());
indivCenterBtn->ghost(centerBtns[brotherID]->isGhosted());
- //indivStarBtn->setCurrent( ( uint16 )starBtns[brotherID]->getCurrent() );
+ //_indivStarBtn->setCurrent( ( uint16 )_starBtns[brotherID]->getCurrent() );
indivPortBtn->setImages(portImag[brotherID]);
indivNamePlate->setImage(namePlateImages[brotherID]);
Portrait->set(uiIndiv, Portrait->getCurrentState(brotherID));
@@ -1864,14 +1864,14 @@ void setIndivBtns(uint16 brotherID) { // top = 0, mid = 1, bot = 2
// now set the indicators for mass and bulk
uint16 pieWeightRatio = MassWeightIndicator->getMassPieDiv();
- uint16 pieBulkRatio = MassWeightIndicator->getBulkPieDiv();
+ uint16 _pieBulkRatio = MassWeightIndicator->getBulkPieDiv();
PlayerActor *brother = g_vm->_playerList[brotherID];
MassWeightIndicator->setMassPie(getWeightRatio(brother->getActor(), pieWeightRatio, false));
- MassWeightIndicator->setBulkPie(getBulkRatio(brother->getActor(), pieBulkRatio, false));
+ MassWeightIndicator->setBulkPie(getBulkRatio(brother->getActor(), _pieBulkRatio, false));
}
-// sets the trio brothers control state buttons
+// sets the trio brothers control state _buttons
void setTrioBtns() {
g_vm->_indivControlsFlag = false;
@@ -1886,7 +1886,7 @@ void setTrioBtns() {
}
void setControlPanelsToIndividualMode(uint16 brotherID) {
- // copy the button/indicator states to the indiv buttons
+ // copy the button/indicator states to the indiv _buttons
setIndivBtns(brotherID);
// set the mode controls
@@ -1966,7 +1966,7 @@ void updateBrotherRadioButtons(uint16 brotherID) {
bool phi = (uiPhillip == brotherID);
bool kev = (uiKevin == brotherID);
- // set the selection buttons to the correct states
+ // set the selection _buttons to the correct states
julBtn->select(jul);
phiBtn->select(phi);
kevBtn->select(kev);
@@ -1975,7 +1975,7 @@ void updateBrotherRadioButtons(uint16 brotherID) {
phiBtn->ghost(isBrotherDead(uiPhillip));
kevBtn->ghost(isBrotherDead(uiKevin));
- // set the center brother buttons
+ // set the center brother _buttons
centerBtns[uiJulian]->select(jul);
centerBtns[uiPhillip]->select(phi);
centerBtns[uiKevin]->select(kev);
@@ -2238,15 +2238,15 @@ APPFUNC(cmdArmor) {
gArmorIndicator *gai = (gArmorIndicator *)ev.panel;
char buf[128];
- if (gai->attr.damageAbsorbtion == 0
- && gai->attr.defenseBonus == 0) {
+ if (gai->_attr.damageAbsorbtion == 0
+ && gai->_attr.defenseBonus == 0) {
g_vm->_mouseInfo->setText(NO_ARMOR);
} else {
sprintf(buf,
DESC_ARMOR,
- gai->attr.damageAbsorbtion,
- gai->attr.damageDivider,
- gai->attr.defenseBonus);
+ gai->_attr.damageAbsorbtion,
+ gai->_attr.damageDivider,
+ gai->_attr.defenseBonus);
// set the text in the cursor
g_vm->_mouseInfo->setText(buf);
@@ -2325,7 +2325,7 @@ APPFUNC(cmdBroChange) {
if (ev.eventType == gEventNewValue) {
if (!isBrotherDead(ev.panel->id)) {
setCenterBrother(ev.panel->id);
- // this sets up the buttons in trio mode to the correct
+ // this sets up the _buttons in trio mode to the correct
// state ( must be called before indiv mode switchtes )
setTrioBtns();
setControlPanelsToIndividualMode(ev.panel->id);
@@ -2389,7 +2389,7 @@ APPFUNC(cmdHealthStar) {
APPFUNC(cmdMassInd) {
gWindow *win = nullptr;
- GameObject *containerObject = nullptr;
+ GameObject *_containerObject = nullptr;
if (ev.eventType == gEventMouseMove) {
if (ev.value == GfxCompImage::enter) {
@@ -2404,14 +2404,14 @@ APPFUNC(cmdMassInd) {
// is it something other than the brother's indicators?
if (ev.panel->id > 1) {
- containerObject = (GameObject *)win->userData;
+ _containerObject = (GameObject *)win->userData;
} else {
- containerObject = (GameObject *)g_vm->_playerList[getCenterActorPlayerID()]->getActor();
+ _containerObject = (GameObject *)g_vm->_playerList[getCenterActorPlayerID()]->getActor();
}
- assert(containerObject);
+ assert(_containerObject);
- curWeight = getWeightRatio(containerObject, baseWeight);
+ curWeight = getWeightRatio(_containerObject, baseWeight);
if (baseWeight != unlimitedCapacity) {
sprintf(buf, "%s %d/%d", WEIGHT_HINT, curWeight, baseWeight);
@@ -2426,7 +2426,7 @@ APPFUNC(cmdMassInd) {
APPFUNC(cmdBulkInd) {
gWindow *win = nullptr;
- GameObject *containerObject = nullptr;
+ GameObject *_containerObject = nullptr;
if (ev.eventType == gEventMouseMove) {
@@ -2442,14 +2442,14 @@ APPFUNC(cmdBulkInd) {
// is it something other than the brother's indicators?
if (ev.panel->id > 1) {
- containerObject = (GameObject *)win->userData;
+ _containerObject = (GameObject *)win->userData;
} else {
- containerObject = (GameObject *)g_vm->_playerList[getCenterActorPlayerID()]->getActor();
+ _containerObject = (GameObject *)g_vm->_playerList[getCenterActorPlayerID()]->getActor();
}
- assert(containerObject);
+ assert(_containerObject);
- curBulk = getBulkRatio(containerObject, baseBulk);
+ curBulk = getBulkRatio(_containerObject, baseBulk);
if (baseBulk != unlimitedCapacity) {
sprintf(buf, "%s %d/%d", BULK_HINT, curBulk, baseBulk);
@@ -2579,7 +2579,7 @@ void cleanupUIState() {
void gArmorIndicator::setValue(PlayerActorID brotherID) {
Actor *bro = g_vm->_playerList[brotherID]->getActor();
- bro->totalArmorAttributes(attr);
+ bro->totalArmorAttributes(_attr);
invalidate();
}
@@ -2618,18 +2618,18 @@ void gArmorIndicator::drawClipped(gPort &port,
port.setOutlineColor(24); // set outline color to black
port.setMode(drawModeMatte);
- if (attr.damageAbsorbtion == 0 && attr.defenseBonus == 0)
+ if (_attr.damageAbsorbtion == 0 && _attr.defenseBonus == 0)
sprintf(buf, "-");
- else if (attr.damageDivider > 1)
- sprintf(buf, "%d/%d", attr.damageAbsorbtion, attr.damageDivider);
- else sprintf(buf, "%d", attr.damageAbsorbtion);
+ else if (_attr.damageDivider > 1)
+ sprintf(buf, "%d/%d", _attr.damageAbsorbtion, _attr.damageDivider);
+ else sprintf(buf, "%d", _attr.damageAbsorbtion);
port.drawTextInBox(buf, -1, Rect16(pos.x, pos.y, _extent.width, _extent.height),
textPosRight | textPosHigh, Point16(0, 2));
- if (attr.damageAbsorbtion == 0 && attr.defenseBonus == 0)
+ if (_attr.damageAbsorbtion == 0 && _attr.defenseBonus == 0)
sprintf(buf, "-");
- else sprintf(buf, "%d", attr.defenseBonus);
+ else sprintf(buf, "%d", _attr.defenseBonus);
port.drawTextInBox(buf, -1, Rect16(pos.x, pos.y, _extent.width, _extent.height),
textPosRight | textPosLow, Point16(0, 2));
}
@@ -2644,7 +2644,7 @@ void gEnchantmentDisplay::drawClipped(gPort &port, const Point16 &offset, con
if (!_extent.overlap(r)) return;
for (int i = 0; i < iconCount; i++) {
- if (iconFlags[i]) {
+ if (_iconFlags[i]) {
Sprite *sp = mentalSprites->sprite(i + 162);
pos.x -= sp->size.x + 2;
@@ -2663,7 +2663,7 @@ void gEnchantmentDisplay::pointerMove(gPanelMessage &msg) {
setValue(getCenterActorPlayerID());
for (int i = 0; i < iconCount; i++) {
- if (iconFlags[i]) {
+ if (_iconFlags[i]) {
Sprite *sp = mentalSprites->sprite(i + 162);
x -= sp->size.x + 2;
@@ -2671,9 +2671,9 @@ void gEnchantmentDisplay::pointerMove(gPanelMessage &msg) {
// set the text in the cursor
char buf[128];
- if (iconFlags[i] == 255)
+ if (_iconFlags[i] == 255)
sprintf(buf, "%s", enchantmentNames[i]);
- else sprintf(buf, "%s : %d", enchantmentNames[i], iconFlags[i]);
+ else sprintf(buf, "%s : %d", enchantmentNames[i], _iconFlags[i]);
g_vm->_mouseInfo->setText(buf);
return;
}
@@ -2939,8 +2939,8 @@ void gEnchantmentDisplay::setValue(PlayerActorID pID) {
// If icon flags changed, then redraw the control.
- if (memcmp(iconFlags, newIconFlags, sizeof iconFlags)) {
- memcpy(iconFlags, newIconFlags, sizeof iconFlags);
+ if (memcmp(_iconFlags, newIconFlags, sizeof _iconFlags)) {
+ memcpy(_iconFlags, newIconFlags, sizeof _iconFlags);
invalidate();
}
}
diff --git a/engines/saga2/intrface.h b/engines/saga2/intrface.h
index bda0506b450..76c4f709286 100644
--- a/engines/saga2/intrface.h
+++ b/engines/saga2/intrface.h
@@ -187,12 +187,12 @@ protected:
};
- char lineBuf[bufSize]; // text to render on button
- textPallete textFacePal; // contains info about coloring for multi-depth text rendering
- Rect16 textRect; // rect for the text
- int16 textPosition;
- gFont *buttonFont; // pointer to font for this button
- gFont *oldFont;
+ char _lineBuf[bufSize]; // text to render on button
+ textPallete _textFacePal; // contains info about coloring for multi-depth text rendering
+ Rect16 _textRect; // rect for the text
+ int16 _textPosition;
+ gFont *_buttonFont; // pointer to font for this button
+ gFont *_oldFont;
public:
@@ -220,17 +220,17 @@ public:
class CStatusLine : public CPlaqText {
private:
- Alarm waitAlarm,
- minWaitAlarm;
+ Alarm _waitAlarm,
+ _minWaitAlarm;
struct {
char *text;
uint32 frameTime;
- } lineQueue[12];
+ } _lineQueue[12];
- uint8 queueHead,
- queueTail;
- bool lineDisplayed;
+ uint8 _queueHead,
+ _queueTail;
+ bool _lineDisplayed;
static uint8 bump(uint8 i) {
return (i + 1) % 12;
@@ -265,11 +265,11 @@ enum PortraitType {
class CPortrait {
private:
- PortraitType currentState[kNumViews + 1];
- uint16 numButtons;
+ PortraitType _currentState[kNumViews + 1];
+ uint16 _numButtons;
uint16 _numViews;
- GfxMultCompButton **buttons;
- GfxMultCompButton *indivButton;
+ GfxMultCompButton **_buttons;
+ GfxMultCompButton *_indivButton;
void setPortrait(uint16);
@@ -280,7 +280,7 @@ public:
void ORset(uint16, PortraitType type);
void set(uint16 brotherID, PortraitType type);
PortraitType getCurrentState(uint16 brotherID) {
- return currentState[brotherID];
+ return _currentState[brotherID];
}
void getStateString(char buf[], int8 size, uint16 brotherID);
};
@@ -292,10 +292,10 @@ public:
class CMassWeightIndicator {
private:
- GameObject *containerObject;
+ GameObject *_containerObject;
public:
- static bool bRedraw;
+ static bool _bRedraw;
private:
enum {
@@ -313,49 +313,49 @@ private:
};
// xy positions of this indicator
- Point16 backImagePos;
- Point16 massPiePos;
- Point16 bulkPiePos;
+ Point16 _backImagePos;
+ Point16 _massPiePos;
+ Point16 _bulkPiePos;
// memory for update
- uint16 currentMass;
- uint16 currentBulk;
+ uint16 _currentMass;
+ uint16 _currentBulk;
// resource context pointer
- hResContext *containerRes;
+ hResContext *_containerRes;
// indicator images
- void *massBulkImag;
+ void *_massBulkImag;
// array of pointers to images
- void **pieIndImag;
+ void **_pieIndImag;
// image control buttons
- GfxCompImage *pieMass;
- GfxCompImage *pieBulk;
+ GfxCompImage *_pieMass;
+ GfxCompImage *_pieBulk;
public:
void invalidate(Rect16 *unused = nullptr) {
- pieMass->invalidate();
- pieBulk->invalidate();
+ _pieMass->invalidate();
+ _pieBulk->invalidate();
}
CMassWeightIndicator(gPanelList *, const Point16 &, uint16 type = 1, bool death = false);
~CMassWeightIndicator();
uint16 getMassPieDiv() {
- return pieMass->getMax();
+ return _pieMass->getMax();
}
uint16 getBulkPieDiv() {
- return pieBulk->getMax();
+ return _pieBulk->getMax();
}
void setMassPie(uint16 val) {
- pieMass->setCurrent(val);
+ _pieMass->setCurrent(val);
}
void setBulkPie(uint16 val) {
- pieBulk->setCurrent(val);
+ _pieBulk->setCurrent(val);
}
void recalculate();
static void update();
@@ -488,31 +488,31 @@ public:
private:
// resource handle
- hResContext *resContext;
+ hResContext *_resContext;
// array of image pointers
- void **starImages;
- void **ringImages;
+ void **_starImages;
+ void **_ringImages;
// background image pointer
- void *backImage;
- void *wellImage;
+ void *_backImage;
+ void *_wellImage;
// image maps
- gPixelMap savedMap;
+ gPixelMap _savedMap;
// array of manaLine infos for blitting
- manaLineInfo manaLines[numManaTypes];
+ manaLineInfo _manaLines[numManaTypes];
// array of ring and star end positions
// this is initialized via constructor
- Point16 starRingEndPos[numManaTypes];
+ Point16 _starRingEndPos[numManaTypes];
- Point16 starSizes[numStars];
- Point16 ringSizes[numRings];
+ Point16 _starSizes[numStars];
+ Point16 _ringSizes[numRings];
// these are checks against redundent updates
- int32 currentMana[numManaTypes], currentBaseMana[numManaTypes];
+ int32 _currentMana[numManaTypes], _currentBaseMana[numManaTypes];
protected:
// these do line and position calculations
@@ -555,7 +555,7 @@ public:
class CHealthIndicator {
private:
- static const char *hintText;
+ static const char *_hintText;
enum {
starFrameResNum = 14,
@@ -580,23 +580,23 @@ private:
};
// resource handle
- hResContext *healthRes;
+ hResContext *_healthRes;
// buttons
- GfxCompImage *starBtns[numControls];
- GfxCompImage *indivStarBtn;
+ GfxCompImage *_starBtns[numControls];
+ GfxCompImage *_indivStarBtn;
// array of pointer to the star imagery
- void **starImag;
+ void **_starImag;
// health star frame imagery
- void *starFrameImag;
+ void *_starFrameImag;
void updateStar(GfxCompImage *starCtl, int32 bro, int32 baseVitality, int32 curVitality);
public:
- uint16 starIDs[3];
- int16 imageIndexMemory[4];
+ uint16 _starIDs[3];
+ int16 _imageIndexMemory[4];
public:
diff --git a/engines/saga2/motion.cpp b/engines/saga2/motion.cpp
index 1d37d1de2ca..7c4bd12351c 100644
--- a/engines/saga2/motion.cpp
+++ b/engines/saga2/motion.cpp
@@ -4395,7 +4395,7 @@ void MotionTask::updatePositions() {
g_vm->_mTaskList->_nextMT = it;
}
- CMassWeightIndicator::bRedraw = true; // tell the mass/weight indicators to refresh
+ CMassWeightIndicator::_bRedraw = true; // tell the mass/weight indicators to refresh
break;
@@ -4431,7 +4431,7 @@ void MotionTask::updatePositions() {
g_vm->_mTaskList->_nextMT = it;
}
- CMassWeightIndicator::bRedraw = true; // tell the mass/weight indicators to refresh
+ CMassWeightIndicator::_bRedraw = true; // tell the mass/weight indicators to refresh
break;
diff --git a/engines/saga2/uidialog.cpp b/engines/saga2/uidialog.cpp
index 34b40102ea4..54fe3d0332d 100644
--- a/engines/saga2/uidialog.cpp
+++ b/engines/saga2/uidialog.cpp
@@ -1382,7 +1382,7 @@ void CPlacardPanel::positionText(const char *windowText, const Rect16 &textArea)
yPos,
maxY;
- int16 fontHeight = buttonFont->height;
+ int16 fontHeight = _buttonFont->height;
// make a copy of the window text string
sprintf(titleBuf, "%s", windowText);
@@ -1402,7 +1402,7 @@ void CPlacardPanel::positionText(const char *windowText, const Rect16 &textArea)
titlePos[i].x =
textArea.x +
((textArea.width -
- TextWidth(buttonFont, titleStrings[i], -1, 0))
+ TextWidth(_buttonFont, titleStrings[i], -1, 0))
>> 1);
} else titleCount = i;
}
@@ -1450,9 +1450,9 @@ void CPlacardPanel::drawClipped(
writePlaqTextPos(port,
textPos,
- buttonFont,
+ _buttonFont,
0,
- textFacePal,
+ _textFacePal,
false,
titleStrings[i]);
}
Commit: f3a751e94791d4b0e54e1cf5ec90cea4d9157e07
https://github.com/scummvm/scummvm/commit/f3a751e94791d4b0e54e1cf5ec90cea4d9157e07
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:26+02:00
Commit Message:
SAGA2: Rename class variables in mapfeatr.h
Changed paths:
engines/saga2/mapfeatr.cpp
engines/saga2/mapfeatr.h
diff --git a/engines/saga2/mapfeatr.cpp b/engines/saga2/mapfeatr.cpp
index 8874ca03dc5..c8c0887b34b 100644
--- a/engines/saga2/mapfeatr.cpp
+++ b/engines/saga2/mapfeatr.cpp
@@ -298,10 +298,10 @@ void termMapFeatures() {
CMapFeature::CMapFeature(TilePoint where, int16 inWorld, const char *desc) {
- visible = false;
- featureCoords = where;
- world = inWorld;
- Common::strlcpy(name, desc, MAX_MAP_FEATURE_NAME_LENGTH);
+ _visible = false;
+ _featureCoords = where;
+ _world = inWorld;
+ Common::strlcpy(_name, desc, MAX_MAP_FEATURE_NAME_LENGTH);
}
@@ -311,12 +311,12 @@ void CMapFeature::draw(TileRegion viewRegion,
gPort &tPort) {
int32 x, y;
- if (world != inWorld) return;
+ if (_world != inWorld) return;
update();
- //TilePoint centerCoords = featureCoords >> (kTileUVShift + kPlatShift);
- TilePoint fCoords = featureCoords >> (kTileUVShift + kPlatShift);
- if (visible &&
+ //TilePoint centerCoords = _featureCoords >> (kTileUVShift + kPlatShift);
+ TilePoint fCoords = _featureCoords >> (kTileUVShift + kPlatShift);
+ if (_visible &&
fCoords.u >= viewRegion.min.u &&
fCoords.u <= viewRegion.max.u &&
fCoords.v >= viewRegion.min.v &&
@@ -325,7 +325,7 @@ void CMapFeature::draw(TileRegion viewRegion,
// Calculate the position of the cross-hairs showing the position of
// the center actor.
- centerPt = featureCoords - (baseCoords << (kTileUVShift + kPlatShift));
+ centerPt = _featureCoords - (baseCoords << (kTileUVShift + kPlatShift));
x = ((centerPt.u - centerPt.v) >> (kTileUVShift + kPlatShift - 2)) + 261 + 4;
y = 255 + 4 - ((centerPt.u + centerPt.v) >> (kTileUVShift + kPlatShift - 1));
@@ -354,9 +354,9 @@ bool CMapFeature::hitCheck(TileRegion viewRegion,
TilePoint comparePoint) {
int32 x, y;
- if (world != inWorld) return false;
- TilePoint fCoords = featureCoords >> (kTileUVShift + kPlatShift);
- if (visible &&
+ if (_world != inWorld) return false;
+ TilePoint fCoords = _featureCoords >> (kTileUVShift + kPlatShift);
+ if (_visible &&
fCoords.u >= viewRegion.min.u &&
fCoords.u <= viewRegion.max.u &&
fCoords.v >= viewRegion.min.v &&
@@ -365,7 +365,7 @@ bool CMapFeature::hitCheck(TileRegion viewRegion,
// Calculate the position of the cross-hairs showing the position of
// the center actor.
- centerPt = featureCoords - (baseCoords << (kTileUVShift + kPlatShift));
+ centerPt = _featureCoords - (baseCoords << (kTileUVShift + kPlatShift));
x = ((centerPt.u - centerPt.v) >> (kTileUVShift + kPlatShift - 2)) + 261 + 4;
y = 255 + 4 - ((centerPt.u + centerPt.v) >> (kTileUVShift + kPlatShift - 1));
@@ -382,13 +382,13 @@ bool CMapFeature::hitCheck(TileRegion viewRegion,
CStaticMapFeature::CStaticMapFeature(TilePoint where, int16 inWorld, const char *desc, int16 bColor)
: CMapFeature(where, inWorld, desc) {
- color = bColor;
+ _color = bColor;
}
void CStaticMapFeature::blit(gPort &tPort, int32 x, int32 y) {
tPort.setColor(9 + 15); // black
tPort.fillRect(x - 2, y - 2, 5, 5);
- tPort.setColor(color); // whatever color its supposed to be
+ tPort.setColor(_color); // whatever color its supposed to be
tPort.fillRect(x - 1, y - 1, 3, 3);
}
@@ -404,7 +404,7 @@ bool CStaticMapFeature::isHit(TilePoint disp, TilePoint mouse) {
CPictureMapFeature::CPictureMapFeature(TilePoint where, int16 inWorld, char *desc, gPixelMap *pm)
: CMapFeature(where, inWorld, desc) {
- pic = pm;
+ _pic = pm;
}
void CPictureMapFeature::blit(gPort &tPort, int32 x, int32 y) {
diff --git a/engines/saga2/mapfeatr.h b/engines/saga2/mapfeatr.h
index 2d4bcaa950e..2073762c400 100644
--- a/engines/saga2/mapfeatr.h
+++ b/engines/saga2/mapfeatr.h
@@ -44,10 +44,10 @@ class gPixelMap;
// Pure virtual base class for map features
class CMapFeature {
- bool visible;
- int16 world;
- TilePoint featureCoords;
- char name[MAX_MAP_FEATURE_NAME_LENGTH];
+ bool _visible;
+ int16 _world;
+ TilePoint _featureCoords;
+ char _name[MAX_MAP_FEATURE_NAME_LENGTH];
public:
@@ -55,21 +55,21 @@ public:
virtual ~CMapFeature() {}
void expose(bool canSee = true) {
- visible = canSee;
+ _visible = canSee;
}
void draw(TileRegion tr, int16 inWorld, TilePoint bc, gPort &tport);
bool hitCheck(TileRegion vr, int16 inWorld, TilePoint bc, TilePoint cp);
int16 getWorld() {
- return world;
+ return _world;
}
int16 getU() {
- return featureCoords.u;
+ return _featureCoords.u;
}
int16 getV() {
- return featureCoords.v;
+ return _featureCoords.v;
}
char *getText() {
- return name;
+ return _name;
}
// The only aspect of different map features is what they look like
@@ -85,7 +85,7 @@ typedef CMapFeature *pCMapFeature;
// class for map features with static icons
class CStaticMapFeature : public CMapFeature {
- int16 color;
+ int16 _color;
public:
CStaticMapFeature(TilePoint where, int16 inWorld, const char *desc, int16 bColor);
@@ -99,7 +99,7 @@ public:
// class for map features with static icons
class CPictureMapFeature : public CMapFeature {
- gPixelMap *pic;
+ gPixelMap *_pic;
public:
CPictureMapFeature(TilePoint where, int16 inWorld, char *desc, gPixelMap *pm);
Commit: 9bb65c95fe71422cc77248324fa6f28bd84ff19f
https://github.com/scummvm/scummvm/commit/9bb65c95fe71422cc77248324fa6f28bd84ff19f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:26+02:00
Commit Message:
SAGA2: Fix class variable names in messager.h
Changed paths:
engines/saga2/messager.cpp
engines/saga2/messager.h
diff --git a/engines/saga2/messager.cpp b/engines/saga2/messager.cpp
index cf6f671acd2..67fb584e1f8 100644
--- a/engines/saga2/messager.cpp
+++ b/engines/saga2/messager.cpp
@@ -30,7 +30,7 @@
namespace Saga2 {
size_t Messager::va(const char *format, va_list argptr) {
- if (enabled) {
+ if (_enabled) {
char tempBuf[256];
size_t size;
@@ -48,7 +48,7 @@ size_t Messager::va(const char *format, va_list argptr) {
}
size_t Messager::operator()(const char *format, ...) {
- if (enabled) {
+ if (_enabled) {
size_t size;
va_list argptr;
@@ -69,39 +69,39 @@ uint16 heightStatusF = 11;
int StatusLineMessager::dumpit(char *s, size_t size) {
Rect16 r;
- r.x = atX;
- r.y = atY;
- r.width = atW;
+ r.x = _atX;
+ r.y = _atY;
+ r.width = _atW;
r.height = heightStatusF;
- textPort->setColor(blackStatusF);
- textPort->fillRect(r);
- textPort->setColor(atColor);
- textPort->setStyle(0);
- textPort->drawTextInBox(s, size, r, textPosLeft, Point16(2, 1));
+ _textPort->setColor(blackStatusF);
+ _textPort->fillRect(r);
+ _textPort->setColor(_atColor);
+ _textPort->setStyle(0);
+ _textPort->drawTextInBox(s, size, r, textPosLeft, Point16(2, 1));
return 0;
}
StatusLineMessager::StatusLineMessager(const char *entry, int lineno, gDisplayPort *mp, int32 x, int32 y, int32 w, int16 color)
: Messager(entry) {
- line = lineno;
- textPort = mp;
- atX = (x >= 0 ? x : defaultStatusFX);
- atY = (y >= 0 ? y : defaultStatusFY + line * heightStatusF);
- atW = (w >= 0 ? w : 640 - (defaultStatusFX - 16) - 20);
- atColor = (color >= 0 ? color : line * 16 + 12);
- operator()("Status Line %d", line);
+ _line = lineno;
+ _textPort = mp;
+ _atX = (x >= 0 ? x : defaultStatusFX);
+ _atY = (y >= 0 ? y : defaultStatusFY + _line * heightStatusF);
+ _atW = (w >= 0 ? w : 640 - (defaultStatusFX - 16) - 20);
+ _atColor = (color >= 0 ? color : _line * 16 + 12);
+ operator()("Status Line %d", _line);
}
StatusLineMessager::StatusLineMessager(int lineno, gDisplayPort *mp, int32 x, int32 y, int32 w, int16 color) {
- line = lineno;
- textPort = mp;
- atX = (x >= 0 ? x : defaultStatusFX);
- atY = (y >= 0 ? y : defaultStatusFY + line * heightStatusF);
- atW = (w >= 0 ? w : 640 - (defaultStatusFX - 16) - 20);
- atColor = (color >= 0 ? color : line * 16 + 12);
- operator()("Status Line %d", line);
+ _line = lineno;
+ _textPort = mp;
+ _atX = (x >= 0 ? x : defaultStatusFX);
+ _atY = (y >= 0 ? y : defaultStatusFY + _line * heightStatusF);
+ _atW = (w >= 0 ? w : 640 - (defaultStatusFX - 16) - 20);
+ _atColor = (color >= 0 ? color : _line * 16 + 12);
+ operator()("Status Line %d", _line);
}
StatusLineMessager::~StatusLineMessager() {
diff --git a/engines/saga2/messager.h b/engines/saga2/messager.h
index 4965adb2a05..cd40f9f2acd 100644
--- a/engines/saga2/messager.h
+++ b/engines/saga2/messager.h
@@ -62,15 +62,15 @@ class gDisplayPort;
class Messager {
protected:
- bool enabled;
+ bool _enabled;
virtual int dumpit(char *, size_t) = 0;
public:
Messager() {
- enabled = true;
+ _enabled = true;
}
Messager(const char *entry) {
- enabled = true;
+ _enabled = true;
}
virtual ~Messager() {}
@@ -78,13 +78,13 @@ public:
size_t va(const char *format, va_list argptr);
void enable() {
- enabled = true;
+ _enabled = true;
}
void disable() {
- enabled = false;
+ _enabled = false;
}
bool active() {
- return enabled;
+ return _enabled;
}
};
@@ -100,10 +100,10 @@ typedef Messager *pMessager;
class StatusLineMessager : public Messager {
private:
- int line;
- int32 atX, atY, atW;
- int16 atColor;
- gDisplayPort *textPort;
+ int _line;
+ int32 _atX, _atY, _atW;
+ int16 _atColor;
+ gDisplayPort *_textPort;
protected:
int dumpit(char *s, size_t size) ;
Commit: b8632b0a918ab4477bf1a3253833c1ca2ca08939
https://github.com/scummvm/scummvm/commit/b8632b0a918ab4477bf1a3253833c1ca2ca08939
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:27+02:00
Commit Message:
SAGA2: Rename class variables in modal.h
Changed paths:
engines/saga2/modal.cpp
engines/saga2/modal.h
diff --git a/engines/saga2/modal.cpp b/engines/saga2/modal.cpp
index cb6e999e70d..f577794a4ab 100644
--- a/engines/saga2/modal.cpp
+++ b/engines/saga2/modal.cpp
@@ -54,14 +54,14 @@ extern void updateWindowSection(const Rect16 &r);
Modal Window class member functions
* ===================================================================== */
-ModalWindow *ModalWindow::current = nullptr;
+ModalWindow *ModalWindow::_current = nullptr;
ModalWindow::ModalWindow(const Rect16 &r, uint16 ident, AppFunc *cmd)
: DecoratedWindow(r, ident, "DialogWindow", cmd) {
- prevModeStackCtr = 0;
+ _prevModeStackCtr = 0;
for (int i = 0; i < Max_Modes; i++)
- prevModeStackPtr[i] = nullptr;
+ _prevModeStackPtr[i] = nullptr;
}
ModalWindow::~ModalWindow() {
@@ -81,13 +81,11 @@ bool ModalWindow::open() {
g_vm->_mouseInfo->setText(nullptr);
g_vm->_mouseInfo->setIntent(GrabInfo::WalkTo);
- prevModeStackCtr = GameMode::getStack(prevModeStackPtr);
+ _prevModeStackCtr = GameMode::getStack(_prevModeStackPtr);
GameMode *gameModes[] = {&PlayMode, &TileMode, &ModalMode};
GameMode::SetStack(gameModes, 3);
- current = this;
-
-
+ _current = this;
return gWindow::open();
}
@@ -95,7 +93,7 @@ bool ModalWindow::open() {
void ModalWindow::close() {
gWindow::close();
- GameMode::SetStack(prevModeStackPtr, prevModeStackCtr);
+ GameMode::SetStack(_prevModeStackPtr, _prevModeStackCtr);
updateWindowSection(_extent);
}
diff --git a/engines/saga2/modal.h b/engines/saga2/modal.h
index cc3cb7ec56c..b92075875df 100644
--- a/engines/saga2/modal.h
+++ b/engines/saga2/modal.h
@@ -44,8 +44,8 @@ extern GameMode ModalMode;
* ===================================================================== */
class ModalWindow : public DecoratedWindow {
- GameMode *prevModeStackPtr[Max_Modes];
- int prevModeStackCtr;
+ GameMode *_prevModeStackPtr[Max_Modes];
+ int _prevModeStackCtr;
public:
@@ -58,7 +58,7 @@ public:
void close();
bool isModal();
- static ModalWindow *current;
+ static ModalWindow *_current;
void handleKey(short, short);
};
Commit: c2d795f63c4a89373cdc76cd9ac8d34b6ee54716
https://github.com/scummvm/scummvm/commit/c2d795f63c4a89373cdc76cd9ac8d34b6ee54716
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:27+02:00
Commit Message:
SAGA2: Rename class variables in motion.h
Changed paths:
engines/saga2/actor.cpp
engines/saga2/motion.cpp
engines/saga2/motion.h
engines/saga2/path.cpp
diff --git a/engines/saga2/actor.cpp b/engines/saga2/actor.cpp
index fa2ec9551cc..dc9c29fc6c7 100644
--- a/engines/saga2/actor.cpp
+++ b/engines/saga2/actor.cpp
@@ -1928,7 +1928,7 @@ void Actor::attack(GameObject *target) {
// Stop all attacks on a specified target
void Actor::stopAttack(GameObject *target) {
- if (_moveTask && _moveTask->isAttack() && _moveTask->targetObj == target)
+ if (_moveTask && _moveTask->isAttack() && _moveTask->_targetObj == target)
_moveTask->finishAttack();
}
@@ -2509,7 +2509,7 @@ void Actor::updateState() {
&& isDead()
&& isInterruptable()
&& (_moveTask == nullptr
- || _moveTask->motionType != MotionTask::motionTypeDie)) {
+ || _moveTask->_motionType != MotionTask::motionTypeDie)) {
int16 deadState = isActionAvailable(actionDead)
? actionDead
: isActionAvailable(actionDie)
@@ -3115,7 +3115,7 @@ uint8 Actor::evaluateFollowerNeeds(Actor *follower) {
bool Actor::pathFindState() {
if (_moveTask == nullptr)
return 0;
- if (_moveTask->pathFindTask)
+ if (_moveTask->_pathFindTask)
return 1;
return 2;
}
diff --git a/engines/saga2/motion.cpp b/engines/saga2/motion.cpp
index 7c4bd12351c..31e138d545d 100644
--- a/engines/saga2/motion.cpp
+++ b/engines/saga2/motion.cpp
@@ -401,7 +401,7 @@ void MotionTaskList::write(Common::MemoryWriteStreamDynamic *out) {
void MotionTaskList::cleanup() {
for (Common::List<MotionTask *>::iterator it = _list.begin(); it != _list.end(); ++it) {
abortPathFind(*it);
- (*it)->pathFindTask = nullptr;
+ (*it)->_pathFindTask = nullptr;
delete *it;
}
@@ -418,10 +418,10 @@ MotionTask *MotionTaskList::newTask(GameObject *obj) {
// Check see if there's already motion associated with this object.
for (Common::List<MotionTask *>::iterator it = _list.begin(); it != _list.end(); ++it) {
- if ((*it)->object == obj) {
+ if ((*it)->_object == obj) {
mt = *it;
- wakeUpThread(mt->thread, motionInterrupted);
- mt->thread = NoThread;
+ wakeUpThread(mt->_thread, motionInterrupted);
+ mt->_thread = NoThread;
break;
}
@@ -430,18 +430,18 @@ MotionTask *MotionTaskList::newTask(GameObject *obj) {
if (mt == nullptr) {
mt = new MotionTask;
- mt->object = obj;
- mt->motionType = mt->prevMotionType = MotionTask::motionTypeNone;
- mt->pathFindTask = nullptr;
- mt->pathCount = -1;
- mt->flags = 0;
- mt->velocity = TilePoint(0, 0, 0);
- mt->immediateLocation = mt->finalTarget = obj->getLocation();
- mt->thread = NoThread;
+ mt->_object = obj;
+ mt->_motionType = mt->_prevMotionType = MotionTask::motionTypeNone;
+ mt->_pathFindTask = nullptr;
+ mt->_pathCount = -1;
+ mt->_flags = 0;
+ mt->_velocity = TilePoint(0, 0, 0);
+ mt->_immediateLocation = mt->_finalTarget = obj->getLocation();
+ mt->_thread = NoThread;
- mt->targetObj = nullptr;
- mt->targetTAG = nullptr;
- mt->spellObj = nullptr;
+ mt->_targetObj = nullptr;
+ mt->_targetTAG = nullptr;
+ mt->_spellObj = nullptr;
_list.push_back(mt);
@@ -462,59 +462,59 @@ void MotionTask::read(Common::InSaveFile *in) {
ObjectID objectID;
// Restore the motion type and previous motion type
- motionType = in->readByte();
- prevMotionType = in->readByte();
+ _motionType = in->readByte();
+ _prevMotionType = in->readByte();
// Restore the thread ID
- thread = in->readSint16LE();
+ _thread = in->readSint16LE();
// Restore the motion flags
- flags = in->readUint16LE();
+ _flags = in->readUint16LE();
// Get the object ID
objectID = in->readUint16LE();
// Convert the object ID to and object address
- object = objectID != Nothing
+ _object = objectID != Nothing
? GameObject::objectAddress(objectID)
: nullptr;
// If the object is an actor, plug this motion task into the actor
- if (object && isActor(object))
- ((Actor *)object)->_moveTask = this;
+ if (_object && isActor(_object))
+ ((Actor *)_object)->_moveTask = this;
- if (motionType == motionTypeWalk
- || prevMotionType == motionTypeWalk) {
+ if (_motionType == motionTypeWalk
+ || _prevMotionType == motionTypeWalk) {
// Restore the target _data.locations
- immediateLocation.load(in);
- finalTarget.load(in);
+ _immediateLocation.load(in);
+ _finalTarget.load(in);
// If there is a tether restore it
- if (flags & tethered) {
- tetherMinU = in->readSint16LE();
- tetherMinV = in->readSint16LE();
- tetherMaxU = in->readSint16LE();
- tetherMaxV = in->readSint16LE();
+ if (_flags & tethered) {
+ _tetherMinU = in->readSint16LE();
+ _tetherMinV = in->readSint16LE();
+ _tetherMaxU = in->readSint16LE();
+ _tetherMaxV = in->readSint16LE();
}
// Restore the direction
- direction = in->readByte();
+ _direction = in->readByte();
// Restore the path index and path count
- pathIndex = in->readSint16LE();
- pathCount = in->readSint16LE();
- runCount = in->readSint16LE();
+ _pathIndex = in->readSint16LE();
+ _pathCount = in->readSint16LE();
+ _runCount = in->readSint16LE();
// Restore the action counter if needed
- if (flags & agitated)
+ if (_flags & agitated)
actionCounter = in->readSint16LE();
// If there were valid path way points, restore those
- if (pathIndex >= 0 && pathIndex < pathCount) {
- int16 wayPointIndex = pathIndex;
+ if (_pathIndex >= 0 && _pathIndex < _pathCount) {
+ int16 wayPointIndex = _pathIndex;
- while (wayPointIndex < pathCount) {
- pathList[wayPointIndex].load(in);
+ while (wayPointIndex < _pathCount) {
+ _pathList[wayPointIndex].load(in);
wayPointIndex++;
}
@@ -522,114 +522,114 @@ void MotionTask::read(Common::InSaveFile *in) {
// If this motion task previously had a path finding request
// it must be restarted
- pathFindTask = nullptr;
+ _pathFindTask = nullptr;
}
- if (motionType == motionTypeThrown || motionType == motionTypeShot) {
+ if (_motionType == motionTypeThrown || _motionType == motionTypeShot) {
// Restore the velocity
- velocity.load(in);
+ _velocity.load(in);
// Restore other ballistic motion variables
- steps = in->readSint16LE();
- uFrac = in->readSint16LE();
- vFrac = in->readSint16LE();
- uErrorTerm = in->readSint16LE();
- vErrorTerm = in->readSint16LE();
-
- if (motionType == motionTypeShot) {
- ObjectID targetObjID,
+ _steps = in->readSint16LE();
+ _uFrac = in->readSint16LE();
+ _vFrac = in->readSint16LE();
+ _uErrorTerm = in->readSint16LE();
+ _vErrorTerm = in->readSint16LE();
+
+ if (_motionType == motionTypeShot) {
+ ObjectID _targetObjID,
enactorID;
- targetObjID = in->readUint16LE();
+ _targetObjID = in->readUint16LE();
- targetObj = targetObjID
- ? GameObject::objectAddress(targetObjID)
+ _targetObj = _targetObjID
+ ? GameObject::objectAddress(_targetObjID)
: nullptr;
enactorID = in->readUint16LE();
- o.enactor = enactorID != Nothing
+ _o.enactor = enactorID != Nothing
? (Actor *)GameObject::objectAddress(enactorID)
: nullptr;
}
- } else if (motionType == motionTypeClimbUp
- || motionType == motionTypeClimbDown) {
- immediateLocation.load(in);
- } else if (motionType == motionTypeJump) {
- velocity.load(in);
- } else if (motionType == motionTypeTurn) {
- direction = in->readByte();
- } else if (motionType == motionTypeGive) {
+ } else if (_motionType == motionTypeClimbUp
+ || _motionType == motionTypeClimbDown) {
+ _immediateLocation.load(in);
+ } else if (_motionType == motionTypeJump) {
+ _velocity.load(in);
+ } else if (_motionType == motionTypeTurn) {
+ _direction = in->readByte();
+ } else if (_motionType == motionTypeGive) {
ObjectID id = in->readUint16LE();
- targetObj = id != Nothing
+ _targetObj = id != Nothing
? GameObject::objectAddress(id)
: nullptr;
- } else if (motionType == motionTypeWait) {
+ } else if (_motionType == motionTypeWait) {
actionCounter = in->readSint16LE();
- } else if (motionType == motionTypeUseObject
- || motionType == motionTypeUseObjectOnObject
- || motionType == motionTypeUseObjectOnTAI
- || motionType == motionTypeUseObjectOnLocation
- || motionType == motionTypeDropObject
- || motionType == motionTypeDropObjectOnObject
- || motionType == motionTypeDropObjectOnTAI) {
+ } else if (_motionType == motionTypeUseObject
+ || _motionType == motionTypeUseObjectOnObject
+ || _motionType == motionTypeUseObjectOnTAI
+ || _motionType == motionTypeUseObjectOnLocation
+ || _motionType == motionTypeDropObject
+ || _motionType == motionTypeDropObjectOnObject
+ || _motionType == motionTypeDropObjectOnTAI) {
ObjectID directObjID = in->readUint16LE();
- o.directObject = directObjID != Nothing
+ _o.directObject = directObjID != Nothing
? GameObject::objectAddress(directObjID)
: nullptr;
- direction = in->readByte();
+ _direction = in->readByte();
- if (motionType == motionTypeUseObjectOnObject
- || motionType == motionTypeDropObjectOnObject) {
+ if (_motionType == motionTypeUseObjectOnObject
+ || _motionType == motionTypeDropObjectOnObject) {
ObjectID indirectObjID = in->readUint16LE();
- o.indirectObject = indirectObjID != Nothing
+ _o.indirectObject = indirectObjID != Nothing
? GameObject::objectAddress(indirectObjID)
: nullptr;
} else {
- if (motionType == motionTypeUseObjectOnTAI
- || motionType == motionTypeDropObjectOnTAI) {
+ if (_motionType == motionTypeUseObjectOnTAI
+ || _motionType == motionTypeDropObjectOnTAI) {
ActiveItemID tai(in->readSint16LE());
- o.TAI = tai != NoActiveItem
+ _o.TAI = tai != NoActiveItem
? ActiveItem::activeItemAddress(tai)
: nullptr;
}
- if (motionType == motionTypeUseObjectOnLocation
- || motionType == motionTypeDropObject
- || motionType == motionTypeDropObjectOnTAI) {
- targetLoc.load(in);
+ if (_motionType == motionTypeUseObjectOnLocation
+ || _motionType == motionTypeDropObject
+ || _motionType == motionTypeDropObjectOnTAI) {
+ _targetLoc.load(in);
}
}
- } else if (motionType == motionTypeUseTAI) {
+ } else if (_motionType == motionTypeUseTAI) {
ActiveItemID tai(in->readSint16LE());
- o.TAI = tai != NoActiveItem
+ _o.TAI = tai != NoActiveItem
? ActiveItem::activeItemAddress(tai)
: nullptr;
- direction = in->readByte();
- } else if (motionType == motionTypeTwoHandedSwing
- || motionType == motionTypeOneHandedSwing
- || motionType == motionTypeFireBow
- || motionType == motionTypeCastSpell
- || motionType == motionTypeUseWand) {
- ObjectID targetObjID;
+ _direction = in->readByte();
+ } else if (_motionType == motionTypeTwoHandedSwing
+ || _motionType == motionTypeOneHandedSwing
+ || _motionType == motionTypeFireBow
+ || _motionType == motionTypeCastSpell
+ || _motionType == motionTypeUseWand) {
+ ObjectID _targetObjID;
// Restore the direction
- direction = in->readByte();
+ _direction = in->readByte();
// Restore the combat motion type
- combatMotionType = in->readByte();
+ _combatMotionType = in->readByte();
// Get the target object ID
- targetObjID = in->readUint16LE();
+ _targetObjID = in->readUint16LE();
// Convert the target object ID to a pointer
- targetObj = targetObjID != Nothing
- ? GameObject::objectAddress(targetObjID)
+ _targetObj = _targetObjID != Nothing
+ ? GameObject::objectAddress(_targetObjID)
: nullptr;
- if (motionType == motionTypeCastSpell) {
+ if (_motionType == motionTypeCastSpell) {
SpellID sid ;
ObjectID toid ;
ActiveItemID ttaid;
@@ -637,70 +637,70 @@ void MotionTask::read(Common::InSaveFile *in) {
// restore the spell prototype
warning("MotionTask::read: Check SpellID size");
sid = (SpellID)in->readUint32LE();
- spellObj = sid != nullSpell
+ _spellObj = sid != nullSpell
? skillProtoFromID(sid)
: nullptr;
// restore object target
toid = in->readUint16LE();
- targetObj = toid != Nothing
+ _targetObj = toid != Nothing
? GameObject::objectAddress(toid)
: nullptr;
// restore TAG target
ttaid = in->readSint16LE();
- targetTAG = ttaid != NoActiveItem
+ _targetTAG = ttaid != NoActiveItem
? ActiveItem::activeItemAddress(ttaid)
: nullptr;
// restore _data.location target
- targetLoc.load(in);
+ _targetLoc.load(in);
}
// Restore the action counter
actionCounter = in->readSint16LE();
- } else if (motionType == motionTypeTwoHandedParry
- || motionType == motionTypeOneHandedParry
- || motionType == motionTypeShieldParry) {
+ } else if (_motionType == motionTypeTwoHandedParry
+ || _motionType == motionTypeOneHandedParry
+ || _motionType == motionTypeShieldParry) {
ObjectID attackerID,
defensiveObjID;
// Restore the direction
- direction = in->readByte();
+ _direction = in->readByte();
// Get the attacker's and defensive object's IDs
attackerID = in->readByte();
defensiveObjID = in->readByte();
// Convert IDs to pointers
- d.attacker = attackerID != Nothing
+ _d.attacker = attackerID != Nothing
? (Actor *)GameObject::objectAddress(attackerID)
: nullptr;
- d.defensiveObj = defensiveObjID != Nothing
+ _d.defensiveObj = defensiveObjID != Nothing
? GameObject::objectAddress(defensiveObjID)
: nullptr;
// Restore the defense flags
- d.defenseFlags = in->readByte();
+ _d.defenseFlags = in->readByte();
// Restore the action counter
actionCounter = in->readSint16LE();
- if (motionType == motionTypeOneHandedParry) {
+ if (_motionType == motionTypeOneHandedParry) {
// Restore the combat sub-motion type
- combatMotionType = in->readByte();
+ _combatMotionType = in->readByte();
}
- } else if (motionType == motionTypeDodge
- || motionType == motionTypeAcceptHit
- || motionType == motionTypeFallDown) {
+ } else if (_motionType == motionTypeDodge
+ || _motionType == motionTypeAcceptHit
+ || _motionType == motionTypeFallDown) {
ObjectID attackerID;
// Get the attacker's ID
attackerID = in->readUint16LE();
// Convert ID to pointer
- d.attacker = attackerID != Nothing
+ _d.attacker = attackerID != Nothing
? (Actor *)GameObject::objectAddress(attackerID)
: nullptr;
@@ -715,117 +715,117 @@ void MotionTask::read(Common::InSaveFile *in) {
int32 MotionTask::archiveSize() {
int32 size = 0;
- size = sizeof(motionType)
- + sizeof(prevMotionType)
- + sizeof(thread)
- + sizeof(flags)
+ size = sizeof(_motionType)
+ + sizeof(_prevMotionType)
+ + sizeof(_thread)
+ + sizeof(_flags)
+ sizeof(ObjectID); // object
- if (motionType == motionTypeWalk
- || prevMotionType == motionTypeWalk) {
- size += sizeof(immediateLocation)
- + sizeof(finalTarget);
+ if (_motionType == motionTypeWalk
+ || _prevMotionType == motionTypeWalk) {
+ size += sizeof(_immediateLocation)
+ + sizeof(_finalTarget);
- if (flags & tethered) {
- size += sizeof(tetherMinU)
- + sizeof(tetherMinV)
- + sizeof(tetherMaxU)
- + sizeof(tetherMaxV);
+ if (_flags & tethered) {
+ size += sizeof(_tetherMinU)
+ + sizeof(_tetherMinV)
+ + sizeof(_tetherMaxU)
+ + sizeof(_tetherMaxV);
}
- size += sizeof(direction)
- + sizeof(pathIndex)
- + sizeof(pathCount)
- + sizeof(runCount);
+ size += sizeof(_direction)
+ + sizeof(_pathIndex)
+ + sizeof(_pathCount)
+ + sizeof(_runCount);
- if (flags & agitated)
+ if (_flags & agitated)
size += sizeof(actionCounter);
- if (pathIndex >= 0 && pathIndex < pathCount)
- size += sizeof(TilePoint) * (pathCount - pathIndex);
+ if (_pathIndex >= 0 && _pathIndex < _pathCount)
+ size += sizeof(TilePoint) * (_pathCount - _pathIndex);
}
- if (motionType == motionTypeThrown || motionType == motionTypeShot) {
- size += sizeof(velocity)
- + sizeof(steps)
- + sizeof(uFrac)
- + sizeof(vFrac)
- + sizeof(uErrorTerm)
- + sizeof(vErrorTerm);
+ if (_motionType == motionTypeThrown || _motionType == motionTypeShot) {
+ size += sizeof(_velocity)
+ + sizeof(_steps)
+ + sizeof(_uFrac)
+ + sizeof(_vFrac)
+ + sizeof(_uErrorTerm)
+ + sizeof(_vErrorTerm);
- if (motionType == motionTypeShot) {
- size += sizeof(ObjectID) // targetObj ID
+ if (_motionType == motionTypeShot) {
+ size += sizeof(ObjectID) // _targetObj ID
+ sizeof(ObjectID); // enactor ID
}
- } else if (motionType == motionTypeClimbUp
- || motionType == motionTypeClimbDown) {
- size += sizeof(immediateLocation);
- } else if (motionType == motionTypeJump) {
- size += sizeof(velocity);
- } else if (motionType == motionTypeTurn) {
- size += sizeof(direction);
- } else if (motionType == motionTypeGive) {
- size += sizeof(ObjectID); // targetObj ID
- } else if (motionType == motionTypeUseObject
- || motionType == motionTypeUseObjectOnObject
- || motionType == motionTypeUseObjectOnTAI
- || motionType == motionTypeUseObjectOnLocation
- || motionType == motionTypeDropObject
- || motionType == motionTypeDropObjectOnObject
- || motionType == motionTypeDropObjectOnTAI) {
+ } else if (_motionType == motionTypeClimbUp
+ || _motionType == motionTypeClimbDown) {
+ size += sizeof(_immediateLocation);
+ } else if (_motionType == motionTypeJump) {
+ size += sizeof(_velocity);
+ } else if (_motionType == motionTypeTurn) {
+ size += sizeof(_direction);
+ } else if (_motionType == motionTypeGive) {
+ size += sizeof(ObjectID); // _targetObj ID
+ } else if (_motionType == motionTypeUseObject
+ || _motionType == motionTypeUseObjectOnObject
+ || _motionType == motionTypeUseObjectOnTAI
+ || _motionType == motionTypeUseObjectOnLocation
+ || _motionType == motionTypeDropObject
+ || _motionType == motionTypeDropObjectOnObject
+ || _motionType == motionTypeDropObjectOnTAI) {
size += sizeof(ObjectID)
- + sizeof(direction);
+ + sizeof(_direction);
- if (motionType == motionTypeUseObjectOnObject
- || motionType == motionTypeDropObjectOnObject) {
+ if (_motionType == motionTypeUseObjectOnObject
+ || _motionType == motionTypeDropObjectOnObject) {
size += sizeof(ObjectID);
} else {
- if (motionType == motionTypeUseObjectOnTAI
- || motionType == motionTypeDropObjectOnTAI) {
+ if (_motionType == motionTypeUseObjectOnTAI
+ || _motionType == motionTypeDropObjectOnTAI) {
size += sizeof(ActiveItemID);
}
- if (motionType == motionTypeUseObjectOnLocation
- || motionType == motionTypeDropObject
- || motionType == motionTypeDropObjectOnTAI) {
- size += sizeof(targetLoc);
+ if (_motionType == motionTypeUseObjectOnLocation
+ || _motionType == motionTypeDropObject
+ || _motionType == motionTypeDropObjectOnTAI) {
+ size += sizeof(_targetLoc);
}
}
- } else if (motionType == motionTypeUseTAI) {
+ } else if (_motionType == motionTypeUseTAI) {
size += sizeof(ActiveItemID)
- + sizeof(direction);
- } else if (motionType == motionTypeTwoHandedSwing
- || motionType == motionTypeOneHandedSwing
- || motionType == motionTypeFireBow
- || motionType == motionTypeCastSpell
- || motionType == motionTypeUseWand) {
- size += sizeof(direction)
- + sizeof(combatMotionType)
- + sizeof(ObjectID); // targetObj
-
- if (motionType == motionTypeCastSpell) {
- size += sizeof(SpellID); // spellObj
- size += sizeof(ObjectID); // targetObj
- size += sizeof(ActiveItemID); // targetTAG
- size += sizeof(targetLoc); // targetLoc
+ + sizeof(_direction);
+ } else if (_motionType == motionTypeTwoHandedSwing
+ || _motionType == motionTypeOneHandedSwing
+ || _motionType == motionTypeFireBow
+ || _motionType == motionTypeCastSpell
+ || _motionType == motionTypeUseWand) {
+ size += sizeof(_direction)
+ + sizeof(_combatMotionType)
+ + sizeof(ObjectID); // _targetObj
+
+ if (_motionType == motionTypeCastSpell) {
+ size += sizeof(SpellID); // _spellObj
+ size += sizeof(ObjectID); // _targetObj
+ size += sizeof(ActiveItemID); // _targetTAG
+ size += sizeof(_targetLoc); // _targetLoc
}
size += sizeof(actionCounter);
- } else if (motionType == motionTypeTwoHandedParry
- || motionType == motionTypeOneHandedParry
- || motionType == motionTypeShieldParry) {
- size += sizeof(direction)
+ } else if (_motionType == motionTypeTwoHandedParry
+ || _motionType == motionTypeOneHandedParry
+ || _motionType == motionTypeShieldParry) {
+ size += sizeof(_direction)
+ sizeof(ObjectID) // attacker ID
+ sizeof(ObjectID) // defensiveObj ID
- + sizeof(d.defenseFlags)
+ + sizeof(_d.defenseFlags)
+ sizeof(actionCounter);
- if (motionType == motionTypeOneHandedParry)
- size += sizeof(combatMotionType);
- } else if (motionType == motionTypeDodge
- || motionType == motionTypeAcceptHit
- || motionType == motionTypeFallDown) {
+ if (_motionType == motionTypeOneHandedParry)
+ size += sizeof(_combatMotionType);
+ } else if (_motionType == motionTypeDodge
+ || _motionType == motionTypeAcceptHit
+ || _motionType == motionTypeFallDown) {
size += sizeof(ObjectID) // attacker ID
+ sizeof(actionCounter);
}
@@ -837,172 +837,172 @@ void MotionTask::write(Common::MemoryWriteStreamDynamic *out) {
ObjectID objectID;
// Store the motion type and previous motion type
- out->writeByte(motionType);
- out->writeByte(prevMotionType);
+ out->writeByte(_motionType);
+ out->writeByte(_prevMotionType);
// Store the thread ID
- out->writeSint16LE(thread);
+ out->writeSint16LE(_thread);
// Store the motion flags
- out->writeUint16LE(flags);
+ out->writeUint16LE(_flags);
// Convert the object pointer to an object ID
- objectID = object != nullptr ? object->thisID() : Nothing;
+ objectID = _object != nullptr ? _object->thisID() : Nothing;
// Store the object ID
out->writeUint16LE(objectID);
- if (motionType == motionTypeWalk
- || prevMotionType == motionTypeWalk) {
+ if (_motionType == motionTypeWalk
+ || _prevMotionType == motionTypeWalk) {
// Store the target _data.locations
- immediateLocation.write(out);
- finalTarget.write(out);
+ _immediateLocation.write(out);
+ _finalTarget.write(out);
// If there is a tether store it
- if (flags & tethered) {
- out->writeSint16LE(tetherMinU);
- out->writeSint16LE(tetherMinV);
- out->writeSint16LE(tetherMaxU);
- out->writeSint16LE(tetherMaxV);
+ if (_flags & tethered) {
+ out->writeSint16LE(_tetherMinU);
+ out->writeSint16LE(_tetherMinV);
+ out->writeSint16LE(_tetherMaxU);
+ out->writeSint16LE(_tetherMaxV);
}
// Store the direction
- out->writeByte(direction);
+ out->writeByte(_direction);
// Store the path index and path count
- out->writeSint16LE(pathIndex);
- out->writeSint16LE(pathCount);
- out->writeSint16LE(runCount);
+ out->writeSint16LE(_pathIndex);
+ out->writeSint16LE(_pathCount);
+ out->writeSint16LE(_runCount);
// Store the action counter if needed
- if (flags & agitated)
+ if (_flags & agitated)
out->writeSint16LE(actionCounter);
// If there are valid path way points, store them
- if (pathIndex >= 0 && pathIndex < pathCount) {
- int16 wayPointIndex = pathIndex;
+ if (_pathIndex >= 0 && _pathIndex < _pathCount) {
+ int16 wayPointIndex = _pathIndex;
- while (wayPointIndex < pathCount) {
- pathList[wayPointIndex].write(out);
+ while (wayPointIndex < _pathCount) {
+ _pathList[wayPointIndex].write(out);
wayPointIndex++;
}
}
}
- if (motionType == motionTypeThrown || motionType == motionTypeShot) {
+ if (_motionType == motionTypeThrown || _motionType == motionTypeShot) {
// Store the velocity
- velocity.write(out);
+ _velocity.write(out);
// Store other ballistic motion variables
- out->writeSint16LE(steps);
- out->writeSint16LE(uFrac);
- out->writeSint16LE(vFrac);
- out->writeSint16LE(uErrorTerm);
- out->writeSint16LE(vErrorTerm);
-
- if (motionType == motionTypeShot) {
- ObjectID targetObjID,
+ out->writeSint16LE(_steps);
+ out->writeSint16LE(_uFrac);
+ out->writeSint16LE(_vFrac);
+ out->writeSint16LE(_uErrorTerm);
+ out->writeSint16LE(_vErrorTerm);
+
+ if (_motionType == motionTypeShot) {
+ ObjectID _targetObjID,
enactorID;
- targetObjID = targetObj != nullptr
- ? targetObj->thisID()
+ _targetObjID = _targetObj != nullptr
+ ? _targetObj->thisID()
: Nothing;
- out->writeUint16LE(targetObjID);
+ out->writeUint16LE(_targetObjID);
- enactorID = o.enactor != nullptr
- ? o.enactor->thisID()
+ enactorID = _o.enactor != nullptr
+ ? _o.enactor->thisID()
: Nothing;
out->writeUint16LE(enactorID);
}
- } else if (motionType == motionTypeClimbUp
- || motionType == motionTypeClimbDown) {
- immediateLocation.write(out);
- } else if (motionType == motionTypeJump) {
- velocity.write(out);
- } else if (motionType == motionTypeTurn) {
- out->writeByte(direction);
- } else if (motionType == motionTypeGive) {
- if (targetObj != nullptr)
- out->writeUint16LE(targetObj->thisID());
+ } else if (_motionType == motionTypeClimbUp
+ || _motionType == motionTypeClimbDown) {
+ _immediateLocation.write(out);
+ } else if (_motionType == motionTypeJump) {
+ _velocity.write(out);
+ } else if (_motionType == motionTypeTurn) {
+ out->writeByte(_direction);
+ } else if (_motionType == motionTypeGive) {
+ if (_targetObj != nullptr)
+ out->writeUint16LE(_targetObj->thisID());
else
out->writeUint16LE(Nothing);
- } else if (motionType == motionTypeUseObject
- || motionType == motionTypeUseObjectOnObject
- || motionType == motionTypeUseObjectOnTAI
- || motionType == motionTypeUseObjectOnLocation
- || motionType == motionTypeDropObject
- || motionType == motionTypeDropObjectOnObject
- || motionType == motionTypeDropObjectOnTAI) {
- if (o.directObject != nullptr)
- out->writeUint16LE(o.directObject->thisID());
+ } else if (_motionType == motionTypeUseObject
+ || _motionType == motionTypeUseObjectOnObject
+ || _motionType == motionTypeUseObjectOnTAI
+ || _motionType == motionTypeUseObjectOnLocation
+ || _motionType == motionTypeDropObject
+ || _motionType == motionTypeDropObjectOnObject
+ || _motionType == motionTypeDropObjectOnTAI) {
+ if (_o.directObject != nullptr)
+ out->writeUint16LE(_o.directObject->thisID());
else
out->writeUint16LE(Nothing);
- out->writeByte(direction);
+ out->writeByte(_direction);
- if (motionType == motionTypeUseObjectOnObject
- || motionType == motionTypeDropObjectOnObject) {
- if (o.indirectObject != nullptr)
- out->writeUint16LE(o.indirectObject->thisID());
+ if (_motionType == motionTypeUseObjectOnObject
+ || _motionType == motionTypeDropObjectOnObject) {
+ if (_o.indirectObject != nullptr)
+ out->writeUint16LE(_o.indirectObject->thisID());
else
out->writeUint16LE(Nothing);
} else {
- if (motionType == motionTypeUseObjectOnTAI
- || motionType == motionTypeDropObjectOnTAI) {
- if (o.TAI != nullptr)
- out->writeSint16LE(o.TAI->thisID());
+ if (_motionType == motionTypeUseObjectOnTAI
+ || _motionType == motionTypeDropObjectOnTAI) {
+ if (_o.TAI != nullptr)
+ out->writeSint16LE(_o.TAI->thisID());
else
out->writeSint16LE(NoActiveItem.val);
}
- if (motionType == motionTypeUseObjectOnLocation
- || motionType == motionTypeDropObject
- || motionType == motionTypeDropObjectOnTAI) {
- targetLoc.write(out);
+ if (_motionType == motionTypeUseObjectOnLocation
+ || _motionType == motionTypeDropObject
+ || _motionType == motionTypeDropObjectOnTAI) {
+ _targetLoc.write(out);
}
}
- } else if (motionType == motionTypeUseTAI) {
- if (o.TAI != nullptr)
- out->writeSint16LE(o.TAI->thisID());
+ } else if (_motionType == motionTypeUseTAI) {
+ if (_o.TAI != nullptr)
+ out->writeSint16LE(_o.TAI->thisID());
else
out->writeSint16LE(NoActiveItem.val);
- out->writeByte(direction);
- } else if (motionType == motionTypeTwoHandedSwing
- || motionType == motionTypeOneHandedSwing
- || motionType == motionTypeFireBow
- || motionType == motionTypeCastSpell
- || motionType == motionTypeUseWand) {
- ObjectID targetObjID;
+ out->writeByte(_direction);
+ } else if (_motionType == motionTypeTwoHandedSwing
+ || _motionType == motionTypeOneHandedSwing
+ || _motionType == motionTypeFireBow
+ || _motionType == motionTypeCastSpell
+ || _motionType == motionTypeUseWand) {
+ ObjectID _targetObjID;
// Store the direction
- out->writeByte(direction);
+ out->writeByte(_direction);
// Store the combat motion type
- out->writeByte(combatMotionType);
+ out->writeByte(_combatMotionType);
// Convert the target object pointer to an ID
- targetObjID = targetObj != nullptr ? targetObj->thisID() : Nothing;
+ _targetObjID = _targetObj != nullptr ? _targetObj->thisID() : Nothing;
// Store the target object ID
- out->writeUint16LE(targetObjID);
+ out->writeUint16LE(_targetObjID);
- if (motionType == motionTypeCastSpell) {
+ if (_motionType == motionTypeCastSpell) {
// Convert the spell object pointer to an ID
- SpellID sid = spellObj != nullptr
- ? spellObj->getSpellID()
+ SpellID sid = _spellObj != nullptr
+ ? _spellObj->getSpellID()
: nullSpell;
- ObjectID toid = targetObj != nullptr
- ? targetObj->thisID()
+ ObjectID toid = _targetObj != nullptr
+ ? _targetObj->thisID()
: Nothing;
- ActiveItemID ttaid = targetTAG != nullptr
- ? targetTAG->thisID()
+ ActiveItemID ttaid = _targetTAG != nullptr
+ ? _targetTAG->thisID()
: NoActiveItem;
// Store the spell prototype
@@ -1016,44 +1016,44 @@ void MotionTask::write(Common::MemoryWriteStreamDynamic *out) {
out->writeSint16LE(ttaid.val);
// Store _data.location target
- targetLoc.write(out);
+ _targetLoc.write(out);
}
// Store the action counter
out->writeSint16LE(actionCounter);
- } else if (motionType == motionTypeTwoHandedParry
- || motionType == motionTypeOneHandedParry
- || motionType == motionTypeShieldParry) {
+ } else if (_motionType == motionTypeTwoHandedParry
+ || _motionType == motionTypeOneHandedParry
+ || _motionType == motionTypeShieldParry) {
ObjectID attackerID,
defensiveObjID;
// Store the direction
- out->writeByte(direction);
+ out->writeByte(_direction);
- attackerID = d.attacker != nullptr ? d.attacker->thisID() : Nothing;
- defensiveObjID = d.defensiveObj != nullptr ? d.defensiveObj->thisID() : Nothing;
+ attackerID = _d.attacker != nullptr ? _d.attacker->thisID() : Nothing;
+ defensiveObjID = _d.defensiveObj != nullptr ? _d.defensiveObj->thisID() : Nothing;
// Store the attacker's and defensive object's IDs
out->writeUint16LE(attackerID);
out->writeUint16LE(defensiveObjID);
// Store the defense flags
- out->writeByte(d.defenseFlags);
+ out->writeByte(_d.defenseFlags);
// Store the action counter
out->writeSint16LE(actionCounter);
- if (motionType == motionTypeOneHandedParry) {
+ if (_motionType == motionTypeOneHandedParry) {
// Store the combat sub-motion type
- out->writeByte(combatMotionType);
+ out->writeByte(_combatMotionType);
}
- } else if (motionType == motionTypeDodge
- || motionType == motionTypeAcceptHit
- || motionType == motionTypeFallDown) {
+ } else if (_motionType == motionTypeDodge
+ || _motionType == motionTypeAcceptHit
+ || _motionType == motionTypeFallDown) {
ObjectID attackerID;
- attackerID = d.attacker != nullptr ? d.attacker->thisID() : Nothing;
+ attackerID = _d.attacker != nullptr ? _d.attacker->thisID() : Nothing;
// Store the attacker's ID
out->writeUint16LE(attackerID);
@@ -1070,14 +1070,14 @@ void MotionTask::remove(int16 returnVal) {
if (g_vm->_mTaskList->_nextMT != g_vm->_mTaskList->_list.end() && *(g_vm->_mTaskList->_nextMT) == this)
++g_vm->_mTaskList->_nextMT;
- object->_data.objectFlags &= ~objectMoving;
- if (objObscured(object))
- object->_data.objectFlags |= objectObscured;
+ _object->_data.objectFlags &= ~objectMoving;
+ if (objObscured(_object))
+ _object->_data.objectFlags |= objectObscured;
else
- object->_data.objectFlags &= ~objectObscured;
+ _object->_data.objectFlags &= ~objectObscured;
- if (isActor(object)) {
- Actor *a = (Actor *)object;
+ if (isActor(_object)) {
+ Actor *a = (Actor *)_object;
a->_moveTask = nullptr;
a->_cycleCount = g_vm->_rnd->getRandomNumber(19);
@@ -1091,29 +1091,29 @@ void MotionTask::remove(int16 returnVal) {
g_vm->_mTaskList->_list.remove(this);
abortPathFind(this);
- pathFindTask = nullptr;
+ _pathFindTask = nullptr;
- wakeUpThread(thread, returnVal);
+ wakeUpThread(_thread, returnVal);
}
//-----------------------------------------------------------------------
// Determine the immediate target _data.location
TilePoint MotionTask::getImmediateTarget() {
- if (immediateLocation != Nowhere)
- return immediateLocation;
+ if (_immediateLocation != Nowhere)
+ return _immediateLocation;
Direction dir;
// If the wandering then simply go in the direction the actor is
// facing, else if avoiding a block go in the previously selected
// random direction
- if (flags & agitated)
- dir = direction;
+ if (_flags & agitated)
+ dir = _direction;
else
- dir = ((Actor *)object)->_currentFacing;
+ dir = ((Actor *)_object)->_currentFacing;
- return object->_data.location
+ return _object->_data.location
+ incDirTable[dir] * kTileUVSize;
}
@@ -1138,14 +1138,14 @@ void MotionTask::calcVelocity(const TilePoint &vector, int16 turns) {
// This is used in ballistic motion to make up for rounding
- steps = turns;
- uFrac = vector.u % turns;
- vFrac = vector.v % turns;
- uErrorTerm = 0;
- vErrorTerm = 0;
+ _steps = turns;
+ _uFrac = vector.u % turns;
+ _vFrac = vector.v % turns;
+ _uErrorTerm = 0;
+ _vErrorTerm = 0;
veloc.z = ((gravity * turns) >> 1) + vector.z / turns;
- velocity = veloc;
+ _velocity = veloc;
}
//-----------------------------------------------------------------------
@@ -1157,9 +1157,9 @@ void MotionTask::turn(Actor &obj, Direction dir) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&obj)) != nullptr) {
- mt->direction = dir;
- mt->motionType = motionTypeTurn;
- mt->flags = reset;
+ mt->_direction = dir;
+ mt->_motionType = motionTypeTurn;
+ mt->_flags = reset;
}
}
@@ -1170,9 +1170,9 @@ void MotionTask::turnTowards(Actor &obj, const TilePoint &where) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&obj)) != nullptr) {
- mt->direction = (where - obj.getLocation()).quickDir();
- mt->motionType = motionTypeTurn;
- mt->flags = reset;
+ mt->_direction = (where - obj.getLocation()).quickDir();
+ mt->_motionType = motionTypeTurn;
+ mt->_flags = reset;
}
}
@@ -1184,9 +1184,9 @@ void MotionTask::give(Actor &actor, Actor &givee) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
- mt->targetObj = &givee;
- mt->motionType = motionTypeGive;
- mt->flags = reset;
+ mt->_targetObj = &givee;
+ mt->_motionType = motionTypeGive;
+ mt->_flags = reset;
}
}
@@ -1198,8 +1198,8 @@ void MotionTask::throwObject(GameObject &obj, const TilePoint &velocity) {
if ((mt = g_vm->_mTaskList->newTask(&obj)) != nullptr) {
if (obj.isMissile()) obj._data.missileFacing = missileNoFacing;
- mt->velocity = velocity;
- mt->motionType = motionTypeThrown;
+ mt->_velocity = velocity;
+ mt->_motionType = motionTypeThrown;
}
}
@@ -1217,7 +1217,7 @@ void MotionTask::throwObjectTo(GameObject &obj, const TilePoint &where) {
if ((mt = g_vm->_mTaskList->newTask(&obj)) != nullptr) {
if (obj.isMissile()) obj._data.missileFacing = missileNoFacing;
mt->calcVelocity(where - obj.getLocation(), turns);
- mt->motionType = motionTypeThrown;
+ mt->_motionType = motionTypeThrown;
}
}
@@ -1233,11 +1233,11 @@ void MotionTask::shootObject(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&obj)) != nullptr) {
- TilePoint targetLoc = target.getLocation();
+ TilePoint _targetLoc = target.getLocation();
- targetLoc.z += target.proto()->height / 2;
+ _targetLoc.z += target.proto()->height / 2;
- TilePoint vector = targetLoc - obj.getLocation();
+ TilePoint vector = _targetLoc - obj.getLocation();
int16 turns = MAX(vector.quickHDistance() / speed, 1);
if (isActor(&target)) {
@@ -1246,19 +1246,19 @@ void MotionTask::shootObject(
if (targetActor->_moveTask != nullptr) {
MotionTask *targetMotion = targetActor->_moveTask;
- if (targetMotion->motionType == motionTypeWalk)
- vector += targetMotion->velocity * turns;
+ if (targetMotion->_motionType == motionTypeWalk)
+ vector += targetMotion->_velocity * turns;
}
}
mt->calcVelocity(vector, turns);
if (obj.isMissile())
- obj._data.missileFacing = missileDir(mt->velocity);
+ obj._data.missileFacing = missileDir(mt->_velocity);
- mt->motionType = motionTypeShot;
- mt->o.enactor = &doer;
- mt->targetObj = ⌖
+ mt->_motionType = motionTypeShot;
+ mt->_o.enactor = &doer;
+ mt->_targetObj = ⌖
}
}
@@ -1275,16 +1275,16 @@ void MotionTask::walkTo(
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
if (!mt->isReflex() && !actor.isImmobile()) {
unstickObject(&actor);
- mt->finalTarget = mt->immediateLocation = target;
- mt->motionType = mt->prevMotionType = motionTypeWalk;
- mt->pathCount = mt->pathIndex = 0;
- mt->flags = pathFind | reset;
- mt->runCount = 12; // # of frames until we can run
+ mt->_finalTarget = mt->_immediateLocation = target;
+ mt->_motionType = mt->_prevMotionType = motionTypeWalk;
+ mt->_pathCount = mt->_pathIndex = 0;
+ mt->_flags = pathFind | reset;
+ mt->_runCount = 12; // # of frames until we can run
if (run && actor.isActionAvailable(actionRun))
- mt->flags |= requestRun;
+ mt->_flags |= requestRun;
if (canAgitate)
- mt->flags |= agitatable;
+ mt->_flags |= agitatable;
RequestPath(mt, getPathFindIQ(&actor));
}
@@ -1305,19 +1305,19 @@ void MotionTask::walkToDirect(
if (!mt->isReflex() && !actor.isImmobile()) {
// Abort any pending path finding task
abortPathFind(mt);
- mt->pathFindTask = nullptr;
+ mt->_pathFindTask = nullptr;
unstickObject(&actor);
- mt->motionType = mt->prevMotionType = motionTypeWalk;
- mt->finalTarget = mt->immediateLocation = target;
- mt->pathCount = mt->pathIndex = 0;
- mt->flags = reset;
- mt->runCount = 12;
+ mt->_motionType = mt->_prevMotionType = motionTypeWalk;
+ mt->_finalTarget = mt->_immediateLocation = target;
+ mt->_pathCount = mt->_pathIndex = 0;
+ mt->_flags = reset;
+ mt->_runCount = 12;
if (run && actor.isActionAvailable(actionRun))
- mt->flags |= requestRun;
+ mt->_flags |= requestRun;
if (canAgitate)
- mt->flags |= agitatable;
+ mt->_flags |= agitatable;
}
}
}
@@ -1334,17 +1334,17 @@ void MotionTask::wander(
if (!mt->isReflex() && !actor.isImmobile()) {
// Abort any pending path finding task
abortPathFind(mt);
- mt->pathFindTask = nullptr;
+ mt->_pathFindTask = nullptr;
unstickObject(&actor);
- mt->motionType = mt->prevMotionType = motionTypeWalk;
- mt->immediateLocation = Nowhere;
- mt->pathCount = mt->pathIndex = 0;
- mt->flags = reset | wandering;
- mt->runCount = 12;
+ mt->_motionType = mt->_prevMotionType = motionTypeWalk;
+ mt->_immediateLocation = Nowhere;
+ mt->_pathCount = mt->_pathIndex = 0;
+ mt->_flags = reset | wandering;
+ mt->_runCount = 12;
if (run && actor.isActionAvailable(actionRun))
- mt->flags |= requestRun;
+ mt->_flags |= requestRun;
RequestWanderPath(mt, getPathFindIQ(&actor));
}
@@ -1364,21 +1364,21 @@ void MotionTask::tetheredWander(
if (!mt->isReflex() && !actor.isImmobile()) {
// Abort any pending path finding task
abortPathFind(mt);
- mt->pathFindTask = nullptr;
+ mt->_pathFindTask = nullptr;
unstickObject(&actor);
- mt->motionType = mt->prevMotionType = motionTypeWalk;
- mt->immediateLocation = Nowhere;
- mt->tetherMinU = tetherReg.min.u;
- mt->tetherMinV = tetherReg.min.v;
- mt->tetherMaxU = tetherReg.max.u;
- mt->tetherMaxV = tetherReg.max.v;
- mt->pathCount = mt->pathIndex = 0;
- mt->flags = reset | wandering | tethered;
- mt->runCount = 12;
+ mt->_motionType = mt->_prevMotionType = motionTypeWalk;
+ mt->_immediateLocation = Nowhere;
+ mt->_tetherMinU = tetherReg.min.u;
+ mt->_tetherMinV = tetherReg.min.v;
+ mt->_tetherMaxU = tetherReg.max.u;
+ mt->_tetherMaxV = tetherReg.max.v;
+ mt->_pathCount = mt->_pathIndex = 0;
+ mt->_flags = reset | wandering | tethered;
+ mt->_runCount = 12;
if (run && actor.isActionAvailable(actionRun))
- mt->flags |= requestRun;
+ mt->_flags |= requestRun;
RequestWanderPath(mt, getPathFindIQ(&actor));
}
@@ -1392,9 +1392,9 @@ void MotionTask::upLadder(Actor &actor) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
- if (mt->motionType != motionTypeClimbUp) {
- mt->motionType = motionTypeClimbUp;
- mt->flags = reset;
+ if (mt->_motionType != motionTypeClimbUp) {
+ mt->_motionType = motionTypeClimbUp;
+ mt->_flags = reset;
}
}
}
@@ -1406,9 +1406,9 @@ void MotionTask::downLadder(Actor &actor) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
- if (mt->motionType != motionTypeClimbDown) {
- mt->motionType = motionTypeClimbDown;
- mt->flags = reset;
+ if (mt->_motionType != motionTypeClimbDown) {
+ mt->_motionType = motionTypeClimbDown;
+ mt->_flags = reset;
}
}
}
@@ -1420,9 +1420,9 @@ void MotionTask::talk(Actor &actor) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
- if (mt->motionType != motionTypeTalk) {
- mt->motionType = motionTypeTalk;
- mt->flags = reset;
+ if (mt->_motionType != motionTypeTalk) {
+ mt->_motionType = motionTypeTalk;
+ mt->_flags = reset;
}
}
}
@@ -1435,10 +1435,10 @@ void MotionTask::jump(Actor &actor) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&actor)) != nullptr) {
- if (mt->motionType != motionTypeThrown) {
- mt->velocity.z = 10;
- mt->motionType = motionTypeJump;
- mt->flags = reset;
+ if (mt->_motionType != motionTypeThrown) {
+ mt->_velocity.z = 10;
+ mt->_motionType = motionTypeJump;
+ mt->_flags = reset;
}
}
}
@@ -1451,9 +1451,9 @@ void MotionTask::wait(Actor &a) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeWait) {
- mt->motionType = motionTypeWait;
- mt->flags = reset;
+ if (mt->_motionType != motionTypeWait) {
+ mt->_motionType = motionTypeWait;
+ mt->_flags = reset;
}
}
}
@@ -1465,11 +1465,11 @@ void MotionTask::useObject(Actor &a, GameObject &dObj) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeUseObject) {
- mt->motionType = motionTypeUseObject;
- mt->o.directObject = &dObj;
- mt->flags = reset;
- if (isPlayerActor(&a)) mt->flags |= privledged;
+ if (mt->_motionType != motionTypeUseObject) {
+ mt->_motionType = motionTypeUseObject;
+ mt->_o.directObject = &dObj;
+ mt->_flags = reset;
+ if (isPlayerActor(&a)) mt->_flags |= privledged;
}
}
}
@@ -1484,12 +1484,12 @@ void MotionTask::useObjectOnObject(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeUseObjectOnObject) {
- mt->motionType = motionTypeUseObjectOnObject;
- mt->o.directObject = &dObj;
- mt->o.indirectObject = ⌖
- mt->flags = reset;
- if (isPlayerActor(&a)) mt->flags |= privledged;
+ if (mt->_motionType != motionTypeUseObjectOnObject) {
+ mt->_motionType = motionTypeUseObjectOnObject;
+ mt->_o.directObject = &dObj;
+ mt->_o.indirectObject = ⌖
+ mt->_flags = reset;
+ if (isPlayerActor(&a)) mt->_flags |= privledged;
}
}
}
@@ -1504,11 +1504,11 @@ void MotionTask::useObjectOnTAI(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeUseObjectOnTAI) {
- mt->motionType = motionTypeUseObjectOnTAI;
- mt->o.directObject = &dObj;
- mt->o.TAI = ⌖
- mt->flags = reset;
+ if (mt->_motionType != motionTypeUseObjectOnTAI) {
+ mt->_motionType = motionTypeUseObjectOnTAI;
+ mt->_o.directObject = &dObj;
+ mt->_o.TAI = ⌖
+ mt->_flags = reset;
}
}
}
@@ -1523,11 +1523,11 @@ void MotionTask::useObjectOnLocation(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeUseObjectOnLocation) {
- mt->motionType = motionTypeUseObjectOnLocation;
- mt->o.directObject = &dObj;
- mt->targetLoc = target;
- mt->flags = reset;
+ if (mt->_motionType != motionTypeUseObjectOnLocation) {
+ mt->_motionType = motionTypeUseObjectOnLocation;
+ mt->_o.directObject = &dObj;
+ mt->_targetLoc = target;
+ mt->_flags = reset;
}
}
}
@@ -1539,10 +1539,10 @@ void MotionTask::useTAI(Actor &a, ActiveItem &dTAI) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeUseTAI) {
- mt->motionType = motionTypeUseTAI;
- mt->o.TAI = &dTAI;
- mt->flags = reset;
+ if (mt->_motionType != motionTypeUseTAI) {
+ mt->_motionType = motionTypeUseTAI;
+ mt->_o.TAI = &dTAI;
+ mt->_flags = reset;
}
}
}
@@ -1557,11 +1557,11 @@ void MotionTask::dropObject(Actor &a,
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeDropObject) {
- mt->motionType = motionTypeDropObject;
- mt->o.directObject = &dObj;
- mt->targetLoc = loc;
- mt->flags = reset;
+ if (mt->_motionType != motionTypeDropObject) {
+ mt->_motionType = motionTypeDropObject;
+ mt->_o.directObject = &dObj;
+ mt->_targetLoc = loc;
+ mt->_flags = reset;
mt->moveCount = num;
}
}
@@ -1592,11 +1592,11 @@ void MotionTask::dropObjectOnObject(
// Otherwise, drop it on the object
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeDropObjectOnObject) {
- mt->motionType = motionTypeDropObjectOnObject;
- mt->o.directObject = &dObj;
- mt->o.indirectObject = ⌖
- mt->flags = reset;
+ if (mt->_motionType != motionTypeDropObjectOnObject) {
+ mt->_motionType = motionTypeDropObjectOnObject;
+ mt->_o.directObject = &dObj;
+ mt->_o.indirectObject = ⌖
+ mt->_flags = reset;
mt->moveCount = num;
}
}
@@ -1613,12 +1613,12 @@ void MotionTask::dropObjectOnTAI(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeDropObjectOnTAI) {
- mt->motionType = motionTypeDropObjectOnTAI;
- mt->o.directObject = &dObj;
- mt->o.TAI = ⌖
- mt->targetLoc = loc;
- mt->flags = reset;
+ if (mt->_motionType != motionTypeDropObjectOnTAI) {
+ mt->_motionType = motionTypeDropObjectOnTAI;
+ mt->_o.directObject = &dObj;
+ mt->_o.TAI = ⌖
+ mt->_targetLoc = loc;
+ mt->_flags = reset;
}
}
}
@@ -1628,12 +1628,12 @@ void MotionTask::dropObjectOnTAI(
// has no control )
bool MotionTask::isReflex() {
- return motionType == motionTypeThrown
- || motionType == motionTypeFall
- || motionType == motionTypeLand
- || motionType == motionTypeAcceptHit
- || motionType == motionTypeFallDown
- || motionType == motionTypeDie;
+ return _motionType == motionTypeThrown
+ || _motionType == motionTypeFall
+ || _motionType == motionTypeLand
+ || _motionType == motionTypeAcceptHit
+ || _motionType == motionTypeFallDown
+ || _motionType == motionTypeDie;
}
// Offensive combat actions
@@ -1645,10 +1645,10 @@ void MotionTask::twoHandedSwing(Actor &a, GameObject &target) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeTwoHandedSwing) {
- mt->motionType = motionTypeTwoHandedSwing;
- mt->targetObj = ⌖
- mt->flags = reset;
+ if (mt->_motionType != motionTypeTwoHandedSwing) {
+ mt->_motionType = motionTypeTwoHandedSwing;
+ mt->_targetObj = ⌖
+ mt->_flags = reset;
}
}
}
@@ -1660,10 +1660,10 @@ void MotionTask::oneHandedSwing(Actor &a, GameObject &target) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeOneHandedSwing) {
- mt->motionType = motionTypeOneHandedSwing;
- mt->targetObj = ⌖
- mt->flags = reset;
+ if (mt->_motionType != motionTypeOneHandedSwing) {
+ mt->_motionType = motionTypeOneHandedSwing;
+ mt->_targetObj = ⌖
+ mt->_flags = reset;
}
}
}
@@ -1675,10 +1675,10 @@ void MotionTask::fireBow(Actor &a, GameObject &target) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeFireBow) {
- mt->motionType = motionTypeFireBow;
- mt->targetObj = ⌖
- mt->flags = reset;
+ if (mt->_motionType != motionTypeFireBow) {
+ mt->_motionType = motionTypeFireBow;
+ mt->_targetObj = ⌖
+ mt->_flags = reset;
}
}
}
@@ -1695,13 +1695,13 @@ void MotionTask::castSpell(Actor &a, SkillProto &spell, GameObject &target) {
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != type) {
- mt->motionType = type;
- mt->spellObj = &spell;
- mt->targetObj = ⌖
- mt->flags = reset;
- mt->direction = (mt->targetObj->getLocation() - a.getLocation()).quickDir();
- if (isPlayerActor(&a)) mt->flags |= privledged;
+ if (mt->_motionType != type) {
+ mt->_motionType = type;
+ mt->_spellObj = &spell;
+ mt->_targetObj = ⌖
+ mt->_flags = reset;
+ mt->_direction = (mt->_targetObj->getLocation() - a.getLocation()).quickDir();
+ if (isPlayerActor(&a)) mt->_flags |= privledged;
}
}
}
@@ -1714,13 +1714,13 @@ void MotionTask::castSpell(Actor &a, SkillProto &spell, Location &target) {
motionTypeCastSpell;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != type) {
- mt->motionType = type;
- mt->spellObj = &spell;
- mt->targetLoc = target; //target;
- mt->flags = reset | LocTarg;
- mt->direction = (target - a.getLocation()).quickDir();
- if (isPlayerActor(&a)) mt->flags |= privledged;
+ if (mt->_motionType != type) {
+ mt->_motionType = type;
+ mt->_spellObj = &spell;
+ mt->_targetLoc = target; //target;
+ mt->_flags = reset | LocTarg;
+ mt->_direction = (target - a.getLocation()).quickDir();
+ if (isPlayerActor(&a)) mt->_flags |= privledged;
}
}
}
@@ -1733,21 +1733,21 @@ void MotionTask::castSpell(Actor &a, SkillProto &spell, ActiveItem &target) {
motionTypeCastSpell;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != type) {
+ if (mt->_motionType != type) {
Location loc;
assert(target._data.itemType == activeTypeInstance);
- mt->motionType = type;
- mt->spellObj = &spell;
- mt->targetTAG = ⌖
+ mt->_motionType = type;
+ mt->_spellObj = &spell;
+ mt->_targetTAG = ⌖
loc = Location(
target._data.instance.u << kTileUVShift,
target._data.instance.v << kTileUVShift,
target._data.instance.h,
a.world()->thisID());
- mt->targetLoc = loc; //target;
- mt->flags = reset | TAGTarg;
- mt->direction = (loc - a.getLocation()).quickDir();
- if (isPlayerActor(&a)) mt->flags |= privledged;
+ mt->_targetLoc = loc; //target;
+ mt->_flags = reset | TAGTarg;
+ mt->_direction = (loc - a.getLocation()).quickDir();
+ if (isPlayerActor(&a)) mt->_flags |= privledged;
}
}
}
@@ -1759,10 +1759,10 @@ void MotionTask::useWand(Actor &a, GameObject &target) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeUseWand) {
- mt->motionType = motionTypeUseWand;
- mt->targetObj = ⌖
- mt->flags = reset;
+ if (mt->_motionType != motionTypeUseWand) {
+ mt->_motionType = motionTypeUseWand;
+ mt->_targetObj = ⌖
+ mt->_flags = reset;
}
}
}
@@ -1779,13 +1779,13 @@ void MotionTask::twoHandedParry(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeTwoHandedParry) {
- mt->motionType = motionTypeTwoHandedParry;
- mt->d.attacker = &opponent;
- mt->d.defensiveObj = &weapon;
+ if (mt->_motionType != motionTypeTwoHandedParry) {
+ mt->_motionType = motionTypeTwoHandedParry;
+ mt->_d.attacker = &opponent;
+ mt->_d.defensiveObj = &weapon;
}
- mt->flags = reset;
- mt->d.defenseFlags = 0;
+ mt->_flags = reset;
+ mt->_d.defenseFlags = 0;
}
}
@@ -1799,13 +1799,13 @@ void MotionTask::oneHandedParry(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeOneHandedParry) {
- mt->motionType = motionTypeOneHandedParry;
- mt->d.attacker = &opponent;
- mt->d.defensiveObj = &weapon;
+ if (mt->_motionType != motionTypeOneHandedParry) {
+ mt->_motionType = motionTypeOneHandedParry;
+ mt->_d.attacker = &opponent;
+ mt->_d.defensiveObj = &weapon;
}
- mt->flags = reset;
- mt->d.defenseFlags = 0;
+ mt->_flags = reset;
+ mt->_d.defenseFlags = 0;
}
}
@@ -1819,13 +1819,13 @@ void MotionTask::shieldParry(
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeShieldParry) {
- mt->motionType = motionTypeShieldParry;
- mt->d.attacker = &opponent;
- mt->d.defensiveObj = &shield;
+ if (mt->_motionType != motionTypeShieldParry) {
+ mt->_motionType = motionTypeShieldParry;
+ mt->_d.attacker = &opponent;
+ mt->_d.defensiveObj = &shield;
}
- mt->flags = reset;
- mt->d.defenseFlags = 0;
+ mt->_flags = reset;
+ mt->_d.defenseFlags = 0;
}
}
@@ -1836,12 +1836,12 @@ void MotionTask::dodge(Actor &a, Actor &opponent) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeDodge) {
- mt->motionType = motionTypeDodge;
- mt->d.attacker = &opponent;
+ if (mt->_motionType != motionTypeDodge) {
+ mt->_motionType = motionTypeDodge;
+ mt->_d.attacker = &opponent;
}
- mt->flags = reset;
- mt->d.defenseFlags = 0;
+ mt->_flags = reset;
+ mt->_d.defenseFlags = 0;
}
}
@@ -1854,10 +1854,10 @@ void MotionTask::acceptHit(Actor &a, Actor &opponent) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeAcceptHit) {
- mt->motionType = motionTypeAcceptHit;
- mt->d.attacker = &opponent;
- mt->flags = reset;
+ if (mt->_motionType != motionTypeAcceptHit) {
+ mt->_motionType = motionTypeAcceptHit;
+ mt->_d.attacker = &opponent;
+ mt->_flags = reset;
}
}
}
@@ -1869,10 +1869,10 @@ void MotionTask::fallDown(Actor &a, Actor &opponent) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeFallDown) {
- mt->motionType = motionTypeFallDown;
- mt->d.attacker = &opponent;
- mt->flags = reset;
+ if (mt->_motionType != motionTypeFallDown) {
+ mt->_motionType = motionTypeFallDown;
+ mt->_d.attacker = &opponent;
+ mt->_flags = reset;
}
}
}
@@ -1884,9 +1884,9 @@ void MotionTask::die(Actor &a) {
MotionTask *mt;
if ((mt = g_vm->_mTaskList->newTask(&a)) != nullptr) {
- if (mt->motionType != motionTypeDie) {
- mt->motionType = motionTypeDie;
- mt->flags = reset;
+ if (mt->_motionType != motionTypeDie) {
+ mt->_motionType = motionTypeDie;
+ mt->_flags = reset;
}
}
}
@@ -1895,10 +1895,10 @@ void MotionTask::die(Actor &a) {
// Determine if this MotionTask is a defensive motion
bool MotionTask::isDefense() {
- return motionType == motionTypeOneHandedParry
- || motionType == motionTypeTwoHandedParry
- || motionType == motionTypeShieldParry
- || motionType == motionTypeDodge;
+ return _motionType == motionTypeOneHandedParry
+ || _motionType == motionTypeTwoHandedParry
+ || _motionType == motionTypeShieldParry
+ || _motionType == motionTypeDodge;
}
//-----------------------------------------------------------------------
@@ -1906,24 +1906,24 @@ bool MotionTask::isDefense() {
bool MotionTask::isAttack() {
return isMeleeAttack()
- || motionType == motionTypeFireBow
- || motionType == motionTypeCastSpell
- || motionType == motionTypeUseWand;
+ || _motionType == motionTypeFireBow
+ || _motionType == motionTypeCastSpell
+ || _motionType == motionTypeUseWand;
}
//-----------------------------------------------------------------------
// Determine if this MotionTask is an offensive melee motion
bool MotionTask::isMeleeAttack() {
- return motionType == motionTypeOneHandedSwing
- || motionType == motionTypeTwoHandedSwing;
+ return _motionType == motionTypeOneHandedSwing
+ || _motionType == motionTypeTwoHandedSwing;
}
//-----------------------------------------------------------------------
// Determine if this MotionTask is a walk motion
bool MotionTask::isWalk() {
- return prevMotionType == motionTypeWalk;
+ return _prevMotionType == motionTypeWalk;
}
//-----------------------------------------------------------------------
@@ -1932,9 +1932,9 @@ bool MotionTask::isWalk() {
TileRegion MotionTask::getTether() {
TileRegion reg;
- if (flags & tethered) {
- reg.min = TilePoint(tetherMinU, tetherMinV, 0);
- reg.max = TilePoint(tetherMaxU, tetherMaxV, 0);
+ if (_flags & tethered) {
+ reg.min = TilePoint(_tetherMinU, _tetherMinV, 0);
+ reg.max = TilePoint(_tetherMaxU, _tetherMaxV, 0);
} else {
reg.min = Nowhere;
reg.max = Nowhere;
@@ -1948,28 +1948,28 @@ TileRegion MotionTask::getTether() {
// then call this function.
void MotionTask::changeTarget(const TilePoint &newPos, bool run) {
- if (prevMotionType == motionTypeWalk) {
- uint16 oldFlags = flags;
+ if (_prevMotionType == motionTypeWalk) {
+ uint16 oldFlags = _flags;
abortPathFind(this);
- finalTarget = immediateLocation = newPos;
- pathCount = pathIndex = 0;
+ _finalTarget = _immediateLocation = newPos;
+ _pathCount = _pathIndex = 0;
- flags = pathFind | reset;
+ _flags = pathFind | reset;
if (oldFlags & agitatable)
- flags |= agitatable;
+ _flags |= agitatable;
// Set run flag if requested
if (run
// Check if actor capable of running...
- && ((Actor *)object)->isActionAvailable(actionRun))
+ && ((Actor *)_object)->isActionAvailable(actionRun))
- flags |= requestRun;
+ _flags |= requestRun;
else
- flags &= ~requestRun;
+ _flags &= ~requestRun;
- RequestPath(this, getPathFindIQ(object));
+ RequestPath(this, getPathFindIQ(_object));
}
}
@@ -1978,48 +1978,48 @@ void MotionTask::changeTarget(const TilePoint &newPos, bool run) {
// call this function.
void MotionTask::changeDirectTarget(const TilePoint &newPos, bool run) {
- if (prevMotionType == motionTypeWalk) {
- prevMotionType = motionTypeWalk;
+ if (_prevMotionType == motionTypeWalk) {
+ _prevMotionType = motionTypeWalk;
- finalTarget = immediateLocation = newPos;
+ _finalTarget = _immediateLocation = newPos;
// Reset motion task
- flags |= reset;
- flags &= ~pathFind;
+ _flags |= reset;
+ _flags &= ~pathFind;
// Set run flag if requested
if (run
// Check if actor capable of running...
- && ((Actor *)object)->isActionAvailable(actionRun))
+ && ((Actor *)_object)->isActionAvailable(actionRun))
- flags |= requestRun;
+ _flags |= requestRun;
else
- flags &= ~requestRun;
+ _flags &= ~requestRun;
}
}
// Cancel actor movement if walking...
void MotionTask::finishWalk() {
// If the actor is in a running state
- if (motionType == motionTypeWalk) {
+ if (_motionType == motionTypeWalk) {
remove();
// If there is currently a path finding request, abort it.
/* abortPathFind( this );
// Simply set actor's target _data.location to "here".
- finalTarget = immediateLocation = object->getLocation();
- pathList[0] = finalTarget;
+ _finalTarget = _immediateLocation = _object->getLocation();
+ _pathList[0] = _finalTarget;
flags = reset;
- pathCount = 0;
- pathIndex = 0;*/
+ _pathCount = 0;
+ _pathIndex = 0;*/
}
}
// Cancel actor movement if talking...
void MotionTask::finishTalking() {
- if (motionType == motionTypeTalk) {
- if (isActor(object)) {
- Actor *a = (Actor *)object;
+ if (_motionType == motionTypeTalk) {
+ if (isActor(_object)) {
+ Actor *a = (Actor *)_object;
if (a->_currentAnimation != actionStand)
a->setAction(actionStand, 0);
}
@@ -2039,7 +2039,7 @@ void MotionTask::ballisticAction() {
int16 minDim,
vectorSteps;
- GameObject *obj = object;
+ GameObject *obj = _object;
ProtoObj *proto = obj->proto();
if (isActor(obj)) {
@@ -2051,11 +2051,11 @@ void MotionTask::ballisticAction() {
// Add the force of gravity to the acceleration.
- if (!(flags & inWater)) {
- velocity.z -= gravity;
+ if (!(_flags & inWater)) {
+ _velocity.z -= gravity;
} else {
- velocity.u = velocity.v = 0;
- velocity.z = -gravity;
+ _velocity.u = _velocity.v = 0;
+ _velocity.z = -gravity;
}
location = obj->getLocation();
@@ -2066,28 +2066,28 @@ void MotionTask::ballisticAction() {
// undersample the terrain. We do this by breaking the velocity
// vector into smaller vectors, and handling them individually.
- totalVelocity = velocity;
+ totalVelocity = _velocity;
// Make Up For Rounding Errors In ThrowTo
- if (uFrac) {
- uErrorTerm += ABS(uFrac);
+ if (_uFrac) {
+ _uErrorTerm += ABS(_uFrac);
- if (uErrorTerm >= steps) {
- uErrorTerm -= steps;
- if (uFrac > 0)
+ if (_uErrorTerm >= _steps) {
+ _uErrorTerm -= _steps;
+ if (_uFrac > 0)
totalVelocity.u++;
else
totalVelocity.u--;
}
}
- if (vFrac) {
- vErrorTerm += ABS(vFrac);
+ if (_vFrac) {
+ _vErrorTerm += ABS(_vFrac);
- if (vErrorTerm >= steps) {
- vErrorTerm -= steps;
- if (vFrac > 0)
+ if (_vErrorTerm >= _steps) {
+ _vErrorTerm -= _steps;
+ if (_vFrac > 0)
totalVelocity.v++;
else
totalVelocity.v--;
@@ -2102,7 +2102,7 @@ void MotionTask::ballisticAction() {
vectorSteps = ((totalVelocity.magnitude() - 1) / minDim) + 1;
- if (isActor(obj) && velocity.magnitude() > 16) {
+ if (isActor(obj) && _velocity.magnitude() > 16) {
Actor *a = (Actor *)obj;
if (a->isActionAvailable(actionFreeFall))
@@ -2116,7 +2116,7 @@ void MotionTask::ballisticAction() {
// REM: This would be better as a rounded division...
// Compute the small velocity vector for this increment,
- // and then subtract it from the total velocity.
+ // and then subtract it from the total _velocity.
stepVelocity = totalVelocity / stepsLeft;
totalVelocity -= stepVelocity;
@@ -2140,25 +2140,25 @@ void MotionTask::ballisticAction() {
if (checkContact(obj, newPos, &collisionObject) == false) {
location = newPos;
} else {
- TilePoint oldVelocity = velocity;
+ TilePoint oldVelocity = _velocity;
- if (motionType == motionTypeShot && collisionObject != nullptr) {
+ if (_motionType == motionTypeShot && collisionObject != nullptr) {
// If this motion is for a shot arrow and we did not
// collide with our target object just continue the
// motion as if there was no collision.
- if (collisionObject == targetObj) {
- if (object->strike(
- o.enactor->thisID(),
- targetObj->thisID())) {
+ if (collisionObject == _targetObj) {
+ if (_object->strike(
+ _o.enactor->thisID(),
+ _targetObj->thisID())) {
// The arrow struck, so delete the arrow and
// end this motion
remove();
- object->deleteObject();
+ _object->deleteObject();
return;
} else {
// If the arrow failed to strike continue the
// arrows flight as if there was no collision.
- targetObj = nullptr;
+ _targetObj = nullptr;
location = newPos;
continue;
}
@@ -2203,36 +2203,36 @@ void MotionTask::ballisticAction() {
// case, we just bounce directly backwards.
if (probe == 0) {
- velocity = -velocity / 2;
+ _velocity = -_velocity / 2;
totalVelocity = -totalVelocity / 2;
} else {
if (probe & (1 << 0)) { // If struck wall in U direction
- velocity.u = -velocity.u / 2;
+ _velocity.u = -_velocity.u / 2;
totalVelocity.u = -totalVelocity.u / 2;
} else {
- velocity.u = (velocity.u * 2) / 3;
+ _velocity.u = (_velocity.u * 2) / 3;
totalVelocity.u = (totalVelocity.u * 2) / 3;
}
if (probe & (1 << 1)) { // If struck wall in V direction
- velocity.v = -velocity.v / 2;
+ _velocity.v = -_velocity.v / 2;
totalVelocity.v = -totalVelocity.v / 2;
} else {
- velocity.v = (velocity.v * 2) / 3;
+ _velocity.v = (_velocity.v * 2) / 3;
totalVelocity.v = (totalVelocity.v * 2) / 3;
}
if (probe & (1 << 2)) { // If struct wall in Z direction
- velocity.z = -velocity.z / 2;
+ _velocity.z = -_velocity.z / 2;
totalVelocity.z = -totalVelocity.z / 2;
} else {
- velocity.z = (velocity.z * 2) / 3;
+ _velocity.z = (_velocity.z * 2) / 3;
totalVelocity.z = (totalVelocity.z * 2) / 3;
}
}
- uFrac = vFrac = 0;
- if (motionType == motionTypeShot && obj->isMissile())
- obj->_data.missileFacing = missileDir(velocity);
+ _uFrac = _vFrac = 0;
+ if (_motionType == motionTypeShot && obj->isMissile())
+ obj->_data.missileFacing = missileDir(_velocity);
// If the ballistic object is an actor hitting the
// ground, then instead of bouncing, we'll just have
@@ -2247,10 +2247,10 @@ void MotionTask::ballisticAction() {
fallingDamage(obj, velocityMagnitude);
obj->move(location);
if (!((Actor *)obj)->isDead()) {
- motionType = velocityMagnitude <= 16
+ _motionType = velocityMagnitude <= 16
? motionTypeLand
: motionTypeLandBadly;
- flags |= reset;
+ _flags |= reset;
setObjectSurface(obj, sti);
} else {
setObjectSurface(obj, sti);
@@ -2264,9 +2264,9 @@ void MotionTask::ballisticAction() {
// object's _data.location
return;
}
- } else if (velocity.u < 2 && velocity.u > -2
- && velocity.v < 2 && velocity.v > -2
- && velocity.z < 2 && velocity.z > -2) {
+ } else if (_velocity.u < 2 && _velocity.u > -2
+ && _velocity.v < 2 && _velocity.v > -2
+ && _velocity.z < 2 && _velocity.z > -2) {
StandingTileInfo sti;
// If the reduced velocity after impact is
@@ -2299,43 +2299,43 @@ void MotionTask::ballisticAction() {
bool MotionTask::nextWayPoint() {
// If the pathfinder hasn't managed to determine waypoints
// yet, then return failure.
-// if ( ( flags & pathFind ) && pathCount < 0 ) return false;
+// if ( ( _flags & pathFind ) && _pathCount < 0 ) return false;
// If there are still waypoints in the path list, then
// retrieve the next waypoint.
- if ((flags & (pathFind | wandering)) && pathIndex < pathCount) {
+ if ((_flags & (pathFind | wandering)) && _pathIndex < _pathCount) {
TilePoint wayPointVector(0, 0, 0);
- if (pathIndex > 0)
- wayPointVector = immediateLocation - object->_data.location;
+ if (_pathIndex > 0)
+ wayPointVector = _immediateLocation - _object->_data.location;
if (wayPointVector.quickHDistance() == 0)
// Next vertex in path polyline
- immediateLocation = pathList[pathIndex++];
+ _immediateLocation = _pathList[_pathIndex++];
else
return false;
} else {
- if (flags & wandering) {
- immediateLocation = Nowhere;
- if (pathFindTask == nullptr)
- RequestWanderPath(this, getPathFindIQ(object));
- } else if (flags & agitated) {
- immediateLocation = Nowhere;
+ if (_flags & wandering) {
+ _immediateLocation = Nowhere;
+ if (_pathFindTask == nullptr)
+ RequestWanderPath(this, getPathFindIQ(_object));
+ } else if (_flags & agitated) {
+ _immediateLocation = Nowhere;
} else {
// If we've gone off the end of the path list,
// and we're not at the target yet, request more waypoints then
// use dumb pathfinding until the pathfinder finishes it's task.
- if ((finalTarget - object->_data.location).quickHDistance() > 0
- || ABS(finalTarget.z - object->_data.location.z) > kMaxStepHeight) {
+ if ((_finalTarget - _object->_data.location).quickHDistance() > 0
+ || ABS(_finalTarget.z - _object->_data.location.z) > kMaxStepHeight) {
// If no pathfind in progress
- if ((flags & pathFind)
- && !(flags & finalPath)
- && pathFindTask == nullptr)
- RequestPath(this, getPathFindIQ(object));
+ if ((_flags & pathFind)
+ && !(_flags & finalPath)
+ && _pathFindTask == nullptr)
+ RequestPath(this, getPathFindIQ(_object));
// Set the immediate target to the final target,
- immediateLocation = finalTarget;
+ _immediateLocation = _finalTarget;
}
// else we're close enough to call it quits.
else return false;
@@ -2359,10 +2359,10 @@ bool MotionTask::checkWalk(
// Check the terrain in various directions.
// Check in the forward direction first, at various heights
- newPos = object->_data.location + (dirTable[dir] * speed) / 2;
- newPos.z = object->_data.location.z + stepUp;
+ newPos = _object->_data.location + (dirTable[dir] * speed) / 2;
+ newPos.z = _object->_data.location.z + stepUp;
- if (checkWalkable(object, newPos)) return false;
+ if (checkWalkable(_object, newPos)) return false;
// movementDirection = direction;
pos = newPos;
@@ -2397,8 +2397,8 @@ void MotionTask::walkAction() {
moveTaskDone = false;
WalkType walkType = walkNormal;
- assert(isActor(object));
- a = (Actor *)object;
+ assert(isActor(_object));
+ a = (Actor *)_object;
aa = a->_appearance;
if (a->isImmobile()) {
@@ -2411,9 +2411,9 @@ void MotionTask::walkAction() {
// Set the speed of movement based on whether we are walking
// or running. Running only occurs after we have accelerated.
- if (flags & requestRun
- && runCount == 0
- && !(flags & (inWater | onStairs))) {
+ if (_flags & requestRun
+ && _runCount == 0
+ && !(_flags & (inWater | onStairs))) {
speed = runSpeed;
speedScale = 4;
walkType = walkRun;
@@ -2430,8 +2430,8 @@ void MotionTask::walkAction() {
// If for some reason we cannot run at this time, then
// set up for a walk instead.
if (walkType != walkRun) {
- if (!(flags & onStairs)) {
- if (!(flags & inWater)) {
+ if (!(_flags & onStairs)) {
+ if (!(_flags & inWater)) {
speed = walkSpeed;
speedScale = 2;
walkType = walkNormal;
@@ -2441,7 +2441,7 @@ void MotionTask::walkAction() {
walkType = walkSlow;
// reset run count if actor walking slowly
- runCount = MAX<int16>(runCount, 8);
+ _runCount = MAX<int16>(_runCount, 8);
}
// If we can see this actor, and this actor's walk
@@ -2457,23 +2457,23 @@ void MotionTask::walkAction() {
walkType = walkStairs;
// reset run count if actor walking on stairs
- runCount = MAX<int16>(runCount, 8);
+ _runCount = MAX<int16>(_runCount, 8);
}
}
- if ((flags & agitated)
+ if ((_flags & agitated)
&& --actionCounter <= 0) {
- flags &= ~agitated;
- flags |= pathFind | reset;
+ _flags &= ~agitated;
+ _flags |= pathFind | reset;
}
for (;;) {
// The "reset" flag indicates that the final target has
// changed since the last time this routine was called.
- if (!(flags & reset)) {
+ if (!(_flags & reset)) {
// Compute the vector and distance of the current
// position to the next "immediate" target.
- targetVector = immediateTarget - object->_data.location;
+ targetVector = immediateTarget - _object->_data.location;
targetDist = targetVector.quickHDistance();
// If we're not already there, then proceed towards
@@ -2485,12 +2485,12 @@ void MotionTask::walkAction() {
if (nextWayPoint() == false) {
// If no waypoint could be found and this motion task has
// a path find request, then go into "wait" mode.
- if (pathFindTask)
+ if (_pathFindTask)
moveTaskWaiting = true;
else moveTaskDone = true;
break;
} else {
- flags &= ~reset;
+ _flags &= ~reset;
immediateTarget = getImmediateTarget();
}
}
@@ -2504,11 +2504,11 @@ void MotionTask::walkAction() {
pt1,
pt2;
-// TPLine( a->getLocation(), immediateLocation );
+// TPLine( a->getLocation(), _immediateLocation );
curPt = a->getLocation();
wayPt = immediateTarget;
- for (int i = pathIndex - 1; i < pathCount;) {
+ for (int i = _pathIndex - 1; i < _pathCount;) {
TPLine(curPt, wayPt);
pt1 = pt2 = wayPt;
pt1.u -= 2;
@@ -2527,7 +2527,7 @@ void MotionTask::walkAction() {
TPLine(pt1, pt2);
curPt = wayPt;
- wayPt = pathList[++i];
+ wayPt = _pathList[++i];
}
ShowObjectSection(a);
@@ -2539,7 +2539,7 @@ void MotionTask::walkAction() {
if (moveTaskDone || moveTaskWaiting) {
movementDirection = a->_currentFacing;
} else if (targetDist == 0 && ABS(targetVector.z) > kMaxStepHeight) {
- if (pathFindTask) {
+ if (_pathFindTask) {
movementDirection = a->_currentFacing;
moveTaskWaiting = true;
} else {
@@ -2557,7 +2557,7 @@ void MotionTask::walkAction() {
// Set the new _data.location to the character's _data.location.
newPos.u = immediateTarget.u;
newPos.v = immediateTarget.v;
- newPos.z = object->_data.location.z;
+ newPos.z = _object->_data.location.z;
// Determine the direction the character must spin
// to be at the correct movement angle.
@@ -2568,23 +2568,23 @@ void MotionTask::walkAction() {
// octant this frame, then they cannot move so a terrain test is unneeded.
if (directionAngle <= 1 && directionAngle >= -1) {
// Test the terrain to see if we can go there.
- if ((blockageType = checkWalkable(object, newPos)) != false) {
+ if ((blockageType = checkWalkable(_object, newPos)) != false) {
// Try stepping up to a higher terrain too.
- newPos.z = object->_data.location.z + kMaxStepHeight;
- if (checkWalkable(object, newPos) != blockageNone) {
+ newPos.z = _object->_data.location.z + kMaxStepHeight;
+ if (checkWalkable(_object, newPos) != blockageNone) {
// If there is a path find task pending, put the walk action
// on hold until it finishes, else, abort the walk action.
- if (pathFindTask)
+ if (_pathFindTask)
moveTaskWaiting = true;
else {
movementDirection = a->_currentFacing;
moveBlocked = true;
}
- /* if (!(flags & pathFind) || nextWayPoint() == false)
+ /* if (!(_flags & pathFind) || nextWayPoint() == false)
{
moveBlocked = true;
- flags |= blocked;
- newPos.z = object->_data.location.z;
+ _flags |= blocked;
+ newPos.z = _object->_data.location.z;
}*/
}
@@ -2597,11 +2597,11 @@ void MotionTask::walkAction() {
movementDirection = targetVector.quickDir();
// Calculate new object position along direction vector.
- TilePoint pos = object->_data.location
+ TilePoint pos = _object->_data.location
+ targetVector * speed / targetDist;
#if DEBUG*0
- TPLine(object->_data.location, pos);
+ TPLine(_object->_data.location, pos);
#endif
// Check the terrain in various directions.
@@ -2612,9 +2612,9 @@ void MotionTask::walkAction() {
// vector, even if it's not aligned with one of the
// cardinal directions.
- pos.z = object->_data.location.z + height;
+ pos.z = _object->_data.location.z + height;
- if (!checkWalkable(object, pos)) {
+ if (!checkWalkable(_object, pos)) {
newPos = pos;
foundPath = true;
break;
@@ -2674,7 +2674,7 @@ void MotionTask::walkAction() {
// If there is a path find task pending, put the walk action
// on hold until it finishes, else, abort the walk action.
- if (pathFindTask)
+ if (_pathFindTask)
moveTaskWaiting = true;
else {
movementDirection = a->_currentFacing;
@@ -2705,47 +2705,47 @@ void MotionTask::walkAction() {
remove(motionCompleted);
} else if (moveBlocked) {
a->setAction(actionStand, 0);
- if (flags & agitatable) {
- if (freeFall(object->_data.location, sti)) return;
+ if (_flags & agitatable) {
+ if (freeFall(_object->_data.location, sti)) return;
// When he starts running again, then have him walk only.
- runCount = MAX<int16>(runCount, 8);
+ _runCount = MAX<int16>(_runCount, 8);
// We're blocked so we're going to wander in a random
// direction for a random duration
- flags |= agitated | reset;
+ _flags |= agitated | reset;
- direction = g_vm->_rnd->getRandomNumber(7);
+ _direction = g_vm->_rnd->getRandomNumber(7);
actionCounter = 8 + g_vm->_rnd->getRandomNumber(7);
// Discard the path
- if (flags & pathFind) {
- flags &= ~finalPath;
- pathIndex = pathCount = 0;
+ if (_flags & pathFind) {
+ _flags &= ~finalPath;
+ _pathIndex = _pathCount = 0;
}
} else
remove(motionWalkBlocked);
} else if (moveTaskWaiting
|| movementDirection != a->_currentFacing) {
// When he starts running again, then have him walk only.
- runCount = MAX<int16>(runCount, 8);
+ _runCount = MAX<int16>(_runCount, 8);
a->setAction(actionStand, 0);
- freeFall(object->_data.location, sti);
+ freeFall(_object->_data.location, sti);
} else {
if (a == getCenterActor() && checkLadder(a, newPos)) return;
int16 tHeight;
- flags &= ~blocked;
+ _flags &= ~blocked;
- tHeight = tileSlopeHeight(newPos, object, &sti);
+ tHeight = tileSlopeHeight(newPos, _object, &sti);
// This is a kludge to keep the character from
// "jumping" as he climbs up a small step.
- if (tHeight >= object->_data.location.z - kMaxSmoothStep
+ if (tHeight >= _object->_data.location.z - kMaxSmoothStep
* ((sti.surfaceTile != nullptr
&& (sti.surfaceTile->combinedTerrainMask() & terrainStair))
? 4
@@ -2776,24 +2776,24 @@ void MotionTask::walkAction() {
if (a->_currentFacing == stairsDir) {
// walk up stairs
newAction = actionSpecial7;
- flags |= onStairs;
+ _flags |= onStairs;
} else if (a->_currentFacing == ((stairsDir - 4) & 0x7)) {
// walk down stairs
newAction = actionSpecial8;
- flags |= onStairs;
+ _flags |= onStairs;
} else {
- flags &= ~onStairs;
+ _flags &= ~onStairs;
if (walkType == walkStairs) walkType = walkNormal;
newAction = (walkType == walkRun) ? actionRun : actionWalk;
}
} else {
- flags &= ~onStairs;
+ _flags &= ~onStairs;
if (walkType == walkStairs) walkType = walkNormal;
newAction = (walkType == walkRun) ? actionRun : actionWalk;
}
- object->move(newPos);
+ _object->move(newPos);
// Determine if the new action is running
// or walking.
@@ -2804,9 +2804,9 @@ void MotionTask::walkAction() {
if (walkType != walkSlow)
a->nextAnimationFrame();
else {
- if (flags & nextAnim)
+ if (_flags & nextAnim)
a->nextAnimationFrame();
- flags ^= nextAnim;
+ _flags ^= nextAnim;
}
} else if (a->_currentAnimation == actionWalk
|| a->_currentAnimation == actionRun
@@ -2821,19 +2821,19 @@ void MotionTask::walkAction() {
if (walkType != walkSlow)
a->nextAnimationFrame();
else {
- if (flags & nextAnim)
+ if (_flags & nextAnim)
a->nextAnimationFrame();
- flags ^= nextAnim;
+ _flags ^= nextAnim;
}
} else {
// If we weren't walking or running before, then start
// walking/running and reset the sequence.
a->setAction(newAction, animateRepeat);
- if (walkType == walkSlow) flags |= nextAnim;
+ if (walkType == walkSlow) _flags |= nextAnim;
}
- if (runCount > 0) runCount--;
- setObjectSurface(object, sti);
+ if (_runCount > 0) _runCount--;
+ setObjectSurface(_object, sti);
}
}
}
@@ -2842,11 +2842,11 @@ void MotionTask::walkAction() {
// Climb up a ladder
void MotionTask::upLadderAction() {
- Actor *a = (Actor *)object;
+ Actor *a = (Actor *)_object;
- if (flags & reset) {
+ if (_flags & reset) {
a->setAction(actionClimbLadder, animateRepeat);
- flags &= ~reset;
+ _flags &= ~reset;
} else {
TilePoint loc = a->getLocation();
uint8 crossSection = a->proto()->crossSection,
@@ -2969,11 +2969,11 @@ void MotionTask::upLadderAction() {
// Climb down a ladder
void MotionTask::downLadderAction() {
- Actor *a = (Actor *)object;
+ Actor *a = (Actor *)_object;
- if (flags & reset) {
+ if (_flags & reset) {
a->setAction(actionClimbLadder, animateRepeat | animateReverse);
- flags &= ~reset;
+ _flags &= ~reset;
} else {
TilePoint loc = a->getLocation();
uint8 crossSection = a->proto()->crossSection;
@@ -3088,13 +3088,13 @@ void MotionTask::downLadderAction() {
// Go through the giving motions
void MotionTask::giveAction() {
- Actor *a = (Actor *)object;
- Direction targetDir = (targetObj->getLocation()
+ Actor *a = (Actor *)_object;
+ Direction targetDir = (_targetObj->getLocation()
- a->getLocation()).quickDir();
- if (flags & reset) {
+ if (_flags & reset) {
a->setAction(actionGiveItem, 0);
- flags &= ~reset;
+ _flags &= ~reset;
}
if (a->_currentFacing != targetDir)
@@ -3106,11 +3106,11 @@ void MotionTask::giveAction() {
// Set up specified animation and run through the frames
void MotionTask::genericAnimationAction(uint8 actionType) {
- Actor *const a = (Actor *)object;
+ Actor *const a = (Actor *)_object;
- if (flags & reset) {
+ if (_flags & reset) {
a->setAction(actionType, 0);
- flags &= ~reset;
+ _flags &= ~reset;
} else if (a->nextAnimationFrame())
remove(motionCompleted);
}
@@ -3173,13 +3173,13 @@ const CombatMotionSet twoHandedLowSwingSet = {
void MotionTask::twoHandedSwingAction() {
// If the reset flag is set, initialize the motion
- if (flags & reset) {
+ if (_flags & reset) {
// Let the game engine know about this aggressive act
- logAggressiveAct(object->thisID(), targetObj->thisID());
+ logAggressiveAct(_object->thisID(), _targetObj->thisID());
// Notify the target actor that he is being attacked
- if (isActor(targetObj))
- ((Actor *)targetObj)->evaluateMeleeAttack((Actor *)object);
+ if (isActor(_targetObj))
+ ((Actor *)_targetObj)->evaluateMeleeAttack((Actor *)_object);
// Create an animation type lookup table
static const uint8 animationTypeArray[] = {
@@ -3191,10 +3191,10 @@ void MotionTask::twoHandedSwingAction() {
actionTwoHandSwingRightLow,
};
- Actor *a = (Actor *)object;
+ Actor *a = (Actor *)_object;
uint8 actorAnimation;
int16 actorMidAltitude,
- targetAltitude = targetObj->getLocation().z;
+ targetAltitude = _targetObj->getLocation().z;
const CombatMotionSet *availableSet;
@@ -3205,7 +3205,7 @@ void MotionTask::twoHandedSwingAction() {
// The target is higher than the actor's midsection
availableSet = &twoHandedHighSwingSet;
else {
- uint8 targetHeight = targetObj->proto()->height;
+ uint8 targetHeight = _targetObj->proto()->height;
if (targetAltitude + targetHeight < actorMidAltitude)
// The target is below the actor's midsection
@@ -3216,35 +3216,35 @@ void MotionTask::twoHandedSwingAction() {
}
// Calculate the direction of the attack
- direction = (targetObj->getLocation() - a->getLocation()).quickDir();
+ _direction = (_targetObj->getLocation() - a->getLocation()).quickDir();
// Randomly select a combat motion type from the available set
- combatMotionType = availableSet->selectRandom();
- actorAnimation = animationTypeArray[combatMotionType];
+ _combatMotionType = availableSet->selectRandom();
+ actorAnimation = animationTypeArray[_combatMotionType];
if (a->_appearance != nullptr
&& a->isActionAvailable(actorAnimation)) {
// Compute the number of frames in the animation before the
// actual strike
- actionCounter = a->animationFrames(actorAnimation, direction) - 2;
+ actionCounter = a->animationFrames(actorAnimation, _direction) - 2;
a->setAction(actorAnimation, 0);
// Set this flag to indicate that the animation is actually
// being played
- flags |= nextAnim;
+ _flags |= nextAnim;
} else {
actionCounter = 2;
// Clear this flag to indicate that the animation is not
// being played
- flags &= ~nextAnim;
+ _flags &= ~nextAnim;
}
a->setActionPoints(
- computeTurnFrames(a->_currentFacing, direction) + 10);
+ computeTurnFrames(a->_currentFacing, _direction) + 10);
- flags &= ~reset;
+ _flags &= ~reset;
} else
// Call the generic offensive melee function
offensiveMeleeAction();
@@ -3287,13 +3287,13 @@ const CombatMotionSet oneHandedLowSwingSet = {
// Handle all one handed swing motions
void MotionTask::oneHandedSwingAction() {
- if (flags & reset) {
+ if (_flags & reset) {
// Let the game engine know about this aggressive act
- logAggressiveAct(object->thisID(), targetObj->thisID());
+ logAggressiveAct(_object->thisID(), _targetObj->thisID());
// Notify the target actor that he is being attacked
- if (isActor(targetObj))
- ((Actor *)targetObj)->evaluateMeleeAttack((Actor *)object);
+ if (isActor(_targetObj))
+ ((Actor *)_targetObj)->evaluateMeleeAttack((Actor *)_object);
// Create an animation type lookup table
static const uint8 animationTypeArray[] = {
@@ -3301,10 +3301,10 @@ void MotionTask::oneHandedSwingAction() {
actionSwingLow,
};
- Actor *const a = (Actor *)object;
+ Actor *const a = (Actor *)_object;
uint8 actorAnimation;
int16 actorMidAltitude,
- targetAltitude = targetObj->getLocation().z;
+ targetAltitude = _targetObj->getLocation().z;
const CombatMotionSet *availableSet;
@@ -3315,7 +3315,7 @@ void MotionTask::oneHandedSwingAction() {
// The target is higher than the actor's midsection
availableSet = &oneHandedHighSwingSet;
else {
- uint8 targetHeight = targetObj->proto()->height;
+ uint8 targetHeight = _targetObj->proto()->height;
if (targetAltitude + targetHeight < actorMidAltitude)
// The target is below the actor's midsection
@@ -3326,35 +3326,35 @@ void MotionTask::oneHandedSwingAction() {
}
// Calculate the direction of the attack
- direction = (targetObj->getLocation() - a->getLocation()).quickDir();
+ _direction = (_targetObj->getLocation() - a->getLocation()).quickDir();
// Randomly select a combat motion type from the available set
- combatMotionType = availableSet->selectRandom();
+ _combatMotionType = availableSet->selectRandom();
- /* if ( combatMotionType == oneHandedThrust )
+ /* if ( _combatMotionType == oneHandedThrust )
{
// Initialize the thrust motion
}
else*/
{
- actorAnimation = animationTypeArray[combatMotionType];
+ actorAnimation = animationTypeArray[_combatMotionType];
if (a->_appearance != nullptr
&& a->isActionAvailable(actorAnimation)) {
// Compute the number of frames in the animation before the
// actual strike
- actionCounter = a->animationFrames(actorAnimation, direction) - 2;
+ actionCounter = a->animationFrames(actorAnimation, _direction) - 2;
a->setAction(actorAnimation, 0);
// Set this flag to indicate that the animation is actually
// being played
- flags |= nextAnim;
+ _flags |= nextAnim;
} else {
actionCounter = 1;
// Clear this flag to indicate that the animation is not
// being played
- flags &= ~nextAnim;
+ _flags &= ~nextAnim;
}
}
@@ -3362,9 +3362,9 @@ void MotionTask::oneHandedSwingAction() {
a->setActionPoints(actionCounter * 2);
a->setActionPoints(
- computeTurnFrames(a->_currentFacing, direction) + 10);
+ computeTurnFrames(a->_currentFacing, _direction) + 10);
- flags &= ~reset;
+ _flags &= ~reset;
} else
// Call the generic offensive melee function
offensiveMeleeAction();
@@ -3376,11 +3376,11 @@ void MotionTask::oneHandedSwingAction() {
uint16 MotionTask::framesUntilStrike() {
// If the melee action has not been initialized, return a safe value
- if (flags & reset) return maxuint16;
+ if (_flags & reset) return maxuint16;
uint16 turnFrames;
- turnFrames = (direction - ((Actor *)object)->_currentFacing) & 0x7;
+ turnFrames = (_direction - ((Actor *)_object)->_currentFacing) & 0x7;
if (turnFrames > 4) turnFrames = 8 - turnFrames;
return turnFrames + actionCounter;
@@ -3392,9 +3392,9 @@ uint16 MotionTask::framesUntilStrike() {
GameObject *MotionTask::blockingObject(Actor *thisAttacker) {
return isDefense()
- && (d.defenseFlags & blocking)
- && thisAttacker == d.attacker
- ? d.defensiveObj
+ && (_d.defenseFlags & blocking)
+ && thisAttacker == _d.attacker
+ ? _d.defensiveObj
: nullptr;
}
@@ -3402,50 +3402,50 @@ GameObject *MotionTask::blockingObject(Actor *thisAttacker) {
// Handle bow firing motions
void MotionTask::fireBowAction() {
- Actor *a = (Actor *)object;
+ Actor *a = (Actor *)_object;
assert(a->_leftHandObject != Nothing);
// Initialize the bow firing motion
- if (flags & reset) {
+ if (_flags & reset) {
// Let the game engine know about this aggressive act
- logAggressiveAct(object->thisID(), targetObj->thisID());
+ logAggressiveAct(_object->thisID(), _targetObj->thisID());
// Compute the direction to the target
- direction = (targetObj->getLocation() - a->getLocation()).quickDir();
+ _direction = (_targetObj->getLocation() - a->getLocation()).quickDir();
if (a->_appearance != nullptr
&& a->isActionAvailable(actionFireBow)) {
// Calculate the number of frames in the animation before the
// projectile is actually fired
- actionCounter = a->animationFrames(actionFireBow, direction) - 1;
+ actionCounter = a->animationFrames(actionFireBow, _direction) - 1;
a->setAction(actionFireBow, 0);
// Set this flag to indicate that the animation is actually
// being played
- flags |= nextAnim;
+ _flags |= nextAnim;
} else {
actionCounter = 1;
// Clear this flag to indicate that the animation is not
// being played
- flags &= ~nextAnim;
+ _flags &= ~nextAnim;
}
a->setActionPoints(
- computeTurnFrames(a->_currentFacing, direction) + 10);
+ computeTurnFrames(a->_currentFacing, _direction) + 10);
- if (a->_currentFacing != direction)
- a->turn(direction);
+ if (a->_currentFacing != _direction)
+ a->turn(_direction);
- flags &= ~reset;
- } else if (a->_currentFacing != direction)
- a->turn(direction);
+ _flags &= ~reset;
+ } else if (a->_currentFacing != _direction)
+ a->turn(_direction);
else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((flags & nextAnim) && a->_appearance == nullptr)
- flags &= ~nextAnim;
+ if ((_flags & nextAnim) && a->_appearance == nullptr)
+ _flags &= ~nextAnim;
// If the action counter has reached zero, get a projectile and
// fire it
@@ -3477,13 +3477,13 @@ void MotionTask::fireBowAction() {
if ((projID = proj->extractMerged(Location(actorLoc, a->IDParent()), 1)) != Nothing) {
g_vm->_cnm->setUpdate(a->thisID());
proj = GameObject::objectAddress(projID);
- shootObject(*proj, *a, *targetObj, 16);
+ shootObject(*proj, *a, *_targetObj, 16);
}
}
}
}
- if (flags & nextAnim) {
+ if (_flags & nextAnim) {
// Run through the animation frames
if (!a->nextAnimationFrame()) {
if (actionCounter >= 0) actionCounter--;
@@ -3502,53 +3502,53 @@ void MotionTask::fireBowAction() {
// Handle spell casting motions
void MotionTask::castSpellAction() {
- Actor *a = (Actor *)object;
+ Actor *a = (Actor *)_object;
// Turn until facing the target
- if (a->_currentFacing != direction)
- a->turn(direction);
+ if (a->_currentFacing != _direction)
+ a->turn(_direction);
else {
- if (flags & reset) {
+ if (_flags & reset) {
if (a->_appearance != nullptr
&& a->isActionAvailable(actionCastSpell)) {
// Calculate the number of frames in the animation before the
// spell is case
- actionCounter = a->animationFrames(actionCastSpell, direction) - 1;
+ actionCounter = a->animationFrames(actionCastSpell, _direction) - 1;
a->setAction(actionCastSpell, 0);
// Set this flag to indicate that the animation is actually
// being played
- flags |= nextAnim;
+ _flags |= nextAnim;
} else {
actionCounter = 3;
// Clear this flag to indicate that the animation is not
// being played
- flags &= ~nextAnim;
+ _flags &= ~nextAnim;
}
- flags &= ~reset;
+ _flags &= ~reset;
}
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((flags & nextAnim) && a->_appearance == nullptr)
- flags &= ~nextAnim;
+ if ((_flags & nextAnim) && a->_appearance == nullptr)
+ _flags &= ~nextAnim;
if (actionCounter == 0) {
- if (spellObj) {
- if (flags & TAGTarg) {
- assert(targetTAG->_data.itemType == activeTypeInstance);
- spellObj->implementAction(spellObj->getSpellID(), a->thisID(), targetTAG);
- } else if (flags & LocTarg) {
- spellObj->implementAction(spellObj->getSpellID(), a->thisID(), targetLoc);
- } else if (targetObj) {
- spellObj->implementAction(spellObj->getSpellID(), a->thisID(), targetObj->thisID());
+ if (_spellObj) {
+ if (_flags & TAGTarg) {
+ assert(_targetTAG->_data.itemType == activeTypeInstance);
+ _spellObj->implementAction(_spellObj->getSpellID(), a->thisID(), _targetTAG);
+ } else if (_flags & LocTarg) {
+ _spellObj->implementAction(_spellObj->getSpellID(), a->thisID(), _targetLoc);
+ } else if (_targetObj) {
+ _spellObj->implementAction(_spellObj->getSpellID(), a->thisID(), _targetObj->thisID());
}
}
}
- if (flags & nextAnim) {
+ if (_flags & nextAnim) {
// Run through the animation frames
if (!a->nextAnimationFrame()) {
if (actionCounter >= 0) actionCounter--;
@@ -3568,34 +3568,34 @@ void MotionTask::castSpellAction() {
void MotionTask::useWandAction() {
// Initialize the wand using motion
- if (flags & reset) {
+ if (_flags & reset) {
// Let the game engine know about this aggressive act
- logAggressiveAct(object->thisID(), targetObj->thisID());
+ logAggressiveAct(_object->thisID(), _targetObj->thisID());
- Actor *a = (Actor *)object;
+ Actor *a = (Actor *)_object;
- direction = (targetObj->getLocation() - a->getLocation()).quickDir();
+ _direction = (_targetObj->getLocation() - a->getLocation()).quickDir();
if (a->_appearance != nullptr
&& a->isActionAvailable(actionUseWand)) {
- actionCounter = a->animationFrames(actionUseWand, direction) - 1;
+ actionCounter = a->animationFrames(actionUseWand, _direction) - 1;
a->setAction(actionUseWand, 0);
// Set this flag to indicate that the animation is actually
// being played
- flags |= nextAnim;
+ _flags |= nextAnim;
} else {
actionCounter = 3;
// Clear this flag to indicate that the animation is not
// being played
- flags &= ~nextAnim;
+ _flags &= ~nextAnim;
}
a->setActionPoints(
- computeTurnFrames(a->_currentFacing, direction) + 10);
+ computeTurnFrames(a->_currentFacing, _direction) + 10);
- flags &= ~reset;
+ _flags &= ~reset;
}
useMagicWeaponAction();
}
@@ -3605,33 +3605,33 @@ void MotionTask::useWandAction() {
// Handle two handed parrying motions
void MotionTask::twoHandedParryAction() {
- if (flags & reset) {
- Actor *a = (Actor *)object;
+ if (_flags & reset) {
+ Actor *a = (Actor *)_object;
int16 animationFrames;
- direction = (d.attacker->getLocation() - a->getLocation()).quickDir();
+ _direction = (_d.attacker->getLocation() - a->getLocation()).quickDir();
if (a->_appearance != nullptr
&& a->isActionAvailable(actionTwoHandParry)) {
a->setAction(actionTwoHandParry, 0);
- animationFrames = a->animationFrames(actionTwoHandParry, direction);
+ animationFrames = a->animationFrames(actionTwoHandParry, _direction);
// Set this flag to indicate that the animation is actually
// being played
- flags |= nextAnim;
+ _flags |= nextAnim;
} else {
animationFrames = 2;
// Clear this flag to indicate that the animation is not
// being played
- flags &= ~nextAnim;
+ _flags &= ~nextAnim;
}
a->setActionPoints(
- computeTurnFrames(a->_currentFacing, direction)
+ computeTurnFrames(a->_currentFacing, _direction)
+ animationFrames + 1);
- flags &= ~reset;
+ _flags &= ~reset;
}
defensiveMeleeAction();
}
@@ -3640,34 +3640,34 @@ void MotionTask::twoHandedParryAction() {
// Handle one handed parrying motions
void MotionTask::oneHandedParryAction() {
- if (flags & reset) {
- Actor *a = (Actor *)object;
+ if (_flags & reset) {
+ Actor *a = (Actor *)_object;
int16 animationFrames;
- direction = (d.attacker->getLocation() - a->getLocation()).quickDir();
+ _direction = (_d.attacker->getLocation() - a->getLocation()).quickDir();
- combatMotionType = oneHandedParryHigh;
+ _combatMotionType = oneHandedParryHigh;
if (a->_appearance != nullptr
&& a->isActionAvailable(actionParryHigh)) {
a->setAction(actionParryHigh, 0);
- animationFrames = a->animationFrames(actionParryHigh, direction);
+ animationFrames = a->animationFrames(actionParryHigh, _direction);
// Set this flag to indicate that the animation is actually
// being played
- flags |= nextAnim;
+ _flags |= nextAnim;
} else {
animationFrames = 2;
// Clear this flag to indicate that the animation is not
// being played
- flags &= ~nextAnim;
+ _flags &= ~nextAnim;
}
a->setActionPoints(
- computeTurnFrames(a->_currentFacing, direction)
+ computeTurnFrames(a->_currentFacing, _direction)
+ animationFrames + 1);
- flags &= ~reset;
+ _flags &= ~reset;
}
defensiveMeleeAction();
}
@@ -3676,33 +3676,33 @@ void MotionTask::oneHandedParryAction() {
// Handle shield parrying motions
void MotionTask::shieldParryAction() {
- if (flags & reset) {
- Actor *a = (Actor *)object;
+ if (_flags & reset) {
+ Actor *a = (Actor *)_object;
int16 animationFrames;
- direction = (d.attacker->getLocation() - a->getLocation()).quickDir();
+ _direction = (_d.attacker->getLocation() - a->getLocation()).quickDir();
if (a->_appearance != nullptr
&& a->isActionAvailable(actionShieldParry)) {
a->setAction(actionShieldParry, 0);
- animationFrames = a->animationFrames(actionShieldParry, direction);
+ animationFrames = a->animationFrames(actionShieldParry, _direction);
// Set this flag to indicate that the animation is actually
// being played
- flags |= nextAnim;
+ _flags |= nextAnim;
} else {
animationFrames = 1;
// Clear this flag to indicate that the animation is not
// being played
- flags &= ~nextAnim;
+ _flags &= ~nextAnim;
}
a->setActionPoints(
- computeTurnFrames(a->_currentFacing, direction)
+ computeTurnFrames(a->_currentFacing, _direction)
+ animationFrames + 1);
- flags &= ~reset;
+ _flags &= ~reset;
}
defensiveMeleeAction();
}
@@ -3711,10 +3711,10 @@ void MotionTask::shieldParryAction() {
// Handle dodging motions
void MotionTask::dodgeAction() {
- Actor *a = (Actor *)object;
- MotionTask *attackerMotion = d.attacker->_moveTask;
+ Actor *a = (Actor *)_object;
+ MotionTask *attackerMotion = _d.attacker->_moveTask;
- if (flags & reset) {
+ if (_flags & reset) {
// If the attacker is not attacking, we're done
if (attackerMotion == nullptr
|| !attackerMotion->isMeleeAttack()) {
@@ -3734,27 +3734,27 @@ void MotionTask::dodgeAction() {
// Set this flag to indicate that the animation is actually
// being played
- flags |= nextAnim;
+ _flags |= nextAnim;
} else {
animationFrames = 3;
// Clear this flag to indicate that the animation is not
// being played
- flags &= ~nextAnim;
+ _flags &= ~nextAnim;
}
actionCounter = animationFrames - 1;
a->setActionPoints(animationFrames + 1);
- flags &= ~reset;
+ _flags &= ~reset;
}
} else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((flags & nextAnim) && a->_appearance == nullptr)
- flags &= ~nextAnim;
+ if ((_flags & nextAnim) && a->_appearance == nullptr)
+ _flags &= ~nextAnim;
- if (flags & nextAnim) {
+ if (_flags & nextAnim) {
// Run through the animation frames
if (!a->nextAnimationFrame()) {
if (actionCounter > 0) actionCounter--;
@@ -3773,15 +3773,15 @@ void MotionTask::dodgeAction() {
// Handle accept hit motions
void MotionTask::acceptHitAction() {
- Actor *a = (Actor *)object;
+ Actor *a = (Actor *)_object;
- if (flags & reset) {
+ if (_flags & reset) {
TilePoint newLoc = a->getLocation();
StandingTileInfo sti;
int16 animationFrames;
a->_currentFacing =
- (d.attacker->getWorldLocation() - a->getLocation()).quickDir();
+ (_d.attacker->getWorldLocation() - a->getLocation()).quickDir();
if (a->_appearance != nullptr
&& a->isActionAvailable(actionHit, a->_currentFacing)) {
@@ -3790,13 +3790,13 @@ void MotionTask::acceptHitAction() {
// Set this flag to indicate that the animation is actually
// being played
- flags |= nextAnim;
+ _flags |= nextAnim;
} else {
animationFrames = 1;
// Clear this flag to indicate that the animation is not
// being played
- flags &= ~nextAnim;
+ _flags &= ~nextAnim;
}
a->setActionPoints(animationFrames + 1);
@@ -3813,14 +3813,14 @@ void MotionTask::acceptHitAction() {
}
}
- flags &= ~reset;
+ _flags &= ~reset;
} else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((flags & nextAnim) && a->_appearance == nullptr)
- flags &= ~nextAnim;
+ if ((_flags & nextAnim) && a->_appearance == nullptr)
+ _flags &= ~nextAnim;
- if (flags & nextAnim) {
+ if (_flags & nextAnim) {
if (a->nextAnimationFrame()) remove();
} else
remove();
@@ -3831,15 +3831,15 @@ void MotionTask::acceptHitAction() {
// Handle fall down motions
void MotionTask::fallDownAction() {
- Actor *a = (Actor *)object;
+ Actor *a = (Actor *)_object;
- if (flags & reset) {
+ if (_flags & reset) {
TilePoint newLoc = a->getLocation();
StandingTileInfo sti;
int16 animationFrames;
a->_currentFacing =
- (d.attacker->getWorldLocation() - a->getLocation()).quickDir();
+ (_d.attacker->getWorldLocation() - a->getLocation()).quickDir();
if (a->_appearance != nullptr
&& a->isActionAvailable(actionKnockedDown, a->_currentFacing)) {
@@ -3850,13 +3850,13 @@ void MotionTask::fallDownAction() {
// Set this flag to indicate that the animation is actually
// being played
- flags |= nextAnim;
+ _flags |= nextAnim;
} else {
animationFrames = 6;
// Clear this flag to indicate that the animation is not
// being played
- flags &= ~nextAnim;
+ _flags &= ~nextAnim;
}
a->setActionPoints(animationFrames + 1);
@@ -3873,14 +3873,14 @@ void MotionTask::fallDownAction() {
}
}
- flags &= ~reset;
+ _flags &= ~reset;
} else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((flags & nextAnim) && a->_appearance == nullptr)
- flags &= ~nextAnim;
+ if ((_flags & nextAnim) && a->_appearance == nullptr)
+ _flags &= ~nextAnim;
- if (flags & nextAnim) {
+ if (_flags & nextAnim) {
if (a->nextAnimationFrame()) remove();
} else
remove();
@@ -3892,16 +3892,16 @@ void MotionTask::fallDownAction() {
// and oneHandedSwingAction()
void MotionTask::offensiveMeleeAction() {
- Actor *a = (Actor *)object;
+ Actor *a = (Actor *)_object;
// Turn until facing the target
- if (a->_currentFacing != direction)
- a->turn(direction);
+ if (a->_currentFacing != _direction)
+ a->turn(_direction);
else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((flags & nextAnim) && a->_appearance == nullptr)
- flags &= ~nextAnim;
+ if ((_flags & nextAnim) && a->_appearance == nullptr)
+ _flags &= ~nextAnim;
// If the action counter has reached zero, use the weapon on
// the target
@@ -3909,10 +3909,10 @@ void MotionTask::offensiveMeleeAction() {
GameObject *weapon;
weapon = a->offensiveObject();
- if (weapon) weapon->strike(a->thisID(), targetObj->thisID());
+ if (weapon) weapon->strike(a->thisID(), _targetObj->thisID());
}
- if (flags & nextAnim) {
+ if (_flags & nextAnim) {
// Run through the animation frames
if (!a->nextAnimationFrame()) {
if (actionCounter >= 0) actionCounter--;
@@ -3931,16 +3931,16 @@ void MotionTask::offensiveMeleeAction() {
// Generic magic weapon code. Called by useWandAction().
void MotionTask::useMagicWeaponAction() {
- Actor *a = (Actor *)object;
+ Actor *a = (Actor *)_object;
// Turn until facing the target
- if (a->_currentFacing != direction)
- a->turn(direction);
+ if (a->_currentFacing != _direction)
+ a->turn(_direction);
else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((flags & nextAnim) && a->_appearance == nullptr)
- flags &= ~nextAnim;
+ if ((_flags & nextAnim) && a->_appearance == nullptr)
+ _flags &= ~nextAnim;
// If the action counter has reached zero, get a spell and
// use it
@@ -3962,11 +3962,11 @@ void MotionTask::useMagicWeaponAction() {
spellProto->implementAction(
spellProto->getSpellID(),
magicWeapon->thisID(),
- targetObj->thisID());
+ _targetObj->thisID());
}
}
- if (flags & nextAnim) {
+ if (_flags & nextAnim) {
// Run through the animation frames
if (!a->nextAnimationFrame()) {
if (actionCounter >= 0) actionCounter--;
@@ -3986,11 +3986,11 @@ void MotionTask::useMagicWeaponAction() {
// oneHandedParryAction() and shieldParryAction().
void MotionTask::defensiveMeleeAction() {
- Actor *a = (Actor *)object;
- MotionTask *attackerMotion = d.attacker->_moveTask;
+ Actor *a = (Actor *)_object;
+ MotionTask *attackerMotion = _d.attacker->_moveTask;
// Determine if the blocking action has been initiated
- if (!(d.defenseFlags & blocking)) {
+ if (!(_d.defenseFlags & blocking)) {
// If the attacker is not attacking, we're done
if (attackerMotion == nullptr
|| !attackerMotion->isMeleeAttack()) {
@@ -4000,20 +4000,20 @@ void MotionTask::defensiveMeleeAction() {
}
// turn towards attacker
- if (a->_currentFacing != direction)
- a->turn(direction);
+ if (a->_currentFacing != _direction)
+ a->turn(_direction);
// If the strike is about to land start the blocking motion
if (attackerMotion->framesUntilStrike() <= 1)
- d.defenseFlags |= blocking;
+ _d.defenseFlags |= blocking;
} else {
// If the actors appearance becomes NULL, make sure this action
// no longer depends upon the animation
- if ((flags & nextAnim) && a->_appearance == nullptr)
- flags &= ~nextAnim;
+ if ((_flags & nextAnim) && a->_appearance == nullptr)
+ _flags &= ~nextAnim;
// Run through the animation frames
- if (!(flags & nextAnim) || a->nextAnimationFrame()) {
+ if (!(_flags & nextAnim) || a->nextAnimationFrame()) {
// Wait for the attacker's attack
if (attackerMotion == nullptr
|| !attackerMotion->isMeleeAttack()) {
@@ -4036,7 +4036,7 @@ void MotionTask::updatePositions() {
for (Common::List<MotionTask *>::iterator it = g_vm->_mTaskList->_list.begin(); it != g_vm->_mTaskList->_list.end(); it = g_vm->_mTaskList->_nextMT) {
MotionTask *mt = *it;
- GameObject *obj = mt->object;
+ GameObject *obj = mt->_object;
ProtoObj *proto = obj->proto();
Actor *a = (Actor *)obj;
bool moveTaskDone = false;
@@ -4056,11 +4056,11 @@ void MotionTask::updatePositions() {
continue;
if (obj->_data.location.z < -(proto->height >> 2))
- mt->flags |= inWater;
+ mt->_flags |= inWater;
else
- mt->flags &= ~inWater;
+ mt->_flags &= ~inWater;
- switch (mt->motionType) {
+ switch (mt->_motionType) {
case motionTypeThrown:
case motionTypeShot:
mt->ballisticAction();
@@ -4080,20 +4080,20 @@ void MotionTask::updatePositions() {
case motionTypeTalk:
- if (mt->flags & reset) {
+ if (mt->_flags & reset) {
a->setAction(actionStand, 0);
a->_cycleCount = g_vm->_rnd->getRandomNumber(3);
- mt->flags &= ~(reset | nextAnim);
+ mt->_flags &= ~(reset | nextAnim);
}
if (a->_cycleCount == 0) {
a->setAction(actionTalk, 0);
- mt->flags |= nextAnim;
+ mt->_flags |= nextAnim;
a->_cycleCount = -1;
- } else if (mt->flags & nextAnim) {
+ } else if (mt->_flags & nextAnim) {
if (a->nextAnimationFrame()) {
a->setAction(actionStand, 0);
a->_cycleCount = g_vm->_rnd->getRandomNumber(3);
- mt->flags &= ~nextAnim;
+ mt->_flags &= ~nextAnim;
}
} else
a->_cycleCount--;
@@ -4102,41 +4102,41 @@ void MotionTask::updatePositions() {
case motionTypeLand:
case motionTypeLandBadly:
- if (mt->flags & reset) {
- int16 newAction = mt->motionType == motionTypeLand
+ if (mt->_flags & reset) {
+ int16 newAction = mt->_motionType == motionTypeLand
? actionJumpUp
: actionFallBadly;
if (!a->isActionAvailable(newAction)) {
- if (mt->prevMotionType == motionTypeWalk) {
- mt->motionType = mt->prevMotionType;
- if (mt->flags & pathFind) {
+ if (mt->_prevMotionType == motionTypeWalk) {
+ mt->_motionType = mt->_prevMotionType;
+ if (mt->_flags & pathFind) {
mt->changeTarget(
- mt->finalTarget,
- (mt->flags & requestRun) != 0);
+ mt->_finalTarget,
+ (mt->_flags & requestRun) != 0);
} else {
mt->changeDirectTarget(
- mt->finalTarget,
- (mt->flags & requestRun) != 0);
+ mt->_finalTarget,
+ (mt->_flags & requestRun) != 0);
}
g_vm->_mTaskList->_nextMT = it;
}
} else {
a->setAction(newAction, 0);
a->setInterruptablity(false);
- mt->flags &= ~reset;
+ mt->_flags &= ~reset;
}
- } else if (a->nextAnimationFrame() || (mt->flags & inWater)) {
- if (mt->prevMotionType == motionTypeWalk) {
- mt->motionType = mt->prevMotionType;
- if (mt->flags & pathFind) {
+ } else if (a->nextAnimationFrame() || (mt->_flags & inWater)) {
+ if (mt->_prevMotionType == motionTypeWalk) {
+ mt->_motionType = mt->_prevMotionType;
+ if (mt->_flags & pathFind) {
mt->changeTarget(
- mt->finalTarget,
- (mt->flags & requestRun) != 0);
+ mt->_finalTarget,
+ (mt->_flags & requestRun) != 0);
} else {
mt->changeDirectTarget(
- mt->finalTarget,
- (mt->flags & requestRun) != 0);
+ mt->_finalTarget,
+ (mt->_flags & requestRun) != 0);
}
g_vm->_mTaskList->_nextMT = it;
} else if (mt->freeFall(obj->_data.location, sti) == false)
@@ -4145,19 +4145,19 @@ void MotionTask::updatePositions() {
// If actor was running, go through an abreviated
// landing sequence by aborting the landing animation
// after the first frame.
- if (mt->prevMotionType == motionTypeWalk
- && mt->flags & requestRun
- && mt->runCount == 0
- && !(mt->flags & inWater)) {
- mt->motionType = mt->prevMotionType;
- if (mt->flags & pathFind) {
+ if (mt->_prevMotionType == motionTypeWalk
+ && mt->_flags & requestRun
+ && mt->_runCount == 0
+ && !(mt->_flags & inWater)) {
+ mt->_motionType = mt->_prevMotionType;
+ if (mt->_flags & pathFind) {
mt->changeTarget(
- mt->finalTarget,
- (mt->flags & requestRun) != 0);
+ mt->_finalTarget,
+ (mt->_flags & requestRun) != 0);
} else {
mt->changeDirectTarget(
- mt->finalTarget,
- (mt->flags & requestRun) != 0);
+ mt->_finalTarget,
+ (mt->_flags & requestRun) != 0);
}
g_vm->_mTaskList->_nextMT = it;
}
@@ -4166,12 +4166,12 @@ void MotionTask::updatePositions() {
case motionTypeJump:
- if (mt->flags & reset) {
+ if (mt->_flags & reset) {
a->setAction(actionJumpUp, 0);
a->setInterruptablity(false);
- mt->flags &= ~reset;
+ mt->_flags &= ~reset;
} else if (a->nextAnimationFrame()) {
- mt->motionType = motionTypeThrown;
+ mt->_motionType = motionTypeThrown;
a->setAction(actionFreeFall, 0);
}
break;
@@ -4188,18 +4188,18 @@ void MotionTask::updatePositions() {
case motionTypeRise:
- if (a->_data.location.z < mt->immediateLocation.z) {
+ if (a->_data.location.z < mt->_immediateLocation.z) {
a->_data.location.z++;
- if (mt->flags & nextAnim)
+ if (mt->_flags & nextAnim)
a->nextAnimationFrame();
- mt->flags ^= nextAnim;
+ mt->_flags ^= nextAnim;
} else {
- targetVector = mt->finalTarget - obj->_data.location;
+ targetVector = mt->_finalTarget - obj->_data.location;
targetDist = targetVector.quickHDistance();
if (targetDist > kTileUVSize) {
- mt->motionType = mt->prevMotionType;
- mt->flags |= reset;
+ mt->_motionType = mt->_prevMotionType;
+ mt->_flags |= reset;
g_vm->_mTaskList->_nextMT = it;
} else
moveTaskDone = true;
@@ -4208,9 +4208,9 @@ void MotionTask::updatePositions() {
case motionTypeWait:
- if (mt->flags & reset) {
+ if (mt->_flags & reset) {
mt->actionCounter = 5;
- mt->flags &= ~reset;
+ mt->_flags &= ~reset;
} else if (--mt->actionCounter == 0)
moveTaskDone = true;
break;
@@ -4219,33 +4219,33 @@ void MotionTask::updatePositions() {
// This will be uninterrutable for 2 frames
a->setActionPoints(2);
- mt->o.directObject->use(a->thisID());
+ mt->_o.directObject->use(a->thisID());
//g_vm->_mTaskList->_nextMT=mt;
moveTaskDone = true;
break;
case motionTypeUseObjectOnObject:
- if (isWorld(mt->o.indirectObject->IDParent())) {
+ if (isWorld(mt->_o.indirectObject->IDParent())) {
if (
1
#ifdef THIS_SHOULD_BE_IN_TILEMODE
a->inUseRange(
- mt->o.indirectObject->getLocation(),
- mt->o.directObject)
+ mt->_o.indirectObject->getLocation(),
+ mt->_o.directObject)
#endif
) {
- mt->direction = (mt->o.indirectObject->getLocation()
+ mt->_direction = (mt->_o.indirectObject->getLocation()
- a->getLocation()).quickDir();
- if (a->_currentFacing != mt->direction)
- a->turn(mt->direction);
+ if (a->_currentFacing != mt->_direction)
+ a->turn(mt->_direction);
else {
// The actor will now be uniterruptable
a->setActionPoints(2);
- mt->o.directObject->useOn(
+ mt->_o.directObject->useOn(
a->thisID(),
- mt->o.indirectObject->thisID());
- if (mt->motionType == motionTypeUseObjectOnObject)
+ mt->_o.indirectObject->thisID());
+ if (mt->_motionType == motionTypeUseObjectOnObject)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4254,10 +4254,10 @@ void MotionTask::updatePositions() {
} else {
// The actor will now be uniterruptable
a->setActionPoints(2);
- mt->o.directObject->useOn(
+ mt->_o.directObject->useOn(
a->thisID(),
- mt->o.indirectObject->thisID());
- if (mt->motionType == motionTypeUseObjectOnObject)
+ mt->_o.indirectObject->thisID());
+ if (mt->_motionType == motionTypeUseObjectOnObject)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4267,15 +4267,15 @@ void MotionTask::updatePositions() {
case motionTypeUseObjectOnTAI:
- if (mt->flags & reset) {
+ if (mt->_flags & reset) {
TilePoint actorLoc = a->getLocation(),
TAILoc;
TileRegion TAIReg;
- ActiveItem *TAG = mt->o.TAI->getGroup();
+ ActiveItem *TAG = mt->_o.TAI->getGroup();
// Compute in points the region of the TAI
- TAIReg.min.u = mt->o.TAI->_data.instance.u << kTileUVShift;
- TAIReg.min.v = mt->o.TAI->_data.instance.v << kTileUVShift;
+ TAIReg.min.u = mt->_o.TAI->_data.instance.u << kTileUVShift;
+ TAIReg.min.v = mt->_o.TAI->_data.instance.v << kTileUVShift;
TAIReg.max.u = TAIReg.min.u
+ (TAG->_data.group.uSize << kTileUVShift);
TAIReg.max.v = TAIReg.min.v
@@ -4288,17 +4288,17 @@ void MotionTask::updatePositions() {
TAILoc.z = actorLoc.z;
// Compute the direction from the actor to the TAI
- mt->direction = (TAILoc - actorLoc).quickDir();
- mt->flags &= ~reset;
+ mt->_direction = (TAILoc - actorLoc).quickDir();
+ mt->_flags &= ~reset;
}
- if (a->_currentFacing != mt->direction)
- a->turn(mt->direction);
+ if (a->_currentFacing != mt->_direction)
+ a->turn(mt->_direction);
else {
// The actor will now be uniterruptable
a->setActionPoints(2);
- mt->o.directObject->useOn(a->thisID(), mt->o.TAI);
- if (mt->motionType == motionTypeUseObjectOnTAI)
+ mt->_o.directObject->useOn(a->thisID(), mt->_o.TAI);
+ if (mt->_motionType == motionTypeUseObjectOnTAI)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4307,18 +4307,18 @@ void MotionTask::updatePositions() {
case motionTypeUseObjectOnLocation:
- if (mt->flags & reset) {
- mt->direction = (mt->targetLoc - a->getLocation()).quickDir();
- mt->flags &= ~reset;
+ if (mt->_flags & reset) {
+ mt->_direction = (mt->_targetLoc - a->getLocation()).quickDir();
+ mt->_flags &= ~reset;
}
- if (a->_currentFacing != mt->direction)
- a->turn(mt->direction);
+ if (a->_currentFacing != mt->_direction)
+ a->turn(mt->_direction);
else {
// The actor will now be uniterruptable
a->setActionPoints(2);
- mt->o.directObject->useOn(a->thisID(), mt->targetLoc);
- if (mt->motionType == motionTypeUseObjectOnLocation)
+ mt->_o.directObject->useOn(a->thisID(), mt->_targetLoc);
+ if (mt->_motionType == motionTypeUseObjectOnLocation)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4327,15 +4327,15 @@ void MotionTask::updatePositions() {
case motionTypeUseTAI:
- if (mt->flags & reset) {
+ if (mt->_flags & reset) {
TilePoint actorLoc = a->getLocation(),
TAILoc;
TileRegion TAIReg;
- ActiveItem *TAG = mt->o.TAI->getGroup();
+ ActiveItem *TAG = mt->_o.TAI->getGroup();
// Compute in points the region of the TAI
- TAIReg.min.u = mt->o.TAI->_data.instance.u << kTileUVShift;
- TAIReg.min.v = mt->o.TAI->_data.instance.v << kTileUVShift;
+ TAIReg.min.u = mt->_o.TAI->_data.instance.u << kTileUVShift;
+ TAIReg.min.v = mt->_o.TAI->_data.instance.v << kTileUVShift;
TAIReg.max.u = TAIReg.min.u
+ (TAG->_data.group.uSize << kTileUVShift);
TAIReg.max.v = TAIReg.min.v
@@ -4348,37 +4348,37 @@ void MotionTask::updatePositions() {
TAILoc.z = actorLoc.z;
// Compute the direction from the actor to the TAI
- mt->direction = (TAILoc - actorLoc).quickDir();
- mt->flags &= ~reset;
+ mt->_direction = (TAILoc - actorLoc).quickDir();
+ mt->_flags &= ~reset;
}
- if (a->_currentFacing != mt->direction)
- a->turn(mt->direction);
+ if (a->_currentFacing != mt->_direction)
+ a->turn(mt->_direction);
else {
// The actor will now be uniterruptable
a->setActionPoints(2);
- mt->o.TAI->use(a->thisID());
+ mt->_o.TAI->use(a->thisID());
moveTaskDone = true;
}
break;
case motionTypeDropObject:
- if (isWorld(mt->targetLoc.context)) {
- if (mt->flags & reset) {
- mt->direction = (mt->targetLoc - a->getLocation()).quickDir();
- mt->flags &= ~reset;
+ if (isWorld(mt->_targetLoc.context)) {
+ if (mt->_flags & reset) {
+ mt->_direction = (mt->_targetLoc - a->getLocation()).quickDir();
+ mt->_flags &= ~reset;
}
- if (a->_currentFacing != mt->direction)
- a->turn(mt->direction);
+ if (a->_currentFacing != mt->_direction)
+ a->turn(mt->_direction);
else {
// The actor will now be uniterruptable
a->setActionPoints(2);
- mt->o.directObject->drop(a->thisID(),
- mt->targetLoc,
+ mt->_o.directObject->drop(a->thisID(),
+ mt->_targetLoc,
mt->moveCount);
- if (mt->motionType == motionTypeDropObject)
+ if (mt->_motionType == motionTypeDropObject)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4386,10 +4386,10 @@ void MotionTask::updatePositions() {
} else {
// The actor will now be uniterruptable
a->setActionPoints(2);
- mt->o.directObject->drop(a->thisID(),
- mt->targetLoc,
+ mt->_o.directObject->drop(a->thisID(),
+ mt->_targetLoc,
mt->moveCount);
- if (mt->motionType == motionTypeDropObject)
+ if (mt->_motionType == motionTypeDropObject)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4401,19 +4401,19 @@ void MotionTask::updatePositions() {
case motionTypeDropObjectOnObject:
- if (isWorld(mt->o.indirectObject->IDParent())) {
- mt->direction = (mt->o.indirectObject->getLocation()
+ if (isWorld(mt->_o.indirectObject->IDParent())) {
+ mt->_direction = (mt->_o.indirectObject->getLocation()
- a->getLocation()).quickDir();
- if (a->_currentFacing != mt->direction)
- a->turn(mt->direction);
+ if (a->_currentFacing != mt->_direction)
+ a->turn(mt->_direction);
else {
// The actor will now be uniterruptable
a->setActionPoints(2);
- mt->o.directObject->dropOn(
+ mt->_o.directObject->dropOn(
a->thisID(),
- mt->o.indirectObject->thisID(),
+ mt->_o.indirectObject->thisID(),
mt->moveCount);
- if (mt->motionType == motionTypeDropObjectOnObject)
+ if (mt->_motionType == motionTypeDropObjectOnObject)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4421,11 +4421,11 @@ void MotionTask::updatePositions() {
} else {
// The actor will now be uniterruptable
a->setActionPoints(2);
- mt->o.directObject->dropOn(
+ mt->_o.directObject->dropOn(
a->thisID(),
- mt->o.indirectObject->thisID(),
+ mt->_o.indirectObject->thisID(),
mt->moveCount);
- if (mt->motionType == motionTypeDropObjectOnObject)
+ if (mt->_motionType == motionTypeDropObjectOnObject)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4437,21 +4437,21 @@ void MotionTask::updatePositions() {
case motionTypeDropObjectOnTAI:
- if (mt->flags & reset) {
- mt->direction = (mt->targetLoc - a->getLocation()).quickDir();
- mt->flags &= ~reset;
+ if (mt->_flags & reset) {
+ mt->_direction = (mt->_targetLoc - a->getLocation()).quickDir();
+ mt->_flags &= ~reset;
}
- if (a->_currentFacing != mt->direction)
- a->turn(mt->direction);
+ if (a->_currentFacing != mt->_direction)
+ a->turn(mt->_direction);
else {
// The actor will now be uniterruptable
a->setActionPoints(2);
- mt->o.directObject->dropOn(
+ mt->_o.directObject->dropOn(
a->thisID(),
- mt->o.TAI,
- mt->targetLoc);
- if (mt->motionType == motionTypeDropObjectOnTAI)
+ mt->_o.TAI,
+ mt->_targetLoc);
+ if (mt->_motionType == motionTypeDropObjectOnTAI)
moveTaskDone = true;
else
g_vm->_mTaskList->_nextMT = it;
@@ -4503,11 +4503,11 @@ void MotionTask::updatePositions() {
break;
case motionTypeDie:
- if (mt->flags & reset) {
+ if (mt->_flags & reset) {
if (a->isActionAvailable(actionDie)) {
a->setAction(actionDie, 0);
a->setInterruptablity(false);
- mt->flags &= ~reset;
+ mt->_flags &= ~reset;
} else {
moveTaskDone = true;
a->setInterruptablity(true);
@@ -4548,34 +4548,34 @@ bool MotionTask::freeFall(TilePoint &newPos, StandingTileInfo &sti) {
TilePoint tPos;
uint8 objCrossSection;
- tHeight = tileSlopeHeight(newPos, object, &sti);
+ tHeight = tileSlopeHeight(newPos, _object, &sti);
- if (object->_data.objectFlags & objectFloating) return false;
+ if (_object->_data.objectFlags & objectFloating) return false;
- velocity.u = (newPos.u - object->_data.location.u) * 2 / 3;
- velocity.v = (newPos.v - object->_data.location.v) * 2 / 3;
- velocity.z = (newPos.z - object->_data.location.z) * 2 / 3;
-// velocity.z = 0;
+ _velocity.u = (newPos.u - _object->_data.location.u) * 2 / 3;
+ _velocity.v = (newPos.v - _object->_data.location.v) * 2 / 3;
+ _velocity.z = (newPos.z - _object->_data.location.z) * 2 / 3;
+// _velocity.z = 0;
// If terrain is HIGHER (or even sligtly lower) than we are
// currently at, then try climbing it.
if (tHeight >= newPos.z - gravity * 4) {
supported:
- if (motionType != motionTypeWalk
+ if (_motionType != motionTypeWalk
|| tHeight <= newPos.z
- || !(flags & inWater)) {
+ || !(_flags & inWater)) {
if (tHeight > newPos.z + kMaxStepHeight) {
- unstickObject(object);
- tHeight = tileSlopeHeight(newPos, object, &sti);
+ unstickObject(_object);
+ tHeight = tileSlopeHeight(newPos, _object, &sti);
}
newPos.z = tHeight;
-// setObjectSurface( object, sti );
+// setObjectSurface( _object, sti );
return false;
} else {
- motionType = motionTypeRise;
- immediateLocation.z = tHeight;
- object->move(newPos);
+ _motionType = motionTypeRise;
+ _immediateLocation.z = tHeight;
+ _object->move(newPos);
return true;
}
@@ -4588,15 +4588,15 @@ supported:
// by checking the contact of what he's about to fall on.
if (tPos.z > tHeight) tPos.z--;
// See if we fell on something.
- if (checkContact(object, tPos) == blockageNone) {
+ if (checkContact(_object, tPos) == blockageNone) {
falling:
- if (motionType != motionTypeWalk
+ if (_motionType != motionTypeWalk
|| newPos.z > gravity * 4
|| tHeight >= 0) {
- motionType = motionTypeThrown;
+ _motionType = motionTypeThrown;
// newPos = tPos;
- object->move(tPos);
+ _object->move(tPos);
return true;
} else {
newPos = tPos;
@@ -4607,27 +4607,27 @@ falling:
// If we fall on something, reduce velocity due to impact.
// Try a couple of probes to see if we can fall in
// other directions.
- objCrossSection = object->proto()->crossSection;
+ objCrossSection = _object->proto()->crossSection;
tPos.u += objCrossSection;
- if (!checkBlocked(object, tPos)
- && !checkContact(object, tPos))
+ if (!checkBlocked(_object, tPos)
+ && !checkContact(_object, tPos))
goto falling;
tPos.u -= objCrossSection * 2;
- if (!checkBlocked(object, tPos)
- && !checkContact(object, tPos))
+ if (!checkBlocked(_object, tPos)
+ && !checkContact(_object, tPos))
goto falling;
tPos.u += objCrossSection;
tPos.v += objCrossSection;
- if (!checkBlocked(object, tPos)
- && !checkContact(object, tPos))
+ if (!checkBlocked(_object, tPos)
+ && !checkContact(_object, tPos))
goto falling;
tPos.v -= objCrossSection * 2;
- if (!checkBlocked(object, tPos)
- && !checkContact(object, tPos))
+ if (!checkBlocked(_object, tPos)
+ && !checkContact(_object, tPos))
goto falling;
// There is no support for the object and there is no place to fall
@@ -4635,7 +4635,7 @@ falling:
tPos = newPos;
tPos.u += objCrossSection;
- tHeight = tileSlopeHeight(tPos, object, &sti);
+ tHeight = tileSlopeHeight(tPos, _object, &sti);
if (tHeight <= tPos.z + kMaxStepHeight
&& tHeight >= tPos.z - gravity * 4) {
newPos = tPos;
@@ -4643,7 +4643,7 @@ falling:
}
tPos.u -= objCrossSection * 2;
- tHeight = tileSlopeHeight(tPos, object, &sti);
+ tHeight = tileSlopeHeight(tPos, _object, &sti);
if (tHeight <= tPos.z + kMaxStepHeight
&& tHeight >= tPos.z - gravity * 4) {
newPos = tPos;
@@ -4652,7 +4652,7 @@ falling:
tPos.u += objCrossSection;
tPos.v += objCrossSection;
- tHeight = tileSlopeHeight(tPos, object, &sti);
+ tHeight = tileSlopeHeight(tPos, _object, &sti);
if (tHeight <= tPos.z + kMaxStepHeight
&& tHeight >= tPos.z - gravity * 4) {
newPos = tPos;
@@ -4660,7 +4660,7 @@ falling:
}
tPos.v -= objCrossSection * 2;
- tHeight = tileSlopeHeight(tPos, object, &sti);
+ tHeight = tileSlopeHeight(tPos, _object, &sti);
if (tHeight <= tPos.z + kMaxStepHeight
&& tHeight >= tPos.z - gravity * 4) {
newPos = tPos;
@@ -4670,9 +4670,9 @@ falling:
// If we STILL cannot find support for the object, change its
// position and try again. This should be very rare.
newPos.z--;
- object->move(newPos);
- unstickObject(object);
- newPos = object->getLocation();
+ _object->move(newPos);
+ unstickObject(_object);
+ newPos = _object->getLocation();
return true;
}
diff --git a/engines/saga2/motion.h b/engines/saga2/motion.h
index 4dcbf53ffdf..82c869d70c0 100644
--- a/engines/saga2/motion.h
+++ b/engines/saga2/motion.h
@@ -99,21 +99,21 @@ class MotionTask {
friend void RequestWanderPath(MotionTask *mTask, int16 smartness);
friend void abortPathFind(MotionTask *mTask);
- GameObject *object; // the object to move
- TilePoint velocity; // object velocity for ballistic flight
- TilePoint immediateLocation, // where we are trying to get to
- finalTarget; // where we eventually want to get to
- int16 tetherMinU,
- tetherMinV,
- tetherMaxU,
- tetherMaxV;
- uint8 motionType, // thrown or shot.
- prevMotionType; // motion type before interruption
-
- ThreadID thread; // SAGA thread to wake up when
+ GameObject *_object; // the object to move
+ TilePoint _velocity; // object velocity for ballistic flight
+ TilePoint _immediateLocation, // where we are trying to get to
+ _finalTarget; // where we eventually want to get to
+ int16 _tetherMinU,
+ _tetherMinV,
+ _tetherMaxU,
+ _tetherMaxV;
+ uint8 _motionType, // thrown or shot.
+ _prevMotionType; // motion type before interruption
+
+ ThreadID _thread; // SAGA thread to wake up when
// motion is done
- uint16 flags; // various flags
+ uint16 _flags; // various flags
enum motionFlags {
pathFind = (1 << 0), // walk is using path finding
@@ -134,26 +134,26 @@ class MotionTask {
privledged = (1 << 15) // don't let AI interrupt this
};
- Direction direction; // direction of movement
- TilePoint pathList[16]; // intermediate motion targets
- int16 pathCount, // number of points in path
- pathIndex, // number of points so far
- runCount; // used for run requests.
- PathRequest *pathFindTask; // request to find the path
- int16 steps, // number of steps in ballistic motion
- uFrac, // remainder in U direction
- vFrac, // remainder in V direction
- uErrorTerm, // used to adjust for rounding errors
- vErrorTerm; // used to adjust for rounding errors
+ Direction _direction; // direction of movement
+ TilePoint _pathList[16]; // intermediate motion targets
+ int16 _pathCount, // number of points in path
+ _pathIndex, // number of points so far
+ _runCount; // used for run requests.
+ PathRequest *_pathFindTask; // request to find the path
+ int16 _steps, // number of steps in ballistic motion
+ _uFrac, // remainder in U direction
+ _vFrac, // remainder in V direction
+ _uErrorTerm, // used to adjust for rounding errors
+ _vErrorTerm; // used to adjust for rounding errors
// Data used in combat motion
- uint8 combatMotionType; // combat sub motion type
+ uint8 _combatMotionType; // combat sub motion type
// Spell casting stuff
- GameObject *targetObj; // target of attack or defense (object)
- ActiveItem *targetTAG; // target of attack or defense (TAG)
- Location targetLoc; // target of attack or defense (Location)
- SkillProto *spellObj; // spell being cast
+ GameObject *_targetObj; // target of attack or defense (object)
+ ActiveItem *_targetTAG; // target of attack or defense (TAG)
+ Location _targetLoc; // target of attack or defense (Location)
+ SkillProto *_spellObj; // spell being cast
union {
int16 actionCounter; // counter used in some motion
@@ -173,14 +173,14 @@ class MotionTask {
// upon.
Actor *enactor;
ActiveItem *TAI; // TAI involved in interation
- } o;
+ } _o;
// Defensive motion stuff
struct {
Actor *attacker; // attacking actor
GameObject *defensiveObj; // shield or parrying weapon
uint8 defenseFlags; // various combat flags
- } d;
+ } _d;
};
public:
@@ -272,15 +272,15 @@ private:
// Routines to handle updating of specific motion types
void turnAction() {
- Actor *a = (Actor *)object;
+ Actor *a = (Actor *)_object;
- if (flags & reset) {
+ if (_flags & reset) {
a->setAction(actionStand, 0);
- flags &= ~reset;
+ _flags &= ~reset;
}
- if (a->_currentFacing != direction)
- a->turn(direction);
+ if (a->_currentFacing != _direction)
+ a->turn(_direction);
else
remove(motionCompleted);
}
@@ -453,25 +453,25 @@ public:
// Determine if the motion task is walking to a destination
bool isWalkToDest() {
- return isWalk() && !(flags & wandering);
+ return isWalk() && !(_flags & wandering);
}
// Determine if the motion task is a wandering motion
bool isWander() {
- return isWalk() && (flags & wandering);
+ return isWalk() && (_flags & wandering);
}
// Determine if the motion task is tethered
bool isTethered() {
- return isWander() && (flags & tethered);
+ return isWander() && (_flags & tethered);
}
bool isRunning() {
- return (flags & requestRun) && runCount == 0;
+ return (_flags & requestRun) && _runCount == 0;
}
bool isTurn() {
- return motionType == motionTypeTurn;
+ return _motionType == motionTypeTurn;
}
// Return the wandering tether region
@@ -479,7 +479,7 @@ public:
// Return the final target location
TilePoint getTarget() {
- return finalTarget;
+ return _finalTarget;
}
// Update to a new final target
@@ -523,13 +523,13 @@ public:
// Determine if this motion is a dodge motion
bool isDodging(Actor *thisAttacker) {
- return motionType == motionTypeDodge && thisAttacker == d.attacker;
+ return _motionType == motionTypeDodge && thisAttacker == _d.attacker;
}
static void initMotionTasks();
bool isPrivledged() {
- return flags & privledged;
+ return _flags & privledged;
}
};
@@ -571,7 +571,7 @@ inline void MotionTask::walkTo(
bool canAgitate) {
walkTo(actor, target, run, canAgitate);
if (actor._moveTask != NULL)
- actor._moveTask->thread = th;
+ actor._moveTask->_thread = th;
}
inline void MotionTask::walkToDirect(
@@ -582,13 +582,13 @@ inline void MotionTask::walkToDirect(
bool canAgitate) {
walkToDirect(actor, target, run, canAgitate);
if (actor._moveTask != NULL)
- actor._moveTask->thread = th;
+ actor._moveTask->_thread = th;
}
inline void MotionTask::turn(ThreadID th, Actor &actor, Direction dir) {
turn(actor, dir);
if (actor._moveTask != NULL)
- actor._moveTask->thread = th;
+ actor._moveTask->_thread = th;
}
inline void MotionTask::turnTowards(
@@ -597,13 +597,13 @@ inline void MotionTask::turnTowards(
const TilePoint &where) {
turnTowards(actor, where);
if (actor._moveTask != NULL)
- actor._moveTask->thread = th;
+ actor._moveTask->_thread = th;
}
inline void MotionTask::give(ThreadID th, Actor &actor, Actor &givee) {
give(actor, givee);
if (actor._moveTask != NULL)
- actor._moveTask->thread = th;
+ actor._moveTask->_thread = th;
}
/* ===================================================================== *
diff --git a/engines/saga2/path.cpp b/engines/saga2/path.cpp
index 1f3385e700b..a523c08db03 100644
--- a/engines/saga2/path.cpp
+++ b/engines/saga2/path.cpp
@@ -1389,12 +1389,12 @@ PathRequest::PathRequest(Actor *a, int16 howSmart) {
actor = a;
smartness = howSmart;
mTask = actor->_moveTask;
- flags = mTask->flags & MotionTask::requestRun ? run : 0;
+ flags = mTask->_flags & MotionTask::requestRun ? run : 0;
if (path == nullptr)
path = new TilePoint[kPathSize]();
- mTask->pathFindTask = this;
+ mTask->_pathFindTask = this;
}
void PathRequest::initialize() {
@@ -1661,21 +1661,21 @@ void PathRequest::finish() {
pathLength = stepCount;
- if (mTask->pathFindTask == this && mTask->isWalk()) {
- memcpy(mTask->pathList, path, pathLength * sizeof path[0]);
- mTask->pathCount = pathLength;
- mTask->pathIndex = 0;
- mTask->flags |= MotionTask::reset;
- if (flags & completed) mTask->flags |= MotionTask::finalPath;
- mTask->pathFindTask = nullptr;
+ if (mTask->_pathFindTask == this && mTask->isWalk()) {
+ memcpy(mTask->_pathList, path, pathLength * sizeof path[0]);
+ mTask->_pathCount = pathLength;
+ mTask->_pathIndex = 0;
+ mTask->_flags |= MotionTask::reset;
+ if (flags & completed) mTask->_flags |= MotionTask::finalPath;
+ mTask->_pathFindTask = nullptr;
}
}
void PathRequest::abortReq() {
debugC(4, kDebugPath, "Aborting Path Request: %p", (void *)this);
- if (mTask->pathFindTask == this)
- mTask->pathFindTask = nullptr;
+ if (mTask->_pathFindTask == this)
+ mTask->_pathFindTask = nullptr;
}
@@ -2060,15 +2060,15 @@ bool PathRequest::timeLimitExceeded() {
DestinationPathRequest::DestinationPathRequest(Actor *a, int16 howSmart) :
PathRequest(a, howSmart) {
// Quantize the target destination to the nearest tile center.
- mTask->finalTarget.u = (mTask->finalTarget.u & ~kTileUVMask) + kTileUVSize / 2;
- mTask->finalTarget.v = (mTask->finalTarget.v & ~kTileUVMask) + kTileUVSize / 2;
- mTask->finalTarget.z = tileSlopeHeight(
- mTask->finalTarget,
+ mTask->_finalTarget.u = (mTask->_finalTarget.u & ~kTileUVMask) + kTileUVSize / 2;
+ mTask->_finalTarget.v = (mTask->_finalTarget.v & ~kTileUVMask) + kTileUVSize / 2;
+ mTask->_finalTarget.z = tileSlopeHeight(
+ mTask->_finalTarget,
a,
nullptr,
&destPlatform);
- destination = mTask->finalTarget;
+ destination = mTask->_finalTarget;
}
// Initialize the static data members
@@ -2190,12 +2190,12 @@ WanderPathRequest::WanderPathRequest(
Actor *a,
int16 howSmart) :
PathRequest(a, howSmart) {
- if (mTask->flags & MotionTask::tethered) {
+ if (mTask->_flags & MotionTask::tethered) {
tethered = true;
- tetherMinU = mTask->tetherMinU;
- tetherMinV = mTask->tetherMinV;
- tetherMaxU = mTask->tetherMaxU;
- tetherMaxV = mTask->tetherMaxV;
+ tetherMinU = mTask->_tetherMinU;
+ tetherMinV = mTask->_tetherMinV;
+ tetherMaxU = mTask->_tetherMaxU;
+ tetherMaxV = mTask->_tetherMaxV;
} else {
tethered = false;
tetherMinU = tetherMinV = tetherMaxU = tetherMaxV = 0;
@@ -2334,7 +2334,7 @@ void addPathRequestToQueue(PathRequest *pr) {
void RequestPath(MotionTask *mTask, int16 smartness) {
DestinationPathRequest *pr;
- Actor *a = (Actor *)mTask->object;
+ Actor *a = (Actor *)mTask->_object;
if ((pr = new DestinationPathRequest(a, smartness)) != nullptr)
addPathRequestToQueue(pr);
@@ -2342,22 +2342,22 @@ void RequestPath(MotionTask *mTask, int16 smartness) {
void RequestWanderPath(MotionTask *mTask, int16 smartness) {
WanderPathRequest *pr;
- Actor *a = (Actor *)mTask->object;
+ Actor *a = (Actor *)mTask->_object;
if ((pr = new WanderPathRequest(a, smartness)) != nullptr)
addPathRequestToQueue(pr);
}
void abortPathFind(MotionTask *mTask) {
- if (mTask->pathFindTask) {
- PathRequest *pr = mTask->pathFindTask;
+ if (mTask->_pathFindTask) {
+ PathRequest *pr = mTask->_pathFindTask;
if (pr == currentRequest)
pr->requestAbort();
else
g_vm->_pathQueue.remove(pr);
- mTask->pathFindTask = nullptr;
+ mTask->_pathFindTask = nullptr;
}
}
Commit: 1d5f9486b2822ed51d3a104e29a8c35aa18d7058
https://github.com/scummvm/scummvm/commit/1d5f9486b2822ed51d3a104e29a8c35aa18d7058
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:27+02:00
Commit Message:
SAGA2: Rename class variables in msgbox.h
Changed paths:
engines/saga2/msgbox.cpp
engines/saga2/msgbox.h
diff --git a/engines/saga2/msgbox.cpp b/engines/saga2/msgbox.cpp
index 30e389f2d23..03c11633c22 100644
--- a/engines/saga2/msgbox.cpp
+++ b/engines/saga2/msgbox.cpp
@@ -95,10 +95,10 @@ int16 MsgBox(const char *msg, const char *btnMsg1, const char *btnMsg2) {
return res;
}
-char ErrorWindow::mbChs1Text[8];
-char ErrorWindow::mbChs2Text[8];
-uint8 ErrorWindow::numBtns = 0;
-requestInfo ErrorWindow::rInfo;
+char ErrorWindow::_mbChs1Text[8];
+char ErrorWindow::_mbChs2Text[8];
+uint8 ErrorWindow::_numBtns = 0;
+requestInfo ErrorWindow::_rInfo;
APPFUNC(ErrorWindow::cmdMessageWindow) {
gWindow *win;
@@ -118,48 +118,48 @@ APPFUNC(ErrorWindow::cmdMessageWindow) {
ErrorWindow::ErrorWindow(const char *msg, const char *btnMsg1, const char *btnMsg2)
: SimpleWindow(mbWindowRect, 0, msg, cmdMessageWindow) {
- numBtns = 0;
+ _numBtns = 0;
- if (btnMsg1) numBtns++;
- if (btnMsg2) numBtns++;
+ if (btnMsg1) _numBtns++;
+ if (btnMsg2) _numBtns++;
// requester info struct
- rInfo.result = -1;
- rInfo.running = true;
+ _rInfo.result = -1;
+ _rInfo.running = true;
- strcpy(mbChs1Text, "\x13");
- strcpy(mbChs2Text, "\x1B");
+ strcpy(_mbChs1Text, "\x13");
+ strcpy(_mbChs2Text, "\x1B");
const char *eq;
// button one
if (btnMsg1) {
- new SimpleButton(*this, butBox(numBtns, 0), btnMsg1, 0, cmdMessageWindow);
+ new SimpleButton(*this, butBox(_numBtns, 0), btnMsg1, 0, cmdMessageWindow);
if ((eq = strchr(btnMsg1, '_')) != nullptr) {
eq++;
if (eq)
- mbChs1Text[strlen(mbChs1Text)] = *eq;
+ _mbChs1Text[strlen(_mbChs1Text)] = *eq;
}
}
// button two
if (btnMsg2) {
- new SimpleButton(*this, butBox(numBtns, 1), btnMsg2, 1, cmdMessageWindow);
+ new SimpleButton(*this, butBox(_numBtns, 1), btnMsg2, 1, cmdMessageWindow);
if ((eq = strchr(btnMsg2, '_')) != nullptr) {
eq++;
if (eq)
- mbChs2Text[strlen(mbChs2Text)] = *eq;
+ _mbChs2Text[strlen(_mbChs2Text)] = *eq;
}
}
- userData = &rInfo;
+ userData = &_rInfo;
}
int16 ErrorWindow::getResult() {
open();
draw();
- EventLoop(rInfo.running, true);
- return rInfo.result;
+ EventLoop(_rInfo.running, true);
+ return _rInfo.result;
}
ErrorWindow::~ErrorWindow() {
@@ -169,21 +169,21 @@ ErrorWindow::~ErrorWindow() {
void ErrorWindow::ErrorModeHandleKey(short key, short) {
- if (strchr(mbChs2Text, tolower(key)) ||
- strchr(mbChs2Text, toupper(key))) {
- rInfo.result = 2;
- rInfo.running = false;
+ if (strchr(_mbChs2Text, tolower(key)) ||
+ strchr(_mbChs2Text, toupper(key))) {
+ _rInfo.result = 2;
+ _rInfo.running = false;
return;
}
- if (strchr(mbChs1Text, tolower(key)) ||
- strchr(mbChs1Text, toupper(key))) {
- rInfo.result = 1;
- rInfo.running = false;
+ if (strchr(_mbChs1Text, tolower(key)) ||
+ strchr(_mbChs1Text, toupper(key))) {
+ _rInfo.result = 1;
+ _rInfo.running = false;
return;
}
- if (numBtns < 2) {
- rInfo.result = 1;
- rInfo.running = false;
+ if (_numBtns < 2) {
+ _rInfo.result = 1;
+ _rInfo.running = false;
return;
}
}
@@ -208,7 +208,7 @@ SimpleWindow::SimpleWindow(const Rect16 &r,
const char *stitle,
AppFunc *cmd)
: gWindow(r, ident, "", cmd) {
- prevModeStackCtr = GameMode::getStack(prevModeStackPtr);
+ _prevModeStackCtr = GameMode::getStack(_prevModeStackPtr);
GameMode *gameModes[] = {&PlayMode, &TileMode, &SimpleMode};
GameMode::SetStack(gameModes, 3);
@@ -216,7 +216,7 @@ SimpleWindow::SimpleWindow(const Rect16 &r,
}
SimpleWindow::~SimpleWindow() {
- GameMode::SetStack(prevModeStackPtr, prevModeStackCtr);
+ GameMode::SetStack(_prevModeStackPtr, _prevModeStackCtr);
}
bool SimpleWindow::isModal() {
@@ -340,7 +340,7 @@ void SimpleWindow::DrawOutlineFrame(gPort &port, const Rect16 &r, int16 fillColo
SimpleButton::SimpleButton(gWindow &win, const Rect16 &box, const char *title_, uint16 ident, AppFunc *cmd_)
: gControl(win, box, title_, ident, cmd_) {
- window = &win;
+ _window = &win;
}
void SimpleButton::deactivate() {
@@ -385,8 +385,8 @@ void SimpleButton::pointerDrag(gPanelMessage &msg) {
}
void SimpleButton::draw() {
- gDisplayPort &port = window->windowPort;
- Rect16 rect = window->getExtent();
+ gDisplayPort &port = _window->windowPort;
+ Rect16 rect = _window->getExtent();
SAVE_GPORT_STATE(port); // save pen color, etc.
g_vm->_pointer->hide(port, _extent); // hide mouse pointer
@@ -400,7 +400,7 @@ void SimpleButton::drawClipped(
gPort &port,
const Point16 &,
const Rect16 &) {
- Rect16 base = window->getExtent();
+ Rect16 base = _window->getExtent();
Rect16 box = Rect16(_extent.x + 1,
_extent.y + 1,
diff --git a/engines/saga2/msgbox.h b/engines/saga2/msgbox.h
index 014a760be31..7f5963e58ea 100644
--- a/engines/saga2/msgbox.h
+++ b/engines/saga2/msgbox.h
@@ -42,8 +42,8 @@ extern GameMode ModalMode;
class SimpleWindow : public gWindow {
- GameMode *prevModeStackPtr[Max_Modes];
- int prevModeStackCtr;
+ GameMode *_prevModeStackPtr[Max_Modes];
+ int _prevModeStackCtr;
public:
@@ -69,7 +69,7 @@ public:
};
class SimpleButton : public gControl {
- gWindow *window;
+ gWindow *_window;
public:
SimpleButton(gWindow &, const Rect16 &, const char *, uint16, AppFunc *cmd = NULL);
@@ -85,12 +85,12 @@ private:
};
class ErrorWindow : public SimpleWindow {
- static char mbChs1Text[8];
- static char mbChs2Text[8];
- static uint8 numBtns;
+ static char _mbChs1Text[8];
+ static char _mbChs2Text[8];
+ static uint8 _numBtns;
public:
- static requestInfo rInfo;
+ static requestInfo _rInfo;
ErrorWindow(const char *msg, const char *btnMsg1, const char *btnMsg2);
~ErrorWindow();
int16 getResult();
Commit: 4921ae88c269d176748cbf4012a6f75caed4f979
https://github.com/scummvm/scummvm/commit/4921ae88c269d176748cbf4012a6f75caed4f979
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:27+02:00
Commit Message:
SAGA2: Rename class variables in objects.h
Changed paths:
engines/saga2/automap.cpp
engines/saga2/mapfeatr.cpp
engines/saga2/objects.cpp
engines/saga2/objects.h
engines/saga2/spelshow.h
engines/saga2/target.cpp
engines/saga2/tile.cpp
engines/saga2/tilemode.cpp
diff --git a/engines/saga2/automap.cpp b/engines/saga2/automap.cpp
index a3747719700..cb267534df1 100644
--- a/engines/saga2/automap.cpp
+++ b/engines/saga2/automap.cpp
@@ -192,12 +192,12 @@ void AutoMap::locateRegion() {
Common::SeekableReadStream *stream;
hResContext *areaRes; // tile resource handle
int16 regionCount;
- WorldMapData *wMap = &mapList[currentWorld->mapNum];
+ WorldMapData *wMap = &mapList[currentWorld->_mapNum];
areaRes = auxResFile->newContext(MKTAG('A', 'M', 'A', 'P'), "AreaList");
assert(areaRes != nullptr);
- stream = loadResourceToStream(areaRes, MKTAG('Z', 'O', 'N', currentWorld->mapNum), "AreaList");
+ stream = loadResourceToStream(areaRes, MKTAG('Z', 'O', 'N', currentWorld->_mapNum), "AreaList");
regionCount = stream->readUint16LE();
_centerCoords = _trackPos >> (kTileUVShift + kPlatShift);
@@ -304,7 +304,7 @@ void AutoMap::pointerMove(gPanelMessage &msg) {
viewRegion.max.u = MIN<int16>(_localAreaRegion.max.u, _baseCoords.u + (int16)kSummaryDiameter) - 1;
viewRegion.min.v = MAX(_localAreaRegion.min.v, _baseCoords.v);
viewRegion.max.v = MIN<int16>(_localAreaRegion.max.v, _baseCoords.v + (int16)kSummaryDiameter) - 1;
- char *mtext = getMapFeaturesText(viewRegion, currentWorld->mapNum, _baseCoords, pos) ;
+ char *mtext = getMapFeaturesText(viewRegion, currentWorld->_mapNum, _baseCoords, pos) ;
g_vm->_mouseInfo->setText(mtext);
} else {
notify(gEventMouseMove, 0);
@@ -441,7 +441,7 @@ void AutoMap::draw() { // redraw the window
// create a summary map on the tPort gPixelMap buffer
void AutoMap::createSmallMap() {
- WorldMapData *wMap = &mapList[currentWorld->mapNum];
+ WorldMapData *wMap = &mapList[currentWorld->_mapNum];
uint16 *mapData = wMap->map->mapData;
uint16 *mapRow;
@@ -505,7 +505,7 @@ void AutoMap::createSmallMap() {
}
}
- drawMapFeatures(viewRegion, currentWorld->mapNum, _baseCoords, _tPort);
+ drawMapFeatures(viewRegion, currentWorld->_mapNum, _baseCoords, _tPort);
// if (blink)
diff --git a/engines/saga2/mapfeatr.cpp b/engines/saga2/mapfeatr.cpp
index c8c0887b34b..71eea671d6e 100644
--- a/engines/saga2/mapfeatr.cpp
+++ b/engines/saga2/mapfeatr.cpp
@@ -230,7 +230,7 @@ void initMapFeatures() {
void updateMapFeatures(int16 cWorld) {
extern WorldMapData *mapList;
extern GameWorld *currentWorld;
- WorldMapData *wMap = &mapList[currentWorld->mapNum];
+ WorldMapData *wMap = &mapList[currentWorld->_mapNum];
uint16 *mapData = wMap->map->mapData;
diff --git a/engines/saga2/objects.cpp b/engines/saga2/objects.cpp
index 2925c78c6d5..b896dfee199 100644
--- a/engines/saga2/objects.cpp
+++ b/engines/saga2/objects.cpp
@@ -471,8 +471,8 @@ ObjectID *GameObject::getHeadPtr(ObjectID parentID, TilePoint &l) {
int16 u = clamp(0, l.u / kSectorSize, sectors.u - 1),
v = clamp(0, l.v / kSectorSize, sectors.v - 1);
- return &(world->sectorArray)[
- v * world->sectorArraySize + u].childID;
+ return &(world->_sectorArray)[
+ v * world->_sectorArraySize + u]._childID;
} else return &parentObj->_data.childID;
}
@@ -1711,7 +1711,7 @@ void GameObject::dropInventoryObject(GameObject *obj, int16 count) {
assert(isWorld(_data.parentID));
int16 dist;
- int16 mapNum = getMapNum();
+ int16 _mapNum = getMapNum();
dist = _prototype->crossSection + obj->proto()->crossSection;
@@ -1730,10 +1730,10 @@ void GameObject::dropInventoryObject(GameObject *obj, int16 count) {
probeLoc = _data.location + incDirTable[dir] * dist;
probeLoc.u += g_vm->_rnd->getRandomNumber(3) - 2;
probeLoc.v += g_vm->_rnd->getRandomNumber(3) - 2;
- probeLoc.z = tileSlopeHeight(probeLoc, mapNum, obj, &sti);
+ probeLoc.z = tileSlopeHeight(probeLoc, _mapNum, obj, &sti);
// If _data.location is not blocked, drop the object
- if (checkBlocked(obj, mapNum, probeLoc) == blockageNone) {
+ if (checkBlocked(obj, _mapNum, probeLoc) == blockageNone) {
// If we're dropping the object on a TAI, make sure
// we call the correct drop function
if (sti.surfaceTAG == nullptr) {
@@ -2410,57 +2410,57 @@ GameWorld::GameWorld(int16 map) {
int16 mapSize; // Size of map in MetaTiles
mapSize = stream->readSint16LE();
- size.u = (mapSize << kPlatShift) << kTileUVShift;
- size.v = size.u;
+ _size.u = (mapSize << kPlatShift) << kTileUVShift;
+ _size.v = _size.u;
- sectorArraySize = size.u / kSectorSize;
- sectorArray = new Sector[sectorArraySize * sectorArraySize]();
+ _sectorArraySize = _size.u / kSectorSize;
+ _sectorArray = new Sector[_sectorArraySize * _sectorArraySize]();
- if (sectorArray == nullptr)
+ if (_sectorArray == nullptr)
error("Unable to allocate world %d sector array", map);
- mapNum = map;
+ _mapNum = map;
delete stream;
} else {
- size.u = size.v = 0;
- sectorArraySize = 0;
- sectorArray = nullptr;
+ _size.u = _size.v = 0;
+ _sectorArraySize = 0;
+ _sectorArray = nullptr;
- mapNum = -1;
+ _mapNum = -1;
}
}
GameWorld::GameWorld(Common::SeekableReadStream *stream) {
- size.u = size.v = stream->readSint16LE();
- mapNum = stream->readSint16LE();
+ _size.u = _size.v = stream->readSint16LE();
+ _mapNum = stream->readSint16LE();
- debugC(3, kDebugSaveload, "... size.u = size.v = %d", size.u);
- debugC(3, kDebugSaveload, "... mapNum = %d", mapNum);
+ debugC(3, kDebugSaveload, "... _size.u = _size.v = %d", _size.u);
+ debugC(3, kDebugSaveload, "... _mapNum = %d", _mapNum);
- if (size.u != 0) {
- int32 sectorArrayCount;
+ if (_size.u != 0) {
+ int32 _sectorArrayCount;
- sectorArraySize = size.u / kSectorSize;
- sectorArrayCount = sectorArraySize * sectorArraySize;
- sectorArray = new Sector[sectorArrayCount]();
+ _sectorArraySize = _size.u / kSectorSize;
+ _sectorArrayCount = _sectorArraySize * _sectorArraySize;
+ _sectorArray = new Sector[_sectorArrayCount]();
- if (sectorArray == nullptr)
- error("Unable to allocate world %d sector array", mapNum);
+ if (_sectorArray == nullptr)
+ error("Unable to allocate world %d sector array", _mapNum);
- for (int i = 0; i < sectorArrayCount; ++i) {
- sectorArray[i].read(stream);
- debugC(4, kDebugSaveload, "...... sectArray[%d].activationCount = %d", i, sectorArray[i].activationCount);
- debugC(4, kDebugSaveload, "...... sectArray[%d].childID = %d", i, sectorArray[i].childID);
+ for (int i = 0; i < _sectorArrayCount; ++i) {
+ _sectorArray[i].read(stream);
+ debugC(4, kDebugSaveload, "...... sectArray[%d].activationCount = %d", i, _sectorArray[i]._activationCount);
+ debugC(4, kDebugSaveload, "...... sectArray[%d].childID = %d", i, _sectorArray[i]._childID);
}
} else {
- sectorArraySize = 0;
- sectorArray = nullptr;
+ _sectorArraySize = 0;
+ _sectorArray = nullptr;
}
}
GameWorld::~GameWorld() {
- if (sectorArray)
- delete[] sectorArray;
+ if (_sectorArray)
+ delete[] _sectorArray;
}
//-------------------------------------------------------------------
@@ -2469,9 +2469,9 @@ GameWorld::~GameWorld() {
int32 GameWorld::archiveSize() {
int32 bytes = 0;
- bytes += sizeof(size.u)
- + sizeof(mapNum)
- + sectorArraySize * sectorArraySize * sizeof(Sector);
+ bytes += sizeof(_size.u)
+ + sizeof(_mapNum)
+ + _sectorArraySize * _sectorArraySize * sizeof(Sector);
return bytes;
}
@@ -2480,9 +2480,9 @@ int32 GameWorld::archiveSize() {
// Cleanup
void GameWorld::cleanup() {
- if (sectorArray != nullptr) {
- delete[] sectorArray;
- sectorArray = nullptr;
+ if (_sectorArray != nullptr) {
+ delete[] _sectorArray;
+ _sectorArray = nullptr;
}
}
@@ -2837,7 +2837,7 @@ void initWorlds() {
}
currentWorld = &worldList[0];
- setCurrentMap(currentWorld->mapNum);
+ setCurrentMap(currentWorld->_mapNum);
}
void saveWorlds(Common::OutSaveFile *outS) {
@@ -2850,20 +2850,20 @@ void saveWorlds(Common::OutSaveFile *outS) {
debugC(3, kDebugSaveload, "... currentWorld->thisID() = %d", currentWorld->thisID());
for (int i = 0; i < worldCount; ++i) {
- Sector *sectArray = worldList[i].sectorArray;
- int32 sectorArrayCount = worldList[i].sectorArraySize *
- worldList[i].sectorArraySize;
+ Sector *sectArray = worldList[i]._sectorArray;
+ int32 _sectorArrayCount = worldList[i]._sectorArraySize *
+ worldList[i]._sectorArraySize;
- out->writeSint16LE(worldList[i].size.u);
- out->writeSint16LE(worldList[i].mapNum);
+ out->writeSint16LE(worldList[i]._size.u);
+ out->writeSint16LE(worldList[i]._mapNum);
- debugC(3, kDebugSaveload, "... worldList[%d].size.u = %d", i, worldList[i].size.u);
- debugC(3, kDebugSaveload, "... worldList[%d].mapNum = %d", i, worldList[i].mapNum);
+ debugC(3, kDebugSaveload, "... worldList[%d]._size.u = %d", i, worldList[i]._size.u);
+ debugC(3, kDebugSaveload, "... worldList[%d]._mapNum = %d", i, worldList[i]._mapNum);
- for (int j = 0; j < sectorArrayCount; ++j) {
+ for (int j = 0; j < _sectorArrayCount; ++j) {
sectArray[j].write(out);
- debugC(4, kDebugSaveload, "...... sectArray[%d].activationCount = %d", j, sectArray[j].activationCount);
- debugC(4, kDebugSaveload, "...... sectArray[%d].childID = %d", j, sectArray[j].childID);
+ debugC(4, kDebugSaveload, "...... sectArray[%d].activationCount = %d", j, sectArray[j]._activationCount);
+ debugC(4, kDebugSaveload, "...... sectArray[%d].childID = %d", j, sectArray[j]._childID);
}
}
CHUNK_END;
@@ -2892,7 +2892,7 @@ void loadWorlds(Common::InSaveFile *in) {
// Reset the current world
currentWorld = (GameWorld *)GameObject::objectAddress(currentWorldID);
- setCurrentMap(currentWorld->mapNum);
+ setCurrentMap(currentWorld->_mapNum);
}
//-------------------------------------------------------------------
@@ -3126,8 +3126,8 @@ GameObject *getViewCenterObject() {
// Activate all actors in sector if sector is not alreay active
void Sector::activate() {
- if (activationCount++ == 0) {
- ObjectID id = childID;
+ if (_activationCount++ == 0) {
+ ObjectID id = _childID;
while (id != Nothing) {
GameObject *obj = GameObject::objectAddress(id);
@@ -3144,19 +3144,19 @@ void Sector::activate() {
// actors in sector if activation count has reached zero.
void Sector::deactivate() {
- assert(activationCount != 0);
+ assert(_activationCount != 0);
- activationCount--;
+ _activationCount--;
}
void Sector::read(Common::InSaveFile *in) {
- activationCount = in->readUint16LE();
- childID = in->readUint16LE();
+ _activationCount = in->readUint16LE();
+ _childID = in->readUint16LE();
}
void Sector::write(Common::MemoryWriteStreamDynamic *out) {
- out->writeUint16LE(activationCount);
- out->writeUint16LE(childID);
+ out->writeUint16LE(_activationCount);
+ out->writeUint16LE(_childID);
}
@@ -3168,64 +3168,64 @@ void Sector::write(Common::MemoryWriteStreamDynamic *out) {
// Update this active region
void ActiveRegion::read(Common::InSaveFile *in) {
- anchor = in->readUint16LE();
- anchorLoc.load(in);
- worldID = in->readUint16LE();
- region.read(in);
-
- debugC(4, kDebugSaveload, "... anchor = %d", anchor);
- debugC(4, kDebugSaveload, "... anchorLoc = (%d, %d, %d)", anchorLoc.u, anchorLoc.v, anchorLoc.z);
- debugC(4, kDebugSaveload, "... worldID = %d", worldID);
+ _anchor = in->readUint16LE();
+ _anchorLoc.load(in);
+ _worldID = in->readUint16LE();
+ _region.read(in);
+
+ debugC(4, kDebugSaveload, "... anchor = %d", _anchor);
+ debugC(4, kDebugSaveload, "... anchorLoc = (%d, %d, %d)", _anchorLoc.u, _anchorLoc.v, _anchorLoc.z);
+ debugC(4, kDebugSaveload, "... worldID = %d", _worldID);
debugC(4, kDebugSaveload, "... region = (min: (%d, %d, %d), max: (%d, %d, %d))",
- region.min.u, region.min.v, region.min.z, region.max.u, region.max.v, region.max.z);
+ _region.min.u, _region.min.v, _region.min.z, _region.max.u, _region.max.v, _region.max.z);
}
void ActiveRegion::write(Common::MemoryWriteStreamDynamic *out) {
- out->writeUint16LE(anchor);
- anchorLoc.write(out);
- out->writeUint16LE(worldID);
- region.write(out);
-
- debugC(4, kDebugSaveload, "... anchor = %d", anchor);
- debugC(4, kDebugSaveload, "... anchorLoc = (%d, %d, %d)", anchorLoc.u, anchorLoc.v, anchorLoc.z);
- debugC(4, kDebugSaveload, "... worldID = %d", worldID);
+ out->writeUint16LE(_anchor);
+ _anchorLoc.write(out);
+ out->writeUint16LE(_worldID);
+ _region.write(out);
+
+ debugC(4, kDebugSaveload, "... anchor = %d", _anchor);
+ debugC(4, kDebugSaveload, "... anchorLoc = (%d, %d, %d)", _anchorLoc.u, _anchorLoc.v, _anchorLoc.z);
+ debugC(4, kDebugSaveload, "... worldID = %d", _worldID);
debugC(4, kDebugSaveload, "... region = (min: (%d, %d, %d), max: (%d, %d, %d))",
- region.min.u, region.min.v, region.min.z, region.max.u, region.max.v, region.max.z);
+ _region.min.u, _region.min.v, _region.min.z, _region.max.u, _region.max.v, _region.max.z);
}
void ActiveRegion::update() {
- GameObject *obj = GameObject::objectAddress(anchor);
- GameWorld *world = (GameWorld *)GameObject::objectAddress(worldID);
+ GameObject *obj = GameObject::objectAddress(_anchor);
+ GameWorld *world = (GameWorld *)GameObject::objectAddress(_worldID);
ObjectID objWorldID = obj->world()->thisID();
// Determine if the world for this active region has changed
- if (worldID != objWorldID) {
+ if (_worldID != objWorldID) {
int16 u, v;
// Deactivate all of the old sectors
- for (u = region.min.u; u < region.max.u; u++) {
- for (v = region.min.v; v < region.max.v; v++) {
+ for (u = _region.min.u; u < _region.max.u; u++) {
+ for (v = _region.min.v; v < _region.max.v; v++) {
world->getSector(u, v)->deactivate();
}
}
// Initialize active region for new world
- worldID = objWorldID;
- world = (GameWorld *)GameObject::objectAddress(worldID);
- anchorLoc = Nowhere;
- region.min = Nowhere;
- region.max = Nowhere;
+ _worldID = objWorldID;
+ world = (GameWorld *)GameObject::objectAddress(_worldID);
+ _anchorLoc = Nowhere;
+ _region.min = Nowhere;
+ _region.max = Nowhere;
}
TilePoint loc = obj->getLocation();
// Determine if anchor has moved since the last time
- if (loc != anchorLoc) {
+ if (loc != _anchorLoc) {
TileRegion ptRegion,
newRegion;
// Update the anchor _data.location
- anchorLoc = loc;
+ _anchorLoc = loc;
// Determine the active region in points
ptRegion.min.u = loc.u - kSectorSize / 2;
@@ -3239,20 +3239,20 @@ void ActiveRegion::update() {
newRegion.max.u = (ptRegion.max.u + kSectorMask) >> kSectorShift;
newRegion.max.v = (ptRegion.max.v + kSectorMask) >> kSectorShift;
- if (region.min.u != newRegion.min.u
- || region.min.v != newRegion.min.v
- || region.max.u != newRegion.max.u
- || region.max.v != newRegion.max.v) {
+ if (_region.min.u != newRegion.min.u
+ || _region.min.v != newRegion.min.v
+ || _region.max.u != newRegion.max.u
+ || _region.max.v != newRegion.max.v) {
int16 u, v;
// Deactivate all sectors from the old region which are
// not in the new region
- for (u = region.min.u; u < region.max.u; u++) {
+ for (u = _region.min.u; u < _region.max.u; u++) {
bool uOutOfRange;
uOutOfRange = u < newRegion.min.u || u >= newRegion.max.u;
- for (v = region.min.v; v < region.max.v; v++) {
+ for (v = _region.min.v; v < _region.max.v; v++) {
if (uOutOfRange
|| v < newRegion.min.v
|| v >= newRegion.max.v) {
@@ -3270,12 +3270,12 @@ void ActiveRegion::update() {
for (u = newRegion.min.u; u < newRegion.max.u; u++) {
bool uOutOfRange;
- uOutOfRange = u < region.min.u || u >= region.max.u;
+ uOutOfRange = u < _region.min.u || u >= _region.max.u;
for (v = newRegion.min.v; v < newRegion.max.v; v++) {
if (uOutOfRange
- || v < region.min.v
- || v >= region.max.v) {
+ || v < _region.min.v
+ || v >= _region.max.v) {
if(Sector *sect = world->getSector(u, v))
sect->activate();
@@ -3286,10 +3286,10 @@ void ActiveRegion::update() {
}
// Update the region coordinates
- region.min.u = newRegion.min.u;
- region.min.v = newRegion.min.v;
- region.max.u = newRegion.max.u;
- region.max.v = newRegion.max.v;
+ _region.min.u = newRegion.min.u;
+ _region.min.v = newRegion.min.v;
+ _region.max.u = newRegion.max.u;
+ _region.max.v = newRegion.max.v;
}
}
}
@@ -3335,11 +3335,11 @@ void initActiveRegions() {
ActiveRegion *reg = &g_vm->_activeRegionList[i];
ObjectID actorID = getPlayerActorAddress(playerIDArray[i])->getActorID();
- reg->anchor = actorID;
- reg->anchorLoc = Nowhere;
- reg->worldID = Nothing;
- reg->region.min = Nowhere;
- reg->region.max = Nowhere;
+ reg->_anchor = actorID;
+ reg->_anchorLoc = Nowhere;
+ reg->_worldID = Nothing;
+ reg->_region.min = Nowhere;
+ reg->_region.max = Nowhere;
}
}
@@ -3372,12 +3372,12 @@ void loadActiveRegions(Common::InSaveFile *in) {
// Constructor
SectorRegionObjectIterator::SectorRegionObjectIterator(GameWorld *world) :
- searchWorld(world), _currentObject(nullptr) {
- assert(searchWorld != nullptr);
- assert(isWorld(searchWorld));
+ _searchWorld(world), _currentObject(nullptr) {
+ assert(_searchWorld != nullptr);
+ assert(isWorld(_searchWorld));
- minSector = TilePoint(0, 0, 0);
- maxSector = searchWorld->sectorSize();
+ _minSector = TilePoint(0, 0, 0);
+ _maxSector = _searchWorld->sectorSize();
}
//------------------------------------------------------------------------
@@ -3388,40 +3388,40 @@ ObjectID SectorRegionObjectIterator::first(GameObject **obj) {
_currentObject = nullptr;
- sectorCoords = minSector;
- currentSector = searchWorld->getSector(sectorCoords.u, sectorCoords.v);
+ _sectorCoords = _minSector;
+ currentSector = _searchWorld->getSector(_sectorCoords.u, _sectorCoords.v);
if (currentSector == nullptr)
return Nothing;
- while (currentSector->childID == Nothing) {
- if (++sectorCoords.v >= maxSector.v) {
- sectorCoords.v = minSector.v;
- if (++sectorCoords.u >= maxSector.u) {
+ while (currentSector->_childID == Nothing) {
+ if (++_sectorCoords.v >= _maxSector.v) {
+ _sectorCoords.v = _minSector.v;
+ if (++_sectorCoords.u >= _maxSector.u) {
if (obj != nullptr) *obj = nullptr;
return Nothing;
}
}
- currentSector = searchWorld->getSector(
- sectorCoords.u,
- sectorCoords.v);
+ currentSector = _searchWorld->getSector(
+ _sectorCoords.u,
+ _sectorCoords.v);
}
- _currentObject = GameObject::objectAddress(currentSector->childID);
+ _currentObject = GameObject::objectAddress(currentSector->_childID);
if (obj != nullptr) *obj = _currentObject;
- return currentSector->childID;
+ return currentSector->_childID;
}
//------------------------------------------------------------------------
// Return the next object found
ObjectID SectorRegionObjectIterator::next(GameObject **obj) {
- assert(sectorCoords.u >= minSector.u);
- assert(sectorCoords.v >= minSector.v);
- assert(sectorCoords.u < maxSector.u);
- assert(sectorCoords.v < maxSector.v);
+ assert(_sectorCoords.u >= _minSector.u);
+ assert(_sectorCoords.v >= _minSector.v);
+ assert(_sectorCoords.u < _maxSector.u);
+ assert(_sectorCoords.v < _maxSector.v);
ObjectID currentObjectID;
@@ -3431,21 +3431,21 @@ ObjectID SectorRegionObjectIterator::next(GameObject **obj) {
Sector *currentSector;
do {
- if (++sectorCoords.v >= maxSector.v) {
- sectorCoords.v = minSector.v;
- if (++sectorCoords.u >= maxSector.u) {
+ if (++_sectorCoords.v >= _maxSector.v) {
+ _sectorCoords.v = _minSector.v;
+ if (++_sectorCoords.u >= _maxSector.u) {
if (obj != nullptr) *obj = nullptr;
return Nothing;
}
}
- currentSector = searchWorld->getSector(
- sectorCoords.u,
- sectorCoords.v);
+ currentSector = _searchWorld->getSector(
+ _sectorCoords.u,
+ _sectorCoords.v);
- } while (currentSector->childID == Nothing);
+ } while (currentSector->_childID == Nothing);
- currentObjectID = currentSector->childID;
+ currentObjectID = currentSector->_childID;
}
_currentObject = GameObject::objectAddress(currentObjectID);
@@ -3500,7 +3500,7 @@ ObjectID RadialObjectIterator::first(GameObject **obj, int16 *dist) {
while (currentObjectID != Nothing
&& (currentDist =
computeDist(currentObject->getLocation()))
- > radius) {
+ > _radius) {
currentObjectID = SectorRegionObjectIterator::next(¤tObject);
}
@@ -3520,7 +3520,7 @@ ObjectID RadialObjectIterator::next(GameObject **obj, int16 *dist) {
do {
currentObjectID = SectorRegionObjectIterator::next(¤tObject);
} while (currentObjectID != Nothing
- && (currentDist = computeDist(currentObject->getLocation())) > radius);
+ && (currentDist = computeDist(currentObject->getLocation())) > _radius);
if (dist != nullptr)
*dist = currentDist;
@@ -3551,7 +3551,7 @@ ObjectID RingObjectIterator::first(GameObject **obj) {
currentObjectID = CircularObjectIterator::first(¤tObject);
while (currentObjectID != Nothing
- && computeDist(currentObject->getLocation()) < innerDist) {
+ && computeDist(currentObject->getLocation()) < _innerDist) {
currentObjectID = CircularObjectIterator::next(¤tObject);
}
@@ -3567,7 +3567,7 @@ ObjectID RingObjectIterator::next(GameObject **obj) {
do {
currentObjectID = CircularObjectIterator::next(¤tObject);
} while (currentObjectID != Nothing
- && computeDist(currentObject->getLocation()) < innerDist);
+ && computeDist(currentObject->getLocation()) < _innerDist);
if (obj != nullptr) *obj = currentObject;
return currentObjectID;
@@ -3827,7 +3827,7 @@ TilePoint CenterRegionObjectIterator::MaxCenterRegion() {
//------------------------------------------------------------------------
bool ActiveRegionObjectIterator::firstActiveRegion() {
- activeRegionIndex = -1;
+ _activeRegionIndex = -1;
return nextActiveRegion();
}
@@ -3840,22 +3840,22 @@ bool ActiveRegionObjectIterator::nextActiveRegion() {
TilePoint currentRegionSize;
do {
- if (++activeRegionIndex >= kPlayerActors)
+ if (++_activeRegionIndex >= kPlayerActors)
return false;
int16 prevRegionIndex;
- currentRegion = &g_vm->_activeRegionList[activeRegionIndex];
+ currentRegion = &g_vm->_activeRegionList[_activeRegionIndex];
- sectorBitMask = 0;
- currentRegionSize.u = currentRegion->region.max.u
- - currentRegion->region.min.u;
- currentRegionSize.v = currentRegion->region.max.v
- - currentRegion->region.min.v;
+ _sectorBitMask = 0;
+ currentRegionSize.u = currentRegion->_region.max.u
+ - currentRegion->_region.min.u;
+ currentRegionSize.v = currentRegion->_region.max.v
+ - currentRegion->_region.min.v;
currentRegionSectors = currentRegionSize.u * currentRegionSize.v;
for (prevRegionIndex = 0;
- prevRegionIndex < activeRegionIndex;
+ prevRegionIndex < _activeRegionIndex;
prevRegionIndex++) {
ActiveRegion *prevRegion;
@@ -3863,32 +3863,32 @@ bool ActiveRegionObjectIterator::nextActiveRegion() {
// Determine if the current region and the previous region
// overlap.
- if (currentRegion->worldID != prevRegion->worldID
- || prevRegion->region.min.u >= currentRegion->region.max.u
- || currentRegion->region.min.u >= prevRegion->region.max.u
- || prevRegion->region.min.v >= currentRegion->region.max.v
- || currentRegion->region.min.v >= prevRegion->region.max.v)
+ if (currentRegion->_worldID != prevRegion->_worldID
+ || prevRegion->_region.min.u >= currentRegion->_region.max.u
+ || currentRegion->_region.min.u >= prevRegion->_region.max.u
+ || prevRegion->_region.min.v >= currentRegion->_region.max.v
+ || currentRegion->_region.min.v >= prevRegion->_region.max.v)
continue;
TileRegion intersection;
int16 u, v;
intersection.min.u = MAX(
- currentRegion->region.min.u,
- prevRegion->region.min.u)
- - currentRegion->region.min.u;
+ currentRegion->_region.min.u,
+ prevRegion->_region.min.u)
+ - currentRegion->_region.min.u;
intersection.max.u = MIN(
- currentRegion->region.max.u,
- prevRegion->region.max.u)
- - currentRegion->region.min.u;
+ currentRegion->_region.max.u,
+ prevRegion->_region.max.u)
+ - currentRegion->_region.min.u;
intersection.min.v = MAX(
- currentRegion->region.min.v,
- prevRegion->region.min.v)
- - currentRegion->region.min.v;
+ currentRegion->_region.min.v,
+ prevRegion->_region.min.v)
+ - currentRegion->_region.min.v;
intersection.max.v = MIN(
- currentRegion->region.max.v,
- prevRegion->region.max.v)
- - currentRegion->region.min.v;
+ currentRegion->_region.max.v,
+ prevRegion->_region.max.v)
+ - currentRegion->_region.min.v;
for (u = intersection.min.u;
u < intersection.max.u;
@@ -3900,13 +3900,13 @@ bool ActiveRegionObjectIterator::nextActiveRegion() {
sectorBit = 1 << (u * currentRegionSize.v + v);
- if (!(sectorBitMask & sectorBit)) {
+ if (!(_sectorBitMask & sectorBit)) {
currentRegionSectors--;
assert(currentRegionSectors >= 0);
// Set the bit in the bit mask indicating that this
// sector overlaps with a previouse active region
- sectorBitMask |= sectorBit;
+ _sectorBitMask |= sectorBit;
}
}
}
@@ -3919,12 +3919,12 @@ bool ActiveRegionObjectIterator::nextActiveRegion() {
} while (currentRegionSectors == 0);
- baseSectorCoords.u = currentRegion->region.min.u;
- baseSectorCoords.v = currentRegion->region.min.v;
- size.u = currentRegionSize.u;
- size.v = currentRegionSize.v;
- currentWorld = (GameWorld *)GameObject::objectAddress(
- currentRegion->worldID);
+ _baseSectorCoords.u = currentRegion->_region.min.u;
+ _baseSectorCoords.v = currentRegion->_region.min.v;
+ _size.u = currentRegionSize.u;
+ _size.v = currentRegionSize.v;
+ _currentWorld = (GameWorld *)GameObject::objectAddress(
+ currentRegion->_worldID);
return true;
}
@@ -3935,10 +3935,10 @@ bool ActiveRegionObjectIterator::firstSector() {
if (!firstActiveRegion())
return false;
- sectorCoords.u = baseSectorCoords.u;
- sectorCoords.v = baseSectorCoords.v;
+ _sectorCoords.u = _baseSectorCoords.u;
+ _sectorCoords.v = _baseSectorCoords.v;
- if (sectorBitMask & 1) {
+ if (_sectorBitMask & 1) {
if (!nextSector())
return false;
}
@@ -3952,23 +3952,23 @@ bool ActiveRegionObjectIterator::nextSector() {
int16 u, v;
do {
- sectorCoords.v++;
+ _sectorCoords.v++;
- if (sectorCoords.v >= baseSectorCoords.v + size.v) {
- sectorCoords.v = baseSectorCoords.v;
- sectorCoords.u++;
+ if (_sectorCoords.v >= _baseSectorCoords.v + _size.v) {
+ _sectorCoords.v = _baseSectorCoords.v;
+ _sectorCoords.u++;
- if (sectorCoords.u >= baseSectorCoords.u + size.u) {
+ if (_sectorCoords.u >= _baseSectorCoords.u + _size.u) {
if (!nextActiveRegion()) return false;
- sectorCoords.u = baseSectorCoords.u;
- sectorCoords.v = baseSectorCoords.v;
+ _sectorCoords.u = _baseSectorCoords.u;
+ _sectorCoords.v = _baseSectorCoords.v;
}
}
- u = sectorCoords.u - baseSectorCoords.u;
- v = sectorCoords.v - baseSectorCoords.v;
- } while (sectorBitMask & (1 << (u * size.v + v)));
+ u = _sectorCoords.u - _baseSectorCoords.u;
+ v = _sectorCoords.v - _baseSectorCoords.v;
+ } while (_sectorBitMask & (1 << (u * _size.v + v)));
return true;
}
@@ -3984,13 +3984,13 @@ ObjectID ActiveRegionObjectIterator::first(GameObject **obj) {
if (firstSector()) {
Sector *currentSector;
- currentSector = currentWorld->getSector(
- sectorCoords.u,
- sectorCoords.v);
+ currentSector = _currentWorld->getSector(
+ _sectorCoords.u,
+ _sectorCoords.v);
assert(currentSector != nullptr);
- currentObjectID = currentSector->childID;
+ currentObjectID = currentSector->_childID;
_currentObject = currentObjectID != Nothing
? GameObject::objectAddress(currentObjectID)
: nullptr;
@@ -3998,13 +3998,13 @@ ObjectID ActiveRegionObjectIterator::first(GameObject **obj) {
while (currentObjectID == Nothing) {
if (!nextSector()) break;
- currentSector = currentWorld->getSector(
- sectorCoords.u,
- sectorCoords.v);
+ currentSector = _currentWorld->getSector(
+ _sectorCoords.u,
+ _sectorCoords.v);
assert(currentSector != nullptr);
- currentObjectID = currentSector->childID;
+ currentObjectID = currentSector->_childID;
_currentObject = currentObjectID != Nothing
? GameObject::objectAddress(currentObjectID)
: nullptr;
@@ -4019,8 +4019,8 @@ ObjectID ActiveRegionObjectIterator::first(GameObject **obj) {
// Return the next object within the specified region
ObjectID ActiveRegionObjectIterator::next(GameObject **obj) {
- assert(activeRegionIndex >= 0);
- assert(activeRegionIndex < kPlayerActors);
+ assert(_activeRegionIndex >= 0);
+ assert(_activeRegionIndex < kPlayerActors);
ObjectID currentObjectID;
@@ -4034,13 +4034,13 @@ ObjectID ActiveRegionObjectIterator::next(GameObject **obj) {
if (!nextSector()) break;
- currentSector = currentWorld->getSector(
- sectorCoords.u,
- sectorCoords.v);
+ currentSector = _currentWorld->getSector(
+ _sectorCoords.u,
+ _sectorCoords.v);
assert(currentSector != nullptr);
- currentObjectID = currentSector->childID;
+ currentObjectID = currentSector->_childID;
_currentObject = currentObjectID != Nothing
? GameObject::objectAddress(currentObjectID)
: nullptr;
@@ -4058,19 +4058,19 @@ ObjectID ActiveRegionObjectIterator::next(GameObject **obj) {
ContainerIterator::ContainerIterator(GameObject *container) {
// Get the ID of the 1st object in the sector list
- nextID = container->_data.childID;
- object = nullptr;
+ _nextID = container->_data.childID;
+ _object = nullptr;
}
ObjectID ContainerIterator::next(GameObject **obj) {
- ObjectID id = nextID;
+ ObjectID id = _nextID;
if (id == Nothing) return Nothing;
- object = GameObject::objectAddress(id);
- nextID = object->_data.siblingID;
+ _object = GameObject::objectAddress(id);
+ _nextID = _object->_data.siblingID;
- if (obj) *obj = object;
+ if (obj) *obj = _object;
return id;
}
@@ -4135,44 +4135,44 @@ ObjectID RecursiveContainerIterator::next(GameObject **obj) {
// This class iterates through every object within a container
ObjectID RecursiveContainerIterator::first(GameObject **obj) {
- GameObject *rootObj = GameObject::objectAddress(root);
+ GameObject *rootObj = GameObject::objectAddress(_root);
- id = rootObj->IDChild();
+ _id = rootObj->IDChild();
if (obj != nullptr)
- *obj = id != Nothing ? GameObject::objectAddress(id) : nullptr;
+ *obj = _id != Nothing ? GameObject::objectAddress(_id) : nullptr;
- return id;
+ return _id;
}
ObjectID RecursiveContainerIterator::next(GameObject **obj) {
- GameObject *currentObj = GameObject::objectAddress(id);
+ GameObject *currentObj = GameObject::objectAddress(_id);
// If this object has a child, then the next object (id) is the child.
// If it has no child, then check for sibling.
- if ((id = currentObj->IDChild()) == 0) {
+ if ((_id = currentObj->IDChild()) == 0) {
// If this object has a sibling, then the next object (id) is the sibling.
// If it has no sibling, then check for parent.
- while ((id = currentObj->IDNext()) == 0) {
+ while ((_id = currentObj->IDNext()) == 0) {
// If this object has a parent, then the get the parent.
- if ((id = currentObj->IDParent()) != 0) {
+ if ((_id = currentObj->IDParent()) != 0) {
// If the parent is the root, then we're done.
- if (id == Nothing || id == root) return 0;
+ if (_id == Nothing || _id == _root) return 0;
// Set the current object to the parent, and then
// Go around the loop once again and get the sibling of the parent.
// The loop will keep going up until we either find an object that
// has a sibling, or we hit the original root object.
- currentObj = GameObject::objectAddress(id);
+ currentObj = GameObject::objectAddress(_id);
}
}
}
if (obj != nullptr)
- *obj = id != Nothing ? GameObject::objectAddress(id) : nullptr;
+ *obj = _id != Nothing ? GameObject::objectAddress(_id) : nullptr;
- return id;
+ return _id;
}
/* ======================================================================= *
@@ -4257,7 +4257,7 @@ bool lineOfSight(GameObject *obj1, GameObject *obj2, uint32 terrainMask) {
obj2Loc.z += obj2proto->height * 7 / 8;
return (lineTerrain(
- world->mapNum,
+ world->_mapNum,
obj1Loc,
obj2Loc,
opaqueTerrain)
@@ -4278,7 +4278,7 @@ bool lineOfSight(GameObject *obj, const TilePoint &loc, uint32 terrainMask) {
objLoc.z += proto->height * 7 / 8;
return (lineTerrain(
- world->mapNum,
+ world->_mapNum,
objLoc,
loc,
opaqueTerrain)
@@ -4299,7 +4299,7 @@ bool lineOfSight(
uint32 opaqueTerrain = ~terrainMask;
return (lineTerrain(
- world->mapNum,
+ world->_mapNum,
loc1,
loc2,
opaqueTerrain)
diff --git a/engines/saga2/objects.h b/engines/saga2/objects.h
index 95ecd93ce62..11a1cf4cdb1 100644
--- a/engines/saga2/objects.h
+++ b/engines/saga2/objects.h
@@ -736,16 +736,16 @@ public:
class Sector {
public:
- uint16 activationCount;
- ObjectID childID;
+ uint16 _activationCount;
+ ObjectID _childID;
Sector() :
- activationCount(0),
- childID(Nothing) {
+ _activationCount(0),
+ _childID(Nothing) {
}
bool isActivated() {
- return activationCount != 0;
+ return _activationCount != 0;
}
void activate();
@@ -776,13 +776,13 @@ class GameWorld : public GameObject {
friend class ObjectIterator;
public:
- TilePoint size; // size of world in U/V coords
- int16 sectorArraySize; // size of sector array
- Sector *sectorArray; // array of sectors
- int16 mapNum; // map number for this world.
+ TilePoint _size; // size of world in U/V coords
+ int16 _sectorArraySize; // size of sector array
+ Sector *_sectorArray; // array of sectors
+ int16 _mapNum; // map number for this world.
// Default constructor
- GameWorld() : sectorArraySize(0), sectorArray(nullptr), mapNum(0) {}
+ GameWorld() : _sectorArraySize(0), _sectorArray(nullptr), _mapNum(0) {}
// Initial constructor
GameWorld(int16 map);
@@ -799,22 +799,22 @@ public:
if (u == -1 && v == -1)
return nullptr;
- if (v * sectorArraySize + u >= sectorArraySize * sectorArraySize ||
- v * sectorArraySize + u < 0) {
- warning("Sector::getSector: Invalid sector: (%d, %d) (sectorArraySize = %d)", u, v, sectorArraySize);
+ if (v * _sectorArraySize + u >= _sectorArraySize * _sectorArraySize ||
+ v * _sectorArraySize + u < 0) {
+ warning("Sector::getSector: Invalid sector: (%d, %d) (sectorArraySize = %d)", u, v, _sectorArraySize);
return nullptr;
}
- return &(sectorArray)[v * sectorArraySize + u];
+ return &(_sectorArray)[v * _sectorArraySize + u];
}
TilePoint sectorSize() { // size of map in sectors
- return TilePoint(sectorArraySize, sectorArraySize, 0);
+ return TilePoint(_sectorArraySize, _sectorArraySize, 0);
}
static uint32 IDtoMapNum(ObjectID id) {
assert(isWorld(id));
- return ((GameWorld *)GameObject::objectAddress(id))->mapNum;
+ return ((GameWorld *)GameObject::objectAddress(id))->_mapNum;
}
};
@@ -831,12 +831,12 @@ extern GameWorld *currentWorld;
inline int16 GameObject::getMapNum() {
if (world())
- return world()->mapNum;
+ return world()->_mapNum;
else if (_data.siblingID) {
GameObject *sibling = GameObject::objectAddress(_data.siblingID);
return sibling->getMapNum();
} else
- return currentWorld->mapNum;
+ return currentWorld->_mapNum;
}
/* ======================================================================= *
@@ -861,10 +861,10 @@ class ActiveRegion {
friend class ActiveRegionObjectIterator;
- ObjectID anchor; // ID of object this region is attached to
- TilePoint anchorLoc; // Location of anchor
- ObjectID worldID;
- TileRegion region; // Region coords ( in sectors )
+ ObjectID _anchor; // ID of object this region is attached to
+ TilePoint _anchorLoc; // Location of anchor
+ ObjectID _worldID;
+ TileRegion _region; // Region coords ( in sectors )
public:
@@ -872,7 +872,7 @@ public:
kActiveRegionSize = 22
};
- ActiveRegion() : anchor(0), worldID(0) {}
+ ActiveRegion() : _anchor(0), _worldID(0) {}
void update();
void read(Common::InSaveFile *in);
@@ -882,10 +882,10 @@ public:
TileRegion getRegion() {
TileRegion tReg;
- tReg.min.u = region.min.u << kSectorShift;
- tReg.min.v = region.min.v << kSectorShift;
- tReg.max.u = region.max.u << kSectorShift;
- tReg.max.v = region.max.v << kSectorShift;
+ tReg.min.u = _region.min.u << kSectorShift;
+ tReg.min.v = _region.min.v << kSectorShift;
+ tReg.max.u = _region.max.u << kSectorShift;
+ tReg.max.v = _region.max.v << kSectorShift;
tReg.min.z = tReg.max.z = 0;
return tReg;
@@ -893,7 +893,7 @@ public:
// Return the region world
GameWorld *getWorld() {
- return (GameWorld *)GameObject::objectAddress(worldID);
+ return (GameWorld *)GameObject::objectAddress(_worldID);
}
};
@@ -933,10 +933,10 @@ public:
class SectorRegionObjectIterator : public ObjectIterator {
- TilePoint minSector,
- maxSector,
- sectorCoords;
- GameWorld *searchWorld;
+ TilePoint _minSector,
+ _maxSector,
+ _sectorCoords;
+ GameWorld *_searchWorld;
GameObject *_currentObject;
public:
@@ -947,17 +947,17 @@ public:
SectorRegionObjectIterator(
GameWorld *world,
const TileRegion §orRegion) :
- searchWorld(world),
- minSector(sectorRegion.min),
- maxSector(sectorRegion.max),
+ _searchWorld(world),
+ _minSector(sectorRegion.min),
+ _maxSector(sectorRegion.max),
_currentObject(nullptr) {
- assert(searchWorld != NULL);
- assert(isWorld(searchWorld));
+ assert(_searchWorld != NULL);
+ assert(isWorld(_searchWorld));
}
protected:
GameWorld *getSearchWorld() {
- return searchWorld;
+ return _searchWorld;
}
public:
@@ -976,8 +976,8 @@ public:
class RadialObjectIterator : public SectorRegionObjectIterator {
private:
- TilePoint center;
- int16 radius;
+ TilePoint _center;
+ int16 _radius;
// Compute the region of sectors to pass to the ObjectIterator
// constructor
@@ -994,7 +994,7 @@ protected:
// Simply return the center coordinates
TilePoint getCenter() {
- return center;
+ return _center;
}
public:
@@ -1010,8 +1010,8 @@ public:
world->sectorSize(),
searchCenter,
distance)),
- center(searchCenter),
- radius(distance) {
+ _center(searchCenter),
+ _radius(distance) {
}
// Return the first object found
@@ -1060,7 +1060,7 @@ public:
class RingObjectIterator : public CircularObjectIterator {
private:
- int16 innerDist;
+ int16 _innerDist;
public:
// Constructor
@@ -1070,7 +1070,7 @@ public:
int16 outerDistance,
int16 innerDistance) :
CircularObjectIterator(world, searchCenter, outerDistance) {
- innerDist = innerDistance;
+ _innerDist = innerDistance;
}
ObjectID first(GameObject **obj);
@@ -1222,12 +1222,12 @@ public:
class ActiveRegionObjectIterator : public ObjectIterator {
- int16 activeRegionIndex;
- TilePoint baseSectorCoords,
- size,
- sectorCoords;
- uint8 sectorBitMask;
- GameWorld *currentWorld;
+ int16 _activeRegionIndex;
+ TilePoint _baseSectorCoords,
+ _size,
+ _sectorCoords;
+ uint8 _sectorBitMask;
+ GameWorld *_currentWorld;
GameObject *_currentObject;
bool firstActiveRegion();
@@ -1237,7 +1237,7 @@ class ActiveRegionObjectIterator : public ObjectIterator {
public:
// Constructor
- ActiveRegionObjectIterator() : activeRegionIndex(-1), sectorBitMask(0), currentWorld(nullptr), _currentObject(nullptr) {}
+ ActiveRegionObjectIterator() : _activeRegionIndex(-1), _sectorBitMask(0), _currentWorld(nullptr), _currentObject(nullptr) {}
// Iteration functions
ObjectID first(GameObject **obj);
@@ -1251,10 +1251,10 @@ public:
// This class iterates through every object within a container
class ContainerIterator {
- ObjectID nextID;
+ ObjectID _nextID;
public:
- GameObject *object;
+ GameObject *_object;
// Constructor
ContainerIterator(GameObject *container);
@@ -1270,41 +1270,20 @@ public:
// This class iterates through every object within a container and
// all of the containers within the container
-#if 0
class RecursiveContainerIterator {
- ObjectID id;
- RecursiveContainerIterator *subIter;
+ ObjectID _id,
+ _root;
public:
// Constructor
RecursiveContainerIterator(GameObject *container) :
- id(container->IDChild()),
- subIter(NULL) {
- }
- ~RecursiveContainerIterator();
-
- // Iteration functions
- ObjectID first(GameObject **obj);
- ObjectID next(GameObject **obj);
-};
-#else
-
-class RecursiveContainerIterator {
- ObjectID id,
- root;
-
-public:
- // Constructor
- RecursiveContainerIterator(GameObject *container) :
- root(container->thisID()), id(0) {}
+ _root(container->thisID()), _id(0) {}
// Iteration functions
ObjectID first(GameObject **obj);
ObjectID next(GameObject **obj);
};
-#endif
-
/* ============================================================================ *
Object sound effect struct
* ============================================================================ */
diff --git a/engines/saga2/spelshow.h b/engines/saga2/spelshow.h
index f31dfcecbdb..78d53534be0 100644
--- a/engines/saga2/spelshow.h
+++ b/engines/saga2/spelshow.h
@@ -366,7 +366,7 @@ inline GameWorld *Effectron::world() const {
return parent->world;
}
inline int16 Effectron::getMapNum() const {
- return parent->world->mapNum;
+ return parent->world->_mapNum;
}
inline EffectID Effectron::spellID() {
diff --git a/engines/saga2/target.cpp b/engines/saga2/target.cpp
index e20e987b238..6d29457bb35 100644
--- a/engines/saga2/target.cpp
+++ b/engines/saga2/target.cpp
@@ -236,7 +236,7 @@ TilePoint TileTarget::where(GameWorld *world, const TilePoint &tp) const {
tileReg.max.v = (tp.v + maxTileDist - 1 + kTileUVMask)
>> kTileUVShift;
- TileIterator tIter(world->mapNum, tileReg);
+ TileIterator tIter(world->_mapNum, tileReg);
// Get the first tile in tile region
ti = tIter.first(&tileCoords, &sti);
@@ -291,7 +291,7 @@ int16 TileTarget::where(
tileReg.max.v = (tp.v + maxTileDist - 1 + kTileUVMask)
>> kTileUVShift;
- TileIterator tIter(world->mapNum, tileReg);
+ TileIterator tIter(world->_mapNum, tileReg);
// Get the first tile in tile region
ti = tIter.first(&tileCoords, &sti);
@@ -468,12 +468,12 @@ TilePoint MetaTileTarget::where(
tileReg.max.v = (tp.v + maxMetaDist + kTileUVMask)
>> kTileUVShift;
- MetaTileIterator mIter(world->mapNum, tileReg);
+ MetaTileIterator mIter(world->_mapNum, tileReg);
// get the first metatile in region
mt = mIter.first(&metaCoords);
while (mt != nullptr) {
- if (isTarget(mt, world->mapNum, metaCoords)) {
+ if (isTarget(mt, world->_mapNum, metaCoords)) {
uint16 dist;
metaCoords.u <<= kTileUVShift;
@@ -522,12 +522,12 @@ int16 MetaTileTarget::where(
tileReg.max.v = (tp.v + maxMetaDist + kTileUVMask)
>> kTileUVShift;
- MetaTileIterator mIter(world->mapNum, tileReg);
+ MetaTileIterator mIter(world->_mapNum, tileReg);
// Get the first metatile in tile region
mt = mIter.first(&metaCoords);
while (mt != nullptr) {
- if (isTarget(mt, world->mapNum, metaCoords)) {
+ if (isTarget(mt, world->_mapNum, metaCoords)) {
uint16 dist;
metaCoords.u <<= kTileUVShift;
diff --git a/engines/saga2/tile.cpp b/engines/saga2/tile.cpp
index c21b07c8e46..723fd1889e5 100644
--- a/engines/saga2/tile.cpp
+++ b/engines/saga2/tile.cpp
@@ -4317,7 +4317,7 @@ void updateMainDisplay() {
if (viewWorld != currentWorld) {
currentWorld = viewWorld;
- setCurrentMap(currentWorld->mapNum);
+ setCurrentMap(currentWorld->_mapNum);
}
WorldMapData *curMap = &mapList[g_vm->_currentMapNum];
diff --git a/engines/saga2/tilemode.cpp b/engines/saga2/tilemode.cpp
index 95152a45706..f66191204e2 100644
--- a/engines/saga2/tilemode.cpp
+++ b/engines/saga2/tilemode.cpp
@@ -655,7 +655,7 @@ void TileModeSetup() {
lastUpdateTime = gameTime;
setCurrentWorld(WorldBaseID);
- setCurrentMap(currentWorld->mapNum);
+ setCurrentMap(currentWorld->_mapNum);
}
//-----------------------------------------------------------------------
Commit: 9834c6e32147be56e7875c2e7add985801f1a368
https://github.com/scummvm/scummvm/commit/9834c6e32147be56e7875c2e7add985801f1a368
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:27+02:00
Commit Message:
SAGA2: Rename class variables in objproto.h
Changed paths:
engines/saga2/actor.cpp
engines/saga2/audio.cpp
engines/saga2/beegee.cpp
engines/saga2/grabinfo.cpp
engines/saga2/motion.cpp
engines/saga2/objects.cpp
engines/saga2/objproto.cpp
engines/saga2/objproto.h
engines/saga2/player.cpp
engines/saga2/sagafunc.cpp
diff --git a/engines/saga2/actor.cpp b/engines/saga2/actor.cpp
index dc9c29fc6c7..644f9082be9 100644
--- a/engines/saga2/actor.cpp
+++ b/engines/saga2/actor.cpp
@@ -638,7 +638,7 @@ bool ActorProto::acceptInsertionAtAction(
}
// Determine if this object is simply being moved within this actor
- if (oldLoc.context == dObj) {
+ if (oldLoc._context == dObj) {
// Determine if and where the object is in use by this actor
if (a->_leftHandObject == item)
inUseType = heldInLeftHand;
diff --git a/engines/saga2/audio.cpp b/engines/saga2/audio.cpp
index b2a03ceeb77..7539b980c9c 100644
--- a/engines/saga2/audio.cpp
+++ b/engines/saga2/audio.cpp
@@ -265,7 +265,7 @@ Point32 translateLocation(Location playAt) {
GameObject *go = getViewCenterObject();
Location cal = Location(go->getWorldLocation(), go->IDParent());
- if (playAt.context == cal.context) {
+ if (playAt._context == cal._context) {
Point32 p = Point32(playAt.u - cal.u, playAt.v - cal.v);
return p;
}
diff --git a/engines/saga2/beegee.cpp b/engines/saga2/beegee.cpp
index 97c2eeb4ee9..96bbd78773c 100644
--- a/engines/saga2/beegee.cpp
+++ b/engines/saga2/beegee.cpp
@@ -237,7 +237,7 @@ void setAreaSound(const TilePoint &) {
for (i = 0; i < AUXTHEMES; i++) {
if (g_vm->_grandMasterFTA->_aats[i].active) {
Location loc = getCenterActor()->notGetWorldLocation();
- if (g_vm->_grandMasterFTA->_aats[i].l.context == Nothing || loc.context == g_vm->_grandMasterFTA->_aats[i].l.context) {
+ if (g_vm->_grandMasterFTA->_aats[i].l._context == Nothing || loc._context == g_vm->_grandMasterFTA->_aats[i].l._context) {
TilePoint tp = (g_vm->_grandMasterFTA->_aats[i].l >> kTileUVShift) - baseCoords;
if (tp.magnitude() < dist.magnitude()) {
dist = tp;
diff --git a/engines/saga2/grabinfo.cpp b/engines/saga2/grabinfo.cpp
index 197331acb61..9d262a4ca0d 100644
--- a/engines/saga2/grabinfo.cpp
+++ b/engines/saga2/grabinfo.cpp
@@ -97,7 +97,7 @@ void GrabInfo::grabObject(GameObject *obj, Intent in, int16 count) {
// get the original location
_from = _grabObj->getLocation();
- _from.context = _grabObj->IDParent();
+ _from._context = _grabObj->IDParent();
// de-link the object
_grabObj->move(Location(Nowhere, Nothing));
@@ -139,7 +139,7 @@ void GrabInfo::copyObject(GameObject *obj, Intent in, int16 count) {
setMoveCount(count);
_from = Nowhere;
- _from.context = Nothing;
+ _from._context = Nothing;
setIcon();
setIntent(in);
diff --git a/engines/saga2/motion.cpp b/engines/saga2/motion.cpp
index 31e138d545d..fa5026945d2 100644
--- a/engines/saga2/motion.cpp
+++ b/engines/saga2/motion.cpp
@@ -4364,7 +4364,7 @@ void MotionTask::updatePositions() {
case motionTypeDropObject:
- if (isWorld(mt->_targetLoc.context)) {
+ if (isWorld(mt->_targetLoc._context)) {
if (mt->_flags & reset) {
mt->_direction = (mt->_targetLoc - a->getLocation()).quickDir();
mt->_flags &= ~reset;
diff --git a/engines/saga2/objects.cpp b/engines/saga2/objects.cpp
index b896dfee199..9219fd1dc70 100644
--- a/engines/saga2/objects.cpp
+++ b/engines/saga2/objects.cpp
@@ -87,7 +87,7 @@ ObjectID viewCenterObject; // ID of object that view tracks
hResContext *listRes; // object list resource handle
extern hResContext *tileRes;
-uint8 *ProtoObj::nextAvailObj;
+uint8 *ProtoObj::_nextAvailObj;
// trio ready container consts
@@ -571,11 +571,11 @@ bool GameObject::getWorldLocation(Location &loc) {
if (isWorld(id)) {
loc = obj->_data.location;
loc.z += (obj->_prototype->height - objHeight) / 2;
- loc.context = id;
+ loc._context = id;
return true;
} else if (id == Nothing) {
loc = Nowhere;
- loc.context = Nothing;
+ loc._context = Nothing;
return false;
}
@@ -832,13 +832,13 @@ bool GameObject::unstack() {
// Move the object to a new _data.location, and change context if needed.
void GameObject::setLocation(const Location &l) {
- if (l.context != _data.parentID) {
+ if (l._context != _data.parentID) {
unstack(); // if it's in a stack, unstack it.
remove(); // remove from old list
_data.location = (TilePoint)l; // change _data.location
- append(l.context); // append to new list
- } else if (isWorld(l.context)) {
- GameWorld *world = (GameWorld *)objectAddress(l.context);
+ append(l._context); // append to new list
+ } else if (isWorld(l._context)) {
+ GameWorld *world = (GameWorld *)objectAddress(l._context);
TilePoint sectors = world->sectorSize();
int16 u0 = clamp(0, _data.location.u / kSectorSize, sectors.u - 1),
@@ -849,7 +849,7 @@ void GameObject::setLocation(const Location &l) {
if (u0 != u1 || v0 != v1) { // If sector changed
remove(); // Remove from old list
_data.location = (TilePoint)l; // Set object coords
- append(l.context); // append to appropriate list
+ append(l._context); // append to appropriate list
} else {
_data.location = (TilePoint)l; // Set object coords
}
diff --git a/engines/saga2/objproto.cpp b/engines/saga2/objproto.cpp
index 613af2a1b1d..b79f7388743 100644
--- a/engines/saga2/objproto.cpp
+++ b/engines/saga2/objproto.cpp
@@ -188,7 +188,7 @@ bool ProtoObj::useOnAction(ObjectID dObj, ObjectID enactor, ActiveItem *item) {
// UseOn location command
bool ProtoObj::useOn(ObjectID dObj, ObjectID enactor, const Location &loc) {
assert(dObj != Nothing);
- assert(loc != Nowhere && loc.context != Nothing);
+ assert(loc != Nowhere && loc._context != Nothing);
/* int16 scrResult;
@@ -344,7 +344,7 @@ bool ProtoObj::drop(ObjectID dObj, ObjectID enactor, const Location &loc, int16
scf.invokedObject = dObj;
scf.enactor = enactor;
scf.directObject = dObj;
- scf.indirectObject = loc.context;
+ scf.indirectObject = loc._context;
scf.coords = loc;
scf.value = 0;
@@ -412,7 +412,7 @@ bool ProtoObj::dropOn(
int16 num) {
assert(dObj != Nothing);
assert(target != nullptr);
- assert(isWorld(loc.context));
+ assert(isWorld(loc._context));
return dropOnAction(dObj, enactor, target, loc, num);
}
@@ -1019,14 +1019,14 @@ bool InventoryProto::canDropAt(
assert(enactor != Nothing);
// If we're not dropping it onto a world, we're okay
- if (!isWorld(loc.context)) return true;
+ if (!isWorld(loc._context)) return true;
GameObject *enactorPtr = GameObject::objectAddress(enactor);
// If we're trying to drop it into a different world or if
// we're dropping it more than 4 metatile widths away from the
// enactor, fail
- if (enactorPtr->IDParent() != loc.context
+ if (enactorPtr->IDParent() != loc._context
|| (loc - enactorPtr->getLocation()).quickHDistance()
> kTileUVSize * kPlatformWidth * 4)
return false;
@@ -1039,7 +1039,7 @@ bool InventoryProto::dropAction(
ObjectID enactor,
const Location &loc,
int16 num) {
- assert(loc.context != Nothing);
+ assert(loc._context != Nothing);
assert(dObj != Nothing);
assert(enactor != Nothing);
@@ -1047,7 +1047,7 @@ bool InventoryProto::dropAction(
Actor *enactorPtr = (Actor *)GameObject::objectAddress(enactor);
/* // Determine if we're dropping an object from the actor's hands.
- if ( enactor != loc.context )
+ if ( enactor != loc._context )
{
if ( dObj == enactorPtr->rightHandObject )
enactorPtr->rightHandObject = Nothing;
@@ -1062,7 +1062,7 @@ bool InventoryProto::dropAction(
dObjPtr->_data.currentTAG = NoActiveItem;
}
- if (isWorld(loc.context)) {
+ if (isWorld(loc._context)) {
ProtoObj *enactorProto = enactorPtr->proto();
TilePoint enactorLoc(enactorPtr->getLocation());
TilePoint vector = loc - enactorLoc;
@@ -1116,7 +1116,7 @@ bool InventoryProto::dropAction(
return false;
}
- dObjPtr->move(Location(startPt, loc.context));
+ dObjPtr->move(Location(startPt, loc._context));
// Make sure the game engine knows that it may scavenge this
// object if necessary
@@ -1126,7 +1126,7 @@ bool InventoryProto::dropAction(
MotionTask::throwObjectTo(*dObjPtr, loc);
}
} else {
- GameObject *targetObj = GameObject::objectAddress(loc.context);
+ GameObject *targetObj = GameObject::objectAddress(loc._context);
return targetObj->acceptInsertionAt(enactor, dObj, loc, num);
}
@@ -1142,7 +1142,7 @@ bool InventoryProto::dropOnAction(
int16 num) {
assert(dObj != Nothing);
assert(target != nullptr);
- assert(isWorld(loc.context));
+ assert(isWorld(loc._context));
if (drop(dObj, enactor, loc, num)) {
GameObject *dObjPtr = GameObject::objectAddress(dObj);
@@ -2501,7 +2501,7 @@ bool IntangibleObjProto::canDropAt(
ObjectID,
const Location &loc) {
// We can try dropping this object anywhere, except within a world
- return !isWorld(loc.context);
+ return !isWorld(loc._context);
}
bool IntangibleObjProto::dropAction(
@@ -2510,10 +2510,10 @@ bool IntangibleObjProto::dropAction(
const Location &loc,
int16) {
assert(isObject(dObj));
- assert(loc.context != Nothing);
- assert(!isWorld(loc.context));
+ assert(loc._context != Nothing);
+ assert(!isWorld(loc._context));
- GameObject *container = GameObject::objectAddress(loc.context);
+ GameObject *container = GameObject::objectAddress(loc._context);
if (container->canContain(dObj)) {
GameObject *dObjPtr = GameObject::objectAddress(dObj);
@@ -2666,7 +2666,7 @@ bool SkillProto::canDropAt(ObjectID, ObjectID, const Location &) {
bool SkillProto::dropAction(ObjectID dObj, ObjectID enactor, const Location &loc, int16 num) {
assert(isActor(enactor));
- if (isWorld(loc.context)) {
+ if (isWorld(loc._context)) {
Actor *enactorPtr = (Actor *)GameObject::objectAddress(enactor);
if (validTarget(enactorPtr, nullptr, nullptr, this))
@@ -2822,7 +2822,7 @@ void EncounterGeneratorProto::doBackgroundUpdate(GameObject *obj) {
a->getWorldLocation(actorLoc);
// If actor is in the same world as the generator
- if (actorLoc.context == generatorLoc.context) {
+ if (actorLoc._context == generatorLoc._context) {
int32 dist,
mtRadius = obj->getHitPoints(),// Radius in metatiles
ptRadius = mtRadius * kTileUVSize * kPlatformWidth,
diff --git a/engines/saga2/objproto.h b/engines/saga2/objproto.h
index cf376f5e2ab..e3bc5fe03b8 100644
--- a/engines/saga2/objproto.h
+++ b/engines/saga2/objproto.h
@@ -106,7 +106,7 @@ class Location : public TilePoint {
public:
// context = the ObjectID of containing context
// (either a container or a world).
- ObjectID context;
+ ObjectID _context;
/*
// Member functions to translate world coords into
@@ -126,27 +126,27 @@ public:
return *this;
}
- Location() : context(0) {}
+ Location() : _context(0) {}
Location(int16 nu, int16 nv, int16 nz, ObjectID con) {
u = nu;
v = nv;
z = nz;
- context = con;
+ _context = con;
}
Location(TilePoint p, ObjectID con = 0) {
u = p.u;
v = p.v;
z = p.z;
- context = con;
+ _context = con;
}
Location(StaticLocation l) {
u = l.tile.u;
v = l.tile.v;
z = l.tile.z;
- context = l.context;
+ _context = l.context;
}
};
@@ -370,7 +370,7 @@ struct ResourceObjectPrototype {
class ProtoObj : public ResourceObjectPrototype {
- static uint8 *nextAvailObj;
+ static uint8 *_nextAvailObj;
// container defines
diff --git a/engines/saga2/player.cpp b/engines/saga2/player.cpp
index dec66547946..ed563b381ab 100644
--- a/engines/saga2/player.cpp
+++ b/engines/saga2/player.cpp
@@ -806,7 +806,7 @@ void handlePlayerActorDeath(PlayerActorID id) {
// to the center actor
void transportCenterBand(const Location &loc) {
- assert(isWorld(loc.context));
+ assert(isWorld(loc._context));
fadeDown();
@@ -836,14 +836,14 @@ void transportCenterBand(const Location &loc) {
TilePoint dest;
dest = selectNearbySite(
- loc.context,
+ loc._context,
loc,
1,
3,
false);
if (dest != Nowhere) {
- a->move(Location(dest, loc.context));
+ a->move(Location(dest, loc._context));
if (a->_moveTask != nullptr)
a->_moveTask->finishWalk();
player->resolveBanding();
diff --git a/engines/saga2/sagafunc.cpp b/engines/saga2/sagafunc.cpp
index 132906bac6d..a409a9f6b30 100644
--- a/engines/saga2/sagafunc.cpp
+++ b/engines/saga2/sagafunc.cpp
@@ -201,7 +201,7 @@ int16 scriptActorMoveRel(int16 *args) {
Location l;
TilePoint tp;
- l.context = baseObj->IDParent();
+ l._context = baseObj->IDParent();
tp = baseObj->getLocation();
// Add offset for angle and distance
@@ -1026,7 +1026,7 @@ int16 deepCopy(GameObject *src, ObjectID parentID, TilePoint tp) {
l.u = tp.u;
l.v = tp.v;
l.z = tp.z;
- l.context = parentID;
+ l._context = parentID;
// Make a copy of this object, and place it in the parent container we spec'd
newID = src->copy(l);
@@ -3657,7 +3657,7 @@ int16 scriptSwapRegions(int16 *args) {
tp = obj->getLocation();
- loc.context = worldID2;
+ loc._context = worldID2;
loc.u = tp.u + region2.min.u - region1.min.u;
loc.v = tp.v + region2.min.v - region1.min.v;
loc.z = tp.z;
@@ -3673,7 +3673,7 @@ int16 scriptSwapRegions(int16 *args) {
tp = obj->getLocation();
- loc.context = worldID1;
+ loc._context = worldID1;
loc.u = tp.u + region1.min.u - region2.min.u;
loc.v = tp.v + region1.min.v - region2.min.v;
loc.z = tp.z;
Commit: 307bd92ea8ccba1636ba5ffa4a66a2db9852f8f1
https://github.com/scummvm/scummvm/commit/307bd92ea8ccba1636ba5ffa4a66a2db9852f8f1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:27+02:00
Commit Message:
SAGA2: Remove non-portable log-related code
Changed paths:
engines/saga2/enchant.cpp
engines/saga2/gamemode.cpp
engines/saga2/sagafunc.cpp
engines/saga2/tile.cpp
diff --git a/engines/saga2/enchant.cpp b/engines/saga2/enchant.cpp
index 73437d8ad50..dd0f0d2477d 100644
--- a/engines/saga2/enchant.cpp
+++ b/engines/saga2/enchant.cpp
@@ -23,8 +23,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-//#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/cmisc.h"
#include "saga2/player.h"
diff --git a/engines/saga2/gamemode.cpp b/engines/saga2/gamemode.cpp
index f1a1715d759..ac4885c8cd2 100644
--- a/engines/saga2/gamemode.cpp
+++ b/engines/saga2/gamemode.cpp
@@ -23,8 +23,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-//#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "saga2/saga2.h"
#include "saga2/floating.h"
diff --git a/engines/saga2/sagafunc.cpp b/engines/saga2/sagafunc.cpp
index a409a9f6b30..6424d77c69f 100644
--- a/engines/saga2/sagafunc.cpp
+++ b/engines/saga2/sagafunc.cpp
@@ -23,8 +23,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
-
#include "common/debug.h"
#include "saga2/saga2.h"
@@ -2725,56 +2723,8 @@ int16 scriptStatus(int16 *args) {
return 0;
}
-//-----------------------------------------------------------------------
-// Write a message to a log file
-// void "C" status( string caption, ... );
-/*
-void writeLog( char *str )
-{
- static FILE *logFile = NULL;
-
- if (logFile == NULL)
- {
- logFile = fopen( "logfile.txt", "a+t" );
- }
-
- if (logFile) fputs( str, logFile );
- fclose(logFile);
-}
-*/
-void writeLog(char *str) {
- FILE *logFile = nullptr;
-#ifdef __WATCOMC__
- time_t time_of_day;
- auto char buf[26];
- char strbuf[256];
-
-
- logFile = fopen("logfile.txt", "a+t");
- if (logFile) {
- time_of_day = time(NULL);
- _ctime(&time_of_day, buf);
- buf[strlen(buf) - 1] = 0;
- sprintf(strbuf, "%s: %s", buf, str);
- fputs(strbuf, logFile);
- fclose(logFile);
- }
-#else
- logFile = fopen("logfile.txt", "a+t");
- if (logFile) {
- fputs(str, logFile);
- fclose(logFile);
- }
-#endif
-}
-
void writeObject(char *str) {
- FILE *logFile = nullptr;
- logFile = fopen("objfile.txt", "a+t");
- if (logFile) {
- fputs(str, logFile);
- fclose(logFile);
- }
+ warning("OBJ: %s", str);
}
int16 scriptWriteLog(int16 *args) {
diff --git a/engines/saga2/tile.cpp b/engines/saga2/tile.cpp
index 723fd1889e5..3c0971af40f 100644
--- a/engines/saga2/tile.cpp
+++ b/engines/saga2/tile.cpp
@@ -47,7 +47,6 @@
namespace Saga2 {
-extern void writeLog(char *str);
void PlayModeSetup();
void initBackPanel();
Commit: ea0d27d4961ba86dcdf1d35eac0002f1ac670cf1
https://github.com/scummvm/scummvm/commit/ea0d27d4961ba86dcdf1d35eac0002f1ac670cf1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-26T19:52:27+02:00
Commit Message:
SAGA2: Rename class variables in panel.h
Changed paths:
engines/saga2/automap.cpp
engines/saga2/button.cpp
engines/saga2/contain.cpp
engines/saga2/document.cpp
engines/saga2/floating.cpp
engines/saga2/grequest.cpp
engines/saga2/gtextbox.cpp
engines/saga2/intrface.cpp
engines/saga2/modal.cpp
engines/saga2/mouseimg.cpp
engines/saga2/msgbox.cpp
engines/saga2/panel.cpp
engines/saga2/panel.h
engines/saga2/tilemode.cpp
engines/saga2/uidialog.cpp
engines/saga2/videobox.cpp
diff --git a/engines/saga2/automap.cpp b/engines/saga2/automap.cpp
index cb267534df1..a04da31ef65 100644
--- a/engines/saga2/automap.cpp
+++ b/engines/saga2/automap.cpp
@@ -235,7 +235,7 @@ void AutoMap::locateRegion() {
// deactivation
void AutoMap::deactivate() {
- selected = 0;
+ _selected = 0;
gPanel::deactivate();
}
@@ -244,7 +244,7 @@ void AutoMap::deactivate() {
bool AutoMap::activate(gEventType why) {
if (why == gEventMouseDown) { // momentarily depress
- selected = 1;
+ _selected = 1;
notify(why, 0); // notify App of successful hit
return true;
}
@@ -253,7 +253,7 @@ bool AutoMap::activate(gEventType why) {
bool AutoMap::keyStroke(gPanelMessage &msg) {
gEvent ev;
- switch (msg.key) {
+ switch (msg._key) {
case Common::ASCII_ESCAPE:
cmdAutoMapEsc(ev);
return true;
@@ -292,7 +292,7 @@ gPanel *AutoMap::keyTest(int16 key) {
// ------------------------------------------------------------------------
// mouse movement event handler
void AutoMap::pointerMove(gPanelMessage &msg) {
- Point16 pos = msg.pickAbsPos;
+ Point16 pos = msg._pickAbsPos;
if (Rect16(_extent.x, _extent.y, _extent.width, _extent.height).ptInside(pos)) {
// mouse hit inside autoMap
@@ -315,7 +315,7 @@ void AutoMap::pointerMove(gPanelMessage &msg) {
// mouse click event handler
bool AutoMap::pointerHit(gPanelMessage &msg) {
- Point16 pos = msg.pickAbsPos;
+ Point16 pos = msg._pickAbsPos;
if (Rect16(0, 0, _extent.width, _extent.height).ptInside(pos)) {
// mouse hit inside autoMap
@@ -346,13 +346,13 @@ bool AutoMap::pointerHit(gPanelMessage &msg) {
win = getWindow(); // get the window pointer
if (win)
- ri = (requestInfo *)win->userData;
+ ri = (requestInfo *)win->_userData;
else
ri = nullptr;
if (ri) {
ri->running = 0;
- ri->result = id;
+ ri->result = _id;
}
}
@@ -364,7 +364,7 @@ bool AutoMap::pointerHit(gPanelMessage &msg) {
// mouse drag event handler
void AutoMap::pointerDrag(gPanelMessage &) {
- if (selected) {
+ if (_selected) {
notify(gEventMouseDrag, 0);
}
}
@@ -373,7 +373,7 @@ void AutoMap::pointerDrag(gPanelMessage &) {
// mouse click release event handler
void AutoMap::pointerRelease(gPanelMessage &) {
- if (selected) notify(gEventMouseUp, 0); // notify App of successful hit
+ if (_selected) notify(gEventMouseUp, 0); // notify App of successful hit
deactivate();
}
@@ -568,7 +568,7 @@ int16 openAutoMap() {
decRes, 'M', 'A', 'P');
// attach the structure to the book
- pAutoMap->userData = &rInfo;
+ pAutoMap->_userData = &rInfo;
// locate where the center actor is, and open the map
pAutoMap->locateRegion();
@@ -600,11 +600,11 @@ APPFUNC(cmdAutoMapQuit) {
if (ev.panel && ev.eventType == gEventNewValue && ev.value) {
win = ev.panel->getWindow(); // get the window pointer
- ri = win ? (requestInfo *)win->userData : nullptr;
+ ri = win ? (requestInfo *)win->_userData : nullptr;
if (ri) {
ri->running = 0;
- ri->result = ev.panel->id;
+ ri->result = ev.panel->_id;
}
}
}
@@ -647,7 +647,7 @@ APPFUNC(cmdAutoMapAppFunc) {
}
APPFUNCV(AutoMap::cmdAutoMapEsc) {
- requestInfo *ri = (requestInfo *) userData;
+ requestInfo *ri = (requestInfo *)_userData;
if (ri) {
ri->running = 0;
ri->result = 0;
diff --git a/engines/saga2/button.cpp b/engines/saga2/button.cpp
index 4b27ca9aebe..d19eef9d57f 100644
--- a/engines/saga2/button.cpp
+++ b/engines/saga2/button.cpp
@@ -110,7 +110,7 @@ GfxCompImage::GfxCompImage(gPanelList &list, const Rect16 &box, void *image, con
_compImages[0] = image;
_max = 0;
_numPtrAlloc = 1;
- title = text;
+ _title = text;
_textFont = &Onyx10Font; // >>> this should be dynamic
_textPal = pal;
}
@@ -143,7 +143,7 @@ GfxCompImage::GfxCompImage(gPanelList &list, const Rect16 &box, void **images,
_currentImage = clamp(_min, initial, _max);
}
- title = text;
+ _title = text;
_textFont = &Onyx10Font; // >>> this should be dynamic
_textPal = pal;
}
@@ -161,7 +161,7 @@ GfxCompImage::GfxCompImage(gPanelList &list, const StaticRect &box, void **image
_currentImage = clamp(_min, initial, _max);
}
- title = text;
+ _title = text;
_textFont = &Onyx10Font; // >>> this should be dynamic
_textPal = pal;
}
@@ -191,7 +191,7 @@ void GfxCompImage::pointerMove(gPanelMessage &msg) {
// call the superclass's pointerMove
gControl::pointerMove(msg);
- notify(gEventMouseMove, (msg.pointerEnter ? enter : 0) | (msg.pointerLeave ? leave : 0));
+ notify(gEventMouseMove, (msg._pointerEnter ? enter : 0) | (msg._pointerLeave ? leave : 0));
}
void GfxCompImage::enable(bool abled) {
@@ -199,12 +199,12 @@ void GfxCompImage::enable(bool abled) {
}
void GfxCompImage::invalidate(Rect16 *) {
- window.update(_extent);
+ _window.update(_extent);
}
void GfxCompImage::draw() {
- gPort &port = window.windowPort;
- Rect16 rect = window.getExtent();
+ gPort &port = _window._windowPort;
+ Rect16 rect = _window.getExtent();
SAVE_GPORT_STATE(port); // save pen color, etc.
g_vm->_pointer->hide(port, _extent); // hide mouse pointer
@@ -241,7 +241,7 @@ void GfxCompImage::select(uint16 val) {
setCurrent(val);
if (getEnabled()) {
- window.update(_extent);
+ _window.update(_extent);
}
}
@@ -280,12 +280,12 @@ void GfxCompImage::drawClipped(gPort &port,
else drawCompressedImage(port, pos, dispImage);
// this could be modified to get the current text coloring
- if (title) {
+ if (_title) {
Rect16 textRect = _extent;
textRect.x -= offset.x;
textRect.y -= offset.y;
- writePlaqText(port, textRect, _textFont, 0, _textPal, selected, title);
+ writePlaqText(port, textRect, _textFont, 0, _textPal, _selected, _title);
}
}
}
@@ -520,19 +520,19 @@ void GfxCompButton::dim(bool enableFlag) {
_dimmed = false;
}
- window.update(_extent);
+ _window.update(_extent);
}
void GfxCompButton::deactivate() {
- selected = 0;
- window.update(_extent);
+ _selected = 0;
+ _window.update(_extent);
gPanel::deactivate();
}
bool GfxCompButton::activate(gEventType why) {
- selected = 1;
- window.update(_extent);
+ _selected = 1;
+ _window.update(_extent);
if (why == gEventKeyDown) { // momentarily depress
deactivate();
@@ -561,16 +561,16 @@ bool GfxCompButton::pointerHit(gPanelMessage &) {
void GfxCompButton::pointerRelease(gPanelMessage &) {
// We have to test selected first because deactivate clears it.
- if (selected) {
+ if (_selected) {
deactivate(); // give back input focus
notify(gEventNewValue, 1); // notify App of successful hit
} else deactivate();
}
void GfxCompButton::pointerDrag(gPanelMessage &msg) {
- if (selected != msg.inPanel) {
- selected = msg.inPanel;
- window.update(_extent);
+ if (_selected != msg._inPanel) {
+ _selected = msg._inPanel;
+ _window.update(_extent);
}
}
@@ -579,13 +579,13 @@ void GfxCompButton::enable(bool abled) {
}
void GfxCompButton::invalidate(Rect16 *) {
- window.update(_extent);
+ _window.update(_extent);
}
void GfxCompButton::draw() {
- gPort &port = window.windowPort;
- Rect16 rect = window.getExtent();
+ gPort &port = _window._windowPort;
+ Rect16 rect = _window.getExtent();
SAVE_GPORT_STATE(port); // save pen color, etc.
g_vm->_pointer->hide(port, _extent); // hide mouse pointer
@@ -596,7 +596,7 @@ void GfxCompButton::draw() {
void *GfxCompButton::getCurrentCompImage() {
if (_dimmed) {
return _dimImage;
- } else if (selected) {
+ } else if (_selected) {
return _resImage;
} else {
return _forImage;
@@ -618,7 +618,7 @@ bool GfxOwnerSelCompButton::activate(gEventType why) {
// selected = !selected;
// window.update( extent );
gPanel::deactivate();
- notify(gEventNewValue, selected); // notify App of successful hit
+ notify(gEventNewValue, _selected); // notify App of successful hit
playMemSound(2);
}
return false;
@@ -629,12 +629,12 @@ bool GfxOwnerSelCompButton::pointerHit(gPanelMessage &) {
}
void GfxOwnerSelCompButton::select(uint16 val) {
- selected = val;
+ _selected = val;
setCurrent(val);
if (getEnabled()) {
- window.update(_extent);
+ _window.update(_extent);
}
}
@@ -728,7 +728,7 @@ bool GfxMultCompButton::activate(gEventType why) {
if (++_current > _max) {
_current = 0;
}
- window.update(_extent);
+ _window.update(_extent);
}
gPanel::deactivate();
@@ -805,7 +805,7 @@ int16 GfxSlider::getSliderLenVal() {
}
void GfxSlider::draw() {
- gPort &port = window.windowPort;
+ gPort &port = _window._windowPort;
Point16 offset = Point16(0, 0);
SAVE_GPORT_STATE(port); // save pen color, etc.
@@ -838,8 +838,8 @@ void GfxSlider::drawClipped(gPort &port,
bool GfxSlider::activate(gEventType why) {
if (why == gEventKeyDown || why == gEventMouseDown) {
- selected = 1;
- window.update(_extent);
+ _selected = 1;
+ _window.update(_extent);
gPanel::deactivate();
notify(gEventNewValue, _slCurrent); // notify App of successful hit
}
@@ -847,29 +847,29 @@ bool GfxSlider::activate(gEventType why) {
}
void GfxSlider::deactivate() {
- selected = 0;
- window.update(_extent);
+ _selected = 0;
+ _window.update(_extent);
gPanel::deactivate();
}
bool GfxSlider::pointerHit(gPanelMessage &msg) {
// update the image index
- updateSliderIndexes(msg.pickPos);
+ updateSliderIndexes(msg._pickPos);
// redraw the control should any visual change hath occurred
- window.update(_extent);
+ _window.update(_extent);
activate(gEventMouseDown);
return true;
}
void GfxSlider::pointerMove(gPanelMessage &msg) {
- if (selected) {
+ if (_selected) {
// update the image index
- updateSliderIndexes(msg.pickPos);
+ updateSliderIndexes(msg._pickPos);
// redraw the control should any visual change hath occurred
- window.update(_extent);
+ _window.update(_extent);
notify(gEventMouseMove, _slCurrent);
}
@@ -877,7 +877,7 @@ void GfxSlider::pointerMove(gPanelMessage &msg) {
void GfxSlider::pointerRelease(gPanelMessage &) {
// We have to test selected first because deactivate clears it.
- if (selected) {
+ if (_selected) {
deactivate(); // give back input focus
notify(gEventNewValue, _slCurrent); // notify App of successful hit
} else deactivate();
@@ -885,11 +885,11 @@ void GfxSlider::pointerRelease(gPanelMessage &) {
void GfxSlider::pointerDrag(gPanelMessage &msg) {
// update the image index
- updateSliderIndexes(msg.pickPos);
+ updateSliderIndexes(msg._pickPos);
notify(gEventNewValue, _slCurrent); // notify App of successful hit
// redraw the control should any visual change hath occurred
- window.update(_extent);
+ _window.update(_extent);
}
void GfxSlider::updateSliderIndexes(Point16 &pos) {
diff --git a/engines/saga2/contain.cpp b/engines/saga2/contain.cpp
index d68d7ec0c20..134aa1661b1 100644
--- a/engines/saga2/contain.cpp
+++ b/engines/saga2/contain.cpp
@@ -527,7 +527,7 @@ void ContainerView::deactivate() {
}
void ContainerView::pointerMove(gPanelMessage &msg) {
- if (msg.pointerLeave) {
+ if (msg._pointerLeave) {
g_vm->_cnm->_lastPickedObjectID = Nothing;
g_vm->_cnm->_lastPickedObjectQuantity = -1;
g_vm->_mouseInfo->setText(nullptr);
@@ -557,7 +557,7 @@ void ContainerView::pointerMove(gPanelMessage &msg) {
}
// Determine if mouse is pointing at a new object
- updateMouseText(msg.pickPos);
+ updateMouseText(msg._pickPos);
}
}
@@ -566,13 +566,13 @@ bool ContainerView::pointerHit(gPanelMessage &msg) {
GameObject *slotObject;
uint16 mouseSet;
- slotObject = pickObject(msg.pickPos);
+ slotObject = pickObject(msg._pickPos);
mouseObject = g_vm->_mouseInfo->getObject();
mouseSet = mouseObject ? mouseObject->containmentSet() : 0;
if (!g_vm->_mouseInfo->getDoable()) return false;
- if (msg.doubleClick && !g_vm->_cnm->_alreadyDone) {
+ if (msg._doubleClick && !g_vm->_cnm->_alreadyDone) {
dblClick(mouseObject, slotObject, msg);
} else { // single click
if (mouseObject != nullptr) {
@@ -615,7 +615,7 @@ bool ContainerView::pointerHit(gPanelMessage &msg) {
// total the mass and bulk of all the objects in this container
totalObjects();
- window.update(_extent);
+ _window.update(_extent);
return activate(gEventMouseDown);
}
@@ -638,7 +638,7 @@ void ContainerView::timerTick(gPanelMessage &msg) {
// validate objToGet and make sure that the number selected for move
// is less then or equal to the number of items present in the merged object
if (g_vm->_cnm->_objToGet && g_vm->_cnm->_amountIndY != -1) {
- int32 rate = (g_vm->_cnm->_amountIndY - msg.pickAbsPos.y);
+ int32 rate = (g_vm->_cnm->_amountIndY - msg._pickAbsPos.y);
rate = rate * ((rate > 0) ? rate : -rate);
@@ -732,7 +732,7 @@ void ContainerView::dropPhysical(
// test to check if item is accepted by container
if (_containerObject->canContain(mObj->thisID())) {
Actor *centerActor = getCenterActor();
- Location loc(pickObjectSlot(msg.pickPos),
+ Location loc(pickObjectSlot(msg._pickPos),
_containerObject->thisID());
// check if no object in the current slot
@@ -784,7 +784,7 @@ void ContainerView::useConcept(
// If there is no object already in this slot drop the
// mouse object here
- Location loc(pickObjectSlot(msg.pickPos),
+ Location loc(pickObjectSlot(msg._pickPos),
_containerObject->thisID());
mObj->drop(centerActorID, loc);
@@ -1147,7 +1147,7 @@ TangibleContainerWindow::TangibleContainerWindow(
// set the userdata such that we can extract the container object later
// through an appfunc.
- this->userData = _view->_containerObject;
+ this->_userData = _view->_containerObject;
_massWeightIndicator = new CMassWeightIndicator(
this,
diff --git a/engines/saga2/document.cpp b/engines/saga2/document.cpp
index e03d25209f5..103430509bc 100644
--- a/engines/saga2/document.cpp
+++ b/engines/saga2/document.cpp
@@ -223,13 +223,13 @@ CDocument::~CDocument() {
}
void CDocument::deactivate() {
- selected = 0;
+ _selected = 0;
gPanel::deactivate();
}
bool CDocument::activate(gEventType why) {
if (why == gEventMouseDown) { // momentarily depress
- selected = 1;
+ _selected = 1;
notify(why, 0); // notify App of successful hit
return true;
}
@@ -238,7 +238,7 @@ bool CDocument::activate(gEventType why) {
bool CDocument::keyStroke(gPanelMessage &msg) {
gEvent ev;
- switch (msg.key) {
+ switch (msg._key) {
case Common::ASCII_ESCAPE:
cmdDocumentEsc(ev);
return true;
@@ -276,9 +276,9 @@ gPanel *CDocument::keyTest(int16 key) {
// Cursor images for turning book pages
void CDocument::pointerMove(gPanelMessage &msg) {
- Point16 pos = msg.pickPos;
+ Point16 pos = msg._pickPos;
- if (msg.inPanel && Rect16(0, 0, _extent.width, _extent.height).ptInside(pos)) {
+ if (msg._inPanel && Rect16(0, 0, _extent.width, _extent.height).ptInside(pos)) {
if (_app.orientation == pageOrientVertical) {
// find out which end of the book we're on
if (pos.y < _extent.height / 2) setMouseImage(kMousePgUpImage, -7, -7);
@@ -288,7 +288,7 @@ void CDocument::pointerMove(gPanelMessage &msg) {
if (pos.x < _extent.width / 2) setMouseImage(kMousePgLeftImage, -7, -7);
else setMouseImage(kMousePgRightImage, -7, -7);
}
- } else if (msg.pointerLeave) {
+ } else if (msg._pointerLeave) {
setMouseImage(kMouseArrowImage, 0, 0);
}
@@ -296,15 +296,15 @@ void CDocument::pointerMove(gPanelMessage &msg) {
}
void CDocument::pointerDrag(gPanelMessage &) {
- if (selected) {
+ if (_selected) {
notify(gEventMouseDrag, 0);
}
}
bool CDocument::pointerHit(gPanelMessage &msg) {
- Point16 pos = msg.pickPos;
+ Point16 pos = msg._pickPos;
- if (msg.inPanel && Rect16(0, 0, _extent.width, _extent.height).ptInside(pos)) {
+ if (msg._inPanel && Rect16(0, 0, _extent.width, _extent.height).ptInside(pos)) {
gEvent ev;
if (_app.orientation == pageOrientVertical) {
// find out which end of the book we're on
@@ -321,11 +321,11 @@ bool CDocument::pointerHit(gPanelMessage &msg) {
requestInfo *ri;
win = getWindow(); // get the window pointer
- ri = win ? (requestInfo *)win->userData : nullptr;
+ ri = win ? (requestInfo *)win->_userData : nullptr;
if (ri) {
ri->running = 0;
- ri->result = id;
+ ri->result = _id;
setMouseImage(kMouseArrowImage, 0, 0);
}
@@ -347,7 +347,7 @@ void CDocument::gotoPage(int8 page) {
}
void CDocument::pointerRelease(gPanelMessage &) {
- if (selected) notify(gEventMouseUp, 0); // notify App of successful hit
+ if (_selected) notify(gEventMouseUp, 0); // notify App of successful hit
deactivate();
}
@@ -548,7 +548,7 @@ void CDocument::makePages() {
// This function will draw the text onto the book.
void CDocument::renderText() {
gPort tPort;
- gPort &port = window.windowPort;
+ gPort &port = _window._windowPort;
uint16 pageIndex;
uint16 lineIndex;
uint16 linesPerPage = _pageHeight / (_textHeight + 1);
@@ -748,10 +748,10 @@ int16 openScroll(uint16 textScript) {
// make the quit button
closeScroll = new GfxCompButton(*win, scrollAppearance.closeRect, closeBtnImage, numBtnImages, 0, cmdDocumentQuit);
- closeScroll->accelKey = 0x1B;
+ closeScroll->_accelKey = 0x1B;
// attach the structure to the book, open the book
- win->userData = &rInfo;
+ win->_userData = &rInfo;
win->open();
// do stuff
@@ -799,10 +799,10 @@ int16 openBook(uint16 textScript) {
// make the quit button
closeBook = new GfxCompButton(*win, bookAppearance.closeRect, cmdDocumentQuit);
- closeBook->accelKey = 0x1B;
+ closeBook->_accelKey = 0x1B;
// attach the structure to the book, open the book
- win->userData = &rInfo;
+ win->_userData = &rInfo;
win->open();
// do stuff
@@ -844,10 +844,10 @@ int16 openParchment(uint16 textScript) {
win = new CDocument(parchAppearance, bookText, &Script10Font, 0, nullptr);
// make the quit button
closeParchment = new GfxCompButton(*win, parchAppearance.closeRect, cmdDocumentQuit);
- closeParchment->accelKey = 0x1B;
+ closeParchment->_accelKey = 0x1B;
// attach the structure to the book, open the book
- win->userData = &rInfo;
+ win->_userData = &rInfo;
win->open();
// do stuff
@@ -869,17 +869,17 @@ APPFUNC(cmdDocumentQuit) {
if (ev.panel && ev.eventType == gEventNewValue && ev.value) {
win = ev.panel->getWindow(); // get the window pointer
- ri = win ? (requestInfo *)win->userData : nullptr;
+ ri = win ? (requestInfo *)win->_userData : nullptr;
if (ri) {
ri->running = 0;
- ri->result = ev.panel->id;
+ ri->result = ev.panel->_id;
}
}
}
APPFUNCV(CDocument::cmdDocumentEsc) {
- requestInfo *ri = (requestInfo *) userData;
+ requestInfo *ri = (requestInfo *)_userData;
if (ri) {
ri->running = 0;
ri->result = 0;
diff --git a/engines/saga2/floating.cpp b/engines/saga2/floating.cpp
index fc5e05caa98..51e2ba41a3a 100644
--- a/engines/saga2/floating.cpp
+++ b/engines/saga2/floating.cpp
@@ -296,12 +296,12 @@ BackWindow::BackWindow(const Rect16 &r, uint16 ident, AppFunc *cmd)
void BackWindow::invalidate(Rect16 *area) {
if (displayEnabled())
- window.update(*area);
+ _window.update(*area);
}
void BackWindow::invalidate(const StaticRect *area) {
if (displayEnabled())
- window.update(*area);
+ _window.update(*area);
}
// Return true if window floats above animated are
@@ -336,11 +336,11 @@ void DragBar::deactivate() {
}
bool DragBar::pointerHit(gPanelMessage &msg) {
- Rect16 wExtent = window.getExtent();
+ Rect16 wExtent = _window.getExtent();
_dragPos.x = wExtent.x;
_dragPos.y = wExtent.y;
- _dragOffset.set(msg.pickAbsPos.x, msg.pickAbsPos.y);
+ _dragOffset.set(msg._pickAbsPos.x, msg._pickAbsPos.y);
return true;
}
@@ -349,20 +349,20 @@ bool DragBar::pointerHit(gPanelMessage &msg) {
// be dragged...
void DragBar::pointerDrag(gPanelMessage &msg) {
- Rect16 ext = window.getExtent();
+ Rect16 ext = _window.getExtent();
Point16 pos;
// Calculate new window position
- pos.x = msg.pickAbsPos.x + ext.x - _dragOffset.x;
- pos.y = msg.pickAbsPos.y + ext.y - _dragOffset.y;
+ pos.x = msg._pickAbsPos.x + ext.x - _dragOffset.x;
+ pos.y = msg._pickAbsPos.y + ext.y - _dragOffset.y;
// If window position has changed, then signal the drawing loop
if (pos != _dragPos) {
_dragPos.set(pos.x, pos.y);
_update = true;
- _dragWindow = (FloatingWindow *)&window;
+ _dragWindow = (FloatingWindow *)&_window;
}
}
@@ -378,13 +378,13 @@ void DragBar::pointerRelease(gPanelMessage &) {
* ===================================================================== */
void gButton::deactivate() {
- selected = 0;
+ _selected = 0;
draw();
gPanel::deactivate();
}
bool gButton::activate(gEventType why) {
- selected = 1;
+ _selected = 1;
draw();
if (why == gEventKeyDown) { // momentarily depress
@@ -402,22 +402,22 @@ bool gButton::pointerHit(gPanelMessage &) {
void gButton::pointerRelease(gPanelMessage &) {
// We have to test selected first because deactivate clears it.
- if (selected) {
+ if (_selected) {
deactivate(); // give back input focus
notify(gEventNewValue, 1); // notify App of successful hit
} else deactivate();
}
void gButton::pointerDrag(gPanelMessage &msg) {
- if (selected != msg.inPanel) {
- selected = msg.inPanel;
+ if (_selected != msg._inPanel) {
+ _selected = msg._inPanel;
draw();
}
}
void gButton::draw() {
- gPort &port = window.windowPort;
- Rect16 rect = window.getExtent();
+ gPort &port = _window._windowPort;
+ Rect16 rect = _window.getExtent();
g_vm->_pointer->hide(port, _extent); // hide mouse pointer
if (displayEnabled())
@@ -431,7 +431,7 @@ void gButton::draw() {
* ===================================================================== */
void gImageButton::drawClipped(gPort &port, const Point16 &offset, const Rect16 &r) {
- gPixelMap *currentImage = selected ? _selImage : _deselImage;
+ gPixelMap *currentImage = _selected ? _selImage : _deselImage;
if (displayEnabled())
if (_extent.overlap(r))
@@ -450,10 +450,10 @@ void gImageButton::drawClipped(gPort &port, const Point16 &offset, const Rect16
bool gToggleButton::activate(gEventType why) {
if (why == gEventKeyDown || why == gEventMouseDown) {
- selected = !selected;
+ _selected = !_selected;
draw();
gPanel::deactivate();
- notify(gEventNewValue, selected); // notify App of successful hit
+ notify(gEventNewValue, _selected); // notify App of successful hit
}
return false;
}
@@ -482,8 +482,8 @@ LabeledButton::LabeledButton(gPanelList &list,
cmd) {
const char *underscore;
- if ((underscore = strchr(title, '_')) != nullptr)
- accelKey = toupper(underscore[1]);
+ if ((underscore = strchr(_title, '_')) != nullptr)
+ _accelKey = toupper(underscore[1]);
}
void LabeledButton::drawClipped(
@@ -508,14 +508,14 @@ void LabeledButton::drawClipped(
gImageButton::drawClipped(port, offset, r);
textOrigin.x = origin.x + ((_extent.width -
- TextWidth(textFont, title, -1, textStyleUnderBar)) >> 1);
+ TextWidth(textFont, _title, -1, textStyleUnderBar)) >> 1);
textOrigin.y = origin.y + ((_extent.height - textFont->height) >> 1);
port.setColor(2);
port.moveTo(textOrigin);
port.setFont(textFont);
port.setStyle(textStyleUnderBar);
- port.drawText(title, -1);
+ port.drawText(_title, -1);
}
diff --git a/engines/saga2/grequest.cpp b/engines/saga2/grequest.cpp
index 3213ff852df..42d6a30e9a1 100644
--- a/engines/saga2/grequest.cpp
+++ b/engines/saga2/grequest.cpp
@@ -65,11 +65,11 @@ static void handleRequestEvent(gEvent &ev) {
if (ev.panel && ev.eventType == gEventNewValue && ev.value) {
win = ev.panel->getWindow(); // get the window pointer
- ri = win ? (requestInfo *)win->userData : nullptr;
+ ri = win ? (requestInfo *)win->_userData : nullptr;
if (ri) {
ri->running = 0;
- ri->result = ev.panel->id;
+ ri->result = ev.panel->_id;
}
}
}
@@ -321,12 +321,12 @@ public:
};
void ModalDisplayWindow::pointerRelease(gPanelMessage &) {
- requestInfo *ri = (requestInfo *)userData;
+ requestInfo *ri = (requestInfo *)_userData;
if (ri) ri->running = false;
}
bool ModalDisplayWindow::keyStroke(gPanelMessage &) {
- requestInfo *ri = (requestInfo *)userData;
+ requestInfo *ri = (requestInfo *)_userData;
if (ri) ri->running = false;
return true;
}
@@ -363,7 +363,7 @@ int16 GameDialogA(
error("Unable to open requester window.");
}
- win->userData = &rInfo;
+ win->_userData = &rInfo;
win->open();
EventLoop(rInfo.running, false);
@@ -415,7 +415,7 @@ int16 GameDisplayA(
error("Unable to open requester window.");
}
- win->userData = &rInfo;
+ win->_userData = &rInfo;
win->open();
EventLoop(rInfo.running, false);
diff --git a/engines/saga2/gtextbox.cpp b/engines/saga2/gtextbox.cpp
index ba300bbebc5..e1d36d77b75 100644
--- a/engines/saga2/gtextbox.cpp
+++ b/engines/saga2/gtextbox.cpp
@@ -199,7 +199,7 @@ gTextBox::gTextBox(
_onEnter = cmdEnter;
_onEscape = cmdEscape;
_isActiveCtl = false;
- selected = 0;
+ _selected = 0;
_parent = &list;
_blinkStart = 0;
@@ -231,7 +231,7 @@ gTextBox::gTextBox(
gTextBox::~gTextBox() {
deSelect();
- selected = 0;
+ _selected = 0;
if (_undoBuffer) {
delete[] _undoBuffer;
}
@@ -331,7 +331,7 @@ void gTextBox::setText(char *newText) {
insertText(newText, len);
_cursorPos = _anchorPos = 0;
- if (window.isOpen()) drawContents();
+ if (_window.isOpen()) drawContents();
}
//-----------------------------------------------------------------------
@@ -348,15 +348,15 @@ void gTextBox::setEditExtent(const Rect16 &r) {
bool gTextBox::activate(gEventType why) {
if (why == gEventAltValue) { // momentarily depress
- selected = 1;
+ _selected = 1;
notify(why, 0); // notify App of successful hit
return true;
}
_isActiveCtl = true;
- if (!selected) {
+ if (!_selected) {
enSelect(_index);
}
- selected = 1;
+ _selected = 1;
_fullRedraw = true;
draw();
if (why == gEventNone)
@@ -367,7 +367,7 @@ bool gTextBox::activate(gEventType why) {
//-----------------------------------------------------------------------
void gTextBox::deactivate() {
- selected = 0;
+ _selected = 0;
_isActiveCtl = false;
draw();
_fullRedraw = true;
@@ -563,7 +563,7 @@ void gTextBox::scrollDown() {
//-----------------------------------------------------------------------
bool gTextBox::pointerHit(gPanelMessage &msg) {
- Point16 pos = msg.pickPos;
+ Point16 pos = msg._pickPos;
int16 newPos;
@@ -577,11 +577,11 @@ bool gTextBox::pointerHit(gPanelMessage &msg) {
reSelect(newIndex);
if (_editing) {
if (_textFont) {
- newPos = WhichIChar(_textFont, (uint8 *)_fieldStrings[_index], msg.pickPos.x - 3, _currentLen[_index]);
+ newPos = WhichIChar(_textFont, (uint8 *)_fieldStrings[_index], msg._pickPos.x - 3, _currentLen[_index]);
} else {
- newPos = WhichIChar(mainFont, (uint8 *)_fieldStrings[_index], msg.pickPos.x - 3, _currentLen[_index]);
+ newPos = WhichIChar(mainFont, (uint8 *)_fieldStrings[_index], msg._pickPos.x - 3, _currentLen[_index]);
}
- if (msg.leftButton) {
+ if (msg._leftButton) {
if (_cursorPos != newPos || _anchorPos != newPos) {
_anchorPos = newPos;
_cursorPos = newPos;
@@ -605,11 +605,11 @@ bool gTextBox::pointerHit(gPanelMessage &msg) {
void gTextBox::pointerDrag(gPanelMessage &msg) {
int16 newPos;
- if (msg.leftButton) {
+ if (msg._leftButton) {
if (_textFont) {
- newPos = WhichIChar(_textFont, (uint8 *)_fieldStrings[_index], msg.pickPos.x - 3, _currentLen[_index]);
+ newPos = WhichIChar(_textFont, (uint8 *)_fieldStrings[_index], msg._pickPos.x - 3, _currentLen[_index]);
} else {
- newPos = WhichIChar(mainFont, (uint8 *)_fieldStrings[_index], msg.pickPos.x - 3, _currentLen[_index]);
+ newPos = WhichIChar(mainFont, (uint8 *)_fieldStrings[_index], msg._pickPos.x - 3, _currentLen[_index]);
}
_inDrag = true;
if (_cursorPos != newPos) {
@@ -628,7 +628,7 @@ void gTextBox::pointerDrag(gPanelMessage &msg) {
// Mouse release code
void gTextBox::pointerRelease(gPanelMessage &msg) {
- if (!msg.leftButton) {
+ if (!msg._leftButton) {
_inDrag = false;
draw();
}
@@ -638,10 +638,10 @@ void gTextBox::pointerRelease(gPanelMessage &msg) {
bool gTextBox::keyStroke(gPanelMessage &msg) {
- gPort &port = window.windowPort;
+ gPort &port = _window._windowPort;
int16 selStart = MIN(_cursorPos, _anchorPos),
selWidth = ABS(_cursorPos - _anchorPos);
- uint16 key = msg.key;
+ uint16 key = msg._key;
// Process the various keystrokes...
if (_editing && _cursorPos > _anchorPos) {
@@ -703,14 +703,14 @@ bool gTextBox::keyStroke(gPanelMessage &msg) {
case Common::KEYCODE_LEFT:
if (_anchorPos > 0)
_anchorPos--;
- if (!(msg.qualifier & qualifierShift))
+ if (!(msg._qualifier & qualifierShift))
_cursorPos = _anchorPos;
break;
case Common::KEYCODE_RIGHT:
if (_anchorPos < _currentLen[_index])
_anchorPos++;
- if (!(msg.qualifier & qualifierShift))
+ if (!(msg._qualifier & qualifierShift))
_cursorPos = _anchorPos;
break;
@@ -725,7 +725,7 @@ bool gTextBox::keyStroke(gPanelMessage &msg) {
break;
case Common::KEYCODE_z: // Alt-Z
- if (msg.qualifier & (qualifierControl | qualifierAlt)) {
+ if (msg._qualifier & (qualifierControl | qualifierAlt)) {
if (_undoBuffer) {
_cursorPos = _anchorPos = _currentLen[_index] = _undoLen;
memcpy(_fieldStrings[_index], _undoBuffer, _currentLen[_index] + 1);
@@ -844,14 +844,14 @@ void gTextBox::timerTick(gPanelMessage &msg) {
//-----------------------------------------------------------------------
void gTextBox::handleTimerTick(int32 tick) {
- if (selected && !_displayOnly && _editing && !_inDrag) {
+ if (_selected && !_displayOnly && _editing && !_inDrag) {
if (_blinkStart == 0) {
_blinkState = 0;
_blinkStart = tick;
return;
}
if (tick - _blinkStart > blinkTime) {
- gPort &port = window.windowPort;
+ gPort &port = _window._windowPort;
SAVE_GPORT_STATE(port); // save pen color, etc.
g_vm->_pointer->hide(port, _extent); // hide mouse pointer
@@ -885,7 +885,7 @@ void gTextBox::drawContents() {
assert(_textFont);
assert(_fontColorBack != -1);
- gPort &port = window.windowPort,
+ gPort &port = _window._windowPort,
tPort;
@@ -909,7 +909,7 @@ void gTextBox::drawContents() {
editRectFill(tPort, port._penMap);
}
- if (selected) { // if panel is selected
+ if (_selected) { // if panel is selected
// Determine the pixel position of the cursor and
// anchor positions.
@@ -987,8 +987,8 @@ void gTextBox::drawContents() {
//-----------------------------------------------------------------------
void gTextBox::drawClipped() {
- gPort &port = window.windowPort;
- Rect16 rect = window.getExtent();
+ gPort &port = _window._windowPort;
+ Rect16 rect = _window.getExtent();
#if 0
if (!_inDrag && _cursorPos > _anchorPos) {
diff --git a/engines/saga2/intrface.cpp b/engines/saga2/intrface.cpp
index 34f8ad5d892..080db3a45e1 100644
--- a/engines/saga2/intrface.cpp
+++ b/engines/saga2/intrface.cpp
@@ -416,12 +416,12 @@ void CPlaqText::enable(bool abled) {
}
void CPlaqText::invalidate(Rect16 *) {
- window.update(_extent);
+ _window.update(_extent);
}
void CPlaqText::draw() {
- gPort &port = window.windowPort;
- Rect16 rect = window.getExtent();
+ gPort &port = _window._windowPort;
+ Rect16 rect = _window.getExtent();
// save pen color, etc.
@@ -450,7 +450,7 @@ void CPlaqText::drawClipped(gPort &port,
_textRect.y -= offset.y;
- writePlaqText(port, _textRect, _buttonFont, _textPosition, _textFacePal, selected, _lineBuf);
+ writePlaqText(port, _textRect, _buttonFont, _textPosition, _textFacePal, _selected, _lineBuf);
}
}
}
@@ -637,7 +637,7 @@ void CStatusLine::experationCheck() {
&& (_waitAlarm.check()
|| (_queueTail != _queueHead && _minWaitAlarm.check()))) {
enable(false);
- window.update(_extent);
+ _window.update(_extent);
_lineDisplayed = false;
}
@@ -662,7 +662,7 @@ void CStatusLine::experationCheck() {
_queueTail = bump(_queueTail);
// draw the new textline
- window.update(_extent);
+ _window.update(_extent);
_lineDisplayed = true;
}
@@ -670,7 +670,7 @@ void CStatusLine::experationCheck() {
void CStatusLine::clear() {
enable(false);
- window.update(_extent);
+ _window.update(_extent);
_lineDisplayed = false;
_queueHead = _queueTail = 0;
@@ -747,7 +747,7 @@ CMassWeightIndicator::CMassWeightIndicator(gPanelList *panel, const Point16 &pos
// if this is something other then the ready containers
if (type > 1) {
- _containerObject = (GameObject *)panel->userData;
+ _containerObject = (GameObject *)panel->_userData;
} else {
_containerObject = nullptr;
}
@@ -923,7 +923,7 @@ Rect16 CManaIndicator::getManaRegionRect(int8 nRegion) {
void CManaIndicator::draw() {
- gPort &port = window.windowPort;
+ gPort &port = _window._windowPort;
// save pen color, etc.
@@ -2067,7 +2067,7 @@ APPFUNC(cmdPortrait) {
const int bufSize = 80;
const int stateBufSize = 60;
- uint16 panID = ev.panel->id;
+ uint16 panID = ev.panel->_id;
GameObject *mouseObject = g_vm->_mouseInfo->getObject(); // object being dragged
switch (ev.eventType) {
@@ -2186,7 +2186,7 @@ void toggleAgression(PlayerActorID bro, bool all) {
}
APPFUNC(cmdAggressive) {
- uint16 transBroID = translatePanID(ev.panel->id);
+ uint16 transBroID = translatePanID(ev.panel->_id);
// check for message update stuff
// and aggression update
@@ -2258,7 +2258,7 @@ APPFUNC(cmdArmor) {
}
APPFUNC(cmdCenter) {
- uint16 transBroID = translatePanID(ev.panel->id);
+ uint16 transBroID = translatePanID(ev.panel->_id);
if (ev.eventType == gEventNewValue) {
if (rightButtonState())
@@ -2287,7 +2287,7 @@ void toggleBanding(PlayerActorID bro, bool all) {
}
APPFUNC(cmdBand) {
- uint16 transBroID = translatePanID(ev.panel->id);
+ uint16 transBroID = translatePanID(ev.panel->_id);
if (ev.eventType == gEventNewValue) {
toggleBanding(transBroID, rightButtonState());
@@ -2323,18 +2323,18 @@ APPFUNC(cmdOptions) {
APPFUNC(cmdBroChange) {
if (ev.eventType == gEventNewValue) {
- if (!isBrotherDead(ev.panel->id)) {
- setCenterBrother(ev.panel->id);
+ if (!isBrotherDead(ev.panel->_id)) {
+ setCenterBrother(ev.panel->_id);
// this sets up the _buttons in trio mode to the correct
// state ( must be called before indiv mode switchtes )
setTrioBtns();
- setControlPanelsToIndividualMode(ev.panel->id);
+ setControlPanelsToIndividualMode(ev.panel->_id);
}
} else if (ev.eventType == gEventMouseMove) {
const int bufSize = 80;
const int stateBufSize = 60;
- uint16 panID = ev.panel->id;
+ uint16 panID = ev.panel->_id;
if (ev.value == GfxCompImage::enter) {
// working buffer
@@ -2364,7 +2364,7 @@ APPFUNC(cmdBroChange) {
}
APPFUNC(cmdHealthStar) {
- uint16 transBroID = translatePanID(ev.panel->id);
+ uint16 transBroID = translatePanID(ev.panel->_id);
if (ev.eventType == gEventMouseMove) {
if (ev.value == GfxCompImage::leave) {
@@ -2403,8 +2403,8 @@ APPFUNC(cmdMassInd) {
assert(win);
// is it something other than the brother's indicators?
- if (ev.panel->id > 1) {
- _containerObject = (GameObject *)win->userData;
+ if (ev.panel->_id > 1) {
+ _containerObject = (GameObject *)win->_userData;
} else {
_containerObject = (GameObject *)g_vm->_playerList[getCenterActorPlayerID()]->getActor();
}
@@ -2441,8 +2441,8 @@ APPFUNC(cmdBulkInd) {
assert(win);
// is it something other than the brother's indicators?
- if (ev.panel->id > 1) {
- _containerObject = (GameObject *)win->userData;
+ if (ev.panel->_id > 1) {
+ _containerObject = (GameObject *)win->_userData;
} else {
_containerObject = (GameObject *)g_vm->_playerList[getCenterActorPlayerID()]->getActor();
}
@@ -2654,7 +2654,7 @@ void gEnchantmentDisplay::drawClipped(gPort &port, const Point16 &offset, con
}
void gEnchantmentDisplay::pointerMove(gPanelMessage &msg) {
- if (msg.pointerLeave) {
+ if (msg._pointerLeave) {
g_vm->_mouseInfo->setText(nullptr);
} else {
int16 x = _extent.width - 10;
@@ -2667,7 +2667,7 @@ void gEnchantmentDisplay::pointerMove(gPanelMessage &msg) {
Sprite *sp = mentalSprites->sprite(i + 162);
x -= sp->size.x + 2;
- if (msg.pickPos.x >= x) {
+ if (msg._pickPos.x >= x) {
// set the text in the cursor
char buf[128];
diff --git a/engines/saga2/modal.cpp b/engines/saga2/modal.cpp
index f577794a4ab..557965c4787 100644
--- a/engines/saga2/modal.cpp
+++ b/engines/saga2/modal.cpp
@@ -72,7 +72,7 @@ ModalWindow::~ModalWindow() {
}
bool ModalWindow::isModal() {
- return openFlag;
+ return _openFlag;
}
bool ModalWindow::open() {
diff --git a/engines/saga2/mouseimg.cpp b/engines/saga2/mouseimg.cpp
index c26be411bf1..9eea9d68c15 100644
--- a/engines/saga2/mouseimg.cpp
+++ b/engines/saga2/mouseimg.cpp
@@ -354,7 +354,7 @@ void setMouseText(char *text) {
void setMouseTextF(char *format, ...) {
if (format == nullptr) {
setMouseText(nullptr);
- g_vm->_toolBase->mouseHintSet = true;
+ g_vm->_toolBase->_mouseHintSet = true;
} else {
char lineBuf[128];
va_list argptr;
@@ -364,7 +364,7 @@ void setMouseTextF(char *format, ...) {
va_end(argptr);
setMouseText(lineBuf);
- g_vm->_toolBase->mouseHintSet = true;
+ g_vm->_toolBase->_mouseHintSet = true;
}
}
diff --git a/engines/saga2/msgbox.cpp b/engines/saga2/msgbox.cpp
index 03c11633c22..f0644332df6 100644
--- a/engines/saga2/msgbox.cpp
+++ b/engines/saga2/msgbox.cpp
@@ -106,11 +106,11 @@ APPFUNC(ErrorWindow::cmdMessageWindow) {
if (ev.panel && ev.eventType == gEventNewValue && ev.value) {
win = ev.panel->getWindow(); // get the window pointer
- ri = win ? (requestInfo *)win->userData : nullptr;
+ ri = win ? (requestInfo *)win->_userData : nullptr;
if (ri) {
ri->running = 0;
- ri->result = ev.panel->id;
+ ri->result = ev.panel->_id;
}
}
}
@@ -151,7 +151,7 @@ ErrorWindow::ErrorWindow(const char *msg, const char *btnMsg1, const char *btnMs
}
}
- userData = &_rInfo;
+ _userData = &_rInfo;
}
@@ -212,7 +212,7 @@ SimpleWindow::SimpleWindow(const Rect16 &r,
GameMode *gameModes[] = {&PlayMode, &TileMode, &SimpleMode};
GameMode::SetStack(gameModes, 3);
- title = stitle;
+ _title = stitle;
}
SimpleWindow::~SimpleWindow() {
@@ -251,7 +251,7 @@ void SimpleWindow::drawClipped(
g_vm->_pointer->hide(port, _extent); // hide mouse pointer
DrawOutlineFrame(port, _extent, windowColor);
- writeWrappedPlaqText(port, box, mbButtonFont, textPos, pal, false, title);
+ writeWrappedPlaqText(port, box, mbButtonFont, textPos, pal, false, _title);
gWindow::drawClipped(port, p, r);
@@ -344,13 +344,13 @@ SimpleButton::SimpleButton(gWindow &win, const Rect16 &box, const char *title_,
}
void SimpleButton::deactivate() {
- selected = 0;
+ _selected = 0;
draw();
gPanel::deactivate();
}
bool SimpleButton::activate(gEventType why) {
- selected = 1;
+ _selected = 1;
draw();
if (why == gEventKeyDown) { // momentarily depress
@@ -371,21 +371,21 @@ bool SimpleButton::pointerHit(gPanelMessage &) {
void SimpleButton::pointerRelease(gPanelMessage &) {
// We have to test selected first because deactivate clears it.
- if (selected) {
+ if (_selected) {
deactivate(); // give back input focus
notify(gEventNewValue, 1); // notify App of successful hit
} else deactivate();
}
void SimpleButton::pointerDrag(gPanelMessage &msg) {
- if (selected != msg.inPanel) {
- selected = msg.inPanel;
+ if (_selected != msg._inPanel) {
+ _selected = msg._inPanel;
draw();
}
}
void SimpleButton::draw() {
- gDisplayPort &port = _window->windowPort;
+ gDisplayPort &port = _window->_windowPort;
Rect16 rect = _window->getExtent();
SAVE_GPORT_STATE(port); // save pen color, etc.
diff --git a/engines/saga2/panel.cpp b/engines/saga2/panel.cpp
index 9690d62c053..eb03b61d037 100644
--- a/engines/saga2/panel.cpp
+++ b/engines/saga2/panel.cpp
@@ -39,7 +39,7 @@ namespace Saga2 {
extern char iniFile[];
// Function to enable/disable user interface keys
-extern bool enableUIKeys(bool enabled);
+extern bool enableUIKeys(bool _enabled);
/* ======================================================================= *
global dispatcher base
@@ -56,69 +56,69 @@ int lockUINest = 0;
* ======================================================================= */
gPanel::gPanel(gWindow &win, const Rect16 &box, AppFunc *cmd)
- : window(win), _extent(box), command(cmd) {
- enabled = 1;
- ghosted = 0;
- selected = 0;
- imageLabel = 0;
- title = nullptr;
- id = 0;
- wantMousePoll = 0;
- userData = nullptr;
+ : _window(win), _extent(box), _command(cmd) {
+ _enabled = 1;
+ _ghosted = 0;
+ _selected = 0;
+ _imageLabel = 0;
+ _title = nullptr;
+ _id = 0;
+ _wantMousePoll = 0;
+ _userData = nullptr;
}
gPanel::gPanel(gPanelList &list, const Rect16 &box,
const char *newTitle, uint16 ident, AppFunc *cmd)
- : window(list.window) {
- title = newTitle;
+ : _window(list._window) {
+ _title = newTitle;
_extent = box;
- enabled = 1;
- ghosted = 0;
- selected = 0;
- imageLabel = 0;
- command = cmd;
- id = ident;
- wantMousePoll = 0;
- userData = nullptr;
+ _enabled = 1;
+ _ghosted = 0;
+ _selected = 0;
+ _imageLabel = 0;
+ _command = cmd;
+ _id = ident;
+ _wantMousePoll = 0;
+ _userData = nullptr;
}
gPanel::gPanel(gPanelList &list, const Rect16 &box,
gPixelMap &pic, uint16 ident, AppFunc *cmd)
- : window(list.window) {
- title = (char *)&pic;
+ : _window(list._window) {
+ _title = (char *)&pic;
_extent = box;
- enabled = 1;
- ghosted = 0;
- selected = 0;
- imageLabel = 1;
- command = cmd;
- id = ident;
- wantMousePoll = 0;
- userData = nullptr;
+ _enabled = 1;
+ _ghosted = 0;
+ _selected = 0;
+ _imageLabel = 1;
+ _command = cmd;
+ _id = ident;
+ _wantMousePoll = 0;
+ _userData = nullptr;
}
gPanel::gPanel(gPanelList &list, const StaticRect &box,
const char *newTitle, uint16 ident, AppFunc *cmd)
- : window(list.window) {
- title = newTitle;
+ : _window(list._window) {
+ _title = newTitle;
_extent = Rect16(box);
- enabled = 1;
- ghosted = 0;
- selected = 0;
- imageLabel = 0;
- command = cmd;
- id = ident;
- wantMousePoll = 0;
- userData = nullptr;
+ _enabled = 1;
+ _ghosted = 0;
+ _selected = 0;
+ _imageLabel = 0;
+ _command = cmd;
+ _id = ident;
+ _wantMousePoll = 0;
+ _userData = nullptr;
}
// Dummy virtual functions
gPanel::~gPanel() {
- if (this == g_vm->_toolBase->mousePanel)
- g_vm->_toolBase->mousePanel = nullptr;
- if (this == g_vm->_toolBase->activePanel)
- g_vm->_toolBase->activePanel = nullptr;
+ if (this == g_vm->_toolBase->_mousePanel)
+ g_vm->_toolBase->_mousePanel = nullptr;
+ if (this == g_vm->_toolBase->_activePanel)
+ g_vm->_toolBase->_activePanel = nullptr;
}
void gPanel::draw() {}
void gPanel::drawClipped(gPort &, const Point16 &, const Rect16 &) {}
@@ -138,19 +138,19 @@ void gPanel::timerTick(gPanelMessage &) {}
void gPanel::onMouseHintDelay() {}
void gPanel::enable(bool abled) {
- enabled = abled ? 1 : 0;
+ _enabled = abled ? 1 : 0;
}
void gPanel::select(uint16 sel) {
- selected = sel ? 1 : 0;
+ _selected = sel ? 1 : 0;
}
void gPanel::ghost(bool b) {
- ghosted = b ? 1 : 0;
+ _ghosted = b ? 1 : 0;
}
bool gPanel::isActive() {
- return (this == g_vm->_toolBase->activePanel);
+ return (this == g_vm->_toolBase->_activePanel);
}
void gPanel::notify(enum gEventType type, int32 value) {
@@ -159,12 +159,12 @@ void gPanel::notify(enum gEventType type, int32 value) {
ev.panel = this;
ev.eventType = type;
ev.value = value;
- ev.mouse.x = g_vm->_toolBase->pickPos.x - _extent.x;
- ev.mouse.y = g_vm->_toolBase->pickPos.y - _extent.y;
- ev.window = &window;
+ ev.mouse.x = g_vm->_toolBase->_pickPos.x - _extent.x;
+ ev.mouse.y = g_vm->_toolBase->_pickPos.y - _extent.y;
+ ev.window = &_window;
- if (command) command(ev);
- else if (this != &window) window.notify(ev);
+ if (_command) _command(ev);
+ else if (this != &_window) _window.notify(ev);
}
bool gPanel::activate(gEventType) {
@@ -172,7 +172,7 @@ bool gPanel::activate(gEventType) {
}
void gPanel::deactivate() {
- if (isActive()) g_vm->_toolBase->activePanel = nullptr;
+ if (isActive()) g_vm->_toolBase->_activePanel = nullptr;
}
void gPanel::makeActive() {
@@ -181,24 +181,24 @@ void gPanel::makeActive() {
void gPanel::invalidate(Rect16 *) {
assert(displayEnabled());
- window.update(_extent);
+ _window.update(_extent);
}
void gPanel::drawTitle(enum text_positions placement) {
- gPort &port = window.windowPort;
+ gPort &port = _window._windowPort;
Rect16 r = _extent;
const gPixelMap *img = nullptr;
- if (title == nullptr)
+ if (_title == nullptr)
return;
- if (imageLabel) {
- img = (const gPixelMap *)title;
+ if (_imageLabel) {
+ img = (const gPixelMap *)_title;
r.width = img->_size.x;
r.height = img->_size.y;
} else {
- r.width = TextWidth(mainFont, title, -1, textStyleUnderBar);
+ r.width = TextWidth(mainFont, _title, -1, textStyleUnderBar);
r.height = mainFont->height;
}
@@ -231,7 +231,7 @@ void gPanel::drawTitle(enum text_positions placement) {
SAVE_GPORT_STATE(port); // save pen color, etc.
- if (imageLabel) {
+ if (_imageLabel) {
port.setIndirectColor(blackPen); // pen color black
port.setMode(drawModeColor); // draw as glyph
port.bltPixels(*img, 0, 0, r.x, r.y, r.width, r.height);
@@ -242,13 +242,13 @@ void gPanel::drawTitle(enum text_positions placement) {
port.moveTo(r.x, r.y); // move to new text pos
g_vm->_pointer->hide(*globalPort, r); // hide the pointer
- port.drawText(title, -1); // draw the text
+ port.drawText(_title, -1); // draw the text
g_vm->_pointer->show(*globalPort, r); // hide the pointer
}
}
gPanel *gPanel::hitTest(const Point16 &p) {
- return enabled && !ghosted && _extent.ptInside(p) ? this : nullptr;
+ return _enabled && !_ghosted && _extent.ptInside(p) ? this : nullptr;
}
gPanel *gPanel::keyTest(int16) {
@@ -264,29 +264,29 @@ gPanel *gPanel::keyTest(int16) {
gPanelList::gPanelList(gWindow &win, const Rect16 &box, char *newTitle,
uint16 ident, AppFunc *cmd)
: gPanel(win, box, cmd) {
- title = newTitle;
- id = ident;
+ _title = newTitle;
+ _id = ident;
}
// Constructor for standalone panels..
gPanelList::gPanelList(gPanelList &list)
- : gPanel(list, list.window.getExtent(), nullptr, 0, nullptr) {
- window.contents.push_back(this);
+ : gPanel(list, list._window.getExtent(), nullptr, 0, nullptr) {
+ _window._contents.push_back(this);
}
gPanelList::~gPanelList() {
removeControls();
- window.contents.remove(this);
+ _window._contents.remove(this);
}
void gPanelList::removeControls() {
gPanel *ctl;
// Delete all sub-panels.
- while (contents.size()) {
- ctl = contents.front();
- contents.remove(ctl);
+ while (_contents.size()) {
+ ctl = _contents.front();
+ _contents.remove(ctl);
delete ctl;
}
}
@@ -303,15 +303,15 @@ void gPanelList::invalidate(Rect16 *) {
assert(displayEnabled());
if (displayEnabled())
- if (contents.size()) {
- ctl = contents.back();
+ if (_contents.size()) {
+ ctl = _contents.back();
invArea = ctl->getExtent();
- for (Common::List<gPanel *>::iterator it = contents.reverse_begin(); it != contents.end(); --it) {
+ for (Common::List<gPanel *>::iterator it = _contents.reverse_begin(); it != _contents.end(); --it) {
ctl = *it;
invArea = bound(invArea, ctl->getExtent());
}
- window.update(invArea);
+ _window.update(invArea);
}
}
@@ -319,8 +319,8 @@ void gPanelList::draw() {
gPanel *ctl;
if (displayEnabled())
- if (enabled) {
- for (Common::List<gPanel *>::iterator it = contents.reverse_begin(); it != contents.end(); --it) {
+ if (_enabled) {
+ for (Common::List<gPanel *>::iterator it = _contents.reverse_begin(); it != _contents.end(); --it) {
ctl = *it;
if (ctl->getEnabled())
ctl->draw();
@@ -337,8 +337,8 @@ void gPanelList::drawClipped(
Rect16 tmpR = r - Point16(_extent.x, _extent.y);
if (displayEnabled())
- if (enabled) {
- for (Common::List<gPanel *>::iterator it = contents.reverse_begin(); it != contents.end(); --it) {
+ if (_enabled) {
+ for (Common::List<gPanel *>::iterator it = _contents.reverse_begin(); it != _contents.end(); --it) {
ctl = *it;
if (ctl->getEnabled())
ctl->drawClipped(port, tmpOffset, tmpR);
@@ -350,8 +350,8 @@ gPanel *gPanelList::hitTest(const Point16 &p) {
gPanel *ctl;
gPanel *result;
- if (enabled && !ghosted) {
- for (Common::List<gPanel *>::iterator it = contents.begin(); it != contents.end(); ++it) {
+ if (_enabled && !_ghosted) {
+ for (Common::List<gPanel *>::iterator it = _contents.begin(); it != _contents.end(); ++it) {
ctl = *it;
if ((result = ctl->hitTest(p)) != nullptr)
return result;
@@ -364,8 +364,8 @@ gPanel *gPanelList::keyTest(int16 key) {
gPanel *ctl;
gPanel *result;
- if (enabled && !ghosted) {
- for (Common::List<gPanel *>::iterator it = contents.reverse_begin(); it != contents.end(); --it) {
+ if (_enabled && !_ghosted) {
+ for (Common::List<gPanel *>::iterator it = _contents.reverse_begin(); it != _contents.end(); --it) {
ctl = *it;
if ((result = ctl->keyTest(key)) != nullptr)
return result;
@@ -381,15 +381,14 @@ gPanel *gPanelList::keyTest(int16 key) {
// gWindow static variables
-int gWindow::dragMode = 0; // current dragging mode
-StaticRect gWindow::dragExtent = {0, 0, 0, 0}; // dragging extent
-StaticPoint16 gWindow::dragOffset = {0, 0}; // offset to window origin
+int gWindow::_dragMode = 0; // current dragging mode
+StaticRect gWindow::_dragExtent = {0, 0, 0, 0}; // dragging extent
+StaticPoint16 gWindow::_dragOffset = {0, 0}; // offset to window origin
gWindow::gWindow(const Rect16 &box, uint16 ident, const char saveName[], AppFunc *cmd)
- : gPanelList(*this, box, nullptr, ident, cmd)
+ : gPanelList(*this, box, nullptr, ident, cmd) {
//, saver(WIIFF_POS|WIIFS_NORMAL|WIIFE_ONEXIT,iniFile,saveName,box,this)
-{
- openFlag = false;
+ _openFlag = false;
// pointerImage = &arrowPtr;
// pointerOffset = Point16( 0, 0 );
@@ -399,8 +398,8 @@ gWindow::gWindow(const Rect16 &box, uint16 ident, const char saveName[], AppFunc
// Set up the window's gPort
- windowPort.setFont(mainFont);
- windowPort.setPenMap(globalPort->_penMap);
+ _windowPort.setFont(mainFont);
+ _windowPort.setPenMap(globalPort->_penMap);
/* if (windowFeatures & windowBackSaved) // backsave data under window
{
@@ -433,8 +432,8 @@ bool gWindow::open() {
// Send a "pointer-leave" message to mouse panel.
g_vm->_toolBase->leavePanel();
- g_vm->_toolBase->windowList.push_front(this);
- g_vm->_toolBase->activeWindow = this;
+ g_vm->_toolBase->_windowList.push_front(this);
+ g_vm->_toolBase->_activeWindow = this;
g_vm->_toolBase->setActive(nullptr);
// g_vm->_pointer->hide();
@@ -442,7 +441,7 @@ bool gWindow::open() {
// g_vm->_pointer->setImage( *pointerImage, pointerOffset.x, pointerOffset.y );
// g_vm->_pointer->show();
- openFlag = true;
+ _openFlag = true;
draw();
return true;
@@ -453,22 +452,22 @@ void gWindow::close() {
if (!isOpen()) return;
// If any panels on this window are active, then deactivate them.
- if (g_vm->_toolBase->activePanel && g_vm->_toolBase->activePanel->getWindow() == this)
- g_vm->_toolBase->activePanel->deactivate();
+ if (g_vm->_toolBase->_activePanel && g_vm->_toolBase->_activePanel->getWindow() == this)
+ g_vm->_toolBase->_activePanel->deactivate();
// Don't close a window that is being dragged (should never happen,
// but just in case).
if (DragBar::_dragWindow == (FloatingWindow *)this)
return;
- openFlag = false;
+ _openFlag = false;
// remove this window from the window list.
- g_vm->_toolBase->windowList.remove(this);
+ g_vm->_toolBase->_windowList.remove(this);
- g_vm->_toolBase->mouseWindow = g_vm->_toolBase->activeWindow = g_vm->_toolBase->windowList.front();
- g_vm->_toolBase->mousePanel = g_vm->_toolBase->activePanel = nullptr;
+ g_vm->_toolBase->_mouseWindow = g_vm->_toolBase->_activeWindow = g_vm->_toolBase->_windowList.front();
+ g_vm->_toolBase->_mousePanel = g_vm->_toolBase->_activePanel = nullptr;
}
// Move the window to the front...
@@ -476,11 +475,11 @@ void gWindow::close() {
void gWindow::toFront() { // re-order the windows
if (!isOpen()) return;
- g_vm->_toolBase->windowList.remove(this);
- g_vm->_toolBase->windowList.push_front(this);
+ g_vm->_toolBase->_windowList.remove(this);
+ g_vm->_toolBase->_windowList.push_front(this);
- g_vm->_toolBase->activePanel = nullptr;
- g_vm->_toolBase->activeWindow = this;
+ g_vm->_toolBase->_activePanel = nullptr;
+ g_vm->_toolBase->_activeWindow = this;
// redraw the window
update(_extent);
@@ -500,14 +499,14 @@ void gWindow::setPos(Point16 pos) {
// We also need to set up the window's port in a similar fashion.
- windowPort._origin.x = _extent.x;
- windowPort._origin.y = _extent.y;
+ _windowPort._origin.x = _extent.x;
+ _windowPort._origin.y = _extent.y;
// set port's clip
newClip = intersect(_extent, g_vm->_mainPort._clip);
newClip.x -= _extent.x;
newClip.y -= _extent.y;
- windowPort.setClip(newClip);
+ _windowPort.setClip(newClip);
//saver.onMove(this);
// if (backSave) backSave->setPos( pos );
@@ -523,7 +522,7 @@ void gWindow::setExtent(const Rect16 &r) {
// insert window into window list
void gWindow::insert() {
- g_vm->_toolBase->windowList.push_front(this);
+ g_vm->_toolBase->_windowList.push_front(this);
}
@@ -531,13 +530,13 @@ void gWindow::insert() {
// redefine the address of the pixel map.
void gWindow::deactivate() {
- selected = 0;
+ _selected = 0;
gPanel::deactivate();
}
bool gWindow::activate(gEventType why) {
if (why == gEventMouseDown) { // momentarily depress
- selected = 1;
+ _selected = 1;
notify(why, 0); // notify App of successful hit
return true;
}
@@ -554,13 +553,13 @@ bool gWindow::pointerHit(gPanelMessage &) {
}
void gWindow::pointerDrag(gPanelMessage &) {
- if (selected) {
+ if (_selected) {
notify(gEventMouseDrag, 0);
}
}
void gWindow::pointerRelease(gPanelMessage &) {
- if (selected) notify(gEventMouseUp, 0); // notify App of successful hit
+ if (_selected) notify(gEventMouseUp, 0); // notify App of successful hit
deactivate();
}
@@ -594,7 +593,7 @@ void gWindow::setPointer( gPixelMap &map, int x, int y )
pointerOffset.x = x;
pointerOffset.y = y;
- if (this == g_vm->_toolBase->activeWindow)
+ if (this == g_vm->_toolBase->_activeWindow)
{
g_vm->_pointer->hide();
g_vm->_pointer->setImage( *pointerImage, pointerOffset.x, pointerOffset.y );
@@ -609,36 +608,36 @@ void gWindow::setPointer( gPixelMap &map, int x, int y )
gControl::gControl(gPanelList &list, const Rect16 &box, const char *title_, uint16 ident,
AppFunc *cmd) : gPanel(list, box, title_, ident, cmd) {
- accelKey = 0;
+ _accelKey = 0;
// Add control to the window's control list.
_list = &list;
- list.contents.push_back(this);
+ list._contents.push_back(this);
}
gControl::gControl(gPanelList &list, const Rect16 &box, gPixelMap &img, uint16 ident,
AppFunc *cmd) : gPanel(list, box, img, ident, cmd) {
- accelKey = 0;
+ _accelKey = 0;
// Add control to the window's control list.
_list = &list;
- list.contents.push_back(this);
+ list._contents.push_back(this);
}
gControl::~gControl() {
- _list->contents.remove(this);
+ _list->_contents.remove(this);
}
gControl::gControl(gPanelList &list, const StaticRect &box, const char *title_, uint16 ident,
AppFunc *cmd) : gPanel(list, box, title_, ident, cmd) {
- accelKey = 0;
+ _accelKey = 0;
// Add control to the window's control list.
_list = &list;
- list.contents.push_back(this);
+ list._contents.push_back(this);
}
void gControl::enable(bool abled) {
@@ -663,7 +662,7 @@ void gControl::ghost(bool sel) {
}
gPanel *gControl::keyTest(int16 key) {
- return accelKey == key ? this : nullptr;
+ return _accelKey == key ? this : nullptr;
}
// For many controls, the only drawing routine we need is the
@@ -671,12 +670,12 @@ gPanel *gControl::keyTest(int16 key) {
// drawClipped with the main port.
void gControl::draw() {
- g_vm->_pointer->hide(window.windowPort, _extent);
+ g_vm->_pointer->hide(_window._windowPort, _extent);
if (displayEnabled())
drawClipped(*globalPort,
- Point16(-window._extent.x, -window._extent.y),
- window._extent);
- g_vm->_pointer->show(window.windowPort, _extent);
+ Point16(-_window._extent.x, -_window._extent.y),
+ _window._extent);
+ g_vm->_pointer->show(_window._windowPort, _extent);
}
/* ===================================================================== *
@@ -686,31 +685,31 @@ void gControl::draw() {
gGenericControl::gGenericControl(gPanelList &list, const Rect16 &box,
uint16 ident, AppFunc *cmd)
: gControl(list, box, nullptr, ident, cmd) {
- dblClickFlag = false;
+ _dblClickFlag = false;
}
bool gGenericControl::activate(gEventType) {
- selected = 1;
+ _selected = 1;
return true;
}
void gGenericControl::deactivate() {
- selected = 0;
+ _selected = 0;
gPanel::deactivate();
}
void gGenericControl::pointerMove(gPanelMessage &msg) {
- notify(gEventMouseMove, (msg.pointerEnter ? enter : 0) | (msg.pointerLeave ? leave : 0));
+ notify(gEventMouseMove, (msg._pointerEnter ? enter : 0) | (msg._pointerLeave ? leave : 0));
}
bool gGenericControl::pointerHit(gPanelMessage &msg) {
- if (msg.rightButton)
+ if (msg._rightButton)
notify(gEventRMouseDown, 0);
- else if (msg.doubleClick && !dblClickFlag) {
- dblClickFlag = true;
+ else if (msg._doubleClick && !_dblClickFlag) {
+ _dblClickFlag = true;
notify(gEventDoubleClick, 0);
} else {
- dblClickFlag = false;
+ _dblClickFlag = false;
notify(gEventMouseDown, 0);
}
@@ -735,13 +734,13 @@ void gGenericControl::draw() {
* ===================================================================== */
void gToolBase::setActive(gPanel *ctl) {
- if (activePanel && activePanel == ctl) return;
- if (activePanel) activePanel->deactivate();
- if (ctl == nullptr || ctl->activate(gEventNone)) activePanel = ctl;
+ if (_activePanel && _activePanel == ctl) return;
+ if (_activePanel) _activePanel->deactivate();
+ if (ctl == nullptr || ctl->activate(gEventNone)) _activePanel = ctl;
}
void gToolBase::handleMouse(Common::Event &event, uint32 time) {
- gWindow *w = activeWindow;
+ gWindow *w = _activeWindow;
gPanel *ctl,
*pickPanel = nullptr;
static gMouseState prevState;
@@ -785,8 +784,8 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) {
if (prevState.pos != _curMouseState.pos
&& prevState.left != _curMouseState.left
&& prevState.right != _curMouseState.right) {
- lastMouseMoveTime = msg.timeStamp;
- if (mouseHintSet)
+ _lastMouseMoveTime = _msg._timeStamp;
+ if (_mouseHintSet)
setMouseTextF(nullptr);
}
@@ -799,60 +798,60 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) {
// Set up the pick position relative to the window
- if (activePanel) {
- pickPos.x = _curMouseState.pos.x - activePanel->window._extent.x;
- pickPos.y = _curMouseState.pos.y - activePanel->window._extent.y;
+ if (_activePanel) {
+ _pickPos.x = _curMouseState.pos.x - _activePanel->_window._extent.x;
+ _pickPos.y = _curMouseState.pos.y - _activePanel->_window._extent.y;
} else {
- pickPos.x = _curMouseState.pos.x - w->_extent.x;
- pickPos.y = _curMouseState.pos.y - w->_extent.y;
+ _pickPos.x = _curMouseState.pos.x - w->_extent.x;
+ _pickPos.y = _curMouseState.pos.y - w->_extent.y;
}
// Fill in the message to be sent to the various panels
- msg.pickAbsPos = pickPos;
- msg.leftButton = _curMouseState.left ? 1 : 0;
- msg.rightButton = _curMouseState.right ? 1 : 0;
- msg.pointerEnter = 0;
- msg.pointerLeave = 0;
- msg.doubleClick = 0;
- msg.timeStamp = time;
-
- if (((_curMouseState.left && !leftDrag) // if left button hit
- || (_curMouseState.right && !rightDrag)) // or right button hit
- && activePanel != nullptr) { // and a panel is active
+ _msg._pickAbsPos = _pickPos;
+ _msg._leftButton = _curMouseState.left ? 1 : 0;
+ _msg._rightButton = _curMouseState.right ? 1 : 0;
+ _msg._pointerEnter = 0;
+ _msg._pointerLeave = 0;
+ _msg._doubleClick = 0;
+ _msg._timeStamp = time;
+
+ if (((_curMouseState.left && !_leftDrag) // if left button hit
+ || (_curMouseState.right && !_rightDrag)) // or right button hit
+ && _activePanel != nullptr) { // and a panel is active
// Then we have a button hit event. If the button hit
// is occuring outside the panel, then it should be
- // deselected.
+ // de_selected.
- if (activePanel->_extent.ptInside(pickPos) == false)
- activePanel->deactivate();
+ if (_activePanel->_extent.ptInside(_pickPos) == false)
+ _activePanel->deactivate();
}
if (prevState.pos == _curMouseState.pos) ; // don't do anything if same pos
- else if (activePanel) { // if control active
- mousePanel = activePanel; // assume mouse over active panel
+ else if (_activePanel) { // if control active
+ _mousePanel = _activePanel; // assume mouse over active panel
- if (leftDrag || rightDrag) {
- setMsg(msg, activePanel); // set up gPanelMessage
- activePanel->pointerDrag(msg); // send panel a mouse movement
+ if (_leftDrag || _rightDrag) {
+ setMsg(_msg, _activePanel); // set up gPanelMessage
+ _activePanel->pointerDrag(_msg); // send panel a mouse movement
} else {
- setMsg(msg, activePanel); // set up gPanelMessage
- activePanel->pointerMove(msg); // send panel a mouse movement
+ setMsg(_msg, _activePanel); // set up gPanelMessage
+ _activePanel->pointerMove(_msg); // send panel a mouse movement
}
}
- if (!activePanel /* && !ms.right */) {
+ if (!_activePanel /* && !ms.right */) {
// If the point is within the window
Common::List<gWindow *>::iterator it;
- for (it = windowList.begin(); it != windowList.end(); ++it) {
+ for (it = _windowList.begin(); it != _windowList.end(); ++it) {
w = *it;
if (w->_extent.ptInside(_curMouseState.pos) || w->isModal()) {
// Set up the pick position relative to the window
- pickPos.x = _curMouseState.pos.x - w->_extent.x;
- pickPos.y = _curMouseState.pos.y - w->_extent.y;
+ _pickPos.x = _curMouseState.pos.x - w->_extent.x;
+ _pickPos.y = _curMouseState.pos.y - w->_extent.y;
- if ((ctl = w->hitTest(pickPos)) != nullptr)
+ if ((ctl = w->hitTest(_pickPos)) != nullptr)
pickPanel = ctl;
else
pickPanel = w;
@@ -861,36 +860,36 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) {
}
}
- if (it == windowList.end()) {
+ if (it == _windowList.end()) {
prevState = _curMouseState;
return;
}
- mouseWindow = w;
+ _mouseWindow = w;
// If the mouse is not over the control any more, tell it so.
- if (mousePanel && mousePanel != pickPanel) {
- if (&mousePanel->window != w) {
- // Temporarily adjust pickPos to be relative to the old panel's window
+ if (_mousePanel && _mousePanel != pickPanel) {
+ if (&_mousePanel->_window != w) {
+ // Temporarily adjust _pickPos to be relative to the old panel's window
// instead of the new panel's window.
- pickPos.x = _curMouseState.pos.x - mousePanel->window._extent.x;
- pickPos.y = _curMouseState.pos.y - mousePanel->window._extent.y;
+ _pickPos.x = _curMouseState.pos.x - _mousePanel->_window._extent.x;
+ _pickPos.y = _curMouseState.pos.y - _mousePanel->_window._extent.y;
- setMsgQ(msg, mousePanel); // set up gPanelMessage
+ setMsgQ(_msg, _mousePanel); // set up gPanelMessage
- pickPos.x = _curMouseState.pos.x - w->_extent.x;
- pickPos.y = _curMouseState.pos.y - w->_extent.y;
+ _pickPos.x = _curMouseState.pos.x - w->_extent.x;
+ _pickPos.y = _curMouseState.pos.y - w->_extent.y;
} else {
- setMsgQ(msg, mousePanel); // set up gPanelMessage
+ setMsgQ(_msg, _mousePanel); // set up gPanelMessage
}
-// msg.pickPos.x = pickPos.x - mousePanel->extent.x;
-// msg.pickPos.y = pickPos.y - mousePanel->extent.y;
- msg.inPanel = 0;
- msg.pointerEnter = 0;
- msg.pointerLeave = 1;
+// _msg._pickPos.x = _pickPos.x - _mousePanel->extent.x;
+// _msg._pickPos.y = _pickPos.y - _mousePanel->extent.y;
+ _msg._inPanel = 0;
+ _msg._pointerEnter = 0;
+ _msg._pointerLeave = 1;
- mousePanel->pointerMove(msg);
+ _mousePanel->pointerMove(_msg);
}
@@ -898,24 +897,24 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) {
// mouse control.
if (pickPanel) {
- setMsg(msg, pickPanel); // set up gPanelMessage
-// msg.pickPos.x = pickPos.x - pickPanel->extent.x;
-// msg.pickPos.y = pickPos.y - pickPanel->extent.y;
- msg.leftButton = _curMouseState.left ? 1 : 0;
-// msg.inPanel = pickPanel->extent.ptInside(pickPos);
- msg.pointerEnter = (mousePanel == pickPanel) ? 0 : 1;
- msg.pointerLeave = 0;
-
- mousePanel = pickPanel;
- mousePanel->pointerMove(msg);
+ setMsg(_msg, pickPanel); // set up gPanelMessage
+// _msg._pickPos.x = _pickPos.x - pickPanel->extent.x;
+// _msg._pickPos.y = _pickPos.y - pickPanel->extent.y;
+ _msg._leftButton = _curMouseState.left ? 1 : 0;
+// _msg._inPanel = pickPanel->extent.ptInside(_pickPos);
+ _msg._pointerEnter = (_mousePanel == pickPanel) ? 0 : 1;
+ _msg._pointerLeave = 0;
+
+ _mousePanel = pickPanel;
+ _mousePanel->pointerMove(_msg);
} else
- mousePanel = nullptr;
+ _mousePanel = nullptr;
}
// Fix up flags because earlier code may have changed them
- msg.pointerEnter = 0;
- msg.pointerLeave = 0;
+ _msg._pointerEnter = 0;
+ _msg._pointerLeave = 0;
// Send appropriate button-press messages to the panels
@@ -932,54 +931,54 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) {
// 1/3 of a second, and that the mouse ptr hasn't moved
// very much.
- if (((uint32)(msg.timeStamp - lastClickTime) < 333)
+ if (((uint32)(_msg._timeStamp - lastClickTime) < 333)
|| _curMouseState.left > 1
|| _curMouseState.right > 1) {
Point16 diff = lastClickPos - _curMouseState.pos;
if (ABS(diff.x) + ABS(diff.y) < 6)
- msg.doubleClick = 1;
+ _msg._doubleClick = 1;
}
// Record the last mouse time and position for
// future double-click checks.
- lastClickTime = msg.timeStamp;
+ lastClickTime = _msg._timeStamp;
lastClickPos = _curMouseState.pos;
- if (mousePanel) { // if over a control
- setMsgQ(msg, mousePanel); // set up gPanelMessage
-// msg.pickPos.x = pickPos.x - mousePanel->extent.x;
-// msg.pickPos.y = pickPos.y - mousePanel->extent.y;
- msg.inPanel = 1;
+ if (_mousePanel) { // if over a control
+ setMsgQ(_msg, _mousePanel); // set up gPanelMessage
+// _msg._pickPos.x = _pickPos.x - _mousePanel->extent.x;
+// _msg._pickPos.y = _pickPos.y - _mousePanel->extent.y;
+ _msg._inPanel = 1;
- if (activeWindow && activeWindow->isModal()) {
- mouseWindow = activeWindow;
- } else if (mouseWindow == nullptr) {
- mouseWindow = &mousePanel->window;
+ if (_activeWindow && _activeWindow->isModal()) {
+ _mouseWindow = _activeWindow;
+ } else if (_mouseWindow == nullptr) {
+ _mouseWindow = &_mousePanel->_window;
}
- if (mouseWindow && mouseWindow != activeWindow) {
- msg.pickAbsPos = pickPos;
+ if (_mouseWindow && _mouseWindow != _activeWindow) {
+ _msg._pickAbsPos = _pickPos;
// Re-order the windows.
- mouseWindow->toFront();
+ _mouseWindow->toFront();
}
// send it a hit message
- if (mousePanel->pointerHit(msg)) {
- activePanel = mousePanel;
+ if (_mousePanel->pointerHit(_msg)) {
+ _activePanel = _mousePanel;
if (_curMouseState.left)
- leftDrag = true;
+ _leftDrag = true;
else
- rightDrag = true;
+ _rightDrag = true;
}
}
- } else if ((leftDrag && _curMouseState.left == false) // check for release
- || (rightDrag && _curMouseState.right == false)) {
- if (activePanel && mousePanel) { // if a control is active
- setMsg(msg, mousePanel); // send it a release message
- mousePanel->pointerRelease(msg);
+ } else if ((_leftDrag && _curMouseState.left == false) // check for release
+ || (_rightDrag && _curMouseState.right == false)) {
+ if (_activePanel && _mousePanel) { // if a control is active
+ setMsg(_msg, _mousePanel); // send it a release message
+ _mousePanel->pointerRelease(_msg);
}
- leftDrag = rightDrag = false;
+ _leftDrag = _rightDrag = false;
}
}
@@ -987,22 +986,22 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) {
}
void gToolBase::leavePanel() {
- msg.timeStamp = g_system->getMillis();
+ _msg._timeStamp = g_system->getMillis();
- if (mousePanel) {
- msg.inPanel = 0;
- msg.pointerEnter = 0;
- msg.pointerLeave = 1;
+ if (_mousePanel) {
+ _msg._inPanel = 0;
+ _msg._pointerEnter = 0;
+ _msg._pointerLeave = 1;
- mousePanel->pointerMove(msg);
- mousePanel = nullptr;
+ _mousePanel->pointerMove(_msg);
+ _mousePanel = nullptr;
}
- if (activePanel) activePanel->deactivate();
+ if (_activePanel) _activePanel->deactivate();
}
void gToolBase::handleKeyStroke(Common::Event &event) {
- gWindow *w = activeWindow;
+ gWindow *w = _activeWindow;
gPanel *ctl;
uint16 key = event.kbd.ascii; // FIXME
@@ -1017,16 +1016,16 @@ void gToolBase::handleKeyStroke(Common::Event &event) {
if (event.kbd.flags & Common::KBD_ALT)
qualifier |= qualifierAlt;
- msg.pickAbsPos = pickPos;
- msg.pointerEnter = 0;
- msg.pointerLeave = 0;
- msg.key = key;
- msg.qualifier = qualifier;
- msg.timeStamp = g_system->getMillis();
+ _msg._pickAbsPos = _pickPos;
+ _msg._pointerEnter = 0;
+ _msg._pointerLeave = 0;
+ _msg._key = key;
+ _msg._qualifier = qualifier;
+ _msg._timeStamp = g_system->getMillis();
- if (activePanel) { // send keystroke to active panel
- setMsg(msg, activePanel); // set up gPanelMessage
- if (activePanel->keyStroke(msg))
+ if (_activePanel) { // send keystroke to active panel
+ setMsg(_msg, _activePanel); // set up gPanelMessage
+ if (_activePanel->keyStroke(_msg))
return;
}
@@ -1041,10 +1040,10 @@ void gToolBase::handleKeyStroke(Common::Event &event) {
k = toupper(k);
if ((ctl = w->keyTest(k)) != nullptr) {
- if (activePanel == ctl) return;
- if (activePanel) activePanel->deactivate();
+ if (_activePanel == ctl) return;
+ if (_activePanel) _activePanel->deactivate();
if (ctl->activate(gEventKeyDown)) {
- activePanel = ctl;
+ _activePanel = ctl;
return;
}
}
@@ -1052,7 +1051,7 @@ void gToolBase::handleKeyStroke(Common::Event &event) {
// Try sending the message to the window
- if (w->keyStroke(msg))
+ if (w->keyStroke(_msg))
return;
// else send the message to the app.
@@ -1062,21 +1061,21 @@ void gToolBase::handleKeyStroke(Common::Event &event) {
}
void gToolBase::handleTimerTick(int32 tick) {
- msg.pickAbsPos = pickPos;
- msg.pointerEnter = 0;
- msg.pointerLeave = 0;
- msg.timeStamp = tick;
-
- if (activePanel) { // send keystroke to active panel
- setMsg(msg, activePanel); // set up gPanelMessage
- activePanel->timerTick(msg);
- } else if (mousePanel) {
- if (mousePanel->wantMousePoll) {
- setMsg(msg, mousePanel); // set up gPanelMessage
- mousePanel->pointerMove(msg);
- } else if (!mouseHintSet
- && ((uint32)(tick - lastMouseMoveTime) > 500)) {
- mousePanel->onMouseHintDelay();
+ _msg._pickAbsPos = _pickPos;
+ _msg._pointerEnter = 0;
+ _msg._pointerLeave = 0;
+ _msg._timeStamp = tick;
+
+ if (_activePanel) { // send keystroke to active panel
+ setMsg(_msg, _activePanel); // set up gPanelMessage
+ _activePanel->timerTick(_msg);
+ } else if (_mousePanel) {
+ if (_mousePanel->_wantMousePoll) {
+ setMsg(_msg, _mousePanel); // set up gPanelMessage
+ _mousePanel->pointerMove(_msg);
+ } else if (!_mouseHintSet
+ && ((uint32)(tick - _lastMouseMoveTime) > 500)) {
+ _mousePanel->onMouseHintDelay();
}
}
}
@@ -1103,11 +1102,11 @@ void cleanupPanels() {
}
int16 leftButtonState() {
- return g_vm->_toolBase->msg.leftButton;
+ return g_vm->_toolBase->_msg._leftButton;
}
int16 rightButtonState() {
- return g_vm->_toolBase->msg.rightButton;
+ return g_vm->_toolBase->_msg._rightButton;
}
void LockUI(bool state) {
diff --git a/engines/saga2/panel.h b/engines/saga2/panel.h
index 0e18f8935c1..fbfc8674bff 100644
--- a/engines/saga2/panel.h
+++ b/engines/saga2/panel.h
@@ -119,23 +119,23 @@ class gPanel {
friend class gToolBase;
friend class gWindow;
- AppFunc *command; // application function
+ AppFunc *_command; // application function
protected:
- gWindow &window; // window this belongs to
+ gWindow &_window; // window this belongs to
Rect16 _extent; // rectangular bounds of the control
- const char *title; // title of the panel
- byte enabled, // allows disabling the panel
- selected, // some panels have a selected state
- imageLabel, // button label is image, not text
- ghosted, // button is dimmed
- wantMousePoll; // send mousemoves even if mouse not moving!
+ const char *_title; // title of the panel
+ byte _enabled, // allows disabling the panel
+ _selected, // some panels have a selected state
+ _imageLabel, // button label is image, not text
+ _ghosted, // button is dimmed
+ _wantMousePoll; // send mousemoves even if mouse not moving!
// window constructor
gPanel(gWindow &, const Rect16 &, AppFunc *cmd);
public:
- uint32 id; // panel id number
- void *userData; // data for this panel
+ uint32 _id; // panel id number
+ void *_userData; // data for this panel
// constructor
gPanel(gPanelList &, const Rect16 &, const char *, uint16, AppFunc *cmd = NULL);
@@ -159,7 +159,7 @@ protected:
void notify(enum gEventType, int32 value);
void notify(gEvent &ev) {
- if (command) command(ev);
+ if (_command) _command(ev);
}
void drawTitle(enum text_positions placement);
@@ -174,7 +174,7 @@ public:
virtual void ghost(bool ghosted);
virtual void invalidate(Rect16 *area = nullptr);
virtual void setMousePoll(bool abled) {
- wantMousePoll = abled ? 1 : 0;
+ _wantMousePoll = abled ? 1 : 0;
}
// Redraw the panel, but only a small clipped section,
@@ -186,20 +186,20 @@ public:
// void setCommand( AppFunc *func ) { command = func; }
gWindow *getWindow() {
- return &window;
+ return &_window;
}
void makeActive();
Rect16 getExtent() {
return _extent;
}
bool isSelected() {
- return selected != 0;
+ return _selected != 0;
}
bool isGhosted() {
- return ghosted != 0;
+ return _ghosted != 0;
}
bool getEnabled() const {
- return (bool) enabled;
+ return (bool)_enabled;
}
void show(bool shown = true, bool inval = true) {
enable(shown);
@@ -217,32 +217,32 @@ public:
class gPanelMessage {
public:
- Point16 pickPos, // mouse position relative to panel
- pickAbsPos; // mouse position relative to display
- byte leftButton, // left button state
- rightButton, // right button state
- inPanel, // whether mouse is currently in panel
- pointerEnter, // set when pointer enters panel
- pointerLeave, // set when pointer leaves panel
- doubleClick; // set when double click detected
+ Point16 _pickPos, // mouse position relative to panel
+ _pickAbsPos; // mouse position relative to display
+ byte _leftButton, // left button state
+ _rightButton, // right button state
+ _inPanel, // whether mouse is currently in panel
+ _pointerEnter, // set when pointer enters panel
+ _pointerLeave, // set when pointer leaves panel
+ _doubleClick; // set when double click detected
// For keyboard input
- uint16 key, // keystroke from keyboard
- qualifier; // qualifier from keyboard
+ uint16 _key, // keystroke from keyboard
+ _qualifier; // qualifier from keyboard
- uint32 timeStamp; // time of message
+ uint32 _timeStamp; // time of message
gPanelMessage() {
- leftButton = 0;
- rightButton = 0;
- inPanel = 0;
- pointerEnter = 0;
- pointerLeave = 0;
- doubleClick = 0;
- key = 0;
- qualifier = 0;
- timeStamp = 0;
+ _leftButton = 0;
+ _rightButton = 0;
+ _inPanel = 0;
+ _pointerEnter = 0;
+ _pointerLeave = 0;
+ _doubleClick = 0;
+ _key = 0;
+ _qualifier = 0;
+ _timeStamp = 0;
}
};
@@ -262,7 +262,7 @@ class gPanelList : public gPanel {
protected:
- Common::List<gPanel *> contents; // list of panels
+ Common::List<gPanel *> _contents; // list of panels
gPanelList(gWindow &, const Rect16 &, char *, uint16, AppFunc *cmd = NULL);
@@ -288,13 +288,13 @@ public:
};
inline void gPanel::moveToFront(gPanelList &l) {
- l.contents.remove(this);
- l.contents.push_front(this);
+ l._contents.remove(this);
+ l._contents.push_front(this);
}
inline void gPanel::moveToBack(gPanelList &l) {
- l.contents.remove(this);
- l.contents.push_back(this);
+ l._contents.remove(this);
+ l._contents.push_back(this);
}
/* ===================================================================== *
@@ -319,20 +319,20 @@ class gWindow : public gPanelList {
friend class gToolBase;
public:
- gDisplayPort windowPort;
+ gDisplayPort _windowPort;
gWindow(const Rect16 &, uint16, const char saveName[], AppFunc *cmd = NULL);
~gWindow();
operator gPort() {
- return windowPort;
+ return _windowPort;
}
void postEvent(gEvent &ev) {
gPanel::notify(ev);
}
protected:
- bool openFlag; // true if window open.
+ bool _openFlag; // true if window open.
//gWindowWinInfoInINIFile saver;
@@ -352,9 +352,9 @@ private:
dragPosition
};
- static int dragMode; // current dragging mode
- static StaticRect dragExtent; // dragging extent
- static StaticPoint16 dragOffset; // offset to window origin
+ static int _dragMode; // current dragging mode
+ static StaticRect _dragExtent; // dragging extent
+ static StaticPoint16 _dragOffset; // offset to window origin
void shadow();
@@ -370,7 +370,7 @@ protected:
public:
bool isOpen() {
- return openFlag; // true if window is visible
+ return _openFlag; // true if window is visible
}
void draw(); // redraw the panel.
void drawClipped(
@@ -405,7 +405,7 @@ public:
class gControl : public gPanel {
public:
- uint8 accelKey;
+ uint8 _accelKey;
gPanelList *_list;
gControl(gPanelList &, const Rect16 &, const char *, uint16, AppFunc *cmd = NULL);
@@ -429,14 +429,14 @@ public:
* ===================================================================== */
class gGenericControl : public gControl {
- bool dblClickFlag;
+ bool _dblClickFlag;
public:
gGenericControl(gPanelList &, const Rect16 &, uint16, AppFunc *cmd = NULL);
// Disable double click for next mouse click
void disableDblClick() {
- dblClickFlag = true;
+ _dblClickFlag = true;
}
enum controlValue {
@@ -476,50 +476,50 @@ class gToolBase {
// windows
- Common::List<gWindow *> windowList; // list of windows
- gWindow *mouseWindow, // window mouse is in
- *activeWindow; // current active window
- gPanel *mousePanel, // panel that mouse is in
- *activePanel; // panel that has input focus
- Rect16 dragRect; // dragging rectangle for windows
- Point16 pickPos; // mouse pos relative to panel
- uint8 leftDrag, // left-button dragging
- rightDrag; // right button dragging
- gPanelMessage msg; // message that we send out
+ Common::List<gWindow *> _windowList; // list of windows
+ gWindow *_mouseWindow, // window mouse is in
+ *_activeWindow; // current active window
+ gPanel *_mousePanel, // panel that mouse is in
+ *_activePanel; // panel that has input focus
+ Rect16 _dragRect; // dragging rectangle for windows
+ Point16 _pickPos; // mouse pos relative to panel
+ uint8 _leftDrag, // left-button dragging
+ _rightDrag; // right button dragging
+ gPanelMessage _msg; // message that we send out
- int32 lastMouseMoveTime; // time of last mouse move
+ int32 _lastMouseMoveTime; // time of last mouse move
gMouseState _curMouseState;
public:
- bool mouseHintSet; // true if mouse hint is up.
+ bool _mouseHintSet; // true if mouse hint is up.
gToolBase() {
- mouseWindow = nullptr;
- activeWindow = nullptr;
- mousePanel = nullptr;
- activePanel = nullptr;
- leftDrag = 0;
- rightDrag = 0;
- lastMouseMoveTime = 0;
+ _mouseWindow = nullptr;
+ _activeWindow = nullptr;
+ _mousePanel = nullptr;
+ _activePanel = nullptr;
+ _leftDrag = 0;
+ _rightDrag = 0;
+ _lastMouseMoveTime = 0;
}
private:
void setMsgQ(gPanelMessage &msg_, gPanel *panel) {
- if (panel == &panel->window)
- msg_.pickPos = pickPos;
+ if (panel == &panel->_window)
+ msg_._pickPos = _pickPos;
else {
- msg.pickPos.x = (int16)(pickPos.x - panel->_extent.x);
- msg.pickPos.y = (int16)(pickPos.y - panel->_extent.y);
+ _msg._pickPos.x = (int16)(_pickPos.x - panel->_extent.x);
+ _msg._pickPos.y = (int16)(_pickPos.y - panel->_extent.y);
}
}
void setMsg(gPanelMessage &msg_, gPanel *panel) {
setMsgQ(msg_, panel);
- msg.inPanel = (msg_.pickPos.x >= 0
- && msg_.pickPos.y >= 0
- && msg_.pickPos.x < panel->_extent.width
- && msg_.pickPos.y < panel->_extent.height);
+ _msg._inPanel = (msg_._pickPos.x >= 0
+ && msg_._pickPos.y >= 0
+ && msg_._pickPos.x < panel->_extent.width
+ && msg_._pickPos.y < panel->_extent.height);
// panel->extent.ptInside( pickPos );
}
@@ -531,19 +531,19 @@ public:
void handleKeyStroke(Common::Event &event);
void handleTimerTick(int32 tick);
Common::List<gWindow *>::iterator topWindowIterator() {
- return windowList.end();
+ return _windowList.end();
}
Common::List<gWindow *>::iterator bottomWindowIterator() {
- return windowList.reverse_begin();
+ return _windowList.reverse_begin();
}
gWindow *topWindow() {
- return windowList.front();
+ return _windowList.front();
}
gWindow *bottomWindow() {
- return windowList.back();
+ return _windowList.back();
}
bool isMousePanel(gPanel *p) {
- return (mousePanel != NULL) ? (p == mousePanel) : (p == topWindow());
+ return (_mousePanel != NULL) ? (p == _mousePanel) : (p == topWindow());
}
};
diff --git a/engines/saga2/tilemode.cpp b/engines/saga2/tilemode.cpp
index f66191204e2..d33844d4fa5 100644
--- a/engines/saga2/tilemode.cpp
+++ b/engines/saga2/tilemode.cpp
@@ -676,7 +676,7 @@ void TileModeCleanup() {
delete tileMapControl;
// This Fixes the mousePanel That's not set up
- g_vm->_toolBase->mousePanel = nullptr;
+ g_vm->_toolBase->_mousePanel = nullptr;
mainWindow->removeDecorations();
}
diff --git a/engines/saga2/uidialog.cpp b/engines/saga2/uidialog.cpp
index 54fe3d0332d..739c57cf623 100644
--- a/engines/saga2/uidialog.cpp
+++ b/engines/saga2/uidialog.cpp
@@ -692,17 +692,17 @@ int16 FileDialog(int16 fileProcess) {
// make the quit button
new GfxCompButton(*win, *saveLoadButtonRects[0], pushBtnIm, numBtnImages, btnStrings[stringIndex][0], pal, 0, cmdDialogQuit);
- //t->accelKey=0x1B;
+ //t->_accelKey=0x1B;
// make the Save/Load button
new GfxCompButton(*win, *saveLoadButtonRects[1], pushBtnIm, numBtnImages, btnStrings[stringIndex][1], pal, fileProcess, fileCommands[fileProcess]);
- //t->accelKey=0x0D;
+ //t->_accelKey=0x0D;
// make the up arrow
new GfxCompButton(*win, *saveLoadButtonRects[2], arrowUpIm, numBtnImages, 0, cmdSaveDialogUp);
- //t->accelKey=33+0x80;
+ //t->_accelKey=33+0x80;
// make the down arrow
new GfxCompButton(*win, *saveLoadButtonRects[3], arrowDnIm, numBtnImages, 0, cmdSaveDialogDown);
- //t->accelKey=34+0x80;
+ //t->_accelKey=34+0x80;
// attach the title
new CPlaqText(*win, *saveLoadTextRects[0], textStrings[stringIndex][0], &Plate18Font, 0, pal, 0, nullptr);
@@ -719,7 +719,7 @@ int16 FileDialog(int16 fileProcess) {
ARRAYSIZE(saveWindowDecorations),
decRes, 'S', 'L', 'D');
- win->userData = &rInfo;
+ win->_userData = &rInfo;
win->open();
if (GameMode::_newmodeFlag)
@@ -838,28 +838,28 @@ int16 OptionsDialog(bool disableSaveResume) {
if (!disableSaveResume) {
t = new GfxCompButton(*win, *optionsButtonRects[0],
dialogPushImag, numBtnImages, btnStrings[0], pal, 0, cmdDialogQuit);
- t->accelKey = 0x1B;
+ t->_accelKey = 0x1B;
t = new GfxCompButton(*win, *optionsButtonRects[1],
dialogPushImag, numBtnImages, btnStrings[1], pal, 0, cmdOptionsSaveGame); // make the quit button
- t->accelKey = 'S';
+ t->_accelKey = 'S';
} else {
t = new GfxCompButton(*win, *optionsButtonRects[1],
dialogPushImag, numBtnImages, OPTN_DIALOG_BUTTON6, pal, 0, cmdOptionsNewGame);
- t->accelKey = 'N';
+ t->_accelKey = 'N';
}
t = new GfxCompButton(*win, *optionsButtonRects[2],
dialogPushImag, numBtnImages, btnStrings[2], pal, 0, cmdOptionsLoadGame); // make the quit button
- t->accelKey = 'L';
+ t->_accelKey = 'L';
t = new GfxCompButton(*win, *optionsButtonRects[3],
dialogPushImag, numBtnImages, btnStrings[3], pal, 0, cmdQuitGame);
- t->accelKey = 'Q';
+ t->_accelKey = 'Q';
t = new GfxCompButton(*win, *optionsButtonRects[4],
dialogPushImag, numBtnImages, btnStrings[4], pal, 0, cmdCredits);
- t->accelKey = 'C';
+ t->_accelKey = 'C';
autoAggressBtn = new GfxOwnerSelCompButton(*win, *optionsButtonRects[5],
checkImag, numBtnImages, 0, cmdAutoAggression);
@@ -901,7 +901,7 @@ int16 OptionsDialog(bool disableSaveResume) {
decRes, 'O', 'P', 'T');
- win->userData = &rInfo;
+ win->_userData = &rInfo;
win->open();
EventLoop(rInfo.running, true);
@@ -1016,7 +1016,7 @@ bool initUserDialog() {
ARRAYSIZE(messageDecorations),
udDecRes, 'M', 'E', 'S');
- udWin->userData = &udrInfo;
+ udWin->_userData = &udrInfo;
if (udDecRes) resFile->disposeContext(udDecRes);
udDecRes = nullptr;
@@ -1191,21 +1191,21 @@ int16 userDialog(const char *title, const char *msg, const char *bMsg1,
if (numBtns >= 1) {
t = new GfxCompButton(*win, *messageButtonRects[0],
dialogPushImag, numBtnImages, btnMsg1, pal, 10, cmdDialogQuit);
- t->accelKey = k1;
+ t->_accelKey = k1;
}
// button two
if (numBtns >= 2) {
t = new GfxCompButton(*win, *messageButtonRects[1],
dialogPushImag, numBtnImages, btnMsg2, pal, 11, cmdDialogQuit);
- t->accelKey = k2;
+ t->_accelKey = k2;
}
// button three
if (numBtns >= 3) {
t = new GfxCompButton(*win, *messageButtonRects[2],
dialogPushImag, numBtnImages, btnMsg3, pal, 12, cmdDialogQuit);
- t->accelKey = k3;
+ t->_accelKey = k3;
}
// title for the box
@@ -1219,7 +1219,7 @@ int16 userDialog(const char *title, const char *msg, const char *bMsg1,
decRes, 'M', 'E', 'S');
- win->userData = &rInfo;
+ win->_userData = &rInfo;
win->open();
@@ -1320,11 +1320,11 @@ bool CPlacardWindow::pointerHit(gPanelMessage &) {
requestInfo *ri;
win = getWindow(); // get the window pointer
- ri = win ? (requestInfo *)win->userData : nullptr;
+ ri = win ? (requestInfo *)win->_userData : nullptr;
if (ri) {
ri->running = 0;
- ri->result = id;
+ ri->result = _id;
}
//activate( gEventMouseDown );
@@ -1562,7 +1562,7 @@ void placardWindow(int8 type, char *text) {
}
- win->userData = &rInfo;
+ win->_userData = &rInfo;
win->open();
@@ -1600,11 +1600,11 @@ APPFUNC(cmdDialogQuit) {
if (ev.panel && isUserAction(ev) && ev.value) {
win = ev.panel->getWindow(); // get the window pointer
- ri = win ? (requestInfo *)win->userData : nullptr;
+ ri = win ? (requestInfo *)win->_userData : nullptr;
if (ri) {
ri->running = 0;
- ri->result = ev.panel->id;
+ ri->result = ev.panel->_id;
}
}
}
@@ -1616,7 +1616,7 @@ APPFUNC(cmdFileSave) {
if (ev.panel && isUserAction(ev) && ev.value) {
// now close the window
win = ev.panel->getWindow(); // get the window pointer
- ri = win ? (requestInfo *)win->userData : nullptr;
+ ri = win ? (requestInfo *)win->_userData : nullptr;
if (ri) {
ri->running = 0;
@@ -1653,7 +1653,7 @@ APPFUNC(cmdFileLoad) {
// close window
win = ev.panel->getWindow(); // get the window pointer
- ri = win ? (requestInfo *)win->userData : nullptr;
+ ri = win ? (requestInfo *)win->_userData : nullptr;
if (ri) {
ri->running = 0;
@@ -1696,11 +1696,11 @@ APPFUNC(cmdOptionsNewGame) {
gWindow *win;
requestInfo *ri;
win = ev.panel->getWindow(); // get the window pointer
- ri = win ? (requestInfo *)win->userData : nullptr;
+ ri = win ? (requestInfo *)win->_userData : nullptr;
if (ri) {
ri->running = 0;
- ri->result = ev.panel->id;
+ ri->result = ev.panel->_id;
deferredLoadID = 999;
deferredLoadFlag = true;
}
@@ -1716,11 +1716,11 @@ APPFUNC(cmdOptionsLoadGame) {
// if the fileDialog actually did loading
if (FileDialog(typeLoad) == typeLoad) {
win = ev.panel->getWindow(); // get the window pointer
- ri = win ? (requestInfo *)win->userData : nullptr;
+ ri = win ? (requestInfo *)win->_userData : nullptr;
if (ri) {
ri->running = 0;
- ri->result = ev.panel->id;
+ ri->result = ev.panel->_id;
}
}
}
@@ -1732,7 +1732,7 @@ APPFUNC(cmdQuitGame) {
if (ev.panel && isUserAction(ev) && ev.value) {
win = ev.panel->getWindow(); // get the window pointer
- ri = win ? (requestInfo *)win->userData : nullptr;
+ ri = win ? (requestInfo *)win->_userData : nullptr;
if (ri
&& userDialog(
@@ -1743,7 +1743,7 @@ APPFUNC(cmdQuitGame) {
endGame();
ri->running = false;
- ri->result = ev.panel->id;
+ ri->result = ev.panel->_id;
}
}
diff --git a/engines/saga2/videobox.cpp b/engines/saga2/videobox.cpp
index 137602359ce..4f1a6906795 100644
--- a/engines/saga2/videobox.cpp
+++ b/engines/saga2/videobox.cpp
@@ -66,13 +66,13 @@ CVideoBox::~CVideoBox() {
}
void CVideoBox::deactivate() {
- selected = 0;
+ _selected = 0;
gPanel::deactivate();
}
bool CVideoBox::activate(gEventType why) {
if (why == gEventMouseDown) { // momentarily depress
- selected = 1;
+ _selected = 1;
notify(why, 0); // notify App of successful hit
return true;
}
@@ -89,11 +89,11 @@ bool CVideoBox::pointerHit(gPanelMessage &) {
requestInfo *ri;
win = getWindow(); // get the window pointer
- ri = win ? (requestInfo *)win->userData : nullptr;
+ ri = win ? (requestInfo *)win->_userData : nullptr;
if (ri) {
ri->running = 0;
- ri->result = id;
+ ri->result = _id;
}
activate(gEventMouseDown);
@@ -101,13 +101,13 @@ bool CVideoBox::pointerHit(gPanelMessage &) {
}
void CVideoBox::pointerDrag(gPanelMessage &) {
- if (selected) {
+ if (_selected) {
notify(gEventMouseDrag, 0);
}
}
void CVideoBox::pointerRelease(gPanelMessage &) {
- if (selected) notify(gEventMouseUp, 0); // notify App of successful hit
+ if (_selected) notify(gEventMouseUp, 0); // notify App of successful hit
deactivate();
}
@@ -145,7 +145,7 @@ void CVideoBox::init() {
'V', 'B', 'D');
// attach the result info struct to this window
- userData = &rInfo;
+ _userData = &rInfo;
}
int16 CVideoBox::openVidBox(char *fileName) {
More information about the Scummvm-git-logs
mailing list