opentnl-cvs Mailing List for Torque Network Library (Page 22)
Brought to you by:
mark_frohnmayer,
s_alanet
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(141) |
May
(232) |
Jun
(103) |
Jul
(36) |
Aug
(35) |
Sep
(19) |
Oct
(20) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
(26) |
Mar
(2) |
Apr
(84) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ben G. <s_a...@us...> - 2004-05-07 00:51:11
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2705/zap Modified Files: sfx.cpp ship.cpp ship.h sparkManager.cpp Log Message: - Turbo noise is louder. - Adjusted turbo sound profile to make it fade properly on the screen. - Added spark grabbing logic so newest particle effects always have particles. - Tweaked energy usage for shield and turbo. Energy usage is faster tempo now. - Enabled client side prediction of energy (should give better feedback on when your shields are down). Index: ship.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/ship.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ship.h 5 May 2004 09:50:35 -0000 1.14 --- ship.h 7 May 2004 00:51:01 -0000 1.15 *************** *** 57,61 **** MaxControlObjectInterpDistance = 200, TrailCount = 2, ! RechargeRate = 3, // How many percent/second }; --- 57,61 ---- MaxControlObjectInterpDistance = 200, TrailCount = 2, ! RechargeRate = 6, // How many percent/second }; *************** *** 93,96 **** --- 93,97 ---- void render(); Ship(StringTableEntry playerName="", Point p = Point(0,0), F32 m = 1.0); + ~Ship(); F32 getHealth() { return mHealth; } Index: sfx.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sfx.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** sfx.cpp 5 May 2004 09:50:35 -0000 1.10 --- sfx.cpp 7 May 2004 00:50:59 -0000 1.11 *************** *** 43,47 **** { "ship_explode.wav", false, 1.0, false, 300, 1000 }, { "ship_heal.wav", false, 1.0, false, 300, 1000 }, ! { "ship_turbo.wav", false, 1.0, true, 300, 1000 }, { "flag_capture.wav", true, 0.45f, false, 0, 0 }, { "flag_drop.wav", true, 0.45f, false, 0, 0 }, --- 43,47 ---- { "ship_explode.wav", false, 1.0, false, 300, 1000 }, { "ship_heal.wav", false, 1.0, false, 300, 1000 }, ! { "ship_turbo.wav", false, 1.0, true, 150, 500 }, { "flag_capture.wav", true, 0.45f, false, 0, 0 }, { "flag_drop.wav", true, 0.45f, false, 0, 0 }, Index: sparkManager.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sparkManager.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sparkManager.cpp 6 May 2004 01:36:01 -0000 1.7 --- sparkManager.cpp 7 May 2004 00:51:01 -0000 1.8 *************** *** 49,60 **** U32 firstFreeIndex = 0; Spark gSparks[MaxSparks]; void emitSpark(Point pos, Point vel, Color color, F32 ttl) { if(firstFreeIndex >= MaxSparks) ! return; ! Spark *s = gSparks + firstFreeIndex; ! firstFreeIndex++; s->pos = pos; --- 49,71 ---- U32 firstFreeIndex = 0; + U32 grabIndex = MaxSparks/2; Spark gSparks[MaxSparks]; void emitSpark(Point pos, Point vel, Color color, F32 ttl) { + Spark *s; + if(firstFreeIndex >= MaxSparks) ! { ! s = gSparks + grabIndex; ! ! // Bump an arbitrary amount ahead to avoid noticable artifacts. ! grabIndex = (grabIndex + 100) % MaxSparks; ! } ! else ! { ! s = gSparks + firstFreeIndex; ! firstFreeIndex++; ! } s->pos = pos; *************** *** 83,90 **** theSpark->ttl -= dT; theSpark->pos += theSpark->vel * dT; ! if(theSpark->ttl > 2) theSpark->alpha = 1; else ! theSpark->alpha = theSpark->ttl * 0.5; i++; } --- 94,101 ---- theSpark->ttl -= dT; theSpark->pos += theSpark->vel * dT; ! if(theSpark->ttl > 1) theSpark->alpha = 1; else ! theSpark->alpha = theSpark->ttl; i++; } Index: ship.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/ship.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ship.cpp 5 May 2004 09:50:35 -0000 1.24 --- ship.cpp 7 May 2004 00:51:00 -0000 1.25 *************** *** 77,80 **** --- 77,89 ---- } + Ship::~Ship() + { + if(mTurboNoise.isValid()) + { + mTurboNoise->setGain(0.f); + mTurboNoise->stop(); + } + } + void Ship::processArguments(S32 argc, const char **argv) { *************** *** 175,179 **** void Ship::burnEnergy( U32 dT ) { ! if(isGhost()) return; F32 scaleFactor = ((F32)dT) / 1000.f; --- 184,188 ---- void Ship::burnEnergy( U32 dT ) { ! // if(isGhost()) return; F32 scaleFactor = ((F32)dT) / 1000.f; *************** *** 194,203 **** if(mShield) { ! mEnergy -= 7.0f * scaleFactor; } if(mTurbo) { ! mEnergy -= 20.0f * scaleFactor; } --- 203,212 ---- if(mShield) { ! mEnergy -= 15.0f * scaleFactor; } if(mTurbo) { ! mEnergy -= 15.0f * scaleFactor; } *************** *** 205,209 **** if(mEnergy < 100.f) { ! mEnergy += (F32)(dT * RechargeRate) / 1000.f; if(mEnergy < 0.f) --- 214,220 ---- if(mEnergy < 100.f) { ! // If we're not doing anything, recharge. ! if(!(mShield || mTurbo)) ! mEnergy += (F32)(dT * RechargeRate) / 1000.f; if(mEnergy < 0.f) *************** *** 221,227 **** // Factor in shields ! if(mShield && mEnergy >= 10.f) { ! mEnergy -= 10.f; return; } --- 232,238 ---- // Factor in shields ! if(mShield && mEnergy >= 20.f) { ! mEnergy -= 20.f; return; } |
From: Ben G. <s_a...@us...> - 2004-05-07 00:51:08
|
Update of /cvsroot/opentnl/tnl/exe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2705/exe Modified Files: ship_turbo.wav Log Message: - Turbo noise is louder. - Adjusted turbo sound profile to make it fade properly on the screen. - Added spark grabbing logic so newest particle effects always have particles. - Tweaked energy usage for shield and turbo. Energy usage is faster tempo now. - Enabled client side prediction of energy (should give better feedback on when your shields are down). Index: ship_turbo.wav =================================================================== RCS file: /cvsroot/opentnl/tnl/exe/ship_turbo.wav,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsG6X2oc and /tmp/cvsmLmZ21 differ |
From: Mark F. <mar...@us...> - 2004-05-06 01:55:30
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7469/zap Modified Files: main.cpp Log Message: Removed SparkManager init from main.cpp Index: main.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/main.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** main.cpp 5 May 2004 09:50:35 -0000 1.21 --- main.cpp 6 May 2004 01:55:21 -0000 1.22 *************** *** 368,372 **** if(hasClient) { - SparkManager::init(); SFXObject::init(); glutInitWindowSize(800, 600); --- 368,371 ---- |
From: Mark F. <mar...@us...> - 2004-05-06 01:36:09
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4906/zap Modified Files: sparkManager.cpp sparkManager.h Log Message: New Vector resizing scheme to fix reallocation bug in vector Rolled back Ben's sparkManager changes Index: sparkManager.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sparkManager.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sparkManager.h 5 May 2004 09:50:35 -0000 1.5 --- sparkManager.h 6 May 2004 01:36:01 -0000 1.6 *************** *** 42,46 **** void tick( F32 dT); void render(); - void init(); }; --- 42,45 ---- Index: sparkManager.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sparkManager.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sparkManager.cpp 5 May 2004 09:50:35 -0000 1.6 --- sparkManager.cpp 6 May 2004 01:36:01 -0000 1.7 *************** *** 42,46 **** F32 ttl; Point vel; - Spark *mNext, *mPrev; }; --- 42,45 ---- *************** *** 49,133 **** }; - Spark *mFree; - Spark *mActive; - Spark *mActiveTail; - U32 firstFreeIndex = 0; Spark gSparks[MaxSparks]; - void init() - { - // Put all the sparks (from gSparks) onto the free list and mark the tail. - U32 i; - for(i=0; i<MaxSparks-1; i++) - gSparks[i].mNext = &gSparks[i+1]; - gSparks[i+1].mNext = NULL; - - mFree = gSparks; - - // No active sparks yet. - mActive = NULL; - mActiveTail = NULL; - } - - Spark *getSpark() - { - // Are there any in the free list? - Spark *newSpark = NULL; - - if(mFree) - { - newSpark = mFree; - mFree = mFree->mNext; - if(mFree) mFree->mPrev = NULL; - } - else - { - // Reuse one from the active list... - if(mActiveTail) - { - newSpark = mActiveTail; - - if(newSpark->mPrev) newSpark->mPrev->mNext = NULL; - mActiveTail = newSpark->mPrev; - } - else - return NULL; - } - - // Put it at the head of the active list - newSpark->mPrev = NULL; - newSpark->mNext = mActive; - if(mActive) mActive->mPrev = newSpark; - mActive = newSpark; - - return newSpark; - } - - void freeSpark(Spark *s) - { - // Remove it safely from the list it's in... - if(s->mNext) s->mNext->mPrev = s->mPrev; - if(s->mPrev) s->mPrev->mNext = s->mNext; - if(s==mActive) mActive = mActive->mNext; - - // Update tail info - if(s->mNext == NULL) - mActiveTail = s->mPrev; - - // And add it to the free list - s->mNext = mFree; - s->mPrev = NULL; - if(mFree) mFree->mPrev = s; - mFree = s; - - } - void emitSpark(Point pos, Point vel, Color color, F32 ttl) { ! Spark *s = getSpark(); ! ! if(!s) return; s->pos = pos; --- 48,60 ---- }; U32 firstFreeIndex = 0; Spark gSparks[MaxSparks]; void emitSpark(Point pos, Point vel, Color color, F32 ttl) { ! if(firstFreeIndex >= MaxSparks) return; + Spark *s = gSparks + firstFreeIndex; + firstFreeIndex++; s->pos = pos; *************** *** 144,158 **** void tick( F32 dT ) { ! Spark *theSpark = mActive; ! while(theSpark) { if(theSpark->ttl <= dT) { ! Spark *t = theSpark->mNext; ! freeSpark(theSpark); ! theSpark = t; ! continue; // Skip to the next one... } ! theSpark->ttl -= dT; theSpark->pos += theSpark->vel * dT; --- 71,84 ---- void tick( F32 dT ) { ! for(U32 i = 0; i < firstFreeIndex; ) { + Spark *theSpark = gSparks + i; if(theSpark->ttl <= dT) { ! firstFreeIndex--; ! *theSpark = gSparks[firstFreeIndex]; } ! else ! { theSpark->ttl -= dT; theSpark->pos += theSpark->vel * dT; *************** *** 161,166 **** else theSpark->alpha = theSpark->ttl * 0.5; ! ! theSpark = theSpark->mNext; } } --- 87,92 ---- else theSpark->alpha = theSpark->ttl * 0.5; ! i++; ! } } } *************** *** 175,203 **** glEnableClientState(GL_VERTEX_ARRAY); ! // Prepare buffers... ! static struct SparkRender ! { ! Point pos; ! Color color; ! F32 alpha; ! } renderData[MaxSparks]; ! ! Spark *theSpark = mActive; ! SparkRender *r = renderData; ! while(theSpark) ! { ! r->pos = theSpark->pos; ! r->color = theSpark->color; ! r->alpha = theSpark->alpha; ! ! // Advance pointers ! r++; ! theSpark = theSpark->mNext; ! } ! ! glVertexPointer(2, GL_FLOAT, sizeof(SparkRender), &renderData[0].pos); ! glColorPointer(4, GL_FLOAT , sizeof(SparkRender), &renderData[0].color); ! glDrawArrays(GL_POINTS, 0, (r - renderData)); glDisableClientState(GL_COLOR_ARRAY); --- 101,108 ---- glEnableClientState(GL_VERTEX_ARRAY); ! glVertexPointer(2, GL_FLOAT, sizeof(Spark), &gSparks[0].pos); ! glColorPointer(4, GL_FLOAT , sizeof(Spark), &gSparks[0].color); ! glDrawArrays(GL_POINTS, 0, firstFreeIndex); glDisableClientState(GL_COLOR_ARRAY); *************** *** 212,215 **** --- 117,121 ---- for(U32 i = 0; i < (500.0 * size); i++) { + F32 th = Random::readF() * 2 * 3.14; F32 f = (Random::readF() * 2 - 1) * 400 * size; *************** *** 224,227 **** --- 130,134 ---- for(U32 i = 0; i < (500.0 * size); i++) { + F32 th = Random::readF() * 2 * 3.14; F32 f = (Random::readF() * 2 - 1) * 400 * size; *************** *** 239,242 **** --- 146,150 ---- for(U32 i = 0; i < (250.0 * size); i++) { + F32 th = Random::readF() * 2 * 3.14; F32 f = (Random::readF() * 0.1 + 0.9) * 200 * size; *************** *** 264,268 **** mDropFreq = dropFrequency; mLength = len; - mNodes.clear(); registerTrail(); } --- 172,175 ---- |
From: Mark F. <mar...@us...> - 2004-05-06 01:36:09
|
Update of /cvsroot/opentnl/tnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4906/tnl Modified Files: tnlVector.h Log Message: New Vector resizing scheme to fix reallocation bug in vector Rolled back Ben's sparkManager changes Index: tnlVector.h =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnlVector.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tnlVector.h 3 May 2004 22:06:16 -0000 1.2 --- tnlVector.h 6 May 2004 01:36:01 -0000 1.3 *************** *** 310,313 **** --- 310,320 ---- destroy(size, oldSize); mElementCount = size; + + if(!mElementCount) + { + free(mArray); + mArray = NULL; + mArraySize = 0; + } return mElementCount; } *************** *** 413,417 **** template<class T> inline void Vector<T>::clear() { ! mElementCount = 0; } --- 420,424 ---- template<class T> inline void Vector<T>::clear() { ! setSize(0); } *************** *** 561,570 **** template<class T> inline bool Vector<T>::resize(U32 ecount) { ! #ifdef DEBUG_GUARD ! return VectorResize(&mArraySize, &mElementCount, (void**) &mArray, ecount, sizeof(T), ! mFileAssociation, mLineAssociation); ! #else ! return VectorResize(&mArraySize, &mElementCount, (void**) &mArray, ecount, sizeof(T)); ! #endif } --- 568,586 ---- template<class T> inline bool Vector<T>::resize(U32 ecount) { ! U32 blk = VectorBlockSize - (ecount % VectorBlockSize); ! U32 newCount = ecount + ((blk != VectorBlockSize) ? blk : 0); ! ! T *array = (T *) malloc(sizeof(T) * newCount); ! ! for(U32 i = 0; i < mElementCount; i++) ! { ! constructInPlace(&array[i], &mArray[i]); ! destructInPlace(&mArray[i]); ! } ! free(mArray); ! mArray = array; ! mArraySize = newCount; ! mElementCount = ecount; ! return true; } |
From: Mark F. <mar...@us...> - 2004-05-06 00:33:47
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27643/zap Modified Files: CTFGame.cpp CTFGame.h gameType.cpp gameType.h soccerGame.cpp soccerGame.h Log Message: Added tnlMethodDispatch files Split RPC argument parsing and dispatch into seperate module Moved compressed RPC types into tnlTypes.h Removed StringTableEntry from being able to be transmitted as an argument to RPCs Added StringTableEntryRef (and typedef) as valid RPC type Updated all projects to reflect change to StringTableEntryRef Index: gameType.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameType.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** gameType.cpp 3 May 2004 22:06:16 -0000 1.17 --- gameType.cpp 6 May 2004 00:33:39 -0000 1.18 *************** *** 404,408 **** } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddClient, (StringTableEntry name, bool isMyClient), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { --- 404,408 ---- } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddClient, (StringTableEntryRef name, bool isMyClient), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { *************** *** 432,436 **** } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cRemoveClient, (StringTableEntry name), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { --- 432,436 ---- } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cRemoveClient, (StringTableEntryRef name), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { *************** *** 440,444 **** } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddTeam, (StringTableEntry teamName, F32 r, F32 g, F32 b), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { --- 440,444 ---- } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddTeam, (StringTableEntryRef teamName, F32 r, F32 g, F32 b), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { *************** *** 457,461 **** } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cClientJoinedTeam, (StringTableEntry name, U32 teamIndex), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { --- 457,461 ---- } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cClientJoinedTeam, (StringTableEntryRef name, U32 teamIndex), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { *************** *** 511,515 **** extern Color gTeamChatColor; ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cDisplayChatMessage, (bool global, StringTableEntry clientName, const char *message), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { --- 511,515 ---- extern Color gTeamChatColor; ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cDisplayChatMessage, (bool global, StringTableEntryRef clientName, const char *message), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { *************** *** 551,555 **** } ! TNL_DECLARE_RPC_MEM_ENUM(GameType, MaxPing); TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cScoreboardUpdate, (const Vector<RangedU32<0, GameType::MaxPing> > &pingTimes, const Vector<Int<24> > &scores), --- 551,555 ---- } ! TNL_DECLARE_ENUM(GameType::MaxPing); TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cScoreboardUpdate, (const Vector<RangedU32<0, GameType::MaxPing> > &pingTimes, const Vector<Int<24> > &scores), *************** *** 566,570 **** } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cKillMessage, (StringTableEntry victim, StringTableEntry killer), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { --- 566,570 ---- } ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cKillMessage, (StringTableEntryRef victim, StringTableEntryRef killer), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { Index: soccerGame.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/soccerGame.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** soccerGame.cpp 3 May 2004 22:06:16 -0000 1.3 --- soccerGame.cpp 6 May 2004 00:33:39 -0000 1.4 *************** *** 164,168 **** } ! TNL_IMPLEMENT_NETOBJECT_RPC(SoccerGameType, s2cSoccerScoreMessage, (U32 msgIndex, StringTableEntry clientName, U32 teamIndex), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { --- 164,168 ---- } ! TNL_IMPLEMENT_NETOBJECT_RPC(SoccerGameType, s2cSoccerScoreMessage, (U32 msgIndex, StringTableEntryRef clientName, U32 teamIndex), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { Index: CTFGame.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/CTFGame.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** CTFGame.cpp 3 May 2004 22:06:16 -0000 1.20 --- CTFGame.cpp 6 May 2004 00:33:39 -0000 1.21 *************** *** 296,300 **** } ! TNL_IMPLEMENT_NETOBJECT_RPC(CTFGameType, s2cCTFMessage, (U32 messageIndex, StringTableEntry clientName, U32 teamIndex), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { --- 296,300 ---- } ! TNL_IMPLEMENT_NETOBJECT_RPC(CTFGameType, s2cCTFMessage, (U32 messageIndex, StringTableEntryRef clientName, U32 teamIndex), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) { Index: gameType.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameType.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gameType.h 3 May 2004 22:06:16 -0000 1.8 --- gameType.h 6 May 2004 00:33:39 -0000 1.9 *************** *** 124,139 **** virtual void performProxyScopeQuery(GameObject *scopeObject, GameConnection *connection); ! 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)); ! TNL_DECLARE_RPC(s2cDisplayChatMessage, (bool global, StringTableEntry clientName, const char *message)); ! TNL_DECLARE_RPC(s2cKillMessage, (StringTableEntry victim, StringTableEntry killer)); TNL_DECLARE_RPC(s2cScoreboardUpdate, (const Vector<RangedU32<0, MaxPing> > &pingTimes, const Vector<Int<24> > &scores)); --- 124,139 ---- virtual void performProxyScopeQuery(GameObject *scopeObject, GameConnection *connection); ! TNL_DECLARE_RPC(s2cAddTeam, (StringTableEntryRef teamName, F32 r, F32 g, F32 b)); TNL_DECLARE_RPC(s2cSetTeamScore, (U32 teamIndex, U32 score)); ! TNL_DECLARE_RPC(s2cAddClient, (StringTableEntryRef clientName, bool isMyClient)); ! TNL_DECLARE_RPC(s2cRemoveClient, (StringTableEntryRef clientName)); TNL_DECLARE_RPC(c2sChangeTeams, ()); ! TNL_DECLARE_RPC(s2cClientJoinedTeam, (StringTableEntryRef clientName, U32 teamIndex)); TNL_DECLARE_RPC(c2sSendChat, (bool global, const char *message)); ! TNL_DECLARE_RPC(s2cDisplayChatMessage, (bool global, StringTableEntryRef clientName, const char *message)); ! TNL_DECLARE_RPC(s2cKillMessage, (StringTableEntryRef victim, StringTableEntryRef killer)); TNL_DECLARE_RPC(s2cScoreboardUpdate, (const Vector<RangedU32<0, MaxPing> > &pingTimes, const Vector<Int<24> > &scores)); Index: CTFGame.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/CTFGame.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CTFGame.h 2 May 2004 06:27:41 -0000 1.7 --- CTFGame.h 6 May 2004 00:33:39 -0000 1.8 *************** *** 67,71 **** }; ! TNL_DECLARE_RPC(s2cCTFMessage, (U32 messageIndex, StringTableEntry clientName, U32 teamIndex)); TNL_DECLARE_CLASS(CTFGameType); }; --- 67,71 ---- }; ! TNL_DECLARE_RPC(s2cCTFMessage, (U32 messageIndex, StringTableEntryRef clientName, U32 teamIndex)); TNL_DECLARE_CLASS(CTFGameType); }; Index: soccerGame.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/soccerGame.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** soccerGame.h 3 May 2004 22:06:16 -0000 1.3 --- soccerGame.h 6 May 2004 00:33:39 -0000 1.4 *************** *** 59,63 **** }; ! TNL_DECLARE_RPC(s2cSoccerScoreMessage, (U32 msgIndex, StringTableEntry clientName, U32 teamIndex)); TNL_DECLARE_CLASS(SoccerGameType); }; --- 59,63 ---- }; ! TNL_DECLARE_RPC(s2cSoccerScoreMessage, (U32 msgIndex, StringTableEntryRef clientName, U32 teamIndex)); TNL_DECLARE_CLASS(SoccerGameType); }; |
Update of /cvsroot/opentnl/tnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27643/tnl Modified Files: ghostConnection.cpp rpc.cpp tnl.vcproj tnlByteBuffer.h tnlNetObject.h tnlRPC.h tnlTypes.h Added Files: tnlMethodDispatch.cpp tnlMethodDispatch.h Log Message: Added tnlMethodDispatch files Split RPC argument parsing and dispatch into seperate module Moved compressed RPC types into tnlTypes.h Removed StringTableEntry from being able to be transmitted as an argument to RPCs Added StringTableEntryRef (and typedef) as valid RPC type Updated all projects to reflect change to StringTableEntryRef --- NEW FILE: tnlMethodDispatch.cpp --- //----------------------------------------------------------------------------------- // // Torque Network Library // Copyright (C) 2004 GarageGames.com, Inc. // For more information see http://www.opentnl.org // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // For use in products that are not compatible with the terms of the GNU // General Public License, alternative licensing options are available // from GarageGames.com. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // //------------------------------------------------------------------------------------ #include "tnlMethodDispatch.h" #include "tnlNetStringTable.h" namespace TNL { void *gBasePtr = NULL; void *gThisPtr = NULL; void *gStackPtr = NULL; struct TypeInfo { const char *name; U32 size; bool allowedAsArg; bool allowedInVector; }; enum ArgTypeId { TypeS8, TypeU8, TypeS16, TypeU16, TypeS32, TypeU32, TypeF32, TypeSignedInt, TypeInt, TypeSignedFloat, TypeFloat, TypeString, TypeRangedU32, TypeBool, TypeStringTableEntryRef, TypeStringTableEntry, TypeByteBufferPtr, TypeIPAddressRef, TypeIPAddress, NumTypes, }; static TypeInfo gTypes[] = { { "S8", sizeof(S8), true, true }, { "U8", sizeof(U8), true, true }, { "S16", sizeof(S16), true, true }, { "U16", sizeof(U16), true, true }, { "S32", sizeof(S32), true, true }, { "U32", sizeof(U32), true, true }, { "F32", sizeof(F32), true, true }, { "SignedInt<", sizeof(S32), true, true }, { "Int<", sizeof(U32), true, true }, { "SignedFloat<", sizeof(F32), true, true }, { "Float<", sizeof(F32), true, true }, { "const char *", sizeof(const char *), true, true }, { "RangedU32<", sizeof(U32), true, true }, { "bool", sizeof(bool), true, true }, { "StringTableEntryRef", sizeof(StringTableEntryRef), true, false }, { "StringTableEntry", sizeof(StringTableEntry), false, true }, { "ByteBufferRef", sizeof(ByteBufferRef), true, false }, { "IPAddressRef", sizeof(IPAddressRef), true, false }, { "IPAddress", sizeof(IPAddress), false, true }, { 0, 0, 0, 0 }, }; MethodEnum *MethodEnum::mLinkedList = NULL; U32 MethodArgList::getValue(const char *buffer) { while(*buffer == ' ') buffer++; if(buffer[0] >= '0' && buffer[0] <= '9') return atoi(buffer); else { U32 len = 0; while((buffer[len] >= 'a' && buffer[len] <= 'z') || (buffer[len] >= 'A' && buffer[len] <= 'Z') || (buffer[len] == ':' || buffer[len] == '_')) len++; for(MethodEnum *walk = MethodEnum::mLinkedList; walk; walk = walk->mNext) { if(!strncmp(buffer, walk->mSymbol, len) && walk->mSymbol[len] == 0) return walk->mValue; } } TNLAssert(0, "Undeclared method enumeration! Use TNL_DECLARE_ENUM."); return 0; } typedef StringTableEntry &StringTableEntryType; MethodArgList::MethodArgList(const char *className, const char *anArgList) { argListString = anArgList; mClassName = className; // first strip off the leading paren. const char *aptr = argListString + 1; U32 numFloats = 0; for(;;) { U32 type = 0; MethodArgInfo info; // remove leading spaces while(*aptr == ' ') aptr++; if(*aptr == ')') break; info.isVector = false; // this can let some errors through - for example we don't check that // the vector is passed as a reference, but it has to be. // Ideally we should do a simple lexer/parser for the argument // lists in flex/bison. This would let us grow the parser a lot // more easily. if(!strncmp(aptr, "const Vector<", 13)) { info.isVector = true; aptr += 13; } U32 len = 0; // grab the type off the arg list pointer: for(;type < NumTypes; type++) { // figure out the base type: len = strlen(gTypes[type].name); if(!strncmp(aptr, gTypes[type].name, len)) break; } TNLAssert(type != NumTypes, "Invalid type in method declaration."); TNLAssert(!info.isVector || gTypes[type].allowedInVector, ("Invalid vector subtype (%s) in method declaration.", aptr)); TNLAssert(info.isVector || gTypes[type].allowedAsArg, ("Invalid type (%s) in method declaration.", aptr)); aptr += len; info.argType = type; // figure out the template arguments, if any: if(type == TypeSignedInt || type == TypeInt || type == TypeSignedFloat || type == TypeFloat || type == TypeRangedU32) { const char *walk = aptr; aptr = strchr(aptr, '>') + 1; if(type == TypeRangedU32) { info.rangeStart = getValue(walk); info.rangeEnd = getValue(strchr(walk, ',') + 1); } else info.bitCount = getValue(walk); } if(type == TypeF32 || type == TypeFloat || type == TypeSignedFloat) { if(numFloats < 13) { floatRegOffsets[numFloats] = argList.size() * sizeof(U32); numFloats++; } } argList.push_back(info); // lop off the name of the var... aptr = strchr(aptr, ','); if(!aptr) break; aptr++; } if(numFloats < 13) floatRegOffsets[numFloats] = -1; } #ifdef TNL_CPU_PPC U32 gRegisterSaves[8 + 13 + 1]; #endif void MethodArgList::marshall(MarshalledCall *theEvent) { PacketStream bstream; #if defined (TNL_CPU_PPC) U32 *intArg = gRegisterSaves; F32 *floatArg = (F32 *) (&gRegisterSaves[8]); void *stackPtr = (void *) gRegisterSaves[8 + 13]; stackPtr = (void *) (*((U8 **) stackPtr) + 24); // advance past linkage area of stack intArg++; // get rid of the "this" pointer. bool floatInRegs = true; #else U8 *ptr = (U8 *) gBasePtr; ptr += 4; // get rid of the return address and saved base ptr. #endif U32 whichSTE = 0; for(S32 i = 0; i < argList.size(); i++) { #if !defined (TNL_CPU_PPC) void *arg = ptr + sizeof(U32) * i; U32 *intArg = (U32 *) arg; F32 *floatArg = (F32 *) arg; #else if(!floatInRegs) floatArg = ((F32 *) stackPtr) + i + 1; // the +1 skips the this pointer which is an arg, but not in the arg list. #endif U32 count = 1; U32 *intArgSave = intArg; F32 *floatArgSave = floatArg; if(argList[i].isVector) { VectorRep *vector = *((VectorRep **) intArg); bstream.writeInt(vector->elementCount, VectorSizeBitSize); intArg = (U32 *) vector->array; floatArg = (F32 *) vector->array; count = vector->elementCount; } for(U32 j = 0; j < count; j++) { switch(argList[i].argType) { case TypeS8: bstream.write(*((S8 *) intArg)); break; case TypeU8: bstream.write(*((U8 *) intArg)); break; case TypeS16: bstream.write(*((S16 *) intArg)); break; case TypeU16: bstream.write(*((U16 *) intArg)); break; case TypeS32: bstream.write(*((S32 *) intArg)); break; case TypeU32: bstream.write(*((U32 *) intArg)); break; case TypeF32: bstream.write(*((F32 *) floatArg)); floatArg++; break; case TypeSignedInt: bstream.writeSignedInt(*((S32 *) intArg), argList[i].bitCount); break; case TypeInt: bstream.writeInt(*((U32 *) intArg), argList[i].bitCount); break; case TypeSignedFloat: bstream.writeSignedFloat(*((F32 *) floatArg), argList[i].bitCount); floatArg++; break; case TypeFloat: bstream.writeFloat(*((F32 *) floatArg), argList[i].bitCount); floatArg++; break; case TypeString: bstream.writeString(*((const char **) intArg)); break; case TypeStringTableEntryRef: theEvent->mSTEs.push_back(**((StringTableEntry **) intArg)); break; case TypeStringTableEntry: theEvent->mSTEs.push_back(*((StringTableEntry *) intArg)); break; case TypeRangedU32: bstream.writeRangedU32(*((U32 *) intArg), argList[i].rangeStart, argList[i].rangeEnd); break; case TypeBool: bstream.writeFlag(*((bool *) intArg)); break; case TypeByteBufferPtr: { ByteBuffer *buffer = *((ByteBuffer **) intArg); bstream.writeInt(buffer->getBufferSize(), ByteBufferSizeBitSize); bstream.write(buffer->getBufferSize(), buffer->getBuffer()); } break; case TypeIPAddressRef: bstream.write((*((IPAddress **) intArg))->netNum); bstream.write((*((IPAddress **) intArg))->port); break; case TypeIPAddress: bstream.write(((IPAddress *) intArg)->netNum); bstream.write(((IPAddress *) intArg)->port); break; } if(count != 1) { *((U8 **) &intArg) += gTypes[argList[i].argType].size; // float args already get incremented above //*((U8 **) &floatArg) += typeSizes[argList[i].argType]; } } if(argList[i].isVector) { intArg = intArgSave; floatArg = floatArgSave; } intArg++; #ifdef TNL_CPU_PPC if(i == 6) // we're on our 8th register... start reading ints from the stack: { intArg = ((U32 *) stackPtr) + 8; // skip 8 registers. } if(floatArg == (F32 *) &gRegisterSaves[8+13]) // we're on our 13th register... start reading floats from the stack: floatInRegs = false; #endif } theEvent->marshalledData.setBuffer(bstream.getBuffer(), bstream.getBytePosition()); theEvent->marshalledData.takeOwnership(); theEvent->marshalledData.setBitPosition(bstream.getBitPosition()); } static U8 rpcReadData[MethodArgList::MaxRPCDataSize]; static U32 rpcReadOffsets[MethodArgList::MaxOffsets]; static U8 *rpcSTEOffsets[MethodArgList::MaxOffsets]; static U32 rpcSTEIndex[MethodArgList::MaxOffsets]; static U32 rpcNumSTEs; static U32 rpcNumOffsets; inline U8 *allocSpace(U8 **offsetDest, U32 ¤tSize, U32 requestSize) { if(rpcNumOffsets >= MethodArgList::MaxOffsets) return NULL; currentSize = fourByteAlign(currentSize); rpcReadOffsets[rpcNumOffsets++] = ((U8 *) offsetDest) - rpcReadData; if(requestSize + currentSize > MethodArgList::MaxRPCDataSize) return NULL; U8 *ret = rpcReadData + currentSize; *offsetDest = ret; currentSize += requestSize; return ret; } bool MethodArgList::unmarshall(BitStream *bstream, MarshalledCall *theEvent) { rpcNumOffsets = 0; rpcNumSTEs = 0; U32 rpcCurrentSTEIndex = 0; U32 currentSize = sizeof(U32) * argList.size(); #ifdef TNL_CPU_PPC currentSize = getMax(currentSize, U32(28)); #endif U32 whichSTE = 0; for(S32 i = 0; i < argList.size(); i++) { U8 *arg = (rpcReadData + sizeof(U32) * i); U32 count = 1; if(argList[i].isVector) { VectorRep *vector = (VectorRep *) allocSpace((U8 **) arg, currentSize, sizeof(VectorRep)); if(!vector) goto errorOut; vector->arraySize = bstream->readInt(VectorSizeBitSize); vector->elementCount = vector->arraySize; if(argList[i].argType == TypeStringTableEntry) { rpcSTEIndex[rpcNumSTEs] = rpcCurrentSTEIndex; rpcSTEOffsets[rpcNumSTEs] = (U8 *) &vector->array; rpcNumSTEs++; rpcCurrentSTEIndex += vector->elementCount; continue; } else { vector->array = allocSpace(&vector->array, currentSize, vector->elementCount * gTypes[argList[i].argType].size); if(!vector->array) goto errorOut; *((VectorRep **) arg) = vector; count = vector->elementCount; arg = vector->array; } } for(U32 j = 0; j < count; j++) { switch(argList[i].argType) { case TypeS8: bstream->read((S8 *) arg); break; case TypeU8: bstream->read((U8 *) arg); break; case TypeS16: bstream->read((S16 *) arg); break; case TypeU16: bstream->read((S16 *) arg); break; case TypeS32: bstream->read((S32 *) arg); break; case TypeU32: bstream->read((U32 *) arg); break; case TypeF32: bstream->read((F32 *) arg); break; case TypeSignedInt: *((S32 *) arg) = bstream->readSignedInt(argList[i].bitCount); break; case TypeInt: *((U32 *) arg) = bstream->readInt(argList[i].bitCount); break; case TypeSignedFloat: *((F32 *) arg) = bstream->readSignedFloat(argList[i].bitCount); break; case TypeFloat: *((F32 *) arg) = bstream->readFloat(argList[i].bitCount); break; case TypeString: { char **stringPtr = (char **) arg; *stringPtr = (char *) allocSpace((U8 **) arg, currentSize, 256); if(!*stringPtr) goto errorOut; bstream->readString(*stringPtr); // back off the end pointer. currentSize -= (255 - strlen(*stringPtr)); } break; case TypeStringTableEntryRef: if(rpcNumSTEs >= MethodArgList::MaxOffsets) goto errorOut; rpcSTEIndex[rpcNumSTEs] = rpcCurrentSTEIndex; rpcSTEOffsets[rpcNumSTEs] = arg; rpcNumSTEs++; rpcCurrentSTEIndex++; break; case TypeRangedU32: *((U32 *) arg) = bstream->readRangedU32(argList[i].rangeStart, argList[i].rangeEnd); break; case TypeBool: *((bool *) arg) = bstream->readFlag(); break; case TypeByteBufferPtr: { ByteBuffer *buffer = (ByteBuffer *) allocSpace((U8 **) arg, currentSize, sizeof(ByteBuffer)); if(!buffer) goto errorOut; buffer->mOwnsMemory = false; buffer->mBufSize = bstream->readInt(ByteBufferSizeBitSize); buffer->mDataPtr = (U8 *) allocSpace(&buffer->mDataPtr, currentSize, buffer->mBufSize); if(!buffer->mDataPtr) goto errorOut; bstream->read(buffer->mBufSize, buffer->mDataPtr); *((ByteBuffer **) arg) = buffer; } break; case TypeIPAddressRef: { IPAddress *ip = (IPAddress *) allocSpace((U8 **) arg, currentSize, sizeof(IPAddress)); if(!ip) goto errorOut; bstream->read(&ip->netNum); bstream->read(&ip->port); *((IPAddress **) arg) = (IPAddress *) ip; } break; case TypeIPAddress: bstream->read(&((IPAddress *) arg)->netNum); bstream->read(&((IPAddress *) arg)->port); break; } *((U8 **) &arg) += gTypes[argList[i].argType].size; } } theEvent->mSTEs.setSize(rpcCurrentSTEIndex); for(U32 i = 0; i < rpcNumSTEs; i++) { *((StringTableEntry **) rpcSTEOffsets[i]) = &theEvent->mSTEs[rpcSTEIndex[i]]; // StringTableEntry ste = ps->unpackStringTableEntry(bstream); // theEvent->mSTEs.push_back(ste); // *((U32 *) rpcSTEOffsets[i]) = ste.getIndex(); } theEvent->unmarshalledData.setBuffer(rpcReadData, currentSize, false); theEvent->unmarshalledData.takeOwnership(); U32 delta; U8 *data = theEvent->unmarshalledData.getBuffer(); delta = data - rpcReadData; for(U32 i = 0; i < rpcNumOffsets; i++) { *((U8 **) (data + rpcReadOffsets[i])) += delta; } return true; errorOut: return false; } void MarshalledCall::dispatch(void *thisPtr, MethodPointer *method) { U32 func; U32 funcOffset; func = method->v1; funcOffset = method->v2; void *args = unmarshalledData.getBuffer(); #ifdef TNL_CPU_X86 S32 sz = mMarshaller->argList.size() * sizeof(U32); U32 saveESP; #endif // CallMethod(ps, data); #if defined(TNL_SUPPORTS_VC_INLINE_X86_ASM) _asm { push esi push edi push ecx push edx push ebx mov saveESP, esp mov ecx, sz // get size of buffer mov esi, args // get buffer sub esp, ecx // allocate stack space mov edi, esp // start of destination stack frame shr ecx, 2 // make it dwords rep movsd // copy it mov ecx, thisPtr // set "this" push ecx call [func] // call the function mov esp, saveESP pop ebx pop edx pop ecx pop edi pop esi } #elif defined(TNL_SUPPORTS_GCC_INLINE_X86_ASM) U8 *funcPtr = ((U8 *) thisPtr) + funcOffset; funcPtr = *((U8 **) funcPtr); funcPtr += func; funcPtr--; funcPtr = *((U8 **) funcPtr); asm( "mov %%esp, %0 \n" "mov %1, %%ecx \n" // get size of buffer "mov %2, %%esi \n" // get buffer "sub %%ecx, %%esp \n" // allocate stack space "mov %%esp, %%edi \n" // start of destination stack frame "shr $2, %%ecx \n" // make it dwords "rep\nmovsl \n" // copy it "mov %4, %%ecx \n" // set "this" "push %%ecx \n" // gcc expects this pointer to be on the stack "call *%3 \n" // call the function "mov %0, %%esp \n" : /* nothing out */ : "m" (saveESP), "m" (sz), "m" (args), "m" (funcPtr), "m" (thisPtr) : "ebx", "edx", "ecx", "edi", "esi" ); #elif defined (TNL_SUPPORTS_GCC_INLINE_PPC_ASM) register S32 *floatOffsets = mMarshaller->floatRegOffsets; S32 argAreaSize = mMarshaller->argList.size() * sizeof(U32); if(argAreaSize < 28) argAreaSize = 28; S32 copySize = 28 - argAreaSize; // negative - stack grows down // load up the floating point registers asm(" \n" "mflr r0\n" "stw r0, 8(r1)\n" // save off link register "mr r9, %4\n" // load up the copy size "addi r9, r9, -24-32-4\n" // 24 for linkage area, 32 for register arguments, 4 for r20 "stw r20, -4(r1)\n" // save off r20 into the red zone "mr r20, r9\n" // save the grow amount "subfic r9, r9, -24-32-4\n" // compute byte total to copy to the stack "mr r10, %1\n" "addi r10, r10, 28\n" "sub r12, r1, r9\n" // write offset from stack (into red zone) "addi r12, r12, -4\n" // skip past r20 save area. "li r2, 0\n" "stackCopyLoop:\n" "cmpw r2, r9\n" "beq stackCopyDone\n" "lwzx r3, r2, r10\n" "stwx r3, r2, r12\n" "addi r2, r2, 4\n" // increment the loop counter... "b stackCopyLoop\n" "stackCopyDone:\n" "mr r10, %1\n" "mr r3, %3\n" "mr r12, %2\n" "mr r9, %0\n" "stwux r1, r1, r20\n" // create some stack space for us to work in "lwz r2, 0(r9)\n" "subic. r2, r2, 0\n" "blt floatsDone\n" "lfsx f1, r2, r10\n" "lwz r2, 4(r9)\n" "subic. r2, r2, 0\n" "blt floatsDone\n" "lfsx f2, r2, r10\n" "lwz r2, 8(r9)\n" "subic. r2, r2, 0\n" "blt floatsDone\n" "lfsx f3, r2, r10\n" "lwz r2, 12(r9)\n" "subic. r2, r2, 0\n" "blt floatsDone\n" "lfsx f4, r2, r10\n" "lwz r2, 16(r9)\n" "subic. r2, r2, 0\n" "blt floatsDone\n" "lfsx f5, r2, r10\n" "lwz r2, 20(r9)\n" "subic. r2, r2, 0\n" "blt floatsDone\n" "lfsx f6, r2, r10\n" "lwz r2, 24(r9)\n" "subic. r2, r2, 0\n" "blt floatsDone\n" "lfsx f7, r2, r10\n" "lwz r2, 28(r9)\n" "subic. r2, r2, 0\n" "blt floatsDone\n" "lfsx f8, r2, r10\n" "lwz r2, 32(r9)\n" "subic. r2, r2, 0\n" "blt floatsDone\n" "lfsx f9, r2, r10\n" "lwz r2, 36(r9)\n" "subic. r2, r2, 0\n" "blt floatsDone\n" "lfsx f10, r2, r10\n" "lwz r2, 40(r9)\n" "subic. r2, r2, 0\n" "blt floatsDone\n" "lfsx f11, r2, r10\n" "lwz r2, 44(r9)\n" "subic. r2, r2, 0\n" "blt floatsDone\n" "lfsx f12, r2, r10\n" "lwz r2, 48(r9)\n" "subic. r2, r2, 0\n" "blt floatsDone\n" "lfsx f13, r2, r10\n" "floatsDone:\n" // load up the virtual function pointer "mr r4, %5\n" // r4 has funcOffset, r12 has the function index "add r4, r4, r3\n" "lwz r4, 0(r4)\n" "add r4, r4, r12\n" "addi r4, r4, -1\n" "lwz r12, 0(r4)\n" "lwz r4, 0(r10)\n" "lwz r5, 4(r10)\n" "lwz r6, 8(r10)\n" "lwz r7, 12(r10)\n" "lwz r8, 16(r10)\n" "lwz r9, 20(r10)\n" "lwz r10, 24(r10)\n" "mtctr r12\n" "bctrl\n" "sub r1, r1, r20\n" "lwz r20, -4(r1)\n" //addic r1, r1, 424\n" "lwz r0, 8(r1)\n" "mtlr r0\n" : : "r" (floatOffsets), "r" (args), "r" (func), "r" (thisPtr), "r" (copySize), "r" (funcOffset) : "r2", "r9", "r10", "r12", "r3", "r0"); #endif } }; Index: ghostConnection.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/ghostConnection.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ghostConnection.cpp 4 May 2004 06:27:39 -0000 1.4 --- ghostConnection.cpp 6 May 2004 00:33:38 -0000 1.5 *************** *** 743,747 **** //----------------------------------------------------------------------------- ! TNL_DECLARE_RPC_MEM_ENUM(GhostConnection, GhostCountBitSize); TNL_IMPLEMENT_RPC(GhostConnection, rpcGhostAlwaysStarting, (U32 sequence, Int<GhostConnection::GhostCountBitSize> ghostCount), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirAny, 0) --- 743,747 ---- //----------------------------------------------------------------------------- ! TNL_DECLARE_ENUM(GhostConnection::GhostCountBitSize); TNL_IMPLEMENT_RPC(GhostConnection, rpcGhostAlwaysStarting, (U32 sequence, Int<GhostConnection::GhostCountBitSize> ghostCount), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirAny, 0) Index: tnlNetObject.h =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnlNetObject.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tnlNetObject.h 20 Apr 2004 04:27:19 -0000 1.1 --- tnlNetObject.h 6 May 2004 00:33:38 -0000 1.2 *************** *** 420,424 **** /// Constructor - initializes the base class's data ! NetObjectRPCEvent(NetObject *destObject, RPCArgList *aMarshaller, RPCGuaranteeType type, NetObjectRPCDirection dir) : RPCEvent(aMarshaller, type, RPCDirAny) { mDestObject = destObject; mRPCDirection = dir; } void pack(EventConnection *ps, BitStream *bstream); --- 420,424 ---- /// Constructor - initializes the base class's data ! NetObjectRPCEvent(NetObject *destObject, MethodArgList *aMarshaller, RPCGuaranteeType type, NetObjectRPCDirection dir) : RPCEvent(aMarshaller, type, RPCDirAny) { mDestObject = destObject; mRPCDirection = dir; } void pack(EventConnection *ps, BitStream *bstream); *************** *** 434,438 **** /// following the TNL_IMPLEMENT_NETOBJECT_RPC macro call. #define TNL_IMPLEMENT_NETOBJECT_RPC(className, name, args, groupMask, guaranteeType, eventDirection, rpcVersion) \ ! extern TNL::RPCArgList RPC##className##name; \ class RPCEV_##className##_##name : public TNL::NetObjectRPCEvent { \ public: typedef void (FN_CDECL className::*RPCFuncPtr) args; \ --- 434,438 ---- /// following the TNL_IMPLEMENT_NETOBJECT_RPC macro call. #define TNL_IMPLEMENT_NETOBJECT_RPC(className, name, args, groupMask, guaranteeType, eventDirection, rpcVersion) \ ! extern TNL::MethodArgList RPC##className##name; \ class RPCEV_##className##_##name : public TNL::NetObjectRPCEvent { \ public: typedef void (FN_CDECL className::*RPCFuncPtr) args; \ *************** *** 442,448 **** { mFuncPtr = &className::name##_remote; } \ TNL_DECLARE_CLASS( RPCEV_##className##_##name ); \ ! void getFuncPtr(U32 &v1, U32 &v2) { v1=*((U32 *) &mFuncPtr); v2 = *(((U32 *) &mFuncPtr) + 1); } }; \ TNL_IMPLEMENT_NETEVENT( RPCEV_##className##_##name, groupMask, rpcVersion ); \ ! TNL::RPCArgList RPC##className##name (#className, #args); \ void FN_CDECL className::name args { SAVE_PARAMS RPCEV_##className##_##name *theEvent = new RPCEV_##className##_##name(this); theEvent->marshallArguments(); postRPCEvent(theEvent); } \ TNL::NetEvent * FN_CDECL className::name##_construct args { SAVE_PARAMS RPCEV_##className##_##name *theEvent = new RPCEV_##className##_##name(this); theEvent->marshallArguments(); return theEvent; } \ --- 442,448 ---- { mFuncPtr = &className::name##_remote; } \ TNL_DECLARE_CLASS( RPCEV_##className##_##name ); \ ! void getFuncPtr(MethodPointer &p) { p.v1=*((U32 *) &mFuncPtr); p.v2 = *(((U32 *) &mFuncPtr) + 1); } }; \ TNL_IMPLEMENT_NETEVENT( RPCEV_##className##_##name, groupMask, rpcVersion ); \ ! TNL::MethodArgList RPC##className##name (#className, #args); \ void FN_CDECL className::name args { SAVE_PARAMS RPCEV_##className##_##name *theEvent = new RPCEV_##className##_##name(this); theEvent->marshallArguments(); postRPCEvent(theEvent); } \ TNL::NetEvent * FN_CDECL className::name##_construct args { SAVE_PARAMS RPCEV_##className##_##name *theEvent = new RPCEV_##className##_##name(this); theEvent->marshallArguments(); return theEvent; } \ Index: tnlByteBuffer.h =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnlByteBuffer.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tnlByteBuffer.h 22 Apr 2004 20:42:25 -0000 1.2 --- tnlByteBuffer.h 6 May 2004 00:33:38 -0000 1.3 *************** *** 40,44 **** class ByteBuffer : public Object { ! friend struct RPCArgList; protected: /// Pointer to our data buffer. --- 40,44 ---- class ByteBuffer : public Object { ! friend struct MethodArgList; protected: /// Pointer to our data buffer. Index: tnlTypes.h =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnlTypes.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tnlTypes.h 4 May 2004 06:27:40 -0000 1.3 --- tnlTypes.h 6 May 2004 00:33:38 -0000 1.4 *************** *** 70,73 **** --- 70,148 ---- /// @} + /// NetType serves as a base class for all bit-compressed versions of + /// the base types that can be transmitted using TNL's RPC mechanism. + /// In general, the type names are self-explanatory, providing simple + /// wrappers on the original base types. The template argument for bit + /// counts or numeric ranges is necessary because TNL parses the actual + /// function prototype as a string in order to determine how many bits + /// to use for each RPC parameter. + /// + /// Template parameters to the NetType templates can be either integer + /// constants or enumeration values. If enumeration values are used, + /// the TNL_DECLARE_RPC_ENUM or TNL_DECLARE_RPC_MEM enum macros must + /// be used to register the enumerations with the RPC system. + struct NetType { + + }; + + /// Unsigned integer bit-level RPC template wrapper. + /// + /// When an Int<X> is in the parameter list for an RPC method, that parameter will + /// be transmitted using X bits. + template<U32 bitCount> struct Int : NetType + { + U32 value; + Int(U32 val=0) { value = val; } + operator U32() const { return value; } + U32 getPrecisionBits() { return bitCount; } + }; + + /// Signed integer bit-level RPC template wrapper. + /// + /// When a SignedInt<X> is in the parameter list for an RPC method, that parameter will + /// be transmitted using X bits. + template<U32 bitCount> struct SignedInt : NetType + { + S32 value; + SignedInt(S32 val=0) { value = val; } + operator S32() const { return value; } + U32 getPrecisionBits() { return bitCount; } + }; + + /// Floating point 0...1 value bit-level RPC template wrapper. + /// + /// When a Float<X> is in the parameter list for an RPC method, that parameter will + /// be transmitted using X bits. + template<U32 bitCount> struct Float : NetType + { + F32 value; + Float(F32 val=0) { value = val; } + operator F32() const { return value; } + U32 getPrecisionBits() { return bitCount; } + }; + + /// Floating point -1...1 value bit-level RPC template wrapper. + /// + /// When a SignedFloat<X> is in the parameter list for an RPC method, that parameter will + /// be transmitted using X bits. + template<U32 bitCount> struct SignedFloat : NetType + { + F32 value; + SignedFloat(F32 val=0) { value = val; } + operator F32() const { return value; } + U32 getPrecisionBits() { return bitCount; } + }; + + /// Unsigned ranged integer bit-level RPC template wrapper. + /// + /// The RangedU32 is used to specify a range of valid values for the parameter + /// in the parameter list for an RPC method. + template<U32 rangeStart, U32 rangeEnd> struct RangedU32 : NetType + { + U32 value; + RangedU32(U32 val=rangeStart) { value = val; } + operator U32() const { return value; } + }; + //------------------------------------------------------------------------------ //-------------------------------------- Type constants... Index: tnl.vcproj =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnl.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tnl.vcproj 20 Apr 2004 04:27:18 -0000 1.1 --- tnl.vcproj 6 May 2004 00:33:38 -0000 1.2 *************** *** 322,325 **** --- 322,331 ---- </File> <File + RelativePath=".\tnlMethodDispatch.cpp"> + </File> + <File + RelativePath=".\tnlMethodDispatch.h"> + </File> + <File RelativePath=".\tnlNetBase.h"> </File> Index: rpc.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/rpc.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rpc.cpp 20 Apr 2004 04:27:18 -0000 1.1 --- rpc.cpp 6 May 2004 00:33:38 -0000 1.2 *************** *** 35,736 **** namespace TNL { ! void *gBasePtr = NULL; ! void *gThisPtr = NULL; ! void *gStackPtr = NULL; ! ! static const char *typeNamesBase[] = { ! "S8", ! "U8", ! "S16", ! "U16", ! "S32", ! "U32", ! "F32", ! "SignedInt<", ! "Int<", ! "SignedFloat<", ! "Float<", ! "const char *", ! "RangedU32<", ! "bool", ! "StringTableEntry", ! "ByteBufferRef", ! "IPAddressRef", ! "IPAddress", ! }; ! ! // Type sizes array. ! // This array is used to allocate space for the data in vectors ! // passed over RPCs. Fields that have a zero value are not allowed ! // to be passed in vectors. ! static const U32 typeSizes[] = { ! sizeof(S8), ! sizeof(U8), ! sizeof(S16), ! sizeof(U16), ! sizeof(S32), ! sizeof(U32), ! sizeof(F32), ! sizeof(S32), ! sizeof(U32), ! sizeof(F32), ! sizeof(F32), ! sizeof(const char *), ! sizeof(U32), ! sizeof(bool), ! sizeof(StringTableEntry), ! 0, ! 0, ! sizeof(IPAddress), ! }; ! ! RPCEnum *RPCEnum::mLinkedList = NULL; ! ! U32 RPCArgList::getValue(const char *buffer) ! { ! while(*buffer == ' ') ! buffer++; ! if(buffer[0] >= '0' && buffer[0] <= '9') ! return atoi(buffer); ! else ! { ! U32 len = 0; ! while((buffer[len] >= 'a' && buffer[len] <= 'z') || ! (buffer[len] >= 'A' && buffer[len] <= 'Z') || ! (buffer[len] == ':' || buffer[len] == '_')) ! len++; ! for(RPCEnum *walk = RPCEnum::mLinkedList; walk; walk = walk->mNext) ! { ! if(!strncmp(buffer, walk->mSymbol, len) && walk->mSymbol[len] == 0) ! return walk->mValue; ! } ! } ! TNLAssert(0, "Undeclared RPC enumeration! Use TNL_DECLARE_RPC_ENUM."); ! return 0; ! } ! ! typedef StringTableEntry &StringTableEntryType; ! RPCArgList::RPCArgList(const char *className, const char *anArgList) ! { ! argListString = anArgList; ! mClassName = className; ! ! mNumStringTableEntries = 0; ! ! // first strip off the leading paren. ! const char *aptr = argListString + 1; ! U32 numFloats = 0; ! ! for(;;) ! { ! U32 type = 0; ! RPCArgInfo info; ! ! // remove leading spaces ! while(*aptr == ' ') ! aptr++; ! if(*aptr == ')') ! break; ! ! info.isVector = false; ! ! // this can let some errors through - for example we don't check that ! // the vector is passed as a reference, but it has to be. ! // Ideally we should do a simple lexer/parser for the argument ! // lists in flex/bison. This would let us grow the parser a lot ! // more easily. ! if(!strncmp(aptr, "const Vector<", 13)) ! { ! info.isVector = true; ! aptr += 13; ! } ! U32 len = 0; ! // grab the type off the arg list pointer: ! for(;type < RPCArgInfo::NumTypes; type++) ! { ! // figure out the base type: ! len = strlen(typeNamesBase[type]); ! if(!strncmp(aptr, typeNamesBase[type], len)) ! break; ! } ! ! TNLAssert(type != RPCArgInfo::NumTypes, "Invalid type in RPC declaration."); ! TNLAssert(!info.isVector || typeSizes[type] != 0, "Invalid vector subtype in RPC declaration."); ! ! aptr += len; ! info.argType = type; ! ! // figure out the template arguments, if any: ! if(type == RPCArgInfo::TypeSignedInt || type == RPCArgInfo::TypeInt || ! type == RPCArgInfo::TypeSignedFloat || type == RPCArgInfo::TypeFloat || ! type == RPCArgInfo::TypeRangedU32) ! { ! const char *walk = aptr; ! aptr = strchr(aptr, '>') + 1; ! ! if(type == RPCArgInfo::TypeRangedU32) ! { ! info.rangeStart = getValue(walk); ! info.rangeEnd = getValue(strchr(walk, ',') + 1); ! } ! else ! info.bitCount = getValue(walk); ! } ! if (type == RPCArgInfo::TypeStringTableEntryRef) ! mNumStringTableEntries++; ! if(type == RPCArgInfo::TypeF32 || type == RPCArgInfo::TypeFloat || type == RPCArgInfo::TypeSignedFloat) ! { ! if(numFloats < 13) ! { ! floatRegOffsets[numFloats] = argList.size() * sizeof(U32); ! numFloats++; ! } ! } ! argList.push_back(info); ! // lop off the name of the var... ! aptr = strchr(aptr, ','); ! if(!aptr) ! break; ! aptr++; ! } ! if(numFloats < 13) ! floatRegOffsets[numFloats] = -1; ! } ! ! #ifdef TNL_CPU_PPC ! U32 gRegisterSaves[8 + 13 + 1]; ! #endif ! ! void RPCArgList::marshall(BitStream *bstream, RPCEvent *theEvent) ! { ! #if defined (TNL_CPU_PPC) ! U32 *intArg = gRegisterSaves; ! F32 *floatArg = (F32 *) (&gRegisterSaves[8]); ! void *stackPtr = (void *) gRegisterSaves[8 + 13]; ! stackPtr = (void *) (*((U8 **) stackPtr) + 24); // advance past linkage area of stack ! intArg++; // get rid of the "this" pointer. ! bool floatInRegs = true; ! #else ! U8 *ptr = (U8 *) gBasePtr; ! ptr += 4; // get rid of the return address and saved base ptr. ! #endif ! U32 whichSTE = 0; ! for(S32 i = 0; i < argList.size(); i++) ! { ! #if !defined (TNL_CPU_PPC) ! void *arg = ptr + sizeof(U32) * i; ! U32 *intArg = (U32 *) arg; ! F32 *floatArg = (F32 *) arg; ! #else ! if(!floatInRegs) ! floatArg = ((F32 *) stackPtr) + i + 1; // the +1 skips the this pointer which is an arg, but not in the arg list. ! #endif ! U32 count = 1; ! U32 *intArgSave = intArg; ! F32 *floatArgSave = floatArg; ! ! if(argList[i].isVector) ! { ! VectorRep *vector = *((VectorRep **) intArg); ! bstream->writeInt(vector->elementCount, VectorSizeBitSize); ! intArg = (U32 *) vector->array; ! floatArg = (F32 *) vector->array; ! count = vector->elementCount; ! } ! for(U32 j = 0; j < count; j++) ! { ! switch(argList[i].argType) ! { ! case RPCArgInfo::TypeS8: ! bstream->write(*((S8 *) intArg)); ! break; ! case RPCArgInfo::TypeU8: ! bstream->write(*((U8 *) intArg)); ! break; ! case RPCArgInfo::TypeS16: ! bstream->write(*((S16 *) intArg)); ! break; ! case RPCArgInfo::TypeU16: ! bstream->write(*((U16 *) intArg)); ! break; ! case RPCArgInfo::TypeS32: ! bstream->write(*((S32 *) intArg)); ! break; ! case RPCArgInfo::TypeU32: ! bstream->write(*((U32 *) intArg)); ! break; ! case RPCArgInfo::TypeF32: ! bstream->write(*((F32 *) floatArg)); ! floatArg++; ! break; ! case RPCArgInfo::TypeSignedInt: ! bstream->writeSignedInt(*((S32 *) intArg), argList[i].bitCount); ! break; ! case RPCArgInfo::TypeInt: ! bstream->writeInt(*((U32 *) intArg), argList[i].bitCount); ! break; ! case RPCArgInfo::TypeSignedFloat: ! bstream->writeSignedFloat(*((F32 *) floatArg), argList[i].bitCount); ! floatArg++; ! break; ! case RPCArgInfo::TypeFloat: ! bstream->writeFloat(*((F32 *) floatArg), argList[i].bitCount); ! floatArg++; ! break; ! case RPCArgInfo::TypeString: ! bstream->writeString(*((const char **) intArg)); ! break; ! case RPCArgInfo::TypeStringTableEntryRef: ! theEvent->mSTEs.push_back(*((StringTableEntry *) intArg)); ! break; ! case RPCArgInfo::TypeRangedU32: ! bstream->writeRangedU32(*((U32 *) intArg), argList[i].rangeStart, argList[i].rangeEnd); ! break; ! case RPCArgInfo::TypeBool: ! bstream->writeFlag(*((bool *) intArg)); ! break; ! case RPCArgInfo::TypeByteBufferPtr: ! { ! ByteBuffer *buffer = *((ByteBuffer **) intArg); ! bstream->writeInt(buffer->getBufferSize(), ByteBufferSizeBitSize); ! bstream->write(buffer->getBufferSize(), buffer->getBuffer()); ! } ! break; ! case RPCArgInfo::TypeIPAddressRef: ! bstream->write((*((IPAddress **) intArg))->netNum); ! bstream->write((*((IPAddress **) intArg))->port); ! break; ! case RPCArgInfo::TypeIPAddress: ! bstream->write(((IPAddress *) intArg)->netNum); ! bstream->write(((IPAddress *) intArg)->port); ! break; ! } ! if(count != 1) ! { ! *((U8 **) &intArg) += typeSizes[argList[i].argType]; ! // float args already get incremented above ! //*((U8 **) &floatArg) += typeSizes[argList[i].argType]; ! } ! } ! if(argList[i].isVector) ! { ! intArg = intArgSave; ! floatArg = floatArgSave; ! } ! intArg++; ! #ifdef TNL_CPU_PPC ! if(i == 6) // we're on our 8th register... start reading ints from the stack: ! { ! intArg = ((U32 *) stackPtr) + 8; // skip 8 registers. ! } ! if(floatArg == (F32 *) &gRegisterSaves[8+13]) // we're on our 13th register... start reading floats from the stack: ! floatInRegs = false; ! #endif ! } ! } ! ! static U8 rpcReadData[RPCArgList::MaxRPCDataSize]; ! static U32 rpcReadOffsets[RPCArgList::MaxOffsets]; ! static U8 *rpcSTEOffsets[RPCArgList::MaxOffsets]; ! static U32 rpcNumSTEs; ! static U32 rpcNumOffsets; ! ! inline U8 *allocSpace(U8 **offsetDest, U32 ¤tSize, U32 requestSize) ! { ! if(rpcNumOffsets >= RPCArgList::MaxOffsets) ! return NULL; ! ! currentSize = fourByteAlign(currentSize); ! rpcReadOffsets[rpcNumOffsets++] = ((U8 *) offsetDest) - rpcReadData; ! ! if(requestSize + currentSize > RPCArgList::MaxRPCDataSize) ! return NULL; ! ! U8 *ret = rpcReadData + currentSize; ! *offsetDest = ret; ! ! currentSize += requestSize; ! return ret; ! } ! ! void *RPCArgList::unmarshall(BitStream *bstream, EventConnection *ps, RPCEvent *theEvent) ! { ! rpcNumOffsets = 0; ! rpcNumSTEs = 0; ! U32 currentSize = sizeof(U32) * argList.size(); ! #ifdef TNL_CPU_PPC ! currentSize = getMax(currentSize, U32(28)); ! #endif ! U32 whichSTE = 0; ! for(S32 i = 0; i < argList.size(); i++) ! { ! U8 *arg = (rpcReadData + sizeof(U32) * i); ! U32 count = 1; ! if(argList[i].isVector) ! { ! VectorRep *vector = (VectorRep *) allocSpace((U8 **) arg, currentSize, sizeof(VectorRep)); ! if(!vector) ! goto errorOut; ! ! vector->arraySize = bstream->readInt(VectorSizeBitSize); ! vector->elementCount = vector->arraySize; ! ! vector->array = allocSpace(&vector->array, currentSize, vector->elementCount * typeSizes[argList[i].argType]); ! if(!vector->array) ! goto errorOut; ! *((VectorRep **) arg) = vector; ! count = vector->elementCount; ! arg = vector->array; ! } ! for(U32 j = 0; j < count; j++) ! { ! switch(argList[i].argType) ! { ! case RPCArgInfo::TypeS8: ! bstream->read((S8 *) arg); ! break; ! case RPCArgInfo::TypeU8: ! bstream->read((U8 *) arg); ! break; ! case RPCArgInfo::TypeS16: ! bstream->read((S16 *) arg); ! break; ! case RPCArgInfo::TypeU16: ! bstream->read((S16 *) arg); ! break; ! case RPCArgInfo::TypeS32: ! bstream->read((S32 *) arg); ! break; ! case RPCArgInfo::TypeU32: ! bstream->read((U32 *) arg); ! break; ! case RPCArgInfo::TypeF32: ! bstream->read((F32 *) arg); ! break; ! case RPCArgInfo::TypeSignedInt: ! *((S32 *) arg) = bstream->readSignedInt(argList[i].bitCount); ! break; ! case RPCArgInfo::TypeInt: ! *((U32 *) arg) = bstream->readInt(argList[i].bitCount); ! break; ! case RPCArgInfo::TypeSignedFloat: ! *((F32 *) arg) = bstream->readSignedFloat(argList[i].bitCount); ! break; ! case RPCArgInfo::TypeFloat: ! *((F32 *) arg) = bstream->readFloat(argList[i].bitCount); ! break; ! case RPCArgInfo::TypeString: ! { ! char **stringPtr = (char **) arg; ! *stringPtr = (char *) allocSpace((U8 **) arg, currentSize, 256); ! if(!*stringPtr) ! goto errorOut; ! bstream->readString(*stringPtr); ! // back off the end pointer. ! currentSize -= (255 - strlen(*stringPtr)); ! } ! break; ! case RPCArgInfo::TypeStringTableEntryRef: ! if(rpcNumSTEs >= RPCArgList::MaxOffsets) ! goto errorOut; ! rpcSTEOffsets[rpcNumSTEs++] = arg; ! break; ! case RPCArgInfo::TypeRangedU32: ! *((U32 *) arg) = bstream->readRangedU32(argList[i].rangeStart, argList[i].rangeEnd); ! break; ! case RPCArgInfo::TypeBool: ! *((bool *) arg) = bstream->readFlag(); ! break; ! case RPCArgInfo::TypeByteBufferPtr: ! { ! ByteBuffer *buffer = (ByteBuffer *) allocSpace((U8 **) arg, currentSize, sizeof(ByteBuffer)); ! if(!buffer) ! goto errorOut; ! buffer->mOwnsMemory = false; ! buffer->mBufSize = bstream->readInt(ByteBufferSizeBitSize); ! buffer->mDataPtr = (U8 *) allocSpace(&buffer->mDataPtr, currentSize, buffer->mBufSize); ! if(!buffer->mDataPtr) ! goto errorOut; ! bstream->read(buffer->mBufSize, buffer->mDataPtr); ! *((ByteBuffer **) arg) = buffer; ! } ! break; ! case RPCArgInfo::TypeIPAddressRef: ! { ! IPAddress *ip = (IPAddress *) allocSpace((U8 **) arg, currentSize, sizeof(IPAddress)); ! if(!ip) ! goto errorOut; ! bstream->read(&ip->netNum); ! bstream->read(&ip->port); ! *((IPAddress **) arg) = (IPAddress *) ip; ! } ! break; ! case RPCArgInfo::TypeIPAddress: ! bstream->read(&((IPAddress *) arg)->netNum); ! bstream->read(&((IPAddress *) arg)->port); ! break; ! } ! *((U8 **) &arg) += typeSizes[argList[i].argType]; ! } ! } ! for(U32 i = 0; i < rpcNumSTEs; i++) ! { ! StringTableEntry ste = ps->unpackStringTableEntry(bstream); ! theEvent->mSTEs.push_back(ste); ! *((U32 *) rpcSTEOffsets[i]) = ste.getIndex(); ! } ! ! U8 *data; ! data = (U8 *)malloc(currentSize); ! U32 delta; ! delta = data - rpcReadData; ! for(U32 i = 0; i < rpcNumOffsets; i++) ! { ! *((U8 **) (rpcReadData + rpcReadOffsets[i])) += delta; ! } ! ! memcpy(data, rpcReadData, currentSize); ! return data; ! errorOut: ! return NULL; ! } ! ! ! RPCEvent::RPCEvent(RPCArgList *aMarshaller, RPCGuaranteeType gType, RPCDirection dir) : ! NetEvent((NetEvent::GuaranteeType) gType, (NetEvent::EventDirection) dir), mData(NULL), mMarshaller(aMarshaller) ! { ! } ! ! RPCEvent::~RPCEvent() { - free(mData); } void RPCEvent::marshallArguments() { ! PacketStream s; ! mMarshaller->marshall(&s, this); ! mBitCount = s.getBitPosition(); ! mData = malloc(s.getBytePosition()); ! memcpy(mData, s.getBuffer(), s.getBytePosition()); } void RPCEvent::pack(EventConnection *ps, BitStream *bstream) { ! bstream->writeBits(mBitCount, mData); ! for(S32 i = 0; i < mSTEs.size(); i++) ! ps->packStringTableEntry(bstream, mSTEs[i]); } void RPCEvent::unpack(EventConnection *ps, BitStream *bstream) { ! mData = mMarshaller->unmarshall(bstream, ps, this); ! if(!mData) ! { ! ps->setLastError("Invalid packet."); ! } } void RPCEvent::process(EventConnection *ps) { ! U32 func; ! U32 funcOffset; ! getFuncPtr(func, funcOffset); ! void *args = mData; ! void *thisPtr = getThisPointer(ps); ! ! #ifdef TNL_CPU_X86 ! S32 sz = mMarshaller->argList.size() * sizeof(U32); ! U32 saveESP; ! #endif ! // CallMethod(ps, data); ! ! #if defined(TNL_SUPPORTS_VC_INLINE_X86_ASM) ! _asm ! { ! push esi ! push edi ! push ecx ! push edx ! push ebx ! mov saveESP, esp ! ! mov ecx, sz // get size of buffer ! mov esi, args // get buffer ! sub esp, ecx // allocate stack space ! mov edi, esp // start of destination stack frame ! shr ecx, 2 // make it dwords ! rep movsd // copy it ! mov ecx, thisPtr // set "this" ! push ecx ! call [func] // call the function ! mov esp, saveESP ! ! pop ebx ! pop edx ! pop ecx ! pop edi ! pop esi ! } ! ! #elif defined(TNL_SUPPORTS_GCC_INLINE_X86_ASM) ! U8 *funcPtr = ((U8 *) thisPtr) + funcOffset; ! funcPtr = *((U8 **) funcPtr); ! funcPtr += func; ! funcPtr--; ! funcPtr = *((U8 **) funcPtr); ! ! asm( ! "mov %%esp, %0 \n" ! ! "mov %1, %%ecx \n" // get size of buffer ! "mov %2, %%esi \n" // get buffer ! "sub %%ecx, %%esp \n" // allocate stack space ! "mov %%esp, %%edi \n" // start of destination stack frame ! "shr $2, %%ecx \n" // make it dwords ! "rep\nmovsl \n" // copy it ! "mov %4, %%ecx \n" // set "this" ! "push %%ecx \n" // gcc expects this pointer to be on the stack ! "call *%3 \n" // call the function ! ! "mov %0, %%esp \n" ! ! : /* nothing out */ ! : "m" (saveESP), "m" (sz), "m" (args), "m" (funcPtr), "m" (thisPtr) ! : "ebx", "edx", "ecx", "edi", "esi" ! ); ! #elif defined (TNL_SUPPORTS_GCC_INLINE_PPC_ASM) ! register S32 *floatOffsets = mMarshaller->floatRegOffsets; ! ! S32 argAreaSize = mMarshaller->argList.size() * sizeof(U32); ! if(argAreaSize < 28) ! argAreaSize = 28; ! ! S32 copySize = 28 - argAreaSize; // negative - stack grows down ! ! // load up the floating point registers ! asm(" \n" ! "mflr r0\n" ! "stw r0, 8(r1)\n" // save off link register ! "mr r9, %4\n" // load up the copy size ! "addi r9, r9, -24-32-4\n" // 24 for linkage area, 32 for register arguments, 4 for r20 ! "stw r20, -4(r1)\n" // save off r20 into the red zone ! "mr r20, r9\n" // save the grow amount ! ! "subfic r9, r9, -24-32-4\n" // compute byte total to copy to the stack ! "mr r10, %1\n" ! "addi r10, r10, 28\n" ! "sub r12, r1, r9\n" // write offset from stack (into red zone) ! "addi r12, r12, -4\n" // skip past r20 save area. ! "li r2, 0\n" ! ! "stackCopyLoop:\n" ! "cmpw r2, r9\n" ! "beq stackCopyDone\n" ! "lwzx r3, r2, r10\n" ! "stwx r3, r2, r12\n" ! "addi r2, r2, 4\n" // increment the loop counter... ! "b stackCopyLoop\n" ! "stackCopyDone:\n" ! ! "mr r10, %1\n" ! "mr r3, %3\n" ! "mr r12, %2\n" ! "mr r9, %0\n" ! ! "stwux r1, r1, r20\n" // create some stack space for us to work in ! ! "lwz r2, 0(r9)\n" ! "subic. r2, r2, 0\n" ! "blt floatsDone\n" ! "lfsx f1, r2, r10\n" ! ! "lwz r2, 4(r9)\n" ! "subic. r2, r2, 0\n" ! "blt floatsDone\n" ! "lfsx f2, r2, r10\n" ! ! "lwz r2, 8(r9)\n" ! "subic. r2, r2, 0\n" ! "blt floatsDone\n" ! "lfsx f3, r2, r10\n" ! ! "lwz r2, 12(r9)\n" ! "subic. r2, r2, 0\n" ! "blt floatsDone\n" ! "lfsx f4, r2, r10\n" ! ! "lwz r2, 16(r9)\n" ! "subic. r2, r2, 0\n" ! "blt floatsDone\n" ! "lfsx f5, r2, r10\n" ! ! "lwz r2, 20(r9)\n" ! "subic. r2, r2, 0\n" ! "blt floatsDone\n" ! "lfsx f6, r2, r10\n" ! ! "lwz r2, 24(r9)\n" ! "subic. r2, r2, 0\n" ! "blt floatsDone\n" ! "lfsx f7, r2, r10\n" ! ! "lwz r2, 28(r9)\n" ! "subic. r2, r2, 0\n" ! "blt floatsDone\n" ! "lfsx f8, r2, r10\n" ! ! "lwz r2, 32(r9)\n" ! "subic. r2, r2, 0\n" ! "blt floatsDone\n" ! "lfsx f9, r2, r10\n" ! ! "lwz r2, 36(r9)\n" ! "subic. r2, r2, 0\n" ! "blt floatsDone\n" ! "lfsx f10, r2, r10\n" ! ! "lwz r2, 40(r9)\n" ! "subic. r2, r2, 0\n" ! "blt floatsDone\n" ! "lfsx f11, r2, r10\n" ! ! "lwz r2, 44(r9)\n" ! "subic. r2, r2, 0\n" ! "blt floatsDone\n" ! "lfsx f12, r2, r10\n" ! ! "lwz r2, 48(r9)\n" ! "subic. r2, r2, 0\n" ! "blt floatsDone\n" ! "lfsx f13, r2, r10\n" ! ! "floatsDone:\n" ! ! // load up the virtual function pointer ! "mr r4, %5\n" ! // r4 has funcOffset, r12 has the function index ! "add r4, r4, r3\n" ! "lwz r4, 0(r4)\n" ! "add r4, r4, r12\n" ! "addi r4, r4, -1\n" ! "lwz r12, 0(r4)\n" ! ! "lwz r4, 0(r10)\n" ! "lwz r5, 4(r10)\n" ! "lwz r6, 8(r10)\n" ! "lwz r7, 12(r10)\n" ! "lwz r8, 16(r10)\n" ! "lwz r9, 20(r10)\n" ! "lwz r10, 24(r10)\n" ! "mtctr r12\n" ! "bctrl\n" ! "sub r1, r1, r20\n" ! "lwz r20, -4(r1)\n" //addic r1, r1, 424\n" ! "lwz r0, 8(r1)\n" ! "mtlr r0\n" ! ! : : "r" (floatOffsets), "r" (args), "r" (func), "r" (thisPtr), "r" (copySize), "r" (funcOffset) : "r2", "r9", "r10", "r12", "r3", "r0"); ! #endif } --- 35,68 ---- namespace TNL { ! RPCEvent::RPCEvent(MethodArgList *aMarshaller, RPCGuaranteeType gType, RPCDirection dir) : ! NetEvent((NetEvent::GuaranteeType) gType, (NetEvent::EventDirection) dir), ! mCall(aMarshaller) { } void RPCEvent::marshallArguments() { ! mCall.marshall(); } void RPCEvent::pack(EventConnection *ps, BitStream *bstream) { ! bstream->writeBits(mCall.marshalledData.getBitPosition(), mCall.marshalledData.getBuffer()); ! for(S32 i = 0; i < mCall.mSTEs.size(); i++) ! ps->packStringTableEntry(bstream, mCall.mSTEs[i]); } void RPCEvent::unpack(EventConnection *ps, BitStream *bstream) { ! mCall.unmarshall(bstream); ! for(S32 i = 0; i < mCall.mSTEs.size(); i++) ! mCall.mSTEs[i] = ps->unpackStringTableEntry(bstream); } void RPCEvent::process(EventConnection *ps) { ! MethodPointer p; ! getFuncPtr(p); ! mCall.dispatch(getThisPointer(ps), &p); } Index: tnlRPC.h =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnlRPC.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tnlRPC.h 4 May 2004 01:07:29 -0000 1.4 --- tnlRPC.h 6 May 2004 00:33:38 -0000 1.5 *************** *** 32,35 **** --- 32,39 ---- #endif + #ifndef _TNL_METHODDISPATCH_H_ + #include "tnlMethodDispatch.h" + #endif + namespace TNL { *************** *** 120,285 **** */ - /// NetType serves as a base class for all bit-compressed versions of - /// the base types that can be transmitted using TNL's RPC mechanism. - /// In general, the type names are self-explanatory, providing simple - /// wrappers on the original base types. The template argument for bit - /// counts or numeric ranges is necessary because TNL parses the actual - /// function prototype as a string in order to determine how many bits - /// to use for each RPC parameter. - /// - /// Template parameters to the NetType templates can be either integer - /// constants or enumeration values. If enumeration values are used, - /// the TNL_DECLARE_RPC_ENUM or TNL_DECLARE_RPC_MEM enum macros must - /// be used to register the enumerations with the RPC system. - struct NetType { - - }; - - /// Unsigned integer bit-level RPC template wrapper. - /// - /// When an Int<X> is in the parameter list for an RPC method, that parameter will - /// be transmitted using X bits. - template<U32 bitCount> struct Int : NetType - { - U32 value; - Int(U32 val=0) { value = val; } - operator U32() const { return value; } - U32 getPrecisionBits() { return bitCount; } - }; - - /// Signed integer bit-level RPC template wrapper. - /// - /// When a SignedInt<X> is in the parameter list for an RPC method, that parameter will - /// be transmitted using X bits. - template<U32 bitCount> struct SignedInt : NetType - { - S32 value; - SignedInt(S32 val=0) { value = val; } - operator S32() const { return value; } - U32 getPrecisionBits() { return bitCount; } - }; - - /// Floating point 0...1 value bit-level RPC template wrapper. - /// - /// When a Float<X> is in the parameter list for an RPC method, that parameter will - /// be transmitted using X bits. - template<U32 bitCount> struct Float : NetType - { - F32 value; - Float(F32 val=0) { value = val; } - operator F32() const { return value; } - U32 getPrecisionBits() { return bitCount; } - }; - - /// Floating point -1...1 value bit-level RPC template wrapper. - /// - /// When a SignedFloat<X> is in the parameter list for an RPC method, that parameter will - /// be transmitted using X bits. - template<U32 bitCount> struct SignedFloat : NetType - { - F32 value; - SignedFloat(F32 val=0) { value = val; } - operator F32() const { return value; } - U32 getPrecisionBits() { return bitCount; } - }; - - /// Unsigned ranged integer bit-level RPC template wrapper. - /// - /// The RangedU32 is used to specify a range of valid values for the parameter - /// in the parameter list for an RPC method. - template<U32 rangeStart, U32 rangeEnd> struct RangedU32 : NetType - { - U32 value; - RangedU32(U32 val=rangeStart) { TNLAssert(val >= rangeStart && val <= rangeEnd, "Out of range value!"); value = val; } - operator U32() const { return value; } - }; - - /// RPCArgInfo tracks an individual parameter in an RPC method parameter list - struct RPCArgInfo { - enum Type { - TypeS8, - TypeU8, - TypeS16, - TypeU16, - TypeS32, - TypeU32, - TypeF32, - TypeSignedInt, - TypeInt, - TypeSignedFloat, - TypeFloat, - TypeString, - TypeRangedU32, - TypeBool, - TypeStringTableEntryRef, - TypeByteBufferPtr, - TypeIPAddressRef, - TypeIPAddress, - NumTypes, - }; - bool isVector; ///< True if this is a vector of the specified type argument - U32 argType; ///< The type of this argument. - U32 rangeStart; ///< Start of the U32 range, for TypeRangedU32s. - U32 rangeEnd; ///< End of the U32 range, for TypeRangedU32s. - U32 bitCount; ///< Bit size of this argument. - }; - - /// Manages an enumeration declared with TNL_DECLARE_RPC_ENUM or TNL_DECLARE_RPC_MEM_ENUM - struct RPCEnum - { - const char *mSymbol; ///< The name of the enumeration value - - U32 mValue; ///< The value of the enumeration constant - RPCEnum *mNext; ///< The next in global linked list of enums - - static RPCEnum *mLinkedList; ///< The head of the linked list of enums - - /// Constructor - called from statically allocated RPCEnums, using the declare macros - RPCEnum(const char *symbol, U32 value) - ... [truncated message content] |
From: Mark F. <mar...@us...> - 2004-05-06 00:33:47
|
Update of /cvsroot/opentnl/tnl/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27643/test Modified Files: testGame.cpp testGame.h Log Message: Added tnlMethodDispatch files Split RPC argument parsing and dispatch into seperate module Moved compressed RPC types into tnlTypes.h Removed StringTableEntry from being able to be transmitted as an argument to RPCs Added StringTableEntryRef (and typedef) as valid RPC type Updated all projects to reflect change to StringTableEntryRef Index: testGame.h =================================================================== RCS file: /cvsroot/opentnl/tnl/test/testGame.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testGame.h 20 Apr 2004 04:27:18 -0000 1.1 --- testGame.h 6 May 2004 00:33:38 -0000 1.2 *************** *** 265,269 **** /// that's possible using TNL's RPC. This RPC also sends bool and StringTableEntry data, /// as well as showing the use of the TNL_DECLARE_RPC_ENUM macro. ! TNL_DECLARE_RPC(rpcGotPlayerPos, (bool b1, bool b2, StringTableEntry string, Float<PlayerPosReplyBitSize> x, Float<PlayerPosReplyBitSize> y)); /// TNL_DECLARE_NETCONNECTION is used to declare that TestConnection is a valid connection class to the --- 265,269 ---- /// that's possible using TNL's RPC. This RPC also sends bool and StringTableEntry data, /// as well as showing the use of the TNL_DECLARE_RPC_ENUM macro. ! TNL_DECLARE_RPC(rpcGotPlayerPos, (bool b1, bool b2, StringTableEntryRef string, Float<PlayerPosReplyBitSize> x, Float<PlayerPosReplyBitSize> y)); /// TNL_DECLARE_NETCONNECTION is used to declare that TestConnection is a valid connection class to the Index: testGame.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/test/testGame.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testGame.cpp 20 Apr 2004 04:27:18 -0000 1.1 --- testGame.cpp 6 May 2004 00:33:38 -0000 1.2 *************** *** 355,361 **** TNL_IMPLEMENT_NETCONNECTION(TestConnection, NetClassGroupGame, true); ! TNL_DECLARE_RPC_MEM_ENUM(TestConnection, PlayerPosReplyBitSize); ! TNL_IMPLEMENT_RPC(TestConnection, rpcGotPlayerPos, (bool b1, bool b2, StringTableEntry string, Float<TestConnection::PlayerPosReplyBitSize> x, Float<TestConnection::PlayerPosReplyBitSize> y), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirAny, 0) { --- 355,361 ---- TNL_IMPLEMENT_NETCONNECTION(TestConnection, NetClassGroupGame, true); ! TNL_DECLARE_ENUM(TestConnection::PlayerPosReplyBitSize); ! TNL_IMPLEMENT_RPC(TestConnection, rpcGotPlayerPos, (bool b1, bool b2, StringTableEntryRef string, Float<TestConnection::PlayerPosReplyBitSize> x, Float<TestConnection::PlayerPosReplyBitSize> y), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirAny, 0) { |
From: Mark F. <mar...@us...> - 2004-05-06 00:33:46
|
Update of /cvsroot/opentnl/tnl/master In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27643/master Modified Files: main.cpp masterInterface.cpp masterInterface.h Log Message: Added tnlMethodDispatch files Split RPC argument parsing and dispatch into seperate module Moved compressed RPC types into tnlTypes.h Removed StringTableEntry from being able to be transmitted as an argument to RPCs Added StringTableEntryRef (and typedef) as valid RPC type Updated all projects to reflect change to StringTableEntryRef Index: masterInterface.h =================================================================== RCS file: /cvsroot/opentnl/tnl/master/masterInterface.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** masterInterface.h 20 Apr 2004 04:27:15 -0000 1.1 --- masterInterface.h 6 May 2004 00:33:38 -0000 1.2 *************** *** 85,89 **** TNL_DECLARE_RPC(c2mQueryServers, (U32 queryId, U32 regionMask, U32 minPlayers, U32 maxPlayers, U32 infoFlags, ! U32 maxBots, U32 minCPUSpeed, StringTableEntry gameType, StringTableEntry missionType)); /// m2cQueryServersResponse is sent by the master server in response to a c2mQueryServers RPC, to --- 85,89 ---- TNL_DECLARE_RPC(c2mQueryServers, (U32 queryId, U32 regionMask, U32 minPlayers, U32 maxPlayers, U32 infoFlags, ! U32 maxBots, U32 minCPUSpeed, StringTableEntryRef gameType, StringTableEntryRef missionType)); /// m2cQueryServersResponse is sent by the master server in response to a c2mQueryServers RPC, to *************** *** 130,134 **** /// and mission types, any player counts and the current info flags. TNL_DECLARE_RPC(c2mUpdateServerStatus, ( ! StringTableEntry gameType, StringTableEntry missionType, U32 botCount, U32 playerCount, U32 maxPlayers, U32 infoFlags)); }; --- 130,134 ---- /// and mission types, any player counts and the current info flags. TNL_DECLARE_RPC(c2mUpdateServerStatus, ( ! StringTableEntryRef gameType, StringTableEntryRef missionType, U32 botCount, U32 playerCount, U32 maxPlayers, U32 infoFlags)); }; Index: masterInterface.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/master/masterInterface.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** masterInterface.cpp 20 Apr 2004 04:27:15 -0000 1.1 --- masterInterface.cpp 6 May 2004 00:33:38 -0000 1.2 *************** *** 38,42 **** TNL_IMPLEMENT_RPC(MasterServerInterface, c2mQueryServers, (U32 queryId, U32 regionMask, U32 minPlayers, U32 maxPlayers, U32 infoFlags, ! U32 maxBots, U32 minCPUSpeed, StringTableEntry gameType, StringTableEntry missionType), NetClassGroupMasterMask, RPCGuaranteedOrdered, RPCDirClientToServer, 0) {} --- 38,42 ---- TNL_IMPLEMENT_RPC(MasterServerInterface, c2mQueryServers, (U32 queryId, U32 regionMask, U32 minPlayers, U32 maxPlayers, U32 infoFlags, ! U32 maxBots, U32 minCPUSpeed, StringTableEntryRef gameType, StringTableEntryRef missionType), NetClassGroupMasterMask, RPCGuaranteedOrdered, RPCDirClientToServer, 0) {} *************** *** 67,71 **** TNL_IMPLEMENT_RPC(MasterServerInterface, c2mUpdateServerStatus, ( ! StringTableEntry gameType, StringTableEntry missionType, U32 botCount, U32 playerCount, U32 maxPlayers, U32 infoFlags), NetClassGroupMasterMask, RPCGuaranteedOrdered, RPCDirClientToServer, 0) {} --- 67,71 ---- TNL_IMPLEMENT_RPC(MasterServerInterface, c2mUpdateServerStatus, ( ! StringTableEntryRef gameType, StringTableEntryRef missionType, U32 botCount, U32 playerCount, U32 maxPlayers, U32 infoFlags), NetClassGroupMasterMask, RPCGuaranteedOrdered, RPCDirClientToServer, 0) {} Index: main.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/master/main.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.cpp 27 Apr 2004 23:26:14 -0000 1.3 --- main.cpp 6 May 2004 00:33:38 -0000 1.4 *************** *** 256,260 **** (U32 queryId, U32 regionMask, U32 minPlayers, U32 maxPlayers, U32 infoFlags, U32 maxBots, U32 minCPUSpeed, ! StringTableEntry gameType, StringTableEntry missionType) ) { --- 256,260 ---- (U32 queryId, U32 regionMask, U32 minPlayers, U32 maxPlayers, U32 infoFlags, U32 maxBots, U32 minCPUSpeed, ! StringTableEntryRef gameType, StringTableEntryRef missionType) ) { *************** *** 474,478 **** // Called to update the status of a game server. TNL_DECLARE_RPC_OVERRIDE(c2mUpdateServerStatus, ( ! StringTableEntry gameType, StringTableEntry missionType, U32 botCount, U32 playerCount, U32 maxPlayers, U32 infoFlags)) { --- 474,478 ---- // Called to update the status of a game server. TNL_DECLARE_RPC_OVERRIDE(c2mUpdateServerStatus, ( ! StringTableEntryRef gameType, StringTableEntryRef missionType, U32 botCount, U32 playerCount, U32 maxPlayers, U32 infoFlags)) { |
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1314/zap Modified Files: game.cpp gameItems.cpp main.cpp projectile.cpp sfx.cpp sfx.h ship.cpp ship.h sparkManager.cpp sparkManager.h Log Message: - Added sounds for turbo, health, shield impacts, and commander map activate/deactivate. - Added particles back for engine trails. - Rewrote particle allocation manager to prevent particle starvation. (It seemed that the old allocator assumed that particles were sorted by TTL, but they weren't, so it tended to hold on to dead particles and even deallocate active ones). - Changed energy consumed by shooting. Now you gain energy slowly even if you're firing. - Added better error reporting to sound code on missing sounds. - Doc fixes in GhostConnection. Index: ship.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/ship.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ship.h 3 May 2004 22:06:16 -0000 1.13 --- ship.h 5 May 2004 09:50:35 -0000 1.14 *************** *** 30,33 **** --- 30,34 ---- #include "moveObject.h" #include "sparkManager.h" + #include "sfx.h" namespace Zap *************** *** 75,78 **** --- 76,80 ---- StringTableEntry mPlayerName; bool mShield, mTurbo, mCooldown; + SFXHandle mTurboNoise; S32 mLastTrailPoint[TrailCount]; Index: sparkManager.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sparkManager.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sparkManager.cpp 30 Apr 2004 21:58:10 -0000 1.5 --- sparkManager.cpp 5 May 2004 09:50:35 -0000 1.6 *************** *** 42,45 **** --- 42,46 ---- F32 ttl; Point vel; + Spark *mNext, *mPrev; }; *************** *** 48,60 **** }; U32 firstFreeIndex = 0; Spark gSparks[MaxSparks]; void emitSpark(Point pos, Point vel, Color color, F32 ttl) { ! if(firstFreeIndex >= MaxSparks) return; - Spark *s = gSparks + firstFreeIndex; - firstFreeIndex++; s->pos = pos; --- 49,133 ---- }; + Spark *mFree; + Spark *mActive; + Spark *mActiveTail; + U32 firstFreeIndex = 0; Spark gSparks[MaxSparks]; + void init() + { + // Put all the sparks (from gSparks) onto the free list and mark the tail. + U32 i; + for(i=0; i<MaxSparks-1; i++) + gSparks[i].mNext = &gSparks[i+1]; + gSparks[i+1].mNext = NULL; + + mFree = gSparks; + + // No active sparks yet. + mActive = NULL; + mActiveTail = NULL; + } + + Spark *getSpark() + { + // Are there any in the free list? + Spark *newSpark = NULL; + + if(mFree) + { + newSpark = mFree; + mFree = mFree->mNext; + if(mFree) mFree->mPrev = NULL; + } + else + { + // Reuse one from the active list... + if(mActiveTail) + { + newSpark = mActiveTail; + + if(newSpark->mPrev) newSpark->mPrev->mNext = NULL; + mActiveTail = newSpark->mPrev; + } + else + return NULL; + } + + // Put it at the head of the active list + newSpark->mPrev = NULL; + newSpark->mNext = mActive; + if(mActive) mActive->mPrev = newSpark; + mActive = newSpark; + + return newSpark; + } + + void freeSpark(Spark *s) + { + // Remove it safely from the list it's in... + if(s->mNext) s->mNext->mPrev = s->mPrev; + if(s->mPrev) s->mPrev->mNext = s->mNext; + if(s==mActive) mActive = mActive->mNext; + + // Update tail info + if(s->mNext == NULL) + mActiveTail = s->mPrev; + + // And add it to the free list + s->mNext = mFree; + s->mPrev = NULL; + if(mFree) mFree->mPrev = s; + mFree = s; + + } + void emitSpark(Point pos, Point vel, Color color, F32 ttl) { ! Spark *s = getSpark(); ! ! if(!s) return; s->pos = pos; *************** *** 71,92 **** void tick( F32 dT ) { ! for(U32 i = 0; i < firstFreeIndex; ) { - Spark *theSpark = gSparks + i; if(theSpark->ttl <= dT) { ! firstFreeIndex--; ! *theSpark = gSparks[firstFreeIndex]; } else ! { ! theSpark->ttl -= dT; ! theSpark->pos += theSpark->vel * dT; ! if(theSpark->ttl > 2) ! theSpark->alpha = 1; ! else ! theSpark->alpha = theSpark->ttl * 0.5; ! i++; ! } } } --- 144,166 ---- void tick( F32 dT ) { ! Spark *theSpark = mActive; ! while(theSpark) { if(theSpark->ttl <= dT) { ! Spark *t = theSpark->mNext; ! freeSpark(theSpark); ! theSpark = t; ! continue; // Skip to the next one... } + + theSpark->ttl -= dT; + theSpark->pos += theSpark->vel * dT; + if(theSpark->ttl > 2) + theSpark->alpha = 1; else ! theSpark->alpha = theSpark->ttl * 0.5; ! ! theSpark = theSpark->mNext; } } *************** *** 101,108 **** glEnableClientState(GL_VERTEX_ARRAY); ! glVertexPointer(2, GL_FLOAT, sizeof(Spark), &gSparks[0].pos); ! glColorPointer(4, GL_FLOAT , sizeof(Spark), &gSparks[0].color); ! glDrawArrays(GL_POINTS, 0, firstFreeIndex); glDisableClientState(GL_COLOR_ARRAY); --- 175,203 ---- glEnableClientState(GL_VERTEX_ARRAY); ! // Prepare buffers... ! static struct SparkRender ! { ! Point pos; ! Color color; ! F32 alpha; ! } renderData[MaxSparks]; ! ! Spark *theSpark = mActive; ! SparkRender *r = renderData; ! while(theSpark) ! { ! r->pos = theSpark->pos; ! r->color = theSpark->color; ! r->alpha = theSpark->alpha; ! ! // Advance pointers ! r++; ! theSpark = theSpark->mNext; ! } ! ! glVertexPointer(2, GL_FLOAT, sizeof(SparkRender), &renderData[0].pos); ! glColorPointer(4, GL_FLOAT , sizeof(SparkRender), &renderData[0].color); ! glDrawArrays(GL_POINTS, 0, (r - renderData)); glDisableClientState(GL_COLOR_ARRAY); *************** *** 117,121 **** for(U32 i = 0; i < (500.0 * size); i++) { - F32 th = Random::readF() * 2 * 3.14; F32 f = (Random::readF() * 2 - 1) * 400 * size; --- 212,215 ---- *************** *** 130,134 **** for(U32 i = 0; i < (500.0 * size); i++) { - F32 th = Random::readF() * 2 * 3.14; F32 f = (Random::readF() * 2 - 1) * 400 * size; --- 224,227 ---- *************** *** 146,150 **** for(U32 i = 0; i < (250.0 * size); i++) { - F32 th = Random::readF() * 2 * 3.14; F32 f = (Random::readF() * 0.1 + 0.9) * 200 * size; --- 239,242 ---- *************** *** 172,175 **** --- 264,268 ---- mDropFreq = dropFrequency; mLength = len; + mNodes.clear(); registerTrail(); } Index: projectile.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/projectile.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** projectile.cpp 26 Apr 2004 07:36:06 -0000 1.8 --- projectile.cpp 5 May 2004 09:50:35 -0000 1.9 *************** *** 114,118 **** { SparkManager::emitExplosion(collisionPoint, 0.4, SparkColors, NumSparkColors); ! SFXObject::play(SFXPhaserImpact, pos, velocity); } } --- 114,123 ---- { SparkManager::emitExplosion(collisionPoint, 0.4, SparkColors, NumSparkColors); ! ! Ship *s = dynamic_cast<Ship*>(hitObject); ! if(s && s->mShield) ! SFXObject::play(SFXBounceShield, pos, velocity); ! else ! SFXObject::play(SFXPhaserImpact, pos, velocity); } } Index: sfx.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sfx.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sfx.cpp 22 Apr 2004 07:46:20 -0000 1.9 --- sfx.cpp 5 May 2004 09:50:35 -0000 1.10 *************** *** 42,45 **** --- 42,47 ---- { "phaser_impact.wav", false, 0.7f, false, 150, 600 }, { "ship_explode.wav", false, 1.0, false, 300, 1000 }, + { "ship_heal.wav", false, 1.0, false, 300, 1000 }, + { "ship_turbo.wav", false, 1.0, true, 300, 1000 }, { "flag_capture.wav", true, 0.45f, false, 0, 0 }, { "flag_drop.wav", true, 0.45f, false, 0, 0 }, *************** *** 50,54 **** --- 52,59 ---- { "bounce_wall.wav", false, 0.7f, false, 150, 600 }, { "bounce_obj.wav", false, 0.7f, false, 150, 600 }, + { "bounce_shield.wav", false, 0.7f, false, 150, 600 }, { "boop.wav", true, 0.4f, false, 150, 600 }, + { "comm_up.wav", true, 0.4f, false, 150, 600 }, + { "comm_down.wav", true, 0.4f, false, 150, 600 }, { NULL, false, 0, false, 0, 0 }, }; *************** *** 255,263 **** --- 260,274 ---- #endif if(alGetError() != AL_NO_ERROR) + { + logprintf("Failure (1) loading sound file '%s'", gSFXProfiles[i].fileName); return; + } alBufferData(gBuffers[i], format, data, size, freq); alutUnloadWAV(format, data, size, freq); if(alGetError() != AL_NO_ERROR) + { + logprintf("Failure (2) loading sound file '%s'", gSFXProfiles[i].fileName); return; + } } gSFXValid = true; Index: sparkManager.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sparkManager.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sparkManager.h 30 Apr 2004 21:58:10 -0000 1.4 --- sparkManager.h 5 May 2004 09:50:35 -0000 1.5 *************** *** 42,45 **** --- 42,46 ---- void tick( F32 dT); void render(); + void init(); }; Index: gameItems.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameItems.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gameItems.cpp 25 Apr 2004 06:01:30 -0000 1.2 --- gameItems.cpp 5 May 2004 09:50:35 -0000 1.3 *************** *** 56,60 **** theShip->damageObject(&di); ! return true; } --- 56,60 ---- theShip->damageObject(&di); ! SFXObject::play(SFXShipHeal, getRenderPos(), getRenderVel()); return true; } Index: game.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/game.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** game.cpp 3 May 2004 23:31:45 -0000 1.18 --- game.cpp 5 May 2004 09:50:35 -0000 1.19 *************** *** 393,397 **** { mInCommanderMap = !mInCommanderMap; ! UserInterface::playBoop(); GameConnection *conn = getConnectionToServer(); --- 393,401 ---- { mInCommanderMap = !mInCommanderMap; ! if(mInCommanderMap) ! SFXObject::play(SFXUICommUp); ! else ! SFXObject::play(SFXUICommDown); ! GameConnection *conn = getConnectionToServer(); Index: main.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/main.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** main.cpp 4 May 2004 19:46:34 -0000 1.20 --- main.cpp 5 May 2004 09:50:35 -0000 1.21 *************** *** 36,40 **** #include "UI.h" #include "UIGame.h" ! #include "UINameEntry.h" #include "UIMenus.h" #include "game.h" --- 36,40 ---- #include "UI.h" #include "UIGame.h" ! #include "UINameEntry.h" #include "UIMenus.h" #include "game.h" *************** *** 42,45 **** --- 42,46 ---- #include "masterConnection.h" #include "sfx.h" + #include "sparkManager.h" namespace Zap *************** *** 367,370 **** --- 368,372 ---- if(hasClient) { + SparkManager::init(); SFXObject::init(); glutInitWindowSize(800, 600); Index: sfx.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sfx.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sfx.h 22 Apr 2004 07:46:20 -0000 1.5 --- sfx.h 5 May 2004 09:50:35 -0000 1.6 *************** *** 41,44 **** --- 41,46 ---- SFXPhaserImpact, SFXShipExplode, + SFXShipHeal, + SFXShipTurbo, SFXFlagCapture, SFXFlagDrop, *************** *** 49,53 **** --- 51,58 ---- SFXBounceWall, SFXBounceObject, + SFXBounceShield, SFXUIBoop, + SFXUICommUp, + SFXUICommDown, NumSFXBuffers }; Index: ship.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/ship.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ship.cpp 3 May 2004 22:06:16 -0000 1.23 --- ship.cpp 5 May 2004 09:50:35 -0000 1.24 *************** *** 74,77 **** --- 74,78 ---- mTurbo = false; mCooldown = false; + mTurboNoise = NULL; } *************** *** 153,157 **** if(currentTime - lastFireTime > FireDelay) { ! mEnergy -= 1.f; lastFireTime = currentTime; Point dir(sin(mMoveState[ActualState].angle), cos(mMoveState[ActualState].angle) ); --- 154,158 ---- if(currentTime - lastFireTime > FireDelay) { ! mEnergy -= 0.5f; lastFireTime = currentTime; Point dir(sin(mMoveState[ActualState].angle), cos(mMoveState[ActualState].angle) ); *************** *** 255,258 **** --- 256,262 ---- SFXObject::setListenerParams(mMoveState[RenderState].pos, mMoveState[RenderState].vel); + + if(mTurboNoise) + mTurboNoise->setMovementParams(mMoveState[RenderState].pos, mMoveState[RenderState].vel); } *************** *** 267,270 **** --- 271,277 ---- for(U32 i=0; i<TrailCount; i++) mTrail[i].tick(deltaT); + + if(mTurboNoise) + mTurboNoise->setMovementParams(mMoveState[RenderState].pos, mMoveState[RenderState].vel); } *************** *** 378,381 **** --- 385,399 ---- else interpTime = 1; + + // Update the turbo noise + if(mTurbo && mTurboNoise.isNull()) + mTurboNoise = SFXObject::play(SFXShipTurbo, mMoveState[RenderState].pos, mMoveState[RenderState].vel); + + if(!mTurbo && mTurboNoise.isValid()) + { + mTurboNoise->setGain(0); + mTurboNoise->stop(); + mTurboNoise = NULL; + } } *************** *** 522,525 **** --- 540,554 ---- emitShipExplosion(mMoveState[ActualState].pos); } + + // Update the turbo noise + if(mTurbo && mTurboNoise.isNull()) + mTurboNoise = SFXObject::play(SFXShipTurbo, mMoveState[RenderState].pos, mMoveState[RenderState].vel); + + if(!mTurbo && mTurboNoise.isValid()) + { + mTurboNoise->setGain(0); + mTurboNoise->stop(); + mTurboNoise = NULL; + } } *************** *** 695,698 **** --- 724,773 ---- } + // Finally, do some particles + Point velDir(lastMove.right - lastMove.left, lastMove.down - lastMove.up); + F32 len = velDir.len(); + + if(len > 0) + { + if(len > 1) + velDir *= 1 / len; + + Point shipDirs[4]; + shipDirs[0].set(sin(mMoveState[RenderState].angle), cos(mMoveState[RenderState].angle) ); + shipDirs[1].set(-shipDirs[0]); + shipDirs[2].set(shipDirs[0].y, -shipDirs[0].x); + shipDirs[3].set(-shipDirs[0].y, shipDirs[0].x); + + for(U32 i = 0; i < 4; i++) + { + F32 th = shipDirs[i].dot(velDir); + + if(th > 0.1) + { + // shoot some sparks... + if(th >= 1*TNL::Random::readF() * velDir.len()) + { + Point chaos(TNL::Random::readF(),TNL::Random::readF()); + chaos *= 5; + + //interp give us some nice enginey colors... + Color dim(1, 0, 0); + Color light(1, 1, 0); + Color thrust; + + F32 t = TNL::Random::readF(); + thrust.interp(t, dim, light); + + SparkManager::emitSpark( + mMoveState[RenderState].pos - shipDirs[i] * 13, + -shipDirs[i] * 100 + chaos, + thrust, + 1.5 * Random::readF() + ); + } + } + } + } + } |
From: Ben G. <s_a...@us...> - 2004-05-05 09:50:44
|
Update of /cvsroot/opentnl/tnl/exe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1314/exe Added Files: bounce_shield.wav comm_down.wav comm_up.wav ship_heal.wav ship_turbo.wav Log Message: - Added sounds for turbo, health, shield impacts, and commander map activate/deactivate. - Added particles back for engine trails. - Rewrote particle allocation manager to prevent particle starvation. (It seemed that the old allocator assumed that particles were sorted by TTL, but they weren't, so it tended to hold on to dead particles and even deallocate active ones). - Changed energy consumed by shooting. Now you gain energy slowly even if you're firing. - Added better error reporting to sound code on missing sounds. - Doc fixes in GhostConnection. --- NEW FILE: ship_turbo.wav --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ship_heal.wav --- (This appears to be a binary file; contents omitted.) --- NEW FILE: bounce_shield.wav --- (This appears to be a binary file; contents omitted.) --- NEW FILE: comm_down.wav --- (This appears to be a binary file; contents omitted.) --- NEW FILE: comm_up.wav --- (This appears to be a binary file; contents omitted.) |
From: Ben G. <s_a...@us...> - 2004-05-05 09:50:43
|
Update of /cvsroot/opentnl/tnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1314/tnl Modified Files: tnlGhostConnection.h Log Message: - Added sounds for turbo, health, shield impacts, and commander map activate/deactivate. - Added particles back for engine trails. - Rewrote particle allocation manager to prevent particle starvation. (It seemed that the old allocator assumed that particles were sorted by TTL, but they weren't, so it tended to hold on to dead particles and even deallocate active ones). - Changed energy consumed by shooting. Now you gain energy slowly even if you're firing. - Added better error reporting to sound code on missing sounds. - Doc fixes in GhostConnection. Index: tnlGhostConnection.h =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnlGhostConnection.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tnlGhostConnection.h 20 Apr 2004 04:27:18 -0000 1.1 --- tnlGhostConnection.h 5 May 2004 09:50:35 -0000 1.2 *************** *** 59,63 **** /// /// There is a cap on the maximum number of ghosts that can be active through a GhostConnection at once. ! /// The enum GhostIdBitSize (defualts to 10) determines how many bits will be used to transmit the ID for /// each ghost, so the maximum number is 2^GhostIdBitSize or 1024. This can be easily raised; see the /// GhostConstants enum. --- 59,63 ---- /// /// There is a cap on the maximum number of ghosts that can be active through a GhostConnection at once. ! /// The enum GhostIdBitSize (defaults to 10) determines how many bits will be used to transmit the ID for /// each ghost, so the maximum number is 2^GhostIdBitSize or 1024. This can be easily raised; see the /// GhostConstants enum. *************** *** 166,171 **** void setGhostTo(bool ghostTo); ///< Sets whether ghosts are allowed from the other side of the connection. ! bool doesGhostFrom() { return mGhostArray != NULL; } ///< Does this GhostConnection ghosts NetObjects to the remote host? ! bool doesGhostTo() { return mLocalGhosts != NULL; } ///< Does this GhostConnection receive ghosts sent from the remote host? enum GhostConstants { --- 166,171 ---- void setGhostTo(bool ghostTo); ///< Sets whether ghosts are allowed from the other side of the connection. ! bool doesGhostFrom() { return mGhostArray != NULL; } ///< Does this GhostConnection ghost NetObjects to the remote host? ! bool doesGhostTo() { return mLocalGhosts != NULL; } ///< Does this GhostConnection receive ghosts from the remote host? enum GhostConstants { |
From: Mark F. <mar...@us...> - 2004-05-04 19:47:14
|
Update of /cvsroot/opentnl/tnl/exe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4782/exe Modified Files: README.txt Added Files: level4.txt Log Message: Added new CTF level --- NEW FILE: level4.txt --- GridSize 300 CTFGameType 10 8 Team Blue 0 0 1 Team Red 1 0 0 CTFFlagItem 0 6 2 CTFFlagItem 1 6 14 BarrierMaker 0 1 5 1 5.5 0.8 6.5 0.8 7 1 12 1 12 15 7 15 6.5 15.2 5.5 15.2 5 15 0 15 0 1 BarrierMaker 6 6 7 7 7 7.5 9 7.5 9 8.5 7 8.5 7 9 6 10 5 9 5 8.5 3 8.5 3 7.5 5 7.5 5 7 6 6 BarrierMaker 5 3 5 3.5 4 3.5 5 3 BarrierMaker 4 4 5 4 5 5 5.5 5 BarrierMaker 8 3 7 3 7 5 BarrierMaker 4 3.5 5 3.5 5 3 4 3.5 BarrierMaker 4 2.5 4.5 2.5 4.5 2 5 2 BarrierMaker 6 5 5.5 3 6.5 3 6 5 BarrierMaker 3.5 4.5 3.5 6 4 6 BarrierMaker 4.5 6 4.5 4.5 4 4.5 BarrierMaker 3.5 2 4 2 BarrierMaker 1.5 2 3 2 3 3.5 1.5 2 BarrierMaker 1 2 2.5 4 1 3 1 2 BarrierMaker 7 2 7.5 2 7 2.5 7 2 BarrierMaker 7.5 4 8 4 8 5 7.5 5 7.5 4 BarrierMaker 8 6 11 4 11 2 8 6 BarrierMaker 8 2.5 9 2.5 9 3 8.5 3.5 BarrierMaker 7 13 7 12.5 8 12.5 7 13 BarrierMaker 8 12 7 12 7 11 6.5 11 BarrierMaker 4 13 5 13 5 11 BarrierMaker 8 12.5 7 12.5 7 13 8 12.5 BarrierMaker 8 13.5 7.5 13.5 7.5 14 7 14 BarrierMaker 6 11 6.5 13 5.5 13 6 11 BarrierMaker 8.5 11.5 8.5 10 8 10 BarrierMaker 7.5 10 7.5 11.5 8 11.5 BarrierMaker 8.5 14 8 14 BarrierMaker 10.5 14 9 14 9 12.5 10.5 14 BarrierMaker 11 14 9.5 12 11 13 11 14 BarrierMaker 5 14 4.5 14 5 13.5 5 14 BarrierMaker 4.5 12 4 12 4 11 4.5 11 4.5 12 BarrierMaker 4 10 1 12 1 14 4 10 BarrierMaker 4 13.5 3 13.5 3 13 3.5 12.5 Spawn 0 3.5 4 Spawn 0 11 1.5 Spawn 0 0.5 1.5 Spawn 0 4.5 7 Spawn 0 8.7 2.8 Spawn 0 11 4.5 Spawn 0 6 1.2 Spawn 1 8.5 12 Spawn 1 1 14.5 Spawn 1 11.5 14.5 Spawn 1 7.5 9 Spawn 1 3.3 13.2 Spawn 1 1 11.5 Spawn 1 6 14.8 Index: README.txt =================================================================== RCS file: /cvsroot/opentnl/tnl/exe/README.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** README.txt 4 May 2004 18:24:46 -0000 1.5 --- README.txt 4 May 2004 19:46:33 -0000 1.6 *************** *** 11,14 **** --- 11,15 ---- - Added README - Added credits on exit + - Added a new CTF level Controls: |
From: Mark F. <mar...@us...> - 2004-05-04 19:46:42
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4782/zap Modified Files: UIGame.cpp ZAP.vcproj main.cpp Log Message: Added new CTF level Index: main.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/main.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** main.cpp 4 May 2004 18:24:52 -0000 1.19 --- main.cpp 4 May 2004 19:46:34 -0000 1.20 *************** *** 54,58 **** const char *gMasterAddressString = "IP:master.opentnl.org:29005"; Address gMasterAddress; ! const char *gLevelList = "level1.txt level2.txt level3.txt level2.txt"; void reshape(int nw, int nh) --- 54,58 ---- const char *gMasterAddressString = "IP:master.opentnl.org:29005"; Address gMasterAddress; ! const char *gLevelList = "level4.txt level2.txt level1.txt level2.txt level3.txt level2.txt"; void reshape(int nw, int nh) Index: UIGame.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/UIGame.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** UIGame.cpp 3 May 2004 22:55:51 -0000 1.16 --- UIGame.cpp 4 May 2004 19:46:34 -0000 1.17 *************** *** 229,239 **** #if 0 ! // some code for outputting the RTT for the connection ! // useful for testing lag code GameConnection *con = gClientGame->getConnectionToServer(); if(con) { ! drawStringf(10, 550, 30, "%0.2g", con->getRoundTripTime()); } #endif --- 229,243 ---- #if 0 ! // some code for outputting the position of the ship for finding good spawns GameConnection *con = gClientGame->getConnectionToServer(); if(con) { ! GameObject *co = con->getControlObject(); ! if(co) ! { ! Point pos = co->getActualPos() * F32(1 / 300.0f); ! drawStringf(10, 550, 30, "%0.2g, %0.2g", pos.x, pos.y); ! } } #endif Index: ZAP.vcproj =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/ZAP.vcproj,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ZAP.vcproj 2 May 2004 06:27:41 -0000 1.11 --- ZAP.vcproj 4 May 2004 19:46:34 -0000 1.12 *************** *** 190,193 **** --- 190,196 ---- </File> <File + RelativePath="..\exe\level4.txt"> + </File> + <File RelativePath=".\main.cpp"> </File> |
From: Mark F. <mar...@us...> - 2004-05-04 18:25:31
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19048/zap Modified Files: game.h main.cpp Log Message: Upped version number in readme and game Placed deathmatch game between ctf and soccer games Lowered time limit to 10 minutes Index: main.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/main.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** main.cpp 3 May 2004 23:31:45 -0000 1.18 --- main.cpp 4 May 2004 18:24:52 -0000 1.19 *************** *** 54,58 **** const char *gMasterAddressString = "IP:master.opentnl.org:29005"; Address gMasterAddress; ! const char *gLevelList = "level1.txt level3.txt"; void reshape(int nw, int nh) --- 54,58 ---- const char *gMasterAddressString = "IP:master.opentnl.org:29005"; Address gMasterAddress; ! const char *gLevelList = "level1.txt level2.txt level3.txt level2.txt"; void reshape(int nw, int nh) Index: game.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/game.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** game.h 4 May 2004 06:27:40 -0000 1.13 --- game.h 4 May 2004 18:24:51 -0000 1.14 *************** *** 213,217 **** extern void endGame(); ! #define ZAP_GAME_STRING "ZAP 1.1.3" }; --- 213,217 ---- extern void endGame(); ! #define ZAP_GAME_STRING "ZAP 1.1.4" }; |
From: Mark F. <mar...@us...> - 2004-05-04 18:25:31
|
Update of /cvsroot/opentnl/tnl/exe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19048/exe Modified Files: README.txt level1.txt level2.txt level3.txt Log Message: Upped version number in readme and game Placed deathmatch game between ctf and soccer games Lowered time limit to 10 minutes Index: level3.txt =================================================================== RCS file: /cvsroot/opentnl/tnl/exe/level3.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** level3.txt 3 May 2004 02:41:00 -0000 1.5 --- level3.txt 4 May 2004 18:24:51 -0000 1.6 *************** *** 1,3 **** ! SoccerGameType 20 8 GridSize 280 --- 1,3 ---- ! SoccerGameType 10 8 GridSize 280 Index: level1.txt =================================================================== RCS file: /cvsroot/opentnl/tnl/exe/level1.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** level1.txt 2 May 2004 06:27:40 -0000 1.5 --- level1.txt 4 May 2004 18:24:51 -0000 1.6 *************** *** 3,7 **** GridSize 300 ! CTFGameType 20 8 Team Blue 0 0 1 --- 3,7 ---- GridSize 300 ! CTFGameType 10 8 Team Blue 0 0 1 Index: level2.txt =================================================================== RCS file: /cvsroot/opentnl/tnl/exe/level2.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** level2.txt 3 May 2004 22:06:15 -0000 1.2 --- level2.txt 4 May 2004 18:24:51 -0000 1.3 *************** *** 3,7 **** GridSize 128 ! GameType 0.5 Team Blue 0 0 1 --- 3,7 ---- GridSize 128 ! GameType 0.33 Team Blue 0 0 1 Index: README.txt =================================================================== RCS file: /cvsroot/opentnl/tnl/exe/README.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README.txt 4 May 2004 01:18:01 -0000 1.4 --- README.txt 4 May 2004 18:24:46 -0000 1.5 *************** *** 1,7 **** ! ZAP 1.1.3 Welcome to ZAP, the retro multiplayer team action game! ! Changes since the last version: - Added shields, boost and ship energy - Added Soccer game type --- 1,7 ---- ! ZAP 1.1.4 Welcome to ZAP, the retro multiplayer team action game! ! Changes since version 1.1.2: - Added shields, boost and ship energy - Added Soccer game type *************** *** 10,13 **** --- 10,14 ---- - Removed player particle trails and added motion trails - Added README + - Added credits on exit Controls: |
From: Mark F. <mar...@us...> - 2004-05-04 06:27:52
|
Update of /cvsroot/opentnl/tnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8692/tnl Modified Files: ghostConnection.cpp tnlTypes.h Log Message: fixed <new> conflict with STL (I think) fixed server deleted object crash fixed ghosting bug where objects not yet available got messages Index: tnlTypes.h =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnlTypes.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tnlTypes.h 30 Apr 2004 20:27:40 -0000 1.2 --- tnlTypes.h 4 May 2004 06:27:40 -0000 1.3 *************** *** 37,42 **** #endif #include <stdlib.h> ! inline void* operator new(size_t size, void* ptr) { return ptr; } ! namespace TNL { --- 37,42 ---- #endif #include <stdlib.h> ! //inline void* operator new(size_t size, void* ptr) { return ptr; } ! #include <new> namespace TNL { Index: ghostConnection.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/ghostConnection.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ghostConnection.cpp 2 May 2004 06:27:40 -0000 1.3 --- ghostConnection.cpp 4 May 2004 06:27:39 -0000 1.4 *************** *** 867,871 **** ghostPushToZero(mGhostArray[j]); mGhostArray[j]->flags &= ~GhostInfo::NotYetGhosted; ! mGhostArray[j]->flags |= GhostInfo::ScopedEvent; postNetEvent(new GhostAlwaysObjectEvent(mGhostArray[j]->obj, mGhostArray[j]->index)); --- 867,871 ---- ghostPushToZero(mGhostArray[j]); mGhostArray[j]->flags &= ~GhostInfo::NotYetGhosted; ! mGhostArray[j]->flags |= GhostInfo::Ghosting | GhostInfo::ScopedEvent; postNetEvent(new GhostAlwaysObjectEvent(mGhostArray[j]->obj, mGhostArray[j]->index)); |
From: Mark F. <mar...@us...> - 2004-05-04 06:27:51
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8692/zap Modified Files: game.h Log Message: fixed <new> conflict with STL (I think) fixed server deleted object crash fixed ghosting bug where objects not yet available got messages Index: game.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/game.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** game.h 3 May 2004 22:06:16 -0000 1.12 --- game.h 4 May 2004 06:27:40 -0000 1.13 *************** *** 91,95 **** struct DeleteRef { ! GameObject *theObject; U32 delay; --- 91,95 ---- struct DeleteRef { ! SafePtr<GameObject> theObject; U32 delay; |
From: Mark F. <mar...@us...> - 2004-05-04 01:07:38
|
Update of /cvsroot/opentnl/tnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16823/tnl Modified Files: tnlRPC.h Log Message: Fixed bad assert in RangedU32 class Index: tnlRPC.h =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnlRPC.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tnlRPC.h 27 Apr 2004 23:26:15 -0000 1.3 --- tnlRPC.h 4 May 2004 01:07:29 -0000 1.4 *************** *** 191,195 **** { U32 value; ! RangedU32(U32 val=rangeStart) { TNLAssert(value >= rangeStart && value <= rangeEnd, "Out of range value!"); value = val; } operator U32() const { return value; } }; --- 191,195 ---- { U32 value; ! RangedU32(U32 val=rangeStart) { TNLAssert(val >= rangeStart && val <= rangeEnd, "Out of range value!"); value = val; } operator U32() const { return value; } }; |
From: Mark F. <mar...@us...> - 2004-05-04 01:01:25
|
Update of /cvsroot/opentnl/tnl/exe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15648/exe Modified Files: README.txt Log Message: Updated README for 1.1.3 Index: README.txt =================================================================== RCS file: /cvsroot/opentnl/tnl/exe/README.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** README.txt 3 May 2004 22:55:50 -0000 1.2 --- README.txt 4 May 2004 01:00:37 -0000 1.3 *************** *** 1,3 **** ! ZAP 1.2 Welcome to ZAP, the retro multiplayer team action game! --- 1,3 ---- ! ZAP 1.1.3 Welcome to ZAP, the retro multiplayer team action game! *************** *** 7,10 **** --- 7,11 ---- - Added Soccer game type - Added level cycling and victory conditions + - Added deathmatch mini level between team levels - Removed player particle trails and added motion trails - Added README |
From: Mark F. <mar...@us...> - 2004-05-04 00:37:16
|
Update of /cvsroot/opentnl/tnl/osx/tnl.xcode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11804/osx/tnl.xcode Modified Files: project.pbxproj Log Message: Added new files to mac project file. Index: project.pbxproj =================================================================== RCS file: /cvsroot/opentnl/tnl/osx/tnl.xcode/project.pbxproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** project.pbxproj 23 Apr 2004 02:14:29 -0000 1.4 --- project.pbxproj 4 May 2004 00:37:07 -0000 1.5 *************** *** 1752,1755 **** --- 1752,1757 ---- 6656DDDD0635C95C00E30126, DB997D2C0638AFC1002745B0, + DBAFF49C06471A4200683BA4, + DBAFF4AA06471AAE00683BA4, ); isa = PBXHeadersBuildPhase; *************** *** 1786,1789 **** --- 1788,1793 ---- DB997D2A0638AFC1002745B0, DB997D2B0638AFC1002745B0, + DBAFF49B06471A4200683BA4, + DBAFF4A906471AAE00683BA4, ); isa = PBXSourcesBuildPhase; *************** *** 1802,1806 **** GCC_WARN_UNKNOWN_PRAGMAS = NO; HEADER_SEARCH_PATHS = "../glut ../openal"; ! INSTALL_PATH = /usr/local/bin; MACOSX_DEPLOYMENT_TARGET = 10.2; OTHER_CFLAGS = ""; --- 1806,1810 ---- GCC_WARN_UNKNOWN_PRAGMAS = NO; HEADER_SEARCH_PATHS = "../glut ../openal"; ! INSTALL_PATH = ""; MACOSX_DEPLOYMENT_TARGET = 10.2; OTHER_CFLAGS = ""; *************** *** 1810,1813 **** --- 1814,1818 ---- SECTORDER_FLAGS = ""; WARNING_CFLAGS = "-Wmost"; + WRAPPER_EXTENSION = app; }; dependencies = ( *************** *** 2219,2222 **** --- 2224,2231 ---- 6692C0E606247C3B00D5ADFE = { children = ( + DBAFF4A706471AAE00683BA4, + DBAFF4A806471AAE00683BA4, + DBAFF49906471A4200683BA4, + DBAFF49A06471A4200683BA4, DB997D270638AFC1002745B0, DB997D280638AFC1002745B0, *************** *** 4067,4070 **** --- 4076,4139 ---- }; }; + DBAFF49906471A4200683BA4 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = soccerGame.cpp; + path = ../zap/soccerGame.cpp; + refType = 2; + sourceTree = SOURCE_ROOT; + }; + DBAFF49A06471A4200683BA4 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = soccerGame.h; + path = ../zap/soccerGame.h; + refType = 2; + sourceTree = SOURCE_ROOT; + }; + DBAFF49B06471A4200683BA4 = { + fileRef = DBAFF49906471A4200683BA4; + isa = PBXBuildFile; + settings = { + }; + }; + DBAFF49C06471A4200683BA4 = { + fileRef = DBAFF49A06471A4200683BA4; + isa = PBXBuildFile; + settings = { + }; + }; + DBAFF4A706471AAE00683BA4 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = UICredits.cpp; + path = ../zap/UICredits.cpp; + refType = 2; + sourceTree = SOURCE_ROOT; + }; + DBAFF4A806471AAE00683BA4 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = UICredits.h; + path = ../zap/UICredits.h; + refType = 2; + sourceTree = SOURCE_ROOT; + }; + DBAFF4A906471AAE00683BA4 = { + fileRef = DBAFF4A706471AAE00683BA4; + isa = PBXBuildFile; + settings = { + }; + }; + DBAFF4AA06471AAE00683BA4 = { + fileRef = DBAFF4A806471AAE00683BA4; + isa = PBXBuildFile; + settings = { + }; + }; }; rootObject = 29B97313FDCFA39411CA2CEA; |
From: Mark F. <mar...@us...> - 2004-05-03 23:31:57
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv374/zap Modified Files: game.cpp main.cpp Log Message: Updated log file writer for NULL file Removed bogus assert in game for getGameType() == NULL Index: main.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/main.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** main.cpp 3 May 2004 22:55:51 -0000 1.17 --- main.cpp 3 May 2004 23:31:45 -0000 1.18 *************** *** 210,219 **** ~FileLogConsumer() { ! fclose(f); } void logString(const char *string) { ! fprintf(f, "%s\r\n", string); } } gFileLogConsumer; --- 210,221 ---- ~FileLogConsumer() { ! if(f) ! fclose(f); } void logString(const char *string) { ! if(f) ! fprintf(f, "%s\r\n", string); } } gFileLogConsumer; Index: game.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/game.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** game.cpp 3 May 2004 22:06:16 -0000 1.17 --- game.cpp 3 May 2004 23:31:45 -0000 1.18 *************** *** 77,81 **** GameType *Game::getGameType() { - TNLAssert(mGameType, "Unexpected null game type!"); return mGameType; } --- 77,80 ---- |
From: Mark F. <mar...@us...> - 2004-05-03 23:04:23
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27691/zap Modified Files: Makefile Log Message: Added soccer game type to linux makefile Index: Makefile =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 30 Apr 2004 07:05:23 -0000 1.4 --- Makefile 3 May 2004 23:03:38 -0000 1.5 *************** *** 31,34 **** --- 31,35 ---- ship.o\ sfx.o\ + soccerGame.o\ SweptEllipsoid.o\ sparkManager.o\ |
From: Mark F. <mar...@us...> - 2004-05-03 22:56:29
|
Update of /cvsroot/opentnl/tnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26044/tnl Modified Files: certificate.cpp Log Message: Added newlines to end of files Updated README Index: certificate.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/certificate.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** certificate.cpp 20 Apr 2004 04:27:18 -0000 1.1 --- certificate.cpp 3 May 2004 22:55:51 -0000 1.2 *************** *** 84,86 **** } ! }; \ No newline at end of file --- 84,86 ---- } ! }; |
From: Mark F. <mar...@us...> - 2004-05-03 22:56:00
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26044/zap Modified Files: UI.cpp UI.h UIGame.cpp UIGame.h main.cpp moveObject.h quickChat.h timer.h Log Message: Added newlines to end of files Updated README Index: moveObject.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/moveObject.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** moveObject.h 20 Apr 2004 04:27:20 -0000 1.1 --- moveObject.h 3 May 2004 22:55:51 -0000 1.2 *************** *** 85,87 **** }; ! #endif \ No newline at end of file --- 85,87 ---- }; ! #endif Index: timer.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/timer.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** timer.h 2 May 2004 06:27:41 -0000 1.1 --- timer.h 3 May 2004 22:55:51 -0000 1.2 *************** *** 74,76 **** }; ! #endif \ No newline at end of file --- 74,76 ---- }; ! #endif Index: quickChat.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/quickChat.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** quickChat.h 22 Apr 2004 07:27:43 -0000 1.1 --- quickChat.h 3 May 2004 22:55:51 -0000 1.2 *************** *** 63,65 **** }; ! #endif \ No newline at end of file --- 63,65 ---- }; ! #endif Index: UI.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/UI.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UI.h 27 Apr 2004 20:41:53 -0000 1.3 --- UI.h 3 May 2004 22:55:51 -0000 1.4 *************** *** 50,53 **** --- 50,56 ---- virtual void onMouseDown(S32 x, S32 y); virtual void onMouseUp(S32 x, S32 y); + virtual void onRightMouseDown(S32 x, S32 y); + virtual void onRightMouseUp(S32 x, S32 y); + virtual void onMouseMoved(S32 x, S32 y); virtual void onMouseDragged(S32 x, S32 y); Index: UI.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/UI.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UI.cpp 22 Apr 2004 07:46:20 -0000 1.2 --- UI.cpp 3 May 2004 22:55:51 -0000 1.3 *************** *** 121,124 **** --- 121,134 ---- } + void UserInterface::onRightMouseDown(S32 x, S32 y) + { + + } + + void UserInterface::onRightMouseUp(S32 x, S32 y) + { + + } + void UserInterface::onMouseMoved(S32 x, S32 y) { Index: UIGame.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/UIGame.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UIGame.h 27 Apr 2004 20:41:53 -0000 1.4 --- UIGame.h 3 May 2004 22:55:51 -0000 1.5 *************** *** 92,95 **** --- 92,97 ---- void onMouseDown(S32 x, S32 y); void onMouseUp(S32 x, S32 y); + void onRightMouseDown(S32 x, S32 y); + void onRightMouseUp(S32 x, S32 y); void onKeyDown(U32 key); void onKeyUp(U32 key); Index: UIGame.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/UIGame.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** UIGame.cpp 3 May 2004 02:41:01 -0000 1.15 --- UIGame.cpp 3 May 2004 22:55:51 -0000 1.16 *************** *** 272,275 **** --- 272,285 ---- } + void GameUserInterface::onRightMouseDown(S32 x, S32 y) + { + mCurrentMove.shield = true; + } + + void GameUserInterface::onRightMouseUp(S32 x, S32 y) + { + mCurrentMove.shield = false; + } + void GameUserInterface::onControllerButtonDown(U32 buttonIndex) { Index: main.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/main.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** main.cpp 3 May 2004 22:06:16 -0000 1.16 --- main.cpp 3 May 2004 22:55:51 -0000 1.17 *************** *** 88,107 **** void mouse(int button, int state, int x, int y) { ! // This is pretty gross. We need a trigger system. - BJG ! static int mouseState = 0; ! if(UserInterface::current && button == 0) { ! if(state==1 && !mouseState) { UserInterface::current->onMouseUp(x, y); ! mouseState = 0; } else { ! mouseState = state; UserInterface::current->onMouseDown(x, y); } } } --- 88,121 ---- void mouse(int button, int state, int x, int y) { ! static int mouseState[2] = { 0, }; ! if(!UserInterface::current) ! return; ! if(button == GLUT_LEFT_BUTTON) { ! if(state == 1 && !mouseState[0]) { UserInterface::current->onMouseUp(x, y); ! mouseState[0] = 0; } else { ! mouseState[0] = state; UserInterface::current->onMouseDown(x, y); } } + else if(button == GLUT_RIGHT_BUTTON) + { + if(state == 1 && !mouseState[1]) + { + UserInterface::current->onRightMouseUp(x, y); + mouseState[1] = 0; + } + else + { + mouseState[1] = state; + UserInterface::current->onRightMouseDown(x, y); + } + } } |