!% -SD

Constant Story "Up She Rises";
Constant Headline "^a story of shipwrecked memories^
		 ^by vincent zeng^
		 ^(for more information, type 'about')^";
Release 0;  Serial "000000";
Include "Parser";
Include "VerbLib";
Include "Menus";

Constant MAX_TURNS = 40;
Constant POOP_LIMIT = MAX_TURNS/4;

Global songRemembered = false;
Global songSung = false;
Global poop_counter = -POOP_LIMIT;
Global ropeReleased = false;
Global ropeRemembered = false;

!==========menus

Menu about_menu "Up She Rises";
Option -> "About the game"
	with description "This is my first interactive fiction. It's based loosly on a short story of mine that seemed to fit the interative setting fairly well. Instead of focusing on making interesting puzzles or storylines, I tried to make a small world with rich interactions and a large emotional space. The endings are less important to this piece than the way you choose to get there, but there are multiple endings to discover..";
Option -> "How to play"
	with description "Standard interactive fiction controls apply here. ^
	^For the uniniated, this means you can move around in the world by typing compass directions (abbreviated as 'n', 's', 'e', and 'w'), as well as 'up', 'down', 'enter', 'exit'.^
	^You can examine your surroundings by typing 'look' (abbreviated as 'l'), or examine specific objects by typing 'x (object)'.^
	^Your non-visual senses are applicable as well; you can 'smell (object)' and 'listen to (object)' and 'taste (object)'.^
	^You can 'get' an object, or 'drop' it (check your inventory with 'i').^
	^Try other vebs, too. Try examining yourself. Try to talk, shout, sing. Try doing what the text suggests. The worse thing that can happen is nothing.^
	^If you're ever at a loss at what to do next, try to 'remember (object)' and see what happens.";
Option -> "Technical Notes"
	with description "filler";
Option -> "Release Notes"
	with description "0: Pre-beta version; basic setting and grammar are there, working on fleshing out environment and adding more interations.";
Option -> "Credits"
	with description "Thanks to support and enthusiasm from lea for dragging me into interactive fiction, general coding advice and lewd grammar requests from iev, all my poor friends who I forced into playtesting, and the IBG and DM4.^
	^I can be contacted at hvincentATmodgethanc.com for any reason you want.";

!==========classes

Class 	Room
	with
		cant_go	"There isn't anything interesting that way.",
		each_turn [;
			if (turns >= MAX_TURNS) {
				deadflag = 3;
				print "^The sun has set. It's time to go.^";
				if (songSung)
					print "^As you walk back to the cottage, you stop at the edge of the surf. The sand is heavy and wet, packed down by the pounding waves. Hermit crabs scatter under your feet, their half-spiral shells burying frantically down into the watery sand. You sit just above the tide line, waiting for them to return. Voices sing in the distance---wey-hey up she rises, wey-hey up she rises, wey-hey up she rises early in the morning---as several figures stomp through the surf at a distance, arms around each others' backs. You watch and wave to them. They turn and walk back into the sea.^";
				if (ocean.rock_count > 0) {
					print "^You threw ", ocean.rock_count, " rock";
					if (ocean.rock_count > 1) {
						print "s"; 
					}
					print " into the sea.";
				}
			}
		],
		before [;
			Listen:
				if (noun == false)
					print_ret "All you can hear is the ocean. Why don't you listen to it more closely?";
			Smell:
				if (noun == false)
					print_ret "The ocean's salty musk fills your nose.";
			Sing:
				if (songRemembered == false)
					print_ret "You open your mouth in a moment of pasion, meaning to burst into song, but your voice breaks at the first rush of air and you realize you've forgotten the words.";
				if (songRemembered) {
					songSung = true;
					print "Even though no one's listening, you sing to yourself.^";
					style bold;
					print "^{wey-hey up she rises, wey-hey up she rises, wey-hey up she rises early in the morning}^";
					style roman;
					print_ret "^The ocean seems to approve of your song; the crashing waves lull for a moment, leaving only fingers of froth on the wet sand.";
				}
		],
		after [;
			Wait:
				print_ret "You do nothing but watch as the sun inches a little closer to the water.";
		],
	has	light;

