Update of /cvsroot/opentnl/tnl/zap
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6427/zap
Modified Files:
UIGame.cpp UIMenus.cpp UIMenus.h gameType.cpp ship.cpp
Log Message:
Added option to render player name below ships. Name is rendered in a slightly brighter version of the team color.
Index: UIGame.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/UIGame.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** UIGame.cpp 21 Apr 2004 02:23:08 -0000 1.3
--- UIGame.cpp 21 Apr 2004 20:19:06 -0000 1.4
***************
*** 417,419 ****
}
! };
\ No newline at end of file
--- 417,419 ----
}
! };
Index: gameType.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/gameType.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** gameType.cpp 20 Apr 2004 19:25:48 -0000 1.3
--- gameType.cpp 21 Apr 2004 20:19:07 -0000 1.4
***************
*** 107,111 ****
spawnPoint = mTeams[teamIndex].spawnPoints[spawnIndex];
! Ship *newShip = new Ship(spawnPoint, mTeams[teamIndex].color);
newShip->addToGame(getGame());
theClient->setControlObject(newShip);
--- 107,111 ----
spawnPoint = mTeams[teamIndex].spawnPoints[spawnIndex];
! Ship *newShip = new Ship(mClientList[clientIndex].name, spawnPoint, mTeams[teamIndex].color);
newShip->addToGame(getGame());
theClient->setControlObject(newShip);
Index: UIMenus.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/UIMenus.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** UIMenus.cpp 20 Apr 2004 04:27:19 -0000 1.1
--- UIMenus.cpp 21 Apr 2004 20:19:07 -0000 1.2
***************
*** 158,161 ****
--- 158,162 ----
bool OptionsMenuUserInterface::controlsRelative = false;
bool OptionsMenuUserInterface::fullscreen = false;
+ bool OptionsMenuUserInterface::showNames = false;
OptionsMenuUserInterface::OptionsMenuUserInterface()
***************
*** 184,187 ****
--- 185,193 ----
menuItems.push_back("SET FULLSCREEN MODE");
+ if(showNames)
+ menuItems.push_back("SET NAMES HIDDEN");
+ else
+ menuItems.push_back("SET NAMES VISIBLE");
+
if(gClientGame->getConnectionToServer())
menuItems.push_back("RETURN TO GAME");
***************
*** 212,219 ****
void OptionsMenuUserInterface::processSelection(U32 index)
{
! if(index == 0)
! controlsRelative = !controlsRelative;
! else if(index == 1)
{
if(fullscreen)
{
--- 218,227 ----
void OptionsMenuUserInterface::processSelection(U32 index)
{
! switch(index)
{
+ case 0:
+ controlsRelative = !controlsRelative;
+ break;
+ case 1:
if(fullscreen)
{
***************
*** 224,237 ****
glutFullScreen();
fullscreen = !fullscreen;
! }
! if(index == 2)
! {
if(gClientGame->getConnectionToServer())
gGameUserInterface.activate();
else
gMainMenuUserInterface.activate();
! }
! else
! setupMenus();
}
--- 232,247 ----
glutFullScreen();
fullscreen = !fullscreen;
! break;
! case 2:
! showNames = !showNames;
! break;
! case 3:
if(gClientGame->getConnectionToServer())
gGameUserInterface.activate();
else
gMainMenuUserInterface.activate();
! break;
! };
! setupMenus();
}
Index: UIMenus.h
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/UIMenus.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** UIMenus.h 20 Apr 2004 04:27:19 -0000 1.1
--- UIMenus.h 21 Apr 2004 20:19:07 -0000 1.2
***************
*** 74,77 ****
--- 74,78 ----
static bool controlsRelative;
static bool fullscreen;
+ static bool showNames;
OptionsMenuUserInterface();
Index: ship.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/ship.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ship.cpp 20 Apr 2004 19:25:49 -0000 1.5
--- ship.cpp 21 Apr 2004 20:19:07 -0000 1.6
***************
*** 33,36 ****
--- 33,40 ----
#include "gameLoader.h"
#include "sfx.h"
+ #include "UI.h"
+ #include "UIMenus.h"
+
+ #include <stdio.h>
namespace Zap
***************
*** 39,43 ****
//------------------------------------------------------------------------
TNL_IMPLEMENT_NETOBJECT(Ship);
! Ship::Ship(Point p, Color c, F32 m) : MoveObject(p, CollisionRadius)
{
mObjectTypeMask = ShipType | MoveableType;
--- 43,48 ----
//------------------------------------------------------------------------
TNL_IMPLEMENT_NETOBJECT(Ship);
!
! Ship::Ship(StringTableEntry playerName, Point p, Color c, F32 m) : MoveObject(p, CollisionRadius)
{
mObjectTypeMask = ShipType | MoveableType;
***************
*** 58,61 ****
--- 63,68 ----
updateExtent();
lastFireTime = 0;
+
+ mPlayerName = playerName;
}
***************
*** 283,286 ****
--- 290,294 ----
if(stream->writeFlag(updateMask & InitialMask))
{
+ connection->packStringTableEntry(stream, mPlayerName);
stream->write(color.r);
stream->write(color.g);
***************
*** 342,345 ****
--- 350,354 ----
if(stream->readFlag())
{
+ mPlayerName = connection->unpackStringTableEntry(stream);
stream->read(&color.r);
stream->read(&color.g);
***************
*** 562,565 ****
--- 571,585 ----
glTranslatef(mMoveState[RenderState].pos.x, mMoveState[RenderState].pos.y, 0);
+ // Render name...
+ if(OptionsMenuUserInterface::showNames)
+ {
+ static char buff[255];
+ sprintf(buff, "%s", mPlayerName.getString());
+
+ // Make it a nice pastel
+ glColor3f(color.r*1.2,color.g*1.2,color.b*1.2);
+ UserInterface::drawString( UserInterface::getStringWidth(14, buff) * -0.5, 30, 14, buff );
+ }
+
F32 alpha = 1.0;
***************
*** 735,738 ****
--- 755,759 ----
if(mMountedItems[i].isValid())
mMountedItems[i]->renderItem(mMoveState[RenderState].pos);
+
}
|