Merge branch 'feature/player-menu-update' into feature/menu-update

This commit is contained in:
Petr Bartos 2022-03-29 17:47:02 +02:00
commit c10f4b03fb
5 changed files with 968 additions and 23 deletions

View File

@ -378,6 +378,8 @@ static void PlayerModel_DrawPlayer( void *self )
}
UI_DrawPlayer( b->generic.x, b->generic.y, b->width, b->height, &s_playermodel.playerinfo, uis.realtime/2 );
UI_DrawString( 320, 460, "To change player name use the companion app.", UI_CENTER|UI_SMALLFONT, text_color_normal );
}
/*
@ -606,7 +608,7 @@ static void PlayerModel_MenuInit( void )
s_playermodel.playername.generic.type = MTYPE_PTEXT;
s_playermodel.playername.generic.flags = QMF_CENTER_JUSTIFY|QMF_INACTIVE;
s_playermodel.playername.generic.x = 320;
s_playermodel.playername.generic.y = 440;
s_playermodel.playername.generic.y = 430;
s_playermodel.playername.string = playername;
s_playermodel.playername.style = UI_CENTER;
s_playermodel.playername.color = text_color_normal;

View File

@ -108,7 +108,7 @@ PlayerSettings_DrawName
*/
static void PlayerSettings_DrawName( void *self ) {
menufield_s *f;
qboolean focus;
//qboolean focus;
int style;
char *txt;
char c;
@ -120,14 +120,14 @@ static void PlayerSettings_DrawName( void *self ) {
f = (menufield_s*)self;
basex = f->generic.x;
y = f->generic.y;
focus = (f->generic.parent->cursor == f->generic.menuPosition);
//focus = (f->generic.parent->cursor == f->generic.menuPosition);
style = UI_LEFT|UI_SMALLFONT;
color = text_color_normal;
if( focus ) {
style |= UI_PULSE;
color = text_color_highlight;
}
//if( focus ) {
// style |= UI_PULSE;
// color = text_color_highlight;
//}
UI_DrawProportionalString( basex, y, "Name", style, color );
@ -138,7 +138,8 @@ static void PlayerSettings_DrawName( void *self ) {
color = g_color_table[ColorIndex(COLOR_WHITE)];
x = basex;
while ( (c = *txt) != 0 ) {
if ( !focus && Q_IsColorString( txt ) ) {
//if ( !focus && Q_IsColorString( txt ) ) {
if ( Q_IsColorString( txt ) ) {
n = ColorIndex( *(txt+1) );
if( n == 0 ) {
n = 7;
@ -153,23 +154,24 @@ static void PlayerSettings_DrawName( void *self ) {
}
// draw cursor if we have focus
if( focus ) {
if ( trap_Key_GetOverstrikeMode() ) {
c = 11;
} else {
c = 10;
}
style &= ~UI_PULSE;
style |= UI_BLINK;
UI_DrawChar( basex + f->field.cursor * SMALLCHAR_WIDTH, y, c, style, color_white );
}
//if( focus ) {
// if ( trap_Key_GetOverstrikeMode() ) {
// c = 11;
// } else {
// c = 10;
// }
//
// style &= ~UI_PULSE;
// style |= UI_BLINK;
//
// UI_DrawChar( basex + f->field.cursor * SMALLCHAR_WIDTH, y, c, style, color_white );
//}
// draw at bottom also using proportional font
Q_strncpyz( name, f->field.buffer, sizeof(name) );
Q_CleanStr( name );
UI_DrawProportionalString( 320, 440, name, UI_CENTER|UI_BIGFONT, text_color_normal );
UI_DrawProportionalString( 320, 430, name, UI_CENTER|UI_BIGFONT, text_color_normal );
UI_DrawString( 320, 460, "To change player name use the companion app.", UI_CENTER|UI_SMALLFONT, text_color_normal );
}
@ -397,8 +399,10 @@ static void PlayerSettings_MenuInit( void ) {
s_playersettings.framer.height = 334;
y = 112;
s_playersettings.name.generic.type = MTYPE_FIELD;
s_playersettings.name.generic.flags = QMF_NODEFAULTINIT;
//s_playersettings.name.generic.type = MTYPE_FIELD;
//s_playersettings.name.generic.flags = QMF_NODEFAULTINIT;
s_playersettings.name.generic.type = MTYPE_BTEXT;
s_playersettings.name.generic.flags = QMF_INACTIVE;
s_playersettings.name.generic.ownerdraw = PlayerSettings_DrawName;
s_playersettings.name.field.widthInChars = MAX_NAMELENGTH;
s_playersettings.name.field.maxchars = MAX_NAMELENGTH;

View File

@ -0,0 +1,295 @@
#include "ui/menudef.h"
{
\\ SETUP MENU \\
menuDef {
name "ingame_player"
visible 0
fullscreen 0
outOfBoundsClick // this closes the window if it gets a click out of the rectangle
rect 125 30 290 170
focusColor 1 .75 0 1
style 1
border 1
onOpen { uiScript update "ui_GetName" }
onClose { uiScript update "ui_SetName" }
itemDef {
name window
rect 10 15 270 155
style 1
backcolor 0 .1 0 1
visible 1
decoration
}
// FRAME //
itemDef {
name window
rect 0 10 64 64
style 3
background "ui/assets/ingameleftcorner.tga"
visible 1
decoration
}
itemDef {
name window
rect 64 10 64 8
style 3
background "ui/assets/ingametop.tga"
visible 1
decoration
}
itemDef {
name window
rect 168 10 64 8
style 3
background "ui/assets/ingametop.tga"
visible 1
decoration
}
itemDef {
name window
rect 226 10 64 64
style 3
background "ui/assets/ingamerightcorner.tga"
visible 1
decoration
}
itemDef {
name window
rect 104 0 64 16
style 3
background "ui/assets/ingameconnection.tga"
visible 1
decoration
}
itemDef {
name window
rect 0 108 64 64
style 3
background "ui/assets/ingameleftcornerb.tga"
visible 1
decoration
}
itemDef {
name window
rect 226 108 64 64
style 3
background "ui/assets/ingamerightcornerb.tga"
visible 1
decoration
}
itemDef {
name window
rect 0 64 16 64
style 3
background "ui/assets/ingameleft.tga"
visible 1
decoration
}
itemDef {
name window
rect 274 64 16 64
style 3
background "ui/assets/ingameright.tga"
visible 1
decoration
}
itemDef {
name window
rect 64 164 64 8
style 3
background "ui/assets/ingamebottom.tga"
visible 1
decoration
}
itemDef {
name window
rect 128 164 98 8
style 3
background "ui/assets/ingamebottom.tga"
visible 1
decoration
}
itemDef {
name namefield
group "playersettinggroup"
type ITEM_TYPE_EDITFIELD
style 0
text "Name:"
cvar "ui_Name"
maxchars 26
rect 20 10 256 20
textalign ITEM_ALIGN_LEFT
textalignx 10
textaligny 18
textscale .23
outlinecolor 1 .5 .5 .5
backcolor 0 0 0 0
forecolor 1 1 1 1
border 0
bordercolor 0 0 0 0
visible 1
}
itemDef {
name other
group "playersettinggroup"
style 1
text "To change player name use the companion app."
rect 20 20 215 32
textalign ITEM_ALIGN_LEFT
textalignx 10
textaligny 21
textscale .2
forecolor .4 .4 .65 1
visible 1
decoration
}
itemDef {
name handicapfield
group "playersettinggroup"
style 0
text "Handicap:"
ownerdraw UI_HANDICAP
rect 20 40 256 20
textalign ITEM_ALIGN_LEFT
textalignx 10
textaligny 18
textscale .23
outlinecolor 1 .5 .5 .5
backcolor 0 0 0 0
forecolor 1 1 1 1
border 0
bordercolor 0 0 0 0
visible 1
}
itemDef {
name effectentry
group "playersettinggroup"
text "Effect:"
type 1
style 0
rect 20 58 256 20
textalign ITEM_ALIGN_LEFT
textalignx 10
textaligny 18
textscale .23
outlinecolor 1 .5 .5 .5
backcolor 0 0 0 0
forecolor 1 1 1 1
border 0
bordercolor 0 0 0 0
visible 1
decoration
mouseEnterText { setitemcolor effectentry forecolor 1 .75 0 1 ; setfocus effectfield ; show message_effect }
mouseExitText { setitemcolor playersettinggroup forecolor 1 1 1 1 ; hide message_effect }
}
itemDef {
name effectfield
group "playersettinggroup"
style 0
ownerdraw UI_EFFECTS
rect 20 58 256 20
textalign ITEM_ALIGN_LEFT
textalignx 50
textaligny 25
outlinecolor 1 .5 .5 .5
backcolor 0 0 0 0
forecolor 1 1 1 1
border 0
bordercolor 0 0 0 0
visible 1
}
itemDef {
name effectfield
group "playersettinggroup"
type ITEM_TYPE_SLIDER
text "1st-Person Body Scale:"
cvarfloat "cg_firstPersonBodyScale" 0.2 0 1
rect 20 80 256 20
textstyle 6
textalign ITEM_ALIGN_LEFT
textalignx 10
textaligny 16
textscale .23
outlinecolor 1 .5 .5 .5
backcolor 0 0 0 0
forecolor 1 1 1 1
border 0
bordercolor 0 0 0 0
visible 1
}
itemDef {
name headlist
rect 15 100 260 50
type ITEM_TYPE_LISTBOX
style WINDOW_STYLE_FILLED
elementwidth 32
elementheight 32
elementtype LISTBOX_IMAGE
feeder FEEDER_HEADS
horizontalscroll
backcolor 0 0 0 1
border 1
bordercolor .5 .5 .5 1
forecolor 1 1 1 1
visible 1
cvarTest "g_gametype"
showCvar { "3" ; "4" ; "5" ; "6" ; "7" ; "8" }
mouseenter { setitemcolor headlist bordercolor 1 0 0 1 }
mouseexit { setitemcolor headlist bordercolor .5 .5 .5 1 }
}
itemDef {
name headlist
rect 15 100 260 50
type ITEM_TYPE_LISTBOX
style WINDOW_STYLE_FILLED
elementwidth 32
elementheight 32
elementtype LISTBOX_IMAGE
feeder FEEDER_Q3HEADS
horizontalscroll
backcolor 0 0 0 1
border 1
bordercolor .5 .5 .5 1
forecolor 1 1 1 1
visible 1
cvarTest "g_gametype"
showCvar { "0" ; "1" }
mouseenter { setitemcolor headlist bordercolor 1 0 0 1 }
mouseexit { setitemcolor headlist bordercolor .5 .5 .5 1 }
}
}
}

View File

@ -0,0 +1,644 @@
#include "ui/menudef.h"
{
\\ PLATER SELECTION MENU \\
menuDef {
name "player_menu"
visible 0
fullscreen 1
rect 0 0 640 480
background "menuback_a"
style 1
focusColor 1 .75 0 1
onOpen { play "sound/misc/kcswish.wav" ;
playlooped "music/fla_mp03.wav" ;
setitemcolor fadebox backcolor 0 0 0 1 ;
fadeout fadebox ;
uiScript update "ui_GetName" ;
transition menuback_g 0 0 640 480 195 120 255 202 20 10 ;
transition clancinematic 107 82 426 316 238 153 170 133 20 10 ;
hide back_alt ;
show back ;
hide grpmessage }
onClose { uiScript update "ui_SetName" }
onEsc { close player_menu ; open main }
itemDef {
name gametypebar
style 2
rect 0 5 640 40
textscale 0.4
textalign 0 // center
textalignx 60 // x alignment point for text
// use it to offset left/right text from the edge
// or to center the text on a different point
textaligny 21
style 2
border 4
bordercolor 0.5 0.5 0.5 0.5
bordersize 2
backcolor 0 0 .75 .5
visible 1
decoration
mouseEnter { setcolor backcolor .75 0 0 .5 }
mouseExit { setcolor backcolor 0 0 .75 .5 }
}
itemDef {
name arenatype
type ITEM_TYPE_MULTI
cvar "ui_q3model"
cvarFloatList { "Team Arena" 0 "Quake III" 1 }
text "Model Type:"
textstyle 6
rect 0 10 320 31
textalign ITEM_ALIGN_LEFT
textalignx 20
textaligny 26
textscale .35
forecolor 1 1 1 1
visible 1
mouseEnter { show message_type }
mouseExit { hide message_type }
action { play "sound/misc/kcaction.wav" }
}
itemDef {
name quakeimage
style WINDOW_STYLE_SHADER
group grpquaketype
cvarTest "ui_q3model"
showCVar { "1" }
background "ui/assets/playerpatriot.tga"
rect 60 24 128 256
forecolor .25 .25 .25 1
decoration
}
itemDef {
name quakeimage
group grpquaketype
cvarTest "ui_q3model"
showCVar { "1" }
style WINDOW_STYLE_SHADER
background "ui/assets/playerpi.tga"
rect 100 24 128 256
visible 1
decoration
}
itemDef {
name quakeimage
group grpquaketype
cvarTest "ui_q3model"
showCVar { "1" }
style WINDOW_STYLE_SHADER
background "ui/assets/playerklesk.tga"
rect 440 24 128 256
forecolor .5 .5 .5 1
visible 1
decoration
}
itemDef {
name quakeimage
group grpquaketype
cvarTest "ui_q3model"
showCVar { "1" }
style WINDOW_STYLE_SHADER
background "ui/assets/playerbiker.tga"
rect 384 24 128 256
visible 1
decoration
}
itemDef {
name clanlogo1
style WINDOW_STYLE_SHADER
group grparenatype
cvarTest "ui_q3model"
showCVar { "0" }
background "ui/assets/pagans.tga"
rect 0 150 128 128
forecolor .5 .5 .5 .25
visible 1
decoration
}
itemDef {
name clanlogo1
group grparenatype
cvarTest "ui_q3model"
showCVar { "0" }
style WINDOW_STYLE_SHADER
background "ui/assets/crusaders.tga"
rect 128 150 128 128
forecolor .5 .5 .5 .25
visible 1
decoration
}
itemDef {
name clanlogo1
group grparenatype
cvarTest "ui_q3model"
showCVar { "0" }
style WINDOW_STYLE_SHADER
background "ui/assets/stroggs.tga"
rect 384 150 128 128
forecolor .5 .5 .5 .25
visible 1
decoration
}
itemDef {
name clanlogo1
group grparenatype
cvarTest "ui_q3model"
showCVar { "0" }
style WINDOW_STYLE_SHADER
background "ui/assets/intruders.tga"
rect 512 150 128 128
forecolor .5 .5 .5 .25
visible 1
decoration
}
itemDef {
name window
style WINDOW_STYLE_FILLED
rect 238 153 170 133
forecolor 0 0 0 1
backcolor 0 0 0 1
visible 1
decoration
}
itemDef {
name playerbar
style 2
rect 0 130 640 170
backcolor 0 0 .75 0
forecolor 1 1 1 1
border 4
bordercolor 0.5 0.5 0.5 .75
bordersize 2
visible 1
decoration
}
itemDef {
name window
rect 10 50 620 60
style WINDOW_STYLE_EMPTY
border 1
bordercolor .5 .5 .5 .5
forecolor 1 1 1 1
backcolor 0 0 0 0
visible 1
decoration
}
itemDef {
name window
rect 10 112 205 216
style WINDOW_STYLE_EMPTY
border 1
bordercolor .5 .5 .5 .5
forecolor 1 1 1 1
backcolor 0 0 0 0
visible 1
decoration
}
itemDef {
name window
rect 217 112 205 216
style WINDOW_STYLE_EMPTY
border 1
bordercolor .5 .5 .5 .5
forecolor 1 1 1 1
backcolor 0 0 0 0
visible 1
decoration
}
itemDef {
name window
rect 424 112 206 216
style WINDOW_STYLE_EMPTY
border 1
bordercolor .5 .5 .5 .5
forecolor 1 1 1 1
backcolor 0 0 0 0
visible 1
decoration
}
itemDef {
name modelselection
ownerdraw UI_PLAYERMODEL
rect 424 80 260 260
style 1
decoration
visible 1
}
itemDef {
name namefield
group "playersettinggroup"
type ITEM_TYPE_EDITFIELD
style 0
text "Name:"
cvar "ui_Name"
textstyle 6
maxChars 32
rect 0 60 215 32
textalign ITEM_ALIGN_LEFT
textalignx 20
textaligny 21
textscale .333
outlinecolor 1 .5 .5 .5
backcolor 0 0 0 0
forecolor 1 1 1 1
border 0
bordercolor 0 0 0 0
visible 1
// mouseEnter { show message_name }
// mouseExit { hide message_name }
}
itemDef {
name other
group grpSystem
style 1
text "To change player name use the companion app."
rect 0 80 215 32
textalign ITEM_ALIGN_LEFT
textalignx 20
textaligny 21
textscale .25
forecolor .4 .4 .65 1
visible 1
decoration
}
itemDef {
name handicapfield
group "playersettinggroup"
style 0
text "Handicap:"
ownerdraw UI_HANDICAP
textstyle 6
rect 0 175 215 32
textalign ITEM_ALIGN_LEFT
textalignx 20
textaligny 21
textscale .333
outlinecolor 1 .5 .5 .5
backcolor 0 0 0 0
forecolor 1 1 1 1
border 0
bordercolor 0 0 0 0
visible 1
mouseEnter { show message_handicap }
mouseExit { hide message_handicap }
}
itemDef {
name effectfield
group "playersettinggroup"
style 0
text "Effect:"
ownerdraw UI_EFFECTS
rect 0 205 215 32
textstyle 6
textalign ITEM_ALIGN_LEFT
textalignx 20
textaligny 21
textscale .333
outlinecolor 1 .5 .5 .5
backcolor 0 0 0 0
forecolor 1 1 1 1
border 0
bordercolor 0 0 0 0
visible 1
mouseEnter { show message_effect }
mouseExit { hide message_effect }
}
itemDef {
name clanfield
group grparenatype
ownerdraw UI_CLANNAME
text "Clan:"
textstyle 6
rect 20 235 215 31
textalign ITEM_ALIGN_LEFT
textalignx 0
textaligny 21
textscale .333
forecolor 1 1 1 1
cvarTest "ui_q3model"
showCVar { "0" }
visible 1
action { play "sound/misc/nomenu.wav" }
mouseEnter { show message_clan }
mouseExit { hide message_clan }
}
itemDef {
name effectfield
group "playersettinggroup"
type ITEM_TYPE_SLIDER
text "1st-Person Body Scale:"
cvarfloat "cg_firstPersonBodyScale" 0.2 0 1
rect 0 310 250 20
textstyle 6
textalign ITEM_ALIGN_LEFT
textalignx 20
textaligny 16
textscale .333
outlinecolor 1 .5 .5 .5
backcolor 0 0 0 0
forecolor 1 1 1 1
border 0
bordercolor 0 0 0 0
visible 1
}
itemDef {
name headlist
rect 10 340 620 80
group grparenatype
cvarTest "ui_q3model"
hideCvar { "1" }
type ITEM_TYPE_LISTBOX
style WINDOW_STYLE_FILLED
elementwidth 61.75
elementheight 61.75
elementtype LISTBOX_IMAGE
feeder FEEDER_HEADS
horizontalscroll
border 1
bordersize 1
backcolor 0 0 0 .25
bordercolor .5 .5 .5 .5
forecolor 1 1 1 1
visible 1
mouseenter { setitemcolor headlist bordercolor .7 0 0 1 ; show message_model }
mouseexit { setitemcolor headlist bordercolor .5 .5 .5 .5 ; hide message_model }
}
itemDef {
name headlist
rect 10 330 620 80
group grpquaketype
cvarTest "ui_q3model"
showCVar { "1" }
type ITEM_TYPE_LISTBOX
style WINDOW_STYLE_FILLED
elementwidth 61.75
elementheight 61.75
elementtype LISTBOX_IMAGE
feeder FEEDER_Q3HEADS
horizontalscroll
border 1
bordersize 1
backcolor 0 0 0 .25
bordercolor .5 .5 .5 .5
forecolor 1 1 1 1
visible 1
mouseenter { setitemcolor headlist bordercolor .7 0 0 1 ; show message_model }
mouseexit { setitemcolor headlist bordercolor .5 .5 .5 .5 ; hide message_model}
}
// BACK BAR //
itemDef {
name gotobar
style 2
rect 0 430 640 30
textscale 0.4
textalign 0 // center
textalignx 60 // x alignment point for text
// use it to offset left/right text from the edge
// or to center the text on a different point
textaligny 21
style 2
border 4
bordercolor 0.5 0.5 0.5 0.5
bordersize 2
backcolor 0 0 .75 0.5
visible 1
mouseEnter { setcolor backcolor .75 0 0 .5 }
mouseExit { setcolor backcolor 0 0 .75 .5 }
decoration
}
itemDef {
name back
style 3
background "ui/assets/backarrow.tga"
rect 16 424 50 50
visible 1
action { close player_menu ; open main }
mouseEnter { hide back ; show back_alt ; show message_back }
}
itemDef {
name back_alt
style WINDOW_STYLE_SHADER
background "ui/assets/backarrow_alt.tga"
rect 14 422 54 54
backcolor 0 0 0 0
forecolor 1 1 1 1
visible 0
type ITEM_TYPE_BUTTON
mouseExit { hide back_alt ; show back ; hide message_back }
action { close player_menu ; open main }
}
// MESSAGES //
itemDef {
name message_back
group grpmessage
style 0
rect 320 430 128 30
textstyle 1
textalign 1
textalignx 0
textaligny 25
textscale .416
text "Return to Main Menu"
forecolor 1 1 1 1
decoration
visible 0
}
itemDef {
name message_name
group grpmessage
style 0
rect 320 430 128 30
textalign 1
textstyle 1
textalignx 0
textaligny 25
textscale .416
text "Enter Player Name"
forecolor 1 1 1 1
decoration
visible 0
}
itemDef {
name message_handicap
group grpmessage
style 0
rect 320 430 128 30
textalign 1
textstyle 1
textalignx 0
textaligny 25
textscale .416
text "Click to Change Handicap"
forecolor 1 1 1 1
decoration
visible 0
}
itemDef {
name message_effect
group grpmessage
style 0
rect 320 430 128 30
textalign 1
textstyle 1
textalignx 0
textaligny 25
textscale .416
text "Select Bar to Change Effect Color"
forecolor 1 1 1 1
decoration
visible 0
}
itemDef {
name message_clan
group grpmessage
style 0
rect 320 430 128 30
textalign 1
textstyle 1
textalignx 0
textaligny 25
textscale .416
text "Click to Cycle Clan Selection"
forecolor 1 1 1 1
decoration
visible 0
}
itemDef {
name message_type
group grpmessage
style 0
rect 320 430 128 30
textalign 1
textstyle 1
textalignx 0
textaligny 25
textscale .416
text "Click to View Team Arena or Quake III Models"
forecolor 1 1 1 1
decoration
visible 0
}
itemDef {
name message_model
group grpmessage
style 0
rect 320 430 128 30
textalign 1
textstyle 1
textalignx 0
textaligny 25
textscale .416
text "Click to Change Player Model"
forecolor 1 1 1 1
decoration
visible 0
}
itemDef {
name clancinematic
rect 238 157 170 133
group grparenatype
cvarTest "ui_q3model"
showCVar { "0" }
ownerdraw UI_CLANCINEMATIC
visible 1
decoration
}
itemDef {
name clancinematic
group grpquaketype
cvarTest "ui_q3model"
showCVar { "1" }
style 3
background "ui/assets/q3imagepage.tga"
rect 238 157 170 133
visible 1
decoration
}
itemDef {
name clancinematic
style 3
background "menuscreen"
rect 238 153 170 133
visible 1
decoration
}
itemDef {
name menuback_g
style WINDOW_STYLE_SHADER
rect 195 120 255 202
background "menuback_g"
visible 1
decoration
}
itemDef {
name fadebox
style WINDOW_STYLE_FILLED
background "ui/assets/fadebox.tga"
forecolor 0 0 0 1
backcolor 0 0 0 1
rect 0 0 640 480
visible 1
decoration
}
}
}