mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
common: replace HLSDK pmtrace.h and pm_movevars.h by it's QW counterparts
This commit is contained in:
86
common/pmove.h
Normal file
86
common/pmove.h
Normal file
@@ -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
|
||||
@@ -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
|
||||
@@ -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 ));
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 ) },
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -33,9 +33,6 @@
|
||||
|
||||
#include "pm_info.h"
|
||||
|
||||
// PM_PlayerTrace results.
|
||||
#include "pmtrace.h"
|
||||
|
||||
// physent_t
|
||||
typedef struct physent_s
|
||||
{
|
||||
|
||||
@@ -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
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user