Skip to content

Commit

Permalink
new name
Browse files Browse the repository at this point in the history
- water fix (III/VC)
  • Loading branch information
ThirteenAG committed Jul 28, 2016
1 parent af3df01 commit 0b98158
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 61 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ solution "OpenLA"
configuration "vs*"
buildoptions { "/arch:IA32" } -- disable the use of SSE/SSE2 instructions

project "limit_adjuster_gta3vcsa"
project "III.VC.SA.LimitAdjuster"
language "C++"
kind "SharedLib"
targetname "limit_adjuster_gta3vcsa"
targetname "III.VC.SA.LimitAdjuster"
targetextension ".asi"

flags { "NoPCH" }
Expand Down
2 changes: 1 addition & 1 deletion src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void ReadSection(const linb::ini& ini, const char* secname, std::map<std::string
int AdjustLimits()
{
std::map<std::string, std::string> keys;
linb::ini ini("limit_adjuster_gta3vcsa.ini"); // Open the ini
linb::ini ini("III.VC.SA.LimitAdjuster.ini"); // Open the ini
const char* secname = 0;

// Find which section we should read on the ini
Expand Down
126 changes: 68 additions & 58 deletions src/limits/Water/WaterBlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,34 +69,34 @@ struct OutsideWorldWaterBlocks : public SimpleAdjuster
ASM_OutsideWorldWaterBlocks_ret2 = lazy_pointer<0x6E6D04>::get();
}

// Usage counter
bool GetUsage(int, std::string& output)
{
int max = HasPatched()? LIMIT_OutsideWorldWaterBlocks : ReadMemory<char>(0x6E6CE9 + 2, true);
return Adjuster::GetUsage(output, ReadMemory<int>(0xC215EC), max);
}

// Frees the current outside world water block array
void Free()
{
if(this->a)
{
delete[] a;
this->a = nullptr;
}
}

// Reallocates the outside world water block array
uint16_t* ReAlloc(int limit)
{
this->Free();
return (this->a = new uint16_t[limit * 2]);
}

bool HasPatched()
{
return this->a != nullptr;
}
// Usage counter
bool GetUsage(int, std::string& output)
{
int max = HasPatched()? LIMIT_OutsideWorldWaterBlocks : ReadMemory<char>(0x6E6CE9 + 2, true);
return Adjuster::GetUsage(output, ReadMemory<int>(0xC215EC), max);
}

// Frees the current outside world water block array
void Free()
{
if(this->a)
{
delete[] a;
this->a = nullptr;
}
}

// Reallocates the outside world water block array
uint16_t* ReAlloc(int limit)
{
this->Free();
return (this->a = new uint16_t[limit * 2]);
}

bool HasPatched()
{
return this->a != nullptr;
}

// Instantiate the adjuster on the global scope
} adjuster_OutsideWorldWaterBlocks;
Expand Down Expand Up @@ -132,40 +132,50 @@ class OutsideWorldWaterBlocksVC : public SimpleAdjuster
//Author: xanser
//e-mail: [email protected]
public:
const char* GetLimitName() { return GetGVM().IsVC() ? "OutsideWorldWaterBlocks" : nullptr; }
void ChangeLimit(int, const std::string& value)
{
BYTE * WaterRender = (BYTE *)0x5C1710; // функция рендера воды
if (*WaterRender == 0xDE) WaterRender += 0x20; // VC 1.1
BYTE WaterLines = std::stoi(value); // количество линий внешней воды 5
// *(float *)0x69CC58 = 0; // сдвиг всей воды на запад 400
*(float *)0x69CD7C = 10000; // радиус видимости внутренней воды ниже 60 метров (z-15)*800*0.022+1200
*(float *)0x69CD80 = 10000; // радиус видимости внутренней воды выше 60 метров 2000
*(float *)0x69CDCC = static_cast<float>(WaterLines * 256); // сдвиг на количество внешней воды 1280 = 5*256
injector::WriteMemory<unsigned char>(WaterRender + 0xDC1, WaterLines, true); // количество внешней воды севера и юга
injector::WriteMemory<unsigned char>(WaterRender + 0xDCB, (WaterLines - 5) * 2 + 26, true); // расширение внешней воды севера и юга на восток
injector::WriteMemory<unsigned char>(WaterRender + 0xDD3, WaterLines, true); // сдвиг внешней воды запада и востока на север
injector::WriteMemory<unsigned char>(WaterRender + 0x11D1, WaterLines, true); // количество внешней воды запада и востока
injector::WriteMemory<unsigned char>(WaterRender + 0x11DB, WaterLines + 16, true); // расширение внешней воды запада и востока на север
}
const char* GetLimitName() { return GetGVM().IsVC() ? "OutsideWorldWaterBlocks" : nullptr; }
void ChangeLimit(int, const std::string& value)
{
uint8_t * WaterRender = (uint8_t *)0x5C1710; // функция рендера воды
uint8_t WaterLines = std::stoi(value); // количество линий внешней воды 5
if (WaterLines > 40)
WaterLines = 40;
// *(float *)0x69CC58 = 0; // сдвиг всей воды на запад 400
*(float *)0x69CD7C = 10000.0f; // радиус видимости внутренней воды ниже 60 метров (z-15)*800*0.022+1200
*(float *)0x69CD80 = 10000.0f; // радиус видимости внутренней воды выше 60 метров 2000
*(float *)0x69CDCC = static_cast<float>(WaterLines * 256); // сдвиг на количество внешней воды 1280 = 5*256

injector::WriteMemory<uint8_t>(WaterRender + 0xDC1, WaterLines, true); // количество внешней воды севера и юга
injector::WriteMemory<uint8_t>(WaterRender + 0xDCB, (WaterLines - 5) * 2 + 26, true); // расширение внешней воды севера и юга на восток
injector::WriteMemory<uint8_t>(WaterRender + 0xDD3, WaterLines, true); // сдвиг внешней воды запада и востока на север
injector::WriteMemory<uint8_t>(WaterRender + 0x11D1, WaterLines, true); // количество внешней воды запада и востока
injector::WriteMemory<uint8_t>(WaterRender + 0x11DB, WaterLines + 16, true); // расширение внешней воды запада и востока на север

injector::WriteMemory(0x5C22DE, 0x78D658, true);
injector::WriteMemory(0x5C24AE, 0x78D658, true);
injector::WriteMemory(0x5C26DE, 0x78D658, true);
injector::WriteMemory(0x5C28BE, 0x78D658, true);
}
} OutsideWorldWaterBlocksVC;

