From 3d07b68a314ce189f207e42d95f786979662410d Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 3 Dec 2000 23:42:54 +0100 Subject: [PATCH 1/1] rnd-20001203-5-src --- src/cartoons.c | 3 +- src/game.c | 1 + src/init.c | 8 +-- src/libgame/Makefile | 8 +-- src/libgame/gadgets.c | 4 +- src/libgame/gadgets.h | 2 +- src/libgame/image.c | 7 ++- src/libgame/image.h | 14 ++---- src/libgame/libgame.c | 45 ----------------- src/libgame/libgame.h | 108 ----------------------------------------- src/libgame/main_TMP.h | 1 - src/libgame/misc.c | 6 +-- src/libgame/misc.h | 3 +- src/libgame/msdos.c | 9 +++- src/libgame/msdos.h | 3 +- src/libgame/pcx.c | 4 +- src/libgame/pcx.h | 4 +- src/libgame/private.c | 22 --------- src/libgame/private.h | 27 ----------- src/libgame/sdl.c | 6 ++- src/libgame/sound.c | 29 ++++++++--- src/libgame/sound.h | 18 ++++--- src/libgame/system.c | 22 +++++++-- src/libgame/system.h | 88 +++++++++++++++++++++++++++++++-- src/libgame/text.c | 3 +- src/libgame/text.h | 3 +- src/libgame/x11.c | 4 +- src/main.c | 2 + src/main.h | 4 +- 29 files changed, 188 insertions(+), 270 deletions(-) delete mode 100644 src/libgame/libgame.c delete mode 120000 src/libgame/main_TMP.h delete mode 100644 src/libgame/private.c delete mode 100644 src/libgame/private.h diff --git a/src/cartoons.c b/src/cartoons.c index c2c0fea6..2ef229f1 100644 --- a/src/cartoons.c +++ b/src/cartoons.c @@ -11,12 +11,11 @@ * cartoons.c * ***********************************************************/ -#include "libgame/libgame.h" - #include "cartoons.h" #include "main.h" #include "tools.h" + static void HandleAnimation(int); static boolean AnimateToon(int, boolean); static void DrawAnim(Bitmap, GC, int, int, int, int, int, int, int, int); diff --git a/src/game.c b/src/game.c index 3f95c2b0..fd89096a 100644 --- a/src/game.c +++ b/src/game.c @@ -180,6 +180,7 @@ void GetPlayerConfig() setup.sound_simple = setup.sound; + SetAudioMode(setup.sound); InitJoysticks(); } diff --git a/src/init.c b/src/init.c index 8f30094d..8d9571c9 100644 --- a/src/init.c +++ b/src/init.c @@ -148,14 +148,16 @@ void InitSound() OpenAudio(&audio); + AllocSoundArray(NUM_SOUNDS); + for(i=0; i #include -#include "libgame.h" - #include "gadgets.h" +#include "text.h" +#include "misc.h" /* values for DrawGadget() */ diff --git a/src/libgame/gadgets.h b/src/libgame/gadgets.h index ccac2373..398d97c7 100644 --- a/src/libgame/gadgets.h +++ b/src/libgame/gadgets.h @@ -14,7 +14,7 @@ #ifndef GADGETS_H #define GADGETS_H -#include "libgame.h" +#include "system.h" #define GADGET_FRAME_DELAY 150 /* delay between gadget actions */ diff --git a/src/libgame/image.c b/src/libgame/image.c index b83de19f..6a6d5a1d 100644 --- a/src/libgame/image.c +++ b/src/libgame/image.c @@ -11,14 +11,13 @@ * image.c * ***********************************************************/ -#include "platform.h" - -#if defined(TARGET_X11) - #include "image.h" #include "pcx.h" #include "misc.h" + +#if defined(TARGET_X11) + /* for MS-DOS/Allegro, exclude all except newImage() and freeImage() */ Image *newImage(unsigned int width, unsigned int height, unsigned int depth) diff --git a/src/libgame/image.h b/src/libgame/image.h index 1257dda1..716ba0f5 100644 --- a/src/libgame/image.h +++ b/src/libgame/image.h @@ -14,17 +14,10 @@ #ifndef IMAGE_H #define IMAGE_H -#include "platform.h" - -#ifndef TARGET_SDL - -#include "types.h" #include "system.h" -/* -#include "types.h" -#include "x11.h" -*/ + +#if defined(TARGET_X11) #define MAX_COLORS 256 /* maximal number of colors for each image */ @@ -64,5 +57,6 @@ void freeImage(Image *); void freeXImage(Image *, XImageInfo *); int Read_PCX_to_Pixmap(Display *, Window, GC, char *, Pixmap *, Pixmap *); -#endif /* !TARGET_SDL */ +#endif /* TARGET_X11 */ + #endif /* IMAGE_H */ diff --git a/src/libgame/libgame.c b/src/libgame/libgame.c deleted file mode 100644 index 00d7c13e..00000000 --- a/src/libgame/libgame.c +++ /dev/null @@ -1,45 +0,0 @@ -/*********************************************************** -* Rocks'n'Diamonds -- McDuffin Strikes Back! * -*----------------------------------------------------------* -* (c) 1995-98 Artsoft Entertainment * -* Holger Schemel * -* Oststrasse 11a * -* 33604 Bielefeld * -* phone: ++49 +521 290471 * -* email: aeglos@valinor.owl.de * -*----------------------------------------------------------* -* libgame.c * -***********************************************************/ - -#include "libgame.h" - - -/* ========================================================================= */ -/* exported variables */ -/* ========================================================================= */ - -struct ProgramInfo program; -struct OptionInfo options; -struct VideoSystemInfo video; -struct AudioSystemInfo audio; -struct GfxInfo gfx; - -struct LevelDirInfo *leveldir_first = NULL; -struct LevelDirInfo *leveldir_current = NULL; - -Display *display = NULL; -Visual *visual = NULL; -int screen = 0; -Colormap cmap = None; - -DrawWindow window = NULL; -DrawBuffer backbuffer = NULL; -DrawBuffer drawto = NULL; - -int button_status = MB_NOT_PRESSED; -boolean motion_status = FALSE; - -int redraw_mask = REDRAW_NONE; -int redraw_tiles = 0; - -int FrameCounter = 0; diff --git a/src/libgame/libgame.h b/src/libgame/libgame.h index e8956034..94f21f46 100644 --- a/src/libgame/libgame.h +++ b/src/libgame/libgame.h @@ -16,7 +16,6 @@ #include "platform.h" #include "types.h" -#include "private.h" #include "system.h" #include "random.h" #include "gadgets.h" @@ -26,111 +25,4 @@ #include "pcx.h" #include "misc.h" - -/* default name for empty highscore entry */ -#define EMPTY_PLAYER_NAME "no name" - -/* default name for unknown player names */ -#define ANONYMOUS_NAME "anonymous" - -/* default name for new levels */ -#define NAMELESS_LEVEL_NAME "nameless level" - -/* definitions for game sub-directories */ -#ifndef RO_GAME_DIR -#define RO_GAME_DIR "." -#endif - -#ifndef RW_GAME_DIR -#define RW_GAME_DIR "." -#endif - -#define RO_BASE_PATH RO_GAME_DIR -#define RW_BASE_PATH RW_GAME_DIR - -#define GRAPHICS_DIRECTORY "graphics" -#define SOUNDS_DIRECTORY "sounds" -#define LEVELS_DIRECTORY "levels" -#define TAPES_DIRECTORY "tapes" -#define SCORES_DIRECTORY "scores" - -/* areas in bitmap PIX_DOOR */ -/* meaning in PIX_DB_DOOR: (3 PAGEs) - PAGEX1: 1. buffer for DOOR_1 - PAGEX2: 2. buffer for DOOR_1 - PAGEX3: buffer for animations -*/ - -#define DOOR_GFX_PAGESIZE (gfx.dxsize) -#define DOOR_GFX_PAGEX1 (0 * DOOR_GFX_PAGESIZE) -#define DOOR_GFX_PAGEX2 (1 * DOOR_GFX_PAGESIZE) -#define DOOR_GFX_PAGEX3 (2 * DOOR_GFX_PAGESIZE) -#define DOOR_GFX_PAGEX4 (3 * DOOR_GFX_PAGESIZE) -#define DOOR_GFX_PAGEX5 (4 * DOOR_GFX_PAGESIZE) -#define DOOR_GFX_PAGEX6 (5 * DOOR_GFX_PAGESIZE) -#define DOOR_GFX_PAGEX7 (6 * DOOR_GFX_PAGESIZE) -#define DOOR_GFX_PAGEX8 (7 * DOOR_GFX_PAGESIZE) -#define DOOR_GFX_PAGEY1 (0) -#define DOOR_GFX_PAGEY2 (gfx.dysize) - -struct LevelDirInfo -{ - char *filename; /* level series single directory name */ - char *fullpath; /* complete path relative to level directory */ - char *basepath; /* absolute base path of level directory */ - char *name; /* level series name, as displayed on main screen */ - char *name_short; /* optional short name for level selection screen */ - char *name_sorting; /* optional sorting name for correct level sorting */ - char *author; /* level series author name levels without author */ - char *imported_from; /* optional comment for imported level series */ - int levels; /* number of levels in level series */ - int first_level; /* first level number (to allow start with 0 or 1) */ - int last_level; /* last level number (automatically calculated) */ - int sort_priority; /* sort levels by 'sort_priority' and then by name */ - boolean level_group; /* directory contains more level series directories */ - boolean parent_link; /* entry links back to parent directory */ - boolean user_defined; /* user defined levels are stored in home directory */ - boolean readonly; /* readonly levels can not be changed with editor */ - int color; /* color to use on selection screen for this level */ - char *class_desc; /* description of level series class */ - int handicap_level; /* number of the lowest unsolved level */ - int cl_first; /* internal control field for "choose level" screen */ - int cl_cursor; /* internal control field for "choose level" screen */ - - struct LevelDirInfo *node_parent; /* parent level directory info */ - struct LevelDirInfo *node_group; /* level group sub-directory info */ - struct LevelDirInfo *next; /* next level series structure node */ -}; - - -/* ========================================================================= */ -/* exported variables */ -/* ========================================================================= */ - -extern struct ProgramInfo program; -extern struct OptionInfo options; -extern struct VideoSystemInfo video; -extern struct AudioSystemInfo audio; -extern struct GfxInfo gfx; - -extern struct LevelDirInfo *leveldir_first; -extern struct LevelDirInfo *leveldir_current; - -extern Display *display; -extern Visual *visual; -extern int screen; -extern Colormap cmap; - -extern DrawWindow window; -extern DrawBuffer backbuffer; -extern DrawBuffer drawto; - -extern int button_status; -extern boolean motion_status; - -extern int redraw_mask; -extern int redraw_tiles; - -extern int FrameCounter; - #endif /* LIBGAME_H */ diff --git a/src/libgame/main_TMP.h b/src/libgame/main_TMP.h deleted file mode 120000 index 31e337c4..00000000 --- a/src/libgame/main_TMP.h +++ /dev/null @@ -1 +0,0 @@ -../main.h \ No newline at end of file diff --git a/src/libgame/misc.c b/src/libgame/misc.c index b2ee4717..2947adc4 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -27,13 +27,9 @@ #include #endif -#include "libgame.h" - #include "misc.h" +#include "random.h" -#if 0 -#include "joystick_TMP.h" -#endif #if defined(PLATFORM_MSDOS) volatile unsigned long counter = 0; diff --git a/src/libgame/misc.h b/src/libgame/misc.h index 28b073ff..f838df1a 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -17,7 +17,8 @@ #include #include -#include "libgame.h" +#include "system.h" + /* values for InitCounter() and Counter() */ #define INIT_COUNTER 0 diff --git a/src/libgame/msdos.c b/src/libgame/msdos.c index b3137b4a..16bbe771 100644 --- a/src/libgame/msdos.c +++ b/src/libgame/msdos.c @@ -12,10 +12,15 @@ * msdos.c * ***********************************************************/ -#include "libgame.h" +#include "system.h" + #if defined(PLATFORM_MSDOS) +#include "sound.h" +#include "misc.h" +#include "pcx.h" + #define AllegroDefaultScreen() (display->screens[display->default_screen]) /* allegro driver declarations */ @@ -915,7 +920,7 @@ void XAutoRepeatOff(Display *display) keyboard_auto_repeat = FALSE; } -boolean MSDOSOpenAudio(void) +Bool MSDOSOpenAudio(void) { return allegro_init_audio(); } diff --git a/src/libgame/msdos.h b/src/libgame/msdos.h index c265b0d7..7523ef40 100644 --- a/src/libgame/msdos.h +++ b/src/libgame/msdos.h @@ -18,6 +18,7 @@ #include #include "allegro.h" + /* symbol 'window' is defined in DJGPP cross-compiler in libc.a(conio.o) */ #define window window_djgpp @@ -708,7 +709,7 @@ Bool XQueryPointer(Display *, Window, Window *, Window *, int *, int *, void XAutoRepeatOn(Display *); void XAutoRepeatOff(Display *); -boolean MSDOSOpenAudio(void); +Bool MSDOSOpenAudio(void); void MSDOSCloseAudio(void); void NetworkServer(int, int); diff --git a/src/libgame/pcx.c b/src/libgame/pcx.c index b075940c..6763edd3 100644 --- a/src/libgame/pcx.c +++ b/src/libgame/pcx.c @@ -13,10 +13,12 @@ #ifndef TARGET_SDL +#include + #include "pcx.h" -#include "image.h" #include "misc.h" + #define PCX_DEBUG FALSE #define PCX_MAGIC 0x0a /* first byte in a PCX image file */ diff --git a/src/libgame/pcx.h b/src/libgame/pcx.h index f214971b..304672fe 100644 --- a/src/libgame/pcx.h +++ b/src/libgame/pcx.h @@ -14,7 +14,9 @@ #ifndef PCX_H #define PCX_H -#include "libgame.h" +#include "system.h" +#include "image.h" + #if !defined(TARGET_SDL) diff --git a/src/libgame/private.c b/src/libgame/private.c deleted file mode 100644 index 90de58af..00000000 --- a/src/libgame/private.c +++ /dev/null @@ -1,22 +0,0 @@ -/*********************************************************** -* Rocks'n'Diamonds -- McDuffin Strikes Back! * -*----------------------------------------------------------* -* (c) 1995-98 Artsoft Entertainment * -* Holger Schemel * -* Oststrasse 11a * -* 33604 Bielefeld * -* phone: ++49 +521 290471 * -* email: aeglos@valinor.owl.de * -*----------------------------------------------------------* -* private.c * -***********************************************************/ - -#include "libgame.h" - -#if 0 -Display *display; -Visual *visual; -int screen; - -DrawWindow window = None; -#endif diff --git a/src/libgame/private.h b/src/libgame/private.h deleted file mode 100644 index e79f00d9..00000000 --- a/src/libgame/private.h +++ /dev/null @@ -1,27 +0,0 @@ -/*********************************************************** -* Rocks'n'Diamonds -- McDuffin Strikes Back! * -*----------------------------------------------------------* -* (c) 1995-98 Artsoft Entertainment * -* Holger Schemel * -* Oststrasse 11a * -* 33604 Bielefeld * -* phone: ++49 +521 290471 * -* email: aeglos@valinor.owl.de * -*----------------------------------------------------------* -* private.h * -***********************************************************/ - -#ifndef PRIVATE_H -#define PRIVATE_H - -#include "libgame.h" - -#if 0 -extern Display *display; -extern Visual *visual; -extern int screen; - -extern DrawWindow window; -#endif - -#endif /* PRIVATE_H */ diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 19526fe0..fed2a65e 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -12,9 +12,11 @@ * sdl.c * ***********************************************************/ -#include "libgame.h" +#include "system.h" +#include "misc.h" -#ifdef TARGET_SDL + +#if defined(TARGET_SDL) inline void SDLInitVideoDisplay(void) { diff --git a/src/libgame/sound.c b/src/libgame/sound.c index 745e3cd9..1cf7e5f1 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -11,13 +11,18 @@ * sound.c * ***********************************************************/ -#include "libgame.h" - -#include "main_TMP.h" +#include +#include +#include #include "sound.h" #include "misc.h" + +static int num_sounds = 0; +static struct SampleInfo *Sound = NULL; + + /*** THE STUFF BELOW IS ONLY USED BY THE SOUND SERVER CHILD PROCESS ***/ static int playing_sounds = 0; @@ -101,6 +106,7 @@ void UnixOpenAudio(struct AudioSystemInfo *audio) audio->device_name = audio_device_name[i]; audio->sound_available = TRUE; + audio->sound_enabled = TRUE; #if defined(AUDIO_STREAMING_DSP) audio->loops_available = TRUE; @@ -785,11 +791,18 @@ static int ulaw_to_linear(unsigned char ulawbyte) /*** THE STUFF BELOW IS ONLY USED BY THE MAIN PROCESS ***/ +void AllocSoundArray(int num) +{ + num_sounds = num; + Sound = checked_calloc(num_sounds * sizeof(struct SampleInfo)); +} + #define CHUNK_ID_LEN 4 /* IFF style chunk id length */ #define WAV_HEADER_SIZE 20 /* size of WAV file header */ -boolean LoadSound(struct SampleInfo *snd_info) +boolean LoadSound(int sound_nr, char *sound_name) { + struct SampleInfo *snd_info = &Sound[sound_nr]; char filename[256]; char *sound_ext = "wav"; #if !defined(TARGET_SDL) @@ -802,6 +815,8 @@ boolean LoadSound(struct SampleInfo *snd_info) #endif #endif + snd_info->name = sound_name; + sprintf(filename, "%s/%s/%s.%s", options.ro_base_directory, SOUNDS_DIRECTORY, snd_info->name, sound_ext); @@ -907,7 +922,7 @@ void PlaySoundExt(int nr, int volume, int stereo, boolean loop) { struct SoundControl snd_ctrl = emptySoundControl; - if (!audio.sound_available || !setup.sound) + if (!audio.sound_available || !audio.sound_enabled) return; if (volume +#include "platform.h" + #if defined(PLATFORM_LINUX) #include #endif -#define SND_BLOCKSIZE 4096 - #if defined(PLATFORM_LINUX) #include #elif defined(PLATFORM_FREEBSD) #include #elif defined(PLATFORM_HPUX) #include -#undef SND_BLOCKSIZE -#define SND_BLOCKSIZE 32768 #endif -#include "libgame.h" +#include "system.h" + #if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) || defined(VOXWARE) #define AUDIO_STREAMING_DSP @@ -44,6 +43,12 @@ #define MAX_SOUNDS_PLAYING 8 #endif +#if !defined(PLATFORM_HPUX) +#define SND_BLOCKSIZE 4096 +#else +#define SND_BLOCKSIZE 32768 +#endif + /* some values for PlaySound(), StopSound() and friends */ #if !defined(PLATFORM_MSDOS) #define PSND_SILENCE 0 @@ -155,7 +160,8 @@ void UnixCloseAudio(struct AudioSystemInfo *); void SoundServer(void); /* sound client functions */ -boolean LoadSound(struct SampleInfo *); +void AllocSoundArray(int); +boolean LoadSound(int, char *); void PlaySound(int); void PlaySoundStereo(int, int); void PlaySoundLoop(int); diff --git a/src/libgame/system.c b/src/libgame/system.c index 0304be81..30c3bc5c 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -20,9 +20,11 @@ #include #endif -#include "libgame.h" +#include "system.h" +#include "sound.h" +#include "misc.h" + -#if 0 /* ========================================================================= */ /* exported variables */ /* ========================================================================= */ @@ -33,6 +35,9 @@ struct VideoSystemInfo video; struct AudioSystemInfo audio; struct GfxInfo gfx; +struct LevelDirInfo *leveldir_first = NULL; +struct LevelDirInfo *leveldir_current = NULL; + Display *display = NULL; Visual *visual = NULL; int screen = 0; @@ -50,7 +55,6 @@ int redraw_tiles = 0; int FrameCounter = 0; -#endif /* ========================================================================= */ /* init functions */ @@ -431,6 +435,7 @@ inline boolean OpenAudio(struct AudioSystemInfo *audio) { audio->sound_available = FALSE; audio->loops_available = FALSE; + audio->sound_enabled = FALSE; audio->soundserver_pipe[0] = audio->soundserver_pipe[1] = 0; audio->soundserver_pid = 0; audio->device_name = NULL; @@ -441,12 +446,14 @@ inline boolean OpenAudio(struct AudioSystemInfo *audio) { audio->sound_available = TRUE; audio->loops_available = TRUE; + audio->sound_enabled = TRUE; } #elif defined(PLATFORM_MSDOS) if (MSDOSOpenAudio()) { audio->sound_available = TRUE; audio->loops_available = TRUE; + audio->sound_enabled = TRUE; } #elif defined(PLATFORM_UNIX) UnixOpenAudio(audio); @@ -467,6 +474,15 @@ inline void CloseAudio(struct AudioSystemInfo *audio) audio->sound_available = FALSE; audio->loops_available = FALSE; + audio->sound_enabled = FALSE; +} + +inline void SetAudioMode(boolean enabled) +{ + if (!audio.sound_available) + return; + + audio.sound_enabled = enabled; } diff --git a/src/libgame/system.h b/src/libgame/system.h index 9899f728..26565af0 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -15,9 +15,8 @@ #ifndef SYSTEM_H #define SYSTEM_H -/* -#include "libgame.h" -*/ +#include "platform.h" +#include "types.h" #if defined(PLATFORM_MSDOS) #include "msdos.h" @@ -73,6 +72,53 @@ #define REDRAWTILES_THRESHOLD (SCR_FIELDX * SCR_FIELDY / 2) +/* default name for empty highscore entry */ +#define EMPTY_PLAYER_NAME "no name" + +/* default name for unknown player names */ +#define ANONYMOUS_NAME "anonymous" + +/* default name for new levels */ +#define NAMELESS_LEVEL_NAME "nameless level" + +/* definitions for game sub-directories */ +#ifndef RO_GAME_DIR +#define RO_GAME_DIR "." +#endif + +#ifndef RW_GAME_DIR +#define RW_GAME_DIR "." +#endif + +#define RO_BASE_PATH RO_GAME_DIR +#define RW_BASE_PATH RW_GAME_DIR + +#define GRAPHICS_DIRECTORY "graphics" +#define SOUNDS_DIRECTORY "sounds" +#define LEVELS_DIRECTORY "levels" +#define TAPES_DIRECTORY "tapes" +#define SCORES_DIRECTORY "scores" + +/* areas in bitmap PIX_DOOR */ +/* meaning in PIX_DB_DOOR: (3 PAGEs) + PAGEX1: 1. buffer for DOOR_1 + PAGEX2: 2. buffer for DOOR_1 + PAGEX3: buffer for animations +*/ + +#define DOOR_GFX_PAGESIZE (gfx.dxsize) +#define DOOR_GFX_PAGEX1 (0 * DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEX2 (1 * DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEX3 (2 * DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEX4 (3 * DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEX5 (4 * DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEX6 (5 * DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEX7 (6 * DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEX8 (7 * DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEY1 (0) +#define DOOR_GFX_PAGEY2 (gfx.dysize) + + /* type definitions */ typedef int (*EventFilter)(const Event *); @@ -121,6 +167,7 @@ struct AudioSystemInfo { boolean sound_available; boolean loops_available; + boolean sound_enabled; int soundserver_pipe[2]; int soundserver_pid; char *device_name; @@ -142,8 +189,36 @@ struct GfxInfo int vxsize, vysize; }; +struct LevelDirInfo +{ + char *filename; /* level series single directory name */ + char *fullpath; /* complete path relative to level directory */ + char *basepath; /* absolute base path of level directory */ + char *name; /* level series name, as displayed on main screen */ + char *name_short; /* optional short name for level selection screen */ + char *name_sorting; /* optional sorting name for correct level sorting */ + char *author; /* level series author name levels without author */ + char *imported_from; /* optional comment for imported level series */ + int levels; /* number of levels in level series */ + int first_level; /* first level number (to allow start with 0 or 1) */ + int last_level; /* last level number (automatically calculated) */ + int sort_priority; /* sort levels by 'sort_priority' and then by name */ + boolean level_group; /* directory contains more level series directories */ + boolean parent_link; /* entry links back to parent directory */ + boolean user_defined; /* user defined levels are stored in home directory */ + boolean readonly; /* readonly levels can not be changed with editor */ + int color; /* color to use on selection screen for this level */ + char *class_desc; /* description of level series class */ + int handicap_level; /* number of the lowest unsolved level */ + int cl_first; /* internal control field for "choose level" screen */ + int cl_cursor; /* internal control field for "choose level" screen */ + + struct LevelDirInfo *node_parent; /* parent level directory info */ + struct LevelDirInfo *node_group; /* level group sub-directory info */ + struct LevelDirInfo *next; /* next level series structure node */ +}; + -#if 0 /* ========================================================================= */ /* exported variables */ /* ========================================================================= */ @@ -154,6 +229,9 @@ extern struct VideoSystemInfo video; extern struct AudioSystemInfo audio; extern struct GfxInfo gfx; +extern struct LevelDirInfo *leveldir_first; +extern struct LevelDirInfo *leveldir_current; + extern Display *display; extern Visual *visual; extern int screen; @@ -171,7 +249,6 @@ extern int redraw_tiles; extern int FrameCounter; -#endif /* function definitions */ @@ -207,6 +284,7 @@ inline boolean ChangeVideoModeIfNeeded(boolean); inline boolean OpenAudio(struct AudioSystemInfo *); inline void CloseAudio(struct AudioSystemInfo *); +inline void SetAudioMode(boolean); inline void InitEventFilter(EventFilter); inline boolean PendingEvent(void); diff --git a/src/libgame/text.c b/src/libgame/text.c index 6dfdf7f8..aab18ef6 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -11,9 +11,10 @@ * text.c * ***********************************************************/ +#include #include -#include "libgame.h" +#include "text.h" /* ========================================================================= */ diff --git a/src/libgame/text.h b/src/libgame/text.h index 4aee0437..7bbad09c 100644 --- a/src/libgame/text.h +++ b/src/libgame/text.h @@ -14,7 +14,8 @@ #ifndef TEXT_H #define TEXT_H -#include "libgame.h" +#include "system.h" + /* font types */ #define FS_SMALL 0 diff --git a/src/libgame/x11.c b/src/libgame/x11.c index fef8bcf9..931e9d5c 100644 --- a/src/libgame/x11.c +++ b/src/libgame/x11.c @@ -12,7 +12,9 @@ * x11.c * ***********************************************************/ -#include "libgame.h" +#include "system.h" +#include "misc.h" + #if defined(TARGET_X11) diff --git a/src/main.c b/src/main.c index 40a19333..427a74eb 100644 --- a/src/main.c +++ b/src/main.c @@ -142,7 +142,9 @@ struct LevelDirInfo *leveldir_first = NULL, *leveldir_current = NULL; struct LevelInfo level; struct PlayerInfo stored_player[MAX_PLAYERS], *local_player = NULL; struct HiScore highscore[MAX_SCORE_ENTRIES]; +#if 0 struct SampleInfo Sound[NUM_SOUNDS]; +#endif struct TapeInfo tape; #if 0 diff --git a/src/main.h b/src/main.h index b41c3829..6c0ec325 100644 --- a/src/main.h +++ b/src/main.h @@ -28,9 +28,7 @@ #define DEBUG_TIMING 0 #endif -#if 0 #include "libgame/libgame.h" -#endif #ifndef FALSE #define FALSE 0 @@ -521,7 +519,9 @@ extern struct LevelInfo level; extern struct PlayerInfo stored_player[], *local_player; extern struct HiScore highscore[]; extern struct TapeInfo tape; +#if 0 extern struct SampleInfo Sound[]; +#endif extern struct JoystickInfo joystick[]; #if 0 -- 2.34.1