Merge pull request #155 from ENSL/v33b8

Version 3.3b8
This commit is contained in:
pierow 2024-03-21 14:12:46 -04:00 committed by GitHub
commit acc1056ec8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
149 changed files with 67844 additions and 791 deletions

Binary file not shown.

View file

@ -1,5 +1,4 @@
//Alien cfg that is part of a default installation on the NS Launcher.
//Activated by joining or spawning on aliens.
//bind "mouse2" "+movement"
//psoff
//bind "mouse2" "+movement"

View file

@ -66,7 +66,7 @@ ati_npatch "0"
ati_subdiv "0"
bgmvolume "1.000000"
bottomcolor "144.889999"
brightness "5"
brightness "0"
cl_allowdownload "1"
cl_allowupload "1"
cl_autohelp "1.0"
@ -80,9 +80,9 @@ cl_dlmax "128"
cl_download_ingame "1"
cl_dynamiclights "0"
cl_forcedefaultfov "0"
cl_gammaramp "0"
cl_highdetail "1"
cl_himodels "0"
cl_hudmapzoom "2"
cl_iconb "221"
cl_icong "149"
cl_iconr "0"
@ -90,14 +90,17 @@ cl_idealpitchscale "0.8"
cl_labelhivesight "1"
cl_labelmaps "1"
cl_lc "1"
cl_intensity "0.55"
cl_intensityalt "1"
cl_logocolor "#Valve_Orange"
cl_logofile "lambda"
cl_lw "1"
cl_musicdelay "90"
cl_musicdelay "-1"
cl_musicdirectory ""
cl_musicvolume "155"
cl_musicenabled "0"
cl_musicvolume "0.6"
cl_musicenabled "1"
cl_particleinfo "0"
cl_postprocessing "1"
cl_quickselecttime ".15"
cl_timeout "60"
cl_updaterate "100"
@ -108,15 +111,16 @@ crosshair "0"
fps_max "250"
fps_override "1"
fps_modem "0.0"
gamma "3"
gl_vsync "0"
gamma "2.95"
gl_dither "1"
gl_flipmatrix "0"
gl_fog "1"
gl_monolights "0"
gl_overbright "1"
gl_overbright "0"
gl_polyoffset "0.1"
gl_texturemode "GL_LINEAR_MIPMAP_LINEAR"
gl_use_shaders "0"
gl_vsync "0"
hisound "1"
hpk_maxsize "4"
hud_capturemouse "1"
@ -135,12 +139,13 @@ m_side "0.8"
m_yaw "0.022"
model "barney"
MP3FadeTime "2.0"
MP3Volume "0"
MP3Volume "0.45"
mp_decals "300"
name "NSPlayer"
net_graph "0"
net_graphpos "1"
net_scale "5"
rate "100000"
r_bmodelhighfrac "5.0"
r_detailtextures "0"
s_a3d "0.0"
@ -175,11 +180,15 @@ voice_scale "1"
volume "0.500000"
m_rawinput "1"
zoom_sensitivity_ratio "1"
lightgamma "2"
lightgamma "1.81"
ex_interp "0.05"
cl_cross "1"
rate "30000"
cl_bob "0"
cl_bob "0.006"
cl_bobcycle "0.85"
cl_bobup "0.5"
cl_weaponswap "2"
cl_pistoltrigger "1"
+mlook
exec userconfig.cfg

View file

@ -83,3 +83,14 @@ mp_uplink 0
// Needed so this file is executed on map change, like pre-NS v2.1
mapchangecfgfile listenserver.cfg
//Post HL 25th Aniversary update
sv_rollangle 0
sv_allow_shaders 0
// Set rate limits, otherwise they initialize to bad values
sv_maxupdaterate 102
sv_maxunlag 0.3
sv_maxrate 0
sv_minrate 20000
sv_minupdaterate 30

View file

@ -1,6 +1,4 @@
//Marine cfg that is part of a default installation on the NS Launcher.
//Activated by pressing joining or spawning on marines.
//bind "mouse2" "impulse 10"
//pson
//bind "mouse2" "impulse 10"

View file

@ -3,9 +3,10 @@
// =============================
delay 60.0 // delays game for 60 seconds
multicast 0 // multicast disabled
rate 10000 // amount of data proxy gets from match server
maxclientrate 8000 // maximum client data from HLTV proxy
updaterate 20 // get 20 updates per second from server
rate 100000 // amount of data proxy gets from match server
maxrate 20000 // 2024 - Valve's readme references this instead of maxclientrate so I'm including both
maxclientrate 20000 // maximum client data from HLTV proxy
updaterate 60 // get 60 updates per second from server
logfile 1 // log events in proxy.log
chatmode 1 // local chatting on
name "NS-HLTV" // HLTV Host Name

View file

@ -0,0 +1,44 @@
// Bright Lighting
brightness "2"
gamma "3"
lightgamma "2"
cl_dynamiclights "0"
cl_postprocess "0"
cl_intensity "0"
cl_intensityalt "1"
// High detail particles
//cl_high_detail "0"
// No bobbing
cl_bob "0"
//cl_bobcycle "0.8"
//cl_bobup "0.5"
cl_bobview "0"
// Audio
cl_ambientsound "0"
cl_musicenabled "0"
//cl_musicvolume "0.6"
//cl_musicdelay "-1"
// HUD
hud_style "2"
hud_mapstyle "3"
//hud_mapnames "5"
cl_hudmapzoom "2"
// New crosshairs
crosshair "0"
cl_cross "1"
cl_cross_scaling "0"
cl_weaponcfgs "1"
echo " "
echo "----------------------------------------------------------------------"
echo "Competitive NS preset applied:"
echo "----------------------------------------------------------------------"
echo "- Bright lighting settings with overbright shader disabled"
echo "- Nine Legends competitive HUD and new crosshair system"
echo "- No weapon or view bobbing"
echo "- Ambient sound and music tracks disabled"

View file

@ -0,0 +1,47 @@
// Lighting
brightness "0"
gamma "2.95"
lightgamma "1.81"
cl_dynamiclights "0"
cl_postprocess "1"
cl_intensity "0.55"
cl_intensityalt "1"
// High detail particles
cl_high_detail "1"
// Bobbing
cl_bob "0.006"
cl_bobcycle "0.85"
cl_bobup "0.5"
cl_bobview "0"
// Reduced ambient and music volume
cl_ambientsound "0.6"
cl_musicenabled "1"
cl_musicvolume "0.6"
cl_musicdelay "-1"
// HUD
hud_style "1"
hud_mapstyle "3"
//hud_mapnames "5"
cl_hudmapzoom "2"
// New crosshairs
crosshair "0"
cl_cross "1"
cl_cross_scaling "1"
cl_weaponcfgs "2"
echo " "
echo "----------------------------------------------------------------------"
echo "NS 3.3 graphics and audio preset applied"
echo "----------------------------------------------------------------------"
echo "- Brighter shadows. Reduced overbrightening. Flashing dynamic lights disabled."
echo "- Minimal marine HUD and new crosshair system."
echo "- Reduced weapon bobbing and no view bobbing."
echo "- Reduced ambient and music track volumes. Music tracks play only once at the start of the round."
echo " "

View file

@ -0,0 +1,44 @@
// Lighting
brightness "1"
gamma "2.5"
lightgamma "2.5"
cl_dynamiclights "1"
cl_postprocess "1"
cl_intensity "1"
cl_intensityalt "0"
// High detail particles
cl_high_detail "1"
// Bobbing
cl_bob "0.01"
cl_bobcycle "0.8"
cl_bobup "0.5"
cl_bobview "1"
// Audio
cl_ambientsound "1.25" // 1 is the old ambient default volume, but the old master volume was 0.8 before ambient sound volume scaled with the volume command
cl_musicenabled "1"
cl_musicvolume "1.25" // 1 is the old music default volume, but the old master volume was 0.8 before music volume scaled with the volume command
cl_musicdelay "90"
// HUD
hud_style "0"
hud_mapstyle "1"
//hud_mapnames "0"
cl_hudmapzoom "3"
// Legacy sprite crosshairs
crosshair "1"
cl_cross "0"
echo " "
echo "----------------------------------------------------------------------"
echo "Classic NS graphics and audio preset applied:"
echo "----------------------------------------------------------------------"
echo "- Original lighting."
echo "- Original HUD and crosshairs."
echo "- Original weapon and view bob."
echo "- Original mix volumes for ambient sound and music."
echo " "

View file

@ -0,0 +1,5 @@
rate "100000"
cl_cmdrate "100"
cl_updaterate "100"
cl_cmdbackup "2"
ex_interp "0.01"

View file

@ -0,0 +1,5 @@
rate "100000"
cl_cmdrate "100"
cl_updaterate "100"
cl_cmdbackup "2"
ex_interp "0.02"

View file

@ -0,0 +1,5 @@
rate "100000"
cl_cmdrate "100"
cl_updaterate "100"
cl_cmdbackup "2"
ex_interp "0.033333"

View file

@ -0,0 +1,5 @@
rate "100000"
cl_cmdrate "100"
cl_updaterate "100"
cl_cmdbackup "2"
ex_interp "0.05"

View file

@ -0,0 +1,5 @@
rate "100000"
cl_cmdrate "100"
cl_updaterate "60"
cl_cmdbackup "2"
ex_interp "0.05"

View file

@ -0,0 +1,5 @@
rate "100000"
cl_cmdrate "60"
cl_updaterate "60"
cl_cmdbackup "2"
ex_interp "0.05"

View file

@ -0,0 +1,5 @@
rate "30000"
cl_cmdrate "60"
cl_updaterate "60"
cl_cmdbackup "2"
ex_interp "0.1"

View file

@ -0,0 +1,5 @@
rate "30000"
cl_cmdrate "60"
cl_updaterate "30"
cl_cmdbackup "2"
ex_interp "0.1"

View file

@ -0,0 +1,5 @@
rate "20000"
cl_cmdrate "60"
cl_updaterate "30"
cl_cmdbackup "2"
ex_interp "0.1"

View file

