// City skyline shadows in Coach's mind.
// Also Tree canopies in camp, so we cannot move them.
//
// As a general rule, we want to only move known damaged
// textures, and leave everything else untouched.  It's safer
// to do it that way, because it avoids unknown or unseen
// side effects.
//
// Shader 59
//
// Converted from 2_0 to 3_0 so we can use if_eq statement
// to skip non-skyline textures.

// [VSDEC13C78] Shader 59, city skyline, tree canopies
//
// Coach's Brain:
//  Mod:
//   C119CA38;  City skyline in distance
//   2735EC4E;  Far sky, past clouds
//   027DFA6A;  Bottom 'bowl' of skybox 
//   6445DE5C;  City street map at far bottom
//   06E679DB;  Skybox top half in airplane
//   6BC35B6A;  Skybox bottom half in airplane
//  No Mod:
//   89A5A855;  Rings on wall near trampoline
//   73671DA6;  Mines on ground
//
// Cabins:
//  No Mod:
//   AB97A5C4;  Random trees on hillsides
//   196D0136;  Tree trunks in camp
//   D84A182D;  Tree crowns in camp
//   DE8FE236;
//   E506C7FE;
//   75A13130;
//   7DC2EC8F;
//   25CFCE9E;
//   8F797E4C;
//   F3048EB2;
//   A8010F3B;
//   ED001448;
//   1BB73819;
//   DB53F4CA;
//   2A233E81;
//   1EB9A462;
//   4B8390C1;  Mountain range past lake
//   304D7202;
//   FF000000;
//   64B7226B;
//   8D7FCA28;
//   FEB6B180;
//   E10B9C65;
//   86ECFFB0;
//   83E5B2CE;
//   93F9AD36;
//   82260914; 
//   0ADF3508; 
//   7BEAC660; 
//   D0CB0AE1; 
//   44770942; 
//   A4A3A1A5; 
//   9ABD9FE4; 
//   EFC83432; 
//   53CC5E42;  Roof of main lodge


	vs_3_0

	def c200, 666, 999, 0, 8000
	def c201, 1,0,1,1	// hot pink
		
	dcl_position v0
    dcl_color v2
    dcl_texcoord v3
		
	dcl_position o0
	dcl_color o1
	dcl_fog o2
	dcl_texcoord o3.xy
		
	m4x4 r4, v0, c6
	add r4, r4, c50
		
	// At this point, r4 is the output position
	// For city skyline, it's inverted, or something.

	// Check for key which toggles effect on/off.
	mov r30.x, c250.x
	if_eq r30.x, c200.x
	
		// If texture defined in DX9Settings.ini, we do the fixup, if
		// not we skip it.  Thus we only move the vertex further out
		// for the textures specified in the ini.
		// As defined in ini, c251.x == 666 if we are supposed to fix it.
		mov r30.x, c251.x
		if_eq r30.x, c200.x
			mul r4, r4, c200.w
		endif
	endif
	
	// Send vertex, changed or not, to the output
	mov o0, r4

	// Default path, assume that we aren't going pinkify the output color
	mul o1, v2, c2

	// Check if pinking is enabled or to be skipped altogether.
	mov r30.y, c250.y
	if_eq r30.y, c200.x
	
		// If the current texture is in the Not Defined
		// list, then show it in hot-pink coloring.  We
		// can disable this coloring from the ini file, by
		// commenting out the ValNotDefined.
		mov r30, c251.x
		if_eq r30.x, c200.y
			mov o1, c201
		endif
	endif
	
	mov r11, v0
	add r7, c51, -r11
    dp3 r4.x, r7, r7
    rsq r4.x, r4.x
    rcp r4.x, r4.x
    mad r4.x, r4.x, c4.x, c4.y
    dp4 r4.y, r11, c52
    mad r4.y, r4.y, c4.z, c4.w
    min o2, r4.x, r4.y
    
	mul o3.xy, v3, c94
 