Revenge of the Enginerds













Introduction

Sometimes the stress of college takes over in a student's life and he just needs to get revenge. We decided to take legal action to aid in the relieving of stress. Revenge of the Enginerds is that action. The main goal of this game is to find your ECE (or CS) professors to get revenge. Once the player finds them, he will pick them up and attampt to throw them in front of a MTD bus while doging obstacles like O&M trucks, parking police, other buses, other students, etc. Thus, all stress of the college life will be released in the termination of the player's dreaded Professor.
 
 

Program Operation

This game will be in a 2D top-down perspective. The player can walk anywhere on the screen until he reaches the edge. When the player reaches the edge of the screen, the next screen is automatically scrolled to. There will be many things on a screen at one time, such as buses, other students, O&M trucks, the character, and whatever else we feel necessary. For this game, we will write many AI's for the buses, trucks, people, Professors, etc. We will have algorithims for scrolling and a grid determining where certain objects, (such as the player), can go. A health meter may be implemented to monitor how well the player is doing in his mission. It will run in 320x200x256 vga mode. A timer interupt will be installed to control relative speeds of all objects on the screen at one time, and a keyboard interupt will be installed to determine player control.

Our grid will be comprised of six 320x200 screens that will be scrolled to as necessary. Each will have obstacles in the corner as to eliminate consecutative scrolling and slow game play. Each section of the screen will have different values in the grid to determine what will be allowed cross into it. For example, O&M trucks can go on the sidewalk and in the grass, but not in the road. The player can go anywhere except through buildings and other physical obstacles.

Both an introduction and exit sequence will be included in the game. The exit sequence will vary depending on how the game was ended. MIDI and WAV sounds will be used to enhance gameplay for both music and various sound effects.

Most of our functions will be written in C style assembly to simplify variable usage. They will be invoked as necessary.
 
 

Variables

Timercount--Controls game speed. Incremented in timer interrupt

PeopleSpeed--Speed of people

PlayerSpeed--Speed of player

BusSpeed--Speed of Bus

TruckSpeed--Speed of truck

TossSpeed--speed person tossed

EscPressed--Set if ESC is pressed

SpcPressed--Set if SPC is pressed

OldKeyV--Holds old keyboard interrupt vector

OldTimerV--Holds old timer interrupt vector

PkeyDir--Holds user entered direction for player to move

CurrentGrid--Holds current grid number

PeopleArray--Holds which grid each person is in

TruckArray--Holds which grid each truck is in

BusArray--Holds which grid each bus is in

endgame--tells if game is ended

how_died--tells how player died

meter_changed--set if meter changed

Meter--contains life status of player

BusCount            ; counts for graphics
PeopleCount
PlayerCount
TruckCount
TossCount
bounceplcount
bouncepecount

enddrop--contains coordinates of end of drop

dropping--set if person being tossed

persondropped--contains person tossed

Tossdir--contains direction of person tossed

Numdead--contains the # of people killed by buses

Button1_Flag db 0-Used for Joystick Button1

OffPct  REAL4 0.5-Used for setting up the Joystick

displ dw 0-Used in the Joystick Algorithims

;WAV Files
BeginWav    db 'rumble.wav',0
IntroWav db 'ccrash.wav',0
IntroEndWav db 'feature.wav',0
ScreamWav   db 'scream.wav',0
IntroDoNot  db 'DONOT.wav',0

;MIDI Files
MainSong   db 'Mission.xmi',0
IntroSong  db 'Halown.xmi',0
Highway    db 'highway.xmi',0
HellBells  db 'hellsbel.xmi',0
Winsong    db 'champion.xmi',0
MenuSong   db 'nine0210.xmi',0
Taps       db 'taps.xmi',0
BadBoys    db 'Badboys.xmi',0
Gonnafly   db 'Flynowg.xmi',0
 

;PCXfiles
Intro1pcx  db 'final2.pcx',0
Intro1Apcx db 'final2a.pcx',0
Intro2pcx  db 'final2b.pcx',0
Intro2Bpcx db 'final2c.pcx',0
Intro3pcx  db 'final3.pcx',0
Intro4pcx  db 'final4.pcx',0
Intro4bpcx db 'final4b.pcx',0
Intro4cpcx db 'final4c.pcx',0
Intro4dpcx db 'final4d.pcx',0
Intro5bpcx db 'final5b.pcx',0
Intro5cpcx db 'final5c.pcx',0
Intro6bpcx db 'final6b.pcx',0
Intro6cpcx db 'final6c.pcx',0
Intro6dpcx db 'final6d.pcx',0
End1apcx   db 'end1a.pcx',0
End1bpcx   db 'end1b.pcx',0
End1cpcx   db 'end1c.pcx',0
End1dpcx   db 'end1d.pcx',0
End1epcx   db 'end1e.pcx',0
End1fpcx   db 'end1f.pcx',0
End1gpcx   db 'end1g.pcx',0
End1hpcx   db 'end1h.pcx',0
End1ipcx   db 'end1i.pcx',0
End1jpcx   db 'end1j.pcx',0
End1kpcx   db 'end1k.pcx',0
End1lpcx   db 'end1l.pcx',0
End1mpcx   db 'end1m.pcx',0
End1npcx   db 'end1n.pcx',0
End1opcx   db 'end1o.pcx',0
End1ppcx   db 'end1p.pcx',0
End1qpcx   db 'end1q.pcx',0
End1rpcx   db 'end1r.pcx',0
Menuipcx   db 'menui.pcx',0
Menugpcx   db 'menug.pcx',0
Menuqpcx   db 'menuq.pcx',0
Instrctpcx db 'Instruct.pcx',0
End1f2pcx  db 'end1f2.pcx',0
End1f3pcx  db 'end1f3.pcx',0
End1f4pcx  db 'end1f4.pcx',0
End1f5pcx  db 'end1f5.pcx',0
End1f6pcx  db 'end1f6.pcx',0

;Joystick variables

CtX     dw 0      ;Self Explanatory variables for the counts in the different directions
CtY     dw 0
LwRtX   dw 0
LwRtY   dw 0
UpLftX  dw 0
UpLftY  dw 0
OffstX  dw 0
OffstY  dw 0
Butt1   db 0
Butt2   db 0
BothB   db 0
Joystickflg db 0 - Variable to determine if the joystick is being used or not

 Messages

crlf    db CR,LF,'$'
Leftmsg db 'Left',CR,LF,'$'
Rightmsg db 'Right',CR,LF,'$'
Upmsg   db 'Up',CR,LF,'$'
Downmsg db 'Down',CR,LF,'$'
Center  db 'Center',CR,LF,'$'
Button1 db 'Button 1',CR,LF,'$'
Button2 db 'Button 2',CR,LF,'$'
MoveLft db 'Move joystick to upper-left and press button 2.',CR,LF,'$'
MoveRt  db 'Move joystick to lower-right and press button 1.',CR,LF,'$'
MoveCt  db 'Center joystick and press button 1.',CR,LF,'$'
JoyKey  db 'Use joystick(1) or keyboard(2): ','$'

PBuf       db 7  dup(?)    -   Temp Buffer

Filenames for screens

screen0 db 'screen0.pcx',0
screen1 db 'screen1.pcx',0
screen2 db 'screen2.pcx',0
screen3 db 'screen3.pcx',0
screen4 db 'screen4.pcx',0
screen5 db 'screen5.pcx',0

Filenames for grids

grid0 db 'grid0.dat',0
grid1 db 'grid1.dat',0
grid2 db 'grid2.dat',0
grid3 db 'grid3.dat',0
grid4 db 'grid4.dat',0
grid5 db 'grid5.dat',0
 

sprites db 'sprites.pcx',0  - Filename of sprites file