@ -1,18 +1,43 @@
"GameMenu"
{
"1"
{
"label" "Apply classic NS preset"
"command" "engine nspreset 1"
}
"2"
{
"label" "Apply NS 3.3 preset"
"command" "engine nspreset 2"
}
"3"
{
"label" "Apply competitive preset"
"command" "engine nspreset 3"
}
"4"
{
"label" ""
"command" ""
}
"5"
{
"label" ""
"command" ""
}
"6"
{
"label" "#GameUI_GameMenu_ResumeGame"
"command" "ResumeGame"
"OnlyInGame" "1"
}
"2"
"7"
{
"label" "#Menu_ReadyRoom"
"command" "engine menureadyroom"
"OnlyInGame" "1"
}
"3"
"8"
{
"label" "#GameUI_GameMenu_Disconnect"
"command" "Disconnect"
@ -37,25 +62,25 @@
// "notmulti" "1"
// "OnlyInGame" "1"
// }
"7"
"9"
{
"label" ""
"command" ""
"notmulti" "1"
}
"8"
"10"
{
"label" "#GameUI_GameMenu_PlayerList"
"command" "OpenPlayerListDialog"
"OnlyInGame" "1"
"notmulti" "0"
}
"9"
"11"
{
"label" "#GameUI_GameMenu_CreateServer"
"command" "OpenCreateMultiplayerGameDialog"
}
"10"
"12"
{
"label" "#GameUI_GameMenu_FindServers"
"command" "OpenServerBrowser"
@ -66,23 +91,23 @@
//"label" "#GameUI_GameMenu_PlayDemo"
//"command" "OpenLoadDemoDialog"
//}
"11"
"13"
{
"label" ""
"command" ""
}
"12"
"14"
{
"label" "#GameUI_GameMenu_ChangeGame"
"command" "OpenChangeGameDialog"
"notsteam" "1"
}
"13"
"15"
{
"label" "#GameUI_GameMenu_Options"
"command" "OpenOptionsDialog"
}
"14"
"16"
{
"label" "#GameUI_GameMenu_Quit"
"command" "Quit"

View file

@ -0,0 +1,80 @@
"Resource\MultiplayerAdvancedDialog.res"
{
"MultiplayerAdvancedDialog"
{
"ControlName" "CTaskFrame"
"fieldName" "MultiplayerAdvancedDialog"
"xpos" "250"
"ypos" "25"
"wide" "700"
"tall" "600"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"paintbackground" "1"
"settitlebarvisible" "1"
"title" "#GameUI_MultiplayerAdvanced"
}
"Cancel"
{
"ControlName" "Button"
"fieldName" "Cancel"
"xpos" "616"
"ypos" "562"
"wide" "72"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "2"
"paintbackground" "1"
"labelText" "#GameUI_Cancel"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Command" "Close"
"Default" "0"
}
"Ok"
{
"ControlName" "Button"
"fieldName" "OK"
"xpos" "536"
"ypos" "562"
"wide" "72"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "1"
"paintbackground" "1"
"labelText" "#GameUI_OK"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Command" "Ok"
"Default" "0"
}
"PanelListPanel"
{
"ControlName" "CPanelListPanel"
"fieldName" "PanelListPanel"
"xpos" "16"
"ypos" "56"
"wide" "670"
"tall" "502"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"paintbackground" "1"
}
}

View file

@ -0,0 +1,31 @@
"Resource\MultiplayerAdvancedDia"
{
"MultiplayerAdvancedDialog"
{
"ControlName" "PropertyDialog"
"fieldName" "MultiplayerAdvancedDialog"
"xpos" "0"
"ypos" "0"
"wide" "728"
"tall" "536"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
}
"PanelListPanel"
{
"ControlName" "CPanelListPanel"
"fieldName" "PanelListPanel"
"xpos" "10"
"ypos" "10"
"wide" "713"
"tall" "516"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
}
}

View file

@ -0,0 +1,312 @@
"Resource/OptionsSubMultiplayer.res"
{
"Advanced"
{
"ControlName" "Button"
"fieldName" "Advanced"
"xpos" "32"
"ypos" "22"
"tooltiptext" ""
"wide" "440"
"tall" "80"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "1"
"paintbackground" "1"
"labelText" "#GameUI_AdvancedEllipsis"
"textAlignment" "center"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Command" "Advanced"
"Default" "0"
}
"NameLabel"
{
"ControlName" "Label"
"fieldName" "NameLabel"
"xpos" "230"
"ypos" "144"
"wide" "144"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"paintbackground" "1"
"labelText" "#GameUI_PlayerName"
"textAlignment" "west"
"associate" "NameEntry"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
}
"NameEntry"
{
"ControlName" "CCvarTextEntry"
"fieldName" "NameEntry"
"xpos" "230"
"ypos" "174"
"wide" "240"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "2"
"paintbackground" "1"
"textHidden" "0"
"editable" "1"
"maxchars" "63"
"NumericInputOnly" "0"
"unicode" "1"
}
"Primary Color Slider"
{
"ControlName" "CCvarSlider"
"fieldName" "Primary Color Slider"
"xpos" "0"
"ypos" "0"
"wide" "42"
"tall" "16"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
"leftText" "0.00"
"rightText" "255.00"
}
"Secondary Color Slider"
{
"ControlName" "CCvarSlider"
"fieldName" "Secondary Color Slider"
"xpos" "0"
"ypos" "0"
"wide" "42"
"tall" "16"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
"leftText" "0.00"
"rightText" "255.00"
}
"High Quality Models"
{
"ControlName" "CCvarToggleCheckButton"
"fieldName" "High Quality Models"
"xpos" "162"
"ypos" "280"
"wide" "204"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "0"
"labelText" "#GameUI_HighModels"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Default" "0"
}
"Player model"
{
"ControlName" "CLabeledCommandComboBox"
"fieldName" "Player model"
"xpos" "0"
"ypos" "0"
"wide" "42"
"tall" "16"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
"textHidden" "0"
"editable" "0"
"maxchars" "-1"
"NumericInputOnly" "0"
"unicode" "0"
}
"Label2"
{
"ControlName" "Label"
"fieldName" "Label2"
"xpos" "230"
"ypos" "216"
"wide" "140"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"paintbackground" "1"
"labelText" "#GameUI_SpraypaintImage"
"textAlignment" "west"
"associate" "SpraypaintList"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
}
"SpraypaintList"
{
"ControlName" "CLabeledCommandComboBox"
"fieldName" "SpraypaintList"
"xpos" "230"
"ypos" "244"
"wide" "240"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "3"
"paintbackground" "1"
"textHidden" "0"
"editable" "0"
"maxchars" "-1"
"NumericInputOnly" "0"
"unicode" "0"
}
"SpraypaintColor"
{
"ControlName" "CLabeledCommandComboBox"
"fieldName" "SpraypaintColor"
"xpos" "230"
"ypos" "274"
"wide" "240"
"tall" "24"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "4"
"paintbackground" "1"
"textHidden" "0"
"editable" "0"
"maxchars" "-1"
"NumericInputOnly" "0"
"unicode" "0"
}
"ModelImage"
{
"ControlName" "Panel"
"fieldName" "ModelImage"
"xpos" "0"
"ypos" "0"
"wide" "66"
"tall" "66"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
}
"LogoImage"
{
"ControlName" "Panel"
"fieldName" "LogoImage"
"xpos" "132"
"ypos" "234"
"wide" "64"
"tall" "64"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"paintbackground" "1"
}
"Ok"
{
"ControlName" "Button"
"fieldName" "OK"
"xpos" "0"
"ypos" "0"
"wide" "42"
"tall" "16"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
"labelText" "#GameUI_OK"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Default" "0"
}
"Apply"
{
"ControlName" "Button"
"fieldName" "Apply"
"xpos" "0"
"ypos" "0"
"wide" "42"
"tall" "16"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
"labelText" "#GameUI_Apply"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Default" "0"
}
"Cancel"
{
"ControlName" "Button"
"fieldName" "Cancel"
"xpos" "0"
"ypos" "0"
"wide" "42"
"tall" "16"
"AutoResize" "0"
"PinCorner" "0"
"visible" "0"
"enabled" "0"
"tabPosition" "0"
"paintbackground" "1"
"labelText" "#GameUI_Cancel"
"textAlignment" "west"
"dulltext" "0"
"brighttext" "0"
"wrap" "0"
"Default" "0"
}
"Divider1"
{
"ControlName" "Divider"
"fieldName" "Divider1"
"xpos" "32"
"ypos" "126"
"wide" "440"
"tall" "1"
"AutoResize" "0"
"PinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"paintbackground" "1"
}
}

View file

@ -174,7 +174,7 @@ Scheme
"ArmedMenuColor" "255 255 255 255"
"DepressedMenuColor" "192 186 80 255"
"WidescreenBarColor" "0 0 0 0"
"MenuItemVisibilityRate" "0.03" // time it takes for one menu item to appear
"MenuItemVisibilityRate" "0.01" // time it takes for one menu item to appear
"MenuItemHeight" "28"
"GameMenuInset" "32"
}

Binary file not shown.

View file

@ -100,3 +100,14 @@ mp_uplink 1
// Needed so this file is executed on map change, like pre-NS v2.1
mapchangecfgfile server.cfg
// Post HL 25th Aniversary update
sv_rollangle 0
sv_allow_shaders 0
// Set rate limits, otherwise they initialize to bad values
sv_maxupdaterate 102
sv_maxunlag 0.3
sv_maxrate 0
sv_minrate 20000
sv_minupdaterate 30

View file

@ -59,7 +59,7 @@ DESCRIPTION SERVER_OPTIONS
{
"#Valve_Max_Players"
{ NUMBER 2.000000 32.000000 }
{ "2.000000" }
{ "24.000000" }
}
"sv_password"

14
main/shaders/fs.shaders Normal file
View file

@ -0,0 +1,14 @@
#version 330 core
in vec2 texCoord;
out vec4 fragColor;
uniform sampler2D textureSampler;
uniform float colorMultiplier; // Uniform float to multiply color by
void main() {
// Sample the texture
vec4 texColor = texture(textureSampler, texCoord);
// Multiply the color
fragColor = vec4(texColor.rgb * colorMultiplier, 1.0f);
}

10
main/shaders/vs.shaders Normal file
View file

@ -0,0 +1,10 @@
#version 330 core
layout(location = 0) in vec2 vertexPosition;
out vec2 texCoord;
void main() {
// Pass the vertex position to the fragment shader
texCoord = (vertexPosition + 1.0) * 0.5; // Convert vertex position to texture coordinates
gl_Position = vec4(vertexPosition, 0.0, 1.0);
}

View file

Binary file not shown.

View file

@ -380,13 +380,18 @@ void WeaponsResource::UserCmd_MovementOn()
// Find out which weapon we want to trigger
AvHUser3 theUser3 = gHUD.GetHUDUser3();
int wID = -1;
bool lerkFlap = false;
switch(theUser3)
{
case AVH_USER3_ALIEN_PLAYER1:
wID = AVH_ABILITY_LEAP;
break;
//TODO: Make healspray work with attack2
case AVH_USER3_ALIEN_PLAYER2:
wID = AVH_WEAPON_HEALINGSPRAY;
break;
case AVH_USER3_ALIEN_PLAYER3:
// TODO: Add flap
lerkFlap = true;
break;
case AVH_USER3_ALIEN_PLAYER4:
wID = AVH_WEAPON_BLINK;
@ -399,7 +404,24 @@ void WeaponsResource::UserCmd_MovementOn()
return;
}
if (wID > -1)
if (wID == AVH_WEAPON_HEALINGSPRAY)
{
WEAPON* healWeapon = this->GetWeapon(AVH_WEAPON_HEALINGSPRAY);
WEAPON* currentWeapon = this->GetWeapon(gHUD.GetCurrentWeaponID());
if (healWeapon != NULL && currentWeapon != NULL)
{
//if (healWeapon != currentWeapon)
//{
healSprayLastWeapon = currentWeapon;
healSprayAttack2Active = true;
SetCurrentWeapon(healWeapon);
//}
IN_Attack2Down();
}
}
else if (wID > -1)
{
// Fetch the needed movement weapon
WEAPON *p = this->GetWeapon(wID);
@ -409,6 +431,10 @@ void WeaponsResource::UserCmd_MovementOn()
IN_Attack2Down();
}
}
else if (lerkFlap)
{
IN_Attack2Down();
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -418,6 +444,24 @@ void WeaponsResource::UserCmd_MovementOff()
// Ensure that we're not activating any weapons when selected
IN_Attack2Up();
IN_ReloadUp();
// Check if we're in game.
if (gEngfuncs.pfnGetLevelName()[0] != 0)
{
if (gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER2)
{
WEAPON* healWeapon = this->GetWeapon(AVH_WEAPON_HEALINGSPRAY);
if (healWeapon != NULL && healSprayLastWeapon != NULL)
{
//if (healSprayLastWeapon != healWeapon)
//{
SetCurrentWeapon(healSprayLastWeapon);
//}
healSprayAttack2Active = false;
}
}
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -461,7 +505,15 @@ void WeaponsResource::SetCurrentWeapon(WEAPON* newWeapon)
if( newWeapon != NULL )
{
if( newWeapon != currentWeapon )
{ lastWeapon = currentWeapon; }
{
lastWeapon = currentWeapon;
if (gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER2 && !healSprayAttack2Active)
{
healSprayLastWeapon = newWeapon;
}
}
ServerCmd(newWeapon->szName);
g_weaponselect = newWeapon->iId;
}
@ -694,41 +746,49 @@ void CHudAmmo::Think(void)
}
if (gHUD.GetCurrentWeaponID() != gWR.lastWeaponId)
{
gWR.lastWeaponId = gHUD.GetCurrentWeaponID();
float wCfgCvar = CVAR_GET_FLOAT("cl_weaponcfgs");
if (wCfgCvar == 1)
{
ClientCmd("exec weaponcfgs/default.cfg");
WEAPON* currentWeapon = gWR.GetWeapon(gHUD.GetCurrentWeaponID());
char weapcfg[128];
sprintf(weapcfg, "exec weaponcfgs/%s.cfg", currentWeapon->szName);
ClientCmd(weapcfg);
}
//else if (wCfgCvar == 2.0f)
//{
// ClientCmd("exec weaponcfgs/nsdefaults/default.cfg");
// WEAPON* currentWeapon = gWR.GetWeapon(gHUD.GetCurrentWeaponID());
// char weapcfg[128];
// sprintf(weapcfg, "exec weaponcfgs/nsdefaults/%s.cfg", currentWeapon->szName);
// ClientCmd(weapcfg);
//}
}
WEAPON* currentWeapon = gWR.GetWeapon(gHUD.GetCurrentWeaponID());
if(gHUD.GetIsAlien()) //check for hive death causing loss of current weapon
{
WEAPON* currentWeapon = gWR.GetWeapon(gHUD.GetCurrentWeaponID());
if(!gWR.IsSelectable(currentWeapon)) //current weapon isn't valid
{
gWR.SetValidWeapon(); //get best option
}
}
if (gHUD.GetCurrentWeaponID() != m_crossLastWeapId)
{
m_crossLastWeapId = gHUD.GetCurrentWeaponID();
const float wCfgCvar = CVAR_GET_FLOAT("cl_weaponcfgs");
char weapCfg[128];
if (wCfgCvar == 1.0f)
{
ClientCmd("exec weaponcfgs/default.cfg");
if (!currentWeapon)
{
ClientCmd("exec weaponcfgs/noweapon.cfg");
}
else
{
snprintf(weapCfg, 128, "exec weaponcfgs/%s.cfg", currentWeapon->szName);
ClientCmd(weapCfg);
}
}
else if (wCfgCvar == 2.0f)
{
if (!currentWeapon)
{
ClientCmd("exec weaponcfgs/nsdefaults/noweapon.cfg");
}
else
{
snprintf(weapCfg, 128, "exec weaponcfgs/nsdefaults/%s.cfg", currentWeapon->szName);
ClientCmd(weapCfg);
}
}
}
if (!gpActiveSel)
return;

View file

@ -73,10 +73,11 @@ private:
WEAPON rgWeapons[MAX_WEAPONS]; // current weapon state
WEAPON* rgSlots[MAX_WEAPON_SLOTS][MAX_WEAPON_POSITIONS]; // current weapon slot map
WEAPON* lastWeapon; // client-side lastinv
WEAPON* healSprayLastWeapon;
bool healSprayAttack2Active;
int riAmmo[MAX_AMMO_TYPES]; // current ammo counts
int iOldWeaponBits;
int lastWeaponId;
};
extern WeaponsResource gWR;

View file

@ -69,6 +69,8 @@ TeamFortressViewport *gViewPort = NULL;
HINTERFACEMODULE g_hTrackerModule = NULL;
//ITrackerUser *g_pTrackerUser = NULL;
CPostProcessShader g_PostProcessShader;
void InitInput (void);
void EV_HookEvents( void );
void IN_Commands( void );
@ -216,6 +218,8 @@ void CL_DLLEXPORT HUD_Init( void )
InitInput();
gHUD.Init();
Scheme_Init();
g_PostProcessShader.Init();
//gEngfuncs.Con_Printf("waterrenderer init %d", success);
}
/*
@ -261,6 +265,8 @@ HUD_Redraw
int CL_DLLEXPORT HUD_Redraw( float time, int intermission )
{
g_PostProcessShader.DrawShader();
// RecClHudRedraw(time, intermission);
gHUD.Redraw( time, intermission );

View file

@ -24,7 +24,7 @@ public:
AVHHSPRITE m_hsprCursor;
float m_flTime; // the current client time
float m_fOldTime; // the time at which the HUD was last redrawn
float m_wsFOV; //fov recalc corrected for widescreen
//float m_wsFOV; //fov recalc corrected for widescreen
double m_flTimeDelta; // the difference between flTime and fOldTime
Vector m_vecOrigin;
Vector m_vecAngles;
@ -34,6 +34,7 @@ public:
int m_iRes;
cvar_t *m_pCvarStealMouse;
cvar_t *m_pCvarDraw;
bool m_bWindowed;
int m_iFontHeight;
int DrawHudNumber(int x, int y, int iFlags, int iNumber, int r, int g, int b );

View file

@ -121,6 +121,7 @@ private:
int m_HUD_bucket0;
int m_HUD_selection;
int m_customCrosshair;
int m_crossLastWeapId;
};

View file

@ -95,8 +95,8 @@
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_;AVH_PLAYTEST_BUILD;BALANCE_ENABLED;PLAYTEST_BUILD</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;$(SolutionDir)\includes\glew;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_;AVH_PLAYTEST_BUILD;BALANCE_ENABLED;PLAYTEST_BUILD;GLEW_STATIC</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
@ -158,8 +158,8 @@
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;$(SolutionDir)\includes\glew;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_;GLEW_STATIC</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
@ -221,8 +221,8 @@
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ITERATOR_DEBUG_LEVEL=2;_DEBUG;DEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_;AVH_PLAYTEST_BUILD;BALANCE_ENABLED;PLAYTEST_BUILD</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\particles;$(SolutionDir)\includes\lpng1251;$(SolutionDir)\includes\zlib-1.2.8;$(SolutionDir)\includes\fmod\inc;$(SolutionDir)\includes\vgui\include;$(SolutionDir)\includes\glew;../public;../common;../external;../pm_shared;../game_shared;../mod;../util;../ui;../engine;../cl_dll;../dlls</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ITERATOR_DEBUG_LEVEL=2;_DEBUG;DEBUG;WIN32;_WINDOWS;AVH_CLIENT;USE_OLDAUTH;_X86_;AVH_PLAYTEST_BUILD;BALANCE_ENABLED;PLAYTEST_BUILD;GLEW_STATIC</PreprocessorDefinitions>
<StringPooling>
</StringPooling>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
@ -281,6 +281,22 @@
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\includes\glew\GL\glew.c">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">MaxSpeed</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile Include="..\util\ShaderUtil.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">MaxSpeed</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile Include="ammo.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
@ -564,6 +580,14 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile Include="shader.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">MaxSpeed</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Client - Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ClCompile Include="status_icons.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Playtest|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Client - Release|Win32'">MaxSpeed</Optimization>
@ -1615,7 +1639,6 @@
</ClCompile>
<ClCompile Include="..\util\Balance.cpp" />
<ClCompile Include="..\util\Checksum.cpp" />
<ClCompile Include="..\util\GammaTable.cpp" />
<ClCompile Include="..\util\LinuxSupport.cpp" />
<ClCompile Include="..\util\Mat3.cpp" />
<ClCompile Include="..\util\MathUtil.cpp" />
@ -1627,6 +1650,10 @@
<ClCompile Include="..\textrep\TRFactory.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\includes\glew\GL\eglew.h" />
<ClInclude Include="..\includes\glew\GL\glew.h" />
<ClInclude Include="..\includes\glew\GL\glxew.h" />
<ClInclude Include="..\includes\glew\GL\wglew.h" />
<ClInclude Include="..\mod\AvHAlienAbilities.h" />
<ClInclude Include="..\mod\AvHAlienWeaponConstants.h" />
<ClInclude Include="..\mod\AvHAlienWeapons.h" />
@ -1634,6 +1661,7 @@
<ClInclude Include="..\mod\AvHMarineWeapon.h" />
<ClInclude Include="..\mod\AvHMarineWeaponConstants.h" />
<ClInclude Include="..\mod\AvHMarineWeapons.h" />
<ClInclude Include="..\util\ShaderUtil.h" />
<ClInclude Include="ammo.h" />
<ClInclude Include="ammohistory.h" />
<ClInclude Include="..\game_shared\bitvec.h" />
@ -1763,7 +1791,6 @@
<ClInclude Include="..\util\Balance.h" />
<ClInclude Include="..\util\Checksum.h" />
<ClInclude Include="..\util\CString.h" />
<ClInclude Include="..\util\GammaTable.h" />
<ClInclude Include="..\util\LinuxSupport.h" />
<ClInclude Include="..\util\Mat3.h" />
<ClInclude Include="..\util\MathUtil.h" />

View file

@ -31,6 +31,9 @@
<Filter Include="textrep">
<UniqueIdentifier>{ad5bbb2c-1092-4ba3-ab5b-fdfa0a33f1f5}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\glew">
<UniqueIdentifier>{57cad65d-80b8-4d06-abb5-8ff8dc1d60cc}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ammo.cpp">
@ -552,9 +555,6 @@
<ClCompile Include="..\util\Checksum.cpp">
<Filter>util</Filter>
</ClCompile>
<ClCompile Include="..\util\GammaTable.cpp">
<Filter>util</Filter>
</ClCompile>
<ClCompile Include="..\util\LinuxSupport.cpp">
<Filter>util</Filter>
</ClCompile>
@ -600,6 +600,15 @@
<ClCompile Include="hudgl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="shader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\util\ShaderUtil.cpp">
<Filter>util</Filter>
</ClCompile>
<ClCompile Include="..\includes\glew\GL\glew.c">
<Filter>Source Files\glew</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\mod\AvHAlienAbilities.h">
@ -1004,9 +1013,6 @@
<ClInclude Include="..\util\CString.h">
<Filter>util</Filter>
</ClInclude>
<ClInclude Include="..\util\GammaTable.h">
<Filter>util</Filter>
</ClInclude>
<ClInclude Include="..\util\LinuxSupport.h">
<Filter>util</Filter>
</ClInclude>
@ -1052,6 +1058,21 @@
<ClInclude Include="hudgl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\util\ShaderUtil.h">
<Filter>util</Filter>
</ClInclude>
<ClInclude Include="..\includes\glew\GL\glxew.h">
<Filter>Source Files\glew</Filter>
</ClInclude>
<ClInclude Include="..\includes\glew\GL\wglew.h">
<Filter>Source Files\glew</Filter>
</ClInclude>
<ClInclude Include="..\includes\glew\GL\eglew.h">
<Filter>Source Files\glew</Filter>
</ClInclude>
<ClInclude Include="..\includes\glew\GL\glew.h">
<Filter>Source Files\glew</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Library Include="..\lib\public\game_controls.lib" />

View file

@ -525,63 +525,82 @@ void CBasePlayerWeapon::ItemPostFrame( void )
}
}
if ( (m_pPlayer->pev->button & IN_ATTACK) && !(m_pPlayer->pev->button & IN_ATTACK2))
bool pistolAttackUp = ((CVAR_GET_FLOAT("cl_pistoltrigger") != 0) && m_pPlayer->m_afButtonLast & IN_ATTACK && m_pPlayer->m_afButtonReleased & IN_ATTACK && ii.iId == AVH_WEAPON_PISTOL);
if ((m_pPlayer->pev->button & IN_ATTACK || this->m_bAttackQueued || pistolAttackUp) && (!(m_pPlayer->pev->button & IN_ATTACK2) || gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER3))
{
if ((m_fInSpecialReload == 1 || m_fInSpecialReload == 2) && m_iClip != 0)
{
m_fInSpecialReload = 3;
Reload();
}
else if (GetCanUseWeapon() && (m_flNextPrimaryAttack <= 0.0))
if (GetCanUseWeapon())
{
if ( (m_iClip == 0 && ii.pszAmmo1) ||
(ii.iMaxClip == -1 && !m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] ) )
{
m_fFireOnEmpty = TRUE;
}
if ((gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER1)
&& (gHUD.GetCurrentWeaponID() == AVH_ABILITY_LEAP)
&& (this->m_flLastAnimationPlayed + (float)BALANCE_VAR(kLeapROF) <= gpGlobals->time))
if ((m_fInSpecialReload == 1 || m_fInSpecialReload == 2) && m_iClip != 0)
{
// : 0001151 predict energy too
AvHAlienWeapon* theWeapon = dynamic_cast<AvHAlienWeapon *>(g_pWpns[AVH_ABILITY_LEAP]);
if ( theWeapon && theWeapon->IsUseable() ) {
float theVolumeScalar = 1.0f;
cl_entity_t *player = gEngfuncs.GetLocalPlayer();
int theSilenceLevel = AvHGetAlienUpgradeLevel(player->curstate.iuser4, MASK_UPGRADE_6);
switch(theSilenceLevel)
{
case 1:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel1Volume);
break;
case 2:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel2Volume);
break;
case 3:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel3Volume);
break;
}
HUD_PlaySound( kLeapSound, theVolumeScalar);
AvHMUDeductAlienEnergy(m_pPlayer->pev->fuser3, theWeapon->GetEnergyForAttack() );
gEngfuncs.pEventAPI->EV_WeaponAnimation(3, 2);
this->m_flLastAnimationPlayed = gpGlobals->time;
}
m_fInSpecialReload = 3;
Reload();
}
else if (m_flNextPrimaryAttack <= 0.0)
{
if ( (m_iClip == 0 && ii.pszAmmo1) ||
(ii.iMaxClip == -1 && !m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] ) )
{
m_fFireOnEmpty = TRUE;
}
if ((gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER1)
&& (gHUD.GetCurrentWeaponID() == AVH_ABILITY_LEAP)
&& (this->m_flLastAnimationPlayed + (float)BALANCE_VAR(kLeapROF) <= gpGlobals->time))
{
// : 0001151 predict energy too
AvHAlienWeapon* theWeapon = dynamic_cast<AvHAlienWeapon *>(g_pWpns[AVH_ABILITY_LEAP]);
if ( theWeapon && theWeapon->IsUseable() ) {
float theVolumeScalar = 1.0f;
cl_entity_t *player = gEngfuncs.GetLocalPlayer();
int theSilenceLevel = AvHGetAlienUpgradeLevel(player->curstate.iuser4, MASK_UPGRADE_6);
switch(theSilenceLevel)
{
case 1:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel1Volume);
break;
case 2:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel2Volume);
break;
case 3:
theVolumeScalar = (float)BALANCE_VAR(kSilenceLevel3Volume);
break;
}
HUD_PlaySound( kLeapSound, theVolumeScalar);
AvHMUDeductAlienEnergy(m_pPlayer->pev->fuser3, theWeapon->GetEnergyForAttack() );
gEngfuncs.pEventAPI->EV_WeaponAnimation(3, 2);
this->m_flLastAnimationPlayed = gpGlobals->time;
}
}
//#ifdef AVH_CLIENT
//if((m_iClip == 0) && ?
//#endif
PrimaryAttack(pistolAttackUp);
//return;
}
else
{
QueueAttack(pistolAttackUp);
}
//#ifdef AVH_CLIENT
//if((m_iClip == 0) && ?
//#endif
PrimaryAttack();
//return;
}
}
// +movement: Rewritten to allow us to use +attack2 for movement abilities
else if ((m_pPlayer->pev->button & IN_ATTACK2) && (gHUD.GetIsAlien()))
{
AvHUser3 theUser3 = gHUD.GetHUDUser3();
//m_flNextSecondaryAttack
// Find out what kind of special movement we are using, and execute the animation for it
if (this->PrevAttack2Status == false)
if (theUser3 == AVH_USER3_ALIEN_PLAYER2)
{
if (GetCanUseWeapon() && m_flNextPrimaryAttack <= 0.0)
{
SecondaryAttack();
}
}
else if (this->PrevAttack2Status == false)
{
bool enabled=false;
// : 0001151 predict energy too
@ -589,7 +608,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
if ( theWeapon )
enabled=theWeapon->IsUseable();
switch (gHUD.GetHUDUser3())
switch (theUser3)
{
case AVH_USER3_ALIEN_PLAYER1:
@ -644,8 +663,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
}
}
if ((gHUD.GetHUDUser3() == AVH_USER3_ALIEN_PLAYER1)
&& (this->m_flLastAnimationPlayed + BALANCE_VAR(kLeapROF) < gpGlobals->time))
if ((theUser3 == AVH_USER3_ALIEN_PLAYER1) && (this->m_flLastAnimationPlayed + BALANCE_VAR(kLeapROF) < gpGlobals->time))
this->PrevAttack2Status = false;
else
this->PrevAttack2Status = true;

View file

@ -209,9 +209,9 @@ void CHud :: Init( void )
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
CVAR_CREATE( "cl_showspeed", "0", 0);
CVAR_CREATE( "cl_showspeed", "0", FCVAR_ARCHIVE);
CVAR_CREATE( kvLabelMaps, "3", FCVAR_ARCHIVE);
CVAR_CREATE( kvGammaRamp, "0", FCVAR_ARCHIVE);
//CVAR_CREATE( kvGammaRamp, "0", FCVAR_ARCHIVE);
CVAR_CREATE( kvCustomCrosshair, "1", FCVAR_ARCHIVE);
CVAR_CREATE( kvHudMapZoom, "3", FCVAR_ARCHIVE);
CVAR_CREATE( kvLabelHivesight, "1", FCVAR_ARCHIVE);
@ -219,6 +219,7 @@ void CHud :: Init( void )
CVAR_CREATE( "cl_icong", "149", FCVAR_ARCHIVE);
CVAR_CREATE( "cl_iconb", "221", FCVAR_ARCHIVE);
CVAR_CREATE("hud_style", "1", FCVAR_ARCHIVE);
CVAR_CREATE("cl_weaponswap", "2", FCVAR_ARCHIVE | FCVAR_USERINFO);
CVAR_CREATE("hud_teamhealthalert", "95", FCVAR_ARCHIVE);
CVAR_CREATE("hud_mapnames", "5", FCVAR_ARCHIVE);
@ -326,6 +327,21 @@ void CHud :: VidInit( void )
gHUD.SetViewport(theViewPort);
//Determine if we're playing in windowed mode so we can do mouse centering correctly later.
for (Uint32 id = 0; id < UINT32_MAX; ++id)
{
SDL_Window* theWindow = SDL_GetWindowFromID(id);
if (theWindow)
{
if (!(SDL_GetWindowFlags(theWindow) & SDL_WINDOW_FULLSCREEN))
{
m_bWindowed = true;
}
break;
}
}
if (CVAR_GET_FLOAT("hud_style") == 2.0f)
{
mFont.Load("sprites/nl/font_arial");
@ -351,7 +367,7 @@ void CHud :: VidInit( void )
m_iRes = 640;
// Only load this once
if ( !m_pSpriteList )
if ( !m_pSpriteList || gHUD.GetReInitHUD())
{
// we need to load the hud.txt, and all sprites within
if (CVAR_GET_FLOAT("hud_style") == 2.0f)

View file

@ -30,6 +30,7 @@ class TeamFortressViewport;
class AvHHud;
#include "AvHHud.h"
extern AvHHud gHUD;
extern CPostProcessShader g_PostProcessShader;
#include "wrect.h"
#include "cl_dll.h"

View file

@ -10,13 +10,13 @@ int CHudCrosshairs::Init()
{
m_iFlags = HUD_ACTIVE;
cl_cross = CVAR_CREATE("cl_cross", "0", FCVAR_ARCHIVE);
cl_cross = CVAR_CREATE("cl_cross", "1", FCVAR_ARCHIVE);
cl_cross_color = CVAR_CREATE("cl_cross_color", "255 255 255", FCVAR_ARCHIVE);
cl_cross_alpha = CVAR_CREATE("cl_cross_alpha", "255", FCVAR_ARCHIVE);
cl_cross_thickness = CVAR_CREATE("cl_cross_thickness", "2", FCVAR_ARCHIVE);
cl_cross_size = CVAR_CREATE("cl_cross_size", "6", FCVAR_ARCHIVE);
cl_cross_gap = CVAR_CREATE("cl_cross_gap", "3", FCVAR_ARCHIVE);
cl_cross_outline = CVAR_CREATE("cl_cross_outline", "2", FCVAR_ARCHIVE);
cl_cross_outline = CVAR_CREATE("cl_cross_outline", "1", FCVAR_ARCHIVE);
cl_cross_outline_alpha = CVAR_CREATE("cl_cross_outline_alpha", "", FCVAR_ARCHIVE);
cl_cross_outline_inner = CVAR_CREATE("cl_cross_outline_inner", "0", FCVAR_ARCHIVE);
cl_cross_circle_radius = CVAR_CREATE("cl_cross_circle_radius", "0", FCVAR_ARCHIVE);
@ -35,6 +35,7 @@ int CHudCrosshairs::Init()
cl_cross_line_bottom = CVAR_CREATE("cl_cross_line_bottom", "1", FCVAR_ARCHIVE);
cl_cross_line_left = CVAR_CREATE("cl_cross_line_left", "1", FCVAR_ARCHIVE);
cl_cross_line_right = CVAR_CREATE("cl_cross_line_right", "1", FCVAR_ARCHIVE);
cl_cross_scaling = CVAR_CREATE("cl_cross_scaling", "1", FCVAR_ARCHIVE);
gHUD.AddHudElem(this);
return 0;
@ -62,9 +63,33 @@ int CHudCrosshairs::Draw(float time)
unsigned char r, g, b;
if (sscanf(cl_cross_color->string, "%hhu %hhu %hhu", &r, &g, &b) != 3) {
r = 0;
r = 255;
g = 255;
b = 0;
b = 255;
}
unsigned char outalpha;
if (sscanf(cl_cross_outline_alpha->string, "%hhu", &outalpha) != 1)
outalpha = alpha;
float scalar = 1.0f;
if (cl_cross_scaling->value != 0)
{
// Scale from 1080 Y res, as it's what the default crosshairs are designed for, but don't scale when resolution is close to 1080, as it looks bad.
const float screenscale = ScreenHeight() / 1080.0f; //ScreenHeight() * 0.000926f
// Lowering scale looks like junk, don't bother.
//if (screenscale < 0.75f)
//{
// scalar = 1.0f / round(1080.0f / ScreenHeight());
// //scalar = 0.5f;
//}
if (screenscale > 1.0f)
{
scalar = screenscale;
}
// Additional scaling with the cvar value if desired.
scalar *= cl_cross_scaling->value;
}
@ -73,38 +98,35 @@ int CHudCrosshairs::Draw(float time)
HudGL gl;
// Draw the outline.
// TODO: this contains a terrible amount of repeating complex code.
//
// Possible solution: can be changed to this with the one downside being in rare cases where cl_cross_thickness is high AND its alpha is <255, the center of each line will be slightly darker.
// Example below is for bottom line. Would also cause certain crosshairs that have outlines on invisible cross lines to not look right.
// gl.rectangle(Vector2D(center.x + offset, center.y + gap - half_width), Vector2D(center.x - offset, center.y + gap + size + half_width));
if (cl_cross_outline->value > 0.0f) {
unsigned char outalpha;
if (sscanf(cl_cross_outline_alpha->string, "%hhu", &outalpha) != 1)
outalpha = alpha;
// TODO: Swap out lines for rectangles to fix the line thickness limit of 10.
// The lines can also be changed to one rectangle with the one downside being in cases where the cross alpha is <255, the center of each line will be slightly darker.
// Example below is for bottom line. It would also cause certain crosshairs that have outlines on invisible cross lines to not look right.
// gl.rectangle(Vector2D(center.x + offset, center.y + gap /*- outline_width*/), Vector2D(center.x - offset, center.y + gap + size + outline_width));
if (cl_cross_outline->value > 0.0f && cl_cross_thickness->value > 0.0f && cl_cross_size->value > 0.0f) {
float size = cl_cross_size->value * scalar;
float gap = cl_cross_gap->value * scalar;
float half_thickness = min(cl_cross_thickness->value * scalar, ScreenHeight() * 0.3f) * 0.5f;
float outline_width = cl_cross_outline->value * scalar;
float offset = half_thickness + outline_width;
gl.color(0, 0, 0, outalpha);
gl.line_width(cl_cross_outline->value);
float size = cl_cross_size->value;
float gap = cl_cross_gap->value;
float half_thickness = cl_cross_thickness->value / 2.0f;
float half_width = cl_cross_outline->value / 2.0f;
float offset = half_thickness + half_width;
gl.line_width(outline_width * 2.0f);
// Top line
if (cl_cross_line_top->value) {
gl.line(Vector2D(center.x - offset, center.y - gap - size), Vector2D(center.x + offset, center.y - gap - size));
if (cl_cross_outline_inner->value == 0.0f)
{
gl.line(Vector2D(center.x + half_thickness, center.y - gap - size + half_width), Vector2D(center.x + half_thickness, center.y - gap));
gl.line(Vector2D(center.x - half_thickness, center.y - gap), Vector2D(center.x - half_thickness, center.y - gap - size + half_width));
gl.line(Vector2D(center.x + half_thickness, center.y - gap - size + outline_width), Vector2D(center.x + half_thickness, center.y - gap));
gl.line(Vector2D(center.x - half_thickness, center.y - gap), Vector2D(center.x - half_thickness, center.y - gap - size + outline_width));
}
else
{
gl.line(Vector2D(center.x + half_thickness, center.y - gap - size + half_width), Vector2D(center.x + half_thickness, center.y - gap - half_width));
gl.line(Vector2D(center.x + half_thickness, center.y - gap - size + outline_width), Vector2D(center.x + half_thickness, center.y - gap - outline_width));
gl.line(Vector2D(center.x + offset, center.y - gap), Vector2D(center.x - offset, center.y - gap));
gl.line(Vector2D(center.x - half_thickness, center.y - gap - half_width), Vector2D(center.x - half_thickness, center.y - gap - size + half_width));
gl.line(Vector2D(center.x - half_thickness, center.y - gap - outline_width), Vector2D(center.x - half_thickness, center.y - gap - size + outline_width));
}
}
@ -113,14 +135,14 @@ int CHudCrosshairs::Draw(float time)
gl.line(Vector2D(center.x - offset, center.y + gap + size), Vector2D(center.x + offset, center.y + gap + size));
if (cl_cross_outline_inner->value == 0.0f)
{
gl.line(Vector2D(center.x + half_thickness, center.y + gap + size - half_width), Vector2D(center.x + half_thickness, center.y + gap));
gl.line(Vector2D(center.x - half_thickness, center.y + gap), Vector2D(center.x - half_thickness, center.y + gap + size - half_width));
gl.line(Vector2D(center.x + half_thickness, center.y + gap + size - outline_width), Vector2D(center.x + half_thickness, center.y + gap));
gl.line(Vector2D(center.x - half_thickness, center.y + gap), Vector2D(center.x - half_thickness, center.y + gap + size - outline_width));
}
else
{
gl.line(Vector2D(center.x + half_thickness, center.y + gap + size - half_width), Vector2D(center.x + half_thickness, center.y + gap + half_width));
gl.line(Vector2D(center.x + half_thickness, center.y + gap + size - outline_width), Vector2D(center.x + half_thickness, center.y + gap + outline_width));
gl.line(Vector2D(center.x + offset, center.y + gap), Vector2D(center.x - offset, center.y + gap));
gl.line(Vector2D(center.x - half_thickness, center.y + gap + half_width), Vector2D(center.x - half_thickness, center.y + gap + size - half_width));
gl.line(Vector2D(center.x - half_thickness, center.y + gap + outline_width), Vector2D(center.x - half_thickness, center.y + gap + size - outline_width));
}
}
@ -129,14 +151,14 @@ int CHudCrosshairs::Draw(float time)
gl.line(Vector2D(center.x - gap - size, center.y - offset), Vector2D(center.x - gap - size, center.y + offset));
if (cl_cross_outline_inner->value == 0.0f)
{
gl.line(Vector2D(center.x - gap - size + half_width, center.y + half_thickness), Vector2D(center.x - gap, center.y + half_thickness));
gl.line(Vector2D(center.x - gap, center.y - half_thickness), Vector2D(center.x - gap - size + half_width, center.y - half_thickness));
gl.line(Vector2D(center.x - gap - size + outline_width, center.y + half_thickness), Vector2D(center.x - gap, center.y + half_thickness));
gl.line(Vector2D(center.x - gap, center.y - half_thickness), Vector2D(center.x - gap - size + outline_width, center.y - half_thickness));
}
else
{
gl.line(Vector2D(center.x - gap - size + half_width, center.y + half_thickness), Vector2D(center.x - gap - half_width, center.y + half_thickness));
gl.line(Vector2D(center.x - gap - size + outline_width, center.y + half_thickness), Vector2D(center.x - gap - outline_width, center.y + half_thickness));
gl.line(Vector2D(center.x - gap, center.y + offset), Vector2D(center.x - gap, center.y - offset));
gl.line(Vector2D(center.x - gap - half_width, center.y - half_thickness), Vector2D(center.x - gap - size + half_width, center.y - half_thickness));
gl.line(Vector2D(center.x - gap - outline_width, center.y - half_thickness), Vector2D(center.x - gap - size + outline_width, center.y - half_thickness));
}
}
@ -145,64 +167,72 @@ int CHudCrosshairs::Draw(float time)
gl.line(Vector2D(center.x + gap + size, center.y - offset), Vector2D(center.x + gap + size, center.y + offset));
if (cl_cross_outline_inner->value == 0.0f)
{
gl.line(Vector2D(center.x + gap + size - half_width, center.y + half_thickness), Vector2D(center.x + gap, center.y + half_thickness));
gl.line(Vector2D(center.x + gap, center.y - half_thickness), Vector2D(center.x + gap + size - half_width, center.y - half_thickness));
gl.line(Vector2D(center.x + gap + size - outline_width, center.y + half_thickness), Vector2D(center.x + gap, center.y + half_thickness));
gl.line(Vector2D(center.x + gap, center.y - half_thickness), Vector2D(center.x + gap + size - outline_width, center.y - half_thickness));
}
else
{
gl.line(Vector2D(center.x + gap + size - half_width, center.y + half_thickness), Vector2D(center.x + gap + half_width, center.y + half_thickness));
gl.line(Vector2D(center.x + gap + size - outline_width, center.y + half_thickness), Vector2D(center.x + gap + outline_width, center.y + half_thickness));
gl.line(Vector2D(center.x + gap, center.y + offset), Vector2D(center.x + gap, center.y - offset));
gl.line(Vector2D(center.x + gap + half_width, center.y - half_thickness), Vector2D(center.x + gap + size - half_width, center.y - half_thickness));
gl.line(Vector2D(center.x + gap + outline_width, center.y - half_thickness), Vector2D(center.x + gap + size - outline_width, center.y - half_thickness));
}
}
}
unsigned char dotout;
if (sscanf(cl_cross_dot_outline->string, "%hhu", &dotout) != 1)
dotout = cl_cross_outline->value;
float dotout;
if (cl_cross_dot_outline->string[0] == 0)
{
dotout = cl_cross_outline->value * scalar;
}
else
{
dotout = cl_cross_dot_outline->value * scalar;
}
// Dot outline
if (cl_cross_dot_size->value > 0.0f && dotout > 0.0f) {
unsigned char dotoutalpha;
if (sscanf(cl_cross_circle_outline_alpha->string, "%hhu", &dotoutalpha) != 1)
dotoutalpha = alpha;
if (sscanf(cl_cross_dot_outline_alpha->string, "%hhu", &dotoutalpha) != 1)
dotoutalpha = outalpha;
gl.color(0, 0, 0, dotoutalpha);
float size = cl_cross_dot_size->value;
float size = min(cl_cross_dot_size->value * scalar, ScreenHeight() * 0.2f) + (dotout * 2.0f);
Vector2D offset = Vector2D(size / 2.0f, size / 2.0f);
float dot_half_width = dotout / 2.0f;
gl.line(Vector2D(center.x - offset.x - dot_half_width, center.y - offset.y), Vector2D(center.x + offset.x + dot_half_width, center.y - offset.y));
gl.line(Vector2D(center.x + offset.x, center.y - offset.y + dot_half_width), Vector2D(center.x + offset.x, center.y + offset.y - dot_half_width));
gl.line(Vector2D(center.x - offset.x, center.y - offset.y + dot_half_width), Vector2D(center.x - offset.x, center.y + offset.y - dot_half_width));
gl.line(Vector2D(center.x - offset.x - dot_half_width, center.y + offset.y), Vector2D(center.x + offset.x + dot_half_width, center.y + offset.y));
gl.rectangle(center - offset, center + offset);
}
unsigned char circleout;
if (sscanf(cl_cross_circle_outline->string, "%hhu", &circleout) != 1)
circleout = cl_cross_outline->value;
float circleout;
if (cl_cross_circle_outline->string[0] == 0)
{
circleout = cl_cross_outline->value * scalar;
}
else
{
circleout = cl_cross_circle_outline->value * scalar;
}
// Circle outline
if (cl_cross_circle_radius->value > 0.0f && cl_cross_circle_thickness->value > 0.0f && circleout > 0.0f) {
unsigned char circleoutalpha;
if (sscanf(cl_cross_circle_outline_alpha->string, "%hhu", &circleoutalpha) != 1)
circleoutalpha = alpha;
unsigned char circleoutinner;
if (sscanf(cl_cross_circle_outline_inner->string, "%hhu", &circleoutinner) != 1)
circleoutinner = cl_cross_outline_inner->value;
circleoutalpha = outalpha;
bool circleoutinner = cl_cross_outline_inner->value;
gl.color(0, 0, 0, circleoutalpha);
auto radius = cl_cross_circle_radius->value;
auto radius = cl_cross_circle_radius->value * scalar;
if (circleoutinner == 0.0f)
if (!circleoutinner)
{
radius += (cl_cross_circle_thickness->value * 0.5f) + (circleout * 0.5f);
radius += cl_cross_circle_thickness->value * scalar * 0.5f;
gl.line_width(circleout);
}
else
{
gl.line_width(cl_cross_circle_thickness->value + circleout);
gl.line_width(cl_cross_circle_thickness->value * scalar + (circleout * 2.0f));
}
if (old_circle_radius != radius) {
@ -216,22 +246,41 @@ int CHudCrosshairs::Draw(float time)
gl.color(r, g, b, alpha);
// Draw the crosshairs.
if (cl_cross_thickness->value > 0.0f) {
//gl.line_width(cl_cross_thickness->value);
//clamp dot size to prevent using it as a full screen transparent mask for highlighting eneimies like with the /nvg night vision server plugin.
gl.line_width(min(cl_cross_thickness->value, ScreenHeight() * 0.3f));
if (cl_cross_thickness->value > 0.0f && cl_cross_size->value > 0.0f) {
float size;
float gap = cl_cross_gap->value * scalar;
float size = cl_cross_size->value;
float gap = cl_cross_gap->value;
// Box crosshair. This is needed since line thickness seems to cap out at 10 on my system.
if (cl_cross_thickness->value > cl_cross_size->value) {
gl.line_width(cl_cross_size->value * scalar);
float half_size = cl_cross_size->value * scalar * 0.5f;
float half_thickness = cl_cross_thickness->value * scalar * 0.5f;
if (cl_cross_line_top->value)
gl.line(Vector2D(center.x - half_thickness, center.y - gap - half_size), Vector2D(center.x + half_thickness, center.y - gap - half_size));
if (cl_cross_line_bottom->value)
gl.line(Vector2D(center.x - half_thickness, center.y + gap + half_size), Vector2D(center.x + half_thickness, center.y + gap + half_size));
if (cl_cross_line_left->value)
gl.line(Vector2D(center.x - gap - half_size, center.y + half_thickness), Vector2D(center.x - gap - half_size, center.y - half_thickness));
if (cl_cross_line_right->value)
gl.line(Vector2D(center.x + gap + half_size, center.y + half_thickness), Vector2D(center.x + gap + half_size, center.y - half_thickness));
}
// Normal cross.
else {
gl.line_width(cl_cross_thickness->value * scalar);
size = cl_cross_size->value * scalar;
if (cl_cross_line_top->value)
gl.line(Vector2D(center.x, center.y - gap - size), Vector2D(center.x, center.y - gap));
if (cl_cross_line_bottom->value)
gl.line(Vector2D(center.x, center.y + gap + size), Vector2D(center.x, center.y + gap));
if (cl_cross_line_left->value)
gl.line(Vector2D(center.x - gap - size, center.y), Vector2D(center.x - gap, center.y));
if (cl_cross_line_right->value)
gl.line(Vector2D(center.x + gap + size, center.y), Vector2D(center.x + gap, center.y));
}
if (cl_cross_line_top->value)
gl.line(Vector2D(center.x, center.y - gap - size), Vector2D(center.x, center.y - gap));
if (cl_cross_line_bottom->value)
gl.line(Vector2D(center.x, center.y + gap + size), Vector2D(center.x, center.y + gap));
if (cl_cross_line_left->value)
gl.line(Vector2D(center.x - gap - size, center.y), Vector2D(center.x - gap, center.y));
if (cl_cross_line_right->value)
gl.line(Vector2D(center.x + gap + size, center.y), Vector2D(center.x + gap, center.y));
}
// Draw the circle.
@ -250,9 +299,9 @@ int CHudCrosshairs::Draw(float time)
gl.color(r, g, b, circlealpha);
}
gl.line_width(cl_cross_circle_thickness->value);
gl.line_width(cl_cross_circle_thickness->value * scalar);
float radius = cl_cross_circle_radius->value;
float radius = cl_cross_circle_radius->value * scalar;
if (old_circle_radius != radius) {
// Recompute the circle points.
circle_points = HudGL::compute_circle(radius);
@ -278,9 +327,9 @@ int CHudCrosshairs::Draw(float time)
gl.color(r, g, b, dotalpha);
}
//float size = cl_cross_dot_size->value;
//float size = cl_cross_dot_size->value * scalar;
//clamp dot size to prevent using it as a full screen transparent mask for highlighting eneimies like with the /nvg night vision server plugin.
float size = min(cl_cross_dot_size->value, ScreenHeight() * 0.2f);
float size = min(cl_cross_dot_size->value * scalar, ScreenHeight() * 0.2f);
Vector2D offset = Vector2D(size / 2.0f, size / 2.0f);
gl.rectangle(center - offset, center + offset);

View file

@ -31,6 +31,7 @@ class CHudCrosshairs : public CHudBase
cvar_t* cl_cross_line_bottom;
cvar_t* cl_cross_line_left;
cvar_t* cl_cross_line_right;
cvar_t* cl_cross_scaling;
float old_circle_radius;
std::vector<Vector2D> circle_points;

View file

@ -561,7 +561,7 @@ void CHudSpectator::DrawOverviewMap()
gEngfuncs.pTriAPI->CullFace(TRI_NONE);
gEngfuncs.pTriAPI->SpriteTexture((struct model_s*)(gEngfuncs.GetSpritePointer(m_hsprWhite)), 0);
float gammaScale = 1.0f / gHUD.GetGammaSlope();
float gammaScale = 1.0f/* / gHUD.GetGammaSlope()*/;
// Draw the background.

View file

@ -41,47 +41,46 @@ int CHud::UpdateClientData(client_data_t *cdata, float time)
Think();
//cdata->fov = m_iFOV;
cdata->fov = m_iFOV;
float width = ScreenWidth();
float height = ScreenHeight();
//// Horizontal+ widescreen view correction - Removed after HL25 update
//float width = ScreenWidth();
//float height = ScreenHeight();
// Horizontal+ widescreen view correction - engine uses vertical- cropping
//// Cvar to let players use old widescreen. Only allow it to change when not alive so it can't be used as a zoom toggle.
//if (!gHUD.GetIsAlive(false))
//{
// wstoggle = CVAR_GET_FLOAT("cl_widescreen") != 0;
//}
// Cvar to let players use old widescreen. Only allow it to change when not alive so it can't be used as a zoom toggle.
if (!gHUD.GetIsAlive(false))
{
wstoggle = CVAR_GET_FLOAT("cl_widescreen") != 0;
}
//if (wstoggle)
//{
// m_wsFOV = atanf(tan(m_iFOV * M_PI / 360) * 0.75 * width / height) * 360 / M_PI;
if (wstoggle)
{
m_wsFOV = atanf(tan(m_iFOV * M_PI / 360) * 0.75 * width / height) * 360 / M_PI;
// //clamp for game balance
// if (m_iFOV == 105 && m_wsFOV > 121)
// {
// m_wsFOV = 120;
// }
// else if (m_iFOV == 100 && m_wsFOV > 117)
// {
// m_wsFOV = 116;
// }
// else if (m_iFOV == 90 && m_wsFOV > 107)
// {
// m_wsFOV = 106;
// }
// else if (m_wsFOV < 90)
// {
// m_wsFOV = 90;
// }
//}
//else
//{
// m_wsFOV = m_iFOV;
//}
//clamp for game balance
if (m_iFOV == 105 && m_wsFOV > 121)
{
m_wsFOV = 120;
}
else if (m_iFOV == 100 && m_wsFOV > 117)
{
m_wsFOV = 116;
}
else if (m_iFOV == 90 && m_wsFOV > 107)
{
m_wsFOV = 106;
}
else if (m_wsFOV < 90)
{
m_wsFOV = 90;
}
}
else
{
m_wsFOV = m_iFOV;
}
cdata->fov = m_wsFOV;
//cdata->fov = m_wsFOV;
CL_ResetButtonBits( m_iKeyBits );

View file

@ -61,6 +61,7 @@ extern "C"
#include "mod/AvHScrollHandler.h"
#include "mod/AvHCommanderModeHandler.h"
#include "util/Mat3.h"
#include "mod/AvHBasePlayerWeaponConstants.h"
#include "engine/APIProxy.h"
#include "Exports.h"
@ -135,16 +136,15 @@ cvar_t *cl_highdetail;
cvar_t *cl_cmhotkeys;
//cvar_t *cl_forcedefaultfov;
cvar_t *cl_dynamiclights;
cvar_t *r_dynamic;
cvar_t *cl_buildmessages;
cvar_t *cl_particleinfo;
cvar_t *cl_widescreen;
//cvar_t *cl_widescreen;
cvar_t *cl_ambientsound;
cvar_t *senslock;
cvar_t *hud_style;
cvar_t *cl_chatbeep;
cvar_t *cl_mutemenu;
cvar_t *cl_weaponcfgs;
cvar_t *cl_pistoltrigger;
/*
===============================================================================
@ -808,7 +808,7 @@ void IN_AttackUp(void)
in_cancel = 0;
// Attack2up only for onos so it can end +attack onos charges. Attack2up for all causes blink and leap to cancel if you release attack while blinking or leaping.
if (g_iUser3 == AVH_USER3_ALIEN_PLAYER5)
if (gHUD.GetCurrentWeaponID() == AVH_ABILITY_CHARGE)
{
IN_Attack2Up();
}
@ -1530,6 +1530,86 @@ void EchoDev(void)
gEngfuncs.Con_Printf("%s\n", gEngfuncs.Cmd_Argv(1));
}
void NsPreset(void)
{
int presetChoice = atoi(gEngfuncs.Cmd_Argv(1));
bool printToChat = gViewPort;
char execText[1024];
//char localizedText[1024];
switch (presetChoice)
{
case 1:
ClientCmd("exec presetcfgs/AV/ns32.cfg");
if (printToChat)
{
// Localize later.
//sprintf(localizedText, CHudTextMessage::BufferedLocaliseTextString("#Preset1"));
snprintf(execText, 1024, "%c** %s\n", HUD_PRINTTALK, "Classic NS audio/visual presets applied. Left click once to fix bug. See console for details.");
gHUD.m_TextMessage.MsgFunc_TextMsg(NULL, (int)strlen(execText) + 1, execText);
ClientCmd("echo \"NOTE: Left click once after applying these settings, or your next left click won't register. It's an HL engine bug.\""); // Use echo or it's out of order.
}
else
{
ClientCmd("toggleconsole");
}
break;
case 2:
ClientCmd("exec presetcfgs/AV/newdefault.cfg");
if (printToChat)
{
// Localize later.
//sprintf(localizedText, CHudTextMessage::BufferedLocaliseTextString("#Preset2"));
snprintf(execText, 1024, "%c** %s\n", HUD_PRINTTALK, "NS 3.3 audio/visual presets applied. Left click once to fix bug. See console for details. ");
gHUD.m_TextMessage.MsgFunc_TextMsg(NULL, (int)strlen(execText) + 1, execText);
ClientCmd("echo \"NOTE: Left click once after applying these settings, or your next left click won't register. It's an HL engine bug.\""); // Use echo or it's out of order.
}
else
{
ClientCmd("toggleconsole");
}
break;
case 3:
ClientCmd("exec presetcfgs/AV/competitive.cfg");
if (printToChat)
{
// Localize later.
//sprintf(localizedText, CHudTextMessage::BufferedLocaliseTextString("#Preset3"));
snprintf(execText, 1024, "%c** %s\n", HUD_PRINTTALK, "Competive audio/visual presets applied. Left click once to fix bug. See console for details.");
gHUD.m_TextMessage.MsgFunc_TextMsg(NULL, (int)strlen(execText) + 1, execText);
ClientCmd("echo \"NOTE: Left click once after applying these settings, or your next left click won't register. It's an HL engine bug.\""); // Use echo or it's out of order.
}
else
{
ClientCmd("toggleconsole");
}
break;
default:
gEngfuncs.Con_Printf("NS configuration preset selector. Useage:\n1: apply NS 3.2 settings\n2: apply NS 3.3 settings\n3: apply competitive settings\n");
}
}
void NsRates(void)
{
int ratesChoice = atoi(gEngfuncs.Cmd_Argv(1));
char execText[30];
if (ratesChoice >= 1 && ratesChoice <= 20)
{
snprintf(execText, 30, "exec presetcfgs/rates/%d.cfg", ratesChoice);
ClientCmd(execText);
}
// Don't show this if 0 is entered as an arg, as it's the normal behavior for the blank default setting in options.
else if (gEngfuncs.Cmd_Argc() <= 1 || ratesChoice != 0)
{
gEngfuncs.Con_Printf("nsrates selects from preset network rate commands. Start from \"nsrates 1\" and increase the number until your connection feels stable.\n");
}
}
/*
============
InitInput
@ -1604,6 +1684,8 @@ void InitInput (void)
gEngfuncs.pfnAddCommand("nsversion", NsVersion);
gEngfuncs.pfnAddCommand("echodev", EchoDev);
gEngfuncs.pfnAddCommand("nspreset", NsPreset);
gEngfuncs.pfnAddCommand("nsrates", NsRates);
lookstrafe = gEngfuncs.pfnRegisterVariable ( "lookstrafe", "0", FCVAR_ARCHIVE );
lookspring = gEngfuncs.pfnRegisterVariable ( "lookspring", "0", FCVAR_ARCHIVE );
@ -1627,8 +1709,8 @@ void InitInput (void)
cl_autohelp = gEngfuncs.pfnRegisterVariable ( kvAutoHelp, "1.0", FCVAR_ARCHIVE );
cl_centerentityid = gEngfuncs.pfnRegisterVariable ( kvCenterEntityID, "0.0", FCVAR_ARCHIVE );
cl_musicenabled = gEngfuncs.pfnRegisterVariable ( kvMusicEnabled, "0", FCVAR_ARCHIVE );
cl_musicvolume = gEngfuncs.pfnRegisterVariable ( kvMusicVolume, "1", FCVAR_ARCHIVE );
cl_musicenabled = gEngfuncs.pfnRegisterVariable ( kvMusicEnabled, "1", FCVAR_ARCHIVE );
cl_musicvolume = gEngfuncs.pfnRegisterVariable ( kvMusicVolume, "0.6", FCVAR_ARCHIVE );
cl_musicdir = gEngfuncs.pfnRegisterVariable ( kvMusicDirectory, "", FCVAR_ARCHIVE);
cl_musicdelay = gEngfuncs.pfnRegisterVariable ( kvMusicDelay, "90", FCVAR_ARCHIVE);
cl_dynamiclights = gEngfuncs.pfnRegisterVariable ( kvDynamicLights, "1", FCVAR_ARCHIVE );
@ -1638,13 +1720,13 @@ void InitInput (void)
cl_cmhotkeys = gEngfuncs.pfnRegisterVariable ( kvCMHotkeys, "qwerasdfzxcv", FCVAR_ARCHIVE );
//cl_forcedefaultfov = gEngfuncs.pfnRegisterVariable ( kvForceDefaultFOV, "0", FCVAR_ARCHIVE );
cl_particleinfo = gEngfuncs.pfnRegisterVariable ( kvParticleInfo, "0", FCVAR_ARCHIVE );
cl_widescreen = gEngfuncs.pfnRegisterVariable ( kvWidescreen, "1", FCVAR_ARCHIVE );
cl_ambientsound = gEngfuncs.pfnRegisterVariable ( kvAmbientSound, "0", FCVAR_ARCHIVE);
//cl_widescreen = gEngfuncs.pfnRegisterVariable ( kvWidescreen, "1", FCVAR_ARCHIVE );
cl_ambientsound = gEngfuncs.pfnRegisterVariable ( kvAmbientSound, "0.6", FCVAR_ARCHIVE);
senslock = gEngfuncs.pfnRegisterVariable ("senslock", "0", FCVAR_ARCHIVE);
hud_style = gEngfuncs.pfnRegisterVariable ("hud_style", "1", FCVAR_ARCHIVE);
cl_chatbeep = gEngfuncs.pfnRegisterVariable ("cl_chatbeep", "1", FCVAR_ARCHIVE);
cl_mutemenu = gEngfuncs.pfnRegisterVariable ("cl_mutemenu", "3", FCVAR_ARCHIVE);
cl_weaponcfgs = gEngfuncs.pfnRegisterVariable ("cl_weaponcfgs", "1", FCVAR_ARCHIVE);
cl_pistoltrigger = gEngfuncs.pfnRegisterVariable ("cl_pistoltrigger", "1", FCVAR_ARCHIVE | FCVAR_USERINFO);
// Initialize third person camera controls.
CAM_Init();

View file

@ -96,14 +96,18 @@ int old_mouse_x, old_mouse_y, mx_accum, my_accum;
float mouse_x, mouse_y;
static int restore_spi;
//// Previous code from HL SDK windows98 for era paramaters. See comments in IN_StartupMouse.
//// Previous code from Quake era forced mouse accel. Also adjusted launch params in IN_StartupMouse.
//static int originalmouseparms[3], newmouseparms[3] = {0, 0, 1};
////Mouse accel forced off.
static int originalmouseparms[3], newmouseparms[3] = { 0, 0, 0};
static int mouseactive = 0;
int mouseinitialized;
static int mouseparmsvalid;
static int mouseshowtoggle = 1;
////2024 - Added to fix view spin when disabling the cursor.
static bool cursorDisabledThisFrame = false;
// joystick defines and variables
// where should defines be moved?
#define JOY_ABSOLUTE_AXIS 0x00000000 // control like a joystick
@ -311,7 +315,21 @@ void IN_SetVisibleMouse(bool visible)
g_iVisibleMouse = visible;
IN_SetMouseMode(!visible);
////2024 - Disabled this as SDL mouse mode is handled per use of UIManager::SetMouseVisibility to fix edge case bugs with centering and showing/not showing cursor in game and in the escape menu.
//IN_SetMouseMode(!visible);
//2024 - Added to fix view spin when disabling the cursor. Reassess after new SDK is released.
cursorDisabledThisFrame = (!visible);
////2024 - Move centering here?
//if (visible && gHUD.m_bWindowed)
//{
// gEngfuncs.pfnSetMousePos(ScreenWidth() / 2, ScreenHeight() / 2);
//}
//else
//{
// gEngfuncs.pfnSetMousePos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
//}
#ifdef _WIN32
UpdateMouseThreadActive();
@ -389,12 +407,7 @@ void IN_StartupMouse (void)
if (mouseparmsvalid)
{
//// Original mouse parameter code. SPI_GETMOUSE windows parameters changed either in win2000 or winxp and these launch parameters haven't made sense since.
//// The newmouseparms[2] (mouse accel on/off in newer windows) was also hardcoded to 1 previously, forcing acceleration on for players without noforcemspd or noforcemparms parameters. This was done so to make mouse speed = 1 in win98.
//// SPI_GETMOUSE documentation:
//// Win10: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfoa
//// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-mouse_event
//// Win98: Retrieve the x-axis and y-axis threshold values for the mouse as well as the mouse speed. uiParam must be 0. pvParam is a 3-element array of Long-type variables which receives the x-threshold, y-threshold, and mouse speed.
//// Original mouse parameter code before disabling forced mouse acceleration.
//if ( gEngfuncs.CheckParm ("-noforcemspd", NULL ) )
// newmouseparms[2] = originalmouseparms[2];
//
@ -646,6 +659,14 @@ void IN_GetMouseDelta( int *pOutX, int *pOutY)
mx = deltaX + mx_accum;
my = deltaY + my_accum;
}
//2024 - Added to fix view spin when disabling the cursor.
if (cursorDisabledThisFrame)
{
mx = 0;
my = 0;
cursorDisabledThisFrame = false;
}
mx_accum = 0;
my_accum = 0;
@ -760,7 +781,7 @@ void IN_MouseMove ( float frametime, usercmd_t *cmd)
}
}
}
gEngfuncs.SetViewAngles( (float *)viewangles );
/*
@ -805,7 +826,7 @@ void CL_DLLEXPORT IN_Accumulate (void)
int deltaX, deltaY;
SDL_GetRelativeMouseState( &deltaX, &deltaY );
mx_accum += deltaX;
my_accum += deltaY;
my_accum += deltaY;
}
// force the mouse to the center, so there's room to move

View file

@ -0,0 +1,215 @@
#include "hud.h"
#include "cl_util.h"
//#include "PlatformHeaders.h"
#ifdef _WIN32
#include "windows.h"
#endif
#include <GL/glew.h>
//#include <gl/GL.h>
#include "util/ShaderUtil.h"
cvar_t* cl_postprocess = NULL;
cvar_t* cl_intensity = NULL;
GLuint screenTexture;
GLenum glew;
ShaderUtil shaderUtil;
void CPostProcessShader::Init()
{
//glActiveTexture(GL_TEXTURE0);
//glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTextAtInit);
// Create the screen texture
glGenTextures(1, &screenTexture);
glBindTexture(GL_TEXTURE_2D, screenTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, ScreenWidth(), ScreenHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
cl_postprocess = CVAR_CREATE("cl_postprocess", "1", FCVAR_ARCHIVE);
cl_intensity = CVAR_CREATE("cl_intensity", "0.55", FCVAR_ARCHIVE);
CVAR_CREATE("cl_intensityalt", "1", FCVAR_ARCHIVE);
// Store shaders in dll so swapping in different ones is harder.
const std::string vertShader =
"#version 330 core\n"
"layout(location = 0) in vec2 vertexPosition;\n"
"out vec2 texCoord;\n"
"void main() {\n"
// Convert vertex position to texture coordinates
"texCoord = (vertexPosition + 1.0) * 0.5;\n"
"gl_Position = vec4(vertexPosition, 0.0, 1.0);\n"
"}\n"
;
const std::string fragShader =
"#version 330 core\n"
"in vec2 texCoord;\n"
"out vec4 fragColor;\n"
"uniform sampler2D textureSampler;\n"
"uniform float colorMultiplier;\n"
"void main() {\n"
// Sample the texture
"vec4 texColor = texture(textureSampler, texCoord);\n"
// Multiply the color
"fragColor = vec4(texColor.rgb * colorMultiplier, 1.0f);\n"
"}\n"
;
glew = glewInit();
if (GLEW_OK != glew)
{
/* Problem: glewInit failed, something is seriously wrong. */
// fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
gEngfuncs.Con_DPrintf("[GLEW] Error: %s\n", glewGetErrorString(glew));
}
else
{
gEngfuncs.Con_DPrintf("[GLEW] Initialize success!\n");
//shaderUtil.LoadFromFile(std::string(gEngfuncs.pfnGetGameDirectory() + (std::string) "/shaders/vs.shaders"), std::string(gEngfuncs.pfnGetGameDirectory() + (std::string) "/shaders/fs.shaders"));
shaderUtil.LoadFromString(vertShader, fragShader);
}
return;
}
void CPostProcessShader::ClearFrameBuffer()
{
if (cl_postprocess->value <= 0 || cl_intensity->value <= 0)
return;
//glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
//GLfloat clearColors[] = { 0.0f, 0.0f, 0.0f, 1.0f };
//GLint drawFboId;
//GLint readFboId;
//GLint FboId;
//glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &drawFboId);
//glBindFramebuffer(GL_FRAMEBUFFER, drawFboId);
//glClearBufferfv(GL_COLOR, 0, clearColors);
//glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &readFboId);
//glBindFramebuffer(GL_FRAMEBUFFER, readFboId);
//glClearBufferfv(GL_COLOR, 0, clearColors);
//glGetIntegerv(GL_FRAMEBUFFER_BINDING, &FboId);
//glBindFramebuffer(GL_FRAMEBUFFER, FboId);
//glClearBufferfv(GL_COLOR, 0, clearColors);
}
void CPostProcessShader::DrawShader()
{
if (cl_postprocess->value <= 0 || cl_intensity->value <= 0)
return;
// TO DO: Check NPOT texture support and shader support for older systems. HL might already check NPOT for FBO mode.
const int error1 = glGetError();
if (error1 != 0)
gEngfuncs.Con_DPrintf("before shader error %d\n", error1);
glPushAttrib(GL_TEXTURE_BIT);
glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
//// Might need some of these if things break.
//glViewport(0, 0, ScreenWidth(), ScreenHeight());
//glActiveTexture(GL_TEXTURE0);
//glEnable(GL_TEXTURE_RECTANGE_NV);
//glColor3f(1, 1, 1);
//glDisable(GL_DEPTH_TEST);
//glMatrixMode(GL_MODELVIEW);
//glPushMatrix();
//glLoadIdentity();
//glMatrixMode(GL_PROJECTION);
//glPushMatrix();
//glLoadIdentity();
//glOrtho(0, 1, 1, 0, 0.1, 100);
//glReadBuffer(GL_COLOR_ATTACHMENT0);
//glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, screenTexture);
//// Solokiller's code to copy from MSAA/scaling framebuffer
//glFinish(); // Significant performance hit with this and it seems to work without it.
GLint drawFboId;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &drawFboId);
glBindFramebuffer(GL_READ_FRAMEBUFFER, drawFboId);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBlitFramebuffer(0, 0, ScreenWidth(), ScreenHeight(), 0, 0, ScreenWidth(), ScreenHeight(), GL_COLOR_BUFFER_BIT, GL_NEAREST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, drawFboId);
glReadBuffer(GL_BACK);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, ScreenWidth(), ScreenHeight(), 0);
const int error2 = glGetError();
if (error2 != 0)
gEngfuncs.Con_DPrintf("framebuffer copy error %d\n", error2);
float colorMultiplier = 1.0f;
const float scalarCvar = min(2.0f, max( 0.0f, cl_intensity->value));
//const float colorMultiplier = max( 1.0f, max(scalarCvar, 1.0f + (gHUD.GetGammaSlope() - 1.0f) * scalarCvar));
// Scale the map's gamma value.
if (gHUD.GetGammaSlope() > 1.0f)
{
colorMultiplier = 1.0f + (gHUD.GetGammaSlope() - 1.0f) * scalarCvar;
}
// If the map has no gamma value, override it with the cvar's value.
else
{
colorMultiplier = min(1.0f, scalarCvar);
}
// Use shader.
glUseProgram(shaderUtil.GetProgramID());
//glUniform1f(glGetUniformLocation(shaderUtil.GetProgramID(), "textureMap"), 0);
glUniform1f(glGetUniformLocation(shaderUtil.GetProgramID(), "colorMultiplier"), colorMultiplier);
// Draw the quad.
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex3f(-1, 1, -1);
glTexCoord2f(0, 1);
glVertex3f(-1, -1, -1);
glTexCoord2f(1, 1);
glVertex3f(1, -1, -1);
glTexCoord2f(1, 0);
glVertex3f(1, 1, -1);
glEnd();
// Restore state.
glUseProgram(0);
//glBindTexture(GL_TEXTURE_2D, 0);
//glBindVertexArray(0);
glPopAttrib();
glPopClientAttrib();
//glMatrixMode(GL_PROJECTION);
//glPopMatrix();
//glMatrixMode(GL_MODELVIEW);
//glPopMatrix();
//glDisable(GL_TEXTURE_RECTANGE_NV); // Don't disable texture_2d or ui bugs out.
//glEnable(GL_DEPTH_TEST);
const int error3 = glGetError();
if (error3 != 0)
gEngfuncs.Con_DPrintf("shader error %d\n", error3);
}

