Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Stealth Remastered/Cheat/MathStuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
#ifndef M_PI
#define M_PI 3.14159265358979323844f
#endif
#ifndef DEGTORAD
#define DEGTORAD( Deg ) ( (Deg * M_PI) / 180.0f )
#endif
#ifndef RADTODEG
#define RADTODEG( Deg ) ( (Deg * 180.f) / M_PI )
#endif
#define FLOAT_EPSILON 0.0001f

namespace Math
Expand Down Expand Up @@ -50,12 +54,12 @@ namespace Math

static float vect2_dist(float* point1, float* point2)
{
return sqrt(pow(point1[0] - point2[0], 2) + pow(point1[1] - point2[1], 2));
return sqrtf(powf(point1[0] - point2[0], 2.0f) + powf(point1[1] - point2[1], 2.0f));
}

static float vect2_dist(CVector* point1, CVector* point2)
{
return sqrt(pow(point1->fX - point2->fX, 2) + pow(point1->fY - point2->fY, 2));
return sqrtf(powf(point1->x - point2->x, 2.0f) + powf(point1->y - point2->y, 2.0f));
}

static void vect3_normalize(const float in[3], float out[3])
Expand Down
2 changes: 1 addition & 1 deletion Stealth Remastered/Features/Combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void Combat::NoReload()
if (!g_Config.g_Combat.bNoReload)
return;

int iWeapon = FindPlayerPed()->m_aWeapons[FindPlayerPed()->m_nActiveWeaponSlot].m_nType;
int iWeapon = FindPlayerPed()->m_aWeapons[FindPlayerPed()->m_nActiveWeaponSlot].m_eWeaponType;
if (iWeapon >= 22 && iWeapon <= 42 && FindPlayerPed()->m_aWeapons[FindPlayerPed()->m_nActiveWeaponSlot].m_nAmmoInClip == 1)
FindPlayerPed()->GiveWeapon((eWeaponType)iWeapon, 0, false);
}
Expand Down
8 changes: 4 additions & 4 deletions Stealth Remastered/Features/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ void Player::AirBreak()
pVehicle->m_vecMoveSpeed.fX = pVehicle->m_vecMoveSpeed.fY = pVehicle->m_vecMoveSpeed.fZ = 0.f;
}
else if (g_Config.g_Player.bAirBreak)
pPedSelf->m_nPedFlags.bIsStanding = pPedSelf->m_nPedFlags.bWasStanding = pPedSelf->m_nPedFlags.bStayInSamePlace = true;
else pPedSelf->m_nPedFlags.bIsStanding = true;
pPedSelf->bIsStanding = pPedSelf->bWasStanding = pPedSelf->bStayInSamePlace = true;
else pPedSelf->bIsStanding = true;

if (isKeyDown('W'))
nVec->fX += sinf(fCameraRotation) * fSpeed, nVec->fY += cosf(fCameraRotation) * fSpeed;
Expand Down Expand Up @@ -93,8 +93,8 @@ void Player::AirBreak()
void Player::AntiStun()
{
if (g_Config.g_Player.bAntiStun && rand() % 100 < g_Config.g_Player.iAntiStunChance)
pPedSelf->m_nPedFlags.bUpperBodyDamageAnimsOnly = true;
else pPedSelf->m_nPedFlags.bUpperBodyDamageAnimsOnly = false;
pPedSelf->bUpperBodyDamageAnimsOnly = true;
else pPedSelf->bUpperBodyDamageAnimsOnly = false;
}

void Player::FastRotation()
Expand Down
2 changes: 1 addition & 1 deletion Stealth Remastered/Features/Visuals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void CVisuals::ESP_NameTags(int iPlayerID, CPed* pPed)

pSprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE);
pWeaponFont->DrawText(pSprite, "G", -1, &rect, DT_NOCLIP | DT_LEFT, 0xFF000000);
pWeaponFont->DrawText(pSprite, pSAMP->getWeaponSpriteID(pPed->m_aWeapons[pPed->m_nActiveWeaponSlot].m_nType), -1, &rect, DT_NOCLIP | DT_LEFT, 0xFFFFFFFF);
pWeaponFont->DrawText(pSprite, pSAMP->getWeaponSpriteID(pPed->m_aWeapons[pPed->m_nActiveWeaponSlot].m_eWeaponType), -1, &rect, DT_NOCLIP | DT_LEFT, 0xFFFFFFFF);
pSprite->End();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Stealth Remastered/ImGui/imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6130,7 +6130,7 @@ bool ImGui::ListBoxHeader(const char* label, int items_count, int height_in_item
if (height_in_items < 0)
height_in_items = ImMin(items_count, 7);
const ImGuiStyle& style = GetStyle();
float height_in_items_f = height_in_items;
float height_in_items_f = (float)height_in_items;

// We include ItemSpacing.y so that a list sized for the exact number of items doesn't make a scrollbar appears. We could also enforce that by passing a flag to BeginChild().
ImVec2 size;
Expand Down
9 changes: 4 additions & 5 deletions Stealth Remastered/Menu/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void CMenu::Update()
{
if (bOpen)
{
fFadeAlpha = min(fFadeAlpha + ImGui::GetIO().DeltaTime * 6.0f, 1.0f);
fFadeAlpha = std::min(fFadeAlpha + ImGui::GetIO().DeltaTime * 6.0f, 1.0f);
ImGui::GetStyle().Alpha = fFadeAlpha;
pSAMP->toggleSAMPCursor(1);
ImGui::GetIO().MouseDrawCursor = true;
Expand Down Expand Up @@ -222,8 +222,7 @@ void CMenu::RenderMap()
}
ImVec2 vecMapMin(vecWindow.x + vecWindow.y + ImGui::GetIO().DisplaySize.y / 12.f * iMapX, vecWindow.y + ImGui::GetIO().DisplaySize.y / 12.f * iMapY);
ImVec2 vecMapMax(vecWindow.x + vecWindow.y + ImGui::GetIO().DisplaySize.y / 12.f * (iMapX + 1), vecWindow.y + ImGui::GetIO().DisplaySize.y / 12.f * (iMapY + 1));
if (pTextures->tMap[i]->raster)
ImGui::GetBackgroundDrawList()->AddImage(pTextures->tMap[i]->raster->RwD3D9Raster.texture, vecMapMin, vecMapMax, { 0, 0 }, { 1, 1 }, ImColor(255, 255, 255, 150));
// TODO: Rendering disabled until a safe way to fetch the underlying D3D9 texture from RwRaster is provided in the current plugin-sdk.
iMapX++;
}

Expand Down Expand Up @@ -261,15 +260,15 @@ void CMenu::RenderMap()

CVector vecBlipScreen;
Utils::CalcMapToScreen(vecWindow, &pBlip.m_vPosition, &vecBlipScreen, ImGui::GetIO().DisplaySize.y);
ImGui::GetBackgroundDrawList()->AddImage(((CSprite2d*)(4 * pBlip.m_nBlipSprite + 0xBAA250))->m_pTexture->raster->RwD3D9Raster.texture, { vecBlipScreen.fX - 10, vecBlipScreen.fY - 10 }, { vecBlipScreen.fX + 10, vecBlipScreen.fY + 10 });
// Rendering disabled pending RwRaster -> IDirect3DTexture9 accessor.
break;
}
}
}

CVector vecCentreScreen;
Utils::CalcMapToScreen(vecWindow, &FindPlayerPed()->GetPosition(), &vecCentreScreen, ImGui::GetIO().DisplaySize.y);
pRender->DrawImageRotated(((CSprite2d*)(4 * RADAR_SPRITE_CENTRE + 0xBAA250))->m_pTexture->raster->RwD3D9Raster.texture, { vecCentreScreen.fX,vecCentreScreen.fY }, { 10, 10 }, -FindPlayerPed()->m_fCurrentRotation);
// Rendering disabled pending RwRaster -> IDirect3DTexture9 accessor.
}
}

Expand Down
82 changes: 41 additions & 41 deletions Stealth Remastered/SAMP/SAMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,12 @@ float fWeaponDamage[55] =
1.0, // 13 - Vibrator 2
1.0, // 14 - Flowers
1.0, // 15 - Cane
82.5, // 16 - Grenade
82.5f, // 16 - Grenade
0.0, // 17 - Teargas
1.0, // 18 - Molotov
9.9, // 19 - Vehicle M4 (custom)
46.2, // 20 - Vehicle minigun (custom)
0.0, // 21
9.9f, // 19 - Vehicle M4 (custom)
46.2f, // 20 - Vehicle minigun (custom)
0.0f, // 21
8.25f, // 22 - Colt 45
13.200001f, // 23 - Silenced
46.200001f, // 24 - Deagle
Expand All @@ -252,26 +252,26 @@ float fWeaponDamage[55] =
6.6f, // 32 - Tec9
24.750002f, // 33 - Cuntgun
41.25f, // 34 - Sniper
82.5, // 35 - Rocket launcher
82.5, // 36 - Heatseeker
1.0, // 37 - Flamethrower
82.5f, // 35 - Rocket launcher
82.5f, // 36 - Heatseeker
1.0f, // 37 - Flamethrower
46.200001f, // 38 - Minigun
82.5, // 39 - Satchel
0.0, // 40 - Detonator
0.33, // 41 - Spraycan
0.33, // 42 - Fire extinguisher
0.0, // 43 - Camera
0.0, // 44 - Night vision
0.0, // 45 - Infrared
0.0, // 46 - Parachute
0.0, // 47 - Fake pistol
2.64, // 48 - Pistol whip (custom)
9.9, // 49 - Vehicle
330.0, // 50 - Helicopter blades
82.5, // 51 - Explosion
1.0, // 52 - Car park (custom)
1.0, // 53 - Drowning
165.0 // 54 - Splat
82.5f, // 39 - Satchel
0.0f, // 40 - Detonator
0.33f, // 41 - Spraycan
0.33f, // 42 - Fire extinguisher
0.0f, // 43 - Camera
0.0f, // 44 - Night vision
0.0f, // 45 - Infrared
0.0f, // 46 - Parachute
0.0f, // 47 - Fake pistol
2.64f, // 48 - Pistol whip (custom)
9.9f, // 49 - Vehicle
330.0f, // 50 - Helicopter blades
82.5f, // 51 - Explosion
1.0f, // 52 - Car park (custom)
1.0f, // 53 - Drowning
165.0f // 54 - Splat
};

