#if !defined(RT_MISC_H)
#define RT_MISC_H
// misc.h
//
// Description:
//  Provides some miscellaneous helper items.
//
// Provides:
//  NUM_OF(array)   Returns number of items in the fixed-size array.
//
//  Error code facility enumerants.
//
//  Typedef aliases to provide consistent structure naming conventions.
//
// Copyright (C) 2000-2001, Rich Thomson, all rights reserved.
//

#define NUM_OF(array_) (sizeof(array_)/sizeof(array_[0]))

namespace rt {
    // facility name enumerants
    enum {
        FACILITY_DIRECT3D = 0x876,
        FACILITY_DIRECT3D_UTIL = 0x877
    };
};

//////////////////////////////////////////////////////////////////////
// The naming convention for structures in Direct3D8 is a little
// inconsistent.  While all are in upper case, some separate wrods
// with _'s and some don't.  If you often have compiler errors that
// are spelling errors due to the inconsistent naming convention,
// you can define one of the following symbols to create typedefs
// consistent with either naming convention found in the header
// files
//
// RTM_NO_UNDERSCORE_NAMES  - use D3DSTRUCTURENAME convention
// RTM_ALL_UNDERSCORE_NAMES - use D3DSTRUCTURE_NAME convention
//
#if defined(RTM_NO_UNDERSCORE_NAMES)
typedef ::D3DDEVICE_CREATION_PARAMETERS ::D3DDEVICECREATIONPARAMETERS;
typedef ::D3DPRESENT_PARAMETERS         ::D3DPRESENTPARAMETERS;
typedef ::D3DVERTEXBUFFER_DESC          ::D3DVERTEXBUFFERDESC;
typedef ::D3DINDEXBUFFER_DESC           ::D3DINDEXBUFFERDESC;
typedef ::D3DSURFACE_DESC               ::D3DSURFACEDESC;
typedef ::D3DVOLUME_DESC                ::D3DVOLUMEDESC;
typedef ::D3DLOCKED_RECT                ::D3DLOCKEDRECT;
typedef ::D3DLOCKED_BOX                 ::D3DLOCKEDBOX;
typedef ::D3DRECTPATCH_INFO             ::D3DRECTPATCHINFO;
typedef ::D3DTRIPATCH_INFO              ::D3DTRIPATCHINFO;
typedef ::D3DADAPTER_IDENTIFIER8        ::D3DADAPTERIDENTIFIER8;
typedef ::D3DRASTER_STATUS              ::D3DRASTERSTATUS;
#endif

#if defined(RTM_ALL_UNDERSCORE_NAMES)
typedef ::D3DCOLORVALUE        ::D3DCOLOR_VALUE;
typedef ::D3DLINEPATTERN       ::D3DLINE_PATTERN;
typedef ::D3DDISPLAYMODE       ::D3DDISPLAY_MODE;
typedef ::D3DGAMMARAMP         ::D3DGAMMA_RAMP;
typedef ::D3DVERTEXBUFFER_DESC ::D3DVERTEX_BUFFER_DESC;
typedef ::D3DINDEXBUFFER_DESC  ::D3DINDEX_BUFFER_DESC;
typedef ::D3DRECTPATCH_INFO    ::D3DRECT_PATCH_INFO;
typedef ::D3DTRIPATCH_INFO     ::D3DTRI_PATCH_INFO;
#endif

#endif