PlayerOffset dw 28800 - Offset of player sprite

PeopleOffset dw 28820 - offset of regular person
                       dw 28810 - offset of professor

TruckOffset dw 12800 - Truck offsets (up, down, right, left)
                      dw 12830
                      dw 12860
                      dw 12890

BusOffset dw 35200 - Bus offsets ( up, down, right, left)
                  dw 35200
                  dw 0
                  dw 40

PoPoOffset dw 22400 - Parking Police offsets (up, down, right, left)
                    dw 22420
                    dw 22440
                    dw 22460
 

Structs

Player-- X Coordinate

Y Coordinate

Facing Direction

Holding?

Introduction ¡ Owner: Ryan Ruwe

¡ Purpose: Displays the introduction sequence on the screen

n Writes PCX files to the screen in order to animate a sequence

n Continues reloading files to create animation of dripping blood

nPlays Midi file during animation and also plays Wav files of voices, screaming, and bus wrecking

n Waits for Esc to be presseed to show Menu

n Calls Loadpcx, Update_Screen, and necessary sound functions (i.e. MIDIplay)
 

¡ Inputs: n Offsets of all PCX files are listed in code

nOffsets of Wav files and Midi files are also listed

nEscPressed is set whenever Player presses ESC

nscrseg - Segment of screen to load

nvbufseg - Video Buffer Segment
 

¡ Outputs: n Introduction sequence is shown on screen and sound is heard through the speakers
PlayExit ¡ Owner: Ryan Ruwe

¡ Purpose: Display the closing sequence to the game

n Plays different sequences of pictures and sounds depending on how
the player finishes the game.

n Returns the game either back to the initial menu

n Animation in the end of either dripping blood or words slide down screen

n Calls necessary music functions and also loadpcx and Update_screen
 

¡ Inputs: n How_died = the number determining the game ending
(i.e. 1=hit by bus, 2=hit by truck, 3=win, etc.)

n Offsets of all sound and video files are previously defined and used by this function

n EscPressed is variable determining if Esc has been pressed or not

n scrseg and vbufseg are also used for displaying the pcx file
 

¡ Outputs: n Displays the video on the screen.

n Plays the necessary music and sound

n Returns to the beginning of the game

LoadMidi ¡ Owner: Ryan Ruwe

¡ Purpose: Load MIDI file into memory using DOS interrupt 21.

n It opens the file and loads it into the SndSeg

n The size of the file will be stored in MIDIlength
 

¡ Inputs: n Offset of the string containg the MIDI filename

n Segments SoundPad and also SndSeg
 

¡ Outputs: n The MIDI file is loaded into memory

n MIDIlength is adjusted as necessary
 

RegisterMidi ¡ Owner: Ryan Ruwe

¡ Purpose: This will register an XMIDI file for play by MIDIPAK

n Function 704h on INT 66 ¡ Inputs: n Offsets SoundPad and SndSeg

n Length of MIDI file
 

¡ Outputs:
  n Sets the offset variables to the necessary values

n Stores the music files in memory

n Checks to make sure there were no errors

MidiPlay ¡ Owner: Ryan Ruwe

¡ Purpose: Plays the midi file registered with MIDIpak

n Function 702h on INT 66 ¡ Inputs: n None ¡ Outputs: n Sound will be heard through the speakers
StopMidi ¡ Owner: Ryan Ruwe

¡ Purpose: Stop the currently playing MIDI file

n Function 705h on INT 66 ¡ Inputs: n None ¡ Outputs: n The MIDI file will no longer be heard
Reset_mouse ¡ Owner: Ryan Ruwe

¡ Purpose:
          n Reset the Mouse Drivers and Hardware

          n Also Reads Status of Mouse

          n Uses INT 33h

¡ Inputs: None

¡ Outputs:

n AX = 0000h, Error Hardware/Sofware not installed

n AX = FFFFh, OK Hardware Software installed

Show_mouse ¡ Owner: Ryan Ruwe

