TWINE: removed screenLookupTable
This commit is contained in:
parent
37cdcae625
commit
df75fac95f
12 changed files with 40 additions and 42 deletions
|
@ -35,9 +35,9 @@
|
|||
|
||||
namespace TwinE {
|
||||
|
||||
void Debug::debugFillButton(int32 X, int32 Y, int32 width, int32 height, int8 color) {
|
||||
uint8 *ptr = (uint8*)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[Y] + X;
|
||||
int32 offset = 640 - width;
|
||||
void Debug::debugFillButton(int32 x, int32 y, int32 width, int32 height, int8 color) {
|
||||
uint8 *ptr = (uint8*)_engine->frontVideoBuffer.getBasePtr(x, y);
|
||||
int32 offset = SCREEN_WIDTH - width;
|
||||
|
||||
for (int32 i = 0; i < height; i++) {
|
||||
for (int32 j = 0; j < width; j++) {
|
||||
|
|
|
@ -459,7 +459,7 @@ void GameState::processGameoverAnimation() {
|
|||
const int32 avg = _engine->_collision->getAverageValue(40000, 3200, 500, _engine->lbaTime - startLbaTime);
|
||||
const int32 cdot = _engine->_screens->crossDot(1, 1024, 100, (_engine->lbaTime - startLbaTime) % 100);
|
||||
|
||||
_engine->_interface->blitBox(left, top, right, bottom, (int8 *)_engine->workVideoBuffer.getPixels(), 120, 120, (int8 *)_engine->frontVideoBuffer.getPixels());
|
||||
_engine->_interface->blitBox(left, top, right, bottom, _engine->workVideoBuffer, 120, 120, _engine->frontVideoBuffer);
|
||||
_engine->_renderer->setCameraAngle(0, 0, 0, 0, -cdot, 0, avg);
|
||||
_engine->_renderer->renderIsoModel(0, 0, 0, 0, 0, 0, gameOverPtr);
|
||||
_engine->copyBlockPhys(left, top, right, bottom);
|
||||
|
@ -469,7 +469,7 @@ void GameState::processGameoverAnimation() {
|
|||
}
|
||||
|
||||
_engine->_sound->playSample(Samples::Explode, _engine->getRandomNumber(2000) + 3096);
|
||||
_engine->_interface->blitBox(left, top, right, bottom, (int8 *)_engine->workVideoBuffer.getPixels(), 120, 120, (int8 *)_engine->frontVideoBuffer.getPixels());
|
||||
_engine->_interface->blitBox(left, top, right, bottom, _engine->workVideoBuffer, 120, 120, _engine->frontVideoBuffer);
|
||||
_engine->_renderer->setCameraAngle(0, 0, 0, 0, 0, 0, 3200);
|
||||
_engine->_renderer->renderIsoModel(0, 0, 0, 0, 0, 0, gameOverPtr);
|
||||
_engine->copyBlockPhys(left, top, right, bottom);
|
||||
|
|
|
@ -51,7 +51,7 @@ Grid::~Grid() {
|
|||
}
|
||||
}
|
||||
|
||||
void Grid::copyGridMask(int32 index, int32 x, int32 y, const uint8 *buffer) {
|
||||
void Grid::copyGridMask(int32 index, int32 x, int32 y, const Graphics::ManagedSurface& buffer) {
|
||||
uint8 *ptr = brickMaskTable[index];
|
||||
|
||||
int32 left = x + *(ptr + 2);
|
||||
|
@ -106,8 +106,8 @@ void Grid::copyGridMask(int32 index, int32 x, int32 y, const uint8 *buffer) {
|
|||
}
|
||||
}
|
||||
|
||||
uint8 *outPtr = (uint8 *)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[absY] + left;
|
||||
const uint8 *inPtr = buffer + _engine->screenLookupTable[absY] + left;
|
||||
uint8 *outPtr = (uint8 *)_engine->frontVideoBuffer.getBasePtr(left, absY);
|
||||
const uint8 *inPtr = (const uint8*)buffer.getBasePtr(left, absY);
|
||||
|
||||
do {
|
||||
int32 vc3 = *(ptr++);
|
||||
|
@ -154,7 +154,7 @@ void Grid::drawOverModelActor(int32 x, int32 y, int32 z) {
|
|||
|
||||
if (currBrickEntry->posY + 38 > _engine->_interface->textWindowTop && currBrickEntry->posY <= _engine->_interface->textWindowBottom && currBrickEntry->y >= y) {
|
||||
if (currBrickEntry->x + currBrickEntry->z > z + x) {
|
||||
copyGridMask(currBrickEntry->index, (j * 24) - 24, currBrickEntry->posY, (uint8 *)_engine->workVideoBuffer.getPixels());
|
||||
copyGridMask(currBrickEntry->index, (j * 24) - 24, currBrickEntry->posY, _engine->workVideoBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,11 +171,11 @@ void Grid::drawOverSpriteActor(int32 x, int32 y, int32 z) {
|
|||
|
||||
if (currBrickEntry->posY + 38 > _engine->_interface->textWindowTop && currBrickEntry->posY <= _engine->_interface->textWindowBottom && currBrickEntry->y >= y) {
|
||||
if ((currBrickEntry->x == x) && (currBrickEntry->z == z)) {
|
||||
copyGridMask(currBrickEntry->index, (j * 24) - 24, currBrickEntry->posY, (uint8 *)_engine->workVideoBuffer.getPixels());
|
||||
copyGridMask(currBrickEntry->index, (j * 24) - 24, currBrickEntry->posY, _engine->workVideoBuffer);
|
||||
}
|
||||
|
||||
if ((currBrickEntry->x > x) || (currBrickEntry->z > z)) {
|
||||
copyGridMask(currBrickEntry->index, (j * 24) - 24, currBrickEntry->posY, (uint8 *)_engine->workVideoBuffer.getPixels());
|
||||
copyGridMask(currBrickEntry->index, (j * 24) - 24, currBrickEntry->posY, _engine->workVideoBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ void Grid::drawBrickSprite(int32 index, int32 posX, int32 posY, const uint8 *ptr
|
|||
right++;
|
||||
bottom++;
|
||||
|
||||
uint8 *outPtr = (uint8 *)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[top] + left;
|
||||
uint8 *outPtr = (uint8 *)_engine->frontVideoBuffer.getBasePtr(left, top);
|
||||
|
||||
int32 offset = -((right - left) - SCREEN_WIDTH);
|
||||
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
#include "common/scummsys.h"
|
||||
#include "twine/shared.h"
|
||||
|
||||
namespace Graphics {
|
||||
class ManagedSurface;
|
||||
}
|
||||
|
||||
namespace TwinE {
|
||||
|
||||
/** Block fragment entry */
|
||||
|
@ -128,7 +132,7 @@ private:
|
|||
* @param y grid Y coordinate
|
||||
* @param buffer work video buffer
|
||||
*/
|
||||
void copyGridMask(int32 index, int32 x, int32 y, const uint8 *buffer);
|
||||
void copyGridMask(int32 index, int32 x, int32 y, const Graphics::ManagedSurface& buffer);
|
||||
|
||||
/** Table with all loaded bricks */
|
||||
uint8 *brickTable[NUM_BRICKS]{nullptr};
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
#include "twine/interface.h"
|
||||
#include "graphics/managed_surface.h"
|
||||
#include "twine/twine.h"
|
||||
|
||||
namespace TwinE {
|
||||
|
@ -112,7 +113,7 @@ void Interface::drawLine(int32 startWidth, int32 startHeight, int32 endWidth, in
|
|||
endHeight = -endHeight;
|
||||
}
|
||||
|
||||
out = (uint8*)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[startHeight] + startWidth;
|
||||
out = (uint8*)_engine->frontVideoBuffer.getBasePtr(startWidth, startHeight);
|
||||
|
||||
int16 color = currentLineColor;
|
||||
if (endWidth < endHeight) { // significant slope
|
||||
|
@ -152,9 +153,9 @@ void Interface::drawLine(int32 startWidth, int32 startHeight, int32 endWidth, in
|
|||
}
|
||||
}
|
||||
|
||||
void Interface::blitBox(int32 left, int32 top, int32 right, int32 bottom, const int8 *source, int32 leftDest, int32 topDest, int8 *dest) {
|
||||
const int8 *s = _engine->screenLookupTable[top] + source + left;
|
||||
int8 *d = _engine->screenLookupTable[topDest] + dest + leftDest;
|
||||
void Interface::blitBox(int32 left, int32 top, int32 right, int32 bottom, const Graphics::ManagedSurface &source, int32 leftDest, int32 topDest, Graphics::ManagedSurface &dest) {
|
||||
const int8 *s = (const int8 *)source.getBasePtr(left, top);
|
||||
int8 *d = (int8 *)dest.getBasePtr(left, top);
|
||||
|
||||
int32 width = right - left + 1;
|
||||
int32 height = bottom - top + 1;
|
||||
|
@ -202,7 +203,7 @@ void Interface::drawTransparentBox(int32 left, int32 top, int32 right, int32 bot
|
|||
bottom = SCREEN_TEXTLIMIT_BOTTOM;
|
||||
}
|
||||
|
||||
uint8 *pos = (uint8*)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[top] + left;
|
||||
uint8 *pos = (uint8*)_engine->frontVideoBuffer.getBasePtr(left, top);
|
||||
const int32 height = bottom - top;
|
||||
int32 height2 = height + 1;
|
||||
const int32 width = right - left + 1;
|
||||
|
@ -245,7 +246,7 @@ void Interface::drawSplittedBox(int32 left, int32 top, int32 right, int32 bottom
|
|||
// cropping
|
||||
int32 offset = -((right - left) - SCREEN_WIDTH);
|
||||
|
||||
uint8 *ptr = (uint8*)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[top] + left;
|
||||
uint8 *ptr = (uint8*)_engine->frontVideoBuffer.getBasePtr(left, top);
|
||||
|
||||
for (int32 x = top; x < bottom; x++) {
|
||||
for (int32 y = left; y < right; y++) {
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
namespace Graphics {
|
||||
class ManagedSurface;
|
||||
}
|
||||
|
||||
namespace TwinE {
|
||||
|
||||
/** Screen top limit to display the texts */
|
||||
|
@ -75,7 +79,7 @@ public:
|
|||
* @param topDest start height to draw the button in destination buffer
|
||||
* @param dest destination screen buffer, in this case front buffer
|
||||
*/
|
||||
void blitBox(int32 left, int32 top, int32 right, int32 bottom, const int8 *source, int32 leftDest, int32 topDest, int8 *dest);
|
||||
void blitBox(int32 left, int32 top, int32 right, int32 bottom, const Graphics::ManagedSurface &source, int32 leftDest, int32 topDest, Graphics::ManagedSurface &dest);
|
||||
|
||||
/**
|
||||
* Draws inside buttons transparent area
|
||||
|
|
|
@ -221,7 +221,7 @@ void Menu::processPlasmaEffect(int32 left, int32 top, int32 color) {
|
|||
plasmaEffectRenderFrame();
|
||||
|
||||
const uint8 *in = plasmaEffectPtr + 5 * PLASMA_WIDTH;
|
||||
uint8 *out = (uint8 *)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[top] + left;
|
||||
uint8 *out = (uint8 *)_engine->frontVideoBuffer.getBasePtr(left, top);
|
||||
|
||||
for (int32 y = 0; y < PLASMA_HEIGHT / 2; y++) {
|
||||
for (int32 x = 0; x < PLASMA_WIDTH; x++) {
|
||||
|
@ -294,7 +294,7 @@ void Menu::drawButtonGfx(const MenuSettings *menuSettings, int32 width, int32 to
|
|||
}
|
||||
}
|
||||
} else {
|
||||
_engine->_interface->blitBox(left, top, right, bottom, (const int8 *)_engine->workVideoBuffer.getPixels(), left, top, (int8 *)_engine->frontVideoBuffer.getPixels());
|
||||
_engine->_interface->blitBox(left, top, right, bottom, _engine->workVideoBuffer, left, top, _engine->frontVideoBuffer);
|
||||
_engine->_interface->drawTransparentBox(left, top, right, bottom, 4);
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ void MenuOptions::drawSelectableCharacter(int32 x, int32 y, bool selected) {
|
|||
if (selected) {
|
||||
_engine->_interface->drawSplittedBox(left, top, right, bottom, 91);
|
||||
} else {
|
||||
_engine->_interface->blitBox(left, top, right, bottom, (const int8 *)_engine->workVideoBuffer.getPixels(), left, top, (int8 *)_engine->frontVideoBuffer.getPixels());
|
||||
_engine->_interface->blitBox(left, top, right, bottom, _engine->workVideoBuffer, left, top, _engine->frontVideoBuffer);
|
||||
_engine->_interface->drawTransparentBox(left, top, right, bottom, 4);
|
||||
}
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ void Redraw::blitBackgroundAreas() {
|
|||
const RedrawStruct *currentArea = currentRedrawList;
|
||||
|
||||
for (int32 i = 0; i < numOfRedrawBox; i++) {
|
||||
_engine->_interface->blitBox(currentArea->left, currentArea->top, currentArea->right, currentArea->bottom, (const int8 *)_engine->workVideoBuffer.getPixels(), currentArea->left, currentArea->top, (int8 *)_engine->frontVideoBuffer.getPixels());
|
||||
_engine->_interface->blitBox(currentArea->left, currentArea->top, currentArea->right, currentArea->bottom, _engine->workVideoBuffer, currentArea->left, currentArea->top, _engine->frontVideoBuffer);
|
||||
currentArea++;
|
||||
}
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ void Redraw::redrawEngineActions(int32 bgRedraw) { // fullRedraw
|
|||
addRedrawArea(_engine->_interface->textWindowLeft, _engine->_interface->textWindowTop, renderRight, renderBottom);
|
||||
|
||||
if (actor2->staticFlags.bIsBackgrounded && bgRedraw == 1) {
|
||||
_engine->_interface->blitBox(_engine->_interface->textWindowLeft, _engine->_interface->textWindowTop, renderRight, renderBottom, (const int8 *)_engine->frontVideoBuffer.getPixels(), _engine->_interface->textWindowLeft, _engine->_interface->textWindowTop, (int8 *)_engine->workVideoBuffer.getPixels());
|
||||
_engine->_interface->blitBox(_engine->_interface->textWindowLeft, _engine->_interface->textWindowTop, renderRight, renderBottom, _engine->frontVideoBuffer, _engine->_interface->textWindowLeft, _engine->_interface->textWindowTop, _engine->workVideoBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ void Redraw::redrawEngineActions(int32 bgRedraw) { // fullRedraw
|
|||
addRedrawArea(_engine->_interface->textWindowLeft, _engine->_interface->textWindowTop, _engine->_interface->textWindowRight, _engine->_interface->textWindowBottom);
|
||||
|
||||
if (actor2->staticFlags.bIsBackgrounded && bgRedraw == 1) {
|
||||
_engine->_interface->blitBox(_engine->_interface->textWindowLeft, _engine->_interface->textWindowTop, _engine->_interface->textWindowRight, _engine->_interface->textWindowBottom, (const int8 *)_engine->frontVideoBuffer.getPixels(), _engine->_interface->textWindowLeft, _engine->_interface->textWindowTop, (int8 *)_engine->workVideoBuffer.getPixels());
|
||||
_engine->_interface->blitBox(_engine->_interface->textWindowLeft, _engine->_interface->textWindowTop, _engine->_interface->textWindowRight, _engine->_interface->textWindowBottom, _engine->frontVideoBuffer, _engine->_interface->textWindowLeft, _engine->_interface->textWindowTop, _engine->workVideoBuffer);
|
||||
}
|
||||
|
||||
// show clipping area
|
||||
|
|
|
@ -162,7 +162,7 @@ void Text::drawCharacter(int32 x, int32 y, uint8 character) { // drawCharacter
|
|||
|
||||
const uint8 usedColor = dialTextColor;
|
||||
|
||||
uint8 *screen2 = (uint8 *)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[y] + x;
|
||||
uint8 *screen2 = (uint8 *)_engine->frontVideoBuffer.getBasePtr(x, y);
|
||||
|
||||
int32 tempX = x;
|
||||
int32 tempY = y;
|
||||
|
@ -278,7 +278,7 @@ int32 Text::getTextSize(const char *dialogue) { // SizeFont
|
|||
}
|
||||
|
||||
void Text::initDialogueBox() { // InitDialWindow
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, (const int8 *)_engine->workVideoBuffer.getPixels(), dialTextBoxLeft, dialTextBoxTop, (int8 *)_engine->frontVideoBuffer.getPixels());
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, _engine->workVideoBuffer, dialTextBoxLeft, dialTextBoxTop, _engine->frontVideoBuffer);
|
||||
|
||||
if (newGameVar4 != 0) {
|
||||
_engine->_menu->drawBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom);
|
||||
|
@ -287,11 +287,11 @@ void Text::initDialogueBox() { // InitDialWindow
|
|||
|
||||
_engine->copyBlockPhys(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom);
|
||||
printText8Var3 = 0;
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, (const int8 *)_engine->frontVideoBuffer.getPixels(), dialTextBoxLeft, dialTextBoxTop, (int8 *)_engine->workVideoBuffer.getPixels());
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, _engine->frontVideoBuffer, dialTextBoxLeft, dialTextBoxTop, _engine->workVideoBuffer);
|
||||
}
|
||||
|
||||
void Text::initInventoryDialogueBox() { // SecondInitDialWindow
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, (const int8 *)_engine->workVideoBuffer.getPixels(), dialTextBoxLeft, dialTextBoxTop, (int8 *)_engine->frontVideoBuffer.getPixels());
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, _engine->workVideoBuffer, dialTextBoxLeft, dialTextBoxTop, _engine->frontVideoBuffer);
|
||||
_engine->copyBlockPhys(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom);
|
||||
printText8Var3 = 0;
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ int Text::printText10() {
|
|||
return 0;
|
||||
}
|
||||
if (printText8Var6 != 0) {
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, (const int8 *)_engine->workVideoBuffer.getPixels(), dialTextBoxLeft, dialTextBoxTop, (int8 *)_engine->frontVideoBuffer.getPixels());
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, _engine->workVideoBuffer, dialTextBoxLeft, dialTextBoxTop, _engine->frontVideoBuffer);
|
||||
_engine->copyBlockPhys(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom);
|
||||
printText8Var3 = 0;
|
||||
printText8Var6 = 0;
|
||||
|
|
|
@ -265,14 +265,6 @@ void TwinEEngine::allocVideoMemory() {
|
|||
workVideoBuffer.create(SCREEN_WIDTH, SCREEN_HEIGHT, format);
|
||||
frontVideoBuffer.create(SCREEN_WIDTH, SCREEN_HEIGHT, format);
|
||||
|
||||
int32 j = 0;
|
||||
int32 k = 0;
|
||||
for (int32 i = SCREEN_HEIGHT; i > 0; i--) {
|
||||
screenLookupTable[j] = k;
|
||||
j++;
|
||||
k += SCREEN_WIDTH;
|
||||
}
|
||||
|
||||
// initVideoVar1 = -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -249,9 +249,6 @@ public:
|
|||
/** Main game video buffer */
|
||||
Graphics::ManagedSurface frontVideoBuffer;
|
||||
|
||||
/** temporary screen table */
|
||||
int32 screenLookupTable[2000]{0};
|
||||
|
||||
int32 loopInventoryItem = 0;
|
||||
int32 loopActorStep = 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue