mirror of
https://github.com/ENSL/NS.git
synced 2024-11-10 15:21:54 +00:00
o Added new message SetUpgrades sent when the enthier is process
o Display multiple chamber icons to represent the level of available upgrade. git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@398 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
efca6a6db4
commit
b1cc0c7f41
6 changed files with 117 additions and 12 deletions
|
@ -129,12 +129,15 @@ int GetHotkeyGroupContainingPlayer(AvHPlayer* player)
|
|||
return -1;
|
||||
|
||||
}
|
||||
|
||||
static int numMovement=0;
|
||||
static int numSensory=0;
|
||||
static int numDefence=0;
|
||||
|
||||
void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType& inBaseEntityList)
|
||||
{
|
||||
|
||||
this->Clear();
|
||||
int mc=0, sc=0, dc=0;
|
||||
|
||||
if (inTeam->GetTeamType() == AVH_CLASS_TYPE_MARINE ||
|
||||
inTeam->GetTeamType() == AVH_CLASS_TYPE_ALIEN)
|
||||
|
@ -157,7 +160,24 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType
|
|||
// Don't send ammo, health, weapons, or scans
|
||||
bool theIsTransient = ((AvHUser3)(theBaseEntity->pev->iuser3) == AVH_USER3_MARINEITEM) || (theBaseEntity->pev->classname == MAKE_STRING(kwsScan));
|
||||
|
||||
MapEntity mapEntity;
|
||||
|
||||
|
||||
if ( inTeam->GetTeamType() == AVH_CLASS_TYPE_ALIEN && theBaseEntity->pev->team == (int)(inTeam->GetTeamNumber()) ) {
|
||||
AvHBuildable *theBuildable=dynamic_cast<AvHBuildable *>(theBaseEntity);
|
||||
if ( theBuildable && theBuildable->GetHasBeenBuilt() ) {
|
||||
if ( theBaseEntity->pev->iuser3 == AVH_USER3_MOVEMENT_CHAMBER ) {
|
||||
mc++;
|
||||
}
|
||||
if ( theBaseEntity->pev->iuser3 == AVH_USER3_SENSORY_CHAMBER ) {
|
||||
sc++;
|
||||
}
|
||||
if ( theBaseEntity->pev->iuser3 == AVH_USER3_DEFENSE_CHAMBER ) {
|
||||
dc++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MapEntity mapEntity;
|
||||
|
||||
mapEntity.mX = theBaseEntity->pev->origin.x;
|
||||
mapEntity.mY = theBaseEntity->pev->origin.y;
|
||||
|
@ -195,7 +215,6 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType
|
|||
}
|
||||
else if ((theEntityIsVisible || theEntityIsDetected) && !(theBaseEntity->pev->effects & EF_NODRAW) && !theIsTransient)
|
||||
{
|
||||
|
||||
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theBaseEntity);
|
||||
|
||||
if (thePlayer)
|
||||
|
@ -245,8 +264,25 @@ void AvHEntityHierarchy::BuildFromTeam(const AvHTeam* inTeam, BaseEntityListType
|
|||
mEntityList[theEntityIndex] = mapEntity;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if ( inTeam->GetTeamType() == AVH_CLASS_TYPE_ALIEN ) {
|
||||
sc=min(3, sc);
|
||||
dc=min(3,dc);
|
||||
mc=min(3,mc);
|
||||
if ( numSensory != sc || numDefence != dc || numMovement != mc ) {
|
||||
numSensory=sc;
|
||||
numDefence=dc;
|
||||
numMovement=mc;
|
||||
int mask=0;
|
||||
mask |= ( numSensory & 0x3 );
|
||||
mask <<= 2;
|
||||
mask |= ( numDefence & 0x3 );
|
||||
mask <<= 2;
|
||||
mask |= ( numMovement & 0x3 );
|
||||
mask |= 0x80;
|
||||
NetMsg_HUDSetUpgrades(mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2860,6 +2860,24 @@ int AvHHud::Fog(const char* pszName, int iSize, void* pbuf)
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
BIND_MESSAGE(SetUpgrades);
|
||||
int AvHHud::SetUpgrades(const char* pszName, int iSize, void* pbuf)
|
||||
{
|
||||
int mask;
|
||||
NetMsg_HUDSetUpgrades( pbuf, iSize, mask );
|
||||
// Aliens
|
||||
if ( mask & 0x80 ) {
|
||||
this->mNumMovement=mask & 0x3;
|
||||
mask >>=2;
|
||||
this->mNumDefense=mask & 0x3;
|
||||
mask >>=2;
|
||||
this->mNumSensory=mask & 0x3;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
BIND_MESSAGE(ListPS);
|
||||
int AvHHud::ListPS(const char* pszName, int iSize, void* pbuf)
|
||||
{
|
||||
|
@ -3586,6 +3604,7 @@ void AvHHud::Init(void)
|
|||
HOOK_MESSAGE(ClScript);
|
||||
HOOK_MESSAGE(AlienInfo);
|
||||
HOOK_MESSAGE(DebugCSP);
|
||||
HOOK_MESSAGE(SetUpgrades);
|
||||
HOOK_MESSAGE(TechSlots);
|
||||
// tankefugl: 0000971
|
||||
HOOK_MESSAGE(IssueOrder);
|
||||
|
@ -3633,6 +3652,10 @@ void AvHHud::Init(void)
|
|||
this->mCurrentUseableEnergyLevel = 0;
|
||||
this->mVisualEnergyLevel = 0.0f;
|
||||
|
||||
this->mNumSensory=0;
|
||||
this->mNumMovement=0;
|
||||
this->mNumDefense=0;
|
||||
|
||||
this->mFogActive = false;
|
||||
this->mFogColor.x = this->mFogColor.y = this->mFogColor.z = 0;
|
||||
this->mFogStart = 0;
|
||||
|
|
|
@ -387,6 +387,7 @@ public:
|
|||
int EditPS(const char* pszName, int iSize, void* pbuf);
|
||||
int EntHier(const char *pszName, int iSize, void *pbuf);
|
||||
int Fog(const char* pszName, int iSize, void* pbuf);
|
||||
int SetUpgrades(const char* pszName, int iSize, void* pbuf);
|
||||
int ListPS(const char* pszName, int iSize, void* pbuf);
|
||||
int Particles(const char *pszName, int iSize, void *pbuf);
|
||||
int SoundNames(const char *pszName, int iSize, void *pbuf);
|
||||
|
@ -640,6 +641,10 @@ private:
|
|||
string mPreviousHelpText;
|
||||
float mTimeLastHelpTextChanged;
|
||||
|
||||
int mNumMovement;
|
||||
int mNumSensory;
|
||||
int mNumDefense;
|
||||
|
||||
int mSelectedNodeResourceCost;
|
||||
float mCurrentUseableEnergyLevel;
|
||||
float mVisualEnergyLevel;
|
||||
|
|
|
@ -3868,14 +3868,29 @@ void AvHHud::RenderAlienUI()
|
|||
int theSecondOfLastUpdate = (int)this->mTimeOfLastUpdate;
|
||||
if(theSecondOfLastUpdate % 2)
|
||||
{
|
||||
int theFrame = theCategory-1;
|
||||
int numSprites=1;
|
||||
switch ( theCategory ) {
|
||||
case ALIEN_UPGRADE_CATEGORY_DEFENSE:
|
||||
numSprites=this->mNumDefense;
|
||||
break;
|
||||
case ALIEN_UPGRADE_CATEGORY_SENSORY:
|
||||
numSprites=this->mNumSensory;
|
||||
break;
|
||||
case ALIEN_UPGRADE_CATEGORY_MOVEMENT:
|
||||
numSprites=this->mNumMovement;
|
||||
break;
|
||||
}
|
||||
for ( int j=0; j< numSprites; j++ ) {
|
||||
const float kOffset = .01f;
|
||||
int theFrame = theCategory-1;
|
||||
|
||||
float x1 = theX;
|
||||
float y1 = theY;
|
||||
float x2 = x1 + theUpgradeWidth;
|
||||
float y2 = y1 + theUpgradeHeight;
|
||||
float x1 = theX - j*(kOffset*ScreenWidth());
|
||||
float y1 = theY - j*(kOffset*ScreenHeight());
|
||||
float x2 = x1 + theUpgradeWidth;
|
||||
float y2 = y1 + theUpgradeHeight;
|
||||
|
||||
AvHSpriteDraw(mAlienUIUpgradeCategories, theFrame, x1, y1, x2, y2, 0, 0, 1, 1);
|
||||
AvHSpriteDraw(mAlienUIUpgradeCategories, theFrame, x1, y1, x2, y2, 0, 0, 1, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ int g_msgAmmoPickup = 0, g_msgAmmoX, g_msgBattery, g_msgCurWeapon, g_msgDamage,
|
|||
g_msgServerVar, g_msgSetGammaRamp, g_msgSetOrder, g_msgSetParticleTemplates,
|
||||
g_msgSetSelect, g_msgSetRequest, g_msgSetSoundNames, g_msgSetTechNodes, g_msgSetTechSlots,
|
||||
g_msgSetTopDown, g_msgSetupMap, g_msgUpdateCountdown, g_msgUpdateEntityHierarchy,
|
||||
g_msgProfileInfo, g_msgNexusBytes, g_msgIssueOrder;
|
||||
g_msgProfileInfo, g_msgNexusBytes, g_msgIssueOrder, g_msgHUDSetUpgrades;
|
||||
|
||||
void Net_InitializeMessages(void)
|
||||
{
|
||||
|
@ -74,6 +74,7 @@ void Net_InitializeMessages(void)
|
|||
g_msgGameStatus = REG_USER_MSG( "GameStatus", -1 );
|
||||
g_msgListPS = REG_USER_MSG( "ListPS", -1 );
|
||||
g_msgPlayHUDNotification = REG_USER_MSG( "PlayHUDNot", 6 );
|
||||
g_msgHUDSetUpgrades = REG_USER_MSG( "SetUpgrades", 1);
|
||||
g_msgProgressBar = REG_USER_MSG( "Progress", 3 );
|
||||
g_msgServerVar = REG_USER_MSG( "ServerVar", -1 );
|
||||
g_msgSetGammaRamp = REG_USER_MSG( "SetGmma", 2 );
|
||||
|
@ -1448,6 +1449,28 @@ union float_converter
|
|||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
#ifndef AVH_SERVER
|
||||
void NetMsg_HUDSetUpgrades( void* const buffer, const int size, int& upgradeMask )
|
||||
{
|
||||
BEGIN_READ( buffer, size );
|
||||
upgradeMask=READ_BYTE();
|
||||
END_READ();
|
||||
}
|
||||
#else
|
||||
void NetMsg_HUDSetUpgrades( int upgradeMask )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ALL, g_msgHUDSetUpgrades);
|
||||
WRITE_BYTE( upgradeMask );
|
||||
MESSAGE_END();
|
||||
}
|
||||
void NetMsg_HUDSetUpgrades( entvars_t* const pev, int upgradeMask )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, g_msgHUDSetUpgrades, NULL, pev );
|
||||
WRITE_BYTE( upgradeMask );
|
||||
MESSAGE_END();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef AVH_SERVER
|
||||
void NetMsg_PlayHUDNotification( void* const buffer, const int size, int& flags, int& sound, float& location_x, float& location_y )
|
||||
{
|
||||
|
|
|
@ -90,6 +90,8 @@
|
|||
void NetMsg_GameStatus_State( entvars_t* const pev, const int status_code, const int map_mode );
|
||||
void NetMsg_GameStatus_UnspentLevels( entvars_t* const pev, const int status_code, const int map_mode, const int unspent_levels );
|
||||
void NetMsg_ListPS( entvars_t* const pev, const string& system_name );
|
||||
void NetMsg_HUDSetUpgrades( int upgradeMask );
|
||||
void NetMsg_HUDSetUpgrades( entvars_t* const pev, int upgradeMask );
|
||||
void NetMsg_PlayHUDNotification( entvars_t* const pev, const int flags, const int sound, const float location_x, const float location_y );
|
||||
void NetMsg_ProgressBar( entvars_t* const pev, const int entity_number, const int progress );
|
||||
void NetMsg_ServerVar( entvars_t* const pev, const string& name, const string& value );
|
||||
|
@ -178,6 +180,7 @@
|
|||
void NetMsg_Fog( void* const buffer, const int size, bool& enabled, int& R, int& G, int& B, float& start, float& end );
|
||||
void NetMsg_GameStatus( void* const buffer, const int size, int& status_code, AvHMapMode& map_mode, int& game_time, int& timelimit, int& misc_data );
|
||||
void NetMsg_ListPS( void* const buffer, const int size, string& system_name );
|
||||
void NetMsg_HUDSetUpgrades( void* const buffer, const int size, int& upgradeMask );
|
||||
void NetMsg_PlayHUDNotification( void* const buffer, const int size, int& flags, int& sound, float& location_x, float& location_y );
|
||||
void NetMsg_ProgressBar( void* const buffer, const int size, int& entity_number, int& progress );
|
||||
//45
|
||||
|
|
Loading…
Reference in a new issue