mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 16:03:24 +00:00
SAGA2: Rename class variables in gdraw.h
This commit is contained in:
parent
97fe41e498
commit
98ef900668
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/* ===================================================================== *
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
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
|
||||
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:
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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?
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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++;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
savedRegion.y = pos.y;
|
||||
}
|
||||
bool valid() {
|
||||
return savedPixels.data != NULL;
|
||||
return savedPixels._data != NULL;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
void fillRect(const Rect16 r);
|
||||
|
||||
void clear() {
|
||||
protoPage.fillRect(clip, fgPen);
|
||||
protoPage.fillRect(_clip, _fgPen);
|
||||
}
|
||||
|
||||
// Blitting functions
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user