
// NOT DOCUMENTED AT THIS STAGE - IF YOU'RE INTERESTED IN EXTENDING THE MOD,
// JUST TRACK WHAT THE MOD DOES IN-GAME AT THE VARIOUS INSTALL ADDRESSES
// WITH YOUR DEBUGGER.


#include "stdafx.h"
#include "stdio.h"



//***********************************************
//GLOBAL WEAPON DATA
//***********************************************


WORD weatherTable1[64];
WORD weatherTable2[64];
BYTE weatherDurations[6][2];
WORD weatherProbs[6][6];

//global tint data
BYTE tintRed[25][7];	//using 24 gives faulty data when scanning data in for some reason
BYTE tintGreen[25][7];
BYTE tintBlue[25][7];
BYTE tintAlpha[25][7];



//DO ENTER NEW MEMBERS ONLY AT THE BOTTOM TO PRESERVE EXISTING DATA ORDER
struct PRECIPITATIONDATA
{
	DWORD reserved1;
	DWORD reserved2;
	DWORD reserved3;
	DWORD worldRainSpawnFreq;
	float worldRainSize;		//deprecated
	float worldRainDropDistance;
	float worldRainDespawnAdder;
	float worldRainDropHeight;
	float camRainDropSpeedMultiplier;
	float worldRainDespawnTime1;
	float worldRainDespawnTime2;
	float worldRainSpawnDistMod;	//multiplier to speed force for spawn distance
	float worldRainSpawnSpeedTresh; //threshhold for player speed force beyond which no world rain gets rendered
	float worldRainScale;
	float worldRainSpeedInfluence;
	float worldRainDispersion;
	float streetReflections;
	float surfaceGrip;
	DWORD padding1;
	DWORD padding2;
	DWORD padding3;
	DWORD padding4;

	PRECIPITATIONDATA()
	{
		reserved1 = 0;
		reserved2 = 0;
		reserved3 = 0;
		worldRainSpawnFreq = 0x0F00;
		worldRainSize = 0.25;	//deprecated
		worldRainDropDistance = -12.0;
		worldRainDespawnAdder = 0.0;
		worldRainDropHeight = 8.0;
		camRainDropSpeedMultiplier = 1.0;	
		worldRainDespawnTime1 = 3.7f;
		worldRainDespawnTime2 = 4.0;
		worldRainSpawnDistMod = 2.0;
		worldRainSpawnSpeedTresh = 1.75;
		worldRainScale = 1.0;
		worldRainSpeedInfluence = 1.0;
		worldRainDispersion = 0.04f;
		streetReflections = 1.0f;
		surfaceGrip = 1.0f;
		padding1 = 0;
		padding2 = 0;
		padding3 = 0;
		padding4 = 0;
	}
};

struct DXMATERIALTEMP
{
	float diffR;
	float diffG;
	float diffB;
	float diffA;
	float ambR;
	float ambG;
	float ambB;
	float ambA;
	float specR;
	float specG;
	float specB;
	float specA;
	float emissR;
	float emissG;
	float emissB;
	float emissA;
	float power;

	DXMATERIALTEMP()
	{
		diffR = 0.0;
		diffG = 0.0;
		diffB = 0.0;
		diffA = 1.0;
		ambR = 0.5;
		ambG = 0.5;
		ambB = 0.5;
		ambA = 1.0;
		specR = 0.0;
		specG = 0.0;
		specB = 0.0;
		specA = 1.0;
		emissR = 0.0;
		emissG = 0.0;
		emissB = 0.0;
		emissA = 1.0;
		power = 0.0;

	}
};

float windIntensityTable[7];
float windTreeFixTable[7];
float windCloudFixTable[7];


//DO ENTER NEW MEMBERS ONLY AT THE BOTTOM TO PRESERVE EXISTING DATA ORDER
struct VC_WEATHERGLOBALDATA
{
	DWORD reserved1;
	DWORD reserved2;
	BYTE weatherGenerationType;
	BYTE defaultWeatherTable;
	BYTE activateTint;
	BYTE initialWeatherState;
	DWORD tintRedPtr;
	DWORD tintGreenPtr;
	DWORD tintBluePtr;
	DWORD tintAlphaPtr;
	DWORD temp;
	DWORD curTint;
	DWORD weatherTable1Ptr;
	DWORD weatherTable2Ptr;
	DWORD weatherDurationsPtr;
	DWORD weatherProbsPtr;
	PRECIPITATIONDATA* weather02Data;
	PRECIPITATIONDATA* weather05Data;
	DXMATERIALTEMP* snowMaterial;
	DWORD _2DRainTexturePtr1;
	DWORD _2DRainTexturePtr2;
	DWORD rainTexturePtr1;
	DWORD rainTexturePtr2;
	BYTE useVC_Snow;
	BYTE snowR;
	BYTE snowG;
	BYTE snowB;
	BYTE rainbowStart;
	BYTE rainbowEnd;
	WORD unused1;
	DWORD windTreeFixPtr;
	DWORD windCloudFixPtr;
	DWORD padding1;
	DWORD padding2;
	DWORD padding3;
	DWORD padding4;

	VC_WEATHERGLOBALDATA()
	{
		reserved1 = 0;
		reserved2 = 0;
		weatherGenerationType = 0;
		defaultWeatherTable = 1;
		activateTint = 0;
		initialWeatherState = 04;
		tintRedPtr = 0x00000000;
		tintGreenPtr = 0x00000000;
		tintBluePtr = 0x00000000;
		tintAlphaPtr = 0x00000000;
		temp = 0;
		curTint = 0;
		weatherTable1Ptr = 0x00000000;
		weatherTable2Ptr = 0x00000000;
		weatherDurationsPtr = 0x00000000;
		weatherProbsPtr = 0x00000000;
		weather02Data = new PRECIPITATIONDATA();
		weather05Data = new PRECIPITATIONDATA();
		snowMaterial = new DXMATERIALTEMP();
		_2DRainTexturePtr1 = 0;
		_2DRainTexturePtr2 = 0;
		rainTexturePtr1 = 0;
		rainTexturePtr2 = 0;
		useVC_Snow = 0;
		rainbowStart = 0;
		rainbowEnd = 0;
		unused1 = 0;
		windTreeFixPtr = (DWORD) windTreeFixTable;
		windCloudFixPtr = (DWORD) windCloudFixTable;
		padding1 = 0;
		padding2 = 0;
		padding3 = 0;
		padding4 = 0;
	}
};

//GLOBAL DATA STRUCTURE
VC_WEATHERGLOBALDATA VC_WeatherGlobalData = VC_WEATHERGLOBALDATA();
DWORD *VC_WeatherPointerAddr			= (DWORD *) 0x6DFFE0;

//global variables
DWORD *PtrToPlayer						= (DWORD *) 0x97F2AC;
DWORD *UseAlternateWeatherTable			= (DWORD *) 0xA0FCAC;
DWORD *WeatherTableIndex				= (DWORD *) 0x9B6E0C;
DWORD *NextWeather						= (DWORD *) 0xA10A2E;
DWORD *CurrentWeather					= (DWORD *) 0xA10AAA;
DWORD *D3DDevicePtr						= (DWORD *) 0x7897A8;
DWORD *WindTableBase					= (DWORD *) 0x699EC0;
DWORD *IngameTimerInMS					= (DWORD *) 0x974B2C;
DWORD *StandardMaterial					= (DWORD *) 0x6DDEB8;
DWORD *CamPosBase						= (DWORD *) 0x7E46B8;
DWORD *HourElapsed						= (DWORD *) 0x9787D8;

//constant
const float nine = 9.0f;
const float eleven = 11.0f;

//Used possibly across modules
DWORD *RandomNumberCallDest				= (DWORD *) 0x6499F0;
DWORD *GetPlayerCallDest				= (DWORD *) 0x4BC120;
DWORD *CalcCurTimeCycValueCallDest		= (DWORD *) 0x4D0560;
DWORD *RenderParticlesCallDest			= (DWORD *) 0x4A6510;
DWORD *ChangeRenderStateSetupCallDest	= (DWORD *) 0x649BA0;
DWORD *RenderRectangleCallDest			= (DWORD *) 0x577B00;
DWORD *CreateParticleProc				= (DWORD *) 0x563CC0;
DWORD *CreateParticleWrapperProc		= (DWORD *) 0x5648F0;
DWORD *RWSetRenderStateProc				= (DWORD *) 0x6582A0;




//***********************************************
//WEATHER CONTROL
//***********************************************
//DWORD *OrigWeatherTable1Addr = (DWORD *) 0x699EE4;
//DWORD *OrigWeatherTable2Addr = (DWORD *) 0x699F64;
DWORD *WeatherTable1Install = (DWORD *) 0x57D612;
DWORD *WeatherTable2Install = (DWORD *) 0x57D622;
DWORD *InitCurWeatherInstall = (DWORD *) 0x57E060;
DWORD *InitNextWeatherInstall = (DWORD *) 0x57E04C;
DWORD *DefaultWeatherTableInstall = (DWORD *) 0x4CE6CF;
DWORD *RandomWeatherInstall = (DWORD *) 0x57D5ED;



BYTE DefaultWeatherTableProc[21] =	{0x50, 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x0F, 0xB6,
									 0x40, 0x09, 0xA3, 0xAC, 0xFC, 0xA0, 0x00, 0x58,
									 0xE9, 0xAF, 0x09, 0xE5, 0xFF};
BYTE DefaultWeatherTableInst[5] =	{0xE9, 0x00, 0x00, 0x00, 0x00};


BYTE RandomWeatherProc[241] =		{0x50, 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x0F, 0xB6,
									 0x40, 0x08, 0x83, 0xF8, 0x00, 0x58, 0x75, 0x0A,
									 0xA1, 0x0C, 0x6E, 0x9B, 0x00, 0xE9, 0xC8, 0xF8,
									 0xEF, 0xFF, 0x51, 0xA1, 0x0C, 0x6E, 0x9B, 0x00, 
									 0x8B, 0xC8, 0x81, 0xE1, 0x80, 0x00, 0x00, 0x00,
									 0x85, 0xC9, 0x75, 0x02, 0x33, 0xC0, 0x83, 0xE0,
									 0x7F, 0x83, 0xF8, 0x00, 0x7E, 0x19, 0x48, 0x0D,
									 0x80, 0x00, 0x00, 0x00, 0xA3, 0x0C, 0x6E, 0x9B,
									 0x00, 0x66, 0x0F, 0xB7, 0x05, 0x2E, 0x0A, 0xA1,
									 0x00, 0x59, 0xE9, 0xCF, 0xF8, 0xEF, 0xFF, 0x52,
									 0x53, 0x53, 0xE8, 0x89, 0xBC, 0xFC, 0xFF, 0x25,
									 0xFF, 0xFF, 0x00, 0x00, 0x89, 0x04, 0x24, 0xDB,
									 0x04, 0x24, 0xD8, 0x0D, 0x14, 0x72, 0x68, 0x00, 
									 0xD8, 0x0D, 0x58, 0x70, 0x68, 0x00, 0x3E, 0xDB,
									 0x1C, 0x24, 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x8B,
									 0x40, 0x30, 0x8B, 0x15, 0xAA, 0x0A, 0xA1, 0x00,
									 0x8D, 0x14, 0x52, 0x8D, 0x04, 0x90, 0x33, 0xC9,
									 0x33, 0xD2, 0x66, 0x03, 0x0C, 0x50, 0x3B, 0x0C,
									 0x24, 0x7F, 0x08, 0x83, 0xFA, 0x05, 0x74, 0x03,
									 0x42, 0xEB, 0xEF, 0xE8, 0x40, 0xBC, 0xFC, 0xFF,
									 0x25, 0xFF, 0xFF, 0x00, 0x00, 0x89, 0x04, 0x24,
									 0xDB, 0x04, 0x24, 0xD8, 0x0D, 0x14, 0x72, 0x68,
									 0x00, 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x8B, 0x40,
									 0x2C, 0x33, 0xC9, 0x33, 0xDB, 0x8A, 0x4C, 0x50,
									 0x01, 0x8A, 0x1C, 0x50, 0x2A, 0xCB, 0x89, 0x0C,
									 0x24, 0xDF, 0x04, 0x24, 0xD8, 0xC9, 0xDF, 0x1C,
									 0x24, 0xDD, 0xD8, 0x03, 0x1C, 0x24, 0x4B, 0x83,
									 0xE3, 0x7F, 0x81, 0xCB, 0x80, 0x00, 0x00, 0x00,
									 0x89, 0x1D, 0x0C, 0x6E, 0x9B, 0x00, 0x8B, 0xC2,
									 0x5B, 0x5B, 0x5A, 0x59, 0xE9, 0x2D, 0xF8, 0xEF,
									 0xFF};
BYTE RandomWeatherInst[5] =			{0xE9, 0x00, 0x00, 0x00, 0x00};



