1 /***********************************************************
2 * Artsoft Retro-Game Library *
3 *----------------------------------------------------------*
4 * (c) 1994-2000 Artsoft Entertainment *
6 * Detmolder Strasse 189 *
9 * e-mail: info@artsoft.org *
10 *----------------------------------------------------------*
12 ***********************************************************/
17 #if defined(PLATFORM_MSDOS)
23 #define AllegroDefaultScreen() (display->screens[display->default_screen])
25 /* allegro driver declarations */
26 DECLARE_GFX_DRIVER_LIST(GFX_DRIVER_VBEAF GFX_DRIVER_VESA2L GFX_DRIVER_VESA1)
27 DECLARE_COLOR_DEPTH_LIST(COLOR_DEPTH_8)
28 DECLARE_DIGI_DRIVER_LIST(DIGI_DRIVER_SB)
29 DECLARE_MIDI_DRIVER_LIST()
30 DECLARE_JOYSTICK_DRIVER_LIST(JOYSTICK_DRIVER_STANDARD)
32 /* allegro global variables */
33 extern volatile int key_shifts;
34 extern int num_joysticks;
35 extern JOYSTICK_INFO joy[];
36 extern int i_love_bill;
38 /* internal variables of msdos.c */
39 static boolean keyboard_auto_repeat = TRUE;
40 static int key_press_state[MAX_SCANCODES];
41 static XEvent event_buffer[MAX_EVENT_BUFFER];
42 static int pending_events;
43 static boolean joystick_event;
44 static boolean mouse_installed = FALSE;
45 static int last_mouse_pos;
46 static int last_mouse_b;
47 static int last_joystick_state;
48 static BITMAP* video_bitmap;
50 static RGB global_colormap[MAX_COLORS];
51 static int global_colormap_entries_used = 0;
53 boolean wait_for_vsync;
56 extern int playing_sounds;
57 extern struct SoundControl playlist[MAX_SOUNDS_PLAYING];
58 extern struct SoundControl emptySoundControl;
61 static BITMAP *Read_PCX_to_AllegroBitmap(char *);
63 static void allegro_init_drivers()
67 for (i=0; i<MAX_EVENT_BUFFER; i++)
68 event_buffer[i].type = 0;
70 for (i=0; i<MAX_SCANCODES; i++)
71 key_press_state[i] = KeyReleaseMask;
73 last_mouse_pos = mouse_pos;
79 /* enable Windows friendly timer mode (already default under Windows) */
84 if (install_mouse() > 0)
85 mouse_installed = TRUE;
87 last_joystick_state = 0;
88 joystick_event = FALSE;
91 static boolean allegro_init_audio()
93 reserve_voices(MAX_SOUNDS_PLAYING, 0);
95 if (install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL) == -1)
96 if (install_sound(DIGI_SB, MIDI_NONE, NULL) == -1)
102 static boolean hide_mouse(Display *display, int x, int y,
103 unsigned int width, unsigned int height)
105 if (mouse_x + display->mouse_ptr->w < x || mouse_x > x + width)
107 if (mouse_y + display->mouse_ptr->h < y || mouse_y > y + height)
115 static void unhide_mouse(Display *display)
118 show_mouse(video_bitmap);
121 static KeySym ScancodeToKeySym(byte scancode)
125 case KEY_ESC: return XK_Escape;
126 case KEY_1: return XK_1;
127 case KEY_2: return XK_2;
128 case KEY_3: return XK_3;
129 case KEY_4: return XK_4;
130 case KEY_5: return XK_5;
131 case KEY_6: return XK_6;
132 case KEY_7: return XK_7;
133 case KEY_8: return XK_8;
134 case KEY_9: return XK_9;
135 case KEY_0: return XK_0;
136 case KEY_MINUS: return XK_minus;
137 case KEY_EQUALS: return XK_equal;
138 case KEY_BACKSPACE: return XK_BackSpace;
139 case KEY_TAB: return XK_Tab;
140 case KEY_Q: return XK_q;
141 case KEY_W: return XK_w;
142 case KEY_E: return XK_e;
143 case KEY_R: return XK_r;
144 case KEY_T: return XK_t;
145 case KEY_Y: return XK_y;
146 case KEY_U: return XK_u;
147 case KEY_I: return XK_i;
148 case KEY_O: return XK_o;
149 case KEY_P: return XK_p;
150 case KEY_OPENBRACE: return XK_braceleft;
151 case KEY_CLOSEBRACE: return XK_braceright;
152 case KEY_ENTER: return XK_Return;
153 case KEY_LCONTROL: return XK_Control_L;
154 case KEY_A: return XK_a;
155 case KEY_S: return XK_s;
156 case KEY_D: return XK_d;
157 case KEY_F: return XK_f;
158 case KEY_G: return XK_g;
159 case KEY_H: return XK_h;
160 case KEY_J: return XK_j;
161 case KEY_K: return XK_k;
162 case KEY_L: return XK_l;
163 case KEY_COLON: return XK_colon;
164 case KEY_QUOTE: return XK_apostrophe;
165 case KEY_TILDE: return XK_asciitilde;
166 case KEY_LSHIFT: return XK_Shift_L;
167 case KEY_BACKSLASH: return XK_backslash;
168 case KEY_Z: return XK_z;
169 case KEY_X: return XK_x;
170 case KEY_C: return XK_c;
171 case KEY_V: return XK_v;
172 case KEY_B: return XK_b;
173 case KEY_N: return XK_n;
174 case KEY_M: return XK_m;
175 case KEY_COMMA: return XK_comma;
176 case KEY_STOP: return XK_period;
177 case KEY_SLASH: return XK_slash;
178 case KEY_RSHIFT: return XK_Shift_R;
179 case KEY_ASTERISK: return XK_KP_Multiply;
180 case KEY_ALT: return XK_Alt_L;
181 case KEY_SPACE: return XK_space;
182 case KEY_CAPSLOCK: return XK_Caps_Lock;
183 case KEY_F1: return XK_F1;
184 case KEY_F2: return XK_F2;
185 case KEY_F3: return XK_F3;
186 case KEY_F4: return XK_F4;
187 case KEY_F5: return XK_F5;
188 case KEY_F6: return XK_F6;
189 case KEY_F7: return XK_F7;
190 case KEY_F8: return XK_F8;
191 case KEY_F9: return XK_F9;
192 case KEY_F10: return XK_F10;
193 case KEY_NUMLOCK: return XK_Num_Lock;
194 case KEY_SCRLOCK: return XK_Scroll_Lock;
195 case KEY_HOME: return XK_Home;
196 case KEY_UP: return XK_Up;
197 case KEY_PGUP: return XK_Page_Up;
198 case KEY_MINUS_PAD: return XK_KP_Subtract;
199 case KEY_LEFT: return XK_Left;
200 case KEY_5_PAD: return XK_KP_5;
201 case KEY_RIGHT: return XK_Right;
202 case KEY_PLUS_PAD: return XK_KP_Add;
203 case KEY_END: return XK_End;
204 case KEY_DOWN: return XK_Down;
205 case KEY_PGDN: return XK_Page_Down;
206 case KEY_INSERT: return XK_Insert;
207 case KEY_DEL: return XK_Delete;
208 case KEY_PRTSCR: return XK_Print;
209 case KEY_F11: return XK_F11;
210 case KEY_F12: return XK_F12;
211 case KEY_LWIN: return XK_Meta_L;
212 case KEY_RWIN: return XK_Meta_R;
213 case KEY_MENU: return XK_Menu;
214 case KEY_PAD: return XK_VoidSymbol;
215 case KEY_RCONTROL: return XK_Control_R;
216 case KEY_ALTGR: return XK_Alt_R;
217 case KEY_SLASH2: return XK_KP_Divide;
218 case KEY_PAUSE: return XK_Pause;
220 case NEW_KEY_BACKSLASH: return XK_backslash;
221 case NEW_KEY_1_PAD: return XK_KP_1;
222 case NEW_KEY_2_PAD: return XK_KP_2;
223 case NEW_KEY_3_PAD: return XK_KP_3;
224 case NEW_KEY_4_PAD: return XK_KP_4;
225 case NEW_KEY_5_PAD: return XK_KP_5;
226 case NEW_KEY_6_PAD: return XK_KP_6;
227 case NEW_KEY_7_PAD: return XK_KP_7;
228 case NEW_KEY_8_PAD: return XK_KP_8;
229 case NEW_KEY_9_PAD: return XK_KP_9;
230 case NEW_KEY_0_PAD: return XK_KP_0;
231 case NEW_KEY_STOP_PAD: return XK_KP_Separator;
232 case NEW_KEY_EQUALS_PAD: return XK_KP_Equal;
233 case NEW_KEY_SLASH_PAD: return XK_KP_Divide;
234 case NEW_KEY_ASTERISK_PAD: return XK_KP_Multiply;
235 case NEW_KEY_ENTER_PAD: return XK_KP_Enter;
237 default: return XK_VoidSymbol;
241 void XMapWindow(Display *display, Window window)
244 unsigned int width, height;
247 x = AllegroDefaultScreen().x;
248 y = AllegroDefaultScreen().y;
249 width = AllegroDefaultScreen().width;
250 height = AllegroDefaultScreen().height;
252 mouse_off = hide_mouse(display, x, y, width, height);
253 blit((BITMAP *)window, video_bitmap, 0, 0, x, y, width, height);
256 unhide_mouse(display);
259 static unsigned long AllocColorCell(int r, int g, int b)
261 byte pixel_mapping = 0;
268 /* try to use existing colors from the global colormap */
269 for (i=0; i<global_colormap_entries_used; i++)
271 if (r == global_colormap[i].r &&
272 g == global_colormap[i].g &&
273 b == global_colormap[i].b) /* color found */
280 if (i == global_colormap_entries_used) /* color not found */
282 if (global_colormap_entries_used < MAX_COLORS)
283 global_colormap_entries_used++;
285 global_colormap[i].r = r;
286 global_colormap[i].g = g;
287 global_colormap[i].b = b;
292 return pixel_mapping;
295 Display *XOpenDisplay(char *display_name)
299 BITMAP *mouse_bitmap = NULL;
301 mouse_bitmap = Read_PCX_to_AllegroBitmap(program.msdos_pointer_filename);
302 if (mouse_bitmap == NULL)
305 screen = malloc(sizeof(Screen));
306 display = malloc(sizeof(Display));
311 screen[0].white_pixel = 0xFF;
312 screen[0].black_pixel = 0x00;
314 screen[0].white_pixel = AllocColorCell(0xFFFF, 0xFFFF, 0xFFFF);
315 screen[0].black_pixel = AllocColorCell(0x0000, 0x0000, 0x0000);
317 screen[0].video_bitmap = NULL;
319 display->default_screen = 0;
320 display->screens = screen;
321 display->mouse_ptr = mouse_bitmap;
324 allegro_init_drivers();
327 /* force Windows 95 to switch to fullscreen mode */
328 set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0);
330 set_gfx_mode(GFX_AUTODETECT, XRES, YRES, 0, 0);
335 Window XCreateSimpleWindow(Display *display, Window parent, int x, int y,
336 unsigned int width, unsigned int height,
337 unsigned int border_width, unsigned long border,
338 unsigned long background)
340 video_bitmap = create_video_bitmap(XRES, YRES);
341 clear_to_color(video_bitmap, background);
343 AllegroDefaultScreen().video_bitmap = video_bitmap;
344 AllegroDefaultScreen().x = x;
345 AllegroDefaultScreen().y = y;
346 AllegroDefaultScreen().width = XRES;
347 AllegroDefaultScreen().height = YRES;
349 set_mouse_sprite(display->mouse_ptr);
352 set_mouse_sprite_focus(1, 1);
355 set_mouse_speed(1, 1);
356 set_mouse_range(AllegroDefaultScreen().x + 1,
357 AllegroDefaultScreen().y + 1,
358 AllegroDefaultScreen().x + video.width + 1,
359 AllegroDefaultScreen().y + video.height + 1);
361 show_video_bitmap(video_bitmap);
363 return (Window)video_bitmap;
366 Status XStringListToTextProperty(char **list, int count,
367 XTextProperty *text_prop_return)
373 string = malloc(strlen(list[0] + 1));
374 strcpy(string, list[0]);
375 text_prop_return->value = (unsigned char *)string;
379 text_prop_return = NULL;
384 void XFree(void *data)
390 GC XCreateGC(Display *display, Drawable d, unsigned long value_mask,
394 gcv = malloc(sizeof(XGCValues));
395 gcv->foreground = values->foreground;
396 gcv->background = values->background;
397 gcv->graphics_exposures = values->graphics_exposures;
398 gcv->clip_mask = values->clip_mask;
399 gcv->clip_x_origin = values->clip_x_origin;
400 gcv->clip_y_origin = values->clip_y_origin;
401 gcv->value_mask = value_mask;
405 void XSetClipMask(Display *display, GC gc, Pixmap pixmap)
407 XGCValues *gcv = (XGCValues *)gc;
409 gcv->clip_mask = pixmap;
410 gcv->value_mask |= GCClipMask;
413 void XSetClipOrigin(Display *display, GC gc, int x, int y)
415 XGCValues *gcv = (XGCValues *)gc;
417 gcv->clip_x_origin = x;
418 gcv->clip_x_origin = y;
421 void XFillRectangle(Display *display, Drawable d, GC gc, int x, int y,
422 unsigned int width, unsigned int height)
424 boolean mouse_off = FALSE;
426 if ((BITMAP *)d == video_bitmap)
428 x += AllegroDefaultScreen().x;
429 y += AllegroDefaultScreen().y;
430 freeze_mouse_flag = TRUE;
431 mouse_off = hide_mouse(display, x, y, width, height);
434 rectfill((BITMAP *)d, x, y, x + width - 1, y + height - 1,
435 ((XGCValues *)gc)->foreground);
438 unhide_mouse(display);
440 freeze_mouse_flag = FALSE;
443 Pixmap XCreatePixmap(Display *display, Drawable d, unsigned int width,
444 unsigned int height, unsigned int depth)
446 BITMAP *bitmap = NULL;
448 if (gfx_capabilities & GFX_HW_VRAM_BLIT &&
449 width == gfx.scrollbuffer_width && height == gfx.scrollbuffer_height)
450 bitmap = create_video_bitmap(width, height);
453 bitmap = create_bitmap(width, height);
455 return (Pixmap)bitmap;
458 void XSync(Display *display, Bool discard_events)
460 wait_for_vsync = TRUE;
463 inline void XCopyArea(Display *display, Drawable src, Drawable dest, GC gc,
464 int src_x, int src_y,
465 unsigned int width, unsigned int height,
466 int dest_x, int dest_y)
468 boolean mouse_off = FALSE;
470 if ((BITMAP *)src == video_bitmap)
472 src_x += AllegroDefaultScreen().x;
473 src_y += AllegroDefaultScreen().y;
476 if ((BITMAP *)dest == video_bitmap)
478 dest_x += AllegroDefaultScreen().x;
479 dest_y += AllegroDefaultScreen().y;
480 freeze_mouse_flag = TRUE;
481 mouse_off = hide_mouse(display, dest_x, dest_y, width, height);
486 wait_for_vsync = FALSE;
490 if (((XGCValues *)gc)->value_mask & GCClipMask)
491 masked_blit((BITMAP *)src, (BITMAP *)dest, src_x, src_y, dest_x, dest_y,
494 blit((BITMAP *)src, (BITMAP *)dest, src_x, src_y, dest_x, dest_y,
498 unhide_mouse(display);
500 freeze_mouse_flag = FALSE;
503 static BITMAP *Image_to_AllegroBitmap(Image *image)
506 byte *src_ptr = image->data;
507 byte pixel_mapping[MAX_COLORS];
508 unsigned int depth = 8;
516 /* allocate new allegro bitmap structure */
517 if ((bitmap = create_bitmap_ex(depth, image->width, image->height)) == NULL)
519 errno_pcx = PCX_NoMemory;
525 /* try to use existing colors from the global colormap */
526 for (i=0; i<MAX_COLORS; i++)
533 if (!image->rgb.color_used[i])
538 r = image->rgb.red[i] >> 10;
539 g = image->rgb.green[i] >> 10;
540 b = image->rgb.blue[i] >> 10;
542 for (j=0; j<global_colormap_entries_used; j++)
544 if (r == global_colormap[j].r &&
545 g == global_colormap[j].g &&
546 b == global_colormap[j].b) /* color found */
548 pixel_mapping[i] = j;
553 if (j == global_colormap_entries_used) /* color not found */
555 if (global_colormap_entries_used < MAX_COLORS)
556 global_colormap_entries_used++;
558 global_colormap[j].r = r;
559 global_colormap[j].g = g;
560 global_colormap[j].b = b;
562 pixel_mapping[i] = j;
565 pixel_mapping[i] = AllocColorCell(image->rgb.red[i],
572 /* copy bitmap data */
573 for (y=0; y<image->height; y++)
574 for (x=0; x<image->width; x++)
575 putpixel(bitmap, x, y, pixel_mapping[*src_ptr++]);
580 static BITMAP *Read_PCX_to_AllegroBitmap(char *filename)
585 /* read the graphic file in PCX format to internal image structure */
586 if ((image = Read_PCX_to_Image(filename)) == NULL)
589 /* convert internal image structure to allegro bitmap structure */
590 if ((bitmap = Image_to_AllegroBitmap(image)) == NULL)
593 set_palette(global_colormap);
598 int Read_PCX_to_Pixmap(Display *display, Window window, GC gc, char *filename,
599 Pixmap *pixmap, Pixmap *pixmap_mask)
603 if ((bitmap = Read_PCX_to_AllegroBitmap(filename)) == NULL)
606 *pixmap = (Pixmap)bitmap;
607 *pixmap_mask = (Pixmap)bitmap;
612 int XReadBitmapFile(Display *display, Drawable d, char *filename,
613 unsigned int *width_return, unsigned int *height_return,
614 Pixmap *bitmap_return,
615 int *x_hot_return, int *y_hot_return)
619 if ((bitmap = Read_PCX_to_AllegroBitmap(filename)) == NULL)
620 return BitmapOpenFailed;
622 *width_return = bitmap->w;
623 *height_return = bitmap->h;
626 *bitmap_return = (Pixmap)bitmap;
628 return BitmapSuccess;
631 void XFreePixmap(Display *display, Pixmap pixmap)
633 if (pixmap != DUMMY_MASK &&
634 (is_memory_bitmap((BITMAP *)pixmap) ||
635 is_screen_bitmap((BITMAP *)pixmap)))
636 destroy_bitmap((BITMAP *)pixmap);
639 void XFreeGC(Display *display, GC gc)
643 gcv = (XGCValues *)gc;
648 void XUnmapWindow(Display *display, Window window)
652 void XCloseDisplay(Display *display)
654 BITMAP *bitmap = video_bitmap;
656 if (is_screen_bitmap(bitmap))
657 destroy_bitmap(bitmap);
659 if (display->screens)
660 free(display->screens);
665 /* return to text mode (or DOS box on Windows screen) */
666 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
669 void XNextEvent(Display *display, XEvent *event_return)
671 while (!pending_events)
674 memcpy(event_return, &event_buffer[pending_events], sizeof(XEvent));
678 static void NewKeyEvent(int key_press_state, KeySym keysym)
682 if (pending_events >= MAX_EVENT_BUFFER)
686 xkey = (XKeyEvent *)&event_buffer[pending_events];
687 xkey->type = key_press_state;
688 xkey->state = (unsigned int)keysym;
691 #define HANDLE_RAW_KB_ALL_KEYS 0
692 #define HANDLE_RAW_KB_MODIFIER_KEYS_ONLY 1
694 static int modifier_scancode[] =
710 static void HandleKeyboardRaw(int mode)
714 for (i=0; i<MAX_SCANCODES; i++)
716 int scancode, new_state, event_type;
719 if (mode == HANDLE_RAW_KB_MODIFIER_KEYS_ONLY)
721 if ((scancode = modifier_scancode[i]) == -1)
727 key_pressed = key[scancode];
728 new_state = (key_pressed ? KeyPressMask : KeyReleaseMask);
729 event_type = (key_pressed ? KeyPress : KeyRelease);
731 if (key_press_state[i] == new_state) /* state not changed */
734 key_press_state[i] = new_state;
736 NewKeyEvent(event_type, ScancodeToKeySym(scancode));
740 static void HandleKeyboardEvent()
744 int key_info = readkey();
745 int scancode = (key_info >> 8);
746 int ascii = (key_info & 0xff);
747 KeySym keysym = ScancodeToKeySym(scancode);
749 if (scancode == KEY_PAD)
751 /* keys on the numeric keypad return just scancode 'KEY_PAD'
752 for some reason, so we must handle them separately */
754 if (ascii >= '0' && ascii <= '9')
755 keysym = XK_KP_0 + (KeySym)(ascii - '0');
756 else if (ascii == '.')
757 keysym = XK_KP_Separator;
759 else if (ascii >= ' ' && ascii <= 'Z')
760 keysym = XK_space + (KeySym)(ascii - ' ');
761 else if (ascii == '^')
762 keysym = XK_asciicircum;
763 else if (ascii == '_')
764 keysym = XK_underscore;
765 else if (ascii == 'Ä')
766 keysym = XK_Adiaeresis;
767 else if (ascii == 'Ö')
768 keysym = XK_Odiaeresis;
769 else if (ascii == 'Ü')
770 keysym = XK_Udiaeresis;
771 else if (ascii == 'ä')
772 keysym = XK_adiaeresis;
773 else if (ascii == 'ö')
774 keysym = XK_odiaeresis;
775 else if (ascii == 'ü')
776 keysym = XK_udiaeresis;
777 else if (ascii == 'ß')
780 NewKeyEvent(KeyPress, keysym);
782 else if (key_shifts & (KB_SHIFT_FLAG | KB_CTRL_FLAG | KB_ALT_FLAG))
784 /* the allegro function keypressed() does not give us single pressed
785 modifier keys, so we must detect them with the internal global
786 allegro variable 'key_shifts' and then handle them separately */
788 HandleKeyboardRaw(HANDLE_RAW_KB_MODIFIER_KEYS_ONLY);
792 int XPending(Display *display)
794 XButtonEvent *xbutton;
795 XMotionEvent *xmotion;
798 /* When using 'HandleKeyboardRaw()', keyboard input is also stored in
799 the allegro keyboard input buffer and would be available a second
800 time by calling 'HandleKeyboardEvent()'. To avoid double keyboard
801 events, the allegro function 'clear_keybuf()' must be called each
802 time when switching from calling 'HandleKeyboardRaw()' to calling
803 'HandleKeyboardEvent()' to get keyboard input, which is actually
804 done by 'XAutoRepeatOn()' which sets keyboard_auto_repeat to TRUE. */
807 if (keyboard_auto_repeat)
808 HandleKeyboardEvent();
810 HandleKeyboardRaw(HANDLE_RAW_KB_ALL_KEYS);
812 /* mouse motion event */
813 if (mouse_pos != last_mouse_pos)
815 last_mouse_pos = mouse_pos;
817 xmotion = (XMotionEvent *)&event_buffer[pending_events];
818 xmotion->type = MotionNotify;
819 xmotion->x = mouse_x - AllegroDefaultScreen().x;
820 xmotion->y = mouse_y - AllegroDefaultScreen().y;
823 /* mouse button event */
824 if (mouse_b != last_mouse_b)
826 for (i=0; i<3; i++) /* check all three mouse buttons */
828 int bitmask = (1 << i);
830 if ((last_mouse_b & bitmask) != (mouse_b & bitmask))
832 int mapping[3] = { 1, 3, 2 };
835 xbutton = (XButtonEvent *)&event_buffer[pending_events];
836 xbutton->type = (mouse_b & bitmask ? ButtonPress : ButtonRelease);
837 xbutton->button = mapping[i];
838 xbutton->x = mouse_x - AllegroDefaultScreen().x;
839 xbutton->y = mouse_y - AllegroDefaultScreen().y;
842 last_mouse_b = mouse_b;
845 return pending_events;
848 KeySym XLookupKeysym(XKeyEvent *key_event, int index)
850 return key_event->state;
853 int XLookupString(XKeyEvent *key_event, char *buffer, int buffer_size,
854 KeySym *key, XComposeStatus *compose)
856 *key = key_event->state;
860 void XSetForeground(Display *display, GC gc, unsigned long pixel)
862 XGCValues *gcv = (XGCValues *)gc;
864 gcv->foreground = pixel;
867 void XDrawLine(Display *display, Drawable d, GC gc,
868 int x1, int y1, int x2, int y2)
870 XGCValues *gcv = (XGCValues *)gc;
871 boolean mouse_off = FALSE;
873 if ((BITMAP *)d == video_bitmap)
875 x1 += AllegroDefaultScreen().x;
876 y1 += AllegroDefaultScreen().y;
877 x2 += AllegroDefaultScreen().x;
878 y2 += AllegroDefaultScreen().y;
879 freeze_mouse_flag = TRUE;
880 mouse_off = hide_mouse(display, MIN(x1, x2), MIN(y1, y2),
881 MAX(x1, x2) - MIN(x1, x2),
882 MAX(y1, y2) - MIN(y1, y2));
885 line((BITMAP *)d, x1, y1, x2, y2, gcv->foreground);
888 unhide_mouse(display);
890 freeze_mouse_flag = FALSE;
893 void XDestroyImage(XImage *ximage)
897 void XDestroyWindow(Display *display, Window window)
901 Bool XQueryPointer(Display *display, Window window,
902 Window *root, Window *child, int *root_x, int *root_y,
903 int *win_x, int *win_y, unsigned int *mask)
905 *win_x = mouse_x - AllegroDefaultScreen().x;
906 *win_y = mouse_y - AllegroDefaultScreen().y;
911 void XAutoRepeatOn(Display *display)
913 keyboard_auto_repeat = TRUE;
917 void XAutoRepeatOff(Display *display)
919 keyboard_auto_repeat = FALSE;
922 void AllegroDrawLine(Drawable d, int from_x, int from_y, int to_x, int to_y,
925 boolean mouse_off = FALSE;
927 if ((BITMAP *)d == video_bitmap)
929 int dx = AllegroDefaultScreen().x;
930 int dy = AllegroDefaultScreen().y;
938 x1 = (from_x < to_x ? from_x : to_x);
939 y1 = (from_y < to_y ? from_y : to_y);
940 x2 = (from_x < to_x ? to_x : from_x);
941 y2 = (from_y < to_y ? to_y : from_y);
943 freeze_mouse_flag = TRUE;
944 mouse_off = hide_mouse(display, x1, y1, x2 - x1 + 1, y2 - y1 + 1);
947 line((BITMAP *)d, from_x, from_y, to_x, to_y, color);
950 unhide_mouse(display);
952 freeze_mouse_flag = FALSE;
955 void MSDOSOpenAudio(void)
957 if (allegro_init_audio())
959 audio.sound_available = TRUE;
960 audio.music_available = TRUE;
961 audio.loops_available = TRUE;
962 audio.sound_enabled = TRUE;
966 void MSDOSCloseAudio(void)
968 /* nothing to be done here */
971 void NetworkServer(int port, int serveronly)
973 Error(ERR_WARN, "networking not supported in DOS version");
976 #endif /* PLATFORM_MSDOS */