diff --git a/releases/valve/source/mod/AvHHud.cpp b/releases/valve/source/mod/AvHHud.cpp index 376d8dd6..7a548d39 100644 --- a/releases/valve/source/mod/AvHHud.cpp +++ b/releases/valve/source/mod/AvHHud.cpp @@ -183,7 +183,7 @@ #include "mod/AvHServerVariables.h" #include "mod/AvHPlayerUpgrade.h" #include "mod/AvHCommandConstants.h" -#include "mod/AvHDebugUtil.h" +#include "mod/AvHDebugUtil.h" #include "engine/keydefs.h" #include "mod/ChatPanel.h" #include "cl_dll/r_studioint.h" @@ -350,7 +350,7 @@ bool AvHHud::OnKeyEvent(int virtualKey, int scanCode, bool pressed) if (pressed) { theChatPanel->KeyDown(virtualKey, scanCode); - return true; + return true; } else { @@ -359,7 +359,7 @@ bool AvHHud::OnKeyEvent(int virtualKey, int scanCode, bool pressed) return theChatPanel->WasKeyPushed(virtualKey); } } - + if (virtualKey == VK_ESCAPE && GetInTopDownMode() && mGhostBuilding != MESSAGE_NULL) { if (pressed) @@ -368,7 +368,7 @@ bool AvHHud::OnKeyEvent(int virtualKey, int scanCode, bool pressed) } return true; } - + } return false; @@ -388,7 +388,7 @@ int AvHHud::GetGameTime() const } int AvHHud::GetGameTimeLimit() const -{ +{ return this->mTimeLimit; } @@ -416,7 +416,7 @@ bool AvHHud::GetIsAlive(bool inIncludeSpectating) const { thePlayer = this->GetVisiblePlayer(); } - + if(thePlayer) { int thePlayerIndex = thePlayer->index; @@ -447,19 +447,19 @@ bool AvHHud::GetIsAlive(bool inIncludeSpectating) const bool GetIsWithinRegion(float inNormX, float inNormY, float inLowX, float inLowY, float inHighX, float inHighY) { bool inRegion = false; - + if((inNormX >= inLowX) && (inNormY >= inLowY) && (inNormX <= inHighX) && (inNormY < inHighY)) { inRegion = true; } - + return inRegion; } bool AvHHud::GetIsRegionBlockedByUI(float inNormX, float inNormY) { bool theIsBlocked = true; - + if( GetIsWithinRegion(inNormX, inNormY, 0, .061, .3017, .6797) || GetIsWithinRegion(inNormX, inNormY, .248, .0791, .7753, .6823) || GetIsWithinRegion(inNormX, inNormY, .748, .092, 1, .6575) || @@ -475,16 +475,16 @@ bool AvHHud::GetIsRegionBlockedByUI(float inNormX, float inNormY) AvHMessageID theMessageID = theIterator->first; char theComponentName[256]; sprintf(theComponentName, kPendingImpulseSpecifier, (int)theMessageID); - + AvHTechImpulsePanel* theTechImpulsePanel = NULL; if(this->GetManager().GetVGUIComponentNamed(theComponentName, theTechImpulsePanel)) { int thePosX, thePosY; theTechImpulsePanel->getPos(thePosX, thePosY); - + int theWidth, theHeight; theTechImpulsePanel->getSize(theWidth, theHeight); - + int theHighX = thePosX + theWidth; int theHighY = thePosY + theHeight; @@ -499,7 +499,7 @@ bool AvHHud::GetIsRegionBlockedByUI(float inNormX, float inNormY) } } } - + return theIsBlocked; } @@ -524,7 +524,7 @@ void AvHHud::ClearSelection() #ifdef AVH_PREDICT_SELECT gSelectionHelper.ClearSelection(); #endif - + this->mGroupEvent = COMMANDER_REMOVESELECTION; } @@ -560,19 +560,19 @@ void AvHHud::AddTooltip(const char* inMessageText, bool inIsToolTip, float inToo if(gEngfuncs.pfnGetCvarFloat(kvAutoHelp) || !inIsToolTip) { AvHTooltip theNewTooltip; - + theNewTooltip.SetText(string(inMessageText)); theNewTooltip.SetNormalizedScreenX(1.0f - inTooltipWidth - kHelpMessageLeftEdgeInset); theNewTooltip.SetNormalizedScreenY(0.01f); theNewTooltip.SetCentered(false); theNewTooltip.SetIgnoreFadeForLifetime(true); theNewTooltip.SetNormalizedMaxWidth(inTooltipWidth); - + if(inIsToolTip) { this->PlayHUDSound(HUD_SOUND_TOOLTIP); } - + this->mTooltips.push_back(theNewTooltip); } } @@ -581,9 +581,9 @@ void AvHHud::AddTooltip(const char* inMessageText, bool inIsToolTip, float inToo bool AvHHud::AddTooltipOnce(const char* inMessageText, bool inIsToolTip) { bool theAddedTooltip = false; - + string theMessage(inMessageText); - + // Check if message is in sent list StringList::iterator theIter = std::find(this->mDisplayedToolTipList.begin(), this->mDisplayedToolTipList.end(), theMessage); if(theIter == this->mDisplayedToolTipList.end()) @@ -592,11 +592,11 @@ bool AvHHud::AddTooltipOnce(const char* inMessageText, bool inIsToolTip) // Call AddTooltip this->AddTooltip(inMessageText, inIsToolTip); theAddedTooltip = true; - + // Add message to list this->mDisplayedToolTipList.push_back(theMessage); } - + return theAddedTooltip; } @@ -612,10 +612,10 @@ void AvHHud::Cancel(void) void AvHHud::ClearData() { this->mResources = 0; - + this->mHierarchy = NULL; this->mShowMapHierarchy = NULL; - + this->mCommanderResourceLabel = NULL; this->mGenericProgressBar = NULL; this->mResearchProgressBar = NULL; @@ -650,7 +650,7 @@ void AvHHud::ClearData() this->mMouseCursorX = this->mMouseCursorY = 0; this->mPieMenuControl = ""; - + this->mPreviousHelpText = ""; this->mTimeLastHelpTextChanged = -1; this->mCurrentCursorFrame = 0; @@ -723,17 +723,17 @@ void AvHHud::AddCommands() gEngfuncs.pfnAddCommand ("+mousepopupmenu", AvHPieMenuHandler::OpenPieMenu); gEngfuncs.pfnAddCommand ("-mousepopupmenu", AvHPieMenuHandler::ClosePieMenu); - + // Add scrolling commands gEngfuncs.pfnAddCommand ("+scrollup", AvHScrollHandler::ScrollUp); gEngfuncs.pfnAddCommand ("-scrollup", AvHScrollHandler::StopScroll); - + gEngfuncs.pfnAddCommand ("+scrolldown", AvHScrollHandler::ScrollDown); gEngfuncs.pfnAddCommand ("-scrolldown", AvHScrollHandler::StopScroll); - + gEngfuncs.pfnAddCommand ("+scrollleft", AvHScrollHandler::ScrollLeft); gEngfuncs.pfnAddCommand ("-scrollleft", AvHScrollHandler::StopScroll); - + gEngfuncs.pfnAddCommand ("+scrollright", AvHScrollHandler::ScrollRight); gEngfuncs.pfnAddCommand ("-scrollright", AvHScrollHandler::StopScroll); @@ -783,9 +783,9 @@ void AvHHud::ClientProcessEntity(struct entity_state_s* inEntity) int theGenEntIndex = (0xFFFF0000 & theValue) >> 16; //int theTemplateIndex = (0x0000FFFF & theValue); int theTemplateIndex = (((int(inEntity->fuser1)) & 0x0000FF00) >> 8); - + //int theTemplateIndex = theValue; - + // Handle stored in fuser2 theHandle = (int)(inEntity->fuser2); @@ -797,7 +797,7 @@ void AvHHud::ClientProcessEntity(struct entity_state_s* inEntity) if(!theTemplate->GetHighDetailOnly() || gEngfuncs.pfnGetCvarFloat(kvHighDetail)) { AvHParticleSystemManager::Instance()->CreateParticleSystemIfNotCreated(inEntity->number, theTemplateIndex, /*theEntIndex,*/ theHandle); - + // Update postion and visibility if(theGenEntIndex > 0) { @@ -811,7 +811,7 @@ void AvHHud::ClientProcessEntity(struct entity_state_s* inEntity) { AvHParticleSystemManager::Instance()->SetParticleSystemPosition(inEntity->origin, theHandle); } - + // Set the particle system custom data //uint16 theCustomData = (uint16)(((int)inEntity->fuser3) >> 16); //uint16 theCustomData = (uint16)(inEntity->fuser3); @@ -844,7 +844,7 @@ void AvHHud::ClientProcessEntity(struct entity_state_s* inEntity) { theVisibilityState = true; } - + AvHParticleSystemManager::Instance()->SetParticleSystemVisibility(theVisibilityState, theHandle); } else if((inEntity->iuser3 == AVH_USER3_AUDIO_ON) || (inEntity->iuser3 == AVH_USER3_AUDIO_OFF)) @@ -865,7 +865,7 @@ void AvHHud::ClientProcessEntity(struct entity_state_s* inEntity) int theFadeDistance = (inEntity->iuser4) & 0x0000FFFF; float theTimeOfAction = inEntity->fuser2; - + bool theSoundOn = (inEntity->iuser3 == AVH_USER3_AUDIO_ON); this->ModifyAmbientSoundEntryIfChanged(theSoundOn, theSoundIndex, theEntIndex, theTimeOfAction, theVolume, theFadeDistance, theFlags, inEntity->origin); @@ -903,7 +903,7 @@ void AvHHud::DisplayCombatUpgradeMenu(bool inVisible) string theFinalText = theYouAreNow + string(" ") + theRankTitle + theExclamation + string("\n"); theFinalText += theChooseAnUpgrade + string("\n\n"); - + // Set the lines this->mCombatUpgradeMenu.SetText(theFinalText); } @@ -941,7 +941,7 @@ void AvHHud::DisplayMessage(const char* inMessage) int AvHHud::GetFrameForOrderType(AvHOrderType inOrderType) const { int theFrame = 0; - + switch(inOrderType) { case ORDERTYPEL_DEFAULT: @@ -999,13 +999,13 @@ AvHPlayMode AvHHud::GetPlayMode(void) const AvHPlayMode AvHHud::GetHUDPlayMode() const { AvHPlayMode thePlayMode = this->GetPlayMode(); - + cl_entity_s* thePlayer = this->GetVisiblePlayer(); if(thePlayer) { thePlayMode = AvHPlayMode(thePlayer->curstate.playerclass); } - + return thePlayMode; } @@ -1027,7 +1027,7 @@ cl_entity_s* AvHHud::GetVisiblePlayer() const int AvHHud::GetLocalUpgrades() const { static int theUpgrades = 0; - + cl_entity_s* thePlayer = this->GetVisiblePlayer(); if(thePlayer) { @@ -1058,7 +1058,7 @@ EntityListType AvHHud::GetDrawPlayerOrders() const return this->mSelected; } } - + return theList; } @@ -1085,7 +1085,7 @@ OrderListType AvHHud::GetOrderList() const bool AvHHud::GetCenterPositionForGroup(int inGroupNumber, vec3_t& outCenterPosition) const { bool theSuccess = false; - + if((inGroupNumber >= 1) && (inGroupNumber <= kNumHotkeyGroups)) { vec3_t theCenterPosition; @@ -1099,14 +1099,14 @@ bool AvHHud::GetCenterPositionForGroup(int inGroupNumber, vec3_t& outCenterPosit for(EntityListType::const_iterator theIter = theGroup.begin(); theIter != theGroup.end(); theIter++) { int theEntIndex = *theIter; - + Vector thePosition; cl_entity_s* theEntity = gEngfuncs.GetEntityByIndex(theEntIndex); if(theEntity) { thePosition = theEntity->curstate.origin; } - + if(AvHSHUGetEntityLocation(theEntIndex, thePosition)) { theCenterPosition.x += thePosition.x; @@ -1119,9 +1119,9 @@ bool AvHHud::GetCenterPositionForGroup(int inGroupNumber, vec3_t& outCenterPosit { theCenterPosition.x /= theNumFound; theCenterPosition.y /= theNumFound; - + outCenterPosition = theCenterPosition; - + theSuccess = true; } } @@ -1133,11 +1133,11 @@ bool AvHHud::GetCenterPositionForGroup(int inGroupNumber, vec3_t& outCenterPosit void AvHHud::GetMousePos(int& outX, int& outY) const { gEngfuncs.GetMousePosition(&outX, &outY); - + // Clip mouse to window (weird) outX = min(max(0, outX), ScreenWidth()); outY = min(max(0, outY), ScreenHeight()); - + //char theMouseMessage[256]; //sprintf(theMouseMessage, "Mouse coords: %d, %d", outX, outY); //CenterPrint(theMouseMessage); @@ -1149,9 +1149,9 @@ bool AvHHud::GetAndClearTopDownScrollAmount(int& outX, int& outY, int& outZ) outX = 0; outY = 0; outZ = 0; - + // Don't scroll if the the commander is dragging a selection box. - + if(this->GetInTopDownMode() && !GetIsSelecting()) { const int kScreenWidth = ScreenWidth(); @@ -1183,10 +1183,10 @@ bool AvHHud::GetAndClearTopDownScrollAmount(int& outX, int& outY, int& outZ) // Only clear z scroll because of the way events work (invnext/invprev vs. holding a key down) //gScrollHandler.ClearScrollHeight(); - + theSuccess = true; } - + return theSuccess; } @@ -1247,7 +1247,7 @@ bool AvHHud::GetAndClearSelectionEvent(vec3_t& outSelection, AvHMessageID& outMe outMessageID = COMMANDER_MOUSECOORD; theSuccess = true; } - + return theSuccess; } @@ -1264,32 +1264,32 @@ const AvHTechSlotManager& AvHHud::GetTechSlotManager() const bool AvHHud::GetAndClearAlienAbility(AvHMessageID& outMessageID) { bool theAlienAbilityWaiting = false; - + if(this->mAlienAbility != MESSAGE_NULL) { outMessageID = this->mAlienAbility; theAlienAbilityWaiting = true; this->mAlienAbility = MESSAGE_NULL; } - + return theAlienAbilityWaiting; } bool AvHHud::GetAndClearGroupEvent(AvHMessageID& outMessageID) { bool theGroupEventWaiting = false; - + if(this->mGroupEvent != MESSAGE_NULL) { outMessageID = this->mGroupEvent; theGroupEventWaiting = true; - + // if(!this->mIsTracking) // { this->mGroupEvent = MESSAGE_NULL; // } } - + return theGroupEventWaiting; } @@ -1309,7 +1309,7 @@ void AvHHud::SetSelectionEffects(EntityListType& inUnitList) // have selection effects that aren't in this list, delete them. This is called locally when the // selection is predicted, then it's called again when the selection is confirmed. this->mSelectionEffects.clear(); - + for(EntityListType::iterator theIter = inUnitList.begin(); theIter != inUnitList.end(); theIter++) { SelectionEffect theNewEffect; @@ -1393,7 +1393,7 @@ bool AvHHud::Update(float inCurrentTime, string& outErrorString) this->GetManager().UnhideComponent(kLastComponent); this->UpdateDemoRecordPlayback(); - + theSuccess = UIHud::Update(inCurrentTime, outErrorString); if(!theSuccess) { @@ -1407,12 +1407,12 @@ bool AvHHud::Update(float inCurrentTime, string& outErrorString) this->UpdateAlienUI(inCurrentTime); this->UpdateMarineUI(inCurrentTime); - + this->UpdateCountdown(inCurrentTime); this->UpdateExploitPrevention(); this->UpdateFromEntities(inCurrentTime); - + this->UpdateEntityID(inCurrentTime); this->UpdateHelpText(); @@ -1446,24 +1446,24 @@ bool AvHHud::Update(float inCurrentTime, string& outErrorString) { this->ResetTopDownUI(); } - + // Update orders //for(OrderListType::iterator theIter = this->mOrders.begin(); theIter != this->mOrders.end(); theIter++) //{ // theIter->Update(); //} - + this->UpdateTechNodes(); - + this->UpdateAmbientSounds(); this->UpdateViewModelEffects(); mOverviewMap.UpdateOrders(mOrders, GetDrawPlayerOrders()); mOverviewMap.Update(inCurrentTime); - + float theTimePassed = inCurrentTime - this->mTimeOfLastUpdate; - + AvHParticleSystemManager::Instance()->Update(theTimePassed); AvHScriptManager::Instance()->ClientUpdate(theTimePassed); @@ -1484,7 +1484,7 @@ bool AvHHud::Update(float inCurrentTime, string& outErrorString) int theNum = AvHParticleSystemManager::Instance()->GetNumberParticleSystems(); int theNumTemplates = gParticleTemplateList.GetNumberTemplates(); sprintf(theDebugText, "(vis, total, list): %d, %d, %d", theNumVisible, theNum, theNumTemplates); - + //sprintf(theDebugText, "step interval: %d", pmove->flTimeStepSound); /* @@ -1506,9 +1506,9 @@ bool AvHHud::Update(float inCurrentTime, string& outErrorString) this->mLastUser3 = this->GetHUDUser3(); this->mLastTeamNumber = this->GetHUDTeam(); this->mLastPlayMode = this->GetPlayMode(); - + this->mTimeOfLastUpdate = inCurrentTime; - + // Save view origin and angles before we do crazy viewport stuff // gPlayerOrigin = v_origin; // gPlayerAngles = v_angles; @@ -1530,14 +1530,14 @@ bool AvHHud::Update(float inCurrentTime, string& outErrorString) bool AvHHud::GetAndClearTechEvent(AvHMessageID& outMessageID) { bool theTechEventWaiting = false; - + if(this->mTechEvent != MESSAGE_NULL) { outMessageID = this->mTechEvent; theTechEventWaiting = true; this->mTechEvent = MESSAGE_NULL; } - + return theTechEventWaiting; } @@ -1588,9 +1588,9 @@ void AvHHud::SetLastHotkeySelectionEvent(AvHMessageID inMessageID) bool AvHHud::GetIsAlien() const { bool theIsAlien = false; - + AvHUser3 theUser3 = this->GetHUDUser3(); - + switch(theUser3) { case AVH_USER3_ALIEN_PLAYER1: @@ -1602,7 +1602,7 @@ bool AvHHud::GetIsAlien() const theIsAlien = true; break; } - + return theIsAlien; } @@ -1611,7 +1611,7 @@ bool AvHHud::GetIsBeingDigested() const bool theIsBeingDigested = false; int theUpgrades = this->GetHUDUpgrades(); - + if(GetHasUpgrade(theUpgrades, MASK_DIGESTING)) { cl_entity_t* theVisiblePlayer = this->GetVisiblePlayer(); @@ -1639,9 +1639,9 @@ bool AvHHud::GetIsStunned() const bool AvHHud::GetIsDigesting() const { bool theIsDigesting = false; - + int theUpgrades = this->GetHUDUpgrades(); - + if(GetHasUpgrade(theUpgrades, MASK_DIGESTING)) { cl_entity_t* theVisiblePlayer = this->GetVisiblePlayer(); @@ -1650,7 +1650,7 @@ bool AvHHud::GetIsDigesting() const theIsDigesting = true; } } - + return theIsDigesting; } @@ -1662,12 +1662,12 @@ bool AvHHud::GetIsNotInControl() const bool AvHHud::GetIsInTopDownMode() const { bool theIsInTopDownMode = false; - + if(GetHasUpgrade(this->GetHUDUpgrades(), MASK_TOPDOWN)) { theIsInTopDownMode = true; } - + return theIsInTopDownMode; } @@ -1695,7 +1695,7 @@ bool AvHHud::GetHasJetpack() const { int theLocalUpgrades = this->GetHUDUpgrades(); bool theHasJetpackUpgrade = GetHasUpgrade(theLocalUpgrades, MASK_UPGRADE_7) && this->GetIsMarine(); - + return theHasJetpackUpgrade; } @@ -1729,19 +1729,19 @@ bool AvHHud::GetIsMarine() const theIsMarine = true; break; } - + return theIsMarine; } bool AvHHud::GetIsRelevant() const { bool theIsRelevant = false; - + if(this->GetIsAlive() && (this->GetPlayMode() == PLAYMODE_PLAYING) /*&& !this->GetIsSpectator()*/) { theIsRelevant = true; } - + return theIsRelevant; } @@ -1888,7 +1888,7 @@ bool AvHHud::SetGamma(float inSlope) // Disable gamma stuff in debug for sanity // #ifndef DEBUG - + HDC theDC = GetDC(NULL); if(theDC != 0) { @@ -1903,7 +1903,7 @@ bool AvHHud::SetGamma(float inSlope) { // Tell UI components so they can change shading to look the same this->GetManager().NotifyGammaChange(theGammaToTry); - + //float theColorBias = 1/this->mGammaSlope; // //if(this->mSoldierMenu) @@ -1915,12 +1915,12 @@ bool AvHHud::SetGamma(float inSlope) //{ // this->mAlienMenu->SetColorBias(theColorBias); //} - + // aww yeah theSuccess = true; } } - + char theMessage[256]; if(theSuccess) { @@ -1935,7 +1935,7 @@ bool AvHHud::SetGamma(float inSlope) { CenterPrint(theMessage); } - + if(!ReleaseDC(NULL, theDC)) { // emit error about leak @@ -1943,7 +1943,7 @@ bool AvHHud::SetGamma(float inSlope) } //#endif - + return theSuccess; } @@ -1957,21 +1957,21 @@ bool AvHHud::SlotInput(int inSlot) { // TODO: Read state of control/duck here bool theCreateGroup = false; - + int theButtonBits = CL_ButtonBits(0); if(theButtonBits & IN_DUCK) { theCreateGroup = true; - + //#ifdef AVH_PREDICT_SELECT //this->PlayHUDSound(AvHHUDSound(HUD_SOUND_SQUAD1 + inSlot)); //#endif } - + int theBaseOffset = theCreateGroup ? GROUP_CREATE_1 : GROUP_SELECT_1; - + this->mGroupEvent = (AvHMessageID)(theBaseOffset + inSlot); - + theHandled = true; } } @@ -1986,7 +1986,7 @@ bool AvHHud::SlotInput(int inSlot) // char szbuf[32]; // sprintf(szbuf, "impulse %d\n", theImpulse); // ClientCmd(szbuf); -// +// // theHandled = true; // } // } @@ -2030,7 +2030,7 @@ void AvHHud::ResetTopDownUI() this->mGhostBuilding = MESSAGE_NULL; this->mSelected.clear(); this->mSelectionEffects.clear(); - + gCommanderHandler.Reset(); for(int i = 0; i < kNumHotkeyGroups; i++) @@ -2059,7 +2059,7 @@ void AvHHud::SetSelectingWeaponID(int inWeaponID, int inR, int inG, int inB) { this->mHelpMessage.SetB(inB); } - + this->mSelectingWeaponID = inWeaponID; } } @@ -2102,7 +2102,7 @@ int AvHHud::Countdown(const char* pszName, int iSize, void* pbuf) // // // Make the change // this->ChangeUpgradeCosts(theOldMessageID, theNewMessageID, theString); -// +// // // TODO: Is it ok to return this here? 2 bytes for the ids, one for the string? // return 3; //} @@ -2140,10 +2140,10 @@ void AvHHud::ModifyAmbientSoundEntryIfChanged(bool inSoundOn, int inSoundIndex, { // If found, remember that we found it theFoundSound = true; - + // Set position theIter->SetPosition(inOrigin); - + // If we're turning off sound, kill the sound if(!inSoundOn) { @@ -2157,13 +2157,13 @@ void AvHHud::ModifyAmbientSoundEntryIfChanged(bool inSoundOn, int inSoundIndex, theIter++; } } - + // If we're turning a sound on, and we didn't find one if(inSoundOn && !theFoundSound) { bool theLooping = inFlags & 2; float theTimeElapsed = this->mTimeOfLastUpdate - inTimeStarted; - + // Add new entry with these values this->mAmbientSounds.push_back(AvHAmbientSound(theSoundName, inVolume, inFadeDistance, theLooping, inOrigin, inEntIndex, theTimeElapsed)); } @@ -2188,30 +2188,30 @@ void AvHHud::OrderNotification(const AvHOrder& inOrder) // Do a switch on the order type AvHOrderType theOrderType = inOrder.GetOrderType(); AvHHUDSound theSound = HUD_SOUND_INVALID; - + // Play HUD sound depending on order switch(theOrderType) { case ORDERTYPEL_MOVE: theSound = HUD_SOUND_ORDER_MOVE; break; - + case ORDERTYPET_ATTACK: theSound = HUD_SOUND_ORDER_ATTACK; break; - + case ORDERTYPET_BUILD: theSound = HUD_SOUND_ORDER_BUILD; break; - + case ORDERTYPET_GUARD: theSound = HUD_SOUND_ORDER_GUARD; break; - + case ORDERTYPET_WELD: theSound = HUD_SOUND_ORDER_WELD; break; - + case ORDERTYPET_GET: theSound = HUD_SOUND_ORDER_GET; break; @@ -2231,41 +2231,41 @@ void AvHHud::ResetComponentsForUser3() { this->mPieMenuControl = ""; - + this->GetManager().HideComponents(); if(gParticleEditorHandler.GetInEditMode()) { gHUD.GetManager().UnhideComponent(kPSESizeSlider); gHUD.GetManager().UnhideComponent(kPSESizeLabel); - + gHUD.GetManager().UnhideComponent(kPSEScaleSlider); gHUD.GetManager().UnhideComponent(kPSEScaleLabel); - + gHUD.GetManager().UnhideComponent(kPSEGenerationRateSlider); gHUD.GetManager().UnhideComponent(kPSEGenerationRateLabel); - + gHUD.GetManager().UnhideComponent(kPSEParticleLifetimeSlider); gHUD.GetManager().UnhideComponent(kPSEParticleLifetimeLabel); - + gHUD.GetManager().UnhideComponent(kPSEParticleSystemLifetimeSlider); gHUD.GetManager().UnhideComponent(kPSEParticleSystemLifetimeLabel); - + gHUD.GetManager().UnhideComponent(kPSEMaxParticlesSlider); gHUD.GetManager().UnhideComponent(kPSEMaxParticlesLabel); - + gHUD.GetManager().UnhideComponent(kPSEDrawModeSlider); gHUD.GetManager().UnhideComponent(kPSEDrawModeLabel); - + gHUD.GetManager().UnhideComponent(PSEGenVelToggleSlider); gHUD.GetManager().UnhideComponent(kPSEGenVelToggleLabel); - + gHUD.GetManager().UnhideComponent(kPSEGenVelShapeSlider); gHUD.GetManager().UnhideComponent(kPSEGenVelShapeLabel); - + gHUD.GetManager().UnhideComponent(kPSEGenVelParamNumSlider); gHUD.GetManager().UnhideComponent(kPSEGenVelParamNumLabel); - + gHUD.GetManager().UnhideComponent(kPSEGenVelParamValueSlider); gHUD.GetManager().UnhideComponent(kPSEGenVelParamValueLabel); } @@ -2273,7 +2273,7 @@ void AvHHud::ResetComponentsForUser3() { bool theIsCombatMode = (this->mMapMode == MAP_MODE_CO); bool theIsNSMode = (this->mMapMode == MAP_MODE_NS); - + if((this->GetHUDPlayMode() == PLAYMODE_PLAYING) && !this->GetIsNotInControl() && !gViewPort->IsOptionsMenuVisible()) { switch(this->GetHUDUser3()) @@ -2300,7 +2300,7 @@ void AvHHud::ResetComponentsForUser3() //this->GetManager().UnhideComponent(kDebugCSPServerLabel); //this->GetManager().UnhideComponent(kDebugCSPClientLabel); break; - + case AVH_USER3_COMMANDER_PLAYER: if(this->mInTopDownMode) { @@ -2319,7 +2319,7 @@ void AvHHud::ResetComponentsForUser3() } //this->GetManager().UnhideComponent(kReinforcementsLabel); break; - + case AVH_USER3_ALIEN_PLAYER1: case AVH_USER3_ALIEN_PLAYER2: case AVH_USER3_ALIEN_PLAYER3: @@ -2333,7 +2333,7 @@ void AvHHud::ResetComponentsForUser3() { this->mPieMenuControl = kAlienMenu; } - + if (g_iUser1 == OBS_NONE) { this->GetManager().UnhideComponent(mPieMenuControl.c_str()); @@ -2355,7 +2355,7 @@ void AvHHud::ResetComponentsForUser3() } mOverviewMap.SetUser3(this->GetHUDUser3()); - + // Update command hierarchy so it can potentially display differently if(this->mHierarchy) { @@ -2381,7 +2381,7 @@ int AvHHud::BalanceVar(const char* pszName, int iSize, void* pbuf) // Read byte indicating whether to be stored as a long or float int theFloatData = READ_BYTE(); - + // Read data int theIntValue = READ_LONG(); theBytesRead += 4; @@ -2421,7 +2421,7 @@ int AvHHud::GameStatus(const char* pszName, int iSize, void* pbuf) { int theBytesRead = 0; BEGIN_READ(pbuf, iSize); - + BYTE theStatusByte = READ_BYTE(); theBytesRead++; @@ -2440,7 +2440,7 @@ int AvHHud::GameStatus(const char* pszName, int iSize, void* pbuf) // gViewAngles[2] = READ_COORD(); // gResetViewAngles = true; } - + bool theMapChange = false; if(theStatusByte == kGameStatusResetNewMap) { @@ -2468,7 +2468,7 @@ int AvHHud::GameStatus(const char* pszName, int iSize, void* pbuf) this->mExperienceLevelSpent = READ_BYTE(); theBytesRead++; } - + return theBytesRead; } @@ -2479,7 +2479,7 @@ int AvHHud::MiniMap(const char* pszName, int iSize, void* pbuf) BEGIN_READ(pbuf, iSize); theBytesRead += gMiniMap.ReceiveFromNetworkStream(); - + return theBytesRead; } @@ -2493,7 +2493,7 @@ int AvHHud::ServerVar(const char* pszName, int iSize, void* pbuf) std::string theVariableValue = READ_STRING(); mServerVariableMap[theVariableName] = theVariableValue; - + return 1; } @@ -2504,7 +2504,7 @@ int AvHHud::ServerVar(const char* pszName, int iSize, void* pbuf) //{ // int theBytesRead = 0; // BEGIN_READ(pbuf, iSize); -// +// // BYTE theStatusByte = READ_BYTE(); // theBytesRead++; // @@ -2524,7 +2524,7 @@ int AvHHud::Progress(const char* pszName, int iSize, void* pbuf) this->mProgressBarParam = READ_BYTE(); theBytesRead++; - + return theBytesRead; } @@ -2543,10 +2543,10 @@ void AvHHud::ResetGame(bool inMapChanged) // Don't use a menu yet //this->ResetUpgradeCosts(); - + // Reset armor as well. //this->mArmorLevel = ARMOR_BASE; - + // Clear out all particle systems and templates if(inMapChanged) { @@ -2563,18 +2563,21 @@ void AvHHud::ResetGame(bool inMapChanged) } } + // puzl: 1066 reset overview map on game restart + gHUD.GetOverviewMap().Clear(); + AvHParticleSystemManager::Instance()->Reset(); this->mTechSlotManager.Clear(); this->mTechNodes.Clear(); - + this->mTimeOfCurrentUpdate = 0.0f; // On game reset, clear blips (happens on server as well) - + this->mEntityHierarchy.Clear(); - + // Clear selection effects this->mSelectionEffects.clear(); @@ -2583,7 +2586,7 @@ void AvHHud::ResetGame(bool inMapChanged) // Clear client scripts AvHScriptManager::Instance()->Reset(); - + // Selection and commander variables this->mNumLocalSelectEvents = 0; this->mMapMode = MAP_MODE_UNDEFINED; @@ -2593,17 +2596,17 @@ void AvHHud::ResetGame(bool inMapChanged) this->mPlacingBuilding = false; sShowMap = false; - + this->StopMusic(); - + for(AmbientSoundListType::iterator theIter = this->mAmbientSounds.begin(); theIter != this->mAmbientSounds.end(); theIter++) { theIter->ClearData(); } this->mAmbientSounds.clear(); - + this->SetReinforcements(0); - + this->mOrders.clear(); this->mCurrentCursorFrame = 0; @@ -2696,17 +2699,17 @@ BIND_MESSAGE(SetGmma); int AvHHud::SetGmma(const char* pszName, int iSize, void* pbuf) { int theNumBytesRead = 0; - + BEGIN_READ( pbuf, iSize); this->mDesiredGammaSlope = READ_COORD()/kNormalizationNetworkFactor; theNumBytesRead += 2; - + // Set gamma here if (!mSteamUIActive) { this->SetGamma(this->mDesiredGammaSlope); } - + return theNumBytesRead; } @@ -2714,21 +2717,21 @@ BIND_MESSAGE(BlipList); int AvHHud::BlipList(const char* pszName, int iSize, void* pbuf) { float theCurrentTime = gEngfuncs.GetClientTime(); - + // Fetch new chain of command from network message BEGIN_READ(pbuf, iSize); int theBytesRead = 0; - + bool theReadingFriendlyBlips = READ_BYTE(); theBytesRead++; - + if(!theReadingFriendlyBlips) { this->mEnemyBlips.Clear(); - + // Read number enemy blips int theNumBlips = READ_BYTE(); - + // For each enemy blip for(int i = 0; i < theNumBlips; i++) { @@ -2738,7 +2741,7 @@ int AvHHud::BlipList(const char* pszName, int iSize, void* pbuf) float theZ = READ_COORD(); int8 theStatus = READ_BYTE(); this->mEnemyBlips.AddBlip(theX, theY, theZ, theStatus); - + // Increment bytes read theBytesRead += 7; } @@ -2751,7 +2754,7 @@ int AvHHud::BlipList(const char* pszName, int iSize, void* pbuf) // Read number friendly blips int theNumBlips = READ_BYTE(); - + // For each friendly blip for(int i = 0; i < theNumBlips; i++) { @@ -2762,14 +2765,14 @@ int AvHHud::BlipList(const char* pszName, int iSize, void* pbuf) int8 theStatus = READ_BYTE(); int8 theInfo = READ_BYTE(); this->mFriendlyBlips.AddBlip(theX, theY, theZ, theStatus, theInfo); - + // Increment bytes read theBytesRead += 8; } this->mFriendlyBlips.SetTimeBlipsReceived(theCurrentTime); } - + return theBytesRead; } @@ -2801,7 +2804,7 @@ int AvHHud::Particles(const char *pszName, int iSize, void *pbuf) // Fetch new chain of command from network message BEGIN_READ(pbuf, iSize); int theBytesRead = gParticleTemplateList.ReceiveFromNetworkStream(); - + return theBytesRead; } @@ -2810,10 +2813,10 @@ int AvHHud::SoundNames(const char *pszName, int iSize, void *pbuf) { // Fetch new chain of command from network message BEGIN_READ(pbuf, iSize); - + bool theClearSoundList = READ_BYTE(); int theBytesRead = 1; - + if(theClearSoundList) { // Clear sound list @@ -2823,7 +2826,7 @@ int AvHHud::SoundNames(const char *pszName, int iSize, void *pbuf) { char* theString = READ_STRING(); theBytesRead += strlen(theString); - + string theSoundName(theString); int theSize = this->mSoundNameList.size(); this->mSoundNameList.push_back(theString); @@ -2853,7 +2856,7 @@ int AvHHud::SetSelect(const char* pszName, int iSize, void* pbuf) { int theNumUnits = READ_BYTE(); theBytesRead += 1; - + for(int i = 0; i < theNumUnits; i++) { int theEntIndex = READ_SHORT(); @@ -2866,7 +2869,7 @@ int AvHHud::SetSelect(const char* pszName, int iSize, void* pbuf) // set flag to indicate selection just changed // #ifdef AVH_PREDICT_SELECT // this->mNumLocalSelectEvents--; -// +// // // This will only be negative when the server sets the selection for us, like when becoming commander // if(this->mNumLocalSelectEvents <= 0) // { @@ -2884,7 +2887,7 @@ int AvHHud::SetSelect(const char* pszName, int iSize, void* pbuf) { this->mTrackingEntity = 0; } - + if(theGroup != this->mSelected) { this->mSelectionJustChanged = true; @@ -2900,10 +2903,10 @@ int AvHHud::SetSelect(const char* pszName, int iSize, void* pbuf) if(theHotGroupNumber <= kNumHotkeyGroups) { this->mGroups[theHotGroupNumber-1] = theGroup; - + this->mGroupTypes[theHotGroupNumber-1] = (AvHUser3)READ_BYTE(); theBytesRead++; - + mGroupAlerts[theHotGroupNumber-1] = (AvHAlertType)READ_BYTE(); theBytesRead++; } @@ -2928,7 +2931,7 @@ int AvHHud::SetSelect(const char* pszName, int iSize, void* pbuf) // Save it this->mPendingRequests[theRequestType] = theNumberPendingRequests; } - + return theBytesRead; } @@ -2936,21 +2939,21 @@ BIND_MESSAGE(SetOrder); int AvHHud::SetOrder(const char* pszName, int iSize, void* pbuf) { int theBytesRead = 0; - + BEGIN_READ(pbuf, iSize); // Read status, changed or new //int theStatus = READ_BYTE(); //theBytesRead++; - + AvHOrder theNewOrder; theBytesRead += theNewOrder.ReceiveFromNetworkStream(); - + AvHChangeOrder(this->mOrders, theNewOrder); - + // Give feedback on order this->OrderNotification(theNewOrder); - + // Run through orders, deleting any that are complete for(OrderListType::iterator theIter = this->mOrders.begin(); theIter != this->mOrders.end(); /* no inc */) { @@ -2963,7 +2966,7 @@ int AvHHud::SetOrder(const char* pszName, int iSize, void* pbuf) theIter++; } } - + return theBytesRead; } @@ -2971,7 +2974,7 @@ int AvHHud::SetOrder(const char* pszName, int iSize, void* pbuf) //int AvHHud::CplteOrder(const char* pszName, int iSize, void* pbuf) //{ // int theBytesRead = 0; -// +// // BEGIN_READ(pbuf, iSize); // // int theNumPlayers = READ_BYTE(); @@ -2986,13 +2989,13 @@ int AvHHud::SetOrder(const char* pszName, int iSize, void* pbuf) // } // // return theBytesRead; -//} +//} BIND_MESSAGE(SetupMap); int AvHHud::SetupMap(const char* pszName, int iSize, void* pbuf) { int theBytesRead = 0; - + BEGIN_READ(pbuf, iSize); int theMessageType = READ_BYTE(); @@ -3005,7 +3008,7 @@ int AvHHud::SetupMap(const char* pszName, int iSize, void* pbuf) char* theMapName = READ_STRING(); this->mMapName = string(theMapName); theBytesRead += strlen(theMapName); - + // Read map extents if entering top down mode theBytesRead += this->mMapExtents.ReceiveFromNetworkStream(); } @@ -3035,16 +3038,16 @@ int AvHHud::SetupMap(const char* pszName, int iSize, void* pbuf) AvHBaseInfoLocation theLocation(theLocationName, theMaxExtent, theMinExtent); this->mInfoLocationList.push_back(theLocation); } - + return theBytesRead; } - + BIND_MESSAGE(SetTopDown); int AvHHud::SetTopDown(const char* pszName, int iSize, void* pbuf) { int theBytesRead = 0; - + BEGIN_READ(pbuf, iSize); bool theSendingTechSlots = READ_BYTE(); @@ -3053,21 +3056,21 @@ int AvHHud::SetTopDown(const char* pszName, int iSize, void* pbuf) { BYTE theTopDownMode = READ_BYTE(); theBytesRead += 1; - + if(this->mInTopDownMode && !theTopDownMode) { // Switch away from top down mode this->mInTopDownMode = false; this->ToggleMouse(); - + // Reset angles gViewAngles[0] = READ_COORD(); gViewAngles[1] = READ_COORD(); gViewAngles[2] = READ_COORD(); theBytesRead += 6; - + gResetViewAngles = true; - + this->mSelectionEffects.clear(); } else if(!this->mInTopDownMode && theTopDownMode) @@ -3076,7 +3079,7 @@ int AvHHud::SetTopDown(const char* pszName, int iSize, void* pbuf) this->mInTopDownMode = true; this->ToggleMouse(); } - + if(theTopDownMode) { // Read new PAS @@ -3115,9 +3118,9 @@ BIND_MESSAGE(EditPS); int AvHHud::EditPS(const char* pszName, int iSize, void* pbuf) { int theNumBytesRead = 0; - + BEGIN_READ( pbuf, iSize); - + uint32 theEditParticleSystemIndex = (uint32)(READ_SHORT()); theNumBytesRead += 2; @@ -3130,7 +3133,7 @@ BIND_MESSAGE(Fog); int AvHHud::Fog(const char* pszName, int iSize, void* pbuf) { int theNumBytesRead = 0; - + BEGIN_READ( pbuf, iSize); // Read fog values @@ -3156,9 +3159,9 @@ BIND_MESSAGE(ListPS); int AvHHud::ListPS(const char* pszName, int iSize, void* pbuf) { int theNumBytesRead = 0; - + BEGIN_READ( pbuf, iSize); - + //int theNumTemplates = READ_SHORT(); //theNumBytesRead += 2; @@ -3177,14 +3180,14 @@ BIND_MESSAGE(Reinfor); int AvHHud::Reinfor(const char* pszName, int iSize, void* pbuf) { int theNumBytesRead = 0; - + BEGIN_READ( pbuf, iSize); - + int theReinforcements = READ_SHORT(); theNumBytesRead += 2; this->SetReinforcements(theReinforcements); - + return theNumBytesRead; } @@ -3208,7 +3211,7 @@ int AvHHud::PlayHUDNot(const char* pszName, int iSize, void* pbuf) float theX = READ_COORD(); float theY = READ_COORD(); theBytesRead += 4; - + // Hack to avoid adding another network message (at max) if(!this->GetInTopDownMode()) { @@ -3244,7 +3247,7 @@ int AvHHud::PlayHUDNot(const char* pszName, int iSize, void* pbuf) this->mBlinkingAlertType = 2; AddMiniMapAlert(theX, theY); break; - + // Just research or something like that case HUD_SOUND_MARINE_UPGRADE_COMPLETE: case HUD_SOUND_MARINE_RESEARCHCOMPLETE: @@ -3253,13 +3256,13 @@ int AvHHud::PlayHUDNot(const char* pszName, int iSize, void* pbuf) break; } } - + this->PlayHUDSound(theSound); //char theMessage[512]; //sprintf(theMessage, "Playing sound %d in HUD\n", theSound ); //ConsolePrint(theMessage); - + } else { @@ -3295,7 +3298,7 @@ BIND_MESSAGE(AlienInfo); int AvHHud::AlienInfo(const char* pszName, int iSize, void* pbuf) { int theNumBytesRead = 0; - + BEGIN_READ( pbuf, iSize); // 0 means upgrades, 1 means hive info @@ -3307,7 +3310,7 @@ int AvHHud::AlienInfo(const char* pszName, int iSize, void* pbuf) // Read upgrades int theNumUpgrades = READ_BYTE(); theNumBytesRead++; - + this->mUpgrades.clear(); for(int i = 0; i < theNumUpgrades; i++) { @@ -3366,11 +3369,11 @@ int AvHHud::AlienInfo(const char* pszName, int iSize, void* pbuf) theHiveInfo.mUnderAttack = READ_BYTE(); theHiveInfo.mTechnology = READ_SHORT(); theNumBytesRead += 4; - + theHiveInfo.mHealthPercentage = READ_BYTE(); theNumBytesRead += 1; - + // Add or replace if((int)this->mHiveInfoList.size() <= i) { @@ -3387,29 +3390,29 @@ int AvHHud::AlienInfo(const char* pszName, int iSize, void* pbuf) { ASSERT(false); } - + return theNumBytesRead; } -void AvHHud::PlayHUDSound(const char *szSound, float vol, float inSoundLength) -{ +void AvHHud::PlayHUDSound(const char *szSound, float vol, float inSoundLength) +{ if((this->mTimeOfNextHudSound == -1) || (this->mTimeOfCurrentUpdate > this->mTimeOfNextHudSound)) { if(szSound) { char theSoundName[512]; strcpy(theSoundName, szSound); - gEngfuncs.pfnPlaySoundByName(theSoundName, vol); + gEngfuncs.pfnPlaySoundByName(theSoundName, vol); this->mTimeOfNextHudSound = this->mTimeOfCurrentUpdate + inSoundLength; } } } -void AvHHud::PlayHUDSound(int iSound, float vol, float inSoundLength) -{ +void AvHHud::PlayHUDSound(int iSound, float vol, float inSoundLength) +{ if((this->mTimeOfNextHudSound == -1) || (this->mTimeOfCurrentUpdate > this->mTimeOfNextHudSound)) { - gEngfuncs.pfnPlaySoundByIndex(iSound, vol); + gEngfuncs.pfnPlaySoundByIndex(iSound, vol); this->mTimeOfNextHudSound = this->mTimeOfCurrentUpdate + inSoundLength; } } @@ -3445,7 +3448,7 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound) theSoundPtr = kSelectAlienSound; else theSoundPtr = kSelectSound; - + // Set to 0 so it never blocks other sounds theVolume = .2f; theSoundLength = 0.0f; @@ -3519,7 +3522,7 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound) theSoundPtr = kMarinePointsReceivedSound; theSoundLength = 1.42f; break; - + case HUD_SOUND_MARINE_RESEARCHCOMPLETE: theSoundPtr = kMarineResearchComplete; theSoundLength = 2.0f; @@ -3624,7 +3627,7 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound) case HUD_SOUND_MARINE_GIVEORDERS: // tankefugl: 0000407 - if (theAutoHelpEnabled) + if (theAutoHelpEnabled) { theSoundPtr = kMarineGiveOrders; theSoundLength = 2.2f; @@ -3634,7 +3637,7 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound) case HUD_SOUND_MARINE_NEEDPORTAL: // tankefugl: 0000407 - if (theAutoHelpEnabled) + if (theAutoHelpEnabled) { if(rand() % 2) theSoundPtr = kMarineNeedPortal1; @@ -3647,7 +3650,7 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound) case HUD_SOUND_MARINE_GOTOALERT: // tankefugl: 0000407 - if (theAutoHelpEnabled) + if (theAutoHelpEnabled) { theSoundPtr = kMarineGotoAlert; theSoundLength = 2.2f; @@ -3657,7 +3660,7 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound) case HUD_SOUND_MARINE_COMMANDERIDLE: // tankefugl: 0000407 - if (theAutoHelpEnabled) + if (theAutoHelpEnabled) { if(rand() % 2) theSoundPtr = kMarineCommanderIdle1; @@ -3780,7 +3783,7 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound) theSoundPtr = kAlienUpgradeLost; theSoundLength = 1.5f; break; - + case HUD_SOUND_ORDER_MOVE: switch(rand() % 4) { @@ -3866,7 +3869,7 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound) theSoundLength = 2.2f; } break; - + case HUD_SOUND_YOU_WIN: theSoundPtr = kYouWinSound; theSoundLength = 6.0f; @@ -3889,7 +3892,7 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound) break; // :joev } - + if(theSoundPtr) { gEngfuncs.pfnPlaySoundByName(theSoundPtr, theVolume); @@ -3915,7 +3918,7 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound) // int theNewRole = READ_BYTE(); // this->mRole = AvHRole(theNewRole); // theBytesRead++; -// +// // AvHTeamNumber theTeam = (AvHTeamNumber)(READ_BYTE()); // // // When switching sides, zero out visible resources (prevents weird behavior when going from marine team to aliens especially) @@ -3939,7 +3942,7 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound) // // this->mResourceLabel->setVisible(true); // // this->mGhostBuilding = MESSAGE_NULL; -// +// // this->mReticleInfoText = ""; // // // Set default color for tooltip @@ -3948,7 +3951,7 @@ void AvHHud::PlayHUDSound(AvHHUDSound inSound) //// this->mReticleTooltip.SetR(theR); //// this->mReticleTooltip.SetG(theG); //// this->mReticleTooltip.SetB(theB); -// +// // this->mTooltips.clear(); // // return theBytesRead; @@ -4030,13 +4033,13 @@ int AvHHud::DebugCSP(const char* pszName, int iSize, void* pbuf) char theServerInfoString[512]; sprintf(theServerInfoString, "Server: id: %d, clip: %d, prim attack: %f, idle: %f, next attack: %f", theID, theClip, theNextPrimaryAttack, theTimeWeaponIdle, theNextAttack); - + vgui::Label* theLabel = NULL; if(this->GetManager().GetVGUIComponentNamed(kDebugCSPServerLabel, theLabel)) { theLabel->setText(theServerInfoString); } - + return theBytesRead; } @@ -4135,7 +4138,7 @@ void AvHHud::Init(void) HOOK_MESSAGE(TechSlots); HOOK_MESSAGE(ServerVar); - + this->AddCommands(); this->mCountDownClock = -1; @@ -4150,7 +4153,7 @@ void AvHHud::Init(void) int theRC = atexit(AvHHud::ResetGammaAtExit); _onexit_t theExit = _onexit(AvHHud::ResetGammaAtExitForOnExit); - + signal(SIGILL, AvHHud::ResetGammaAtExit); signal(SIGFPE, AvHHud::ResetGammaAtExit); signal(SIGSEGV, AvHHud::ResetGammaAtExit); @@ -4183,7 +4186,7 @@ void AvHHud::Init(void) this->mLocationText = ""; this->mInfoLocationList.clear(); - + this->mLastHotkeySelectionEvent = MESSAGE_NULL; this->mUpgrades.clear(); @@ -4300,7 +4303,7 @@ bool AvHHud::SetCursor(AvHOrderType inOrderType) case ALIEN_LIFEFORM_FIVE: this->mCurrentCursorFrame = 2 + (int)this->mSelectingNodeID - (int)ALIEN_LIFEFORM_ONE; break; - + default: this->mCurrentCursorFrame = 1; break; @@ -4309,10 +4312,10 @@ bool AvHHud::SetCursor(AvHOrderType inOrderType) theSuccess = true; } - + // Scheme::SchemeCursor theSchemeCursor = Scheme::SchemeCursor::scu_arrow; // //Scheme::SchemeCursor theSchemeCursor = Scheme::SchemeCursor::scu_no; - // + // // switch(inOrderType) // { //// case ORDERTYPE_UNDEFINED: @@ -4334,7 +4337,7 @@ bool AvHHud::SetCursor(AvHOrderType inOrderType) // } // // App::getInstance()->setCursorOveride( App::getInstance()->getScheme()->getCursor(theSchemeCursor)); - + return theSuccess; } @@ -4369,21 +4372,21 @@ void AvHHud::SetHelpMessage(const string& inHelpText, bool inForce, float inNorm this->GetMousePos(theMouseX, theMouseY); theReticleX = theMouseX/(float)ScreenWidth(); theReticleY = theMouseY/(float)ScreenHeight(); - + // Move text up a bit so it doesn't obscure theReticleY -= .1f; - + theCentered = true; } // Alien HUD forces this to be inset a bit - else + else { if(this->GetIsAlien()) { theReticleX = kHelpMessageAlienLeftedgeInset; theReticleY = kHelpMessageAlienTopEdgeInset; } - + if(inNormX != -1) { theReticleX = inNormX; @@ -4393,18 +4396,18 @@ void AvHHud::SetHelpMessage(const string& inHelpText, bool inForce, float inNorm theReticleY = inNormY; } } - + this->mHelpMessage.SetText(inHelpText); - + this->mHelpMessage.SetNormalizedScreenX(theReticleX); this->mHelpMessage.SetNormalizedScreenY(theReticleY); this->mHelpMessage.SetCentered(theCentered); this->mHelpMessage.SetNormalizedMaxWidth(kReticleMaxWidth); //this->mHelpMessage.SetIgnoreFadeForLifetime(true); - + float theTimePassed = (this->mTimeOfCurrentUpdate - this->mTimeOfLastUpdate); this->mHelpMessage.FadeText(theTimePassed, false); - + // Set color int theR, theG, theB; this->GetPrimaryHudColor(theR, theG, theB, true, false); @@ -4430,10 +4433,10 @@ void AvHHud::SetActionButtonHelpMessage(const string& inHelpText) this->mTopDownActionButtonHelp.SetCentered(false); this->mTopDownActionButtonHelp.SetNormalizedMaxWidth(1.0f - kNormX - .01f); //this->mTopDownActionButtonHelp.SetIgnoreFadeForLifetime(true); - + float theTimePassed = (this->mTimeOfCurrentUpdate - this->mTimeOfLastUpdate); this->mTopDownActionButtonHelp.FadeText(theTimePassed, false); - + // Set color int theR, theG, theB; this->GetPrimaryHudColor(theR, theG, theB, true, false); @@ -4446,9 +4449,9 @@ void AvHHud::SetReticleMessage(const string& inHelpText) float theReticleY; bool theIsCentered; this->GetReticleTextDrawingInfo(theReticleX, theReticleY, theIsCentered); - + this->mReticleMessage.SetText(inHelpText); - + this->mReticleMessage.SetNormalizedScreenX(theReticleX); this->mReticleMessage.SetNormalizedScreenY(theReticleY); this->mReticleMessage.SetCentered(theIsCentered); @@ -4458,7 +4461,7 @@ void AvHHud::SetReticleMessage(const string& inHelpText) this->mReticleMessage.SetFadeDownSpeed(-100); this->mReticleMessage.SetFadeUpSpeed(10000); //this->mReticleMessage.SetIgnoreFadeForLifetime(true); - + float theTimePassed = (this->mTimeOfCurrentUpdate - this->mTimeOfLastUpdate); this->mReticleMessage.FadeText(theTimePassed, false); } @@ -4511,7 +4514,7 @@ void AvHHud::InitCommanderMode() theTechImpulsePanel->addInputSignal(&gCommanderHandler); } } - + //this->GetManager().GetVGUIComponentNamed(kScroller, thePanel); //if(thePanel) //{ @@ -4520,7 +4523,7 @@ void AvHHud::InitCommanderMode() // Get input from every control this->GetManager().AddInputSignal(&gScrollHandler); - + // TODO: Add others here } @@ -4529,7 +4532,7 @@ int AvHHud::InitializeDemoPlayback(int inSize, unsigned char* inBuffer) { // Read in base state int theBytesRead = 0; - + // Read in num upgrades int theNumUpgrades = 0; //this->mUpgradeCosts.clear(); @@ -4544,7 +4547,7 @@ int AvHHud::InitializeDemoPlayback(int inSize, unsigned char* inBuffer) int theSecond = 0; LoadData(&theSecond, inBuffer, sizeof(int), theBytesRead); } - + // Read in gamma LoadData(&this->mDesiredGammaSlope, inBuffer, sizeof(this->mDesiredGammaSlope), theBytesRead); @@ -4555,11 +4558,11 @@ int AvHHud::InitializeDemoPlayback(int inSize, unsigned char* inBuffer) // Read in resources LoadData(&this->mResources, inBuffer, sizeof(this->mResources), theBytesRead); - + // Read in commander (TODO: REMOVE) int theCommander; LoadData(&theCommander, inBuffer, sizeof(theCommander), theBytesRead); - + // Read in number of hive infos this->mHiveInfoList.clear(); @@ -4582,7 +4585,7 @@ int AvHHud::InitializeDemoPlayback(int inSize, unsigned char* inBuffer) memset(thePieMenuControl, 0, 256); LoadData(thePieMenuControl, inBuffer, thePieMenuControlLength, theBytesRead); this->mPieMenuControl = string(thePieMenuControl); - + // Read in selected units size this->mSelected.clear(); int theNumSelected = 0; @@ -4627,23 +4630,23 @@ int AvHHud::InitializeDemoPlayback2(int inSize, unsigned char* inBuffer) float theMaxViewHeight; LOAD_DATA(theMaxViewHeight); this->mMapExtents.SetMaxViewHeight(theMaxViewHeight); - + float theMinMapX; LOAD_DATA(theMinMapX); this->mMapExtents.SetMinMapX(theMinMapX); - + float theMaxMapX; LOAD_DATA(theMaxMapX); this->mMapExtents.SetMaxMapX(theMaxMapX); - + float theMinMapY; LOAD_DATA(theMinMapY); this->mMapExtents.SetMinMapY(theMinMapY); - + float theMaxMapY; LOAD_DATA(theMaxMapY); this->mMapExtents.SetMaxMapY(theMaxMapY); - + bool theDrawMapBG; LOAD_DATA(theDrawMapBG); this->mMapExtents.SetDrawMapBG(theDrawMapBG); @@ -4661,9 +4664,9 @@ int AvHHud::InitializeDemoPlayback2(int inSize, unsigned char* inBuffer) } ASSERT((theBytesRead + (int)sizeof(int)) == inSize); - + return theBytesRead; -} +} // Write out base HUD data to stream void AvHHud::InitializeDemoRecording() @@ -4678,7 +4681,7 @@ void AvHHud::InitializeDemoRecording() // Gamma, resources int theGammaSize = sizeof(this->mDesiredGammaSlope); int theResourcesSizes = sizeof(this->mResources); - + // Save commander index (TODO: REMOVE) int theCommanderIndex = this->GetCommanderIndex(); int theCommanderSize = sizeof(theCommanderIndex); @@ -4688,7 +4691,7 @@ void AvHHud::InitializeDemoRecording() string thePieMenuControl = gPieMenuHandler.GetPieMenuControl(); int theCurrentPieMenuControlSize = sizeof(int) + thePieMenuControl.size(); - + int theSelectedSize = sizeof(int) + this->mSelected.size()*sizeof(EntityInfo); int theTotalSize = theUpgradesSize + theGammaSize + theResourcesSizes + theCommanderSize + theHiveInfoSize + theCurrentPieMenuControlSize + theSelectedSize; @@ -4768,7 +4771,7 @@ void AvHHud::InitializeDemoRecording() string theCurrentSoundName = this->mSoundNameList[i]; theTotalSize += GetDataSize(theCurrentSoundName); } - + theCharArray = new unsigned char[theTotalSize]; if(theCharArray) { @@ -4872,9 +4875,9 @@ void AvHHud::PostUIInit(void) this->InitMenu(kSoldierCombatMenu); this->InitMenu(kAlienMenu); this->InitMenu(kAlienCombatMenu); - + this->InitCommanderMode(); - + this->GetManager().GetVGUIComponentNamed(kCommanderResourceLabel, this->mCommanderResourceLabel); this->GetManager().GetVGUIComponentNamed(kGenericProgress, this->mGenericProgressBar); this->GetManager().GetVGUIComponentNamed(kResearchProgress, this->mResearchProgressBar); @@ -4884,7 +4887,7 @@ void AvHHud::PostUIInit(void) // Init particle editor gParticleEditorHandler.Setup(); - + if(this->GetManager().GetVGUIComponentNamed(kHierarchy, this->mHierarchy)) { this->mHierarchy->setEnabled(false); @@ -4893,7 +4896,7 @@ void AvHHud::PostUIInit(void) { this->mShowMapHierarchy->setEnabled(false); } - + // Don't turn on gamma by default, it is annoying for testing //this->SetGamma(); } @@ -4913,7 +4916,7 @@ void AvHHud::SetClientDebugCSP(weapon_data_t* inWeaponData, float inNextPlayerAt { char theClientInfoString[512]; sprintf(theClientInfoString, "Client: id: %d, clip: %d, prim attack: %f, idle: %f, next attack: %f", inWeaponData->m_iId, inWeaponData->m_iClip, inWeaponData->m_flNextPrimaryAttack, inWeaponData->m_flTimeWeaponIdle, inNextPlayerAttack); - + vgui::Label* theLabel = NULL; if(this->GetManager().GetVGUIComponentNamed(kDebugCSPClientLabel, theLabel)) { @@ -4958,7 +4961,7 @@ void AvHHud::SetProgressStatus(float inPercentage) if(theProgressBar) { theProgressBar->setVisible(true); - + int theNumSegments = theProgressBar->getSegmentCount(); int theSegment = inPercentage*theNumSegments; theProgressBar->setProgress(theSegment); @@ -4984,13 +4987,13 @@ void AvHHud::SetResearchProgressStatus(float inPercentage) if(this->mResearchProgressBar) { this->mResearchProgressBar->setVisible(true); - + int theNumSegments = this->mResearchProgressBar->getSegmentCount(); int theSegment = inPercentage*theNumSegments; this->mResearchProgressBar->setProgress(theSegment); - + this->mResearchLabel->setVisible(true); - + // Center research label int theX, theY; this->mResearchLabel->getPos(theX, theY); @@ -5016,23 +5019,23 @@ void AvHHud::UpdateDemoRecordPlayback() //Demo_WriteVector(TYPE_VIEWANGLES, v_angles); //Demo_WriteVector(TYPE_VIEWORIGIN, v_origin); // Demo_WriteByte(TYPE_MOUSEVIS, g_iVisibleMouse); -// +// // if(g_iVisibleMouse) // { // int theMouseScreenX, theMouseScreenY; -// +// // IN_GetMousePos(&theMouseScreenX, &theMouseScreenY); -// +// // //theMouseScreenX += ScreenWidth/2; // //theMouseScreenY += ScreenHeight/2; -// +// // // Write mouse position // float theNormX = (float)theMouseScreenX/ScreenWidth; // float theNormY = (float)theMouseScreenY/ScreenHeight; -// +// // Demo_WriteFloat(TYPE_MOUSEX, theNormX); // Demo_WriteFloat(TYPE_MOUSEY, theNormY); -// +// // //char theBuffer[256]; // //sprintf(theBuffer, "Saving mouse coords %f %f\n", theNormX, theNormY); // //CenterPrint(theBuffer); @@ -5043,7 +5046,7 @@ void AvHHud::UpdateDemoRecordPlayback() //char theBuffer[256]; //sprintf(theBuffer, "Restoring mouse coords %f %f\n", gNormMouseX, gNormMouseY); //CenterPrint(theBuffer); - + //int theCurrentMouseX = gNormMouseX*ScreenWidth; //int theCurrentMouseY = gNormMouseY*ScreenHeight; // @@ -5083,7 +5086,7 @@ void AvHHud::UpdateDataFromVuser4(float inCurrentTime) if(this->GetIsCombatMode()) { - this->mExperience = (int)ceil(theVUser.z/kNumericNetworkConstant); + this->mExperience = (int)ceil(theVUser.z/kNumericNetworkConstant); this->mExperienceLevel = AvHPlayerUpgrade::GetPlayerLevel(this->mExperience); const float kShowMenuInterval = 5.0f; @@ -5110,7 +5113,7 @@ void AvHHud::UpdateDataFromVuser4(float inCurrentTime) { this->mResources = theNewValue; } - + // Don't smooth resources nicely when switching targets if((g_iUser1 == OBS_IN_EYE) && (g_iUser2 != this->mUser2OfLastResourceMessage)) { @@ -5127,7 +5130,7 @@ void AvHHud::UpdateSpectating() if((this->GetPlayMode() == PLAYMODE_AWAITINGREINFORCEMENT) || (this->GetPlayMode() == PLAYMODE_OBSERVER)) { AvHTeamNumber theCurrentTargetTeam = TEAM_IND; - + int theCurrentTarget = g_iUser2;//thePlayer->curstate.iuser2; cl_entity_s* theEntity = gEngfuncs.GetEntityByIndex(theCurrentTarget); if(theEntity) @@ -5161,7 +5164,7 @@ void AvHHud::UpdateCommonUI() if(thePieMenu && thePieMenu->GetSelectedNode(theCurrentNode)) { theCurrentNodeID = (AvHMessageID)theCurrentNode->GetMessageID(); - + if(theCurrentNodeID > 0) { this->mSelectingNodeID = theCurrentNodeID; @@ -5199,16 +5202,16 @@ void AvHHud::UpdateAlienUI(float inCurrentTime) { // Always hide it by default this->GetManager().HideComponent(kPieHelpText); - + if(this->GetIsAlien() && this->GetIsAlive()) { float theTimePassed = inCurrentTime - this->mTimeOfLastUpdate; // int theNumFrames = SPR_Frames(this->mAlienUIHiveSprite); -// +// // for(AnimatedSpriteListType::iterator theIter = this->mAlienUIHiveList.begin(); theIter != this->mAlienUIHiveList.end(); theIter++) // { // const float kAnimationSpeed = 16.0f; -// +// // float theCurrentFrame = theIter->mCurrentFrame + theTimePassed*kAnimationSpeed; // if(theCurrentFrame >= theNumFrames) // { @@ -5216,7 +5219,7 @@ void AvHHud::UpdateAlienUI(float inCurrentTime) // } // theIter->mCurrentFrame = theCurrentFrame; // } - + // Check to see if we have any unspent upgrades. If so, change the pie menu and HUD state to reflect this this->mNumUpgradesAvailable = 0; for(int i = 0; i < ALIEN_UPGRADE_CATEGORY_MAX_PLUS_ONE; i++) @@ -5254,7 +5257,7 @@ bool AvHHud::GetCommanderLabelText(std::string& outCommanderName) const int theCommander = this->GetCommanderIndex(); bool theHasCommander = (theCommander > 0) && (theCommander <= gEngfuncs.GetMaxClients()); - + if(!theHasCommander) { LocalizeString(kNoCommander, outCommanderName); @@ -5270,7 +5273,7 @@ bool AvHHud::GetCommanderLabelText(std::string& outCommanderName) const theStream << theCommanderText; theStream << ": "; - + hud_player_info_t thePlayerInfo; gEngfuncs.pfnGetPlayerInfo(theCommander, &thePlayerInfo); @@ -5289,7 +5292,7 @@ bool AvHHud::GetCommanderLabelText(std::string& outCommanderName) const } void AvHHud::UpdateMarineUI(float inCurrentTime) -{ +{ // Find commander label Label* theCommanderStatusLabel = NULL; @@ -5301,15 +5304,15 @@ void AvHHud::UpdateMarineUI(float inCurrentTime) for(int i = 0; i < MESSAGE_LAST; i++) { AvHMessageID theMessageID = AvHMessageID(i); - + char theComponentName[256]; sprintf(theComponentName, kPendingImpulseSpecifier, (int)theMessageID); - + AvHTechImpulsePanel* theTechImpulsePanel = NULL; if(this->GetManager().GetVGUIComponentNamed(theComponentName, theTechImpulsePanel)) { bool theVisibility = false; - + // Do we have any requests pending? if(this->GetIsInTopDownMode()) { @@ -5337,7 +5340,7 @@ void AvHHud::UpdateMarineUI(float inCurrentTime) break; } } - + theTechImpulsePanel->setVisible(theVisibility); } } @@ -5370,7 +5373,7 @@ void AvHHud::UpdateHierarchy() // Start the starting point on the map to our local position this->mOverviewMap.SetMapExtents(this->GetMapName(), this->mMapExtents); this->mOverviewMap.SetWorldPosition(gPredictedPlayerOrigin[0], gPredictedPlayerOrigin[1]); - + if(this->mHierarchy) { this->mHierarchy->SetFullScreen(this->GetHUDUser3() == AVH_USER3_COMMANDER_PLAYER); @@ -5398,7 +5401,7 @@ void AvHHud::UpdateInfoLocation() { // Don't clear our location, disconcerting to see our location disappear //this->mLocationText = ""; - + this->mLocationText = this->GetNameOfLocation(gPredictedPlayerOrigin); } else @@ -5425,7 +5428,7 @@ bool AvHHud::GetIsMouseInRegion(int inX, int inY, int inWidth, int inHeight) { int theMouseX, theMouseY; this->GetMousePos(theMouseX, theMouseY); - + if((theMouseX >= inX) && (theMouseX <= (inX + inWidth))) { if((theMouseY >= inY) && (theMouseY <= (inY + inHeight))) @@ -5447,7 +5450,7 @@ void AvHHud::TraceEntityID(int& outEntityID) gEngfuncs.pEventAPI->EV_PushPMStates(); // Now add in all of the players. - gEngfuncs.pEventAPI->EV_SetSolidPlayers (-1); + gEngfuncs.pEventAPI->EV_SetSolidPlayers (-1); gEngfuncs.pEventAPI->EV_SetTraceHull(2); @@ -5469,7 +5472,7 @@ void AvHHud::TraceEntityID(int& outEntityID) do { gEngfuncs.pEventAPI->EV_PlayerTrace(theStartTrace, theEndTrace, PM_NORMAL, -1, &tr); - + // Ignore local player, and ignore the player we're spectating int theHit = gEngfuncs.pEventAPI->EV_IndexFromTrace(&tr); if(theHit == theLocalPlayerIndex) @@ -5479,7 +5482,7 @@ void AvHHud::TraceEntityID(int& outEntityID) // We hit something else if(tr.fraction < 1.0) { - physent_t* pe = gEngfuncs.pEventAPI->EV_GetPhysent( tr.ent ); + physent_t* pe = gEngfuncs.pEventAPI->EV_GetPhysent( tr.ent ); if(pe) { int thePotentialEntity = pe->info; @@ -5491,7 +5494,7 @@ void AvHHud::TraceEntityID(int& outEntityID) theDone = true; } } while(!theDone); - + gEngfuncs.pEventAPI->EV_PopPMStates(); } @@ -5502,7 +5505,7 @@ bool AvHHud::GetAlienHelpForMessage(int inMessageID, string& outHelpText, int& o char theNumber[8]; sprintf(theNumber, "%d", inMessageID); string theNumberString(theNumber); - + string theTechHelpText; string theKey = string(kTechNodeHelpPrefix) + theNumberString; if(LocalizeString(theKey.c_str(), theTechHelpText)) @@ -5534,12 +5537,12 @@ bool AvHHud::GetAlienHelpForMessage(int inMessageID, string& outHelpText, int& o bool AvHHud::GetDoesPlayerHaveOrder() const { bool thePlayerHasOrder = false; - + for(OrderListType::const_iterator theIter = this->mOrders.begin(); theIter != this->mOrders.end(); theIter++) { // Draw the order if the order is for any plays that are in our draw player list EntityInfo theReceiverPlayer = theIter->GetReceiver(); - + cl_entity_s* thePlayer = gEngfuncs.GetLocalPlayer(); if(thePlayer) { @@ -5555,11 +5558,11 @@ bool AvHHud::GetDoesPlayerHaveOrder() const return thePlayerHasOrder; } - + bool AvHHud::GetHelpForMessage(int inMessageID, string& outHelpText) const { bool theSuccess = false; - + char theNumber[8]; sprintf(theNumber, "%d", (int)inMessageID); string theNumberString(theNumber); @@ -5574,12 +5577,12 @@ bool AvHHud::GetHelpForMessage(int inMessageID, string& outHelpText) const { outHelpText = /*theTechNodeLabel + " " +*/ theTechNodeLabel; theSuccess = true; - + int theCost; bool theResearchable; float theTime; this->mTechNodes.GetResearchInfo((AvHMessageID)(inMessageID), theResearchable, theCost, theTime); - + // Add cost if(theCost > 0) { @@ -5637,13 +5640,13 @@ void AvHHud::UpdatePieMenuControl() { // Set which pie menu to use ("" for none) bool theScoreBoardIsOpen = false; - + ScorePanel* theScoreBoard = gViewPort->GetScoreBoard(); if(theScoreBoard && theScoreBoard->isVisible()) { theScoreBoardIsOpen = true; } - + if(theScoreBoardIsOpen) { AvHPieMenuHandler::SetPieMenuControl(""); @@ -5722,7 +5725,7 @@ bool AvHHud::GetEntityInfoString(int inEntityID, string& outEntityInfoString, bo outIsEnemy = theIsEnemy; theSuccess = true; } - + // sprintf(thePlayerName, "%s (health: %d)", thePlayerInfo.name, thePlayer->curstate.health); //} } @@ -5774,7 +5777,7 @@ bool AvHHud::GetEntityInfoString(int inEntityID, string& outEntityInfoString, bo } } } - + return theSuccess; } @@ -5789,7 +5792,7 @@ void AvHHud::UpdateEntityID(float inCurrentTime) //{ //char* theNewPlayerName = NULL; int theEntityIndex = -1; - + if(this->GetHUDUser3() == AVH_USER3_COMMANDER_PLAYER) { int theCurrentX, theCurrentY; @@ -5801,9 +5804,9 @@ void AvHHud::UpdateEntityID(float inCurrentTime) if(!this->GetIsRegionBlockedByUI(theNormX, theNormY)) { Vector theNormRay; - + CreatePickingRay(theCurrentX, theCurrentY, theNormRay); - + // Look for player and entities under/near the mouse AvHSHUGetEntityAtRay(this->GetVisualOrigin(), theNormRay, theEntityIndex); } @@ -5817,13 +5820,13 @@ void AvHHud::UpdateEntityID(float inCurrentTime) // Trace entity id in front of us this->TraceEntityID(theEntityIndex); } - + if(this->mSelectingWeaponID != -1) { // Look up help, set our current help to it string theWeaponHelpKey; sprintf(theWeaponHelpKey, kWeaponHelpText, this->mSelectingWeaponID); - + string theHelpText; if(LocalizeString(theWeaponHelpKey.c_str(), theHelpText)) { @@ -5850,7 +5853,7 @@ void AvHHud::UpdateEntityID(float inCurrentTime) char theNumber[8]; sprintf(theNumber, "%d", this->mSelectingNodeID); string theNumberString(theNumber); - + string theKey = string(kTechNodeHelpPrefix) + theNumberString; if(LocalizeString(theKey.c_str(), this->mReticleInfoText)) { @@ -5867,7 +5870,7 @@ void AvHHud::UpdateEntityID(float inCurrentTime) if(theIter->first == this->mSelectingNodeID) { this->mSelectedNodeResourceCost = theIter->second; - + char theCostSuffix[128]; sprintf(theCostSuffix, " %s: %d %s", theCostString.c_str(), this->mSelectedNodeResourceCost, thePointsString.c_str()); this->mReticleInfoText += string(theCostSuffix); @@ -5876,7 +5879,7 @@ void AvHHud::UpdateEntityID(float inCurrentTime) } */ } - + // Don't draw marine sayings, as they are printed on the controls and the aliens are using the titles.txt entries if(this->GetIsMarine()) { @@ -5895,13 +5898,13 @@ void AvHHud::UpdateEntityID(float inCurrentTime) break; } } - + this->SetHelpMessage(this->mReticleInfoText); theSetHelpMessage = true; } } } - + if(theEntityIndex > 0) { // Don't draw info for cloaked structures @@ -5914,12 +5917,12 @@ void AvHHud::UpdateEntityID(float inCurrentTime) { this->mBuildingEffectsEntityList.push_back(theEntityIndex); } - + bool theEntityIsPlayer = ((theEntityIndex > 0) && (theEntityIndex <= gEngfuncs.GetMaxClients())); - + string theHelpText; bool theIsEnemy = false; - + if(this->GetEntityInfoString(theEntityIndex, theHelpText, theIsEnemy)) { // Set color to red if enemy, otherise to our HUD color @@ -5938,7 +5941,7 @@ void AvHHud::UpdateEntityID(float inCurrentTime) if(gEngfuncs.pfnGetCvarFloat(kvAutoHelp) || this->GetInTopDownMode()) { this->SetHelpMessage(theHelpText); - + this->mHelpMessage.SetRGB(theR, theG, theB); theSetHelpMessage = true; @@ -5947,9 +5950,9 @@ void AvHHud::UpdateEntityID(float inCurrentTime) else { this->SetReticleMessage(theHelpText); - + this->mReticleMessage.SetRGB(theR, theG, theB); - + theSetReticleMessage = true; } } @@ -5966,7 +5969,7 @@ void AvHHud::UpdateEntityID(float inCurrentTime) int a = 0; } } - + //if(this->mReticleInfoColorA == 0) //{ // this->mReticleInfoText = ""; @@ -6037,14 +6040,14 @@ string AvHHud::GetRankTitle(bool inShowUnspentLevels) const theText += theUnspentLevelText; } } - + return theText; } void AvHHud::GetReticleTextDrawingInfo(float& outNormX, float& outNormY, bool& outCentered) const { outCentered = false; - + if(this->GetInTopDownMode()) { int theCurrentX, theCurrentY; @@ -6086,14 +6089,14 @@ void AvHHud::UpdateTooltips(float inCurrentTime) float theReticleX; float theReticleY; this->GetTooltipDrawingInfo(theReticleX, theReticleY); - + float theBottomMostY = theReticleY; - + float theTimePassed = inCurrentTime - this->mTimeOfLastUpdate; float kMovement = 1.0f*theTimePassed; - + int theBottomScreenY = theBottomMostY*ScreenHeight(); - + // Clear all tooltips on a role change, or on a playmode change AvHUser3 theCurrentUser3 = this->GetHUDUser3(); AvHTeamNumber theCurrentTeam = this->GetHUDTeam(); @@ -6109,20 +6112,20 @@ void AvHHud::UpdateTooltips(float inCurrentTime) { this->mExperienceLevelLastDrawn = 1; } - + // Run through list, dropping them down as far as they can go. Assumes the first one in the list is the bottommost one for(AvHTooltipListType::iterator theIter = this->mTooltips.begin(); theIter != this->mTooltips.end(); /* no inc */) { // Recompute settings, if it hasn't been updated before theIter->RecomputeIfNeccessary(); - + // Get height of current tool tip int theTooltipScreenHeight = theIter->GetScreenHeight(); - + // Move it down towards the current limit float theCurrentMinScreenY = theIter->GetNormalizedScreenY(); int theCurrentTipScreenBottom = (int)(theCurrentMinScreenY) + theTooltipScreenHeight; - + float theCurrentMaxNormY = (float)(theBottomScreenY - theTooltipScreenHeight)/ScreenHeight(); float theNewNormY = min(theCurrentMaxNormY, (theCurrentMinScreenY + kMovement)); @@ -6131,7 +6134,7 @@ void AvHHud::UpdateTooltips(float inCurrentTime) char theMessage[256]; sprintf(theMessage, "theNewNormY %f, minScreenY: %f)", theNewNormY, theCurrentMinScreenY); //CenterPrint(theMessage); - + // If we moved it down if(theNewNormY > theCurrentMinScreenY) { @@ -6146,16 +6149,16 @@ void AvHHud::UpdateTooltips(float inCurrentTime) theIter->FadeText(theTimePassed, true); } } - + // Set the new position theIter->SetNormalizedScreenY(theNewNormY); - + // Subtract it's height to the current limit theBottomScreenY -= theTooltipScreenHeight; // Subtract out small spacing amount theBottomScreenY -= max(1, kToolTipVerticalSpacing*ScreenHeight()); - + // If it's totally faded out, remove it from the list, else process next int theAlpha = theIter->GetA(); if(theAlpha == 0) @@ -6177,7 +6180,7 @@ void AvHHud::UpdateTooltips(float inCurrentTime) { const int kScrollDirection = this->mDrawCombatUpgradeMenu ? 1 : -1; const float kScrollingSpeed = .7f*kScrollDirection; - + float theXDiff = (theTimePassed*kScrollingSpeed); const float kNormalizedWidth = this->mCombatUpgradeMenu.GetNormalizedMaxWidth(); @@ -6213,7 +6216,7 @@ void AvHHud::UpdateStructureNotification(float inCurrentTime) //{ // const float kReticleInfoFadeUpSpeed = 500; // const float kReticleInfoFadeDownSpeed = -150; -// +// // // Fade reticle nicely // int theFadeSpeed = inFadeDown ? kReticleInfoFadeDownSpeed : kReticleInfoFadeUpSpeed; // @@ -6230,7 +6233,7 @@ float AvHHud::GetTimeOfLastUpdate() const void AvHHud::UpdateProgressBar() { this->HideProgressStatus(); - + float thePercentage; if(gMiniMap.GetIsProcessing(&thePercentage)) { @@ -6277,7 +6280,7 @@ void AvHHud::UpdateProgressBar() { theProgress = pmove->fuser3; } - + thePercentage = theProgress/kNormalizationNetworkFactor; if(thePercentage < 1.0f) { @@ -6302,7 +6305,7 @@ void AvHHud::UpdateProgressBar() bool theIsBuilding, theIsResearching; float thePercentage; AvHSHUGetBuildResearchState(theEntity->curstate.iuser3, theEntity->curstate.iuser4, theEntity->curstate.fuser1, theIsBuilding, theIsResearching, thePercentage); - + if(theIsBuilding && (thePercentage > 0.0f) && (thePercentage < 1.0f)) { // Turned off progress bar now that we have circular build icons @@ -6324,10 +6327,10 @@ void AvHHud::GhostBuildingCallback(struct tempent_s* inEntity, float inFrametime { // Don't let it die inEntity->die = gClientTimeLastUpdate + 2.0f; - + // Update position to be where mouse is VectorCopy(this->mGhostWorldLocation, inEntity->entity.origin); - + // Visually indicate whether this is a valid position or not if(this->mCurrentGhostIsValid) { @@ -6360,7 +6363,7 @@ void AvHHud::UpdateBuildingPlacement() // Fetch current mouse up/down state from gScrollHandler and store bool theMouseOneDown = gScrollHandler.GetMouseOneDown() && !gCommanderHandler.GetMouseOneDown(); bool theMouseTwoDown = gScrollHandler.GetMouseTwoDown(); - + // If we haven't created the temp entity, create it if(!this->mCreatedGhost) { @@ -6412,7 +6415,7 @@ void AvHHud::UpdateBuildingPlacement() //char theMessage[256]; //sprintf(theMessage, "Ghost: %f, %f, %f", this->mGhostWorldLocation[0], this->mGhostWorldLocation[1],this->mGhostWorldLocation[2]); //CenterPrint(theMessage); - + // Was either mouse button pressed? bool theMouseOneReleased = (theMouseOneDown && !this->mMouseOneDown); bool theMouseTwoReleased = (theMouseTwoDown && !this->mMouseTwoDown); @@ -6427,7 +6430,7 @@ void AvHHud::UpdateBuildingPlacement() // Test to see if we're in a valid position this->mCurrentGhostIsValid = false; - + vec3_t theLocation; if(AvHSHUTraceAndGetIsSiteValidForBuild(this->mGhostBuilding, this->GetVisualOrigin(), theNormMousePos, &theLocation)) { @@ -6437,8 +6440,8 @@ void AvHHud::UpdateBuildingPlacement() float theTime; if(this->mTechNodes.GetResearchInfo(this->mGhostBuilding, theIsResearchable, theCost, theTime)) { - // Ghost is valid if message available and - // we have enough resources OR + // Ghost is valid if message available and + // we have enough resources OR // tech takes energy and we have enough energy this->mCurrentGhostIsValid = false; @@ -6494,7 +6497,7 @@ void AvHHud::UpdateSelection() CreatePickingRay(theCurrentX, theCurrentY, this->mMouseWorldPosition); //ASSERT(this->mMouseWorldPosition.z < 0.0f); - // Left mouse button // + // Left mouse button // // If mouse just pressed, set starting point if(theMouseOneDown && !this->mMouseOneDown) { @@ -6517,7 +6520,7 @@ void AvHHud::UpdateSelection() //CreatePickingRay(theCurrentX, theCurrentY, this->mLeftMouseWorldEnd); //ASSERT(this->mLeftMouseWorldEnd.z < 0.0f); VectorCopy(this->mMouseWorldPosition, this->mLeftMouseWorldEnd); - + //this->mSelectionJustChanged = true; this->mLeftMouseEnded = true; } @@ -6526,14 +6529,14 @@ void AvHHud::UpdateSelection() this->mLeftMouseEnded = false; } - // Right mouse button // + // Right mouse button // // If mouse two just pressed, set starting point if(theMouseTwoDown && !this->mMouseTwoDown) { this->mMouseTwoStartX = theCurrentX; this->mMouseTwoStartY = theCurrentY; this->mRightMouseStarted = true; - + //CreatePickingRay(theCurrentX, theCurrentY, this->mRightMouseWorldStart); //ASSERT(this->mRightMouseWorldStart.z < 0.0f); VectorCopy(this->mMouseWorldPosition, this->mRightMouseWorldStart); @@ -6542,14 +6545,14 @@ void AvHHud::UpdateSelection() { this->mRightMouseStarted = false; } - + // If mouse just released, set flag to indicate selection just changed if(!theMouseTwoDown && this->mMouseTwoDown) { //CreatePickingRay(theCurrentX, theCurrentY, this->mRightMouseWorldEnd); //ASSERT(this->mRightMouseWorldEnd.z < 0.0f); VectorCopy(this->mMouseWorldPosition, this->mRightMouseWorldEnd); - + //this->mSelectionJustChanged = true; this->mRightMouseEnded = true; } @@ -6561,16 +6564,16 @@ void AvHHud::UpdateSelection() // Set extents of marquee control this->mSelectionBox->SetStartPos(this->mMouseOneStartX, this->mMouseOneStartY); this->mSelectionBox->SetEndPos(theCurrentX, theCurrentY); - + // Set visibility state of marquee control //this->mSelectionBox->setVisible(theMouseOneDown); this->mSelectionBox->setVisible(false); - + this->mSelectionBoxX1 = mMouseOneStartX; this->mSelectionBoxY1 = mMouseOneStartY; this->mSelectionBoxX2 = theCurrentX; this->mSelectionBoxY2 = theCurrentY; - + this->mSelectionBoxVisible = theMouseOneDown; // If we're just selecting stuff, don't want to hit this button by mistake @@ -6655,7 +6658,7 @@ void AvHHud::UpdateSelection() EntityListType theNewSelection; gSelectionHelper.GetAndClearSelection(theNewSelection); // this->mNumLocalSelectEvents++; - + if(theNewSelection != this->mSelected) { this->mSelected = theNewSelection; @@ -6678,7 +6681,7 @@ void AvHHud::UpdateSelection() // Clear flag this->mSelectionJustChanged = false; - + // // Set default order mode // if(this->mSelected.size() > 0) // { @@ -6691,7 +6694,7 @@ void AvHHud::UpdateSelection() } this->UpdateBuildingPlacement(); - + // Store current mouse state this->mMouseOneDown = theMouseOneDown; this->mMouseTwoDown = theMouseTwoDown; @@ -6712,17 +6715,17 @@ void AvHHud::UpdateBuildResearchText() // Display build/research text string theBuildResearchText = gCommanderHandler.GetBuildResearchText(); theHelpTextLabel->setText(theBuildResearchText.c_str()); - + // Center it int theWidth, theHeight; theHelpTextLabel->getTextSize(theWidth, theHeight); - + int theX, theY; theHelpTextLabel->getPos(theX, theY); - + int theScreenWidth = ScreenWidth(); theHelpTextLabel->setPos(theScreenWidth/2 - theWidth/2, theY); - + // Vanish if no text (but keep build/research text visible) theHelpTextLabel->setVisible(true); if(theBuildResearchText.length() == 0)// || ((this->mTimeLastHelpTextChanged != -1) && (this->mTimeLastHelpTextChanged + kHelpTextInterval < this->mTimeOfLastUpdate))) @@ -6750,7 +6753,7 @@ void AvHHud::UpdateBuildResearchText() void AvHHud::UpdateTechNodes() { this->UpdateBuildResearchText(); - + // Don't get new node until existing one has been processed if(this->mTechEvent == MESSAGE_NULL) { @@ -6767,7 +6770,7 @@ void AvHHud::UpdateTechNodes() bool theIsResearchable; int theCost; float theTime; - + if(this->mTechNodes.GetResearchInfo(theMessageID, theIsResearchable, theCost, theTime)) { if(AvHSHUGetIsBuildTech(theMessageID)) @@ -6817,13 +6820,13 @@ void AvHHud::UpdateAmbientSounds() { Vector theListenerPosition; VectorCopy(gPredictedPlayerOrigin, theListenerPosition); - + // Commanders have a different PAS then themselves if(this->mInTopDownMode) { VectorCopy(this->mCommanderPAS, theListenerPosition); } - + for(AmbientSoundListType::iterator theIter = this->mAmbientSounds.begin(); theIter != this->mAmbientSounds.end(); theIter++) { theIter->StartPlayingIfNot(); @@ -6839,29 +6842,29 @@ void AvHHud::UpdateFromEntities(float inCurrentTime) { this->mHelpIcons.clear(); this->mHelpEnts.clear(); - + bool theAutoHelpEnabled = gEngfuncs.pfnGetCvarFloat(kvAutoHelp); // Clear help icons this->mHelpEnts.clear(); - + // Clear building effects //this->mBuildingEffectsEntityList.clear(); - + this->mTimeOfLastEntityUpdate = inCurrentTime; - + // Scan for entities, adding help icons // Only draw if enabled const int kHelpDistance = 350; const int kBuildDistance = 500; const int kHealthDistance = 125; - + // Look for entities that have help icons in front of us. Don't search to far away, it could give players away. EntityListType theHelpEntities; AvHSHUGetEntities(-1, theHelpEntities); - + cl_entity_t* theLocalPlayer = gEngfuncs.GetLocalPlayer(); - + for(EntityListType::iterator theIter = theHelpEntities.begin(); theIter != theHelpEntities.end(); theIter++) { vec3_t theLocation; @@ -6894,11 +6897,11 @@ void AvHHud::UpdateFromEntities(float inCurrentTime) if(theAutoHelpEnabled || theAlwaysDraw) { this->mHelpIcons.push_back( make_pair(theEntityOrigin, theUser3) ); - + // Push back entity for displaying helpful tooltips this->mHelpEnts.push_back(*theIter); } - + // // If entity is buildable and within a certain distance, add it to have it's building effects potentially drawn // if(!this->GetInTopDownMode()) // { @@ -6937,7 +6940,7 @@ void AvHHud::UpdateViewModelEffects() short theSkin = 0; // Set the skin, stored in playerclass - + //cl_entity_s* theLocalPlayer = gEngfuncs.GetLocalPlayer(); // Use the visible player so that when we are spectating we can tell @@ -6946,14 +6949,14 @@ void AvHHud::UpdateViewModelEffects() if(theLocalPlayer) { - + //theViewModel->curstate.skin = theLocalPlayer->curstate.skin; theRenderMode = theLocalPlayer->curstate.rendermode; theRenderAmount = theLocalPlayer->curstate.renderamt; theRenderFx = theLocalPlayer->curstate.renderfx; theRenderColor = theLocalPlayer->curstate.rendercolor; theSkin = theLocalPlayer->curstate.skin; - // Hack to make cloaking work for viewmodels (if only view models rendered in additive properly). + // Hack to make cloaking work for viewmodels (if only view models rendered in additive properly). // Draw view model normally unless fully cloaked. //bool theIsCloakedViaUpgrade = GetHasUpgrade(theLocalPlayer->curstate.iuser4, MASK_ALIEN_CLOAKED); int old=theRenderAmount; @@ -6962,7 +6965,7 @@ void AvHHud::UpdateViewModelEffects() theRenderFx = kRenderFxNone; theRenderColor.r = theRenderColor.g = theRenderColor.b = 0; - if ( theRenderAmount == kAlienSelfCloakingBaseOpacity ) + if ( theRenderAmount == kAlienSelfCloakingBaseOpacity ) { theRenderMode = kAlienCloakViewModelRenderMode; theRenderAmount = 10; @@ -6994,12 +6997,12 @@ void AvHHud::UpdateViewModelEffects() // theRenderMode = kAlienCloakViewModelRenderMode; // int theCloakingLevel = AvHGetAlienUpgradeLevel(this->GetLocalUpgrades(), MASK_UPGRADE_7); // theRenderAmount = kAlienCloakViewModelAmount - theCloakingLevel*kAlienCloakViewModelLevelAmount; -// +// // // Put in color, because texture rendering needs it // theRenderFx = kRenderFxNone; // theRenderColor.r = theRenderColor.g = theRenderColor.b = 0; // } - + if(this->mInTopDownMode) { theRenderMode = kRenderTransAdd; @@ -7072,10 +7075,10 @@ void AvHHud::UpdateResources(float inTimePassed) } } } - + string theResourceText; char theResourceBuffer[64]; - + if(this->GetInTopDownMode() && this->mCommanderResourceLabel) { LocalizeString(kMarineResourcePrefix, theResourceText); @@ -7147,12 +7150,12 @@ void AvHHud::UpdateResources(float inTimePassed) bool AvHHud::GetParticlesVisible() const { - + if (g_iUser1 == OBS_NONE) { return true; } - + if (m_Spectator.IsInOverviewMode()) { return m_Spectator.m_iDrawCycle == 1; @@ -7211,7 +7214,7 @@ bool AvHHud::GetShouldDisplayUser3(AvHUser3 inUser3) const break; } } - + return theShouldDisplay; } @@ -7225,7 +7228,7 @@ bool AvHHud::GetTranslatedUser3Name(AvHUser3 inUser3, string& outString) const sprintf(theUser3String, "#%s%d", kUser3Name, inUser3); theSuccess = LocalizeString(theUser3String, outString); } - + return theSuccess; } @@ -7286,7 +7289,7 @@ void AvHHud::UpdateEnableState(PieMenu* inMenu) if(inMenu) { int thePurchaseLevel = this->GetIsCombatMode() ? max(0, this->mExperienceLevel - this->mExperienceLevelSpent - 1) : this->mResources; - + inMenu->UpdateMenuFromTech(this->mTechNodes, thePurchaseLevel); // if(this->GetIsNSMode()) @@ -7302,7 +7305,7 @@ void AvHHud::UpdateEnableState(PieMenu* inMenu) void AvHHud::ShowMap() { if (!sShowMap && gHUD.GetIsNSMode()) - { + { sShowMap = true; gHUD.HideCrosshair(); gHUD.GetManager().UnhideComponent(kShowMapHierarchy); @@ -7343,7 +7346,7 @@ void AvHHud::GetSpriteForUser3(AvHUser3 inUser3, int& outSprite, int& outFrame, outSprite = Safe_SPR_Load(kStructuresSprite); outFrame = 5; break; - case AVH_USER3_TURRET_FACTORY: + case AVH_USER3_TURRET_FACTORY: case AVH_USER3_ADVANCED_TURRET_FACTORY: outSprite = Safe_SPR_Load(kStructuresSprite); outFrame = 6; @@ -7379,16 +7382,16 @@ void AvHHud::GetSpriteForUser3(AvHUser3 inUser3, int& outSprite, int& outFrame, case AVH_USER3_RESTOWER: outSprite = Safe_SPR_Load(kStructuresSprite); outFrame = 14; - break; + break; case AVH_USER3_INFANTRYPORTAL: outSprite = Safe_SPR_Load(kStructuresSprite); outFrame = 15; - break; + break; case AVH_USER3_PHASEGATE: outSprite = Safe_SPR_Load(kStructuresSprite); outFrame = 16; - break; - + break; + // Aliens case AVH_USER3_DEFENSE_CHAMBER: outSprite = Safe_SPR_Load(kStructuresSprite); @@ -7447,7 +7450,7 @@ void AvHHud::GetSpriteForUser3(AvHUser3 inUser3, int& outSprite, int& outFrame, outSprite = Safe_SPR_Load(kStructuresSprite); outFrame = 0; break; - + default: outSprite = 0; outFrame = 0; @@ -7460,7 +7463,7 @@ int AvHHud::GetCurrentSquad() const { return mCurrentSquad; } - + AvHOverviewMap& AvHHud::GetOverviewMap() { return mOverviewMap; @@ -7468,7 +7471,7 @@ AvHOverviewMap& AvHHud::GetOverviewMap() void AvHHud::ShowCrosshair() { - + ++mCrosshairShowCount; if (mCrosshairShowCount > 0) @@ -7556,7 +7559,7 @@ void AvHHud::PlayStream() // Read URL string theURL; theURL = string("http://") + string(gEngfuncs.Cmd_Argv(1)); - + string theError; if(!gHUD.PlayInternetStream(theURL, theError)) { @@ -7591,7 +7594,7 @@ float AvHHud::GetServerVariableFloat(const char* inName) const /** * Prints the call stack when an unhandled exception occurs. */ -LONG WINAPI ExceptionFilter(EXCEPTION_POINTERS* pExp) +LONG WINAPI ExceptionFilter(EXCEPTION_POINTERS* pExp) { /* @@ -7607,12 +7610,12 @@ LONG WINAPI ExceptionFilter(EXCEPTION_POINTERS* pExp) { "max_mcguire@yahoo.com", }; - + for (int i = 0; i < sizeof(programmerAddress) / sizeof(char*); ++i) { SendMail(serverName, fromAddress, fromAddress, programmerAddress[i], "Exception Log", buffer.str().c_str()); - } + } */ AvHHud::ResetGammaAtExit(); diff --git a/releases/valve/source/mod/AvHOverviewMap.cpp b/releases/valve/source/mod/AvHOverviewMap.cpp index f11d4afe..d0203d95 100644 --- a/releases/valve/source/mod/AvHOverviewMap.cpp +++ b/releases/valve/source/mod/AvHOverviewMap.cpp @@ -78,6 +78,8 @@ void AvHOverviewMap::Init() this->mMiniMapSprite = 0; this->mReticleSprite = 0; + // puzl: 1066 reset overview + this->mLastMinimapName = ""; mLastUpdateTime = 0; } diff --git a/releases/valve/source/mod/AvHOverviewMap.h b/releases/valve/source/mod/AvHOverviewMap.h index e5f3aa64..52c58a06 100644 --- a/releases/valve/source/mod/AvHOverviewMap.h +++ b/releases/valve/source/mod/AvHOverviewMap.h @@ -40,7 +40,7 @@ public: float mViewWorldMaxY; bool mFullScreen; - + }; AvHOverviewMap(); @@ -75,7 +75,8 @@ protected: AvHUser3 mUser3; AvHTeamNumber mTeam; - + // puzl: 1066 the name of the last minimap we loaded + string mLastMinimapName; private: void WorldToMiniMapCoords(const DrawInfo& inDrawInfo, float& x, float& y); @@ -126,4 +127,4 @@ private: }; -#endif \ No newline at end of file +#endif