Jump to content
Eternal Lands Official Forums
Sir_Odie

Ranging Lock

Recommended Posts

I wrote a patch to implement a Ranging-Lock feature similar to Sit-Lock as suggested here...

 

Index: elconfig.h
===================================================================
RCS file: /cvsroot/elc/elc/elconfig.h,v
retrieving revision 1.33
diff -u -r1.33 elconfig.h
--- elconfig.h   8 May 2009 23:51:54 -0000   1.33
+++ elconfig.h   11 May 2009 21:36:10 -0000
@@ -103,6 +103,8 @@
extern int gx_adjust;
extern int gy_adjust;

+extern int ranging_lock;
+
void display_elconfig_win(void);

void change_language(const char *new_lang);

Index: elconfig.c
===================================================================
RCS file: /cvsroot/elc/elc/elconfig.c,v
retrieving revision 1.334
diff -u -r1.334 elconfig.c
--- elconfig.c   10 May 2009 20:14:49 -0000   1.334
+++ elconfig.c   11 May 2009 21:40:10 -0000
@@ -151,6 +151,7 @@

int you_sit= 0;
int sit_lock= 0;
+int ranging_lock= 0;
int use_keypress_dialogue_boxes = 0, use_full_dialogue_window = 0;
int use_alpha_banner = 0;
int show_fps= 1;
@@ -1668,6 +1669,7 @@

#ifndef MAP_EDITOR2
   add_var(OPT_BOOL,"sit_lock","sl",&sit_lock,change_var,0,"Sit Lock","Enable this to prevent your character from moving by accident when you are sitting.",CONTROLS);
+   add_var(OPT_BOOL,"ranging_lock","rl",&ranging_lock,change_var,0,"Ranging Lock","Enable this to prevent your character from moving by accident when you are using ranging weapons.",CONTROLS);

   add_var(OPT_BOOL,"item_window_on_drop","itemdrop",&item_window_on_drop,change_var,1,"Item Window On Drop","Toggle whether the item window shows when you drop items",CONTROLS);
   add_var(OPT_BOOL,"use_floating_messages", "floating", &floatingmessages_enabled, change_var, 1, "Floating Messages", "Toggles the use of floating experience messages and other graphical enhancements", CONTROLS);

Index: gamewin.c
===================================================================
RCS file: /cvsroot/elc/elc/gamewin.c,v
retrieving revision 1.320
diff -u -r1.320 gamewin.c
--- gamewin.c   7 May 2009 23:14:41 -0000   1.320
+++ gamewin.c   11 May 2009 22:21:19 -0000
@@ -458,7 +458,7 @@
      {
         elwin_mouse = CURSOR_TRADE;
      }
-      else if(alt_on || action_mode==ACTION_ATTACK)
+      else if(alt_on || action_mode==ACTION_ATTACK || ranging_lock)
      {
         elwin_mouse = CURSOR_ATTACK;
      }
@@ -490,7 +490,7 @@
      {
         elwin_mouse = CURSOR_WAND;
      }
-      else if(alt_on || action_mode==ACTION_ATTACK || (actor_under_mouse && !actor_under_mouse->dead))
+      else if(alt_on || action_mode==ACTION_ATTACK || ranging_lock || (actor_under_mouse && !actor_under_mouse->dead))
      {
         elwin_mouse = CURSOR_ATTACK;
      }
@@ -913,7 +913,7 @@
         if ((mx >= window_width-hud_x) || (my >= window_height-hud_y))
            return 1;            

