lfnetwork.com mark read register faq members calendar

Thread: Need help with HUD
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 08-20-2006, 12:05 PM   #1
UDM
 
Join Date: Mar 2003
Posts: 922
Need help with HUD

I'm working on a new HUD, and have made quite a number of changes to the UI files. However, when I go ingame, I get either black boxes or nothing at all

I'm not sure what's wrong with the code. For example, I only changed the rect syntax in this part of the code:

// Metal Frame
itemDef
{
name "frame"
forecolor 1 1 1 1
background "gfx/hud/hudleft"
rect 0 0 100 100 // (these positions are relative to the initial position of the menu)
// X pos, Y pos, char size, char height
}

I bolded the part which was changed.

The game, however, shows a big <censored> black box ingame! Funnily enough, some other itemDef's that I changed actually show up the intended tga! Eg this:

// Right Metal Frame
itemDef
{
name "frame"
forecolor 1 1 1 1
background "gfx/hud/hudright.tga"
rect 0 0 -100 100 // (these positions are relative to the initial position of the menu)
// X pos, Y pos, char size, char height
}

I'm really frustrated now. Spent a whole day trying to figure this out. I thouguht that the background syntax had to be linked directly to shader files, but even after experimenting with that, it still gave me a bloody black box. It's almost as if the game is being choosy, selectively showing what it wants to display

Please help!!!!!!!!!
UDM is offline   you may: quote & reply,
Old 08-20-2006, 12:48 PM   #2
Griswald
 
Join Date: Aug 2002
Location: ent->ps.get_loc();
Posts: 25
I myself am currently doing all the UI work to RKR (http://www.rkredemption.com), and have run into this many times.

The number one thing to remember, is that all tga files that are used in the HUD must be in powers of 2 for it's dimensions. ( 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 )

If said image is... say... 65x64 or anything not in a power 2, all you see ingame is the big black box.

Another thing to remember, is that the UI itself is only treated as 640x480, so anything larger then those will be ignored / not drawn (though, that dosen't appear to be the case here)

My only recommendation is check the width and height of your tga's, check that there's a proper shader entry for said graphics, and then you shouldn't have an issue.

An example of an image I added to the UI was a "flower" instead of the blue glow behind the text, but I wanted it to look good, and have it's own unique id, rather then "button_back" or whatever it was.

This image is /gfx/menus/menu_flower.tga and is 32x32 pixels. Now, not only do you have to have the entry in your UI code for it to appear, you need it in a shader file (I modded the ui.shader file located at /shaders/ui.shader), and here's what MY entry looks like:

Code:
gfx/menus/menu_flower
{
    {
        map gfx/menus/menu_flower
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
    }
}

Also, an invaluable resource to figuring out what does what would be to look at the following as well:
http://www.gamingforums.com/showthread.php?p=1078156


-- Griswald, RKR Project Co-Leader
Griswald is offline   you may: quote & reply,
Old 08-20-2006, 12:53 PM   #3
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
you are gonna also eventually need to put this all in a pk3.


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 08-20-2006, 01:41 PM   #4
UDM
 
Join Date: Mar 2003
Posts: 922
Thanks griswald now it works

Another issue:

http://img255.imageshack.us/img255/1667/shot0110id3.jpg

As you can see,t here's a little line of artifact which I have highlighted. It's not there in photoshop, but it's always there ingame, even if I try to copy n paste it into a new file. How do I get rid of it?
UDM is offline   you may: quote & reply,
Old 08-20-2006, 01:56 PM   #5
Griswald
 
Join Date: Aug 2002
Location: ent->ps.get_loc();
Posts: 25
While I can't be too sure about this, I'd say check the alpha layers of your TGA files involved. Perhaps they aren't setup properly? If thats not the issue, browse over the UI .menu file, and if that still dosen't solve it, since it's a HUD mod, check the cg_draw.c file in CGame (It contains all the health bar drawing, etc)


-- Griswald, RKR Project Co-Leader
Griswald is offline   you may: quote & reply,
Old 08-20-2006, 02:16 PM   #6
UDM
 
Join Date: Mar 2003
Posts: 922
Oh well

Thanks anyway Griswald, you have really been a great help to me!
UDM is offline   you may: quote & reply,
Old 08-21-2006, 12:58 PM   #7
Vruki Salet
Junior Member
 
Vruki Salet's Avatar
 
Join Date: Aug 2005
Location: Somewhere else entirely
Posts: 443
Quote:
Originally Posted by UDM
Thanks griswald now it works

Another issue:

http://img255.imageshack.us/img255/1667/shot0110id3.jpg

As you can see,t here's a little line of artifact which I have highlighted. It's not there in photoshop, but it's always there ingame, even if I try to copy n paste it into a new file. How do I get rid of it?
My guess is it's the left edge of the graphic showing up again to repeat to fill the space you allotted to the graphic in the code, like the way the bottom of a saber blade reappears at the tip to make that annoying little spot when you edit the blade graphic. Maybe you could make the box for your graphic a little narrower in the code? Or make the graphic a little wider? Or shave of a couple pixels from the left-hand side of the graphic?
Vruki Salet is offline   you may: quote & reply,
Old 08-21-2006, 04:53 PM   #8
KMan
The Wu Tang Master
 
KMan's Avatar
 
Join Date: May 2002
Location: Virginia
Posts: 840
LFN Staff Member 
can you use the 'clamp' option on those textures? then it won't try to repeat the texture past its edges.
KMan is offline   you may: quote & reply,
Old 08-21-2006, 05:05 PM   #9
Griswald
 
Join Date: Aug 2002
Location: ent->ps.get_loc();
Posts: 25
Depending on how you setup the UI code, it will "stretch" the image based on the coordinates you provide. It's definately not repeating the same image.

Here's an example from his code provided:
rect 0 0 100 100 // (these positions are relative to the initial position of the menu)

Let's do a breakdown of this. The first 0 represents the X value (which is 0 to 640), the top left of the screen is 0,0 (x,y). The second zero represents the Y (which is 0 to 480). The first 100 represents how far in width the image should be stretched, while the second 100 represents how far in height the image should be stretched. If you provide values less then the pixel details of the image, it gets shrunk... if you provide bigger values then the Width x Height of the image, then it gets stretched, not repeated.


-- Griswald, RKR Project Co-Leader
Griswald is offline   you may: quote & reply,
Old 08-22-2006, 12:01 AM   #10
UDM
 
Join Date: Mar 2003
Posts: 922
I also thought it was repetition at first, but after I tried changing the size of rect, naw it wasn't repetition

What I don't understand is, the right side of the hud uses an image with an outline that is created from the same psd that Plasma did. When I use the right hud ie. change 'background' value to hud/gfx/hudright.tga, it works fine, there's no additional line, but it persists with the left hud. I think the game has a personal vendetta against hudleft.tga or something

Argh I'm really pissed off. I need to take a break

-edit-

K I don't know how this solved the problem, but I just changed the background of the RGB channels to black, presto, artifact gone. Weird

But never mind that, I'm so happy now! Rejoice! w00t! Now I just need Razor to send me the dlls before we finish it up
UDM is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > JediKnight Series > Editing Central > JA Coding > Need help with HUD

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:40 PM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.