Constant Story "Journey to Alpha Centauri (In Real Time)";
Constant Headline "^An Interactive Waste of Time^
            Copyright (c) 1998 by Julian Fleetwood.^";
Constant USES_TIMER;
Constant MAX_SCORE = 100;

Release 3;

Replace DrawStatusLine;
Replace UpdateTimer;

Include "Parser";
Include "VerbLib";

Global arrived = 0;
Global tenths = 0;
Global secs = 60;
Global mins = 60;
Global hours = 24;
Global days = 365;
Global years = 3000;

Object Ship_Room "Control Room"
      with initial
        [; print "New players should ask for ";
           style bold; print "help"; style roman; print ".^";
        ],
      with description "This is the control cabin of an immense space ship. Around the room are
                        hundreds of switches and buttons. Dials on almost every surface display
                        the tiniest detail about the ship. At the north end of the room is a
                        flat window which looks out in to the inky blackness of space.",
      each_turn [; if (arrived==1)
                   {
                    score = 100;
                    deadflag = 2;
                    "^Welcome to Alpha Centauri. Now go home.";
                   }
                ],
      has light static;

Object Window "curved window" Ship_Room
      with name "window" "glass" "flat" "roof",
           description "A tall piece of glass that covers the entire wall is all that separates
                        you from the great emptiness of space. Through the glass you can see
                        thousands of stars glowing like little pin holes in black card.",
      has scenery static;

Object Dials "small dials" Ship_Room
      with name "dials" "dial" "screen" "screens" "displays" "display",
           description "The numerous dials that litter the surfaces of the room provide you with
                        such useless information as Coffee Temperature, Windscreen Wiper Speed and
                        the like.",
      has scenery static;

Object Buttons "fiddly buttons" Ship_Room
      with name "controls" "switches" "button" "buttons" "switch" "control",
           description "Every intricate part of the ship can be controlled from this impressive
           room. You resist the temptation to play with the controls.",
      has scenery static;

[ Initialise;
 TitlePage();
 DrawStatusLine();
 print "^^^^^";
 location = Ship_Room;
];

[ Time;
 if (secs == 0 && mins == 0 && hours == 0 && days == 0 && years == 0)
 {
  arrived = 1; rtrue;
 }
 secs--;
 if (secs == -1)
 {
  secs = 60;
  mins--;
  if (mins == -1)
  {
   mins = 60;
   hours--;
   if (hours == -1)
   {
    hours = 24;
    days--;
    if (days == -1)
    {
     days = 365;
     years--;
    }
    else
     print secs, " (s) ", mins, " (m) ", hours, " (h) ", days, " (d) ", years, " (y)"; rtrue;
   }
   else
    print secs, " (s) ", mins, " (m) ", hours, " (h) ", days, " (d) ", years, " (y)"; rtrue;
  }
  else
   print secs, " (s) ", mins, " (m) ", hours, " (h) ", days, " (d) ", years, " (y)"; rtrue;
 }
 else
  print secs, " (s) ", mins, " (m) ", hours, " (h) ", days, " (d) ", years, " (y)"; rtrue;
];

[ UpdateTimer;
 DrawStatusLine();
 tenths++;
 if (tenths == 10)
 {
  tenths = 0;
  no_parse = 1;
  rfalse;
 }
 else
  rfalse;
];

[ TitlePage i;
 @erase_window -1; print "^^^^^^^^^^^^^";
 i = 0->33; if (i==0) i=80; i=(i-50)/2;
 style bold; font off; spaces(i);
 style roman; print "^^"; spaces(i);
 print "            [Please press SPACE to begin.]^";
 font on;
 box "In the year of '39 assembled here the Volunteers"
     "In the days when lands were few"
     "Here the ship sailed out into the blue and sunny morn"
     "The sweetest sight ever seen."
     ""
     "-- Queen, '39";
  do { @read_char 1 0 0 i; } until (i==32 or 10 or 13);
  @erase_window -1;
];

[ DrawStatusLine;
  @split_window 1; @set_window 1; @set_cursor 1 1; style reverse;
  spaces (0->33)-1;
  @set_cursor 1 2; print "Counter: ";
  if (arrived == 1)
  {
   print "Arrived!";
  }
  else
   Time();
  @set_cursor 1 1; style roman; @set_window 0;
];

