Removed all hardcoded screen sizes

svn-id: r47072
This commit is contained in:
Filippos Karapetis 2010-01-06 12:17:03 +00:00
parent 1c6ccf8000
commit bcf7535c97
3 changed files with 15 additions and 10 deletions

View file

@ -1822,6 +1822,7 @@ reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) {
if (argc > 7)
opt = argv[7].toUint16();
} else {
// SCI1.1 and older games always ran with an internal resolution of 320x200
poly_list = argv[4];
width = 320;
height = 190;

View file

@ -170,7 +170,7 @@ void Transitions::doit(Common::Rect picRect) {
// Now we do the actual transition to the new screen
doTransition(_number, false);
if (picRect.bottom != 320) {
if (picRect.bottom != _screen->_height) {
// TODO: this is a workaround for lsl6 not showing menubar when playing
// There is some new code in the sierra sci in ShowPic that seems to do something similar to this
_screen->copyToScreen();
@ -305,10 +305,10 @@ void Transitions::pixelation (bool blackoutFlag) {
do {
mask = (mask & 1) ? (mask >> 1) ^ 0xB400 : mask >> 1;
if (mask >= 320 * 200)
if (mask >= _screen->_width * _screen->_height)
continue;
pixelRect.left = mask % 320; pixelRect.right = pixelRect.left + 1;
pixelRect.top = mask / 320; pixelRect.bottom = pixelRect.top + 1;
pixelRect.left = mask % _screen->_width; pixelRect.right = pixelRect.left + 1;
pixelRect.top = mask / _screen->_width; pixelRect.bottom = pixelRect.top + 1;
pixelRect.clip(_picRect);
if (!pixelRect.isEmpty())
copyRectToScreen(pixelRect, blackoutFlag);

View file

@ -35,6 +35,10 @@
namespace Sci {
// SEQ videos always run at 320x200
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 200
enum seqPalTypes {
kSeqPalVariable = 0,
kSeqPalConstant = 1
@ -59,8 +63,8 @@ bool SeqDecoder::loadFile(const char *fileName, int frameDelay) {
// Seek to the first frame
_videoInfo.currentFrame = 0;
_videoInfo.width = 320;
_videoInfo.height = 200;
_videoInfo.width = SCREEN_WIDTH;
_videoInfo.height = SCREEN_HEIGHT;
_videoInfo.frameCount = _fileStream->readUint16LE();
// Our frameDelay is calculated in 1/100 ms, so we convert it here
_videoInfo.frameDelay = 100 * frameDelay * 1000 / 60;
@ -129,7 +133,7 @@ bool SeqDecoder::decodeNextFrame() {
_videoInfo.startTime = g_system->getMillis();
if (frameType == kSeqFrameFull) {
byte *dst = _videoFrameBuffer + frameTop * 320 + frameLeft;
byte *dst = _videoFrameBuffer + frameTop * SCREEN_WIDTH + frameLeft;
byte *linebuf = new byte[frameWidth];
@ -143,7 +147,7 @@ bool SeqDecoder::decodeNextFrame() {
} else {
byte *buf = new byte[frameSize];
_fileStream->read(buf, frameSize);
decodeFrame(buf, rleSize, buf + rleSize, frameSize - rleSize, _videoFrameBuffer + 320 * frameTop, frameLeft, frameWidth, frameHeight, colorKey);
decodeFrame(buf, rleSize, buf + rleSize, frameSize - rleSize, _videoFrameBuffer + SCREEN_WIDTH * frameTop, frameLeft, frameWidth, frameHeight, colorKey);
delete[] buf;
}
@ -151,14 +155,14 @@ bool SeqDecoder::decodeNextFrame() {
}
#define WRITE_TO_BUFFER(n) \
if (writeRow * 320 + writeCol + (n) > 320 * height) { \
if (writeRow * SCREEN_WIDTH + writeCol + (n) > SCREEN_WIDTH * height) { \
warning("SEQ player: writing out of bounds, aborting"); \
return false; \
} \
if (litPos + (n) > litSize) { \
warning("SEQ player: reading out of bounds, aborting"); \
} \
memcpy(dest + writeRow * 320 + writeCol, litData + litPos, n);
memcpy(dest + writeRow * SCREEN_WIDTH + writeCol, litData + litPos, n);
bool SeqDecoder::decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey) {
int writeRow = 0;