From ed181a8d2015ad0d90d0ec21d64ad2822473591e Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 25 Nov 2016 20:01:43 +0100 Subject: [PATCH] Ansify Paranoia, because I was getting annoyed by all the compiler warnings on every build. --- examples/paranoia.c | 141 ++++++++++++++++++++++---------------------- 1 file changed, 70 insertions(+), 71 deletions(-) diff --git a/examples/paranoia.c b/examples/paranoia.c index f7020f71e..8a25800d9 100644 --- a/examples/paranoia.c +++ b/examples/paranoia.c @@ -15,6 +15,7 @@ This is a public domain adventure and may not be sold for profit */ +#include #include #define MOXIE 13 @@ -32,7 +33,9 @@ int plato_clone=3; int blast_door=0; int killer_count=0; -char get_char() +void character(void); + +char get_char(void) { char c; fflush(stdout); @@ -41,7 +44,7 @@ char get_char() return c; } -more() +void more(void) { printf("---------- More ----------"); #ifdef DEBUG @@ -55,8 +58,7 @@ more() }; } -new_clone(resume) -int resume; +int new_clone(int resume) { printf("\nClone %d just died.\n",clone); if (++clone>6) @@ -75,15 +77,14 @@ int resume; } } -dice_roll(number,faces) -int number, faces; +int dice_roll(int number, int faces) { int i,total=0; for(i=number;i>0;i--) total+= rand()%faces+1; return total; } -instructions() +void instructions(void) { printf("\n\n\n\nWelcome to Paranoia!\n\n"); printf("HOW TO PLAY:\n\n"); @@ -104,7 +105,7 @@ instructions() printf(" If not, you can try again later.\n"); } -character() +void character(void) { printf("===============================================================================\n"); printf("The Character : Philo-R-DMD %d\n", clone); @@ -130,9 +131,7 @@ character() printf("===============================================================================\n"); } -choose(a,aptr,b,bptr) -int a,b; -char *aptr, *bptr; +int choose(int a, char* aptr, int b, char* bptr) { printf("\nSelect \'a\' or \'b\' :\n"); printf(" a - %s.\n b - %s.\n", aptr, bptr); @@ -140,7 +139,7 @@ char *aptr, *bptr; else return b; } -page1() +int page1(void) { printf(" You wake up face down on the red and pink checked E-Z-Kleen linoleum floor.\n"); printf(" You recognise the pattern, it\'s the type preferred in the internal security\nbriefing cells. When you finally look around you, you see that you are alone\n"); @@ -148,7 +147,7 @@ page1() return 57; } -page2() +int page2(void) { printf("\"Greetings,\" says the kindly Internal Security self incrimination expert who\n"); printf("meets you at the door, \"How are we doing today?\" He offers you a doughnut\n"); @@ -166,7 +165,7 @@ page2() else return new_clone(32); } -page3() +int page3(void) { printf("You walk to the nearest Computer terminal and request more information about\n"); printf("Christmas. The Computer says, \"That is an A-1 ULTRAVIOLET ONLY IMMEDIATE\n"); @@ -174,7 +173,7 @@ page3() return choose(4,"You give your correct clearance",5,"You lie and claim Ultraviolet clearance"); } -page4() +int page4(void) { printf("\"That is classified information, Troubleshooter, thank you for your inquiry.\n"); printf(" Please report to an Internal Security self incrimination station as soon as\n"); @@ -182,7 +181,7 @@ page4() return 9; } -page5() +int page5(void) { printf("The computer says, \"Troubleshooter, you are not wearing the correct colour\n"); printf("uniform. You must put on an Ultraviolet uniform immediately. I have seen to\n"); @@ -193,7 +192,7 @@ page5() return choose(6, "You open the package and put on the uniform", 7, "You finally come to your senses and run for it"); } -page6() +int page6(void) { printf("The uniform definitely makes you look snappy and pert. It really looks\n"); printf("impressive, and even has the new lopsided lapel fashion that you admire so\n"); @@ -205,7 +204,7 @@ page6() return 8; } -page7() +int page7(void) { printf("The corridor lights dim and are replaced by red battle lamps as the Security\n"); printf("Breach alarms howl all around you. You run headlong down the corridor and\n"); @@ -232,7 +231,7 @@ page7() return 8; } -page8() +int page8(void) { printf("\"Now, about your question, citizen. Christmas was an old world marketing ploy\n"); printf("to induce lower clearance citizens to purchase vast quantities of goods, thus\n"); @@ -249,7 +248,7 @@ page8() return 10; } -page9() +int page9(void) { int choice; printf("As you walk toward the tubecar that will take you to GDH7-beta, you pass one\n"); @@ -262,7 +261,7 @@ page9() return choice; } -page10() +int page10(void) { int choice; printf("You stroll briskly down the corridor, up a ladder, across an unrailed catwalk,\n"); @@ -290,7 +289,7 @@ page10() } } -page11() +int page11(void) { printf("The printing on the folder says \"Experimental Self Briefing.\"\n"); printf("You open it and begin to read the following:\n"); @@ -321,7 +320,7 @@ page11() return choose(3,"You wish to ask The Computer for more information about Christmas",10,"You have decided to go directly to Goods Distribution Hall 7-beta"); } -page12() +int page12(void) { printf("You walk up to the door and push the button labelled \"push to exit.\"\n"); printf("Within seconds a surly looking guard shoves his face into the small plexiglass\n"); @@ -333,7 +332,7 @@ page12() return choose(11,"You sit down at the table and read the Orange packet",57,"You stare around the room some more"); } -page13() +int page13(void) { printf("You step into the shiny plasteel tubecar, wondering why the shape has always\n"); printf("reminded you of bullets. The car shoots forward the instant your feet touch\n"); @@ -346,7 +345,7 @@ page13() return 14; } -page14() +int page14(void) { printf("You manage to pull yourself out of the tubecar and look around. Before you is\n"); printf("one of the most confusing things you have ever seen, a hallway that is\n"); @@ -360,7 +359,7 @@ page14() return 22; } -page15() +int page15(void) { printf("You are set upon by a runty robot with a queer looking face and two pointy\n"); printf("rubber ears poking from beneath a tattered cap. \"Hey mister,\" it says,\n"); @@ -384,7 +383,7 @@ page15() } } -page16() +int page16(void) { printf("The doll is a good buy for fifty credits; it will make a fine Christmas present\n"); printf("for one of your friends. After the sale the robot rolls away. You can use\n"); @@ -395,7 +394,7 @@ page16() return 22; } -page17() +int page17(void) { int i, robot_hp=15; printf("You whip out your laser and shoot the robot, but not before it squeezes the\n"); @@ -432,7 +431,7 @@ page17() return 22; } -page18() +int page18(void) { printf("You walk to the centre of the hall, ogling like an infrared fresh from the\n"); printf("clone vats. Towering before you is the most unearthly thing you have ever\n"); @@ -448,7 +447,7 @@ page18() else return 20; } -page19() +int page19(void) { printf("Quickly you regain your balance, whirl and fire your laser into the Ultraviolet\n"); printf("citizen behind you. For a moment your heart leaps to your throat, then you\n"); @@ -461,7 +460,7 @@ page19() return choose(34,"You search the body, keeping an eye open for Internal Security",22,"You run away like the cowardly dog you are"); } -page20() +int page20(void) { printf("Oh no! you can\'t keep your balance. You\'re falling, falling head first into\n"); printf("the Christmas beast\'s gaping maw. It\'s a valiant struggle; you think you are\n"); @@ -473,7 +472,7 @@ page20() return 22; } -page21() +int page21(void) { printf("You have been wasting the leading citizens of Alpha Complex at a prodigious\n"); printf("rate. This has not gone unnoticed by the Internal Security squad at GDH7-beta.\n"); @@ -482,7 +481,7 @@ page21() return new_clone(45); } -page22() +int page22(void) { printf("You are searching Goods Distribution Hall 7-beta.\n"); switch(dice_roll(1,4)) @@ -494,7 +493,7 @@ page22() } } -page23() +int page23(void) { printf("You go to the nearest computer terminal and declare yourself a mutant.\n"); printf("\"A mutant, he\'s a mutant,\" yells a previously unnoticed infrared who had\n"); @@ -503,7 +502,7 @@ page23() return choose(28,"You tell them that it was really only a bad joke",24,"You want to fight it out, one against twelve"); } -page24() +int page24(void) { printf("Golly, I never expected someone to pick this. I haven\'t even designed\n"); printf("the 12 citizens who are going to make a sponge out of you. Tell you what,\n"); @@ -511,7 +510,7 @@ page24() return choose(28,"You change your mind and say it was only a bad joke",25,"You REALLY want to shoot it out"); } -page25() +int page25(void) { printf("Boy, you really can\'t take a hint!\n"); printf("They\'re closing in. Their trigger fingers are twitching, they\'re about to\n"); @@ -519,7 +518,7 @@ page25() return choose(28,"You tell them it was all just a bad joke",26,"You are going to shoot"); } -page26() +int page26(void) { printf("You can read the cold, sober hatred in their eyes (They really didn\'t think\n"); printf("it was funny), as they tighten the circle around you. One of them shoves a\n"); @@ -529,19 +528,19 @@ page26() return new_clone(32); } -page27() +int page27(void) { /* doesn't exist. Can't happen with computer version. designed to catch dice cheats */ } -page28() +int page28(void) { printf("They don\'t think it\'s funny.\n"); return 26; } -page29() +int page29(void) { printf("\"Psst, hey citizen, come here. Pssfft,\" you hear. When you peer around\n"); printf("you can see someone\'s dim outline in the shadows. \"I got some information\n"); @@ -559,7 +558,7 @@ page29() } } -page30() +int page30(void) { printf("You step into the shadows and offer the man a thirty credit bill. \"Just drop\n"); printf("it on the floor,\" he says. \"So you\'re looking for the Master Retailer, pssfft?\n"); @@ -586,7 +585,7 @@ page30() } } -page31() +int page31(void) { printf("Like any good troubleshooter you make the least expensive decision and threaten\n"); printf("him for information. With lightning like reflexes you whip out your laser and\n"); @@ -599,7 +598,7 @@ page31() return choose(30,"You pay the 30 credits",22,"You pssfft go away stupid"); } -page32() +int page32(void) { printf("Finally it\'s your big chance to prove that you\'re as good a troubleshooter\n"); printf("as your previous clone. You walk briskly to mission briefing and pick up your\n"); @@ -609,7 +608,7 @@ page32() return 22; } -page33() +int page33(void) { blast_door=1; printf("You release the megabolts on the blast door, then strain against it with your\n"); @@ -622,7 +621,7 @@ page33() else return 36; } -page34() +int page34(void) { printf("You have found a sealed envelope on the body. You open it and read:\n"); printf("\"WARNING: Ultraviolet Clearance ONLY. DO NOT READ.\n"); @@ -650,7 +649,7 @@ page34() return choose(46,"You rush off to the nearest computer terminal to expose the commies",22,"You wander off to look for more evidence"); } -page35() +int page35(void) { printf("\"Oh master,\" you hear through the gun barrel, \"where have you been? It is\n"); printf("time for the great Christmas gifting ceremony. You had better hurry and get\n"); @@ -669,7 +668,7 @@ page35() return new_clone(32); } -page36() +int page36(void) { printf("\"Congratulations, troubleshooter, you have successfully found the lair of the\n"); printf("Master Retailer and completed the Troubleshooter Training Course test mission,\"\n"); @@ -692,7 +691,7 @@ page36() } } -page37() +int page37(void) { printf("\"Come with me please, Troubleshooter,\" says the Green clearance technician\n"); printf("after he has dislodged your head from the cannon. \"You have been participating\n"); @@ -708,7 +707,7 @@ page37() return 38; } -page38() +int page38(void) { printf("\"I am Plato-B-PHI%d, head of mutant propaganda here at the training course.\n",plato_clone); printf("If you have any questions about mutants please come to me. Today I will be\n"); @@ -725,7 +724,7 @@ page38() return choose(39,"You volunteer for the test",40,"You duck behind a chair and hope the instructor doesn\'t notice you"); } -page39() +int page39(void) { printf("You bravely volunteer to test the mutant detection gun. You stand up and walk\n"); printf("down the steps to the podium, passing a very relieved Troubleshooter along the\n"); @@ -743,7 +742,7 @@ page39() return 41; } -page40() +int page40(void) { printf("You breathe a sigh of relief as Plato-B-PHI picks on the other Troubleshooter.\n"); printf("\"You down here in the front,\" says the instructor pointing at the other\n"); @@ -775,7 +774,7 @@ page40() } } -page41() +int page41(void) { printf("You stumble down the hallway of the Troubleshooter Training Course looking for\n"); printf("your next class. Up ahead you see one of the instructors waving to you. When\n"); @@ -789,7 +788,7 @@ page41() return choose(42,"You respond with the proper Illuminati code phrase, \"Ewige Blumenkraft\"",43,"You ignore this secret society contact"); } -page42() +int page42(void) { printf("\"Aha, so you are a member of the elitist Illuminati secret society,\" he says\n"); printf("loudly, \"that is most interesting.\" He turns to the large class already\n"); @@ -799,7 +798,7 @@ page42() return choose(51,"You run for it",52,"You wait for the guard"); } -page43() +int page43(void) { printf("You sit through a long lecture on how to recognise and infiltrate secret\n"); printf("societies, with an emphasis on mimicking secret handshakes. The basic theory,\n"); @@ -815,7 +814,7 @@ page43() return choose(44,"You go looking for a computer terminal",55,"You go to the graduation ceremony immediately"); } -page44() +int page44(void) { printf("You walk down to a semi-secluded part of the training course complex and\n"); printf("activate a computer terminal. \"AT YOUR SERVICE\" reads the computer screen.\n"); @@ -833,7 +832,7 @@ page44() } } -page45() +int page45(void) { printf("\"Hrank Hrank,\" snorts the alarm in your living quarters. Something is up.\n"); printf("You look at the monitor above the bathroom mirror and see the message you have\n"); @@ -847,7 +846,7 @@ page45() return 10; } -page46() +int page46(void) { printf("\"Why do you ask about the communists, Troubleshooter? It is not in the\n"); printf("interest of your continued survival to be asking about such topics,\" says\n"); @@ -855,7 +854,7 @@ page46() return choose(53,"You insist on talking about the communists",54,"You change the subject"); } -page47() +int page47(void) { printf("The Computer orders the entire Vulture squadron to terminate the Troubleshooter\n"); printf("Training Course. Unfortunately you too are terminated for possessing\n"); @@ -867,7 +866,7 @@ page47() return 0; } -page48() +int page48(void) { printf("The tubecar shoots forward as you enter, slamming you back into a pile of\n"); printf("garbage. The front end rotates upward and you, the garbage and the garbage\n"); @@ -877,14 +876,14 @@ page48() return new_clone(45); } -page49() +int page49(void) { printf("The instructor drags your inert body into a specimen detainment cage.\n"); printf("\"He\'ll make a good subject for tomorrow\'s mutant dissection class,\" you hear.\n"); return new_clone(32); } -page50() +int page50(void) { printf("You put down the other Troubleshooter, and then wisely decide to drill a few\n"); printf("holes in the instructor as well; the only good witness is a dead witness.\n"); @@ -893,27 +892,27 @@ page50() return 41; } -page51() +int page51(void) { printf("You run for it, but you don\'t run far. Three hundred strange and exotic\n"); printf("weapons turn you into a freeze dried cloud of soot.\n"); return new_clone(32); } -page52() +int page52(void) { printf("You wisely wait until the instructor returns with a Blue Internal Security\n"); printf("guard. The guard leads you to an Internal Security self incrimination station.\n"); return 2; } -page53() +int page53(void) { printf("You tell The Computer about:\n"); return choose(47,"The commies who have infiltrated the Troubleshooter Training Course\n and the impending People\'s Revolution",54,"Something less dangerous"); } -page54() +int page54(void) { printf("\"Do not try to change the subject, Troubleshooter,\" says The Computer.\n"); printf("\"It is a serious crime to ask about the communists. You will be terminated\n"); @@ -927,7 +926,7 @@ page54() else return new_clone(32); } -page55() +int page55(void) { printf("You and 300 other excited graduates are marched from the lecture hall and into\n"); printf("a large auditorium for the graduation exercise. The auditorium is\n"); @@ -955,7 +954,7 @@ page55() return 0; } -page56() +int page56(void) { printf("That familiar strange feeling of deja\'vu envelops you again. It is hard to\n"); printf("say, but whatever is on the other side of the door does not seem to be intended\n"); @@ -963,15 +962,14 @@ page56() return choose(33,"You open the door and step through",22,"You go looking for more information"); } -page57() +int page57(void) { printf("In the centre of the room is a table and a single chair. There is an Orange\n"); printf("folder on the table top, but you can\'t make out the lettering on it.\n"); return choose(11,"You sit down and read the folder",12,"You leave the room"); } -next_page(this_page) -int this_page; +int next_page(int this_page) { printf("\n"); switch (this_page) @@ -1038,10 +1036,11 @@ int this_page; } } -main() +int main(int argc, const char* argv[]) { /* srand(time(0)); */ instructions(); more(); character(); more(); while((page=next_page(page))!=0) more(); + return 0; }