Mantis 0001016:

o End game notifications now display in the center of the screen for 10 seconds + 2 seconds fadeout. The text has been reworked to "The TSA Marines have exterminated the alien infestation" and "The alien Kharaa have eradicated the human presence".

I did some changes to AvHPlayer::SendMessage to allow a message to be sent either as a tooltip or a centered message.

git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@157 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
tankefugl 2005-06-01 20:50:02 +00:00
parent 86d4f4b184
commit dcf57ac40e
15 changed files with 105 additions and 39 deletions

View file

@ -686,10 +686,18 @@ int CHudMessage::MsgFunc_HudText2( const char *pszName, int iSize, void *pbuf )
string content; string content;
int flags; int flags;
NetMsg_HudText2( pbuf, iSize, content, flags ); NetMsg_HudText2( pbuf, iSize, content, flags );
bool theIsAutoHelp = (flags & 1) != 0;
gHUD.AddTooltip(content.c_str(), theIsAutoHelp);
switch (flags)
{
case 2:
gHUD.SetCenterText(content.c_str());
break;
default:
bool theIsAutoHelp = (flags & 1) != 0;
gHUD.AddTooltip(content.c_str(), theIsAutoHelp);
break;
}
return 2; return 2;
} }

View file

@ -986,12 +986,12 @@ void UTIL_ShowMessage( const char *pString, CBaseEntity *pEntity)
NetMsg_HudText( pEntity->pev, string( pString ) ); NetMsg_HudText( pEntity->pev, string( pString ) );
} }
void UTIL_ShowMessage2( const char *pString, CBaseEntity *pEntity, bool inIsAutoHelp) void UTIL_ShowMessage2( const char *pString, CBaseEntity *pEntity, SHOWMESSAGE_TYPE type)
{ {
if ( !pEntity || !pEntity->IsNetClient() ) if ( !pEntity || !pEntity->IsNetClient() )
return; return;
NetMsg_HudText2( pEntity->pev, string( pString ), inIsAutoHelp ? 1 : 0 ); NetMsg_HudText2( pEntity->pev, string( pString ), type );
} }

View file

@ -265,7 +265,8 @@ extern void UTIL_ParticleEffect ( const Vector &vecOrigin, const Vector &vecD
extern void UTIL_ScreenShake ( const Vector &center, float amplitude, float frequency, float duration, float radius ); extern void UTIL_ScreenShake ( const Vector &center, float amplitude, float frequency, float duration, float radius );
extern void UTIL_ScreenShakeAll ( const Vector &center, float amplitude, float frequency, float duration ); extern void UTIL_ScreenShakeAll ( const Vector &center, float amplitude, float frequency, float duration );
extern void UTIL_ShowMessage ( const char *pString, CBaseEntity *pPlayer); extern void UTIL_ShowMessage ( const char *pString, CBaseEntity *pPlayer);
extern void UTIL_ShowMessage2 ( const char *pString, CBaseEntity *pPlayer, bool inIsToolTip = false); typedef enum { NORMAL = 0, TOOLTIP = 1, CENTER = 2} SHOWMESSAGE_TYPE;
extern void UTIL_ShowMessage2 ( const char *pString, CBaseEntity *pPlayer, SHOWMESSAGE_TYPE type = NORMAL);
extern void UTIL_ShowMessageAll ( const char *pString ); extern void UTIL_ShowMessageAll ( const char *pString );
extern void UTIL_ScreenFadeAll ( const Vector &color, float fadeTime, float holdTime, int alpha, int flags ); extern void UTIL_ScreenFadeAll ( const Vector &color, float fadeTime, float holdTime, int alpha, int flags );
extern void UTIL_ScreenFade ( CBaseEntity *pEntity, const Vector &color, float fadeTime, float fadeHold, int alpha, int flags ); extern void UTIL_ScreenFade ( CBaseEntity *pEntity, const Vector &color, float fadeTime, float fadeHold, int alpha, int flags );

View file

@ -566,7 +566,7 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
{ {
bool theIsToolTip = (theMode == 2); bool theIsToolTip = (theMode == 2);
theAvHPlayer->SendMessage(theTooltipText, theIsToolTip); theAvHPlayer->SendMessage(theTooltipText, (theIsToolTip)?TOOLTIP:NORMAL);
} }
theSuccess = true; theSuccess = true;
@ -614,7 +614,7 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
//} //}
} }
theTargetPlayer->SendMessage(theToolTip.c_str(), true); theTargetPlayer->SendMessage(theToolTip.c_str(), TOOLTIP);
theSuccess = true; theSuccess = true;
} }
else else
@ -889,12 +889,12 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
uint32 theParticleIndex; uint32 theParticleIndex;
if(gParticleTemplateList.GetTemplateIndexWithName(theName, theParticleIndex)) if(gParticleTemplateList.GetTemplateIndexWithName(theName, theParticleIndex))
{ {
theAvHPlayer->SendMessage(kEditingParticleSystem, true); theAvHPlayer->SendMessage(kEditingParticleSystem, TOOLTIP);
NetMsg_EditPS( theAvHPlayer->pev, theParticleIndex ); NetMsg_EditPS( theAvHPlayer->pev, theParticleIndex );
} }
else else
{ {
theAvHPlayer->SendMessage(kNoParticleSystem, true); theAvHPlayer->SendMessage(kNoParticleSystem, TOOLTIP);
} }
theSuccess = true; theSuccess = true;
} }
@ -1419,7 +1419,7 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
} }
else else
{ {
theAvHPlayer->SendMessage(kSpectatorsNotAllowed, true); theAvHPlayer->SendMessage(kSpectatorsNotAllowed, TOOLTIP);
} }
theSuccess = true; theSuccess = true;
} }

