Skip to content

Commit 32c40aa

Browse files
committed
EnsureDestination
1 parent c3bc598 commit 32c40aa

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

src/movement/movement.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,9 @@ void CMovementPlayer::Teleport(const Vector* origin, const QAngle* angle, const
141141
if (origin) {
142142
SetOrigin(*origin);
143143
}
144-
145144
if (angle) {
146145
SetAngles(*angle);
147146
}
148-
149147
if (vel) {
150148
SetVelocity(*vel);
151149
}

src/surf/zones/edit.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "edit.h"
22
#include <utils/utils.h>
33
#include <surf/zones/surf_zones.h>
4+
#include <surf/misc/surf_misc.h>
45

56
void ZoneEditProperty::Init(CSurfZoneService* outer) {
67
m_pOuter = outer;
@@ -133,3 +134,20 @@ void ZoneEditProperty::ClearBeams() {
133134
}
134135
m_vBeam.clear();
135136
}
137+
138+
void ZoneData_t::EnsureDestination() {
139+
for (const auto& hTele : SURF::MiscPlugin()->m_vTeleDestination) {
140+
auto pTeleEnt = hTele.Get();
141+
if (pTeleEnt) {
142+
const Vector& origin = pTeleEnt->GetOrigin();
143+
if (IsInsideBox(origin)) {
144+
m_vecDestination = origin;
145+
m_angDestination = pTeleEnt->GetAbsAngles();
146+
return;
147+
}
148+
}
149+
}
150+
151+
m_vecDestination = (m_vecMins + m_vecMaxs) / 2.0f;
152+
m_angDestination.Invalidate();
153+
}

src/surf/zones/edit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ struct ZoneData_t {
5353
return (vec.x > m_vecMins.x && vec.y > m_vecMins.y && vec.z > m_vecMins.z) && (vec.x < m_vecMaxs.x && vec.y < m_vecMaxs.y && vec.z < m_vecMaxs.z);
5454
}
5555

56+
void EnsureDestination();
57+
5658
ZoneTrack m_iTrack;
5759
ZoneType m_iType;
5860
i32 m_iValue;

src/surf/zones/surf_zones.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include <utils/utils.h>
33
#include <core/sdkhook.h>
44
#include <surf/global/surf_global.h>
5-
#include <surf/misc/surf_misc.h>
65

76
CSurfZonePlugin g_SurfZonePlugin;
87

@@ -151,7 +150,7 @@ bool CSurfZoneService::TeleportToZone(ZoneTrack track, ZoneType type) {
151150
vecTargetAng = customDestination.second;
152151
}
153152

154-
GetPlayer()->Teleport(&vecTargetOrigin, &vecTargetAng, &SURF::ZERO_VEC);
153+
GetPlayer()->Teleport(&vecTargetOrigin, vecTargetAng.IsValid() ? &vecTargetAng : nullptr, &SURF::ZERO_VEC);
155154

156155
return true;
157156
}
@@ -188,18 +187,3 @@ CBaseEntity* CSurfZonePlugin::CreateNormalZone(const Vector& vecMins, const Vect
188187
void CSurfZoneService::OnReset() {
189188
m_ZoneEdit.Init(this);
190189
}
191-
192-
void ZoneCache_t::EnsureDestination() {
193-
for (const auto& hTele : SURF::MiscPlugin()->m_vTeleDestination) {
194-
auto pTeleEnt = hTele.Get();
195-
if (pTeleEnt) {
196-
const Vector& origin = pTeleEnt->GetOrigin();
197-
if (IsInsideBox(origin)) {
198-
m_vecDestination = origin;
199-
return;
200-
}
201-
}
202-
}
203-
204-
m_vecDestination = (m_vecMins + m_vecMaxs) / 2.0f;
205-
}

src/surf/zones/surf_zones.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ struct ZoneCache_t : ZoneData_t {
1212
m_aBeams.fill(CEntityHandle());
1313
}
1414

15-
void EnsureDestination();
16-
1715
std::array<CHandle<CBeam>, 12> m_aBeams;
1816
};
1917

0 commit comments

Comments
 (0)