Results 1 to 10 of 10

Thread: Rotating HUDS

  1. #1
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts

    Rotating HUDS

    y'all talking about rotating huds etc. I wonder how to achieve this and somebody post an example of it?

  2. #2
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    Maybe I will not understand because of the language barrier), but could you tell more precisely in what sense "rotating"?
    To top of your feet?))

  3. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    No need to manually create a lot of rotated images anymore


    How-to (quick n dirty):
    - You need to have an image that already is in .iwi, preferably square (non-square images get stretched)
    - Name it something with exactly 15 letters.
    - Create a background for this image, same size as the image used above (also square). Give it a 9 char name.
    - Now for the tricky part. Find the material files called "hudstopwatch" and "hudstopwatchneedle" and rename the first one to whatever you like (12 chars though), and rename the second one to exactly the same name, but add "needle" to the end. (so a total of 18 chars)
    - Open up both files in some program like notepad++. Scroll to the end of the file, notice the hudstopwatchneedle and stopwatchneedle for the "hudstopwatchneedle" file.
    Replace the first of those references with the name of the material file (18 char, ending in needle) and the second with the name of the actual image file that has to be rotated (15 char).
    Do the same for the other material file, but remember to use the 12 and 9 char filenames here
    - Now put the images and the material files in the appropriate folders
    - Take a look at sd.gsc: see that both hudstopwatch and hudstopwatchneedle shaders are being precached.
    This means you have to precache both YOUR images too
    - Scroll to the following part in sd.gsc:
    Code:
    showPlayerBombTimer()
    {
    	timeleft = (level.bombtimer - (getTime() - level.bombtimerstart) / 1000);
    
    	if(timeleft > 0)
    	{
    		self.bombtimer = newClientHudElem(self);
    		self.bombtimer.x = 6;
    		self.bombtimer.y = 76;
    		self.bombtimer.horzAlign = "left";
    		self.bombtimer.vertAlign = "top";
    		self.bombtimer setClock(timeleft, level.bombtimer, "hudStopwatch", 48, 48);
    	}
    }
    The most important line here is:
    Code:
    		self.bombtimer setClock(timeleft, level.bombtimer, "hudStopwatch", 48, 48);
    Take a look at the appropriate reference for this function:
    http://www.zeroy.com/script/hud/setclock.htm
    If you set the full time really high and reset the clock every 0.05 seconds, you can control the angle your image is held under, or just give it a spin with a low total time and let it just go round.

    This opens up a LOT of possibilities for modders.

    PS: this write-up was done really quick, and should not be made a reference for future generations. If someone has some time to spare and feels like doing a rewrite: please feel free to do so.

    For all hungarian readers: if you do not understand a word i said above, please, feel free to NOT contact me about this. You wont understand me then either.

    For all dogs reading this: bark bark bark. Good dog
    quoting myself from modsonline.com
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  4. The Following User Says Thank You to IzNoGoD For This Useful Post:

    Loveboy (17th March 2019)

  5. #4
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    In COD4, they do a rotating hud element like this:

    PHP Code:
    {
        
    precacheShader"icon_0" );
        
    precacheShader"icon_1" );
        
    precacheShader"icon_2" );
        
    precacheShader"icon_3" );
        
    precacheShader"icon_4" );
        
    precacheShader"icon_5" );

    }

    {
            
    self.nuke_icon newClientHudElem(self);
            
    self.nuke_icon.143;
            
    self.nuke_icon.98;
            
    self.nuke_icon.alignx "center";
            
    self.nuke_icon.aligny "middle";
            
    self.nuke_icon.horzAlign "fullscreen";
            
    self.nuke_icon.vertAlign "fullscreen";
            
    self.nuke_icon.glowColor = (0.20.30.7);
            
    self.nuke_icon.glowAlpha 1;
            
    self.nuke_icon.alpha .9;
            
    self.nuke_icon.sort 100;
            
    self.nuke_icon.foreground true;
            
    self.nuke_icon thread rotatingNukeIcon(); 
    }

    rotatingNukeIcon()
    {
        
    self endon("death");
       
        
    iconNumber 0;
       
        for( ;; ) 
        {
            if( 
    isDefinedself ) )
                
    self setShader"icon_" iconNumber3232 );
           
            
    iconNumber++;
            
            if( 
    iconNumber iconNumber 0;
           
            
    wait0.08 );
        }

    So, your shader files are stages of an animation. A quick and easy way to create these is to do the first one in the animation, the very last one in the animation, then find a site that creates GIF files from your before and after images (these sites use a tween engine to interpolate all the between images from the first stage and the last stage). Then, open the gif in ImageReady and save each individual frame as a .DDS file. Create your materials and IWI files from these.

    FYI - doing animated images in the Q3 engine was easy. This is an animated flag waving:

    PHP Code:
    americanflag
    {
        
    nopicmip
        nomipmaps
        
    {
            
    AnimMap 10
            map gfx
    /flags/usa_1.tga
            map gfx
    /flags/usa_2.tga
            map gfx
    /flags/usa_3.tga
            map gfx
    /flags/usa_4.tga
            map gfx
    /flags/usa_5.tga
            map gfx
    /flags/usa_6.tga
            map gfx
    /flags/usa_7.tga
            map gfx
    /flags/usa_8.tga
            map gfx
    /flags/usa_9.tga
            map gfx
    /flags/usa_10.tga
            
            blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
            rgbGen vertex
       
    }

    Last edited by Tally; 31st October 2014 at 13:53.

  6. #5
    Private First Class php's Avatar
    Join Date
    Nov 2012
    Posts
    142
    Thanks
    28
    Thanked 116 Times in 59 Posts
    Or for Q3/CoD1 just use the SetClock or use a tcMod shader rotate.
    Last edited by php; 31st October 2014 at 15:19.

  7. #6
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by php View Post
    Or for Q3/CoD1 just use the SetClock or use a tcMod shader rotate.
    I think you've missed the wood for the trees.

  8. #7
    Private First Class php's Avatar
    Join Date
    Nov 2012
    Posts
    142
    Thanks
    28
    Thanked 116 Times in 59 Posts
    Quote Originally Posted by Tally View Post
    I think you've missed the wood for the trees.
    I think you've missed the tree for the forest.

  9. #8
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    I think i have no clue what you guys are trying to say...
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  10. #9
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by php View Post
    I think you've missed the tree for the forest.
    Not at all Pal. I was saying I wished it were easier to make animated shaders - whether rotating or waving or scrolling - in COD2 like it was in Q3. You came along and added details of how to do yet more rotating icons in Q3. Which was completely beside my point and not really relevant to the discussion.

  11. #10
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    in CoD1 you can just use hud.angle...
    look at the stock files in the bombermission (I dont remember the actual script name), the plane damage-icon in the compass is done this way, unfortunately they removed this feature
    in CoD2: you can also combine WINDOW_STYLE_DVAR_SHADER and changing cvars with image names, this way I did the mw2 icons in the hud
    Last edited by serthy; 31st October 2014 at 20:03.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •