fixed wrong position of global animations in 'door_2' in level editor
[rocksndiamonds.git] / src / anim.c
index fcf7ef36f13633a155a261af15213d1bae404508..824f86b5a159e441fc90c03112b0e45cc36cae0c 100644 (file)
@@ -854,10 +854,20 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part
   }
   else if (part->control_info.class == get_hash_from_key("door_2"))
   {
-    viewport_x = VX;
-    viewport_y = VY;
-    viewport_width  = VXSIZE;
-    viewport_height = VYSIZE;
+    if (part->mode_nr == GAME_MODE_EDITOR)
+    {
+      viewport_x = EX;
+      viewport_y = EY;
+      viewport_width  = EXSIZE;
+      viewport_height = EYSIZE;
+    }
+    else
+    {
+      viewport_x = VX;
+      viewport_y = VY;
+      viewport_width  = VXSIZE;
+      viewport_height = VYSIZE;
+    }
   }
   else         // default: "playfield"
   {
@@ -1072,7 +1082,7 @@ static boolean clickConsumed(struct GlobalAnimPartControlInfo *part)
 static void InitGlobalAnim_Triggered(struct GlobalAnimPartControlInfo *part,
                                     boolean *anything_clicked,
                                     boolean *any_event_action,
-                                    int event_value)
+                                    int event_value, char *info_text)
 {
   struct GlobalAnimControlInfo *ctrl = &global_anim_ctrl[part->mode_nr];
 
@@ -1103,8 +1113,8 @@ static void InitGlobalAnim_Triggered(struct GlobalAnimPartControlInfo *part,
        *anything_clicked = clickConsumed(part);        // click was on "part"!
 
 #if DEBUG_ANIM_EVENTS
-       printf("::: => %d.%d TRIGGERED BY %d.%d\n",
-              part2->old_anim_nr + 1, part2->old_nr + 1,
+       printf("::: => %d.%d TRIGGERED BY %s OF %d.%d\n",
+              part2->old_anim_nr + 1, part2->old_nr + 1, info_text,
               part->old_anim_nr + 1, part->old_nr + 1);
 #endif
 #if 0
@@ -1145,7 +1155,7 @@ static void HandleGlobalAnimEvent(struct GlobalAnimPartControlInfo *part,
 
   // check if this event is defined to trigger other animations
   InitGlobalAnim_Triggered(part, &anything_clicked, &any_event_action,
-                          event_value);
+                          event_value, info_text);
 }
 
 static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part,
@@ -1732,7 +1742,7 @@ static boolean InitGlobalAnim_Clicked(int mx, int my, boolean clicked)
 
          // check if this click is defined to trigger other animations
          InitGlobalAnim_Triggered(part, &anything_clicked, &any_event_action,
-                                  ANIM_EVENT_CLICK);
+                                  ANIM_EVENT_CLICK, "CLICK");
        }
       }
     }