The project will involve the assembly implementation of Snood, a highly addictive game involving the launching of specified pieces from a fixed location at varying angles (see www.snood.com). Using video
mode 13h, graphics will be somewhat limited in resolution, but gameplay will be similar to the original.
Implementation will include graphics input, video output, user input, and gameplay/scoring. Rather than standard snoods, initially, simple blocks of colors will be used.
Screen capture from www.snood.com
Implementation
The game will be implemented in a similar fashion as MP3 and MP4. An internal representation of the board will be maintained as an array of pieces, with separate
graphics routines used to draw pieces in mode 13h, and update positions. Calculations for landing positions and collision resolution of pieces shot at different angles will be carried out using a lookup table with preset values. Modified ISRs will provide user input through the mouse and keyboard.
The GameBoard array will contain predefined constants, much like the maze in MP3. It will represent the entire visible screen, including walls, background, and game pieces. There is also a fixed width for every piece and wall. Background pieces are 1/2 the width so that columns can be staggered.
Procedures
GenerateGameBoard
Purpose: Creates internal array of the game board.
Input: none
Output: GameBoard
Description: Fills array with predefined constants. When two walls pieces are next to each other, then a new row has begun. Uses RandomPiece to fill in pieces.
Owner: Jacob Perkins
Move
Purpose: Moves given game piece from one location to another
Input: SI is old pos, DI is new pos
Outputs: GameBoard
Description: Moves piece at old pos to new pos. Error checking should be done in the function that calls Move
Owner: Jacob Perkins
DropRow
Purpose: Drops an entire row down one row
Inputs: SI is the start of the row
Output: GameBoard
Description: The row starting at SI is moved down one row, probably calling Move on each piece.
Owner: Jacob Perkins
DropAll
Purpose: Drops every row of block down 1.
Inputs: none
Output: GameBoard
Description: Every row is moved down one and any space above the top row is filled in with 'bricks'. Uses DropRow and then fills top row with 'bricks'.
Owner: Jacob Perkins
DeleteBlocks
Purpose: If needed, a set of blocks is deleted
Inputs: SI is the location of the new block
Output: GameBoard
Description: Checks around current block for any blocks of the same type then recursively deletes those blocks (if there are more than 2).
Owner: Jacob Perkins
RandomPiece
Purpose: Generate a random piece
Inputs: none
Output: DX holds value of piece
Description: Generates random piece and returns that value in DX.
Owner: Jacob Perkins
DrawBoard
Purpose: Draws initial board
Inputs: Game Board
Output: Screen
Description:draws pieces that are represented by the constants in Game Board array
Owner: Graphics
UpdateBoard
Purpose: Changes board during gameplay
Inputs: TBD
Output: screen
Description: this method by only drawing what has changed will help us avoid having to redraw the entire board
Owner: Graphics
RotateShooter
Purpose: Rotates Shooter to aim, based on mouse position
Inputs: BL, the position of the mouse ranging from 0-10
Output: Graphical representation of the shooter on screen
Description: Uses BL to access lookup table, and DisplayPicture to display shooter image on screen
Owner: Nathan Gosse
LaunchPiece
Purpose: Sets up variables for shooting; Begins animation of launched piece
Inputs: Angle
Output: none
Description: sets initial X Position, calls animation and math routines
Owner: Jon Agnich
GetParametrics
Purpose: Sets coefficients for piece movement determination.
Inputs: Angle
Output: AVar and BVar are set
Description: Uses lookup table to find x and y coefficients
Owner: Jon Agnich
Bounce
Purpose: Determines new angle and X intercept after collision with wall
Inputs: old Angle, old X_Shift
Output: new Angle, new X_Shift, GetParametrics called
Description: finds new linear parametric equations for position
Owner: Jon Agnich
GetRealPosition
Purpose: return expected next position, rounded to integer
Inputs: Angle, X_Shift, and Time
Output: ah contains rounded X coordinate; al contains rounded Y coordinate
Description: executes parametric equations and rounds results
Owner: Jon Agnich
MainLoop
Purpose:Establish continuous loop, polling mouse and keyboard status
Inputs: Mouse position, button status, keyboard status
Output: CX = integer between 0 and 638 (incremented by 8), representing the x-axis position of the mouse
BX = mouse button status. 1 = button released (clicked), 0 = button not clicked.
Description: Infinite loop with mouse (int 33h) and keyboard (int 16h) polling, with other program calls being made following user input.
This procedure also includes the subroutines PauseGame, QuitGame and NewGame, which are activated by specific keystrokes, and will pause, quit, or begin a new game, respectively. Each of these
three functions will employ the DisplayPicture routine that displays a dialog box in the upper righthand of the screen. Verification of intent to start a new game or quit the program will then make calls to the proper graphics and internal implementation routines.
Owner: Nathan Gosse
EndGame
Purpose:End current game, display game over image, start new game
Inputs: GameBoard data
Output: Screen, GameBoard
Description: Based on piece positions in the GameBoard, EndGame is called to end current game.
Owner: Jacob Perkins
StartNewGame
Purpose: Generate and draw new board, display commands window, get next piece
Inputs: None
Output: GameBoard, screen
Owner: Nathan Gosse
GetNextPiece
Purpose: Update next piece available using RandomPiece, show next and current pieces.
Inputs: NextPiece
Output: NextPiece, CurrentPiece, Screen
Owner: Nathan Gosse
DrawPiece
Purpose: Draw a piece onto screen
Inputs: AL = offset of pixel buffer in lookup table
DX = position of upper lefthand corner on screen
Output: Screen
Owner: Peter Jones
DrawBoard
Purpose: Draw all pieces residing in GameBoard onto video screen
Inputs: GameBoard
Output: Screen
Owner: Peter Jones
StepPiece
Purpose: Takes the next step in a piece's motion. Checs for collision with pieces, walls, back wall, and takes correct action
Inputs: GameBoard, SI = Current location, Angle, AVar, BVar, Time
Output: GameBoard, SI = old location, DI = new location, Angle, AVar, BVar, AL =1 if piece comes to rest
Owner: Jon Agnich
DisplayPicture
Purpose: Draw small .PCX files in a defined location on the 320x200 screen.
Inputs: BL = Type of picture (limited to file names included in the 'PicFileOffsets'lookup table, currently 0=commands.pcx, 1=quit.pcx, 2=pause.pcx, 3=new.pcx).
[PicDisplayStart] = Pixel position of upper lefthand corner of image
.PCX file with appropriate header information
Output: Draw to screen
Description: Display dialog boxes and other small .PCX files on screen without writing over other images.
Owner: Nathan Gosse
LoadPixelArrays
Purpose: Load graphical data for each piece into piece pixel buffers
Inputs: BL = Type of piece (defined by constants).
.PCX file with appropriate header information
Output: Pixel arrays located at WALLarray, REDLarray, etc.
Description: Fills pixel buffers so that drawing pieces to screen does not require reading from disk each time