Jump to content
Eternal Lands Official Forums
Sign in to follow this  
Ezeril

Proposed Patch: Quickbar For Magic

Recommended Posts

OK, I haven't been playing EL for that long, so I don't know if I should even even be writing mods for the client (seeing as how no one knows me well enough to have reason to trust me), but I have a lot of free time on my hands right now, and I saw this on the to-do list, so I figured I'd give it a go anyways.

 

Here's a screenshot of the mod:

 

qcb_mod.jpg

 

Here's how it works:

 

  • The quickbar is fully customizable. The spells in the quickbar are saved in el.cfg.
  • The quickbar can be displayed in a horizontal or vertical orientation. The default is vertical. To display the quickbar horizontally, add this line to el.ini: #quickcastbar_vert = 0
  • For those who don't use magic, the quickbar can be toggled by an icon at the bottom of the screen (between the options icon and buddy icon in the screenshot.)
  • Spells are added to the quickbar through the sigils window. Select the appropriate sigils for the spell and click the arrow in the bottom right corner.
  • To use a spell in the quickbar, simply left-click on it. The sigil window does not have to be open.
  • To remove a spell from the quickbar, right-click on it.
  • If the sigil window is closed, messages associated with spellcasting normally displayed in the sigils window (e.g., "Please select a friendly target for the Remote Heal spell.") are sent to the console.
  • If the user attempts to put an invalid spell in the quickbar, or put a spell into the quickbar that is already present in the quickbar, an error message is displayed in
    the sigils window.

The icons that appear in the quickbar are pulled out of a new file in the textures folder called spells.bmp. The code is a bit hackish in places, but it's fairly bug-free, as far as I can tell. (I tried everything I could think of to get something to blow up.) The only obvious problem right now is that a titlebar won't draw properly on a window narrower than 48 pixels, and the vertical quickbar is 32 pixels wide. This would be easy to fix though. The problem is that the current draw_window_title() function makes each end of the titlebar 32 pixels wide. Titlebars still look fine if the ends are only 16 pixels wide however, and titlebars for windows that are only 32 pixels wide look passable.

 

It would also still be relatively painless to add spells to the game with this patch included. I need to know what sigils each valid spell uses (so I can recognize valid spells), and what icon to give it. I put all this information into a text file instead of hard-coding it, so when new spells are added to the game the text file (and spells.bmp, if desired) is all that would need to be updated client-side.

 

If anyone's interested in the patch, I can post the diff and/or the new source files.

Share this post


Link to post
Share on other sites

there was plans for a spells quickbar located next to the existing quickbar for items. can you perhaps code in a option for it to dock there, maybe #quickcastbar_vert = 2 or something :D

 

hmm, those icons they are blends of the sigils that go into the spell right?

 

other then that i say they should commit this patch as the game needs a quickbar like that and it will not interfer with the new magic system, whenever that gets done...

Share this post


Link to post
Share on other sites

Good work!

 

Can the quick bar not be docked something similar to the inventory quickbar? Just a thought, although i might be thinking in the wrong sense here :D

Share this post


Link to post
Share on other sites

I agree with duran. This should be in hud.c (next to the current quickbar). And don't worry about being new - it's open source, everyone can audit the code and reject it if it's "untrustworthy" for some reason ;-) I think that the developers will just be happy to have more people helping them creating a better game :D

 

