// Brain load screen backdrop
// Shader 20
//
// Also used in the Collective Unconscious as the walking circle
//
// [VSDC2DF1F9]: Shader 20, brain loading, collective unconscious backdrop
// Mod:
//  F8FF43B0;  Brain load screen backdrop

	vs_3_0
	
	def c200, 666, 999, 0, 8000
	def c201, 1,0,1,1	// hot pink

    dcl_position v0
    dcl_texcoord v3

	dcl_position o0
	dcl_color o1
	dcl_texcoord o2
	dcl_texcoord1 o3
    
    m4x4 r4, v0, c6
    add r4, r4, c50

	// At this point, r4 is the output position

	// Check for key which toggles effect on/off.
	// If it's off, skip fixing the texture so we can see it.
	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, 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
	mov o1, 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

	// Texture loads unchanged.
	mov r0, c12
    mul r0, r0, c94
    mad r0, v3, r0, c13
    mov o2.xy, r0
    mul o3.xy, r0, c5

	
	// Original code:
    // vs_2_0
    // dcl_position v0
    // dcl_normal v1
    // dcl_texcoord v3
    // mov r11, v0
    // mov r1, v1
    // m4x4 r4, v0, c6
    // add oPos, r4, c50
    // mov oD0, c2
    // mov r0, c12
    // mul r0, r0, c94
    // mad r0, v3, r0, c13
    // mov oT0.xy, r0
    // mul oT1.xy, r0, c5

	// approximately 13 instruction slots used
	