Assorted minor fixes and retabbing
authorMartin Read <martin@blackswordsonics.com>
Tue, 24 Sep 2013 19:45:03 +0000 (20:45 +0100)
committerMartin Read <martin@blackswordsonics.com>
Tue, 24 Sep 2013 19:45:03 +0000 (20:45 +0100)
12 files changed:
combat.c
display.h
main.c
map.c
misc.c
mon2.c
objects.c
objects.h
sorcery.c
sorcery.h
u.c
vector.c

index 616877a..a5765b6 100644 (file)
--- a/combat.c
+++ b/combat.c
@@ -34,16 +34,16 @@ int player_attack(int dy, int dx)
 {
     if ((objects[u.weapon].obj_id == PO_BOW) || (objects[u.weapon].obj_id == PO_CROSSBOW))
     {
-       ushootm(dy, dx);
+        ushootm(dy, dx);
     }
     else if (mapmonster[u.y + dy][u.x + dx] != -1)
     {
-       uhitm(mapmonster[u.y + dy][u.x + dx]);
+        uhitm(mapmonster[u.y + dy][u.x + dx]);
     }
     else
     {
-       print_msg("Nothing to attack.\n");
-       return 0;
+        print_msg("Nothing to attack.\n");
+        return 0;
     }
     return 1;
 }
@@ -61,64 +61,64 @@ int uhitm(int mon)
     tohit = zero_die(u.agility + u.level);
     if (tohit < mp->defence)
     {
-       print_msg("You miss.\n");
-       return 0;       /* Missed. */
+        print_msg("You miss.\n");
+        return 0;       /* Missed. */
     }
     print_msg("You hit ");
     print_mon_name(mon, 1);
     print_msg(".\n");
     if (u.weapon != -1)
     {
-       wep = objects + u.weapon;
-       pwep = permobjs + wep->obj_id;
-       damage = one_die(pwep->power) + (u.body / 10);
+        wep = objects + u.weapon;
+        pwep = permobjs + wep->obj_id;
+        damage = one_die(pwep->power) + (u.body / 10);
     }
     else
     {
-       damage = u.body / 10;
+        damage = u.body / 10;
     }
     if (u.ring != -1)
     {
-       ring = objects + u.ring;
-       switch (ring->obj_id)
-       {
-       case PO_RING_FIRE:
-           if (!pmon_resists_fire(mp->mon_id))
-           {
-               print_msg("Your ring burns ");
-               print_mon_name(mon, 1);
-               print_msg("!\n");
-               damage += (damage + 1) / 2 + dice(2, 4);
-           }
-           break;
-       case PO_RING_VAMPIRE:
-           if (!pmon_is_undead(mp->mon_id))
-           {
-               print_msg("Your ring drains ");
-               print_mon_name(mon, 1);
-               print_msg("!\n");
-               damage += (damage + 3) / 4 + dice(2, 4);
-               healing = (damage + 5) / 6;
-               heal_u(healing, 0, 1);
-           }
-           break;
-       case PO_RING_FROST:
-           if (!pmon_resists_cold(mp->mon_id))
-           {
-               print_msg("Your ring freezes ");
-               print_mon_name(mon, 1);
-               print_msg("!\n");
-               damage += (damage + 2) / 3 + dice(1, 6);
-           }
-       }
+        ring = objects + u.ring;
+        switch (ring->obj_id)
+        {
+        case PO_RING_FIRE:
+            if (!pmon_resists_fire(mp->mon_id))
+            {
+                print_msg("Your ring burns ");
+                print_mon_name(mon, 1);
+                print_msg("!\n");
+                damage += (damage + 1) / 2 + dice(2, 4);
+            }
+            break;
+        case PO_RING_VAMPIRE:
+            if (!pmon_is_undead(mp->mon_id))
+            {
+                print_msg("Your ring drains ");
+                print_mon_name(mon, 1);
+                print_msg("!\n");
+                damage += (damage + 3) / 4 + dice(2, 4);
+                healing = (damage + 5) / 6;
+                heal_u(healing, 0, 1);
+            }
+            break;
+        case PO_RING_FROST:
+            if (!pmon_resists_cold(mp->mon_id))
+            {
+                print_msg("Your ring freezes ");
+                print_mon_name(mon, 1);
+                print_msg("!\n");
+                damage += (damage + 2) / 3 + dice(1, 6);
+            }
+        }
     }
     print_msg("You do %d damage.\n", damage);
     damage_mon(mon, damage, 1);
     if (u.weapon != -1)
     {
-       damage_obj(u.weapon);
+        damage_obj(u.weapon);
     }
-    return 1;  /* Hit. */
+    return 1;   /* Hit. */
 }
 
 int ushootm(int sy, int sx)
@@ -141,26 +141,26 @@ int ushootm(int sy, int sx)
     range = 1;
     for ( ; !done; (y += sy), (x += sx))
     {
-       if (mapmonster[y][x] != -1)
-       {
-           done = 1;
-           mptr = monsters + mapmonster[y][x];
-           tohit = zero_die(u.agility + u.level - range);
-           if (range == 1)
-           {
-               /* Shooting at point-blank is tricky */
-               tohit = (tohit + 1) / 2;
-           }
-           if (tohit >= mptr->defence)
-           {
-               if (mon_visible(mapmonster[y][x]))
-               {
-                   print_msg("You hit ");
-                   print_mon_name(mapmonster[y][x], 1);
-                   print_msg(".\n");
-                   print_msg("You do %d damage.\n", damage);
-               }
-               damage_mon(mapmonster[y][x], damage, 1);
+        if (mapmonster[y][x] != -1)
+        {
+            done = 1;
+            mptr = monsters + mapmonster[y][x];
+            tohit = zero_die(u.agility + u.level - range);
+            if (range == 1)
+            {
+                /* Shooting at point-blank is tricky */
+                tohit = (tohit + 1) / 2;
+            }
+            if (tohit >= mptr->defence)
+            {
+                if (mon_visible(mapmonster[y][x]))
+                {
+                    print_msg("You hit ");
+                    print_mon_name(mapmonster[y][x], 1);
+                    print_msg(".\n");
+                    print_msg("You do %d damage.\n", damage);
+                }
+                damage_mon(mapmonster[y][x], damage, 1);
                 if ((mptr->used) && (wep->obj_id == PO_THUNDERBOW))
                 {
                     int kb = knockback_mon(mapmonster[y][x], sy, sx, true, true);
@@ -177,22 +177,22 @@ int ushootm(int sy, int sx)
                         break;
                     }
                 }
-               return 1;
-           }
-           else
-           {
-               print_msg("You miss ");
-               print_mon_name(mapmonster[y][x], 1);
-               print_msg(".\n");
-               return 0;
-           }
-       }
-       else if ((terrain[y][x] == WALL) || (terrain[y][x] == HARDWALL) ||
+                return 1;
+            }
+            else
+            {
+                print_msg("You miss ");
+                print_mon_name(mapmonster[y][x], 1);
+                print_msg(".\n");
+                return 0;
+            }
+        }
+        else if ((terrain[y][x] == WALL) || (terrain[y][x] == HARDWALL) ||
                  (terrain[y][x] == DOOR))
-       {
-           print_msg("Your %s hits the %s.\n", (wep->obj_id == PO_CROSSBOW) ? "bolt" : "arrow", (terrain[y][x] == DOOR) ? "door" : "wall");
-           return 0;
-       }
+        {
+            print_msg("Your %s hits the %s.\n", (wep->obj_id == PO_CROSSBOW) ? "bolt" : "arrow", (terrain[y][x] == DOOR) ? "door" : "wall");
+            return 0;
+        }
     }
     return 0;
 }
@@ -206,21 +206,21 @@ int mhitu(int mon, enum damtyp dtype)
     tohit = zero_die(mptr->mtohit + 5);
     if (tohit < u.defence)
     {
-       /* Note: Yes, all attacks can damage your armour. Deal. */
-       if ((u.armour != -1) && (tohit > agility_modifier()))
-       {
-           /* Monster hit your armour. */
-           print_msg("Your armour deflects ");
-           print_mon_name(mon, 1);
-           print_msg("'s blow.\n");
-           damage_obj(u.armour);
-       }
-       else
-       {
-           print_mon_name(mon, 3);
-           print_msg(" misses you.\n");
-       }
-       return 0;
+        /* Note: Yes, all attacks can damage your armour. Deal. */
+        if ((u.armour != -1) && (tohit > agility_modifier()))
+        {
+            /* Monster hit your armour. */
+            print_msg("Your armour deflects ");
+            print_mon_name(mon, 1);
+            print_msg("'s blow.\n");
+            damage_obj(u.armour);
+        }
+        else
+        {
+            print_mon_name(mon, 3);
+            print_msg(" misses you.\n");
+        }
+        return 0;
     }
     damage = one_die(mptr->mdam);
     unaffected = player_resists_dtype(dtype);
@@ -228,76 +228,76 @@ int mhitu(int mon, enum damtyp dtype)
     print_msg(" hits you.\n");
     if (u.armourmelt && (!zero_die(3)))
     {
-       /* If you're subject to armourmelt, it is decreed that one
-        * blow in three hits your dust-weak armour and rips a chunk
-        * out of it. */
-       damage_obj(u.armour);
+        /* If you're subject to armourmelt, it is decreed that one
+         * blow in three hits your dust-weak armour and rips a chunk
+         * out of it. */
+        damage_obj(u.armour);
     }
 test_unaffected:
     if (unaffected)
     {
-       switch (dtype)
-       {
-       case DT_PHYS:
-           print_msg("Can't happen: player resisting physical damage\n");
-           unaffected = 0;
-           /* Turn off the player's resistance, because they're
-            * not supposed to have it! */
-           u.resistances[DT_PHYS] = 0;
-           goto test_unaffected;
-       case DT_FIRE:
-           print_msg("The flames seem pleasantly warm.\n");
-           if (unaffected & RESIST_RING)
-           {
-               print_msg("Your ring flashes red.\n");
-           }
-           break;
-       case DT_COLD:
-           print_msg("Its touch seems pleasantly cool.\n");
-           if (unaffected & RESIST_RING)
-           {
-               print_msg("Your ring flashes blue.\n");
-           }
-           break;
-       case DT_NECRO:
-           print_msg("Its touch makes you feel no deader.\n");
-           if (objects[u.ring].obj_id == PO_RING_VAMPIRE)
-           {
-               print_msg("Your ring shrieks.\n");
-           }
-           break;
-       default:
-           print_msg("Can't happen: bogus damage type.\n");
-           break;
-       }
+        switch (dtype)
+        {
+        case DT_PHYS:
+            print_msg("Can't happen: player resisting physical damage\n");
+            unaffected = 0;
+            /* Turn off the player's resistance, because they're
+             * not supposed to have it! */
+            u.resistances[DT_PHYS] = 0;
+            goto test_unaffected;
+        case DT_FIRE:
+            print_msg("The flames seem pleasantly warm.\n");
+            if (unaffected & RESIST_RING)
+            {
+                print_msg("Your ring flashes red.\n");
+            }
+            break;
+        case DT_COLD:
+            print_msg("Its touch seems pleasantly cool.\n");
+            if (unaffected & RESIST_RING)
+            {
+                print_msg("Your ring flashes blue.\n");
+            }
+            break;
+        case DT_NECRO:
+            print_msg("Its touch makes you feel no deader.\n");
+            if (objects[u.ring].obj_id == PO_RING_VAMPIRE)
+            {
+                print_msg("Your ring shrieks.\n");
+            }
+            break;
+        default:
+            print_msg("Can't happen: bogus damage type.\n");
+            break;
+        }
     }
     else
     {
-       switch (dtype)
-       {
-       default:
-       case DT_PHYS:
-           break;
-       case DT_FIRE:
-           print_msg("You are engulfed in flames.\n");
-           break;
-       case DT_COLD:
-           print_msg("You are covered in frost.\n");
-           break;
-       case DT_NECRO:
-           print_msg("You feel your life force slipping away.\n");
-           break;
-       }
-       print_msg("You take %d damage.\n", damage);
-       if ((mptr->mon_id == PM_VAMPIRE) && !player_resists_dtype(DT_NECRO))
-       {
-           heal_mon(mon, damage * 2 / 5, 1);
-       } else if ((tohit - u.defence >= 5) && (mptr->mon_id == PM_SNAKE))
-       {
-           drain_body(1, "snake venom", 0);
-       }
-       damage_u(damage, DEATH_KILLED_MON, permons[mptr->mon_id].name);
-       display_update();
+        switch (dtype)
+        {
+        default:
+        case DT_PHYS:
+            break;
+        case DT_FIRE:
+            print_msg("You are engulfed in flames.\n");
+            break;
+        case DT_COLD:
+            print_msg("You are covered in frost.\n");
+            break;
+        case DT_NECRO:
+            print_msg("You feel your life force slipping away.\n");
+            break;
+        }
+        print_msg("You take %d damage.\n", damage);
+        if ((mptr->mon_id == PM_VAMPIRE) && !player_resists_dtype(DT_NECRO))
+        {
+            heal_mon(mon, damage * 2 / 5, 1);
+        } else if ((tohit - u.defence >= 5) && (mptr->mon_id == PM_SNAKE))
+        {
+            drain_body(1, "snake venom", 0);
+        }
+        damage_u(damage, DEATH_KILLED_MON, permons[mptr->mon_id].name);
+        display_update();
     }
     return 1;
 }