-         if (flag_alt && range_weapon_equipped)
+         if ((flag_alt && range_weapon_equipped) || (ranging_lock && range_weapon_equipped))
            return 1;
         if (you_sit && sit_lock && !flag_ctrl){
            LOG_TO_CONSOLE(c_green1, no_walk_with_sitlock);

Edited by Sir_Odie

Share this post


Link to post
Share on other sites

This certainly works but I wonder how convenient it is being a config option? Obviously, by design, with the lock on, you can not move until you turn the option off or you unequip your bow. Would you really want to save the value between game sessions? Also toggling it on and off is currently a bit time consuming. May be instead, there could be a new key sequence to enter/leave the lock mode, and/or a new entry in the player context menu.

Edited by bluap

Share this post


Link to post
Share on other sites

Ty for your comments.

This was only a first attempt implemented similar to the sit_lock variable.

Saving between sessions is really not needed and a key sequence and/or context-menu entry is a great idea (but wouldn't the same be true for sit_lock?)... :medieval:

 

Edit:

I rewrote the patch to use the player context-menu instead of a config option and uploaded it to Berlios...

Edited by Sir_Odie

Share this post


Link to post
Share on other sites
Ty for your comments.

This was only a first attempt implemented similar to the sit_lock variable.

Saving between sessions is really not needed and a key sequence and/or context-menu entry is a great idea (but wouldn't the same be true for sit_lock?)... :pickaxe:

I had also thought about the similarity to the sit-lock. However, it is very easy to override by just standing up and most people probably want it on/off permanently. So different behaviour for this lock is OK IMHO.

 

Edit:

I rewrote the patch to use the player context-menu instead of a config option and uploaded it to Berlios...

Sorry, I didn't notice the edit before. The updated patch still has the config setting though and it will not apply for me again (like your usermenu for mac build patch). I think the problem with the patch is that you have converted tab characters to spaces so the patch command naturally gets confused. Generally the client uses real tab characters for indentation and you should do the same when writing patches. :pickaxe:

 

Anyway, have you thought about using a key combination to activate the attack lock? Something like ALT+a would be nice. With probably a console message saying your were entering or leaving lock mode.

 

Like Raistlin said, "sounds good imo".

Edited by bluap

Share this post


Link to post
Share on other sites

Sorry, didn't notice that there was an auto-conversion from tabs to spaces in my patches... :=((

 

I corrected and re-uploaded all my patches and hopefully they work now...

 

I thought about a key-combination (ALT+r for ranging-lock) in addition to the context-menu but we already have alot of key-combinations, so I first wanted to know, if it's ok to add that...

 

Ty for your hints!

 

Edit: I added the key-conbination with an according consol-message...

Edited by Sir_Odie

Share this post


Link to post
Share on other sites
I thought about a key-combination (ALT+r for ranging-lock) in addition to the context-menu but we already have alot of key-combinations, so I first wanted to know, if it's ok to add that...

I would say it is always ok to add the code for additional key combinations to a patch, finding a free combination can of course be tough, but it is easily changed later, or it could simply be removed if undesired.

Share this post


Link to post
Share on other sites

Definitely needed. With a shortcut, don't care what just as long as it works on linux (unlike holding the alt to target, heh)

Share this post


Link to post
Share on other sites
Definitely needed. With a shortcut, don't care what just as long as it works on linux (unlike holding the alt to target, heh)

Yes it works nicely on Linux and I think it would be very useful.

I use the gnome desktop so I just remapped the desktop's use of the ALT key.

Share this post


Link to post
Share on other sites

I put in <ALT+r> for ranging lock.

This could be changed by adding

#K_RANGINGLOCK = <your preferred key-combo>

to the 'key.ini' file in the EL program folder...

Share this post


Link to post
Share on other sites

fantastic idea :icon13:

 

would be great for my nerves :icon13: i hate it when i miss the monster and run close to it.. especially on the nordcarn wall.

 

thx odie..

Share this post


Link to post
Share on other sites

Did something get changed in ranging lock with CVS recently?

 

In current CVS, i noticed today that when i hold alt while in ranging mode it doesn't prevent me from walking if i misclick... I tested in normal 1.8.0 release client, and in that it still works fine... just in current CVS it doesn't work for me.

 

Also, a ranging lock as per Odie describes in this thread definitely has thumbs up from me.

Will be cool if ctrl+right-click does still make you walk though (as it does now even when you're sit-locked).

Edited by Korrode

Share this post


Link to post
Share on other sites

Force-walk (ctrl+rightclick) works as intended: it OVERRIDES the locks (sit/ranging) but doesn't disable them.

For the ranging-lock that means you can walk with ctrl+rightclick while ranging-lock is enabled but after releasing ctrl the lock is still active. You can disable it with alt+r or by unequipping the bow/crossbow.

If people think ctrl+rightclick should disable the ranging-lock i can change that of course.... :=))

 

EDIT:

I just tested alt while ranging with the current CVS client under Windows and it worked: i didn't move when i clicked next to the target...

Edited by Sir_Odie

Share this post


Link to post
Share on other sites
Force-walk (ctrl+rightclick) works as intended: it OVERRIDES the locks (sit/ranging) but doesn't disable them.

For the ranging-lock that means you can walk with ctrl+rightclick while ranging-lock is enabled but after releasing ctrl the lock is still active. You can disable it with alt+r or by unequipping the bow/crossbow.

Now that i think about it, having it work that way is probably better ^^ u can go grab a drop bad and walk back to your spot and not have to turn the lock on again.

 

EDIT:

I just tested alt while ranging with the current CVS client under Windows and it worked: i didn't move when i clicked next to the target...

Doesn't work for me on my current Arch linux install :\

Maybe it's somehow at my end.

Share this post


Link to post
Share on other sites
Doesn't work for me on my current Arch linux install :\

Maybe it's somehow at my end.

Using Alt to stop movement works fine here on Ubuntu. Curious.

 

Looking again at this patch, do we really need the "Ranging-Lock is enabled. Disable...." every time you click and don't get the attach cursor? With a fast moving creature, I certainly miss a lot and so get an awful lot of SPAM on screen and in my chat log. What we could really do with is an on-screen indication when the lock is in place.... Like the poison and shields may be....

 

There appears to be a lot of support for this patch. Does anyone object to adding it to the client?

Edited by bluap

Share this post


Link to post
Share on other sites
Looking again at this patch, do we really need the "Ranging-Lock is enabled. Disable...." every time you click and don't get the attach cursor? With a fast moving creature, I certainly miss a lot and so get an awful lot of SPAM on screen and in my chat log. What we could really do with is an on-screen indication when the lock is in place.... Like the poison and shields may be....

For this we would need at least 1 new icon.

Some ideas:

1) put a text (e.g. RL: 0/1) in the upper right corner together with the FPS/UVP message

2) add a counter so that the console-message is only printed on every x'th misclick

