Add fixes to ui menu by Ensiform and DevHC (#5062)

This commit is contained in:
Thilo Schulz 2011-07-07 16:12:53 +00:00
parent 74e538ffcf
commit 7666c2f54c
4 changed files with 50 additions and 23 deletions

View file

@ -492,6 +492,9 @@ typedef struct {
vec3_t flashDlightColor;
int muzzleFlashTime;
vec3_t color1;
byte c1RGBA[4];
// currently in use drawing parms
vec3_t viewAngles;
vec3_t moveAngles;

View file

@ -819,6 +819,12 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti
if ( pi->currentWeapon != WP_NONE ) {
memset( &gun, 0, sizeof(gun) );
gun.hModel = pi->weaponModel;
if( pi->currentWeapon == WP_RAILGUN ) {
Byte4Copy( pi->c1RGBA, gun.shaderRGBA );
}
else {
Byte4Copy( colorWhite, gun.shaderRGBA );
}
VectorCopy( origin, gun.lightingOrigin );
UI_PositionEntityOnTag( &gun, &torso, pi->torsoModel, "tag_weapon");
gun.renderfx = renderfx;
@ -857,6 +863,12 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti
if ( pi->flashModel ) {
memset( &flash, 0, sizeof(flash) );
flash.hModel = pi->flashModel;
if( pi->currentWeapon == WP_RAILGUN ) {
Byte4Copy( pi->c1RGBA, flash.shaderRGBA );
}
else {
Byte4Copy( colorWhite, flash.shaderRGBA );
}
VectorCopy( origin, flash.lightingOrigin );
UI_PositionEntityOnTag( &flash, &gun, pi->weaponModel, "tag_flash");
flash.renderfx = renderfx;
@ -1140,9 +1152,36 @@ UI_PlayerInfo_SetInfo
void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNumber, qboolean chat ) {
int currentAnim;
weapon_t weaponNum;
int c;
pi->chat = chat;
c = (int)trap_Cvar_VariableValue( "color1" );
VectorClear( pi->color1 );
if( c < 1 || c > 7 ) {
VectorSet( pi->color1, 1, 1, 1 );
}
else {
if( c & 1 ) {
pi->color1[2] = 1.0f;
}
if( c & 2 ) {
pi->color1[1] = 1.0f;
}
if( c & 4 ) {
pi->color1[0] = 1.0f;
}
}
pi->c1RGBA[0] = 255 * pi->color1[0];
pi->c1RGBA[1] = 255 * pi->color1[1];
pi->c1RGBA[2] = 255 * pi->color1[2];
pi->c1RGBA[3] = 255;
// view angles
VectorCopy( viewAngles, pi->viewAngles );

View file

@ -111,10 +111,6 @@ static void Preferences_Event( void* ptr, int notification ) {
switch( ((menucommon_s*)ptr)->id ) {
case ID_CROSSHAIR:
s_preferences.crosshair.curvalue++;
if( s_preferences.crosshair.curvalue == NUM_CROSSHAIRS ) {
s_preferences.crosshair.curvalue = 0;
}
trap_Cvar_SetValue( "cg_drawCrosshair", s_preferences.crosshair.curvalue );
break;
@ -252,7 +248,7 @@ static void Preferences_MenuInit( void ) {
s_preferences.framer.height = 334;
y = 144;
s_preferences.crosshair.generic.type = MTYPE_TEXT;
s_preferences.crosshair.generic.type = MTYPE_SPINCONTROL;
s_preferences.crosshair.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT|QMF_NODEFAULTINIT|QMF_OWNERDRAW;
s_preferences.crosshair.generic.x = PREFERENCES_X_POS;
s_preferences.crosshair.generic.y = y;
@ -264,6 +260,7 @@ static void Preferences_MenuInit( void ) {
s_preferences.crosshair.generic.bottom = y + 20;
s_preferences.crosshair.generic.left = PREFERENCES_X_POS - ( ( strlen(s_preferences.crosshair.generic.name) + 1 ) * SMALLCHAR_WIDTH );
s_preferences.crosshair.generic.right = PREFERENCES_X_POS + 48;
s_preferences.crosshair.numitems = NUM_CROSSHAIRS;
y += BIGCHAR_HEIGHT+2+4;
s_preferences.simpleitems.generic.type = MTYPE_RADIOBUTTON;

View file

@ -798,6 +798,8 @@ static sfxHandle_t SpinControl_Key( menulist_s *s, int key )
sound = 0;
switch (key)
{
case K_KP_RIGHTARROW:
case K_RIGHTARROW:
case K_MOUSE1:
s->curvalue++;
if (s->curvalue >= s->numitems)
@ -807,24 +809,10 @@ static sfxHandle_t SpinControl_Key( menulist_s *s, int key )
case K_KP_LEFTARROW:
case K_LEFTARROW:
if (s->curvalue > 0)
{
s->curvalue--;
sound = menu_move_sound;
}
else
sound = menu_buzz_sound;
break;
case K_KP_RIGHTARROW:
case K_RIGHTARROW:
if (s->curvalue < s->numitems-1)
{
s->curvalue++;
sound = menu_move_sound;
}
else
sound = menu_buzz_sound;
s->curvalue--;
if (s->curvalue < 0)
s->curvalue = s->numitems-1;
sound = menu_move_sound;
break;
}