Update of /cvsroot/opentnl/tnl/zap
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16345/zap
Modified Files:
CTFGame.cpp CTFGame.h HTFGame.cpp footballGame.cpp game.h
gameType.cpp item.cpp item.h retrieveGame.cpp soccerGame.cpp
soccerGame.h
Log Message:
Updated all team game types to use objective arrows
Arrows now rotate around ellipse on screen, not edges of screen.
Index: gameType.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/gameType.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** gameType.cpp 4 Oct 2004 19:23:59 -0000 1.60
--- gameType.cpp 5 Oct 2004 00:16:34 -0000 1.61
***************
*** 245,248 ****
--- 245,249 ----
Point center(400, 300);
Point arrowDir = rp - center;
+ /*
if(rp.x > UserInterface::horizMargin &&
rp.x < UserInterface::canvasWidth - UserInterface::horizMargin &&
***************
*** 251,255 ****
return;
- Point np = rp;
if(rp.x < UserInterface::horizMargin)
rp.x = UserInterface::horizMargin;
--- 252,255 ----
***************
*** 260,263 ****
--- 260,274 ----
if(rp.y > UserInterface::canvasHeight - UserInterface::vertMargin)
rp.y = UserInterface::canvasHeight - UserInterface::vertMargin;
+ */
+
+ F32 er = arrowDir.x * arrowDir.x / (350 * 350) + arrowDir.y * arrowDir.y / (250 * 250);
+ if(er < 1)
+ return;
+ Point np = rp;
+
+ er = sqrt(er);
+ rp.x = arrowDir.x / er;
+ rp.y = arrowDir.y / er;
+ rp += center;
F32 dist = (np - rp).len();
***************
*** 265,269 ****
arrowDir.normalize();
Point crossVec(arrowDir.y, -arrowDir.x);
! F32 alpha = (1 - gClientGame->getCommanderZoomFraction()) * 0.8;
if(!alpha)
return;
--- 276,280 ----
arrowDir.normalize();
Point crossVec(arrowDir.y, -arrowDir.x);
! F32 alpha = (1 - gClientGame->getCommanderZoomFraction()) * 0.6;
if(!alpha)
return;
***************
*** 275,287 ****
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);
--- 286,289 ----
Index: soccerGame.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/soccerGame.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** soccerGame.cpp 1 Jul 2004 23:07:46 -0000 1.19
--- soccerGame.cpp 5 Oct 2004 00:16:34 -0000 1.20
***************
*** 68,71 ****
--- 68,81 ----
}
+ void SoccerGameType::addZone(GoalZone *theZone)
+ {
+ mGoals.push_back(theZone);
+ }
+
+ void SoccerGameType::setBall(SoccerBallItem *theBall)
+ {
+ mBall = theBall;
+ }
+
void SoccerGameType::scoreGoal(StringTableEntry playerName, U32 goalTeamIndex)
{
***************
*** 93,96 ****
--- 103,122 ----
}
+ void SoccerGameType::renderInterfaceOverlay(bool scoreboardVisible)
+ {
+ Parent::renderInterfaceOverlay(scoreboardVisible);
+ Ship *u = (Ship *) gClientGame->getConnectionToServer()->getControlObject();
+ if(!u)
+ return;
+
+ for(S32 i = 0; i < mGoals.size(); i++)
+ {
+ if(mGoals[i]->getTeam() != u->getTeam())
+ renderObjectiveArrow(mGoals[i], getTeamColor(mGoals[i]->getTeam()));
+ }
+ if(mBall.isValid())
+ renderObjectiveArrow(mBall, getTeamColor(-1));
+ }
+
TNL_IMPLEMENT_NETOBJECT(SoccerBallItem);
***************
*** 108,111 ****
--- 134,144 ----
}
+ void SoccerBallItem::onAddedToGame(Game *theGame)
+ {
+ if(!isGhost())
+ theGame->getGameType()->addItemOfInterest(this);
+ ((SoccerGameType *) theGame->getGameType())->setBall(this);
+ }
+
void SoccerBallItem::renderItem(Point pos)
{
Index: HTFGame.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/HTFGame.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** HTFGame.cpp 28 Sep 2004 18:45:25 -0000 1.2
--- HTFGame.cpp 5 Oct 2004 00:16:34 -0000 1.3
***************
*** 41,46 ****
Vector<GoalZone *> mZones;
! Vector<FlagItem *> mFlags;
! Vector<GoalZone *> mFlagZones;
enum {
CapScore = 2,
--- 41,45 ----
Vector<GoalZone *> mZones;
! Vector<SafePtr<FlagItem> > mFlags;
enum {
CapScore = 2,
***************
*** 52,57 ****
void addFlag(FlagItem *theFlag)
{
! mFlags.push_back(theFlag);
! mFlagZones.push_back(NULL);
}
--- 51,68 ----
void addFlag(FlagItem *theFlag)
{
! S32 i;
! for(i = 0; i < mFlags.size(); i++)
! {
! if(mFlags[i] == NULL)
! {
! mFlags[i] = theFlag;
! break;
! }
! }
! if(i == mFlags.size())
! mFlags.push_back(theFlag);
!
! if(!isGhost())
! addItemOfInterest(theFlag);
}
***************
*** 80,84 ****
// see if this flag is already in a flag zone owned by the ship's team
! if(mFlagZones[flagIndex] != NULL && mFlagZones[flagIndex]->getTeam() == theShip->getTeam())
return;
--- 91,95 ----
// see if this flag is already in a flag zone owned by the ship's team
! if(theFlag->getZone() != NULL && theFlag->getZone()->getTeam() == theShip->getTeam())
return;
***************
*** 88,97 ****
S32 teamIndex;
! if(mFlagZones[flagIndex] == NULL)
teamIndex = cl->teamId;
else
{
r = stealString;
! teamIndex = mFlagZones[flagIndex]->getTeam();
}
Vector<StringTableEntry> e;
--- 99,108 ----
S32 teamIndex;
! if(theFlag->getZone() == NULL)
teamIndex = cl->teamId;
else
{
r = stealString;
! teamIndex = theFlag->getZone()->getTeam();
}
Vector<StringTableEntry> e;
***************
*** 108,112 ****
GameConnection::ColorNuclearGreen, SFXFlagSnatch, r, e);
theFlag->mountToShip(theShip);
! mFlagZones[flagIndex] = NULL;
}
--- 119,123 ----
GameConnection::ColorNuclearGreen, SFXFlagSnatch, r, e);
theFlag->mountToShip(theShip);
! theFlag->setZone(NULL);
}
***************
*** 140,145 ****
// see if this zone already has a flag in it...
! for(S32 i = 0; i < mFlagZones.size(); i++)
! if(mFlagZones[i] == z)
return;
--- 151,156 ----
// see if this zone already has a flag in it...
! for(S32 i = 0; i < mFlags.size(); i++)
! if(mFlags[i]->getZone() == z)
return;
***************
*** 179,183 ****
break;
! mFlagZones[flagIndex] = z;
mountedFlag->setActualPos(z->getExtent().getCenter());
--- 190,194 ----
break;
! mFlags[flagIndex]->setZone(z);
mountedFlag->setActualPos(z->getExtent().getCenter());
***************
*** 196,202 ****
for(S32 flagIndex = 0; flagIndex < mFlags.size(); flagIndex++)
{
! if(mFlagZones[flagIndex] != NULL)
{
! S32 team = mFlagZones[flagIndex]->getTeam();
setTeamScore(team, mTeams[team].score + 1);
}
--- 207,213 ----
for(S32 flagIndex = 0; flagIndex < mFlags.size(); flagIndex++)
{
! if(mFlags[flagIndex]->getZone() != NULL)
{
! S32 team = mFlags[flagIndex]->getZone()->getTeam();
setTeamScore(team, mTeams[team].score + 1);
}
***************
*** 205,208 ****
--- 216,293 ----
}
+ void performProxyScopeQuery(GameObject *scopeObject, GameConnection *connection)
+ {
+ Parent::performProxyScopeQuery(scopeObject, connection);
+ S32 uTeam = scopeObject->getTeam();
+
+ for(S32 i = 0; i < mFlags.size(); i++)
+ {
+ if(mFlags[i]->isAtHome() || mFlags[i]->getZone())
+ connection->objectInScope(mFlags[i]);
+ else
+ {
+ Ship *mount = mFlags[i]->getMount();
+ if(mount && mount->getTeam() == uTeam)
+ {
+ connection->objectInScope(mount);
+ connection->objectInScope(mFlags[i]);
+ }
+ }
+ }
+ }
+
+ void renderInterfaceOverlay(bool scoreboardVisible)
+ {
+ Parent::renderInterfaceOverlay(scoreboardVisible);
+ Ship *u = (Ship *) gClientGame->getConnectionToServer()->getControlObject();
+ if(!u)
+ return;
+ bool uFlag = false;
+
+ for(S32 i = 0; i < mFlags.size(); i++)
+ {
+ if(mFlags[i].isValid() && mFlags[i]->getMount() == u)
+ {
+ for(S32 j = 0; j < mZones.size(); j++)
+ {
+ // see if this is one of our zones and that it doesn't have a flag in it.
+ if(mZones[j]->getTeam() != u->getTeam())
+ continue;
+ S32 k;
+ for(k = 0; k < mFlags.size(); k++)
+ {
+ if(mFlags[k]->getZone() == mZones[j])
+ break;
+ }
+ if(k == mFlags.size())
+ renderObjectiveArrow(mZones[j], getTeamColor(u->getTeam()));
+ }
+ uFlag = true;
+ break;
+ }
+ }
+
+ for(S32 i = 0; i < mFlags.size(); i++)
+ {
+ if(!mFlags[i].isValid())
+ continue;
+
+ if(!mFlags[i]->isMounted() && !uFlag)
+ {
+ GoalZone *gz = mFlags[i]->getZone();
+ if(gz && gz->getTeam() != u->getTeam())
+ renderObjectiveArrow(mFlags[i], getTeamColor(gz->getTeam()));
+ else if(!gz)
+ renderObjectiveArrow(mFlags[i], getTeamColor(-1));
+ }
+ else
+ {
+ Ship *mount = mFlags[i]->getMount();
+ if(mount && mount != u)
+ renderObjectiveArrow(mount, getTeamColor(mount->getTeam()));
+ }
+ }
+ }
+
const char *getGameTypeString() { return "Hold the Flag"; }
const char *getInstructionString() { return "Hold the flags at your capture zones!"; }
Index: game.h
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/game.h,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** game.h 1 Oct 2004 00:21:40 -0000 1.66
--- game.h 5 Oct 2004 00:16:34 -0000 1.67
***************
*** 236,240 ****
extern void endGame();
! #define ZAP_GAME_STRING "ZAP 1.4.4"
};
--- 236,240 ----
extern void endGame();
! #define ZAP_GAME_STRING "ZAP 1.4.5"
};
Index: retrieveGame.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/retrieveGame.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** retrieveGame.cpp 4 Aug 2004 18:25:27 -0000 1.3
--- retrieveGame.cpp 5 Oct 2004 00:16:34 -0000 1.4
***************
*** 36,42 ****
class RetrieveGameType : public GameType
{
Vector<GoalZone *> mZones;
! Vector<FlagItem *> mFlags;
! Vector<GoalZone *> mFlagZones;
enum {
CapScore = 2,
--- 36,42 ----
class RetrieveGameType : public GameType
{
+ typedef GameType Parent;
Vector<GoalZone *> mZones;
! Vector<SafePtr<FlagItem> > mFlags;
enum {
CapScore = 2,
***************
*** 45,50 ****
void addFlag(FlagItem *theFlag)
{
! mFlags.push_back(theFlag);
! mFlagZones.push_back(NULL);
}
--- 45,62 ----
void addFlag(FlagItem *theFlag)
{
! S32 i;
! for(i = 0; i < mFlags.size(); i++)
! {
! if(mFlags[i] == NULL)
! {
! mFlags[i] = theFlag;
! break;
! }
! }
! if(i == mFlags.size())
! mFlags.push_back(theFlag);
!
! if(!isGhost())
! addItemOfInterest(theFlag);
}
***************
*** 73,77 ****
// see if this flag is already in a flag zone owned by the ship's team
! if(mFlagZones[flagIndex] != NULL && mFlagZones[flagIndex]->getTeam() == theShip->getTeam())
return;
--- 85,89 ----
// see if this flag is already in a flag zone owned by the ship's team
! if(theFlag->getZone() != NULL && theFlag->getZone()->getTeam() == theShip->getTeam())
return;
***************
*** 84,93 ****
S32 teamIndex;
! if(mFlagZones[flagIndex] == NULL)
teamIndex = cl->teamId;
else
{
r = stealString;
! teamIndex = mFlagZones[flagIndex]->getTeam();
setTeamScore(teamIndex, mTeams[teamIndex].score - 1);
}
--- 96,105 ----
S32 teamIndex;
! if(theFlag->getZone() == NULL)
teamIndex = cl->teamId;
else
{
r = stealString;
! teamIndex = theFlag->getZone()->getTeam();
setTeamScore(teamIndex, mTeams[teamIndex].score - 1);
}
***************
*** 99,103 ****
GameConnection::ColorNuclearGreen, SFXFlagSnatch, r, e);
theFlag->mountToShip(theShip);
! mFlagZones[flagIndex] = NULL;
}
--- 111,115 ----
GameConnection::ColorNuclearGreen, SFXFlagSnatch, r, e);
theFlag->mountToShip(theShip);
! theFlag->setZone(NULL);
}
***************
*** 124,129 ****
// see if this zone already has a flag in it...
! for(S32 i = 0; i < mFlagZones.size(); i++)
! if(mFlagZones[i] == z)
return;
--- 136,141 ----
// see if this zone already has a flag in it...
! for(S32 i = 0; i < mFlags.size(); i++)
! if(mFlags[i]->getZone() == z)
return;
***************
*** 161,172 ****
break;
! mFlagZones[flagIndex] = z;
mountedFlag->setActualPos(z->getExtent().getCenter());
cl->score += CapScore;
// see if all the flags are owned by one team
! for(S32 i = 0; i < mFlagZones.size(); i++)
{
! if(!mFlagZones[i] || mFlagZones[i]->getTeam() != cl->teamId)
return;
}
--- 173,184 ----
break;
! mFlags[flagIndex]->setZone(z);
mountedFlag->setActualPos(z->getExtent().getCenter());
cl->score += CapScore;
// see if all the flags are owned by one team
! for(S32 i = 0; i < mFlags.size(); i++)
{
! if(!mFlags[i]->getZone() || mFlags[i]->getZone()->getTeam() != cl->teamId)
return;
}
***************
*** 181,185 ****
for(S32 i = 0; i < mFlags.size(); i++)
{
! mFlagZones[i] = NULL;
mFlags[i]->sendHome();
}
--- 193,197 ----
for(S32 i = 0; i < mFlags.size(); i++)
{
! mFlags[i]->setZone(NULL);
mFlags[i]->sendHome();
}
***************
*** 187,190 ****
--- 199,276 ----
}
+ void performProxyScopeQuery(GameObject *scopeObject, GameConnection *connection)
+ {
+ Parent::performProxyScopeQuery(scopeObject, connection);
+ S32 uTeam = scopeObject->getTeam();
+
+ for(S32 i = 0; i < mFlags.size(); i++)
+ {
+ if(mFlags[i]->isAtHome() || mFlags[i]->getZone())
+ connection->objectInScope(mFlags[i]);
+ else
+ {
+ Ship *mount = mFlags[i]->getMount();
+ if(mount && mount->getTeam() == uTeam)
+ {
+ connection->objectInScope(mount);
+ connection->objectInScope(mFlags[i]);
+ }
+ }
+ }
+ }
+
+ void renderInterfaceOverlay(bool scoreboardVisible)
+ {
+ Parent::renderInterfaceOverlay(scoreboardVisible);
+ Ship *u = (Ship *) gClientGame->getConnectionToServer()->getControlObject();
+ if(!u)
+ return;
+ bool uFlag = false;
+
+ for(S32 i = 0; i < mFlags.size(); i++)
+ {
+ if(mFlags[i].isValid() && mFlags[i]->getMount() == u)
+ {
+ for(S32 j = 0; j < mZones.size(); j++)
+ {
+ // see if this is one of our zones and that it doesn't have a flag in it.
+ if(mZones[j]->getTeam() != u->getTeam())
+ continue;
+ S32 k;
+ for(k = 0; k < mFlags.size(); k++)
+ {
+ if(mFlags[k]->getZone() == mZones[j])
+ break;
+ }
+ if(k == mFlags.size())
+ renderObjectiveArrow(mZones[j], getTeamColor(u->getTeam()));
+ }
+ uFlag = true;
+ break;
+ }
+ }
+
+ for(S32 i = 0; i < mFlags.size(); i++)
+ {
+ if(!mFlags[i].isValid())
+ continue;
+
+ if(!mFlags[i]->isMounted() && !uFlag)
+ {
+ GoalZone *gz = mFlags[i]->getZone();
+ if(gz && gz->getTeam() != u->getTeam())
+ renderObjectiveArrow(mFlags[i], getTeamColor(gz->getTeam()));
+ else if(!gz)
+ renderObjectiveArrow(mFlags[i], getTeamColor(-1));
+ }
+ else
+ {
+ Ship *mount = mFlags[i]->getMount();
+ if(mount && mount != u)
+ renderObjectiveArrow(mount, getTeamColor(mount->getTeam()));
+ }
+ }
+ }
+
const char *getGameTypeString() { return "Retrieve"; }
const char *getInstructionString() { return "Bring all the flags to your capture zones!"; }
Index: CTFGame.h
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/CTFGame.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** CTFGame.h 4 Aug 2004 18:25:27 -0000 1.16
--- CTFGame.h 5 Oct 2004 00:16:34 -0000 1.17
***************
*** 48,54 ****
--- 48,58 ----
};
+ Vector<SafePtr<FlagItem> > mFlags;
public:
+ void addFlag(FlagItem *theFlag);
void shipTouchFlag(Ship *theShip, FlagItem *theFlag);
void flagDropped(Ship *theShip, FlagItem *theFlag);
+ void performProxyScopeQuery(GameObject *scopeObject, GameConnection *connection);
+ void renderInterfaceOverlay(bool scoreboardVisible);
const char *getGameTypeString() { return "Capture the Flag"; }
const char *getInstructionString() { return "Take the opposing team's flag and touch it to your flag!"; }
Index: item.h
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/item.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** item.h 4 Aug 2004 18:25:27 -0000 1.8
--- item.h 5 Oct 2004 00:16:34 -0000 1.9
***************
*** 35,38 ****
--- 35,39 ----
class Ship;
+ class GoalZone;
class Item : public MoveObject
***************
*** 44,51 ****
WarpPositionMask = BIT(2),
MountMask = BIT(3),
! FirstFreeMask = BIT(4),
};
SafePtr<Ship> mMount;
bool mIsMounted;
bool mIsCollideable;
--- 45,55 ----
WarpPositionMask = BIT(2),
MountMask = BIT(3),
! ZoneMask = BIT(4),
! FirstFreeMask = BIT(5),
};
SafePtr<Ship> mMount;
+ SafePtr<GoalZone> mZone;
+
bool mIsMounted;
bool mIsCollideable;
***************
*** 65,68 ****
--- 69,75 ----
void mountToShip(Ship *theShip);
bool isMounted() { return mIsMounted; }
+ void setZone(GoalZone *theZone);
+ GoalZone *getZone();
+
Ship *getMount();
void dismount();
Index: footballGame.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/footballGame.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** footballGame.cpp 4 Oct 2004 19:23:59 -0000 1.12
--- footballGame.cpp 5 Oct 2004 00:16:34 -0000 1.13
***************
*** 174,215 ****
void ZoneControlGameType::renderInterfaceOverlay(bool scoreboardVisible)
{
Ship *u = (Ship *) gClientGame->getConnectionToServer()->getControlObject();
! if(u)
{
! if(mFlag.isValid() && mFlag->getMount() == u)
! {
! // the ship has the flag, so render zones not controlled by his team
! for(S32 i = 0; i < mZones.size(); i++)
! if(mZones[i]->getTeam() != u->getTeam())
! renderObjectiveArrow(mZones[i], getTeamColor(mZones[i]->getTeam()));
! }
! else
{
! if(mFlag.isValid())
{
! if(!mFlag->isMounted())
! renderObjectiveArrow(mFlag, getTeamColor(mFlag->getTeam()));
! else
! {
! Ship *mount = mFlag->getMount();
! if(mount)
! renderObjectiveArrow(mount, getTeamColor(mount->getTeam()));
! }
}
! for(S32 i = 0; i < mZones.size(); i++)
{
! if(mZones[i]->didRecentlyChangeTeam() && mZones[i]->getTeam() != -1)
! {
! Color c = getTeamColor(mZones[i]->getTeam());
! if(mZones[i]->isFlashing())
! c *= 0.8;
! renderObjectiveArrow(mZones[i], c);
- }
}
}
}
-
- Parent::renderInterfaceOverlay(scoreboardVisible);
}
--- 174,214 ----
void ZoneControlGameType::renderInterfaceOverlay(bool scoreboardVisible)
{
+ Parent::renderInterfaceOverlay(scoreboardVisible);
Ship *u = (Ship *) gClientGame->getConnectionToServer()->getControlObject();
! if(!u)
! return;
!
! if(mFlag.isValid() && mFlag->getMount() == u)
{
! // the ship has the flag, so render zones not controlled by his team
! for(S32 i = 0; i < mZones.size(); i++)
! if(mZones[i]->getTeam() != u->getTeam())
! renderObjectiveArrow(mZones[i], getTeamColor(mZones[i]->getTeam()));
! }
! else
! {
! if(mFlag.isValid())
{
! if(!mFlag->isMounted())
! renderObjectiveArrow(mFlag, getTeamColor(mFlag->getTeam()));
! else
{
! Ship *mount = mFlag->getMount();
! if(mount)
! renderObjectiveArrow(mount, getTeamColor(mount->getTeam()));
}
! }
! for(S32 i = 0; i < mZones.size(); i++)
! {
! if(mZones[i]->didRecentlyChangeTeam() && mZones[i]->getTeam() != -1)
{
! Color c = getTeamColor(mZones[i]->getTeam());
! if(mZones[i]->isFlashing())
! c *= 0.8;
! renderObjectiveArrow(mZones[i], c);
}
}
}
}
Index: CTFGame.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/CTFGame.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** CTFGame.cpp 4 Aug 2004 18:25:27 -0000 1.32
--- CTFGame.cpp 5 Oct 2004 00:16:34 -0000 1.33
***************
*** 39,42 ****
--- 39,60 ----
TNL_IMPLEMENT_NETOBJECT(CTFGameType);
+ void CTFGameType::addFlag(FlagItem *theFlag)
+ {
+ S32 i;
+ for(i = 0; i < mFlags.size(); i++)
+ {
+ if(mFlags[i] == NULL)
+ {
+ mFlags[i] = theFlag;
+ break;
+ }
+ }
+ if(i == mFlags.size())
+ mFlags.push_back(theFlag);
+
+ if(!isGhost())
+ addItemOfInterest(theFlag);
+ }
+
void CTFGameType::shipTouchFlag(Ship *theShip, FlagItem *theFlag)
{
***************
*** 109,112 ****
--- 127,176 ----
}
+ void CTFGameType::performProxyScopeQuery(GameObject *scopeObject, GameConnection *connection)
+ {
+ Parent::performProxyScopeQuery(scopeObject, connection);
+ S32 uTeam = scopeObject->getTeam();
+
+ for(S32 i = 0; i < mFlags.size(); i++)
+ {
+ if(mFlags[i]->isAtHome() || mFlags[i]->getZone())
+ connection->objectInScope(mFlags[i]);
+ else
+ {
+ Ship *mount = mFlags[i]->getMount();
+ if(mount && mount->getTeam() == uTeam)
+ {
+ connection->objectInScope(mount);
+ connection->objectInScope(mFlags[i]);
+ }
+ }
+ }
+ }
+
+
+ void CTFGameType::renderInterfaceOverlay(bool scoreboardVisible)
+ {
+ Parent::renderInterfaceOverlay(scoreboardVisible);
+ Ship *u = (Ship *) gClientGame->getConnectionToServer()->getControlObject();
+ if(!u)
+ return;
+
+ for(S32 i = 0; i < mFlags.size(); i++)
+ {
+ if(!mFlags[i].isValid())
+ continue;
+
+ if(mFlags[i]->isMounted())
+ {
+ Ship *mount = mFlags[i]->getMount();
+ if(mount)
+ renderObjectiveArrow(mount, getTeamColor(mount->getTeam()));
+ }
+ else
+ renderObjectiveArrow(mFlags[i], getTeamColor(mFlags[i]->getTeam()));
+ }
+ }
+
+
};
Index: item.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/item.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** item.cpp 1 Oct 2004 00:21:40 -0000 1.20
--- item.cpp 5 Oct 2004 00:16:34 -0000 1.21
***************
*** 27,31 ****
#include "item.h"
#include "ship.h"
!
#include "glutInclude.h"
--- 27,31 ----
#include "item.h"
#include "ship.h"
! #include "goalZone.h"
#include "glutInclude.h"
***************
*** 115,118 ****
--- 115,129 ----
}
+ void Item::setZone(GoalZone *theZone)
+ {
+ mZone = theZone;
+ setMaskBits(ZoneMask);
+ }
+
+ GoalZone *Item::getZone()
+ {
+ return mZone;
+ }
+
void Item::idle(GameObject::IdleCallPath path)
{
***************
*** 164,168 ****
stream->writeFlag(updateMask & WarpPositionMask);
}
! if(stream->writeFlag(MountMask) && stream->writeFlag(mIsMounted))
{
S32 index = connection->getGhostIndex(mMount);
--- 175,179 ----
stream->writeFlag(updateMask & WarpPositionMask);
}
! if(stream->writeFlag(updateMask & MountMask) && stream->writeFlag(mIsMounted))
{
S32 index = connection->getGhostIndex(mMount);
***************
*** 170,174 ****
stream->writeInt(index, GhostConnection::GhostIdBitSize);
else
! retMask = MountMask;
}
return retMask;
--- 181,198 ----
stream->writeInt(index, GhostConnection::GhostIdBitSize);
else
! retMask |= MountMask;
! }
! if(stream->writeFlag(updateMask & ZoneMask))
! {
! if(mZone.isValid())
! {
! S32 index = connection->getGhostIndex(mZone);
! if(stream->writeFlag(index != -1))
! stream->writeInt(index, GhostConnection::GhostIdBitSize);
! else
! retMask |= ZoneMask;
! }
! else
! stream->writeFlag(false);
}
return retMask;
***************
*** 203,206 ****
--- 227,238 ----
dismount();
}
+ if(stream->readFlag())
+ {
+ bool hasZone = stream->readFlag();
+ if(hasZone)
+ mZone = (GoalZone *) connection->resolveGhost(stream->readInt(GhostConnection::GhostIdBitSize));
+ else
+ mZone = NULL;
+ }
if(positionChanged)
Index: soccerGame.h
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/soccerGame.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** soccerGame.h 20 Jul 2004 18:31:43 -0000 1.11
--- soccerGame.h 5 Oct 2004 00:16:34 -0000 1.12
***************
*** 45,50 ****
--- 45,56 ----
GoalScore = 5,
};
+ Vector<GoalZone *> mGoals;
+ SafePtr<SoccerBallItem> mBall;
+
public:
void scoreGoal(StringTableEntry playerName, U32 goalTeamIndex);
+ void addZone(GoalZone *theZone);
+ void setBall(SoccerBallItem *theBall);
+ void renderInterfaceOverlay(bool scoreboardVisible);
enum {
***************
*** 74,77 ****
--- 80,84 ----
void idle(GameObject::IdleCallPath path);
void processArguments(S32 argc, const char **argv);
+ void onAddedToGame(Game *theGame);
bool collide(GameObject *hitObject);
|