Skip to content

Commit e68a029

Browse files
committed
Clean up client Drawing luadefs
(cherry picked from commit 5f41859)
1 parent 39faccb commit e68a029

14 files changed

+1582
-1656
lines changed

MTA10/mods/deathmatch/StdInc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
#include <luadefs/CLuaBrowserDefs.h>
112112
#include <luadefs/CLuaClassDefs.h>
113113
#include <luadefs/CLuaCameraDefs.h>
114+
#include <luadefs/CLuaDrawingDefs.h>
114115
#include <luadefs/CLuaElementDefs.h>
115116
#include <luadefs/CLuaMarkerDefs.h>
116117
#include <luadefs/CLuaObjectDefs.h>
@@ -129,7 +130,6 @@
129130
#include <luadefs/CLuaTeamDefs.h>
130131
#include <luadefs/CLuaFxDefs.h>
131132
#include <luadefs/CLuaFileDefs.h>
132-
#include <lua/oopdefs/CLuaOOPDefs.h>
133133
#include <CRemoteCalls.h>
134134

135135
// Shared includes

MTA10/mods/deathmatch/_Deathmatch 2008.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@
370370
<ClCompile Include="..\shared_logic\luadefs\CLuaBlipDefs.cpp" />
371371
<ClCompile Include="..\shared_logic\luadefs\CLuaBrowserDefs.cpp" />
372372
<ClCompile Include="..\shared_logic\luadefs\CLuaCameraDefs.cpp" />
373+
<ClCompile Include="..\shared_logic\luadefs\CLuaDrawingDefs.cpp" />
373374
<ClCompile Include="..\shared_logic\luadefs\CLuaElementDefs.cpp" />
374375
<ClCompile Include="..\shared_logic\luadefs\CLuaMarkerDefs.cpp" />
375376
<ClCompile Include="..\shared_logic\luadefs\CLuaObjectDefs.cpp" />
@@ -387,7 +388,6 @@
387388
<ClCompile Include="..\shared_logic\lua\CLuaVector2.cpp" />
388389
<ClCompile Include="..\shared_logic\lua\CLuaVector3.cpp" />
389390
<ClCompile Include="..\shared_logic\lua\CLuaVector4.cpp" />
390-
<ClCompile Include="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.Drawing.cpp" />
391391
<ClCompile Include="..\shared_logic\CClientWebBrowser.cpp" />
392392
<ClCompile Include="CClient.cpp" />
393393
<ClCompile Include="Client.cpp" />
@@ -573,7 +573,6 @@
573573
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.BodyClothes.cpp" />
574574
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Commands.cpp" />
575575
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.cpp" />
576-
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Drawing.cpp" />
577576
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Engine.cpp" />
578577
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Event.cpp" />
579578
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.GUI.cpp" />
@@ -761,6 +760,7 @@
761760
<ClInclude Include="..\shared_logic\luadefs\CLuaBlipDefs.h" />
762761
<ClInclude Include="..\shared_logic\luadefs\CLuaBrowserDefs.h" />
763762
<ClInclude Include="..\shared_logic\luadefs\CLuaCameraDefs.h" />
763+
<ClInclude Include="..\shared_logic\luadefs\CLuaDrawingDefs.h" />
764764
<ClInclude Include="..\shared_logic\luadefs\CLuaElementDefs.h" />
765765
<ClInclude Include="..\shared_logic\luadefs\CLuaMarkerDefs.h" />
766766
<ClInclude Include="..\shared_logic\luadefs\CLuaObjectDefs.h" />

