Permalink
Browse files

Merging branch GML to trunk

git-svn-id: https://spring.clan-sy.com/svn/spring/trunk@6045 37977431-3df6-0310-b722-df95706aa16b
  • Loading branch information...
1 parent 58868ea commit 48b69c7d4e6e4340c1d0ded02f76ea28e0c3e2c6 zerver committed Jun 19, 2008
Showing with 10,324 additions and 418 deletions.
  1. +49 −7 rts/Game/Game.cpp
  2. +8 −0 rts/Game/Game.h
  3. +9 −2 rts/Game/GameController.cpp
  4. +4 −1 rts/Game/GameServer.cpp
  5. +0 −1 rts/Game/PlayerRoster.cpp
  6. +1 −1 rts/Game/UI/HwMouseCursor.cpp
  7. +2 −2 rts/Lua/LuaMaterial.h
  8. +2 −0 rts/Lua/LuaOpenGL.cpp
  9. +1 −0 rts/Lua/LuaParser.cpp
  10. +1 −0 rts/Lua/LuaVFS.cpp
  11. +1 −2 rts/Map/ReadMap.h
  12. +2 −3 rts/Map/SM3/Frustum.cpp
  13. +1 −2 rts/Map/SM3/Sm3GroundDrawer.cpp
  14. +1 −2 rts/Map/SM3/Sm3Map.cpp
  15. +1 −2 rts/Map/SM3/terrain/QuadRenderData.cpp
  16. +1 −2 rts/Map/SM3/terrain/Terrain.cpp
  17. +1 −2 rts/Map/SM3/terrain/TerrainBase.h
  18. +795 −2 rts/Map/SMF/BFGroundDrawer.cpp
  19. +11 −0 rts/Map/SMF/BFGroundDrawer.h
  20. +1 −2 rts/Map/SMF/BFGroundTextures.h
  21. +12 −8 rts/Map/SMF/SmfReadMap.cpp
  22. +29 −28 rts/Rendering/Env/AdvTreeDrawer.cpp
  23. +0 −1 rts/Rendering/Env/GrassDrawer.cpp
  24. +95 −112 rts/Rendering/GL/VertexArray.cpp
  25. +71 −69 rts/Rendering/GL/VertexArray.h
  26. +20 −53 rts/Rendering/GL/VertexArrayRange.cpp
  27. +18 −1 rts/Rendering/GL/myGL.cpp
  28. +4 −0 rts/Rendering/GL/myGL.h
  29. +2 −1 rts/Rendering/GroundDecalHandler.cpp
  30. +1 −1 rts/Rendering/Textures/nv_dds.h
  31. +1 −1 rts/Rendering/UnitModels/3DOParser.cpp
  32. +171 −15 rts/Rendering/UnitModels/UnitDrawer.cpp
  33. +18 −4 rts/Rendering/UnitModels/UnitDrawer.h
  34. +0 −1 rts/Sim/Features/FeatureHandler.cpp
  35. +7 −7 rts/Sim/Path/PathEstimator.cpp
  36. +1 −1 rts/Sim/Projectiles/Projectile.cpp
  37. +2 −2 rts/Sim/Projectiles/ProjectileHandler.cpp
  38. +1 −1 rts/Sim/Units/UnitHandler.cpp
  39. +2 −0 rts/System/BaseNetProtocol.cpp
  40. +1 −1 rts/System/FileSystem/FileFilter.cpp
  41. +1 −0 rts/System/FileSystem/FileHandler.cpp
  42. +1 −0 rts/System/Platform/FileSystem.cpp
  43. +1 −1 rts/System/Platform/Win/AVIGenerator.cpp
  44. +0 −4 rts/System/Platform/Win/DxSound.h
  45. +1 −0 rts/System/Platform/Win/WinFileSystemHandler.cpp
  46. +3 −0 rts/System/Platform/Win/win32.h
  47. +4 −0 rts/System/StdAfx.h
  48. +0 −1 rts/System/Sync/SyncedPrimitive.h
  49. +5 −2 rts/build/vstudio8/rts.sln
  50. +1,818 −69 rts/build/vstudio8/rts.vcproj
  51. +973 −0 rts/lib/gml/gml.cpp
  52. +135 −0 rts/lib/gml/gml.h
  53. +889 −0 rts/lib/gml/gmlcls.h
  54. +528 −0 rts/lib/gml/gmldef.h
  55. +1,228 −0 rts/lib/gml/gmlfun.h
  56. +3,122 −0 rts/lib/gml/gmlimp.h
  57. +263 −0 rts/lib/gml/gmlsrv.h
  58. +4 −1 rts/lib/luabind/luabind/lua_include.hpp
  59. BIN rts/spring.ico
  60. BIN rts/spring.new.ico