Class	Prop
	with
		before [;
			Examine:
				return false;
			default:
				print_ret "It's not really useful to do that to ", (the) self, ".";
		],
	has	scenery;

Class 	Memory
	with	before [;
			default:
				print_ret "It's only a memory...";
		],
		found_in [;
			return true;
		],
	has	scenery scored;

Class	Turd (MAX_TURNS)
	with	name 'poop' 'poops//p' 'turd' 'turds//p' 'crap' 'shit' 'poo' 'feces' 'dump',
		short_name "smelly turd",
		article "a",
		plural "turds",
		description "A by-product of digestion.",
		before [;
			Take:
				print_ret "You reach out to pick up the turd, but think better of it. Gross. Why don't you try cleaning it?";
			Smell:
				print_ret "It stinks a lot.";
			Examine:
				print_ret "A by-product of digestion.";
			Rub:
				remove self;
				print_ret "While holding your breath, you clean up your mess.";
			default:
				print_ret "You wouldn't want to do that.";
		],
	has	;

Class 	Rock (MAX_TURNS)
	with	name 'rock' 'stone' 'pebble',
		short_name "small rock from the beach",
		article "a",
		plural "rocks from the beach",
		description "A small, flat grey rock, its edges worn smooth by the sea. It fits nicely in your hand.",
		before [;
			Drop:
				move self to location;
				print_ret "It falls heavily to the ground a few paces away.";
			ThrowAt,Insert:
				if (second == ocean) {
					ocean.rock_count++;
					remove self;
					print_ret "You pull your arm back, winding up for a long throw, and heave the rock at the open sea. It soars through the sky, spiraling out at the sunset, then splashes boldly into the surf.";
				}
		],
		has	;
!==========memories

Memory song "song"
	with 	name 'song' 'tune' 'sing' 'singing' 'lyrics' 'music' 'words',
		before [;
			Remember:
				if (songRemembered)
					print_ret "You can easily recall the words to the song now, but it's still nice to think about it.";
				songRemembered = true;
				print "The old memories pleasantly wash over you; nights of calm, open sea with warm air and food, the ship-mates singing on the other side of the ship. You never joined them.^";
				box "wey-hey up she rises"
				    "wey-hey up she rises"
				    "wey-hey up she rises"
				    "early in the morn";
				print_ret "^You recall an old tune.";
		];
	

!==========objects

Object ocean "ocean" 
	with	description
		"The ocean. You're on an island so small that you could walk with one foot in the frothing tide and the other foot dry, and before the sun passes all the way overhead, you're back where you started. As far as you can see, there's nothing out there on the water except the water. The sound is hypnotic.",
		name 'ocean' 'sea' 'water',
		rock_count 0,
		found_in [;
			return true;
		],
		before [;
			Enter,Go:
				print_ret "The surf is rough; you briefly consider diving in, but think better of it. Instead, you are content to listen to the sound of the ocean.";
			Examine:
				if (location == cottage_inside ||
				    location == lighthouse_inside ||
				    location == lighthouse_top ||
				    location == lighthouse_stairs)
					print_ret "You can't see the ocean from inside.";
			Taste:
				if (location == cottage_inside ||
				    location == lighthouse_inside ||
				    location == lighthouse_top ||
				    location == lighthouse_stairs)
				  	print_ret "The ocean calls to you from outside, but you can't taste it from here.";
				print_ret "Bending down at the edge of the surf, you scoop up some of the water and sip it from your hands. It tastes like salt and fish; it tastes like life. The sand is gritty in your teeth.";
			Listen:
				switch (location) {
					rocky_outcropping:
						print_ret "The waves smack against the rocks as if the water was solid.";
					beach:
						print_ret "The waves lap hypnotically at the sand; it reminds you of the first time you saw the ocean.";
					lighthouse_front:
						print_ret "The sound of crashing waves wrap around the lighthouse; it echos strangely.";
					lighthouse_inside:
						print_ret "From here, the sound of the ocean is strange; the waves crash against the shore outside, but the sound enters the lighthouse and reverberates around and around. It almost sounds like you're standing knee-deep in the water and the ocean is everywhere.";
					lighthouse_stairs:
						print_ret "From here, the sound of the ocean is strange; the waves crash against the shore outside, but the sound enters the lighthouse and reverberates around and around. It almost sounds like you're standing knee-deep in the water and the ocean is everywhere.";
					lighthouse_top:
						print_ret "From here, the sound of the ocean is strange; the waves crash against the shore outside, but the sound enters the lighthouse and reverberates around and around. It almost sounds like you're standing knee-deep in the water and the ocean is everywhere.";
					cottage_inside:
						print_ret "Even inside the cottage, you can hear the comforting lull of the ocean.";
					cottage_front:
						print_ret "The waves call out to you."; 
				}
		],
	has 	scenery container open;

