projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added missing free() for local string variable
[rocksndiamonds.git]
/
src
/
files.c
diff --git
a/src/files.c
b/src/files.c
index 706b819e701fa4905d691d8e6cc609703dea37a9..66109470dfc7ab57007b5db46b0a43a23adc1fdb 100644
(file)
--- a/
src/files.c
+++ b/
src/files.c
@@
-2334,7
+2334,7
@@
static void copyLevelFileInfo(struct LevelFileInfo *lfi_from,
// functions for loading R'n'D level
// ----------------------------------------------------------------------------
// functions for loading R'n'D level
// ----------------------------------------------------------------------------
-
static
int getMappedElement(int element)
+int getMappedElement(int element)
{
// remap some (historic, now obsolete) elements
{
// remap some (historic, now obsolete) elements
@@
-4274,7
+4274,7
@@
static int getMappedElement_DC(int element)
break;
case 0x13f5:
break;
case 0x13f5:
- element = EL_YAMYAM;
+ element = EL_YAMYAM
_UP
;
break;
case 0x1425:
break;
case 0x1425:
@@
-5300,7
+5300,7
@@
static int getMappedElement_DC(int element)
break;
case 0x1682: // secret gate (red)
break;
case 0x1682: // secret gate (red)
- element = EL_GATE_1_GRAY;
+ element = EL_
EM_
GATE_1_GRAY;
break;
case 0x1683: // gate (yellow)
break;
case 0x1683: // gate (yellow)
@@
-5308,7
+5308,7
@@
static int getMappedElement_DC(int element)
break;
case 0x1684: // secret gate (yellow)
break;
case 0x1684: // secret gate (yellow)
- element = EL_GATE_2_GRAY;
+ element = EL_
EM_
GATE_2_GRAY;
break;
case 0x1685: // gate (blue)
break;
case 0x1685: // gate (blue)
@@
-5316,7
+5316,7
@@
static int getMappedElement_DC(int element)
break;
case 0x1686: // secret gate (blue)
break;
case 0x1686: // secret gate (blue)
- element = EL_GATE_4_GRAY;
+ element = EL_
EM_
GATE_4_GRAY;
break;
case 0x1687: // gate (green)
break;
case 0x1687: // gate (green)
@@
-5324,7
+5324,7
@@
static int getMappedElement_DC(int element)
break;
case 0x1688: // secret gate (green)
break;
case 0x1688: // secret gate (green)
- element = EL_GATE_3_GRAY;
+ element = EL_
EM_
GATE_3_GRAY;
break;
case 0x1689: // gate (white)
break;
case 0x1689: // gate (white)
@@
-5717,6
+5717,13
@@
static void LoadLevelFromFileStream_DC(File *file, struct LevelInfo *level,
level->extra_time = header[56] | (header[57] << 8);
level->shield_normal_time = header[58] | (header[59] << 8);
level->extra_time = header[56] | (header[57] << 8);
level->shield_normal_time = header[58] | (header[59] << 8);
+ // shield and extra time elements do not have a score
+ level->score[SC_SHIELD] = 0;
+ level->extra_time_score = 0;
+
+ // set time for normal and deadly shields to the same value
+ level->shield_deadly_time = level->shield_normal_time;
+
// Diamond Caves has the same (strange) behaviour as Emerald Mine that gems
// can slip down from flat walls, like normal walls and steel walls
level->em_slippery_gems = TRUE;
// Diamond Caves has the same (strange) behaviour as Emerald Mine that gems
// can slip down from flat walls, like normal walls and steel walls
level->em_slippery_gems = TRUE;
@@
-9146,6
+9153,14
@@
static struct TokenInfo debug_setup_tokens[] =
TYPE_BOOLEAN,
&setup.debug.show_frames_per_second, "debug.show_frames_per_second"
},
TYPE_BOOLEAN,
&setup.debug.show_frames_per_second, "debug.show_frames_per_second"
},
+ {
+ TYPE_SWITCH3,
+ &setup.debug.xsn_mode, "debug.xsn_mode"
+ },
+ {
+ TYPE_INTEGER,
+ &setup.debug.xsn_percent, "debug.xsn_percent"
+ },
};
static struct TokenInfo options_setup_tokens[] =
};
static struct TokenInfo options_setup_tokens[] =
@@
-9419,11
+9434,16
@@
static void setSetupInfoToDefaults(struct SetupInfo *si)
si->debug.show_frames_per_second = FALSE;
si->debug.show_frames_per_second = FALSE;
+ si->debug.xsn_mode = AUTO;
+ si->debug.xsn_percent = 0;
+
si->options.verbose = FALSE;
#if defined(PLATFORM_ANDROID)
si->fullscreen = TRUE;
#endif
si->options.verbose = FALSE;
#if defined(PLATFORM_ANDROID)
si->fullscreen = TRUE;
#endif
+
+ setHideSetupEntry(&setup.debug.xsn_mode);
}
static void setSetupInfoToDefaults_AutoSetup(struct SetupInfo *si)
}
static void setSetupInfoToDefaults_AutoSetup(struct SetupInfo *si)
@@
-9470,10
+9490,21
@@
void setHideSetupEntry(void *setup_value)
{
char *hide_setup_token = getHideSetupToken(setup_value);
{
char *hide_setup_token = getHideSetupToken(setup_value);
+ if (hide_setup_hash == NULL)
+ hide_setup_hash = newSetupFileHash();
+
if (setup_value != NULL)
setHashEntry(hide_setup_hash, hide_setup_token, "");
}
if (setup_value != NULL)
setHashEntry(hide_setup_hash, hide_setup_token, "");
}
+void removeHideSetupEntry(void *setup_value)
+{
+ char *hide_setup_token = getHideSetupToken(setup_value);
+
+ if (setup_value != NULL)
+ removeHashEntry(hide_setup_hash, hide_setup_token);
+}
+
boolean hideSetupEntry(void *setup_value)
{
char *hide_setup_token = getHideSetupToken(setup_value);
boolean hideSetupEntry(void *setup_value)
{
char *hide_setup_token = getHideSetupToken(setup_value);
@@
-9495,6
+9526,8
@@
static void setSetupInfoFromTokenText(SetupFileHash *setup_file_hash,
// check if this setup option should be hidden in the setup menu
if (token_hide_value != NULL && get_boolean_from_string(token_hide_value))
setHideSetupEntry(token_info[token_nr].value);
// check if this setup option should be hidden in the setup menu
if (token_hide_value != NULL && get_boolean_from_string(token_hide_value))
setHideSetupEntry(token_info[token_nr].value);
+
+ free(token_hide_text);
}
static void setSetupInfoFromTokenInfo(SetupFileHash *setup_file_hash,
}
static void setSetupInfoFromTokenInfo(SetupFileHash *setup_file_hash,
@@
-9512,9
+9545,6
@@
static void decodeSetupFileHash(SetupFileHash *setup_file_hash)
if (!setup_file_hash)
return;
if (!setup_file_hash)
return;
- if (hide_setup_hash == NULL)
- hide_setup_hash = newSetupFileHash();
-
for (i = 0; i < ARRAY_SIZE(global_setup_tokens); i++)
setSetupInfoFromTokenInfo(setup_file_hash, global_setup_tokens, i);
for (i = 0; i < ARRAY_SIZE(global_setup_tokens); i++)
setSetupInfoFromTokenInfo(setup_file_hash, global_setup_tokens, i);
@@
-9856,7
+9886,9
@@
void SaveSetup(void)
fprintf(file, "\n");
for (i = 0; i < ARRAY_SIZE(debug_setup_tokens); i++)
fprintf(file, "\n");
for (i = 0; i < ARRAY_SIZE(debug_setup_tokens); i++)
- fprintf(file, "%s\n", getSetupLine(debug_setup_tokens, "", i));
+ if (!strPrefix(debug_setup_tokens[i].text, "debug.xsn_") ||
+ setup.debug.xsn_mode != AUTO)
+ fprintf(file, "%s\n", getSetupLine(debug_setup_tokens, "", i));
fprintf(file, "\n");
for (i = 0; i < ARRAY_SIZE(options_setup_tokens); i++)
fprintf(file, "\n");
for (i = 0; i < ARRAY_SIZE(options_setup_tokens); i++)