]> granicus.if.org Git - nethack/commitdiff
Flip timed effects
authorPasi Kallinen <paxed@alt.org>
Sat, 14 Mar 2020 09:28:29 +0000 (11:28 +0200)
committerPasi Kallinen <paxed@alt.org>
Sat, 14 Mar 2020 09:28:32 +0000 (11:28 +0200)
In wizard mode, freezing some water on the ground, then
flipping the level did not flip the coordinate of the ice
thawing timed effect. This could cause an impossible complaint.

src/sp_lev.c

index 6cbd35be1f4cf7e95039379993e6da2af2b3c870..9f0d3b9430b43bd121f284bd7e512b5f6b00cbae 100755 (executable)
@@ -447,6 +447,7 @@ boolean extras;
     struct monst *mtmp;
     struct engr *etmp;
     struct mkroom *sroom;
+    timer_element *timer;
 
     get_level_extends(&minx, &miny, &maxx, &maxy);
     /* get_level_extends() returns -1,-1 to COLNO,ROWNO at max */
@@ -712,6 +713,19 @@ boolean extras;
            }
     }
 
+    /* timed effects */
+    for (timer = g.timer_base; timer; timer = timer->next) {
+        if (timer->func_index == MELT_ICE_AWAY) {
+            long ty = ((long)timer->arg.a_void) & 0xFFFF;
+            long tx = (((long)timer->arg.a_void) >> 16) & 0xFFFF;
+            if (flp & 1)
+                ty = FlipY(ty);
+            if (flp & 2)
+                tx = FlipX(tx);
+            timer->arg.a_void = (genericptr_t)((tx << 16) | ty);
+        }
+    }
+
     if (extras) {
         /* flip hero location only if inside the flippable area */
         if (!(u.ux < minx || u.ux > maxx || u.uy < miny || u.uy > maxy)) {