View file

@ -458,11 +458,11 @@ void AvHGamerules::RewardPlayerForKill(AvHPlayer* inPlayer, CBaseEntity* inTarge
AvHClassType theClassType = inPlayer->GetClassType(); AvHClassType theClassType = inPlayer->GetClassType();
if(theClassType == AVH_CLASS_TYPE_MARINE) if(theClassType == AVH_CLASS_TYPE_MARINE)
{ {
inPlayer->SendMessageOnce(kMarinePointsAwarded, true); inPlayer->SendMessageOnce(kMarinePointsAwarded, TOOLTIP);
} }
else if(theClassType == AVH_CLASS_TYPE_ALIEN) else if(theClassType == AVH_CLASS_TYPE_ALIEN)
{ {
inPlayer->SendMessageOnce(kAlienPointsAwarded, true); inPlayer->SendMessageOnce(kAlienPointsAwarded, TOOLTIP);
} }
// Increment resource score in tourny mode // Increment resource score in tourny mode
@ -3504,7 +3504,7 @@ void AvHGamerules::UpdateCountdown(float inTime)
} }
FOR_ALL_ENTITIES(kAvHPlayerClassName, AvHPlayer*) FOR_ALL_ENTITIES(kAvHPlayerClassName, AvHPlayer*)
theEntity->SendMessageOnce(theMessage, true); theEntity->SendMessageOnce(theMessage, TOOLTIP);
END_FOR_ALL_ENTITIES(kAvHPlayerClassName) END_FOR_ALL_ENTITIES(kAvHPlayerClassName)
this->mTimeLastWontStartMessageSent = inTime; this->mTimeLastWontStartMessageSent = inTime;
@ -3808,7 +3808,7 @@ void AvHGamerules::UpdateVictoryStatus(void)
UTIL_ScreenFade(theEntity, theFadeColor, 1.0f, 0.0f, 255, FFADE_OUT | FFADE_STAYOUT); UTIL_ScreenFade(theEntity, theFadeColor, 1.0f, 0.0f, 255, FFADE_OUT | FFADE_STAYOUT);
} }
theEntity->PlayHUDSound(theHUDSound); theEntity->PlayHUDSound(theHUDSound);
theEntity->SendMessage(theVictoryMessage); theEntity->SendMessage(theVictoryMessage, CENTER);
// Final game time update to all clients have same winning time // Final game time update to all clients have same winning time
this->SendGameTimeUpdate(true); this->SendGameTimeUpdate(true);

View file

