0002-misc-fixes.patch 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. diff -Nrup rubix-1.0.5/fillpoly.c rubix-1.0.5-avr32/fillpoly.c
  2. --- rubix-1.0.5/fillpoly.c 2003-10-12 15:41:43.000000000 -0400
  3. +++ rubix-1.0.5-avr32/fillpoly.c 2008-02-29 12:39:51.000000000 -0500
  4. @@ -435,7 +435,7 @@ void fill_lines(device *d, int thecol)
  5. );
  6. #endif
  7. }
  8. - } else if (d->depth==16) { /* here 16bpp */
  9. + } else if ((d->depth==16) | (d->depth==15)) { /* here 16bpp */
  10. register int i;
  11. #ifndef PC_ARCHI
  12. register int j;
  13. diff -Nrup rubix-1.0.5/line.c rubix-1.0.5-avr32/line.c
  14. --- rubix-1.0.5/line.c 2003-10-12 14:15:19.000000000 -0400
  15. +++ rubix-1.0.5-avr32/line.c 2008-02-29 12:39:51.000000000 -0500
  16. @@ -1317,7 +1317,7 @@ void drawline(device *d, line *l)
  17. #endif
  18. if (d->depth==8)
  19. drawline8(d, l);
  20. - else if (d->depth==16)
  21. + else if ((d->depth==16) | (d->depth==15))
  22. drawline16(d, l);
  23. else if (d->depth==24)
  24. drawline24(d, l);
  25. diff -Nrup rubix-1.0.5/Makefile rubix-1.0.5-avr32/Makefile
  26. --- rubix-1.0.5/Makefile 2003-12-04 14:27:58.000000000 -0500
  27. +++ rubix-1.0.5-avr32/Makefile 2008-02-29 12:58:30.000000000 -0500
  28. @@ -11,21 +11,17 @@
  29. # Customize to fit your needs (especially if it does not work for now).
  30. LANGUAGE=ENGLISH
  31. -GAMESDIR=/usr/games
  32. #architecture=-DPC_ARCHI
  33. # For Solaris
  34. #EXTRALIBS=-lsocket
  35. -CC=gcc
  36. CFLAGS=-Wall -O3 -fomit-frame-pointer -ffast-math \
  37. -DGAMESDIR="\"$(GAMESDIR)\"" \
  38. -D$(LANGUAGE) $(architecture)
  39. #CFLAGS=-Wall -g -ffast-math -Iplayer $(architecture)
  40. -XINC=-I/usr/X11R6/include
  41. -XLIB=-L/usr/X11R6/lib -lX11
  42. #the following should not be changed.
  43. @@ -37,7 +33,7 @@ rubix : $(OBJ)
  44. install :
  45. mkdir -p $(GAMESDIR)
  46. - install -c -s rubix $(GAMESDIR)
  47. + install -c rubix $(GAMESDIR)
  48. clean :
  49. rm -f *.o *~ core *.bak *.dat gmon.out
  50. diff -Nrup rubix-1.0.5/screen.c rubix-1.0.5-avr32/screen.c
  51. --- rubix-1.0.5/screen.c 2004-04-26 04:26:05.000000000 -0400
  52. +++ rubix-1.0.5-avr32/screen.c 2008-02-29 12:39:51.000000000 -0500
  53. @@ -80,11 +80,17 @@ void error_statement(SCREEN *s)
  54. int reset_data_buffers(SCREEN *s)
  55. {
  56. + int temp;
  57. if (s->im)
  58. XDestroyImage(s->im);
  59. + if (s->depth == 15) {
  60. + temp=16;
  61. + } else {
  62. + temp=s->depth;
  63. + }
  64. - s->buffer=(char *)malloc(((SCREEN_X+7)/8)*SCREEN_Y*s->depth);
  65. + s->buffer=(char *)malloc(((SCREEN_X+7)/8)*SCREEN_Y*temp);
  66. if (!s->buffer) {
  67. error_statement(s);
  68. @@ -106,7 +112,7 @@ int reset_data_buffers(SCREEN *s)
  69. */
  70. /* Sed - december 2003 - no it has to be 8 */
  71. s->im=XCreateImage(s->d, DefaultVisual(s->d, DefaultScreen(s->d)),
  72. - s->depth==32?24:s->depth, ZPixmap,
  73. + s->depth, ZPixmap,
  74. 0, s->buffer, SCREEN_X, SCREEN_Y, 8, 0);
  75. if (!s->im) {
  76. @@ -139,8 +145,8 @@ int init_screen(SCREEN *s)
  77. s->depth=DefaultDepth(s->d, DefaultScreen(s->d));
  78. - if (s->depth!=8 && s->depth!=16 && s->depth!=24) {
  79. - fprintf(stderr, "screen depth not supported (only 8, 16 and 24bpp (which means 32bpp too) handled\n");
  80. + if (s->depth!=8 && s->depth!=15 && s->depth!=16 && s->depth!=24) {
  81. + fprintf(stderr, "screen depth not supported (only 8, 15, 16 and 24bpp (which means 32bpp too) handled\n");
  82. XCloseDisplay(s->d);
  83. s->d=(Display *)0;
  84. return -1;
  85. @@ -182,10 +188,10 @@ int init_screen(SCREEN *s)
  86. /* let's create and map our window */
  87. s->w=XCreateWindow(s->d, DefaultRootWindow(s->d), 0, 0,
  88. - SCREEN_X, SCREEN_Y, 3, s->depth==32?24:s->depth,
  89. + SCREEN_X, SCREEN_Y, 3, s->depth,
  90. CopyFromParent, CopyFromParent, 0, NULL);
  91. s->h=XCreateWindow(s->d, DefaultRootWindow(s->d), 0, 0,
  92. - HELP_X, HELP_Y, 3, s->depth==32?24:s->depth,
  93. + HELP_X, HELP_Y, 3, s->depth,
  94. CopyFromParent, CopyFromParent, 0, NULL);
  95. xch.res_name = "rubix";
  96. @@ -946,13 +952,18 @@ void close_screen(SCREEN *s)
  97. void clear_screen(SCREEN *s)
  98. {
  99. /* fill s->im with pixel[10], avoid XPutPixel which is rather slow... */
  100. - int i, w, dw;
  101. + int i, w, dw, temp;
  102. + if (s->depth == 15) {
  103. + temp = 16;
  104. + } else {
  105. + temp = s->depth;
  106. + }
  107. w = (SCREEN_X+7)/8;
  108. - dw = s->depth/8;
  109. + dw = temp/8;
  110. XPutPixel(s->im, 0, 0, pixel[10]);
  111. for (i=1; i<8*w; i++)
  112. memcpy(s->buffer + i*dw, s->buffer, dw);
  113. - w = w * s->depth;
  114. + w = w * temp;
  115. for (i=1; i<SCREEN_Y; i++)
  116. memcpy(s->buffer + i*w, s->buffer, w);
  117. }