[Scummvm-cvs-logs] CVS: scummvm debug.cpp,1.12,1.13 scumm.h,1.49,1.50 sdl.cpp,1.32,1.33 windows.cpp,1.26,1.27
James Brown
ender at users.sourceforge.net
Tue Feb 19 10:05:23 CET 2002
- Previous message: [Scummvm-cvs-logs] CVS: scummvm script_v1.cpp,1.33,1.34 scumm.h,1.48,1.49 sdl.cpp,1.31,1.32 windows.cpp,1.25,1.26
- Next message: [Scummvm-cvs-logs] CVS: scummvm gfx.cpp,1.33,1.34
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv18544
Modified Files:
debug.cpp scumm.h sdl.cpp windows.cpp
Log Message:
Some temporary changes. New debug command 'b' draws walkboxes on the screen.
For indy3_256/zak256, change the #if 1 in scumm.h - it makes the walkboxes
draw correctly, although the actors still don't navigate right.
Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/debug.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** debug.cpp 27 Dec 2001 17:51:58 -0000 1.12
--- debug.cpp 19 Feb 2002 18:04:21 -0000 1.13
***************
*** 24,27 ****
--- 24,29 ----
+
+
#include "stdafx.h"
#include "scumm.h"
***************
*** 39,42 ****
--- 41,45 ----
CMD_SCRIPTS,
CMD_LOAD_ROOM,
+ CMD_DUMPBOX,
CMD_EXIT
};
***************
*** 56,59 ****
--- 59,63 ----
}
+ void BoxTest(int num);
bool ScummDebugger::do_command() {
int cmd;
***************
*** 69,72 ****
--- 73,77 ----
"(r)oom roomnum -> load room\n"
"(s)cripts -> show running scripts\n"
+ "(b)oxes -> list and draw boxen\n"
"(e)xit -> exit game\n"
);
***************
*** 102,106 ****
}
return true;
!
case CMD_EXIT:
exit(1);
--- 107,123 ----
}
return true;
! case CMD_DUMPBOX:
! {
! int num, i; BoxCoords box;
! num = _s->getNumBoxes();
! for (i=0; i<num; i++) {
! BoxTest(i);
! _s->getBoxCoordinates(i, &box);
! printf("%d: [%d x %d] [%d x %d] [%d x %d] [%d x %d]\n", i,
! box.ul.x, box.ul.y, box.ll.x, box.ll.y,
! box.ur.x, box.ur.y, box.lr.x, box.lr.y);
! }
! }
! return true;
case CMD_EXIT:
exit(1);
***************
*** 145,148 ****
--- 162,166 ----
{ "s", 1, CMD_SCRIPTS },
{ "r", 1, CMD_LOAD_ROOM },
+ { "b", 1, CMD_DUMPBOX},
{ "e", 1, CMD_EXIT },
{ 0, 0, 0 },
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** scumm.h 19 Feb 2002 03:11:46 -0000 1.49
--- scumm.h 19 Feb 2002 18:04:21 -0000 1.50
***************
*** 64,69 ****
--- 64,74 ----
int16 ulx,uly;
int16 urx,ury;
+ #if 1 // Ender - set to 0 for indy3/zak256
int16 llx,lly;
int16 lrx,lry;
+ #else
+ int16 lrx,lry;
+ int16 llx,lly;
+ #endif
byte mask;
byte flags;
Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** sdl.cpp 19 Feb 2002 03:11:46 -0000 1.32
--- sdl.cpp 19 Feb 2002 18:04:21 -0000 1.33
***************
*** 580,581 ****
--- 580,788 ----
}
+ /************ ENDER: Temporary debug code for boxen **************/
+ int hlineColor (SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color) {
+ Sint16 left,right,top,bottom;
+ Uint8 *pixel,*pixellast;
+ int dx;
+ int pixx, pixy;
+ Sint16 w;
+ Sint16 xtmp;
+ int result=-1;
+ Uint8 *colorptr;
+
+ /* Get clipping boundary */
+ left = dst->clip_rect.x;
+ right = dst->clip_rect.x+dst->clip_rect.w-1;
+ top = dst->clip_rect.y;
+ bottom = dst->clip_rect.y+dst->clip_rect.h-1;
+
+ /* Swap x1, x2 if required */
+ if (x1>x2) {
+ xtmp=x1; x1=x2; x2=xtmp;
+ }
+
+ /* Visible */
+ if ((x1>right) || (x2<left) || (y<top) || (y>bottom)) {
+ return(0);
+ }
+
+ /* Clip x */
+ if (x1<left) {
+ x1=left;
+ }
+ if (x2>right) {
+ x2=right;
+ }
+
+ /* Calculate width */
+ w=x2-x1;
+
+ /* Sanity check on width */
+ if (w<0) {
+ return(0);
+ }
+
+ /* Setup color */
+ colorptr=(Uint8 *)&color;
+ if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
+ color=SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
+ } else {
+ color=SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
+ }
+
+ /* Lock surface */
+ SDL_LockSurface(dst);
+
+ /* More variable setup */
+ dx=w;
+ pixx = dst->format->BytesPerPixel;
+ pixy = dst->pitch;
+ pixel = ((Uint8*)dst->pixels) + pixx * (int)x1 + pixy * (int)y;
+
+ /* Draw */
+ switch(dst->format->BytesPerPixel) {
+ case 1:
+ memset (pixel, color, dx);
+ break;
+ case 2:
+ pixellast = pixel + dx + dx;
+ for (; pixel<=pixellast; pixel += pixx) {
+ *(Uint16*)pixel = color;
+ }
+ break;
+ case 3:
+ pixellast = pixel + dx + dx + dx;
+ for (; pixel<=pixellast; pixel += pixx) {
+ if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
+ pixel[0] = (color >> 16) & 0xff;
+ pixel[1] = (color >> 8) & 0xff;
+ pixel[2] = color & 0xff;
+ } else {
+ pixel[0] = color & 0xff;
+ pixel[1] = (color >> 8) & 0xff;
+ pixel[2] = (color >> 16) & 0xff;
+ }
+ }
+ break;
+ default: /* case 4*/
+ dx = dx + dx;
+ pixellast = pixel + dx + dx;
+ for (; pixel<=pixellast; pixel += pixx) {
+ *(Uint32*)pixel = color;
+ }
+ break;
+ }
+
+ /* Unlock surface */
+ SDL_UnlockSurface(dst);
+
+ /* Set result code */
+ result=0;
+
+ return(result);
+ }
+
+ int gfxPrimitivesCompareInt(const void *a, const void *b);
+
+ static int *gfxPrimitivesPolyInts=NULL;
+ static int gfxPrimitivesPolyAllocated=0;
+
+ int filledPolygonColor (SDL_Surface *dst, Sint16 *vx, Sint16 *vy, int n, int color)
+ {
+ int result;
+ int i;
+ int y;
+ int miny, maxy;
+ int x1, y1;
+ int x2, y2;
+ int ind1, ind2;
+ int ints;
+
+ /* Sanity check */
+ if (n<3) {
+ return -1;
+ }
+
+ /* Allocate temp array, only grow array */
+ if (!gfxPrimitivesPolyAllocated) {
+ gfxPrimitivesPolyInts = (int *) malloc(sizeof(int) * n);
+ gfxPrimitivesPolyAllocated = n;
+ } else {
+ if (gfxPrimitivesPolyAllocated<n) {
+ gfxPrimitivesPolyInts = (int *) realloc(gfxPrimitivesPolyInts, sizeof(int) * n);
+ gfxPrimitivesPolyAllocated = n;
+ }
+ }
+
+ /* Determine Y maxima */
+ miny = vy[0];
+ maxy = vy[0];
+ for (i=1; (i < n); i++) {
+ if (vy[i] < miny) {
+ miny = vy[i];
+ } else if (vy[i] > maxy) {
+ maxy = vy[i];
+ }
+ }
+
+ /* Draw, scanning y */
+ result=0;
+ for (y=miny; (y <= maxy); y++) {
+ ints = 0;
+ for (i=0; (i < n); i++) {
+ if (!i) {
+ ind1 = n-1;
+ ind2 = 0;
+ } else {
+ ind1 = i-1;
+ ind2 = i;
+ }
+ y1 = vy[ind1];
+ y2 = vy[ind2];
+ if (y1 < y2) {
+ x1 = vx[ind1];
+ x2 = vx[ind2];
+ } else if (y1 > y2) {
+ y2 = vy[ind1];
+ y1 = vy[ind2];
+ x2 = vx[ind1];
+ x1 = vx[ind2];
+ } else {
+ continue;
+ }
+ if ((y >= y1) && (y < y2)) {
+ gfxPrimitivesPolyInts[ints++] = (y-y1) * (x2-x1) / (y2-y1) + x1;
+ } else if ((y == maxy) && (y > y1) && (y <= y2)) {
+ gfxPrimitivesPolyInts[ints++] = (y-y1) * (x2-x1) / (y2-y1) + x1;
+ }
+ }
+ qsort(gfxPrimitivesPolyInts, ints, sizeof(int), gfxPrimitivesCompareInt);
+
+ for (i=0; (i<ints); i+=2) {
+ result |= hlineColor(dst, gfxPrimitivesPolyInts[i], gfxPrimitivesPolyInts[i+1], y, color);
+ }
+ }
+
+ return (result);
+ }
+
+ int gfxPrimitivesCompareInt(const void *a, const void *b)
+ {
+ return (*(const int *)a) - (*(const int *)b);
+ }
+
+ void BoxTest(int num) {
+ BoxCoords box;
+ Sint16 rx1[4], ry1[4];
+
+ scumm.getBoxCoordinates(num, &box);
+ rx1[0] = box.ul.x*2; ry1[0] = box.ul.y*2;
+ rx1[1] = box.ur.x*2; ry1[1] = box.ur.y*2;
+ rx1[2] = box.lr.x*2; ry1[2] = box.lr.y*2;
+ rx1[3] = box.ll.x*2; ry1[3] = box.ll.y*2;
+
+ filledPolygonColor(screen, &rx1[0], &ry1[0], 4, 255);
+ SDL_UpdateRect(screen, 0,0,0,0);
+
+ }
+
Index: windows.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/windows.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** windows.cpp 19 Feb 2002 03:11:46 -0000 1.26
--- windows.cpp 19 Feb 2002 18:04:21 -0000 1.27
***************
*** 566,567 ****
--- 566,568 ----
}
+ void BoxTest(int num) {;} // Test code
- Previous message: [Scummvm-cvs-logs] CVS: scummvm script_v1.cpp,1.33,1.34 scumm.h,1.48,1.49 sdl.cpp,1.31,1.32 windows.cpp,1.25,1.26
- Next message: [Scummvm-cvs-logs] CVS: scummvm gfx.cpp,1.33,1.34
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list