#include "files.h"
#include "joystick.h"
#include "image.h"
+#include "pcx.h"
/* allegro driver declarations */
DECLARE_GFX_DRIVER_LIST(GFX_DRIVER_VBEAF GFX_DRIVER_VESA2L GFX_DRIVER_VESA1)
boolean wait_for_vsync;
+/*
extern int playing_sounds;
extern struct SoundControl playlist[MAX_SOUNDS_PLAYING];
extern struct SoundControl emptySoundControl;
+*/
static BITMAP *Read_PCX_to_AllegroBitmap(char *);
joystick_event = FALSE;
reserve_voices(MAX_SOUNDS_PLAYING, 0);
- if (install_sound(DIGI_AUTODETECT, MIDI_NONE, "ROCKS.SND") == -1)
+ if (install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL) == -1)
if (install_sound(DIGI_SB, MIDI_NONE, NULL) == -1)
sound_status = SOUND_OFF;
}
if ((bitmap = Image_to_AllegroBitmap(image)) == NULL)
return NULL;
- set_pallete(global_colormap);
+ set_palette(global_colormap);
return bitmap;
}
/* mouse button event */
if (mouse_b != last_mouse_b)
{
- for (i=1; i<4; i<<=1)
+ for (i=0; i<3; i++) /* check all three mouse buttons */
{
- if ((last_mouse_b & i) != (mouse_b & i))
+ int bitmask = (1 << i);
+
+ if ((last_mouse_b & bitmask) != (mouse_b & bitmask))
{
+ int mapping[3] = { 1, 3, 2 };
+
pending_events++;
xbutton = (XButtonEvent *)&event_buffer[pending_events];
- xbutton->type = (mouse_b & i ? ButtonPress : ButtonRelease);
- xbutton->button = i;
+ xbutton->type = (mouse_b & bitmask ? ButtonPress : ButtonRelease);
+ xbutton->button = mapping[i];
xbutton->x = mouse_x - display->screens[display->default_screen].x;
xbutton->y = mouse_y - display->screens[display->default_screen].y;
}
return key_event->state;
}
-void sound_handler(struct SoundControl snd_ctrl)
+int XLookupString(XKeyEvent *key_event, char *buffer, int buffer_size,
+ KeySym *key, XComposeStatus *compose)
{
- int i;
+ *key = key_event->state;
+ return 0;
+}
- if (snd_ctrl.fade_sound)
- {
- if (!playing_sounds)
- return;
+void XSetForeground(Display *display, GC gc, unsigned long pixel)
+{
+ XGCValues *gcv = (XGCValues *)gc;
- for (i=0; i<MAX_SOUNDS_PLAYING; i++)
- if ((snd_ctrl.stop_all_sounds || playlist[i].nr == snd_ctrl.nr) &&
- !playlist[i].fade_sound)
- {
- playlist[i].fade_sound = TRUE;
- if (voice_check(playlist[i].voice))
- voice_ramp_volume(playlist[i].voice, 1000, 0);
- playlist[i].loop = PSND_NO_LOOP;
- }
- }
- else if (snd_ctrl.stop_all_sounds)
- {
- if (!playing_sounds)
- return;
- SoundServer_StopAllSounds();
- }
- else if (snd_ctrl.stop_sound)
+ gcv->foreground = pixel;
+}
+
+void XDrawLine(Display *display, Drawable d, GC gc,
+ int x1, int y1, int x2, int y2)
+{
+ XGCValues *gcv = (XGCValues *)gc;
+ boolean mouse_off = FALSE;
+
+ if ((BITMAP *)d == video_bitmap)
{
- if (!playing_sounds)
- return;
- SoundServer_StopSound(snd_ctrl.nr);
+ x1 += display->screens[display->default_screen].x;
+ y1 += display->screens[display->default_screen].y;
+ x2 += display->screens[display->default_screen].x;
+ y2 += display->screens[display->default_screen].y;
+ freeze_mouse_flag = TRUE;
+ mouse_off = hide_mouse(display, MIN(x1, x2), MIN(y1, y2),
+ MAX(x1, x2) - MIN(x1, x2),
+ MAX(y1, y2) - MIN(y1, y2));
}
- for (i=0; i<MAX_SOUNDS_PLAYING; i++)
- {
- if (!playlist[i].active || playlist[i].loop)
- continue;
+ line((BITMAP *)d, x1, y1, x2, y2, gcv->foreground);
- playlist[i].playingpos = voice_get_position(playlist[i].voice);
- playlist[i].volume = voice_get_volume(playlist[i].voice);
- if (playlist[i].playingpos == -1 || !playlist[i].volume)
- {
- deallocate_voice(playlist[i].voice);
- playlist[i] = emptySoundControl;
- playing_sounds--;
- }
- }
+ if (mouse_off)
+ unhide_mouse(display);
- if (snd_ctrl.active)
- SoundServer_InsertNewSound(snd_ctrl);
+ freeze_mouse_flag = FALSE;
+}
+
+void XDestroyImage(XImage *ximage)
+{
}
void NetworkServer(int port, int serveronly)