DREAMWEB: Further migration to screen size constants.
This commit is contained in:
parent
396f45f551
commit
06cc3b051a
4 changed files with 16 additions and 17 deletions
|
@ -25,7 +25,7 @@
|
||||||
namespace DreamWeb {
|
namespace DreamWeb {
|
||||||
|
|
||||||
void DreamWebEngine::doBlocks() {
|
void DreamWebEngine::doBlocks() {
|
||||||
uint16 dstOffset = _mapAdY * 320 + _mapAdX;
|
uint16 dstOffset = _mapAdY * kScreenwidth + _mapAdX;
|
||||||
uint16 mapOffset = _mapY * kMapWidth + _mapX;
|
uint16 mapOffset = _mapY * kMapWidth + _mapX;
|
||||||
const uint8 *mapData = _mapData + mapOffset;
|
const uint8 *mapData = _mapData + mapOffset;
|
||||||
uint8 *dstBuffer = workspace() + dstOffset;
|
uint8 *dstBuffer = workspace() + dstOffset;
|
||||||
|
@ -34,26 +34,26 @@ void DreamWebEngine::doBlocks() {
|
||||||
for (size_t j = 0; j < 11; ++j) {
|
for (size_t j = 0; j < 11; ++j) {
|
||||||
uint16 blockType = mapData[j];
|
uint16 blockType = mapData[j];
|
||||||
if (blockType != 0) {
|
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;
|
const uint8 *block = _backdropBlocks + blockType * 256;
|
||||||
for (size_t k = 0; k < 4; ++k) {
|
for (size_t k = 0; k < 4; ++k) {
|
||||||
memcpy(dst, block, 16);
|
memcpy(dst, block, 16);
|
||||||
block += 16;
|
block += 16;
|
||||||
dst += 320;
|
dst += kScreenwidth;
|
||||||
}
|
}
|
||||||
for (size_t k = 0; k < 12; ++k) {
|
for (size_t k = 0; k < 12; ++k) {
|
||||||
memcpy(dst, block, 16);
|
memcpy(dst, block, 16);
|
||||||
memset(dst + 16, 0xdf, 4);
|
memset(dst + 16, 0xdf, 4);
|
||||||
block += 16;
|
block += 16;
|
||||||
dst += 320;
|
dst += kScreenwidth;
|
||||||
}
|
}
|
||||||
dst += 4;
|
dst += 4;
|
||||||
memset(dst, 0xdf, 16);
|
memset(dst, 0xdf, 16);
|
||||||
dst += 320;
|
dst += kScreenwidth;
|
||||||
memset(dst, 0xdf, 16);
|
memset(dst, 0xdf, 16);
|
||||||
dst += 320;
|
dst += kScreenwidth;
|
||||||
memset(dst, 0xdf, 16);
|
memset(dst, 0xdf, 16);
|
||||||
dst += 320;
|
dst += kScreenwidth;
|
||||||
memset(dst, 0xdf, 16);
|
memset(dst, 0xdf, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,7 +416,7 @@ void DreamWebEngine::getPalette(uint8 *data, uint start, uint count) {
|
||||||
|
|
||||||
void DreamWebEngine::setPalette(const uint8 *data, uint start, uint count) {
|
void DreamWebEngine::setPalette(const uint8 *data, uint start, uint count) {
|
||||||
assert(start + count <= 256);
|
assert(start + count <= 256);
|
||||||
uint8 fixed[768];
|
uint8 fixed[3*256];
|
||||||
for (uint i = 0; i < count * 3; ++i) {
|
for (uint i = 0; i < count * 3; ++i) {
|
||||||
fixed[i] = data[i] << 2;
|
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) {
|
void DreamWebEngine::blit(const uint8 *src, int pitch, int x, int y, int w, int h) {
|
||||||
if (y + h > 200)
|
if (y + h > (int)kScreenheight)
|
||||||
h = 200 - y;
|
h = kScreenheight - y;
|
||||||
if (x + w > 320)
|
if (x + w > (int)kScreenwidth)
|
||||||
w = 320 - x;
|
w = kScreenwidth - x;
|
||||||
if (h <= 0 || w <= 0)
|
if (h <= 0 || w <= 0)
|
||||||
return;
|
return;
|
||||||
_system->copyRectToScreen(src, pitch, x, y, w, h);
|
_system->copyRectToScreen(src, pitch, x, y, w, h);
|
||||||
|
|
|
@ -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(),
|
// Note: isItRight comes from use.asm, but is only used by enterCode(),
|
||||||
// so we place it here.
|
// so we place it here.
|
||||||
bool DreamWebEngine::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) {
|
bool DreamWebEngine::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) {
|
||||||
|
|
||||||
return digit0 == _pressList[0] && digit1 == _pressList[1]
|
return digit0 == _pressList[0] && digit1 == _pressList[1]
|
||||||
&& digit2 == _pressList[2] && digit3 == _pressList[3];
|
&& digit2 == _pressList[2] && digit3 == _pressList[3];
|
||||||
}
|
}
|
||||||
|
@ -455,12 +454,12 @@ void DreamWebEngine::showLeftPage() {
|
||||||
_kerning = 0;
|
_kerning = 0;
|
||||||
_charShift = 0;
|
_charShift = 0;
|
||||||
_lineSpacing = 10;
|
_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 i = 0; i < 120; ++i) {
|
||||||
for (size_t j = 0; j < 65; ++j) {
|
for (size_t j = 0; j < 65; ++j) {
|
||||||
SWAP(bufferToSwap[j], bufferToSwap[130 - j]);
|
SWAP(bufferToSwap[j], bufferToSwap[130 - j]);
|
||||||
}
|
}
|
||||||
bufferToSwap += 320;
|
bufferToSwap += kScreenwidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,12 +42,12 @@ void DreamWebEngine::showRain() {
|
||||||
uint16 offset = (rain.w3 - rain.b5) & 511;
|
uint16 offset = (rain.w3 - rain.b5) & 511;
|
||||||
rain.w3 = offset;
|
rain.w3 = offset;
|
||||||
const uint8 *src = frameData + 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) {
|
for (uint16 j = 0; j < size; ++j) {
|
||||||
uint8 v = src[j];
|
uint8 v = src[j];
|
||||||
if (v != 0)
|
if (v != 0)
|
||||||
*dst = v;
|
*dst = v;
|
||||||
dst += 320-1; // advance diagonally
|
dst += kScreenwidth-1; // advance diagonally
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue