Thread: [Opentnl-cvs] tnl/zap CTFGame.cpp,1.6,1.7 CTFGame.h,1.3,1.4 masterConnection.cpp,1.2,1.3
Brought to you by:
mark_frohnmayer,
s_alanet
From: Ben G. <s_a...@us...> - 2004-04-22 02:59:25
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7446/zap Modified Files: CTFGame.cpp CTFGame.h masterConnection.cpp Log Message: Updated game name to ZAP1.1 for sanity's sake. Updated scoring. Merged changes with Mark's fix to gameplay. Index: masterConnection.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/masterConnection.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** masterConnection.cpp 20 Apr 2004 23:37:26 -0000 1.2 --- masterConnection.cpp 22 Apr 2004 02:57:51 -0000 1.3 *************** *** 182,186 **** Parent::writeConnectRequest(bstream); ! bstream->writeString("ZAP"); // Game Name if(bstream->writeFlag(mIsGameServer)) { --- 182,186 ---- Parent::writeConnectRequest(bstream); ! bstream->writeString("ZAP1.1"); // Game Name if(bstream->writeFlag(mIsGameServer)) { Index: CTFGame.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/CTFGame.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CTFGame.h 22 Apr 2004 00:35:43 -0000 1.3 --- CTFGame.h 22 Apr 2004 02:57:51 -0000 1.4 *************** *** 39,42 **** --- 39,50 ---- class CTFGameType : public GameType { + enum Scores + { + KillScore = 100, + ReturnScore = 150, + CapScore = 500, + CapTeamScore = 250, + + }; public: void shipTouchFlag(Ship *theShip, CTFFlagItem *theFlag); *************** *** 52,56 **** static Vector<RangedU32<0, MaxPing> > mPingTimes; ///< Static vector used for constructing update RPCs ! static Vector<Int<9> > mScores; enum { --- 60,64 ---- static Vector<RangedU32<0, MaxPing> > mPingTimes; ///< Static vector used for constructing update RPCs ! static Vector<Int<24> > mScores; enum { *************** *** 63,67 **** TNL_DECLARE_RPC(s2cCTFMessage, (U32 messageIndex, U32 clientId, U32 teamIndex)); TNL_DECLARE_RPC(s2cKillMessage, (StringTableEntry victim, StringTableEntry killer)); ! TNL_DECLARE_RPC(s2cScoreboardUpdate, (const Vector<RangedU32<0, MaxPing> > &pingTimes, const Vector<Int<9> > &scores)); TNL_DECLARE_CLASS(CTFGameType); }; --- 71,75 ---- TNL_DECLARE_RPC(s2cCTFMessage, (U32 messageIndex, U32 clientId, U32 teamIndex)); TNL_DECLARE_RPC(s2cKillMessage, (StringTableEntry victim, StringTableEntry killer)); ! TNL_DECLARE_RPC(s2cScoreboardUpdate, (const Vector<RangedU32<0, MaxPing> > &pingTimes, const Vector<Int<24> > &scores)); TNL_DECLARE_CLASS(CTFGameType); }; Index: CTFGame.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/CTFGame.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CTFGame.cpp 22 Apr 2004 02:07:55 -0000 1.6 --- CTFGame.cpp 22 Apr 2004 02:57:51 -0000 1.7 *************** *** 31,34 **** --- 31,35 ---- #include "glutInclude.h" + #include <stdio.h> namespace Zap *************** *** 115,118 **** --- 116,120 ---- UserInterface::drawString(xl + 40, yt + 2, 30, mTeams[i].name.getString()); + UserInterface::drawStringf(xr - 140, yt + 2, 30, "%d", mTeams[i].score); *************** *** 124,128 **** { UserInterface::drawString(xl + 40, curRowY, fontSize, mClientList[j].name.getString()); ! UserInterface::drawStringf(xr - 140, curRowY, fontSize, "%d", mClientList[j].score); UserInterface::drawStringf(xr - 70, curRowY, fontSize, "%d", mClientList[j].ping); curRowY += maxHeight; --- 126,134 ---- { UserInterface::drawString(xl + 40, curRowY, fontSize, mClientList[j].name.getString()); ! ! static char buff[255] = ""; ! sprintf(buff, "%d", mClientList[j].score); ! ! UserInterface::drawString(xr - (120 + UserInterface::getStringWidth(fontSize, buff)), curRowY, fontSize, buff); UserInterface::drawStringf(xr - 70, curRowY, fontSize, "%d", mClientList[j].ping); curRowY += maxHeight; *************** *** 144,148 **** Vector<RangedU32<0, CTFGameType::MaxPing> > CTFGameType::mPingTimes; ///< Static vector used for constructing update RPCs ! Vector<Int<9> > CTFGameType::mScores; void CTFGameType::updateClientScoreboard(S32 clientIndex) --- 150,154 ---- Vector<RangedU32<0, CTFGameType::MaxPing> > CTFGameType::mPingTimes; ///< Static vector used for constructing update RPCs ! Vector<Int<24> > CTFGameType::mScores; void CTFGameType::updateClientScoreboard(S32 clientIndex) *************** *** 167,171 **** TNL_DECLARE_RPC_MEM_ENUM(CTFGameType, MaxPing); ! TNL_IMPLEMENT_NETOBJECT_RPC(CTFGameType, s2cScoreboardUpdate, (const Vector<RangedU32<0, CTFGameType::MaxPing> > &pingTimes, const Vector<Int<9> > &scores), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { --- 173,177 ---- TNL_DECLARE_RPC_MEM_ENUM(CTFGameType, MaxPing); ! TNL_IMPLEMENT_NETOBJECT_RPC(CTFGameType, s2cScoreboardUpdate, (const Vector<RangedU32<0, CTFGameType::MaxPing> > &pingTimes, const Vector<Int<24> > &scores), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { *************** *** 196,200 **** s2cCTFMessage(CTFMsgReturnFlag, cl.clientId, theFlag->getTeamIndex()); theFlag->sendHome(); ! cl.score += 2; } else --- 202,206 ---- s2cCTFMessage(CTFMsgReturnFlag, cl.clientId, theFlag->getTeamIndex()); theFlag->sendHome(); ! cl.score += Scores::ReturnScore; } else *************** *** 213,217 **** mountedFlag->dismount(); mountedFlag->sendHome(); ! cl.score += 5; } } --- 219,223 ---- mountedFlag->dismount(); mountedFlag->sendHome(); ! cl.score += Scores::CapScore; } } *************** *** 265,269 **** if(killerIndex != -1) { ! mClientList[killerIndex].score++; s2cKillMessage(mClientList[clientIndex].name, mClientList[killerIndex].name); } --- 271,280 ---- if(killerIndex != -1) { ! // Punish team killers slightly ! if(mClientList[killerIndex].teamId == mClientList[clientIndex].teamId) ! mClientList[killerIndex].score -= Scores::KillScore/4; ! else ! mClientList[killerIndex].score += Scores::KillScore; ! s2cKillMessage(mClientList[clientIndex].name, mClientList[killerIndex].name); } |