void InstallWeatherControl()
{
	DWORD protect1, protect2;
	BYTE tempData[4] =	{0x00, 0x00, 0x00, 0x00};

	tempData[0] = LOBYTE(LOWORD((DWORD) VC_WeatherGlobalData.weatherTable1Ptr));
	tempData[1] = HIBYTE(LOWORD((DWORD) VC_WeatherGlobalData.weatherTable1Ptr));
	tempData[2] = LOBYTE(HIWORD((DWORD) VC_WeatherGlobalData.weatherTable1Ptr));
	tempData[3] = HIBYTE(HIWORD((DWORD) VC_WeatherGlobalData.weatherTable1Ptr));
	VirtualProtect(WeatherTable1Install, sizeof(tempData), PAGE_READWRITE, &protect1);
	memcpy(WeatherTable1Install, &tempData, sizeof(tempData));
	VirtualProtect(WeatherTable1Install, sizeof(tempData), protect1, &protect2);

	tempData[0] = LOBYTE(LOWORD((DWORD) VC_WeatherGlobalData.weatherTable2Ptr));
	tempData[1] = HIBYTE(LOWORD((DWORD) VC_WeatherGlobalData.weatherTable2Ptr));
	tempData[2] = LOBYTE(HIWORD((DWORD) VC_WeatherGlobalData.weatherTable2Ptr));
	tempData[3] = HIBYTE(HIWORD((DWORD) VC_WeatherGlobalData.weatherTable2Ptr));
	VirtualProtect(WeatherTable2Install, sizeof(tempData), PAGE_READWRITE, &protect1);
	memcpy(WeatherTable2Install, &tempData, sizeof(tempData));
	VirtualProtect(WeatherTable2Install, sizeof(tempData), protect1, &protect2);


	BYTE tempData2[2] =	{0x00, 0x00};
	tempData2[0] = LOBYTE((WORD) VC_WeatherGlobalData.initialWeatherState);
	tempData2[1] = HIBYTE((WORD) VC_WeatherGlobalData.initialWeatherState);
	VirtualProtect(InitCurWeatherInstall, sizeof(tempData2), PAGE_READWRITE, &protect1);
	memcpy(InitCurWeatherInstall, &tempData2, sizeof(tempData2));
	VirtualProtect(InitCurWeatherInstall, sizeof(tempData2), protect1, &protect2);
	VirtualProtect(InitNextWeatherInstall, sizeof(tempData2), PAGE_READWRITE, &protect1);
	memcpy(InitNextWeatherInstall, &tempData2, sizeof(tempData2));
	VirtualProtect(InitNextWeatherInstall, sizeof(tempData2), protect1, &protect2);


	DefaultWeatherTableProc[2] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	DefaultWeatherTableProc[3] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	DefaultWeatherTableProc[4] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	DefaultWeatherTableProc[5] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	DefaultWeatherTableProc[11] = LOBYTE(LOWORD((DWORD) UseAlternateWeatherTable));
	DefaultWeatherTableProc[12] = HIBYTE(LOWORD((DWORD) UseAlternateWeatherTable));
	DefaultWeatherTableProc[13] = LOBYTE(HIWORD((DWORD) UseAlternateWeatherTable));
	DefaultWeatherTableProc[14] = HIBYTE(HIWORD((DWORD) UseAlternateWeatherTable));
	long relJumpDist1 =  (((DWORD) DefaultWeatherTableInstall)+5) - (((DWORD) DefaultWeatherTableProc)+21);
	DefaultWeatherTableProc[17] = LOBYTE(LOWORD(relJumpDist1));
	DefaultWeatherTableProc[18] = HIBYTE(LOWORD(relJumpDist1));
	DefaultWeatherTableProc[19] = LOBYTE(HIWORD(relJumpDist1));
	DefaultWeatherTableProc[20] = HIBYTE(HIWORD(relJumpDist1));
	long relJumpDist2 =  ((DWORD) DefaultWeatherTableProc) - (((DWORD) DefaultWeatherTableInstall)+5);
	DefaultWeatherTableInst[1] = LOBYTE(LOWORD(relJumpDist2));
	DefaultWeatherTableInst[2] = HIBYTE(LOWORD(relJumpDist2));
	DefaultWeatherTableInst[3] = LOBYTE(HIWORD(relJumpDist2));
	DefaultWeatherTableInst[4] = HIBYTE(HIWORD(relJumpDist2));
	VirtualProtect(DefaultWeatherTableInstall, sizeof(DefaultWeatherTableInst), PAGE_READWRITE, &protect1);
	memcpy(DefaultWeatherTableInstall, &DefaultWeatherTableInst, sizeof(DefaultWeatherTableInst));
	VirtualProtect(DefaultWeatherTableInstall, sizeof(DefaultWeatherTableInst), protect1, &protect2);

	RandomWeatherProc[2] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RandomWeatherProc[3] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RandomWeatherProc[4] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RandomWeatherProc[5] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RandomWeatherProc[17] = LOBYTE(LOWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[18] = HIBYTE(LOWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[19] = LOBYTE(HIWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[20] = HIBYTE(HIWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[28] = LOBYTE(LOWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[29] = HIBYTE(LOWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[30] = LOBYTE(HIWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[31] = HIBYTE(HIWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[61] = LOBYTE(LOWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[62] = HIBYTE(LOWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[63] = LOBYTE(HIWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[64] = HIBYTE(HIWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[69] = LOBYTE(LOWORD((DWORD) NextWeather));
	RandomWeatherProc[70] = HIBYTE(LOWORD((DWORD) NextWeather));
	RandomWeatherProc[71] = LOBYTE(HIWORD((DWORD) NextWeather));
	RandomWeatherProc[72] = HIBYTE(HIWORD((DWORD) NextWeather));
	RandomWeatherProc[115] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RandomWeatherProc[116] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RandomWeatherProc[117] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RandomWeatherProc[118] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RandomWeatherProc[124] = LOBYTE(LOWORD((DWORD) CurrentWeather));
	RandomWeatherProc[125] = HIBYTE(LOWORD((DWORD) CurrentWeather));
	RandomWeatherProc[126] = LOBYTE(HIWORD((DWORD) CurrentWeather));
	RandomWeatherProc[127] = HIBYTE(HIWORD((DWORD) CurrentWeather));
	RandomWeatherProc[178] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RandomWeatherProc[179] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RandomWeatherProc[180] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RandomWeatherProc[181] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RandomWeatherProc[226] = LOBYTE(LOWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[227] = HIBYTE(LOWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[228] = LOBYTE(HIWORD((DWORD) WeatherTableIndex));
	RandomWeatherProc[229] = HIBYTE(HIWORD((DWORD) WeatherTableIndex));
	long relJumpDist3 =  (((DWORD) RandomWeatherInstall)+5) - (((DWORD) RandomWeatherProc)+26);
	RandomWeatherProc[22] = LOBYTE(LOWORD(relJumpDist3));
	RandomWeatherProc[23] = HIBYTE(LOWORD(relJumpDist3));
	RandomWeatherProc[24] = LOBYTE(HIWORD(relJumpDist3));
	RandomWeatherProc[25] = HIBYTE(HIWORD(relJumpDist3));
	long relJumpDist4 =  (((DWORD) RandomWeatherInstall)+65) - (((DWORD) RandomWeatherProc)+79);
	RandomWeatherProc[75] = LOBYTE(LOWORD(relJumpDist4));
	RandomWeatherProc[76] = HIBYTE(LOWORD(relJumpDist4));
	RandomWeatherProc[77] = LOBYTE(HIWORD(relJumpDist4));
	RandomWeatherProc[78] = HIBYTE(HIWORD(relJumpDist4));
	DWORD relCallDist1 =  ((DWORD) RandomNumberCallDest) - ((DWORD) RandomWeatherProc+87);
	RandomWeatherProc[83] = LOBYTE(LOWORD(relCallDist1));
	RandomWeatherProc[84] = HIBYTE(LOWORD(relCallDist1));
	RandomWeatherProc[85] = LOBYTE(HIWORD(relCallDist1));
	RandomWeatherProc[86] = HIBYTE(HIWORD(relCallDist1));
	DWORD relCallDist2 =  ((DWORD) RandomNumberCallDest) - ((DWORD) RandomWeatherProc+160);
	RandomWeatherProc[156] = LOBYTE(LOWORD(relCallDist2));
	RandomWeatherProc[157] = HIBYTE(LOWORD(relCallDist2));
	RandomWeatherProc[158] = LOBYTE(HIWORD(relCallDist2));
	RandomWeatherProc[159] = HIBYTE(HIWORD(relCallDist2));
	long relJumpDist5 =  (((DWORD) RandomWeatherInstall)+65) - (((DWORD) RandomWeatherProc)+241);
	RandomWeatherProc[237] = LOBYTE(LOWORD(relJumpDist5));
	RandomWeatherProc[238] = HIBYTE(LOWORD(relJumpDist5));
	RandomWeatherProc[239] = LOBYTE(HIWORD(relJumpDist5));
	RandomWeatherProc[240] = HIBYTE(HIWORD(relJumpDist5));
	long relJumpDist6 =  ((DWORD) RandomWeatherProc) - (((DWORD) RandomWeatherInstall)+5);
	RandomWeatherInst[1] = LOBYTE(LOWORD(relJumpDist6));
	RandomWeatherInst[2] = HIBYTE(LOWORD(relJumpDist6));
	RandomWeatherInst[3] = LOBYTE(HIWORD(relJumpDist6));
	RandomWeatherInst[4] = HIBYTE(HIWORD(relJumpDist6));
	VirtualProtect(RandomWeatherInstall, sizeof(RandomWeatherInst), PAGE_READWRITE, &protect1);
	memcpy(RandomWeatherInstall, &RandomWeatherInst, sizeof(RandomWeatherInst));
	VirtualProtect(RandomWeatherInstall, sizeof(RandomWeatherInst), protect1, &protect2);
	
}

//***********************************************
//TINT ACTIVATION
//***********************************************
DWORD *CalcCurrentTintInstall = (DWORD *) 0x4CED33;
DWORD *RenderTintInstall = (DWORD *) 0x4A604F;

DWORD *SomeAddress = (DWORD *) 0x78D5B0;
DWORD *ResolutionX = (DWORD *) 0x9B48E4;
DWORD *ResolutionY = (DWORD *) 0x9B48E8;

BYTE CalcCurrentTintProc[143] =  {0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x8B, 0x48, 0x0C,
								 0x8B, 0xD1, 0x03, 0xCB, 0x03, 0xD5, 0x5E, 0x5E, 
								 0x52, 0x51, 0xE8, 0x39, 0x28, 0xE5, 0xFF, 0xA1, 
								 0xE0, 0xFF, 0x6D, 0x00, 0xDB, 0x58, 0x1C, 0x8A,
								 0x48, 0x1C, 0x88, 0x48, 0x20, 0x8B, 0x48, 0x10, 
								 0x8B, 0xD1, 0x03, 0xCB, 0x03, 0xD5, 0x5E, 0x5E, 
								 0x52, 0x51, 0xE8, 0x19, 0x28, 0xE5, 0xFF, 0xA1, 
								 0xE0, 0xFF, 0x6D, 0x00, 0xDB, 0x58, 0x1C, 0x8A, 
								 0x48, 0x1C, 0x88, 0x48, 0x21, 0x8B, 0x48, 0x14, 
								 0x8B, 0xD1, 0x03, 0xCB, 0x03, 0xD5, 0x5E, 0x5E, 
								 0x52, 0x51, 0xE8, 0xF9, 0x27, 0xE5, 0xFF, 0xA1, 
								 0xE0, 0xFF, 0x6D, 0x00, 0xDB, 0x58, 0x1C, 0x8A, 
								 0x48, 0x1C, 0x88, 0x48, 0x22, 0x8B, 0x48, 0x18, 
								 0x8B, 0xD1, 0x03, 0xCB, 0x03, 0xD5, 0x5E, 0x5E, 
								 0x52, 0x51, 0xE8, 0xD9, 0x27, 0xE5, 0xFF, 0xA1, 
								 0xE0, 0xFF, 0x6D, 0x00, 0xDB, 0x58, 0x1C, 0x8A, 
								 0x48, 0x1C, 0x88, 0x48, 0x23, 0xB8, 0xB0, 0xD5, 
								 0x78, 0x00, 0xE9, 0x99, 0x0F, 0xE5, 0xFF};
BYTE CalcCurrentTintInst[5] =	{0xE9, 0x00, 0x00, 0x00, 0x00};

BYTE RenderTintProc[112] =		{0xE8, 0xFB, 0x87, 0xE2, 0xFF, 0x50, 0xA1, 0xE0, 
								 0xFF, 0x6D, 0x00, 0x8A, 0x40, 0x0A, 0x3C, 0x00,
								 0x58, 0x0F, 0x84, 0x2D, 0x83, 0xE2, 0xFF, 0x50, 
								 0x51, 0x52, 0x6A, 0x05, 0x6A, 0x0A, 0xE8, 0x7F, 
								 0xBE, 0xFC, 0xFF, 0x83, 0xC4, 0x08, 0x6A, 0x06, 
								 0x6A, 0x0B, 0xE8, 0x73, 0xBE, 0xFC, 0xFF, 0x83, 
								 0xC4, 0x08, 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0xFF, 
								 0x70, 0x20, 0x6A, 0x00, 0x6A, 0x00, 0x6A, 0x00, 
								 0x6A, 0x00, 0xDB, 0x05, 0xE4, 0x48, 0x9B, 0x00, 
								 0xD9, 0x5C, 0x24, 0x08, 0xDB, 0x05, 0xE8, 0x48, 
								 0x9B, 0x00, 0xD9, 0x5C, 0x24, 0x04, 0x8D, 0x44, 
								 0x24, 0x10, 0x50, 0x8D, 0x44, 0x24, 0x04, 0x50, 
								 0xE8, 0x9D, 0x9D, 0xEF, 0xFF, 0x83, 0xC4, 0x1C, 
								 0x5A, 0x59, 0x58, 0xE9, 0xE6, 0x82, 0xE2, 0xFF};

BYTE RenderTintInst[5] =		{0xE9, 0x00, 0x00, 0x00, 0x00};

void InstallTintActivation()
{
	
	DWORD protect1, protect2;
	
	CalcCurrentTintProc[1] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[2] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[3] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[4] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[24] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[25] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[26] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[27] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[56] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[57] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[58] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[59] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[88] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[89] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[90] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[91] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[120] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[121] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[122] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[123] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	CalcCurrentTintProc[134] = LOBYTE(LOWORD((DWORD) SomeAddress));
	CalcCurrentTintProc[135] = HIBYTE(LOWORD((DWORD) SomeAddress));
	CalcCurrentTintProc[136] = LOBYTE(HIWORD((DWORD) SomeAddress));
	CalcCurrentTintProc[137] = HIBYTE(HIWORD((DWORD) SomeAddress));

	DWORD relCallDist1 =  ((DWORD) CalcCurTimeCycValueCallDest) - ((DWORD) CalcCurrentTintProc+23);
	CalcCurrentTintProc[19] = LOBYTE(LOWORD(relCallDist1));
	CalcCurrentTintProc[20] = HIBYTE(LOWORD(relCallDist1));
	CalcCurrentTintProc[21] = LOBYTE(HIWORD(relCallDist1));
	CalcCurrentTintProc[22] = HIBYTE(HIWORD(relCallDist1));
	DWORD relCallDist2 =  ((DWORD) CalcCurTimeCycValueCallDest) - ((DWORD) CalcCurrentTintProc+55);
	CalcCurrentTintProc[51] = LOBYTE(LOWORD(relCallDist2));
	CalcCurrentTintProc[52] = HIBYTE(LOWORD(relCallDist2));
	CalcCurrentTintProc[53] = LOBYTE(HIWORD(relCallDist2));
	CalcCurrentTintProc[54] = HIBYTE(HIWORD(relCallDist2));
	DWORD relCallDist3 =  ((DWORD) CalcCurTimeCycValueCallDest) - ((DWORD) CalcCurrentTintProc+87);
	CalcCurrentTintProc[83] = LOBYTE(LOWORD(relCallDist3));
	CalcCurrentTintProc[84] = HIBYTE(LOWORD(relCallDist3));
	CalcCurrentTintProc[85] = LOBYTE(HIWORD(relCallDist3));
	CalcCurrentTintProc[86] = HIBYTE(HIWORD(relCallDist3));
	DWORD relCallDist4 =  ((DWORD) CalcCurTimeCycValueCallDest) - ((DWORD) CalcCurrentTintProc+119);
	CalcCurrentTintProc[115] = LOBYTE(LOWORD(relCallDist4));
	CalcCurrentTintProc[116] = HIBYTE(LOWORD(relCallDist4));
	CalcCurrentTintProc[117] = LOBYTE(HIWORD(relCallDist4));
	CalcCurrentTintProc[118] = HIBYTE(HIWORD(relCallDist4));

	long relJumpDist1 =  (((DWORD) CalcCurrentTintInstall)+5) - (((DWORD) CalcCurrentTintProc)+143);
	CalcCurrentTintProc[139] = LOBYTE(LOWORD(relJumpDist1));
	CalcCurrentTintProc[140] = HIBYTE(LOWORD(relJumpDist1));
	CalcCurrentTintProc[141] = LOBYTE(HIWORD(relJumpDist1));
	CalcCurrentTintProc[142] = HIBYTE(HIWORD(relJumpDist1));
	long relJumpDist2 =  ((DWORD) CalcCurrentTintProc) - (((DWORD) CalcCurrentTintInstall)+5);
	CalcCurrentTintInst[1] = LOBYTE(LOWORD(relJumpDist2));
	CalcCurrentTintInst[2] = HIBYTE(LOWORD(relJumpDist2));
	CalcCurrentTintInst[3] = LOBYTE(HIWORD(relJumpDist2));
	CalcCurrentTintInst[4] = HIBYTE(HIWORD(relJumpDist2));

	VirtualProtect(CalcCurrentTintInstall, sizeof(CalcCurrentTintInst), PAGE_READWRITE, &protect1);
	memcpy(CalcCurrentTintInstall, &CalcCurrentTintInst, sizeof(CalcCurrentTintInst));
	VirtualProtect(CalcCurrentTintInstall, sizeof(CalcCurrentTintInst), protect1, &protect2);



	RenderTintProc[7] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RenderTintProc[8] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RenderTintProc[9] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RenderTintProc[10] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RenderTintProc[51] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RenderTintProc[52] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RenderTintProc[53] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RenderTintProc[54] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RenderTintProc[68] = LOBYTE(LOWORD((DWORD) ResolutionX));
	RenderTintProc[69] = HIBYTE(LOWORD((DWORD) ResolutionX));
	RenderTintProc[70] = LOBYTE(HIWORD((DWORD) ResolutionX));
	RenderTintProc[71] = HIBYTE(HIWORD((DWORD) ResolutionX));
	RenderTintProc[78] = LOBYTE(LOWORD((DWORD) ResolutionY));
	RenderTintProc[79] = HIBYTE(LOWORD((DWORD) ResolutionY));
	RenderTintProc[80] = LOBYTE(HIWORD((DWORD) ResolutionY));
	RenderTintProc[81] = HIBYTE(HIWORD((DWORD) ResolutionY));

	long relJumpDist3 =  (((DWORD) RenderTintInstall)+5) - (((DWORD) RenderTintProc)+23);
	RenderTintProc[19] = LOBYTE(LOWORD(relJumpDist3));
	RenderTintProc[20] = HIBYTE(LOWORD(relJumpDist3));
	RenderTintProc[21] = LOBYTE(HIWORD(relJumpDist3));
	RenderTintProc[22] = HIBYTE(HIWORD(relJumpDist3));

	DWORD relCallDist5 =  ((DWORD) RenderParticlesCallDest) - ((DWORD) RenderTintProc+5);
	RenderTintProc[1] = LOBYTE(LOWORD(relCallDist5));
	RenderTintProc[2] = HIBYTE(LOWORD(relCallDist5));
	RenderTintProc[3] = LOBYTE(HIWORD(relCallDist5));
	RenderTintProc[4] = HIBYTE(HIWORD(relCallDist5));
	DWORD relCallDist6 =  ((DWORD) ChangeRenderStateSetupCallDest) - ((DWORD) RenderTintProc+35);
	RenderTintProc[31] = LOBYTE(LOWORD(relCallDist6));
	RenderTintProc[32] = HIBYTE(LOWORD(relCallDist6));
	RenderTintProc[33] = LOBYTE(HIWORD(relCallDist6));
	RenderTintProc[34] = HIBYTE(HIWORD(relCallDist6));
	DWORD relCallDist7 =  ((DWORD) ChangeRenderStateSetupCallDest) - ((DWORD) RenderTintProc+47);
	RenderTintProc[43] = LOBYTE(LOWORD(relCallDist7));
	RenderTintProc[44] = HIBYTE(LOWORD(relCallDist7));
	RenderTintProc[45] = LOBYTE(HIWORD(relCallDist7));
	RenderTintProc[46] = HIBYTE(HIWORD(relCallDist7));
	DWORD relCallDist8 =  ((DWORD) RenderRectangleCallDest) - ((DWORD) RenderTintProc+101);
	RenderTintProc[97] = LOBYTE(LOWORD(relCallDist8));
	RenderTintProc[98] = HIBYTE(LOWORD(relCallDist8));
	RenderTintProc[99] = LOBYTE(HIWORD(relCallDist8));
	RenderTintProc[100] = HIBYTE(HIWORD(relCallDist8));

	long relJumpDist4 =  (((DWORD) RenderTintInstall)+5) - (((DWORD) RenderTintProc)+112);
	RenderTintProc[108] = LOBYTE(LOWORD(relJumpDist4));
	RenderTintProc[109] = HIBYTE(LOWORD(relJumpDist4));
	RenderTintProc[110] = LOBYTE(HIWORD(relJumpDist4));
	RenderTintProc[111] = HIBYTE(HIWORD(relJumpDist4));
	long relJumpDist5 =  ((DWORD) RenderTintProc) - (((DWORD) RenderTintInstall)+5);
	RenderTintInst[1] = LOBYTE(LOWORD(relJumpDist5));
	RenderTintInst[2] = HIBYTE(LOWORD(relJumpDist5));
	RenderTintInst[3] = LOBYTE(HIWORD(relJumpDist5));
	RenderTintInst[4] = HIBYTE(HIWORD(relJumpDist5));

	VirtualProtect(RenderTintInstall, sizeof(RenderTintInst), PAGE_READWRITE, &protect1);
	memcpy(RenderTintInstall, &RenderTintInst, sizeof(RenderTintInst));
	VirtualProtect(RenderTintInstall, sizeof(RenderTintInst), protect1, &protect2);
}


//***********************************************
//MISC WEATHER STUFF (incl. VC:SNOW)
//***********************************************
/*DWORD *WorldRainSpawnFreq = (DWORD *) 0x57C279;
DWORD *WorldRainSize = (DWORD *) 0x57C014;
DWORD *WorldRainSpeed = (DWORD *) 0x57C2A7;
DWORD *WorldRainSpawnTime1 = (DWORD *) 0x69A040;
DWORD *WorldRainSpawnTime2 = (DWORD *) 0x69A034;
DWORD *WorldRainDropHeight = (DWORD *) 0x69A054;
DWORD *CamRainSpeedInstall = (DWORD *) 0x562112;
DWORD *WorldRainSpawnDistModInstall = (DWORD *) 0x69A058;
DWORD *WorldRainSpawnSpeedThreshInstall = (DWORD *) 0x69A02C;


DWORD *IngameFrameTimeIn20Ms_60MsMax = (DWORD *) 0x975424;

BYTE CamRainSpeedProc[24] =			{0xD9, 0x05, 0x24, 0x54, 0x97, 0x00, 0x50, 0xA1,
									 0xE0, 0xFF, 0x6D, 0x00, 0x8B, 0x40, 0x34, 0xD8,
									 0x48, 0x20, 0x58, 0xE9, 0xF0, 0x43, 0xEE, 0xFF};
BYTE CamRainSpeedInst[6] =			{0xE9, 0x00, 0x00, 0x00, 0x00, 0x90};
*/


DWORD *WorldRainSpawnTime1 = (DWORD *) 0x69A040;
DWORD *WorldRainSpawnTime2 = (DWORD *) 0x69A034;
DWORD *WorldRainDropHeight = (DWORD *) 0x69A054;
DWORD *WorldRainSpawnDistModInstall = (DWORD *) 0x69A058;
DWORD *WorldRainSpawnSpeedThreshInstall = (DWORD *) 0x69A02C;
DWORD *WorldRainSizeInstall = (DWORD *) 0x57C014;

//New stuff (Snow)
DWORD *Boat7_8OverrideInstall = (DWORD *) 0x5651BF;
DWORD *Set3DSnowTextureInstall = (DWORD *) 0x57C46D;
DWORD *Light3DSnowInstall = (DWORD *) 0x6773EE;
//DWORD *AssortedPrecipDataInstall = (DWORD *) 0x57D63A;
DWORD *AssortedPrecipDataInstall = (DWORD *) 0x57D878;
DWORD *Freq_Speed3DRainInstall = (DWORD *) 0x57C278;
DWORD *PrevSpeed3DRainBlankerInstall = (DWORD *) 0x57C2A1;
DWORD *Size3DRainInstall = (DWORD *) 0x57C012;
DWORD *RainSplashSkip1Install = (DWORD *) 0x5040DB;
DWORD *RainSplashSkip2Install = (DWORD *) 0x57D119;
DWORD *RainSplashSkip3Install = (DWORD *) 0x58B54F;
DWORD *Rain2DSkipInstall = (DWORD *) 0x57C9EF;
DWORD *Rain2DSkipJump = (DWORD *) 0x57D147;
DWORD *RainSoundSkip1Install = (DWORD *) 0x5DC2DC;
DWORD *RainSoundSkip1Jump = (DWORD *) 0x5DC399;
DWORD *RainSoundSkip2Install = (DWORD *) 0x5F3C2A;
DWORD *RainSoundSkip2Jump = (DWORD *) 0x5F3D9C;
DWORD *ZDeviationInstall = (DWORD *) 0x57C3A4;
DWORD *Rain3DSpawnFix1Install = (DWORD *) 0x57C315;
DWORD *Rain3DSpawnFix2Install = (DWORD *) 0x57C335;
DWORD *Rain3DScaleInstall = (DWORD *) 0x57BFFA;
DWORD *Rain3DMatFixInstall = (DWORD *) 0x57C4B1;
DWORD *GripFXInstall = (DWORD *) 0x4CE79A;
DWORD *ReflectFXInstall = (DWORD *) 0x5433B1;
DWORD *UndoBoatOverrideInstall = (DWORD *) 0x564AEB;
DWORD *GroundSteamFixInstall = (DWORD *) 0x57C973;



DWORD *CarDebrisString = (DWORD *) 0x698290;
DWORD *BoatTextureBase = (DWORD *) 0x77E874;
DWORD *RainDropTexturePtr = (DWORD *) 0xA106A4;
DWORD *SomeProc = (DWORD *) 0x65F6A0;
DWORD *DesiredReturnAddress = (DWORD *) 0x57C4AE;
DWORD *SomeAddress3DRain = (DWORD *) 0xA102B8;
DWORD *SomeProc2 = (DWORD *) 0x57E0E0;
DWORD *DeviationConstant = (DWORD *) 0x69A060;
DWORD *Rain3DZPos = (DWORD *) 0xA102AC;
DWORD *Address69D3D4 = (DWORD *) 0x69D3D4;				//1/32768
DWORD *Address699FF0 = (DWORD *) 0x699FF0;				//60.0f
DWORD *Rain3DWidth = (DWORD *) 0x69A064;
DWORD *Rain3DHeight = (DWORD *) 0x69A068;
DWORD *SomeProc3 = (DWORD *) 0x65AF60;
DWORD *RoadWetness = (DWORD *) 0x9B6A9C;
DWORD *ActivateSteam = (DWORD *) 0x77F028;
float rainSizePlaceholder = 0.25f;


BYTE Boat7_8Override[103] =			{0xBD, 0x90, 0x82, 0x69, 0x00, 0x50, 0x51, 0xA1,
									 0xE0, 0xFF, 0x6D, 0x00, 0x8B, 0x0D, 0x8C, 0xE8,
									 0x77, 0x00, 0x89, 0x48, 0x40, 0x8B, 0x0D, 0xAC,
									 0xE8, 0x77, 0x00, 0x89, 0x48, 0x44, 0x8B, 0x0D,
									 0x90, 0xE8, 0x77, 0x00, 0x89, 0x48, 0x48, 0x8B,
									 0x0D, 0xB0, 0xE8, 0x77, 0x00, 0x89, 0x48, 0x4C,
									 0x8B, 0x0D, 0x74, 0xE8, 0x77, 0x00, 0x89, 0x0D,
									 0x8C, 0xE8, 0x77, 0x00, 0x8B, 0x0D, 0x78, 0xE8,
									 0x77, 0x00, 0x89, 0x0D, 0x90, 0xE8, 0x77, 0x00,
									 0x8B, 0x0D, 0x94, 0xE8, 0x77, 0x00, 0x89, 0x0D,
									 0xAC, 0xE8, 0x77, 0x00, 0x8B, 0x0D, 0x98, 0xE8,
									 0x77, 0x00, 0x89, 0x0D, 0xB0, 0xE8, 0x77, 0x00,
									 0x59, 0x58, 0xE9, 0x0D, 0x74, 0xEE, 0xFF};
BYTE Boat7_8OverrideInst[5] =		{0xE9, 0x00, 0x00, 0x00, 0x00};

BYTE Set3DSnowTexture[80] =			{0x66, 0x83, 0x3D, 0x2E, 0x0A, 0xA1, 0x00, 0x05,
									 0x74, 0x0B, 0x8B, 0x15, 0xA4, 0x06, 0xA1, 0x00,
									 0xE9, 0x8E, 0xE6, 0xEF, 0xFF, 0x50, 0x51, 0xA1,
									 0xE0, 0xFF, 0x6D, 0x00, 0x80, 0x78, 0x50, 0x00,
									 0x75, 0x0D, 0x59, 0x58, 0x8B, 0x15, 0xA4, 0x06,
									 0xA1, 0x00, 0xE9, 0x74, 0xE6, 0xEF, 0xFF, 0x8B,
									 0x0D, 0xA8, 0x97, 0x78, 0x00, 0x8B, 0x11, 0xFF,
									 0x70, 0x3C, 0x51, 0xFF, 0x92, 0xA8, 0x00, 0x00,
									 0x00, 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x8B, 0x50,
									 0x48, 0x59, 0x58, 0xE9, 0x53, 0xE6, 0xEF, 0xFF};
BYTE Set3DSnowTextureInst[6] =		{0xE9, 0x00, 0x00, 0x00, 0x00, 0x90};

BYTE Light3DSnow[58] =				{0xE8, 0x8B, 0x19, 0xFE, 0xFF, 0x81, 0x7C, 0x24,
									 0x60, 0xAE, 0xC4, 0x57, 0x00, 0x0F, 0x85, 0xD0,
									 0x96, 0xFF, 0xFF, 0x66, 0x83, 0x3D, 0x2E, 0x0A,
									 0xA1, 0x00, 0x05, 0x0F, 0x85, 0xC2, 0x96, 0xFF,
									 0xFF, 0x50, 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x8A,
									 0x40, 0x50, 0x3C, 0x00, 0x58, 0x0F, 0x84, 0xB0,
									 0x96, 0xFF, 0xFF, 0x6A, 0x01, 0xE9, 0xAB, 0x96,
									 0xFF, 0xFF};
BYTE Light3DSnowInst[5] =			{0xE9, 0x00, 0x00, 0x00, 0x00};

BYTE AssortedPrecipData[99] =		{0x8B, 0x3D, 0x2C, 0x4B, 0x97, 0x00, 0x66, 0x83,
									 0x3D, 0x2E, 0x0A, 0xA1, 0x00, 0x05, 0x74, 0x0C,
									 0x50, 0x51, 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x8B,
									 0x40, 0x34, 0xEB, 0x0A, 0x50, 0x51, 0xA1, 0xE0,
									 0xFF, 0x6D, 0x00, 0x8B, 0x40, 0x38, 0x8B, 0x48,
									 0x24, 0x89, 0x0D, 0x40, 0xA0, 0x69, 0x00, 0x8B,
									 0x48, 0x28, 0x89, 0x0D, 0x34, 0xA0, 0x69, 0x00,
									 0x8B, 0x48, 0x1C, 0x89, 0x0D, 0x54, 0xA0, 0x69,
									 0x00, 0x8B, 0x48, 0x2C, 0x89, 0x0D, 0x58, 0xA0,
									 0x69, 0x00, 0x8B, 0x48, 0x30, 0x89, 0x0D, 0x2C,
									 0xA0, 0x69, 0x00, 0x8B, 0x48, 0x10, 0x89, 0x0D, 
									 0xC0, 0xFF, 0x6D, 0x00, 0x59, 0x58, 0xE9, 0x14, 
									 0xFB, 0xEF, 0xFF};
BYTE AssortedPrecipDataInst[6] =	{0xE9, 0x00, 0x00, 0x00, 0x00, 0x90};

BYTE Freq_Speed3DRain[51] =			{0x51, 0x52, 0x8B, 0x0D, 0xE0, 0xFF, 0x6D, 0x00,
									 0x66, 0x83, 0x3D, 0x2E, 0x0A, 0xA1, 0x00, 0x02,
									 0x74, 0x05, 0x8B, 0x49, 0x38, 0xEB, 0x03, 0x8B,
									 0x49, 0x34, 0x8B, 0x51, 0x0C, 0x21, 0xD0, 0x75,
									 0x09, 0x8B, 0x51, 0x14, 0x89, 0x93, 0xB8, 0x02,
									 0xA1, 0x00, 0x5A, 0x59, 0x85, 0xC0, 0xE9, 0x9A,
									 0xE3, 0xEF, 0xFF};
BYTE Freq_Speed3DRainInst[5] =		{0xE9, 0x00, 0x00, 0x00, 0x00};
BYTE PrevSpeed3DRainBlankerInst[10] =	{0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
										 0x90, 0x90};

BYTE Size3DRain[34] =				{0x51, 0x8B, 0x0D, 0xE0, 0xFF, 0x6D, 0x00, 0x66,
									 0x83, 0x3D, 0x2E, 0x0A, 0xA1, 0x00, 0x02, 0x74,
									 0x05, 0x8B, 0x49, 0x38, 0xEB, 0x03, 0x8B, 0x49,
									 0x34, 0xD8, 0x49, 0x10, 0x59, 0xE9, 0x06, 0xE1,
									 0xEF, 0xFF};
BYTE Size3DRainInst[6] =			{0xE9, 0x00, 0x00, 0x00, 0x00, 0x90};

BYTE RainSplashSkip1[39] =			{0x50, 0x66, 0x83, 0x3D, 0x2E, 0x0A, 0xA1, 0x00,
									 0x05, 0x75, 0x11, 0xA1, 0xE0, 0xFF, 0x6D, 0x00,
									 0x80, 0x78, 0x50, 0x00, 0x74, 0x06, 0x58, 0xE9,
									 0xB4, 0x63, 0xE8, 0xFF, 0x58, 0xE8, 0x8E, 0x5F, 
									 0xEE, 0xFF, 0xE9, 0xA9, 0x63, 0xE8, 0xFF};
BYTE RainSplashSkip1Inst[5] =		{0xE9, 0x00, 0x00, 0x00, 0x00};

BYTE RainSplashSkip2[39] =			{0x50, 0x66, 0x83, 0x3D, 0x2E, 0x0A, 0xA1, 0x00,
									 0x05, 0x75, 0x11, 0xA1, 0xE0, 0xFF, 0x6D, 0x00,
									 0x80, 0x78, 0x50, 0x00, 0x74, 0x06, 0x58, 0xE9,
									 0xB4, 0x63, 0xE8, 0xFF, 0x58, 0xE8, 0x8E, 0x5F, 
									 0xEE, 0xFF, 0xE9, 0xA9, 0x63, 0xE8, 0xFF};
BYTE RainSplashSkip2Inst[5] =		{0xE9, 0x00, 0x00, 0x00, 0x00};

BYTE RainSplashSkip3[39] =			{0x50, 0x66, 0x83, 0x3D, 0x2E, 0x0A, 0xA1, 0x00,
									 0x05, 0x75, 0x11, 0xA1, 0xE0, 0xFF, 0x6D, 0x00,
									 0x80, 0x78, 0x50, 0x00, 0x74, 0x06, 0x58, 0xE9,
									 0xB4, 0x63, 0xE8, 0xFF, 0x58, 0xE8, 0x8E, 0x5F, 
									 0xEE, 0xFF, 0xE9, 0xA9, 0x63, 0xE8, 0xFF};
BYTE RainSplashSkip3Inst[5] =		{0xE9, 0x00, 0x00, 0x00, 0x00};

BYTE Rain2DSkip[34] =				{0x50, 0x66, 0x83, 0x3D, 0x2E, 0x0A, 0xA1, 0x00,
									 0x05, 0x75, 0x11, 0xA1, 0xE0, 0xFF, 0x6D, 0x00,
									 0x80, 0x78, 0x50, 0x00, 0x74, 0x06, 0x58, 0xE9,
									 0x1B, 0xF4, 0xEF, 0xFF, 0x58, 0xE9, 0xC3, 0xEC,
									 0xEF, 0xFF};
BYTE Rain2DSkipInst[6] =			{0xE9, 0x00, 0x00, 0x00, 0x00, 0x90};

BYTE RainSoundSkip1[39] =			{0x50, 0x66, 0x83, 0x3D, 0x2E, 0x0A, 0xA1, 0x00,
									 0x05, 0x75, 0x11, 0xA1, 0xE0, 0xFF, 0x6D, 0x00,
									 0x80, 0x78, 0x50, 0x00, 0x74, 0x06, 0x58, 0xE9,
									 0x1B, 0xF4, 0xEF, 0xFF, 0x58, 0xE8, 0xC3, 0xEC,
									 0xEF, 0xFF, 0xE9, 0xC3, 0xEC, 0xEF, 0xFF};
BYTE RainSoundSkip1Inst[5] =		{0xE9, 0x00, 0x00, 0x00, 0x00};

BYTE RainSoundSkip2[39] =			{0x50, 0x66, 0x83, 0x3D, 0x2E, 0x0A, 0xA1, 0x00,
									 0x05, 0x75, 0x11, 0xA1, 0xE0, 0xFF, 0x6D, 0x00,
									 0x80, 0x78, 0x50, 0x00, 0x74, 0x06, 0x58, 0xE9,
									 0x1B, 0xF4, 0xEF, 0xFF, 0x58, 0xE8, 0xC3, 0xEC,
									 0xEF, 0xFF, 0xE9, 0xC3, 0xEC, 0xEF, 0xFF};
BYTE RainSoundSkip2Inst[5] =		{0xE9, 0x00, 0x00, 0x00, 0x00};

BYTE ZDeviation[84] =				{0xE8, 0xDB, 0xBC, 0xFC, 0xFF, 0x0F, 0xB7, 0xC0,
									 0x25, 0xFF, 0x00, 0x00, 0x00, 0x83, 0xC0, 0x80,
									 0x89, 0x44, 0x24, 0x20, 0xDB, 0x44, 0x24, 0x20,
									 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x66, 0x83, 0x3D,
									 0x2E, 0x0A, 0xA1, 0x00, 0x05, 0x74, 0x05, 0x8B,
									 0x40, 0x34, 0xEB, 0x03, 0x8B, 0x40, 0x38, 0x8B,
									 0x48, 0x3C, 0x89, 0x0D, 0x60, 0xA0, 0x69, 0x00,
									 0xD8, 0x0D, 0x60, 0xA0, 0x69, 0x00, 0xD8, 0x83,
									 0xAC, 0x02, 0xA1, 0x00, 0xD9, 0x9B, 0xAC, 0x02,
									 0xA1, 0x00, 0xE8, 0x91, 0xBC, 0xFC, 0xFF, 0xE9,
									 0x45, 0xE6, 0xEF, 0xFF};
BYTE ZDeviationInst[5] =			{0xE9, 0x00, 0x00, 0x00, 0x00};

BYTE Rain3DSpawnFix[73] =			{0xE8, 0x7B, 0xBC, 0xFC, 0xFF, 0x0F, 0xB7, 0xC0,
									 0x89, 0x44, 0x24, 0x24, 0xDB, 0x44, 0x24, 0x24,
									 0xD8, 0x0D, 0xD4, 0xD3, 0x69, 0x00, 0xA1, 0xE0,
									 0xFF, 0x6D, 0x00, 0x66, 0x83, 0x3D, 0x2E, 0x0A,
									 0xA1, 0x00, 0x05, 0x74, 0x05, 0x8B, 0x40, 0x34,
									 0xEB, 0x03, 0x8B, 0x40, 0x38, 0xD9, 0x40, 0x38,
									 0xD9, 0xE8, 0xD8, 0xE1, 0xD9, 0xC2, 0xD8, 0xCA,
									 0xD8, 0xC1, 0xDD, 0xD9, 0xDD, 0xDA, 0xDD, 0xD8,
									 0xD8, 0xC9, 0xD8, 0x0D, 0xF0, 0x9F, 0x69, 0x00,
									 0xC3};
BYTE Rain3DSpawnFix1Inst[6] =		{0xE8, 0x00, 0x00, 0x00, 0x00, 0x90};
BYTE Rain3DSpawnFix2Inst[6] =		{0xE8, 0x00, 0x00, 0x00, 0x00, 0x90};

BYTE Rain3DScale[65] =				{0xBD, 0xB8, 0x46, 0x7E, 0x00, 0x50, 0xA1, 0xE0,
									 0xFF, 0x6D, 0x00, 0x66, 0x83, 0x3D, 0x2E, 0x0A,
									 0xA1, 0x00, 0x05, 0x74, 0x05, 0x8B, 0x40, 0x34,
									 0xEB, 0x03, 0x8B, 0x40, 0x38, 0xD9, 0x05, 0xC0,
									 0xFF, 0x6D, 0x00, 0xD8, 0x48, 0x34, 0xD9, 0x1D,
									 0x64, 0xA0, 0x69, 0x00, 0xD9, 0x05, 0xC4, 0xFF,
									 0x6D, 0x00, 0xD8, 0x48, 0x34, 0xD9, 0x1D, 0x68,
									 0xA0, 0x69, 0x00, 0x58, 0xE9, 0xEE, 0xE1, 0xEF,
									 0xFF};
BYTE Rain3DScaleInst[5] =			{0xE9, 0x00, 0x00, 0x00, 0x00};

BYTE Rain3DMatFix[49] =				{0xE8, 0x4B, 0xD2, 0xFD, 0xFF, 0x51, 0x52, 0x8B,
									 0x0D, 0xA8, 0x97, 0x78, 0x00, 0x8B, 0x11, 0x68,
									 0xB8, 0xDE, 0x6D, 0x00, 0x51, 0xFF, 0x92, 0xA8,
									 0x00, 0x00, 0x00, 0x6A, 0x00, 0x68, 0x89, 0x00,
									 0x00, 0x00, 0xE8, 0x69, 0xA5, 0xFD, 0xFF, 0x83,
									 0xC4, 0x08, 0x5A, 0x59, 0xE9, 0x75, 0xE7, 0xEF,
									 0xFF};
BYTE Rain3DMatFixInst[5] =			{0xE9, 0x00, 0x00, 0x00, 0x00};


BYTE GripFX[112] =					{0xD9, 0x05, 0x9C, 0x6A, 0x9B, 0x00, 0x50, 0x51,
									 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x66, 0x83, 0x3D,
									 0xAA, 0x0A, 0xA1, 0x00, 0x02, 0x75, 0x05, 0x8B,
									 0x48, 0x34, 0xEB, 0x0D, 0x66, 0x83, 0x3D, 0xAA,
									 0x0A, 0xA1, 0x00, 0x05, 0x75, 0x06, 0x8B, 0x48,
									 0x38, 0xD8, 0x49, 0x44, 0xD9, 0xE8, 0xD8, 0x25,
									 0xD8, 0x87, 0x97, 0x00, 0xDE, 0xC9, 0xD9, 0x05,
									 0x9C, 0x6A, 0x9B, 0x00, 0x66, 0x83, 0x3D, 0x2E,
									 0x0A, 0xA1, 0x00, 0x02, 0x75, 0x05, 0x8B, 0x48,
									 0x34, 0xEB, 0x0D, 0x66, 0x83, 0x3D, 0x2E, 0x0A,
									 0xA1, 0x00, 0x05, 0x75, 0x06, 0x8B, 0x48, 0x38,
									 0xD8, 0x49, 0x44, 0xD8, 0x0D, 0xD8, 0x87, 0x97,
									 0x00, 0xDC, 0xC1, 0xDD, 0xD8, 0xD8, 0xC9, 0xDD,
									 0xD9, 0x59, 0x58, 0xE9, 0x20, 0x0A, 0xE5, 0xFF};
BYTE GripFXInst[6] =				{0xE9, 0x00, 0x00, 0x00, 0x00, 0x90};


BYTE ReflectFX[110] =				{0xD9, 0x05, 0x9C, 0x6A, 0x9B, 0x00, 0x50, 0x51,
									 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x66, 0x83, 0x3D,
									 0xAA, 0x0A, 0xA1, 0x00, 0x02, 0x75, 0x05, 0x8B,
									 0x48, 0x34, 0xEB, 0x0D, 0x66, 0x83, 0x3D, 0xAA,
									 0x0A, 0xA1, 0x00, 0x05, 0x75, 0x06, 0x8B, 0x48,
									 0x38, 0xD8, 0x49, 0x40, 0xD9, 0xE8, 0xD8, 0x25,
									 0xD8, 0x87, 0x97, 0x00, 0xDE, 0xC9, 0xD9, 0x05,
									 0x9C, 0x6A, 0x9B, 0x00, 0x66, 0x83, 0x3D, 0x2E,
									 0x0A, 0xA1, 0x00, 0x02, 0x75, 0x05, 0x8B, 0x48,
									 0x34, 0xEB, 0x0D, 0x66, 0x83, 0x3D, 0x2E, 0x0A,
									 0xA1, 0x00, 0x05, 0x75, 0x06, 0x8B, 0x48, 0x38,
									 0xD8, 0x49, 0x40, 0xD8, 0x0D, 0xD8, 0x87, 0x97,
									 0x00, 0xDC, 0xC1, 0xDD, 0xD8, 0xDE, 0xC9, 0x59,
									 0x58, 0xE9, 0xB9, 0x55, 0xEC, 0xFF};
BYTE ReflectFXInst[6] =				{0xE9, 0x00, 0x00, 0x00, 0x00, 0x90};

BYTE UndoBoatOverride[55] =			{0x31, 0xDB, 0x59, 0x89, 0xC0, 0x50, 0x51, 0xA1,
									 0xE0, 0xFF, 0x6D, 0x00, 0x8B, 0x48, 0x40, 0x89,
									 0x0D, 0x8C, 0xE8, 0x77, 0x00, 0x8B, 0x48, 0x44,
									 0x89, 0x0D, 0xAC, 0xE8, 0x77, 0x00, 0x8B, 0x48,
									 0x48, 0x89, 0x0D, 0x90, 0xE8, 0x77, 0x00, 0x8B,
									 0x48, 0x4C, 0x89, 0x0D, 0xB0, 0xE8, 0x77, 0x00,
									 0x59, 0x58, 0xE9, 0xA9, 0x6D, 0xEE, 0xFF};
BYTE UndoBoatOverrideInst[5] =		{0xE9, 0x00, 0x00, 0x00, 0x00};

BYTE GroundSteamFix[43] =			{0x66, 0x83, 0x3D, 0x2E, 0x0A, 0xA1, 0x00, 0x05,
									 0x75, 0x12, 0x50, 0xA1, 0xE0, 0xFF, 0x6D, 0x00,
									 0x80, 0x78, 0x50, 0x00, 0x58, 0x74, 0x05, 0xE9,
									 0x64, 0xEC, 0xEF, 0xFF, 0xC7, 0x05, 0x28, 0xF0,
									 0x77, 0x00, 0x01, 0x00, 0x00, 0x00, 0xE9, 0x42,
									 0xEC, 0xEF, 0xFF};
BYTE GroundSteamFixInst[10] =		{0xE9, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90, 0x90,
									 0x90, 0x90};

void InstallMiscWeatherStuff()
{
	DWORD protect1, protect2;	
	DWORD temp;

	//void* tempAddress;
	void* rainSizePlaceholderAddress = (void*) &rainSizePlaceholder;
	//tempAddress = &(VC_WeatherGlobalData.miscWeatherData->worldRainSize);
	VirtualProtect(WorldRainSizeInstall, sizeof(rainSizePlaceholderAddress), PAGE_READWRITE, &protect1);
	memcpy(WorldRainSizeInstall, &rainSizePlaceholderAddress, sizeof(rainSizePlaceholderAddress));
	VirtualProtect(WorldRainSizeInstall, sizeof(rainSizePlaceholderAddress), protect1, &protect2);

	Boat7_8Override[1] = LOBYTE(LOWORD((DWORD) CarDebrisString));
	Boat7_8Override[2] = HIBYTE(LOWORD((DWORD) CarDebrisString));
	Boat7_8Override[3] = LOBYTE(HIWORD((DWORD) CarDebrisString));
	Boat7_8Override[4] = HIBYTE(HIWORD((DWORD) CarDebrisString));
	Boat7_8Override[8] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Boat7_8Override[9] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Boat7_8Override[10] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Boat7_8Override[11] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	temp = (DWORD) BoatTextureBase + 0x18;
	Boat7_8Override[14] = LOBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[15] = HIBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[16] = LOBYTE(HIWORD((DWORD) temp));
	Boat7_8Override[17] = HIBYTE(HIWORD((DWORD) temp));
	temp = (DWORD) BoatTextureBase + 0x38;
	Boat7_8Override[23] = LOBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[24] = HIBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[25] = LOBYTE(HIWORD((DWORD) temp));
	Boat7_8Override[26] = HIBYTE(HIWORD((DWORD) temp));
	temp = (DWORD) BoatTextureBase + 0x1C;
	Boat7_8Override[32] = LOBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[33] = HIBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[34] = LOBYTE(HIWORD((DWORD) temp));
	Boat7_8Override[35] = HIBYTE(HIWORD((DWORD) temp));
	temp = (DWORD) BoatTextureBase + 0x3C;
	Boat7_8Override[41] = LOBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[42] = HIBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[43] = LOBYTE(HIWORD((DWORD) temp));
	Boat7_8Override[44] = HIBYTE(HIWORD((DWORD) temp));
	Boat7_8Override[50] = LOBYTE(LOWORD((DWORD) BoatTextureBase));
	Boat7_8Override[51] = HIBYTE(LOWORD((DWORD) BoatTextureBase));
	Boat7_8Override[52] = LOBYTE(HIWORD((DWORD) BoatTextureBase));
	Boat7_8Override[53] = HIBYTE(HIWORD((DWORD) BoatTextureBase));
	temp = (DWORD) BoatTextureBase + 0x18;
	Boat7_8Override[56] = LOBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[57] = HIBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[58] = LOBYTE(HIWORD((DWORD) temp));
	Boat7_8Override[59] = HIBYTE(HIWORD((DWORD) temp));
	temp = (DWORD) BoatTextureBase + 0x04;
	Boat7_8Override[62] = LOBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[63] = HIBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[64] = LOBYTE(HIWORD((DWORD) temp));
	Boat7_8Override[65] = HIBYTE(HIWORD((DWORD) temp));
	temp = (DWORD) BoatTextureBase + 0x1C;
	Boat7_8Override[68] = LOBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[69] = HIBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[70] = LOBYTE(HIWORD((DWORD) temp));
	Boat7_8Override[71] = HIBYTE(HIWORD((DWORD) temp));
	temp = (DWORD) BoatTextureBase + 0x20;
	Boat7_8Override[74] = LOBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[75] = HIBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[76] = LOBYTE(HIWORD((DWORD) temp));
	Boat7_8Override[77] = HIBYTE(HIWORD((DWORD) temp));
	temp = (DWORD) BoatTextureBase + 0x38;
	Boat7_8Override[80] = LOBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[81] = HIBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[82] = LOBYTE(HIWORD((DWORD) temp));
	Boat7_8Override[83] = HIBYTE(HIWORD((DWORD) temp));
	temp = (DWORD) BoatTextureBase + 0x24;
	Boat7_8Override[86] = LOBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[87] = HIBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[88] = LOBYTE(HIWORD((DWORD) temp));
	Boat7_8Override[89] = HIBYTE(HIWORD((DWORD) temp));
	temp = (DWORD) BoatTextureBase + 0x2C;
	Boat7_8Override[92] = LOBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[93] = HIBYTE(LOWORD((DWORD) temp));
	Boat7_8Override[94] = LOBYTE(HIWORD((DWORD) temp));
	Boat7_8Override[95] = HIBYTE(HIWORD((DWORD) temp));
	long relJumpDist1 =  (((DWORD) Boat7_8OverrideInstall)+5) - (((DWORD) Boat7_8Override)+103);
	Boat7_8Override[99] = LOBYTE(LOWORD(relJumpDist1));
	Boat7_8Override[100] = HIBYTE(LOWORD(relJumpDist1));
	Boat7_8Override[101] = LOBYTE(HIWORD(relJumpDist1));
	Boat7_8Override[102] = HIBYTE(HIWORD(relJumpDist1));
	long relJumpDist2 =  ((DWORD) Boat7_8Override) - (((DWORD) Boat7_8OverrideInstall)+5);
	Boat7_8OverrideInst[1] = LOBYTE(LOWORD(relJumpDist2));
	Boat7_8OverrideInst[2] = HIBYTE(LOWORD(relJumpDist2));
	Boat7_8OverrideInst[3] = LOBYTE(HIWORD(relJumpDist2));
	Boat7_8OverrideInst[4] = HIBYTE(HIWORD(relJumpDist2));
	VirtualProtect(Boat7_8OverrideInstall, sizeof(Boat7_8OverrideInst), PAGE_READWRITE, &protect1);
	memcpy(Boat7_8OverrideInstall, &Boat7_8OverrideInst, sizeof(Boat7_8OverrideInst));
	VirtualProtect(Boat7_8OverrideInstall, sizeof(Boat7_8OverrideInst), protect1, &protect2);

	
	Set3DSnowTexture[3] = LOBYTE(LOWORD((DWORD) NextWeather));
	Set3DSnowTexture[4] = HIBYTE(LOWORD((DWORD) NextWeather));
	Set3DSnowTexture[5] = LOBYTE(HIWORD((DWORD) NextWeather));
	Set3DSnowTexture[6] = HIBYTE(HIWORD((DWORD) NextWeather));
	Set3DSnowTexture[12] = LOBYTE(LOWORD((DWORD) RainDropTexturePtr));
	Set3DSnowTexture[13] = HIBYTE(LOWORD((DWORD) RainDropTexturePtr));
	Set3DSnowTexture[14] = LOBYTE(HIWORD((DWORD) RainDropTexturePtr));
	Set3DSnowTexture[15] = HIBYTE(HIWORD((DWORD) RainDropTexturePtr));
	Set3DSnowTexture[24] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Set3DSnowTexture[25] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Set3DSnowTexture[26] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Set3DSnowTexture[27] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Set3DSnowTexture[38] = LOBYTE(LOWORD((DWORD) RainDropTexturePtr));
	Set3DSnowTexture[39] = HIBYTE(LOWORD((DWORD) RainDropTexturePtr));
	Set3DSnowTexture[40] = LOBYTE(HIWORD((DWORD) RainDropTexturePtr));
	Set3DSnowTexture[41] = HIBYTE(HIWORD((DWORD) RainDropTexturePtr));
	Set3DSnowTexture[49] = LOBYTE(LOWORD((DWORD) D3DDevicePtr));
	Set3DSnowTexture[50] = HIBYTE(LOWORD((DWORD) D3DDevicePtr));
	Set3DSnowTexture[51] = LOBYTE(HIWORD((DWORD) D3DDevicePtr));
	Set3DSnowTexture[52] = HIBYTE(HIWORD((DWORD) D3DDevicePtr));
	Set3DSnowTexture[66] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Set3DSnowTexture[67] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Set3DSnowTexture[68] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Set3DSnowTexture[69] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	long relJumpDist3 =  (((DWORD) Set3DSnowTextureInstall)+6) - (((DWORD) Set3DSnowTexture)+21);
	Set3DSnowTexture[17] = LOBYTE(LOWORD(relJumpDist3));
	Set3DSnowTexture[18] = HIBYTE(LOWORD(relJumpDist3));
	Set3DSnowTexture[19] = LOBYTE(HIWORD(relJumpDist3));
	Set3DSnowTexture[20] = HIBYTE(HIWORD(relJumpDist3));
	long relJumpDist4 =  (((DWORD) Set3DSnowTextureInstall)+6) - (((DWORD) Set3DSnowTexture)+47);
	Set3DSnowTexture[43] = LOBYTE(LOWORD(relJumpDist4));
	Set3DSnowTexture[44] = HIBYTE(LOWORD(relJumpDist4));
	Set3DSnowTexture[45] = LOBYTE(HIWORD(relJumpDist4));
	Set3DSnowTexture[46] = HIBYTE(HIWORD(relJumpDist4));
	long relJumpDist5 =  (((DWORD) Set3DSnowTextureInstall)+6) - (((DWORD) Set3DSnowTexture)+80);
	Set3DSnowTexture[76] = LOBYTE(LOWORD(relJumpDist5));
	Set3DSnowTexture[77] = HIBYTE(LOWORD(relJumpDist5));
	Set3DSnowTexture[78] = LOBYTE(HIWORD(relJumpDist5));
	Set3DSnowTexture[79] = HIBYTE(HIWORD(relJumpDist5));
	long relJumpDist6 =  ((DWORD) Set3DSnowTexture) - (((DWORD) Set3DSnowTextureInstall)+5);
	Set3DSnowTextureInst[1] = LOBYTE(LOWORD(relJumpDist6));
	Set3DSnowTextureInst[2] = HIBYTE(LOWORD(relJumpDist6));
	Set3DSnowTextureInst[3] = LOBYTE(HIWORD(relJumpDist6));
	Set3DSnowTextureInst[4] = HIBYTE(HIWORD(relJumpDist6));
	VirtualProtect(Set3DSnowTextureInstall, sizeof(Set3DSnowTextureInst), PAGE_READWRITE, &protect1);
	memcpy(Set3DSnowTextureInstall, &Set3DSnowTextureInst, sizeof(Set3DSnowTextureInst));
	VirtualProtect(Set3DSnowTextureInstall, sizeof(Set3DSnowTextureInst), protect1, &protect2);

	Light3DSnow[9] = LOBYTE(LOWORD((DWORD) DesiredReturnAddress));
	Light3DSnow[10] = HIBYTE(LOWORD((DWORD) DesiredReturnAddress));
	Light3DSnow[11] = LOBYTE(HIWORD((DWORD) DesiredReturnAddress));
	Light3DSnow[12] = HIBYTE(HIWORD((DWORD) DesiredReturnAddress));
	Light3DSnow[22] = LOBYTE(LOWORD((DWORD) NextWeather));
	Light3DSnow[23] = HIBYTE(LOWORD((DWORD) NextWeather));
	Light3DSnow[24] = LOBYTE(HIWORD((DWORD) NextWeather));
	Light3DSnow[25] = HIBYTE(HIWORD((DWORD) NextWeather));
	Light3DSnow[35] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Light3DSnow[36] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Light3DSnow[37] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Light3DSnow[38] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	DWORD relCallDist1 =  ((DWORD) SomeProc) - ((DWORD) Light3DSnow+5);
	Light3DSnow[1] = LOBYTE(LOWORD(relCallDist1));
	Light3DSnow[2] = HIBYTE(LOWORD(relCallDist1));
	Light3DSnow[3] = LOBYTE(HIWORD(relCallDist1));
	Light3DSnow[4] = HIBYTE(HIWORD(relCallDist1));
	long relJumpDist7 =  (((DWORD) Light3DSnowInstall)+5) - (((DWORD) Light3DSnow)+19);
	Light3DSnow[15] = LOBYTE(LOWORD(relJumpDist7));
	Light3DSnow[16] = HIBYTE(LOWORD(relJumpDist7));
	Light3DSnow[17] = LOBYTE(HIWORD(relJumpDist7));
	Light3DSnow[18] = HIBYTE(HIWORD(relJumpDist7));
	long relJumpDist8 =  (((DWORD) Light3DSnowInstall)+5) - (((DWORD) Light3DSnow)+33);
	Light3DSnow[29] = LOBYTE(LOWORD(relJumpDist8));
	Light3DSnow[30] = HIBYTE(LOWORD(relJumpDist8));
	Light3DSnow[31] = LOBYTE(HIWORD(relJumpDist8));
	Light3DSnow[32] = HIBYTE(HIWORD(relJumpDist8));
	long relJumpDist9 =  (((DWORD) Light3DSnowInstall)+5) - (((DWORD) Light3DSnow)+51);
	Light3DSnow[47] = LOBYTE(LOWORD(relJumpDist9));
	Light3DSnow[48] = HIBYTE(LOWORD(relJumpDist9));
	Light3DSnow[49] = LOBYTE(HIWORD(relJumpDist9));
	Light3DSnow[50] = HIBYTE(HIWORD(relJumpDist9));
	long relJumpDist10 =  (((DWORD) Light3DSnowInstall)+7) - (((DWORD) Light3DSnow)+58);
	Light3DSnow[54] = LOBYTE(LOWORD(relJumpDist10));
	Light3DSnow[55] = HIBYTE(LOWORD(relJumpDist10));
	Light3DSnow[56] = LOBYTE(HIWORD(relJumpDist10));
	Light3DSnow[57] = HIBYTE(HIWORD(relJumpDist10));
	long relJumpDist11 =  ((DWORD) Light3DSnow) - (((DWORD) Light3DSnowInstall)+5);
	Light3DSnowInst[1] = LOBYTE(LOWORD(relJumpDist11));
	Light3DSnowInst[2] = HIBYTE(LOWORD(relJumpDist11));
	Light3DSnowInst[3] = LOBYTE(HIWORD(relJumpDist11));
	Light3DSnowInst[4] = HIBYTE(HIWORD(relJumpDist11));
	VirtualProtect(Light3DSnowInstall, sizeof(Light3DSnowInst), PAGE_READWRITE, &protect1);
	memcpy(Light3DSnowInstall, &Light3DSnowInst, sizeof(Light3DSnowInst));
	VirtualProtect(Light3DSnowInstall, sizeof(Light3DSnowInst), protect1, &protect2);

	AssortedPrecipData[2] = LOBYTE(LOWORD((DWORD) IngameTimerInMS));
	AssortedPrecipData[3] = HIBYTE(LOWORD((DWORD) IngameTimerInMS));
	AssortedPrecipData[4] = LOBYTE(HIWORD((DWORD) IngameTimerInMS));
	AssortedPrecipData[5] = HIBYTE(HIWORD((DWORD) IngameTimerInMS));
	AssortedPrecipData[9] = LOBYTE(LOWORD((DWORD) NextWeather));
	AssortedPrecipData[10] = HIBYTE(LOWORD((DWORD) NextWeather));
	AssortedPrecipData[11] = LOBYTE(HIWORD((DWORD) NextWeather));
	AssortedPrecipData[12] = HIBYTE(HIWORD((DWORD) NextWeather));
	AssortedPrecipData[19] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	AssortedPrecipData[20] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	AssortedPrecipData[21] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	AssortedPrecipData[22] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	AssortedPrecipData[31] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	AssortedPrecipData[32] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	AssortedPrecipData[33] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	AssortedPrecipData[34] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	AssortedPrecipData[43] = LOBYTE(LOWORD((DWORD) WorldRainSpawnTime1));
	AssortedPrecipData[44] = HIBYTE(LOWORD((DWORD) WorldRainSpawnTime1));
	AssortedPrecipData[45] = LOBYTE(HIWORD((DWORD) WorldRainSpawnTime1));
	AssortedPrecipData[46] = HIBYTE(HIWORD((DWORD) WorldRainSpawnTime1));
	AssortedPrecipData[52] = LOBYTE(LOWORD((DWORD) WorldRainSpawnTime2));
	AssortedPrecipData[53] = HIBYTE(LOWORD((DWORD) WorldRainSpawnTime2));
	AssortedPrecipData[54] = LOBYTE(HIWORD((DWORD) WorldRainSpawnTime2));
	AssortedPrecipData[55] = HIBYTE(HIWORD((DWORD) WorldRainSpawnTime2));
	AssortedPrecipData[61] = LOBYTE(LOWORD((DWORD) WorldRainDropHeight));
	AssortedPrecipData[62] = HIBYTE(LOWORD((DWORD) WorldRainDropHeight));
	AssortedPrecipData[63] = LOBYTE(HIWORD((DWORD) WorldRainDropHeight));
	AssortedPrecipData[64] = HIBYTE(HIWORD((DWORD) WorldRainDropHeight));
	AssortedPrecipData[70] = LOBYTE(LOWORD((DWORD) WorldRainSpawnDistModInstall));
	AssortedPrecipData[71] = HIBYTE(LOWORD((DWORD) WorldRainSpawnDistModInstall));
	AssortedPrecipData[72] = LOBYTE(HIWORD((DWORD) WorldRainSpawnDistModInstall));
	AssortedPrecipData[73] = HIBYTE(HIWORD((DWORD) WorldRainSpawnDistModInstall));
	AssortedPrecipData[79] = LOBYTE(LOWORD((DWORD) WorldRainSpawnSpeedThreshInstall));
	AssortedPrecipData[80] = HIBYTE(LOWORD((DWORD) WorldRainSpawnSpeedThreshInstall));
	AssortedPrecipData[81] = LOBYTE(HIWORD((DWORD) WorldRainSpawnSpeedThreshInstall));
	AssortedPrecipData[82] = HIBYTE(HIWORD((DWORD) WorldRainSpawnSpeedThreshInstall));	
	AssortedPrecipData[88] = LOBYTE(LOWORD((DWORD) rainSizePlaceholderAddress));
	AssortedPrecipData[89] = HIBYTE(LOWORD((DWORD) rainSizePlaceholderAddress));
	AssortedPrecipData[90] = LOBYTE(HIWORD((DWORD) rainSizePlaceholderAddress));
	AssortedPrecipData[91] = HIBYTE(HIWORD((DWORD) rainSizePlaceholderAddress));
	long relJumpDist13 =  (((DWORD) AssortedPrecipDataInstall)+6) - (((DWORD) AssortedPrecipData)+99);
	AssortedPrecipData[95] = LOBYTE(LOWORD(relJumpDist13));
	AssortedPrecipData[96] = HIBYTE(LOWORD(relJumpDist13));
	AssortedPrecipData[97] = LOBYTE(HIWORD(relJumpDist13));
	AssortedPrecipData[98] = HIBYTE(HIWORD(relJumpDist13));
	long relJumpDist14 =  ((DWORD) AssortedPrecipData) - (((DWORD) AssortedPrecipDataInstall)+5);
	AssortedPrecipDataInst[1] = LOBYTE(LOWORD(relJumpDist14));
	AssortedPrecipDataInst[2] = HIBYTE(LOWORD(relJumpDist14));
	AssortedPrecipDataInst[3] = LOBYTE(HIWORD(relJumpDist14));
	AssortedPrecipDataInst[4] = HIBYTE(HIWORD(relJumpDist14));
	VirtualProtect(AssortedPrecipDataInstall, sizeof(AssortedPrecipDataInst), PAGE_READWRITE, &protect1);
	memcpy(AssortedPrecipDataInstall, &AssortedPrecipDataInst, sizeof(AssortedPrecipDataInst));
	VirtualProtect(AssortedPrecipDataInstall, sizeof(AssortedPrecipDataInst), protect1, &protect2);

	Freq_Speed3DRain[4] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Freq_Speed3DRain[5] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Freq_Speed3DRain[6] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Freq_Speed3DRain[7] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Freq_Speed3DRain[11] = LOBYTE(LOWORD((DWORD) NextWeather));
	Freq_Speed3DRain[12] = HIBYTE(LOWORD((DWORD) NextWeather));
	Freq_Speed3DRain[13] = LOBYTE(HIWORD((DWORD) NextWeather));
	Freq_Speed3DRain[14] = HIBYTE(HIWORD((DWORD) NextWeather));
	Freq_Speed3DRain[38] = LOBYTE(LOWORD((DWORD) SomeAddress3DRain));
	Freq_Speed3DRain[39] = HIBYTE(LOWORD((DWORD) SomeAddress3DRain));
	Freq_Speed3DRain[40] = LOBYTE(HIWORD((DWORD) SomeAddress3DRain));
	Freq_Speed3DRain[41] = HIBYTE(HIWORD((DWORD) SomeAddress3DRain));
	long relJumpDist15 =  (((DWORD) Freq_Speed3DRainInstall)+5) - (((DWORD) Freq_Speed3DRain)+51);
	Freq_Speed3DRain[47] = LOBYTE(LOWORD(relJumpDist15));
	Freq_Speed3DRain[48] = HIBYTE(LOWORD(relJumpDist15));
	Freq_Speed3DRain[49] = LOBYTE(HIWORD(relJumpDist15));
	Freq_Speed3DRain[50] = HIBYTE(HIWORD(relJumpDist15));
	long relJumpDist16 =  ((DWORD) Freq_Speed3DRain) - (((DWORD) Freq_Speed3DRainInstall)+5);
	Freq_Speed3DRainInst[1] = LOBYTE(LOWORD(relJumpDist16));
	Freq_Speed3DRainInst[2] = HIBYTE(LOWORD(relJumpDist16));
	Freq_Speed3DRainInst[3] = LOBYTE(HIWORD(relJumpDist16));
	Freq_Speed3DRainInst[4] = HIBYTE(HIWORD(relJumpDist16));
	VirtualProtect(Freq_Speed3DRainInstall, sizeof(Freq_Speed3DRainInst), PAGE_READWRITE, &protect1);
	memcpy(Freq_Speed3DRainInstall, &Freq_Speed3DRainInst, sizeof(Freq_Speed3DRainInst));
	VirtualProtect(Freq_Speed3DRainInstall, sizeof(Freq_Speed3DRainInst), protect1, &protect2);
	VirtualProtect(PrevSpeed3DRainBlankerInstall, sizeof(PrevSpeed3DRainBlankerInst), PAGE_READWRITE, &protect1);
	memcpy(PrevSpeed3DRainBlankerInstall, &PrevSpeed3DRainBlankerInst, sizeof(PrevSpeed3DRainBlankerInst));
	VirtualProtect(PrevSpeed3DRainBlankerInstall, sizeof(PrevSpeed3DRainBlankerInst), protect1, &protect2);

	Size3DRain[3] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Size3DRain[4] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Size3DRain[5] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Size3DRain[6] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Size3DRain[10] = LOBYTE(LOWORD((DWORD) NextWeather));
	Size3DRain[11] = HIBYTE(LOWORD((DWORD) NextWeather));
	Size3DRain[12] = LOBYTE(HIWORD((DWORD) NextWeather));
	Size3DRain[13] = HIBYTE(HIWORD((DWORD) NextWeather));
	long relJumpDist17 =  (((DWORD) Size3DRainInstall)+6) - (((DWORD) Size3DRain)+34);
	Size3DRain[30] = LOBYTE(LOWORD(relJumpDist17));
	Size3DRain[31] = HIBYTE(LOWORD(relJumpDist17));
	Size3DRain[32] = LOBYTE(HIWORD(relJumpDist17));
	Size3DRain[33] = HIBYTE(HIWORD(relJumpDist17));
	long relJumpDist18 =  ((DWORD) Size3DRain) - (((DWORD) Size3DRainInstall)+5);
	Size3DRainInst[1] = LOBYTE(LOWORD(relJumpDist18));
	Size3DRainInst[2] = HIBYTE(LOWORD(relJumpDist18));
	Size3DRainInst[3] = LOBYTE(HIWORD(relJumpDist18));
	Size3DRainInst[4] = HIBYTE(HIWORD(relJumpDist18));
	//VirtualProtect(Size3DRainInstall, sizeof(Size3DRainInst), PAGE_READWRITE, &protect1);
	//memcpy(Size3DRainInstall, &Size3DRainInst, sizeof(Size3DRainInst));
	//VirtualProtect(Size3DRainInstall, sizeof(Size3DRainInst), protect1, &protect2);

	RainSplashSkip1[4] = LOBYTE(LOWORD((DWORD) NextWeather));
	RainSplashSkip1[5] = HIBYTE(LOWORD((DWORD) NextWeather));
	RainSplashSkip1[6] = LOBYTE(HIWORD((DWORD) NextWeather));
	RainSplashSkip1[7] = HIBYTE(HIWORD((DWORD) NextWeather));
	RainSplashSkip1[12] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RainSplashSkip1[13] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RainSplashSkip1[14] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RainSplashSkip1[15] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	long relJumpDist19 =  (((DWORD) RainSplashSkip1Install)+5) - (((DWORD) RainSplashSkip1)+28);
	RainSplashSkip1[24] = LOBYTE(LOWORD(relJumpDist19));
	RainSplashSkip1[25] = HIBYTE(LOWORD(relJumpDist19));
	RainSplashSkip1[26] = LOBYTE(HIWORD(relJumpDist19));
	RainSplashSkip1[27] = HIBYTE(HIWORD(relJumpDist19));
	DWORD relCallDist2 =  ((DWORD) CreateParticleProc) - (((DWORD) RainSplashSkip1)+34);
	RainSplashSkip1[30] = LOBYTE(LOWORD(relCallDist2));
	RainSplashSkip1[31] = HIBYTE(LOWORD(relCallDist2));
	RainSplashSkip1[32] = LOBYTE(HIWORD(relCallDist2));
	RainSplashSkip1[33] = HIBYTE(HIWORD(relCallDist2));
	long relJumpDist20 =  (((DWORD) RainSplashSkip1Install)+5) - (((DWORD) RainSplashSkip1)+39);
	RainSplashSkip1[35] = LOBYTE(LOWORD(relJumpDist20));
	RainSplashSkip1[36] = HIBYTE(LOWORD(relJumpDist20));
	RainSplashSkip1[37] = LOBYTE(HIWORD(relJumpDist20));
	RainSplashSkip1[38] = HIBYTE(HIWORD(relJumpDist20));
	long relJumpDist21 =  ((DWORD) RainSplashSkip1) - (((DWORD) RainSplashSkip1Install)+5);
	RainSplashSkip1Inst[1] = LOBYTE(LOWORD(relJumpDist21));
	RainSplashSkip1Inst[2] = HIBYTE(LOWORD(relJumpDist21));
	RainSplashSkip1Inst[3] = LOBYTE(HIWORD(relJumpDist21));
	RainSplashSkip1Inst[4] = HIBYTE(HIWORD(relJumpDist21));
	VirtualProtect(RainSplashSkip1Install, sizeof(RainSplashSkip1Inst), PAGE_READWRITE, &protect1);
	memcpy(RainSplashSkip1Install, &RainSplashSkip1Inst, sizeof(RainSplashSkip1Inst));
	VirtualProtect(RainSplashSkip1Install, sizeof(RainSplashSkip1Inst), protect1, &protect2);

	RainSplashSkip2[4] = LOBYTE(LOWORD((DWORD) NextWeather));
	RainSplashSkip2[5] = HIBYTE(LOWORD((DWORD) NextWeather));
	RainSplashSkip2[6] = LOBYTE(HIWORD((DWORD) NextWeather));
	RainSplashSkip2[7] = HIBYTE(HIWORD((DWORD) NextWeather));
	RainSplashSkip2[12] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RainSplashSkip2[13] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RainSplashSkip2[14] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RainSplashSkip2[15] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	long relJumpDist22 =  (((DWORD) RainSplashSkip2Install)+5) - (((DWORD) RainSplashSkip2)+28);
	RainSplashSkip2[24] = LOBYTE(LOWORD(relJumpDist22));
	RainSplashSkip2[25] = HIBYTE(LOWORD(relJumpDist22));
	RainSplashSkip2[26] = LOBYTE(HIWORD(relJumpDist22));
	RainSplashSkip2[27] = HIBYTE(HIWORD(relJumpDist22));
	DWORD relCallDist3 =  ((DWORD) CreateParticleProc) - (((DWORD) RainSplashSkip2)+34);
	RainSplashSkip2[30] = LOBYTE(LOWORD(relCallDist3));
	RainSplashSkip2[31] = HIBYTE(LOWORD(relCallDist3));
	RainSplashSkip2[32] = LOBYTE(HIWORD(relCallDist3));
	RainSplashSkip2[33] = HIBYTE(HIWORD(relCallDist3));
	long relJumpDist23 =  (((DWORD) RainSplashSkip2Install)+5) - (((DWORD) RainSplashSkip2)+39);
	RainSplashSkip2[35] = LOBYTE(LOWORD(relJumpDist23));
	RainSplashSkip2[36] = HIBYTE(LOWORD(relJumpDist23));
	RainSplashSkip2[37] = LOBYTE(HIWORD(relJumpDist23));
	RainSplashSkip2[38] = HIBYTE(HIWORD(relJumpDist23));
	long relJumpDist24 =  ((DWORD) RainSplashSkip2) - (((DWORD) RainSplashSkip2Install)+5);
	RainSplashSkip2Inst[1] = LOBYTE(LOWORD(relJumpDist24));
	RainSplashSkip2Inst[2] = HIBYTE(LOWORD(relJumpDist24));
	RainSplashSkip2Inst[3] = LOBYTE(HIWORD(relJumpDist24));
	RainSplashSkip2Inst[4] = HIBYTE(HIWORD(relJumpDist24));
	VirtualProtect(RainSplashSkip2Install, sizeof(RainSplashSkip2Inst), PAGE_READWRITE, &protect1);
	memcpy(RainSplashSkip2Install, &RainSplashSkip2Inst, sizeof(RainSplashSkip2Inst));
	VirtualProtect(RainSplashSkip2Install, sizeof(RainSplashSkip2Inst), protect1, &protect2);

	RainSplashSkip3[4] = LOBYTE(LOWORD((DWORD) NextWeather));
	RainSplashSkip3[5] = HIBYTE(LOWORD((DWORD) NextWeather));
	RainSplashSkip3[6] = LOBYTE(HIWORD((DWORD) NextWeather));
	RainSplashSkip3[7] = HIBYTE(HIWORD((DWORD) NextWeather));
	RainSplashSkip3[12] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RainSplashSkip3[13] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RainSplashSkip3[14] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RainSplashSkip3[15] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	long relJumpDist25 =  (((DWORD) RainSplashSkip3Install)+5) - (((DWORD) RainSplashSkip3)+28);
	RainSplashSkip3[24] = LOBYTE(LOWORD(relJumpDist25));
	RainSplashSkip3[25] = HIBYTE(LOWORD(relJumpDist25));
	RainSplashSkip3[26] = LOBYTE(HIWORD(relJumpDist25));
	RainSplashSkip3[27] = HIBYTE(HIWORD(relJumpDist25));
	DWORD relCallDist4 =  ((DWORD) CreateParticleWrapperProc) - (((DWORD) RainSplashSkip3)+34);
	RainSplashSkip3[30] = LOBYTE(LOWORD(relCallDist4));
	RainSplashSkip3[31] = HIBYTE(LOWORD(relCallDist4));
	RainSplashSkip3[32] = LOBYTE(HIWORD(relCallDist4));
	RainSplashSkip3[33] = HIBYTE(HIWORD(relCallDist4));
	long relJumpDist26 =  (((DWORD) RainSplashSkip3Install)+5) - (((DWORD) RainSplashSkip3)+39);
	RainSplashSkip3[35] = LOBYTE(LOWORD(relJumpDist26));
	RainSplashSkip3[36] = HIBYTE(LOWORD(relJumpDist26));
	RainSplashSkip3[37] = LOBYTE(HIWORD(relJumpDist26));
	RainSplashSkip3[38] = HIBYTE(HIWORD(relJumpDist26));
	long relJumpDist27 =  ((DWORD) RainSplashSkip3) - (((DWORD) RainSplashSkip3Install)+5);
	RainSplashSkip3Inst[1] = LOBYTE(LOWORD(relJumpDist27));
	RainSplashSkip3Inst[2] = HIBYTE(LOWORD(relJumpDist27));
	RainSplashSkip3Inst[3] = LOBYTE(HIWORD(relJumpDist27));
	RainSplashSkip3Inst[4] = HIBYTE(HIWORD(relJumpDist27));
	VirtualProtect(RainSplashSkip3Install, sizeof(RainSplashSkip3Inst), PAGE_READWRITE, &protect1);
	memcpy(RainSplashSkip3Install, &RainSplashSkip3Inst, sizeof(RainSplashSkip3Inst));
	VirtualProtect(RainSplashSkip3Install, sizeof(RainSplashSkip3Inst), protect1, &protect2);

	Rain2DSkip[4] = LOBYTE(LOWORD((DWORD) NextWeather));
	Rain2DSkip[5] = HIBYTE(LOWORD((DWORD) NextWeather));
	Rain2DSkip[6] = LOBYTE(HIWORD((DWORD) NextWeather));
	Rain2DSkip[7] = HIBYTE(HIWORD((DWORD) NextWeather));
	Rain2DSkip[12] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Rain2DSkip[13] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Rain2DSkip[14] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Rain2DSkip[15] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	long relJumpDist28 =  ((DWORD) Rain2DSkipJump) - (((DWORD) Rain2DSkip)+28);
	Rain2DSkip[24] = LOBYTE(LOWORD(relJumpDist28));
	Rain2DSkip[25] = HIBYTE(LOWORD(relJumpDist28));
	Rain2DSkip[26] = LOBYTE(HIWORD(relJumpDist28));
	Rain2DSkip[27] = HIBYTE(HIWORD(relJumpDist28));
	long relJumpDist29 =  (((DWORD) Rain2DSkipInstall)+6) - (((DWORD) Rain2DSkip)+34);
	Rain2DSkip[30] = LOBYTE(LOWORD(relJumpDist29));
	Rain2DSkip[31] = HIBYTE(LOWORD(relJumpDist29));
	Rain2DSkip[32] = LOBYTE(HIWORD(relJumpDist29));
	Rain2DSkip[33] = HIBYTE(HIWORD(relJumpDist29));
	long relJumpDist30 =  ((DWORD) Rain2DSkip) - (((DWORD) Rain2DSkipInstall)+5);
	Rain2DSkipInst[1] = LOBYTE(LOWORD(relJumpDist30));
	Rain2DSkipInst[2] = HIBYTE(LOWORD(relJumpDist30));
	Rain2DSkipInst[3] = LOBYTE(HIWORD(relJumpDist30));
	Rain2DSkipInst[4] = HIBYTE(HIWORD(relJumpDist30));
	VirtualProtect(Rain2DSkipInstall, sizeof(Rain2DSkipInst), PAGE_READWRITE, &protect1);
	memcpy(Rain2DSkipInstall, &Rain2DSkipInst, sizeof(Rain2DSkipInst));
	VirtualProtect(Rain2DSkipInstall, sizeof(Rain2DSkipInst), protect1, &protect2);

	RainSoundSkip1[4] = LOBYTE(LOWORD((DWORD) NextWeather));
	RainSoundSkip1[5] = HIBYTE(LOWORD((DWORD) NextWeather));
	RainSoundSkip1[6] = LOBYTE(HIWORD((DWORD) NextWeather));
	RainSoundSkip1[7] = HIBYTE(HIWORD((DWORD) NextWeather));
	RainSoundSkip1[12] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RainSoundSkip1[13] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RainSoundSkip1[14] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RainSoundSkip1[15] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	long relJumpDist31 =  ((DWORD) RainSoundSkip1Jump) - (((DWORD) RainSoundSkip1)+28);
	RainSoundSkip1[24] = LOBYTE(LOWORD(relJumpDist31));
	RainSoundSkip1[25] = HIBYTE(LOWORD(relJumpDist31));
	RainSoundSkip1[26] = LOBYTE(HIWORD(relJumpDist31));
	RainSoundSkip1[27] = HIBYTE(HIWORD(relJumpDist31));
	DWORD relCallDist5 =  ((DWORD) SomeProc2) - (((DWORD) RainSoundSkip1)+34);
	RainSoundSkip1[30] = LOBYTE(LOWORD(relCallDist5));
	RainSoundSkip1[31] = HIBYTE(LOWORD(relCallDist5));
	RainSoundSkip1[32] = LOBYTE(HIWORD(relCallDist5));
	RainSoundSkip1[33] = HIBYTE(HIWORD(relCallDist5));
	long relJumpDist32 =  (((DWORD) RainSoundSkip1Install)+5) - (((DWORD) RainSoundSkip1)+39);
	RainSoundSkip1[35] = LOBYTE(LOWORD(relJumpDist32));
	RainSoundSkip1[36] = HIBYTE(LOWORD(relJumpDist32));
	RainSoundSkip1[37] = LOBYTE(HIWORD(relJumpDist32));
	RainSoundSkip1[38] = HIBYTE(HIWORD(relJumpDist32));
	long relJumpDist33 =  ((DWORD) RainSoundSkip1) - (((DWORD) RainSoundSkip1Install)+5);
	RainSoundSkip1Inst[1] = LOBYTE(LOWORD(relJumpDist33));
	RainSoundSkip1Inst[2] = HIBYTE(LOWORD(relJumpDist33));
	RainSoundSkip1Inst[3] = LOBYTE(HIWORD(relJumpDist33));
	RainSoundSkip1Inst[4] = HIBYTE(HIWORD(relJumpDist33));
	VirtualProtect(RainSoundSkip1Install, sizeof(RainSoundSkip1Inst), PAGE_READWRITE, &protect1);
	memcpy(RainSoundSkip1Install, &RainSoundSkip1Inst, sizeof(RainSoundSkip1Inst));
	VirtualProtect(RainSoundSkip1Install, sizeof(RainSoundSkip1Inst), protect1, &protect2);

	RainSoundSkip2[4] = LOBYTE(LOWORD((DWORD) NextWeather));
	RainSoundSkip2[5] = HIBYTE(LOWORD((DWORD) NextWeather));
	RainSoundSkip2[6] = LOBYTE(HIWORD((DWORD) NextWeather));
	RainSoundSkip2[7] = HIBYTE(HIWORD((DWORD) NextWeather));
	RainSoundSkip2[12] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RainSoundSkip2[13] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	RainSoundSkip2[14] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	RainSoundSkip2[15] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	long relJumpDist34 =  ((DWORD) RainSoundSkip2Jump) - (((DWORD) RainSoundSkip2)+28);
	RainSoundSkip2[24] = LOBYTE(LOWORD(relJumpDist34));
	RainSoundSkip2[25] = HIBYTE(LOWORD(relJumpDist34));
	RainSoundSkip2[26] = LOBYTE(HIWORD(relJumpDist34));
	RainSoundSkip2[27] = HIBYTE(HIWORD(relJumpDist34));
	DWORD relCallDist6 =  ((DWORD) SomeProc2) - (((DWORD) RainSoundSkip2)+34);
	RainSoundSkip2[30] = LOBYTE(LOWORD(relCallDist6));
	RainSoundSkip2[31] = HIBYTE(LOWORD(relCallDist6));
	RainSoundSkip2[32] = LOBYTE(HIWORD(relCallDist6));
	RainSoundSkip2[33] = HIBYTE(HIWORD(relCallDist6));
	long relJumpDist35 =  (((DWORD) RainSoundSkip2Install)+5) - (((DWORD) RainSoundSkip2)+39);
	RainSoundSkip2[35] = LOBYTE(LOWORD(relJumpDist35));
	RainSoundSkip2[36] = HIBYTE(LOWORD(relJumpDist35));
	RainSoundSkip2[37] = LOBYTE(HIWORD(relJumpDist35));
	RainSoundSkip2[38] = HIBYTE(HIWORD(relJumpDist35));
	long relJumpDist36 =  ((DWORD) RainSoundSkip2) - (((DWORD) RainSoundSkip2Install)+5);
	RainSoundSkip2Inst[1] = LOBYTE(LOWORD(relJumpDist36));
	RainSoundSkip2Inst[2] = HIBYTE(LOWORD(relJumpDist36));
	RainSoundSkip2Inst[3] = LOBYTE(HIWORD(relJumpDist36));
	RainSoundSkip2Inst[4] = HIBYTE(HIWORD(relJumpDist36));
	VirtualProtect(RainSoundSkip2Install, sizeof(RainSoundSkip2Inst), PAGE_READWRITE, &protect1);
	memcpy(RainSoundSkip2Install, &RainSoundSkip2Inst, sizeof(RainSoundSkip2Inst));
	VirtualProtect(RainSoundSkip2Install, sizeof(RainSoundSkip2Inst), protect1, &protect2);

	ZDeviation[32] = LOBYTE(LOWORD((DWORD) NextWeather));
	ZDeviation[33] = HIBYTE(LOWORD((DWORD) NextWeather));
	ZDeviation[34] = LOBYTE(HIWORD((DWORD) NextWeather));
	ZDeviation[35] = HIBYTE(HIWORD((DWORD) NextWeather));
	ZDeviation[52] = LOBYTE(LOWORD((DWORD) DeviationConstant));
	ZDeviation[53] = HIBYTE(LOWORD((DWORD) DeviationConstant));
	ZDeviation[54] = LOBYTE(HIWORD((DWORD) DeviationConstant));
	ZDeviation[55] = HIBYTE(HIWORD((DWORD) DeviationConstant));
	ZDeviation[58] = LOBYTE(LOWORD((DWORD) DeviationConstant));
	ZDeviation[59] = HIBYTE(LOWORD((DWORD) DeviationConstant));
	ZDeviation[60] = LOBYTE(HIWORD((DWORD) DeviationConstant));
	ZDeviation[61] = HIBYTE(HIWORD((DWORD) DeviationConstant));
	ZDeviation[64] = LOBYTE(LOWORD((DWORD) Rain3DZPos));
	ZDeviation[65] = HIBYTE(LOWORD((DWORD) Rain3DZPos));
	ZDeviation[66] = LOBYTE(HIWORD((DWORD) Rain3DZPos));
	ZDeviation[67] = HIBYTE(HIWORD((DWORD) Rain3DZPos));
	ZDeviation[70] = LOBYTE(LOWORD((DWORD) Rain3DZPos));
	ZDeviation[71] = HIBYTE(LOWORD((DWORD) Rain3DZPos));
	ZDeviation[72] = LOBYTE(HIWORD((DWORD) Rain3DZPos));
	ZDeviation[73] = HIBYTE(HIWORD((DWORD) Rain3DZPos));
	DWORD relCallDist7 =  ((DWORD) RandomNumberCallDest) - (((DWORD) ZDeviation)+5);
	ZDeviation[1] = LOBYTE(LOWORD(relCallDist7));
	ZDeviation[2] = HIBYTE(LOWORD(relCallDist7));
	ZDeviation[3] = LOBYTE(HIWORD(relCallDist7));
	ZDeviation[4] = HIBYTE(HIWORD(relCallDist7));
	DWORD relCallDist8 =  ((DWORD) RandomNumberCallDest) - (((DWORD) ZDeviation)+79);
	ZDeviation[75] = LOBYTE(LOWORD(relCallDist8));
	ZDeviation[76] = HIBYTE(LOWORD(relCallDist8));
	ZDeviation[77] = LOBYTE(HIWORD(relCallDist8));
	ZDeviation[78] = HIBYTE(HIWORD(relCallDist8));
	long relJumpDist37 =  (((DWORD) ZDeviationInstall)+5) - (((DWORD) ZDeviation)+84);
	ZDeviation[80] = LOBYTE(LOWORD(relJumpDist37));
	ZDeviation[81] = HIBYTE(LOWORD(relJumpDist37));
	ZDeviation[82] = LOBYTE(HIWORD(relJumpDist37));
	ZDeviation[83] = HIBYTE(HIWORD(relJumpDist37));
	long relJumpDist38 =  ((DWORD) ZDeviation) - (((DWORD) ZDeviationInstall)+5);
	ZDeviationInst[1] = LOBYTE(LOWORD(relJumpDist38));
	ZDeviationInst[2] = HIBYTE(LOWORD(relJumpDist38));
	ZDeviationInst[3] = LOBYTE(HIWORD(relJumpDist38));
	ZDeviationInst[4] = HIBYTE(HIWORD(relJumpDist38));
	VirtualProtect(ZDeviationInstall, sizeof(ZDeviationInst), PAGE_READWRITE, &protect1);
	memcpy(ZDeviationInstall, &ZDeviationInst, sizeof(ZDeviationInst));
	VirtualProtect(ZDeviationInstall, sizeof(ZDeviationInst), protect1, &protect2);

	Rain3DSpawnFix[18] = LOBYTE(LOWORD((DWORD) Address69D3D4));
	Rain3DSpawnFix[19] = HIBYTE(LOWORD((DWORD) Address69D3D4));
	Rain3DSpawnFix[20] = LOBYTE(HIWORD((DWORD) Address69D3D4));
	Rain3DSpawnFix[21] = HIBYTE(HIWORD((DWORD) Address69D3D4));
	Rain3DSpawnFix[23] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Rain3DSpawnFix[24] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Rain3DSpawnFix[25] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Rain3DSpawnFix[26] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Rain3DSpawnFix[30] = LOBYTE(LOWORD((DWORD) NextWeather));
	Rain3DSpawnFix[31] = HIBYTE(LOWORD((DWORD) NextWeather));
	Rain3DSpawnFix[32] = LOBYTE(HIWORD((DWORD) NextWeather));
	Rain3DSpawnFix[33] = HIBYTE(HIWORD((DWORD) NextWeather));
	Rain3DSpawnFix[68] = LOBYTE(LOWORD((DWORD) Address699FF0));
	Rain3DSpawnFix[69] = HIBYTE(LOWORD((DWORD) Address699FF0));
	Rain3DSpawnFix[70] = LOBYTE(HIWORD((DWORD) Address699FF0));
	Rain3DSpawnFix[71] = HIBYTE(HIWORD((DWORD) Address699FF0));
	DWORD relCallDist9 =  ((DWORD) RandomNumberCallDest) - (((DWORD) Rain3DSpawnFix)+5);
	Rain3DSpawnFix[1] = LOBYTE(LOWORD(relCallDist9));
	Rain3DSpawnFix[2] = HIBYTE(LOWORD(relCallDist9));
	Rain3DSpawnFix[3] = LOBYTE(HIWORD(relCallDist9));
	Rain3DSpawnFix[4] = HIBYTE(HIWORD(relCallDist9));
	DWORD relCallDist10 =  ((DWORD) Rain3DSpawnFix) - (((DWORD) Rain3DSpawnFix1Install)+5);
	Rain3DSpawnFix1Inst[1] = LOBYTE(LOWORD(relCallDist10));
	Rain3DSpawnFix1Inst[2] = HIBYTE(LOWORD(relCallDist10));
	Rain3DSpawnFix1Inst[3] = LOBYTE(HIWORD(relCallDist10));
	Rain3DSpawnFix1Inst[4] = HIBYTE(HIWORD(relCallDist10));
	VirtualProtect(Rain3DSpawnFix1Install, sizeof(Rain3DSpawnFix1Inst), PAGE_READWRITE, &protect1);
	memcpy(Rain3DSpawnFix1Install, &Rain3DSpawnFix1Inst, sizeof(Rain3DSpawnFix1Inst));
	VirtualProtect(Rain3DSpawnFix1Install, sizeof(Rain3DSpawnFix1Inst), protect1, &protect2);
	DWORD relCallDist11 =  ((DWORD) Rain3DSpawnFix) - (((DWORD) Rain3DSpawnFix2Install)+5);
	Rain3DSpawnFix2Inst[1] = LOBYTE(LOWORD(relCallDist11));
	Rain3DSpawnFix2Inst[2] = HIBYTE(LOWORD(relCallDist11));
	Rain3DSpawnFix2Inst[3] = LOBYTE(HIWORD(relCallDist11));
	Rain3DSpawnFix2Inst[4] = HIBYTE(HIWORD(relCallDist11));
	VirtualProtect(Rain3DSpawnFix2Install, sizeof(Rain3DSpawnFix2Inst), PAGE_READWRITE, &protect1);
	memcpy(Rain3DSpawnFix2Install, &Rain3DSpawnFix2Inst, sizeof(Rain3DSpawnFix2Inst));
	VirtualProtect(Rain3DSpawnFix2Install, sizeof(Rain3DSpawnFix2Inst), protect1, &protect2);

	Rain3DScale[1] = LOBYTE(LOWORD((DWORD) CamPosBase));
	Rain3DScale[2] = HIBYTE(LOWORD((DWORD) CamPosBase));
	Rain3DScale[3] = LOBYTE(HIWORD((DWORD) CamPosBase));
	Rain3DScale[4] = HIBYTE(HIWORD((DWORD) CamPosBase));
	Rain3DScale[7] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Rain3DScale[8] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	Rain3DScale[9] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Rain3DScale[10] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	Rain3DScale[14] = LOBYTE(LOWORD((DWORD) NextWeather));
	Rain3DScale[15] = HIBYTE(LOWORD((DWORD) NextWeather));
	Rain3DScale[16] = LOBYTE(HIWORD((DWORD) NextWeather));
	Rain3DScale[17] = HIBYTE(HIWORD((DWORD) NextWeather));
	void* nineptr = (void*) &nine;
	Rain3DScale[31] = LOBYTE(LOWORD((DWORD) nineptr));
	Rain3DScale[32] = HIBYTE(LOWORD((DWORD) nineptr));
	Rain3DScale[33] = LOBYTE(HIWORD((DWORD) nineptr));
	Rain3DScale[34] = HIBYTE(HIWORD((DWORD) nineptr));
	Rain3DScale[40] = LOBYTE(LOWORD((DWORD) Rain3DWidth));
	Rain3DScale[41] = HIBYTE(LOWORD((DWORD) Rain3DWidth));
	Rain3DScale[42] = LOBYTE(HIWORD((DWORD) Rain3DWidth));
	Rain3DScale[43] = HIBYTE(HIWORD((DWORD) Rain3DWidth));
	void* elevenptr = (void*) &eleven;
	Rain3DScale[46] = LOBYTE(LOWORD((DWORD) elevenptr));
	Rain3DScale[47] = HIBYTE(LOWORD((DWORD) elevenptr));
	Rain3DScale[48] = LOBYTE(HIWORD((DWORD) elevenptr));
	Rain3DScale[49] = HIBYTE(HIWORD((DWORD) elevenptr));
	Rain3DScale[55] = LOBYTE(LOWORD((DWORD) Rain3DHeight));
	Rain3DScale[56] = HIBYTE(LOWORD((DWORD) Rain3DHeight));
	Rain3DScale[57] = LOBYTE(HIWORD((DWORD) Rain3DHeight));
	Rain3DScale[58] = HIBYTE(HIWORD((DWORD) Rain3DHeight));
	long relJumpDist39 =  (((DWORD) Rain3DScaleInstall)+5) - (((DWORD) Rain3DScale)+65);
	Rain3DScale[61] = LOBYTE(LOWORD(relJumpDist39));
	Rain3DScale[62] = HIBYTE(LOWORD(relJumpDist39));
	Rain3DScale[63] = LOBYTE(HIWORD(relJumpDist39));
	Rain3DScale[64] = HIBYTE(HIWORD(relJumpDist39));
	long relJumpDist40 =  ((DWORD) Rain3DScale) - (((DWORD) Rain3DScaleInstall)+5);
	Rain3DScaleInst[1] = LOBYTE(LOWORD(relJumpDist40));
	Rain3DScaleInst[2] = HIBYTE(LOWORD(relJumpDist40));
	Rain3DScaleInst[3] = LOBYTE(HIWORD(relJumpDist40));
	Rain3DScaleInst[4] = HIBYTE(HIWORD(relJumpDist40));
	VirtualProtect(Rain3DScaleInstall, sizeof(Rain3DScaleInst), PAGE_READWRITE, &protect1);
	memcpy(Rain3DScaleInstall, &Rain3DScaleInst, sizeof(Rain3DScaleInst));
	VirtualProtect(Rain3DScaleInstall, sizeof(Rain3DScaleInst), protect1, &protect2);

	Rain3DMatFix[9] = LOBYTE(LOWORD((DWORD) D3DDevicePtr));
	Rain3DMatFix[10] = HIBYTE(LOWORD((DWORD) D3DDevicePtr));
	Rain3DMatFix[11] = LOBYTE(HIWORD((DWORD) D3DDevicePtr));
	Rain3DMatFix[12] = HIBYTE(HIWORD((DWORD) D3DDevicePtr));
	Rain3DMatFix[16] = LOBYTE(LOWORD((DWORD) StandardMaterial));
	Rain3DMatFix[17] = HIBYTE(LOWORD((DWORD) StandardMaterial));
	Rain3DMatFix[18] = LOBYTE(HIWORD((DWORD) StandardMaterial));
	Rain3DMatFix[19] = HIBYTE(HIWORD((DWORD) StandardMaterial));
	DWORD relCallDist12 =  ((DWORD) SomeProc3) - (((DWORD) Rain3DMatFix)+5);
	Rain3DMatFix[1] = LOBYTE(LOWORD(relCallDist12));
	Rain3DMatFix[2] = HIBYTE(LOWORD(relCallDist12));
	Rain3DMatFix[3] = LOBYTE(HIWORD(relCallDist12));
	Rain3DMatFix[4] = HIBYTE(HIWORD(relCallDist12));
	DWORD relCallDist13 =  ((DWORD) RWSetRenderStateProc) - (((DWORD) Rain3DMatFix)+39);
	Rain3DMatFix[35] = LOBYTE(LOWORD(relCallDist13));
	Rain3DMatFix[36] = HIBYTE(LOWORD(relCallDist13));
	Rain3DMatFix[37] = LOBYTE(HIWORD(relCallDist13));
	Rain3DMatFix[38] = HIBYTE(HIWORD(relCallDist13));
	long relJumpDist41 =  (((DWORD) Rain3DMatFixInstall)+5) - (((DWORD) Rain3DMatFix)+49);
	Rain3DMatFix[45] = LOBYTE(LOWORD(relJumpDist41));
	Rain3DMatFix[46] = HIBYTE(LOWORD(relJumpDist41));
	Rain3DMatFix[47] = LOBYTE(HIWORD(relJumpDist41));
	Rain3DMatFix[48] = HIBYTE(HIWORD(relJumpDist41));
	long relJumpDist42 =  ((DWORD) Rain3DMatFix) - (((DWORD) Rain3DMatFixInstall)+5);
	Rain3DMatFixInst[1] = LOBYTE(LOWORD(relJumpDist42));
	Rain3DMatFixInst[2] = HIBYTE(LOWORD(relJumpDist42));
	Rain3DMatFixInst[3] = LOBYTE(HIWORD(relJumpDist42));
	Rain3DMatFixInst[4] = HIBYTE(HIWORD(relJumpDist42));
	VirtualProtect(Rain3DMatFixInstall, sizeof(Rain3DMatFixInst), PAGE_READWRITE, &protect1);
	memcpy(Rain3DMatFixInstall, &Rain3DMatFixInst, sizeof(Rain3DMatFixInst));
	VirtualProtect(Rain3DMatFixInstall, sizeof(Rain3DMatFixInst), protect1, &protect2);

	GripFX[2] = LOBYTE(LOWORD((DWORD) RoadWetness));
	GripFX[3] = HIBYTE(LOWORD((DWORD) RoadWetness));
	GripFX[4] = LOBYTE(HIWORD((DWORD) RoadWetness));
	GripFX[5] = HIBYTE(HIWORD((DWORD) RoadWetness));
	GripFX[9] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	GripFX[10] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	GripFX[11] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	GripFX[12] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	GripFX[16] = LOBYTE(LOWORD((DWORD) CurrentWeather));
	GripFX[17] = HIBYTE(LOWORD((DWORD) CurrentWeather));
	GripFX[18] = LOBYTE(HIWORD((DWORD) CurrentWeather));
	GripFX[19] = HIBYTE(HIWORD((DWORD) CurrentWeather));
	GripFX[31] = LOBYTE(LOWORD((DWORD) CurrentWeather));
	GripFX[32] = HIBYTE(LOWORD((DWORD) CurrentWeather));
	GripFX[33] = LOBYTE(HIWORD((DWORD) CurrentWeather));
	GripFX[34] = HIBYTE(HIWORD((DWORD) CurrentWeather));
	GripFX[48] = LOBYTE(LOWORD((DWORD) HourElapsed));
	GripFX[49] = HIBYTE(LOWORD((DWORD) HourElapsed));
	GripFX[50] = LOBYTE(HIWORD((DWORD) HourElapsed));
	GripFX[51] = HIBYTE(HIWORD((DWORD) HourElapsed));
	GripFX[56] = LOBYTE(LOWORD((DWORD) RoadWetness));
	GripFX[57] = HIBYTE(LOWORD((DWORD) RoadWetness));
	GripFX[58] = LOBYTE(HIWORD((DWORD) RoadWetness));
	GripFX[59] = HIBYTE(HIWORD((DWORD) RoadWetness));
	GripFX[63] = LOBYTE(LOWORD((DWORD) NextWeather));
	GripFX[64] = HIBYTE(LOWORD((DWORD) NextWeather));
	GripFX[65] = LOBYTE(HIWORD((DWORD) NextWeather));
	GripFX[66] = HIBYTE(HIWORD((DWORD) NextWeather));
	GripFX[78] = LOBYTE(LOWORD((DWORD) NextWeather));
	GripFX[79] = HIBYTE(LOWORD((DWORD) NextWeather));
	GripFX[80] = LOBYTE(HIWORD((DWORD) NextWeather));
	GripFX[81] = HIBYTE(HIWORD((DWORD) NextWeather));
	GripFX[93] = LOBYTE(LOWORD((DWORD) HourElapsed));
	GripFX[94] = HIBYTE(LOWORD((DWORD) HourElapsed));
	GripFX[95] = LOBYTE(HIWORD((DWORD) HourElapsed));
	GripFX[96] = HIBYTE(HIWORD((DWORD) HourElapsed));
	long relJumpDist43 =  (((DWORD) GripFXInstall)+6) - (((DWORD) GripFX)+112);
	GripFX[108] = LOBYTE(LOWORD(relJumpDist43));
	GripFX[109] = HIBYTE(LOWORD(relJumpDist43));
	GripFX[110] = LOBYTE(HIWORD(relJumpDist43));
	GripFX[111] = HIBYTE(HIWORD(relJumpDist43));
	long relJumpDist44 =  ((DWORD) GripFX) - (((DWORD) GripFXInstall)+5);
	GripFXInst[1] = LOBYTE(LOWORD(relJumpDist44));
	GripFXInst[2] = HIBYTE(LOWORD(relJumpDist44));
	GripFXInst[3] = LOBYTE(HIWORD(relJumpDist44));
	GripFXInst[4] = HIBYTE(HIWORD(relJumpDist44));
	VirtualProtect(GripFXInstall, sizeof(GripFXInst), PAGE_READWRITE, &protect1);
	memcpy(GripFXInstall, &GripFXInst, sizeof(GripFXInst));
	VirtualProtect(GripFXInstall, sizeof(GripFXInst), protect1, &protect2);

	ReflectFX[2] = LOBYTE(LOWORD((DWORD) RoadWetness));
	ReflectFX[3] = HIBYTE(LOWORD((DWORD) RoadWetness));
	ReflectFX[4] = LOBYTE(HIWORD((DWORD) RoadWetness));
	ReflectFX[5] = HIBYTE(HIWORD((DWORD) RoadWetness));
	ReflectFX[9] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	ReflectFX[10] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	ReflectFX[11] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	ReflectFX[12] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	ReflectFX[16] = LOBYTE(LOWORD((DWORD) CurrentWeather));
	ReflectFX[17] = HIBYTE(LOWORD((DWORD) CurrentWeather));
	ReflectFX[18] = LOBYTE(HIWORD((DWORD) CurrentWeather));
	ReflectFX[19] = HIBYTE(HIWORD((DWORD) CurrentWeather));
	ReflectFX[31] = LOBYTE(LOWORD((DWORD) CurrentWeather));
	ReflectFX[32] = HIBYTE(LOWORD((DWORD) CurrentWeather));
	ReflectFX[33] = LOBYTE(HIWORD((DWORD) CurrentWeather));
	ReflectFX[34] = HIBYTE(HIWORD((DWORD) CurrentWeather));
	ReflectFX[48] = LOBYTE(LOWORD((DWORD) HourElapsed));
	ReflectFX[49] = HIBYTE(LOWORD((DWORD) HourElapsed));
	ReflectFX[50] = LOBYTE(HIWORD((DWORD) HourElapsed));
	ReflectFX[51] = HIBYTE(HIWORD((DWORD) HourElapsed));
	ReflectFX[56] = LOBYTE(LOWORD((DWORD) RoadWetness));
	ReflectFX[57] = HIBYTE(LOWORD((DWORD) RoadWetness));
	ReflectFX[58] = LOBYTE(HIWORD((DWORD) RoadWetness));
	ReflectFX[59] = HIBYTE(HIWORD((DWORD) RoadWetness));
	ReflectFX[63] = LOBYTE(LOWORD((DWORD) NextWeather));
	ReflectFX[64] = HIBYTE(LOWORD((DWORD) NextWeather));
	ReflectFX[65] = LOBYTE(HIWORD((DWORD) NextWeather));
	ReflectFX[66] = HIBYTE(HIWORD((DWORD) NextWeather));
	ReflectFX[78] = LOBYTE(LOWORD((DWORD) NextWeather));
	ReflectFX[79] = HIBYTE(LOWORD((DWORD) NextWeather));
	ReflectFX[80] = LOBYTE(HIWORD((DWORD) NextWeather));
	ReflectFX[81] = HIBYTE(HIWORD((DWORD) NextWeather));
	ReflectFX[93] = LOBYTE(LOWORD((DWORD) HourElapsed));
	ReflectFX[94] = HIBYTE(LOWORD((DWORD) HourElapsed));
	ReflectFX[95] = LOBYTE(HIWORD((DWORD) HourElapsed));
	ReflectFX[96] = HIBYTE(HIWORD((DWORD) HourElapsed));
	long relJumpDist45 =  (((DWORD) ReflectFXInstall)+6) - (((DWORD) ReflectFX)+110);
	ReflectFX[106] = LOBYTE(LOWORD(relJumpDist45));
	ReflectFX[107] = HIBYTE(LOWORD(relJumpDist45));
	ReflectFX[108] = LOBYTE(HIWORD(relJumpDist45));
	ReflectFX[109] = HIBYTE(HIWORD(relJumpDist45));
	long relJumpDist46 =  ((DWORD) ReflectFX) - (((DWORD) ReflectFXInstall)+5);
	ReflectFXInst[1] = LOBYTE(LOWORD(relJumpDist46));
	ReflectFXInst[2] = HIBYTE(LOWORD(relJumpDist46));
	ReflectFXInst[3] = LOBYTE(HIWORD(relJumpDist46));
	ReflectFXInst[4] = HIBYTE(HIWORD(relJumpDist46));
	VirtualProtect(ReflectFXInstall, sizeof(ReflectFXInst), PAGE_READWRITE, &protect1);
	memcpy(ReflectFXInstall, &ReflectFXInst, sizeof(ReflectFXInst));
	VirtualProtect(ReflectFXInstall, sizeof(ReflectFXInst), protect1, &protect2);

	UndoBoatOverride[8] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	UndoBoatOverride[9] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	UndoBoatOverride[10] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	UndoBoatOverride[11] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	temp = (DWORD) BoatTextureBase + 0x18;
	UndoBoatOverride[17] = LOBYTE(LOWORD((DWORD) temp));
	UndoBoatOverride[18] = HIBYTE(LOWORD((DWORD) temp));
	UndoBoatOverride[19] = LOBYTE(HIWORD((DWORD) temp));
	UndoBoatOverride[20] = HIBYTE(HIWORD((DWORD) temp));
	temp = (DWORD) BoatTextureBase + 0x38;
	UndoBoatOverride[26] = LOBYTE(LOWORD((DWORD) temp));
	UndoBoatOverride[27] = HIBYTE(LOWORD((DWORD) temp));
	UndoBoatOverride[28] = LOBYTE(HIWORD((DWORD) temp));
	UndoBoatOverride[29] = HIBYTE(HIWORD((DWORD) temp));
	temp = (DWORD) BoatTextureBase + 0x1C;
	UndoBoatOverride[35] = LOBYTE(LOWORD((DWORD) temp));
	UndoBoatOverride[36] = HIBYTE(LOWORD((DWORD) temp));
	UndoBoatOverride[37] = LOBYTE(HIWORD((DWORD) temp));
	UndoBoatOverride[38] = HIBYTE(HIWORD((DWORD) temp));
	temp = (DWORD) BoatTextureBase + 0x3C;
	UndoBoatOverride[44] = LOBYTE(LOWORD((DWORD) temp));
	UndoBoatOverride[45] = HIBYTE(LOWORD((DWORD) temp));
	UndoBoatOverride[46] = LOBYTE(HIWORD((DWORD) temp));
	UndoBoatOverride[47] = HIBYTE(HIWORD((DWORD) temp));
	long relJumpDist47 =  (((DWORD) UndoBoatOverrideInstall)+5) - (((DWORD) UndoBoatOverride)+55);
	UndoBoatOverride[51] = LOBYTE(LOWORD(relJumpDist47));
	UndoBoatOverride[52] = HIBYTE(LOWORD(relJumpDist47));
	UndoBoatOverride[53] = LOBYTE(HIWORD(relJumpDist47));
	UndoBoatOverride[54] = HIBYTE(HIWORD(relJumpDist47));
	long relJumpDist48 =  ((DWORD) UndoBoatOverride) - (((DWORD) UndoBoatOverrideInstall)+5);
	UndoBoatOverrideInst[1] = LOBYTE(LOWORD(relJumpDist48));
	UndoBoatOverrideInst[2] = HIBYTE(LOWORD(relJumpDist48));
	UndoBoatOverrideInst[3] = LOBYTE(HIWORD(relJumpDist48));
	UndoBoatOverrideInst[4] = HIBYTE(HIWORD(relJumpDist48));
	VirtualProtect(UndoBoatOverrideInstall, sizeof(UndoBoatOverrideInst), PAGE_READWRITE, &protect1);
	memcpy(UndoBoatOverrideInstall, &UndoBoatOverrideInst, sizeof(UndoBoatOverrideInst));
	VirtualProtect(UndoBoatOverrideInstall, sizeof(UndoBoatOverrideInst), protect1, &protect2);

	GroundSteamFix[3] = LOBYTE(LOWORD((DWORD) NextWeather));
	GroundSteamFix[4] = HIBYTE(LOWORD((DWORD) NextWeather));
	GroundSteamFix[5] = LOBYTE(HIWORD((DWORD) NextWeather));
	GroundSteamFix[6] = HIBYTE(HIWORD((DWORD) NextWeather));
	GroundSteamFix[12] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	GroundSteamFix[13] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	GroundSteamFix[14] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	GroundSteamFix[15] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	GroundSteamFix[30] = LOBYTE(LOWORD((DWORD) ActivateSteam));
	GroundSteamFix[31] = HIBYTE(LOWORD((DWORD) ActivateSteam));
	GroundSteamFix[32] = LOBYTE(HIWORD((DWORD) ActivateSteam));
	GroundSteamFix[33] = HIBYTE(HIWORD((DWORD) ActivateSteam));
	long relJumpDist49 =  (((DWORD) GroundSteamFixInstall)+29) - (((DWORD) GroundSteamFix)+28);
	GroundSteamFix[24] = LOBYTE(LOWORD(relJumpDist49));
	GroundSteamFix[25] = HIBYTE(LOWORD(relJumpDist49));
	GroundSteamFix[26] = LOBYTE(HIWORD(relJumpDist49));
	GroundSteamFix[27] = HIBYTE(HIWORD(relJumpDist49));
	long relJumpDist50 =  (((DWORD) GroundSteamFixInstall)+10) - (((DWORD) GroundSteamFix)+43);
	GroundSteamFix[39] = LOBYTE(LOWORD(relJumpDist50));
	GroundSteamFix[40] = HIBYTE(LOWORD(relJumpDist50));
	GroundSteamFix[41] = LOBYTE(HIWORD(relJumpDist50));
	GroundSteamFix[42] = HIBYTE(HIWORD(relJumpDist50));
	long relJumpDist51 =  ((DWORD) GroundSteamFix) - (((DWORD) GroundSteamFixInstall)+5);
	GroundSteamFixInst[1] = LOBYTE(LOWORD(relJumpDist51));
	GroundSteamFixInst[2] = HIBYTE(LOWORD(relJumpDist51));
	GroundSteamFixInst[3] = LOBYTE(HIWORD(relJumpDist51));
	GroundSteamFixInst[4] = HIBYTE(HIWORD(relJumpDist51));
	VirtualProtect(GroundSteamFixInstall, sizeof(GroundSteamFixInst), PAGE_READWRITE, &protect1);
	memcpy(GroundSteamFixInstall, &GroundSteamFixInst, sizeof(GroundSteamFixInst));
	VirtualProtect(GroundSteamFixInstall, sizeof(GroundSteamFixInst), protect1, &protect2);
}


//***********************************************
//RAINBOWS
//***********************************************
DWORD *RainbowTime1Install = (DWORD *) 0x57DA3C;
DWORD *RainbowTime2Install = (DWORD *) 0x57DA45;

void InstallRainbowHandling()
{
	DWORD protect1, protect2;

	BYTE temp = VC_WeatherGlobalData.rainbowStart;
	VirtualProtect(RainbowTime1Install, sizeof(temp), PAGE_READWRITE, &protect1);
	memcpy(RainbowTime1Install, &temp, sizeof(temp));
	VirtualProtect(RainbowTime1Install, sizeof(temp), protect1, &protect2);
	
	temp = VC_WeatherGlobalData.rainbowEnd;
	VirtualProtect(RainbowTime2Install, sizeof(temp), PAGE_READWRITE, &protect1);
	memcpy(RainbowTime2Install, &temp, sizeof(temp));
	VirtualProtect(RainbowTime2Install, sizeof(temp), protect1, &protect2);
}

//***********************************************
//WINDS/HURRICANE WEATHER (builds on wind function above)
//***********************************************
DWORD *WindTreeFix1Install = (DWORD *) 0x487B8B;
DWORD *WindTreeFix2Install = (DWORD *) 0x487C01;
DWORD *WindCloudFix1Install = (DWORD *) 0x540EC5;
DWORD *WindCloudFix2Install = (DWORD *) 0x540EE8;

//DWORD *CurrentWindIntensity = (DWORD *) 0x97533C;
DWORD *Address69A044 = (DWORD *) 0x69A044; //const 1.0f

BYTE WindTreeFix1[67] =				{0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x50, 0x51, 
									 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x8B, 0x40, 0x58,
									 0x0F, 0xB7, 0x0D, 0x2E, 0x0A, 0xA1, 0x00, 0xD9,
									 0x04, 0x88, 0xD8, 0x0D, 0xD8, 0x87, 0x97, 0x00,
									 0x0F, 0xB7, 0x0D, 0xAA, 0x0A, 0xA1, 0x00, 0xD9,
									 0x05, 0x44, 0xA0, 0x69, 0x00, 0xD8, 0x25, 0xD8,
									 0x87, 0x97, 0x00, 0xD8, 0x0C, 0x88, 0xD8, 0xC1,
									 0xDC, 0xCA, 0xDE, 0xD9, 0x59, 0x58, 0xE9, 0x3E,
									 0x9E, 0xE0, 0xFF};
BYTE WindTreeFix1Inst[6] =			{0xE9, 0x00, 0x00, 0x00, 0x00, 0x90};

BYTE WindTreeFix2[67] =				{0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x50, 0x51,
									 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x8B, 0x40, 0x58,
									 0x0F, 0xB7, 0x0D, 0x2E, 0x0A, 0xA1, 0x00, 0xD9,
									 0x04, 0x88, 0xD8, 0x0D, 0xD8, 0x87, 0x97, 0x00,
									 0x0F, 0xB7, 0x0D, 0xAA, 0x0A, 0xA1, 0x00, 0xD9,
									 0x05, 0x44, 0xA0, 0x69, 0x00, 0xD8, 0x25, 0xD8,
									 0x87, 0x97, 0x00, 0xD8, 0x0C, 0x88, 0xD8, 0xC1,
									 0xDC, 0xCA, 0xDE, 0xD9, 0x59, 0x58, 0xE9, 0x64,
									 0x9E, 0xE0, 0xFF};
BYTE WindTreeFix2Inst[6] =			{0xE9, 0x00, 0x00, 0x00, 0x00, 0x90};

BYTE WindCloudFix1[64] =			{0x50, 0x51, 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x8B,
									 0x40, 0x5C, 0x0F, 0xB7, 0x0D, 0x2E, 0x0A, 0xA1,
									 0x00, 0xD9, 0x04, 0x88, 0xD8, 0x0D, 0xD8, 0x87,
									 0x97, 0x00, 0x0F, 0xB7, 0x0D, 0xAA, 0x0A, 0xA1,
									 0x00, 0xD9, 0x05, 0x44, 0xA0, 0x69, 0x00, 0xD8,
									 0x25, 0xD8, 0x87, 0x97, 0x00, 0xD8, 0x0C, 0x88,
									 0xD8, 0xC1, 0xDC, 0xCA, 0xDE, 0xD9, 0x59, 0x58,
									 0xE9, 0x7E, 0x31, 0xEC, 0xFF};
BYTE WindCloudFix1Inst[6] =			{0xE9, 0x00, 0x00, 0x00, 0x00, 0x90};

BYTE WindCloudFix2[64] =			{0x50, 0x51, 0xA1, 0xE0, 0xFF, 0x6D, 0x00, 0x8B,
									 0x40, 0x5C, 0x0F, 0xB7, 0x0D, 0x2E, 0x0A, 0xA1,
									 0x00, 0xD9, 0x04, 0x88, 0xD8, 0x0D, 0xD8, 0x87,
									 0x97, 0x00, 0x0F, 0xB7, 0x0D, 0xAA, 0x0A, 0xA1,
									 0x00, 0xD9, 0x05, 0x44, 0xA0, 0x69, 0x00, 0xD8,
									 0x25, 0xD8, 0x87, 0x97, 0x00, 0xD8, 0x0C, 0x88,
									 0xD8, 0xC1, 0xDC, 0xCA, 0xDE, 0xD9, 0x59, 0x58,
									 0xE9, 0x51, 0x31, 0xEC, 0xFF};
BYTE WindCloudFix2Inst[6] =			{0xE9, 0x00, 0x00, 0x00, 0x00, 0x90};

void InstallHurricanes()
{
	DWORD protect1, protect2;

	//WindTreeFix1[2] = LOBYTE(LOWORD((DWORD) CurrentWindIntensity));
	//WindTreeFix1[3] = HIBYTE(LOWORD((DWORD) CurrentWindIntensity));
	//WindTreeFix1[4] = LOBYTE(HIWORD((DWORD) CurrentWindIntensity));
	//WindTreeFix1[5] = HIBYTE(HIWORD((DWORD) CurrentWindIntensity));
	//WindTreeFix1[9] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	WindTreeFix1[10] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	WindTreeFix1[11] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	WindTreeFix1[12] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	WindTreeFix1[19] = LOBYTE(LOWORD((DWORD) NextWeather));
	WindTreeFix1[20] = HIBYTE(LOWORD((DWORD) NextWeather));
	WindTreeFix1[21] = LOBYTE(HIWORD((DWORD) NextWeather));
	WindTreeFix1[22] = HIBYTE(HIWORD((DWORD) NextWeather));
	WindTreeFix1[28] = LOBYTE(LOWORD((DWORD) HourElapsed));
	WindTreeFix1[29] = HIBYTE(LOWORD((DWORD) HourElapsed));
	WindTreeFix1[30] = LOBYTE(HIWORD((DWORD) HourElapsed));
	WindTreeFix1[31] = HIBYTE(HIWORD((DWORD) HourElapsed));
	WindTreeFix1[35] = LOBYTE(LOWORD((DWORD) CurrentWeather));
	WindTreeFix1[36] = HIBYTE(LOWORD((DWORD) CurrentWeather));
	WindTreeFix1[37] = LOBYTE(HIWORD((DWORD) CurrentWeather));
	WindTreeFix1[38] = HIBYTE(HIWORD((DWORD) CurrentWeather));
	WindTreeFix1[41] = LOBYTE(LOWORD((DWORD) Address69A044));
	WindTreeFix1[42] = HIBYTE(LOWORD((DWORD) Address69A044));
	WindTreeFix1[43] = LOBYTE(HIWORD((DWORD) Address69A044));
	WindTreeFix1[44] = HIBYTE(HIWORD((DWORD) Address69A044));
	WindTreeFix1[47] = LOBYTE(LOWORD((DWORD) HourElapsed));
	WindTreeFix1[48] = HIBYTE(LOWORD((DWORD) HourElapsed));
	WindTreeFix1[49] = LOBYTE(HIWORD((DWORD) HourElapsed));
	WindTreeFix1[50] = HIBYTE(HIWORD((DWORD) HourElapsed));
	long relJumpDist1 =  (((DWORD) WindTreeFix1Install)+6) - (((DWORD) WindTreeFix1)+67);
	WindTreeFix1[63] = LOBYTE(LOWORD(relJumpDist1));
	WindTreeFix1[64] = HIBYTE(LOWORD(relJumpDist1));
	WindTreeFix1[65] = LOBYTE(HIWORD(relJumpDist1));
	WindTreeFix1[66] = HIBYTE(HIWORD(relJumpDist1));
	long relJumpDist2 =  ((DWORD) WindTreeFix1) - (((DWORD) WindTreeFix1Install)+5);
	WindTreeFix1Inst[1] = LOBYTE(LOWORD(relJumpDist2));
	WindTreeFix1Inst[2] = HIBYTE(LOWORD(relJumpDist2));
	WindTreeFix1Inst[3] = LOBYTE(HIWORD(relJumpDist2));
	WindTreeFix1Inst[4] = HIBYTE(HIWORD(relJumpDist2));
	VirtualProtect(WindTreeFix1Install, sizeof(WindTreeFix1Inst), PAGE_READWRITE, &protect1);
	memcpy(WindTreeFix1Install, &WindTreeFix1Inst, sizeof(WindTreeFix1Inst));
	VirtualProtect(WindTreeFix1Install, sizeof(WindTreeFix1Inst), protect1, &protect2);

	//WindTreeFix2[2] = LOBYTE(LOWORD((DWORD) CurrentWindIntensity));
	//WindTreeFix2[3] = HIBYTE(LOWORD((DWORD) CurrentWindIntensity));
	//WindTreeFix2[4] = LOBYTE(HIWORD((DWORD) CurrentWindIntensity));
	//WindTreeFix2[5] = HIBYTE(HIWORD((DWORD) CurrentWindIntensity));
	WindTreeFix2[9] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	WindTreeFix2[10] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	WindTreeFix2[11] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	WindTreeFix2[12] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	WindTreeFix2[19] = LOBYTE(LOWORD((DWORD) NextWeather));
	WindTreeFix2[20] = HIBYTE(LOWORD((DWORD) NextWeather));
	WindTreeFix2[21] = LOBYTE(HIWORD((DWORD) NextWeather));
	WindTreeFix2[22] = HIBYTE(HIWORD((DWORD) NextWeather));
	WindTreeFix2[28] = LOBYTE(LOWORD((DWORD) HourElapsed));
	WindTreeFix2[29] = HIBYTE(LOWORD((DWORD) HourElapsed));
	WindTreeFix2[30] = LOBYTE(HIWORD((DWORD) HourElapsed));
	WindTreeFix2[31] = HIBYTE(HIWORD((DWORD) HourElapsed));
	WindTreeFix2[35] = LOBYTE(LOWORD((DWORD) CurrentWeather));
	WindTreeFix2[36] = HIBYTE(LOWORD((DWORD) CurrentWeather));
	WindTreeFix2[37] = LOBYTE(HIWORD((DWORD) CurrentWeather));
	WindTreeFix2[38] = HIBYTE(HIWORD((DWORD) CurrentWeather));
	WindTreeFix2[41] = LOBYTE(LOWORD((DWORD) Address69A044));
	WindTreeFix2[42] = HIBYTE(LOWORD((DWORD) Address69A044));
	WindTreeFix2[43] = LOBYTE(HIWORD((DWORD) Address69A044));
	WindTreeFix2[44] = HIBYTE(HIWORD((DWORD) Address69A044));
	WindTreeFix2[47] = LOBYTE(LOWORD((DWORD) HourElapsed));
	WindTreeFix2[48] = HIBYTE(LOWORD((DWORD) HourElapsed));
	WindTreeFix2[49] = LOBYTE(HIWORD((DWORD) HourElapsed));
	WindTreeFix2[50] = HIBYTE(HIWORD((DWORD) HourElapsed));
	long relJumpDist3 =  (((DWORD) WindTreeFix2Install)+6) - (((DWORD) WindTreeFix2)+67);
	WindTreeFix2[63] = LOBYTE(LOWORD(relJumpDist3));
	WindTreeFix2[64] = HIBYTE(LOWORD(relJumpDist3));
	WindTreeFix2[65] = LOBYTE(HIWORD(relJumpDist3));
	WindTreeFix2[66] = HIBYTE(HIWORD(relJumpDist3));
	long relJumpDist4 =  ((DWORD) WindTreeFix2) - (((DWORD) WindTreeFix2Install)+5);
	WindTreeFix2Inst[1] = LOBYTE(LOWORD(relJumpDist4));
	WindTreeFix2Inst[2] = HIBYTE(LOWORD(relJumpDist4));
	WindTreeFix2Inst[3] = LOBYTE(HIWORD(relJumpDist4));
	WindTreeFix2Inst[4] = HIBYTE(HIWORD(relJumpDist4));
	VirtualProtect(WindTreeFix2Install, sizeof(WindTreeFix2Inst), PAGE_READWRITE, &protect1);
	memcpy(WindTreeFix2Install, &WindTreeFix2Inst, sizeof(WindTreeFix2Inst));
	VirtualProtect(WindTreeFix2Install, sizeof(WindTreeFix2Inst), protect1, &protect2);

	WindCloudFix1[3] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	WindCloudFix1[4] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	WindCloudFix1[5] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	WindCloudFix1[6] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	WindCloudFix1[13] = LOBYTE(LOWORD((DWORD) NextWeather));
	WindCloudFix1[14] = HIBYTE(LOWORD((DWORD) NextWeather));
	WindCloudFix1[15] = LOBYTE(HIWORD((DWORD) NextWeather));
	WindCloudFix1[16] = HIBYTE(HIWORD((DWORD) NextWeather));
	WindCloudFix1[22] = LOBYTE(LOWORD((DWORD) HourElapsed));
	WindCloudFix1[23] = HIBYTE(LOWORD((DWORD) HourElapsed));
	WindCloudFix1[24] = LOBYTE(HIWORD((DWORD) HourElapsed));
	WindCloudFix1[25] = HIBYTE(HIWORD((DWORD) HourElapsed));
	WindCloudFix1[29] = LOBYTE(LOWORD((DWORD) CurrentWeather));
	WindCloudFix1[30] = HIBYTE(LOWORD((DWORD) CurrentWeather));
	WindCloudFix1[31] = LOBYTE(HIWORD((DWORD) CurrentWeather));
	WindCloudFix1[32] = HIBYTE(HIWORD((DWORD) CurrentWeather));
	WindCloudFix1[35] = LOBYTE(LOWORD((DWORD) Address69A044));
	WindCloudFix1[36] = HIBYTE(LOWORD((DWORD) Address69A044));
	WindCloudFix1[37] = LOBYTE(HIWORD((DWORD) Address69A044));
	WindCloudFix1[38] = HIBYTE(HIWORD((DWORD) Address69A044));
	WindCloudFix1[41] = LOBYTE(LOWORD((DWORD) HourElapsed));
	WindCloudFix1[42] = HIBYTE(LOWORD((DWORD) HourElapsed));
	WindCloudFix1[43] = LOBYTE(HIWORD((DWORD) HourElapsed));
	WindCloudFix1[44] = HIBYTE(HIWORD((DWORD) HourElapsed));
	long relJumpDist5 =  (((DWORD) WindCloudFix1Install)+6) - (((DWORD) WindCloudFix1)+61);
	WindCloudFix1[57] = LOBYTE(LOWORD(relJumpDist5));
	WindCloudFix1[58] = HIBYTE(LOWORD(relJumpDist5));
	WindCloudFix1[59] = LOBYTE(HIWORD(relJumpDist5));
	WindCloudFix1[60] = HIBYTE(HIWORD(relJumpDist5));
	long relJumpDist6 =  ((DWORD) WindCloudFix1) - (((DWORD) WindCloudFix1Install)+5);
	WindCloudFix1Inst[1] = LOBYTE(LOWORD(relJumpDist6));
	WindCloudFix1Inst[2] = HIBYTE(LOWORD(relJumpDist6));
	WindCloudFix1Inst[3] = LOBYTE(HIWORD(relJumpDist6));
	WindCloudFix1Inst[4] = HIBYTE(HIWORD(relJumpDist6));
	VirtualProtect(WindCloudFix1Install, sizeof(WindCloudFix1Inst), PAGE_READWRITE, &protect1);
	memcpy(WindCloudFix1Install, &WindCloudFix1Inst, sizeof(WindCloudFix1Inst));
	VirtualProtect(WindCloudFix1Install, sizeof(WindCloudFix1Inst), protect1, &protect2);

	WindCloudFix2[3] = LOBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	WindCloudFix2[4] = HIBYTE(LOWORD((DWORD) VC_WeatherPointerAddr));
	WindCloudFix2[5] = LOBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	WindCloudFix2[6] = HIBYTE(HIWORD((DWORD) VC_WeatherPointerAddr));
	WindCloudFix2[13] = LOBYTE(LOWORD((DWORD) NextWeather));
	WindCloudFix2[14] = HIBYTE(LOWORD((DWORD) NextWeather));
	WindCloudFix2[15] = LOBYTE(HIWORD((DWORD) NextWeather));
	WindCloudFix2[16] = HIBYTE(HIWORD((DWORD) NextWeather));
	WindCloudFix2[22] = LOBYTE(LOWORD((DWORD) HourElapsed));
	WindCloudFix2[23] = HIBYTE(LOWORD((DWORD) HourElapsed));
	WindCloudFix2[24] = LOBYTE(HIWORD((DWORD) HourElapsed));
	WindCloudFix2[25] = HIBYTE(HIWORD((DWORD) HourElapsed));
	WindCloudFix2[29] = LOBYTE(LOWORD((DWORD) CurrentWeather));
	WindCloudFix2[30] = HIBYTE(LOWORD((DWORD) CurrentWeather));
	WindCloudFix2[31] = LOBYTE(HIWORD((DWORD) CurrentWeather));
	WindCloudFix2[32] = HIBYTE(HIWORD((DWORD) CurrentWeather));
	WindCloudFix2[35] = LOBYTE(LOWORD((DWORD) Address69A044));
	WindCloudFix2[36] = HIBYTE(LOWORD((DWORD) Address69A044));
	WindCloudFix2[37] = LOBYTE(HIWORD((DWORD) Address69A044));
	WindCloudFix2[38] = HIBYTE(HIWORD((DWORD) Address69A044));
	WindCloudFix2[41] = LOBYTE(LOWORD((DWORD) HourElapsed));
	WindCloudFix2[42] = HIBYTE(LOWORD((DWORD) HourElapsed));
	WindCloudFix2[43] = LOBYTE(HIWORD((DWORD) HourElapsed));
	WindCloudFix2[44] = HIBYTE(HIWORD((DWORD) HourElapsed));
	long relJumpDist7 =  (((DWORD) WindCloudFix2Install)+6) - (((DWORD) WindCloudFix2)+61);
	WindCloudFix2[57] = LOBYTE(LOWORD(relJumpDist7));
	WindCloudFix2[58] = HIBYTE(LOWORD(relJumpDist7));
	WindCloudFix2[59] = LOBYTE(HIWORD(relJumpDist7));
	WindCloudFix2[60] = HIBYTE(HIWORD(relJumpDist7));
	long relJumpDist8 =  ((DWORD) WindCloudFix2) - (((DWORD) WindCloudFix2Install)+5);
	WindCloudFix2Inst[1] = LOBYTE(LOWORD(relJumpDist8));
	WindCloudFix2Inst[2] = HIBYTE(LOWORD(relJumpDist8));
	WindCloudFix2Inst[3] = LOBYTE(HIWORD(relJumpDist8));
	WindCloudFix2Inst[4] = HIBYTE(HIWORD(relJumpDist8));
	VirtualProtect(WindCloudFix2Install, sizeof(WindCloudFix2Inst), PAGE_READWRITE, &protect1);
	memcpy(WindCloudFix2Install, &WindCloudFix2Inst, sizeof(WindCloudFix2Inst));
	VirtualProtect(WindCloudFix2Install, sizeof(WindCloudFix2Inst), protect1, &protect2);
}

//***********************************************
//THE DLL STUFF
//***********************************************
void AdjustAdresses();
void ReadConfigFile();


void Initialization()
{
	DWORD *Pointer = (DWORD *) 0x6DFFF1;

	AdjustAdresses();

	ReadConfigFile();

	InstallWeatherControl();
	InstallTintActivation();
	InstallMiscWeatherStuff();
	InstallRainbowHandling();
	InstallHurricanes();
}

BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
	DWORD *Pointer = (DWORD *) 0x6DFFF2;
    switch( ul_reason_for_call ) 
    { 
        case DLL_PROCESS_ATTACH:
			DisableThreadLibraryCalls((HMODULE) hModule);
			Initialization();
            break;

        case DLL_THREAD_ATTACH:
            break;

        case DLL_THREAD_DETACH:
            break;

        case DLL_PROCESS_DETACH:
            break;
    }

    return TRUE;
}


//used below
int valuesAssigned = 0;
int lineType = 1, lineCount = 0, weatherIndex = 0;
WORD weatherTemp[12];

char line[255];
BYTE globalTemp[4];		
BYTE hC = 0; //hourCounter

void ReadConfigFile()
{
	int counter = 0;
	void* gtaDirAddr = (DWORD *) 0x68BD50;
	const char *gtaDir = (const char*) gtaDirAddr;
	const char *cfgFile = "vc_weather.cfg";
	char cfgFileFullPath[256];
	strcpy (cfgFileFullPath, gtaDir);
	strcat(cfgFileFullPath, cfgFile);

	PRECIPITATIONDATA tempPrecip;
	float tempFloat[3];
	BYTE tempSnow[4];
	DWORD protect1, protect2;

	FILE* config = fopen(cfgFileFullPath, "r");
	if (config)	// If it opened alright...
	{
		while (fgets(line, 255, config))	// While we're still reading lines...
		{
			if ((line[0] != '#') && (line[0] != 0))		// If this line isn't a comment...
			{
				switch (lineType)
				{
					case 1:						
						//DO NOT FORGET TO ADJUST valuesAssigned CHECK BELOW
						valuesAssigned = sscanf(line, "%d %d %d %d", &globalTemp[0], &globalTemp[1], 
											&globalTemp[2], &globalTemp[3]);
						if (valuesAssigned == 4)
						{
							VC_WeatherGlobalData.weatherGenerationType = globalTemp[0];
							VC_WeatherGlobalData.defaultWeatherTable = globalTemp[1];
							VC_WeatherGlobalData.activateTint = globalTemp[2];
							VC_WeatherGlobalData.initialWeatherState = globalTemp[3];
							lineType = 2;
						}						
						break;
					case 2:
						//DO NOT FORGET TO ADJUST valuesAssigned CHECK BELOW
						if (lineCount != 5)
						{
							valuesAssigned = sscanf(line, "%d %d %d %d %d %d %d %d %d %d %d %d", &weatherTemp[0],
												&weatherTemp[1], &weatherTemp[2], &weatherTemp[3], &weatherTemp[4], 
												&weatherTemp[5], &weatherTemp[6], &weatherTemp[7], &weatherTemp[8], 
												&weatherTemp[9], &weatherTemp[10], &weatherTemp[11]);
							if (valuesAssigned == 12) 
							{
								for (int i = 0; i < 12; i++)
								{
									weatherTable1[weatherIndex+i] = weatherTemp[i];
								}
								weatherIndex += 12;
								lineCount++;
							}						
						}
						else
						{
							valuesAssigned = sscanf(line, "%d %d %d %d", &weatherTemp[0], &weatherTemp[1], +
												&weatherTemp[2], &weatherTemp[3]);
							if (valuesAssigned == 4) 
							{
								for (int i = 0; i < 4; i++)
								{
									weatherTable1[weatherIndex+i] = weatherTemp[i];
								}
								weatherIndex = 0;
								lineCount = 0;
								VC_WeatherGlobalData.weatherTable1Ptr = (DWORD) weatherTable1;
								lineType = 3;
							}						
						}
						break;
					case 3:
						//DO NOT FORGET TO ADJUST valuesAssigned CHECK BELOW
						if (lineCount != 5)
						{
							valuesAssigned = sscanf(line, "%d %d %d %d %d %d %d %d %d %d %d %d", &weatherTemp[0],
												&weatherTemp[1], &weatherTemp[2], &weatherTemp[3], &weatherTemp[4], 
												&weatherTemp[5], &weatherTemp[6], &weatherTemp[7], &weatherTemp[8], 
												&weatherTemp[9], &weatherTemp[10], &weatherTemp[11]);
							if (valuesAssigned == 12) 
							{
								for (int i = 0; i < 12; i++)
								{
									weatherTable2[weatherIndex+i] = weatherTemp[i];
								}
								weatherIndex += 12;
								lineCount++;
								//lineType = 5;
							}						
						}
						else
						{
							//DO NOT FORGET TO ADJUST valuesAssigned CHECK BELOW
							valuesAssigned = sscanf(line, "%d %d %d %d", &weatherTemp[0], &weatherTemp[1], +
												&weatherTemp[2], &weatherTemp[3]);
							if (valuesAssigned == 4) 
							{
								for (int i = 0; i < 4; i++)
								{
									weatherTable2[weatherIndex+i] = weatherTemp[i];
								}
								weatherIndex = 0;
								lineCount = 0;
								VC_WeatherGlobalData.weatherTable2Ptr = (DWORD) weatherTable2;
								counter = 0;
								lineType = 4;
							}						
						}
						break;
					case 4:						
						//DO NOT FORGET TO ADJUST valuesAssigned CHECK BELOW
						valuesAssigned = sscanf(line, "%i %f %f %f %f %f %f %f %f %f %f %f %f", &tempPrecip.worldRainSpawnFreq, 
											&tempPrecip.worldRainSize, &tempPrecip.worldRainDropDistance, 
											&tempPrecip.worldRainDespawnAdder, &tempPrecip.worldRainDropHeight, 
											&tempPrecip.camRainDropSpeedMultiplier, &tempPrecip.worldRainSpawnDistMod,
											&tempPrecip.worldRainSpawnSpeedTresh, &tempPrecip.worldRainScale,
											&tempPrecip.worldRainSpeedInfluence, &tempPrecip.worldRainDispersion,
											&tempPrecip.streetReflections, &tempPrecip.surfaceGrip);
						if (valuesAssigned == 13) 
						{
							counter++;
							if (counter == 1) 
							{
								VC_WeatherGlobalData.weather02Data->worldRainSpawnFreq = tempPrecip.worldRainSpawnFreq;
								VC_WeatherGlobalData.weather02Data->worldRainSize = tempPrecip.worldRainSize;
								VC_WeatherGlobalData.weather02Data->worldRainDropDistance = tempPrecip.worldRainDropDistance;
								VC_WeatherGlobalData.weather02Data->worldRainDespawnAdder = tempPrecip.worldRainDespawnAdder;
								VC_WeatherGlobalData.weather02Data->worldRainDropHeight = tempPrecip.worldRainDropHeight;
								VC_WeatherGlobalData.weather02Data->camRainDropSpeedMultiplier = tempPrecip.camRainDropSpeedMultiplier;
								VC_WeatherGlobalData.weather02Data->worldRainSpawnDistMod = tempPrecip.worldRainSpawnDistMod;
								VC_WeatherGlobalData.weather02Data->worldRainSpawnSpeedTresh = tempPrecip.worldRainSpawnSpeedTresh;
								VC_WeatherGlobalData.weather02Data->worldRainScale = tempPrecip.worldRainScale;
								VC_WeatherGlobalData.weather02Data->worldRainSpeedInfluence = tempPrecip.worldRainSpeedInfluence;
								VC_WeatherGlobalData.weather02Data->worldRainDispersion = tempPrecip.worldRainDispersion;
								VC_WeatherGlobalData.weather02Data->streetReflections = tempPrecip.streetReflections;
								VC_WeatherGlobalData.weather02Data->surfaceGrip = tempPrecip.surfaceGrip;
								
								VC_WeatherGlobalData.weather02Data->worldRainDespawnTime1 += VC_WeatherGlobalData.weather02Data->worldRainDespawnAdder;
								VC_WeatherGlobalData.weather02Data->worldRainDespawnTime2 += VC_WeatherGlobalData.weather02Data->worldRainDespawnAdder;
							}
							if (counter == 2) 
							{
								VC_WeatherGlobalData.weather05Data->worldRainSpawnFreq = tempPrecip.worldRainSpawnFreq;
								VC_WeatherGlobalData.weather05Data->worldRainSize = tempPrecip.worldRainSize;
								VC_WeatherGlobalData.weather05Data->worldRainDropDistance = tempPrecip.worldRainDropDistance;
								VC_WeatherGlobalData.weather05Data->worldRainDespawnAdder = tempPrecip.worldRainDespawnAdder;
								VC_WeatherGlobalData.weather05Data->worldRainDropHeight = tempPrecip.worldRainDropHeight;
								VC_WeatherGlobalData.weather05Data->camRainDropSpeedMultiplier = tempPrecip.camRainDropSpeedMultiplier;
								VC_WeatherGlobalData.weather05Data->worldRainSpawnDistMod = tempPrecip.worldRainSpawnDistMod;
								VC_WeatherGlobalData.weather05Data->worldRainSpawnSpeedTresh = tempPrecip.worldRainSpawnSpeedTresh;
								VC_WeatherGlobalData.weather05Data->worldRainScale = tempPrecip.worldRainScale;
								VC_WeatherGlobalData.weather05Data->worldRainSpeedInfluence = tempPrecip.worldRainSpeedInfluence;
								VC_WeatherGlobalData.weather05Data->worldRainDispersion = tempPrecip.worldRainDispersion;
								VC_WeatherGlobalData.weather05Data->streetReflections = tempPrecip.streetReflections;
								VC_WeatherGlobalData.weather05Data->surfaceGrip = tempPrecip.surfaceGrip;

								VC_WeatherGlobalData.weather05Data->worldRainDespawnTime1 += VC_WeatherGlobalData.weather05Data->worldRainDespawnAdder;
								VC_WeatherGlobalData.weather05Data->worldRainDespawnTime2 += VC_WeatherGlobalData.weather05Data->worldRainDespawnAdder;

								counter = 0;
								lineType = 5;
							}							
						}	
						break;
					case 5:
						//DO NOT FORGET TO ADJUST valuesAssigned CHECK BELOW
						valuesAssigned = sscanf(line, "%f %f %f", &tempFloat[0], &tempFloat[1], &tempFloat[2]);
						if (valuesAssigned == 3) 
						{
							windIntensityTable[lineCount] = tempFloat[0];
							windTreeFixTable[lineCount] = tempFloat[1];
							windCloudFixTable[lineCount] = tempFloat[2];
							lineCount++;
							if (lineCount == 7) 
							{
								lineCount = 0;								
								VirtualProtect(WindTableBase, sizeof(windIntensityTable), PAGE_READWRITE, &protect1);
								memcpy(WindTableBase, &windIntensityTable, sizeof(windIntensityTable));
								VirtualProtect(WindTableBase, sizeof(windIntensityTable), protect1, &protect2);
								lineType = 6;
							}
						}	
						break;
					case 6:
						//DO NOT FORGET TO ADJUST valuesAssigned CHECK BELOW
						valuesAssigned = sscanf(line, "%i %i %i %i", &tempSnow[0], &tempSnow[1], &tempSnow[2], 
													&tempSnow[3]);
						if (valuesAssigned == 4) 
						{
							VC_WeatherGlobalData.useVC_Snow = tempSnow[0];
							VC_WeatherGlobalData.snowR = tempSnow[1];
							VC_WeatherGlobalData.snowG = tempSnow[2];
							VC_WeatherGlobalData.snowB = tempSnow[3];
							VC_WeatherGlobalData.snowMaterial->ambR = ((float) VC_WeatherGlobalData.snowR) / 255.0f;
							VC_WeatherGlobalData.snowMaterial->ambG = ((float) VC_WeatherGlobalData.snowG) / 255.0f;
							VC_WeatherGlobalData.snowMaterial->ambB = ((float) VC_WeatherGlobalData.snowB) / 255.0f;

							lineType = 7;
						}	
						break;
					case 7:
						//DO NOT FORGET TO ADJUST valuesAssigned CHECK BELOW
						valuesAssigned = sscanf(line, "%i %i", &tempSnow[0], &tempSnow[1]);
						if (valuesAssigned == 2) 
						{
							VC_WeatherGlobalData.rainbowStart = tempSnow[0];
							VC_WeatherGlobalData.rainbowEnd = tempSnow[1];
							lineType = 8;
						}	
						break;
					case 8:
						//DO NOT FORGET TO ADJUST valuesAssigned CHECK BELOW
						valuesAssigned = sscanf(line, "%i %i", &weatherTemp[0], &weatherTemp[1]);
						if (valuesAssigned == 2) 
						{
							for (int i = 0; i < 2; i++)
							{
								weatherDurations[lineCount][i] = (BYTE) weatherTemp[i];
							}
							lineCount++;
							if (lineCount == 6) 
							{
								lineCount = 0;
								VC_WeatherGlobalData.weatherDurationsPtr = (DWORD) weatherDurations;
								lineType = 9;
							}
						}	
						break;
					case 9:						
						//DO NOT FORGET TO ADJUST valuesAssigned CHECK BELOW
						valuesAssigned = sscanf(line, "%i %i %i %i %i %i", &weatherTemp[0], &weatherTemp[1],
											&weatherTemp[2], &weatherTemp[3], &weatherTemp[4], &weatherTemp[5]);
						if (valuesAssigned == 6) 
						{
							for (int i = 0; i < 6; i++)
							{
								weatherProbs[lineCount][i] = weatherTemp[i];
							}
							lineCount++;
							if (lineCount == 6) 
							{
								lineCount = 0;
								VC_WeatherGlobalData.weatherProbsPtr = (DWORD) weatherProbs;
								lineType = 10;
							}
						}			
						break;
					case 10:						
						//DO NOT FORGET TO ADJUST valuesAssigned CHECK BELOW
						valuesAssigned = sscanf(line, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", 
												&tintRed[hC][0], &tintGreen[hC][0], &tintBlue[hC][0], &tintAlpha[hC][0], 
												&tintRed[hC][1], &tintGreen[hC][1], &tintBlue[hC][1], &tintAlpha[hC][1], 
												&tintRed[hC][2], &tintGreen[hC][2], &tintBlue[hC][2], &tintAlpha[hC][2], 
												&tintRed[hC][3], &tintGreen[hC][3], &tintBlue[hC][3], &tintAlpha[hC][3], 
												&tintRed[hC][4], &tintGreen[hC][4], &tintBlue[hC][4], &tintAlpha[hC][4], 
												&tintRed[hC][5], &tintGreen[hC][5], &tintBlue[hC][5], &tintAlpha[hC][5],
												&tintRed[hC][6], &tintGreen[hC][6], &tintBlue[hC][6], &tintAlpha[hC][6]);
						if (valuesAssigned == 28) 
						{
							hC++;
							if (hC == 24) 
							{
								VC_WeatherGlobalData.tintRedPtr = (DWORD) tintRed;
								VC_WeatherGlobalData.tintGreenPtr = (DWORD) tintGreen;
								VC_WeatherGlobalData.tintBluePtr = (DWORD) tintBlue;
								VC_WeatherGlobalData.tintAlphaPtr = (DWORD) tintAlpha;
								lineType = 11;
							}
						}
						break;
				}
			}
		}
		fclose(config);	
	}


	BYTE GlobalData[4] =	{0x00, 0x00, 0x00, 0x00};
	GlobalData[0] = LOBYTE(LOWORD((DWORD) &VC_WeatherGlobalData));
	GlobalData[1] = HIBYTE(LOWORD((DWORD) &VC_WeatherGlobalData));
	GlobalData[2] = LOBYTE(HIWORD((DWORD) &VC_WeatherGlobalData));
	GlobalData[3] = HIBYTE(HIWORD((DWORD) &VC_WeatherGlobalData));
	VirtualProtect(VC_WeatherPointerAddr, sizeof(GlobalData), PAGE_READWRITE, &protect1);
	memcpy(VC_WeatherPointerAddr, &GlobalData, sizeof(GlobalData));
	VirtualProtect(VC_WeatherPointerAddr, sizeof(GlobalData), protect1, &protect2);

}


void AdjustAdresses()
{

	enum VersionID {
		verUnknown, 
		verGTAVC_US_10,
		verGTAVC_US_11,
		verGTAVC_AUS_10,
		verGTAVC_GER_10,
		verGTAVC_GER_11} versionID;

	HINSTANCE hVCVersion;
	HANDLE currentProcess = GetCurrentProcess();

	typedef VersionID (WINAPI *DETECTVERSIONPROC) (HANDLE);
	DETECTVERSIONPROC DetectVersion;
	typedef DWORD (WINAPI *ADJUSTOFFSETPROC) (DWORD,VersionID);
	ADJUSTOFFSETPROC AdjustOffset;

	//OutputDebugString("Loading VCVersion...");
	hVCVersion = LoadLibrary("vcversion.dll");
	if (hVCVersion != NULL)
	{
		//OutputDebugString("VCVersion loaded");
		DetectVersion = (DETECTVERSIONPROC) GetProcAddress(hVCVersion, "DetectVersion");
		if (DetectVersion != NULL)
		{
			versionID = DetectVersion(currentProcess);
			//char message[64];
			//sprintf(message, "VersionID is: %d", versionID);
			//OutputDebugString(message);

			AdjustOffset = (ADJUSTOFFSETPROC) GetProcAddress(hVCVersion, "AdjustOffset");
			if (AdjustOffset != NULL)
			{
				//GLOBALS
				//VC_WeatherPointerAddr			= (DWORD*) AdjustOffset((DWORD) VC_WeatherPointerAddr, versionID);
				PtrToPlayer						= (DWORD*) AdjustOffset((DWORD) PtrToPlayer, versionID);
				UseAlternateWeatherTable		= (DWORD*) AdjustOffset((DWORD) UseAlternateWeatherTable, versionID);
				WeatherTableIndex				= (DWORD*) AdjustOffset((DWORD) WeatherTableIndex, versionID);
				NextWeather						= (DWORD*) AdjustOffset((DWORD) NextWeather, versionID);
				CurrentWeather					= (DWORD*) AdjustOffset((DWORD) CurrentWeather, versionID);
				D3DDevicePtr					= (DWORD*) AdjustOffset((DWORD) D3DDevicePtr, versionID);
				WindTableBase					= (DWORD*) AdjustOffset((DWORD) WindTableBase, versionID);
				IngameTimerInMS					= (DWORD*) AdjustOffset((DWORD) IngameTimerInMS, versionID);
				StandardMaterial				= (DWORD*) AdjustOffset((DWORD) StandardMaterial, versionID);
				CamPosBase						= (DWORD*) AdjustOffset((DWORD) CamPosBase, versionID);
				HourElapsed						= (DWORD*) AdjustOffset((DWORD) HourElapsed, versionID);


				RandomNumberCallDest			= (DWORD*) AdjustOffset((DWORD) RandomNumberCallDest, versionID);
				GetPlayerCallDest				= (DWORD*) AdjustOffset((DWORD) GetPlayerCallDest, versionID);
				CalcCurTimeCycValueCallDest		= (DWORD*) AdjustOffset((DWORD) CalcCurTimeCycValueCallDest, versionID);
				RenderParticlesCallDest			= (DWORD*) AdjustOffset((DWORD) RenderParticlesCallDest, versionID);
				ChangeRenderStateSetupCallDest	= (DWORD*) AdjustOffset((DWORD) ChangeRenderStateSetupCallDest, versionID);
				RenderRectangleCallDest			= (DWORD*) AdjustOffset((DWORD) RenderRectangleCallDest, versionID);
				CreateParticleProc				= (DWORD*) AdjustOffset((DWORD) CreateParticleProc, versionID);
				CreateParticleWrapperProc		= (DWORD*) AdjustOffset((DWORD) CreateParticleWrapperProc, versionID);
				RWSetRenderStateProc			= (DWORD*) AdjustOffset((DWORD) RWSetRenderStateProc, versionID);
				
				//WEATHER CONTROL
				WeatherTable1Install			= (DWORD*) AdjustOffset((DWORD) WeatherTable1Install, versionID);
				WeatherTable2Install			= (DWORD*) AdjustOffset((DWORD) WeatherTable2Install, versionID);
				InitCurWeatherInstall			= (DWORD*) AdjustOffset((DWORD) InitCurWeatherInstall, versionID);
				InitNextWeatherInstall			= (DWORD*) AdjustOffset((DWORD) InitNextWeatherInstall, versionID);
				DefaultWeatherTableInstall		= (DWORD*) AdjustOffset((DWORD) DefaultWeatherTableInstall, versionID);
				RandomWeatherInstall			= (DWORD*) AdjustOffset((DWORD) RandomWeatherInstall, versionID);
				
				//TINT ACTIVATION
				CalcCurrentTintInstall			= (DWORD*) AdjustOffset((DWORD) CalcCurrentTintInstall, versionID);
				RenderTintInstall				= (DWORD*) AdjustOffset((DWORD) RenderTintInstall, versionID);
				SomeAddress						= (DWORD*) AdjustOffset((DWORD) SomeAddress, versionID);
				ResolutionX						= (DWORD*) AdjustOffset((DWORD) ResolutionX, versionID);
				ResolutionY						= (DWORD*) AdjustOffset((DWORD) ResolutionY, versionID);
				
				//MISC WEATHER STUFF (incl. VC:SNOW)
				//WorldRainSpawnFreq			= (DWORD*) AdjustOffset((DWORD) WorldRainSpawnFreq, versionID);
				//WorldRainSize					= (DWORD*) AdjustOffset((DWORD) WorldRainSize, versionID);
				//WorldRainSpeed				= (DWORD*) AdjustOffset((DWORD) WorldRainSpeed, versionID);
				WorldRainSpawnTime1				= (DWORD*) AdjustOffset((DWORD) WorldRainSpawnTime1, versionID);
				WorldRainSpawnTime2				= (DWORD*) AdjustOffset((DWORD) WorldRainSpawnTime2, versionID);
				WorldRainDropHeight				= (DWORD*) AdjustOffset((DWORD) WorldRainDropHeight, versionID);
				//CamRainSpeedInstall			= (DWORD*) AdjustOffset((DWORD) CamRainSpeedInstall, versionID);
				WorldRainSpawnDistModInstall	= (DWORD*) AdjustOffset((DWORD) WorldRainSpawnDistModInstall, versionID);
				WorldRainSpawnSpeedThreshInstall= (DWORD*) AdjustOffset((DWORD) WorldRainSpawnSpeedThreshInstall, versionID);
				WorldRainSizeInstall			= (DWORD*) AdjustOffset((DWORD) WorldRainSizeInstall, versionID);
				//IngameFrameTimeIn20Ms_60MsMax	= (DWORD*) AdjustOffset((DWORD) IngameFrameTimeIn20Ms_60MsMax, versionID);
				
				Boat7_8OverrideInstall			= (DWORD*) AdjustOffset((DWORD) Boat7_8OverrideInstall, versionID);
				Set3DSnowTextureInstall			= (DWORD*) AdjustOffset((DWORD) Set3DSnowTextureInstall, versionID);
				Light3DSnowInstall				= (DWORD*) AdjustOffset((DWORD) Light3DSnowInstall, versionID);
				AssortedPrecipDataInstall		= (DWORD*) AdjustOffset((DWORD) AssortedPrecipDataInstall, versionID);
				Freq_Speed3DRainInstall			= (DWORD*) AdjustOffset((DWORD) Freq_Speed3DRainInstall, versionID);
				PrevSpeed3DRainBlankerInstall	= (DWORD*) AdjustOffset((DWORD) PrevSpeed3DRainBlankerInstall, versionID);
				Size3DRainInstall				= (DWORD*) AdjustOffset((DWORD) Size3DRainInstall, versionID);
				RainSplashSkip1Install			= (DWORD*) AdjustOffset((DWORD) RainSplashSkip1Install, versionID);
				RainSplashSkip2Install			= (DWORD*) AdjustOffset((DWORD) RainSplashSkip2Install, versionID);
				RainSplashSkip3Install			= (DWORD*) AdjustOffset((DWORD) RainSplashSkip3Install, versionID);
				Rain2DSkipInstall				= (DWORD*) AdjustOffset((DWORD) Rain2DSkipInstall, versionID);
				Rain2DSkipJump					= (DWORD*) AdjustOffset((DWORD) Rain2DSkipJump, versionID);
				RainSoundSkip1Install			= (DWORD*) AdjustOffset((DWORD) RainSoundSkip1Install, versionID);
				RainSoundSkip1Jump				= (DWORD*) AdjustOffset((DWORD) RainSoundSkip1Jump, versionID);
				RainSoundSkip2Install			= (DWORD*) AdjustOffset((DWORD) RainSoundSkip2Install, versionID);
				RainSoundSkip2Jump				= (DWORD*) AdjustOffset((DWORD) RainSoundSkip2Jump, versionID);
				ZDeviationInstall				= (DWORD*) AdjustOffset((DWORD) ZDeviationInstall, versionID);
				Rain3DSpawnFix1Install			= (DWORD*) AdjustOffset((DWORD) Rain3DSpawnFix1Install, versionID);
				Rain3DSpawnFix2Install			= (DWORD*) AdjustOffset((DWORD) Rain3DSpawnFix2Install, versionID);
				Rain3DScaleInstall				= (DWORD*) AdjustOffset((DWORD) Rain3DScaleInstall, versionID);
				Rain3DMatFixInstall				= (DWORD*) AdjustOffset((DWORD) Rain3DMatFixInstall, versionID);
				GripFXInstall					= (DWORD*) AdjustOffset((DWORD) GripFXInstall, versionID);
				ReflectFXInstall				= (DWORD*) AdjustOffset((DWORD) ReflectFXInstall, versionID);
				UndoBoatOverrideInstall			= (DWORD*) AdjustOffset((DWORD) UndoBoatOverrideInstall, versionID);
				GroundSteamFixInstall			= (DWORD*) AdjustOffset((DWORD) GroundSteamFixInstall, versionID);
				CarDebrisString					= (DWORD*) AdjustOffset((DWORD) CarDebrisString, versionID);
				BoatTextureBase					= (DWORD*) AdjustOffset((DWORD) BoatTextureBase, versionID);
				RainDropTexturePtr				= (DWORD*) AdjustOffset((DWORD) RainDropTexturePtr, versionID);
				SomeProc						= (DWORD*) AdjustOffset((DWORD) SomeProc, versionID);
				DesiredReturnAddress			= (DWORD*) AdjustOffset((DWORD) DesiredReturnAddress, versionID);
				SomeAddress3DRain				= (DWORD*) AdjustOffset((DWORD) SomeAddress3DRain, versionID);
				SomeProc2						= (DWORD*) AdjustOffset((DWORD) SomeProc2, versionID);
				DeviationConstant				= (DWORD*) AdjustOffset((DWORD) DeviationConstant, versionID);
				Rain3DZPos						= (DWORD*) AdjustOffset((DWORD) Rain3DZPos, versionID);
				Address69D3D4					= (DWORD*) AdjustOffset((DWORD) Address69D3D4, versionID);
				Address699FF0					= (DWORD*) AdjustOffset((DWORD) Address699FF0, versionID);
				Rain3DWidth						= (DWORD*) AdjustOffset((DWORD) Rain3DWidth, versionID);
				Rain3DHeight					= (DWORD*) AdjustOffset((DWORD) Rain3DHeight, versionID);
				SomeProc3						= (DWORD*) AdjustOffset((DWORD) SomeProc3, versionID);
				RoadWetness						= (DWORD*) AdjustOffset((DWORD) RoadWetness, versionID);
				ActivateSteam					= (DWORD*) AdjustOffset((DWORD) ActivateSteam, versionID);

				//RAINBOWS
				RainbowTime1Install				= (DWORD*) AdjustOffset((DWORD) RainbowTime1Install, versionID);
				RainbowTime2Install				= (DWORD*) AdjustOffset((DWORD) RainbowTime2Install, versionID);

				//WINDS/HURRICANE WEATHER (builds on wind function above)
				WindTreeFix1Install				= (DWORD*) AdjustOffset((DWORD) WindTreeFix1Install, versionID);
				WindTreeFix2Install				= (DWORD*) AdjustOffset((DWORD) WindTreeFix2Install, versionID);
				WindCloudFix1Install			= (DWORD*) AdjustOffset((DWORD) WindCloudFix1Install, versionID);
				WindCloudFix2Install			= (DWORD*) AdjustOffset((DWORD) WindCloudFix2Install, versionID);
				Address69A044					= (DWORD*) AdjustOffset((DWORD) Address69A044, versionID);

			}
			else OutputDebugString("VCVersion::AdjustOffset() not correctly loaded");

		}
		else OutputDebugString("VCVersion::DetectVersion() not correctly loaded");

		FreeLibrary(hVCVersion);
	}
	else OutputDebugString("VCVersion not correctly loaded");
}