@@ -332,132 +332,132 @@ int mshootu(int mon)
     dtype = permons[mptr->mon_id].rdtyp;
     if (dtype == DT_PHYS)
     {
-       print_msg(" %s at you!\n", permons[mptr->mon_id].shootverb);
+        print_msg(" %s at you!\n", permons[mptr->mon_id].shootverb);
     }
     else
     {
-       print_msg(" %s %s at you!\n", permons[mptr->mon_id].shootverb, damtype_names[dtype]);
+        print_msg(" %s %s at you!\n", permons[mptr->mon_id].shootverb, damtype_names[dtype]);
     }
     if ((dtype == DT_NECRO) || (dtype == DT_ELEC))
     {
-       /* Use agility-based defence for necromantic blasts and lightning
-        * bolts */
-       evasion = u.agility * 100;
-       if (u.armour != -1)
-       {
-           evasion -= (u.agility * evasion_penalty(u.armour));
-       }
-       defence = evasion / 200;
+        /* Use agility-based defence for necromantic blasts and lightning
+         * bolts */
+        evasion = u.agility * 100;
+        if (u.armour != -1)
+        {
+            evasion -= (u.agility * evasion_penalty(u.armour));
+        }
+        defence = evasion / 200;
     }
     else
     {
-       defence = u.defence;
+        defence = u.defence;
     }
     /* Move projectile one square before looking for targets. */
     for ((done = 0), (y = mptr->y + sy), (x = mptr->x + sx);
-        !done;
-        (y += sy), (x += sx))
+         !done;
+         (y += sy), (x += sx))
     {
-       if ((terrain[y][x] == WALL) || (terrain[y][x] == DOOR))
-       {
-           done = 1;
-       }
-       if ((y == u.y) && (x == u.x))
-       {
-           if (tohit >= defence)
-           {
-               done = 1;
-               print_msg("It hits you!\n");
-               unaffected = player_resists_dtype(dtype);
-               if (unaffected)
-               {
-                   if (unaffected & RESIST_RING)
-                   {
-                       switch (dtype)
-                       {
-                       case DT_COLD:
-                           if (objects[u.ring].obj_id == PO_RING_FROST)
-                           {
-                               print_msg("Your ring flashes blue.\n");
-                           }
-                           break;
-                       case DT_FIRE:
-                           if (objects[u.ring].obj_id == PO_RING_FIRE)
-                           {
-                               print_msg("Your ring flashes red.\n");
-                           }
-                           break;
-                       case DT_NECRO:
-                           if (objects[u.ring].obj_id == PO_RING_VAMPIRE)
-                           {
-                               print_msg("Your ring shrieks.\n");
-                           }
-                           break;
-                       default:
-                           break;
-                       }
-                   }
-               }
-               if (!unaffected)
-               {
-                   damage = one_die(mptr->rdam);
-                   print_msg("You take %d damage.\n", damage);
-                   damage_u(damage, DEATH_KILLED_MON, permons[mptr->mon_id].name);
-               }
-               display_update();
-               return 1;
-           }
-           else
-           {
-               print_msg("It misses you.\n");
-           }
-       }
-       else if (mapmonster[y][x] != -1)
-       {
-           done = 1;
-           bystander = monsters + mapmonster[y][x];
-           switch (dtype)
-           {
-           case DT_COLD:
-               if (pmon_resists_cold(bystander->mon_id))
-               {
-                   unaffected = 1;
-               }
-               else
-               {
-                   unaffected = 0;
-               }
-               break;
-           case DT_FIRE:
-               if (pmon_resists_fire(bystander->mon_id))
-               {
-                   unaffected = 1;
-               }
-               else
-               {
-                   unaffected = 0;
-               }
-               break;
-           case DT_NECRO:
-               if (pmon_is_undead(bystander->mon_id))
-               {
-                   unaffected = 1;
-               }
-               else
-               {
-                   unaffected = 0;
-               }
-               break;
-           default:
-               unaffected = 0;
-               break;
-           }
-           if (tohit >= bystander->defence)
-           {
-               damage = one_die(mptr->rdam);
-               damage_mon(mapmonster[y][x], dtype, 0);
-           }
-       }
+        if ((terrain[y][x] == WALL) || (terrain[y][x] == DOOR))
+        {
+            done = 1;
+        }
+        if ((y == u.y) && (x == u.x))
+        {
+            if (tohit >= defence)
+            {
+                done = 1;
+                print_msg("It hits you!\n");
+                unaffected = player_resists_dtype(dtype);
+                if (unaffected)
+                {
+                    if (unaffected & RESIST_RING)
+                    {
+                        switch (dtype)
+                        {
+                        case DT_COLD:
+                            if (objects[u.ring].obj_id == PO_RING_FROST)
+                            {
+                                print_msg("Your ring flashes blue.\n");
+                            }
+                            break;
+                        case DT_FIRE:
+                            if (objects[u.ring].obj_id == PO_RING_FIRE)
+                            {
+                                print_msg("Your ring flashes red.\n");
+                            }
+                            break;
+                        case DT_NECRO:
+                            if (objects[u.ring].obj_id == PO_RING_VAMPIRE)
+                            {
+                                print_msg("Your ring shrieks.\n");
+                            }
+                            break;
+                        default:
+                            break;
+                        }
+                    }
+                }
+                if (!unaffected)
+                {
+                    damage = one_die(mptr->rdam);
+                    print_msg("You take %d damage.\n", damage);
+                    damage_u(damage, DEATH_KILLED_MON, permons[mptr->mon_id].name);
+                }
+                display_update();
+                return 1;
+            }
+            else
+            {
+                print_msg("It misses you.\n");
+            }
+        }
+        else if (mapmonster[y][x] != -1)
+        {
+            done = 1;
+            bystander = monsters + mapmonster[y][x];
+            switch (dtype)
+            {
+            case DT_COLD:
+                if (pmon_resists_cold(bystander->mon_id))
+                {
+                    unaffected = 1;
+                }
+                else
+                {
+                    unaffected = 0;
+                }
+                break;
+            case DT_FIRE:
+                if (pmon_resists_fire(bystander->mon_id))
+                {
+                    unaffected = 1;
+                }
+                else
+                {
+                    unaffected = 0;
+                }
+                break;
+            case DT_NECRO:
+                if (pmon_is_undead(bystander->mon_id))
+                {
+                    unaffected = 1;
+                }
+                else
+                {
+                    unaffected = 0;
+                }
+                break;
+            default:
+                unaffected = 0;
+                break;
+            }
+            if (tohit >= bystander->defence)
+            {
+                damage = one_die(mptr->rdam);
+                damage_mon(mapmonster[y][x], dtype, 0);
+            }
+        }
     }
     return 0;
 }
index 36fc807..1ec39ca 100644 (file)
--- a/display.h
+++ b/display.h
 #ifndef DISPLAY_H
 #define DISPLAY_H
 
-#define DBCLR_L_GREY   0
-#define DBCLR_D_GREY   1
-#define DBCLR_RED      2
-#define DBCLR_BLUE     3
-#define DBCLR_GREEN    4
-#define DBCLR_PURPLE   5
-#define DBCLR_BROWN    6
-#define DBCLR_CYAN     7
-#define DBCLR_WHITE    8
-#define DBCLR_L_RED    9
-#define DBCLR_L_BLUE   10
-#define DBCLR_L_GREEN  11
-#define DBCLR_L_PURPLE 12
-#define DBCLR_YELLOW   13
-#define DBCLR_L_CYAN   14
+#define DBCLR_L_GREY    0
+#define DBCLR_D_GREY    1
+#define DBCLR_RED       2
+#define DBCLR_BLUE      3
+#define DBCLR_GREEN     4
+#define DBCLR_PURPLE    5
+#define DBCLR_BROWN     6
+#define DBCLR_CYAN      7
+#define DBCLR_WHITE     8
+#define DBCLR_L_RED     9
+#define DBCLR_L_BLUE    10
+#define DBCLR_L_GREEN   11
+#define DBCLR_L_PURPLE  12
+#define DBCLR_YELLOW    13
+#define DBCLR_L_CYAN    14
 
 extern void print_msg(const char *fmt, ...);
 extern int read_input(char *buffer, int length);
diff --git a/main.c b/main.c
index d8652de..e20e48a 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1,6 +1,8 @@
-/* main.c
- * 
- * Copyright 2005-2012 Martin Read
+/* \file main.c
+ * \brief main core of Victrix Abyssi
+ */
+
+/* Copyright 2005-2013 Martin Read
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -49,10 +51,10 @@ static void rebuild_mapmons(void)
     int i;
     for (i = 0; i < 100; i++)
     {
-       if (monsters[i].used)
-       {
-           mapmonster[monsters[i].y][monsters[i].x] = i;
-       }
+        if (monsters[i].used)
+        {
+            mapmonster[monsters[i].y][monsters[i].x] = i;
+        }
     }
 }
 
@@ -61,10 +63,10 @@ static void rebuild_mapobjs(void)
     int i;
     for (i = 0; i < 100; i++)
     {
-       if (objects[i].used && !objects[i].with_you)
-       {
-           mapobject[objects[i].y][objects[i].x] = i;
-       }
+        if (objects[i].used && !objects[i].with_you)
+        {
+            mapobject[objects[i].y][objects[i].x] = i;
+        }
     }
 }
 
@@ -75,7 +77,7 @@ unsigned int convert_range(int dy, int dx)
     adx = dx > 0 ? dx : -dx;
     if (ady > adx)
     {
-       return ady;
+        return ady;
     }
     return adx;
 }
@@ -131,7 +133,7 @@ void load_game(void)
     fread(&game_tick, 1, sizeof game_tick, fp);
     fclose(fp);
     unlink("victrix-abyssi.sav");
-    touch_back_buffer();
+    explore_around(u.y, u.x);
     status_updated = 1;
     map_updated = 1;
     hard_redraw = 1;
@@ -153,7 +155,7 @@ int one_die(int sides)
     int rval;
     if (sides < 2)
     {
-       return 1;
+        return 1;
     }
     rval = 1 + (rng() / ((RNG_MAX / sides) + 1));
     return rval;
@@ -164,7 +166,7 @@ int zero_die(int sides)
     int rval;
     if (sides < 2)
     {
-       return 0;
+        return 0;
     }
     rval = rng() / ((RNG_MAX / sides) + 1);
     return rval;
@@ -175,7 +177,7 @@ int dice(int count, int sides)
     int total = 0;
     for ( ; count > 0; count--)
     {
-       total += one_die(sides);
+        total += one_die(sides);
     }
     return total;
 }
@@ -200,71 +202,71 @@ int do_command(enum game_cmd cmd)
     switch (cmd)
     {
     case MOVE_NORTH:
-       return move_player(-1, 0);
+        return move_player(-1, 0);
     case MOVE_SOUTH:
-       return move_player(1, 0);
+        return move_player(1, 0);
     case MOVE_EAST:
-       return move_player(0, 1);
+        return move_player(0, 1);
     case MOVE_WEST:
-       return move_player(0, -1);
+        return move_player(0, -1);
     case MOVE_NW:
-       return move_player(-1, -1);
+        return move_player(-1, -1);
     case MOVE_NE:
-       return move_player(-1, 1);
+        return move_player(-1, 1);
     case MOVE_SE:
-       return move_player(1, 1);
+        return move_player(1, 1);
     case MOVE_SW:
-       return move_player(1, -1);
+        return move_player(1, -1);
 
     case ATTACK:
-       i = select_dir(&sy, &sx);
-       if (i != -1)
-       {
-           return player_attack(sy, sx);
-       }
-       return 0;
+        i = select_dir(&sy, &sx);
+        if (i != -1)
+        {
+            return player_attack(sy, sx);
+        }
+        return 0;
 
     case GET_ITEM:
-       if (mapobject[u.y][u.x] != -1)
-       {
-           attempt_pickup();
-           return 1;
-       }
-       else
-       {
-           print_msg("Nothing to get.\n");
-           return 0;
-       }
+        if (mapobject[u.y][u.x] != -1)
+        {
+            attempt_pickup();
+            return 1;
+        }
+        else
+        {
+            print_msg("Nothing to get.\n");
+            return 0;
+        }
 
     case WIELD_WEAPON:
-       j = 0;
-       i = inv_select(POCLASS_WEAPON, "wield", 1);
-       if (i == -2)
-       {
-           u.weapon = -1;
-           print_msg("Weapon unwielded.\n");
-       }
-       else if (i >= 0)
-       {
-           u.weapon = u.inventory[i];
-           j = 1;
-           print_msg("Wielding ");
-           print_obj_name(u.weapon);
-           print_msg(".\n");
-       }
-       return j;
+        j = 0;
+        i = inv_select(POCLASS_WEAPON, "wield", 1);
+        if (i == -2)
+        {
+            u.weapon = -1;
+            print_msg("Weapon unwielded.\n");
+        }
+        else if (i >= 0)
+        {
+            u.weapon = u.inventory[i];
+            j = 1;
+            print_msg("Wielding ");
+            print_obj_name(u.weapon);
+            print_msg(".\n");
+        }
+        return j;
 
     case WEAR_ARMOUR:
-       if (u.armour >= 0)
-       {
-           print_msg("You are already wearing armour.\n");
-           return 0;
-       }
-       i = inv_select(POCLASS_ARMOUR, "wear", 0);
-       if (i >= 0)
-       {
-           u.armour = u.inventory[i];
-           recalc_defence();
+        if (u.armour >= 0)
+        {
+            print_msg("You are already wearing armour.\n");
+            return 0;
+        }
+        i = inv_select(POCLASS_ARMOUR, "wear", 0);
+        if (i >= 0)
+        {
+            u.armour = u.inventory[i];
+            recalc_defence();
             if (objects[u.armour].obj_id == PO_RIBBONS)
             {
                 print_msg("You grit your teeth, trying to get used to the tingle of\nthe ribbons' magic against your skin.\n");
@@ -275,9 +277,9 @@ int do_command(enum game_cmd cmd)
                 print_obj_name(u.armour);
                 print_msg(".\n");
             }
-           return 1;
-       }
-       return 0;
+            return 1;
+        }
+        return 0;
 
     case EMANATE_ARMOUR:
         if (u.armour == -1)
@@ -304,82 +306,82 @@ int do_command(enum game_cmd cmd)
         return magic_ring();
 
     case TAKE_OFF_ARMOUR:
-       if (u.armour != -1)
-       {
+        if (u.armour != -1)
+        {
             if ((u.resistances[DT_FIRE] == RESIST_ARMOUR) &&
                 (terrain[u.y][u.x] == LAVA))
             {
                 print_msg("Your armour is your only current source of fire\nresistance; removing it here would incinerate you.\n");
                 return 0;
             }
-           u.armour = -1;
-           recalc_defence();
-           print_msg("You take off your armour.\n");
-           return 1;
-       }
-       else
-       {
-           print_msg("You aren't wearing any armour.\n");
-           return 0;
-       }
+            u.armour = -1;
+            recalc_defence();
+            print_msg("You take off your armour.\n");
+            return 1;
+        }
+        else
+        {
+            print_msg("You aren't wearing any armour.\n");
+            return 0;
+        }
 
     case GIVE_HELP:
-       print_help();
-       return 0;
+        print_help();
+        return 0;
 
     case GO_DOWN_STAIRS:
-       if (terrain[u.y][u.x] == STAIRS)
-       {
-           leave_level();
-           make_new_level();
-       }
-       else
-       {
-           print_msg("There are no stairs here.\n");
-       }
-       return 0;
+        if (terrain[u.y][u.x] == STAIRS)
+        {
+            leave_level();
+            make_new_level();
+        }
+        else
+        {
+            print_msg("There are no stairs here.\n");
+        }
+        return 0;
 
     case STAND_STILL:
-       return 1;
+        return 1;
 
     case READ_SCROLL:
-       i = inv_select(POCLASS_SCROLL, "read", 0);
-       if (i >= 0)
-       {
-           j = read_scroll(u.inventory[i]);
-           if (j)
-           {
-               u.inventory[i] = -1;
-           }
-           return 1;
-       }
-       return 0;
+        i = inv_select(POCLASS_SCROLL, "read", 0);
+        if (i >= 0)
+        {
+            j = read_scroll(u.inventory[i]);
+            if (j)
+            {
+                u.inventory[i] = -1;
+            }
+            return 1;
+        }
+        return 0;
 
     case EAT_FOOD:
-       i = inv_select(POCLASS_FOOD, "eat", 0);
-       if (i >= 0)
-       {
-           j = eat_food(u.inventory[i]);
-           if (j == -1)
-           {
-               u.inventory[i] = -1;
-           }
+        i = inv_select(POCLASS_FOOD, "eat", 0);
+        if (i >= 0)
+        {
+            j = eat_food(u.inventory[i]);
+            if (j == -1)
+            {
+                u.inventory[i] = -1;
+            }
             return 1;
-       }
-       return 0;
+        }
+        return 0;
 
     case QUAFF_POTION:
-       i = inv_select(POCLASS_POTION, "quaff", 0);
-       if (i >= 0)
-       {
-           j = quaff_potion(u.inventory[i]);
-           if (j)
-           {
-               u.inventory[i] = -1;
-           }
-           return 1;
-       }
-       return 0;
+        i = inv_select(POCLASS_POTION, "quaff", 0);
+        if (i >= 0)
+        {
+            j = quaff_potion(u.inventory[i]);
+            if (j)
+            {
+                u.inventory[i] = -1;
+            }
+            return 1;
+        }
+        return 0;
 
     case THROW_FLASK:
         i = inv_select(POCLASS_FLASK, "throw", 0);
@@ -394,17 +396,17 @@ int do_command(enum game_cmd cmd)
         return 0;
 
     case REMOVE_RING:
-       if (u.ring == -1)
-       {
-           print_msg("You have no ring to remove!\n");
-           return 0;
-       }
+        if (u.ring == -1)
+        {
+            print_msg("You have no ring to remove!\n");
+            return 0;
+        }
         else if ((terrain[u.y][u.x] == LAVA) && (u.resistances[DT_FIRE] == RESIST_RING))
         {
             print_msg("That ring is your only current source of fire resistance. Removing\nit here would incinerate you.\n");
             return 0;
         }
-       else if ((objects[u.ring].obj_id == PO_RING_FROST) && (terrain[u.y][u.x] == WATER))
+        else if ((objects[u.ring].obj_id == PO_RING_FROST) && (terrain[u.y][u.x] == WATER))
         {
             print_msg("Since nobody ever taught you to swim, removing that ring\nhere would result in your death by drowning.\n");
             return 0;
@@ -429,114 +431,114 @@ int do_command(enum game_cmd cmd)
             print_obj_name(u.ring);
             print_msg(".\n");
             return 1;
-       }
-       return 0;
+        }
+        return 0;
     case INSPECT_ITEM:
-       i = inv_select(POCLASS_NONE, "inspect", 0);
-       if ((i >= 0) && (u.inventory[i] != -1))
-       {
-           describe_object(u.inventory[i]);
-       }
-       return 0;
+        i = inv_select(POCLASS_NONE, "inspect", 0);
+        if ((i >= 0) && (u.inventory[i] != -1))
+        {
+            describe_object(u.inventory[i]);
+        }
+        return 0;
     case EXAMINE_MONSTER:
-       print_msg("Monster examination not implemented yet.\n");
-       return 0;
+        print_msg("Monster examination not implemented yet.\n");
+        return 0;
     case SHOW_TERRAIN:
-       show_terrain = 1;
-       touch_back_buffer();
+        show_terrain = 1;
+        touch_back_buffer();
         display_update();
-       print_msg("Display of monsters and objects suppressed.\n");
-       press_enter();
-       show_terrain = 0;
+        print_msg("Display of monsters and objects suppressed.\n");
+        press_enter();
+        show_terrain = 0;
         touch_back_buffer();
-       display_update();
-       return 0;
+        display_update();
+        return 0;
     case RNG_TEST:
-       {
-           int odds = 0;
-           int evens = 0;
-           for (i = 0; i < 100000; i++)
-           {
-               if (zero_die(2))
-               {
-                   odds++;
-               }
-               else
-               {
-                   evens++;
-               }
-           }
-           print_msg("100k rolls: 0 %d, 1 %d\n", odds, evens);
-       }
-       print_msg("1d2-1: %d %d %d %d %d %d %d %d\n", zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2));
-       print_msg("1d8-1: %d %d %d %d %d %d %d %d\n", zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8));
-       print_msg("1d32-1: %d %d %d %d %d %d %d %d\n", zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32));
-       return 0;
+        {
+            int odds = 0;
+            int evens = 0;
+            for (i = 0; i < 100000; i++)
+            {
+                if (zero_die(2))
+                {
+                    odds++;
+                }
+                else
+                {
+                    evens++;
+                }
+            }
+            print_msg("100k rolls: 0 %d, 1 %d\n", odds, evens);
+        }
+        print_msg("1d2-1: %d %d %d %d %d %d %d %d\n", zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2), zero_die(2));
+        print_msg("1d8-1: %d %d %d %d %d %d %d %d\n", zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8), zero_die(8));
+        print_msg("1d32-1: %d %d %d %d %d %d %d %d\n", zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32), zero_die(32));
+        return 0;
     case DROP_ITEM:
-       if (mapobject[u.y][u.x] != -1)
-       {
-           print_msg("There is already an item here.\n");
-           return 0;
-       }
-       i = inv_select(POCLASS_NONE, "drop", 0);
-       if (i >= 0)
-       {
-           if ((u.inventory[i] != -1) &&
-               ((u.inventory[i] == u.ring) ||
-                (u.inventory[i] == u.armour)))
-           {
-               print_msg("You cannot drop something you are wearing.\n");
-               return 0;
-           }
-           j = drop_obj(i);
-           if (j == -1)
-           {
-               return 0;
-           }
-           return 1;
-       }
-       return 0;
+        if (mapobject[u.y][u.x] != -1)
+        {
+            print_msg("There is already an item here.\n");
+            return 0;
+        }
+        i = inv_select(POCLASS_NONE, "drop", 0);
+        if (i >= 0)
+        {
+            if ((u.inventory[i] != -1) &&
+                ((u.inventory[i] == u.ring) ||
+                 (u.inventory[i] == u.armour)))
+            {
+                print_msg("You cannot drop something you are wearing.\n");
+                return 0;
+            }
+            j = drop_obj(i);
+            if (j == -1)
+            {
+                return 0;
+            }
+            return 1;
+        }
+        return 0;
     case DUMP_CHARA:
-       write_char_dump();
-       return 0;
+        write_char_dump();
+        return 0;
     case SAVE_GAME:
-       game_finished = 1;
-       save_game();
-       return 0;
+        game_finished = 1;
+        save_game();
+        return 0;
     case QUIT:
-       j = getYN("Really quit?\n");
-       if (j > 0)
-       {
-           game_finished = 1;
-       }
-       else
-       {
-           print_msg("Never mind.\n");
-       }
-       return 0;
+        j = getYN("Really quit?\n");
+        if (j > 0)
+        {
+            game_finished = 1;
+        }
+        else
+        {
+            print_msg("Never mind.\n");
+        }
+        return 0;
 
     case WIZARD_DESCEND:
-       if (wizard_mode)
-       {
-           leave_level();
-           make_new_level();
-       }
-       else
-       {
-           print_msg("You aren't a wizard.\n");
-       }
-       return 0;
+        if (wizard_mode)
+        {
+            leave_level();
+            make_new_level();
+        }
+        else
+        {
+            print_msg("You aren't a wizard.\n");
+        }
+        return 0;
 
     case WIZARD_LEVELUP:
-       if (wizard_mode)
-       {
-           gain_experience((lev_threshold(u.level) - u.experience) + 1);
-       }
-       else
-       {
-           print_msg("You aren't a wizard.\n");
-       }
-       return 0;
+        if (wizard_mode)
+        {
+            gain_experience((lev_threshold(u.level) - u.experience) + 1);
+        }
+        else
+        {
+            print_msg("You aren't a wizard.\n");
+        }
+        return 0;
     }
     return 0;
 }
@@ -550,63 +552,63 @@ void main_loop(void)
     print_msg("Press '?' for help.\n");
     while (!game_finished)
     {
-       switch (game_tick % 4)
-       {
-       case 0:
-       case 2:
-           action_speed = 0;
-           break;
-       case 1:
-           action_speed = 1;
-           break;
-       case 3:
-           action_speed = 2;
-           break;
-       }
-       /* Player is always speed 1, for now. */
-       if (action_speed <= u.speed)
-       {
-           i = 0;
-           while (!i)
-           {
-               /* Take commands until the player does
-                * something that uses an action. */
-               cmd = get_command();
-               i = do_command(cmd);
-               if (game_finished)
-               {
-                   break;
-               }
-           }
-           if (game_finished)
-           {
-               break;
-           }
-       }
-       for (i = 0; i < 100; i++)
-       {
-           if (!monsters[i].used)
-           {
-               /* Unused monster */
-               continue;
-           }
-           /* Update the monster's status. */
-           update_mon(i);
-           if (action_speed <= permons[monsters[i].mon_id].speed)
-           {
-               mon_acts(i);
-           }
-           if (game_finished)
-           {
-               break;
-           }
-       }
-       if (game_finished)
-       {
-           break;
-       }
-       update_player();
-       game_tick++;
+        switch (game_tick % 4)
+        {
+        case 0:
+        case 2:
+            action_speed = 0;
+            break;
+        case 1:
+            action_speed = 1;
+            break;
+        case 3:
+            action_speed = 2;
+            break;
+        }
+        /* Player is always speed 1, for now. */
+        if (action_speed <= u.speed)
+        {
+            i = 0;
+            while (!i)
+            {
+                /* Take commands until the player does
+                 * something that uses an action. */
+                cmd = get_command();
+                i = do_command(cmd);
+                if (game_finished)
+                {
+                    break;
+                }
+            }
+            if (game_finished)
+            {
+                break;
+            }
+        }
+        for (i = 0; i < 100; i++)
+        {
+            if (!monsters[i].used)
+            {
+                /* Unused monster */
+                continue;
+            }
+            /* Update the monster's status. */
+            update_mon(i);
+            if (action_speed <= permons[monsters[i].mon_id].speed)
+            {
+                mon_acts(i);
+            }
+            if (game_finished)
+            {
+                break;
+            }
+        }
+        if (game_finished)
+        {
+            break;
+        }
+        update_player();
+        game_tick++;
     }
 }
 
