[Scummvm-cvs-logs] CVS: scummvm gfx.h,1.5,1.6 object.cpp,1.61,1.62
Vincent Hamm
yazoo at users.sourceforge.net
Mon Apr 22 07:09:59 CEST 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv29263
Modified Files:
gfx.h object.cpp
Log Message:
Rewrote a part of the blast object management code for implementation of future features. That fixed the highway minigame in samnmax
Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** gfx.h 21 Apr 2002 21:20:32 -0000 1.5
--- gfx.h 22 Apr 2002 13:55:28 -0000 1.6
***************
*** 75,82 ****
struct BlastObject { /* BlastObjects to draw */
! uint16 a,b,c,d,e;
! int16 x,y;
uint16 width,height;
! uint16 j,k,l;
uint16 mode;
};
--- 75,82 ----
struct BlastObject { /* BlastObjects to draw */
! uint16 number,areaX,areaY,areaWidth,areaHeight;
! int16 posX,posY;
uint16 width,height;
! uint16 unk3,unk4,image;
uint16 mode;
};
Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/object.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** object.cpp 21 Apr 2002 21:20:32 -0000 1.61
--- object.cpp 22 Apr 2002 13:55:28 -0000 1.62
***************
*** 1162,1172 ****
eo = &_enqueuedObjects[_enqueuePos++];
! eo->a = objectNumber;
! eo->b = _enqueue_b;
! eo->c = _enqueue_c;
! eo->d = _enqueue_d;
! eo->e = _enqueue_e;
! eo->x = objectX;
! eo->y = objectY;
if (objectWidth == 0) {
od = &_objs[getObjectIndex(objectNumber)];
--- 1162,1172 ----
eo = &_enqueuedObjects[_enqueuePos++];
! eo->number = objectNumber;
! eo->areaX = _enqueue_b;
! eo->areaY = _enqueue_c;
! eo->areaWidth = _enqueue_d;
! eo->areaHeight = _enqueue_e;
! eo->posX = objectX;
! eo->posY = objectY;
if (objectWidth == 0) {
od = &_objs[getObjectIndex(objectNumber)];
***************
*** 1182,1188 ****
}
! eo->j = f;
! eo->k = g;
! eo->l = image;
eo->mode = mode;
}
--- 1182,1188 ----
}
! eo->unk3 = f;
! eo->unk4 = g;
! eo->image = image;
eo->mode = mode;
}
***************
*** 1204,1210 ****
VirtScreen *vs;
byte *roomptr, *bomp;
! byte *ptr;
int idx;
- ObjectData *od;
BompDrawData bdd;
--- 1204,1210 ----
VirtScreen *vs;
byte *roomptr, *bomp;
! byte *ptr;
! byte *img;
int idx;
BompDrawData bdd;
***************
*** 1213,1241 ****
_lastXstart = vs->xstart;
! if (eo->l == 0) {
! roomptr = getResourceAddress(1, _roomResource);
! idx = getObjectIndex(eo->a);
! assert(idx != -1);
! ptr = roomptr + _objs[idx].offs_obim_to_room;
! } else if (eo->a != 0) {
! od = &_objs[getObjectIndex(eo->a)];
! ptr = getResourceAddress(rtFlObject, od->fl_object_index);
! assert(ptr);
! ptr = findResource(MKID('OBIM'), ptr);
! } else {
! warning("drawEnqueuedObject: invalid");
! return;
! }
!
! if (eo->l == 0)
! eo->l = 1;
!
! assert(ptr);
! ptr = findResource(IMxx_tags[eo->l], ptr);
! if (!ptr) /* FIXME: Sam and Max highway subgame */
! return;
! bomp = findResourceData(MKID('BOMP'), ptr);
bdd.srcwidth = READ_LE_UINT16(&((BompHeader *)bomp)->width);
--- 1213,1245 ----
_lastXstart = vs->xstart;
+
+ checkRange(_numGlobalObjects - 1, 30, eo->number, "Illegal Blast object %d");
+
+ idx = _objs[getObjectIndex(eo->number)].fl_object_index;
+
+ if(idx)
+ {
+ ptr = getResourceAddress(rtFlObject, idx);
+ ptr = findResource(MKID('OBIM'), ptr);
+ } else {
+ idx = getObjectIndex(eo->number);
+ assert(idx != -1);
+ ptr = getResourceAddress(1, _roomResource) + _objs[idx].offs_obim_to_room;
+ }
+
+ if(!ptr)
+ error("BlastObject object %d image not found",eo->number);
! img = findResource(IMxx_tags[eo->image], ptr);
! if(!img)
! img = findResource(IMxx_tags[1], ptr); // Backward compatibility with samnmax blast objects
!
! if(!img)
! error("blast-object %d invalid image %d (1-x)",eo->number,eo->image);
! bomp = findResourceData(MKID('BOMP'), img);
!
! if(!bomp)
! error("object %d is not a blast object",eo->number);
bdd.srcwidth = READ_LE_UINT16(&((BompHeader *)bomp)->width);
***************
*** 1246,1258 ****
bdd.outheight = vs->height;
bdd.dataptr = bomp + 10;
! bdd.x = eo->x;
! bdd.y = eo->y;
! bdd.scale_x = (unsigned char)eo->j;
! bdd.scale_y = (unsigned char)eo->k;
updateDirtyRect(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y,
bdd.y + bdd.srcheight, 0);
! if (eo->a) {
drawBomp(&bdd);
}
--- 1250,1262 ----
bdd.outheight = vs->height;
bdd.dataptr = bomp + 10;
! bdd.x = eo->posX;
! bdd.y = eo->posY;
! bdd.scale_x = (unsigned char)eo->unk3;
! bdd.scale_y = (unsigned char)eo->unk4;
updateDirtyRect(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y,
bdd.y + bdd.srcheight, 0);
! if (eo->number) {
drawBomp(&bdd);
}
***************
*** 1274,1278 ****
void Scumm::removeBlastObject(BlastObject * eo)
{
! restoreBG(eo->x, eo->y, eo->x + eo->width, eo->y + eo->height);
}
--- 1278,1282 ----
void Scumm::removeBlastObject(BlastObject * eo)
{
! restoreBG(eo->posX, eo->posY, eo->posX + eo->width, eo->posY + eo->height);
}
More information about the Scummvm-git-logs
mailing list