Applied cleanup and scaling patch by Rob.
svn-id: r3665
This commit is contained in:
parent
4a98b9b9e9
commit
178540c989
15 changed files with 287 additions and 65 deletions
|
@ -156,9 +156,9 @@ int Scumm::calcMovementFactor(Actor *a, int newX, int newY) {
|
||||||
a->walkdata.yfrac = 0;
|
a->walkdata.yfrac = 0;
|
||||||
|
|
||||||
if(_gameId==GID_DIG) {
|
if(_gameId==GID_DIG) {
|
||||||
float temp;
|
double temp;
|
||||||
temp = atan2 (XYFactor, -YXFactor);
|
temp = atan2 (XYFactor, -YXFactor);
|
||||||
a->newDirection = normalizeAngle(temp * 1.8e2 / 3.14);
|
a->newDirection = normalizeAngle((int)(temp * 1.8e2 / 3.14));
|
||||||
} else {
|
} else {
|
||||||
a->newDirection = getAngleFromPos(XYFactor, YXFactor);
|
a->newDirection = getAngleFromPos(XYFactor, YXFactor);
|
||||||
}
|
}
|
||||||
|
@ -465,7 +465,7 @@ AdjustBoxResult Scumm::adjustXYToBeInBox(Actor *a, int x, int y, int pathfrom) {
|
||||||
AdjustBoxResult abr,tmp;
|
AdjustBoxResult abr,tmp;
|
||||||
uint threshold;
|
uint threshold;
|
||||||
uint best;
|
uint best;
|
||||||
int box, iterations; /* Use inerations for those odd times we get stuck in the loop */
|
int box, iterations = 0; /* Use inerations for those odd times we get stuck in the loop */
|
||||||
byte flags, b;
|
byte flags, b;
|
||||||
|
|
||||||
abr.x = x;
|
abr.x = x;
|
||||||
|
@ -480,7 +480,7 @@ AdjustBoxResult Scumm::adjustXYToBeInBox(Actor *a, int x, int y, int pathfrom) {
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
iterations++;
|
iterations++;
|
||||||
if (iterations > 1000) return abr; /* Safety net */
|
if (iterations > 3000000) return abr; /* Safety net */
|
||||||
box = getNumBoxes() - 1;
|
box = getNumBoxes() - 1;
|
||||||
best = (uint)0xFFFF;
|
best = (uint)0xFFFF;
|
||||||
b = 0;
|
b = 0;
|
||||||
|
|
2
akos.cpp
2
akos.cpp
|
@ -39,7 +39,7 @@ int Scumm::akos_findManyDirection(int16 ManyDirection, uint16 facing)
|
||||||
{
|
{
|
||||||
int32 direction;
|
int32 direction;
|
||||||
int32 temp;
|
int32 temp;
|
||||||
int32 temp_facing;
|
|
||||||
temp=many_direction_tab[ManyDirection];
|
temp=many_direction_tab[ManyDirection];
|
||||||
direction=temp + ManyDirection * 8;
|
direction=temp + ManyDirection * 8;
|
||||||
do{
|
do{
|
||||||
|
|
|
@ -149,6 +149,7 @@ bool ScummDebugger::do_command() {
|
||||||
|
|
||||||
default: /* this line is never reached */
|
default: /* this line is never reached */
|
||||||
error("Unknown debug command");
|
error("Unknown debug command");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
gfx.cpp
4
gfx.cpp
|
@ -553,7 +553,7 @@ void Scumm::redrawBGAreas() {
|
||||||
int i;
|
int i;
|
||||||
int val;
|
int val;
|
||||||
CameraData *cd = &camera;
|
CameraData *cd = &camera;
|
||||||
int diff; // Full throttle hack
|
int diff;
|
||||||
|
|
||||||
if (!(_features & GF_AFTER_V7))
|
if (!(_features & GF_AFTER_V7))
|
||||||
if (cd->_cur.x!=cd->_last.x && charset._hasMask)
|
if (cd->_cur.x!=cd->_last.x && charset._hasMask)
|
||||||
|
@ -2369,7 +2369,7 @@ void Scumm::drawBomp(BompDrawData *bd) {
|
||||||
src = bd->dataptr;
|
src = bd->dataptr;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
byte color,code;
|
byte color;
|
||||||
uint len, num;
|
uint len, num;
|
||||||
uint x;
|
uint x;
|
||||||
if ((uint)y >= (uint)bd->outheight) {
|
if ((uint)y >= (uint)bd->outheight) {
|
||||||
|
|
|
@ -491,7 +491,7 @@ void Scumm::loadRoomObjectsSmall() {
|
||||||
|
|
||||||
void Scumm::setupRoomObject(ObjectData *od, byte *room) {
|
void Scumm::setupRoomObject(ObjectData *od, byte *room) {
|
||||||
CodeHeader *cdhd;
|
CodeHeader *cdhd;
|
||||||
ImageHeader *imhd; // Full throttle hack
|
ImageHeader *imhd;
|
||||||
|
|
||||||
if(_features & GF_SMALL_HEADER) {
|
if(_features & GF_SMALL_HEADER) {
|
||||||
|
|
||||||
|
|
|
@ -334,7 +334,7 @@ void Scumm::writeVar(uint var, int value) {
|
||||||
checkRange(_numVariables-1, 0, var, "Variable %d out of range(w)");
|
checkRange(_numVariables-1, 0, var, "Variable %d out of range(w)");
|
||||||
_vars[var] = value;
|
_vars[var] = value;
|
||||||
|
|
||||||
if ((_varwatch == var) || (_varwatch == 0))
|
if ((_varwatch == (int)var) || (_varwatch == 0))
|
||||||
printf("vars[%d] = %d (via script %d)\n", var, value, &vm.slot[_currentScript].number);
|
printf("vars[%d] = %d (via script %d)\n", var, value, &vm.slot[_currentScript].number);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2611,7 +2611,7 @@ void Scumm::o6_miscOps() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 117:
|
case 117:
|
||||||
error("stub o6_miscOps_117()");
|
warning("stub o6_miscOps_117()");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 118:
|
case 118:
|
||||||
|
|
5
scumm.h
5
scumm.h
|
@ -956,6 +956,9 @@ struct Scumm {
|
||||||
|
|
||||||
uint16 _debugMode;
|
uint16 _debugMode;
|
||||||
|
|
||||||
|
uint16 _noSubtitles; // skip all subtitles?
|
||||||
|
unsigned int _scale; // multiplier to resolution (2 is default)
|
||||||
|
|
||||||
byte *_messagePtr;
|
byte *_messagePtr;
|
||||||
|
|
||||||
byte _numNestedScripts;
|
byte _numNestedScripts;
|
||||||
|
@ -2214,7 +2217,7 @@ void CDECL NORETURN error(const char *s, ...);
|
||||||
void CDECL warning(const char *s, ...);
|
void CDECL warning(const char *s, ...);
|
||||||
void CDECL debug(int level, const char *s, ...);
|
void CDECL debug(int level, const char *s, ...);
|
||||||
void checkHeap();
|
void checkHeap();
|
||||||
void initGraphics(Scumm *s, bool fullScreen);
|
void initGraphics(Scumm *s, bool fullScreen, unsigned int scaleFactor = 2);
|
||||||
void updateScreen(Scumm *s);
|
void updateScreen(Scumm *s);
|
||||||
void drawMouse(Scumm *s, int x, int y, int color, byte *mask, bool visible);
|
void drawMouse(Scumm *s, int x, int y, int color, byte *mask, bool visible);
|
||||||
void drawMouse(Scumm *s, int x, int y, int w, int h, byte *buf, bool visible);
|
void drawMouse(Scumm *s, int x, int y, int w, int h, byte *buf, bool visible);
|
||||||
|
|
75
scummvm.cpp
75
scummvm.cpp
|
@ -191,7 +191,9 @@ void Scumm::scummMain(int argc, char **argv) {
|
||||||
|
|
||||||
_fileHandle = NULL;
|
_fileHandle = NULL;
|
||||||
|
|
||||||
_debugMode = 1;
|
_debugMode = 0; // off by default...
|
||||||
|
_noSubtitles = 0; // use by default - should this depend on soundtrack?
|
||||||
|
_scale = 2; // double size by default
|
||||||
|
|
||||||
_maxHeapThreshold = 450000;
|
_maxHeapThreshold = 450000;
|
||||||
_minHeapThreshold = 400000;
|
_minHeapThreshold = 400000;
|
||||||
|
@ -234,7 +236,7 @@ void Scumm::scummMain(int argc, char **argv) {
|
||||||
// _bootParam = 10001;
|
// _bootParam = 10001;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
initGraphics(this, _fullScreen);
|
initGraphics(this, _fullScreen, _scale);
|
||||||
|
|
||||||
if (_features & GF_SMALL_HEADER)
|
if (_features & GF_SMALL_HEADER)
|
||||||
readIndexFileSmall();
|
readIndexFileSmall();
|
||||||
|
@ -397,10 +399,32 @@ int Scumm::scummLoop(int delta) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define USAGE_STRING "ScummVM - Scumm Interpreter\n" \
|
||||||
|
"Syntax:\n" \
|
||||||
|
"\tscummvm [-v] [-d] [-n] [-b<num>] [-t<num>] [-s<num>] [-p<path>] [-m<num>] [-f] game\n" \
|
||||||
|
"Flags:\n" \
|
||||||
|
"\tv - show version info and exit\n" \
|
||||||
|
"\td - enable debug output\n" \
|
||||||
|
"\tn - no subtitles for speech\n" \
|
||||||
|
"\tb<num> - start in room <num>\n" \
|
||||||
|
"\tt<num> - Set music tempo. Suggested: 1F0000\n" \
|
||||||
|
"\ts<num> - Set scale factor to <num> (1, 2, or 3 - 2 by default)\n" \
|
||||||
|
"\tp<path> - look for game in <path>\n" \
|
||||||
|
"\tm<num> - Set music volume to <num> (0-100)\n" \
|
||||||
|
"\tf - fullscreen mode\n"
|
||||||
|
|
||||||
void Scumm::parseCommandLine(int argc, char **argv) {
|
void Scumm::parseCommandLine(int argc, char **argv) {
|
||||||
int i;
|
int i;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
|
// check for arguments
|
||||||
|
if (argc < 2)
|
||||||
|
{
|
||||||
|
printf( USAGE_STRING );
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
/* Parse the arguments */
|
/* Parse the arguments */
|
||||||
for (i=1; i < argc; i++) {
|
for (i=1; i < argc; i++) {
|
||||||
s = argv[i];
|
s = argv[i];
|
||||||
|
@ -410,21 +434,49 @@ void Scumm::parseCommandLine(int argc, char **argv) {
|
||||||
while (*s) {
|
while (*s) {
|
||||||
switch(tolower(*s)) {
|
switch(tolower(*s)) {
|
||||||
case 'b':
|
case 'b':
|
||||||
|
if (*(s+1) == '\0')
|
||||||
|
goto ShowHelpAndExit;
|
||||||
_bootParam = atoi(s+1);
|
_bootParam = atoi(s+1);
|
||||||
goto NextArg;
|
goto NextArg;
|
||||||
case 'f':
|
case 'f':
|
||||||
_fullScreen = true;
|
_fullScreen = true;
|
||||||
break;
|
break;
|
||||||
|
case 'd':
|
||||||
|
_debugMode = true;
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
_noSubtitles = true;
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
if (*(s+1) == '\0')
|
||||||
|
goto ShowHelpAndExit;
|
||||||
|
_scale = atoi(s+1);
|
||||||
|
if (_scale == 0 || _scale > 3)
|
||||||
|
{
|
||||||
|
// bad scale - only 1, 2, 3 work for now
|
||||||
|
printf("Invalid scale '%s' - valid values are 1, 2, 3\n", s+1);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
goto NextArg;
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("ScummVM " SCUMMVM_VERSION "\nBuilt on " __DATE__ " " __TIME__ "\n");
|
printf("ScummVM " SCUMMVM_VERSION "\nBuilt on " __DATE__ " " __TIME__ "\n");
|
||||||
|
#ifdef SCUMMVM_PLATFORM_VERSION
|
||||||
|
printf(" " SCUMMVM_PLATFORM_VERSION "\n");
|
||||||
|
#endif
|
||||||
exit(1);
|
exit(1);
|
||||||
case 'p':
|
case 'p':
|
||||||
_gameDataPath = argv[++i];
|
if (*(s+1) == '\0')
|
||||||
break;
|
goto ShowHelpAndExit;
|
||||||
|
_gameDataPath = s+1;
|
||||||
|
goto NextArg;
|
||||||
case 't':
|
case 't':
|
||||||
|
if (*(s+1) == '\0')
|
||||||
|
goto ShowHelpAndExit;
|
||||||
_gameTempo = atoi(s+1);
|
_gameTempo = atoi(s+1);
|
||||||
goto NextArg;
|
goto NextArg;
|
||||||
case 'm': {
|
case 'm': {
|
||||||
|
if (*(s+1) == '\0')
|
||||||
|
goto ShowHelpAndExit;
|
||||||
SoundEngine *se = (SoundEngine*)_soundEngine;
|
SoundEngine *se = (SoundEngine*)_soundEngine;
|
||||||
if (se)
|
if (se)
|
||||||
se->set_music_volume(atoi(s+1));
|
se->set_music_volume(atoi(s+1));
|
||||||
|
@ -432,15 +484,7 @@ void Scumm::parseCommandLine(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
ShowHelpAndExit:;
|
ShowHelpAndExit:;
|
||||||
printf(
|
printf( USAGE_STRING );
|
||||||
"ScummVM - Scumm Interpreter\n"
|
|
||||||
"Syntax:\n"
|
|
||||||
"\tscummvm [-b<num>] [-p path] [-f] [-m<num>] [-t<num>] game\n"
|
|
||||||
"Flags:\n"
|
|
||||||
"\tm<num> - Set music volume (0-100)\n"
|
|
||||||
"\tt<num> - Set music tempo (Default: 2031616)\n"
|
|
||||||
"\tb<num> - start in that room\n"
|
|
||||||
"\tf - fullscreen mode\n");
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
s++;
|
s++;
|
||||||
|
@ -1157,14 +1201,15 @@ void NORETURN CDECL error(const char *s, ...) {
|
||||||
|
|
||||||
if (scumm._currentScript != 0xFF) {
|
if (scumm._currentScript != 0xFF) {
|
||||||
ScriptSlot *ss = &scumm.vm.slot[scumm._currentScript];
|
ScriptSlot *ss = &scumm.vm.slot[scumm._currentScript];
|
||||||
fprintf(stderr, "Error(%d:%d:0x%X): %s!\nPress a key to quit.\n",
|
fprintf(stderr, "Error(%d:%d:0x%X): %s!\n",
|
||||||
scumm._roomResource,
|
scumm._roomResource,
|
||||||
ss->number,
|
ss->number,
|
||||||
scumm._scriptPointer - scumm._scriptOrgPointer,
|
scumm._scriptPointer - scumm._scriptOrgPointer,
|
||||||
buf);
|
buf);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Error: %s!\nPress a key to quit.\n", buf);
|
fprintf(stderr, "Error: %s!\n", buf);
|
||||||
}
|
}
|
||||||
|
// Doesn't wait for any keypress!! Is it intended to?
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,8 @@ RSC=rc.exe
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||||
# ADD CPP /nologo /Zp4 /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
# ADD CPP /nologo /G6 /Zp8 /MD /W3 /GX- /O2 /Ob2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
|
||||||
|
# SUBTRACT CPP /YX /Yc /Yu
|
||||||
# ADD BASE RSC /l 0x41d /d "NDEBUG"
|
# ADD BASE RSC /l 0x41d /d "NDEBUG"
|
||||||
# ADD RSC /l 0x41d /d "NDEBUG"
|
# ADD RSC /l 0x41d /d "NDEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
|
210
sdl.cpp
210
sdl.cpp
|
@ -27,7 +27,7 @@
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "SDL_thread.h"
|
#include "SDL_thread.h"
|
||||||
|
|
||||||
#define SCALEUP_2x2
|
static unsigned int scale;
|
||||||
|
|
||||||
Scumm scumm;
|
Scumm scumm;
|
||||||
ScummDebugger debugger;
|
ScummDebugger debugger;
|
||||||
|
@ -121,13 +121,21 @@ void waitForTimer(Scumm *s, int msec_delay) {
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEMOTION: {
|
case SDL_MOUSEMOTION: {
|
||||||
int newx,newy;
|
int newx,newy;
|
||||||
#if !defined(SCALEUP_2x2)
|
if (scale == 3)
|
||||||
newx = event.motion.x;
|
{
|
||||||
newy = event.motion.y;
|
newx = event.motion.x/3;
|
||||||
#else
|
newy = event.motion.y/3;
|
||||||
|
} else
|
||||||
|
if (scale == 2)
|
||||||
|
{
|
||||||
newx = event.motion.x>>1;
|
newx = event.motion.x>>1;
|
||||||
newy = event.motion.y>>1;
|
newy = event.motion.y>>1;
|
||||||
#endif
|
} else
|
||||||
|
{
|
||||||
|
newx = event.motion.x;
|
||||||
|
newy = event.motion.y;
|
||||||
|
}
|
||||||
|
|
||||||
if (newx != s->mouse.x || newy != s->mouse.y) {
|
if (newx != s->mouse.x || newy != s->mouse.y) {
|
||||||
s->mouse.x = newx;
|
s->mouse.x = newx;
|
||||||
s->mouse.y = newy;
|
s->mouse.y = newy;
|
||||||
|
@ -181,17 +189,26 @@ void addDirtyRect(int x, int y, int w, int h) {
|
||||||
fullRedraw = true;
|
fullRedraw = true;
|
||||||
else if (!fullRedraw) {
|
else if (!fullRedraw) {
|
||||||
r = &dirtyRects[numDirtyRects++];
|
r = &dirtyRects[numDirtyRects++];
|
||||||
#if defined(SCALEUP_2x2)
|
if (scale == 3)
|
||||||
|
{
|
||||||
|
r->x = x*3;
|
||||||
|
r->y = y*3;
|
||||||
|
r->w = w*3;
|
||||||
|
r->h = h*3;
|
||||||
|
} else
|
||||||
|
if (scale == 2)
|
||||||
|
{
|
||||||
r->x = x*2;
|
r->x = x*2;
|
||||||
r->y = y*2;
|
r->y = y*2;
|
||||||
r->w = w*2;
|
r->w = w*2;
|
||||||
r->h = h*2;
|
r->h = h*2;
|
||||||
#else
|
} else
|
||||||
|
{
|
||||||
r->x = x;
|
r->x = x;
|
||||||
r->y = y;
|
r->y = y;
|
||||||
r->w = w;
|
r->w = w;
|
||||||
r->h = h;
|
r->h = h;
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,12 +236,23 @@ void setShakePos(Scumm *s, int shake_pos) {
|
||||||
/* Old shake pos was current_shake_pos, new is shake_pos.
|
/* Old shake pos was current_shake_pos, new is shake_pos.
|
||||||
* Move the screen up or down to account for the change.
|
* Move the screen up or down to account for the change.
|
||||||
*/
|
*/
|
||||||
#if defined(SCALEUP_2x2)
|
if (scale == 3)
|
||||||
SDL_Rect dstr = {0,shake_pos*2,640,400}, srcr = {0,old_shake_pos*2,640,400};
|
{
|
||||||
#else
|
SDL_Rect dstr = {0,shake_pos*3,960,600};
|
||||||
SDL_Rect dstr = {0,shake_pos,320,200}, srcr = {0,old_shake_pos,320,200};
|
SDL_Rect srcr = {0,old_shake_pos*3,960,600};
|
||||||
#endif
|
|
||||||
SDL_BlitSurface(screen, &srcr, screen, &dstr);
|
SDL_BlitSurface(screen, &srcr, screen, &dstr);
|
||||||
|
} else
|
||||||
|
if (scale == 2)
|
||||||
|
{
|
||||||
|
SDL_Rect dstr = {0,shake_pos*2,640,400};
|
||||||
|
SDL_Rect srcr = {0,old_shake_pos*2,640,400};
|
||||||
|
SDL_BlitSurface(screen, &srcr, screen, &dstr);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
SDL_Rect dstr = {0,shake_pos,320,200};
|
||||||
|
SDL_Rect srcr = {0,old_shake_pos,320,200};
|
||||||
|
SDL_BlitSurface(screen, &srcr, screen, &dstr);
|
||||||
|
}
|
||||||
|
|
||||||
/* Also adjust the mouse pointer backup Y coordinate.
|
/* Also adjust the mouse pointer backup Y coordinate.
|
||||||
* There is a minor mouse glitch when the mouse is moved
|
* There is a minor mouse glitch when the mouse is moved
|
||||||
|
@ -247,12 +275,21 @@ void setShakePos(Scumm *s, int shake_pos) {
|
||||||
|
|
||||||
/* Fill the dirty area with blackness or the scumm image */
|
/* Fill the dirty area with blackness or the scumm image */
|
||||||
{
|
{
|
||||||
#if defined(SCALEUP_2x2)
|
if (scale == 3)
|
||||||
SDL_Rect blackrect = {0, dirty_blacktop*2, 640, dirty_blackheight*2};
|
{
|
||||||
#else
|
SDL_Rect blackrect = {0, dirty_blacktop*3, 960, dirty_blackheight*3};
|
||||||
SDL_Rect blackrect = {0, dirty_blacktop, 320, dirty_blackheight};
|
|
||||||
#endif
|
|
||||||
SDL_FillRect(screen, &blackrect, 0);
|
SDL_FillRect(screen, &blackrect, 0);
|
||||||
|
} else
|
||||||
|
if (scale == 2)
|
||||||
|
{
|
||||||
|
SDL_Rect blackrect = {0, dirty_blacktop*2, 640, dirty_blackheight*2};
|
||||||
|
SDL_FillRect(screen, &blackrect, 0);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
SDL_Rect blackrect = {0, dirty_blacktop, 320, dirty_blackheight};
|
||||||
|
SDL_FillRect(screen, &blackrect, 0);
|
||||||
|
}
|
||||||
|
|
||||||
s->redrawLines(dirty_top, dirty_top + dirty_height);
|
s->redrawLines(dirty_top, dirty_top + dirty_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,15 +314,37 @@ void blitToScreen(Scumm *s, byte *src,int x, int y, int w, int h) {
|
||||||
if (SDL_LockSurface(screen)==-1)
|
if (SDL_LockSurface(screen)==-1)
|
||||||
error("SDL_LockSurface failed: %s.\n", SDL_GetError());
|
error("SDL_LockSurface failed: %s.\n", SDL_GetError());
|
||||||
|
|
||||||
#if !defined(SCALEUP_2x2)
|
if (scale == 3)
|
||||||
dst = (byte*)screen->pixels + y*320 + x;
|
{
|
||||||
|
dst = (byte*)screen->pixels + y*960*3 + x*3;
|
||||||
addDirtyRect(x,y,w,h);
|
addDirtyRect(x,y,w,h);
|
||||||
|
#ifdef DEBUG_CODE
|
||||||
|
byte black = GetAsyncKeyState(VK_SHIFT)<0 ? 0 : 0xFF;
|
||||||
do {
|
do {
|
||||||
memcpy(dst, src, w);
|
i=0;
|
||||||
dst += 320;
|
do {
|
||||||
|
dst[i*3] = dst[i*3+1] = dst[i*3+2] = src[i] & black;
|
||||||
|
} while (++i!=w);
|
||||||
|
memcpy(dst+960, dst, w*3);
|
||||||
|
memcpy(dst+960+960, dst, w*3);
|
||||||
|
dst += 960*3;
|
||||||
src += 320;
|
src += 320;
|
||||||
} while (--h);
|
} while (--h);
|
||||||
#else
|
#else
|
||||||
|
do {
|
||||||
|
i=0;
|
||||||
|
do {
|
||||||
|
dst[i*3] = dst[i*3+1] = dst[i*3+2] = src[i];
|
||||||
|
} while (++i!=w);
|
||||||
|
memcpy(dst+960, dst, w*3);
|
||||||
|
memcpy(dst+960+960, dst, w*3);
|
||||||
|
dst += 960*3;
|
||||||
|
src += 320;
|
||||||
|
} while (--h);
|
||||||
|
#endif
|
||||||
|
} else
|
||||||
|
if (scale == 2)
|
||||||
|
{
|
||||||
dst = (byte*)screen->pixels + y*640*2 + x*2;
|
dst = (byte*)screen->pixels + y*640*2 + x*2;
|
||||||
addDirtyRect(x,y,w,h);
|
addDirtyRect(x,y,w,h);
|
||||||
#ifdef DEBUG_CODE
|
#ifdef DEBUG_CODE
|
||||||
|
@ -310,7 +369,16 @@ void blitToScreen(Scumm *s, byte *src,int x, int y, int w, int h) {
|
||||||
src += 320;
|
src += 320;
|
||||||
} while (--h);
|
} while (--h);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
} else
|
||||||
|
{
|
||||||
|
dst = (byte*)screen->pixels + y*320 + x;
|
||||||
|
addDirtyRect(x,y,w,h);
|
||||||
|
do {
|
||||||
|
memcpy(dst, src, w);
|
||||||
|
dst += 320;
|
||||||
|
src += 320;
|
||||||
|
} while (--h);
|
||||||
|
}
|
||||||
|
|
||||||
SDL_UnlockSurface(screen);
|
SDL_UnlockSurface(screen);
|
||||||
}
|
}
|
||||||
|
@ -361,7 +429,58 @@ void drawMouse(Scumm *s, int xdraw, int ydraw, int w, int h, byte *buf, bool vis
|
||||||
if (SDL_LockSurface(screen)==-1)
|
if (SDL_LockSurface(screen)==-1)
|
||||||
error("SDL_LockSurface failed: %s.\n", SDL_GetError());
|
error("SDL_LockSurface failed: %s.\n", SDL_GetError());
|
||||||
|
|
||||||
#if defined(SCALEUP_2x2)
|
if (scale == 3)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (has_mouse) {
|
||||||
|
dst = (byte*)screen->pixels + old_mouse_y*960*3 + old_mouse_x*3;
|
||||||
|
bak = old_backup;
|
||||||
|
|
||||||
|
for (y=0; y<old_mouse_h; y++,bak+=BAK_WIDTH*3,dst+=960*3) {
|
||||||
|
if ( (uint)(old_mouse_y + y) < 200) {
|
||||||
|
for (x=0; x<old_mouse_w; x++) {
|
||||||
|
if ((uint)(old_mouse_x + x) < 320) {
|
||||||
|
dst[x*3+960] = dst[x*3+960+960] = dst[x*3] = bak[x*3];
|
||||||
|
dst[x*3+960+1] = dst[x*3+960+960+1] = dst[x*3+1] = bak[x*3+1];
|
||||||
|
dst[x*3+960+2] = dst[x*3+960+960+2] = dst[x*3+2] = bak[x*3+2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (visible) {
|
||||||
|
ydraw += current_shake_pos;
|
||||||
|
|
||||||
|
dst = (byte*)screen->pixels + ydraw*960*3 + xdraw*3;
|
||||||
|
bak = old_backup;
|
||||||
|
|
||||||
|
for (y=0; y<h; y++,dst+=960*3,bak+=BAK_WIDTH*3,buf+=w) {
|
||||||
|
if ((uint)(ydraw+y)<200) {
|
||||||
|
for (x=0; x<w; x++) {
|
||||||
|
if ((uint)(xdraw+x)<320) {
|
||||||
|
bak[x*3] = dst[x*3];
|
||||||
|
bak[x*3+1] = dst[x*3+1];
|
||||||
|
bak[x*3+2] = dst[x*3+2];
|
||||||
|
if ((color=buf[x])!=0xFF) {
|
||||||
|
dst[x*3] = color;
|
||||||
|
dst[x*3+1] = color;
|
||||||
|
dst[x*3+2] = color;
|
||||||
|
dst[x*3+960] = color;
|
||||||
|
dst[x*3+1+960] = color;
|
||||||
|
dst[x*3+2+960] = color;
|
||||||
|
dst[x*3+960+960] = color;
|
||||||
|
dst[x*3+1+960+960] = color;
|
||||||
|
dst[x*3+2+960+960] = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (scale == 2)
|
||||||
|
{
|
||||||
|
|
||||||
if (has_mouse) {
|
if (has_mouse) {
|
||||||
dst = (byte*)screen->pixels + old_mouse_y*640*2 + old_mouse_x*2;
|
dst = (byte*)screen->pixels + old_mouse_y*640*2 + old_mouse_x*2;
|
||||||
|
@ -402,7 +521,8 @@ void drawMouse(Scumm *s, int xdraw, int ydraw, int w, int h, byte *buf, bool vis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
} else
|
||||||
|
{
|
||||||
if (has_mouse) {
|
if (has_mouse) {
|
||||||
dst = (byte*)screen->pixels + old_mouse_y*320 + old_mouse_x;
|
dst = (byte*)screen->pixels + old_mouse_y*320 + old_mouse_x;
|
||||||
bak = old_backup;
|
bak = old_backup;
|
||||||
|
@ -436,9 +556,7 @@ void drawMouse(Scumm *s, int xdraw, int ydraw, int w, int h, byte *buf, bool vis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SDL_UnlockSurface(screen);
|
SDL_UnlockSurface(screen);
|
||||||
|
|
||||||
|
@ -487,9 +605,11 @@ int music_thread(Scumm *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void initGraphics(Scumm *s, bool fullScreen) {
|
void initGraphics(Scumm *s, bool fullScreen, unsigned int scaleFactor) {
|
||||||
SDL_AudioSpec desired;
|
SDL_AudioSpec desired;
|
||||||
|
|
||||||
|
scale = scaleFactor;
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)==-1) {
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)==-1) {
|
||||||
error("Could not initialize SDL: %s.\n", SDL_GetError());
|
error("Could not initialize SDL: %s.\n", SDL_GetError());
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -525,11 +645,31 @@ void initGraphics(Scumm *s, bool fullScreen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !defined(SCALEUP_2x2)
|
if (scale == 3)
|
||||||
screen = SDL_SetVideoMode(320, 200, 8, fullScreen ? (SDL_SWSURFACE | SDL_FULLSCREEN) : SDL_SWSURFACE);
|
{
|
||||||
#else
|
screen = SDL_SetVideoMode(960, 600, 8, fullScreen ? (SDL_SWSURFACE | SDL_FULLSCREEN) : (SDL_SWSURFACE | SDL_DOUBLEBUF));
|
||||||
screen = SDL_SetVideoMode(640, 400, 8, fullScreen ? (SDL_SWSURFACE | SDL_FULLSCREEN) : SDL_SWSURFACE);
|
} else
|
||||||
#endif
|
if (scale == 2)
|
||||||
|
{
|
||||||
|
screen = SDL_SetVideoMode(640, 400, 8, fullScreen ? (SDL_SWSURFACE | SDL_FULLSCREEN) : (SDL_SWSURFACE | SDL_DOUBLEBUF));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
screen = SDL_SetVideoMode(320, 200, 8, fullScreen ? (SDL_SWSURFACE | SDL_FULLSCREEN) : (SDL_SWSURFACE | SDL_DOUBLEBUF));
|
||||||
|
}
|
||||||
|
|
||||||
|
// SDL_SWSURFACE 0x00000000 /* Surface is in system memory */
|
||||||
|
// SDL_HWSURFACE 0x00000001 /* Surface is in video memory */
|
||||||
|
// SDL_ASYNCBLIT 0x00000004 /* Use asynchronous blits if possible */
|
||||||
|
// SDL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */
|
||||||
|
// SDL_HWPALETTE 0x20000000 /* Surface has exclusive palette */
|
||||||
|
// SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */
|
||||||
|
// SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */
|
||||||
|
// SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */
|
||||||
|
// SDL_OPENGLBLIT 0x0000000A /* Create an OpenGL rendering context and use it for blitting */
|
||||||
|
// SDL_RESIZABLE 0x00000010 /* This video mode may be resized */
|
||||||
|
// SDL_NOFRAME 0x00000020 /* No window caption or edge frame */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
printf("%d %d, %d %d, %d %d %d, %d %d %d %d %d\n",
|
printf("%d %d, %d %d, %d %d %d, %d %d %d %d %d\n",
|
||||||
sizeof(int8), sizeof(uint8),
|
sizeof(int8), sizeof(uint8),
|
||||||
|
|
25
stdafx.h
25
stdafx.h
|
@ -2,6 +2,9 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.9 2002/03/06 12:24:56 ender
|
||||||
|
* Applied cleanup and scaling patch by Rob.
|
||||||
|
*
|
||||||
* Revision 1.8 2001/11/20 07:13:01 vasyl
|
* Revision 1.8 2001/11/20 07:13:01 vasyl
|
||||||
* Added ability for ports to override all includes in stdafx.h. To use this feature
|
* Added ability for ports to override all includes in stdafx.h. To use this feature
|
||||||
* port must define symbol NONSTANDARD_PORT. Port must also provide
|
* port must define symbol NONSTANDARD_PORT. Port must also provide
|
||||||
|
@ -85,3 +88,25 @@
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Semi-Platform-specific version info */
|
||||||
|
#ifdef ALLOW_GDI
|
||||||
|
/* Assume Win32 GDI is used, then... */
|
||||||
|
#define SCUMMVM_PLATFORM_VERSION "Win32 GDI version"
|
||||||
|
|
||||||
|
#else
|
||||||
|
#ifdef ALLOW_X11
|
||||||
|
/* Assume pure X11 is used, then... */
|
||||||
|
#define SCUMMVM_PLATFORM_VERSION "X11 version"
|
||||||
|
|
||||||
|
#else
|
||||||
|
#ifdef SDL_COMPILEDVERSION
|
||||||
|
#define SCUMMVM_PLATFORM_VERSION "SDL version"
|
||||||
|
//SDL_COMPILEDVERSION is a number... :(
|
||||||
|
//SDL_Linked_Version returns an SDL_Version structure...
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -349,9 +349,11 @@ newLine:;
|
||||||
charset.printCharOld(c);
|
charset.printCharOld(c);
|
||||||
else if (!(_features&GF_AFTER_V6)) {
|
else if (!(_features&GF_AFTER_V6)) {
|
||||||
// if (!_vars[VAR_V5_CHARFLAG]) { /* FIXME */
|
// if (!_vars[VAR_V5_CHARFLAG]) { /* FIXME */
|
||||||
|
if (!(a && _noSubtitles))
|
||||||
charset.printChar(c);
|
charset.printChar(c);
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
|
if (!(a && _noSubtitles))
|
||||||
charset.printChar(c);
|
charset.printChar(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#define BITS_PER_SAMPLE 16
|
#define BITS_PER_SAMPLE 16
|
||||||
|
|
||||||
static bool shutdown;
|
static bool shutdown;
|
||||||
|
static unsigned int scale;
|
||||||
|
|
||||||
#if USE_GDI
|
#if USE_GDI
|
||||||
typedef struct DIB {
|
typedef struct DIB {
|
||||||
|
@ -446,9 +446,10 @@ void waitForTimer(Scumm *s, int delay) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void initGraphics(Scumm *s, bool fullScreen) {
|
void initGraphics(Scumm *s, bool fullScreen, unsigned int scaleFactor) {
|
||||||
if(fullScreen)
|
if(fullScreen)
|
||||||
warning("Use SDL for fullscreen support");
|
warning("Use SDL for fullscreen support");
|
||||||
|
scale = scaleFactor; // not supported yet! ignored.
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawMouse(Scumm *s, int, int, int, byte*, bool) {
|
void drawMouse(Scumm *s, int, int, int, byte*, bool) {
|
||||||
|
|
6
x11.cpp
6
x11.cpp
|
@ -68,6 +68,8 @@ static int old_mouse_x, old_mouse_y;
|
||||||
static int old_mouse_h, old_mouse_w;
|
static int old_mouse_h, old_mouse_w;
|
||||||
static bool has_mouse, hide_mouse;
|
static bool has_mouse, hide_mouse;
|
||||||
|
|
||||||
|
static unsigned int scale;
|
||||||
|
|
||||||
#define MAX_NUMBER_OF_DIRTY_SQUARES 32
|
#define MAX_NUMBER_OF_DIRTY_SQUARES 32
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
|
@ -188,7 +190,7 @@ void BoxTest(int num) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the graphics sub-system */
|
/* Initialize the graphics sub-system */
|
||||||
void initGraphics(Scumm *s, bool fullScreen) {
|
void initGraphics(Scumm *s, bool fullScreen, unsigned int scaleFactor) {
|
||||||
char buf[512], *gameName;
|
char buf[512], *gameName;
|
||||||
static XShmSegmentInfo shminfo;
|
static XShmSegmentInfo shminfo;
|
||||||
XWMHints *wm_hints;
|
XWMHints *wm_hints;
|
||||||
|
@ -196,6 +198,8 @@ void initGraphics(Scumm *s, bool fullScreen) {
|
||||||
XTextProperty window_name;
|
XTextProperty window_name;
|
||||||
char *name = (char *) &buf;
|
char *name = (char *) &buf;
|
||||||
|
|
||||||
|
scale = scaleFactor; // not implemented yet! ignored.
|
||||||
|
|
||||||
/* For the window title */
|
/* For the window title */
|
||||||
sprintf(buf, "ScummVM - %s", gameName = s->getGameName());
|
sprintf(buf, "ScummVM - %s", gameName = s->getGameName());
|
||||||
free(gameName);
|
free(gameName);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue