More v7 implementation

svn-id: r3656
This commit is contained in:
Vincent Hamm 2002-03-05 23:05:55 +00:00
parent 720c41a25f
commit 6600b48be9
5 changed files with 380 additions and 396 deletions

View file

@ -815,8 +815,8 @@ void Scumm::processActors() {
} while (ac++,--cnt); } while (ac++,--cnt);
} }
#if !defined(FULL_THROTTLE)
void Scumm::drawActorCostume(Actor *a) { void Scumm::drawActorCostume(Actor *a) {
if(!(_features & GF_AFTER_V7)) {
CostumeRenderer cr; CostumeRenderer cr;
if (a==NULL || !a->needRedraw) if (a==NULL || !a->needRedraw)
@ -855,9 +855,7 @@ void Scumm::drawActorCostume(Actor *a) {
a->needBgReset = true; a->needBgReset = true;
a->needRedraw = true; a->needRedraw = true;
} }
} } else {
#else
void Scumm::drawActorCostume(Actor *a) {
AkosRenderer ar; AkosRenderer ar;
if (a==NULL || !a->needRedraw) if (a==NULL || !a->needRedraw)
@ -899,15 +897,12 @@ void Scumm::drawActorCostume(Actor *a) {
akos_drawCostume(&ar); akos_drawCostume(&ar);
a->top = ar.draw_top; a->top = ar.draw_top;
a->bottom = ar.draw_bottom; a->bottom = ar.draw_bottom;
}
} }
#endif
void Scumm::actorAnimate(Actor *a) { void Scumm::actorAnimate(Actor *a) {
#if defined(FULL_THROTTLE)
byte *akos; byte *akos;
#else
LoadedCostume lc; LoadedCostume lc;
#endif
if (a==NULL || a->costume == 0) if (a==NULL || a->costume == 0)
return; return;
@ -916,17 +911,20 @@ void Scumm::actorAnimate(Actor *a) {
if (a->animProgress >= a->animSpeed) { if (a->animProgress >= a->animSpeed) {
a->animProgress = 0; a->animProgress = 0;
#if defined(FULL_THROTTLE) if (_features & GF_AFTER_V7) {
akos = getResourceAddress(rtCostume, a->costume); akos = getResourceAddress(rtCostume, a->costume);
assert(akos); assert(akos);
if (akos_increaseAnims(akos, a)) { if (akos_increaseAnims(akos, a)) {
#else
loadCostume(&lc, a->costume);
if (cost_increaseAnims(&lc, a)) {
#endif
a->needRedraw = true; a->needRedraw = true;
a->needBgReset = true; a->needBgReset = true;
} }
} else {
loadCostume(&lc, a->costume);
if (cost_increaseAnims(&lc, a)) {
a->needRedraw = true;
a->needBgReset = true;
}
}
} }
} }

View file

@ -674,7 +674,7 @@ void CostumeRenderer::loadCostume(int id) {
if (_vm->_features&GF_AFTER_V6) { if (_vm->_features&GF_AFTER_V6) {
_ptr += 8; _ptr += 8;
} else if(!(_features&GF_SMALL_HEADER)) { } else if(!(_vm->_features&GF_SMALL_HEADER)) {
_ptr += 2; _ptr += 2;
} }
@ -711,7 +711,8 @@ void Scumm::initActorCostumeData(Actor *a) {
} }
byte CostumeRenderer::drawOneSlot(Actor *a, int slot) { byte CostumeRenderer::drawOneSlot(Actor *a, int slot) {
#if !defined(FULL_THROTTLE)
if(!(_vm->_features & GF_AFTER_V7)) {
int i; int i;
int code; int code;
CostumeData *cd = &a->cost; CostumeData *cd = &a->cost;
@ -729,7 +730,7 @@ byte CostumeRenderer::drawOneSlot(Actor *a, int slot) {
if ( !(_vm->_features & GF_OLD256) || code <0x79) if ( !(_vm->_features & GF_OLD256) || code <0x79)
return mainRoutine(a, slot, code); return mainRoutine(a, slot, code);
} }
#endif }
return 0; return 0;

40
gfx.cpp
View file

@ -116,12 +116,8 @@ void Scumm::drawDirtyScreenParts() {
if (_features & GF_OLD256) if (_features & GF_OLD256)
updateDirtyScreen(1); updateDirtyScreen(1);
#if defined(FULL_THROTTLE) if ((camera._last.x==camera._cur.x &&
if (camera._last.x==camera._cur.x && camera._last.y==camera._cur.y && (_features & GF_AFTER_V7)) || (camera._last.x == camera._cur.x)) {
camera._last.y==camera._cur.y) {
#else
if (camera._last.x == camera._cur.x) {
#endif
updateDirtyScreen(0); updateDirtyScreen(0);
} else { } else {
vs = &virtscr[0]; vs = &virtscr[0];
@ -228,9 +224,9 @@ void Scumm::setCursor(int cursor) {
warning("setCursor(%d)", cursor); warning("setCursor(%d)", cursor);
} }
#if defined(FULL_THROTTLE)
void Scumm::setCameraAt(int pos_x, int pos_y) { void Scumm::setCameraAt(int pos_x, int pos_y) {
if(_features & GF_AFTER_V7) {
CameraData *cd = &camera; CameraData *cd = &camera;
Point old; Point old;
@ -250,9 +246,7 @@ void Scumm::setCameraAt(int pos_x, int pos_y) {
_vars[VAR_CAMERA_POS_Y] = cd->_cur.y; _vars[VAR_CAMERA_POS_Y] = cd->_cur.y;
runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0); runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0);
} }
} } else {
#else
void Scumm::setCameraAt(int pos_x, int pos_y) {
int t; int t;
CameraData *cd = &camera; CameraData *cd = &camera;
@ -274,11 +268,11 @@ void Scumm::setCameraAt(int pos_x, int pos_y) {
if (cd->_cur.x != cd->_last.x && charset._hasMask) if (cd->_cur.x != cd->_last.x && charset._hasMask)
stopTalk(); stopTalk();
}
} }
#endif
#if defined(FULL_THROTTLE)
void Scumm::setCameraFollows(Actor *a) { void Scumm::setCameraFollows(Actor *a) {
if(_features & GF_AFTER_V7) {
CameraData *cd = &camera; CameraData *cd = &camera;
byte oldfollow = cd->_follows; byte oldfollow = cd->_follows;
int ax,ay; int ax,ay;
@ -301,10 +295,7 @@ void Scumm::setCameraFollows(Actor *a) {
if (a->number != oldfollow) if (a->number != oldfollow)
runHook(0); runHook(0);
} } else {
#else
void Scumm::setCameraFollows(Actor *a) {
int t,i; int t,i;
CameraData *cd = &camera; CameraData *cd = &camera;
@ -329,8 +320,8 @@ void Scumm::setCameraFollows(Actor *a) {
a->needRedraw = true; a->needRedraw = true;
} }
runHook(0); runHook(0);
}
} }
#endif
void Scumm::initBGBuffers() { void Scumm::initBGBuffers() {
byte *ptr; byte *ptr;
@ -518,9 +509,8 @@ void Scumm::unkVirtScreen4(int a) {
VirtScreen *vs; VirtScreen *vs;
setDirtyRange(0, 0, 0); setDirtyRange(0, 0, 0);
#if !defined(FULL_THROTTLE) if(!(_features & GF_AFTER_V7))
camera._last.x = camera._cur.x; camera._last.x = camera._cur.x;
#endif
if (!_screenEffectFlag) if (!_screenEffectFlag)
return; return;
_screenEffectFlag = false; _screenEffectFlag = false;
@ -1650,8 +1640,6 @@ void Gdi::clearUpperMask() {
); );
} }
#if defined(FULL_THROTTLE)
void Scumm::clampCameraPos(Point *pt) { void Scumm::clampCameraPos(Point *pt) {
if (pt->x < _vars[VAR_CAMERA_MIN_X]) if (pt->x < _vars[VAR_CAMERA_MIN_X])
pt->x = _vars[VAR_CAMERA_MIN_X]; pt->x = _vars[VAR_CAMERA_MIN_X];
@ -1668,6 +1656,7 @@ void Scumm::clampCameraPos(Point *pt) {
void Scumm::moveCamera() { void Scumm::moveCamera() {
if(_features & GF_AFTER_V7) {
CameraData *cd = &camera; CameraData *cd = &camera;
Point old = cd->_cur; Point old = cd->_cur;
Actor *a; Actor *a;
@ -1749,10 +1738,7 @@ void Scumm::moveCamera() {
_vars[VAR_CAMERA_POS_Y] = cd->_cur.y; _vars[VAR_CAMERA_POS_Y] = cd->_cur.y;
runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0); runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0);
} }
} } else {
#else
void Scumm::moveCamera() {
CameraData *cd = &camera; CameraData *cd = &camera;
int pos = cd->_cur.x; int pos = cd->_cur.x;
int actorx, t; int actorx, t;
@ -1826,8 +1812,8 @@ void Scumm::moveCamera() {
_vars[VAR_CAMERA_POS_X] = cd->_cur.x; _vars[VAR_CAMERA_POS_X] = cd->_cur.x;
runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0); runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0);
} }
}
} }
#endif
#if defined(FULL_THROTTLE) #if defined(FULL_THROTTLE)
void Scumm::cameraMoved() { void Scumm::cameraMoved() {

View file

@ -532,7 +532,7 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room) {
else else
od->obj_nr = READ_LE_UINT16(&(cdhd->v5.obj_id)); od->obj_nr = READ_LE_UINT16(&(cdhd->v5.obj_id));
#if !defined(FULL_THROTTLE) if(!(_features & GF_AFTER_V7)) {
if (_features & GF_AFTER_V6) { if (_features & GF_AFTER_V6) {
od->width = READ_LE_UINT16(&cdhd->v6.w); od->width = READ_LE_UINT16(&cdhd->v6.w);
od->height = READ_LE_UINT16(&cdhd->v6.h); od->height = READ_LE_UINT16(&cdhd->v6.h);
@ -560,18 +560,18 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room) {
od->walk_y = READ_LE_UINT16(&cdhd->v5.walk_y); od->walk_y = READ_LE_UINT16(&cdhd->v5.walk_y);
od->actordir = cdhd->v5.actordir; od->actordir = cdhd->v5.actordir;
} }
#else } else {
od->parent = cdhd->parent; od->parent = cdhd->v7.parent;
od->parentstate = cdhd->parentstate; od->parentstate = cdhd->v7.parentstate;
imhd = (ImageHeader*)findResourceData(MKID('IMHD'), room + od->offs_obim_to_room); imhd = (ImageHeader*)findResourceData(MKID('IMHD'), room + od->offs_obim_to_room);
od->x_pos = imhd->x_pos; od->x_pos = imhd->v7.x_pos;
od->y_pos = imhd->y_pos; od->y_pos = imhd->v7.y_pos;
od->width = imhd->width; od->width = imhd->v7.width;
od->height = imhd->height; od->height = imhd->v7.height;
od->actordir = imhd->actordir; od->actordir = imhd->v7.actordir;
#endif }
od->fl_object_index = 0; od->fl_object_index = 0;
} }
@ -1049,8 +1049,8 @@ void Scumm::setCursorImg(uint img, uint room, uint imgindex) {
w = READ_LE_UINT16(&foir.cdhd->v6.w)>>3; w = READ_LE_UINT16(&foir.cdhd->v6.w)>>3;
h = READ_LE_UINT16(&foir.cdhd->v6.h)>>3; h = READ_LE_UINT16(&foir.cdhd->v6.h)>>3;
#else #else
w = READ_LE_UINT16(&foir.imhd->width)>>3; w = READ_LE_UINT16(&foir.imhd->v7.width)>>3;
h = READ_LE_UINT16(&foir.imhd->height)>>3; h = READ_LE_UINT16(&foir.imhd->v7.height)>>3;
#endif #endif
dataptr = findResource(IMxx_tags[imgindex],foir.obim); dataptr = findResource(IMxx_tags[imgindex],foir.obim);

View file

@ -564,10 +564,9 @@ void Scumm::ensureResourceLoaded(int type, int i) {
loadResource(type, i); loadResource(type, i);
#if !defined(FULL_THROTTLE) if(!(_features & GF_AFTER_V7))
if (type==rtRoom && i==_roomResource) if (type==rtRoom && i==_roomResource)
_vars[VAR_ROOM_FLAG] = 1; _vars[VAR_ROOM_FLAG] = 1;
#endif
} }
int Scumm::loadResource(int type, int index) { int Scumm::loadResource(int type, int index) {