diff --git a/Source/Client/Draw.c b/Source/Client/Draw.c index 877b9e79..8a57fe28 100755 --- a/Source/Client/Draw.c +++ b/Source/Client/Draw.c @@ -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(); diff --git a/Source/Client/HUD.c b/Source/Client/HUD.c index 76175e15..23f4c79e 100755 --- a/Source/Client/HUD.c +++ b/Source/Client/HUD.c @@ -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 ); diff --git a/Source/Client/Makefile b/Source/Client/Makefile new file mode 100644 index 00000000..d9a657d5 --- /dev/null +++ b/Source/Client/Makefile @@ -0,0 +1,4 @@ +CC=fteqcc + +all: + $(CC) diff --git a/Source/FreeCS-CE.prj b/Source/FreeCS-CE.prj index 598e8eae..49ac912b 100644 --- a/Source/FreeCS-CE.prj +++ b/Source/FreeCS-CE.prj @@ -72,7 +72,7 @@ - + @@ -114,11 +114,6 @@ - - - - - - + diff --git a/Source/Globals.h b/Source/Globals.h index d8b48217..68ce3516 100755 --- a/Source/Globals.h +++ b/Source/Globals.h @@ -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; diff --git a/Source/Menu/Draw.c b/Source/Menu/Draw.c index 66575cca..d2804fdf 100644 --- a/Source/Menu/Draw.c +++ b/Source/Menu/Draw.c @@ -43,9 +43,6 @@ void m_draw( vector vScreenSize ) { return; } - // temporary - vMousePos = getmousepos(); - if ( vVideoSize != vScreenSize ) { vVideoSize = vScreenSize; vMenuOffset_x = vVideoSize_x / 2 - 320; diff --git a/Source/Menu/Makefile b/Source/Menu/Makefile new file mode 100644 index 00000000..d9a657d5 --- /dev/null +++ b/Source/Menu/Makefile @@ -0,0 +1,4 @@ +CC=fteqcc + +all: + $(CC) diff --git a/Source/Menu/MenuConfiguration.c b/Source/Menu/MenuConfiguration.c index b392f5df..9f0a8e18 100755 --- a/Source/Menu/MenuConfiguration.c +++ b/Source/Menu/MenuConfiguration.c @@ -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] ); } diff --git a/Source/Menu/Objects.c b/Source/Menu/Objects.c index 84b6caab..3c0c96c7 100644 --- a/Source/Menu/Objects.c +++ b/Source/Menu/Objects.c @@ -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 ); +} \ No newline at end of file diff --git a/Source/Server/Makefile b/Source/Server/Makefile new file mode 100644 index 00000000..d9a657d5 --- /dev/null +++ b/Source/Server/Makefile @@ -0,0 +1,4 @@ +CC=fteqcc + +all: + $(CC) diff --git a/Source/Shared/WeaponC4Bomb.c b/Source/Shared/WeaponC4Bomb.c index 260c5c90..07aef777 100755 --- a/Source/Shared/WeaponC4Bomb.c +++ b/Source/Shared/WeaponC4Bomb.c @@ -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 diff --git a/Source/Shared/WeaponFlashbang.c b/Source/Shared/WeaponFlashbang.c index 567827f9..734108a0 100755 --- a/Source/Shared/WeaponFlashbang.c +++ b/Source/Shared/WeaponFlashbang.c @@ -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 ); } diff --git a/Source/Shared/WeaponHEGrenade.c b/Source/Shared/WeaponHEGrenade.c index c0f37448..991f2552 100755 --- a/Source/Shared/WeaponHEGrenade.c +++ b/Source/Shared/WeaponHEGrenade.c @@ -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 -} \ No newline at end of file +} diff --git a/Source/Shared/WeaponSmokeGrenade.c b/Source/Shared/WeaponSmokeGrenade.c index d555d728..bc585a7b 100755 --- a/Source/Shared/WeaponSmokeGrenade.c +++ b/Source/Shared/WeaponSmokeGrenade.c @@ -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 -} \ No newline at end of file +}