From eb78a1fd82720675ad488a58b61b482ca58b5d58 Mon Sep 17 00:00:00 2001 From: savagex Date: Tue, 22 Nov 2005 19:14:04 +0000 Subject: [PATCH] now supporting shirt colors git-svn-id: svn://svn.icculus.org/nexuiz/trunk@587 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/menu/data/player.menu | 13 +++++ data/menu/options/player.menu | 18 +++++++ data/menuqc/custom/player/color.qc | 82 +++++++++++++++++++++++++++++- 3 files changed, 112 insertions(+), 1 deletion(-) diff --git a/data/menu/data/player.menu b/data/menu/data/player.menu index 7e3063d47..a8995ead1 100644 --- a/data/menu/data/player.menu +++ b/data/menu/data/player.menu @@ -29,6 +29,19 @@ Item DataContainer Player link "##up" } } + Item Data_Nex_ColorShirt ShirtColor + { + defValue "4" // Red + + Item DataLink_TextSwitch TextSwitch + { + // Red Blue Green Yellow + valueList "'4' '13' '3' '12'" + descList "'$gfx/m_redsquare' '$gfx/m_bluesquare' '$gfx/m_greensquare' '$gfx/m_yellowsquare'" + + link "##up" + } + } Item Data_Cvar FOV { cvarName "FOV" diff --git a/data/menu/options/player.menu b/data/menu/options/player.menu index 68b84bacb..e9f8d91b7 100644 --- a/data/menu/options/player.menu +++ b/data/menu/options/player.menu @@ -118,6 +118,24 @@ Item Window Player colorSelected "1.0 1.0 1.0" } } + Derive Nex_Composition ShirtColor + { + text "Shirt color" + target "::Data::Player::ShirtColor::TextSwitch" + + Derive Nex_Automation_Option_Slider Automation + {} + Derive TextButton Description + {} + Derive Slider Slider + {} + Derive PictureValueButton Value + { + color "1.0 1.0 1.0" + colorPressed "1.0 1.0 1.0" + colorSelected "1.0 1.0 1.0" + } + } Derive Nex_Option_Slider FOV { text "Field of View" diff --git a/data/menuqc/custom/player/color.qc b/data/menuqc/custom/player/color.qc index d8616fe47..ca6712e67 100644 --- a/data/menuqc/custom/player/color.qc +++ b/data/menuqc/custom/player/color.qc @@ -12,8 +12,10 @@ void() _IDNC_Sync = { local float lPants; + // color = shirt * 16 + pants lPants = cvar( "_cl_color" ) & 15; + bprint("Pants: ", ftos(lPants), "\n"); String_EntitySet( self, value, ftos( lPants ) ); String_EntitySet( self, _syncValue, self.value ); @@ -21,7 +23,9 @@ void() _IDNC_Sync = void() _IDNC_Send = { - cmd( strcat( "color \"", self.value, "\"\n" ) ); + local float lShirt; + lShirt = (cvar( "_cl_color" ) / 16) & 15; + cmd( strcat( "color ", ftos( lShirt), " ", self.value, "\n" ) ); String_EntitySet( self, _syncValue, self.value ); }; @@ -70,3 +74,79 @@ void() Item_Data_Nex_Color_Spawn = self._reinit = _IDNC_Sync; self._dataEvent = Item_Data_Nex_Color_DataEvent; }; + + +/* +=================== +Item_Data_Nex_ColorShirt +=================== +*/ + +void() _IDNCS_Sync = +{ + local float lShirt; + + // color = shirt * 16 + pants + lShirt = (cvar( "_cl_color" ) / 16) & 15; + + bprint("Shirt: ", ftos(lShirt), "\n"); + + String_EntitySet( self, value, ftos( lShirt ) ); + String_EntitySet( self, _syncValue, self.value ); +}; + +void() _IDNCS_Send = +{ + local float lPants; + lPants = cvar( "_cl_color" ) & 15; + cmd( strcat( "color ", self.value , " ", ftos( lPants ) , "\n" ) ); + String_EntitySet( self, _syncValue, self.value ); +}; + + +void() _IDNCS_Test_Start = +{ + //cmd( strcat( "color \"", self.value, "\"\n" ) ); +}; + +void() _IDNCS_Test_End = +{ + String_EntitySet( self, value, self._syncValue ); + //cmd( strcat( "color \"", self.value, "\"\n" ) ); +}; + + +void() _IDNCS_Reset = +{ + String_EntitySet( self, value, self.defValue ); + _IDNN_Send(); +}; + +void( float pEvent ) Item_Data_Nex_ColorShirt_DataEvent = +{ + switch( pEvent ) { + case ITEM_DATA_SYNC: + _IDNCS_Sync(); + break; + case ITEM_DATA_SEND: + _IDNCS_Send(); + break; + case ITEM_DATA_RESET: + _IDNCS_Reset(); + break; + case ITEM_DATA_TEST_START: + _IDNCS_Test_Start(); + break; + case ITEM_DATA_TEST_END: + _IDNCS_Test_End(); + break; + } +}; + +void() Item_Data_Nex_ColorShirt_Spawn = +{ + Item_Data_Init(); + + self._reinit = _IDNCS_Sync; + self._dataEvent = Item_Data_Nex_ColorShirt_DataEvent; +}; -- 2.39.2