From 4393c6d67a862009143f47502aec6f7ed5bb6c24 Mon Sep 17 00:00:00 2001
From: kopareigns <kopareigns@gmail.com>
Date: Thu, 17 Jan 2019 22:09:30 -0500
Subject: [PATCH] Convert Penis.tw

---
 src/art/artJS.tw        | 125 ++++++++++++++++++++++++++++++++++++++++
 src/art/vector/Penis.tw | 103 +--------------------------------
 2 files changed, 126 insertions(+), 102 deletions(-)

diff --git a/src/art/artJS.tw b/src/art/artJS.tw
index b9471f1a25d..d85c3122fea 100644
--- a/src/art/artJS.tw
+++ b/src/art/artJS.tw
@@ -3305,3 +3305,128 @@ window.ArtVectorHead = function(slave) {
 	}	
 	return r;
 };
+
+window.ArtVectorPenis = function(slave) {
+	const T = State.temporary;
+	let penisSize;
+	let r = "";
+	/* BEWARE: _art_have_boobs and _art_scale_factor interfere with Art_Vector_Boob_ */
+	
+	if (slave.dick > 6 || (slave.dick > 0 && slave.belly <= 4000))
+		penisSize = Math.clamp(slave.dick, 1, 11) - 1;
+
+	if (penisSize !== undefined) { /* equivalent to (slave.dick > 6 || (slave.dick > 0 && slave.belly <= 4000)) */
+		switch (slave.clothes) {
+			/* BULGE OUTFITS LONG+MEDIUM OUTFITS */
+			case "a ball gown":
+			case "a biyelgee costume":
+			case "a burkini":
+			case "a burqa":
+			case "a dirndl":
+			case "a halter top dress":
+			case "a hijab and abaya":
+			case "a hijab and blouse":
+			case "a kimono":
+			case "a klan robe":
+			case "a long qipao":
+			case "a maternity dress":
+			case "a military uniform":
+			case "a mounty outfit":
+			case "a nice maid outfit":
+			case "a nice nurse outfit":
+			case "a niqab and abaya":
+			case "a police uniform":
+			case "a red army uniform":
+			case "a schutzstaffel uniform":
+			case "a skimpy loincloth":
+			case "a slave gown":
+			case "a slutty nurse outfit":
+			case "a slutty schutzstaffel uniform":
+			case "a t-shirt and jeans":
+			case "a toga":
+			case "an apron":
+			case "battlearmor":
+			case "battledress":
+			case "conservative clothing":
+			case "jeans":
+			case "leather pants":
+			case "leather pants and a tube top":
+			case "leather pants and pasties":
+			case "lederhosen":
+			case "nice business attire":
+			case "slutty business attire":
+			case "spats and a tank top":
+			case "sport shorts":
+			case "sport shorts and a sports bra":
+			case "sport shorts and a t-shirt":
+			case "stretch pants and a crop-top":
+				r += jsInclude(`Art_Vector_Bulge_Outfit_${penisSize}`);
+				break;
+			/* BULGE OUTFITS SHORT OUTFITS */
+			case "a bunny outfit":
+			case "a button-up shirt and panties":
+			case "a chattel habit":
+			case "a huipil":
+			case "a leotard":
+			case "a mini dress":
+			case "a monokini":
+			case "a one-piece swimsuit":
+			case "a penitent nuns habit":
+			case "a scalemail bikini":
+			case "a slutty klan robe":
+			case "a slutty maid outfit":
+			case "a slutty outfit":
+			case "a slutty qipao":
+			case "a succubus outfit":
+			case "a sweater and cutoffs":
+			case "a sweater and panties":
+			case "a t-shirt and panties":
+			case "a t-shirt and thong":
+			case "a tank-top and panties":
+			case "a thong":
+			case "a tube top and thong":
+			case "an oversized t-shirt and boyshorts":
+			case "attractive lingerie for a pregnant woman":
+			case "boyshorts":
+			case "cutoffs":
+			case "cutoffs and a t-shirt":
+			case "harem gauze":
+			case "kitty lingerie":
+			case "panties":
+			case "panties and pasties":
+			case "striped panties":
+			case "striped underwear":
+				if (slave.dick > 3)
+					r += jsInclude("Art_Vector_Bulge_Outfit_3");
+				else
+					r += jsInclude(`Art_Vector_Bulge_Outfit_${penisSize}`);
+			/* hide everything */
+			case "a cheerleader outfit":
+			case "a gothic lolita dress":
+			case "a hanbok":
+			case "a schoolgirl outfit":
+				break;
+			/* full frontal */
+			default:
+				if (canAchieveErection(slave) && slave.dickAccessory !== "chastity" && slave.dickAccessory !== "combined chastity") {
+				/* draw erect penis over boobs if boobs do not hide the penis' base */
+					if (T.art_have_boobs === true && T.art_scale_factor < 3.7) {
+						if (slave.foreskin !== 0)
+							r += jsInclude(`Art_Vector_Penis_${penisSize}`);
+						else
+							r += jsInclude(`Art_Vector_PenisCirc_${penisSize}`);
+					}
+				/* flaccid penises are always drawn behind the boobs */
+				} else if (T.art_have_boobs !== true) {
+					if (slave.foreskin !== 0) 
+						r += jsInclude(`Art_Vector_Flaccid_${penisSize}`);
+					else
+						r += jsInclude(`Art_Vector_FlaccidCirc_${penisSize}`);
+					/* this draws chastity OVER latex catsuit. prndev finds this alright. */
+					if (slave.dickAccessory === "chastity" || slave.dickAccessory === "combined chastity") 
+						r += jsInclude(`Art_Vector_Chastity_Cage_${penisSize}`);
+				}
+		}
+	}
+	return r;
+};
diff --git a/src/art/vector/Penis.tw b/src/art/vector/Penis.tw
index e40d6193128..2f4ae402fea 100644
--- a/src/art/vector/Penis.tw
+++ b/src/art/vector/Penis.tw
@@ -1,107 +1,6 @@
 :: Art_Vector_Penis_ [nobr]
 