¡ Purpose:
          n Makes the mouse cursor visible on the screen

          n Used after Mouse cursor is hidden

          n Uses INT 33h

¡ Inputs: None

¡ Outputs:

n Mouse Pointer is visible on the screen
Hide_mouse ¡ Owner: Ryan Ruwe

¡ Purpose:
          n Makes the mouse cursor invisible on the screen

          n Used before writing to video memory to make sure graphics are displayed correctly
              when mouse first becomes visible

          n Uses INT 33h

¡ Inputs: None

¡ Outputs:

n Mouse Pointer is not visible on the screen
Get_mouse_pos ¡ Owner: Ryan Ruwe

¡ Purpose:
          n Returns Mouse position and status

          n Counts by pixels

          n Uses INT 33h

¡ Inputs: None

¡ Outputs:

n BX is button status Bit0 is left button, Bit1 is right button

n CX is pixel column position

nDX is pixel row position

PositionMouse ¡ Owner: Ryan Ruwe

¡ Purpose:
          n Positions the mouse on the screen

          n Counts by pixels  (0,0 is the upper left hand corner)

          n Uses INT 33h with

¡ Inputs:

         n DX is column position

       n CX is the Row position

¡ Outputs:

n The mouse is positioned on the screen
Mouse_horiz_limit ¡ Owner: Ryan Ruwe

¡ Purpose:
          n Sets the horizontal limit that the mouse can travel

          n Counts by pixels  (0,0 is the upper left hand corner)

          n Uses INT 33h with

¡ Inputs:

         n CX is Leftmost column position

       n DX is the Rightmost column position

¡ Outputs:

n The mouse is limited in travel
Mouse_Vert_limit ¡ Owner: Ryan Ruwe

¡ Purpose:
          n Sets the Vertical limit that the mouse can travel

          n Counts by pixels  (0,0 is the upper left hand corner)

          n Uses INT 33h with

¡ Inputs:

         n CX is Upper row position

       n DX is the lower row position

¡ Outputs:

n The mouse is limited in travel
Menu ¡ Owner: Ryan Ruwe

¡ Purpose:
          n Display a menu for instructions, playing the game and quiting

          n Calls and Plays MIDI

          n Accepts input from Mouse, Joystick, or Keyboard as necessary

        n Change the color of the letters of the selection as each is selected by any input source

        n Also dispalys instructions when activated and waits to redisplay menu

¡ Inputs:
         n EscPressed - If player pushes ESC, the game ends

         n SpcPressed - If player pushes Space, then it activates the current selection

¡ Outputs:

n A menu with different selections is displayed on the screen

n The necessary calls are made as selections are activated

Calibrate_Joystick ¡ Owner: Ryan Ruwe

¡ Purpose:
          n Calibrates Joystick for game play

          n Returns values for user to see on the screen

          n Sets right, left, up, down, button1 and button2

        n If joystick option is not selected, then the Joystick flag is set to 0 and the function exits

        n Uses int 15h

¡ Inputs:
         n Offsets of text messages to be displayed on the screen

         n Keyboard input as to the joystic option

¡ Outputs:

n If joystick is to be used, necessary variablels are set as to Right, Left center and also offsets for determining the direction (CtY, CtX, UpLftY, LwRtY, UpLftX, LwRtX, Displ, etc)

n If the joystick is not to be used then the Joystick flag is set to 0

Poll_Joystick ¡ Owner: Ryan Ruwe

¡ Purpose:
          n Polls Joystick to check for direction and buttons

          n Uses int 15h

          n Sets right, left, up,and  down directions as well as button1 and button2 flags

        n If joystick option is not selected, then the function exits

        n Uses int 15h

¡ Inputs:
         n JoystickFlg  0=No Joystick, 1=Use JoyStick

¡ Outputs:

n If joystick is to be used, necessary variablels are set as to Joystick position (PKeydir)