!====== Cottage Front

Room cottage_front "In front of the cottage"
	with 	description
		"You stand outside of the cottage. The lighthouse is just south down the path, while the ocean crashes against the beach to the west.",
		s_to lighthouse_front,
		in_to cottage_inside,
		n_to cottage_inside,
		w_to "The surf is rough; you briefly consider diving in, but think better of it. Instead, you are content to listen to the sound of the ocean.",
	has 	;

Object cottage "cottage" cottage_front
	with 	description
		"The cottage is small and cozy-looking. Algae grows on the flaky white paint; the outside hasn't been cleaned for a while.",
		before [;
			Rub:
				print_ret "You'd like to clean the outside of the cottage, but you lack anything to clean with.";
		],
		name 'cottage',
	has	scenery;

Object pole "pole" cottage_front
	with	description
		"A wooden pole about as thick as a man's wrist and twice as tall as you are. It's cracked with age and weather, but smooth and splinterless.",
		name 'pole' 'wood' 'wooden',
		before [;
			Take:
				move self to player;	
				print_ret "It's heavy and a little awkward to carry, but you are used to carrying heavy things and you balance it over your shoulder.";
			Smell:
				print_ret "Smells like old dirt.";
			
			Taste:
				print_ret "You don't really want to do that.";
			Listen:
				print_ret "You put your ear against the side of the pole. Ambient vibrations buzz against your ear.";
			ThrowAt:
				if (second == ocean)	
					print_ret "If you threw that into the ocean, you might never get it back again.";
			Insert:
				if (second == trunk)
					print_ret "It doesn't fit.";
		],
	has	;

!====== Cottage Inside

Room cottage_inside "Inside the cottage"
	with 	description
		"You stand inside of the cottage. It's a one-room house with a bed, a small dining table with one chair, a grungy old sink, and a pot bellied stove. A plain old steamer trunk sits at the foot of the bed.",
		out_to cottage_front,
		s_to cottage_front,
	has 	;

Object shirt "shirt" cottage_inside
	with 	description
		"A shirt that's probably too big for you.",
		name 'shirt',
		before [;
			Smell:
				print_ret "The shirt smells a little musty.";
		],
		after [;
			Wear:
				print_ret "The shirt is a little baggy on you, but you put it on anyway.";
		],
	has 	clothing;

Object trunk "trunk" cottage_inside
	with 	description 
		"A plain-looking steamer trunk made of unpolished wood.",
		name 'trunk' 'steamer' 'suitcase' 'case' 'box',
		after [;
			Enter:
				print_ret "You get into the trunk. It's a tight squeeze, but you manage to fit. It's a little hard to breathe.";
		],
	has 	container openable scenery enterable;

Object lantern "lantern" cottage_inside
	with	description
		"A dirty old kerosene lantern.",
		name 'lantern' 'lamp' 'light',
		before [;
			Burn:
				print_ret "You can't make fire with your bare hands.";
		],
	has	;

Object bed "bed" cottage_inside
	with	description
		"A bed with neatly folded white sheets. Two people would have a hard time sharing it.",
		name 'bed',
	has	scenery supporter;

Prop sheets "sheets" cottage_inside
	with	description
		"Neatly folded white sheets.",
		name "sheets" "sheet",
	has	scenery;

Object kitchen_table "table" cottage_inside
	with 	description
		"A three-legged wooden table. Its surface is smooth and polished from use.",
		name 'table' 'dining',
		before [;
			Enter:
			"You feel a little silly about yourself.";
		],
	has scenery supporter;