View file

@ -182,7 +182,14 @@ void CreatePickingRay( int mousex, int mousey, Vector& outVecPickingRay )
// char gDebugMessage[256];
float fovDegrees = gHUD.m_wsFOV;
//float fovDegrees = gHUD.m_wsFOV;
bool wideScreen = CVAR_GET_FLOAT("gl_widescreen_yfov");
float fovDegrees = gHUD.m_iFOV;
//Adjust for widescreen FOV
if (wideScreen)
{
fovDegrees = atanf(tan(gHUD.m_iFOV * M_PI / 360) * 0.75f * ScreenWidth() / ScreenHeight()) * 360 / M_PI;
}
//cl_entity_s* theLocalEntity = gEngfuncs.GetLocalPlayer();
//Vector vecRenderOrigin = theLocalEntity->origin;

View file

@ -185,9 +185,16 @@ void ScorePanel::HitTestPanel::internalMousePressed(MouseCode code)
if (SDL_GetRelativeMouseMode() == SDL_TRUE)
{
SDL_SetRelativeMouseMode(SDL_FALSE);
//gEngfuncs.pfnSetMousePos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
//Fix for windowed mode centering being incorrect.
gEngfuncs.pfnSetMousePos(ScreenWidth() / 2, ScreenHeight() / 2);
if (gHUD.m_bWindowed)
{
gEngfuncs.pfnSetMousePos(ScreenWidth() / 2, ScreenHeight() / 2);
}
else
{
gEngfuncs.pfnSetMousePos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
}
//#ifdef WIN32
//ShowCursor(FALSE);
@ -205,8 +212,11 @@ void ScorePanel::HitTestPanel::internalMousePressed(MouseCode code)
vgui::Color BuildColor( int R, int G, int B, float gamma )
{
ASSERT( gamma != 0 );
return vgui::Color( R/gamma, G/gamma, B/gamma, 0 );
// 2024 - remove old gamma ramp compensation
//ASSERT( gamma != 0 );
//return vgui::Color( R/gamma, G/gamma, B/gamma, 0 );
return vgui::Color(R, G, B, 0);
}
//-----------------------------------------------------------------------------

View file

@ -148,13 +148,13 @@ void SpectatorPanel::Initialize()
CSchemeManager * pSchemes = gViewPort->GetSchemeManager();
int colorR = 128 / gHUD.GetGammaSlope();
int colorG = 128 / gHUD.GetGammaSlope();
int colorB = 128 / gHUD.GetGammaSlope();
int colorR = 128/* / gHUD.GetGammaSlope()*/;
int colorG = 128/* / gHUD.GetGammaSlope()*/;
int colorB = 128/* / gHUD.GetGammaSlope()*/;
int armedColorR = 255 / gHUD.GetGammaSlope();
int armedColorG = 255 / gHUD.GetGammaSlope();
int armedColorB = 255 / gHUD.GetGammaSlope();
int armedColorR = 255/* / gHUD.GetGammaSlope()*/;
int armedColorG = 255/* / gHUD.GetGammaSlope()*/;
int armedColorB = 255/* / gHUD.GetGammaSlope()*/;
SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle( /*"Team Info Text"*/ "PieMenuScheme" );

View file

@ -157,15 +157,15 @@ public:
case PLAYERCLASS_DEAD_MARINE:
case PLAYERCLASS_DEAD_ALIEN:
case PLAYERCLASS_REINFORCING:
r = 255 / gHUD.GetGammaSlope();
g = 0 / gHUD.GetGammaSlope();
b = 0 / gHUD.GetGammaSlope();
r = 255/* / gHUD.GetGammaSlope()*/;
g = 0/* / gHUD.GetGammaSlope()*/;
b = 0/* / gHUD.GetGammaSlope()*/;
break;
default:
r = kTeamColors[theTeamNumber][0] / gHUD.GetGammaSlope();
g = kTeamColors[theTeamNumber][1] / gHUD.GetGammaSlope();
b = kTeamColors[theTeamNumber][2] / gHUD.GetGammaSlope();
r = kTeamColors[theTeamNumber][0]/* / gHUD.GetGammaSlope()*/;
g = kTeamColors[theTeamNumber][1]/* / gHUD.GetGammaSlope()*/;
b = kTeamColors[theTeamNumber][2]/* / gHUD.GetGammaSlope()*/;
break;
}
@ -1524,8 +1524,14 @@ void TeamFortressViewport::HideOptionsMenu()
gHUD.GetManager().SetMouseVisibility(false);
//gEngfuncs.pfnSetMousePos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
gEngfuncs.pfnSetMousePos(ScreenWidth() / 2, ScreenHeight() / 2);
if (gHUD.m_bWindowed)
{
gEngfuncs.pfnSetMousePos(ScreenWidth() / 2, ScreenHeight() / 2);
}
else
{
gEngfuncs.pfnSetMousePos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
}
}
}

