Browse Source

Upload first port

pull/3/merge
mittorn 7 years ago
parent
commit
0f599684c5
  1. 31
      backup.bat
  2. 36
      backup.lst
  3. 106
      cl_dll/Android.mk
  4. 123
      cl_dll/GameStudioModelRenderer.cpp
  5. 26
      cl_dll/GameStudioModelRenderer.h
  6. 992
      cl_dll/GameStudioModelRenderer_Sample.cpp
  7. 55
      cl_dll/GameStudioModelRenderer_Sample.h
  8. 165
      cl_dll/MOTD.cpp
  9. 1703
      cl_dll/StudioModelRenderer.cpp
  10. 189
      cl_dll/StudioModelRenderer.h
  11. 1203
      cl_dll/ammo.cpp
  12. 62
      cl_dll/ammo.h
  13. 159
      cl_dll/ammo_secondary.cpp
  14. 190
      cl_dll/ammohistory.cpp
  15. 143
      cl_dll/ammohistory.h
  16. 138
      cl_dll/battery.cpp
  17. 24
      cl_dll/camera.h
  18. 279
      cl_dll/cdll_int.cpp
  19. 624
      cl_dll/cl_dll.dsp
  20. 43
      cl_dll/cl_dll.h
  21. 162
      cl_dll/cl_util.h
  22. 277
      cl_dll/com_weapons.cpp
  23. 48
      cl_dll/com_weapons.h
  24. 303
      cl_dll/death.cpp
  25. 107
      cl_dll/demo.cpp
  26. 27
      cl_dll/demo.h
  27. 980
      cl_dll/entity.cpp
  28. 205
      cl_dll/ev_common.cpp
  29. 1700
      cl_dll/ev_hldm.cpp
  30. 95
      cl_dll/ev_hldm.h
  31. 23
      cl_dll/events.cpp
  32. 73
      cl_dll/eventscripts.h
  33. 149
      cl_dll/flashlight.cpp
  34. 184
      cl_dll/geiger.cpp
  35. 472
      cl_dll/health.cpp
  36. 127
      cl_dll/health.h
  37. 347
      cl_dll/hl/hl_baseentity.cpp
  38. 80
      cl_dll/hl/hl_events.cpp
  39. 90
      cl_dll/hl/hl_objects.cpp
  40. 1095
      cl_dll/hl/hl_weapons.cpp
  41. 587
      cl_dll/hud.cpp
  42. 701
      cl_dll/hud.h
  43. 25
      cl_dll/hud_iface.h
  44. 120
      cl_dll/hud_msg.cpp
  45. 342
      cl_dll/hud_redraw.cpp
  46. 1230
      cl_dll/hud_servers.cpp
  47. 41
      cl_dll/hud_servers.h
  48. 98
      cl_dll/hud_servers_priv.h
  49. 1595
      cl_dll/hud_spectator.cpp
  50. 132
      cl_dll/hud_spectator.h
  51. 54
      cl_dll/hud_update.cpp
  52. 620
      cl_dll/in_camera.cpp
  53. 31
      cl_dll/in_defs.h
  54. 1006
      cl_dll/input.cpp
  55. 268
      cl_dll/input_xash3d.cpp
  56. 947
      cl_dll/inputw32.cpp
  57. 18
      cl_dll/kbutton.h
  58. 186
      cl_dll/menu.cpp
  59. 536
      cl_dll/message.cpp
  60. 163
      cl_dll/overview.cpp
  61. 31
      cl_dll/overview.h
  62. 166
      cl_dll/parsemsg.cpp
  63. 40
      cl_dll/parsemsg.h
  64. 107
      cl_dll/readme.txt
  65. 312
      cl_dll/saytext.cpp
  66. 603
      cl_dll/scoreboard.cpp
  67. 162
      cl_dll/soundsystem.cpp
  68. 162
      cl_dll/status_icons.cpp
  69. 265
      cl_dll/statusbar.cpp
  70. 251
      cl_dll/studio_util.cpp
  71. 40
      cl_dll/studio_util.h
  72. 209
      cl_dll/text_message.cpp
  73. 1389
      cl_dll/tf_defs.h
  74. 85
      cl_dll/train.cpp
  75. 128
      cl_dll/tri.cpp
  76. 133
      cl_dll/util.cpp
  77. 121
      cl_dll/util_vector.h
  78. 1693
      cl_dll/view.cpp
  79. 15
      cl_dll/view.h
  80. 16
      cl_dll/wrect.h
  81. 60
      common/beamdef.h
  82. 246
      common/bspfile.h
  83. 105
      common/cl_entity.h
  84. 413
      common/com_model.h
  85. 25
      common/con_nprint.h
  86. 780
      common/const.h
  87. 37
      common/cvardef.h
  88. 27
      common/demo_api.h
  89. 31
      common/dlight.h
  90. 186
      common/entity_state.h
  91. 25
      common/entity_types.h
  92. 54
      common/event_api.h
  93. 47
      common/event_args.h
  94. 45
      common/event_flags.h
  95. 49
      common/gameinfo.h
  96. 59
      common/hltv.h
  97. 40
      common/ivoicetweak.h
  98. 29
      common/lightstyle.h
  99. 95
      common/mathlib.h
  100. 97
      common/net_api.h

31
backup.bat

