diff --git a/main/source/mod/AvHHud.h b/main/source/mod/AvHHud.h index 56132c7a..d9677fdd 100644 --- a/main/source/mod/AvHHud.h +++ b/main/source/mod/AvHHud.h @@ -455,6 +455,7 @@ private: void DrawOrders(); void DrawHelpIcons(); // tankefugl: 0000971 + void GetOrderDirection(vec3_t inTarget, int inOrderType); void DrawTeammateOrders(); // tankefugl: 0000992 void DrawDisplayOrder(); @@ -611,6 +612,7 @@ private: // tankefugl: 0000992 float mDisplayOrderTime; int mDisplayOrderType; + int mDisplayOrderDirection; int mDisplayOrderIndex; string mDisplayOrderText1; string mDisplayOrderText2; diff --git a/main/source/mod/AvHHudRender.cpp b/main/source/mod/AvHHudRender.cpp index 501fae85..ef0f2555 100644 --- a/main/source/mod/AvHHudRender.cpp +++ b/main/source/mod/AvHHudRender.cpp @@ -1007,6 +1007,10 @@ void AvHHud::DrawOrderIcon(const AvHOrder& inOrder) //DrawScaledHUDSprite(theSpriteHandle, kRenderNormal, 1, thePosX, thePosY, theWidth, theHeight, theFrame, theStartU, theStartV, theEndU, theEndV); } + + vec3_t orderDir; + inOrder.GetLocation(orderDir); + this->GetOrderDirection(orderDir, 2); } } } @@ -1185,6 +1189,8 @@ void AvHHud::DrawDisplayOrder() float mIconY1 = 0.10f * ScreenHeight(); float mIconX2 = mIconX1 + 0.06f * ScreenWidth(); float mIconY2 = mIconY1 + 0.06f * ScreenWidth(); + float mLeftX = mIconX1 - 0.06f * ScreenWidth(); + float mRightX = mIconX2 + 0.06f * ScreenWidth(); float mTextX1 = 0.50f * ScreenWidth(); @@ -1192,6 +1198,17 @@ void AvHHud::DrawDisplayOrder() AvHSpriteSetDrawMode(kSpriteDrawModeFilled); AvHSpriteSetColor(1, 1, 1, 1 * theFade); + int theTeamAdd = 0; + if (this->GetIsAlien()) + theTeamAdd = 2; + + if (this->mDisplayOrderDirection == 1) + AvHSpriteDraw(this->mTeammateOrderSprite, TEAMMATE_MARINE_LEFT_ARROW + theTeamAdd, + mLeftX, mIconY1, mIconX1, mIconY2, 0, 0, 1, 1); // Left + else if (this->mDisplayOrderDirection == 2) + AvHSpriteDraw(this->mTeammateOrderSprite, TEAMMATE_MARINE_RIGHT_ARROW + theTeamAdd, + mIconX2, mIconY1, mRightX, mIconY2, 0, 0, 1, 1); // Right + if (this->mDisplayOrderType == 1) { AvHSpriteDraw(this->mTeammateOrderSprite, this->mDisplayOrderIndex + 8, mIconX1, mIconY1, mIconX2, mIconY2, 0, 0, 1, 1); @@ -1213,6 +1230,32 @@ void AvHHud::DrawDisplayOrder() // :tankefugl // tankefugl: 0000971 +void AvHHud::GetOrderDirection(vec3_t inTarget, int inOrderType) +{ + if (this->mDisplayOrderType == inOrderType) + { + // find left/right/none direction for the order popup notificator + vec3_t theForward, theRight, theUp, theDir; + AngleVectors(v_angles, theForward, theRight, theUp); + VectorSubtract(inTarget, v_origin, theDir); + theForward[2] = theDir[2] = 0; + VectorNormalize(theForward); + VectorNormalize(theDir); + + this->mDisplayOrderDirection = 0; + // if it is too close to screen center, ignore it + if (DotProduct(theForward, theDir) < 0.9f) + { + // Determine left and right + vec3_t theCrossProd = CrossProduct(theForward, theDir); + if (theCrossProd[2] > 0.0f) + this->mDisplayOrderDirection = 1; // Left + else if (theCrossProd[2] < 0.0f) + this->mDisplayOrderDirection = 2; // Right + } + } +} + void AvHHud::DrawTeammateOrders() { TeammateOrderListType::iterator toErase = NULL; @@ -1224,6 +1267,7 @@ void AvHHud::DrawTeammateOrders() for(TeammateOrderListType::iterator theIter = this->mTeammateOrder.begin(); theIter != this->mTeammateOrder.end(); theIter++) { + float lastOrder = 0; TeammateOrderType theOrder = (*theIter).second; int theEntIndex = (*theIter).first; float theFade = 1.0f; @@ -1252,6 +1296,12 @@ void AvHHud::DrawTeammateOrders() VectorCopy(theEntity->origin, theVec); theVec[2] += AvHCUGetIconHeightForPlayer((AvHUser3)theEntity->curstate.iuser3); this->DrawWorldSprite(this->mTeammateOrderSprite, kRenderTransAdd, theVec, theOrder.first, kHelpIconDrawSize, theFade); + + if (lastOrder < theOrder.second) + { + lastOrder = theOrder.second; + this->GetOrderDirection(theVec, 1); + } } } } @@ -4206,6 +4256,4 @@ void AvHHud::VidInit(void) this->mEnemyBlips.VidInit(); this->mFriendlyBlips.VidInit(); -} - - +} \ No newline at end of file diff --git a/main/source/mod/AvHOrder.h b/main/source/mod/AvHOrder.h index 69425341..91327fb3 100644 --- a/main/source/mod/AvHOrder.h +++ b/main/source/mod/AvHOrder.h @@ -96,6 +96,10 @@ typedef enum { TEAMMATE_ALIEN_ORDER_HEAL, TEAMMATE_ALIEN_ORDER_FOLLOW, TEAMMATE_ALIEN_ORDER_COVER, + TEAMMATE_MARINE_LEFT_ARROW = 16, + TEAMMATE_MARINE_RIGHT_ARROW, + TEAMMATE_ALIEN_LEFT_ARROW, + TEAMMATE_ALIEN_RIGHT_ARROW, TEAMMATE_ALIEN_ORDER_UNKNOWN } TeammateOrderEnum; typedef pair TeammateOrderType; diff --git a/main/sprites/query.spr b/main/sprites/query.spr index d4a8cd6b..fc831ca6 100644 Binary files a/main/sprites/query.spr and b/main/sprites/query.spr differ