mirror of
https://github.com/ENSL/NS.git
synced 2024-11-22 04:31:12 +00:00
add minimap visuals for unbuilt and recycling structures
This commit is contained in:
parent
d2dc2fd7cf
commit
1f3940091a
5 changed files with 56 additions and 19 deletions
|
@ -165,10 +165,8 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType
|
|||
GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_VIS_SIGHTED);
|
||||
bool theEntityIsDetected = GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_VIS_DETECTED);
|
||||
bool theEntityIsUnderAttack = GetGameRules()->GetIsEntityUnderAttack(theEntityIndex);
|
||||
if ( theEntityIsUnderAttack )
|
||||
{
|
||||
int a=0;
|
||||
}
|
||||
bool theEntityIsUnbuilt = GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_BUILDABLE);
|
||||
bool theEntityIsRecycling = GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_RECYCLING);
|
||||
// Don't send ammo, health, weapons, or scans
|
||||
bool theIsTransient = ((AvHUser3)(theBaseEntity->pev->iuser3) == AVH_USER3_MARINEITEM) || (theBaseEntity->pev->classname == MAKE_STRING(kwsScan));
|
||||
|
||||
|
@ -203,6 +201,8 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType
|
|||
mapEntity.mTeam = (AvHTeamNumber)(theBaseEntity->pev->team);
|
||||
mapEntity.mSquadNumber = 0;
|
||||
mapEntity.mUnderAttack = theEntityIsUnderAttack ? 1 : 0;
|
||||
mapEntity.mUnbuilt = theEntityIsUnbuilt ? 1 : 0;
|
||||
mapEntity.mRecycling = theEntityIsRecycling ? 1 : 0;
|
||||
|
||||
bool sendEntity = false;
|
||||
|
||||
|
@ -305,6 +305,8 @@ void AvHEntityHierarchy::BuildForSpec(BaseEntityListType& inBaseEntityList)
|
|||
if ( theBaseEntity->pev->team == TEAM_ONE || theBaseEntity->pev->team == TEAM_TWO || theBaseEntity->pev->team == TEAM_THREE || theBaseEntity->pev->team == TEAM_FOUR )
|
||||
theEntityIsVisible=true;
|
||||
bool theEntityIsUnderAttack = GetGameRules()->GetIsEntityUnderAttack(theEntityIndex);
|
||||
bool theEntityIsUnbuilt = GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_BUILDABLE);
|
||||
bool theEntityIsRecycling = GetHasUpgrade(theBaseEntity->pev->iuser4, MASK_RECYCLING);
|
||||
// Don't send ammo, health, weapons, or scans
|
||||
bool theIsTransient = ((AvHUser3)(theBaseEntity->pev->iuser3) == AVH_USER3_MARINEITEM) || (theBaseEntity->pev->classname == MAKE_STRING(kwsScan));
|
||||
|
||||
|
@ -318,6 +320,8 @@ void AvHEntityHierarchy::BuildForSpec(BaseEntityListType& inBaseEntityList)
|
|||
mapEntity.mTeam = (AvHTeamNumber)(theBaseEntity->pev->team);
|
||||
mapEntity.mSquadNumber = 0;
|
||||
mapEntity.mUnderAttack = theEntityIsUnderAttack ? 1 : 0;
|
||||
mapEntity.mUnbuilt = theEntityIsUnbuilt ? 1 : 0;
|
||||
mapEntity.mRecycling = theEntityIsRecycling ? 1 : 0;
|
||||
|
||||
bool sendEntity = false;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ const int kNumStatusTypes = 15;
|
|||
class MapEntity
|
||||
{
|
||||
public:
|
||||
MapEntity(void) : mUser3(AVH_USER3_NONE), mTeam(TEAM_IND), mX(0.0f), mY(0.0f), mAngle(0.0f), mSquadNumber(0), mUnderAttack(0) {}
|
||||
MapEntity(void) : mUser3(AVH_USER3_NONE), mTeam(TEAM_IND), mX(0.0f), mY(0.0f), mAngle(0.0f), mSquadNumber(0), mUnderAttack(0), mUnbuilt(0), mRecycling(0) {}
|
||||
|
||||
AvHUser3 mUser3;
|
||||
AvHTeamNumber mTeam;
|
||||
|
@ -63,6 +63,8 @@ public:
|
|||
float mAngle;
|
||||
int mSquadNumber;
|
||||
int mUnderAttack;
|
||||
int mUnbuilt;
|
||||
int mRecycling;
|
||||
|
||||
bool operator==(const MapEntity& e) const
|
||||
{
|
||||
|
@ -72,7 +74,9 @@ public:
|
|||
mY == e.mY &&
|
||||
mAngle == e.mAngle &&
|
||||
mUnderAttack == e.mUnderAttack &&
|
||||
mSquadNumber == e.mSquadNumber;
|
||||
mSquadNumber == e.mSquadNumber &&
|
||||
mUnbuilt == e.mUnbuilt &&
|
||||
mRecycling == e.mRecycling;
|
||||
}
|
||||
|
||||
bool operator!=(const MapEntity& e) const
|
||||
|
|
|
@ -2086,11 +2086,13 @@ const int kNumPlayerIndexBits = 6;
|
|||
const int kPlayerIndexMask = 0x3F;
|
||||
const int kNumIndexBits = 14;
|
||||
const int kIndexMask = 0x3FFF;
|
||||
const int kNumFlagBits = 3;
|
||||
const int kFlagMask = 0x07;
|
||||
const int kNumFlagBits = 5;
|
||||
const int kFlagMask = 0x1F;
|
||||
const int kEntHierFlagPlayer = 0x01;
|
||||
const int kEntHierFlagDeletion = 0x02;
|
||||
const int kEntHierFlagUnderAttack = 0x04;
|
||||
const int kEntHierFlagUnbuilt = 0x08;
|
||||
const int kEntHierFlagRecycling = 0x10;
|
||||
|
||||
|
||||
#ifndef AVH_SERVER
|
||||
|
@ -2137,6 +2139,8 @@ const int kEntHierFlagUnderAttack = 0x04;
|
|||
int index = 0;
|
||||
|
||||
ent.mUnderAttack = ((flags & kEntHierFlagUnderAttack) == kEntHierFlagUnderAttack );
|
||||
ent.mUnbuilt = ((flags & kEntHierFlagUnbuilt) == kEntHierFlagUnbuilt);
|
||||
ent.mRecycling = ((flags & kEntHierFlagRecycling) == kEntHierFlagRecycling);
|
||||
ent.mUser3 = (AvHUser3)(long_data & kStatusMask);
|
||||
long_data >>= kNumStatusBits;
|
||||
ent.mTeam = (AvHTeamNumber)(long_data & kTeamMask);
|
||||
|
@ -2283,6 +2287,8 @@ const int kEntHierFlagUnderAttack = 0x04;
|
|||
ASSERT( ( short_data & kFlagMask ) == 0 );
|
||||
short_data |= kEntHierFlagPlayer;
|
||||
if ( ent.mUnderAttack ) short_data |= kEntHierFlagUnderAttack;
|
||||
if ( ent.mUnbuilt ) short_data |= kEntHierFlagUnbuilt;
|
||||
if ( ent.mRecycling ) short_data |= kEntHierFlagRecycling;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -2293,6 +2299,12 @@ const int kEntHierFlagUnderAttack = 0x04;
|
|||
if ( ent.mUnderAttack ) {
|
||||
short_data |= kEntHierFlagUnderAttack;
|
||||
}
|
||||
if ( ent.mUnbuilt ) {
|
||||
short_data |= kEntHierFlagUnbuilt;
|
||||
}
|
||||
if (ent.mRecycling) {
|
||||
short_data |= kEntHierFlagRecycling;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ void AvHOverviewMap::GetSpriteForEntity(const DrawableEntity& entity, AVHHSPRITE
|
|||
}
|
||||
|
||||
|
||||
void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR, float& outG, float& outB)
|
||||
void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR, float& outG, float& outB, float& outA)
|
||||
{
|
||||
static float attackBlinkPeriod=0.4f;
|
||||
bool isStructure=entity.mUser3 == AVH_USER3_HIVE ||
|
||||
|
@ -216,6 +216,8 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
|
|||
entity.mUser3 == AVH_USER3_ALIENRESTOWER ||
|
||||
entity.mUser3 == AVH_USER3_ADVANCED_TURRET_FACTORY;
|
||||
|
||||
outA = 1.0f;
|
||||
|
||||
if ( entity.mIsUnderAttack && (entity.mTeam == mTeam || gEngfuncs.IsSpectateOnly() ) ) {
|
||||
if ( gpGlobals && (gpGlobals->time > this->mBlinkTime + attackBlinkPeriod) ) {
|
||||
this->mBlinkOn=!mBlinkOn;
|
||||
|
@ -312,7 +314,13 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
|
|||
outB=0.0;
|
||||
}
|
||||
if ( isStructure ) {
|
||||
if ( entity.mTeam == TEAM_ONE ) {
|
||||
if (entity.mIsRecycling)
|
||||
{
|
||||
outR = 0.5f;
|
||||
outG = 0.5f;
|
||||
outB = 0.5f;
|
||||
}
|
||||
else if ( entity.mTeam == TEAM_ONE ) {
|
||||
outR=0.43;
|
||||
outG=0.70;
|
||||
outB=1.0;
|
||||
|
@ -322,6 +330,11 @@ void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR
|
|||
outG=0.45;
|
||||
outB=0.00;
|
||||
}
|
||||
|
||||
if (entity.mIsUnbuilt)
|
||||
{
|
||||
outA = 0.6f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -397,10 +410,10 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
|
|||
if (x + w >= theX && y + h >= theY && x < theX + theWidth && y < theY + theHeight)
|
||||
{
|
||||
|
||||
float r, g, b;
|
||||
GetColorForEntity(inEntity, r, g, b);
|
||||
float r, g, b, a;
|
||||
GetColorForEntity(inEntity, r, g, b, a);
|
||||
|
||||
AvHSpriteSetColor(r, g, b);
|
||||
AvHSpriteSetColor(r, g, b, a);
|
||||
|
||||
// If it's the local player, draw the FOV.
|
||||
|
||||
|
@ -436,7 +449,7 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
|
|||
AvHSpriteSetRotation(0, 0, 0);
|
||||
}
|
||||
|
||||
AvHSpriteSetColor(r, g, b);
|
||||
AvHSpriteSetColor(r, g, b, a);
|
||||
AvHSpriteSetRenderMode(theRenderMode);
|
||||
AvHSpriteDraw(theSprite, theFrame, x, y, x + w, y + h, 0, 0, 1, 1);
|
||||
|
||||
|
@ -534,10 +547,10 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
|
|||
|
||||
AvHSpriteSetRenderMode(renderMode);
|
||||
|
||||
float r, g, b;
|
||||
GetColorForEntity(inEntity, r, g, b);
|
||||
float r, g, b, a;
|
||||
GetColorForEntity(inEntity, r, g, b, a);
|
||||
|
||||
AvHSpriteSetColor(r, g, b);
|
||||
AvHSpriteSetColor(r, g, b, a);
|
||||
AvHSpriteSetRotation(angle, tipX, tipY);
|
||||
AvHSpriteDraw(theSprite, theFrame, tipX, tipY - h / 2 , tipX + w, tipY + h / 2, 0, 0, 1, 1);
|
||||
|
||||
|
@ -979,6 +992,8 @@ void AvHOverviewMap::UpdateDrawData(float inCurrentTime)
|
|||
theDrawableEntity.mAngleRadians = theIter->second.mAngle * M_PI / 180;
|
||||
theDrawableEntity.mSquadNumber = theIter->second.mSquadNumber;
|
||||
theDrawableEntity.mIsUnderAttack = theIter->second.mUnderAttack;
|
||||
theDrawableEntity.mIsUnbuilt = theIter->second.mUnbuilt;
|
||||
theDrawableEntity.mIsRecycling = theIter->second.mRecycling;
|
||||
|
||||
// Returns position relative to minimap, so add it back in
|
||||
// commented this out here, commented out corresponding shift in AvHEntityHierarchy::BuildFromTeam at line 234
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
class DrawableEntity
|
||||
{
|
||||
public:
|
||||
DrawableEntity() : mUser3(AVH_USER3_NONE), mIsAlive(true), mX(0), mY(0), mAngleRadians(0), mIsLocalPlayer(false), mEntityNumber(0), mTeam(TEAM_IND), mSquadNumber(0), mIsUnderAttack(0)
|
||||
DrawableEntity() : mUser3(AVH_USER3_NONE), mIsAlive(true), mX(0), mY(0), mAngleRadians(0), mIsLocalPlayer(false), mEntityNumber(0), mTeam(TEAM_IND), mSquadNumber(0), mIsUnderAttack(0), mIsUnbuilt(false), mIsRecycling(false)
|
||||
{}
|
||||
|
||||
AvHUser3 mUser3;
|
||||
|
@ -21,6 +21,8 @@ public:
|
|||
bool mIsLocalPlayer;
|
||||
int mEntityNumber;
|
||||
int mSquadNumber;
|
||||
bool mIsUnbuilt;
|
||||
bool mIsRecycling;
|
||||
};
|
||||
|
||||
class AvHOverviewMap
|
||||
|
@ -86,7 +88,7 @@ private:
|
|||
|
||||
void Init();
|
||||
void GetSpriteForEntity(const DrawableEntity& entity, AVHHSPRITE& outSprite, int& outFrame, int& outRenderMode, bool commanderOverview);
|
||||
void GetColorForEntity(const DrawableEntity& entity, float& outR, float& outG, float& outB);
|
||||
void GetColorForEntity(const DrawableEntity& entity, float& outR, float& outG, float& outB, float& outA);
|
||||
|
||||
void UpdateDrawData(float inCurrentTime);
|
||||
|
||||
|
|
Loading…
Reference in a new issue