@@ -621,14 +623,14 @@ int main(void)
     i = stat("victrix-abyssi.sav.gz", &s);
     if (!i)
     {
-       /* Yes! */
-       print_msg("Loading...\n");
-       load_game();
+        /* Yes! */
+        print_msg("Loading...\n");
+        load_game();
     }
     else
     {
-       /* No! */
-       new_game();
+        /* No! */
+        new_game();
     }
     main_loop();
     display_shutdown();
diff --git a/map.c b/map.c
index 6678267..9743b3f 100644 (file)
--- a/map.c
+++ b/map.c
@@ -72,7 +72,7 @@ void make_new_level(void)
     build_level();
     populate_level();
     inject_player();
-    touch_back_buffer();
+    explore_around(u.y, u.x);
     display_update();
 }
 
@@ -139,10 +139,11 @@ static void run_random_walk(int oy, int ox, rwalk_mod_funcptr func,
 
 void build_level(void)
 {
-    int theme_roll = zero_die(depth + 50);
+    int theme_roll;
     /* Snapshot the running RNG state, so that we can rebuild the map from
      * the saved RNG state at game reload. */
     memcpy(saved_state, rng_state, sizeof saved_state);
+    theme_roll = zero_die(depth + 50);
     if (zero_die(2))
     {
         current_layout = LAYOUT_CAVE_INTRUSIONS;
@@ -151,7 +152,7 @@ void build_level(void)
     {
         current_layout = LAYOUT_CLASSIC_CAVE;
     }
-    else if (!zero_die(10) && (depth >= 15))
+    else if (!zero_die(3) && (depth >= 15))
     {
         current_layout = LAYOUT_CAVE_SHRINE;
     }
@@ -320,7 +321,7 @@ static void build_level_shrine(void)
                 terrain[y][x] = FLOOR;
                 break;
             case '#':
-                terrain[y][x] = WALL;
+                terrain[y][x] = HARDWALL;
                 break;
             case '+':
                 terrain[y][x] = DOOR;
diff --git a/misc.c b/misc.c
index b77ec25..f20e66c 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -1,6 +1,8 @@
-/* misc.c
- * 
- * Copyright 2005-2012 Martin Read
+/* \file misc.c
+ * \brief Stuff.
+ */
+
+/* Copyright 2005-2013 Martin Read
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include "victrix-abyssi.h"
 
 const char *damtype_names[DT_COUNT] = {
-       [DT_PHYS] = "physical damage",
-       [DT_FIRE] = "fire",
-       [DT_COLD] = "cold",
-       [DT_ELEC] = "electricity",
-       [DT_NECRO] = "necromantic force",
-       [DT_POISON] = "poison",
+    [DT_PHYS] = "physical damage",
+    [DT_FIRE] = "fire",
+    [DT_COLD] = "cold",
+    [DT_ELEC] = "electricity",
+    [DT_NECRO] = "necromantic force",
+    [DT_POISON] = "poison",
 };
 
 /* main.c */
diff --git a/mon2.c b/mon2.c
index 5c0ee92..33b7705 100644 (file)
--- a/mon2.c
+++ b/mon2.c
@@ -1,6 +1,8 @@
-/* mon2.c
- * 
- * Copyright 2005-2012 Martin Read
+/* \file mon2.c
+ * \brief More monster functions
+ */
+
+/* Copyright 2005-2013 Martin Read
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -68,32 +70,32 @@ static void get_drunk_prefs(int y, int x, int dy, int dx, int *pref_y, int *pref
     pref_x[2] = x;
     for (pref_idx = 0; pref_idx < 3; pref_idx++)
     {
-       for (tryct = 0; tryct < 40; tryct++)
-       {
-           retry = 0;
-           sy = zero_die(3) - 1;
-           sx = zero_die(3) - 1;
-           if (!sy && !sx)
-           {
-               continue;
-           }
-           for (idx2 = 0; idx2 < pref_idx; idx2++)
-           {
-               if ((pref_y[idx2] == y + sy) &&
-                   (pref_x[idx2] == x + sx))
-               {
-                   retry = 1;
-                   break;
-               }
-           }
-           if (retry) 
-           {
-               continue;
-           }
-           pref_y[pref_idx] = y + sy;
-           pref_x[pref_idx] = x + sx;
-           break;
-       }
+        for (tryct = 0; tryct < 40; tryct++)
+        {
+            retry = 0;
+            sy = zero_die(3) - 1;
+            sx = zero_die(3) - 1;
+            if (!sy && !sx)
+            {
+                continue;
+            }
+            for (idx2 = 0; idx2 < pref_idx; idx2++)
+            {
+                if ((pref_y[idx2] == y + sy) &&
+                    (pref_x[idx2] == x + sx))
+                {
+                    retry = 1;
+                    break;
+                }
+            }
+            if (retry) 
+            {
+                continue;
+            }
+            pref_y[pref_idx] = y + sy;
+            pref_x[pref_idx] = x + sx;
+            break;
+        }
     }
 }
 
@@ -122,126 +124,126 @@ static void get_chase_prefs(int mon, int *pref_y, int *pref_x)
     dx = monsters[mon].ai_lastx - x;
     if (dy == 0)
     {
-       sy = 0;
-       ady = 0;
+        sy = 0;
+        ady = 0;
     }
     else
     {
-       sy = dy < 0 ? -1 : 1;
-       ady = dy < 0 ? -dy : dy;
+        sy = dy < 0 ? -1 : 1;
+        ady = dy < 0 ? -dy : dy;
     }
     if (dx == 0)
     {
-       sx = 0;
-       adx = 0;
+        sx = 0;
+        adx = 0;
     }
     else
     {
-       sx = dx < 0 ? -1 : 1;
-       adx = dx < 0 ? -dx : dx;
+        sx = dx < 0 ? -1 : 1;
+        adx = dx < 0 ? -dx : dx;
     }
     if (mon_can_pass(mon, y + sy, x + sx))
     {
-       *pref_y = y + sy;
-       *pref_x = x + sx;
+        *pref_y = y + sy;
+        *pref_x = x + sx;
     }
     else if (!sy)
     {
-       /* We're on the horizontal; check the horizontally adjacent
-        * square, then the squares one square north or south in a
-        * random order. */
-       if (zero_die(2))
-       {
-           pref_y[1] = y - 1;
-           pref_y[2] = y + 1;
-       }
-       else
-       {
-           pref_y[1] = y + 1;
-           pref_y[2] = y - 1;
-       }
-       pref_x[1] = x + sx;
-       pref_x[2] = x + sx;
-       if (mon_can_pass(mon, pref_y[1], pref_x[1]))
-       {
-           pref_y[0] = pref_y[1];
-           pref_x[0] = pref_x[1];
-       }
-       else if (mon_can_pass(mon, pref_y[2], pref_x[2]))
-       {
-           pref_y[0] = pref_y[2];
-           pref_x[0] = pref_x[2];
-       }
-       else
-       {
-           pref_y[0] = monsters[mon].y;
-           pref_x[0] = monsters[mon].x;
-       }
+        /* We're on the horizontal; check the horizontally adjacent
+         * square, then the squares one square north or south in a
+         * random order. */
+        if (zero_die(2))
+        {
+            pref_y[1] = y - 1;
+            pref_y[2] = y + 1;
+        }
+        else
+        {
+            pref_y[1] = y + 1;
+            pref_y[2] = y - 1;
+        }
+        pref_x[1] = x + sx;
+        pref_x[2] = x + sx;
+        if (mon_can_pass(mon, pref_y[1], pref_x[1]))
+        {
+            pref_y[0] = pref_y[1];
+            pref_x[0] = pref_x[1];
+        }
+        else if (mon_can_pass(mon, pref_y[2], pref_x[2]))
+        {
+            pref_y[0] = pref_y[2];
+            pref_x[0] = pref_x[2];
+        }
+        else
+        {
+            pref_y[0] = monsters[mon].y;
+            pref_x[0] = monsters[mon].x;
+        }
     }
     else if (!sx)
     {
-       /* We're on the horizontal; check the horizontally adjacent
-        * square, then the squares one square north or south in a
-        * random order. */
-       if (zero_die(2))
-       {
-           pref_x[1] = x - 1;
-           pref_x[2] = x + 1;
-       }
-       else
-       {
-           pref_x[1] = x + 1;
-           pref_x[2] = x - 1;
-       }
-       pref_y[1] = y + sy;
-       pref_y[2] = y + sy;
-       if (mon_can_pass(mon, pref_y[1], pref_x[1]))
-       {
-           pref_y[0] = pref_y[1];
-           pref_x[0] = pref_x[1];
-       }
-       else if (mon_can_pass(mon, pref_y[2], pref_x[2]))
-       {
-           pref_y[0] = pref_y[2];
-           pref_x[0] = pref_x[2];
-       }
-       else
-       {
-           pref_y[0] = monsters[mon].y;
-           pref_x[0] = monsters[mon].x;
-       }
+        /* We're on the horizontal; check the horizontally adjacent
+         * square, then the squares one square north or south in a
+         * random order. */
+        if (zero_die(2))
+        {
+            pref_x[1] = x - 1;
+            pref_x[2] = x + 1;
+        }
+        else
+        {
+            pref_x[1] = x + 1;
+            pref_x[2] = x - 1;
+        }
+        pref_y[1] = y + sy;
+        pref_y[2] = y + sy;
+        if (mon_can_pass(mon, pref_y[1], pref_x[1]))
+        {
+            pref_y[0] = pref_y[1];
+            pref_x[0] = pref_x[1];
+        }
+        else if (mon_can_pass(mon, pref_y[2], pref_x[2]))
+        {
+            pref_y[0] = pref_y[2];
+            pref_x[0] = pref_x[2];
+        }
+        else
+        {
+            pref_y[0] = monsters[mon].y;
+            pref_x[0] = monsters[mon].x;
+        }
     }
     else
     {
-       if (zero_die(2))
-       {
-           pref_x[1] = x;
-           pref_y[1] = y + sy;
-           pref_x[2] = x + sx;
-           pref_y[2] = y;
-       }
-       else
-       {
-           pref_x[2] = x;
-           pref_y[2] = y + sy;
-           pref_x[1] = x + sx;
-           pref_y[1] = y;
-       }
-       if (mon_can_pass(mon, pref_y[1], pref_x[1]))
-       {
-           pref_y[0] = pref_y[1];
-           pref_x[0] = pref_x[1];
-       }
-       else if (mon_can_pass(mon, pref_y[2], pref_x[2]))
-       {
-           pref_y[0] = pref_y[2];
-           pref_x[0] = pref_x[2];
-       }
-       else
-       {
-           pref_y[0] = monsters[mon].y;
-           pref_x[0] = monsters[mon].x;
-       }
+        if (zero_die(2))
+        {
+            pref_x[1] = x;
+            pref_y[1] = y + sy;
+            pref_x[2] = x + sx;
+            pref_y[2] = y;
+        }
+        else
+        {
+            pref_x[2] = x;
+            pref_y[2] = y + sy;
+            pref_x[1] = x + sx;
+            pref_y[1] = y;
+        }
+        if (mon_can_pass(mon, pref_y[1], pref_x[1]))
+        {
+            pref_y[0] = pref_y[1];
+            pref_x[0] = pref_x[1];
+        }
+        else if (mon_can_pass(mon, pref_y[2], pref_x[2]))
+        {
+            pref_y[0] = pref_y[2];
+            pref_x[0] = pref_x[2];
+        }
+        else
+        {
+            pref_y[0] = monsters[mon].y;
+            pref_x[0] = monsters[mon].x;
+        }
     }
 }
 
@@ -266,15 +268,15 @@ static void get_seeking_prefs(int y, int x, int dy, int dx, int *pref_y, int *pr
     build_ai_cells(ai_cells, y, x);
     for (i = 0; i < 8; i++)
     {
-       ai_cells[i].dy = u.y - ai_cells[i].y;
-       ai_cells[i].dx = u.x - ai_cells[i].x;
-       /* Scoring factors:
-        *   Square closer to player: +1
-        *   Square further from player: -1
-        */
-       if (!mon_can_pass(mapmonster[y][x], ai_cells[i].y, ai_cells[i].x))
-       {
-           /* Square impassable to this monster. Set score WAY
+        ai_cells[i].dy = u.y - ai_cells[i].y;
+        ai_cells[i].dx = u.x - ai_cells[i].x;
+        /* Scoring factors:
+         *   Square closer to player: +1
+         *   Square further from player: -1
+         */
+        if (!mon_can_pass(mapmonster[y][x], ai_cells[i].y, ai_cells[i].x))
+        {
+            /* Square impassable to this monster. Set score WAY
              * out of bounds and continue. */
             ai_cells[i].score = -10000;
             continue;
@@ -299,18 +301,18 @@ static void get_seeking_prefs(int y, int x, int dy, int dx, int *pref_y, int *pr
     }
     if (highest_score == -10000)
     {
-       /* No good targets. */
-       return;
+        /* No good targets. */
+        return;
     }
     for (tryct = 0; tryct < 32; tryct++)
     {
-       i = zero_die(8);
-       if (ai_cells[i].score == highest_score)
-       {
-           *pref_y = ai_cells[i].y;
-           *pref_x = ai_cells[i].x;
-           break;
-       }
+        i = zero_die(8);
+        if (ai_cells[i].score == highest_score)
+        {
+            *pref_y = ai_cells[i].y;
+            *pref_x = ai_cells[i].x;
+            break;
+        }
     }
     return;
 }
@@ -328,79 +330,79 @@ static void get_naive_prefs(int y, int x, int dy, int dx, int *pref_y, int *pref
     int ady, adx;
     if (dy == 0)
     {
-       sy = 0;
-       ady = 0;
+        sy = 0;
+        ady = 0;
     }
     else
     {
-       sy = dy < 0 ? -1 : 1;
-       ady = dy < 0 ? -dy : dy;
+        sy = dy < 0 ? -1 : 1;
+        ady = dy < 0 ? -dy : dy;
     }
     if (dx == 0)
     {
-       sx = 0;
-       adx = dx < 0 ? -dx : dx;
+        sx = 0;
+        adx = dx < 0 ? -dx : dx;
     }
     else
     {
-       sx = dx < 0 ? -1 : 1;
-       adx = dx < 0 ? -dx : dx;
+        sx = dx < 0 ? -1 : 1;
+        adx = dx < 0 ? -dx : dx;
     }
     if (!sy)
     {
-       /* We're on the horizontal; check the horizontally adjacent
-        * square, then the squares one square north or south in a
-        * random order. */
-       pref_y[0] = y;
-       if (zero_die(2))
-       {
-           pref_y[1] = y - 1;
-           pref_y[2] = y + 1;
-       }
-       else
-       {
-           pref_y[1] = y + 1;
-           pref_y[2] = y - 1;
-       }
-       pref_x[0] = x + sx;
-       pref_x[1] = x + sx;
-       pref_x[2] = x + sx;
+        /* We're on the horizontal; check the horizontally adjacent
+         * square, then the squares one square north or south in a
+         * random order. */
+        pref_y[0] = y;
+        if (zero_die(2))
+        {
+            pref_y[1] = y - 1;
+            pref_y[2] = y + 1;
+        }
+        else
+        {
+            pref_y[1] = y + 1;
+            pref_y[2] = y - 1;
+        }
+        pref_x[0] = x + sx;
+        pref_x[1] = x + sx;
+        pref_x[2] = x + sx;
     }
     else if (!sx)
     {
-       pref_x[0] = x;
-       if (zero_die(2))
-       {
-           pref_x[1] = x - 1;
-           pref_x[2] = x + 1;
-       }
-       else
-       {
-           pref_x[1] = x + 1;
-           pref_x[2] = x - 1;
-       }
-       pref_y[0] = y + sy;
-       pref_y[1] = y + sy;
-       pref_y[2] = y + sy;
+        pref_x[0] = x;
+        if (zero_die(2))
+        {
+            pref_x[1] = x - 1;
+            pref_x[2] = x + 1;
+        }
+        else
+        {
+            pref_x[1] = x + 1;
+            pref_x[2] = x - 1;
+        }
+        pref_y[0] = y + sy;
+        pref_y[1] = y + sy;
+        pref_y[2] = y + sy;
     }
     else
     {
-       pref_x[0] = x + sx;
-       pref_y[0] = y + sy;
-       if (zero_die(2))
-       {
-           pref_x[1] = x;
-           pref_y[1] = y + sy;
-           pref_x[2] = x + sx;
-           pref_y[2] = y;
-       }
-       else
-       {
-           pref_x[2] = x;
-           pref_y[2] = y + sy;
-           pref_x[1] = x + sx;
-           pref_y[1] = y;
-       }
+        pref_x[0] = x + sx;
+        pref_y[0] = y + sy;
+        if (zero_die(2))
+        {
+            pref_x[1] = x;
+            pref_y[1] = y + sy;
+            pref_x[2] = x + sx;
+            pref_y[2] = y;
+        }
+        else
+        {
+            pref_x[2] = x;
+            pref_y[2] = y + sy;
+            pref_x[1] = x + sx;
+            pref_y[1] = y;
+        }
     }
 }
 
@@ -448,11 +450,11 @@ static int ai_cell_compare(struct ai_cell *cell, int dy, int dx)
     int cellrange = convert_range(cell->dy, cell->dx);
     if (cellrange < pointrange)
     {
-       return -1;
+        return -1;
     }
     else if (cellrange > pointrange)
     {
-       return 1;
+        return 1;
     }
     return 0;
 }
@@ -485,67 +487,67 @@ static void get_dodger_prefs(int y, int x, int dy, int dx, int *pref_y, int *pre
     /* Build the local dx/dy arrays. */
     for (i = 0; i < 8; i++)
     {
-       ai_cells[i].dy = u.y - ai_cells[i].y;
-       ai_cells[i].dx = u.x - ai_cells[i].x;
-       /* Scoring factors:
-        * Square on cardinal: -2.
-        * Square closer to player: +1.
-        * Square further from player: -3.
-        * Square next to player: +10.
-        *
-        * Yes, this monster prizes not opening the range more than
-        * it prizes staying off the cardinal; this is intentional.
-        * It also prizes staying off the cardinal more than actually
-        * closing. When I add more AI state to the monster structure,
-        * this will change.
-        */
-       if (!mon_can_pass(mapmonster[y][x], ai_cells[i].y, ai_cells[i].x))
-       {
-           /* Square impassable. Set score WAY out of bounds
-            * and continue. */
-           ai_cells[i].score = -10000;
-           continue;
-       }
-       /* Cardinality */
-       if ((ai_cells[i].dy == ai_cells[i].dx) || (ai_cells[i].dy == -ai_cells[i].dx) || (ai_cells[i].dy == 0) || (ai_cells[i].dx == 0))
-       {
-           /* Score this square down for being on a cardinal. */
-           ai_cells[i].score -= 2;
-       }
-       j = ai_cell_compare(ai_cells + i, dy, dx);
-       /* Range */
-       if ((ai_cells[i].dy < 2) && (ai_cells[i].dy > -2) && (ai_cells[i].dx < 2) && (ai_cells[i].dx > -2))
-       {
-           /* Score upward a *lot* for being adjacent to player */
-           ai_cells[i].score += 10;
-       }
-       else if (j > 0)
-       {
-           ai_cells[i].score -= 3;
-       }
-       else if (j < 0)
-       {
-           ai_cells[i].score += 1;
-       }
-       if (ai_cells[i].score > highest_score)
-       {
-           highest_score = ai_cells[i].score;
-       }
+        ai_cells[i].dy = u.y - ai_cells[i].y;
+        ai_cells[i].dx = u.x - ai_cells[i].x;
+        /* Scoring factors:
+         * Square on cardinal: -2.
+         * Square closer to player: +1.
+         * Square further from player: -3.
+         * Square next to player: +10.
+         *
+         * Yes, this monster prizes not opening the range more than
+         * it prizes staying off the cardinal; this is intentional.
+         * It also prizes staying off the cardinal more than actually
+         * closing. When I add more AI state to the monster structure,
+         * this will change.
+         */
+        if (!mon_can_pass(mapmonster[y][x], ai_cells[i].y, ai_cells[i].x))
+        {
+            /* Square impassable. Set score WAY out of bounds
+             * and continue. */
+            ai_cells[i].score = -10000;
+            continue;
+        }
+        /* Cardinality */
+        if ((ai_cells[i].dy == ai_cells[i].dx) || (ai_cells[i].dy == -ai_cells[i].dx) || (ai_cells[i].dy == 0) || (ai_cells[i].dx == 0))
+        {
+            /* Score this square down for being on a cardinal. */
+            ai_cells[i].score -= 2;
+        }
+        j = ai_cell_compare(ai_cells + i, dy, dx);
+        /* Range */
+        if ((ai_cells[i].dy < 2) && (ai_cells[i].dy > -2) && (ai_cells[i].dx < 2) && (ai_cells[i].dx > -2))
+        {
+            /* Score upward a *lot* for being adjacent to player */
+            ai_cells[i].score += 10;
+        }
+        else if (j > 0)
+        {
+            ai_cells[i].score -= 3;
+        }
+        else if (j < 0)
+        {
+            ai_cells[i].score += 1;
+        }
+        if (ai_cells[i].score > highest_score)
+        {
+            highest_score = ai_cells[i].score;
+        }
     }
     if (highest_score == -10000)
     {
-       /* No good targets. */
-       return;
+        /* No good targets. */
+        return;
     }
     for (tryct = 0; tryct < 32; tryct++)
     {
-       i = zero_die(8);
-       if (ai_cells[i].score == highest_score)
-       {
-           *pref_y = ai_cells[i].y;
-           *pref_x = ai_cells[i].x;
-           break;
-       }
+        i = zero_die(8);
+        if (ai_cells[i].score == highest_score)
+        {
+            *pref_y = ai_cells[i].y;
+            *pref_x = ai_cells[i].x;
+            break;
+        }
     }
     return;
 }
@@ -559,161 +561,161 @@ void select_space(int *py, int *px, int dy, int dx, int selection_mode)
     int sy, sx;
     if (dy == 0)
     {
-       sy = 0;
-       ady = 0;
+        sy = 0;
+        ady = 0;
     }
     else
     {
-       sy = dy < 0 ? -1 : 1;
-       ady = dy < 0 ? -dy : dy;
+        sy = dy < 0 ? -1 : 1;
+        ady = dy < 0 ? -dy : dy;
     }
     if (dx == 0)
     {
-       sx = 0;
-       adx = dx < 0 ? -dx : dx;
+        sx = 0;
+        adx = dx < 0 ? -dx : dx;
     }
     else
     {
-       sx = dx < 0 ? -1 : 1;
-       adx = dx < 0 ? -dx : dx;
+        sx = dx < 0 ? -1 : 1;
+        adx = dx < 0 ? -dx : dx;
     }
     switch (selection_mode)
     {
     case 0:
-       /* Simple convergence */
-       get_naive_prefs(*py, *px, dy, dx, ai_y, ai_x);
-       if (mon_can_pass(mapmonster[*py][*px], ai_y[0], ai_x[0]))
-       {
-           y = ai_y[0];
-           x = ai_x[0];
-       }
-       else if (mon_can_pass(mapmonster[*py][*px], ai_y[1], ai_x[1]))
-       {
-           y = ai_y[1];
-           x = ai_x[1];
-       }
-       else if (mon_can_pass(mapmonster[*py][*px], ai_y[2], ai_x[2]))
-       {
-           y = ai_y[2];
-           x = ai_x[2];
-       }
-       else
-       {
-           y = *py;
-           x = *px;
-       }
-       break;
+        /* Simple convergence */
+        get_naive_prefs(*py, *px, dy, dx, ai_y, ai_x);
+        if (mon_can_pass(mapmonster[*py][*px], ai_y[0], ai_x[0]))
+        {
+            y = ai_y[0];
+            x = ai_x[0];
+        }
+        else if (mon_can_pass(mapmonster[*py][*px], ai_y[1], ai_x[1]))
+        {
+            y = ai_y[1];
+            x = ai_x[1];
+        }
+        else if (mon_can_pass(mapmonster[*py][*px], ai_y[2], ai_x[2]))
+        {
+            y = ai_y[2];
+            x = ai_x[2];
+        }
+        else
+        {
+            y = *py;
+            x = *px;
+        }
+        break;
     case 1:
-       /* Converge to cardinal */
-       if ((dy == dx) || (dy == -dx) || (!dy) || (!dx))
-       {
-           /* On cardinal. Stay there if we can. But close anyway. */
-           x = *px + sx;
-           y = *py + sy;
-           if (mon_can_pass(mapmonster[*py][*px], y, x))
-           {
-               break;
-           }
-           x = *px;
-           if (mon_can_pass(mapmonster[*py][*px], y, x))
-           {
-               break;
-           }
-           y = *py;
-           x = *px + sx;
-           if (mon_can_pass(mapmonster[*py][*px], y, x))
-           {
-               break;
-           }
-       }
-       else if ((ady == 1) || ((adx > 1) && (ady > adx)))
-       {
-           /* One step in ydir off a NSEW cardinal, or further
-            * off cardinal in y than in x */
-           y = *py + sy;
-           x = *px;
-           if (mon_can_pass(mapmonster[*py][*px], y, x))
-           {
-               break;
-           }
-           x = *px + sx;
-           if (mon_can_pass(mapmonster[*py][*px], y, x))
-           {
-               break;
-           }
-           y = *py;
-           if (mon_can_pass(mapmonster[*py][*px], y, x))
-           {
-               break;
-           }
-       }
-       else if ((adx == 1) || ((ady > 1) && (adx > ady)))
-       {
-           /* One step off a diagonal cardinal, with adx > ady */
-           x = *px + sx;
-           y = *py;
-           if (mon_can_pass(mapmonster[*py][*px], y, x))
-           {
-               break;
-           }
-           y = *py + sy;
-           if (mon_can_pass(mapmonster[*py][*px], y, x))
-           {
-               break;
-           }
-           x = *px;
-           if (mon_can_pass(mapmonster[*py][*px], y, x))
-           {
-               break;
-           }
-       }
-       y = *py;
-       x = *px;
-       break;
+        /* Converge to cardinal */
+        if ((dy == dx) || (dy == -dx) || (!dy) || (!dx))
+        {
+            /* On cardinal. Stay there if we can. But close anyway. */
+            x = *px + sx;
+            y = *py + sy;
+            if (mon_can_pass(mapmonster[*py][*px], y, x))
+            {
+                break;
+            }
+            x = *px;
+            if (mon_can_pass(mapmonster[*py][*px], y, x))
+            {
+                break;
+            }
+            y = *py;
+            x = *px + sx;
+            if (mon_can_pass(mapmonster[*py][*px], y, x))
+            {
+                break;
+            }
+        }
+        else if ((ady == 1) || ((adx > 1) && (ady > adx)))
+        {
+            /* One step in ydir off a NSEW cardinal, or further
+             * off cardinal in y than in x */
+            y = *py + sy;
+            x = *px;
+            if (mon_can_pass(mapmonster[*py][*px], y, x))
+            {
+                break;
+            }
+            x = *px + sx;
+            if (mon_can_pass(mapmonster[*py][*px], y, x))
+            {
+                break;
+            }
+            y = *py;
+            if (mon_can_pass(mapmonster[*py][*px], y, x))
+            {
+                break;
+            }
+        }
+        else if ((adx == 1) || ((ady > 1) && (adx > ady)))
+        {
+            /* One step off a diagonal cardinal, with adx > ady */
+            x = *px + sx;
+            y = *py;
+            if (mon_can_pass(mapmonster[*py][*px], y, x))
+            {
+                break;
+            }
+            y = *py + sy;
+            if (mon_can_pass(mapmonster[*py][*px], y, x))
+            {
+                break;
+            }
+            x = *px;
+            if (mon_can_pass(mapmonster[*py][*px], y, x))
+            {
+                break;
+            }
+        }
+        y = *py;
+        x = *px;
+        break;
     case 2:
-       get_dodger_prefs(*py, *px, dy, dx, ai_y, ai_x);
-       y = ai_y[0];
-       x = ai_x[0];
-       break;
+        get_dodger_prefs(*py, *px, dy, dx, ai_y, ai_x);
+        y = ai_y[0];
+        x = ai_x[0];
+        break;
     case 3:
-       /* "Drunk" monster i.e. monster moving while it doesn't know
-        * how to find you. */
-       get_drunk_prefs(*py, *px, dy, dx, ai_y, ai_x);
-       if (mon_can_pass(mapmonster[*py][*px], ai_y[0], ai_x[0]))
-       {
-           y = ai_y[0];
-           x = ai_x[0];
-       }
-       else if (mon_can_pass(mapmonster[*py][*px], ai_y[1], ai_x[1]))
-       {
-           y = ai_y[1];
-           x = ai_x[1];
-       }
-       else if (mon_can_pass(mapmonster[*py][*px], ai_y[2], ai_x[2]))
-       {
-           y = ai_y[2];
-           x = ai_x[2];
-       }
-       else
-       {
-           y = *py;
-           x = *px;
-       }
-       break;
+        /* "Drunk" monster i.e. monster moving while it doesn't know
+         * how to find you. */
+        get_drunk_prefs(*py, *px, dy, dx, ai_y, ai_x);
+        if (mon_can_pass(mapmonster[*py][*px], ai_y[0], ai_x[0]))
+        {
+            y = ai_y[0];
+            x = ai_x[0];
+        }
+        else if (mon_can_pass(mapmonster[*py][*px], ai_y[1], ai_x[1]))
+        {
+            y = ai_y[1];
+            x = ai_x[1];
+        }
+        else if (mon_can_pass(mapmonster[*py][*px], ai_y[2], ai_x[2]))
+        {
+            y = ai_y[2];
+            x = ai_x[2];
+        }
+        else
+        {
+            y = *py;
+            x = *px;
+        }
+        break;
     case 4:
-       /* "Seeking" monster i.e. monster moving while it can't see
-        * you, but thinks it knows where you are. This AI isn't
-        * great, but it'll do for now. */
-       get_seeking_prefs(*py, *px, dy, dx, ai_y, ai_x);
-       y = ai_y[0];
-       x = ai_x[0];
-       break;
+        /* "Seeking" monster i.e. monster moving while it can't see
+         * you, but thinks it knows where you are. This AI isn't
+         * great, but it'll do for now. */
+        get_seeking_prefs(*py, *px, dy, dx, ai_y, ai_x);
+        y = ai_y[0];
+        x = ai_x[0];
+        break;
     case 5:
-       /* "chase" AI i.e. pursue your last known position. */
-       get_chase_prefs(mapmonster[*py][*px], ai_y, ai_x);
-       y = ai_y[0];
-       x = ai_x[0];
-       break;
+        /* "chase" AI i.e. pursue your last known position. */
+        get_chase_prefs(mapmonster[*py][*px], ai_y, ai_x);
+        y = ai_y[0];
+        x = ai_x[0];
+        break;
     }
     *py = y;
     *px = x;
@@ -737,22 +739,22 @@ void mon_acts(int mon)
     dx = u.x - mptr->x;
     if ((dy == 0) && (dx == 0))
     {
-       print_msg("Program disordered: monster in player's square.\n");
-       print_msg("Discarding misplaced monster.\n");
-       mptr->used = 0;
-       mapmonster[y][x] = -1;
-       return;
+        print_msg("Program disordered: monster in player's square.\n");
+        print_msg("Discarding misplaced monster.\n");
+        mptr->used = 0;
+        mapmonster[y][x] = -1;
+        return;
     }
     if (mapmonster[y][x] != mon)
     {
-       print_msg("Program disordered: monster(s) misplaced.\n");
-       mptr->used = 0;
-       if (mapmonster[y][x] != -1)
-       {
-           monsters[mapmonster[y][x]].used = 0;
-           mapmonster[y][x] = -1;
-       }
-       return;
+        print_msg("Program disordered: monster(s) misplaced.\n");
+        mptr->used = 0;
+        if (mapmonster[y][x] != -1)
+        {
+            monsters[mapmonster[y][x]].used = 0;
+            mapmonster[y][x] = -1;
+        }
+        return;
     }
     if (mon_visible(mon))
     {
@@ -760,116 +762,116 @@ void mon_acts(int mon)
     }
     if (meleerange)
     {
-       /* Adjacent! Attack you.  Demons have a 1 in 10 chance of
-        * attempting to summon another demon instead of attacking
-        * you. */
-       if ((mptr->mon_id == PM_DEMON) && !zero_die(10))
-       {
-           summon_demon_near(y, x);
-           special_used = 1;
-       }
-       else if (pmon_is_magician(mptr->mon_id))
-       {
-           special_used = mon_use_sorcery(mon);
-       }
-       if (!special_used)
-       {
-           mhitu(mon, DT_PHYS);
-       }
+        /* Adjacent! Attack you.  Demons have a 1 in 10 chance of
+         * attempting to summon another demon instead of attacking
+         * you. */
+        if ((mptr->mon_id == PM_DEMON) && !zero_die(10))
+        {
+            summon_demon_near(y, x);
+            special_used = 1;
+        }
+        else if (pmon_is_magician(mptr->mon_id))
+        {
+            special_used = mon_use_sorcery(mon);
+        }
+        if (!special_used)
+        {
+            mhitu(mon, DT_PHYS);
+        }
     }
     else if (mon_visible(mon))
     {
-       /* In sight. */
-       if (pmon_is_magician(mptr->mon_id))
-       {
-           /* Two-thirds of the time, try to use sorcery. */
-           if (zero_die(6) < 4)
-           {
-               special_used = mon_use_sorcery(mon);
-           }
-           if (special_used)
-           {
-               return;
-           }
-           /* Didn't, or couldn't, use sorcery; converge
-            * as if an archer. */
-           select_space(&y, &x, dy, dx, 1);
-       }
-       else if (pmon_is_archer(mptr->mon_id))
-       {
-           if (oncardinal && (zero_die(6) < 3))
-           {
-               special_used = 1;
-               mshootu(mon);
-           }
-           if (special_used)
-           {
-               return;
-           }
-           select_space(&y, &x, dy, dx, 1);
-       }
-       else if (pmon_is_smart(mptr->mon_id))
-       {
-           select_space(&y, &x, dy, dx, 2);
-       }
-       else /* pmon_is_stupid() */
-       {
-           select_space(&y, &x, dy, dx, 0);
-       }
-       if ((y != mptr->y) || (x != mptr->x))
-       {
-           /* We decided to move; move! */
-           move_mon(mon, y, x);
-       }
+        /* In sight. */
+        if (pmon_is_magician(mptr->mon_id))
+        {
+            /* Two-thirds of the time, try to use sorcery. */
+            if (zero_die(6) < 4)
+            {
+                special_used = mon_use_sorcery(mon);
+            }
+            if (special_used)
+            {
+                return;
+            }
+            /* Didn't, or couldn't, use sorcery; converge
+             * as if an archer. */
+            select_space(&y, &x, dy, dx, 1);
+        }
+        else if (pmon_is_archer(mptr->mon_id))
+        {
+            if (oncardinal && (zero_die(6) < 3))
+            {
+                special_used = 1;
+                mshootu(mon);
+            }
+            if (special_used)
+            {
+                return;
+            }
+            select_space(&y, &x, dy, dx, 1);
+        }
+        else if (pmon_is_smart(mptr->mon_id))
+        {
+            select_space(&y, &x, dy, dx, 2);
+        }
+        else /* pmon_is_stupid() */
+        {
+            select_space(&y, &x, dy, dx, 0);
+        }
+        if ((y != mptr->y) || (x != mptr->x))
+        {
+            /* We decided to move; move! */
+            move_mon(mon, y, x);
+        }
     }
     else if (!mptr->awake)
     {
-       return;
+        return;
     }
     else
     {
-       /* Out of LOS, but awake. Stupid monsters move "drunkenly"; smart
-        * monsters (may) seek you out. */
-       if (pmon_is_magician(mptr->mon_id))
-       {
-           /* Magicians may have spells that are used when
-            * you are out of sight.  For example, some magicians
-            * may teleport themselves to your vicinity. */
-           special_used = mon_use_sorcery(mon);
-       }
-       if (special_used)
-       {
-           return;
-       }
-       if (pmon_is_smart(mptr->mon_id))
-       {
-           select_space(&y, &x, dy, dx, 4);
-       }
-       else if (pmon_is_stupid(mptr->mon_id) || (mptr->ai_lasty == -1))
-       {
-           select_space(&y, &x, dy, dx, 3);
-       }
-       else
-       {
-           select_space(&y, &x, dy, dx, 5);
-       }
-       if ((y != mptr->y) || (x != mptr->x))
-       {
-           /* We decided to move; move! */
-           move_mon(mon, y, x);
-       }
+        /* Out of LOS, but awake. Stupid monsters move "drunkenly"; smart
+         * monsters (may) seek you out. */
+        if (pmon_is_magician(mptr->mon_id))
+        {
+            /* Magicians may have spells that are used when
+             * you are out of sight.  For example, some magicians
+             * may teleport themselves to your vicinity. */
+            special_used = mon_use_sorcery(mon);
+        }
+        if (special_used)
+        {
+            return;
+        }
+        if (pmon_is_smart(mptr->mon_id))
+        {
+            select_space(&y, &x, dy, dx, 4);
+        }
+        else if (pmon_is_stupid(mptr->mon_id) || (mptr->ai_lasty == -1))
+        {
+            select_space(&y, &x, dy, dx, 3);
+        }
+        else
+        {
+            select_space(&y, &x, dy, dx, 5);
+        }
+        if ((y != mptr->y) || (x != mptr->x))
+        {
+            /* We decided to move; move! */
+            move_mon(mon, y, x);
+        }
     }
     /* Let's get the data again. */
     compute_directions(u.y, u.x, y, x, &dy, &dx, &sy, &sx, &meleerange, &oncardinal);
     if ((dy >= -10) && (dy <= 10) && (dx >= -10) && (dx >= 10))
     {
-       mptr->ai_lasty = u.y;
-       mptr->ai_lastx = u.x;
+        mptr->ai_lasty = u.y;
+        mptr->ai_lastx = u.x;
     }
     else if (mptr->ai_lasty != -1)
     {
-       mptr->ai_lasty = -1;
-       mptr->ai_lastx = -1;
+        mptr->ai_lasty = -1;
+        mptr->ai_lastx = -1;
     }
 }
 
index 45ea778..4d7b768 100644 (file)
--- a/objects.c
+++ b/objects.c
@@ -713,7 +713,7 @@ int evasion_penalty(int obj)
 
     case PO_ROBE_SHADOWS:
     case PO_RIBBONS:
-        return -15;    /* This is a bonus. */
+        return -15;     /* This is a bonus. */
 
     default:
         /* If you've somehow managed to wear a non-armour, you're abusing
@@ -769,7 +769,7 @@ int emanate_armour(void)
         print_msg("Your current attire has no activatable powers.\n");
         break;
     }
-        return 0;
+    return 0;
 }
 
 int zap_weapon(void)
index 7ed6f28..fcea150 100644 (file)
--- a/objects.h
+++ b/objects.h
@@ -83,13 +83,13 @@ struct permobj {
     const char plural[48];
     const char *description;
     enum poclass_num poclass;
-    int rarity;        /* Chance in 100 of being thrown away and regen'd. */
+    int rarity; /* Chance in 100 of being thrown away and regen'd. */
     int sym;
-    int power; /* AC for armour; damage for weapons; colour/title for
-                * scrolls and potions and rings and such. */
-    int used;  /* Set to 1 for valid entries. */
-    int depth; /* If greater than 1, this item cannot be given out
-                * by get_random_pobj() before the specified depth. */
+    int power;  /* AC for armour; damage for weapons; colour/title for
+                 * scrolls and potions and rings and such. */
+    int used;   /* Set to 1 for valid entries. */
+    int depth;  /* If greater than 1, this item cannot be given out
+                 * by get_random_pobj() before the specified depth. */
 };
 extern struct permobj permobjs[NUM_OF_PERMOBJS];
 
@@ -99,11 +99,11 @@ extern struct permobj permobjs[NUM_OF_PERMOBJS];
 struct obj {
     int obj_id;
     int quan;
-    int with_you;      /* Preserved when item DB is reaped on level change. */
+    int with_you;       /* Preserved when item DB is reaped on level change. */
     int y;
     int x;
-    int used;  /* Entry is occupied. */
-    int durability;    /* Weapons and armour degrade with use. */
+    int used;   /* Entry is occupied. */
+    int durability;     /* Weapons and armour degrade with use. */
 };
 extern struct obj objects[OBJECTS_IN_PLAY];
 
index fa54454..db81633 100644 (file)
--- a/sorcery.c
+++ b/sorcery.c
@@ -72,8 +72,8 @@ int mon_use_sorcery(int mon)
     int dy, dx;
     int sy, sx;
     enum monspell to_cast = MS_REJECT;
-    int rval = 1;      /* Default to success; failure paths will force this
-                        * to an appropriate value. */
+    int rval = 1;       /* Default to success; failure paths will force this
+                         * to an appropriate value. */
     int dieroll;
     int meleerange;
     int oncardinal;
@@ -84,390 +84,390 @@ int mon_use_sorcery(int mon)
     cansee = mon_visible(mon);
     if ((dy * sy) >= (dx * sx))
     {
-       range = dy * sy;
+        range = dy * sy;
     }
     else
     {
-       range = dx * sx;
+        range = dx * sx;
     }
     switch (monsters[mon].mon_id)
     {
     case PM_ARCHMAGE:
-       if (cansee)
-       {
-           /* We have LOS; choose a spell on that basis. */
-           if ((mptr->hpcur < (mptr->hpmax * 25 / 100)) && (zero_die(10) < 2))
-           {
-               to_cast = zero_die(3) ? MS_TELEPORT_ESCAPE : MS_TELEPORT_AND_SUMMON;
-           }
-           else if (meleerange && (zero_die(10) > 3))
-           {
-               to_cast = MS_STRIKE_STAFF;
-           }
-           else if (oncardinal)
-           {
-               to_cast = MS_LIGHTNING;
-           }
-       }
-       else if (!zero_die(40))
-       {
-           /* 
-            * We lack LOS, but pass the 1-in-40 chance; use
-            * sorcery to relocate us to the player's location.
-            */
-           to_cast = MS_TELEPORT_ASSAULT;
-       }
-       break;
+        if (cansee)
+        {
+            /* We have LOS; choose a spell on that basis. */
+            if ((mptr->hpcur < (mptr->hpmax * 25 / 100)) && (zero_die(10) < 2))
+            {
+                to_cast = zero_die(3) ? MS_TELEPORT_ESCAPE : MS_TELEPORT_AND_SUMMON;
+            }
+            else if (meleerange && (zero_die(10) > 3))
+            {
+                to_cast = MS_STRIKE_STAFF;
+            }
+            else if (oncardinal)
+            {
+                to_cast = MS_LIGHTNING;
+            }
+        }
+        else if (!zero_die(40))
+        {
+            /* 
+             * We lack LOS, but pass the 1-in-40 chance; use
+             * sorcery to relocate us to the player's location.
+             */
+            to_cast = MS_TELEPORT_ASSAULT;
+        }
+        break;
 
     case PM_WIZARD:
-       if (cansee)
-       {
-           if ((mptr->hpcur < (mptr->hpmax * 25 / 100)) && (zero_die(10) < 2))
-           {
-               to_cast = MS_TELEPORT_ESCAPE;
-           }
-           else if (meleerange && (zero_die(10) > 2))
-           {
-               to_cast = MS_STRIKE_STAFF;
-           }
-           else if (oncardinal)
-           {
-               to_cast = MS_LIGHTNING;
-           }
-       }
-       else if (!zero_die(80))
-       {
-           /* we lack LOS, but passed the 1-in-80 chance to
-            * close with the player by means of sorcery. */
-           to_cast = MS_TELEPORT_ASSAULT;
-       }
-       break;
+        if (cansee)
+        {
+            if ((mptr->hpcur < (mptr->hpmax * 25 / 100)) && (zero_die(10) < 2))
+            {
+                to_cast = MS_TELEPORT_ESCAPE;
+            }
+            else if (meleerange && (zero_die(10) > 2))
+            {
+                to_cast = MS_STRIKE_STAFF;
+            }
+            else if (oncardinal)
+            {
+                to_cast = MS_LIGHTNING;
+            }
+        }
+        else if (!zero_die(80))
+        {
+            /* we lack LOS, but passed the 1-in-80 chance to
+             * close with the player by means of sorcery. */
+            to_cast = MS_TELEPORT_ASSAULT;
+        }
+        break;
 
     case PM_MASTER_LICH:
-       if (cansee)
-       {
-           if ((mptr->hpcur < (mptr->hpmax * 25 / 100)) && (zero_die(10) < 4))
-           {
-               to_cast = ((mptr->next_summon < game_tick) || !zero_die(3)) ? MS_TELEPORT_ESCAPE : MS_TELEPORT_AND_SUMMON;
-           }
-           else if (meleerange)
-           {
-               switch (zero_die(7))
-               {
-               case 6:
-                   if (!u.withering)
-                   {
-                       to_cast = MS_CURSE_WITHERING;
-                       break;
-                   }
-               case 4:
-                   if (!u.leadfoot)
-                   {
-                       to_cast = MS_CURSE_LEADFOOT;
-                       break;
-                   }
-                   /* fall through */
-               case 5:
-                   if (!u.armourmelt)
-                   {
-                       to_cast = MS_CURSE_ARMOURMELT;
-                       break;
-                   }
-                   /* fall through */
-               default:
-                   to_cast = zero_die(2) ? MS_CHILLING_TOUCH : MS_STRIKE_STAFF;
-                   break;
-               }
-           }
-           else if (range < 3)
-           {
-               switch (zero_die(10))
-               {
-               case 9:
-                   if (!u.withering)
-                   {
-                       to_cast = MS_CURSE_WITHERING;
-                       break;
-                   }
-               case 8:
-                   if (!u.leadfoot)
-                   {
-                       to_cast = MS_CURSE_LEADFOOT;
-                       break;
-                   }
-                   /* fall through */
-               case 7:
-                   if (!u.armourmelt)
-                   {
-                       to_cast = MS_CURSE_ARMOURMELT;
-                       break;
-                   }
-                   /* fall through */
-               default:
-                   to_cast = MS_NECRO_SMITE;
-                   break;
-               }
-           }
-           else if (range < 8)
-           {
-               switch (zero_die(7))
-               {
-               case 6:
-                   if (!u.withering)
-                   {
-                       to_cast = MS_CURSE_WITHERING;
-                       break;
-                   }
-               case 4:
-                   if (!u.leadfoot)
-                   {
-                       to_cast = MS_CURSE_LEADFOOT;
-                       break;
-                   }
-                   /* fall through */
-               case 5:
-                   if (!u.armourmelt)
-                   {
-                       to_cast = MS_CURSE_ARMOURMELT;
-                       break;
-                   }
-                   /* fall through */
-               default:
-                   to_cast = MS_NECRO_SMITE;
-                   break;
-               }
-           }
-       }
-       else if (!zero_die(40))
-       {
-           /* we lack LOS, but passed the 1-in-40 chance to
-            * close with the player by means of sorcery. */
-           to_cast = MS_TELEPORT_ASSAULT;
-       }
-       break;
+        if (cansee)
+        {
+            if ((mptr->hpcur < (mptr->hpmax * 25 / 100)) && (zero_die(10) < 4))
+            {
+                to_cast = ((mptr->next_summon < game_tick) || !zero_die(3)) ? MS_TELEPORT_ESCAPE : MS_TELEPORT_AND_SUMMON;
+            }
+            else if (meleerange)
+            {
+                switch (zero_die(7))
+                {
+                case 6:
+                    if (!u.withering)
+                    {
+                        to_cast = MS_CURSE_WITHERING;
+                        break;
+                    }
+                case 4:
+                    if (!u.leadfoot)
+                    {
+                        to_cast = MS_CURSE_LEADFOOT;
+                        break;
+                    }
+                    /* fall through */
+                case 5:
+                    if (!u.armourmelt)
+                    {
+                        to_cast = MS_CURSE_ARMOURMELT;
+                        break;
+                    }
+                    /* fall through */
+                default:
+                    to_cast = zero_die(2) ? MS_CHILLING_TOUCH : MS_STRIKE_STAFF;
+                    break;
+                }
+            }
+            else if (range < 3)
+            {
+                switch (zero_die(10))
+                {
+                case 9:
+                    if (!u.withering)
+                    {
+                        to_cast = MS_CURSE_WITHERING;
+                        break;
+                    }
+                case 8:
+                    if (!u.leadfoot)
+                    {
+                        to_cast = MS_CURSE_LEADFOOT;
+                        break;
+                    }
+                    /* fall through */
+                case 7:
+                    if (!u.armourmelt)
+                    {
+                        to_cast = MS_CURSE_ARMOURMELT;
+                        break;
+                    }
+                    /* fall through */
+                default:
+                    to_cast = MS_NECRO_SMITE;
+                    break;
+                }
+            }
+            else if (range < 8)
+            {
+                switch (zero_die(7))
+                {
+                case 6:
+                    if (!u.withering)
+                    {
+                        to_cast = MS_CURSE_WITHERING;
+                        break;
+                    }
+                case 4:
+                    if (!u.leadfoot)
+                    {
+                        to_cast = MS_CURSE_LEADFOOT;
+                        break;
+                    }
+                    /* fall through */
+                case 5:
+                    if (!u.armourmelt)
+                    {
+                        to_cast = MS_CURSE_ARMOURMELT;
+                        break;
+                    }
+                    /* fall through */
+                default:
+                    to_cast = MS_NECRO_SMITE;
+                    break;
+                }
+            }
+        }
+        else if (!zero_die(40))
+        {
+            /* we lack LOS, but passed the 1-in-40 chance to
+             * close with the player by means of sorcery. */
+            to_cast = MS_TELEPORT_ASSAULT;
+        }
+        break;
     case PM_LICH:
-       if (cansee)
-       {
-           if (meleerange)
-           {
-               dieroll = zero_die(6);
-               switch (dieroll)
-               {
-               case 4:
-                   if (!u.leadfoot)
-                   {
-                       to_cast = MS_CURSE_LEADFOOT;
-                       break;
-                   }
-                   /* fall through */
-               case 5:
-                   if (!u.armourmelt)
-                   {
-                       to_cast = MS_CURSE_ARMOURMELT;
-                       break;
-                   }
-                   /* fall through */
-               default:
-                   to_cast = MS_NECRO_STAFF;
-                   break;
-               }
-           }
-           else if (oncardinal)
-           {
-               if (range < 3)
-               {
-                   switch (zero_die(6))
-                   {
-                   case 4:
-                       if (!u.leadfoot)
-                       {
-                           to_cast = MS_CURSE_LEADFOOT;
-                           break;
-                       }
-                       /* fall through */
-                   case 5:
-                       if (!u.armourmelt)
-                       {
-                           to_cast = MS_CURSE_ARMOURMELT;
-                           break;
-                       }
-                       /* fall through */
-                   default:
-                       to_cast = MS_NECRO_BOLT;
-                       break;
-                   }
-               }
-               else
-               {
-                   to_cast = MS_NECRO_BOLT;
-               }
-           }
-           break;
-       }
-       break;
+        if (cansee)
+        {
+            if (meleerange)
+            {
+                dieroll = zero_die(6);
+                switch (dieroll)
+                {
+                case 4:
+                    if (!u.leadfoot)
+                    {
+                        to_cast = MS_CURSE_LEADFOOT;
+                        break;
+                    }
+                    /* fall through */
+                case 5:
+                    if (!u.armourmelt)
+                    {
+                        to_cast = MS_CURSE_ARMOURMELT;
+                        break;
+                    }
+                    /* fall through */
+                default:
+                    to_cast = MS_NECRO_STAFF;
+                    break;
+                }
+            }
+            else if (oncardinal)
+            {
+                if (range < 3)
+                {
+                    switch (zero_die(6))
+                    {
+                    case 4:
+                        if (!u.leadfoot)
+                        {
+                            to_cast = MS_CURSE_LEADFOOT;
+                            break;
+                        }
+                        /* fall through */
+                    case 5:
+                        if (!u.armourmelt)
+                        {
+                            to_cast = MS_CURSE_ARMOURMELT;
+                            break;
+                        }
+                        /* fall through */
+                    default:
+                        to_cast = MS_NECRO_BOLT;
+                        break;
+                    }
+                }
+                else
+                {
+                    to_cast = MS_NECRO_BOLT;
+                }
+            }
+            break;
+        }
+        break;
     case PM_DEFILER:
-       if (cansee)
-       {
-           if (!meleerange)
-           {
-               switch (zero_die(7))
-               {
-               case 6:
-                   if (!u.withering)
-                   {
-                       to_cast = MS_CURSE_WITHERING;
-                       break;
-                   }
-               case 4:
-                   if (!u.leadfoot)
-                   {
-                       to_cast = MS_CURSE_LEADFOOT;
-                       break;
-                   }
-                   /* fall through */
-               case 5:
-                   if (!u.armourmelt)
-                   {
-                       to_cast = MS_CURSE_ARMOURMELT;
-                       break;
-                   }
-                   /* fall through */
-               default:
-                   to_cast = MS_FIRE_COLUMN;
-                   break;
-               }
-           }
-       }
-       break;
+        if (cansee)
+        {
+            if (!meleerange)
+            {
+                switch (zero_die(7))
+                {
+                case 6:
+                    if (!u.withering)
+                    {
+                        to_cast = MS_CURSE_WITHERING;
+                        break;
+                    }
+                case 4:
+                    if (!u.leadfoot)
+                    {
+                        to_cast = MS_CURSE_LEADFOOT;
+                        break;
+                    }
+                    /* fall through */
+                case 5:
+                    if (!u.armourmelt)
+                    {
+                        to_cast = MS_CURSE_ARMOURMELT;
+                        break;
+                    }
+                    /* fall through */
+                default:
+                    to_cast = MS_FIRE_COLUMN;
+                    break;
+                }
+            }
+        }
+        break;
 
     default:
-       break;
+        break;
     }
     switch (to_cast)
     {
     default:
-       /* If this happens, we're trying to cast an unimplemented
-        * spell. */
-       print_msg("Can't happen: Bogus spell %d!\n", to_cast);
-       rval = -1;
-       break;
+        /* If this happens, we're trying to cast an unimplemented
+         * spell. */
+        print_msg("Can't happen: Bogus spell %d!\n", to_cast);
+        rval = -1;
+        break;
 
     case MS_REJECT:
-       /* No usable spell available. */
-       rval = 0;
-       break;
+        /* No usable spell available. */
+        rval = 0;
+        break;
 
     case MS_STRIKE_STAFF:
-       mhitu(mon, DT_PHYS);
-       break;
+        mhitu(mon, DT_PHYS);
+        break;
 
     case MS_NECRO_STAFF:
-       mhitu(mon, DT_NECRO);
-       break;
+        mhitu(mon, DT_NECRO);
+        break;
 
     case MS_CHILLING_TOUCH:
-       mhitu(mon, DT_COLD);
-       break;
+        mhitu(mon, DT_COLD);
+        break;
 
     case MS_LIGHTNING:
     case MS_NECRO_BOLT:
-       mshootu(mon);
-       break;
+        mshootu(mon);
+        break;
 
     case MS_TELEPORT_AND_SUMMON:
         mptr->next_summon = game_tick + 1000;
-       /* Do the summoning... */
-       print_mon_name(mon, 3);
-       print_msg(" calls for help...\n");
-       /* (Try to) summon 2-6 monsters. */
-       i = summoning(mptr->y, mptr->x, dice(2, 3));
-       if (i == 0)
-       {
-           print_msg("... luckily for you, help wasn't listening.\n");
-       }
-       else
-       {
-           print_msg("... and gets it.\n");
-       }
-       /* ... and fall through. */
+        /* Do the summoning... */
+        print_mon_name(mon, 3);
+        print_msg(" calls for help...\n");
+        /* (Try to) summon 2-6 monsters. */
+        i = summoning(mptr->y, mptr->x, dice(2, 3));
+        if (i == 0)
+        {
+            print_msg("... luckily for you, help wasn't listening.\n");
+        }
+        else
+        {
+            print_msg("... and gets it.\n");
+        }
+        /* ... and fall through. */
     case MS_TELEPORT_ESCAPE:
-       print_mon_name(mon, 3);
-       print_msg(" vanishes in a puff of smoke.\n");
-       teleport_mon(mon);
-       break;
+        print_mon_name(mon, 3);
+        print_msg(" vanishes in a puff of smoke.\n");
+        teleport_mon(mon);
+        break;
 
     case MS_TELEPORT_ASSAULT:
-       /* It is rare that a monster will cast this spell, but not
-        * unheard of. */
-       teleport_mon_to_you(mon);
-       break;
+        /* It is rare that a monster will cast this spell, but not
+         * unheard of. */
+        teleport_mon_to_you(mon);
+        break;
 
     case MS_CURSE_ARMOURMELT:
-       mon_curses(mon);
-       if (u.protection)
-       {
-           malignant_aura();
-       }
-       else
-       {
-           u.armourmelt = 10 + one_die(10);
-           print_msg("Your armour seems suddenly no stronger than dust!\n");
-       }
-       break;
+        mon_curses(mon);
+        if (u.protection)
+        {
+            malignant_aura();
+        }
+        else
+        {
+            u.armourmelt = 10 + one_die(10);
+            print_msg("Your armour seems suddenly no stronger than dust!\n");
+        }
+        break;
 
     case MS_CURSE_LEADFOOT:
-       mon_curses(mon);
-       if (u.protection)
-       {
-           malignant_aura();
-       }
-       else
-       {
-           u.leadfoot = 10 + one_die(10);
-           print_msg("Your feet feel like lead!\n");
-       }
-       break;
+        mon_curses(mon);
+        if (u.protection)
+        {
+            malignant_aura();
+        }
+        else
+        {
+            u.leadfoot = 10 + one_die(10);
+            print_msg("Your feet feel like lead!\n");
+        }
+        break;
 
     case MS_CURSE_WITHERING:
-       mon_curses(mon);
-       if (u.protection)
-       {
-           malignant_aura();
-       }
-       else
-       {
-           u.withering = 10 + one_die(10);
-           print_msg("Your limbs twist and wither!\n");
-       }
-       break;
+        mon_curses(mon);
+        if (u.protection)
+        {
+            malignant_aura();
+        }
+        else
+        {
+            u.withering = 10 + one_die(10);
+            print_msg("Your limbs twist and wither!\n");
+        }
+        break;
 
     case MS_NECRO_SMITE:
-       mon_curses(mon);
-       if (player_resists_dtype(DT_NECRO))
-       {
-           print_msg("Darkness reaches towards you, but dissolves.\n");
-       }
-       else
-       {
-           print_msg("Soul-chilling darkness engulfs you!\n");
-           damage_u(dice(1, 20), DEATH_KILLED_MON, permons[monsters[mon].mon_id].name);
-       }
-       break;
+        mon_curses(mon);
+        if (player_resists_dtype(DT_NECRO))
+        {
+            print_msg("Darkness reaches towards you, but dissolves.\n");
+        }
+        else
+        {
+            print_msg("Soul-chilling darkness engulfs you!\n");
+            damage_u(dice(1, 20), DEATH_KILLED_MON, permons[monsters[mon].mon_id].name);
+        }
+        break;
 
     case MS_FIRE_COLUMN:
-       mon_curses(mon);
-       print_msg("The fires of hell ");
-       if (player_resists_dtype(DT_FIRE))
-       {
-           print_msg("lightly singe you.\n");
-           damage_u(dice(1, 5), DEATH_KILLED_MON, permons[monsters[mon].mon_id].name);
-       }
-       else
-       {
-           print_msg("burn you!\n");
-           damage_u(dice(1, 20), DEATH_KILLED_MON, permons[monsters[mon].mon_id].name);
-       }
-       break;
+        mon_curses(mon);
+        print_msg("The fires of hell ");
+        if (player_resists_dtype(DT_FIRE))
+        {
+            print_msg("lightly singe you.\n");
+            damage_u(dice(1, 5), DEATH_KILLED_MON, permons[monsters[mon].mon_id].name);
+        }
+        else
+        {
+            print_msg("burn you!\n");
+            damage_u(dice(1, 20), DEATH_KILLED_MON, permons[monsters[mon].mon_id].name);
+        }
+        break;
     }
     return rval;
 }
