DREAMWEB: Further migration to screen size constants.

This commit is contained in:
D G Turner 2012-11-30 10:49:25 +00:00
parent 396f45f551
commit 06cc3b051a
4 changed files with 16 additions and 17 deletions

View file

@ -25,7 +25,7 @@
namespace DreamWeb {
void DreamWebEngine::doBlocks() {
uint16 dstOffset = _mapAdY * 320 + _mapAdX;
uint16 dstOffset = _mapAdY * kScreenwidth + _mapAdX;
uint16 mapOffset = _mapY * kMapWidth + _mapX;
const uint8 *mapData = _mapData + mapOffset;
uint8 *dstBuffer = workspace() + dstOffset;
@ -34,26 +34,26 @@ void DreamWebEngine::doBlocks() {
for (size_t j = 0; j < 11; ++j) {
uint16 blockType = mapData[j];
if (blockType != 0) {
uint8 *dst = dstBuffer + i * 320 * 16 + j * 16;
uint8 *dst = dstBuffer + i * kScreenwidth * 16 + j * 16;
const uint8 *block = _backdropBlocks + blockType * 256;
for (size_t k = 0; k < 4; ++k) {
memcpy(dst, block, 16);
block += 16;
dst += 320;
dst += kScreenwidth;
}
for (size_t k = 0; k < 12; ++k) {
memcpy(dst, block, 16);
memset(dst + 16, 0xdf, 4);
block += 16;
dst += 320;
dst += kScreenwidth;
}
dst += 4;
memset(dst, 0xdf, 16);
dst += 320;
dst += kScreenwidth;
memset(dst, 0xdf, 16);
dst += 320;
dst += kScreenwidth;
memset(dst, 0xdf, 16);
dst += 320;
dst += kScreenwidth;
memset(dst, 0xdf, 16);
}
}

View file

@ -416,7 +416,7 @@ void DreamWebEngine::getPalette(uint8 *data, uint start, uint count) {
void DreamWebEngine::setPalette(const uint8 *data, uint start, uint count) {
assert(start + count <= 256);
uint8 fixed[768];
uint8 fixed[3*256];
for (uint i = 0; i < count * 3; ++i) {
fixed[i] = data[i] << 2;
}
@ -424,10 +424,10 @@ void DreamWebEngine::setPalette(const uint8 *data, uint start, uint count) {
}
void DreamWebEngine::blit(const uint8 *src, int pitch, int x, int y, int w, int h) {
if (y + h > 200)
h = 200 - y;
if (x + w > 320)
w = 320 - x;
if (y + h > (int)kScreenheight)
h = kScreenheight - y;
if (x + w > (int)kScreenwidth)
w = kScreenwidth - x;
if (h <= 0 || w <= 0)
return;
_system->copyRectToScreen(src, pitch, x, y, w, h);

View file

@ -103,7 +103,6 @@ void DreamWebEngine::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 d
// Note: isItRight comes from use.asm, but is only used by enterCode(),
// so we place it here.
bool DreamWebEngine::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) {
return digit0 == _pressList[0] && digit1 == _pressList[1]
&& digit2 == _pressList[2] && digit3 == _pressList[3];
}
@ -455,12 +454,12 @@ void DreamWebEngine::showLeftPage() {
_kerning = 0;
_charShift = 0;
_lineSpacing = 10;
uint8 *bufferToSwap = workspace() + (48*320)+2;
uint8 *bufferToSwap = workspace() + (48*kScreenwidth)+2;
for (size_t i = 0; i < 120; ++i) {
for (size_t j = 0; j < 65; ++j) {
SWAP(bufferToSwap[j], bufferToSwap[130 - j]);
}
bufferToSwap += 320;
bufferToSwap += kScreenwidth;
}
}

View file

@ -42,12 +42,12 @@ void DreamWebEngine::showRain() {
uint16 offset = (rain.w3 - rain.b5) & 511;
rain.w3 = offset;
const uint8 *src = frameData + offset;
uint8 *dst = workspace() + y * 320 + x;
uint8 *dst = workspace() + y * kScreenwidth + x;
for (uint16 j = 0; j < size; ++j) {
uint8 v = src[j];
if (v != 0)
*dst = v;
dst += 320-1; // advance diagonally
dst += kScreenwidth-1; // advance diagonally
}
}