MTA10/mods/deathmatch/_Deathmatch 2008.vcxproj.filters

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
<Filter Include="Source Files\shared_logic\lua">
1818
<UniqueIdentifier>{72ea805f-d464-4727-b50e-22ef5cedd747}</UniqueIdentifier>
1919
</Filter>
20-
<Filter Include="Source Files\shared_logic\lua\oopdefs">
21-
<UniqueIdentifier>{f9f63459-5d42-4049-bbb3-64799e25b896}</UniqueIdentifier>
22-
</Filter>
2320
<Filter Include="Source Files\shared_logic\utils">
2421
<UniqueIdentifier>{55d7d751-fc86-415e-89a5-6d757b618ebb}</UniqueIdentifier>
2522
</Filter>
@@ -575,9 +572,6 @@
575572
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.cpp">
576573
<Filter>Source Files\shared_logic\lua</Filter>
577574
</ClCompile>
578-
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Drawing.cpp">
579-
<Filter>Source Files\shared_logic\lua</Filter>
580-
</ClCompile>
581575
<ClCompile Include="..\shared_logic\lua\CLuaFunctionDefs.Engine.cpp">
582576
<Filter>Source Files\shared_logic\lua</Filter>
583577
</ClCompile>
@@ -770,9 +764,6 @@
770764
<ClCompile Include="..\shared_logic\lua\CLuaVector2.cpp">
771765
<Filter>Source Files\shared_logic\lua</Filter>
772766
</ClCompile>
773-
<ClCompile Include="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.Drawing.cpp">
774-
<Filter>Source Files\shared_logic\lua\oopdefs</Filter>
775-
</ClCompile>
776767
<ClCompile Include="..\..\..\vendor\lua\src\lmathlib.c">
777768
<Filter>Source Files\utils\lualib</Filter>
778769
</ClCompile>
@@ -926,6 +917,9 @@
926917
<ClCompile Include="..\shared_logic\luadefs\CLuaTeamDefs.cpp">
927918
<Filter>Source Files\shared_logic\luadefs</Filter>
928919
</ClCompile>
920+
<ClCompile Include="..\shared_logic\luadefs\CLuaDrawingDefs.cpp">
921+
<Filter>Source Files\shared_logic\luadefs</Filter>
922+
</ClCompile>
929923
</ItemGroup>
930924
<ItemGroup>
931925
<ClInclude Include="CClient.h">
@@ -1696,5 +1690,8 @@
16961690
<ClInclude Include="..\shared_logic\luadefs\CLuaTeamDefs.h">
16971691
<Filter>Header Files\shared_logic\luadefs</Filter>
16981692
</ClInclude>
1693+
<ClInclude Include="..\shared_logic\luadefs\CLuaDrawingDefs.h">
1694+
<Filter>Header Files\shared_logic\luadefs</Filter>
1695+
</ClInclude>
16991696
</ItemGroup>
17001697
</Project>

MTA10/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ CClientGame::CClientGame ( bool bLocalPlay )
299299

300300
CStaticFunctionDefinitions ( m_pLuaManager, &m_Events, g_pCore, g_pGame, this, m_pManager );
301301
CLuaFunctionDefs::Initialize ( m_pLuaManager, m_pScriptDebugging, this );
302-
CLuaOOPDefs::Initialize ( this, m_pLuaManager, m_pScriptDebugging );
303302
CLuaDefs::Initialize ( this, m_pLuaManager, m_pScriptDebugging );
304303

305304
// Disable the enter/exit vehicle key button (we want to handle this button ourselves)

MTA10/mods/shared_logic/lua/CLuaFunctionDefs.h

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -127,43 +127,6 @@ class CLuaFunctionDefs
127127
LUA_DECLARE ( EngineGetModelTextureNames );
128128
LUA_DECLARE ( EngineGetVisibleTextureNames );
129129

130-
// Drawing funcs (low-level)
131-
LUA_DECLARE ( dxDrawLine );
132-
LUA_DECLARE ( dxDrawLine3D );
133-
LUA_DECLARE ( dxDrawMaterialLine3D );
134-
LUA_DECLARE ( dxDrawMaterialSectionLine3D );
135-
LUA_DECLARE ( dxDrawText );
136-
LUA_DECLARE ( dxDrawRectangle );
137-
LUA_DECLARE ( dxDrawImage );
138-
LUA_DECLARE ( dxDrawImageSection );
139-
LUA_DECLARE ( dxGetTextWidth );
140-
LUA_DECLARE ( dxGetFontHeight );
141-
LUA_DECLARE ( dxCreateFont );
142-
LUA_DECLARE ( dxCreateTexture );
143-
LUA_DECLARE ( dxCreateShader );
144-
LUA_DECLARE ( dxCreateRenderTarget );
145-
LUA_DECLARE ( dxCreateScreenSource );
146-
LUA_DECLARE ( dxGetMaterialSize );
147-
LUA_DECLARE ( dxSetShaderValue );
148-
LUA_DECLARE ( dxSetShaderTessellation );
149-
LUA_DECLARE ( dxSetShaderTransform );
150-
LUA_DECLARE ( dxSetRenderTarget );
151-
LUA_DECLARE ( dxUpdateScreenSource );
152-
LUA_DECLARE ( dxGetStatus );
153-
LUA_DECLARE ( dxSetTestMode );
154-
LUA_DECLARE ( dxGetTexturePixels );
155-
LUA_DECLARE ( dxSetTexturePixels );
156-
LUA_DECLARE ( dxGetPixelsSize );
157-
LUA_DECLARE ( dxGetPixelsFormat );
158-
LUA_DECLARE ( dxConvertPixels );
159-
LUA_DECLARE ( dxGetPixelColor );
160-
LUA_DECLARE ( dxSetPixelColor );
161-
LUA_DECLARE ( dxSetBlendMode );
162-
LUA_DECLARE ( dxGetBlendMode );
163-
LUA_DECLARE ( dxSetAspectRatioAdjustmentEnabled );
164-
LUA_DECLARE ( dxIsAspectRatioAdjustmentEnabled );
165-
LUA_DECLARE ( dxSetTextureEdge );
166-
167130
// Util functions to make scripting easier for the end user
168131
// Some of these are based on standard mIRC script funcs as a lot of people will be used to them
169132
LUA_DECLARE ( GetTok );