@ -0,0 +1,31 @@
@echo off
color 4F
echo XashXT Group 2006 (C)
echo Prepare source for backup
echo.
if exist backup.log del /f /q backup.log
if not exist D:\!backup/ mkdir D:\!backup\
echo Prepare OK!
echo Please wait: backup in progress
C:\Progra~1\WinRar\rar a -agMMMYYYY-DD D:\!backup\.rar -dh -m5 @backup.lst >>backup.log
if errorlevel 1 goto error
if errorlevel 0 goto ok
:ok
cls
echo Source was sucessfully backuped
echo and stored in folder "backup"
echo Press any key for exit. :-)
if exist backup.log del /f /q backup.log
exit
:error
echo ******************************
echo ***********Error!*************
echo ******************************
echo **See backup.log for details**
echo ******************************
echo ******************************
echo.
echo press any key for exit :-(
pause>nul
exit

36
backup.lst

@ -0,0 +1,36 @@
//=======================================================================
// Copyright XashXT Group 2007 ©
// list with backup directories
//=======================================================================
// global stuff
xash.dsw
debug.bat
backup.lst
backup.bat
release.bat
change.log
make_sdk.bat
xash_sdk.lst
cl_dll\
cl_dll\hl\
common\
dlls\
game_shared\
game_launch\
engine\
engine\client\
engine\client\vgui\
engine\server\
engine\common\
engine\common\imagelib\
engine\common\soundlib\
pm_shared\
mainui\
mainui\legacy
utils\
utils\makefont\
utils\vgui\
utils\vgui\include\
utils\vgui\lib\win32_vc6\

106
cl_dll/Android.mk

@ -0,0 +1,106 @@
#hlsdk-2.3 client port for android
#Copyright (c) mittorn
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := client
#ifeq ($(XASH_SDL),1)
#APP_PLATFORM := android-12
#LOCAL_SHARED_LIBRARIES += SDL2
#LOCAL_CFLAGS += -DXASH_SDL
#else
APP_PLATFORM := android-8
#endif
LOCAL_CONLYFLAGS += -std=c99
include $(XASH3D_CONFIG)
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a-hard)
LOCAL_MODULE_FILENAME = libclient_hardfp
endif
LOCAL_CFLAGS += -fsigned-char -DCLIENT_DLL=1
SRCS=
SRCS_C=
SRCS+=../dlls/crossbow.cpp
SRCS+=../dlls/crowbar.cpp
SRCS+=../dlls/egon.cpp
SRCS+=./ev_hldm.cpp
SRCS+=../dlls/gauss.cpp
SRCS+=../dlls/handgrenade.cpp
SRCS+=./hl/hl_baseentity.cpp
SRCS+=./hl/hl_events.cpp
SRCS+=./hl/hl_objects.cpp
SRCS+=./hl/hl_weapons.cpp
SRCS+=../dlls/hornetgun.cpp
SRCS+=../dlls/mp5.cpp
SRCS+=../dlls/python.cpp
SRCS+=../dlls/rpg.cpp
SRCS+=../dlls/satchel.cpp
SRCS+=../dlls/shotgun.cpp
SRCS+=../dlls/squeakgrenade.cpp
SRCS+=../dlls/tripmine.cpp
SRCS+=../dlls/glock.cpp
#SRCS+=../game_shared/voice_banmgr.cpp
#SRCS+=../game_shared/voice_status.cpp
SRCS+=./ammo.cpp
SRCS+=./ammo_secondary.cpp
SRCS+=./ammohistory.cpp
SRCS+=./battery.cpp
SRCS+=./cdll_int.cpp
SRCS+=./com_weapons.cpp
SRCS+=./death.cpp
SRCS+=./demo.cpp
SRCS+=./entity.cpp
SRCS+=./ev_common.cpp
SRCS+=./events.cpp
SRCS+=./flashlight.cpp
SRCS+=./GameStudioModelRenderer.cpp
SRCS+=./geiger.cpp
SRCS+=./health.cpp
SRCS+=./hud.cpp
SRCS+=./hud_msg.cpp
SRCS+=./hud_redraw.cpp
#SRCS+=./hud_servers.cpp
SRCS+=./hud_spectator.cpp
SRCS+=./hud_update.cpp
SRCS+=./in_camera.cpp
SRCS+=./input.cpp
#SRCS+=./inputw32.cpp
SRCS+=./menu.cpp
SRCS+=./message.cpp
SRCS+=./overview.cpp
SRCS+=./parsemsg.cpp
SRCS_C+=../pm_shared/pm_debug.c
SRCS_C+=../pm_shared/pm_math.c
SRCS_C+=../pm_shared/pm_shared.c
SRCS+=./saytext.cpp
SRCS+=./status_icons.cpp
SRCS+=./statusbar.cpp
SRCS+=./studio_util.cpp
SRCS+=./StudioModelRenderer.cpp
SRCS+=./text_message.cpp
SRCS+=./train.cpp
SRCS+=./tri.cpp
SRCS+=./util.cpp
SRCS+=./view.cpp
SRCS+=./input_xash3d.cpp
SRCS+=./scoreboard.cpp
SRCS+=./MOTD.cpp
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls
DEFINES = -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -fpermissive -w
LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \
$(LOCAL_PATH)/../common \
$(LOCAL_PATH)/../engine \
$(LOCAL_PATH)/../game_shared \
$(LOCAL_PATH)/../dlls \
$(LOCAL_PATH)/../pm_shared
LOCAL_CFLAGS += $(DEFINES) $(INCLUDES)
LOCAL_SRC_FILES := $(SRCS) $(SRCS_C)
include $(BUILD_SHARED_LIBRARY)

123
cl_dll/GameStudioModelRenderer.cpp

@ -0,0 +1,123 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include <assert.h>
#include "hud.h"
#include "cl_util.h"
#include "const.h"
#include "com_model.h"
#include "studio.h"
#include "entity_state.h"
#include "cl_entity.h"
#include "dlight.h"
#include "triangleapi.h"
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include "studio_util.h"
#include "r_studioint.h"
#include "StudioModelRenderer.h"
#include "GameStudioModelRenderer.h"
//
// Override the StudioModelRender virtual member functions here to implement custom bone
// setup, blending, etc.
//
// Global engine <-> studio model rendering code interface
extern engine_studio_api_t IEngineStudio;
// The renderer object, created on the stack.
CGameStudioModelRenderer g_StudioRenderer;
/*
====================
CGameStudioModelRenderer
====================
*/
CGameStudioModelRenderer::CGameStudioModelRenderer( void )
{
}
////////////////////////////////////
// Hooks to class implementation
////////////////////////////////////
/*
====================
R_StudioDrawPlayer
====================
*/
int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
{
return g_StudioRenderer.StudioDrawPlayer( flags, pplayer );
}
/*
====================
R_StudioDrawModel
====================
*/
int R_StudioDrawModel( int flags )
{
return g_StudioRenderer.StudioDrawModel( flags );
}
/*
====================
R_StudioInit
====================
*/
void R_StudioInit( void )
{
g_StudioRenderer.Init();
}
// The simple drawing interface we'll pass back to the engine
r_studio_interface_t studio =
{
STUDIO_INTERFACE_VERSION,
R_StudioDrawModel,
R_StudioDrawPlayer,
};
/*
====================
HUD_GetStudioModelInterface
Export this function for the engine to use the studio renderer class to render objects.
====================
*/
#ifdef _WIN32
#define DLLEXPORT __declspec( dllexport )
#else
#define DLLEXPORT
#endif
extern "C" int DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio )
{
if ( version != STUDIO_INTERFACE_VERSION )
return 0;
// Point the engine to our callbacks
*ppinterface = &studio;
// Copy in engine helper functions
memcpy( &IEngineStudio, pstudio, sizeof( IEngineStudio ) );
// Initialize local variables, etc.
R_StudioInit();
// Success
return 1;
}