index de5cc12..a083c45 100644 (file)
--- a/sorcery.h
+++ b/sorcery.h
 /* XXX DATA TYPES XXX */
 
 enum monspell {
-       MS_REJECT = -1,         /* Rejection tag. */
-       /* "Melee" attacks */
-       MS_STRIKE_STAFF,        /* Wizard */
-       MS_NECRO_STAFF,         /* Lich */
-       MS_CHILLING_TOUCH,      /* Master Lich */
-       /* Ranged Attacks */
-       MS_LIGHTNING,   /* Wizard */
-       MS_NECRO_BOLT,  /* Lich */
-       MS_NECRO_SMITE, /* Master Lich - no cardinal alignment needed */
-       MS_FIRE_COLUMN, /* Defiler */
-       /* Curses */
-       MS_CURSE_ARMOURMELT,    /* All cursers */
-       MS_CURSE_LEADFOOT,      /* All cursers */
-       MS_CURSE_WITHERING,     /* Master Lich and Defiler only */
-       /* Evasion */
-       MS_TELEPORT_ESCAPE,     /* Wizard, Archmage, Master Lich */
-       MS_TELEPORT_AND_SUMMON, /* Archmage */
-       MS_TELEPORT_ASSAULT,    /* Wizard, Archmage, Master Lich */
+    MS_REJECT = -1,         /* Rejection tag. */
+    /* "Melee" attacks */
+    MS_STRIKE_STAFF,        /* Wizard */
+    MS_NECRO_STAFF,         /* Lich */
+    MS_CHILLING_TOUCH,      /* Master Lich */
+    /* Ranged Attacks */
+    MS_LIGHTNING,   /* Wizard */
+    MS_NECRO_BOLT,  /* Lich */
+    MS_NECRO_SMITE, /* Master Lich - no cardinal alignment needed */
+    MS_FIRE_COLUMN, /* Defiler */
+    /* Curses */
+    MS_CURSE_ARMOURMELT,    /* All cursers */
+    MS_CURSE_LEADFOOT,      /* All cursers */
+    MS_CURSE_WITHERING,     /* Master Lich and Defiler only */
+    /* Evasion */
+    MS_TELEPORT_ESCAPE,     /* Wizard, Archmage, Master Lich */
+    MS_TELEPORT_AND_SUMMON, /* Archmage */
+    MS_TELEPORT_ASSAULT,    /* Wizard, Archmage, Master Lich */
 };
 
 extern int mon_use_sorcery(int mon);
