home *** CD-ROM | disk | FTP | other *** search
- // STARFERR2.CPP - Game Engine Demo - STAR FERRET DELUXE!
- // try and add stuff!
- // remember to compile you need GPDUMB1.CPP, GPDUMB2.CPP and
- // DirectX libraries DDRAW.LIB, DSOUND.LIB, DINPUT.LIB,
- // DINPUT8.LIB, and WINMM.LIB
-
- // INCLUDES ///////////////////////////////////////////////
-
- #define WIN32_LEAN_AND_MEAN
- #define INITGUID
-
- #include <windows.h> // include important windows stuff
- #include <windowsx.h>
- #include <mmsystem.h>
- #include <iostream.h> // include important C/C++ stuff
- #include <conio.h>
- #include <stdlib.h>
- #include <malloc.h>
- #include <memory.h>
- #include <string.h>
- #include <stdarg.h>
- #include <stdio.h>
- #include <math.h>
- #include <io.h>
- #include <fcntl.h>
-
- #include <ddraw.h> // directX includes
- #include <dsound.h>
- #include <dinput.h>
- #include "gpdumb1.h" // game library includes
- #include "gpdumb2.h"
-
- //#include "mono.h"
-
- // DEFINES ////////////////////////////////////////////////
-
- // defines for windows
- #define WINDOW_CLASS_NAME "WINXCLASS" // class name
-
- #define WINDOW_WIDTH 64 // size of window
- #define WINDOW_HEIGHT 48
-
- // star ferret constants
-
- // vertical extents of players motion
- #define MIN_STARFERRET_Y 300
- #define MAX_STARFERRET_Y (screen_height-40)
-
- // weapons defines
- #define MAX_PLASMA 8 // max number of plasma pulses
-
- #define PLASMA_STATE_OFF 0 // this plasma is dead or off
- #define PLASMA_STATE_ON 1 // this one is alive and in flight
-
- // starfield defines
- #define MAX_STARS 128
-
- // asteroid field defines
- #define MAX_ROCKS 48
- #define ROCK_STATE_OFF 0 // this rock is dead or off
- #define ROCK_STATE_ON 1 // this one is alive and in flight
-
- #define ROCK_LARGE 0 // sizes of rock
- #define ROCK_MEDIUM 1
- #define ROCK_SMALL 2
-
- // explosion defines
- #define MAX_BURSTS 8
- #define BURST_STATE_OFF 0 // this burst is dead or off
- #define BURST_STATE_ON 1 // this one is alive
-
- // defines for player states
- #define PLAYER_STATE_DEAD 0
- #define PLAYER_STATE_DYING 1
- #define PLAYER_STATE_INVINCIBLE 2
- #define PLAYER_STATE_ALIVE 3
-
- // sound id's
- #define MAX_FIRE_SOUNDS 8
- #define MAX_EXPL_SOUNDS 8
-
- // PROTOTYPES /////////////////////////////////////////////
-
- // game console
- int Game_Init(void *parms=NULL);
- int Game_Shutdown(void *parms=NULL);
- int Game_Main(void *parms=NULL);
-
- // helper functions for game logic
- void Draw_Info(void);
- void Start_Burst(int x, int y, int width, int height, int xv,int yv);
- void Draw_Bursts(void);
- void Move_Bursts(void);
- void Delete_Bursts(void);
- void Init_Bursts(void);
- void Draw_Rocks(void);
- void Start_Rock(int x, int y, int size,int xv, int yv);
- void Move_Rocks(void);
- void Delete_Rocks(void);
- void Init_Rocks(void);
- void Fire_Plasma(int x,int y, int vel);
- void Draw_Plasma(void);
- void Move_Plasma(void);
-
- void Delete_Plasma(void);
- void Init_Plasma(void);
- void Move_Stars(void);
- void Draw_Stars(void);
- void Init_Stars(void);
-
- // TYPES //////////////////////////////////////////////////
-
- // used to contain a single star
- typedef struct STAR_TYP
- {
- UCHAR color;
- int x,y;
- int velocity;
- } STAR, *STAR_PTR;
-
- // GLOBALS ////////////////////////////////////////////////
-
- HWND main_window_handle = NULL; // save the window handle
- HINSTANCE main_instance = NULL; // save the instance
- char buffer[80]; // used to print text
-
- BITMAP_IMAGE background_bmp; // used to hold backgrounds
-
- BOB starferret; // the player
- int moving_up = 0; // used to track if player is moving up for
- // various parallax effects
- BOB plasma[MAX_PLASMA]; // plasma pulses
- BOB rocks[MAX_ROCKS]; // the asteroids
- BOB bursts[MAX_BURSTS]; // the explosion bursts
-
- int rock_sizes[3] = {96,32,12}; // width X height sizes for scaler
-
- STAR stars[MAX_STARS]; // the star field
-
- // player state variables
- int player_state = PLAYER_STATE_ALIVE;
- int player_score = 0; // the score
- int player_ships = 3; // ships left
- int player_damage = 0; // damage of player
- int player_counter = 0; // used for state transition tracking
- int player_regen_count = 0; // used to regenerate player
-
- // sound id's
- int intro_music_id = -1,
- main_music_id = -1,
- ready_id = -1,
- engines_id = -1,
- scream_id = -1;
-
- int expl_ids[MAX_EXPL_SOUNDS] = {-1,-1,-1,-1,-1,-1,-1,-1};
- int fire_ids[MAX_FIRE_SOUNDS] = {-1,-1,-1,-1,-1,-1,-1,-1};
-
- //MONOPRINT mono;
-
- // PROTOTYPES //////////////////////////////////////////////
-
- // FUNCTIONS //////////////////////////////////////////////
-
- LRESULT CALLBACK WindowProc(HWND hwnd,
- UINT msg,
- WPARAM wparam,
- LPARAM lparam)
- {
- // this is the main message handler of the system
- PAINTSTRUCT ps; // used in WM_PAINT
- HDC hdc; // handle to a device context
-
- // what is the message
- switch(msg)
- {
- case WM_CREATE:
- {
- // do initialization stuff here
- return(0);
- } break;
-
- case WM_PAINT:
- {
- // start painting
- hdc = BeginPaint(hwnd,&ps);
-
- // end painting
- EndPaint(hwnd,&ps);
- return(0);
- } break;
-
- case WM_DESTROY:
- {
- // kill the application
- PostQuitMessage(0);
- return(0);
- } break;
-
- default:break;
-
- } // end switch
-
- // process any messages that we didn't take care of
- return (DefWindowProc(hwnd, msg, wparam, lparam));
-
- } // end WinProc
-
- // WINMAIN ////////////////////////////////////////////////
-
- int WINAPI WinMain( HINSTANCE hinstance,
- HINSTANCE hprevinstance,
- LPSTR lpcmdline,
- int ncmdshow)
- {
- // this is the winmain function
-
- WNDCLASS winclass; // this will hold the class we create
- HWND hwnd; // generic window handle
- MSG msg; // generic message
- HDC hdc; // generic dc
- PAINTSTRUCT ps; // generic paintstruct
-
- // first fill in the window class stucture
- winclass.style = CS_DBLCLKS | CS_OWNDC |
- CS_HREDRAW | CS_VREDRAW;
- winclass.lpfnWndProc = WindowProc;
- winclass.cbClsExtra = 0;
- winclass.cbWndExtra = 0;
- winclass.hInstance = hinstance;
- winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- winclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
- winclass.lpszMenuName = NULL;
- winclass.lpszClassName = WINDOW_CLASS_NAME;
-
- // register the window class
- if (!RegisterClass(&winclass))
- return(0);
-
- // create the window, note the use of WS_POPUP
- if (!(hwnd = CreateWindow(WINDOW_CLASS_NAME, // class
- "WinX Game Console", // title
- WS_POPUP | WS_VISIBLE,
- 0,0, // x,y
- WINDOW_WIDTH, // width
- WINDOW_HEIGHT, // height
- NULL, // handle to parent
- NULL, // handle to menu
- hinstance,// instance
- NULL))) // creation parms
- return(0);
-
- // save the window handle and instance in a global
- main_window_handle = hwnd;
- main_instance = hinstance;
-
- // perform all game console specific initialization
- Game_Init();
-
- // enter main event loop
- while(1)
- {
- if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
- {
- // test if this is a quit
- if (msg.message == WM_QUIT)
- break;
-
- // translate any accelerator keys
- TranslateMessage(&msg);
-
- // send the message to the window proc
- DispatchMessage(&msg);
- } // end if
-
- // main game processing goes here
- Game_Main();
-
- } // end while
-
- // shutdown game and release all resources
- Game_Shutdown();
-
- // return to Windows like this
- return(msg.wParam);
-
- } // end WinMain
-
-
- ///////////////////////////////////////////////////////////
-
- void Init_Stars(void)
- {
- // this function initializes all the stars in such a way
- // that their intensity is proportional to their
- // velocity
-
- for (int index=0; index<MAX_STARS; index++)
- {
- // random postion
- stars[index].x = rand()%screen_width;
- stars[index].y = rand()%screen_height;
-
- // select star plane
- int plane = rand()%4; // (1..4)
-
- // based on plane select velocity and color
- stars[index].velocity = -(1 + plane*2);
- stars[index].color = 25 - (plane*3);
-
- } // end for index
-
- } // end Init_Stars
-
- ///////////////////////////////////////////////////////////
-
- void Move_Stars(void)
- {
- // this function moves all the stars
-
- for (int index=0; index<MAX_STARS; index++)
- {
- // translate upward
- if (!moving_up)
- stars[index].y-=stars[index].velocity;
- else
- stars[index].y-=(stars[index].velocity+((moving_up*stars[index].velocity)));
-
- // test for collision with top of screen
- if (stars[index].y >= screen_height)
- stars[index].y-=screen_height;
-
- } // end for index
-
- } // end Move_Stars
-
- ///////////////////////////////////////////////////////////
-
- void Draw_Stars(void)
- {
- // this function draws all the stars
-
- // lock back surface
- DD_Lock_Back_Surface();
-
- // draw all the stars
- for (int index=0; index<MAX_STARS; index++)
- {
- // draw stars
- Draw_Pixel(stars[index].x,stars[index].y, stars[index].color,back_buffer, back_lpitch);
-
- } // end for index
-
- // unlock the secondary surface
- DD_Unlock_Back_Surface();
-
- } // end Draw_Stars
-
- ///////////////////////////////////////////////////////////
-
- void Init_Plasma(void)
- {
- // this function initializes and loads all the plasma
- // weapon pulses
-
- // load the plasma imagery
- Load_Bitmap_File(&bitmap8bit, "PLASMA8.BMP");
-
-
- #if 1
- // now create and load each plasma pulse
- for (int pulse=0; pulse<MAX_PLASMA; pulse++)
- {
- // create the bob to hold pulse
- Create_BOB(&plasma[pulse],0,0,16,24,6,
- BOB_ATTR_VISIBLE | BOB_ATTR_MULTI_FRAME,
- DDSCAPS_SYSTEMMEMORY);
-
- // load animation frames
- for (int frame=0; frame<6; frame++)
- Load_Frame_BOB(&plasma[pulse],&bitmap8bit,frame,frame,0,BITMAP_EXTRACT_MODE_CELL);
-
- // set animation rate
- Set_Anim_Speed_BOB(&plasma[pulse],1);
-
- // set state to off
- plasma[pulse].state = PLASMA_STATE_OFF;
-
- } // end for pulse
- #endif
-
- #if 0
- // create the first bob
- Create_BOB(&plasma[0],0,0,16,24,6,
- BOB_ATTR_VISIBLE | BOB_ATTR_MULTI_FRAME,
- DDSCAPS_SYSTEMMEMORY);
-
- // load animation frames
- for (int frame=0; frame<6; frame++)
- Load_Frame_BOB(&plasma[0],&bitmap8bit,frame,frame,0,BITMAP_EXTRACT_MODE_CELL);
-
- // set animation rate
- Set_Anim_Speed_BOB(&plasma[0],1);
-
- // set state to off
- plasma[0].state = PLASMA_STATE_OFF;
-
- for (int pulse=1; pulse<MAX_PLASMA; pulse++)
- {
- memcpy(&plasma[pulse], &plasma[0], sizeof(BOB));
- } // end for pulse
-
- #endif
-
-
- // unload data infile
- Unload_Bitmap_File(&bitmap8bit);
-
- } // end Init_Plasma
-
- ///////////////////////////////////////////////////////////
-
- void Delete_Plasma(void)
- {
- // this function simply deletes all memory and surfaces
- // related to the plasma pulses
-
- for (int index=0; index<MAX_PLASMA; index++)
- Destroy_BOB(&plasma[index]);
-
- } // end Delete_Plasma
-
- ///////////////////////////////////////////////////////////
-
- void Move_Plasma(void)
- {
- // this function moves all the plasma pulses and checks for
- // collision with the rocks
-
- for (int index=0; index<MAX_PLASMA; index++)
- {
- // test if plasma pulse is in flight
- if (plasma[index].state == PLASMA_STATE_ON)
- {
- // move the pulse upward
- Move_BOB(&plasma[index]);
-
- // test for boundaries
- if (plasma[index].y < 0 )
- {
- // kill the pulse
- plasma[index].state = PLASMA_STATE_OFF;
-
- // move to next pulse
- continue;
- } // end if
-
- // test for collision with rocks
-
- for (int rock=0; rock<MAX_ROCKS; rock++)
- {
- if (rocks[rock].state==ROCK_STATE_ON)
- {
- // test for collision
- if (Collision_Test(plasma[index].x, plasma[index].y,
- plasma[index].width, plasma[index].height,
- rocks[rock].x, rocks[rock].y,
- rocks[rock].varsI[1], rocks[rock].varsI[1]))
- {
- // kill pulse
- plasma[index].state = PLASMA_STATE_OFF;
-
- switch(rocks[rock].varsI[0])
- {
- case ROCK_LARGE:
- {
- // start explosion
- Start_Burst(plasma[index].x, plasma[index].y,
- 68+rand()%12,54+rand()%10,
- rocks[rock].xv*.5, rocks[rock].yv*.5);
-
- } break;
-
- case ROCK_MEDIUM:
- {
- // start explosion
- Start_Burst(plasma[index].x, plasma[index].y,
- 52+rand()%10,44+rand()%8,
- rocks[rock].xv*.5, rocks[rock].yv*.5);
-
- } break;
-
- case ROCK_SMALL:
- {
-
- // start explosion
- Start_Burst(plasma[index].x, plasma[index].y,
- 34-4+rand()%8,30-3+rand()%6,
- rocks[rock].xv*.5, rocks[rock].yv*.5);
-
- } break;
-
- } // end switch
-
- // update score
- player_score+=rocks[rock].varsI[2];
-
- // test strength of rock, cause damage
- rocks[rock].varsI[2]-=50;
-
- // split test
- if (rocks[rock].varsI[2] > 0 && rocks[rock].varsI[2] < 50)
- {
- // test the size of rock
- switch(rocks[rock].varsI[0])
- {
- case ROCK_LARGE:
- {
- // split into two medium
- Start_Rock(rocks[rock].x+rand()%16,rocks[rock].y+rand()%16,
- ROCK_MEDIUM,
- rocks[rock].xv-2+rand()%4,rocks[rock].yv-2+rand()%4);
-
- Start_Rock(rocks[rock].x+rand()%16,rocks[rock].y+rand()%16,
- ROCK_MEDIUM,
- rocks[rock].xv-2+rand()%4,rocks[rock].yv-2+rand()%4);
-
- // throw in a small?
- if ((rand()%3)==1)
- Start_Rock(rocks[rock].x+rand()%16,rocks[rock].y+rand()%16,
- ROCK_SMALL,
- rocks[rock].xv-2+rand()%4,rocks[rock].yv-2+rand()%4);
-
- // kill the original
- rocks[rock].state = ROCK_STATE_OFF;
-
- } break;
-
- case ROCK_MEDIUM:
- {
- // split into 1 - 3 small
- int num_rocks = 1+rand()%3;
-
- for (; num_rocks >=1; num_rocks--)
- {
- Start_Rock(rocks[rock].x+rand()%8,rocks[rock].y+rand()%8,
- ROCK_SMALL,
- rocks[rock].xv-2+rand()%4,rocks[rock].yv-2+rand()%4);
-
- } // end for num_rocks
-
- // kill the original
- rocks[rock].state = ROCK_STATE_OFF;
-
- } break;
-
- case ROCK_SMALL:
- {
- // just kill it
- rocks[rock].state = ROCK_STATE_OFF;
-
- } break;
-
- default:break;
-
-
- } // end switch
-
- } // end if split
- else
- if (rocks[rock].varsI[2] <= 0)
- {
- // kill rock
- rocks[rock].state = ROCK_STATE_OFF;
- } // end else
-
- // break out of loop
- break;
-
- } // end if collision
- } // end if rock alive
- } // end for rock
-
- } // end if
-
- } // end for index
-
- } // end Move_Plasma
-
- ///////////////////////////////////////////////////////////
-
- void Draw_Plasma(void)
- {
- // this function draws all the plasma pulses
-
- for (int index=0; index<MAX_PLASMA; index++)
- {
- // test if plasma pulse is in flight
- if (plasma[index].state == PLASMA_STATE_ON)
- {
- // draw the pulse
- Draw_BOB(&plasma[index],lpddsback);
-
- // animate the pulse
- Animate_BOB(&plasma[index]);
-
- } // end if
-
- } // end for index
-
- } // end Draw_Plasma
-
- ///////////////////////////////////////////////////////////
-
- void Fire_Plasma(int x,int y, int vel)
- {
- // this function fires a plasma pulse at the given starting
- // position and velocity, of course, one must be free for
- // this to work
-
- // scan for a pulse that is available
- for (int index=0; index<MAX_PLASMA; index++)
- {
- // is this one available
- // test if plasma pulse is in flight
- if (plasma[index].state == PLASMA_STATE_OFF)
- {
- // start this one up
- plasma[index].x = x;
- plasma[index].y = y;
- plasma[index].yv = -vel;
- plasma[index].curr_frame = 0;
- plasma[index].state = PLASMA_STATE_ON;
-
- // start sound up
- for (int sound_index=0; sound_index < MAX_FIRE_SOUNDS; sound_index++)
- {
- // test if this sound is playing
- if (Status_Sound(fire_ids[sound_index])==0)
- {
- Play_Sound(fire_ids[sound_index]);
- break;
- } // end if
-
- } // end for sound_index
-
- // later
- return;
-
- } // end if
-
- } // end for
-
- } // end Fire_Plasma
-
- ///////////////////////////////////////////////////////////
-
- void Init_Rocks(void)
- {
- // this function initializes and loads all the rocks
-
- // load the rocks imagery
- Load_Bitmap_File(&bitmap8bit, "ROCKS8.BMP");
-
- // create the first bob
- Create_BOB(&rocks[0],0,0,96,96,20,
- BOB_ATTR_VISIBLE | BOB_ATTR_MULTI_FRAME,
- DDSCAPS_SYSTEMMEMORY);
-
- // load animation frames
- for (int frame=0; frame < 20; frame++)
- Load_Frame_BOB(&rocks[0],&bitmap8bit,frame,frame%6,frame/6,BITMAP_EXTRACT_MODE_CELL);
-
- // set animation rate
- Set_Anim_Speed_BOB(&rocks[0],1+rand()%5);
- Set_Vel_BOB(&rocks[0], -4+rand()%8, 4+rand()%4);
- Set_Pos_BOB(&rocks[0], rand()%screen_width, rand()%screen_height);
-
- // set size of rock
- rocks[0].varsI[0] = rand()%3;
- rocks[0].varsI[1] = rock_sizes[rocks[0].varsI[0]];
-
- // set state to off
- rocks[0].state = ROCK_STATE_OFF;
-
- for (int rock=1; rock<MAX_ROCKS; rock++)
- {
- memcpy(&rocks[rock], &rocks[0], sizeof(BOB));
-
- // set animation rate
- Set_Anim_Speed_BOB(&rocks[rock],1+rand()%5);
-
- // set velocity
- Set_Vel_BOB(&rocks[rock], -4+rand()%8, 4+rand()%4);
-
- // set position
- Set_Pos_BOB(&rocks[rock], rand()%screen_width, rand()%screen_height);
-
- // set size of rock
- rocks[rock].varsI[0] = rand()%3;
- rocks[rock].varsI[1] = rock_sizes[rocks[rock].varsI[0]];
- } // end for rock
-
- // unload data infile
- Unload_Bitmap_File(&bitmap8bit);
-
- } // end Init_Rocks
-
- ///////////////////////////////////////////////////////////
-
- void Delete_Rocks(void)
- {
- // this function simply deletes all memory and surfaces
- // related to the rocks pulses
-
- for (int index=0; index<MAX_ROCKS; index++)
- Destroy_BOB(&rocks[index]);
-
- } // end Delete_Rocks
-
- ///////////////////////////////////////////////////////////
-
- void Move_Rocks(void)
- {
- // this function moves all the rocks pulses and checks for
- // collision with the rocks
-
- for (int index=0; index<MAX_ROCKS; index++)
- {
- // test if rocks pulse is in flight
- if (rocks[index].state == ROCK_STATE_ON)
- {
- // move the rock
- Move_BOB(&rocks[index]);
-
- // add player motion in
- if (moving_up)
- rocks[index].y+=(rocks[index].yv*.5);
-
- // test if rock is off screen
- if (rocks[index].y > screen_height)
- {
- // kill rock and put back on available list
- rocks[index].state = ROCK_STATE_OFF;
- } // end if
-
- // test for collision with rocks
- if (Collision_Test(starferret.x, starferret.y,
- starferret.width, starferret.height,
- rocks[index].x, rocks[index].y,
- rocks[index].varsI[1], rocks[index].varsI[1]))
- {
- // what size rock did we hit?
-
- switch(rocks[index].varsI[0])
- {
- case ROCK_LARGE:
- {
- // start explosion
- Start_Burst(rocks[index].x, rocks[index].y,
- 68+rand()%12,54+rand()%10,
- rocks[index].xv*.5, rocks[index].yv*.5);
-
- // update players damage
- player_damage+=50;
-
- } break;
-
- case ROCK_MEDIUM:
- {
- // start explosion
- Start_Burst(rocks[index].x, rocks[index].y,
- 52+rand()%10,44+rand()%8,
- rocks[index].xv*.5, rocks[index].yv*.5);
-
- // update players damage
- player_damage+=20;
-
- } break;
-
- case ROCK_SMALL:
- {
- // start explosion
- Start_Burst(rocks[index].x, rocks[index].y,
- 34-4+rand()%8,30-3+rand()%6,
- rocks[index].xv*.5, rocks[index].yv*.5);
-
- // update players damage
- player_damage+=10;
-
- } break;
-
- } // end switch
-
- // update score
- player_score+=rocks[index].varsI[2];
-
- // kill the original
- rocks[index].state = ROCK_STATE_OFF;
-
- } // end if collision
-
- } // end if rock
-
- } // end for index
-
- // now test if it's time to add a new rock to the list
- if ((rand()%6)==3 && player_state == PLAYER_STATE_ALIVE)
- {
- // scan for a rock to initialize
- for (index=0; index<MAX_ROCKS; index++)
- {
- // is this rock available?
- if (rocks[index].state == ROCK_STATE_OFF)
- {
- // set animation rate
- Set_Anim_Speed_BOB(&rocks[index],1+rand()%5);
-
- // set velocity
- Set_Vel_BOB(&rocks[index], -4+rand()%8, 4+rand()%12);
-
- // set position
- Set_Pos_BOB(&rocks[index], rand()%screen_width, -128);
-
- // set size of rock
- rocks[index].varsI[0] = rand()%3;
- rocks[index].varsI[1] = rock_sizes[rocks[index].varsI[0]];
-
- // set strength of rock
- switch(rocks[index].varsI[0])
- {
- case ROCK_LARGE:
- {
- // set hardness of rock
- rocks[index].varsI[2] = 100+rand()%100;
- } break;
-
- case ROCK_MEDIUM:
- {
- // set hardness of rock
- rocks[index].varsI[2] = 40 + rand()%30;
- } break;
-
- case ROCK_SMALL:
- {
- // set hardness of rock
- rocks[index].varsI[2] = 10;
- } break;
-
- default:break;
-
- } // end switch
-
- // turn rock on
- rocks[index].state = ROCK_STATE_ON;
-
- // later
- return;
-
- } // end if
-
- } // end for index
-
- } // end if
-
- } // end Move_Rocks
-
- ///////////////////////////////////////////////////////////
-
- void Start_Rock(int x, int y, int size,int xv, int yv)
- {
- // this functions starts a rock up with the sent parms, considering
- // there is one left
-
- // scan for a rock to initialize
- for (int index=0; index<MAX_ROCKS; index++)
- {
- // is this rock available?
- if (rocks[index].state == ROCK_STATE_OFF)
- {
- // set animation rate
- Set_Anim_Speed_BOB(&rocks[index],1+rand()%5);
-
- // set velocity
- Set_Vel_BOB(&rocks[index], xv,yv);
-
- // set position
- Set_Pos_BOB(&rocks[index], x,y);
-
- // set size of rock
- rocks[index].varsI[0] = size;
- rocks[index].varsI[1] = rock_sizes[rocks[index].varsI[0]];
-
- // set strength of rock
- switch(rocks[index].varsI[0])
- {
- case ROCK_LARGE:
- {
- // set hardness of rock
- rocks[index].varsI[2] = 100+rand()%100;
- } break;
-
- case ROCK_MEDIUM:
- {
- // set hardness of rock
- rocks[index].varsI[2] = 40 + rand()%30;
- } break;
-
- case ROCK_SMALL:
- {
- // set hardness of rock
- rocks[index].varsI[2] = 10;
- } break;
-
- default:break;
-
- } // end switch
-
- // turn rock on
- rocks[index].state = ROCK_STATE_ON;
-
- // later
- return;
-
- } // end if
-
- } // end for index
-
- } // end Start_Rock
-
- ///////////////////////////////////////////////////////////
-
- void Draw_Rocks(void)
- {
- // this function draws all the rocks
-
- for (int index=0; index<MAX_ROCKS; index++)
- {
- // test if rocks pulse is in flight
- if (rocks[index].state == ROCK_STATE_ON)
- {
-
- if (rocks[index].varsI[0]!=ROCK_LARGE)
- {
- // draw the rock scaled
- Draw_Scaled_BOB(&rocks[index],
- rocks[index].varsI[1],rocks[index].varsI[1],
- lpddsback);
- }
- else // draw normal
- Draw_BOB(&rocks[index],lpddsback);
-
- // animate the pulse
- Animate_BOB(&rocks[index]);
-
- } // end if
-
- } // end for index
-
- } // end Draw_Rocks
-
- ///////////////////////////////////////////////////////////
-
- void Init_Bursts(void)
- {
- // this function initializes and loads all the bursts
-
- // load the bursts imagery
- Load_Bitmap_File(&bitmap8bit, "EXPL8.BMP");
-
- // create the first bob
- Create_BOB(&bursts[0],0,0,42,36,14,
- BOB_ATTR_VISIBLE | BOB_ATTR_MULTI_FRAME,
- DDSCAPS_SYSTEMMEMORY);
-
- // load animation frames
- for (int frame=0; frame < 14; frame++)
- Load_Frame_BOB(&bursts[0],&bitmap8bit,frame,frame%6,frame/6,BITMAP_EXTRACT_MODE_CELL);
-
- // set animation rate
- Set_Anim_Speed_BOB(&bursts[0],1);
-
- // set size of burst
- bursts[0].varsI[0] = bursts[0].width;
- bursts[0].varsI[1] = bursts[0].height;
-
- // set state to off
- bursts[0].state = BURST_STATE_OFF;
-
- for (int burst=1; burst<MAX_BURSTS; burst++)
- {
- memcpy(&bursts[burst], &bursts[0], sizeof(BOB));
- } // end for burst
-
- // unload data infile
- Unload_Bitmap_File(&bitmap8bit);
-
- } // end Init_Bursts
-
- ///////////////////////////////////////////////////////////
-
- void Delete_Bursts(void)
- {
- // this function simply deletes all memory and surfaces
- // related to the bursts pulses
-
- for (int index=0; index < MAX_BURSTS; index++)
- Destroy_BOB(&bursts[index]);
-
- } // end Delete_Bursts
-
- ///////////////////////////////////////////////////////////
-
- void Move_Bursts(void)
- {
- // this function moves all the bursts
-
- for (int index=0; index<MAX_BURSTS; index++)
- {
- // test if bursts pulse is in moving
- if (bursts[index].state == BURST_STATE_ON)
- {
- // move the burst
- Move_BOB(&bursts[index]);
-
- // add player motion in
- if (moving_up)
- bursts[index].y+=(bursts[index].yv*.5);
-
- // test if burst is off screen or done with animation
- if ((bursts[index].y > screen_height) || bursts[index].curr_frame >= bursts[index].num_frames-1)
- {
- // kill burst and put back on available list
- bursts[index].state = BURST_STATE_OFF;
- } // end if
-
- } // end if
-
- } // end for index
-
- } // end Move_Bursts
-
- ///////////////////////////////////////////////////////////
-
- void Draw_Bursts(void)
- {
- // this function draws all the bursts
- for (int index=0; index<MAX_BURSTS; index++)
- {
- // test if bursts pulse is in flight
- if (bursts[index].state == BURST_STATE_ON)
- {
- if (bursts[index].varsI[0]!=bursts[index].width ||
- bursts[index].varsI[1]!=bursts[index].height)
- {
- // draw the burst scaled
- Draw_Scaled_BOB(&bursts[index],
- bursts[index].varsI[0],bursts[index].varsI[1],
- lpddsback);
- }
- else // draw normal
- Draw_BOB(&bursts[index],lpddsback);
-
- // animate the explosion
- Animate_BOB(&bursts[index]);
-
- } // end if
-
- } // end for index
-
- } // end Draw_Bursts
-
- ///////////////////////////////////////////////////////////
-
- void Start_Burst(int x, int y, int width, int height, int xv,int yv)
- {
- // this function starts a burst up
-
- // now test if it's time to add a new burst to the list
-
- // scan for a burst to initialize
- for (int index=0; index<MAX_BURSTS; index++)
- {
- // is this burst available?
- if (bursts[index].state == BURST_STATE_OFF)
- {
- // set animation rate
- Set_Anim_Speed_BOB(&bursts[index],1);
- bursts[index].curr_frame = 0;
-
- // set velocity
- Set_Vel_BOB(&bursts[index], xv,yv);
-
- // set position
- Set_Pos_BOB(&bursts[index], x,y);
-
- // set size of burst
- bursts[index].varsI[0] = width;
- bursts[index].varsI[1] = height;
-
- // turn burst on
- bursts[index].state = BURST_STATE_ON;
-
- // start sound up
- for (int sound_index=0; sound_index < MAX_EXPL_SOUNDS; sound_index++)
- {
- // test if this sound is playing
- if (Status_Sound(expl_ids[sound_index])==0)
- {
- Play_Sound(expl_ids[sound_index]);
- break;
- } // end if
-
- } // end for sound_index
-
- // later
- return;
-
- } // end if
-
- } // end for index
-
- } // end Start_Burst
-
- ///////////////////////////////////////////////////////////
-
- void Draw_Info(void)
- {
- // this function draws all the information at the top of the screen
-
- char score[16]; // hold score
- static int red_glow = 0; // used for damage display
-
- // build up scrore string
- sprintf(score,"0000000%d",player_score);
-
- // build up final string
- sprintf(buffer,"SCORE %s",&score[strlen(score)-8]);
- Draw_Text_GDI(buffer,10,10,RGB(0,255,0),lpddsback);
-
- // draw damage
- sprintf(buffer,"DAMAGE %d%%",player_damage);
-
- if (player_damage < 90)
- Draw_Text_GDI(buffer,320-8*strlen(buffer),10,RGB(0,255,0),lpddsback);
- else
- Draw_Text_GDI(buffer,320-8*strlen(buffer),10,RGB(red_glow,0,0),lpddsback);
-
- // update red glow
- if ((red_glow+=15) > 255)
- red_glow = 0;
-
- // draw ships
- sprintf(buffer,"SHIPS %d",player_ships);
- Draw_Text_GDI(buffer,500,10,RGB(0,255,0),lpddsback);
-
- } // end Draw_Info
-
- ///////////////////////////////////////////////////////////
-
- void Do_Intro(void)
- {
- // the worlds simples intro
-
- int shade; // used as looping var
-
- // load bitmap into primary buffer
- Load_Bitmap_File(&bitmap8bit, "STARSB8.BMP");
- Create_Bitmap(&background_bmp,0,0,640,480);
- Load_Image_Bitmap(&background_bmp, &bitmap8bit,0,0,BITMAP_EXTRACT_MODE_CELL);
- DD_Lock_Primary_Surface();
- Draw_Bitmap(&background_bmp,primary_buffer, primary_lpitch, 0);
- DD_Unlock_Primary_Surface();
- Unload_Bitmap_File(&bitmap8bit);
- Destroy_Bitmap(&background_bmp);
-
- for (shade=0; shade < 256; shade++)
- {
- // draw text in shades
- Draw_Text_GDI("DUMB GAMES INC.",320-4*strlen("DUMB GAMES INC."),200,
- RGB(shade,shade,shade),lpddsprimary);
- Sleep(2);
-
- // is user trying to bail
- if (KEY_DOWN(VK_ESCAPE))
- return;
-
- } // end for shade
-
- Sleep(2000);
-
- for (shade=255; shade >=0; shade--)
- {
- // draw text in shades
- Draw_Text_GDI("DUMB GAMES INC.",320-4*strlen("DUMB GAMES INC."),200,
- RGB(0,0,shade),lpddsprimary);
- Sleep(2);
-
- // is user trying to bail
- if (KEY_DOWN(VK_ESCAPE))
- return;
-
- } // end for shade
-
- Sleep(1000);
-
- for (shade=0; shade < 256; shade++)
- {
- // draw text in shades
- Draw_Text_GDI("- PRESENTS -",320-4*strlen("- PRESENTS -"),200,
- RGB(shade,shade,shade),lpddsprimary);
- Sleep(2);
-
- // is user trying to bail
- if (KEY_DOWN(VK_ESCAPE))
- return;
-
- } // end for shade
-
- Sleep(2000);
-
- for (shade=255; shade >=0; shade--)
- {
- // draw text in shades
- Draw_Text_GDI("- PRESENTS -",320-4*strlen("- PRESENTS -"),200,
- RGB(0,0,shade),lpddsprimary);
- Sleep(2);
-
- // is user trying to bail
- if (KEY_DOWN(VK_ESCAPE))
- return;
-
- } // end for shade
-
- Sleep(1000);
-
- for (shade=0; shade < 256; shade++)
- {
- // draw text in shades
- Draw_Text_GDI("A NECRON PRODUCTION",320-4*strlen("A NECRON PRODUCTION"),200,
- RGB(shade,shade,shade),lpddsprimary);
- Sleep(2);
-
- // is user trying to bail
- if (KEY_DOWN(VK_ESCAPE))
- return;
-
- } // end for shade
-
- Sleep(1000);
-
- for (shade=255; shade >=0; shade--)
- {
- // draw text in shades
- Draw_Text_GDI("A NECRON PRODUCTION",320-4*strlen("A NECRON PRODUCTION"),200,
- RGB(0,0,shade),lpddsprimary);
- Sleep(2);
-
- // is user trying to bail
- if (KEY_DOWN(VK_ESCAPE))
- return;
-
- } // end for shade
-
- Sleep(1000);
-
- for (shade=0; shade < 256; shade++)
- {
- // draw text in shades
- Draw_Text_GDI("S T A R F E R R E T D E L U X E !",320-3*strlen("S T A R F E R R E T D E L U X E !"),200,
- RGB(shade,shade,shade),lpddsprimary);
- Sleep(2);
-
- // is user trying to bail
- if (KEY_DOWN(VK_ESCAPE))
- return;
-
- } // end for shade
-
- Sleep(2000);
-
- for (shade=255; shade >=0; shade--)
- {
- // draw text in shades
- Draw_Text_GDI("S T A R F E R R E T D E L U X E !",320-3*strlen("S T A R F E R R E T D E L U X E !"),200,
- RGB(0,0,shade),lpddsprimary);
- Sleep(2);
-
- // is user trying to bail
- if (KEY_DOWN(VK_ESCAPE))
- return;
-
- } // end for shade
-
- Sleep(1500);
-
- for (shade=0; shade < 256; shade++)
- {
- // draw text in shades
- Draw_Text_GDI("M U S I C B Y T O D D M A S T E N",320-3*strlen("M U S I C B Y T O D D M A S T E N"),200,
- RGB(shade,shade,shade),lpddsprimary);
- Sleep(2);
-
- // is user trying to bail
- if (KEY_DOWN(VK_ESCAPE))
- return;
-
- } // end for shade
-
- Sleep(2500);
-
- for (shade=255; shade >=0; shade--)
- {
- // draw text in shades
- Draw_Text_GDI("M U S I C B Y T O D D M A S T E N",320-3*strlen("M U S I C B Y T O D D M A S T E N"),200,
- RGB(0,0,shade),lpddsprimary);
- Sleep(2);
-
- // is user trying to bail
- if (KEY_DOWN(VK_ESCAPE))
- return;
-
- } // end for shade
-
- } // end Do_Intro
-
- ///////////////////////////////////////////////////////////
-
- int Load_Sound_Music(void)
- {
- // this function loads all the sounds and music
-
- // load in intro music
- if ((intro_music_id = Load_WAV("INTRO.WAV"))==-1)
- return(0);
-
- // load the main music
- if ((main_music_id = Load_WAV("STARSNG.WAV"))==-1)
- return(0);
-
- // load get ready
- if ((ready_id = Load_WAV("READY.WAV"))==-1)
- return(0);
-
- // load engines
- if ((engines_id = Load_WAV("ENGINES.WAV"))==-1)
- return(0);
-
- // load scream
- if ((scream_id = Load_WAV("SCREAM.WAV"))==-1)
- return(0);
-
- // load the explosions sounds
-
- // these are the two different source masters
- if ((expl_ids[0] = Load_WAV("EXPL1.WAV"))==-1)
- return(0);
-
- if ((expl_ids[1] = Load_WAV("EXPL2.WAV"))==-1)
- return(0);
-
- // now make copies
- for (int index=2; index < MAX_EXPL_SOUNDS; index++)
- {
- // replicate sound
- expl_ids[index] = Replicate_Sound(expl_ids[rand()%2]);
-
- } // end for index
-
-
- // load the plasma weapons sounds
- if ((fire_ids[0] = Load_WAV("PULSE.WAV"))==-1)
- return(0);
-
- // now make copies
- for (index=1; index < MAX_FIRE_SOUNDS; index++)
- {
- // replicate sound
- fire_ids[index] = Replicate_Sound(fire_ids[0]);
- } // end for index
-
- // return sucess
- return(1);
-
- } // end Load_Sound_Music
-
- // WINX GAME PROGRAMMING CONSOLE FUNCTIONS ////////////////
-
- int Game_Init(void *parms)
- {
- // this function is where you do all the initialization
- // for your game
-
- int index; // looping var
- char filename[80]; // used to build up files names
-
- //mono.clear();
- //mono.print("\ndebugger on-line\n");
-
- // set screen stuff
- screen_width = 640;
- screen_height = 480;
- screen_bpp = 8;
-
- // initialize directdraw
- DD_Init(screen_width, screen_height, screen_bpp);
-
- // initialize directsound
- DSound_Init();
-
- // initialize Directinput
- DInput_Init();
-
- // initialize all input devices
- DI_Init_Keyboard();
- DI_Init_Joystick(-16,16,-16,16);
- DI_Init_Mouse();
-
-
- // load all the sound and music
- Load_Sound_Music();
-
- // load the starferret ship
- Load_Bitmap_File(&bitmap8bit, "STAR8.BMP");
-
- // set the palette to background image palette
- Set_Palette(bitmap8bit.palette);
-
- // now create the starferret
- Create_BOB(&starferret,0,0,56,38,3,
- BOB_ATTR_VISIBLE | BOB_ATTR_MULTI_FRAME,
- DDSCAPS_SYSTEMMEMORY);
-
- // load star ferret frames
- for (index=0; index<3; index++)
- Load_Frame_BOB(&starferret,&bitmap8bit,index,index,0,BITMAP_EXTRACT_MODE_CELL);
-
- // set position
- Set_Pos_BOB(&starferret,320-starferret.width/2,350);
-
- // set animation speed
- Set_Anim_Speed_BOB(&starferret,1);
-
- // unload data infile
- Unload_Bitmap_File(&bitmap8bit);
-
- // initialize the plasma pulses
- Init_Plasma();
-
- // initialize all the stars
- Init_Stars();
-
- // init rocks
- Init_Rocks();
-
- // init all the explosions
- Init_Bursts();
-
- // set clipping rectangle to screen extents so objects dont
- // mess up at edges
- RECT screen_rect = {0,0,screen_width,screen_height};
- lpddclipper = DD_Attach_Clipper(lpddsback,1,&screen_rect);
-
- // seed random number generate
- srand(Start_Clock());
-
- // hide the mouse
- ShowCursor(FALSE);
-
- // start the intro music
- Play_Sound(intro_music_id);
-
- // do the introdcution
- Do_Intro();
-
- // start the music
- Play_Sound(main_music_id, DSBPLAY_LOOPING);
-
- // return success
- return(1);
-
- } // end Game_Init
-
- ///////////////////////////////////////////////////////////
-
- int Game_Shutdown(void *parms)
- {
- // this function is where you shutdown your game and
- // release all resources that you allocated
-
- // delete all the explosions
- Delete_Bursts();
-
- // delete the player
- Destroy_BOB(&starferret);
-
- // the delete all the rocks
- Delete_Rocks();
-
- // delete all the plasma pulses
- Delete_Plasma();
-
- // shutdown directdraw
- DD_Shutdown();
-
- // unload sounds
- Delete_All_Sounds();
-
- // shutdown directsound
- DSound_Shutdown();
-
- // release all input devices
- DI_Release_Keyboard();
- DI_Release_Joystick();
- DI_Release_Mouse();
-
- // return success
- return(1);
- } // end Game_Shutdown
-
- ///////////////////////////////////////////////////////////
-
- int Game_Main(void *parms)
- {
- // this is the workhorse of your game it will be called
- // continuously in real-time this is like main() in C
- // all the calls for you game go here!
-
- static int ready_counter = 0, // used to draw a little "get ready"
- ready_state = 0;
-
- int index; // looping var
- int dx,dy; // general deltas used in collision detection
-
- // start the timing clock
- Start_Clock();
-
- // reset upward motion flag
- moving_up = 0;
-
- // clear the drawing surface
- DD_Fill_Surface(lpddsback, 0);
-
- // read all input devices
- DI_Read_Keyboard();
- DI_Read_Mouse();
- DI_Read_Joystick();
-
- // only process player if alive
- if (player_state == PLAYER_STATE_ALIVE)
- {
-
- // test if player is moving
- if (keyboard_state[DIK_RIGHT])
- {
- // move player to right
- starferret.x+=8;
-
- } // end if
- else
- if (keyboard_state[DIK_LEFT])
- {
- // move player to left
- starferret.x-=8;
-
- } // end if
-
- // vertical/speed motion
- if (keyboard_state[DIK_UP])
- {
- // move player up
- starferret.y-=4;
-
- // set upward motion flag
- moving_up = 1;
-
- // change engine freq
- Set_Sound_Freq(engines_id, 16000);
-
- } // end if
-
- if (keyboard_state[DIK_DOWN])
- {
- // move player to left
- starferret.y+=2;
-
- } // end if
-
-
- // merge mouse input
- starferret.x+=mouse_state.lX;
- starferret.y+=mouse_state.lY;
-
- // merge joystick input
- starferret.x+=joy_state.lX;
- starferret.y+=joy_state.lY;
-
- // test upward joystick component
- if (joy_state.lY < 0)
- {
- moving_up = 1; // set upward motion flag
-
- // change engine freq
- Set_Sound_Freq(engines_id, 16000);
- } // end if
-
- // turn the engines down
- if (!keyboard_state[DIK_UP] && joy_state.lY >=0)
- {
- // change engine freq
- Set_Sound_Freq(engines_id, 11000);
- } // end if
-
- // test if player is firing
- if (keyboard_state[DIK_LCONTROL] || keyboard_state[DIK_SPACE] ||
- mouse_state.rgbButtons[0] || joy_state.rgbButtons[0])
- Fire_Plasma(starferret.x+28-8,starferret.y-8,16);
-
- // apply friction, or downward motion
- starferret.y++;
-
- // do bounds check
-
- // first vertical axis
- if (starferret.y < MIN_STARFERRET_Y)
- starferret.y = MIN_STARFERRET_Y;
- else
- if (starferret.y > MAX_STARFERRET_Y)
- starferret.y = MAX_STARFERRET_Y;
-
- // now horizontal axis
- if (starferret.x < 0)
- starferret.x = 0;
- else
- if (starferret.x > (screen_width - starferret.width))
- starferret.x = (screen_width - starferret.width);
-
- // animate player
- Animate_BOB(&starferret);
-
- // regenerate player
- if (++player_regen_count > 60)
- {
- // reset regen counter
- player_regen_count=0;
-
- // regenerate healt a bit
- if (player_damage > 0)
- player_damage--;
-
- } // end if
-
- // test for dying state transition
- if (player_damage >= 100)
- {
- // set damage to 100
- player_damage = 100;
-
- // kill player
- player_state = PLAYER_STATE_DYING;
- player_ships--;
-
- // set counter to 0
- player_counter = 0;
-
- // start scream
- Play_Sound(scream_id);
-
- } // end if
-
- } // end if player alive
- else
- if (player_state == PLAYER_STATE_DYING)
- {
- // player is dying
-
- // start random bursts
- float bwidth = 16 + rand()%64;
- float bheight = bwidth*1.16;
-
- if ((rand()%4)==1)
- Start_Burst(starferret.x-16+rand()%40, starferret.y-64+rand()%8,
- (int)bwidth,(int)bheight,
- -4+rand()%8,2+rand()%4);
-
- // bumb ship around
- starferret.x-=(-3+rand()%6);
- starferret.y-=(-3+rand()%6);
-
- // update state counter
- if (++player_counter > 100)
- {
- // set state to invincible
- player_state = PLAYER_STATE_INVINCIBLE;
-
- // reset counter
- player_counter = 0;
-
- // reset damage
- player_damage = 0;
-
- // set position
- Set_Pos_BOB(&starferret,320-starferret.width/2,350);
-
- } // end if
-
- } // end if
- else
- if (player_state == PLAYER_STATE_INVINCIBLE)
- {
- // player is invincible
-
- // update state counter
- if (++player_counter > 70)
- {
- // set state to invincible
- player_state = PLAYER_STATE_ALIVE;
-
- // reset counter
- player_counter = 0;
-
- // decrease player ships
- if (player_ships == 0)
- {
- // change state to dead, reset all vars
- player_state = PLAYER_STATE_DEAD;
- player_counter = 0;
- ready_state = 1;
- ready_counter = 0;
-
- // turn engines
- Stop_Sound(engines_id);
-
- } // end if
-
- } // end if
-
- // start ready again
- if ((player_counter == 20) && (player_ships > 0))
- {
- // reset to ready
- ready_counter = 0,
- ready_state = 0;
- } // end if
-
- } // end if
-
- if (player_state == PLAYER_STATE_DEAD)
- {
- // player is dead
- ready_state = 1;
- ready_counter = 0;
-
- ////////////////////////////////////////////////////////////////
-
- // Y O U A D D T H I S S E C T I O N !!!
-
- ////////////////////////////////////////////////////////////////
-
- // draw text
- Draw_Text_GDI("G A M E O V E R M A N",
- 320-6*strlen("G A M E O V E R M A N")/2,
- 200,RGB(255,0,0),lpddsback);
- } // end if
-
- // move the plasma
- Move_Plasma();
-
- // move the asteroids
- Move_Rocks();
-
- // move the stars
- Move_Stars();
-
- // move the explosions
- Move_Bursts();
-
- // draw the tocks
- Draw_Rocks();
-
- // draw the plasma
- Draw_Plasma();
-
- // draw the player if alive
- if (player_state == PLAYER_STATE_ALIVE ||
- (player_state == PLAYER_STATE_DYING && player_counter < 70))
- {
- Draw_BOB(&starferret,lpddsback);
- } // end if
-
- // draw the stars
- Draw_Stars();
-
- // draw explosions last
- Draw_Bursts();
-
- // draw the score and ships left
- Draw_Info();
-
- // draw get ready?
- if (ready_state==0)
- {
- // test if counter is 0 for engines
- if (ready_counter==0)
- Play_Sound(engines_id,DSBPLAY_LOOPING);
-
- // test if counter is 10 for voice
- if (ready_counter==10)
- Play_Sound(ready_id);
-
- // draw text
- Draw_Text_GDI("GET READY!",320-8*strlen("GET READY!")/2, 200,RGB(0,rand()%255,0),lpddsback);
-
- // increment counter
- if (++ready_counter > 60)
- {
- // set state to ready
- ready_state = 1;
- ready_counter = 0;
-
- // stop the intro if not already
- Stop_Sound(intro_music_id);
-
- } // end if
-
- } // end if
-
- // flip the surfaces
- DD_Flip();
-
- // sync to 30ish fps
- Wait_Clock(30);
-
- // check of user is trying to exit
- if ((KEY_DOWN(VK_ESCAPE) || keyboard_state[DIK_ESCAPE]) && ready_state)
- PostMessage(main_window_handle, WM_DESTROY,0,0);
-
- // return success
- return(1);
-
- } // end Game_Main
-
- //////////////////////////////////////////////////////////