Update of /cvsroot/opentnl/tnl/zap
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3672/zap
Modified Files:
UINameEntry.cpp UINameEntry.h game.cpp game.h
gameConnection.cpp gameConnection.h main.cpp ship.cpp ship.h
Log Message:
Added size optimizations on journal writes
Added flush of journal
Added debug break at end of journal playback
Index: gameConnection.h
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/gameConnection.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** gameConnection.h 3 May 2004 22:06:16 -0000 1.7
--- gameConnection.h 11 May 2004 18:26:25 -0000 1.8
***************
*** 178,184 ****
static GameConnection gClientList;
- // Time in milliseconds at which we were created.
- U32 mCreateTime;
-
GameConnection(Game *game = NULL);
~GameConnection();
--- 178,181 ----
Index: gameConnection.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/gameConnection.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** gameConnection.cpp 3 May 2004 22:06:16 -0000 1.10
--- gameConnection.cpp 11 May 2004 18:26:25 -0000 1.11
***************
*** 42,46 ****
{
mNext = mPrev = this;
- mCreateTime = Platform::getRealMilliseconds();
highSendIndex[0] = 0;
highSendIndex[1] = 0;
--- 42,45 ----
Index: ship.h
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/ship.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ship.h 7 May 2004 00:51:01 -0000 1.15
--- ship.h 11 May 2004 18:26:25 -0000 1.16
***************
*** 31,35 ****
#include "sparkManager.h"
#include "sfx.h"
!
namespace Zap
{
--- 31,35 ----
#include "sparkManager.h"
#include "sfx.h"
! #include "timer.h"
namespace Zap
{
***************
*** 71,75 ****
U32 interpTime;
! U32 lastFireTime;
F32 mHealth;
F32 mEnergy;
--- 71,75 ----
U32 interpTime;
! Timer mFireTimer;
F32 mHealth;
F32 mEnergy;
***************
*** 83,87 ****
Color color; // color of the ship
F32 mass; // mass of ship
- U32 timeUntilRemove; // when the ship is killed, it sticks around for a while to make sure that the kill message is propagated
bool hasExploded;
--- 83,86 ----
Index: game.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/game.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** game.cpp 5 May 2004 09:50:35 -0000 1.19
--- game.cpp 11 May 2004 18:26:24 -0000 1.20
***************
*** 60,65 ****
mNextMasterTryTime = 0;
- mLastIdleTime = Platform::getRealMilliseconds();
-
mNetInterface = new GameNetInterface(theBindAddress, this);
}
--- 60,63 ----
Index: game.h
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/game.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** game.h 8 May 2004 22:59:58 -0000 1.16
--- game.h 11 May 2004 18:26:25 -0000 1.17
***************
*** 85,89 ****
{
protected:
- U32 mLastIdleTime;
U32 mNextMasterTryTime;
F32 mGridSize;
--- 85,88 ----
Index: UINameEntry.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/UINameEntry.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** UINameEntry.cpp 20 Apr 2004 04:27:19 -0000 1.1
--- UINameEntry.cpp 11 May 2004 18:26:24 -0000 1.2
***************
*** 64,71 ****
void NameEntryUserInterface::idle(U32 t)
{
! U32 time = Platform::getRealMilliseconds();
! if(time - lastBlinkTime > BlinkTime)
{
! lastBlinkTime = time;
blink = !blink;
}
--- 64,70 ----
void NameEntryUserInterface::idle(U32 t)
{
! if(mBlinkTimer.update(t))
{
! mBlinkTimer.reset(BlinkTime);
blink = !blink;
}
Index: main.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/main.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** main.cpp 11 May 2004 02:45:27 -0000 1.26
--- main.cpp 11 May 2004 18:26:25 -0000 1.27
***************
*** 65,73 ****
TNL_DECLARE_JOURNAL_ENTRYPOINT(motion, (S32 x, S32 y));
TNL_DECLARE_JOURNAL_ENTRYPOINT(passivemotion, (S32 x, S32 y));
! TNL_DECLARE_JOURNAL_ENTRYPOINT(key, (U8 key, S32 x, S32 y));
! TNL_DECLARE_JOURNAL_ENTRYPOINT(keyup, (U8 key, S32 x, S32 y));
TNL_DECLARE_JOURNAL_ENTRYPOINT(mouse, (S32 button, S32 state, S32 x, S32 y));
! TNL_DECLARE_JOURNAL_ENTRYPOINT(specialkey, (S32 key, S32 x, S32 y));
! TNL_DECLARE_JOURNAL_ENTRYPOINT(specialkeyup, (S32 key, S32 x, S32 y));
TNL_DECLARE_JOURNAL_ENTRYPOINT(idle, (U32 timeDelta));
TNL_DECLARE_JOURNAL_ENTRYPOINT(display, ());
--- 65,73 ----
TNL_DECLARE_JOURNAL_ENTRYPOINT(motion, (S32 x, S32 y));
TNL_DECLARE_JOURNAL_ENTRYPOINT(passivemotion, (S32 x, S32 y));
! TNL_DECLARE_JOURNAL_ENTRYPOINT(key, (U8 key));
! TNL_DECLARE_JOURNAL_ENTRYPOINT(keyup, (U8 key));
TNL_DECLARE_JOURNAL_ENTRYPOINT(mouse, (S32 button, S32 state, S32 x, S32 y));
! TNL_DECLARE_JOURNAL_ENTRYPOINT(specialkey, (S32 key));
! TNL_DECLARE_JOURNAL_ENTRYPOINT(specialkeyup, (S32 key));
TNL_DECLARE_JOURNAL_ENTRYPOINT(idle, (U32 timeDelta));
TNL_DECLARE_JOURNAL_ENTRYPOINT(display, ());
***************
*** 111,118 ****
void key(unsigned char key, int x, int y)
{
! gZapJournal.key(key, x, y);
}
! TNL_IMPLEMENT_JOURNAL_ENTRYPOINT(ZapJournal, key, (U8 key, S32 x, S32 y))
{
if(UserInterface::current)
--- 111,118 ----
void key(unsigned char key, int x, int y)
{
! gZapJournal.key(key);
}
! TNL_IMPLEMENT_JOURNAL_ENTRYPOINT(ZapJournal, key, (U8 key))
{
if(UserInterface::current)
***************
*** 122,129 ****
void keyup(unsigned char key, int x, int y)
{
! gZapJournal.keyup(key, x, y);
}
! TNL_IMPLEMENT_JOURNAL_ENTRYPOINT(ZapJournal, keyup, (U8 key, S32 x, S32 y))
{
if(UserInterface::current)
--- 122,129 ----
void keyup(unsigned char key, int x, int y)
{
! gZapJournal.keyup(key);
}
! TNL_IMPLEMENT_JOURNAL_ENTRYPOINT(ZapJournal, keyup, (U8 key))
{
if(UserInterface::current)
***************
*** 172,179 ****
void specialkey(int key, int x, int y)
{
! gZapJournal.specialkey(key, x, y);
}
! TNL_IMPLEMENT_JOURNAL_ENTRYPOINT(ZapJournal, specialkey, (S32 key, S32 x, S32 y))
{
if(UserInterface::current)
--- 172,179 ----
void specialkey(int key, int x, int y)
{
! gZapJournal.specialkey(key);
}
! TNL_IMPLEMENT_JOURNAL_ENTRYPOINT(ZapJournal, specialkey, (S32 key))
{
if(UserInterface::current)
***************
*** 183,190 ****
void specialkeyup(int key, int x, int y)
{
! gZapJournal.specialkeyup(key, x, y);
}
! TNL_IMPLEMENT_JOURNAL_ENTRYPOINT(ZapJournal, specialkeyup, (S32 key, S32 x, S32 y))
{
if(UserInterface::current)
--- 183,190 ----
void specialkeyup(int key, int x, int y)
{
! gZapJournal.specialkeyup(key);
}
! TNL_IMPLEMENT_JOURNAL_ENTRYPOINT(ZapJournal, specialkeyup, (S32 key))
{
if(UserInterface::current)
Index: UINameEntry.h
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/UINameEntry.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** UINameEntry.h 20 Apr 2004 04:27:19 -0000 1.1
--- UINameEntry.h 11 May 2004 18:26:24 -0000 1.2
***************
*** 29,32 ****
--- 29,33 ----
#include "UI.h"
+ #include "timer.h"
namespace Zap
***************
*** 42,54 ****
U32 cursorPos;
bool blink;
! U32 lastBlinkTime;
protected:
const char *title;
public:
! NameEntryUserInterface()
{
title = "ENTER YOUR NAME:";
- lastBlinkTime = 0;
buffer[0] = 0;
memset(buffer, 0, sizeof(buffer));
--- 43,54 ----
U32 cursorPos;
bool blink;
! Timer mBlinkTimer;
protected:
const char *title;
public:
! NameEntryUserInterface() : mBlinkTimer(BlinkTime)
{
title = "ENTER YOUR NAME:";
buffer[0] = 0;
memset(buffer, 0, sizeof(buffer));
Index: ship.cpp
===================================================================
RCS file: /cvsroot/opentnl/tnl/zap/ship.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** ship.cpp 7 May 2004 00:51:00 -0000 1.25
--- ship.cpp 11 May 2004 18:26:25 -0000 1.26
***************
*** 61,67 ****
mass = m;
hasExploded = false;
- timeUntilRemove = 0;
updateExtent();
- lastFireTime = 0;
mPlayerName = playerName;
--- 61,65 ----
***************
*** 158,168 ****
}
if(theMove->fire)
{
! U32 currentTime = Platform::getRealMilliseconds();
! if(currentTime - lastFireTime > FireDelay)
{
mEnergy -= 0.5f;
! lastFireTime = currentTime;
Point dir(sin(mMoveState[ActualState].angle), cos(mMoveState[ActualState].angle) );
Point projVel = dir * 600 + dir * mMoveState[ActualState].vel.dot(dir);
--- 156,166 ----
}
+ mFireTimer.update(theMove->time);
if(theMove->fire)
{
! if(mFireTimer.getCurrent() == 0)
{
mEnergy -= 0.5f;
! mFireTimer.reset(FireDelay);
Point dir(sin(mMoveState[ActualState].angle), cos(mMoveState[ActualState].angle) );
Point projVel = dir * 600 + dir * mMoveState[ActualState].vel.dot(dir);
|