diff --git a/src/Game.cpp b/src/Game.cpp index 015bf36..b63e986 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -130,12 +130,14 @@ Game::Game() float water_height = 0; Command(pos.x, pos.y, false, &water_height); - if (!Command(hplayer) && water_height != -1000.0f && pos.z > (water_height+1)) + if (!Command(hplayer) && water_height != -1000.0f && pos.z > (water_height)) { if (solid_water_object == 0) { Command(3095, pos.x, pos.y, water_height, &solid_water_object); - Command(solid_water_object, false); + Command(solid_water_object,false); + if (pos.z < (water_height+1)) + player->SetPosn(pos.x,pos.y,water_height+1); } else Command(solid_water_object, pos.x, pos.y, water_height); @@ -427,7 +429,7 @@ Lowers armour, health, stamina etc.")) } Ui::CheckboxWithHint("Screenshot shortcut", &ss_shortcut, (("Take screenshot using ") + Ui::GetHotKeyNameString(Menu::hotkeys::quick_ss) + "\nSaved inside 'GTA San Andreas User Files\\Gallery'").c_str()); - if (Ui::CheckboxWithHint("Solid water", &solid_water, "Player can walk on water")) + if (Ui::CheckboxWithHint("Solid water", &solid_water, "Player can walk on water\nTurn this off if you want to swim.")) { if (!solid_water && solid_water_object != 0) { diff --git a/src/Menu.cpp b/src/Menu.cpp index 5bffd8d..d12d264 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -246,7 +246,7 @@ void Menu::ProcessCommands() ss >> temp; pos.z = std::stof(temp); - Teleport::TeleportPlayer(false, &pos, 0); + Teleport::TeleportPlayer(false, pos, 0); } catch (...) { CHud::SetHelpMessage("Invalid location", false, false, false); diff --git a/src/Teleport.cpp b/src/Teleport.cpp index 4f92aa9..2dfe451 100644 --- a/src/Teleport.cpp +++ b/src/Teleport.cpp @@ -96,7 +96,7 @@ Teleport::Teleport() }; } -void Teleport::TeleportPlayer(bool get_marker, CVector* pos, short interior_id) +void Teleport::TeleportPlayer(bool get_marker, CVector pos, short interior_id) { CPlayerPed *player = FindPlayerPed(); CVehicle *pVeh = player->m_pVehicle; @@ -112,10 +112,10 @@ void Teleport::TeleportPlayer(bool get_marker, CVector* pos, short interior_id) return; } CEntity* player_entity = FindPlayerEntity(-1); - pos = &(target_blip.m_vPosition); - pos->z = CWorld::FindGroundZFor3DCoord(pos->x, pos->y, 1000, 0, &player_entity) + 50.f; + pos = target_blip.m_vPosition; + pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, 0, &player_entity) + 50.f; - Teleport::STeleport::pos = *pos; + Teleport::STeleport::pos = pos; Teleport::STeleport::timer = CTimer::m_snTimeInMilliseconds; Teleport::STeleport::_bool = true; TheCamera.Fade(0,0); @@ -138,7 +138,7 @@ void Teleport::TeleportPlayer(bool get_marker, CVector* pos, short interior_id) pVeh->m_nAreaCode = interior_id; } else - player->Teleport(STeleport::pos, false); + player->Teleport(pos, false); player->m_nAreaCode = interior_id; Command(interior_id); @@ -164,7 +164,7 @@ void Teleport::TeleportToLocation(std::string& rootkey, std::string& loc_name,st std::getline(ss, temp, ','); pos.z = std::stof(temp); - Teleport::TeleportPlayer(false, &pos, static_cast(interior)); + Teleport::TeleportPlayer(false, pos, static_cast(interior)); } catch (...) { CHud::SetHelpMessage("Invalid location", false, false, false); @@ -231,7 +231,7 @@ void Teleport::Main() getline(ss, temp, ','); pos.z = std::stof(temp) + 1.0f; - Teleport::TeleportPlayer(false,&pos); + Teleport::TeleportPlayer(false,pos); } catch (...) { CHud::SetHelpMessage("Invalid coordinate", false, false, false); @@ -274,9 +274,4 @@ void Teleport::Main() } ImGui::EndTabBar(); } -} - -Teleport::~Teleport() -{ -}; - +} \ No newline at end of file diff --git a/src/Teleport.h b/src/Teleport.h index aba970b..6f548bc 100644 --- a/src/Teleport.h +++ b/src/Teleport.h @@ -31,11 +31,10 @@ private: protected: Teleport(); - virtual ~Teleport(); public: static void Main(); - static void TeleportPlayer(bool get_marker = false, CVector* pos = new CVector(0,0,0), short interior_id = 0); + static void TeleportPlayer(bool get_marker = false, CVector pos = CVector(0,0,0), short interior_id = 0); static void TeleportToLocation(std::string& rootkey, std::string& loc_name, std::string& loc); static void RemoveTeleportEntry(std::string& rootkey, std::string& key, std::string& val); diff --git a/src/TimeCycle.h b/src/TimeCycle.h index 8dea347..e6ed491 100644 --- a/src/TimeCycle.h +++ b/src/TimeCycle.h @@ -1,99 +1,99 @@ #include "plugin.h" -unsigned char* m_nDirectionalMult{ (unsigned char*)patch::GetPointer(0x55F7C7)}; //m_nDirectionalMult[184] +uchar* m_nDirectionalMult = (uchar*)0x55F7C7; //m_nDirectionalMult[184] -unsigned char* m_nWaterFogAlpha{ (unsigned char*)patch::GetPointer(0x55F7B8)}; //m_nWaterFogAlpha[184] +uchar* m_nWaterFogAlpha = (uchar*)0x55F7B8; //m_nWaterFogAlpha[184] -unsigned char* m_nHighLightMinIntensity{ (unsigned char*)patch::GetPointer(0x55F7A9)}; //m_nHighLightMinIntensity[184] +uchar* m_nHighLightMinIntensity = (uchar*)0x55F7A9; //m_nHighLightMinIntensity[184] -unsigned char* m_fCloudAlpha{ (unsigned char*)patch::GetPointer(0x55F793)}; //m_fCloudAlpha[184] +uchar* m_fCloudAlpha = (uchar*)0x55F793; //m_fCloudAlpha[184] -unsigned char* m_fPostFx2Alpha{ (unsigned char*)patch::GetPointer(0x55F77D)}; //m_fPostFx2Alpha[184] +uchar* m_fPostFx2Alpha = (uchar*)0x55F77D; //m_fPostFx2Alpha[184] -unsigned char* m_fPostFx2Blue{ (unsigned char*)patch::GetPointer(0x55F767)}; //m_fPostFx2Blue[184] +uchar* m_fPostFx2Blue = (uchar*)0x55F767; //m_fPostFx2Blue[184] -unsigned char* m_fPostFx2Green{ (unsigned char*)patch::GetPointer(0x55F751)}; //m_fPostFx2Green[184] +uchar* m_fPostFx2Green = (uchar*)0x55F751; //m_fPostFx2Green[184] -unsigned char* m_fPostFx2Red{ (unsigned char*)patch::GetPointer(0x55F73B)}; //m_fPostFx2Red[184] +uchar* m_fPostFx2Red = (uchar*)0x55F73B; //m_fPostFx2Red[184] -unsigned char* m_fPostFx1Alpha{ (unsigned char*)patch::GetPointer(0x55F725)}; //m_fPostFx1Alpha[184] +uchar* m_fPostFx1Alpha = (uchar*)0x55F725; //m_fPostFx1Alpha[184] -unsigned char* m_fPostFx1Blue{ (unsigned char*)patch::GetPointer(0x55F70F)}; //m_fPostFx1Blue[184] +uchar* m_fPostFx1Blue = (uchar*)0x55F70F; //m_fPostFx1Blue[184] -unsigned char* m_fPostFx1Green{ (unsigned char*)patch::GetPointer(0x55F6FC)}; //m_fPostFx1Green[184] +uchar* m_fPostFx1Green = (uchar*)0x55F6FC; //m_fPostFx1Green[184] -unsigned char* m_fPostFx1Red{ (unsigned char*)patch::GetPointer(0x55F6E9)}; //m_fPostFx1Red[184] +uchar* m_fPostFx1Red = (uchar*)0x55F6E9; //m_fPostFx1Red[184] -unsigned char* m_fWaterAlpha{ (unsigned char*)patch::GetPointer(0x55F6D6)}; //m_fWaterAlpha[184] +uchar* m_fWaterAlpha = (uchar*)0x55F6D6; //m_fWaterAlpha[184] -unsigned char* m_fWaterBlue{ (unsigned char*)patch::GetPointer(0x55F6C3)}; //m_fWaterBlue[184] +uchar* m_fWaterBlue = (uchar*)0x55F6C3; //m_fWaterBlue[184] -unsigned char* m_fWaterGreen{ (unsigned char*)patch::GetPointer(0x55F6B0)}; //m_fWaterGreen[184] +uchar* m_fWaterGreen = (uchar*)0x55F6B0; //m_fWaterGreen[184] -unsigned char* m_fWaterRed{ (unsigned char*)patch::GetPointer(0x55F69C)}; //m_fWaterRed[184] +uchar* m_fWaterRed = (uchar*)0x55F69C; //m_fWaterRed[184] -unsigned char* m_nFluffyCloudsBottomBlue{ (unsigned char*)patch::GetPointer(0x55F690)}; //m_nFluffyCloudsBottomBlue[184] +uchar* m_nFluffyCloudsBottomBlue = (uchar*)0x55F690; //m_nFluffyCloudsBottomBlue[184] -unsigned char* m_nFluffyCloudsBottomGreen{ (unsigned char*)patch::GetPointer(0x55F683)}; //m_nFluffyCloudsBottomGreen[184] +uchar* m_nFluffyCloudsBottomGreen = (uchar*)0x55F683;//m_nFluffyCloudsBottomGreen[184] -unsigned char* m_nFluffyCloudsBottomRed{ (unsigned char*)patch::GetPointer(0x55F677)}; //m_nFluffyCloudsBottomRed[184] +uchar* m_nFluffyCloudsBottomRed = (uchar*)0x55F677; //m_nFluffyCloudsBottomRed[184] -unsigned char* m_nLowCloudsBlue{ (unsigned char*)patch::GetPointer(0x55F66B)}; //m_nLowCloudsBlue[184] +uchar* m_nLowCloudsBlue = (uchar*)0x55F66B; //m_nLowCloudsBlue[184] -unsigned char* m_nLowCloudsGreen{ (unsigned char*)patch::GetPointer(0x55F65F)}; //m_nLowCloudsGreen[184] +uchar* m_nLowCloudsGreen = (uchar*)0x55F65F; //m_nLowCloudsGreen[184] -unsigned char* m_nLowCloudsRed{ (unsigned char*)patch::GetPointer(0x55F653)}; //m_nLowCloudsRed[184] +uchar* m_nLowCloudsRed = (uchar*)0x55F653; //m_nLowCloudsRed[184] -unsigned char* m_fLightsOnGroundBrightness{ (unsigned char*)patch::GetPointer(0x55F640)}; //m_fLightsOnGroundBrightness[184] +uchar* m_fLightsOnGroundBrightness = (uchar*)0x55F640;//m_fLightsOnGroundBrightness[184] -short* m_fFogStart{ (short*)patch::GetPointer(0x55F62E)}; //m_fFogStart[184] +short* m_fFogStart = (short*)0x55F62E; //m_fFogStart[184] -short* m_fFarClip{ (short*)patch::GetPointer(0x55F61B)}; //m_fFarClip[184] +short* m_fFarClip = (short*)0x55F61B; //m_fFarClip[184] -unsigned char* m_nPoleShadowStrength{ (unsigned char*)patch::GetPointer(0x55F60F)}; //m_nPoleShadowStrength[184] +uchar* m_nPoleShadowStrength = (uchar*)0x55F60F; //m_nPoleShadowStrength[184] -unsigned char* m_nLightShadowStrength{ (unsigned char*)patch::GetPointer(0x55F603)}; //m_nLightShadowStrength[184] +uchar* m_nLightShadowStrength = (uchar*)0x55F603; //m_nLightShadowStrength[184] -unsigned char* m_nShadowStrength{ (unsigned char*)patch::GetPointer(0x55F5F7)}; //m_nShadowStrength[184] +uchar* m_nShadowStrength = (uchar*)0x55F5F7; //m_nShadowStrength[184] -unsigned char* m_fSpriteBrightness{ (unsigned char*)patch::GetPointer(0x55F5E4)}; //m_fSpriteBrightness[184] +uchar* m_fSpriteBrightness = (uchar*)0x55F5E4; //m_fSpriteBrightness[184] -unsigned char* m_fSpriteSize{ (unsigned char*)patch::GetPointer(0x55F5D2)}; //m_fSpriteSize[184] +uchar* m_fSpriteSize = (uchar*)0x55F5D2; //m_fSpriteSize[184] -unsigned char* m_fSunSize{ (unsigned char*)patch::GetPointer(0x55F5C0)}; //m_fSunSize[184] +uchar* m_fSunSize = (uchar*)0x55F5C0; //m_fSunSize[184] -unsigned char* m_nSunCoronaBlue{ (unsigned char*)patch::GetPointer(0x55F5B5)}; //m_nSunCoronaBlue[184] +uchar* m_nSunCoronaBlue = (uchar*)0x55F5B5; //m_nSunCoronaBlue[184] -unsigned char* m_nSunCoronaGreen{ (unsigned char*)patch::GetPointer(0x55F5A9)}; //m_nSunCoronaGreen[184] +uchar* m_nSunCoronaGreen = (uchar*)0x55F5A9; //m_nSunCoronaGreen[184] -unsigned char* m_nSunCoronaRed{ (unsigned char*)patch::GetPointer(0x55F59D)}; //m_nSunCoronaRed[184] +uchar* m_nSunCoronaRed = (uchar*)0x55F59D; //m_nSunCoronaRed[184] -unsigned char* m_nSunCoreBlue{ (unsigned char*)patch::GetPointer(0x55F591)}; //m_nSunCoreBlue[184] +uchar* m_nSunCoreBlue = (uchar*)0x55F591; //m_nSunCoreBlue[184] -unsigned char* m_nSunCoreGreen{ (unsigned char*)patch::GetPointer(0x55F585)}; //m_nSunCoreGreen[184] +uchar* m_nSunCoreGreen = (uchar*)0x55F585; //m_nSunCoreGreen[184] -unsigned char* m_nSunCoreRed{ (unsigned char*)patch::GetPointer(0x55F579)}; //m_nSunCoreRed[184] +uchar* m_nSunCoreRed = (uchar*)0x55F579; //m_nSunCoreRed[184] -unsigned char* m_nSkyBottomBlue{ (unsigned char*)patch::GetPointer(0x55F56D)}; //m_nSkyBottomBlue[184] +uchar* m_nSkyBottomBlue = (uchar*)0x55F56D; //m_nSkyBottomBlue[184] -unsigned char* m_nSkyBottomGreen{ (unsigned char*)patch::GetPointer(0x55F561)}; //m_nSkyBottomGreen[184] +uchar* m_nSkyBottomGreen = (uchar*)0x55F561; //m_nSkyBottomGreen[184] -unsigned char* m_nSkyBottomRed{ (unsigned char*)patch::GetPointer(0x55F555)}; //m_nSkyBottomRed[184] +uchar* m_nSkyBottomRed = (uchar*)0x55F555; //m_nSkyBottomRed[184] -unsigned char* m_nSkyTopBlue{ (unsigned char*)patch::GetPointer(0x55F549)}; //m_nSkyTopBlue[45] +uchar* m_nSkyTopBlue = (uchar*)0x55F549; //m_nSkyTopBlue[45] -unsigned char* m_nSkyTopGreen{ (unsigned char*)patch::GetPointer(0x55F53D)}; //m_nSkyTopGreen[45] +uchar* m_nSkyTopGreen = (uchar*)0x55F53D; //m_nSkyTopGreen[45] -unsigned char* m_nSkyTopRed{ (unsigned char*)patch::GetPointer(0x55F531)}; //m_nSkyTopRed[45] +uchar* m_nSkyTopRed = (uchar*)0x55F531; //m_nSkyTopRed[45] -unsigned char* m_nAmbientBlue_Obj{ (unsigned char*)patch::GetPointer(0x55F51E)}; //m_nAmbientBlue_Obj[184] +uchar* m_nAmbientBlue_Obj = (uchar*)0x55F51E; //m_nAmbientBlue_Obj[184] -unsigned char* m_nAmbientGreen_Obj{ (unsigned char*)patch::GetPointer(0x55F50C)}; //m_nAmbientGreen_Obj[184] +uchar* m_nAmbientGreen_Obj = (uchar*)0x55F50C; //m_nAmbientGreen_Obj[184] -unsigned char* m_nAmbientRed_Obj{ (unsigned char*)patch::GetPointer(0x55F4FA)}; //m_nAmbientRed_Obj[184] +uchar* m_nAmbientRed_Obj = (uchar*)0x55F4FA; //m_nAmbientRed_Obj[184] -unsigned char* m_nAmbientBlue{ (unsigned char*)patch::GetPointer(0x55F4E8)}; //m_nAmbientBlue[184] +uchar* m_nAmbientBlue = (uchar*)0x55F4E8; //m_nAmbientBlue[184] -unsigned char* m_nAmbientGreen{ (unsigned char*)patch::GetPointer(0x55F4D6)}; //m_nAmbientGreen[184] +uchar* m_nAmbientGreen = (uchar*)0x55F4D6; //m_nAmbientGreen[184] -unsigned char* m_nAmbientRed{ (unsigned char*)patch::GetPointer(0x560C61)}; //m_nAmbientRed[184] +uchar* m_nAmbientRed = (uchar*)0x560C61; //m_nAmbientRed[184] diff --git a/src/Vehicle.cpp b/src/Vehicle.cpp index 0bc4b0e..17fd2ac 100644 --- a/src/Vehicle.cpp +++ b/src/Vehicle.cpp @@ -525,7 +525,7 @@ void Vehicle::SpawnVehicle(std::string &smodel) int hveh = 0; if (spawner::spawn_inside) { - Command(imodel, pos.x, pos.y, pos.z + 3.0f, &hveh); + Command(imodel, pos.x, pos.y, pos.z + 4.0f, &hveh); veh = CPools::GetVehicle(hveh); veh->SetHeading(player->GetHeading()); Command(hplayer, hveh); diff --git a/src/Visual.cpp b/src/Visual.cpp index 37f33e0..83d2db8 100644 --- a/src/Visual.cpp +++ b/src/Visual.cpp @@ -78,16 +78,20 @@ bool Visual::TimeCycColorEdit3(const char* label, uchar *r, uchar *g, uchar *b, bool rtn = false; int val = 23 * GetCurrentHourTimeId() + CWeather::OldWeatherType; - float col[3]{ r[val] / 255.0f, g[val] / 255.0f, b[val] / 255.0f }; + uchar *red = (uchar*)patch::GetPointer(int(r)); + uchar *green = (uchar*)patch::GetPointer(int(g)); + uchar *blue = (uchar*)patch::GetPointer(int(b)); + float col[3]{red[val]/255.0f,green[val]/255.0f,blue[val]/255.0f}; + if (ImGui::ColorEdit3(label, col, flags)) { - r[val] = col[0] * 255; - g[val] = col[1] * 255; - b[val] = col[2] * 255; + red[val] = col[0] * 255; + green[val] = col[1] * 255; + blue[val] = col[2] * 255; rtn = true; } - + return rtn; } @@ -95,15 +99,20 @@ bool Visual::TimeCycColorEdit4(const char* label, uchar *r, uchar *g, uchar *b, { bool rtn = false; int val = 23 * GetCurrentHourTimeId() + CWeather::OldWeatherType; + + uchar *red = (uchar*)patch::GetPointer(int(r)); + uchar *green = (uchar*)patch::GetPointer(int(g)); + uchar *blue = (uchar*)patch::GetPointer(int(b)); + uchar *alpha = (uchar*)patch::GetPointer(int(a)); - float col[4]{ r[val] / 255.0f, g[val] / 255.0f, b[val] / 255.0f, a[val] / 255.0f }; - + float col[4]{red[val]/255.0f,green[val]/255.0f,blue[val]/255.0f,alpha[val]/255.0f}; + if (ImGui::ColorEdit4(label, col, flags)) { - r[val] = col[0] * 255; - g[val] = col[1] * 255; - b[val] = col[2] * 255; - a[val] = col[3] * 255; + red[val] = col[0] * 255; + green[val] = col[1] * 255; + blue[val] = col[2] * 255; + alpha[val] = col[3] * 255; rtn = true; } @@ -280,7 +289,7 @@ void Visual::Main() ImGui::EndTabItem(); } - if (ImGui::BeginTabItem("Timecyc")) + if ( timecyc_hour == 8 ? ImGui::BeginTabItem("Timecyc") : ImGui::BeginTabItem("Timecyc 24h")) { ImGui::Spacing(); if (ImGui::Button("Generate timecyc file", Ui::GetSize(2))) diff --git a/src/Visual.h b/src/Visual.h index 0ffe42d..e7fd7bb 100644 --- a/src/Visual.h +++ b/src/Visual.h @@ -22,11 +22,12 @@ public: }; template -void Visual::TimecycSlider(const char* label, T* data, int min, int max) +void Visual::TimecycSlider(const char* label, T* ptr, int min, int max) { int val = 23 * GetCurrentHourTimeId() + CWeather::OldWeatherType; - int a = data[val]; - + T *arr = (T*)patch::GetPointer(int(ptr)); + int a = arr[val]; + if (ImGui::SliderInt(label, &a, min, max)) - data[val] = (T)a; + arr[val] = (T)a; } \ No newline at end of file