o added back in -mlook but made it do nothing. Use of the console toggles mlook

o Added colouring of icons to the minimap
- local player is white
- squad members are blue/green
- friendlies are green
- enemies are red
- mines are orange
- entities under attack flash yellow
o Added small optomisation to 'Entity under attack' processing.
o Added 'under attack' bit to enthier flags


git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@396 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
puzl 2006-04-17 19:15:39 +00:00
parent 694b72d5d7
commit d8d132bf1e
7 changed files with 145 additions and 96 deletions

View file

@ -863,11 +863,11 @@ void IN_ScoreUp(void)
void IN_MLookUp (void)
{
KeyUp( &in_mlook );
/*KeyUp( &in_mlook );
if ( !( in_mlook.state & 1 ) && lookspring->value )
{
V_StartPitchDrift();
}
}*/
}
/*
@ -1513,7 +1513,7 @@ void InitInput (void)
gEngfuncs.pfnAddCommand ("+klook", IN_KLookDown);
gEngfuncs.pfnAddCommand ("-klook", IN_KLookUp);
gEngfuncs.pfnAddCommand ("+mlook", IN_MLookDown);
//gEngfuncs.pfnAddCommand ("-mlook", IN_MLookUp);
gEngfuncs.pfnAddCommand ("-mlook", IN_MLookUp);
gEngfuncs.pfnAddCommand ("+jlook", IN_JLookDown);
gEngfuncs.pfnAddCommand ("-jlook", IN_JLookUp);
gEngfuncs.pfnAddCommand ("+duck", IN_DuckDown);

View file

@ -149,7 +149,11 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType
bool theEntityIsVisible = (theBaseEntity->pev->team == (int)(inTeam->GetTeamNumber())) ||
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;
}
// Don't send ammo, health, weapons, or scans
bool theIsTransient = ((AvHUser3)(theBaseEntity->pev->iuser3) == AVH_USER3_MARINEITEM) || (theBaseEntity->pev->classname == MAKE_STRING(kwsScan));
@ -166,6 +170,7 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType
mapEntity.mAngle = theBaseEntity->pev->angles[1];
mapEntity.mTeam = (AvHTeamNumber)(theBaseEntity->pev->team);
mapEntity.mSquadNumber = 0;
mapEntity.mUnderAttack = theEntityIsUnderAttack ? 1 : 0;
bool sendEntity = false;

View file

@ -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) {}
MapEntity(void) : mUser3(AVH_USER3_NONE), mTeam(TEAM_IND), mX(0.0f), mY(0.0f), mAngle(0.0f), mSquadNumber(0), mUnderAttack(0) {}
AvHUser3 mUser3;
AvHTeamNumber mTeam;
@ -62,6 +62,7 @@ public:
float mY;
float mAngle;
int mSquadNumber;
int mUnderAttack;
bool operator==(const MapEntity& e) const
{
@ -70,6 +71,7 @@ public:
mX == e.mX &&
mY == e.mY &&
mAngle == e.mAngle &&
mUnderAttack == e.mUnderAttack &&
mSquadNumber == e.mSquadNumber;
}

View file

@ -3362,17 +3362,10 @@ const std::string& AvHGamerules::GetServerVariable(int i) const
bool AvHGamerules::GetIsEntityUnderAttack(int inEntityIndex) const
{
bool theEntityIsUnderAttack = false;
// If entity is in list, it's being attacked
for(EntityUnderAttackListType::const_iterator theIter = this->mEntitiesUnderAttack.begin(); theIter != this->mEntitiesUnderAttack.end(); theIter++)
{
if(inEntityIndex == theIter->first)
{
theEntityIsUnderAttack = true;
break;
}
if ( this->mEntitiesUnderAttack.find(inEntityIndex) != this->mEntitiesUnderAttack.end() ) {
theEntityIsUnderAttack=true;
}
return theEntityIsUnderAttack;
}

View file

@ -1957,10 +1957,12 @@ const int kNumPlayerIndexBits = 6;
const int kPlayerIndexMask = 0x3F;
const int kNumIndexBits = 14;
const int kIndexMask = 0x3FFF;
const int kNumFlagBits = 2;
const int kFlagMask = 0x03;
const int kNumFlagBits = 3;
const int kFlagMask = 0x07;
const int kEntHierFlagPlayer = 0x01;
const int kEntHierFlagDeletion = 0x02;
const int kEntHierFlagUnderAttack = 0x04;
#ifndef AVH_SERVER
//TODO : replace OldItems with vector<int>
@ -2001,6 +2003,11 @@ const int kEntHierFlagDeletion = 0x02;
MapEntity ent;
int index = 0;
ent.mUnderAttack = ((flags & kEntHierFlagUnderAttack) == kEntHierFlagUnderAttack );
if ( ent.mUnderAttack )
{
int a=0;
}
ent.mUser3 = (AvHUser3)(long_data & kStatusMask);
long_data >>= kNumStatusBits;
ent.mTeam = (AvHTeamNumber)(long_data & kTeamMask);
@ -2020,6 +2027,7 @@ const int kEntHierFlagDeletion = 0x02;
else // Other item added/changed
{
index = short_data & kIndexMask;
short_data >>= kNumIndexBits;
ent.mSquadNumber = 0;
ent.mAngle = 0;
}
@ -2097,6 +2105,7 @@ const int kEntHierFlagDeletion = 0x02;
ASSERT((ent.mUser3 & ~kStatusMask) == 0);
long_data |= ent.mUser3 & kStatusMask;
switch( ent.mUser3 )
{
case AVH_USER3_MARINE_PLAYER: case AVH_USER3_COMMANDER_PLAYER:
@ -2120,12 +2129,17 @@ const int kEntHierFlagDeletion = 0x02;
short_data <<= kNumFlagBits;
ASSERT( ( short_data & kFlagMask ) == 0 );
short_data |= kEntHierFlagPlayer;
if ( ent.mUnderAttack ) short_data |= kEntHierFlagUnderAttack;
break;
}
default:
ASSERT( ( index & ~kIndexMask ) == 0 );
short_data = index & kIndexMask;
short_data <<= kNumFlagBits;
ASSERT( (short_data & kFlagMask) == 0 );
if ( ent.mUnderAttack ) {
short_data |= kEntHierFlagUnderAttack;
}
}
}

View file

@ -67,6 +67,7 @@ AvHOverviewMap::AvHOverviewMap()
this->Init();
}
extern globalvars_t *gpGlobals;
void AvHOverviewMap::Init()
{
this->mUser3 = AVH_USER3_NONE;
@ -81,6 +82,8 @@ void AvHOverviewMap::Init()
this->mReticleSprite = 0;
// puzl: 1066 reset overview map
this->mLastMinimapName = "";
this->mBlinkTime=0.0f;
this->mBlinkOn=false;
mLastUpdateTime = 0;
}
@ -109,103 +112,130 @@ void AvHOverviewMap::GetSpriteForEntity(const DrawableEntity& entity, int& outSp
void AvHOverviewMap::GetColorForEntity(const DrawableEntity& entity, float& outR, float& outG, float& outB)
{
static float attackBlinkPeriod=0.3f;
bool isStructure=entity.mUser3 == AVH_USER3_HIVE ||
entity.mUser3 == AVH_USER3_COMMANDER_STATION ||
entity.mUser3 == AVH_USER3_TURRET_FACTORY ||
entity.mUser3 == AVH_USER3_ARMORY ||
entity.mUser3 == AVH_USER3_ADVANCED_ARMORY ||
entity.mUser3 == AVH_USER3_ARMSLAB ||
entity.mUser3 == AVH_USER3_PROTOTYPE_LAB ||
entity.mUser3 == AVH_USER3_OBSERVATORY ||
entity.mUser3 == AVH_USER3_TURRET ||
entity.mUser3 == AVH_USER3_SIEGETURRET ||
entity.mUser3 == AVH_USER3_RESTOWER ||
entity.mUser3 == AVH_USER3_INFANTRYPORTAL ||
entity.mUser3 == AVH_USER3_PHASEGATE ||
entity.mUser3 == AVH_USER3_DEFENSE_CHAMBER ||
entity.mUser3 == AVH_USER3_MOVEMENT_CHAMBER ||
entity.mUser3 == AVH_USER3_OFFENSE_CHAMBER ||
entity.mUser3 == AVH_USER3_SENSORY_CHAMBER ||
entity.mUser3 == AVH_USER3_ALIENRESTOWER ||
entity.mUser3 == AVH_USER3_ADVANCED_TURRET_FACTORY;
if ( entity.mIsUnderAttack && (entity.mTeam == mTeam || gEngfuncs.IsSpectateOnly() ) {
if ( gpGlobals->time > this->mBlinkTime + attackBlinkPeriod ) {
this->mBlinkOn=!mBlinkOn;
this->mBlinkTime=gpGlobals->time;
}
if ( this->mBlinkOn ) {
outR = 0.8;
outG = 0.8;
outB = 0.2;
return;
}
}
if (entity.mUser3 == AVH_USER3_WAYPOINT)
{
outR = 0.1;
outG = 0.8;
outB = 1.0;
}
}
else if (entity.mTeam == TEAM_IND)
{
{
if (entity.mUser3 == AVH_USER3_WELD)
{
outR = 1.0;
outG = 0.7;
outB = 0.0;
outB = 0.5;
}
else
{
outR = 0.5;
outG = 0.5;
outB = 0.5;
outR = 0.5;
outG = 0.5;
outB = 0.5;
}
}
else if ( gEngfuncs.IsSpectateOnly() ) {
if ( entity.mTeam == TEAM_ONE || entity.mTeam == TEAM_THREE ) {
outR = 0.1;
outG = 0.1;
outB = 0.8;
}
else if ( entity.mTeam == TEAM_TWO || entity.mTeam == TEAM_FOUR ) {
outR = 0.8;
outG = 0.6;
outB = 0.1;
}
}
else if (entity.mTeam == mTeam)
{
if ( entity.mUser3 == AVH_USER3_MINE ) {
outR = 0.0;
outG = 0.4;
outB = 0.0;
}
else if ( isStructure )
{
outR = 0.1;
outG = 0.8;
outB = 0.1;
}
else
{
outR = 0.1;
outG = 1.0;
outB = 0.1;
// Color squads.
int localPlayerSquad;
if (g_iUser1 == OBS_NONE)
{
localPlayerSquad = gHUD.GetCurrentSquad();
}
else
{
// We don't have access to the squad information for player's
// we're spectating.
localPlayerSquad = 0;
}
if (mUser3 != AVH_USER3_COMMANDER_PLAYER)
{
if (entity.mIsLocalPlayer ) {
outR = 1.0;
outG = 1.0;
outB = 1.0;
}
if (entity.mSquadNumber != 0 && entity.mSquadNumber == localPlayerSquad)
{
outR = 1.0;
outG = 8.0;
outB = 8.0;
}
}
}
}
else
{
if (entity.mTeam == mTeam)
{
if (entity.mUser3 == AVH_USER3_HIVE ||
entity.mUser3 == AVH_USER3_COMMANDER_STATION ||
entity.mUser3 == AVH_USER3_TURRET_FACTORY ||
entity.mUser3 == AVH_USER3_ARMORY ||
entity.mUser3 == AVH_USER3_ADVANCED_ARMORY ||
entity.mUser3 == AVH_USER3_ARMSLAB ||
entity.mUser3 == AVH_USER3_PROTOTYPE_LAB ||
entity.mUser3 == AVH_USER3_OBSERVATORY ||
entity.mUser3 == AVH_USER3_TURRET ||
entity.mUser3 == AVH_USER3_SIEGETURRET ||
entity.mUser3 == AVH_USER3_RESTOWER ||
entity.mUser3 == AVH_USER3_INFANTRYPORTAL ||
entity.mUser3 == AVH_USER3_PHASEGATE ||
entity.mUser3 == AVH_USER3_DEFENSE_CHAMBER ||
entity.mUser3 == AVH_USER3_MOVEMENT_CHAMBER ||
entity.mUser3 == AVH_USER3_OFFENSE_CHAMBER ||
entity.mUser3 == AVH_USER3_SENSORY_CHAMBER ||
entity.mUser3 == AVH_USER3_ALIENRESTOWER ||
entity.mUser3 == AVH_USER3_ADVANCED_TURRET_FACTORY)
{
outR = 0.5;
outG = 0.8;
outB = 1.0;
}
else
{
outR = 1.0;
outG = 1.0;
outB = 1.0;
// Color squads.
int localPlayerSquad;
if (g_iUser1 == OBS_NONE)
{
localPlayerSquad = gHUD.GetCurrentSquad();
}
else
{
// We don't have access to the squad information for player's
// we're spectating.
localPlayerSquad = 0;
}
if (mUser3 != AVH_USER3_COMMANDER_PLAYER)
{
if (entity.mIsLocalPlayer ||
(entity.mSquadNumber != 0 &&
entity.mSquadNumber == localPlayerSquad))
{
outR = 0.5;
outG = 1.0;
outB = 0.5;
}
}
}
}
else
{
outR = 1.0;
outG = 0.1;
outB = 0.0;
}
outR = isStructure ? 0.8 : 1.0;
outG = 0.1;
outB = 0.0;
}
}
void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const DrawableEntity& inEntity)
@ -214,7 +244,7 @@ void AvHOverviewMap::DrawMiniMapEntity(const DrawInfo& inDrawInfo, const Drawabl
if (!GetHasData())
{
return;
}
}
float theEntityPosX = inEntity.mX;
float theEntityPosY = inEntity.mY;
@ -784,6 +814,7 @@ void AvHOverviewMap::UpdateDrawData(float inCurrentTime)
theDrawableEntity.mTeam = theIter->second.mTeam;
theDrawableEntity.mAngleRadians = theIter->second.mAngle * M_PI / 180;
theDrawableEntity.mSquadNumber = theIter->second.mSquadNumber;
theDrawableEntity.mIsUnderAttack = theIter->second.mUnderAttack;
// Returns position relative to minimap, so add it back in
// commented this out here, commented out corresponding shift in AvHEntityHierarchy::BuildFromTeam at line 234

View file

@ -8,11 +8,12 @@
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)
DrawableEntity() : mUser3(AVH_USER3_NONE), mIsAlive(true), mX(0), mY(0), mAngleRadians(0), mIsLocalPlayer(false), mEntityNumber(0), mTeam(TEAM_IND), mSquadNumber(0), mIsUnderAttack(0)
{}
AvHUser3 mUser3;
bool mIsAlive;
bool mIsUnderAttack;
int mX;
int mY;
AvHTeamNumber mTeam;
@ -90,6 +91,9 @@ private:
float mWorldPlayerX;
float mWorldPlayerY;
float mBlinkTime;
bool mBlinkOn;
AvHMapExtents mMapExtents;
string mMapName;