From 3f0bf58255e6f9e6c3e872e4119927370604b67c Mon Sep 17 00:00:00 2001 From: tankefugl Date: Mon, 27 Jun 2005 02:31:49 +0000 Subject: [PATCH] Mantis 0000971: o Added directional arrows to the order popup notification git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@216 67975925-1194-0748-b3d5-c16f83f1a3a1 --- main/source/mod/AvHHud.h | 2 ++ main/source/mod/AvHHudRender.cpp | 54 +++++++++++++++++++++++++++++-- main/source/mod/AvHOrder.h | 4 +++ main/sprites/query.spr | Bin 66666 -> 83130 bytes 4 files changed, 57 insertions(+), 3 deletions(-) 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 d4a8cd6b2a96c016bc41b7727ed99d6f84d148ef..fc831ca69ac5c14519e33964aafcf23455746eef 100644 GIT binary patch delta 2733 zcmbtVOK#gR6htD)e>Iydg4mWKRrNk`66aGda)1E2hgZEpyKA#5>{EDWpy;Aq_YS^8 zPLUz`9z{~5vk@cu~hY$=I53~TV(75U`LeDoEXc>V~mmc+N9E%MTjp!TX73eM6Ln95*kM_YFDR_qwZ_5~=905FMO3ueIE7--1&JtC zgn{UJ5{qFm<(w_nbmB7{I1jk=i{GV_M7{&)em0vWa&&6_(X?;Xrk4iFo#owXw?E6B z{w#X3quDlVtRvsUp;=lB;fby=^m^~e*uP-mN*8|Py+bs$L?LDB=l8UfqmQr1Cn_0?5ZtTlajgez}v($jFQXorBq!=lXr521OgIQ{!L!w#VfYE0B zSz6jz5v5RQLI_=y6fE^=4^}5-J{tW~l+uTA?hputG7Er52FZ z;}=c!H3bKf{wy^FNzUU?9BCYsJXy+R(s2EWkDL&oJN_(o?+a3j3Z}j2GLZ#pX}JSg MiW(Si{Nqnw0k;hK2mk;8 delta 17 Ycmdnh$@;2;Wr7T&K%?wdSw>$L06ESDJ^%m!