@ -2029,6 +2029,21 @@ void AvHHud::ModifyAmbientSoundEntryIfChanged(bool inSoundOn, int inSoundIndex,
} }
} }
// tankefugl:
void AvHHud::SetCenterText(const char* inText)
{
LocalizeString(inText, this->mCenterText);
this->mCenterTextTime = this->mTimeOfLastUpdate;
}
void AvHHud::ClearCenterText()
{
this->mCenterText.clear();
this->mCenterTextTime = -1;
}
// :tankefugl
// Look at incoming order. If we are one of the receivers, play a HUD sound // Look at incoming order. If we are one of the receivers, play a HUD sound
// indicating our new order // indicating our new order
void AvHHud::OrderNotification(const AvHOrder& inOrder) void AvHHud::OrderNotification(const AvHOrder& inOrder)
@ -2547,6 +2562,9 @@ void AvHHud::ResetGame(bool inMapChanged)
this->mDisplayOrderText1 = ""; this->mDisplayOrderText1 = "";
this->mDisplayOrderText2 = ""; this->mDisplayOrderText2 = "";
this->mDisplayOrderText3 = ""; this->mDisplayOrderText3 = "";
this->mCenterText.clear();
this->mCenterTextTime = -1;
// :tankefugl // :tankefugl
} }

View file

@ -433,8 +433,19 @@ public:
float GetServerVariableFloat(const char* inName) const; float GetServerVariableFloat(const char* inName) const;
// tankefugl:
void SetCenterText(const char* inText);
void DrawCenterText();
void ClearCenterText();
// :tankefugl
private: private:
// tankefugl:
std::string mCenterText;
float mCenterTextTime;
// :tankefugl
bool GetCommanderLabelText(std::string& outCommanderName) const; bool GetCommanderLabelText(std::string& outCommanderName) const;
void AddCommands(); void AddCommands();

View file

@ -1107,6 +1107,33 @@ void AvHHud::DrawOrderText(const AvHOrder& inOrder)
// :tankefugl // :tankefugl
} }
// tankefugl:
#define CENTER_TEXT_LENGTH 10
#define CENTER_TEXT_FADEOUT 2
void AvHHud::DrawCenterText()
{
if ((this->mCenterTextTime > -1) && (this->mTimeOfLastUpdate < this->mCenterTextTime + CENTER_TEXT_LENGTH + CENTER_TEXT_FADEOUT))
{
int theR, theG, theB;
this->GetPrimaryHudColor(theR, theG, theB, false, false);
if (this->mTimeOfLastUpdate > this->mCenterTextTime + CENTER_TEXT_LENGTH)
{
float fraction = this->mTimeOfLastUpdate - (this->mCenterTextTime + CENTER_TEXT_LENGTH);
fraction = 1 - fraction / CENTER_TEXT_FADEOUT;
theR *= fraction;
theG *= fraction;
theB *= fraction;
}
int posX = 0.5 * ScreenWidth() - this->mFont.GetStringWidth(this->mCenterText.c_str()) / 2;
int posY = 0.4 * ScreenHeight();
this->mFont.DrawString(posX, posY, this->mCenterText.c_str(), theR, theG, theB);
}
}
// :tankefugl
// tankefugl: 0000992 // tankefugl: 0000992
void AvHHud::SetDisplayOrder(int inOrderType, int inOrderIndex, string inText1, string inText2, string inText3) void AvHHud::SetDisplayOrder(int inOrderType, int inOrderIndex, string inText1, string inText2, string inText3)
{ {
@ -2639,6 +2666,7 @@ void AvHHud::Render()
this->DrawReticleInfo(); this->DrawReticleInfo();
this->DrawPlayerNames(); this->DrawPlayerNames();
this->DrawToolTips(); this->DrawToolTips();
this->DrawCenterText();
} }
} }

View file

@ -1919,7 +1919,7 @@ void AvHCommandStation::CommandTouch(CBaseEntity* pOther)
// Check to see if we already have a commander and don't make the person a commander if so // Check to see if we already have a commander and don't make the person a commander if so
if(GetGameRules()->GetNumCommandersOnTeam(theStationTeamNumber) == 0) if(GetGameRules()->GetNumCommandersOnTeam(theStationTeamNumber) == 0)
{ {
thePlayer->SendMessage(kHelpTextCSAttractMode, true); thePlayer->SendMessage(kHelpTextCSAttractMode, TOOLTIP);
} }
} }
} }
@ -1967,7 +1967,7 @@ void AvHCommandStation::CommandUse( CBaseEntity* pActivator, CBaseEntity* pCalle
} }
else else
{ {
thePlayer->SendMessage(kCommandStationDestroyed, true); thePlayer->SendMessage(kCommandStationDestroyed, TOOLTIP);
} }
} }
else else
@ -1980,13 +1980,13 @@ void AvHCommandStation::CommandUse( CBaseEntity* pActivator, CBaseEntity* pCalle
// The player somehow touches the command station while still a commander // The player somehow touches the command station while still a commander
if(thePlayer->GetUser3() != AVH_USER3_COMMANDER_PLAYER) if(thePlayer->GetUser3() != AVH_USER3_COMMANDER_PLAYER)
{ {
thePlayer->SendMessage(kCommandStationInUse, true); thePlayer->SendMessage(kCommandStationInUse, TOOLTIP);
} }
} }
} }
else else
{ {
thePlayer->SendMessage(kCommandStationForOtherTeam, true); thePlayer->SendMessage(kCommandStationForOtherTeam, TOOLTIP);
} }
} }
} }