26
cl_dll/GameStudioModelRenderer.h

@ -0,0 +1,26 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if !defined( GAMESTUDIOMODELRENDERER_H )
#define GAMESTUDIOMODELRENDERER_H
#if defined( _WIN32 )
#pragma once
#endif
/*
====================
CGameStudioModelRenderer
====================
*/
class CGameStudioModelRenderer : public CStudioModelRenderer
{
public:
CGameStudioModelRenderer( void );
};
#endif // GAMESTUDIOMODELRENDERER_H

992
cl_dll/GameStudioModelRenderer_Sample.cpp

@ -0,0 +1,992 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#include <assert.h>
#include "hud.h"
#include "cl_util.h"
#include "const.h"
#include "com_model.h"
#include "studio.h"
#include "entity_state.h"
#include "cl_entity.h"
#include "dlight.h"
#include "triangleapi.h"
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include "studio_util.h"
#include "r_studioint.h"
#include "StudioModelRenderer.h"
#include "GameStudioModelRenderer.h"
// Predicted values saved off in hl_weapons.cpp
void Game_GetSequence( int *seq, int *gaitseq );
void Game_GetOrientation( float *o, float *a );
float g_flStartScaleTime;
int iPrevRenderState;
int iRenderStateChanged;
// Global engine <-> studio model rendering code interface
extern engine_studio_api_t IEngineStudio;
typedef struct
{
vec3_t origin;
vec3_t angles;
vec3_t realangles;
float animtime;
float frame;
int sequence;
int gaitsequence;
float framerate;
int m_fSequenceLoops;
int m_fSequenceFinished;
byte controller[ 4 ];
byte blending[ 2 ];
latchedvars_t lv;
} client_anim_state_t;
static client_anim_state_t g_state;
static client_anim_state_t g_clientstate;
// The renderer object, created on the stack.
CGameStudioModelRenderer g_StudioRenderer;
/*
====================
CGameStudioModelRenderer
====================
*/
CGameStudioModelRenderer::CGameStudioModelRenderer( void )
{
// If you want to predict animations locally, set this to TRUE
// NOTE: The animation code is somewhat broken, but gives you a sense for how
// to do client side animation of the predicted player in a third person game.
m_bLocal = false;
}
/*
====================
StudioSetupBones
====================
*/
void CGameStudioModelRenderer::StudioSetupBones ( void )
{
int i;
double f;
mstudiobone_t *pbones;
mstudioseqdesc_t *pseqdesc;
mstudioanim_t *panim;
static float pos[MAXSTUDIOBONES][3];
static vec4_t q[MAXSTUDIOBONES];
float bonematrix[3][4];
static float pos2[MAXSTUDIOBONES][3];
static vec4_t q2[MAXSTUDIOBONES];
static float pos3[MAXSTUDIOBONES][3];
static vec4_t q3[MAXSTUDIOBONES];
static float pos4[MAXSTUDIOBONES][3];
static vec4_t q4[MAXSTUDIOBONES];
// Use default bone setup for nonplayers
if ( !m_pCurrentEntity->player )
{
CStudioModelRenderer::StudioSetupBones();
return;
}
// Bound sequence number.
if ( m_pCurrentEntity->curstate.sequence >= m_pStudioHeader->numseq )
{
m_pCurrentEntity->curstate.sequence = 0;
}
pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->curstate.sequence;
if ( m_pPlayerInfo && m_pPlayerInfo->gaitsequence != 0 )
{
f = m_pPlayerInfo->gaitframe;
}
else
{
f = StudioEstimateFrame( pseqdesc );
}
// This game knows how to do three way blending
if ( pseqdesc->numblends == 3 )
{
float s;
// Get left anim
panim = StudioGetAnim( m_pRenderModel, pseqdesc );
// Blending is 0-127 == Left to Middle, 128 to 255 == Middle to right
if ( m_pCurrentEntity->curstate.blending[0] <= 127 )
{
StudioCalcRotations( pos, q, pseqdesc, panim, f );
// Scale 0-127 blending up to 0-255
s = m_pCurrentEntity->curstate.blending[0];
s = ( s * 2.0 );
}
else
{
// Skip ahead to middle
panim += m_pStudioHeader->numbones;
StudioCalcRotations( pos, q, pseqdesc, panim, f );
// Scale 127-255 blending up to 0-255
s = m_pCurrentEntity->curstate.blending[0];
s = 2.0 * ( s - 127.0 );
}
// Normalize interpolant
s /= 255.0;
// Go to middle or right
panim += m_pStudioHeader->numbones;
StudioCalcRotations( pos2, q2, pseqdesc, panim, f );
// Spherically interpolate the bones
StudioSlerpBones( q, pos, q2, pos2, s );
}
else
{
panim = StudioGetAnim( m_pRenderModel, pseqdesc );
StudioCalcRotations( pos, q, pseqdesc, panim, f );
}
// Are we in the process of transitioning from one sequence to another.
if ( m_fDoInterp &&
m_pCurrentEntity->latched.sequencetime &&
( m_pCurrentEntity->latched.sequencetime + 0.2 > m_clTime ) &&
( m_pCurrentEntity->latched.prevsequence < m_pStudioHeader->numseq ))
{
// blend from last sequence
static float pos1b[MAXSTUDIOBONES][3];
static vec4_t q1b[MAXSTUDIOBONES];
float s;
// Blending value into last sequence
unsigned char prevseqblending = m_pCurrentEntity->latched.prevseqblending[ 0 ];
// Point at previous sequenece
pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->latched.prevsequence;
// Know how to do three way blends
if ( pseqdesc->numblends == 3 )
{
float s;
// Get left animation
panim = StudioGetAnim( m_pRenderModel, pseqdesc );
if ( prevseqblending <= 127 )
{
// Set up bones based on final frame of previous sequence
StudioCalcRotations( pos1b, q1b, pseqdesc, panim, m_pCurrentEntity->latched.prevframe );
s = prevseqblending;
s = ( s * 2.0 );
}
else
{
// Skip to middle blend
panim += m_pStudioHeader->numbones;
StudioCalcRotations( pos1b, q1b, pseqdesc, panim, m_pCurrentEntity->latched.prevframe );
s = prevseqblending;
s = 2.0 * ( s - 127.0 );
}
// Normalize
s /= 255.0;
panim += m_pStudioHeader->numbones;
StudioCalcRotations( pos2, q2, pseqdesc, panim, m_pCurrentEntity->latched.prevframe );
// Interpolate bones
StudioSlerpBones( q1b, pos1b, q2, pos2, s );
}
else
{
panim = StudioGetAnim( m_pRenderModel, pseqdesc );
// clip prevframe
StudioCalcRotations( pos1b, q1b, pseqdesc, panim, m_pCurrentEntity->latched.prevframe );
}
// Now blend last frame of previous sequence with current sequence.
s = 1.0 - (m_clTime - m_pCurrentEntity->latched.sequencetime) / 0.2;
StudioSlerpBones( q, pos, q1b, pos1b, s );
}
else
{
m_pCurrentEntity->latched.prevframe = f;
}
// Now convert quaternions and bone positions into matrices
pbones = (mstudiobone_t *)((byte *)m_pStudioHeader + m_pStudioHeader->boneindex);
for (i = 0; i < m_pStudioHeader->numbones; i++)
{
QuaternionMatrix( q[i], bonematrix );
bonematrix[0][3] = pos[i][0];
bonematrix[1][3] = pos[i][1];
bonematrix[2][3] = pos[i][2];
if (pbones[i].parent == -1)
{
if ( IEngineStudio.IsHardware() )
{
ConcatTransforms ((*m_protationmatrix), bonematrix, (*m_pbonetransform)[i]);
ConcatTransforms ((*m_protationmatrix), bonematrix, (*m_plighttransform)[i]);
}
else
{
ConcatTransforms ((*m_paliastransform), bonematrix, (*m_pbonetransform)[i]);
ConcatTransforms ((*m_protationmatrix), bonematrix, (*m_plighttransform)[i]);
}
// Apply client-side effects to the transformation matrix
StudioFxTransform( m_pCurrentEntity, (*m_pbonetransform)[i] );
}
else
{
ConcatTransforms ((*m_pbonetransform)[pbones[i].parent], bonematrix, (*m_pbonetransform)[i]);
ConcatTransforms ((*m_plighttransform)[pbones[i].parent], bonematrix, (*m_plighttransform)[i]);
}
}
}
/*
====================
StudioEstimateGait
====================
*/
void CGameStudioModelRenderer::StudioEstimateGait( entity_state_t *pplayer )
{
float dt;
vec3_t est_velocity;
dt = (m_clTime - m_clOldTime);
dt = max( 0.0, dt );
dt = min( 1.0, dt );
if (dt == 0 || m_pPlayerInfo->renderframe == m_nFrameCount)
{
m_flGaitMovement = 0;
return;
}
// VectorAdd( pplayer->velocity, pplayer->prediction_error, est_velocity );
if ( m_fGaitEstimation )
{
VectorSubtract( m_pCurrentEntity->origin, m_pPlayerInfo->prevgaitorigin, est_velocity );
VectorCopy( m_pCurrentEntity->origin, m_pPlayerInfo->prevgaitorigin );
m_flGaitMovement = Length( est_velocity );
if (dt <= 0 || m_flGaitMovement / dt < 5)
{
m_flGaitMovement = 0;
est_velocity[0] = 0;
est_velocity[1] = 0;
}
}
else
{
VectorCopy( pplayer->velocity, est_velocity );
m_flGaitMovement = Length( est_velocity ) * dt;
}
if (est_velocity[1] == 0 && est_velocity[0] == 0)
{
float flYawDiff = m_pCurrentEntity->angles[YAW] - m_pPlayerInfo->gaityaw;
flYawDiff = flYawDiff - (int)(flYawDiff / 360) * 360;
if (flYawDiff > 180)
flYawDiff -= 360;
if (flYawDiff < -180)
flYawDiff += 360;
if (dt < 0.25)
flYawDiff *= dt * 4;
else
flYawDiff *= dt;
m_pPlayerInfo->gaityaw += flYawDiff;
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - (int)(m_pPlayerInfo->gaityaw / 360) * 360;
m_flGaitMovement = 0;
}
else
{
m_pPlayerInfo->gaityaw = (atan2(est_velocity[1], est_velocity[0]) * 180 / M_PI);
if (m_pPlayerInfo->gaityaw > 180)
m_pPlayerInfo->gaityaw = 180;
if (m_pPlayerInfo->gaityaw < -180)
m_pPlayerInfo->gaityaw = -180;
}
}
/*
====================
StudioProcessGait
====================
*/
void CGameStudioModelRenderer::StudioProcessGait( entity_state_t *pplayer )
{
mstudioseqdesc_t *pseqdesc;
float dt;
float flYaw; // view direction relative to movement
pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->curstate.sequence;
m_pCurrentEntity->angles[PITCH] = 0;
m_pCurrentEntity->latched.prevangles[PITCH] = m_pCurrentEntity->angles[PITCH];
dt = (m_clTime - m_clOldTime);
dt = max( 0.0, dt );
dt = min( 1.0, dt );
StudioEstimateGait( pplayer );
// calc side to side turning
flYaw = m_pCurrentEntity->angles[YAW] - m_pPlayerInfo->gaityaw;
flYaw = fmod( flYaw, 360.0 );
if (flYaw < -180)
{
flYaw = flYaw + 360;
}
else if (flYaw > 180)
{
flYaw = flYaw - 360;
}
float maxyaw = 120.0;
if (flYaw > maxyaw)
{
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - 180;
m_flGaitMovement = -m_flGaitMovement;
flYaw = flYaw - 180;
}
else if (flYaw < -maxyaw)
{
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw + 180;
m_flGaitMovement = -m_flGaitMovement;
flYaw = flYaw + 180;
}
float blend_yaw = ( flYaw / 90.0 ) * 128.0 + 127.0;
blend_yaw = min( 255.0, blend_yaw );
blend_yaw = max( 0.0, blend_yaw );
blend_yaw = 255.0 - blend_yaw;
m_pCurrentEntity->curstate.blending[0] = (int)(blend_yaw);
m_pCurrentEntity->latched.prevblending[0] = m_pCurrentEntity->curstate.blending[0];
m_pCurrentEntity->latched.prevseqblending[0] = m_pCurrentEntity->curstate.blending[0];
m_pCurrentEntity->angles[YAW] = m_pPlayerInfo->gaityaw;
if (m_pCurrentEntity->angles[YAW] < -0)
{
m_pCurrentEntity->angles[YAW] += 360;
}
m_pCurrentEntity->latched.prevangles[YAW] = m_pCurrentEntity->angles[YAW];
pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + pplayer->gaitsequence;
// Calc gait frame
if (pseqdesc->linearmovement[0] > 0)
{
m_pPlayerInfo->gaitframe += (m_flGaitMovement / pseqdesc->linearmovement[0]) * pseqdesc->numframes;
}
else
{
m_pPlayerInfo->gaitframe += pseqdesc->fps * dt * m_pCurrentEntity->curstate.framerate;
}
// Do modulo
m_pPlayerInfo->gaitframe = m_pPlayerInfo->gaitframe - (int)(m_pPlayerInfo->gaitframe / pseqdesc->numframes) * pseqdesc->numframes;
if (m_pPlayerInfo->gaitframe < 0)
{
m_pPlayerInfo->gaitframe += pseqdesc->numframes;
}
}
/*
==============================
SavePlayerState
For local player, in third person, we need to store real render data and then
setup for with fake/client side animation data
==============================
*/
void CGameStudioModelRenderer::SavePlayerState( entity_state_t *pplayer )
{
client_anim_state_t *st;
cl_entity_t *ent = IEngineStudio.GetCurrentEntity();
assert( ent );
if ( !ent )
return;
st = &g_state;
st->angles = ent->curstate.angles;
st->origin = ent->curstate.origin;
st->realangles = ent->angles;
st->sequence = ent->curstate.sequence;
st->gaitsequence = pplayer->gaitsequence;
st->animtime = ent->curstate.animtime;
st->frame = ent->curstate.frame;
st->framerate = ent->curstate.framerate;
memcpy( st->blending, ent->curstate.blending, 2 );
memcpy( st->controller, ent->curstate.controller, 4 );
st->lv = ent->latched;
}
void GetSequenceInfo( void *pmodel, client_anim_state_t *pev, float *pflFrameRate, float *pflGroundSpeed )
{
studiohdr_t *pstudiohdr;
pstudiohdr = (studiohdr_t *)pmodel;
if (! pstudiohdr)
return;
mstudioseqdesc_t *pseqdesc;
if (pev->sequence >= pstudiohdr->numseq)
{
*pflFrameRate = 0.0;
*pflGroundSpeed = 0.0;
return;
}
pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence;
if (pseqdesc->numframes > 1)
{
*pflFrameRate = 256 * pseqdesc->fps / (pseqdesc->numframes - 1);
*pflGroundSpeed = sqrt( pseqdesc->linearmovement[0]*pseqdesc->linearmovement[0]+ pseqdesc->linearmovement[1]*pseqdesc->linearmovement[1]+ pseqdesc->linearmovement[2]*pseqdesc->linearmovement[2] );
*pflGroundSpeed = *pflGroundSpeed * pseqdesc->fps / (pseqdesc->numframes - 1);
}
else
{
*pflFrameRate = 256.0;
*pflGroundSpeed = 0.0;
}
}
int GetSequenceFlags( void *pmodel, client_anim_state_t *pev )
{
studiohdr_t *pstudiohdr;
pstudiohdr = (studiohdr_t *)pmodel;
if ( !pstudiohdr || pev->sequence >= pstudiohdr->numseq )
return 0;
mstudioseqdesc_t *pseqdesc;
pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + (int)pev->sequence;
return pseqdesc->flags;
}
float StudioFrameAdvance ( client_anim_state_t *st, float framerate, float flInterval )
{
if (flInterval == 0.0)
{
flInterval = (gEngfuncs.GetClientTime() - st->animtime);
if (flInterval <= 0.001)
{
st->animtime = gEngfuncs.GetClientTime();
return 0.0;
}
}
if (!st->animtime)
flInterval = 0.0;
st->frame += flInterval * framerate * st->framerate;
st->animtime = gEngfuncs.GetClientTime();
if (st->frame < 0.0 || st->frame >= 256.0)
{
if ( st->m_fSequenceLoops )
st->frame -= (int)(st->frame / 256.0) * 256.0;
else
st->frame = (st->frame < 0.0) ? 0 : 255;
st->m_fSequenceFinished = TRUE; // just in case it wasn't caught in GetEvents
}
return flInterval;
}
/*
==============================
SetupClientAnimation
Called to set up local player's animation values
==============================
*/
void CGameStudioModelRenderer::SetupClientAnimation( entity_state_t *pplayer )
{
static double oldtime;
double curtime, dt;
client_anim_state_t *st;
float fr, gs;
cl_entity_t *ent = IEngineStudio.GetCurrentEntity();
assert( ent );
if ( !ent )
return;
curtime = gEngfuncs.GetClientTime();
dt = curtime - oldtime;
dt = min( 1.0, max( 0.0, dt ) );
oldtime = curtime;
st = &g_clientstate;
st->framerate = 1.0;
int oldseq = st->sequence;
Game_GetSequence( &st->sequence, &st->gaitsequence ); //CVAR_GET_FLOAT( "sequence" );
Game_GetOrientation( (float *)&st->origin, (float *)&st->angles );
st->realangles = st->angles;
if ( st->sequence != oldseq )
{
st->frame = 0.0;
st->lv.prevsequence = oldseq;
st->lv.sequencetime = st->animtime;
memcpy( st->lv.prevseqblending, st->blending, 2 );
memcpy( st->lv.prevcontroller, st->controller, 4 );
}
void *pmodel = (studiohdr_t *)IEngineStudio.Mod_Extradata( ent->model );
GetSequenceInfo( pmodel, st, &fr, &gs );
st->m_fSequenceLoops = ((GetSequenceFlags( pmodel, st ) & STUDIO_LOOPING) != 0);
StudioFrameAdvance( st, fr, dt );
// gEngfuncs.Con_Printf( "gs %i frame %f\n", st->gaitsequence, st->frame );
ent->angles = st->realangles;
ent->curstate.angles = st->angles;
ent->curstate.origin = st->origin;
ent->curstate.sequence = st->sequence;
pplayer->gaitsequence = st->gaitsequence;
ent->curstate.animtime = st->animtime;
ent->curstate.frame = st->frame;
ent->curstate.framerate = st->framerate;
memcpy( ent->curstate.blending, st->blending, 2 );
memcpy( ent->curstate.controller, st->controller, 4 );
ent->latched = st->lv;
}
/*
==============================
RestorePlayerState
Called to restore original player state information
==============================
*/
void CGameStudioModelRenderer::RestorePlayerState( entity_state_t *pplayer )
{
client_anim_state_t *st;
cl_entity_t *ent = IEngineStudio.GetCurrentEntity();
assert( ent );
if ( !ent )
return;
st = &g_clientstate;
st->angles = ent->curstate.angles;
st->origin = ent->curstate.origin;
st->realangles = ent->angles;
st->sequence = ent->curstate.sequence;
st->gaitsequence = pplayer->gaitsequence;
st->animtime = ent->curstate.animtime;
st->frame = ent->curstate.frame;
st->framerate = ent->curstate.framerate;
memcpy( st->blending, ent->curstate.blending, 2 );
memcpy( st->controller, ent->curstate.controller, 4 );
st->lv = ent->latched;
st = &g_state;
ent->curstate.angles = st->angles;
ent->curstate.origin = st->origin;
ent->angles = st->realangles;
ent->curstate.sequence = st->sequence;
pplayer->gaitsequence = st->gaitsequence;
ent->curstate.animtime = st->animtime;
ent->curstate.frame = st->frame;
ent->curstate.framerate = st->framerate;
memcpy( ent->curstate.blending, st->blending, 2 );
memcpy( ent->curstate.controller, st->controller, 4 );
ent->latched = st->lv;
}
/*
==============================
StudioDrawPlayer
==============================
*/
int CGameStudioModelRenderer::StudioDrawPlayer( int flags, entity_state_t *pplayer )
{
int iret = 0;
bool isLocalPlayer = false;
// Set up for client?
if ( m_bLocal && IEngineStudio.GetCurrentEntity() == gEngfuncs.GetLocalPlayer() )
{
isLocalPlayer = true;
}
if ( isLocalPlayer )
{
// Store original data
SavePlayerState( pplayer );
// Copy in client side animation data
SetupClientAnimation( pplayer );
}
// Call real draw function
iret = _StudioDrawPlayer( flags, pplayer );
// Restore for client?
if ( isLocalPlayer )
{
// Restore the original data for the player
RestorePlayerState( pplayer );
}
return iret;
}
/*
====================
_StudioDrawPlayer
====================
*/
int CGameStudioModelRenderer::_StudioDrawPlayer( int flags, entity_state_t *pplayer )
{
alight_t lighting;
vec3_t dir;
m_pCurrentEntity = IEngineStudio.GetCurrentEntity();
IEngineStudio.GetTimes( &m_nFrameCount, &m_clTime, &m_clOldTime );
IEngineStudio.GetViewInfo( m_vRenderOrigin, m_vUp, m_vRight, m_vNormal );
IEngineStudio.GetAliasScale( &m_fSoftwareXScale, &m_fSoftwareYScale );
m_nPlayerIndex = pplayer->number - 1;
if (m_nPlayerIndex < 0 || m_nPlayerIndex >= gEngfuncs.GetMaxClients())
return 0;
m_pRenderModel = IEngineStudio.SetupPlayerModel( m_nPlayerIndex );
if (m_pRenderModel == NULL)
return 0;
m_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata (m_pRenderModel);
IEngineStudio.StudioSetHeader( m_pStudioHeader );
IEngineStudio.SetRenderModel( m_pRenderModel );
if (pplayer->gaitsequence)
{
vec3_t orig_angles;
m_pPlayerInfo = IEngineStudio.PlayerInfo( m_nPlayerIndex );
VectorCopy( m_pCurrentEntity->angles, orig_angles );
StudioProcessGait( pplayer );
m_pPlayerInfo->gaitsequence = pplayer->gaitsequence;
m_pPlayerInfo = NULL;
StudioSetUpTransform( 0 );
VectorCopy( orig_angles, m_pCurrentEntity->angles );
}
else
{
m_pCurrentEntity->curstate.controller[0] = 127;
m_pCurrentEntity->curstate.controller[1] = 127;
m_pCurrentEntity->curstate.controller[2] = 127;
m_pCurrentEntity->curstate.controller[3] = 127;
m_pCurrentEntity->latched.prevcontroller[0] = m_pCurrentEntity->curstate.controller[0];
m_pCurrentEntity->latched.prevcontroller[1] = m_pCurrentEntity->curstate.controller[1];
m_pCurrentEntity->latched.prevcontroller[2] = m_pCurrentEntity->curstate.controller[2];
m_pCurrentEntity->latched.prevcontroller[3] = m_pCurrentEntity->curstate.controller[3];
m_pPlayerInfo = IEngineStudio.PlayerInfo( m_nPlayerIndex );
m_pPlayerInfo->gaitsequence = 0;
StudioSetUpTransform( 0 );
}
if (flags & STUDIO_RENDER)
{
// see if the bounding box lets us trivially reject, also sets
if (!IEngineStudio.StudioCheckBBox ())
return 0;
(*m_pModelsDrawn)++;
(*m_pStudioModelCount)++; // render data cache cookie
if (m_pStudioHeader->numbodyparts == 0)
return 1;
}
m_pPlayerInfo = IEngineStudio.PlayerInfo( m_nPlayerIndex );
StudioSetupBones( );
StudioSaveBones( );
m_pPlayerInfo->renderframe = m_nFrameCount;
m_pPlayerInfo = NULL;
if (flags & STUDIO_EVENTS)
{
StudioCalcAttachments( );
IEngineStudio.StudioClientEvents( );
// copy attachments into global entity array
if ( m_pCurrentEntity->index > 0 )
{
cl_entity_t *ent = gEngfuncs.GetEntityByIndex( m_pCurrentEntity->index );
memcpy( ent->attachment, m_pCurrentEntity->attachment, sizeof( vec3_t ) * 4 );
}
}
if (flags & STUDIO_RENDER)
{
/*
if (m_pCvarHiModels->value && m_pRenderModel != m_pCurrentEntity->model )
{
// show highest resolution multiplayer model
m_pCurrentEntity->curstate.body = 255;
}
if (!(m_pCvarDeveloper->value == 0 && gEngfuncs.GetMaxClients() == 1 ) && ( m_pRenderModel == m_pCurrentEntity->model ) )
{
m_pCurrentEntity->curstate.body = 1; // force helmet
}
*/
lighting.plightvec = dir;
IEngineStudio.StudioDynamicLight(m_pCurrentEntity, &lighting );
IEngineStudio.StudioEntityLight( &lighting );
// model and frame independant
IEngineStudio.StudioSetupLighting (&lighting);
m_pPlayerInfo = IEngineStudio.PlayerInfo( m_nPlayerIndex );
// get remap colors
m_nTopColor = m_pPlayerInfo->topcolor;
if (m_nTopColor < 0)
m_nTopColor = 0;
if (m_nTopColor > 360)
m_nTopColor = 360;
m_nBottomColor = m_pPlayerInfo->bottomcolor;
if (m_nBottomColor < 0)
m_nBottomColor = 0;
if (m_nBottomColor > 360)
m_nBottomColor = 360;
IEngineStudio.StudioSetRemapColors( m_nTopColor, m_nBottomColor );
StudioRenderModel( );
m_pPlayerInfo = NULL;
if (pplayer->weaponmodel)
{
cl_entity_t saveent = *m_pCurrentEntity;
model_t *pweaponmodel = IEngineStudio.GetModelByIndex( pplayer->weaponmodel );
m_pStudioHeader = (studiohdr_t *)IEngineStudio.Mod_Extradata (pweaponmodel);
IEngineStudio.StudioSetHeader( m_pStudioHeader );
StudioMergeBones( pweaponmodel);
IEngineStudio.StudioSetupLighting (&lighting);
StudioRenderModel( );
StudioCalcAttachments( );
*m_pCurrentEntity = saveent;
}
}
return 1;
}
/*
====================
Studio_FxTransform
====================
*/
void CGameStudioModelRenderer::StudioFxTransform( cl_entity_t *ent, float transform[3][4] )
{
switch( ent->curstate.renderfx )
{
case kRenderFxDistort:
case kRenderFxHologram:
if ( gEngfuncs.pfnRandomLong(0,49) == 0 )
{
int axis = gEngfuncs.pfnRandomLong(0,1);
if ( axis == 1 ) // Choose between x & z
axis = 2;
VectorScale( transform[axis], gEngfuncs.pfnRandomFloat(1,1.484), transform[axis] );
}
else if ( gEngfuncs.pfnRandomLong(0,49) == 0 )
{
float offset;
int axis = gEngfuncs.pfnRandomLong(0,1);
if ( axis == 1 ) // Choose between x & z
axis = 2;
offset = gEngfuncs.pfnRandomFloat(-10,10);
transform[gEngfuncs.pfnRandomLong(0,2)][3] += offset;
}
break;
case kRenderFxExplode:
{
if ( iRenderStateChanged )
{
g_flStartScaleTime = m_clTime;
iRenderStateChanged = FALSE;
}
// Make the Model continue to shrink
float flTimeDelta = m_clTime - g_flStartScaleTime;
if ( flTimeDelta > 0 )
{
float flScale = 0.001;
// Goes almost all away
if ( flTimeDelta <= 2.0 )
flScale = 1.0 - (flTimeDelta / 2.0);
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
transform[i][j] *= flScale;
}
}
}
break;
}
}
////////////////////////////////////
// Hooks to class implementation
////////////////////////////////////
/*
====================
R_StudioDrawPlayer
====================
*/
int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
{
return g_StudioRenderer.StudioDrawPlayer( flags, pplayer );
}
/*
====================
R_StudioDrawModel
====================
*/
int R_StudioDrawModel( int flags )
{
return g_StudioRenderer.StudioDrawModel( flags );
}
/*
====================
R_StudioInit
====================
*/
void R_StudioInit( void )
{
g_StudioRenderer.Init();
}
// The simple drawing interface we'll pass back to the engine
r_studio_interface_t studio =
{
STUDIO_INTERFACE_VERSION,
R_StudioDrawModel,
R_StudioDrawPlayer,
};
/*
====================
HUD_GetStudioModelInterface
Export this function for the engine to use the studio renderer class to render objects.
====================
*/
#define DLLEXPORT __declspec( dllexport )
extern "C" int DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio )
{
if ( version != STUDIO_INTERFACE_VERSION )
return 0;
// Point the engine to our callbacks
*ppinterface = &studio;
// Copy in engine helper functions
memcpy( &IEngineStudio, pstudio, sizeof( IEngineStudio ) );
// Initialize local variables, etc.
R_StudioInit();
// Success
return 1;
}

55
cl_dll/GameStudioModelRenderer_Sample.h

@ -0,0 +1,55 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if !defined( GAMESTUDIOMODELRENDERER_H )
#define GAMESTUDIOMODELRENDERER_H
#if defined( _WIN32 )
#pragma once
#endif
/*
====================
CGameStudioModelRenderer
====================
*/
class CGameStudioModelRenderer : public CStudioModelRenderer
{
public:
CGameStudioModelRenderer( void );
// Set up model bone positions
virtual void StudioSetupBones ( void );
// Estimate gait frame for player
virtual void StudioEstimateGait ( entity_state_t *pplayer );
// Process movement of player
virtual void StudioProcessGait ( entity_state_t *pplayer );
// Player drawing code
virtual int StudioDrawPlayer( int flags, entity_state_t *pplayer );
virtual int _StudioDrawPlayer( int flags, entity_state_t *pplayer );
// Apply special effects to transform matrix
virtual void StudioFxTransform( cl_entity_t *ent, float transform[3][4] );
private:
// For local player, in third person, we need to store real render data and then
// setup for with fake/client side animation data
void SavePlayerState( entity_state_t *pplayer );
// Called to set up local player's animation values
void SetupClientAnimation( entity_state_t *pplayer );
// Called to restore original player state information
void RestorePlayerState( entity_state_t *pplayer );
private:
// Private data
bool m_bLocal;
};
#endif // GAMESTUDIOMODELRENDERER_H

