opentnl-cvs Mailing List for Torque Network Library (Page 27)
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-04-20 22:18:30
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6557/zap Modified Files: projectile.cpp sfx.cpp Log Message: Merged MacOS X build fixes. Index: projectile.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/projectile.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** projectile.cpp 20 Apr 2004 21:53:35 -0000 1.4 --- projectile.cpp 20 Apr 2004 22:17:42 -0000 1.5 *************** *** 181,195 **** process(deltaT); liveTime += deltaT; - /* if(alive) - { - if(liveTime <= deltaT) - { - getGame()->deleteObject(this, 500); - liveTime = 0; - alive = false; - } - else - liveTime -= deltaT; - } */ } --- 181,184 ---- *************** *** 235,237 **** } ! }; \ No newline at end of file --- 224,226 ---- } ! }; Index: sfx.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sfx.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sfx.cpp 20 Apr 2004 19:45:05 -0000 1.6 --- sfx.cpp 20 Apr 2004 22:17:46 -0000 1.7 *************** *** 29,33 **** #include "tnlLog.h" ! #if defined (TNL_OS_WIN32) || defined (TNL_OS_LINUX) #include "alInclude.h" --- 29,33 ---- #include "tnlLog.h" ! #if defined (TNL_OS_WIN32) || defined (TNL_OS_LINUX) || defined (TNL_OS_MAC_OSX) #include "alInclude.h" *************** *** 242,246 **** --- 242,250 ---- ALboolean loop; + #ifdef TNL_OS_MAC_OSX + alutLoadWAVFile((ALbyte *) gSFXProfiles[i].fileName, &format, &data, &size, &freq); + #else alutLoadWAVFile((ALbyte *) gSFXProfiles[i].fileName, &format, &data, &size, &freq, &loop); + #endif if(alGetError() != AL_NO_ERROR) return; |
From: Ben G. <s_a...@us...> - 2004-04-20 22:18:20
|
Update of /cvsroot/opentnl/tnl/openal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6557/openal Modified Files: alInclude.h Log Message: Merged MacOS X build fixes. Index: alInclude.h =================================================================== RCS file: /cvsroot/opentnl/tnl/openal/alInclude.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** alInclude.h 20 Apr 2004 09:23:40 -0000 1.2 --- alInclude.h 20 Apr 2004 22:17:39 -0000 1.3 *************** *** 28,34 **** #define _ALINCLUDE_H_ #include <alc.h> #include <alut.h> ! #endif --- 28,38 ---- #define _ALINCLUDE_H_ + #ifdef TNL_OS_MAC_OSX + #include <OpenAL/alc.h> + #include <OpenAL/alut.h> + #else #include <alc.h> #include <alut.h> ! #endif #endif |
From: Ben G. <s_a...@us...> - 2004-04-20 21:54:23
|
Update of /cvsroot/opentnl/tnl/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2244/docs Modified Files: footer.html header.html Log Message: Updated docs. Fixed projectile issues. Index: footer.html =================================================================== RCS file: /cvsroot/opentnl/tnl/docs/footer.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** footer.html 20 Apr 2004 08:51:28 -0000 1.3 --- footer.html 20 Apr 2004 21:53:26 -0000 1.4 *************** *** 1,12 **** ! </div> ! </div> ! <div class="footer"> ! Documentation hosted by <a href="http://sourceforge.net/">SourceForge.net</a><br> ! <small><b>All Rights Reserved GarageGames.com, Inc. 1999-2004</b></small><br> ! <small>Documentation auto-magically Generated with <a href='http://www.doxygen.org' target='_blank'>Doxygen $doxygenversion</a></small> ! </div> ! ! </TD> ! </TR> </TABLE> </BODY> --- 1,9 ---- ! <div class="footer"> ! Documentation hosted by <a href="http://sourceforge.net/">SourceForge.net</a><br> ! <small><b>All Rights Reserved <A href="http://www.garagegames.com/">GarageGames.com, Inc.</a> 1999-2004</b></small><br> ! <small>Documentation auto-magically Generated with <a href='http://www.doxygen.org' target='_blank'>Doxygen $doxygenversion</a></small> ! </div> ! </TD> ! </TR> </TABLE> </BODY> Index: header.html =================================================================== RCS file: /cvsroot/opentnl/tnl/docs/header.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** header.html 20 Apr 2004 08:51:29 -0000 1.3 --- header.html 20 Apr 2004 21:53:28 -0000 1.4 *************** *** 8,12 **** <TABLE WIDTH=100% height="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0> <TR height="47"> ! <TD width="169" height="46"><IMG SRC="images/layout_tnllogo.gif" WIDTH=169 HEIGHT=47 ALT=""></TD> <TD width="100%" height="46" BGCOLOR=#322900 valign=top><IMG SRC="images/layout_topbar.gif" HEIGHT=47 ALT=""></TD> </TR> --- 8,12 ---- <TABLE WIDTH=100% height="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0> <TR height="47"> ! <TD width="169" height="46"><a href="http://www.opentnl.org/"><IMG SRC="images/layout_tnllogo.gif" WIDTH=169 HEIGHT=47 ALT="" border=0></a></TD> <TD width="100%" height="46" BGCOLOR=#322900 valign=top><IMG SRC="images/layout_topbar.gif" HEIGHT=47 ALT=""></TD> </TR> *************** *** 30,33 **** --- 30,38 ---- <img src="http://sourceforge.net/sflogo.php?group_id=opentnl&type=2" width="125" height="37" border="0" alt="SourceForge.net Logo" /> </a> + <br> + <br> + <a href="http://www.garagegames.com/"> + <img src="images/gglogo.png" height=100 width=100 border=0 ALT="Changing the way games are made and played."> + </a> </p> |
From: Ben G. <s_a...@us...> - 2004-04-20 21:54:00
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2244/zap Modified Files: projectile.cpp projectile.h Log Message: Updated docs. Fixed projectile issues. Index: projectile.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/projectile.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** projectile.cpp 20 Apr 2004 19:25:48 -0000 1.3 --- projectile.cpp 20 Apr 2004 21:53:35 -0000 1.4 *************** *** 45,48 **** --- 45,49 ---- liveTime = t; collided = false; + alive = true; mShooter = shooter; } *************** *** 105,108 **** --- 106,110 ---- hitObject->damageObject(&theInfo); } + liveTime = 0; *************** *** 162,166 **** { process(deltaT); ! if(liveTime) { if(liveTime <= deltaT) --- 164,168 ---- { process(deltaT); ! if(alive) { if(liveTime <= deltaT) *************** *** 168,171 **** --- 170,174 ---- getGame()->deleteObject(this, 500); liveTime = 0; + alive = false; } else *************** *** 178,181 **** --- 181,195 ---- process(deltaT); liveTime += deltaT; + /* if(alive) + { + if(liveTime <= deltaT) + { + getGame()->deleteObject(this, 500); + liveTime = 0; + alive = false; + } + else + liveTime -= deltaT; + } */ } Index: projectile.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/projectile.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** projectile.h 20 Apr 2004 04:27:20 -0000 1.1 --- projectile.h 20 Apr 2004 21:53:37 -0000 1.2 *************** *** 42,45 **** --- 42,46 ---- U32 liveTime; bool collided; + bool alive; SafePtr<Ship> mShooter; |
From: Mark F. <mar...@us...> - 2004-04-20 19:45:14
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7130/zap Modified Files: item.cpp sfx.cpp zap.dsp Log Message: Updated VC6 project file Index: item.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/item.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** item.cpp 20 Apr 2004 19:25:48 -0000 1.3 --- item.cpp 20 Apr 2004 19:45:04 -0000 1.4 *************** *** 79,83 **** for(S32 i = 0; i < mMount->mMountedItems.size(); i++) { ! if(mMount->mMountedItems[i] == this) { mMount->mMountedItems.erase(i); --- 79,83 ---- for(S32 i = 0; i < mMount->mMountedItems.size(); i++) { ! if(mMount->mMountedItems[i].getPointer() == this) { mMount->mMountedItems.erase(i); Index: zap.dsp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/zap.dsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** zap.dsp 20 Apr 2004 04:27:20 -0000 1.1 --- zap.dsp 20 Apr 2004 19:45:06 -0000 1.2 *************** *** 43,47 **** # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD CPP /nologo /W3 /GR /GX /O2 /I "../glut" /I "../tnl" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" --- 43,47 ---- # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD CPP /nologo /W3 /GR /GX /O2 /I "../tnl" /I "../glut" /I "../openal" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" *************** *** 50,55 **** # ADD BSC32 /nologo LINK32=link.exe ! # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 ! # ADD LINK32 wsock32.lib opengl32.lib glu32.lib ../glut/glut32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../exe/zap.exe" !ELSEIF "$(CFG)" == "zap - Win32 Debug" --- 50,55 ---- # ADD BSC32 /nologo LINK32=link.exe ! # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 ! # ADD LINK32 ../openal/alut.lib ../openal/openal32.lib wsock32.lib opengl32.lib glu32.lib ../glut/glut32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../exe/zap.exe" !ELSEIF "$(CFG)" == "zap - Win32 Debug" *************** *** 66,71 **** # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" ! # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c ! # ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "../tnl" /I "../glut" /D "TNL_DEBUG" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" --- 66,71 ---- # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" ! # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c ! # ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "../tnl" /I "../glut" /I "../openal" /D "TNL_DEBUG" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" *************** *** 74,79 **** # ADD BSC32 /nologo LINK32=link.exe ! # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 wsock32.lib opengl32.lib glu32.lib ../glut/glut32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../exe/zapd.exe" /pdbtype:sept !ENDIF --- 74,79 ---- # ADD BSC32 /nologo LINK32=link.exe ! # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ../openal/alut.lib ../openal/openal32.lib wsock32.lib opengl32.lib glu32.lib ../glut/glut32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../exe/zapd.exe" /pdbtype:sept !ENDIF *************** *** 97,100 **** --- 97,108 ---- # Begin Source File + SOURCE=.\CTFGame.cpp + # End Source File + # Begin Source File + + SOURCE=.\CTFGame.h + # End Source File + # Begin Source File + SOURCE=.\game.cpp # End Source File *************** *** 137,140 **** --- 145,156 ---- # Begin Source File + SOURCE=.\gameType.cpp + # End Source File + # Begin Source File + + SOURCE=.\gameType.h + # End Source File + # Begin Source File + SOURCE=.\gridDB.cpp # End Source File *************** *** 145,148 **** --- 161,172 ---- # Begin Source File + SOURCE=.\item.cpp + # End Source File + # Begin Source File + + SOURCE=.\item.h + # End Source File + # Begin Source File + SOURCE=.\main.cpp # End Source File *************** *** 161,164 **** --- 185,196 ---- # Begin Source File + SOURCE=.\moveObject.cpp + # End Source File + # Begin Source File + + SOURCE=.\moveObject.h + # End Source File + # Begin Source File + SOURCE=.\point.h # End Source File *************** *** 173,176 **** --- 205,216 ---- # Begin Source File + SOURCE=.\sfx.cpp + # End Source File + # Begin Source File + + SOURCE=.\sfx.h + # End Source File + # Begin Source File + SOURCE=.\ship.cpp # End Source File Index: sfx.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sfx.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sfx.cpp 20 Apr 2004 19:25:49 -0000 1.5 --- sfx.cpp 20 Apr 2004 19:45:05 -0000 1.6 *************** *** 178,182 **** S32 i; for(i = 0; i < gPlayList.size(); i++) ! if(gPlayList[i] == this) return; gPlayList.push_back(this); --- 178,182 ---- S32 i; for(i = 0; i < gPlayList.size(); i++) ! if(this == gPlayList[i].getPointer()) return; gPlayList.push_back(this); *************** *** 194,198 **** for(S32 i = 0; i < gPlayList.size(); i++) { ! if(gPlayList[i] == this) { gPlayList.erase(i); --- 194,198 ---- for(S32 i = 0; i < gPlayList.size(); i++) { ! if(gPlayList[i].getPointer() == this) { gPlayList.erase(i); |
From: Mark F. <mar...@us...> - 2004-04-20 19:45:14
|
Update of /cvsroot/opentnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7130 Modified Files: tnl.sln Log Message: Updated VC6 project file Index: tnl.sln =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl.sln,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tnl.sln 20 Apr 2004 04:27:12 -0000 1.1 --- tnl.sln 20 Apr 2004 19:45:03 -0000 1.2 *************** *** 61,64 **** --- 61,65 ---- {5FAF4911-1DA7-44FE-9DA1-49AE25B11250}.Release Xbox.Build.0 = Release|Win32 {2BF337F1-B812-4324-A9BA-E4D580C8CFF1}.Debug.ActiveCfg = Debug|Win32 + {2BF337F1-B812-4324-A9BA-E4D580C8CFF1}.Debug.Build.0 = Debug|Win32 {2BF337F1-B812-4324-A9BA-E4D580C8CFF1}.Debug Win32.ActiveCfg = Debug|Win32 {2BF337F1-B812-4324-A9BA-E4D580C8CFF1}.Debug Xbox.ActiveCfg = Debug|Win32 *************** *** 71,74 **** --- 72,76 ---- {2BF337F1-B812-4324-A9BA-E4D580C8CFF1}.Release Xbox.Build.0 = Release|Win32 {2BC8A06B-B9E6-4C92-9E10-6B5E37CBFF96}.Debug.ActiveCfg = Debug|Win32 + {2BC8A06B-B9E6-4C92-9E10-6B5E37CBFF96}.Debug.Build.0 = Debug|Win32 {2BC8A06B-B9E6-4C92-9E10-6B5E37CBFF96}.Debug Win32.ActiveCfg = Debug|Win32 {2BC8A06B-B9E6-4C92-9E10-6B5E37CBFF96}.Debug Xbox.ActiveCfg = Debug|Win32 *************** *** 81,84 **** --- 83,87 ---- {2BC8A06B-B9E6-4C92-9E10-6B5E37CBFF96}.Release Xbox.Build.0 = Release|Win32 {3F7F7B79-4473-4CAB-A54E-4274A9F1A01A}.Debug.ActiveCfg = Debug|Win32 + {3F7F7B79-4473-4CAB-A54E-4274A9F1A01A}.Debug.Build.0 = Debug|Win32 {3F7F7B79-4473-4CAB-A54E-4274A9F1A01A}.Debug Win32.ActiveCfg = Debug|Win32 {3F7F7B79-4473-4CAB-A54E-4274A9F1A01A}.Debug Win32.Build.0 = Debug|Win32 *************** *** 92,95 **** --- 95,99 ---- {3F7F7B79-4473-4CAB-A54E-4274A9F1A01A}.Release Xbox.Build.0 = Release|Win32 {CE4F0113-8119-491D-BCBE-20F5C3A555FC}.Debug.ActiveCfg = Debug|Win32 + {CE4F0113-8119-491D-BCBE-20F5C3A555FC}.Debug.Build.0 = Debug|Win32 {CE4F0113-8119-491D-BCBE-20F5C3A555FC}.Debug Win32.ActiveCfg = Debug|Win32 {CE4F0113-8119-491D-BCBE-20F5C3A555FC}.Debug Xbox.ActiveCfg = Debug|Win32 *************** *** 102,105 **** --- 106,110 ---- {CE4F0113-8119-491D-BCBE-20F5C3A555FC}.Release Xbox.Build.0 = Release|Win32 {F931A5FA-FF37-4977-8493-786AFD5D71EC}.Debug.ActiveCfg = Debug|Win32 + {F931A5FA-FF37-4977-8493-786AFD5D71EC}.Debug.Build.0 = Debug|Win32 {F931A5FA-FF37-4977-8493-786AFD5D71EC}.Debug Win32.ActiveCfg = Debug|Win32 {F931A5FA-FF37-4977-8493-786AFD5D71EC}.Debug Xbox.ActiveCfg = Debug|Win32 |
From: Ben G. <s_a...@us...> - 2004-04-20 19:26:02
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3186/zap Modified Files: CTFGame.cpp game.cpp game.h gameConnection.cpp gameType.cpp item.cpp moveObject.cpp projectile.cpp sfx.cpp sfx.h ship.cpp teleporter.cpp Log Message: Assorted fixes and cleanups. Team chat works now. Fixed messed up linebreaks. Redid sound engine. Index: moveObject.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/moveObject.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** moveObject.cpp 20 Apr 2004 18:55:58 -0000 1.3 --- moveObject.cpp 20 Apr 2004 19:25:48 -0000 1.4 *************** *** 299,304 **** { // Make a noise... ! //SFXHandle h = new SFXObject(SFXBounceWall, collisionPoint, Point()); ! //h->play(); Color bumpC(scale/3, scale/3, scale); --- 299,303 ---- { // Make a noise... ! SFXObject::play(SFXBounceWall, collisionPoint, Point()); Color bumpC(scale/3, scale/3, scale); *************** *** 340,346 **** shipHit->mMoveState[stateIndex].vel += collisionVector * (v2f - v2i); ! //SFXHandle h = new SFXObject(SFXBounceObject, shipHit->mMoveState[stateIndex].pos, Point()); ! //h->play(); ! } --- 339,343 ---- shipHit->mMoveState[stateIndex].vel += collisionVector * (v2f - v2i); ! SFXObject::play(SFXBounceObject, shipHit->mMoveState[stateIndex].pos, Point()); } Index: gameType.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameType.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gameType.cpp 20 Apr 2004 18:40:19 -0000 1.2 --- gameType.cpp 20 Apr 2004 19:25:48 -0000 1.3 *************** *** 1,278 **** ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 "gameType.h" ! #include "ship.h" ! #include "UIGame.h" ! #include "gameNetInterface.h" ! ! namespace Zap ! { ! ! TNL_IMPLEMENT_NETOBJECT(GameType); ! ! GameType::GameType() ! { ! mNetFlags.set(Ghostable); ! } ! ! void GameType::processArguments(S32 argc, const char **argv) ! { ! ! } ! ! void GameType::onAddedToGame(Game *theGame) ! { ! theGame->setGameType(this); ! setInterface(theGame->getNetInterface()); ! if(!isGhost()) ! setScopeAlways(); ! } ! ! bool GameType::processLevelItem(S32 argc, const char **argv) ! { ! if(!stricmp(argv[0], "Team")) ! { ! if(argc < 5) ! return false; ! Team t; ! t.numPlayers = 0; ! ! t.name.set(argv[1]); ! t.color.read(argv + 2); ! mTeams.push_back(t); ! } ! else if(!stricmp(argv[0], "Spawn")) ! { ! if(argc < 4) ! return false; ! S32 teamIndex = atoi(argv[1]); ! Point p; ! p.read(argv + 2); ! p *= getGame()->getGridSize(); ! if(teamIndex >= 0 && teamIndex < mTeams.size()) ! mTeams[teamIndex].spawnPoints.push_back(p); ! } ! else ! return false; ! return true; ! } ! ! S32 GameType::findClientIndexByConnection(GameConnection *theConnection) ! { ! for(S32 clientIndex = 0; clientIndex < mClientList.size(); clientIndex++) ! if(mClientList[clientIndex].clientConnection == theConnection) ! return clientIndex; ! return -1; ! } ! ! S32 GameType::findClientIndexById(U32 clientId) ! { ! for(S32 clientIndex = 0; clientIndex < mClientList.size(); clientIndex++) ! if(mClientList[clientIndex].clientId == clientId) ! return clientIndex; ! return -1; ! } ! ! void GameType::spawnShip(GameConnection *theClient) ! { ! S32 clientIndex = findClientIndexByConnection(theClient); ! S32 teamIndex = mClientList[clientIndex].teamId; ! ! Point spawnPoint; ! S32 spawnIndex = Random::readI() % mTeams[teamIndex].spawnPoints.size(); ! spawnPoint = mTeams[teamIndex].spawnPoints[spawnIndex]; ! ! Ship *newShip = new Ship(spawnPoint, mTeams[teamIndex].color); ! newShip->addToGame(getGame()); ! theClient->setControlObject(newShip); ! } ! ! void GameType::serverAddClient(GameConnection *theClient) ! { ! ClientRef cref; ! cref.clientId = theClient->mClientId; ! cref.name = theClient->playerName; ! ! cref.clientConnection = theClient; ! U32 minPlayers = mTeams[0].numPlayers; ! S32 minTeamIndex = 0; ! for(S32 i = 1; i < mTeams.size(); i++) ! { ! if(mTeams[i].numPlayers < minPlayers) ! { ! minTeamIndex = i; ! minPlayers = mTeams[i].numPlayers; ! } ! } ! cref.teamId = minTeamIndex; ! mClientList.push_back(cref); ! ! mTeams[cref.teamId].numPlayers++; ! ! s2cAddClient(cref.clientId, cref.name, false); ! s2cClientJoinedTeam(cref.clientId, cref.teamId); ! spawnShip(theClient); ! } ! ! void GameType::controlObjectForClientKilled(GameConnection *theClient) ! { ! spawnShip(theClient); ! } ! ! void GameType::addClientGameMenuOptions(Vector<const char *> &menuOptions) ! { ! if(mTeams.size() > 1) ! menuOptions.push_back("CHANGE TEAMS"); ! } ! ! void GameType::processClientGameMenuOption(U32 index) ! { ! if(index == 0) ! c2sChangeTeams(); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddClient, (U32 id, StringTableEntry name, bool isMyClient), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! ClientRef cref; ! cref.clientId = id; ! cref.name = name; ! cref.teamId = 0; ! mClientList.push_back(cref); ! ! if(isMyClient) ! mThisClientId = id; ! gGameUserInterface.displayMessage(Color(0.6f, 0.6f, 0.8f), "%s joined the game.", name.getString()); ! } ! ! void GameType::serverRemoveClient(GameConnection *theClient) ! { ! S32 clientIndex = findClientIndexByConnection(theClient); ! mTeams[mClientList[clientIndex].teamId].numPlayers--; ! mClientList.erase(clientIndex); ! ! GameObject *theControlObject = theClient->getControlObject(); ! if(theControlObject) ! delete theControlObject; ! ! s2cRemoveClient(theClient->mClientId); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cRemoveClient, (U32 id), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! S32 clientIndex = findClientIndexById(id); ! mClientList.erase(clientIndex); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddTeam, (StringTableEntry teamName, F32 r, F32 g, F32 b), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! Team team; ! team.name = teamName; ! team.color.r = r; ! team.color.g = g; ! team.color.b = b; ! mTeams.push_back(team); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cSetTeamScore, (U32 teamIndex, U32 score), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! mTeams[teamIndex].score = score; ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cClientJoinedTeam, (U32 clientId, U32 teamIndex), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! S32 clientIndex = findClientIndexById(clientId); ! mClientList[clientIndex].teamId = teamIndex; ! gGameUserInterface.displayMessage(Color(0.6f, 0.6f, 0.8f), "%s joined team %s.", mClientList[clientIndex].name.getString(), mTeams[teamIndex].name.getString()); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, c2sChangeTeams, (), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhostParent, 0) ! { ! if(mTeams.size() <= 1) ! return; ! ! GameConnection *source = (GameConnection *) NetObject::getRPCSourceConnection(); ! S32 clientIndex = findClientIndexByConnection(source); ! ! // destroy the old ship ! GameObject *co = source->getControlObject(); ! if(co) ! getGame()->deleteObject(co, 0); ! ! U32 newTeamId = (mClientList[clientIndex].teamId + 1) % mTeams.size(); ! mClientList[clientIndex].teamId = newTeamId; ! s2cClientJoinedTeam(mClientList[clientIndex].clientId, newTeamId); ! spawnShip(source); ! } ! ! void GameType::onGhostAvailable(GhostConnection *theConnection) ! { ! NetObject::setRPCDestConnection(theConnection); ! ! for(S32 i = 0; i < mTeams.size(); i++) ! { ! s2cAddTeam(mTeams[i].name, mTeams[i].color.r, mTeams[i].color.g, mTeams[i].color.b); ! s2cSetTeamScore(i, mTeams[i].score); ! } ! ! // add all the client and team information ! for(S32 i = 0; i < mClientList.size(); i++) ! { ! s2cAddClient(mClientList[i].clientId, mClientList[i].name, mClientList[i].clientConnection == theConnection); ! s2cClientJoinedTeam(mClientList[i].clientId, mClientList[i].teamId); ! } ! NetObject::setRPCDestConnection(NULL); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, c2sSendChat, (bool global, const char *message), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhostParent, 0) ! { ! GameConnection *source = (GameConnection *) getRPCSourceConnection(); ! ! RefPtr<NetEvent> theEvent = TNL_RPC_CONSTRUCT_NETEVENT(this, ! s2cDisplayChatMessage, (global, source->playerName, message)); ! for(S32 i = 0; i < mClientList.size(); i++) ! mClientList[i].clientConnection->postNetEvent(theEvent); ! } ! ! extern Color gGlobalChatColor; ! extern Color gTeamChatColor; ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cDisplayChatMessage, (bool global, StringTableEntry clientName, const char *message), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! Color theColor = global ? gGlobalChatColor : gTeamChatColor; ! ! gGameUserInterface.displayMessage(theColor, "%s: %s", clientName.getString(), message); ! } ! }; \ No newline at end of file --- 1,289 ---- ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 "gameType.h" ! #include "ship.h" ! #include "UIGame.h" ! #include "gameNetInterface.h" ! ! namespace Zap ! { ! ! TNL_IMPLEMENT_NETOBJECT(GameType); ! ! GameType::GameType() ! { ! mNetFlags.set(Ghostable); ! } ! ! void GameType::processArguments(S32 argc, const char **argv) ! { ! ! } ! ! void GameType::onAddedToGame(Game *theGame) ! { ! theGame->setGameType(this); ! setInterface(theGame->getNetInterface()); ! if(!isGhost()) ! setScopeAlways(); ! } ! ! bool GameType::processLevelItem(S32 argc, const char **argv) ! { ! if(!stricmp(argv[0], "Team")) ! { ! if(argc < 5) ! return false; ! Team t; ! t.numPlayers = 0; ! ! t.name.set(argv[1]); ! t.color.read(argv + 2); ! mTeams.push_back(t); ! } ! else if(!stricmp(argv[0], "Spawn")) ! { ! if(argc < 4) ! return false; ! S32 teamIndex = atoi(argv[1]); ! Point p; ! p.read(argv + 2); ! p *= getGame()->getGridSize(); ! if(teamIndex >= 0 && teamIndex < mTeams.size()) ! mTeams[teamIndex].spawnPoints.push_back(p); ! } ! else ! return false; ! return true; ! } ! ! S32 GameType::findClientIndexByConnection(GameConnection *theConnection) ! { ! for(S32 clientIndex = 0; clientIndex < mClientList.size(); clientIndex++) ! if(mClientList[clientIndex].clientConnection == theConnection) ! return clientIndex; ! return -1; ! } ! ! S32 GameType::findClientIndexById(U32 clientId) ! { ! for(S32 clientIndex = 0; clientIndex < mClientList.size(); clientIndex++) ! if(mClientList[clientIndex].clientId == clientId) ! return clientIndex; ! return -1; ! } ! ! void GameType::spawnShip(GameConnection *theClient) ! { ! S32 clientIndex = findClientIndexByConnection(theClient); ! S32 teamIndex = mClientList[clientIndex].teamId; ! ! Point spawnPoint; ! S32 spawnIndex = Random::readI() % mTeams[teamIndex].spawnPoints.size(); ! spawnPoint = mTeams[teamIndex].spawnPoints[spawnIndex]; ! ! Ship *newShip = new Ship(spawnPoint, mTeams[teamIndex].color); ! newShip->addToGame(getGame()); ! theClient->setControlObject(newShip); ! } ! ! void GameType::serverAddClient(GameConnection *theClient) ! { ! ClientRef cref; ! cref.clientId = theClient->mClientId; ! cref.name = theClient->playerName; ! ! cref.clientConnection = theClient; ! U32 minPlayers = mTeams[0].numPlayers; ! S32 minTeamIndex = 0; ! for(S32 i = 1; i < mTeams.size(); i++) ! { ! if(mTeams[i].numPlayers < minPlayers) ! { ! minTeamIndex = i; ! minPlayers = mTeams[i].numPlayers; ! } ! } ! cref.teamId = minTeamIndex; ! mClientList.push_back(cref); ! ! mTeams[cref.teamId].numPlayers++; ! ! s2cAddClient(cref.clientId, cref.name, false); ! s2cClientJoinedTeam(cref.clientId, cref.teamId); ! spawnShip(theClient); ! } ! ! void GameType::controlObjectForClientKilled(GameConnection *theClient) ! { ! spawnShip(theClient); ! } ! ! void GameType::addClientGameMenuOptions(Vector<const char *> &menuOptions) ! { ! if(mTeams.size() > 1) ! menuOptions.push_back("CHANGE TEAMS"); ! } ! ! void GameType::processClientGameMenuOption(U32 index) ! { ! if(index == 0) ! c2sChangeTeams(); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddClient, (U32 id, StringTableEntry name, bool isMyClient), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! ClientRef cref; ! cref.clientId = id; ! cref.name = name; ! cref.teamId = 0; ! mClientList.push_back(cref); ! ! if(isMyClient) ! mThisClientId = id; ! gGameUserInterface.displayMessage(Color(0.6f, 0.6f, 0.8f), "%s joined the game.", name.getString()); ! } ! ! void GameType::serverRemoveClient(GameConnection *theClient) ! { ! S32 clientIndex = findClientIndexByConnection(theClient); ! mTeams[mClientList[clientIndex].teamId].numPlayers--; ! mClientList.erase(clientIndex); ! ! GameObject *theControlObject = theClient->getControlObject(); ! if(theControlObject) ! delete theControlObject; ! ! s2cRemoveClient(theClient->mClientId); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cRemoveClient, (U32 id), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! S32 clientIndex = findClientIndexById(id); ! mClientList.erase(clientIndex); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddTeam, (StringTableEntry teamName, F32 r, F32 g, F32 b), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! Team team; ! team.name = teamName; ! team.color.r = r; ! team.color.g = g; ! team.color.b = b; ! mTeams.push_back(team); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cSetTeamScore, (U32 teamIndex, U32 score), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! mTeams[teamIndex].score = score; ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cClientJoinedTeam, (U32 clientId, U32 teamIndex), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! S32 clientIndex = findClientIndexById(clientId); ! mClientList[clientIndex].teamId = teamIndex; ! gGameUserInterface.displayMessage(Color(0.6f, 0.6f, 0.8f), "%s joined team %s.", mClientList[clientIndex].name.getString(), mTeams[teamIndex].name.getString()); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, c2sChangeTeams, (), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhostParent, 0) ! { ! if(mTeams.size() <= 1) ! return; ! ! GameConnection *source = (GameConnection *) NetObject::getRPCSourceConnection(); ! S32 clientIndex = findClientIndexByConnection(source); ! ! // destroy the old ship ! GameObject *co = source->getControlObject(); ! if(co) ! getGame()->deleteObject(co, 0); ! ! U32 newTeamId = (mClientList[clientIndex].teamId + 1) % mTeams.size(); ! mClientList[clientIndex].teamId = newTeamId; ! s2cClientJoinedTeam(mClientList[clientIndex].clientId, newTeamId); ! spawnShip(source); ! } ! ! void GameType::onGhostAvailable(GhostConnection *theConnection) ! { ! NetObject::setRPCDestConnection(theConnection); ! ! for(S32 i = 0; i < mTeams.size(); i++) ! { ! s2cAddTeam(mTeams[i].name, mTeams[i].color.r, mTeams[i].color.g, mTeams[i].color.b); ! s2cSetTeamScore(i, mTeams[i].score); ! } ! ! // add all the client and team information ! for(S32 i = 0; i < mClientList.size(); i++) ! { ! s2cAddClient(mClientList[i].clientId, mClientList[i].name, mClientList[i].clientConnection == theConnection); ! s2cClientJoinedTeam(mClientList[i].clientId, mClientList[i].teamId); ! } ! NetObject::setRPCDestConnection(NULL); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, c2sSendChat, (bool global, const char *message), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhostParent, 0) ! { ! GameConnection *source = (GameConnection *) getRPCSourceConnection(); ! ! RefPtr<NetEvent> theEvent = TNL_RPC_CONSTRUCT_NETEVENT(this, ! s2cDisplayChatMessage, (global, source->playerName, message)); ! ! S32 teamId = 0; ! ! if(!global) ! for(S32 i = 0; i < mClientList.size(); i++) ! if(mClientList[i].clientId == source->mClientId) ! teamId = mClientList[i].teamId; ! ! for(S32 i = 0; i < mClientList.size(); i++) ! { ! if(global || mClientList[i].teamId == teamId) ! mClientList[i].clientConnection->postNetEvent(theEvent); ! } ! } ! ! extern Color gGlobalChatColor; ! extern Color gTeamChatColor; ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cDisplayChatMessage, (bool global, StringTableEntry clientName, const char *message), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! Color theColor = global ? gGlobalChatColor : gTeamChatColor; ! ! gGameUserInterface.displayMessage(theColor, "%s: %s", clientName.getString(), message); ! } ! }; \ No newline at end of file Index: projectile.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/projectile.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** projectile.cpp 20 Apr 2004 18:40:19 -0000 1.2 --- projectile.cpp 20 Apr 2004 19:25:48 -0000 1.3 *************** *** 1,223 **** ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 "projectile.h" ! #include "ship.h" ! #include "sparkManager.h" ! #include "sfx.h" ! ! #include "glutInclude.h" ! ! namespace Zap ! { ! ! TNL_IMPLEMENT_NETOBJECT(Projectile); ! ! ! Projectile::Projectile(Point p, Point v, U32 t, Ship *shooter) ! { ! mNetFlags.set(Ghostable); ! pos = p; ! velocity = v; ! liveTime = t; ! collided = false; ! mShooter = shooter; ! } ! ! U32 Projectile::packUpdate(GhostConnection *connection, U32 updateMask, BitStream *stream) ! { ! stream->write(pos.x); ! stream->write(pos.y); ! stream->write(velocity.x); ! stream->write(velocity.y); ! S32 index = -1; ! if(mShooter.isValid()) ! index = connection->getGhostIndex(mShooter); ! if(stream->writeFlag(index != -1)) ! stream->writeInt(index, GhostConnection::GhostIdBitSize); ! ! return 0; ! } ! ! void Projectile::unpackUpdate(GhostConnection *connection, BitStream *stream) ! { ! stream->read(&pos.x); ! stream->read(&pos.y); ! stream->read(&velocity.x); ! stream->read(&velocity.y); ! ! if(stream->readFlag()) ! mShooter = (Ship *) connection->resolveGhost(stream->readInt(GhostConnection::GhostIdBitSize)); ! ! Rect newExtent(pos,pos); ! setExtent(newExtent); ! process(connection->getOneWayTime()); ! ! SFXObject::play(0, pos, velocity); ! } ! ! enum { ! NumSparkColors = 4, ! }; ! ! Color SparkColors[NumSparkColors] = { ! Color(1, 0, 1), ! Color(1, 1, 1), ! Color(0, 0, 1), ! Color(1, 0, 0), ! }; ! void Projectile::handleCollision(GameObject *hitObject, Point collisionPoint) ! { ! collided = true; ! ! if(!isGhost()) ! { ! DamageInfo theInfo; ! theInfo.collisionPoint = collisionPoint; ! theInfo.damageAmount = 1; ! theInfo.damageType = 0; ! theInfo.damagingObject = this; ! theInfo.impulseVector = velocity; ! ! hitObject->damageObject(&theInfo); ! } ! liveTime = 0; ! ! // Do some particle spew... ! if(isGhost()) ! { ! SparkManager::emitExplosion(collisionPoint, 0.4, SparkColors, NumSparkColors); ! SFXObject::play(SFXPhaserImpact, pos, velocity); ! } ! } ! ! void Projectile::process(U32 deltaT) ! { ! if(collided) ! return; ! ! Point endPos = pos + velocity * deltaT * 0.001; ! static Vector<GameObject *> disableVector; ! ! Rect queryRect(pos, endPos); ! ! float collisionTime; ! disableVector.clear(); ! ! if(mShooter.isValid()) ! { ! disableVector.push_back(mShooter); ! mShooter->disableCollision(); ! } ! ! GameObject *hitObject; ! for(;;) ! { ! hitObject = findObjectLOS(MoveableType | BarrierType, MoveObject::RenderState, pos, endPos, collisionTime); ! if(!hitObject || hitObject->collide(this)) ! break; ! disableVector.push_back(hitObject); ! hitObject->disableCollision(); ! } ! ! for(S32 i = 0; i < disableVector.size(); i++) ! disableVector[i]->enableCollision(); ! ! if(hitObject) ! { ! Point collisionPoint = pos + (endPos - pos) * collisionTime; ! handleCollision(hitObject, collisionPoint); ! } ! else ! pos = endPos; ! ! Rect newExtent(pos,pos); ! setExtent(newExtent); ! } ! ! void Projectile::processServer(U32 deltaT) ! { ! process(deltaT); ! if(liveTime) ! { ! if(liveTime <= deltaT) ! { ! getGame()->deleteObject(this, 500); ! liveTime = 0; ! } ! else ! liveTime -= deltaT; ! } ! } ! ! void Projectile::processClient(U32 deltaT) ! { ! process(deltaT); ! liveTime += deltaT; ! } ! ! void Projectile::render() ! { ! if(collided) ! return; ! ! glColor3f(1,0,0.5); ! glPushMatrix(); ! glTranslatef(pos.x, pos.y, 0); ! ! glPushMatrix(); ! glRotatef((liveTime % 720) * 0.5, 0, 0, 1); ! ! glBegin(GL_LINE_LOOP); ! glVertex2f(-2, 2); ! glVertex2f(0, 6); ! glVertex2f(2, 2); ! glVertex2f(6, 0); ! glVertex2f(2, -2); ! glVertex2f(0, -6); ! glVertex2f(-2, -2); ! glVertex2f(-6, 0); ! glEnd(); ! ! glPopMatrix(); ! ! glRotatef(180 - (liveTime % 360), 0, 0, 1); ! glColor3f(0.5,0,1); ! glBegin(GL_LINE_LOOP); ! glVertex2f(-2, 2); ! glVertex2f(0, 8); ! glVertex2f(2, 2); ! glVertex2f(8, 0); ! glVertex2f(2, -2); ! glVertex2f(0, -8); ! glVertex2f(-2, -2); ! glVertex2f(-8, 0); ! glEnd(); ! ! glPopMatrix(); ! } ! }; \ No newline at end of file --- 1,223 ---- ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 "projectile.h" ! #include "ship.h" ! #include "sparkManager.h" ! #include "sfx.h" ! ! #include "glutInclude.h" ! ! namespace Zap ! { ! ! TNL_IMPLEMENT_NETOBJECT(Projectile); ! ! ! Projectile::Projectile(Point p, Point v, U32 t, Ship *shooter) ! { ! mNetFlags.set(Ghostable); ! pos = p; ! velocity = v; ! liveTime = t; ! collided = false; ! mShooter = shooter; ! } ! ! U32 Projectile::packUpdate(GhostConnection *connection, U32 updateMask, BitStream *stream) ! { ! stream->write(pos.x); ! stream->write(pos.y); ! stream->write(velocity.x); ! stream->write(velocity.y); ! S32 index = -1; ! if(mShooter.isValid()) ! index = connection->getGhostIndex(mShooter); ! if(stream->writeFlag(index != -1)) ! stream->writeInt(index, GhostConnection::GhostIdBitSize); ! ! return 0; ! } ! ! void Projectile::unpackUpdate(GhostConnection *connection, BitStream *stream) ! { ! stream->read(&pos.x); ! stream->read(&pos.y); ! stream->read(&velocity.x); ! stream->read(&velocity.y); ! ! if(stream->readFlag()) ! mShooter = (Ship *) connection->resolveGhost(stream->readInt(GhostConnection::GhostIdBitSize)); ! ! Rect newExtent(pos,pos); ! setExtent(newExtent); ! process(connection->getOneWayTime()); ! ! SFXObject::play(0, pos, velocity); ! } ! ! enum { ! NumSparkColors = 4, ! }; ! ! Color SparkColors[NumSparkColors] = { ! Color(1, 0, 1), ! Color(1, 1, 1), ! Color(0, 0, 1), ! Color(1, 0, 0), ! }; ! void Projectile::handleCollision(GameObject *hitObject, Point collisionPoint) ! { ! collided = true; ! ! if(!isGhost()) ! { ! DamageInfo theInfo; ! theInfo.collisionPoint = collisionPoint; ! theInfo.damageAmount = 1; ! theInfo.damageType = 0; ! theInfo.damagingObject = this; ! theInfo.impulseVector = velocity; ! ! hitObject->damageObject(&theInfo); ! } ! liveTime = 0; ! ! // Do some particle spew... ! if(isGhost()) ! { ! SparkManager::emitExplosion(collisionPoint, 0.4, SparkColors, NumSparkColors); ! SFXObject::play(SFXPhaserImpact, pos, velocity); ! } ! } ! ! void Projectile::process(U32 deltaT) ! { ! if(collided) ! return; ! ! Point endPos = pos + velocity * deltaT * 0.001; ! static Vector<GameObject *> disableVector; ! ! Rect queryRect(pos, endPos); ! ! float collisionTime; ! disableVector.clear(); ! ! if(mShooter.isValid()) ! { ! disableVector.push_back(mShooter); ! mShooter->disableCollision(); ! } ! ! GameObject *hitObject; ! for(;;) ! { ! hitObject = findObjectLOS(MoveableType | BarrierType, MoveObject::RenderState, pos, endPos, collisionTime); ! if(!hitObject || hitObject->collide(this)) ! break; ! disableVector.push_back(hitObject); ! hitObject->disableCollision(); ! } ! ! for(S32 i = 0; i < disableVector.size(); i++) ! disableVector[i]->enableCollision(); ! ! if(hitObject) ! { ! Point collisionPoint = pos + (endPos - pos) * collisionTime; ! handleCollision(hitObject, collisionPoint); ! } ! else ! pos = endPos; ! ! Rect newExtent(pos,pos); ! setExtent(newExtent); ! } ! ! void Projectile::processServer(U32 deltaT) ! { ! process(deltaT); ! if(liveTime) ! { ! if(liveTime <= deltaT) ! { ! getGame()->deleteObject(this, 500); ! liveTime = 0; ! } ! else ! liveTime -= deltaT; ! } ! } ! ! void Projectile::processClient(U32 deltaT) ! { ! process(deltaT); ! liveTime += deltaT; ! } ! ! void Projectile::render() ! { ! if(collided) ! return; ! ! glColor3f(1,0,0.5); ! glPushMatrix(); ! glTranslatef(pos.x, pos.y, 0); ! ! glPushMatrix(); ! glRotatef((liveTime % 720) * 0.5, 0, 0, 1); ! ! glBegin(GL_LINE_LOOP); ! glVertex2f(-2, 2); ! glVertex2f(0, 6); ! glVertex2f(2, 2); ! glVertex2f(6, 0); ! glVertex2f(2, -2); ! glVertex2f(0, -6); ! glVertex2f(-2, -2); ! glVertex2f(-6, 0); ! glEnd(); ! ! glPopMatrix(); ! ! glRotatef(180 - (liveTime % 360), 0, 0, 1); ! glColor3f(0.5,0,1); ! glBegin(GL_LINE_LOOP); ! glVertex2f(-2, 2); ! glVertex2f(0, 8); ! glVertex2f(2, 2); ! glVertex2f(8, 0); ! glVertex2f(2, -2); ! glVertex2f(0, -8); ! glVertex2f(-2, -2); ! glVertex2f(-8, 0); ! glEnd(); ! ! glPopMatrix(); ! } ! }; \ No newline at end of file Index: sfx.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sfx.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sfx.cpp 20 Apr 2004 18:40:19 -0000 1.4 --- sfx.cpp 20 Apr 2004 19:25:49 -0000 1.5 *************** *** 1,454 **** ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 "sfx.h" ! #include "tnl.h" ! #include "tnlLog.h" ! ! #if defined (TNL_OS_WIN32) ! ! #include "alInclude.h" ! ! using namespace TNL; ! ! namespace Zap ! { ! ! static SFXProfile gSFXProfiles[] = { ! { "phaser.wav", false, 0.45f, false, 150, 600 }, ! { "phaser_impact.wav", false, 0.7f, false, 150, 600 }, ! { "ship_explode.wav", false, 1.0, false, 300, 1000 }, ! { "flag_capture.wav", true, 0.45f, false, 0, 0 }, ! { "flag_drop.wav", true, 0.45f, false, 0, 0 }, ! { "flag_return.wav", true, 0.45f, false, 0, 0 }, ! { "flag_snatch.wav", true, 0.45f, false, 0, 0 }, ! { "teleport_in.wav", false, 1.0, false, 200, 500 }, ! { "teleport_out.wav", false, 1.0, false, 200, 500 }, ! { NULL, false, 0, false, 0, 0 }, ! }; ! ! static ALCdevice *gDevice = NULL; ! static ALCcontext *gContext = NULL; ! static bool gSFXValid = false; ! ! enum { ! NumSources = 16, ! }; ! ! static ALuint gSources[NumSources]; ! static bool gSourceActive[NumSources]; ! Point SFXObject::mListenerPosition; ! Point SFXObject::mListenerVelocity; ! F32 SFXObject::mMaxDistance = 500; ! ! static ALuint gBuffers[NumSFXBuffers]; ! static Vector<SFXHandle> gPlayList; ! ! SFXObject::SFXObject(U32 profileIndex, F32 gain, Point position, Point velocity) ! { ! mSFXIndex = profileIndex; ! mProfile = gSFXProfiles + profileIndex; ! mGain = gain; ! mPosition = position; ! mVelocity = velocity; ! mSourceIndex = -1; ! mPriority = 0; ! } ! ! RefPtr<SFXObject> SFXObject::play(U32 profileIndex, F32 gain) ! { ! RefPtr<SFXObject> ret = new SFXObject(profileIndex, gain, Point(), Point()); ! ret->play(); ! return ret; ! } ! ! RefPtr<SFXObject> SFXObject::play(U32 profileIndex, Point position, Point velocity, F32 gain) ! { ! RefPtr<SFXObject> ret = new SFXObject(profileIndex, gain, position, velocity); ! ret->play(); ! return ret; ! } ! ! SFXObject::~SFXObject() ! { ! ! } ! ! void SFXObject::updateGain() ! { ! ALuint source = gSources[mSourceIndex]; ! F32 gain = mGain; ! ! if(!mProfile->isRelative) ! { ! F32 distance = (mListenerPosition - mPosition).len(); ! if(distance > mProfile->fullGainDistance) ! { ! if(distance < mProfile->zeroGainDistance) ! gain *= (mProfile->fullGainDistance - distance) / ! (mProfile->zeroGainDistance - mProfile->fullGainDistance); ! else ! gain = 0.0f; ! } ! else ! gain = 1.0f; ! } ! else ! gain = 1.0f; ! ! alSourcef(source, AL_GAIN, gain * mProfile->gainScale); ! } ! ! void SFXObject::updateMovementParams() ! { ! ALuint source = gSources[mSourceIndex]; ! if(mProfile->isRelative) ! { ! alSourcei(source, AL_SOURCE_RELATIVE, true); ! alSource3f(source, AL_POSITION, 0, 0, 0); ! //alSource3f(source, AL_VELOCITY, 0, 0, 0); ! } ! else ! { ! alSourcei(source, AL_SOURCE_RELATIVE, false); ! alSource3f(source, AL_POSITION, mPosition.x, mPosition.y, 0); ! //alSource3f(source, AL_VELOCITY, mVelocity.x, mVelocity.y, 0); ! } ! } ! ! void SFXObject::playOnSource() ! { ! ALuint source = gSources[mSourceIndex]; ! alSourceStop(source); ! alSourcei(source, AL_BUFFER, gBuffers[mSFXIndex]); ! alSourcei(source, AL_LOOPING, mProfile->isLooping); ! updateMovementParams(); ! ! updateGain(); ! alSourcePlay(source); ! } ! ! void SFXObject::setGain(F32 gain) ! { ! mGain = gain; ! if(mSourceIndex != -1) ! updateGain(); ! } ! ! void SFXObject::setMovementParams(Point position, Point velocity) ! { ! mPosition = position; ! mVelocity = velocity; ! if(mSourceIndex != -1) ! updateMovementParams(); ! } ! ! void SFXObject::play() ! { ! if(mSourceIndex != -1) ! return; ! else ! { ! // see if it's on the play list: ! S32 i; ! for(i = 0; i < gPlayList.size(); i++) ! if(gPlayList[i] == this) ! return; ! gPlayList.push_back(this); ! } ! } ! ! void SFXObject::stop() ! { ! // remove from the play list, if this sound is playing: ! if(mSourceIndex != -1) ! { ! alSourceStop(gSources[mSourceIndex]); ! mSourceIndex = -1; ! } ! for(S32 i = 0; i < gPlayList.size(); i++) ! { ! if(gPlayList[i] == this) ! { ! gPlayList.erase(i); ! return; ! } ! } ! } ! ! void SFXObject::init() ! { ! gDevice = alcOpenDevice((ALubyte *) "DirectSound3D"); ! if(!gDevice) ! { ! logprintf("Failed to intitialize OpenAL."); ! return; ! } ! ! static int contextData[][2] = ! { ! {ALC_FREQUENCY, 11025}, ! {0,0} // Indicate end of list... ! }; ! ! gContext = alcCreateContext(gDevice, (ALCint*)contextData); ! alcMakeContextCurrent(gContext); ! ! alGetError(); ! ! alDistanceModel(AL_NONE); ! ! // load up all the sound buffers ! alGenBuffers(NumSFXBuffers, gBuffers); ! ! if(alGetError() != AL_NO_ERROR) ! return; ! ! alGenSources(NumSources, gSources); ! ! for(U32 i = 0; i < NumSFXBuffers; i++) ! { ! if(!gSFXProfiles[i].fileName) ! break; ! ! ALsizei size,freq; ! ALenum format; ! ALvoid *data; ! ALboolean loop; ! ! alutLoadWAVFile((ALbyte *) gSFXProfiles[i].fileName, &format, &data, &size, &freq, &loop); ! if(alGetError() != AL_NO_ERROR) ! return; ! alBufferData(gBuffers[i], format, data, size, freq); ! alutUnloadWAV(format, data, size, freq); ! if(alGetError() != AL_NO_ERROR) ! return; ! } ! gSFXValid = true; ! } ! ! void SFXObject::process() ! { ! if(!gSFXValid) ! return; ! ! // ok, so we have a list of currently "playing" sounds, which is ! // unbounded in length, but only the top NumSources actually have sources ! // associtated with them. Sounds are prioritized on a 0-1 scale ! // based on type and distance. ! // Each time through the main loop, newly played sounds are placed ! // on the process list. When SFXProcess is called, any finished sounds ! // are retired from the list, and then it prioritizes and sorts all ! // the remaining sounds. For any sounds from 0 to NumSources that don't ! // have a current source, they grab one of the sources not used by the other ! // top sounds. At this point, any sound that is not looping, and is ! // not in the active top list is retired. ! ! // ok, look through all the currently playing sources and see which ! // ones need to be retired: ! ! for(S32 i = 0; i < NumSources; i++) ! { ! ALint state; ! alGetSourcei(gSources[i], AL_SOURCE_STATE, &state); ! gSourceActive[i] = state != AL_STOPPED && state != AL_INITIAL; ! } ! for(S32 i = 0; i < gPlayList.size(); ) ! { ! SFXHandle &s = gPlayList[i]; ! if(s->mSourceIndex != -1 && !gSourceActive[s->mSourceIndex]) ! { ! // this sound was playing; now it is stopped, ! // so remove it from the list. ! s->mSourceIndex = -1; ! gPlayList.erase_fast(i); ! } ! else ! { ! // compute a priority for this sound. ! if(!s->mProfile->isRelative) ! s->mPriority = (500 - (s->mPosition - mListenerPosition).len()) / 500.0f; ! else ! s->mPriority = 1.0; ! i++; ! } ! } ! // now, bubble sort all the sounds up the list: ! // we choose bubble sort, because the list should ! // have a lot of frame-to-frame coherency, making the ! // sort most often O(n) ! for(S32 i = 1; i < gPlayList.size(); i++) ! { ! F32 priority = gPlayList[i]->mPriority; ! for(S32 j = i - 1; j >= 0; j--) ! { ! if(priority > gPlayList[j]->mPriority) ! { ! SFXHandle temp = gPlayList[j]; ! gPlayList[j] = gPlayList[j+1]; ! gPlayList[j+1] = temp; ! } ! } ! } ! // last, release any sources and get rid of non-looping sounds ! // outside our max sound limit ! for(S32 i = NumSources; i < gPlayList.size(); ) ! { ! SFXHandle &s = gPlayList[i]; ! if(s->mSourceIndex != -1) ! { ! gSourceActive[s->mSourceIndex] = false; ! s->mSourceIndex = -1; ! } ! if(!s->mProfile->isLooping) ! gPlayList.erase_fast(i); ! else ! i++; ! } ! // now assign sources to all our sounds that need them: ! S32 firstFree = 0; ! S32 max = NumSources; ! if(max > gPlayList.size()) ! max = gPlayList.size(); ! ! for(S32 i = 0; i < max; i++) ! { ! SFXHandle &s = gPlayList[i]; ! if(s->mSourceIndex == -1) ! { ! while(gSourceActive[firstFree]) ! firstFree++; ! s->mSourceIndex = firstFree; ! gSourceActive[firstFree] = true; ! s->playOnSource(); ! } ! else ! { ! // for other sources, just attenuate the gain. ! s->updateGain(); ! } ! } ! } ! ! void SFXObject::setListenerParams(Point pos, Point velocity) ! { ! if(!gSFXValid) ! return; ! ! mListenerPosition = pos; ! mListenerVelocity = velocity; ! alListener3f(AL_POSITION, pos.x, pos.y, -mMaxDistance/2); ! } ! ! void SFXObject::shutdown() ! { ! if(!gSFXValid) ! return; ! ! alDeleteBuffers(NumSFXBuffers, gBuffers); ! alcMakeContextCurrent(NULL); ! alcDestroyContext(gContext); ! alcCloseDevice(gDevice); ! } ! ! }; ! ! #else ! ! using namespace TNL; ! ! namespace Zap ! { ! ! Point SFXObject::mListenerPosition; ! Point SFXObject::mListenerVelocity; ! F32 SFXObject::mMaxDistance = 500; ! ! SFXObject::SFXObject(U32 sfxIndex, F32 gain, bool looping) ! { ! } ! ! SFXObject::SFXObject(U32 sfxIndex, Point position, Point velocity, F32 gain, bool looping) ! { ! } ! ! SFXObject::~SFXObject() ! { ! ! } ! ! void SFXObject::updateGain() ! { ! } ! ! void SFXObject::updateMovementParams() ! { ! } ! ! void SFXObject::playOnSource() ! { ! } ! ! void SFXObject::setGain(F32 gain) ! { ! } ! ! void SFXObject::setLooping(bool looping) ! { ! } ! ! void SFXObject::setMovementParams(Point position, Point velocity) ! { ! } ! ! void SFXObject::play() ! { ! } ! ! void SFXObject::stop() ! { ! } ! ! void SFXObject::init() ! { ! logprintf("No OpenAL support on this platform."); ! } ! ! void SFXObject::process() ! { ! } ! ! void SFXObject::setListenerParams(Point pos, Point velocity) ! { ! } ! ! void SFXObject::shutdown() ! { ! }; ! ! }; ! ! #endif \ No newline at end of file --- 1,456 ---- ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 "sfx.h" ! #include "tnl.h" ! #include "tnlLog.h" ! ! #if defined (TNL_OS_WIN32) || defined (TNL_OS_LINUX) ! ! #include "alInclude.h" ! ! using namespace TNL; ! ! namespace Zap ! { ! ! static SFXProfile gSFXProfiles[] = { ! { "phaser.wav", false, 0.45f, false, 150, 600 }, ! { "phaser_impact.wav", false, 0.7f, false, 150, 600 }, ! { "ship_explode.wav", false, 1.0, false, 300, 1000 }, ! { "flag_capture.wav", true, 0.45f, false, 0, 0 }, ! { "flag_drop.wav", true, 0.45f, false, 0, 0 }, ! { "flag_return.wav", true, 0.45f, false, 0, 0 }, ! { "flag_snatch.wav", true, 0.45f, false, 0, 0 }, ! { "teleport_in.wav", false, 1.0, false, 200, 500 }, ! { "teleport_out.wav", false, 1.0, false, 200, 500 }, ! { "bounce_wall.wav", false, 0.7f, false, 150, 600 }, ! { "bounce_obj.wav", false, 0.7f, false, 150, 600 }, ! { NULL, false, 0, false, 0, 0 }, ! }; ! ! static ALCdevice *gDevice = NULL; ! static ALCcontext *gContext = NULL; ! static bool gSFXValid = false; ! ! enum { ! NumSources = 16, ! }; ! ! static ALuint gSources[NumSources]; ! static bool gSourceActive[NumSources]; ! Point SFXObject::mListenerPosition; ! Point SFXObject::mListenerVelocity; ! F32 SFXObject::mMaxDistance = 500; ! ! static ALuint gBuffers[NumSFXBuffers]; ! static Vector<SFXHandle> gPlayList; ! ! SFXObject::SFXObject(U32 profileIndex, F32 gain, Point position, Point velocity) ! { ! mSFXIndex = profileIndex; ! mProfile = gSFXProfiles + profileIndex; ! mGain = gain; ! mPosition = position; ! mVelocity = velocity; ! mSourceIndex = -1; ! mPriority = 0; ! } ! ! RefPtr<SFXObject> SFXObject::play(U32 profileIndex, F32 gain) ! { ! RefPtr<SFXObject> ret = new SFXObject(profileIndex, gain, Point(), Point()); ! ret->play(); ! return ret; ! } ! ! RefPtr<SFXObject> SFXObject::play(U32 profileIndex, Point position, Point velocity, F32 gain) ! { ! RefPtr<SFXObject> ret = new SFXObject(profileIndex, gain, position, velocity); ! ret->play(); ! return ret; ! } ! ! SFXObject::~SFXObject() ! { ! ! } ! ! void SFXObject::updateGain() ! { ! ALuint source = gSources[mSourceIndex]; ! F32 gain = mGain; ! ! if(!mProfile->isRelative) ! { ! F32 distance = (mListenerPosition - mPosition).len(); ! if(distance > mProfile->fullGainDistance) ! { ! if(distance < mProfile->zeroGainDistance) ! gain *= (mProfile->fullGainDistance - distance) / ! (mProfile->zeroGainDistance - mProfile->fullGainDistance); ! else ! gain = 0.0f; ! } ! else ! gain = 1.0f; ! } ! else ! gain = 1.0f; ! ! alSourcef(source, AL_GAIN, gain * mProfile->gainScale); ! } ! ! void SFXObject::updateMovementParams() ! { ! ALuint source = gSources[mSourceIndex]; ! if(mProfile->isRelative) ! { ! alSourcei(source, AL_SOURCE_RELATIVE, true); ! alSource3f(source, AL_POSITION, 0, 0, 0); ! //alSource3f(source, AL_VELOCITY, 0, 0, 0); ! } ! else ! { ! alSourcei(source, AL_SOURCE_RELATIVE, false); ! alSource3f(source, AL_POSITION, mPosition.x, mPosition.y, 0); ! //alSource3f(source, AL_VELOCITY, mVelocity.x, mVelocity.y, 0); ! } ! } ! ! void SFXObject::playOnSource() ! { ! ALuint source = gSources[mSourceIndex]; ! alSourceStop(source); ! alSourcei(source, AL_BUFFER, gBuffers[mSFXIndex]); ! alSourcei(source, AL_LOOPING, mProfile->isLooping); ! updateMovementParams(); ! ! updateGain(); ! alSourcePlay(source); ! } ! ! void SFXObject::setGain(F32 gain) ! { ! mGain = gain; ! if(mSourceIndex != -1) ! updateGain(); ! } ! ! void SFXObject::setMovementParams(Point position, Point velocity) ! { ! mPosition = position; ! mVelocity = velocity; ! if(mSourceIndex != -1) ! updateMovementParams(); ! } ! ! void SFXObject::play() ! { ! if(mSourceIndex != -1) ! return; ! else ! { ! // see if it's on the play list: ! S32 i; ! for(i = 0; i < gPlayList.size(); i++) ! if(gPlayList[i] == this) ! return; ! gPlayList.push_back(this); ! } ! } ! ! void SFXObject::stop() ! { ! // remove from the play list, if this sound is playing: ! if(mSourceIndex != -1) ! { ! alSourceStop(gSources[mSourceIndex]); ! mSourceIndex = -1; ! } ! for(S32 i = 0; i < gPlayList.size(); i++) ! { ! if(gPlayList[i] == this) ! { ! gPlayList.erase(i); ! return; ! } ! } ! } ! ! void SFXObject::init() ! { ! gDevice = alcOpenDevice((ALubyte *) "DirectSound3D"); ! if(!gDevice) ! { ! logprintf("Failed to intitialize OpenAL."); ! return; ! } ! ! static int contextData[][2] = ! { ! {ALC_FREQUENCY, 11025}, ! {0,0} // Indicate end of list... ! }; ! ! gContext = alcCreateContext(gDevice, (ALCint*)contextData); ! alcMakeContextCurrent(gContext); ! ! alGetError(); ! ! alDistanceModel(AL_NONE); ! ! // load up all the sound buffers ! alGenBuffers(NumSFXBuffers, gBuffers); ! ! if(alGetError() != AL_NO_ERROR) ! return; ! ! alGenSources(NumSources, gSources); ! ! for(U32 i = 0; i < NumSFXBuffers; i++) ! { ! if(!gSFXProfiles[i].fileName) ! break; ! ! ALsizei size,freq; ! ALenum format; ! ALvoid *data; ! ALboolean loop; ! ! alutLoadWAVFile((ALbyte *) gSFXProfiles[i].fileName, &format, &data, &size, &freq, &loop); ! if(alGetError() != AL_NO_ERROR) ! return; ! alBufferData(gBuffers[i], format, data, size, freq); ! alutUnloadWAV(format, data, size, freq); ! if(alGetError() != AL_NO_ERROR) ! return; ! } ! gSFXValid = true; ! } ! ! void SFXObject::process() ! { ! if(!gSFXValid) ! return; ! ! // ok, so we have a list of currently "playing" sounds, which is ! // unbounded in length, but only the top NumSources actually have sources ! // associtated with them. Sounds are prioritized on a 0-1 scale ! // based on type and distance. ! // Each time through the main loop, newly played sounds are placed ! // on the process list. When SFXProcess is called, any finished sounds ! // are retired from the list, and then it prioritizes and sorts all ! // the remaining sounds. For any sounds from 0 to NumSources that don't ! // have a current source, they grab one of the sources not used by the other ! // top sounds. At this point, any sound that is not looping, and is ! // not in the active top list is retired. ! ! // ok, look through all the currently playing sources and see which ! // ones need to be retired: ! ! for(S32 i = 0; i < NumSources; i++) ! { ! ALint state; ! alGetSourcei(gSources[i], AL_SOURCE_STATE, &state); ! gSourceActive[i] = state != AL_STOPPED && state != AL_INITIAL; ! } ! for(S32 i = 0; i < gPlayList.size(); ) ! { ! SFXHandle &s = gPlayList[i]; ! if(s->mSourceIndex != -1 && !gSourceActive[s->mSourceIndex]) ! { ! // this sound was playing; now it is stopped, ! // so remove it from the list. ! s->mSourceIndex = -1; ! gPlayList.erase_fast(i); ! } ! else ! { ! // compute a priority for this sound. ! if(!s->mProfile->isRelative) ! s->mPriority = (500 - (s->mPosition - mListenerPosition).len()) / 500.0f; ! else ! s->mPriority = 1.0; ! i++; ! } ! } ! // now, bubble sort all the sounds up the list: ! // we choose bubble sort, because the list should ! // have a lot of frame-to-frame coherency, making the ! // sort most often O(n) ! for(S32 i = 1; i < gPlayList.size(); i++) ! { ! F32 priority = gPlayList[i]->mPriority; ! for(S32 j = i - 1; j >= 0; j--) ! { ! if(priority > gPlayList[j]->mPriority) ! { ! SFXHandle temp = gPlayList[j]; ! gPlayList[j] = gPlayList[j+1]; ! gPlayList[j+1] = temp; ! } ! } ! } ! // last, release any sources and get rid of non-looping sounds ! // outside our max sound limit ! for(S32 i = NumSources; i < gPlayList.size(); ) ! { ! SFXHandle &s = gPlayList[i]; ! if(s->mSourceIndex != -1) ! { ! gSourceActive[s->mSourceIndex] = false; ! s->mSourceIndex = -1; ! } ! if(!s->mProfile->isLooping) ! gPlayList.erase_fast(i); ! else ! i++; ! } ! // now assign sources to all our sounds that need them: ! S32 firstFree = 0; ! S32 max = NumSources; ! if(max > gPlayList.size()) ! max = gPlayList.size(); ! ! for(S32 i = 0; i < max; i++) ! { ! SFXHandle &s = gPlayList[i]; ! if(s->mSourceIndex == -1) ! { ! while(gSourceActive[firstFree]) ! firstFree++; ! s->mSourceIndex = firstFree; ! gSourceActive[firstFree] = true; ! s->playOnSource(); ! } ! else ! { ! // for other sources, just attenuate the gain. ! s->updateGain(); ! } ! } ! } ! ! void SFXObject::setListenerParams(Point pos, Point velocity) ! { ! if(!gSFXValid) ! return; ! ! mListenerPosition = pos; ! mListenerVelocity = velocity; ! alListener3f(AL_POSITION, pos.x, pos.y, -mMaxDistance/2); ! } ! ! void SFXObject::shutdown() ! { ! if(!gSFXValid) ! return; ! ! alDeleteBuffers(NumSFXBuffers, gBuffers); ! alcMakeContextCurrent(NULL); ! alcDestroyContext(gContext); ! alcCloseDevice(gDevice); ! } ! ! }; ! ! #else ! ! using namespace TNL; ! ! namespace Zap ! { ! ! Point SFXObject::mListenerPosition; ! Point SFXObject::mListenerVelocity; ! F32 SFXObject::mMaxDistance = 500; ! ! SFXObject::SFXObject(U32 sfxIndex, F32 gain, bool looping) ! { ! } ! ! SFXObject::SFXObject(U32 sfxIndex, Point position, Point velocity, F32 gain, bool looping) ! { ! } ! ! SFXObject::~SFXObject() ! { ! ! } ! ! void SFXObject::updateGain() ! { ! } ! ! void SFXObject::updateMovementParams() ! { ! } ! ! void SFXObject::playOnSource() ! { ! } ! ! void SFXObject::setGain(F32 gain) ! { ! } ! ! void SFXObject::setLooping(bool looping) ! { ! } ! ! void SFXObject::setMovementParams(Point position, Point velocity) ! { ! } ! ! void SFXObject::play() ! { ! } ! ! void SFXObject::stop() ! { ! } ! ! void SFXObject::init() ! { ! logprintf("No OpenAL support on this platform."); ! } ! ! void SFXObject::process() ! { ! } ! ! void SFXObject::setListenerParams(Point pos, Point velocity) ! { ! } ! ! void SFXObject::shutdown() ! { ! }; ! ! }; ! ! #endif Index: game.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/game.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** game.h 20 Apr 2004 18:40:19 -0000 1.2 --- game.h 20 Apr 2004 19:25:48 -0000 1.3 *************** *** 1,189 **** ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 ! // ! //------------------------------------------------------------------------------------ ! ! #ifndef _GAME_H_ ! #define _GAME_H_ ! ! #include "point.h" ! #include "gameConnection.h" ! #include "../tnl/tnlNetObject.h" ! #include "gridDB.h" ! ! /// ! /// Zap - a 2D space game demonstrating the full capabilities of the ! /// Torque Network Library. ! /// ! /// The Zap example game is a 2D vector-graphics game that utilizes ! /// some of the more advanced features of the TNL. Zap also demonstrates ! /// the use of client-side prediction, and interpolation to present ! /// a consistent simulation to clients over a connection with perceptible ! /// latency. ! /// ! /// Zap can run in 3 modes - as a client, a client and server, or a dedicated ! /// server. The dedicated server option is available only as a launch ! /// parameter from the command line. ! /// ! /// If it is run as a client, Zap uses the GLUT library to perform ! /// cross-platform window intialization, event processing and OpenGL setup. ! /// ! /// Zap implements a simple game framework. The GameObject class is ! /// the root class for all of the various objects in the Zap world, including ! /// Ship, Barrier and Projectile instances. The Game class, which is instanced ! /// once for the client and once for the server, manages the current ! /// list of GameObject instances. ! /// ! /// Zap clients can connect to servers directly that are on the same LAN ! /// or for which the IP address is known. Zap is also capable of talking ! /// to the TNL master server and using its arranged connection functionality ! /// to talk to servers. ! /// ! /// The simplified user interface for Zap is managed entirely through ! /// subclasses of the UserInterface class. Each UserInterface subclass ! /// represents one "screen" in the UI. The GameUserInterface is the most complicated, ! /// being responsible for the user interface while the client is actually ! /// playing a game. The only other somewhat complicated UI is the ! /// QueryServersUserInterface class, which implements a full server browser ! /// for choosing from a list of LAN and master server queried servers. ! /// ! /// ! namespace Zap ! { ! ! class MasterServerConnection; ! class GameNetInterface; ! class GameType; ! ! /// Base class for server and client Game subclasses. The Game ! /// base class manages all the objects in the game simulation on ! /// either the server or the client, and is responsible for ! /// managing the passage of time as well as rendering. ! class Game ! { ! protected: ! U32 mLastIdleTime; ! U32 mNextMasterTryTime; ! F32 mGridSize; ! ! struct DeleteRef ! { ! GameO... [truncated message content] |
From: Mark F. <mar...@us...> - 2004-04-20 18:56:09
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29414 Modified Files: moveObject.cpp Log Message: Index: moveObject.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/moveObject.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** moveObject.cpp 20 Apr 2004 08:51:29 -0000 1.2 --- moveObject.cpp 20 Apr 2004 18:55:58 -0000 1.3 *************** *** 299,304 **** { // Make a noise... ! SFXHandle h = new SFXObject(SFXBounceWall, collisionPoint, Point()); ! h->play(); Color bumpC(scale/3, scale/3, scale); --- 299,304 ---- { // Make a noise... ! //SFXHandle h = new SFXObject(SFXBounceWall, collisionPoint, Point()); ! //h->play(); Color bumpC(scale/3, scale/3, scale); *************** *** 340,345 **** shipHit->mMoveState[stateIndex].vel += collisionVector * (v2f - v2i); ! SFXHandle h = new SFXObject(SFXBounceObject, shipHit->mMoveState[stateIndex].pos, Point()); ! h->play(); } --- 340,345 ---- shipHit->mMoveState[stateIndex].vel += collisionVector * (v2f - v2i); ! //SFXHandle h = new SFXObject(SFXBounceObject, shipHit->mMoveState[stateIndex].pos, Point()); ! //h->play(); } |
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25769/zap Modified Files: CTFGame.cpp game.cpp game.h gameConnection.cpp gameType.cpp item.cpp projectile.cpp sfx.cpp sfx.h ship.cpp teleporter.cpp Log Message: Index: gameType.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/gameType.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gameType.cpp 20 Apr 2004 04:27:20 -0000 1.1 --- gameType.cpp 20 Apr 2004 18:40:19 -0000 1.2 *************** *** 1,278 **** ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 "gameType.h" ! #include "ship.h" ! #include "UIGame.h" ! #include "gameNetInterface.h" ! ! namespace Zap ! { ! ! TNL_IMPLEMENT_NETOBJECT(GameType); ! ! GameType::GameType() ! { ! mNetFlags.set(Ghostable); ! } ! ! void GameType::processArguments(S32 argc, const char **argv) ! { ! ! } ! ! void GameType::onAddedToGame(Game *theGame) ! { ! theGame->setGameType(this); ! setInterface(theGame->getNetInterface()); ! if(!isGhost()) ! setScopeAlways(); ! } ! ! bool GameType::processLevelItem(S32 argc, const char **argv) ! { ! if(!stricmp(argv[0], "Team")) ! { ! if(argc < 5) ! return false; ! Team t; ! t.numPlayers = 0; ! ! t.name.set(argv[1]); ! t.color.read(argv + 2); ! mTeams.push_back(t); ! } ! else if(!stricmp(argv[0], "Spawn")) ! { ! if(argc < 4) ! return false; ! S32 teamIndex = atoi(argv[1]); ! Point p; ! p.read(argv + 2); ! p *= getGame()->getGridSize(); ! if(teamIndex >= 0 && teamIndex < mTeams.size()) ! mTeams[teamIndex].spawnPoints.push_back(p); ! } ! else ! return false; ! return true; ! } ! ! S32 GameType::findClientIndexByConnection(GameConnection *theConnection) ! { ! for(S32 clientIndex = 0; clientIndex < mClientList.size(); clientIndex++) ! if(mClientList[clientIndex].clientConnection == theConnection) ! return clientIndex; ! return -1; ! } ! ! S32 GameType::findClientIndexById(U32 clientId) ! { ! for(S32 clientIndex = 0; clientIndex < mClientList.size(); clientIndex++) ! if(mClientList[clientIndex].clientId == clientId) ! return clientIndex; ! return -1; ! } ! ! void GameType::spawnShip(GameConnection *theClient) ! { ! S32 clientIndex = findClientIndexByConnection(theClient); ! S32 teamIndex = mClientList[clientIndex].teamId; ! ! Point spawnPoint; ! S32 spawnIndex = Random::readI() % mTeams[teamIndex].spawnPoints.size(); ! spawnPoint = mTeams[teamIndex].spawnPoints[spawnIndex]; ! ! Ship *newShip = new Ship(spawnPoint, mTeams[teamIndex].color); ! newShip->addToGame(getGame()); ! theClient->setControlObject(newShip); ! } ! ! void GameType::serverAddClient(GameConnection *theClient) ! { ! ClientRef cref; ! cref.clientId = theClient->mClientId; ! cref.name = theClient->playerName; ! ! cref.clientConnection = theClient; ! U32 minPlayers = mTeams[0].numPlayers; ! S32 minTeamIndex = 0; ! for(S32 i = 1; i < mTeams.size(); i++) ! { ! if(mTeams[i].numPlayers < minPlayers) ! { ! minTeamIndex = i; ! minPlayers = mTeams[i].numPlayers; ! } ! } ! cref.teamId = minTeamIndex; ! mClientList.push_back(cref); ! ! mTeams[cref.teamId].numPlayers++; ! ! s2cAddClient(cref.clientId, cref.name, false); ! s2cClientJoinedTeam(cref.clientId, cref.teamId); ! spawnShip(theClient); ! } ! ! void GameType::controlObjectForClientKilled(GameConnection *theClient) ! { ! spawnShip(theClient); ! } ! ! void GameType::addClientGameMenuOptions(Vector<const char *> &menuOptions) ! { ! if(mTeams.size() > 1) ! menuOptions.push_back("CHANGE TEAMS"); ! } ! ! void GameType::processClientGameMenuOption(U32 index) ! { ! if(index == 0) ! c2sChangeTeams(); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddClient, (U32 id, StringTableEntry name, bool isMyClient), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! ClientRef cref; ! cref.clientId = id; ! cref.name = name; ! cref.teamId = 0; ! mClientList.push_back(cref); ! ! if(isMyClient) ! mThisClientId = id; ! gGameUserInterface.displayMessage(Color(0.6f, 0.6f, 0.8f), "%s joined the game.", name.getString()); ! } ! ! void GameType::serverRemoveClient(GameConnection *theClient) ! { ! S32 clientIndex = findClientIndexByConnection(theClient); ! mTeams[mClientList[clientIndex].teamId].numPlayers--; ! mClientList.erase(clientIndex); ! ! GameObject *theControlObject = theClient->getControlObject(); ! if(theControlObject) ! delete theControlObject; ! ! s2cRemoveClient(theClient->mClientId); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cRemoveClient, (U32 id), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! S32 clientIndex = findClientIndexById(id); ! mClientList.erase(clientIndex); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddTeam, (StringTableEntry teamName, F32 r, F32 g, F32 b), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! Team team; ! team.name = teamName; ! team.color.r = r; ! team.color.g = g; ! team.color.b = b; ! mTeams.push_back(team); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cSetTeamScore, (U32 teamIndex, U32 score), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! mTeams[teamIndex].score = score; ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cClientJoinedTeam, (U32 clientId, U32 teamIndex), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! S32 clientIndex = findClientIndexById(clientId); ! mClientList[clientIndex].teamId = teamIndex; ! gGameUserInterface.displayMessage(Color(0.6f, 0.6f, 0.8f), "%s joined team %s.", mClientList[clientIndex].name.getString(), mTeams[teamIndex].name.getString()); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, c2sChangeTeams, (), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhostParent, 0) ! { ! if(mTeams.size() <= 1) ! return; ! ! GameConnection *source = (GameConnection *) NetObject::getRPCSourceConnection(); ! S32 clientIndex = findClientIndexByConnection(source); ! ! // destroy the old ship ! GameObject *co = source->getControlObject(); ! if(co) ! getGame()->deleteObject(co); ! ! U32 newTeamId = (mClientList[clientIndex].teamId + 1) % mTeams.size(); ! mClientList[clientIndex].teamId = newTeamId; ! s2cClientJoinedTeam(mClientList[clientIndex].clientId, newTeamId); ! spawnShip(source); ! } ! ! void GameType::onGhostAvailable(GhostConnection *theConnection) ! { ! NetObject::setRPCDestConnection(theConnection); ! ! for(S32 i = 0; i < mTeams.size(); i++) ! { ! s2cAddTeam(mTeams[i].name, mTeams[i].color.r, mTeams[i].color.g, mTeams[i].color.b); ! s2cSetTeamScore(i, mTeams[i].score); ! } ! ! // add all the client and team information ! for(S32 i = 0; i < mClientList.size(); i++) ! { ! s2cAddClient(mClientList[i].clientId, mClientList[i].name, mClientList[i].clientConnection == theConnection); ! s2cClientJoinedTeam(mClientList[i].clientId, mClientList[i].teamId); ! } ! NetObject::setRPCDestConnection(NULL); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, c2sSendChat, (bool global, const char *message), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhostParent, 0) ! { ! GameConnection *source = (GameConnection *) getRPCSourceConnection(); ! ! RefPtr<NetEvent> theEvent = TNL_RPC_CONSTRUCT_NETEVENT(this, ! s2cDisplayChatMessage, (global, source->playerName, message)); ! for(S32 i = 0; i < mClientList.size(); i++) ! mClientList[i].clientConnection->postNetEvent(theEvent); ! } ! ! extern Color gGlobalChatColor; ! extern Color gTeamChatColor; ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cDisplayChatMessage, (bool global, StringTableEntry clientName, const char *message), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! Color theColor = global ? gGlobalChatColor : gTeamChatColor; ! ! gGameUserInterface.displayMessage(theColor, "%s: %s", clientName.getString(), message); ! } ! }; \ No newline at end of file --- 1,278 ---- ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 "gameType.h" ! #include "ship.h" ! #include "UIGame.h" ! #include "gameNetInterface.h" ! ! namespace Zap ! { ! ! TNL_IMPLEMENT_NETOBJECT(GameType); ! ! GameType::GameType() ! { ! mNetFlags.set(Ghostable); ! } ! ! void GameType::processArguments(S32 argc, const char **argv) ! { ! ! } ! ! void GameType::onAddedToGame(Game *theGame) ! { ! theGame->setGameType(this); ! setInterface(theGame->getNetInterface()); ! if(!isGhost()) ! setScopeAlways(); ! } ! ! bool GameType::processLevelItem(S32 argc, const char **argv) ! { ! if(!stricmp(argv[0], "Team")) ! { ! if(argc < 5) ! return false; ! Team t; ! t.numPlayers = 0; ! ! t.name.set(argv[1]); ! t.color.read(argv + 2); ! mTeams.push_back(t); ! } ! else if(!stricmp(argv[0], "Spawn")) ! { ! if(argc < 4) ! return false; ! S32 teamIndex = atoi(argv[1]); ! Point p; ! p.read(argv + 2); ! p *= getGame()->getGridSize(); ! if(teamIndex >= 0 && teamIndex < mTeams.size()) ! mTeams[teamIndex].spawnPoints.push_back(p); ! } ! else ! return false; ! return true; ! } ! ! S32 GameType::findClientIndexByConnection(GameConnection *theConnection) ! { ! for(S32 clientIndex = 0; clientIndex < mClientList.size(); clientIndex++) ! if(mClientList[clientIndex].clientConnection == theConnection) ! return clientIndex; ! return -1; ! } ! ! S32 GameType::findClientIndexById(U32 clientId) ! { ! for(S32 clientIndex = 0; clientIndex < mClientList.size(); clientIndex++) ! if(mClientList[clientIndex].clientId == clientId) ! return clientIndex; ! return -1; ! } ! ! void GameType::spawnShip(GameConnection *theClient) ! { ! S32 clientIndex = findClientIndexByConnection(theClient); ! S32 teamIndex = mClientList[clientIndex].teamId; ! ! Point spawnPoint; ! S32 spawnIndex = Random::readI() % mTeams[teamIndex].spawnPoints.size(); ! spawnPoint = mTeams[teamIndex].spawnPoints[spawnIndex]; ! ! Ship *newShip = new Ship(spawnPoint, mTeams[teamIndex].color); ! newShip->addToGame(getGame()); ! theClient->setControlObject(newShip); ! } ! ! void GameType::serverAddClient(GameConnection *theClient) ! { ! ClientRef cref; ! cref.clientId = theClient->mClientId; ! cref.name = theClient->playerName; ! ! cref.clientConnection = theClient; ! U32 minPlayers = mTeams[0].numPlayers; ! S32 minTeamIndex = 0; ! for(S32 i = 1; i < mTeams.size(); i++) ! { ! if(mTeams[i].numPlayers < minPlayers) ! { ! minTeamIndex = i; ! minPlayers = mTeams[i].numPlayers; ! } ! } ! cref.teamId = minTeamIndex; ! mClientList.push_back(cref); ! ! mTeams[cref.teamId].numPlayers++; ! ! s2cAddClient(cref.clientId, cref.name, false); ! s2cClientJoinedTeam(cref.clientId, cref.teamId); ! spawnShip(theClient); ! } ! ! void GameType::controlObjectForClientKilled(GameConnection *theClient) ! { ! spawnShip(theClient); ! } ! ! void GameType::addClientGameMenuOptions(Vector<const char *> &menuOptions) ! { ! if(mTeams.size() > 1) ! menuOptions.push_back("CHANGE TEAMS"); ! } ! ! void GameType::processClientGameMenuOption(U32 index) ! { ! if(index == 0) ! c2sChangeTeams(); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddClient, (U32 id, StringTableEntry name, bool isMyClient), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! ClientRef cref; ! cref.clientId = id; ! cref.name = name; ! cref.teamId = 0; ! mClientList.push_back(cref); ! ! if(isMyClient) ! mThisClientId = id; ! gGameUserInterface.displayMessage(Color(0.6f, 0.6f, 0.8f), "%s joined the game.", name.getString()); ! } ! ! void GameType::serverRemoveClient(GameConnection *theClient) ! { ! S32 clientIndex = findClientIndexByConnection(theClient); ! mTeams[mClientList[clientIndex].teamId].numPlayers--; ! mClientList.erase(clientIndex); ! ! GameObject *theControlObject = theClient->getControlObject(); ! if(theControlObject) ! delete theControlObject; ! ! s2cRemoveClient(theClient->mClientId); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cRemoveClient, (U32 id), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! S32 clientIndex = findClientIndexById(id); ! mClientList.erase(clientIndex); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cAddTeam, (StringTableEntry teamName, F32 r, F32 g, F32 b), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! Team team; ! team.name = teamName; ! team.color.r = r; ! team.color.g = g; ! team.color.b = b; ! mTeams.push_back(team); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cSetTeamScore, (U32 teamIndex, U32 score), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! mTeams[teamIndex].score = score; ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cClientJoinedTeam, (U32 clientId, U32 teamIndex), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! S32 clientIndex = findClientIndexById(clientId); ! mClientList[clientIndex].teamId = teamIndex; ! gGameUserInterface.displayMessage(Color(0.6f, 0.6f, 0.8f), "%s joined team %s.", mClientList[clientIndex].name.getString(), mTeams[teamIndex].name.getString()); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, c2sChangeTeams, (), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhostParent, 0) ! { ! if(mTeams.size() <= 1) ! return; ! ! GameConnection *source = (GameConnection *) NetObject::getRPCSourceConnection(); ! S32 clientIndex = findClientIndexByConnection(source); ! ! // destroy the old ship ! GameObject *co = source->getControlObject(); ! if(co) ! getGame()->deleteObject(co, 0); ! ! U32 newTeamId = (mClientList[clientIndex].teamId + 1) % mTeams.size(); ! mClientList[clientIndex].teamId = newTeamId; ! s2cClientJoinedTeam(mClientList[clientIndex].clientId, newTeamId); ! spawnShip(source); ! } ! ! void GameType::onGhostAvailable(GhostConnection *theConnection) ! { ! NetObject::setRPCDestConnection(theConnection); ! ! for(S32 i = 0; i < mTeams.size(); i++) ! { ! s2cAddTeam(mTeams[i].name, mTeams[i].color.r, mTeams[i].color.g, mTeams[i].color.b); ! s2cSetTeamScore(i, mTeams[i].score); ! } ! ! // add all the client and team information ! for(S32 i = 0; i < mClientList.size(); i++) ! { ! s2cAddClient(mClientList[i].clientId, mClientList[i].name, mClientList[i].clientConnection == theConnection); ! s2cClientJoinedTeam(mClientList[i].clientId, mClientList[i].teamId); ! } ! NetObject::setRPCDestConnection(NULL); ! } ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, c2sSendChat, (bool global, const char *message), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhostParent, 0) ! { ! GameConnection *source = (GameConnection *) getRPCSourceConnection(); ! ! RefPtr<NetEvent> theEvent = TNL_RPC_CONSTRUCT_NETEVENT(this, ! s2cDisplayChatMessage, (global, source->playerName, message)); ! for(S32 i = 0; i < mClientList.size(); i++) ! mClientList[i].clientConnection->postNetEvent(theEvent); ! } ! ! extern Color gGlobalChatColor; ! extern Color gTeamChatColor; ! ! TNL_IMPLEMENT_NETOBJECT_RPC(GameType, s2cDisplayChatMessage, (bool global, StringTableEntry clientName, const char *message), ! NetClassGroupGameMask, RPCGuaranteedOrdered, RPCToGhost, 0) ! { ! Color theColor = global ? gGlobalChatColor : gTeamChatColor; ! ! gGameUserInterface.displayMessage(theColor, "%s: %s", clientName.getString(), message); ! } ! }; \ No newline at end of file Index: projectile.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/projectile.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** projectile.cpp 20 Apr 2004 04:27:20 -0000 1.1 --- projectile.cpp 20 Apr 2004 18:40:19 -0000 1.2 *************** *** 1,218 **** ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 "projectile.h" ! #include "ship.h" ! #include "sparkManager.h" ! #include "sfx.h" ! ! #include "glutInclude.h" ! ! namespace Zap ! { ! ! TNL_IMPLEMENT_NETOBJECT(Projectile); ! ! ! Projectile::Projectile(Point p, Point v, U32 t, Ship *shooter) ! { ! mNetFlags.set(Ghostable); ! pos = p; ! velocity = v; ! liveTime = t; ! collided = false; ! mShooter = shooter; ! } ! ! U32 Projectile::packUpdate(GhostConnection *connection, U32 updateMask, BitStream *stream) ! { ! stream->write(pos.x); ! stream->write(pos.y); ! stream->write(velocity.x); ! stream->write(velocity.y); ! S32 index = -1; ! if(mShooter.isValid()) ! index = connection->getGhostIndex(mShooter); ! if(stream->writeFlag(index != -1)) ! stream->writeInt(index, GhostConnection::GhostIdBitSize); ! ! return 0; ! } ! ! void Projectile::unpackUpdate(GhostConnection *connection, BitStream *stream) ! { ! stream->read(&pos.x); ! stream->read(&pos.y); ! stream->read(&velocity.x); ! stream->read(&velocity.y); ! ! if(stream->readFlag()) ! mShooter = (Ship *) connection->resolveGhost(stream->readInt(GhostConnection::GhostIdBitSize)); ! ! Rect newExtent(pos,pos); ! setExtent(newExtent); ! process(connection->getOneWayTime()); ! ! SFXHandle h = new SFXObject(0, pos, velocity); ! h->play(); ! } ! ! enum { ! NumSparkColors = 4, ! }; ! ! Color SparkColors[NumSparkColors] = { ! Color(1, 0, 1), ! Color(1, 1, 1), ! Color(0, 0, 1), ! Color(1, 0, 0), ! }; ! void Projectile::handleCollision(GameObject *hitObject, Point collisionPoint) ! { ! collided = true; ! ! if(!isGhost()) ! { ! DamageInfo theInfo; ! theInfo.collisionPoint = collisionPoint; ! theInfo.damageAmount = 1; ! theInfo.damageType = 0; ! theInfo.damagingObject = this; ! theInfo.impulseVector = velocity; ! ! hitObject->damageObject(&theInfo); ! } ! velocity.set(0,0); ! liveTime = 0; ! ! // Do some particle spew... ! if(isGhost()) ! { ! SparkManager::emitExplosion(collisionPoint, 0.4, SparkColors, NumSparkColors); ! SFXHandle h = new SFXObject(SFXPhaserImpact, pos, velocity); ! h->play(); ! } ! } ! ! void Projectile::process(U32 deltaT) ! { ! Point endPos = pos + velocity * deltaT * 0.001; ! static Vector<GameObject *> disableVector; ! ! Rect queryRect(pos, endPos); ! ! float collisionTime; ! disableVector.clear(); ! ! if(mShooter.isValid()) ! { ! disableVector.push_back(mShooter); ! mShooter->disableCollision(); ! } ! ! GameObject *hitObject; ! for(;;) ! { ! hitObject = findObjectLOS(MoveableType | BarrierType, MoveObject::RenderState, pos, endPos, collisionTime); ! if(!hitObject || hitObject->collide(this)) ! break; ! disableVector.push_back(hitObject); ! hitObject->disableCollision(); ! } ! ! for(S32 i = 0; i < disableVector.size(); i++) ! disableVector[i]->enableCollision(); ! ! if(hitObject) ! { ! Point collisionPoint = pos + (endPos - pos) * collisionTime; ! handleCollision(hitObject, collisionPoint); ! } ! else ! pos = endPos; ! ! Rect newExtent(pos,pos); ! setExtent(newExtent); ! } ! ! void Projectile::processServer(U32 deltaT) ! { ! process(deltaT); ! ! if(liveTime < deltaT) ! getGame()->deleteObject(this); ! else ! liveTime -= deltaT; ! } ! ! void Projectile::processClient(U32 deltaT) ! { ! process(deltaT); ! liveTime += deltaT; ! } ! ! void Projectile::render() ! { ! if(collided) ! return; ! ! glColor3f(1,0,0.5); ! glPushMatrix(); ! glTranslatef(pos.x, pos.y, 0); ! ! glPushMatrix(); ! glRotatef((liveTime % 720) * 0.5, 0, 0, 1); ! ! glBegin(GL_LINE_LOOP); ! glVertex2f(-2, 2); ! glVertex2f(0, 6); ! glVertex2f(2, 2); ! glVertex2f(6, 0); ! glVertex2f(2, -2); ! glVertex2f(0, -6); ! glVertex2f(-2, -2); ! glVertex2f(-6, 0); ! glEnd(); ! ! glPopMatrix(); ! ! glRotatef(180 - (liveTime % 360), 0, 0, 1); ! glColor3f(0.5,0,1); ! glBegin(GL_LINE_LOOP); ! glVertex2f(-2, 2); ! glVertex2f(0, 8); ! glVertex2f(2, 2); ! glVertex2f(8, 0); ! glVertex2f(2, -2); ! glVertex2f(0, -8); ! glVertex2f(-2, -2); ! glVertex2f(-8, 0); ! glEnd(); ! ! glPopMatrix(); ! } ! }; \ No newline at end of file --- 1,223 ---- ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 "projectile.h" ! #include "ship.h" ! #include "sparkManager.h" ! #include "sfx.h" ! ! #include "glutInclude.h" ! ! namespace Zap ! { ! ! TNL_IMPLEMENT_NETOBJECT(Projectile); ! ! ! Projectile::Projectile(Point p, Point v, U32 t, Ship *shooter) ! { ! mNetFlags.set(Ghostable); ! pos = p; ! velocity = v; ! liveTime = t; ! collided = false; ! mShooter = shooter; ! } ! ! U32 Projectile::packUpdate(GhostConnection *connection, U32 updateMask, BitStream *stream) ! { ! stream->write(pos.x); ! stream->write(pos.y); ! stream->write(velocity.x); ! stream->write(velocity.y); ! S32 index = -1; ! if(mShooter.isValid()) ! index = connection->getGhostIndex(mShooter); ! if(stream->writeFlag(index != -1)) ! stream->writeInt(index, GhostConnection::GhostIdBitSize); ! ! return 0; ! } ! ! void Projectile::unpackUpdate(GhostConnection *connection, BitStream *stream) ! { ! stream->read(&pos.x); ! stream->read(&pos.y); ! stream->read(&velocity.x); ! stream->read(&velocity.y); ! ! if(stream->readFlag()) ! mShooter = (Ship *) connection->resolveGhost(stream->readInt(GhostConnection::GhostIdBitSize)); ! ! Rect newExtent(pos,pos); ! setExtent(newExtent); ! process(connection->getOneWayTime()); ! ! SFXObject::play(0, pos, velocity); ! } ! ! enum { ! NumSparkColors = 4, ! }; ! ! Color SparkColors[NumSparkColors] = { ! Color(1, 0, 1), ! Color(1, 1, 1), ! Color(0, 0, 1), ! Color(1, 0, 0), ! }; ! void Projectile::handleCollision(GameObject *hitObject, Point collisionPoint) ! { ! collided = true; ! ! if(!isGhost()) ! { ! DamageInfo theInfo; ! theInfo.collisionPoint = collisionPoint; ! theInfo.damageAmount = 1; ! theInfo.damageType = 0; ! theInfo.damagingObject = this; ! theInfo.impulseVector = velocity; ! ! hitObject->damageObject(&theInfo); ! } ! liveTime = 0; ! ! // Do some particle spew... ! if(isGhost()) ! { ! SparkManager::emitExplosion(collisionPoint, 0.4, SparkColors, NumSparkColors); ! SFXObject::play(SFXPhaserImpact, pos, velocity); ! } ! } ! ! void Projectile::process(U32 deltaT) ! { ! if(collided) ! return; ! ! Point endPos = pos + velocity * deltaT * 0.001; ! static Vector<GameObject *> disableVector; ! ! Rect queryRect(pos, endPos); ! ! float collisionTime; ! disableVector.clear(); ! ! if(mShooter.isValid()) ! { ! disableVector.push_back(mShooter); ! mShooter->disableCollision(); ! } ! ! GameObject *hitObject; ! for(;;) ! { ! hitObject = findObjectLOS(MoveableType | BarrierType, MoveObject::RenderState, pos, endPos, collisionTime); ! if(!hitObject || hitObject->collide(this)) ! break; ! disableVector.push_back(hitObject); ! hitObject->disableCollision(); ! } ! ! for(S32 i = 0; i < disableVector.size(); i++) ! disableVector[i]->enableCollision(); ! ! if(hitObject) ! { ! Point collisionPoint = pos + (endPos - pos) * collisionTime; ! handleCollision(hitObject, collisionPoint); ! } ! else ! pos = endPos; ! ! Rect newExtent(pos,pos); ! setExtent(newExtent); ! } ! ! void Projectile::processServer(U32 deltaT) ! { ! process(deltaT); ! if(liveTime) ! { ! if(liveTime <= deltaT) ! { ! getGame()->deleteObject(this, 500); ! liveTime = 0; ! } ! else ! liveTime -= deltaT; ! } ! } ! ! void Projectile::processClient(U32 deltaT) ! { ! process(deltaT); ! liveTime += deltaT; ! } ! ! void Projectile::render() ! { ! if(collided) ! return; ! ! glColor3f(1,0,0.5); ! glPushMatrix(); ! glTranslatef(pos.x, pos.y, 0); ! ! glPushMatrix(); ! glRotatef((liveTime % 720) * 0.5, 0, 0, 1); ! ! glBegin(GL_LINE_LOOP); ! glVertex2f(-2, 2); ! glVertex2f(0, 6); ! glVertex2f(2, 2); ! glVertex2f(6, 0); ! glVertex2f(2, -2); ! glVertex2f(0, -6); ! glVertex2f(-2, -2); ! glVertex2f(-6, 0); ! glEnd(); ! ! glPopMatrix(); ! ! glRotatef(180 - (liveTime % 360), 0, 0, 1); ! glColor3f(0.5,0,1); ! glBegin(GL_LINE_LOOP); ! glVertex2f(-2, 2); ! glVertex2f(0, 8); ! glVertex2f(2, 2); ! glVertex2f(8, 0); ! glVertex2f(2, -2); ! glVertex2f(0, -8); ! glVertex2f(-2, -2); ! glVertex2f(-8, 0); ! glEnd(); ! ! glPopMatrix(); ! } ! }; \ No newline at end of file Index: sfx.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sfx.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sfx.cpp 20 Apr 2004 09:28:26 -0000 1.3 --- sfx.cpp 20 Apr 2004 18:40:19 -0000 1.4 *************** *** 1,455 **** ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 "sfx.h" ! #include "tnl.h" ! #include "tnlLog.h" ! ! #if defined (TNL_OS_WIN32) || defined (TNL_OS_LINUX) ! ! #include "alInclude.h" ! ! using namespace TNL; ! ! namespace Zap ! { ! ! static ALbyte *wavFileNames[] = { ! "phaser.wav", ! "phaser_impact.wav", ! "ship_explode.wav", ! "flag_capture.wav", ! "flag_drop.wav", ! "flag_return.wav", ! "flag_snatch.wav", ! "teleport_in.wav", ! "teleport_out.wav", ! "bounce_wall.wav", ! "bounce_obj.wav", ! NULL, ! }; ! ! ! static ALCdevice *gDevice = NULL; ! static ALCcontext *gContext = NULL; ! static bool gSFXValid = false; ! ! enum { ! NumSources = 16, ! }; ! ! static ALuint gSources[NumSources]; ! static bool gSourceActive[NumSources]; ! Point SFXObject::mListenerPosition; ! Point SFXObject::mListenerVelocity; ! F32 SFXObject::mMaxDistance = 500; ! ! static ALuint gBuffers[NumSFXBuffers]; ! static Vector<SFXHandle> gPlayList; ! ! SFXObject::SFXObject(U32 sfxIndex, F32 gain, bool looping) ! { ! mSFXIndex = sfxIndex; ! mGain = gain; ! mIsLooping = looping; ! mIsRelative = true; ! mSourceIndex = -1; ! mPriority = 0; ! } ! ! SFXObject::SFXObject(U32 sfxIndex, Point position, Point velocity, F32 gain, bool looping) ! { ! mSFXIndex = sfxIndex; ! mGain = gain; ! mIsLooping = looping; ! mPosition = position; ! mVelocity = velocity; ! mIsRelative = false; ! mSourceIndex = -1; ! mPriority = 0; ! } ! ! SFXObject::~SFXObject() ! { ! ! } ! ! void SFXObject::updateGain() ! { ! ALuint source = gSources[mSourceIndex]; ! if(!mIsRelative) ! { ! F32 distance = (mListenerPosition - mPosition).len(); ! ! F32 gainFactor = (mMaxDistance - distance) / mMaxDistance; ! if(gainFactor < 0) ! gainFactor = 0; ! ! //gainFactor = 1; ! ! alSourcef(source, AL_GAIN, gainFactor * mGain); ! } ! else ! alSourcef(source, AL_GAIN, mGain); ! } ! ! void SFXObject::updateMovementParams() ! { ! ALuint source = gSources[mSourceIndex]; ! if(mIsRelative) ! { ! alSourcei(source, AL_SOURCE_RELATIVE, true); ! alSource3f(source, AL_POSITION, 0, 0, 0); ! //alSource3f(source, AL_VELOCITY, 0, 0, 0); ! } ! else ! { ! alSourcei(source, AL_SOURCE_RELATIVE, false); ! alSource3f(source, AL_POSITION, mPosition.x, mPosition.y, 0); ! //alSource3f(source, AL_VELOCITY, mVelocity.x, mVelocity.y, 0); ! } ! } ! ! void SFXObject::playOnSource() ! { ! ALuint source = gSources[mSourceIndex]; ! alSourceStop(source); ! alSourcei(source, AL_BUFFER, gBuffers[mSFXIndex]); ! alSourcei(source, AL_LOOPING, mIsLooping); ! updateMovementParams(); ! ! updateGain(); ! alSourcePlay(source); ! } ! ! void SFXObject::setGain(F32 gain) ! { ! mGain = gain; ! if(mSourceIndex != -1) ! updateGain(); ! } ! ! void SFXObject::setLooping(bool looping) ! { ! mIsLooping = looping; ! if(mSourceIndex != -1) ! alSourcei(gSources[mSourceIndex], AL_LOOPING, mIsLooping); ! } ! ! void SFXObject::setMovementParams(Point position, Point velocity) ! { ! mPosition = position; ! mVelocity = velocity; ! if(mSourceIndex != -1) ! updateMovementParams(); ! } ! ! void SFXObject::play() ! { ! if(mSourceIndex != -1) ! return; ! else ! { ! // see if it's on the play list: ! S32 i; ! for(i = 0; i < gPlayList.size(); i++) ! if(gPlayList[i] == this) ! return; ! gPlayList.push_back(this); ! } ! } ! ! void SFXObject::stop() ! { ! // remove from the play list, if this sound is playing: ! if(mSourceIndex != -1) ! { ! alSourceStop(gSources[mSourceIndex]); ! mSourceIndex = -1; ! } ! for(S32 i = 0; i < gPlayList.size(); i++) ! { ! if(gPlayList[i] == this) ! { ! gPlayList.erase(i); ! return; ! } ! } ! } ! ! void SFXObject::init() ! { ! gDevice = alcOpenDevice((ALubyte *) "DirectSound3D"); ! if(!gDevice) ! { ! logprintf("Failed to intitialize OpenAL."); ! return; ! } ! ! static int contextData[][2] = ! { ! {ALC_FREQUENCY, 11025}, ! {0,0} // Indicate end of list... ! }; ! ! gContext = alcCreateContext(gDevice, (ALCint*)contextData); ! alcMakeContextCurrent(gContext); ! ! alGetError(); ! ! alDistanceModel(AL_NONE); ! ! // load up all the sound buffers ! alGenBuffers(NumSFXBuffers, gBuffers); ! ! if(alGetError() != AL_NO_ERROR) ! return; ! ! alGenSources(NumSources, gSources); ! ! for(U32 i = 0; i < NumSFXBuffers; i++) ! { ! if(!wavFileNames[i]) ! break; ! ! ALsizei size,freq; ! ALenum format; ! ALvoid *data; ! ALboolean loop; ! ! alutLoadWAVFile(wavFileNames[i], &format, &data, &size, &freq, &loop); ! if(alGetError() != AL_NO_ERROR) ! return; ! alBufferData(gBuffers[i], format, data, size, freq); ! alutUnloadWAV(format, data, size, freq); ! if(alGetError() != AL_NO_ERROR) ! return; ! } ! gSFXValid = true; ! } ! ! void SFXObject::process() ! { ! if(!gSFXValid) ! return; ! ! // ok, so we have a list of currently "playing" sounds, which is ! // unbounded in length, but only the top NumSources actually have sources ! // associtated with them. Sounds are prioritized on a 0-1 scale ! // based on type and distance. ! // Each time through the main loop, newly played sounds are placed ! // on the process list. When SFXProcess is called, any finished sounds ! // are retired from the list, and then it prioritizes and sorts all ! // the remaining sounds. For any sounds from 0 to NumSources that don't ! // have a current source, they grab one of the sources not used by the other ! // top sounds. At this point, any sound that is not looping, and is ! // not in the active top list is retired. ! ! // ok, look through all the currently playing sources and see which ! // ones need to be retired: ! ! for(S32 i = 0; i < NumSources; i++) ! { ! ALint state; ! alGetSourcei(gSources[i], AL_SOURCE_STATE, &state); ! gSourceActive[i] = state != AL_STOPPED && state != AL_INITIAL; ! } ! for(S32 i = 0; i < gPlayList.size(); ) ! { ! SFXHandle &s = gPlayList[i]; ! if(s->mSourceIndex != -1 && !gSourceActive[s->mSourceIndex]) ! { ! // this sound was playing; now it is stopped, ! // so remove it from the list. ! s->mSourceIndex = -1; ! gPlayList.erase_fast(i); ! } ! else ! { ! // compute a priority for this sound. ! if(s->mIsRelative) ! s->mPriority = (500 - (s->mPosition - mListenerPosition).len()) / 500.0f; ! else ! s->mPriority = 1.0; ! i++; ! } ! } ! // now, bubble sort all the sounds up the list: ! // we choose bubble sort, because the list should ! // have a lot of frame-to-frame coherency, making the ! // sort most often O(n) ! for(S32 i = 1; i < gPlayList.size(); i++) ! { ! F32 priority = gPlayList[i]->mPriority; ! for(S32 j = i - 1; j >= 0; j--) ! { ! if(priority > gPlayList[j]->mPriority) ! { ! SFXHandle temp = gPlayList[j]; ! gPlayList[j] = gPlayList[j+1]; ! gPlayList[j+1] = temp; ! } ! } ! } ! // last, release any sources and get rid of non-looping sounds ! // outside our max sound limit ! for(S32 i = NumSources; i < gPlayList.size(); ) ! { ! SFXHandle &s = gPlayList[i]; ! if(s->mSourceIndex != -1) ! { ! gSourceActive[s->mSourceIndex] = false; ! s->mSourceIndex = -1; ! } ! if(!s->mIsLooping) ! gPlayList.erase_fast(i); ! else ! i++; ! } ! // now assign sources to all our sounds that need them: ! S32 firstFree = 0; ! S32 max = NumSources; ! if(max > gPlayList.size()) ! max = gPlayList.size(); ! ! for(S32 i = 0; i < max; i++) ! { ! SFXHandle &s = gPlayList[i]; ! if(s->mSourceIndex == -1) ! { ! while(gSourceActive[firstFree]) ! firstFree++; ! s->mSourceIndex = firstFree; ! gSourceActive[firstFree] = true; ! s->playOnSource(); ! } ! else ! { ! // for other sources, just attenuate the gain. ! s->updateGain(); ! } ! } ! } ! ! void SFXObject::setListenerParams(Point pos, Point velocity) ! { ! if(!gSFXValid) ! return; ! ! mListenerPosition = pos; ! mListenerVelocity = velocity; ! alListener3f(AL_POSITION, pos.x, pos.y, -mMaxDistance/2); ! } ! ! void SFXObject::shutdown() ! { ! if(!gSFXValid) ! return; ! ! alDeleteBuffers(NumSFXBuffers, gBuffers); ! alcMakeContextCurrent(NULL); ! alcDestroyContext(gContext); ! alcCloseDevice(gDevice); ! } ! ! }; ! ! #else ! ! using namespace TNL; ! ! namespace Zap ! { ! ! Point SFXObject::mListenerPosition; ! Point SFXObject::mListenerVelocity; ! F32 SFXObject::mMaxDistance = 500; ! ! SFXObject::SFXObject(U32 sfxIndex, F32 gain, bool looping) ! { ! } ! ! SFXObject::SFXObject(U32 sfxIndex, Point position, Point velocity, F32 gain, bool looping) ! { ! } ! ! SFXObject::~SFXObject() ! { ! ! } ! ! void SFXObject::updateGain() ! { ! } ! ! void SFXObject::updateMovementParams() ! { ! } ! ! void SFXObject::playOnSource() ! { ! } ! ! void SFXObject::setGain(F32 gain) ! { ! } ! ! void SFXObject::setLooping(bool looping) ! { ! } ! ! void SFXObject::setMovementParams(Point position, Point velocity) ! { ! } ! ! void SFXObject::play() ! { ! } ! ! void SFXObject::stop() ! { ! } ! ! void SFXObject::init() ! { ! logprintf("No OpenAL support on this platform."); ! } ! ! void SFXObject::process() ! { ! } ! ! void SFXObject::setListenerParams(Point pos, Point velocity) ! { ! } ! ! void SFXObject::shutdown() ! { ! }; ! ! }; ! ! #endif --- 1,454 ---- ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 "sfx.h" ! #include "tnl.h" ! #include "tnlLog.h" ! ! #if defined (TNL_OS_WIN32) ! ! #include "alInclude.h" ! ! using namespace TNL; ! ! namespace Zap ! { ! ! static SFXProfile gSFXProfiles[] = { ! { "phaser.wav", false, 0.45f, false, 150, 600 }, ! { "phaser_impact.wav", false, 0.7f, false, 150, 600 }, ! { "ship_explode.wav", false, 1.0, false, 300, 1000 }, ! { "flag_capture.wav", true, 0.45f, false, 0, 0 }, ! { "flag_drop.wav", true, 0.45f, false, 0, 0 }, ! { "flag_return.wav", true, 0.45f, false, 0, 0 }, ! { "flag_snatch.wav", true, 0.45f, false, 0, 0 }, ! { "teleport_in.wav", false, 1.0, false, 200, 500 }, ! { "teleport_out.wav", false, 1.0, false, 200, 500 }, ! { NULL, false, 0, false, 0, 0 }, ! }; ! ! static ALCdevice *gDevice = NULL; ! static ALCcontext *gContext = NULL; ! static bool gSFXValid = false; ! ! enum { ! NumSources = 16, ! }; ! ! static ALuint gSources[NumSources]; ! static bool gSourceActive[NumSources]; ! Point SFXObject::mListenerPosition; ! Point SFXObject::mListenerVelocity; ! F32 SFXObject::mMaxDistance = 500; ! ! static ALuint gBuffers[NumSFXBuffers]; ! static Vector<SFXHandle> gPlayList; ! ! SFXObject::SFXObject(U32 profileIndex, F32 gain, Point position, Point velocity) ! { ! mSFXIndex = profileIndex; ! mProfile = gSFXProfiles + profileIndex; ! mGain = gain; ! mPosition = position; ! mVelocity = velocity; ! mSourceIndex = -1; ! mPriority = 0; ! } ! ! RefPtr<SFXObject> SFXObject::play(U32 profileIndex, F32 gain) ! { ! RefPtr<SFXObject> ret = new SFXObject(profileIndex, gain, Point(), Point()); ! ret->play(); ! return ret; ! } ! ! RefPtr<SFXObject> SFXObject::play(U32 profileIndex, Point position, Point velocity, F32 gain) ! { ! RefPtr<SFXObject> ret = new SFXObject(profileIndex, gain, position, velocity); ! ret->play(); ! return ret; ! } ! ! SFXObject::~SFXObject() ! { ! ! } ! ! void SFXObject::updateGain() ! { ! ALuint source = gSources[mSourceIndex]; ! F32 gain = mGain; ! ! if(!mProfile->isRelative) ! { ! F32 distance = (mListenerPosition - mPosition).len(); ! if(distance > mProfile->fullGainDistance) ! { ! if(distance < mProfile->zeroGainDistance) ! gain *= (mProfile->fullGainDistance - distance) / ! (mProfile->zeroGainDistance - mProfile->fullGainDistance); ! else ! gain = 0.0f; ! } ! else ! gain = 1.0f; ! } ! else ! gain = 1.0f; ! ! alSourcef(source, AL_GAIN, gain * mProfile->gainScale); ! } ! ! void SFXObject::updateMovementParams() ! { ! ALuint source = gSources[mSourceIndex]; ! if(mProfile->isRelative) ! { ! alSourcei(source, AL_SOURCE_RELATIVE, true); ! alSource3f(source, AL_POSITION, 0, 0, 0); ! //alSource3f(source, AL_VELOCITY, 0, 0, 0); ! } ! else ! { ! alSourcei(source, AL_SOURCE_RELATIVE, false); ! alSource3f(source, AL_POSITION, mPosition.x, mPosition.y, 0); ! //alSource3f(source, AL_VELOCITY, mVelocity.x, mVelocity.y, 0); ! } ! } ! ! void SFXObject::playOnSource() ! { ! ALuint source = gSources[mSourceIndex]; ! alSourceStop(source); ! alSourcei(source, AL_BUFFER, gBuffers[mSFXIndex]); ! alSourcei(source, AL_LOOPING, mProfile->isLooping); ! updateMovementParams(); ! ! updateGain(); ! alSourcePlay(source); ! } ! ! void SFXObject::setGain(F32 gain) ! { ! mGain = gain; ! if(mSourceIndex != -1) ! updateGain(); ! } ! ! void SFXObject::setMovementParams(Point position, Point velocity) ! { ! mPosition = position; ! mVelocity = velocity; ! if(mSourceIndex != -1) ! updateMovementParams(); ! } ! ! void SFXObject::play() ! { ! if(mSourceIndex != -1) ! return; ! else ! { ! // see if it's on the play list: ! S32 i; ! for(i = 0; i < gPlayList.size(); i++) ! if(gPlayList[i] == this) ! return; ! gPlayList.push_back(this); ! } ! } ! ! void SFXObject::stop() ! { ! // remove from the play list, if this sound is playing: ! if(mSourceIndex != -1) ! { ! alSourceStop(gSources[mSourceIndex]); ! mSourceIndex = -1; ! } ! for(S32 i = 0; i < gPlayList.size(); i++) ! { ! if(gPlayList[i] == this) ! { ! gPlayList.erase(i); ! return; ! } ! } ! } ! ! void SFXObject::init() ! { ! gDevice = alcOpenDevice((ALubyte *) "DirectSound3D"); ! if(!gDevice) ! { ! logprintf("Failed to intitialize OpenAL."); ! return; ! } ! ! static int contextData[][2] = ! { ! {ALC_FREQUENCY, 11025}, ! {0,0} // Indicate end of list... ! }; ! ! gContext = alcCreateContext(gDevice, (ALCint*)contextData); ! alcMakeContextCurrent(gContext); ! ! alGetError(); ! ! alDistanceModel(AL_NONE); ! ! // load up all the sound buffers ! alGenBuffers(NumSFXBuffers, gBuffers); ! ! if(alGetError() != AL_NO_ERROR) ! return; ! ! alGenSources(NumSources, gSources); ! ! for(U32 i = 0; i < NumSFXBuffers; i++) ! { ! if(!gSFXProfiles[i].fileName) ! break; ! ! ALsizei size,freq; ! ALenum format; ! ALvoid *data; ! ALboolean loop; ! ! alutLoadWAVFile((ALbyte *) gSFXProfiles[i].fileName, &format, &data, &size, &freq, &loop); ! if(alGetError() != AL_NO_ERROR) ! return; ! alBufferData(gBuffers[i], format, data, size, freq); ! alutUnloadWAV(format, data, size, freq); ! if(alGetError() != AL_NO_ERROR) ! return; ! } ! gSFXValid = true; ! } ! ! void SFXObject::process() ! { ! if(!gSFXValid) ! return; ! ! // ok, so we have a list of currently "playing" sounds, which is ! // unbounded in length, but only the top NumSources actually have sources ! // associtated with them. Sounds are prioritized on a 0-1 scale ! // based on type and distance. ! // Each time through the main loop, newly played sounds are placed ! // on the process list. When SFXProcess is called, any finished sounds ! // are retired from the list, and then it prioritizes and sorts all ! // the remaining sounds. For any sounds from 0 to NumSources that don't ! // have a current source, they grab one of the sources not used by the other ! // top sounds. At this point, any sound that is not looping, and is ! // not in the active top list is retired. ! ! // ok, look through all the currently playing sources and see which ! // ones need to be retired: ! ! for(S32 i = 0; i < NumSources; i++) ! { ! ALint state; ! alGetSourcei(gSources[i], AL_SOURCE_STATE, &state); ! gSourceActive[i] = state != AL_STOPPED && state != AL_INITIAL; ! } ! for(S32 i = 0; i < gPlayList.size(); ) ! { ! SFXHandle &s = gPlayList[i]; ! if(s->mSourceIndex != -1 && !gSourceActive[s->mSourceIndex]) ! { ! // this sound was playing; now it is stopped, ! // so remove it from the list. ! s->mSourceIndex = -1; ! gPlayList.erase_fast(i); ! } ! else ! { ! // compute a priority for this sound. ! if(!s->mProfile->isRelative) ! s->mPriority = (500 - (s->mPosition - mListenerPosition).len()) / 500.0f; ! else ! s->mPriority = 1.0; ! i++; ! } ! } ! // now, bubble sort all the sounds up the list: ! // we choose bubble sort, because the list should ! // have a lot of frame-to-frame coherency, making the ! // sort most often O(n) ! for(S32 i = 1; i < gPlayList.size(); i++) ! { ! F32 priority = gPlayList[i]->mPriority; ! for(S32 j = i - 1; j >= 0; j--) ! { ! if(priority > gPlayList[j]->mPriority) ! { ! SFXHandle temp = gPlayList[j]; ! gPlayList[j] = gPlayList[j+1]; ! gPlayList[j+1] = temp; ! } ! } ! } ! // last, release any sources and get rid of non-looping sounds ! // outside our max sound limit ! for(S32 i = NumSources; i < gPlayList.size(); ) ! { ! SFXHandle &s = gPlayList[i]; ! if(s->mSourceIndex != -1) ! { ! gSourceActive[s->mSourceIndex] = false; ! s->mSourceIndex = -1; ! } ! if(!s->mProfile->isLooping) ! gPlayList.erase_fast(i); ! else ! i++; ! } ! // now assign sources to all our sounds that need them: ! S32 firstFree = 0; ! S32 max = NumSources; ! if(max > gPlayList.size()) ! max = gPlayList.size(); ! ! for(S32 i = 0; i < max; i++) ! { ! SFXHandle &s = gPlayList[i]; ! if(s->mSourceIndex == -1) ! { ! while(gSourceActive[firstFree]) ! firstFree++; ! s->mSourceIndex = firstFree; ! gSourceActive[firstFree] = true; ! s->playOnSource(); ! } ! else ! { ! // for other sources, just attenuate the gain. ! s->updateGain(); ! } ! } ! } ! ! void SFXObject::setListenerParams(Point pos, Point velocity) ! { ! if(!gSFXValid) ! return; ! ! mListenerPosition = pos; ! mListenerVelocity = velocity; ! alListener3f(AL_POSITION, pos.x, pos.y, -mMaxDistance/2); ! } ! ! void SFXObject::shutdown() ! { ! if(!gSFXValid) ! return; ! ! alDeleteBuffers(NumSFXBuffers, gBuffers); ! alcMakeContextCurrent(NULL); ! alcDestroyContext(gContext); ! alcCloseDevice(gDevice); ! } ! ! }; ! ! #else ! ! using namespace TNL; ! ! namespace Zap ! { ! ! Point SFXObject::mListenerPosition; ! Point SFXObject::mListenerVelocity; ! F32 SFXObject::mMaxDistance = 500; ! ! SFXObject::SFXObject(U32 sfxIndex, F32 gain, bool looping) ! { ! } ! ! SFXObject::SFXObject(U32 sfxIndex, Point position, Point velocity, F32 gain, bool looping) ! { ! } ! ! SFXObject::~SFXObject() ! { ! ! } ! ! void SFXObject::updateGain() ! { ! } ! ! void SFXObject::updateMovementParams() ! { ! } ! ! void SFXObject::playOnSource() ! { ! } ! ! void SFXObject::setGain(F32 gain) ! { ! } ! ! void SFXObject::setLooping(bool looping) ! { ! } ! ! void SFXObject::setMovementParams(Point position, Point velocity) ! { ! } ! ! void SFXObject::play() ! { ! } ! ! void SFXObject::stop() ! { ! } ! ! void SFXObject::init() ! { ! logprintf("No OpenAL support on this platform."); ! } ! ! void SFXObject::process() ! { ! } ! ! void SFXObject::setListenerParams(Point pos, Point velocity) ! { ! } ! ! void SFXObject::shutdown() ! { ! }; ! ! }; ! ! #endif \ No newline at end of file Index: game.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/game.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** game.h 20 Apr 2004 04:27:19 -0000 1.1 --- game.h 20 Apr 2004 18:40:19 -0000 1.2 *************** *** 1,181 **** ! //----------------------------------------------------------------------------------- ! // ! // Torque Network Library - ZAP example multiplayer vector graphics space game ! // 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 ! // ! //------------------------------------------------------------------------------------ ! ! #ifndef _GAME_H_ ! #define _GAME_H_ ! ! #include "point.h" ! #include "gameConnection.h" ! #include "../tnl/tnlNetObject.h" ! #include "gridDB.h" ! ! /// ! /// Zap - a 2D space game demonstrating the full capabilities of the ! /// Torque Network Library. ! /// ! /// The Zap example game is a 2D vector-graphics game that utilizes ! /// some of the more advanced features of the TNL. Zap also demonstrates ! /// the use of client-side prediction, and interpolation to present ! /// a consistent simulation to clients over a connection with perceptible ! /// latency. ! /// ! /// Zap can run in 3 modes - as a client, a client and server, or a dedicated ! /// server. The dedicated server option is available only as a launch ! /// parameter from the command line. ! /// ! /// If it is run as a client, Zap uses the GLUT library to perform ! /// cross-platform window intialization, event processing and OpenGL setup. ! /// ! /// Zap implements a simple game framework. The GameObject class is ! /// the root class for all of the various objects in the Zap world, including ! /// Ship, Barrier and Projectile instances. The Game class, which is instanced ! /// once for the client and once for the server, manages the current ! /// list of GameObject instances. ! /// ! /// Zap clients can connect to servers directly that are on the same LAN ! /// or for which the IP address is known. Zap is also capable of talking ! /// to the TNL master server and using its arranged connection functionality ! /// to talk to servers. ! /// ! /// The simplified user interface for Zap is managed entirely through ! /// subclasses of the UserInterface class. Each UserInterface subclass ! /// represents one "screen" in the UI. The GameUserInterface is the most complicated, ! /// being responsible for the user interface while the client is actually ! /// playing a game. The only other somewhat complicated UI is the ! /// QueryServersUserInterface class, which implements a full server browser ! /// for choosing from a list of LAN and master server queried servers. ! /// ! /// ! namespace Zap ! { ! ! class MasterServerConnection; ! class GameNetInterface; ! class GameType; ! ! /// Base class for server and client Game subclasses. The Game ! /// base class manages all the objects in the game simulation on ! /// either the server or the client, and is responsible for ! /// managing the passage of time as well as rendering. ! class Game ! { ! protected: ! U32 mLastIdleTime; ! U32 mNextMasterTryTime; ! F32 mGridSize; ! ! GridDatabase mDatabase; ! Vector<GameObject *> mGameObjects; ! Vector<GameObject *> mPendingDeleteObjects; ! ! RefPtr<GameNetInterface> mNetInterface; ! ! SafePtr<MasterServerConnection> mConnectionToMaster; ! SafePtr<GameType> mGameType; ! ! enum { ! NumStars = 2048, ! WorldSize = 4096, ! DefaultGridSize = 256, ! MasterServerConnectAttemptDelay = 60000, ! }; ! Point mStars[NumStars]; ! ! public: ! Game(const Address &theBindAddress); ! ! void deleteObject(GameObject *theObject) { mPendingDeleteObjects.push_back(theObject); } ! ! void addToGameObjectList(GameObject *theObject); ! void removeFromGameObjectList(GameObject *theObject); ! ! void setGridSize(F32 gridSize) { mGridSize = gridSize; } ! ! F32 getGridSize() { return mGridSize; } ! ! virtual bool isServer() = 0; ! virtual void idle(U32 timeDelta) = 0; ! ! void checkConnectionToMaster(U32 timeDelta); ! MasterServerConnection *getConnectionToMaster(); ! ! GameNetInterface *getNetInterface(); ! GridDatabase *getGridDatabase() { return &mDatabase; } ! ! GameType *getGameType(); ! void setGameType(GameType *theGameType); ! ! void processDeleteList(); ! }; ! ! class ServerGame : public Game ! { ! U32 mPlayerCount; ! U32 mMaxPlayers; ! const char *mHostName; ! public: ! U32 getPlayerCount() { return mPlayerCount; } ! U32 getMaxPlayers() { return mMaxPlayers; } ! const char *getHostName() { return mHostName; } ! ! void addClient(GameConnection *theConnection); ! void removeClient(GameConnection *theConnection); ! ServerGame(const Address &theBindAddress, U32 maxPlayers, const char *hostName); ! ! void controlObjectForClientKilled(GameConnection *theConnection); ! void loadLevel(const char *fileName); ! void processLevelLoadLine(int argc, const char **argv); ! bool isServer() { return true; } ! void idle(U32 timeDelta); ! }; ! ! class ClientGame : public Game ! { ! SafePtr<GameConnection> mConnectionToServer; // If this is a client game, this is the connection to the server ! public: ! ClientGame(const Address &bindAddress) : Game(bindAddress) {} ! ! bool hasValidControlObject(); ! bool isConnectedToServer(); ! ! void setConnectionToServer(... [truncated message content] |
From: Ben G. <s_a...@us...> - 2004-04-20 09:43:07
|
Update of /cvsroot/opentnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17571 Added Files: LICENSE.txt Log Message: Realized we should have the GPL in here somewhere. ;) --- NEW FILE: LICENSE.txt --- The GNU General Public License (GPL) Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. one line to give the program's name and a brief idea of what it does. Copyright (C) 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. 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 Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. |
From: John Q. <jm...@us...> - 2004-04-20 09:30:16
|
Update of /cvsroot/opentnl/tnl/openal/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15548 Added Files: libopenal.a Log Message: Added static openal library for use by zap program. --- NEW FILE: libopenal.a --- (This appears to be a binary file; contents omitted.) |
From: John Q. <jm...@us...> - 2004-04-20 09:28:35
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15237 Modified Files: Makefile point.h sfx.cpp Log Message: Added new files to makefile include #stdlib in point.h for atoi function Re-enabled sound on linux Index: point.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/point.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** point.h 20 Apr 2004 04:27:20 -0000 1.1 --- point.h 20 Apr 2004 09:28:26 -0000 1.2 *************** *** 28,31 **** --- 28,32 ---- #define _POINT_H_ #include <math.h> + #include <stdlib.h> namespace Zap Index: Makefile =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 20 Apr 2004 04:27:19 -0000 1.1 --- Makefile 20 Apr 2004 09:28:25 -0000 1.2 *************** *** 5,11 **** # Configuration # ! CC=g++ -g -I../tnl #-O2 OBJECTS_ZAP=\ game.o\ gameConnection.o\ --- 5,12 ---- # Configuration # ! CC=g++ -g -I../tnl -I../glut -I../openal -DTNL_DEBUG #-O2 OBJECTS_ZAP=\ + CTFGame.o\ game.o\ gameConnection.o\ *************** *** 13,19 **** --- 14,23 ---- gameNetInterface.o\ gameObject.o\ + gameType.o\ gridDB.o\ + item.o\ masterConnection.o\ ../master/masterInterface.o\ + moveObject.o\ UI.o\ UIGame.o\ *************** *** 23,26 **** --- 27,31 ---- projectile.o\ ship.o\ + sfx.o\ SweptEllipsoid.o\ sparkManager.o\ *************** *** 36,40 **** default: $(OBJECTS_ZAP) ! $(CC) -o zap $(OBJECTS_ZAP) ../tnl/libtnl.a ../libtomcrypt/libtomcrypt.a -lstdc++ -lGL -lGLU -lglut -lm ../master/masterInterface.o: --- 41,45 ---- default: $(OBJECTS_ZAP) ! $(CC) -o zap $(OBJECTS_ZAP) ../tnl/libtnl.a ../libtomcrypt/libtomcrypt.a ../openal/linux/libopenal.a -lpthread -lstdc++ -lGL -lGLU -lglut -lm ../master/masterInterface.o: Index: sfx.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sfx.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sfx.cpp 20 Apr 2004 08:51:29 -0000 1.2 --- sfx.cpp 20 Apr 2004 09:28:26 -0000 1.3 *************** *** 29,33 **** #include "tnlLog.h" ! #if defined (TNL_OS_WIN32) #include "alInclude.h" --- 29,33 ---- #include "tnlLog.h" ! #if defined (TNL_OS_WIN32) || defined (TNL_OS_LINUX) #include "alInclude.h" *************** *** 453,455 **** }; ! #endif \ No newline at end of file --- 453,455 ---- }; ! #endif |
From: John Q. <jm...@us...> - 2004-04-20 09:26:06
|
Update of /cvsroot/opentnl/tnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14956 Modified Files: Makefile Log Message: added certificate to makefile Index: Makefile =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 20 Apr 2004 04:27:18 -0000 1.1 --- Makefile 20 Apr 2004 09:25:57 -0000 1.2 *************** *** 15,18 **** --- 15,19 ---- bitStream.o\ byteBuffer.o\ + certificate.o\ clientPuzzle.o\ connectionStringTable.o\ |
From: John Q. <jm...@us...> - 2004-04-20 09:25:15
|
Update of /cvsroot/opentnl/tnl/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14767 Modified Files: Makefile client.cpp Log Message: Removed wxgui references in makefile and replaced with glut Fixed compile errors in client.cpp Index: client.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/test/client.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** client.cpp 20 Apr 2004 04:27:18 -0000 1.1 --- client.cpp 20 Apr 2004 09:25:06 -0000 1.2 *************** *** 7,10 **** --- 7,11 ---- #include "testGame.h" #include <stdio.h> + #include <string.h> class DedicatedServerLogConsumer : public LogConsumer *************** *** 23,27 **** S32 port = 28999; if(argc == 2) ! port = TNL::atoi(argv[1]); TestGame* theGame = new TestGame(false, Address(IPProtocol, Address::Any, port),Address(localBroadcastAddress)); for(;;) --- 24,28 ---- S32 port = 28999; if(argc == 2) ! port = atoi(argv[1]); TestGame* theGame = new TestGame(false, Address(IPProtocol, Address::Any, port),Address(localBroadcastAddress)); for(;;) Index: Makefile =================================================================== RCS file: /cvsroot/opentnl/tnl/test/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 20 Apr 2004 04:27:18 -0000 1.1 --- Makefile 20 Apr 2004 09:25:06 -0000 1.2 *************** *** 18,22 **** client.o ! OBJECTS_WXGUI=\ testGame.o\ testWindow.o \ --- 18,22 ---- client.o ! OBJECTS_TNLTEST=\ testGame.o\ testWindow.o \ *************** *** 33,40 **** $(CC) -o client $(OBJECTS_CLIENT) ../tnl/libtnl.a ../libtomcrypt/libtomcrypt.a -lstdc++ -lm ! wxgui: CFLAGS += `wx-config --cxxflags` ! wxgui: $(OBJECTS_WXGUI) ! @echo Building WX gui... ! $(CC) -o wxgui $(OBJECTS_WXGUI) ../tnl/libtnl.a ../libtomcrypt/libtomcrypt.a `wx-config --libs --gl-libs ` -lGL clean: ! rm -f $(OBJECTS_SERVER) $(OBJECTS_CLIENT) $(OBJECTS_WXGUI) server client wxgui --- 33,39 ---- $(CC) -o client $(OBJECTS_CLIENT) ../tnl/libtnl.a ../libtomcrypt/libtomcrypt.a -lstdc++ -lm ! tnltest: $(OBJECTS_TNLTEST) ! @echo Building TNLTest gui... ! $(CC) -o tnltest $(OBJECTS_TNLTEST) ../tnl/libtnl.a ../libtomcrypt/libtomcrypt.a -lGL -lGLU -lglut -lm clean: ! rm -f $(OBJECTS_SERVER) $(OBJECTS_CLIENT) $(OBJECTS_TNLTEST) server client tnltest |
From: John Q. <jm...@us...> - 2004-04-20 09:23:50
|
Update of /cvsroot/opentnl/tnl/openal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14536 Modified Files: al.h alInclude.h alc.h alu.h alut.h Log Message: Hacks to make creative openal headers compile on linux Index: alut.h =================================================================== RCS file: /cvsroot/opentnl/tnl/openal/alut.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** alut.h 20 Apr 2004 04:27:16 -0000 1.1 --- alut.h 20 Apr 2004 09:23:40 -0000 1.2 *************** *** 5,8 **** --- 5,15 ---- #define ALUTAPIENTRY __cdecl + #if defined(__linux) + #undef ALUTAPIENTRY + #define ALUTAPIENTRY + typedef ALCvoid ALCdevice; + typedef ALCvoid ALCcontext; + #endif + #include "al.h" #include "alu.h" Index: alc.h =================================================================== RCS file: /cvsroot/opentnl/tnl/openal/alc.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** alc.h 20 Apr 2004 04:27:16 -0000 1.1 --- alc.h 20 Apr 2004 09:23:40 -0000 1.2 *************** *** 30,34 **** #endif ! #ifndef ALC_NO_PROTOTYPES --- 30,41 ---- #endif ! // JMQ: hack for linux. we really shouldn't be using the creative ! // headers with the linux lib. ! #if defined(__linux) ! #undef ALCAPIENTRY ! #define ALCAPIENTRY ! typedef ALCvoid ALCdevice; ! typedef ALCvoid ALCcontext; ! #endif #ifndef ALC_NO_PROTOTYPES Index: al.h =================================================================== RCS file: /cvsroot/opentnl/tnl/openal/al.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** al.h 20 Apr 2004 04:27:16 -0000 1.1 --- al.h 20 Apr 2004 09:23:40 -0000 1.2 *************** *** 46,49 **** --- 46,58 ---- #endif + // JMQ: hack for linux. we really shouldn't be using the creative + // headers with the linux lib. + #if defined(__linux) + #undef ALAPIENTRY + #define ALAPIENTRY + typedef ALCvoid ALCdevice; + typedef ALCvoid ALCcontext; + #endif + #define OPENAL Index: alInclude.h =================================================================== RCS file: /cvsroot/opentnl/tnl/openal/alInclude.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** alInclude.h 20 Apr 2004 04:27:16 -0000 1.1 --- alInclude.h 20 Apr 2004 09:23:40 -0000 1.2 *************** *** 32,34 **** ! #endif \ No newline at end of file --- 32,34 ---- ! #endif Index: alu.h =================================================================== RCS file: /cvsroot/opentnl/tnl/openal/alu.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** alu.h 20 Apr 2004 04:27:16 -0000 1.1 --- alu.h 20 Apr 2004 09:23:40 -0000 1.2 *************** *** 5,8 **** --- 5,15 ---- #define ALUAPIENTRY __cdecl + #if defined(__linux) + #undef ALUAPIENTRY + #define ALUAPIENTRY + typedef ALCvoid ALCdevice; + typedef ALCvoid ALCcontext; + #endif + #define BUFFERSIZE 48000 #define FRACTIONBITS 14 |
From: John Q. <jm...@us...> - 2004-04-20 09:22:17
|
Update of /cvsroot/opentnl/tnl/openal/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14279/openal/linux Log Message: Directory /cvsroot/opentnl/tnl/openal/linux added to the repository |
From: Ben G. <s_a...@us...> - 2004-04-20 08:57:29
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9808/zap Modified Files: ship.cpp Log Message: Fixed flag mounting issues. Index: ship.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/ship.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ship.cpp 20 Apr 2004 08:51:29 -0000 1.2 --- ship.cpp 20 Apr 2004 08:57:21 -0000 1.3 *************** *** 271,274 **** --- 271,276 ---- U32 Ship::packUpdate(GhostConnection *connection, U32 updateMask, BitStream *stream) { + U32 retVal = 0; + if(stream->writeFlag(updateMask & InitialMask)) { *************** *** 289,296 **** --- 291,303 ---- stream->writeInt(index, GhostConnection::GhostIdBitSize); } + else + { + retVal |= InitialMask; + } } } stream->writeFlag(false); } + if(stream->writeFlag(updateMask & HealthMask)) stream->writeFloat(mHealth, 6); *************** *** 322,326 **** } } ! return 0; } --- 329,333 ---- } } ! return retVal; } |
From: Ben G. <s_a...@us...> - 2004-04-20 08:51:39
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8819/zap Modified Files: barrier.cpp moveObject.cpp sfx.cpp sfx.h ship.cpp Log Message: Updated docs. Added images for docs. Enhanced SFX, attempted to fix barrier issues. Index: moveObject.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/moveObject.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** moveObject.cpp 20 Apr 2004 04:27:20 -0000 1.1 --- moveObject.cpp 20 Apr 2004 08:51:29 -0000 1.2 *************** *** 28,31 **** --- 28,32 ---- #include "SweptEllipsoid.h" #include "sparkManager.h" + #include "sfx.h" namespace Zap *************** *** 297,300 **** --- 298,305 ---- if(scale > 0.5f) { + // Make a noise... + SFXHandle h = new SFXObject(SFXBounceWall, collisionPoint, Point()); + h->play(); + Color bumpC(scale/3, scale/3, scale); *************** *** 334,337 **** --- 339,346 ---- mMoveState[stateIndex].vel += collisionVector * (v1f - v1i); shipHit->mMoveState[stateIndex].vel += collisionVector * (v2f - v2i); + + SFXHandle h = new SFXObject(SFXBounceObject, shipHit->mMoveState[stateIndex].pos, Point()); + h->play(); + } Index: sfx.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sfx.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sfx.cpp 20 Apr 2004 04:27:20 -0000 1.1 --- sfx.cpp 20 Apr 2004 08:51:29 -0000 1.2 *************** *** 48,52 **** "teleport_in.wav", "teleport_out.wav", ! NULL, }; --- 48,53 ---- "teleport_in.wav", "teleport_out.wav", ! "bounce_wall.wav", ! "bounce_obj.wav", NULL, }; Index: barrier.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/barrier.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** barrier.cpp 20 Apr 2004 04:27:19 -0000 1.1 --- barrier.cpp 20 Apr 2004 08:51:29 -0000 1.2 *************** *** 206,209 **** --- 206,210 ---- } } + // if both are in, just go to the next edge. Index: sfx.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/sfx.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sfx.h 20 Apr 2004 04:27:20 -0000 1.1 --- sfx.h 20 Apr 2004 08:51:29 -0000 1.2 *************** *** 47,50 **** --- 47,52 ---- SFXTeleportIn, SFXTeleportOut, + SFXBounceWall, + SFXBounceObject, NumSFXBuffers }; Index: ship.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/ship.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ship.cpp 20 Apr 2004 04:27:20 -0000 1.1 --- ship.cpp 20 Apr 2004 08:51:29 -0000 1.2 *************** *** 175,179 **** float time = deltaT * 0.001; Point deltap = mMoveState[ActualState].pos - ! mMoveState[RenderState].pos; Point requestVel = deltap; --- 175,179 ---- float time = deltaT * 0.001; Point deltap = mMoveState[ActualState].pos - ! mMoveState[RenderState].pos; Point requestVel = deltap; *************** *** 211,244 **** else mMoveState[RenderState] = mMoveState[ActualState]; - /* - - U32 timeUsed = deltaT; - if(interpTime) - { - if(interpTime < timeUsed) - { - timeUsed -= interpTime; - interpTime = 0; - mMoveState[RenderState] = mMoveState[ActualState]; - } - else - { - Point totalDelta = mMoveState[ActualState].pos - - mMoveState[RenderState].pos; - mMoveState[RenderState].pos += - totalDelta * (timeUsed / F32(interpTime)); - - interpTime -= timeUsed; - timeUsed = 0; - } - } - if(timeUsed) - { - lastMove.time = timeUsed; - processMove(&lastMove, ActualState); - mMoveState[RenderState] = mMoveState[ActualState]; - }*/ updateExtent(); if(hasExploded && timeUntilRemove) --- 211,216 ---- *************** *** 424,428 **** { Rect queryRect(mMoveState[ActualState].pos, mMoveState[ActualState].pos); ! queryRect.expand(Point(500, 400)); fillVector.clear(); --- 396,400 ---- { Rect queryRect(mMoveState[ActualState].pos, mMoveState[ActualState].pos); ! queryRect.expand(Point(600, 500)); fillVector.clear(); *************** *** 476,491 **** Color ShipExplosionColors[NumShipExplosionColors] = { ! Color(1, 0, 0), ! Color(0.9, 0.5, 0), ! Color(1, 1, 1), ! Color(1, 1, 0), ! Color(1, 0, 0), ! Color(0.8, 1.0, 0), ! Color(1, 0.5, 0), ! Color(1, 1, 1), ! Color(1, 0, 0), ! Color(0.9, 0.5, 0), ! Color(1, 1, 1), ! Color(1, 1, 0), }; --- 448,463 ---- Color ShipExplosionColors[NumShipExplosionColors] = { ! Color(1, 0, 0), ! Color(0.9, 0.5, 0), ! Color(1, 1, 1), ! Color(1, 1, 0), ! Color(1, 0, 0), ! Color(0.8, 1.0, 0), ! Color(1, 0.5, 0), ! Color(1, 1, 1), ! Color(1, 0, 0), ! Color(0.9, 0.5, 0), ! Color(1, 1, 1), ! Color(1, 1, 0), }; |
From: Ben G. <s_a...@us...> - 2004-04-20 08:51:39
|
Update of /cvsroot/opentnl/tnl/docs/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8819/docs/images Added Files: layout_left_documentation.gif layout_left_downloads.gif layout_left_faq.gif layout_left_news.gif layout_left_sf.gif layout_left_tnl.gif layout_tnllogo.gif layout_topbar.gif opentnl.png spacer.gif testshot.png zapshot.png Log Message: Updated docs. Added images for docs. Enhanced SFX, attempted to fix barrier issues. --- NEW FILE: layout_left_documentation.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: spacer.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: layout_left_downloads.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: layout_left_tnl.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: layout_topbar.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: layout_left_news.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: opentnl.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: layout_left_sf.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: zapshot.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: layout_left_faq.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: testshot.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: layout_tnllogo.gif --- (This appears to be a binary file; contents omitted.) |
From: Ben G. <s_a...@us...> - 2004-04-20 08:51:39
|
Update of /cvsroot/opentnl/tnl/exe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8819/exe Added Files: bounce_obj.wav bounce_wall.WAV Log Message: Updated docs. Added images for docs. Enhanced SFX, attempted to fix barrier issues. --- NEW FILE: bounce_wall.WAV --- (This appears to be a binary file; contents omitted.) --- NEW FILE: bounce_obj.wav --- (This appears to be a binary file; contents omitted.) |
From: Ben G. <s_a...@us...> - 2004-04-20 08:51:38
|
Update of /cvsroot/opentnl/tnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8819/tnl Modified Files: tnl.overview.txt Log Message: Updated docs. Added images for docs. Enhanced SFX, attempted to fix barrier issues. Index: tnl.overview.txt =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnl.overview.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tnl.overview.txt 20 Apr 2004 04:27:18 -0000 1.1 --- tnl.overview.txt 20 Apr 2004 08:51:29 -0000 1.2 *************** *** 38,44 **** John Quigley - For his incredible patience as the Linux build master. ! Ben Garney - For his mad documentation skills and for usefully doing other projects that would have distracted Mark. ! Tom St. Denis - For his excellent libtomcrypt cryptographic library that is included in the TNL. The GLUT developers - For a cross-platform, easy-to-use OpenGL initialization, input and windowing API. --- 38,44 ---- John Quigley - For his incredible patience as the Linux build master. ! Ben Garney - For his mad documentation skills and for usefully doing other projects that would have distracted Mark - and sound effects. ! Tom St. Denis - For his excellent <a href="http://libtomcrypt.org/">libtomcrypt</a> cryptographic library that is included in the TNL. The GLUT developers - For a cross-platform, easy-to-use OpenGL initialization, input and windowing API. *************** *** 46,52 **** The OpenAL team - For a good, cross-platform audio API. ! Ari Juels and John Brainard for their work on Client Puzzles. ! Tuomas Aura, Pekka Nikander, and Jussipekka Leiwo of the Helsinki University of Technology for their work on DoS resistant Authentication with Client Puzzles. */ --- 46,52 ---- The OpenAL team - For a good, cross-platform audio API. ! Ari Juels and John Brainard - For their work on Client Puzzles. ! Tuomas Aura, Pekka Nikander, and Jussipekka Leiwo of the Helsinki University of Technology - For their work on DoS resistant Authentication with Client Puzzles. */ *************** *** 55,70 **** @section downloading Downloading the Torque Network Library ! @section building Compiling the Torque Network Library ! @section troubleshooting Troubleshooting and Questions ! Link to FAQ ! Link to Forums ! With that overview complete, you should now have a working version of the Torque Network Library and its sample programs up and running on your computer. */ --- 55,69 ---- @section downloading Downloading the Torque Network Library ! Please see <a href="http://www.opentnl.org/download.php">the download page</a> for information on how to get the source. @section building Compiling the Torque Network Library ! Once you have a copy of the source code, you may compile it by following the instructions in the Readme.html in the root of the source code. @section troubleshooting Troubleshooting and Questions ! For general information, <a href="http://www.opentnl.org/faq.php">please see our FAQ</a>. ! For bugs or other issues, you can get help from our <a href="http://lists.sourceforge.net/lists/listinfo/opentnl-general">mailing list</a>. Please check the archives first, as others may have had similar issues; if not, feel free to ask questions. */ *************** *** 282,286 **** */ ! /*! @page archoverview Torque Network Library Archtectural Overview The Torque Network Library is built in layers, each adding more functionality to the layer below it. --- 281,285 ---- */ ! /*! @page archoverview Torque Network Library Architectural Overview The Torque Network Library is built in layers, each adding more functionality to the layer below it. |
From: Ben G. <s_a...@us...> - 2004-04-20 08:51:38
|
Update of /cvsroot/opentnl/tnl/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8819/docs Modified Files: footer.html header.html Log Message: Updated docs. Added images for docs. Enhanced SFX, attempted to fix barrier issues. Index: footer.html =================================================================== RCS file: /cvsroot/opentnl/tnl/docs/footer.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** footer.html 20 Apr 2004 05:24:12 -0000 1.2 --- footer.html 20 Apr 2004 08:51:28 -0000 1.3 *************** *** 9,23 **** </TD> </TR> - <TR> - - <TD width="169" align="left" valign="top" bgcolor="#1A1B4D"> - <a href="http://www.opentnl.org/index.php"><IMG SRC="images/layout_left_news.gif" ALT="News" WIDTH=169 HEIGHT=30 border="0"></a> - <a href="http://sourceforge.net/projects/opentnl"><img src="images/layout_left_sf.gif" width="169" height="30" border="0" alt="SF.net Project"></a> - <a href="http://www.opentnl.org/faq.php"><IMG SRC="images/layout_left_faq.gif" ALT="Frequently Asked Questions" WIDTH=169 HEIGHT=30 border="0"></a> - <a href="http://opentnl.sourceforge.net/doxydocs/"><IMG SRC="images/layout_left_documentation.gif" ALT="Documentation" WIDTH=169 HEIGHT=30 border="0"></a> - <a href="http://www.opentnl.org/download.php"><IMG SRC="images/layout_left_downloads.gif" ALT="Downloads" WIDTH=169 HEIGHT=30 border="0"></a> - <p align="center"><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=opentnl&type=2" width="125" height="37" border="0" alt="SourceForge.net Logo" /></a></p></TD> - </TR> - </TABLE> </BODY> --- 9,12 ---- Index: header.html =================================================================== RCS file: /cvsroot/opentnl/tnl/docs/header.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** header.html 20 Apr 2004 05:24:12 -0000 1.2 --- header.html 20 Apr 2004 08:51:29 -0000 1.3 *************** *** 1,3 **** - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> --- 1,2 ---- *************** *** 8,22 **** <BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0> <TABLE WIDTH=100% height="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0> <TR> ! <TD width="169" height="47"> ! <IMG SRC="images/layout_tnllogo.gif" WIDTH=169 HEIGHT=47 ALT=""></TD> ! <TD width="100%" BGCOLOR=#322900> ! <IMG SRC="images/layout_topbar.gif" HEIGHT=47 ALT=""></TD> ! </TR> ! <TR> ! <TD width="169" height="20"> ! <IMG SRC="images/layout_left_tnl.gif" WIDTH=169 HEIGHT=20 ALT=""></TD> ! <TD ROWSPAN=2 align="left" valign="top"> <div class="header"> <div class="nav">$projectname $projectnumber - $date</div> --- 7,40 ---- <BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0> <TABLE WIDTH=100% height="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0> + <TR height="47"> + <TD width="169" height="46"><IMG SRC="images/layout_tnllogo.gif" WIDTH=169 HEIGHT=47 ALT=""></TD> + <TD width="100%" height="46" BGCOLOR=#322900 valign=top><IMG SRC="images/layout_topbar.gif" HEIGHT=47 ALT=""></TD> + </TR> <TR> ! <TD width="169" bgcolor="#1A1B4D" valign=top nowrap> ! <table WIDTH=169 BORDER=0 CELLPADDING=0 CELLSPACING=0 bgcolor="#1A1B4D"> ! <tr WIDTH=169 HEIGHT=20> ! <td WIDTH=169 HEIGHT=20 valign=top> ! <IMG SRC="images/layout_left_tnl.gif" WIDTH=169 HEIGHT=20 ALT=""> ! </td> ! </tr> ! <tr> ! <td> ! <a href="http://www.opentnl.org/index.php"><IMG SRC="images/layout_left_news.gif" ALT="News" WIDTH=169 HEIGHT=30 border="0"></a> ! <a href="http://sourceforge.net/projects/opentnl"><img src="images/layout_left_sf.gif" width="169" height="30" border="0" alt="SF.net Project"></a> ! <a href="http://www.opentnl.org/faq.php"><IMG SRC="images/layout_left_faq.gif" ALT="Frequently Asked Questions" WIDTH=169 HEIGHT=30 border="0"></a> ! <a href="http://opentnl.sourceforge.net/doxydocs/"><IMG SRC="images/layout_left_documentation.gif" ALT="Documentation" WIDTH=169 HEIGHT=30 border="0"></a> ! <a href="http://www.opentnl.org/download.php"><IMG SRC="images/layout_left_downloads.gif" ALT="Downloads" WIDTH=169 HEIGHT=30 border="0"></a> ! <p align="center"> ! <a href="http://sourceforge.net"> ! <img src="http://sourceforge.net/sflogo.php?group_id=opentnl&type=2" width="125" height="37" border="0" alt="SourceForge.net Logo" /> ! </a> ! </p> ! </td> ! </tr> ! </table> ! </TD> ! <TD width=100% align="left" valign="top"> <div class="header"> <div class="nav">$projectname $projectnumber - $date</div> |
From: Ben G. <s_a...@us...> - 2004-04-20 07:13:00
|
Update of /cvsroot/opentnl/tnl/docs/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24202/images Log Message: Directory /cvsroot/opentnl/tnl/docs/images added to the repository |
From: Ben G. <s_a...@us...> - 2004-04-20 05:24:22
|
Update of /cvsroot/opentnl/tnl/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6916/docs Modified Files: doco.css doxygen.html.cfg footer.html header.html Removed Files: tnl.css Log Message: Fixed various documentation issues. Index: doxygen.html.cfg =================================================================== RCS file: /cvsroot/opentnl/tnl/docs/doxygen.html.cfg,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** doxygen.html.cfg 20 Apr 2004 04:27:12 -0000 1.1 --- doxygen.html.cfg 20 Apr 2004 05:24:12 -0000 1.2 *************** *** 110,114 **** DISABLE_INDEX = YES ENUM_VALUES_PER_LINE = 1 ! GENERATE_TREEVIEW = YES TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- --- 110,114 ---- DISABLE_INDEX = YES ENUM_VALUES_PER_LINE = 1 ! GENERATE_TREEVIEW = NO TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- Index: footer.html =================================================================== RCS file: /cvsroot/opentnl/tnl/docs/footer.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** footer.html 20 Apr 2004 04:27:12 -0000 1.1 --- footer.html 20 Apr 2004 05:24:12 -0000 1.2 *************** *** 1,6 **** ! </div><div class="footer"> ! <b>All Rights Reserved GarageGames.com, Inc. 1999-2004</b><br> ! <small>Auto-magically Generated with <a href='http://www.doxygen.org' target='_blank'>Doxygen</a></small> </div> ! </body> ! </html> \ No newline at end of file --- 1,24 ---- ! </div> </div> ! <div class="footer"> ! Documentation hosted by <a href="http://sourceforge.net/">SourceForge.net</a><br> ! <small><b>All Rights Reserved GarageGames.com, Inc. 1999-2004</b></small><br> ! <small>Documentation auto-magically Generated with <a href='http://www.doxygen.org' target='_blank'>Doxygen $doxygenversion</a></small> ! </div> ! ! </TD> ! </TR> ! <TR> ! ! <TD width="169" align="left" valign="top" bgcolor="#1A1B4D"> ! <a href="http://www.opentnl.org/index.php"><IMG SRC="images/layout_left_news.gif" ALT="News" WIDTH=169 HEIGHT=30 border="0"></a> ! <a href="http://sourceforge.net/projects/opentnl"><img src="images/layout_left_sf.gif" width="169" height="30" border="0" alt="SF.net Project"></a> ! <a href="http://www.opentnl.org/faq.php"><IMG SRC="images/layout_left_faq.gif" ALT="Frequently Asked Questions" WIDTH=169 HEIGHT=30 border="0"></a> ! <a href="http://opentnl.sourceforge.net/doxydocs/"><IMG SRC="images/layout_left_documentation.gif" ALT="Documentation" WIDTH=169 HEIGHT=30 border="0"></a> ! <a href="http://www.opentnl.org/download.php"><IMG SRC="images/layout_left_downloads.gif" ALT="Downloads" WIDTH=169 HEIGHT=30 border="0"></a> ! <p align="center"><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=opentnl&type=2" width="125" height="37" border="0" alt="SourceForge.net Logo" /></a></p></TD> ! </TR> ! ! </TABLE> ! </BODY> ! </HTML> \ No newline at end of file Index: doco.css =================================================================== RCS file: /cvsroot/opentnl/tnl/docs/doco.css,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** doco.css 20 Apr 2004 04:27:12 -0000 1.1 --- doco.css 20 Apr 2004 05:24:12 -0000 1.2 *************** *** 1,2 **** --- 1,10 ---- + .article a { color: #8D0000; font-weight: bold; text-decoration: none } + .article a:visited { color: #AAAAAA; } + .article a:hover { text-decoration: underline; } + + a { color: #8D0000; font-weight: bold; text-decoration: none } + a:visited { color: #AAAAAA; } + a:hover { text-decoration: underline; } + a.code { color: #4444EE; *************** *** 139,147 **** div.header a:visited, div.footer a:visited { ! color: #436976; } ! div.header a:hover, div.footer a:hover { ! color: #B52010; } --- 147,156 ---- div.header a:visited, div.footer a:visited { ! color: #325865; } ! div.header a:hover, div.footer a:hover, a.anchor:hover { ! color: #A41005; ! text-decoration: none; } *************** *** 304,305 **** --- 313,382 ---- padding: 1px 0px 0px 8px; } + + + /* CSS Document */ + body { + background-color: #FFFFFF; + font-family: Arial, Helvetica, sans-serif; + font-size: 8pt; + color: Black; + } + + hr { + color: #333366; + background-color:transparent + } + i, em { font-style: italic; } + b, strong { font-weight:bold; } + .tiny { font-size: 7pt; } + .grey { + font-size: 8pt; + color: #909090; + background-color:transparent + } + + h1,h2,h3,h4 { color:black; background-color:transparent; font-weight:bold; margin-top:.25em;margin-bottom:.25em } + h1 { font-size:200%; } + h2 { font-size:150%; } + h3 { font-size:120%; } + h4 { font-size:100%; } + + + /* Article Style ----------------*/ + /*-------------------------------*/ + .article { + vertical-align:top; + text-align:left; + font-size: 12px; + color:black; + background-color: #FFFFFF; + padding-top: 4px; + padding-right: 4px; + padding-bottom: 0px; + padding-left: 4px; + } + + .article .title { + vertical-align:top; + background-color: #1A1B4D; + text-align:left; + font-weight: bold; + color: white; + padding:2px 2px 2px 6px; + } + + .article .body { + text-align:left; + border-width:2px; + border-style:solid; + border-color:#1A1B4D; + background-color: white; + color: black; + padding:3px; + } + + .article .freetext { + padding:5px; + font-size: 8px; + } + Index: header.html =================================================================== RCS file: /cvsroot/opentnl/tnl/docs/header.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** header.html 20 Apr 2004 04:27:12 -0000 1.1 --- header.html 20 Apr 2004 05:24:12 -0000 1.2 *************** *** 1,9 **** <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> ! <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> ! <title>$title</title> ! <link href="./doco.css" rel="stylesheet" type="text/css"> ! </head><body> <div class="header"> ! <div class="nav">TNL Project</div> <div class="index"> <a href="index.html">Main Page</a> --- 1,24 ---- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> ! <HTML> ! <HEAD> ! <TITLE>OpenTNL - $title</TITLE> ! <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> ! <link href="doco.css" rel="stylesheet" type="text/css"> ! </HEAD> ! <BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0> ! <TABLE WIDTH=100% height="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0> ! <TR> ! <TD width="169" height="47"> ! <IMG SRC="images/layout_tnllogo.gif" WIDTH=169 HEIGHT=47 ALT=""></TD> ! <TD width="100%" BGCOLOR=#322900> ! ! <IMG SRC="images/layout_topbar.gif" HEIGHT=47 ALT=""></TD> ! </TR> ! <TR> ! <TD width="169" height="20"> ! <IMG SRC="images/layout_left_tnl.gif" WIDTH=169 HEIGHT=20 ALT=""></TD> ! <TD ROWSPAN=2 align="left" valign="top"> <div class="header"> ! <div class="nav">$projectname $projectnumber - $date</div> <div class="index"> <a href="index.html">Main Page</a> *************** *** 16,18 **** </div> </div> ! <div class="maindox"> --- 31,38 ---- </div> </div> ! <div class="article"> ! <div class="title"> ! $title ! </div> ! ! <div class="body"> \ No newline at end of file --- tnl.css DELETED --- |
Update of /cvsroot/opentnl/tnl/libtomcrypt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31063/libtomcrypt Added Files: aes.c aes_tab.c authors base64.c bits.c blowfish.c cast5.c cbc.c cfb.c crypt.c crypt.pdf ctr.c des.c dh.c dh_sys.c dsa.c ecb.c ecc.c ecc_sys.c gf.c hash.c hmac.c keyring.c libtomcrypt.dsp libtomcrypt.vcproj makefile md2.c md4.c md5.c mem.c mpi.c mycrypt.h mycrypt_argchk.h mycrypt_cfg.h mycrypt_cipher.h mycrypt_custom.h mycrypt_gf.h mycrypt_hash.h mycrypt_kr.h mycrypt_macros.h mycrypt_misc.h mycrypt_pk.h mycrypt_prng.h noekeon.c ofb.c omac.c packet.c prime.c rc2.c rc4.c rc5.c rc6.c rmd128.c rmd160.c rsa.c rsa_sys.c safer+.c safer.c safer_tab.c sha1.c sha224.c sha256.c sha384.c sha512.c skipjack.c sprng.c strings.c tiger.c tommath.h twofish.c twofish_tab.c xtea.c yarrow.c Log Message: Initial commit. --- NEW FILE: sha512.c --- #include "mycrypt.h" #ifdef SHA512 const struct _hash_descriptor sha512_desc = { "sha512", 5, 64, 128, &sha512_init, &sha512_process, &sha512_done, &sha512_test }; /* the K array */ static const ulong64 K[80] = { CONST64(0x428a2f98d728ae22), CONST64(0x7137449123ef65cd), CONST64(0xb5c0fbcfec4d3b2f), CONST64(0xe9b5dba58189dbbc), CONST64(0x3956c25bf348b538), CONST64(0x59f111f1b605d019), CONST64(0x923f82a4af194f9b), CONST64(0xab1c5ed5da6d8118), CONST64(0xd807aa98a3030242), CONST64(0x12835b0145706fbe), CONST64(0x243185be4ee4b28c), CONST64(0x550c7dc3d5ffb4e2), CONST64(0x72be5d74f27b896f), CONST64(0x80deb1fe3b1696b1), CONST64(0x9bdc06a725c71235), CONST64(0xc19bf174cf692694), CONST64(0xe49b69c19ef14ad2), CONST64(0xefbe4786384f25e3), CONST64(0x0fc19dc68b8cd5b5), CONST64(0x240ca1cc77ac9c65), CONST64(0x2de92c6f592b0275), CONST64(0x4a7484aa6ea6e483), CONST64(0x5cb0a9dcbd41fbd4), CONST64(0x76f988da831153b5), CONST64(0x983e5152ee66dfab), CONST64(0xa831c66d2db43210), CONST64(0xb00327c898fb213f), CONST64(0xbf597fc7beef0ee4), CONST64(0xc6e00bf33da88fc2), CONST64(0xd5a79147930aa725), CONST64(0x06ca6351e003826f), CONST64(0x142929670a0e6e70), CONST64(0x27b70a8546d22ffc), CONST64(0x2e1b21385c26c926), CONST64(0x4d2c6dfc5ac42aed), CONST64(0x53380d139d95b3df), CONST64(0x650a73548baf63de), CONST64(0x766a0abb3c77b2a8), CONST64(0x81c2c92e47edaee6), CONST64(0x92722c851482353b), CONST64(0xa2bfe8a14cf10364), CONST64(0xa81a664bbc423001), CONST64(0xc24b8b70d0f89791), CONST64(0xc76c51a30654be30), CONST64(0xd192e819d6ef5218), CONST64(0xd69906245565a910), CONST64(0xf40e35855771202a), CONST64(0x106aa07032bbd1b8), CONST64(0x19a4c116b8d2d0c8), CONST64(0x1e376c085141ab53), CONST64(0x2748774cdf8eeb99), CONST64(0x34b0bcb5e19b48a8), CONST64(0x391c0cb3c5c95a63), CONST64(0x4ed8aa4ae3418acb), CONST64(0x5b9cca4f7763e373), CONST64(0x682e6ff3d6b2b8a3), CONST64(0x748f82ee5defb2fc), CONST64(0x78a5636f43172f60), CONST64(0x84c87814a1f0ab72), CONST64(0x8cc702081a6439ec), CONST64(0x90befffa23631e28), CONST64(0xa4506cebde82bde9), CONST64(0xbef9a3f7b2c67915), CONST64(0xc67178f2e372532b), CONST64(0xca273eceea26619c), CONST64(0xd186b8c721c0c207), CONST64(0xeada7dd6cde0eb1e), CONST64(0xf57d4f7fee6ed178), CONST64(0x06f067aa72176fba), CONST64(0x0a637dc5a2c898a6), CONST64(0x113f9804bef90dae), CONST64(0x1b710b35131c471b), CONST64(0x28db77f523047d84), CONST64(0x32caab7b40c72493), CONST64(0x3c9ebe0a15c9bebc), CONST64(0x431d67c49c100d4c), CONST64(0x4cc5d4becb3e42b6), CONST64(0x597f299cfc657e2a), CONST64(0x5fcb6fab3ad6faec), CONST64(0x6c44198c4a475817) }; /* Various logical functions */ #define Ch(x,y,z) (z ^ (x & (y ^ z))) #define Maj(x,y,z) (((x | y) & z) | (x & y)) #define S(x, n) ROR64((x),(n)) #define R(x, n) (((x)&CONST64(0xFFFFFFFFFFFFFFFF))>>((ulong64)n)) #define Sigma0(x) (S(x, 28) ^ S(x, 34) ^ S(x, 39)) #define Sigma1(x) (S(x, 14) ^ S(x, 18) ^ S(x, 41)) #define Gamma0(x) (S(x, 1) ^ S(x, 8) ^ R(x, 7)) #define Gamma1(x) (S(x, 19) ^ S(x, 61) ^ R(x, 6)) /* compress 1024-bits */ #ifdef CLEAN_STACK static void _sha512_compress(hash_state * md, unsigned char *buf) #else static void sha512_compress(hash_state * md, unsigned char *buf) #endif { ulong64 S[8], W[80], t0, t1; int i; _ARGCHK(md != NULL); /* copy state into S */ for (i = 0; i < 8; i++) { S[i] = md->sha512.state[i]; } /* copy the state into 1024-bits into W[0..15] */ for (i = 0; i < 16; i++) { LOAD64H(W[i], buf + (8*i)); } /* fill W[16..79] */ for (i = 16; i < 80; i++) { W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]; } /* Compress */ #ifdef SMALL_CODE for (i = 0; i < 80; i++) { t0 = S[7] + Sigma1(S[4]) + Ch(S[4], S[5], S[6]) + K[i] + W[i]; t1 = Sigma0(S[0]) + Maj(S[0], S[1], S[2]); S[7] = S[6]; S[6] = S[5]; S[5] = S[4]; S[4] = S[3] + t0; S[3] = S[2]; S[2] = S[1]; S[1] = S[0]; S[0] = t0 + t1; } #else #define RND(a,b,c,d,e,f,g,h,i) \ t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \ t1 = Sigma0(a) + Maj(a, b, c); \ d += t0; \ h = t0 + t1; for (i = 0; i < 80; i += 8) { RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i+0); RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],i+1); RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],i+2); RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],i+3); RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],i+4); RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],i+5); RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],i+6); RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],i+7); } #endif /* feedback */ for (i = 0; i < 8; i++) { md->sha512.state[i] = md->sha512.state[i] + S[i]; } } /* compress 1024-bits */ #ifdef CLEAN_STACK static void sha512_compress(hash_state * md, unsigned char *buf) { _sha512_compress(md, buf); burn_stack(sizeof(ulong64) * 90 + sizeof(int)); } #endif /* init the sha512 state */ void sha512_init(hash_state * md) { _ARGCHK(md != NULL); md->sha512.curlen = 0; md->sha512.length = 0; md->sha512.state[0] = CONST64(0x6a09e667f3bcc908); md->sha512.state[1] = CONST64(0xbb67ae8584caa73b); md->sha512.state[2] = CONST64(0x3c6ef372fe94f82b); md->sha512.state[3] = CONST64(0xa54ff53a5f1d36f1); md->sha512.state[4] = CONST64(0x510e527fade682d1); md->sha512.state[5] = CONST64(0x9b05688c2b3e6c1f); md->sha512.state[6] = CONST64(0x1f83d9abfb41bd6b); md->sha512.state[7] = CONST64(0x5be0cd19137e2179); } HASH_PROCESS(sha512_process, sha512_compress, sha512, 128) int sha512_done(hash_state * md, unsigned char *hash) { int i; _ARGCHK(md != NULL); _ARGCHK(hash != NULL); if (md->sha512.curlen >= sizeof(md->sha512.buf)) { return CRYPT_INVALID_ARG; } /* increase the length of the message */ md->sha512.length += md->sha512.curlen * CONST64(8); /* append the '1' bit */ md->sha512.buf[md->sha512.curlen++] = (unsigned char)0x80; /* if the length is currently above 112 bytes we append zeros * then compress. Then we can fall back to padding zeros and length * encoding like normal. */ if (md->sha512.curlen > 112) { while (md->sha512.curlen < 128) { md->sha512.buf[md->sha512.curlen++] = (unsigned char)0; } sha512_compress(md, md->sha512.buf); md->sha512.curlen = 0; } /* pad upto 120 bytes of zeroes * note: that from 112 to 120 is the 64 MSB of the length. We assume that you won't hash * > 2^64 bits of data... :-) */ while (md->sha512.curlen < 120) { md->sha512.buf[md->sha512.curlen++] = (unsigned char)0; } /* store length */ STORE64H(md->sha512.length, md->sha512.buf+120); sha512_compress(md, md->sha512.buf); /* copy output */ for (i = 0; i < 8; i++) { STORE64H(md->sha512.state[i], hash+(8*i)); } #ifdef CLEAN_STACK zeromem(md, sizeof(hash_state)); #endif return CRYPT_OK; } int sha512_test(void) { #ifndef LTC_TEST return CRYPT_NOP; #else static const struct { char *msg; unsigned char hash[64]; } tests[] = { { "abc", { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31, 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a, 0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8, 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd, 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f } }, { "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", { 0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda, 0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f, 0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1, 0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18, 0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4, 0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a, 0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54, 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09 } }, }; int i; unsigned char tmp[64]; hash_state md; for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { sha512_init(&md); sha512_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); sha512_done(&md, tmp); if (memcmp(tmp, tests[i].hash, 64) != 0) { return CRYPT_FAIL_TESTVECTOR; } } return CRYPT_OK; #endif } #ifdef SHA384 #include "sha384.c" #endif #endif --- NEW FILE: twofish_tab.c --- #ifdef TWOFISH_TABLES /* pre generated 8x8 tables from the four 4x4s */ static const unsigned char SBOX[2][256] = { { 0xa9, 0x67, 0xb3, 0xe8, 0x04, 0xfd, 0xa3, 0x76, 0x9a, 0x92, 0x80, 0x78, 0xe4, 0xdd, 0xd1, 0x38, 0x0d, 0xc6, 0x35, 0x98, 0x18, 0xf7, 0xec, 0x6c, 0x43, 0x75, 0x37, 0x26, 0xfa, 0x13, 0x94, 0x48, 0xf2, 0xd0, 0x8b, 0x30, 0x84, 0x54, 0xdf, 0x23, 0x19, 0x5b, 0x3d, 0x59, 0xf3, 0xae, 0xa2, 0x82, 0x63, 0x01, 0x83, 0x2e, 0xd9, 0x51, 0x9b, 0x7c, 0xa6, 0xeb, 0xa5, 0xbe, 0x16, 0x0c, 0xe3, 0x61, 0xc0, 0x8c, 0x3a, 0xf5, 0x73, 0x2c, 0x25, 0x0b, 0xbb, 0x4e, 0x89, 0x6b, 0x53, 0x6a, 0xb4, 0xf1, 0xe1, 0xe6, 0xbd, 0x45, 0xe2, 0xf4, 0xb6, 0x66, 0xcc, 0x95, 0x03, 0x56, 0xd4, 0x1c, 0x1e, 0xd7, 0xfb, 0xc3, 0x8e, 0xb5, 0xe9, 0xcf, 0xbf, 0xba, 0xea, 0x77, 0x39, 0xaf, 0x33, 0xc9, 0x62, 0x71, 0x81, 0x79, 0x09, 0xad, 0x24, 0xcd, 0xf9, 0xd8, 0xe5, 0xc5, 0xb9, 0x4d, 0x44, 0x08, 0x86, 0xe7, 0xa1, 0x1d, 0xaa, 0xed, 0x06, 0x70, 0xb2, 0xd2, 0x41, 0x7b, 0xa0, 0x11, 0x31, 0xc2, 0x27, 0x90, 0x20, 0xf6, 0x60, 0xff, 0x96, 0x5c, 0xb1, 0xab, 0x9e, 0x9c, 0x52, 0x1b, 0x5f, 0x93, 0x0a, 0xef, 0x91, 0x85, 0x49, 0xee, 0x2d, 0x4f, 0x8f, 0x3b, 0x47, 0x87, 0x6d, 0x46, 0xd6, 0x3e, 0x69, 0x64, 0x2a, 0xce, 0xcb, 0x2f, 0xfc, 0x97, 0x05, 0x7a, 0xac, 0x7f, 0xd5, 0x1a, 0x4b, 0x0e, 0xa7, 0x5a, 0x28, 0x14, 0x3f, 0x29, 0x88, 0x3c, 0x4c, 0x02, 0xb8, 0xda, 0xb0, 0x17, 0x55, 0x1f, 0x8a, 0x7d, 0x57, 0xc7, 0x8d, 0x74, 0xb7, 0xc4, 0x9f, 0x72, 0x7e, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, 0x6e, 0x50, 0xde, 0x68, 0x65, 0xbc, 0xdb, 0xf8, 0xc8, 0xa8, 0x2b, 0x40, 0xdc, 0xfe, 0x32, 0xa4, 0xca, 0x10, 0x21, 0xf0, 0xd3, 0x5d, 0x0f, 0x00, 0x6f, 0x9d, 0x36, 0x42, 0x4a, 0x5e, 0xc1, 0xe0}, { 0x75, 0xf3, 0xc6, 0xf4, 0xdb, 0x7b, 0xfb, 0xc8, 0x4a, 0xd3, 0xe6, 0x6b, 0x45, 0x7d, 0xe8, 0x4b, 0xd6, 0x32, 0xd8, 0xfd, 0x37, 0x71, 0xf1, 0xe1, 0x30, 0x0f, 0xf8, 0x1b, 0x87, 0xfa, 0x06, 0x3f, 0x5e, 0xba, 0xae, 0x5b, 0x8a, 0x00, 0xbc, 0x9d, 0x6d, 0xc1, 0xb1, 0x0e, 0x80, 0x5d, 0xd2, 0xd5, 0xa0, 0x84, 0x07, 0x14, 0xb5, 0x90, 0x2c, 0xa3, 0xb2, 0x73, 0x4c, 0x54, 0x92, 0x74, 0x36, 0x51, 0x38, 0xb0, 0xbd, 0x5a, 0xfc, 0x60, 0x62, 0x96, 0x6c, 0x42, 0xf7, 0x10, 0x7c, 0x28, 0x27, 0x8c, 0x13, 0x95, 0x9c, 0xc7, 0x24, 0x46, 0x3b, 0x70, 0xca, 0xe3, 0x85, 0xcb, 0x11, 0xd0, 0x93, 0xb8, 0xa6, 0x83, 0x20, 0xff, 0x9f, 0x77, 0xc3, 0xcc, 0x03, 0x6f, 0x08, 0xbf, 0x40, 0xe7, 0x2b, 0xe2, 0x79, 0x0c, 0xaa, 0x82, 0x41, 0x3a, 0xea, 0xb9, 0xe4, 0x9a, 0xa4, 0x97, 0x7e, 0xda, 0x7a, 0x17, 0x66, 0x94, 0xa1, 0x1d, 0x3d, 0xf0, 0xde, 0xb3, 0x0b, 0x72, 0xa7, 0x1c, 0xef, 0xd1, 0x53, 0x3e, 0x8f, 0x33, 0x26, 0x5f, 0xec, 0x76, 0x2a, 0x49, 0x81, 0x88, 0xee, 0x21, 0xc4, 0x1a, 0xeb, 0xd9, 0xc5, 0x39, 0x99, 0xcd, 0xad, 0x31, 0x8b, 0x01, 0x18, 0x23, 0xdd, 0x1f, 0x4e, 0x2d, 0xf9, 0x48, 0x4f, 0xf2, 0x65, 0x8e, 0x78, 0x5c, 0x58, 0x19, 0x8d, 0xe5, 0x98, 0x57, 0x67, 0x7f, 0x05, 0x64, 0xaf, 0x63, 0xb6, 0xfe, 0xf5, 0xb7, 0x3c, 0xa5, 0xce, 0xe9, 0x68, 0x44, 0xe0, 0x4d, 0x43, 0x69, 0x29, 0x2e, 0xac, 0x15, 0x59, 0xa8, 0x0a, 0x9e, 0x6e, 0x47, 0xdf, 0x34, 0x35, 0x6a, 0xcf, 0xdc, 0x22, 0xc9, 0xc0, 0x9b, 0x89, 0xd4, 0xed, 0xab, 0x12, 0xa2, 0x0d, 0x52, 0xbb, 0x02, 0x2f, 0xa9, 0xd7, 0x61, 0x1e, 0xb4, 0x50, 0x04, 0xf6, 0xc2, 0x16, 0x25, 0x86, 0x56, 0x55, 0x09, 0xbe, 0x91} }; /* the 4x4 MDS in a nicer format */ static const ulong32 mds_tab[4][256] = { { 0x00000000UL, 0xefef5b01UL, 0xb7b7b602UL, 0x5858ed03UL, 0x07070504UL, 0xe8e85e05UL, 0xb0b0b306UL, 0x5f5fe807UL, 0x0e0e0a08UL, 0xe1e15109UL, 0xb9b9bc0aUL, 0x5656e70bUL, 0x09090f0cUL, 0xe6e6540dUL, 0xbebeb90eUL, 0x5151e20fUL, 0x1c1c1410UL, 0xf3f34f11UL, 0xababa212UL, 0x4444f913UL, 0x1b1b1114UL, 0xf4f44a15UL, 0xacaca716UL, 0x4343fc17UL, 0x12121e18UL, 0xfdfd4519UL, 0xa5a5a81aUL, 0x4a4af31bUL, 0x15151b1cUL, 0xfafa401dUL, 0xa2a2ad1eUL, 0x4d4df61fUL, 0x38382820UL, 0xd7d77321UL, 0x8f8f9e22UL, 0x6060c523UL, 0x3f3f2d24UL, 0xd0d07625UL, 0x88889b26UL, 0x6767c027UL, 0x36362228UL, 0xd9d97929UL, 0x8181942aUL, 0x6e6ecf2bUL, 0x3131272cUL, 0xdede7c2dUL, 0x8686912eUL, 0x6969ca2fUL, 0x24243c30UL, 0xcbcb6731UL, 0x93938a32UL, 0x7c7cd133UL, 0x23233934UL, 0xcccc6235UL, 0x94948f36UL, 0x7b7bd437UL, 0x2a2a3638UL, 0xc5c56d39UL, 0x9d9d803aUL, 0x7272db3bUL, 0x2d2d333cUL, 0xc2c2683dUL, 0x9a9a853eUL, 0x7575de3fUL, 0x70705040UL, 0x9f9f0b41UL, 0xc7c7e642UL, 0x2828bd43UL, 0x77775544UL, 0x98980e45UL, 0xc0c0e346UL, 0x2f2fb847UL, 0x7e7e5a48UL, 0x91910149UL, 0xc9c9ec4aUL, 0x2626b74bUL, 0x79795f4cUL, 0x9696044dUL, 0xcecee94eUL, 0x2121b24fUL, 0x6c6c4450UL, 0x83831f51UL, 0xdbdbf252UL, 0x3434a953UL, 0x6b6b4154UL, 0x84841a55UL, 0xdcdcf756UL, 0x3333ac57UL, 0x62624e58UL, 0x8d8d1559UL, 0xd5d5f85aUL, 0x3a3aa35bUL, 0x65654b5cUL, 0x8a8a105dUL, 0xd2d2fd5eUL, 0x3d3da65fUL, 0x48487860UL, 0xa7a72361UL, 0xffffce62UL, 0x10109563UL, 0x4f4f7d64UL, 0xa0a02665UL, 0xf8f8cb66UL, 0x17179067UL, 0x46467268UL, 0xa9a92969UL, 0xf1f1c46aUL, 0x1e1e9f6bUL, 0x4141776cUL, 0xaeae2c6dUL, 0xf6f6c16eUL, 0x19199a6fUL, 0x54546c70UL, 0xbbbb3771UL, 0xe3e3da72UL, 0x0c0c8173UL, 0x53536974UL, 0xbcbc3275UL, 0xe4e4df76UL, 0x0b0b8477UL, 0x5a5a6678UL, 0xb5b53d79UL, 0xededd07aUL, 0x02028b7bUL, 0x5d5d637cUL, 0xb2b2387dUL, 0xeaead57eUL, 0x05058e7fUL, 0xe0e0a080UL, 0x0f0ffb81UL, 0x57571682UL, 0xb8b84d83UL, 0xe7e7a584UL, 0x0808fe85UL, 0x50501386UL, 0xbfbf4887UL, 0xeeeeaa88UL, 0x0101f189UL, 0x59591c8aUL, 0xb6b6478bUL, 0xe9e9af8cUL, 0x0606f48dUL, 0x5e5e198eUL, 0xb1b1428fUL, 0xfcfcb490UL, 0x1313ef91UL, 0x4b4b0292UL, 0xa4a45993UL, 0xfbfbb194UL, 0x1414ea95UL, 0x4c4c0796UL, 0xa3a35c97UL, 0xf2f2be98UL, 0x1d1de599UL, 0x4545089aUL, 0xaaaa539bUL, 0xf5f5bb9cUL, 0x1a1ae09dUL, 0x42420d9eUL, 0xadad569fUL, 0xd8d888a0UL, 0x3737d3a1UL, 0x6f6f3ea2UL, 0x808065a3UL, 0xdfdf8da4UL, 0x3030d6a5UL, 0x68683ba6UL, 0x878760a7UL, 0xd6d682a8UL, 0x3939d9a9UL, 0x616134aaUL, 0x8e8e6fabUL, 0xd1d187acUL, 0x3e3edcadUL, 0x666631aeUL, 0x89896aafUL, 0xc4c49cb0UL, 0x2b2bc7b1UL, 0x73732ab2UL, 0x9c9c71b3UL, 0xc3c399b4UL, 0x2c2cc2b5UL, 0x74742fb6UL, 0x9b9b74b7UL, 0xcaca96b8UL, 0x2525cdb9UL, 0x7d7d20baUL, 0x92927bbbUL, 0xcdcd93bcUL, 0x2222c8bdUL, 0x7a7a25beUL, 0x95957ebfUL, 0x9090f0c0UL, 0x7f7fabc1UL, 0x272746c2UL, 0xc8c81dc3UL, 0x9797f5c4UL, 0x7878aec5UL, 0x202043c6UL, 0xcfcf18c7UL, 0x9e9efac8UL, 0x7171a1c9UL, 0x29294ccaUL, 0xc6c617cbUL, 0x9999ffccUL, 0x7676a4cdUL, 0x2e2e49ceUL, 0xc1c112cfUL, 0x8c8ce4d0UL, 0x6363bfd1UL, 0x3b3b52d2UL, 0xd4d409d3UL, 0x8b8be1d4UL, 0x6464bad5UL, 0x3c3c57d6UL, 0xd3d30cd7UL, 0x8282eed8UL, 0x6d6db5d9UL, 0x353558daUL, 0xdada03dbUL, 0x8585ebdcUL, 0x6a6ab0ddUL, 0x32325ddeUL, 0xdddd06dfUL, 0xa8a8d8e0UL, 0x474783e1UL, 0x1f1f6ee2UL, 0xf0f035e3UL, 0xafafdde4UL, 0x404086e5UL, 0x18186be6UL, 0xf7f730e7UL, 0xa6a6d2e8UL, 0x494989e9UL, 0x111164eaUL, 0xfefe3febUL, 0xa1a1d7ecUL, 0x4e4e8cedUL, 0x161661eeUL, 0xf9f93aefUL, 0xb4b4ccf0UL, 0x5b5b97f1UL, 0x03037af2UL, 0xecec21f3UL, 0xb3b3c9f4UL, 0x5c5c92f5UL, 0x04047ff6UL, 0xebeb24f7UL, 0xbabac6f8UL, 0x55559df9UL, 0x0d0d70faUL, 0xe2e22bfbUL, 0xbdbdc3fcUL, 0x525298fdUL, 0x0a0a75feUL, 0xe5e52effUL }, { 0x00000000UL, 0x015befefUL, 0x02b6b7b7UL, 0x03ed5858UL, 0x04050707UL, 0x055ee8e8UL, 0x06b3b0b0UL, 0x07e85f5fUL, 0x080a0e0eUL, 0x0951e1e1UL, 0x0abcb9b9UL, 0x0be75656UL, 0x0c0f0909UL, 0x0d54e6e6UL, 0x0eb9bebeUL, 0x0fe25151UL, 0x10141c1cUL, 0x114ff3f3UL, 0x12a2ababUL, 0x13f94444UL, 0x14111b1bUL, 0x154af4f4UL, 0x16a7acacUL, 0x17fc4343UL, 0x181e1212UL, 0x1945fdfdUL, 0x1aa8a5a5UL, 0x1bf34a4aUL, 0x1c1b1515UL, 0x1d40fafaUL, 0x1eada2a2UL, 0x1ff64d4dUL, 0x20283838UL, 0x2173d7d7UL, 0x229e8f8fUL, 0x23c56060UL, 0x242d3f3fUL, 0x2576d0d0UL, 0x269b8888UL, 0x27c06767UL, 0x28223636UL, 0x2979d9d9UL, 0x2a948181UL, 0x2bcf6e6eUL, 0x2c273131UL, 0x2d7cdedeUL, 0x2e918686UL, 0x2fca6969UL, 0x303c2424UL, 0x3167cbcbUL, 0x328a9393UL, 0x33d17c7cUL, 0x34392323UL, 0x3562ccccUL, 0x368f9494UL, 0x37d47b7bUL, 0x38362a2aUL, 0x396dc5c5UL, 0x3a809d9dUL, 0x3bdb7272UL, 0x3c332d2dUL, 0x3d68c2c2UL, 0x3e859a9aUL, 0x3fde7575UL, 0x40507070UL, 0x410b9f9fUL, 0x42e6c7c7UL, 0x43bd2828UL, 0x44557777UL, 0x450e9898UL, 0x46e3c0c0UL, 0x47b82f2fUL, 0x485a7e7eUL, 0x49019191UL, 0x4aecc9c9UL, 0x4bb72626UL, 0x4c5f7979UL, 0x4d049696UL, 0x4ee9ceceUL, 0x4fb22121UL, 0x50446c6cUL, 0x511f8383UL, 0x52f2dbdbUL, 0x53a93434UL, 0x54416b6bUL, 0x551a8484UL, 0x56f7dcdcUL, 0x57ac3333UL, 0x584e6262UL, 0x59158d8dUL, 0x5af8d5d5UL, 0x5ba33a3aUL, 0x5c4b6565UL, 0x5d108a8aUL, 0x5efdd2d2UL, 0x5fa63d3dUL, 0x60784848UL, 0x6123a7a7UL, 0x62ceffffUL, 0x63951010UL, 0x647d4f4fUL, 0x6526a0a0UL, 0x66cbf8f8UL, 0x67901717UL, 0x68724646UL, 0x6929a9a9UL, 0x6ac4f1f1UL, 0x6b9f1e1eUL, 0x6c774141UL, 0x6d2caeaeUL, 0x6ec1f6f6UL, 0x6f9a1919UL, 0x706c5454UL, 0x7137bbbbUL, 0x72dae3e3UL, 0x73810c0cUL, 0x74695353UL, 0x7532bcbcUL, 0x76dfe4e4UL, 0x77840b0bUL, 0x78665a5aUL, 0x793db5b5UL, 0x7ad0ededUL, 0x7b8b0202UL, 0x7c635d5dUL, 0x7d38b2b2UL, 0x7ed5eaeaUL, 0x7f8e0505UL, 0x80a0e0e0UL, 0x81fb0f0fUL, 0x82165757UL, 0x834db8b8UL, 0x84a5e7e7UL, 0x85fe0808UL, 0x86135050UL, 0x8748bfbfUL, 0x88aaeeeeUL, 0x89f10101UL, 0x8a1c5959UL, 0x8b47b6b6UL, 0x8cafe9e9UL, 0x8df40606UL, 0x8e195e5eUL, 0x8f42b1b1UL, 0x90b4fcfcUL, 0x91ef1313UL, 0x92024b4bUL, 0x9359a4a4UL, 0x94b1fbfbUL, 0x95ea1414UL, 0x96074c4cUL, 0x975ca3a3UL, 0x98bef2f2UL, 0x99e51d1dUL, 0x9a084545UL, 0x9b53aaaaUL, 0x9cbbf5f5UL, 0x9de01a1aUL, 0x9e0d4242UL, 0x9f56adadUL, 0xa088d8d8UL, 0xa1d33737UL, 0xa23e6f6fUL, 0xa3658080UL, 0xa48ddfdfUL, 0xa5d63030UL, 0xa63b6868UL, 0xa7608787UL, 0xa882d6d6UL, 0xa9d93939UL, 0xaa346161UL, 0xab6f8e8eUL, 0xac87d1d1UL, 0xaddc3e3eUL, 0xae316666UL, 0xaf6a8989UL, 0xb09cc4c4UL, 0xb1c72b2bUL, 0xb22a7373UL, 0xb3719c9cUL, 0xb499c3c3UL, 0xb5c22c2cUL, 0xb62f7474UL, 0xb7749b9bUL, 0xb896cacaUL, 0xb9cd2525UL, 0xba207d7dUL, 0xbb7b9292UL, 0xbc93cdcdUL, 0xbdc82222UL, 0xbe257a7aUL, 0xbf7e9595UL, 0xc0f09090UL, 0xc1ab7f7fUL, 0xc2462727UL, 0xc31dc8c8UL, 0xc4f59797UL, 0xc5ae7878UL, 0xc6432020UL, 0xc718cfcfUL, 0xc8fa9e9eUL, 0xc9a17171UL, 0xca4c2929UL, 0xcb17c6c6UL, 0xccff9999UL, 0xcda47676UL, 0xce492e2eUL, 0xcf12c1c1UL, 0xd0e48c8cUL, 0xd1bf6363UL, 0xd2523b3bUL, 0xd309d4d4UL, 0xd4e18b8bUL, 0xd5ba6464UL, 0xd6573c3cUL, 0xd70cd3d3UL, 0xd8ee8282UL, 0xd9b56d6dUL, 0xda583535UL, 0xdb03dadaUL, 0xdceb8585UL, 0xddb06a6aUL, 0xde5d3232UL, 0xdf06ddddUL, 0xe0d8a8a8UL, 0xe1834747UL, 0xe26e1f1fUL, 0xe335f0f0UL, 0xe4ddafafUL, 0xe5864040UL, 0xe66b1818UL, 0xe730f7f7UL, 0xe8d2a6a6UL, 0xe9894949UL, 0xea641111UL, 0xeb3ffefeUL, 0xecd7a1a1UL, 0xed8c4e4eUL, 0xee611616UL, 0xef3af9f9UL, 0xf0ccb4b4UL, 0xf1975b5bUL, 0xf27a0303UL, 0xf321ececUL, 0xf4c9b3b3UL, 0xf5925c5cUL, 0xf67f0404UL, 0xf724ebebUL, 0xf8c6babaUL, 0xf99d5555UL, 0xfa700d0dUL, 0xfb2be2e2UL, 0xfcc3bdbdUL, 0xfd985252UL, 0xfe750a0aUL, 0xff2ee5e5UL }, { 0x00000000UL, 0xef01ef5bUL, 0xb702b7b6UL, 0x580358edUL, 0x07040705UL, 0xe805e85eUL, 0xb006b0b3UL, 0x5f075fe8UL, 0x0e080e0aUL, 0xe109e151UL, 0xb90ab9bcUL, 0x560b56e7UL, 0x090c090fUL, 0xe60de654UL, 0xbe0ebeb9UL, 0x510f51e2UL, 0x1c101c14UL, 0xf311f34fUL, 0xab12aba2UL, 0x441344f9UL, 0x1b141b11UL, 0xf415f44aUL, 0xac16aca7UL, 0x431743fcUL, 0x1218121eUL, 0xfd19fd45UL, 0xa51aa5a8UL, 0x4a1b4af3UL, 0x151c151bUL, 0xfa1dfa40UL, 0xa21ea2adUL, 0x4d1f4df6UL, 0x38203828UL, 0xd721d773UL, 0x8f228f9eUL, 0x602360c5UL, 0x3f243f2dUL, 0xd025d076UL, 0x8826889bUL, 0x672767c0UL, 0x36283622UL, 0xd929d979UL, 0x812a8194UL, 0x6e2b6ecfUL, 0x312c3127UL, 0xde2dde7cUL, 0x862e8691UL, 0x692f69caUL, 0x2430243cUL, 0xcb31cb67UL, 0x9332938aUL, 0x7c337cd1UL, 0x23342339UL, 0xcc35cc62UL, 0x9436948fUL, 0x7b377bd4UL, 0x2a382a36UL, 0xc539c56dUL, 0x9d3a9d80UL, 0x723b72dbUL, 0x2d3c2d33UL, 0xc23dc268UL, 0x9a3e9a85UL, 0x753f75deUL, 0x70407050UL, 0x9f419f0bUL, 0xc742c7e6UL, 0x284328bdUL, 0x77447755UL, 0x9845980eUL, 0xc046c0e3UL, 0x2f472fb8UL, 0x7e487e5aUL, 0x91499101UL, 0xc94ac9ecUL, 0x264b26b7UL, 0x794c795fUL, 0x964d9604UL, 0xce4ecee9UL, 0x214f21b2UL, 0x6c506c44UL, 0x8351831fUL, 0xdb52dbf2UL, 0x345334a9UL, 0x6b546b41UL, 0x8455841aUL, 0xdc56dcf7UL, 0x335733acUL, 0x6258624eUL, 0x8d598d15UL, 0xd55ad5f8UL, 0x3a5b3aa3UL, 0x655c654bUL, 0x8a5d8a10UL, 0xd25ed2fdUL, 0x3d5f3da6UL, 0x48604878UL, 0xa761a723UL, 0xff62ffceUL, 0x10631095UL, 0x4f644f7dUL, 0xa065a026UL, 0xf866f8cbUL, 0x17671790UL, 0x46684672UL, 0xa969a929UL, 0xf16af1c4UL, 0x1e6b1e9fUL, 0x416c4177UL, 0xae6dae2cUL, 0xf66ef6c1UL, 0x196f199aUL, 0x5470546cUL, 0xbb71bb37UL, 0xe372e3daUL, 0x0c730c81UL, 0x53745369UL, 0xbc75bc32UL, 0xe476e4dfUL, 0x0b770b84UL, 0x5a785a66UL, 0xb579b53dUL, 0xed7aedd0UL, 0x027b028bUL, 0x5d7c5d63UL, 0xb27db238UL, 0xea7eead5UL, 0x057f058eUL, 0xe080e0a0UL, 0x0f810ffbUL, 0x57825716UL, 0xb883b84dUL, 0xe784e7a5UL, 0x088508feUL, 0x50865013UL, 0xbf87bf48UL, 0xee88eeaaUL, 0x018901f1UL, 0x598a591cUL, 0xb68bb647UL, 0xe98ce9afUL, 0x068d06f4UL, 0x5e8e5e19UL, 0xb18fb142UL, 0xfc90fcb4UL, 0x139113efUL, 0x4b924b02UL, 0xa493a459UL, 0xfb94fbb1UL, 0x149514eaUL, 0x4c964c07UL, 0xa397a35cUL, 0xf298f2beUL, 0x1d991de5UL, 0x459a4508UL, 0xaa9baa53UL, 0xf59cf5bbUL, 0x1a9d1ae0UL, 0x429e420dUL, 0xad9fad56UL, 0xd8a0d888UL, 0x37a137d3UL, 0x6fa26f3eUL, 0x80a38065UL, 0xdfa4df8dUL, 0x30a530d6UL, 0x68a6683bUL, 0x87a78760UL, 0xd6a8d682UL, 0x39a939d9UL, 0x61aa6134UL, 0x8eab8e6fUL, 0xd1acd187UL, 0x3ead3edcUL, 0x66ae6631UL, 0x89af896aUL, 0xc4b0c49cUL, 0x2bb12bc7UL, 0x73b2732aUL, 0x9cb39c71UL, 0xc3b4c399UL, 0x2cb52cc2UL, 0x74b6742fUL, 0x9bb79b74UL, 0xcab8ca96UL, 0x25b925cdUL, 0x7dba7d20UL, 0x92bb927bUL, 0xcdbccd93UL, 0x22bd22c8UL, 0x7abe7a25UL, 0x95bf957eUL, 0x90c090f0UL, 0x7fc17fabUL, 0x27c22746UL, 0xc8c3c81dUL, 0x97c497f5UL, 0x78c578aeUL, 0x20c62043UL, 0xcfc7cf18UL, 0x9ec89efaUL, 0x71c971a1UL, 0x29ca294cUL, 0xc6cbc617UL, 0x99cc99ffUL, 0x76cd76a4UL, 0x2ece2e49UL, 0xc1cfc112UL, 0x8cd08ce4UL, 0x63d163bfUL, 0x3bd23b52UL, 0xd4d3d409UL, 0x8bd48be1UL, 0x64d564baUL, 0x3cd63c57UL, 0xd3d7d30cUL, 0x82d882eeUL, 0x6dd96db5UL, 0x35da3558UL, 0xdadbda03UL, 0x85dc85ebUL, 0x6add6ab0UL, 0x32de325dUL, 0xdddfdd06UL, 0xa8e0a8d8UL, 0x47e14783UL, 0x1fe21f6eUL, 0xf0e3f035UL, 0xafe4afddUL, 0x40e54086UL, 0x18e6186bUL, 0xf7e7f730UL, 0xa6e8a6d2UL, 0x49e94989UL, 0x11ea1164UL, 0xfeebfe3fUL, 0xa1eca1d7UL, 0x4eed4e8cUL, 0x16ee1661UL, 0xf9eff93aUL, 0xb4f0b4ccUL, 0x5bf15b97UL, 0x03f2037aUL, 0xecf3ec21UL, 0xb3f4b3c9UL, 0x5cf55c92UL, 0x04f6047fUL, 0xebf7eb24UL, 0xbaf8bac6UL, 0x55f9559dUL, 0x0dfa0d70UL, 0xe2fbe22bUL, 0xbdfcbdc3UL, 0x52fd5298UL, 0x0afe0a75UL, 0xe5ffe52eUL }, { 0x00000000UL, 0x5bef015bUL, 0xb6b702b6UL, 0xed5803edUL, 0x05070405UL, 0x5ee8055eUL, 0xb3b006b3UL, 0xe85f07e8UL, 0x0a0e080aUL, 0x51e10951UL, 0xbcb90abcUL, 0xe7560be7UL, 0x0f090c0fUL, 0x54e60d54UL, 0xb9be0eb9UL, 0xe2510fe2UL, 0x141c1014UL, 0x4ff3114fUL, 0xa2ab12a2UL, 0xf94413f9UL, 0x111b1411UL, 0x4af4154aUL, 0xa7ac16a7UL, 0xfc4317fcUL, 0x1e12181eUL, 0x45fd1945UL, 0xa8a51aa8UL, 0xf34a1bf3UL, 0x1b151c1bUL, 0x40fa1d40UL, 0xada21eadUL, 0xf64d1ff6UL, 0x28382028UL, 0x73d72173UL, 0x9e8f229eUL, 0xc56023c5UL, 0x2d3f242dUL, 0x76d02576UL, 0x9b88269bUL, 0xc06727c0UL, 0x22362822UL, 0x79d92979UL, 0x94812a94UL, 0xcf6e2bcfUL, 0x27312c27UL, 0x7cde2d7cUL, 0x91862e91UL, 0xca692fcaUL, 0x3c24303cUL, 0x67cb3167UL, 0x8a93328aUL, 0xd17c33d1UL, 0x39233439UL, 0x62cc3562UL, 0x8f94368fUL, 0xd47b37d4UL, 0x362a3836UL, 0x6dc5396dUL, 0x809d3a80UL, 0xdb723bdbUL, 0x332d3c33UL, 0x68c23d68UL, 0x859a3e85UL, 0xde753fdeUL, 0x50704050UL, 0x0b9f410bUL, 0xe6c742e6UL, 0xbd2843bdUL, 0x55774455UL, 0x0e98450eUL, 0xe3c046e3UL, 0xb82f47b8UL, 0x5a7e485aUL, 0x01914901UL, 0xecc94aecUL, 0xb7264bb7UL, 0x5f794c5fUL, 0x04964d04UL, 0xe9ce4ee9UL, 0xb2214fb2UL, 0x446c5044UL, 0x1f83511fUL, 0xf2db52f2UL, 0xa93453a9UL, 0x416b5441UL, 0x1a84551aUL, 0xf7dc56f7UL, 0xac3357acUL, 0x4e62584eUL, 0x158d5915UL, 0xf8d55af8UL, 0xa33a5ba3UL, 0x4b655c4bUL, 0x108a5d10UL, 0xfdd25efdUL, 0xa63d5fa6UL, 0x78486078UL, 0x23a76123UL, 0xceff62ceUL, 0x95106395UL, 0x7d4f647dUL, 0x26a06526UL, 0xcbf866cbUL, 0x90176790UL, 0x72466872UL, 0x29a96929UL, 0xc4f16ac4UL, 0x9f1e6b9fUL, 0x77416c77UL, 0x2cae6d2cUL, 0xc1f66ec1UL, 0x9a196f9aUL, 0x6c54706cUL, 0x37bb7137UL, 0xdae372daUL, 0x810c7381UL, 0x69537469UL, 0x32bc7532UL, 0xdfe476dfUL, 0x840b7784UL, 0x665a7866UL, 0x3db5793dUL, 0xd0ed7ad0UL, 0x8b027b8bUL, 0x635d7c63UL, 0x38b27d38UL, 0xd5ea7ed5UL, 0x8e057f8eUL, 0xa0e080a0UL, 0xfb0f81fbUL, 0x16578216UL, 0x4db8834dUL, 0xa5e784a5UL, 0xfe0885feUL, 0x13508613UL, 0x48bf8748UL, 0xaaee88aaUL, 0xf10189f1UL, 0x1c598a1cUL, 0x47b68b47UL, 0xafe98cafUL, 0xf4068df4UL, 0x195e8e19UL, 0x42b18f42UL, 0xb4fc90b4UL, 0xef1391efUL, 0x024b9202UL, 0x59a49359UL, 0xb1fb94b1UL, 0xea1495eaUL, 0x074c9607UL, 0x5ca3975cUL, 0xbef298beUL, 0xe51d99e5UL, 0x08459a08UL, 0x53aa9b53UL, 0xbbf59cbbUL, 0xe01a9de0UL, 0x0d429e0dUL, 0x56ad9f56UL, 0x88d8a088UL, 0xd337a1d3UL, 0x3e6fa23eUL, 0x6580a365UL, 0x8ddfa48dUL, 0xd630a5d6UL, 0x3b68a63bUL, 0x6087a760UL, 0x82d6a882UL, 0xd939a9d9UL, 0x3461aa34UL, 0x6f8eab6fUL, 0x87d1ac87UL, 0xdc3eaddcUL, 0x3166ae31UL, 0x6a89af6aUL, 0x9cc4b09cUL, 0xc72bb1c7UL, 0x2a73b22aUL, 0x719cb371UL, 0x99c3b499UL, 0xc22cb5c2UL, 0x2f74b62fUL, 0x749bb774UL, 0x96cab896UL, 0xcd25b9cdUL, 0x207dba20UL, 0x7b92bb7bUL, 0x93cdbc93UL, 0xc822bdc8UL, 0x257abe25UL, 0x7e95bf7eUL, 0xf090c0f0UL, 0xab7fc1abUL, 0x4627c246UL, 0x1dc8c31dUL, 0xf597c4f5UL, 0xae78c5aeUL, 0x4320c643UL, 0x18cfc718UL, 0xfa9ec8faUL, 0xa171c9a1UL, 0x4c29ca4cUL, 0x17c6cb17UL, 0xff99ccffUL, 0xa476cda4UL, 0x492ece49UL, 0x12c1cf12UL, 0xe48cd0e4UL, 0xbf63d1bfUL, 0x523bd252UL, 0x09d4d309UL, 0xe18bd4e1UL, 0xba64d5baUL, 0x573cd657UL, 0x0cd3d70cUL, 0xee82d8eeUL, 0xb56dd9b5UL, 0x5835da58UL, 0x03dadb03UL, 0xeb85dcebUL, 0xb06addb0UL, 0x5d32de5dUL, 0x06dddf06UL, 0xd8a8e0d8UL, 0x8347e183UL, 0x6e1fe26eUL, 0x35f0e335UL, 0xddafe4ddUL, 0x8640e586UL, 0x6b18e66bUL, 0x30f7e730UL, 0xd2a6e8d2UL, 0x8949e989UL, 0x6411ea64UL, 0x3ffeeb3fUL, 0xd7a1ecd7UL, 0x8c4eed8cUL, 0x6116ee61UL, 0x3af9ef3aUL, 0xccb4f0ccUL, 0x975bf197UL, 0x7a03f27aUL, 0x21ecf321UL, 0xc9b3f4c9UL, 0x925cf592UL, 0x7f04f67fUL, 0x24ebf724UL, 0xc6baf8c6UL, 0x9d55f99dUL, 0x700dfa70UL, 0x2be2fb2bUL, 0xc3bdfcc3UL, 0x9852fd98UL, 0x750afe75UL, 0x2ee5ff2eUL }}; #ifdef TWOFISH_ALL_TABLES /* the 4x8 RS transform */ static const ulong32 rs_tab0[256] = { 0x00000000LU, 0xa402a401LU, 0x05040502LU, 0xa106a103LU, 0x0a080a04LU, 0xae0aae05LU, 0x0f0c0f06LU, 0xab0eab07LU, 0x14101408LU, 0xb012b009LU, 0x1114110aLU, 0xb516b50bLU, 0x1e181e0cLU, 0xba1aba0dLU, 0x1b1c1b0eLU, 0xbf1ebf0fLU, 0x28202810LU, 0x8c228c11LU, 0x2d242d12LU, 0x89268913LU, 0x22282214LU, 0x862a8615LU, 0x272c2716LU, 0x832e8317LU, 0x3c303c18LU, 0x98329819LU, 0x3934391aLU, 0x9d369d1bLU, 0x3638361cLU, 0x923a921dLU, 0x333c331eLU, 0x973e971fLU, 0x50405020LU, 0xf442f421LU, 0x55445522LU, 0xf146f123LU, 0x5a485a24LU, 0xfe4afe25LU, 0x5f4c5f26LU, 0xfb4efb27LU, 0x44504428LU, 0xe052e029LU, 0x4154412aLU, 0xe556e52bLU, 0x4e584e2cLU, 0xea5aea2dLU, 0x4b5c4b2eLU, 0xef5eef2fLU, 0x78607830LU, 0xdc62dc31LU, 0x7d647d32LU, 0xd966d933LU, 0x72687234LU, 0xd66ad635LU, 0x776c7736LU, 0xd36ed337LU, 0x6c706c38LU, 0xc872c839LU, 0x6974693aLU, 0xcd76cd3bLU, 0x6678663cLU, 0xc27ac23dLU, 0x637c633eLU, 0xc77ec73fLU, 0xa080a040LU, 0x04820441LU, 0xa584a542LU, 0x01860143LU, 0xaa88aa44LU, 0x0e8a0e45LU, 0xaf8caf46LU, 0x0b8e0b47LU, 0xb490b448LU, 0x10921049LU, 0xb194b14aLU, 0x1596154bLU, 0xbe98be4cLU, 0x1a9a1a4dLU, 0xbb9cbb4eLU, 0x1f9e1f4fLU, 0x88a08850LU, 0x2ca22c51LU, 0x8da48d52LU, 0x29a62953LU, 0x82a88254LU, 0x26aa2655LU, 0x87ac8756LU, 0x23ae2357LU, 0x9cb09c58LU, 0x38b23859LU, 0x99b4995aLU, 0x3db63d5bLU, 0x96b8965cLU, 0x32ba325dLU, 0x93bc935eLU, 0x37be375fLU, 0xf0c0f060LU, 0x54c25461LU, 0xf5c4f562LU, 0x51c65163LU, 0xfac8fa64LU, 0x5eca5e65LU, 0xffccff66LU, 0x5bce5b67LU, 0xe4d0e468LU, 0x40d24069LU, 0xe1d4e16aLU, 0x45d6456bLU, 0xeed8ee6cLU, 0x4ada4a6dLU, 0xebdceb6eLU, 0x4fde4f6fLU, 0xd8e0d870LU, 0x7ce27c71LU, 0xdde4dd72LU, 0x79e67973LU, 0xd2e8d274LU, 0x76ea7675LU, 0xd7ecd776LU, 0x73ee7377LU, 0xccf0cc78LU, 0x68f26879LU, 0xc9f4c97aLU, 0x6df66d7bLU, 0xc6f8c67cLU, 0x62fa627dLU, 0xc3fcc37eLU, 0x67fe677fLU, 0x0d4d0d80LU, 0xa94fa981LU, 0x08490882LU, 0xac4bac83LU, 0x07450784LU, 0xa347a385LU, 0x02410286LU, 0xa643a687LU, 0x195d1988LU, 0xbd5fbd89LU, 0x1c591c8aLU, 0xb85bb88bLU, 0x1355138cLU, 0xb757b78dLU, 0x1651168eLU, 0xb253b28fLU, 0x256d2590LU, 0x816f8191LU, 0x20692092LU, 0x846b8493LU, 0x2f652f94LU, 0x8b678b95LU, 0x2a612a96LU, 0x8e638e97LU, 0x317d3198LU, 0x957f9599LU, 0x3479349aLU, 0x907b909bLU, 0x3b753b9cLU, 0x9f779f9dLU, 0x3e713e9eLU, 0x9a739a9fLU, 0x5d0d5da0LU, 0xf90ff9a1LU, 0x580958a2LU, 0xfc0bfca3LU, 0x570557a4LU, 0xf307f3a5LU, 0x520152a6LU, 0xf603f6a7LU, 0x491d49a8LU, 0xed1feda9LU, 0x4c194caaLU, 0xe81be8abLU, 0x431543acLU, 0xe717e7adLU, 0x461146aeLU, 0xe213e2afLU, 0x752d75b0LU, 0xd12fd1b1LU, 0x702970b2LU, 0xd42bd4b3LU, 0x7f257fb4LU, 0xdb27dbb5LU, 0x7a217ab6LU, 0xde23deb7LU, 0x613d61b8LU, 0xc53fc5b9LU, 0x643964baLU, 0xc03bc0bbLU, 0x6b356bbcLU, 0xcf37cfbdLU, 0x6e316ebeLU, 0xca33cabfLU, 0xadcdadc0LU, 0x09cf09c1LU, 0xa8c9a8c2LU, 0x0ccb0cc3LU, 0xa7c5a7c4LU, 0x03c703c5LU, 0xa2c1a2c6LU, 0x06c306c7LU, 0xb9ddb9c8LU, 0x1ddf1dc9LU, 0xbcd9bccaLU, 0x18db18cbLU, 0xb3d5b3ccLU, 0x17d717cdLU, 0xb6d1b6ceLU, 0x12d312cfLU, 0x85ed85d0LU, 0x21ef21d1LU, 0x80e980d2LU, 0x24eb24d3LU, 0x8fe58fd4LU, 0x2be72bd5LU, 0x8ae18ad6LU, 0x2ee32ed7LU, 0x91fd91d8LU, 0x35ff35d9LU, 0x94f994daLU, 0x30fb30dbLU, 0x9bf59bdcLU, 0x3ff73fddLU, 0x9ef19edeLU, 0x3af33adfLU, 0xfd8dfde0LU, 0x598f59e1LU, 0xf889f8e2LU, 0x5c8b5ce3LU, 0xf785f7e4LU, 0x538753e5LU, 0xf281f2e6LU, 0x568356e7LU, 0xe99de9e8LU, 0x4d9f4de9LU, 0xec99eceaLU, 0x489b48ebLU, 0xe395e3ecLU, 0x479747edLU, 0xe691e6eeLU, 0x429342efLU, 0xd5add5f0LU, 0x71af71f1LU, 0xd0a9d0f2LU, 0x74ab74f3LU, 0xdfa5dff4LU, 0x7ba77bf5LU, 0xdaa1daf6LU, 0x7ea37ef7LU, 0xc1bdc1f8LU, 0x65bf65f9LU, 0xc4b9c4faLU, 0x60bb60fbLU, 0xcbb5cbfcLU, 0x6fb76ffdLU, 0xceb1cefeLU, 0x6ab36affLU }; static const ulong32 rs_tab1[256] = { 0x00000000LU, 0x55a156a4LU, 0xaa0fac05LU, 0xffaefaa1LU, 0x191e150aLU, 0x4cbf43aeLU, 0xb311b90fLU, 0xe6b0efabLU, 0x323c2a14LU, 0x679d7cb0LU, 0x98338611LU, 0xcd92d0b5LU, 0x2b223f1eLU, 0x7e8369baLU, 0x812d931bLU, 0xd48cc5bfLU, 0x64785428LU, 0x31d9028cLU, 0xce77f82dLU, 0x9bd6ae89LU, 0x7d664122LU, 0x28c71786LU, 0xd769ed27LU, 0x82c8bb83LU, 0x56447e3cLU, 0x03e52898LU, 0xfc4bd239LU, 0xa9ea849dLU, 0x4f5a6b36LU, 0x1afb3d92LU, 0xe555c733LU, 0xb0f49197LU, 0xc8f0a850LU, 0x9d51fef4LU, 0x62ff0455LU, 0x375e52f1LU, 0xd1eebd5aLU, 0x844febfeLU, 0x7be1115fLU, 0x2e4047fbLU, 0xfacc8244LU, 0xaf6dd4e0LU, 0x50c32e41LU, 0x056278e5LU, 0xe3d2974eLU, 0xb673c1eaLU, 0x49dd3b4bLU, 0x1c7c6defLU, 0xac88fc78LU, 0xf929aadcLU, 0x0687507dLU, 0x532606d9LU, 0xb596e972LU, 0xe037bfd6LU, 0x1f994577LU, 0x4a3813d3LU, 0x9eb4d66cLU, 0xcb1580c8LU, 0x34bb7a69LU, 0x611a2ccdLU, 0x87aac366LU, 0xd20b95c2LU, 0x2da56f63LU, 0x780439c7LU, 0xddad1da0LU, 0x880c4b04LU, 0x77a2b1a5LU, 0x2203e701LU, 0xc4b308aaLU, 0x91125e0eLU, 0x6ebca4afLU, 0x3b1df20bLU, 0xef9137b4LU, 0xba306110LU, 0x459e9bb1LU, 0x103fcd15LU, 0xf68f22beLU, 0xa32e741aLU, 0x5c808ebbLU, 0x0921d81fLU, 0xb9d54988LU, 0xec741f2cLU, 0x13dae58dLU, 0x467bb329LU, 0xa0cb5c82LU, 0xf56a0a26LU, 0x0ac4f087LU, 0x5f65a623LU, 0x8be9639cLU, 0xde483538LU, 0x21e6cf99LU, 0x7447993dLU, 0x92f77696LU, 0xc7562032LU, 0x38f8da93LU, 0x6d598c37LU, 0x155db5f0LU, 0x40fce354LU, 0xbf5219f5LU, 0xeaf34f51LU, 0x0c43a0faLU, 0x59e2f65eLU, 0xa64c0cffLU, 0xf3ed5a5bLU, 0x27619fe4LU, 0x72c0c940LU, 0x8d6e33e1LU, 0xd8cf6545LU, 0x3e7f8aeeLU, 0x6bdedc4aLU, 0x947026ebLU, 0xc1d1704fLU, 0x7125e1d8LU, 0x2484b77cLU, 0xdb2a4dddLU, 0x8e8b1b79LU, 0x683bf4d2LU, 0x3d9aa276LU, 0xc23458d7LU, 0x97950e73LU, 0x4319cbccLU, 0x16b89d68LU, 0xe91667c9LU, 0xbcb7316dLU, 0x5a07dec6LU, 0x0fa68862LU, 0xf00872c3LU, 0xa5a92467LU, 0xf7173a0dLU, 0xa2b66ca9LU, 0x5d189608LU, 0x08b9c0acLU, 0xee092f07LU, 0xbba879a3LU, 0x44068302LU, 0x11a7d5a6LU, 0xc52b1019LU, 0x908a46bdLU, 0x6f24bc1cLU, 0x3a85eab8LU, 0xdc350513LU, 0x899453b7LU, 0x763aa916LU, 0x239bffb2LU, 0x936f6e25LU, 0xc6ce3881LU, 0x3960c220LU, 0x6cc19484LU, 0x8a717b2fLU, 0xdfd02d8bLU, 0x207ed72aLU, 0x75df818eLU, 0xa1534431LU, 0xf4f21295LU, 0x0b5ce834LU, 0x5efdbe90LU, 0xb84d513bLU, 0xedec079fLU, 0x1242fd3eLU, 0x47e3ab9aLU, 0x3fe7925dLU, 0x6a46c4f9LU, 0x95e83e58LU, 0xc04968fcLU, 0x26f98757LU, 0x7358d1f3LU, 0x8cf62b52LU, 0xd9577df6LU, 0x0ddbb849LU, 0x587aeeedLU, 0xa7d4144cLU, 0xf27542e8LU, 0x14c5ad43LU, 0x4164fbe7LU, 0xbeca0146LU, 0xeb6b57e2LU, 0x5b9fc675LU, 0x0e3e90d1LU, 0xf1906a70LU, 0xa4313cd4LU, 0x4281d37fLU, 0x172085dbLU, 0xe88e7f7aLU, 0xbd2f29deLU, 0x69a3ec61LU, 0x3c02bac5LU, 0xc3ac4064LU, 0x960d16c0LU, 0x70bdf96bLU, 0x251cafcfLU, 0xdab2556eLU, 0x8f1303caLU, 0x2aba27adLU, 0x7f1b7109LU, 0x80b58ba8LU, 0xd514dd0cLU, 0x33a432a7LU, 0x66056403LU, 0x99ab9ea2LU, 0xcc0ac806LU, 0x18860db9LU, 0x4d275b1dLU, 0xb289a1bcLU, 0xe728f718LU, 0x019818b3LU, 0x54394e17LU, 0xab97b4b6LU, 0xfe36e212LU, 0x4ec27385LU, 0x1b632521LU, 0xe4cddf80LU, 0xb16c8924LU, 0x57dc668fLU, 0x027d302bLU, 0xfdd3ca8aLU, 0xa8729c2eLU, 0x7cfe5991LU, 0x295f0f35LU, 0xd6f1f594LU, 0x8350a330LU, 0x65e04c9bLU, 0x30411a3fLU, 0xcfefe09eLU, 0x9a4eb63aLU, 0xe24a8ffdLU, 0xb7ebd959LU, 0x484523f8LU, 0x1de4755cLU, 0xfb549af7LU, 0xaef5cc53LU, 0x515b36f2LU, 0x04fa6056LU, 0xd076a5e9LU, 0x85d7f34dLU, 0x7a7909ecLU, 0x2fd85f48LU, 0xc968b0e3LU, 0x9cc9e647LU, 0x63671ce6LU, 0x36c64a42LU, 0x8632dbd5LU, 0xd3938d71LU, 0x2c3d77d0LU, 0x799c2174LU, 0x9f2ccedfLU, 0xca8d987bLU, 0x352362daLU, 0x6082347eLU, 0xb40ef1c1LU, 0xe1afa765LU, 0x1e015dc4LU, 0x4ba00b60LU, 0xad10e4cbLU, 0xf8b1b26fLU, 0x071f48ceLU, 0x52be1e6aLU }; static const ulong32 rs_tab2[256] = { 0x00000000LU, 0x87fc8255LU, 0x43b549aaLU, 0xc449cbffLU, 0x86279219LU, 0x01db104cLU, 0xc592dbb3LU, 0x426e59e6LU, 0x414e6932LU, 0xc6b2eb67LU, 0x02fb2098LU, 0x8507a2cdLU, 0xc769fb2bLU, 0x4095797eLU, 0x84dcb281LU, 0x032030d4LU, 0x829cd264LU, 0x05605031LU, 0xc1299bceLU, 0x46d5199bLU, 0x04bb407dLU, 0x8347c228LU, 0x470e09d7LU, 0xc0f28b82LU, 0xc3d2bb56LU, 0x442e3903LU, 0x8067f2fcLU, 0x079b70a9LU, 0x45f5294fLU, 0xc209ab1aLU, 0x064060e5LU, 0x81bce2b0LU, 0x4975e9c8LU, 0xce896b9dLU, 0x0ac0a062LU, 0x8d3c2237LU, 0xcf527bd1LU, 0x48aef984LU, 0x8ce7327bLU, 0x0b1bb02eLU, 0x083b80faLU, 0x8fc702afLU, 0x4b8ec950LU, 0xcc724b05LU, 0x8e1c12e3LU, 0x09e090b6LU, 0xcda95b49LU, 0x4a55d91cLU, 0xcbe93bacLU, 0x4c15b9f9LU, 0x885c7206LU, 0x0fa0f053LU, 0x4dcea9b5LU, 0xca322be0LU, 0x0e7be01fLU, 0x8987624aLU, 0x8aa7529eLU, 0x0d5bd0cbLU, 0xc9121b34LU, 0x4eee9961LU, 0x0c80c087LU, 0x8b7c42d2LU, 0x4f35892dLU, 0xc8c90b78LU, 0x92ea9fddLU, 0x15161d88LU, 0xd15fd677LU, 0x56a35422LU, 0x14cd0dc4LU, 0x93318f91LU, 0x5778446eLU, 0xd084c63bLU, 0xd3a4f6efLU, 0x545874baLU, 0x9011bf45LU, 0x17ed3d10LU, 0x558364f6LU, 0xd27fe6a3LU, 0x16362d5cLU, 0x91caaf09LU, 0x10764db9LU, 0x978acfecLU, 0x53c30413LU, 0xd43f8646LU, 0x9651dfa0LU, 0x11ad5df5LU, 0xd5e4960aLU, 0x5218145fLU, 0x5138248bLU, 0xd6c4a6deLU, 0x128d6d21LU, 0x9571ef74LU, 0xd71fb692LU, 0x50e334c7LU, 0x94aaff38LU, 0x13567d6dLU, 0xdb9f7615LU, 0x5c63f440LU, 0x982a3fbfLU, 0x1fd6bdeaLU, 0x5db8e40cLU, 0xda446659LU, 0x1e0dada6LU, 0x99f12ff3LU, 0x9ad11f27LU, 0x1d2d9d72LU, 0xd964568dLU, 0x5e98d4d8LU, 0x1cf68d3eLU, 0x9b0a0f6bLU, 0x5f43c494LU, 0xd8bf46c1LU, 0x5903a471LU, 0xdeff2624LU, 0x1ab6eddbLU, 0x9d4a6f8eLU, 0xdf243668LU, 0x58d8b43dLU, 0x9c917fc2LU, 0x1b6dfd97LU, 0x184dcd43LU, 0x9fb14f16LU, 0x5bf884e9LU, 0xdc0406bcLU, 0x9e6a5f5aLU, 0x1996dd0fLU, 0xdddf16f0LU, 0x5a2394a5LU, 0x699973f7LU, 0xee65f1a2LU, 0x2a2c3a5dLU, 0xadd0b808LU, 0xefbee1eeLU, 0x684263bbLU, 0xac0ba844LU, 0x2bf72a11LU, 0x28d71ac5LU, 0xaf2b9890LU, 0x6b62536fLU, 0xec9ed13aLU, 0xaef088dcLU, 0x290c0a89LU, 0xed45c176LU, 0x6ab94323LU, 0xeb05a193LU, 0x6cf923c6LU, 0xa8b0e839LU, 0x2f4c6a6cLU, 0x6d22338aLU, 0xeadeb1dfLU, 0x2e977a20LU, 0xa96bf875LU, 0xaa4bc8a1LU, 0x2db74af4LU, 0xe9fe810bLU, 0x6e02035eLU, 0x2c6c5ab8LU, 0xab90d8edLU, 0x6fd91312LU, 0xe8259147LU, 0x20ec9a3fLU, 0xa710186aLU, 0x6359d395LU, 0xe4a551c0LU, 0xa6cb0826LU, 0x21378a73LU, 0xe57e418cLU, 0x6282c3d9LU, 0x61a2f30dLU, 0xe65e7158LU, 0x2217baa7LU, 0xa5eb38f2LU, 0xe7856114LU, 0x6079e341LU, 0xa43028beLU, 0x23ccaaebLU, 0xa270485bLU, 0x258cca0eLU, 0xe1c501f1LU, 0x663983a4LU, 0x2457da42LU, 0xa3ab5817LU, 0x67e293e8LU, 0xe01e11bdLU, 0xe33e2169LU, 0x64c2a33cLU, 0xa08b68c3LU, 0x2777ea96LU, 0x6519b370LU, 0xe2e53125LU, 0x26acfadaLU, 0xa150788fLU, 0xfb73ec2aLU, 0x7c8f6e7fLU, 0xb8c6a580LU, 0x3f3a27d5LU, 0x7d547e33LU, 0xfaa8fc66LU, 0x3ee13799LU, 0xb91db5ccLU, 0xba3d8518LU, 0x3dc1074dLU, 0xf988ccb2LU, 0x7e744ee7LU, 0x3c1a1701LU, 0xbbe69554LU, 0x7faf5eabLU, 0xf853dcfeLU, 0x79ef3e4eLU, 0xfe13bc1bLU, 0x3a5a77e4LU, 0xbda6f5b1LU, 0xffc8ac57LU, 0x78342e02LU, 0xbc7de5fdLU, 0x3b8167a8LU, 0x38a1577cLU, 0xbf5dd529LU, 0x7b141ed6LU, 0xfce89c83LU, 0xbe86c565LU, 0x397a4730LU, 0xfd338ccfLU, 0x7acf0e9aLU, 0xb20605e2LU, 0x35fa87b7LU, 0xf1b34c48LU, 0x764fce1dLU, 0x342197fbLU, 0xb3dd15aeLU, 0x7794de51LU, 0xf0685c04LU, 0xf3486cd0LU, 0x74b4ee85LU, 0xb0fd257aLU, 0x3701a72fLU, 0x756ffec9LU, 0xf2937c9cLU, 0x36dab763LU, 0xb1263536LU, 0x309ad786LU, 0xb76655d3LU, 0x732f9e2cLU, 0xf4d31c79LU, 0xb6bd459fLU, 0x3141c7caLU, 0xf5080c35LU, 0x72f48e60LU, 0x71d4beb4LU, 0xf6283ce1LU, 0x3261f71eLU, 0xb59d754bLU, 0xf7f32cadLU, 0x700faef8LU, 0xb4466507LU, 0x33bae752LU }; static const ulong32 rs_tab3[256] = { 0x00000000LU, 0x5ac1f387LU, 0xb4cfab43LU, 0xee0e58c4LU, 0x25d31b86LU, 0x7f12e801LU, 0x911cb0c5LU, 0xcbdd4342LU, 0x4aeb3641LU, 0x102ac5c6LU, 0xfe249d02LU, 0xa4e56e85LU, 0x6f382dc7LU, 0x35f9de40LU, 0xdbf78684LU, 0x81367503LU, 0x949b6c82LU, 0xce5a9f05LU, 0x2054c7c1LU, 0x7a953446LU, 0xb1487704LU, 0xeb898483LU, 0x0587dc47LU, 0x5f462fc0LU, 0xde705ac3LU, 0x84b1a944LU, 0x6abff180LU, 0x307e0207LU, 0xfba34145LU, 0xa162b2c2LU, 0x4f6cea06LU, 0x15ad1981LU, 0x657bd849LU, 0x3fba2bceLU, 0xd1b4730aLU, 0x8b75808dLU, 0x40a8c3cfLU, 0x1a693048LU, 0xf467688cLU, 0xaea69b0bLU, 0x2f90ee08LU, 0x75511d8fLU, 0x9b5f454bLU, 0xc19eb6ccLU, 0x0a43f58eLU, 0x50820609LU, 0xbe8c5ecdLU, 0xe44dad4aLU, 0xf1e0b4cbLU, 0xab21474cLU, 0x452f1f88LU, 0x1feeec0fLU, 0xd433af4dLU, 0x8ef25ccaLU, 0x60fc040eLU, 0x3a3df789LU, 0xbb0b828aLU, 0xe1ca710dLU, 0x0fc429c9LU, 0x5505da4eLU, 0x9ed8990cLU, 0xc4196a8bLU, 0x2a17324fLU, 0x70d6c1c8LU, 0xcaf6fd92LU, 0x90370e15LU, 0x7e3956d1LU, 0x24f8a556LU, 0xef25e614LU, 0xb5e41593LU, 0x5bea4d57LU, 0x012bbed0LU, 0x801dcbd3LU, 0xdadc3854LU, 0x34d26090LU, 0x6e139317LU, 0xa5ced055LU, 0xff0f23d2LU, 0x11017b16LU, 0x4bc08891LU, 0x5e6d9110LU, 0x04ac6297LU, 0xeaa23a53LU, 0xb063c9d4LU, 0x7bbe8a96LU, 0x217f7911LU, 0xcf7121d5LU, 0x95b0d252LU, 0x1486a751LU, 0x4e4754d6LU, 0xa0490c12LU, 0xfa88ff95LU, 0x3155bcd7LU, 0x6b944f50LU, 0x859a1794LU, 0xdf5be413LU, 0xaf8d25dbLU, 0xf54cd65cLU, 0x1b428e98LU, 0x41837d1fLU, 0x8a5e3e5dLU, 0xd09fcddaLU, 0x3e91951eLU, 0x64506699LU, 0xe566139aLU, 0xbfa7e01dLU, 0x51a9b8d9LU, 0x0b684b5eLU, 0xc0b5081cLU, 0x9a74fb9bLU, 0x747aa35fLU, 0x2ebb50d8LU, 0x3b164959LU, 0x61d7badeLU, 0x8fd9e21aLU, 0xd518119dLU, 0x1ec552dfLU, 0x4404a158LU, 0xaa0af99cLU, 0xf0cb0a1bLU, 0x71fd7f18LU, 0x2b3c8c9fLU, 0xc532d45bLU, 0x9ff327dcLU, 0x542e649eLU, 0x0eef9719LU, 0xe0e1cfddLU, 0xba203c5aLU, 0xd9a1b769LU, 0x836044eeLU, 0x6d6e1c2aLU, 0x37afefadLU, 0xfc72acefLU, 0xa6b35f68LU, 0x48bd07acLU, 0x127cf42bLU, 0x934a8128LU, 0xc98b72afLU, 0x27852a6bLU, 0x7d44d9ecLU, 0xb6999aaeLU, 0xec586929LU, 0x025631edLU, 0x5897c26aLU, 0x4d3adbebLU, 0x17fb286cLU, 0xf9f570a8LU, 0xa334832fLU, 0x68e9c06dLU, 0x322833eaLU, 0xdc266b2eLU, 0x86e798a9LU, 0x07d1edaaLU, 0x5d101e2dLU, 0xb31e46e9LU, 0xe9dfb56eLU, 0x2202f62cLU, 0x78c305abLU, 0x96cd5d6fLU, 0xcc0caee8LU, 0xbcda6f20LU, 0xe61b9ca7LU, 0x0815c463LU, 0x52d437e4LU, 0x990974a6LU, 0xc3c88721LU, 0x2dc6dfe5LU, 0x77072c62LU, 0xf6315961LU, 0xacf0aae6LU, 0x42fef222LU, 0x183f01a5LU, 0xd3e242e7LU, 0x8923b160LU, 0x672de9a4LU, 0x3dec1a23LU, 0x284103a2LU, 0x7280f025LU, 0x9c8ea8e1LU, 0xc64f5b66LU, 0x0d921824LU, 0x5753eba3LU, 0xb95db367LU, 0xe39c40e0LU, 0x62aa35e3LU, 0x386bc664LU, 0xd6659ea0LU, 0x8ca46d27LU, 0x47792e65LU, 0x1db8dde2LU, 0xf3b68526LU, 0xa97776a1LU, 0x13574afbLU, 0x4996b97cLU, 0xa798e1b8LU, 0xfd59123fLU, 0x3684517dLU, 0x6c45a2faLU, 0x824bfa3eLU, 0xd88a09b9LU, 0x59bc7cbaLU, 0x037d8f3dLU, 0xed73d7f9LU, 0xb7b2247eLU, 0x7c6f673cLU, 0x26ae94bbLU, 0xc8a0cc7fLU, 0x92613ff8LU, 0x87cc2679LU, 0xdd0dd5feLU, 0x33038d3aLU, 0x69c27ebdLU, 0xa21f3dffLU, 0xf8dece78LU, 0x16d096bcLU, 0x4c11653bLU, 0xcd271038LU, 0x97e6e3bfLU, 0x79e8bb7bLU, 0x232948fcLU, 0xe8f40bbeLU, 0xb235f839LU, 0x5c3ba0fdLU, 0x06fa537aLU, 0x762c92b2LU, 0x2ced6135LU, 0xc2e339f1LU, 0x9822ca76LU, 0x53ff8934LU, 0x093e7ab3LU, 0xe7302277LU, 0xbdf1d1f0LU, 0x3cc7a4f3LU, 0x66065774LU, 0x88080fb0LU, 0xd2c9fc37LU, 0x1914bf75LU, 0x43d54cf2LU, 0xaddb1436LU, 0xf71ae7b1LU, 0xe2b7fe30LU, 0xb8760db7LU, 0x56785573LU, 0x0cb9a6f4LU, 0xc764e5b6LU, 0x9da51631LU, 0x73ab4ef5LU, 0x296abd72LU, 0xa85cc871LU, 0xf29d3bf6LU, 0x1c936332LU, 0x465290b5LU, 0x8d8fd3f7LU, 0xd74e2070LU, 0x394078b4LU, 0x63818b33LU }; static const ulong32 rs_tab4[256] = { 0x00000000LU, 0x58471e5aLU, 0xb08e3cb4LU, 0xe8c922eeLU, 0x2d517825LU, 0x7516667fLU, 0x9ddf4491LU, 0xc5985acbLU, 0x5aa2f04aLU, 0x02e5ee10LU, 0xea2cccfeLU, 0xb26bd2a4LU, 0x77f3886fLU, 0x2fb49635LU, 0xc77db4dbLU, 0x9f3aaa81LU, 0xb409ad94LU, 0xec4eb3ceLU, 0x04879120LU, 0x5cc08f7aLU, 0x9958d5b1LU, 0xc11fcbebLU, 0x29d6e905LU, 0x7191f75fLU, 0xeeab5ddeLU, 0xb6ec4384LU, 0x5e25616aLU, 0x06627f30LU, 0xc3fa25fbLU, 0x9bbd3ba1LU, 0x7374194fLU, 0x2b330715LU, 0x25121765LU, 0x7d55093fLU, 0x959c2bd1LU, 0xcddb358bLU, 0x08436f40LU, 0x5004711aLU, 0xb8cd53f4LU, 0xe08a4daeLU, 0x7fb0e72fLU, 0x27f7f975LU, 0xcf3edb9bLU, 0x9779c5c1LU, 0x52e19f0aLU, 0x0aa68150LU, 0xe26fa3beLU, 0xba28bde4LU, 0x911bbaf1LU, 0xc95ca4abLU, 0x21958645LU, 0x79d2981fLU, 0xbc4ac2d4LU, 0xe40ddc8eLU, 0x0cc4fe60LU, 0x5483e03aLU, 0xcbb94abbLU, 0x93fe54e1LU, 0x7b37760fLU, 0x23706855LU, 0xe6e8329eLU, 0xbeaf2cc4LU, 0x56660e2aLU, 0x0e211070LU, 0x4a242ecaLU, 0x12633090LU, 0xfaaa127eLU, 0xa2ed0c24LU, 0x677556efLU, 0x3f3248b5LU, 0xd7fb6a5bLU, 0x8fbc7401LU, 0x1086de80LU, 0x48c1c0daLU, 0xa008e234LU, 0xf84ffc6eLU, 0x3dd7a6a5LU, 0x6590b8ffLU, 0x8d599a11LU, 0xd51e844bLU, 0xfe2d835eLU, 0xa66a9d04LU, 0x4ea3bfeaLU, 0x16e4a1b0LU, 0xd37cfb7bLU, 0x8b3be521LU, 0x63f2c7cfLU, 0x3bb5d995LU, 0xa48f7314LU, 0xfcc86d4eLU, 0x14014fa0LU, 0x4c4651faLU, 0x89de0b31LU, 0xd199156bLU, 0x39503785LU, 0x611729dfLU, 0x6f3639afLU, 0x377127f5LU, 0xdfb8051bLU, 0x87ff1b41LU, 0x4267418aLU, 0x1a205fd0LU, 0xf2e97d3eLU, 0xaaae6364LU, 0x3594c9e5LU, 0x6dd3d7bfLU, 0x851af551LU, 0xdd5deb0bLU, 0x18c5b1c0LU, 0x4082af9aLU, 0xa84b8d74LU, 0xf00c932eLU, 0xdb3f943bLU, 0x83788a61LU, 0x6bb1a88fLU, 0x33f6b6d5LU, 0xf66eec1eLU, 0xae29f244LU, 0x46e0d0aaLU, 0x1ea7cef0LU, 0x819d6471LU, 0xd9da7a2bLU, 0x311358c5LU, 0x6954469fLU, 0xaccc1c54LU, 0xf48b020eLU, 0x1c4220e0LU, 0x44053ebaLU, 0x94485cd9LU, 0xcc0f4283LU, 0x24c6606dLU, 0x7c817e37LU, 0xb91924fcLU, 0xe15e3aa6LU, 0x09971848LU, 0x51d00612LU, 0xceeaac93LU, 0x96adb2c9LU, 0x7e649027LU, 0x26238e7dLU, 0xe3bbd4b6LU, 0xbbfccaecLU, 0x5335e802LU, 0x0b72f658LU, 0x2041f14dLU, 0x7806ef17LU, 0x90cfcdf9LU, 0xc888d3a3LU, 0x0d108968LU, 0x55579732LU, 0xbd9eb5dcLU, 0xe5d9ab86LU, 0x7ae30107LU, 0x22a41f5dLU, 0xca6d3db3LU, 0x922a23e9LU, 0x57b27922LU, 0x0ff56778LU, 0xe73c4596LU, 0xbf7b5bccLU, 0xb15a4bbcLU, 0xe91d55e6LU, 0x01d47708LU, 0x59936952LU, 0x9c0b3399LU, 0xc44c2dc3LU, 0x2c850f2dLU, 0x74c21177LU, 0xebf8bbf6LU, 0xb3bfa5acLU, 0x5b768742LU, 0x03319918LU, 0xc6a9c3d3LU, 0x9eeedd89LU, 0x7627ff67LU, 0x2e60e13dLU, 0x0553e628LU, 0x5d14f872LU, 0xb5ddda9cLU, 0xed9ac4c6LU, 0x28029e0dLU, 0x70458057LU, 0x988ca2b9LU, 0xc0cbbce3LU, 0x5ff11662LU, 0x07b60838LU, 0xef7f2ad6LU, 0xb738348cLU, 0x72a06e47LU, 0x2ae7701dLU, 0xc22e52f3LU, 0x9a694ca9LU, 0xde6c7213LU, 0x862b6c49LU, 0x6ee24ea7LU, 0x36a550fdLU, 0xf33d0a36LU, 0xab7a146cLU, 0x43b33682LU, 0x1bf428d8LU, 0x84ce8259LU, 0xdc899c03LU, 0x3440beedLU, 0x6c07a0b7LU, 0xa99ffa7cLU, 0xf1d8e426LU, 0x1911c6c8LU, 0x4156d892LU, 0x6a65df87LU, 0x3222c1ddLU, 0xdaebe333LU, 0x82acfd69LU, 0x4734a7a2LU, 0x1f73b9f8LU, 0xf7ba9b16LU, 0xaffd854cLU, 0x30c72fcdLU, 0x68803197LU, 0x80491379LU, 0xd80e0d23LU, 0x1d9657e8LU, 0x45d149b2LU, 0xad186b5cLU, 0xf55f7506LU, 0xfb7e6576LU, 0xa3397b2cLU, 0x4bf059c2LU, 0x13b74798LU, 0xd62f1d53LU, 0x8e680309LU, 0x66a121e7LU, 0x3ee63fbdLU, 0xa1dc953cLU, 0xf99b8b66LU, 0x1152a988LU, 0x4915b7d2LU, 0x8c8ded19LU, 0xd4caf343LU, 0x3c03d1adLU, 0x6444cff7LU, 0x4f77c8e2LU, 0x1730d6b8LU, 0xfff9f456LU, 0xa7beea0cLU, 0x6226b0c7LU, 0x3a61ae9dLU, 0xd2a88c73LU, 0x8aef9229LU, 0x15d538a8LU, 0x4d9226f2LU, 0xa55b041cLU, 0xfd1c1a46LU, 0x3884408dLU, 0x60c35ed7LU, 0x880a7c39LU, 0xd04d6263LU }; static const ulong32 rs_tab5[256] = { 0x00000000LU, 0xdbaec658LU, 0xfb11c1b0LU, 0x20bf07e8LU, 0xbb22cf2dLU, 0x608c0975LU, 0x40330e9dLU, 0x9b9dc8c5LU, 0x3b44d35aLU, 0xe0ea1502LU, 0xc05512eaLU, 0x1bfbd4b2LU, 0x80661c77LU, 0x5bc8da2fLU, 0x7b77ddc7LU, 0xa0d91b9fLU, 0x7688ebb4LU, 0xad262decLU, 0x8d992a04LU, 0x5637ec5cLU, 0xcdaa2499LU, 0x1604e2c1LU, 0x36bbe529LU, 0xed152371LU, 0x4dcc38eeLU, 0x9662feb6LU, 0xb6ddf95eLU, 0x6d733f06LU, 0xf6eef7c3LU, 0x2d40319bLU, 0x0dff3673LU, 0xd651f02bLU, 0xec5d9b25LU, 0x37f35d7dLU, 0x174c5a95LU, 0xcce29ccdLU, 0x577f5408LU, 0x8cd19250LU, 0xac6e95b8LU, 0x77c053e0LU, 0xd719487fLU, 0x0cb78e27LU, 0x2c0889cfLU, 0xf7a64f97LU, 0x6c3b8752LU, 0xb795410aLU, 0x972a46e2LU, 0x4c8480baLU, 0x9ad57091LU, 0x417bb6c9LU, 0x61c4b121LU, 0xba6a7779LU, 0x21f7bfbcLU, 0xfa5979e4LU, 0xdae67e0cLU, 0x0148b854LU, 0xa191a3cbLU, 0x7a3f6593LU, 0x5a80627bLU, 0x812ea423LU, 0x1ab36ce6LU, 0xc11daabeLU, 0xe1a2ad56LU, 0x3a0c6b0eLU, 0x95ba7b4aLU, 0x4e14bd12LU, 0x6eabbafaLU, 0xb5057ca2LU, 0x2e98b467LU, 0xf536723fLU, 0xd58975d7LU, 0x0e27b38fLU, 0xaefea810LU, 0x75506e48LU, 0x55ef69a0LU, 0x8e41aff8LU, 0x15dc673dLU, 0xce72a165LU, 0xeecda68dLU, 0x356360d5LU, 0xe33290feLU, 0x389c56a6LU, 0x1823514eLU, 0xc38d9716LU, 0x58105fd3LU, 0x83be998bLU, 0xa3019e63LU, 0x78af583bLU, 0xd87643a4LU, 0x03d885fcLU, 0x23678214LU, 0xf8c9444cLU, 0x63548c89LU, 0xb8fa4ad1LU, 0x98454d39LU, 0x43eb8b61LU, 0x79e7e06fLU, 0xa2492637LU, 0x82f621dfLU, 0x5958e787LU, 0xc2c52f42LU, 0x196be91aLU, 0x39d4eef2LU, 0xe27a28aaLU, 0x42a33335LU, 0x990df56dLU, 0xb9b2f285LU, 0x621c34ddLU, 0xf981fc18LU, 0x222f3a40LU, 0x02903da8LU, 0xd93efbf0LU, 0x0f6f0bdbLU, 0xd4c1cd83LU, 0xf47eca6bLU, 0x2fd00c33LU, 0xb44dc4f6LU, 0x6fe302aeLU, 0x4f5c0546LU, 0x94f2c31eLU, 0x342bd881LU, 0xef851ed9LU, 0xcf3a1931LU, 0x1494df69LU, 0x8f0917acLU, 0x54a7d1f4LU, 0x7418d61cLU, 0xafb61044LU, 0x6739f694LU, 0xbc9730ccLU, 0x9c283724LU, 0x4786f17cLU, 0xdc1b39b9LU, 0x07b5ffe1LU, 0x270af809LU, 0xfca43e51LU, 0x5c7d25ceLU, 0x87d3e396LU, 0xa76ce47eLU, 0x7cc22226LU, 0xe75feae3LU, 0x3cf12cbbLU, 0x1c4e2b53LU, 0xc7e0ed0bLU, 0x11b11d20LU, 0xca1fdb78LU, 0xeaa0dc90LU, 0x310e1ac8LU, 0xaa93d20dLU, 0x713d1455LU, 0x518213bdLU, 0x8a2cd5e5LU, 0x2af5ce7aLU, 0xf15b0822LU, 0xd1e40fcaLU, 0x0a4ac992LU, 0x91d70157LU, 0x4a79c70fLU, 0x6ac6c0e7LU, 0xb16806bfLU, 0x8b646db1LU, 0x50caabe9LU, 0x7075ac01LU, 0xabdb6a59LU, 0x3046a29cLU, 0xebe864c4LU, 0xcb57632cLU, 0x10f9a574LU, 0xb020beebLU, 0x6b8e78b3LU, 0x4b317f5bLU, 0x909fb903LU, 0x0b0271c6LU, 0xd0acb79eLU, 0xf013b076LU, 0x2bbd762eLU, 0xfdec8605LU, 0x2642405dLU, 0x06fd47b5LU, 0xdd5381edLU, 0x46ce4928LU, 0x9d608f70LU, 0xbddf8898LU, 0x66714ec0LU, 0xc6a8555fLU, 0x1d069307LU, 0x3db994efLU, 0xe61752b7LU, 0x7d8a9a72LU, 0xa6245c2aLU, 0x869b5bc2LU, 0x5d359d9aLU, 0xf2838ddeLU, 0x292d4b86LU, 0x09924c6eLU, 0xd23c8a36LU, 0x49a142f3LU, 0x920f84abLU, 0xb2b08343LU, 0x691e451bLU, 0xc9c75e84LU, 0x126998dcLU, 0x32d69f34LU, 0xe978596cLU, 0x72e591a9LU, 0xa94b57f1LU, 0x89f45019LU, 0x525a9641LU, 0x840b666aLU, 0x5fa5a032LU, 0x7f1aa7daLU, 0xa4b46182LU, 0x3f29a947LU, 0xe4876f1fLU, 0xc43868f7LU, 0x1f96aeafLU, 0xbf4fb530LU, 0x64e17368LU, 0x445e7480LU, 0x9ff0b2d8LU, 0x046d7a1dLU, 0xdfc3bc45LU, 0xff7cbbadLU, 0x24d27df5LU, 0x1ede16fbLU, 0xc570d0a3LU, 0xe5cfd74bLU, 0x3e611113LU, 0xa5fcd9d6LU, 0x7e521f8eLU, 0x5eed1866LU, 0x8543de3eLU, 0x259ac5a1LU, 0xfe3403f9LU, 0xde8b0411LU, 0x0525c249LU, 0x9eb80a8cLU, 0x4516ccd4LU, 0x65a9cb3cLU, 0xbe070d64LU, 0x6856fd4fLU, 0xb3f83b17LU, 0x93473cffLU, 0x48e9faa7LU, 0xd3743262LU, 0x08daf43aLU, 0x2865f3d2LU, 0xf3cb358aLU, 0x53122e15LU, 0x88bce84dLU, 0xa803efa5LU, 0x73ad29fdLU, 0xe830e138LU, 0x339e2760LU, 0x13212088LU, 0xc88fe6d0LU }; static const ulong32 rs_tab6[256] = { 0x00000000LU, 0x9e3d68dbLU, 0x717ad0fbLU, 0xef47b820LU, 0xe2f4edbbLU, 0x7cc98560LU, 0x938e3d40LU, 0x0db3559bLU, 0x89a5973bLU, 0x1798ffe0LU, 0xf8df47c0LU, 0x66e22f1bLU, 0x6b517a80LU, 0xf56c125bLU, 0x1a2baa7bLU, 0x8416c2a0LU, 0x5f076376LU, 0xc13a0badLU, 0x2e7db38dLU, 0xb040db56LU, 0xbdf38ecdLU, 0x23cee616LU, 0xcc895e36LU, 0x52b436edLU, 0xd6a2f44dLU, 0x489f9c96LU, 0xa7d824b6LU, 0x39e54c6dLU, 0x345619f6LU, 0xaa6b712dLU, 0x452cc90dLU, 0xdb11a1d6LU, 0xbe0ec6ecLU, 0x2033ae37LU, 0xcf741617LU, 0x51497eccLU, 0x5cfa2b57LU, 0xc2c7438cLU, 0x2d80fbacLU, 0xb3bd9377LU, 0x37ab51d7LU, 0xa996390cLU, 0x46d1812cLU, 0xd8ece9f7LU, 0xd55fbc6cLU, 0x4b62d4b7LU, 0xa4256c97LU, 0x3a18044cLU, 0xe109a59aLU, 0x7f34cd41LU, 0x90737561LU, 0x0e4e1dbaLU, 0x03fd4821LU, 0x9dc020faLU, 0x728798daLU, 0xecbaf001LU, 0x68ac32a1LU, 0xf6915a7aLU, 0x19d6e25aLU, 0x87eb8a81LU, 0x8a58df1aLU, 0x1465b7c1LU, 0xfb220fe1LU, 0x651f673aLU, 0x311cc195LU, 0xaf21a94eLU, 0x4066116eLU, 0xde5b79b5LU, 0xd3e82c2eLU, 0x4dd544f5LU, 0xa292fcd5LU, 0x3caf940eLU, 0xb8b956aeLU, 0x26843e75LU, 0xc9c38655LU, 0x57feee8eLU, 0x5a4dbb15LU, 0xc470d3ceLU, 0x2b376beeLU, 0xb50a0335LU, 0x6e1ba2e3LU, 0xf026ca38LU, 0x1f617218LU, 0x815c1ac3LU, 0x8cef4f58LU, 0x12d22783LU, 0xfd959fa3LU, 0x63a8f778LU, 0xe7be35d8LU, 0x79835d03LU, 0x96c4e523LU, 0x08f98df8LU, 0x054ad863LU, 0x9b77b0b8LU, 0x74300898LU, 0xea0d6043LU, 0x8f120779LU, 0x112f6fa2LU, 0xfe68d782LU, 0x6055bf59LU, 0x6de6eac2LU, 0xf3db8219LU, 0x1c9c3a39LU, 0x82a152e2LU, 0x06b79042LU, 0x988af899LU, 0x77cd40b9LU, 0xe9f02862LU, 0xe4437df9LU, 0x7a7e1522LU, 0x9539ad02LU, 0x0b04c5d9LU, 0xd015640fLU, 0x4e280cd4LU, 0xa16fb4f4LU, 0x3f52dc2fLU, 0x32e189b4LU, 0xacdce16fLU, 0x439b594fLU, 0xdda63194LU, 0x59b0f334LU, 0xc78d9befLU, 0x28ca23cfLU, 0xb6f74b14LU, 0xbb441e8fLU, 0x25797654LU, 0xca3ece74LU, 0x5403a6afLU, 0x6238cf67LU, 0xfc05a7bcLU, 0x13421f9cLU, 0x8d7f7747LU, 0x80cc22dcLU, 0x1ef14a07LU, 0xf1b6f227LU, 0x6f8b9afcLU, 0xeb9d585cLU, 0x75a03087LU, 0x9ae788a7LU, 0x04dae07cLU, 0x0969b5e7LU, 0x9754dd3cLU, 0x7813651cLU, 0xe62e0dc7LU, 0x3d3fac11LU, 0xa302c4caLU, 0x4c457ceaLU, 0xd2781431LU, 0xdfcb41aaLU, 0x41f62971LU, 0xaeb19151LU, 0x308cf98aLU, 0xb49a3b2aLU, 0x2aa753f1LU, 0xc5e0ebd1LU, 0x5bdd830aLU, 0x566ed691LU, 0xc853be4aLU, 0x2714066aLU, 0xb9296eb1LU, 0xdc36098bLU, 0x420b6150LU, 0xad4cd970LU, 0x3371b1abLU, 0x3ec2e430LU, 0xa0ff8cebLU, 0x4fb834cbLU, 0xd1855c10LU, 0x55939eb0LU, 0xcbaef66bLU, 0x24e94e4bLU, 0xbad42690LU, 0xb767730bLU, 0x295a1bd0LU, 0xc61da3f0LU, 0x5820cb2bLU, 0x83316afdLU, 0x1d0c0226LU, 0xf24bba06LU, 0x6c76d2ddLU, 0x61c58746LU, 0xfff8ef9dLU, 0x10bf57bdLU, 0x8e823f66LU, 0x0a94fdc6LU, 0x94a9951dLU, 0x7bee2d3dLU, 0xe5d345e6LU, 0xe860107dLU, 0x765d78a6LU, 0x991ac086LU, 0x0727a85dLU, 0x53240ef2LU, 0xcd196629LU, 0x225ede09LU, 0xbc63b6d2LU, 0xb1d0e349LU, 0x2fed8b92LU, 0xc0aa33b2LU, 0x5e975b69LU, 0xda8199c9LU, 0x44bcf112LU, 0xabfb4932LU, 0x35c621e9LU, 0x38757472LU, 0xa6481ca9LU, 0x490fa489LU, 0xd732cc52LU, 0x0c236d84LU, 0x921e055fLU, 0x7d59bd7fLU, 0xe364d5a4LU, 0xeed7803fLU, 0x70eae8e4LU, 0x9fad50c4LU, 0x0190381fLU, 0x8586fabfLU, 0x1bbb9264LU, 0xf4fc2a44LU, 0x6ac1429fLU, 0x67721704LU, 0xf94f7fdfLU, 0x1608c7ffLU, 0x8835af24LU, 0xed2ac81eLU, 0x7317a0c5LU, 0x9c5018e5LU, 0x026d703eLU, 0x0fde25a5LU, 0x91e34d7eLU, 0x7ea4f55eLU, 0xe0999d85LU, 0x648f5f25LU, 0xfab237feLU, 0x15f58fdeLU, 0x8bc8e705LU, 0x867bb29eLU, 0x1846da45LU, 0xf7016265LU, 0x693c0abeLU, 0xb22dab68LU, 0x2c10c3b3LU, 0xc3577b93LU, 0x5d6a1348LU, 0x50d946d3LU, 0xcee42e08LU, 0x21a39628LU, 0xbf9efef3LU, 0x3b883c53LU, 0xa5b55488LU, 0x4af2eca8LU, 0xd4cf8473LU, 0xd97cd1e8LU, 0x4741b933LU, 0xa8060113LU, 0x363b69c8LU }; static const ulong32 rs_tab7[256] = { 0x00000000LU, 0x0319e59eLU, 0x06328771LU, 0x052b62efLU, 0x0c6443e2LU, 0x0f7da67cLU, 0x0a56c493LU, 0x094f210dLU, 0x18c88689LU, 0x1bd16317LU, 0x1efa01f8LU, 0x1de3e466LU, 0x14acc56bLU, 0x17b520f5LU, 0x129e421aLU, 0x1187a784LU, 0x30dd415fLU, 0x33c4a4c1LU, 0x36efc62eLU, 0x35f623b0LU, 0x3cb902bdLU, 0x3fa0e723LU, 0x3a8b85ccLU, 0x39926052LU, 0x2815c7d6LU, 0x2b0c2248LU, 0x2e2740a7LU, 0x2d3ea539LU, 0x24718434LU, 0x276861aaLU, 0x22430345LU, 0x215ae6dbLU, 0x60f782beLU, 0x63ee6720LU, 0x66c505cfLU, 0x65dce051LU, 0x6c93c15cLU, 0x6f8a24c2LU, 0x6aa1462dLU, 0x69b8a3b3LU, 0x783f0437LU, 0x7b26e1a9LU, 0x7e0d8346LU, 0x7d1466d8LU, 0x745b47d5LU, 0x7742a24bLU, 0x7269c0a4LU, 0x7170253aLU, 0x502ac3e1LU, 0x5333267fLU, 0x56184490LU, 0x5501a10eLU, 0x5c4e8003LU, 0x5f57659dLU, 0x5a7c0772LU, 0x5965e2ecLU, 0x48e24568LU, 0x4bfba0f6LU, 0x4ed0c219LU, 0x4dc92787LU, 0x4486068aLU, 0x479fe314LU, 0x42b481fbLU, 0x41ad6465LU, 0xc0a34931LU, 0xc3baacafLU, 0xc691ce40LU, 0xc5882bdeLU, 0xccc70ad3LU, 0xcfdeef4dLU, 0xcaf58da2LU, 0xc9ec683cLU, 0xd86bcfb8LU, 0xdb722a26LU, 0xde5948c9LU, 0xdd40ad57LU, 0xd40f8c5aLU, 0xd71669c4LU, 0xd23d0b2bLU, 0xd124eeb5LU, 0xf07e086eLU, 0xf367edf0LU, 0xf64c8f1fLU, 0xf5556a81LU, 0xfc1a4b8cLU, 0xff03ae12LU, 0xfa28ccfdLU, 0xf9312963LU, 0xe8b68ee7LU, 0xebaf6b79LU, 0xee840996LU, 0xed9dec08LU, 0xe4d2cd05LU, 0xe7cb289bLU, 0xe2e04a74LU, 0xe1f9afeaLU, 0xa054cb8fLU, 0xa34d2e11LU, 0xa6664cfeLU, 0xa57fa960LU, 0xac30886dLU, 0xaf296df3LU, 0xaa020f1cLU, 0xa91bea82LU, 0xb89c4d06LU, 0xbb85a898LU, 0xbeaeca77LU, 0xbdb72fe9LU, 0xb4f80ee4LU, 0xb7e1eb7aLU, 0xb2ca8995LU, 0xb1d36c0bLU, 0x90898ad0LU, 0x93906f4eLU, 0x96bb0da1LU, 0x95a2e83fLU, 0x9cedc932LU, 0x9ff42cacLU, 0x9adf4e43LU, 0x99c6abddLU, 0x88410c59LU, 0x8b58e9c7LU, 0x8e738b28LU, 0x8d6a6eb6LU, 0x84254fbbLU, 0x873caa25LU, 0x8217c8caLU, 0x810e2d54LU, 0xcd0b9262LU, 0xce1277fcLU, 0xcb391513LU, 0xc820f08dLU, 0xc16fd180LU, 0xc276341eLU, 0xc75d56f1LU, 0xc444b36fLU, 0xd5c314ebLU, 0xd6daf175LU, 0xd3f1939aLU, 0xd0e87604LU, 0xd9a75709LU, 0xdabeb297LU, 0xdf95d078LU, 0xdc8c35e6LU, 0xfdd6d33dLU, 0xfecf36a3LU, 0xfbe4544cLU, 0xf8fdb1d2LU, 0xf1b290dfLU, 0xf2ab7541LU, 0xf78017aeLU, 0xf499f230LU, 0xe51e55b4LU, 0xe607b02aLU, 0xe32cd2c5LU, 0xe035375bLU, 0xe97a1656LU, 0xea63f3c8LU, 0xef489127LU, 0xec5174b9LU, 0xadfc10dcLU, 0xaee5f542LU, 0xabce97adLU, 0xa8d77233LU, 0xa198533eLU, 0xa281b6a0LU, 0xa7aad44fLU, 0xa4b331d1LU, 0xb5349655LU, 0xb62d73cbLU, 0xb3061124LU, 0xb01ff4baLU, 0xb950d5b7LU, 0xba493029LU, 0xbf6252c6LU, 0xbc7bb758LU, 0x9d215183LU, 0x9e38b41dLU, 0x9b13d6f2LU, 0x980a336cLU, 0x91451261LU, 0x925cf7ffLU, 0x97779510LU, 0x946e708eLU, 0x85e9d70aLU, 0x86f03294LU, 0x83db507bLU, 0x80c2b5e5LU, 0x898d94e8LU, 0x8a947176LU, 0x8fbf1399LU, 0x8ca6f607LU, 0x0da8db53LU, 0x0eb13ecdLU, 0x0b9a5c22LU, 0x0883b9bcLU, 0x01cc98b1LU, 0x02d57d2fLU, 0x07fe1fc0LU, 0x04e7fa5eLU, 0x15605ddaLU, 0x1679b844LU, 0x1352daabLU, 0x104b3f35LU, 0x19041e38LU, 0x1a1dfba6LU, 0x1f369949LU, 0x1c2f7cd7LU, 0x3d759a0cLU, 0x3e6c7f92LU, 0x3b471d7dLU, 0x385ef8e3LU, 0x3111d9eeLU, 0x32083c70LU, 0x37235e9fLU, 0x343abb01LU, 0x25bd1c85LU, 0x26a4f91bLU, 0x238f9bf4LU, 0x20967e6aLU, 0x29d95f67LU, 0x2ac0baf9LU, 0x2febd816LU, 0x2cf23d88LU, 0x6d5f59edLU, 0x6e46bc73LU, 0x6b6dde9cLU, 0x68743b02LU, 0x613b1a0fLU, 0x6222ff91LU, 0x67099d7eLU, 0x641078e0LU, 0x7597df64LU, 0x768e3afaLU, 0x73a55815LU, 0x70bcbd8bLU, 0x79f39c86LU, 0x7aea7918LU, 0x7fc11bf7LU, 0x7cd8fe69LU, 0x5d8218b2LU, 0x5e9bfd2cLU, 0x5bb09fc3LU, 0x58a97a5dLU, 0x51e65b50LU, 0x52ffbeceLU, 0x57d4dc21LU, 0x54cd39bfLU, 0x454a9e3bLU, 0x46537ba5LU, 0x4378194aLU, 0x4061fcd4LU, 0x492eddd9LU, 0x4a373847LU, 0x4f1c5aa8LU, 0x4c05bf36LU }; #endif /* TWOFISH_ALL_TABLES */ #endif --- NEW FILE: rc5.c --- #include "mycrypt.h" #ifdef RC5 const struct _cipher_descriptor rc5_desc = { "rc5", 2, 8, 128, 8, 12, &rc5_setup, &rc5_ecb_encrypt, &rc5_ecb_decrypt, &rc5_test, &rc5_keysize }; static const ulong32 stab[50] = { 0xb7e15163UL, 0x5618cb1cUL, 0xf45044d5UL, 0x9287be8eUL, 0x30bf3847UL, 0xcef6b200UL, 0x6d2e2bb9UL, 0x0b65a572UL, 0xa99d1f2bUL, 0x47d498e4UL, 0xe60c129dUL, 0x84438c56UL, 0x227b060fUL, 0xc0b27fc8UL, 0x5ee9f981UL, 0xfd21733aUL, 0x9b58ecf3UL, 0x399066acUL, 0xd7c7e065UL, 0x75ff5a1eUL, 0x1436d3d7UL, 0xb26e4d90UL, 0x50a5c749UL, 0xeedd4102UL, 0x8d14babbUL, 0x2b4c3474UL, 0xc983ae2dUL, 0x67bb27e6UL, 0x05f2a19fUL, 0xa42a1b58UL, 0x42619511UL, 0xe0990ecaUL, 0x7ed08883UL, 0x1d08023cUL, 0xbb3f7bf5UL, 0x5976f5aeUL, 0xf7ae6f67UL, 0x95e5e920UL, 0x341d62d9UL, 0xd254dc92UL, 0x708c564bUL, 0x0ec3d004UL, 0xacfb49bdUL, 0x4b32c376UL, 0xe96a3d2fUL, 0x87a1b6e8UL, 0x25d930a1UL, 0xc410aa5aUL, 0x62482413UL, 0x007f9dccUL }; #ifdef CLEAN_STACK static int _rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) #else int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) #endif { ulong32 L[64], *S, A, B, i, j, v, s, t, l; _ARGCHK(skey != NULL); _ARGCHK(key != NULL); /* test parameters */ if (num_rounds == 0) { num_rounds = rc5_desc.default_rounds; } if (num_rounds < 12 || num_rounds > 24) { return CRYPT_INVALID_ROUNDS; } /* key must be between 64 and 1024 bits */ if (keylen < 8 || keylen > 128) { return CRYPT_INVALID_KEYSIZE; } skey->rc5.rounds = num_rounds; S = skey->rc5.K; /* copy the key into the L array */ for (A = i = j = 0; i < (ulong32)keylen; ) { A = (A << 8) | ((ulong32)(key[i++] & 255)); if ((i & 3) == 0) { L[j++] = BSWAP(A); A = 0; } } if ((keylen & 3) != 0) { A <<= (ulong32)((8 * (4 - (keylen&3)))); L[j++] = BSWAP(A); } /* setup the S array */ t = (ulong32)(2 * (num_rounds + 1)); memcpy(S, stab, t * sizeof(*S)); /* mix buffer */ s = 3 * MAX(t, j); l = j; for (A = B = i = j = v = 0; v < s; v++) { A = S[i] = ROL(S[i] + A + B, 3); B = L[j] = ROL(L[j] + A + B, (A+B)); if (++i == t) { i = 0; } if (++j == l) { j = 0; } } return CRYPT_OK; } #ifdef CLEAN_STACK int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) { int x; x = _rc5_setup(key, keylen, num_rounds, skey); burn_stack(sizeof(ulong32) * 122 + sizeof(int)); return x; } #endif #ifdef CLEAN_STACK static void _rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *key) #else void rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *key) #endif { ulong32 A, B, *K; int r; _ARGCHK(key != NULL); _ARGCHK(pt != NULL); _ARGCHK(ct != NULL); LOAD32L(A, &pt[0]); LOAD32L(B, &pt[4]); A += key->rc5.K[0]; B += key->rc5.K[1]; K = key->rc5.K + 2; if ((key->rc5.rounds & 1) == 0) { for (r = 0; r < key->rc5.rounds; r += 2) { A = ROL(A ^ B, B) + K[0]; B = ROL(B ^ A, A) + K[1]; A = ROL(A ^ B, B) + K[2]; B = ROL(B ^ A, A) + K[3]; K += 4; } } else { for (r = 0; r < key->rc5.rounds; r++) { A = ROL(A ^ B, B) + K[0]; B = ROL(B ^ A, A) + K[1]; K += 2; } } STORE32L(A, &ct[0]); STORE32L(B, &ct[4]); } #ifdef CLEAN_STACK void rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *key) { _rc5_ecb_encrypt(pt, ct, key); burn_stack(sizeof(ulong32)... [truncated message content] |