View file

@ -1224,7 +1224,7 @@ bool AvHPlayer::ExecuteMessage(AvHMessageID inMessageID, bool inInstantaneous, b
break; break;
case WEAPON_DROP: case WEAPON_DROP:
if(!this->DropItem()) if(!this->DropItem())
this->SendMessageOnce(kWeaponCantBeDropped, true); this->SendMessageOnce(kWeaponCantBeDropped, TOOLTIP);
break; break;
case ADMIN_VOTEDOWNCOMMANDER: case ADMIN_VOTEDOWNCOMMANDER:
@ -3240,7 +3240,7 @@ void AvHPlayer::ItemPostFrame(void)
{ {
if((this->pev->button & IN_ATTACK) || (this->pev->button & IN_ATTACK2) || (this->pev->button & IN_RELOAD)) if((this->pev->button & IN_ATTACK) || (this->pev->button & IN_ATTACK2) || (this->pev->button & IN_RELOAD))
{ {
this->SendMessageOnce(kReadyRoomMessage, true); this->SendMessageOnce(kReadyRoomMessage, TOOLTIP);
} }
} }
@ -4167,7 +4167,7 @@ void AvHPlayer::HandleTopDownInput()
if(!this->GiveOrderToSelection(ORDERTYPEL_DEFAULT, this->mAttackTwoPressedWorldPos)) if(!this->GiveOrderToSelection(ORDERTYPEL_DEFAULT, this->mAttackTwoPressedWorldPos))
{ {
// This location better be off the map or something, default orders should nearly always go through // This location better be off the map or something, default orders should nearly always go through
this->SendMessage(kInvalidOrderGiven, true); this->SendMessage(kInvalidOrderGiven, TOOLTIP);
} }
else else
{ {
@ -6802,7 +6802,7 @@ void AvHPlayer::PreThink( void )
PROFILE_START() PROFILE_START()
if(this->mQueuedThinkMessage != "") if(this->mQueuedThinkMessage != "")
{ {
this->SendMessage(this->mQueuedThinkMessage.c_str(), true); this->SendMessage(this->mQueuedThinkMessage.c_str(), TOOLTIP);
this->mQueuedThinkMessage = ""; this->mQueuedThinkMessage = "";
} }
if(this->mPendingCommand) if(this->mPendingCommand)
@ -7238,7 +7238,7 @@ void AvHPlayer::SetViewForUser3()
} }
bool AvHPlayer::SendMessage(const char *pMessage, bool inIsToolTip) bool AvHPlayer::SendMessage(const char *pMessage, SHOWMESSAGE_TYPE type)
{ {
bool theSuccess = false; bool theSuccess = false;
@ -7248,7 +7248,7 @@ bool AvHPlayer::SendMessage(const char *pMessage, bool inIsToolTip)
string theMessage(pMessage); string theMessage(pMessage);
if(theMessage != this->mLastMessageSent) if(theMessage != this->mLastMessageSent)
{ {
UTIL_ShowMessage2(pMessage, this, inIsToolTip); UTIL_ShowMessage2(pMessage, this, type);
this->mLastMessageSent = theMessage; this->mLastMessageSent = theMessage;
@ -7270,7 +7270,7 @@ bool AvHPlayer::SendMessage(const char *pMessage, bool inIsToolTip)
return theSuccess; return theSuccess;
} }
bool AvHPlayer::SendMessageOnce(const char *pMessage, bool inIsToolTip) bool AvHPlayer::SendMessageOnce(const char *pMessage, SHOWMESSAGE_TYPE type)
{ {
bool theSentMessage = false; bool theSentMessage = false;
@ -7282,7 +7282,7 @@ bool AvHPlayer::SendMessageOnce(const char *pMessage, bool inIsToolTip)
{ {
// If not // If not
// Call SendMessage // Call SendMessage
theSentMessage = this->SendMessage(pMessage, inIsToolTip); theSentMessage = this->SendMessage(pMessage, type);
this->mLastMessageSent = theMessage; this->mLastMessageSent = theMessage;
@ -7544,7 +7544,7 @@ void AvHPlayer::SetPlayMode(AvHPlayMode inPlayMode, bool inForceSpawn)
this->StartObservingIfNotAlready(); this->StartObservingIfNotAlready();
this->SendMessage(kReinforcingMessage, true); this->SendMessage(kReinforcingMessage, TOOLTIP);
this->mHasLeftReadyRoom = true; this->mHasLeftReadyRoom = true;
break; break;
@ -7574,7 +7574,7 @@ void AvHPlayer::SetPlayMode(AvHPlayMode inPlayMode, bool inForceSpawn)
case PLAYMODE_REINFORCINGCOMPLETE: case PLAYMODE_REINFORCINGCOMPLETE:
this->pev->playerclass = PLAYMODE_REINFORCINGCOMPLETE; this->pev->playerclass = PLAYMODE_REINFORCINGCOMPLETE;
this->SendMessage(kReinforcementComplete, false); this->SendMessage(kReinforcementComplete, NORMAL);
break; break;
} }
@ -7827,7 +7827,7 @@ void AvHPlayer::SetUser3(AvHUser3 inUser3, bool inForceChange, bool inGiveWeapon
if(theMessage != "") if(theMessage != "")
{ {
// Send instructions to player // Send instructions to player
this->SendMessageOnce(theMessage.c_str(), true); this->SendMessageOnce(theMessage.c_str(), TOOLTIP);
} }
this->LogEmitRoleChange(); this->LogEmitRoleChange();
} }

View file

@ -428,8 +428,8 @@ public:
void SetResources(float inResources, bool inPlaySound = false); void SetResources(float inResources, bool inPlaySound = false);
// Send messages to player's screen // Send messages to player's screen
bool SendMessage(const char* pMessage, bool inIsToolTip = false); bool SendMessage(const char* pMessage, SHOWMESSAGE_TYPE type = NORMAL);
bool SendMessageOnce(const char* pMessage, bool inIsToolTip = false); bool SendMessageOnce(const char* pMessage, SHOWMESSAGE_TYPE type = NORMAL);
bool SendMessageNextThink(const char* pMessage); bool SendMessageNextThink(const char* pMessage);
virtual int GetEffectivePlayerClass(); virtual int GetEffectivePlayerClass();

View file

@ -430,7 +430,7 @@ static int sendMessage(lua_State* inState)
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theEntity); AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theEntity);
if(thePlayer) if(thePlayer)
{ {
thePlayer->SendMessage(theCString, true); thePlayer->SendMessage(theCString, TOOLTIP);
theSuccess = true; theSuccess = true;
} }
} }