MTA10/mods/shared_logic/lua/CLuaMain.cpp

Lines changed: 2 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -772,91 +772,6 @@ void CLuaMain::AddEngineDffClass ( lua_State* luaVM )
772772
lua_registerclass ( luaVM, "EngineDFF", "Element" );
773773
}
774774

775-
776-
void CLuaMain::AddDxMaterialClass ( lua_State* luaVM )
777-
{
778-
lua_newclass ( luaVM );
779-
780-
lua_classfunction ( luaVM, "getSize", "dxGetMaterialSize" );
781-
782-
lua_registerclass ( luaVM, "DxMaterial", "Element" );
783-
}
784-
785-
786-
void CLuaMain::AddDxTextureClass ( lua_State* luaVM )
787-
{
788-
lua_newclass ( luaVM );
789-
790-
lua_classfunction ( luaVM, "create", "dxCreateTexture");
791-
792-
lua_classfunction ( luaVM, "setEdge", "dxSetTextureEdge");
793-
lua_classfunction ( luaVM, "setPixels", "dxSetTexturePixels");
794-
lua_classfunction ( luaVM, "getPixels", "dxGetTexturePixels");
795-
796-
lua_registerclass ( luaVM, "DxTexture", "DxMaterial" );
797-
}
798-
799-
800-
// TODO: function specials
801-
void CLuaMain::AddDxFontClass ( lua_State* luaVM )
802-
{
803-
lua_newclass ( luaVM );
804-
805-
lua_classfunction ( luaVM, "create", "dxCreateFont");
806-
807-
lua_classfunction ( luaVM, "getHeight", CLuaOOPDefs::DxGetFontHeight );
808-
lua_classfunction ( luaVM, "getTextWidth", CLuaOOPDefs::DxGetTextWidth );
809-
810-
//lua_classvariable ( luaVM, "height", NULL, "dxGetFontHeight"); // swap arguments, .height[scale] = int(height);
811-
812-
lua_registerclass ( luaVM, "DxFont" );
813-
814-
}
815-
816-
817-
// TODO: specials
818-
void CLuaMain::AddDxShaderClass ( lua_State* luaVM )
819-
{
820-
lua_newclass ( luaVM );
821-
822-
lua_classfunction ( luaVM, "create", "dxCreateShader" );
823-
lua_classfunction ( luaVM, "applyToWorldTexture", "engineApplyShaderToWorldTexture" );
824-
lua_classfunction ( luaVM, "removeFromWorldTexture", "engineRemoveShaderFromWorldTexture" );
825-
826-
lua_classfunction ( luaVM, "setValue", "dxSetShaderValue" );
827-
lua_classfunction ( luaVM, "setTessellation", "dxSetShaderTessellation" );
828-
lua_classfunction ( luaVM, "setTransform", "dxSetShaderTransform" );
829-
830-
//lua_classvariable ( luaVM, "value", CLuaOOPDefs::SetShaderValue, NULL); // .value["param"] = value
831-
lua_classvariable ( luaVM, "tessellation", "dxSetShaderTessellation", NULL );
832-
833-
lua_registerclass ( luaVM, "DxShader", "DxMaterial" );
834-
}
835-
836-
837-
void CLuaMain::AddDxScreenSourceClass ( lua_State* luaVM )
838-
{
839-
lua_newclass ( luaVM );
840-
841-
lua_classfunction ( luaVM, "create", "dxCreateScreenSource");
842-
lua_classfunction ( luaVM, "update", "dxUpdateScreenSource");
843-
844-
lua_registerclass ( luaVM, "DxScreenSource", "DxTexture" );
845-
}
846-
847-
848-
void CLuaMain::AddDxRenderTargetClass ( lua_State* luaVM )
849-
{
850-
lua_newclass ( luaVM );
851-
852-
lua_classfunction ( luaVM, "create", "dxCreateRenderTarget");
853-
854-
lua_classfunction ( luaVM, "setAsTarget", "dxSetRenderTarget");
855-
856-
lua_registerclass ( luaVM, "DxRenderTarget", "DxTexture" );
857-
}
858-
859-
860775
void CLuaMain::InitClasses ( lua_State* luaVM )
861776
{
862777
lua_initclasses ( luaVM );
@@ -905,15 +820,10 @@ void CLuaMain::InitClasses ( lua_State* luaVM )
905820
AddEngineTxdClass ( luaVM );
906821
AddEngineDffClass ( luaVM );
907822

908-
AddDxMaterialClass ( luaVM );
909-
AddDxTextureClass ( luaVM );
910-
AddDxFontClass ( luaVM );
911-
AddDxShaderClass ( luaVM );
912-
AddDxScreenSourceClass ( luaVM );
913-
AddDxRenderTargetClass ( luaVM );
914823
CLuaBlipDefs::AddClass ( luaVM );
915-
CLuaBrowserDefs::AddClass ( luaVM );
916824
CLuaCameraDefs::AddClass ( luaVM );
825+
CLuaDrawingDefs::AddClass ( luaVM );
826+
CLuaBrowserDefs::AddClass ( luaVM ); // browser must be after drawing, since it extends DxTexture
917827
CLuaFileDefs::AddClass ( luaVM );
918828
CLuaMarkerDefs::AddClass ( luaVM );
919829
CLuaObjectDefs::AddClass ( luaVM );

MTA10/mods/shared_logic/lua/CLuaMain.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,6 @@ class CLuaMain //: public CClient
109109
void AddEngineTxdClass ( lua_State* luaVM );
110110
void AddEngineDffClass ( lua_State* luaVM );
111111

112-
void AddDxMaterialClass ( lua_State* luaVM );
113-
void AddDxTextureClass ( lua_State* luaVM );
114-
void AddDxFontClass ( lua_State* luaVM );
115-
void AddDxShaderClass ( lua_State* luaVM );
116-
void AddDxScreenSourceClass ( lua_State* luaVM );
117-
void AddDxRenderTargetClass ( lua_State* luaVM );
118-
119112
void InitClasses ( lua_State* luaVM );
120113
void InitVM ( void );
121114
const SString& GetFunctionTag ( int iLuaFunction );

MTA10/mods/shared_logic/lua/CLuaManager.cpp

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -278,43 +278,6 @@ void CLuaManager::LoadCFunctions ( void )
278278
//CLuaCFunctions::AddFunction ( "engineAddAllAtomics", CLuaFunctionDefs::EngineAddAllAtomics );
279279
//CLuaCFunctions::AddFunction ( "engineReplaceVehiclePart", CLuaFunctionDefs::EngineReplaceVehiclePart );
280280

281-
// Drawing funcs
282-
CLuaCFunctions::AddFunction ( "dxDrawLine", CLuaFunctionDefs::dxDrawLine );
283-
CLuaCFunctions::AddFunction ( "dxDrawMaterialLine3D", CLuaFunctionDefs::dxDrawMaterialLine3D );
284-
CLuaCFunctions::AddFunction ( "dxDrawMaterialSectionLine3D", CLuaFunctionDefs::dxDrawMaterialSectionLine3D );
285-
CLuaCFunctions::AddFunction ( "dxDrawLine3D", CLuaFunctionDefs::dxDrawLine3D );
286-
CLuaCFunctions::AddFunction ( "dxDrawText", CLuaFunctionDefs::dxDrawText );
287-
CLuaCFunctions::AddFunction ( "dxDrawRectangle", CLuaFunctionDefs::dxDrawRectangle );
288-
CLuaCFunctions::AddFunction ( "dxDrawImage", CLuaFunctionDefs::dxDrawImage );
289-
CLuaCFunctions::AddFunction ( "dxDrawImageSection", CLuaFunctionDefs::dxDrawImageSection );
290-
CLuaCFunctions::AddFunction ( "dxGetTextWidth", CLuaFunctionDefs::dxGetTextWidth );
291-
CLuaCFunctions::AddFunction ( "dxGetFontHeight", CLuaFunctionDefs::dxGetFontHeight );
292-
CLuaCFunctions::AddFunction ( "dxCreateFont", CLuaFunctionDefs::dxCreateFont );
293-
CLuaCFunctions::AddFunction ( "dxCreateTexture", CLuaFunctionDefs::dxCreateTexture );
294-
CLuaCFunctions::AddFunction ( "dxCreateShader", CLuaFunctionDefs::dxCreateShader );
295-
CLuaCFunctions::AddFunction ( "dxCreateRenderTarget", CLuaFunctionDefs::dxCreateRenderTarget );
296-
CLuaCFunctions::AddFunction ( "dxCreateScreenSource", CLuaFunctionDefs::dxCreateScreenSource );
297-
CLuaCFunctions::AddFunction ( "dxGetMaterialSize", CLuaFunctionDefs::dxGetMaterialSize );
298-
CLuaCFunctions::AddFunction ( "dxSetShaderValue", CLuaFunctionDefs::dxSetShaderValue );
299-
CLuaCFunctions::AddFunction ( "dxSetShaderTessellation", CLuaFunctionDefs::dxSetShaderTessellation );
300-
CLuaCFunctions::AddFunction ( "dxSetShaderTransform", CLuaFunctionDefs::dxSetShaderTransform );
301-
CLuaCFunctions::AddFunction ( "dxSetRenderTarget", CLuaFunctionDefs::dxSetRenderTarget );
302-
CLuaCFunctions::AddFunction ( "dxUpdateScreenSource", CLuaFunctionDefs::dxUpdateScreenSource );
303-
CLuaCFunctions::AddFunction ( "dxGetStatus", CLuaFunctionDefs::dxGetStatus );
304-
CLuaCFunctions::AddFunction ( "dxSetTestMode", CLuaFunctionDefs::dxSetTestMode );
305-
CLuaCFunctions::AddFunction ( "dxGetTexturePixels", CLuaFunctionDefs::dxGetTexturePixels );
306-
CLuaCFunctions::AddFunction ( "dxSetTexturePixels", CLuaFunctionDefs::dxSetTexturePixels );
307-
CLuaCFunctions::AddFunction ( "dxGetPixelsSize", CLuaFunctionDefs::dxGetPixelsSize );
308-
CLuaCFunctions::AddFunction ( "dxGetPixelsFormat", CLuaFunctionDefs::dxGetPixelsFormat );
309-
CLuaCFunctions::AddFunction ( "dxConvertPixels", CLuaFunctionDefs::dxConvertPixels );
310-
CLuaCFunctions::AddFunction ( "dxGetPixelColor", CLuaFunctionDefs::dxGetPixelColor );
311-
CLuaCFunctions::AddFunction ( "dxSetPixelColor", CLuaFunctionDefs::dxSetPixelColor );
312-
CLuaCFunctions::AddFunction ( "dxSetBlendMode", CLuaFunctionDefs::dxSetBlendMode );
313-
CLuaCFunctions::AddFunction ( "dxGetBlendMode", CLuaFunctionDefs::dxGetBlendMode );
314-
CLuaCFunctions::AddFunction ( "dxSetAspectRatioAdjustmentEnabled", CLuaFunctionDefs::dxSetAspectRatioAdjustmentEnabled );
315-
CLuaCFunctions::AddFunction ( "dxIsAspectRatioAdjustmentEnabled", CLuaFunctionDefs::dxIsAspectRatioAdjustmentEnabled );
316-
CLuaCFunctions::AddFunction ( "dxSetTextureEdge", CLuaFunctionDefs::dxSetTextureEdge );
317-
318281
// Pickup create/destroy funcs
319282
CLuaCFunctions::AddFunction ( "createPickup", CLuaFunctionDefs::CreatePickup );
320283

@@ -735,6 +698,7 @@ void CLuaManager::LoadCFunctions ( void )
735698
CLuaBlipDefs::LoadFunctions ();
736699
CLuaBrowserDefs::LoadFunctions ();
737700
CLuaCameraDefs::LoadFunctions ();
701+
CLuaDrawingDefs::LoadFunctions ();
738702
CLuaElementDefs::LoadFunctions ();
739703
CLuaFileDefs::LoadFunctions ();
740704
CLuaFxDefs::LoadFunctions ();

MTA10/mods/shared_logic/lua/LuaCommon.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ void lua_registerclass ( lua_State* luaVM, const char* szName, const char* szPar
274274
lua_rawget ( luaVM, LUA_REGISTRYINDEX ); // class table, mt table
275275
lua_getfield ( luaVM, -1, szParent ); // class table, mt table, parent table
276276

277+
// Error if we can't find the parent class to extend from
277278
assert ( lua_istable ( luaVM, -1 ) );
278279

279280
lua_setfield ( luaVM, -3, "__parent" ); // class table, mt table
@@ -417,4 +418,4 @@ void lua_classmetamethod ( lua_State* luaVM, const char* szName, lua_CFunction f
417418
lua_pushcclosure ( luaVM, fn, 1 );
418419
lua_rawset ( luaVM, -3 );
419420
}
420-
}
421+
}

MTA10/mods/shared_logic/lua/oopdefs/CLuaOOPDefs.h

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)