# changingroom

menu_off = 1

if $ARGS[0] = 'view_swim_list':

	if $loc = 'fit' or $loc = 'bass' or temper >= 15:
		if $clothingworntype ! 'swimwear' and $clothingworntype ! 'beach':
			if $clothingworntype = 'nude':
				if $lastwornclothingtype ! 'swimwear' and $lastwornclothingtype ! 'beach':
					$normalclothingworntype = $lastwornclothingtype
					normalclothingwornno = lastwornclothingnumber
				end
			else
				$normalclothingworntype = $clothingworntype
				normalclothingwornno = clothingwornnumber
			end
		end

		i = 1
		h = 0
		:loopswimwear
			if swimwear[i] = 1 and swimwear_s[i] = 0 and ($clothingworntype ! 'swimwear' or clothingwornnumber ! i):h += 1 & *p '<a href="exec:gt ''changingroom'', ''view_swim_item'', ''swimwear'', <<i>>"><img <<$set_imgh>> src="images/pc/clothing/12swimwear/<<i>>.jpg" 	height="250" /></a>'
			i += 1
		if i <= ARRSIZE('swimwear'):jump 'loopswimwear'

		*nl
		*nl

		i = 1
		h = 0
		:loopbeach
			if beach[i] = 1 and beach_s[i] = 0 and ($clothingworntype ! 'beach' or clothingwornnumber ! i):h += 1 & *p '<a href="exec:gt ''changingroom'', ''view_swim_item'', ''beach'', <<i>>"><img <<$set_imgh>> src="images/pc/clothing/15beachbabe/<<i>>.jpg" 	height="250" /></a>'
			i += 1
		if i <= ARRSIZE('beach'):jump 'loopbeach'

		if h = 0 and $clothingworntype ! 'swimwear': '<center>You do not own any regular swimwear.</center>'
		if h = 0 and $clothingworntype ! 'beach': '<center>You do not own any slutty swimwear.</center>'
		if h = 0 and $clothingworntype = 'swimwear' or $clothingworntype = 'beach': '<center>You are wearing swimwear.</center>'

	elseif temper < 15:
		'<center>It''s below 15C - far too cold to get changed into swimwear. You should wait until the weather warms up.</center>'
	end

	act 'Leave':gt $loc, $loc_arg
	
	if $clothingworntype = 'swimwear' or $clothingworntype = 'beach':
		act 'Put your regular clothes back on':
			gs 'underwear', 'wear'
			gs 'clothing', 'wear', $normalclothingworntype, normalclothingwornno
			gt $loc, $loc_arg
		end
	end
end

if $ARGS[0] = 'view_swim_item':
	!! ARGS 0 - view_clothing_item
	!! ARGS 1 - clothing type
	!! ARGS 2 - clothing index

	cla
	'<center><img <<$set_imgh>> src="<<FUNC(''$clothing_image'',  $ARGS[1], ARGS[2])>>"></center>'
	'<<$ARGS[1]>> no.<<ARGS[2]>>'
	if $ARGS[1] = 'swimwear':
		FUNC('$attributes_swimwear', $ARGS[1], ARGS[2])
	else
		FUNC('$attributes_beach', $ARGS[1], ARGS[2])
	end
	FUNC('$clothing_name', $ARGS[1], ARGS[2])

	$RESULT = '(strength '
	dynamic '$RESULT += <<$ARGS[1]>>_h[<<ARGS[2]>>]'
	$RESULT += ')'
	'<<$RESULT>>'

	act 'Return':gt 'changingroom', 'view_swim_list'
	
	!! if the clothing is worn out
	if dyneval('RESULT = <<$ARGS[1]>>_h[<<ARGS[2]>>]') <= 0:
		'This item is worn and is not suitable for further wear.'
		act 'Throw it away':
			dynamic '<<$ARGS[1]>>[<<ARGS[2]>>] = 0'
			gt 'changingroom', 'view_swim_list'
		end
	elseif CloInhibit > pcs_inhib:
		'You don''t feel daring enough to wear swimwear this revealing.'
	else
		if CloInhibit + 10 > pcs_inhib: 'You find this swimwear to be more revealing than you are completely comfortable with but that makes it quite exciting too.'
		act 'Wear':
			gs 'underwear', 'remove'
			gs 'clothing', 'wear', $ARGS[1], ARGS[2]
			gt $loc, $loc_arg
		end
	end
end


!! following function counts all available swim and beach wear including the one which could be dressed already.
!! you can add 'swim' or 'beach' if you want to count just one of them
!! use func('changingroom','count_swim_item') or func('changingroom','count_swim_item','swim') or func('changingroom','count_swim_item','beach')

if $ARGS[0] = 'count_swim_item':
	h = 0
	if $ARGS[1] = 'swim' or $ARGS[1] = '':
		i = 1
		:loopcountswimwear
			if swimwear[i] = 1 and swimwear_s[i] = 0 :h += 1
			i += 1
		if i <= ARRSIZE('swimwear'):jump 'loopcountswimwear'
	end

	if $ARGS[1] = 'beach' or $ARGS[1] = '':
		i = 1
		:loopcountbeach
			if beach[i] = 1 and beach_s[i] = 0 :h += 1
			i += 1
		if i <= ARRSIZE('beach'):jump 'loopcountbeach'
	end
	result = h
	killvar 'i'
	killvar 'h'
end
--- changingroom ---------------------------------

