Configuration Update

Merge branch 'master' of https://github.com/eukara/FreeCS
This commit is contained in:
Marco Cawthorne 2017-11-10 15:49:19 -06:00
commit bcae0060bc
14 changed files with 201 additions and 42 deletions

View file

@ -176,9 +176,6 @@ void CSQC_UpdateView( float fWinWidth, float fWinHeight, float fGameFocus ) {
Nightvision_PostDraw();
if( fGameFocus == TRUE ) {
// temporary
vMousePos = getmousepos();
// The spectator sees things... differently
if ( getplayerkeyvalue( player_localnum, "*spec" ) != "0" ) {
VGUI_DrawSpectatorHUD();

View file

@ -42,7 +42,7 @@ float vHUDNumPos[10] = {
};
// Ditto
vector vHUDCalPos[11] = {
vector vHUDCalPos[15] = {
'0 0 0',
'0.09375 0.28125 0', // 50AE
'0.28125 0.28125 0', // 762MM
@ -54,6 +54,10 @@ vector vHUDCalPos[11] = {
'0.375 0.28125 0', // 45ACP
'0.46875 0.28125 0', // 357SIG
'0.46875 0.375 0', // 57MM
'0.375 0.375', // C4
'0.5625 0.375', // SMOKE
'0.28125 0.375', // HE
'0.1875 0.375', // FLASH
};
/*
@ -331,6 +335,9 @@ Draws the current clip, the amount of ammo for the caliber and a matching calibe
void HUD_DrawAmmo( void ) {
static float fOldMag, fOldCal;
static float fAmmoAlpha;
static vector vAmmoMagPos;
static vector vAmmoCalPos;
if ( getstatf( STAT_ACTIVEWEAPON ) == WEAPON_KNIFE || getstatf( STAT_ACTIVEWEAPON ) == WEAPON_C4BOMB ) {
return;
}
@ -345,13 +352,18 @@ void HUD_DrawAmmo( void ) {
fAmmoAlpha = HUD_ALPHA;
}
vector vAmmoMagPos = [ vVideoResolution_x - 142, vVideoResolution_y - 42 ];
HUD_DrawNums( getstatf( STAT_CURRENT_MAG ), vAmmoMagPos, fAmmoAlpha, vHUDColor );
drawsubpic( [vVideoResolution_x - 118, vVideoResolution_y - 42], '3 25', HUD_NUMFILE_LAYER, [0.9375, 0], [ 0.01171875, 0.09765625 ], vHUDColor, fAmmoAlpha, DRAWFLAG_ADDITIVE );
vector vAmmoCalPos = [ vVideoResolution_x - 64, vVideoResolution_y - 42 ];
HUD_DrawNums( getstatf( STAT_CURRENT_CALIBER ), vAmmoCalPos, fAmmoAlpha, vHUDColor );
if ( wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iCaliber < 11 ) {
vAmmoMagPos = [ vVideoResolution_x - 142, vVideoResolution_y - 42 ];
HUD_DrawNums( getstatf( STAT_CURRENT_MAG ), vAmmoMagPos, fAmmoAlpha, vHUDColor );
drawsubpic( [vVideoResolution_x - 118, vVideoResolution_y - 42], '3 25', HUD_NUMFILE_LAYER, [0.9375, 0], [ 0.01171875, 0.09765625 ], vHUDColor, fAmmoAlpha, DRAWFLAG_ADDITIVE );
vAmmoCalPos = [ vVideoResolution_x - 64, vVideoResolution_y - 42 ];
HUD_DrawNums( getstatf( STAT_CURRENT_CALIBER ), vAmmoCalPos, fAmmoAlpha, vHUDColor );
} else {
vAmmoMagPos = [ vVideoResolution_x - 64, vVideoResolution_y - 42 ];
HUD_DrawNums( getstatf( STAT_CURRENT_MAG ), vAmmoMagPos, fAmmoAlpha, vHUDColor );
}
// Caliber icon
drawsubpic( vVideoResolution - '42 42', '24 24', HUD_NUMFILE_LAYER, vHUDCalPos[ wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iCaliber ], [ NUMSIZE_X, NUMSIZE_X ], vHUDColor, fAmmoAlpha, DRAWFLAG_ADDITIVE );

4
Source/Client/Makefile Normal file
View file

@ -0,0 +1,4 @@
CC=fteqcc
all:
$(CC)

View file

@ -72,7 +72,7 @@
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Objects.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\progs.src" />
</category>
<category name="Shared" expanded="no">
<category name="Shared" expanded="yes">
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\Animations.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\BaseMelee.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\Effects.c" />
@ -114,11 +114,6 @@
</project>
<workspace version="Crimson Editor 3.60">
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\MenuMain.c" linenum="34" placement="2:3:-1:-1:-8:-30:125:125:980:590" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\MenuMultiplayer.c" linenum="1" placement="0:1:-1:-1:-8:-30:150:150:1009:619" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\MenuConfiguration.c" linenum="130" placement="0:1:-1:-1:-8:-30:175:175:1034:644" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Input.c" linenum="125" placement="0:1:-1:-1:-8:-30:200:200:1059:669" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Builtins.h" linenum="1153" placement="0:1:-1:-1:-8:-30:225:225:1084:694" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\Event.c" linenum="527" placement="0:1:-1:-1:-8:-30:0:0:859:469" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\MenuConfiguration.c" linenum="1" placement="2:3:-1:-1:-4:-23:176:176:1058:608" />
</workspace>

View file

@ -133,7 +133,11 @@ enum {
CALIBER_BUCKSHOT,
CALIBER_45ACP,
CALIBER_357SIG,
CALIBER_57MM
CALIBER_57MM,
EXPLOSIVE_C4,
EXPLOSIVE_SMOKE,
EXPLOSIVE_HE,
EXPLOSIVE_FLASH,
};
.int iAmmo_50AE;

View file

@ -43,9 +43,6 @@ void m_draw( vector vScreenSize ) {
return;
}
// temporary
vMousePos = getmousepos();
if ( vVideoSize != vScreenSize ) {
vVideoSize = vScreenSize;
vMenuOffset_x = vVideoSize_x / 2 - 320;

4
Source/Menu/Makefile Normal file
View file

@ -0,0 +1,4 @@
CC=fteqcc
all:
$(CC)

View file

@ -26,16 +26,18 @@ Initializes external control scheme file, etc.
=================
*/
int iActCount;
int iResCount;
string *strActBind;
string *strActDescr;
string *strResolution;
void Menu_Configuration_Init( void ) {
int iCount = 0;
string sTemp;
filestream fileActList = fopen( "gfx/shell/kb_act.lst", FILE_READ );
filestream fileSettings = fopen( "gfx/shell/kb_act.lst", FILE_READ );
// Count the valid entries.
if ( fileActList >= 0 ) {
while ( ( sTemp = fgets( fileActList ) ) ) {
if ( fileSettings >= 0 ) {
while ( ( sTemp = fgets( fileSettings ) ) ) {
if ( tokenize_console( sTemp ) == 2 ) {
iActCount++;
}
@ -47,10 +49,10 @@ void Menu_Configuration_Init( void ) {
// Reset filestream position after allocating the strings
strActBind = memalloc( sizeof( string ) * iActCount );
strActDescr = memalloc( sizeof( string ) * iActCount );
fseek( fileActList, 0 );
fseek( fileSettings, 0 );
// Parse the bindings in
while ( ( sTemp = fgets( fileActList ) ) ) {
while ( ( sTemp = fgets( fileSettings ) ) ) {
// Tokenize and just parse this stuff in
if ( tokenize_console( sTemp ) == 2 ) {
strActBind[ iCount ] = argv( 0 );
@ -59,7 +61,31 @@ void Menu_Configuration_Init( void ) {
iCount++;
}
}
fclose( fileActList );
fclose( fileSettings );
fileSettings = fopen( "resolutions.txt", FILE_READ );
// Count the valid entries.
if ( fileSettings >= 0 ) {
while ( ( sTemp = fgets( fileSettings ) ) ) {
if ( tokenize_console( sTemp ) == 2 ) {
iResCount++;
}
}
} else {
error( "Cannot parse resolutions.txt!" );
}
// Reset filestream position after allocating the strings
strResolution = memalloc( sizeof( string ) * iResCount );
fseek( fileSettings, 0 );
// Parse the bindings in
iCount = 0;
while ( ( sTemp = fgets( fileSettings ) ) ) {
strResolution[ iCount ] = sTemp;
iCount++;
}
fclose( fileSettings );
}
/*
@ -67,7 +93,7 @@ void Menu_Configuration_Init( void ) {
Menu_Configuration_ButtonOK
=================
*/
void Menu_Configuration_ButtonOK( void ) {
void Menu_Configuration_ButtonOK( void ) {
iMenu = MENU_CONFIGURATION;
}
@ -86,7 +112,61 @@ Menu_Configuration_Video
=================
*/
void Menu_Configuration_Video( void ) {
Object_Button( '32 148', BTN_OK, Menu_Configuration_ButtonOK, fButtonAlpha[0] );
static int iScrollRes = 0;
static int iSelectedResolution = -1;
static void Video_Apply( void ) {
if ( iSelectedResolution != -1 ) {
tokenizebyseparator( strResolution[ iSelectedResolution ], "x", " " );
cvar_set( "vid_width", argv( 0 ) );
cvar_set( "vid_height", argv( 1 ) );
localcmd( "vid_restart\n" );
}
}
static void Video_DisplayRes( vector vPosition, int i, __inout int iSelected ) {
float fItemAlpha = 1.0f;
vPosition += vMenuOffset;
if ( Menu_InputCheckMouse( [ vPosition_x, vPosition_y ], [ 284, 8 ] ) == TRUE ) {
if ( fMouseClick == TRUE ) {
if ( iSelected != i ) {
iSelected = i;
fInputKeyCode = 0;
fMouseClick = FALSE;
}
}
} else {
fItemAlpha = 0.8;
}
if ( iSelected == i ) {
drawfill( [ vPosition_x, vPosition_y - 1 ], [ 156, 10 ], '1 1 1', 0.5, 2 );
drawstring( [vPosition_x + 8, vPosition_y], strResolution[ i ], '8 8 0', '1 1 1', 1.0f, FALSE );
} else {
drawstring( [vPosition_x + 8, vPosition_y], strResolution[ i ], '8 8 0', '1 1 1', fItemAlpha, FALSE );
}
}
Object_Label( '196 148', _("VIDEO_RES"), '8 8' );
Object_Frame( '196 160', '164 300' );
Object_Scrollbar( '372 160', 284, iScrollRes );
Menu_SetClipArea( '196 160', '164 300' );
vector vListPos = '200 165';
vListPos_y -= fabs( ( ( iResCount - 8 ) * 10 ) * ( iScrollRes / 300 ) );
for ( int i = 0; i < iResCount; i++ ) {
Video_DisplayRes( vListPos, i, iSelectedResolution );
vListPos_y += 10;
}
Menu_ResetClipArea();
Object_Button( '32 148', BTN_OK, Video_Apply, fButtonAlpha[0] );
Object_Button( '32 180', BTN_CANCEL, Menu_Configuration_ButtonCancel, fButtonAlpha[1] );
}
@ -96,6 +176,23 @@ Menu_Configuration_Audio
=================
*/
void Menu_Configuration_Audio( void ) {
static int iAudioMaster = -1;
static int iLastMaster = -1;
// Page is first opened, initialize the scrollbar variables
if ( iAudioMaster == -1 ) {
iAudioMaster = cvar( "volume" ) * 256;
iLastMaster = iAudioMaster;
}
Object_Label( '196 148', _("AUDIO_MASTER"), '8 8' );
Object_ScrollbarH( '196 160', 256, iAudioMaster );
if ( iAudioMaster != iLastMaster ) {
localcmd( sprintf( "volume %f\n", iAudioMaster / 256 ) );
iLastMaster = iAudioMaster;
}
Object_Button( '32 148', BTN_OK, Menu_Configuration_ButtonOK, fButtonAlpha[0] );
Object_Button( '32 180', BTN_CANCEL, Menu_Configuration_ButtonCancel, fButtonAlpha[1] );
}

View file

@ -185,13 +185,13 @@ Note: Only have one at a time.
=================
*/
void Object_Scrollbar( vector vPosition, int iHeight, __inout int iProgress ) {
Object_Frame( vPosition, [ 16, iHeight ] );
Object_Frame( vPosition, [ 16, iHeight + 16 ] );
vPosition += vMenuOffset;
iHeight -= 16;
if ( ( iScrollbarHold == TRUE ) || ( Menu_InputCheckMouse( [vPosition_x, vPosition_y + iProgress ], '16 16' ) == TRUE ) ) {
if ( fMouseClick == TRUE ) {
iProgress = ( vMousePos_y - vPosition_y ) - 8;
iProgress = ( vMousePos_y - vPosition_y );
iScrollbarHold = TRUE;
}
}
@ -209,9 +209,35 @@ void Object_Scrollbar( vector vPosition, int iHeight, __inout int iProgress ) {
} else if ( iProgress > iHeight ) {
iProgress = iHeight;
}
iHeight += 16;
drawfill( [vPosition_x, vPosition_y + iProgress], [ 16, 16 ], autocvar_menu_fgcolor, 1.0f );
}
void Object_ScrollbarH( vector vPosition, int iWidth, __inout int iProgress ) {
Object_Frame( vPosition, [ iWidth + 16, 16 ] );
vPosition += vMenuOffset;
if ( ( iScrollbarHold == TRUE ) || ( Menu_InputCheckMouse( [vPosition_x + iProgress, vPosition_y ], '16 16' ) == TRUE ) ) {
if ( fMouseClick == TRUE ) {
iProgress = ( vMousePos_x - vPosition_x );
iScrollbarHold = TRUE;
}
}
if ( fScrollWheel == SCROLL_DOWN ) {
iProgress += 2;
fScrollWheel = SCROLL_NONE;
} else if ( fScrollWheel == SCROLL_UP ) {
iProgress -= 2;
fScrollWheel = SCROLL_NONE;
}
if ( iProgress < 0 ) {
iProgress = 0;
} else if ( iProgress > iWidth ) {
iProgress = iWidth;
}
drawfill( [vPosition_x + iProgress, vPosition_y ], [ 16, 16 ], autocvar_menu_fgcolor, 1.0f );
}

4
Source/Server/Makefile Normal file
View file

@ -0,0 +1,4 @@
CC=fteqcc
all:
$(CC)

View file

@ -29,7 +29,7 @@ weaponinfo_t wptC4BOMB = {
WEAPON_C4BOMB, // Identifier
SLOT_GRENADE,
0, // Price
CALIBER_50AE, // Caliber ID
EXPLOSIVE_C4, // Caliber ID
1.0, // Max Player Speed
0, // Bullets Per Shot
0, // Clip/MagSize

View file

@ -30,7 +30,7 @@ weaponinfo_t wptFLASHBANG = {
WEAPON_FLASHBANG, // Identifier
SLOT_GRENADE, // Slot
200, // Price
0, // Caliber ID
EXPLOSIVE_FLASH, // Caliber ID
1.0, // Max Player Speed
1, // Bullets Per Shot
1, // Clip/MagSize
@ -119,6 +119,12 @@ void WeaponFLASHBANG_Throw( void ) {
remove( self );
}
static void Weapon_FLASHBANG_Touch( void ) {
if ( other.solid == SOLID_TRIGGER ) {
return;
}
if ( other == self.owner ) {
return;
}
if ( other.classname == "func_breakable" ) {
Damage_Apply( other, self, 10, self.origin );
}

View file

@ -30,7 +30,7 @@ weaponinfo_t wptHEGRENADE = {
WEAPON_HEGRENADE, // Identifier
SLOT_GRENADE, // Slot
200, // Price
0, // Caliber ID
EXPLOSIVE_HE, // Caliber ID
1.0, // Max Player Speed
1, // Bullets Per Shot
1, // Clip/MagSize
@ -101,9 +101,16 @@ void WeaponHEGRENADE_Throw( void ) {
remove( self );
}
static void Weapon_HEGRENADE_Touch( void ) {
if ( other.solid == SOLID_TRIGGER ) {
return;
}
if ( other == self.owner ) {
return;
}
if ( other.classname == "func_breakable" && other.material == MATERIAL_GLASS ) {
Damage_Apply( other, self, 10, self.origin );
}
sound( self, CHAN_WEAPON, "weapons/he_bounce-1.wav", 1, ATTN_NORM );
}
@ -115,7 +122,7 @@ void WeaponHEGRENADE_Throw( void ) {
vector vDir = aim ( self, 100000 );
eNade.owner = self;
eNade.solid = SOLID_TRIGGER;
eNade.solid = SOLID_TRIGGER; // This is so grenades will not get slowed down by windows they touch
eNade.angles = vectoangles( vDir );
eNade.velocity = ( vDir * 800 );
eNade.avelocity = ( v_forward * 600 );
@ -147,4 +154,4 @@ void WeaponHEGRENADE_Release( void ) {
self.think = WeaponHEGRENADE_Throw;
}
#endif
}
}

View file

@ -30,7 +30,7 @@ weaponinfo_t wptSMOKEGRENADE = {
WEAPON_SMOKEGRENADE, // Identifier
SLOT_GRENADE, // Slot
200, // Price
0, // Caliber ID
EXPLOSIVE_SMOKE, // Caliber ID
1.0, // Max Player Speed
1, // Bullets Per Shot
1, // Clip/MagSize
@ -107,6 +107,12 @@ void WeaponSMOKEGRENADE_Throw( void ) {
self.nextthink = time + 5.0f;
}
static void Weapon_SMOKEGRENADE_Touch( void ) {
if ( other.solid == SOLID_TRIGGER ) {
return;
}
if ( other == self.owner ) {
return;
}
if ( other.classname == "func_breakable" ) {
Damage_Apply( other, self, 10, self.origin );
}
@ -152,4 +158,4 @@ void WeaponSMOKEGRENADE_Release( void ) {
self.think = WeaponSMOKEGRENADE_Throw;
}
#endif
}
}