added first version of simple click events for global animations
[rocksndiamonds.git] / src / libgame / misc.c
index 4ffb51c707adb555962ba68876d13e685f369e74..bb732ffa4ac8d517f511b236ea014f275a6c6247 100644 (file)
@@ -222,6 +222,18 @@ void Print(char *format, ...)
   va_end(ap);
 }
 
   va_end(ap);
 }
 
+void PrintNoLog(char *format, ...)
+{
+  FILE *file = program.log_file_default[LOG_OUT_ID];
+  va_list ap;
+
+  va_start(ap, format);
+  vfprintf(file, format, ap);
+  va_end(ap);
+
+  fflush(file);
+}
+
 void PrintLine(char *line_chars, int line_length)
 {
   int i;
 void PrintLine(char *line_chars, int line_length)
 {
   int i;
@@ -709,11 +721,19 @@ static char *getProgramMainDataPath()
     char *main_data_path_old = main_data_path;
 
     // cut relative path to Mac OS X application binary directory from path
     char *main_data_path_old = main_data_path;
 
     // cut relative path to Mac OS X application binary directory from path
-    main_data_path_old[strlen(main_data_path_old) -
-                      strlen(main_data_binary_subdir)] = '\0';
+    main_data_path[strlen(main_data_path) -
+                  strlen(main_data_binary_subdir)] = '\0';
+
+    // cut trailing path separator from path (but not if path is root directory)
+    if (strSuffix(main_data_path, "/") && !strEqual(main_data_path, "/"))
+      main_data_path[strlen(main_data_path) - 1] = '\0';
+
+    // replace empty path with current directory
+    if (strEqual(main_data_path, ""))
+      main_data_path = ".";
 
     // add relative path to Mac OS X application resources directory to path
 
     // add relative path to Mac OS X application resources directory to path
-    main_data_path = getPath2(main_data_path_old, main_data_files_subdir);
+    main_data_path = getPath2(main_data_path, main_data_files_subdir);
 
     free(main_data_path_old);
   }
 
     free(main_data_path_old);
   }
@@ -2762,6 +2782,14 @@ int get_parameter_value(char *value_raw, char *suffix, int type)
     if (string_has_parameter(value, "static_panel"))
       result |= ANIM_STATIC_PANEL;
   }
     if (string_has_parameter(value, "static_panel"))
       result |= ANIM_STATIC_PANEL;
   }
+  else if (strEqual(suffix, ".init_event") ||
+          strEqual(suffix, ".anim_event"))
+  {
+    result = ANIM_EVENT_DEFAULT;
+
+    if (string_has_parameter(value, "click"))
+      result |= ANIM_EVENT_CLICK;
+  }
   else if (strEqual(suffix, ".class"))
   {
     result = (strEqual(value, ARG_UNDEFINED) ? ARG_UNDEFINED_VALUE :
   else if (strEqual(suffix, ".class"))
   {
     result = (strEqual(value, ARG_UNDEFINED) ? ARG_UNDEFINED_VALUE :