Skip to content

Commit

Permalink
v1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
JuniorDjjr authored Nov 15, 2022
1 parent 0e4f959 commit 9e3b0b0
Show file tree
Hide file tree
Showing 13 changed files with 189 additions and 97 deletions.
29 changes: 21 additions & 8 deletions CLEOPlus/CLEOPlus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "rw/rpworld.h"
#include <set>

constexpr uint32_t CLEOPLUS_VERSION_INT = 0x01010200;
constexpr uint32_t CLEOPLUS_VERSION_INT = 0x01010300;

using namespace plugin;
using namespace std;
Expand Down Expand Up @@ -371,6 +371,7 @@ OpcodeResult WINAPI REMOVE_CLEO_BLIP(CScriptThread* thread);

//Render object
OpcodeResult WINAPI CREATE_RENDER_OBJECT_TO_CHAR_BONE(CScriptThread* thread);
OpcodeResult WINAPI CREATE_RENDER_OBJECT_TO_CHAR_BONE_FROM_SPECIAL(CScriptThread* thread);
OpcodeResult WINAPI DELETE_RENDER_OBJECT(CScriptThread* thread);
OpcodeResult WINAPI SET_RENDER_OBJECT_AUTO_HIDE(CScriptThread* thread);
OpcodeResult WINAPI SET_RENDER_OBJECT_VISIBLE(CScriptThread* thread);
Expand Down Expand Up @@ -436,6 +437,9 @@ OpcodeResult WINAPI LIST_REMOVE_STRING_VALUE(CScriptThread* thread);
OpcodeResult WINAPI LIST_REMOVE_INDEX_RANGE(CScriptThread* thread);
OpcodeResult WINAPI REVERSE_LIST(CScriptThread* thread);

// Special models
OpcodeResult WINAPI LOAD_SPECIAL_MODEL(CScriptThread* thread);



class CLEOPlus
Expand Down Expand Up @@ -788,6 +792,7 @@ class CLEOPlus

// Render object
CLEO_RegisterOpcode(0xE2E, CREATE_RENDER_OBJECT_TO_CHAR_BONE); // 0xE2E=10,create_render_object_to_char_bone %1d% model %2d% bone %3d% offset %4d% %5d% %6d% rotation %7d% %8d% %9d% store_to %10d%
CLEO_RegisterOpcode(0xF02, CREATE_RENDER_OBJECT_TO_CHAR_BONE_FROM_SPECIAL); // 0F02=10,create_render_object_to_char_bone_from_special %1d% special_model %2d% bone %3d% offset %4d% %5d% %6d% rotation %7d% %8d% %9d% scale %10d% %11d% %12d% store_to %13d%
CLEO_RegisterOpcode(0xE2F, DELETE_RENDER_OBJECT); // 0xE2F=1,delete_render_object %1d%
CLEO_RegisterOpcode(0xE30, SET_RENDER_OBJECT_AUTO_HIDE); // 0xE30=4,set_render_object_auto_hide %1d% dead %2d% weapon %3d% car %4d%
CLEO_RegisterOpcode(0xE31, SET_RENDER_OBJECT_VISIBLE); // 0xE31=2,set_render_object_visible %1d% %2d%
Expand Down Expand Up @@ -856,6 +861,9 @@ class CLEOPlus
CLEO_RegisterOpcode(0xE7D, LIST_REMOVE_INDEX_RANGE); // 0xE7D=3,list_remove_index %1d% start %2d% end %3d%
CLEO_RegisterOpcode(0xE7E, REVERSE_LIST); // 0xE7E=1,reverse_list %1d%

// Special Models
//CLEO_RegisterOpcode(0xF00, LOAD_SPECIAL_MODEL); //


// Cache addresses (for better mod compatibility)
defaultMouseAccelHorizontalAddress = ReadMemory<uintptr_t>(0x50FB16 + 2, true);
Expand Down Expand Up @@ -901,7 +909,7 @@ class CLEOPlus
{
// Reset ped data per frame
auto& pedsPool = CPools::ms_pPedPool;
for (unsigned int index = 0; index < pedsPool->m_nSize; ++index)
for (int index = 0; index < pedsPool->m_nSize; ++index)
{
if (CPed* ped = pedsPool->GetAt(index))
{
Expand Down Expand Up @@ -948,14 +956,18 @@ class CLEOPlus
}
}
}