View file

@ -1059,7 +1059,7 @@ void AvHTeam::SetGameStarted(bool inGameStarted)
theMessage = kYouAreDefending; theMessage = kYouAreDefending;
} }
theEntity->SendMessage(theMessage.c_str(), false); theEntity->SendMessage(theMessage.c_str(), NORMAL);
} }
} }
END_FOR_ALL_ENTITIES(kAvHPlayerClassName); END_FOR_ALL_ENTITIES(kAvHPlayerClassName);

View file

@ -133,13 +133,13 @@ bool AvHWebProjectile::CreateWeb()
else else
{ {
// Send player message indicating they've reached the limit for this particular area // Send player message indicating they've reached the limit for this particular area
thePlayer->SendMessage(kTooManyWebsNearby, true); thePlayer->SendMessage(kTooManyWebsNearby, TOOLTIP);
} }
} }
else else
{ {
// Send player message indicating they've reached the limit // Send player message indicating they've reached the limit
thePlayer->SendMessage(kTooManyWebs, true); thePlayer->SendMessage(kTooManyWebs, TOOLTIP);
} }
} }
} }

View file

@ -1576,12 +1576,12 @@ There are too many webs nearby.
TeamOneWon TeamOneWon
{ {
The marines won the game! The TSA Marines have exterminated the alien infestation
} }
TeamTwoWon TeamTwoWon
{ {
The aliens won the game! The alien Kharaa have eradicated the human presence
} }
GameDraw GameDraw