Jump to content
The Dark Mod Forums

Problem with images in menus


joebarnin

Recommended Posts

On the purchase screen (when starting a mission), I'm trying to get an image to display when the user hovers over the name of an item to purchase. As an example, there's a file \guis\assets\purchase_menu\broadhead_image.tga. So I have a windowdef called hoverImage, and if I do this:

 

set "hoverImage::background" "guis/assets/purchase_menu/broadhead_image.tga"

 

The image displays, but without background transparancy, so there's a big white background. Interestingly, if I just say:

 

set "hoverImage::background" "guis/assets/purchase_menu/broadhead";

 

it looks great. So, doom automagically knows to look for a "_image.tga" suffix, and support image transparency? Weird. So I went with that. I want this to be dynamic, so I need to do something like this:

 

set "hoverImage::background" "gui::forSale0_image"

 

where the "forSale0_image" variable is set in the shop.cpp code, depending on what's for sale. Unfortunately, when I do it this way, and try to use the filename without "_image.tga", doom reports an error: "Couldn't load image: guis/assets/purchase_menu/broadhead". If I include the "_image.tga" in the variable value, the image is found, but as before it has the white background.

 

Can anyone cast any light on this?

Link to comment
Share on other sites

There's two different ways to call images in a .gui. You can either point directly to the image file (by putting the .tga extension at the end) or you can point to a material shader. If you point directly to the image, you can't use any special effects (which is why the broadhead image shows up as white). The "_image" part is not necessary, it just happens to be part of the name of those .tga files.

 

For the images for the purchase menu, I used a material shader that allows the objects to be transparent and fade into the parchment. I've only done that for two test images so far, however, since at the time the code didn't allow the image to be called dynamically.

 

The current shaders are guis/assets/purchase_menu/lantern and guis/assets/purchase_menu/lockpicks.

 

set "hoverImage::background" "gui::forSale0_image"

 

where the "forSale0_image" variable is set in the shop.cpp code, depending on what's for sale. Unfortunately, when I do it this way, and try to use the filename without "_image.tga", doom reports an error: "Couldn't load image: guis/assets/purchase_menu/broadhead". If I include the "_image.tga" in the variable value, the image is found, but as before it has the white background.

 

When the .tga is not provided, D3 looks for a material shader of that name (and won't find one atm), so that's why you get the "couldn't load" error.

 

If you tell me what names you've used in the shop.cpp code, I can make the shaders and images to match.

Link to comment
Share on other sites

This makes sense now, thank you.

 

The name of the image for each shop item is specified in tdm_shopitems.def. Each entityDef has an "image" field. All we need is for the name of the shader to match the name in this field. Right now, many of the "image" fields in this file are unspecified and some are specified incorrectly. So you can just create the shaders and images with any reasonable set of names, and I will modify tdm_shopitems.def to match. (I'll be checking in the code changes in support of this later today).

 

Springheel, while I've got your attention, I'd like to get the New Mission and Objectives screens beyond the "work in progress" phase. Can you provide the background images for these pages? The New Mission screen needs room for a) displaying the name of the currently-installed mission, B) a Start button, c) a list of FMs (including a More button for paging down and an "Install FM" button), and d) a Main Menu button. Pretty much just what the curernt mock-up page has. If you supply the background image, I can do the GUI and code work to match. The Objectives page currently just uses the default background. Again, if you can supply a background with room for the set of items that are displayed now, I'll do the rest. No hurry if there are other items on your to-do list; just letting you know I'm ready when you are.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...