Saturday, January 3, 2009

Console editing and I've gone and done it again!

While taking a break from something moderately large I have brewing (...of which more later...) I'm putting a lot of work into console editing. The objective here is to have a somewhat less aggravating console, which actually lets you do useful stuff. It's a mixture of old QuakeSrc tutorials (which have to be worked over to fit in with other changes I've made) and original code, with most of the code being original.

This is probably the first time in about 6 years I've put a QuakeSrc tutorial into my code, but the need for the feature is there so why reinvent the wheel?

Console features now include:

  • Enhanced TAB completion; you will get a list of all commands or cvars (sorted alphabetically, indicating which type each is) that match what you type. Press TAB repeatedly to cycle.
  • Cursor stays at the end of what you've partially typed so you can fine-tune.
  • Left and right arrow keys work as expected in the console; Delete and Insert functionality.
  • Home and End functionality restored for backscrolling.
  • Home and End bring you to the start or end of the line if you're in the middle of a line rather than scrolling the console.
That's about that so far, on to the moderately huge thing.

I know I said that I wouldn't do it again, but with me being me I went ahead and did it anyway. I'm writing a scriptable HUD system. Not some flaky homebrew scripting language, nor some horrific concoction of XML (ugh!) or whatever, but good old cfg files and cvars. This will entirely replace the status bar, but the default layout will replicate the classic status bar look. I actually have most of it done, aside from weapons and ammo counts (having to tackle the Hipnotic and Rogue hackery in there has never been a pleasant experience).

You'll be able to independently position just about every single HUD element - for convenience I've grouped the inventory items (into keys/sigils/items/weapons/ammo counts), but there's still some flexibility with their positioning. Then just issue a "savehud myhud" command, and put "exec myhud.cfg" into your autoexec. There will also be a defaulthud cvar which you can use to specify a hud file to load automatically for you.

Because there are so many HUD cvars I'm not saving them to the config.

I have ambitions for this, not sure if anyone's ever gonna use it all, but it scratches an itch for me, so mission accomplished. But someday I hope to write a layout interface for it, where you can visually position all of the elements.

0 comments: