diff --git a/mp/src/game/server/buttons.cpp b/mp/src/game/server/buttons.cpp index af46d0c4c6..0d8ccc224c 100644 --- a/mp/src/game/server/buttons.cpp +++ b/mp/src/game/server/buttons.cpp @@ -20,17 +20,6 @@ void PlayLockSounds( CBaseEntity *pEdict, locksound_t *pls, int flocked, int fbutton ); string_t MakeButtonSound( int sound ); // get string of button sound number - -#define SF_BUTTON_DONTMOVE 1 -#define SF_ROTBUTTON_NOTSOLID 1 -#define SF_BUTTON_TOGGLE 32 // button stays pushed until reactivated -#define SF_BUTTON_TOUCH_ACTIVATES 256 // Button fires when touched. -#define SF_BUTTON_DAMAGE_ACTIVATES 512 // Button fires when damaged. -#define SF_BUTTON_USE_ACTIVATES 1024 // Button fires when used. -#define SF_BUTTON_LOCKED 2048 // Whether the button is initially locked. -#define SF_BUTTON_SPARK_IF_OFF 4096 // button sparks in OFF state -#define SF_BUTTON_JIGGLE_ON_USE_LOCKED 8192 // whether to jiggle if someone uses us when we're locked - BEGIN_DATADESC( CBaseButton ) DEFINE_KEYFIELD( m_vecMoveDir, FIELD_VECTOR, "movedir" ), diff --git a/mp/src/game/server/buttons.h b/mp/src/game/server/buttons.h index c78a8652db..fe0abb3c7d 100644 --- a/mp/src/game/server/buttons.h +++ b/mp/src/game/server/buttons.h @@ -10,6 +10,17 @@ #pragma once #endif +#include + +#define SF_BUTTON_DONTMOVE 1 +#define SF_ROTBUTTON_NOTSOLID 1 +#define SF_BUTTON_TOGGLE 32 // button stays pushed until reactivated +#define SF_BUTTON_TOUCH_ACTIVATES 256 // Button fires when touched. +#define SF_BUTTON_DAMAGE_ACTIVATES 512 // Button fires when damaged. +#define SF_BUTTON_USE_ACTIVATES 1024 // Button fires when used. +#define SF_BUTTON_LOCKED 2048 // Whether the button is initially locked. +#define SF_BUTTON_SPARK_IF_OFF 4096 // button sparks in OFF state +#define SF_BUTTON_JIGGLE_ON_USE_LOCKED 8192 // whether to jiggle if someone uses us when we're locked class CBaseButton : public CBaseToggle { diff --git a/mp/src/game/server/momentum/mom_blockfix.cpp b/mp/src/game/server/momentum/mom_blockfix.cpp new file mode 100644 index 0000000000..5c43cd7a45 --- /dev/null +++ b/mp/src/game/server/momentum/mom_blockfix.cpp @@ -0,0 +1,146 @@ +#include "cbase.h" +#include "mom_blockfix.h" + +#include "tier0/memdbgon.h" + +void CMOMBhopBlockFixSystem::FindBhopBlocks() +{ + SetDefLessFunc(m_mapBlocks); + // ---- func_door ---- + CBaseEntity *ent = NULL; + while ((ent = gEntList.FindEntityByClassname(ent, "func_door")) != NULL) + { + CBaseDoor *pEntDoor = static_cast(ent); + + Vector startpos(pEntDoor->m_vecPosition1); + Vector endpos(pEntDoor->m_vecPosition2); + + if (startpos.z > endpos.z) + { + FindTeleport(pEntDoor, true); + + if (m_mapBlocks.Count() == MAX_BHOPBLOCKS) + break; + } + } + ent = NULL; + + // ---- func_button ---- + while ((ent = gEntList.FindEntityByClassname(ent, "func_button")) != NULL) + { + CBaseButton *pEntButton = static_cast(ent); + Vector startpos(pEntButton->m_vecPosition1); + Vector endpos(pEntButton->m_vecPosition2); + + if (startpos.z > endpos.z && (pEntButton->HasSpawnFlags(SF_BUTTON_TOUCH_ACTIVATES))) + { + FindTeleport(pEntButton, false); + + if (m_mapBlocks.Count() == MAX_BHOPBLOCKS) + break; + } + } +} +void CMOMBhopBlockFixSystem::AlterBhopBlock(bhop_block_t block) +{ + if (block.m_bIsDoor) + { + // And now the settings begin + CBaseDoor *pDoorEnt = static_cast(block.m_pBlockEntity); //(block.m_hBlockEntity.Get()); + + pDoorEnt->m_vecPosition2 = pDoorEnt->m_vecPosition1; // Set the end position to start (not allowed to move) + + pDoorEnt->m_flSpeed = 0.0; // set speed to 0 (further not allowed to move) + + pDoorEnt->ClearSpawnFlags(); + pDoorEnt->AddSpawnFlags(SF_DOOR_PTOUCH); // Player touch affects this + + variant_t emptyvarient; + pDoorEnt->AcceptInput("Lock", NULL, NULL, emptyvarient, 0); // Lock the door bhop block + + pDoorEnt->m_ls.sLockedSound = + pDoorEnt->m_NoiseMoving; // Plays the sound like normal (makes the player aware they jumped it) + } + else + { // func_button block + + CBaseButton *pEntButton = static_cast(block.m_pBlockEntity); //(block.m_hBlockEntity.Get()); + pEntButton->m_vecPosition2 = pEntButton->m_vecPosition1; + + pEntButton->m_flSpeed = 0.0f; + pEntButton->ClearSpawnFlags(); + + pEntButton->AddSpawnFlags(SF_BUTTON_DONTMOVE | SF_BUTTON_TOUCH_ACTIVATES); + } +} + +void CMOMBhopBlockFixSystem::PlayerTouch(CBaseEntity *pPlayerEnt, CBaseEntity *pBlock) +{ + CMomentumPlayer *pPlayer = static_cast(pPlayerEnt); + float diff = gpGlobals->curtime - pPlayer->GetPunishTime(); + + if (pPlayer->GetLastBlock() != pBlock->entindex() || diff > BLOCK_COOLDOWN) + { + pPlayer->SetLastBlock(pBlock->entindex()); + pPlayer->SetPunishTime(gpGlobals->curtime + BLOCK_TELEPORT); + } + else if (diff > BLOCK_TELEPORT) // We need to teleport the player. + { + int idx = m_mapBlocks.Find(pBlock->entindex()); + if (m_mapBlocks.IsValidIndex(idx)) + { + CBaseEntity *pEntTeleport = m_mapBlocks.Element(idx).m_pTeleportTrigger; + if (pEntTeleport) + { + pEntTeleport->Touch(pPlayer); + } + } + } +} + +void CMOMBhopBlockFixSystem::FindTeleport(CBaseEntity *pBlockEnt, bool isDoor) +{ + // Create Vectors for the start, stop, and direction + Vector vecAbsStart, vecAbsEnd, vecDir; + + vecDir = Vector(0, 0, -1); // Straight down + + // Get the Start/End + vecAbsStart = pBlockEnt->WorldSpaceCenter(); + // move vector to top of bhop block + vecAbsStart.z += pBlockEnt->WorldAlignMaxs().z; + + // ray is as long as the bhop block is tall + vecAbsEnd = vecAbsStart + (vecDir * (pBlockEnt->WorldAlignMaxs().z - pBlockEnt->WorldAlignMins().z)); + + // Do the TraceLine, and write our results to our trace_t class, tr. + Ray_t ray; + ray.Init(vecAbsStart, vecAbsEnd); + CTeleportTriggerTraceEnum triggerTraceEnum(&ray, pBlockEnt, isDoor); + + enginetrace->EnumerateEntities(ray, true, &triggerTraceEnum); +} +// override of IEntityEnumerator's EnumEntity() for our trigger teleport filter +bool CTeleportTriggerTraceEnum::EnumEntity(IHandleEntity *pHandleEntity) +{ + trace_t tr; + // store entity that we found on the trace + CBaseEntity *pEnt = gEntList.GetBaseEntity(pHandleEntity->GetRefEHandle()); + + // Done to avoid hitting an entity that's both solid & a trigger. + if (pEnt->IsSolid()) + return false; + + enginetrace->ClipRayToEntity(*m_pRay, MASK_ALL, pHandleEntity, &tr); + + if (tr.fraction < 1.0f) // tr.fraction = 1.0 means the trace completed + { + // arguments are initilized in the constructor of CTeleportTriggerTraceEnum + g_MOMBlockFixer->AddBhopBlock(pEntBlock, pEnt, bIsDoor); + return true; + } + return false; +} + +static CMOMBhopBlockFixSystem s_MOMBlockFixer("CMOMBhopBlockFixSystem"); +CMOMBhopBlockFixSystem *g_MOMBlockFixer = &s_MOMBlockFixer; \ No newline at end of file diff --git a/mp/src/game/server/momentum/mom_blockfix.h b/mp/src/game/server/momentum/mom_blockfix.h new file mode 100644 index 0000000000..3c5a0a6b36 --- /dev/null +++ b/mp/src/game/server/momentum/mom_blockfix.h @@ -0,0 +1,73 @@ +#ifndef DOORFIX_H +#define DOORFIX_H +#ifdef _WIN32 +#pragma once +#endif + +#include "buttons.h" +#include "cbase.h" +#include "doors.h" +#include "mom_player.h" + +#define MAX_BHOPBLOCKS 1024 +#define BLOCK_TELEPORT 0.11 +#define BLOCK_COOLDOWN 1.0 + +class CMOMBhopBlockFixSystem : CAutoGameSystem +{ + + public: + CMOMBhopBlockFixSystem(const char *pName) : CAutoGameSystem(pName) {} + + virtual void LevelInitPostEntity() { FindBhopBlocks(); } + + virtual void LevelShutdownPostEntity() { m_mapBlocks.RemoveAll(); } + + bool IsBhopBlock(int entIndex) { return (m_mapBlocks.Find(entIndex) != m_mapBlocks.InvalidIndex()); } + + void PlayerTouch(CBaseEntity *pPlayerEnt, CBaseEntity *pBlock); + + void FindBhopBlocks(); + + void FindTeleport(CBaseEntity *pBlockEnt, bool isDoor); + + void AddBhopBlock(CBaseEntity *pBlockEnt, CBaseEntity *pTeleportEnt, bool isDoor) + { + bhop_block_t block = bhop_block_t(); + block.m_pBlockEntity = pBlockEnt; + block.m_pTeleportTrigger = pTeleportEnt; + block.m_bIsDoor = isDoor; + AlterBhopBlock(block); + m_mapBlocks.Insert(pBlockEnt->entindex(), block); + } + + private: + struct bhop_block_t + { + CBaseEntity *m_pBlockEntity; // func_door or func_button + CBaseEntity *m_pTeleportTrigger; // trigger_teleport under it + bool m_bIsDoor; + }; + CUtlMap m_mapBlocks; + void AlterBhopBlock(bhop_block_t); +}; + +class CTeleportTriggerTraceEnum : public IEntityEnumerator +{ + public: + CTeleportTriggerTraceEnum(Ray_t *pRay, CBaseEntity *block, bool isDoor) + : m_pRay(pRay), pEntBlock(block), bIsDoor(isDoor) + { + } + + virtual bool EnumEntity(IHandleEntity *pHandleEntity); + + private: + bool bIsDoor; + CBaseEntity *pEntBlock; + Ray_t *m_pRay; +}; + +extern CMOMBhopBlockFixSystem *g_MOMBlockFixer; + +#endif // DOORFIX_H \ No newline at end of file diff --git a/mp/src/game/server/momentum/mom_player.cpp b/mp/src/game/server/momentum/mom_player.cpp index 8f0407dea8..a8acfb5b6f 100644 --- a/mp/src/game/server/momentum/mom_player.cpp +++ b/mp/src/game/server/momentum/mom_player.cpp @@ -21,18 +21,16 @@ PRECACHE_REGISTER(player); CMomentumPlayer::CMomentumPlayer() { - + m_flPunishTime = -1; + m_iLastBlock = -1; } -CMomentumPlayer::~CMomentumPlayer() -{ - -} +CMomentumPlayer::~CMomentumPlayer() {} void CMomentumPlayer::Precache() { - // Name of our entity's model -#define ENTITY_MODEL "models/gibs/airboat_broken_engine.mdl" +// Name of our entity's model +#define ENTITY_MODEL "models/gibs/airboat_broken_engine.mdl" PrecacheModel(ENTITY_MODEL); BaseClass::Precache(); @@ -43,32 +41,32 @@ void CMomentumPlayer::Spawn() SetModel(ENTITY_MODEL); BaseClass::Spawn(); AddFlag(FL_GODMODE); - //do this here because we can't get a local player in the timer class + // do this here because we can't get a local player in the timer class ConVarRef gm("mom_gamemode"); switch (gm.GetInt()) { - case MOMGM_BHOP: - case MOMGM_SURF: - case MOMGM_UNKNOWN: - default: - EnableAutoBhop(); - break; - case MOMGM_SCROLL: - DisableAutoBhop(); - break; + case MOMGM_BHOP: + case MOMGM_SURF: + case MOMGM_UNKNOWN: + default: + EnableAutoBhop(); + break; + case MOMGM_SCROLL: + DisableAutoBhop(); + break; } SetThink(&CMomentumPlayer::CheckForBhop); // Pass a function pointer SetNextThink(gpGlobals->curtime); } -void CMomentumPlayer::SurpressLadderChecks(const Vector& pos, const Vector& normal) +void CMomentumPlayer::SurpressLadderChecks(const Vector &pos, const Vector &normal) { m_ladderSurpressionTimer.Start(1.0f); m_lastLadderPos = pos; m_lastLadderNormal = normal; } -bool CMomentumPlayer::CanGrabLadder(const Vector& pos, const Vector& normal) +bool CMomentumPlayer::CanGrabLadder(const Vector &pos, const Vector &normal) { if (m_ladderSurpressionTimer.GetRemainingTime() <= 0.0f) { @@ -89,7 +87,7 @@ bool CMomentumPlayer::CanGrabLadder(const Vector& pos, const Vector& normal) return false; } -CBaseEntity* CMomentumPlayer::EntSelectSpawnPoint() +CBaseEntity *CMomentumPlayer::EntSelectSpawnPoint() { CBaseEntity *pStart; pStart = NULL; @@ -112,7 +110,7 @@ CBaseEntity* CMomentumPlayer::EntSelectSpawnPoint() } } -bool CMomentumPlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pStart) +bool CMomentumPlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity *&pStart) { #define SF_PLAYER_START_MASTER 1 pStart = gEntList.FindEntityByClassname(pStart, pEntClassName); @@ -142,6 +140,15 @@ bool CMomentumPlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &p return false; } + +void CMomentumPlayer::Touch(CBaseEntity *pOther) +{ + BaseClass::Touch(pOther); + + if (g_MOMBlockFixer->IsBhopBlock(pOther->entindex())) + g_MOMBlockFixer->PlayerTouch(this, pOther); +} + void CMomentumPlayer::EnableAutoBhop() { m_bAutoBhop = true; @@ -152,16 +159,13 @@ void CMomentumPlayer::DisableAutoBhop() m_bAutoBhop = false; DevLog("Disabled autobhop\n"); } -bool CMomentumPlayer::HasAutoBhop() -{ - return m_bAutoBhop; -} +bool CMomentumPlayer::HasAutoBhop() { return m_bAutoBhop; } void CMomentumPlayer::CheckForBhop() { if (GetGroundEntity() != NULL) { m_flTicksOnGround += gpGlobals->interval_per_tick; - //true is player is on ground for less than 4 ticks, false if they are on ground for more + // true is player is on ground for less than 10 ticks, false if they are on ground for more s m_bDidPlayerBhop = (m_flTicksOnGround < NUM_TICKS_TO_BHOP * gpGlobals->interval_per_tick) != 0; } else diff --git a/mp/src/game/server/momentum/mom_player.h b/mp/src/game/server/momentum/mom_player.h index a7e4c38456..47d455a630 100644 --- a/mp/src/game/server/momentum/mom_player.h +++ b/mp/src/game/server/momentum/mom_player.h @@ -5,13 +5,13 @@ #endif #include "cbase.h" -#include "player.h" +#include "mom_blockfix.h" #include "momentum/mom_shareddefs.h" +#include "player.h" class CMomentumPlayer : public CBasePlayer { -public: - + public: DECLARE_CLASS(CMomentumPlayer, CBasePlayer); CMomentumPlayer(); @@ -20,7 +20,7 @@ class CMomentumPlayer : public CBasePlayer static CMomentumPlayer *CreatePlayer(const char *className, edict_t *ed) { CMomentumPlayer::s_PlayerEdict = ed; - return (CMomentumPlayer*) CreateEntityByName(className); + return (CMomentumPlayer *)CreateEntityByName(className); } DECLARE_SERVERCLASS(); @@ -29,34 +29,35 @@ class CMomentumPlayer : public CBasePlayer int FlashlightIsOn() { return IsEffectActive(EF_DIMLIGHT); } void FlashlightTurnOn() - { + { AddEffects(EF_DIMLIGHT); - EmitSound("HL2Player.FlashLightOn");//MOM_TODO: change this? + EmitSound("HL2Player.FlashLightOn"); // MOM_TODO: change this? } void FlashlightTurnOff() { RemoveEffects(EF_DIMLIGHT); - EmitSound("HL2Player.FlashLightOff");//MOM_TODO: change this? + EmitSound("HL2Player.FlashLightOff"); // MOM_TODO: change this? } void Spawn(); void Precache(); + void Touch(CBaseEntity *); - virtual void CommitSuicide(bool bExplode = false, bool bForce = false) {}; - virtual void CommitSuicide(const Vector &vecForce, bool bExplode = false, bool bForce = false) {}; + virtual void CommitSuicide(bool bExplode = false, bool bForce = false){}; + virtual void CommitSuicide(const Vector &vecForce, bool bExplode = false, bool bForce = false){}; bool CanBreatheUnderwater() const { return true; } // LADDERS - void SurpressLadderChecks(const Vector& pos, const Vector& normal); - bool CanGrabLadder(const Vector& pos, const Vector& normal); + void SurpressLadderChecks(const Vector &pos, const Vector &normal); + bool CanGrabLadder(const Vector &pos, const Vector &normal); Vector m_lastStandingPos; // used by the gamemovement code for finding ladders - //SPAWNING - CBaseEntity* EntSelectSpawnPoint(); + // SPAWNING + CBaseEntity *EntSelectSpawnPoint(); - //used by CMomentumGameMovement + // used by CMomentumGameMovement bool m_duckUntilOnGround; float m_flStamina; @@ -64,7 +65,7 @@ class CMomentumPlayer : public CBasePlayer void DisableAutoBhop(); bool HasAutoBhop(); bool DidPlayerBhop() { return m_bDidPlayerBhop; } - //think function for detecting if player bhopped + // think function for detecting if player bhopped void CheckForBhop(); CNetworkVar(int, m_iShotsFired); @@ -73,47 +74,35 @@ class CMomentumPlayer : public CBasePlayer CNetworkVar(int, m_iLastZoom); CNetworkVar(bool, m_bAutoBhop); CNetworkVar(bool, m_bDidPlayerBhop); - - - void GetBulletTypeParameters( - int iBulletType, - float &fPenetrationPower, - float &flPenetrationDistance); - - void FireBullet( - Vector vecSrc, - const QAngle &shootAngles, - float vecSpread, - float flDistance, - int iPenetration, - int iBulletType, - int iDamage, - float flRangeModifier, - CBaseEntity *pevAttacker, - bool bDoEffects, - float x, - float y); - - void KickBack( - float up_base, - float lateral_base, - float up_modifier, - float lateral_modifier, - float up_max, - float lateral_max, - int direction_change); - -private: + + void GetBulletTypeParameters(int iBulletType, float &fPenetrationPower, float &flPenetrationDistance); + + void FireBullet(Vector vecSrc, const QAngle &shootAngles, float vecSpread, float flDistance, int iPenetration, + int iBulletType, int iDamage, float flRangeModifier, CBaseEntity *pevAttacker, bool bDoEffects, + float x, float y); + + void KickBack(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, + float lateral_max, int direction_change); + + void SetPunishTime(float newTime) { m_flPunishTime = newTime; } + + void SetLastBlock(int lastBlock) { m_iLastBlock = lastBlock; } + + int GetLastBlock() { return m_iLastBlock; } + float GetPunishTime() { return m_flPunishTime; } + + private: CountdownTimer m_ladderSurpressionTimer; Vector m_lastLadderNormal; Vector m_lastLadderPos; EHANDLE g_pLastSpawn; - bool SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot); + bool SelectSpawnSpot(const char *pEntClassName, CBaseEntity *&pSpot); - //for detecting bhop + // for detecting bhop float m_flTicksOnGround; - const int NUM_TICKS_TO_BHOP = 4; + const int NUM_TICKS_TO_BHOP = 10; friend class CMomentumGameMovement; - + float m_flPunishTime; + int m_iLastBlock; }; -#endif //MOMPLAYER_H \ No newline at end of file +#endif // MOMPLAYER_H \ No newline at end of file diff --git a/mp/src/game/server/momentum/mom_triggers.cpp b/mp/src/game/server/momentum/mom_triggers.cpp index 2666bc30d0..9ad6126fcd 100644 --- a/mp/src/game/server/momentum/mom_triggers.cpp +++ b/mp/src/game/server/momentum/mom_triggers.cpp @@ -1,8 +1,8 @@ #include "cbase.h" #include "Timer.h" +#include "in_buttons.h" #include "mom_triggers.h" #include "movevars_shared.h" -#include "in_buttons.h" #include "tier0/memdbgon.h" @@ -37,16 +37,16 @@ LINK_ENTITY_TO_CLASS(trigger_momentum_timer_start, CTriggerTimerStart); BEGIN_DATADESC(CTriggerTimerStart) DEFINE_KEYFIELD(m_fMaxLeaveSpeed, FIELD_FLOAT, "leavespeed"), DEFINE_KEYFIELD(m_fBhopLeaveSpeed, FIELD_FLOAT, "bhopleavespeed"), -DEFINE_KEYFIELD(m_angLook, FIELD_VECTOR, "lookangles") +DEFINE_KEYFIELD(m_angLook, FIELD_VECTOR, "lookangles") END_DATADESC() void CTriggerTimerStart::EndTouch(CBaseEntity *pOther) { - if (pOther->IsPlayer() && !g_Timer.IsPracticeMode(pOther)) //do not start timer if player is in practice mode. + if (pOther->IsPlayer() && !g_Timer.IsPracticeMode(pOther)) // do not start timer if player is in practice mode. { g_Timer.Start(gpGlobals->tickcount); - if (IsLimitingSpeed()) + if (IsLimitingSpeed()) { Vector velocity = pOther->GetAbsVelocity(); if (IsLimitingSpeedOnlyXY()) @@ -61,16 +61,17 @@ void CTriggerTimerStart::EndTouch(CBaseEntity *pOther) pOther->SetAbsVelocity(Vector(vel2D.x, vel2D.y, velocity.z)); } } - //XYZ limit (this is likely never going to be used, or at least, it shouldn't be) + // XYZ limit (this is likely never going to be used, or at least, it shouldn't be) else { if (velocity.IsLengthGreaterThan((m_bDidPlayerBhop ? m_fBhopLeaveSpeed : m_fMaxLeaveSpeed))) - pOther->SetAbsVelocity(velocity.Normalized() * (m_bDidPlayerBhop ? m_fBhopLeaveSpeed : m_fMaxLeaveSpeed)); + pOther->SetAbsVelocity(velocity.Normalized() * + (m_bDidPlayerBhop ? m_fBhopLeaveSpeed : m_fMaxLeaveSpeed)); } } } - //stop thinking on end touch - SetNextThink(NULL); + // stop thinking on end touch + SetNextThink(-1); BaseClass::EndTouch(pOther); } @@ -82,7 +83,7 @@ void CTriggerTimerStart::StartTouch(CBaseEntity *pOther) g_Timer.Stop(false); g_Timer.DispatchResetMessage(); } - //start thinking + // start thinking SetNextThink(gpGlobals->curtime); BaseClass::StartTouch(pOther); } @@ -97,15 +98,9 @@ void CTriggerTimerStart::Spawn() BaseClass::Spawn(); } -void CTriggerTimerStart::SetMaxLeaveSpeed(float pMaxLeaveSpeed) -{ - m_fMaxLeaveSpeed = abs(pMaxLeaveSpeed); -} +void CTriggerTimerStart::SetMaxLeaveSpeed(float pMaxLeaveSpeed) { m_fMaxLeaveSpeed = abs(pMaxLeaveSpeed); } -void CTriggerTimerStart::SetBhopLeaveSpeed(float pBhopMaxLeaveSpeed) -{ - m_fBhopLeaveSpeed = abs(pBhopMaxLeaveSpeed); -} +void CTriggerTimerStart::SetBhopLeaveSpeed(float pBhopMaxLeaveSpeed) { m_fBhopLeaveSpeed = abs(pBhopMaxLeaveSpeed); } void CTriggerTimerStart::SetIsLimitingSpeed(bool pIsLimitingSpeed) { @@ -178,16 +173,13 @@ void CTriggerTimerStart::SetHasLookAngles(bool bHasLook) } } } -void CTriggerTimerStart::SetLookAngles(QAngle newang) -{ - m_angLook = newang; -} +void CTriggerTimerStart::SetLookAngles(QAngle newang) { m_angLook = newang; } void CTriggerTimerStart::Think() { - //for limit bhop in start zone + // for limit bhop in start zone CMomentumPlayer *pPlayer = ToCMOMPlayer(UTIL_GetLocalPlayer()); - //We don't check for player inside trigger here since the Think() function - //is only called if we are inside (see StartTouch & EndTouch defined above) + // We don't check for player inside trigger here since the Think() function + // is only called if we are inside (see StartTouch & EndTouch defined above) if (pPlayer && IsLimitingBhop()) { if (pPlayer->DidPlayerBhop()) @@ -217,7 +209,7 @@ void CTriggerTimerStop::StartTouch(CBaseEntity *pOther) LINK_ENTITY_TO_CLASS(trigger_momentum_timer_checkpoint, CTriggerCheckpoint); BEGIN_DATADESC(CTriggerCheckpoint) -DEFINE_KEYFIELD(m_iCheckpointNumber, FIELD_INTEGER, "checkpoint"), +DEFINE_KEYFIELD(m_iCheckpointNumber, FIELD_INTEGER, "checkpoint"), END_DATADESC() void CTriggerCheckpoint::StartTouch(CBaseEntity *pOther) @@ -241,14 +233,13 @@ END_DATADESC() bool CFilterCheckpoint::PassesFilterImpl(CBaseEntity *pCaller, CBaseEntity *pEntity) { return (g_Timer.GetCurrentCheckpoint() && - g_Timer.GetCurrentCheckpoint()->GetCheckpointNumber() >= m_iCheckpointNumber); + g_Timer.GetCurrentCheckpoint()->GetCheckpointNumber() >= m_iCheckpointNumber); } //---------------------------------------------------------------------------------------------- //----------- CTriggerTeleport ----------------------------------------------------------------- LINK_ENTITY_TO_CLASS(trigger_momentum_teleport, CTriggerTeleportEnt); - BEGIN_DATADESC(CTriggerTeleportEnt) DEFINE_KEYFIELD(m_bResetVelocity, FIELD_BOOLEAN, "stop"), DEFINE_KEYFIELD(m_bResetAngles, FIELD_BOOLEAN, "resetang") @@ -271,15 +262,17 @@ void CTriggerTeleportEnt::StartTouch(CBaseEntity *pOther) } } - if (!PassesTriggerFilters(pOther)) return; + if (!PassesTriggerFilters(pOther)) + return; - if (pDestinationEnt)//ensuring not null + if (pDestinationEnt) // ensuring not null { Vector tmp = pDestinationEnt->GetAbsOrigin(); // make origin adjustments. (origin in center, not at feet) tmp.z -= pOther->WorldAlignMins().z; - pOther->Teleport(&tmp, m_bResetAngles ? &pDestinationEnt->GetAbsAngles() : NULL, m_bResetVelocity ? &vec3_origin : NULL); + pOther->Teleport(&tmp, m_bResetAngles ? &pDestinationEnt->GetAbsAngles() : NULL, + m_bResetVelocity ? &vec3_origin : NULL); AfterTeleport(); } } @@ -289,7 +282,6 @@ void CTriggerTeleportEnt::StartTouch(CBaseEntity *pOther) //----------- CTriggerTeleportCheckpoint ------------------------------------------------------- LINK_ENTITY_TO_CLASS(trigger_momentum_teleport_checkpoint, CTriggerTeleportCheckpoint); - void CTriggerTeleportCheckpoint::StartTouch(CBaseEntity *pOther) { SetDestinationEnt(g_Timer.GetCurrentCheckpoint()); @@ -308,8 +300,8 @@ void CTriggerOnehop::StartTouch(CBaseEntity *pOther) { SetDestinationEnt(NULL); BaseClass::StartTouch(pOther); - //The above is needed for the Think() function of this class, - //it's very HACKHACK but it works + // The above is needed for the Think() function of this class, + // it's very HACKHACK but it works if (pOther->IsPlayer()) { @@ -379,7 +371,7 @@ void CTriggerMultihop::StartTouch(CBaseEntity *pOther) } } -void CTriggerMultihop::EndTouch(CBaseEntity* pOther) +void CTriggerMultihop::EndTouch(CBaseEntity *pOther) { // We don't want to keep checking for tp m_fStartTouchedTime = -1.0f; @@ -468,14 +460,14 @@ void CTriggerLimitMovement::Think() if (HasSpawnFlags(LIMIT_BHOP)) { pPlayer->DisableButtons(IN_JUMP); - //if player in air + // if player in air if (pPlayer->GetGroundEntity() != NULL) { - //only start timer if we havent already started + // only start timer if we havent already started if (!m_BhopTimer.HasStarted()) m_BhopTimer.Start(FL_BHOP_TIMER); - //when finished + // when finished if (m_BhopTimer.IsElapsed()) { pPlayer->EnableButtons(IN_JUMP); @@ -484,14 +476,14 @@ void CTriggerLimitMovement::Think() } } } - //figure out if timer elapsed or not + // figure out if timer elapsed or not if (m_BhopTimer.GetRemainingTime() <= 0) m_BhopTimer.Invalidate(); - //DevLog("Bhop Timer Remaining Time:%f\n", m_BhopTimer.GetRemainingTime()); + // DevLog("Bhop Timer Remaining Time:%f\n", m_BhopTimer.GetRemainingTime()); - //HACKHACK - this prevents think from running too fast, breaking the timer - //and preventing the player from jumping until the timer runs out - //Thinking every 0.25 seconds seems to feel good, but we can adjust this later + // HACKHACK - this prevents think from running too fast, breaking the timer + // and preventing the player from jumping until the timer runs out + // Thinking every 0.25 seconds seems to feel good, but we can adjust this later SetNextThink(gpGlobals->curtime + 0.25); BaseClass::Think(); } @@ -536,7 +528,6 @@ void CTriggerLimitMovement::EndTouch(CBaseEntity *pOther) } //----------------------------------------------------------------------------------------------- - //---------- CFuncShootBoost -------------------------------------------------------------------- LINK_ENTITY_TO_CLASS(func_shootboost, CFuncShootBoost); diff --git a/mp/src/game/server/server_momentum.vpc b/mp/src/game/server/server_momentum.vpc index c2118c6199..b71b74f5f4 100644 --- a/mp/src/game/server/server_momentum.vpc +++ b/mp/src/game/server/server_momentum.vpc @@ -49,7 +49,9 @@ $Project "Server (Momentum)" $File "momentum\Timer.h" $File "momentum\Timer.cpp" } - + + $File "momentum\mom_blockfix.h" + $File "momentum\mom_blockfix.cpp" $File "momentum\mom_triggers.h" $File "momentum\mom_triggers.cpp" diff --git a/mp/src/game/shared/momentum/mom_shareddefs.h b/mp/src/game/shared/momentum/mom_shareddefs.h index c21fe6cd07..ca5839567f 100644 --- a/mp/src/game/shared/momentum/mom_shareddefs.h +++ b/mp/src/game/shared/momentum/mom_shareddefs.h @@ -23,6 +23,7 @@ typedef enum MOMGM // Main Version (0 is alpha, 1 is beta, 2 is release)​.Main feature push (increment by one for each)​.​Small commits or hotfixes​ // When editing this, remember to also edit version.txt on the main dir of the repo -#define MOM_CURRENT_VERSION "0.0.1" +// If you have any doubts, please refer to http://semver.org/ +#define MOM_CURRENT_VERSION "0.1.0" #endif // MOM_SHAREDDEFS_H \ No newline at end of file diff --git a/mp/src/lib/public/mathlib.lib b/mp/src/lib/public/mathlib.lib index 1087708363..41754a0c9d 100644 Binary files a/mp/src/lib/public/mathlib.lib and b/mp/src/lib/public/mathlib.lib differ diff --git a/mp/src/lib/public/raytrace.lib b/mp/src/lib/public/raytrace.lib index c4fc1efcba..d120ada249 100644 Binary files a/mp/src/lib/public/raytrace.lib and b/mp/src/lib/public/raytrace.lib differ diff --git a/mp/src/lib/public/tier1.lib b/mp/src/lib/public/tier1.lib index a37e22d214..f58a52f90a 100644 Binary files a/mp/src/lib/public/tier1.lib and b/mp/src/lib/public/tier1.lib differ diff --git a/mp/src/lib/public/vgui_controls.lib b/mp/src/lib/public/vgui_controls.lib index 84f4a294e9..188e432833 100644 Binary files a/mp/src/lib/public/vgui_controls.lib and b/mp/src/lib/public/vgui_controls.lib differ diff --git a/version.txt b/version.txt index 8a9ecc2ea9..6c6aa7cb09 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.0.1 \ No newline at end of file +0.1.0 \ No newline at end of file