projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed compiler warnings (after adding "-Wmissing-prototypes")
[rocksndiamonds.git]
/
src
/
files.c
diff --git
a/src/files.c
b/src/files.c
index 21bede9a7be2fbf873b82a6ee3b2ae10e64d0512..4ca23663e68e4bfbd4101ec9aa522a6e57a94b37 100644
(file)
--- a/
src/files.c
+++ b/
src/files.c
@@
-251,6
+251,12
@@
static struct LevelFileConfigInfo chunk_config_INFO[] =
&li.auto_count_gems, FALSE
},
&li.auto_count_gems, FALSE
},
+ {
+ -1, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(11),
+ &li.solved_by_one_player, FALSE
+ },
+
{
-1, -1,
-1, -1,
{
-1, -1,
-1, -1,
@@
-1398,7
+1404,7
@@
static boolean check_special_flags(char *flag)
return FALSE;
}
return FALSE;
}
-static struct DateInfo getCurrentDate()
+static struct DateInfo getCurrentDate(
void
)
{
time_t epoch_seconds = time(NULL);
struct tm *now = localtime(&epoch_seconds);
{
time_t epoch_seconds = time(NULL);
struct tm *now = localtime(&epoch_seconds);
@@
-1421,7
+1427,7
@@
static void resetEventFlags(struct ElementChangeInfo *change)
change->has_event[i] = FALSE;
}
change->has_event[i] = FALSE;
}
-static void resetEventBits()
+static void resetEventBits(
void
)
{
int i;
{
int i;
@@
-1862,7
+1868,7
@@
static void setFileInfoToDefaults(struct LevelFileInfo *level_file_info)
int getMappedElement_SB(int, boolean);
int getMappedElement_SB(int, boolean);
-static void ActivateLevelTemplate()
+static void ActivateLevelTemplate(
void
)
{
int x, y;
{
int x, y;
@@
-2153,12
+2159,12
@@
static int getFiletypeFromID(char *filetype_id)
return filetype;
}
return filetype;
}
-char *getLocalLevelTemplateFilename()
+char *getLocalLevelTemplateFilename(
void
)
{
return getDefaultLevelFilename(-1);
}
{
return getDefaultLevelFilename(-1);
}
-char *getGlobalLevelTemplateFilename()
+char *getGlobalLevelTemplateFilename(
void
)
{
/* global variable "leveldir_current" must be modified in the loop below */
LevelDirTree *leveldir_current_last = leveldir_current;
{
/* global variable "leveldir_current" must be modified in the loop below */
LevelDirTree *leveldir_current_last = leveldir_current;
@@
-2305,7
+2311,7
@@
static void copyLevelFileInfo(struct LevelFileInfo *lfi_from,
/* functions for loading R'n'D level */
/* ------------------------------------------------------------------------- */
/* functions for loading R'n'D level */
/* ------------------------------------------------------------------------- */
-int getMappedElement(int element)
+
static
int getMappedElement(int element)
{
/* remap some (historic, now obsolete) elements */
{
/* remap some (historic, now obsolete) elements */
@@
-2356,7
+2362,7
@@
int getMappedElement(int element)
return element;
}
return element;
}
-int getMappedElementByVersion(int element, int game_version)
+
static
int getMappedElementByVersion(int element, int game_version)
{
/* remap some elements due to certain game version */
{
/* remap some elements due to certain game version */
@@
-3478,7
+3484,7
@@
static void LoadLevelFromFileInfo_RND(struct LevelInfo *level,
/* functions for loading EM level */
/* ------------------------------------------------------------------------- */
/* functions for loading EM level */
/* ------------------------------------------------------------------------- */
-void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
+
static
void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
{
static int ball_xy[8][2] =
{
{
static int ball_xy[8][2] =
{
@@
-3606,7
+3612,7
@@
void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
}
}
}
}
-void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
+
static
void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
{
static int ball_xy[8][2] =
{
{
static int ball_xy[8][2] =
{
@@
-3707,7
+3713,7
@@
void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
/* functions for loading SP level */
/* ------------------------------------------------------------------------- */
/* functions for loading SP level */
/* ------------------------------------------------------------------------- */
-void CopyNativeLevel_RND_to_SP(struct LevelInfo *level)
+
static
void CopyNativeLevel_RND_to_SP(struct LevelInfo *level)
{
struct LevelInfo_SP *level_sp = level->native_sp_level;
LevelInfoType *header = &level_sp->header;
{
struct LevelInfo_SP *level_sp = level->native_sp_level;
LevelInfoType *header = &level_sp->header;
@@
-3791,7
+3797,7
@@
void CopyNativeLevel_RND_to_SP(struct LevelInfo *level)
}
}
}
}
-void CopyNativeLevel_SP_to_RND(struct LevelInfo *level)
+
static
void CopyNativeLevel_SP_to_RND(struct LevelInfo *level)
{
struct LevelInfo_SP *level_sp = level->native_sp_level;
LevelInfoType *header = &level_sp->header;
{
struct LevelInfo_SP *level_sp = level->native_sp_level;
LevelInfoType *header = &level_sp->header;
@@
-3951,7
+3957,7
@@
static void CopyNativeTape_RND_to_SP(struct LevelInfo *level)
demo->is_available = TRUE;
}
demo->is_available = TRUE;
}
-static void setTapeInfoToDefaults();
+static void setTapeInfoToDefaults(
void
);
static void CopyNativeTape_SP_to_RND(struct LevelInfo *level)
{
static void CopyNativeTape_SP_to_RND(struct LevelInfo *level)
{
@@
-4004,7
+4010,7
@@
static void CopyNativeTape_SP_to_RND(struct LevelInfo *level)
/* functions for loading MM level */
/* ------------------------------------------------------------------------- */
/* functions for loading MM level */
/* ------------------------------------------------------------------------- */
-void CopyNativeLevel_RND_to_MM(struct LevelInfo *level)
+
static
void CopyNativeLevel_RND_to_MM(struct LevelInfo *level)
{
struct LevelInfo_MM *level_mm = level->native_mm_level;
int x, y;
{
struct LevelInfo_MM *level_mm = level->native_mm_level;
int x, y;
@@
-4041,7
+4047,7
@@
void CopyNativeLevel_RND_to_MM(struct LevelInfo *level)
level_mm->field[x][y] = map_element_RND_to_MM(level->field[x][y]);
}
level_mm->field[x][y] = map_element_RND_to_MM(level->field[x][y]);
}
-void CopyNativeLevel_MM_to_RND(struct LevelInfo *level)
+
static
void CopyNativeLevel_MM_to_RND(struct LevelInfo *level)
{
struct LevelInfo_MM *level_mm = level->native_mm_level;
int x, y;
{
struct LevelInfo_MM *level_mm = level->native_mm_level;
int x, y;
@@
-4087,7
+4093,8
@@
void CopyNativeLevel_MM_to_RND(struct LevelInfo *level)
#define DC_LEVEL_HEADER_SIZE 344
#define DC_LEVEL_HEADER_SIZE 344
-unsigned short getDecodedWord_DC(unsigned short data_encoded, boolean init)
+static unsigned short getDecodedWord_DC(unsigned short data_encoded,
+ boolean init)
{
static int last_data_encoded;
static int offset1;
{
static int last_data_encoded;
static int offset1;
@@
-4126,7
+4133,7
@@
unsigned short getDecodedWord_DC(unsigned short data_encoded, boolean init)
return data_decoded;
}
return data_decoded;
}
-int getMappedElement_DC(int element)
+
static
int getMappedElement_DC(int element)
{
switch (element)
{
{
switch (element)
{
@@
-6395,6
+6402,10
@@
static void LoadLevel_InitVersion(struct LevelInfo *level)
/* EM style elements always chain-exploded in R'n'D engine before 3.2.6 */
if (level->game_version < VERSION_IDENT(3,2,6,0))
level->em_explodes_by_fire = TRUE;
/* EM style elements always chain-exploded in R'n'D engine before 3.2.6 */
if (level->game_version < VERSION_IDENT(3,2,6,0))
level->em_explodes_by_fire = TRUE;
+
+ /* levels were solved by the first player entering an exit up to 4.1.0.0 */
+ if (level->game_version <= VERSION_IDENT(4,1,0,0))
+ level->solved_by_one_player = TRUE;
}
static void LoadLevel_InitStandardElements(struct LevelInfo *level)
}
static void LoadLevel_InitStandardElements(struct LevelInfo *level)
@@
-6596,7
+6607,7
@@
static void LoadLevel_InitNativeEngines(struct LevelInfo *level)
CopyNativeLevel_RND_to_Native(level);
}
CopyNativeLevel_RND_to_Native(level);
}
-static void LoadLevelTemplate_LoadAndInit()
+static void LoadLevelTemplate_LoadAndInit(
void
)
{
LoadLevelFromFileInfo(&level_template, &level_template.file_info, FALSE);
{
LoadLevelFromFileInfo(&level_template, &level_template.file_info, FALSE);
@@
-6620,21
+6631,21
@@
void LoadLevelTemplate(int nr)
LoadLevelTemplate_LoadAndInit();
}
LoadLevelTemplate_LoadAndInit();
}
-static void Load
LevelTemplateFromNetwork(struct LevelFileInfo *lfi_network_template
)
+static void Load
NetworkLevelTemplate(struct NetworkLevelInfo *network_level
)
{
{
- copyLevelFileInfo(
lfi_network_template
, &level_template.file_info);
+ copyLevelFileInfo(
&network_level->tmpl_info
, &level_template.file_info);
LoadLevelTemplate_LoadAndInit();
}
LoadLevelTemplate_LoadAndInit();
}
-static void LoadLevel_LoadAndInit(struct
LevelFileInfo *lfi_network_template
)
+static void LoadLevel_LoadAndInit(struct
NetworkLevelInfo *network_level
)
{
LoadLevelFromFileInfo(&level, &level.file_info, FALSE);
if (level.use_custom_template)
{
{
LoadLevelFromFileInfo(&level, &level.file_info, FALSE);
if (level.use_custom_template)
{
- if (
lfi_network_template
!= NULL)
- Load
LevelTemplateFromNetwork(lfi_network_template
);
+ if (
network_level
!= NULL)
+ Load
NetworkLevelTemplate(network_level
);
else
LoadLevelTemplate(-1);
}
else
LoadLevelTemplate(-1);
}
@@
-6648,6
+6659,8
@@
static void LoadLevel_LoadAndInit(struct LevelFileInfo *lfi_network_template)
void LoadLevel(int nr)
{
void LoadLevel(int nr)
{
+ SetLevelSetInfo(leveldir_current->identifier, nr);
+
setLevelFileInfo(&level.file_info, nr);
LoadLevel_LoadAndInit(NULL);
setLevelFileInfo(&level.file_info, nr);
LoadLevel_LoadAndInit(NULL);
@@
-6660,12
+6673,14
@@
void LoadLevelInfoOnly(int nr)
LoadLevelFromFileInfo(&level, &level.file_info, TRUE);
}
LoadLevelFromFileInfo(&level, &level.file_info, TRUE);
}
-void LoadLevelFromNetwork(struct LevelFileInfo *lfi_network_level,
- struct LevelFileInfo *lfi_network_template)
+void LoadNetworkLevel(struct NetworkLevelInfo *network_level)
{
{
- copyLevelFileInfo(lfi_network_level, &level.file_info);
+ SetLevelSetInfo(network_level->leveldir_identifier,
+ network_level->file_info.nr);
+
+ copyLevelFileInfo(&network_level->file_info, &level.file_info);
- LoadLevel_LoadAndInit(
lfi_network_template
);
+ LoadLevel_LoadAndInit(
network_level
);
}
static int SaveLevel_VERS(FILE *file, struct LevelInfo *level)
}
static int SaveLevel_VERS(FILE *file, struct LevelInfo *level)
@@
-7500,7
+7515,7
@@
void SaveLevel(int nr)
SaveLevelFromFilename(&level, filename, FALSE);
}
SaveLevelFromFilename(&level, filename, FALSE);
}
-void SaveLevelTemplate()
+void SaveLevelTemplate(
void
)
{
char *filename = getLocalLevelTemplateFilename();
{
char *filename = getLocalLevelTemplateFilename();
@@
-7570,7
+7585,7
@@
void DumpLevel(struct LevelInfo *level)
/* tape file functions */
/* ========================================================================= */
/* tape file functions */
/* ========================================================================= */
-static void setTapeInfoToDefaults()
+static void setTapeInfoToDefaults(
void
)
{
int i;
{
int i;
@@
-7770,7
+7785,7
@@
static int LoadTape_BODY(File *file, int chunk_size, struct TapeInfo *tape)
return chunk_size;
}
return chunk_size;
}
-void LoadTape_SokobanSolution(char *filename)
+
static
void LoadTape_SokobanSolution(char *filename)
{
File *file;
int move_delay = TILESIZE / level.initial_player_stepsize[0];
{
File *file;
int move_delay = TILESIZE / level.initial_player_stepsize[0];
@@
-9264,7
+9279,7
@@
void LoadSetupFromFilename(char *filename)
}
}
}
}
-static void LoadSetup_SpecialPostProcessing()
+static void LoadSetup_SpecialPostProcessing(
void
)
{
char *player_name_new;
{
char *player_name_new;
@@
-9285,7
+9300,7
@@
static void LoadSetup_SpecialPostProcessing()
MIN(MAX(MIN_SCROLL_DELAY, setup.scroll_delay_value), MAX_SCROLL_DELAY);
}
MIN(MAX(MIN_SCROLL_DELAY, setup.scroll_delay_value), MAX_SCROLL_DELAY);
}
-void LoadSetup()
+void LoadSetup(
void
)
{
char *filename;
{
char *filename;
@@
-9306,7
+9321,7
@@
void LoadSetup()
LoadSetup_SpecialPostProcessing();
}
LoadSetup_SpecialPostProcessing();
}
-void LoadSetup_AutoSetup()
+void LoadSetup_AutoSetup(
void
)
{
char *filename = getPath2(getSetupDir(), AUTOSETUP_FILENAME);
SetupFileHash *setup_file_hash = NULL;
{
char *filename = getPath2(getSetupDir(), AUTOSETUP_FILENAME);
SetupFileHash *setup_file_hash = NULL;
@@
-9326,7
+9341,7
@@
void LoadSetup_AutoSetup()
free(filename);
}
free(filename);
}
-void LoadSetup_EditorCascade()
+void LoadSetup_EditorCascade(
void
)
{
char *filename = getPath2(getSetupDir(), EDITORCASCADE_FILENAME);
SetupFileHash *setup_file_hash = NULL;
{
char *filename = getPath2(getSetupDir(), EDITORCASCADE_FILENAME);
SetupFileHash *setup_file_hash = NULL;
@@
-9395,7
+9410,7
@@
static void LoadSetup_ReadGameControllerMappings(SetupFileHash *mappings_hash,
fclose(file);
}
fclose(file);
}
-void SaveSetup()
+void SaveSetup(
void
)
{
char *filename = getSetupFilename();
FILE *file;
{
char *filename = getSetupFilename();
FILE *file;
@@
-9508,7
+9523,7
@@
void SaveSetup()
SetFilePermissions(filename, PERMS_PRIVATE);
}
SetFilePermissions(filename, PERMS_PRIVATE);
}
-void SaveSetup_AutoSetup()
+void SaveSetup_AutoSetup(
void
)
{
char *filename = getPath2(getSetupDir(), AUTOSETUP_FILENAME);
FILE *file;
{
char *filename = getPath2(getSetupDir(), AUTOSETUP_FILENAME);
FILE *file;
@@
-9536,7
+9551,7
@@
void SaveSetup_AutoSetup()
free(filename);
}
free(filename);
}
-void SaveSetup_EditorCascade()
+void SaveSetup_EditorCascade(
void
)
{
char *filename = getPath2(getSetupDir(), EDITORCASCADE_FILENAME);
FILE *file;
{
char *filename = getPath2(getSetupDir(), EDITORCASCADE_FILENAME);
FILE *file;
@@
-9605,7
+9620,7
@@
void SaveSetup_AddGameControllerMapping(char *mapping)
free(filename);
}
free(filename);
}
-void LoadCustomElementDescriptions()
+void LoadCustomElementDescriptions(
void
)
{
char *filename = getCustomArtworkConfigFilename(ARTWORK_TYPE_GRAPHICS);
SetupFileHash *setup_file_hash;
{
char *filename = getCustomArtworkConfigFilename(ARTWORK_TYPE_GRAPHICS);
SetupFileHash *setup_file_hash;
@@
-9667,7
+9682,7
@@
static int get_token_parameter_value(char *token, char *value_raw)
return get_parameter_value(value_raw, suffix, TYPE_INTEGER);
}
return get_parameter_value(value_raw, suffix, TYPE_INTEGER);
}
-void InitMenuDesignSettings_Static()
+void InitMenuDesignSettings_Static(
void
)
{
int i;
{
int i;
@@
-9682,7
+9697,7
@@
void InitMenuDesignSettings_Static()
}
}
}
}
-static void InitMenuDesignSettings_SpecialPreProcessing()
+static void InitMenuDesignSettings_SpecialPreProcessing(
void
)
{
int i;
{
int i;
@@
-9774,7
+9789,7
@@
static void InitMenuDesignSettings_SpecialPreProcessing()
}
}
}
}
-static void InitMenuDesignSettings_SpecialPostProcessing()
+static void InitMenuDesignSettings_SpecialPostProcessing(
void
)
{
static struct
{
{
static struct
{
@@
-9803,7
+9818,7
@@
static void InitMenuDesignSettings_SpecialPostProcessing()
*game_buttons_xy[i].dst = *game_buttons_xy[i].src;
}
*game_buttons_xy[i].dst = *game_buttons_xy[i].src;
}
-static void InitMenuDesignSettings_SpecialPostProcessing_AfterGraphics()
+static void InitMenuDesignSettings_SpecialPostProcessing_AfterGraphics(
void
)
{
static struct
{
{
static struct
{
@@
-10237,7
+10252,7
@@
static void LoadMenuDesignSettingsFromFilename(char *filename)
freeSetupFileHash(setup_file_hash);
}
freeSetupFileHash(setup_file_hash);
}
-void LoadMenuDesignSettings()
+void LoadMenuDesignSettings(
void
)
{
char *filename_base = UNDEFINED_FILENAME, *filename_local;
{
char *filename_base = UNDEFINED_FILENAME, *filename_local;
@@
-10261,7
+10276,7
@@
void LoadMenuDesignSettings()
InitMenuDesignSettings_SpecialPostProcessing();
}
InitMenuDesignSettings_SpecialPostProcessing();
}
-void LoadMenuDesignSettings_AfterGraphics()
+void LoadMenuDesignSettings_AfterGraphics(
void
)
{
InitMenuDesignSettings_SpecialPostProcessing_AfterGraphics();
}
{
InitMenuDesignSettings_SpecialPostProcessing_AfterGraphics();
}
@@
-10463,7
+10478,7
@@
static boolean sound_info_listed(struct MusicFileInfo *list, char *basename)
return music_info_listed_ext(list, basename, TRUE);
}
return music_info_listed_ext(list, basename, TRUE);
}
-void LoadMusicInfo()
+void LoadMusicInfo(
void
)
{
char *music_directory = getCustomMusicDirectory();
int num_music = getMusicListSize();
{
char *music_directory = getCustomMusicDirectory();
int num_music = getMusicListSize();
@@
-10590,8
+10605,8
@@
void LoadMusicInfo()
}
}
}
}
-
void add_helpanim_entry(int element, int action, int direction, int delay
,
- int *num_list_entries)
+
static void add_helpanim_entry(int element, int action, int direction
,
+
int delay,
int *num_list_entries)
{
struct HelpAnimInfo *new_list_entry;
(*num_list_entries)++;
{
struct HelpAnimInfo *new_list_entry;
(*num_list_entries)++;
@@
-10607,7
+10622,7
@@
void add_helpanim_entry(int element, int action, int direction, int delay,
new_list_entry->delay = delay;
}
new_list_entry->delay = delay;
}
-void print_unknown_token(char *filename, char *token, int token_nr)
+
static
void print_unknown_token(char *filename, char *token, int token_nr)
{
if (token_nr == 0)
{
{
if (token_nr == 0)
{
@@
-10619,13
+10634,13
@@
void print_unknown_token(char *filename, char *token, int token_nr)
Error(ERR_INFO, "- token: '%s'", token);
}
Error(ERR_INFO, "- token: '%s'", token);
}
-void print_unknown_token_end(int token_nr)
+
static
void print_unknown_token_end(int token_nr)
{
if (token_nr > 0)
Error(ERR_INFO_LINE, "-");
}
{
if (token_nr > 0)
Error(ERR_INFO_LINE, "-");
}
-void LoadHelpAnimInfo()
+void LoadHelpAnimInfo(
void
)
{
char *filename = getHelpAnimFilename();
SetupFileList *setup_file_list = NULL, *list;
{
char *filename = getHelpAnimFilename();
SetupFileList *setup_file_list = NULL, *list;
@@
-10835,7
+10850,7
@@
void LoadHelpAnimInfo()
#endif
}
#endif
}
-void LoadHelpTextInfo()
+void LoadHelpTextInfo(
void
)
{
char *filename = getHelpTextFilename();
int i;
{
char *filename = getHelpTextFilename();
int i;
@@
-10877,7
+10892,7
@@
void LoadHelpTextInfo()
#define MAX_NUM_CONVERT_LEVELS 1000
#define MAX_NUM_CONVERT_LEVELS 1000
-void ConvertLevels()
+void ConvertLevels(
void
)
{
static LevelDirTree *convert_leveldir = NULL;
static int convert_level_nr = -1;
{
static LevelDirTree *convert_leveldir = NULL;
static int convert_level_nr = -1;
@@
-10989,7
+11004,7
@@
void ConvertLevels()
/* create and save images for use in level sketches (raw BMP format) */
/* ------------------------------------------------------------------------- */
/* create and save images for use in level sketches (raw BMP format) */
/* ------------------------------------------------------------------------- */
-void CreateLevelSketchImages()
+void CreateLevelSketchImages(
void
)
{
#if defined(TARGET_SDL)
Bitmap *bitmap1;
{
#if defined(TARGET_SDL)
Bitmap *bitmap1;