Skip to content

Commit

Permalink
v1.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
JuniorDjjr authored Feb 27, 2022
1 parent 939ff20 commit d9387fd
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 39 deletions.
16 changes: 8 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 = 0x01000800;
constexpr uint32_t CLEOPLUS_VERSION_INT = 0x01000900;

using namespace plugin;
using namespace std;
Expand Down Expand Up @@ -224,8 +224,8 @@ OpcodeResult WINAPI SET_CAR_MODEL_ALPHA(CScriptThread* thread);
OpcodeResult WINAPI SET_CHAR_MODEL_ALPHA(CScriptThread* thread);
OpcodeResult WINAPI SET_OBJECT_MODEL_ALPHA(CScriptThread* thread);
OpcodeResult WINAPI GET_LOCAL_TIME(CScriptThread* thread);
OpcodeResult WINAPI SET_THREAD_VAR(CScriptThread* thread);
OpcodeResult WINAPI GET_THREAD_VAR(CScriptThread* thread);
OpcodeResult WINAPI SET_SCRIPT_VAR(CScriptThread* thread);
OpcodeResult WINAPI GET_SCRIPT_VAR(CScriptThread* thread);
OpcodeResult WINAPI SET_CAR_DOOR_WINDOW_STATE(CScriptThread* thread);
OpcodeResult WINAPI GET_OBJECT_CENTRE_OF_MASS_TO_BASE_OF_MODEL(CScriptThread* thread);
OpcodeResult WINAPI GET_MODEL_TYPE(CScriptThread* thread);
Expand Down Expand Up @@ -723,8 +723,8 @@ class CLEOPlus
CLEO_RegisterOpcode(0xD10, SET_CHAR_MODEL_ALPHA); // 0xD10=2,set_char_model_alpha %1d% alpha %2d%
CLEO_RegisterOpcode(0xD11, SET_OBJECT_MODEL_ALPHA); // 0xD11=2,set_object_model_alpha %1d% alpha %2d%
CLEO_RegisterOpcode(0xD2D, GET_LOCAL_TIME); // 0D2D=8,get_local_time_year_to %1d% month_to %2d% day_of_week_to %3d% day_to %4d% hour_to %5d% minute_to %6d% second_to %7d% milliseconds_to %8d%
CLEO_RegisterOpcode(0xD2E, SET_THREAD_VAR); // 0D2E=3,set_thread %1d% var %2d% value %3d%
CLEO_RegisterOpcode(0xD2F, GET_THREAD_VAR); // 0D2F=3,%3d% = get_thread %1d% var %2d% // keep NewOpcodes order
CLEO_RegisterOpcode(0xD2E, SET_SCRIPT_VAR); // 0D2E=3,set_script %1d% var %2d% value %3d%
CLEO_RegisterOpcode(0xD2F, GET_SCRIPT_VAR); // 0D2F=3,%3d% = get_script %1d% var %2d% // keep NewOpcodes order
CLEO_RegisterOpcode(0xD33, SET_CAR_DOOR_WINDOW_STATE); // 0D33=3,set_car %1d% door %2d% window_state %3d%
}

Expand Down Expand Up @@ -832,8 +832,8 @@ class CLEOPlus
{
CLEO_RegisterOpcode(0xD3A, GET_COLLISION_BETWEEN_POINTS); // 0D3A=20,get_collision_between_points %1d% %2d% %3d% and %4d% %5d% %6d% flags %7d% %8d% %9d% %10d% %11d% %12d% %13d% %14d% ignore_entity %15d% store_point_to %17d% %18d% %19d% entity_to %20d% colpoint_data_to %16d% // keep NewOpcodes order
CLEO_RegisterOpcode(0xD3B, GET_COLPOINT_NORMAL_VECTOR); // 0D3B=4,get_colpoint_normal_vector %1d% store_to %2d% %3d% %4d%
CLEO_RegisterOpcode(0xD3C, GET_COLPOINT_SURFACE); // 0D3D=2,get_colpoint_surface %1d% store_to %2d%
CLEO_RegisterOpcode(0xD3E, GET_COLPOINT_DEPTH); // 0D3C=2,get_colpoint_depth %1d% store_to %2d%
CLEO_RegisterOpcode(0xD3C, GET_COLPOINT_SURFACE); // 0D3C=2,get_colpoint_surface %1d% store_to %2d%
CLEO_RegisterOpcode(0xD3E, GET_COLPOINT_DEPTH); // 0D3E=2,get_colpoint_depth %1d% store_to %2d%
}
CLEO_RegisterOpcode(0xE6B, GET_COLPOINT_LIGHTING); // 0xE6B=2,get_colpoint_lighting %1d% from_night %2d% store_to %3d%
CLEO_RegisterOpcode(0xEE1, GET_COLPOINT_COORDINATES); // 0xEE1=4,get_colpoint_coordinates %1d% store_to %2d% %3d% %4d%
Expand Down Expand Up @@ -1225,7 +1225,7 @@ class CLEOPlus

Events::objectDtorEvent.before += [](CObject *object) {
int ref = CPools::GetObjectRef(object);
if (scriptEvents[ScriptEvent::List::ObjectCreate].size() > 0) {
if (scriptEvents[ScriptEvent::List::ObjectDelete].size() > 0) {
for (auto scriptEvent : scriptEvents[ScriptEvent::List::ObjectDelete]) scriptEvent->RunScriptEvent(ref);
}
for (int i = 0; i < sizeScriptConnectLodsObjects; ++i)
Expand Down
4 changes: 2 additions & 2 deletions CLEOPlus/CLEOPlus.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='GTASA Release|Win32'">
<OutDir>G:\GTA San Andreas Remaster\cleo\</OutDir>
<OutDir>G:\GTA SA The Modded Edition\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 San Andreas Remaster\cleo\</OutDir>
<OutDir>G:\GTA SA The Modded Edition\CLEO\</OutDir>
<IntDir>$(ProjectDir).obj\GTASA\Debug\</IntDir>
<TargetName>CLEO+</TargetName>
<TargetExt>.cleo</TargetExt>
Expand Down
12 changes: 8 additions & 4 deletions CLEOPlus/Colpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ OpcodeResult WINAPI GET_COLPOINT_NORMAL_VECTOR(CScriptThread* thread)
// SCR: GET_COL_DATA_DEPTH
OpcodeResult WINAPI GET_COLPOINT_DEPTH(CScriptThread* thread)
{
CColPoint *colPoint = (CColPoint*)CLEO_GetIntOpcodeParam(thread);
CLEO_SetFloatOpcodeParam(thread, colPoint->m_fDepth);
//CColPoint *colPoint = (CColPoint*)CLEO_GetIntOpcodeParam(thread);
//CLEO_SetFloatOpcodeParam(thread, colPoint->m_fDepth);
uint32_t colPoint = CLEO_GetIntOpcodeParam(thread);
CLEO_SetFloatOpcodeParam(thread, *(float*)(colPoint + 0x28));
return OR_CONTINUE;
}

Expand All @@ -88,8 +90,10 @@ OpcodeResult WINAPI GET_COLPOINT_DEPTH(CScriptThread* thread)
// SCR: GET_COL_DATA_SURFACE
OpcodeResult WINAPI GET_COLPOINT_SURFACE(CScriptThread* thread)
{
CColPoint *colPoint = (CColPoint*)CLEO_GetIntOpcodeParam(thread);
CLEO_SetIntOpcodeParam(thread, colPoint->m_nSurfaceTypeB);
//CColPoint *colPoint = (CColPoint*)CLEO_GetIntOpcodeParam(thread);
//CLEO_SetIntOpcodeParam(thread, colPoint->m_nSurfaceTypeB);
uint32_t colPoint = CLEO_GetIntOpcodeParam(thread);
CLEO_SetIntOpcodeParam(thread, *(uint8_t*)(colPoint+0x23));
return OR_CONTINUE;
}

Expand Down
9 changes: 8 additions & 1 deletion CLEOPlus/MathRelated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ OpcodeResult WINAPI GET_ANGLE_FROM_TWO_COORDS(CScriptThread* thread)
while (result < 0.0) {
result += 360.0;
}
if (_isnan(result)) {
result = 0.0f;
}

CLEO_SetFloatOpcodeParam(thread, result);
return OR_CONTINUE;
Expand Down Expand Up @@ -423,7 +426,11 @@ OpcodeResult WINAPI CLAMP_FLOAT(CScriptThread* thread)
float f = CLEO_GetFloatOpcodeParam(thread);
float min = CLEO_GetFloatOpcodeParam(thread);
float max = CLEO_GetFloatOpcodeParam(thread);
CLEO_SetFloatOpcodeParam(thread, clamp(f, min, max));
float result = 0.0f;
if (!_isnan(f)) {
result = clamp(f, min, max);
}
CLEO_SetFloatOpcodeParam(thread, result);
return OR_CONTINUE;
}

Expand Down
14 changes: 7 additions & 7 deletions CLEOPlus/Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ OpcodeResult WINAPI GET_LOCAL_TIME(CScriptThread* thread)

// 0D2E=3,set_thread %1d% var %2d% to %3d%
// 0D2E: set_thread 0@ var 10 to 10.0
// SCR: SET_THREAD_VAR
OpcodeResult WINAPI SET_THREAD_VAR(CScriptThread* thread)
// SCR: SET_SCRIPT_VAR
OpcodeResult WINAPI SET_SCRIPT_VAR(CScriptThread* thread)
{
void *t, *value; unsigned int var; SCRIPT_VAR scrVal;
t = (void *)CLEO_GetIntOpcodeParam(thread);
Expand All @@ -519,8 +519,8 @@ OpcodeResult WINAPI SET_THREAD_VAR(CScriptThread* thread)

// 0D2F=3,%3d% = get_thread %1d% var %2d%
// 0D2F: 1@ = get_thread 0@ var 10
// SCR: GET_THREAD_VAR
OpcodeResult WINAPI GET_THREAD_VAR(CScriptThread* thread)
// SCR: GET_SCRIPT_VAR
OpcodeResult WINAPI GET_SCRIPT_VAR(CScriptThread* thread)
{
void *t; unsigned int var;
t = (void *)CLEO_GetIntOpcodeParam(thread);
Expand Down Expand Up @@ -1472,15 +1472,15 @@ OpcodeResult WINAPI STRING_FIND(CScriptThread* thread)
std::string str = CLEO_ReadStringPointerOpcodeParam(thread, bufferA, 128);
std::string strFind = CLEO_ReadStringPointerOpcodeParam(thread, bufferB, 128);

size_t found = 0;
size_t found = string::npos;

if (mode == 0)
{
found = str.find_first_of(strFind);
found = str.find(strFind);
}
else if (mode == 1)
{
found = str.find_last_of(strFind);
found = str.rfind(strFind);
}

if (found != string::npos)
Expand Down
42 changes: 26 additions & 16 deletions CLEOPlus/RenderObjectOnChar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ OpcodeResult WINAPI DELETE_RENDER_OBJECT(CScriptThread* thread)
OpcodeResult WINAPI SET_RENDER_OBJECT_AUTO_HIDE(CScriptThread* thread)
{
RenderObject *renderObject = (RenderObject *)CLEO_GetIntOpcodeParam(thread);
renderObject->hideIfDead = CLEO_GetIntOpcodeParam(thread);
renderObject->hideIfWeapon = CLEO_GetIntOpcodeParam(thread);
renderObject->hideIfCar = CLEO_GetIntOpcodeParam(thread);
if (renderObject) {
renderObject->hideIfDead = CLEO_GetIntOpcodeParam(thread);
renderObject->hideIfWeapon = CLEO_GetIntOpcodeParam(thread);
renderObject->hideIfCar = CLEO_GetIntOpcodeParam(thread);
}
return OR_CONTINUE;
}

Expand All @@ -128,9 +130,11 @@ OpcodeResult WINAPI SET_RENDER_OBJECT_VISIBLE(CScriptThread* thread)
OpcodeResult WINAPI SET_RENDER_OBJECT_POSITION(CScriptThread* thread)
{
RenderObject *renderObject = (RenderObject *)CLEO_GetIntOpcodeParam(thread);
renderObject->offset.x = CLEO_GetFloatOpcodeParam(thread);
renderObject->offset.y = CLEO_GetFloatOpcodeParam(thread);
renderObject->offset.z = CLEO_GetFloatOpcodeParam(thread);
if (renderObject) {
renderObject->offset.x = CLEO_GetFloatOpcodeParam(thread);
renderObject->offset.y = CLEO_GetFloatOpcodeParam(thread);
renderObject->offset.z = CLEO_GetFloatOpcodeParam(thread);
}
return OR_CONTINUE;
}

Expand All @@ -139,9 +143,11 @@ OpcodeResult WINAPI SET_RENDER_OBJECT_POSITION(CScriptThread* thread)
OpcodeResult WINAPI SET_RENDER_OBJECT_ROTATION(CScriptThread* thread)
{
RenderObject *renderObject = (RenderObject *)CLEO_GetIntOpcodeParam(thread);
renderObject->rot.x = CLEO_GetFloatOpcodeParam(thread);
renderObject->rot.y = CLEO_GetFloatOpcodeParam(thread);
renderObject->rot.z = CLEO_GetFloatOpcodeParam(thread);
if (renderObject) {
renderObject->rot.x = CLEO_GetFloatOpcodeParam(thread);
renderObject->rot.y = CLEO_GetFloatOpcodeParam(thread);
renderObject->rot.z = CLEO_GetFloatOpcodeParam(thread);
}
return OR_CONTINUE;
}

Expand All @@ -150,9 +156,11 @@ OpcodeResult WINAPI SET_RENDER_OBJECT_ROTATION(CScriptThread* thread)
OpcodeResult WINAPI SET_RENDER_OBJECT_SCALE(CScriptThread* thread)
{
RenderObject *renderObject = (RenderObject *)CLEO_GetIntOpcodeParam(thread);
renderObject->scale.x = CLEO_GetFloatOpcodeParam(thread);
renderObject->scale.y = CLEO_GetFloatOpcodeParam(thread);
renderObject->scale.z = CLEO_GetFloatOpcodeParam(thread);
if (renderObject) {
renderObject->scale.x = CLEO_GetFloatOpcodeParam(thread);
renderObject->scale.y = CLEO_GetFloatOpcodeParam(thread);
renderObject->scale.z = CLEO_GetFloatOpcodeParam(thread);
}
return OR_CONTINUE;
}

Expand All @@ -161,9 +169,11 @@ OpcodeResult WINAPI SET_RENDER_OBJECT_SCALE(CScriptThread* thread)
OpcodeResult WINAPI SET_RENDER_OBJECT_DISTORTION(CScriptThread* thread)
{
RenderObject *renderObject = (RenderObject *)CLEO_GetIntOpcodeParam(thread);
renderObject->dist.x = CLEO_GetFloatOpcodeParam(thread);
renderObject->dist.y = CLEO_GetFloatOpcodeParam(thread);
renderObject->dist.z = CLEO_GetFloatOpcodeParam(thread);
renderObject->dist.w = CLEO_GetFloatOpcodeParam(thread);
if (renderObject) {
renderObject->dist.x = CLEO_GetFloatOpcodeParam(thread);
renderObject->dist.y = CLEO_GetFloatOpcodeParam(thread);
renderObject->dist.z = CLEO_GetFloatOpcodeParam(thread);
renderObject->dist.w = CLEO_GetFloatOpcodeParam(thread);
}
return OR_CONTINUE;
}
6 changes: 5 additions & 1 deletion CLEOPlus/TextDrawer/TextDrawer.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include "CMessages.h"
#include "TextDrawer.h"
#include "../Screen.h"

TextDrawer textDrawer[DrawEvent::TOTAL_DRAW_EVENT];

void TextDrawer::DrawPrints()
{
char finalString[400];
for (auto print : m_aPrints)
{
float sizX = print->m_fWidth;
Expand Down Expand Up @@ -52,7 +54,9 @@ void TextDrawer::DrawPrints()
case ALIGN_RIGHT:
CFont::SetRightJustifyWrap(print->m_fWrap * magicResolutionWidth); break;
}
CFont::PrintString(print->m_fX * magicResolutionWidth, print->m_fY * magicResolutionHeight, print->m_text);
CMessages::InsertNumberInString(print->m_text, -1, -1, -1, -1, -1, -1, finalString); // this is required to use InsertPlayerControlKeysInString, idkw
CMessages::InsertPlayerControlKeysInString(finalString);
CFont::PrintString(print->m_fX * magicResolutionWidth, print->m_fY * magicResolutionHeight, finalString);
}

// clear all
Expand Down

0 comments on commit d9387fd

Please sign in to comment.