3) add a timer so that there is only one message per x seconds

 

Of course i'm open for better ideas... :=))

Edited by Sir_Odie

Share this post


Link to post
Share on other sites
For this we would need at least 1 new icon.

Some ideas:

1) put a text (e.g. RL: 0/1) in the upper right corner together with the FPS/UVP message

2) add a counter so that the console-message is only printed on every x'th misclick

3) add a timer so that there is only one message per x seconds

Of course i'm open for better ideas... :=))

I'd prefer something like option 1 rather than the others. I've also just experimented with using the walk/attack/spell highlight graphic. Like the red cross that briefly appears at the feet of you target, I made a yellow highlight that briefly appears at your feed if you try to walk with the lock on. The same highlight could be used for the sit lock too. Just another option.

Share this post


Link to post
Share on other sites

I uploaded an alternate version of the ranging lock to Berlios. This one uses an indicator in the top right corner (R-L: 0/1) instead of the status message. This could be a good combination with your highlight-graphic which sounds good for both locks...

I didn't really notice the messages as spammy as i get lots of messages (you failed to flee / you're too far away) while training --> they look somewhat 'normal' to me :=))

Share this post


Link to post
Share on other sites

After chatting with Entropy, I've committed this patch. Slightly modified to use the yellow cross highlight rather than the console message to warn it's engaged. I also removed the sit lock message in favour if using the same yellow highlight. For now, I did not add the FPS area indicator text. I wonder if its needed? Also, the existing code is a bit messy and some people (myself included) have that text switched off.

 

Edit: I forgot to add. Thanks Sir_Odie for the patch. :P

Edited by bluap

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×