Coma-the Game



The Programers
  • KathyBetts: Rooms logic, graphics
  • Brian Etscheid: Main, Game engine
  • Richa Avasthi: Graphics (320x200)
  • Alex Lorgus: Sound
    _______________________________________________________________

    Game Premise
    You get in a terrible accident, which leaves you in a coma. Where is this place you are at? Where is everyone you know and love? You must figure out how to get to them or you may just be in this coma forever!

    Completely mouse driven, this one player adventuue game journeys through 28 different "rooms" (320x200) in search of the 3 things that can get you home. Where are these items? How do you use them? One thing is certain...leave no stone unturned.
    ________________________________________________________________

    Windows
  • PICTURE: Displays each room. Uses the whole screen.
  • INVENTORY BAR: Bottom strip of screen. Displays all the items owned, two arrows for scrolling, and a "self" icon.
  • TEXTBOX: Appears at top of screen, only when relaying a message to the player.
    ________________________________________________________________
    COMMANDS
    Action var Actioncursor
    50LOOKeye
    51 TAKE hand
    52 HIT word "hit"
    53 OPEN open door
    54 CLOSE closed door
    55 MOVUp up-arrow
    56 MOVBackdwn-arrow
    57 MOVERtrt-arrow
    58 MOVELftleft-arrow
    _______________________________________________________________
    PROCEDURES
    -------------------------NEW CODE FOR FINAL--------------------
    1)MUSIC: ALEX
    • Purpose: when background music is needed, it is supplied. It uses MIDIs
    • Input: Room variable
    • Output: audible music
    2)SoundFX: ALEX
    • Purpose: when an action happens that needs a sound effect, it is supplied
    • Input: ax = value of sound to play
    • Output: sound wav audiable
    3)Text: KATHY
    • Purpose: pulls up textbox and prints messages on it.
    • Input: bx= location of begining of text string to be displayed
    • Output: Message in textbox on top of screen
    4)Rooms: KATHY
    • Purpose: Selects one of the 30 rooms, and calls that room's procedure.
    • Input: Room variable
    • Output: Particular room's procedure is called. Exits if game is won.
    5) main proc far: BRIAN
    • PURPOSE: initializes video, keyboard ISR, and mouse. Runs StarScreen. Then gives control to ROOMS procedure.
    • INPUT: none
    • OUTPUT: game is played
    6) _StartScreen proc far C private: BRIAN
    • PURPOSE: Draws the intro sequence, shows intro pic and instructions pic when user clicks on buttons. Returns when clicked on play game.
    • INPUT: none
    • OUTPUT: intro to game to screen.
    7) _PollMouse proc far C private: BRIAN
    • PURPOSE: helper function that waits on the mouse
    • INPUT: button click
    • OUTPUT: returns row and column location
    8)MouseControl proc near: BRIAN
    • If the requested action is room independent, do not return to room.
    • If right click, change to next action and cursor
    • If on inventory calls _ClickInventory.
    • If moving, continually updates the move cursor based on location
    • Waits for mouse click and outputs: AX=AL=block # on pic (0-239)
    • 'Blocks' are 20 pixels wide and 11 pixels high
    9) _CalcBlockNum proc far C Private uses ax: BRIAN
    • PURPOSE: Called by Mousecontrol to get the block number to return to room
    • INPUT: cx= mouse column pixel(0-639), dx = dl=mouse row pixel (0-199)
    • OUTPUT: returns dl = the block # where button clicked. destroys original cx, and dh.
    10) _CheckMove Proc far C private: BRIAN
    • PURPOSE: called by mousecontrol, updates action with correct direction.
    • INPUT: mouse move
    • OUTPUT: changed action depending on location of screen
    11) _ChgAction proc far C private uses ax bx cx dx si di ds es, useitem:byte: BRIAN
    • PURPOSE: within inventory bar, set up use cursor
    • If useitem =255 then increment action, change cursor
    • Otherwise action = useitem, change to generic 'using item' cursor
    12) _ClickINventory proc far C private uses bx cx dx: BRIAN
    • Called by MOuseControl if cursor is below the pic.
    • Inputs: dx= cursor row(y) pos, cx =cursor col(x) pos, action
    • OUTPUT: services the requested action, calling helper functions
    13) _ScrollInv proc far C private uses BX: BRIAN
    • PURPOSE: used to scroll for items, knows not to scroll past either end of inventory.
    • INPUT: expects cx to be column location. called by _ClickInventory
    • OUTPUT: checks if user clicked inv scroll arrows, if so, scroll.
    14) _CalcInvBlock proc far C Private uses ax dx: BRIAN
    • PURPOSE: find block number on grid
    • INPUT: cx=mouse colmn pixel (0-639)
    • OUTPUT: bx=the item # at item clicked on (0-8 = items, 15 = none)
    15) _IDitem proc far C private, invblocknum:byte : BRIAN
    • PURPOSE:find item that was clicked on.
    • INPUT: block # (239-247) of inventory spot that was clicked
    • OUTPUT: bx = the item # at that spot. If no item there, bx=255
    16) _DrawInv proc far C private uses ax bx cx dx si: BRIAN
    • PURPOSE: Redraws the inventory bar with the proper items on it.
    • INPUT: Inventory array, InvINdex, uses jump table: DrawItemTable
    • OUTPUT: If using an item, show the item on right side of the bar, else show the item on right side of the bar, else show self
    17) _Useitemonself proc far C private, Itemnum:byte : BRIAN
    • PURPOSE: uses an item on another item
    • INPUT: the item # and action. Reminder: action is the item # being used.
    • OUTPUT: does whatever is needed for using items on other items
    18) _addtoinv proc far C private uses ax bx, item:byte : BRIAN
    • puts the item (item #) into in the inventory array
    • redraws inventory, scrolling to the right enough to show the new item.
    19) _RemoveFromInv proc far C private uses ax bx cx dx, Itemnum:byte : BRIAN
    • INPUTS: the item number to be removed from the inventory
    • finds the item, removes it and shifts the rest of the inventory back
    20) _LoseLife proc far C private : BRIAN
    • called when player dies
    • changes the look of the player, change lives left
    21) _endgame proc far C private : BRIAN
    • Deinstalls KBD ISR, video--> text mode, and calls LIB291's dosexit
    22) _DrwRoom : KATHY
    • Purpose: Used by DrawInv, Text, and each room.copies a 'rectangle' of pixels from Source to Screen
    • Input: SourceSeg, SourceOffset, ScreenOffset (upperleft corner of rect), xSize, ySize
    • Output: Rectangle displayed on screen
    23) Finally....Every room had its own procedure.
    • KATHY: rooms = 0-13, 21, 22, 26, 29
    • ALEX: rooms = 14-20, 27, 28
    • BRIAN: rooms = 23-25
      • PURPOSE: handled all actions within a particular room.
      • INPUT: none
      • OUTPUT: every player move is acknowledged and responded to.
    -----------------------------Mostly recycled code (small changes from MPS)
    24)MoveScreen: BRIAN
    • Purpose: moves 320x200 pixels of screen data from one segment to another. Just like MP4
    • Input:DestSeg, SourceSeg
    • Output: Transfers 320x200 =64000 bytes of data from [sourceseg:0] to [destseg:0]
    26) _DelayTick proc far C private uses ax cx es, Clocks:word
    • Delays by (clocks/18) seconds, burns clock cycles
    -------------------------completely recycled code-------
    27)KeyInt/InstallKey/DeInstallKey: BRIAN
    • Purpose:Only want keyboard receptive to ESC key
    • Input: Button presses
    • Output: ExitFlag var set to 1 when ESC is hit
    28)LoadPCX: BRIAN
    • Purpose: Similar to MP4, but different sizes & no need to set VGA Palette. Loads and decodes a 320x'Ysize' PCX file into memory.
    • Input: file name (fname), and DestSeg
    • Output: Displays PCX picture (uncompressed)
    -------------code used, not written by us---------
    29) WaitRetrace proc near
    • waits for the monitor beam to make one full pass of the screen
    • combats flicker
    _______________________________________________________________
    VARIABLES
  • ("used" means in "correct" spot.)
    (items assigned number in inventory)
    (all items initialized to 0 @ beginning)

    Inv #ItemValues
    00 ladder1=own, 2=used
    01 key1(blue)1=own, 2=used
    02 key2 (green)1=own, 2=used
    03 key3 (cyan)1=own, 2=used
    04 key4 (red)1=own, 2=used
    05 key5 (yellow)1=own, 2=used
    06 key6 (black)1=own, 2=used
    07 garopen1=own, 2=used
    08 kitty1=own, 2=used
    09 shovel1=own,2=used
    10 bike 1=own
    11 tickets1=own, 2=used
    12 pencil1=own
    13 napkin1=own
    14 chair1=own
    15 hairbrush1=own
    16 cosmetics1=own
    17 fdiamond 1=own
    18 tissue 1=own
    19 derby 1=own
    20 shoe 1=own
    21 suit1=own, 2=used
    22 lever1=own, 2=used
    23 coal1=own, 2=used 3=crushed
    24 sheet 1=own
    25 gloves 1=own, 2=used
    26 scapel1=own
    27 knife 1=own, 2=used
    28 meat1=own
    29 light1=own, 2=used
    30 shell1 (white)1=own
    31 shell2(yellow)1=own
    32 book1=own
    33 hook1=own, 2=used
    34 worm 1=own, 2=used
    35 paper1=owned
    36 flashlight1=own, 2=used
    37 vase1=own
    38 phone 1=own
    39 goggles1=own, 2=used
    40 pole1=own, 2=used
    41 diamond 1=own,2=used
    42 bag 1 = owned
    43 disk 1=own, 2=used
    44 self 3=smiley, 2=frown, 1=skull
    45 eel 1=own, 2 = used
  • numlives: 3
  • room: 0-30d
  • ExitFlag: 0=continue, 1=exit program
  • ActionVar: db ;holds cursor action. any of commands (see above) or item # being "used."
  • MouseLoc: db ;if under 16*15 then it's a grid location (on pic),else it's one of the buttons on the inv bar.
  • CurInventory: db 43 dup(?) ;array as big as the amount of items that can be picked up. Holds the item # of which the player owns.
  • InvIndex: db 0 ; index for CurInventory pointing to the left of the item shown on the bar.
  • ScrollDir: db ;{+1=right, -1=left}for use in the Inventory bar.
    **various strings of text. (error messages, defintion messages, etc)
    ______________________________________________________________
    GRAPHICS (320x200)
  • (Richa)

    28 rooms with their different variations
    Intro pages
    Death screen
    7 cursor pictures
    Inventory bar
    43 item icons (for inventory bar)
    Textbox (for messages to user)
    26 letters of the Alphabet and symbols
    _______________________________________________________________
    ROOMS
    00payphone
    01house
    02treehouse
    03garage
    04 kitchen
    05 theater
    06 path
    07 th. entrance
    08 backstage
    09 star room
    10 prop room
    11 office
    12 costume room
    13 vice
    14 deck
    15 yard
    16 hallway
    17 cave
    18 OR (oper. room)
    19 butcher's
    20 tunnel
    21 dock
    22 boat
    23 bouy
    24 beach
    25 lighthouse
    26inside LH
    27Family
    28Win Screen
    29Death
    30Intro
    _______________________________________________________________


    Link to ECE291
    Link to my homepage

    This page was updated Dec 12, 1997.