diff --git a/u.c b/u.c
index beb1500..496026c 100644 (file)
--- a/u.c
+++ b/u.c
@@ -39,44 +39,44 @@ void recalc_defence(void)
     int i;
     for (i = 0; i < DT_COUNT; i++)
     {
-       u.resistances[i] &= RESIST_MASK_TEMPORARY;
+        u.resistances[i] &= RESIST_MASK_TEMPORARY;
     }
     u.speed = (u.leadfoot ? 0 : 1);
     if (u.armour != -1)
     {
-       u.defence = u.armourmelt ? 0 : permobjs[objects[u.armour].obj_id].power;
-       u.defence += u.withering ? (u.agility / 10) : (u.agility / 5);
-       switch (objects[u.armour].obj_id)
-       {
-       case PO_DRAGON_ARMOUR:
-       case PO_METEOR_ARMOUR:
-           u.resistances[DT_FIRE] |= RESIST_ARMOUR;
-           break;
-       case PO_ROBE_SWIFTNESS:
-           u.speed++;
-           break;
-       default:
-           break;
-       }
+        u.defence = u.armourmelt ? 0 : permobjs[objects[u.armour].obj_id].power;
+        u.defence += u.withering ? (u.agility / 10) : (u.agility / 5);
+        switch (objects[u.armour].obj_id)
+        {
+        case PO_DRAGON_ARMOUR:
+        case PO_METEOR_ARMOUR:
+            u.resistances[DT_FIRE] |= RESIST_ARMOUR;
+            break;
+        case PO_ROBE_SWIFTNESS:
+            u.speed++;
+            break;
+        default:
+            break;
+        }
     }
     else
     {
-       u.defence = u.withering ? (u.agility / 10) : (u.agility / 5);
+        u.defence = u.withering ? (u.agility / 10) : (u.agility / 5);
     }
     if (u.ring != -1)
     {
-       switch (objects[u.ring].obj_id)
-       {
-       case PO_RING_FIRE:
-           u.resistances[DT_FIRE] |= RESIST_RING;
-           break;
-       case PO_RING_FROST:
-           u.resistances[DT_COLD] |= RESIST_RING;
-           break;
-       case PO_RING_VAMPIRE:
-           u.resistances[DT_NECRO] |= RESIST_RING;
-           break;
-       }
+        switch (objects[u.ring].obj_id)
+        {
+        case PO_RING_FIRE:
+            u.resistances[DT_FIRE] |= RESIST_RING;
+            break;
+        case PO_RING_FROST:
+            u.resistances[DT_COLD] |= RESIST_RING;
+            break;
+        case PO_RING_VAMPIRE:
+            u.resistances[DT_NECRO] |= RESIST_RING;
+            break;
+        }
     }
     status_updated = 1;
     display_update();
