diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cfa836fee..b4e807929 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,14 +58,13 @@ jobs: move msvc\${{ env.buildRelease }}\mp.pdb publish\debug\mp.pdb - name: Deploy artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3.1.1 with: name: win32 path: publish/* testdemos: - if: false # TODO: FIXME!! - name: 'Test demos (FIXME)' + name: 'Test demos' runs-on: ubuntu-20.04 container: s1lentq/testdemos:latest needs: [windows] @@ -73,6 +72,7 @@ jobs: env: WINEDEBUG: -all WINEDLLOVERRIDES: mshtml= + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true defaults: run: @@ -81,7 +81,7 @@ jobs: steps: - name: Deploying windows artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: win32 @@ -146,12 +146,11 @@ jobs: run: | sudo dpkg --add-architecture i386 sudo apt-get update - sudo apt-get install -y clang sudo apt-get install -y gcc-multilib g++-multilib - name: Build and Run unittests run: | - rm -rf build && CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Unittests -B build && cmake --build build -j8 + rm -rf build && CC=gcc CXX=g++ cmake -DCMAKE_BUILD_TYPE=Unittests -B build && cmake --build build -j8 retVal=0 ./build/regamedll/cs 2> /dev/null > result.log || retVal=$? while read line; do @@ -172,9 +171,9 @@ jobs: fi shell: bash - - name: Build using Clang C++ Compiler + - name: Build run: | - rm -rf build && CC=clang CXX=clang++ cmake -B build && cmake --build build -j8 + rm -rf build && CC=gcc CXX=g++ cmake -B build && cmake --build build -j8 - name: Prepare CSSDK run: | @@ -200,7 +199,7 @@ jobs: shell: bash - name: Deploy artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3.1.1 id: upload-job with: name: linux32 @@ -219,12 +218,12 @@ jobs: steps: - name: Deploying linux artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: name: linux32 - name: Deploying windows artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: name: win32 diff --git a/regamedll/dlls/cbase.cpp b/regamedll/dlls/cbase.cpp index ebfd2fdc2..5be847bdc 100644 --- a/regamedll/dlls/cbase.cpp +++ b/regamedll/dlls/cbase.cpp @@ -1598,6 +1598,30 @@ void OnFreeEntPrivateData(edict_t *pEnt) if (!pEntity) return; +#ifdef REGAMEDLL_FIXES + // FIXED: Ensure this item will be removed from the owner player's inventory 'm_rgpPlayerItems[]' + // to avoid dangling pointers + CBasePlayerItem *pItem = dynamic_cast(pEntity); + if (pItem) + { + CBasePlayer *pOwner = GET_PRIVATE(pItem->pev->owner); + if (pOwner && pOwner->IsPlayer()) + { + if (pOwner->m_pActiveItem == pItem && pItem->IsWeapon()) + ((CBasePlayerWeapon *)pItem)->RetireWeapon(); + + if (pOwner->RemovePlayerItem(pItem)) + { + // Ammo must be dropped, otherwise grenades cannot be buy or picked up + if (IsGrenadeWeapon(pItem->m_iId) || pItem->m_iId == WEAPON_C4) + pOwner->m_rgAmmo[pItem->PrimaryAmmoIndex()] = 0; + + pOwner->pev->weapons &= ~(1 << pItem->m_iId); + } + } + } +#endif + #ifdef REGAMEDLL_API pEntity->OnDestroy(); #endif diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index e1b8a7e4e..8ba46556d 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -4293,7 +4293,7 @@ int CHalfLifeMultiplay::ItemShouldRespawn(CItem *pItem) // At what time in the future may this Item respawn? float CHalfLifeMultiplay::FlItemRespawnTime(CItem *pItem) { -#ifdef REGAMEDLL_ADD; +#ifdef REGAMEDLL_ADD return gpGlobals->time + item_respawn_time.value; #else return gpGlobals->time + ITEM_RESPAWN_TIME; diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index d56f02545..705e24810 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -6778,6 +6778,26 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse) break; } +#ifdef REGAMEDLL_ADD + // noclip with air acceleration + case 200: + { + if (pev->movetype == MOVETYPE_WALK) + { + pev->movetype = MOVETYPE_NOCLIP; + pev->fuser3 = MAX_PLAYER_RUN_MODIFIER_SPEED; // air acceleration increases xN times + ALERT(at_console, "noclip ON\n"); + } + else + { + pev->movetype = MOVETYPE_WALK; + pev->fuser3 = 0; + ALERT(at_console, "noclip OFF\n"); + } + + break; + } +#endif case 202: { // Random blood splatter diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index d3d37d3ea..182c4a379 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -58,9 +58,10 @@ const int MAX_BUFFER_MENU_BRIEFING = 50; const float SUIT_UPDATE_TIME = 3.5f; const float SUIT_FIRST_UPDATE_TIME = 0.1f; -const float MAX_PLAYER_FATAL_FALL_SPEED = 1100.0f; -const float MAX_PLAYER_SAFE_FALL_SPEED = 500.0f; -const float MAX_PLAYER_USE_RADIUS = 64.0f; +const float MAX_PLAYER_FATAL_FALL_SPEED = 1100.0f; +const float MAX_PLAYER_SAFE_FALL_SPEED = 500.0f; +const float MAX_PLAYER_USE_RADIUS = 64.0f; +const float MAX_PLAYER_RUN_MODIFIER_SPEED = 10.0f; // x10 speed run when IN_RUN button is pressed const float ARMOR_RATIO = 0.5f; // Armor Takes 50% of the damage const float ARMOR_BONUS = 0.5f; // Each Point of Armor is work 1/x points of health diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 9f1765418..9a3d8e0c0 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -724,6 +724,41 @@ LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayerWeapon, KickBack, (float up_base, float la void EXT_FUNC CBasePlayerWeapon::__API_HOOK(KickBack)(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change) { +#ifdef REGAMEDLL_ADD + real_t flKickUp = up_base; + float flKickLateral = lateral_base; + + if (m_iShotsFired > 1) // consider == 0 case + { + flKickUp += m_iShotsFired * up_modifier; + flKickLateral += m_iShotsFired * lateral_modifier; + } + + if (up_max == 0.0f) // boundaryless vertical kick + { + m_pPlayer->pev->punchangle.x -= flKickUp; + } + else if (m_pPlayer->pev->punchangle.x > -up_max) // do not kick when already out of boundaries + { + m_pPlayer->pev->punchangle.x = Q_max(m_pPlayer->pev->punchangle.x - flKickUp, -up_max); + } + + if (lateral_max == 0.0f) // boundaryless horizontal kick + { + m_pPlayer->pev->punchangle.y += flKickLateral * (m_iDirection * 2 - 1); + } + else if (Q_fabs(m_pPlayer->pev->punchangle.y) < lateral_max) // do not kick when already out of boundaries + { + m_pPlayer->pev->punchangle.y = (m_iDirection == 1) ? + Q_min(m_pPlayer->pev->punchangle.y + flKickLateral, lateral_max) : + Q_max(m_pPlayer->pev->punchangle.y - flKickLateral, -lateral_max); + } + + if (direction_change > 0 && !RANDOM_LONG(0, direction_change)) // be sure to not waste RNG consumption + { + m_iDirection = !m_iDirection; + } +#else real_t flKickUp; float flKickLateral; @@ -764,6 +799,7 @@ void EXT_FUNC CBasePlayerWeapon::__API_HOOK(KickBack)(float up_base, float later { m_iDirection = !m_iDirection; } +#endif } void CBasePlayerWeapon::FireRemaining(int &shotsFired, float &shootTime, BOOL bIsGlock) diff --git a/regamedll/dlls/wpn_shared/wpn_awp.cpp b/regamedll/dlls/wpn_shared/wpn_awp.cpp index 0e31bd548..3cf4e437e 100644 --- a/regamedll/dlls/wpn_shared/wpn_awp.cpp +++ b/regamedll/dlls/wpn_shared/wpn_awp.cpp @@ -189,7 +189,11 @@ void CAWP::AWPFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) } m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; +#ifdef REGAMEDLL_ADD + KickBack(2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); +#else m_pPlayer->pev->punchangle.x -= 2.0f; +#endif } void CAWP::Reload() diff --git a/regamedll/dlls/wpn_shared/wpn_deagle.cpp b/regamedll/dlls/wpn_shared/wpn_deagle.cpp index 7dbed0c6b..e9bbc7132 100644 --- a/regamedll/dlls/wpn_shared/wpn_deagle.cpp +++ b/regamedll/dlls/wpn_shared/wpn_deagle.cpp @@ -177,7 +177,11 @@ void CDEAGLE::DEAGLEFire(float flSpread, float flCycleTime, BOOL fUseSemi) } m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8f; +#ifdef REGAMEDLL_ADD + KickBack(2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); +#else m_pPlayer->pev->punchangle.x -= 2; +#endif ResetPlayerShieldAnim(); } diff --git a/regamedll/dlls/wpn_shared/wpn_elite.cpp b/regamedll/dlls/wpn_shared/wpn_elite.cpp index 05428d8ed..845b5f278 100644 --- a/regamedll/dlls/wpn_shared/wpn_elite.cpp +++ b/regamedll/dlls/wpn_shared/wpn_elite.cpp @@ -200,7 +200,11 @@ void CELITE::ELITEFire(float flSpread, float flCycleTime, BOOL fUseSemi) } m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; +#ifdef REGAMEDLL_ADD + KickBack(2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); +#else m_pPlayer->pev->punchangle.x -= 2.0f; +#endif } void CELITE::Reload() diff --git a/regamedll/dlls/wpn_shared/wpn_fiveseven.cpp b/regamedll/dlls/wpn_shared/wpn_fiveseven.cpp index 31f211f08..4f07b840e 100644 --- a/regamedll/dlls/wpn_shared/wpn_fiveseven.cpp +++ b/regamedll/dlls/wpn_shared/wpn_fiveseven.cpp @@ -176,7 +176,11 @@ void CFiveSeven::FiveSevenFire(float flSpread, float flCycleTime, BOOL fUseSemi) } m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; +#ifdef REGAMEDLL_ADD + KickBack(2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); +#else m_pPlayer->pev->punchangle.x -= 2.0f; +#endif ResetPlayerShieldAnim(); } diff --git a/regamedll/dlls/wpn_shared/wpn_g3sg1.cpp b/regamedll/dlls/wpn_shared/wpn_g3sg1.cpp index 5351d0f78..b7e36b09f 100644 --- a/regamedll/dlls/wpn_shared/wpn_g3sg1.cpp +++ b/regamedll/dlls/wpn_shared/wpn_g3sg1.cpp @@ -185,8 +185,15 @@ void CG3SG1::G3SG1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8f; +#ifdef REGAMEDLL_ADD + m_iDirection = 1; // force positive Y addition + KickBack(UTIL_SharedRandomFloat(m_pPlayer->random_seed + 4, 0.75, 1.75) + m_pPlayer->pev->punchangle.x * 0.25f, + UTIL_SharedRandomFloat(m_pPlayer->random_seed + 5, -0.75, 0.75), + 0.0, 0.0, 0.0, 0.0, 0); +#else m_pPlayer->pev->punchangle.x -= UTIL_SharedRandomFloat(m_pPlayer->random_seed + 4, 0.75, 1.75) + m_pPlayer->pev->punchangle.x * 0.25f; m_pPlayer->pev->punchangle.y += UTIL_SharedRandomFloat(m_pPlayer->random_seed + 5, -0.75, 0.75); +#endif } void CG3SG1::Reload() diff --git a/regamedll/dlls/wpn_shared/wpn_glock18.cpp b/regamedll/dlls/wpn_shared/wpn_glock18.cpp index c2f5399d5..b879ef858 100644 --- a/regamedll/dlls/wpn_shared/wpn_glock18.cpp +++ b/regamedll/dlls/wpn_shared/wpn_glock18.cpp @@ -253,6 +253,9 @@ void CGLOCK18::GLOCK18Fire(float flSpread, float flCycleTime, BOOL bFireBurst) m_flGlock18Shoot = gpGlobals->time + 0.1f; } +#ifdef REGAMEDLL_ADD + KickBack(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); // dummy call, API useful +#endif ResetPlayerShieldAnim(); } diff --git a/regamedll/dlls/wpn_shared/wpn_m3.cpp b/regamedll/dlls/wpn_shared/wpn_m3.cpp index 3251ae9a1..64ad7c5f0 100644 --- a/regamedll/dlls/wpn_shared/wpn_m3.cpp +++ b/regamedll/dlls/wpn_shared/wpn_m3.cpp @@ -167,10 +167,17 @@ void CM3::PrimaryAttack() m_fInSpecialReload = 0; +#ifdef REGAMEDLL_ADD + if (m_pPlayer->pev->flags & FL_ONGROUND) + KickBack(UTIL_SharedRandomLong(m_pPlayer->random_seed + 1, 4, 6), 0.0, 0.0, 0.0, 0.0, 0.0, 0); + else + KickBack(UTIL_SharedRandomLong(m_pPlayer->random_seed + 1, 8, 11), 0.0, 0.0, 0.0, 0.0, 0.0, 0); +#else if (m_pPlayer->pev->flags & FL_ONGROUND) m_pPlayer->pev->punchangle.x -= UTIL_SharedRandomLong(m_pPlayer->random_seed + 1, 4, 6); else m_pPlayer->pev->punchangle.x -= UTIL_SharedRandomLong(m_pPlayer->random_seed + 1, 8, 11); +#endif m_pPlayer->m_flEjectBrass = gpGlobals->time + 0.45f; } diff --git a/regamedll/dlls/wpn_shared/wpn_p228.cpp b/regamedll/dlls/wpn_shared/wpn_p228.cpp index b64f5fcf3..1343671cb 100644 --- a/regamedll/dlls/wpn_shared/wpn_p228.cpp +++ b/regamedll/dlls/wpn_shared/wpn_p228.cpp @@ -176,7 +176,11 @@ void CP228::P228Fire(float flSpread, float flCycleTime, BOOL fUseSemi) } m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; +#ifdef REGAMEDLL_ADD + KickBack(2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); +#else m_pPlayer->pev->punchangle.x -= 2; +#endif ResetPlayerShieldAnim(); } diff --git a/regamedll/dlls/wpn_shared/wpn_scout.cpp b/regamedll/dlls/wpn_shared/wpn_scout.cpp index fd9456624..ec7c1a196 100644 --- a/regamedll/dlls/wpn_shared/wpn_scout.cpp +++ b/regamedll/dlls/wpn_shared/wpn_scout.cpp @@ -181,7 +181,11 @@ void CSCOUT::SCOUTFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) } m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8f; +#ifdef REGAMEDLL_ADD + KickBack(2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); +#else m_pPlayer->pev->punchangle.x -= 2.0f; +#endif } void CSCOUT::Reload() diff --git a/regamedll/dlls/wpn_shared/wpn_sg550.cpp b/regamedll/dlls/wpn_shared/wpn_sg550.cpp index 8263e98a8..efad9e082 100644 --- a/regamedll/dlls/wpn_shared/wpn_sg550.cpp +++ b/regamedll/dlls/wpn_shared/wpn_sg550.cpp @@ -188,8 +188,15 @@ void CSG550::SG550Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.8f; +#ifdef REGAMEDLL_ADD + m_iDirection = 1; // force positive Y addition + KickBack(UTIL_SharedRandomFloat(m_pPlayer->random_seed + 4, 0.75, 1.75) + m_pPlayer->pev->punchangle.x * 0.25, + UTIL_SharedRandomFloat(m_pPlayer->random_seed + 5, -0.75, 0.75), + 0.0, 0.0, 0.0, 0.0, 0); +#else m_pPlayer->pev->punchangle.x -= UTIL_SharedRandomFloat(m_pPlayer->random_seed + 4, 0.75, 1.25) + m_pPlayer->pev->punchangle.x * 0.25; m_pPlayer->pev->punchangle.y += UTIL_SharedRandomFloat(m_pPlayer->random_seed + 5, -0.75, 0.75); +#endif } void CSG550::Reload() diff --git a/regamedll/dlls/wpn_shared/wpn_usp.cpp b/regamedll/dlls/wpn_shared/wpn_usp.cpp index 0d830d690..5a474f652 100644 --- a/regamedll/dlls/wpn_shared/wpn_usp.cpp +++ b/regamedll/dlls/wpn_shared/wpn_usp.cpp @@ -239,7 +239,11 @@ void CUSP::USPFire(float flSpread, float flCycleTime, BOOL fUseSemi) } m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; +#ifdef REGAMEDLL_ADD + KickBack(2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0); +#else m_pPlayer->pev->punchangle.x -= 2.0f; +#endif ResetPlayerShieldAnim(); } diff --git a/regamedll/dlls/wpn_shared/wpn_xm1014.cpp b/regamedll/dlls/wpn_shared/wpn_xm1014.cpp index ec7a01dee..a4e4304eb 100644 --- a/regamedll/dlls/wpn_shared/wpn_xm1014.cpp +++ b/regamedll/dlls/wpn_shared/wpn_xm1014.cpp @@ -166,10 +166,17 @@ void CXM1014::PrimaryAttack() m_fInSpecialReload = 0; +#ifdef REGAMEDLL_ADD + if (m_pPlayer->pev->flags & FL_ONGROUND) + KickBack(UTIL_SharedRandomLong(m_pPlayer->random_seed + 1, 3, 5), 0.0, 0.0, 0.0, 0.0, 0.0, 0); + else + KickBack(UTIL_SharedRandomLong(m_pPlayer->random_seed + 1, 7, 10), 0.0, 0.0, 0.0, 0.0, 0.0, 0); +#else if (m_pPlayer->pev->flags & FL_ONGROUND) m_pPlayer->pev->punchangle.x -= UTIL_SharedRandomLong(m_pPlayer->random_seed + 1, 3, 5); else m_pPlayer->pev->punchangle.x -= UTIL_SharedRandomLong(m_pPlayer->random_seed + 1, 7, 10); +#endif } void CXM1014::Reload() diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index b40495569..d90206bc5 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -870,7 +870,7 @@ void PM_WalkMove() vec3_t wishvel; real_t spd; - float fmove, smove; + float fmove, smove, maxspeed; vec3_t wishdir; real_t wishspeed; @@ -882,6 +882,7 @@ void PM_WalkMove() pmtrace_t trace; + // jump penalty if (pmove->fuser2 > 0.0) { real_t flRatio = (100 - pmove->fuser2 * 0.001 * 19) * 0.01; @@ -893,6 +894,17 @@ void PM_WalkMove() // Copy movement amounts fmove = pmove->cmd.forwardmove; smove = pmove->cmd.sidemove; + maxspeed = pmove->maxspeed; + +#ifdef REGAMEDLL_ADD + // Player can speed up the run if '+speed' button is pressed + if ((pmove->cmd.buttons & IN_RUN) && pmove->fuser3 > 0) + { + fmove *= pmove->fuser3; + smove *= pmove->fuser3; + maxspeed *= 2.0f; // increase speed cap to x2 when running + } +#endif // Zero out z components of movement vectors pmove->forward[2] = 0; @@ -916,10 +928,10 @@ void PM_WalkMove() wishspeed = VectorNormalize(wishdir); // Clamp to server defined max speed - if (wishspeed > pmove->maxspeed) + if (wishspeed > maxspeed) { - VectorScale(wishvel, pmove->maxspeed / wishspeed, wishvel); - wishspeed = pmove->maxspeed; + VectorScale(wishvel, maxspeed / wishspeed, wishvel); + wishspeed = maxspeed; } // Set pmove velocity @@ -1636,7 +1648,7 @@ void PM_SpectatorMove() real_t accelspeed; int i; vec3_t wishvel; - float fmove, smove; + float fmove, smove, spectatormaxspeed; vec3_t wishdir; real_t wishspeed; @@ -1688,6 +1700,19 @@ void PM_SpectatorMove() fmove = pmove->cmd.forwardmove; smove = pmove->cmd.sidemove; + spectatormaxspeed = pmove->movevars->spectatormaxspeed; + +#ifdef REGAMEDLL_ADD + // Observer can accelerate in air if '+speed' button is pressed + if (pmove->cmd.buttons & IN_RUN) + { + float flAirAccelerate = (pmove->fuser3 > 0.0f) ? pmove->fuser3 : max(pmove->movevars->airaccelerate / 100.0f, 7.0f); + fmove *= flAirAccelerate; + smove *= flAirAccelerate; + spectatormaxspeed *= 2.0f; // increase speed cap to x2 when accelerating + } +#endif + VectorNormalize(pmove->forward); VectorNormalize(pmove->right); @@ -1702,29 +1727,33 @@ void PM_SpectatorMove() wishspeed = VectorNormalize(wishdir); // clamp to server defined max speed - if (wishspeed > pmove->movevars->spectatormaxspeed) + if (wishspeed > spectatormaxspeed) { - VectorScale(wishvel, pmove->movevars->spectatormaxspeed / wishspeed, wishvel); - wishspeed = pmove->movevars->spectatormaxspeed; + VectorScale(wishvel, spectatormaxspeed / wishspeed, wishvel); + wishspeed = spectatormaxspeed; } currentspeed = DotProduct(pmove->velocity, wishdir); addspeed = wishspeed - currentspeed; + +#ifndef REGAMEDLL_FIXES if (addspeed <= 0) - { return; - } - - accelspeed = pmove->movevars->accelerate * pmove->frametime * wishspeed; - if (accelspeed > addspeed) +#else + if (addspeed > 0) +#endif { - accelspeed = addspeed; - } + accelspeed = pmove->movevars->accelerate * pmove->frametime * wishspeed; + if (accelspeed > addspeed) + { + accelspeed = addspeed; + } - for (i = 0; i < 3; i++) - { - pmove->velocity[i] += accelspeed * wishdir[i]; + for (i = 0; i < 3; i++) + { + pmove->velocity[i] += accelspeed * wishdir[i]; + } } // move @@ -1902,8 +1931,8 @@ void EXT_FUNC __API_HOOK(PM_Duck)() } #ifdef REGAMEDLL_ADD - if ((pmove->iuser3 & PLAYER_PREVENT_DUCK) == PLAYER_PREVENT_DUCK // Prevent ducking if the iuser3 variable is contain PLAYER_PREVENT_DUCK - || freezetime_duck.value == 0.0f && CSGameRules()->IsFreezePeriod()) // Prevent ducking during freezetime if the freezetime_duck cvar is 0 + if ((pmove->iuser3 & PLAYER_PREVENT_DUCK) == PLAYER_PREVENT_DUCK // Prevent ducking if the iuser3 variable is contain PLAYER_PREVENT_DUCK + || (freezetime_duck.value == 0.0f && CSGameRules()->IsFreezePeriod())) // Prevent ducking during freezetime if the freezetime_duck cvar is 0 { // Try to unduck if (pmove->flags & FL_DUCKING) @@ -2334,6 +2363,16 @@ void PM_NoClip() fmove = pmove->cmd.forwardmove; smove = pmove->cmd.sidemove; +#ifdef REGAMEDLL_ADD + // Player with noclip can accelerate in air if '+speed' button is pressed + if ((pmove->cmd.buttons & IN_RUN) && pmove->fuser3 > 0) + { + float flAirAccelerate = pmove->fuser3; + fmove *= flAirAccelerate; + smove *= flAirAccelerate; + } +#endif + VectorNormalize(pmove->forward); VectorNormalize(pmove->right); @@ -2458,8 +2497,8 @@ void EXT_FUNC __API_HOOK(PM_Jump)() } #ifdef REGAMEDLL_ADD - if ((pmove->iuser3 & PLAYER_PREVENT_JUMP) == PLAYER_PREVENT_JUMP // Prevent jumping if the iuser3 variable is contain PLAYER_PREVENT_JUMP - || freezetime_jump.value == 0.0f && CSGameRules()->IsFreezePeriod()) // Prevent jumping during freezetime if the freezetime_jump cvar is 0 + if ((pmove->iuser3 & PLAYER_PREVENT_JUMP) == PLAYER_PREVENT_JUMP // Prevent jumping if the iuser3 variable is contain PLAYER_PREVENT_JUMP + || (freezetime_jump.value == 0.0f && CSGameRules()->IsFreezePeriod())) // Prevent jumping during freezetime if the freezetime_jump cvar is 0 { return; } diff --git a/regamedll/public/tier0/dbg.cpp b/regamedll/public/tier0/dbg.cpp index 35c99fe38..b9bade819 100644 --- a/regamedll/public/tier0/dbg.cpp +++ b/regamedll/public/tier0/dbg.cpp @@ -141,7 +141,7 @@ SpewRetval_t _SpewMessageV(SpewType_t spewType, int level, const char *pMsgForma assert(len < sizeof(szTempBuffer)); // Add \n for warning and assert - if ((spewType == SPEW_ASSERT)) + if (spewType == SPEW_ASSERT) { len += Q_snprintf(&szTempBuffer[len], sizeof(szTempBuffer) - len, "\n"); Plat_OutputDebugString(szTempBuffer);