diff --git a/doc/limit_adjuster_gta3vcsa.ini b/doc/III.VC.SA.LimitAdjuster.ini similarity index 100% rename from doc/limit_adjuster_gta3vcsa.ini rename to doc/III.VC.SA.LimitAdjuster.ini diff --git a/premake5.lua b/premake5.lua index 27f68a3..ce09961 100644 --- a/premake5.lua +++ b/premake5.lua @@ -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" } diff --git a/src/dllmain.cpp b/src/dllmain.cpp index 9198c38..1bb7244 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -81,7 +81,7 @@ void ReadSection(const linb::ini& ini, const char* secname, std::map 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 diff --git a/src/limits/Water/WaterBlocks.cpp b/src/limits/Water/WaterBlocks.cpp index c32b9ba..6b4c99a 100644 --- a/src/limits/Water/WaterBlocks.cpp +++ b/src/limits/Water/WaterBlocks.cpp @@ -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(0x6E6CE9 + 2, true); - return Adjuster::GetUsage(output, ReadMemory(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(0x6E6CE9 + 2, true); + return Adjuster::GetUsage(output, ReadMemory(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; @@ -132,40 +132,50 @@ class OutsideWorldWaterBlocksVC : public SimpleAdjuster //Author: xanser //e-mail: xanser@mail.ru 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(WaterLines * 256); // сдвиг на количество внешней воды 1280 = 5*256 - injector::WriteMemory(WaterRender + 0xDC1, WaterLines, true); // количество внешней воды севера и юга - injector::WriteMemory(WaterRender + 0xDCB, (WaterLines - 5) * 2 + 26, true); // расширение внешней воды севера и юга на восток - injector::WriteMemory(WaterRender + 0xDD3, WaterLines, true); // сдвиг внешней воды запада и востока на север - injector::WriteMemory(WaterRender + 0x11D1, WaterLines, true); // количество внешней воды запада и востока - injector::WriteMemory(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(WaterLines * 256); // сдвиг на количество внешней воды 1280 = 5*256 + + injector::WriteMemory(WaterRender + 0xDC1, WaterLines, true); // количество внешней воды севера и юга + injector::WriteMemory(WaterRender + 0xDCB, (WaterLines - 5) * 2 + 26, true); // расширение внешней воды севера и юга на восток + injector::WriteMemory(WaterRender + 0xDD3, WaterLines, true); // сдвиг внешней воды запада и востока на север + injector::WriteMemory(WaterRender + 0x11D1, WaterLines, true); // количество внешней воды запада и востока + injector::WriteMemory(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(0x602AE8, 10000.0f, true); - injector::WriteMemory(0x602AF0, 10000.0f, true); - injector::WriteMemory(0x602B48, static_cast(WaterCount)* 256.0f, true); - injector::WriteMemory(0x5564BD + 0x2, static_cast(WaterCount), true); - injector::WriteMemory(0x5C24D9 + 0x3, (static_cast(WaterCount)-5) * 2 + 26, true); - injector::WriteMemory(0x5564D0 + 0x1, static_cast(WaterCount), true); - injector::WriteMemory(0x55676D + 0x2, static_cast(WaterCount), true); - injector::WriteMemory(0x556777 + 0x2, static_cast(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(WaterLines * 256); // сдвиг на количество внешней воды 1280 = 5*256 + + injector::WriteMemory(0x5564BF, WaterLines, true); // количество внешней воды севера и юга + injector::WriteMemory(0x5564C9, (WaterLines - 5) * 2 + 26, true); // расширение внешней воды севера и юга на восток + injector::WriteMemory(0x5564D1, WaterLines, true); // сдвиг внешней воды запада и востока на север + injector::WriteMemory(0x55676F, (WaterLines - 5) * 2 + 26, true); // количество внешней воды запада и востока + injector::WriteMemory(0x556779, (WaterLines - 5) * 2 + 26, true); // расширение внешней воды запада и востока на север + } } OutsideWorldWaterBlocksIII; \ No newline at end of file