@@ -85,10 +85,10 @@ void recalc_defence(void)
 int move_player(int dy, int dx)
 {
     if ((u.y + dy < 0) || (u.y + dy >= DUN_HEIGHT) ||
-       (u.x + dx < 0) || (u.x + dx >= DUN_WIDTH))
+        (u.x + dx < 0) || (u.x + dx >= DUN_WIDTH))
     {
         print_msg("Attempted move out of bounds.\n");
-        return 0;      /* No movement. */
+        return 0;       /* No movement. */
     }
     if (mapmonster[u.y + dy][u.x + dx] != -1)
     {
@@ -157,7 +157,7 @@ int reloc_player(int y, int x)
     ox = u.x;
     u.y = y;
     u.x = x;
-    
+
     touch_one_screen(oy, ox);
     explore_around(u.y, u.x);
     map_updated = 1;
@@ -165,9 +165,9 @@ int reloc_player(int y, int x)
     display_update();
     if (mapobject[y][x] != -1)
     {
-       print_msg("You see here ");
-       print_obj_name(mapobject[y][x]);
-       print_msg(".\n");
+        print_msg("You see here ");
+        print_obj_name(mapobject[y][x]);
+        print_msg(".\n");
     }
     return 0;
 }
@@ -176,30 +176,30 @@ int gain_body(int amount, int loud)
 {
     if (amount < 1)
     {
-       print_msg("Absurd body gain %d\n", amount);
+        print_msg("Absurd body gain %d\n", amount);
     }
     if (u.body < 99)
     {
-       if (u.body + amount > 99)
-       {
-           amount = 99 - u.body;
-       }
-       u.body += amount;
-       status_updated = 1;
-       if (loud)
-       {
-           print_msg("You feel stronger!\n");
-       }
-       else
-       {
-           display_update();
-       }
-       return amount;
+        if (u.body + amount > 99)
+        {
+            amount = 99 - u.body;
+        }
+        u.body += amount;
+        status_updated = 1;
+        if (loud)
+        {
+            print_msg("You feel stronger!\n");
+        }
+        else
+        {
+            display_update();
+        }
+        return amount;
     }
     else
     {
-       print_msg("You feel disappointed.\n");
-       return 0;
+        print_msg("You feel disappointed.\n");
+        return 0;
     }
 }
 