// clear stuff that failed to be drawn
for (unsigned int i = 0; i < DrawEvent::TOTAL_DRAW_EVENT; ++i) {
ClearMySprites(sprites[i]);
textDrawer[i].ClearAll();
}
};

Events::processScriptsEvent.after += []
{
// Reset ped data per frame
auto& pedsPool = CPools::ms_pPedPool;
for (unsigned int index = 0; index < pedsPool->m_nSize; ++index)
for (int index = 0; index < pedsPool->m_nSize; ++index)
{
if (CPed* ped = pedsPool->GetAt(index))
{
Expand All @@ -971,7 +983,7 @@ class CLEOPlus
}
// Reset vehicle data per frame
auto& vehsPool = CPools::ms_pVehiclePool;
for (unsigned int index = 0; index < vehsPool->m_nSize; ++index)
for (int index = 0; index < vehsPool->m_nSize; ++index)
{
if (CVehicle* vehicle = vehsPool->GetAt(index))
{
Expand Down Expand Up @@ -1093,13 +1105,13 @@ class CLEOPlus

startSaveGame += []
{
currentSaveSlot = FrontEndMenuManager.m_bSelectedSaveGame;
currentSaveSlot = FrontEndMenuManager.m_nSelectedSaveGame;
for (auto scriptEvent : scriptEvents[ScriptEvent::List::SaveConfirmation]) scriptEvent->RunScriptEvent(currentSaveSlot + 1);
};

loadingEvent += []
{
currentSaveSlot = FrontEndMenuManager.m_bSelectedSaveGame;
currentSaveSlot = FrontEndMenuManager.m_nSelectedSaveGame;
};

// Fixes corrupted old saves with deleted LOD objects
Expand Down Expand Up @@ -1134,6 +1146,7 @@ class CLEOPlus
disablePadControl[1] = false;
disablePadControlMovement[0] = false;
disablePadControlMovement[1] = false;
disableCamControl = false;
RadarBlip::Clear();
ClearScriptLists();
ScriptEvent::ClearAllScriptEvents();
Expand Down Expand Up @@ -1415,7 +1428,7 @@ class CLEOPlus
static void __fastcall MyDoBulletImpact(CWeapon* weapon, int i, CEntity* owner, CEntity* victim, CVector* startPoint, CVector* endPoint, CColPoint* colPoint, int a7)
{
if (scriptEvents[ScriptEvent::List::BulletImpact].size() > 0) {
for (auto scriptEvent : scriptEvents[ScriptEvent::List::BulletImpact]) scriptEvent->RunScriptEvent((DWORD)owner, (DWORD)victim, (DWORD)weapon->m_nType, (DWORD)colPoint);
for (auto scriptEvent : scriptEvents[ScriptEvent::List::BulletImpact]) scriptEvent->RunScriptEvent((DWORD)owner, (DWORD)victim, (DWORD)weapon->m_eWeaponType, (DWORD)colPoint);
}
weapon->DoBulletImpact(owner, victim, startPoint, endPoint, colPoint, a7);
return;
Expand Down
36 changes: 22 additions & 14 deletions CLEOPlus/CLEOPlus.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,40 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='GTASA zDebug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='GTAVC Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='GTAVC zDebug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='GTA3 Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='GTA3 zDebug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand All @@ -96,14 +96,14 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='GTASA Release|Win32'">
<OutDir>G:\GTA SA The Modded Edition\CLEO\</OutDir>
<OutDir>G:\GTA San Andreas - Urbanize\cleo\</OutDir>
<IntDir>$(ProjectDir).obj\GTASA\Release\</IntDir>
<TargetName>CLEO+</TargetName>
<TargetExt>.cleo</TargetExt>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);E:\Documents\Para GTA\plugin-sdk-2020\shared;E:\Documents\Para GTA\plugin-sdk-2020\plugin_sa\game_sa</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='GTASA zDebug|Win32'">
<OutDir>G:\GTA SA The Modded Edition\CLEO\</OutDir>
<OutDir>G:\GTA San Andreas - Urbanize\cleo\</OutDir>
<IntDir>$(ProjectDir).obj\GTASA\Debug\</IntDir>
<TargetName>CLEO+</TargetName>
<TargetExt>.cleo</TargetExt>
Expand Down Expand Up @@ -132,6 +132,12 @@
<TargetName>CLEOPlus_d</TargetName>
<TargetExt>.asi</TargetExt>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='GTASA zDebug|Win32'">
<VcpkgEnabled>false</VcpkgEnabled>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='GTASA Release|Win32'">
<VcpkgEnabled>false</VcpkgEnabled>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='GTASA Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
Expand All @@ -142,7 +148,7 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(PLUGIN_SDK_DIR)\plugin_sa\;$(PLUGIN_SDK_DIR)\plugin_sa\game_sa\;$(PLUGIN_SDK_DIR)\shared\;$(PLUGIN_SDK_DIR)\shared\game\;$(CLEO_SDK_SA_DIR)\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS;GTASA;GTAGAME_NAME="San Andreas";GTAGAME_ABBR="SA";GTAGAME_ABBRLOW="sa";GTAGAME_PROTAGONISTNAME="CJ";GTAGAME_CITYNAME="San Andreas";_LA_SUPPORT;PLUGIN_SGV_10US;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalOptions>/Zc:threadSafeInit- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
Expand All @@ -164,7 +170,7 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>$(PLUGIN_SDK_DIR)\plugin_sa\;$(PLUGIN_SDK_DIR)\plugin_sa\game_sa\;$(PLUGIN_SDK_DIR)\shared\;$(PLUGIN_SDK_DIR)\shared\game\;$(CLEO_SDK_SA_DIR)\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS;GTASA;GTAGAME_NAME="San Andreas";GTAGAME_ABBR="SA";GTAGAME_ABBRLOW="sa";GTAGAME_PROTAGONISTNAME="CJ";GTAGAME_CITYNAME="San Andreas";_LA_SUPPORT;PLUGIN_SGV_10US;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<GenerateDebugInformation>Debug</GenerateDebugInformation>
Expand All @@ -184,7 +190,7 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(PLUGIN_SDK_DIR)\plugin_vc\;$(PLUGIN_SDK_DIR)\plugin_vc\game_vc\;$(PLUGIN_SDK_DIR)\shared\;$(PLUGIN_SDK_DIR)\shared\game\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS;GTAVC;GTAGAME_NAME="Vice City";GTAGAME_ABBR="VC";GTAGAME_ABBRLOW="vc";GTAGAME_PROTAGONISTNAME="Tommy";GTAGAME_CITYNAME="Vice City";_LA_SUPPORT;PLUGIN_SGV_10EN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
Expand All @@ -204,7 +210,7 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>$(PLUGIN_SDK_DIR)\plugin_vc\;$(PLUGIN_SDK_DIR)\plugin_vc\game_vc\;$(PLUGIN_SDK_DIR)\shared\;$(PLUGIN_SDK_DIR)\shared\game\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS;GTAVC;GTAGAME_NAME="Vice City";GTAGAME_ABBR="VC";GTAGAME_ABBRLOW="vc";GTAGAME_PROTAGONISTNAME="Tommy";GTAGAME_CITYNAME="Vice City";_LA_SUPPORT;PLUGIN_SGV_10EN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<GenerateDebugInformation>Debug</GenerateDebugInformation>
Expand All @@ -224,7 +230,7 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(PLUGIN_SDK_DIR)\plugin_iii\;$(PLUGIN_SDK_DIR)\plugin_iii\game_iii\;$(PLUGIN_SDK_DIR)\shared\;$(PLUGIN_SDK_DIR)\shared\game\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS;GTA3;GTAGAME_NAME="3";GTAGAME_ABBR="3";GTAGAME_ABBRLOW="3";GTAGAME_PROTAGONISTNAME="Claude";GTAGAME_CITYNAME="Liberty City";_LA_SUPPORT;PLUGIN_SGV_10EN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
Expand All @@ -244,7 +250,7 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>$(PLUGIN_SDK_DIR)\plugin_iii\;$(PLUGIN_SDK_DIR)\plugin_iii\game_iii\;$(PLUGIN_SDK_DIR)\shared\;$(PLUGIN_SDK_DIR)\shared\game\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS;GTA3;GTAGAME_NAME="3";GTAGAME_ABBR="3";GTAGAME_ABBRLOW="3";GTAGAME_PROTAGONISTNAME="Claude";GTAGAME_CITYNAME="Liberty City";_LA_SUPPORT;PLUGIN_SGV_10EN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<GenerateDebugInformation>Debug</GenerateDebugInformation>
Expand Down Expand Up @@ -278,6 +284,7 @@
<ClCompile Include="RenderObjectOnChar.cpp" />
<ClCompile Include="Screen.cpp" />
<ClCompile Include="ScriptEntities.cpp" />
<ClCompile Include="SpecialModels.cpp" />
<ClCompile Include="TextDrawer\TextDrawer.cpp" />
<ClCompile Include="Timer.cpp" />
<ClCompile Include="Types.cpp" />
Expand All @@ -295,6 +302,7 @@
<ClInclude Include="RadarBlip.h" />
<ClInclude Include="RenderObjectOnChar.h" />
<ClInclude Include="Screen.h" />
<ClInclude Include="SpecialModels.h" />
<ClInclude Include="TextDrawer\TextDrawer.h" />
<ClInclude Include="VehExtendedData.h" />
</ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions CLEOPlus/CLEOPlus.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
<ClCompile Include="VehExtendedData.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="SpecialModels.cpp">
<Filter>Source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="TextDrawer">
Expand Down Expand Up @@ -135,5 +138,8 @@
<ClInclude Include="game_sa\CarGeneratorsEx.h">
<Filter>game_sa</Filter>
</ClInclude>
<ClInclude Include="SpecialModels.h">
<Filter>Source</Filter>
</ClInclude>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions CLEOPlus/Drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ OpcodeResult WINAPI DRAW_TEXTURE_PLUS(CScriptThread* thread)
int i = 0;
int j = 1;
while (i < (maskTrisCount * 2)) {
finalMaskTrisArray[i] = maskTrisArray[i] * magicResolutionWidth;
finalMaskTrisArray[j] = maskTrisArray[j] * magicResolutionHeight;
finalMaskTrisArray[i] = (maskTrisArray[i] * magicResolutionWidth);
finalMaskTrisArray[j] = (maskTrisArray[j] * magicResolutionHeight);
i += 2;
j += 2;
}
Expand Down
2 changes: 1 addition & 1 deletion CLEOPlus/Events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void ScriptDeleteEvent(CScriptThread* script)
ScriptEvent::ClearAllForScript(reinterpret_cast<CRunningScript *>(script));
}

void AddEvent(CScriptThread* thread, vector<ScriptEvent*> &scriptEventList, int args = 1)
void AddEvent(CScriptThread* thread, vector<ScriptEvent*> &scriptEventList, unsigned int args = 1)
{
int toggle = CLEO_GetIntOpcodeParam(thread);
int label = CLEO_GetIntOpcodeParam(thread);
Expand Down
4 changes: 2 additions & 2 deletions CLEOPlus/Events.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class ScriptEvent {
int eventScriptIP;
unsigned int varPointer[4];

void ScriptEvent::RunScriptEvent(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4);
void ScriptEvent::RunScriptEvent(DWORD arg1);
void RunScriptEvent(DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4);
void RunScriptEvent(DWORD arg1);

static void ClearForScriptLabelAndVar(vector<ScriptEvent*> &scriptEvents, CRunningScript* script, int label, unsigned int varPointer[4]);
static void ClearAllForScript(CRunningScript *script);
Expand Down
2 changes: 1 addition & 1 deletion CLEOPlus/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ OpcodeResult WINAPI READ_STRUCT_OFFSET_MULTI(CScriptThread* thread)
for (unsigned int i = 0; i < (count * size); i += size)
{
SCRIPT_VAR *pointer = CLEO_GetPointerToScriptVariable(thread);
if (pointer > 0) {
if (pointer != nullptr) {
*(DWORD*)pointer = 0;
memcpy(pointer, (void*)(struc + i), size);
}
Expand Down
Loading

0 comments on commit 9e3b0b0

Please sign in to comment.