float fWeaponRange[39] =
Expand All @@ -297,22 +297,22 @@ float fWeaponRange[39] =
0.0, // 18 - Molotov
90.0, // 19 - Vehicle M4 (custom)
75.0, // 20 - Vehicle minigun (custom)
0.0, // 21
35.0, // 22 - Colt 45
35.0, // 23 - Silenced
35.0, // 24 - Deagle
40.0, // 25 - Shotgun
35.0, // 26 - Sawed-off
40.0, // 27 - Spas
35.0, // 28 - UZI
45.0, // 29 - MP5
70.0, // 30 - AK47
90.0, // 31 - M4
35.0, // 32 - Tec9
100.0, // 33 - Cuntgun
320.0, // 34 - Sniper
0.0, // 35 - Rocket launcher
0.0, // 36 - Heatseeker
0.0, // 37 - Flamethrower
75.0 // 38 - Minigun
0.0f, // 21
35.0f, // 22 - Colt 45
35.0f, // 23 - Silenced
35.0f, // 24 - Deagle
40.0f, // 25 - Shotgun
35.0f, // 26 - Sawed-off
40.0f, // 27 - Spas
35.0f, // 28 - UZI
45.0f, // 29 - MP5
70.0f, // 30 - AK47
90.0f, // 31 - M4
35.0f, // 32 - Tec9
100.0f, // 33 - Cuntgun
320.0f, // 34 - Sniper
0.0f, // 35 - Rocket launcher
0.0f, // 36 - Heatseeker
0.0f, // 37 - Flamethrower
75.0f // 38 - Minigun
};
22 changes: 11 additions & 11 deletions Stealth Remastered/Stealth Remastered.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='GTASA Release|Win32'">
<OutDir>$(GTA_SA_DIR)\scripts\</OutDir>
<OutDir>$(ProjectDir).bin\GTASA\Release\</OutDir>
<IntDir>$(ProjectDir).obj\GTASA\Release\</IntDir>
<TargetName>StealthRemastered.SA</TargetName>
<TargetExt>.asi</TargetExt>
<TargetExt>.dll</TargetExt>
<IncludePath>$(IncludePath);$(DIRECTX9_SDK_DIR)\Include\</IncludePath>
<LibraryPath>$(LibraryPath);$(DIRECTX9_SDK_DIR)\Lib\x86\</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='GTASA zDebug|Win32'">
<OutDir>$(GTA_SA_DIR)\scripts\</OutDir>
<OutDir>$(ProjectDir).bin\GTASA\Debug\</OutDir>
<IntDir>$(ProjectDir).obj\GTASA\Debug\</IntDir>
<TargetName>StealthRemastered.SA_d</TargetName>
<TargetExt>.asi</TargetExt>
<TargetExt>.dll</TargetExt>
<IncludePath>$(IncludePath);$(DIRECTX9_SDK_DIR)\Include\</IncludePath>
<LibraryPath>$(LibraryPath);$(DIRECTX9_SDK_DIR)\Lib\x86\</LibraryPath>
</PropertyGroup>
Expand All @@ -64,8 +64,8 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>false</SDLCheck>
<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\;..\Stealth Remastered;%(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";_DX9_SDK_INSTALLED;PLUGIN_SGV_10US;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(PLUGIN_SDK_DIR)\plugin_sa\;$(PLUGIN_SDK_DIR)\plugin_sa\game_sa\;$(PLUGIN_SDK_DIR)\plugin_sa\game_sa\rw\;$(PLUGIN_SDK_DIR)\shared\;$(PLUGIN_SDK_DIR)\shared\game\;..\Stealth Remastered;%(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";_DX9_SDK_INSTALLED;PLUGIN_SGV_10US;RW;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpplatest</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>main.h</PrecompiledHeaderFile>
Expand All @@ -76,7 +76,7 @@
<GenerateDebugInformation>false</GenerateDebugInformation>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<AdditionalLibraryDirectories>$(PLUGIN_SDK_DIR)\output\lib\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>plugin.lib;d3d9.lib;d3dx9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>detours.lib;plugin.lib;d3d9.lib;d3dx9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
Expand All @@ -86,15 +86,15 @@
<Optimization>Disabled</Optimization>
<SDLCheck>false</SDLCheck>
<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\;%(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";_DX9_SDK_INSTALLED;PLUGIN_SGV_10US;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(PLUGIN_SDK_DIR)\plugin_sa\;$(PLUGIN_SDK_DIR)\plugin_sa\game_sa\;$(PLUGIN_SDK_DIR)\plugin_sa\game_sa\rw\;$(PLUGIN_SDK_DIR)\shared\;$(PLUGIN_SDK_DIR)\shared\game\;%(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";_DX9_SDK_INSTALLED;PLUGIN_SGV_10US;RW;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
<Link>
<GenerateDebugInformation>Debug</GenerateDebugInformation>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
<AdditionalLibraryDirectories>$(PLUGIN_SDK_DIR)\output\lib\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>plugin_d.lib;d3d9.lib;d3dx9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>detours.lib;plugin_d.lib;d3d9.lib;d3dx9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
Expand Down Expand Up @@ -166,4 +166,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
28 changes: 27 additions & 1 deletion Stealth Remastered/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,30 @@

#include "Menu/Menu.h"

extern HMODULE g_hModule;
extern HMODULE g_hModule;

// Compatibility aliases for newer plugin-sdk field names
#ifndef fX
#define fX x
#endif
#ifndef fY
#define fY y
#endif
#ifndef fZ
#define fZ z
#endif
#ifndef m_nActiveWeaponSlot
#define m_nActiveWeaponSlot m_nSelectedWepSlot
#endif
#ifndef m_nBlipSprite
#define m_nBlipSprite m_nRadarSprite
#endif
#ifndef m_vPosition
#define m_vPosition m_vecPos
#endif
#ifndef gRadarTextures
#define gRadarTextures gRadarTxdIds
#endif
#ifndef m_bWidescreenOn
#define m_bWidescreenOn m_bMenuAccessWidescreen
#endif