/*==========================================================================
*
* Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
*
* File: donuts.h
* Content: main include file
*
*@@BEGIN_MSINTERNAL
* History:
* Date By Reason
* ==== == ======
* 12-jul-95 kylej Initial Creation
* 15-sep-97 t-craigs Multimon
*@@END_MSINTERNAL
*
***************************************************************************/
#ifndef DONUTS_INCLUDED
#define DONUTS_INCLUDED
//#define USE_DSOUND
#undef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <mmsystem.h>
#include <ddraw.h>
#ifdef USE_DSOUND
#include <dsound.h>
#endif
#include "resource.h"
#include "ddutil.h"
#include "input.h"
#include "util.h"
#include "monitor.h"
#ifdef USE_DSOUND
#include "dsutil.h"
#endif
#define DEF_SHOW_DELAY (2000)
// program states
enum
{
PS_SPLASH,
PS_ACTIVE,
PS_BEGINREST,
PS_REST
};
class CObject
{
public:
CObject( int nMaxFrame, int nSize );
int GetMonitorX();
int GetMonitorY();
void UpdateRect();
void Blt();
BOOL CheckPosition( DWORD tickDiff );
void DeleteFromList();
// virtual fcts
virtual void Init( double x, double y );
virtual BOOL CheckFrame();
virtual void UpdateFrame( DWORD tickDiff );
virtual BOOL CanBeBullet() { return FALSE; };
virtual BOOL CanBeTarget() { return FALSE; };
// pure virtual - must be implemented by derived classes
virtual void UpdateSrcRect() = 0;
virtual int Hit( double l, double t ) = 0;
virtual LPDIRECTDRAWSURFACE GetSurface() = 0;
// constants
int km_iMaxFrame;
int km_iSize;
// data
CObject*next;
CObject*prev;
double posx, posy; // actual x and y position
double velx, vely; // x and y velocity (pixels/millisecond)
double frame; // current frame
double delay;
RECT src, dst;
intiMonitor;
};
class CDonut : public CObject
{
public:
CDonut();
virtual void UpdateSrcRect();
virtual LPDIRECTDRAWSURFACE GetSurface();
virtual int Hit( double l, double t );
virtual void Init( double x, double y );
virtual BOOL CanBeTarget() { return TRUE; };
};
class CPyramid : public CObject
{
public:
CPyramid();
virtual void UpdateSrcRect();
virtual LPDIRECTDRAWSURFACE GetSurface();
virtual int Hit( double l, double t );
virtual void Init( double x, double y );
virtual BOOL CanBeTarget() { return TRUE; };
};
class CCube : public CObject
{
public:
CCube();
virtual void UpdateSrcRect();
virtual LPDIRECTDRAWSURFACE GetSurface();
virtual int Hit( double l, double t );
virtual void Init( double x, double y );
virtual BOOL CanBeTarget() { return TRUE; };
};
class CSphere : public CObject
{
public:
CSphere();
virtual void UpdateSrcRect();
virtualLPDIRECTDRAWSURFACE GetSurface();
virtual int Hit( double l, double t );
virtual void Init( double x, double y );
virtual BOOL CanBeTarget() { return TRUE; };
};
class CShip : public CObject
{
public:
CShip();
virtual void UpdateSrcRect();
virtual LPDIRECTDRAWSURFACE GetSurface();
virtual int Hit( double l, double t );
virtual void Init();
virtual void UpdateFrame( DWORD tickDiff );
virtual BOOL CanBeBullet() { return TRUE; };
BOOLlastShield;
};
class CBullet : public CObject
{
enum {
BULLET_X = 304,
BULLET_Y = 0
};
public:
CBullet();
virtual void UpdateSrcRect();
virtual LPDIRECTDRAWSURFACE GetSurface();
virtual int Hit( double l, double t );
virtual void Init( double x, double y );
virtual BOOL CheckFrame();
virtual BOOL CanBeBullet() { return TRUE; };
};
/*
* fn prototypes
*/
voidAppPause(void);
voidAppUnpause(void);
voidCheckOneMenuItem(HMENU hmenu, UINT idc, BOOL fCheck);
voidCheckMenuItems(HWND hwnd);
BOOLInitApplication( HANDLE hInstance, int nCmdShow );
BOOLInitializeGame( void );
voidInitLevel( int level );
voidSetupGame();
voidUpdateFrame( void );
voidUpdateDisplayList( void );
voidCheckForHits( void );
voidDrawDisplayList( void );
voidDisplayFrameRate( void );
voidDisplayLevel( void );
voidBltScore( char *num, int x, int y );
voidBltSplash( void );
BOOLEraseScreen( void );
BOOL FlipScreen( void );
BOOLCleanupAndExit( char *err );
BOOLCleanupAndExit( char *err, HRESULT ddrval );
#ifdef USE_DSOUND
voidPlayPanned(HSNDOBJ hSO, double posx);
voidInitializeSound( void );
voidDestroySound( void );
#endif
#endif