View
@@ -11,7 +11,6 @@
#include <sstream>
#include "Rendering/GL/myGL.h"
-#include <GL/glu.h>
#include <SDL_keyboard.h>
#include <SDL_keysym.h>
#include <SDL_mouse.h>
@@ -150,13 +149,16 @@
#include <boost/thread/thread.hpp>
#include <boost/bind.hpp>
+#include <boost/thread/barrier.hpp>
+
+#include "lib/gml/gmlsrv.h"
+gmlClientServer<void, int,CUnit*> gmlProcessor;
extern Uint8 *keys;
extern bool globalQuit;
extern bool fullscreen;
extern string stupidGlobalMapname;
-
CGame* game = NULL;
@@ -2449,6 +2451,7 @@ bool CGame::DrawWorld()
//transparent stuff
glEnable(GL_BLEND);
glDepthFunc(GL_LEQUAL);
+
if (drawGround) {
if (treeDrawer->drawTrees) {
treeDrawer->DrawGrass();
@@ -2540,9 +2543,22 @@ bool CGame::DrawWorld()
return true;
}
+#if GML_ENABLE_DRAWALL
+bool CGame::Draw() {
+#else
+bool CGame::DrawMT() {
+#endif
+ gmlProcessor.Work(&CGame::DrawMTcb,NULL,NULL,this,gmlThreadCount,TRUE,NULL,1,2,2,FALSE);
+ return TRUE;
+}
+
+
+#if GML_ENABLE_DRAWALL
+bool CGame::DrawMT() {
+#else
+bool CGame::Draw() {
+#endif
-bool CGame::Draw()
-{
ASSERT_UNSYNCED_MODE;
SetDrawMode(normalDraw);
@@ -2943,8 +2959,29 @@ void CGame::StartPlaying()
}
-void CGame::SimFrame()
-{
+
+// This will be run by a separate thread in parallel with the Sim
+// ONLY 100% THREAD SAFE UNSYNCED STUFF HERE PLEASE
+void CGame::UnsyncedStuff() {
+ if(!skipping) {
+ infoConsole->Update();
+ }
+}
+
+
+#if GML_ENABLE_SIM
+void CGame::SimFrame() {
+#else
+void CGame::SimFrameMT() {
+#endif
+ gmlProcessor.Work(&CGame::SimFrameMTcb,NULL,NULL,this,2,FALSE,NULL,1,2,2,FALSE,&CGame::UnsyncedStuffcb);
+}
+
+#if GML_ENABLE_SIM
+void CGame::SimFrameMT() {
+#else
+void CGame::SimFrame() {
+#endif
good_fpu_control_registers("CGame::SimFrame");
lastFrameTime = SDL_GetTicks();
ASSERT_SYNCED_MODE;
@@ -2970,7 +3007,10 @@ void CGame::SimFrame()
ENTER_UNSYNCED;
if (!skipping) {
- infoConsole->Update();
+#if !GML_ENABLE_SIM
+ UnsyncedStuff();
+#endif
+// infoConsole->Update();
waitCommandsAI.Update();
geometricObjects->Update();
if(!(gs->frameNum & 7))
@@ -3717,6 +3757,8 @@ void CGame::ClientReadNet()
gu->spectating = false;
gu->spectatingFullView = false;
gu->spectatingFullSelect = false;
+ gu->spectatingFullView = false;
+ gu->spectatingFullSelect = false;
selectedUnits.ClearSelected();
unitTracker.Disable();
CLuaUI::UpdateTeams();
View
@@ -31,7 +31,15 @@ class CGame : public CGameController
CR_DECLARE(CGame); //Don't use CGame pointer in CR_MEMBER()!!!
void PostLoad();
+ void SimFrameMT();
+ static void SimFrameMTcb(void *c) {((CGame *)c)->SimFrameMT();}
+
bool Draw();
+ bool DrawMT();
+
+ static void DrawMTcb(void *c) {((CGame *)c)->DrawMT();}
+ void UnsyncedStuff();
+ static void UnsyncedStuffcb(void *c) {((CGame *)c)->UnsyncedStuff();}
bool Update();
int KeyReleased(unsigned short k);
int KeyPressed(unsigned short k,bool isRepeat);
@@ -30,8 +30,15 @@ bool CGameController::Draw(void)
{
return true;
}
-
-
+/*
+bool CGameController::Draw2(void)
+{
+ return true;
+}*/
+/*bool CGameController::DrawMT(void)
+{
+ return true;
+}*/
bool CGameController::Update(void)
{
@@ -1,3 +1,4 @@
+#include "StdAfx.h"
#include "GameServer.h"
#include <stdarg.h>
@@ -37,6 +38,7 @@ namespace std { using ::ceil; }
#endif
using netcode::RawPacket;
+
/// frames until a syncchech will time out and a warning is given out
const int SYNCCHECK_TIMEOUT = 300;
@@ -1240,7 +1242,7 @@ void CGameServer::CheckForGameEnd()
void CGameServer::CreateNewFrame(bool fromServerThread, bool fixedFrameTime)
{
-#if BOOST_VERSION >= 103500
+#if (BOOST_VERSION >= 103500)
if (!fromServerThread)
boost::recursive_mutex::scoped_lock scoped_lock(gameServerMutex, boost::defer_lock);
else
@@ -1426,3 +1428,4 @@ void CGameServer::RestrictedAction(const std::string& action)
commandBlacklist.insert(action);
}
+
@@ -7,7 +7,6 @@
#include "Player.h"
#include "Team.h"
-
static int CompareAllies (const void* a, const void* b);
static int CompareTeamIDs (const void* a, const void* b);
static int ComparePlayerNames(const void* a, const void* b);
@@ -13,7 +13,7 @@
#include <SDL_syswm.h>
#ifdef WIN32
- #include "windows.h"
+ #include "windows.h"
#include "MouseInput.h"
#elif defined(__APPLE__)
/*do nothing (duno how to create cursors on runtime on macs)*/
@@ -202,7 +202,7 @@ class LuaMatBin : public LuaMaterial {
public:
void Clear() { units.clear(); }
- const vector<CUnit*>& GetUnits() const { return units; }
+ const GML_VECTOR<CUnit*>& GetUnits() const { return units; }
void Ref();
void UnRef();
@@ -218,7 +218,7 @@ class LuaMatBin : public LuaMaterial {
private:
int refCount;
- vector<CUnit*> units;
+ GML_VECTOR<CUnit*> units;
};
@@ -65,6 +65,8 @@ using std::string;
using std::vector;
using std::set;
+#undef far // avoid collision with windef.h
+#undef near
static const int MAX_TEXTURE_UNITS = 32;
@@ -6,6 +6,7 @@
#include "LuaParser.h"
#include <algorithm>
+#include <limits.h>
#include <boost/regex.hpp>
#include <SDL_timer.h>
View
@@ -7,6 +7,7 @@
#include <set>
#include <list>
#include <cctype>
+#include <limits.h>
#include <boost/regex.hpp>
using namespace std;
View
@@ -4,8 +4,7 @@
//
//////////////////////////////////////////////////////////////////////
-#define GLEW_STATIC
-#include <GL/glew.h>
+#include "Rendering/GL/myGL.h"
#include "creg/creg.h"
#include "float3.h"
@@ -9,9 +9,8 @@
#include "Frustum.h"
-#define GLEW_STATIC
-#include <GL/glew.h>
-
+#include "Rendering/GL/myGL.h"
+#undef far // avoid collision with windef.h
void Frustum::InversePlanes ()
{
@@ -8,9 +8,8 @@
#include "Rendering/ShadowHandler.h"
#include "Sim/Projectiles/ProjectileHandler.h"
#include "Rendering/GroundDecalHandler.h"
+#include "Rendering/GL/myGL.h"
#include "Map/MapInfo.h"
-#define GLEW_STATIC
-#include <GL/glew.h>
#include "Platform/ConfigHandler.h"
#include <SDL_keysym.h>
@@ -4,8 +4,7 @@
#include "Sm3GroundDrawer.h"
#include "LogOutput.h"
-#define GLEW_STATIC
-#include <GL/glew.h>
+#include "Rendering/GL/myGL.h"
#include <IL/il.h>
#include <SDL_types.h>
#include "Map/MapInfo.h"
@@ -28,8 +28,7 @@
*/
#include "StdAfx.h"
-#define GLEW_STATIC
-#include <GL/glew.h>
+#include "Rendering/GL/myGL.h"
#include "TerrainBase.h"
#include "TerrainNode.h"
@@ -28,8 +28,7 @@
*/
#include "StdAfx.h"
-#define GLEW_STATIC
-#include <GL/glew.h>
+#include "Rendering/GL/myGL.h"
#include "TerrainBase.h"
#include "Terrain.h"
@@ -29,8 +29,7 @@
#ifndef TERRAIN_BASE_H
#define TERRAIN_BASE_H
-#define GLEW_STATIC
-#include <GL/glew.h>
+#include "Rendering/GL/myGL.h"
#include "../Frustum.h"
#include "Matrix44f.h"
Oops, something went wrong.

0 comments on commit 48b69c7

Please sign in to comment.