# HG changeset patch
# User Nomad
# Date 1385838037 -7200
# Node ID 62a27b2cfcc26590384b7bfff5e55483736a787e
# Parent 64e23bf9d27ee2ca8bf8d0c8e5c72729f98278c1
Player.swig
diff -r 64e23bf9d27e -r 62a27b2cfcc2 Build/Visual Studio 2012/World of Might and Magic.vcxproj
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj Fri Nov 29 12:20:44 2013 +0200
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj Sat Nov 30 21:00:37 2013 +0200
@@ -166,6 +166,7 @@
+
@@ -188,6 +189,7 @@
+
@@ -226,7 +228,6 @@
-
@@ -386,8 +387,15 @@
Document
call "../../lib/swig" "%(FileName)" %(RelativeDir) "%(FileName)%(Extension)" "%(FullPath)" "$(SolutionDir)" %(Filename)_wrap.cxx
%(Filename)_wrap.cxx
+ %(Filename).swig
+
+ Document
+ call "../../lib/swig" "%(FileName)" %(RelativeDir) "%(FileName)%(Extension)" "%(FullPath)" "$(SolutionDir)" %(Filename)_wrap.cxx
+ %(Filename)_wrap.cxx
+ %(Filename).swig
+
diff -r 64e23bf9d27e -r 62a27b2cfcc2 Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters Fri Nov 29 12:20:44 2013 +0200
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters Sat Nov 30 21:00:37 2013 +0200
@@ -308,7 +308,8 @@
NewUI\Core
-
+
+
@@ -608,5 +609,6 @@
NewUI\Core
+
\ No newline at end of file
diff -r 64e23bf9d27e -r 62a27b2cfcc2 LuaVM.h
--- a/LuaVM.h Fri Nov 29 12:20:44 2013 +0200
+++ b/LuaVM.h Sat Nov 30 21:00:37 2013 +0200
@@ -3,6 +3,8 @@
class LuaVM
{
public:
+ inline LuaVM(): L(nullptr) {}
+
void Initialize();
bool DoFile(const char *filename);
diff -r 64e23bf9d27e -r 62a27b2cfcc2 NewUI/Core/UIControl.h
--- a/NewUI/Core/UIControl.h Fri Nov 29 12:20:44 2013 +0200
+++ b/NewUI/Core/UIControl.h Sat Nov 30 21:00:37 2013 +0200
@@ -10,45 +10,11 @@
virtual bool Focused() = 0;
// Events
- virtual bool OnKey(int key)
- {
- for (auto i = children.begin(); i != children.end(); ++i)
- if ((*i)->OnKey(key))
- return true;
- return false;
- }
-
- virtual bool OnMouseLeftClick(int x, int y)
- {
- for (auto i = children.begin(); i != children.end(); ++i)
- if ((*i)->OnMouseLeftClick(x, y))
- return true;
- return false;
- }
-
- virtual bool OnMouseRightClick(int x, int y)
- {
- for (auto i = children.begin(); i != children.end(); ++i)
- if ((*i)->OnMouseRightClick(x, y))
- return true;
- return false;
- }
-
- virtual bool OnMouseEnter()
- {
- for (auto i = children.begin(); i != children.end(); ++i)
- if ((*i)->OnMouseEnter())
- return true;
- return false;
- }
-
- virtual bool OnMouseLeave()
- {
- for (auto i = children.begin(); i != children.end(); ++i)
- if ((*i)->OnMouseLeave())
- return true;
- return false;
- }
+ virtual bool OnKey(int key) {return DefaultOnKey(key);}
+ virtual bool OnMouseLeftClick(int x, int y) {return DefaultOnMouseLeftClick(x, y);}
+ virtual bool OnMouseRightClick(int x, int y) {return DefaultOnMouseRightClick(x, y);}
+ virtual bool OnMouseEnter() {return DefaultOnMouseEnter();}
+ virtual bool OnMouseLeave() {return DefaultOnMouseLeave();}
// Container
virtual bool AddControl(UIControl *ctrl)
@@ -56,6 +22,7 @@
if (std::find(children.begin(), children.end(), ctrl) == children.end())
{
children.push_back(ctrl);
+ ctrl->parent = this;
return true;
}
return false;
@@ -67,10 +34,55 @@
children.remove(ctrl);
if (i != children.end())
+ {
+ ctrl->parent = nullptr;
return true;
+ }
return false;
}
protected:
- std::list children;
+ UIControl *parent;
+ std::list children;
+
+
+ bool DefaultOnKey(int key)
+ {
+ for (auto i = children.begin(); i != children.end(); ++i)
+ if ((*i)->OnKey(key))
+ return true;
+ return false;
+ }
+
+ bool DefaultOnMouseLeftClick(int x, int y)
+ {
+ for (auto i = children.begin(); i != children.end(); ++i)
+ if ((*i)->OnMouseLeftClick(x, y))
+ return true;
+ return false;
+ }
+
+ bool DefaultOnMouseRightClick(int x, int y)
+ {
+ for (auto i = children.begin(); i != children.end(); ++i)
+ if ((*i)->OnMouseRightClick(x, y))
+ return true;
+ return false;
+ }
+
+ bool DefaultOnMouseEnter()
+ {
+ for (auto i = children.begin(); i != children.end(); ++i)
+ if ((*i)->OnMouseEnter())
+ return true;
+ return false;
+ }
+
+ bool DefaultOnMouseLeave()
+ {
+ for (auto i = children.begin(); i != children.end(); ++i)
+ if ((*i)->OnMouseLeave())
+ return true;
+ return false;
+ }
};
\ No newline at end of file
diff -r 64e23bf9d27e -r 62a27b2cfcc2 Player.cpp
--- a/Player.cpp Fri Nov 29 12:20:44 2013 +0200
+++ b/Player.cpp Sat Nov 30 21:00:37 2013 +0200
@@ -34,6 +34,9 @@
+NZIArray pPlayers;
+
+
/* 381 */
#pragma pack(push, 1)
struct PlayerCreation_AttributeProps
diff -r 64e23bf9d27e -r 62a27b2cfcc2 Player.h
--- a/Player.h Fri Nov 29 12:20:44 2013 +0200
+++ b/Player.h Sat Nov 30 21:00:37 2013 +0200
@@ -840,3 +840,5 @@
char field_1B3B;
};
#pragma pack(pop)
+
+extern NZIArray pPlayers;
\ No newline at end of file
diff -r 64e23bf9d27e -r 62a27b2cfcc2 Player.swig
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Player.swig Sat Nov 30 21:00:37 2013 +0200
@@ -0,0 +1,6 @@
+%module Player
+%{
+ #include "Player.h"
+%}
+
+%include "../../../Player.h"
\ No newline at end of file
diff -r 64e23bf9d27e -r 62a27b2cfcc2 Player_wrap.cxx
diff -r 64e23bf9d27e -r 62a27b2cfcc2 lib/swig.bat
--- a/lib/swig.bat Fri Nov 29 12:20:44 2013 +0200
+++ b/lib/swig.bat Sat Nov 30 21:00:37 2013 +0200
@@ -1,4 +1,3 @@
-@echo off
rem echo 1 %1
rem echo 2 %2
rem echo 3 %3
@@ -6,6 +5,8 @@
rem echo 5 %5
rem echo 6 %6
+set WOMM_SWIG_SOLUTION_DIR=%CD%
+
rem echo xcopy %4 "../../lib/swig/swigwin-2.0.11" /y
xcopy %4 "../../lib/swig/swigwin-2.0.11" /y
@@ -13,4 +14,7 @@
swig -c++ -lua %3
rem echo xcopy "%6" %5"%2" /y
-xcopy "%6" %5"%2" /y
\ No newline at end of file
+xcopy "%6" %5"%2" /y
+
+rem echo chdir /d %WOMM_SWIG_SOLUTION_DIR%
+chdir /d %WOMM_SWIG_SOLUTION_DIR%
\ No newline at end of file
diff -r 64e23bf9d27e -r 62a27b2cfcc2 mm7_data.cpp
--- a/mm7_data.cpp Fri Nov 29 12:20:44 2013 +0200
+++ b/mm7_data.cpp Sat Nov 30 21:00:37 2013 +0200
@@ -1305,7 +1305,6 @@
struct Texture *pTexture_PlayerFaceEradicated;
struct Texture *pTexture_PlayerFaceDead;
std::array< std::array, 4> pTextures_PlayerFaces;
-NZIArray pPlayers;
__int64 qword_A750D8; // weak
enum PlayerSpeech PlayerSpeechID;
int uSpeakingCharacter; // weak
diff -r 64e23bf9d27e -r 62a27b2cfcc2 mm7_data.h
--- a/mm7_data.h Fri Nov 29 12:20:44 2013 +0200
+++ b/mm7_data.h Sat Nov 30 21:00:37 2013 +0200
@@ -963,7 +963,6 @@
extern struct Texture *pTexture_PlayerFaceDead;
extern std::array< std::array, 4> pTextures_PlayerFaces;
extern int dword_A75070; // weak
-extern NZIArray pPlayers;
extern __int64 qword_A750D8; // weak
extern enum PlayerSpeech PlayerSpeechID;
extern int uSpeakingCharacter; // weak