@@ -208,17 +208,17 @@ int drain_body(int amount, const char *what, int permanent)
     print_msg("You feel weaker!\n");
     if (permanent)
     {
-       u.body -= amount;
+        u.body -= amount;
     }
     else
     {
-       u.bdam += amount;
+        u.bdam += amount;
     }
     status_updated = 1;
     if ((u.body - u.bdam) < 0)
     {
-       print_msg("Your heart is too weak to beat.\n");
-       return do_death(DEATH_BODY, what);
+        print_msg("Your heart is too weak to beat.\n");
+        return do_death(DEATH_BODY, what);
     }
     display_update();
     return 0;
@@ -228,31 +228,31 @@ int gain_agility(int amount, int loud)
 {
     if (amount < 1)
     {
-       print_msg("Absurd agility gain %d\n", amount);
+        print_msg("Absurd agility gain %d\n", amount);
     }
     if (u.agility < 99)
     {
-       if (u.agility + amount > 99)
-       {
-           amount = 99 - u.agility;
-       }
-       u.agility += amount;
-       status_updated = 1;
-       recalc_defence();
-       if (loud)
-       {
-           print_msg("You feel more agile!\n");
-       }
-       else
-       {
-           display_update();
-       }
-       return amount;
+        if (u.agility + amount > 99)
+        {
+            amount = 99 - u.agility;
+        }
+        u.agility += amount;
+        status_updated = 1;
+        recalc_defence();
+        if (loud)
+        {
+            print_msg("You feel more agile!\n");
+        }
+        else
+        {
+            display_update();
+        }
+        return amount;
     }
     else
     {
-       print_msg("You feel disappointed.\n");
-       return 0;
+        print_msg("You feel disappointed.\n");
+        return 0;
     }
 }
 
@@ -261,17 +261,17 @@ int drain_agility(int amount, const char *what, int permanent)
     print_msg("You feel clumsy!\n");
     if (permanent)
     {
-       u.agility -= amount;
+        u.agility -= amount;
     }
     else
     {
-       u.adam += amount;
+        u.adam += amount;
     }
     status_updated = 1;
     if ((u.agility - u.adam) < 0)
     {
-       print_msg("You forget how to breathe.\n");
-       return do_death(DEATH_AGILITY, what);
+        print_msg("You forget how to breathe.\n");
+        return do_death(DEATH_AGILITY, what);
     }
     recalc_defence();
     return 0;
@@ -283,8 +283,8 @@ int damage_u(int amount, enum death d, const char *what)
     status_updated = 1;
     if (u.hpcur < 0)
     {
-       u.hpcur = 0;
-       return do_death(d, what);
+        u.hpcur = 0;
+        return do_death(d, what);
     }
     return 0;
 }
