aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2007-04-15 00:55:16 +0000
committerTravis Howell2007-04-15 00:55:16 +0000
commit1c00843f2be1ccfd74182d0268d43fdf8dfcec6f (patch)
treebb2f9181f066d94a2b6566a661d730e5495e5628 /engines
parentaa0f36358bdba01f4714e69ad972e728b3309bc4 (diff)
downloadscummvm-rg350-1c00843f2be1ccfd74182d0268d43fdf8dfcec6f.tar.gz
scummvm-rg350-1c00843f2be1ccfd74182d0268d43fdf8dfcec6f.tar.bz2
scummvm-rg350-1c00843f2be1ccfd74182d0268d43fdf8dfcec6f.zip
Cleanup.
svn-id: r26480
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.h2
-rw-r--r--engines/agos/debug.cpp2
-rw-r--r--engines/agos/draw.cpp26
-rw-r--r--engines/agos/gfx.cpp28
-rw-r--r--engines/agos/res_ami.cpp2
-rw-r--r--engines/agos/script_e1.cpp2
-rw-r--r--engines/agos/script_s1.cpp2
-rw-r--r--engines/agos/script_s2.cpp2
-rw-r--r--engines/agos/vga.cpp122
-rw-r--r--engines/agos/vga.h2
-rw-r--r--engines/agos/vga_ww.cpp8
11 files changed, 89 insertions, 109 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 8016add841..f8c602de1a 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -1273,7 +1273,7 @@ public:
protected:
bool drawImage_clip(VC10_state *state);
- void drawImage_init(VC10_state *state);
+ void drawImage_init(uint16 image, uint16 palette, uint16 x, uint16 y, uint16 flags);
void drawImage(VC10_state *state);
void drawImage_Amiga(VC10_state *state);
diff --git a/engines/agos/debug.cpp b/engines/agos/debug.cpp
index 34529ccbd8..507f0ae9e6 100644
--- a/engines/agos/debug.cpp
+++ b/engines/agos/debug.cpp
@@ -435,7 +435,7 @@ void AGOSEngine::dumpBitmap(const char *filename, const byte *offs, int w, int h
VC10_state state;
state.depack_cont = -0x80;
- state.depack_src = offs;
+ state.srcPtr = offs;
state.dh = h;
state.y_skip = 0;
diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp
index 578ea74dcc..c48db940ee 100644
--- a/engines/agos/draw.cpp
+++ b/engines/agos/draw.cpp
@@ -27,7 +27,6 @@
#include "agos/agos.h"
#include "agos/intern.h"
-#include "agos/vga.h"
namespace AGOS {
@@ -54,7 +53,6 @@ byte *AGOSEngine::getScaleBuf() {
void AGOSEngine::animateSprites() {
VgaSprite *vsp;
VgaPointersEntry *vpe;
- VC10_state state;
if (_paletteFlag == 2)
_paletteFlag = 1;
@@ -84,13 +82,7 @@ void AGOSEngine::animateSprites() {
_vgaCurSpriteId = vsp->id;
_vgaCurSpritePriority = vsp->priority;
- state.image = vsp->image;
- state.palette = (vsp->palette & 15) * 16;
- state.x = vsp->x;
- state.y = vsp->y;
- state.flags = vsp->flags;
-
- drawImage_init(&state);
+ drawImage_init(vsp->image, vsp->palette, vsp->x, vsp->y, vsp->flags);
vsp++;
}
@@ -124,13 +116,7 @@ void AGOSEngine::animateSpritesDebug() {
printf("id:%5d image:%3d base-color:%3d x:%3d y:%3d flags:%x\n",
vsp->id, vsp->image, vsp->palette, vsp->x, vsp->y, vsp->flags);
- state.image = vsp->image;
- state.palette = (vsp->palette & 15) * 16;
- state.x = vsp->x;
- state.y = vsp->y;
- state.flags = vsp->flags;
-
- drawImage_init(&state);
+ drawImage_init(vsp->image, vsp->palette, vsp->x, vsp->y, vsp->flags);
vsp++;
}
@@ -200,13 +186,7 @@ void AGOSEngine::animateSpritesByY() {
_vgaCurSpriteId = vsp->id;
_vgaCurSpritePriority = vsp->priority;
- state.image = vsp->image;
- state.palette = 0;
- state.x = vsp->x;
- state.y = vsp->y;
- state.flags = vsp->flags;
-
- drawImage_init(&state);
+ drawImage_init(vsp->image, vsp->palette, vsp->x, vsp->y, vsp->flags);
}
_updateScreen = true;
diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp
index 887b42acf0..a370e42046 100644
--- a/engines/agos/gfx.cpp
+++ b/engines/agos/gfx.cpp
@@ -31,7 +31,7 @@ namespace AGOS {
byte *vc10_depackColumn(VC10_state * vs) {
int8 a = vs->depack_cont;
- const byte *src = vs->depack_src;
+ const byte *src = vs->srcPtr;
byte *dst = vs->depack_dest;
uint16 dh = vs->dh;
byte color;
@@ -66,7 +66,7 @@ byte *vc10_depackColumn(VC10_state * vs) {
}
get_out:;
- vs->depack_src = src;
+ vs->srcPtr = src;
vs->depack_cont = a;
return vs->depack_dest + vs->y_skip;
}
@@ -368,7 +368,7 @@ void AGOSEngine::drawImage_Feeble(VC10_state *state) {
byte *dst;
uint count;
- src = state->depack_src + state->width * state->y_skip;
+ src = state->srcPtr + state->width * state->y_skip;
dst = state->surf_addr;
do {
for (count = 0; count != state->draw_width; count++) {
@@ -455,7 +455,7 @@ void AGOSEngine::drawImage_Simon(VC10_state *state) {
if (state->flags & kDFCompressed) {
byte *dstPtr = state->surf_addr;
- src = state->depack_src;
+ src = state->srcPtr;
/* AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD EEEEEEEE
* aaaaabbb bbcccccd ddddeeee efffffgg ggghhhhh
*/
@@ -502,7 +502,7 @@ void AGOSEngine::drawImage_Simon(VC10_state *state) {
dstPtr += _screenWidth;
} while (--state->draw_height);
} else {
- src = state->depack_src + (state->width * state->y_skip * 16) + (state->x_skip * 8);
+ src = state->srcPtr + (state->width * state->y_skip * 16) + (state->x_skip * 8);
dst = state->surf_addr;
state->draw_width *= 2;
@@ -562,7 +562,7 @@ void AGOSEngine::drawImage_Simon(VC10_state *state) {
byte *dst;
uint count;
- src = state->depack_src + (state->width * state->y_skip) * 8;
+ src = state->srcPtr + (state->width * state->y_skip) * 8;
dst = state->surf_addr;
state->x_skip *= 4;
@@ -598,7 +598,7 @@ void AGOSEngine::drawImage_Amiga(VC10_state *state) {
state->surf_addr += xoffs + yoffs * state->surf2_pitch;
if (state->flags & kDFMasked) {
- const byte *mask = state->depack_src + (state->width * state->y_skip * 16) + (state->x_skip * 8);
+ const byte *mask = state->srcPtr + (state->width * state->y_skip * 16) + (state->x_skip * 8);
src = state->surf2_addr;
dst = state->surf_addr;
@@ -622,7 +622,7 @@ void AGOSEngine::drawImage_Amiga(VC10_state *state) {
mask += state->width * 16;
} while (--h);
} else {
- src = state->depack_src + (state->width * state->y_skip * 16) + (state->x_skip * 8);
+ src = state->srcPtr + (state->width * state->y_skip * 16) + (state->x_skip * 8);
dst = state->surf_addr;
state->draw_width *= 2;
@@ -722,7 +722,7 @@ void AGOSEngine::drawImage(VC10_state *state) {
byte *dst;
uint count;
- src = state->depack_src + (state->width * state->y_skip) * 8;
+ src = state->srcPtr + (state->width * state->y_skip) * 8;
dst = state->surf_addr;
state->x_skip *= 4;
@@ -753,7 +753,7 @@ void AGOSEngine::horizontalScroll(VC10_state *state) {
else
_scrollXMax = state->width * 2 - 40;
_scrollYMax = 0;
- _scrollImage = state->depack_src;
+ _scrollImage = state->srcPtr;
_scrollHeight = state->height;
if (_variableArrayPtr[34] < 0)
state->x = _variableArrayPtr[251];
@@ -765,9 +765,9 @@ void AGOSEngine::horizontalScroll(VC10_state *state) {
dst = getBackBuf();
if (getGameType() == GType_FF)
- src = state->depack_src + _scrollX / 2;
+ src = state->srcPtr + _scrollX / 2;
else
- src = state->depack_src + _scrollX * 4;
+ src = state->srcPtr + _scrollX * 4;
for (w = 0; w < _screenWidth; w += 8) {
decodeColumn(dst, src + readUint32Wrapper(src), state->height);
@@ -783,7 +783,7 @@ void AGOSEngine::verticalScroll(VC10_state *state) {
_scrollXMax = 0;
_scrollYMax = state->height - 480;
- _scrollImage = state->depack_src;
+ _scrollImage = state->srcPtr;
_scrollWidth = state->width;
if (_variableArrayPtr[34] < 0)
state->y = _variableArrayPtr[250];
@@ -793,7 +793,7 @@ void AGOSEngine::verticalScroll(VC10_state *state) {
vcWriteVar(250, _scrollY);
dst = getBackBuf();
- src = state->depack_src + _scrollY / 2;
+ src = state->srcPtr + _scrollY / 2;
for (h = 0; h < _screenHeight; h += 8) {
decodeRow(dst, src + READ_LE_UINT32(src), state->width);
diff --git a/engines/agos/res_ami.cpp b/engines/agos/res_ami.cpp
index 6e4675f063..068c2ac149 100644
--- a/engines/agos/res_ami.cpp
+++ b/engines/agos/res_ami.cpp
@@ -141,7 +141,7 @@ byte *AGOSEngine::convertImage(VC10_state *state, bool compressed) {
}
}
- const byte *src = state->depack_src;
+ const byte *src = state->srcPtr;
int width = state->width * 16;
int height = state->height;
diff --git a/engines/agos/script_e1.cpp b/engines/agos/script_e1.cpp
index 90eed10ae2..a8006b4627 100644
--- a/engines/agos/script_e1.cpp
+++ b/engines/agos/script_e1.cpp
@@ -970,7 +970,7 @@ void AGOSEngine::printScroll() {
VC10_state state;
VgaPointersEntry *vpe = &_vgaBufferPointers[1];
- state.depack_src = vpe->vgaFile2 + READ_BE_UINT32(vpe->vgaFile2 + 9 * 8);
+ state.srcPtr = vpe->vgaFile2 + READ_BE_UINT32(vpe->vgaFile2 + 9 * 8);
state.palette = 0;
state.x = 10;
diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp
index 12184fdfb4..eeb17515f6 100644
--- a/engines/agos/script_s1.cpp
+++ b/engines/agos/script_s1.cpp
@@ -81,7 +81,7 @@ void AGOSEngine::os1_animate() {
uint windowNum = getVarOrByte();
uint x = getVarOrWord();
uint y = getVarOrWord();
- uint palette = getVarOrWord();
+ uint palette = (getVarOrWord() & 15);
if (getFeatures() & GF_TALKIE && vgaSpriteId >= 400) {
_lastVgaWaitFor = 0;
diff --git a/engines/agos/script_s2.cpp b/engines/agos/script_s2.cpp
index ddcc1132eb..27ab3d2af2 100644
--- a/engines/agos/script_s2.cpp
+++ b/engines/agos/script_s2.cpp
@@ -95,7 +95,7 @@ void AGOSEngine::os2_animate() {
uint windowNum = getVarOrByte();
uint x = getVarOrWord();
uint y = getVarOrWord();
- uint palette = getVarOrWord();
+ uint palette = (getVarOrWord() & 15);
_lockWord |= 0x40;
animate(windowNum, zoneNum, vgaSpriteId, x, y, palette);
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index a16b91606a..96b9551fa6 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -578,128 +578,134 @@ byte *AGOSEngine::vc10_flip(const byte *src, uint w, uint h) {
}
void AGOSEngine::vc10_draw() {
- VC10_state state;
+ uint16 image, palette, x, y, flags;
- state.image = (int16)vcReadNextWord();
+ image = (int16)vcReadNextWord();
- state.palette = 0;
+ palette = 0;
if (getGameType() == GType_FF || getGameType() == GType_PP) {
+ palette = _vcPtr[0];
_vcPtr += 2;
} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
- state.palette = (_vcPtr[1] * 16);
+ palette = _vcPtr[1];
_vcPtr += 2;
}
- state.x = (int16)vcReadNextWord();
- state.y = (int16)vcReadNextWord();
+ x = (int16)vcReadNextWord();
+ y = (int16)vcReadNextWord();
if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP) {
- state.flags = vcReadNextByte();
+ flags = vcReadNextByte();
} else {
- state.flags = vcReadNextWord();
+ flags = vcReadNextWord();
}
- drawImage_init(&state);
+ drawImage_init(image, palette, x, y, flags);
}
-void AGOSEngine::drawImage_init(VC10_state *state) {
- if (state->image == 0)
+void AGOSEngine::drawImage_init(uint16 image, uint16 palette, uint16 x, uint16 y, uint16 flags) {
+ if (image == 0)
return;
- byte *p2;
+ byte *src;
uint width, height;
- byte flags;
+ VC10_state state;
+
+ state.image = image;
+ if (state.image < 0)
+ state.image = vcReadVar(-state.image);
+
+ state.palette = palette * 16;
- state->x -= _scrollX;
- state->y -= _scrollY;
+ state.x = x - _scrollX;
+ state.y = y - _scrollY;
- if (state->image < 0)
- state->image = vcReadVar(-state->image);
+ state.flags = flags;
- p2 = _curVgaFile2 + state->image * 8;
- state->depack_src = _curVgaFile2 + readUint32Wrapper(p2);
+ src = _curVgaFile2 + state.image * 8;
+ state.srcPtr = _curVgaFile2 + readUint32Wrapper(src);
if (getGameType() == GType_FF || getGameType() == GType_PP) {
- width = READ_LE_UINT16(p2 + 6);
- height = READ_LE_UINT16(p2 + 4) & 0x7FFF;
- flags = p2[5];
+ width = READ_LE_UINT16(src + 6);
+ height = READ_LE_UINT16(src + 4) & 0x7FFF;
+ flags = src[5];
} else {
- width = READ_BE_UINT16(p2 + 6) / 16;
- height = p2[5];
- flags = p2[4];
+ width = READ_BE_UINT16(src + 6) / 16;
+ height = src[5];
+ flags = src[4];
}
if (height == 0 || width == 0)
return;
if (_dumpImages)
- dumpSingleBitmap(_vgaCurZoneNum, state->image, state->depack_src, width, height,
- state->palette);
- state->width = state->draw_width = width; /* cl */
- state->height = state->draw_height = height; /* ch */
+ dumpSingleBitmap(_vgaCurZoneNum, state.image, state.srcPtr, width, height,
+ state.palette);
+ state.width = state.draw_width = width; /* cl */
+ state.height = state.draw_height = height; /* ch */
- state->depack_cont = -0x80;
+ state.depack_cont = -0x80;
- state->x_skip = 0; /* colums to skip = bh */
- state->y_skip = 0; /* rows to skip = bl */
+ state.x_skip = 0; /* colums to skip = bh */
+ state.y_skip = 0; /* rows to skip = bl */
if (getFeatures() & GF_PLANAR) {
- state->depack_src = convertImage(state, ((flags & 0x80) != 0));
+ state.srcPtr = convertImage(&state, ((flags & 0x80) != 0));
// converted planar clip is already uncompressed
- if (state->flags & kDFCompressedFlip) {
- state->flags &= ~kDFCompressedFlip;
- state->flags |= kDFFlip;
+ if (state.flags & kDFCompressedFlip) {
+ state.flags &= ~kDFCompressedFlip;
+ state.flags |= kDFFlip;
}
- if (state->flags & kDFCompressed) {
- state->flags &= ~kDFCompressed;
+ if (state.flags & kDFCompressed) {
+ state.flags &= ~kDFCompressed;
}
} else if (getGameType() == GType_FF || getGameType() == GType_PP) {
if (flags & 0x80) {
- state->flags |= kDFCompressed;
+ state.flags |= kDFCompressed;
}
} else {
- if (flags & 0x80 && !(state->flags & kDFCompressedFlip)) {
- if (state->flags & kDFFlip) {
- state->flags &= ~kDFFlip;
- state->flags |= kDFCompressedFlip;
+ if (flags & 0x80 && !(state.flags & kDFCompressedFlip)) {
+ if (state.flags & kDFFlip) {
+ state.flags &= ~kDFFlip;
+ state.flags |= kDFCompressedFlip;
} else {
- state->flags |= kDFCompressed;
+ state.flags |= kDFCompressed;
}
}
}
uint maxWidth = (getGameType() == GType_FF || getGameType() == GType_PP) ? 640 : 20;
if ((getGameType() == GType_SIMON2 || getGameType() == GType_FF) && width > maxWidth) {
- horizontalScroll(state);
+ horizontalScroll(&state);
return;
}
if (getGameType() == GType_FF && height > 480) {
- verticalScroll(state);
+ verticalScroll(&state);
return;
}
if (getGameType() != GType_FF && getGameType() != GType_PP) {
- if (state->flags & kDFCompressedFlip) {
- state->depack_src = vc10_uncompressFlip(state->depack_src, width, height);
- } else if (state->flags & kDFFlip) {
- state->depack_src = vc10_flip(state->depack_src, width, height);
+ if (state.flags & kDFCompressedFlip) {
+ state.srcPtr = vc10_uncompressFlip(state.srcPtr, width, height);
+ } else if (state.flags & kDFFlip) {
+ state.srcPtr = vc10_flip(state.srcPtr, width, height);
}
}
- state->surf2_addr = getFrontBuf();
- state->surf2_pitch = _dxSurfacePitch;
+ state.surf2_addr = getFrontBuf();
+ state.surf2_pitch = _dxSurfacePitch;
- state->surf_addr = getBackBuf();
- state->surf_pitch = _dxSurfacePitch;
+ state.surf_addr = getBackBuf();
+ state.surf_pitch = _dxSurfacePitch;
if (getGameType() == GType_FF || getGameType() == GType_PP) {
- drawImage_Feeble(state);
+ drawImage_Feeble(&state);
} else if (getFeatures() & GF_32COLOR) {
- drawImage_Amiga(state);
+ drawImage_Amiga(&state);
} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
- drawImage_Simon(state);
+ drawImage_Simon(&state);
} else {
- drawImage(state);
+ drawImage(&state);
}
}
diff --git a/engines/agos/vga.h b/engines/agos/vga.h
index ab20de4543..c2ba140b35 100644
--- a/engines/agos/vga.h
+++ b/engines/agos/vga.h
@@ -130,7 +130,7 @@ struct VC10_state {
uint16 dl, dh;
- const byte *depack_src;
+ const byte *srcPtr;
int8 depack_cont;
byte depack_dest[480];
diff --git a/engines/agos/vga_ww.cpp b/engines/agos/vga_ww.cpp
index 6fbea94f4c..5209b91b46 100644
--- a/engines/agos/vga_ww.cpp
+++ b/engines/agos/vga_ww.cpp
@@ -207,13 +207,7 @@ void AGOSEngine::vc62_fastFadeOut() {
_curVgaFile2 = vpe->vgaFile2;
_windowNum = vsp->windowNum;
- state.image = vsp->image;
- state.palette = (vsp->palette & 15) * 16;
- state.x = vsp->x;
- state.y = vsp->y;
- state.flags = vsp->flags;
-
- drawImage_init(&state);
+ drawImage_init(vsp->image, vsp->palette, vsp->x, vsp->y, vsp->flags);
_windowNum = palmode;
_curVgaFile1 = old_file_1;