UDM Posted August 20, 2006 Share Posted August 20, 2006 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!!!!!!!!! Link to comment Share on other sites More sharing options...
Griswald Posted August 20, 2006 Share Posted August 20, 2006 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: 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 Link to comment Share on other sites More sharing options...
ensiform Posted August 20, 2006 Share Posted August 20, 2006 you are gonna also eventually need to put this all in a pk3. Link to comment Share on other sites More sharing options...
UDM Posted August 20, 2006 Author Share Posted August 20, 2006 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? Link to comment Share on other sites More sharing options...
Griswald Posted August 20, 2006 Share Posted August 20, 2006 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) Link to comment Share on other sites More sharing options...
UDM Posted August 20, 2006 Author Share Posted August 20, 2006 Oh well Thanks anyway Griswald, you have really been a great help to me! Link to comment Share on other sites More sharing options...
Vruki Salet Posted August 21, 2006 Share Posted August 21, 2006 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? Link to comment Share on other sites More sharing options...
KMan Posted August 21, 2006 Share Posted August 21, 2006 can you use the 'clamp' option on those textures? then it won't try to repeat the texture past its edges. Link to comment Share on other sites More sharing options...
Griswald Posted August 21, 2006 Share Posted August 21, 2006 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. Link to comment Share on other sites More sharing options...
UDM Posted August 22, 2006 Author Share Posted August 22, 2006 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.