Object kitchen_chair "chair" cottage_inside
	with 	description
		"A high-backed wooden chair. The seat has been contoured to fit the average behind perfectly.",
		name 'chair',
		before [;
			Enter:
			"It creaks a little under your weight, but firmly supports you.";
		],
	has scenery supporter;

Prop stove "pot-bellied stove" cottage_inside
	with 	description
		"An old cast-iron stove. It's been well-used, but still burns wood like any other stove.",
		name 'stove' 'pot' 'belly' 'bellied' 'iron' 'cast';

Prop sink "sink" cottage_inside
	with 	description
		"An old stainless steel sink attached to the wall. The faucets are rusty, but the water pump works well enough.",
		name 'sink' 'grungy' 'stainless' 'steel' 'faucet';

!====== Lighthouse Front

Room lighthouse_front "In front of the lighthouse"
	with 	description
		"You stand at the foot of the lighthouse. The cottage sits to the north. The beach stretches to the south, while waves from the ocean crash in from the west.",
		s_to beach,
		n_to cottage_front,
		in_to lighthouse_inside,
		w_to "The surf is rough; you briefly consider diving in, but think better of it. Instead, you are content to listen to the sound of the ocean.",
	has 	;

Object lighthouse "lighthouse" lighthouse_front
	with	description
		"A lighthouse.",
		before [;
			Enter:
				PlayerTo(lighthouse_inside);
				return true;
		],
		name 'lighthouse' 'light' 'tower',
	has	scenery;

!===== Lighthouse Inside

Room lighthouse_inside "Inside a lighthouse"
	with 	description[;
		print "The lighthouse is old and burnt-out; nothing much remains inside of it. Stone stairs curve around the wall, spiraling up to the top, but they can't be easily reached as they stop about ten feet above your head. Charred remains of burnt wood lay in a pile under the stairs; it seems that there used to be wooden stairs leading up to the stone ones.^";
		if (ropeReleased)
			print "^An old rope hangs from a metal hoop on the bottom stair. It almost reaches the ground.^";
		else
			print "^An old rope is tied to a metal hoop on the bottom stair, but it sits coiled out of reach. One loop hangs slightly over the edge of the stone.^";
		],
		out_to lighthouse_front,
		u_to "How do you think you're getting up there?",
	has 	;

Object wood "wood" lighthouse_inside
	with	description
		"A pile of charred wood, covered in dust and sand. Seems like they were once wooden stairs leading up to the stone stairs.",
		name 'wood' 'burnt' 'wooden' 'charred' 'pile',
	has	scenery;

Object rope "rope" lighthouse_inside
	with	description
		"A frayed old rope, tied firmly to a metal hoop on the lowest stair.",
		name 'rope' 'cable' 'coil' 'coiled' 'coils' 'loop' 'frayed'  'line' 'climb' 'climbing',
		before [;
			Take:
				if (ropeReleased)
					print_ret "It's firmly tied to the metal hoop.";
				else
					ropeReleased = true;
					print_ret "It's out of reach. BUT YOU GET IT ANYWAY";
			Remember:
				ropeRemembered = true;
				print_ret "You remember a time when your strong arms could easily haul the rest of your body up and down ropes with ease. You could probably still do it if you really tried.";
			Climb:
				if (ropeReleased) {
					if (ropeRemembered) { 
						print "It's been a while since you've climbed anything, but the body rarely forgets.^";
						playerTo(lighthouse_stairs);
						return;
					} else {
						box "...gotta remember if i can do it...";
						print_ret "You stare at the rope but you aren't certain if you can make it.";
					}
				} else
					print_ret "You can't even reach it.";
		],
	has	scenery;

Object hoop "hoop" lighthouse_inside
	with	description
		"A rusty metal hoop set into the stone.",
		name 'hoop' 'metal' 'rusty',
	has	scenery;

Object knot "knot" lighthouse_inside
	with	description
		"The knot is so old and encrusted with salt that you'd never imagine trying to untie it.",
		name 'knot',
	has	scenery;

!====== Lighthouse Stairs

room lighthouse_stairs "In the stairs of the lighthouse"
	with	description
		"stairs stairs stairs",
		u_to lighthouse_top,
		d_to lighthouse_inside,
	has	;

!====== Lighthouse Top

