svn-id: r26759
This commit is contained in:
Travis Howell 2007-05-06 09:46:43 +00:00
parent 0da4791128
commit 6ddc79a9a8
3 changed files with 73 additions and 105 deletions

View File

@ -1039,10 +1039,7 @@ protected:
void drawImage_init(int16 image, uint16 palette, uint16 x, uint16 y, uint16 flags);
void drawImage(VC10_state *state);
void drawImage_Amiga(VC10_state *state);
void drawImage_Simon(VC10_state *state);
void drawImage_Feeble(VC10_state *state);
virtual void drawImage(VC10_state *state);
void scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY);
void horizontalScroll(VC10_state *state);
@ -1407,6 +1404,8 @@ protected:
};
const OpcodeEntrySimon1 *_opcodesSimon1;
virtual void drawImage(VC10_state *state);
};
class AGOSEngine_Simon2 : public AGOSEngine_Simon1 {
@ -1494,6 +1493,8 @@ protected:
const OpcodeEntryFeeble *_opcodesFeeble;
virtual void drawImage(VC10_state *state);
void drawMousePart(int image, byte x, byte y);
virtual void drawMousePointer();

View File

@ -224,7 +224,7 @@ bool AGOSEngine::drawImage_clip(VC10_state *state) {
return 1;
}
void AGOSEngine::drawImage_Feeble(VC10_state *state) {
void AGOSEngine_Feeble::drawImage(VC10_state *state) {
if (state->flags & kDFCompressed) {
if (state->flags & kDFScaled) {
state->surf_addr = getScaleBuf();
@ -387,12 +387,15 @@ void AGOSEngine::drawImage_Feeble(VC10_state *state) {
}
}
void AGOSEngine::drawImage_Simon(VC10_state *state) {
void AGOSEngine_Simon1::drawImage(VC10_state *state) {
const uint16 *vlut = &_videoWindows[_windowNum * 4];
if (drawImage_clip(state) == 0)
return;
if (getFeatures() & GF_32COLOR)
state->palette = 0xC0;
uint xoffs, yoffs;
if (getGameType() == GType_SIMON1 && (_subroutine == 2923 || _subroutine == 2926)) {
// Allow one section of Simon the Sorcerer 1 introduction to be displayed
@ -408,46 +411,73 @@ void AGOSEngine::drawImage_Simon(VC10_state *state) {
state->surf_addr += xoffs + yoffs * state->surf2_pitch;
if (state->flags & kDFMasked) {
byte *mask, *src, *dst;
byte h;
uint w;
if (getFeatures() & GF_32COLOR) {
const byte *mask = state->srcPtr + (state->width * state->y_skip * 16) + (state->x_skip * 8);
byte *src = state->surf2_addr;
byte *dst = state->surf_addr;
state->x_skip *= 4;
state->dl = state->width;
state->dh = state->height;
state->draw_width *= 2;
vc10_skip_cols(state);
w = 0;
do {
mask = vc10_depackColumn(state); /* esi */
src = state->surf2_addr + w * 2; /* ebx */
dst = state->surf_addr + w * 2; /* edi */
h = state->draw_height;
uint h = state->draw_height;
do {
if ((getGameType() == GType_SIMON1) && getBitFlag(88)) {
/* transparency */
if (mask[0] & 0xF0) {
if ((dst[0] & 0x0F0) == 0x20)
dst[0] = src[0];
}
if (mask[0] & 0x0F) {
if ((dst[1] & 0x0F0) == 0x20)
dst[1] = src[1];
}
} else {
/* no transparency */
if (mask[0] & 0xF0)
dst[0] = src[0];
if (mask[0] & 0x0F)
dst[1] = src[1];
for (uint i = 0; i != state->draw_width; i++) {
if ((getGameType() == GType_SIMON1) && getBitFlag(88)) {
/* transparency */
if (mask[i] & 1 && (dst[i] & 1) == 0x20)
dst[i] = src[i];
} else {
/* no transparency */
if (mask[i] & 1)
dst[i] = src[i];
}
}
mask++;
dst += state->surf_pitch;
src += state->surf2_pitch;
mask += state->width * 16;
} while (--h);
} while (++w != state->draw_width);
} else {
byte *mask, *src, *dst;
byte h;
uint w;
state->x_skip *= 4;
state->dl = state->width;
state->dh = state->height;
vc10_skip_cols(state);
w = 0;
do {
mask = vc10_depackColumn(state); /* esi */
src = state->surf2_addr + w * 2; /* ebx */
dst = state->surf_addr + w * 2; /* edi */
h = state->draw_height;
do {
if ((getGameType() == GType_SIMON1) && getBitFlag(88)) {
/* transparency */
if (mask[0] & 0xF0) {
if ((dst[0] & 0x0F0) == 0x20)
dst[0] = src[0];
}
if (mask[0] & 0x0F) {
if ((dst[1] & 0x0F0) == 0x20)
dst[1] = src[1];
}
} else {
/* no transparency */
if (mask[0] & 0xF0)
dst[0] = src[0];
if (mask[0] & 0x0F)
dst[1] = src[1];
}
mask++;
dst += state->surf_pitch;
src += state->surf2_pitch;
} while (--h);
} while (++w != state->draw_width);
}
} else if ((((_lockWord & 0x20) && state->palette == 0) || state->palette == 0xC0)) {
const byte *src;
byte *dst;
@ -583,61 +613,6 @@ void AGOSEngine::drawImage_Simon(VC10_state *state) {
}
}
void AGOSEngine::drawImage_Amiga(VC10_state *state) {
uint8 *dst;
const byte *src;
const uint16 *vlut = &_videoWindows[_windowNum * 4];
if (drawImage_clip(state) == 0)
return;
uint xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
uint yoffs = (vlut[1] - _videoWindows[17] + state->y);
state->surf2_addr += xoffs + yoffs * state->surf_pitch;
state->surf_addr += xoffs + yoffs * state->surf2_pitch;
if (state->flags & kDFMasked) {
const byte *mask = state->srcPtr + (state->width * state->y_skip * 16) + (state->x_skip * 8);
src = state->surf2_addr;
dst = state->surf_addr;
state->draw_width *= 2;
uint h = state->draw_height;
do {
for (uint i = 0; i != state->draw_width; i++) {
if ((getGameType() == GType_SIMON1) && getBitFlag(88)) {
/* transparency */
if (mask[i] & 1 && (dst[i] & 1) == 0x20)
dst[i] = src[i];
} else {
/* no transparency */
if (mask[i] & 1)
dst[i] = src[i];
}
}
dst += state->surf_pitch;
src += state->surf2_pitch;
mask += state->width * 16;
} while (--h);
} else {
src = state->srcPtr + (state->width * state->y_skip * 16) + (state->x_skip * 8);
dst = state->surf_addr;
state->draw_width *= 2;
uint h = state->draw_height;
do {
for (uint i = 0; i != state->draw_width; i++)
if ((state->flags & kDFNonTrans) || src[i])
dst[i] = src[i];
dst += _screenWidth;
src += state->width * 16;
} while (--h);
}
}
void AGOSEngine::drawImage(VC10_state *state) {
const uint16 *vlut = &_videoWindows[_windowNum * 4];

View File

@ -689,15 +689,7 @@ void AGOSEngine::drawImage_init(int16 image, uint16 palette, uint16 x, uint16 y,
state.surf_addr = getBackBuf();
state.surf_pitch = _dxSurfacePitch;
if (getGameType() == GType_FF || getGameType() == GType_PP) {
drawImage_Feeble(&state);
} else if (getFeatures() & GF_32COLOR) {
drawImage_Amiga(&state);
} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
drawImage_Simon(&state);
} else {
drawImage(&state);
}
drawImage(&state);
}
void AGOSEngine::vc12_delay() {
@ -712,8 +704,8 @@ void AGOSEngine::vc12_delay() {
num = vcReadVarOrWord() * _frameRate;
}
// Work around to allow inventory arrows to be
// shown in some versions of Simon the Sorcerer 1
// Work around to allow inventory arrows to be shown
// in non-Windows versions of Simon the Sorcerer 1
if ((getGameType() == GType_SIMON1) && vsp->id == 128)
num = 0;
else