!\--------------------------------------------------------------------------- DOWNCOMM.HUG Common objects, etc. for Down by Kent Tessman (c) 1997-1998 Including: you (the player object) Classes: corpse pollable flammable NPC_follower Routines: DoBurn DoJump DoTouch DoFollow DoWaitUntil DoAsk PrintStatusline ---------------------------------------------------------------------------\! !---------------------------------------------------------------------------- ! PLAYER: constant MAX_PLAYER_CAPACITY 75 player_character you "you" { capacity MAX_PLAYER_CAPACITY long_desc { "A little scraped up, but otherwise you seem okay. "; if splint in self "You're wearing a makeshift splint on your right leg." else "Your right leg doesn't look too good, though." } before { actor DoGo { if splint is worn: return false if location = bluff "Your leg is in too much pain to walk on." elseif location ~= lyingdown { "You can't even take a step--without a splint, there's no way your right leg can keep you up." } else: return false } } is known } !---------------------------------------------------------------------------- ! OBJECTS, CLASSES, ETC.: attribute inside_the_plane ! used by rooms/locations in down3.hug class corpse { size MAX_PLAYER_CAPACITY ! all the player can carry before { object DoTouch { CThe(self) " is cold. There's no pulse." } object DoHit, DoEat, DoKiss { "What the hell is the matter with you?" } } } !---------------------------------------------------------------------------- ! POLLABLE CLASS: ! ! A very handy little class to add event/daemon-ish behaviors to multiple ! classes of objects that can be added/subtracted from the active list at ! any time. Here it's used for flammable items (where multiple objects can ! be burning) and non-player characters (where multiple characters can be ! following.) To be honest, neither is really necessary for this relatively ! simple game, but I thought I might as well write them while I was at it. ! ! Note that it's not really a "class" per se, but rather a collection of ! properties and other data that can be co-opted by pollable objects. constant MAX_POLLABLES 16 ! total active at any given time array pollable[MAX_POLLABLES] global total_pollables global pollable_temp ! variable used by AddPollable property poll $additive property add_pollable property remove_pollable routine AddPollable(obj1, obj2) ! second argument is optional { if total_pollables = MAX_POLLABLES: return false pollable[total_pollables] = obj1 total_pollables++ pollable_temp = obj2 run obj1.add_pollable return true } routine RemovePollable(obj) { local i, j for (i=0; i 720) {Message(&DoWaitUntil, 2) ! "You're ahead of your time." return} else { if object < counter object = object * 60 DoWait((object - counter + 1) * TURNS_PER_MIN) ! "It is now (whatever time/turn)..." Message(&DoWaitUntil, 3) } event_flag = 0 } !---------------------------------------------------------------------------- ! REPLACED ROUTINES: ! PrintStatusline (from hugolib.h) ! prints an appropriate statusline as specified by global STATUSTYPE constant TURNS_PER_MIN 2 ! 2 turns per minute replace PrintStatusline { if display.linelength < 80 display.statusline_height = 2 Font(BOLD_OFF | ITALIC_OFF | UNDERLINE_OFF | PROP_OFF) window display.statusline_height { color SL_TEXTCOLOR, SL_BGCOLOR cls locate 1, 1 if not light_source print "In the dark"; else { if FORMAT & DESCFORM_F: print "\_"; print capital location.name; } if display.statusline_height = 1 print to 65; else { locate 1, 2 if FORMAT & DESCFORM_F: print "\_"; } if STATUSTYPE = 1 print number score; " / "; number counter ! Here's the replaced part--the time only shows up on the ! statusline if the player is carrying the watch. Note also ! that the counter is divided by 2: all other turn-based ! calculations (such as fuses) should also assume that two ! turns equal one minute. ! elseif STATUSTYPE = 2 and watch in player print HoursMinutes(counter/TURNS_PER_MIN); } color TEXTCOLOR, BGCOLOR Font(DEFAULT_FONT) } !---------------------------------------------------------------------------- ! PARSING: synonym "plexi" for "plexiglass" !---------------------------------------------------------------------------- ! MODULAR DEVELOPMENT: #ifset MODULE ! The stub class is used to make objects that will stand in for like-named ! objects in other modules. ! class stub { is known } #ifclear PART1 routine DoCrawl ! These routines are needed for DOWN.G {"(Stub routine)"} routine DoTear {"(Stub routine)"} routine DoMake {"(Stub routine)"} routine DoMakeSplint {"(Stub routine)"} stub lyingdown ! These objects are referred to outside of {} ! DOWN1.HUG: stub watch "watch" { in you noun "watch" article "your" is clothing, worn } stub splint "splint" { in you noun "splint" article "a" is clothing, worn } stub bluff {} #endif ! ifclear PART1 #ifclear PART2 stub crashsite ! These objects are referred to outside of {} ! DOWN2.HUG: stub plane {} stub besideplane {} stub behindplane {} stub onwing {} stub otherwing {} #ifset BETA_TEST routine DoStopFuse {"(Stub routine - fuse active only in Part 2)"} #endif #endif ! ifclear PART2 #ifclear PART3 stub insideplane ! These objects are referred to outside of {} ! DOWN3.HUG: #endif ! ifclear PART3 #endif ! ifset MODULE