* tools.c *
***********************************************************/
-#include <math.h>
#include <stdarg.h>
#ifdef __FreeBSD__
this could mean that we have to wait for the graphics to complete,
although we could go on doing calculations for the next frame */
- XSync(display,FALSE);
+ XSync(display, FALSE);
+ /*
#ifdef MSDOS
wait_for_vsync = TRUE;
#endif
+ */
if (redraw_mask & REDRAW_ALL)
{
if (setup.soft_scrolling)
{
- fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0);
- fy += (ScreenMovDir & (MV_UP|MV_DOWN) ? ScreenGfxPos : 0);
+ fx += (ScreenMovDir & (MV_LEFT | MV_RIGHT) ? ScreenGfxPos : 0);
+ fy += (ScreenMovDir & (MV_UP | MV_DOWN) ? ScreenGfxPos : 0);
}
- XCopyArea(display,buffer,window,gc,
- fx,fy, SXSIZE,SYSIZE,
- SX,SY);
+ if (setup.soft_scrolling ||
+ ABS(ScreenGfxPos) + ScrollStepSize == TILEX ||
+ ABS(ScreenGfxPos) == ScrollStepSize ||
+ redraw_tiles > REDRAWTILES_THRESHOLD)
+ XCopyArea(display, buffer, window, gc, fx, fy, SXSIZE, SYSIZE, SX, SY);
}
redraw_mask &= ~REDRAW_MAIN;
}
VX+VIDEO_CONTROL_XPOS,VY+VIDEO_CONTROL_YPOS);
}
}
+ if (redraw_mask & REDRAW_DOOR_3)
+ XCopyArea(display, backbuffer, window, gc,
+ EX, EY, EXSIZE, EYSIZE,
+ EX, EY);
redraw_mask &= ~REDRAW_DOORS;
}
SY + (graphic / GFX_PER_LINE) * TILEY,
TILEX, TILEY, x, y);
}
+ else if (graphic >= GFX_START_ROCKSMORE && graphic <= GFX_END_ROCKSMORE)
+ {
+ graphic -= GFX_START_ROCKSMORE;
+ XCopyArea(display, pix[PIX_MORE], d, gc,
+ (graphic % MORE_PER_LINE) * TILEX,
+ (graphic / MORE_PER_LINE) * TILEY,
+ TILEX, TILEY, x, y);
+ }
else if (graphic >= GFX_START_ROCKSHEROES && graphic <= GFX_END_ROCKSHEROES)
{
graphic -= GFX_START_ROCKSHEROES;
src_x = SX + (graphic % GFX_PER_LINE) * TILEX;
src_y = SY + (graphic / GFX_PER_LINE) * TILEY;
}
+ else if (graphic >= GFX_START_ROCKSMORE && graphic <= GFX_END_ROCKSMORE)
+ {
+ src_pixmap = pix[PIX_MORE];
+ drawing_gc = clip_gc[PIX_MORE];
+ graphic -= GFX_START_ROCKSMORE;
+ src_x = (graphic % MORE_PER_LINE) * TILEX;
+ src_y = (graphic / MORE_PER_LINE) * TILEY;
+ }
else if (graphic >= GFX_START_ROCKSHEROES && graphic <= GFX_END_ROCKSHEROES)
{
src_pixmap = pix[PIX_HEROES];
MINI_GFX_STARTY + (graphic / MINI_GFX_PER_LINE) * MINI_TILEY,
MINI_TILEX, MINI_TILEY, x, y);
}
+ else if (graphic >= GFX_START_ROCKSMORE && graphic <= GFX_END_ROCKSMORE)
+ {
+ graphic -= GFX_START_ROCKSMORE;
+ XCopyArea(display, pix[PIX_MORE], d, gc,
+ MINI_MORE_STARTX + (graphic % MINI_MORE_PER_LINE) * MINI_TILEX,
+ MINI_MORE_STARTY + (graphic / MINI_MORE_PER_LINE) * MINI_TILEY,
+ MINI_TILEX, MINI_TILEY, x, y);
+ }
else if (graphic >= GFX_START_ROCKSFONT && graphic <= GFX_END_ROCKSFONT)
{
graphic -= GFX_START_ROCKSFONT;
src_x = SX + (graphic % GFX_PER_LINE) * TILEX + cx;
src_y = SY + (graphic / GFX_PER_LINE) * TILEY + cy;
}
+ else if (graphic >= GFX_START_ROCKSMORE && graphic <= GFX_END_ROCKSMORE)
+ {
+ src_pixmap = pix[PIX_MORE];
+ drawing_gc = clip_gc[PIX_MORE];
+ graphic -= GFX_START_ROCKSMORE;
+ src_x = (graphic % MORE_PER_LINE) * TILEX + cx;
+ src_y = (graphic / MORE_PER_LINE) * TILEY + cy;
+ }
else if (graphic >= GFX_START_ROCKSHEROES && graphic <= GFX_END_ROCKSHEROES)
{
src_pixmap = pix[PIX_HEROES];
src_x = (graphic % HEROES_PER_LINE) * TILEX + cx;
src_y = (graphic / HEROES_PER_LINE) * TILEY + cy;
}
+ else /* big font graphics currently not allowed (and not needed) */
+ return;
dest_x = FX + x * TILEX + dx;
dest_y = FY + y * TILEY + dy;
}
else if ((element == EL_FELSBROCKEN || IS_GEM(element)) && !cut_mode)
{
- graphic += phase * (element == EL_FELSBROCKEN ? 2 : 1);
+ if (element != EL_SP_INFOTRON)
+ graphic += phase * (element == EL_FELSBROCKEN ? 2 : 1);
}
else if ((element == EL_SIEB_LEER || element == EL_SIEB2_LEER ||
element == EL_SIEB_VOLL || element == EL_SIEB2_VOLL) && SiebAktiv)
graphic = el2gfx(element);
- XCopyArea(display, pix[PIX_BACK], drawto, gc,
- MICRO_GFX_STARTX + (graphic % MICRO_GFX_PER_LINE) * MICRO_TILEX,
- MICRO_GFX_STARTY + (graphic / MICRO_GFX_PER_LINE) * MICRO_TILEY,
- MICRO_TILEX, MICRO_TILEY, xpos, ypos);
+ if (graphic >= GFX_START_ROCKSMORE && graphic <= GFX_END_ROCKSMORE)
+ {
+ graphic -= GFX_START_ROCKSMORE;
+ XCopyArea(display, pix[PIX_MORE], drawto, gc,
+ MICRO_MORE_STARTX + (graphic % MICRO_MORE_PER_LINE) *MICRO_TILEX,
+ MICRO_MORE_STARTY + (graphic / MICRO_MORE_PER_LINE) *MICRO_TILEY,
+ MICRO_TILEX, MICRO_TILEY, xpos, ypos);
+ }
+ else
+ XCopyArea(display, pix[PIX_BACK], drawto, gc,
+ MICRO_GFX_STARTX + (graphic % MICRO_GFX_PER_LINE) * MICRO_TILEX,
+ MICRO_GFX_STARTY + (graphic / MICRO_GFX_PER_LINE) * MICRO_TILEY,
+ MICRO_TILEX, MICRO_TILEY, xpos, ypos);
}
void DrawLevel()
int mx, my, ty, result = -1;
unsigned int old_door_state;
+#ifndef MSDOS
/* pause network game while waiting for request to answer */
if (options.network &&
game_status == PLAYING &&
req_state & REQUEST_WAIT_FOR)
SendToServer_PausePlaying();
+#endif
old_door_state = GetDoorState();
}
}
+#ifndef MSDOS
/* continue network game after request */
if (options.network &&
game_status == PLAYING &&
req_state & REQUEST_WAIT_FOR)
SendToServer_ContinuePlaying();
+#endif
return(result);
}
unsigned int MoveDoor(unsigned int door_state)
{
- static unsigned int door1 = DOOR_OPEN_1;
- static unsigned int door2 = DOOR_CLOSE_2;
- static long door_delay = 0;
+ static int door1 = DOOR_OPEN_1;
+ static int door2 = DOOR_CLOSE_2;
+ static unsigned long door_delay = 0;
int x, start, stepsize = 2;
- long door_delay_value = stepsize * 5;
+ unsigned long door_delay_value = stepsize * 5;
if (door_state == DOOR_GET_STATE)
return(door1 | door2);
int ReadPixel(Drawable d, int x, int y)
{
- static XImage *pixelimage;
+ XImage *pixel_image;
+ unsigned long pixel_value;
+
+ pixel_image = XGetImage(display, d, x, y, 1, 1, AllPlanes, ZPixmap);
+ pixel_value = XGetPixel(pixel_image, 0, 0);
+
+ XDestroyImage(pixel_image);
- pixelimage = XGetImage(display, d, x, y, 1, 1, AllPlanes, ZPixmap);
- return(XGetPixel(pixelimage, 0, 0));
+ return pixel_value;
}
int el2gfx(int element)
{
if (IS_CHAR(element))
return GFX_CHAR_START + (element - EL_CHAR_START);
+ else if (element >= EL_SP_START && element <= EL_SP_END)
+ return GFX_START_ROCKSMORE + (element - EL_SP_START);
else
return -1;
}