Request for range indicator

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ChodTheWacko
    Adept
    • Jul 2007
    • 155

    Request for range indicator

    Hey Everyone,

    I modified the out of range message to:
    Target out of range by 5 squares. Fire anyway?

    It's very handy.

    The code is trivial, looks something like:


    if ((dir == 5) && target_okay())
    {
    int taim;
    char msg[80]

    target_get(&tx, &ty);
    taim = distance(y, x, ty, tx);
    if (taim > tdis)
    {
    sprintf (msg, "Target out of range by %d squares. Fire anyway? ",taim-tdis);
    if (!get_check(msg))
    return;
    }
    }

    I always hated doing: 'fire, abort, step, fire, abort, step, ........ ' till a monster gets in range.

    - Frank
    Last edited by ChodTheWacko; May 15, 2011, 21:39.
  • Magnate
    Angband Devteam member
    • May 2007
    • 5110

    #2
    Nice! Thanks - I'll check that in tonight or tomorrow.
    "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

    Comment

    • buzzkill
      Prophet
      • May 2008
      • 2939

      #3
      Wouldn't giving the distance in feet sound better? Something like "Target is 50' out of range."
      www.mediafire.com/buzzkill - Get your 32x32 tiles here. UT32 now compatible Ironband and Quickband 9/6/2012.
      My banding life on Buzzkill's ladder.

      Comment

      • takkaria
        Veteran
        • Apr 2007
        • 1951

        #4
        Originally posted by ChodTheWacko
        Hey Everyone,

        I modified the out of range message to:
        Target out of range by 5 squares. Fire anyway?

        It's very handy.

        The code is trivial, looks something like:


        if ((dir == 5) && target_okay())
        {
        int taim;
        char msg[80]

        target_get(&tx, &ty);
        taim = distance(y, x, ty, tx);
        if (taim > tdis)
        {
        sprintf (msg, "Target out of range by %d squares. Fire anyway? ",taim-tdis);
        if (!get_check(msg))
        return;
        }
        }

        I always hated doing: 'fire, abort, step, fire, abort, step, ........ ' till a monster gets in range.

        - Frank
        Hmm, could we achieve a similar effect by showing out-of-range grids when targetting in red, or somesuch?
        takkaria whispers something about options. -more-

        Comment

        • Derakon
          Prophet
          • Dec 2009
          • 9022

          #5
          Why not do both?

          Comment

          • takkaria
            Veteran
            • Apr 2007
            • 1951

            #6
            Originally posted by Derakon
            Why not do both?
            Aye, even better.
            takkaria whispers something about options. -more-

            Comment

            • ChodTheWacko
              Adept
              • Jul 2007
              • 155

              #7
              Originally posted by takkaria
              Hmm, could we achieve a similar effect by showing out-of-range grids when targetting in red, or somesuch?
              yea - I have no idea how to code such a thing though.
              I just went for the easiest solution so it had a high chance of getting in

              and feet is fine of course.

              - Frank

              Comment

              • Magnate
                Angband Devteam member
                • May 2007
                • 5110

                #8
                Originally posted by takkaria
                Aye, even better.
                I have committed Frank's changes to start with (I left it as "squares" because there is no consensus on the size of a square). The original intention of porting Jeff's path-to-target feature was indeed to show out-of-range squares in red, but this is dependent on ticket #1328, the splendidly-titled "rewrite target.c so it's less hideous". At the moment the whole of the targetting code has no concept of allowed range at all, so it's a deeply non-trivial fix.
                "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                Comment

                Working...
                😀
                😂
                🥰
                😘
                🤢
                😎
                😞
                😡
                👍
                👎