[ HelpMenu;
 if (menu_item==0)  { item_width=13; item_name="Journey To Alpha Centauri"; return 5; }
 if (menu_item==1)  { item_width=7; item_name="Thank-You List"; }
 if (menu_item==2)  { item_width=10; item_name="About the Author..."; }
 if (menu_item==3)  { item_width=8; item_name="Bugs 'n' Versions"; }
 if (menu_item==4)  { item_width=16; item_name="The Story That Started it All..."; }
 if (menu_item==5)  { item_width=3; item_name="Hints"; }
];

[ HelpInfo;
if (menu_item==1)
{
print "Wow! Even for a 50k game there are so many people to thank. Firstly, a big thanks to
       Graham Nelson for allowing my wildest IF dreams to come true. Numerous cheers go to the
       denizens of rec.arts.int-fiction and rec.games.int-fiction who helped me improve and
       re-design the code.^^";

print "In individual terms, my undying gratitude goes to Francis Irving who held my hand as I
       coded this beast, Joe Mason who helped me to get the real time input to work, and
       Terry Pratchett for making the world a whole lot funnier.^^";
}
if (menu_item==2)
{
print "The author, Julian Fleetwood (mfleetwo@@64pcug.org.au), lives in Canberra, Australia. He is
       16 and is trying to learn enough to get a computer science degree while maintaining his web
       site (http://surf.to/free4all).^^";

print "The author wishes to make known that this is not a good example of his work and suggests
       that players wait for his first real IF game (coming in the not too close future) before
       judging his work.^^";

print "No animals were hurt in the construction of this game.^^";
}
if (menu_item==3)
{
print "1994: Q-Basic version. One message and a simple counter.^^";

print "1996: Port to Nimbus Apple Basic. No changes.^^";

print "July-September 1998: Inform Release 1: More text, an actual room, okay time counter and
       groovy menu system.^^";

print "September 1998: Inform Release 2: Fixed a few silly mistakes.^^";

print "October 1998: Current release. Changed the status bar. Fixed the ~typing to fast~ bug and
       made the time length acurate.^^";

print "Bugs: If you use WinFrotz and are using different fixed and display fonts the typing font
       will frequently change or completely lock up. The status bar disappears for a couple
       seconds after exiting the help menu. The timer does not cover leap years. Please don't bug
       me about this :-)^^";

print "If you have new bug reports or fixes please send them to me at mfleetwo@@64pcug.org.au^^";

print "The source code for this game should be avalible at^
       ftp://ftp.gmd.de/if-archive/games/source/inform/Alpha.inf^^";
}
if (menu_item==4)
{
print "Excerpt from ~Only You Can Save Mankind~ by Terry Pratchett (Corgi Books
       1993 0-552-13926-2)^^";

print "Chapter 3 Cereal Killers^^";

print "Johnny went back and watched the screen for a while. Stars occasionally went past.^";
print "  Wobbler had written an actual computer game like this once. It was called ";
style bold;
print "Journey to Alpha Centauri";
style roman;
print ". It was a screen with some dots on it. Because, he said, it happened in ";
style bold;
print "real time";
style roman;
print ", which no-one had ever heard of until computers. He'd seen on TV that it took three
       thousand years to get the Alpha Centauri. he had written it so that if anyone kept their
       computer on for three thousand years, they'd be rewarded by a little dot appearing in
       the middle of the sreen, and then a message saying, ~Welcome to Alpha Centauri. Now go
       home.~^^";
}
if (menu_item==5)
{
print "[This space left intentionly blank.]^^";
}
];

[ HelpSub;
 DoMenu("There is information provided on the following:^
        ^     Thank-You List
        ^     About the Author...
        ^     Bugs 'n' Versions
        ^     The Story That Started it All...
        ^     Hints^",
        HelpMenu, HelpInfo);
];

[ XyzzySub;
 "In space, no one can hear ~nothing happens~.";
];

[ PlaySub;
 if (noun == Buttons)
 {
  print "A panel lights up with the words ~Please do not play with the controls again.~^";
 }
 else
  print "You're not really in the mood.^";
];

Include "Grammar";

Verb "smeg" = "damn";
Verb "kick" = "attack";
Verb "play" "fiddle" "mess"
    * noun               -> Play
    * "with" noun        -> Play;
Verb "xyzzy"    *         -> Xyzzy;
Verb "help"     *         -> Help;