}\r
}\r
}\r
+\r
+void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vector rgb, float a, float drawflag)\r
+{\r
+ float x, y, q, d;\r
+ vector ringsize, v, t;\r
+ ringsize = radius * '1 1 0';\r
+\r
+ x = cos(f * 2 * M_PI);\r
+ y = sin(f * 2 * M_PI);\r
+ q = fabs(x) + fabs(y);\r
+ x /= q;\r
+ y /= q;\r
+\r
+ if(f >= 1)\r
+ {\r
+ // draw full rectangle\r
+ R_BeginPolygon(pic, drawflag);\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_x += 0.5 * ringsize_x; t += '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_y += 0.5 * ringsize_y; t += '0.5 -0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_x -= 0.5 * ringsize_x; t -= '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_y -= 0.5 * ringsize_y; t -= '0.5 -0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+ R_EndPolygon();\r
+\r
+ d = q - 1;\r
+ if(d > 0)\r
+ {\r
+ R_BeginPolygon(pic, drawflag);\r
+ v = centre; t = '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_x += 0.5 * ringsize_x; t += '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+ }\r
+ }\r
+ else if(f > 0.75)\r
+ {\r
+ // draw upper and first triangle\r
+ R_BeginPolygon(pic, drawflag);\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_x += 0.5 * ringsize_x; t += '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_y += 0.5 * ringsize_y; t += '0.5 -0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_x -= 0.5 * ringsize_x; t -= '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+ R_EndPolygon();\r
+ R_BeginPolygon(pic, drawflag);\r
+ v = centre; t = '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_x -= 0.5 * ringsize_x; t -= '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_y -= 0.5 * ringsize_y; t -= '0.5 -0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ d = q - 0.75;\r
+ if(d <= 0)\r
+ R_EndPolygon();\r
+ }\r
+ else if(f > 0.5)\r
+ {\r
+ // draw upper triangle\r
+ R_BeginPolygon(pic, drawflag);\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_x += 0.5 * ringsize_x; t += '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_y += 0.5 * ringsize_y; t += '0.5 -0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_x -= 0.5 * ringsize_x; t -= '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+ R_EndPolygon();\r
+\r
+ d = q - 0.5;\r
+ if(d > 0)\r
+ {\r
+ R_BeginPolygon(pic, drawflag);\r
+ v = centre; t = '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_x -= 0.5 * ringsize_x; t -= '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+ }\r
+ }\r
+ else if(f > 0.25)\r
+ {\r
+ // draw first triangle\r
+ R_BeginPolygon(pic, drawflag);\r
+ v = centre; t = '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_x += 0.5 * ringsize_x; t += '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_y += 0.5 * ringsize_y; t += '0.5 -0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ d = q - 0.25;\r
+ if(d <= 0)\r
+ R_EndPolygon();\r
+ }\r
+ else\r
+ {\r
+ d = q;\r
+ if(d > 0)\r
+ {\r
+ R_BeginPolygon(pic, drawflag);\r
+ v = centre; t = '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_x += 0.5 * ringsize_x; t += '0.5 0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+ }\r
+ }\r
+\r
+ if(d > 0)\r
+ {\r
+ v = centre; t = '0.5 0.5 0';\r
+ v_x += x * 0.5 * ringsize_x; t += x * '0.5 0.5 0';\r
+ v_y += y * 0.5 * ringsize_y; t += y * '0.5 -0.5 0';\r
+ R_PolygonVertex(v, t, rgb, a);\r
+ R_EndPolygon();\r
+ }\r
+}\r