/////////////////////////////////////////////GTA 3/////////////////////////////////////////////////////
class OutsideWorldWaterBlocksIII : public SimpleAdjuster
{
public:
const char* GetLimitName() { return GetGVM().IsIII() ? "OutsideWorldWaterBlocks" : nullptr; }
void ChangeLimit(int, const std::string& value)
{
unsigned int WaterCount = std::stoi(value);

injector::WriteMemory<float>(0x602AE8, 10000.0f, true);
injector::WriteMemory<float>(0x602AF0, 10000.0f, true);
injector::WriteMemory<float>(0x602B48, static_cast<float>(WaterCount)* 256.0f, true);
injector::WriteMemory<unsigned char>(0x5564BD + 0x2, static_cast<unsigned char>(WaterCount), true);
injector::WriteMemory<unsigned char>(0x5C24D9 + 0x3, (static_cast<unsigned char>(WaterCount)-5) * 2 + 26, true);
injector::WriteMemory<unsigned char>(0x5564D0 + 0x1, static_cast<unsigned char>(WaterCount), true);
injector::WriteMemory<unsigned char>(0x55676D + 0x2, static_cast<unsigned char>(WaterCount), true);
injector::WriteMemory<unsigned char>(0x556777 + 0x2, static_cast<unsigned char>(WaterCount)+16, true);
}
const char* GetLimitName() { return GetGVM().IsIII() ? "OutsideWorldWaterBlocks" : nullptr; }
void ChangeLimit(int, const std::string& value)
{
uint8_t WaterLines = std::stoi(value); // количество линий внешней воды 5
if (WaterLines > 40)
WaterLines = 40;

*(float *)0x602AE8 = 10000.0f; // радиус видимости внутренней воды ниже 60 метров (z-15)*800*0.022+1200
*(float *)0x602AF0 = 10000.0f; // радиус видимости внутренней воды выше 60 метров 2000
*(float *)0x602B48 = static_cast<float>(WaterLines * 256); // сдвиг на количество внешней воды 1280 = 5*256

injector::WriteMemory<uint8_t>(0x5564BF, WaterLines, true); // количество внешней воды севера и юга
injector::WriteMemory<uint8_t>(0x5564C9, (WaterLines - 5) * 2 + 26, true); // расширение внешней воды севера и юга на восток
injector::WriteMemory<uint8_t>(0x5564D1, WaterLines, true); // сдвиг внешней воды запада и востока на север
injector::WriteMemory<uint8_t>(0x55676F, (WaterLines - 5) * 2 + 26, true); // количество внешней воды запада и востока
injector::WriteMemory<uint8_t>(0x556779, (WaterLines - 5) * 2 + 26, true); // расширение внешней воды запада и востока на север
}
} OutsideWorldWaterBlocksIII;

0 comments on commit 0b98158

Please sign in to comment.