n SpcPressed is set for button 1 and EscPressed is set for Button2


CopySeg

¡ Owner: Ryan Ruwe

¡ Purpose:
          n Copies an entire segment

          n Uses built-in complex instructions

¡ Inputs:
         n es segment to copy

       n gs location of copy

¡ Outputs:

n gs now contains what es did
Playmain ¡ Owner: Ryan Ruwe

¡ Purpose:
           nLoad the necessary Wav file into WavPad

    n Call initdsp, volume, dspwrite and play

¡ Inputs:
 

n Segment WavPad ¡ Outputs:
  n The WAV file is played through the speakers
Play ¡ Owner: Ryan Ruwe

¡ Purpose:
          nPlay the Wav file that is in the WavPad

          n Calls dspwrite

¡ Inputs:

n None ¡ Outputs: n The WAV file is played through the speakers
Initdsp ¡ Owner: Ryan Ruwe

¡ Purpose:
          nInitialize the Sound Card

          n Writes to port 226h

¡ Inputs: None

¡ Outputs:

n The Sound Card is initialized
DSPWrite ¡ Owner: Ryan Ruwe

¡ Purpose:
           nWrite the sound information to the DSP memory

¡ Inputs: None

¡ Outputs:

nThe data is in the DSP memory


Update_Screen

¡ Owner: Ryan Ruwe

¡ Purpose:
           n Write the video buffer to the video memory

¡ Inputs:
          n Segment VBufSeg

¡ Outputs:

nThe file is shown on the screen


Loadpcx

¡ Owner: Ryan Ruwe

¡ Purpose:
           n Load the pcx file into memory

   n The palette is also loaded

¡ Inputs:
          n Offset of file

  n Scratchseg and ScratchPad

¡ Outputs:

nThe file is loaded into memory
GamePlay ¡ Owner: Nathan Schneider

¡ Purpose: Controls game flow, waits until proper time to allow movement of players.

n Installs and de-installs new timer and keyboard interrupts.

n Loads music, unloads music

n Loads intro screen

n Initializes graphics and grid

n Waits until different counts reach the proper count to move graphics on screen

n Allows people, trucks, buses, and main player to move at different speeds

n Keeps proper number of people and other graphics on screen at all times

n Calls appropriate exit screen

¡ Inputs: none

¡ Outputs: none
 
 

InstKey, DeInstKey, KeyHandler ¡ Owner: Nathan Schneider

¡ Purpose: Install, de-install new keyboard interrupt handler

n Processes ESC to leave game at any time, EscPressed set

n Processes movements for main player

n Processes SPC, sets SpcPressed to allow main player to pick up people

¡ Inputs: n OldKeyV: for InstKey (unitialized)

n OldKeyV: for DeInstKey

¡ Outputs: n OldKeyV: for InstKey, initialized

n PkeyDir: Direction of main player

n EscPressed, SpcPressed

InstTimer, DeInstTimer, TimerHandler ¡ Owner: Nathan Schneider

¡ Purpose: Install, de-install new timer interrupt handler

¡ Inputs: ¡ Outputs: MovePlayer ¡ Owner: Nathan Schneider

¡ Purpose: Moves and controls player according to read in instructions for direction and control of player.

¡ Inputs: ¡ Outputs: Player moved on screen ScrollScreen ¡ Owner: Nathan Schneider

¡ Purpose: To switch into different grid segments

¡ Inputs: ¡ Outputs: MoveTrucks ¡ Owner: Nathan Schneider

¡ Purpose: to control the movements of trucks, and to draw them on the screen.

¡ Inputs: TruckArray

¡ Outputs: truck moved in appropriate direction along screen

MoveBuses ¡ Owner: Nathan Schneider

¡ Purpose: to control the movements of buses, and to draw them on the screen.

¡ Inputs: BusArray--contains information on trucks

¡ Outputs: Bus moved in appropriate direction along screen

  Toss n Moves person in predetermined direction in toss n persondropped--contains person that was tossed by player
