A new Team Select menu

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

A new Team Select menu

Postby Spaceman » Sat Jul 12, 2008 12:03 am

ImageImage
A heavily modified Team Select menu next to the default version from 2.4

Whilst learning how to make a new menu for the Shaggy Selector I changed the Team Select menu and added a few extra buttons to it.

Eventually, I ended up with the menu above, it has buttons on it for my most used commands. Like the Shaggy Selector buttons, they can be hidden or resized and their colours, labels and actions altered.

Get the diff's here http://217.16.115.15/~blub/nexfiles/?page=file&file=cedfc8997abf5fa9698624aee025b9ee or use the code below.

You need to change the dialog_teamselect.c code to
Code: Select all
#ifdef INTERFACE
CLASS(NexuizTeamSelectDialog) EXTENDS(NexuizRootDialog)
   METHOD(NexuizTeamSelectDialog, fill, void(entity))
   METHOD(NexuizTeamSelectDialog, showNotify, void(entity))
   ATTRIB(NexuizTeamSelectDialog, title, string, "Team Select +")
   ATTRIB(NexuizTeamSelectDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
   ATTRIB(NexuizTeamSelectDialog, intendedWidth, float, 0.4)
   ATTRIB(NexuizTeamSelectDialog, rows, float, 9)
   ATTRIB(NexuizTeamSelectDialog, columns, float, 6)
   ATTRIB(NexuizTeamSelectDialog, name, string, "TeamSelect")
   ATTRIB(NexuizTeamSelectDialog, team1, entity, NULL)
   ATTRIB(NexuizTeamSelectDialog, team2, entity, NULL)
   ATTRIB(NexuizTeamSelectDialog, team3, entity, NULL)
   ATTRIB(NexuizTeamSelectDialog, team4, entity, NULL)
ENDCLASS(NexuizTeamSelectDialog)
float mtb_width(string);
string mtb_label(string);
vector mtb_colour(string);
string mtb_action(string);
#endif

#ifdef IMPLEMENTATION
entity makeTeamButton(string theName, vector theColor, string commandtheName)
{
   entity b;
   b = makeNexuizCommandButton(theName, theColor, commandtheName, 1);
   return b;
}

void showNotifyNexuizTeamSelectDialog(entity me)
{
   float teams;
   teams = cvar("_teams_available");

   me.team1.disabled = !(teams & 1);
   me.team2.disabled = !(teams & 2);
   me.team3.disabled = !(teams & 4);
   me.team4.disabled = !(teams & 8);
}

void fillNexuizTeamSelectDialog(entity me)
{
   me.TR(me);
      me.TD(me, 1, 4, makeTeamButton(strzone(cvar_string("ts_Auto")), '0 1 0', "cmd selectteam auto; cmd join"));
      me.TD(me, 1, 2, makeTeamButton(strzone(cvar_string("ts_Spectate")), '0 0 0', "cmd spectate"));
   me.TR(me);

   me.TR(me);
      me.TD(me, 2, 1.5, me.team1 = makeTeamButton(strzone(cvar_string("ts_Red")), '1 0.5 0.5', "cmd selectteam red; cmd join"));
      me.TD(me, 2, 1.5, me.team2 = makeTeamButton(strzone(cvar_string("ts_Blue")), '0.5 0.5 1', "cmd selectteam blue; cmd join"));
      me.TD(me, 2, 1.5, me.team3 = makeTeamButton(strzone(cvar_string("ts_Yellow")), '1 1 0.5', "cmd selectteam yellow; cmd join"));
      me.TD(me, 2, 1.5, me.team4 = makeTeamButton(strzone(cvar_string("ts_Pink")), '1 0.5 1', "cmd selectteam pink; cmd join"));
   me.TR(me);
   me.TR(me);

   me.TR(me);  // row 0
      if (mtb_width("0") > 0)
         me.TD(me, 1, mtb_width("0"), makeTeamButton(mtb_label("0"), mtb_colour("0"), mtb_action("0")));

      if (mtb_width("1") > 0)
         me.TD(me, 1, mtb_width("1"), makeTeamButton(mtb_label("1"), mtb_colour("1"), mtb_action("1")));

   me.TR(me);  // row 1
      if (mtb_width("2") > 0)
         me.TD(me, 1, mtb_width("2"), makeTeamButton(mtb_label("2"), mtb_colour("2"), mtb_action("2")));

      if (mtb_width("3") > 0)
         me.TD(me, 1, mtb_width("3"), makeTeamButton(mtb_label("3"), mtb_colour("3"), mtb_action("3")));

   me.TR(me);  // row 2
      if (mtb_width("4") > 0)
         me.TD(me, 1, mtb_width("4"), makeTeamButton(mtb_label("4"), mtb_colour("4"), mtb_action("4")));

      if (mtb_width("5") > 0)
         me.TD(me, 1, mtb_width("5"), makeTeamButton(mtb_label("5"), mtb_colour("5"), mtb_action("5")));

   me.TR(me);  // row 3
      if (mtb_width("6") > 0)
         me.TD(me, 1, mtb_width("6"), makeTeamButton(mtb_label("6"), mtb_colour("6"), mtb_action("6")));

      if (mtb_width("7") > 0)
         me.TD(me, 1, mtb_width("7"), makeTeamButton(mtb_label("7"), mtb_colour("7"), mtb_action("7")));
}

float mtb_width(string btn)
{
   return cvar(strcat("ts_width", btn));
}

string mtb_label(string btn)
{
   return strzone(cvar_string((strcat("ts_label", btn))));
}

vector mtb_colour(string btn)
{
   return stov(cvar_string(strcat("ts_colour", btn)));
}

string mtb_action(string btn)
{
   return strzone(cvar_string((strcat("ts_action", btn))));
}
#endif

// click. The C-word so you can grep for it.


Add menu.cfg to ./.nexuiz/data with the following in it
Code: Select all
//team select +

// note there is a French translation by Ronan at the end
// simply uncomment it


// English
set ts_Auto "Auto"
set ts_Spectate "Spectate"

set ts_Red "Red"
set ts_Blue "Blue"
set ts_Yellow "Yellow"
set ts_Pink "Pink"

//row 0
set ts_width0 3.0
set ts_label0 "Chase camera"
set ts_action0 "toggle chase_active"
set ts_colour0 "0.8 0.4 0.1"

set ts_width1 3.0
set ts_label1 "Open the console"
set ts_action1 "toggleconsole"
set ts_colour1 "0.5 0 0.6"

//row 1
set ts_width2 3.0
set ts_label2 "Change HUD"
set ts_action2 "toggle sbar_hudselector"
set ts_colour2 "0.9 0 0.9"

set ts_width3 3.0
set ts_label3 "Show FPS"
set ts_action3 "toggle showfps"
set ts_colour3 "0.1 0.5 0.9"

//row 2
set ts_width4 3.0
set ts_label4 "Show your weapon"
set ts_action4 "toggle r_drawviewmodel"
set ts_colour4 "0.6 0.9 0.9"

set ts_width5 3.0
set ts_label5 "Flip the screen"
set ts_action5 "toggle v_flipped"
set ts_colour5 "1 0.3 0.5"

//row 3
set ts_width6 3.0
set ts_label6 "End match"
set ts_action6 "vcall endmatch"
set ts_colour6 "0.2 0.5 0.1"

set ts_width7 3.0
set ts_label7 "Extend match"
set ts_action7 "vcall extendmatchtime"
set ts_colour7 "0.9 0.4 0.1"

// French translation thanks to Ronan
// set ts_Auto "Auto"
// set ts_Spectate "Spectateur"

// set ts_Red "Rouge"
// set ts_Blue "Bleu"
// set ts_Yellow "Jaune"
// set ts_Pink "Rose"

// set ts_label0 "Changer la vue"
// set ts_label1 "Ouvrir la console"
// set ts_label2 "Changer de HUD"
// set ts_label3 "Afficher les FPS"
// set ts_label4 "Afficher l'arme"
// set ts_label5 "Inverser l'ecran"
// set ts_label6 "Terminer la partie"
// set ts_label7 "Etendre la partie"


And finally add exec menu.cfg to your autoexec.cfg

Image
With lots of help from Ronan, a French version of the Team Select menu.

To enable it, simply uncomment the last 14 lines of your menu.cfg (remove //). You don't have to comment the English lines as menu.cfg is read sequentially and the French overwrites the English.
Spaceman
Alien trapper
 
Posts: 264
Joined: Tue Aug 28, 2007 10:53 am

Re: A new Team Select menu

Postby CrazyClone » Sat Jul 12, 2008 5:44 am

Cool, thank you
Image
CrazyClone
Alien
 
Posts: 127
Joined: Thu Jul 10, 2008 7:38 am

Postby mand1nga » Wed Dec 31, 2008 6:20 pm

I think the majority of these buttons are a little out of the context of "Team Selection". I only like the "End match" and the "Extend match" buttons, that makes me think about having a new menu only for match options, where you can vcall time limits, end matches, change or suggest maps, etc, etc
mand1nga
Alien trapper
 
Posts: 321
Joined: Mon May 12, 2008 12:19 am


Return to Nexuiz - Development

Who is online

Users browsing this forum: No registered users and 0 guests

cron