spaceeinstein Posted May 5, 2017 Share Posted May 5, 2017 (edited) Introduction Pedestrian Traffic Signal Fix is a plugin for Grand Theft Auto: Vice City. The traffic light model trafficlight1.dff does not make an appearance in the world, but if you were to use it in your world, the model does not display a pedestrian traffic signal at all as seen in the left image. In Grand Theft Auto III, the model features a fully functional signal but only some code for it was carried over to GTA: Vice City. This plugin ports over the missing code, fully reenabling the pedestrian traffic signal for the traffic light model as seen in the right image. Installation Download the mod at GTAGarage. Copy pedestrian-traffic-signal-fix.asi into Vice City's folder. This mod has been tested only on VC v1.00 US but should theoretically work on v1.01 and Steam. Source #include #include #include class CVector{public: float x, y, z;};class CShinyTexts{public: CVector vec1; CVector vec2; CVector vec3; CVector vec4; float unk[8]; float distance; uint8_t type; uint8_t r; uint8_t g; uint8_t b;};static uint32_t jumpAddress = 0x00464BD9;static uint32_t shinyTextsJumpEnd = 0x00465BB8;static auto LightForPeds = (uint8_t(__cdecl *)(void))0x00465BE0;static auto ml = (CVector *(__cdecl *)(CVector *, void *, const CVector &))0x004DFF20;static uint32_t TheCamera = 0x007E4688;static CShinyTexts *aShinyTexts = reinterpret_cast(0x0094A218);static uint32_t &nTimeInMilliseconds = *reinterpret_cast(0x00974B2C);static uint32_t &NumShinyTexts = *reinterpret_cast(0x00978618);void RegisterOne(CVector vec1, CVector vec2, CVector vec3, CVector vec4, float f0, float f1, float f2, float f3, float f4, float f5, float f6, float f7, uint8_t type, uint8_t r, uint8_t g, uint8_t b, float maxDistance){ aShinyTexts[NumShinyTexts].distance = sqrt( pow((vec1.x - *reinterpret_cast(TheCamera + 0x30)), 2) + pow((vec1.y - *reinterpret_cast(TheCamera + 0x34)), 2) + pow((vec1.z - *reinterpret_cast(TheCamera + 0x38)), 2)); if (aShinyTexts[NumShinyTexts].distance maxDistance / 2.0f) { float fade = 2.0f - 2.0f * aShinyTexts[NumShinyTexts].distance / maxDistance; aShinyTexts[NumShinyTexts].r = static_cast(static_cast® * fade); aShinyTexts[NumShinyTexts].g = static_cast(static_cast(g) * fade); aShinyTexts[NumShinyTexts].b = static_cast(static_cast(b) * fade); } NumShinyTexts++; }}void RegisterOneCall(void *mat){ CVector vec1 = {}, vec2 = {}, vec3 = {}, vec4 = {}, in1, in2, in3, in4; if (LightForPeds() == 2) { // don't walk in1 = { 2.7, 0.706, -0.127 }; in2 = { 2.7, 1.256, -0.127 }; in3 = { 2.7, 0.706, -0.40166664 }; in4 = { 2.7, 1.256, -0.40166664 }; ml(&vec1, mat, in1); ml(&vec2, mat, in2); ml(&vec3, mat, in3); ml(&vec4, mat, in4); RegisterOne(vec1, vec2, vec3, vec4, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1, 255, 0, 0, 60.0); } else if (LightForPeds() == 0 || nTimeInMilliseconds & 0x100) { // walk in1 = { 2.7, 0.706, -0.40166664 }; in2 = { 2.7, 1.256, -0.40166664 }; in3 = { 2.7, 0.706, -0.539 }; in4 = { 2.7, 1.256, -0.539 }; ml(&vec1, mat, in1); ml(&vec2, mat, in2); ml(&vec3, mat, in3); ml(&vec4, mat, in4); RegisterOne(vec1, vec2, vec3, vec4, 1.0, 0.5, 0.0, 0.5, 1.0, 1.0, 0.0, 1.0, 1, 255, 255, 255, 60.0); }}void __declspec(naked) RegisterOneCallProxy(){ __asm { lea edi, [edi+4] push edi call RegisterOneCall add esp, 4 jmp shinyTextsJumpEnd }}BOOL APIENTRY DllMain(HMODULE, DWORD reason, LPVOID){ if (reason == DLL_PROCESS_ATTACH) { if (*reinterpret_cast(jumpAddress) == 0x000FDAE9) { DWORD flOldProtect; VirtualProtect(reinterpret_cast(jumpAddress + 1), 4, PAGE_EXECUTE_READWRITE, &flOldProtect); *reinterpret_cast(jumpAddress + 1) = reinterpret_cast(&RegisterOneCallProxy) - jumpAddress - 5; VirtualProtect(reinterpret_cast(jumpAddress + 1), 4, flOldProtect, &flOldProtect); } } return TRUE;} Thanks to Silent and HM128 for showing that a fix is possible. Edited May 5, 2017 by spaceeinstein Hovac, DubHaMlg777, Azure Blue and 16 others 19 Link to comment https://gtaforums.com/topic/886718-pedestrian-traffic-signal-fix/ Share on other sites More sharing options...
gts. Posted May 5, 2017 Share Posted May 5, 2017 First! Wonderful job as always space. By the way, I've never noticed this bug on PS2. Then R* forgot to add the rest of the code to the game? inadequate 1 Link to comment https://gtaforums.com/topic/886718-pedestrian-traffic-signal-fix/#findComment-1069553641 Share on other sites More sharing options...
spaceeinstein Posted May 5, 2017 Author Share Posted May 5, 2017 (edited) This specific traffic light model doesn't appear in the world by default. There are only Miami-style traffic lights. The model exists in the game files and can be placed in the world by editing the IPL file. The vehicular traffic signal works just fine but the pedestrian traffic signal doesn't. Edited May 5, 2017 by spaceeinstein Link to comment https://gtaforums.com/topic/886718-pedestrian-traffic-signal-fix/#findComment-1069553644 Share on other sites More sharing options...
Guest Posted May 8, 2017 Share Posted May 8, 2017 Which traffic light models are the Miami-style ones? Link to comment https://gtaforums.com/topic/886718-pedestrian-traffic-signal-fix/#findComment-1069559267 Share on other sites More sharing options...
inadequate Posted May 8, 2017 Share Posted May 8, 2017 All traffic lights in-game are Miami-style. You can reuse the trafficlight1 model though. Link to comment https://gtaforums.com/topic/886718-pedestrian-traffic-signal-fix/#findComment-1069559979 Share on other sites More sharing options...
Old Man With No Name Posted June 26, 2018 Share Posted June 26, 2018 I installed the mod. But its not working Same location, but still same traffic light Link to comment https://gtaforums.com/topic/886718-pedestrian-traffic-signal-fix/#findComment-1070284510 Share on other sites More sharing options...
LaDiDa Posted June 26, 2018 Share Posted June 26, 2018 8 hours ago, GroveStGTAV said: I installed the mod. But its not working Same location, but still same traffic light The traffic light model trafficlight1.dff does not make an appearance in the world Better read OP next time, unless you put that specific traffic light model in your map you're not going to encounter it. HYPERCRYPT, Old Man With No Name and Blackbird88 3 Link to comment https://gtaforums.com/topic/886718-pedestrian-traffic-signal-fix/#findComment-1070285232 Share on other sites More sharing options...
CanerKaraca Posted March 13, 2019 Share Posted March 13, 2019 How can i activate this in game ? Link to comment https://gtaforums.com/topic/886718-pedestrian-traffic-signal-fix/#findComment-1070676418 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now