summaryrefslogtreecommitdiff
path: root/games/xjig
diff options
context:
space:
mode:
authorVanilla I. Shu <vanilla@FreeBSD.org>1998-04-11 18:34:45 +0000
committerVanilla I. Shu <vanilla@FreeBSD.org>1998-04-11 18:34:45 +0000
commit2029f470e86f7048f52971deaad73f2bdb2c352c (patch)
tree2429b93a9de6a2000414a5e07572c148fdc85979 /games/xjig
parentUpgrade to 1.2. (diff)
Add some patches for 24bpp
PR: ports/6245 Submitted by: Jonathan Hanna <jh@pc-21490.bc.rogers.wave.ca>
Notes
Notes: svn path=/head/; revision=10481
Diffstat (limited to 'games/xjig')
-rw-r--r--games/xjig/files/patch-ab72
-rw-r--r--games/xjig/files/patch-ac10
-rw-r--r--games/xjig/files/patch-ad10
-rw-r--r--games/xjig/files/patch-ae60
-rw-r--r--games/xjig/files/patch-af10
-rw-r--r--games/xjig/files/patch-ag72
-rw-r--r--games/xjig/files/patch-ah72
-rw-r--r--games/xjig/files/patch-ai89
8 files changed, 395 insertions, 0 deletions
diff --git a/games/xjig/files/patch-ab b/games/xjig/files/patch-ab
new file mode 100644
index 000000000000..51a2ca4aaf07
--- /dev/null
+++ b/games/xjig/files/patch-ab
@@ -0,0 +1,72 @@
+--- gifx_image.C.orig Wed Jul 24 00:12:55 1996
++++ gifx_image.C Tue Apr 7 15:34:33 1998
+@@ -62,12 +62,16 @@
+ offset_rows=0;
+ #endif
+ DropData();
+- switch(texture_mode) {
+- case 1: Reset8(); break;
+- case 2: Reset16(); break;
+- case 3: Reset32(); break;
+- default: fprintf( stderr, "depth not supported\n" );
+- exit(0);
++
++ extern int pixmap_depth;
++
++ switch(pixmap_depth) {
++ case 8: Reset8(); break;
++ case 16: Reset16(); break;
++ case 24: Reset24(); break;
++ case 32: Reset32(); break;
++ default: fprintf( stderr, "depth not supported\n" );
++ exit(0);
+ }
+ }
+
+@@ -90,29 +94,40 @@
+ }
+
+ /*----------------------------------------------------------------------------*/
++
++#define CARD24 long
++
++#define DATA_TYPE CARD24
++#define DATA_BYTES 3
++void GifXImage::Reset24() {
++# include "reset_image.H"
++}
++#undef DATA_TYPE
++#undef DATA_BYTES
++/*----------------------------------------------------------------------------*/
+ #define DATA_TYPE CARD32
+-#define DATA_PAD 4
++#define DATA_BYTES 4
+ void GifXImage::Reset32() {
+ # include "reset_image.H"
+ }
+ #undef DATA_TYPE
+-#undef DATA_PAD
++#undef DATA_BYTES
+ /*----------------------------------------------------------------------------*/
+ #define DATA_TYPE CARD16
+-#define DATA_PAD 2
++#define DATA_BYTES 2
+ void GifXImage::Reset16() {
+ # include "reset_image.H"
+ }
+ #undef DATA_TYPE
+-#undef DATA_PAD
++#undef DATA_BYTES
+ /*----------------------------------------------------------------------------*/
+ #define DATA_TYPE CARD8
+-#define DATA_PAD 1
++#define DATA_BYTES 1
+ void GifXImage::Reset8() {
+ # include "reset_image.H"
+ }
+ #undef DATA_TYPE
+-#undef DATA_PAD
++#undef DATA_BYTES
+
+ // ========================================================================
+
diff --git a/games/xjig/files/patch-ac b/games/xjig/files/patch-ac
new file mode 100644
index 000000000000..20a647ebd855
--- /dev/null
+++ b/games/xjig/files/patch-ac
@@ -0,0 +1,10 @@
+--- gifx_image.H.orig Mon Jul 15 12:59:11 1996
++++ gifx_image.H Tue Apr 7 15:34:33 1998
+@@ -29,6 +29,7 @@
+ void Reset8();
+ void Reset16();
+ void Reset32();
++ void Reset24();
+
+ Display *dpy;
+ int scr;
diff --git a/games/xjig/files/patch-ad b/games/xjig/files/patch-ad
new file mode 100644
index 000000000000..1d57e96b98cf
--- /dev/null
+++ b/games/xjig/files/patch-ad
@@ -0,0 +1,10 @@
+--- imgbuff.C.orig Wed Jul 17 00:23:26 1996
++++ imgbuff.C Tue Apr 7 15:34:33 1998
+@@ -72,6 +72,7 @@
+
+
+ XImage *ImageBuffer::Init(int w,int h,int bpp8) {
++
+ // w+=10; h+=10;
+ if (w>width||h>height) {
+ FreeData();
diff --git a/games/xjig/files/patch-ae b/games/xjig/files/patch-ae
new file mode 100644
index 000000000000..c05d5e3e760f
--- /dev/null
+++ b/games/xjig/files/patch-ae
@@ -0,0 +1,60 @@
+--- objects.C.orig Wed Jul 24 15:06:28 1996
++++ objects.C Tue Apr 7 15:34:33 1998
+@@ -533,28 +533,30 @@
+ }
+
+ #define DATA_TYPE CARD32
+-#define DATA_PAD 4
+ void PixmapPiece::CreateTilemap32() {
+ # include "rotate.H"
+ }
+ #undef DATA_TYPE
+-#undef DATA_PAD
++
++#define CARD24 long
++
++#define DATA_TYPE CARD24
++void PixmapPiece::CreateTilemap24() {
++# include "rotate.H"
++}
++#undef DATA_TYPE
+
+ #define DATA_TYPE CARD16
+-#define DATA_PAD 2
+ void PixmapPiece::CreateTilemap16() {
+ # include "rotate.H"
+ }
+ #undef DATA_TYPE
+-#undef DATA_PAD
+
+ #define DATA_TYPE CARD8
+-#define DATA_PAD 1
+ void PixmapPiece::CreateTilemap8() {
+ # include "rotate.H"
+ }
+ #undef DATA_TYPE
+-#undef DATA_PAD
+
+
+ void PixmapPiece::DirectionChanged() {
+@@ -573,10 +575,16 @@
+ XPix(wcenter.X())-offx, YPix(wcenter.Y())-offy, width, height, 0, 0 );
+ }
+ else {
+- switch(texture_mode) {
+- case 1: CreateTilemap8(); break;
+- case 2: CreateTilemap16(); break;
+- case 3: CreateTilemap32(); break;
++ extern int pixmap_depth;
++
++ switch(pixmap_depth) {
++ case 8: CreateTilemap8(); break;
++ case 16: CreateTilemap16(); break;
++ case 32: CreateTilemap32(); break;
++ case 24: CreateTilemap24(); break;
++ default:
++ fprintf(stderr,"unhandled depth = %d\n",pixmap_depth);
++ exit(1);
+ }
+ }
+ }
diff --git a/games/xjig/files/patch-af b/games/xjig/files/patch-af
new file mode 100644
index 000000000000..8be81a32b18c
--- /dev/null
+++ b/games/xjig/files/patch-af
@@ -0,0 +1,10 @@
+--- objects.H.orig Wed Jul 24 15:08:44 1996
++++ objects.H Tue Apr 7 15:34:33 1998
+@@ -241,6 +241,7 @@
+ protected:
+ void CreateTilemap8();
+ void CreateTilemap16();
++ void CreateTilemap24();
+ void CreateTilemap32();
+
+ Pixmap tilemap;
diff --git a/games/xjig/files/patch-ag b/games/xjig/files/patch-ag
new file mode 100644
index 000000000000..76abd0c6a2d2
--- /dev/null
+++ b/games/xjig/files/patch-ag
@@ -0,0 +1,72 @@
+--- reset_image.H.orig Tue Jul 16 10:59:50 1996
++++ reset_image.H Tue Apr 7 15:34:33 1998
+@@ -16,15 +16,24 @@
+ // to access data beyond the allocated image, that might lead to a segmentation
+ // violation. Therefore, it might be good to allocated some additional
+ // rows of data for the image.
+- offset_bytes=xwidth*offset_rows*sizeof(DATA_TYPE);
+- xdata=new DATA_TYPE[xwidth*(xheight+2*offset_rows)];
++
++ extern int scanline_pad;
++
++ int byte_pad = scanline_pad / 8;
++
++ offset_bytes=xwidth*offset_rows*DATA_BYTES;
++ // xdata=new DATA_TYPE[xwidth*(xheight+2*offset_rows)];
++
++ xdata=(DATA_TYPE*)new char[DATA_BYTES*xwidth*(xheight+2*offset_rows)];
+ { DATA_TYPE *xdata_run=xdata;
+ unsigned long blk_pixel=BlackPixel(dpy,scr);
+ for (int i=xwidth*(xheight+2*offset_rows);i>0;i--) {
+- *xdata_run++=(DATA_TYPE)blk_pixel;
++ // *xdata_run++=(DATA_TYPE)blk_pixel;
++ *xdata_run=(DATA_TYPE)blk_pixel; // align fault
++ ((char *)xdata_run) += DATA_BYTES;
+ }
+ }
+- xdata+=(offset_bytes/sizeof(DATA_TYPE));
++ xdata+=(offset_bytes/DATA_BYTES);
+
+ if (!xdata) {
+ fprintf(stderr,"not enough memory for XImage-data");
+@@ -32,9 +41,11 @@
+ }
+
+ // create the XImage
++
+ ximage = XCreateImage(dpy, DefaultVisual(dpy,scr),
+- DefaultDepth(dpy,scr), ZPixmap, 0,
+- (char*)xdata, xwidth, xheight, 8*DATA_PAD, xwidth*sizeof(DATA_TYPE));
++ DefaultDepth(dpy,scr), ZPixmap, 0,
++ (char*)xdata, xwidth, xheight, scanline_pad,
++ ((xwidth*DATA_BYTES + byte_pad - 1)/byte_pad) * byte_pad);
+
+ if (!ximage) {
+ fprintf(stderr,"\n*** can't allocate ximage.\n" );
+@@ -47,9 +58,23 @@
+ register const byte *org = Data();
+ register int j,i;
+
+- for (i=0; i<Height(); i++) {
+- for (j=0; j<Width(); j++)
+- *copy++ = (DATA_TYPE)gif_cols[*org++];
++ extern int pixmap_depth;
++
++ switch(pixmap_depth) {
++ case 8: // power of two covered by basic data type
++ case 16:
++ case 32:
++ for (i=0; i<Height(); i++) {
++ for (j=0; j<Width(); j++)
++ *copy++ = (DATA_TYPE)gif_cols[*org++];
++ }
++ break;
++ case 24:
++ for (i=0; i<Height(); i++) {
++ for (j=0; j<Width(); j++)
++ XPutPixel(ximage,j,i,gif_cols[*org++]);
++ }
++ break;
+ }
+ }
+ else {
diff --git a/games/xjig/files/patch-ah b/games/xjig/files/patch-ah
new file mode 100644
index 000000000000..eda795d07916
--- /dev/null
+++ b/games/xjig/files/patch-ah
@@ -0,0 +1,72 @@
+--- rotate.H.orig Wed Jul 24 15:15:11 1996
++++ rotate.H Tue Apr 7 15:34:34 1998
+@@ -6,7 +6,6 @@
+ // while compiling that function:
+ //
+ // #define DATA_TYPE unsigned char
+-// #define DATA_PAD 1
+
+ #define IMAX 1000
+
+@@ -21,7 +20,9 @@
+ }
+ else wcenter=center;
+
+- ximage = img_buf->Init(width,height,DATA_PAD);
++ extern int scanline_pad;
++
++ ximage = img_buf->Init(width,height,scanline_pad/8);
+
+ if (!itm) {
+ if (page) {
+@@ -40,7 +41,10 @@
+ edge=wcenter+(*itm)*Vec2(-offx,-offy);
+ }
+
+-#if (0)
++extern int pixmap_depth;
++
++switch(pixmap_depth) {
++case 24:
+
+ //
+ // the traditional routine to copy each pixel from one image to the other
+@@ -52,6 +56,15 @@
+
+ for (int y=0;y<height;y++) {
+ Vec2 pt=edge+y*diry;
++ for (int x=0;x<width;x++) {
++ XPutPixel(ximage,x,y,pm->GetPixel( XPix(pt.X()), YPix(pt.Y()) ));
++ pt+=dirx;
++ }
++ }
++
++#if 0
++ for (int y=0;y<height;y++) {
++ Vec2 pt=edge+y*diry;
+ /* x,y, dx,dy bestimmen ... */
+ register DATA_TYPE *dest = (DATA_TYPE*)(ximage->data + y * ximage->bytes_per_line);
+ for (int x=0;x<width;x++) {
+@@ -59,8 +72,12 @@
+ pt+=dirx;
+ }
+ }
++#endif
+
+-#else
++break;
++case 8:
++case 16:
++case 32:
+
+ //
+ // optimized mapping
+@@ -209,7 +226,7 @@
+ }
+ }
+ }
+-#endif
++}
+
+ img_buf->PutImage(dpy,tilemap,DefaultGC(dpy,scr),0,0,0,0,width,height);
+
diff --git a/games/xjig/files/patch-ai b/games/xjig/files/patch-ai
new file mode 100644
index 000000000000..af0baff96abb
--- /dev/null
+++ b/games/xjig/files/patch-ai
@@ -0,0 +1,89 @@
+--- xjig.C.orig Wed Jul 24 13:14:28 1996
++++ xjig.C Tue Apr 7 15:34:34 1998
+@@ -61,7 +61,8 @@
+ Window win;
+ GC gc;
+
+-int texture_mode=0; // mode for texture mapping depending on depth
++int pixmap_depth = 0;
++int scanline_pad = 0;
+
+ Cursor normal_cursor, move_cursor, pull_cursor, idle_cursor, no_cursor;
+
+@@ -324,7 +325,7 @@
+ printf( " -sa : shuffle angles\n" );
+ printf( " -sp : shuffle positions\n" );
+ printf( " -r : rotation demo\n" );
+- printf( " -8 -16 -32 : manually select optimized texture mapping routine\n" );
++ printf( " -8 -16 -24 -32 : manually select optimized texture mapping routine\n" );
+ printf( " -dist <n> : distortion percentage\n" );
+ printf( " -maxang <n>: maximum rotation angle at startup\n" );
+ printf( " -rand <n> : seed for random generator\n" );
+@@ -392,9 +393,10 @@
+ #ifdef PINUP_DEFAULT
+ else if (!strcmp(argv[i],"-pinup")) filename=PINUP_DEFAULT;
+ #endif
+- else if (!strcmp(argv[i],"-8")) texture_mode=1;
+- else if (!strcmp(argv[i],"-16")) texture_mode=2;
+- else if (!strcmp(argv[i],"-32")) texture_mode=3;
++ else if (!strcmp(argv[i],"-8")) pixmap_depth=8;
++ else if (!strcmp(argv[i],"-16")) pixmap_depth=16;
++ else if (!strcmp(argv[i],"-32")) pixmap_depth=32;
++ else if (!strcmp(argv[i],"-24")) pixmap_depth=24;
+ else if (!strcmp(argv[i],"-shm")) shared=1;
+ else if (!strcmp(argv[i],"-no_shm")) shared=0;
+ else if (!strcmp(argv[i],"-shapes")) shapes=1;
+@@ -465,30 +467,34 @@
+ printf( "xjig V2.4, by Helmut Hoenig, July-24-96\n" );
+ printf( "\n" );
+
+- if (!texture_mode) {
+- //
+- // check screen depth to select function for texture mappings
+- //
+- switch(DefaultDepth(dpy,scr)) {
+- case 8: texture_mode=1; break;
+- case 16: texture_mode=2; break;
+- case 24:
+- case 32: texture_mode=3; break;
++ XPixmapFormatValues *pmf;
++
++ int n;
++ pmf = XListPixmapFormats (dpy, &n);
++ if (pmf) {
++ for (int i = 0; i < n; i++) {
++ if (pixmap_depth) {
++ if (pixmap_depth == pmf[i].depth) {
++ scanline_pad = pmf[i].scanline_pad;
++ break;
++ }
++ } else if (pmf[i].depth == DefaultDepth(dpy,scr)) {
++ pixmap_depth = pmf[i].depth;
++ scanline_pad = pmf[i].scanline_pad;
++ break;
++ }
+ }
++ XFree ((char *) pmf);
+ }
+- if (!texture_mode) {
+- fprintf( stderr, "*** Unable to select texture mode for Depth %d\n", DefaultDepth(dpy,scr) );
+- fprintf( stderr, " You can manually select one by trying either -8, -16 or -32\n" );
+- fprintf( stderr, " Good Luck.\n" );
+- exit(0);
++
++
++ if (!scanline_pad) {
++ fprintf(stderr,"No matching depth mode found\n");
++ exit(1);
+ }
+
+ if (verbose) {
+- switch( texture_mode ) {
+- case 1: printf( "texture mode 1: 1 byte\n" ); break;
+- case 2: printf( "texture mode 2: 2 byte\n" ); break;
+- case 3: printf( "texture mode 3: 4 byte\n" ); break;
+- }
++ printf("depth: %d pad: %d\n",pixmap_depth,scanline_pad);
+ }
+
+ old_handler=XSetErrorHandler( error_handler );