Fix Indy4/MI2 crash due to VirtScroll code.
Cleanup \N's - For gods sake fix your CVS client :) svn-id: r4067
This commit is contained in:
parent
20e9ad5e23
commit
280136f13a
11 changed files with 98 additions and 113 deletions
|
@ -495,10 +495,8 @@ int Scumm::getActorXYPos(Actor * a)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
AdjustBoxResult Scumm::adjustXYToBeInBox(Actor * a, int x, int y,
|
AdjustBoxResult Scumm::adjustXYToBeInBox(Actor * a, int x, int y, int pathfrom)
|
||||||
int pathfrom)
|
|
||||||
{
|
{
|
||||||
// Yazoo: need to recheck with Loom for the class data flags (0x400000)
|
|
||||||
AdjustBoxResult abr, tmp;
|
AdjustBoxResult abr, tmp;
|
||||||
uint threshold;
|
uint threshold;
|
||||||
uint best;
|
uint best;
|
||||||
|
@ -753,7 +751,6 @@ void Scumm::startWalkAnim(Actor * a, int cmd, int angle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Scumm::walkActor(Actor * a)
|
void Scumm::walkActor(Actor * a)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
@ -918,10 +915,14 @@ void Scumm::drawActorCostume(Actor * a)
|
||||||
a->mask = 0;
|
a->mask = 0;
|
||||||
else if (g_scumm->getClass(a->number, 21))
|
else if (g_scumm->getClass(a->number, 21))
|
||||||
a->forceClip = 1;
|
a->forceClip = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (_gameId==GID_SAMNMAX && getState(995)) // FIXME: ugly fix for samnmax inventory
|
if (_gameId==GID_SAMNMAX && getState(995)) // FIXME: ugly fix for samnmax inventory
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
a->needRedraw = false;
|
a->needRedraw = false;
|
||||||
|
|
||||||
setupActorScale(a);
|
setupActorScale(a);
|
||||||
|
|
39
akos.cpp
39
akos.cpp
|
@ -53,7 +53,6 @@ int Scumm::akos_findManyDirection(int16 ManyDirection, uint16 facing)
|
||||||
|
|
||||||
--temp;
|
--temp;
|
||||||
--direction;
|
--direction;
|
||||||
|
|
||||||
} while (temp);
|
} while (temp);
|
||||||
|
|
||||||
return (temp);
|
return (temp);
|
||||||
|
@ -221,9 +220,7 @@ bool Scumm::akos_drawCostumeChannel(AkosRenderer * ar, int chan)
|
||||||
if (code != AKC_ComplexChan) {
|
if (code != AKC_ComplexChan) {
|
||||||
off = ar->akof + (code & 0xFFF);
|
off = ar->akof + (code & 0xFFF);
|
||||||
|
|
||||||
assert((code & 0xFFF) * 6 <
|
assert((code & 0xFFF) * 6 < READ_BE_UINT32_UNALIGNED((byte *)ar->akof - 4) - 8);
|
||||||
READ_BE_UINT32_UNALIGNED((byte *)ar->akof - 4) - 8);
|
|
||||||
|
|
||||||
assert((code & 0x7000) == 0);
|
assert((code & 0x7000) == 0);
|
||||||
|
|
||||||
ar->srcptr = ar->akcd + READ_LE_UINT32(&off->akcd);
|
ar->srcptr = ar->akcd + READ_LE_UINT32(&off->akcd);
|
||||||
|
@ -582,14 +579,14 @@ void Scumm::akos_codec1(AkosRenderer * ar)
|
||||||
bool masking;
|
bool masking;
|
||||||
int step;
|
int step;
|
||||||
|
|
||||||
|
|
||||||
/* implement custom scale table */
|
/* implement custom scale table */
|
||||||
|
|
||||||
if(isGlobInMemory(rtString,_vars[VAR_CUSTOMSCALETABLE]))
|
|
||||||
{
|
|
||||||
|
if(isGlobInMemory(rtString,_vars[VAR_CUSTOMSCALETABLE])) {
|
||||||
ar->v1.scaletable = getStringAddressVar(VAR_CUSTOMSCALETABLE);
|
ar->v1.scaletable = getStringAddressVar(VAR_CUSTOMSCALETABLE);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ar->v1.scaletable = default_scale_table;
|
ar->v1.scaletable = default_scale_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,7 +654,6 @@ void Scumm::akos_codec1(AkosRenderer * ar)
|
||||||
if (x_left >= (int)ar->outwidth) {
|
if (x_left >= (int)ar->outwidth) {
|
||||||
tmp_x = j;
|
tmp_x = j;
|
||||||
skip++;
|
skip++;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (ar->v1.scaletable[j--] < ar->scale_x)
|
if (ar->v1.scaletable[j--] < ar->scale_x)
|
||||||
x_left--;
|
x_left--;
|
||||||
|
@ -897,34 +893,30 @@ void Scumm::akos_codec1_ignorePakCols(AkosRenderer * ar, int num)
|
||||||
|
|
||||||
void Scumm::akos_codec5(AkosRenderer * ar)
|
void Scumm::akos_codec5(AkosRenderer * ar)
|
||||||
{
|
{
|
||||||
|
|
||||||
VirtScreen *vs;
|
VirtScreen *vs;
|
||||||
BompDrawData bdd;
|
BompDrawData bdd;
|
||||||
|
|
||||||
int mirror;
|
int mirror;
|
||||||
int moveX;
|
int moveX;
|
||||||
int moveY;
|
int moveY;
|
||||||
int left;
|
int left;
|
||||||
int var_20;
|
int var_20;
|
||||||
int max_width;
|
int max_width;
|
||||||
|
|
||||||
int right;
|
int right;
|
||||||
int top;
|
int top;
|
||||||
int bottom;
|
int bottom;
|
||||||
|
|
||||||
vs = &virtscr[0];
|
vs = &virtscr[0];
|
||||||
|
|
||||||
//setBlastObjectMode(ar->shadow_mode); // not implemented yet
|
//setBlastObjectMode(ar->shadow_mode); // not implemented yet
|
||||||
|
|
||||||
mirror = ar->mirror;
|
mirror = ar->mirror;
|
||||||
|
|
||||||
moveX=ar->move_x_cur;
|
moveX=ar->move_x_cur;
|
||||||
moveY=ar->move_y_cur;
|
moveY=ar->move_y_cur;
|
||||||
|
|
||||||
if (!mirror)
|
if (!mirror) {
|
||||||
{
|
|
||||||
left = (ar->x - moveX - ar->width) + 1;
|
left = (ar->x - moveX - ar->width) + 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
left = ar->x + moveX -1;
|
left = ar->x + moveX -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -937,7 +929,6 @@ void Scumm::akos_codec5(AkosRenderer * ar)
|
||||||
|
|
||||||
if(left < 0)
|
if(left < 0)
|
||||||
left = 0;
|
left = 0;
|
||||||
|
|
||||||
if(left > max_width)
|
if(left > max_width)
|
||||||
left -= left - max_width;
|
left -= left - max_width;
|
||||||
|
|
||||||
|
@ -1095,12 +1086,8 @@ bool Scumm::akos_increaseAnim(Actor * a, int chan, byte *aksq, uint16 *akfo,
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case AKC_StartAnimInActor:
|
case AKC_StartAnimInActor:
|
||||||
akos_queCommand(4,
|
akos_queCommand(4, derefActorSafe(getAnimVar(a, GB(2)),
|
||||||
derefActorSafe(getAnimVar(a, GB(2)),
|
"akos_increaseAnim:29"), getAnimVar(a, GB(3)), 0);
|
||||||
"akos_increaseAnim:29"), getAnimVar(a,
|
|
||||||
GB
|
|
||||||
(3)),
|
|
||||||
0);
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case AKC_Random:
|
case AKC_Random:
|
||||||
|
|
62
gfx.cpp
62
gfx.cpp
|
@ -94,7 +94,6 @@ void Scumm::initVirtScreen(int slot, int number, int top, int width, int height,
|
||||||
size += 320 * 4;
|
size += 320 * 4;
|
||||||
|
|
||||||
createResource(rtBuffer, slot+1, size);
|
createResource(rtBuffer, slot+1, size);
|
||||||
|
|
||||||
vs->screenPtr = getResourceAddress(rtBuffer, slot+1);
|
vs->screenPtr = getResourceAddress(rtBuffer, slot+1);
|
||||||
|
|
||||||
ptr = vs->screenPtr;
|
ptr = vs->screenPtr;
|
||||||
|
@ -143,9 +142,8 @@ void Scumm::drawDirtyScreenParts()
|
||||||
updateDirtyScreen(0);
|
updateDirtyScreen(0);
|
||||||
} else {
|
} else {
|
||||||
vs = &virtscr[0];
|
vs = &virtscr[0];
|
||||||
|
|
||||||
src = vs->screenPtr + _screenStartStrip * 8 + camera._cur.y - 100;
|
src = vs->screenPtr + _screenStartStrip * 8 + camera._cur.y - 100;
|
||||||
|
|
||||||
_system->copy_rect(src , 320, 0, vs->topline, 320, vs->height);
|
_system->copy_rect(src , 320, 0, vs->topline, 320, vs->height);
|
||||||
|
|
||||||
for (i = 0; i < 40; i++) {
|
for (i = 0; i < 40; i++) {
|
||||||
|
@ -183,8 +181,11 @@ void Gdi::updateDirtyScreen(VirtScreen * vs)
|
||||||
|
|
||||||
for (i = 0; i < 40; i++) {
|
for (i = 0; i < 40; i++) {
|
||||||
bottom = vs->bdirty[i];
|
bottom = vs->bdirty[i];
|
||||||
|
|
||||||
if (_vm->camera._cur.y != _vm->camera._last.y)
|
if (_vm->camera._cur.y != _vm->camera._last.y)
|
||||||
|
|
||||||
drawStripToScreen(vs, start, w, 0, vs->height);
|
drawStripToScreen(vs, start, w, 0, vs->height);
|
||||||
|
|
||||||
else
|
else
|
||||||
if (bottom) {
|
if (bottom) {
|
||||||
top = vs->tdirty[i];
|
top = vs->tdirty[i];
|
||||||
|
@ -196,6 +197,7 @@ void Gdi::updateDirtyScreen(VirtScreen * vs)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// drawStripToScreen(vs, start, w, top, bottom);
|
// drawStripToScreen(vs, start, w, top, bottom);
|
||||||
|
|
||||||
drawStripToScreen(vs, start, w, 0, vs->height);
|
drawStripToScreen(vs, start, w, 0, vs->height);
|
||||||
w = 8;
|
w = 8;
|
||||||
}
|
}
|
||||||
|
@ -229,15 +231,14 @@ void Gdi::drawStripToScreen(VirtScreen * vs, int x, int w, int t, int b)
|
||||||
scrollY = 0;
|
scrollY = 0;
|
||||||
|
|
||||||
ptr = vs->screenPtr + (t * 40 + x) * 8 + _readOffs + scrollY * 320;
|
ptr = vs->screenPtr + (t * 40 + x) * 8 + _readOffs + scrollY * 320;
|
||||||
|
_vm->_system->copy_rect(ptr, 320, x * 8, vs->topline + t , w, height);
|
||||||
_vm->_system->copy_rect(
|
|
||||||
ptr, 320, x * 8, vs->topline + t , w, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void blit(byte *dst, byte *src, int w, int h)
|
void blit(byte *dst, byte *src, int w, int h)
|
||||||
{
|
{
|
||||||
assert(h > 0);
|
assert(h > 0);
|
||||||
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
memcpy(dst, src, w);
|
memcpy(dst, src, w);
|
||||||
dst += 320;
|
dst += 320;
|
||||||
|
@ -358,24 +359,26 @@ void Scumm::initBGBuffers(int height)
|
||||||
int size, itemsize, i;
|
int size, itemsize, i;
|
||||||
byte *room;
|
byte *room;
|
||||||
|
|
||||||
if (_features & GF_AFTER_V7)
|
if (_features & GF_AFTER_V7) {
|
||||||
{
|
|
||||||
initVirtScreen(0, 0, virtscr[0].topline, 200, height, 1, 1);
|
initVirtScreen(0, 0, virtscr[0].topline, 200, height, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
room = getResourceAddress(rtRoom, _roomResource);
|
room = getResourceAddress(rtRoom, _roomResource);
|
||||||
if (_features & GF_SMALL_HEADER) {
|
if (_features & GF_SMALL_HEADER) {
|
||||||
gdi._numZBuffer = 2; // ENDER
|
gdi._numZBuffer = 2;
|
||||||
} else {
|
} else {
|
||||||
ptr = findResource(MKID('RMIH'), findResource(MKID('RMIM'), room));
|
ptr = findResource(MKID('RMIH'), findResource(MKID('RMIM'), room));
|
||||||
gdi._numZBuffer = READ_LE_UINT16(ptr + 8) + 1;
|
gdi._numZBuffer = READ_LE_UINT16(ptr + 8) + 1;
|
||||||
}
|
}
|
||||||
assert(gdi._numZBuffer >= 1 && gdi._numZBuffer <= 5);
|
assert(gdi._numZBuffer >= 1 && gdi._numZBuffer <= 5);
|
||||||
|
|
||||||
// itemsize = (_scrHeight + 4) * 40;
|
if (_features & GF_AFTER_V7)
|
||||||
itemsize = (virtscr[0].height +4) * 40;
|
itemsize = (virtscr[0].height +4) * 40;
|
||||||
size = itemsize * gdi._numZBuffer;
|
else
|
||||||
|
itemsize = (_scrHeight + 4) * 40;
|
||||||
|
|
||||||
|
|
||||||
|
size = itemsize * gdi._numZBuffer;
|
||||||
createResource(rtBuffer, 9, size);
|
createResource(rtBuffer, 9, size);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
|
@ -663,11 +666,13 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen * vs, int x, int y, int h,
|
||||||
byte *smap_ptr, *where_draw_ptr;
|
byte *smap_ptr, *where_draw_ptr;
|
||||||
int i;
|
int i;
|
||||||
byte *zplane_list[4];
|
byte *zplane_list[4];
|
||||||
|
|
||||||
int bottom;
|
int bottom;
|
||||||
byte twobufs;
|
byte twobufs;
|
||||||
int numzbuf;
|
int numzbuf;
|
||||||
int sx;
|
int sx;
|
||||||
|
|
||||||
|
|
||||||
CHECK_HEAP;
|
CHECK_HEAP;
|
||||||
if (_vm->_features & GF_SMALL_HEADER)
|
if (_vm->_features & GF_SMALL_HEADER)
|
||||||
smap_ptr = _smap_ptr = ptr;
|
smap_ptr = _smap_ptr = ptr;
|
||||||
|
@ -695,6 +700,8 @@ void Gdi::drawBitmap(byte *ptr, VirtScreen * vs, int x, int y, int h,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bottom = y + h;
|
bottom = y + h;
|
||||||
if (bottom > vs->height) {
|
if (bottom > vs->height) {
|
||||||
warning("Gdi::drawBitmap, strip drawn to %d below window bottom %d", bottom,
|
warning("Gdi::drawBitmap, strip drawn to %d below window bottom %d", bottom,
|
||||||
|
@ -1928,9 +1935,13 @@ void Scumm::moveCamera()
|
||||||
if (cd->_cur.x != old.x || cd->_cur.y != old.y) {
|
if (cd->_cur.x != old.x || cd->_cur.y != old.y) {
|
||||||
_vars[VAR_CAMERA_POS_X] = cd->_cur.x;
|
_vars[VAR_CAMERA_POS_X] = cd->_cur.x;
|
||||||
_vars[VAR_CAMERA_POS_Y] = cd->_cur.y;
|
_vars[VAR_CAMERA_POS_Y] = cd->_cur.y;
|
||||||
|
|
||||||
_vars[VAR_CAMERA_DEST_X] = cd->_dest.x;
|
_vars[VAR_CAMERA_DEST_X] = cd->_dest.x;
|
||||||
|
|
||||||
_vars[VAR_CAMERA_DEST_Y] = cd->_dest.y;
|
_vars[VAR_CAMERA_DEST_Y] = cd->_dest.y;
|
||||||
|
|
||||||
_vars[VAR_CAMERA_FOLLOWED_ACTOR] = cd ->_follows;
|
_vars[VAR_CAMERA_FOLLOWED_ACTOR] = cd ->_follows;
|
||||||
|
|
||||||
if(_vars[VAR_SCROLL_SCRIPT])
|
if(_vars[VAR_SCROLL_SCRIPT])
|
||||||
runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0);
|
runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -2203,6 +2214,7 @@ void Scumm::resetActorBgs()
|
||||||
while (onlyActorFlags) {
|
while (onlyActorFlags) {
|
||||||
if (onlyActorFlags & 1 && a->top != 0xFF && a->needBgReset) {
|
if (onlyActorFlags & 1 && a->top != 0xFF && a->needBgReset) {
|
||||||
gfxUsageBits[_screenStartStrip + i] ^= bitpos;
|
gfxUsageBits[_screenStartStrip + i] ^= bitpos;
|
||||||
|
|
||||||
if((a->bottom - a->top) >=0)
|
if((a->bottom - a->top) >=0)
|
||||||
gdi.resetBackground(a->top, a->bottom, i);
|
gdi.resetBackground(a->top, a->bottom, i);
|
||||||
}
|
}
|
||||||
|
@ -2575,8 +2587,11 @@ int Scumm::remapPaletteColor(int r, int g, int b, uint threshold)
|
||||||
return bestitem;
|
return bestitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// param3= clipping
|
// param3= clipping
|
||||||
|
|
||||||
// param2= mirror
|
// param2= mirror
|
||||||
|
|
||||||
// param1= never used ?
|
// param1= never used ?
|
||||||
void Scumm::drawBomp(BompDrawData *bd, int param1, byte* dataPtr, int param2, int param3)
|
void Scumm::drawBomp(BompDrawData *bd, int param1, byte* dataPtr, int param2, int param3)
|
||||||
{
|
{
|
||||||
|
@ -2683,12 +2698,8 @@ void Scumm::createSpecialPalette(int16 a, int16 b, int16 c, int16 d, int16 e, in
|
||||||
byte *curPtr;
|
byte *curPtr;
|
||||||
byte *searchPtr;
|
byte *searchPtr;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
byte readComp1;
|
byte readComp1;
|
||||||
|
|
||||||
byte readComp2;
|
byte readComp2;
|
||||||
|
|
||||||
byte readComp3;
|
byte readComp3;
|
||||||
|
|
||||||
int colorComp1;
|
int colorComp1;
|
||||||
|
@ -2714,18 +2725,11 @@ void Scumm::createSpecialPalette(int16 a, int16 b, int16 c, int16 d, int16 e, in
|
||||||
|
|
||||||
curPtr = palPtr + colorMin*3;
|
curPtr = palPtr + colorMin*3;
|
||||||
|
|
||||||
for(i=colorMin;i<colorMax;i++)
|
for(i=colorMin;i<colorMax;i++) {
|
||||||
{
|
|
||||||
|
|
||||||
readComp1=*(curPtr++);
|
readComp1=*(curPtr++);
|
||||||
|
|
||||||
readComp2=*(curPtr++);
|
readComp2=*(curPtr++);
|
||||||
|
|
||||||
readComp3=*(curPtr++);
|
readComp3=*(curPtr++);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
colorComp1=((readComp1)*c)>>8;
|
colorComp1=((readComp1)*c)>>8;
|
||||||
colorComp2=((readComp2)*d)>>8;
|
colorComp2=((readComp2)*d)>>8;
|
||||||
colorComp3=((readComp3)*e)>>8;
|
colorComp3=((readComp3)*e)>>8;
|
||||||
|
@ -2734,22 +2738,18 @@ void Scumm::createSpecialPalette(int16 a, int16 b, int16 c, int16 d, int16 e, in
|
||||||
bestResult = 32000;
|
bestResult = 32000;
|
||||||
currentIndex = 0;
|
currentIndex = 0;
|
||||||
|
|
||||||
for(j=a;j<b;j++)
|
for(j=a;j<b;j++) {
|
||||||
{
|
|
||||||
searchComp1 = (*searchPtr++);
|
searchComp1 = (*searchPtr++);
|
||||||
searchComp2 = (*searchPtr++);
|
searchComp2 = (*searchPtr++);
|
||||||
searchComp3 = (*searchPtr++);
|
searchComp3 = (*searchPtr++);
|
||||||
|
|
||||||
currentResult = abs(searchComp1-colorComp1) + abs(searchComp2-colorComp2) + abs(searchComp3-colorComp3);
|
currentResult = abs(searchComp1-colorComp1) + abs(searchComp2-colorComp2) + abs(searchComp3-colorComp3);
|
||||||
|
|
||||||
if(currentResult<bestResult)
|
if(currentResult<bestResult) {
|
||||||
{
|
|
||||||
_proc_special_palette[i]=currentIndex;
|
_proc_special_palette[i]=currentIndex;
|
||||||
bestResult=currentResult;
|
bestResult=currentResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
1
gfx.h
1
gfx.h
|
@ -78,6 +78,7 @@ struct BlastObject { /* BlastObjects to draw */
|
||||||
int16 posX,posY;
|
int16 posX,posY;
|
||||||
uint16 width,height;
|
uint16 width,height;
|
||||||
uint16 unk3,unk4,image;
|
uint16 unk3,unk4,image;
|
||||||
|
|
||||||
uint16 mode;
|
uint16 mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
23
object.cpp
23
object.cpp
|
@ -336,6 +336,7 @@ void Scumm::drawObject(int obj, int arg)
|
||||||
|
|
||||||
xpos = od->x_pos >> 3;
|
xpos = od->x_pos >> 3;
|
||||||
ypos = od->y_pos;
|
ypos = od->y_pos;
|
||||||
|
|
||||||
width = od->width >> 3;
|
width = od->width >> 3;
|
||||||
height = od->height &= 0xF8; // Ender
|
height = od->height &= 0xF8; // Ender
|
||||||
|
|
||||||
|
@ -521,7 +522,8 @@ void Scumm::loadRoomObjectsSmall()
|
||||||
setupRoomObject(od, room);
|
setupRoomObject(od, room);
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_HEAP}
|
CHECK_HEAP
|
||||||
|
}
|
||||||
|
|
||||||
void Scumm::setupRoomObject(ObjectData *od, byte *room)
|
void Scumm::setupRoomObject(ObjectData *od, byte *room)
|
||||||
{
|
{
|
||||||
|
@ -558,8 +560,7 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cdhd =
|
cdhd = (CodeHeader *)findResourceData(MKID('CDHD'),
|
||||||
(CodeHeader *)findResourceData(MKID('CDHD'),
|
|
||||||
room + od->offs_obcd_to_room);
|
room + od->offs_obcd_to_room);
|
||||||
if (_features & GF_AFTER_V7)
|
if (_features & GF_AFTER_V7)
|
||||||
od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id));
|
od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id));
|
||||||
|
@ -653,6 +654,7 @@ void Scumm::clearOwnerOf(int obj)
|
||||||
} while (++i <= _numObjectsInRoom);
|
} while (++i <= _numObjectsInRoom);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i < _maxInventoryItems; i++) {
|
for (i = 1; i < _maxInventoryItems; i++) {
|
||||||
if (_inventory[i] == obj) {
|
if (_inventory[i] == obj) {
|
||||||
j = whereIsObject(obj);
|
j = whereIsObject(obj);
|
||||||
|
@ -1184,6 +1186,7 @@ void Scumm::enqueueObject(int objectNumber, int objectX, int objectY, int object
|
||||||
eo->unk3 = f;
|
eo->unk3 = f;
|
||||||
eo->unk4 = g;
|
eo->unk4 = g;
|
||||||
eo->image = image;
|
eo->image = image;
|
||||||
|
|
||||||
eo->mode = mode;
|
eo->mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1202,11 +1205,8 @@ void Scumm::drawBlastObjects()
|
||||||
void Scumm::drawBlastObject(BlastObject * eo)
|
void Scumm::drawBlastObject(BlastObject * eo)
|
||||||
{
|
{
|
||||||
VirtScreen *vs;
|
VirtScreen *vs;
|
||||||
byte *roomptr, *bomp;
|
byte *bomp, *ptr, *img;
|
||||||
byte *ptr;
|
|
||||||
byte *img;
|
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
BompDrawData bdd;
|
BompDrawData bdd;
|
||||||
|
|
||||||
vs = &virtscr[0];
|
vs = &virtscr[0];
|
||||||
|
@ -1217,8 +1217,7 @@ void Scumm::drawBlastObject(BlastObject * eo)
|
||||||
|
|
||||||
idx = _objs[getObjectIndex(eo->number)].fl_object_index;
|
idx = _objs[getObjectIndex(eo->number)].fl_object_index;
|
||||||
|
|
||||||
if(idx)
|
if(idx) {
|
||||||
{
|
|
||||||
ptr = getResourceAddress(rtFlObject, idx);
|
ptr = getResourceAddress(rtFlObject, idx);
|
||||||
ptr = findResource(MKID('OBIM'), ptr);
|
ptr = findResource(MKID('OBIM'), ptr);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1226,19 +1225,16 @@ void Scumm::drawBlastObject(BlastObject * eo)
|
||||||
assert(idx != -1);
|
assert(idx != -1);
|
||||||
ptr = getResourceAddress(1, _roomResource) + _objs[idx].offs_obim_to_room;
|
ptr = getResourceAddress(1, _roomResource) + _objs[idx].offs_obim_to_room;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ptr)
|
if(!ptr)
|
||||||
error("BlastObject object %d image not found",eo->number);
|
error("BlastObject object %d image not found",eo->number);
|
||||||
|
|
||||||
img = findResource(IMxx_tags[eo->image], ptr);
|
img = findResource(IMxx_tags[eo->image], ptr);
|
||||||
if(!img)
|
if(!img)
|
||||||
img = findResource(IMxx_tags[1], ptr); // Backward compatibility with samnmax blast objects
|
img = findResource(IMxx_tags[1], ptr); // Backward compatibility with samnmax blast objects
|
||||||
|
|
||||||
if(!img)
|
if(!img)
|
||||||
error("blast-object %d invalid image %d (1-x)",eo->number,eo->image);
|
error("blast-object %d invalid image %d (1-x)",eo->number,eo->image);
|
||||||
|
|
||||||
bomp = findResourceData(MKID('BOMP'), img);
|
bomp = findResourceData(MKID('BOMP'), img);
|
||||||
|
|
||||||
if(!bomp)
|
if(!bomp)
|
||||||
error("object %d is not a blast object",eo->number);
|
error("object %d is not a blast object",eo->number);
|
||||||
|
|
||||||
|
@ -1255,11 +1251,8 @@ void Scumm::drawBlastObject(BlastObject * eo)
|
||||||
bdd.scale_y = (unsigned char)eo->unk4;
|
bdd.scale_y = (unsigned char)eo->unk4;
|
||||||
|
|
||||||
drawBomp(&bdd, 0, bdd.dataptr, 1, 0);
|
drawBomp(&bdd, 0, bdd.dataptr, 1, 0);
|
||||||
|
|
||||||
|
|
||||||
updateDirtyRect(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y,
|
updateDirtyRect(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y,
|
||||||
bdd.y + bdd.srcheight, 0);
|
bdd.y + bdd.srcheight, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scumm::removeBlastObjects()
|
void Scumm::removeBlastObjects()
|
||||||
|
|
19
resource.cpp
19
resource.cpp
|
@ -652,12 +652,12 @@ byte *Scumm::getStringAddress(int i)
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte *Scumm::getStringAddressVar(int i)
|
|
||||||
{
|
|
||||||
|
byte *Scumm::getStringAddressVar(int i) {
|
||||||
byte *addr;
|
byte *addr;
|
||||||
|
|
||||||
addr=getResourceAddress(rtString,_vars[i]);
|
addr=getResourceAddress(rtString,_vars[i]);
|
||||||
|
|
||||||
if(addr==NULL)
|
if(addr==NULL)
|
||||||
error("NULL string var %d slot %d",i,_vars[i]);
|
error("NULL string var %d slot %d",i,_vars[i]);
|
||||||
|
|
||||||
|
@ -665,7 +665,6 @@ byte *Scumm::getStringAddressVar(int i)
|
||||||
return ((ArrayHeader *)addr)->data;
|
return ((ArrayHeader *)addr)->data;
|
||||||
|
|
||||||
return(addr);
|
return(addr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scumm::setResourceCounter(int type, int idx, byte flag)
|
void Scumm::setResourceCounter(int type, int idx, byte flag)
|
||||||
|
@ -1163,16 +1162,27 @@ void Scumm::allocateArrays()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32 Scumm::isGlobInMemory(int type, int index)
|
uint32 Scumm::isGlobInMemory(int type, int index)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
validateResource("isGlobInMemory",type,index);
|
validateResource("isGlobInMemory",type,index);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(res.address[type][index]==NULL)
|
if(res.address[type][index]==NULL)
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint16 newTag2Old(uint32 oldTag)
|
uint16 newTag2Old(uint32 oldTag)
|
||||||
{
|
{
|
||||||
switch (oldTag) {
|
switch (oldTag) {
|
||||||
|
@ -1214,3 +1224,4 @@ uint16 newTag2Old(uint32 oldTag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
12
script.cpp
12
script.cpp
|
@ -32,6 +32,7 @@ void Scumm::runScript(int script, int a, int b, int16 * lvarptr)
|
||||||
int slot;
|
int slot;
|
||||||
ScriptSlot *s;
|
ScriptSlot *s;
|
||||||
|
|
||||||
|
|
||||||
if (script == 0)
|
if (script == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -267,6 +268,7 @@ void Scumm::getScriptEntryPoint()
|
||||||
/* Execute a script - Read opcode, and execute it from the table */
|
/* Execute a script - Read opcode, and execute it from the table */
|
||||||
void Scumm::executeScript()
|
void Scumm::executeScript()
|
||||||
{
|
{
|
||||||
|
|
||||||
OpcodeProc op;
|
OpcodeProc op;
|
||||||
while (_currentScript != 0xFF) {
|
while (_currentScript != 0xFF) {
|
||||||
_opcode = fetchScriptByte();
|
_opcode = fetchScriptByte();
|
||||||
|
@ -966,10 +968,7 @@ void Scumm::beginOverride()
|
||||||
|
|
||||||
idx = vm.cutSceneStackPointer;
|
idx = vm.cutSceneStackPointer;
|
||||||
ptr = &vm.cutScenePtr[idx];
|
ptr = &vm.cutScenePtr[idx];
|
||||||
/* if (!*ptr) { // ENDER - FIXME - We don't need this?
|
|
||||||
vm.slot[_currentScript].cutsceneOverride++;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
*ptr = _scriptPointer - _scriptOrgPointer;
|
*ptr = _scriptPointer - _scriptOrgPointer;
|
||||||
vm.cutSceneScript[idx] = _currentScript;
|
vm.cutSceneScript[idx] = _currentScript;
|
||||||
|
|
||||||
|
@ -985,10 +984,7 @@ void Scumm::endOverride()
|
||||||
|
|
||||||
idx = vm.cutSceneStackPointer;
|
idx = vm.cutSceneStackPointer;
|
||||||
ptr = &vm.cutScenePtr[idx];
|
ptr = &vm.cutScenePtr[idx];
|
||||||
/* if (!*ptr) { // ENDER - FIXME - We don't need this?
|
|
||||||
// vm.slot[_currentScript].cutsceneOverride--;
|
|
||||||
//printf("ending override: %d on script %d\n", vm.slot[_currentScript].cutsceneOverride, _currentScript);
|
|
||||||
} */
|
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
vm.cutSceneScript[idx] = 0;
|
vm.cutSceneScript[idx] = 0;
|
||||||
_vars[VAR_OVERRIDE] = 0;
|
_vars[VAR_OVERRIDE] = 0;
|
||||||
|
|
3
scumm.h
3
scumm.h
|
@ -1692,8 +1692,11 @@ public:
|
||||||
byte VAR_CAMERA_SPEED_Y;
|
byte VAR_CAMERA_SPEED_Y;
|
||||||
byte VAR_CAMERA_ACCEL_X;
|
byte VAR_CAMERA_ACCEL_X;
|
||||||
byte VAR_CAMERA_ACCEL_Y;
|
byte VAR_CAMERA_ACCEL_Y;
|
||||||
|
|
||||||
byte VAR_CAMERA_DEST_X;
|
byte VAR_CAMERA_DEST_X;
|
||||||
|
|
||||||
byte VAR_CAMERA_DEST_Y;
|
byte VAR_CAMERA_DEST_Y;
|
||||||
|
|
||||||
byte VAR_CAMERA_FOLLOWED_ACTOR;
|
byte VAR_CAMERA_FOLLOWED_ACTOR;
|
||||||
|
|
||||||
byte VAR_LEFTBTN_DOWN;
|
byte VAR_LEFTBTN_DOWN;
|
||||||
|
|
33
scummvm.cpp
33
scummvm.cpp
|
@ -53,10 +53,7 @@ void Scumm::scummInit()
|
||||||
int i;
|
int i;
|
||||||
Actor *a;
|
Actor *a;
|
||||||
|
|
||||||
|
|
||||||
tempMusic=0;
|
tempMusic=0;
|
||||||
|
|
||||||
|
|
||||||
debug(9, "scummInit");
|
debug(9, "scummInit");
|
||||||
|
|
||||||
if (_features & GF_SMALL_HEADER)
|
if (_features & GF_SMALL_HEADER)
|
||||||
|
@ -208,13 +205,8 @@ int Scumm::scummLoop(int delta)
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
|
|
||||||
|
|
||||||
if (_debugger)
|
if (_debugger)
|
||||||
_debugger->on_frame();
|
_debugger->on_frame();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_vars[VAR_TMR_1] += delta;
|
_vars[VAR_TMR_1] += delta;
|
||||||
|
@ -259,23 +251,12 @@ int Scumm::scummLoop(int delta)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if(tempMusic == 3)
|
if(tempMusic == 3) {
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
tempMusic = 0;
|
tempMusic = 0;
|
||||||
_vars[VAR_MUSIC_FLAG]++;
|
_vars[VAR_MUSIC_FLAG]++;
|
||||||
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
tempMusic ++;
|
tempMusic ++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,6 +309,7 @@ int Scumm::scummLoop(int delta)
|
||||||
if (camera._cur.x != camera._last.x || camera._cur.y != camera._last.y
|
if (camera._cur.x != camera._last.x || camera._cur.y != camera._last.y
|
||||||
|| _BgNeedsRedraw || _fullRedraw) {
|
|| _BgNeedsRedraw || _fullRedraw) {
|
||||||
redrawBGAreas();
|
redrawBGAreas();
|
||||||
|
|
||||||
_videoBuffer = virtscr[0].screenPtr + (camera._cur.y - 100) * 328;
|
_videoBuffer = virtscr[0].screenPtr + (camera._cur.y - 100) * 328;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -431,7 +413,7 @@ void Scumm::startScene(int room, Actor * a, int objectNr)
|
||||||
|
|
||||||
_currentRoom = room;
|
_currentRoom = room;
|
||||||
_vars[VAR_ROOM] = room;
|
_vars[VAR_ROOM] = room;
|
||||||
// printf("startscene with room 0x%x\n", room);
|
|
||||||
if (room >= 0x80)
|
if (room >= 0x80)
|
||||||
_roomResource = _resourceMapper[room & 0x7F];
|
_roomResource = _resourceMapper[room & 0x7F];
|
||||||
else
|
else
|
||||||
|
@ -457,6 +439,7 @@ void Scumm::startScene(int room, Actor * a, int objectNr)
|
||||||
if (!(_features & GF_AFTER_V7)) {
|
if (!(_features & GF_AFTER_V7)) {
|
||||||
camera._mode = CM_NORMAL;
|
camera._mode = CM_NORMAL;
|
||||||
camera._cur.x = camera._dest.x = 160;
|
camera._cur.x = camera._dest.x = 160;
|
||||||
|
|
||||||
camera._cur.y = camera._dest.y = 100;
|
camera._cur.y = camera._dest.y = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,8 +694,10 @@ void Scumm::initRoomSubBlocks()
|
||||||
|
|
||||||
initBGBuffers(_scrHeight);
|
initBGBuffers(_scrHeight);
|
||||||
|
|
||||||
|
|
||||||
_videoBuffer = virtscr[0].screenPtr;
|
_videoBuffer = virtscr[0].screenPtr;
|
||||||
|
|
||||||
|
|
||||||
memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags));
|
memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,9 +807,13 @@ void Scumm::processKbd()
|
||||||
|
|
||||||
_virtual_mouse_x = mouse.x + virtscr[0].xstart;
|
_virtual_mouse_x = mouse.x + virtscr[0].xstart;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(_features & GF_AFTER_V7)
|
if(_features & GF_AFTER_V7)
|
||||||
_virtual_mouse_y = mouse.y + camera._cur.y-100;
|
_virtual_mouse_y = mouse.y + camera._cur.y-100;
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
_virtual_mouse_y = mouse.y;
|
_virtual_mouse_y = mouse.y;
|
||||||
|
|
||||||
if (!(_features & GF_OLD256))
|
if (!(_features & GF_OLD256))
|
||||||
|
|
|
@ -237,7 +237,9 @@ void Scumm::CHARSET_1()
|
||||||
string[0].ypos = ((a->new_1 - s) >> 1) + s - a->elevation + a->y;
|
string[0].ypos = ((a->new_1 - s) >> 1) + s - a->elevation + a->y;
|
||||||
if (string[0].ypos < 1)
|
if (string[0].ypos < 1)
|
||||||
string[0].ypos = 1;
|
string[0].ypos = 1;
|
||||||
|
|
||||||
if (string[0].ypos < camera._cur.y - 100)
|
if (string[0].ypos < camera._cur.y - 100)
|
||||||
|
|
||||||
string[0].ypos = camera._cur.y - 100;
|
string[0].ypos = camera._cur.y - 100;
|
||||||
|
|
||||||
s = a->scalex * a->new_2 / 0xFF;
|
s = a->scalex * a->new_2 / 0xFF;
|
||||||
|
@ -533,6 +535,7 @@ void Scumm::drawString(int a)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (a == 1 && (_features & GF_AFTER_V6))
|
if (a == 1 && (_features & GF_AFTER_V6))
|
||||||
|
|
||||||
if(string[a].no_talk_anim==0)
|
if(string[a].no_talk_anim==0)
|
||||||
charset._blitAlso = true;
|
charset._blitAlso = true;
|
||||||
if (_features & GF_OLD256)
|
if (_features & GF_OLD256)
|
||||||
|
|
7
vars.cpp
7
vars.cpp
|
@ -140,10 +140,14 @@ void Scumm::setupScummVarsNew()
|
||||||
VAR_NEW_ROOM = 35;
|
VAR_NEW_ROOM = 35;
|
||||||
VAR_WALKTO_OBJ = 36;
|
VAR_WALKTO_OBJ = 36;
|
||||||
|
|
||||||
|
|
||||||
VAR_CAMERA_DEST_X = 38;
|
VAR_CAMERA_DEST_X = 38;
|
||||||
|
|
||||||
VAR_CAMERA_DEST_Y = 39;
|
VAR_CAMERA_DEST_Y = 39;
|
||||||
|
|
||||||
VAR_CAMERA_FOLLOWED_ACTOR = 40;
|
VAR_CAMERA_FOLLOWED_ACTOR = 40;
|
||||||
|
|
||||||
|
|
||||||
VAR_SCROLL_SCRIPT = 50;
|
VAR_SCROLL_SCRIPT = 50;
|
||||||
VAR_ENTRY_SCRIPT = 51;
|
VAR_ENTRY_SCRIPT = 51;
|
||||||
VAR_ENTRY_SCRIPT2 = 52;
|
VAR_ENTRY_SCRIPT2 = 52;
|
||||||
|
@ -188,9 +192,7 @@ void Scumm::setupScummVarsNew()
|
||||||
VAR_DEBUGMODE = 116;
|
VAR_DEBUGMODE = 116;
|
||||||
|
|
||||||
VAR_CHARSET_MASK = 119;
|
VAR_CHARSET_MASK = 119;
|
||||||
|
|
||||||
VAR_VIDEONAME = 0xF6/2;
|
VAR_VIDEONAME = 0xF6/2;
|
||||||
|
|
||||||
VAR_CUSTOMSCALETABLE = 131;
|
VAR_CUSTOMSCALETABLE = 131;
|
||||||
|
|
||||||
//VAR_V5_DRAWFLAGS = 9;
|
//VAR_V5_DRAWFLAGS = 9;
|
||||||
|
@ -201,6 +203,5 @@ void Scumm::setupScummVarsNew()
|
||||||
VAR_V5_CHARFLAG = 60;
|
VAR_V5_CHARFLAG = 60;
|
||||||
|
|
||||||
VAR_V6_EMSSPACE = 76;
|
VAR_V6_EMSSPACE = 76;
|
||||||
|
|
||||||
VAR_STRING2DRAW = 130;
|
VAR_STRING2DRAW = 130;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue