From 50147a3d48609b4b30bf0f814c589b1ff8e89a26 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 26 Feb 2026 05:15:08 +0500 Subject: [PATCH] common: replace HLSDK pmtrace.h and pm_movevars.h by it's QW counterparts --- common/pmove.h | 86 +++++++++++++++++++++++++++++++++++++ common/pmtrace.h | 41 ------------------ engine/client/cl_parse_gs.c | 12 +++--- engine/client/client.h | 2 +- engine/common/net_encode.c | 22 +++++----- engine/common/pm_local.h | 1 + engine/common/pm_trace.c | 1 - engine/common/world.c | 1 + engine/server/server.h | 2 +- engine/server/sv_frame.c | 2 +- engine/server/sv_main.c | 12 +++--- pm_shared/pm_defs.h | 3 -- pm_shared/pm_movevars.h | 54 ----------------------- ref/gl/gl_alias.c | 26 +++++------ ref/gl/gl_local.h | 3 +- ref/gl/gl_studio.c | 26 +++++------ ref/soft/r_local.h | 4 +- ref/soft/r_studio.c | 36 ++++++---------- 18 files changed, 151 insertions(+), 183 deletions(-) create mode 100644 common/pmove.h delete mode 100644 common/pmtrace.h delete mode 100644 pm_shared/pm_movevars.h diff --git a/common/pmove.h b/common/pmove.h new file mode 100644 index 00000000..f95849a5 --- /dev/null +++ b/common/pmove.h @@ -0,0 +1,86 @@ +/* +Copyright (C) 1996-1997 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef QW_PMOVE_H +#define QW_PMOVE_H + +// a1ba: from QW's client/pmove.h +// and modified to keep binary compatibility with +// goldsrc base structs and xash extensions +typedef struct pmplane_s +{ + vec3_t normal; + float dist; +} pmplane_t; + +STATIC_CHECK_SIZEOF( pmplane_t, 16, 16 ); + +typedef struct pmtrace_s +{ + qboolean allsolid; // if true, plane is not valid + qboolean startsolid; // if true, the initial point was in a solid area + qboolean inopen, inwater; + float fraction; // time completed, 1.0 = didn't hit anything + vec3_t endpos; // final position + pmplane_t plane; // surface normal at impact + int ent; // entity the surface is on + vec3_t deltavelocity; + int hitgroup; +} pmtrace_t; + +STATIC_CHECK_SIZEOF( pmtrace_t, 68, 68 ); + +typedef struct movevars_s +{ + float gravity; + float stopspeed; + float maxspeed; + float spectatormaxspeed; + float accelerate; + float airaccelerate; + float wateraccelerate; + float friction; + float edgefriction; // goldsrc binary compat + float waterfriction; + float entgravity; + + // goldsrc additions + float bounce; + float stepsize; + float maxvelocity; + float zmax; + float waveHeight; + qboolean footsteps; + char skyName[32]; + float rollangle; + float rollspeed; + vec3_t skycolor; + vec3_t skyvec; + + // xash extensions + int features; + int fog_settings; + float wateralpha; + vec3_t skydir; // unused + float skyangle; // unused +} movevars_t; + +STATIC_CHECK_SIZEOF( movevars_t, 160, 160 ); + +#endif // QW_PMOVE_H diff --git a/common/pmtrace.h b/common/pmtrace.h deleted file mode 100644 index fb7fc26e..00000000 --- a/common/pmtrace.h +++ /dev/null @@ -1,41 +0,0 @@ -/*** -* -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. -* All Rights Reserved. -* -* Use, distribution, and modification of this source code and/or resulting -* object code is restricted to non-commercial enhancements to products from -* Valve LLC. All other use, distribution, or modification is prohibited -* without written permission from Valve LLC. -* -****/ - -#ifndef PM_TRACE_H -#define PM_TRACE_H - -typedef struct -{ - vec3_t normal; - float dist; -} pmplane_t; - -typedef struct pmtrace_s pmtrace_t; - -struct pmtrace_s -{ - qboolean allsolid; // if true, plane is not valid - qboolean startsolid; // if true, the initial point was in a solid area - qboolean inopen, inwater; // End point is in empty space or in water - float fraction; // time completed, 1.0 = didn't hit anything - vec3_t endpos; // final position - pmplane_t plane; // surface normal at impact - int ent; // entity at impact - vec3_t deltavelocity; // Change in player's velocity caused by impact. - // Only run on server. - int hitgroup; -}; - -#endif//PM_TRACE_H diff --git a/engine/client/cl_parse_gs.c b/engine/client/cl_parse_gs.c index 3b7c1a69..ed74757c 100644 --- a/engine/client/cl_parse_gs.c +++ b/engine/client/cl_parse_gs.c @@ -58,12 +58,12 @@ static void CL_ParseNewMovevars( sizebuf_t *msg ) clgame.movevars.footsteps = MSG_ReadByte( msg ); clgame.movevars.rollangle = MSG_ReadFloat( msg ); clgame.movevars.rollspeed = MSG_ReadFloat( msg ); - clgame.movevars.skycolor_r = MSG_ReadFloat( msg ); - clgame.movevars.skycolor_g = MSG_ReadFloat( msg ); - clgame.movevars.skycolor_b = MSG_ReadFloat( msg ); - clgame.movevars.skyvec_x = MSG_ReadFloat( msg ); - clgame.movevars.skyvec_y = MSG_ReadFloat( msg ); - clgame.movevars.skyvec_z = MSG_ReadFloat( msg ); + clgame.movevars.skycolor[0] = MSG_ReadFloat( msg ); + clgame.movevars.skycolor[1] = MSG_ReadFloat( msg ); + clgame.movevars.skycolor[2] = MSG_ReadFloat( msg ); + clgame.movevars.skyvec[0] = MSG_ReadFloat( msg ); + clgame.movevars.skyvec[1] = MSG_ReadFloat( msg ); + clgame.movevars.skyvec[2] = MSG_ReadFloat( msg ); Q_strncpy( clgame.movevars.skyName, MSG_ReadString( msg ), sizeof( clgame.movevars.skyName )); diff --git a/engine/client/client.h b/engine/client/client.h index 94e80c66..53585a80 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -22,8 +22,8 @@ GNU General Public License for more details. #include "menu_int.h" #include "cl_entity.h" #include "mod_local.h" +#include "pmove.h" #include "pm_defs.h" -#include "pm_movevars.h" #include "ref_params.h" #include "render_api.h" #include "cdll_exp.h" diff --git a/engine/common/net_encode.c b/engine/common/net_encode.c index 3df08961..73ed7e09 100644 --- a/engine/common/net_encode.c +++ b/engine/common/net_encode.c @@ -18,7 +18,6 @@ GNU General Public License for more details. #include "xash3d_mathlib.h" #include "net_encode.h" #include "event_api.h" -#include "pm_movevars.h" #include "entity_state.h" #include "weaponinfo.h" #include "event_args.h" @@ -40,11 +39,12 @@ GNU General Public License for more details. // helper macroses #define UCMD_DEF_( name, x ) #name, offsetof( usercmd_t, x ), sizeof( ((usercmd_t *)0)->x ) +#define PHYS_DEF_( name, x ) #name, offsetof( movevars_t, x ), sizeof( ((movevars_t *)0)->x ) #define ENTS_DEF( x ) #x, offsetof( entity_state_t, x ), sizeof( ((entity_state_t *)0)->x ) #define UCMD_DEF( x ) UCMD_DEF_( x, x ) #define EVNT_DEF( x ) #x, offsetof( event_args_t, x ), sizeof( ((event_args_t *)0)->x ) -#define PHYS_DEF( x ) #x, offsetof( movevars_t, x ), sizeof( ((movevars_t *)0)->x ) +#define PHYS_DEF( x ) PHYS_DEF_( x, x ) #define CLDT_DEF( x ) #x, offsetof( clientdata_t, x ), sizeof( ((clientdata_t *)0)->x ) #define WPDT_DEF( x ) #x, offsetof( weapon_data_t, x ), sizeof( ((weapon_data_t *)0)->x ) #define DESC_DEF( x ) #x, offsetof( goldsrc_delta_t, x ), sizeof( ((goldsrc_delta_t *)0)->x ) @@ -93,17 +93,17 @@ static const delta_field_t pm_fields[] = { PHYS_DEF( skyName ) }, { PHYS_DEF( rollangle ) }, { PHYS_DEF( rollspeed ) }, -{ PHYS_DEF( skycolor_r ) }, -{ PHYS_DEF( skycolor_g ) }, -{ PHYS_DEF( skycolor_b ) }, -{ PHYS_DEF( skyvec_x ) }, -{ PHYS_DEF( skyvec_y ) }, -{ PHYS_DEF( skyvec_z ) }, +{ PHYS_DEF_( skycolor_r, skycolor[0] ) }, +{ PHYS_DEF_( skycolor_g, skycolor[1] ) }, +{ PHYS_DEF_( skycolor_b, skycolor[2] ) }, +{ PHYS_DEF_( skyvec_x, skyvec[0] ) }, +{ PHYS_DEF_( skyvec_y, skyvec[1] ) }, +{ PHYS_DEF_( skyvec_z, skyvec[2] ) }, { PHYS_DEF( fog_settings ) }, { PHYS_DEF( wateralpha ) }, -{ PHYS_DEF( skydir_x ) }, -{ PHYS_DEF( skydir_y ) }, -{ PHYS_DEF( skydir_z ) }, +{ PHYS_DEF_( skydir_x, skydir[0] ) }, +{ PHYS_DEF_( skydir_y, skydir[1] ) }, +{ PHYS_DEF_( skydir_z, skydir[2] ) }, { PHYS_DEF( skyangle ) }, }; diff --git a/engine/common/pm_local.h b/engine/common/pm_local.h index a079c310..128794c3 100644 --- a/engine/common/pm_local.h +++ b/engine/common/pm_local.h @@ -16,6 +16,7 @@ GNU General Public License for more details. #ifndef PM_LOCAL_H #define PM_LOCAL_H +#include "pmove.h" #include "pm_defs.h" typedef int (*pfnIgnore)( physent_t *pe ); // custom trace filter diff --git a/engine/common/pm_trace.c b/engine/common/pm_trace.c index ed365843..f4f14861 100644 --- a/engine/common/pm_trace.c +++ b/engine/common/pm_trace.c @@ -17,7 +17,6 @@ GNU General Public License for more details. #include "xash3d_mathlib.h" #include "mod_local.h" #include "pm_local.h" -#include "pm_movevars.h" #include "enginefeatures.h" #include "studio.h" #include "world.h" diff --git a/engine/common/world.c b/engine/common/world.c index 06275cb4..38f8421e 100644 --- a/engine/common/world.c +++ b/engine/common/world.c @@ -15,6 +15,7 @@ GNU General Public License for more details. #include "common.h" #include "world.h" +#include "pmove.h" #include "pm_defs.h" #include "mod_local.h" #include "xash3d_mathlib.h" diff --git a/engine/server/server.h b/engine/server/server.h index 1bded216..05c57d0f 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -21,8 +21,8 @@ GNU General Public License for more details. #include "eiface.h" #include "physint.h" // physics interface #include "mod_local.h" +#include "pmove.h" #include "pm_defs.h" -#include "pm_movevars.h" #include "entity_state.h" #include "protocol.h" #include "netchan.h" diff --git a/engine/server/sv_frame.c b/engine/server/sv_frame.c index 89c8ce53..6fd1884b 100644 --- a/engine/server/sv_frame.c +++ b/engine/server/sv_frame.c @@ -968,7 +968,7 @@ void SV_InactivateClients( void ) } COM_ClearCustomizationList( &cl->customdata, false ); - memset( cl->physinfo, 0, MAX_PHYSINFO_STRING ); + memset( cl->physinfo, 0, sizeof( cl->physinfo )); // NOTE: many mods sending messages that must be applied on a next level // e.g. CryOfFear sending HideHud and PlayMp3 that affected after map change diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 9bb065f8..b9295435 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -221,12 +221,12 @@ void SV_UpdateMovevars( qboolean initialize ) svgame.movevars.footsteps = sv_footsteps.value; svgame.movevars.rollangle = sv_rollangle.value; svgame.movevars.rollspeed = sv_rollspeed.value; - svgame.movevars.skycolor_r = sv_skycolor_r.value; - svgame.movevars.skycolor_g = sv_skycolor_g.value; - svgame.movevars.skycolor_b = sv_skycolor_b.value; - svgame.movevars.skyvec_x = sv_skyvec_x.value; - svgame.movevars.skyvec_y = sv_skyvec_y.value; - svgame.movevars.skyvec_z = sv_skyvec_z.value; + svgame.movevars.skycolor[0] = sv_skycolor_r.value; + svgame.movevars.skycolor[1] = sv_skycolor_g.value; + svgame.movevars.skycolor[2] = sv_skycolor_b.value; + svgame.movevars.skyvec[0] = sv_skyvec_x.value; + svgame.movevars.skyvec[1] = sv_skyvec_y.value; + svgame.movevars.skyvec[2] = sv_skyvec_z.value; svgame.movevars.wateralpha = sv_wateralpha.value; svgame.movevars.features = host.features; // just in case. not really need svgame.movevars.entgravity = 1.0f; diff --git a/pm_shared/pm_defs.h b/pm_shared/pm_defs.h index 8c89e044..6f7f7ac5 100644 --- a/pm_shared/pm_defs.h +++ b/pm_shared/pm_defs.h @@ -33,9 +33,6 @@ #include "pm_info.h" -// PM_PlayerTrace results. -#include "pmtrace.h" - // physent_t typedef struct physent_s { diff --git a/pm_shared/pm_movevars.h b/pm_shared/pm_movevars.h deleted file mode 100644 index 0efaae44..00000000 --- a/pm_shared/pm_movevars.h +++ /dev/null @@ -1,54 +0,0 @@ -//========= Copyright (C) 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -// pm_movevars.h -#if !defined( PM_MOVEVARSH ) -#define PM_MOVEVARSH - -// movevars_t // Physics variables. -typedef struct movevars_s movevars_t; - -struct movevars_s -{ - float gravity; // Gravity for map - float stopspeed; // Deceleration when not moving - float maxspeed; // Max allowed speed - float spectatormaxspeed; - float accelerate; // Acceleration factor - float airaccelerate; // Same for when in open air - float wateraccelerate; // Same for when in water - float friction; - float edgefriction; // Extra friction near dropofs - float waterfriction; // Less in water - float entgravity; // 1.0 - float bounce; // Wall bounce value. 1.0 - float stepsize; // sv_stepsize; - float maxvelocity; // maximum server velocity. - float zmax; // Max z-buffer range (for GL) - float waveHeight; // Water wave height (for GL) - qboolean footsteps; // Play footstep sounds - char skyName[32]; // Name of the sky map - float rollangle; - float rollspeed; - float skycolor_r; // Sky color - float skycolor_g; // - float skycolor_b; // - float skyvec_x; // Sky vector - float skyvec_y; // - float skyvec_z; // - int features; // engine features that shared across network - int fog_settings; // Global fog settings (packed color+density) - float wateralpha; // World water alpha 1.0 - solid 0.0 - transparent - float skydir_x; // skybox rotate direction - float skydir_y; // - float skydir_z; // - float skyangle; // skybox rotate angle -}; - -extern movevars_t movevars; - -#endif diff --git a/ref/gl/gl_alias.c b/ref/gl/gl_alias.c index 5efc40f7..c2ae9e6a 100644 --- a/ref/gl/gl_alias.c +++ b/ref/gl/gl_alias.c @@ -19,7 +19,6 @@ GNU General Public License for more details. #include "triangleapi.h" #include "alias.h" #include "pm_local.h" -#include "pmtrace.h" typedef struct { @@ -602,23 +601,18 @@ static void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight ) VectorSet( vecSrc, origin[0], origin[1], origin[2] - lightDir[2] * 8.0f ); light.r = light.g = light.b = light.a = 0; - if(( mv->skycolor_r + mv->skycolor_g + mv->skycolor_b ) != 0 ) + if(( mv->skycolor[0] + mv->skycolor[1] + mv->skycolor[2] ) != 0 ) { msurface_t *psurf = NULL; pmtrace_t trace; + vec3_t skyvec; if( FBitSet( gp_host->features, ENGINE_WRITE_LARGE_COORD )) - { - vecEnd[0] = origin[0] - mv->skyvec_x * 65536.0f; - vecEnd[1] = origin[1] - mv->skyvec_y * 65536.0f; - vecEnd[2] = origin[2] - mv->skyvec_z * 65536.0f; - } + VectorScale( mv->skyvec, 65536.0f, skyvec ); else - { - vecEnd[0] = origin[0] - mv->skyvec_x * 8192.0f; - vecEnd[1] = origin[1] - mv->skyvec_y * 8192.0f; - vecEnd[2] = origin[2] - mv->skyvec_z * 8192.0f; - } + VectorScale( mv->skyvec, 8192.0f, skyvec ); + + VectorSubtract( origin, skyvec, vecEnd ); trace = gEngfuncs.CL_TraceLine( vecSrc, vecEnd, PM_STUDIO_IGNORE ); if( trace.ent > 0 ) psurf = gEngfuncs.EV_TraceSurface( trace.ent, vecSrc, vecEnd ); @@ -626,11 +620,11 @@ static void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight ) if( psurf && FBitSet( psurf->flags, SURF_DRAWSKY )) { - VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z ); + VectorCopy( mv->skyvec, lightDir ); - light.r = mv->skycolor_r; - light.g = mv->skycolor_g; - light.b = mv->skycolor_b; + light.r = mv->skycolor[0]; + light.g = mv->skycolor[1]; + light.b = mv->skycolor[2]; } } diff --git a/ref/gl/gl_local.h b/ref/gl/gl_local.h index f28ee51b..232f6b63 100644 --- a/ref/gl/gl_local.h +++ b/ref/gl/gl_local.h @@ -23,18 +23,17 @@ GNU General Public License for more details. #include "cl_entity.h" #include "render_api.h" #include "protocol.h" -#include "dlight.h" #include "gl_frustum.h" #include "ref_api.h" #include "xash3d_mathlib.h" #include "ref_params.h" #include "enginefeatures.h" #include "com_strings.h" -#include "pm_movevars.h" #include "cvardef.h" #include "gl_export.h" #include "wadfile.h" #include "common/mod_local.h" +#include "pmove.h" #if XASH_PSVITA int VGL_ShimInit( void ); diff --git a/ref/gl/gl_studio.c b/ref/gl/gl_studio.c index ddae6c0d..8512cea5 100644 --- a/ref/gl/gl_studio.c +++ b/ref/gl/gl_studio.c @@ -20,7 +20,6 @@ GNU General Public License for more details. #include "triangleapi.h" #include "studio.h" #include "pm_local.h" -#include "pmtrace.h" #define EVENT_CLIENT 5000 // less than this value it's a server-side studio events #define MAX_LOCALLIGHTS 4 @@ -1349,23 +1348,18 @@ static void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight ) VectorSet( vecSrc, origin[0], origin[1], origin[2] - lightDir[2] * 8.0f ); light.r = light.g = light.b = light.a = 0; - if(( mv->skycolor_r + mv->skycolor_g + mv->skycolor_b ) != 0 ) + if(( mv->skycolor[0] + mv->skycolor[1] + mv->skycolor[2] ) != 0 ) { msurface_t *psurf = NULL; pmtrace_t trace; + vec3_t skyvec; if( FBitSet( gp_host->features, ENGINE_WRITE_LARGE_COORD )) - { - vecEnd[0] = origin[0] - mv->skyvec_x * 65536.0f; - vecEnd[1] = origin[1] - mv->skyvec_y * 65536.0f; - vecEnd[2] = origin[2] - mv->skyvec_z * 65536.0f; - } + VectorScale( mv->skyvec, 65536.0f, skyvec ); else - { - vecEnd[0] = origin[0] - mv->skyvec_x * 8192.0f; - vecEnd[1] = origin[1] - mv->skyvec_y * 8192.0f; - vecEnd[2] = origin[2] - mv->skyvec_z * 8192.0f; - } + VectorScale( mv->skyvec, 8192.0f, skyvec ); + + VectorSubtract( origin, skyvec, vecEnd ); trace = gEngfuncs.CL_TraceLine( vecSrc, vecEnd, PM_WORLD_ONLY ); if( trace.ent > 0 ) psurf = gEngfuncs.EV_TraceSurface( trace.ent, vecSrc, vecEnd ); @@ -1373,11 +1367,11 @@ static void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight ) if( FBitSet( ent->model->flags, STUDIO_FORCE_SKYLIGHT ) || ( psurf && FBitSet( psurf->flags, SURF_DRAWSKY ))) { - VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z ); + VectorCopy( mv->skyvec, lightDir ); - light.r = mv->skycolor_r; - light.g = mv->skycolor_g; - light.b = mv->skycolor_b; + light.r = mv->skycolor[0]; + light.g = mv->skycolor[1]; + light.b = mv->skycolor[2]; } } diff --git a/ref/soft/r_local.h b/ref/soft/r_local.h index 05c753ca..09285a85 100644 --- a/ref/soft/r_local.h +++ b/ref/soft/r_local.h @@ -23,14 +23,14 @@ GNU General Public License for more details. #include "cl_entity.h" #include "render_api.h" #include "protocol.h" -#include "dlight.h" #include "ref_api.h" #include "xash3d_mathlib.h" #include "ref_params.h" #include "enginefeatures.h" #include "com_strings.h" -#include "pm_movevars.h" #include "cvardef.h" +#include "pmove.h" + typedef struct mip_s mip_t; typedef int fixed8_t; diff --git a/ref/soft/r_studio.c b/ref/soft/r_studio.c index acaf4940..e681fb35 100644 --- a/ref/soft/r_studio.c +++ b/ref/soft/r_studio.c @@ -20,7 +20,6 @@ GNU General Public License for more details. #include "triangleapi.h" #include "studio.h" #include "pm_local.h" -#include "pmtrace.h" #define EVENT_CLIENT 5000 // less than this value it's a server-side studio events #define MAX_LOCALLIGHTS 4 @@ -1386,37 +1385,30 @@ static void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight ) VectorSet( vecSrc, origin[0], origin[1], origin[2] - lightDir[2] * 8.0f ); light.r = light.g = light.b = light.a = 0; - if(( mv->skycolor_r + mv->skycolor_g + mv->skycolor_b ) != 0 ) + if(( mv->skycolor[0] + mv->skycolor[1] + mv->skycolor[2] ) != 0 ) { - msurface_t *psurf = NULL; - pmtrace_t trace; + msurface_t *psurf = NULL; + pmtrace_t trace; + vec3_t skyvec; if( FBitSet( gp_host->features, ENGINE_WRITE_LARGE_COORD )) - { - vecEnd[0] = origin[0] - mv->skyvec_x * 65536.0f; - vecEnd[1] = origin[1] - mv->skyvec_y * 65536.0f; - vecEnd[2] = origin[2] - mv->skyvec_z * 65536.0f; - } + VectorScale( mv->skyvec, 65536.0f, skyvec ); else - { - vecEnd[0] = origin[0] - mv->skyvec_x * 8192.0f; - vecEnd[1] = origin[1] - mv->skyvec_y * 8192.0f; - vecEnd[2] = origin[2] - mv->skyvec_z * 8192.0f; - } + VectorScale( mv->skyvec, 8192.0f, skyvec ); + + VectorSubtract( origin, skyvec, vecEnd ); trace = gEngfuncs.CL_TraceLine( vecSrc, vecEnd, PM_WORLD_ONLY ); - if( trace.ent > 0 ) - psurf = gEngfuncs.EV_TraceSurface( trace.ent, vecSrc, vecEnd ); - else - psurf = gEngfuncs.EV_TraceSurface( 0, vecSrc, vecEnd ); + if( trace.ent > 0 ) psurf = gEngfuncs.EV_TraceSurface( trace.ent, vecSrc, vecEnd ); + else psurf = gEngfuncs.EV_TraceSurface( 0, vecSrc, vecEnd ); if( FBitSet( ent->model->flags, STUDIO_FORCE_SKYLIGHT ) || ( psurf && FBitSet( psurf->flags, SURF_DRAWSKY ))) { - VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z ); + VectorCopy( mv->skyvec, lightDir ); - light.r = mv->skycolor_r; - light.g = mv->skycolor_g; - light.b = mv->skycolor_b; + light.r = mv->skycolor[0]; + light.g = mv->skycolor[1]; + light.b = mv->skycolor[2]; } }