From e6db2ee4e54964716ac651cd4c0ea4822d26edea Mon Sep 17 00:00:00 2001 From: tankefugl Date: Mon, 4 Apr 2005 01:45:56 +0000 Subject: [PATCH] Mantis 0000988: O The commander can now see the health for all buildings and marines, even when not selected, as transparent health circles. Health circles for selected buildings and marines are rendered as normal. git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@32 67975925-1194-0748-b3d5-c16f83f1a3a1 --- main/source/mod/AvHHud.h | 4 ++- main/source/mod/AvHHudRender.cpp | 55 ++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/main/source/mod/AvHHud.h b/main/source/mod/AvHHud.h index aefeca92..8ef2ff97 100644 --- a/main/source/mod/AvHHud.h +++ b/main/source/mod/AvHHud.h @@ -300,7 +300,9 @@ public: void SetSelectingWeaponID(int inWeaponID, int inR = -1, int inG = -1, int inB = -1); void SetTechHelpText(const string& inTechHelpText); void DrawSelectionCircleOnGroundAtPoint(vec3_t inOrigin, int inRadius); - void DrawBuildHealthEffectsForEntity(int inEntIndex); + // tankefugl: 0000988 + void DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha = 1.0f); + // :tankefugl void DrawSelectionAndBuildEffects(); void DrawHUDNumber(int inX, int inY, int inFlags, int inNumber); diff --git a/main/source/mod/AvHHudRender.cpp b/main/source/mod/AvHHudRender.cpp index e3021267..f053cd17 100644 --- a/main/source/mod/AvHHudRender.cpp +++ b/main/source/mod/AvHHudRender.cpp @@ -138,6 +138,7 @@ #include "mod/AvHServerVariables.h" #include "mod/AvHSpriteAPI.h" #include "mod/AvHParticleEditorHandler.h" +#include void IN_GetMousePos( int *mx, int *my ); @@ -2158,7 +2159,9 @@ void AvHHud::DrawPendingRequests() } -void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex) +// tankefugl: 0000988 +void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha) +// :tankefugl { // Get entity int theUser3 = 0; @@ -2291,7 +2294,7 @@ void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex) //GetHasUpgrade(this->GetHUDUpgrades(), MASK_PARASITED) - DrawSpriteOnGroundAtPoint(thePosition, theRadius, theSpriteToUse, kRenderTransAdd, theCurrentFrame); + DrawSpriteOnGroundAtPoint(thePosition, theRadius, theSpriteToUse, kRenderTransAdd, theCurrentFrame, inAlpha); theDrewBuildInProgress = true; } @@ -2316,12 +2319,19 @@ void AvHHud::DrawHUDNumber(int inX, int inY, int inFlags, int inNumber) void AvHHud::DrawSelectionAndBuildEffects() { +// tankefugl: 0000988 + list theSelectedList; +// :tankefugl + // Draw build effects for(SelectionListType::iterator theSelectIter = this->mSelectionEffects.begin(); theSelectIter != this->mSelectionEffects.end(); theSelectIter++) { // Draw selection effect around the entity int theEntIndex = theSelectIter->mEntIndex; this->DrawBuildHealthEffectsForEntity(theEntIndex); + // tankefugl: 0000988 + theSelectedList.push_back(theEntIndex); + // :tankefugl } bool theDrawBuildingEffect = false; @@ -2329,7 +2339,48 @@ void AvHHud::DrawSelectionAndBuildEffects() { int theEntIndex = *theBuildingIter; this->DrawBuildHealthEffectsForEntity(theEntIndex); + // tankefugl: 0000988 + theSelectedList.push_back(theEntIndex); + // :tankefugl } + +// tankefugl: 0000988 + gEngfuncs.pEventAPI->EV_SetUpPlayerPrediction( false, true ); + gEngfuncs.pEventAPI->EV_PushPMStates(); + gEngfuncs.pEventAPI->EV_SetSolidPlayers(-1); + + if (this->GetInTopDownMode()) { + int localPlayerIndex = gEngfuncs.GetLocalPlayer()->index; + physent_t *thePlayer = gEngfuncs.pEventAPI->EV_GetPhysent(localPlayerIndex); +// gEngfuncs.Con_Printf("gEngfuncs.GetLocalPlayer()->index = %d, thePlayer->team = %d\n", gEngfuncs.GetLocalPlayer()->index, thePlayer->team); + + physent_t* theEntity = NULL; + int theNumEnts = pmove->numphysent; + for (int i = 0; i < theNumEnts; i++) + { + theEntity = gEngfuncs.pEventAPI->EV_GetPhysent(i); + if(theEntity) + { + if (localPlayerIndex != theEntity->info) + { + int theEntityIndex = theEntity->info; + list::iterator theSelectedIterator = find(theSelectedList.begin(), theSelectedList.end(), theEntityIndex); + if (theSelectedIterator == theSelectedList.end()) + { + bool theIsPlayer = ((theEntityIndex >= 1) && (theEntityIndex <= gEngfuncs.GetMaxClients())); + bool theSameTeam = (theEntity->team == thePlayer->team ); + + if(theIsPlayer || theSameTeam) + { + this->DrawBuildHealthEffectsForEntity(theEntityIndex, 0.3); + } + } + } + } + } + } + gEngfuncs.pEventAPI->EV_PopPMStates(); +// :tankefugl }