View file

@ -104,6 +104,7 @@ cvar_t *v_centerspeed;
cvar_t *cl_bobcycle;
cvar_t *cl_bob;
cvar_t *cl_bobup;
cvar_t *cl_bobview;
cvar_t *cl_waterdist;
cvar_t *cl_chasedist;
cvar_t *cl_hudcam;
@ -621,8 +622,12 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
// refresh position
VectorCopy ( pparams->simorg, pparams->vieworg );
pparams->vieworg[2] += ( bob );
VectorAdd( pparams->vieworg, pparams->viewheight, pparams->vieworg );
if (cl_bobview && cl_bobview->value != 0)
{
pparams->vieworg[2] += ( bob );
}
VectorAdd(pparams->vieworg, pparams->viewheight, pparams->vieworg);
VectorCopy ( pparams->cl_viewangles, pparams->viewangles );
@ -754,8 +759,12 @@ void V_CalcNormalRefdef ( struct ref_params_s *pparams )
{
view->origin[ i ] += bob * 0.4 * pparams->forward[ i ];
}
view->origin[2] += bob;
if (cl_bobview && cl_bobview->value > 0.0f)
{
view->origin[2] += bob;
}
//// 2024 - This doesn't do what it's supposed to, and commenting it out makes the weapon model go nuts.
// throw in a little tilt.
view->angles[YAW] -= bob * 0.5;
view->angles[ROLL] -= bob * 1;
@ -2148,10 +2157,10 @@ void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
gunModel->origin[ i ] += bob * 0.4 * forward[ i ];
}
// throw in a little tilt.
gunModel->angles[YAW] -= bob * 0.5;
gunModel->angles[ROLL] -= bob * 1;
gunModel->angles[PITCH] -= bob * 0.3;
//// throw in a little tilt.
//gunModel->angles[YAW] -= bob * 0.5;
//gunModel->angles[ROLL] -= bob * 1;
//gunModel->angles[PITCH] -= bob * 0.3;
VectorCopy( gunModel->angles, gunModel->curstate.angles );
VectorCopy( gunModel->angles, gunModel->latched.prevangles );
@ -2210,6 +2219,8 @@ void CL_DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams )
{
// RecClCalcRefdef(pparams);
g_PostProcessShader.ClearFrameBuffer();
// intermission / finale rendering
if ( pparams->intermission )
{
@ -2295,12 +2306,17 @@ void V_Init (void)
v_centermove = gEngfuncs.pfnRegisterVariable( "v_centermove", "0.15", 0 );
v_centerspeed = gEngfuncs.pfnRegisterVariable( "v_centerspeed","500", 0 );
cl_bobcycle = gEngfuncs.pfnRegisterVariable( "cl_bobcycle","0.8", 0 );// best default for my experimental gun wag (sjb)
cl_bob = gEngfuncs.pfnRegisterVariable( "cl_bob","0.01", 0 );// best default for my experimental gun wag (sjb)
cl_bobup = gEngfuncs.pfnRegisterVariable( "cl_bobup","0.5", 0 );
cl_bobcycle = gEngfuncs.pfnRegisterVariable( "cl_bobcycle","0.8", FCVAR_ARCHIVE);// best default for my experimental gun wag (sjb)
cl_bob = gEngfuncs.pfnRegisterVariable( "cl_bob","0.01", FCVAR_ARCHIVE);// best default for my experimental gun wag (sjb)
cl_bobup = gEngfuncs.pfnRegisterVariable( "cl_bobup","0.5", FCVAR_ARCHIVE);
cl_bobview = gEngfuncs.pfnRegisterVariable( "cl_bobview","0", FCVAR_ARCHIVE);
cl_waterdist = gEngfuncs.pfnRegisterVariable( "cl_waterdist","4", 0 );
cl_hudcam = gEngfuncs.pfnRegisterVariable( "cl_hudcam", "1", 0 );
cl_chasedist = gEngfuncs.pfnRegisterVariable( "cl_chasedist", "200", 0 );
// lightgamma doesn't save to config.cfg otherwise.
cvar_t* lightgamma = gEngfuncs.pfnGetCvarPointer("lightgamma");
lightgamma->flags |= FCVAR_ARCHIVE;
}

View file

@ -1169,10 +1169,13 @@ void ClientPrecache( void )
PRECACHE_UNMODIFIED_GENERIC("ns_shiva.wad");
PRECACHE_UNMODIFIED_GENERIC("ns_tanith.wad");
// Waste of memory, but files must be precached for the hash check to work.
PRECACHE_UNMODIFIED_GENERIC("dlls/ns.dll");
PRECACHE_UNMODIFIED_GENERIC("cl_dlls/client.dll");
PRECACHE_UNMODIFIED_GENERIC("dlls/ns.so");
PRECACHE_UNMODIFIED_GENERIC("cl_dlls/client.so");
//PRECACHE_UNMODIFIED_GENERIC("gl_shaders/fs_world.frag");
//PRECACHE_UNMODIFIED_GENERIC("gl_shaders/vs_world.vert");
/* PRECACHE_UNMODIFIED_GENERIC("maps/co_angst_detail.txt");
PRECACHE_UNMODIFIED_GENERIC("maps/co_core_detail.txt");
@ -2341,7 +2344,7 @@ int InconsistentFile( const edict_t *player, const char *filename, char *disconn
return 1;
}
// Cheating prone files that aren't commonly used for customization.
if ( (strstr(filename, "player/pl_") != NULL) || (strstr(filename, "player/role") != NULL) || (strstr(filename, ".wad") != NULL) || (strstr(filename, "misc/egg_idle.wav") != NULL)){
if ( (strstr(filename, "player/pl_") != NULL) || (strstr(filename, "player/role") != NULL) || (strstr(filename, ".wad") != NULL) || (strstr(filename, "misc/egg_idle.wav") != NULL) || (strstr(filename, "gl_shaders/") != NULL)){
// Default behavior is to kick the player
sprintf(disconnect_message, "Server is enforcing file consistency for %s. Files available at github.com/ENSL/NS#downloads\n", filename);
// Kick now with specified disconnect message.

View file

@ -120,12 +120,13 @@ cvar_t avh_votepercentneeded = {kvVotePercentNeeded, ".3", FCVAR_SERVER};
cvar_t avh_autoconcede = {kvAutoConcede, "4", FCVAR_SERVER};
cvar_t avh_combattime = {kvCombatTime, "10", FCVAR_SERVER};
cvar_t avh_mapvoteratio = {kvMapVoteRatio, ".6", FCVAR_SERVER};
cvar_t avh_blockscripts = {kvBlockScripts, "1", FCVAR_SERVER};
cvar_t avh_blockscripts = {kvBlockScripts, "0", FCVAR_SERVER};
cvar_t avh_jumpmode = {kvJumpMode, "1", FCVAR_SERVER};
cvar_t avh_version = {kvVersion, "330", FCVAR_SERVER};
cvar_t avh_widescreenclamp = {kvWidescreenClamp, "0", FCVAR_SERVER};
cvar_t avh_randomrfk = {kvRandomRfk, "0", FCVAR_SERVER};
//playtest cvars
cvar_t avh_fastjp = {kvfastjp, "0", FCVAR_SERVER};
cvar_t avh_randomrfk = {kvRandomRfk, "1", FCVAR_SERVER};
cvar_t avh_parasiteonmap = {kvParasiteOnMap, "0", FCVAR_SERVER };
#ifdef DEBUG
@ -169,6 +170,11 @@ cvar_t avh_killdelay = {kvKillDelay, "0", FCVAR_SERVER};
cvar_t *g_psv_gravity = NULL;
cvar_t *g_psv_aim = NULL;
cvar_t *g_footsteps = NULL;
cvar_t* sv_maxupdaterate = NULL;
cvar_t* sv_maxunlag = NULL;
cvar_t* sv_rollangle = NULL;
cvar_t* sv_allow_shaders = NULL;
// END Cvars for Skill Level settings
@ -239,6 +245,7 @@ void GameDLLInit( void )
CVAR_REGISTER (&avh_blockscripts);
CVAR_REGISTER (&avh_jumpmode);
CVAR_REGISTER (&avh_version);
CVAR_REGISTER (&avh_widescreenclamp);
//playtest cvars
CVAR_REGISTER (&avh_fastjp);
CVAR_REGISTER (&avh_randomrfk);
@ -270,5 +277,34 @@ void GameDLLInit( void )
CVAR_REGISTER (&avh_uplink);
CVAR_REGISTER (&avh_killdelay);
// Initialize rates for servers that have old configs without them.
sv_maxupdaterate = CVAR_GET_POINTER("sv_maxupdaterate");
if(sv_maxupdaterate)
{
//sv_maxupdaterate->value = 102.0f;
CVAR_SET_FLOAT("sv_maxupdaterate", 102.0f);
}
sv_maxunlag = CVAR_GET_POINTER("sv_maxunlag");
if (sv_maxunlag)
{
//sv_maxunlag->value = 0.3f;
CVAR_SET_FLOAT("sv_maxunlag", 0.3f);
}
// Remove HL25 addition of roll angle and overbright shader in code so servers don't need to update configs.
sv_rollangle = CVAR_GET_POINTER("sv_rollangle");
if (sv_rollangle)
{
//sv_rollangle->value = 0.0f;
CVAR_SET_FLOAT("sv_rollangle", 0.0f);
}
sv_allow_shaders = CVAR_GET_POINTER("sv_allow_shaders");
if (sv_allow_shaders)
{
//sv_allow_shaders->value = 0.0f;
CVAR_SET_FLOAT("sv_allow_shaders", 0.0f);
}
}

View file

@ -1357,7 +1357,6 @@
</ClCompile>
<ClCompile Include="..\util\Balance.cpp" />
<ClCompile Include="..\util\Checksum.cpp" />
<ClCompile Include="..\util\GammaTable.cpp" />
<ClCompile Include="..\util\LinuxSupport.cpp" />
<ClCompile Include="..\util\Mat3.cpp" />
<ClCompile Include="..\util\MathUtil.cpp" />
@ -1485,7 +1484,6 @@
<ClInclude Include="..\util\Balance.h" />
<ClInclude Include="..\util\Checksum.h" />
<ClInclude Include="..\util\CString.h" />
<ClInclude Include="..\util\GammaTable.h" />
<ClInclude Include="..\util\LinuxSupport.h" />
<ClInclude Include="..\util\Mat3.h" />
<ClInclude Include="..\util\MathUtil.h" />

View file

@ -473,9 +473,6 @@
<ClCompile Include="..\util\Checksum.cpp">
<Filter>util</Filter>
</ClCompile>
<ClCompile Include="..\util\GammaTable.cpp">
<Filter>util</Filter>
</ClCompile>
<ClCompile Include="..\util\LinuxSupport.cpp">
<Filter>util</Filter>
</ClCompile>
@ -856,9 +853,6 @@
<ClInclude Include="..\util\CString.h">
<Filter>util</Filter>
</ClInclude>
<ClInclude Include="..\util\GammaTable.h">
<Filter>util</Filter>
</ClInclude>
<ClInclude Include="..\util\LinuxSupport.h">
<Filter>util</Filter>
</ClInclude>

View file

@ -361,6 +361,9 @@ public:
// Added by mmcguire.
virtual bool GetCanUseWeapon() const { return true; }
// Networked user options
int m_iAutoWeaponSwap;
int m_iPistolTrigger;
};
#define AUTOAIM_2DEGREES 0.0348994967025

View file

@ -949,7 +949,9 @@ BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted )
void CBasePlayerWeapon::ItemPostFrame( void )
{
bool theAttackPressed = (m_pPlayer->pev->button & IN_ATTACK) && !(m_pPlayer->pev->button & IN_ATTACK2);
// Block attacks during +movement except for lerk.
bool theAttackPressed = (m_pPlayer->pev->button & IN_ATTACK) && (!(m_pPlayer->pev->button & IN_ATTACK2) || m_pPlayer->pev->iuser3 == AVH_USER3_ALIEN_PLAYER3);
bool pistolAttackUp = (m_pPlayer->m_iPistolTrigger && m_pPlayer->m_afButtonLast & IN_ATTACK && m_pPlayer->m_afButtonReleased & IN_ATTACK && m_iId == AVH_WEAPON_PISTOL);
bool theWeaponPrimes = (this->GetWeaponPrimeTime() > 0.0f);
bool theWeaponIsPriming = this->GetIsWeaponPriming();
@ -988,7 +990,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
else
*/
if ( theAttackPressed && m_pPlayer->GetCanUseWeapon())
if ( (theAttackPressed || m_bAttackQueued || pistolAttackUp) && m_pPlayer->GetCanUseWeapon())
{
if ((m_fInSpecialReload == 1 || m_fInSpecialReload == 2) && m_iClip != 0)
{
@ -1003,8 +1005,22 @@ void CBasePlayerWeapon::ItemPostFrame( void )
}
m_pPlayer->TabulateAmmo();
PrimaryAttack();
PrimaryAttack(pistolAttackUp);
}
else
{
QueueAttack(pistolAttackUp);
}
}
else if (m_pPlayer->pev->button & IN_ATTACK2)
{
if (m_pPlayer->pev->iuser3 == AVH_USER3_ALIEN_PLAYER2 && m_pPlayer->GetCanUseWeapon())
{
if (CanAttack(m_flNextPrimaryAttack, gpGlobals->time, UseDecrement()))
{
SecondaryAttack();
}
}
}
else if ( m_pPlayer->pev->button & IN_RELOAD && iMaxClip() != WEAPON_NOCLIP && !m_fInReload )
{

View file

@ -353,7 +353,8 @@ public:
virtual void ItemPostFrame( void ); // called each frame by the player PostThink
// called by CBasePlayerWeapons ItemPostFrame()
virtual void PrimaryAttack( void ) { return; } // do "+ATTACK"
virtual void PrimaryAttack( bool fireOnAttackUp = false ) { return; } // do "+ATTACK"
virtual void QueueAttack( bool fireOnAttackUp = false ) { return; } // queue an attack
virtual void SecondaryAttack( void ) { return; } // do "+ATTACK2"
virtual void Reload( void ) { return; } // do "+RELOAD"
virtual void WeaponIdle( void ) { return; } // called when no buttons pressed
@ -384,7 +385,8 @@ public:
int m_iDefaultAmmo;// how much ammo you get when you pick up this weapon as placed by a level designer.
bool PrevAttack2Status; // HACK: For +movement weapon animations
float m_flLastAnimationPlayed;
float m_flLastAnimationPlayed;
bool m_bAttackQueued;
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -26,9 +26,9 @@ GAME_SHARED_OBJ_DIR=$(HL1_OBJ_DIR)/game_shared
PM_SHARED_OBJ_DIR=$(HL1_OBJ_DIR)/pm_shared
HL1_SERVER_OBJ_DIR=$(HL1_OBJ_DIR)/server
CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS) -DCLIENT_DLL -I/usr/include/malloc -D_snwprintf=swprintf -DAVH_CLIENT -DUSE_OLDAUTH -DAVH_NO_NEXUS -DNDEBUG -DASSERT=assert -Dsprintf_s=snprintf -DDISABLE_VEC_FUNCS -DDISABLE_VEC_ORIGIN
CFLAGS=$(BASE_CFLAGS) $(ARCH_CFLAGS) -DCLIENT_DLL -I/usr/include/malloc -D_snwprintf=swprintf -DAVH_CLIENT -DUSE_OLDAUTH -DAVH_NO_NEXUS -DNDEBUG -DASSERT=assert -Dsprintf_s=snprintf -DDISABLE_VEC_FUNCS -DDISABLE_VEC_ORIGIN -DGLEW_STATIC -DGLEW_NO_GLU
INCLUDEDIRS= -I$(HL_SRC_DIR) -I$(NS_MOD_SRC_DIR) -I$(COMMON_SRC_DIR) -I$(PUBLIC_SRC_DIR) -I$(PM_SHARED_SRC_DIR) -I../engine -I$(GAME_SHARED_SRC_DIR) -I../external/ -I../particles -I../includes/fmodapi375linux/api/inc -I$(HL_SERVER_SRC_DIR) -I$(HL_SRC_DIR)/cl_dll -I$(VGUI_INCLUDE_DIR) -I$(UI_INCLUDE_DIR) -I$(UTIL_SRC_DIR) -I../ -I../includes/fmodapi375linux/api -I../includes/lpng1251
INCLUDEDIRS= -I$(HL_SRC_DIR) -I$(NS_MOD_SRC_DIR) -I$(COMMON_SRC_DIR) -I$(PUBLIC_SRC_DIR) -I$(PM_SHARED_SRC_DIR) -I../engine -I$(GAME_SHARED_SRC_DIR) -I../external/ -I../particles -I../includes/fmodapi375linux/api/inc -I$(HL_SERVER_SRC_DIR) -I$(HL_SRC_DIR)/cl_dll -I$(VGUI_INCLUDE_DIR) -I$(UI_INCLUDE_DIR) -I$(UTIL_SRC_DIR) -I../ -I../includes/fmodapi375linux/api -I../includes/lpng1251 -I../includes/glew
ifeq ($(OS),Darwin)
LDFLAGS=$(SHLIBLDFLAGS) $(CPP_LIB) -framework Carbon -framework OpenGL vgui.dylib -L. -lSDL2-2.0.0 -L. libparticleMP.a
@ -86,6 +86,7 @@ HL1_OBJS = \
$(HL1_OBJ_DIR)/view.o \
$(HL1_OBJ_DIR)/message.o \
$(HL1_OBJ_DIR)/parsemsg.o \
$(HL1_OBJ_DIR)/shader.o \
$(HL1_OBJ_DIR)/saytext.o \
$(HL1_OBJ_DIR)/status_icons.o \
$(HL1_OBJ_DIR)/statusbar.o \
@ -246,11 +247,12 @@ UI_OBJS = \
UTIL_OBJS = \
$(UTIL_OBJ_DIR)/Balance.o \
$(UTIL_OBJ_DIR)/Checksum.o \
$(UTIL_OBJ_DIR)/GammaTable.o \
#$(UTIL_OBJ_DIR)/GammaTable.o \
$(UTIL_OBJ_DIR)/LinuxSupport.o \
$(UTIL_OBJ_DIR)/Mat3.o \
$(UTIL_OBJ_DIR)/MathUtil.o \
$(UTIL_OBJ_DIR)/Quat.o \
$(UTIL_OBJ_DIR)/ShaderUtil.o \
$(UTIL_OBJ_DIR)/Stacktrace.o \
$(UTIL_OBJ_DIR)/STLUtil.o \
$(UTIL_OBJ_DIR)/Tokenizer.o \

