/* Liquid Acid Drop For Windows by Master on LSD send me a im my screen name on aim is master on lsd */ #include #include #include #include "grid.h" #include #include #include #include "dsutil.h" #include "resource.h" #include "gunite.h" #include "hscores.h" // Screens #define INTROSCREEN 0 #define GAMESCREEN 1 #define GAMEOVERSCREEN 2 #define HIGHSCORESSCREEN 3 #define OPTIONSSCREEN 4 // Game Music #define TRACK_ZOMBIE 0 #define TRACK_MATRIX 1 HWND mainWnd; // Global Variables LPDIRECTDRAW lpDD; // Direct Draw Object LPDIRECTDRAWSURFACE lpPrimary; // Primary Surface LPDIRECTDRAWSURFACE lpBack; // Back Surface IDirectSound *pDS; // Direct Sound Object // Introduction Graphical surfaces LPDIRECTDRAWSURFACE intro; LPDIRECTDRAWSURFACE logo; bool bintro = true; bool blogo = true; int introcount = 0; int logocount = 0; int track = 0; LPDIRECTDRAWSURFACE start; LPDIRECTDRAWSURFACE cursor; // Actual Game Surfaces LPDIRECTDRAWSURFACE gamebg; LPDIRECTDRAWSURFACE grid_blocks[11]; // Games Grid/Surafces Etc GameGrid Grid; bool gint = false; IDirectSoundBuffer *zombie; IDirectSoundBuffer *matrix; // GAME OVER SCREEN SURFACES LPDIRECTDRAWSURFACE gameover; // HIGH SCORES SCREEN SURFACES LPDIRECTDRAWSURFACE highscores; // SCORES HighScores score; // End of Game Varaibles int x = 0,y = 0; // were bg is mofo int ix;int iy; UINT activeapp; // if app active bool poop = true; int screen = 0; int curpos = 0; int overwait = 0; int scorewait = 0; int op_cur = 0; void errcheck(HRESULT); void setscreen(int); void draw(); void introscreen(); void gamescreen(); void drawgameover(); void drawhighscores(); void drawoptions(); void IntroInput(WPARAM); void GameInput(WPARAM); void GameOverInput(WPARAM); // DirectX Shit LRESULT APIENTRY WndProc(HWND,UINT,WPARAM,LPARAM); bool DirectDrawInit(HWND); // Setup DirectX Object bool CreatePrimarySurface(); // CreatePimary Surfaces (lpBack & lpPrimary) bool initSound(); /* IDirectDrawSurface* DDLoadBitmap(IDirectDraw* pdd, LPCSTR szBitmap); // Loading Bitmap into Memory IDirectDrawSurface* CreateOffScreenSurface(IDirectDraw* pdd, int dx, int dy); // Creating the Surface HRESULT DDCopyBitmap(IDirectDrawSurface* pdds, HBITMAP hbm, int dx, int dy); // Copy Bitmap */ IDirectDrawPalette* DDLoadPalette(IDirectDraw* pdd, LPCSTR szBitmap); // Load Palette void DDSetColorKey(LPDIRECTDRAWSURFACE* surface, int r,int g,int b); // Sets up the DirectDraw Object. 640x480 Mode void updateframe(void); void finiObjects(void); void initSurfaces(void); void DSPlaySound(int); void KeyInput(WPARAM); // Block Gone void BlockGone() { IDirectSoundBuffer *pSound; pSound = DSLoadSoundBuffer(pDS, MAKEINTRESOURCE(IDR_WAVE7)); pSound->Play(0,0,0); } // init surfaces void initSurfaces(void) { logo = DDLoadBitmap(lpDD, "lost2.bmp"); intro = DDLoadBitmap(lpDD, "intro_intro.bmp"); start = DDLoadBitmap(lpDD, "intro_start.bmp"); cursor = DDLoadBitmap(lpDD, "intro_cursor.bmp"); gamebg = DDLoadBitmap(lpDD, "gamebg.bmp"); gameover = DDLoadBitmap(lpDD,"gameover.bmp"); highscores = DDLoadBitmap(lpDD, "highscores.bmp"); // Grid grid_blocks[0] = DDLoadBitmap(lpDD, "block_black.bmp"); grid_blocks[1] = DDLoadBitmap(lpDD, "block_yellow.bmp"); grid_blocks[2] = DDLoadBitmap(lpDD, "block_orange.bmp"); grid_blocks[3] = DDLoadBitmap(lpDD, "block_ltblue.bmp"); grid_blocks[4] = DDLoadBitmap(lpDD, "block_dblue.bmp"); grid_blocks[5] = DDLoadBitmap(lpDD, "block_purple.bmp"); grid_blocks[6] = DDLoadBitmap(lpDD, "block_pink.bmp"); grid_blocks[7] = DDLoadBitmap(lpDD, "block_gray.bmp"); grid_blocks[8] = DDLoadBitmap(lpDD, "block_red.bmp"); grid_blocks[9] = DDLoadBitmap(lpDD, "block_green.bmp"); grid_blocks[10] = DDLoadBitmap(lpDD, "block_clear.bmp"); /* LPDIRECTDRAWSURFACE cursor; DDCOLORKEY ddck; ddck.dwColorSpaceLowValue = 0xff; ddck.dwColorSpaceHighValue = 0xff; cursor = DDLoadBitmap(lpDD, "Master3.bmp"); cursor->SetColorKey(DDCKEY_SRCBLT,&ddck); */ } // init DirectSound :) bool initSound() { HRESULT h; h = DirectSoundCreate(NULL, &pDS, NULL); if (h != DS_OK) return FALSE; HWND hWnd = GetForegroundWindow(); if (hWnd == NULL) hWnd = GetDesktopWindow(); h = pDS->SetCooperativeLevel(hWnd, DSSCL_PRIORITY); if (h != DS_OK) { pDS->Release(); pDS = NULL; return FALSE; } IDirectSoundBuffer *lpDsb; DSBUFFERDESC dsbdesc; memset(&dsbdesc, 0, sizeof(DSBUFFERDESC)); dsbdesc.dwSize = sizeof(DSBUFFERDESC); dsbdesc.dwFlags = DSBCAPS_PRIMARYBUFFER; dsbdesc.dwBufferBytes = 0; dsbdesc.lpwfxFormat = NULL; if (pDS->CreateSoundBuffer(&dsbdesc, &lpDsb, NULL) != DS_OK) { pDS->Release(); pDS = NULL; return FALSE; } lpDsb->Play(0, 0, DSBPLAY_LOOPING); return TRUE; } void DSPlaySound(int s) // Play a Sound From Resource { IDirectSoundBuffer *pSound; pSound = DSLoadSoundBuffer(pDS, MAKEINTRESOURCE(s)); pSound->Play(0,0,0); } void errcheck(HRESULT ddrval) { // if(ddrval != DD_OK) { exit(0); } // Lets bail if(ddrval != DD_OK) { initSurfaces(); lpBack->Restore(); } } bool DirectDrawInit(HWND hwnd) { HRESULT ddrval; // create main dd object ddrval = DirectDrawCreate(NULL, &lpDD,NULL); if(ddrval != DD_OK) { return false; } ddrval = lpDD->SetCooperativeLevel(hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); if(ddrval != DD_OK) { lpDD->Release(); return false; } // Set Mode to 640x480 in EXCLUSIVE MODE HDC dc; dc = GetDC(NULL); int bp; bp = GetDeviceCaps(dc,BITSPIXEL); ReleaseDC(NULL,dc); ddrval = lpDD->SetDisplayMode(640,480,bp); if(ddrval != DD_OK) { lpDD->Release(); return false; } return true; } // Setting Up the Surfaces (lpBack & lpPrimary) bool CreatePrimarySurface() { DDSURFACEDESC ddsd; DDSCAPS ddscaps; HRESULT ddrval; memset(&ddsd,0,sizeof(ddsd)); // ok were filling out a surface description ddsd.dwSize = sizeof(ddsd); // then using createsurface // to attach it to the global surface ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; ddsd.dwBackBufferCount = 1; ddrval = lpDD->CreateSurface(&ddsd,&lpPrimary,NULL); if(ddrval != DD_OK) { lpDD->Release(); return false; } // Set the description for backbuffer ddscaps.dwCaps = DDSCAPS_BACKBUFFER; ddrval = lpPrimary->GetAttachedSurface(&ddscaps, &lpBack); if(ddrval != DD_OK) { lpPrimary->Release(); lpDD->Release(); return false; } return true; } /* IDirectDrawSurface* DDLoadBitmap(IDirectDraw* pdd, LPCSTR szBitmap) { HBITMAP hbm; BITMAP bm; IDirectDrawSurface *pdds; // Load Image for loading from Disk hbm = (HBITMAP)LoadImage(NULL, szBitmap, IMAGE_BITMAP,0,0,LR_LOADFROMFILE | LR_CREATEDIBSECTION); if(hbm == NULL) { return NULL; } GetObject(hbm, sizeof(bm), &bm); // size // Create Surface for this Bitmap pdds = CreateOffScreenSurface(pdd, bm.bmWidth,bm.bmHeight); if(pdds) { DDCopyBitmap(pdds, hbm, bm.bmWidth,bm.bmHeight); } DeleteObject(hbm); return pdds; } // this is a surface when can be cliped IDirectDrawSurface* CreateOffScreenSurface(IDirectDraw* pdd, int dx, int dy) { DDSURFACEDESC ddsd; IDirectDrawSurface* pdds; // Create Surface for this bitmap ZeroMemory(&ddsd,sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; ddsd.dwWidth = dx; ddsd.dwHeight = dy; if(pdd->CreateSurface(&ddsd, &pdds,NULL) != DD_OK) { return NULL; } else { return pdds; } } // Copy Bitmap HRESULT DDCopyBitmap(IDirectDrawSurface* pdds, HBITMAP hbm, int dx, int dy) { HDC hdcImage; HDC hdc; HRESULT hr; HBITMAP hbmOld; // Select Bitmap into a MemoryDC hdcImage = CreateCompatibleDC(NULL); hbmOld = (HBITMAP)SelectObject(hdcImage, hbm); if((hr = pdds->GetDC(&hdc)) == DD_OK) { BitBlt(hdc,0,0,dx,dy,hdcImage,0,0,SRCCOPY); pdds->ReleaseDC(hdc); } SelectObject(hdcImage, hbmOld); DeleteDC(hdcImage); return hr; } */ // Createing the pallete IDirectDrawPalette* DDLoadPalette(IDirectDraw* pdd, LPCSTR szBitmap) { IDirectDrawPalette* ddpal; int i; int n; int fh; PALETTEENTRY ape[256]; if(szBitmap && (fh = _lopen(szBitmap, OF_READ)) != -1) { BITMAPFILEHEADER bf; BITMAPINFOHEADER bi; _lread(fh, &bf, sizeof(bf)); _lread(fh ,&bi,sizeof(bi)); _lread(fh, ape,sizeof(ape)); _lclose(fh); if(bi.biSize != sizeof(BITMAPINFOHEADER)) n = 0; else if(bi.biBitCount > 8) n = 0; else if(bi.biClrUsed == 0) n = 1 << bi.biBitCount; else n = bi.biClrUsed; // Dibs are STored Diff then BITMAP so make it right (flip 'em) for(i = 0; i < n; i++) { BYTE r = ape[i].peRed; ape[i].peRed = ape[i].peBlue; ape[i].peBlue = r; } } if(pdd->CreatePalette(DDPCAPS_8BIT, ape,&ddpal,NULL) != DD_OK) { return NULL; } else { return ddpal; } // TO SET THE PALETTE USE // lpDDPal = DDLoadPalette(lpDD, szBitmap); // lpPrimary->SetPalette(lpDDPal); } // FOR SETTING COLOR KEY ( MAKE IT TRANSPARENT ) /* DDCOLORKEY ddck; ddc.dwColorSpaceLoValue = 0xff; ddck.dwColorSpaceHighValue = 0xff; lpDDSomeBitmapSurface->SetColorKey(DDCKEY_SRCBLT,&ddck); */ void updateframe(void) { HRESULT ddrval; //int xpos,ypos; // Blit the Stuff For the Next Frame DDBLTFX ddbltfx; ZeroMemory(&ddbltfx,sizeof(ddbltfx)); ddbltfx.dwSize = sizeof(ddbltfx); ddbltfx.dwFillColor = 0; lpBack->Blt(NULL,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&ddbltfx); /* SetRect(&rcRect,0,0,300,300); ddrval = lpBack->BltFast(100,100,background,&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); x++; SetRect(&rcRect,0,0,100,100); ddrval = lpBack->BltFast(x,y,sprite,&rcRect,DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); ddrval = lpBack->BltFast(ix,iy,cursor,&rcRect,DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); /* if(ddrval != DD_OK) { return; } */ draw(); ddrval = lpPrimary->Flip(NULL, DDFLIP_WAIT); if(ddrval == DD_OK) { return; } else if(ddrval == DDERR_SURFACELOST) { HRESULT hret; hret = lpPrimary->Restore(); if(hret != DD_OK) { return; } initSurfaces(); ddrval = logo->Restore(); ddrval = intro->Restore(); ddrval = cursor->Restore(); ddrval = gamebg->Restore(); ddrval = start->Restore(); for(int f = 0; f < 10; f ++) { grid_blocks[f]->Restore(); } ddrval = lpBack->Restore(); } if (ddrval != DDERR_WASSTILLDRAWING) return; } void finiObjects(void) { if(lpPrimary) { lpPrimary->Release(); lpPrimary = NULL; } if(lpBack) { lpBack->Release(); lpBack = NULL; } if(lpDD) { lpDD->Release(); lpDD = NULL; } if (pDS) { pDS->Release(); pDS = NULL; } /* if(lpPrimary) { lpPrimary->Release(); lpPrimary = NULL; } if(lpBack) { lpBack->Release(); lpBack = NULL; } */ } int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR l, int CmdShow) { // LoadScores ifstream fin("scores.lsd", ios::binary); fin.read((char*)&score,sizeof(score)); fin.close(); if(score.scoreset == false) { score.setscore(0, "Master on LSD", 3000, 30); score.setscore(1, "Mr. Tweaker ", 2800, 25); score.setscore(2, "Crankster ",2500, 20); score.setscore(3, "Tripper ",2000, 15); score.setscore(4, "Crack HEAD ",1900, 14); score.setscore(5, "Satan ",1800, 12); score.setscore(6, "Deamon Issac ",1500, 10); score.setscore(7, "Alex da man ",1200, 8); score.setscore(8, "Mr. Rod ",100, 3); score.setscore(9, "Brudduh Monkey",100, 2); score.scoreset = true; // were ghetto and havent set are scores up; (first run) } HWND hwnd; MSG msg; WNDCLASS wc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH); wc.hInstance = hInst; wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1)); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.lpfnWndProc = (WNDPROC) WndProc; wc.lpszMenuName = NULL; wc.lpszClassName = "masteronlsd"; wc.style = CS_HREDRAW | CS_VREDRAW; RegisterClass(&wc); hwnd = CreateWindowEx(WS_EX_APPWINDOW,"masteronlsd", "Liquid Acid Drop", WS_POPUP, 0,0,100,100,0,0,hInst,0); mainWnd = hwnd; ShowWindow(hwnd, 1); UpdateWindow(hwnd); // score = LoadScores(); if(DirectDrawInit(hwnd) == 0) { return 0; } if(initSound() == false) { return 0; } if(CreatePrimarySurface() == false) { return 0; } initSurfaces(); IDirectSoundBuffer *pSound; pSound = DSLoadSoundBuffer(pDS, MAKEINTRESOURCE(IDR_WAVE1)); pSound->Play(0, 0, 0); while(1) { int t = PeekMessage(&msg, NULL, 0U, 0U, PM_NOREMOVE); if (t) { if (!GetMessage (& msg, NULL, 0, 0)) return msg.wParam; TranslateMessage (&msg); DispatchMessage (&msg); } else if (activeapp)// this is important here { updateframe(); } else if (!activeapp) WaitMessage(); } ofstream fout("scores.lsd", ios::binary); // Save Scores fout.write((char*)&score,sizeof(score)); fout.close(); finiObjects(); return msg.wParam; } LRESULT APIENTRY WndProc(HWND hwnd,UINT msg,WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_DESTROY: // SaveScores(score); ShowCursor(true); PostQuitMessage(0); break; case WM_SETCURSOR: ShowCursor(false); break; case WM_ACTIVATEAPP: activeapp = wParam; break; case WM_MOUSEMOVE: ix = LOWORD(lParam); iy = HIWORD(lParam); break; case WM_KEYDOWN: switch(wParam) { case VK_ESCAPE: SendMessage(hwnd, WM_CLOSE,0,0); break; } KeyInput(wParam); break; default: return DefWindowProc(hwnd,msg,wParam,lParam); } return 0; } void KeyInput(WPARAM wParam) { switch(screen) { case INTROSCREEN: IntroInput(wParam); break; case 1: GameInput(wParam); break; case 2: GameOverInput(wParam); break; } } void IntroInput(WPARAM wParam) { IDirectSoundBuffer *pSound; pSound = DSLoadSoundBuffer(pDS, MAKEINTRESOURCE(IDR_WAVE2)); IDirectSoundBuffer *pSound2; pSound2 = DSLoadSoundBuffer(pDS, MAKEINTRESOURCE(IDR_WAVE3)); switch(wParam) { case VK_UP: if(curpos != 0) { curpos = 0; pSound->Play(0, 0, 0); } break; case VK_DOWN: if(curpos != 1) { curpos = 1; pSound->Play(0, 0, 0); } break; case 13: if(bintro == false) { if(curpos == 0) { pSound2->Play(0,0,0); setscreen(GAMESCREEN); }else { SendMessage(mainWnd, WM_CLOSE,0,0); } } break; } if(blogo == false) { if(bintro == true) { bintro = false; } // skip } } void GameInput(WPARAM wParam) { switch(wParam) { case VK_SHIFT: case VK_CONTROL: case 97: case 65: Grid.HandleInput(MOV_A); // DSPlaySound(IDR_WAVE5); break; // case VK_ALTERNATE: case VK_SPACE: case 115: case 83: Grid.HandleInput(MOV_B); // DSPlaySound(IDR_WAVE5); break; case VK_LEFT: Grid.HandleInput(MOV_LEFT); //DSPlaySound(IDR_WAVE4); break; case VK_RIGHT: Grid.HandleInput(MOV_RIGHT); //DSPlaySound(IDR_WAVE4); break; case VK_DOWN: Grid.HandleInput(MOV_DOWN); //DSPlaySound(IDR_WAVE4); break; } } void GameOverInput(WPARAM wParam) { } // now that thats over with void setscreen(int s) { screen = s; } void draw() { switch(screen) { case 0: introscreen(); break; case 1: gamescreen(); break; case 2: drawgameover(); break; case 3: drawhighscores(); break; case 4: drawoptions(); break; } } void introscreen() { RECT rcRect; HRESULT ddrval; if(bintro == true) { if(blogo == true) { SetRect(&rcRect,0,0,640,480); ddrval = lpBack->BltFast(0,0,logo,&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); if(ddrval != DD_OK) { initSurfaces(); lpBack->Restore(); } logocount++; if(logocount > 150) { logocount = 0; blogo = false;} } else { SetRect(&rcRect,0,0,640,480); ddrval = lpBack->BltFast(0,0,intro,&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); introcount++; if(introcount > 150) { introcount = 0; bintro = false; } if(ddrval != DD_OK) { initSurfaces(); lpBack->Restore(); } } } else { SetRect(&rcRect,0,0,640,480); ddrval = lpBack->BltFast(0,0,start,&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); if(ddrval != DD_OK) { initSurfaces(); lpBack->Restore(); } SetRect(&rcRect,0,0,38,33); if(curpos == 0) { ddrval = lpBack->BltFast(80,220,cursor,&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); } else { ddrval = lpBack->BltFast(80,290,cursor,&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); } if(ddrval != DD_OK) { initSurfaces(); lpBack->Restore(); } } } void gamescreen() { RECT rcRect; HRESULT ddrval; SetRect(&rcRect,0,0,640,480); ddrval = lpBack->BltFast(0,0,gamebg,&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); errcheck(ddrval); // Paint // BlockProc // Paint // BlockCheck if(gint == false) { Grid.init_Grid(); gint = true; // 4 MATRIX - 5 ZOMBIE zombie = DSLoadSoundBuffer(pDS, MAKEINTRESOURCE(IDR_WAVE5)); matrix = DSLoadSoundBuffer(pDS, MAKEINTRESOURCE(IDR_WAVE4)); } if(Grid.ifgameover() == false) { Grid.update();// paiting within grid is turned off so ill just paint here // PAINTING THE GRID TO THE SCREEN // x = across // y = down if(track == TRACK_ZOMBIE) { DWORD status; zombie->GetStatus(&status); if(status & DSBSTATUS_PLAYING) { } else { zombie->Play(0,0,0); } } if(track == TRACK_MATRIX) { DWORD status; zombie->GetStatus(&status); if(status & DSBSTATUS_PLAYING) { } else { matrix->Play(0,0,0); } } // ofstream fout("debug.txt"); int STARTPOSX = STARTX; int STARTPOSY = STARTY; int x = STARTPOSX,y = STARTPOSY; for(int i = 0; i < 17; i++) { for(int j = 0; j < 8; j++) { // draw to screen //printscr.PrintText(x,y,gamescreen, "X"); // grid_blocks[Grid[i][j]]->DrawAt(gamescreen,x,y); SetRect(&rcRect,0,0,32,16); ddrval = lpBack->BltFast(x,y,grid_blocks[Grid.Grid[i][j]],&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); x = x + 32; } x = STARTPOSX; y = y + 16; // down lower } STARTPOSX = STARTX ; STARTPOSY = STARTY ; x = STARTPOSX,y = STARTPOSY; for(int s = 0; s < 17; s++) { for(int i = 0; i < 8; i++) { // graphics // draw to screen. if(Grid.BlockGrid[s][i] != BLOCK_BLACK) { ddrval = lpBack->BltFast(x,y,grid_blocks[Grid.BlockGrid[s][i]],&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); } x = x + 32; } y = y + 16; x = STARTPOSX; } // Draw What the Next Block Will Be to the Screen. // BLOCK2 int bx = 510; int by = 200; lpBack->BltFast(bx,by,grid_blocks[Grid.block2.color.c1],&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); lpBack->BltFast(bx,by+16,grid_blocks[Grid.block2.color.c2],&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); lpBack->BltFast(bx,by+32,grid_blocks[Grid.block2.color.c3],&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); // Draw The Score and Lines To The Scren using the Windows GDI HDC dc; lpBack->GetDC(&dc); SetBkColor(dc,RGB(0,0,0)); SetTextColor(dc,RGB(255,0,0)); char scorebuff[30]; char iscore[10]; char ilines[10]; char linesbuff[30]; itoa(Grid.Game.score,iscore,10); itoa(Grid.Game.lines,ilines,10); strcpy(scorebuff, "Score: "); strcat(scorebuff, iscore); strcpy(linesbuff, "Lines: "); strcat(linesbuff, ilines); if(Grid.Game.lines >= 10) { track = TRACK_MATRIX; // HARDCORE } else { track = TRACK_ZOMBIE; // SOFTCORE } TextOut(dc,200,60,scorebuff,strlen(scorebuff)); SetTextColor(dc,RGB(0,0,255)); TextOut(dc,310,60,linesbuff,strlen(linesbuff)); lpBack->ReleaseDC(dc); } else { //GameOverScreenStart(Grid.Game.score, Grid.Game.lines); //SetCurrentGameScreen(5); // Over //dScreen = 0; int score; int lines; score = Grid.Game.score; lines = Grid.Game.lines; DSPlaySound(IDR_WAVE8); setscreen(2); // game over gint = false; } } void drawgameover() { HRESULT ddrval; RECT rcRect; SetRect(&rcRect,0,0,640,480); ddrval = lpBack->BltFast(0,0,gameover,&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); errcheck(ddrval); // get input; of new high score inf nessicary // drawimage(x,y,image,rect); overwait++; if(overwait > 150) { overwait = 0; setscreen(3); // high scores } } void drawhighscores() { HRESULT ddrval; RECT rcRect; SetRect(&rcRect,0,0,640,480); ddrval = lpBack->BltFast(0,0,highscores,&rcRect,DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); errcheck(ddrval); // Paint High Scores // Set Here For 300 or Wait for Key Press HDC dc; lpBack->GetDC(&dc); SetBkColor(dc,RGB(0,0,0)); /* TextOut(dc,200,60,scorebuff,strlen(scorebuff)); SetTextColor(dc,RGB(0,0,255)); TextOut(dc,310,60,linesbuff,strlen(linesbuff)); lpBack->ReleaseDC(dc); */ int sx = 150; int sy = 60; int r; r = 50; for(int i = 0; i < 10; i++) { SetTextColor(dc,RGB(r,rand()%255,rand()%255)); r = r + 25; char scorebuff[100]; // strcpy(scorebuff, "Master on LSD: Score: 00000 Lines: Something "); char linebuff[10]; char scoreb[10]; itoa(score.scores[i].lines,linebuff,10); itoa(score.scores[i].score,scoreb,10); strcpy(scorebuff,score.scores[i].name); strcat(scorebuff,": "); strcat(scorebuff, " Score: "); strcat(scorebuff,scoreb); strcat(scorebuff, " Lines: "); strcat(scorebuff, linebuff); TextOut(dc,sx,sy,scorebuff,strlen(scorebuff)); sy = sy + 40; } lpBack->ReleaseDC(dc); scorewait++; if(scorewait > 300) { setscreen(0); scorewait = 0; } } void drawoptions() { // screw options till i get a good iface HDC dc; lpBack->GetDC(&dc); SetBkColor(dc,RGB(0,0,0)); SetTextColor(dc,RGB(0,0,255)); // TextOut(dc,640/2-70,50, "New Game Options",strlen("New Game Options")); SetTextColor(dc,RGB(255,0,0)); char buff[100]; strcpy(buff, "Game Difficulty: "); char diff[100]; strcpy(diff, "Trippin"); strcat(buff, diff); TextOut(dc,640/2-strlen(buff)-80,150,buff,strlen(buff)); strcpy(buff,"Trails: "); strcat(buff, "On"); /* AppFont = CreateFont(width < 640 ? 24 : 48, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, NONANTIALIASED_QUALITY, VARIABLE_PITCH, "Comic Sans MS"); */ //SelectObject(hdc, AppFont); //SetBkMode(hdc, TRANSPARENT); TextOut(dc,640/2-strlen(buff)-80,200,buff,strlen(buff)); lpBack->ReleaseDC(dc); }