network.c \
netserv.c \
msdos.c \
+ system.c \
sdl.c
OBJS = main.o \
network.o \
netserv.o \
msdos.o \
+ system.o \
sdl.o
all: $(PROGNAME)
{
int cx = DOOR_GFX_PAGEX3, cy = DOOR_GFX_PAGEY2;
- XCopyArea(display,pix[PIX_DOOR],drawto,gc,
- cx + VIDEO_REC_LABEL_XPOS,
- cy + VIDEO_REC_LABEL_YPOS,
- VIDEO_PBEND_LABEL_XSIZE,
- VIDEO_PBEND_LABEL_YSIZE,
- VX + VIDEO_REC_LABEL_XPOS,
- VY + VIDEO_REC_LABEL_YPOS);
+ BlitBitmap(pix[PIX_DOOR], drawto,
+ cx + VIDEO_REC_LABEL_XPOS,
+ cy + VIDEO_REC_LABEL_YPOS,
+ VIDEO_PBEND_LABEL_XSIZE,
+ VIDEO_PBEND_LABEL_YSIZE,
+ VX + VIDEO_REC_LABEL_XPOS,
+ VY + VIDEO_REC_LABEL_YPOS);
}
for(i=0;i<10;i++)
cx = DOOR_GFX_PAGEX3; /* i gerade => STATE_OFF / PRESS_ON */
if (video_pos[pos][part_label][0] && value != VIDEO_DISPLAY_SYMBOL_ONLY)
- XCopyArea(display,pix[PIX_DOOR],drawto,gc,
- cx + video_pos[pos][part_label][xpos],
- cy + video_pos[pos][part_label][ypos],
- video_pos[pos][part_label][xsize],
- video_pos[pos][part_label][ysize],
- VX + video_pos[pos][part_label][xpos],
- VY + video_pos[pos][part_label][ypos]);
+ BlitBitmap(pix[PIX_DOOR], drawto,
+ cx + video_pos[pos][part_label][xpos],
+ cy + video_pos[pos][part_label][ypos],
+ video_pos[pos][part_label][xsize],
+ video_pos[pos][part_label][ysize],
+ VX + video_pos[pos][part_label][xpos],
+ VY + video_pos[pos][part_label][ypos]);
if (video_pos[pos][part_symbol][0] && value != VIDEO_DISPLAY_LABEL_ONLY)
- XCopyArea(display,pix[PIX_DOOR],drawto,gc,
- cx + video_pos[pos][part_symbol][xpos],
- cy + video_pos[pos][part_symbol][ypos],
- video_pos[pos][part_symbol][xsize],
- video_pos[pos][part_symbol][ysize],
- VX + video_pos[pos][part_symbol][xpos],
- VY + video_pos[pos][part_symbol][ypos]);
+ BlitBitmap(pix[PIX_DOOR], drawto,
+ cx + video_pos[pos][part_symbol][xpos],
+ cy + video_pos[pos][part_symbol][ypos],
+ video_pos[pos][part_symbol][xsize],
+ video_pos[pos][part_symbol][ysize],
+ VX + video_pos[pos][part_symbol][xpos],
+ VY + video_pos[pos][part_symbol][ypos]);
}
}
{
int cx = DOOR_GFX_PAGEX4, cy = DOOR_GFX_PAGEY2;
- XCopyArea(display,pix[PIX_DOOR],drawto,gc,
- cx + VIDEO_PLAY_SYMBOL_XPOS,
- cy + VIDEO_PLAY_SYMBOL_YPOS,
- VIDEO_PLAY_SYMBOL_XSIZE - 2,
- VIDEO_PLAY_SYMBOL_YSIZE,
- VX + VIDEO_PLAY_SYMBOL_XPOS - 9,
- VY + VIDEO_PLAY_SYMBOL_YPOS);
+ BlitBitmap(pix[PIX_DOOR], drawto,
+ cx + VIDEO_PLAY_SYMBOL_XPOS,
+ cy + VIDEO_PLAY_SYMBOL_YPOS,
+ VIDEO_PLAY_SYMBOL_XSIZE - 2,
+ VIDEO_PLAY_SYMBOL_YSIZE,
+ VX + VIDEO_PLAY_SYMBOL_XPOS - 9,
+ VY + VIDEO_PLAY_SYMBOL_YPOS);
}
if (state & VIDEO_STATE_PBEND_ON)
{
int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY1;
- XCopyArea(display,pix[PIX_DOOR],drawto,gc,
- cx + VIDEO_PBEND_LABEL_XPOS,
- cy + VIDEO_PBEND_LABEL_YPOS,
- VIDEO_PBEND_LABEL_XSIZE,
- VIDEO_PBEND_LABEL_YSIZE,
- VX + VIDEO_REC_LABEL_XPOS,
- VY + VIDEO_REC_LABEL_YPOS);
+ BlitBitmap(pix[PIX_DOOR], drawto,
+ cx + VIDEO_PBEND_LABEL_XPOS,
+ cy + VIDEO_PBEND_LABEL_YPOS,
+ VIDEO_PBEND_LABEL_XSIZE,
+ VIDEO_PBEND_LABEL_YSIZE,
+ VX + VIDEO_REC_LABEL_XPOS,
+ VY + VIDEO_REC_LABEL_YPOS);
}
if (state & VIDEO_STATE_DATE_ON)
void DrawCompleteVideoDisplay()
{
- XCopyArea(display,pix[PIX_DOOR],drawto,gc,
- DOOR_GFX_PAGEX3,DOOR_GFX_PAGEY2, VXSIZE,VYSIZE, VX,VY);
- XCopyArea(display,pix[PIX_DOOR],drawto,gc,
- DOOR_GFX_PAGEX4+VIDEO_CONTROL_XPOS,
- DOOR_GFX_PAGEY2+VIDEO_CONTROL_YPOS,
- VIDEO_CONTROL_XSIZE,VIDEO_CONTROL_YSIZE,
- VX+VIDEO_CONTROL_XPOS,VY+VIDEO_CONTROL_YPOS);
+ BlitBitmap(pix[PIX_DOOR], drawto,
+ DOOR_GFX_PAGEX3,DOOR_GFX_PAGEY2, VXSIZE,VYSIZE, VX,VY);
+ BlitBitmap(pix[PIX_DOOR], drawto,
+ DOOR_GFX_PAGEX4+VIDEO_CONTROL_XPOS,
+ DOOR_GFX_PAGEY2+VIDEO_CONTROL_YPOS,
+ VIDEO_CONTROL_XSIZE,VIDEO_CONTROL_YSIZE,
+ VX+VIDEO_CONTROL_XPOS,VY+VIDEO_CONTROL_YPOS);
DrawVideoDisplay(VIDEO_ALL_OFF,0);
if (tape.date && tape.length)
DrawVideoDisplay(VIDEO_STATE_TIME_ON,tape.length_seconds);
}
- XCopyArea(display,drawto,pix[PIX_DB_DOOR],gc,
- VX,VY, VXSIZE,VYSIZE, DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY2);
+ BlitBitmap(drawto, pix[PIX_DB_DOOR],
+ VX,VY, VXSIZE,VYSIZE, DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY2);
}
case GD_TYPE_NORMAL_BUTTON:
case GD_TYPE_CHECK_BUTTON:
case GD_TYPE_RADIO_BUTTON:
- XCopyArea(display, gd->pixmap, drawto, gc,
- gd->x, gd->y, gi->width, gi->height, gi->x, gi->y);
- if (gi->deco.design.pixmap)
- XCopyArea(display, gi->deco.design.pixmap, drawto, gc,
- gi->deco.design.x, gi->deco.design.y,
- gi->deco.width, gi->deco.height,
- gi->x + gi->deco.x + (pressed ? gi->deco.xshift : 0),
- gi->y + gi->deco.y + (pressed ? gi->deco.yshift : 0));
+ BlitBitmap(gd->bitmap, drawto,
+ gd->x, gd->y, gi->width, gi->height, gi->x, gi->y);
+ if (gi->deco.design.bitmap)
+ BlitBitmap(gi->deco.design.bitmap, drawto,
+ gi->deco.design.x, gi->deco.design.y,
+ gi->deco.width, gi->deco.height,
+ gi->x + gi->deco.x + (pressed ? gi->deco.xshift : 0),
+ gi->y + gi->deco.y + (pressed ? gi->deco.yshift : 0));
break;
case GD_TYPE_TEXTINPUT_ALPHANUMERIC:
strcat(text, " ");
/* left part of gadget */
- XCopyArea(display, gd->pixmap, drawto, gc,
- gd->x, gd->y, border, gi->height, gi->x, gi->y);
+ BlitBitmap(gd->bitmap, drawto,
+ gd->x, gd->y, border, gi->height, gi->x, gi->y);
/* middle part of gadget */
for (i=0; i<=gi->text.size; i++)
- XCopyArea(display, gd->pixmap, drawto, gc,
- gd->x + border, gd->y, font_width, gi->height,
- gi->x + border + i * font_width, gi->y);
+ BlitBitmap(gd->bitmap, drawto,
+ gd->x + border, gd->y, font_width, gi->height,
+ gi->x + border + i * font_width, gi->y);
/* right part of gadget */
- XCopyArea(display, gd->pixmap, drawto, gc,
- gd->x + gi->border.width - border, gd->y,
- border, gi->height, gi->x + gi->width - border, gi->y);
+ BlitBitmap(gd->bitmap, drawto,
+ gd->x + gi->border.width - border, gd->y,
+ border, gi->height, gi->x + gi->width - border, gi->y);
/* gadget text value */
DrawText(gi->x + border, gi->y + border, text, FS_SMALL, font_type);
int step_size_remain = size_body - num_steps * design_body;
/* clear scrollbar area */
- XFillRectangle(display, backbuffer, gc,
- gi->x, gi->y, gi->width, gi->height);
+ ClearRectangle(backbuffer, gi->x, gi->y, gi->width, gi->height);
/* upper part of gadget */
- XCopyArea(display, gd->pixmap, drawto, gc,
- gd->x, gd->y,
- gi->width, gi->border.size,
- xpos, ypos);
+ BlitBitmap(gd->bitmap, drawto,
+ gd->x, gd->y,
+ gi->width, gi->border.size,
+ xpos, ypos);
/* middle part of gadget */
for (i=0; i<num_steps; i++)
- XCopyArea(display, gd->pixmap, drawto, gc,
- gd->x, gd->y + gi->border.size,
- gi->width, design_body,
- xpos, ypos + gi->border.size + i * design_body);
+ BlitBitmap(gd->bitmap, drawto,
+ gd->x, gd->y + gi->border.size,
+ gi->width, design_body,
+ xpos, ypos + gi->border.size + i * design_body);
/* remaining middle part of gadget */
if (step_size_remain > 0)
- XCopyArea(display, gd->pixmap, drawto, gc,
- gd->x, gd->y + gi->border.size,
- gi->width, step_size_remain,
- xpos, ypos + gi->border.size + num_steps * design_body);
+ BlitBitmap(gd->bitmap, drawto,
+ gd->x, gd->y + gi->border.size,
+ gi->width, step_size_remain,
+ xpos, ypos + gi->border.size + num_steps * design_body);
/* lower part of gadget */
- XCopyArea(display, gd->pixmap, drawto, gc,
- gd->x, gd->y + design_full - gi->border.size,
- gi->width, gi->border.size,
- xpos, ypos + size_full - gi->border.size);
+ BlitBitmap(gd->bitmap, drawto,
+ gd->x, gd->y + design_full - gi->border.size,
+ gi->width, gi->border.size,
+ xpos, ypos + size_full - gi->border.size);
}
break;
int step_size_remain = size_body - num_steps * design_body;
/* clear scrollbar area */
- XFillRectangle(display, backbuffer, gc,
- gi->x, gi->y, gi->width, gi->height);
+ ClearRectangle(backbuffer, gi->x, gi->y, gi->width, gi->height);
/* left part of gadget */
- XCopyArea(display, gd->pixmap, drawto, gc,
- gd->x, gd->y,
- gi->border.size, gi->height,
- xpos, ypos);
+ BlitBitmap(gd->bitmap, drawto,
+ gd->x, gd->y,
+ gi->border.size, gi->height,
+ xpos, ypos);
/* middle part of gadget */
for (i=0; i<num_steps; i++)
- XCopyArea(display, gd->pixmap, drawto, gc,
- gd->x + gi->border.size, gd->y,
- design_body, gi->height,
- xpos + gi->border.size + i * design_body, ypos);
+ BlitBitmap(gd->bitmap, drawto,
+ gd->x + gi->border.size, gd->y,
+ design_body, gi->height,
+ xpos + gi->border.size + i * design_body, ypos);
/* remaining middle part of gadget */
if (step_size_remain > 0)
- XCopyArea(display, gd->pixmap, drawto, gc,
- gd->x + gi->border.size, gd->y,
- step_size_remain, gi->height,
- xpos + gi->border.size + num_steps * design_body, ypos);
+ BlitBitmap(gd->bitmap, drawto,
+ gd->x + gi->border.size, gd->y,
+ step_size_remain, gi->height,
+ xpos + gi->border.size + num_steps * design_body, ypos);
/* right part of gadget */
- XCopyArea(display, gd->pixmap, drawto, gc,
- gd->x + design_full - gi->border.size, gd->y,
- gi->border.size, gi->height,
- xpos + size_full - gi->border.size, ypos);
+ BlitBitmap(gd->bitmap, drawto,
+ gd->x + design_full - gi->border.size, gd->y,
+ gi->border.size, gi->height,
+ xpos + size_full - gi->border.size, ypos);
}
break;
}
if (direct)
- XCopyArea(display, drawto, window, gc,
- gi->x, gi->y, gi->width, gi->height, gi->x, gi->y);
+ BlitBitmap(drawto, window,
+ gi->x, gi->y, gi->width, gi->height, gi->x, gi->y);
else
redraw_mask |= (gi->x < SX + SXSIZE ? REDRAW_FIELD :
gi->y < DY + DYSIZE ? REDRAW_DOOR_1 :
break;
case GDI_DESIGN_UNPRESSED:
- gi->design[GD_BUTTON_UNPRESSED].pixmap = va_arg(ap, Pixmap);
+ gi->design[GD_BUTTON_UNPRESSED].bitmap = va_arg(ap, Bitmap);
gi->design[GD_BUTTON_UNPRESSED].x = va_arg(ap, int);
gi->design[GD_BUTTON_UNPRESSED].y = va_arg(ap, int);
break;
case GDI_DESIGN_PRESSED:
- gi->design[GD_BUTTON_PRESSED].pixmap = va_arg(ap, Pixmap);
+ gi->design[GD_BUTTON_PRESSED].bitmap = va_arg(ap, Bitmap);
gi->design[GD_BUTTON_PRESSED].x = va_arg(ap, int);
gi->design[GD_BUTTON_PRESSED].y = va_arg(ap, int);
break;
case GDI_ALT_DESIGN_UNPRESSED:
- gi->alt_design[GD_BUTTON_UNPRESSED].pixmap= va_arg(ap, Pixmap);
+ gi->alt_design[GD_BUTTON_UNPRESSED].bitmap= va_arg(ap, Bitmap);
gi->alt_design[GD_BUTTON_UNPRESSED].x = va_arg(ap, int);
gi->alt_design[GD_BUTTON_UNPRESSED].y = va_arg(ap, int);
break;
case GDI_ALT_DESIGN_PRESSED:
- gi->alt_design[GD_BUTTON_PRESSED].pixmap = va_arg(ap, Pixmap);
+ gi->alt_design[GD_BUTTON_PRESSED].bitmap = va_arg(ap, Bitmap);
gi->alt_design[GD_BUTTON_PRESSED].x = va_arg(ap, int);
gi->alt_design[GD_BUTTON_PRESSED].y = va_arg(ap, int);
break;
break;
case GDI_DECORATION_DESIGN:
- gi->deco.design.pixmap = va_arg(ap, Pixmap);
+ gi->deco.design.bitmap = va_arg(ap, Bitmap);
gi->deco.design.x = va_arg(ap, int);
gi->deco.design.y = va_arg(ap, int);
break;
/* check if gadget complete */
if (gi->type != GD_TYPE_DRAWING_AREA &&
- (!gi->design[GD_BUTTON_UNPRESSED].pixmap ||
- !gi->design[GD_BUTTON_PRESSED].pixmap))
- Error(ERR_EXIT, "gadget incomplete (missing Pixmap)");
+ (!gi->design[GD_BUTTON_UNPRESSED].bitmap ||
+ !gi->design[GD_BUTTON_PRESSED].bitmap))
+ Error(ERR_EXIT, "gadget incomplete (missing Bitmap)");
/* adjust gadget values in relation to other gadget values */
struct GadgetDesign
{
- Pixmap pixmap; /* Pixmap with gadget surface */
- int x, y; /* position of rectangle in Pixmap */
+ Bitmap bitmap; /* Bitmap with gadget surface */
+ int x, y; /* position of rectangle in Bitmap */
};
struct GadgetDecoration
static void HandleAnimation(int);
static boolean AnimateToon(int, boolean);
-static void DrawAnim(Pixmap, GC, int, int, int, int, int, int, int, int);
+static void DrawAnim(Bitmap, GC, int, int, int, int, int, int, int, int);
struct AnimInfo
{
fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0);
fy += (ScreenMovDir & (MV_UP|MV_DOWN) ? ScreenGfxPos : 0);
- XCopyArea(display,fieldbuffer,backbuffer,gc,
- fx,fy, SXSIZE,SYSIZE,
- SX,SY);
+ BlitBitmap(fieldbuffer, backbuffer, fx,fy, SXSIZE,SYSIZE, SX,SY);
}
return;
},
};
struct AnimInfo *anim = &toon[toon_nr];
- Pixmap anim_pixmap = (toon_nr < 6 ? pix[PIX_TOONS] : pix[PIX_HEROES]);
- GC anim_clip_gc = (toon_nr < 6 ? clip_gc[PIX_TOONS] : clip_gc[PIX_HEROES]);
+ int anim_bitmap_nr = (toon_nr < 6 ? PIX_TOONS : PIX_HEROES);
+ Bitmap anim_bitmap = pix_masked[anim_bitmap_nr];
+ GC anim_clip_gc = clip_gc[anim_bitmap_nr];
if (restart)
{
if ((game_status == HELPSCREEN ||
(game_status == MAINMENU && redraw_mask & REDRAW_MICROLEVEL))
&& !restart)
- DrawAnim(anim_pixmap, anim_clip_gc,
+ DrawAnim(anim_bitmap, anim_clip_gc,
src_x + cut_x, src_y + cut_y, width, height,
REAL_SX + dest_x, REAL_SY + dest_y, pad_x, pad_y);
else if (pos_y>FULL_SYSIZE-anim->height)
height -= (pos_y - (FULL_SYSIZE-anim->height));
- DrawAnim(anim_pixmap,anim_clip_gc,
+ DrawAnim(anim_bitmap,anim_clip_gc,
src_x+cut_x,src_y+cut_y, width,height,
REAL_SX+dest_x,REAL_SY+dest_y, pad_x,pad_y);
return(FALSE);
}
-void DrawAnim(Pixmap toon_pixmap, GC toon_clip_gc,
+void DrawAnim(Bitmap toon_bitmap, GC toon_clip_gc,
int src_x, int src_y, int width, int height,
int dest_x, int dest_y, int pad_x, int pad_y)
{
#if 1
/* special method to avoid flickering interference with BackToFront() */
- XCopyArea(display,backbuffer,pix[PIX_DB_DOOR],gc,dest_x-pad_x,dest_y-pad_y,
- width+2*pad_x,height+2*pad_y, buf_x,buf_y);
- XSetClipOrigin(display,toon_clip_gc,dest_x-src_x,dest_y-src_y);
- XCopyArea(display,toon_pixmap,backbuffer,toon_clip_gc,
- src_x,src_y, width,height, dest_x,dest_y);
- XCopyArea(display,backbuffer,window,gc, dest_x-pad_x,dest_y-pad_y,
- width+2*pad_x,height+2*pad_y, dest_x-pad_x,dest_y-pad_y);
+ BlitBitmap(backbuffer, pix[PIX_DB_DOOR], dest_x-pad_x, dest_y-pad_y,
+ width+2*pad_x, height+2*pad_y, buf_x, buf_y);
+ SetClipOrigin(toon_clip_gc, dest_x-src_x, dest_y-src_y);
+ BlitBitmapMasked(toon_bitmap, backbuffer,
+ src_x, src_y, width, height, dest_x, dest_y);
+ BlitBitmap(backbuffer, window, dest_x-pad_x, dest_y-pad_y,
+ width+2*pad_x, height+2*pad_y, dest_x-pad_x, dest_y-pad_y);
BackToFront();
- XCopyArea(display,pix[PIX_DB_DOOR],backbuffer,gc, buf_x,buf_y,
- width+2*pad_x,height+2*pad_y, dest_x-pad_x,dest_y-pad_y);
+ BlitBitmap(pix[PIX_DB_DOOR], backbuffer, buf_x, buf_y,
+ width+2*pad_x, height+2*pad_y, dest_x-pad_x, dest_y-pad_y);
#else
/* normal method, causing flickering interference with BackToFront() */
- XCopyArea(display,backbuffer,pix[PIX_DB_DOOR],gc,dest_x-pad_x,dest_y-pad_y,
- width+2*pad_x,height+2*pad_y, buf_x,buf_y);
- XSetClipOrigin(display,toon_clip_gc,
- buf_x-src_x+pad_x,buf_y-src_y+pad_y);
- XCopyArea(display,toon_pixmap,pix[PIX_DB_DOOR],toon_clip_gc,
- src_x,src_y, width,height, buf_x+pad_x,buf_y+pad_y);
- XCopyArea(display,pix[PIX_DB_DOOR],window,gc, buf_x,buf_y,
- width+2*pad_x,height+2*pad_y, dest_x-pad_x,dest_y-pad_y);
+ BlitBitmap(backbuffer, pix[PIX_DB_DOOR], dest_x-pad_x, dest_y-pad_y,
+ width+2*pad_x, height+2*pad_y, buf_x, buf_y);
+ SetClipOrigin(toon_clip_gc, buf_x-src_x+pad_x, buf_y-src_y+pad_y);
+ BlitBitmapMasked(toon_bitmap, pix[PIX_DB_DOOR],
+ src_x, src_y, width, height, buf_x+pad_x, buf_y+pad_y);
+ BlitBitmap(pix[PIX_DB_DOOR], window, buf_x, buf_y,
+ width+2*pad_x, height+2*pad_y, dest_x-pad_x, dest_y-pad_y);
#endif
- XFlush(display);
+ FlushDisplay();
}
int dx = (scroll == ED_SCROLL_LEFT ? -1 : scroll == ED_SCROLL_RIGHT ? 1 : 0);
int dy = (scroll == ED_SCROLL_UP ? -1 : scroll == ED_SCROLL_DOWN ? 1 : 0);
- XCopyArea(display, drawto, drawto, gc,
- SX + (dx == -1 ? MINI_TILEX : 0),
- SY + (dy == -1 ? MINI_TILEY : 0),
- (ed_fieldx * MINI_TILEX) - (dx != 0 ? MINI_TILEX : 0),
- (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0),
- SX + (dx == +1 ? MINI_TILEX : 0),
- SY + (dy == +1 ? MINI_TILEY : 0));
+ BlitBitmap(drawto, drawto,
+ SX + (dx == -1 ? MINI_TILEX : 0),
+ SY + (dy == -1 ? MINI_TILEY : 0),
+ (ed_fieldx * MINI_TILEX) - (dx != 0 ? MINI_TILEX : 0),
+ (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0),
+ SX + (dx == +1 ? MINI_TILEX : 0),
+ SY + (dy == +1 ? MINI_TILEY : 0));
if (dx)
{
x = (dx == 1 ? 0 : ed_fieldx - 1);
static void CreateControlButtons()
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap gd_bitmap = pix[PIX_DOOR];
struct GadgetInfo *gi;
unsigned long event_mask;
int i;
GDI_STATE, GD_BUTTON_UNPRESSED,
GDI_RADIO_NR, radio_button_nr,
GDI_CHECKED, checked,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y1,
- GDI_ALT_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y2,
- GDI_ALT_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y1,
+ GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y2,
+ GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleControlButtons,
GDI_END);
GDI_HEIGHT, height,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleControlButtons,
GDI_END);
/* create buttons for element list */
for (i=0; i<ED_NUM_ELEMENTLIST_BUTTONS; i++)
{
- Pixmap deco_pixmap;
+ Bitmap deco_bitmap;
int deco_x, deco_y, deco_xpos, deco_ypos;
int gd_xoffset, gd_yoffset;
int gd_x1, gd_x2, gd_y;
gd_y = DOOR_GFX_PAGEY1 + ED_ELEMENTLIST_YPOS;
getMiniGraphicSource(el2gfx(editor_element[i]),
- &deco_pixmap, &deco_x, &deco_y);
+ &deco_bitmap, &deco_x, &deco_y);
deco_xpos = (ED_ELEMENTLIST_XSIZE - MINI_TILEX) / 2;
deco_ypos = (ED_ELEMENTLIST_YSIZE - MINI_TILEY) / 2;
GDI_HEIGHT, ED_ELEMENTLIST_YSIZE,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
- GDI_DECORATION_DESIGN, deco_pixmap, deco_x, deco_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+ GDI_DECORATION_DESIGN, deco_bitmap, deco_x, deco_y,
GDI_DECORATION_POSITION, deco_xpos, deco_ypos,
GDI_DECORATION_SIZE, MINI_TILEX, MINI_TILEY,
GDI_DECORATION_SHIFTING, 1, 1,
for (j=0; j<2; j++)
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap gd_bitmap = pix[PIX_DOOR];
struct GadgetInfo *gi;
int id = (j == 0 ?
counterbutton_info[i].gadget_id_down :
GDI_HEIGHT, y_size,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleCounterButtons,
GDI_END);
GDI_NUMBER_MAX, counterbutton_info[i].max_value,
GDI_TEXT_SIZE, 3,
GDI_TEXT_FONT, font_type,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x, gd_y,
GDI_BORDER_SIZE, ED_BORDER_SIZE,
GDI_TEXTINPUT_DESIGN_WIDTH, gd_width,
GDI_EVENT_MASK, event_mask,
for (i=0; i<ED_NUM_TEXTINPUT; i++)
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap gd_bitmap = pix[PIX_DOOR];
int gd_x, gd_y;
struct GadgetInfo *gi;
unsigned long event_mask;
GDI_TEXT_VALUE, textinput_info[i].value,
GDI_TEXT_SIZE, textinput_info[i].size,
GDI_TEXT_FONT, FC_YELLOW,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x, gd_y,
GDI_BORDER_SIZE, ED_BORDER_SIZE,
GDI_TEXTINPUT_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
GDI_EVENT_MASK, event_mask,
for (i=0; i<ED_NUM_SCROLLBARS; i++)
{
int id = scrollbar_info[i].gadget_id;
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap gd_bitmap = pix[PIX_DOOR];
int gd_x1, gd_x2, gd_y1, gd_y2;
struct GadgetInfo *gi;
int items_max, items_visible, item_position;
GDI_SCROLLBAR_ITEMS_VISIBLE, items_visible,
GDI_SCROLLBAR_ITEM_POSITION, item_position,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
GDI_BORDER_SIZE, ED_BORDER_SIZE,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleControlButtons,
static void CreateCheckbuttonGadgets()
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap gd_bitmap = pix[PIX_DOOR];
struct GadgetInfo *gi;
unsigned long event_mask;
int gd_x1, gd_x2, gd_x3, gd_x4, gd_y;
GDI_TYPE, GD_TYPE_RADIO_BUTTON,
GDI_RADIO_NR, radiobutton_info[i].radio_button_nr,
GDI_CHECKED, checked,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
- GDI_ALT_DESIGN_UNPRESSED, gd_pixmap, gd_x3, gd_y,
- GDI_ALT_DESIGN_PRESSED, gd_pixmap, gd_x4, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+ GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x3, gd_y,
+ GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x4, gd_y,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleRadiobuttons,
GDI_END);
GDI_HEIGHT, ED_CHECKBUTTON_YSIZE,
GDI_TYPE, GD_TYPE_CHECK_BUTTON,
GDI_CHECKED, *checkbutton_info[i].value,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
- GDI_ALT_DESIGN_UNPRESSED, gd_pixmap, gd_x3, gd_y,
- GDI_ALT_DESIGN_PRESSED, gd_pixmap, gd_x4, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+ GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x3, gd_y,
+ GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x4, gd_y,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleCheckbuttons,
GDI_END);
}
/* copy default editor door content to main double buffer */
- XCopyArea(display, pix[PIX_DOOR], drawto, gc,
- DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
+ BlitBitmap(pix[PIX_DOOR], drawto,
+ DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
/* draw mouse button brush elements */
DrawMiniGraphicExt(drawto, gc,
DrawSpecialEditorDoor();
/* draw new control window */
- XCopyArea(display, pix[PIX_DOOR], drawto, gc,
- DOOR_GFX_PAGEX8, 236,
- EXSIZE, EYSIZE,
- EX, EY);
+ BlitBitmap(pix[PIX_DOOR], drawto,
+ DOOR_GFX_PAGEX8, 236, EXSIZE, EYSIZE, EX, EY);
redraw_mask |= REDRAW_ALL;
MapControlButtons();
/* copy actual editor door content to door double buffer for OpenDoor() */
- XCopyArea(display, drawto, pix[PIX_DB_DOOR], gc,
- DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ BlitBitmap(drawto, pix[PIX_DB_DOOR],
+ DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
DrawEditModeWindow();
for (x=0; x<2; x++)
DrawMiniElement(area_x + x, area_y + y, EL_ERDREICH);
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
area_sx + MINI_TILEX/2 - 1, area_sy + MINI_TILEY/2 - 1,
MINI_TILEX + 2, MINI_TILEY + 2);
/* copy border to the right location */
- XCopyArea(display, drawto, drawto, gc,
- area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
- area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
+ area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
for (x=0; x<2; x++)
DrawMiniElement(area_x + x, area_y + y, EL_ERDREICH);
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
area_sx + MINI_TILEX/2 - 1, area_sy + MINI_TILEY/2 - 1,
MINI_TILEX + 2, MINI_TILEY + 2);
/* copy border to the right location */
- XCopyArea(display, drawto, drawto, gc,
- area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
- area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
+ area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
DrawText(area_sx + TILEX, area_sy + 1, "Content of amoeba",
FS_SMALL, font_color);
MapCounterButtons(counter_id);
/* delete content areas in case of reducing number of them */
- XFillRectangle(display, backbuffer, gc,
+ ClearRectangle(backbuffer,
SX, area_sy - MINI_TILEX,
SXSIZE, 12 * MINI_TILEY);
DrawMiniElement(area_x + 5 * (i % 4) + x, area_y + 6 * (i / 4) + y,
EL_ERDREICH);
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
area_sx + 5 * (i % 4) * MINI_TILEX + MINI_TILEX/2 - 1,
area_sy + 6 * (i / 4) * MINI_TILEY + MINI_TILEY/2 - 1,
3 * MINI_TILEX + 2, 3 * MINI_TILEY + 2);
}
/* copy border to the right location */
- XCopyArea(display, drawto, drawto, gc,
- area_sx, area_sy, (5 * 4 + 1) * MINI_TILEX, 11 * MINI_TILEY,
- area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ area_sx, area_sy, (5 * 4 + 1) * MINI_TILEX, 11 * MINI_TILEY,
+ area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 0 * MINI_TILEY + 1,
"Content", FS_SMALL, font_color);
for (x=0; x<3; x++)
DrawMiniElement(xstart + x , ystart + y, EL_ERDREICH);
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
SX + xstart * MINI_TILEX + MINI_TILEX/2 - 1,
SY + ystart * MINI_TILEY + MINI_TILEY/2 - 1,
TILEX + 2, TILEY + 2);
/* copy border to the right location */
- XCopyArea(display, drawto, drawto, gc,
- SX + xstart * MINI_TILEX,
- SY + ystart * MINI_TILEY,
- 2 * TILEX, 2 * TILEY,
- SX + xstart * MINI_TILEX - MINI_TILEX/2,
- SY + ystart * MINI_TILEY - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ SX + xstart * MINI_TILEX,
+ SY + ystart * MINI_TILEY,
+ 2 * TILEX, 2 * TILEY,
+ SX + xstart * MINI_TILEX - MINI_TILEX/2,
+ SY + ystart * MINI_TILEY - MINI_TILEY/2);
DrawGraphic(xstart/2, ystart/2, el2gfx(properties_element));
/* copy the whole stuff to the definitive location */
- XCopyArea(display, drawto, drawto, gc,
- SX + xstart * MINI_TILEX - MINI_TILEX/2,
- SY + ystart * MINI_TILEY - MINI_TILEY,
- 2 * TILEX, 2 * TILEY,
- SX + xstart * MINI_TILEX - MINI_TILEX/2,
- SY + ystart * MINI_TILEY - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ SX + xstart * MINI_TILEX - MINI_TILEX/2,
+ SY + ystart * MINI_TILEY - MINI_TILEY,
+ 2 * TILEX, 2 * TILEY,
+ SX + xstart * MINI_TILEX - MINI_TILEX/2,
+ SY + ystart * MINI_TILEY - MINI_TILEY/2);
DrawTextF((xstart + 3) * MINI_TILEX, (ystart + 1) * MINI_TILEY,
font_color, element_info[properties_element]);
}
}
-static void swap_numbers(int *i1, int *i2)
-{
- int help = *i1;
-
- *i1 = *i2;
- *i2 = help;
-}
-
-static void swap_number_pairs(int *x1, int *y1, int *x2, int *y2)
-{
- int help_x = *x1;
- int help_y = *y1;
-
- *x1 = *x2;
- *x2 = help_x;
-
- *y1 = *y2;
- *y2 = help_y;
-}
-
static void DrawLineElement(int sx, int sy, int element, boolean change_level)
{
int lx = sx + level_xpos;
to_sx = SX + to_x * MINI_TILEX + MINI_TILEX - 1;
to_sy = SY + to_y * MINI_TILEY + MINI_TILEY - 1;
- XSetForeground(display, gc, WhitePixel(display, screen));
-
- XDrawLine(display, drawto, gc, from_sx, from_sy, to_sx, from_sy);
- XDrawLine(display, drawto, gc, to_sx, from_sy, to_sx, to_sy);
- XDrawLine(display, drawto, gc, to_sx, to_sy, from_sx, to_sy);
- XDrawLine(display, drawto, gc, from_sx, to_sy, from_sx, from_sy);
-
- XSetForeground(display, gc, BlackPixel(display, screen));
+ DrawSimpleWhiteLine(drawto, from_sx, from_sy, to_sx, from_sy);
+ DrawSimpleWhiteLine(drawto, to_sx, from_sy, to_sx, to_sy);
+ DrawSimpleWhiteLine(drawto, to_sx, to_sy, from_sx, to_sy);
+ DrawSimpleWhiteLine(drawto, from_sx, to_sy, from_sx, from_sy);
if (from_x == to_x && from_y == to_y)
MarkTileDirty(from_x/2, from_y/2);
int element = editor_element[element_shift + i];
UnmapGadget(gi);
- getMiniGraphicSource(el2gfx(element), &gd->pixmap, &gd->x, &gd->y);
+ getMiniGraphicSource(el2gfx(element), &gd->bitmap, &gd->x, &gd->y);
ModifyGadget(gi, GDI_INFO_TEXT, element_info[element], GDI_END);
MapGadget(gi);
}
else
{
CloseDoor(DOOR_CLOSE_1);
- XCopyArea(display, pix[PIX_DB_DOOR], pix[PIX_DB_DOOR], gc,
- DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
- DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ BlitBitmap(pix[PIX_DB_DOOR], pix[PIX_DB_DOOR],
+ DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
OpenDoor(DOOR_OPEN_1);
}
break;
void ClearEditorGadgetInfoText()
{
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
INFOTEXT_XPOS, INFOTEXT_YPOS, INFOTEXT_XSIZE, INFOTEXT_YSIZE);
redraw_mask |= REDRAW_FIELD;
}
{
while(1)
{
- if (XPending(display)) /* got event from X server */
+ if (PendingEvent()) /* got event */
{
- XEvent event;
+ Event event;
- XNextEvent(display, &event);
+ NextEvent(&event);
switch(event.type)
{
- case ButtonPress:
- case ButtonRelease:
- HandleButtonEvent((XButtonEvent *) &event);
+ case EVENT_BUTTONPRESS:
+ case EVENT_BUTTONRELEASE:
+ HandleButtonEvent((ButtonEvent *) &event);
break;
- case MotionNotify:
- HandleMotionEvent((XMotionEvent *) &event);
+ case EVENT_MOTIONNOTIFY:
+ HandleMotionEvent((MotionEvent *) &event);
break;
- case KeyPress:
- case KeyRelease:
- HandleKeyEvent((XKeyEvent *) &event);
+ case EVENT_KEYPRESS:
+ case EVENT_KEYRELEASE:
+ HandleKeyEvent((KeyEvent *) &event);
break;
default:
if (game_status != PLAYING)
{
- XSync(display, FALSE);
- if (!XPending(display)) /* delay only if no pending events */
+ SyncDisplay();
+ if (!PendingEvent()) /* delay only if no pending events */
Delay(10);
}
}
}
-void HandleOtherEvents(XEvent *event)
+void HandleOtherEvents(Event *event)
{
switch(event->type)
{
- case Expose:
- HandleExposeEvent((XExposeEvent *) event);
+ case EVENT_EXPOSE:
+ HandleExposeEvent((ExposeEvent *) event);
break;
- case UnmapNotify:
+ case EVENT_UNMAPNOTIFY:
SleepWhileUnmapped();
break;
- case FocusIn:
- case FocusOut:
- HandleFocusEvent((XFocusChangeEvent *) event);
+ case EVENT_FOCUSIN:
+ case EVENT_FOCUSOUT:
+ HandleFocusEvent((FocusChangeEvent *) event);
break;
- case ClientMessage:
- HandleClientMessageEvent((XClientMessageEvent *) event);
+ case EVENT_CLIENTMESSAGE:
+ HandleClientMessageEvent((ClientMessageEvent *) event);
break;
default:
void ClearEventQueue()
{
- while(XPending(display))
+ while (PendingEvent())
{
- XEvent event;
+ Event event;
- XNextEvent(display, &event);
+ NextEvent(&event);
switch(event.type)
{
- case ButtonRelease:
+ case EVENT_BUTTONRELEASE:
button_status = MB_RELEASED;
break;
- case KeyRelease:
+ case EVENT_KEYRELEASE:
key_joystick_mapping = 0;
break;
{
boolean window_unmapped = TRUE;
- XAutoRepeatOn(display);
+ KeyboardAutoRepeatOn();
while(window_unmapped)
{
- XEvent event;
+ Event event;
- XNextEvent(display, &event);
+ NextEvent(&event);
switch(event.type)
{
- case ButtonRelease:
+ case EVENT_BUTTONRELEASE:
button_status = MB_RELEASED;
break;
- case KeyRelease:
+ case EVENT_KEYRELEASE:
key_joystick_mapping = 0;
break;
- case MapNotify:
+ case EVENT_MAPNOTIFY:
window_unmapped = FALSE;
break;
- case UnmapNotify:
+ case EVENT_UNMAPNOTIFY:
/* this is only to surely prevent the 'should not happen' case
* of recursively looping between 'SleepWhileUnmapped()' and
* 'HandleOtherEvents()' which usually calls this funtion.
}
if (game_status == PLAYING)
- XAutoRepeatOff(display);
+ KeyboardAutoRepeatOff();
}
-void HandleExposeEvent(XExposeEvent *event)
+void HandleExposeEvent(ExposeEvent *event)
{
int x = event->x, y = event->y;
int width = event->width, height = event->height;
fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0);
fy += (ScreenMovDir & (MV_UP|MV_DOWN) ? ScreenGfxPos : 0);
- XCopyArea(display,fieldbuffer,backbuffer,gc,
- fx,fy, SXSIZE,SYSIZE,
- SX,SY);
+ BlitBitmap(fieldbuffer, backbuffer, fx,fy, SXSIZE,SYSIZE, SX,SY);
}
- XCopyArea(display,drawto,window,gc, x,y, width,height, x,y);
+ BlitBitmap(drawto, window, x,y, width,height, x,y);
- XFlush(display);
+ FlushDisplay();
}
-void HandleButtonEvent(XButtonEvent *event)
+void HandleButtonEvent(ButtonEvent *event)
{
motion_status = FALSE;
- if (event->type == ButtonPress)
+ if (event->type == EVENT_BUTTONPRESS)
button_status = event->button;
else
button_status = MB_RELEASED;
HandleButton(event->x, event->y, button_status);
}
-void HandleMotionEvent(XMotionEvent *event)
+void HandleMotionEvent(MotionEvent *event)
{
- Window root, child;
- int root_x, root_y;
int win_x, win_y;
- unsigned int mask;
- if (!XQueryPointer(display, window, &root, &child, &root_x, &root_y,
- &win_x, &win_y, &mask))
- return;
+ if (!QueryPointer(window, &win_x, &win_y))
+ return; /* window and pointer are on different screens */
if (!button_status && game_status != LEVELED)
return;
HandleButton(win_x, win_y, button_status);
}
-void HandleKeyEvent(XKeyEvent *event)
+void HandleKeyEvent(KeyEvent *event)
{
- int key_status = (event->type == KeyPress ? KEY_PRESSED : KEY_RELEASED);
+ int key_status = (event->type==EVENT_KEYPRESS ? KEY_PRESSED : KEY_RELEASED);
KeySym key;
if (game_status == PLAYING)
HandleKey(key, key_status);
}
-void HandleFocusEvent(XFocusChangeEvent *event)
+void HandleFocusEvent(FocusChangeEvent *event)
{
static int old_joystick_status = -1;
- if (event->type == FocusOut)
+ if (event->type == EVENT_FOCUSOUT)
{
int i;
- XAutoRepeatOn(display);
+ KeyboardAutoRepeatOn();
old_joystick_status = joystick_status;
joystick_status = JOYSTICK_OFF;
for (i=0; i<MAX_PLAYERS; i++)
stored_player[i].action = 0;
}
- else if (event->type == FocusIn)
+ else if (event->type == EVENT_FOCUSIN)
{
/* When there are two Rocks'n'Diamonds windows which overlap and
the player moves the pointer from one game window to the other,
if (game_status == PLAYING)
{
Delay(100);
- XAutoRepeatOff(display);
+ KeyboardAutoRepeatOff();
}
if (old_joystick_status != -1)
joystick_status = old_joystick_status;
}
}
-void HandleClientMessageEvent(XClientMessageEvent *event)
+void HandleClientMessageEvent(ClientMessageEvent *event)
{
+#ifdef USE_SDL_LIBRARY
+ CloseAllAndExit(0); /* the only possible message here is SDL_QUIT */
+#else
#ifndef MSDOS
if ((event->window == window) &&
(event->data.l[0] == XInternAtom(display, "WM_DELETE_WINDOW", FALSE)))
CloseAllAndExit(0);
#endif
+#endif
}
void HandleButton(int mx, int my, int button)
#include "main.h"
void EventLoop(void);
-void HandleOtherEvents(XEvent *);
+void HandleOtherEvents(Event *);
void ClearEventQueue(void);
void SleepWhileUnmapped(void);
-void HandleExposeEvent(XExposeEvent *);
-void HandleButtonEvent(XButtonEvent *);
-void HandleMotionEvent(XMotionEvent *);
-void HandleKeyEvent(XKeyEvent *);
-void HandleFocusEvent(XFocusChangeEvent *);
-void HandleClientMessageEvent(XClientMessageEvent *event);
+void HandleExposeEvent(ExposeEvent *);
+void HandleButtonEvent(ButtonEvent *);
+void HandleMotionEvent(MotionEvent *);
+void HandleKeyEvent(KeyEvent *);
+void HandleFocusEvent(FocusChangeEvent *);
+void HandleClientMessageEvent(ClientMessageEvent *event);
void HandleNoXEvent(void);
CloseAllOpenTimegates();
if (setup.soft_scrolling)
- XCopyArea(display, fieldbuffer, backbuffer, gc,
- FX, FY, SXSIZE, SYSIZE, SX, SY);
+ BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
redraw_mask |= REDRAW_FROM_BACKBUFFER;
/* copy default game door content to main double buffer */
- XCopyArea(display, pix[PIX_DOOR], drawto, gc,
- DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
+ BlitBitmap(pix[PIX_DOOR], drawto,
+ DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
if (level_nr < 100)
DrawText(DX + XX_LEVEL, DY + YY_LEVEL,
{
DrawTextExt(drawto, gc, DX + XX_EMERALDS, DY + YY_EMERALDS,
int2str(level_nr, 3), FS_SMALL, FC_SPECIAL3);
- XCopyArea(display, drawto, drawto, gc,
- DX + XX_EMERALDS, DY + YY_EMERALDS + 1,
- FONT5_XSIZE * 3, FONT5_YSIZE - 1,
- DX + XX_LEVEL - 1, DY + YY_LEVEL + 1);
+ BlitBitmap(drawto, drawto,
+ DX + XX_EMERALDS, DY + YY_EMERALDS + 1,
+ FONT5_XSIZE * 3, FONT5_YSIZE - 1,
+ DX + XX_LEVEL - 1, DY + YY_LEVEL + 1);
}
DrawText(DX + XX_EMERALDS, DY + YY_EMERALDS,
MapTapeButtons();
/* copy actual game door content to door double buffer for OpenDoor() */
- XCopyArea(display, drawto, pix[PIX_DB_DOOR], gc,
- DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ BlitBitmap(drawto, pix[PIX_DB_DOOR],
+ DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
OpenDoor(DOOR_OPEN_ALL);
if (setup.sound_music)
PlaySoundLoop(background_loop[level_nr % num_bg_loops]);
- XAutoRepeatOff(display);
+ KeyboardAutoRepeatOff();
if (options.verbose)
{
dest_x = FX + SCREENX(x)*TILEX;
dest_y = FY + SCREENY(y)*TILEY;
- XCopyArea(display, drawto_field, window, gc,
- dest_x, dest_y, TILEX, TILEY, dest_x, dest_y);
+ BlitBitmap(drawto_field, window,
+ dest_x, dest_y, TILEX, TILEY, dest_x, dest_y);
SetDrawtoField(DRAW_DIRECT);
}
}
int softscroll_offset = (setup.soft_scrolling ? TILEX : 0);
int x, y;
- XCopyArea(display, drawto_field, drawto_field, gc,
- FX + TILEX*(dx == -1) - softscroll_offset,
- FY + TILEY*(dy == -1) - softscroll_offset,
- SXSIZE - TILEX*(dx!=0) + 2*softscroll_offset,
- SYSIZE - TILEY*(dy!=0) + 2*softscroll_offset,
- FX + TILEX*(dx == 1) - softscroll_offset,
- FY + TILEY*(dy == 1) - softscroll_offset);
+ BlitBitmap(drawto_field, drawto_field,
+ FX + TILEX*(dx == -1) - softscroll_offset,
+ FY + TILEY*(dy == -1) - softscroll_offset,
+ SXSIZE - TILEX*(dx!=0) + 2*softscroll_offset,
+ SYSIZE - TILEY*(dy!=0) + 2*softscroll_offset,
+ FX + TILEX*(dx == 1) - softscroll_offset,
+ FY + TILEY*(dy == 1) - softscroll_offset);
if (dx)
{
for (i=0; i<NUM_GAME_BUTTONS; i++)
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap gd_bitmap = pix[PIX_DOOR];
struct GadgetInfo *gi;
int button_type;
boolean checked;
GDI_TYPE, button_type,
GDI_STATE, GD_BUTTON_UNPRESSED,
GDI_CHECKED, checked,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y1,
- GDI_ALT_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y2,
- GDI_ALT_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y1,
+ GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y2,
+ GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleGameButtons,
GDI_END);
#ifndef USE_SDL_LIBRARY
XMapWindow(display, window);
- XFlush(display);
+ FlushDisplay();
#endif
InitGfx();
InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */
InitLevelAndPlayerInfo();
- return;
InitGadgets(); /* needs to know number of level series */
DrawMainMenu();
{
#ifdef USE_SDL_LIBRARY
/* open SDL video output device (window or fullscreen mode) */
- if ((sdl_window = SDL_SetVideoMode(WIN_XSIZE, WIN_YSIZE, WIN_SDL_DEPTH,
- SDL_HWSURFACE))
+ if ((window = SDL_SetVideoMode(WIN_XSIZE, WIN_YSIZE, WIN_SDL_DEPTH,
+ SDL_HWSURFACE))
== NULL)
Error(ERR_EXIT, "SDL_SetVideoMode() failed: %s\n", SDL_GetError());
/* set window and icon title */
SDL_WM_SetCaption(WINDOW_TITLE_STRING, WINDOW_TITLE_STRING);
- /* select event types: initially no mouse motion events */
- SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
-
#else /* !USE_SDL_LIBRARY */
unsigned int border_width = 4;
XSelectInput(display, window, window_event_mask);
#endif
- /* create GC for drawing with window depth */
+ /* create GC for drawing with window depth and background color (black) */
gc_values.graphics_exposures = False;
gc_values.foreground = pen_bg;
gc_values.background = pen_bg;
== NULL)
Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s\n", SDL_GetError());
- if ((sdl_pix[PIX_DB_BACK] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ if ((pix[PIX_DB_BACK] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError());
SDL_FreeSurface(sdl_image_tmp);
== NULL)
Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s\n", SDL_GetError());
- if ((sdl_pix[PIX_DB_DOOR] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ if ((pix[PIX_DB_DOOR] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError());
SDL_FreeSurface(sdl_image_tmp);
== NULL)
Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s\n", SDL_GetError());
- if ((sdl_pix[PIX_DB_FIELD] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ if ((pix[PIX_DB_FIELD] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError());
SDL_FreeSurface(sdl_image_tmp);
/* initialize surface array to 'NULL' */
for(i=0; i<NUM_TILES; i++)
- sdl_tile_masked[i] = NULL;
+ tile_masked[i] = NULL;
/* create only those masked surfaces we really need */
for(i=0; tile_needs_clipping[i].start>=0; i++)
for(j=0; j<tile_needs_clipping[i].count; j++)
{
int tile = tile_needs_clipping[i].start + j;
-#if 0
int graphic = tile;
int src_x, src_y;
- int pixmap_nr;
- Pixmap src_pixmap;
+ int bitmap_nr;
+ Bitmap src_bitmap;
- getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
- src_pixmap = clipmask[pixmap_nr];
+ getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
+ src_bitmap = pix_masked[bitmap_nr];
- tile_clipmask[tile] = XCreatePixmap(display, window, TILEX,TILEY, 1);
+ /* create surface for masked tile graphic */
+ if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, TILEX, TILEY,
+ WIN_SDL_DEPTH, 0, 0, 0, 0))
+ == NULL)
+ Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s\n", SDL_GetError());
- XCopyArea(display,src_pixmap,tile_clipmask[tile],copy_clipmask_gc,
- src_x,src_y, TILEX,TILEY, 0,0);
-#endif
- }
- }
+ /* create native transparent surface for current image */
+ SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
+ SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
+ if ((tile_masked[tile] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError());
- sdl_drawto = sdl_backbuffer = sdl_pix[PIX_DB_BACK];
- sdl_fieldbuffer = sdl_pix[PIX_DB_FIELD];
- SetDrawtoField(DRAW_BACKBUFFER);
+ SDL_FreeSurface(sdl_image_tmp);
- SDLCopyArea(sdl_pix[PIX_BACK], sdl_backbuffer,
- 0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
- SDLFillRectangle(sdl_pix[PIX_DB_BACK],
- REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE, 0x000000);
- SDLFillRectangle(sdl_pix[PIX_DB_DOOR],
- 0,0, 3*DXSIZE,DYSIZE+VYSIZE, 0x000000);
+ BlitBitmap(src_bitmap, tile_masked[tile], src_x,src_y, TILEX,TILEY, 0,0);
+ }
+ }
#else /* !USE_SDL_LIBRARY */
if (!pix[PIX_DB_BACK] || !pix[PIX_DB_DOOR])
Error(ERR_EXIT, "cannot create additional pixmaps");
- for(i=0; i<NUM_PIXMAPS; i++)
+ for(i=0; i<NUM_BITMAPS; i++)
{
if (clipmask[i])
{
}
}
+#endif /* !USE_SDL_LIBRARY */
+
drawto = backbuffer = pix[PIX_DB_BACK];
fieldbuffer = pix[PIX_DB_FIELD];
SetDrawtoField(DRAW_BACKBUFFER);
- XCopyArea(display, pix[PIX_BACK], backbuffer, gc,
- 0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
- XFillRectangle(display, pix[PIX_DB_BACK], gc,
- REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
- XFillRectangle(display, pix[PIX_DB_DOOR], gc,
- 0,0, 3*DXSIZE,DYSIZE+VYSIZE);
-#endif /* !USE_SDL_LIBRARY */
+ BlitBitmap(pix[PIX_BACK], backbuffer, 0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
+ ClearRectangle(pix[PIX_DB_BACK], REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
+ ClearRectangle(pix[PIX_DB_DOOR], 0,0, 3*DXSIZE,DYSIZE+VYSIZE);
for(i=0; i<MAX_BUF_XSIZE; i++)
for(j=0; j<MAX_BUF_YSIZE; j++)
Error(ERR_EXIT, "IMG_Load() failed: %s\n", SDL_GetError());
/* create native non-transparent surface for current image */
- if ((sdl_pix[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ if ((pix[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError());
/* create native transparent surface for current image */
SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
- if ((sdl_pix_masked[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ if ((pix_masked[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError());
/* free temporary surface */
if (!pix[pos])
Error(ERR_EXIT, "cannot get graphics for '%s'", pic->picture_filename);
+
+ /* setting pix_masked[] to pix[] allows BlitBitmapMasked() to always
+ use pix_masked[], although they are the same when not using SDL */
+ pix_masked[pos] = pix[pos];
+
#endif /* !USE_SDL_LIBRARY */
}
FreeSounds(NUM_SOUNDS);
}
- for(i=0; i<NUM_PIXMAPS; i++)
+ for(i=0; i<NUM_BITMAPS; i++)
{
if (pix[i])
{
XpmFreeAttributes(&xpm_att[i]);
}
#endif
+
+#ifdef USE_SDL_LIBRARY
+ SDL_FreeSurface(pix[i]);
+#else
XFreePixmap(display,pix[i]);
+#endif
}
+
+#ifdef USE_SDL_LIBRARY
+ SDL_FreeSurface(pix_masked[i]);
+#else
if (clipmask[i])
XFreePixmap(display,clipmask[i]);
if (clip_gc[i])
XFreeGC(display, clip_gc[i]);
+#endif
}
+#ifdef USE_SDL_LIBRARY
+ KeyboardAutoRepeatOn();
+#else
if (gc)
XFreeGC(display, gc);
if (display)
{
- XAutoRepeatOn(display);
+ KeyboardAutoRepeatOn();
XCloseDisplay(display);
}
+#endif
#ifdef MSDOS
dumpErrorFile();
Display *display;
Visual *visual;
int screen;
-Window window;
-GC gc, clip_gc[NUM_PIXMAPS], tile_clip_gc;
-Pixmap pix[NUM_PIXMAPS];
-Pixmap clipmask[NUM_PIXMAPS], tile_clipmask[NUM_TILES];
+DrawWindow window;
+GC gc, clip_gc[NUM_BITMAPS], tile_clip_gc;
+Bitmap pix[NUM_BITMAPS];
+Bitmap pix_masked[NUM_BITMAPS], tile_masked[NUM_TILES];
+Pixmap clipmask[NUM_BITMAPS], tile_clipmask[NUM_TILES];
#ifdef USE_XPM_LIBRARY
XpmAttributes xpm_att[NUM_PICTURES];
#endif
-Drawable drawto, drawto_field, backbuffer, fieldbuffer;
+DrawBuffer drawto, drawto_field, backbuffer, fieldbuffer;
Colormap cmap;
-#ifdef USE_SDL_LIBRARY
-SDL_Surface *sdl_window;
-SDL_Surface *sdl_drawto, *sdl_drawto_field;
-SDL_Surface *sdl_backbuffer, *sdl_fieldbuffer;
-SDL_Surface *sdl_pix[NUM_PIXMAPS];
-SDL_Surface *sdl_pix_masked[NUM_PIXMAPS], *sdl_tile_masked[NUM_TILES];
-#endif
-
int sound_pipe[2];
int sound_device;
char *sound_device_name = SOUND_DEVICE;
{
SDL_Rect rect_src, rect_dst;
- SDLCopyArea(sdl_pix_masked[PIX_HEROES], sdl_window,
+ SDLCopyArea(pix_masked[PIX_HEROES], window,
8 * TILEX, 8 * TILEY, TILEX, TILEY, x, y);
return;
void TEST_SDL_EVENT_LOOP()
{
- SDL_Event event;
int quit_loop = 0;
SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
+ /*
while (!quit_loop && SDL_WaitEvent(&event) >=0)
+ */
+
+ while (!quit_loop)
{
- /* hier werden die Ereignisse behandelt */
- switch(event.type)
+ SDL_Event event;
+
+ if (SDL_PollEvent(&event))
{
- case SDL_QUIT:
+ /* hier werden die Ereignisse behandelt */
+ switch(event.type)
{
- quit_loop = 1;
- break;
- }
+ case SDL_QUIT:
+ {
+ quit_loop = 1;
+ break;
+ }
- case SDL_MOUSEBUTTONDOWN:
- {
- int x = event.button.x;
- int y = event.button.y;
+ case SDL_MOUSEBUTTONDOWN:
+ {
+ int x = event.button.x;
+ int y = event.button.y;
- SDL_EventState(SDL_MOUSEMOTION, SDL_ENABLE);
+ SDL_EventState(SDL_MOUSEMOTION, SDL_ENABLE);
- TEST_SDL_BLIT_RECT(x, y);
+ TEST_SDL_BLIT_RECT(x, y);
- printf("SDL_MOUSEBUTTONDOWN(%d, %d)\n", x, y);
- break;
- }
+ printf("SDL_MOUSEBUTTONDOWN(%d, %d)\n", x, y);
+ break;
+ }
- case SDL_MOUSEBUTTONUP:
- {
- int x = event.button.x;
- int y = event.button.y;
+ case SDL_MOUSEBUTTONUP:
+ {
+ int x = event.button.x;
+ int y = event.button.y;
- SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
+ SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
- printf("SDL_MOUSEBUTTONUP(%d, %d)\n", x, y);
- break;
- }
+ printf("SDL_MOUSEBUTTONUP(%d, %d)\n", x, y);
+ break;
+ }
- case SDL_MOUSEMOTION:
- {
- int x = event.motion.x;
- int y = event.motion.y;
+ case SDL_MOUSEMOTION:
+ {
+ int x = event.motion.x;
+ int y = event.motion.y;
- TEST_SDL_BLIT_RECT(x, y);
+ TEST_SDL_BLIT_RECT(x, y);
- printf("SDL_MOUSEMOTION(%d, %d)\n", x, y);
- break;
+ printf("SDL_MOUSEMOTION(%d, %d)\n", x, y);
+ break;
+ }
+
+ default:
+ break;
}
+ }
- default:
- break;
+ if (!SDL_PollEvent(NULL)) /* delay only if no pending events */
+ {
+ printf("waiting...\n");
+ Delay(100);
}
}
GetOptions(argv);
OpenAll(argc,argv);
+#if 0
#ifdef USE_SDL_LIBRARY
TEST_SDL_BLIT_RECT((WIN_XSIZE - TILEX)/2, (WIN_YSIZE - TILEY)/2);
TEST_SDL_EVENT_LOOP();
exit(0);
+#endif
#endif
EventLoop();
#define XK_MISCELLANY
#define XK_LATIN1
+/*
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/Xos.h>
#include <X11/Intrinsic.h>
#include <X11/keysymdef.h>
+*/
#ifdef XPM_INCLUDE_FILE
#define USE_XPM_LIBRARY
#include "msdos.h"
#endif /* MSDOS */
-#ifdef USE_SDL_LIBRARY
-#include "sdl.h"
-#endif
-
#ifdef DEBUG
#define DEBUG_TIMING 0
#endif
typedef unsigned char boolean;
typedef unsigned char byte;
+#include "system.h"
+
#ifndef FALSE
#define FALSE 0
#define TRUE (!FALSE)
#define PLAYER_PROTECTED(x,y) (SHIELD_ON(PLAYERINFO(x, y)) || \
PROTECTED_FIELD(x, y))
-/* Pixmaps with graphic file */
+/* Bitmaps with graphic file */
#define PIX_BACK 0
#define PIX_DOOR 1
#define PIX_HEROES 2
#define PIX_BIGFONT 7
#define PIX_SMALLFONT 8
#define PIX_MEDIUMFONT 9
-/* Pixmaps without graphic file */
+/* Bitmaps without graphic file */
#define PIX_DB_BACK 10
#define PIX_DB_DOOR 11
#define PIX_DB_FIELD 12
#define NUM_PICTURES 10
-#define NUM_PIXMAPS 13
+#define NUM_BITMAPS 13
/* boundaries of arrays etc. */
#define MAX_PLAYER_NAME_LEN 10
extern Display *display;
extern Visual *visual;
extern int screen;
-extern Window window;
+extern DrawWindow window;
extern GC gc, clip_gc[], tile_clip_gc;
-extern Pixmap pix[];
+extern Bitmap pix[];
+extern Bitmap pix_masked[], tile_masked[];
extern Pixmap clipmask[], tile_clipmask[];
#ifdef USE_XPM_LIBRARY
extern XpmAttributes xpm_att[];
#endif
-extern Drawable drawto, drawto_field, backbuffer, fieldbuffer;
+extern DrawBuffer drawto, drawto_field, backbuffer, fieldbuffer;
extern Colormap cmap;
-#ifdef USE_SDL_LIBRARY
-extern SDL_Surface *sdl_window;
-extern SDL_Surface *sdl_drawto, *sdl_drawto_field;
-extern SDL_Surface *sdl_backbuffer, *sdl_fieldbuffer;
-extern SDL_Surface *sdl_pix[];
-extern SDL_Surface *sdl_pix_masked[], *sdl_tile_masked[];
-#endif
-
extern int sound_pipe[2];
extern int sound_device;
extern char *sound_device_name;
REDRAW_MICROLEVEL)
#define REDRAWTILES_THRESHOLD (SCR_FIELDX * SCR_FIELDY / 2)
-/* areas in pixmap PIX_DOOR */
+/* areas in bitmap PIX_DOOR */
/* meaning in PIX_DB_DOOR: (3 PAGEs)
PAGEX1: 1. buffer for DOOR_1
PAGEX2: 2. buffer for DOOR_1
}
}
+inline void swap_numbers(int *i1, int *i2)
+{
+ int help = *i1;
+
+ *i1 = *i2;
+ *i2 = help;
+}
+
+inline void swap_number_pairs(int *x1, int *y1, int *x2, int *y2)
+{
+ int help_x = *x1;
+ int help_y = *y1;
+
+ *x1 = *x2;
+ *x2 = help_x;
+
+ *y1 = *y2;
+ *y2 = help_y;
+}
+
/* ------------------------------------------------------------------------- */
/* the following is only for debugging purpose and normally not used */
void sortLevelDirInfo(struct LevelDirInfo **,
int (*compare_function)(const void *, const void *));
+inline void swap_numbers(int *, int *);
+inline void swap_number_pairs(int *, int *, int *, int *);
+
void debug_print_timestamp(int, char *);
#endif /* MISC_H */
UnmapAllGadgets();
FadeSounds();
- XAutoRepeatOn(display);
+ KeyboardAutoRepeatOn();
/* needed if last screen was the playing screen, invoked from level editor */
if (level_editor_test_game)
/* needed because DrawMicroLevel() takes some time */
BackToFront();
- XSync(display, FALSE);
+ SyncDisplay();
DelayReached(&level_delay, 0); /* reset delay counter */
}
else if (x == 1 && y >= 3 && y <= 10)
int max_buffer_len = (SCR_FIELDX - 2) * 2;
int num_leveldirs = numLevelDirInfoInGroup(leveldir_current);
- XFillRectangle(display, backbuffer, gc, SX, SY, SXSIZE - 32, SYSIZE);
+ ClearRectangle(backbuffer, SX, SY, SXSIZE - 32, SYSIZE);
redraw_mask |= REDRAW_FIELD;
DrawText(SX, SY, "Level Directories", FS_BIG, FC_GREEN);
node_first = getLevelDirInfoFirstGroupEntry(leveldir_current);
node = getLevelDirInfoFromPos(node_first, leveldir_pos);
- XFillRectangle(display, drawto, gc, SX + 32, SY + 32, SXSIZE - 64, 32);
+ ClearRectangle(drawto, SX + 32, SY + 32, SXSIZE - 64, 32);
if (node->parent_link)
DrawTextFCentered(40, FC_RED, "leave group \"%s\"", node->class_desc);
while(!finished)
{
- if (XPending(display)) /* got event from X server */
+ if (PendingEvent()) /* got event */
{
- XEvent event;
+ Event event;
- XNextEvent(display, &event);
+ NextEvent(&event);
switch(event.type)
{
- case KeyPress:
+ case EVENT_KEYPRESS:
{
- KeySym key = XLookupKeysym((XKeyEvent *)&event,
- ((XKeyEvent *)&event)->state);
+ KeySym key = XLookupKeysym((KeyEvent *)&event,
+ ((KeyEvent *)&event)->state);
if (key == XK_Escape || (key == XK_Return && step_nr == 6))
{
}
break;
- case KeyRelease:
+ case EVENT_KEYRELEASE:
key_joystick_mapping = 0;
break;
while(result < 0)
{
- if (XPending(display)) /* got event from X server */
+ if (PendingEvent()) /* got event */
{
- XEvent event;
+ Event event;
- XNextEvent(display, &event);
+ NextEvent(&event);
switch(event.type)
{
- case KeyPress:
- switch(XLookupKeysym((XKeyEvent *)&event,
- ((XKeyEvent *)&event)->state))
+ case EVENT_KEYPRESS:
+ switch(XLookupKeysym((KeyEvent *)&event,
+ ((KeyEvent *)&event)->state))
{
case XK_Return:
if (check_remaining == 0)
}
break;
- case KeyRelease:
+ case EVENT_KEYRELEASE:
key_joystick_mapping = 0;
break;
static void CreateScreenScrollbuttons()
{
- Pixmap gd_pixmap = pix[PIX_MORE];
+ Bitmap gd_bitmap = pix[PIX_MORE];
struct GadgetInfo *gi;
unsigned long event_mask;
int i;
GDI_HEIGHT, height,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleScreenGadgets,
GDI_END);
for (i=0; i<NUM_SCREEN_SCROLLBARS; i++)
{
int id = scrollbar_info[i].gadget_id;
- Pixmap gd_pixmap = pix[PIX_MORE];
+ Bitmap gd_bitmap = pix[PIX_MORE];
int gd_x1, gd_x2, gd_y1, gd_y2;
struct GadgetInfo *gi;
int items_max, items_visible, item_position;
GDI_SCROLLBAR_ITEMS_VISIBLE, items_visible,
GDI_SCROLLBAR_ITEM_POSITION, item_position,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
GDI_BORDER_SIZE, SC_BORDER_SIZE,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleScreenGadgets,
#ifdef USE_SDL_LIBRARY
#include "main.h"
+#include "misc.h"
inline void SDLCopyArea(SDL_Surface *src_surface, SDL_Surface *dst_surface,
int src_x, int src_y,
SDL_MapRGB(surface->format, color_r, color_g, color_b));
}
+inline void SDLDrawSimpleLine(SDL_Surface *surface, int from_x, int from_y,
+ int to_x, int to_y, unsigned int color)
+{
+ SDL_Rect rect;
+ unsigned int color_r = (color >> 2) && 0xff;
+ unsigned int color_g = (color >> 1) && 0xff;
+ unsigned int color_b = (color >> 0) && 0xff;
+
+ if (from_x > to_x)
+ swap_numbers(&from_x, &to_x);
+
+ if (from_y > to_y)
+ swap_numbers(&from_y, &to_y);
+
+ rect.x = from_x;
+ rect.y = from_y;
+ rect.w = (to_x - from_x + 1);
+ rect.h = (to_y - from_y + 1);
+
+ SDL_FillRect(surface, &rect,
+ SDL_MapRGB(surface->format, color_r, color_g, color_b));
+}
+
#endif /* USE_SDL_LIBRARY */
* sdl.h *
***********************************************************/
-#include <SDL/SDL.h>
-#include <IMG.h>
+#ifndef SDL_H
+#define SDL_H
+
+#include "SDL.h"
+#include "IMG.h"
inline void SDLCopyArea(SDL_Surface *, SDL_Surface *,
int, int, int, int, int, int);
-inline void SDLFillRectangle(SDL_Surface *, int, int,
- int, int, unsigned int);
+inline void SDLFillRectangle(SDL_Surface *, int, int, int, int, unsigned int);
+inline void SDLDrawSimpleLine(SDL_Surface *, int, int, int, int, unsigned int);
+
+#endif /* SDL_H */
--- /dev/null
+/***********************************************************
+* Rocks'n'Diamonds -- McDuffin Strikes Back! *
+*----------------------------------------------------------*
+* ©1995 Artsoft Development *
+* Holger Schemel *
+* 33659 Bielefeld-Senne *
+* Telefon: (0521) 493245 *
+* eMail: aeglos@valinor.owl.de *
+* aeglos@uni-paderborn.de *
+* q99492@pbhrzx.uni-paderborn.de *
+*----------------------------------------------------------*
+* system.c *
+***********************************************************/
+
+#include "main.h"
+
+#ifdef USE_SDL_LIBRARY
+#include "sdl.h"
+#endif
+
+inline void ClearRectangle(Bitmap bitmap, int x, int y, int width, int height)
+{
+#ifdef USE_SDL_LIBRARY
+ SDLFillRectangle(bitmap, x, y, width, height, 0x000000);
+#else
+ XFillRectangle(display, bitmap, gc, x, y, width, height);
+#endif
+}
+
+inline void BlitBitmap(Bitmap src_bitmap, Bitmap dst_bitmap,
+ int src_x, int src_y,
+ int width, int height,
+ int dst_x, int dst_y)
+{
+#ifdef USE_SDL_LIBRARY
+ SDLCopyArea(src_bitmap, dst_bitmap,
+ src_x, src_y, width, height, dst_x, dst_y);
+#else
+ XCopyArea(display, src_bitmap, dst_bitmap, gc,
+ src_x, src_y, width, height, dst_x, dst_y);
+#endif
+}
+
+#ifndef USE_SDL_LIBRARY
+static GC last_clip_gc = 0; /* needed for XCopyArea() through clip mask */
+#endif
+
+inline void SetClipMask(GC clip_gc, Pixmap clip_pixmap)
+{
+#ifndef USE_SDL_LIBRARY
+ XSetClipMask(display, clip_gc, clip_pixmap);
+ last_clip_gc = clip_gc;
+#endif
+}
+
+inline void SetClipOrigin(GC clip_gc, int clip_x, int clip_y)
+{
+#ifndef USE_SDL_LIBRARY
+ XSetClipOrigin(display, clip_gc, clip_x, clip_y);
+ last_clip_gc = clip_gc;
+#endif
+}
+
+inline void BlitBitmapMasked(Bitmap src_bitmap, Bitmap dst_bitmap,
+ int src_x, int src_y,
+ int width, int height,
+ int dst_x, int dst_y)
+{
+#ifdef USE_SDL_LIBRARY
+ SDLCopyArea(src_bitmap, dst_bitmap,
+ src_x, src_y, width, height, dst_x, dst_y);
+#else
+ XCopyArea(display, src_bitmap, dst_bitmap, last_clip_gc,
+ src_x, src_y, width, height, dst_x, dst_y);
+#endif
+}
+
+inline void DrawSimpleWhiteLine(Bitmap bitmap, int from_x, int from_y,
+ int to_x, int to_y)
+{
+#ifdef USE_SDL_LIBRARY
+ SDLDrawSimpleLine(bitmap, from_x, from_y, to_x, to_y, 0xffffff);
+#else
+ XSetForeground(display, gc, WhitePixel(display, screen));
+ XDrawLine(display, bitmap, gc, from_x, from_y, to_x, to_y);
+ XSetForeground(display, gc, BlackPixel(display, screen));
+#endif
+}
+
+/* execute all pending screen drawing operations */
+inline void FlushDisplay()
+{
+#ifndef USE_SDL_LIBRARY
+ XFlush(display);
+#endif
+}
+
+/* execute and wait for all pending screen drawing operations */
+inline void SyncDisplay()
+{
+#ifndef USE_SDL_LIBRARY
+ XSync(display, FALSE);
+#endif
+}
+
+inline void KeyboardAutoRepeatOn()
+{
+#ifndef USE_SDL_LIBRARY
+ XAutoRepeatOn(display);
+#endif
+}
+
+inline void KeyboardAutoRepeatOff()
+{
+#ifndef USE_SDL_LIBRARY
+ XAutoRepeatOff(display);
+#endif
+}
+
+inline boolean QueryPointer(DrawWindow window, int *win_x, int *win_y)
+{
+#ifdef USE_SDL_LIBRARY
+ SDL_GetMouseState(win_x, win_y);
+ return TRUE;
+#else
+ DrawWindow root, child;
+ int root_x, root_y;
+ unsigned int mask;
+
+ /* if XQueryPointer() returns False, the pointer
+ is not on the same screen as the specified window */
+ return XQueryPointer(display, window, &root, &child, &root_x, &root_y,
+ win_x, win_y, &mask);
+#endif
+}
+
+inline boolean PendingEvent()
+{
+#ifdef USE_SDL_LIBRARY
+ return (SDL_PollEvent(NULL) ? TRUE : FALSE);
+#else
+ return (XPending(display) ? TRUE : FALSE);
+#endif
+}
+
+inline void NextEvent(Event *event)
+{
+#ifdef USE_SDL_LIBRARY
+ SDL_WaitEvent(event);
+#else
+ XNextEvent(display, event);
+#endif
+}
+
+inline void dummy()
+{
+#ifdef USE_SDL_LIBRARY
+#else
+#endif
+}
--- /dev/null
+/***********************************************************
+* Rocks'n'Diamonds -- McDuffin Strikes Back! *
+*----------------------------------------------------------*
+* ©1995 Artsoft Development *
+* Holger Schemel *
+* 33659 Bielefeld-Senne *
+* Telefon: (0521) 493245 *
+* eMail: aeglos@valinor.owl.de *
+* aeglos@uni-paderborn.de *
+* q99492@pbhrzx.uni-paderborn.de *
+*----------------------------------------------------------*
+* system.h *
+***********************************************************/
+
+#ifndef SYSTEM_H
+#define SYSTEM_H
+
+#ifndef MSDOS
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+#include <X11/Xos.h>
+#include <X11/Intrinsic.h>
+#include <X11/keysymdef.h>
+#endif
+
+#ifdef USE_SDL_LIBRARY
+#include "sdl.h"
+#endif
+
+#ifdef USE_SDL_LIBRARY
+typedef SDL_Surface *Bitmap;
+typedef SDL_Surface *DrawWindow;
+typedef SDL_Surface *DrawBuffer;
+#else
+typedef Pixmap Bitmap;
+typedef Window DrawWindow;
+typedef Drawable DrawBuffer;
+#endif
+
+#ifdef USE_SDL_LIBRARY
+
+typedef SDL_Event Event;
+typedef SDL_MouseButtonEvent ButtonEvent;
+typedef SDL_MouseMotionEvent MotionEvent;
+typedef XKeyEvent KeyEvent;
+typedef XExposeEvent ExposeEvent;
+typedef XFocusChangeEvent FocusChangeEvent;
+typedef XClientMessageEvent ClientMessageEvent;
+
+#define EVENT_BUTTONPRESS SDL_MOUSEBUTTONDOWN
+#define EVENT_BUTTONRELEASE SDL_MOUSEBUTTONUP
+#define EVENT_MOTIONNOTIFY SDL_MOUSEMOTION
+#define EVENT_KEYPRESS SDL_KEYDOWN
+#define EVENT_KEYRELEASE SDL_KEYUP
+#define EVENT_EXPOSE SDL_USEREVENT + 0
+#define EVENT_FOCUSIN SDL_USEREVENT + 1
+#define EVENT_FOCUSOUT SDL_USEREVENT + 2
+#define EVENT_CLIENTMESSAGE SDL_QUIT
+#define EVENT_MAPNOTIFY SDL_USEREVENT + 4
+#define EVENT_UNMAPNOTIFY SDL_USEREVENT + 5
+
+#else
+
+typedef XEvent Event;
+typedef XButtonEvent ButtonEvent;
+typedef XMotionEvent MotionEvent;
+typedef XKeyEvent KeyEvent;
+typedef XExposeEvent ExposeEvent;
+typedef XFocusChangeEvent FocusChangeEvent;
+typedef XClientMessageEvent ClientMessageEvent;
+
+#define EVENT_BUTTONPRESS ButtonPress
+#define EVENT_BUTTONRELEASE ButtonRelease
+#define EVENT_MOTIONNOTIFY MotionNotify
+#define EVENT_KEYPRESS KeyPress
+#define EVENT_KEYRELEASE KeyRelease
+#define EVENT_EXPOSE Expose
+#define EVENT_FOCUSIN FocusIn
+#define EVENT_FOCUSOUT FocusOut
+#define EVENT_CLIENTMESSAGE ClientMessage
+#define EVENT_MAPNOTIFY MapNotify
+#define EVENT_UNMAPNOTIFY UnmapNotify
+
+#endif
+
+inline void ClearRectangle(Bitmap, int, int, int, int);
+inline void BlitBitmap(Bitmap, Bitmap, int, int, int, int, int, int);
+inline void SetClipMask(GC, Pixmap);
+inline void SetClipOrigin(GC, int, int);
+inline void BlitBitmapMasked(Bitmap, Bitmap, int, int, int, int, int, int);
+inline void DrawSimpleWhiteLine(Bitmap, int, int, int, int);
+
+inline void FlushDisplay();
+inline void SyncDisplay();
+inline void KeyboardAutoRepeatOn();
+inline void KeyboardAutoRepeatOff();
+inline boolean QueryPointer(DrawWindow, int *, int *);
+
+inline boolean PendingEvent();
+inline void NextEvent(Event *event);
+
+#endif /* SYSTEM_H */
for (i=0; i<NUM_TAPE_BUTTONS; i++)
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap gd_bitmap = pix[PIX_DOOR];
struct GadgetInfo *gi;
int gd_xoffset, gd_yoffset;
int gd_x1, gd_x2, gd_y;
GDI_HEIGHT, TAPE_BUTTON_YSIZE,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
GDI_EVENT_MASK, GD_EVENT_RELEASED,
GDI_CALLBACK_ACTION, HandleTapeButtons,
GDI_END);
void BackToFront()
{
int x,y;
- Drawable buffer = (drawto_field == window ? backbuffer : drawto_field);
+ DrawBuffer buffer = (drawto_field == window ? backbuffer : drawto_field);
if (setup.direct_draw && game_status == PLAYING)
redraw_mask &= ~REDRAW_MAIN;
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);
+ SyncDisplay();
if (redraw_mask & REDRAW_ALL)
{
- XCopyArea(display, backbuffer, window, gc,
- 0, 0, WIN_XSIZE, WIN_YSIZE,
- 0, 0);
+ BlitBitmap(backbuffer, window, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
redraw_mask = 0;
}
{
if (game_status != PLAYING || redraw_mask & REDRAW_FROM_BACKBUFFER)
{
- XCopyArea(display, backbuffer, window, gc,
- REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE,
- REAL_SX, REAL_SY);
+ BlitBitmap(backbuffer, window,
+ REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, REAL_SX, REAL_SY);
}
else
{
ABS(ScreenMovPos) == ScrollStepSize ||
redraw_tiles > REDRAWTILES_THRESHOLD)
{
- XCopyArea(display, buffer, window, gc, fx, fy, SXSIZE, SYSIZE, SX, SY);
+ BlitBitmap(buffer, window, fx, fy, SXSIZE, SYSIZE, SX, SY);
#ifdef DEBUG
#if 0
if (redraw_mask & REDRAW_DOORS)
{
if (redraw_mask & REDRAW_DOOR_1)
- XCopyArea(display, backbuffer, window, gc,
- DX, DY, DXSIZE, DYSIZE,
- DX, DY);
+ BlitBitmap(backbuffer, window, DX, DY, DXSIZE, DYSIZE, DX, DY);
if (redraw_mask & REDRAW_DOOR_2)
{
if ((redraw_mask & REDRAW_DOOR_2) == REDRAW_DOOR_2)
- XCopyArea(display,backbuffer,window,gc,
- VX,VY, VXSIZE,VYSIZE,
- VX,VY);
+ BlitBitmap(backbuffer, window, VX,VY, VXSIZE,VYSIZE, VX,VY);
else
{
if (redraw_mask & REDRAW_VIDEO_1)
- XCopyArea(display,backbuffer,window,gc,
- VX+VIDEO_DISPLAY1_XPOS,VY+VIDEO_DISPLAY1_YPOS,
- VIDEO_DISPLAY_XSIZE,VIDEO_DISPLAY_YSIZE,
- VX+VIDEO_DISPLAY1_XPOS,VY+VIDEO_DISPLAY1_YPOS);
+ BlitBitmap(backbuffer, window,
+ VX+VIDEO_DISPLAY1_XPOS,VY+VIDEO_DISPLAY1_YPOS,
+ VIDEO_DISPLAY_XSIZE,VIDEO_DISPLAY_YSIZE,
+ VX+VIDEO_DISPLAY1_XPOS,VY+VIDEO_DISPLAY1_YPOS);
if (redraw_mask & REDRAW_VIDEO_2)
- XCopyArea(display,backbuffer,window,gc,
- VX+VIDEO_DISPLAY2_XPOS,VY+VIDEO_DISPLAY2_YPOS,
- VIDEO_DISPLAY_XSIZE,VIDEO_DISPLAY_YSIZE,
- VX+VIDEO_DISPLAY2_XPOS,VY+VIDEO_DISPLAY2_YPOS);
+ BlitBitmap(backbuffer, window,
+ VX+VIDEO_DISPLAY2_XPOS,VY+VIDEO_DISPLAY2_YPOS,
+ VIDEO_DISPLAY_XSIZE,VIDEO_DISPLAY_YSIZE,
+ VX+VIDEO_DISPLAY2_XPOS,VY+VIDEO_DISPLAY2_YPOS);
if (redraw_mask & REDRAW_VIDEO_3)
- XCopyArea(display,backbuffer,window,gc,
- VX+VIDEO_CONTROL_XPOS,VY+VIDEO_CONTROL_YPOS,
- VIDEO_CONTROL_XSIZE,VIDEO_CONTROL_YSIZE,
- VX+VIDEO_CONTROL_XPOS,VY+VIDEO_CONTROL_YPOS);
+ BlitBitmap(backbuffer, window,
+ VX+VIDEO_CONTROL_XPOS,VY+VIDEO_CONTROL_YPOS,
+ VIDEO_CONTROL_XSIZE,VIDEO_CONTROL_YSIZE,
+ 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);
+ BlitBitmap(backbuffer, window, EX, EY, EXSIZE, EYSIZE, EX, EY);
redraw_mask &= ~REDRAW_DOORS;
}
if (redraw_mask & REDRAW_MICROLEVEL)
{
- XCopyArea(display,backbuffer,window,gc,
- MICROLEV_XPOS, MICROLEV_YPOS, MICROLEV_XSIZE, MICROLEV_YSIZE,
- MICROLEV_XPOS, MICROLEV_YPOS);
- XCopyArea(display,backbuffer,window,gc,
- SX, MICROLABEL_YPOS, SXSIZE, FONT4_YSIZE,
- SX, MICROLABEL_YPOS);
+ BlitBitmap(backbuffer, window,
+ MICROLEV_XPOS, MICROLEV_YPOS, MICROLEV_XSIZE, MICROLEV_YSIZE,
+ MICROLEV_XPOS, MICROLEV_YPOS);
+ BlitBitmap(backbuffer, window,
+ SX, MICROLABEL_YPOS, SXSIZE, FONT4_YSIZE,
+ SX, MICROLABEL_YPOS);
redraw_mask &= ~REDRAW_MICROLEVEL;
}
for(x=0; x<SCR_FIELDX; x++)
for(y=0; y<SCR_FIELDY; y++)
if (redraw[redraw_x1 + x][redraw_y1 + y])
- XCopyArea(display, buffer, window, gc,
- FX + x * TILEX, FX + y * TILEY, TILEX, TILEY,
- SX + x * TILEX, SY + y * TILEY);
+ BlitBitmap(buffer, window,
+ FX + x * TILEX, FX + y * TILEY, TILEX, TILEY,
+ SX + x * TILEX, SY + y * TILEY);
}
- XFlush(display);
+ FlushDisplay();
for(x=0; x<MAX_BUF_XSIZE; x++)
for(y=0; y<MAX_BUF_YSIZE; y++)
void FadeToFront()
{
-/*
+#if 0
long fading_delay = 300;
if (setup.fading && (redraw_mask & REDRAW_FIELD))
{
-*/
+#endif
-/*
+#if 0
int x,y;
- XFillRectangle(display,window,gc,
- REAL_SX,REAL_SY,FULL_SXSIZE,FULL_SYSIZE);
- XFlush(display);
+ ClearRectangle(window, REAL_SX,REAL_SY,FULL_SXSIZE,FULL_SYSIZE);
+ FlushDisplay();
for(i=0;i<2*FULL_SYSIZE;i++)
{
for(y=0;y<FULL_SYSIZE;y++)
{
- XCopyArea(display,backbuffer,window,gc,
- REAL_SX,REAL_SY+i, FULL_SXSIZE,1, REAL_SX,REAL_SY+i);
+ BlitBitmap(backbuffer, window,
+ REAL_SX,REAL_SY+i, FULL_SXSIZE,1, REAL_SX,REAL_SY+i);
}
- XFlush(display);
+ FlushDisplay();
Delay(10);
}
-*/
+#endif
-/*
+#if 0
for(i=1;i<FULL_SYSIZE;i+=2)
- XCopyArea(display,backbuffer,window,gc,
- REAL_SX,REAL_SY+i, FULL_SXSIZE,1, REAL_SX,REAL_SY+i);
- XFlush(display);
+ BlitBitmap(backbuffer, window,
+ REAL_SX,REAL_SY+i, FULL_SXSIZE,1, REAL_SX,REAL_SY+i);
+ FlushDisplay();
Delay(fading_delay);
-*/
+#endif
-/*
- XSetClipOrigin(display,clip_gc[PIX_FADEMASK],0,0);
- XCopyArea(display,backbuffer,window,clip_gc[PIX_FADEMASK],
- REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE, REAL_SX,REAL_SY);
- XFlush(display);
+#if 0
+ SetClipOrigin(clip_gc[PIX_FADEMASK], 0, 0);
+ BlitBitmapMasked(backbuffer, window,
+ REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE,
+ REAL_SX,REAL_SY);
+ FlushDisplay();
Delay(fading_delay);
- XSetClipOrigin(display,clip_gc[PIX_FADEMASK],-1,-1);
- XCopyArea(display,backbuffer,window,clip_gc[PIX_FADEMASK],
- REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE, REAL_SX,REAL_SY);
- XFlush(display);
+ SetClipOrigin(clip_gc[PIX_FADEMASK], -1, -1);
+ BlitBitmapMasked(backbuffer, window,
+ REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE,
+ REAL_SX,REAL_SY);
+ FlushDisplay();
Delay(fading_delay);
- XSetClipOrigin(display,clip_gc[PIX_FADEMASK],0,-1);
- XCopyArea(display,backbuffer,window,clip_gc[PIX_FADEMASK],
- REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE, REAL_SX,REAL_SY);
- XFlush(display);
+ SetClipOrigin(clip_gc[PIX_FADEMASK], 0, -1);
+ BlitBitmapMasked(backbuffer, window,
+ REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE,
+ REAL_SX,REAL_SY);
+ FlushDisplay();
Delay(fading_delay);
- XSetClipOrigin(display,clip_gc[PIX_FADEMASK],-1,0);
- XCopyArea(display,backbuffer,window,clip_gc[PIX_FADEMASK],
- REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE, REAL_SX,REAL_SY);
- XFlush(display);
+ SetClipOrigin(clip_gc[PIX_FADEMASK], -1, 0);
+ BlitBitmapMasked(backbuffer, window,
+ REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE,
+ REAL_SX,REAL_SY);
+ FlushDisplay();
Delay(fading_delay);
redraw_mask &= ~REDRAW_MAIN;
}
-*/
+#endif
BackToFront();
}
void ClearWindow()
{
- XFillRectangle(display, backbuffer, gc,
- REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
+ ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
if (setup.soft_scrolling && game_status == PLAYING)
{
- XFillRectangle(display, fieldbuffer, gc, 0, 0, FXSIZE, FYSIZE);
+ ClearRectangle(fieldbuffer, 0, 0, FXSIZE, FYSIZE);
SetDrawtoField(DRAW_BUFFERED);
}
else
if (setup.direct_draw && game_status == PLAYING)
{
- XFillRectangle(display, window, gc,
- REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
+ ClearRectangle(window, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
SetDrawtoField(DRAW_DIRECT);
}
void DrawInitText(char *text, int ypos, int color)
{
#ifdef USE_SDL_LIBRARY
- if (sdl_window && sdl_pix[PIX_SMALLFONT])
+ if (window && pix[PIX_SMALLFONT])
{
- SDLFillRectangle(sdl_window, 0, ypos, WIN_XSIZE, FONT2_YSIZE, 0x000000);
+ ClearRectangle(window, 0, ypos, WIN_XSIZE, FONT2_YSIZE);
DrawTextExt(window, gc, (WIN_XSIZE - strlen(text) * FONT2_XSIZE)/2,
- ypos,text,FS_SMALL,color);
- SDL_Flip(sdl_window);
+ ypos, text, FS_SMALL, color);
+ SDL_Flip(window);
}
#else
if (display && window && pix[PIX_SMALLFONT])
{
- XFillRectangle(display, window, gc, 0, ypos, WIN_XSIZE, FONT2_YSIZE);
+ ClearRectangle(window, 0, ypos, WIN_XSIZE, FONT2_YSIZE);
DrawTextExt(window, gc, (WIN_XSIZE - strlen(text) * FONT2_XSIZE)/2,
- ypos,text,FS_SMALL,color);
- XFlush(display);
+ ypos, text, FS_SMALL, color);
+ FlushDisplay();
}
#endif
}
redraw_mask |= REDRAW_DOOR_1;
}
-void DrawTextExt(Drawable d, GC gc, int x, int y,
+void DrawTextExt(DrawBuffer d, GC gc, int x, int y,
char *text, int font_size, int font_type)
{
int font_width, font_height, font_start;
- int font_pixmap;
+ int font_bitmap;
boolean print_inverse = FALSE;
if (font_size != FS_SMALL && font_size != FS_BIG && font_size != FS_MEDIUM)
font_width = getFontWidth(font_size, font_type);
font_height = getFontHeight(font_size, font_type);
- font_pixmap = (font_size == FS_BIG ? PIX_BIGFONT :
+ font_bitmap = (font_size == FS_BIG ? PIX_BIGFONT :
font_size == FS_MEDIUM ? PIX_MEDIUMFONT :
PIX_SMALLFONT);
font_start = (font_type * (font_size == FS_BIG ? FONT1_YSIZE :
if (print_inverse)
{
- XCopyArea(display, pix[font_pixmap], d, gc,
- FONT_CHARS_PER_LINE * font_width,
- 3 * font_height + font_start,
- font_width, font_height, x, y);
-
- XSetClipOrigin(display, clip_gc[font_pixmap],
- dest_x - src_x, dest_y - src_y);
- XCopyArea(display, pix[font_pixmap], d, clip_gc[font_pixmap],
- 0, 0, font_width, font_height, dest_x, dest_y);
+ BlitBitmap(pix[font_bitmap], d,
+ FONT_CHARS_PER_LINE * font_width,
+ 3 * font_height + font_start,
+ font_width, font_height, x, y);
+
+ SetClipOrigin(clip_gc[font_bitmap], dest_x - src_x, dest_y - src_y);
+ BlitBitmapMasked(pix_masked[font_bitmap], d,
+ 0, 0, font_width, font_height, dest_x, dest_y);
}
else
- {
-#ifdef USE_SDL_LIBRARY
- SDLCopyArea(sdl_pix[font_pixmap], sdl_window,
- src_x, src_y, font_width, font_height, dest_x, dest_y);
-#else
- XCopyArea(display, pix[font_pixmap], d, gc,
- src_x, src_y, font_width, font_height, dest_x, dest_y);
-#endif
- }
+ BlitBitmap(pix[font_bitmap], d,
+ src_x, src_y, font_width, font_height, dest_x, dest_y);
}
x += font_width;
int x_size = TILEX * (1 + ABS(jx - last_jx));
int y_size = TILEY * (1 + ABS(jy - last_jy));
- XCopyArea(display, drawto_field, window, gc,
- dest_x, dest_y, x_size, y_size, dest_x, dest_y);
+ BlitBitmap(drawto_field, window,
+ dest_x, dest_y, x_size, y_size, dest_x, dest_y);
SetDrawtoField(DRAW_DIRECT);
}
DrawGraphicShiftedThruMask(sx, sy, sxx, syy, graphic + phase, NO_CUTTING);
}
-void getGraphicSource(int graphic, int *pixmap_nr, int *x, int *y)
+void getGraphicSource(int graphic, int *bitmap_nr, int *x, int *y)
{
if (graphic >= GFX_START_ROCKSSCREEN && graphic <= GFX_END_ROCKSSCREEN)
{
graphic -= GFX_START_ROCKSSCREEN;
- *pixmap_nr = PIX_BACK;
+ *bitmap_nr = PIX_BACK;
*x = SX + (graphic % GFX_PER_LINE) * TILEX;
*y = SY + (graphic / GFX_PER_LINE) * TILEY;
}
else if (graphic >= GFX_START_ROCKSHEROES && graphic <= GFX_END_ROCKSHEROES)
{
graphic -= GFX_START_ROCKSHEROES;
- *pixmap_nr = PIX_HEROES;
+ *bitmap_nr = PIX_HEROES;
*x = (graphic % HEROES_PER_LINE) * TILEX;
*y = (graphic / HEROES_PER_LINE) * TILEY;
}
else if (graphic >= GFX_START_ROCKSSP && graphic <= GFX_END_ROCKSSP)
{
graphic -= GFX_START_ROCKSSP;
- *pixmap_nr = PIX_SP;
+ *bitmap_nr = PIX_SP;
*x = (graphic % SP_PER_LINE) * TILEX;
*y = (graphic / SP_PER_LINE) * TILEY;
}
else if (graphic >= GFX_START_ROCKSDC && graphic <= GFX_END_ROCKSDC)
{
graphic -= GFX_START_ROCKSDC;
- *pixmap_nr = PIX_DC;
+ *bitmap_nr = PIX_DC;
*x = (graphic % DC_PER_LINE) * TILEX;
*y = (graphic / DC_PER_LINE) * TILEY;
}
else if (graphic >= GFX_START_ROCKSMORE && graphic <= GFX_END_ROCKSMORE)
{
graphic -= GFX_START_ROCKSMORE;
- *pixmap_nr = PIX_MORE;
+ *bitmap_nr = PIX_MORE;
*x = (graphic % MORE_PER_LINE) * TILEX;
*y = (graphic / MORE_PER_LINE) * TILEY;
}
else if (graphic >= GFX_START_ROCKSFONT && graphic <= GFX_END_ROCKSFONT)
{
graphic -= GFX_START_ROCKSFONT;
- *pixmap_nr = PIX_BIGFONT;
+ *bitmap_nr = PIX_BIGFONT;
*x = (graphic % FONT_CHARS_PER_LINE) * TILEX;
*y = ((graphic / FONT_CHARS_PER_LINE) * TILEY +
FC_SPECIAL1 * FONT_LINES_PER_FONT * TILEY);
}
else
{
- *pixmap_nr = PIX_SP;
+ *bitmap_nr = PIX_SP;
*x = 0;
*y = 0;
}
MarkTileDirty(x,y);
}
-void DrawGraphicExt(Drawable d, GC gc, int x, int y, int graphic)
+void DrawGraphicExt(DrawBuffer d, GC gc, int x, int y, int graphic)
{
- int pixmap_nr;
+ int bitmap_nr;
int src_x, src_y;
- getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
- XCopyArea(display, pix[pixmap_nr], d, gc,
- src_x, src_y, TILEX, TILEY, x, y);
+ getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
+ BlitBitmap(pix[bitmap_nr], d, src_x, src_y, TILEX, TILEY, x, y);
}
void DrawGraphicThruMask(int x, int y, int graphic)
MarkTileDirty(x,y);
}
-void DrawGraphicThruMaskExt(Drawable d, int dest_x, int dest_y, int graphic)
+void DrawGraphicThruMaskExt(DrawBuffer d, int dest_x, int dest_y, int graphic)
{
int tile = graphic;
- int pixmap_nr;
+ int bitmap_nr;
int src_x, src_y;
- Pixmap src_pixmap;
+ Bitmap src_bitmap;
GC drawing_gc;
if (graphic == GFX_LEERRAUM)
return;
- getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
- src_pixmap = pix[pixmap_nr];
- drawing_gc = clip_gc[pixmap_nr];
+ getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
+ src_bitmap = pix_masked[bitmap_nr];
+ drawing_gc = clip_gc[bitmap_nr];
if (tile_clipmask[tile] != None)
{
- XSetClipMask(display, tile_clip_gc, tile_clipmask[tile]);
- XSetClipOrigin(display, tile_clip_gc, dest_x, dest_y);
- XCopyArea(display, src_pixmap, d, tile_clip_gc,
- src_x, src_y, TILEX, TILEY, dest_x, dest_y);
+ SetClipMask(tile_clip_gc, tile_clipmask[tile]);
+ SetClipOrigin(tile_clip_gc, dest_x, dest_y);
+ BlitBitmapMasked(src_bitmap, d,
+ src_x, src_y, TILEX, TILEY, dest_x, dest_y);
}
else
{
#if DEBUG
+#ifndef USE_SDL_LIBRARY
printf("DrawGraphicThruMask(): tile '%d' needs clipping!\n", tile);
+#endif
#endif
- XSetClipOrigin(display, drawing_gc, dest_x-src_x, dest_y-src_y);
- XCopyArea(display, src_pixmap, d, drawing_gc,
- src_x, src_y, TILEX, TILEY, dest_x, dest_y);
+ SetClipOrigin(drawing_gc, dest_x-src_x, dest_y-src_y);
+ BlitBitmapMasked(src_bitmap, d,
+ src_x, src_y, TILEX, TILEY, dest_x, dest_y);
}
}
MarkTileDirty(x/2, y/2);
}
-void getMiniGraphicSource(int graphic, Pixmap *pixmap, int *x, int *y)
+void getMiniGraphicSource(int graphic, Bitmap *bitmap, int *x, int *y)
{
if (graphic >= GFX_START_ROCKSSCREEN && graphic <= GFX_END_ROCKSSCREEN)
{
graphic -= GFX_START_ROCKSSCREEN;
- *pixmap = pix[PIX_BACK];
+ *bitmap = pix[PIX_BACK];
*x = MINI_GFX_STARTX + (graphic % MINI_GFX_PER_LINE) * MINI_TILEX;
*y = MINI_GFX_STARTY + (graphic / MINI_GFX_PER_LINE) * MINI_TILEY;
}
{
graphic -= GFX_START_ROCKSSP;
graphic -= ((graphic / SP_PER_LINE) * SP_PER_LINE) / 2;
- *pixmap = pix[PIX_SP];
+ *bitmap = pix[PIX_SP];
*x = MINI_SP_STARTX + (graphic % MINI_SP_PER_LINE) * MINI_TILEX;
*y = MINI_SP_STARTY + (graphic / MINI_SP_PER_LINE) * MINI_TILEY;
}
else if (graphic >= GFX_START_ROCKSDC && graphic <= GFX_END_ROCKSDC)
{
graphic -= GFX_START_ROCKSDC;
- *pixmap = pix[PIX_DC];
+ *bitmap = pix[PIX_DC];
*x = MINI_DC_STARTX + (graphic % MINI_DC_PER_LINE) * MINI_TILEX;
*y = MINI_DC_STARTY + (graphic / MINI_DC_PER_LINE) * MINI_TILEY;
}
else if (graphic >= GFX_START_ROCKSMORE && graphic <= GFX_END_ROCKSMORE)
{
graphic -= GFX_START_ROCKSMORE;
- *pixmap = pix[PIX_MORE];
+ *bitmap = pix[PIX_MORE];
*x = MINI_MORE_STARTX + (graphic % MINI_MORE_PER_LINE) * MINI_TILEX;
*y = MINI_MORE_STARTY + (graphic / MINI_MORE_PER_LINE) * MINI_TILEY;
}
else if (graphic >= GFX_START_ROCKSFONT && graphic <= GFX_END_ROCKSFONT)
{
graphic -= GFX_START_ROCKSFONT;
- *pixmap = pix[PIX_SMALLFONT];
+ *bitmap = pix[PIX_SMALLFONT];
*x = (graphic % FONT_CHARS_PER_LINE) * FONT4_XSIZE;
*y = ((graphic / FONT_CHARS_PER_LINE) * FONT4_YSIZE +
FC_SPECIAL2 * FONT2_YSIZE * FONT_LINES_PER_FONT);
}
else
{
- *pixmap = pix[PIX_SP];
+ *bitmap = pix[PIX_SP];
*x = MINI_SP_STARTX;
*y = MINI_SP_STARTY;
}
}
-void DrawMiniGraphicExt(Drawable d, GC gc, int x, int y, int graphic)
+void DrawMiniGraphicExt(DrawBuffer d, GC gc, int x, int y, int graphic)
{
- Pixmap pixmap;
+ Bitmap bitmap;
int src_x, src_y;
- getMiniGraphicSource(graphic, &pixmap, &src_x, &src_y);
- XCopyArea(display, pixmap, d, gc,
- src_x, src_y, MINI_TILEX, MINI_TILEY, x, y);
+ getMiniGraphicSource(graphic, &bitmap, &src_x, &src_y);
+ BlitBitmap(bitmap, d, src_x, src_y, MINI_TILEX, MINI_TILEY, x, y);
}
void DrawGraphicShifted(int x,int y, int dx,int dy, int graphic,
int cx = 0, cy = 0;
int src_x, src_y, dest_x, dest_y;
int tile = graphic;
- int pixmap_nr;
- Pixmap src_pixmap;
+ int bitmap_nr;
GC drawing_gc;
if (graphic < 0)
MarkTileDirty(x, y + SIGN(dy));
}
- getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
- src_pixmap = pix[pixmap_nr];
- drawing_gc = clip_gc[pixmap_nr];
+ getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
+ drawing_gc = clip_gc[bitmap_nr];
src_x += cx;
src_y += cy;
{
if (tile_clipmask[tile] != None)
{
- XSetClipMask(display, tile_clip_gc, tile_clipmask[tile]);
- XSetClipOrigin(display, tile_clip_gc, dest_x, dest_y);
- XCopyArea(display, src_pixmap, drawto_field, tile_clip_gc,
- src_x, src_y, TILEX, TILEY, dest_x, dest_y);
+ SetClipMask(tile_clip_gc, tile_clipmask[tile]);
+ SetClipOrigin(tile_clip_gc, dest_x, dest_y);
+ BlitBitmapMasked(pix_masked[bitmap_nr], drawto_field,
+ src_x, src_y, TILEX, TILEY, dest_x, dest_y);
}
else
{
#if DEBUG
+#ifndef USE_SDL_LIBRARY
printf("DrawGraphicShifted(): tile '%d' needs clipping!\n", tile);
+#endif
#endif
- XSetClipOrigin(display, drawing_gc, dest_x - src_x, dest_y - src_y);
- XCopyArea(display, src_pixmap, drawto_field, drawing_gc,
- src_x, src_y, width, height, dest_x, dest_y);
+ SetClipOrigin(drawing_gc, dest_x - src_x, dest_y - src_y);
+ BlitBitmapMasked(pix_masked[bitmap_nr], drawto_field,
+ src_x, src_y, width, height, dest_x, dest_y);
}
}
else
- XCopyArea(display, src_pixmap, drawto_field, gc,
- src_x, src_y, width, height, dest_x, dest_y);
+ BlitBitmap(pix[bitmap_nr], drawto_field,
+ src_x, src_y, width, height, dest_x, dest_y);
MarkTileDirty(x,y);
}
cy = (i == 3 ? TILEY - snip : 0);
}
- XCopyArea(display, pix[PIX_BACK], drawto_field, gc,
- SX + (graphic % GFX_PER_LINE) * TILEX + cx,
- SY + (graphic / GFX_PER_LINE) * TILEY + cy,
- width, height, FX + x * TILEX + cx, FY + y * TILEY + cy);
+ BlitBitmap(pix[PIX_BACK], drawto_field,
+ SX + (graphic % GFX_PER_LINE) * TILEX + cx,
+ SY + (graphic / GFX_PER_LINE) * TILEY + cy,
+ width, height, FX + x * TILEX + cx, FY + y * TILEY + cy);
}
MarkTileDirty(x, y);
cy = (i==0 ? TILEY-snip : 0);
}
- XCopyArea(display, pix[PIX_BACK], drawto_field, gc,
- SX + (graphic % GFX_PER_LINE) * TILEX + cx,
- SY + (graphic / GFX_PER_LINE) * TILEY + cy,
- width, height, FX + xx * TILEX + cx, FY + yy * TILEY + cy);
+ BlitBitmap(pix[PIX_BACK], drawto_field,
+ SX + (graphic % GFX_PER_LINE) * TILEX + cx,
+ SY + (graphic / GFX_PER_LINE) * TILEY + cy,
+ width, height, FX + xx * TILEX + cx, FY + yy * TILEY + cy);
MarkTileDirty(xx, yy);
}
{
graphic -= GFX_START_ROCKSSP;
graphic -= ((graphic / SP_PER_LINE) * SP_PER_LINE) / 2;
- XCopyArea(display, pix[PIX_SP], drawto, gc,
- MICRO_SP_STARTX + (graphic % MICRO_SP_PER_LINE) * MICRO_TILEX,
- MICRO_SP_STARTY + (graphic / MICRO_SP_PER_LINE) * MICRO_TILEY,
- MICRO_TILEX, MICRO_TILEY, xpos, ypos);
+ BlitBitmap(pix[PIX_SP], drawto,
+ MICRO_SP_STARTX + (graphic % MICRO_SP_PER_LINE) * MICRO_TILEX,
+ MICRO_SP_STARTY + (graphic / MICRO_SP_PER_LINE) * MICRO_TILEY,
+ MICRO_TILEX, MICRO_TILEY, xpos, ypos);
}
else if (graphic >= GFX_START_ROCKSDC && graphic <= GFX_END_ROCKSDC)
{
graphic -= GFX_START_ROCKSDC;
- XCopyArea(display, pix[PIX_DC], drawto, gc,
- MICRO_DC_STARTX + (graphic % MICRO_DC_PER_LINE) * MICRO_TILEX,
- MICRO_DC_STARTY + (graphic / MICRO_DC_PER_LINE) * MICRO_TILEY,
- MICRO_TILEX, MICRO_TILEY, xpos, ypos);
+ BlitBitmap(pix[PIX_DC], drawto,
+ MICRO_DC_STARTX + (graphic % MICRO_DC_PER_LINE) * MICRO_TILEX,
+ MICRO_DC_STARTY + (graphic / MICRO_DC_PER_LINE) * MICRO_TILEY,
+ MICRO_TILEX, MICRO_TILEY, xpos, ypos);
}
else 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);
+ BlitBitmap(pix[PIX_MORE], drawto,
+ 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);
+ BlitBitmap(pix[PIX_BACK], drawto,
+ 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 x, y;
- XFillRectangle(display, drawto, gc,
- xpos, ypos, MICROLEV_XSIZE, MICROLEV_YSIZE);
+ ClearRectangle(drawto, xpos, ypos, MICROLEV_XSIZE, MICROLEV_YSIZE);
if (lev_fieldx < STD_LEV_FIELDX)
xpos += (STD_LEV_FIELDX - lev_fieldx) / 2 * MICRO_TILEX;
{
char label_text[MAX_MICROLABEL_SIZE + 1];
- XFillRectangle(display, drawto,gc,
- SX, MICROLABEL_YPOS, SXSIZE, FONT4_YSIZE);
+ ClearRectangle(drawto, SX, MICROLABEL_YPOS, SXSIZE, FONT4_YSIZE);
strncpy(label_text, (mode == MICROLABEL_LEVEL_NAME ? level.name :
mode == MICROLABEL_CREATED_BY ? "created by" :
CloseDoor(DOOR_CLOSE_1);
/* save old door content */
- XCopyArea(display, pix[PIX_DB_DOOR], pix[PIX_DB_DOOR], gc,
- DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE,
- DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1);
+ BlitBitmap(pix[PIX_DB_DOOR], pix[PIX_DB_DOOR],
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE,
+ DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1);
/* clear door drawing field */
- XFillRectangle(display, drawto, gc, DX, DY, DXSIZE, DYSIZE);
+ ClearRectangle(drawto, DX, DY, DXSIZE, DYSIZE);
/* write text for request */
for(ty=0; ty<13; ty++)
}
/* copy request gadgets to door backbuffer */
- XCopyArea(display, drawto, pix[PIX_DB_DOOR], gc,
- DX, DY, DXSIZE, DYSIZE,
- DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ BlitBitmap(drawto, pix[PIX_DB_DOOR],
+ DX, DY, DXSIZE, DYSIZE,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
OpenDoor(DOOR_OPEN_1);
while(result < 0)
{
- if (XPending(display))
+ if (PendingEvent())
{
- XEvent event;
+ Event event;
- XNextEvent(display, &event);
+ NextEvent(&event);
switch(event.type)
{
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
+ case EVENT_BUTTONPRESS:
+ case EVENT_BUTTONRELEASE:
+ case EVENT_MOTIONNOTIFY:
{
- if (event.type == MotionNotify)
+ if (event.type == EVENT_MOTIONNOTIFY)
{
- Window root, child;
- int root_x, root_y;
int win_x, win_y;
- unsigned int mask;
- if (!XQueryPointer(display, window, &root, &child,
- &root_x, &root_y, &win_x, &win_y, &mask))
- continue;
+ if (!QueryPointer(window, &win_x, &win_y))
+ continue; /* window and pointer are on different screens */
if (!button_status)
continue;
motion_status = TRUE;
- mx = ((XMotionEvent *) &event)->x;
- my = ((XMotionEvent *) &event)->y;
+ mx = ((MotionEvent *) &event)->x;
+ my = ((MotionEvent *) &event)->y;
}
else
{
motion_status = FALSE;
- mx = ((XButtonEvent *) &event)->x;
- my = ((XButtonEvent *) &event)->y;
- if (event.type==ButtonPress)
- button_status = ((XButtonEvent *) &event)->button;
+ mx = ((ButtonEvent *) &event)->x;
+ my = ((ButtonEvent *) &event)->y;
+ if (event.type == EVENT_BUTTONPRESS)
+ button_status = ((ButtonEvent *) &event)->button;
else
button_status = MB_RELEASED;
}
break;
}
- case KeyPress:
- switch(XLookupKeysym((XKeyEvent *)&event,
- ((XKeyEvent *)&event)->state))
+ case EVENT_KEYPRESS:
+ switch(XLookupKeysym((KeyEvent *)&event,
+ ((KeyEvent *)&event)->state))
{
case XK_Return:
result = 1;
result = 0;
break;
- case KeyRelease:
+ case EVENT_KEYRELEASE:
key_joystick_mapping = 0;
break;
if (!(req_state & REQ_STAY_CLOSED) && (old_door_state & DOOR_OPEN_1))
{
- XCopyArea(display,pix[PIX_DB_DOOR],pix[PIX_DB_DOOR],gc,
- DOOR_GFX_PAGEX2,DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
- DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY1);
+ BlitBitmap(pix[PIX_DB_DOOR], pix[PIX_DB_DOOR],
+ DOOR_GFX_PAGEX2,DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
+ DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY1);
OpenDoor(DOOR_OPEN_1);
}
}
if (door_state & DOOR_COPY_BACK)
{
- XCopyArea(display, pix[PIX_DB_DOOR], pix[PIX_DB_DOOR], gc,
- DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE + VYSIZE,
- DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ BlitBitmap(pix[PIX_DB_DOOR], pix[PIX_DB_DOOR],
+ DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE + VYSIZE,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
door_state &= ~DOOR_COPY_BACK;
}
{
unsigned int new_door_state;
- XCopyArea(display, backbuffer, pix[PIX_DB_DOOR], gc,
- DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
- XCopyArea(display, backbuffer, pix[PIX_DB_DOOR], gc,
- VX, VY, VXSIZE, VYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY2);
+ BlitBitmap(backbuffer, pix[PIX_DB_DOOR],
+ DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ BlitBitmap(backbuffer, pix[PIX_DB_DOOR],
+ VX, VY, VXSIZE, VYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY2);
new_door_state = MoveDoor(door_state);
int i = (door_state & DOOR_OPEN_1 ? DXSIZE-x : x);
int j = (DXSIZE - i) / 3;
- XCopyArea(display, pix[PIX_DB_DOOR], drawto, gc,
- DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1 + i/2,
- DXSIZE,DYSIZE - i/2, DX, DY);
-
- XFillRectangle(display, drawto, gc, DX, DY + DYSIZE - i/2, DXSIZE,i/2);
-
- XSetClipOrigin(display, clip_gc[PIX_DOOR],
- DX - i, (DY + j) - DOOR_GFX_PAGEY1);
- XCopyArea(display, pix[PIX_DOOR], drawto,clip_gc[PIX_DOOR],
- DXSIZE, DOOR_GFX_PAGEY1, i, 77, DX + DXSIZE - i, DY + j);
- XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
- DXSIZE, DOOR_GFX_PAGEY1 + 140, i, 63, DX + DXSIZE - i,
- DY + 140 + j);
- XSetClipOrigin(display, clip_gc[PIX_DOOR],
- DX - DXSIZE + i, DY - (DOOR_GFX_PAGEY1 + j));
- XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
- DXSIZE - i, DOOR_GFX_PAGEY1 + j, i, 77 - j, DX, DY);
- XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
- DXSIZE-i, DOOR_GFX_PAGEY1 + 140, i, 63, DX, DY + 140 - j);
-
- XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
- DXSIZE - i, DOOR_GFX_PAGEY1 + 77, i, 63,
- DX, DY + 77 - j);
- XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
- DXSIZE - i, DOOR_GFX_PAGEY1 + 203, i, 77,
- DX, DY + 203 - j);
- XSetClipOrigin(display, clip_gc[PIX_DOOR],
- DX - i, (DY + j) - DOOR_GFX_PAGEY1);
- XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
- DXSIZE, DOOR_GFX_PAGEY1 + 77, i, 63,
- DX + DXSIZE - i, DY + 77 + j);
- XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
- DXSIZE, DOOR_GFX_PAGEY1 + 203, i, 77 - j,
- DX + DXSIZE - i, DY + 203 + j);
+ BlitBitmap(pix[PIX_DB_DOOR], drawto,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1 + i/2,
+ DXSIZE,DYSIZE - i/2, DX, DY);
+
+ ClearRectangle(drawto, DX, DY + DYSIZE - i/2, DXSIZE,i/2);
+
+ SetClipOrigin(clip_gc[PIX_DOOR], DX - i, (DY + j) - DOOR_GFX_PAGEY1);
+ BlitBitmapMasked(pix_masked[PIX_DOOR], drawto,
+ DXSIZE, DOOR_GFX_PAGEY1, i, 77,
+ DX + DXSIZE - i, DY + j);
+ BlitBitmapMasked(pix_masked[PIX_DOOR], drawto,
+ DXSIZE, DOOR_GFX_PAGEY1 + 140, i, 63,
+ DX + DXSIZE - i, DY + 140 + j);
+ SetClipOrigin(clip_gc[PIX_DOOR],
+ DX - DXSIZE + i, DY - (DOOR_GFX_PAGEY1 + j));
+ BlitBitmapMasked(pix_masked[PIX_DOOR], drawto,
+ DXSIZE - i, DOOR_GFX_PAGEY1 + j, i, 77 - j,
+ DX, DY);
+ BlitBitmapMasked(pix_masked[PIX_DOOR], drawto,
+ DXSIZE-i, DOOR_GFX_PAGEY1 + 140, i, 63,
+ DX, DY + 140 - j);
+
+ BlitBitmapMasked(pix_masked[PIX_DOOR], drawto,
+ DXSIZE - i, DOOR_GFX_PAGEY1 + 77, i, 63,
+ DX, DY + 77 - j);
+ BlitBitmapMasked(pix_masked[PIX_DOOR], drawto,
+ DXSIZE - i, DOOR_GFX_PAGEY1 + 203, i, 77,
+ DX, DY + 203 - j);
+ SetClipOrigin(clip_gc[PIX_DOOR], DX - i, (DY + j) - DOOR_GFX_PAGEY1);
+ BlitBitmapMasked(pix_masked[PIX_DOOR], drawto,
+ DXSIZE, DOOR_GFX_PAGEY1 + 77, i, 63,
+ DX + DXSIZE - i, DY + 77 + j);
+ BlitBitmapMasked(pix_masked[PIX_DOOR], drawto,
+ DXSIZE, DOOR_GFX_PAGEY1 + 203, i, 77 - j,
+ DX + DXSIZE - i, DY + 203 + j);
redraw_mask |= REDRAW_DOOR_1;
}
int i = (door_state & DOOR_OPEN_2 ? VXSIZE - x : x);
int j = (VXSIZE - i) / 3;
- XCopyArea(display, pix[PIX_DB_DOOR], drawto, gc,
- DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY2 + i/2,
- VXSIZE, VYSIZE - i/2, VX, VY);
-
- XFillRectangle(display, drawto, gc, VX, VY + VYSIZE-i/2, VXSIZE, i/2);
-
- XSetClipOrigin(display, clip_gc[PIX_DOOR],
- VX - i, (VY + j) - DOOR_GFX_PAGEY2);
- XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
- VXSIZE, DOOR_GFX_PAGEY2, i, VYSIZE / 2, VX + VXSIZE-i, VY+j);
- XSetClipOrigin(display, clip_gc[PIX_DOOR],
- VX - VXSIZE + i, VY - (DOOR_GFX_PAGEY2 + j));
- XCopyArea(display, pix[PIX_DOOR], drawto,clip_gc[PIX_DOOR],
- VXSIZE - i, DOOR_GFX_PAGEY2 + j, i, VYSIZE / 2 - j, VX, VY);
-
- XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
- VXSIZE - i, DOOR_GFX_PAGEY2 + VYSIZE / 2, i, VYSIZE / 2,
- VX, VY + VYSIZE / 2 - j);
- XSetClipOrigin(display, clip_gc[PIX_DOOR],
- VX - i, (VY + j) - DOOR_GFX_PAGEY2);
- XCopyArea(display, pix[PIX_DOOR], drawto, clip_gc[PIX_DOOR],
- VXSIZE, DOOR_GFX_PAGEY2 + VYSIZE / 2, i, VYSIZE / 2 - j,
- VX + VXSIZE - i, VY + VYSIZE / 2 + j);
+ BlitBitmap(pix[PIX_DB_DOOR], drawto,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY2 + i/2,
+ VXSIZE, VYSIZE - i/2, VX, VY);
+
+ ClearRectangle(drawto, VX, VY + VYSIZE-i/2, VXSIZE, i/2);
+
+ SetClipOrigin(clip_gc[PIX_DOOR], VX - i, (VY + j) - DOOR_GFX_PAGEY2);
+ BlitBitmapMasked(pix_masked[PIX_DOOR], drawto,
+ VXSIZE, DOOR_GFX_PAGEY2, i, VYSIZE / 2,
+ VX + VXSIZE-i, VY+j);
+ SetClipOrigin(clip_gc[PIX_DOOR],
+ VX - VXSIZE + i, VY - (DOOR_GFX_PAGEY2 + j));
+ BlitBitmapMasked(pix_masked[PIX_DOOR], drawto,
+ VXSIZE - i, DOOR_GFX_PAGEY2 + j, i, VYSIZE / 2 - j,
+ VX, VY);
+
+ BlitBitmapMasked(pix_masked[PIX_DOOR], drawto,
+ VXSIZE - i, DOOR_GFX_PAGEY2 + VYSIZE / 2,
+ i, VYSIZE / 2, VX, VY + VYSIZE / 2 - j);
+ SetClipOrigin(clip_gc[PIX_DOOR], VX - i, (VY + j) - DOOR_GFX_PAGEY2);
+ BlitBitmapMasked(pix_masked[PIX_DOOR], drawto,
+ VXSIZE, DOOR_GFX_PAGEY2 + VYSIZE / 2,
+ i, VYSIZE / 2 - j,
+ VX + VXSIZE - i, VY + VYSIZE / 2 + j);
redraw_mask |= REDRAW_DOOR_2;
}
void DrawSpecialEditorDoor()
{
/* draw bigger toolbox window */
- XCopyArea(display, pix[PIX_DOOR], drawto, gc,
- DOOR_GFX_PAGEX7, 0, 108, 56, EX - 4, EY - 12);
+ BlitBitmap(pix[PIX_DOOR], drawto,
+ DOOR_GFX_PAGEX7, 0, 108, 56, EX - 4, EY - 12);
redraw_mask |= REDRAW_ALL;
}
void UndrawSpecialEditorDoor()
{
/* draw normal tape recorder window */
- XCopyArea(display, pix[PIX_BACK], drawto, gc,
- 562, 344, 108, 56, EX - 4, EY - 12);
+ BlitBitmap(pix[PIX_BACK], drawto,
+ 562, 344, 108, 56, EX - 4, EY - 12);
redraw_mask |= REDRAW_ALL;
}
-int ReadPixel(Drawable d, int x, int y)
+#ifndef USE_SDL_LIBRARY
+int ReadPixel(DrawBuffer d, int x, int y)
{
XImage *pixel_image;
unsigned long pixel_value;
return pixel_value;
}
+#endif
/* ---------- new tool button stuff ---------------------------------------- */
for (i=0; i<NUM_TOOL_BUTTONS; i++)
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
- Pixmap deco_pixmap = None;
+ Bitmap gd_bitmap = pix[PIX_DOOR];
+ Bitmap deco_bitmap = None;
int deco_x = 0, deco_y = 0, deco_xpos = 0, deco_ypos = 0;
struct GadgetInfo *gi;
unsigned long event_mask;
if (id >= TOOL_CTRL_ID_PLAYER_1 && id <= TOOL_CTRL_ID_PLAYER_4)
{
getMiniGraphicSource(GFX_SPIELER1 + id - TOOL_CTRL_ID_PLAYER_1,
- &deco_pixmap, &deco_x, &deco_y);
+ &deco_bitmap, &deco_x, &deco_y);
deco_xpos = (toolbutton_info[i].width - MINI_TILEX) / 2;
deco_ypos = (toolbutton_info[i].height - MINI_TILEY) / 2;
}
GDI_HEIGHT, toolbutton_info[i].height,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
- GDI_DECORATION_DESIGN, deco_pixmap, deco_x, deco_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+ GDI_DECORATION_DESIGN, deco_bitmap, deco_x, deco_y,
GDI_DECORATION_POSITION, deco_xpos, deco_ypos,
GDI_DECORATION_SIZE, MINI_TILEX, MINI_TILEY,
GDI_DECORATION_SHIFTING, 1, 1,
void DrawTextF(int, int, int, char *, ...);
void DrawTextFCentered(int, int, char *, ...);
void DrawText(int, int, char *, int, int);
-void DrawTextExt(Drawable, GC, int, int, char *, int, int);
+void DrawTextExt(DrawBuffer, GC, int, int, char *, int, int);
void DrawAllPlayers(void);
void DrawPlayerField(int, int);
void DrawPlayer(struct PlayerInfo *);
void DrawGraphicAnimationThruMask(int, int, int, int, int, int);
void getGraphicSource(int, int *, int *, int *);
void DrawGraphic(int, int, int);
-void DrawGraphicExt(Drawable, GC, int, int, int);
+void DrawGraphicExt(DrawBuffer, GC, int, int, int);
void DrawGraphicThruMask(int, int, int);
-void DrawGraphicThruMaskExt(Drawable, int, int, int);
+void DrawGraphicThruMaskExt(DrawBuffer, int, int, int);
void DrawMiniGraphic(int, int, int);
-void getMiniGraphicSource(int, Pixmap *, int *, int *);
-void DrawMiniGraphicExt(Drawable, GC, int, int, int);
+void getMiniGraphicSource(int, Bitmap *, int *, int *);
+void DrawMiniGraphicExt(DrawBuffer, GC, int, int, int);
void DrawGraphicShifted(int, int, int, int, int, int, int);
void DrawGraphicShiftedThruMask(int, int, int, int, int, int);
void DrawScreenElementExt(int, int, int, int, int, int, int);
unsigned int MoveDoor(unsigned int);
void DrawSpecialEditorDoor();
void UndrawSpecialEditorDoor();
-int ReadPixel(Drawable, int, int);
+int ReadPixel(DrawBuffer, int, int);
void CreateToolButtons();