From 2e868e115679a95d7152b5bdbb05db7e6fb85c28 Mon Sep 17 00:00:00 2001 From: Justin <95296300+Toodles2You@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:53:27 -0700 Subject: [PATCH] Remove obsolete client code --- cl_dll/GameStudioModelRenderer.cpp | 2 - cl_dll/StudioModelRenderer.cpp | 70 +---- cl_dll/ammo.h | 1 - cl_dll/cdll_int.cpp | 30 --- cl_dll/cl_util.h | 2 - cl_dll/com_weapons.cpp | 2 - cl_dll/com_weapons.h | 2 - cl_dll/demo.cpp | 2 - cl_dll/entity.cpp | 109 -------- cl_dll/ev_hldm.cpp | 22 +- cl_dll/ev_hldm.h | 2 - cl_dll/geiger.cpp | 25 +- cl_dll/global_consts.h | 1 - cl_dll/hl/hl_weapons.cpp | 19 +- cl_dll/hud.cpp | 14 - cl_dll/hud.h | 2 - cl_dll/hud_redraw.cpp | 25 -- cl_dll/hud_spectator.cpp | 41 --- cl_dll/hud_spectator.h | 1 - cl_dll/hud_update.cpp | 6 - cl_dll/in_camera.cpp | 87 +----- cl_dll/input.cpp | 10 - cl_dll/inputw32.cpp | 12 - cl_dll/overview.cpp | 160 ----------- cl_dll/overview.h | 31 --- cl_dll/readme.txt | 107 -------- cl_dll/studio_util.h | 2 - cl_dll/tri.cpp | 5 - cl_dll/vgui_CustomObjects.cpp | 12 - cl_dll/vgui_ScorePanel.h | 1 - cl_dll/vgui_SpectatorPanel.cpp | 2 - cl_dll/vgui_TeamFortressViewport.h | 1 - cl_dll/vgui_int.cpp | 11 - cl_dll/view.cpp | 224 +--------------- cl_dll/view.h | 1 + cl_dll/voice_status.cpp | 14 +- game_shared/voice_status_hud.cpp | 399 ---------------------------- game_shared/voice_status_hud.h | 154 ----------- game_shared/voice_vgui_tweakdlg.cpp | 289 -------------------- game_shared/voice_vgui_tweakdlg.h | 25 -- 40 files changed, 25 insertions(+), 1900 deletions(-) delete mode 100644 cl_dll/overview.cpp delete mode 100644 cl_dll/overview.h delete mode 100644 cl_dll/readme.txt delete mode 100644 game_shared/voice_status_hud.cpp delete mode 100644 game_shared/voice_status_hud.h delete mode 100644 game_shared/voice_vgui_tweakdlg.cpp delete mode 100644 game_shared/voice_vgui_tweakdlg.h diff --git a/cl_dll/GameStudioModelRenderer.cpp b/cl_dll/GameStudioModelRenderer.cpp index c332edda0..ca3114a49 100644 --- a/cl_dll/GameStudioModelRenderer.cpp +++ b/cl_dll/GameStudioModelRenderer.cpp @@ -101,8 +101,6 @@ Export this function for the engine to use the studio renderer class to render o */ int DLLEXPORT HUD_GetStudioModelInterface(int version, struct r_studio_interface_s** ppinterface, struct engine_studio_api_s* pstudio) { - // RecClStudioInterface(version, ppinterface, pstudio); - if (version != STUDIO_INTERFACE_VERSION) return 0; diff --git a/cl_dll/StudioModelRenderer.cpp b/cl_dll/StudioModelRenderer.cpp index 3edcd499d..0f3a4b3bb 100644 --- a/cl_dll/StudioModelRenderer.cpp +++ b/cl_dll/StudioModelRenderer.cpp @@ -31,8 +31,6 @@ extern extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS_HUD + 1]; #define TEAM3_COLOR 45 #define TEAM4_COLOR 100 -int m_nPlayerGaitSequences[MAX_PLAYERS]; - // Global engine <-> studio model rendering code interface engine_studio_api_t IEngineStudio; @@ -144,7 +142,6 @@ void CStudioModelRenderer::StudioCalcBoneAdj(float dadt, float* adj, const byte* value = 1.0; value = (1.0 - value) * pbonecontroller[j].start + value * pbonecontroller[j].end; } - // Con_DPrintf( "%d %d %f : %f\n", m_pCurrentEntity->curstate.controller[j], m_pCurrentEntity->latched.prevcontroller[j], value, dadt ); } else { @@ -152,7 +149,6 @@ void CStudioModelRenderer::StudioCalcBoneAdj(float dadt, float* adj, const byte* if (value > 1.0) value = 1.0; value = (1.0 - value) * pbonecontroller[j].start + value * pbonecontroller[j].end; - // Con_DPrintf("%d %f\n", mouthopen, value ); } switch (pbonecontroller[j].type & STUDIO_TYPES) { @@ -274,10 +270,6 @@ void CStudioModelRenderer::StudioCalcBonePosition(int frame, float s, mstudiobon if (panim->offset[j] != 0) { panimvalue = (mstudioanimvalue_t*)((byte*)panim + panim->offset[j]); - /* - if (i == 0 && j == 0) - Con_DPrintf("%d %d:%d %f\n", frame, panimvalue->num.valid, panimvalue->num.total, s ); - */ k = frame; // DEBUG @@ -434,8 +426,6 @@ void CStudioModelRenderer::StudioSetUpTransform(bool trivial_accept) Vector modelpos; // tweek model origin - //for (i = 0; i < 3; i++) - // modelpos[i] = m_pCurrentEntity->origin[i]; VectorCopy(m_pCurrentEntity->origin, modelpos); @@ -446,8 +436,6 @@ void CStudioModelRenderer::StudioSetUpTransform(bool trivial_accept) angles[PITCH] = m_pCurrentEntity->curstate.angles[PITCH]; angles[YAW] = m_pCurrentEntity->curstate.angles[YAW]; - //Con_DPrintf("Angles %4.2f prev %4.2f for %i\n", angles[PITCH], m_pCurrentEntity->index); - //Con_DPrintf("movetype %d %d\n", m_pCurrentEntity->movetype, m_pCurrentEntity->aiment ); if (m_pCurrentEntity->curstate.movetype == MOVETYPE_STEP) { float f = 0; @@ -462,7 +450,6 @@ void CStudioModelRenderer::StudioSetUpTransform(bool trivial_accept) (m_pCurrentEntity->curstate.animtime != m_pCurrentEntity->latched.prevanimtime)) { f = (m_clTime - m_pCurrentEntity->curstate.animtime) / (m_pCurrentEntity->curstate.animtime - m_pCurrentEntity->latched.prevanimtime); - //Con_DPrintf("%4.2f %.2f %.2f\n", f, m_pCurrentEntity->curstate.animtime, m_clTime); } if (m_fDoInterp) @@ -485,11 +472,6 @@ void CStudioModelRenderer::StudioSetUpTransform(bool trivial_accept) } } - // NOTE: Because multiplayer lag can be relatively large, we don't want to cap - // f at 1.5 anymore. - //if (f > -1.0 && f < 1.5) {} - - // Con_DPrintf("%.0f %.0f\n",m_pCurrentEntity->msg_angles[0][YAW], m_pCurrentEntity->msg_angles[1][YAW] ); for (i = 0; i < 3; i++) { float ang1, ang2; @@ -509,16 +491,12 @@ void CStudioModelRenderer::StudioSetUpTransform(bool trivial_accept) angles[i] += d * f; } - //Con_DPrintf("%.3f \n", f ); } else if (m_pCurrentEntity->curstate.movetype != MOVETYPE_NONE) { VectorCopy(m_pCurrentEntity->angles, angles); } - //Con_DPrintf("%.0f %0.f %0.f\n", modelpos[0], modelpos[1], modelpos[2] ); - //Con_DPrintf("%.0f %0.f %0.f\n", angles[0], angles[1], angles[2] ); - angles[PITCH] = -angles[PITCH]; AngleMatrix(angles, (*m_protationmatrix)); @@ -612,13 +590,6 @@ void CStudioModelRenderer::StudioCalcRotations(float pos[][3], vec4_t* q, mstudi frame = (int)f; - // Con_DPrintf("%d %.4f %.4f %.4f %.4f %d\n", m_pCurrentEntity->curstate.sequence, m_clTime, m_pCurrentEntity->animtime, m_pCurrentEntity->frame, f, frame ); - - // Con_DPrintf( "%f %f %f\n", m_pCurrentEntity->angles[ROLL], m_pCurrentEntity->angles[PITCH], m_pCurrentEntity->angles[YAW] ); - - // Con_DPrintf("frame %d %d\n", frame1, frame2 ); - - dadt = StudioEstimateInterpolant(); s = (f - frame); @@ -632,8 +603,6 @@ void CStudioModelRenderer::StudioCalcRotations(float pos[][3], vec4_t* q, mstudi StudioCalcBoneQuaterion(frame, s, pbone, panim, adj, q[i]); StudioCalcBonePosition(frame, s, pbone, panim, adj, pos[i]); - // if (0 && i == 0) - // Con_DPrintf("%d %d %d %d\n", m_pCurrentEntity->curstate.sequence, frame, j, k ); } if ((pseqdesc->motiontype & STUDIO_X) != 0) @@ -804,29 +773,8 @@ void CStudioModelRenderer::StudioSetupBones() pseqdesc = (mstudioseqdesc_t*)((byte*)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pCurrentEntity->curstate.sequence; - // always want new gait sequences to start on frame zero - /* if ( m_pPlayerInfo ) - { - int playerNum = m_pCurrentEntity->index - 1; - - // new jump gaitsequence? start from frame zero - if ( m_nPlayerGaitSequences[ playerNum ] != m_pPlayerInfo->gaitsequence ) - { - // m_pPlayerInfo->gaitframe = 0.0; - gEngfuncs.Con_Printf( "Setting gaitframe to 0\n" ); - } - - m_nPlayerGaitSequences[ playerNum ] = m_pPlayerInfo->gaitsequence; -// gEngfuncs.Con_Printf( "index: %d gaitsequence: %d\n",playerNum, m_pPlayerInfo->gaitsequence); - } -*/ f = StudioEstimateFrame(pseqdesc); - if (m_pCurrentEntity->latched.prevframe > f) - { - //Con_DPrintf("%f %f\n", m_pCurrentEntity->prevframe, f ); - } - panim = StudioGetAnim(m_pRenderModel, pseqdesc); StudioCalcRotations(pos, q, pseqdesc, panim, f); @@ -908,7 +856,6 @@ void CStudioModelRenderer::StudioSetupBones() } else { - //Con_DPrintf("prevframe = %4.2f\n", f); m_pCurrentEntity->latched.prevframe = f; } @@ -976,9 +923,6 @@ void CStudioModelRenderer::StudioSetupBones() if (0 != IEngineStudio.IsHardware()) { ConcatTransforms((*m_protationmatrix), bonematrix, (*m_pbonetransform)[i]); - - // MatrixCopy should be faster... - //ConcatTransforms ((*m_protationmatrix), bonematrix, (*m_plighttransform)[i]); MatrixCopy((*m_pbonetransform)[i], (*m_plighttransform)[i]); } else @@ -1051,11 +995,6 @@ void CStudioModelRenderer::StudioMergeBones(model_t* m_pSubModel) f = StudioEstimateFrame(pseqdesc); - if (m_pCurrentEntity->latched.prevframe > f) - { - //Con_DPrintf("%f %f\n", m_pCurrentEntity->prevframe, f ); - } - panim = StudioGetAnim(m_pSubModel, pseqdesc); StudioCalcRotations(pos, q, pseqdesc, panim, f); @@ -1086,9 +1025,6 @@ void CStudioModelRenderer::StudioMergeBones(model_t* m_pSubModel) if (0 != IEngineStudio.IsHardware()) { ConcatTransforms((*m_protationmatrix), bonematrix, (*m_pbonetransform)[i]); - - // MatrixCopy should be faster... - //ConcatTransforms ((*m_protationmatrix), bonematrix, (*m_plighttransform)[i]); MatrixCopy((*m_pbonetransform)[i], (*m_plighttransform)[i]); } else @@ -1137,7 +1073,7 @@ bool CStudioModelRenderer::StudioDrawModel(int flags) return false; // get copy of player - deadplayer = *(IEngineStudio.GetPlayerState(m_pCurrentEntity->curstate.renderamt - 1)); //cl.frames[cl.parsecount & CL_UPDATE_MASK].playerstate[m_pCurrentEntity->curstate.renderamt-1]; + deadplayer = *(IEngineStudio.GetPlayerState(m_pCurrentEntity->curstate.renderamt - 1)); // clear weapon, movement state deadplayer.number = m_pCurrentEntity->curstate.renderamt; @@ -1323,8 +1259,6 @@ void CStudioModelRenderer::StudioProcessGait(entity_state_t* pplayer) m_pCurrentEntity->latched.prevblending[0] = m_pCurrentEntity->curstate.blending[0]; m_pCurrentEntity->latched.prevseqblending[0] = m_pCurrentEntity->curstate.blending[0]; - // Con_DPrintf("%f %d\n", m_pCurrentEntity->angles[PITCH], m_pCurrentEntity->blending[0] ); - dt = (m_clTime - m_clOldTime); if (dt < 0) dt = 0; @@ -1333,8 +1267,6 @@ void CStudioModelRenderer::StudioProcessGait(entity_state_t* pplayer) StudioEstimateGait(pplayer); - // Con_DPrintf("%f %f\n", m_pCurrentEntity->angles[YAW], m_pPlayerInfo->gaityaw ); - // calc side to side turning flYaw = m_pCurrentEntity->angles[YAW] - m_pPlayerInfo->gaityaw; flYaw = flYaw - (int)(flYaw / 360) * 360; diff --git a/cl_dll/ammo.h b/cl_dll/ammo.h index 328acfe7f..88d32b36b 100644 --- a/cl_dll/ammo.h +++ b/cl_dll/ammo.h @@ -17,7 +17,6 @@ #define MAX_WEAPON_NAME 128 - #define WEAPON_FLAGS_SELECTONEMPTY 1 #define WEAPON_IS_ONTARGET 0x40 diff --git a/cl_dll/cdll_int.cpp b/cl_dll/cdll_int.cpp index de9efcd07..f9d0534c8 100644 --- a/cl_dll/cdll_int.cpp +++ b/cl_dll/cdll_int.cpp @@ -24,7 +24,6 @@ #include "cl_util.h" #include "netadr.h" #include "interface.h" -//#include "vgui_schememanager.h" #include "pm_shared.h" @@ -42,7 +41,6 @@ cl_enginefunc_t gEngfuncs; CHud gHUD; TeamFortressViewport* gViewPort = NULL; - #include "particleman.h" IParticleMan* g_pParticleMan = nullptr; @@ -75,8 +73,6 @@ HUD_ConnectionlessPacket */ int DLLEXPORT HUD_ConnectionlessPacket(const struct netadr_s* net_from, const char* args, char* response_buffer, int* response_buffer_size) { - // RecClConnectionlessPacket(net_from, args, response_buffer, response_buffer_size); - // Parse stuff from args int max_buffer_size = *response_buffer_size; @@ -91,22 +87,16 @@ int DLLEXPORT HUD_ConnectionlessPacket(const struct netadr_s* net_from, const ch void DLLEXPORT HUD_PlayerMoveInit(struct playermove_s* ppmove) { - // RecClClientMoveInit(ppmove); - PM_Init(ppmove); } char DLLEXPORT HUD_PlayerMoveTexture(char* name) { - // RecClClientTextureType(name); - return PM_FindTextureType(name); } void DLLEXPORT HUD_PlayerMove(struct playermove_s* ppmove, int server) { - // RecClClientMove(ppmove, server); - PM_Move(ppmove, server); } @@ -136,8 +126,6 @@ int DLLEXPORT Initialize(cl_enginefunc_t* pEnginefuncs, int iVersion) { gEngfuncs = *pEnginefuncs; - // RecClInitialize(pEnginefuncs, iVersion); - if (iVersion != CLDLL_INTERFACE_VERSION) return 0; @@ -168,7 +156,6 @@ so the HUD can reinitialize itself. int DLLEXPORT HUD_VidInit() { - // RecClHudVidInit(); gHUD.VidInit(); VGui_Startup(); @@ -188,7 +175,6 @@ the hud variables. void DLLEXPORT HUD_Init() { - // RecClHudInit(); InitInput(); gHUD.Init(); Scheme_Init(); @@ -206,8 +192,6 @@ redraw the HUD. int DLLEXPORT HUD_Redraw(float time, int intermission) { - // RecClHudRedraw(time, intermission); - gHUD.Redraw(time, 0 != intermission); return 1; @@ -229,8 +213,6 @@ returns 1 if anything has been changed, 0 otherwise. int DLLEXPORT HUD_UpdateClientData(client_data_t* pcldata, float flTime) { - // RecClHudUpdateClientData(pcldata, flTime); - IN_Commands(); return static_cast(gHUD.UpdateClientData(pcldata, flTime)); @@ -246,8 +228,6 @@ Called at start and end of demos to restore to "non"HUD state. void DLLEXPORT HUD_Reset() { - // RecClHudReset(); - gHUD.VidInit(); } @@ -261,8 +241,6 @@ Called by engine every frame that client .dll is loaded void DLLEXPORT HUD_Frame(double time) { - // RecClHudFrame(time); - GetClientVoiceMgr()->Frame(time); } @@ -277,8 +255,6 @@ Called when a player starts or stops talking. void DLLEXPORT HUD_VoiceStatus(int entindex, qboolean bTalking) { - //// RecClVoiceStatus(entindex, bTalking); - GetClientVoiceMgr()->UpdateSpeakerStatus(entindex, 0 != bTalking); } @@ -292,8 +268,6 @@ Called when a director event message was received void DLLEXPORT HUD_DirectorMessage(int iSize, void* pbuf) { - // RecClDirectorMessage(iSize, pbuf); - gHUD.m_Spectator.DirectorMessage(iSize, pbuf); } @@ -378,10 +352,6 @@ class CClientExports : public IGameClientExports // returns the name of the server the user is connected to, if any const char* GetServerHostName() override { - /*if (gViewPortInterface) - { - return gViewPortInterface->GetServerName(); - }*/ return ""; } diff --git a/cl_dll/cl_util.h b/cl_dll/cl_util.h index 824c2d59f..34b67a547 100644 --- a/cl_dll/cl_util.h +++ b/cl_dll/cl_util.h @@ -68,8 +68,6 @@ inline struct cvar_s* CVAR_CREATE(const char* cv, const char* val, const int fla // ScreenWidth returns the width of the screen, in pixels #define ScreenWidth (gHUD.m_scrinfo.iWidth) -#define BASE_XRES 640.f - // use this to project world coordinates to screen coordinates #define XPROJECT(x) ((1.0f + (x)) * ScreenWidth * 0.5f) #define YPROJECT(y) ((1.0f - (y)) * ScreenHeight * 0.5f) diff --git a/cl_dll/com_weapons.cpp b/cl_dll/com_weapons.cpp index 8c1ce9e5b..2badb5b6a 100644 --- a/cl_dll/com_weapons.cpp +++ b/cl_dll/com_weapons.cpp @@ -273,6 +273,4 @@ stub functions for such things as precaching. So we don't have to modify weapon */ int stub_PrecacheModel(const char* s) { return 0; } int stub_PrecacheSound(const char* s) { return 0; } -unsigned short stub_PrecacheEvent(int type, const char* s) { return 0; } -const char* stub_NameForFunction(uint32 function) { return "func"; } void stub_SetModel(edict_t* e, const char* m) {} diff --git a/cl_dll/com_weapons.h b/cl_dll/com_weapons.h index 5141c0572..68669abc3 100644 --- a/cl_dll/com_weapons.h +++ b/cl_dll/com_weapons.h @@ -25,8 +25,6 @@ void HUD_PlaybackEvent(int flags, const struct edict_s* pInvoker, unsigned short void HUD_SetMaxSpeed(const struct edict_s* ed, float speed); int stub_PrecacheModel(const char* s); int stub_PrecacheSound(const char* s); -unsigned short stub_PrecacheEvent(int type, const char* s); -const char* stub_NameForFunction(uint32 function); void stub_SetModel(struct edict_s* e, const char* m); diff --git a/cl_dll/demo.cpp b/cl_dll/demo.cpp index 64cc01374..8dd577c83 100644 --- a/cl_dll/demo.cpp +++ b/cl_dll/demo.cpp @@ -56,8 +56,6 @@ Engine wants us to parse some data from the demo stream */ void DLLEXPORT Demo_ReadBuffer(int size, unsigned char* buffer) { - // RecClReadDemoBuffer(size, buffer); - int type; int i = 0; diff --git a/cl_dll/entity.cpp b/cl_dll/entity.cpp index 4beef0a11..c163b720a 100644 --- a/cl_dll/entity.cpp +++ b/cl_dll/entity.cpp @@ -31,8 +31,6 @@ HUD_AddEntity */ int DLLEXPORT HUD_AddEntity(int type, struct cl_entity_s* ent, const char* modelname) { - // RecClAddEntity(type, ent, modelname); - switch (type) { case ET_NORMAL: @@ -72,8 +70,6 @@ structure, we need to copy them into the state structure at this point. */ void DLLEXPORT HUD_TxferLocalOverrides(struct entity_state_s* state, const struct clientdata_s* client) { - // RecClTxferLocalOverrides(state, client); - VectorCopy(client->origin, state->origin); // Spectator @@ -97,8 +93,6 @@ playerstate structure */ void DLLEXPORT HUD_ProcessPlayerState(struct entity_state_s* dst, const struct entity_state_s* src) { - // RecClProcessPlayerState(dst, src); - // Copy in network data VectorCopy(src->origin, dst->origin); VectorCopy(src->angles, dst->angles); @@ -166,8 +160,6 @@ Because we can predict an arbitrary number of frames before the server responds */ void DLLEXPORT HUD_TxferPredictionData(struct entity_state_s* ps, const struct entity_state_s* pps, struct clientdata_s* pcd, const struct clientdata_s* ppcd, struct weapon_data_s* wd, const struct weapon_data_s* pwd) { - // RecClTxferPredictionData(ps, pps, pcd, ppcd, wd, pwd); - ps->oldbuttons = pps->oldbuttons; ps->flFallVelocity = pps->flFallVelocity; ps->iStepLeft = pps->iStepLeft; @@ -220,77 +212,6 @@ void DLLEXPORT HUD_TxferPredictionData(struct entity_state_s* ps, const struct e memcpy(wd, pwd, MAX_WEAPONS * sizeof(weapon_data_t)); } -#if defined(BEAM_TEST) -// Note can't index beam[ 0 ] in Beam callback, so don't use that index -// Room for 1 beam ( 0 can't be used ) -static cl_entity_t beams[2]; - -void BeamEndModel() -{ - cl_entity_t *player, *model; - int modelindex; - struct model_s* mod; - - // Load it up with some bogus data - player = gEngfuncs.GetLocalPlayer(); - if (!player) - return; - - mod = gEngfuncs.CL_LoadModel("models/sentry3.mdl", &modelindex); - if (!mod) - return; - - // Slot 1 - model = &beams[1]; - - *model = *player; - model->player = 0; - model->model = mod; - model->curstate.modelindex = modelindex; - - // Move it out a bit - model->origin[0] = player->origin[0] - 100; - model->origin[1] = player->origin[1]; - - model->attachment[0] = model->origin; - model->attachment[1] = model->origin; - model->attachment[2] = model->origin; - model->attachment[3] = model->origin; - - gEngfuncs.CL_CreateVisibleEntity(ET_NORMAL, model); -} - -void Beams() -{ - static float lasttime; - float curtime; - struct model_s* mod; - int index; - - BeamEndModel(); - - curtime = gEngfuncs.GetClientTime(); - float end[3]; - - if ((curtime - lasttime) < 10.0) - return; - - mod = gEngfuncs.CL_LoadModel("sprites/laserbeam.spr", &index); - if (!mod) - return; - - lasttime = curtime; - - end[0] = v_origin.x + 100; - end[1] = v_origin.y + 100; - end[2] = v_origin.z; - - BEAM* p1; - p1 = gEngfuncs.pEfxAPI->R_BeamEntPoint(-1, end, index, - 10.0, 2.0, 0.3, 1.0, 5.0, 0.0, 1.0, 1.0, 1.0, 1.0); -} -#endif - /* ========================= HUD_CreateEntities @@ -300,12 +221,6 @@ Gives us a chance to add additional entities to the render this frame */ void DLLEXPORT HUD_CreateEntities() { - // RecClCreateEntities(); - -#if defined(BEAM_TEST) - Beams(); -#endif - // Add in any game specific objects Game_AddObjects(); @@ -323,8 +238,6 @@ fired during this frame, handle the event by it's tag ( e.g., muzzleflash, sound */ void DLLEXPORT HUD_StudioEvent(const struct mstudioevent_s* event, const struct cl_entity_s* entity) { - // RecClStudioEvent(event, entity); - bool iMuzzleFlash = true; @@ -374,8 +287,6 @@ void DLLEXPORT HUD_TempEntUpdate( int (*Callback_AddVisibleEntity)(cl_entity_t* pEntity), void (*Callback_TempEntPlaySound)(TEMPENTITY* pTemp, float damp)) { - // RecClTempEntUpdate(frametime, client_time, cl_gravity, ppTempEntFree, ppTempEntActive, Callback_AddVisibleEntity, Callback_TempEntPlaySound); - static int gTempEntFrame = 0; int i; TEMPENTITY *pTemp, *pnext, *pprev; @@ -549,11 +460,6 @@ void DLLEXPORT HUD_TempEntUpdate( pTemp->entity.curstate.frame = pTemp->entity.curstate.frame - (int)(pTemp->entity.curstate.frame); } } -// Experiment -#if 0 - if ( pTemp->flags & FTENT_SCALE ) - pTemp->entity.curstate.framerate += 20.0 * (frametime / pTemp->entity.curstate.framerate); -#endif if ((pTemp->flags & FTENT_ROTATE) != 0) { @@ -747,20 +653,5 @@ Indices must start at 1, not zero. */ cl_entity_t DLLEXPORT* HUD_GetUserEntity(int index) { - // RecClGetUserEntity(index); - -#if defined(BEAM_TEST) - // None by default, you would return a valic pointer if you create a client side - // beam and attach it to a client side entity. - if (index > 0 && index <= 1) - { - return &beams[index]; - } - else - { - return NULL; - } -#else return NULL; -#endif } diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index b5f3b7eac..0107e271b 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -36,19 +36,14 @@ #include "event_api.h" #include "event_args.h" #include "in_defs.h" +#include "view.h" #include -#include "r_studioint.h" -#include "com_model.h" - -extern engine_studio_api_t IEngineStudio; - static int tracerCount[MAX_PLAYERS]; #include "pm_shared.h" -void V_PunchAxis(int axis, float punch); void VectorAngles(const float* forward, float* angles); extern cvar_t* cl_lw; @@ -958,7 +953,6 @@ void EV_FireGauss(event_args_t* args) if (n < 0.5) // 60 degrees { - // ALERT( at_console, "reflect %f\n", n ); // reflect Vector r; @@ -1370,17 +1364,9 @@ void EV_EgonFire(event_args_t* args) int iBeamModelIndex = gEngfuncs.pEventAPI->EV_FindModelIndex(EGON_BEAM_SPRITE); - float r = 50.0f; - float g = 50.0f; - float b = 125.0f; - - //if ( IEngineStudio.IsHardware() ) - { - r /= 255.0f; - g /= 255.0f; - b /= 255.0f; - } - + const float r = 50.0f / 255.0f; + const float g = 50.0f / 255.0f; + const float b = 125.0f / 255.0f; pBeam = gEngfuncs.pEfxAPI->R_BeamEntPoint(idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 3.5, 0.2, 0.7, 55, 0, 0, r, g, b); diff --git a/cl_dll/ev_hldm.h b/cl_dll/ev_hldm.h index ac0d31e83..7cf6d36bf 100644 --- a/cl_dll/ev_hldm.h +++ b/cl_dll/ev_hldm.h @@ -32,7 +32,5 @@ void EV_HornetGunFire(event_args_t* args); void EV_TripmineFire(event_args_t* args); void EV_SnarkFire(event_args_t* args); - - void EV_TrainPitchAdjust(event_args_t* args); void EV_VehiclePitchAdjust(event_args_t* args); diff --git a/cl_dll/geiger.cpp b/cl_dll/geiger.cpp index 6ff0b26d9..d41e86481 100644 --- a/cl_dll/geiger.cpp +++ b/cl_dll/geiger.cpp @@ -73,12 +73,12 @@ bool CHudGeiger::Draw(float flTime) // peicewise linear is better than continuous formula for this if (m_iGeigerRange > 800) { - pct = 0; // Con_Printf ( "range > 800\n"); + pct = 0; } else if (m_iGeigerRange > 600) { pct = 2; - flvol = 0.4; //Con_Printf ( "range > 600\n"); + flvol = 0.4; rg[0] = 1; rg[1] = 1; i = 2; @@ -86,7 +86,7 @@ bool CHudGeiger::Draw(float flTime) else if (m_iGeigerRange > 500) { pct = 4; - flvol = 0.5; //Con_Printf ( "range > 500\n"); + flvol = 0.5; rg[0] = 1; rg[1] = 2; i = 2; @@ -94,7 +94,7 @@ bool CHudGeiger::Draw(float flTime) else if (m_iGeigerRange > 400) { pct = 8; - flvol = 0.6; //Con_Printf ( "range > 400\n"); + flvol = 0.6; rg[0] = 1; rg[1] = 2; rg[2] = 3; @@ -103,7 +103,7 @@ bool CHudGeiger::Draw(float flTime) else if (m_iGeigerRange > 300) { pct = 8; - flvol = 0.7; //Con_Printf ( "range > 300\n"); + flvol = 0.7; rg[0] = 2; rg[1] = 3; rg[2] = 4; @@ -112,7 +112,7 @@ bool CHudGeiger::Draw(float flTime) else if (m_iGeigerRange > 200) { pct = 28; - flvol = 0.78; //Con_Printf ( "range > 200\n"); + flvol = 0.78; rg[0] = 2; rg[1] = 3; rg[2] = 4; @@ -121,7 +121,7 @@ bool CHudGeiger::Draw(float flTime) else if (m_iGeigerRange > 150) { pct = 40; - flvol = 0.80; //Con_Printf ( "range > 150\n"); + flvol = 0.80; rg[0] = 3; rg[1] = 4; rg[2] = 5; @@ -130,7 +130,7 @@ bool CHudGeiger::Draw(float flTime) else if (m_iGeigerRange > 100) { pct = 60; - flvol = 0.85; //Con_Printf ( "range > 100\n"); + flvol = 0.85; rg[0] = 3; rg[1] = 4; rg[2] = 5; @@ -139,7 +139,7 @@ bool CHudGeiger::Draw(float flTime) else if (m_iGeigerRange > 75) { pct = 80; - flvol = 0.9; //Con_Printf ( "range > 75\n"); + flvol = 0.9; //gflGeigerDelay = cl.time + GEIGERDELAY * 0.75; rg[0] = 4; rg[1] = 5; @@ -149,7 +149,7 @@ bool CHudGeiger::Draw(float flTime) else if (m_iGeigerRange > 50) { pct = 90; - flvol = 0.95; //Con_Printf ( "range > 50\n"); + flvol = 0.95; rg[0] = 5; rg[1] = 6; i = 2; @@ -157,17 +157,16 @@ bool CHudGeiger::Draw(float flTime) else { pct = 95; - flvol = 1.0; //Con_Printf ( "range < 50\n"); + flvol = 1.0; rg[0] = 5; rg[1] = 6; i = 2; } - flvol = (flvol * ((rand() & 127)) / 255) + 0.25; // UTIL_RandomFloat(0.25, 0.5); + flvol = (flvol * ((rand() & 127)) / 255) + 0.25; if ((rand() & 127) < pct || (rand() & 127) < pct) { - //S_StartDynamicSound (-1, 0, rgsfx[rand() % i], r_origin, flvol, 1.0, 0, 100); char sz[256]; int j = rand() & 1; diff --git a/cl_dll/global_consts.h b/cl_dll/global_consts.h index 1da4db603..18ec97402 100644 --- a/cl_dll/global_consts.h +++ b/cl_dll/global_consts.h @@ -14,7 +14,6 @@ enum MAX_TEAM_NAME = 16, }; -#define MAX_SCORES 10 #define MAX_SCOREBOARD_TEAMS 5 #define NUM_ROWS (MAX_PLAYERS_HUD + (MAX_SCOREBOARD_TEAMS * 2)) diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index 84dfea465..34074031a 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -429,8 +429,6 @@ void HUD_InitClientWeapons() // Fake functions g_engfuncs.pfnPrecacheModel = stub_PrecacheModel; g_engfuncs.pfnPrecacheSound = stub_PrecacheSound; - g_engfuncs.pfnPrecacheEvent = stub_PrecacheEvent; - g_engfuncs.pfnNameForFunction = stub_NameForFunction; g_engfuncs.pfnSetModel = stub_SetModel; g_engfuncs.pfnSetClientMaxspeed = HUD_SetMaxSpeed; @@ -515,14 +513,12 @@ void HUD_WeaponsPostThink(local_state_s* from, local_state_s* to, usercmd_t* cmd int buttonsChanged; CBasePlayerWeapon* pWeapon = NULL; CBasePlayerWeapon* pCurrent; - weapon_data_t nulldata, *pfrom, *pto; + weapon_data_t *pfrom, *pto; static int lasthealth; - memset(&nulldata, 0, sizeof(nulldata)); - // Get current clock //Use actual time instead of prediction frame time because that time value breaks anything that uses absolute time values. - gpGlobals->time = gEngfuncs.GetClientTime(); //time; + gpGlobals->time = gEngfuncs.GetClientTime(); //Lets weapons code use frametime to decrement timers and stuff. gpGlobals->frametime = cmd->msec / 1000.0f; @@ -625,7 +621,6 @@ void HUD_WeaponsPostThink(local_state_s* from, local_state_s* to, usercmd_t* cmd pCurrent->m_fInReload = 0 != pfrom->m_fInReload; pCurrent->m_fInSpecialReload = pfrom->m_fInSpecialReload; - // pCurrent->m_flPumpTime = pfrom->m_flPumpTime; pCurrent->m_iClip = pfrom->m_iClip; pCurrent->m_flNextPrimaryAttack = pfrom->m_flNextPrimaryAttack; pCurrent->m_flNextSecondaryAttack = pfrom->m_flNextSecondaryAttack; @@ -794,7 +789,6 @@ void HUD_WeaponsPostThink(local_state_s* from, local_state_s* to, usercmd_t* cmd pto->m_fInReload = static_cast(pCurrent->m_fInReload); pto->m_fInSpecialReload = pCurrent->m_fInSpecialReload; - // pto->m_flPumpTime = pCurrent->m_flPumpTime; pto->m_iClip = pCurrent->m_iClip; pto->m_flNextPrimaryAttack = pCurrent->m_flNextPrimaryAttack; pto->m_flNextSecondaryAttack = pCurrent->m_flNextSecondaryAttack; @@ -823,13 +817,6 @@ void HUD_WeaponsPostThink(local_state_s* from, local_state_s* to, usercmd_t* cmd pCurrent->GetWeaponData(*pto); - /* if ( pto->m_flPumpTime != -9999 ) - { - pto->m_flPumpTime -= cmd->msec / 1000.0; - if ( pto->m_flPumpTime < -0.001 ) - pto->m_flPumpTime = -0.001; - }*/ - if (pto->m_fNextAimBonus < -1.0) { pto->m_fNextAimBonus = -1.0; @@ -900,8 +887,6 @@ be ignored */ void DLLEXPORT HUD_PostRunCmd(struct local_state_s* from, struct local_state_s* to, struct usercmd_s* cmd, int runfuncs, double time, unsigned int random_seed) { - // RecClPostRunCmd(from, to, cmd, runfuncs, time, random_seed); - g_runfuncs = runfuncs != 0; //Event code depends on this stuff, so always initialize it. diff --git a/cl_dll/hud.cpp b/cl_dll/hud.cpp index c50500968..713b114a7 100644 --- a/cl_dll/hud.cpp +++ b/cl_dll/hud.cpp @@ -87,15 +87,11 @@ cvar_t* cl_rollspeed = nullptr; cvar_t* cl_bobtilt = nullptr; cvar_t* r_decals = nullptr; -void ShutdownInput(); - -//DECLARE_MESSAGE(m_Logo, Logo) int __MsgFunc_Logo(const char* pszName, int iSize, void* pbuf) { return static_cast(gHUD.MsgFunc_Logo(pszName, iSize, pbuf)); } -//DECLARE_MESSAGE(m_Logo, Logo) int __MsgFunc_ResetHUD(const char* pszName, int iSize, void* pbuf) { return static_cast(gHUD.MsgFunc_ResetHUD(pszName, iSize, pbuf)); @@ -426,7 +422,6 @@ void CHud::VidInit() // ---------- // Load Sprites // --------- - // m_hsprFont = LoadSprite("sprites/%d_font.spr"); m_hsprLogo = 0; m_hsprCursor = 0; @@ -637,13 +632,6 @@ bool CHud::MsgFunc_SetFOV(const char* pszName, int iSize, void* pbuf) int newfov = READ_BYTE(); int def_fov = CVAR_GET_FLOAT("default_fov"); - //Weapon prediction already takes care of changing the fog. ( g_lastFOV ). - //But it doesn't restore correctly so this still needs to be used - /* - if ( cl_lw && cl_lw->value ) - return 1; - */ - g_lastFOV = newfov; if (newfov == 0) @@ -677,8 +665,6 @@ void CHud::AddHudElem(CHudBase* phudelem) { HUDLIST *pdl, *ptemp; - //phudelem->Think(); - if (!phudelem) return; diff --git a/cl_dll/hud.h b/cl_dll/hud.h index 4506d1f4b..419c4e4a3 100644 --- a/cl_dll/hud.h +++ b/cl_dll/hud.h @@ -35,8 +35,6 @@ #define DHN_3DIGITS 4 #define MIN_ALPHA 100 -#define HUDELEM_ACTIVE 1 - typedef struct { int x, y; diff --git a/cl_dll/hud_redraw.cpp b/cl_dll/hud_redraw.cpp index be8ac734e..1e3c39300 100644 --- a/cl_dll/hud_redraw.cpp +++ b/cl_dll/hud_redraw.cpp @@ -28,9 +28,6 @@ int grgLogoFrame[MAX_LOGO_FRAMES] = 16, 17, 18, 19, 20, 20, 20, 20, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 29, 29, 29, 29, 28, 27, 26, 25, 24, 30, 31}; - -extern bool g_iVisibleMouse; - float HUD_GetFOV(); extern float IN_GetMouseSensitivity(); @@ -180,28 +177,6 @@ bool CHud::Redraw(float flTime, bool intermission) SPR_DrawAdditive(i, x, y, NULL); } - /* - if ( g_iVisibleMouse ) - { - void IN_GetMousePos( int *mx, int *my ); - int mx, my; - - IN_GetMousePos( &mx, &my ); - - if (m_hsprCursor == 0) - { - char sz[256]; - sprintf( sz, "sprites/cursor.spr" ); - m_hsprCursor = SPR_Load( sz ); - } - - SPR_Set(m_hsprCursor, 250, 250, 250 ); - - // Draw the logo at 20 fps - SPR_DrawAdditive( 0, mx, my, NULL ); - } - */ - return true; } diff --git a/cl_dll/hud_spectator.cpp b/cl_dll/hud_spectator.cpp index 15dd2f9e3..55bfd02f5 100644 --- a/cl_dll/hud_spectator.cpp +++ b/cl_dll/hud_spectator.cpp @@ -44,41 +44,8 @@ extern Vector v_angles; // last view angle extern Vector v_cl_angles; // last client/mouse angle extern Vector v_sim_org; // last sim origin -#if 0 -const char *GetSpectatorLabel ( int iMode ) -{ - switch ( iMode ) - { - case OBS_CHASE_LOCKED: - return "#OBS_CHASE_LOCKED"; - - case OBS_CHASE_FREE: - return "#OBS_CHASE_FREE"; - - case OBS_ROAMING: - return "#OBS_ROAMING"; - - case OBS_IN_EYE: - return "#OBS_IN_EYE"; - - case OBS_MAP_FREE: - return "#OBS_MAP_FREE"; - - case OBS_MAP_CHASE: - return "#OBS_MAP_CHASE"; - - case OBS_NONE: - default: - return "#OBS_NONE"; - } -} - -#endif - void SpectatorMode() { - - if (gEngfuncs.Cmd_Argc() <= 1) { gEngfuncs.Con_Printf("usage: spec_mode
[]\n"); @@ -556,8 +523,6 @@ bool CHudSpectator::GetDirectorCamera(Vector& position, Vector& angle) m_WayInterpolation.Interpolate(fraction, position, angle, &fov); - // gEngfuncs.Con_Printf("Interpolate time: %.2f, fraction %.2f, point : %.2f,%.2f,%.2f\n", now, fraction, position[0], position[1], position[2] ); - SetCameraView(position, angle, fov); return true; @@ -714,7 +679,6 @@ void CHudSpectator::DirectorMessage(int iSize, void* pbuf) m_ChaseEntity = 0; } - // gEngfuncs.Con_Printf("Director Camera: %i %i\n", firstObject, secondObject); break; case DRC_CMD_MODE: if (0 != m_autoDirector->value) @@ -781,7 +745,6 @@ void CHudSpectator::DirectorMessage(int iSize, void* pbuf) string = READ_STRING(); f1 = READ_FLOAT(); - // gEngfuncs.Con_Printf("DRC_CMD_FX_SOUND: %s %.2f\n", string, value ); gEngfuncs.pEventAPI->EV_PlaySound(0, v_origin, CHAN_BODY, string, f1, ATTN_NORM, 0, PITCH_NORM); break; @@ -801,7 +764,6 @@ void CHudSpectator::DirectorMessage(int iSize, void* pbuf) break; case DRC_CMD_BANNER: - // gEngfuncs.Con_DPrintf("GUI: Banner %s\n",READ_STRING() ); // name of banner tga eg gfx/temp/7454562234563475.tga gViewPort->m_pSpectatorPanel->m_TopBanner->LoadImage(READ_STRING()); gViewPort->UpdateSpectatorPanel(); break; @@ -849,7 +811,6 @@ void CHudSpectator::DirectorMessage(int iSize, void* pbuf) AddWaypoint(f1, v1, v2, f2, i3); } - // gEngfuncs.Con_Printf("CHudSpectator::DirectorMessage: waypoints %i.\n", m_NumWayPoints ); if (0 == m_autoDirector->value) { // ignore waypoints @@ -1014,8 +975,6 @@ void CHudSpectator::HandleButtonsDown(int ButtonPressed) int newMainMode = g_iUser1; int newInsetMode = m_pip->value; - // gEngfuncs.Con_Printf(" HandleButtons:%i\n", ButtonPressed ); - if (!gViewPort) return; diff --git a/cl_dll/hud_spectator.h b/cl_dll/hud_spectator.h index 4207d7028..a372e636b 100644 --- a/cl_dll/hud_spectator.h +++ b/cl_dll/hud_spectator.h @@ -19,7 +19,6 @@ #define MAX_SPEC_HUD_MESSAGES 8 -#define OVERVIEW_TILE_SIZE 128 // don't change this #define OVERVIEW_MAX_LAYERS 1 extern void VectorAngles(const float* forward, float* angles); diff --git a/cl_dll/hud_update.cpp b/cl_dll/hud_update.cpp index 3228b642b..f79ebc31c 100644 --- a/cl_dll/hud_update.cpp +++ b/cl_dll/hud_update.cpp @@ -25,8 +25,6 @@ int CL_ButtonBits(bool); void CL_ResetButtonBits(int bits); extern float v_idlescale; -float in_fov; -extern void HUD_SetCmdBits(int bits); bool CHud::UpdateClientData(client_data_t* cdata, float time) { @@ -34,10 +32,6 @@ bool CHud::UpdateClientData(client_data_t* cdata, float time) memcpy(m_vecAngles, cdata->viewangles, sizeof(Vector)); m_iKeyBits = CL_ButtonBits(false); - //Handled in MsgFunc_Weapons now. - //m_iWeaponBits = cdata->iWeaponBits; - - in_fov = cdata->fov; Think(); diff --git a/cl_dll/in_camera.cpp b/cl_dll/in_camera.cpp index 4d378eada..ade4b76db 100644 --- a/cl_dll/in_camera.cpp +++ b/cl_dll/in_camera.cpp @@ -29,11 +29,6 @@ extern cl_enginefunc_t gEngfuncs; #define CAM_ANGLE_SPEED 2.5 #define CAM_MIN_DIST 30.0 #define CAM_ANGLE_MOVE .5 -#define MAX_ANGLE_DIFF 10.0 -#define PITCH_MAX 90.0 -#define PITCH_MIN 0 -#define YAW_MAX 135.0 -#define YAW_MIN -135.0 enum ECAM_Command { @@ -67,13 +62,12 @@ bool cam_thirdperson; bool cam_mousemove; //true if we are moving the cam with the mouse, False if not bool iMouseInUse = false; bool cam_distancemove; -extern int mouse_x, mouse_y; //used to determine what the current x and y values are int cam_old_mouse_x, cam_old_mouse_y; //holds the last ticks mouse movement Point cam_mouse; //-------------------------------------------------- Local Variables static kbutton_t cam_pitchup, cam_pitchdown, cam_yawleft, cam_yawright; -static kbutton_t cam_in, cam_out, cam_move; +static kbutton_t cam_in, cam_out; //-------------------------------------------------- Prototypes @@ -85,7 +79,6 @@ void CAM_EndDistance(); void SDL_GetCursorPos(Point* p) { gEngfuncs.GetMousePosition(&p->x, &p->y); - // SDL_GetMouseState( &p->x, &p->y ); } void SDL_SetCursorPos(const int x, const int y) @@ -135,33 +128,13 @@ float MoveToward(float cur, float goal, float maxspeed) //-------------------------------------------------- Gobal Functions -typedef struct -{ - Vector boxmins, boxmaxs; // enclose the test object along entire move - float *mins, *maxs; // size of the moving object - Vector mins2, maxs2; // size when clipping against mosnters - float *start, *end; - trace_t trace; - int type; - edict_t* passedict; - qboolean monsterclip; -} moveclip_t; - -extern trace_t SV_ClipMoveToEntity(edict_t* ent, Vector start, Vector mins, Vector maxs, Vector end); - void DLLEXPORT CAM_Think() { - // RecClCamThink(); - Vector origin; Vector ext, pnt, camForward, camRight, camUp; - moveclip_t clip; float dist; Vector camAngles; float flSensitivity; -#ifdef LATER - int i; -#endif Vector viewangles; switch ((int)cam_command->value) @@ -182,14 +155,6 @@ void DLLEXPORT CAM_Think() if (!cam_thirdperson) return; -#ifdef LATER - if (cam_contain->value) - { - gEngfuncs.GetClientOrigin(origin); - ext[0] = ext[1] = ext[2] = 0.0; - } -#endif - camAngles[PITCH] = cam_idealpitch->value; camAngles[YAW] = cam_idealyaw->value; dist = cam_idealdist->value; @@ -209,7 +174,6 @@ void DLLEXPORT CAM_Think() //keep the camera within certain limits around the player (ie avoid certain bad viewing angles) if (cam_mouse.x > gEngfuncs.GetWindowCenterX()) { - //if ((camAngles[YAW]>=225.0)||(camAngles[YAW]<135.0)) if (camAngles[YAW] < c_maxyaw->value) { camAngles[YAW] += (CAM_ANGLE_MOVE) * ((cam_mouse.x - gEngfuncs.GetWindowCenterX()) / 2); @@ -222,7 +186,6 @@ void DLLEXPORT CAM_Think() } else if (cam_mouse.x < gEngfuncs.GetWindowCenterX()) { - //if ((camAngles[YAW]<=135.0)||(camAngles[YAW]>225.0)) if (camAngles[YAW] > c_minyaw->value) { camAngles[YAW] -= (CAM_ANGLE_MOVE) * ((gEngfuncs.GetWindowCenterX() - cam_mouse.x) / 2); @@ -331,28 +294,7 @@ void DLLEXPORT CAM_Think() cam_old_mouse_y = cam_mouse.y * gHUD.GetSensitivity(); SDL_SetCursorPos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY()); } -#ifdef LATER - if (cam_contain->value) - { - // check new ideal - VectorCopy(origin, pnt); - AngleVectors(camAngles, camForward, camRight, camUp); - for (i = 0; i < 3; i++) - pnt[i] += -dist * camForward[i]; - - // check line from r_refdef.vieworg to pnt - memset(&clip, 0, sizeof(moveclip_t)); - clip.trace = SV_ClipMoveToEntity(sv.edicts, r_refdef.vieworg, ext, ext, pnt); - if (clip.trace.fraction == 1.0) - { - // update ideal - cam_idealpitch->value = camAngles[PITCH]; - cam_idealyaw->value = camAngles[YAW]; - cam_idealdist->value = dist; - } - } - else -#endif + { // update ideal cam_idealpitch->value = camAngles[PITCH]; @@ -384,26 +326,7 @@ void DLLEXPORT CAM_Think() else camAngles[2] += (cam_idealdist->value - camAngles[2]) / 4.0; } -#ifdef LATER - if (cam_contain->value) - { - // Test new position - dist = camAngles[ROLL]; - camAngles[ROLL] = 0; - - VectorCopy(origin, pnt); - AngleVectors(camAngles, camForward, camRight, camUp); - for (i = 0; i < 3; i++) - pnt[i] += -dist * camForward[i]; - - // check line from r_refdef.vieworg to pnt - memset(&clip, 0, sizeof(moveclip_t)); - ext[0] = ext[1] = ext[2] = 0.0; - clip.trace = SV_ClipMoveToEntity(sv.edicts, r_refdef.vieworg, ext, ext, pnt); - if (clip.trace.fraction != 1.0) - return; - } -#endif + cam_ofs[0] = camAngles[0]; cam_ofs[1] = camAngles[1]; cam_ofs[2] = dist; @@ -614,14 +537,10 @@ void CAM_EndDistance() int DLLEXPORT CL_IsThirdPerson() { - // RecClCL_IsThirdPerson(); - return static_cast(cam_thirdperson || (0 != g_iUser1 && (g_iUser2 == gEngfuncs.GetLocalPlayer()->index))); } void DLLEXPORT CL_CameraOffset(float* ofs) { - // RecClCL_GetCameraOffsets(ofs); - VectorCopy(cam_ofs, ofs); } diff --git a/cl_dll/input.cpp b/cl_dll/input.cpp index 3c16a84db..1ae8d9cc9 100644 --- a/cl_dll/input.cpp +++ b/cl_dll/input.cpp @@ -34,7 +34,6 @@ void IN_Init(); void IN_Move(float frametime, usercmd_t* cmd); void IN_Shutdown(); void V_Init(); -void VectorAngles(const float* forward, float* angles); int CL_ButtonBits(bool); // xxx need client dll function to get and clear impuse @@ -205,8 +204,6 @@ Allows the engine to get a kbutton_t directly ( so it can check +mlook state, et */ struct kbutton_s DLLEXPORT* KB_Find(const char* name) { - // RecClFindKey(name); - kblist_t* p; p = g_kbkeys; while (p) @@ -365,8 +362,6 @@ Return 1 to allow engine to process the key, otherwise, act on it as needed */ int DLLEXPORT HUD_Key_Event(int down, int keynum, const char* pszCurrentBinding) { - // RecClKeyEvent(down, keynum, pszCurrentBinding); - if (gViewPort) return static_cast(gViewPort->KeyInput(0 != down, keynum, pszCurrentBinding)); @@ -651,8 +646,6 @@ if active == 1 then we are 1) not playing back demos ( where our commands are ig */ void DLLEXPORT CL_CreateMove(float frametime, struct usercmd_s* cmd, int active) { - // RecClCL_CreateMove(frametime, cmd, active); - float spd; Vector viewangles; static Vector oldangles; @@ -1016,11 +1009,8 @@ void CL_UnloadParticleMan(); void DLLEXPORT HUD_Shutdown() { - // RecClShutdown(); - ShutdownInput(); - FileSystem_FreeFileSystem(); CL_UnloadParticleMan(); } diff --git a/cl_dll/inputw32.cpp b/cl_dll/inputw32.cpp index ae3e115b8..bc0386119 100644 --- a/cl_dll/inputw32.cpp +++ b/cl_dll/inputw32.cpp @@ -645,18 +645,6 @@ void IN_MouseMove(float frametime, usercmd_t* cmd) IN_SetMouseRelative(true); } #endif - - /* -//#define TRACE_TEST -#if defined( TRACE_TEST ) - { - int mx, my; - void V_Move( int mx, int my ); - IN_GetMousePos( &mx, &my ); - V_Move( mx, my ); - } -#endif -*/ } /* diff --git a/cl_dll/overview.cpp b/cl_dll/overview.cpp deleted file mode 100644 index 782e0217c..000000000 --- a/cl_dll/overview.cpp +++ /dev/null @@ -1,160 +0,0 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -#include "hud.h" -#include "cl_util.h" -#include "cl_entity.h" -#include "triangleapi.h" -#include "vgui_TeamFortressViewport.h" - -// these are included for the math functions -#include "com_model.h" -#include "studio_util.h" - -#pragma warning(disable: 4244) - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -int CHudOverview::Init() -{ - gHUD.AddHudElem(this); - - m_iFlags |= HUD_ACTIVE; - - return 1; -} - -//----------------------------------------------------------------------------- -// Purpose: Loads new icons -//----------------------------------------------------------------------------- -int CHudOverview::VidInit() -{ - m_hsprPlayer = gEngfuncs.pfnSPR_Load("sprites/ring.spr"); - m_hsprViewcone = gEngfuncs.pfnSPR_Load("sprites/camera.spr"); - - return 1; -} - -//----------------------------------------------------------------------------- -// Purpose: -// Input : flTime - -// intermission - -//----------------------------------------------------------------------------- -int CHudOverview::Draw(float flTime) -{ - // only draw in overview mode - if (!gEngfuncs.Overview_GetOverviewState()) - return 1; - - // make sure we have player info - gViewPort->GetAllPlayersInfo(); - - // calculate player size on the overview - int x1, y1, x2, y2; - float v0[3]={0,0,0}, v1[3]={64,64,0}; - gEngfuncs.Overview_WorldToScreen(v0, &x1, &y1); - gEngfuncs.Overview_WorldToScreen(v1, &x2, &y2); - float scale = abs(x2 - x1); - - // loop through all the players and draw them on the map - for (int i = 1; i < MAX_PLAYERS; i++) - { - cl_entity_t *pl = gEngfuncs.GetEntityByIndex(i); - - if (pl && pl->player && pl->curstate.health > 0 && pl->curstate.solid != SOLID_NOT) - { - int x, y, z = 0; - float v[3]={pl->origin[0], pl->origin[1], 0}; - gEngfuncs.Overview_WorldToScreen(v, &x, &y); - - // hack in some team colors - float r, g, bc; - if (g_PlayerExtraInfo[i].teamnumber == 1) - { - r = 0.0f; g = 0.0f; bc = 1.0f; - } - else if (g_PlayerExtraInfo[i].teamnumber == 2) - { - r = 1.0f; g = 0.0f; bc = 0.0f; - } - else - { - // just use the default orange color if the team isn't set - r = 1.0f; g = 0.7f; bc = 0.0f; - } - - // set the current texture - gEngfuncs.pTriAPI->SpriteTexture((struct model_s *)gEngfuncs.GetSpritePointer(m_hsprPlayer), 0); - - // additive render mode - gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); - - // no culling - gEngfuncs.pTriAPI->CullFace(TRI_NONE); - - // draw a square - gEngfuncs.pTriAPI->Begin(TRI_QUADS); - - // set the color to be that of the team - gEngfuncs.pTriAPI->Color4f(r, g, bc, 1.0f); - - // calculate rotational matrix - vec3_t a, b, angles; - float rmatrix[3][4]; // transformation matrix - VectorCopy(pl->angles, angles); - angles[0] = 0.0f; - angles[1] += 90.f; - angles[1] = -angles[1]; - angles[2] = 0.0f; - AngleMatrix(angles, rmatrix); - a[2] = 0; - - a[0] = -scale; a[1] = -scale; - VectorTransform(a, rmatrix , b ); - gEngfuncs.pTriAPI->TexCoord2f( 0, 0 ); - gEngfuncs.pTriAPI->Vertex3f(x + b[0], y + b[1], z); - - a[0]=-scale; a[1] = scale; - VectorTransform(a, rmatrix , b ); - gEngfuncs.pTriAPI->TexCoord2f( 0, 1 ); - gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z); - - a[0]=scale; a[1] = scale; - VectorTransform(a, rmatrix , b ); - gEngfuncs.pTriAPI->TexCoord2f( 1, 1 ); - gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z); - - a[0]=scale; a[1] = -scale; - VectorTransform(a, rmatrix , b ); - gEngfuncs.pTriAPI->TexCoord2f( 1, 0 ); - gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z); - - // finish up - gEngfuncs.pTriAPI->End(); - gEngfuncs.pTriAPI->RenderMode( kRenderNormal ); - - // draw the players name and health underneath - char string[256]; - sprintf(string, "%s (%i%%)", g_PlayerInfoList[i].name, pl->curstate.health); - DrawConsoleString(x, y + (1.1 * scale), string); - } - } - - return 1; -} - -//----------------------------------------------------------------------------- -// Purpose: called every time a server is connected to -//----------------------------------------------------------------------------- -void CHudOverview::InitHUDData() -{ -// this block would force the spectator view to be on -// gEngfuncs.Overview_SetDrawOverview( 1 ); -// gEngfuncs.Overview_SetDrawInset( 0 ); -} - diff --git a/cl_dll/overview.h b/cl_dll/overview.h deleted file mode 100644 index c03b77e4c..000000000 --- a/cl_dll/overview.h +++ /dev/null @@ -1,31 +0,0 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -#ifndef OVERVIEW_H -#define OVERVIEW_H -#pragma once - - -//----------------------------------------------------------------------------- -// Purpose: Handles the drawing of the top-down map and all the things on it -//----------------------------------------------------------------------------- -class CHudOverview : public CHudBase -{ -public: - int Init(); - int VidInit(); - - int Draw(float flTime); - void InitHUDData( void ); - -private: - HSPRITE m_hsprPlayer; - HSPRITE m_hsprViewcone; -}; - - -#endif // OVERVIEW_H diff --git a/cl_dll/readme.txt b/cl_dll/readme.txt deleted file mode 100644 index 249205ca5..000000000 --- a/cl_dll/readme.txt +++ /dev/null @@ -1,107 +0,0 @@ - client dll readme.txt -------------------------- - -This file details the structure of the half-life client dll, and -how it communicates with the half-life game engine. - - -Engine callback functions: - -Drawing functions: - HSPRITE SPR_Load( char *picname ); - Loads a sprite into memory, and returns a handle to it. - - int SPR_Frames( HSPRITE sprite ); - Returns the number of frames stored in the specified sprite. - - int SPR_Height( HSPRITE x, int frame ) - Returns the height, in pixels, of a sprite at the specified frame. - Returns 0 is the frame number or the sprite handle is invalid. - - int SPR_Width( HSPRITE x, int f ) - Returns the width, in pixels, of a sprite at the specified frame. - Returns 0 is the frame number or the sprite handle is invalid. - - int SPR_Set( HSPRITE sprite, int r, int g, int b ); - Prepares a sprite about to be drawn. RBG color values are applied to the sprite at this time. - - - void SPR_Draw( int frame, int x, int y ); - Precondition: SPR_Set has already been called for a sprite. - Draws the currently active sprite to the screen, at position (x,y), where (0,0) is - the top left-hand corner of the screen. - - - void SPR_DrawHoles( int frame, int x, int y ); - Precondition: SPR_Set has already been called for a sprite. - Draws the currently active sprite to the screen. Color index #255 is treated as transparent. - - void SPR_DrawAdditive( int frame, int x, int y ); - Precondition: SPR_Set has already been called for a sprite. - Draws the currently active sprite to the screen, adding it's color values to the background. - - void SPR_EnableScissor( int x, int y, int width, int height ); - Creates a clipping rectangle. No pixels will be drawn outside the specified area. Will - stay in effect until either the next frame, or SPR_DisableScissor is called. - - void SPR_DisableScissor( void ); - Disables the effect of an SPR_EnableScissor call. - - int IsHighRes( void ); - returns 1 if the res mode is 640x480 or higher; 0 otherwise. - - int ScreenWidth( void ); - returns the screen width, in pixels. - - int ScreenHeight( void ); - returns the screen height, in pixels. - -// Sound functions - void PlaySound( char *szSound, int volume ) - plays the sound 'szSound' at the specified volume. Loads the sound if it hasn't been cached. - If it can't find the sound, it displays an error message and plays no sound. - - void PlaySound( int iSound, int volume ) - Precondition: iSound has been precached. - Plays the sound, from the precache list. - - -// Communication functions - void SendClientCmd( char *szCmdString ); - sends a command to the server, just as if the client had typed the szCmdString at the console. - - char *GetPlayerName( int entity_number ); - returns a pointer to a string, that contains the name of the specified client. - Returns NULL if the entity_number is not a client. - - - DECLARE_MESSAGE(), HOOK_MESSAGE() - These two macros bind the message sending between the entity DLL and the client DLL to - the CHud object. - - HOOK_MESSAGE( message_name ) - This is used inside CHud::Init(). It calls into the engine to hook that message - from the incoming message stream. - Precondition: There must be a function of name UserMsg_message_name declared - for CHud. Eg, CHud::UserMsg_Health() must be declared if you want to - use HOOK_MESSAGE( Health ); - - DECLARE_MESSAGE( message_name ) - For each HOOK_MESSAGE you must have an equivalent DECLARE_MESSAGE. This creates - a function which passes the hooked messages into the CHud object. - - - HOOK_COMMAND(), DECLARE_COMMAND() - These two functions declare and hook console commands into the client dll. - - HOOK_COMMAND( char *command, command_name ) - Whenever the user types the 'command' at the console, the function 'command_name' - will be called. - Precondition: There must be a function of the name UserCmd_command_name declared - for CHud. Eg, CHud::UserMsg_ShowScores() must be declared if you want to - use HOOK_COMMAND( "+showscores", ShowScores ); - - DECLARE_COMMAND( command_name ) - For each HOOK_COMMAND you must have an equivelant DECLARE_COMMAND. This creates - a function which passes the hooked commands into the CHud object. - diff --git a/cl_dll/studio_util.h b/cl_dll/studio_util.h index 45f2eadc0..ad7e32659 100644 --- a/cl_dll/studio_util.h +++ b/cl_dll/studio_util.h @@ -17,8 +17,6 @@ #define ROLL 2 #endif -#define FDotProduct( a, b ) (fabs((a[0])*(b[0])) + fabs((a[1])*(b[1])) + fabs((a[2])*(b[2]))) - void AngleMatrix (const float *angles, float (*matrix)[4] ); bool VectorCompare (const float *v1, const float *v2); void CrossProduct (const float *v1, const float *v2, float *cross); diff --git a/cl_dll/tri.cpp b/cl_dll/tri.cpp index 367ddc35c..be2eb3b35 100644 --- a/cl_dll/tri.cpp +++ b/cl_dll/tri.cpp @@ -31,8 +31,6 @@ Non-transparent triangles-- add them here */ void DLLEXPORT HUD_DrawNormalTriangles() { - // RecClDrawNormalTriangles(); - gHUD.m_Spectator.DrawOverview(); } @@ -46,9 +44,6 @@ Render any triangles with transparent rendermode needs here */ void DLLEXPORT HUD_DrawTransparentTriangles() { - // RecClDrawTransparentTriangles(); - - if (g_pParticleMan) g_pParticleMan->Update(); } diff --git a/cl_dll/vgui_CustomObjects.cpp b/cl_dll/vgui_CustomObjects.cpp index b91f74975..5d73056e3 100644 --- a/cl_dll/vgui_CustomObjects.cpp +++ b/cl_dll/vgui_CustomObjects.cpp @@ -445,18 +445,6 @@ void CTFScrollButton::paint() void CTFScrollButton::paintBackground() { - /* - if ( isArmed() ) - { - // Orange highlight background - drawSetColor( Scheme::sc_primary2 ); - drawFilledRect(0,0,_size[0],_size[1]); - } - - // Orange Border - drawSetColor( Scheme::sc_secondary1 ); - drawOutlinedRect(0,0,_size[0]-1,_size[1]); -*/ } void CTFSlider::paintBackground() diff --git a/cl_dll/vgui_ScorePanel.h b/cl_dll/vgui_ScorePanel.h index a62ea0a61..9250f8c5b 100644 --- a/cl_dll/vgui_ScorePanel.h +++ b/cl_dll/vgui_ScorePanel.h @@ -17,7 +17,6 @@ #include -#define MAX_SCORES 10 #define MAX_SCOREBOARD_TEAMS 5 // Scoreboard cells diff --git a/cl_dll/vgui_SpectatorPanel.cpp b/cl_dll/vgui_SpectatorPanel.cpp index d880de907..14fa9cba3 100644 --- a/cl_dll/vgui_SpectatorPanel.cpp +++ b/cl_dll/vgui_SpectatorPanel.cpp @@ -24,8 +24,6 @@ Sets the location of the input for chat text void DLLEXPORT HUD_ChatInputPosition(int* x, int* y) { - // RecClChatInputPosition( x, y ); - if (g_iUser1 != 0 || 0 != gEngfuncs.IsSpectateOnly()) { if (gHUD.m_Spectator.m_pip->value == INSET_OFF) diff --git a/cl_dll/vgui_TeamFortressViewport.h b/cl_dll/vgui_TeamFortressViewport.h index 247ca1892..150ebd808 100644 --- a/cl_dll/vgui_TeamFortressViewport.h +++ b/cl_dll/vgui_TeamFortressViewport.h @@ -76,7 +76,6 @@ extern TeamFortressViewport *gViewPort; #define CMENU_TOP (BUTTON_SIZE_Y * 4) -//#define MAX_TEAMNAME_SIZE 64 #define MAX_BUTTON_SIZE 32 // Map Briefing Window diff --git a/cl_dll/vgui_int.cpp b/cl_dll/vgui_int.cpp index 22767c7c9..d33d2b154 100644 --- a/cl_dll/vgui_int.cpp +++ b/cl_dll/vgui_int.cpp @@ -40,21 +40,10 @@ void VGui_Startup() { Panel* root = (Panel*)VGui_GetPanel(); root->setBgColor(128, 128, 0, 0); - //root->setNonPainted(false); - //root->setBorder(new LineBorder()); root->setLayout(new BorderLayout(0)); - - //root->getSurfaceBase()->setEmulatedCursorVisible(true); - if (gViewPort != NULL) { - // root->removeChild(gViewPort); - - // free the memory - // delete gViewPort; - // gViewPort = NULL; - gViewPort->Initialize(); } else diff --git a/cl_dll/view.cpp b/cl_dll/view.cpp index 2dd7c4f5a..333c72950 100644 --- a/cl_dll/view.cpp +++ b/cl_dll/view.cpp @@ -9,7 +9,7 @@ #include "entity_state.h" #include "cl_entity.h" #include "ref_params.h" -#include "in_defs.h" // PITCH YAW ROLL +#include "in_defs.h" #include "pm_movevars.h" #include "pm_shared.h" #include "pm_defs.h" @@ -23,20 +23,13 @@ int CL_IsThirdPerson(); void CL_CameraOffset(float* ofs); -void DLLEXPORT V_CalcRefdef(struct ref_params_s* pparams); - -void PM_ParticleLine(float* start, float* end, int pcolor, float life, float vert); -int PM_GetVisEntInfo(int ent); int PM_GetPhysEntInfo(int ent); -void InterpolateAngles(float* start, float* end, float* output, float frac); void NormalizeAngles(float* angles); float Distance(const float* v1, const float* v2); -float AngleBetweenVectors(const float* v1, const float* v2); extern float vJumpOrigin[3]; extern float vJumpAngles[3]; - void V_DropPunchAngle(float frametime, float* ev_punchangle); void VectorAngles(const float* forward, float* angles); @@ -56,8 +49,6 @@ when crossing a water boudnary. */ extern cvar_t* cl_forwardspeed; -extern cvar_t* chase_active; -extern cvar_t *scr_ofsx, *scr_ofsy, *scr_ofsz; extern cvar_t* cl_vsmoothing; extern cvar_t* cl_rollangle; extern cvar_t* cl_rollspeed; @@ -100,64 +91,6 @@ cvar_t v_ipitch_level = {"v_ipitch_level", "0.3", 0, 0.3}; float v_idlescale; // used by TFC for concussion grenade effect -//============================================================================= -/* -void V_NormalizeAngles( Vector& angles ) -{ - int i; - // Normalize angles - for ( i = 0; i < 3; i++ ) - { - if ( angles[i] > 180.0 ) - { - angles[i] -= 360.0; - } - else if ( angles[i] < -180.0 ) - { - angles[i] += 360.0; - } - } -} - -/* -=================== -V_InterpolateAngles - -Interpolate Euler angles. -FIXME: Use Quaternions to avoid discontinuities -Frac is 0.0 to 1.0 ( i.e., should probably be clamped, but doesn't have to be ) -=================== - -void V_InterpolateAngles( float *start, float *end, float *output, float frac ) -{ - int i; - float ang1, ang2; - float d; - - V_NormalizeAngles( start ); - V_NormalizeAngles( end ); - - for ( i = 0 ; i < 3 ; i++ ) - { - ang1 = start[i]; - ang2 = end[i]; - - d = ang2 - ang1; - if ( d > 180 ) - { - d -= 360; - } - else if ( d < -180 ) - { - d += 360; - } - - output[i] = ang1 + d * frac; - } - - V_NormalizeAngles( output ); -} */ - // Quakeworld bob code, this fixes jitters in the mutliplayer since the clock (pparams->time) isn't quite linear float V_CalcBob(struct ref_params_s* pparams) { @@ -696,7 +629,6 @@ void V_CalcNormalRefdef(struct ref_params_s* pparams) V_DropPunchAngle(pparams->frametime, (float*)&ev_punchangle); // smooth out stair step ups -#if 1 if (0 == pparams->smoothing && 0 != pparams->onground && pparams->simorg[2] - oldz > 0) { float steptime; @@ -718,7 +650,6 @@ void V_CalcNormalRefdef(struct ref_params_s* pparams) { oldz = pparams->simorg[2]; } -#endif { static float lastorg[3]; @@ -956,58 +887,11 @@ void V_GetChaseOrigin(float* angles, float* origin, float distance, float* retur maxLoops--; } - /* if ( ent ) - { - gEngfuncs.Con_Printf("Trace loops %i , entity %i, model %s, solid %i\n",(8-maxLoops),ent->curstate.number, ent->model->name , ent->curstate.solid ); - } */ - VectorMA(trace->endpos, 4, trace->plane.normal, returnvec); v_lastDistance = Distance(trace->endpos, origin); // real distance without offset } -/*void V_GetDeathCam(cl_entity_t * ent1, cl_entity_t * ent2, float * angle, float * origin) -{ - float newAngle[3]; float newOrigin[3]; - - float distance = 168.0f; - - v_lastDistance+= v_frametime * 96.0f; // move unit per seconds back - - if ( v_resetCamera ) - v_lastDistance = 64.0f; - - if ( distance > v_lastDistance ) - distance = v_lastDistance; - - VectorCopy(ent1->origin, newOrigin); - - if ( ent1->player ) - newOrigin[2]+= 17; // head level of living player - - // get new angle towards second target - if ( ent2 ) - { - VectorSubtract( ent2->origin, ent1->origin, newAngle ); - VectorAngles( newAngle, newAngle ); - newAngle[0] = -newAngle[0]; - } - else - { - // if no second target is given, look down to dead player - newAngle[0] = 90.0f; - newAngle[1] = 0.0f; - newAngle[2] = 0; - } - - // and smooth view - V_SmoothInterpolateAngles( v_lastAngles, newAngle, angle, 120.0f ); - - V_GetChaseOrigin( angle, newOrigin, distance, origin ); - - VectorCopy(angle, v_lastAngles); -}*/ - void V_GetSingleTargetCam(cl_entity_t* ent1, float* angle, float* origin) { float newAngle[3]; @@ -1400,9 +1284,7 @@ void V_GetMapChasePosition(int target, float* cl_angles, float* origin, float* a int V_FindViewModelByWeaponModel(int weaponindex) { - static const char* modelmap[][2] = { - {"models/p_crossbow.mdl", "models/v_crossbow.mdl"}, {"models/p_crowbar.mdl", "models/v_crowbar.mdl"}, {"models/p_egon.mdl", "models/v_egon.mdl"}, @@ -1629,8 +1511,6 @@ void V_CalcSpectatorRefdef(struct ref_params_s* pparams) void DLLEXPORT V_CalcRefdef(struct ref_params_s* pparams) { - // RecClCalcRefdef(pparams); - // intermission / finale rendering if (0 != pparams->intermission) { @@ -1644,25 +1524,6 @@ void DLLEXPORT V_CalcRefdef(struct ref_params_s* pparams) { V_CalcNormalRefdef(pparams); } - - /* -// Example of how to overlay the whole screen with red at 50 % alpha -#define SF_TEST -#if defined SF_TEST - { - screenfade_t sf; - gEngfuncs.pfnGetScreenFade( &sf ); - - sf.fader = 255; - sf.fadeg = 0; - sf.fadeb = 0; - sf.fadealpha = 128; - sf.fadeFlags = FFADE_STAYOUT | FFADE_OUT; - - gEngfuncs.pfnSetScreenFade( &sf ); - } -#endif -*/ } /* @@ -1715,86 +1576,3 @@ void V_Init() cl_waterdist = gEngfuncs.pfnRegisterVariable("cl_waterdist", "4", 0); cl_chasedist = gEngfuncs.pfnRegisterVariable("cl_chasedist", "112", 0); } - - -//#define TRACE_TEST -#if defined(TRACE_TEST) - -extern float in_fov; -/* -==================== -CalcFov -==================== -*/ -float CalcFov(float fov_x, float width, float height) -{ - float a; - float x; - - if (fov_x < 1 || fov_x > 179) - fov_x = 90; // error, set to 90 - - x = width / tan(fov_x / 360 * M_PI); - - a = atan(height / x); - - a = a * 360 / M_PI; - - return a; -} - -int hitent = -1; - -void V_Move(int mx, int my) -{ - float fov; - float fx, fy; - float dx, dy; - float c_x, c_y; - float dX, dY; - Vector forward, up, right; - Vector newangles; - - Vector farpoint; - pmtrace_t tr; - - fov = CalcFov(in_fov, (float)ScreenWidth, (float)ScreenHeight); - - c_x = (float)ScreenWidth / 2.0; - c_y = (float)ScreenHeight / 2.0; - - dx = (float)mx - c_x; - dy = (float)my - c_y; - - // Proportion we moved in each direction - fx = dx / c_x; - fy = dy / c_y; - - dX = fx * in_fov / 2.0; - dY = fy * fov / 2.0; - - newangles = v_angles; - - newangles[YAW] -= dX; - newangles[PITCH] += dY; - - // Now rotate v_forward around that point - AngleVectors(newangles, forward, right, up); - - farpoint = v_origin + 8192 * forward; - - // Trace - tr = *(gEngfuncs.PM_TraceLine((float*)&v_origin, (float*)&farpoint, PM_TRACELINE_PHYSENTSONLY, 2 /*point sized hull*/, -1)); - - if (tr.fraction != 1.0 && tr.ent != 0) - { - hitent = PM_GetPhysEntInfo(tr.ent); - PM_ParticleLine((float*)&v_origin, (float*)&tr.endpos, 5, 1.0, 0.0); - } - else - { - hitent = -1; - } -} - -#endif diff --git a/cl_dll/view.h b/cl_dll/view.h index bf8fe63dd..8500b2f1d 100644 --- a/cl_dll/view.h +++ b/cl_dll/view.h @@ -9,3 +9,4 @@ void V_StartPitchDrift(); void V_StopPitchDrift(); +void V_PunchAxis(int axis, float punch); diff --git a/cl_dll/voice_status.cpp b/cl_dll/voice_status.cpp index a77313337..163bc7b2d 100644 --- a/cl_dll/voice_status.cpp +++ b/cl_dll/voice_status.cpp @@ -17,6 +17,7 @@ #include "voice_status.h" #include "r_efx.h" #include "entity_types.h" +#include "camera.h" #include "VGUI_ActionSignal.h" #include "VGUI_Scheme.h" #include "VGUI_TextImage.h" @@ -24,22 +25,9 @@ #include "vgui_helpers.h" #include "VGUI_MouseCode.h" - - using namespace vgui; - -extern bool cam_thirdperson; - - -#define VOICE_MODEL_INTERVAL 0.3 #define SCOREBOARD_BLINK_FREQUENCY 0.3 // How often to blink the scoreboard icons. -#define SQUELCHOSCILLATE_PER_SECOND 2.0f - - -extern BitmapTGA* LoadTGA(const char* pImageName); - - // ---------------------------------------------------------------------- // // The voice manager for the client. diff --git a/game_shared/voice_status_hud.cpp b/game_shared/voice_status_hud.cpp deleted file mode 100644 index a3db20fb8..000000000 --- a/game_shared/voice_status_hud.cpp +++ /dev/null @@ -1,399 +0,0 @@ -//========= Copyright 1996-2001, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -#include "../cl_dll/hud.h" - -#include "cl_util.h" -#include -#include -#include -#include "parsemsg.h" -#include "demo.h" -#include "demo_api.h" -#include "r_efx.h" -#include "entity_types.h" -#include "shared_util.h" - -#include "voice_status.h" -#include "voice_status_hud.h" - -using namespace vgui; - -#include -#include - -#include - -extern int cam_thirdperson; - - -#define VOICE_MODEL_INTERVAL 0.3 -//#define SCOREBOARD_BLINK_FREQUENCY 0.3 // How often to blink the scoreboard icons. -#define SQUELCHOSCILLATE_PER_SECOND 2.0f - - - -// ---------------------------------------------------------------------- // -// The voice manager for the client. -// ---------------------------------------------------------------------- // -CVoiceStatusHud g_VoiceStatusHud; - -IVoiceHud* GetClientVoiceHud() -{ - return &g_VoiceStatusHud; -} - - - -// ---------------------------------------------------------------------- // -// CVoiceLabel. -// ---------------------------------------------------------------------- // -void CVoiceLabel::SetLocation( const char *location ) -{ - if ( !location || !*location ) - { - if ( m_locationString ) - { - delete[] m_locationString; - m_locationString = NULL; - RebuildLabelText(); - } - return; - } - - const wchar_t *newLocation = vgui::localize()->Find( location ); - if ( newLocation ) - { - // localized version - if ( m_locationString && wcscmp( newLocation, m_locationString ) ) - { - delete[] m_locationString; - m_locationString = NULL; - } - - if ( !m_locationString ) - { - m_locationString = CloneWString( newLocation ); - RebuildLabelText(); - } - } - else - { - // just convert the ANSI version to Unicode - wchar_t *tmpBuf = new wchar_t[ strlen(location) + 1 ]; - localize()->ConvertANSIToUnicode( location, tmpBuf, sizeof(tmpBuf) ); - - if ( m_locationString && wcscmp( tmpBuf, m_locationString ) ) - { - delete[] m_locationString; - m_locationString = NULL; - } - - if ( !m_locationString ) - { - m_locationString = CloneWString( tmpBuf ); - RebuildLabelText(); - } - - delete[] tmpBuf; - } -} - -void CVoiceLabel::SetPlayerName( const char *name ) -{ - if ( m_playerName ) - { - delete[] m_playerName; - m_playerName = NULL; - } - - if ( name ) - { - m_playerName = CloneString( name ); - } - - RebuildLabelText(); -} - -void CVoiceLabel::RebuildLabelText() -{ - const int BufLen = 512; - wchar_t buf[BufLen] = L""; - if ( m_playerName ) - { - wchar_t wsPlayer[BufLen] = L""; - - localize()->ConvertANSIToUnicode(m_playerName, wsPlayer, sizeof(wsPlayer)); - - const wchar_t *formatStr = L"%ls "; - if ( m_locationString ) - { - formatStr = localize()->Find( "#Voice_Location" ); - if ( !formatStr ) - formatStr = L"%ls/%ls "; - } - _snwprintf( buf, BufLen, formatStr, wsPlayer, m_locationString ); - } - m_pLabel->SetText( buf ); - //gEngfuncs.Con_DPrintf( "CVoiceLabel::RebuildLabelText() - [%ls]\n", buf ); -} - - - -// ---------------------------------------------------------------------- // -// CVoiceStatus. -// ---------------------------------------------------------------------- // - -CVoiceStatusHud::CVoiceStatusHud() -{ -} - - -CVoiceStatusHud::~CVoiceStatusHud() -{ -} - - -int CVoiceStatusHud::Init(IVoiceStatusHelper *pHelper, IVoiceStatus *pStatus) -{ - m_VoiceHeadModel = NULL; - - m_pHelper = pHelper; - m_pStatus = pStatus; - - gHUD.AddHudElem(this); - m_iFlags = HUD_ACTIVE; - - m_pLocalPlayerTalkIcon = new vgui::ImagePanel( NULL, "LocalPlayerIcon"); - m_pLocalPlayerTalkIcon->SetParent( gViewPortInterface->GetViewPortPanel() ); - m_pLocalPlayerTalkIcon->SetVisible( false ); - m_pLocalPlayerTalkIcon->SetImage( scheme()->GetImage("gfx/vgui/icntlk_pl", false) ); - - return 1; -} - - -int CVoiceStatusHud::VidInit() -{ - // Figure out the voice head model height. - m_VoiceHeadModelHeight = 45; - char *pFile = (char *)gEngfuncs.COM_LoadFile("scripts/voicemodel.txt", 5, NULL); - if(pFile) - { - char token[4096]; - gEngfuncs.COM_ParseFile(pFile, token); - if(token[0] >= '0' && token[0] <= '9') - { - m_VoiceHeadModelHeight = (float)atof(token); - } - - gEngfuncs.COM_FreeFile(pFile); - } - - m_VoiceHeadModel = gEngfuncs.pfnSPR_Load("sprites/voiceicon.spr"); - return TRUE; -} - -void CVoiceStatusHud::CreateEntities() -{ - if(!m_VoiceHeadModel) - return; - - cl_entity_t *localPlayer = gEngfuncs.GetLocalPlayer(); - - int iOutModel = 0; - for(int i=0; i < VOICE_MAX_PLAYERS; i++) - { - if(m_pStatus->GetSpeakerStatus(i)!=CVoiceStatus::VOICE_TALKING) - { - continue; - } - - cl_entity_s *pClient = gEngfuncs.GetEntityByIndex(i+1); - - // Don't show an icon if the player is not in our PVS. - if(!pClient || pClient->curstate.messagenum < localPlayer->curstate.messagenum) - continue; - - // Don't show an icon for dead or spectating players (ie: invisible entities). - if(pClient->curstate.effects & EF_NODRAW) - continue; - - // Don't show an icon for the local player unless we're in thirdperson mode. - if(pClient == localPlayer && !cam_thirdperson) - continue; - - cl_entity_s *pEnt = &m_VoiceHeadModels[iOutModel]; - ++iOutModel; - - memset(pEnt, 0, sizeof(*pEnt)); - - pEnt->curstate.rendermode = kRenderTransAdd; - pEnt->curstate.renderamt = 255; - pEnt->baseline.renderamt = 255; - pEnt->curstate.renderfx = kRenderFxNoDissipation; - pEnt->curstate.framerate = 1; - pEnt->curstate.frame = 0; - pEnt->model = (struct model_s*)gEngfuncs.GetSpritePointer(m_VoiceHeadModel); - pEnt->angles[0] = pEnt->angles[1] = pEnt->angles[2] = 0; - pEnt->curstate.scale = 0.5f; - - pEnt->origin[0] = pEnt->origin[1] = 0; - pEnt->origin[2] = 45; - - VectorAdd(pEnt->origin, pClient->origin, pEnt->origin); - - // Tell the engine. - gEngfuncs.CL_CreateVisibleEntity(ET_NORMAL, pEnt); - } -} - - - - -void CVoiceStatusHud::UpdateLocation(int entindex, const char *location) -{ - int iClient = entindex - 1; - if(iClient < 0) - return; - - CVoiceLabel *pLabel = FindVoiceLabel( iClient ); - if ( !pLabel ) - return; - - pLabel->SetLocation( location ); - - RepositionLabels(); -} - -CVoiceLabel* CVoiceStatusHud::FindVoiceLabel(int clientindex) -{ - for(int i=0; i < m_Labels.Count(); i++) - { - if(m_Labels[i]->GetClientIndex() == clientindex) - return m_Labels[i]; - } - - return NULL; -} - - -CVoiceLabel* CVoiceStatusHud::GetFreeVoiceLabel() -{ - CVoiceLabel *lab = FindVoiceLabel(-1); - if( !lab ) - { - lab = new CVoiceLabel(); - m_Labels.AddToTail( lab ); - } - return lab; -} - - -void CVoiceStatusHud::RepositionLabels() -{ - // find starting position to draw from, along right-hand side of screen - int y = ScreenHeight / 2; - - // Reposition active labels. - for(int i = 0; i < m_Labels.Count(); i++) - { - CVoiceLabel *pLabel = m_Labels[i]; - - int textWide, textTall; - pLabel->GetContentSize( textWide, textTall ); - pLabel->SetBounds( ScreenWidth - textWide - 8, y ); // if you adjust the x pos also play with VoiceVGUILabel in voice_status_hud.h - - y += textTall + 2; - } -} - - -void CVoiceStatusHud::UpdateSpeakerStatus(int entindex, bool bTalking) -{ - if( entindex == -2 ) // this is the local player - { - if( bTalking ) - { - int sizeX,sizeY; - IImage *image = m_pLocalPlayerTalkIcon->GetImage(); - if( image ) - { - image->GetContentSize( sizeX, sizeY ); - - int local_xPos = ScreenWidth - sizeX - 10; - int local_yPos = ScreenHeight - m_pHelper->GetAckIconHeight() - sizeY; - m_pLocalPlayerTalkIcon->SetPos( local_xPos, local_yPos ); - m_pLocalPlayerTalkIcon->SetVisible( true ); - } - } - else - { - m_pLocalPlayerTalkIcon->SetVisible( false ); - } - - } - else // a remote player, draw a label for them - { - if(entindex >= 0 && entindex <= MAX_PLAYERS) - { - int iClient = entindex - 1; - if(iClient < 0) - return; - - CVoiceLabel *pLabel = FindVoiceLabel(iClient); - if(bTalking) - { - // If we don't have a label for this guy yet, then create one. - if(!pLabel) - { - if(pLabel = GetFreeVoiceLabel()) - { - // Get the name from the engine. - hud_player_info_t info; - memset(&info, 0, sizeof(info)); - gEngfuncs.pfnGetPlayerInfo(entindex, &info); - - int color[3]; - m_pHelper->GetPlayerTextColor( entindex, color ); - - pLabel->SetFgColor( Color(255, 255, 255, 255) ); - pLabel->SetBgColor( Color(color[0], color[1], color[2], 180) ); - pLabel->SetPlayerName( info.name ); - pLabel->SetLocation( m_pHelper->GetPlayerLocation( entindex ) ); - pLabel->SetClientIndex( iClient ); - if ( m_pHelper ) - { - if ( m_pHelper->CanShowSpeakerLabels() ) - { - pLabel->SetVisible(true); - } - } - else - { - pLabel->SetVisible( true ); - } - - } - } - } - else - { - // If we have a label for this guy, kill it. - if(pLabel) - { - pLabel->SetVisible(false); - pLabel->SetClientIndex( -1 ); - } - } - } - } - - RepositionLabels(); -} - - diff --git a/game_shared/voice_status_hud.h b/game_shared/voice_status_hud.h deleted file mode 100644 index 6d881853c..000000000 --- a/game_shared/voice_status_hud.h +++ /dev/null @@ -1,154 +0,0 @@ -//========= Copyright � 1996-2001, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -#ifndef VOICE_STATUS_HUD_H -#define VOICE_STATUS_HUD_H -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "voice_common.h" -#include "cl_entity.h" -#include "voice_banmgr.h" - - -//----------------------------------------------------------------------------- -// Purpose: a label which displays a name and a speaking icon -//----------------------------------------------------------------------------- -class CVoiceLabel -{ -public: - CVoiceLabel() - { - m_pLabel = new VoiceVGUILabel( NULL, "VoiceLabel", ""); - m_pLabel->SetParent( gViewPortInterface->GetViewPortPanel() ); - m_pLabel->SetProportional(true); - m_pLabel->SetScheme("ClientScheme"); - vgui::SETUP_PANEL(m_pLabel); - m_clientindex = -1; // -1 means unassigned - m_locationString = NULL; - m_playerName = NULL; - } - - ~CVoiceLabel() - { - m_pLabel->MarkForDeletion(); - } - - // pass throughs for various label calls - void SetFgColor( Color c ) { m_pLabel->SetFgColor( c ); } - void SetBgColor( Color c ) { m_pLabel->SetBgColor( c ); } - void SetVisible( bool state ) { m_pLabel->SetVisible( state ); } - bool GetVisible() { return m_pLabel->IsVisible(); } - - void GetContentSize( int &wide, int &tall ) { m_pLabel->GetContentSize( wide, tall ); if( tall < 32 ) tall =32; } - void SetBounds( int x, int y ) { - m_pLabel->SetPos( x, y ); - int wide, tall; - m_pLabel->GetContentSize( wide, tall ); - m_pLabel->SetSize( wide, tall ); - } - - void SetClientIndex( int in ) { m_clientindex = in; } - int GetClientIndex() { return m_clientindex; } - - void SetLocation( const char *location ); - void SetPlayerName( const char *name ); - -private: - - //----------------------------------------------------------------------------- - // Purpose: inner class that overrides ApplySchemeSettings() for the label so an image can be loaded, also saves colors away - // so ApplySchemeSettings() doesn't override them - //----------------------------------------------------------------------------- - class VoiceVGUILabel : public vgui::Label - { - public: - VoiceVGUILabel( vgui::Panel *parent, const char *name, const char *text): Label(parent, name, text) {} - - - private: - // VGUI2 overrides - virtual void ApplySchemeSettings(vgui::IScheme *pScheme) - { - Label::ApplySchemeSettings(pScheme); - SetTextImageIndex(1); - SetImagePreOffset( 1, 2); // shift the text over a little - // you need to load the image here, after Label::ApplySchemeSettings()(as applysettings nulls out all existing images) - SetImageAtIndex( 0, vgui::scheme()->GetImage( "gfx/vgui/speaker4", false), 1 ); - } - - }; - - void RebuildLabelText(); - - VoiceVGUILabel *m_pLabel; // the label with the user name and icon - int m_clientindex; // Client index of the speaker. -1 if this label isn't being used. - wchar_t *m_locationString; // localized location string. NULL if the location is "". - char *m_playerName; -}; - - - -//----------------------------------------------------------------------------- -// Purpose: Handles the displaying of labels on the hud and icons above players in game when they talk -//----------------------------------------------------------------------------- -class CVoiceStatusHud : public IVoiceHud, public CHudBase -{ -public: - CVoiceStatusHud(); - virtual ~CVoiceStatusHud(); - - // CHudBase overrides. - // Initialize the cl_dll's voice manager. - virtual int Init(IVoiceStatusHelper *pHelper, IVoiceStatus *pStatus); - - // ackPosition is the bottom position of where CVoiceStatus will draw the voice acknowledgement labels. - virtual int VidInit(); - - // Call from the HUD_CreateEntities function so it can add sprites above player heads. - void CreateEntities(); - - void UpdateLocation(int entindex, const char *location); - - void UpdateSpeakerStatus(int entindex, bool bTalking); - - - CVoiceLabel* FindVoiceLabel(int clientindex); // Find a CVoiceLabel representing the specified speaker. - // Returns NULL if none. - // entindex can be -1 if you want a currently-unused voice label. - CVoiceLabel* GetFreeVoiceLabel(); // Get an unused voice label. Returns NULL if none. - void RepositionLabels(); - - -private: - - cl_entity_s m_VoiceHeadModels[VOICE_MAX_PLAYERS]; // These aren't necessarily in the order of players. They are just - // a place for it to put data in during CreateEntities. - HSPRITE m_VoiceHeadModel; // Voice head model (goes above players who are speaking). - float m_VoiceHeadModelHeight; // Height above their head to place the model. - - IVoiceStatusHelper *m_pHelper; - IVoiceStatus *m_pStatus; - - // Labels telling who is speaking. - CUtlVector m_Labels; - - vgui::ImagePanel *m_pLocalPlayerTalkIcon; -}; - - - -#endif // VOICE_STATUS_HUD_H diff --git a/game_shared/voice_vgui_tweakdlg.cpp b/game_shared/voice_vgui_tweakdlg.cpp deleted file mode 100644 index bbe6809d6..000000000 --- a/game_shared/voice_vgui_tweakdlg.cpp +++ /dev/null @@ -1,289 +0,0 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -#include "../cl_dll/hud.h" -#include "../cl_dll/cl_util.h" -#include "../cl_dll/vgui_teamfortressviewport.h" - - -#include "vgui_actionsignal.h" -#include "voice_vgui_tweakdlg.h" -#include "voice_vgui_tweakdlg.h" -#include "vgui_panel.h" -#include "vgui_scrollbar.h" -#include "vgui_slider.h" -#include "ivoicetweak.h" -#include "vgui_button.h" -#include "vgui_checkbutton2.h" -#include "vgui_helpers.h" - - -#define ITEM_BORDER 40 // Border between text and scrollbars on left and right. -#define VOICETWEAK_TRANSPARENCY 150 - - -class TweakScroller -{ -public: - TweakScroller(); - void Init(Panel *pParent, char *pText, int yPos); - - // Get/set value. Values are 0-1. - float GetValue(); - void SetValue(float val); - -public: - Label m_Label; - ScrollBar m_Scroll; - Slider m_Slider; -}; - - -class CVoiceVGUITweakDlg : public CMenuPanel, public ICheckButton2Handler -{ -typedef CMenuPanel BaseClass; - -public: - CVoiceVGUITweakDlg(); - ~CVoiceVGUITweakDlg(); - -// CMenuPanel overrides. -public: - virtual void Open(); - virtual void Close(); - - -// ICheckButton2Handler overrides. -public: - - virtual void StateChanged(CCheckButton2 *pButton); - - - -// Panel overrides. -public: - virtual void paintBackground(); - - -private: - - int m_DlgWidth; - int m_DlgHeight; - - Label m_Label; - - IVoiceTweak *m_pVoiceTweak; // Engine voice tweak API. - - TweakScroller m_MicVolume; - TweakScroller m_SpeakerVolume; - - CCheckButton2 m_VoiceModEnable; - - Button m_Button_OK; -}; - - - -bool g_bTweakDlgOpen = false; - -bool IsTweakDlgOpen() -{ - return g_bTweakDlgOpen; -} - - - -// ------------------------------------------------------------------------ // -// Global functions. -// ------------------------------------------------------------------------ // - -static CVoiceVGUITweakDlg g_VoiceTweakDlg; -CMenuPanel* GetVoiceTweakDlg() -{ - return &g_VoiceTweakDlg; -} - - -class CVoiceTweakOKButton : public ActionSignal -{ -public: - virtual void actionPerformed(Panel *pPanel) - { - gViewPort->HideVGUIMenu(); - } -}; -CVoiceTweakOKButton g_OKButtonSignal; - - - -// ------------------------------------------------------------------------ // -// TweakScroller -// ------------------------------------------------------------------------ // - -TweakScroller::TweakScroller() : - m_Label(""), - m_Scroll(0,0,0,0,false), - m_Slider(0,0,10,10,false) -{ -} - - -void TweakScroller::Init(Panel *pParent, char *pText, int yPos) -{ - int parentWidth, parentHeight; - pParent->getSize(parentWidth, parentHeight); - - // Setup the volume scroll bar. - m_Label.setParent(pParent); - m_Label.setFont(Scheme::sf_primary1); - m_Label.setContentAlignment(vgui::Label::a_northwest); - m_Label.setBgColor(0, 0, 0, 255); - m_Label.setFgColor(255,255,255,0); - m_Label.setPos(ITEM_BORDER, yPos); - m_Label.setSize(parentWidth/2-ITEM_BORDER, 20); - m_Label.setText(pText); - m_Label.setVisible(true); - - m_Slider.setRangeWindow(10); - m_Slider.setRangeWindowEnabled(true); - - m_Scroll.setPos(parentWidth/2+ITEM_BORDER, yPos); - m_Scroll.setSize(parentWidth/2-ITEM_BORDER*2, 20); - m_Scroll.setSlider(&m_Slider); - m_Scroll.setParent(pParent); - m_Scroll.setRange(0, 100); - m_Scroll.setFgColor(255,255,255,0); - m_Scroll.setBgColor(255,255,255,0); -} - - -float TweakScroller::GetValue() -{ - return m_Scroll.getValue() / 100.0f; -} - - -void TweakScroller::SetValue(float val) -{ - m_Scroll.setValue((int)(val * 100.0f)); -} - - -// ------------------------------------------------------------------------ // -// CVoiceVGUITweakDlg implementation. -// ------------------------------------------------------------------------ // - -CVoiceVGUITweakDlg::CVoiceVGUITweakDlg() - : CMenuPanel(VOICETWEAK_TRANSPARENCY, false, 0, 0, 0, 0), - m_Button_OK("",0,0), - m_Label("") -{ - m_pVoiceTweak = NULL; - m_Button_OK.addActionSignal(&g_OKButtonSignal); - m_Label.setBgColor(255,255,255,200); -} - - -CVoiceVGUITweakDlg::~CVoiceVGUITweakDlg() -{ -} - - -void CVoiceVGUITweakDlg::Open() -{ - if(g_bTweakDlgOpen) - return; - - g_bTweakDlgOpen = true; - - m_DlgWidth = ScreenWidth; - m_DlgHeight = ScreenHeight; - - m_pVoiceTweak = gEngfuncs.pVoiceTweak; - - // Tell the engine to start voice tweak mode (pipe voice output right to speakers). - m_pVoiceTweak->StartVoiceTweakMode(); - - // Set our size. - setPos((ScreenWidth - m_DlgWidth) / 2, (ScreenHeight - m_DlgHeight) / 2); - setSize(m_DlgWidth, m_DlgHeight); - - int curY = ITEM_BORDER; - m_MicVolume.Init(this, gHUD.m_TextMessage.BufferedLocaliseTextString("#Mic_Volume"), curY); - m_MicVolume.SetValue(m_pVoiceTweak->GetControlFloat(MicrophoneVolume)); - curY = PanelBottom(&m_MicVolume.m_Label); - - m_SpeakerVolume.Init(this, gHUD.m_TextMessage.BufferedLocaliseTextString("#Speaker_Volume"), curY); - m_SpeakerVolume.SetValue(m_pVoiceTweak->GetControlFloat(OtherSpeakerScale)); - curY = PanelBottom(&m_SpeakerVolume.m_Label); - - m_VoiceModEnable.setParent(this); - m_VoiceModEnable.SetImages("gfx/vgui/checked.tga", "gfx/vgui/unchecked.tga"); - m_VoiceModEnable.SetText("Enable Voice In This Mod"); - m_VoiceModEnable.setPos(ITEM_BORDER, curY); - m_VoiceModEnable.SetCheckboxLeft(false); - m_VoiceModEnable.SetChecked(!!gEngfuncs.pfnGetCvarFloat("voice_modenable")); - m_VoiceModEnable.SetHandler(this); - - // Setup the OK button. - int buttonWidth, buttonHeight; - m_Button_OK.setText(gHUD.m_TextMessage.BufferedLocaliseTextString("#Menu_OK")); - m_Button_OK.getSize(buttonWidth, buttonHeight); - m_Button_OK.setPos((m_DlgWidth - buttonWidth) / 2, m_DlgHeight - buttonHeight - 3); - m_Button_OK.setParent(this); - - // Put the label on the top. - m_Label.setBgColor(0, 0, 0, 255); - m_Label.setFgColor(255,255,255,0); - m_Label.setText(gHUD.m_TextMessage.BufferedLocaliseTextString("#Voice_Properties")); - int labelWidth, labelHeight; - m_Label.getSize(labelWidth, labelHeight); - m_Label.setPos((m_DlgWidth - labelWidth) / 2, 5); - m_Label.setParent(this); - - BaseClass::Open(); -} - - -void CVoiceVGUITweakDlg::Close() -{ - m_pVoiceTweak->EndVoiceTweakMode(); - g_bTweakDlgOpen = false; - - BaseClass::Close(); -} - - -void CVoiceVGUITweakDlg::paintBackground() -{ - BaseClass::paintBackground(); - - // Draw our border. - int w,h; - getSize(w,h); - - drawSetColor(128,128,128,1); - drawOutlinedRect(0, 0, w, h); - - float volume = m_MicVolume.GetValue(); - m_pVoiceTweak->SetControlFloat(MicrophoneVolume, volume); - - m_pVoiceTweak->SetControlFloat(OtherSpeakerScale, m_SpeakerVolume.GetValue()); -} - - -void CVoiceVGUITweakDlg::StateChanged(CCheckButton2 *pButton) -{ - if(pButton == &m_VoiceModEnable) - { - if(pButton->IsChecked()) - gEngfuncs.pfnClientCmd("voice_modenable 1"); - else - gEngfuncs.pfnClientCmd("voice_modenable 0"); - } -} - diff --git a/game_shared/voice_vgui_tweakdlg.h b/game_shared/voice_vgui_tweakdlg.h deleted file mode 100644 index dcd39263d..000000000 --- a/game_shared/voice_vgui_tweakdlg.h +++ /dev/null @@ -1,25 +0,0 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -#ifndef VOICE_VGUI_TWEAKDLG_H -#define VOICE_VGUI_TWEAKDLG_H -#ifdef _WIN32 -#pragma once -#endif - - -class CMenuPanel; - - -// Returns true if the tweak dialog is currently up. -bool IsTweakDlgOpen(); - -// Returns a global instance of the tweak dialog. -CMenuPanel* GetVoiceTweakDlg(); - - -#endif // VOICE_VGUI_TWEAKDLG_H