165
cl_dll/MOTD.cpp

@ -0,0 +1,165 @@
/***
*
* Copyright (c) 1999, 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.
*
****/
//
// MOTD.cpp
//
// for displaying a server-sent message of the day
//
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
#include "kbutton.h"
#include "triangleapi.h"
#include <string.h>
#include <stdio.h>
DECLARE_MESSAGE( m_MOTD, MOTD );
int CHudMOTD :: Init( void )
{
gHUD.AddHudElem( this );
HOOK_MESSAGE( MOTD );
m_bShow = false;
m_iFlags &= ~HUD_ACTIVE; // start out inactive
m_szMOTD[0] = 0;
return 1;
}
int CHudMOTD :: VidInit( void )
{
// Load sprites here
return 1;
}
void CHudMOTD :: Reset( void )
{
m_iFlags &= ~HUD_ACTIVE; // start out inactive
m_szMOTD[0] = 0;
m_iLines = 0;
m_bShow = 0;
}
#define LINE_HEIGHT 13
#define ROW_GAP 13
#define ROW_RANGE_MIN 30
#define ROW_RANGE_MAX ( ScreenHeight - 100 )
int CHudMOTD :: Draw( float fTime )
{
gHUD.m_iNoConsolePrint &= ~( 1 << 1 );
if( !m_bShow )
return 1;
gHUD.m_iNoConsolePrint |= 1 << 1;
bool bScroll;
// find the top of where the MOTD should be drawn, so the whole thing is centered in the screen
int ypos = (ScreenHeight - LINE_HEIGHT * m_iLines)/2; // shift it up slightly
char *ch = m_szMOTD;
int xpos = (ScreenWidth - gHUD.m_scrinfo.charWidths[ 'M' ] * m_iMaxLength) / 2;
if( xpos < 30 ) xpos = 30;
int xmax = xpos + gHUD.m_scrinfo.charWidths[ 'M' ] * m_iMaxLength;
int height = LINE_HEIGHT * m_iLines;
int ypos_r=ypos;
if( height > ROW_RANGE_MAX )
{
ypos = ROW_RANGE_MIN + 7 + scroll;
if( ypos > ROW_RANGE_MIN + 4 )
scroll-= (ypos - ( ROW_RANGE_MIN + 4))/3.0;
if( ypos + height < ROW_RANGE_MAX )
scroll+= (ROW_RANGE_MAX - (ypos + height))/ 3.0;
ypos_r = ROW_RANGE_MIN;
height = ROW_RANGE_MAX;
}
int ymax = ypos + height;
if( xmax > ScreenWidth - 30 ) xmax = ScreenWidth - 30;
gHUD.DrawDarkRectangle(xpos-5, ypos_r - 5, xmax - xpos+10, height + 10);
while ( *ch )
{
int line_length = 0; // count the length of the current line
for ( char *next_line = ch; *next_line != '\n' && *next_line != 0; next_line++ )
line_length += gHUD.m_scrinfo.charWidths[ *next_line ];
char *top = next_line;
if ( *top == '\n' )
*top = 0;
else
top = NULL;
// find where to start drawing the line
if( (ypos > ROW_RANGE_MIN) && (ypos + LINE_HEIGHT <= ypos_r + height) )
gHUD.DrawHudString( xpos, ypos, xmax, ch, 255, 180, 0 );
ypos += LINE_HEIGHT;
if ( top ) // restore
*top = '\n';
ch = next_line;
if ( *ch == '\n' )
ch++;
if ( ypos > (ScreenHeight - 20) )
break; // don't let it draw too low
}
return 1;
}
int CHudMOTD :: MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
{
if ( m_iFlags & HUD_ACTIVE )
{
Reset(); // clear the current MOTD in prep for this one
}
BEGIN_READ( pbuf, iSize );
int is_finished = READ_BYTE();
strncat( m_szMOTD, READ_STRING(), sizeof(m_szMOTD) );
if ( is_finished )
{
int length = 0;
m_iMaxLength = 0;
m_iFlags |= HUD_ACTIVE;
for ( char *sz = m_szMOTD; *sz != 0; sz++ ) // count the number of lines in the MOTD
{
if ( *sz == '\n' )
{
m_iLines++;
if( length > m_iMaxLength )
{
m_iMaxLength = length;
length = 0;
}
}
length++;
}
m_iLines++;
if( length > m_iMaxLength )
{
m_iMaxLength = length;
length = 0;
}
m_bShow = true;
}
return 1;
}

1703
cl_dll/StudioModelRenderer.cpp

File diff suppressed because it is too large

189
cl_dll/StudioModelRenderer.h

@ -0,0 +1,189 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#if !defined ( STUDIOMODELRENDERER_H )
#define STUDIOMODELRENDERER_H
#if defined( _WIN32 )
#pragma once
#endif
/*
====================
CStudioModelRenderer
====================
*/
class CStudioModelRenderer
{
public:
// Construction/Destruction