You can reuse the functions used for drawing the current quickbar (init_quickbar, draw_quickbar - always remember to use the window manager, that's what it's there for :) (don't know if you do that already ;-))), and just change the placement. However, it might be a problem that the current quickbar is only 64-pixels wide.

 

However, I doubt that putting the spellbar below the current quickbar would look nice. It might be a good idea to get Roja's oppinion on where this should be placed :)

 

But please, post your diff.

Share this post


Link to post
Share on other sites

Aye, originally I had placed it underneath the items quickbar, which looked so-so, but the major problem with doing that was space. I don't know if anyone actually plays in a resolution smaller than 800x600 full-screen (including 800x600 windowed), but in those resolutions the spell quickbar would overlap part of the clock.

A good portion of the code between the magic quickbar and the items quickbar is identical. I should probably just rewrite the item quickbar functions so that they're a little more generic (e.g., the current display_quickbar_handler() determines which texture to use for each slot by looking at the image_id for the current item in item_list[], which is item quickbar-specific.)

 

I'd more than welcome Roja's input on where to place this quickbar, but for now I will start rewriting the quickbar functions to handle both types of quickbar, and place it back underneath the items quickbar.

 

(Edit: By the way, the patch does use the new hud.c. I'm all for letting the window manager do its thing. Less code for me to write :P )

Share this post


Link to post
Share on other sites

Hey great job! The spell quickbar should be placed right next to the items quickbar, not under it, but to the left of it. That's why that space was left there and the items quickbar is the size it is.

 

I even like the icons for the spells you've made. Did you make a .bmp texture file for them?

Share this post


Link to post
Share on other sites

The patch isn't on BerliOS yet, I was waiting on a verdict before putting it up. I'll post it as soon as I change it around to put the spell quickbar to the left of the items quickbar. Since it will be back in hud.c, I'll probably go ahead a rewrite the current quickbar functions to be generic enough to handle both quickbars.

 

And the spell icons are in a .bmp in the textures folder. I can't draw so I dusted off Paint Shop Pro and messed around with layering sigil icons on top of each other with various kinds of blending. Although for spells with an effect icon (shield, poison, etc.) I just copied the effect icon over into the texture file. I really just made those icons so I would have something to display in the quickbar for a screenshot... but if you like them then by all means use them B)

 

I'll post again when I'm finished moving the magic quickbar, and rewriting the quickbar functions in hud.c.

Share this post


Link to post
Share on other sites

Ok, the patch is up on BerliOS now. I had to make the hud frame just a tiny bit wider to fit the magic quickbar in. I also rewrote init_quickbar and display_quickbar_handler so that they can be used for both quickbars. click_quickbar_handler was just too different to try and make generic, so the magic quickbar still has its own separate click handler.

 

Also, here is the .bmp for the spell icon textures (this should go in the textures folder), and I'm posting the contents of the text file containing the spell information below (this file goes in the main directory):

 

14
Heal 0 2 3 23
Remote_Heal 1 3 9 3 23
Magic_Protection 2 3 19 17 21
Shield 3 3 19 15 21
Poison 4 3 5 4 24
Teleport_to_Range 5 4 7 0 8 2
Harm 6 2 22 23
Restoration 7 2 1 24
Bones_to_Gold 8 3 6 0 15
Teleport_to_Portals_Room 9 4 7 0 9 2
Life_Drain 10 3 7 0 24
Magic_Immunity 11 4 19 3 17 21
Heal_Summoned 12 4 8 2 23 14
Smite_Summoned 13 4 8 2 22 24

 

The first line is the total number of spells (so I can dynamically allocate the array of structs holding all this junk) The format of the following lines is:

name image_id number_of_sigils sigil1 sigil2 [sigil3...]

The sigil numbers are the same numbers sent in a CAST_SPELL message.

The name is there for future use, since it might be nice to have the name of the spell in a quickbar slot appear as a tooltip.

 

(Edit: changed the link for spells.bmp to a copy on a less-flaky server.)

Share this post


Link to post
Share on other sites

the spells.bmp link give a 404 error...

 

going to grab the patch now and have a look...

 

edit:

seems there is some funny stuff going on with the patch. the prosess gives me an error:

 

patch: **** `---' expected at line 246 of patch

 

and when i try to compile the compiler errors saying that it cant find quickcast.h

Share this post


Link to post
Share on other sites

ok, to draw attention to this thread again, take a look at my edit. it seems the patch on the dev page dont apply cleanly. i have tried some basic stuff but it seems that either there is whitespace errors in the patch (should patch be sensitive to that?) or something strange is going on...

Share this post


Link to post
Share on other sites

only "problem" there is that the patch your talking about isnt in diff format so the work to merge it can be problematic. it was merged at one time but when i tryed to compile it there was a lot of end of line warnings. yes it compiled but all those errors should be cleaned up, atleast in my view...

Share this post


Link to post
Share on other sites

Umm .. i think you should also be able to put summoning recepts and stuff like that into the quickbar. summoning is also magic and having the manu window open all time is not good.

What do you think?

Share this post


Link to post
Share on other sites

I apologize for all this mess (flaming CVS n00b here). Did my homework this time, made a diff the proper way, then tested it against a fresh copy of the source from CVS (checked it out to a new directory with CVS, applied the diff with patch, compiled it, ran it from the main EL directory). There was one failed hunk but it's not critical... in fact, it's not even a real change... Anywho, the new patch is up on BerliOS, and the two new files (quickcast.c and quickcast.h -- things the quickbar needs that seemed out-of-place in hud.c) can be found here.

 

(Edit: I've been working on this code in VS.NET (compiling as C code), don't know if that's going to be a serious issue for those working in Dev-C++.)

Share this post


Link to post
Share on other sites

elc_patched/quickcast.c:9: parse error before '*' token

 

elc_patched/quickcast.c:9: warning: data definition has no type or storage class

 

elc_patched/quickcast.c:13: parse error before "quickcastbar_spells"

 

elc_patched/quickcast.c:13: warning: data definition has no type or storage class

 

elc_patched/quickcast.c: In function `init_quickcastbar':

elc_patched/quickcast.c:20: request for member `num_sigils' in something not a structure or union

 

elc_patched/quickcast.c:21: request for member `image_id' in something not a structure or union

 

elc_patched/quickcast.c: At top level:

elc_patched/quickcast.c:25: parse error before "ssg"

 

elc_patched/quickcast.c: In function `cast_spell':

elc_patched/quickcast.c:34: `ssg' undeclared (first use in this function)

 

elc_patched/quickcast.c:34: (Each undeclared identifier is reported only once

 

elc_patched/quickcast.c:34: for each function it appears in.)

 

elc_patched/quickcast.c: At top level:

elc_patched/quickcast.c:59: parse error before '*' token

 

elc_patched/quickcast.c: In function `set_spell_info':

elc_patched/quickcast.c:63: `ssg' undeclared (first use in this function)

 

elc_patched/quickcast.c:65: request for member `num_sigils' in something not a structure or union

 

elc_patched/quickcast.c:65: request for member `sigils' in something not a structure or union

 

elc_patched/quickcast.c:74: request for member `name' in something not a structure or union

 

elc_patched/quickcast.c: At top level:

elc_patched/quickcast.c:85: parse error before "spell_sigils"

 

elc_patched/quickcast.c: In function `set_spell_info_id':

elc_patched/quickcast.c:88: `ssg' undeclared (first use in this function)

 

elc_patched/quickcast.c:88: `spell_id' undeclared (first use in this function)

 

elc_patched/quickcast.c: In function `load_spells_list':

elc_patched/quickcast.c:115: `spell_sigils' undeclared (first use in this function)

 

elc_patched/quickcast.c:115: parse error before ')' token

 

elc_patched/quickcast.c:121: request for member `name' in something not a structure or union

 

elc_patched/quickcast.c:122: request for member `image_id' in something not a structure or union

 

elc_patched/quickcast.c:123: request for member `num_sigils' in something not a structure or union

 

elc_patched/quickcast.c:127: request for member `sigils' in something not a structure or union

 

elc_patched/quickcast.c:137:2: warning: no newline at end of file

 

this is what dev-c++ tossed out when trying to compile quickcast.c

Share this post


Link to post
Share on other sites
Guest Zeplin

Same kinda errors with gnu gcc.

And even before that, Issues with the patch applying,

Ill try adding it manually tommorow, And see if i can work out whats going on. Thats a sleep required job tho =)

Share this post


Link to post
Share on other sites

It's because quickcast.h is not included in quickcast.c :(

Hm, but it's included in global.h ...was that the hunk Ezeril? Hm, also, one more thing: instead of having to download more files, just diff -Nur (N meaning new file)... That may also be the problem for them.

 

btw- It looks like you diffed between two different versions.

 

 

Anyway, compiles and runs nicely :(

 

 

Just a few comments:

-Erm, what's with teh empty slots filling themselves on init? -Edit: found it. Instead of

void init_quickcastbar()
{
int i;
for(i=0;i<6;i++)
{
 quickcastbar_spells[i].num_sigils = 0;
 quickcastbar_spells[i].image_id = -1;
}
}

use

void init_quickcastbar()
{
int i,y;
for(i=0;i<6;i++)
{
 quickcastbar_spells[i].num_sigils = 0;
 for(y=0;y<6;y++)quickcastbar_spells[i].sigils[y] = -1;
 quickcastbar_spells[i].image_id = -1;
}
}

 

-Should save quickbar (contents) to el.cfg.

Share this post


Link to post
Share on other sites

gah,seriusly need to look at the files that the compiler complains about. 99% of the time its some joke of an error...

 

edit:

 

yes it compiled fine but i cant get the quickbar to show :P

no arrow in the magic window or anything like that (i recall a error when patching, asking about what file to patch, may have to take a look at that)...

 

edit2:

 

output from patch:

 

missing header for unified diff at line 86 of patch

can't find file to patch at input line 86

Perhaps you should have used the -p or --strip option?

The text leading up to this was:

--------------------------

|

--------------------------

Share this post


Link to post
Share on other sites

Lose the -u option. It will patch normally without it.

 

All I used was copy to the directory, then

patch -i magicquick.diff

 

Worked well enough...

Share this post


Link to post
Share on other sites

dont use -u...

 

what i use is -d and a standard input pipe :P

 

missed that -i option, will try it...

 

edit:

 

btw, i just took a look at that other patch aimed at the magic system (the one that enables you to select spells based on a menu added to the magic window) and i spotted that in fact the file posted was the entire content of spells.h and spells.c. pondering doing a copy and paste into seperate files and then doing a diff based on that. but what would the proper diff switch sequence be?

Share this post


Link to post
Share on other sites

Could be that I'm using patch 2.5, lol.

As for the diff switch sequence...I don't really know, since I have diff aliased as diff -Nur , and I just use diff w/files

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×