Initial Counter-Strike VGUI support
This commit is contained in:
parent
7d373d9216
commit
19a52bf611
35 changed files with 1103 additions and 109 deletions
|
@ -78,6 +78,7 @@ cstrike/hud.c
|
|||
|
||||
vgui.cpp
|
||||
cstrike/vgui_buymenu.cpp
|
||||
cstrike/vgui_chooseteam.cpp
|
||||
cstrike/vgui_motd.cpp
|
||||
|
||||
cstrike/draw.c
|
||||
|
|
|
@ -119,7 +119,7 @@ float Game_ConsoleCommand(void)
|
|||
}
|
||||
break;
|
||||
case "chooseteam":
|
||||
//pSeat->fVGUI_Display = VGUI_TEAMSELECT;
|
||||
VGUI_ChooseTeam();
|
||||
break;
|
||||
case "nightvision":
|
||||
Nightvision_Toggle();
|
||||
|
|
|
@ -39,6 +39,11 @@ void Client_Init(float apilevel, string enginename, float engineversion)
|
|||
pSeat.iOverview = FALSE;
|
||||
}
|
||||
|
||||
void Client_InitDone(void)
|
||||
{
|
||||
VGUI_ChooseTeam();
|
||||
}
|
||||
|
||||
void Game_RendererRestarted(string rstr)
|
||||
{
|
||||
Overview_Init();
|
||||
|
|
|
@ -1,34 +1,430 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
static CUIWindow winBuyMenu;
|
||||
static CUIWindow winBuyHandgun;
|
||||
static CUIWindow winBuyShotgun;
|
||||
static CUIWindow winBuySMG;
|
||||
static CUIWindow winBuyRifle;
|
||||
static CUIWindow winBuyMG;
|
||||
static CUIWindow winBuyEquipment;
|
||||
|
||||
typedef struct {
|
||||
string str;
|
||||
void() ptr;
|
||||
} btnarr_t;
|
||||
|
||||
void VGUI_Back1 (void) { winBuyHandgun.Hide(); winBuyMenu.Show(); }
|
||||
void VGUI_Back2 (void) { winBuyShotgun.Hide(); winBuyMenu.Show(); }
|
||||
void VGUI_Back3 (void) { winBuySMG.Hide(); winBuyMenu.Show(); }
|
||||
void VGUI_Back4 (void) { winBuyRifle.Hide(); winBuyMenu.Show(); }
|
||||
void VGUI_Back5 (void) { winBuyMG.Hide(); winBuyMenu.Show(); }
|
||||
void VGUI_Back6 (void) { winBuyEquipment.Hide(); winBuyMenu.Show(); }
|
||||
|
||||
void VGUI_BuyAmmo1 (void) { sendevent("GamePlayerBuyAmmo", "f", 0); }
|
||||
void VGUI_BuyAmmo2 (void) { sendevent("GamePlayerBuyAmmo", "f", 1); }
|
||||
|
||||
void VGUI_BuyHandguns_1 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_USP45); }
|
||||
void VGUI_BuyHandguns_2 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_GLOCK18); }
|
||||
void VGUI_BuyHandguns_3 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_DEAGLE); }
|
||||
void VGUI_BuyHandguns_4 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_P228); }
|
||||
void VGUI_BuyHandguns_5 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_ELITES); }
|
||||
void VGUI_BuyHandguns_6 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_FIVESEVEN); }
|
||||
|
||||
btnarr_t buy_handguns_t[] = {
|
||||
{"USP", VGUI_BuyHandguns_1 },
|
||||
{"Glock 18", VGUI_BuyHandguns_2 },
|
||||
{"Desert Eagle", VGUI_BuyHandguns_3 },
|
||||
{"P228", VGUI_BuyHandguns_4 },
|
||||
{"Dual Elites", VGUI_BuyHandguns_5 },
|
||||
{__NULL__, __NULL__ },
|
||||
{"< Back", VGUI_Back1 }
|
||||
};
|
||||
|
||||
btnarr_t buy_handguns_ct[] = {
|
||||
{"USP", VGUI_BuyHandguns_1 },
|
||||
{"Glock 18", VGUI_BuyHandguns_2 },
|
||||
{"Desert Eagle", VGUI_BuyHandguns_3 },
|
||||
{"P228", VGUI_BuyHandguns_4 },
|
||||
{"Fiveseven", VGUI_BuyHandguns_6 },
|
||||
{__NULL__, __NULL__ },
|
||||
{"< Back", VGUI_Back1 }
|
||||
};
|
||||
|
||||
void VGUI_BuyHandgun(void)
|
||||
{
|
||||
static int initialized;
|
||||
static CUIButton *btns;
|
||||
|
||||
if ( !initialized ) {
|
||||
vector btnpos = [16,0];
|
||||
initialized = TRUE;
|
||||
winBuyHandgun = spawn( CUIWindow );
|
||||
winBuyHandgun.SetTitle( "Buy Handguns" );
|
||||
winBuyHandgun.SetIcon( "gfx/vgui/buymenu" );
|
||||
winBuyHandgun.SetSize( [420,320] );
|
||||
g_uiDesktop.Add( winBuyHandgun );
|
||||
|
||||
btns = memalloc(sizeof(btnarr_t) * buy_handguns_t.length);
|
||||
for (int i = 0; i < buy_handguns_t.length; i++) {
|
||||
btnpos[1] += 30;
|
||||
if ( buy_handguns_t[i].ptr == __NULL__ ) {
|
||||
continue;
|
||||
}
|
||||
btns[i] = spawn( CUIButton );
|
||||
btns[i].SetPos( btnpos );
|
||||
winBuyHandgun.Add( btns[i] );
|
||||
}
|
||||
}
|
||||
|
||||
if (stof(getplayerkeyvalue(player_localnum, "*team")) == TEAM_T) {
|
||||
for (int i = 0; i < buy_handguns_t.length; i++) {
|
||||
if ( buy_handguns_t[i].ptr == __NULL__ ) {
|
||||
continue;
|
||||
}
|
||||
btns[i].SetTitle( buy_handguns_t[i].str );
|
||||
btns[i].SetFunc( buy_handguns_t[i].ptr );
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < buy_handguns_ct.length; i++) {
|
||||
if ( buy_handguns_t[i].ptr == __NULL__ ) {
|
||||
continue;
|
||||
}
|
||||
btns[i].SetTitle( buy_handguns_ct[i].str );
|
||||
btns[i].SetFunc( buy_handguns_ct[i].ptr );
|
||||
}
|
||||
}
|
||||
|
||||
winBuyMenu.Hide();
|
||||
winBuyHandgun.Show();
|
||||
winBuyHandgun.SetPos( ( video_res / 2 ) - ( winBuyHandgun.GetSize() / 2 ) );
|
||||
}
|
||||
|
||||
void VGUI_BuyShotgun_1 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_M3); }
|
||||
void VGUI_BuyShotgun_2 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_XM1014); }
|
||||
|
||||
btnarr_t buy_shotgun[] = {
|
||||
{"M3", VGUI_BuyShotgun_1 },
|
||||
{"XM1014", VGUI_BuyShotgun_2 },
|
||||
{__NULL__, __NULL__ },
|
||||
{"< Back", VGUI_Back2 }
|
||||
};
|
||||
|
||||
void VGUI_BuyShotgun(void)
|
||||
{
|
||||
static int initialized;
|
||||
static CUIButton *btns;
|
||||
|
||||
if ( !initialized ) {
|
||||
vector btnpos = [16,0];
|
||||
initialized = TRUE;
|
||||
winBuyShotgun = spawn( CUIWindow );
|
||||
winBuyShotgun.SetTitle( "Buy Shotguns" );
|
||||
winBuyShotgun.SetIcon( "gfx/vgui/buymenu" );
|
||||
winBuyShotgun.SetSize( [420,320] );
|
||||
g_uiDesktop.Add( winBuyShotgun );
|
||||
|
||||
btns = memalloc(sizeof(btnarr_t) * buy_shotgun.length);
|
||||
for (int i = 0; i < buy_shotgun.length; i++) {
|
||||
btnpos[1] += 30;
|
||||
if ( buy_shotgun[i].ptr == __NULL__ ) {
|
||||
continue;
|
||||
}
|
||||
btns[i] = spawn( CUIButton );
|
||||
btns[i].SetTitle( buy_shotgun[i].str );
|
||||
btns[i].SetPos( btnpos );
|
||||
btns[i].SetFunc( buy_shotgun[i].ptr );
|
||||
winBuyShotgun.Add( btns[i] );
|
||||
}
|
||||
}
|
||||
|
||||
winBuyMenu.Hide();
|
||||
winBuyShotgun.Show();
|
||||
winBuyShotgun.SetPos( ( video_res / 2 ) - ( winBuyShotgun.GetSize() / 2 ) );
|
||||
}
|
||||
|
||||
void VGUI_BuySMG_1 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_MP5); }
|
||||
void VGUI_BuySMG_2 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_P90); }
|
||||
void VGUI_BuySMG_3 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_UMP45); }
|
||||
void VGUI_BuySMG_4 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_MAC10); }
|
||||
void VGUI_BuySMG_5 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_TMP); }
|
||||
|
||||
btnarr_t buy_smg_t[] = {
|
||||
{"MP5", VGUI_BuySMG_1 },
|
||||
{"P90", VGUI_BuySMG_2 },
|
||||
{"UMP45", VGUI_BuySMG_3 },
|
||||
{"MAC10", VGUI_BuySMG_4 },
|
||||
{__NULL__, __NULL__ },
|
||||
{"< Back", VGUI_Back3 }
|
||||
};
|
||||
|
||||
btnarr_t buy_smg_ct[] = {
|
||||
{"MP5", VGUI_BuySMG_1 },
|
||||
{"P90", VGUI_BuySMG_2 },
|
||||
{"UMP45", VGUI_BuySMG_3 },
|
||||
{"TMP", VGUI_BuySMG_5 },
|
||||
{__NULL__, __NULL__ },
|
||||
{"< Back", VGUI_Back3 }
|
||||
};
|
||||
|
||||
void VGUI_BuySMG(void)
|
||||
{
|
||||
static int initialized;
|
||||
static CUIButton *btns;
|
||||
|
||||
if ( !initialized ) {
|
||||
vector btnpos = [16,0];
|
||||
initialized = TRUE;
|
||||
winBuySMG = spawn( CUIWindow );
|
||||
winBuySMG.SetTitle( "Buy SMGs" );
|
||||
winBuySMG.SetIcon( "gfx/vgui/buymenu" );
|
||||
winBuySMG.SetSize( [420,320] );
|
||||
g_uiDesktop.Add( winBuySMG );
|
||||
|
||||
btns = memalloc(sizeof(btnarr_t) * buy_smg_t.length);
|
||||
for (int i = 0; i < buy_smg_t.length; i++) {
|
||||
btnpos[1] += 30;
|
||||
if ( buy_smg_t[i].ptr == __NULL__ ) {
|
||||
continue;
|
||||
}
|
||||
btns[i] = spawn( CUIButton );
|
||||
btns[i].SetPos( btnpos );
|
||||
winBuySMG.Add( btns[i] );
|
||||
}
|
||||
}
|
||||
|
||||
if (stof(getplayerkeyvalue(player_localnum, "*team")) == TEAM_T) {
|
||||
for (int i = 0; i < buy_smg_t.length; i++) {
|
||||
if ( buy_smg_t[i].ptr == __NULL__ ) {
|
||||
continue;
|
||||
}
|
||||
btns[i].SetTitle( buy_smg_t[i].str );
|
||||
btns[i].SetFunc( buy_smg_t[i].ptr );
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < buy_smg_ct.length; i++) {
|
||||
if ( buy_smg_ct[i].ptr == __NULL__ ) {
|
||||
continue;
|
||||
}
|
||||
btns[i].SetTitle( buy_smg_ct[i].str );
|
||||
btns[i].SetFunc( buy_smg_ct[i].ptr );
|
||||
}
|
||||
}
|
||||
|
||||
winBuyMenu.Hide();
|
||||
winBuySMG.Show();
|
||||
winBuySMG.SetPos( ( video_res / 2 ) - ( winBuySMG.GetSize() / 2 ) );
|
||||
}
|
||||
|
||||
void VGUI_BuyRifle_1 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_AK47); }
|
||||
void VGUI_BuyRifle_2 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_SG552); }
|
||||
void VGUI_BuyRifle_3 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_SCOUT); }
|
||||
void VGUI_BuyRifle_4 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_AWP); }
|
||||
void VGUI_BuyRifle_5 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_G3SG1); }
|
||||
void VGUI_BuyRifle_6 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_M4A1); }
|
||||
void VGUI_BuyRifle_7 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_AUG); }
|
||||
void VGUI_BuyRifle_8 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_SG550); }
|
||||
|
||||
btnarr_t buy_rifle_t[] = {
|
||||
{"AK47", VGUI_BuyRifle_1 },
|
||||
{"SG552", VGUI_BuyRifle_2 },
|
||||
{"SCOUT", VGUI_BuyRifle_3 },
|
||||
{"AWP", VGUI_BuyRifle_4 },
|
||||
{"G3SG1", VGUI_BuyRifle_5 },
|
||||
{__NULL__, __NULL__ },
|
||||
{"< Back", VGUI_Back4 }
|
||||
};
|
||||
btnarr_t buy_rifle_ct[] = {
|
||||
{"M4A1", VGUI_BuyRifle_6 },
|
||||
{"AUG", VGUI_BuyRifle_7 },
|
||||
{"SCOUT", VGUI_BuyRifle_3 },
|
||||
{"AWP", VGUI_BuyRifle_4 },
|
||||
{"SG550", VGUI_BuyRifle_8 },
|
||||
{__NULL__, __NULL__ },
|
||||
{"< Back", VGUI_Back4 }
|
||||
};
|
||||
|
||||
void VGUI_BuyRifle(void)
|
||||
{
|
||||
static int initialized;
|
||||
static CUIButton *btns;
|
||||
|
||||
if ( !initialized ) {
|
||||
vector btnpos = [16,0];
|
||||
initialized = TRUE;
|
||||
winBuyRifle = spawn( CUIWindow );
|
||||
winBuyRifle.SetTitle( "Buy Rifles" );
|
||||
winBuyRifle.SetIcon( "gfx/vgui/buymenu" );
|
||||
winBuyRifle.SetSize( [420,320] );
|
||||
g_uiDesktop.Add( winBuyRifle );
|
||||
|
||||
/* Dangerous if rifle_t and ct were different */
|
||||
btns = memalloc(sizeof(btnarr_t) * buy_rifle_t.length);
|
||||
for (int i = 0; i < buy_rifle_t.length; i++) {
|
||||
btnpos[1] += 30;
|
||||
if ( buy_rifle_t[i].ptr == __NULL__ ) {
|
||||
continue;
|
||||
}
|
||||
btns[i] = spawn( CUIButton );
|
||||
btns[i].SetPos( btnpos );
|
||||
winBuyRifle.Add( btns[i] );
|
||||
}
|
||||
}
|
||||
|
||||
if (stof(getplayerkeyvalue(player_localnum, "*team")) == TEAM_T) {
|
||||
for (int i = 0; i < buy_rifle_t.length; i++) {
|
||||
if ( buy_rifle_t[i].ptr == __NULL__ ) {
|
||||
continue;
|
||||
}
|
||||
btns[i].SetTitle( buy_rifle_t[i].str );
|
||||
btns[i].SetFunc( buy_rifle_t[i].ptr );
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < buy_rifle_ct.length; i++) {
|
||||
if ( buy_rifle_t[i].ptr == __NULL__ ) {
|
||||
continue;
|
||||
}
|
||||
btns[i].SetTitle( buy_rifle_ct[i].str );
|
||||
btns[i].SetFunc( buy_rifle_ct[i].ptr );
|
||||
}
|
||||
}
|
||||
|
||||
winBuyMenu.Hide();
|
||||
winBuyRifle.Show();
|
||||
winBuyRifle.SetPos( ( video_res / 2 ) - ( winBuyRifle.GetSize() / 2 ) );
|
||||
}
|
||||
|
||||
void VGUI_BuyMG_1 (void) { sendevent("PlayerBuyWeapon", "f", WEAPON_PARA); }
|
||||
|
||||
void VGUI_BuyMG(void)
|
||||
{
|
||||
static int initialized;
|
||||
static CUIButton btnPara;
|
||||
static CUIButton btnBack;
|
||||
|
||||
if ( !initialized ) {
|
||||
initialized = TRUE;
|
||||
winBuyMG = spawn( CUIWindow );
|
||||
winBuyMG.SetTitle( "Buy Machineguns" );
|
||||
winBuyMG.SetIcon( "gfx/vgui/buymenu" );
|
||||
winBuyMG.SetSize( [420,320] );
|
||||
g_uiDesktop.Add( winBuyMG );
|
||||
|
||||
/* Lonely bugger */
|
||||
btnPara = spawn( CUIButton );
|
||||
btnPara.SetTitle( "PARA" );
|
||||
btnPara.SetPos( [16,32] );
|
||||
btnPara.SetFunc( VGUI_BuyMG_1 );
|
||||
winBuyMG.Add( btnPara );
|
||||
|
||||
/* Lonely bugger */
|
||||
btnBack = spawn( CUIButton );
|
||||
btnBack.SetTitle( "< Back" );
|
||||
btnBack.SetPos( [16,60] );
|
||||
btnBack.SetFunc( VGUI_Back5 );
|
||||
winBuyMG.Add( btnBack );
|
||||
|
||||
}
|
||||
|
||||
winBuyMenu.Hide();
|
||||
winBuyMG.Show();
|
||||
winBuyMG.SetPos( ( video_res / 2 ) - ( winBuyMG.GetSize() / 2 ) );
|
||||
}
|
||||
|
||||
void VGUI_BuyEquipment_1 (void) { sendevent("PlayerBuyEquipment", "f", EQUIPMENT_KEVLAR); }
|
||||
void VGUI_BuyEquipment_2 (void) { sendevent("PlayerBuyEquipment", "f", EQUIPMENT_HELMET); }
|
||||
void VGUI_BuyEquipment_3 (void) { sendevent("PlayerBuyEquipment", "f", 3); }
|
||||
void VGUI_BuyEquipment_4 (void) { sendevent("PlayerBuyEquipment", "f", 4); }
|
||||
void VGUI_BuyEquipment_5 (void) { sendevent("PlayerBuyEquipment", "f", 5); }
|
||||
void VGUI_BuyEquipment_6 (void) { sendevent("PlayerBuyEquipment", "f", EQUIPMENT_DEFUSALKIT); }
|
||||
void VGUI_BuyEquipment_7 (void) { sendevent("PlayerBuyEquipment", "f", EQUIPMENT_NIGHTVISION); }
|
||||
|
||||
btnarr_t buy_equipment[] = {
|
||||
{"Kevlar", VGUI_BuyEquipment_1 },
|
||||
{"Kevlar & Helmet", VGUI_BuyEquipment_2 },
|
||||
{"Flashbang Grenade", VGUI_BuyEquipment_3 },
|
||||
{"HE Grenade", VGUI_BuyEquipment_4 },
|
||||
{"Smoke Grenade", VGUI_BuyEquipment_5 },
|
||||
{"Defusal Kit", VGUI_BuyEquipment_6 },
|
||||
{"Night Visions", VGUI_BuyEquipment_7 },
|
||||
{__NULL__, __NULL__ },
|
||||
{"< Back", VGUI_Back6 }
|
||||
};
|
||||
|
||||
void VGUI_BuyEquipment(void)
|
||||
{
|
||||
static int initialized;
|
||||
static CUIButton *btns;
|
||||
|
||||
if ( !initialized ) {
|
||||
vector btnpos = [16,0];
|
||||
initialized = TRUE;
|
||||
winBuyEquipment = spawn( CUIWindow );
|
||||
winBuyEquipment.SetTitle( "Buy Equipment" );
|
||||
winBuyEquipment.SetIcon( "gfx/vgui/buymenu" );
|
||||
winBuyEquipment.SetSize( [420,320] );
|
||||
g_uiDesktop.Add( winBuyEquipment );
|
||||
|
||||
btns = memalloc(sizeof(btnarr_t) * buy_equipment.length);
|
||||
for (int i = 0; i < buy_equipment.length; i++) {
|
||||
btnpos[1] += 30;
|
||||
if ( buy_equipment[i].ptr == __NULL__ ) {
|
||||
continue;
|
||||
}
|
||||
btns[i] = spawn( CUIButton );
|
||||
btns[i].SetTitle( buy_equipment[i].str );
|
||||
btns[i].SetPos( btnpos );
|
||||
btns[i].SetFunc( buy_equipment[i].ptr );
|
||||
winBuyEquipment.Add( btns[i] );
|
||||
}
|
||||
}
|
||||
|
||||
winBuyMenu.Hide();
|
||||
winBuyEquipment.Show();
|
||||
winBuyEquipment.SetPos( ( video_res / 2 ) - ( winBuyEquipment.GetSize() / 2 ) );
|
||||
}
|
||||
|
||||
btnarr_t buy_main[] = {
|
||||
{"Handguns", VGUI_BuyHandgun },
|
||||
{"Shotguns", VGUI_BuyShotgun },
|
||||
{"Sub-Machine-Guns", VGUI_BuySMG },
|
||||
{"Rifles", VGUI_BuyRifle },
|
||||
{"Machineguns", VGUI_BuyMG },
|
||||
{"Primary Ammo", VGUI_BuyAmmo1 },
|
||||
{"Secondary Ammo", VGUI_BuyAmmo2 },
|
||||
{"Equipment", VGUI_BuyEquipment }
|
||||
};
|
||||
|
||||
void VGUI_BuyMenu(void)
|
||||
{
|
||||
static int initialized;
|
||||
static CUIWindow winMusicPlayer;
|
||||
static CUIButton btnPlay;
|
||||
static CUIButton btnStop;
|
||||
static CUIButton *btns;
|
||||
|
||||
if ( !initialized ) {
|
||||
vector btnpos = [16,30];
|
||||
initialized = TRUE;
|
||||
winMusicPlayer = spawn( CUIWindow );
|
||||
winMusicPlayer.SetTitle( "Music Player" );
|
||||
winMusicPlayer.SetSize( '256 180' );
|
||||
winMusicPlayer.SetIcon( "textures/ui/icons/cd" );
|
||||
|
||||
btnPlay = spawn( CUIButton );
|
||||
btnPlay.SetTitle( "Play" );
|
||||
btnPlay.SetPos( '8 132' );
|
||||
//btnPlay.SetFunc( MusicPlayer_Play );
|
||||
|
||||
btnStop = spawn( CUIButton );
|
||||
btnStop.SetTitle( "Stop" );
|
||||
btnStop.SetPos( '96 132' );
|
||||
//btnStop.SetFunc( MusicPlayer_Stop );
|
||||
|
||||
g_uiDesktop.Add( winMusicPlayer );
|
||||
winMusicPlayer.Add( btnPlay );
|
||||
winMusicPlayer.Add( btnStop );
|
||||
winBuyMenu = spawn( CUIWindow );
|
||||
winBuyMenu.SetTitle( "Buy Menu" );
|
||||
winBuyMenu.SetIcon( "gfx/vgui/buymenu" );
|
||||
winBuyMenu.SetSize( [420,320] );
|
||||
g_uiDesktop.Add( winBuyMenu );
|
||||
|
||||
btns = memalloc(sizeof(btnarr_t) * buy_main.length);
|
||||
for (int i = 0; i < buy_main.length; i++) {
|
||||
btns[i] = spawn( CUIButton );
|
||||
btns[i].SetTitle( buy_main[i].str );
|
||||
btns[i].SetPos( btnpos );
|
||||
btns[i].SetFunc( buy_main[i].ptr );
|
||||
winBuyMenu.Add( btns[i] );
|
||||
btnpos[1] += 30;
|
||||
}
|
||||
}
|
||||
|
||||
winMusicPlayer.Show();
|
||||
winMusicPlayer.SetPos( ( video_res / 2 ) - ( winMusicPlayer.GetSize() / 2 ) );
|
||||
winBuyMenu.Show();
|
||||
winBuyMenu.SetPos( ( video_res / 2 ) - ( winBuyMenu.GetSize() / 2 ) );
|
||||
}
|
||||
|
|
191
Source/client/cstrike/vgui_chooseteam.cpp
Normal file
191
Source/client/cstrike/vgui_chooseteam.cpp
Normal file
|
@ -0,0 +1,191 @@
|
|||
|
||||
|
||||
static CUIWindow winChooseTeam;
|
||||
static CUIWindow winCTTeam;
|
||||
static CUIWindow winTTeam;
|
||||
|
||||
void
|
||||
T_Skin1(void)
|
||||
{
|
||||
sendevent( "GamePlayerSpawn", "f", 1 );
|
||||
winTTeam.Hide();
|
||||
}
|
||||
void
|
||||
T_Skin2(void)
|
||||
{
|
||||
sendevent( "GamePlayerSpawn", "f", 2 );
|
||||
winTTeam.Hide();
|
||||
}
|
||||
void
|
||||
T_Skin3(void)
|
||||
{
|
||||
sendevent( "GamePlayerSpawn", "f", 3 );
|
||||
winTTeam.Hide();
|
||||
}
|
||||
void
|
||||
T_Skin4(void)
|
||||
{
|
||||
sendevent( "GamePlayerSpawn", "f", 4 );
|
||||
winTTeam.Hide();
|
||||
}
|
||||
|
||||
void
|
||||
CT_Skin1(void)
|
||||
{
|
||||
sendevent( "GamePlayerSpawn", "f", 5 );
|
||||
winCTTeam.Hide();
|
||||
}
|
||||
void
|
||||
CT_Skin2(void)
|
||||
{
|
||||
sendevent( "GamePlayerSpawn", "f", 6 );
|
||||
winCTTeam.Hide();
|
||||
}
|
||||
void
|
||||
CT_Skin3(void)
|
||||
{
|
||||
sendevent( "GamePlayerSpawn", "f", 7 );
|
||||
winCTTeam.Hide();
|
||||
}
|
||||
void
|
||||
CT_Skin4(void)
|
||||
{
|
||||
sendevent( "GamePlayerSpawn", "f", 8 );
|
||||
winCTTeam.Hide();
|
||||
}
|
||||
void
|
||||
VGUI_GoSpectator(void)
|
||||
{
|
||||
sendevent( "GamePlayerSpawn", "f", 0 );
|
||||
winChooseTeam.Hide();
|
||||
}
|
||||
|
||||
void VGUI_ChooseTeam_CT(void)
|
||||
{
|
||||
static int initialized;
|
||||
static CUIButton btnSkin1;
|
||||
static CUIButton btnSkin2;
|
||||
static CUIButton btnSkin3;
|
||||
static CUIButton btnSkin4;
|
||||
|
||||
if ( !initialized ) {
|
||||
initialized = TRUE;
|
||||
winCTTeam = spawn( CUIWindow );
|
||||
winCTTeam.SetTitle( "Choose Skin" );
|
||||
winCTTeam.SetSize( [420,320] );
|
||||
|
||||
btnSkin1 = spawn( CUIButton );
|
||||
btnSkin1.SetTitle( "Skin 1" );
|
||||
btnSkin1.SetPos( [8,132] );
|
||||
btnSkin1.SetFunc( CT_Skin1 );
|
||||
|
||||
btnSkin2 = spawn( CUIButton );
|
||||
btnSkin2.SetTitle( "Skin 2" );
|
||||
btnSkin2.SetPos( [8,132+30] );
|
||||
btnSkin2.SetFunc( CT_Skin2 );
|
||||
|
||||
btnSkin3 = spawn( CUIButton );
|
||||
btnSkin3.SetTitle( "Skin 3" );
|
||||
btnSkin3.SetPos( [8,132+30+30] );
|
||||
btnSkin3.SetFunc( CT_Skin3 );
|
||||
|
||||
btnSkin4 = spawn( CUIButton );
|
||||
btnSkin4.SetTitle( "Skin 4" );
|
||||
btnSkin4.SetPos( [8,132+30+30+30] );
|
||||
btnSkin4.SetFunc( CT_Skin4 );
|
||||
|
||||
g_uiDesktop.Add( winCTTeam );
|
||||
winCTTeam.Add( btnSkin1 );
|
||||
winCTTeam.Add( btnSkin2 );
|
||||
winCTTeam.Add( btnSkin3 );
|
||||
winCTTeam.Add( btnSkin4 );
|
||||
}
|
||||
|
||||
winChooseTeam.Hide();
|
||||
winCTTeam.Show();
|
||||
winCTTeam.SetPos( ( video_res / 2 ) - ( winCTTeam.GetSize() / 2 ) );
|
||||
}
|
||||
|
||||
void VGUI_ChooseTeam_T(void)
|
||||
{
|
||||
static int initialized;
|
||||
static CUIButton btnSkin1;
|
||||
static CUIButton btnSkin2;
|
||||
static CUIButton btnSkin3;
|
||||
static CUIButton btnSkin4;
|
||||
|
||||
if ( !initialized ) {
|
||||
initialized = TRUE;
|
||||
winTTeam = spawn( CUIWindow );
|
||||
winTTeam.SetTitle( "Choose Skin" );
|
||||
winTTeam.SetSize( [420,320] );
|
||||
|
||||
btnSkin1 = spawn( CUIButton );
|
||||
btnSkin1.SetTitle( "Skin 1" );
|
||||
btnSkin1.SetPos( [8,132] );
|
||||
btnSkin1.SetFunc( T_Skin1 );
|
||||
|
||||
btnSkin2 = spawn( CUIButton );
|
||||
btnSkin2.SetTitle( "Skin 2" );
|
||||
btnSkin2.SetPos( [8,132+30] );
|
||||
btnSkin2.SetFunc( T_Skin2 );
|
||||
|
||||
btnSkin3 = spawn( CUIButton );
|
||||
btnSkin3.SetTitle( "Skin 3" );
|
||||
btnSkin3.SetPos( [8,132+30+30] );
|
||||
btnSkin3.SetFunc( T_Skin3 );
|
||||
|
||||
btnSkin4 = spawn( CUIButton );
|
||||
btnSkin4.SetTitle( "Skin 4" );
|
||||
btnSkin4.SetPos( [8,132+30+30+30] );
|
||||
btnSkin4.SetFunc( T_Skin4 );
|
||||
|
||||
g_uiDesktop.Add( winTTeam );
|
||||
winTTeam.Add( btnSkin1 );
|
||||
winTTeam.Add( btnSkin2 );
|
||||
winTTeam.Add( btnSkin3 );
|
||||
winTTeam.Add( btnSkin4 );
|
||||
}
|
||||
|
||||
winChooseTeam.Hide();
|
||||
winTTeam.Show();
|
||||
winTTeam.SetPos( ( video_res / 2 ) - ( winTTeam.GetSize() / 2 ) );
|
||||
}
|
||||
|
||||
void VGUI_ChooseTeam(void)
|
||||
{
|
||||
static int initialized;
|
||||
static CUIButton btnGoCT;
|
||||
static CUIButton btnGoT;
|
||||
static CUIButton btnGoSpectator;
|
||||
|
||||
if ( !initialized ) {
|
||||
initialized = TRUE;
|
||||
winChooseTeam = spawn( CUIWindow );
|
||||
winChooseTeam.SetTitle( "Choose Team" );
|
||||
winChooseTeam.SetSize( '420 320' );
|
||||
|
||||
btnGoCT = spawn( CUIButton );
|
||||
btnGoCT.SetTitle( "Counter-Terrorists" );
|
||||
btnGoCT.SetPos( '8 132' );
|
||||
btnGoCT.SetFunc( VGUI_ChooseTeam_CT );
|
||||
|
||||
btnGoT = spawn( CUIButton );
|
||||
btnGoT.SetTitle( "Terrorists" );
|
||||
btnGoT.SetPos( '8 162' );
|
||||
btnGoT.SetFunc( VGUI_ChooseTeam_T );
|
||||
|
||||
btnGoSpectator = spawn( CUIButton );
|
||||
btnGoSpectator.SetTitle( "Spectator" );
|
||||
btnGoSpectator.SetPos( '8 192' );
|
||||
btnGoSpectator.SetFunc( VGUI_GoSpectator );
|
||||
|
||||
g_uiDesktop.Add( winChooseTeam );
|
||||
winChooseTeam.Add( btnGoCT );
|
||||
winChooseTeam.Add( btnGoT );
|
||||
winChooseTeam.Add( btnGoSpectator );
|
||||
}
|
||||
|
||||
winChooseTeam.Show();
|
||||
winChooseTeam.SetPos( ( video_res / 2 ) - ( winChooseTeam.GetSize() / 2 ) );
|
||||
}
|
|
@ -108,8 +108,19 @@ void CSQC_UpdateView(float w, float h, float focus)
|
|||
|
||||
if (w == 0 || h == 0) {
|
||||
return;
|
||||
} else {
|
||||
/* First time we can effectively call VGUI
|
||||
* because until now we don't know the video res.
|
||||
*/
|
||||
if (!video_res[0] && !video_res[1]) {
|
||||
video_res[0] = w;
|
||||
video_res[1] = h;
|
||||
Client_InitDone();
|
||||
}
|
||||
}
|
||||
|
||||
/* While the init above may have already happened,
|
||||
people are able to resize windows dynamically too. */
|
||||
video_res[0] = w;
|
||||
video_res[1] = h;
|
||||
|
||||
|
@ -242,6 +253,13 @@ void CSQC_UpdateView(float w, float h, float focus)
|
|||
|
||||
renderscene();
|
||||
|
||||
|
||||
/* Run this on all players */
|
||||
for (entity b = world; (b = find(b, ::classname, "player"));) {
|
||||
player pf = (player) b;
|
||||
pf.postdraw();
|
||||
}
|
||||
|
||||
View_DropPunchAngle();
|
||||
Fade_Update((int)video_mins[0],(int)video_mins[1], (int)w, (int)h);
|
||||
|
||||
|
@ -279,12 +297,6 @@ void CSQC_UpdateView(float w, float h, float focus)
|
|||
|
||||
DSP_UpdateListener();
|
||||
pSeat = (void*)0x70000000i;
|
||||
needcursor = 0;
|
||||
if (needcursor) {
|
||||
setcursormode(TRUE, "gfx/cursor", [0,0,0], 1.0f);
|
||||
} else {
|
||||
setcursormode(FALSE, "gfx/cursor", [0,0,0], 1.0f);
|
||||
}
|
||||
|
||||
Sound_ProcessWordQue();
|
||||
}
|
||||
|
@ -346,6 +358,13 @@ float CSQC_InputEvent(float fEventType, float fKey, float fCharacter, float fDev
|
|||
}
|
||||
|
||||
VGUI_Input(fEventType, fKey, fCharacter, fDeviceID);
|
||||
|
||||
if (g_vguiWidgetCount) {
|
||||
setcursormode(TRUE, "gfx/cursor", [0,0,0], 1.0f);
|
||||
} else {
|
||||
setcursormode(FALSE, "gfx/cursor", [0,0,0], 1.0f);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -363,6 +382,13 @@ void CSQC_Input_Frame(void)
|
|||
|
||||
|
||||
// If we are inside a VGUI, don't let the client do stuff outside
|
||||
if (g_vguiWidgetCount) {
|
||||
input_impulse = 0;
|
||||
input_buttons = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* The HUD needs more time */
|
||||
if ((pSeat->fHUDWeaponSelected) && (input_buttons & INPUT_BUTTON0)) {
|
||||
HUD_DrawWeaponSelect_Trigger();
|
||||
input_buttons = 0;
|
||||
|
|
|
@ -51,7 +51,21 @@ string sPModels[CS_WEAPON_COUNT - 1] = {
|
|||
void player::gun_offset(void)
|
||||
{
|
||||
vector v1, v2;
|
||||
|
||||
#ifdef VALVE
|
||||
if (playertype == PLAYERTYPE_Q2) {
|
||||
p_model.scale = 1.4;
|
||||
if (flags & FL_CROUCHING) {
|
||||
setorigin(p_model, origin + [0,0, 16]);
|
||||
} else {
|
||||
setorigin(p_model, origin + [0,0, -2]);
|
||||
}
|
||||
p_model.angles = this.angles;
|
||||
p_model.frame = frame;
|
||||
p_model.frame2 = frame2;
|
||||
p_model.lerpfrac = lerpfrac;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
/* Set it to something consistent */
|
||||
this.p_model.angles = this.angles;
|
||||
|
||||
|
@ -89,30 +103,33 @@ void player::draw(void)
|
|||
this.subblendfrac =
|
||||
this.subblend2frac = this.pitch / 90;
|
||||
|
||||
/* Only bother updating the model if the weapon has changed */
|
||||
if (this.lastweapon != this.activeweapon) {
|
||||
if (this.activeweapon) {
|
||||
#ifdef CSTRIKE
|
||||
setmodel(this.p_model, sPModels[this.activeweapon - 1]);
|
||||
#else
|
||||
setmodel(this. p_model, Weapons_GetPlayermodel(this.activeweapon));
|
||||
#endif
|
||||
} else {
|
||||
setmodel(this.p_model, "");
|
||||
}
|
||||
this.lastweapon = this.activeweapon;
|
||||
|
||||
/* Update the bone index of the current p_ model so we can calculate the offset
|
||||
* and get the weapon bone ID for the current player model */
|
||||
this.p_hand_bone = gettagindex(this, "Bip01 R Hand");
|
||||
this.p_model_bone = gettagindex(this.p_model, "Bip01 R Hand");
|
||||
}
|
||||
|
||||
#warning "FIXME: Clean this mess up"
|
||||
#ifdef VALVE
|
||||
if (playertype == 0) {
|
||||
if (playertype == PLAYERTYPE_HL) {
|
||||
/* Only bother updating the model if the weapon has changed */
|
||||
if (this.lastweapon != this.activeweapon) {
|
||||
if (this.activeweapon) {
|
||||
#ifdef CSTRIKE
|
||||
setmodel(this.p_model, sPModels[this.activeweapon - 1]);
|
||||
#else
|
||||
setmodel(this. p_model, Weapons_GetPlayermodel(this.activeweapon));
|
||||
#endif
|
||||
} else {
|
||||
setmodel(this.p_model, "");
|
||||
}
|
||||
this.lastweapon = this.activeweapon;
|
||||
|
||||
/* Update the bone index of the current p_ model so we can calculate the offset
|
||||
* and get the weapon bone ID for the current player model */
|
||||
this.p_hand_bone = gettagindex(this, "Bip01 R Hand");
|
||||
this.p_model_bone = gettagindex(this.p_model, "Bip01 R Hand");
|
||||
}
|
||||
Animation_PlayerUpdate();
|
||||
} else {
|
||||
if (!this.p_model.modelindex) {
|
||||
tokenizebyseparator(getplayerkeyvalue(entnum-1, "model"), "/");
|
||||
setmodel(this.p_model, sprintf("players/%s/weapon.md2", argv(0)));
|
||||
}
|
||||
Animation_Q2PlayerUpdate();
|
||||
return;
|
||||
}
|
||||
|
@ -175,6 +192,8 @@ void player::draw(void)
|
|||
this.angles[1] -= a;
|
||||
}
|
||||
|
||||
var float autocvar_standheight = 0;
|
||||
var float autocvar_crouchheight = 0;
|
||||
float player::predraw(void)
|
||||
{
|
||||
/* Handle the flashlights... */
|
||||
|
@ -205,15 +224,22 @@ float player::predraw(void)
|
|||
draw();
|
||||
gun_offset();
|
||||
|
||||
#ifdef VALVE
|
||||
/* Size of appearance and bounding box is different from game to game */
|
||||
if (playertype == PLAYERTYPE_Q2) {
|
||||
scale = 1.4;
|
||||
if (flags & FL_CROUCHING) {
|
||||
setorigin(this, this.origin + [0,0, 16]);
|
||||
} else {
|
||||
setorigin(this, this.origin + [0,0, -2]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (autocvar_cl_thirdperson == TRUE || this.entnum != player_localentnum) {
|
||||
Voice_Draw3D(this);
|
||||
|
||||
if (playertype == 0) {
|
||||
addentity(this);
|
||||
addentity(this.p_model);
|
||||
} else {
|
||||
addentity(this);
|
||||
}
|
||||
addentity(this);
|
||||
addentity(this.p_model);
|
||||
} else {
|
||||
removeentity(this);
|
||||
removeentity(this.p_model);
|
||||
|
@ -221,6 +247,21 @@ float player::predraw(void)
|
|||
return PREDRAW_NEXT;
|
||||
}
|
||||
|
||||
float player::postdraw(void)
|
||||
{
|
||||
#ifdef VALVE
|
||||
/* Correct offsets */
|
||||
if (playertype == PLAYERTYPE_Q2) {
|
||||
if (flags & FL_CROUCHING) {
|
||||
setorigin(this, this.origin - [0,0, 16]);
|
||||
} else {
|
||||
setorigin(this, this.origin - [0,0, -2]);
|
||||
}
|
||||
scale = 1.0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void player::set_model(void)
|
||||
{
|
||||
#ifdef VALVE
|
||||
|
|
|
@ -23,6 +23,10 @@ void Client_Init(float apilevel, string enginename, float engineversion)
|
|||
precache_model("sprites/640hud6.spr");
|
||||
}
|
||||
|
||||
void Client_InitDone(void)
|
||||
{
|
||||
}
|
||||
|
||||
void Game_RendererRestarted(string rstr)
|
||||
{
|
||||
|
||||
|
|
|
@ -57,6 +57,10 @@ void Client_Init(float apilevel, string enginename, float engineversion)
|
|||
deltalisten("models/scientist.mdl", Scientist_Update, 0);
|
||||
}
|
||||
|
||||
void Client_InitDone(void)
|
||||
{
|
||||
}
|
||||
|
||||
void Game_RendererRestarted(string rstr)
|
||||
{
|
||||
|
||||
|
|
|
@ -23,6 +23,10 @@ void Client_Init(float apilevel, string enginename, float engineversion)
|
|||
precache_model("sprites/640hud6.spr");
|
||||
}
|
||||
|
||||
void Client_InitDone(void)
|
||||
{
|
||||
}
|
||||
|
||||
void Game_RendererRestarted(string rstr)
|
||||
{
|
||||
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
*
|
||||
****/
|
||||
|
||||
CUIWidget g_uiDesktop;
|
||||
CUIWidget g_uiDesktop;
|
||||
|
||||
void VGUI_Init(void)
|
||||
{
|
||||
UISystem_Init();
|
||||
g_uiDesktop = spawn( CUIWidget );
|
||||
g_uiDesktop.FlagAdd( 1 );
|
||||
}
|
||||
|
|
|
@ -286,3 +286,7 @@ void View_PlayAnimation(int iSequence)
|
|||
pSeat->eViewModel.frame = (float)iSequence;
|
||||
pSeat->eViewModel.frame1time = 0.0f;
|
||||
}
|
||||
int View_GetAnimation(void)
|
||||
{
|
||||
return pSeat->eViewModel.frame;
|
||||
}
|
||||
|
|
|
@ -152,11 +152,17 @@ void w_hammer_release(void)
|
|||
if (pl.a_ammo1 == 1) {
|
||||
if (trace_ent.takedamage) {
|
||||
hitsound = floor(random(1, 4));
|
||||
Damage_Apply(trace_ent, self, 100, trace_endpos, FALSE);
|
||||
|
||||
if (trace_ent.classname == "player")
|
||||
Damage_Apply(trace_ent, self, 50, trace_endpos, FALSE);
|
||||
else
|
||||
Damage_Apply(trace_ent, self, 100, trace_endpos, FALSE);
|
||||
|
||||
if (trace_ent.classname == "monster_scientist") {
|
||||
trace_ent.movetype = MOVETYPE_TOSS;
|
||||
trace_ent.velocity = v_forward * 768 + v_up * 256;
|
||||
} else if (trace_ent.classname == "player") {
|
||||
trace_ent.velocity = v_forward * 768 + v_up * 256;
|
||||
}
|
||||
} else {
|
||||
if (trace_fraction < 1.0) {
|
||||
|
|
|
@ -88,5 +88,6 @@ void Weapons_UpdateAmmo(player pl, int a1, int a2, int a3);
|
|||
void Weapons_ReloadWeapon(player pl, .int mag, .int ammo, int max);
|
||||
#else
|
||||
string Weapons_GetPlayermodel(int id);
|
||||
int Weapons_GetAnimation(void);
|
||||
void Weapons_HUDPic(int w, int s, vector pos);
|
||||
#endif
|
||||
|
|
|
@ -55,6 +55,7 @@ class player
|
|||
virtual void() gun_offset;
|
||||
virtual void() draw;
|
||||
virtual float() predraw;
|
||||
virtual float() postdraw;
|
||||
#else
|
||||
int ammo_9mm;
|
||||
int ammo_357;
|
||||
|
|
|
@ -46,10 +46,11 @@ string w_egon_deathmsg(void)
|
|||
|
||||
void w_egon_draw(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
#ifdef CSQC
|
||||
Weapons_ViewAnimation(EGON_DRAW);
|
||||
pl.w_idle_next = 1.0f;
|
||||
#else
|
||||
player pl = (player)self;
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_uranium, __NULL__);
|
||||
#endif
|
||||
}
|
||||
|
@ -60,7 +61,26 @@ void w_egon_holster(void)
|
|||
}
|
||||
void w_egon_primary(void)
|
||||
{
|
||||
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
if (Weapons_GetAnimation() == EGON_IDLE1)
|
||||
Weapons_ViewAnimation(EGON_ALTFIREON);
|
||||
else if (Weapons_GetAnimation() == EGON_ALTFIREON)
|
||||
Weapons_ViewAnimation(EGON_ALTFIRECYCLE);
|
||||
#else
|
||||
Weapons_MakeVectors();
|
||||
vector src = Weapons_GetCameraPos();
|
||||
vector endpos = src + v_forward * 1024;
|
||||
traceline(src, endpos, FALSE, pl);
|
||||
Damage_Radius(trace_endpos, pl, 10, 64, TRUE);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.2f;
|
||||
pl.w_idle_next = 2.5f;
|
||||
}
|
||||
void w_egon_secondary(void)
|
||||
{
|
||||
|
@ -72,7 +92,18 @@ void w_egon_reload(void)
|
|||
}
|
||||
void w_egon_release(void)
|
||||
{
|
||||
|
||||
#ifdef CSQC
|
||||
player pl = (player)self;
|
||||
if (Weapons_GetAnimation() == EGON_ALTFIRECYCLE) {
|
||||
Weapons_ViewAnimation(EGON_ALTFIREOFF);
|
||||
pl.w_idle_next = 1.0f;
|
||||
} else {
|
||||
if (pl.w_idle_next > 0.0f) {
|
||||
return;
|
||||
}
|
||||
Weapons_ViewAnimation(EGON_IDLE1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void w_egon_crosshair(void)
|
||||
{
|
||||
|
|
|
@ -57,7 +57,17 @@ void w_handgrenade_holster(void)
|
|||
}
|
||||
void w_handgrenade_primary(void)
|
||||
{
|
||||
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
Weapons_ViewAnimation(HANDGRENADE_PULLPIN);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.2f;
|
||||
pl.w_idle_next = 2.5f;
|
||||
}
|
||||
void w_handgrenade_secondary(void)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@ void w_hornetgun_precache(void)
|
|||
precache_model("models/v_hgun.mdl");
|
||||
precache_model("models/w_hgun.mdl");
|
||||
precache_model("models/p_hgun.mdl");
|
||||
precache_model("models/hornet.mdl");
|
||||
|
||||
precache_sound("agrunt/ag_fire1.wav");
|
||||
precache_sound("agrunt/ag_fire2.wav");
|
||||
|
|
|
@ -25,6 +25,9 @@ void w_rpg_precache(void)
|
|||
precache_model("models/v_rpg.mdl");
|
||||
precache_model("models/w_rpg.mdl");
|
||||
precache_model("models/p_rpg.mdl");
|
||||
precache_model("models/rpgrocket.mdl");
|
||||
precache_model("sprites/laserdot.spr");
|
||||
precache_sound("weapons/rocketfire1.wav");
|
||||
}
|
||||
string w_rpg_vmodel(void)
|
||||
{
|
||||
|
@ -59,7 +62,53 @@ void w_rpg_holster(void)
|
|||
}
|
||||
void w_rpg_primary(void)
|
||||
{
|
||||
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
Weapons_ViewAnimation(RPG_FIRE2);
|
||||
#else
|
||||
static void Rocket_Touch(void) {
|
||||
Effect_CreateExplosion(self.origin);
|
||||
Damage_Radius(self.origin, self.owner, 150, 150 * 2.5f, TRUE);
|
||||
sound(self, CHAN_WEAPON, sprintf( "weapons/explode%d.wav", floor( random() * 2 ) + 3 ), 1, ATTN_NORM);
|
||||
remove(self);
|
||||
}
|
||||
static void Rocket_BuildSpeed(void){
|
||||
/* Calculate new direction */
|
||||
makevectors(self.owner.v_angle);
|
||||
traceline(self.owner.origin, self.owner.origin + v_forward * 8096, FALSE, self.owner);
|
||||
self.angles = vectoangles(trace_endpos - self.origin);
|
||||
|
||||
/* Increase speed towards it */
|
||||
makevectors(self.angles);
|
||||
self.velocity += (v_forward * 2000) * frametime;
|
||||
self.nextthink = time;
|
||||
}
|
||||
|
||||
Weapons_MakeVectors();
|
||||
entity rocket = spawn();
|
||||
setmodel(rocket, "models/rpgrocket.mdl");
|
||||
setorigin(rocket, Weapons_GetCameraPos() + (v_forward * 16));
|
||||
rocket.owner = self;
|
||||
rocket.movetype = MOVETYPE_FLY;
|
||||
rocket.solid = SOLID_BBOX;
|
||||
//bolt.flags |= FL_LAGGEDMOVE;
|
||||
rocket.gravity = 0.5f;
|
||||
rocket.velocity = (v_forward * 250);
|
||||
rocket.angles = vectoangles(rocket.velocity);
|
||||
rocket.avelocity[2] = 10;
|
||||
rocket.touch = Rocket_Touch;
|
||||
rocket.think = Rocket_BuildSpeed;
|
||||
rocket.nextthink = time + 0.15f;
|
||||
setsize(rocket, [0,0,0], [0,0,0]);
|
||||
sound(self, CHAN_WEAPON, "weapons/rocketfire1.wav", 1, ATTN_NORM);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 2.5f;
|
||||
}
|
||||
void w_rpg_secondary(void)
|
||||
{
|
||||
|
@ -94,13 +143,28 @@ void w_rpg_hudpic(int s, vector pos)
|
|||
|
||||
void w_rpg_laser(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
player pl = (player)self;
|
||||
|
||||
Weapons_MakeVectors();
|
||||
vector src = pl.origin + pl.view_ofs;
|
||||
traceline(src, src + (v_forward * 8192), FALSE, pl);
|
||||
#ifdef CSQC
|
||||
// Draw laser at laserpos
|
||||
|
||||
/*makevectors(vectoangles(trace_endpos - pl.origin));
|
||||
vector forg = trace_endpos + (v_forward * -16);
|
||||
vector fsize = [64, 64];
|
||||
|
||||
makevectors(view_angles);
|
||||
R_BeginPolygon("sprites/640hud7.spr_0.tga", 1, 0);
|
||||
R_PolygonVertex(forg + v_right * fsize[0] - v_up * fsize[1], [1,1], [1,1,1], 1.0f);
|
||||
R_PolygonVertex(forg - v_right * fsize[0] - v_up * fsize[1], [0,1], [1,1,1], 1.0f);
|
||||
R_PolygonVertex(forg - v_right * fsize[0] + v_up * fsize[1], [0,0], [1,1,1], 1.0f);
|
||||
R_PolygonVertex(forg + v_right * fsize[0] + v_up * fsize[1], [1,0], [1,1,1], 1.0f);
|
||||
R_EndPolygon();*/
|
||||
static vector cross_pos;
|
||||
vector lasersize = [8,8] * (1-trace_fraction);
|
||||
cross_pos = (video_res / 2) - (lasersize/2);
|
||||
drawpic(cross_pos, "sprites/laserdot.spr_0.tga", lasersize, [1,1,1], 1.0f, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@ void w_tripmine_precache(void)
|
|||
{
|
||||
precache_model("models/v_tripmine.mdl");
|
||||
precache_model("models/p_tripmine.mdl");
|
||||
precache_sound("weapons/mine_deploy.wav");
|
||||
precache_sound("weapons/mine_charge.wav");
|
||||
precache_sound("weapons/mine_activate.wav");
|
||||
}
|
||||
string w_tripmine_vmodel(void)
|
||||
{
|
||||
|
@ -54,13 +57,49 @@ void w_tripmine_holster(void)
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
#ifdef SSQC
|
||||
void w_tripmine_trip(int unused)
|
||||
{
|
||||
/* This is to prevent infinite loops in Damage_Radius */
|
||||
self.vDeath =
|
||||
self.vPain = __NULL__;
|
||||
self.takedamage = DAMAGE_NO;
|
||||
|
||||
Effect_CreateExplosion(self.origin);
|
||||
Damage_Radius(self.origin, self.owner, 150, 150 * 2.5f, TRUE);
|
||||
sound(self, CHAN_WEAPON, sprintf( "weapons/explode%d.wav", floor( random() * 2 ) + 3 ), 1, ATTN_NORM);
|
||||
remove(self);
|
||||
}
|
||||
void w_tripmine_ready(void)
|
||||
{
|
||||
makevectors(self.angles);
|
||||
traceline(self.origin, self.origin + v_forward * 2048, FALSE, self);
|
||||
|
||||
if (!self.health) {
|
||||
self.health = 1;
|
||||
self.vDeath =
|
||||
self.vPain = w_tripmine_trip;
|
||||
self.takedamage = DAMAGE_YES;
|
||||
self.solid = SOLID_BBOX;
|
||||
setsize(self, [-8,-8,-8], [8,8,8]);
|
||||
self.armor = trace_plane_dist;
|
||||
sound(self, CHAN_WEAPON, "weapons/mine_activate.wav", 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
if (trace_plane_dist != self.armor) {
|
||||
w_tripmine_trip(0);
|
||||
}
|
||||
self.nextthink = time;
|
||||
}
|
||||
#endif
|
||||
|
||||
void w_tripmine_primary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Weapons_MakeVectors();
|
||||
traceline(Weapons_GetCameraPos(), Weapons_GetCameraPos() + v_forward * 64, FALSE, pl);
|
||||
|
@ -76,12 +115,13 @@ void w_tripmine_primary(void)
|
|||
setmodel(mine, "models/v_tripmine.mdl");
|
||||
setorigin(mine, trace_endpos);
|
||||
mine.frame = TRIPMINE_WORLD;
|
||||
vector norm = trace_plane_normal;
|
||||
norm_x = 0 - norm_x;
|
||||
norm_y = 0 - norm_y;
|
||||
|
||||
mine.angles = vectoangles( [0,0,0.5] - norm );
|
||||
mine.angles = vectoangles( trace_plane_normal );
|
||||
setorigin(mine, trace_endpos - (v_forward * 4));
|
||||
mine.think = w_tripmine_ready;
|
||||
mine.nextthink = time + 4.0f;
|
||||
//mine.owner = pl;
|
||||
sound(mine, CHAN_WEAPON, "weapons/mine_charge.wav", 1, ATTN_NORM);
|
||||
sound(self, CHAN_WEAPON, "weapons/mine_deploy.wav", 1, ATTN_NORM);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.5f;
|
||||
|
|
|
@ -174,6 +174,14 @@ void Weapons_ViewAnimation(int i)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
int View_GetAnimation(void);
|
||||
int Weapons_GetAnimation(void)
|
||||
{
|
||||
return View_GetAnimation();
|
||||
}
|
||||
#endif
|
||||
|
||||
void Weapons_ViewPunchAngle(vector add)
|
||||
{
|
||||
#ifdef CSQC
|
||||
|
@ -242,7 +250,4 @@ void Weapons_ReloadWeapon(player pl, .int mag, .int ammo, int max)
|
|||
pl.(ammo) -= iNeed;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -86,5 +86,6 @@ void Weapons_UpdateAmmo(player pl, int a1, int a2, int a3);
|
|||
void Weapons_ReloadWeapon(player pl, .int mag, .int ammo, int max);
|
||||
#else
|
||||
string Weapons_GetPlayermodel(int id);
|
||||
int Weapons_GetAnimation(void);
|
||||
void Weapons_HUDPic(int w, int s, vector pos);
|
||||
#endif
|
||||
|
|
|
@ -25,10 +25,16 @@ typedef struct
|
|||
|
||||
void Font_Load ( string strFile, font_s &fntNew )
|
||||
{
|
||||
#ifdef CLASSIC_VGUI
|
||||
fntNew.iID = (int)loadfont( "", "gfx/conchars", "12", -1, 0, 0 );
|
||||
fntNew.iScale = 12;
|
||||
fntNew.vecColor = [255,200,0] / 255;
|
||||
fntNew.flAlpha = 1.0f;
|
||||
fntNew.iFlags = 0;
|
||||
#else
|
||||
string strTemp;
|
||||
string strFontPath;
|
||||
filestream fileFont = fopen( strFile, FILE_READ );
|
||||
|
||||
fntNew.iID = FONT_DEFAULT;
|
||||
fntNew.iScale = 8;
|
||||
fntNew.vecColor = '1 1 1';
|
||||
|
@ -65,6 +71,7 @@ void Font_Load ( string strFile, font_s &fntNew )
|
|||
}
|
||||
|
||||
fntNew.iID = (int)loadfont( "", strFontPath, ftos( (float)fntNew.iScale ), -1, 0, 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
void Font_DrawText ( vector vecOrigin, string strText, font_s fnt )
|
||||
|
@ -78,3 +85,19 @@ void Font_DrawField ( vector vecOrigin, vector vecSize, string strText, font_s f
|
|||
drawfont = (float)fnt.iID;
|
||||
drawtextfield( vecOrigin, vecSize, (float)iAlignFlags, strText );
|
||||
}
|
||||
|
||||
string Font_RGBtoHex(vector vecColor)
|
||||
{
|
||||
static string numtohex(float x) {
|
||||
x = rint(x * 15);
|
||||
if (x <= 9)
|
||||
return ftos(x);
|
||||
else {
|
||||
x -= 10;
|
||||
return sprintf("%c", 'A' + x);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return sprintf("^x%s%s%s", numtohex(vecColor[0]), numtohex(vecColor[1]), numtohex(vecColor[2]));
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#define CLASSIC_VGUI
|
||||
|
||||
#includelist
|
||||
../vgui/font.cpp
|
||||
../vgui/ui.cpp
|
||||
|
|
|
@ -7,13 +7,14 @@
|
|||
****/
|
||||
|
||||
font_s g_fntDefault;
|
||||
var int g_vguiWidgetCount;
|
||||
|
||||
#if 0
|
||||
#ifdef CLASSIC_VGUI
|
||||
#define UI_MAINCOLOR '255 200 0' / 255
|
||||
#define UI_MAINALPHA 255
|
||||
#else
|
||||
var vector UI_MAINCOLOR;
|
||||
var float UI_MAINALPHA;
|
||||
#else
|
||||
#define UI_MAINCOLOR '76 88 68' / 255
|
||||
#define UI_MAINALPHA 255
|
||||
#endif
|
||||
|
||||
int Util_MouseAbove(vector vecMousePos, vector vecPos, vector vecSize)
|
||||
|
@ -44,7 +45,6 @@ class CUIWidget
|
|||
virtual void( float, float, float, float ) Input;
|
||||
};
|
||||
|
||||
|
||||
void CUIWidget :: SetPos ( vector vecPos )
|
||||
{
|
||||
m_vecOrigin = vecPos;
|
||||
|
@ -97,9 +97,12 @@ void CUIWidget :: Draw ( void )
|
|||
void CUIWidget :: Input ( float flEVType, float flKey, float flChar, float flDevID )
|
||||
{
|
||||
CUIWidget wNext = this;
|
||||
|
||||
g_vguiWidgetCount = 0;
|
||||
do {
|
||||
wNext = wNext.m_next;
|
||||
if ( wNext && wNext.m_iFlags & 1 && wNext.m_parent.m_iFlags & 1 ) {
|
||||
g_vguiWidgetCount++;
|
||||
wNext.Input( flEVType, flKey, flChar, flDevID );
|
||||
}
|
||||
} while ( wNext );
|
||||
|
@ -107,7 +110,8 @@ void CUIWidget :: Input ( float flEVType, float flKey, float flChar, float flDev
|
|||
|
||||
void UISystem_Init ( void )
|
||||
{
|
||||
/*string strTemp;
|
||||
#ifndef CLASSIC_VGUI
|
||||
string strTemp;
|
||||
string strUIFile = "scripts/ui_style.txt";
|
||||
filestream fileUI = fopen( strUIFile, FILE_READ );
|
||||
|
||||
|
@ -130,8 +134,8 @@ void UISystem_Init ( void )
|
|||
fclose( fileUI );
|
||||
} else {
|
||||
error( sprintf( "[MENU] Cannot load UI file %s!", strUIFile ) );
|
||||
}*/
|
||||
|
||||
}
|
||||
#endif
|
||||
Font_Load( "scripts/ui_font.txt", g_fntDefault );
|
||||
precache_pic( "textures/ui/steam/icon_radiosel" );
|
||||
precache_pic( "textures/ui/steam/icon_radiounsel" );
|
||||
|
|
|
@ -78,8 +78,10 @@ void CUIButton :: SetFunc ( void() vFunc )
|
|||
|
||||
void CUIButton :: Draw ( void )
|
||||
{
|
||||
|
||||
#ifndef CLASSIC_VGUI
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, m_vecColor, m_flAlpha );
|
||||
|
||||
|
||||
if ( m_iFlags & BUTTON_DOWN ) {
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], '1 1 1', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], '0 0 0', 0.5f );
|
||||
|
@ -91,7 +93,16 @@ void CUIButton :: Draw ( void )
|
|||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], '1 1 1', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], '0 0 0', 0.5f );
|
||||
}
|
||||
|
||||
#else
|
||||
if ( m_iFlags & BUTTON_DOWN ) {
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, m_vecColor, 0.25f );
|
||||
}
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
#endif
|
||||
|
||||
if ( m_strTitle ) {
|
||||
if ( m_iFlags & BUTTON_LASTACTIVE ) {
|
||||
Font_DrawText( m_parent.m_vecOrigin + m_vecOrigin + [ 8, 8 ], m_strTitleActive, g_fntDefault );
|
||||
|
|
|
@ -65,8 +65,9 @@ void CUICheckbox :: SetValue ( int iValue )
|
|||
|
||||
void CUICheckbox :: Draw ( void )
|
||||
{
|
||||
#ifndef CLASSIC_VGUI
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, m_vecColor, m_flAlpha );
|
||||
|
||||
|
||||
if ( m_iFlags & CHECKBOX_DOWN ) {
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], '1 1 1', 0.5f );
|
||||
|
@ -79,7 +80,20 @@ void CUICheckbox :: Draw ( void )
|
|||
} else {
|
||||
drawpic( m_parent.m_vecOrigin + m_vecOrigin, "textures/ui/steam/icon_emptybox", '16 16', '1 1 1', 1.0f );
|
||||
}
|
||||
#else
|
||||
if ( m_iFlags & CHECKBOX_DOWN ) {
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
}
|
||||
|
||||
if ( m_iFlags & CHECKBOX_CHECKED ) {
|
||||
drawpic( m_parent.m_vecOrigin + m_vecOrigin, "textures/ui/steam/icon_checked", '16 16', m_vecColor, 1.0f );
|
||||
} else {
|
||||
drawpic( m_parent.m_vecOrigin + m_vecOrigin, "textures/ui/steam/icon_emptybox", '16 16', m_vecColor, 1.0f );
|
||||
}
|
||||
#endif
|
||||
if ( m_strTitle ) {
|
||||
Font_DrawText( m_parent.m_vecOrigin + m_vecOrigin + [ 24, 3 ], m_strTitle, g_fntDefault );
|
||||
}
|
||||
|
|
|
@ -30,7 +30,11 @@ void CUILabel :: SetSize ( vector vecSize )
|
|||
}
|
||||
void CUILabel :: SetTitle ( string strName )
|
||||
{
|
||||
#ifndef CLASSIC_VGUI
|
||||
m_strTitle = strName;
|
||||
#else
|
||||
m_strTitle = sprintf("%s%s", Font_RGBtoHex(UI_MAINCOLOR), strName);
|
||||
#endif
|
||||
SetSize( [ stringwidth( m_strTitle, TRUE, [ g_fntDefault.iScale, g_fntDefault.iScale ] ), 16 ] );
|
||||
}
|
||||
void CUILabel :: Draw ( void )
|
||||
|
|
|
@ -53,11 +53,18 @@ void CUIList :: Draw ( void )
|
|||
return;
|
||||
}
|
||||
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, '0 0 0', 0.5f );
|
||||
#ifdef CLASSIC_VGUI
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], UI_MAINCOLOR, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], UI_MAINCOLOR, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], UI_MAINCOLOR, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], UI_MAINCOLOR, 1.0f );
|
||||
#else
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, '0 0 0', 0.25f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], '1 1 1', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], '1 1 1', 0.5f );
|
||||
#endif
|
||||
|
||||
vector vecOffset = '8 8';
|
||||
|
||||
|
|
|
@ -56,18 +56,29 @@ void CUIMenuButton :: Draw ( void )
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef CLASSIC_VGUI
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, m_vecColor, m_flAlpha );
|
||||
if ( m_iFlags & MBUTTON_DOWN ) {
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], '0 0 0', 0.5f );
|
||||
|
||||
if ( m_iFlags & BUTTON_DOWN ) {
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], '1 1 1', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], '1 1 1', 0.5f );
|
||||
} else {
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], '1 1 1', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], '1 1 1', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], '1 1 1', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], '0 0 0', 0.5f );
|
||||
}
|
||||
#else
|
||||
if ( m_iFlags & BUTTON_DOWN ) {
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, m_vecColor, 0.25f );
|
||||
}
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
#endif
|
||||
|
||||
|
||||
if ( m_strIcon ) {
|
||||
|
|
|
@ -71,6 +71,7 @@ void CUIRadio :: SetFunc ( void() vFunc )
|
|||
|
||||
void CUIRadio :: Draw ( void )
|
||||
{
|
||||
#ifndef CLASSIC_VGUI
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, m_vecColor, m_flAlpha );
|
||||
|
||||
if ( m_iFlags & RADIO_DOWN ) {
|
||||
|
@ -79,13 +80,25 @@ void CUIRadio :: Draw ( void )
|
|||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], '1 1 1', 0.5f );
|
||||
}
|
||||
|
||||
if ( m_iFlags & RADIO_ACTIVE ) {
|
||||
drawpic( m_parent.m_vecOrigin + m_vecOrigin, "textures/ui/steam/icon_radiosel", '16 16', '1 1 1', 1.0f );
|
||||
} else {
|
||||
drawpic( m_parent.m_vecOrigin + m_vecOrigin, "textures/ui/steam/icon_radiounsel", '16 16', '1 1 1', 1.0f );
|
||||
}
|
||||
|
||||
#else
|
||||
if ( m_iFlags & RADIO_DOWN ) {
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
}
|
||||
if ( m_iFlags & RADIO_ACTIVE ) {
|
||||
drawpic( m_parent.m_vecOrigin + m_vecOrigin, "textures/ui/steam/icon_radiosel", '16 16', m_vecColor, 1.0f );
|
||||
} else {
|
||||
drawpic( m_parent.m_vecOrigin + m_vecOrigin, "textures/ui/steam/icon_radiounsel", '16 16', m_vecColor, 1.0f );
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( m_strTitle ) {
|
||||
Font_DrawText( m_parent.m_vecOrigin + m_vecOrigin + [ 24, 3 ], m_strTitle, g_fntDefault );
|
||||
}
|
||||
|
|
|
@ -57,11 +57,26 @@ void CUIScrollbar :: Draw ( void )
|
|||
{
|
||||
vector vecSize = [ 20, m_iLength ];
|
||||
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, vecSize, '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [vecSize[0], 1], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, vecSize[1] - 1], [vecSize[0], 1], '1 1 1', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, vecSize[1] - 2], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ vecSize[0] - 1, 1], [1, vecSize[1] - 2], '1 1 1', 0.5f );
|
||||
#ifndef CLASSIC_VGUI
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, m_vecColor, m_flAlpha );
|
||||
|
||||
if ( m_iFlags & BUTTON_DOWN ) {
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, vecSize[1] - 1], [vecSize[0], 1], '1 1 1', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [vecSize[0], 1], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, vecSize[1] - 2], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ vecSize[0] - 1, 1], [1, vecSize[1] - 2], '1 1 1', 0.5f );
|
||||
} else {
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, vecSize[1] - 1], [vecSize[0], 1], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [vecSize[0], 1], '1 1 1', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, vecSize[1] - 2], '1 1 1', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ vecSize[0] - 1, 1], [1, vecSize[1] - 2], '0 0 0', 0.5f );
|
||||
}
|
||||
#else
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, vecSize[1] - 1], [vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ vecSize[0] - 1, 1], [1, vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
#endif
|
||||
|
||||
vector vecUpPos = m_parent.m_vecOrigin + m_vecOrigin;
|
||||
vector vecDownPos = m_parent.m_vecOrigin + m_vecOrigin + [ 0, m_iLength - 20 ];
|
||||
|
@ -84,6 +99,7 @@ void CUIScrollbar :: Draw ( void )
|
|||
}
|
||||
|
||||
// Button UP
|
||||
#ifndef CLASSIC_VGUI
|
||||
drawfill( vecUpPos, '20 20', m_vecColor, m_flAlpha );
|
||||
if ( m_iFlags & SCROLLBAR_UP_DOWN ) {
|
||||
drawfill( vecUpPos, [20, 1], '0 0 0', 0.5f );
|
||||
|
@ -97,8 +113,23 @@ void CUIScrollbar :: Draw ( void )
|
|||
drawfill( vecUpPos + [ 19, 1], [1, 18], '0 0 0', 0.5f );
|
||||
}
|
||||
drawpic( vecUpPos + '2 2', "textures/ui/steam/icon_up", '16 16', '1 1 1', 1.0f );
|
||||
|
||||
#else
|
||||
if ( m_iFlags & SCROLLBAR_UP_DOWN ) {
|
||||
drawfill( vecUpPos, '20 20', m_vecColor, 0.25f );
|
||||
drawfill( vecUpPos, [20, 1], m_vecColor, 1.0f );
|
||||
drawfill( vecUpPos + [ 0, 19], [20, 1], m_vecColor, 1.0f );
|
||||
drawfill( vecUpPos + [ 0, 1], [1, 18], m_vecColor, 1.0f );
|
||||
drawfill( vecUpPos + [ 19, 1], [1, 18], m_vecColor, 1.0f );
|
||||
} else {
|
||||
drawfill( vecUpPos, [20, 1], '1 1 1', 0.5f );
|
||||
drawfill( vecUpPos + [ 0, 19], [20, 1], m_vecColor, 1.0f );
|
||||
drawfill( vecUpPos + [ 0, 1], [1, 18], m_vecColor, 1.0f );
|
||||
drawfill( vecUpPos + [ 19, 1], [1, 18], m_vecColor, 1.0f );
|
||||
}
|
||||
drawpic( vecUpPos + '2 2', "textures/ui/steam/icon_up", '16 16', m_vecColor, 1.0f );
|
||||
#endif
|
||||
// Button DOWN
|
||||
#ifndef CLASSIC_VGUI
|
||||
drawfill( vecDownPos, '20 20', m_vecColor, m_flAlpha );
|
||||
if ( m_iFlags & SCROLLBAR_DN_DOWN ) {
|
||||
drawfill( vecDownPos, [20, 1], '0 0 0', 0.5f );
|
||||
|
@ -112,6 +143,21 @@ void CUIScrollbar :: Draw ( void )
|
|||
drawfill( vecDownPos + [ 19, 1], [1, 18], '0 0 0', 0.5f );
|
||||
}
|
||||
drawpic( vecDownPos + '2 2', "textures/ui/steam/icon_down", '16 16', '1 1 1', 1.0f );
|
||||
#else
|
||||
if ( m_iFlags & SCROLLBAR_DN_DOWN ) {
|
||||
drawfill( vecDownPos, '20 20', m_vecColor, 0.25f );
|
||||
drawfill( vecDownPos, [20, 1], m_vecColor, 1.0f );
|
||||
drawfill( vecDownPos + [ 0, 19], [20, 1], m_vecColor, 1.0f );
|
||||
drawfill( vecDownPos + [ 0, 1], [1, 18], m_vecColor, 1.0f );
|
||||
drawfill( vecDownPos + [ 19, 1], [1, 18], m_vecColor, 1.0f );
|
||||
} else {
|
||||
drawfill( vecDownPos, [20, 1], m_vecColor, 1.0f );
|
||||
drawfill( vecDownPos+ [ 0, 19], [20, 1], m_vecColor, 1.0f );
|
||||
drawfill( vecDownPos + [ 0, 1], [1, 18], m_vecColor, 1.0f );
|
||||
drawfill( vecDownPos + [ 19, 1], [1, 18], m_vecColor, 1.0f );
|
||||
}
|
||||
drawpic( vecDownPos + '2 2', "textures/ui/steam/icon_down", '16 16', m_vecColor, 1.0f );
|
||||
#endif
|
||||
}
|
||||
|
||||
void CUIScrollbar :: Input ( float flEVType, float flKey, float flChar, float flDevID )
|
||||
|
|
|
@ -53,12 +53,19 @@ string CUITextBox :: GetText ( void )
|
|||
|
||||
void CUITextBox :: Draw ( void )
|
||||
{
|
||||
|
||||
#ifdef CLASSIC_VGUI
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
#else
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, m_vecSize, '0 0 0', 0.25f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin, [m_vecSize[0], 1], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], '1 1 1', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], '0 0 0', 0.5f );
|
||||
drawfill( m_parent.m_vecOrigin + m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], '1 1 1', 0.5f );
|
||||
|
||||
#endif
|
||||
m_flTime += frametime * 2;
|
||||
|
||||
// blinking cursor
|
||||
|
|
|
@ -69,8 +69,6 @@ void CUIWindow :: CUIWindow ( void )
|
|||
m_vecMaxSize = '640 480'; // TODO: Make this the screen res
|
||||
|
||||
m_strTitle = "Window";
|
||||
|
||||
SetIcon( "textures/gfx/icon" );
|
||||
|
||||
m_btnClose = spawn( CUIButton );
|
||||
m_btnClose.SetTitle( __NULL__ );
|
||||
|
@ -158,20 +156,37 @@ void CUIWindow :: Show ( void )
|
|||
|
||||
void CUIWindow :: Draw ( void )
|
||||
{
|
||||
|
||||
#ifdef CLASSIC_VGUI
|
||||
drawfill( m_vecOrigin, m_vecSize, [0,0,0], 0.5);
|
||||
drawfill( m_vecOrigin, [m_vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], m_vecColor, 1.0f );
|
||||
drawfill( m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
drawfill( m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], m_vecColor, 1.0f );
|
||||
|
||||
if ( m_iFlags & WINDOW_CANRESIZE ) {
|
||||
drawpic( m_vecOrigin + m_vecSize - '16 16', "textures/ui/steam/icon_resizer", '16 16', m_vecColor, 1.0f );
|
||||
}
|
||||
#else
|
||||
drawfill( m_vecOrigin, m_vecSize, m_vecColor, m_flAlpha );
|
||||
drawfill( m_vecOrigin, [m_vecSize[0], 1], '1 1 1', 0.5f );
|
||||
drawfill( m_vecOrigin + [ 0, m_vecSize[1] - 1], [m_vecSize[0], 1], '0 0 0', 0.5f );
|
||||
drawfill( m_vecOrigin + [ 0, 1], [1, m_vecSize[1] - 2], '1 1 1', 0.5f );
|
||||
drawfill( m_vecOrigin + [ m_vecSize[0] - 1, 1], [1, m_vecSize[1] - 2], '0 0 0', 0.5f );
|
||||
|
||||
if ( m_strTitle ) {
|
||||
Font_DrawText( m_vecOrigin + [ 26, 8 ], m_strTitle, g_fntDefault );
|
||||
drawpic( m_vecOrigin + [ 4, 4 ], m_strIcon, '16 16', '1 1 1', 1.0f );
|
||||
}
|
||||
|
||||
if ( m_iFlags & WINDOW_CANRESIZE ) {
|
||||
drawpic( m_vecOrigin + m_vecSize - '16 16', "textures/ui/steam/icon_resizer", '16 16', '1 1 1', 1.0f );
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( m_strTitle ) {
|
||||
if ( m_strIcon ) {
|
||||
Font_DrawText( m_vecOrigin + [ 26, 8 ], m_strTitle, g_fntDefault );
|
||||
drawpic( m_vecOrigin + [ 4, 4 ], m_strIcon, '16 16', '1 1 1', 1.0f );
|
||||
} else {
|
||||
Font_DrawText( m_vecOrigin + [ 8, 8 ], m_strTitle, g_fntDefault );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UI_DEVELOPER
|
||||
if ( m_iFlags & WINDOW_DRAGGING ) {
|
||||
|
|
BIN
cstrike/data.pk3dir/gfx/vgui/buymenu.tga
Normal file
BIN
cstrike/data.pk3dir/gfx/vgui/buymenu.tga
Normal file
Binary file not shown.
Loading…
Reference in a new issue