diff options
| author | savander <savander.pl@gmail.com> | 2014-09-21 14:54:06 +0200 |
|---|---|---|
| committer | savander <savander.pl@gmail.com> | 2014-09-21 14:54:06 +0200 |
| commit | 684ae6c63e0f78ee9ab9b06926607225014bfc8f (patch) | |
| tree | b42407c38c7e03c516e8e77d7126ee95df70c3d4 /src/game/server | |
| parent | 836e03aaa5adb888387c34129b8c39a94dc359b3 (diff) | |
| download | zcatch-684ae6c63e0f78ee9ab9b06926607225014bfc8f.tar.gz zcatch-684ae6c63e0f78ee9ab9b06926607225014bfc8f.zip | |
Update
Diffstat (limited to 'src/game/server')
| -rw-r--r-- | src/game/server/entities/character.cpp | 5 | ||||
| -rw-r--r-- | src/game/server/entities/character.h | 3 | ||||
| -rw-r--r-- | src/game/server/gamecontext.cpp | 55 | ||||
| -rw-r--r-- | src/game/server/gamemodes/zcatch.cpp | 80 | ||||
| -rw-r--r-- | src/game/server/player.h | 2 |
5 files changed, 129 insertions, 16 deletions
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 2c1828da..b541f240 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -89,6 +89,8 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos) m_ActiveWeapon = WEAPON_GUN; m_LastWeapon = WEAPON_HAMMER; } + + pPlayer->m_RespawnProtection = Server()->Tick() + Server()->TickSpeed() * 2; /* end zCatch */ m_LastNoAmmoSound = -1; @@ -879,10 +881,11 @@ bool CCharacter::TakeDamage(vec2 Force, int Dmg, int From, int Weapon) /* zCatch */ if(From == m_pPlayer->GetCID() || Weapon == WEAPON_GAME) return false; - if(g_Config.m_SvMode == 4 && Weapon == WEAPON_GRENADE && Dmg < g_Config.m_SvGrenadeMinDamage) return false; + if(m_pPlayer->m_RespawnProtection > Server()->Tick() || GameServer()->m_apPlayers[From]->m_RespawnProtection > Server()->Tick()) + return false; m_Health = 0; m_Armor = 0; /* end zCatch */ diff --git a/src/game/server/entities/character.h b/src/game/server/entities/character.h index 0d68707a..240ee0e2 100644 --- a/src/game/server/entities/character.h +++ b/src/game/server/entities/character.h @@ -73,6 +73,8 @@ public: bool HasBeenThereRecently(vec2 v, const vec2 *&pos, int firstTick, int lastTick) const; bool AimedAtCharRecently(vec2 v, const CCharacter *c, const vec2 *&pos, const vec2 *&posVictim, int firstTick); float HowCloseToXRecently(vec2 x, const vec2 *&pos, int firstTick); + void SetEmoteType(int EmoteType) { m_EmoteType = EmoteType; }; + void SetEmoteStop(int EmoteStop) { m_EmoteStop = EmoteStop; }; private: // player controlling this character @@ -105,6 +107,7 @@ private: int m_EmoteType; int m_EmoteStop; + // last tick that the player took any action ie some input int m_LastAction; int m_LastNoAmmoSound; diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 52b5b9fd..27d17c11 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -526,6 +526,14 @@ void CGameContext::OnTick() } } } + + // info messages + // execute if interval is given and message interval is due, respecting the pause + if(Server()->GetInfoTextInterval() > 0 + && ((Server()->Tick() % Server()->GetInfoTextInterval()) - Server()->GetInfoTextIntervalPause()) % Server()->GetInfoTextMsgInterval() == 0) + { + SendChat(-1, CGameContext::CHAT_ALL, Server()->GetNextInfoText().c_str()); + } // bot detection // it is based on the behaviour of some bots to shoot at a player's _exact_ position @@ -940,20 +948,16 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) if(MuteValidation(pPlayer)) { // prepare message - const char *msgForm = "/PM/ %s", - *msgFormSender = "/PM -> %s / %s"; + const char *msgForm = "/PM -> %s / %s"; int len = 32 + MAX_NAME_LENGTH + str_length(msgStart); char *msg = (char*)malloc(len * sizeof(char)); CNetMsg_Sv_Chat M; M.m_Team = 0; M.m_ClientID = ClientID; - // send to sender - str_format(msg, len * sizeof(char), msgFormSender, Server()->ClientName(recipient), msgStart); + // send to sender and recipient + str_format(msg, len * sizeof(char), msgForm, Server()->ClientName(recipient), msgStart); M.m_pMessage = msg; Server()->SendPackMsg(&M, MSGFLAG_VITAL, ClientID); - // send to recipient - str_format(msg, len * sizeof(char), msgForm, msgStart); - M.m_pMessage = msg; Server()->SendPackMsg(&M, MSGFLAG_VITAL, recipient); // tidy up free(msg); @@ -1350,6 +1354,43 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) pPlayer->m_LastEmote = Server()->Tick(); SendEmoticon(ClientID, pMsg->m_Emoticon); + CCharacter* pChr = pPlayer->GetCharacter(); + if(pChr) + { + switch(pMsg->m_Emoticon) + { + case EMOTICON_EXCLAMATION: + case EMOTICON_GHOST: + case EMOTICON_QUESTION: + case EMOTICON_WTF: + pChr->SetEmoteType(EMOTE_SURPRISE); + break; + case EMOTICON_DOTDOT: + case EMOTICON_DROP: + case EMOTICON_ZZZ: + pChr->SetEmoteType(EMOTE_BLINK); + break; + case EMOTICON_EYES: + case EMOTICON_HEARTS: + case EMOTICON_MUSIC: + pChr->SetEmoteType(EMOTE_HAPPY); + break; + case EMOTICON_OOP: + case EMOTICON_SORRY: + case EMOTICON_SUSHI: + pChr->SetEmoteType(EMOTE_PAIN); + break; + case EMOTICON_DEVILTEE: + case EMOTICON_SPLATTEE: + case EMOTICON_ZOMG: + pChr->SetEmoteType(EMOTE_ANGRY); + break; + default: + pChr->SetEmoteType(EMOTE_NORMAL); + break; + } + pChr->SetEmoteStop(Server()->Tick() + 2 * Server()->TickSpeed()); + } } else if (MsgID == NETMSGTYPE_CL_KILL && !m_World.m_Paused) { diff --git a/src/game/server/gamemodes/zcatch.cpp b/src/game/server/gamemodes/zcatch.cpp index 63ed3dfb..cd36d12f 100644 --- a/src/game/server/gamemodes/zcatch.cpp +++ b/src/game/server/gamemodes/zcatch.cpp @@ -2,7 +2,7 @@ /* If you are missing that file, acquire a complete release at teeworlds.com. */ /* zCatch by erd and Teetime */ /* Modified by Teelevision for zCatch/TeeVi, see readme.txt and license.txt. */ - +#include <iostream> #include <engine/shared/config.h> #include <game/server/gamecontext.h> #include <game/server/gamecontroller.h> @@ -122,13 +122,77 @@ int CGameController_zCatch::OnCharacterDeath(class CCharacter *pVictim, class CP void CGameController_zCatch::OnPlayerInfoChange(class CPlayer *pP) { - if(g_Config.m_SvColorIndicator && pP->m_zCatchNumKillsInARow <= 20) - { - int Num = max(0, 160 - pP->m_zCatchNumKillsInARow * 10); - pP->m_TeeInfos.m_ColorBody = Num * 0x010000 + 0xff00; - pP->m_TeeInfos.m_ColorFeet = pP->m_zCatchNumKillsInARow == 20 ? 0x40ff00 : pP->m_TeeInfos.m_ColorBody; - pP->m_TeeInfos.m_UseCustomColor = 1; - } + if(g_Config.m_SvColorIndicator) + { + switch(pP->m_zCatchNumKillsInARow){ + case 0: + pP->m_TeeInfos.m_ColorBody = 0xFFBB00; + pP->m_TeeInfos.m_ColorFeet = 0x11FF00; + break; + case 15: + pP->m_TeeInfos.m_ColorBody = 0xEEFF00; + break; + case 14: + pP->m_TeeInfos.m_ColorBody = 0xDDFF00; + break; + case 13: + pP->m_TeeInfos.m_ColorBody = 0xCCFF00; + break; + case 12: + pP->m_TeeInfos.m_ColorBody = 0xBBFF00; + break; + case 11: + pP->m_TeeInfos.m_ColorBody = 0xAAFF00; + break; + case 10: + pP->m_TeeInfos.m_ColorBody = 0x99FF00; + break; + case 9: + pP->m_TeeInfos.m_ColorBody = 0x88FF00; + break; + case 8: + pP->m_TeeInfos.m_ColorBody = 0x77FF00; + break; + case 7: + pP->m_TeeInfos.m_ColorBody = 0x66FF00; + break; + case 6: + pP->m_TeeInfos.m_ColorBody = 0x55FF00; + break; + case 5: + pP->m_TeeInfos.m_ColorBody = 0x44FF00; + break; + case 4: + pP->m_TeeInfos.m_ColorBody = 0x33FF00; + break; + case 3: + pP->m_TeeInfos.m_ColorBody = 0x22FF00; + break; + case 2: + pP->m_TeeInfos.m_ColorBody = 0x11FF00; + break; + case 1: + pP->m_TeeInfos.m_ColorBody = 0x00FF00; + break; + default: + pP->m_TeeInfos.m_ColorBody = 0x000000; + break; + } + pP->m_TeeInfos.m_ColorFeet = 0x11FF00 + pP->m_TeeInfos.m_ColorFeet; + pP->m_TeeInfos.m_UseCustomColor = 1; + } +// if(g_Config.m_SvColorIndicator){ +// if(pP->m_zCatchNumKillsInARow > 1 || pP->m_zCatchNumKillsInARow < 16) +// { +// pP->m_TeeInfos.m_ColorBody = 0x11FF00 + pP->m_TeeInfos.m_ColorBody; +// } +// else +// { +// pP->m_TeeInfos.m_ColorBody = 0x11FF00; +// } +// pP->m_TeeInfos.m_ColorFeet = pP->m_TeeInfos.m_ColorBody; +// pP->m_TeeInfos.m_UseCustomColor = 1; +// } } void CGameController_zCatch::StartRound() diff --git a/src/game/server/player.h b/src/game/server/player.h index 97fb299c..7189d7e2 100644 --- a/src/game/server/player.h +++ b/src/game/server/player.h @@ -113,6 +113,8 @@ public: int m_CampTick; vec2 m_CampPos; + int m_RespawnProtection; + // zCatch/TeeVi enum { |