mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-07-18 23:31:22 +00:00
P1: Source files - Copy 9 server stargate files + sg_constants.h + sg_weapons.cpp from StargateTCSource/sourcecode/ into game/server/stargate/ and game/shared/stargate/. - Add $Folder "Stargate" block to server_hl2mp.vpc and client_hl2mp.vpc. - Extend $AdditionalIncludeDirectories with stargate paths. P2/P3: Gamerules + player patches - hl2mp_gamerules.h: add TEAM_JAFFA=4, TEAM_UNAS=5 to team enum. - hl2mp_gamerules.cpp: preserve 5 Stargate spawn classnames in s_PreserveEnts[]; rename teams to Tau'ri/Goa'uld/Jaffa/Unas; rename game description to "StargateTC"/"StargateTC Teamplay". - hl2mp_player.cpp: EntSelectSpawnPoint now searches Stargate spawn classnames first (torri/goauld/marine/unas) with per-team fallback chain to combine/rebel/deathmatch. Build: 0 errors. Server.dll 13.19MB, client.dll 9.85MB. Runtime test: window title "StargateTC", live game launches, HEALTH 100 HUD renders, HL2MP MOTD shown, sky/world geometry renders. Response system loads 217 rules without crashing (was the original Mapbase+VS2022 heap-corruption point). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
65 lines
2.0 KiB
C++
65 lines
2.0 KiB
C++
//============= Copyright (c) StargateTC Source Team ==========================
|
|
//
|
|
// zone_gatetravel and trigger_adv_teleport recovered from the GoldSrc DLL.
|
|
// Ghidra's GTravelTouch path checks IsPlayer(), clears velocity, and starts a
|
|
// short travel lockout. The Source port keeps that observable behavior and adds
|
|
// explicit destination targeting for converted maps.
|
|
//
|
|
//=============================================================================
|
|
#include "cbase.h"
|
|
#include "triggers.h"
|
|
#include "stargate/sg_constants.h"
|
|
|
|
class CStargateTravelZone : public CBaseTrigger
|
|
{
|
|
public:
|
|
DECLARE_CLASS( CStargateTravelZone, CBaseTrigger );
|
|
DECLARE_DATADESC();
|
|
|
|
void Spawn() override;
|
|
void TravelTouch( CBaseEntity *pOther );
|
|
|
|
private:
|
|
void TeleportPlayer( CBaseEntity *pPlayer );
|
|
float m_flNextTouchTime { 0.0f };
|
|
};
|
|
|
|
LINK_ENTITY_TO_CLASS( zone_gatetravel, CStargateTravelZone );
|
|
LINK_ENTITY_TO_CLASS( trigger_adv_teleport, CStargateTravelZone );
|
|
|
|
BEGIN_DATADESC( CStargateTravelZone )
|
|
DEFINE_FIELD( m_flNextTouchTime, FIELD_TIME ),
|
|
DEFINE_ENTITYFUNC( TravelTouch ),
|
|
END_DATADESC()
|
|
|
|
void CStargateTravelZone::Spawn()
|
|
{
|
|
BaseClass::Spawn();
|
|
InitTrigger();
|
|
SetTouch( &CStargateTravelZone::TravelTouch );
|
|
}
|
|
|
|
void CStargateTravelZone::TravelTouch( CBaseEntity *pOther )
|
|
{
|
|
if ( !pOther || !pOther->IsPlayer() || gpGlobals->curtime < m_flNextTouchTime )
|
|
return;
|
|
|
|
pOther->SetAbsVelocity( vec3_origin );
|
|
pOther->SetBaseVelocity( vec3_origin );
|
|
TeleportPlayer( pOther );
|
|
|
|
m_flNextTouchTime = gpGlobals->curtime + StargateTC::GATE_TRAVEL_COOLDOWN;
|
|
}
|
|
|
|
void CStargateTravelZone::TeleportPlayer( CBaseEntity *pPlayer )
|
|
{
|
|
CBaseEntity *pDestination = gEntList.FindEntityByName( NULL, m_target );
|
|
if ( !pDestination )
|
|
return;
|
|
|
|
Vector destination = pDestination->GetAbsOrigin();
|
|
QAngle angles = pDestination->GetAbsAngles();
|
|
Vector velocity = vec3_origin;
|
|
pPlayer->Teleport( &destination, &angles, &velocity );
|
|
}
|