From 8bedc789ee51f9afaace46a3a3f8e200ea73afce Mon Sep 17 00:00:00 2001
From: kopareigns <kopareigns@gmail.com>
Date: Wed, 16 Jan 2019 00:12:49 -0500
Subject: [PATCH] Convert Hair_Fore.tw

---
 src/art/artJS.tw                              |  84 +++++++++++
 src/art/vector/Hair_Fore.tw                   | 131 +-----------------
 ..._Fore_Up_Med.tw => Hair_Fore_Up_Medium.tw} |   2 +-
 3 files changed, 86 insertions(+), 131 deletions(-)
 rename src/art/vector/layers/{Hair_Fore_Up_Med.tw => Hair_Fore_Up_Medium.tw} (98%)

diff --git a/src/art/artJS.tw b/src/art/artJS.tw
index 3fd402dbf3c..05b769a396c 100644
--- a/src/art/artJS.tw
+++ b/src/art/artJS.tw
@@ -2808,3 +2808,87 @@ window.ArtVectorHairBack = function(slave) {
 		r += jsInclude("Art_Vector_Cat_Ear_Back");
 	return r;
 };
+
+window.ArtVectorHairFore = function(slave) {
+	let r = "";
+	let hairLength;
+
+	if (slave.hLength >= 60)
+		hairLength = "Long";
+	else if (slave.hLength >= 30)
+		hairLength = "Medium";
+	else if (slave.hLength >= 10)
+		hairLength = "Short";
+
+	if (slave.fuckdoll !== 0 || slave.bald !== 0) {
+		r += jsInclude("Art_Vector_Hair_Fore_NoHair");
+	} else {
+		switch (slave.clothes) {
+			case "a biyelgee costume":
+			case "a burkini":
+			case "a burqa":
+			case "a chattel habit":
+			case "a cybersuit":
+			case "a fallen nuns habit":
+			case "a hijab and abaya":
+			case "a hijab and blouse":
+			case "a klan robe":
+			case "a military uniform":
+			case "a mounty outfit":
+			case "a niqab and abaya":
+			case "a penitent nuns habit":
+			case "a police uniform":
+			case "a red army uniform":
+			case "a schutzstaffel uniform":
+			case "a slutty klan robe":
+			case "a slutty nurse outfit":
+			case "a slutty schutzstaffel uniform":
+			case "battlearmor":
+			case "restrictive latex":
+			case "Western clothing":
+				break; /* do nothing */
+			default:
+				switch (slave.hStyle) {
+					case "buzzcut":
+					case "shaved":
+					case "shaved bald":
+						r += jsInclude("Art_Vector_Hair_Fore_NoHair");
+						break;
+					case "afro":
+						if (slave.hLength >= 150)
+							r += jsInclude("Art_Vector_Hair_Fore_Afro_Giant");
+						else
+							r += jsInclude(`Art_Vector_Hair_Fore_Afro_${hairLength}`);
+						break;
+					case "messy bun":
+						r += jsInclude(`Art_Vector_Hair_Fore_Ninja_${hairLength}`);
+						break;
+					case "bun":
+					case "neat":
+					case "ponytail":
+						r += jsInclude(`Art_Vector_Hair_Fore_${capFirstChar(slave.hStyle)}`);
+						break;
+					case "braided":
+					case "cornrows":
+					case "curled":
+					case "dreadlocks":
+					case "eary":
+					case "luxurious":
+					case "messy":
+					case "permed":
+					case "strip":
+					case "tails":
+					case "up":
+						if (hairLength)
+							r += jsInclude(`Art_Vector_Hair_Fore_${capFirstChar(slave.hStyle)}_${hairLength}`);
+						break;
+					default:
+						r += jsInclude("Art_Vector_Hair_Fore_Messy_Medium");
+				}
+		}
+	}
+	/* note: latex clothing actually shows some hair, but there is no appropriate art for it */
+	if (slave.collar === "cat ears")
+		r += jsInclude("Art_Vector_Cat_Ear_Fore");
+	return r;
+};
diff --git a/src/art/vector/Hair_Fore.tw b/src/art/vector/Hair_Fore.tw
index 113d3afc9c4..c99e63db3cd 100644
--- a/src/art/vector/Hair_Fore.tw
+++ b/src/art/vector/Hair_Fore.tw
@@ -1,132 +1,3 @@
 :: Art_Vector_Hair_Fore_ [nobr]
 