room lighthouse_top "At the top of the lighthouse"
	with	description
		"YOU'RE ON TOP",
		d_to lighthouse_stairs,
	has	;
!====== Beach

Room beach "On the beach"
	with 	description
		"You stand on a sandy beach. The ocean stretches to the west as far as the eye can see. The sand stops at a rocky outcropping to the south.",
		n_to lighthouse_front,
		s_to rocky_outcropping,
		w_to "The surf is rough; you briefly consider diving in, but think better of it. Instead, you are content to listen to the sound of the ocean.",
	has 	;

!===== Rocks

Room rocky_outcropping "Rocky outcropping"
	with 	description
		"You stand on some large, flat rocks. Salty spray hits you from all directions. The lighthouse stands on the beach to the north.",
		n_to beach,
		w_to "The surf is rough; you briefly consider diving in, but think better of it. Instead, you are content to listen to the sound of the ocean.",
		e_to "The surf is rough; you briefly consider diving in, but think better of it. Instead, you are content to listen to the sound of the ocean.",
		s_to "The surf is rough; you briefly consider diving in, but think better of it. Instead, you are content to listen to the sound of the ocean.",
	has 	;

Object rockpile "pile of rocks" rocky_outcropping
	with	description
		"A pile of small grey rocks.",
		name 'small' 'rock' 'stone' 'pebble' 'flat' 'grey' 'rocks' 'pile' 'bunch',
		before [ new_rock;
			Take:
				new_rock = Rock.create();
				print "You pick up one of the rocks.^";
				move new_rock to player;
				return true;
				!<<Take new_rock>>;
			Remember:
				print_ret "There are so many rocks in the world, but none of them seem any more memorable than the next one.";

		],
	has 	static;

!============grammarizing

Verb 'poop' 'defecate' 'poo' 'pewp' 'p00p' 'crap'
	* -> Poop;

[ PoopSub new_poop;
	if (turns - poop_counter < POOP_LIMIT)
		print_ret "It hasn't been very long since the last time you pooped; you squat and push but nothing comes out.";
	new_poop = Turd.create();
	move new_poop to location;
	"You pooped!";
];

Verb  'remember' 'recall' 'consider' 'ponder'
	* 'about' noun -> Remember
	* noun -> Remember;

[ RememberSub; 
	print_ret "You think about it, but it doesn't seem terribly important.";
];

!Extend 'take'
!	* noun 'with' held -> TakeWith;

![ TakeWithSub;
!	print_ret "";
!];

Verb 'help' 'about' 'menu' 'hints'
	* -> Help;

[ HelpSub;
	about_menu.select();
];

!============initializing

[ Initialise;
		!Global MAX_TURNS = random(25,50);
		location = lighthouse_front;
		lookmode = 2;
		player.description = "A short and stocky man. Your skin is tanned and weathered, your hands are calloused, your face is unshaven.";
		move shirt to bed;
		move lantern to trunk;
		print "^Wake up to sudden motion in bunk. Cabin tilts back and forth. Dumped onto ground in tangle off sheets. Pull on boots. Climb up to deck. Impressive storm swallowing up sea, swirling ship through angry waves. Wind is everywhere. Water is everywhere. Stare up into sky; too dark to see.^
		^'Smithy, you lazy bastard, give us a hand!' shouts sailor from somewhere. Don't see man because voice is torn across deck by wind.^
		^Grab rope and start hauling down sails. Cloth stretches and strains; wood groans as wind threatens to tear ship apart. Line gets caught on massive splinter. Start shimmying up mast. Boat heaves. Grab the air,";
		style bold;
		print " wey-hey, up he rises,";
		style roman;
		print " floating upside-down above the ship, like the wind is drawing him into the clouds. He can't see where the sky ends and the water begines. He plunges into the sea.^^^
		^The ship vanishes. The sky vanishes.^^^";
		print "^^^^^^^^^You wake up with the warm sun stroking your face; it hangs low and shrunken in the horizon.^";
		style bold;
		print "^{must have fallen asleep on the beach again. not a bad place for a late afternoon nap, anyway.}^";
		style roman;
		print_ret "^The sun will set soon, but there are still things to be done.^";
		];

Include "Grammar";