-/* BEWARE: _art_have_boobs and _art_scale_factor interfere with Art_Vector_Boob_ */
-
-<<set _penisSize = -1>>
- /* BULGE OUTFITS LONG+MEDIUM OUTFITS */
-<<if _artSlave.clothes == "a slave gown" || _artSlave.clothes == "a hijab and abaya" || _artSlave.clothes == "a nice maid outfit" || _artSlave.clothes == "a military uniform" || _artSlave.clothes == "a nice nurse outfit" || _artSlave.clothes == "a ball gown" || _artSlave.clothes == "battledress" || _artSlave.clothes == "nice business attire" || _artSlave.clothes == "conservative clothing" || _artSlave.clothes == "a kimono" || _artSlave.clothes == "a maternity dress" || _artSlave.clothes == "stretch pants and a crop-top" || _artSlave.clothes == "a toga" || _artSlave.clothes == "a halter top dress" || _artSlave.clothes == "a slutty nurse outfit" || _artSlave.clothes == "slutty business attire" || _artSlave.clothes == "spats and a tank top" || _artSlave.clothes == "a schutzstaffel uniform" || _artSlave.clothes == "a slutty schutzstaffel uniform" || _artSlave.clothes == "a red army uniform" || _artSlave.clothes == "an apron" || _artSlave.clothes == "battlearmor" || _artSlave.clothes == "a dirndl" || _artSlave.clothes == "a biyelgee costume" || _artSlave.clothes == "lederhosen" || _artSlave.clothes == "a mounty outfit" || _artSlave.clothes == "a long qipao" || _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 == "sport shorts" || _artSlave.clothes == "sport shorts and a sports bra" || _artSlave.clothes == "sport shorts and t-shirt" || _artSlave.clothes == "jeans" || _artSlave.clothes == "leather pants" || _artSlave.clothes == "leather pants and pasties" || _artSlave.clothes == "leather pants and a tube top" || _artSlave.clothes == "a t-shirt and jeans" || _artSlave.clothes == "a skimpy loincloth" || _artSlave.clothes == "a police uniform">>
-	<<if _artSlave.dick >= 11>>
-		<<include Art_Vector_Bulge_Outfit_10>>
-	<<elseif _artSlave.dick >= 10>>
-		<<include Art_Vector_Bulge_Outfit_9>>
-	<<elseif _artSlave.dick >= 9>>
-		<<include Art_Vector_Bulge_Outfit_8>>
-	<<elseif _artSlave.dick >= 8>>
-		<<include Art_Vector_Bulge_Outfit_7>>
-	<<elseif _artSlave.dick >= 7>>
-		<<include Art_Vector_Bulge_Outfit_6>>
-	<<elseif _artSlave.dick >= 6 && _artSlave.belly <= 4000>>
-		<<include Art_Vector_Bulge_Outfit_5>>
-	<<elseif _artSlave.dick >= 5 && _artSlave.belly <= 4000>>
-		<<include Art_Vector_Bulge_Outfit_4>>
-	<<elseif _artSlave.dick >= 4 && _artSlave.belly <= 4000>>
-		<<include Art_Vector_Bulge_Outfit_3>>
-	<<elseif _artSlave.dick >= 3 && _artSlave.belly <= 4000>>
-		<<include Art_Vector_Bulge_Outfit_2>>
-	<<elseif _artSlave.dick >= 2 && _artSlave.belly <= 4000>>
-		<<include Art_Vector_Bulge_Outfit_1>>
-	<<elseif _artSlave.dick >= 1 && _artSlave.belly <= 4000>>
-		<<include Art_Vector_Bulge_Outfit_0>>
-	<</if>>
-<</if>>
-
-/* BULGE OUTFITS SHORT OUTFITS */
-<<if _artSlave.clothes == "cutoffs and a t-shirt" || _artSlave.clothes == "a leotard" || _artSlave.clothes == "a slutty maid outfit" || _artSlave.clothes == "a mini dress" || _artSlave.clothes == "a scalemail bikini" || _artSlave.clothes == "striped panties" || _artSlave.clothes == "a slutty outfit" || _artSlave.clothes == "a succubus outfit" || _artSlave.clothes == "attractive lingerie for a pregnant woman" || _artSlave.clothes == "a bunny outfit" || _artSlave.clothes == "a chattel habit" || _artSlave.clothes == "harem gauze" || _artSlave.clothes == "a huipil" || _artSlave.clothes == "a slutty qipao" || _artSlave.clothes == "a penitent nuns habit" || _artSlave.clothes == "a monokini" || _artSlave.clothes == "cutoffs" || _artSlave.clothes == "panties" || _artSlave.clothes == "panties and pasties" || _artSlave.clothes == "a thong" || _artSlave.clothes == "a slutty klan robe" || _artSlave.clothes == "striped underwear" || _artSlave.clothes == "a button-up shirt and panties" || _artSlave.clothes == "a t-shirt and panties" || _artSlave.clothes == "a t-shirt and thong" || _artSlave.clothes == "a tube top and thong" || _artSlave.clothes == "boyshorts" || _artSlave.clothes == "a tank-top and panties" || _artSlave.clothes == "an oversized t-shirt and boyshorts" || _artSlave.clothes == "a sweater and panties" || _artSlave.clothes == "a sweater and cutoffs" || _artSlave.clothes == "a one-piece swimsuit" || _artSlave.clothes == "kitty lingerie">>
-	<<if _artSlave.dick >= 4 && _artSlave.belly <= 4000>>
-		<<include Art_Vector_Bulge_Outfit_3>>
-	<<elseif _artSlave.dick >= 3 && _artSlave.belly <= 4000>>
-		<<include Art_Vector_Bulge_Outfit_2>>
-	<<elseif _artSlave.dick >= 2 && _artSlave.belly <= 4000>>
-		<<include Art_Vector_Bulge_Outfit_1>>
-	<<elseif _artSlave.dick >= 1 && _artSlave.belly <= 4000>>
-		<<include Art_Vector_Bulge_Outfit_0>>
-	<</if>>
-<</if>>
-
-/* HIDES DICK ON OUTFITS WHERE COVERED BY CLOTHING */
-<<if _artSlave.clothes != "a slave gown" && _artSlave.clothes != "a cheerleader outfit" && _artSlave.clothes != "cutoffs and a t-shirt" && _artSlave.clothes != "a halter top dress" && _artSlave.clothes != "a hijab and abaya" && _artSlave.clothes != "a leotard" && _artSlave.clothes != "a nice maid outfit" && _artSlave.clothes != "a slutty maid outfit" && _artSlave.clothes != "a military uniform" && _artSlave.clothes != "a mini dress" && _artSlave.clothes != "a nice nurse outfit" && _artSlave.clothes != "a slutty nurse outfit" && _artSlave.clothes != "striped panties" && _artSlave.clothes != "a scalemail bikini" && _artSlave.clothes != "a schoolgirl outfit" && _artSlave.clothes != "a ball gown" && _artSlave.clothes != "battledress" && _artSlave.clothes != "a slutty outfit" && _artSlave.clothes != "spats and a tank top" && _artSlave.clothes != "a succubus outfit" && _artSlave.clothes != "nice business attire" && _artSlave.clothes != "slutty business attire" && _artSlave.clothes != "attractive lingerie for a pregnant woman" && _artSlave.clothes != "a bunny outfit" && _artSlave.clothes != "a chattel habit" && _artSlave.clothes != "conservative clothing" && _artSlave.clothes != "harem gauze" && _artSlave.clothes != "a huipil" && _artSlave.clothes != "a kimono" && _artSlave.clothes != "a maternity dress" && _artSlave.clothes != "a slutty qipao" && _artSlave.clothes != "stretch pants and a crop-top" && _artSlave.clothes != "a toga" && _artSlave.clothes != "a penitent nuns habit" && _artSlave.clothes != "a monokini" && _artSlave.clothes != "a schutzstaffel uniform" && _artSlave.clothes != "a slutty schutzstaffel uniform" && _artSlave.clothes != "a red army uniform" && _artSlave.clothes != "an apron" && _artSlave.clothes != "battlearmor" && _artSlave.clothes != "a dirndl" && _artSlave.clothes != "a biyelgee costume" && _artSlave.clothes != "lederhosen" && _artSlave.clothes != "a mounty outfit" && _artSlave.clothes != "a long qipao" && _artSlave.clothes != "a klan robe" && _artSlave.clothes != "a niqab and abaya" && _artSlave.clothes != "a burqa" && _artSlave.clothes != "a hijab and blouse" && _artSlave.clothes != "a burkini" && _artSlave.clothes != "cutoffs" && _artSlave.clothes != "panties" && _artSlave.clothes != "panties and pasties" && _artSlave.clothes != "a thong" && _artSlave.clothes != "a slutty klan robe" && _artSlave.clothes != "striped underwear" && _artSlave.clothes != "a button-up shirt and panties" && _artSlave.clothes != "sport shorts" && _artSlave.clothes != "sport shorts and a sports bra" && _artSlave.clothes != "sport shorts and a t-shirt" && _artSlave.clothes != "a t-shirt and panties" && _artSlave.clothes != "a t-shirt and thong" && _artSlave.clothes != "jeans" && _artSlave.clothes != "leather pants" && _artSlave.clothes != "leather pants and pasties" && _artSlave.clothes != "leather pants and a tube top" && _artSlave.clothes != "a tube top and thong" && _artSlave.clothes != "boyshorts" && _artSlave.clothes != "a t-shirt and jeans" && _artSlave.clothes != "a tank-top and panties" && _artSlave.clothes != "a skimpy loincloth" && _artSlave.clothes != "an oversized t-shirt and boyshorts" && _artSlave.clothes != "a sweater and cutoffs" && _artSlave.clothes != "a sweater and panties" && _artSlave.clothes != "a police uniform" && _artSlave.clothes != "a one-piece swimsuit" && _artSlave.clothes != "a hanbok" && _artSlave.clothes != "a gothic lolita dress" && _artSlave.clothes != "kitty lingerie">>
-	<<if _artSlave.dick >= 11>>
-		<<set _penisSize = 10>>
-	<<elseif _artSlave.dick >= 10>>
-		<<set _penisSize = 9>>
-	<<elseif _artSlave.dick >= 9>>
-		<<set _penisSize = 8>>
-	<<elseif _artSlave.dick >= 8>>
-		<<set _penisSize = 7>>
-	<<elseif _artSlave.dick >= 7>>
-		<<set _penisSize = 6>>
-	<<elseif _artSlave.dick >= 6 && _artSlave.belly <= 4000>>
-		<<set _penisSize = 5>>
-	<<elseif _artSlave.dick >= 5 && _artSlave.belly <= 4000>>
-		<<set _penisSize = 4>>
-	<<elseif _artSlave.dick >= 4 && _artSlave.belly <= 4000>>
-		<<set _penisSize = 3>>
-	<<elseif _artSlave.dick >= 3 && _artSlave.belly <= 4000>>
-		<<set _penisSize = 2>>
-	<<elseif _artSlave.dick >= 2 && _artSlave.belly <= 4000>>
-		<<set _penisSize = 1>>
-	<<elseif _artSlave.dick >= 1 && _artSlave.belly <= 4000>>
-		<<set _penisSize = 0>>
-	<</if>>
-<</if>>
-
-<<if _penisSize >= 0>>
-	<<if canAchieveErection(_artSlave) && (_artSlave.dickAccessory != "chastity") && (_artSlave.dickAccessory != "combined chastity") >>
-		<<if (def _art_have_boobs) && (_art_scale_factor < 3.7) && _artSlave.foreskin >= 1>>
-			/* only draw erect penis over boobs if boobs do not hide the penis' base */
-			<<set _art = "Art_Vector_Penis_"+_penisSize>>
-			<<include _art>>
-		<<elseif (def _art_have_boobs) && (_art_scale_factor < 3.7) && _artSlave.foreskin == 0>>
-			<<set _art = "Art_Vector_PenisCirc_"+_penisSize>>
-			<<include _art>>
-		<</if>>
-	<<else>>
-		<<if ndef _art_have_boobs && _artSlave.foreskin >= 1>>
-			/* flaccid penises are always drawn behind the boobs */
-			<<set _art = "Art_Vector_Flaccid_"+_penisSize>>
-			<<include _art>>
-			<<if (_artSlave.dickAccessory == "chastity") || (_artSlave.dickAccessory == "combined chastity") >>
-				/* this draws chastity OVER latex catsuit. prndev finds this alright. */
-				<<set _art = "Art_Vector_Chastity_Cage_"+_penisSize>>
-				<<include _art>>
-			<</if>>
-		<<elseif ndef _art_have_boobs && _artSlave.foreskin == 0>>
-			/* flaccid penises are always drawn behind the boobs */
-			<<set _art = "Art_Vector_FlaccidCirc_"+_penisSize>>
-			<<include _art>>
-			<<if (_artSlave.dickAccessory == "chastity") || (_artSlave.dickAccessory == "combined chastity") >>
-				/* this draws chastity OVER latex catsuit. prndev finds this alright. */
-				<<set _art = "Art_Vector_Chastity_Cage_"+_penisSize>>
-				<<include _art>>
-			<</if>>
-		<</if>>
-	<</if>>
-<</if>>
+<<= ArtVectorPenis(_artSlave)>>
 
 /* unset the variable for the next display */
 <<unset _art_have_boobs >>
-- 
GitLab