// Slacker.cpp : Defines the entry point for the console application. // //#define _WIN32_WINNT 0x0500 #include "stdafx.h" #include #include #include #include #include //#include "window.h" #include "rick.h" #include "items.h" using namespace std; //globals vector scrollText; vector inventory; string itemList;//the lists of Items in a room int curX, curY; int guilt=0, score=0; int SpoonMove =0; int SpoonStep =0; int theTime =0; int curDsX=1, curDsY=4;//Current Dr. spoon int curSX=-1, curSY=-1;//current Stuendt int DDRtime=0;//Dance Dance Revolution Time int UPEtime=0;//UPE dinning time int DrSpoontime=0;//Dr. Spoon's Class time int Officetime=0;//Office Time.. int Brotime=0;//time for my brother to be on AIM... int Peetime=99999; int Caughttime = 99999;//When am I caught? int Smoketime = 0; int Gonetime = 99999;//how long is Dr. Spoon gone for? vector NULLSTRING;//a placeholder for some functions void drawMenu(void); int StepsA[7][2] ={{ 1, 4}, { 2, 4}, { 3, 4}, { 3, 4}, { 3, 4}, { 2, 4}, { 1, 4}}; int StepsB[9][2] ={{ 1, 4}, { 2, 4}, { 2, 5}, { 1, 5}, { 1, 5}, { 1, 5}, { 2, 5}, { 2, 4}, { 1, 4}}; int StepsC[13][2]={{ 1, 4}, { 2, 4}, { 2, 3}, { 2, 2}, { 1, 2}, { 1, 1}, { 1, 0}, { 1, 1}, { 1, 2}, { 2, 2}, { 2, 3}, { 2, 4}, { 1, 4}}; struct room { string desc; vector items; bool north, south, east, west;//can I go there? }; room map[4][7]; //purpose: adds a blank space void prints(void) { //Add a blank space scrollText.erase(scrollText.begin()); scrollText.push_back(" "); } //purpose: adds a single line void prints(char *word) { scrollText.erase(scrollText.begin()); scrollText.push_back(word); } //purpose: adds a single line void prints(string word) { scrollText.erase(scrollText.begin()); scrollText.push_back(word); } //purpose: to allow anyone to add an item to map void addItemToMap(int item) { map[curX][curY].items.push_back(item); } //purpose: to convert time from minutes to hours : minutes : pm/am string convertTime(int Time) { char buffer[80]; static string str; string min; int hours; int minutes; str = ""; hours = Time / 60; minutes = Time % 60; hours +=10; hours = hours % 13; //the prevous makes 1 oclock 0:00, so I add 1 to it.... if(hours < 8) hours++; str = _itoa(hours, buffer, 10); str += ":"; min= _itoa(minutes, buffer, 10); if(min.size() == 1) min= "0" + min; str += min; if((hours > 9) && (hours != 12)) str += " am"; else str += " pm"; return str; } //purpose: adds a vector of words void prints(vector words) { int count; for(count=0; count rooms, vector inv, int item) { int count; for(count =0; count < rooms.size(); count++) { if(rooms.at(count) == item) return true; } for(count =0; count < inv.size(); count++) { if(inv.at(count) == item) return true; } return false; } //purpose: Parsing, to identify an object int identifyObject(string word1, string word2, string word3, string word4) { int number; number = objectDecode(word1,word2); if((number != -1) &&(number != -2)) return number; number = objectDecode(word2, word3); if((number !=-1) && (number !=-2)) return number; number = objectDecode(word3, word4); if((number !=-1) && (number !=-2)) return number; number = objectDecode(word4, word4); return number; } //purpose: to identify a person from two words int identifyPerson(string word1, string word2) { int item = 0; item = peopleDecode(word1); if(item == -2) return peopleDecode(word2); else return item; } //purpose: to take an item bool Take(string word1, string word2, string word3, string word4) { int itemRequested=0; string str; if((word1.size==0))//if word1 is AT { prints("Take What?"); prints(); return false; } itemRequested = identifyObject(word1, word2, word3, word4); if(itemRequested == -1) { prints("I don't see any of those!"); prints(); return false; } if(RoomHas(map[curX][curY].items, NULLSTRING, itemRequested)) { if(itemMoveable(itemRequested)) { vector::iterator position; position = find(map[curX][curY].items.begin(), map[curX][curY].items.end(), itemRequested); map[curX][curY].items.erase(position); inventory.push_back(itemRequested); //change the envirement based on what was taken switch(itemRequested){ case PANEL: eEngine = TAKE; break; case MONEY: bMoney = false; break; default: break; } prints("TAKEN"); prints(); return true; } else { prints("I might be able to take that, But then it would force me to carry it"); prints("Hard Word != Slacking off"); } } else prints("Umm...I don't even know what you're talking about.."); prints(); return false; } //The give variable bool give(string word1, string word2, string word3, string word4) { int itemRequested=0; string str; int finder; vector::iterator position = 0; if((word1.size==0))//if word1 is AT { prints("give What?"); prints(); return false; } // if(!(curX == curSX && curY == curSY || curDsX == curX && curDsY == curY)) // { // prints("Theres no one to give anything too"); // prints(); // return false; // } itemRequested = identifyObject(word1, word2, word3, word4); if(itemRequested == -1) { prints("I don't see any of those!"); prints(); return false; } if(RoomHas(inventory, NULLSTRING, itemRequested)) { if(itemMoveable(itemRequested)) { vector::iterator position; position = find(inventory.begin(), inventory.end(), itemRequested); inventory.erase(position); //inventory.push_back(itemRequested); //change the envirement based on what was taken switch(itemRequested){ case KIT_KAT: if(curX == curSX && curY == curSY) { prints("ME: Want a Kit-Kat?"); prints("Student Takes and devours it"); prints("The rush of sugar has activated his ADD, and he gets distracted by a passing"); prints("bug and leaves"); prints(); eStudent = TAKE; map[3][2].south = true; position = map[3][2].items.begin(); for(finder =0; finder < map[3][2].items.size(); finder++) { if(map[3][2].items.at(finder) == STUDENT) { map[3][2].items.erase(position); } position++; } curSX = -1; curSY = -1; score += 15; drawMenu(); return true; break; } else break; case PS_AC: if( (curX == 3 && curY == 1) && RoomHas(map[3][1].items, NULLSTRING, UBER_GEEK)) { prints("Uber-geek: Thanks, here's your A&W Burger!"); prints("me: munch munch munch munch"); prints(); if(bFed == false) score += 30; bFed = true; return true; break; } else break; case FLOWER: if(curX == 1 && curY == 3 && bUPEtime == false && eGeekette == UNFOUND) { prints(" .*."); prints(" ***"); prints(" V"); prints("/\\|/\\"); prints(" | "); prints(" |"); prints(); prints("Uber Geekette: Thank you very much..."); prints("me: No problem...its from my friend"); prints("Uber Geekette: of course, a real man would have BOUGHT me flowers"); prints("me: -< gulp >-"); prints("Uber Geekette: Now I think I want a Soda..."); prints("me: ok ok"); prints(); score += 10; eGeekette = FOUND; return true; break; } else break; case LOVELETTER:if(curX == 1 && curY == 3 && bUPEtime == false && eGeekette == TAKE) { prints("me: one love letter"); prints("Uber Geekette: Yay!"); prints("me: NOW?"); prints("Uber Geekette: Ok, I'll smooth things over ..."); prints(); score += 20; eGeekette = DONE; return true; break; } else break; case SODA:if(curX == 1 && curY == 3 && bUPEtime == false && eGeekette == FOUND) { prints("Uber Geekette: Thanks, I needed that, the Caffine has cleared my mind"); prints("me: You mean you've seen the light, and you'll help me now?"); prints("Uber Geekette: No, I still need something thats not store bought"); prints("me: like another flower"); prints("Uber Geekette: OR something that you didn't just find on the floor"); prints("me: What?"); prints("Uber Geekette: A love letter"); prints("me: OK OK, I'll get you a love letter"); prints(); score += 10; eGeekette = TAKE; map[2][1].items.push_back(LOVELETTER); return true; break; } else break; default: prints("No one here even WANTS that"); prints(); inventory.push_back(itemRequested); break; } prints(); return true; } else { prints("Nah, I'll keep it..."); } } else prints("Umm...I don't even know what you're talking about.."); prints(); return false; } //purpose: to activate the use command bool use(string word1, string word2, string word3, string word4) { int itemRequested=0; string str; vector::iterator position; if((word1.size==0))//if word1 is AT { prints("Take What?"); prints(); return false; } itemRequested = identifyObject(word1, word2, word3, word4); if(itemRequested == -1) { prints("I don't see any of those!"); prints(); return false; } if(RoomHas(map[curX][curY].items, inventory, itemRequested)) { switch(itemRequested) { case DDR_PAD: if(guilt > 75) { prints("You failed on Easy...you were too guilty to Dance!"); score += 10; } else if(guilt > 50) { prints("You made it to medium, your guilt got to you..."); score += 20; } else if(guilt > 25) { prints("You made it to hard, your a dancing FOOL"); score += 30; } else { prints("You passed INSAINE!!! You are a DDR King!"); prints("You also get to wear the DDR crown for the entire game!"); score +=50; inventory.push_back(CROWN); } prints(); prints("You were the last to dance, but you *volunteered* to help clean for 40 mintues"); theTime += 39; bDanced = true; break; case MONEY: { if(curX == 2 && curY == 2) { eKitKat = FOUND; prints("The Vending Machine gave out a Kit-Kat, like I gave you a choice :-P"); prints(); position = find(inventory.begin(), inventory.end(), MONEY); if(position != inventory.end()) inventory.erase(position); else { position = find(map[curX][curY].items.begin(), map[curX][curY].items.end(), MONEY); map[curX][curY].items.erase(position); } bMoney = false; map[2][2].items.push_back(KIT_KAT); return true; break; } else { prints("I don't want to spend my money on that"); } break; } case SUN_GLASSES: { prints("Wow these are the coolest sunglasses I have ever found..."); prints("I'm going to place these on my face, and never take them off"); prints("Wear them inside and out, and no one will mind, or notice"); prints(); map[0][2].items.push_back(FLOWER); map[0][2].desc = "Outside"; bSunGlasses = true; position = find(inventory.begin(), inventory.end(), SUN_GLASSES); if(position != inventory.end()) inventory.erase(position); else { position = find(map[curX][curY].items.begin(), map[curX][curY].items.end(), SUN_GLASSES); map[curX][curY].items.erase(position); } break; } case WEB_CAM: { prints("I need to PLACE the web cam"); prints(); break; } case SODA: case WATER: { position = find(inventory.begin(), inventory.end(), itemRequested); if(position != inventory.end()) inventory.erase(position); else { position = find(map[curX][curY].items.begin(), map[curX][curY].items.end(), itemRequested); map[curX][curY].items.erase(position); } prints("You Drank it..."); if(bPee == false) Peetime = theTime + 30; bPee = true; } break; default: prints("I'm too bored to use that thing...");break; } prints(); return true; } else prints("Umm...I don't even know what you're talking about.."); prints(); return false; } //this is for drop / place an tiem bool Place(string word1, string word2, string word3, string word4) { int itemRequested=0; int x; string str; if((word1.size==0))//if word1 is AT { prints("Take What?"); prints(); return false; } itemRequested = identifyObject(word1, word2, word3, word4); if(itemRequested == -1) { prints("I don't see any of those!"); prints(); return false; } if(RoomHas(inventory, NULLSTRING, itemRequested)) { vector::iterator position; position = find(inventory.begin(), inventory.end(), itemRequested); inventory.erase(position); //this determains weither you would like to throw away an item rather than dropping it switch(itemRequested) { case FLOWER: case SODA: case WATER: case KIT_KAT: case PANEL: case PIPE: break; default: map[curX][curY].items.push_back(itemRequested); break; } switch(itemRequested){ case TDBOOK: prints("You placed the book on the floor"); break; case CROWBAR: prints("Dropped"); break; case FLOWER: prints("Thrown Away"); break; case KEY: prints("Dropped"); break; case KIT_KAT: prints("Its been on the floor, no one will eat it now"); break; case MONEY: prints("As soon as you dropped it, someone comes along and picked it up"); break; case PANEL: if(curX == curDsX && curY == curDsY) { prints("A Loud Sound rings out, Dr. Spoon runs for cover, your safe...for now"); curDsX = curDsY = -1; Gonetime = theTime + 10; Caughttime = 99999; bMove = false; } else { prints("A Loud Sound rings out, and a Janitor Picks up the Panel"); } break; case PIPE: if(curX == curDsX && curY == curDsY) { prints("The pipe shatters, Dr. Spoon runs for cover, your safe...for now"); curDsX = curDsY = -1; Caughttime = 99999; Gonetime = theTime + 10; bMove = false; } else { prints("The pipe shatters, Pipe Smokin' Dude secretly weeps"); } break; case PS_AC: prints("Dropped"); break; case SCISSOR: prints("Dropped"); break; case SODA: prints("Disapears after it leaves your hand..."); break; case SUN_GLASSES: prints("Go from whince you came"); break; case WATER: prints("As soon as you dropped it, someone came along and picked it up"); break; // case PEN: return N_PEN; break; case WEB_CAM: for(x=0; x< map[curX][curY].items.size(); x++) { if(WALL_SOCKET == map[curX][curY].items.at(x)) { prints("You connect it to the Ethernet Port, you can now see where everyone is"); prints("In game terms, you can see all of the characters on the MAP"); prints(); bWebCam = true; return true; break; } } prints("You Drop the Web-Cam"); break; case MY_PIC: prints("You Dropped the Picture"); break; } prints(); return true; } else prints("Umm...I don't even know what you're talking about.."); prints(); return false; } //purpose: look, to do all the looking functions bool look(string word1, string word2, string word3, string word4) { int x=word1.size(); //look at the room if(word1.size() == 0) { switch(curY) { case 0: switch(curX) { case 0:{//NULL SPACE prints(); prints("Wind Whispers in my ears as I fall into a Virtual Void, I should have "); prints("finished this room but instead I watched Iron Chief"); prints(); prints("GAME OVER, every game has to have one stupid death, time to QUIT"); prints(); break; } case 1:{//SUN LAB prints(); prints("We're in the Sun Lab, I need to do my Graphics Homework on the suns"); prints("To the West is a gaping hole in reality, to the South is the hallway"); prints(); break; } default: return false; } break; case 1: switch(curX) { case 0: {//Yucky Bathroom prints(); prints("This bathroom is due for its yearly cleaning, at least Dr. Yoon doesn't"); prints("Come here often"); prints(); break; } case 1:{//Hallway 6 prints(); prints("Twisted Hallway, All Alike, The Uber-Nerdy lab is East, The Bathroom is west"); prints("to the south is the Huge engine, to the North is the Sun Labs"); prints(); break; } case 2:{//Uber Nerdy Lab prints(); prints("This is the Uber Nerdy Lab, where the Uber Nerd programs..."); //Add stuff menting the web cam prints(); break; } case 3:{ prints(); prints("Restricted Lab, where computers outnumber people 30 to 1"); prints("My computer, my Cooler, my Research, and a huge amount of"); prints("papers need to be graded are"); prints(); break; } default: break; } break; case 2: switch(curX){ case 0: {//Outside prints(); if(bSunGlasses==true) { prints("I see Flowers of all kinds and colors"); prints("Hopefully, if I stay out here, my monitor tan will disspear"); } else { prints("The yellow face *BURNS* me!"); prints("IT HURTS! IT HURTS!"); } prints(); break; } case 1: {//Engine hallway prints(); prints("A large FORD engine is sitting on a Pedestal"); prints(); break; } case 2: {//Vending Machine prints(); prints("Stupid Vending Machines"); if(bKitKat == false) prints("mmm...kit kats...mmm"); if(bWebCam == false) { prints("I also see a new ethernet port above the vending machine"); if(bWebCamLook == false) { bWebCamLook = true; map[2][2].items.push_back(WALL_SOCKET); } } else prints("The WebCam is working Great"); if(bMoney == true) prints("I see some Mon-ay in the Pop Machine"); prints(); break; } case 3: {//HW5 prints(); prints("This is Smoking Guy's Domain, to the North is my office,"); prints("to the south is a vacant room"); prints(); break; } default: break; } break; case 3: switch(curX){ case 1: {//ACM Office prints(); prints("The ACM office / converted closet, the Uber Geekette sits happily"); prints("10 bucks for ACM, 35 for UPE :D"); prints(); break; } case 2: { // Picture Hallway prints(); prints("This hallway contains the pictures of grads from 1960s to 2002"); if(bPicQuest == false) prints("I always wanted to be in the pictures of grads from 1970s"); else prints("I look good"); prints(); break; } case 3: { //Vacant room prints(); prints("This room is used for meetings and stuff, and Dr. Yoon never comes in here"); prints(); break; } default: break; } break; case 4: switch(curX) { case 1: {//Dr. Spoon's Office prints(); prints("Dr. Spoons' Office! Oh no! I gotta get in here and get out as fast as possible!"); if(bTBook ==false) prints("The 3D book is on the Counter"); else prints("Why am I still here?"); prints(); break; } case 2: {//Hallway 2 prints(); prints("This is a hallway, to the west is Dr. Spoon's office, to the east is"); prints("The bathroom"); prints(); break; } case 3: {//Nice Bathroon prints(); prints("This is the clean but dangerous bathroom...Dr. Spoon visits it"); prints("But its worth it, it has the largest selection of Urinals on Campus"); prints(); break; } default: break; } break; case 5: switch(curX){ case 1: {//CIS OFfice TODO: add lots of objects prints(); prints("Laura is sitting here"); prints(); break; } case 2: { //HW2 prints(); prints("The hallway...to the west is the CIS office..."); prints(); break; } default: break; } break; case 6: if(curX == 2) { prints(); if(bDDRtime == false) { prints("This is where Game design takes place"); } else { prints("Time to Dance! Time to Dance! Time to Dance!"); } prints(); } break; default:break; } return false; } else { int itemRequested=0; if((word1.compare("AT")==0))//if word1 is AT { word1 = word2; word2 = word3; word3 = word4; word4 = ""; } itemRequested = identifyObject(word1, word2, word3, word4); if(itemRequested == -1) itemRequested = identifyPerson(word1, word2); // cout << " ? ? " << theItems(itemRequested) << "->" << RoomHas(map[curX][curY].items, inventory, itemRequested); if(RoomHas(map[curX][curY].items, inventory, itemRequested)) { // string str="We Have "; prints(theItemsDesc(itemRequested)); //if the item is a cooler, and the room doesn't have soda or water if(itemRequested == COOLER) { bool yesSoda = false, yesH20 = false; //see if there is water for(int count =0; count < map[curX][curY].items.size(); count++) { if(map[curX][curY].items.at(count) == SODA) yesSoda = true; if(map[curX][curY].items.at(count) == WATER) yesH20 = true; } //no soda if(!yesSoda) { map[curX][curY].items.push_back(SODA); prints("I Found Another Soda"); } if(!yesH20) { map[curX][curY].items.push_back(WATER); prints("I Found Another Flavored Water"); } } prints(); } else { string str="I don't see any "; prints(str + word1); prints(); return false; } } return false; } //purpose: trip leading white spaces void nowsp(string &str) { //prevents illegal referances if(str.size() == 0) return; //Trim White Spaces while(true) { if(str.size() == 0) break; if(str.at(0) == ' ') str.erase(str.begin()); else break; } } //purpose: prints out your inventory void Inventory(void) { char buffer[80]; string str; prints(); str = "My Guilt rating is "; prints(str + _itoa(guilt, buffer,10)); str = "My Score is "; prints(str + _itoa(score, buffer,10)); str = "The Time is "; prints(str + convertTime(theTime)); prints(); prints("I Have:"); for(int x=0; x &str, int offset) { int spaces = 0; offset += 2; string me_string1; string me_string2; string me_string3; string me_string4; string t_string; me_string1 = ""; me_string2 = ""; me_string3 = ""; me_string4 = ""; if(Y == 0) { if(X == 0) { me_string1 ="| " + name + string(13 - name.size(), ' '); me_string2 =" |"; } else { me_string1 ="| "; me_string2 =" " + name + string(13 - name.size(), ' ') + "|"; } t_string = me_string1 + me_string2; str.insert(str.begin() + offset + 2*Y, t_string); return; } if(Y == 1) { if(X == 0) { me_string1 ="| " + name + string(13 - name.size(), ' '); me_string2 =" "; me_string3 =" |"; me_string4 =" |"; } else if(X == 1) { me_string1 ="| "; me_string2 =" " + name + string(13 - name.size(), ' ') + " "; me_string3 =" |"; me_string4 =" |"; } else if(X == 2) { me_string1 ="| "; me_string2 =" "; me_string3 =" " + name + string(13 - name.size(), ' ') + "|"; me_string4 =" |"; } else { me_string1 ="| "; me_string2 =" "; me_string3 =" |"; me_string4 =" " + name + string(13 - name.size(), ' ') + "|"; } t_string = me_string1 + me_string2 + me_string3 + me_string4; str.insert(str.begin() + offset + 2*Y, t_string); return; } if(Y == 2) { if(X == 0) { me_string1 ="| " + name + string(13 - name.size(), ' '); me_string2 =" "; me_string3 =" "; me_string4 =" |"; } else if(X == 1) { me_string1 ="| "; me_string2 =" " + name + string(13 - name.size(), ' ') + " "; me_string3 =" "; me_string4 =" |"; } else if(X == 2) { me_string1 ="| "; me_string2 =" "; me_string3 =" " + name + string(13 - name.size(), ' ') + " "; me_string4 =" |"; } else { me_string1 ="| "; me_string2 =" "; me_string3 =" "; me_string4 =" " + name + string(13 - name.size(), ' ') + "|"; } t_string = me_string1 + me_string2 + me_string3 + me_string4; str.insert(str.begin() + offset + 2*Y, t_string); return; } if(Y == 3) { if(X == 1) { me_string1 =" |"; me_string2 =" " + name + string(13 - name.size(), ' ') + " "; me_string3 =" |"; me_string4 =" |"; } else if(X == 2) { me_string1 =" |"; me_string2 =" "; me_string3 =" " + name + string(13 - name.size(), ' ') + "|"; me_string4 =" |"; } else { me_string1 =" |"; me_string2 =" "; me_string3 =" |"; me_string4 =" " + name + string(13 - name.size(), ' ') + "|"; } t_string = me_string1 + me_string2 + me_string3 + me_string4; str.insert(str.begin() + offset + 2*Y, t_string); return; } if(Y == 4) { if(X == 1) { me_string1 =" |"; me_string2 =" " + name + string(13 - name.size(), ' ') + " "; me_string3 =" "; me_string4 =" |"; } else if(X == 2) { me_string1 =" |"; me_string2 =" "; me_string3 =" " + name + string(13 - name.size(), ' ') + " "; me_string4 =" |"; } else { me_string1 =" |"; me_string2 =" "; me_string3 =" "; me_string4 =" " + name + string(13 - name.size(), ' ') + "|"; } t_string = me_string1 + me_string2 + me_string3 + me_string4; str.insert(str.begin() + offset + 2*Y, t_string); return; } if(Y == 5) { if(X == 1) { me_string1 =" |"; me_string2 =" " + name + string(13 - name.size(), ' ') + " "; me_string3 =" |"; me_string4 =" "; } else { me_string1 =" |"; me_string2 =" "; me_string3 =" " + name + string(13 - name.size(), ' ') + "|"; me_string4 =" "; } t_string = me_string1 + me_string2 + me_string3 + me_string4; str.insert(str.begin() + offset + 2*Y, t_string); return; } me_string1 = " | " + name + string(13-name.size(), ' ') + " |"; str.insert(str.begin() + offset + 2*Y, me_string1); } // str.insert(str.begin() + 2 + 2*curY, "I'm Here"); //purpose: to display a map void displayMap(void) { vector str; string me_string; string person; int offset =0; str.push_back("+-----------------+-----------------+ "); str.push_back("| Hot Babes Room SUN lab | "); str.push_back("+-----------------+----- ------+-----------------+-----------------+"); str.push_back("| Yucky Bathroom Uber nerdy Lab | Secure Lab |"); str.push_back("+-----------------+----- ------+-----------------+----- ------+"); str.push_back("| Outside Engine Hallway Vending Machine |"); str.push_back("+-----------------+-----------------+----- ------+----- ------+"); str.push_back(" | ACM Office | Vacent Room |"); str.push_back(" +-----------------+----- ------+-----------------+"); str.push_back(" | Dr.Spoon Office Bathroom |"); str.push_back(" +-----------------+----- ------+-----------------+"); str.push_back(" | CIS office | "); str.push_back(" +-----------------+----- ------+ "); str.push_back(" | ELB 198 | "); str.push_back(" +-----------------+ "); placePeople("", curX, curY, str, offset); if(bWebCam == true) { if(curSX != -1) { if(curSY >= curY) offset++; placePeople("", curSX, curSY, str, offset); } if(curDsX != -1) { if(curDsY >= curY) offset++; placePeople("",curDsX, curDsY, str, offset); } } prints(str); } //purpose: to initlize a game void initGame(void) { curX = 3; curY = 1; scrollText.resize(19); NULLSTRING.clear(); srand( (unsigned)time( NULL ) ); /* map[][].desc = ""; map[][].north = true; map[][].south = true; map[][].east = false; map[][].west = false; */ map[0][0].desc = "An Eternal Void of Virtual Nothingness!!! I'm falling!"; map[0][0].north = false; map[0][0].south = false; map[0][0].east = false; map[0][0].west = false; //sunlab map[1][0].desc = "SunLab, 1180 ELB "; map[1][0].north = false; map[1][0].south = true; map[1][0].east = false; map[1][0].west = true; map[1][0].items.push_back(COMPUTER); map[1][0].items.push_back(CHAIR); map[1][0].items.push_back(PRINTER); //Bathroom II map[0][1].desc = "Yucky Bathroom"; map[0][1].north = false; map[0][1].south = false; map[0][1].east = true; map[0][1].west = false; map[0][1].items.push_back(PEE_TOLIET); //Hallway 6 // map[1][1].desc = "Twisty Hallway, all alike, except the Uber Nerdy lab is to the east, Bathrooms to the West, and the sunlabs to the north"; map[1][1].desc = "Twisty Hallway, All alike"; map[1][1].north = true; map[1][1].south = true; map[1][1].east = true; map[1][1].west = true; // map[1][1].items.push_back(0); //Matt's Office map[2][1].desc = "Uber-nerdy lab, where true nerds work"; map[2][1].north = false; map[2][1].south = false; map[2][1].east = false; map[2][1].west = true; map[2][1].items.push_back(COMPUTER); map[2][1].items.push_back(UBER_GEEK); map[2][1].items.push_back(WEB_CAM); // map[2][1].items.push_back(COMPUTER); //My Office map[3][1].desc = "My Office, Restricted Lab ELB 153!"; map[3][1].north = false; map[3][1].south = true; map[3][1].east = false; map[3][1].west = false; map[3][1].items.push_back(COMPUTER); map[3][1].items.push_back(CHAIR); map[3][1].items.push_back(COOLER); map[3][1].items.push_back(WATER); map[3][1].items.push_back(SODA); //Outside map[0][2].desc = "Outside, The yellow face burns me"; map[0][2].north = false; map[0][2].south = false; map[0][2].east = true; map[0][2].west = false; // map[0][2].items.push_back(0); //Engine Room map[1][2].desc = "Engine Hallway"; map[1][2].north = true; map[1][2].south = false; map[1][2].east = true; map[1][2].west = true; map[1][2].items.push_back(ENGINE); //Hallway 4 map[2][2].desc = "Another Hallway, this one has a vending machine AND a pop machine"; map[2][2].north = false; map[2][2].south = true; map[2][2].east = true; map[2][2].west = true; map[2][2].items.push_back(VENDING_MACHINE); map[2][2].items.push_back(POP_MACHINE); //Hallway 5 map[3][2].desc = "This is the dank hallway, far away from everybody"; map[3][2].north = true; map[3][2].south = true; map[3][2].east = false; map[3][2].west = true; // map[3][2].items.push_back(0); //ACM office map[1][3].desc = "ACM office(or converted closet)..."; map[1][3].north = false; map[1][3].south = false; map[1][3].east = true; map[1][3].west = false; map[1][3].items.push_back(UBER_GEEKETTE); map[1][3].items.push_back(COMPUTER); //HW3 map[2][3].desc = "Hallway, picture of prevous graduates line the halls"; map[2][3].north = true; map[2][3].south = true; map[2][3].east = false; map[2][3].west = true; map[2][3].items.push_back(PICTURE); //Room map[3][3].desc = "Vacant Room, A great place to hide from Dr. Spoon"; map[3][3].north = true; map[3][3].south = false; map[3][3].east = false; map[3][3].west = false; // map[3][3].items.push_back(0); //Dr. Spoon's office map[1][4].desc = "Dr. Spoon's Office, A great place, Not!"; map[1][4].north = false; map[1][4].south = false; map[1][4].east = true; map[1][4].west = false; map[1][4].items.push_back(TDBOOK); //HW 2 map[2][4].desc = "Twisty Hallway, all different."; map[2][4].north = true; map[2][4].south = true; map[2][4].east = true; map[2][4].west = true; // map[2][4].items.push_back(0); //Bathroom I Good map[3][4].desc = "Great Bathroom"; map[3][4].north = false; map[3][4].south = false; map[3][4].east = false; map[3][4].west = true; map[3][4].items.push_back(PEE_TOLIET); //CIS office map[1][5].desc = "114 ELB, Nice and Friendly CIS office"; map[1][5].north = false; map[1][5].south = false; map[1][5].east = true; map[1][5].west = false; map[1][5].items.push_back(SCISSOR); // map[1][5].items.push_back(0); //Hallway 1 map[2][5].desc = "A hallway, untypically clean for the ELB"; map[2][5].north = true; map[2][5].south = true; map[2][5].east = false; map[2][5].west = true; // map[2][5].items.push_back(0); map[2][6].desc = "198 ELB"; map[2][6].north = true; map[2][6].south = false; map[2][6].east = false; map[2][6].west = false; // map[2][6].items.push_back(0); //TODO: Add Random Items int ranNum; ranNum = rand() % 4; //place sunglasses switch(ranNum) { case 0: map[1][5].items.push_back(SUN_GLASSES); break;//cis office case 1: map[1][2].items.push_back(SUN_GLASSES); break; case 2: map[0][1].items.push_back(SUN_GLASSES); break; case 3: map[3][4].items.push_back(SUN_GLASSES); break; default: break; } ranNum = rand() % 6; //place DDR flyer switch(ranNum) { case 0: map[1][1].items.push_back(DDR_FLYER); break;//cis office case 1: map[1][2].items.push_back(DDR_FLYER); break; case 2: map[2][3].items.push_back(DDR_FLYER); break; case 3: map[2][4].items.push_back(DDR_FLYER); break; case 4: map[2][5].items.push_back(DDR_FLYER); break; case 5: map[3][2].items.push_back(DDR_FLYER); break; default: break; } DDRtime = rand() & 301 ; UPEtime = rand() % 301; DrSpoontime = rand() % 301; Officetime = rand() % 301; Brotime = rand() % 301; Smoketime = rand() % 301; //Start prints("Ah, I don't feel like doing work today! I have all these papers to grade,"); prints("and all of this research to do. I know, why don't I just slack off today,"); prints("hopefully, tomorrow, I'll be more in the mood to finish this..."); prints(); prints("Now the only problem is, I have to avoid Dr. Spoon and any students that try to"); prints("attend my office hours...while trying to keep myself entertained, fed, and maybe"); prints("finishing my Game Design homework...I'll need a Sun and the book that I lent"); prints("Dr. Spoon..."); prints(); prints("Please God! Let me make it to 6:00pm..."); prints(); } //purpose: to draw a menu void drawMenu(void) { string spaces;//spaces to add int count;//count of letters setcursor(0,0); setcolor(FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE | BACKGROUND_GREEN); spaces = string(80-map[curX][curY].desc.size(),' '); //print the description cout << map[curX][curY].desc << spaces; getItems(itemList, map[curX][curY].items); itemList = "Items in sight: " + itemList; //print items in sight // spaces = string(80-16-map[curX][curY].items.size(),' '); //cout << "Items in sight: "; << map[curX][curY].items << spaces; //extra space incase we need more description space //cout << string(80, ' '); if(itemList.size() > 80) {//TODO: Add Word Wrap :( spaces = string(160- itemList.size(), ' '); cout << itemList.substr(0, 80); cout << itemList.substr(80, itemList.size()) << spaces; } else { spaces = string(80-itemList.size(),' '); cout << itemList << spaces; cout << string(80, ' '); } cout << "Other Areas: "; count = 13; //Print Ways we can go if(map[curX][curY].north) { cout << "North, "; count += 7; } if(map[curX][curY].south) { cout << "South, "; count +=7; } if(map[curX][curY].east) { cout << "East, "; count += 6; } if(map[curX][curY].west) { cout << "West, "; count += 6; } count-=2; setcursor(count, 3); cout << string(80-count, ' '); setcolor(FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE); } //purpose: Draw the Blue and Gold Part of the screen //Gparam: scrollText void drawScrollingText(void) { // string spaces; setcolor(FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE); setcursor(0,4); for(int x=0; x< scrollText.size(); x++) { cout << scrollText[x] << string(80-scrollText[x].size(), ' '); } //erase last line cout << string(80, ' '); } //purpose: To Draw The bottom line...for fun sake void drawColors() { setcursor(0,24); setcolor(FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE); cout << string(80,' '); } //Parse phrase into up to three words int parseWord(string str, string &one, string &two, string &three, string &four, string &five) { string word = str; int count=1; string::size_type tilSpace; while(true) { tilSpace = word.find(' '); switch(count){ case 1: one = word.substr(0, tilSpace);break; case 2: two = word.substr(0, tilSpace);break; case 3: three = word.substr(0, tilSpace);break; case 4: four = word.substr(0, tilSpace);break; case 5: five = word.substr(0, tilSpace);return 5; break; default: break; } word.erase(0, tilSpace); if(word.size() == 0) return count; nowsp(word); count++; } // cout << word; } //purpose: to parse while seated void computerParse(string word1, string word2, string word3, string word4, string word5) { int count; char buffer[80]; switch(toNumbers(word1)) { case 215://aim-mine if(curX == 3) { switch(toNumbers(word2)) { case 422://fiance if(eGeekette == DONE) { prints("FIANCE: Would you like to pick out cards??"); prints("ME: umm...errr...maybe"); prints("FIANCE: We have to plan this wedding TOGETHER..."); prints("ME: ok"); } else { bFiance = true; prints("FIANCE: I don't like you anymore"); prints("ME: WHAT? :'("); prints("FIANCE: If you don't what you did, I'm not telling"); prints("Note to self: uber geekette is my fiance's best friend,"); prints("I bet she knows what going on"); } prints(); return; break; case 227://bro if((Brotime < theTime && theTime < Brotime + 60) && bBro == false) { prints("ME: What's for dinner"); prints("Bro: Poop"); prints("ME: no really"); prints("Bro: Poop, really"); prints("Bro is offline"); prints("That is why I don't usually talk to my brother"); bBro = true; score += 10; } else { prints("bro is offline"); } prints(); return; break; case 681://UBER_GEEK if(theTime > 120 && theTime < 250 && bFed == false) { prints("UBER_GEEK: Hey, wanna get a bite to eat?"); prints("ME: Nah, I don't have money..."); prints("UBER_GEEK: If your bring me the Playstation Addapter, then"); prints("I'll give you some food for free"); prints("ME: maybe, where is it?"); prints("Its in your mailbox, in the CIS office..."); if(bPS_AC == false) { map[1][5].items.push_back(PS_AC); } } else { prints("UBER_GEEK is offline"); } prints(); return; break; case 512://buddies prints("My Buddies include, BRO, UBER_GEEK, FIANCE"); // prints("todo: print weither they are online or not :-P"); if((Brotime < theTime && theTime < Brotime + 60) && bBro == false) { prints("BRO is Online"); } else { prints("BRO is Offline"); } if(theTime > 120 && theTime < 250 && bFed == false) { prints("UBER_GEEK is online"); } else { prints("UBER_GEEK is offline"); } prints("FIANCE is online"); prints(); return; break; default: prints("Type aim Buddies find out who you can talk to"); prints(); return; break; } } else { prints("I'm not allowed to AIM here"); prints(); return; break; } case 589://research-mine case 335://grade-mine if(curX == 3) { count = atoi(word2.c_str()); guilt -= count; if(guilt < 0) guilt = 0; word2 = _itoa(count, buffer, 10); prints("I did " + word2 + " minutes of work"); word2 = "My guilt level is now "; prints(word2 + _itoa(guilt, buffer, 10)); prints(); return; } else { prints("I cannot research or grade in the sun labs..."); prints("I need a Win32 machine to do my work"); prints(); return; } break; case 300://pine-mine if(curX==3) { prints("I'll give you the short verson..."); prints(); prints("From: UBER_GEEKETTE"); prints("Subject: UPE Food-age"); prints("-----------------------------------------"); prints(" blah blah blah blah blah"); prints(" blah blah blah free food " + convertTime(UPEtime)); prints(" blah blah blah blah blah"); prints("-----------------------------------------"); prints(); prints("I guess I have to welcome the new recruits..."); prints("I guess I have to eat their food :D"); } else { prints("hehe, I only enjoy checking my email from my desk"); } prints(); return; break; case 378://stand-all prints("You stand up"); prints(); bsit = false; return; break; case 466://browse-all if(word2.compare("FARK") == 0) { if(bFark == false) { score += 10; bFark = true; } switch(rand() % 7){ case 0: prints("HOMESTARRUNNER.COM SPIFFY Best StrongBad Ever!"); prints("I love StrongBad! hehe"); break; case 1: prints("(some floridan) FLORDA Guess who the US tested Bio Warfare at?"); prints("This should be labeled scary"); break; case 2: prints("(some Guy) DUMBASS Burger King boss phones in sniper report to get day off"); prints("good use of the dumbass tag"); break; case 3: prints("REUTERS INTERESTING Dude, you're done. Dell gives Steven the boot"); prints("Dude, your getting porn!"); break; case 4: prints("(some farker) PHOTOSHOP Photoshop your verson of the terror alert system"); prints("Critical: Charlse manson is under your bed :-D"); break; case 5: prints("(GQ) COOL Some guy wins lottery twice with same numbers"); break; case 6: prints("CAT.TV INTERESTING 4 in 10 Americans want to annex Canada."); prints("I've always called it our 51st state..."); break; default: prints("no new news...."); break; } } else if(word2.compare("GAMEDEV") == 0) { if(bGamedev == false) { score +=10; bGamedev = true; } prints("No new tutorials...but the ones they have are good..."); } else if(word2.compare("NEHE") == 0) { if(bNeHe == false) { score +=10; bNeHe = true; } prints("Tutorial 8000 posted!"); prints("how to make quake 2 in one line of perl"); } else if(word2.compare("FAVORITES") == 0) { prints("NeHe"); prints("GameDev"); prints("Slashdot"); prints("OwnSite"); prints("Fark"); } else if(word2.compare("SLASHDOT") == 0) { if(bSlashdot == false) { score += 10; bSlashdot = true; } switch(rand() % 7){ case 0: prints("Jon Katz writes a shockingly stupid report about how much better linux is"); prints("than windows, trolling ensues"); break; case 1: prints("Linux is better than windows, and more compatible with hardware than windows"); prints("is, in fact, if your not using Linux, your stupid"); break; case 2: prints("Linux should be called GNU/Linux, because its easy to remember"); prints("trolling ensuses"); break; case 3: prints("Ashcroft enacts cryptography back door act, now barbie phone"); prints("must have a backdoor"); break; case 4: prints("Cool robot cars"); prints("cool!"); break; case 5: prints("Report tells weather Linux is cheaper than Windows"); prints("ah, the power of slashdot spellcheck..."); break; case 6: prints("Japanese Toliets - the next frontier"); prints(""); break; default:prints("No new news stories today"); break; } } else if(word2.compare("OWNSITE") == 0) { prints("Office Hours are as follows"); prints("Starts : " + convertTime(UPEtime)); prints("Ends : " + convertTime(UPEtime+60)); prints(); prints("My large picture is staring at me :("); } else if (word2.compare("PORN") == 0 ) { if(bPorn == false) { score += 20; bPorn = true; prints("yay for nudity"); } else { prints("You do know, the school logges all traffic..."); prints("I might get fired"); prints("if I implemented a firing routine like I though I was going to"); prints("instead of making this a easter egg"); } } else { prints("Error 404"); } prints(); return; break; case 297://help-all if(curX==1) { prints("While at the computer, you can do several things:"); prints("Browse type in BROWSE FAVORITES to see all the choices"); // prints("Print prints your current page"); prints("Homework do your homework"); prints("Stand stand up, you will automaticall log out"); } else { prints("While at the computer, you can do several things:"); prints("Browse type in BROWSE FAVORITES to see all the choices"); prints("AIM type in AIM BUDDIES to see all the buddies online"); prints("Research type in minutes of research to do"); prints("Grade type in minutes of grading to do"); prints("Pine read your emails"); } prints(); return; break; case 620://homework-sun if(bHomework== true) { prints("You've done your homework already..."); prints("going too far ahead would be pointless in a game about slacking off..."); prints(); return; break; } else if(curX==1) { for(count=0; count < inventory.size(); count++) { if(inventory.at(count) == TDBOOK) { prints("Homework Accomplished!"); prints(); score +=20; bHomework = true; return; break; } } prints("You need the 3d book from Dr. Spoon"); prints(); return; break; } else prints("I can't do that here"); prints(); return; break; case 397://print-sun if(curX == 1 && curY ==0) { prints("I'm saving printing for Verson 1.2"); prints(); return; break; } prints("I don't have a printer"); prints(); return; break; default: prints("I can't do that while I'm sitting"); prints(); return; break; } } void parse(string comText) { //Add a blank space // scrollText.erase(scrollText.begin()); // scrollText.push_back(" "); prints(); char buffer[80]; int itemRequested=0; if(comText.size() == 0) return; int numOfWords=0; string fstWord = ""; string sndWord = ""; string trdWord = ""; string forWord = ""; string fifWord = ""; numOfWords = parseWord(comText, fstWord, sndWord, trdWord, forWord, fifWord); // cout << numOfWords << " " << fstWord << "!" << sndWord << "?" << trdWord<< "." << forWord << ".." << fifWord; //TODO: make an erase function that erases that, if the and other helper verbs //erase go if(!fstWord.compare("GO")) { fstWord = sndWord; sndWord = trdWord; trdWord = forWord; forWord = fifWord; numOfWords--; } if(bsit == true) { computerParse(fstWord, sndWord, trdWord, forWord, fifWord); return; } switch(toNumbers(fstWord)) { // case 309://look case 458://lookat { look(sndWord, trdWord, forWord, fifWord); drawMenu(); }break; case 395:// north case 78:// N if(map[curX][curY].north && bMove == false) { curY--; drawMenu(); } else if(bMove ==true) { prints("I cannot move!"); prints(); } else { // scrollText.erase(scrollText.begin()); // scrollText.push_back("Umm...You can't go North"); // scrollText.erase(scrollText.begin()); // scrollText.push_back(" "); prints("Umm...You can't go North"); prints(); } return; break; case 403://South case 83://S if(map[curX][curY].south && bMove == false) { curY++; drawMenu(); } else if(bMove ==true) { prints("I cannot move!"); prints(); } else { //add a blank space // scrollText.erase(scrollText.begin()); // scrollText.push_back("Umm...You can't go South"); // scrollText.erase(scrollText.begin()); // scrollText.push_back(" "); prints("Umm...You can't go South"); prints(); } return;break; case 301://east case 69: //e if(map[curX][curY].east && bMove == false) { curX++; drawMenu(); } else if(bMove ==true) { prints("I cannot move!"); prints(); } else { //add a blank space // scrollText.erase(scrollText.begin()); // scrollText.push_back("Umm...You can't go East"); // scrollText.erase(scrollText.begin()); // scrollText.push_back(" "); prints("Umm...You can't go East"); prints(); } return; break; case 323://west case 87://w if(map[curX][curY].west && bMove == false) { curX--; drawMenu(); } else if(bMove ==true) { prints("I cannot move!"); prints(); } else { //add a blank space // scrollText.erase(scrollText.begin()); // scrollText.push_back("Umm...You can't go West"); // scrollText.erase(scrollText.begin()); // scrollText.push_back(" "); prints("Umm...You can't go West"); prints(); } return; break; case 718://inventory case 73: //i Inventory(); return; break; case 293://take case 224://get // case 284://grab if(Take(sndWord, trdWord, forWord, fifWord)) drawMenu(); return; break; case 535://install case 357://place // case 309://drop if(Place(sndWord, trdWord, forWord, fifWord)) drawMenu(); return; break; case 222://map displayMap(); return; break; case 303://time & wear if(fstWord.compare("TIME")== 0) { prints("The Time is: " + convertTime(theTime)); // prints(convertTime(DDRtime)); // prints(_itoa(theTime, buffer, 10)); // prints(convertTime(UPEtime)); // prints(convertTime(Smoketime)); // prints(convertTime(DrSpoontime)); // prints(convertTime(Officetime)); prints(); return; break; }//goes down to wear // case 240: //money // case 303: //wear case 249: //put case 237: //use use(sndWord, trdWord, forWord, fifWord); drawMenu(); return; break; case 299: //give give(sndWord, trdWord, forWord, fifWord); return; break; case 347: //dance use("PAD", trdWord, forWord, fifWord); return; break; case 218://eat if((curX == 3 && curY == 3) && bUPEtime == true) { prints("Pizza has been eaten"); prints(); if(bFed == false) { score += 30; prints("Score increased"); } bFed = true; return; break; } else { prints("I see nothing to eat of any value"); return; break; } case 300: //talk if(curX == 1 && curY == 3 && bUPEtime == false) { switch(eGeekette){ case UNFOUND: if(bFiance == true) { prints("me: Do you know why my fiance hates me?"); prints("Uber Geekette: Yes, you should know what you did"); prints("me: no I don't!"); prints("Uber Geekette: Fine, if you set me up with a guy, I will fix things with you"); prints("me: Arn't you being a bit of a sterotypical video game girl? One who sits"); prints(" around and makes guys to things, the old pricess toadstool syndrome?"); prints("Uber Geekette: Yes, but of course, its not like you didn't program me to act"); prints(" this way..."); prints("me: true true"); prints("Uber Geekette: I want a guy who gives me flowers"); prints("me to self: so it begins, setting up Uber Geek w/Uber Geekette"); prints(); } else { prints("me: Hello"); prints("Uber Geekette: Hi"); } break; case FOUND: prints("Uber Geekette: Where is my drink?"); prints("me to self: I feel like Lesure Suit Larry"); prints(); break; case TAKE: prints("Uber Geekette: Where is my Love Letter"); prints("me to self:I feel like I'm in Chris Saurwald's and Matt Jones's Game"); prints(); break; case DONE: prints("Uber Geekette: Thank you very much, I've patched things up with your fiance"); prints("me: GREAT!"); prints(); break; default : prints("ERROR"); break;} return; } else if(curX == curDsX && curY == curDsY) { prints("ummm...errr...ahhh..."); prints(); return; } else if(curX == curSX && curY == curSY) { prints("umm...I'm not really a GSI, thats an A^2 term..."); prints("I'm a GRSA"); prints(); return; } else { prints("There is no one WORTH talking to here"); prints(); return; } case 376://drink use(sndWord, trdWord, forWord, fifWord); return; case 536://urinate if(bPee == false) { prints("I don't have to pee, yet"); } else if(curX == 0 && curY == 1) { prints("Ahhhh...Its crummmy, but its good"); score += 5; bPee = false; bPeeMessage = false; Peetime = 99999; } else if(curX == 3 && curY == 4) { prints("Thank you, I'm glad I have the urinal of my choice"); score += 10; bPee = false; bPeeMessage = false; Peetime = 99999; } else prints("I cannot pee here!"); prints(); break; /////////////////////collisions case 309://drop and look if(fstWord.compare("LOOK") == 0) { look(sndWord, trdWord, forWord, fifWord); drawMenu(); } else { if(Place(sndWord, trdWord, forWord, fifWord)) drawMenu(); } break; case 284://read and Grab if(fstWord.compare("GRAB") == 0) { if(Take(sndWord, trdWord, forWord, fifWord)) drawMenu(); return; break; } else { if(RoomHas(map[curX][curY].items, NULLSTRING, DDR_FLYER)) { prints("+------------------------------------+"); prints("| Dance Dance Revolution Party! |"); prints("| Today Only... |"); prints("| " + convertTime(DDRtime) + string(23 - convertTime(DDRtime).size(), ' ') + "|"); prints("| |"); prints("| Free, be a star! |"); prints("| Dance Dance the day away! |"); prints("| 198 ELB |"); prints("+------------------------------------+"); prints(); prints("Thats today? I'm there dude!"); prints(); return; } else { prints("Ummm...Read what? I don't see anything to read"); prints(); } return; break; } break; case 240://sit & money if(fstWord.compare("SIT") == 0) { if(RoomHas(map[curX][curY].items, inventory, CHAIR)) { if(curX == 1 && curY == 0) prints("I'm sitting at the computer, I can now only PRINT, BROWSE, HOMEWORK, and Stand"); if(curX == 3 && curY == 1) prints("I'm sitting at the computer, I can BROWSE, AIM, RESEARCH, GRADE, PINE and STAND"); prints(); prints("If your unsure how to work the computer, there is an online HELP"); prints(); bsit = true; return; break; } else { prints("There is nowere to Sit"); prints(); return; } } else { use("MONEY","","",""); drawMenu(); return; break; } default: // scrollText.erase(scrollText.begin()); // scrollText.push_back("I'm unsure how to " + fstWord); // scrollText.erase(scrollText.begin()); // scrollText.push_back(" "); prints("I'm unsure how to " + fstWord + "..."); prints(); return; break; } // cout << "!" << comText; /* if(!(comText.compare("NORTH") && comText.compare("N"))) { if(map[curX][curY].north) { curY--; drawMenu(); } else { //add a blank space scrollText.erase(scrollText.begin()); scrollText.push_back("Umm...You can't go North"); scrollText.erase(scrollText.begin()); scrollText.push_back(" "); } return; } if(!(comText.compare("SOUTH") && comText.compare("S"))) { if(map[curX][curY].south) { curY++; drawMenu(); } else { //add a blank space scrollText.erase(scrollText.begin()); scrollText.push_back("Umm...You can't go South"); scrollText.erase(scrollText.begin()); scrollText.push_back(" "); } return; } if(!(comText.compare("WEST") && comText.compare("W"))) { if(map[curX][curY].west) { curX--; drawMenu(); } else { //add a blank space scrollText.erase(scrollText.begin()); scrollText.push_back("Umm...You can't go West"); scrollText.erase(scrollText.begin()); scrollText.push_back(" "); } return; } if(!(comText.compare("EAST") && comText.compare("E"))) { if(map[curX][curY].east) { curX++; drawMenu(); } else { //add a blank space scrollText.erase(scrollText.begin()); scrollText.push_back("Umm...You can't go East"); scrollText.erase(scrollText.begin()); scrollText.push_back(" "); } return; } */ } void main() { //initWindow(); drawColors();// initGame(); drawMenu(); drawScrollingText(); vector::iterator position; string useText;//text from the user string comText;//text for comparing user input char buffer[80]; //init the game // cin.setf(ios::unitbuf); do { setcursor(0, 23); cout << "> "; cin.getline(buffer, 80);// >> useText; useText.assign(buffer); nowsp(useText); // scrollText.erase(scrollText.begin()); // scrollText.push_back("> " + useText); prints("> " + useText); //store useText in comText, and change comtext to all uppers comText = useText; transform(comText.begin(), comText.end(), comText.begin(), toupper); //exit from the game? if(!(comText.compare("EXIT") && comText.compare("QUIT"))) { drawScrollingText(); setcursor(0,23); cout << "Exit [Y\\N]? "; cin.getline(buffer, 80); useText.assign(buffer); if(!useText.compare("Y")) break; } else { parse(comText); } //small interation w/student if(curX == curSX && curY == curSY) { prints(); prints("STUDENT: are you the GSI??"); prints("ME: Oh No, I've either got to help him, or get rid of him, or else my"); prints("guilt is going to go thru the roof"); prints(); eStudent = FOUND; } ////////////////People //Pee Quest if((Peetime < theTime) && bPeeMessage == false) { prints(); prints("I need to Pee!"); prints(); prints("and I've included a strange bug, just for j00 h4c0rz"); prints("I cannot pee, I can only Urinate"); prints(); prints("and oh yeah, I have only 30 minutes to do so..."); prints(); bPeeMessage = true; } if(Peetime + 30 < theTime) { prints(); prints("I peed myself"); prints("Thank god I've included a special dryer"); prints("of course its going to cost you 30 points to your score"); score -= 30; prints(); Peetime = 99999; bPeeMessage = false; bPee = false; } ///end of pee quest /////////////////////////////////DR Spoon!!! if(curX == curDsX && curY == curDsY && bMove == false) { if(RoomHas(inventory, NULLSTRING, CROWN)) { prints(); prints("Dr. Spoon is blinded by your crown! He cowers and runs away"); prints("Your crown falls to the floor and shatters!"); prints(); curDsX = curDsY = -1; Gonetime = theTime + 10; position = find(inventory.begin(), inventory.end(), CROWN); inventory.erase(position); } else { prints(); prints("Hello! how are you doing?"); prints(); prints("I turn around, realizing that I'm right infront of Dr. Spoon!"); prints(); Caughttime = theTime + 10; bMove = true; } } if(Caughttime < theTime) { prints(); prints("Have you been doing your work???"); prints(); prints("no..."); prints(); prints("Better start...(guilt rises)"); prints(); guilt += 90; bMove = false; Caughttime = 99999; } if(Gonetime < theTime) { curDsY = 4; curDsX = 1; Gonetime = 9999; } if((theTime > DrSpoontime) && (theTime < DrSpoontime + 60)) { curDsX = curDsY = -1; bDrSpoon = true; } else if(bDrSpoon == true) { bDrSpoon = false; curDsX = 1; curDsY = 4; } ////////////////////////////////end of Dr. Spoon Time //Smoking Dude if((theTime > Smoketime) && (theTime < Smoketime + 60)) { if(bSmokeAdd == false) { map[3][2].items.push_back(PIPE_SMOKEN_DUDE); map[3][2].items.push_back(PIPE); drawMenu(); bSmokeAdd = true; } } else if(bSmokeAdd == true) { position = map[3][2].items.begin(); for(int finder =0; finder < map[3][2].items.size(); finder++) { if(map[3][2].items.at(finder) == PIPE) { map[3][2].items.erase(position); break; } position++; } position = find(map[3][2].items.begin(), map[3][2].items.end(), PIPE_SMOKEN_DUDE); map[3][2].items.erase(position); //erase smoken dude bSmokeAdd = false; drawMenu(); } ///Dr. Soon Moving Events if((theTime % 30) == 0 && curDsY != -1) { bSpoonMove = true; SpoonStep = 0; SpoonMove = rand() % 3; } //if he decides to leave for class during scripts if(bDrSpoon == true) { bSpoonMove = false; } //if Dr. Spoon is moving and he is allowed to move if(bSpoonMove == true && bMove == false) { SpoonStep++; switch(SpoonMove) { case 0: curDsX = StepsA[SpoonStep][0]; curDsY = StepsA[SpoonStep][1]; break; case 1: curDsX = StepsB[SpoonStep][0]; curDsY = StepsB[SpoonStep][1]; break; case 2: curDsX = StepsB[SpoonStep][0]; curDsY = StepsB[SpoonStep][1]; break; default: break; } if(curDsX == 1 && curDsY == 4) { bSpoonMove = false; } } drawScrollingText(); //do time updates... theTime++; ////////////////////change room for DDR if((theTime > DDRtime) && (theTime < DDRtime + 60) && (bDanced == false)) { if(bDDRtime == false) { map[2][6].items.push_back(UBER_GEEK); map[2][6].items.push_back(DDR_PAD); map[2][6].items.push_back(CROWD); map[2][6].desc = "Dance Dance Revolution PARTY!"; position = find(map[2][1].items.begin(), map[2][1].items.end(), UBER_GEEK); map[2][1].items.erase(position); drawMenu(); //erase uber geek... } bDDRtime = true; } else if(bDDRtime == true) { position = find(map[2][6].items.begin(), map[2][6].items.end(), UBER_GEEK); map[2][6].items.erase(position); position = find(map[2][6].items.begin(), map[2][6].items.end(), DDR_PAD); map[2][6].items.erase(position); position = find(map[2][6].items.begin(), map[2][6].items.end(), CROWD); map[2][6].items.erase(position); map[2][6].desc = "198 ELB"; map[2][1].items.push_back(UBER_GEEK); bDDRtime = false; drawMenu(); } /////////////end of DDR time events /////////////////////////Student Time Event + UPE time event if((theTime > UPEtime) && (theTime < UPEtime + 60) && (bFed == false)) { if(bUPEtime == false) { map[3][2].items.push_back(STUDENT); map[3][2].south = false; map[3][3].desc = "UPE Meeting"; map[3][3].items.push_back(PIZZA); map[3][3].items.push_back(UBER_GEEKETTE); position = find(map[1][3].items.begin(), map[1][3].items.end(), UBER_GEEKETTE); map[1][3].items.erase(position); drawMenu(); bUPEtime = true; curSX = 3; curSY = 2; } } else if(bUPEtime == true) { //erase student if he's still there if(eStudent == FOUND || eStudent == UNFOUND) { position = map[3][2].items.begin(); for(int finder =0; finder < map[3][2].items.size(); finder++) { if(map[3][2].items.at(finder) == STUDENT) { map[3][2].items.erase(position); break; } position++; } } position = find(map[3][3].items.begin(), map[3][3].items.end(), UBER_GEEKETTE); map[3][3].items.erase(position); position = find(map[3][3].items.begin(), map[3][3].items.end(), PIZZA); map[3][3].items.erase(position); map[3][2].south = true; map[3][3].desc = "Vacant Room, A great place to hide from Dr. Spoon"; bUPEtime = false; map[1][3].items.push_back(UBER_GEEKETTE); curSX = -1; curSY = -1; if(eStudent == FOUND) { prints("Ah! I didn't help the ugly student ... "); prints("I feel somewhat guilty"); prints();; guilt += 50; } drawMenu(); } //////////////////////////End of UPE / Student Events if(theTime > 480) { prints("its 6:00, time to head on HOME!"); break; } } while(true); string str; prints("Your Total Score is .... "); prints(); str = "Points : "; prints(str + itoa(score, buffer, 10)); str = "Guilt - 2 * "; prints(str + itoa(guilt, buffer, 10) + " = " + itoa(-guilt *2, buffer, 10)); score -= guilt *2; if(bFed) { prints("Fed +50"); score += 50; } else { prints("Didn't eat today -50"); score -=50; } prints("----------------------------"); str = "Total Score = "; prints(str + itoa(score, buffer, 10) ); prints(); prints("Thanks for playing"); prints("This is a parody, no actually Uber Nerds / Geekette are real"); prints("Dr. Spoon is a figment of your imagination"); prints("And don't worry, students that ugly just don't exist..."); prints(); prints("Press Enter to Continue"); drawScrollingText(); cin.getline(buffer, 80); }