@@ -293,31 +293,31 @@ void heal_u(int amount, int boost, int loud)
 {
     if (u.hpcur + amount > u.hpmax)
     {
-       if (boost)
-       {
-           u.hpmax++;
-       }
-       amount = u.hpmax - u.hpcur;
+        if (boost)
+        {
+            u.hpmax++;
+        }
+        amount = u.hpmax - u.hpcur;
     }
     u.hpcur += amount;
     /* Touch the status line */
     status_updated = 1;
     if (loud)
     {
-       /* Tell the player how much better they feel. */
-       if (u.hpcur == u.hpmax)
-       {
-           print_msg("You feel great.\n");
-       }
-       else
-       {
-           print_msg("You feel %sbetter.\n", amount > 10 ? "much " : "");
-       }
+        /* Tell the player how much better they feel. */
+        if (u.hpcur == u.hpmax)
+        {
+            print_msg("You feel great.\n");
+        }
+        else
+        {
+            print_msg("You feel %sbetter.\n", amount > 10 ? "much " : "");
+        }
     }
     else
     {
-       /* Update the display. */
-       display_update();
+        /* Update the display. */
+        display_update();
     }
     return;
 }
@@ -329,73 +329,73 @@ int do_death(enum death d, const char *what)
 
     if (wizard_mode)
     {
-       really = getyn("Really die? ");
-       if (really != 1)
-       {
-           u.hpcur = u.hpmax;
-           u.adam = 0;
-           u.bdam = 0;
-           status_updated = 1;
-           print_msg("You survived that attempt on your life.");
-           return 0;
-       }
+        really = getyn("Really die? ");
+        if (really != 1)
+        {
+            u.hpcur = u.hpmax;
+            u.adam = 0;
+            u.bdam = 0;
+            status_updated = 1;
+            print_msg("You survived that attempt on your life.");
+            return 0;
+        }
     }
     if (!wizard_mode)
     {
-       fp = fopen("victrix-abyssi.log", "a");
+        fp = fopen("victrix-abyssi.log", "a");
     }
     print_msg("\n\nTHOU ART SLAIN!\n\n");
     game_finished = 1;
     switch (d)
     {
     case DEATH_KILLED:
-       print_msg("You were killed by %s.\n", what);
-       if (!wizard_mode)
-       {
-           fprintf(fp, "%s was killed by %s.\n", u.name, what);
-       }
-       break;
+        print_msg("You were killed by %s.\n", what);
+        if (!wizard_mode)
+        {
+            fprintf(fp, "%s was killed by %s.\n", u.name, what);
+        }
+        break;
     case DEATH_KILLED_MON:
-       print_msg("You were killed by a nasty %s.\n", what);
-       if (!wizard_mode)
-       {
-           fprintf(fp, "%s was killed by a nasty %s.\n", u.name, what);
-       }
-       break;
+        print_msg("You were killed by a nasty %s.\n", what);
+        if (!wizard_mode)
+        {
+            fprintf(fp, "%s was killed by a nasty %s.\n", u.name, what);
+        }
+        break;
     case DEATH_BODY:
-       print_msg("Your heart was stopped by %s.\n", what);
-       if (!wizard_mode)
-       {
-           fprintf(fp, "%s's heart was stopped by %s.\n", u.name, what);
-       }
-       break;
+        print_msg("Your heart was stopped by %s.\n", what);
+        if (!wizard_mode)
+        {
+            fprintf(fp, "%s's heart was stopped by %s.\n", u.name, what);
+        }
+        break;
     case DEATH_AGILITY:
-       print_msg("Your nerves were destroyed by %s.\n", what); 
-       if (!wizard_mode)
-       {
-           fprintf(fp, "%s's nerves were destroyed by %s.\n", u.name, what); 
-       }
-       break;
+        print_msg("Your nerves were destroyed by %s.\n", what); 
+        if (!wizard_mode)
+        {
+            fprintf(fp, "%s's nerves were destroyed by %s.\n", u.name, what); 
+        }
+        break;
     case DEATH_LASH:
         print_msg("You tasted the lash one time too many.\n");
-       if (!wizard_mode)
-       {
-           fprintf(fp, "%s tasted the lash one time too many.\n", u.name);
-       }
+        if (!wizard_mode)
+        {
+            fprintf(fp, "%s tasted the lash one time too many.\n", u.name);
+        }
         break;
     case DEATH_RIBBONS:
         print_msg("You looked good in ribbons.\n");
-       if (!wizard_mode)
-       {
-           fprintf(fp, "%s looked good in ribbons.\n", u.name);
-       }
+        if (!wizard_mode)
+        {
+            fprintf(fp, "%s looked good in ribbons.\n", u.name);
+        }
         break;
     }
     if (!wizard_mode)
     {
-       fprintf(fp, "    %s died after %d ticks, with %d XP, on dungeon level %d.\n\n", u.name, game_tick, u.experience, depth);
-       fflush(fp);
-       fclose(fp);
+        fprintf(fp, "    %s died after %d ticks, with %d XP, on dungeon level %d.\n\n", u.name, game_tick, u.experience, depth);
+        fflush(fp);
+        fclose(fp);
     }
     print_msg("Your game lasted %d ticks.\n", game_tick);
     print_msg("You killed monsters worth %d experience.\n", u.experience);
@@ -412,8 +412,8 @@ void write_char_dump(void)
     fp = fopen(filename, "w");
     if (fp == NULL)
     {
-       print_msg("Couldn't create dump file. Dump failed.\n");
-       return;
+        print_msg("Couldn't create dump file. Dump failed.\n");
+        return;
     }
     fprintf(fp, "%s, level %d princess (%d XP)\n", u.name, u.level, u.experience);
     fprintf(fp, "%d of %d hit points.\n", u.hpcur, u.hpmax);
@@ -423,11 +423,11 @@ void write_char_dump(void)
     fprintf(fp, "Inventory:\n");
     for (i = 0; i < 19; i++)
     {
-       if (u.inventory[i] != -1)
-       {
-           fprint_obj_name(fp, u.inventory[i]);
-           fputc('\n', fp);
-       }
+        if (u.inventory[i] != -1)
+        {
+            fprint_obj_name(fp, u.inventory[i]);
+            fputc('\n', fp);
+        }
     }
     fflush(fp);
     fclose(fp);
@@ -486,7 +486,7 @@ void u_init(void)
     u.inventory[0] = create_obj(PO_DAGGER, 1, 1, -1, -1);
     if (u.inventory[0] == -1)
     {
-       print_msg("Couldn't create dagger!\n");
+        print_msg("Couldn't create dagger!\n");
     }
     u.inventory[1] = create_obj(PO_IRON_RATION, 1, 1, -1, -1);
     u.inventory[2] = create_obj(PO_BATTLE_BALLGOWN, 1, 1, -1, -1);
@@ -500,15 +500,15 @@ int lev_threshold(int level)
 {
     if (level < 10)
     {
-       return 20 * (1 << (level - 1));
+        return 20 * (1 << (level - 1));
     }
     if (level < 20)
     {
-       return 10000 * (level - 9);
+        return 10000 * (level - 9);
     }
     if (level < 30)
     {
-       return 100000 * (level - 18);
+        return 100000 * (level - 18);
     }
     return INT_MAX;
 }
@@ -522,37 +522,37 @@ void gain_experience(int amount)
     status_updated = 1;
     if (u.experience > lev_threshold(u.level))
     {
-       u.level++;
-       print_msg("You gained a level!\n");
-       if (!zero_die(2))
-       {
-           bodygain = gain_body(2, 0);
-           agilgain = gain_agility(1, 0);
-       }
-       else
-       {
-           bodygain = gain_body(1, 0);
-           agilgain = gain_agility(2, 0);
-       }
-       print_msg("You gained %d body and %d agility.\n", bodygain, agilgain);
-       hpgain = u.body / 10 + 10;
-       if (u.hpmax + hpgain > 999)
-       {
-           hpgain = 999 - u.hpmax;
-       }
-       if (hpgain > 0)
-       {
-           /* v1.3: Policy change - gaining a level effectively
-            * heals you. */
-           u.hpcur += hpgain;
-           u.hpmax += hpgain;
-           status_updated = 1;
-           print_msg("You gained %d hit points.\n", hpgain);
-       }
+        u.level++;
+        print_msg("You gained a level!\n");
+        if (!zero_die(2))
+        {
+            bodygain = gain_body(2, 0);
+            agilgain = gain_agility(1, 0);
+        }
+        else
+        {
+            bodygain = gain_body(1, 0);
+            agilgain = gain_agility(2, 0);
+        }
+        print_msg("You gained %d body and %d agility.\n", bodygain, agilgain);
+        hpgain = u.body / 10 + 10;
+        if (u.hpmax + hpgain > 999)
+        {
+            hpgain = 999 - u.hpmax;
+        }
+        if (hpgain > 0)
+        {
+            /* v1.3: Policy change - gaining a level effectively
+             * heals you. */
+            u.hpcur += hpgain;
+            u.hpmax += hpgain;
+            status_updated = 1;
+            print_msg("You gained %d hit points.\n", hpgain);
+        }
     }
     else
     {
-       display_update();
+        display_update();
     }
 }
 
@@ -585,91 +585,91 @@ void update_player(void)
     }
     else if (!(game_tick % 60) && (u.hpcur < u.hpmax * 3 / 4))
     {
-       /* Hungry player heals much, much slower, and cannot regain
-        * all their hit points. */
-       heal_u(1, 0, 0);
+        /* Hungry player heals much, much slower, and cannot regain
+         * all their hit points. */
+        heal_u(1, 0, 0);
     }
     /* Once you hit the nutrition endstop, your ring of regeneration stops
      * working, and like normal regen, it won't raise you above 75% HP if
      * your food counter is negative. */
     if (((game_tick % 10) == 5) &&
-       (objects[u.ring].obj_id == PO_RING_REGEN) &&
-       (u.hpcur < ((u.food >= 0) ? u.hpmax : ((u.hpmax * 3) / 4))) &&
-       (u.food >= -1950))
+        (objects[u.ring].obj_id == PO_RING_REGEN) &&
+        (u.hpcur < ((u.food >= 0) ? u.hpmax : ((u.hpmax * 3) / 4))) &&
+        (u.food >= -1950))
     {
-       /* Heal player for 1d3 hit points; do not allow HP gain,
-        * and don't say anything apart from the regen ring message. */
-       print_msg("Your ring pulses soothingly.\n");
-       heal_u(one_die(3), 0, 0);
+        /* Heal player for 1d3 hit points; do not allow HP gain,
+         * and don't say anything apart from the regen ring message. */
+        print_msg("Your ring pulses soothingly.\n");
+        heal_u(one_die(3), 0, 0);
     }
     if (u.food >= -1950)
     {
-       int food_use = 1;
-       int squeal = 0;
-       if ((objects[u.ring].obj_id == PO_RING_REGEN) && !(game_tick % 2) && (u.food >= -1950))
-       {
-           /* If you are still less hungry than -1950 nutrition,
-            * use one more food every second tick if you are
-            * wearing a ring of regeneration. */
-           food_use++;
-       }
-       if ((u.food >= 100) && (u.food - food_use < 100))
-       {
-           squeal = 1;
-       }
-       if ((u.food >= 0) && (u.food < food_use))
-       {
-           squeal = 2;
-       }
-       u.food -= food_use;
-       status_updated = 1;
-       switch (squeal)
-       {
-       case 0:
-       default:
-           break;
-       case 1:
-           print_msg("You are getting quite hungry.\n");
-           break;
-       case 2:
-           print_msg("You are feeling hunger pangs, and will recover\nmore slowly from your injuries.\n");
-           break;
-       }
+        int food_use = 1;
+        int squeal = 0;
+        if ((objects[u.ring].obj_id == PO_RING_REGEN) && !(game_tick % 2) && (u.food >= -1950))
+        {
+            /* If you are still less hungry than -1950 nutrition,
+             * use one more food every second tick if you are
+             * wearing a ring of regeneration. */
+            food_use++;
+        }
+        if ((u.food >= 100) && (u.food - food_use < 100))
+        {
+            squeal = 1;
+        }
+        if ((u.food >= 0) && (u.food < food_use))
+        {
+            squeal = 2;
+        }
+        u.food -= food_use;
+        status_updated = 1;
+        switch (squeal)
+        {
+        case 0:
+        default:
+            break;
+        case 1:
+            print_msg("You are getting quite hungry.\n");
+            break;
+        case 2:
+            print_msg("You are feeling hunger pangs, and will recover\nmore slowly from your injuries.\n");
+            break;
+        }
     }
     if (u.leadfoot > 0)
     {
-       u.leadfoot--;
-       if (!u.leadfoot)
-       {
-           print_msg("You shed your feet of lead.\n");
-           recalc_defence();
-       }
+        u.leadfoot--;
+        if (!u.leadfoot)
+        {
+            print_msg("You shed your feet of lead.\n");
+            recalc_defence();
+        }
     }
     if (u.armourmelt > 0)
     {
-       u.armourmelt--;
-       if (!u.armourmelt)
-       {
-           print_msg("Your armour seems solid once more.\n");
-           recalc_defence();
-       }
+        u.armourmelt--;
+        if (!u.armourmelt)
+        {
+            print_msg("Your armour seems solid once more.\n");
+            recalc_defence();
+        }
     }
     if (u.withering > 0)
     {
-       u.withering--;
-       if (!u.withering)
-       {
-           print_msg("Your limbs straighten.\n");
-           recalc_defence();
-       }
+        u.withering--;
+        if (!u.withering)
+        {
+            print_msg("Your limbs straighten.\n");
+            recalc_defence();
+        }
     }
     if (u.protection > 0)
     {
-       u.protection--;
-       if (!u.protection)
-       {
-           print_msg("You feel like you are no longer being helped.\n");
-       }
+        u.protection--;
+        if (!u.protection)
+        {
+            print_msg("You feel like you are no longer being helped.\n");
+        }
     }
     display_update();
 }
index df990bc..319d785 100644 (file)
--- a/vector.c
+++ b/vector.c
 
 void compute_directions(int y1, int x1, int y2, int x2, int *pdy, int *pdx, int *psy, int *psx, int *pmelee, int *pcardinal)
 {
-       int dy, dx, sy, sx;
-       dy = y1 - y2;
-       dx = x1 - x2;
-       sy = dy > 0 ? 1 : (dy < 0 ? -1 : 0);
-       sx = dx > 0 ? 1 : (dx < 0 ? -1 : 0);
-       if (pdy)
-       {
-               *pdy = dy;
-       }
-       if (pdx)
-       {
-               *pdx = dx;
-       }
-       if (psy)
-       {
-               *psy = sy;
-       }
-       if (psx)
-       {
-               *psx = sx;
-       }
-       if (pmelee)
-       {
-               *pmelee = (dy < 2) && (dy > -2) && (dx < 2) && (dx > -2);
-       }
-       if (pcardinal)
-       {
-               *pcardinal = (dy == dx) || (dy == -dx) || (dx == 0) || (dy == 0);
-       }
+    int dy, dx, sy, sx;
+    dy = y1 - y2;
+    dx = x1 - x2;
+    sy = dy > 0 ? 1 : (dy < 0 ? -1 : 0);
+    sx = dx > 0 ? 1 : (dx < 0 ? -1 : 0);
+    if (pdy)
+    {
+        *pdy = dy;
+    }
+    if (pdx)
+    {
+        *pdx = dx;
+    }
+    if (psy)
+    {
+        *psy = sy;
+    }
+    if (psx)
+    {
+        *psx = sx;
+    }
+    if (pmelee)
+    {
+        *pmelee = (dy < 2) && (dy > -2) && (dx < 2) && (dx > -2);
+    }
+    if (pcardinal)
+    {
+        *pcardinal = (dy == dx) || (dy == -dx) || (dx == 0) || (dy == 0);
+    }
 }
 
 /* vector.c */