mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-22 01:39:57 +00:00
TWINE: use Graphics::Surface instead of raw 8 bit buffer
This commit is contained in:
parent
3bc2c1921b
commit
ecbc291e25
@ -40,7 +40,7 @@ void Debug::debugFillButton(int32 X, int32 Y, int32 width, int32 height, int8 co
|
||||
uint8 *ptr;
|
||||
int32 offset;
|
||||
|
||||
ptr = _engine->frontVideoBuffer + _engine->screenLookupTable[Y] + X;
|
||||
ptr = (uint8*)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[Y] + X;
|
||||
offset = 640 - (width);
|
||||
|
||||
for (i = 0; i < height; i++) {
|
||||
|
@ -116,7 +116,7 @@ void FlaMovies::drawDeltaFrame(uint8 *ptr, int32 width) {
|
||||
void FlaMovies::scaleFla2x() {
|
||||
int32 i, j;
|
||||
uint8 *source = (uint8 *)flaBuffer;
|
||||
uint8 *dest = (uint8 *)_engine->workVideoBuffer;
|
||||
uint8 *dest = (uint8 *)_engine->workVideoBuffer.getPixels();
|
||||
|
||||
if (_engine->cfgfile.Movie == CONF_MOVIE_FLAWIDE) {
|
||||
for (i = 0; i < SCREEN_WIDTH / SCALE * 40; i++) {
|
||||
@ -156,19 +156,20 @@ void FlaMovies::processFrame() {
|
||||
uint32 opcodeBlockSize;
|
||||
uint8 opcode;
|
||||
int32 aux = 0;
|
||||
uint8 *ptr;
|
||||
|
||||
file.read(&frameData.videoSize, 1);
|
||||
file.read(&frameData.dummy, 1);
|
||||
file.read(&frameData.frameVar0, 4);
|
||||
if (frameData.frameVar0 > _engine->workVideoBuffer.w * _engine->workVideoBuffer.h * _engine->workVideoBuffer.format.bpp()) {
|
||||
return;
|
||||
}
|
||||
|
||||
file.read(workVideoBufferCopy, frameData.frameVar0);
|
||||
uint8 *ptr = (uint8*)_engine->workVideoBuffer.getPixels();
|
||||
file.read(ptr, frameData.frameVar0);
|
||||
|
||||
if ((int32)frameData.videoSize <= 0)
|
||||
return;
|
||||
|
||||
ptr = workVideoBufferCopy;
|
||||
|
||||
do {
|
||||
opcode = *((uint8 *)ptr);
|
||||
ptr += 2;
|
||||
@ -258,8 +259,6 @@ void FlaMovies::playFlaMovie(const char *flaName) {
|
||||
return;
|
||||
}
|
||||
|
||||
workVideoBufferCopy = _engine->workVideoBuffer;
|
||||
|
||||
file.read(&flaHeaderData.version, 6);
|
||||
flaHeaderData.numOfFrames = file.readUint32LE();
|
||||
flaHeaderData.speed = file.readByte();
|
||||
|
@ -104,8 +104,6 @@ private:
|
||||
int32 flaSampleTable[100] {0};
|
||||
/** Number of samples in FLA movie */
|
||||
int32 samplesInFla = 0;
|
||||
/** Auxiliar work video buffer */
|
||||
uint8 *workVideoBufferCopy = nullptr;
|
||||
/** FLA movie header data */
|
||||
FLAHeaderStruct flaHeaderData;
|
||||
/** FLA movie header data */
|
||||
|
@ -504,7 +504,7 @@ void GameState::processGameoverAnimation() { // makeGameOver
|
||||
|
||||
avg = _engine->_collision->getAverageValue(40000, 3200, 500, _engine->lbaTime - startLbaTime);
|
||||
cdot = _engine->_screens->crossDot(1, 1024, 100, (_engine->lbaTime - startLbaTime) % 0x64);
|
||||
_engine->_interface->blitBox(120, 120, 519, 359, (int8 *)_engine->workVideoBuffer, 120, 120, (int8 *)_engine->frontVideoBuffer);
|
||||
_engine->_interface->blitBox(120, 120, 519, 359, (int8 *)_engine->workVideoBuffer.getPixels(), 120, 120, (int8 *)_engine->frontVideoBuffer.getPixels());
|
||||
_engine->_renderer->setCameraAngle(0, 0, 0, 0, -cdot, 0, avg);
|
||||
_engine->_renderer->renderIsoModel(0, 0, 0, 0, 0, 0, gameOverPtr);
|
||||
_engine->copyBlockPhys(120, 120, 519, 359);
|
||||
@ -514,7 +514,7 @@ void GameState::processGameoverAnimation() { // makeGameOver
|
||||
}
|
||||
|
||||
_engine->_sound->playSample(37, _engine->getRandomNumber(2000) + 3096, 1, 0x80, 0x80, 0x80, -1);
|
||||
_engine->_interface->blitBox(120, 120, 519, 359, (int8 *)_engine->workVideoBuffer, 120, 120, (int8 *)_engine->frontVideoBuffer);
|
||||
_engine->_interface->blitBox(120, 120, 519, 359, (int8 *)_engine->workVideoBuffer.getPixels(), 120, 120, (int8 *)_engine->frontVideoBuffer.getPixels());
|
||||
_engine->_renderer->setCameraAngle(0, 0, 0, 0, 0, 0, 3200);
|
||||
_engine->_renderer->renderIsoModel(0, 0, 0, 0, 0, 0, gameOverPtr);
|
||||
_engine->copyBlockPhys(120, 120, 519, 359);
|
||||
|
@ -94,7 +94,7 @@ void Grid::copyGridMask(int32 index, int32 x, int32 y, uint8 *buffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 *outPtr = _engine->frontVideoBuffer + _engine->screenLookupTable[absY] + left;
|
||||
uint8 *outPtr = (uint8 *)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[absY] + left;
|
||||
uint8 *inPtr = buffer + _engine->screenLookupTable[absY] + left;
|
||||
|
||||
do {
|
||||
@ -140,7 +140,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, _engine->workVideoBuffer);
|
||||
copyGridMask(currBrickEntry->index, (j * 24) - 24, currBrickEntry->posY, (uint8 *)_engine->workVideoBuffer.getPixels());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,11 +163,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, _engine->workVideoBuffer);
|
||||
copyGridMask(currBrickEntry->index, (j * 24) - 24, currBrickEntry->posY, (uint8 *)_engine->workVideoBuffer.getPixels());
|
||||
}
|
||||
|
||||
if ((currBrickEntry->x > X) || (currBrickEntry->z > Z)) {
|
||||
copyGridMask(currBrickEntry->index, (j * 24) - 24, currBrickEntry->posY, _engine->workVideoBuffer);
|
||||
copyGridMask(currBrickEntry->index, (j * 24) - 24, currBrickEntry->posY, (uint8 *)_engine->workVideoBuffer.getPixels());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -475,7 +475,7 @@ void Grid::drawBrickSprite(int32 index, int32 posX, int32 posY, uint8 *ptr, bool
|
||||
right++;
|
||||
bottom++;
|
||||
|
||||
outPtr = _engine->frontVideoBuffer + _engine->screenLookupTable[top] + left;
|
||||
outPtr = (uint8 *)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[top] + left;
|
||||
|
||||
int32 offset = -((right - left) - SCREEN_WIDTH);
|
||||
|
||||
@ -489,16 +489,18 @@ void Grid::drawBrickSprite(int32 index, int32 posX, int32 posY, uint8 *ptr, bool
|
||||
if (!(temp & 0x40)) {
|
||||
temp = *(ptr++);
|
||||
for (int32 i = 0; i < iteration; i++) {
|
||||
if (x >= _engine->_interface->textWindowLeft && x < _engine->_interface->textWindowRight && y >= _engine->_interface->textWindowTop && y < _engine->_interface->textWindowBottom)
|
||||
_engine->frontVideoBuffer[y * SCREEN_WIDTH + x] = temp;
|
||||
if (x >= _engine->_interface->textWindowLeft && x < _engine->_interface->textWindowRight && y >= _engine->_interface->textWindowTop && y < _engine->_interface->textWindowBottom) {
|
||||
*(uint8 *)_engine->frontVideoBuffer.getBasePtr(x, y) = temp;
|
||||
}
|
||||
|
||||
x++;
|
||||
outPtr++;
|
||||
}
|
||||
} else {
|
||||
for (int32 i = 0; i < iteration; i++) {
|
||||
if (x >= _engine->_interface->textWindowLeft && x < _engine->_interface->textWindowRight && y >= _engine->_interface->textWindowTop && y < _engine->_interface->textWindowBottom)
|
||||
_engine->frontVideoBuffer[y * SCREEN_WIDTH + x] = *ptr;
|
||||
if (x >= _engine->_interface->textWindowLeft && x < _engine->_interface->textWindowRight && y >= _engine->_interface->textWindowTop && y < _engine->_interface->textWindowBottom) {
|
||||
*(uint8 *)_engine->frontVideoBuffer.getBasePtr(x, y) = *ptr;
|
||||
}
|
||||
|
||||
x++;
|
||||
ptr++;
|
||||
|
@ -114,7 +114,7 @@ void Interface::drawLine(int32 startWidth, int32 startHeight, int32 endWidth, in
|
||||
endHeight = -endHeight;
|
||||
}
|
||||
|
||||
out = _engine->frontVideoBuffer + _engine->screenLookupTable[startHeight] + startWidth;
|
||||
out = (uint8*)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[startHeight] + startWidth;
|
||||
|
||||
color = currentLineColor;
|
||||
if (endWidth < endHeight) { // significant slope
|
||||
@ -154,10 +154,10 @@ void Interface::drawLine(int32 startWidth, int32 startHeight, int32 endWidth, in
|
||||
}
|
||||
}
|
||||
|
||||
void Interface::blitBox(int32 left, int32 top, int32 right, int32 bottom, int8 *source, int32 leftDest, int32 topDest, int8 *dest) {
|
||||
void Interface::blitBox(int32 left, int32 top, int32 right, int32 bottom, const int8 *source, int32 leftDest, int32 topDest, int8 *dest) {
|
||||
int32 width;
|
||||
int32 height;
|
||||
int8 *s;
|
||||
const int8 *s;
|
||||
int8 *d;
|
||||
int32 insideLine;
|
||||
int32 temp3;
|
||||
@ -215,7 +215,7 @@ void Interface::drawTransparentBox(int32 left, int32 top, int32 right, int32 bot
|
||||
if (bottom > SCREEN_TEXTLIMIT_BOTTOM)
|
||||
bottom = SCREEN_TEXTLIMIT_BOTTOM;
|
||||
|
||||
pos = _engine->screenLookupTable[top] + _engine->frontVideoBuffer + left;
|
||||
pos = _engine->screenLookupTable[top] + (uint8*)_engine->frontVideoBuffer.getPixels() + left;
|
||||
height2 = height = bottom - top;
|
||||
height2++;
|
||||
|
||||
@ -263,7 +263,7 @@ void Interface::drawSplittedBox(int32 left, int32 top, int32 right, int32 bottom
|
||||
// cropping
|
||||
offset = -((right - left) - SCREEN_WIDTH);
|
||||
|
||||
ptr = _engine->frontVideoBuffer + _engine->screenLookupTable[top] + left;
|
||||
ptr = (uint8*)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[top] + left;
|
||||
|
||||
for (x = top; x < bottom; x++) {
|
||||
for (y = left; y < right; y++) {
|
||||
|
@ -75,7 +75,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, int8 *source, int32 leftDest, int32 topDest, int8 *dest);
|
||||
void blitBox(int32 left, int32 top, int32 right, int32 bottom, const int8 *source, int32 leftDest, int32 topDest, int8 *dest);
|
||||
|
||||
/**
|
||||
* Draws inside buttons transparent area
|
||||
|
@ -273,7 +273,7 @@ void Menu::processPlasmaEffect(int32 top, int32 color) {
|
||||
plasmaEffectRenderFrame();
|
||||
|
||||
in = plasmaEffectPtr + 5 * PLASMA_WIDTH;
|
||||
out = _engine->frontVideoBuffer + _engine->screenLookupTable[top];
|
||||
out = (uint8*)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[top];
|
||||
|
||||
for (i = 0; i < 25; i++) {
|
||||
for (j = 0; j < kMainMenuButtonWidth; j++) {
|
||||
@ -355,7 +355,7 @@ void Menu::drawButtonGfx(int32 width, int32 topheight, int32 id, int32 value, in
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_engine->_interface->blitBox(left, top, right, bottom, (int8 *)_engine->workVideoBuffer, left, top, (int8 *)_engine->frontVideoBuffer);
|
||||
_engine->_interface->blitBox(left, top, right, bottom, (const int8*)_engine->workVideoBuffer.getPixels(), left, top, (int8*)_engine->frontVideoBuffer.getPixels());
|
||||
_engine->_interface->drawTransparentBox(left, top, right, bottom2, 4);
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ void MenuOptions::drawSelectableCharacter(int32 x, int32 y, int32 arg) {
|
||||
if (arg != 0) {
|
||||
_engine->_interface->drawSplittedBox(left, top, right, bottom, 91);
|
||||
} else {
|
||||
_engine->_interface->blitBox(left, top, right, bottom, (int8 *)_engine->workVideoBuffer, left, top, (int8 *)_engine->frontVideoBuffer);
|
||||
_engine->_interface->blitBox(left, top, right, bottom, (const int8*)_engine->workVideoBuffer.getPixels(), left, top, (int8*)_engine->frontVideoBuffer.getPixels());
|
||||
right2 = right;
|
||||
_engine->_interface->drawTransparentBox(left, top, right2, bottom, 4);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "twine/redraw.h"
|
||||
#include "common/textconsole.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "twine/actor.h"
|
||||
#include "twine/animations.h"
|
||||
#include "twine/collision.h"
|
||||
@ -149,7 +150,7 @@ void Redraw::blitBackgroundAreas() {
|
||||
const RedrawStruct *currentArea = currentRedrawList;
|
||||
|
||||
for (i = 0; i < numOfRedrawBox; i++) {
|
||||
_engine->_interface->blitBox(currentArea->left, currentArea->top, currentArea->right, currentArea->bottom, (int8 *)_engine->workVideoBuffer, currentArea->left, currentArea->top, (int8 *)_engine->frontVideoBuffer);
|
||||
_engine->_interface->blitBox(currentArea->left, currentArea->top, currentArea->right, currentArea->bottom, (const int8*)_engine->workVideoBuffer.getPixels(), currentArea->left, currentArea->top, (int8*)_engine->frontVideoBuffer.getPixels());
|
||||
currentArea++;
|
||||
}
|
||||
}
|
||||
@ -393,7 +394,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, (int8 *)_engine->frontVideoBuffer, _engine->_interface->textWindowLeft, _engine->_interface->textWindowTop, (int8 *)_engine->workVideoBuffer);
|
||||
_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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -481,7 +482,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, (int8 *)_engine->frontVideoBuffer, _engine->_interface->textWindowLeft, _engine->_interface->textWindowTop, (int8 *)_engine->workVideoBuffer);
|
||||
_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());
|
||||
}
|
||||
|
||||
// show clipping area
|
||||
@ -763,25 +764,22 @@ void Redraw::drawBubble(int32 actorIdx) {
|
||||
}
|
||||
|
||||
void Redraw::zoomScreenScale() {
|
||||
uint8 *dest;
|
||||
uint8 *zoomWorkVideoBuffer = (uint8 *)malloc((SCREEN_WIDTH * SCREEN_HEIGHT) * sizeof(uint8));
|
||||
if (!zoomWorkVideoBuffer) {
|
||||
error("Failed to allocate memory for the scale buffer");
|
||||
}
|
||||
memcpy(zoomWorkVideoBuffer, _engine->workVideoBuffer, SCREEN_WIDTH * SCREEN_HEIGHT);
|
||||
Graphics::Surface zoomWorkVideoBuffer;
|
||||
zoomWorkVideoBuffer.copyFrom(_engine->workVideoBuffer);
|
||||
|
||||
dest = _engine->workVideoBuffer;
|
||||
|
||||
for (int h = 0; h < SCREEN_HEIGHT; h++) {
|
||||
for (int w = 0; w < SCREEN_WIDTH; w++) {
|
||||
*dest++ = *zoomWorkVideoBuffer;
|
||||
*dest++ = *zoomWorkVideoBuffer++;
|
||||
// TODO: this is broken
|
||||
const uint8 *src = (const uint8*)zoomWorkVideoBuffer.getPixels();
|
||||
uint8 *dest = (uint8*)_engine->workVideoBuffer.getPixels();
|
||||
for (int h = 0; h < zoomWorkVideoBuffer.h; h++) {
|
||||
for (int w = 0; w < zoomWorkVideoBuffer.w; w++) {
|
||||
*dest++ = *src;
|
||||
*dest++ = *src++;
|
||||
}
|
||||
//memcpy(dest, dest - SCREEN_WIDTH, SCREEN_WIDTH);
|
||||
//dest += SCREEN_WIDTH;
|
||||
}
|
||||
_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
|
||||
free(zoomWorkVideoBuffer);
|
||||
zoomWorkVideoBuffer.free();
|
||||
}
|
||||
|
||||
} // namespace TwinE
|
||||
|
@ -516,7 +516,7 @@ void Renderer::renderPolygons(int32 renderType, int32 color) {
|
||||
|
||||
int16 start, stop;
|
||||
|
||||
out = _engine->frontVideoBuffer + 640 * vtop;
|
||||
out = (uint8*)_engine->frontVideoBuffer.getPixels() + 640 * vtop;
|
||||
|
||||
ptr1 = &polyTab[vtop];
|
||||
ptr2 = &polyTab2[vtop];
|
||||
|
@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "common/system.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "twine/screens.h"
|
||||
#include "twine/hqrdepack.h"
|
||||
#include "twine/music.h"
|
||||
@ -39,7 +40,7 @@ void Screens::adelineLogo() {
|
||||
}
|
||||
|
||||
void Screens::loadMenuImage(bool fade_in) {
|
||||
_engine->_hqrdepack->hqrGetEntry(_engine->workVideoBuffer, Resources::HQR_RESS_FILE, RESSHQR_MENUIMG);
|
||||
_engine->_hqrdepack->hqrGetEntry((uint8*)_engine->workVideoBuffer.getPixels(), Resources::HQR_RESS_FILE, RESSHQR_MENUIMG);
|
||||
copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
|
||||
if (fade_in) {
|
||||
fadeToPal(paletteRGB);
|
||||
@ -60,7 +61,7 @@ void Screens::copyPal(const uint8* in, uint8* out) {
|
||||
}
|
||||
|
||||
void Screens::loadImage(int32 index, bool fade_in) {
|
||||
_engine->_hqrdepack->hqrGetEntry(_engine->workVideoBuffer, Resources::HQR_RESS_FILE, index);
|
||||
_engine->_hqrdepack->hqrGetEntry((uint8*)_engine->workVideoBuffer.getPixels(), Resources::HQR_RESS_FILE, index);
|
||||
copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
|
||||
loadCustomPalette(index + 1);
|
||||
if (fade_in) {
|
||||
@ -247,8 +248,12 @@ void Screens::copyScreen(const uint8 *source, uint8 *destination) {
|
||||
}
|
||||
}
|
||||
|
||||
void Screens::copyScreen(const Graphics::Surface& source, Graphics::Surface &destination) {
|
||||
copyScreen((const uint8 *)source.getPixels(), (uint8 *)destination.getPixels());
|
||||
}
|
||||
|
||||
void Screens::clearScreen() {
|
||||
memset(_engine->frontVideoBuffer, 0, SCREEN_WIDTH * SCREEN_HEIGHT);
|
||||
memset(_engine->frontVideoBuffer.getPixels(), 0, SCREEN_WIDTH * SCREEN_HEIGHT);
|
||||
}
|
||||
|
||||
} // namespace TwinE
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define TWINE_SCREENS_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "twine/twine.h"
|
||||
|
||||
namespace TwinE {
|
||||
@ -37,13 +38,13 @@ public:
|
||||
Screens(TwinEEngine *engine) : _engine(engine) {}
|
||||
|
||||
/** In-game palette (should not be used, except in special case. otherwise use other images functions instead) */
|
||||
uint8 palette[NUMOFCOLORS * 3] {0};
|
||||
uint8 palette[NUMOFCOLORS * 3]{0};
|
||||
|
||||
/** converted in-game palette */
|
||||
uint8 paletteRGB[NUMOFCOLORS * 3] {0};
|
||||
uint8 paletteRGB[NUMOFCOLORS * 3]{0};
|
||||
|
||||
/** converted custom palette */
|
||||
uint8 paletteRGBCustom[NUMOFCOLORS * 3] {0};
|
||||
uint8 paletteRGBCustom[NUMOFCOLORS * 3]{0};
|
||||
|
||||
/** flag to check if a custom palette is in use */
|
||||
int16 palCustom = 0;
|
||||
@ -61,12 +62,12 @@ public:
|
||||
uint8 *mainPalette = nullptr;
|
||||
|
||||
/** converted in-game palette */
|
||||
uint8 mainPaletteRGB[NUMOFCOLORS * 3] {0};
|
||||
uint8 mainPaletteRGB[NUMOFCOLORS * 3]{0};
|
||||
|
||||
/** Load and display Adeline Logo */
|
||||
void adelineLogo();
|
||||
|
||||
void copyPal(const uint8* in, uint8* out);
|
||||
void copyPal(const uint8 *in, uint8 *out);
|
||||
|
||||
/**
|
||||
* Load a custom palette
|
||||
@ -136,8 +137,10 @@ public:
|
||||
*/
|
||||
void fadeToBlack(uint8 *palette);
|
||||
|
||||
/** Fade image with another palette source
|
||||
@param palette current palette to fade */
|
||||
/**
|
||||
* Fade image with another palette source
|
||||
* @param palette current palette to fade
|
||||
*/
|
||||
void fadeToPal(uint8 *palette);
|
||||
|
||||
/** Fade black palette to white palette */
|
||||
@ -146,18 +149,25 @@ public:
|
||||
/** Resets both in-game and sdl palettes */
|
||||
void setBackPal();
|
||||
|
||||
/** Fade palette to red palette
|
||||
@param palette current palette to fade */
|
||||
/**
|
||||
* Fade palette to red palette
|
||||
* @param palette current palette to fade
|
||||
*/
|
||||
void fadePalRed(uint8 *palette);
|
||||
|
||||
/** Fade red to palette
|
||||
@param palette current palette to fade */
|
||||
/**
|
||||
* Fade red to palette
|
||||
* @param palette current palette to fade
|
||||
*/
|
||||
void fadeRedPal(uint8 *palette);
|
||||
|
||||
/** Copy a determinate screen buffer to another
|
||||
@param source screen buffer
|
||||
@param destination screen buffer */
|
||||
/**
|
||||
* Copy a determinate screen buffer to another
|
||||
* @param source screen buffer
|
||||
* @param destination screen buffer
|
||||
*/
|
||||
void copyScreen(const uint8 *source, uint8 *destination);
|
||||
void copyScreen(const Graphics::Surface &source, Graphics::Surface &destination);
|
||||
|
||||
/** Clear front buffer screen */
|
||||
void clearScreen();
|
||||
|
@ -181,7 +181,7 @@ void Text::drawCharacter(int32 x, int32 y, uint8 character) { // drawCharacter
|
||||
|
||||
usedColor = dialTextColor;
|
||||
|
||||
screen2 = _engine->frontVideoBuffer + _engine->screenLookupTable[y] + x;
|
||||
screen2 = (uint8*)_engine->frontVideoBuffer.getPixels() + _engine->screenLookupTable[y] + x;
|
||||
|
||||
tempX = x;
|
||||
tempY = y;
|
||||
@ -206,8 +206,9 @@ void Text::drawCharacter(int32 x, int32 y, uint8 character) { // drawCharacter
|
||||
} else {
|
||||
number = *(data++);
|
||||
for (i = 0; i < number; i++) {
|
||||
if (tempX >= SCREEN_TEXTLIMIT_LEFT && tempX < SCREEN_TEXTLIMIT_RIGHT && tempY >= SCREEN_TEXTLIMIT_TOP && tempY < SCREEN_TEXTLIMIT_BOTTOM)
|
||||
_engine->frontVideoBuffer[SCREEN_WIDTH * tempY + tempX] = usedColor;
|
||||
if (tempX >= SCREEN_TEXTLIMIT_LEFT && tempX < SCREEN_TEXTLIMIT_RIGHT && tempY >= SCREEN_TEXTLIMIT_TOP && tempY < SCREEN_TEXTLIMIT_BOTTOM) {
|
||||
*((uint8*)_engine->frontVideoBuffer.getBasePtr(tempX, tempY)) = usedColor;
|
||||
}
|
||||
|
||||
screen2++;
|
||||
tempX++;
|
||||
@ -298,7 +299,7 @@ int32 Text::getTextSize(const char *dialogue) { // SizeFont
|
||||
}
|
||||
|
||||
void Text::initDialogueBox() { // InitDialWindow
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, (int8 *)_engine->workVideoBuffer, dialTextBoxLeft, dialTextBoxTop, (int8 *)_engine->frontVideoBuffer);
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, (const int8 *)_engine->workVideoBuffer.getPixels(), dialTextBoxLeft, dialTextBoxTop, (int8 *)_engine->frontVideoBuffer.getPixels());
|
||||
|
||||
if (newGameVar4 != 0) {
|
||||
_engine->_menu->drawBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom);
|
||||
@ -307,11 +308,11 @@ void Text::initDialogueBox() { // InitDialWindow
|
||||
|
||||
_engine->copyBlockPhys(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom);
|
||||
printText8Var3 = 0;
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, (int8 *)_engine->frontVideoBuffer, dialTextBoxLeft, dialTextBoxTop, (int8 *)_engine->workVideoBuffer);
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, (const int8 *)_engine->frontVideoBuffer.getPixels(), dialTextBoxLeft, dialTextBoxTop, (int8 *)_engine->workVideoBuffer.getPixels());
|
||||
}
|
||||
|
||||
void Text::initInventoryDialogueBox() { // SecondInitDialWindow
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, (int8 *)_engine->workVideoBuffer, dialTextBoxLeft, dialTextBoxTop, (int8 *)_engine->frontVideoBuffer);
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, (const int8 *)_engine->workVideoBuffer.getPixels(), dialTextBoxLeft, dialTextBoxTop, (int8 *)_engine->frontVideoBuffer.getPixels());
|
||||
_engine->copyBlockPhys(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom);
|
||||
printText8Var3 = 0;
|
||||
}
|
||||
@ -546,7 +547,7 @@ int Text::printText10() {
|
||||
return 0;
|
||||
}
|
||||
if (printText8Var6 != 0) {
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, (int8 *)_engine->workVideoBuffer, dialTextBoxLeft, dialTextBoxTop, (int8 *)_engine->frontVideoBuffer);
|
||||
_engine->_interface->blitBox(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom, (const int8 *)_engine->workVideoBuffer.getPixels(), dialTextBoxLeft, dialTextBoxTop, (int8 *)_engine->frontVideoBuffer.getPixels());
|
||||
_engine->copyBlockPhys(dialTextBoxLeft, dialTextBoxTop, dialTextBoxRight, dialTextBoxBottom);
|
||||
printText8Var3 = 0;
|
||||
printText8Var6 = 0;
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "common/textconsole.h"
|
||||
#include "engines/util.h"
|
||||
#include "graphics/palette.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "gui/debugger.h"
|
||||
#include "twine/actor.h"
|
||||
#include "twine/animations.h"
|
||||
@ -138,9 +139,9 @@ bool TwinEEngine::hasFeature(EngineFeature f) const {
|
||||
}
|
||||
|
||||
void TwinEEngine::allocVideoMemory() {
|
||||
const size_t videoBufferSize = (SCREEN_WIDTH * SCREEN_HEIGHT) * sizeof(uint8);
|
||||
workVideoBuffer = (uint8 *)malloc(videoBufferSize);
|
||||
frontVideoBuffer = (uint8 *)malloc(videoBufferSize);
|
||||
const Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
|
||||
workVideoBuffer.create(SCREEN_WIDTH, SCREEN_HEIGHT, format);
|
||||
frontVideoBuffer.create(SCREEN_WIDTH, SCREEN_HEIGHT, format);
|
||||
|
||||
int32 j = 0;
|
||||
int32 k = 0;
|
||||
@ -803,21 +804,26 @@ void TwinEEngine::fadeBlackToWhite() {
|
||||
}
|
||||
|
||||
void TwinEEngine::flip() {
|
||||
g_system->copyRectToScreen(frontVideoBuffer, SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
g_system->copyRectToScreen(frontVideoBuffer.getPixels(), frontVideoBuffer.pitch, 0, 0, frontVideoBuffer.w, frontVideoBuffer.h);
|
||||
g_system->updateScreen();
|
||||
}
|
||||
|
||||
void TwinEEngine::copyBlockPhys(int32 left, int32 top, int32 right, int32 bottom) {
|
||||
g_system->copyRectToScreen(frontVideoBuffer, SCREEN_WIDTH, left, top, right - left + 1, bottom - top + 1);
|
||||
// TODO: fix this
|
||||
//g_system->copyRectToScreen(frontVideoBuffer, SCREEN_WIDTH, left, top, right - left + 1, bottom - top + 1);
|
||||
g_system->updateScreen();
|
||||
}
|
||||
|
||||
void TwinEEngine::crossFade(uint8 *buffer, uint8 *palette) {
|
||||
void TwinEEngine::crossFade(const uint8 *buffer, uint8 *palette) {
|
||||
// TODO: implement cross fading
|
||||
g_system->copyRectToScreen(buffer, SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
g_system->updateScreen();
|
||||
}
|
||||
|
||||
void TwinEEngine::crossFade(const Graphics::Surface &buffer, uint8 *palette) {
|
||||
crossFade((const uint8*)buffer.getPixels(), palette);
|
||||
}
|
||||
|
||||
void TwinEEngine::toggleFullscreen() {
|
||||
_redraw->reqBgRedraw = 1;
|
||||
_system->setFeatureState(OSystem::kFeatureFullscreenMode, cfgfile.FullScreen);
|
||||
|
@ -218,9 +218,9 @@ public:
|
||||
int16 rightMouse = 0;
|
||||
|
||||
/** Work video buffer */
|
||||
uint8 *workVideoBuffer = nullptr;
|
||||
Graphics::Surface workVideoBuffer;
|
||||
/** Main game video buffer */
|
||||
uint8 *frontVideoBuffer = nullptr;
|
||||
Graphics::Surface frontVideoBuffer;
|
||||
|
||||
/** temporary screen table */
|
||||
int32 screenLookupTable[2000]{0};
|
||||
@ -280,7 +280,8 @@ public:
|
||||
* @param buffer screen buffer
|
||||
* @param palette new palette to cross fade
|
||||
*/
|
||||
void crossFade(uint8 *buffer, uint8 *palette);
|
||||
void crossFade(const uint8 *buffer, uint8 *palette);
|
||||
void crossFade(const Graphics::Surface &buffer, uint8 *palette);
|
||||
|
||||
/** Switch between window and fullscreen modes */
|
||||
void toggleFullscreen();
|
||||
|
Loading…
Reference in New Issue
Block a user