Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Pedestrian Traffic Signal Fix


spaceeinstein
 Share

Recommended Posts

spaceeinstein

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.

 

signal.gif

 

Installation

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 by spaceeinstein
Link to comment
Share on other sites

First!

 

Wonderful job as always space. By the way, I've never noticed this bug on PS2. :O

Then R* forgot to add the rest of the code to the game?

Link to comment
Share on other sites

spaceeinstein

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 by spaceeinstein
Link to comment
Share on other sites

Inadequate

All traffic lights in-game are Miami-style. You can reuse the trafficlight1 model though.

Link to comment
Share on other sites

  • 1 year later...
Old Man With No Name

I installed the mod. But its not working

 

Same location, but still same traffic light

 

KpK6l9R.jpg

 

 

Link to comment
Share on other sites

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.

  • Like 3
Link to comment
Share on other sites

  • 8 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.