Hey Thủ wtf
//-----------------------------------------------------------------------------
// Hai An Ho's Game for FdSd Course
// This is the game where you and your ship flying around the universe and get
// owned by VY Canis Majoris.
//-----------------------------------------------------------------------------
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#define rnd() (((FLOAT)rand())/RAND_MAX)
//-----------------------------------------------------------------------------
// Include files
//-----------------------------------------------------------------------------
#pragma comment(lib, "winmm.lib")
#include <windows.h>
#include <ddraw.h>
#include <stdio.h>
#include <stdarg.h>
#include <mmsystem.h>
#include "resource.h"
#include "ddutil.h"
//-----------------------------------------------------------------------------
// Local definitions
//-----------------------------------------------------------------------------
#define NAME "DDExample4"
#define TITLE "Direct Draw Example 4"
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEY_UP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)
//-----------------------------------------------------------------------------
// Global data
//-----------------------------------------------------------------------------
LPDIRECTDRAW4 g_pDD = NULL; // DirectDraw object
LPDIRECTDRAWSURFACE4 g_pDDSPrimary = NULL;// DirectDraw primary surface
LPDIRECTDRAWSURFACE4 g_pDDSBack = NULL; // DirectDraw back surface
LPDIRECTDRAWSURFACE4 g_pDDSOne = NULL; // Offscreen surface 1
LPDIRECTDRAWSURFACE4 g_pDDSTwo = NULL; // Airplane
LPDIRECTDRAWSURFACE4 g_pDDSThree = NULL; // Bullets of the airplane
LPDIRECTDRAWSURFACE4 g_pDDSFour = NULL; // DirectDraw back surface
LPDIRECTDRAWSURFACE4 g_pDDSFive = NULL; // Offscreen surface 1
LPDIRECTDRAWSURFACE4 g_pDDSSix = NULL; // Airplane
LPDIRECTDRAWSURFACE4 g_pDDSSeven = NULL; // Bullets of the airplane
//LPDIRECTDRAWSURFACE4 g_pDDSEight = NULL; // DirectDraw back surface
LPDIRECTDRAWPALETTE g_pDDPal = NULL; // The primary surface palette
BOOL g_bActive = FALSE; // Is application active?
void collide(void);
//Bullets
int bull,bposx,bposy;
//Others
int boom = 0;
int backx = 0; //background position
int sSpeed = 2; //background scrolling speed
int aposx = 30, aposy = 230; //airplane position
//Planets' positions
int bplanetposx, bplanetposy, mplanetposx, mplanetposy, splanetposx[5], splanetposy[5];
int en=0,enm[7]={0,0,0,0,0,0,0};
//Collision
int col=0;
int i;
//Explosion
int exposx, exposy;
int expcurrentFrame=0;
DWORD expdelay;
DWORD explastTickCount;
//
//-----------------------------------------------------------------------------
// Local data
//-----------------------------------------------------------------------------
// Name of our bitmap resource.
static char szBitmap[] = "BACKGROUND";
static char szBitmap1[] = "AIRPLANE";
static char szBitmap2[] = "AIRBULLETS";
static char szBitmap3[] = "STAR1";
static char szBitmap4[] = "METEOR";
static char szBitmap5[] = "EXP";
static char szBitmap6[] = "STAR2";
static char szBitmap7[] = "STAR3";
long framecounter=0;
DWORD dwFrameTime;
float dwFrames;
DWORD dwFrameCount;
float dwFramesLast;
void DisplayFrameRate( void ) //every second
{
HDC hdc;
char buf[256];
DWORD time,time2;
framecounter++;
dwFrameCount++;
time=GetTickCount();
time2=time-dwFrameTime;
if(time2>1000)
{
dwFrames=(float)(dwFrameCount*1000)/time2;
dwFrameTime=time;
dwFrameCount=0;
}
if(dwFrames==0) return;
if(dwFrames!=dwFramesLast) dwFramesLast=dwFrames;
if(g_pDDSBack->GetDC(&hdc)==DD_OK)//print stuff on screen
{
SetBkColor (hdc,RGB(0,0,0));
SetTextColor(hdc,RGB(0,255,0));
sprintf_s (buf,"F=%5d FPS=%.1f ",framecounter,dwFrames);
TextOut (hdc,0,0,buf,strlen(buf));
sprintf_s (buf,"bull=%1d bposx=%3d bposy=%3d ",bull,bposx,bposy);
TextOut (hdc,0,16,buf,strlen(buf));
sprintf_s (buf,"en=%1d mplanetposx=%3d mplanetposy=%3d ",en,mplanetposx,mplanetposy);
TextOut (hdc,0,32,buf,strlen(buf));
sprintf_s (buf,"Collide=%1d ",col);
TextOut (hdc,0,48,buf,strlen(buf));
g_pDDSBack->ReleaseDC(hdc);
}
}
//-----------------------------------------------------------------------------
// Name: ReleaseAllObjects()
// Desc: Finished with all objects we use; release them
//-----------------------------------------------------------------------------
static void
ReleaseAllObjects(void)
{
if (g_pDD != NULL)
{
if (g_pDDSPrimary != NULL)
{
g_pDDSPrimary->Release();
g_pDDSPrimary = NULL;
}
if (g_pDDSOne != NULL)
{
g_pDDSOne->Release();
g_pDDSOne = NULL;
}
if (g_pDDSTwo!= NULL)
{
g_pDDSTw

Release();
g_pDDSTwo = NULL;
}
if (g_pDDSThree!= NULL)
{
g_pDDSThree->Release();
g_pDDSThree = NULL;
}
if (g_pDDSFour!= NULL)
{
g_pDDSFour->Release();
g_pDDSFour = NULL;
}
if (g_pDDSFive!= NULL)
{
g_pDDSFive->Release();
g_pDDSFive = NULL;
}
if (g_pDDSSix!= NULL)
{
g_pDDSSix->Release();
g_pDDSSix = NULL;
}
if (g_pDDSSeven!= NULL)
{
g_pDDSSeven->Release();
g_pDDSSeven = NULL;
}
/*if (g_pDDSEight!= NULL)
{
g_pDDSEight->Release();
g_pDDSEight = NULL;
}*/
if (g_pDDPal != NULL)
{
g_pDDPal->Release();
g_pDDPal = NULL;
}
}
}
//-----------------------------------------------------------------------------
// Name: InitFail()
// Desc: This function is called if an initialization function fails
//-----------------------------------------------------------------------------
HRESULT
InitFail(HWND hWnd, HRESULT hRet, LPCTSTR szError,...)
{
char szBuff[128];
va_list vl;
va_start(vl, szError);
vsprintf(szBuff, szError, vl);
ReleaseAllObjects();
MessageBox(hWnd, szBuff, TITLE, MB_OK);
DestroyWindow(hWnd);
va_end(vl);
return hRet;
}
//-----------------------------------------------------------------------------
// Name: RestoreAll()
// Desc: Restore all lost objects
//-----------------------------------------------------------------------------
HRESULT
RestoreAll(void)
{
HRESULT hRet;
hRet = g_pDDSPrimary->Restore();
if (hRet == DD_OK)
{
hRet = g_pDDSOne->Restore();
if (hRet == DD_OK)
{
DDReLoadBitmap(g_pDDSOne, szBitmap);
}
hRet = g_pDDSTw

Restore();
if (hRet == DD_OK)
{
DDReLoadBitmap(g_pDDSTwo, szBitmap);
}
hRet = g_pDDSThree->Restore();
if (hRet == DD_OK)
{
DDReLoadBitmap(g_pDDSThree, szBitmap);
}
hRet = g_pDDSFour->Restore();
if (hRet == DD_OK)
{
DDReLoadBitmap(g_pDDSFour, szBitmap);
}
hRet = g_pDDSFive->Restore();
if (hRet == DD_OK)
{
DDReLoadBitmap(g_pDDSFive, szBitmap);
}
hRet = g_pDDSSix->Restore();
if (hRet == DD_OK)
{
DDReLoadBitmap(g_pDDSSix, szBitmap);
}
hRet = g_pDDSSeven->Restore();
if (hRet == DD_OK)
{
DDReLoadBitmap(g_pDDSSeven, szBitmap);
}
/* hRet = g_pDDSEight->Restore();
if (hRet == DD_OK)
{
DDReLoadBitmap(g_pDDSEight, szBitmap);
}*/
}
return hRet;
}
//-----------------------------------------------------------------------------
//Collision
//-----------------------------------------------------------------------------
void collide(void)
{
boom = 1;
exposx = aposx-40;
exposy = aposy-50;
}
//-----------------------------------------------------------------------------
// Name: UpdateFrame()
// Desc: Decide what needs to be blitted next, wait for flip to complete,
// then flip the buffers.
//-----------------------------------------------------------------------------
void UpdateFrame(void)//Decide what needs to be blitted next, wait for flip to complete then flip
{
static DWORD lastTickCount[3] = {0, 0, 0};
static int currentFrame[3] = {0, 0, 0};
DWORD delay[3] = {25, 78, 13};
int xpos[3] = {288, 190, 416};
int ypos[3] = {128, 300, 256};
DWORD thisTickCount;
RECT rcRect;
HRESULT hRet;
// Decide which frame will be blitted next
thisTickCount = GetTickCount();
for (i=0;i<3;i++)
{
if ((thisTickCount-lastTickCount
)>delay)
{
//Move to next frame;
lastTickCount=thisTickCount;
currentFrame++;
if (currentFrame>59) currentFrame = 0;
}
}
//moving screen
backx+= sSpeed;
if(backx > (1280 - sSpeed)) backx = 0;
//Starting point + moving
if (KEY_DOWN('Z'))
{
if (KEY_DOWN(VK_UP)) aposy-=2;
if (KEY_DOWN(VK_DOWN)) aposy+=2;
if (KEY_DOWN(VK_LEFT)) aposx-=2;
if (KEY_DOWN(VK_RIGHT))aposx+=2;
}
else if (KEY_DOWN('X'))
{
if (KEY_DOWN(VK_UP)) aposy-=6;
if (KEY_DOWN(VK_DOWN)) aposy+=6;
if (KEY_DOWN(VK_LEFT)) aposx-=6;
if (KEY_DOWN(VK_RIGHT))aposx+=6;
}
else
{
if (KEY_DOWN(VK_UP)) aposy-=3;
if (KEY_DOWN(VK_DOWN)) aposy+=3;
if (KEY_DOWN(VK_LEFT)) aposx-=3;
if (KEY_DOWN(VK_RIGHT))aposx+=3;
}
//Check airplane doesn't go off-screen
if (aposx > 600) aposx = 600;
if (aposy > 460) aposy = 460;
if (aposx < 10) aposx = 10;
if (aposy < 10) aposy = 10;
//Planet encouter
if (framecounter == 500)
{
en=1;
mplanetposx=640-225;
mplanetposy=rnd()*(480-231);
}
//Saturn encounter
if (framecounter == 1200)
{
en=2;
bplanetposx=640-583;
bplanetposy=0;
}
//Meteors running in
if (framecounter == 100)
{
enm[0]=2;
splanetposx[0]=640-37;
splanetposy[0]=rnd()*(480-37);
}
if (framecounter == 110)
{
enm[1]=2;
splanetposx[1]=640-37;
splanetposy[1]=rnd()*(480-37);
}
if (framecounter == 210)
{
enm[2]=2;
splanetposx[2]=640-37;
splanetposy[2]=rnd()*(480-37);
}
if (framecounter == 180)
{
enm[3]=2;
splanetposx[3]=640-37;
splanetposy[3]=rnd()*(480-37);
}
if (framecounter == 140)
{
enm[4]=2;
splanetposx[4]=640-37;
splanetposy[4]=rnd()*(480-37);
}
if (framecounter == 250)
{
enm[5]=2;
splanetposx[5]=640-37;
splanetposy[5]=430;
}
if (framecounter == 280)
{
enm[6]=2;
splanetposx[5]=640-37;
splanetposy[5]=rnd()*(480-37);
}
if (framecounter == 320)
{
enm[7]=2;
splanetposx[5]=640-37;
splanetposy[5]=rnd()*(480-37);
}
//Collision detection planet
if (en==1 && aposx > mplanetposx && aposx+36 < mplanetposx+225 && aposy > mplanetposy && aposy+18 < mplanetposy+231)
{
col = 1;
collide();
}
else { col=0;}
if (en==2 && aposx > bplanetposx && aposx+36 < bplanetposx+583 && aposy > bplanetposy && aposy+18 < bplanetposy+455)
{
col = 1;
collide();
}
else { col=0;}
//Collision detection meteors
for (i=0;i<5;i++)
{
if (enm==2 && aposx > splanetposx && aposx+10 < splanetposx+44 && aposy > splanetposy && aposy+18 < splanetposy+36)
{
col = 2;
collide();
}
else{ col=0;}
}
//Draws stuffs##############################################################
// Blit the stuff for the next frame
//Draws background
rcRect.left = backx;
rcRect.top = 0;
rcRect.right = backx + 640;
rcRect.bottom = 480;
while (TRUE)
{
hRet=g_pDDSBack->BltFast(0,0,g_pDDSOne,&rcRect,DDBLTFAST_NOCOLORKEY);
if (hRet == DD_OK) break;
if (hRet == DDERR_SURFACELOST) {hRet = RestoreAll();if (hRet != DD_OK) return;}
if (hRet != DDERR_WASSTILLDRAWING) return;
}
if (hRet != DD_OK) return;
//Draws the planet Ganymede
if (en == 1)
{
mplanetposx-=2;
if (mplanetposx < 0) {en=0; }
else
{
rcRect.left = 0;
rcRect.top = 0;
rcRect.right = 225;
rcRect.bottom = 231;
while (TRUE)
{
hRet=g_pDDSBack->BltFast(mplanetposx,mplanetposy,g_pDDSFour,&rcRect,DDBLTFAST_SRCCOLORKEY);
if (hRet == DD_OK) break;
if (hRet == DDERR_SURFACELOST) {hRet = RestoreAll();if (hRet != DD_OK) return;}
if (hRet != DDERR_WASSTILLDRAWING) return;
}
}
}
//Draws the planet Saturn
if (en == 2)
{
bplanetposx-=1;
if (bplanetposx < 0) {en=0; }
else
{
rcRect.left = 0;
rcRect.top = 0;
rcRect.right = 583;
rcRect.bottom = 455;
while (TRUE)
{
hRet=g_pDDSBack->BltFast(bplanetposx,bplanetposy,g_pDDSSeven,&rcRect,DDBLTFAST_SRCCOLORKEY);
if (hRet == DD_OK) break;
if (hRet == DDERR_SURFACELOST) {hRet = RestoreAll();if (hRet != DD_OK) return;}
if (hRet != DDERR_WASSTILLDRAWING) return;
}
}
}
//Draws the meteors
for (i=0;i<5;i++)
{
if (enm == 2)
{
splanetposx-=4;
if (splanetposx < 0)
{
//enm=0;
splanetposx=640-37;
//splanetposy[0]=100;
}
else
{
rcRect.left = 0;
rcRect.top = 0;
rcRect.right = 37;
rcRect.bottom = 36;
while (TRUE)
{
hRet=g_pDDSBack->BltFast(splanetposx,splanetposy,g_pDDSFive,&rcRect,DDBLTFAST_SRCCOLORKEY);
if (hRet == DD_OK) break;
if (hRet == DDERR_SURFACELOST) {hRet = RestoreAll();if (hRet != DD_OK) return;}
if (hRet != DDERR_WASSTILLDRAWING) return;
}
}
}
}//end of i loop
//Draws the airplane
rcRect.left = 0;
rcRect.top = 0;
rcRect.right = 36;
rcRect.bottom = 18;
while (TRUE)
{
hRet=g_pDDSBack->BltFast(aposx,aposy,g_pDDSTwo,&rcRect,DDBLTFAST_SRCCOLORKEY);
if (hRet == DD_OK) break;
if (hRet == DDERR_SURFACELOST) {hRet = RestoreAll();if (hRet != DD_OK) return;}
if (hRet != DDERR_WASSTILLDRAWING) return;
}
//EXPLOSION####################################
/* expdelay = 100;
thisTickCount = GetTickCount();
if ((thisTickCount-explastTickCount)> expdelay && boom ==1)
{
//Move to next frame;
expcurrentFrame=thisTickCount;
expcurrentFrame++;
if (expcurrentFrame>9)
{
boom = 0;
expcurrentFrame = 0;
}
}
//Draws the explosion
rcRect.left = expcurrentFrame%9*120;
rcRect.top = 0;
rcRect.right = expcurrentFrame%9*120+120;
rcRect.bottom = 120;
while (TRUE)
{
hRet=g_pDDSBack->BltFast(exposx,exposy,g_pDDSSix,&rcRect,DDBLTFAST_SRCCOLORKEY);
if (hRet == DD_OK) break;
if (hRet == DDERR_SURFACELOST) {hRet = RestoreAll();if (hRet != DD_OK) return;}
if (hRet != DDERR_WASSTILLDRAWING) return;
}*/
DisplayFrameRate();
// Flip the surfaces
while (TRUE)
{
hRet = g_pDDSPrimary->Flip(NULL, 0);if (hRet == DD_OK) break;
if (hRet == DDERR_SURFACELOST) {hRet = RestoreAll();if (hRet != DD_OK) break;}
if (hRet != DDERR_WASSTILLDRAWING) break;
}
}
long FAR PASCAL WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) //The Main Window Procedure
{
switch (message)
{
case WM_ACTIVATEAPP:
// Pause if minimized or not the top window
g_bActive = (wParam == WA_ACTIVE) || (wParam == WA_CLICKACTIVE);
return 0L;
case WM_DESTROY:
// Clean up and close the app
ReleaseAllObjects();
PostQuitMessage(0);
return 0L;
case WM_KEYDOWN:
// Handle any non-accelerated key commands
switch (wParam)
{
case VK_ESCAPE:
case VK_F12:
PostMessage(hWnd, WM_CLOSE, 0, 0);
return 0L;
}
break;
case WM_SETCURSOR:
// Turn off the cursor since this is a full-screen app
SetCursor(NULL);
return TRUE;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
//-----------------------------------------------------------------------------
// Name: InitApp()
// Desc: Do work required for every instance of the application:
// Create the window, initialize data
//-----------------------------------------------------------------------------
static HRESULT InitApp(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
WNDCLASS wc;
DDSURFACEDESC2 ddsd;
DDSCAPS2 ddscaps;
HRESULT hRet;
LPDIRECTDRAW pDD;
// Set up and register window class
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAIN_ICON));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH )GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NAME;
wc.lpszClassName = NAME;
RegisterClass(&wc);
// Create a window
hWnd = CreateWindowEx(WS_EX_TOPMOST,
NAME,
TITLE,
WS_POPUP,
0,
0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
NULL,
NULL,
hInstance,
NULL);
if (!hWnd)
return FALSE;
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
SetFocus(hWnd);
///////////////////////////////////////////////////////////////////////////
// Create the main DirectDraw object
///////////////////////////////////////////////////////////////////////////
hRet = DirectDrawCreate(NULL, &pDD, NULL);
if (hRet != DD_OK)
return InitFail(hWnd, hRet, "DirectDrawCreate FAILED");
// Fetch DirectDraw4 interface
hRet = pDD->QueryInterface(IID_IDirectDraw4, (LPVOID *) & g_pDD);
if (hRet != DD_OK)
return InitFail(hWnd, hRet, "QueryInterface FAILED");
// Get exclusive mode
hRet = g_pDD->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
if (hRet != DD_OK)
return InitFail(hWnd, hRet, "SetCooperativeLevel FAILED");
// Set the video mode to 640x480x8
hRet = g_pDD->SetDisplayMode(640, 480, 16, 0, 0);
if (hRet != DD_OK)
return InitFail(hWnd, hRet, "SetDisplayMode FAILED");
// Create the primary surface with 1 back buffer
ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE |
DDSCAPS_FLIP |
DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 1;
hRet = g_pDD->CreateSurface(&ddsd, &g_pDDSPrimary, NULL);
if (hRet != DD_OK) return InitFail(hWnd, hRet, "CreateSurface FAILED");
// Get a pointer to the back buffer
ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
hRet = g_pDDSPrimary->GetAttachedSurface(&ddscaps, &g_pDDSBack);
if (hRet != DD_OK) return InitFail(hWnd, hRet, "GetAttachedSurface FAILED");
// Create and set the palette
g_pDDPal = DDLoadPalette(g_pDD, szBitmap);
if (g_pDDPal) g_pDDSPrimary->SetPalette(g_pDDPal);
// Create the offscreen surface, by loading our bitmap.
g_pDDSOne = DDLoadBitmap(g_pDD, szBitmap, 0, 0);
if (g_pDDSOne == NULL) return InitFail(hWnd, hRet, "DDLoadBitmap FAILED");
g_pDDSTwo = DDLoadBitmap(g_pDD, szBitmap1, 0, 0);
if (g_pDDSTwo == NULL) return InitFail(hWnd, hRet, "Airplane FAILED");
g_pDDSThree = DDLoadBitmap(g_pDD, szBitmap2, 0, 0);
if (g_pDDSThree == NULL) return InitFail(hWnd, hRet, "Bullets FAILED");
g_pDDSFour = DDLoadBitmap(g_pDD, szBitmap3, 0, 0);
if (g_pDDSFour == NULL) return InitFail(hWnd, hRet, "Planet FAILED");
g_pDDSFive = DDLoadBitmap(g_pDD, szBitmap4, 0, 0);
if (g_pDDSFive == NULL) return InitFail(hWnd, hRet, "Meteor FAILED");
g_pDDSSix = DDLoadBitmap(g_pDD, szBitmap5, 0, 0);
if (g_pDDSFour == NULL) return InitFail(hWnd, hRet, "EXP FAILED");
g_pDDSSeven = DDLoadBitmap(g_pDD, szBitmap6, 0, 0);
if (g_pDDSSeven == NULL) return InitFail(hWnd, hRet, "Saturn FAILED");
/*g_pDDSEight = DDLoadBitmap(g_pDD, szBitmap7, 0, 0);
if (g_pDDSEight == NULL) return InitFail(hWnd, hRet, "Canis Majoris FAILED");*/
// Set the color key for this bitmap (black)
DDSetColorKey(g_pDDSOne, RGB(0, 0, 0));
DDSetColorKey(g_pDDSTwo, RGB(0, 255, 0));
DDSetColorKey(g_pDDSThree, RGB(0, 255, 0));
DDSetColorKey(g_pDDSFour, RGB(0, 0, 0));
DDSetColorKey(g_pDDSFive, RGB(0, 0, 0));
DDSetColorKey(g_pDDSSix, RGB(0, 0, 0));
DDSetColorKey(g_pDDSSeven, RGB(0, 0, 0));
// DDSetColorKey(g_pDDSEight, RGB(0, 0, 0));
return DD_OK;
}
int PASCAL WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow) //Initialization, message loop
{
MSG msg;
if (InitApp(hInstance,nCmdShow) != DD_OK) return FALSE;
while (TRUE)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if (!GetMessage(&msg, NULL, 0, 0)) return msg.wParam;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else if (g_bActive) {UpdateFrame();}
else {WaitMessage();/* Make sure we go to sleep if we have nothing else to do*/}
}
}
//EXPLOSION#####################