diff --git a/main/delta.lst b/main/delta.lst index 1003a6aa..11ebb95c 100644 --- a/main/delta.lst +++ b/main/delta.lst @@ -16,10 +16,10 @@ clientdata_t none DEFINE_DELTA( origin[2], DT_SIGNED | DT_FLOAT, 21, 128.0 ), DEFINE_DELTA( velocity[2], DT_SIGNED | DT_FLOAT, 16, 8.0 ), - DEFINE_DELTA( ammo_nails, DT_SIGNED | DT_INTEGER, 10, 1.0 ), - DEFINE_DELTA( ammo_shells, DT_SIGNED | DT_INTEGER, 10, 1.0 ), - DEFINE_DELTA( ammo_cells, DT_SIGNED | DT_INTEGER, 10, 1.0 ), - DEFINE_DELTA( ammo_rockets, DT_SIGNED | DT_INTEGER, 10, 1.0 ), + DEFINE_DELTA( ammo_nails, DT_SIGNED | DT_INTEGER, 10, 1.0 ), // m_iPrimaryAmmoType + DEFINE_DELTA( ammo_shells, DT_SIGNED | DT_INTEGER, 10, 1.0 ), // m_iSecondaryAmmoType - not used in any weapon. I think this is for alt fire ammo (ex mp5 grenade). + DEFINE_DELTA( ammo_cells, DT_SIGNED | DT_INTEGER, 10, 1.0 ), // m_rgAmmo[ pCurrent->m_iPrimaryAmmoType ] + DEFINE_DELTA( ammo_rockets, DT_SIGNED | DT_INTEGER, 10, 1.0 ), // m_rgAmmo[ pCurrent->m_iSecondaryAmmoType ] - not used in any weapon DEFINE_DELTA( m_iId, DT_INTEGER, 8, 1.0 ), @@ -237,7 +237,7 @@ weapon_data_t none DEFINE_DELTA( m_flNextSecondaryAttack, DT_FLOAT | DT_SIGNED, 22, 1000.0 ), DEFINE_DELTA( m_iClip, DT_SIGNED | DT_INTEGER, 10, 1.0 ), // DEFINE_DELTA( m_flPumpTime, DT_FLOAT | DT_SIGNED, 22, 1000.0 ), -// DEFINE_DELTA( m_fInSpecialReload, DT_INTEGER, 2, 1.0 ), + DEFINE_DELTA( m_fInSpecialReload, DT_INTEGER, 3, 1.0 ), DEFINE_DELTA( m_fReloadTime, DT_FLOAT, 16, 100.0 ), DEFINE_DELTA( m_fInReload, DT_INTEGER, 1, 1.0 ), // DEFINE_DELTA( m_fAimedDamage, DT_FLOAT, 6, 0.1 ), diff --git a/main/server.cfg b/main/server.cfg index 974f2c00..6b998d43 100644 --- a/main/server.cfg +++ b/main/server.cfg @@ -39,7 +39,9 @@ sv_proxies 1 // maximum client movement speed (needed for commander mode) sv_maxspeed 4000 sv_allowdownload 1 -mp_consistency 0 + +// Enforce file consistency 0 = none, 1 = game version, 2 = additional files for competitive play (previously 1) +mp_consistency 1 // Commander voting mp_votedowntime 180 diff --git a/main/source/cl_dll/chud.h b/main/source/cl_dll/chud.h index a3e5cde5..430e0f80 100644 --- a/main/source/cl_dll/chud.h +++ b/main/source/cl_dll/chud.h @@ -51,7 +51,7 @@ private: wrect_t *m_rgrcRects; /*[HUD_SPRITE_COUNT]*/ char *m_rgszSpriteNames; /*[HUD_SPRITE_COUNT][MAX_SPRITE_NAME_LENGTH]*/ - struct cvar_s *default_fov; + //struct cvar_s *default_fov; public: diff --git a/main/source/cl_dll/hl/hl_weapons.cpp b/main/source/cl_dll/hl/hl_weapons.cpp index f6283e59..97270b8b 100644 --- a/main/source/cl_dll/hl/hl_weapons.cpp +++ b/main/source/cl_dll/hl/hl_weapons.cpp @@ -477,23 +477,24 @@ void CBasePlayerWeapon::ItemPostFrame( void ) if (this->m_flLastAnimationPlayed >= 3.0f * BALANCE_VAR(kLeapROF) + gpGlobals->time) this->m_flLastAnimationPlayed = 0.0f; - if ((m_fInReload) && (m_pPlayer->m_flNextAttack <= 0.0)) - { -/////////////////////////////////////////////////////////////////////////////////////////////////////// -// Put code in here to predict reloads (ie, have the ammo on screen update before we get a response) // -/////////////////////////////////////////////////////////////////////////////////////////////////////// -//#if 0 // FIXME, need ammo on client to make this work right -// // complete the reload. -// int j = min( iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]); -// -// // Add them to the clip -// m_iClip += j; -// m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j; -//#else -// m_iClip += 10; -//#endif - m_fInReload = FALSE; - } +// if ((m_fInReload) && (m_pPlayer->m_flNextAttack <= 0.0)) +// { +///////////////////////////////////////////////////////////////////////////////////////////////////////// +//// Put code in here to predict reloads (ie, have the ammo on screen update before we get a response) // +///////////////////////////////////////////////////////////////////////////////////////////////////////// +////#if 0 // FIXME, need ammo on client to make this work right +//// // complete the reload. +//// int j = min( iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]); +//// +//// // Add them to the clip +//// m_iClip += j; +//// m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j; +//// ALERT(at_console, "hlweappredictreload\n"); +////#else +//// m_iClip += 10; +////#endif +// m_fInReload = FALSE; +// } // Properly propagate the end animation if (this->PrevAttack2Status == true && !(m_pPlayer->pev->button & IN_ATTACK2)) @@ -518,9 +519,14 @@ void CBasePlayerWeapon::ItemPostFrame( void ) } } - if ( (m_pPlayer->pev->button & IN_ATTACK) && !(m_pPlayer->pev->button & IN_ATTACK2) && (m_flNextPrimaryAttack <= 0.0) ) + if ( (m_pPlayer->pev->button & IN_ATTACK) && !(m_pPlayer->pev->button & IN_ATTACK2)) { - if (GetCanUseWeapon()) + if ((m_fInSpecialReload == 1 || m_fInSpecialReload == 2) && m_iClip != 0 && (CVAR_GET_FLOAT("sv_nsversion") > 322.0f)) + { + m_fInSpecialReload = 3; + Reload(); + } + else if (GetCanUseWeapon() && (m_flNextPrimaryAttack <= 0.0)) { if ( (m_iClip == 0 && pszAmmo1()) || (iMaxClip() == -1 && !m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] ) ) @@ -661,15 +667,16 @@ void CBasePlayerWeapon::ItemPostFrame( void ) // no fire buttons down m_fFireOnEmpty = FALSE; - + // weapon is useable. Reload if empty and weapon has waited as long as it has to after firing if ( m_iClip == 0 && !(iFlags() & ITEM_FLAG_NOAUTORELOAD) && m_flNextPrimaryAttack < 0.0 ) { // << CGC >> Only reload if we have more ammo to reload with - if(m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0) + // Client doesn't know autoreload flag and knife ammo is infinite with networked ammo. Check if knife to prevent reload. + if(m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0 && !(gHUD.GetCurrentWeaponID() == AVH_WEAPON_KNIFE)) { - Reload(); - return; + Reload(); + return; } } @@ -1233,9 +1240,15 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm pCurrent->pev->iuser3 = pfrom->iuser3; // pCurrent->m_iSecondaryAmmoType = (int)from->client.vuser3[2]; - pCurrent->m_iPrimaryAmmoType = (int)from->client.vuser4[0]; +// pCurrent->m_iPrimaryAmmoType = (int)from->client.vuser4[0]; // player.m_rgAmmo[ pCurrent->m_iPrimaryAmmoType ] = (int)from->client.vuser4[1]; // player.m_rgAmmo[ pCurrent->m_iSecondaryAmmoType ] = (int)from->client.vuser4[2]; + + // Ammo networking 2021 + pCurrent->m_iPrimaryAmmoType = from->client.ammo_nails; + pCurrent->m_iSecondaryAmmoType = from->client.ammo_shells; + player.m_rgAmmo[ pCurrent->m_iPrimaryAmmoType ] = from->client.ammo_cells; + player.m_rgAmmo[pCurrent->m_iSecondaryAmmoType] = from->client.ammo_rockets; } // For random weapon events, use this seed to seed random # generator @@ -1287,11 +1300,11 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm player.m_pActiveItem = g_pWpns[ from->client.m_iId ]; } - if ( player.m_pActiveItem->m_iId == WEAPON_RPG ) - { - ( ( CRpg * )player.m_pActiveItem)->m_fSpotActive = (int)from->client.vuser2[ 1 ]; - ( ( CRpg * )player.m_pActiveItem)->m_cActiveRockets = (int)from->client.vuser2[ 2 ]; - } + //if ( player.m_pActiveItem->m_iId == WEAPON_RPG ) + //{ + // ( ( CRpg * )player.m_pActiveItem)->m_fSpotActive = (int)from->client.vuser2[ 1 ]; + // ( ( CRpg * )player.m_pActiveItem)->m_cActiveRockets = (int)from->client.vuser2[ 2 ]; + //} // Don't go firing anything if we have died. // Or if we don't have a weapon model deployed @@ -1363,11 +1376,11 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm // to->client.vuser2[0] = player.ammo_hornets; // to->client.ammo_rockets = player.ammo_rockets; - if ( player.m_pActiveItem->m_iId == WEAPON_RPG ) - { - from->client.vuser2[ 1 ] = ( ( CRpg * )player.m_pActiveItem)->m_fSpotActive; - from->client.vuser2[ 2 ] = ( ( CRpg * )player.m_pActiveItem)->m_cActiveRockets; - } + //if ( player.m_pActiveItem->m_iId == WEAPON_RPG ) + //{ + // from->client.vuser2[ 1 ] = ( ( CRpg * )player.m_pActiveItem)->m_fSpotActive; + // from->client.vuser2[ 2 ] = ( ( CRpg * )player.m_pActiveItem)->m_cActiveRockets; + //} // Make sure that weapon animation matches what the game .dll is telling us // over the wire ( fixes some animation glitches ) @@ -1419,12 +1432,18 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm pto->m_flTimeWeaponIdle -= cmd->msec / 1000.0; pto->fuser1 -= cmd->msec / 1000.0; - to->client.vuser3[2] = pCurrent->m_iSecondaryAmmoType; + //to->client.vuser3[2] = pCurrent->m_iSecondaryAmmoType; to->client.vuser4 = pCurrent->pev->vuser4; // to->client.vuser4[0] = pCurrent->m_iPrimaryAmmoType; // to->client.vuser4[1] = player.m_rgAmmo[ pCurrent->m_iPrimaryAmmoType ]; // to->client.vuser4[2] = player.m_rgAmmo[ pCurrent->m_iSecondaryAmmoType ]; + // Ammo networking 2021 + to->client.ammo_nails = pCurrent->m_iPrimaryAmmoType; + to->client.ammo_shells = pCurrent->m_iSecondaryAmmoType; + to->client.ammo_cells = player.m_rgAmmo[ pCurrent->m_iPrimaryAmmoType ]; + to->client.ammo_rockets = player.m_rgAmmo[ pCurrent->m_iSecondaryAmmoType ]; + /* if ( pto->m_flPumpTime != -9999 ) { pto->m_flPumpTime -= cmd->msec / 1000.0; diff --git a/main/source/cl_dll/hud.cpp b/main/source/cl_dll/hud.cpp index 191894fc..befe55df 100644 --- a/main/source/cl_dll/hud.cpp +++ b/main/source/cl_dll/hud.cpp @@ -204,7 +204,7 @@ void CHud :: Init( void ) // : CVAR_CREATE( "zoom_sensitivity_ratio", "1", 0 ); - default_fov = CVAR_CREATE( "default_fov", "90", 0 ); + //default_fov = CVAR_CREATE( "default_fov", "90", 0 ); m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE ); m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE ); cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" ); @@ -528,7 +528,7 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf) { int newfov; NetMsg_SetFOV( pbuf, iSize, newfov ); - int def_fov = CVAR_GET_FLOAT( "default_fov" ); + //int def_fov = CVAR_GET_FLOAT( "default_fov" ); //Weapon prediction already takes care of changing the fog. ( g_lastFOV ). if ( cl_lw && cl_lw->value ) @@ -538,7 +538,8 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf) if ( newfov == 0 ) { - m_iFOV = def_fov; + //m_iFOV = def_fov; + m_iFOV = 90; } else { @@ -548,7 +549,8 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf) // the clients fov is actually set in the client data update section of the hud // Set a new sensitivity - if ( m_iFOV == def_fov || CVAR_GET_FLOAT("senslock") == 1.0f) + //if ( m_iFOV == def_fov || CVAR_GET_FLOAT("senslock") == 1.0f) + if (m_iFOV == 90 || CVAR_GET_FLOAT("senslock") == 1.0f) { // reset to saved sensitivity m_flMouseSensitivity = 0; @@ -556,7 +558,8 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf) else { // set a new sensitivity that is proportional to the change from the FOV default - m_flMouseSensitivity = sensitivity->value * ((float)newfov / (float)def_fov) * CVAR_GET_FLOAT("zoom_sensitivity_ratio"); + //m_flMouseSensitivity = sensitivity->value * ((float)newfov / (float)def_fov) * CVAR_GET_FLOAT("zoom_sensitivity_ratio"); + m_flMouseSensitivity = sensitivity->value * ((float)newfov / 90.0f) * CVAR_GET_FLOAT("zoom_sensitivity_ratio"); } return 1; diff --git a/main/source/cl_dll/hud_redraw.cpp b/main/source/cl_dll/hud_redraw.cpp index 6adfce21..93803944 100644 --- a/main/source/cl_dll/hud_redraw.cpp +++ b/main/source/cl_dll/hud_redraw.cpp @@ -37,12 +37,12 @@ extern int g_iVisibleMouse; float HUD_GetFOV( void ); extern cvar_t *sensitivity; -extern cvar_t *cl_forcedefaultfov; +//extern cvar_t *cl_forcedefaultfov; // Think void CHud::Think(void) { - int newfov; + float newfov; HUDLIST *pList = m_pHudList; while (pList) @@ -55,22 +55,24 @@ void CHud::Think(void) newfov = HUD_GetFOV(); if ( newfov == 0 ) { - m_iFOV = default_fov->value; +// m_iFOV = default_fov->value; + m_iFOV = 90; } else { m_iFOV = newfov; } - if(cl_forcedefaultfov->value) - { - m_iFOV = 90; - } + //if(cl_forcedefaultfov->value) + //{ + // m_iFOV = 90; + //} // the clients fov is actually set in the client data update section of the hud // Set a new sensitivity - if ( m_iFOV == default_fov->value || CVAR_GET_FLOAT("senslock") == 1.0f) + //if ( m_iFOV == default_fov->value || CVAR_GET_FLOAT("senslock") == 1.0f) + if (m_iFOV == 90 || CVAR_GET_FLOAT("senslock") == 1.0f) { // reset to saved sensitivity m_flMouseSensitivity = 0; @@ -78,13 +80,15 @@ void CHud::Think(void) else { // set a new sensitivity that is proportional to the change from the FOV default - m_flMouseSensitivity = sensitivity->value * ((float)newfov / (float)default_fov->value) * CVAR_GET_FLOAT("zoom_sensitivity_ratio"); + //m_flMouseSensitivity = sensitivity->value * ((float)newfov / (float)default_fov->value) * CVAR_GET_FLOAT("zoom_sensitivity_ratio"); + m_flMouseSensitivity = sensitivity->value * (newfov / 90.0f ) * CVAR_GET_FLOAT("zoom_sensitivity_ratio"); } // think about default fov if ( m_iFOV == 0 ) { // only let players adjust up in fov, and only if they are not overriden by something else - m_iFOV = max( default_fov->value, 90 ); + //m_iFOV = max( default_fov->value, 90 ); + m_iFOV = 90; } } diff --git a/main/source/cl_dll/hud_spectator.cpp b/main/source/cl_dll/hud_spectator.cpp index 44c3549e..3b527b7d 100644 --- a/main/source/cl_dll/hud_spectator.cpp +++ b/main/source/cl_dll/hud_spectator.cpp @@ -1948,6 +1948,7 @@ void CHudSpectator::InitHUDData() g_iUser2 = 0; // fake not target until first camera command // reset HUD FOV - gHUD.m_iFOV = CVAR_GET_FLOAT("default_fov"); + //gHUD.m_iFOV = CVAR_GET_FLOAT("default_fov"); + gHUD.m_iFOV = 90; } diff --git a/main/source/cl_dll/input.cpp b/main/source/cl_dll/input.cpp index f0a3ae2c..0ec8ed54 100644 --- a/main/source/cl_dll/input.cpp +++ b/main/source/cl_dll/input.cpp @@ -116,9 +116,9 @@ cvar_t *lookspring; cvar_t *cl_pitchup; cvar_t *cl_pitchdown; cvar_t *cl_upspeed; -cvar_t *cl_forwardspeed; -cvar_t *cl_backspeed; -cvar_t *cl_sidespeed; +//cvar_t *cl_forwardspeed; +//cvar_t *cl_backspeed; +//cvar_t *cl_sidespeed; cvar_t *cl_movespeedkey; cvar_t *cl_yawspeed; cvar_t *cl_pitchspeed; @@ -133,7 +133,7 @@ cvar_t *cl_musicdir; cvar_t *cl_quickselecttime; cvar_t *cl_highdetail; cvar_t *cl_cmhotkeys; -cvar_t *cl_forcedefaultfov; +//cvar_t *cl_forcedefaultfov; cvar_t *cl_dynamiclights; cvar_t *r_dynamic; cvar_t *cl_buildmessages; @@ -143,6 +143,7 @@ cvar_t *cl_ambientsound; cvar_t *senslock; cvar_t *hud_style; cvar_t *cl_chatbeep; +cvar_t *cl_mutemenu; /* =============================================================================== @@ -191,6 +192,10 @@ kbutton_t in_alt1; kbutton_t in_score; kbutton_t in_break; kbutton_t in_graph; // Display the netgraph +kbutton_t in_scrollup; +kbutton_t in_scrolldown; +kbutton_t in_scrollleft; +kbutton_t in_scrollright; typedef struct kblist_s { @@ -616,6 +621,18 @@ int CL_DLLEXPORT HUD_Key_Event( int down, int keynum, const char *pszCurrentBind theProcessKeyBinding = 0; } + ////Commander arrow key scroll hardcoding so keys can be used out of comm chair without config change. Add as cvar option? + // if (keynum == K_UPARROW){KeyDown(&in_scrollup); theProcessKeyBinding = 0;} + // if (keynum == K_DOWNARROW){KeyDown(&in_scrolldown); theProcessKeyBinding = 0;} + // if (keynum == K_LEFTARROW){KeyDown(&in_scrollleft); theProcessKeyBinding = 0;} + // if (keynum == K_RIGHTARROW){KeyDown(&in_scrollright);theProcessKeyBinding = 0;} + //} + //else if((keynum != 0) && !(down)) + //{ + // if (keynum == K_UPARROW){KeyUp(&in_scrollup);theProcessKeyBinding = 0;} + // if (keynum == K_DOWNARROW){KeyUp(&in_scrolldown);theProcessKeyBinding = 0;} + // if (keynum == K_LEFTARROW){KeyUp(&in_scrollleft);theProcessKeyBinding = 0;} + // if (keynum == K_RIGHTARROW){KeyUp(&in_scrollright); theProcessKeyBinding = 0;} } } @@ -671,6 +688,14 @@ void IN_LeftDown(void) {KeyDown(&in_left);} void IN_LeftUp(void) {KeyUp(&in_left);} void IN_RightDown(void) {KeyDown(&in_right);} void IN_RightUp(void) {KeyUp(&in_right);} +void IN_ScrollUpDown(void) { KeyDown(&in_scrollup);} +void IN_ScrollUpUp(void) { KeyUp(&in_scrollup); } +void IN_ScrollDownDown(void) { KeyDown(&in_scrolldown); } +void IN_ScrollDownUp(void) { KeyUp(&in_scrolldown); } +void IN_ScrollLeftDown(void) { KeyDown(&in_scrollleft); } +void IN_ScrollLeftUp(void) { KeyUp(&in_scrollleft); } +void IN_ScrollRightDown(void) { KeyDown(&in_scrollright); } +void IN_ScrollRightUp(void) { KeyUp(&in_scrollright); } void IN_ForwardDown(void) { @@ -1070,11 +1095,16 @@ void CL_DLLEXPORT CL_CreateMove ( float frametime, struct usercmd_s *cmd, int ac // Scroll the view if the HUD tells us to, otherwise use normal key presses int theScrollX = 0, theScrollY = 0, theScrollZ = 0; gHUD.GetAndClearTopDownScrollAmount(theScrollX, theScrollY, theScrollZ); + //Arrow key scrolling. Binds not needed. Hardcoded in HUD_Key_Event. + theScrollY += CL_KeyState(&in_scrollup); + theScrollY -= CL_KeyState(&in_scrolldown); + theScrollX -= CL_KeyState(&in_scrollleft); + theScrollX += CL_KeyState(&in_scrollright); if(theScrollX || theScrollY || theScrollZ) { // Commander move speed - float kCommanderMoveSpeed = 1000; + float kCommanderMoveSpeed = 1000; cmd->upmove += kCommanderMoveSpeed * theScrollY; cmd->sidemove += kCommanderMoveSpeed * theScrollX; cmd->forwardmove += kCommanderMoveSpeed * theScrollZ; @@ -1181,20 +1211,26 @@ void CL_DLLEXPORT CL_CreateMove ( float frametime, struct usercmd_s *cmd, int ac { if ( in_strafe.state & 1 ) { - cmd->sidemove += cl_sidespeed->value * CL_KeyState (&in_right); - cmd->sidemove -= cl_sidespeed->value * CL_KeyState (&in_left); + //cmd->sidemove += cl_sidespeed->value * CL_KeyState (&in_right); + //cmd->sidemove -= cl_sidespeed->value * CL_KeyState (&in_left); + cmd->sidemove += kSideSpeed * CL_KeyState (&in_right); + cmd->sidemove -= kSideSpeed * CL_KeyState (&in_left); } - cmd->sidemove += cl_sidespeed->value * CL_KeyState (&in_moveright); - cmd->sidemove -= cl_sidespeed->value * CL_KeyState (&in_moveleft); + //cmd->sidemove += cl_sidespeed->value * CL_KeyState (&in_moveright); + //cmd->sidemove -= cl_sidespeed->value * CL_KeyState (&in_moveleft); + cmd->sidemove += kSideSpeed * CL_KeyState (&in_moveright); + cmd->sidemove -= kSideSpeed * CL_KeyState (&in_moveleft); cmd->upmove += cl_upspeed->value * CL_KeyState (&in_up); cmd->upmove -= cl_upspeed->value * CL_KeyState (&in_down); if ( !(in_klook.state & 1 ) ) { - cmd->forwardmove += cl_forwardspeed->value * CL_KeyState (&in_forward); - cmd->forwardmove -= cl_backspeed->value * CL_KeyState (&in_back); + //cmd->forwardmove += cl_forwardspeed->value * CL_KeyState (&in_forward); + cmd->forwardmove += kForwardSpeed * CL_KeyState(&in_forward); + //cmd->forwardmove -= cl_backspeed->value * CL_KeyState (&in_back); + cmd->forwardmove -= kBackSpeed * CL_KeyState(&in_back); } } @@ -1515,6 +1551,14 @@ void InitInput (void) gEngfuncs.pfnAddCommand ("-graph", IN_GraphUp); gEngfuncs.pfnAddCommand ("+break",IN_BreakDown); gEngfuncs.pfnAddCommand ("-break",IN_BreakUp); + gEngfuncs.pfnAddCommand("+scrollup", IN_ScrollUpDown); + gEngfuncs.pfnAddCommand("-scrollup", IN_ScrollUpUp); + gEngfuncs.pfnAddCommand("+scrolldown", IN_ScrollDownDown); + gEngfuncs.pfnAddCommand("-scrolldown", IN_ScrollDownUp); + gEngfuncs.pfnAddCommand("+scrollleft", IN_ScrollLeftDown); + gEngfuncs.pfnAddCommand("-scrollleft", IN_ScrollLeftUp); + gEngfuncs.pfnAddCommand("+scrollright", IN_ScrollRightDown); + gEngfuncs.pfnAddCommand("-scrollright", IN_ScrollRightUp); lookstrafe = gEngfuncs.pfnRegisterVariable ( "lookstrafe", "0", FCVAR_ARCHIVE ); lookspring = gEngfuncs.pfnRegisterVariable ( "lookspring", "0", FCVAR_ARCHIVE ); @@ -1522,9 +1566,9 @@ void InitInput (void) cl_yawspeed = gEngfuncs.pfnRegisterVariable ( "cl_yawspeed", "210", 0 ); cl_pitchspeed = gEngfuncs.pfnRegisterVariable ( "cl_pitchspeed", "225", 0 ); cl_upspeed = gEngfuncs.pfnRegisterVariable ( "cl_upspeed", "320", 0 ); - cl_forwardspeed = gEngfuncs.pfnRegisterVariable ( "cl_forwardspeed", "400", FCVAR_ARCHIVE ); - cl_backspeed = gEngfuncs.pfnRegisterVariable ( "cl_backspeed", "400", FCVAR_ARCHIVE ); - cl_sidespeed = gEngfuncs.pfnRegisterVariable ( "cl_sidespeed", "400", 0 ); + //cl_forwardspeed = gEngfuncs.pfnRegisterVariable ( "cl_forwardspeed", "400", FCVAR_ARCHIVE ); + //cl_backspeed = gEngfuncs.pfnRegisterVariable ( "cl_backspeed", "400", FCVAR_ARCHIVE ); + //cl_sidespeed = gEngfuncs.pfnRegisterVariable ( "cl_sidespeed", "400", 0 ); cl_movespeedkey = gEngfuncs.pfnRegisterVariable ( "cl_movespeedkey", "0.3", 0 ); cl_pitchup = gEngfuncs.pfnRegisterVariable ( "cl_pitchup", "89", 0 ); cl_pitchdown = gEngfuncs.pfnRegisterVariable ( "cl_pitchdown", "89", 0 ); @@ -1542,19 +1586,19 @@ void InitInput (void) cl_musicvolume = gEngfuncs.pfnRegisterVariable ( kvMusicVolume, "155", FCVAR_ARCHIVE ); cl_musicdir = gEngfuncs.pfnRegisterVariable ( kvMusicDirectory, "", FCVAR_ARCHIVE); cl_musicdelay = gEngfuncs.pfnRegisterVariable ( kvMusicDelay, "90", FCVAR_ARCHIVE); - cl_forcedefaultfov = gEngfuncs.pfnRegisterVariable ( kvForceDefaultFOV, "0", FCVAR_ARCHIVE ); cl_dynamiclights = gEngfuncs.pfnRegisterVariable ( kvDynamicLights, "1", FCVAR_ARCHIVE ); cl_buildmessages = gEngfuncs.pfnRegisterVariable ( kvBuildMessages, "1", FCVAR_ARCHIVE); cl_quickselecttime = gEngfuncs.pfnRegisterVariable ( kvQuickSelectTime, ".15", FCVAR_ARCHIVE ); cl_highdetail = gEngfuncs.pfnRegisterVariable ( kvHighDetail, "1", FCVAR_ARCHIVE ); cl_cmhotkeys = gEngfuncs.pfnRegisterVariable ( kvCMHotkeys, "qwerasdfzxcv", FCVAR_ARCHIVE ); - cl_forcedefaultfov = gEngfuncs.pfnRegisterVariable ( kvForceDefaultFOV, "0", 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); 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); // Initialize third person camera controls. CAM_Init(); diff --git a/main/source/cl_dll/inputw32.cpp b/main/source/cl_dll/inputw32.cpp index ebbfaa5e..fc941c74 100644 --- a/main/source/cl_dll/inputw32.cpp +++ b/main/source/cl_dll/inputw32.cpp @@ -55,8 +55,8 @@ extern cvar_t *lookspring; extern cvar_t *cl_pitchdown; extern cvar_t *cl_pitchup; extern cvar_t *cl_yawspeed; -extern cvar_t *cl_sidespeed; -extern cvar_t *cl_forwardspeed; +//extern cvar_t *cl_sidespeed; +//extern cvar_t *cl_forwardspeed; extern cvar_t *cl_pitchspeed; extern cvar_t *cl_movespeedkey; @@ -1130,7 +1130,8 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd ) // user wants forward control to be forward control if (fabs(fAxisValue) > joy_forwardthreshold->value) { - cmd->forwardmove += (fAxisValue * joy_forwardsensitivity->value) * speed * cl_forwardspeed->value; + //cmd->forwardmove += (fAxisValue * joy_forwardsensitivity->value) * speed * cl_forwardspeed->value; + cmd->forwardmove += (fAxisValue * joy_forwardsensitivity->value) * speed * kForwardSpeed; } } break; @@ -1138,7 +1139,8 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd ) case AxisSide: if (fabs(fAxisValue) > joy_sidethreshold->value) { - cmd->sidemove += (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value; + //cmd->sidemove += (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value; + cmd->sidemove += (fAxisValue * joy_sidesensitivity->value) * speed * kSideSpeed; } break; @@ -1148,7 +1150,8 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd ) // user wants turn control to become side control if (fabs(fAxisValue) > joy_sidethreshold->value) { - cmd->sidemove -= (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value; + //cmd->sidemove -= (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value; + cmd->sidemove -= (fAxisValue * joy_sidesensitivity->value) * speed * kSideSpeed; } } else diff --git a/main/source/cl_dll/vgui_ScorePanel.cpp b/main/source/cl_dll/vgui_ScorePanel.cpp index ab2f2258..3be8e2d1 100644 --- a/main/source/cl_dll/vgui_ScorePanel.cpp +++ b/main/source/cl_dll/vgui_ScorePanel.cpp @@ -176,9 +176,13 @@ SBColumnInfo g_ColumnInfo[NUM_COLUMNS] = void ScorePanel::HitTestPanel::internalMousePressed(MouseCode code) { - for(int i=0;i<_inputSignalDar.getCount();i++) + int mutebutton = (int)CVAR_GET_FLOAT("cl_mutemenu") - 1; + if (code == mutebutton) { - _inputSignalDar[i]->mousePressed(code,this); + for (int i = 0; i < _inputSignalDar.getCount(); i++) + { + _inputSignalDar[i]->mousePressed(code,this); + } } } @@ -372,7 +376,7 @@ ScorePanel::ScorePanel(int x, int y, int wide, int tall) : Panel(x, y, wide, tal m_PlayerList.AddItem(pGridRow); } - + // Add the hit test panel. It is invisible and traps mouse clicks so we can go into squelch mode. m_HitTestPanel.setBgColor(0,0,0,255); m_HitTestPanel.setParent(this); diff --git a/main/source/cl_dll/view.cpp b/main/source/cl_dll/view.cpp index 4c83e970..e8066447 100644 --- a/main/source/cl_dll/view.cpp +++ b/main/source/cl_dll/view.cpp @@ -73,7 +73,7 @@ entities sent from the server may not include everything in the pvs, especially when crossing a water boudnary. */ -extern cvar_t *cl_forwardspeed; +//extern cvar_t *cl_forwardspeed; extern cvar_t *chase_active; extern cvar_t *scr_ofsx, *scr_ofsy, *scr_ofsz; extern cvar_t *cl_vsmoothing; diff --git a/main/source/dlls/client.cpp b/main/source/dlls/client.cpp index af6c7271..ead19325 100644 --- a/main/source/dlls/client.cpp +++ b/main/source/dlls/client.cpp @@ -1227,6 +1227,10 @@ void ClientPrecache( void ) PRECACHE_UNMODIFIED_GENERIC("ns.wad"); PRECACHE_UNMODIFIED_GENERIC("ns2.wad"); PRECACHE_UNMODIFIED_GENERIC("v_wad.wad"); + 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("maps/co_angst_detail.txt"); PRECACHE_UNMODIFIED_GENERIC("maps/co_core_detail.txt"); PRECACHE_UNMODIFIED_GENERIC("maps/co_daimos_detail.txt"); @@ -2089,7 +2093,7 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info ) //thePlayer->SetDebugCSP(item); - //item->m_fInSpecialReload = gun->m_fInSpecialReload; + item->m_fInSpecialReload = gun->m_fInSpecialReload; //item->fuser1 = max( gun->pev->fuser1, -0.001 ); item->fuser2 = gun->m_flStartThrow; item->fuser3 = gun->m_flReleaseThrow; @@ -2200,6 +2204,13 @@ void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clien // cd->vuser4.x = gun->m_iPrimaryAmmoType; // cd->vuser4.y = pl->m_rgAmmo[gun->m_iPrimaryAmmoType]; // cd->vuser4.z = pl->m_rgAmmo[gun->m_iSecondaryAmmoType]; + + // Ammo networking 2021 + cd->ammo_nails = gun->m_iPrimaryAmmoType; + cd->ammo_shells = gun->m_iSecondaryAmmoType; + cd->ammo_cells = pl->m_rgAmmo[gun->m_iPrimaryAmmoType]; + cd->ammo_rockets = pl->m_rgAmmo[gun->m_iSecondaryAmmoType]; + // // if ( pl->m_pActiveItem->m_iId == WEAPON_RPG ) // { @@ -2365,10 +2376,6 @@ static char *ignoreInConsistencyCheck[] = { int InconsistentFile( const edict_t *player, const char *filename, char *disconnect_message ) { - // Server doesn't care? - if ( CVAR_GET_FLOAT( "mp_consistency" ) != 1 ) - return 0; - int i=0; while ( ignoreInConsistencyCheck[i] != 0 ) { if ( !strcmp(ignoreInConsistencyCheck[i], filename) ) @@ -2385,11 +2392,24 @@ int InconsistentFile( const edict_t *player, const char *filename, char *disconn } }*/ - // Default behavior is to kick the player - sprintf( disconnect_message, "Server is enforcing file consistency for %s\n", filename ); + if (strstr(filename, "dlls/") != NULL) { + sprintf(disconnect_message, "(%s) Your NS version differs from the server's. Go to github.com/ENSL/NS#downloads or run Natural Launcher for the latest version.\n", filename); + //sprintf(disconnect_message, "(%s) This server is running an experimental NS build. Enable experimental build in Natural Launcher settings. github.com/ENSL/NS#downloads\n", filename); + return 1; + } - // Kick now with specified disconnect message. - return 1; + if (CVAR_GET_FLOAT("mp_consistency") > 1) + { + // 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. + return 1; + } + else + { + return 0; + } } /* diff --git a/main/source/dlls/game.cpp b/main/source/dlls/game.cpp index cadb7f1b..3cb35cc5 100644 --- a/main/source/dlls/game.cpp +++ b/main/source/dlls/game.cpp @@ -122,6 +122,7 @@ 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_jumpmode = {kvJumpMode, "1", FCVAR_SERVER}; +cvar_t avh_version = {kvVersion, "323", FCVAR_SERVER }; #ifdef DEBUG cvar_t avh_testing = {kvTesting, "0", FCVAR_SERVER}; #endif @@ -232,6 +233,7 @@ void GameDLLInit( void ) CVAR_REGISTER (&avh_mapvoteratio); CVAR_REGISTER (&avh_blockscripts); CVAR_REGISTER (&avh_jumpmode); + CVAR_REGISTER (&avh_version); // TODO: Remove CVAR_REGISTER (&avh_ironman); diff --git a/main/source/dlls/player.cpp b/main/source/dlls/player.cpp index 6d533e0e..92346608 100644 --- a/main/source/dlls/player.cpp +++ b/main/source/dlls/player.cpp @@ -3156,16 +3156,21 @@ void CBasePlayer::Spawn( void ) g_engfuncs.pfnSetPhysicsKeyValue( edict(), "slj", "0" ); g_engfuncs.pfnSetPhysicsKeyValue( edict(), "hl", "1" ); - if (avh_jumpmode.value == 2) + if (avh_jumpmode.value == 2 && avh_version.value > 321) g_engfuncs.pfnSetPhysicsKeyValue(edict(), "jm2", "1"); else g_engfuncs.pfnSetPhysicsKeyValue(edict(), "jm2", "0"); - if (avh_jumpmode.value == 1) + if (avh_jumpmode.value == 1 && avh_version.value > 321) g_engfuncs.pfnSetPhysicsKeyValue(edict(), "jm1", "1"); else g_engfuncs.pfnSetPhysicsKeyValue(edict(), "jm1", "0"); + if (avh_version.value > 321) + g_engfuncs.pfnSetPhysicsKeyValue(edict(), "jp", "1"); + else + g_engfuncs.pfnSetPhysicsKeyValue(edict(), "jp", "0"); + pev->fov = m_iFOV = 0;// init field of view. m_iClientFOV = -1; // make sure fov reset is sent diff --git a/main/source/dlls/weapons.cpp b/main/source/dlls/weapons.cpp index fd463cf9..9ea41a3f 100644 --- a/main/source/dlls/weapons.cpp +++ b/main/source/dlls/weapons.cpp @@ -757,7 +757,8 @@ CBasePlayerItem::IsUseable( void ) void CBasePlayerItem :: FallInit( void ) { pev->movetype = MOVETYPE_TOSS; - pev->solid = SOLID_BBOX; + //SOLID_BBOX caused weapons to get stuck on eachother and float in air + pev->solid = SOLID_BSP; UTIL_SetOrigin( pev, pev->origin ); UTIL_SetSize(pev, Vector( 0, 0, 0), Vector(0, 0, 0) );//pointsize until it lands on the ground. @@ -778,6 +779,8 @@ void CBasePlayerItem :: FallInit( void ) void CBasePlayerItem::FallThink ( void ) { pev->nextthink = gpGlobals->time + 0.1; + //timer for weapons stuck floating in air + pev->fuser4 += 0.1; if ( pev->flags & FL_ONGROUND ) { @@ -793,7 +796,14 @@ void CBasePlayerItem::FallThink ( void ) pev->angles.x = 0; pev->angles.z = 0; - Materialize(); + Materialize(); + pev->fuser4 = 0; + } + //weapons in air for too long from collision issues with other entities change to SOLID_TRIGGER to fall to ground + if ((pev->fuser4 > 0.7)) + { + pev->solid = SOLID_TRIGGER; + pev->fuser4 = 0; } } @@ -917,6 +927,15 @@ void CBasePlayerItem::DefaultTouch( CBaseEntity *pOther ) } SUB_UseTargets( pOther, USE_TOGGLE, 0 ); // UNDONE: when should this happen? + + // Haven't had the crash but adding this in case due to weapons being able to turn to SOLID_TRIGGER before touching the ground with 2021 weapon collision fix. + // https://github.com/ValveSoftware/halflife/pull/1599 + // If the item is falling and its Think remains FallItem after the player picks it up, + // then after the item touches the ground its Touch will be set back to DefaultTouch, + // so the player will pick it up again, this time Kill-ing the item (since we already have it in the inventory), + // which will make the pointer bad and crash the game. + if (m_pfnThink == &CBasePlayerItem::FallThink) + SetThink(NULL); } BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted ) @@ -972,17 +991,24 @@ void CBasePlayerWeapon::ItemPostFrame( void ) } else */ - if ( theAttackPressed && CanAttack( m_flNextPrimaryAttack, gpGlobals->time, UseDecrement() ) ) + + if ( theAttackPressed && m_pPlayer->GetCanUseWeapon()) { - if (m_pPlayer->GetCanUseWeapon()) + //bool oldsg = (CVAR_GET_FLOAT("sv_nsversion") < 323.0f); + if ((m_fInSpecialReload == 1 || m_fInSpecialReload == 2) && m_iClip != 0 && (CVAR_GET_FLOAT("sv_nsversion") > 322.0f)) + { + m_fInSpecialReload = 3; + Reload(); + } + else if (CanAttack(m_flNextPrimaryAttack, gpGlobals->time, UseDecrement())) { if ( (m_iClip == 0 && pszAmmo1()) || (iMaxClip() == -1 && !m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] ) ) { m_fFireOnEmpty = TRUE; } - m_pPlayer->TabulateAmmo(); - PrimaryAttack(); + m_pPlayer->TabulateAmmo(); + PrimaryAttack(); } } else if ( m_pPlayer->pev->button & IN_RELOAD && iMaxClip() != WEAPON_NOCLIP && !m_fInReload ) diff --git a/main/source/mod/AvHBasePlayerWeapon.cpp b/main/source/mod/AvHBasePlayerWeapon.cpp index fad392fa..64fe63cb 100644 --- a/main/source/mod/AvHBasePlayerWeapon.cpp +++ b/main/source/mod/AvHBasePlayerWeapon.cpp @@ -266,7 +266,7 @@ BOOL AvHBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, return TRUE; // : - if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) + if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iId == AVH_WEAPON_KNIFE) return FALSE; // Don't reload while we're resupplying @@ -284,12 +284,15 @@ BOOL AvHBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, //!!UNDONE -- reload sound goes here !!! //SendWeaponAnim( iAnim, UseDecrement() ? 1 : 0 ); - this->SendWeaponAnim(iAnim); + //// 2021 Ammo networking. Commented below - client was getting sent extra reload animations causing visual stutter. + //this->SendWeaponAnim(iAnim); // Send reload to all players. Reloads are initiated server-side, so send down to local client as well - this->m_pPlayer->pev->weaponanim = iAnim; + //// 2021 Ammo networking. Commented below - client was getting sent extra reload animations causing visual stutter. + //this->m_pPlayer->pev->weaponanim = iAnim; this->PlaybackEvent(this->mWeaponAnimationEvent, iAnim, FEV_RELIABLE); + //ALERT(at_console, "defaultreload nextattack:%g\n", m_pPlayer->m_flNextAttack); // Player model reload animation this->m_pPlayer->SetAnimation(PLAYER_RELOAD); @@ -742,11 +745,12 @@ bool AvHBasePlayerWeapon::ProcessValidAttack(void) ASSERT(this->m_iPrimaryAmmoType >= 0); if(this->m_iClip > 0) { - if(this->m_flNextPrimaryAttack <= 0) + if((this->m_flNextPrimaryAttack <= 0) && !this->m_fInSpecialReload) { if(!this->GetMustPressTriggerForEachShot() || (!this->mAttackButtonDownLastFrame)) { - theAttackIsValid = true; + //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; } } } @@ -757,14 +761,15 @@ bool AvHBasePlayerWeapon::ProcessValidAttack(void) BOOL theHasAmmo = 0; - if ( pszAmmo1() ) - { + //// 2021 Ammo networking - Client can't check pszAmmo, removing check since every gun in NS uses pszAmmo1 and it was causing theHasAmmo to fail on client when the player had ammo. + //if ( pszAmmo1() ) + //{ theHasAmmo |= (this->m_pPlayer->m_rgAmmo[this->m_iPrimaryAmmoType] != 0); - } - if ( pszAmmo2() ) - { - theHasAmmo |= (this->m_pPlayer->m_rgAmmo[this->m_iSecondaryAmmoType] != 0); - } + //} + //if ( pszAmmo2() ) + //{ + //theHasAmmo |= (this->m_pPlayer->m_rgAmmo[this->m_iSecondaryAmmoType] != 0); + //} if (this->m_iClip > 0) { theHasAmmo |= 1; @@ -774,12 +779,16 @@ bool AvHBasePlayerWeapon::ProcessValidAttack(void) { // Trigger reload this->Reload(); + //ALERT(at_console, "hasammo m_iprimary: %i\n", this->m_pPlayer->m_rgAmmo[this->m_iPrimaryAmmoType]); + //ALERT(at_console, "hasammo m_iptype: %i\n", m_iPrimaryAmmoType); } else { this->PlayEmptySound(); this->SendWeaponAnim(this->GetEmptyShootAnimation()); + //ALERT(at_console, "noammo m_iprimary: %i\n", this->m_pPlayer->m_rgAmmo[this->m_iPrimaryAmmoType]); + //ALERT(at_console, "noammo m_iptype: %i\n", m_iPrimaryAmmoType); //this->m_pPlayer->SetAnimation(PLAYER_ATTACK1); } diff --git a/main/source/mod/AvHClientVariables.h b/main/source/mod/AvHClientVariables.h index 91954c35..9c507a83 100644 --- a/main/source/mod/AvHClientVariables.h +++ b/main/source/mod/AvHClientVariables.h @@ -46,7 +46,7 @@ extern cvar_t* cl_musicdir; // : #define kvCMHotKeys "cl_cmhotkeys" -#define kvForceDefaultFOV "cl_forcedefaultfov" +//#define kvForceDefaultFOV "cl_forcedefaultfov" #define kvWidescreen "cl_widescreen" #define kvAmbientSound "cl_ambientsound" #define kvCenterEntityID "cl_centerentityid" diff --git a/main/source/mod/AvHGamerules.cpp b/main/source/mod/AvHGamerules.cpp index a6a64211..38406bea 100644 --- a/main/source/mod/AvHGamerules.cpp +++ b/main/source/mod/AvHGamerules.cpp @@ -229,6 +229,7 @@ extern cvar_t avh_gametime; extern cvar_t avh_ironman; extern cvar_t avh_mapvoteratio; extern cvar_t avh_structurelimit; +extern cvar_t avh_version; BOOL IsSpawnPointValid( CBaseEntity *pPlayer, CBaseEntity *pSpot ); inline int FNullEnt( CBaseEntity *ent ) { return (ent == NULL) || FNullEnt( ent->edict() ); } @@ -336,6 +337,7 @@ AvHGamerules::AvHGamerules() : mTeamA(TEAM_ONE), mTeamB(TEAM_TWO) RegisterServerVariable(&avh_team4damagepercent); RegisterServerVariable(avh_cheats); RegisterServerVariable(&avh_structurelimit); + RegisterServerVariable(&avh_version); g_VoiceGameMgr.Init(&gVoiceHelper, gpGlobals->maxClients); @@ -4356,6 +4358,7 @@ int AvHGamerules::GetCostForMessageID(AvHMessageID inMessageID) const { // This is point cost or energy cost in NS, or number of levels in Combat int cost = 0; + bool theGameStarted = GetGameRules()->GetGameStarted(); if(this->GetIsCombatMode()) { @@ -4407,6 +4410,18 @@ int AvHGamerules::GetCostForMessageID(AvHMessageID inMessageID) const break; } } + else if (!theGameStarted) + { + switch (inMessageID) + { + case ALIEN_LIFEFORM_TWO: + case ALIEN_LIFEFORM_THREE: + case ALIEN_LIFEFORM_FOUR: + case ALIEN_LIFEFORM_FIVE: + cost = 0; + break; + } + } else { switch(inMessageID) diff --git a/main/source/mod/AvHHud.cpp b/main/source/mod/AvHHud.cpp index 0d351c2a..1ed03c7c 100644 --- a/main/source/mod/AvHHud.cpp +++ b/main/source/mod/AvHHud.cpp @@ -729,18 +729,19 @@ void AvHHud::AddCommands() gEngfuncs.pfnAddCommand ("+mousepopupmenu", AvHPieMenuHandler::OpenPieMenu); gEngfuncs.pfnAddCommand ("-mousepopupmenu", AvHPieMenuHandler::ClosePieMenu); + ////Key scrolling now handled in input.cpp // Add scrolling commands - gEngfuncs.pfnAddCommand ("+scrollup", AvHScrollHandler::KeyScrollUp); - gEngfuncs.pfnAddCommand ("-scrollup", AvHScrollHandler::KeyScrollUpStop); + //gEngfuncs.pfnAddCommand ("+scrollup", AvHScrollHandler::KeyScrollUp); + //gEngfuncs.pfnAddCommand ("-scrollup", AvHScrollHandler::KeyScrollUpStop); - gEngfuncs.pfnAddCommand ("+scrolldown", AvHScrollHandler::KeyScrollDown); - gEngfuncs.pfnAddCommand ("-scrolldown", AvHScrollHandler::KeyScrollDownStop); + //gEngfuncs.pfnAddCommand ("+scrolldown", AvHScrollHandler::KeyScrollDown); + //gEngfuncs.pfnAddCommand ("-scrolldown", AvHScrollHandler::KeyScrollDownStop); - gEngfuncs.pfnAddCommand ("+scrollleft", AvHScrollHandler::KeyScrollLeft); - gEngfuncs.pfnAddCommand ("-scrollleft", AvHScrollHandler::KeyScrollLeftStop); + //gEngfuncs.pfnAddCommand ("+scrollleft", AvHScrollHandler::KeyScrollLeft); + //gEngfuncs.pfnAddCommand ("-scrollleft", AvHScrollHandler::KeyScrollLeftStop); - gEngfuncs.pfnAddCommand ("+scrollright", AvHScrollHandler::KeyScrollRight); - gEngfuncs.pfnAddCommand ("-scrollright", AvHScrollHandler::KeyScrollRightStop); + //gEngfuncs.pfnAddCommand ("+scrollright", AvHScrollHandler::KeyScrollRight); + //gEngfuncs.pfnAddCommand ("-scrollright", AvHScrollHandler::KeyScrollRightStop); gEngfuncs.pfnAddCommand ("toggleeditps", AvHParticleEditorHandler::ToggleEdit); @@ -2194,7 +2195,6 @@ void AvHHud::ResetComponentsForUser3() { bool theIsCombatMode = (this->mMapMode == MAP_MODE_CO); bool theIsNSMode = (this->mMapMode == MAP_MODE_NS); - if((this->GetHUDPlayMode() == PLAYMODE_PLAYING) && !this->GetIsNotInControl() && !gViewPort->IsOptionsMenuVisible()) { switch(this->GetHUDUser3()) @@ -2204,7 +2204,7 @@ void AvHHud::ResetComponentsForUser3() { this->mPieMenuControl = kSoldierCombatMenu; } - else if(theIsNSMode) + else/* if(theIsNSMode) */ { this->mPieMenuControl = kSoldierMenu; } @@ -2250,7 +2250,7 @@ void AvHHud::ResetComponentsForUser3() { this->mPieMenuControl = kAlienCombatMenu; } - else if(theIsNSMode) + else/* if(theIsNSMode)*/ { this->mPieMenuControl = kAlienMenu; } diff --git a/main/source/mod/AvHHud.h b/main/source/mod/AvHHud.h index 93c76251..8bd248d7 100644 --- a/main/source/mod/AvHHud.h +++ b/main/source/mod/AvHHud.h @@ -362,6 +362,7 @@ public: void RenderNoZBuffering(); void Render(); + void RenderShowSpeed(); void RenderCommonUI(); void RenderMarineUI(); void RenderCommanderUI(); diff --git a/main/source/mod/AvHHudRender.cpp b/main/source/mod/AvHHudRender.cpp index 6d9abd76..5f8ca6e5 100644 --- a/main/source/mod/AvHHudRender.cpp +++ b/main/source/mod/AvHHudRender.cpp @@ -2778,6 +2778,10 @@ void AvHHud::Render() RenderProgressBar(kProgressBarSprite); } + if (this->GetHUDPlayMode() >= 1 && this->GetHUDPlayMode() <= 5) + { + RenderShowSpeed(); + } } AvHSpriteEndFrame(); @@ -2785,50 +2789,53 @@ void AvHHud::Render() } +void AvHHud::RenderShowSpeed() +{ + static bool speedMeasured = false; + if (!mSteamUIActive) + { + static int maxSpeed = 0, maxGroundSpeed = 0, maxClimb = 0, maxDive = 0; + if (CVAR_GET_FLOAT("cl_showspeed") != 0) { + + // Draw the speedometer. + int theR, theG, theB; + this->GetPrimaryHudColor(theR, theG, theB, true, false); + + extern playermove_s* pmove; + + char buffer[1024]; + + maxClimb = max(maxClimb, (int)pmove->velocity[2]); + maxDive = min(maxDive, (int)pmove->velocity[2]); + + int speed = (int)Length(pmove->velocity); + + maxSpeed = max(speed, maxSpeed); + sprintf(buffer, "Speed = %d (%d) %d/%d", speed, maxSpeed, maxClimb, maxDive); + mFont.DrawString(10, 10, buffer, theR, theG, theB); + + float theGroundSpeed = sqrtf(pmove->velocity[0] * pmove->velocity[0] + pmove->velocity[1] * pmove->velocity[1]); + maxGroundSpeed = max(theGroundSpeed, maxGroundSpeed); + sprintf(buffer, "Ground speed = %d (%d)", (int)theGroundSpeed, maxGroundSpeed); + mFont.DrawString(10, 12 + mFont.GetStringHeight(), buffer, theR, theG, theB); + speedMeasured = true; + } + else if (speedMeasured == true) { + char msg[256]; + sprintf(msg, "Current Speed(%d)\tCurrent Ground Speed(%d) Max Speed(%d)\t Max Ground Speed (%d)\tMax Climb (%d)\tMax Dive(%d)\n", + (int)Length(pmove->velocity), (int)sqrtf(pmove->velocity[0] * pmove->velocity[0] + pmove->velocity[1] * pmove->velocity[1]), + maxSpeed, maxGroundSpeed, maxClimb, maxDive); + ConsolePrint(msg); + maxSpeed = 0, maxGroundSpeed = 0, maxClimb = 0, maxDive = 0; + speedMeasured = false; + } + } +} + void AvHHud::RenderCommonUI() { - static bool speedMeasured=false; if (!mSteamUIActive) { - - //if (gHUD.GetServerVariableFloat("sv_cheats") != 0 ) { - static int maxSpeed=0, maxGroundSpeed=0, maxClimb=0, maxDive=0; - if ( CVAR_GET_FLOAT("cl_showspeed") != 0) { - - // Draw the speedometer. - int theR, theG, theB; - this->GetPrimaryHudColor(theR, theG, theB, true, false); - - extern playermove_s* pmove; - - char buffer[1024]; - - maxClimb=max(maxClimb, (int)pmove->velocity[2]); - maxDive=min(maxDive, (int)pmove->velocity[2]); - - int speed=(int)Length(pmove->velocity); - - maxSpeed=max(speed, maxSpeed); - sprintf(buffer, "Speed = %d (%d) %d/%d", speed, maxSpeed, maxClimb, maxDive); - mFont.DrawString(10, 10, buffer, theR, theG, theB); - - float theGroundSpeed = sqrtf(pmove->velocity[0] * pmove->velocity[0] + pmove->velocity[1] * pmove->velocity[1]); - maxGroundSpeed=max(theGroundSpeed, maxGroundSpeed); - sprintf(buffer, "Ground speed = %d (%d)", (int)theGroundSpeed, maxGroundSpeed); - mFont.DrawString(10, 12 + mFont.GetStringHeight(), buffer, theR, theG, theB); - speedMeasured = true; - } - else if ( speedMeasured == true ) { - char msg[256]; - sprintf(msg, "Current Speed(%d)\tCurrent Ground Speed(%d) Max Speed(%d)\t Max Ground Speed (%d)\tMax Climb (%d)\tMax Dive(%d)\n", - (int)Length(pmove->velocity), (int)sqrtf(pmove->velocity[0] * pmove->velocity[0] + pmove->velocity[1] * pmove->velocity[1]), - maxSpeed, maxGroundSpeed, maxClimb, maxDive); - ConsolePrint(msg); - maxSpeed=0, maxGroundSpeed=0, maxClimb=0, maxDive=0; - speedMeasured = false; - } - //} - DrawInfoLocationText(); DrawHUDStructureNotification(); diff --git a/main/source/mod/AvHMarineWeapon.cpp b/main/source/mod/AvHMarineWeapon.cpp index 4b2264bc..f9565c58 100644 --- a/main/source/mod/AvHMarineWeapon.cpp +++ b/main/source/mod/AvHMarineWeapon.cpp @@ -29,6 +29,8 @@ #include "AvHMarineWeaponConstants.h" #include "AvHSpecials.h" #include "../util/Balance.h" +#include "AvHServerUtil.h" +#include "AvHSharedUtil.h" bool AvHMarineWeapon::GetAllowedForUser3(AvHUser3 inUser3) { @@ -105,15 +107,16 @@ void AvHMarineWeapon::Precache() const int kSpecialReloadNone = 0; const int kSpecialReloadGotoReload = 1; const int kSpecialReloadReloadShell = 2; +const int kSpecialReloadPump = 3; void AvHReloadableMarineWeapon::DeductCostForShot(void) { AvHMarineWeapon::DeductCostForShot(); // Stop reload if we were in the middle of one - if(this->mSpecialReload != kSpecialReloadNone) + if(this->m_fInSpecialReload != kSpecialReloadNone) { - this->mSpecialReload = kSpecialReloadNone; + this->m_fInSpecialReload = kSpecialReloadNone; } } @@ -128,78 +131,109 @@ void AvHReloadableMarineWeapon::Holster( int skiplocal) AvHMarineWeapon::Holster(skiplocal); // Cancel any reload in progress. - this->mSpecialReload = kSpecialReloadNone; + this->m_fInSpecialReload = kSpecialReloadNone; } void AvHReloadableMarineWeapon::Init() { - this->mSpecialReload = kSpecialReloadNone; - this->mNextReload = 0; + this->m_fInSpecialReload = kSpecialReloadNone; + //this->mNextReload = 0; } void AvHReloadableMarineWeapon::Reload(void) { - int theReloadAnimation = this->GetReloadAnimation(); - float theReloadTime = this->GetReloadTime(); + //int theReloadAnimation = this->GetReloadAnimation(); + //float theReloadTime = this->GetReloadTime(); int theClipSize = this->GetClipSize(); if((this->m_pPlayer->m_rgAmmo[this->m_iPrimaryAmmoType] > 0) && (m_iClip < theClipSize)) { + if (this->m_fInSpecialReload == kSpecialReloadPump) + { + //pump the shotgun to end the reload if attack is pressed during a reload + //ALERT(at_console, "reloadpump3\n"); + this->SendWeaponAnim(this->GetEndReloadAnimation()); + + //float theEndReloadAnimationTime = this->GetEndReloadAnimationTime(); + //this->m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + theEndReloadAnimationTime; + //this->m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + theEndReloadAnimationTime; + //this->m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + theEndReloadAnimationTime; + + //+1 second is the average of the gotoreload and shellreload times previously used to limit primary attack and matches the marine putting his hand on the gun. + //this->m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0f; + this->m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f; + this->m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.0f; + this->m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0f; + + this->m_pPlayer->SetAnimation(PLAYER_RELOAD_END); + this->m_fInSpecialReload = kSpecialReloadNone; + } // don't reload until recoil is done - if(this->m_flNextPrimaryAttack <= UTIL_WeaponTimeBase()) + else if(this->m_flNextPrimaryAttack <= UTIL_WeaponTimeBase()) { - if(this->mSpecialReload == kSpecialReloadNone) + if(this->m_fInSpecialReload == kSpecialReloadNone) { // Start reload - this->mSpecialReload = kSpecialReloadGotoReload; - + this->m_fInSpecialReload = kSpecialReloadGotoReload; + //ALERT(at_console, "reload0\n"); this->SendWeaponAnim(this->GetGotoReloadAnimation()); float theGotoReloadAnimationTime = this->GetGotoReloadAnimationTime(); + + bool oldreload = (CVAR_GET_FLOAT("sv_nsversion") < 323.0f); + if (oldreload) + { + this->m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.1f; + this->m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.1f; + this->m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.1f; + this->m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.1f; + } + else + { + this->m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + theGotoReloadAnimationTime; + this->m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + theGotoReloadAnimationTime; + this->m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + theGotoReloadAnimationTime; + } - this->m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + theGotoReloadAnimationTime; - this->m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + theGotoReloadAnimationTime; - - this->m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + theGotoReloadAnimationTime; // 1.0f - this->m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + theGotoReloadAnimationTime; // 1.0f this->m_pPlayer->SetAnimation(PLAYER_RELOAD_START); } - else if(this->mSpecialReload == kSpecialReloadGotoReload) + else if(this->m_fInSpecialReload == kSpecialReloadGotoReload) { if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase()) { // was waiting for gun to move to side - this->mSpecialReload = kSpecialReloadReloadShell; - + this->m_fInSpecialReload = kSpecialReloadReloadShell; + //ALERT(at_console, "reload1\n"); this->SendWeaponAnim(this->GetShellReloadAnimation()); float theShellReloadTime = this->GetShellReloadAnimationTime(); - this->mNextReload = UTIL_WeaponTimeBase() + theShellReloadTime; + //this->mNextReload = UTIL_WeaponTimeBase() + theShellReloadTime; this->m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + theShellReloadTime; - this->m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + theShellReloadTime; - this->m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + theShellReloadTime; + this->m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + theShellReloadTime; + this->m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + theShellReloadTime; this->m_pPlayer->SetAnimation(PLAYER_RELOAD_INSERT); } } - else if(this->mSpecialReload == kSpecialReloadReloadShell) + else if(this->m_fInSpecialReload == kSpecialReloadReloadShell) { //DefaultReload(theClipSize, theReloadAnimation, theReloadTime); - + // Don't idle for a bit //this->SetNextIdle(); + //ALERT(at_console, "reload2clipadd %g\n", gpGlobals->time); + // Add them to the clip this->m_iClip += 1; this->m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= 1; - this->mSpecialReload = kSpecialReloadGotoReload; + this->m_fInSpecialReload = kSpecialReloadGotoReload; this->m_pPlayer->SetAnimation(PLAYER_RELOAD_END); } - - + } } @@ -210,14 +244,13 @@ void AvHReloadableMarineWeapon::WeaponIdle(void) { // : 0000484 - ensures that all idle weapons can fire the empty sound ResetEmptySound(); - if(this->m_flTimeWeaponIdle < UTIL_WeaponTimeBase()) { - if((this->m_iClip == 0) && (this->mSpecialReload == kSpecialReloadNone) && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]) + if((this->m_iClip == 0) && (this->m_fInSpecialReload == kSpecialReloadNone) && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]) { this->Reload(); } - else if(this->mSpecialReload != kSpecialReloadNone) + else if(this->m_fInSpecialReload != kSpecialReloadNone) { if((m_iClip != this->GetClipSize()) && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]) { @@ -226,8 +259,8 @@ void AvHReloadableMarineWeapon::WeaponIdle(void) else { // reload debounce has timed out - this->mSpecialReload = kSpecialReloadNone; - + this->m_fInSpecialReload = kSpecialReloadNone; + //ALERT(at_console, "specreset time:%g idle:%g primary:%g specrel:%d\n", gpGlobals->time, this->m_flTimeWeaponIdle, this->m_flNextPrimaryAttack, m_fInSpecialReload); this->SendWeaponAnim(this->GetEndReloadAnimation()); float theEndReloadAnimationTime = this->GetEndReloadAnimationTime(); diff --git a/main/source/mod/AvHMarineWeapon.h b/main/source/mod/AvHMarineWeapon.h index 89d35f94..b79c1130 100644 --- a/main/source/mod/AvHMarineWeapon.h +++ b/main/source/mod/AvHMarineWeapon.h @@ -72,9 +72,9 @@ public: protected: virtual void Init(); -private: - int mSpecialReload; - float mNextReload; +//private: +// int mSpecialReload; +// float mNextReload; }; #endif \ No newline at end of file diff --git a/main/source/mod/AvHMovementUtil.cpp b/main/source/mod/AvHMovementUtil.cpp index 3d54dd5e..e4831882 100644 --- a/main/source/mod/AvHMovementUtil.cpp +++ b/main/source/mod/AvHMovementUtil.cpp @@ -260,33 +260,26 @@ float AvHMUGetWalkSpeedFactor(AvHUser3 inUser3) { float theMoveSpeed = .1f; - //unsolved +speed speed reduction starting with 3.2.1 - these values modified to replicate old movement switch (inUser3) { case AVH_USER3_MARINE_PLAYER: - //theMoveSpeed = .095f; - theMoveSpeed = .238f; + theMoveSpeed = .095f; break; case AVH_USER3_ALIEN_PLAYER1: //theMoveSpeed = .04f; - //theMoveSpeed = .14f; - theMoveSpeed = .35f; + theMoveSpeed = .14f; break; case AVH_USER3_ALIEN_PLAYER2: - //theMoveSpeed = .08f; - theMoveSpeed = .2f; + theMoveSpeed = .08f; break; case AVH_USER3_ALIEN_PLAYER3: - //theMoveSpeed = .11f; - theMoveSpeed = .275f; + theMoveSpeed = .11f; break; case AVH_USER3_ALIEN_PLAYER4: - //theMoveSpeed = .09f; - theMoveSpeed = .225f; + theMoveSpeed = .09f; break; case AVH_USER3_ALIEN_PLAYER5: - //theMoveSpeed = .09f; - theMoveSpeed = .225f; + theMoveSpeed = .09f; break; } diff --git a/main/source/mod/AvHOverviewMap.cpp b/main/source/mod/AvHOverviewMap.cpp index 29e242a4..692c0a53 100644 --- a/main/source/mod/AvHOverviewMap.cpp +++ b/main/source/mod/AvHOverviewMap.cpp @@ -397,16 +397,16 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR int f2 = theStructEntity->curstate.fuser2; int f3 = theStructEntity->curstate.fuser3; int f4 = theStructEntity->curstate.fuser4; - ConsolePrint("--------------------------------\n"); - ConsolePrint(("ENTITY ID : " + to_string(entity.mEntityNumber)).c_str()); - ConsolePrint("--------------------------------\n"); - ConsolePrint(("health " +to_string(health)+"\n").c_str()); - ConsolePrint(("solid " + to_string(solid) + "\n").c_str()); - ConsolePrint(("f1 " + to_string(f1) + "\n").c_str()); - ConsolePrint(("f2 " + to_string(f2) + "\n").c_str()); - ConsolePrint(("f3 " + to_string(f4) + "\n").c_str()); - ConsolePrint(("f4 " + to_string(f4) + "\n").c_str()); - ConsolePrint("--------------------------------\n"); + //ConsolePrint("--------------------------------\n"); + //ConsolePrint(("ENTITY ID : " + to_string(entity.mEntityNumber)).c_str()); + //ConsolePrint("--------------------------------\n"); + //ConsolePrint(("health " +to_string(health)+"\n").c_str()); + //ConsolePrint(("solid " + to_string(solid) + "\n").c_str()); + //ConsolePrint(("f1 " + to_string(f1) + "\n").c_str()); + //ConsolePrint(("f2 " + to_string(f2) + "\n").c_str()); + //ConsolePrint(("f3 " + to_string(f4) + "\n").c_str()); + //ConsolePrint(("f4 " + to_string(f4) + "\n").c_str()); + //ConsolePrint("--------------------------------\n"); if (entity.mTeam == TEAM_ONE) { diff --git a/main/source/mod/AvHPlayer.cpp b/main/source/mod/AvHPlayer.cpp index 3c4aca5d..bd277cd4 100644 --- a/main/source/mod/AvHPlayer.cpp +++ b/main/source/mod/AvHPlayer.cpp @@ -2476,19 +2476,19 @@ bool AvHPlayer::GetPurchaseAllowed(AvHMessageID inUpgrade, int& outCost, string* break; case ALIEN_LIFEFORM_ONE: - if(theIsAlien && theGameStarted && (this->GetUser3() != AVH_USER3_ALIEN_PLAYER1)) + if(theIsAlien && /*theGameStarted && */(this->GetUser3() != AVH_USER3_ALIEN_PLAYER1)) { thePurchaseAllowed = true; } break; case ALIEN_LIFEFORM_TWO: - if(theIsAlien && theGameStarted && (this->GetUser3() != AVH_USER3_ALIEN_PLAYER2)) + if(theIsAlien && /*theGameStarted && */(this->GetUser3() != AVH_USER3_ALIEN_PLAYER2)) { thePurchaseAllowed = true; } break; case ALIEN_LIFEFORM_THREE: - if(theIsAlien && theGameStarted && (this->GetUser3() != AVH_USER3_ALIEN_PLAYER3)) + if(theIsAlien && /*theGameStarted && */(this->GetUser3() != AVH_USER3_ALIEN_PLAYER3)) { // if(theNumHives >= 1) // { @@ -2501,7 +2501,7 @@ bool AvHPlayer::GetPurchaseAllowed(AvHMessageID inUpgrade, int& outCost, string* } break; case ALIEN_LIFEFORM_FOUR: - if(theIsAlien && theGameStarted && (this->GetUser3() != AVH_USER3_ALIEN_PLAYER4)) + if(theIsAlien && /*theGameStarted && */(this->GetUser3() != AVH_USER3_ALIEN_PLAYER4)) { // if(theNumHives >= 2) // { @@ -2514,7 +2514,7 @@ bool AvHPlayer::GetPurchaseAllowed(AvHMessageID inUpgrade, int& outCost, string* } break; case ALIEN_LIFEFORM_FIVE: - if(theIsAlien && theGameStarted && (this->GetUser3() != AVH_USER3_ALIEN_PLAYER5)) + if(theIsAlien && /*theGameStarted && */(this->GetUser3() != AVH_USER3_ALIEN_PLAYER5)) { // if(theNumHives >= 3) // { @@ -2529,18 +2529,22 @@ bool AvHPlayer::GetPurchaseAllowed(AvHMessageID inUpgrade, int& outCost, string* case ALIEN_BUILD_RESOURCES: case ALIEN_BUILD_HIVE: - if(theIsBuilder) + if(theIsBuilder && theGameStarted) { thePurchaseAllowed = true; } - else + else if (theIsBuilder && !theGameStarted) + { + theErrorMessage = kMustBeStarted; + } + else { theErrorMessage = kMustBeBuilder; } break; case ALIEN_BUILD_OFFENSE_CHAMBER: - if(theIsBuilder) + if(theIsBuilder && theGameStarted) { if(theNumHives >= 1) { @@ -2551,6 +2555,10 @@ bool AvHPlayer::GetPurchaseAllowed(AvHMessageID inUpgrade, int& outCost, string* theErrorMessage = kNeedOneHiveForStructure; } } + else if (theIsBuilder && !theGameStarted) + { + theErrorMessage = kMustBeStarted; + } else { theErrorMessage = kMustBeBuilder; @@ -2561,7 +2569,7 @@ bool AvHPlayer::GetPurchaseAllowed(AvHMessageID inUpgrade, int& outCost, string* case ALIEN_BUILD_DEFENSE_CHAMBER: case ALIEN_BUILD_MOVEMENT_CHAMBER: case ALIEN_BUILD_SENSORY_CHAMBER: - if(theIsBuilder) + if(theIsBuilder && theGameStarted) { FOR_ALL_ENTITIES(kesTeamHive, AvHHive*) if(theEntity && theEntity->GetIsActive() && (theEntity->pev->team == this->pev->team)) @@ -2598,6 +2606,10 @@ bool AvHPlayer::GetPurchaseAllowed(AvHMessageID inUpgrade, int& outCost, string* } } } + else if (theIsBuilder && !theGameStarted) + { + theErrorMessage = kMustBeStarted; + } else { theErrorMessage = kMustBeBuilder; diff --git a/main/source/mod/AvHScrollHandler.cpp b/main/source/mod/AvHScrollHandler.cpp index 21818b9d..a9f75f24 100644 --- a/main/source/mod/AvHScrollHandler.cpp +++ b/main/source/mod/AvHScrollHandler.cpp @@ -65,61 +65,62 @@ void AvHScrollHandler::ClearScrollHeight() sScrollZ = 0; } -void AvHScrollHandler::KeyScrollLeft() -{ - if ( sKeyDown < 0 ) sKeyDown=0; - sKeyDown++; - ScrollLeft(); -} - -void AvHScrollHandler::KeyScrollRight() -{ - if ( sKeyDown < 0 ) sKeyDown=0; - sKeyDown++; - ScrollRight(); -} - -void AvHScrollHandler::KeyScrollUp() -{ - if ( sKeyDown < 0 ) sKeyDown=0; - sKeyDown++; - ScrollUp(); -} - -void AvHScrollHandler::KeyScrollDown() -{ - if ( sKeyDown < 0 ) sKeyDown=0; - sKeyDown++; - ScrollDown(); -} - -void AvHScrollHandler::KeyScrollUpStop() -{ - sKeyDown--; - if ( sKeyDown < 0 ) sKeyDown=0; - sScrollY=0; -} - -void AvHScrollHandler::KeyScrollDownStop() -{ - sKeyDown--; - if ( sKeyDown < 0 ) sKeyDown=0; - sScrollY=0; -} - -void AvHScrollHandler::KeyScrollLeftStop() -{ - sKeyDown--; - if ( sKeyDown < 0 ) sKeyDown=0; - sScrollX=0; -} - -void AvHScrollHandler::KeyScrollRightStop() -{ - sKeyDown--; - if ( sKeyDown < 0 ) sKeyDown=0; - sScrollX=0; -} +////Key scrolling now handled in input.cpp +//void AvHScrollHandler::KeyScrollLeft() +//{ +// if ( sKeyDown < 0 ) sKeyDown=0; +// sKeyDown++; +// ScrollLeft(); +//} +// +//void AvHScrollHandler::KeyScrollRight() +//{ +// if ( sKeyDown < 0 ) sKeyDown=0; +// sKeyDown++; +// ScrollRight(); +//} +// +//void AvHScrollHandler::KeyScrollUp() +//{ +// if ( sKeyDown < 0 ) sKeyDown=0; +// sKeyDown++; +// ScrollUp(); +//} +// +//void AvHScrollHandler::KeyScrollDown() +//{ +// if ( sKeyDown < 0 ) sKeyDown=0; +// sKeyDown++; +// ScrollDown(); +//} +// +//void AvHScrollHandler::KeyScrollUpStop() +//{ +// sKeyDown--; +// if ( sKeyDown < 0 ) sKeyDown=0; +// sScrollY=0; +//} +// +//void AvHScrollHandler::KeyScrollDownStop() +//{ +// sKeyDown--; +// if ( sKeyDown < 0 ) sKeyDown=0; +// sScrollY=0; +//} +// +//void AvHScrollHandler::KeyScrollLeftStop() +//{ +// sKeyDown--; +// if ( sKeyDown < 0 ) sKeyDown=0; +// sScrollX=0; +//} +// +//void AvHScrollHandler::KeyScrollRightStop() +//{ +// sKeyDown--; +// if ( sKeyDown < 0 ) sKeyDown=0; +// sScrollX=0; +//} void AvHScrollHandler::ScrollLeft() diff --git a/main/source/mod/AvHScrollHandler.h b/main/source/mod/AvHScrollHandler.h index f9d55d53..cbe4134b 100644 --- a/main/source/mod/AvHScrollHandler.h +++ b/main/source/mod/AvHScrollHandler.h @@ -21,14 +21,15 @@ public: bool GetMouseTwoDown() const; static void ClearScrollHeight(); - static void KeyScrollLeft(); - static void KeyScrollRight(); - static void KeyScrollUp(); - static void KeyScrollDown(); - static void KeyScrollLeftStop(); - static void KeyScrollRightStop(); - static void KeyScrollUpStop(); - static void KeyScrollDownStop(); + ////Key scrolling now handled in input.cpp + //static void KeyScrollLeft(); + //static void KeyScrollRight(); + //static void KeyScrollUp(); + //static void KeyScrollDown(); + //static void KeyScrollLeftStop(); + //static void KeyScrollRightStop(); + //static void KeyScrollUpStop(); + //static void KeyScrollDownStop(); static void ScrollLeft(); static void ScrollRight(); static void ScrollUp(); diff --git a/main/source/mod/AvHServerVariables.h b/main/source/mod/AvHServerVariables.h index 3ae78529..f518b87c 100644 --- a/main/source/mod/AvHServerVariables.h +++ b/main/source/mod/AvHServerVariables.h @@ -95,8 +95,7 @@ extern cvar_t *violence_hgibs; extern cvar_t *violence_agibs; extern cvar_t avh_killdelay; extern cvar_t *showtriggers; - -extern cvar_t *showtriggers; +extern cvar_t avh_version; char *ns_cvar_string(const cvar_t *cvar); int ns_cvar_int(const cvar_t *cvar); @@ -145,5 +144,6 @@ float ns_cvar_float(const cvar_t *cvar); #define kvBlockScripts "mp_blockscripts" #define kvJumpMode "sv_jumpmode" +#define kvVersion "sv_nsversion" #endif diff --git a/main/source/mod/AvHSonicGun.cpp b/main/source/mod/AvHSonicGun.cpp index fbb6b493..e1350202 100644 --- a/main/source/mod/AvHSonicGun.cpp +++ b/main/source/mod/AvHSonicGun.cpp @@ -80,6 +80,8 @@ #include "../common/vector_util.h" #include "AvHMarineWeapons.h" #include "AvHPlayerUpgrade.h" +#include "AvHServerUtil.h" +#include "AvHSharedUtil.h" // Anim key: const int kShotgunAnimIdle = 0; @@ -91,7 +93,8 @@ const int kShotgunAnimShoot = 5; const int kShotgunAnimShootEmpty = 6; const int kShotgunAnimDraw = 7; const float kShotgunAnimDrawLength = .9f; -const float kShotgunGotoReloadLength = 1.1f; +//const float kShotgunGotoReloadLength = 1.1f; +const float kShotgunGotoReloadLength = 1.6f; const float kShotgunReloadShellLength = .9f; const float kShotgunEndReloadLength = 1.8f; @@ -210,7 +213,16 @@ void AvHSonicGun::FireProjectiles(void) // Fire the bullets and apply damage //this->m_pPlayer->FireBullets(kSGBulletsPerShot, vecSrc, vecAiming, this->GetProjectileSpread(), this->mRange, 0, 0, theDamage); - this->m_pPlayer->FireBulletsPlayer(BALANCE_VAR(kSGBulletsPerShot), vecSrc, vecAiming, this->GetProjectileSpread(), this->mRange, BULLET_PLAYER_BUCKSHOT, 0, theDamage, 0, this->m_pPlayer->random_seed); + + bool oldshotty = (CVAR_GET_FLOAT("sv_nsversion") < 323.0f); + if (oldshotty) + { + this->m_pPlayer->FireBulletsPlayer(10, vecSrc, vecAiming, this->GetProjectileSpread(), this->mRange, BULLET_PLAYER_BUCKSHOT, 0, 17, 0, this->m_pPlayer->random_seed); + } + else + { + this->m_pPlayer->FireBulletsPlayer(BALANCE_VAR(kSGBulletsPerShot), vecSrc, vecAiming, this->GetProjectileSpread(), this->mRange, BULLET_PLAYER_BUCKSHOT, 0, theDamage, 0, this->m_pPlayer->random_seed); + } } bool AvHSonicGun::GetHasMuzzleFlash() const diff --git a/main/source/mod/AvHTitles.h b/main/source/mod/AvHTitles.h index 7169f03d..38a066d5 100644 --- a/main/source/mod/AvHTitles.h +++ b/main/source/mod/AvHTitles.h @@ -92,6 +92,7 @@ #define kNeedThreeHivesForStructure "NeedThreeHivesForStructure" #define kNeedsAnotherHiveForStructure "NeedsAnotherHiveForStructure" #define kMustBeBuilder "MustBeBuilder" +#define kMustBeStarted "MustBeStarted" #define kUpgradeNotAvailable "UpgradeNotAvailable" #define kTooManyStructuresInArea "TooManyStructuresInArea" #define kTooManyStructuresOfThisTypeNearby "TooManyStructuresOfThisTypeNearby" diff --git a/main/source/pm_shared/pm_shared.cpp b/main/source/pm_shared/pm_shared.cpp index 912a96e7..0e827e34 100644 --- a/main/source/pm_shared/pm_shared.cpp +++ b/main/source/pm_shared/pm_shared.cpp @@ -6339,6 +6339,8 @@ void PM_Jetpack() bool theIsDevoured = GetHasUpgrade(pmove->iuser4, MASK_DIGESTING); // Turn off jetpack by default gIsJetpacking[pmove->player_index] = false; + + bool newjp = atoi(pmove->PM_Info_ValueForKey(pmove->physinfo, "jp")); if(!pmove->dead && theHasJetpackUpgrade && !theIsDevoured) { @@ -6376,10 +6378,18 @@ void PM_Jetpack() // Old lateral jetpack code - acceleration scales with framerate //pmove->velocity[0] += (theWishVelocity[0]/pmove->clientmaxspeed)*kJetpackLateralScalar; //pmove->velocity[1] += (theWishVelocity[1]/pmove->clientmaxspeed)*kJetpackLateralScalar; - - pmove->velocity[0] += (theWishVelocity[0] / pmove->clientmaxspeed) * (theTimePassed * theWeightScalar*kJetpackForce); - pmove->velocity[1] += (theWishVelocity[1] / pmove->clientmaxspeed) * (theTimePassed * theWeightScalar*kJetpackForce); - pmove->velocity[2] += theTimePassed*theWeightScalar*kJetpackForce; + if (!newjp) + { + pmove->velocity[0] += (theWishVelocity[0]/pmove->clientmaxspeed)*12.0f; + pmove->velocity[1] += (theWishVelocity[1]/pmove->clientmaxspeed)*12.0f; + pmove->velocity[2] += theTimePassed * theWeightScalar*kJetpackForce; + } + else + { + pmove->velocity[0] += (theWishVelocity[0] / pmove->clientmaxspeed) * (theTimePassed * theWeightScalar*kJetpackForce); + pmove->velocity[1] += (theWishVelocity[1] / pmove->clientmaxspeed) * (theTimePassed * theWeightScalar*kJetpackForce); + pmove->velocity[2] += theTimePassed*theWeightScalar*kJetpackForce; + } //FPS independent jetpack event. Scales with FPS without timer. JpEventTimer += pmove->cmd.msec; diff --git a/main/source/util/Balance.txt b/main/source/util/Balance.txt index df0b22de..0a0b1203 100644 --- a/main/source/util/Balance.txt +++ b/main/source/util/Balance.txt @@ -121,7 +121,7 @@ #define kGameHDSpaceNeeded 300 #define kGameVersionMajor 3 #define kGameVersionMinor 2 -#define kGameVersionRevision 2 +#define kGameVersionRevision 3 #define kGestateBaseArmor 150 #define kGestateHealth 200 #define kGorgeArmorUpgrade 50 @@ -246,8 +246,8 @@ #define kResourceTowerBuildTime 15 #define kResourceTowerCost 15 #define kResourceTowerHealth 5500 -#define kSGBulletsPerShot 10 -#define kSGDamage 17 +#define kSGBulletsPerShot 17 +#define kSGDamage 10 #define kSGMaxAmmo 40 #define kSGMaxClip 8 #define kScanDuration 10 diff --git a/main/titles.txt b/main/titles.txt index abf90c05..7ca01ed3 100644 --- a/main/titles.txt +++ b/main/titles.txt @@ -1576,6 +1576,11 @@ MustBeBuilder You must be a Gorge to build this structure. } +MustBeStarted +{ +The game must be started to build this structure. +} + UpgradeNotAvailable { This upgrade isn't available at this time.