TWINE: removing scaling code - use scummvm scaling

This commit is contained in:
Martin Gerhardy 2020-11-12 21:31:58 +01:00
parent 78ff2078ab
commit e729e2eaea
7 changed files with 15 additions and 37 deletions

View File

@ -137,7 +137,7 @@ void FlaMovies::scaleFla2x() {
uint8 *dest = (uint8 *)_engine->workVideoBuffer.getPixels();
if (_engine->cfgfile.Movie == CONF_MOVIE_FLAWIDE) {
for (i = 0; i < SCREEN_WIDTH / SCALE * 40; i++) {
for (i = 0; i < SCREEN_WIDTH * 40; i++) {
*(dest++) = 0x00;
}
}
@ -148,22 +148,22 @@ void FlaMovies::scaleFla2x() {
*(dest++) = *(source++);
}
if (_engine->cfgfile.Movie == CONF_MOVIE_FLAWIDE) { // include wide bars
memcpy(dest, dest - SCREEN_WIDTH / SCALE, FLASCREEN_WIDTH * 2);
memcpy(dest, dest - SCREEN_WIDTH, FLASCREEN_WIDTH * 2);
dest += FLASCREEN_WIDTH * 2;
} else { // stretch the movie like original game.
if (i % (2)) {
memcpy(dest, dest - SCREEN_WIDTH / SCALE, FLASCREEN_WIDTH * 2);
memcpy(dest, dest - SCREEN_WIDTH, FLASCREEN_WIDTH * 2);
dest += FLASCREEN_WIDTH * 2;
}
if (i % 10) {
memcpy(dest, dest - SCREEN_WIDTH / SCALE, FLASCREEN_WIDTH * 2);
memcpy(dest, dest - SCREEN_WIDTH, FLASCREEN_WIDTH * 2);
dest += FLASCREEN_WIDTH * 2;
}
}
}
if (_engine->cfgfile.Movie == CONF_MOVIE_FLAWIDE) {
for (i = 0; i < SCREEN_WIDTH / SCALE * 40; i++) {
for (i = 0; i < SCREEN_WIDTH * 40; i++) {
*(dest++) = 0x00;
}
}

View File

@ -104,7 +104,7 @@ void Interface::drawLine(int32 startWidth, int32 startHeight, int32 endWidth, in
}
}
int32 flag2 = DEFAULT_SCREEN_WIDTH;
int32 flag2 = SCREEN_WIDTH;
endWidth -= startWidth;
endHeight -= startHeight;
if (endHeight < 0) {
@ -206,7 +206,7 @@ void Interface::drawTransparentBox(int32 left, int32 top, int32 right, int32 bot
const int32 height = bottom - top;
int32 height2 = height + 1;
const int32 width = right - left + 1;
const int32 pitch = DEFAULT_SCREEN_WIDTH - width;
const int32 pitch = SCREEN_WIDTH - width;
const int32 localMode = colorAdj;
do {

View File

@ -227,11 +227,11 @@ void Menu::processPlasmaEffect(int32 left, int32 top, int32 color) {
for (int32 x = 0; x < PLASMA_WIDTH; x++) {
const uint8 c = MIN(in[y * PLASMA_WIDTH + x] / 2 + color, max_value);
/* 2x2 squares sharing the same pixel color: */
const int32 target = 2 * (y * DEFAULT_SCREEN_WIDTH + x);
const int32 target = 2 * (y * SCREEN_WIDTH + x);
out[target + 0] = c;
out[target + 1] = c;
out[target + DEFAULT_SCREEN_WIDTH + 0] = c;
out[target + DEFAULT_SCREEN_WIDTH + 1] = c;
out[target + SCREEN_WIDTH + 0] = c;
out[target + SCREEN_WIDTH + 1] = c;
}
}
}

View File

@ -252,23 +252,8 @@ void Screens::fadeRedPal(const uint32 *pal) {
}
}
void Screens::copyScreen(const uint8 *source, uint8 *destination) {
if (SCALE == 1) {
memcpy(destination, source, SCREEN_WIDTH * SCREEN_HEIGHT);
} else if (SCALE == 2) {
for (int32 h = 0; h < SCREEN_HEIGHT / SCALE; h++) {
for (int32 w = 0; w < SCREEN_WIDTH / SCALE; w++) {
*destination++ = *source;
*destination++ = *source++;
}
memcpy(destination, destination - SCREEN_WIDTH, SCREEN_WIDTH);
destination += SCREEN_WIDTH;
}
}
}
void Screens::copyScreen(const Graphics::ManagedSurface& source, Graphics::ManagedSurface &destination) {
copyScreen((const uint8 *)source.getPixels(), (uint8 *)destination.getPixels());
destination.blitFrom(source);
}
void Screens::clearScreen() {

View File

@ -167,7 +167,6 @@ public:
* @param source screen buffer
* @param destination screen buffer
*/
void copyScreen(const uint8 *source, uint8 *destination);
void copyScreen(const Graphics::ManagedSurface &source, Graphics::ManagedSurface &destination);
/** Clear front buffer screen */

View File

@ -1460,8 +1460,8 @@ static int32 lTEXT(TwinEEngine *engine, LifeScriptContext &ctx) {
int32 textBoxRight = textSize;
engine->_text->setFontColor(15);
engine->_text->drawText(0, drawVar1, textStr);
if (textSize > DEFAULT_SCREEN_WIDTH - 1) {
textBoxRight = DEFAULT_SCREEN_WIDTH - 1;
if (textSize > SCREEN_WIDTH - 1) {
textBoxRight = SCREEN_WIDTH - 1;
}
drawVar1 += 40;

View File

@ -45,15 +45,9 @@ namespace TwinE {
#define MODIFICATION_VERSION 2
/** Original screen width */
#define DEFAULT_SCREEN_WIDTH 640
#define SCREEN_WIDTH 640
/** Original screen height */
#define DEFAULT_SCREEN_HEIGHT 480
/** Scale screen to double size */
#define SCALE 1 // TODO: remove me or support me
/** Original screen width */
#define SCREEN_WIDTH DEFAULT_SCREEN_WIDTH *SCALE
/** Original screen height */
#define SCREEN_HEIGHT DEFAULT_SCREEN_HEIGHT *SCALE
#define SCREEN_HEIGHT 480
/** Default frames per second */
#define DEFAULT_FRAMES_PER_SECOND 19