-/* TODO: simplify */
-<<if _artSlave.fuckdoll != 0 || _artSlave.bald != 0>>
-	<<include Art_Vector_Hair_Fore_NoHair>>
-<<else>>
-	<<if _artSlave.clothes != "restrictive latex" && _artSlave.clothes != "a hijab and abaya" && _artSlave.clothes != "a chattel habit" && _artSlave.clothes != "a fallen nuns habit" && _artSlave.clothes != "a penitent nuns habit" && _artSlave.clothes != "a cybersuit" && _artSlave.clothes != "Western clothing" && _artSlave.clothes != "a military uniform" && _artSlave.clothes != "a schutzstaffel uniform" && _artSlave.clothes != "a slutty schutzstaffel uniform" && _artSlave.clothes != "a red army uniform" && _artSlave.clothes != "battlearmor" && _artSlave.clothes != "a biyelgee costume" && _artSlave.clothes != "a mounty outfit" && _artSlave.clothes != "a slutty nurse outfit" && _artSlave.clothes != "a niqab and abaya" && _artSlave.clothes != "a burqa" && _artSlave.clothes != "a klan robe" && _artSlave.clothes != "a hijab and blouse" && _artSlave.clothes != "a burkini" && _artSlave.clothes != "a slutty klan robe" && _artSlave.clothes != "a police uniform">>
-		<<switch _artSlave.hStyle>>
-		<<case "buzzcut" "shaved" "shaved bald">>
-			<<include Art_Vector_Hair_Fore_NoHair>>
-		<<case "permed">>
-			<<if _artSlave.hLength >= 60>>
-				<<include Art_Vector_Hair_Fore_Permed_Long>>
-			<<elseif _artSlave.hLength >= 30>>
-				<<include Art_Vector_Hair_Fore_Permed_Medium>>
-			<<elseif _artSlave.hLength >= 10>>
-				<<include Art_Vector_Hair_Fore_Permed_Short>>
-			<</if>>
-		<<case "up">>
-			<<if _artSlave.hLength >= 60>>
-				<<include Art_Vector_Hair_Fore_Up_Long>>
-			<<elseif _artSlave.hLength >= 30>>
-				<<include Art_Vector_Hair_Fore_Up_Med>>
-			<<elseif _artSlave.hLength >= 10>>
-				<<include Art_Vector_Hair_Fore_Up_Short>>
-			<</if>>
-		<<case "neat">>
-			<<include Art_Vector_Hair_Fore_Neat>>
-		<<case "ponytail">>
-			<<include Art_Vector_Hair_Fore_Ponytail>>
-		<<case "bun">>
-			<<include Art_Vector_Hair_Fore_Bun>>
-		<<case "curled">>
-			<<if _artSlave.hLength >= 60>>
-				<<include Art_Vector_Hair_Fore_Curled_Long>>
-			<<elseif _artSlave.hLength >= 30>>
-				<<include Art_Vector_Hair_Fore_Curled_Medium>>
-			<<elseif _artSlave.hLength >= 10>>
-				<<include Art_Vector_Hair_Fore_Curled_Short>>
-			<</if>>
-		<<case "eary">>
-			<<if _artSlave.hLength >= 60>>
-				<<include Art_Vector_Hair_Fore_Eary_Long>>
-			<<elseif _artSlave.hLength >= 30>>
-				<<include Art_Vector_Hair_Fore_Eary_Medium>>
-			<<elseif _artSlave.hLength >= 10>>
-				<<include Art_Vector_Hair_Fore_Eary_Short>>
-			<</if>>
-		<<case "luxurious">>
-			<<if _artSlave.hLength >= 60>>
-				<<include Art_Vector_Hair_Fore_Luxurious_Long>>
-			<<elseif _artSlave.hLength >= 30>>
-				<<include Art_Vector_Hair_Fore_Luxurious_Medium>>
-			<<elseif _artSlave.hLength >= 10>>
-				<<include Art_Vector_Hair_Fore_Luxurious_Short>>
-			<</if>>
-		<<case "afro">>
-			<<if _artSlave.hLength >= 150>>
-				<<include Art_Vector_Hair_Fore_Afro_Giant>>
-			<<elseif _artSlave.hLength >= 60>>
-				<<include Art_Vector_Hair_Fore_Afro_Long>>
-			<<elseif _artSlave.hLength >= 30>>
-				<<include Art_Vector_Hair_Fore_Afro_Medium>>
-			<<elseif _artSlave.hLength >= 10>>
-				<<include Art_Vector_Hair_Fore_Afro_Short>>
-			<</if>>
-		<<case "messy">>
-			<<if _artSlave.hLength >= 60>>
-				<<include Art_Vector_Hair_Fore_Messy_Long>>
-			<<elseif _artSlave.hLength >= 30>>
-				<<include Art_Vector_Hair_Fore_Messy_Medium>>
-			<<elseif _artSlave.hLength >= 10>>
-				<<include Art_Vector_Hair_Fore_Messy_Short>>
-			<</if>>
-		<<case "dreadlocks">>
-			<<if _artSlave.hLength >= 60>>
-				<<include Art_Vector_Hair_Fore_Dreadlocks_Long>>
-			<<elseif _artSlave.hLength >= 30>>
-				<<include Art_Vector_Hair_Fore_Dreadlocks_Medium>>
-			<<elseif _artSlave.hLength >= 10>>
-				<<include Art_Vector_Hair_Fore_Dreadlocks_Short>>
-			<</if>>
-		<<case "cornrows">>
-			<<if _artSlave.hLength >= 60>>
-				<<include Art_Vector_Hair_Fore_Cornrows_Long>>
-			<<elseif _artSlave.hLength >= 30>>
-				<<include Art_Vector_Hair_Fore_Cornrows_Medium>>
-			<<elseif _artSlave.hLength >= 10>>
-				<<include Art_Vector_Hair_Fore_Cornrows_Short>>
-			<</if>>
-		<<case "braided">>
-			<<if _artSlave.hLength >= 60>>
-				<<include Art_Vector_Hair_Fore_Braided_Long>>
-			<<elseif _artSlave.hLength >= 30>>
-				<<include Art_Vector_Hair_Fore_Braided_Medium>>
-			<<elseif _artSlave.hLength >= 10>>
-				<<include Art_Vector_Hair_Fore_Braided_Short>>
-			<</if>>
-		<<case "tails">>
-			<<if _artSlave.hLength >= 60>>
-				<<include Art_Vector_Hair_Fore_Tails_Long>>
-			<<elseif _artSlave.hLength >= 30>>
-				<<include Art_Vector_Hair_Fore_Tails_Medium>>
-			<<elseif _artSlave.hLength >= 10>>
-				<<include Art_Vector_Hair_Fore_Tails_Short>>
-			<</if>>
-		<<case "strip">>
-			<<if _artSlave.hLength >= 60>>
-				<<include Art_Vector_Hair_Fore_Strip_Long>>
-			<<elseif _artSlave.hLength >= 30>>
-				<<include Art_Vector_Hair_Fore_Strip_Medium>>
-			<<elseif _artSlave.hLength >= 10>>
-				<<include Art_Vector_Hair_Fore_Strip_Short>>
-			<</if>>
-		<<case "messy bun">>
-			<<if _artSlave.hLength >= 60>>
-				<<include Art_Vector_Hair_Fore_Ninja_Long>>
-			<<elseif _artSlave.hLength >= 30>>
-				<<include Art_Vector_Hair_Fore_Ninja_Medium>>
-			<<elseif _artSlave.hLength >= 10>>
-				<<include Art_Vector_Hair_Fore_Ninja_Short>>
-			<</if>>
-		<<default>>
-			<<include Art_Vector_Hair_Fore_Messy_Medium>>
-		<</switch>>
-	<</if>>
-<</if>>
-/* note: latex clothing actually shows some hair, but there is no appropriate art for it */
-
-<<if _artSlave.collar == "cat ears">>
-	<<include Art_Vector_Cat_Ear_Fore>>
-<</if>>
\ No newline at end of file
+<<= ArtVectorHairFore(_artSlave)>>
diff --git a/src/art/vector/layers/Hair_Fore_Up_Med.tw b/src/art/vector/layers/Hair_Fore_Up_Medium.tw
similarity index 98%
rename from src/art/vector/layers/Hair_Fore_Up_Med.tw
rename to src/art/vector/layers/Hair_Fore_Up_Medium.tw
index 9686ea87982..07fedc01928 100644
--- a/src/art/vector/layers/Hair_Fore_Up_Med.tw
+++ b/src/art/vector/layers/Hair_Fore_Up_Medium.tw
@@ -1,3 +1,3 @@
-:: Art_Vector_Hair_Fore_Up_Med [nobr]
+:: Art_Vector_Hair_Fore_Up_Medium [nobr]
 
 <<print '<html><svg viewBox="0 0 560 1000" class="'+_art_display_class+'"><path d="m 262.63033,114.30711 c 0.33677,-0.20797 0.0487,51.71527 5.91031,61.18366 0.49569,0.8007 0.18476,1.43686 0.21782,1.40761 0.044,-0.0389 0.3905,-0.85171 -0.0245,-2.08965 -4.86654,-14.51683 -4.13788,-62.17393 -3.73933,-62.57241 2.22688,-2.22649 1.49231,-3.627 6.81007,-5.01625 0.62703,-0.16381 5.41628,13.8835 6.12146,13.77113 0.10895,-0.0174 0.35996,-0.30357 0.29449,-0.79776 -1.10123,-8.31224 0.79838,-15.30974 1.62411,-15.35172 0.3433,-0.0174 6.24163,2.75103 6.59145,2.74513 0.58284,-0.01 7.24794,-2.28362 7.84871,-2.25923 0.60826,0.11533 1.40489,3.11183 0.0147,14.55323 -0.0526,0.43297 0.0902,0.69301 0.17637,0.71466 0.65882,0.16561 6.99807,-12.71343 7.64282,-12.51308 7.18945,2.23413 9.69639,4.81965 15.24999,9.94873 1.63362,1.50875 -2.11462,29.15762 -10.50886,61.70738 -0.0322,0.12488 0.075,0.21548 0.12585,0.27025 1.37468,1.48077 16.87578,-48.11374 18.1457,-46.60103 2.11658,2.52119 5.15116,-0.95931 6.99189,1.46055 34.04139,-70.062712 -74.71689,-86.627596 -69.49304,-20.56119 z" class="hair" id="path4727" sodipodi:nodetypes="cssssssssscsssssssccc"/><path d="m 346.04552,95.099685 c 0.25994,1.650172 0.41643,3.24978 0.48271,4.798076 0.0703,1.642329 0.0391,3.226929 -0.0778,4.752909 -0.10615,1.38618 -0.28309,2.72399 -0.51889,4.01277 -0.0773,0.42308 -0.16115,0.84086 -0.25083,1.25334 -0.34796,1.60053 -0.78517,3.12114 -1.28714,4.56051 -0.27657,0.79306 -0.86561,2.9418 -1.4934,5.17492 -0.73573,2.61708 -1.52468,5.35002 -1.92629,6.15259 -0.62062,1.24025 0.1047,-4.11355 -0.56232,-3.03974 -0.7134,1.14854 -3.6578,15.5138 -4.36669,16.46871 -0.76588,1.03166 0.70662,-11.36337 0.0182,-10.56174 -0.54838,0.63858 -5.2898,19.6518 -5.74623,20.142 -1.31391,1.41113 1.94785,-16.24519 2.00527,-16.09762 -4.01039,-11.72216 -30.66743,-35.160001 -33.47635,-37.599102 -0.0953,-0.247601 -29.7058,15.681462 -33.06005,4.708531 -0.25209,-0.82467 -2.37632,20.466331 -2.62087,19.626151 -3.38914,-11.64347 -5.88094,-24.473915 -2.64966,-30.106714 0.65236,-1.475967 0.91868,-13.225587 1.63476,-14.599305 0.61047,-1.171114 1.66217,8.019734 2.3171,6.922668 1.65456,-2.771539 3.44828,-5.307171 5.36737,-7.608861 1.20998,-1.451224 5.42959,-11.68879 6.73579,-12.954508 1.15345,-1.117702 -0.61671,6.716077 0.6067,5.742303 3.54416,-2.820971 7.37187,-5.039402 11.42528,-6.663547 1.45288,-0.582147 7.53908,-6.110856 9.0473,-6.540682 1.46845,-0.418499 -1.64247,4.257933 -0.12655,3.983119 3.08052,-0.55845 6.25397,-0.820953 9.4997,-0.790453 2.97799,0.02798 5.75432,0.191474 8.34588,0.48126 25.87546,2.893366 24.83102,18.877132 30.67702,37.782415" class="hair" id="path4763-5" sodipodi:nodetypes="csssssssssssccsscssssssssssc"/></svg></html>' >>
\ No newline at end of file
-- 
GitLab