[Opentnl-cvs] tnl/zap footballGame.cpp,1.11,1.12 gameType.cpp,1.59,1.60 gameType.h,1.34,1.35
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <mar...@us...> - 2004-10-04 19:24:28
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9966/zap Modified Files: footballGame.cpp gameType.cpp gameType.h Log Message: Added "Items of interest" to game types to allow carried flags to be added to team's waypoint views Index: gameType.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameType.cpp,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** gameType.cpp 1 Oct 2004 00:21:40 -0000 1.59 --- gameType.cpp 4 Oct 2004 19:23:59 -0000 1.60 *************** *** 68,71 **** --- 68,72 ---- return; } + queryItemsOfInterest(); if(mScoreboardUpdateTimer.update(deltaT)) { *************** *** 271,278 **** alpha *= dist * 0.02; glEnable(GL_BLEND); glColor(c * 0.7, alpha); - Point p2 = rp - arrowDir * 20 + crossVec * 10; - Point p3 = rp - arrowDir * 20 - crossVec * 10; glBegin(GL_POLYGON); glVertex(rp); --- 272,289 ---- alpha *= dist * 0.02; + Point p2 = rp - arrowDir * 23 + crossVec * 8; + Point p3 = rp - arrowDir * 23 - crossVec * 8; + + glColor3f(0,0,0); + glLineWidth(4); + glBegin(GL_LINE_LOOP); + glVertex(rp); + glVertex(p2); + glVertex(p3); + glEnd(); + glLineWidth(2); + glEnable(GL_BLEND); glColor(c * 0.7, alpha); glBegin(GL_POLYGON); glVertex(rp); *************** *** 532,535 **** --- 543,585 ---- } + void GameType::addItemOfInterest(Item *theItem) + { + ItemOfInterest i; + i.theItem = theItem; + i.teamVisMask = 0; + mItemsOfInterest.push_back(i); + } + + void GameType::queryItemsOfInterest() + { + static Vector<GameObject *> fillVector; + for(S32 i = 0; i < mItemsOfInterest.size(); i++) + { + ItemOfInterest &ioi = mItemsOfInterest[i]; + ioi.teamVisMask = 0; + Point pos = ioi.theItem->getActualPos(); + Point scopeRange(Game::PlayerSensorHorizVisDistance, + Game::PlayerSensorVertVisDistance); + Rect queryRect(pos, pos); + + queryRect.expand(scopeRange); + findObjects(ShipType, fillVector, queryRect); + for(S32 j = 0; j < fillVector.size(); j++) + { + Ship *theShip = (Ship *) fillVector[j]; + Point delta = theShip->getActualPos() - pos; + delta.x = fabs(delta.x); + delta.y = fabs(delta.y); + + if( (theShip->isSensorActive() && delta.x < Game::PlayerSensorHorizVisDistance && + delta.y < Game::PlayerSensorVertVisDistance) || + (delta.x < Game::PlayerHorizVisDistance && + delta.y < Game::PlayerVertVisDistance)) + ioi.teamVisMask |= (1 << theShip->getTeam()); + } + fillVector.clear(); + } + } + void GameType::performProxyScopeQuery(GameObject *scopeObject, GameConnection *connection) { *************** *** 537,540 **** --- 587,604 ---- fillVector.clear(); + if(mTeams.size() > 1) + { + for(S32 i = 0; i < mItemsOfInterest.size(); i++) + { + if(mItemsOfInterest[i].teamVisMask & (1 << scopeObject->getTeam())) + { + Item *theItem = mItemsOfInterest[i].theItem; + connection->objectInScope(theItem); + if(theItem->isMounted()) + connection->objectInScope(theItem->getMount()); + } + } + } + if(connection->isInCommanderMap() && mTeams.size() > 1) { Index: footballGame.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/footballGame.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** footballGame.cpp 1 Oct 2004 00:21:40 -0000 1.11 --- footballGame.cpp 4 Oct 2004 19:23:59 -0000 1.12 *************** *** 45,49 **** void flagDropped(Ship *theShip, FlagItem *theFlag); void addZone(GoalZone *z); ! void addFlag(FlagItem *theFlag) { mFlag = theFlag; } void shipTouchZone(Ship *s, GoalZone *z); const char *getGameTypeString() { return "Zone Control"; } --- 45,53 ---- void flagDropped(Ship *theShip, FlagItem *theFlag); void addZone(GoalZone *z); ! void addFlag(FlagItem *theFlag) ! { ! mFlag = theFlag; ! addItemOfInterest(theFlag); ! } void shipTouchZone(Ship *s, GoalZone *z); const char *getGameTypeString() { return "Zone Control"; } *************** *** 195,199 **** for(S32 i = 0; i < mZones.size(); i++) { ! if(mZones[i]->didRecentlyChangeTeam()) { Color c = getTeamColor(mZones[i]->getTeam()); --- 199,203 ---- for(S32 i = 0; i < mZones.size(); i++) { ! if(mZones[i]->didRecentlyChangeTeam() && mZones[i]->getTeam() != -1) { Color c = getTeamColor(mZones[i]->getTeam()); Index: gameType.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameType.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** gameType.h 1 Oct 2004 00:21:40 -0000 1.34 --- gameType.h 4 Oct 2004 19:23:59 -0000 1.35 *************** *** 39,42 **** --- 39,43 ---- class GoalZone; struct MenuItem; + class Item; class ClientRef : public Object *************** *** 95,98 **** --- 96,109 ---- StringTableEntry mLevelDescription; + struct ItemOfInterest + { + SafePtr<Item> theItem; + U32 teamVisMask; + }; + + Vector<ItemOfInterest> mItemsOfInterest; + + void addItemOfInterest(Item *theItem); + Timer mScoreboardUpdateTimer; Timer mGameTimer; *************** *** 163,166 **** --- 174,178 ---- virtual void shipTouchZone(Ship *theShip, GoalZone *theZone) {} + void queryItemsOfInterest(); void performScopeQuery(GhostConnection *connection); virtual void performProxyScopeQuery(GameObject *scopeObject, GameConnection *connection); |