projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changed setting cursor when automatically activating text input gadgets
[rocksndiamonds.git]
/
src
/
libgame
/
misc.c
diff --git
a/src/libgame/misc.c
b/src/libgame/misc.c
index fb265fab44a1c633590580a7c81949be7682577b..e4939b193db1d697d81d11b3ca64539397690346 100644
(file)
--- a/
src/libgame/misc.c
+++ b/
src/libgame/misc.c
@@
-336,7
+336,7
@@
boolean getTokenValueFromString(char *string, char **token, char **value)
/* maximal allowed length of a command line option */
#define MAX_OPTION_LEN 256
/* maximal allowed length of a command line option */
#define MAX_OPTION_LEN 256
-static unsigned int getCurrentMS()
+static unsigned int getCurrentMS(
void
)
{
return SDL_GetTicks();
}
{
return SDL_GetTicks();
}
@@
-558,7
+558,7
@@
static char *get_corrected_real_name(char *real_name)
}
#endif
}
#endif
-char *getLoginName()
+char *getLoginName(
void
)
{
static char *login_name = NULL;
{
static char *login_name = NULL;
@@
-588,7
+588,7
@@
char *getLoginName()
return login_name;
}
return login_name;
}
-char *getRealName()
+char *getRealName(
void
)
{
static char *real_name = NULL;
{
static char *real_name = NULL;
@@
-1141,7
+1141,7
@@
void SetError(char *format, ...)
va_end(ap);
}
va_end(ap);
}
-char *GetError()
+char *GetError(
void
)
{
return internal_error;
}
{
return internal_error;
}
@@
-1507,7
+1507,7
@@
void WriteUnusedBytesToFile(FILE *file, unsigned int bytes)
#define TRANSLATE_KEYNAME_TO_KEYSYM 2
#define TRANSLATE_X11KEYNAME_TO_KEYSYM 3
#define TRANSLATE_KEYNAME_TO_KEYSYM 2
#define TRANSLATE_X11KEYNAME_TO_KEYSYM 3
-void translate_keyname(Key *keysym, char **x11name, char **name, int mode)
+
static
void translate_keyname(Key *keysym, char **x11name, char **name, int mode)
{
static struct
{
{
static struct
{
@@
-1516,6
+1516,10
@@
void translate_keyname(Key *keysym, char **x11name, char **name, int mode)
char *name;
} translate_key[] =
{
char *name;
} translate_key[] =
{
+ /* return and escape keys */
+ { KSYM_Return, "XK_Return", "return" },
+ { KSYM_Escape, "XK_Escape", "escape" },
+
/* normal cursor keys */
{ KSYM_Left, "XK_Left", "cursor left" },
{ KSYM_Right, "XK_Right", "cursor right" },
/* normal cursor keys */
{ KSYM_Left, "XK_Left", "cursor left" },
{ KSYM_Right, "XK_Right", "cursor right" },
@@
-2039,12
+2043,37
@@
int get_switch3_from_string(char *s)
return result;
}
return result;
}
+int get_player_nr_from_string(char *s)
+{
+ static char *player_text[] =
+ {
+ "player_1",
+ "player_2",
+ "player_3",
+ "player_4",
+
+ NULL
+ };
+
+ char *s_lower = getStringToLower(s);
+ int result = 0;
+ int i;
+
+ for (i = 0; player_text[i] != NULL; i++)
+ if (strEqual(s_lower, player_text[i]))
+ result = i;
+
+ free(s_lower);
+
+ return result;
+}
+
/* ------------------------------------------------------------------------- */
/* functions for generic lists */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* functions for generic lists */
/* ------------------------------------------------------------------------- */
-ListNode *newListNode()
+ListNode *newListNode(
void
)
{
return checked_calloc(sizeof(ListNode));
}
{
return checked_calloc(sizeof(ListNode));
}
@@
-2116,7
+2145,8
@@
int getNumNodes(ListNode *node_first)
return (node_first ? 1 + getNumNodes(node_first->next) : 0);
}
return (node_first ? 1 + getNumNodes(node_first->next) : 0);
}
-void dumpList(ListNode *node_first)
+#if 0
+static void dumpList(ListNode *node_first)
{
ListNode *node = node_first;
{
ListNode *node = node_first;
@@
-2129,6
+2159,7
@@
void dumpList(ListNode *node_first)
printf("[%d nodes]\n", getNumNodes(node_first));
}
printf("[%d nodes]\n", getNumNodes(node_first));
}
+#endif
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
@@
-2515,7
+2546,8
@@
boolean fileExists(char *filename)
return success;
}
return success;
}
-boolean fileHasPrefix(char *basename, char *prefix)
+#if 0
+static boolean fileHasPrefix(char *basename, char *prefix)
{
static char *basename_lower = NULL;
int basename_length, prefix_length;
{
static char *basename_lower = NULL;
int basename_length, prefix_length;
@@
-2536,8
+2568,9
@@
boolean fileHasPrefix(char *basename, char *prefix)
return FALSE;
}
return FALSE;
}
+#endif
-boolean fileHasSuffix(char *basename, char *suffix)
+
static
boolean fileHasSuffix(char *basename, char *suffix)
{
static char *basename_lower = NULL;
int basename_length, suffix_length;
{
static char *basename_lower = NULL;
int basename_length, suffix_length;
@@
-2641,7
+2674,8
@@
char *get_mapped_token(char *token)
return NULL;
}
return NULL;
}
-char *get_special_base_token(struct ArtworkListInfo *artwork_info, char *token)
+static char *get_special_base_token(struct ArtworkListInfo *artwork_info,
+ char *token)
{
/* !!! make this dynamically configurable (init.c:InitArtworkConfig) !!! */
static struct ConfigTypeInfo prefix_list[] =
{
/* !!! make this dynamically configurable (init.c:InitArtworkConfig) !!! */
static struct ConfigTypeInfo prefix_list[] =
@@
-2739,7
+2773,7
@@
static boolean string_has_parameter(char *s, char *s_contained)
return string_has_parameter(substring, s_contained);
}
return string_has_parameter(substring, s_contained);
}
-int get_anim_parameter_value(char *s)
+
static
int get_anim_parameter_value(char *s)
{
char *pattern_1 = "click:anim_";
char *pattern_2 = ".part_";
{
char *pattern_1 = "click:anim_";
char *pattern_2 = ".part_";
@@
-2806,7
+2840,7
@@
int get_anim_parameter_value(char *s)
return result;
}
return result;
}
-int get_anim_action_parameter_value(char *token)
+
static
int get_anim_action_parameter_value(char *token)
{
int result = getImageIDFromToken(token);
{
int result = getImageIDFromToken(token);
@@
-2819,6
+2853,14
@@
int get_anim_action_parameter_value(char *token)
checked_free(gfx_token);
}
checked_free(gfx_token);
}
+ if (result == -1)
+ {
+ Key key = getKeyFromX11KeyName(token);
+
+ if (key != KSYM_UNDEFINED)
+ result = -(int)key;
+ }
+
if (result == -1)
result = ANIM_EVENT_ACTION_NONE;
if (result == -1)
result = ANIM_EVENT_ACTION_NONE;
@@
-2909,7
+2951,7
@@
int get_parameter_value(char *value_raw, char *suffix, int type)
else if (strEqual(suffix, ".init_event_action") ||
strEqual(suffix, ".anim_event_action"))
{
else if (strEqual(suffix, ".init_event_action") ||
strEqual(suffix, ".anim_event_action"))
{
- result = get_anim_action_parameter_value(value);
+ result = get_anim_action_parameter_value(value
_raw
);
}
else if (strEqual(suffix, ".class"))
{
}
else if (strEqual(suffix, ".class"))
{
@@
-3840,7
+3882,7
@@
char *getLogFilename(char *basename)
return getPath2(getUserGameDataDir(), basename);
}
return getPath2(getUserGameDataDir(), basename);
}
-void OpenLogFiles()
+void OpenLogFiles(
void
)
{
int i;
{
int i;
@@
-3862,7
+3904,7
@@
void OpenLogFiles()
}
}
}
}
-void CloseLogFiles()
+void CloseLogFiles(
void
)
{
int i;
{
int i;
@@
-3884,7
+3926,7
@@
void DumpLogFile(int nr)
fclose(log_file);
}
fclose(log_file);
}
-void NotifyUserAboutErrorFile()
+void NotifyUserAboutErrorFile(
void
)
{
#if defined(PLATFORM_WIN32)
char *title_text = getStringCat2(program.program_title, " Error Message");
{
#if defined(PLATFORM_WIN32)
char *title_text = getStringCat2(program.program_title, " Error Message");
@@
-3911,7
+3953,7
@@
void NotifyUserAboutErrorFile()
#define DEBUG_TIME_IN_MICROSECONDS 0
#if DEBUG_TIME_IN_MICROSECONDS
#define DEBUG_TIME_IN_MICROSECONDS 0
#if DEBUG_TIME_IN_MICROSECONDS
-static double Counter_Microseconds()
+static double Counter_Microseconds(
void
)
{
static struct timeval base_time = { 0, 0 };
struct timeval current_time;
{
static struct timeval base_time = { 0, 0 };
struct timeval current_time;
@@
-3931,7
+3973,7
@@
static double Counter_Microseconds()
}
#endif
}
#endif
-char *debug_print_timestamp_get_padding(int padding_size)
+
static
char *debug_print_timestamp_get_padding(int padding_size)
{
static char *padding = NULL;
int max_padding_size = 100;
{
static char *padding = NULL;
int max_padding_size = 100;
@@
-3980,7
+4022,8
@@
void debug_print_timestamp(int counter_nr, char *message)
unit);
}
unit);
}
-void debug_print_parent_only(char *format, ...)
+#if 0
+static void debug_print_parent_only(char *format, ...)
{
if (!IS_PARENT_PROCESS())
return;
{
if (!IS_PARENT_PROCESS())
return;
@@
-3996,10
+4039,11
@@
void debug_print_parent_only(char *format, ...)
printf("\n");
}
}
printf("\n");
}
}
+#endif
#endif /* DEBUG */
#endif /* DEBUG */
-void print_timestamp_ext(char *message, char *mode)
+
static
void print_timestamp_ext(char *message, char *mode)
{
#if DEBUG_PRINT_INIT_TIMESTAMPS
static char *debug_message = NULL;
{
#if DEBUG_PRINT_INIT_TIMESTAMPS
static char *debug_message = NULL;