n    PeopleArray--contains array of people
n enddrop--contains coordinates of the end of the toss
n Moved person on screen in proper tossed direction Drop            n Dropping--cleared when input

           n PeopleArray--contains info of person

           n persondropped--unitialized
 

           n Dropping--set

           n enddrop--grid coordinates of the end of the toss

Pick

                           direction of travel               n Hero's location and direction
              n PeopleArray--contains information of people               n Hero.Holding--contains person just picked up by player

RedrawArea

              n  X--upper left x coord of where graphic was
              n  Y--upper left y coord of where graphic was
              nW--width of area to redraw
              n  H--heigth of area to redraw              n  Redraws area where graphic just was

CheckTruckHit

              n X--x coordinate of truck
              nY--y coord of truck
              n Dir--direction of truck movement              n bouncepldir--direction if player bounced
            n bouncepedir--direction if person bounced
            n meter--decrements player's meter if hit

BouncePlayer, BouncePerson

            n    bouncedpe--contains person bounced
            n    PeopleArray--contains info on people              n Person or player is bounced

GetGrid

¡ Owner: Mike Drzal

¡ Purpose: Loads the GridBuffer from the screenbuffer

n Uses the following constants: ROAD = 0

SIDEWALK = 1

GRASS = 2

BARRIERS = 3

n  Checks each pixel and sees what type it is
n  Used to get initial grids  
¡ Inputs: n ScreenBuffer with screen loaded ¡ Outputs: n Initialized GridBuffer
SaveGrid

        ¡Owner: Michael Drzal

          ¡Purpose: Saves the current grid into a file

          ¡Inputs:
                  n DX = offset of ascii filename

          ¡Outputs:
                  n Gridfile

SaveGrid

        ¡Owner: Michael Drzal

          ¡Purpose: Loads a gridfile into gridbuffer

          ¡Inputs:
                  n  DX = offset of ascii filename

          ¡Outputs:
                  n Initialized gridbuffer
 
 

InitGraphics

¡ Owner: Mike Drzal

¡ Purpose: Loads and uncompresses all pcx files for graphics to put them in disk cache

¡ Inputs: n None ¡ Outputs: n All pcx graphics now in disk cache InitGrid ¡ Owner: Mike Drzal

¡ Purpose: Loads and uncompresses all grid files for grids to put them in disk cache

¡ Inputs: n None ¡ Outputs: n All grid graphics now in disk cache InitThings ¡ Owner: Mike Drzal

¡ Purpose: Loads initial values into arrays for vehicles and people

¡ Inputs:

n None ¡ Outputs: n All Arrays initialized


MakeTruck

¡ Owner: Mike Drzal ¡ Purpose: Draws a Truck with Position (X,Y) and direction Dir

¡ Inputs:

n X = x-coordinate
n Y = y-coordinate
n Dir = direction that the truck is facing
¡ Outputs: n A Truck Drawn on the Screen
MakePoPo ¡ Owner: Mike Drzal ¡ Purpose: Draws a Parking Police with Position (X,Y) and direction Dir

¡ Inputs:
   n X = x-coordinate
   n Y = y-coordinate
   n Dir = direction that the parking police is facing

  ¡ Outputs: n A Parking Police vehicle drawn on the screen
MakePerson ¡ Owner: Mike Drzal

¡ Purpose: Bus a Person with Position (X,Y) and direction Dir and type Type

¡ Inputs:

n X = x-coordinate
n Y = y-coordinate
n Dir = direction that the person is facing
n Type = 0 normal, 1 professor
¡ Outputs: n A person drawn on the screen
MakeBus ¡ Owner: Mike Drzal

¡ Purpose: Draw a Bus with Position (X,Y) and direction Dir

¡ Inputs:
        nX = x-coordinate
  n Y = y-coordinate
  n Dir = direction that the bus is facing

¡ Outputs:

n A Bus drawn on the screen