View file

@ -203,7 +203,6 @@ GAME_SHARED_OBJS = \
UTIL_OBJS = \
$(UTIL_OBJ_DIR)/Balance.o \
$(UTIL_OBJ_DIR)/Checksum.o \
$(UTIL_OBJ_DIR)/GammaTable.o \
$(UTIL_OBJ_DIR)/LinuxSupport.o \
$(UTIL_OBJ_DIR)/Mat3.o \
$(UTIL_OBJ_DIR)/MathUtil.o \

View file

@ -425,6 +425,8 @@ public:
virtual int iItemSlot(void);
virtual void Precache(void);
virtual void SecondaryAttack();
virtual void Spawn();

View file

@ -180,6 +180,8 @@ AvHBasePlayerWeapon::AvHBasePlayerWeapon()
this->mIsPersistent = false;
this->mLifetime = -1;
#endif
this->mFireOnAttackUp = false;
}
void AvHBasePlayerWeapon::PrintWeaponToClient(CBaseEntity *theAvHPlayer) {
char msg[1024];
@ -675,6 +677,8 @@ void AvHBasePlayerWeapon::Holster( int skiplocal)
#ifdef AVH_SERVER
this->mInOverwatch = false;
#endif
this->m_bAttackQueued = false;
}
float AvHBasePlayerWeapon::GetTimePassedThisTick() const
@ -777,7 +781,7 @@ bool AvHBasePlayerWeapon::ProcessValidAttack(void)
{
if((this->m_flNextPrimaryAttack <= 0) && !this->m_fInSpecialReload)
{
if(!this->GetMustPressTriggerForEachShot() || (!this->mAttackButtonDownLastFrame))
if(!this->GetMustPressTriggerForEachShot() || !this->mAttackButtonDownLastFrame || this->mFireOnAttackUp)
{
//ALERT(at_console, "trueattack1 primammo:%d primatype:%d secammo:%d secatype:%d\n", this->m_pPlayer->m_rgAmmo[this->m_iPrimaryAmmoType], this->m_iPrimaryAmmoType, this->m_pPlayer->m_rgAmmo[this->m_iSecondaryAmmoType], this->m_iSecondaryAmmoType);
theAttackIsValid = true;
@ -1023,11 +1027,11 @@ void AvHBasePlayerWeapon::SetNextAttack(void)
}
void AvHBasePlayerWeapon::PrimaryAttack(void)
void AvHBasePlayerWeapon::PrimaryAttack(bool fireOnAttackUp)
{
if (this->ProcessValidAttack())
{
if (!this->mAttackButtonDownLastFrame)
{
this->PlaybackEvent(this->mStartEvent);

View file

@ -177,7 +177,7 @@ public:
virtual void Precache();
virtual void PrimaryAttack();
virtual void PrimaryAttack(bool fireOnAttackUp = false);
virtual void Reload();
@ -261,6 +261,8 @@ protected:
// sounds
CStringList mFireSounds;
bool mFireOnAttackUp;
};
#endif

View file

@ -39,7 +39,7 @@ extern cvar_t* cl_musicdir;
#define kvLabelMaps "hud_mapstyle"
// :
// : 0001070 - enables forced gamma ramp loading
#define kvGammaRamp "cl_gammaramp"
//#define kvGammaRamp "cl_gammaramp"
#define kvLabelHivesight "cl_labelhivesight"
#define kvCustomCrosshair "cl_customcrosshair"
#define kvHudMapZoom "cl_hudmapzoom"
@ -47,7 +47,7 @@ extern cvar_t* cl_musicdir;
// :
#define kvCMHotKeys "cl_cmhotkeys"
//#define kvForceDefaultFOV "cl_forcedefaultfov"
#define kvWidescreen "cl_widescreen"
//#define kvWidescreen "cl_widescreen"
#define kvAmbientSound "cl_ambientsound"
#define kvCenterEntityID "cl_centerentityid"
#define kvHighDetail "cl_highdetail"

View file

@ -776,6 +776,7 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
if(this->GetCheatsEnabled())
{
sscanf(CMD_ARGV(1), "%f", &this->mMapGamma);
sscanf(CMD_ARGV(1), "%f", &this->mMapGammaAlt);
}
theSuccess = true;
}

View file

@ -1035,9 +1035,16 @@ AvHGamma::AvHGamma()
void AvHGamma::KeyValue(KeyValueData* pkvd)
{
if(FStrEq(pkvd->szKeyName, "desiredgamma"))
if (FStrEq(pkvd->szKeyName, "desiredgamma"))
{
this->mGammaScalar = atof(pkvd->szValue);
// Set alt value as well in case the map doesn't have one.
this->mGammaScalarAlt = atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "desiredgammaalt"))
{
this->mGammaScalarAlt = atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
@ -1050,7 +1057,11 @@ float AvHGamma::GetGamma() const
{
return this->mGammaScalar;
}
// Alternative gamma for NS 3.3 lighting
float AvHGamma::GetGammaAlt() const
{
return this->mGammaScalarAlt;
}
void AvHGamma::Spawn()
{
@ -1738,13 +1749,23 @@ void AvHWebStrand::StrandThink()
if (!FNullEnt(Hit.pHit))
{
edict_t* webbedEdict = Hit.pHit;
AvHPlayer* theWebbedPlayer = dynamic_cast<AvHPlayer*>(CBaseEntity::Instance(webbedEdict));
if (theWebbedPlayer)
while (!FNullEnt(Hit.pHit) && Hit.flFraction < 0.99f)
{
StrandTouch(theWebbedPlayer);
edict_t* webbedEdict = Hit.pHit;
AvHPlayer* theWebbedPlayer = dynamic_cast<AvHPlayer*>(CBaseEntity::Instance(webbedEdict));
if (theWebbedPlayer && theWebbedPlayer->pev->team != this->pev->team && theWebbedPlayer->GetCanBeAffectedByEnemies())
{
StrandTouch(theWebbedPlayer);
break;
}
else
{
UTIL_TraceLine(Hit.vecEndPos, EndTrace, dont_ignore_monsters, Hit.pHit, &Hit);
}
}
}
if (!this->mSolid)

View file

@ -344,10 +344,13 @@ public:
virtual float GetGamma() const;
virtual float GetGammaAlt() const;
virtual void Spawn();
private:
float mGammaScalar;
float mGammaScalarAlt;
};

View file

@ -2295,7 +2295,7 @@ void EV_WelderGeneralEffects(struct event_args_s* inArgs, const Vector& thePos)
cl_entity_t* thePlayer = GetEntity(theIndex);
// Don't play flashing effects if player is photosensitive
if(CVAR_GET_FLOAT(kvDynamicLights))
if(CVAR_GET_FLOAT(kvDynamicLights) >= 2.0f)
{
// Make flashing lights
int theLightIndex = 20; /* TODO: What do to about this index? */

View file

@ -324,6 +324,7 @@ AvHGamerules::AvHGamerules() : mTeamA(TEAM_ONE), mTeamB(TEAM_TWO)
this->mTimeOfLastPlaytestUpdate = -1;
this->mTimeOfLastHandicapUpdate = -1;
this->mMapGamma = kDefaultMapGamma;
this->mMapGammaAlt = kDefaultMapGamma;
this->mCombatAttackingTeamNumber = TEAM_IND;
this->mCheats.clear();
this->mSpawnEntity = NULL;
@ -338,6 +339,8 @@ AvHGamerules::AvHGamerules() : mTeamA(TEAM_ONE), mTeamB(TEAM_TWO)
RegisterServerVariable(avh_cheats);
RegisterServerVariable(&avh_structurelimit);
RegisterServerVariable(&avh_version);
RegisterServerVariable(&avh_widescreenclamp);
//playtest cvars
RegisterServerVariable(&avh_fastjp);
RegisterServerVariable(&avh_randomrfk);
@ -643,9 +646,7 @@ BOOL AvHGamerules::CanHavePlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pWea
int playerAutoSwapWeapon = 1;
bool newWeaponCanFire = true;
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(pPlayer);
if(thePlayer)
playerAutoSwapWeapon = thePlayer->GetAutoWeapSwapValue();
playerAutoSwapWeapon = pPlayer->m_iAutoWeaponSwap;
AvHBasePlayerWeapon* theNewWeapon = dynamic_cast<AvHBasePlayerWeapon*>(pWeapon);
if (theNewWeapon)
@ -695,6 +696,7 @@ void AvHGamerules::CalculateMapGamma()
// Fetch from map extents entity if the map has one
FOR_ALL_ENTITIES(kwsGammaClassName, AvHGamma*)
this->mMapGamma = theEntity->GetGamma();
this->mMapGammaAlt = theEntity->GetGammaAlt();
END_FOR_ALL_ENTITIES(kwsGammaClassName)
this->mCalculatedMapGamma = true;
@ -866,13 +868,15 @@ void AvHGamerules::ClientUserInfoChanged(CBasePlayer *pPlayer, char *infobuffer)
// NOTE: Not currently calling down to parent CHalfLifeTeamplay
const char* theAutoWeapSwapValue = g_engfuncs.pfnInfoKeyValue(infobuffer, "cl_weaponswap");
if (theAutoWeapSwapValue)
{
pPlayer->m_iAutoWeaponSwap = atoi(theAutoWeapSwapValue);
}
if (theAutoWeapSwapValue) {
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(pPlayer);
if (thePlayer) {
thePlayer->SetAutoWeapSwapValue(atoi(theAutoWeapSwapValue));
}
const char* thePistolTriggerValue = g_engfuncs.pfnInfoKeyValue(infobuffer, "cl_pistoltrigger");
if (thePistolTriggerValue)
{
pPlayer->m_iPistolTrigger = atoi(thePistolTriggerValue);
}
}
@ -1385,6 +1389,16 @@ float AvHGamerules::GetMapGamma()
return this->mMapGamma;
}
float AvHGamerules::GetMapGammaAlt()
{
if (!this->mCalculatedMapGamma)
{
this->CalculateMapGamma();
}
return this->mMapGammaAlt;
}
const AvHGameplay& AvHGamerules::GetGameplay() const
{
return this->mGameplay;
@ -3156,7 +3170,7 @@ void AvHGamerules::UpdateHLTVProxy()
}
// Resend the gammaramp
NetMsgSpec_SetGammaRamp( GetGameRules()->GetMapGamma() );
NetMsgSpec_SetGammaRamp( GetGameRules()->GetMapGamma(), GetGameRules()->GetMapGammaAlt());
HiveInfoListType theTeamHiveInfo = this->mTeamB.GetHiveInfoList();
const HiveInfoListType tmp;

View file

@ -194,6 +194,7 @@ public:
void ComputeWorldChecksum(Checksum& outChecksum) const;
float GetMapGamma();
float GetMapGammaAlt();
int GetNumCommandersOnTeam(AvHTeamNumber inTeam);
int GetNumActiveHives(AvHTeamNumber inTeam) const;
int GetNumEntities() const;
@ -399,6 +400,7 @@ private:
bool mCalculatedMapGamma;
float mMapGamma;
float mMapGammaAlt;
typedef map<int, float> EntityUnderAttackListType;
EntityUnderAttackListType mEntitiesUnderAttack;

View file

@ -238,7 +238,7 @@ BOOL AvHGrenade::IsUseable(void)
}
void AvHGrenade::PrimaryAttack(void)
void AvHGrenade::PrimaryAttack(bool fireOnAttackUp)
{
if (this->ProcessValidAttack())

View file

@ -137,6 +137,11 @@ void AvHHealingSpray::Precache()
this->mEvent = PRECACHE_EVENT(1, kHealingSprayEventName);
}
// Use secondary attack to call primary attack so client predicted ghost spit attacks don't occur on the first frame of +movement use, as the weapon also switches that frame.
void AvHHealingSpray::SecondaryAttack(void)
{
AvHHealingSpray::PrimaryAttack();
}
void AvHHealingSpray::Spawn()
{

View file

@ -227,10 +227,9 @@ extern void __CmdFunc_Close(void);
extern int CL_ButtonBits(int);
extern int g_iVisibleMouse;
//@2014 make this work for linux
GammaTable AvHHud::sPregameGammaTable;
GammaTable AvHHud::sGameGammaTable;
//// 2024 - replaced windows gamma table with shader
//GammaTable AvHHud::sPregameGammaTable;
//GammaTable AvHHud::sGameGammaTable;
bool AvHHud::sShowMap = false;
@ -312,7 +311,7 @@ void NumericalInfoEffect::SetPosition(float inPosition[3])
void AvHHud::OnActivateSteamUI()
{
// Set the normal gamma so the Steam UI looks correct.
/*
/*
#ifdef _WIN32
sPregameGammaTable.InitializeToVideoState();
#endif*/
@ -323,7 +322,7 @@ void AvHHud::OnDeactivateSteamUI()
{
// Set the special NS gamma. //@2014 no more gamma
/*
/*
#ifdef _WIN32
SetGamma(mDesiredGammaSlope);
#endif */
@ -695,7 +694,7 @@ AvHHud::~AvHHud(void)
//this->ResetGamma();
//delete [] sOriginalGammaTable;
//delete [] sGammaTable;
AvHHud::ResetGammaAtExit();
//AvHHud::ResetGammaAtExit();
}
void DummyFunction()
@ -1395,6 +1394,12 @@ bool AvHHud::Update(float inCurrentTime, string& outErrorString)
this->mTimeOfCurrentUpdate = inCurrentTime;
if (CVAR_GET_FLOAT("hud_style") != this->mLastHudStyle)
{
this->mReInitHUD = true;
gHUD.VidInit();
}
// Predict game time
if(this->GetGameStarted())
{
@ -1781,7 +1786,18 @@ AvHMessageID AvHHud::HotKeyHit(char inChar)
//@2014 make this work for linux
float AvHHud::GetGammaSlope() const
{
return sGameGammaTable.GetGammaSlope();
//gEngfuncs.Con_DPrintf("Map gamma set to %f\n", this->mShaderGamma);
if (CVAR_GET_FLOAT("cl_intensityalt") <= 0)
{
return this->mShaderGamma;
}
else
{
return this->mShaderGammaAlt;
}
//return sGameGammaTable.GetGammaSlope();
}
string AvHHud::GetMapName(bool inLocalOnly) const
{
@ -1840,59 +1856,68 @@ int AvHHud::GetMaxAlienResources() const
return theMaxAlienResources;
}
bool AvHHud::SetGamma(float inSlope)
bool AvHHud::SetGamma(float inSlope, float inSlopeAlt)
{
bool theSuccess = false;
bool theSuccess = true;
// Disable gamma stuff in debug for sanity
// #ifndef DEBUG
this->mShaderGamma = inSlope;
this->mShaderGammaAlt = inSlopeAlt;
//@2014
/*
#ifdef _WIN32
HDC theDC = GetDC(NULL); // this is a windows func call
if(theDC != 0)
{
const float kGammaIncrement = 0.05f;
float theGammaToTry = inSlope + kGammaIncrement;
while(!theSuccess && (theGammaToTry > 1.0f))
{
theGammaToTry -= kGammaIncrement;
//sGameGammaTable.ProcessSlope(inSlope);
sGameGammaTable.ProcessSlope(theGammaToTry);
// : fakes a successful gamma ramp change if cl_gammaramp is set to 0
if((CVAR_GET_FLOAT(kvGammaRamp) == 0) || sGameGammaTable.InitializeToVideoState())
{
// Tell UI components so they can change shading to look the same
this->GetManager().NotifyGammaChange(theGammaToTry);
// aww yeah
theSuccess = true;
}
}
char theMessage[256];
if(theSuccess)
{
sprintf(theMessage, "Gamma set to %f.", theGammaToTry);
}
else
{
sprintf(theMessage, "Display doesn't support downloadable gamma ramps.");
}
if(!theSuccess || (gEngfuncs.GetMaxClients() == 1))
{
CenterPrint(theMessage);
}
if(!ReleaseDC(NULL, theDC))
{
// emit error about leak
}
}
#endif */
// 2024 - Replaced windows gamma ramp with shader
//
// bool theSuccess = false;
//
// // Disable gamma stuff in debug for sanity
//// #ifndef DEBUG
//
////@2014
//
//#ifdef _WIN32
// HDC theDC = GetDC(NULL); // this is a windows func call
// if(theDC != 0)
// {
// const float kGammaIncrement = 0.05f;
// float theGammaToTry = inSlope + kGammaIncrement;
// while(!theSuccess && (theGammaToTry > 1.0f))
// {
// theGammaToTry -= kGammaIncrement;
//
// sGameGammaTable.ProcessSlope(theGammaToTry);
// // : fakes a successful gamma ramp change if cl_gammaramp is set to 0
// if((CVAR_GET_FLOAT(kvGammaRamp) == 0) || sGameGammaTable.InitializeToVideoState())
// {
// // Tell UI components so they can change shading to look the same
// this->GetManager().NotifyGammaChange(theGammaToTry);
//
// // aww yeah
// theSuccess = true;
// }
// }
//
// char theMessage[256];
// if(theSuccess)
// {
// sprintf(theMessage, "Gamma set to %f.", theGammaToTry);
// }
// else
// {
// sprintf(theMessage, "Display doesn't support downloadable gamma ramps.");
// }
//
// if(!theSuccess || (gEngfuncs.GetMaxClients() == 1))
// {
// CenterPrint(theMessage);
// }
//
// if(!ReleaseDC(NULL, theDC))
// {
// // emit error about leak
// }
// }
//
//#endif
return theSuccess;
}
@ -1938,25 +1963,25 @@ int AvHHud::Redraw( float flTime, int intermission )
return theRC;
}
void AvHHud::ResetGammaAtExit()
{
/*#ifdef _WIN32
sPregameGammaTable.InitializeToVideoState();
#endif*/
}
int AvHHud::ResetGammaAtExitForOnExit()
{
/*#ifdef _WIN32
sPregameGammaTable.InitializeToVideoState();
#endif*/
return TRUE;
}
void AvHHud::ResetGammaAtExit(int inSig)
{
AvHHud::ResetGammaAtExit();
}
//void AvHHud::ResetGammaAtExit()
//{
//#ifdef _WIN32
//sPregameGammaTable.InitializeToVideoState();
//#endif
//}
//
//int AvHHud::ResetGammaAtExitForOnExit()
//{
//#ifdef _WIN32
// sPregameGammaTable.InitializeToVideoState();
//#endif
// return TRUE;
//}
//
//void AvHHud::ResetGammaAtExit(int inSig)
//{
// AvHHud::ResetGammaAtExit();
//}
void AvHHud::ResetTopDownUI()
{
@ -2585,7 +2610,9 @@ void AvHHud::ResetGame(bool inMapChanged)
this->mHiveInfoList.clear();
this->mShaderGamma = kDefaultMapGamma;
this->mDesiredGammaSlope = kDefaultMapGamma;
this->mDesiredGammaSlopeAlt = kDefaultMapGamma;
this->mRecordingLastFrame = false;
this->mTimeOfLastHelpText = -1;
this->mDisplayedToolTipList.clear();
@ -2660,10 +2687,10 @@ void AvHHud::ResetGame(bool inMapChanged)
BIND_MESSAGE(SetGmma);
int AvHHud::MsgFunc_SetGmma(const char* pszName, int iSize, void* pbuf)
{
NetMsg_SetGammaRamp( pbuf, iSize, this->mDesiredGammaSlope );
NetMsg_SetGammaRamp( pbuf, iSize, this->mDesiredGammaSlope, this->mDesiredGammaSlopeAlt);
if (!mSteamUIActive)
{
this->SetGamma(this->mDesiredGammaSlope);
this->SetGamma(this->mDesiredGammaSlope, this->mDesiredGammaSlopeAlt);
}
return 1;
@ -2892,8 +2919,15 @@ int AvHHud::MsgFunc_SetTopDown(const char* pszName, int iSize, void* pbuf)
if (CVAR_GET_FLOAT("m_rawinput") != 0)
{
SDL_SetRelativeMouseMode(SDL_FALSE);
//gEngfuncs.pfnSetMousePos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
gEngfuncs.pfnSetMousePos(ScreenWidth() / 2, ScreenHeight() / 2);
if (gHUD.m_bWindowed)
{
gEngfuncs.pfnSetMousePos(ScreenWidth() / 2, ScreenHeight() / 2);
}
else
{
gEngfuncs.pfnSetMousePos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
}
#ifdef WIN32
//Hide windows OS cursor while raw input is momentarily off.
@ -3778,6 +3812,7 @@ void AvHHud::Init(void)
signal(SIGBREAK, AvHHud::ResetGammaAtExit);
signal(SIGABRT, AvHHud::ResetGammaAtExit);
#endif */
this->mShaderGamma = 1.0f;
//memset(this->mAlienUILifeforms, 0, sizeof(HSPRITE)*kNumAlienLifeforms);
this->mAlienUIUpgrades = 0;
this->mAlienUIUpgradeCategories = 0;
@ -3821,6 +3856,7 @@ void AvHHud::Init(void)
this->mSelectingWeaponID = -1;
this->mSelectingNodeID = MESSAGE_NULL;
this->mDesiredGammaSlope = 1;
this->mDesiredGammaSlopeAlt = 1;
this->mTimeOfLastHelpText = -1;
this->mCurrentWeaponID = -1;
this->mCurrentWeaponEnabled = false;
@ -3840,6 +3876,9 @@ void AvHHud::Init(void)
this->mDrawCombatUpgradeMenu = false;
this->mDrawOrderOverlay = true;
this->mReInitHUD = false;
this->mLastHudStyle = 0;
// Initialize viewport
this->mViewport[0] = this->mViewport[1] = this->mViewport[2] = this->mViewport[3] = 0;
}
@ -4167,10 +4206,11 @@ int AvHHud::InitializeDemoPlayback(int inSize, unsigned char* inBuffer)
// Read in gamma
LoadData(&this->mDesiredGammaSlope, inBuffer, sizeof(this->mDesiredGammaSlope), theBytesRead);
LoadData(&this->mDesiredGammaSlopeAlt, inBuffer, sizeof(this->mDesiredGammaSlopeAlt), theBytesRead);
if (!mSteamUIActive)
{
this->SetGamma(this->mDesiredGammaSlope);
this->SetGamma(this->mDesiredGammaSlope, this->mDesiredGammaSlopeAlt);
}
// Read in resources
@ -4311,6 +4351,7 @@ void AvHHud::InitializeDemoRecording()
// Gamma, resources
int theGammaSize = sizeof(this->mDesiredGammaSlope);
int theGammaAltSize = sizeof(this->mDesiredGammaSlopeAlt);
int theResourcesSizes = sizeof(this->mResources);
// Save commander index (TODO: REMOVE)
@ -4328,7 +4369,7 @@ void AvHHud::InitializeDemoRecording()
int theSelectedSize = sizeof(int) + (int)this->mSelected.size()*sizeof(EntityInfo);
int theTotalSize = theUpgradesSize + theGammaSize + theResourcesSizes + theCommanderSize + theHiveInfoSize + theCurrentPieMenuControlSize + theSelectedSize;
int theTotalSize = theUpgradesSize + theGammaSize + theGammaAltSize + theResourcesSizes + theCommanderSize + theHiveInfoSize + theCurrentPieMenuControlSize + theSelectedSize;
// New a char array of this size
int theCounter = 0;
@ -4342,6 +4383,7 @@ void AvHHud::InitializeDemoRecording()
// Write out gamma
SaveData(theCharArray, &this->mDesiredGammaSlope, theGammaSize, theCounter);
SaveData(theCharArray, &this->mDesiredGammaSlopeAlt, theGammaAltSize, theCounter);
SaveData(theCharArray, &this->mResources, theResourcesSizes, theCounter);
SaveData(theCharArray, &theCommanderIndex, theCommanderSize, theCounter);
@ -4876,6 +4918,7 @@ cvar_t *lightgamma = NULL;
cvar_t *texgamma = NULL;
cvar_t *r_detailtextures = NULL;
cvar_t *gl_max_size = NULL;
cvar_t *gl_widescreen_yfov = NULL;
void AvHHud::InitExploitPrevention() {
gl_monolights = gEngfuncs.pfnGetCvarPointer("gl_monolights");
@ -4890,6 +4933,7 @@ void AvHHud::InitExploitPrevention() {
texgamma = gEngfuncs.pfnGetCvarPointer("texgamma");
r_detailtextures = gEngfuncs.pfnGetCvarPointer("r_detailtextures");
gl_max_size = gEngfuncs.pfnGetCvarPointer("gl_max_size");
gl_widescreen_yfov = gEngfuncs.pfnGetCvarPointer("gl_widescreen_yfov");
ForceCvar("gl_monolights", gl_monolights, 0.0f);
ForceCvar("gl_overbright", gl_overbright, 0.0f);
@ -4901,13 +4945,14 @@ void AvHHud::InitExploitPrevention() {
ForceCvar("r_detailtextures", r_detailtextures, 0.0f);
ForceCvar("gl_max_size", gl_max_size, 512.0f);
RemoveAlias("lightgamma");
if(lightgamma && lightgamma->value < 2.0) {
ForceCvar("lightgamma", lightgamma, 2.0f);
}
if(lightgamma && lightgamma->value > 5.0) {
ForceCvar("lightgamma", lightgamma, 5.0f);
//2024 - Lighting changes: lower min lightgamma to engine limit. Engine crashes below 1.81, so enforce the limit.
//RemoveAlias("lightgamma");
if(lightgamma && lightgamma->value < 1.81f) {
ForceCvar("lightgamma", lightgamma, 1.81f);
}
//if(lightgamma && lightgamma->value > 5.0) {
// ForceCvar("lightgamma", lightgamma, 5.0f);
//}
RemoveAlias("texgamma");
if(texgamma && texgamma->value < 1.0) {
ForceCvar("texgamma", texgamma, 1.0f);
@ -4915,6 +4960,11 @@ void AvHHud::InitExploitPrevention() {
if(texgamma && texgamma->value > 5.0) {
ForceCvar("texgamma", texgamma, 5.0f);
}
RemoveAlias("gl_widescreen_yfov");
if (gl_widescreen_yfov)
{
mWideScreen = gl_widescreen_yfov->value;
}
}
@ -4933,18 +4983,60 @@ void AvHHud::UpdateExploitPrevention()
ForceCvar("r_detailtextures", r_detailtextures, 0.0f);
ForceCvar("gl_max_size", gl_max_size, 512.0f);
if(lightgamma && lightgamma->value < 2.0) {
ForceCvar("lightgamma", lightgamma, 2.0f);
}
if(lightgamma && lightgamma->value > 5.0) {
ForceCvar("lightgamma", lightgamma, 5.0f);
if(lightgamma && lightgamma->value < 1.81f) {
ForceCvar("lightgamma", lightgamma, 1.81f);
}
//if(lightgamma && lightgamma->value > 5.0) {
// ForceCvar("lightgamma", lightgamma, 5.0f);
//}
if(texgamma && texgamma->value < 1.0) {
ForceCvar("texgamma", texgamma, 1.0f);
}
if(texgamma && texgamma->value > 5.0) {
ForceCvar("texgamma", texgamma, 5.0f);
}
//Widescreen exploit prevention
if (gViewPort)
{
if (gHUD.GetIsAlive(false))
{
if (gl_widescreen_yfov && gl_widescreen_yfov->value == 0 && mWideScreen) {
ForceCvar("gl_widescreen_yfov", gl_widescreen_yfov, 1.0f);
mWideScreenChanged = true;
gEngfuncs.pfnCenterPrint("The Widescreen FOV\n will change after death\n");
}
if (gl_widescreen_yfov && gl_widescreen_yfov->value != 0 && !mWideScreen) {
ForceCvar("gl_widescreen_yfov", gl_widescreen_yfov, 0);
mWideScreenChanged = true;
gEngfuncs.pfnCenterPrint("The Widescreen FOV\n will change after death\n");
}
}
else if (mWideScreenChanged)
{
mWideScreen = !mWideScreen;
ForceCvar("gl_widescreen_yfov", gl_widescreen_yfov, (float)mWideScreen);
mWideScreenChanged = false;
}
else
{
mWideScreen = gl_widescreen_yfov->value;
}
//sv_widescreenclamp is to prevent abuse of ultra-widescreen FOVs in competitive play.
if ((ScreenWidth() / ScreenHeight()) > 1.8f)
{
if (this->GetServerVariableFloat(kvWidescreenClamp) != 0 && gl_widescreen_yfov && gl_widescreen_yfov->value != 0)
{
ForceCvar("gl_widescreen_yfov", gl_widescreen_yfov, 0);
gEngfuncs.pfnCenterPrint("This aspect ratio is not allowed\n on this server\n");
}
}
}
//else if (gl_widescreen_yfov)
//{
// mWideScreen = gl_widescreen_yfov->value;
// gEngfuncs.Con_Printf("init mwidescreen from update %d\n", mWideScreen);
//}
}
void AvHHud::UpdateAlienUI(float inCurrentTime)
@ -7351,6 +7443,15 @@ void AvHHud::SetDrawOrderOverlay(bool drawOverlay)
mDrawOrderOverlay = drawOverlay;
}
bool AvHHud::GetReInitHUD() const
{
return this->mReInitHUD;
}
void AvHHud::SetReInitHUD(bool setInit)
{
mReInitHUD = setInit;
}
/**
* Prints the call stack when an unhandled exception occurs.
@ -7380,7 +7481,7 @@ LONG WINAPI ExceptionFilter(EXCEPTION_POINTERS* pExp)
}
*/
AvHHud::ResetGammaAtExit();
//AvHHud::ResetGammaAtExit();
return EXCEPTION_EXECUTE_HANDLER;
@ -7400,7 +7501,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
}
else if (fdwReason == DLL_PROCESS_DETACH)
{
AvHHud::ResetGammaAtExit();
//AvHHud::ResetGammaAtExit();
}
return TRUE;
}

View file

@ -128,7 +128,7 @@
#include "AvHVisibleBlipList.h"
#include "AvHMapExtents.h"
#include "AvHSpecials.h"
#include "GammaTable.h"
//#include "GammaTable.h"
#include "AvHBaseInfoLocation.h"
#include "AvHTooltip.h"
#include "AvHTechSlotManager.h"
@ -430,9 +430,9 @@ public:
// This function should be used instead of the global SetCrosshair.
void SetCurrentCrosshair(AVHHSPRITE hspr, wrect_t rc, int r, int g, int b);
static void ResetGammaAtExit();
static int ResetGammaAtExitForOnExit();
static void ResetGammaAtExit(int inSig);
//static void ResetGammaAtExit();
//static int ResetGammaAtExitForOnExit();
//static void ResetGammaAtExit(int inSig);
void SetViewport(const int inViewport[4]);
void GetViewport(int outViewport[4]) const;
@ -451,6 +451,9 @@ public:
bool GetDrawOrderOverlay() const;
void SetDrawOrderOverlay(bool drawOverlay);
bool GetReInitHUD() const;
void SetReInitHUD(bool setInit);
private:
// :
@ -501,7 +504,7 @@ private:
bool GetEntityInfoString(int inEntityID, string& outEntityInfoString, bool& outIsEnemy);
void ModifyAmbientSoundEntryIfChanged(bool inSoundOn, int inSoundIndex, int inEntIndex, float inTimeStarted, int inVolume, int inFadeDistance, int inFlags, Vector inOrigin);
void ResetTopDownUI();
bool SetGamma(float inSlope);
bool SetGamma(float inSlope, float inSlopeAlt);
void SetReinforcements(int inReinforcements);
void SetHelpMessage(const string& inHelpText, bool inForce = false, float inNormX = -1, float inNormY = -1);
void SetActionButtonHelpMessage(const string& inHelpText);
@ -676,12 +679,13 @@ private:
int mFramesSinceEnteredTopdownMode;
int mNumLocalSelectEvents;
AvHMapMode mMapMode;
//@2014 make this work for linux
static GammaTable sPregameGammaTable;
static GammaTable sGameGammaTable;
//// 2024 - Replaced gamma ramp with shader.
//static GammaTable sPregameGammaTable;
//static GammaTable sGameGammaTable;
float mDesiredGammaSlope;
float mDesiredGammaSlopeAlt;
typedef vector<AvHAmbientSound> AmbientSoundListType;
AmbientSoundListType mAmbientSounds;
@ -876,6 +880,23 @@ private:
static bool sShowMap;
bool mWideScreen;
bool mWideScreenChanged;
bool mReInitHUD;
float mLastHudStyle;
float mShaderGamma;
float mShaderGammaAlt;
};
class CPostProcessShader
{
public:
void Init();
void ClearFrameBuffer();
void DrawShader();
};
#endif

View file

@ -511,8 +511,8 @@ void DrawScaledHUDSprite(AVHHSPRITE inSpriteHandle, int inMode, int inRowsInSpri
}
// Compensate for gamma
float theGammaSlope = gHUD.GetGammaSlope();
float theColorComponent = 1.0f/theGammaSlope;
//float theGammaSlope = gHUD.GetGammaSlope();
float theColorComponent = 1.0f/* / theGammaSlope*/;
gEngfuncs.pTriAPI->Color4f(theColorComponent, theColorComponent, theColorComponent, 1.0f);
Vector thePoint;
@ -627,9 +627,9 @@ void DrawSpriteOnGroundAtPoint(vec3_t inOrigin, int inRadius, AVHHSPRITE inSprit
// Draw one quad
vec3_t thePoint = inOrigin;
float theGammaSlope = gHUD.GetGammaSlope();
ASSERT(theGammaSlope > 0.0f);
float theColorComponent = 1.0f/theGammaSlope;
//float theGammaSlope = gHUD.GetGammaSlope();
//ASSERT(theGammaSlope > 0.0f);
float theColorComponent = 1.0f/* / theGammaSlope*/;
gEngfuncs.pTriAPI->Color4f(theColorComponent, theColorComponent, theColorComponent, inAlpha);
gEngfuncs.pTriAPI->Brightness(1.6f);
@ -1707,8 +1707,8 @@ void AvHHud::DrawMouseCursor(int inBaseX, int inBaseY)
if (theCursorSprite > 0)
{
float theGammaSlope = this->GetGammaSlope();
ASSERT(theGammaSlope > 0.0f);
//float theGammaSlope = this->GetGammaSlope();
//ASSERT(theGammaSlope > 0.0f);
/*
int theColorComponent = 255/theGammaSlope;
@ -2025,15 +2025,15 @@ void AvHHud::GetPrimaryHudColor(int& outR, int& outG, int& outB, bool inIgnoreUp
UnpackRGB(outR, outG, outB, RGB_YELLOWISH);
//}
}
if (gammaCorrect)
{
// Take into account current gamma?
float theGammaSlope = this->GetGammaSlope();
outR /= theGammaSlope;
outG /= theGammaSlope;
outB /= theGammaSlope;
}
// 2024 - Remove old gamma ramp correction.
//if (gammaCorrect)
//{
// // Take into account current gamma?
// float theGammaSlope = this->GetGammaSlope();
// outR /= theGammaSlope;
// outG /= theGammaSlope;
// outB /= theGammaSlope;
//}
}
@ -2533,7 +2533,7 @@ void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha)
{
const int kDrawEnemyBuildingDistance = 200;
bool healthLowEnough = theHealthPercentage < (CVAR_GET_FLOAT("hud_teamhealthalert") * 0.01f);
bool isSpectating = this->GetPlayMode() == PLAYMODE_AWAITINGREINFORCEMENT || this->GetPlayMode() == PLAYMODE_OBSERVER;
bool isSpectating = (this->GetPlayMode() == PLAYMODE_AWAITINGREINFORCEMENT || this->GetPlayMode() == PLAYMODE_REINFORCING || this->GetPlayMode() == PLAYMODE_OBSERVER);
bool theEntityIsSpecTarget = inEntityIndex == theLocalPlayer->curstate.iuser2;
// Draw effects if we are in top-down mode OR
@ -2638,10 +2638,10 @@ void AvHHud::DrawHUDNumber(int inX, int inY, int inFlags, int inNumber)
int theR, theG, theB;
this->GetPrimaryHudColor(theR, theG, theB, false, false);
int theGammaSlope = this->GetGammaSlope();
theR /= theGammaSlope;
theG /= theGammaSlope;
theB /= theGammaSlope;
//int theGammaSlope = this->GetGammaSlope();
//theR /= theGammaSlope;
//theG /= theGammaSlope;
//theB /= theGammaSlope;
this->DrawHudNumber(inX, inY, inFlags, inNumber, theR, theG, theB);
}
@ -2740,7 +2740,7 @@ void AvHHud::Render()
int theWidth;
int theHeight;
float gammaScale = 1.0f / GetGammaSlope();
float gammaScale = 1.0f/* / GetGammaSlope()*/;
gEngfuncs.pfnDrawSetTextColor(0, gammaScale, 0);
gEngfuncs.pfnDrawConsoleStringLen(theMessage, &theWidth, &theHeight);
@ -4211,7 +4211,17 @@ void AvHHud::RenderAlienUI()
float xdiff = fabs(theScreenPos[0] - screenWidth/2);
float ydiff = fabs(theScreenPos[1] - screenHeight/2);
float quadrance = xdiff * xdiff + ydiff * ydiff;
float alpha = max(0.0f, 0.9f - quadrance / (screenHeight * screenHeight));
float alpha;
if (theBlipStatus == kVulnerableFriendlyBlipStatus)
{
alpha = max(0.0f, 0.9f - (quadrance) / (screenHeight * screenHeight));
}
// 2024 - Reduce HUD visibility for unimportant blips.
else
{
alpha = max(0.0f, 0.75f - (quadrance * 8.0f) / (screenHeight * screenHeight));
}
alpha *= alpha * alpha * alpha;
// "MonsieurEvil is under attack"
@ -4455,7 +4465,15 @@ void AvHHud::VidInit(void)
{
UIHud::VidInit();
mOverviewMap.VidInit();
// Don't reinitialize the minimap when swapping hud styles.
if (!this->mReInitHUD)
{
mOverviewMap.VidInit();
}
float hudStyle = CVAR_GET_FLOAT("hud_style");
this->mLastHudStyle = hudStyle;
this->mReInitHUD = false;
int theScreenWidth = ScreenWidth();
string theSpriteName;
@ -4466,7 +4484,7 @@ void AvHHud::VidInit(void)
// theSpriteName = UINameToSprite(kHiveSprite, theScreenWidth);
// this->mAlienUIHiveSprite = SPR_Load(theSpriteName.c_str());
int i = 0;
// int i = 0;
// for(i = 0; i < kNumAlienLifeforms; i++)
// {
// char theBaseName[128];
@ -4475,7 +4493,7 @@ void AvHHud::VidInit(void)
// this->mAlienUILifeforms[i] = SPR_Load(theSpriteName.c_str());
// }
if (CVAR_GET_FLOAT("hud_style") == 2.0f)
if (hudStyle == 2.0f)
{
this->mAlienUIUpgrades = SPR_Load(kAlienUpgradeSpriteNL);
this->mAlienUIEnergySprite = SPR_Load(kAlienEnergySpriteNL);
@ -4494,7 +4512,7 @@ void AvHHud::VidInit(void)
this->mMarineOrderIndicator = SPR_Load(kMarineOrderSpriteNL);
this->mMarineUpgradesSprite = SPR_Load(kMarineUpgradesSpriteNL);
}
else if (CVAR_GET_FLOAT("hud_style") == 1.0f)
else if (hudStyle == 1.0f)
{
char theBaseName[128];
sprintf(theBaseName, "%s", kAlienUpgradeSprite);

View file

@ -228,10 +228,14 @@ public:
virtual int GetReloadAnimation() const;
virtual int GetShootAnimation() const;
virtual int iItemSlot(void);
virtual int iItemSlot(void);
virtual void Precache(void);
virtual void PrimaryAttack(bool fireOnAttackUp = false);
virtual void QueueAttack(bool fireOnAttackUp);
virtual void Spawn();
@ -620,7 +624,7 @@ public:
virtual void WeaponIdle();
virtual void PrimaryAttack(void);
virtual void PrimaryAttack(bool fireOnAttackUp = false);
protected:

View file

@ -77,7 +77,7 @@ void Net_InitializeMessages(void)
g_msgHUDSetUpgrades = REG_USER_MSG( "SetUpgrades", 1);
g_msgProgressBar = REG_USER_MSG( "Progress", -1 );
g_msgServerVar = REG_USER_MSG( "ServerVar", -1 );
g_msgSetGammaRamp = REG_USER_MSG( "SetGmma", 1 );
g_msgSetGammaRamp = REG_USER_MSG( "SetGmma", 2 );
g_msgSetOrder = REG_USER_MSG( "SetOrder", -1 );
g_msgSetParticleTemplates = REG_USER_MSG( "Particles", -1 );
g_msgDelParts = REG_USER_MSG( "DelParts", 0);
@ -1617,24 +1617,27 @@ union float_converter
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ifndef AVH_SERVER
void NetMsg_SetGammaRamp( void* const buffer, const int size, float& gamma )
void NetMsg_SetGammaRamp( void* const buffer, const int size, float& gamma, float& gammaAlt)
{
BEGIN_READ( buffer, size );
gamma = READ_BYTE() / 128.0f;
gammaAlt = READ_BYTE() / 128.0f;
END_READ();
}
#else
void NetMsg_SetGammaRamp( entvars_t* const pev, const float gamma )
void NetMsg_SetGammaRamp( entvars_t* const pev, const float gamma, const float gammaAlt)
{
MESSAGE_BEGIN( MSG_ONE, g_msgSetGammaRamp, NULL, pev );
WRITE_BYTE( floor( min( max(gamma, 0.0f), 1.992f) * 128.0f) );
WRITE_BYTE( floor (min( max(gammaAlt, 0.0f), 1.992f) * 128.0f) );
MESSAGE_END();
}
void NetMsgSpec_SetGammaRamp( const float gamma )
void NetMsgSpec_SetGammaRamp( const float gamma, const float gammaAlt)
{
MESSAGE_BEGIN( MSG_SPEC, g_msgSetGammaRamp );
WRITE_BYTE( floor( min( max(gamma, 0.0f), 1.992f) * 128.0f) );
WRITE_BYTE( floor( min( max(gammaAlt, 0.0f), 1.992f) * 128.0f) );
MESSAGE_END();
}
#endif

View file

@ -96,7 +96,7 @@
void NetMsg_PlayHUDNotification_Research(entvars_t* const pev, const int flags, const ResearchInfoListType& researching);
void NetMsg_ProgressBar( entvars_t* const pev, const int entity_number, const int progress, int percent=0 );
void NetMsg_ServerVar( entvars_t* const pev, const string& name, const int& value );
void NetMsg_SetGammaRamp( entvars_t* const pev, const float gamma );
void NetMsg_SetGammaRamp( entvars_t* const pev, const float gamma, const float gammaAlt);
void NetMsg_SetOrder( entvars_t* const pev, const AvHOrder& order );
void NetMsg_DelParts( entvars_t* const pev);
void NetMsg_SetParticleTemplate( entvars_t* const pev, const int index, const AvHParticleTemplate& particle_template );
@ -128,7 +128,7 @@
//SPECTATOR MESSAGE TRANSMISSION
void NetMsgSpec_TeamInfo( const int player_index, const string& team_id );
void NetMsgSpec_TextMsg( const int destination, const vector<string>& message );
void NetMsgSpec_SetGammaRamp( const float gamma );
void NetMsgSpec_SetGammaRamp( const float gamma, const float gammaAlt);
#else //!AVH_SERVER
@ -189,7 +189,7 @@
void NetMsg_ProgressBar( void* const buffer, const int size, int& entity_number, int& progress, int &percent);
//45
void NetMsg_ServerVar( void* const buffer, const int size, string& name, int& value );
void NetMsg_SetGammaRamp( void* const buffer, const int size, float& gamma );
void NetMsg_SetGammaRamp( void* const buffer, const int size, float& gamma, float& gammaAlt);
void NetMsg_SetOrder( void* const buffer, const int size, AvHOrder& order );
void NetMsg_SetParticleTemplate( void* const buffer, const int size, int &index, AvHParticleTemplate& particle_template );
void NetMsg_DelParts( void* const buffer, const int size);

View file

@ -73,7 +73,7 @@ void AvHOverviewControl::paint()
gEngfuncs.pTriAPI->SpriteTexture((struct model_s*)(gEngfuncs.GetSpritePointer(m_hsprWhite)), 0);
float gammaScale = 1.0f / gHUD.GetGammaSlope();
float gammaScale = 1.0f/* / gHUD.GetGammaSlope()*/;
// Draw the background.

View file

@ -90,8 +90,14 @@ void AvHParticleEditorHandler::ToggleEdit()
gHUD.ToggleMouse();
// Set mouse position to center so it doesn't jar our view
//gEngfuncs.pfnSetMousePos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
gEngfuncs.pfnSetMousePos(ScreenWidth() / 2, ScreenHeight() / 2);
if (gHUD.m_bWindowed)
{
gEngfuncs.pfnSetMousePos(ScreenWidth() / 2, ScreenHeight() / 2);
}
else
{
gEngfuncs.pfnSetMousePos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
}
sInEditMode = false;
}

View file

@ -79,7 +79,7 @@ PieMenu* AvHPieMenuHandler::GetActivePieMenu()
void AvHPieMenuHandler::ClosePieMenu(void)
{
//if (!sPieMenuOpen)
//{
// return;
@ -138,7 +138,7 @@ void AvHPieMenuHandler::InternalClosePieMenu(void)
if(!gHUD.GetInTopDownMode())
{
gHUD.GetManager().SetMouseVisibility(false);
// OS cursor displaying over in game cursor fix. Remove if showcursor code in SetMouseVisibility is made bug free.
#ifdef WIN32
if(sPieMenuOpen)
@ -153,11 +153,12 @@ void AvHPieMenuHandler::InternalClosePieMenu(void)
}
sLastNodeHighlighted = NULL;
// Return to raw input after menu closes
if (CVAR_GET_FLOAT("m_rawinput") != 0 && sPieMenuOpen)
{
SDL_SetRelativeMouseMode(SDL_TRUE);
}
//// Not needed post-HL25.
//// Return to raw input after menu closes
//if (CVAR_GET_FLOAT("m_rawinput") != 0 && sPieMenuOpen)
//{
// SDL_SetRelativeMouseMode(SDL_TRUE);
//}
// if(sTheDebugBool)
// {
@ -199,12 +200,20 @@ void AvHPieMenuHandler::OpenPieMenu(void)
gHUD.HideCrosshair();
// Workaround for not being able to center mouse with raw input enabled.
// Center mouse for raw input.
if (CVAR_GET_FLOAT("m_rawinput") != 0 && !sPieMenuOpen)
{
SDL_SetRelativeMouseMode(SDL_FALSE);
//gEngfuncs.pfnSetMousePos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
gEngfuncs.pfnSetMousePos(ScreenWidth() / 2, ScreenHeight() / 2);
//// Not needed post-HL25.
//SDL_SetRelativeMouseMode(SDL_FALSE);
if (gHUD.m_bWindowed)
{
gEngfuncs.pfnSetMousePos(ScreenWidth() / 2, ScreenHeight() / 2);
}
else
{
gEngfuncs.pfnSetMousePos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
}
}
// Only do this when in full screen
@ -292,13 +301,15 @@ void AvHPieMenuHandler::cursorMoved(int x,int y,Panel* panel)
// char theMessage[128];
// sprintf(theMessage, "AvHPieMenuHandler::cursorMoved %d, %d (panel ptr: %d).\n", x, y, (int)panel);
// CenterPrint(theMessage);
if (sPieMenuOpen && CVAR_GET_FLOAT("m_rawinput") != 0)
{
if (SDL_GetRelativeMouseMode() != SDL_TRUE)
{
SDL_SetRelativeMouseMode(SDL_TRUE);
}
}
//// Not needed post-HL25.
//if (sPieMenuOpen && CVAR_GET_FLOAT("m_rawinput") != 0)
//{
// if (SDL_GetRelativeMouseMode() != SDL_TRUE)
// {
// SDL_SetRelativeMouseMode(SDL_TRUE);
// }
//}
}
void AvHPieMenuHandler::cursorEntered(Panel* panel)

View file

@ -174,6 +174,26 @@ void AvHPistol::Precache()
this->mEvent = PRECACHE_EVENT(1, kHGEventName);
}
void AvHPistol::PrimaryAttack(bool fireOnAttackUp)
{
this->m_bAttackQueued = false;
this->mFireOnAttackUp = fireOnAttackUp;
if (fireOnAttackUp)
{
this->m_iPlayEmptySound = true;
}
AvHMarineWeapon::PrimaryAttack();
this->mFireOnAttackUp = false;
}
void AvHPistol::QueueAttack(bool fireOnAttackUp)
{
if (!this->mAttackButtonDownLastFrame || fireOnAttackUp)
{
this->m_bAttackQueued = true;
this->mAttackButtonDownLastFrame = false;
}
}
void AvHPistol::Spawn()
{

View file

@ -3887,13 +3887,21 @@ void AvHPlayer::ValidateClientMoveEvents()
case ORDER_ACK:
// If cheats
if(GetGameRules()->GetCheatsEnabled()
// OR It's less than the min saying interval, with less than 2 recent sayings, and they're not trying to say the same thing twice
// OR It's been longer than the min saying interval, with less than 2 recent sayings, and they're not trying to say the same thing twice
|| (gpGlobals->time > (this->mTimeOfLastSaying + kMinSayingInterval) && this->mRecentSayingCounter < 2
&& !(gpGlobals->time < (this->mTimeOfLastSaying + kRepeatSayingInterval) && theMessageID == this->GetLastSaying())))
{
theIsValid = true;
this->mRecentSayingCounter += 1;
}
// Check if repeat saying counter isn't getting decremented for some reason, like plugins intercepting the impulse.
else if (gpGlobals->time > (this->mTimeOfLastSaying + kSpeakingTime + 0.05f))
{
ALERT(at_console, "Saying counter fallback triggered: %d\n", this->mRecentSayingCounter);
theIsValid = true;
this->mRecentSayingCounter = 1;
}
else
{
//2023 - Why???
@ -9502,7 +9510,7 @@ void AvHPlayer::UpdateAlienUI()
currentMask |= 0x80;
int teamMask=0;
AvHEntityHierarchy& theEntHier=GetGameRules()->GetEntityHierarchy(this->GetTeam());
AvHEntityHierarchy& theEntHier=GetGameRules()->GetEntityHierarchy(this->GetTeam(true));
teamMask |= ( theEntHier.GetNumSensory() & 0x3 );
teamMask <<= 2;
teamMask |= ( theEntHier.GetNumDefense() & 0x3 );
@ -9719,12 +9727,14 @@ void AvHPlayer::UpdateFog()
void AvHPlayer::UpdateGamma()
{
float theMapGamma = GetGameRules()->GetMapGamma();
float theMapGammaAlt = GetGameRules()->GetMapGammaAlt();
if(this->mClientGamma != theMapGamma)
{
if(!GetGameRules()->GetIsTesting())
{
NetMsg_SetGammaRamp( this->pev, theMapGamma );
NetMsg_SetGammaRamp( this->pev, theMapGamma, theMapGammaAlt);
this->mClientGamma = theMapGamma;
this->mClientGammaAlt = theMapGammaAlt;
}
}
}

View file

@ -477,9 +477,6 @@ public:
void SetUsedKilled(bool bKilled ) { mUsedKilled = bKilled; }
void ClearOrders() { mClientOrders.clear(); }
int GetAutoWeapSwapValue() { return mAutoWeapSwapValue; }
void SetAutoWeapSwapValue(int autoSwap) { mAutoWeapSwapValue = autoSwap; }
// : 0000953
bool JoinTeamCooledDown(float inCoolDownTime);
//
@ -699,6 +696,7 @@ private:
AvHMessageID mClientResearchingTech;
float mClientGamma;
float mClientGammaAlt;
StringList mSentMessageList;
@ -865,7 +863,6 @@ private:
bool mUsedKilled;
int mAutoWeapSwapValue;
//TODO: remove this system from AvHPlayer and create an
// explicit balance forwarding class registered to each

View file

@ -96,6 +96,7 @@ extern cvar_t *violence_agibs;
extern cvar_t avh_killdelay;
extern cvar_t *showtriggers;
extern cvar_t avh_version;
extern cvar_t avh_widescreenclamp;
//playtest cvars
extern cvar_t avh_fastjp;
extern cvar_t avh_randomrfk;
@ -149,6 +150,8 @@ float ns_cvar_float(const cvar_t *cvar);
#define kvBlockScripts "mp_blockscripts"
#define kvJumpMode "sv_jumpmode"
#define kvVersion "sv_nsversion"
#define kvWidescreenClamp "sv_widescreenclamp"
//playtest cvars
#define kvfastjp "sv_fastjp"
#define kvRandomRfk "mp_randomresfromkill"

View file

@ -2991,7 +2991,8 @@ bool AvHSUClientTraceTangible(const vec3_t& inStartPos, const vec3_t& inEndPos,
if(pEntity)
{
if(pEntity->iuser3 != AVH_USER3_NONE)
// 2024 - Also skip nobuilds on client since clients can now see them.
if(pEntity->iuser3 != AVH_USER3_NONE && pEntity->iuser3 != AVH_USER3_NOBUILD)
{
VectorCopy(tr.endpos, outLocation);
outIndex = theFoundEntity;

View file

@ -404,7 +404,7 @@ void AvHSpriteDraw(AVHHSPRITE spriteHandle, int frame, float x1, float y1, float
// Compensate for the overbrightening effect.
float gammaScale = 1.0f / gHUD.GetGammaSlope();
float gammaScale = 1.0f/* / gHUD.GetGammaSlope()*/;
gEngfuncs.pTriAPI->Color4f(gammaScale * gColor[0], gammaScale * gColor[1], gammaScale * gColor[2], gColor[3]);
// Output the vertices.

View file

@ -2331,7 +2331,7 @@ void AvHTeam::UpdateOrders()
const float kExpireTime = 1.0f;
if(!theOrderIter->GetOrderActive() && (theOrderIter->GetTimeOrderCompleted() != -1) && (gpGlobals->time > (theOrderIter->GetTimeOrderCompleted() + kExpireTime)))
{
this->mOrderList.erase(theOrderIter);
theOrderIter = this->mOrderList.erase(theOrderIter);
}
else
{

View file

@ -66,6 +66,7 @@
#include "AvHConstants.h"
#ifdef AVH_SERVER
#include "AvHGamerules.h"
#include "AvHServerUtil.h"
@ -86,8 +87,20 @@ bool AvHWebProjectile::CreateWeb()
AvHWebSpinner* theWebSpinner = NULL;
if(this->GetWebSpinner(theWebSpinner))
{
vec3_t NormalizedVelocity;
VectorCopy(this->pev->velocity, NormalizedVelocity);
NormalizedVelocity.Normalize();
TraceResult surfaceTraceResult;
UTIL_TraceLine(this->pev->origin, this->pev->origin + (NormalizedVelocity * 10.0f), dont_ignore_monsters, this->edict(), &surfaceTraceResult);
vec3_t theNewPoint = this->pev->origin;
if (surfaceTraceResult.flFraction < 1.0f)
{
theNewPoint = theNewPoint + (surfaceTraceResult.vecPlaneNormal * 3.0f);
}
vec3_t theLastPoint;
if(theWebSpinner->GetLastPoint(theLastPoint))
{

View file

@ -2653,7 +2653,8 @@ int PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce)
float change;
float angle;
int i, blocked;
#define DIST_EPSILON 0.125f
angle = normal[ 2 ];
blocked = 0x00; // Assume unblocked.
@ -2661,7 +2662,7 @@ int PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce)
blocked |= 0x01; //
if (!angle) // If the plane has no Z, it is vertical (wall/step)
blocked |= 0x02; //
// Determine how far along plane to slide based on incoming direction.
// Scale by overbounce factor.
backoff = DotProduct (in, normal) * overbounce;
@ -2670,11 +2671,21 @@ int PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce)
{
change = normal[i]*backoff;
out[i] = in[i] - change;
// If out velocity is too small, zero it out.
if (out[i] > -STOP_EPSILON && out[i] < STOP_EPSILON)
out[i] = 0;
//// If out velocity is too small, zero it out.
//if (out[i] > -STOP_EPSILON && out[i] < STOP_EPSILON)
// out[i] = 0;
}
// iterate once to make sure we aren't still moving through the plane
float adjust = DotProduct(out, normal);
if (adjust <= 0.0f)
{
// min this against a small number (but no further from zero than -DIST_EPSILON) to account for crossing a plane with a near-parallel normal
adjust = min(adjust, -DIST_EPSILON);
for (i = 0; i < 3; i++)
out[i] -= normal[i] * adjust;
}
// Return blocking flags.
return blocked;
}

View file

@ -243,31 +243,34 @@ void ChatPanel::KeyEvent(int iKeydown)
}
if (state[SDL_SCANCODE_RETURN])
{
std::string theCommand;
if (iKeydown && !bTextinput)
{
std::string theCommand;
theCommand += mChatMode;
theCommand += mChatMode;
theCommand += " \"";
theCommand += " \"";
// Replace all ';' characters with ':' characters since we can't have
// ';' characters on a console message.
// Replace all ';' characters with ':' characters since we can't have
// ';' characters on a console message.
for (unsigned int i = 0; i < mText.length(); ++i)
{
if (mText[i] == ';')
{
mText[i] = ':';
}
}
for (unsigned int i = 0; i < mText.length(); ++i)
{
if (mText[i] == ';')
{
mText[i] = ':';
}
}
theCommand += mText;
theCommand += mText;
theCommand += "\"";
theCommand += "\"";
//say_x "the message here" instead of
//say_x the message here (ever word was treated as another argument)
gEngfuncs.pfnClientCmd((char*)theCommand.c_str());
//say_x "the message here" instead of
//say_x the message here (ever word was treated as another argument)
gEngfuncs.pfnClientCmd((char*)theCommand.c_str());
CancelChat();
CancelChat();
}
}
}

View file

@ -93,10 +93,10 @@ void FadingImageLabel::DoPaint()
int r, g, b, a;
this->getBgColor(r, g, b, a);
float theGammaSlope = gHUD.GetGammaSlope();
r = r/theGammaSlope;
g = g/theGammaSlope;
b = b/theGammaSlope;
//float theGammaSlope = gHUD.GetGammaSlope();
//r = r/theGammaSlope;
//g = g/theGammaSlope;
//b = b/theGammaSlope;
// Don't take gamma slope into account for alpha
a = 255 - a;

View file

@ -25,17 +25,17 @@ MarqueeComponent::MarqueeComponent()
{
this->mX0 = this->mY0 = 0;
this->mX1 = this->mY1 = 0;
this->mGammaSlope = 1.0f;
//this->mGammaSlope = 1.0f;
// Default color scheme
this->setFgColor(0, 255, 0, 0);
this->setBgColor(0, 255, 0, 230);
}
void MarqueeComponent::NotifyGammaChange(float inGammaSlope)
{
this->mGammaSlope = inGammaSlope;
}
//void MarqueeComponent::NotifyGammaChange(float inGammaSlope)
//{
// this->mGammaSlope = inGammaSlope;
//}
void MarqueeComponent::paint()
{
@ -49,8 +49,8 @@ void MarqueeComponent::paint()
int theWidth, theHeight;
this->getSize(theWidth, theHeight);
//vguiSimpleBox(0, 0, theWidth, theHeight, r/this->mGammaSlope, g/this->mGammaSlope, b/this->mGammaSlope, a/this->mGammaSlope);
vguiSimpleBox(0, 0, theWidth, theHeight, r/this->mGammaSlope, g/this->mGammaSlope, b/this->mGammaSlope, a);
//vguiSimpleBox(0, 0, theWidth, theHeight, r/this->mGammaSlope, g/this->mGammaSlope, b/this->mGammaSlope, a);
vguiSimpleBox(0, 0, theWidth, theHeight, r, g, b, a);
// Top
// vguiSimpleLine(0, 0, theWidth, 0, r, g, b, a);
@ -76,8 +76,8 @@ void MarqueeComponent::paintBackground()
int theWidth, theHeight;
this->getSize(theWidth, theHeight);
//FillRGBA(0, 0, theWidth, theHeight, r/this->mGammaSlope, g/this->mGammaSlope, b/this->mGammaSlope, a/this->mGammaSlope);
FillRGBA(0, 0, theWidth, theHeight, r/this->mGammaSlope, g/this->mGammaSlope, b/this->mGammaSlope, a);
//FillRGBA(0, 0, theWidth, theHeight, r/this->mGammaSlope, g/this->mGammaSlope, b/this->mGammaSlope, a);
FillRGBA(0, 0, theWidth, theHeight, r, g, b, a);
}
void MarqueeComponent::ResetDimensions()

View file

@ -20,13 +20,13 @@
#define MARQUEECOMPONENT_H
#include "VGUI_Panel.h"
#include "GammaAwareComponent.h"
//#include "GammaAwareComponent.h"
class MarqueeComponent : public vgui::Panel, public GammaAwareComponent
class MarqueeComponent : public vgui::Panel//, public GammaAwareComponent
{
public:
MarqueeComponent();
virtual void NotifyGammaChange(float inGammaSlope);
//virtual void NotifyGammaChange(float inGammaSlope);
void SetStartPos(int inX, int inY);
void SetEndPos(int inX, int inY);
@ -39,7 +39,7 @@ private:
int mX0, mY0;
int mX1, mY1;
float mGammaSlope;
//float mGammaSlope;
};
#endif

Some files were not shown because too many files have changed in this diff Show more