Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-09-15 17:02:37 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-09-15 17:02:37 +0400
commit30293dc2ca8052ad0c7113c77365feca590f4d05 (patch)
treec5f4a092be7204ef2107792c0a16c0d9f331dbba /source/gameengine/GamePlayer
parente715a7185ca176c8a73cd638d4acaa40f75a7d77 (diff)
parent9648c6016b35a72aa23395f5d200e342df16490b (diff)
svn merge -r39834:40222 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/gameengine/GamePlayer')
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.cpp22
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.h7
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_ghost.cpp14
3 files changed, 35 insertions, 8 deletions
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index c5daae9c963..7b47d74d424 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -151,7 +151,7 @@ GPG_Application::~GPG_Application(void)
-bool GPG_Application::SetGameEngineData(struct Main* maggie, Scene *scene, int argc, char **argv)
+bool GPG_Application::SetGameEngineData(struct Main* maggie, Scene *scene, GlobalSettings *gs, int argc, char **argv)
{
bool result = false;
@@ -168,6 +168,9 @@ bool GPG_Application::SetGameEngineData(struct Main* maggie, Scene *scene, int a
m_argc= argc;
m_argv= argv;
+ /* Global Settings */
+ m_globalSettings= gs;
+
return result;
}
@@ -192,7 +195,7 @@ static LRESULT CALLBACK screenSaverWindowProc(HWND hwnd, UINT uMsg, WPARAM wPara
LONG dx = scr_save_mouse_pos.x - pt.x;
LONG dy = scr_save_mouse_pos.y - pt.y;
if (abs(dx) > SCR_SAVE_MOUSE_MOVE_THRESHOLD
- || abs(dy) > SCR_SAVE_MOUSE_MOVE_THRESHOLD)
+ || abs(dy) > SCR_SAVE_MOUSE_MOVE_THRESHOLD)
{
close = TRUE;
}
@@ -511,6 +514,12 @@ int GPG_Application::getExitRequested(void)
}
+GlobalSettings* GPG_Application::getGlobalSettings(void)
+{
+ return m_ketsjiengine->GetGlobalSettings();
+}
+
+
const STR_String& GPG_Application::getExitString(void)
{
@@ -552,7 +561,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
if(GPU_glsl_support())
m_blenderglslmat = (SYS_GetCommandLineInt(syshandle, "blender_glsl_material", 1) != 0);
- else if(gm->matmode == GAME_MAT_GLSL)
+ else if(m_globalSettings->matmode == GAME_MAT_GLSL)
m_blendermat = false;
// create the canvas, rasterizer and rendertools
@@ -629,6 +638,9 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
m_ketsjiengine->SetTimingDisplay(frameRate, profile, properties);
m_ketsjiengine->SetRestrictAnimationFPS(restrictAnimFPS);
+ //set the global settings (carried over if restart/load new files)
+ m_ketsjiengine->SetGlobalSettings(m_globalSettings);
+
m_engineInitialized = true;
}
@@ -685,9 +697,9 @@ bool GPG_Application::startEngine(void)
// if (always_use_expand_framing)
// sceneconverter->SetAlwaysUseExpandFraming(true);
- if(m_blendermat && (m_startScene->gm.matmode != GAME_MAT_TEXFACE))
+ if(m_blendermat && (m_globalSettings->matmode != GAME_MAT_TEXFACE))
m_sceneconverter->SetMaterials(true);
- if(m_blenderglslmat && (m_startScene->gm.matmode == GAME_MAT_GLSL))
+ if(m_blenderglslmat && (m_globalSettings->matmode == GAME_MAT_GLSL))
m_sceneconverter->SetGLSLMaterials(true);
KX_Scene* startscene = new KX_Scene(m_keyboard,
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.h b/source/gameengine/GamePlayer/ghost/GPG_Application.h
index c0638517657..df87aea1195 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.h
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.h
@@ -39,6 +39,8 @@
#include <wtypes.h>
#endif
+#include "KX_KetsjiEngine.h"
+
class KX_KetsjiEngine;
class KX_ISceneConverter;
class NG_LoopBackNetworkDeviceInterface;
@@ -61,7 +63,7 @@ public:
GPG_Application(GHOST_ISystem* system);
~GPG_Application(void);
- bool SetGameEngineData(struct Main* maggie, struct Scene* scene, int argc, char** argv);
+ bool SetGameEngineData(struct Main* maggie, struct Scene* scene, GlobalSettings* gs, int argc, char** argv);
bool startWindow(STR_String& title, int windowLeft, int windowTop, int windowWidth, int windowHeight,
const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0);
bool startFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0);
@@ -74,6 +76,7 @@ public:
virtual bool processEvent(GHOST_IEvent* event);
int getExitRequested(void);
const STR_String& getExitString(void);
+ GlobalSettings* getGlobalSettings(void);
bool StartGameEngine(int stereoMode);
void StopGameEngine();
@@ -111,6 +114,8 @@ protected:
/* Exit state. */
int m_exitRequested;
STR_String m_exitString;
+ GlobalSettings* m_globalSettings;
+
/* GHOST system abstraction. */
GHOST_ISystem* m_system;
/* Main window. */
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index 5318c417916..2695a67ac4f 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -751,6 +751,11 @@ int main(int argc, char** argv)
if(filename[0])
BLI_path_cwd(filename);
+
+ // fill the GlobalSettings with the first scene files
+ // those may change during the game and persist after using Game Actuator
+ GlobalSettings gs;
+
do
{
// Read the Blender file
@@ -804,9 +809,13 @@ int main(int argc, char** argv)
Scene *scene = bfd->curscene;
G.main = maggie;
- if (firstTimeRunning)
+ if (firstTimeRunning) {
G.fileflags = bfd->fileflags;
+ gs.matmode= scene->gm.matmode;
+ gs.glslflag= scene->gm.flag;
+ }
+
//Seg Fault; icon.c gIcons == 0
BKE_icons_init(1);
@@ -866,7 +875,7 @@ int main(int argc, char** argv)
}
// GPG_Application app (system, maggie, startscenename);
- app.SetGameEngineData(maggie, scene, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */
+ app.SetGameEngineData(maggie, scene, &gs, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */
BLI_strncpy(pathname, maggie->name, sizeof(pathname));
if(G.main != maggie) {
BLI_strncpy(G.main->name, maggie->name, sizeof(G.main->name));
@@ -962,6 +971,7 @@ int main(int argc, char** argv)
{
run = false;
exitstring = app.getExitString();
+ gs = *app.getGlobalSettings();
}
}
app.StopGameEngine();