Thread: [Opentnl-cvs] tnl/zap CTFGame.cpp,1.8,1.9 CTFGame.h,1.4,1.5 UIMenus.cpp,1.3,1.4 ZAP.vcproj,1.2,1.3 b
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <mar...@us...> - 2004-04-23 01:49:56
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21514/zap Modified Files: CTFGame.cpp CTFGame.h UIMenus.cpp ZAP.vcproj barrier.cpp gameConnection.cpp gameConnection.h gameObject.cpp gameObject.h gameType.cpp gameType.h item.cpp item.h main.cpp masterConnection.cpp projectile.cpp projectile.h ship.cpp ship.h Log Message: Added health packs Removed some unecessary state transmissions Added better priority function Made barriers scope always Increased the default size of the connection string table to 1k strings Added pickup items Added repair item CTFGame no longer allows team damge Index: main.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/main.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** main.cpp 21 Apr 2004 23:47:34 -0000 1.7 --- main.cpp 23 Apr 2004 01:49:46 -0000 1.8 *************** *** 50,54 **** const char *gHostName = "ZAP Game"; U32 gMaxPlayers = 128; ! const char *gMasterAddressString = "IP:master.opentnl.org:29002"; Address gMasterAddress; const char *gLoadLevel = "level1.txt"; --- 50,54 ---- const char *gHostName = "ZAP Game"; U32 gMaxPlayers = 128; ! const char *gMasterAddressString = "IP:master.opentnl.org:29005"; Address gMasterAddress; const char *gLoadLevel = "level1.txt"; Index: gameType.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameType.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gameType.cpp 22 Apr 2004 02:50:53 -0000 1.8 --- gameType.cpp 23 Apr 2004 01:49:46 -0000 1.9 *************** *** 108,115 **** } ! S32 GameType::findClientIndexById(U32 clientId) { for(S32 clientIndex = 0; clientIndex < mClientList.size(); clientIndex++) ! if(mClientList[clientIndex].clientId == clientId) return clientIndex; return -1; --- 108,115 ---- } ! S32 GameType::findClientIndexByName(const StringTableEntry &name) { for(S32 clientIndex = 0; clientIndex < mClientList.size(); clientIndex++) ! if(mClientList[clientIndex].name == name) return clientIndex; return -1; *************** *** 125,129 **** spawnPoint = mTeams[teamIndex].spawnPoints[spawnIndex]; ! Ship *newShip = new Ship(mClientList[clientIndex].name, spawnPoint, mTeams[teamIndex].color); newShip->addToGame(getGame()); theClient->setControlObject(newShip); --- 125,129 ---- spawnPoint = mTeams[teamIndex].spawnPoints[spawnIndex]; ! Ship *newShip = new Ship(mClientList[clientIndex].name, spawnPoint); newShip->addToGame(getGame()); theClient->setControlObject(newShip); *************** *** 142,146 **** { ClientRef cref; - cref.clientId = theClient->mClientId; cref.name = theClient->playerName; --- 142,145 ---- *************** *** 165,170 **** mClientList.push_back(cref); ! s2cAddClient(cref.clientId, cref.name, false); ! s2cClientJoinedTeam(cref.clientId, cref.teamId); spawnShip(theClient); } --- 164,169 ---- mClientList.push_back(cref); ! s2cAddClient(cref.name, false); ! s2cClientJoinedTeam(cref.name, cref.teamId); spawnShip(theClient); } *************** *** 209,221 **** U32 newTeamId = (mClientList[clientIndex].teamId + 1) % mTeams.size(); mClientList[clientIndex].teamId = newTeamId; ! s2cClientJoinedTeam(mClientList[clientIndex].clientId, newTeamId); spawnShip(source); } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddClient, (U32 id, StringTableEntry name, bool isMyClient), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { ClientRef cref; - cref.clientId = id; cref.name = name; cref.teamId = 0; --- 208,219 ---- U32 newTeamId = (mClientList[clientIndex].teamId + 1) % mTeams.size(); mClientList[clientIndex].teamId = newTeamId; ! s2cClientJoinedTeam(mClientList[clientIndex].name, newTeamId); spawnShip(source); } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddClient, (StringTableEntry name, bool isMyClient), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { ClientRef cref; cref.name = name; cref.teamId = 0; *************** *** 225,229 **** if(isMyClient) ! mThisClientId = id; gGameUserInterface.displayMessage(Color(0.6f, 0.6f, 0.8f), "%s joined the game.", name.getString()); } --- 223,227 ---- if(isMyClient) ! mThisClientName = name; gGameUserInterface.displayMessage(Color(0.6f, 0.6f, 0.8f), "%s joined the game.", name.getString()); } *************** *** 239,249 **** getGame()->deleteObject(theControlObject, 0); ! s2cRemoveClient(theClient->mClientId); } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cRemoveClient, (U32 id), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { ! S32 clientIndex = findClientIndexById(id); mClientList.erase(clientIndex); } --- 237,247 ---- getGame()->deleteObject(theControlObject, 0); ! s2cRemoveClient(theClient->playerName); } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cRemoveClient, (StringTableEntry name), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { ! S32 clientIndex = findClientIndexByName(name); mClientList.erase(clientIndex); } *************** *** 266,273 **** } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cClientJoinedTeam, (U32 clientId, U32 teamIndex), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { ! S32 clientIndex = findClientIndexById(clientId); mClientList[clientIndex].teamId = teamIndex; gGameUserInterface.displayMessage(Color(0.6f, 0.6f, 0.8f), "%s joined team %s.", mClientList[clientIndex].name.getString(), mTeams[teamIndex].name.getString()); --- 264,271 ---- } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cClientJoinedTeam, (StringTableEntry name, U32 teamIndex), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { ! S32 clientIndex = findClientIndexByName(name); mClientList[clientIndex].teamId = teamIndex; gGameUserInterface.displayMessage(Color(0.6f, 0.6f, 0.8f), "%s joined team %s.", mClientList[clientIndex].name.getString(), mTeams[teamIndex].name.getString()); *************** *** 287,292 **** for(S32 i = 0; i < mClientList.size(); i++) { ! s2cAddClient(mClientList[i].clientId, mClientList[i].name, mClientList[i].clientConnection == theConnection); ! s2cClientJoinedTeam(mClientList[i].clientId, mClientList[i].teamId); } NetObject::setRPCDestConnection(NULL); --- 285,290 ---- for(S32 i = 0; i < mClientList.size(); i++) { ! s2cAddClient(mClientList[i].name, mClientList[i].clientConnection == theConnection); ! s2cClientJoinedTeam(mClientList[i].name, mClientList[i].teamId); } NetObject::setRPCDestConnection(NULL); Index: projectile.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/projectile.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** projectile.cpp 22 Apr 2004 00:35:44 -0000 1.6 --- projectile.cpp 23 Apr 2004 01:49:46 -0000 1.7 *************** *** 99,103 **** DamageInfo theInfo; theInfo.collisionPoint = collisionPoint; ! theInfo.damageAmount = 1; theInfo.damageType = 0; theInfo.damagingObject = mShooter; --- 99,103 ---- DamageInfo theInfo; theInfo.collisionPoint = collisionPoint; ! theInfo.damageAmount = 0.21; theInfo.damageType = 0; theInfo.damagingObject = mShooter; Index: gameConnection.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameConnection.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gameConnection.cpp 22 Apr 2004 20:42:25 -0000 1.6 --- gameConnection.cpp 23 Apr 2004 01:49:46 -0000 1.7 *************** *** 230,235 **** } - U32 GameConnection::currentClientId = 0; - void GameConnection::onConnectionEstablished(bool isInitiator) { --- 230,233 ---- *************** *** 245,250 **** else { - mClientId = ++currentClientId; - linkToClientList(); gServerGame->addClient(this); --- 243,246 ---- Index: gameObject.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameObject.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gameObject.cpp 20 Apr 2004 04:27:20 -0000 1.1 --- gameObject.cpp 23 Apr 2004 01:49:46 -0000 1.2 *************** *** 81,87 **** nearest.y = center.y; F32 distance = (nearest - center).len(); ! return (200 / distance) + updateSkips; } --- 81,103 ---- nearest.y = center.y; + Point deltap = nearest - center; + F32 distance = (nearest - center).len(); ! Point deltav = getActualVel() - so->getActualVel(); ! ! F32 add = 0; ! ! // initial scoping factor is distance based. ! F32 distFactor = (500 - distance) / 500; ! ! // give some extra love to things that are moving towards the scope object ! if(deltav.dot(deltap) < 0) ! add = 0.7; ! ! // and a little more love if this object has not yet been scoped. ! if(updateMask == 0xFFFFFFFF) ! add += 0.5; ! return distFactor + add + updateSkips * 0.5f; } *************** *** 122,125 **** --- 138,151 ---- } + void GameObject::addToDatabase() + { + mGame->getGridDatabase()->addToExtents(this, extent); + } + + void GameObject::removeFromDatabase() + { + mGame->getGridDatabase()->removeFromExtents(this, extent); + } + void GameObject::addToGame(Game *theGame) { *************** *** 127,131 **** theGame->addToGameObjectList(this); mGame = theGame; ! mGame->getGridDatabase()->addToExtents(this, extent); onAddedToGame(theGame); } --- 153,157 ---- theGame->addToGameObjectList(this); mGame = theGame; ! addToDatabase(); onAddedToGame(theGame); } *************** *** 139,143 **** if(mGame) { ! mGame->getGridDatabase()->removeFromExtents(this, extent); mGame->removeFromGameObjectList(this); mGame = NULL; --- 165,169 ---- if(mGame) { ! removeFromDatabase(); mGame->removeFromGameObjectList(this); mGame = NULL; Index: ZAP.vcproj =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/ZAP.vcproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ZAP.vcproj 22 Apr 2004 07:27:43 -0000 1.2 --- ZAP.vcproj 23 Apr 2004 01:49:46 -0000 1.3 *************** *** 141,144 **** --- 141,147 ---- </File> <File + RelativePath=".\gameItems.cpp"> + </File> + <File RelativePath=".\gameLoader.cpp"> </File> Index: masterConnection.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/masterConnection.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** masterConnection.cpp 22 Apr 2004 02:57:51 -0000 1.3 --- masterConnection.cpp 23 Apr 2004 01:49:46 -0000 1.4 *************** *** 182,186 **** Parent::writeConnectRequest(bstream); ! bstream->writeString("ZAP1.1"); // Game Name if(bstream->writeFlag(mIsGameServer)) { --- 182,186 ---- Parent::writeConnectRequest(bstream); ! bstream->writeString("ZAP1.2"); // Game Name if(bstream->writeFlag(mIsGameServer)) { Index: CTFGame.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/CTFGame.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CTFGame.h 22 Apr 2004 02:57:51 -0000 1.4 --- CTFGame.h 23 Apr 2004 01:49:46 -0000 1.5 *************** *** 53,56 **** --- 53,58 ---- void controlObjectForClientKilled(GameConnection *theClient, GameObject *clientObject, GameObject *killerObject); void controlObjectForClientRemoved(GameConnection *theClient, GameObject *clientObject); + bool objectCanDamageObject(GameObject *damager, GameObject *victim); + U32 checkFlagDrop(GameObject *theObject); *************** *** 69,73 **** }; ! 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)); --- 71,75 ---- }; ! TNL_DECLARE_RPC(s2cCTFMessage, (U32 messageIndex, StringTableEntry clientName, 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)); Index: projectile.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/projectile.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** projectile.h 20 Apr 2004 21:53:37 -0000 1.2 --- projectile.h 23 Apr 2004 01:49:46 -0000 1.3 *************** *** 55,58 **** --- 55,61 ---- void processClient(U32 deltaT); + virtual Point getRenderVel() { return velocity; } + virtual Point getActualVel() { return velocity; } + void render(); Index: gameConnection.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameConnection.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gameConnection.h 22 Apr 2004 20:42:25 -0000 1.3 --- gameConnection.h 23 Apr 2004 01:49:46 -0000 1.4 *************** *** 159,164 **** StringTableEntry playerName; - static U32 currentClientId; - U32 mClientId; U32 mLastClientControlCRC; --- 159,162 ---- Index: gameObject.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameObject.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gameObject.h 20 Apr 2004 04:27:20 -0000 1.1 --- gameObject.h 23 Apr 2004 01:49:46 -0000 1.2 *************** *** 111,114 **** --- 111,117 ---- virtual Point getRenderPos(); virtual Point getActualPos(); + virtual Point getRenderVel() { return Point(); } + virtual Point getActualVel() { return Point(); } + virtual void setActualPos(Point p); *************** *** 120,123 **** --- 123,128 ---- void disableCollision() { mDisableCollisionCount++; } void enableCollision() { mDisableCollisionCount--; } + void addToDatabase(); + void removeFromDatabase(); bool isCollisionEnabled() { return mDisableCollisionCount == 0; } Index: ship.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/ship.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ship.h 22 Apr 2004 00:35:49 -0000 1.3 --- ship.h 23 Apr 2004 01:49:46 -0000 1.4 *************** *** 76,80 **** void render(); ! Ship(StringTableEntry playerName="", Point p = Point(0,0), Color c = Color(), F32 m = 1.0); void emitMovementSparks(); --- 76,82 ---- void render(); ! Ship(StringTableEntry playerName="", Point p = Point(0,0), F32 m = 1.0); ! ! F32 getHealth() { return mHealth; } void emitMovementSparks(); Index: UIMenus.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/UIMenus.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UIMenus.cpp 22 Apr 2004 07:46:20 -0000 1.3 --- UIMenus.cpp 23 Apr 2004 01:49:46 -0000 1.4 *************** *** 46,49 **** --- 46,53 ---- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glColor3f(1,1,1); drawCenteredString( 10, 30, menuTitle); Index: CTFGame.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/CTFGame.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CTFGame.cpp 22 Apr 2004 20:42:25 -0000 1.8 --- CTFGame.cpp 23 Apr 2004 01:49:46 -0000 1.9 *************** *** 200,204 **** if(!theFlag->isAtHome()) { ! s2cCTFMessage(CTFMsgReturnFlag, cl.clientId, theFlag->getTeamIndex()); theFlag->sendHome(); cl.score += Scores::ReturnScore; --- 200,204 ---- if(!theFlag->isAtHome()) { ! s2cCTFMessage(CTFMsgReturnFlag, cl.name, theFlag->getTeamIndex()); theFlag->sendHome(); cl.score += Scores::ReturnScore; *************** *** 215,219 **** mTeams[cl.teamId].score++; s2cSetTeamScore(cl.teamId, mTeams[cl.teamId].score); ! s2cCTFMessage(CTFMsgCaptureFlag, cl.clientId, mountedFlag->getTeamIndex()); // score the flag for the client's team... mountedFlag->dismount(); --- 215,219 ---- mTeams[cl.teamId].score++; s2cSetTeamScore(cl.teamId, mTeams[cl.teamId].score); ! s2cCTFMessage(CTFMsgCaptureFlag, cl.name, mountedFlag->getTeamIndex()); // score the flag for the client's team... mountedFlag->dismount(); *************** *** 226,230 **** else { ! s2cCTFMessage(CTFMsgTakeFlag, cl.clientId, theFlag->getTeamIndex()); theFlag->mountToShip(theShip); } --- 226,230 ---- else { ! s2cCTFMessage(CTFMsgTakeFlag, cl.name, theFlag->getTeamIndex()); theFlag->mountToShip(theShip); } *************** *** 253,257 **** if(mountedFlag) { ! s2cCTFMessage(CTFMsgDropFlag, cl.clientId, mountedFlag->getTeamIndex()); mountedFlag->dismount(); flagCount++; --- 253,257 ---- if(mountedFlag) { ! s2cCTFMessage(CTFMsgDropFlag, cl.name, mountedFlag->getTeamIndex()); mountedFlag->dismount(); flagCount++; *************** *** 263,266 **** --- 263,278 ---- } + bool CTFGameType::objectCanDamageObject(GameObject *damager, GameObject *victim) + { + GameConnection *c1 = damager->getControllingClient(); + GameConnection *c2 = victim->getControllingClient(); + + if(!c1 || !c2) + return true; + + return mClientList[findClientIndexByConnection(c1)].teamId != + mClientList[findClientIndexByConnection(c2)].teamId; + } + void CTFGameType::controlObjectForClientKilled(GameConnection *theClient, GameObject *clientObject, GameObject *killerObject) { *************** *** 304,311 **** }; ! TNL_IMPLEMENT_NETOBJECT_RPC(CTFGameType, s2cCTFMessage, (U32 messageIndex, U32 clientId, U32 teamIndex), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { ! S32 clientIndex = findClientIndexById(clientId); gGameUserInterface.displayMessage(Color(0.6f, 1.0f, 0.8f), --- 316,323 ---- }; ! TNL_IMPLEMENT_NETOBJECT_RPC(CTFGameType, s2cCTFMessage, (U32 messageIndex, StringTableEntry clientName, U32 teamIndex), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { ! S32 clientIndex = findClientIndexByName(clientName); gGameUserInterface.displayMessage(Color(0.6f, 1.0f, 0.8f), Index: gameType.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameType.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gameType.h 22 Apr 2004 00:35:44 -0000 1.3 --- gameType.h 23 Apr 2004 01:49:46 -0000 1.4 *************** *** 38,43 **** struct ClientRef { ! U32 clientId; ! StringTableEntry name; S32 teamId; U32 score; --- 38,42 ---- struct ClientRef { ! StringTableEntry name; /// Name of client - guaranteed to be unique of current clients S32 teamId; U32 score; *************** *** 59,63 **** }; Vector<Team> mTeams; ! U32 mThisClientId; ///< Set to the client ID of this client (only on the ghost of the GameType) U32 mTimeUntilScoreboardUpdate; --- 58,62 ---- }; Vector<Team> mTeams; ! U32 mThisClientName; ///< Set to the client name of this client (only on the ghost of the GameType) U32 mTimeUntilScoreboardUpdate; *************** *** 65,69 **** void countTeamPlayers(); ! S32 findClientIndexById(U32 clientId); S32 findClientIndexByConnection(GameConnection *theConnection); --- 64,76 ---- void countTeamPlayers(); ! Color getClientColor(const StringTableEntry &clientName) ! { ! S32 index = findClientIndexByName(clientName); ! if(index != -1) ! return mTeams[mClientList[index].teamId].color; ! return Color(); ! } ! ! S32 findClientIndexByName(const StringTableEntry &name); S32 findClientIndexByConnection(GameConnection *theConnection); *************** *** 77,80 **** --- 84,88 ---- virtual void serverRemoveClient(GameConnection *theClient); + virtual bool objectCanDamageObject(GameObject *damager, GameObject *victim) { return true; } virtual void controlObjectForClientKilled(GameConnection *theClient, GameObject *clientObject, GameObject *killerObject); virtual void controlObjectForClientRemoved(GameConnection *theClient, GameObject *clientObject); *************** *** 90,98 **** TNL_DECLARE_RPC(s2cAddTeam, (StringTableEntry teamName, F32 r, F32 g, F32 b)); TNL_DECLARE_RPC(s2cSetTeamScore, (U32 teamIndex, U32 score)); ! TNL_DECLARE_RPC(s2cAddClient, (U32 clientId, StringTableEntry clientName, bool isMyClient)); ! TNL_DECLARE_RPC(s2cRemoveClient, (U32 clientId)); TNL_DECLARE_RPC(c2sChangeTeams, ()); ! TNL_DECLARE_RPC(s2cClientJoinedTeam, (U32 clientId, U32 teamIndex)); TNL_DECLARE_RPC(c2sSendChat, (bool global, const char *message)); --- 98,106 ---- TNL_DECLARE_RPC(s2cAddTeam, (StringTableEntry teamName, F32 r, F32 g, F32 b)); TNL_DECLARE_RPC(s2cSetTeamScore, (U32 teamIndex, U32 score)); ! TNL_DECLARE_RPC(s2cAddClient, (StringTableEntry clientName, bool isMyClient)); ! TNL_DECLARE_RPC(s2cRemoveClient, (StringTableEntry clientName)); TNL_DECLARE_RPC(c2sChangeTeams, ()); ! TNL_DECLARE_RPC(s2cClientJoinedTeam, (StringTableEntry clientName, U32 teamIndex)); TNL_DECLARE_RPC(c2sSendChat, (bool global, const char *message)); Index: item.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/item.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** item.cpp 20 Apr 2004 19:45:04 -0000 1.4 --- item.cpp 23 Apr 2004 01:49:46 -0000 1.5 *************** *** 50,53 **** --- 50,54 ---- for(U32 i = 0; i < MoveStateCount; i++) mMoveState[i].pos = pos; + updateExtent(); } *************** *** 169,173 **** stream->write(mMoveState[RenderState].pos.x); stream->write(mMoveState[RenderState].pos.y); - stream->write(mMoveState[RenderState].angle); stream->write(mMoveState[RenderState].vel.x); stream->write(mMoveState[RenderState].vel.y); --- 170,173 ---- *************** *** 198,202 **** stream->read(&mMoveState[ActualState].pos.x); stream->read(&mMoveState[ActualState].pos.y); - stream->read(&mMoveState[ActualState].angle); stream->read(&mMoveState[ActualState].vel.x); stream->read(&mMoveState[ActualState].vel.y); --- 198,201 ---- *************** *** 240,278 **** } ! TNL_IMPLEMENT_NETOBJECT(TestItem); ! ! TestItem::TestItem() : Item(Point(0,0), true, 60, 4) { ! mNetFlags.set(Ghostable); } ! void TestItem::renderItem(Point pos) { ! glPushMatrix(); ! glTranslatef(pos.x, pos.y, 0); ! ! glColor3f(1, 1, 0); ! glBegin(GL_LINE_LOOP); ! ! glVertex2f(-60, 0); ! glVertex2f(-40, 40); ! glVertex2f(0, 60); ! glVertex2f(40, 40); ! glVertex2f(60, 0); ! glVertex2f(40, -40); ! glVertex2f(0, -60); ! glVertex2f(-40, -40); ! ! glEnd(); ! glPopMatrix(); } ! void TestItem::damageObject(DamageInfo *theInfo) { ! // compute impulse direction ! Point dv = theInfo->impulseVector - mMoveState[ActualState].vel; ! Point iv = mMoveState[ActualState].pos - theInfo->collisionPoint; ! iv.normalize(); ! mMoveState[ActualState].vel += iv * dv.dot(iv) * 0.3; } --- 239,275 ---- } ! PickupItem::PickupItem(Point p, float radius) ! : Item(p, false, radius, 1) { ! mIsVisible = true; ! mRepopDelay = 0; } ! void PickupItem::processServer(U32 deltaT) { ! if(!mIsVisible) ! { ! if(deltaT > mRepopDelay) ! { ! mIsVisible = true; ! addToDatabase(); ! } ! else ! mRepopDelay -= deltaT; ! } } ! bool PickupItem::collide(GameObject *otherObject) { ! if(!isGhost() && otherObject->getObjectTypeMask() & ShipType) ! { ! if(pickup((Ship *) otherObject)) ! { ! mRepopDelay = getRepopDelay(); ! mIsVisible = false; ! removeFromDatabase(); ! } ! } ! return false; } Index: barrier.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/barrier.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** barrier.cpp 21 Apr 2004 01:57:06 -0000 1.3 --- barrier.cpp 23 Apr 2004 01:49:46 -0000 1.4 *************** *** 111,115 **** { mObjectTypeMask = BarrierType; ! mNetFlags.set(Ghostable); start = st; end = e; --- 111,115 ---- { mObjectTypeMask = BarrierType; ! mNetFlags.set(Ghostable | ScopeAlways); start = st; end = e; Index: item.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/item.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** item.h 20 Apr 2004 04:27:20 -0000 1.1 --- item.h 23 Apr 2004 01:49:46 -0000 1.2 *************** *** 69,84 **** class PickupItem : public Item { ! ! }; ! ! class TestItem : public Item ! { ! U32 teamIndex; public: ! TestItem(); ! void renderItem(Point pos); ! void damageObject(DamageInfo *theInfo); ! ! TNL_DECLARE_CLASS(TestItem); }; --- 69,81 ---- class PickupItem : public Item { ! typedef Item Parent; ! bool mIsVisible; ! U32 mRepopDelay; public: ! PickupItem(Point p = Point(), float radius = 1); ! void processServer(U32 deltaT); ! bool collide(GameObject *otherObject); ! virtual bool pickup(Ship *theShip) = 0; ! virtual U32 getRepopDelay() = 0; }; Index: ship.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/ship.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ship.cpp 22 Apr 2004 20:42:25 -0000 1.8 --- ship.cpp 23 Apr 2004 01:49:46 -0000 1.9 *************** *** 45,49 **** TNL_IMPLEMENT_NETOBJECT(Ship); ! Ship::Ship(StringTableEntry playerName, Point p, Color c, F32 m) : MoveObject(p, CollisionRadius) { mObjectTypeMask = ShipType | MoveableType; --- 45,49 ---- TNL_IMPLEMENT_NETOBJECT(Ship); ! Ship::Ship(StringTableEntry playerName, Point p, F32 m) : MoveObject(p, CollisionRadius) { mObjectTypeMask = ShipType | MoveableType; *************** *** 57,61 **** } mHealth = 1.0; - color = c; interpTime = 0; mass = m; --- 57,60 ---- *************** *** 150,154 **** void Ship::damageObject(DamageInfo *theInfo) { ! mHealth -= 0.21; setMaskBits(HealthMask); if(mHealth <= 0) --- 149,156 ---- void Ship::damageObject(DamageInfo *theInfo) { ! if(!getGame()->getGameType()->objectCanDamageObject(theInfo->damagingObject, this)) ! return; ! ! mHealth -= theInfo->damageAmount; setMaskBits(HealthMask); if(mHealth <= 0) *************** *** 157,160 **** --- 159,164 ---- kill(theInfo); } + else if(mHealth > 1) + mHealth = 1; } *************** *** 292,298 **** { connection->packStringTableEntry(stream, mPlayerName); - stream->writeFloat(color.r, 8); - stream->writeFloat(color.g, 8); - stream->writeFloat(color.b, 8); stream->write(mass); --- 296,299 ---- *************** *** 352,358 **** { mPlayerName = connection->unpackStringTableEntry(stream); ! color.r = stream->readFloat(8); ! color.g = stream->readFloat(8); ! color.b = stream->readFloat(8); stream->read(&mass); --- 353,360 ---- { mPlayerName = connection->unpackStringTableEntry(stream); ! GameType *g = gClientGame->getGameType(); ! if(g) ! color = g->getClientColor(mPlayerName); ! stream->read(&mass); |