TWINE: prepare extraction into constants

This commit is contained in:
Martin Gerhardy 2020-12-24 15:06:48 +01:00
parent 174bbd1d59
commit 2cfad1618f
11 changed files with 65 additions and 62 deletions

View file

@ -343,9 +343,9 @@ void Redraw::processDrawListShadows(const DrawListStruct &drawCmd) {
_engine->_grid->drawSprite(drawCmd.offset, renderRect.left, renderRect.top, _engine->_resources->spriteShadowPtr);
}
const int32 tmpX = (drawCmd.x + 0x100) >> 9;
const int32 tmpY = drawCmd.y >> 8;
const int32 tmpZ = (drawCmd.z + 0x100) >> 9;
const int32 tmpX = (drawCmd.x + 256) / 512;
const int32 tmpY = drawCmd.y / 256;
const int32 tmpZ = (drawCmd.z + 256) / 512;
_engine->_grid->drawOverModelActor(tmpX, tmpY, tmpZ);
@ -388,9 +388,9 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
if (_engine->_interface->textWindow.left <= _engine->_interface->textWindow.right && _engine->_interface->textWindow.top <= _engine->_interface->textWindow.bottom) {
actor->dynamicFlags.bIsVisible = 1;
const int32 tempX = (actor->x + 0x100) >> 9;
int32 tempY = actor->y >> 8;
const int32 tempZ = (actor->z + 0x100) >> 9;
const int32 tempX = (actor->x + 256) / 512;
int32 tempY = actor->y / 256;
const int32 tempZ = (actor->z + 256) / 512;
if (actor->brickShape() != ShapeType::kNone) {
tempY++;
}
@ -443,14 +443,14 @@ void Redraw::processDrawListActorSprites(const DrawListStruct &drawCmd, bool bgR
actor->dynamicFlags.bIsVisible = 1;
if (actor->staticFlags.bUsesClipping) {
const int32 tmpX = (actor->lastX + 0x100) >> 9;
const int32 tmpY = actor->lastY >> 8;
const int32 tmpZ = (actor->lastZ + 0x100) >> 9;
const int32 tmpX = (actor->lastX + 256) / 512;
const int32 tmpY = actor->lastY / 256;
const int32 tmpZ = (actor->lastZ + 256) / 512;
_engine->_grid->drawOverSpriteActor(tmpX, tmpY, tmpZ);
} else {
const int32 tmpX = (actor->x + actor->boudingBox.x.topRight + 0x100) >> 9;
int32 tmpY = actor->y >> 8;
const int32 tmpZ = (actor->z + actor->boudingBox.z.topRight + 0x100) >> 9;
const int32 tmpX = (actor->x + actor->boudingBox.x.topRight + 256) / 512;
int32 tmpY = actor->y / 256;
const int32 tmpZ = (actor->z + actor->boudingBox.z.topRight + 256) / 512;
if (actor->brickShape() != ShapeType::kNone) {
tmpY++;
}
@ -495,9 +495,9 @@ void Redraw::processDrawListExtras(const DrawListStruct &drawCmd) {
_engine->_interface->setClip(renderRect);
if (_engine->_interface->textWindow.left <= _engine->_interface->textWindow.right && _engine->_interface->textWindow.top <= _engine->_interface->textWindow.bottom) {
const int32 tmpX = (drawCmd.x + 0x100) >> 9;
const int32 tmpY = drawCmd.y >> 8;
const int32 tmpZ = (drawCmd.z + 0x100) >> 9;
const int32 tmpX = (drawCmd.x + 256) / 512;
const int32 tmpY = drawCmd.y / 256;
const int32 tmpZ = (drawCmd.z + 256) / 512;
_engine->_grid->drawOverModelActor(tmpX, tmpY, tmpZ);
addRedrawArea(_engine->_interface->textWindow.left, _engine->_interface->textWindow.top, renderRect.right, renderRect.bottom);