/***********************************************************
* Artsoft Retro-Game Library *
*----------------------------------------------------------*
-* (c) 1994-2001 Artsoft Entertainment *
+* (c) 1994-2006 Artsoft Entertainment *
* Holger Schemel *
* Detmolder Strasse 189 *
* 33604 Bielefeld *
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 *);
static void allegro_init_drivers()
{
int i;
- for (i=0; i<MAX_EVENT_BUFFER; i++)
+ for (i = 0; i < MAX_EVENT_BUFFER; i++)
event_buffer[i].type = 0;
- for (i=0; i<MAX_SCANCODES; i++)
+ for (i = 0; i < MAX_SCANCODES; i++)
key_press_state[i] = KeyReleaseMask;
last_mouse_pos = mouse_pos;
static boolean allegro_init_audio()
{
- reserve_voices(MAX_SOUNDS_PLAYING, 0);
+ reserve_voices(NUM_MIXER_CHANNELS, 0);
if (install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL) == -1)
if (install_sound(DIGI_SB, MIDI_NONE, NULL) == -1)
b >>= 10;
/* try to use existing colors from the global colormap */
- for (i=0; i<global_colormap_entries_used; i++)
+ for (i = 0; i < global_colormap_entries_used; i++)
{
if (r == global_colormap[i].r &&
g == global_colormap[i].g &&
Screen *screen;
Display *display;
BITMAP *mouse_bitmap = NULL;
- char *mouse_filename =getCustomImageFilename(program.msdos_pointer_filename);
+ char *mouse_filename = getCustomImageFilename(program.msdos_cursor_filename);
if ((mouse_bitmap = Read_PCX_to_AllegroBitmap(mouse_filename)) == NULL)
return NULL;
void XFree(void *data)
{
- if (data)
- free(data);
+ checked_free(data);
}
GC XCreateGC(Display *display, Drawable d, unsigned long value_mask,
BITMAP *bitmap = NULL;
if (gfx_capabilities & GFX_HW_VRAM_BLIT &&
- width == gfx.scrollbuffer_width && height == gfx.scrollbuffer_height)
+ width == gfx.scrollbuffer_width && height == gfx.scrollbuffer_height)
bitmap = create_video_bitmap(width, height);
if (bitmap == NULL)
clear(bitmap);
/* try to use existing colors from the global colormap */
- for (i=0; i<MAX_COLORS; i++)
+ for (i = 0; i < MAX_COLORS; i++)
{
if (!image->rgb.color_used[i])
continue;
}
/* copy bitmap data */
- for (y=0; y<image->height; y++)
- for (x=0; x<image->width; x++)
+ for (y = 0; y < image->height; y++)
+ for (x = 0; x < image->width; x++)
putpixel(bitmap, x, y, pixel_mapping[*src_ptr++]);
return bitmap;
void XFreeGC(Display *display, GC gc)
{
- XGCValues *gcv;
+ XGCValues *gcv = (XGCValues *)gc;
- gcv = (XGCValues *)gc;
- if (gcv)
- free(gcv);
+ checked_free(gcv);
}
void XUnmapWindow(Display *display, Window window)
if (is_screen_bitmap(bitmap))
destroy_bitmap(bitmap);
- if (display->screens)
- free(display->screens);
-
- if (display)
- free(display);
+ checked_free(display->screens);
+ checked_free(display);
/* return to text mode (or DOS box on Windows screen) */
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
{
int i;
- for (i=0; i<MAX_SCANCODES; i++)
+ for (i = 0; i < MAX_SCANCODES; i++)
{
int scancode, new_state, event_type;
char key_pressed;
/* mouse button event */
if (mouse_b != last_mouse_b)
{
- for (i=0; i<3; i++) /* check all three mouse buttons */
+ for (i = 0; i < 3; i++) /* check all three mouse buttons */
{
int bitmask = (1 << i);
return getpixel((BITMAP *)d, x, y);
}
+void AllegroZoomBitmap(Drawable src, Drawable dst,
+ int src_width, int src_height,
+ int dst_width, int dst_height)
+{
+ stretch_blit((BITMAP *)src, (BITMAP *)dst,
+ 0, 0, src_width, src_height, 0, 0, dst_width, dst_height);
+}
+
void MSDOSOpenAudio(void)
{
if (allegro_init_audio())
audio.music_available = TRUE;
audio.loops_available = TRUE;
audio.sound_enabled = TRUE;
- }
- InitPlaylist();
+ audio.num_channels = NUM_MIXER_CHANNELS;
+ audio.music_channel = MUSIC_CHANNEL;
+ audio.first_sound_channel = FIRST_SOUND_CHANNEL;
+
+ Mixer_InitChannels();
+ }
}
void MSDOSCloseAudio(void)
install_joystick(JOY_TYPE_AUTODETECT) == 0)
joystick.status = JOYSTICK_ACTIVATED;
- for (i=0; i<MAX_PLAYERS; i++)
+ for (i = 0; i < MAX_PLAYERS; i++)
{
char *device_name = setup.input[i].joy.device_name;
int joystick_nr = getJoystickNrFromDeviceName(device_name);