dos-vga-arena-shooter-game/game.c

76 lines
1.6 KiB
C

#include <stdio.h>
#include "vga.h"
#include "keyboard.h"
#include "mouse_io.h"
#include "pc_stuff.h"
#include "bmpload.h"
struct BMPImage spritesheetImage;
struct VGAColor vgaColors[256];
struct SpriteRender arenaWallTop, arenaWallSide, arenaFloor;
int main(void) {
FILE *fh;
int keepRunning = 1;
struct MouseStatus mouseStatus;
installKeyboardHandler();
activateMouse(&mouseStatus);
initializeDrawBuffer();
fh = fopen("sprtsht.bmp", "rb");
if (readBMPIntoNewMemory(fh, &spritesheetImage)) return 1;
fclose(fh);
return 0;
spritesheetImage.transparentColor = 0;
buildSpriteFromSpritesheet(
&spritesheetImage,
&arenaWallTop,
0, 0, 20, 20
);
setVideoMode(VIDEO_MODE_VGA_256);
bmp256ColorPaletteToVGAColorPalette(&spritesheetImage, vgaColors);
setVGAColors(vgaColors, 256);
while (keepRunning) {
arenaWallTop.x = 0;
arenaWallTop.y = 0;
drawSprite(&arenaWallTop);
waitStartVbl();
copyDrawBufferToDisplay();
waitEndVbl();
}
// states:
// * main menu
// * play
// * quit
// * play
// * draw base map
// * draw sidebar
// * Game loop
// * get mouse
// * get keyboard
// * set character position
// * check for enemy spawn and spawn enemy if needed
// * check for character firing and able to fire, spawn bullet if allowed
// * check for each enemy firing and able to fire, spawn enemy bullet if allowed
// * check for bullet collisions
// * enemies are destroyed
// * character is damaged
// * check for bullets hitting the edges of the screen and remove
// *
//
return 0;
}