Quake3World.com Forums
     Programming Discussion
        Questions and troubles about quake 3 source


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Questions and troubles about quake 3 source

Grunt
Grunt

Joined: 13 May 2012
Posts: 73
PostPosted: 06-19-2012 02:19 PM           Profile Send private message  E-mail  Edit post Reply with quote


Hi all, again.
Today i tried to make some order in my mods, but i get a silly respond from my build.

here are some questions:
1. There's a max length limit (in number of words) for my cg_ex_newstatusbar for example) shaders?

catch here where i did wrong because
the compiled one seems don't recognize the shader and don't apply alpha:

on cg_draw
Code:
/*
================
CG_DrawTeamBackground

================
*/
void CG_DrawTeamBackground( int x, int y, int w, int h, float alpha, int team )
{
   vec4_t      hcolor;

   hcolor[3] = alpha;
   
   if (cg_modernHUD.integer <= 0) {
      if ( team == TEAM_RED ) {
         hcolor[0] = 1;
         hcolor[1] = 0;
         hcolor[2] = 0;
      
         trap_R_SetColor( hcolor );
         CG_DrawPic( x, y, w, h, cgs.media.teamStatusBar );
         trap_R_SetColor( NULL );
         }
      else if ( team == TEAM_BLUE ) {
         hcolor[0] = 0;
         hcolor[1] = 0;
         hcolor[2] = 1;
      
         trap_R_SetColor( hcolor );
         CG_DrawPic( x, y, w, h, cgs.media.teamStatusBar );
         trap_R_SetColor( NULL );
         }
      else if ( team == TEAM_FREE ) {
         hcolor[0] = 1;
         hcolor[1] = 1;
         hcolor[2] = 1;
         hcolor[3] = 0.1;
      
         trap_R_SetColor( hcolor );
         CG_DrawPic( x, y, w, h, cgs.media.OldStatusBar );
         trap_R_SetColor( NULL );
         }
   if (cg_modernHUD.integer >= 1) {
      if ( team == TEAM_RED ) {
         hcolor[0] = 0.9;
         hcolor[1] = 0.8;
         hcolor[2] = 0.8;
      
         trap_R_SetColor( hcolor );
         CG_DrawPic( x, y, w, h, cgs.media.NewStatusBar );
         trap_R_SetColor( NULL );
         }
      else if ( team == TEAM_BLUE ) {
         hcolor[0] = 0.8;
         hcolor[1] = 0.8;
         hcolor[2] = 0.9;
      
         trap_R_SetColor( hcolor );
         CG_DrawPic( x, y, w, h, cgs.media.NewStatusBar );
         trap_R_SetColor( NULL );
         }
      else if ( team == TEAM_FREE ) {
         hcolor[0] = 1;
         hcolor[1] = 1;
         hcolor[2] = 1;
      
         trap_R_SetColor( hcolor );
         CG_DrawPic( x, y, w, h, cgs.media.NewStatusBar );
         trap_R_SetColor( NULL );
         }

      }
   }
}


on cg_local i add
Code:
   qhandle_t   NewStatusBar;
   qhandle_t   OldStatusBar;


on cg_main
Code:
   cgs.media.NewStatusBar = trap_R_RegisterShaderNoMip( "Ex/NewStatusBar.tga" );
   cgs.media.OldStatusBar = trap_R_RegisterShaderNoMip( "Ex/OldStatusBar.tga" );


on scripts i make a Ex.shader
Code:
Ex/Ex_OldStatusBar
{
   nopicmip
   {
      map Ex/OldStatusBar.tga
      blendfunc blend
   }
}

Ex/Ex_NewStatusBar
{
   nopicmip
   {
      map Ex/NewStatusBar.tga
      blendfunc blend
   }
}


is the code in cg_draw incorrect?

PURPOSE:
i added a shader for FFA modality in standard quake 3: client will see an little -alpha black bar when they play ffa or other gametypes withouts team
WHAT I SEE:
total black bar

PURPOSE:
when cg_modernHUD equals to 1 or more i will see a different shader for my statusbar, different positions etc...
WHAT I SEE:
nothing...like if the team variable is empty and the game doesn't draw anything...
can see all but my statusbar shader doesn't happear




Top
                 

Grunt
Grunt

Joined: 13 May 2012
Posts: 73
PostPosted: 06-20-2012 04:54 AM           Profile Send private message  E-mail  Edit post Reply with quote


fixed creating a new cg_drawteambackground2
(also because original cg_drawteambackground is used also for scoreboard background)

but still can't fix the alpha channel and set the transparency

using the same scheme
void CG_DrawTeamBackground2( int x, int y, int w, int h, float alpha, int team )
the call istruction's:
Code:
CG_DrawTeamBackground2( 0, 420, 640, 60, 0.10f, cg.snap->ps.persistant[PERS_TEAM] );


0.10f 's the float variable about alpha but nothing happends: i can set also to 1 or every kind of number but i still get no trasparency at all.
what i did wrong?

the shader's "oldstatusbar" have only nopicmip and blendfunc blend.
maybe the game doesn't recognize it like a shader and draw just a picture?

cgs.media.OldStatusBar = trap_R_RegisterShaderNoMip( "Ex/OldStatusBar.tga" );




Top
                 

Grunt
Grunt

Joined: 13 May 2012
Posts: 73
PostPosted: 06-21-2012 11:28 AM           Profile Send private message  E-mail  Edit post Reply with quote


oh my gosh....if i erase the shader file it works in proper way.




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group