Last active
August 29, 2015 14:13
-
-
Save qaisjp/0851509ff319f4127c81 to your computer and use it in GitHub Desktop.
radar area rectangle flash f11 map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: MTA10/mods/deathmatch/_Deathmatch 2008.vcproj | |
=================================================================== | |
--- MTA10/mods/deathmatch/_Deathmatch 2008.vcproj (revision 7004) | |
+++ MTA10/mods/deathmatch/_Deathmatch 2008.vcproj (working copy) | |
@@ -1266,6 +1266,10 @@ | |
RelativePath="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.Drawing.cpp" | |
> | |
</File> | |
+ <File | |
+ RelativePath="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.RadarArea.cpp" | |
+ > | |
+ </File> | |
</Filter> | |
</Filter> | |
<Filter | |
Index: MTA10/mods/deathmatch/_Deathmatch 2008.vcxproj | |
=================================================================== | |
--- MTA10/mods/deathmatch/_Deathmatch 2008.vcxproj (revision 7004) | |
+++ MTA10/mods/deathmatch/_Deathmatch 2008.vcxproj (working copy) | |
@@ -212,6 +212,7 @@ | |
<ClCompile Include="..\shared_logic\lua\CLuaVector4.cpp" /> | |
<ClCompile Include="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.Drawing.cpp" /> | |
<ClCompile Include="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.Marker.cpp" /> | |
+ <ClCompile Include="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.RadarArea.cpp" /> | |
<ClCompile Include="CClient.cpp" /> | |
<ClCompile Include="Client.cpp" /> | |
<ClCompile Include="ClientCommands.cpp" /> | |
Index: MTA10/mods/deathmatch/_Deathmatch 2008.vcxproj.filters | |
=================================================================== | |
--- MTA10/mods/deathmatch/_Deathmatch 2008.vcxproj.filters (revision 7004) | |
+++ MTA10/mods/deathmatch/_Deathmatch 2008.vcxproj.filters (working copy) | |
@@ -821,6 +821,9 @@ | |
<ClCompile Include="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.Drawing.cpp"> | |
<Filter>Source Files\shared_logic\lua\oopdefs</Filter> | |
</ClCompile> | |
+ <ClCompile Include="..\shared_logic\lua\oopdefs\CLuaOOPFunctionDefs.RadarArea.cpp"> | |
+ <Filter>Source Files\shared_logic\lua\oopdefs</Filter> | |
+ </ClCompile> | |
</ItemGroup> | |
<ItemGroup> | |
<ClInclude Include="CClient.h"> | |
Index: MTA10/mods/deathmatch/logic/CRadarMap.cpp | |
=================================================================== | |
--- MTA10/mods/deathmatch/logic/CRadarMap.cpp (revision 7004) | |
+++ MTA10/mods/deathmatch/logic/CRadarMap.cpp (working copy) | |
@@ -291,7 +291,14 @@ | |
// Calculate the size of the area | |
vecSize.fX = static_cast < float > ( fX / fRatio ); | |
vecSize.fY = static_cast < float > ( fY / fRatio ); | |
- g_pCore->GetGraphics ()->DrawRectangle ( vecPos.fX, vecPos.fY, vecSize.fX, -vecSize.fY, pArea->GetColor () ); | |
+ | |
+ SColor color = pArea->GetColor (); | |
+ if ( pArea->IsFlashing () ) | |
+ { | |
+ color.A = static_cast < unsigned char > ( color.A * pArea->GetAlphaFactor () ); | |
+ } | |
+ | |
+ g_pCore->GetGraphics ()->DrawRectangle ( vecPos.fX, vecPos.fY, vecSize.fX, -vecSize.fY, color ); | |
} | |
} | |
Index: MTA10/mods/shared_logic/CClientRadarArea.cpp | |
=================================================================== | |
--- MTA10/mods/shared_logic/CClientRadarArea.cpp (revision 7004) | |
+++ MTA10/mods/shared_logic/CClientRadarArea.cpp (working copy) | |
@@ -81,22 +81,20 @@ | |
} | |
// Calculate the alpha based on the last cycle time and the cycle intervals | |
- float fAlphaFactor; | |
- | |
// We're in the fade in part of the cycle? | |
if ( ulCurrentTime >= m_ulFlashCycleStart + RADAR_FLASH_CYCLETIME / 2 ) | |
{ | |
// Calculate the alpha-factor | |
- fAlphaFactor = static_cast < float > ( ulCurrentTime - m_ulFlashCycleStart - RADAR_FLASH_CYCLETIME / 2 ) / ( RADAR_FLASH_CYCLETIME / 2 ); | |
+ m_fAlphaFactor = static_cast < float > ( ulCurrentTime - m_ulFlashCycleStart - RADAR_FLASH_CYCLETIME / 2 ) / ( RADAR_FLASH_CYCLETIME / 2 ); | |
} | |
else | |
{ | |
// Calculate the alpha-factor | |
- fAlphaFactor = 1.0f - static_cast < float > ( ulCurrentTime - m_ulFlashCycleStart ) / ( RADAR_FLASH_CYCLETIME / 2 ); | |
+ m_fAlphaFactor = 1.0f - static_cast < float > ( ulCurrentTime - m_ulFlashCycleStart ) / ( RADAR_FLASH_CYCLETIME / 2 ); | |
} | |
// Multiply the alpha-factor with the alpha we're supposed to have to find what alpha to use and set it | |
- color.A = static_cast < unsigned char > ( fAlphaFactor * static_cast < float > ( color.A ) ); | |
+ color.A = static_cast < unsigned char > ( m_fAlphaFactor * static_cast < float > ( color.A ) ); | |
} | |
// Only render the radar area if we are told to | |
Index: MTA10/mods/shared_logic/CClientRadarArea.h | |
=================================================================== | |
--- MTA10/mods/shared_logic/CClientRadarArea.h (revision 7004) | |
+++ MTA10/mods/shared_logic/CClientRadarArea.h (working copy) | |
@@ -52,6 +52,8 @@ | |
inline bool IsFlashing ( void ) const { return m_bFlashing; }; | |
inline void SetFlashing ( bool bFlashing ) { m_bFlashing = bFlashing; }; | |
+ inline float GetAlphaFactor ( void ) const { return m_fAlphaFactor; }; | |
+ | |
void SetDimension ( unsigned short usDimension ); | |
void RelateDimension ( unsigned short usDimension ); | |
@@ -68,6 +70,7 @@ | |
bool m_bStreamedIn; | |
bool m_bFlashing; | |
unsigned long m_ulFlashCycleStart; | |
+ float m_fAlphaFactor; | |
}; | |
Index: MTA10/mods/shared_logic/lua/CLuaMain.cpp | |
=================================================================== | |
--- MTA10/mods/shared_logic/lua/CLuaMain.cpp (revision 7005) | |
+++ MTA10/mods/shared_logic/lua/CLuaMain.cpp (working copy) | |
@@ -739,9 +739,9 @@ | |
lua_classfunction ( luaVM, "setFlashing", "setRadarAreaFlashing" ); | |
lua_classfunction ( luaVM, "setColor", "setRadarAreaColor" ); | |
- lua_classvariable ( luaVM, "flashing", "isRadarAreaFlashing", "setRadarAreaFlashing" ); | |
- //lua_classvariable ( luaVM, "color", "getRadarAreaColor", "setRadarAreaColor" ); | |
- lua_classvariable ( luaVM, "size", "getRadarAreaSize", "setRadarAreaSize" ); | |
+ lua_classvariable ( luaVM, "flashing", "setRadarAreaFlashing", "isRadarAreaFlashing" ); | |
+ //lua_classvariable ( luaVM, "color", "setRadarAreaColor", "getRadarAreaColor" ); | |
+ lua_classvariable ( luaVM, "size", CLuaFunctionDefs::SetRadarAreaSize, CLuaOOPDefs::GetRadarAreaSize ); | |
lua_registerclass ( luaVM, "RadarArea", "Element" ); | |
} | |
Index: MTA10/mods/shared_logic/lua/oopdefs/CLuaOOPDefs.h | |
=================================================================== | |
--- MTA10/mods/shared_logic/lua/oopdefs/CLuaOOPDefs.h (revision 7004) | |
+++ MTA10/mods/shared_logic/lua/oopdefs/CLuaOOPDefs.h (working copy) | |
@@ -50,6 +50,9 @@ | |
// Drawing | |
LUA_DECLARE ( DxGetFontHeight ); | |
LUA_DECLARE ( DxGetTextWidth ); | |
+ | |
+ // Radar Area | |
+ LUA_DECLARE ( GetRadarAreaSize ); | |
}; | |
#endif | |
Index: MTA10/mods/shared_logic/lua/oopdefs/CLuaOOPFunctionDefs.RadarArea.cpp | |
=================================================================== | |
--- MTA10/mods/shared_logic/lua/oopdefs/CLuaOOPFunctionDefs.RadarArea.cpp (revision 0) | |
+++ MTA10/mods/shared_logic/lua/oopdefs/CLuaOOPFunctionDefs.RadarArea.cpp (working copy) | |
@@ -0,0 +1,37 @@ | |
+/***************************************************************************** | |
+* | |
+* PROJECT: Multi Theft Auto v1.0 | |
+* (Shared logic for modifications) | |
+* LICENSE: See LICENSE in the top level directory | |
+* FILE: mods/shared_logic/lua/oopdefs/CLuaOOPFunctionDefs.RadarArea.cpp | |
+* PURPOSE: Lua OOP specific function definitions class | |
+* DEVELOPERS: Qais "qaisjp" Patankar <qaisjp@gmail.com> | |
+* | |
+*****************************************************************************/ | |
+ | |
+#include "StdInc.h" | |
+ | |
+int CLuaOOPDefs::GetRadarAreaSize ( lua_State* luaVM ) | |
+{ | |
+ // float, float getRadarAreaSize ( radararea theRadararea ) | |
+ CClientRadarArea* pRadarArea; | |
+ | |
+ CScriptArgReader argStream ( luaVM ); | |
+ argStream.ReadUserData ( pRadarArea ); | |
+ | |
+ if ( !argStream.HasErrors () ) | |
+ { | |
+ CVector2D vecSize; | |
+ if ( CStaticFunctionDefinitions::GetRadarAreaSize ( pRadarArea, vecSize ) ) | |
+ { | |
+ lua_pushvector ( luaVM, vecSize ); | |
+ return 2; | |
+ } | |
+ } | |
+ else | |
+ m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () ); | |
+ | |
+ | |
+ lua_pushboolean ( luaVM, false ); | |
+ return 1; | |
+} | |
\ No newline at end of file | |
Index: MTA10_Server/mods/deathmatch/_ServerDeathmatch 2008.vcproj | |
=================================================================== | |
--- MTA10_Server/mods/deathmatch/_ServerDeathmatch 2008.vcproj (revision 7004) | |
+++ MTA10_Server/mods/deathmatch/_ServerDeathmatch 2008.vcproj (working copy) | |
@@ -1746,6 +1746,10 @@ | |
RelativePath=".\logic\lua\oopdefs\CLuaOOPFunctionDefs.Marker.cpp" | |
> | |
</File> | |
+ <File | |
+ RelativePath=".\logic\lua\oopdefs\CLuaOOPFunctionDefs.RadarArea.cpp" | |
+ > | |
+ </File> | |
</Filter> | |
</Filter> | |
<Filter | |
Index: MTA10_Server/mods/deathmatch/_ServerDeathmatch 2008.vcxproj | |
=================================================================== | |
--- MTA10_Server/mods/deathmatch/_ServerDeathmatch 2008.vcxproj (revision 7004) | |
+++ MTA10_Server/mods/deathmatch/_ServerDeathmatch 2008.vcxproj (working copy) | |
@@ -481,6 +481,7 @@ | |
<ClCompile Include="logic\lua\oopdefs\CLuaOOPFunctionDefs.Ped.cpp" /> | |
<ClCompile Include="logic\lua\oopdefs\CLuaOOPFunctionDefs.Player.cpp" /> | |
<ClCompile Include="logic\lua\oopdefs\CLuaOOPFunctionDefs.Connection.cpp" /> | |
+ <ClCompile Include="logic\lua\oopdefs\CLuaOOPFunctionDefs.RadarArea.cpp" /> | |
<ClCompile Include="Server.cpp" /> | |
<ClCompile Include="StdInc.cpp"> | |
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> | |
Index: MTA10_Server/mods/deathmatch/_ServerDeathmatch 2008.vcxproj.filters | |
=================================================================== | |
--- MTA10_Server/mods/deathmatch/_ServerDeathmatch 2008.vcxproj.filters (revision 7004) | |
+++ MTA10_Server/mods/deathmatch/_ServerDeathmatch 2008.vcxproj.filters (working copy) | |
@@ -1002,6 +1002,9 @@ | |
<ClCompile Include="logic\lua\CLuaFunctionDefs.Misc.cpp"> | |
<Filter>Source Files\logic\lua</Filter> | |
</ClCompile> | |
+ <ClCompile Include="logic\lua\oopdefs\CLuaOOPFunctionDefs.RadarArea.cpp"> | |
+ <Filter>Source Files\logic\oopdefs</Filter> | |
+ </ClCompile> | |
</ItemGroup> | |
<ItemGroup> | |
<ClInclude Include="logic\CLightsyncManager.h"> | |
Index: MTA10_Server/mods/deathmatch/logic/lua/CLuaMain.cpp | |
=================================================================== | |
--- MTA10_Server/mods/deathmatch/logic/lua/CLuaMain.cpp (revision 7004) | |
+++ MTA10_Server/mods/deathmatch/logic/lua/CLuaMain.cpp (working copy) | |
@@ -919,9 +919,9 @@ | |
lua_classfunction ( luaVM, "setFlashing", "setRadarAreaFlashing" ); | |
lua_classfunction ( luaVM, "setColor", "setRadarAreaColor" ); | |
- lua_classvariable ( luaVM, "flashing", "isRadarAreaFlashing", "setRadarAreaFlashing" ); | |
- //lua_classvariable ( luaVM, "color", "getRadarAreaColor", "setRadarAreaColor", "" ); | |
- lua_classvariable ( luaVM, "size", "getRadarAreaSize", "setRadarAreaSize" ); | |
+ lua_classvariable ( luaVM, "flashing", "setRadarAreaFlashing", "isRadarAreaFlashing" ); | |
+ //lua_classvariable ( luaVM, "color", "setRadarAreaColor", "getRadarAreaColor" ); | |
+ lua_classvariable ( luaVM, "size", "setRadarAreaSize", "getRadarAreaSize", CLuaFunctionDefs::SetRadarAreaSize, CLuaOOPDefs::GetRadarAreaSize ); | |
lua_registerclass ( luaVM, "RadarArea", "Element" ); | |
} | |
Index: MTA10_Server/mods/deathmatch/logic/lua/oopdefs/CLuaOOPDefs.h | |
=================================================================== | |
--- MTA10_Server/mods/deathmatch/logic/lua/oopdefs/CLuaOOPDefs.h (revision 7004) | |
+++ MTA10_Server/mods/deathmatch/logic/lua/oopdefs/CLuaOOPDefs.h (working copy) | |
@@ -52,6 +52,9 @@ | |
// ACL | |
LUA_DECLARE ( DoesACLGroupContainObject ); | |
+ | |
+ // RadarArea | |
+ LUA_DECLARE ( GetRadarAreaSize ); | |
}; | |
#endif | |
Index: MTA10_Server/mods/deathmatch/logic/lua/oopdefs/CLuaOOPFunctionDefs.RadarArea.cpp | |
=================================================================== | |
--- MTA10_Server/mods/deathmatch/logic/lua/oopdefs/CLuaOOPFunctionDefs.RadarArea.cpp (revision 0) | |
+++ MTA10_Server/mods/deathmatch/logic/lua/oopdefs/CLuaOOPFunctionDefs.RadarArea.cpp (working copy) | |
@@ -0,0 +1,37 @@ | |
+/***************************************************************************** | |
+* | |
+* PROJECT: Multi Theft Auto v1.0 | |
+* (Shared logic for modifications) | |
+* LICENSE: See LICENSE in the top level directory | |
+* FILE: mods/logic/oopdefs/CLuaOOPFunctionDefs.RadarArea.cpp | |
+* PURPOSE: Lua OOP specific function definitions class | |
+* DEVELOPERS: Qais "qaisjp" Patankar <qaisjp@gmail.com> | |
+* | |
+*****************************************************************************/ | |
+ | |
+#include "StdInc.h" | |
+ | |
+int CLuaOOPDefs::GetRadarAreaSize ( lua_State* luaVM ) | |
+{ | |
+ // float, float getRadarAreaSize ( radararea theRadararea ) | |
+ CRadarArea* pRadarArea; | |
+ | |
+ CScriptArgReader argStream ( luaVM ); | |
+ argStream.ReadUserData ( pRadarArea ); | |
+ | |
+ if ( !argStream.HasErrors () ) | |
+ { | |
+ CVector2D vecSize; | |
+ if ( CStaticFunctionDefinitions::GetRadarAreaSize ( pRadarArea, vecSize ) ) | |
+ { | |
+ lua_pushvector ( luaVM, vecSize ); | |
+ return 2; | |
+ } | |
+ } | |
+ else | |
+ m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () ); | |
+ | |
+ | |
+ lua_pushboolean ( luaVM, false ); | |
+ return 1; | |
+} | |
\ No newline at end of file | |
Index: MTA10_Server/mods/deathmatch/Makefile.am | |
=================================================================== | |
--- MTA10_Server/mods/deathmatch/Makefile.am (revision 7004) | |
+++ MTA10_Server/mods/deathmatch/Makefile.am (working copy) | |
@@ -233,6 +233,7 @@ | |
./logic/lua/oopdefs/CLuaOOPFunctionDefs.Marker.cpp \ | |
./logic/lua/oopdefs/CLuaOOPFunctionDefs.Ped.cpp \ | |
./logic/lua/oopdefs/CLuaOOPFunctionDefs.Player.cpp \ | |
+./logic/lua/oopdefs/CLuaOOPFunctionDefs.RadarArea.cpp \ | |
./logic/luadefs/CLuaACLDefs.cpp \ | |
./logic/luadefs/CLuaBitDefs.cpp \ | |
./logic/luadefs/CLuaCameraDefs.cpp \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment