commit 6cc92a9e69f37d0d69c69b0cf71b1db7d48cc085 Author: mason <mason@MinervaWorkspace> Date: Sun Oct 23 09:52:35 2011 -0500 dxsdk3 - from F:\code [git-p4: depot-paths = "//code/dxsdk3/": change = 1612] diff --git a/docs/readme/conv3ds.txt b/docs/readme/conv3ds.txt new file mode 100644 index 0000000..91e14d6 --- /dev/null +++ b/docs/readme/conv3ds.txt @@ -0,0 +1,170 @@ +conv3ds +------- + +conv3ds converts 3ds models produced by Autodesk 3D Studio and other +modelling packages into X Files. By default it produces binary X files +with no templates. + + +How to use it +------------- + +At its simplest you can run it with no options and it will (endeavour) to +produce an X file containing a hiearchy of frames. For example: + +conv3ds file.3ds + +will produce an X File file.x. Use Frame::Load to load the frame. + +If the 3ds file contains key frame data then you can produce an X file +which contains an animation set using the -A option. For example: + +conv3ds -A file.3ds + +Use AnimationSet::Load to load the animation. + +If you want to make an X file containing a single mesh made from all the +objects in the 3ds file then use the -m option. + +conv3ds -m file.3ds + +Use MeshBuilder::Load to load the mesh. + + +Other useful options +-------------------- + +* The -T option will wrap all the objects and frame hierarchies in a single +"toplevel" frame. This enables you to load all the frames and objects in +the 3ds file with a single call to Frame::Load, using the default options +(ie. Load the first toplevel frame hiearchy in the X file). The frame +containing all the other frames and meshes is called "x3ds_filename" +(without the .3ds extension). When used with the -m option this option has +no affect. + + +* The -s option allows you to specify a scale factor for all the objects +converted in the 3ds file. For example + +conv3ds -s10 file.3ds + +will make all the objects 10 times bigger, and + +conv3ds -s0.1 file.3ds + +will make all the objects 10 times smaller + + +* The -r option reverses the winding order of the faces when the 3ds file is +converted. If after converting the 3ds file and viewing it in D3D, the object +appears "inside-out" try converting it with the -r option. All Lightwave +models (see notes below) exported as 3ds files will need this option. + + +* The -v option turns on verbose output mode. Specifiy an integer with it. +The only useful (currently) integers are: + -v1, print out warnings about bad objects and general information + about what the converter is doing + -v2, print out basic keyframe information, objects being included in the + conversion process, and information about the objects while being saved. + -v3, very verbose (mostly useful for debugging) information. + +The default is -v0. + + +* The -e option allows you to change the extension for texture map files. For +example: + +conv3ds -e"ppm" file.3ds + +and file.3ds contains objects which reference the texture map file brick.gif, +the X file will reference the texture map file brick.ppm. The converter does +not convert the texture map file. The texture map files must also be in the +D3DPATH when the resulting X File is loaded. + +* The -x option forces conv3ds to produce a text X file, not a binary +X file. Text files are larger but can be hand edited easily. + +* The -X option forces conv3ds to include the D3DRM X File templates in +the file. By default the templates are not included. + + +Other options +------------- + +* The -t option specifies that the X File produced will not contain texture +information. + +* The -N option specifies that the X file produced will not contain Normal +information. All the D3DRM Load calls will generate normals for objects +with no normals in the X file. + +* The -c option specifies that the X file produced should not contain +texture coordinates. By default if you use the -m option the outputted mesh +will contain 0,0 uv texture coordinates if the 3ds object had no texture +coordinates. + +* The -f option specifies that the X file produced should not contain any +FrameTransformMatrix. + +* The -z and -Z options allow you to adjust the alpha face color value of +all the materials referenced by objects in the X File. +This is best illustrated with an example: + +conv3ds -z0.1 -Z0.2 file.3ds + +says add 0.1 to all alpha values under 0.2. And + +conv3ds-z"-0.2" -z1 file.3ds + +says subtract 0.2 from the alpha values for all alphas. + +* The -o option allows you to specify the filename for the .X File produced. + +* The -h option tells the converter not to try to resolve any hiearchy +information in the 3ds file (usually produced by the keyframer). Instead all +the objects (when the converter is not used with the -m option) are outputted +in toplevel frames. + + +3ds file produced from lightwave objects +---------------------------------------- + +There are a number of issues with 3ds files exported by the trans3d +plugin for lightwave. These are best handled using the following +options to conv3ds. + +conv3ds -r -N -f -h -T|m trans3dfile.3ds + +All the 3ds objects which we've come across produced by trans3d and the +lightwave object editor need their winding order reversing (otherwise they +appear "inside-out" when displayed) and contain no normal information. + + +Hints and Tips +-------------- + +Some of these are pretty obvious but are probably worth saying anyway. + +If, after loading an object produced by conv3ds into the D3DRM viewer, +you can't see the object then try using the -s object +with an integer of say, 100, to increase the X file objects scale. + + +If, after loading the object into the viewer and switching from flat +shading into Gourard shading the object turns dark grey try converting +with the -N option. + +Textures can be the biggest problem. If after converting the object the +textures don't get loaded then make sure that the object is referencing +either .ppm or .bmp files (using the -e option), make sure the textures +width and height is a power of 2, and make sure the textures are stored +in one of the directories in your D3DPATH. + + +Known bugs and problems +----------------------- + +Currently conv3ds can't handle dummy frames used in 3ds animations. +It just ignores them (but will convert any child objects). + diff --git a/docs/readme/d3d.txt b/docs/readme/d3d.txt new file mode 100644 index 0000000..d59c540 --- /dev/null +++ b/docs/readme/d3d.txt @@ -0,0 +1,156 @@ +********************** +*** *** +*** *** +*** Direct3D Notes *** +*** *** +*** *** +********************** + +Last updated September 5, 1996 + + +Notes on the software emulation drivers +======================================= + + +RAMP driver support +=================== +Optional Z buffering. +Color key and stippled transparency. +Mono interpolated rasterization only. +Point sampled perspective correct textures. +Flat and Gouraud shade modes. + +Performance notes for the RAMP driver +===================================== +Texture mapping performance is heavily gated by the speed of memory. +There are a number of ways of maximizing the cache performance of your +textures. The smaller the textures are, the better chance they have of being +maintained in the secondary cache. This is crucial for keeping performance +high. Also, changing the texture per primitive will thrash the cache. Try +and keep polygons grouped in order of the textures they use. + +When using Z buffering and texturing, rendering your scene from front to +back will increase performance. The textured Z buffered primitives +pre-test the Z buffer on a scanline basis. If a scanline is hidden by a +previously rendered polygon it is trivially rejected. If this is the case, Z +buffering performance can exceed non-Z performance. + +The retained mode API automatically orders its scenes from front to back +to facilitate this optimization. + +In it often a good idea to use the D3DTest program to verify performance +results with different drivers, especially where hardware is involved. + + +RGB driver +========== + +There is now an MMX optimized version of the RGB driver. +If you have an MMX capable PC the RGB software emulation will automatically +be accelerated. There is an application included in the sdk\bin directory, +mmxtog.exe which allows you to switch MMX acceleration off and on for the +RGB driver. + +Release notes for D3D MMX driver + +Functionality +------------- + +1. D3D's external interfaces unchanged, all examples and all apps that +can use the RGB driver should be able to run with the RGB MMX driver. + +2. Only 16-bit color depths have been optimised. There is a relatively +minor (2X) improvement in 8-bit dithered RGB rendering. + +3. The following are yet-to-be-implemented: mip-mapping, 16-bit dithering. + +4. The Z-buffer is 16-bit, but is signed, so the farthest Z-value is 0x7fff, +and the nearest is 0x8000. This should not affect you unless you examine +the Z-buffer directly. + +5. There are still some accuracy problems with the rendering: these are +most clearly shown by the colored flashes that appear in the "twist" +example. We're working on this problem right now, and should have +fixes soon. + +6. The driver only supports the PAL8 texture format. D3D apps should detect +this and create the texture appropriately. This format is the same as +the one supported by the ramp driver. + +Performance +----------- + +1. Performance is much better when all surfaces are in systemmemory, this +includes the rendering target and all textures. + +2. The current MMX RGB driver is not complete, and there are several +major performance improvements that we plan to make. Expect another +improvement of about 10% in all benchmarks for the MMX RGB driver, +though the more sophisticated the rendering operation, the bigger the +improvement. The biggest improvement should be in Z-buffered +gouraud-shaded perspective-correct texture-mapping. Perspective +correction will be much faster in the next beta. + +3. Performance is better than that of ramp mode in most situations. +There are some performance bottlenecks that we have yet to address. +We suggest you run the "tunnel" example with the MMX driver to get a +feel for the changed relative costs of rendering qualities: for +example, the speed of gouraud shading is now much closer to that of +flat-shading. To get the best performance from the tunnel, do the +following: + +Specular highlights OFF +Fog OFF +Perspective Correction OFF +Gouraud shading ON + +With these settings, you should be getting about 29Hz for the tunnel +running in systemmemory fullscreen at 640x400x16. + +4. The existing ramp driver works best on textures that are 256x256. +This restriction has been removed in the MMX driver: it supports all +texture dimensions equally well. It is still important to keep the total +texture size as small as possible to reduce memory bandwidth. Note how +fast the tiny checker texture runs in the tunnel. The checker texture is +only 64 bytes instead of 64k like most of the other textures in the SDK. +256x2048 is a reasonable size for the texture in a game. + + + + + + +Known Issues +============ +When using RGB software rasterisation, D3DRMMATERIALMODE_FROMFRAME +does not work correctly if the object is unlit. + +It is not currently possible to load textures from resources if the code +resides in a dll. + +Background depth images do not double buffer correctly in the retained +mode api (page flipping scenario). Use IDirect3DRMViewport::ForceUpdate() +to force the dirty region to be updated. + +The following issues is not made clear in the documentation: +1) SetOrientation overrides any previous shear or scale applied to a +frame. + +2) Texture Transparency. If the retained mode API has to sample down +the colors used in a texture in order to, for example, palettize it, +the color you're using as the transparent color may get remapped to +another close color and transparency will no longer work. In order to +stop this happening, pick a color to use for transparency that is not +close to any other color in the texture. + +The Matrox Millenium driver does not render correctly fullscreen +unless Clear is called at least once. Since the Millenium does not +support texture mapping, this will not affect the types of application +which do not use Clear. A workaround for this issue is to call Clear +in your application once before entering the rendering loop. + +When using the Retained Mode method IDirect3DRM::LoadTexture, the texture +is inverted when loaded from a BMP file. The simplest work around is to +reverse the meshs texture coordinates or load from a PPM file. + diff --git a/docs/readme/ddraw.txt b/docs/readme/ddraw.txt new file mode 100644 index 0000000..b163771 --- /dev/null +++ b/docs/readme/ddraw.txt @@ -0,0 +1,784 @@ +************************ +*** *** +*** *** +*** DirectDraw Notes *** +*** *** +*** *** +************************ + +Last updated September 10, 1996 + +Notes for DirectDraw 3.0 +======================================== +The CoCreateInstance API cannot be used to create an IDirectDraw2 object. +To work around this problem, create a DirectDraw object and call +QueryInterface on it to get the IDirectDraw2 interface. + +IDirectDrawSurface2::Flip may cause your machine to hang. To work around this +problem, call IDirectDrawSurface::Flip instead. + + +Notes for DirectDraw 2.0 +======================================== + +In some hardware configurations, stretched transparent blits do not work +correctly. If at all possible, when writing DirectDraw applications, you +should avoid using stretched transparent blits. To work around this +limitation, you can do a stretched blit to an intermediate surface, followed +by a transparent blit to your original destination surface. + +On some, relatively rare, older video boards, source color key blitting +to the primary surface may not work. You can work around this by composing +your image with transparency to a back buffer, then blitting the result to +the primary surface. + +DirectDraw::Initialize() is now called if the DirectDraw object +is created with standard COM methods. + + +Notes for DirectDraw 2.0 Beta 3 +======================================== + + +SetDisplayMode now supports setting the monitor refresh rate +------------------------------------------------------------ +The IDirectDraw2::SetDisplayMode function now takes two additional +parameters. The dwRefreshRate parameter can be used to specify a +monitor refresh rate in Hz. Valid refresh rates can now be enumerated +with the IDirectDraw2::EnumDisplayModes function. The refresh rate is +returned in the dwRefreshRate field of the DDSURFACEDESC structure. + +If a refresh rate of 0 is specified in SetDisplayMode, this means to +revert back to the IDirectDraw behaviour and set the default refresh +rate for the specified mode. The display driver may or may not enumerate +specific refresh rates for each mode. If no refresh rate is specified +by the driver for a particular mode, the dwRefreshRate field in the +DDSURFACEDESC structure set by EnumDisplayModes will be 0. + + +Direct Draw modes now respect monitor settings +---------------------------------------------- +Windows 95 allows a user to specify the type of monitor that is being +used. DirectDraw now checks the display modes that it knows about against +the display restrictions of the installed monitor. If it is determined +that the requested mode is not compatible with the monitor, then SetDisplayMode +will fail. Only modes which are supported on the installed monitor will be +enumerated in EnumDisplayModes. + + +IDirectDrawSurface2::DDGetInterface now supported +------------------------------------------------- +A new method has been added to the IDirectDrawSurface2 interface which is +call DDGetInterface. This function returns a pointer to the DirectDraw +object that was used to create the specified surface. + +Direct Draw clipper objects now have a COM class factory +-------------------------------------------------------- +Direct Draw clipper objects now have full class factory support for COM +compliance. Clippers can now be created using either CoGetClassObject +to obtain a class factory and then calling CreateInstance or by calling +CoCreateInstance directly. The class identifier for the clipper class is +CLSID_DirectDrawClipper. Please note that it is still possible to create +clipper objects using either of the two existing API functions; +DirectDrawCreateClipper or IDirectDraw::CreateClipper. Class factory +support is provided in addition to these functions rather than in +replacement of them. + +Clippers created by the class factory mechanism must be initialized +with the IDirectDrawClipper::Initialize member before use. Initialize +takes two parameters; a DirectDraw driver object interface pointer and +a flags field. Currently the flags field must be 0. If a NULL driver object +is specified then the clipper is not owned by a Direct Draw driver object +and behaves identically to clippers created with DirectDrawCreateClipper. +If a driver object is specified the clipper will be owned by that driver +object and behaves identically to IDirectDraw::CreateClipper. + +Flip now flips all levels of a mip-map +-------------------------------------- +Previously, Flip only flipped the the mip-map level supplied as an +argument. Now, however, Flip will flip all the levels of a mip-map +from the level supplied to the lowest level in the map. A destination +surface can also be provided in which case all levels in the mip-map will +flip to the back buffer in thier flippable chain which matches the supplied +override. For example, if the third back buffer in the top level +flippable chain is supplied all levels in the mip-map will flip to thier +third back buffer. + +The number of levels in a mip-map is now stored explicitly +---------------------------------------------------------- +The number of levels in a mip-map chain is now stored explicitly. +When the surface description of a mip-map is obtained (via +IDirectDrawSurface::Lock or IDirectDrawSurface::GetSurfaceDesc) the +dwMipMapCount field will contain the number of levels in a mip-map +including the top-level. Note, for levels other than the top-level +in the map, dwMipMapCount will specify the number of levels from +that map to the smallest map in the chain. + +New surface capability bit for Direct3D texture loading +------------------------------------------------------- +A new surface capability bit, DDSCAPS_ALLOCONLOAD, has been added +to support device dependent and compressed texture surfaces. This +capability bit specifies that a given texture surface does not +have memory allocated for it when it is created. Instead, sufficient +memory will be allocated when the texture is loaded using the Direct3D +texture Load member. Currently the semantics of this bit are not fully +implemented and the width, height and pixel format of the texture +surface should be specified when DDSCAPS_ALLOCONLOAD is specified. +However, for the final release, width, height and pixel format will +not be specified at create time but will be initialized when the +texture is loaded. If DDSCAPS_ALLOCONLOAD is specified so must +DDSCAPS_TEXTURE. For further information see the Direct3D documentation +on the IDirect3DTexture::Load member function. + + +Notes for DirectDraw 2.0 Beta 2 +======================================== + + +Support for high resolutions and TrueColor bit depths +----------------------------------------------------- +Direct Draw supports all of the screen resolutions and depths supported +by the Display Driver. Version 1.0 of Direct Draw limited the available +video modes to 640x480 with pixel depths of 8 bits per pixel and 16 bits +per pixel. This restriction has been relaxed and Direct Draw now allows +an application to change the mode into any mode supported by the Display +Driver. This includes all supported 24 and 32 bits-per-pixel modes. + +Note that this release of Direct Draw does not check the monitor capabilities +stored by the system to determine if a particular display resolution is +compatible with the monitor. This means that an application may use +EnumerateDisplayModes to determine the available video modes and then switch +into a mode that is not supported by the monitor. This is a defect which +will be corrected in the next release. + + +HEL Blitting Support for 24 and 32 bit Surfaces +----------------------------------------------- +Direct Draw now supports HEL blitting of 24 and 32 bits-per-pixel surfaces. +If the Display Driver supports blitting at these resolutions then the +hardware blitter will be used for vram to vram blits. Otherwise, the +Hardware Emulation Layer (HEL) will be used to do the blits. + + +Multiple Direct Draw Objects per Process +---------------------------------------- +Direct Draw 1.0 only allowed the creation of one Direct Draw object per +process. If your process happened to use another system component (such +as Direct Play) that created a Direct Draw object, the process would be +unable to create another Direct Draw object for its own use. + +This restriction has been eliminated in this release. It is now possible +for a process to call DirectDrawCreate as many times as necessary. A +unique and independent interface will be returned from each call. Each +DirectDraw object may be used as desired. There are no dependencies +between the objects. They behave exactly as they would if they had been +created by two different processes. + +Since the Direct Draw objects are independent, surface, palette, and +clipper objects which are created with a particular Direct Draw object +should not be used with other Direct Draw objects. This is because these +objects are automatically released when the Direct Draw object is +destroyed. If they are used with another Direct Draw object, they +may go away if the original object is destroyed. + +Clipper objects which are created with DirectDrawClipperCreate are +independent of any particular Direct Draw object and may be used with +one or more Direct Draw objects. + + +SetCooperativeLevel Doesn't Require an HWND for non-Exclusive Mode +------------------------------------------------------------------ +Direct Draw 1.0 required an HWND to be specified in the SetCooperativeLevel +call regardless of whether or not Full-screen Exclusive mode was being +requested. This function no longer requires an HWND to be specified +if the application is requesting DDSCL_NORMAL mode. It is now possible +for an application to use Direct Draw with multiple windows. All of these +windows may be used simultaneously in normal windowed mode. + + +New IDirectDraw2 and IDirectDrawSurface2 interfaces +--------------------------------------------------- +The COM model that Direct Draw uses specifies that additional functionality +is provided by providing new interfaces. This release of Direct Draw +implements a new Direct Draw interface and a new Direct Draw Surface +interface. These new interfaces may be obtained by using QueryInterface +as shown in the following code fragment: + + /* + * create an IDirectDraw2 interface + */ + LPDIRECTDRAW lpDD; + LPDIRECTDRAW2 lpDD2; + + ddrval = DirectDrawCreate( NULL, &lpDD, NULL ); + if( ddrval != DD_OK ) + return; + + ddrval = lpDD->SetCooperativeLevel( hwnd, DDSCL_NORMAL ); + if( ddrval != DD_OK ) + return; + + + ddrval = lpDD->QueryInterface( IID_IDirectDraw2, (LPVOID *)&lpDD2); + if( ddrval != DD_OK ) + return; + + + ddscaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddrval = lpDD2->GetAvailableVidMem(&ddscaps, &total, &free); + if( ddrval != DD_OK ) + return; + +This code fragment shows C++ syntax for creating an IDirectDraw interface +and then using QueryInterface to create an IDirectDraw2 interface. It is +this interface which contains the GetAvailableVidMem function. An attempt +to use the GetAvailableVidMem function from an IDirectDraw interface will +result in a compile-time error. + +The IDirectDraw2 interface contains all of the same member functions as the +IDirectDraw interface along with one additional member functions called +GetAvailableVidMem. The SetDisplayMode function in this interface will +allow refresh rates to be specified. This is not enabled for this beta and +this function will return DDERR_UNSUPPORTED. The SetDisplayMode function +in the IDirectDraw interface can be used instead. + +The IDirectDrawSurface2 interface contains all of the same member functions +as the IDirectDrawSurface interface with two additional member functions +called PageLock and PageUnlock. The following code fragment shows how to +create an IDirectDrawSurface2 interface: + + LPDIRECTDRAWSURFACE lpSurf; + LPDIRECTDRAWSURFACE2 lpSurf2; + + // Create surfaces + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | + DDSCAPS_SYSTEMMEMORY; + ddsd.dwWidth = 10; + ddsd.dwHeight = 10; + + ddrval = lpDD2->CreateSurface( &ddsd, &lpSurf, NULL ); + if( ddrval != DD_OK ) + return; + + ddrval = lpSurf->QueryInterface( IID_IDirectDrawSurface2, (LPVOID *)&lpSurf2); + if( ddrval != DD_OK ) + return; + + ddrval = lpSurf2->PageLock( 0 ); + if( ddrval != DD_OK ) + return; + + ddrval = lpSurf2->PageUnlock( 0 ); + if( ddrval != DD_OK ) + return; + + +New PageLock and PageUnlock functions +------------------------------------- +A new feature that is supported with this release is the capability for +DirectDraw to allow a driver to control the blitting to or from a system +memory surface. A driver may choose to do this blitting by copying the +bytes one by one or by using DMA transfers. If the driver uses a DMA +transfer, it is important that the system memory which contains the bits +for the surface is locked so that it cannot be paged out while the DMA is +in progress. This can be done using the PageLock and PageUnlock functions +available in the IDirectDrawSurface2 interface. + +HRESULT PageLock( LPDIRECTDRAWSURFACE lpddSurf, DWORD dwFlags ); +HRESULT PageUnlock( LPDIRECTDRAWSURFACE lpddSurf, DWORD dwFlags ); + +There are no flags currently defined for these functions so the only valid +value for dwFlags is 0. This function may be called on a vram surface but +it will simply return DD_OK without doing anything. If called on a Sytem +Memory surface (ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY is nonzero) then all +of the memory pages used by this surface will be locked so that they can�t +be paged out. A Lock count is maintained for each surface and incremented +each time PageLock is called for that surface. The count is decremented +when PageUnlock is called. When the count reaches 0, the memory is unlocked +and may then be paged by the operating system. Note that the performance +of the operating system may be negatively affected if too much memory is +locked. + +The following codes may be returned from these two functions: +DD_OK +DDERR_INVALIDOBJECT +DDERR_INVALIDPARAMS +DDERR_SURFACE_LOCK +DDERR_CANTPAGELOCK + + +Driver can now Blit to and from System Memory surfaces +------------------------------------------------------ +In DirectDraw 1.0, if a surface was in system memory, the HEL automatically +performed the blit. Some display cards have DMA hardware which allows them +to efficiently blit to and from system memory surfaces. The DDCAPS +structure has been expanded to allow drivers to report this capability. +The following fields have been added. + +DWORD dwSVBCaps +DWORD dwSVBCKeyCaps +DWORD dwSVBFXCaps +DWORD dwSVBRops[DD_ROP_SPACE] + +DWORD dwVSBCaps +DWORD dwVSBCKeyCaps +DWORD dwVSBFXCaps +DWORD dwVSBRops[DD_ROP_SPACE] + +DWORD dwSSBCaps +DWORD dwSSBCKeyCaps +DWORD dwSSBFXCaps +DWORD dwSSBRops[DD_ROP_SPACE] + +The SVB prefix indicates capabilities bits that relate to System memory to +Video memory Blits. The VSB prefix indicates capabilities bits that relate +to Video memory to System memory Blits. The SSB prefix indicates +capabilities bits that relate to System memory to System memory Blits. + +The dwSVBCaps field corresponds to the dwCaps field except that it describes +the blitting capabilities of the display driver for System Memory to Video +Memory blits. Likewise, the dwSVBCKeyCaps corresponds to the dwCKeyCaps +field and dwSVBFXCaps corresponds to dwFXCaps. The dwSVBRops array describes +the raster ops that the driver supports for this type of blit. + +These fields are only valid if the DDCAPS_CANBLTSYSMEM bit is set in dwCaps +indicating that the driver is able to blit to or from system memory. + +If the system memory surface being used by the hardware blitter is not +locked, Direct Draw will automatically call PageLock on the surface to insure +that the memory has been locked. + + +DirectDraw Palette Objects +========================== + +Setting Palettes on Non-Primary surfaces +---------------------------------------- +In DirectDraw 1.0 palettes could only be attached to the primary surface. +Palettes can now be attached to any palletized surface (primary, back +buffer, offscreen plain or texture map). Only those palettes attached +to primary surfaces will have any effect on the system palette. In it +important to note that DirectDraw blits never perform color conversion - +any palettes attached to the source or destination surface of a blit are +ignored. Furthermore, the DirectDraw surface function GetDC() also ignores +any DirectDraw palette selected into the surface. + +Non-primary surface palettes are intended for use by applications or +Direct3D (or other 3D renderer). + +Sharing Palettes +---------------- +Palettes can now be shared between multiple surfaces. The same palette +can be set on the front and back buffer of a flipping chain or shared +between multiple texture surfaces. When a palette is attached to a +surface with SetPalette(), the surface increments the reference count +of that palette. When the reference count of the surface reaches zero +it will decrement the reference count of the attached palette. In +addition, if a palette is detached from a surface by calling SetPalette() +with a NULL palette interface pointer, the reference count of the +surface's palette will be decremented. Please note that if SetPalette() +is called several times consecutively for the same surface with the +same palette the reference count for the palette will be incremented +once only. Subsequent calls will not effect the palette�s reference count. + +New Palette Types +----------------- +In additional to the 8-bit (256 entry) palettes supported previously, +DirectDraw 2.0 supports 1-bit (2 entry), 2-bit (4 entry) and 4-bit +(16 entry) palettes. Such palettes can by created by specifying one of +the new palette capability flags; DDPCAPS_1BIT, DDPCAPS_2BIT and +DDPCAPS_4BIT. Matching capability flags have been added for surface +pixel formats (DDPF_PALETTEINDEXED1, DDPF_PALETTEINDEXED2 and +DDPF_PALETTEINDEXED4). A palette can only be attached to a surface with +a matching pixel format. For example, a 2 entry palette created with the +DDPCAPS_1BIT flag can only be attached to a 1-bit surface created with +the pixel format flag DDPF_PALETTEINDEXED1 etc. Furthermore, it is now +possible to create indexed palettes. An indexed palette is one whose +entries do not hold RGB colors but integer indices into the array of +PALETTEENTRYs of some target palette. An indexed palette's color table +is an array of 2, 4, 16 or 256 bytes where each byte is an index into +some unspecified, destination palette. + +To create an indexed palette specify the palette capability flag +DDPCAPS_8BITENTRIES when calling CreatePalette(). For example, to +create a 4-bit, indexed palette specify DPCAPS_4BIT | DDPCAPS_8BITENTRIES. +When creating an indexed palette a pointer to an array of BYTEs is passed +rather than a pointer to an array of PALETTEENTRY structures. The pointer +to the array of BYTEs must be cast to an LPPALETTEENTRY when calling +CreatePalette(). + +DirectDraw Clipper Objects +========================== + +Sharing Clippers +---------------- +Clippers can now be shared between multiple surfaces. For example, the +same clipper can be set on both the front and back buffers of a flipping +chain. When a clipper is attached to a surface with SetClipper(), the +surface increments the reference count of that clipper. When the reference +count of the surface reaches zero it will decrement the reference count +of the attached clipper. In addition, if a clipper is detached from a +surface by calling SetClipper() with a NULL clipper interface pointer, +the reference count of the surface's clipper will be decremented. + +Please note that if SetClipper() is called several times consecutively +for the same surface with the same clipper the reference count for the +clipper will be incremented once only. Subsequent calls will not +effect the clipper's reference count. + +Driver Independent Clippers +--------------------------- +It is now possible to create clipper objects which are not owned by a +DirectDraw driver object. Such clippers can be shared across multiple +driver objects. Driver independent clipper objects are created with +the new DirectDraw API function DirectDrawCreateClipper(). This function +can be called before any DirectDraw driver objects are created. As these +clippers are not owned by any DirectDraw driver object, they are not +automatically released when an application's driver objects are released. +If not released explicitly by the application such clippers will be +released by DirectDraw when the application terminates. + +It is still possible to create clippers with the DirectDraw interface +member function CreateClipper(). Such clippers behave identically to +the clippers of DirectDraw 1.0. Specifically they will be automatically +released when the driver object from which they were created is released. + +Enhanced Surface Format Support in the Hardware Emulation Layer (HEL) +===================================================================== + +In DirectDraw 1.0 the Hardware Emulation Layer (HEL) could only create +surfaces whose pixel format exactly matched that of the current primary +surface. This restriction has been relaxed for DirectDraw 2.0. + +The HEL now supports the following pixel formats for offscreen plain +surfaces. + +Pixel Format Flags Bit Depth Red Mask Green Mask Blue Mask Alpha Mask +DDPF_RGB | DDPF_PALETTEINDEXED1 1 0x00000000 0x00000000 0x00000000 0x00000000 +DDPF_RGB | DDPF_PALETTEINDEXED2 2 0x00000000 0x00000000 0x00000000 0x00000000 +DDPF_RGB | DDPF_PALETTEINDEXED4 4 0x00000000 0x00000000 0x00000000 0x00000000 +DDPF_RGB | DDPF_PALETTEINDEXED8 8 0x00000000 0x00000000 0x00000000 0x00000000 +DDPF_RGB 16 0x0000F800 0x000007E0 0x0000001F 0x00000000 +DDPF_RGB 16 0x00007C00 0x000003E0 0x0000001F 0x00000000 +DDPF_RGB 24 0x00FF0000 0x0000FF00 0x000000FF 0x00000000 +DDPF_RGB 24 0x000000FF 0x0000FF00 0x00FF0000 0x00000000 +DDPF_RGB 32 0x00FF0000 0x0000FF00 0x000000FF 0x00000000 +DDPF_RGB 32 0x000000FF 0x0000FF00 0x00FF0000 0x00000000 + +In addition to supporting a wider range of offscreen surface formats the +HEL also supports surfaces intended for use by Direct3D (or other 3D +renders). These surfaces are discussed in the next section. + +Support for 3D Surfaces +======================= + +Support for surfaces specific to 3D rendering has been enhanced in +DirectDraw 2.0. The 3D specific surface types; texture maps, mipmaps +and Z-buffers will be discussed below. + +Texture Maps +------------ +The surface capability flag used to indicate that a surface is a texture +is DDSCAPS_TEXTURE. This flag was previously DDSCAPS_TEXTUREMAP but was +modified for consistency with Direct3D. Texture maps can now be allocated +in system memory using the HEL. To allocate a texture map surface specify +the DDSCAPS_TEXTURE flag in the ddsCaps field of the surface description +passed to CreateSurface(). A wide range of texture pixel formats are +supported by the HEL. These formats are as follows: + +Pixel Format Flags Bit Depth Red Mask Green Mask Blue Mask Alpha Mask +DDPF_RGB | DDPF_PALETTEINDEXED1, 1 0x00000000 0x00000000 0x00000000 0x00000000 +DDPF_RGB | DDPF_PALETTEINDEXED1 | + DDPF_PALETTEINDEXEDTO8 1 0x00000000 0x00000000 0x00000000 0x00000000 +DDPF_RGB | DDPF_PALETTEINDEXED2 2 0x00000000 0x00000000 0x00000000 0x00000000 +DDPF_RGB | DDPF_PALETTEINDEXED2 | + DDPF_PALETTEINDEXEDTO8 2 0x00000000 0x00000000 0x00000000 0x00000000 +DDPF_RGB | DDPF_PALETTEINDEXED4 4 0x00000000 0x00000000 0x00000000 0x00000000 +DDPF_RGB | DDPF_PALETTEINDEXED4 | + DDPF_PALETTEINDEXEDTO8 4 0x00000000 0x00000000 0x00000000 0x00000000 +DDPF_RGB | DDPF_PALETTEINDEXED8 8 0x00000000 0x00000000 0x00000000 0x00000000 +DDPF_RGB, 8 0x000000E0 0x0000001C 0x00000003 0x00000000 +DDPF_RGB | DDPF_ALPHAPIXELS, 16 0x00000F00 0x000000F0 0x0000000F 0x0000F000 +DDPF_RGB, 16 0x0000F800 0x000007E0 0x0000001F 0x00000000 +DDPF_RGB, 16 0x0000001F 0x000007E0 0x0000F800 0x00000000 +DDPF_RGB, 16 0x00007C00 0x000003E0 0x0000001F 0x00000000 +DDPF_RGB | DDPF_ALPHAPIXELS, 16 0x00007C00 0x000003E0 0x0000001F 0x00008000 +DDPF_RGB, 24 0x00FF0000 0x0000FF00 0x000000FF 0x00000000 +DDPF_RGB, 24 0x000000FF 0x0000FF00 0x00FF0000 0x00000000 +DDPF_RGB, 32 0x00FF0000 0x0000FF00 0x000000FF 0x00000000 +DDPF_RGB, 32 0x000000FF 0x0000FF00 0x00FF0000 0x00000000 +DDPF_RGB | DDPF_ALPHAPIXELS, 32 0x00FF0000 0x0000FF00 0x000000FF 0xFF000000 +DDPF_RGB | DDPF_ALPHAPIXELS, 32 0x000000FF 0x0000FF00 0x00FF0000 0xFF000000 + +The above formats are those which can be created by the HEL in system +memory. The DirectDraw driver for a 3D accelerated video card is free to +create textures of other formats in video memory. Such a driver should +export the DDSCAPS_TEXTURE bit to indicate that it can create textures +and should be prepared to handle the DirectDraw HAL callback, +CanCreateSurface() to verify that the surface description for a texture +map is one the driver is prepared to create. + +Mipmaps +------- +DirectDraw 2.0 supports mipmapped texture surfaces. A mipmap is a +sequence of textures, each of which is a progressively lower resolution, +pre-filtered representation of the same image. Mipmaps are a +computationally low cost way of improving the quality of rendered textures. +Each pre-filtered image (or level) in the mipmap is a power of two +smaller than the previous level. In DirectDraw 2.0 mipmaps are represented +as a chain of attached surfaces. The highest resolution texture is at the +head of the chain and has, as an attachment, the next level of the mipmap +which has, in turn, an attachment which is the next level in the mipmap +and so on down to the lowest resolution level of the mipmap. + +To create a surface representing a single level of a mipmap specify the +DDSCAPS_MIPMAP surface capability in the surface description passed to +CreateSurface(). As all mipmaps are also textures the DDSCAPS_TEXTURE +capability must also be specified. It is possible to create each level +manually and build the chain with AddAttachedSurface(). However, +CreateSurface() can be used to build an entire mipmap chain in a single +operation. The following code fragment demonstrates building a chain +of five mipmap levels of sizes 256x256, 128x128, 64x64, 32x32 and 16x16. + + DDSURFACEDESC ddsd; + LPDIRECTDRAWSURFACE lpDDMipMap; + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_MIPMAPCOUNT; + ddsd.dwMipMapCount = 5; + ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP | + DDSCAPS_COMPLEX; + ddsd.dwWidth = 256UL; + ddsd.dwHeight = 256UL; + + ddres = lpDD->CreateSurface(&ddsd, &lpDDMipMap); + if (FAILED(ddres)) + ... + +It is permissible to omit the number of mipmaps levels, in which case +CreateSurface() will create a chain of surfaces each a power of two +smaller than the previous one down to the smallest possible size. It is +also possible to omit the width and height in which case CreateSurface() +will create the number of levels you specify with a minimum level size of +1x1. + +A chain of mipmap surfaces is traversed using GetAttachedSurface() +specifying the DDSCAPS_MIPMAP and DDSCAPS_TEXTURE capability flags. The +following code fragment traverses a mipmap chain from highest to lowest +resolutions. + + LPDIRECTDRAWSURFACE lpDDLevel, lpDDNextLevel; + DDSCAPS ddsCaps; + + lpDDLevel = lpDDMipMap; + lpDDLevel->AddRef(); + ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; + ddres = DD_OK; + while (ddres == DD_OK) + { + // Process this level + ... + ddres = lpDDLevel->GetAttachedSurface(&ddsCaps, + &lpDDNextLevel); + lpDDLevel->Release(); + lpDDLevel = lpDDNextLevel; + } + if ((ddres != DD_OK) && (ddres != DDERR_NOTFOUND)) + ... + +It is also possible to build flippable chains of mipmaps. In this +scenario each mipmap level has an associated chain of back buffer +texture surfaces. Each back buffer texture is attached to one level +of the mipmap. Only the front buffer in the chain has DDSCAPS_MIPMAP +set, the others are simply texture maps (DDSCAPS_TEXTURE). A mipmap +level can have two attached texture maps, one with the capability flag +DDSCAPS_MIPMAP set, which is the next level in the mipmap chain, and one +with the capability flag DDSCAPS_BACKBUFFER set, which is back buffer +of the flippable chain. Note that all the surfaces in each flippable +chain must be of the same size. + +It is not possible to build such a surface arrangement with a single +call to CreateSurface(). To construct a flippable mipmap either build +a complex mipmap chain and manually attach backbuffers with +AddAttachedSurface() or create a sequence of flippable chains and +build the mipmap with AddAttachedSurface(). + +It is important to note that blit operations apply to only a single +level in the mipmap chain. To blit an entire chain of mipmaps each +level must be blit separately. Also note that Flip()will not currently +flip an entire mipmap chain but only a single level of the mipmap. This +is a defect and will be corrected. + +Z Buffers +--------- +The DirectDraw HEL can now create Z buffers for use by Direct3D (or +other 3D rendering software). The HEL supports both 16 and 32-bit +Z buffers. The DirectDraw driver for a 3D accelerated video card can +permit the creation of Z buffers in video memory by exporting the surface +capability bit DDSCAPS_ZBUFFER. It should also specify the Z buffer +depths it supports using the dwZBufferBitDepth field of the DDCAPS +structure. + +Z buffers can be cleared using the DirectDraw surface function Blt(). +A new DDBLT_ flag (DDBLT_DEPTHFILL) has been defined to indicate that +the blit is a Z buffer clear. If this flag is specified the DDBLTFX +structure passed to Blt() should have its dwFillDepth field set to +the required Z depth. If the DirectDraw driver for a 3D accelerated +video card wishes to provide support for Z buffer clearing in hardware +it should export the capability flag DDCAPS_BLTDEPTHFILL and should +have code to handle DDBLT_DEPTHFILL blits. The destination surface +of a depth fill blit must be a Z buffer. Please note that the actual +interpretation of depth value is 3D renderer specific. + +Direct3D Integration +==================== + +DirectDraw 2.0 is very tightly integrated with Direct3D. The most +important aspects of this integration are discussed below. + +The Direct3D Driver Interface +----------------------------- +DirectDraw 2.0 presents a single, unified driver object to the +application programmer. This driver object encapsulates both +DirectDraw and Direct3D state. The DirectDraw driver COM interfaces +(IID_IDirectDraw or IID_IDirectDraw2) and the Direct3D driver COM interface +(IID_IDirect3D) are both interfaces which allow the application programmer +to communicate with the same underlying driver object. Hence no Direct3D +driver object is created. Rather a Direct3D interface to the DirectDraw +driver object is obtained. This is achieved using the standard COM +QueryInterface() function. + +The following code fragment demonstrates creating the DirectDraw driver +object and obtaining a Direct3D interface for communicating with that object. + + LPDIRECTDRAW lpDD; + LPDIRECT3D lpD3D; + ddres = DirectDrawCreate(NULL, &lpDD, NULL); + if (FAILED(ddres)) + ... + ddres = lpDD->QueryInterface(IID_IDirect3D, &lpD3D); + if (FAILED(ddres)) + ... + +The above code creates a single object and obtains two interfaces to +that object. Hence, the reference count of the driver object after the +QueryInterface() is two. The important implication of this is that the +lifetime of the Direct3D driver state is the same as that of the DirectDraw +object. Releasing the Direct3D interface does not destroy the Direct3D +driver state. That state is not destroyed until all references (both +DirectDraw and Direct3D) to that driver object have been released. +Hence, if you release a Direct3D interface, while holding a reference +to a DirectDraw driver interface, and then re-query the Direct3D +interface all the Direct3D state will be preserved. + +The Direct3D Device Interface +----------------------------- +As with the driver object, there is no distinct Direct3D device object. +A Direct3D device is simply an interface for communicating with a +DirectDraw surface used as a 3D rendering target. For example, the +following code fragment creates a Direct3D device interface to a +DirectDraw surface object. + + LPDIRECTDRAWSURFACE lpDDSurface; + LPDIRECT3DDEVICE lpD3DDevice; + + ddres = lpDD->CreateSurface(&ddsd, &lpDDSurface, NULL); + if (FAILED(ddres)) + ... + ddres = lpDDSurface->QueryInterface(lpGuid, &lpD3DDevice); + if (FAILED(ddres)) + ... + +The same rules of reference counting and state lifetime discussed for +driver objects apply to DirectDraw surfaces and Direct3D devices. +Additionally, multiple, distinct Direct3D device interfaces can be +obtained for the same DirectDraw surface. Hence, it is possible that +a single DirectDraw surface be the target for both a ramp based device +and an RGB based device. + +The Direct3D Texture Interface +------------------------------ +Direct3D textures are, once again, not a distinct object type but +rather another interface of DirectDraw surface objects. The following +code fragment obtains a Direct3D texture interface from a DirectDraw +surface object. + + LPDIRECTDRAWSURFACE lpDDSurface; + LPDIRECT3DTEXTURE lpD3DTexture; + + ddres = lpDD->CreateSurface(&ddsd, &lpDDSurface, NULL); + if (FAILED(ddres)) + ... + ddres = lpDDSurface->QueryInterface(IID_IDirect3DTexture, + &lpD3DTexture); + if (FAILED(ddres)) + ... + +The same reference counting and state lifetime rules of driver objects +and devices apply. It is possible to use a single DirectDraw surface as +both a rendering target and a texture. + +The DirectDraw HEL and Direct3D +------------------------------- +The DirectDraw HEL has been enhanced to support the creation of texture, +mipmap and Z buffer surfaces. Furthermore, due to the tight integration +of DirectDraw and Direct3D, a DirectDraw enabled system will always +provide Direct3D support (in software emulation at least). Hence, the +DirectDraw HEL exports the DDCAPS_3D capability flag to indicate the +availability of Direct3D in software emulation. A DirectDraw driver for +a hardware accelerated 3D video card should export this capability flag +to indicate the presence of hardware accelerated 3D. + +GetAvailableVidMem +================== +DirectDraw 2.0 adds a new DirectDraw interface function to query the +amount of video memory available to a specific type of surface as +defined by surface capability flags. To ensure COM compliance this +function is not a member of the DirectDraw 1.0 interface but is part +of the new DirectDraw 2.0 interface, IID_IDirectDraw2. To invoke this +function you must first query for the new DirectDraw interface. + +The following code fragment demonstrates using GetAvailableVidMem() +to determine both the total and free video memory available for +texture map surfaces. + + LPDIRECTDRAW2 lpDD2; + DDSCAPS ddsCaps; + DWORD dwTotal; + DWORD dwFree; + + ddres = lpDD->QueryInterface(IID_IDirectDraw2, &lpDD2); + if (FAILED(ddres)) + ... + ddsCaps.dwCaps = DDSCAPS_TEXTURE; + ddres = lpDD2->GetAvailableVidMem(&ddsCaps, &dwTotal, &dwFree); + if (FAILED(ddres)) + ... + +It should be noted that this function gives a snapshot of the current +video memory state only. The amount of free video memory is subject to +change as surfaces are created and released. Hence, the free memory +figure should be used as a rough guide only. In addition, a particular +video card may make no distinction between two different memory types. +For example, it may use the same portion of video memory to store Z +buffers and textures. Hence, allocating one type of surface (a Z buffer +say) may affect the amount of video memory available for another type +of surface (textures say). Therefore, it is best to first allocate an +application's fixed resources (such as front, back and Z buffer) before +determining how much memory is available for dynamic use (for texture +mapping, for example). + +Miscellaneous Changes +===================== + +New Error Return Codes +---------------------- +DDERR_NOMIPMAPHW - an attempt was made to create a mipmap in video +memory but the hardware DirectDraw driver does not support mipmaps. + +DDERR_INVALIDSURFACETYPE - an attempt was made to perform an operation +on a surface but the capabilities of that surface do not support the +operation. diff --git a/docs/readme/dinput.txt b/docs/readme/dinput.txt new file mode 100644 index 0000000..a60da7d --- /dev/null +++ b/docs/readme/dinput.txt @@ -0,0 +1,37 @@ +DirectInput 3.0 release notes + +What's new in DirectInput 3.0 +============================= +-COM interface that supports mouse and keyboard data. Examples are provided in Flip2D (mouse), Duel (keyboard) and scrawl. For detailed information on the new interface see DInput3e.doc. These new interfaces are not described in the DirectX help file. + +-Bug fixes to VJOYD.VXD and joy.cpl. A few key fixes are listed below: + +VJOYD polling is no longer interrupted by DMA access. This should fix the problem of the joystick behaving erratically when audio is being played. + +VJOYD now passes the data in the dwReserved2 field of the JOYINFOEX structure to the mini-driver on request. + +Devices without buttons can now be calibrated in joy.cpl. + +VJOYD.VXD now works correctly with global port drivers. + + +INITGUID vs. DXGUID.LIB +======================= + +You can generate the DirectInput GUIDs yourself by defining INITGUID. However, if you want to avoid generating all of the DirectInput GUIDs (including the ones you don't use), link to DXGUID.LIB instead of defining INITGUID. + + +Documentation for for DirectInput 3.0 +===================================== +The documentation for the COM interfaces to support mouse and keyboard devices are not in the DirectX help file. They are documented in the file dinput3e.doc which can be found in the \docs directory. The joystick APIs, however, are still documented in the DirectX help file. + + +DirectInput 3.0 for the Windows NT Operating System +=================================================== + +In the EXTRAS\dinput directory on the CD is a preliminary version of DirectInput 3.0 for the Windows NT Operating System. See the readme in that directory for more information. + +The implementation of DirectInput 3.0 for Windows NT has the following limitations: + +* The keyboard can be acquired only in non-exclusive foreground mode. +* The mouse can be acquired only in exclusive foreground mode. diff --git a/docs/readme/dplay.txt b/docs/readme/dplay.txt new file mode 100644 index 0000000..7979cc8 --- /dev/null +++ b/docs/readme/dplay.txt @@ -0,0 +1,149 @@ +DirectPlay Notes: + +1. What's New! +-------------- + +See the DirectPlay section in the DirectX help file for more details +on what's new. + +Highlights include: + + - IDirectPlayLobby - an interface that allows an external application + to launch a DirectPlay 3.0 application and provide it with all the + connection information needed to get connected to a session. + Try out the DPLAUNCH sample application for a demo of this! + + - Internet TCP/IP service provider - now you can have multiplayer + applications over the Internet + + - Unicode support + + - Host migration + + - Automatic player data propagation + + - Better performance, less overhead, more stability and robustness + + - Support for 3rd-party network service providers + +All the new functionality of DirectPlay is in the IDirectPlay2 +(Unicode) and IDirectPlay2A (ANSI) interfaces. When compiling, it is +recommended that you define the symbol IDIRECTPLAY2_OR_GREATER to make +sure that you are not using any obsolete flags or structures. The +IDirectPlay interface has not changed from previous versions of +DirectPlay. + + +2. Samples +---------- + The following samples can be examined for examples of how to use + DirectPlay + + SDK/SAMPLES/DUEL + - This simple multiplayer game uses the new IDirectPlay2 interface + - It also uses IDirectPlayLobby to make it lobby-able + + SDK/SAMPLES/DPLAUNCH + - This stand-alone application demonstrates how a DirectPlay 3 app + can be launched from an external source using the IDirectPlayLobby + interface + + SDK/SAMPLES/IKLOWNS + - Another multiplayer game which still uses the old IDirectPlay + interface + - It also use IDirectPlayLobby to make it lobby-able + +3. General Notes +---------------- + +-- The names of the DirectPlay 3 DLLs have changed. The names of the + new DLLs are: + + dplayx.dll - DirectPlay 3 dll + dpwsockx.dll - Winsock service provider (TCP/IP and IPX) + dpmodemx.dll - modem and serial service provider. + + Make sure that any applications in development link to DPLAYX.LIB. + + Applications compiled with DirectPlay 2 or earlier will not use these + new DLLs and therefore not benefit from the enhancements of DirectPlay 3. + + *** If you installed Beta1 of DirectX 3, the DirectPlay 3 DLLs will + have overwritten any DirectPlay 2 DLLs you may have had installed. + Beta2 will delete these DLLs if they have the version number of + DirectX 3 (4.04.xxxx) + + *** To restore them, simply reinstall DirectX 2 or any game that uses + DirectX 2. Alternatively, copy the files DPLAY.DLL, DPWSOCK.DLL and + DPSERIAL.DLL from your DirectX 2 CD to the windows SYSTEM directory. + +-- The synchronization event parameter in IDirectPlay2::CreatePlayer has + been changed to a HANDLE (from an LPHANDLE). The handle must be + created by the application. Passing in an LPHANDLE will NOT generate + a compiler error but it will cause the method to return an error. + +-- Make sure you read and understand the behavior of the DPSEND_GUARANTEED + flag in the Send() API. Additional text has been added to clarify the + usage of this flag. + +-- The Internet TCP/IP service provider now maintains a cache of open + sockets to improve the performance of guaranteed messages i.e. sockets + will not be opened and closed for each individual message. Calling + GetCaps() and asking for the guaranteed capabilities will tell you + how many players can be supported (dwMaxPlayers). + +-- If an application tries to send messages that are larger than the + maximum packet size of a protocol, DirectPlay will break it up + and send it using multiple packets and reassembling the packets on + the receiving end into a single message. + +-- Added ability to host more than one game on a single machine (TCP/IP only) + +-- The DirectPlay Address structure now uses GUIDs to identify chunks + in the address instead of four character codes. + +-- Applications with short timeouts will not work over the Internet + due to the long latencies. Applications should specify a timeout value + of zero in EnumSessions in which case an appropriate timeout will + be calculated by the service provider. + +-- DirectPlayConnect is obsolete. An application will need to create an + IDirectPlayLobby interface. It may query the connection settings that + the lobby passed in using GetConnectionSettings, and modify them using + SetConnectionSettings. It highly recommended that the application + verify that the correct session description flags are set using this + method. Finally, the application should call the Connect method and + then Release the IDirectPlayLobby interface. + +-- There is now an ANSI and a UNICODE version of the DirectPlayLobbyCreate + API. The version is selected based on the UNICODE compile-time flag. + +-- To use TCP/IP over the Internet, the users joining the session must + enter the IP address of the machine that hosted the game when prompted + by the service provider. + + You can find out the IP address of your machine by running "winipcfg". + If you have a net card and a modem installed, you will need to make + sure you read the IP address of the modem connection to the Internet. + The IP address information for the modem will typically show up under + "PPP Adapter". + +4. Known Problems +----------------- + +-- Inside of any DirectPlay enumeration callback only the thread running + the callback can make calls back into the DirectPlay API. Other threads + and the service provider will be blocked from calling DirectPlay until + the enumeration has completed, so it is important to have enumeration + callbacks complete quickly. + +-- IPX will not allow playing more than one game simultaneously. Use + TCP/IP to do that. + +-- There is no multi-home support for IPX. Use TCP/IP if multi-homing + is needed. + +-- If an application sets the player name or remote data for a non-local + player, the change will not be propagated to the remote applications. + +-- DirectPlay generally will not work through proxies and firewalls. diff --git a/docs/readme/dsound.txt b/docs/readme/dsound.txt new file mode 100644 index 0000000..6cf9722 --- /dev/null +++ b/docs/readme/dsound.txt @@ -0,0 +1,75 @@ +DirectSound 3 Readme File + + +1. New Features in DirectSound 3 +================================ + +- DirectSound3D is finally available! This implementation includes + the ability to position and move sounds in 3D space, complete with Doppler + shifting, attenation due to distance, and a sound cone feature which + allows you to create sounds which are louder when pointing straight at + you than when they are pointing away. DirectSound3D has a flexible + coordinate system which allows you to use your internal game coordinates + and still get the effects you want. To learn more, check out the help + files, or look at the following samples: + + \dxsdk\sdk\samples\ds3dview + \dxsdk\sdk\samples\dsshow3d + \dxsdk\rockem + +- Global Sounds. Many developers wanted to make sounds even when their + application is not the foreground application. Now you can! Just create + your sound sound buffer with the DSBCAPS_GLOBALFOCUS flag specified and + the sound buffer will be audible regardless of sound focus. However, + please note the following caveats: + + a) Global sounds will not be audible if the sound focus application + has the DSSCL_EXCLUSIVE level set. That application has requested + that it not be interrupted, so we respect that request. + + b) You can't create a global sound on a DirectSound object that has + DSSCL_WRITEPRIMARY. + + +2. New Sound Driver Support +=========================== + +This release contains support for the ESS 1788 card and new versions of +the ESS 1688 and SoundBlaster AWE 32 cards, in addition to the drivers +supported in DirectX 1 and 2. This brings our total sound card coverage +to the following: + +- Sound Blaster: 8-bit cards, 16-bit cards, and the AWE32. +- ESS: 488, 688, 1488, 1688, 1788. +- MediaVision: PAS 16, PAS Studio, PAS Plus, Pro 3D, and Blue Lite Special. +- Aztech: Nova 16, Washington 16, Rocky 2. +- Microsoft: Windows Sound System. + +Sound cards which do not have DirectSound drivers can still be accessed +through DirectSound. If no driver is available, DirectSound will use its +emulation layer to communicate with the device through the standard Wave +driver interface. This provides full DirectSound functionality, but +increases latency significantly and prevents access to hardware +acceleration. + +We have also encountered faults in certain situations on the Roland +Rap 10 and the Gravis UltraSound MAX. + + +3. Known Problems with this release +=================================== + +- DirectSound3D consumes more CPU than ordinary mixing. Our measurements + indicate that it consumes about 6% of a P90 per sound. If you ask + DirectSound to play more 3D sounds than the processor is capable of, we + will do our best to satisfy your demand. In practice, this will mean + that the CPU will be overloaded and will be unable to spend any cycles + on ordinary things like updating your display or reading your keyboard. + So be sure to test your application to make sure that it runs on your + low-end target platform. + + +Thanks! +The DirectSound Team. + + diff --git a/docs/web/begindoc.htm b/docs/web/begindoc.htm new file mode 100644 index 0000000..5f9a75c --- /dev/null +++ b/docs/web/begindoc.htm @@ -0,0 +1,41 @@ +<html> + +<head> +<title>Writing 3D Applications</title> +</head> + +<body bgcolor=#000000 text=#FFFFFF link=#FF0000 vlink=#FFFF00> +<basefont face="Times New Roman" size=3> + +<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0> + + +<BLOCKQUOTE> +<FONT FACE="arial" SIZE="2"> +<!--DocHeaderEnd--> +<!-- This is a PANDA Generated HTML file. The source is a WinWord Document. --> +<h2>Writing Direct3D Apps for Hardware Accelerators: The BeginScene()/EndScene() API Calls</h2> +<P>The DirectX Team +<P>August 2, 1996 +<P><h4>Introduction</H4> +<P>Proper use of Direct3D's <b>BeginScene()</b> and <b>EndScene()</b> is essential to making your application work properly with hardware 3-D accelerators. This article describes the operation of <b>BeginScene()</b> and <b>EndScene()</b> and gives guidelines for their use. Failure to follow these guidelines may cause your application to render incorrectly on a broad class of forthcoming 3-D hardware. +<P><h4>Definition</H4> +<P>A <i>scene</i> in the Direct3D immediate mode is a collection of all the vertices and drawing primitives (triangles, lines, and points) used to draw a single frame. <b>BeginScene()</b> marks the beginning of a scene (and hence the start of a frame) and <b>EndScene()</b> marks the end of a scene (and hence the end of the frame). +<P>In keeping with this definition, it is essential that all the execute buffer executions used to draw a single frame be bracketed by a single <b>BeginScene()</b>/<b>EndScene()</b> pair. +<P><h4>Justification</H4> +<P>Correct use of <b>BeginScene()</b> and <b>EndScene()</b> is important to support a class of emerging 3-D hardware accelerators which do not use a conventional z-buffer to perform hidden surface removal. Such accelerators may implement a number of mechanisms for performing hidden surface removal (such as internal tiling and polygon sorting). However, to perform hidden surface removal, they all must process a copy of the entire geometric database for a single frame. +<P>To accomplish this task, such accelerators must perform <i>Scene Capture</i>. In other words, they must store, for later processing, the geometric information passed to them via execute buffers.To ensure the hidden surface processing is correct, a single <b>BeginScene()</b> and <b>EndScene()</b> must bracket <b>all</b> the drawing instructions comprising a single frame. If multiple <b>BeginScene()</b> and <b>EndScene()</b> calls are made while composing a single frame, the accelerator will be unable to correctly resolve hidden surface interactions between triangles executed in different scene contexts. +<P>Furthermore, an application should not assume that multiple <b>BeginScene()</b>/<b>EndScene()</b> calls per frame are permissible simply because it knows there are no hidden surface interactions between the triangles in different scene contexts. Certain accelerators use scene capture to perform high-quality rendering effects in addition to hidden surface removal. For example, a scene-capturing accelerator may be able to render shadows and semitransparent objects. These effects rely on the entire geometric database for a frame being available to the accelerator for processing. Multiple <b>BeginScene()</b> and <b>EndScene()</b> contexts will break such effects. +<P><h4>2-D and 3-D Interaction</H4> +<P>Accelerators that perform scene capture probably will be unable to interleave 2-D drawing operations such as blits and direct writes with 3-D drawing operations in a scene context. Accelerators that have this restriction export the DirectDraw capability bit DDCAPS2_NO2DDURING3DSCENE. Therefore, an application should check this capability bit and, if it is present, not perform <b>DirectDraw Blt()</b>, <b>GetDC()</b>, or <b>Lock()</b> calls on the rendering surface between calls to <b>BeginScene()</b> and <b>EndScene()</b>. +<P><h4>What to Do</H4> +<P>To make sure that your application correctly renders on all 3-D accelerators (including those that perform scene capture), do the following: +<P>1. Ensure that all the execution of execute buffers that hold triangles (and other rendering primitives instructions) for a single frame are preceded by a single call to <b>BeginScene()</b> and followed by a single call to <b>EndScene()</b>. +<P>2. Check the DirectDraw caps bit DDCAPS2_NO2DDURING3DSCENE. If it is set, do not call DirectDraw's <b>Blt()</b>, <b>GetDC()</b> or <b>Lock()</b> functions on the rendering surface between a call to <b>BeginScene()</b> and <b>EndScene()</b>. Such 2-D operations can be performed after <b>EndScene()</b> has been invoked. +<P>3. Ensure that your application does not assume that any rendering primitives included in an execute buffer have been rendered to the target surface when <b>Execute()</b> returns. Scene capture cards will postpone rendering until the scene is complete (<b>EndScene()</b> has been called). +<P> + + +</body> + +</html> diff --git a/docs/web/contents.gif b/docs/web/contents.gif new file mode 100644 index 0000000..e864cbd Binary files /dev/null and b/docs/web/contents.gif differ diff --git a/docs/web/d3dcd.htm b/docs/web/d3dcd.htm new file mode 100644 index 0000000..3903038 --- /dev/null +++ b/docs/web/d3dcd.htm @@ -0,0 +1,88 @@ +<html> + +<head> +<title>Direct3D</title> +</head> + +<body bgcolor="#000000" text="#FFFFFF" link="#FFFF00" vlink="#FF0000"> + +<center><i><h1><font size 8>Direct3D</font></h1></i></center> +<br><br> + +<table width=100% cellspacing="10"> +<tr> + + <td> <h3>Articles of Interest</h3> </td> + + </tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<tr> + + <td> <a href="begindoc.htm"><i>Tips for Writing Direct3D Applications </i></a></td> + + <td> Writing Direct3D Apps for Hardware Accelerators: The BeginScene() / EndScene() API Calls</td> +</tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + <td> <a href="d3dramp.htm"><i>Running fast with the D3D Ramp driver </i></a></td> + + <td> There are a number of ways to get maximum performance from the ramp driver. + This document details the two most useful texturing modes, Copy Mode and Shaded + Ramp Mode. This document covers rasterization performance tips for these modes. + When used correctly, the ramp driver should be able to run faster than some hardware + alternatives.</td> + +</tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<br> +<td> <h3>CD Links</h3> </td> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + + <td> <a href="../readme/conv3ds.txt"><i>Conv3DS Readme File</i></a></td> + + <td>Conv3ds converts 3Ds models produced by Autodesk 3D Studio and other + modelling packages into X Files. By default it produces binary X files + with no templates.</td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + + <td> <a href="../readme/d3d.txt"><i>Direct 3D Readme File</i></a></td> + + <td>Includes notes on the software emulation drivers, RAMP driver support and performance + notes, RGB driver, Functionality, Performance, and Known Issues </td> + + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<br> +<br> +<td> <h3>Samples of Direct3D</h3> </td> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<tr><td><a href="../../sdk/bin/flipcube.exe "><i>FlipCube</i></a></td><tr> +<tr><td> <a href="../../sdk/bin/globe.exe "><i>Globe</i></a></td></tr> +<tr><td> <a href="../../sdk/bin/twist.exe "><i>Twist</i></a></td></tr> +<tr><td> <a href="../../sdk/bin/tunnel.exe "><i>Tunnel</i></a></td></tr> +<tr><td> <a href="../../sdk/bin/viewer.exe "><i>Viewer</i></a></td></tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + + +</table> + + + + +<br><br> + + + + +<align=bottom border=0 width=144 height=131> + +<IMG SRC="screen2.jpg"> +<IMG SRC="screen3.jpg"> +<IMG SRC="screen4.jpg"> + + +<a href="http://www.microsoft.com/windows/anniversary/favor.htm">Download a Direct3D Screen Saver + +</body> + +</html> diff --git a/docs/web/d3dramp.htm b/docs/web/d3dramp.htm new file mode 100644 index 0000000..fb619ae --- /dev/null +++ b/docs/web/d3dramp.htm @@ -0,0 +1,48 @@ +<html> + +<head> +<title>Running fast with the D3D Ramp Driver</title> +</head> + +<body bgcolor=#000000 text=#FFFFFF link=#FF0000 vlink=#FFFF00> +<basefont face="Times New Roman" size=3> + +<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0> + + +<BLOCKQUOTE> +<FONT FACE="arial" SIZE="2"> +<!--DocHeaderEnd--> +<!-- This is a PANDA Generated HTML file. The source is a WinWord Document. --> +<h2>Running fast with the D3D Ramp Driver</h2> +<P>The DirectX Team +<P>September 5, 1996 +<P><h4>Introduction</H4> +<P>There are a number of ways to get maximum performance from the ramp driver. This document details the two most useful texturing modes,<i> Copy Mode and Shaded Ramp Mode</i>. This document covers rasterization performance tips for these modes. When used correctly, the ramp driver should be able to run faster than some hardware alternatives. +<P><h4>Copy Mode</H4> +<P>Copy Mode is the simplest form of rasterization and hence the fastest. When copy mode rasterization is used, no lighting or shading is performed on the texture. The bytes from the texture is copied directly to the screen and mapped onto the polygon using the texture co-ordinates in the vertex. Hence, when using copy mode, the texture format must match the format of the screen. For this reason copy mode is only really useful in 8 bit colour as in 16 bit colour the texture size is doubled, this makes copy mode slower than other rendering modes in 16 bit colour. +<P>Copymode only implements two rasterization options, Z buffering and chroma key transparency. The fastest mode is to just map with no transparency and no Z. Enabling chroma key accelerates the rasterization of invisible pixels as just the texture read is performed, but visible pixels will incur a slight performance hit due to the chroma test. +<P>Enabling Zbuffering incurs the biggest hit for 8 bit copy mode as now a 16 bit value has to be read and conditionally written per pixel. Z buffering copymode can only be faster than non Z copy mode when the average overdraw goes over 2, and the scene is rendered in front to back polygon order. +<P>If your scene has overdraw less than 2 (which is very likely) you should ignore using the Z buffer. The only exception to this rule is if the scene complexity is very high. For example, if you have more than about 1500 rendered polys in the scene the sort overhead begins to get high and it may be worth considering a Z buffer again. +<P>Direct3D will go fastest when all it needs to do is draw one long triangle instruction. Render state changes just get in the way of this, the longer the average triangle instruction the better triangle throughput. Hence peak sorting performance can be achieved when all the texture for a given scene is contained in only one texture map or texture page. This adds the restriction that no texture co-ordinate can be larger than 1.0 but has the performance benefit of no texture state changes at all! +<P>So for normal simple scenes use one texture, one material and sort your triangles, only use Z when the scene gets complex. + +<P><h4>A Few Further Tips On Sorting</H4> +<P>If you are sorting, you need to implement your own transform and clipping as Direct3D only accepts unclipped TLVertices (until DX4). In this scenario you will almost certainly be building execute buffers on the fly. One of the simplest ways of doing this is to put all the instructions in the front of the buffer and all the vertices at the end. Say your whole buffer is big enough to contain 1024 vertices, the first triangle generated would be placed at the front of the buffer indexing vertex 1022,1023 and 1024 at the end of the buffer. This scheme means that no buffer space is wasted and there is no dependency on maximum buffer size, as when the instructions growing from the bottom up meet the vertices growing from the top down the buffer is dispatched and a new one started. + +<P><h4>Introducing Lighting</H4> +<P>When lighting is used we will almost certainly want to Gouraud shade. Ramp mode Gouraud shading is about 15-20% faster in 8 bit than in 16 bit colour due the decreased memory bandwidth. When lighting, we are using more CPU for rasterization than copy mode, it is not so crucial (but still advisable) to avoid state changes. If you have a few large background polygons in the scene you should try and flat shade them as this is 20-30% faster than gouraud for large polygons. +<P>We now need to worry about materials, in a textured scene you should only need two materials and may even be able to get away with one. Materials allow modulation of the texture colour, this operation should be left to RGB drivers (mainly MMX and HW) in ramp it is best just to stick with intensity modulation.ff +The Ramp driver is named after its use of ramps (colour lookup tables) A d3d material contains a set of colour values and a texture handle. For each colour in the textures palette the ramp driver builds a lookup table of intensities (ramp). The size of the ramps are determined by the shades field in the d3d material. So a texture with a palette of 32 colours in a material with shades set to 16 will generate 32 16 entry ramps. The more ramps there are in a scene the slower the performance due to the worse use of the CPU cache. It is best to use one material setting for all textures and the same palette of 64 or preferably less colours for all textures in the scene. If two textures use the same material any colours that are the same between the two texture palettes will share the same ramp. +<P>As for copy mode Z buffering does incur a performance hit for low overdraw scenes and the same technique of tiling as many textures as possible in to larger texture pages is still beneficial, all the copy mode sorting tips still apply when using shading. + +<P><h4>System or Video Memory</H4> +<P>Where should the back buffer go? This can have a large affect on performance but can vary wildly depending on the application and the HW configuration. On faster CPU's, both the above rendering modes will tend to render faster to system memory than video memory as they are helped by the CPU cache. This performance boost is offset by the fact the app can no longer use page flipping and instead must blit from the system memory back buffer to a video memory back buffer. The cost of this blit will often be the decider in the performance. This is especially true of the MMX driver which renders MUCH faster to system memory than video. The only way to really know which is to run and time the app for a few frames in each configuration. All the D3D samples have a system memory option to enable this. + + + + + +</body> + +</html> diff --git a/docs/web/dbugcd.htm b/docs/web/dbugcd.htm new file mode 100644 index 0000000..5bd789a --- /dev/null +++ b/docs/web/dbugcd.htm @@ -0,0 +1,45 @@ +<html> + +<head> +<title>DirectX Bugs</title> +</head> + +<body bgcolor=#000000 text=#FFFFFF link=#FFFF00 vlink=#FF0000> +<basefont face="Times New Roman" size=3> + +<center><i><h1><font size 8>DirectX Bug Reporting</font></h1></i></center> + + + + +<table> +<table width=100% cellspacing="8"> +<tr> + <td> <img height=35 width=40 src="word.bmp" alt="Word"> </td> + <td> <a href="dxbugs.doc"><i>DirectX Bug Reporting Template</i></a></td> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + +<P>Name: +<P>Email Name: +<P>Phone Number: +<P>Company: + +<P>DirectX Area +(DirectPlay, DirectSound, Direct3D, DirectDraw, DirectInput): + +<P>What Build: + +<P>Your System Configuration: + +<P>Problem in Detail: + +<P>Steps to Reproduce: + + +</table><br><br> +<a href="mailto:dxbugs@microsoft.com">Send Mail to: DirectX Bug Reporting Mail Alias</a> + + +</body> + +</html> diff --git a/docs/web/ddrwcd.htm b/docs/web/ddrwcd.htm new file mode 100644 index 0000000..e194489 --- /dev/null +++ b/docs/web/ddrwcd.htm @@ -0,0 +1,59 @@ +<html> + +<head> +<title>DirectDraw</title> +</head> + +<body bgcolor=#000000 text=#FFFFFF link=#FFFF00 vlink=#FF0000> +<basefont face="Times New Roman" size=3> + + +<font size=8 ><i><center><h1>DirectDraw</h1></center></i></font> + +<table width=100% cellspacing="10"> +<tr> + + <td> <h3>Articles of Interest</h3> </td> + + </tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<tr> + + <td> <a href="http://www.microsoft.com/GAMESDEV/GGRAPHIC/gklopf.htm"><i>DirectDraw Articles </i></a></td> + + <td>Basics of DirectDraw Game Programming </td> +</tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<br> +<td> <h3>CD Links</h3> </td> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + + <td> <a href="../readme/ddraw.txt"><i>DirectDraw Readme File</i></a></td> + + <td>Some of the many topics covered are; SetDisplayMode now supports setting the + monitor refresh rate, Direct Draw modes now respect monitor settings + IDirectDrawSurface2::DDGetInterface now supported, Direct Draw clipper + objects now have a COM class factory. </td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + +<br> +<td> <h3>DirectDraw Samples</h3> </td> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + + <td> <a href="../../sdk/bin/donuts.exe"><i>Space Donuts</i></a></td> + + <td>Space Donuts Game Sample</td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + +<td> <a href="../../iklowns/iklowns.exe"><i>IKlowns</i></a></td> + + <td>IKlowns Game Sample</td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +</table> + +</body> + +</html> diff --git a/docs/web/dinpcd.htm b/docs/web/dinpcd.htm new file mode 100644 index 0000000..fab28a3 --- /dev/null +++ b/docs/web/dinpcd.htm @@ -0,0 +1,62 @@ +<html> + +<head> +<title>DirectInput</title> +</head> + +<body bgcolor=#000000 text=#FFFFFF link=#FFFF00 vlink=#FF0000> +<basefont face="Times New Roman" size=3> + + +<font size=8 ><i><center><h1>DirectInput</h1></center></i></font> + +<table width=100% cellspacing="10"> +<tr> + + <td> <h3>Articles of Interest</h3> </td> + + </tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<tr> + + <td> <a href="http://www.microsoft.com/gamesDEV/gNETWORK/gjoystic.HTM"><i>Extending DirectInput's Joystick Subsystem Services</i></a></td> + + <td> DirectInput�, the joystick driver subsystem for Windows� 95, is the much-needed new standard for game developers working with input devices such as joysticks and game pads. The new digital joystick devices, such Microsoft� SideWinder� 3D Pro, support multiple devices on a single port and provide discrete button and position information. DirectInput provides support for multiple joysticks, and it supports the latest in gaming-device technology, without the developer having to know the intricacies of the device. </td> +</tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<br> +<br> +<td> <h3>CD Links</h3> </td> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<td> <a href="..\readme\dinput.txt"><i>DirectInput Readme File</i></a></td> +<td>Introduction to what's new with DirectInput</td> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<br> +<br> +<td> <h3>DirectInput Samples</h3> </td> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<tr> + <td> <a href="../../sdk/bin/duel.exe"><i>Duel</i></a></td> + + <td> <img src="playduel.gif"HEIGHT=64 WIDTH=176 ALT="Play Duel" BORDER=0 VSPACE=5>DirectInput Gaming Sample - Duel </A></td> +</tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<tr> + + <td> <a href="../../sdk/bin/scrawl.exe"><i>Scrawl</i></a></td> + <td>DirectInput's Scrawl</td> +</tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<tr> + + <td> <a href="../../sdk/bin/flip2d.exe"><i>FlipCube 2D</i></a></td> + <td>FlipCube 2D Sample</td> +</tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + + + +</table> +</body> + +</html> diff --git a/docs/web/directx.htm b/docs/web/directx.htm new file mode 100644 index 0000000..4d6f601 --- /dev/null +++ b/docs/web/directx.htm @@ -0,0 +1,27 @@ +<html> +<head> +<title>DirectX</title> + +</head> + +<body bgcolor="#000000" text="#FFFFFF" link="#FFFF00" vlink="#FF0000"> + +<p align=center><font size=3><img src="hammer.jpg" align=bottom width=400 height=400></font></p> +<div align=center><center> +<table cellpadding=10 cellspacing=8 width=100 height=15 align="center"> +<font size=3> +<tr> +<td><a href="d3dcd.htm">Direct3D</td> +<td><a href="ddrwcd.htm">DirectDraw</td> +<td><a href="dinpcd.htm">DirectInput</td> +<td><a href="dplycd.htm">DirectPlay</td> +<tr><td><a href="dsndcd.htm">DirectSound</td> +<td><a href="dbugcd.htm">Bug Reports</td> +<td><a href="hot.htm">Hot Links</td> +<td><a href="dxbook.htm">Documentation and Help</td></tr> +</font> +</table> +</center></div> +</body> + +</html> diff --git a/docs/web/dplaydoc.htm b/docs/web/dplaydoc.htm new file mode 100644 index 0000000..15ca39e --- /dev/null +++ b/docs/web/dplaydoc.htm @@ -0,0 +1,92 @@ +<html> + +<FONT FACE="arial" SIZE="2"> +<head> +<title>DirectPlay Document</title> + + +<TR><TD COLSPAN=2 VALIGN=Bottom HEIGHT=25 WIDTH=640> + +<P> +<H2>About DirectPlay</H2> +<P>The DirectX Team +<P>September 5, 1996 +<P> +<P><i><h3>Introduction</h3></i> +<P> +The Microsoft® DirectPlay™ application programming interface +(API) for Windows® 95 is a software interface that simplifies +application access to communication services. DirectPlay has +become a technology family that provides a way for applications +to communicate with each other that is independent of the underlying +transport, protocol, or online service. Instead of forcing the +developer to deal with the differences that each of these connectivity +solutions represents, DirectPlay provides well defined, generalized +communication capabilities. DirectPlay shields the developer +from the underlying complexities of diverse connectivity implementations, +freeing them to concentrate on producing a great application. +<P> +<I><H3>DirectPlay Architecture</h3></I> +<P> +The DirectPlay architecture is composed of two types of components: +DirectPlay itself and the <I>Service Provider</I>. DirectPlay +is provided by Microsoft and presents a common interface to the +application. The service providers furnish medium-specific communications +services as requested by DirectPlay. Anyone, including online +services, can supply service providers for specialized hardware +and communications media. Microsoft supplies service providers +for direct modem-to-modem (TAPI) connections, COM port serial +connections, Internet TCP/IP, and IPX protocols with DirectPlay. +<P> +The DirectPlay interface hides the complexities and unique tasks +required to establish an arbitrary communications link inside +the DirectPlay service provider implementation. A application +using DirectPlay need only concern itself with the performance +of the communications medium (e.g. bandwidth and latency), not +whether that medium is being provided by a modem, network, or +online service. +<P> +DirectPlay supports a peer-to-peer communication model; that is, +every participant in the communications session can communicate +directly with anyone else and it is expected that each participant +is maintaining information on the complete state of the session. + There is one participant called the <I>session host</I> which +controls new participants joining the session and assigning player +and group ID numbers. +<P> +DirectPlay features: +<UL> +<LI><B>Network independence</B> - the only thing necessary to +run the application on another network is to write a service provider +for it. No need to change the application at all! +<LI><B>Service provider model</B> - this allows DirectPlay to +take advantage of network capabilities like multicasting to optimize +operations like sending messages to all participants. +<LI><B>Simple send/receive</B> model for exchanging messages between +players. +<LI><B>Player and group management functions</B> - automatic messages +generated when new players are created, destroyed, added/deleted +from groups, etc.; function to help manage application specific +data associated with the player/group. +<LI><B>Naming of players and groups</B>. +<LI><B>Remote shared data</B> - changes in remote data are propagated +to all the other machines automatically. +<LI><B>Unicode </B>and<B> ANSI </B>support. +<LI><B>Keep alive</B> - DirectPlay will monitor when players lose +their connection. +<LI><B>Lobby functions</B> - a matchmaking service can bring together +players and automatically start the application on all the participant's +machines and connect them to each other in a communications channel. +Once the game is in progress the lobby software and the application +can exchange information while the session is in progress. +</UL> +</head> + +<body bgcolor=#000000 text=#FFFFFF link=#FFFF00 vlink=#FF0000> +<basefont face="Times New Roman" size=3> + + + +</body> + +</html> diff --git a/docs/web/dplycd.htm b/docs/web/dplycd.htm new file mode 100644 index 0000000..7ad3199 --- /dev/null +++ b/docs/web/dplycd.htm @@ -0,0 +1,74 @@ +<html> + +<head> +<title>DirectPlay</title> +</head> + +<body bgcolor=#000000 text=#FFFFFF link=#FFFF00 vlink=#FF0000> +<basefont face="Times New Roman" size=3> + + +<font size=8 ><i><center><h1>DirectPlay</h1></center></i></font> + +<table width=100% cellspacing="10"> +<tr> + + <td> <h3>Articles of Interest</h3> </td> + + </tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<tr> + + <td> <a href="dplaydoc.htm"><i>About DirectPlay</i></a></td> + + <td> The Microsoft� DirectPlay� application programming interface (API) for Windows� 95 is a software interface that simplifies application access to communication services. </td> +</tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<td> <h3>CD Links</h3> </td> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<td> <a href="../readme/dplay.txt"><i>DirectPlay Readme File</i></a></td> + + <td>What's New with DirectPlay? Highlights include, IDirectPlayLobby + Internet TCP/IP service provider, Unicode support, Host migration + Automatic player data propagation, Better performance, less overhead, + more stability and robustness and Support for 3rd-party network + service providers + + + </td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<br> +<tr> + + <td> <h3>DirectPlay Samples</h3> </td> + + </tr> +<tr> +<td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<tr> + + <td> <a href="../../sdk/bin/duel.exe"><i>Duel</i></a></td> + + <td> <img src="playduel.gif"HEIGHT=64 WIDTH=176 ALT="Play Duel" BORDER=0 VSPACE=5>DirectPlay Gaming Sample - Duel </A></td> +</tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + +<tr> + + <td> <a href="../../iklowns/iklowns.exe"><i>IKlowns</i></a></td> + + <td> <img src="play_ik.gif"HEIGHT=64 WIDTH=176 ALT=" +" BORDER=0 VSPACE=5>DirectPlay Gaming Sample - IKlowns </A></td> +</tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + + + + + + +</table> +</body> + +</html> diff --git a/docs/web/dsndcd.htm b/docs/web/dsndcd.htm new file mode 100644 index 0000000..8b005d8 --- /dev/null +++ b/docs/web/dsndcd.htm @@ -0,0 +1,81 @@ +<html> + +<head> +<title>DirectSound</title> +</head> + +<body bgcolor=#000000 text=#FFFFFF link=#FFFF00 vlink=#FF0000> +<basefont face="Times New Roman" size=3> + +<font size=8 ><i><center><h1>DirectSound</h1></center></i></font> + +<table width=100% cellspacing="10"> +<tr> + + <td> <h3>Articles of Interest</h3> </td> + + </tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<tr> + + <td> <a href="http://www.microsoft.com/mediadev/audio/optaudi1.htm"><i>Optimizing Audio Performance with DirectX</i></a></td> + + <td>The audio components of Microsoft� DirectX�--DirectSound� and DirectSound3D�--include powerful tools for games and interactive-media programmers. DirectX takes advantage of sound-accelerator hardware whenever possible to improve performance and minimize CPU usage, but audio can still have a significant impact on system performance. This article describes techniques that will help you use DirectSound and DirectSound3D to minimize the performance impact of audio playback. </td> +</tr> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<br><br> +<td> <h3>CD Links</h3> </td> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<td> <a href="../readme/dsound.txt"><i>DirectSound Readme File</i></a></td> + + <td>DirectSound3D is Now Available! Read about global sounds, + and new driver support!</td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<br><br> +<td> <h3>DirectSound Samples</h3> </td> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<tr> + + <td> <a href="../../sdk/bin/duel.exe"><i>Duel</i></a></td> + + <td> <img src="playduel.gif"HEIGHT=64 WIDTH=176 ALT="Play Duel" BORDER=0 VSPACE=5>Duel, featuring DirectSound3D </A></td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + + <td> <a href="../../sdk/bin/dsshow.exe"><i>DSShow</i></a></td> + + <td>DirectSound Sample </td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + + <td> <a href="../../sdk/bin/dsshow3d.exe"><i>DSShow3D</i></a></td> + + <td>DirectSound3D Sample </td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + + <td> <a href="../../sdk/bin/dsstream.exe"><i>DSStream</i></a></td> + + <td>DirectSound Streaming Sample </td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + + <td> <a href="../../sdk/bin/ds3dview.exe"><i>DirectSound3D Viewer</i></a></td> + + <td>DirectSound3D Viewer Sample </td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + + + <td> <a href="../../sdk/bin/donuts.exe"><i>Donuts</i></a></td> + + <td>Donuts Game Sample</td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + + +</table> +</body> + +</html> diff --git a/docs/web/dx3d.gif b/docs/web/dx3d.gif new file mode 100644 index 0000000..cef0cae Binary files /dev/null and b/docs/web/dx3d.gif differ diff --git a/docs/web/dxbook.htm b/docs/web/dxbook.htm new file mode 100644 index 0000000..2bd3a2b --- /dev/null +++ b/docs/web/dxbook.htm @@ -0,0 +1,115 @@ +<html> + +<head> +<title>DirectX Help</title> +</head> + +<body bgcolor=#000000 text=#FFFFFF link=#FFFF00 vlink=#FF0000> +<basefont face="Times New Roman" size=3> +<center><i><h1><font size 8>DirectX Documentation</font></h1></i></center> + +<table width=100% cellspacing="25"> +<td> <h3>The DirectX documentation in these directories contain the same information +as the WinHelp documentation in the <A HREF="../winhelp/directx.hlp">Help</A> directory of this SDK</h3> </td> +<br> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +<td> <a href="../worddoc/dxintro.doc"><i>Chapter 1</i></a></td> + + <td>Introducing DirectX 3: The Microsoft� DirectX� Software Development Kit (SDK) + provides a finely tuned set of application programming interfaces (APIs) that give + you the resources you need to design high-performance, real-time applications. The + next generation of computer games and multimedia applications will be built using + DirectX technology. </td> +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + +<td> <a href="../worddoc/ddraw.doc"><i>Chapter 2</i></a></td> + + <td>About DirectDraw: DirectDraw� is a DirectX� 3 SDK component that allows direct + manipulation of display memory, hardware blitters, hardware overlays, and flipping. + DirectDraw provides this functionality while maintaining compatibility with existing + Microsoft� Windows� applications and device drivers. </td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + +<td> <a href="../worddoc/dsound.doc"><i>Chapter 3</i></a></td> + + <td>About DirectSound: The Microsoft� DirectSound� application programming + interface (API) is the audio component of the DirectX� 3 Software Development + Kit (SDK) that provides low-latency mixing, hardware acceleration, and direct + access to the sound device. DirectSound provides this functionality while + maintaining compatibility with existing Windows�-based applications and + device drivers. </td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + +<td> <a href="../worddoc/dplay.doc"><i>Chapter 4</i></a></td> + + <td>About DirectPlay: The Microsoft� DirectPlay� application programming + interface (API) for Windows� is a software interface that simplifies your + application's access to communication services. DirectPlay has become a + technology family that not only provides a way for applications to communicate + with each other that is independent of the underlying transport, protocol, or + online service, but also provides this independence for matchmaking (lobby) servers. </td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + +<td> <a href="../worddoc/d3dover.doc"><i>Chapter 5</i></a></td> + + <td>About Direct3D: The Microsoft family of advanced 3D-graphics solutions includes the + Direct3D� and OpenGL� application programming interfaces (APIs). </td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + +<td> <a href="../worddoc/d3drmref.doc"><i>Chapter 5, Section 1</i></a></td> + + <td>Retained-Mode Reference</td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + +<td> <a href="../worddoc/d3dimref.doc"><i>Chapter 5, Section 2</i></a></td> + + <td>Immediate-Mode Reference</td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + +<td> <a href="../worddoc/dinput.doc"><i>Chapter 6</i></a></td> + + <td>Introduction to Joysticks: The Microsoft� DirectInput� application + programming interface (API) provides fast and consistent access to analog + and digital joysticks. The DirectInput API maintains consistency with the + joystick APIs of the Microsoft Win32� Software Development Kit (SDK), but has + improved responsiveness and reliability by changing the device driver model. + DirectInput device drivers use the registry to store settings for standard + joysticks, calibration information for previously configured joysticks, and + settings for OEM-supplied joysticks. </td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + +<td> <a href="../worddoc/dinput3e.doc"><i>DirectInput Keyboard and Mouse</i></a></td> + + <td>Introduction to using DirectInput keyboard and mouse support: One of the + most frequently received requests for enhancements to the DirectX SDK has + been to allow faster access to mouse and keyboard data than Windows currently + provides. DirectInput 3 provides fast low-latency access to mouse and + keyboard data. This late-breaking info is only available from this + doc file, it is not in the help files yet!</td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> + +<td> <a href="../worddoc/dsetup.doc"><i>Chapter 7</i></a></td> + + <td>About DirectSetup: DirectSetup is a simple application programming + interface (API) that provides you with a one-call installation for the DirectX� 3 \ + components. This is more than a convenience; DirectX 3 is a complex product and its + installation is an involved task. You should not attempt a manual installation of + DirectX 3. </td> + +<tr><td colspan="4"><img src="fireline.gif" height=5 width=100%></td></tr> +</table> +<br><br> + + + +</body> + +</html> diff --git a/docs/web/dxbugs.doc b/docs/web/dxbugs.doc new file mode 100644 index 0000000..0a67a9a Binary files /dev/null and b/docs/web/dxbugs.doc differ diff --git a/docs/web/fireline.gif b/docs/web/fireline.gif new file mode 100644 index 0000000..23cc57f Binary files /dev/null and b/docs/web/fireline.gif differ diff --git a/docs/web/gamezone.gif b/docs/web/gamezone.gif new file mode 100644 index 0000000..bd67acc Binary files /dev/null and b/docs/web/gamezone.gif differ diff --git a/docs/web/ghome3.gif b/docs/web/ghome3.gif new file mode 100644 index 0000000..70eea62 Binary files /dev/null and b/docs/web/ghome3.gif differ diff --git a/docs/web/hammer.jpg b/docs/web/hammer.jpg new file mode 100644 index 0000000..42682a2 Binary files /dev/null and b/docs/web/hammer.jpg differ diff --git a/docs/web/hell.gif b/docs/web/hell.gif new file mode 100644 index 0000000..76939db Binary files /dev/null and b/docs/web/hell.gif differ diff --git a/docs/web/hot.htm b/docs/web/hot.htm new file mode 100644 index 0000000..fba8995 --- /dev/null +++ b/docs/web/hot.htm @@ -0,0 +1,58 @@ +<html> + +<head> +<title>Hot Links</title> +</head> + +<body bgcolor=#000000 text=#FFFFFF link=#FFFF00 vlink=#FF0000> +<basefont face="Times New Roman" size=3> + + + +<center><i><h1><font size 8>DirectX Hot Links</font></h1></i></center> +<br><br> +<h2>DirectX Developer Information</h2> +<img src="fireline.gif" height=5 width=100%> +<br><br> +<p align=left> + <table border=0> + <tr> + <td><a href="http://www.microsoft.com/mediadev" target="_top"><img src="ghome3.gif" align bottom border=0 height="101" width="285"></a></td> + <tr><td><a href="http://www.microsoft.com/mediadev" target="_top"><font size=3>Check out the latest DirectX Development Information</font></a></tr> + +<br><br> +<h2>Cool Microsoft DirectX Games</h2> +<img src="fireline.gif" height=5 width=100%> +<p align=center> + <table border=0> + <tr><td><a href="http://www.zone.com" target="_top"><img src="Gamezone.gif" align=bottom border=0 width=368 height=112></a></td></tr> + <tr><td><a href="http://www.zone.com" target="_top"><font size=4>See games launching automagically out of a web page</font></a></td></tr> + </table> +</p> +<br><br> +<p align=left> + <table border=0> + <tr> + <td><a href="http://www.microsoft.com/games/monster/" target="_top"><font size=3>Microsoft Monster Truck Madness</font></a></td> + <td><a href="http://www.microsoft.com/games/monster/" target="_top"><img src="Monster.gif" align=bottom border=0 width=200 height=183></a></td> + </tr> + </table> + +</p> + +<br> + +<p align=right> + <table border=0> + <tr> + <td><a href="http://www.microsoft.com/games/hellbender/default.htm" target="_top"><img src="Hell.gif" align=bottom border=0 width=348 height=108></a></td> + <td><a href="http://www.microsoft.com/games/hellbender/default.htm" target="_top"><font size=3>Microsoft Hellbender</font></a> + </tr> + </table> +</p> +<br><br><br><br> + + +</body> + +</html> diff --git a/docs/web/monster.gif b/docs/web/monster.gif new file mode 100644 index 0000000..f8c15ee Binary files /dev/null and b/docs/web/monster.gif differ diff --git a/docs/web/play_ik.gif b/docs/web/play_ik.gif new file mode 100644 index 0000000..e09f6f5 Binary files /dev/null and b/docs/web/play_ik.gif differ diff --git a/docs/web/playduel.gif b/docs/web/playduel.gif new file mode 100644 index 0000000..260a842 Binary files /dev/null and b/docs/web/playduel.gif differ diff --git a/docs/web/screen2.jpg b/docs/web/screen2.jpg new file mode 100644 index 0000000..66831e5 Binary files /dev/null and b/docs/web/screen2.jpg differ diff --git a/docs/web/screen3.jpg b/docs/web/screen3.jpg new file mode 100644 index 0000000..a6b6745 Binary files /dev/null and b/docs/web/screen3.jpg differ diff --git a/docs/web/screen4.jpg b/docs/web/screen4.jpg new file mode 100644 index 0000000..f97f841 Binary files /dev/null and b/docs/web/screen4.jpg differ diff --git a/docs/web/word.bmp b/docs/web/word.bmp new file mode 100644 index 0000000..ec82fba Binary files /dev/null and b/docs/web/word.bmp differ diff --git a/docs/winhelp/archive/directx1/autoplay.cnt b/docs/winhelp/archive/directx1/autoplay.cnt new file mode 100644 index 0000000..eb50d3f --- /dev/null +++ b/docs/winhelp/archive/directx1/autoplay.cnt @@ -0,0 +1,23 @@ +:Base autoplay.hlp +:Title AutoPlay +:Index AutoPlay=AUTOPLAY.HLP +1 AutoPlay +2 About AutoPlay +2 Introduction =autoplay_2_ +2 How AutoPlay Works =autoplay_3_ +2 The Autorun.inf File =autoplay_4_ +3 Tips for Writing AutoPlay Applications +3 Introduction =autoplay_6_ +3 Opening a Startup Application =autoplay_7_ +3 Loading in the Background =autoplay_8_ +3 Conserving Hard Disk Space =autoplay_9_ +3 Using the Registry =autoplay_10_ +3 Setting the NoDriveTypeAutoRun Value =autoplay_11_ +2 Suppressing AutoPlay =autoplay_12_ +2 AutoPlay for MS-DOS�Based Applications =autoplay_13_ +2 AutoPlay Command Reference +2 defaulticon =autoplay_15_ +2 icon =autoplay_16_ +2 open =autoplay_17_ +2 shell =autoplay_18_ +2 shell\verb=autoplay_19_ diff --git a/docs/winhelp/archive/directx1/autoplay.hlp b/docs/winhelp/archive/directx1/autoplay.hlp new file mode 100644 index 0000000..414e71e Binary files /dev/null and b/docs/winhelp/archive/directx1/autoplay.hlp differ diff --git a/docs/winhelp/archive/directx1/ddraw.cnt b/docs/winhelp/archive/directx1/ddraw.cnt new file mode 100644 index 0000000..23dfd66 --- /dev/null +++ b/docs/winhelp/archive/directx1/ddraw.cnt @@ -0,0 +1,135 @@ +:Base ddraw.hlp +:Title DirectDraw +:Index DirectPlay=DDRAW.HLP +1 DirectDraw +2 Help Contents Topic =HelpContents1 +2 About DirectDraw =AboutDirectDraw.2 +2 DirectDraw Overview =DirectDrawOverview.3 +2 Architectural Overview =ArchitecturalOverview.4 +3 DirectDraw - Architectural Overview - DirectDraw =DirectDraw.5 +3 DirectDraw HAL =DirectDrawHAL.6 +3 DirectDraw Software Emulation =DirectDrawSoftwareEmulation.7 +3 DirectDraw, DirectDrawSurface, DirectDrawPalette, and DirectDrawClipper =DirectDraw.DirectDrawSurface.DirectDrawPalette.andDirectDrawClipper.8 +2 Using DirectDraw =UsingDirectDraw.9 +3 Frame buffer access =Framebufferaccess.10 +3 Primary Surface resource sharing model =PrimarySurfaceresourcesharingmodel.11 +3 Changing modes and exclusive access =Changingmodesandexclusiveaccess.12 +3 Losing surfaces =Losingsurfaces.13 +3 Cliplists =Cliplists.14 +3 Color and Format Conversion =ColorandFormatConversion.15 +3 Specifying Color Keys =SpecifyingColorKeys.16 +3 Colorkeying =Colorkeying.17 +3 Flipping Surfaces and GDI's 'frame rate' =FlippingSurfacesandGDI.s.framerate..18 +3 Overlay Z Order =OverlayZOrder.19 +3 Palettes and Pixel Formats =PalettesandPixelFormats.20 +2 DirectDraw Structures +3 Data Structure Summary =DataStructureSummary.21 +3 DDBLTBATCH =DDBLTBATCH.22 +3 DDBLTFX =DDBLTFX.23 +3 DDCAPS =DDCAPS.24 +3 DDCOLORKEY =DDCOLORKEY.25 +3 DDMODEDESC =DDMODEDESC.26 +3 DDOVERLAYFX =DDOVERLAYFX.27 +3 DDPIXELFORMAT =DDPIXELFORMAT.28 +3 DDRVAL =DDRVAL.29 +3 DDSCAPS =DDSCAPS.30 +3 DDSURFACEDESC =DDSURFACEDESC.31 +2 DirectDraw Return Values +3 DD OK =DDOK.32 +3 DirectDraw Enumeration Callback Return Codes =DirectDrawEnumerationCallbackReturnCodes.33 +3 DirectDraw Error Return Codes =DirectDrawErrorReturnCodes.34 +2 DirectDraw APIs +3 APIs =APIs.35 +3 DirectDrawCreate =DirectDrawCreate.36 +3 DirectDrawEnumerate =DirectDrawEnumerate.37 +2 DirectDraw Member Reference +3 DirectDraw Member Reference - Overview =Overview.38 +3 DirectDraw Member Implementation =DirectDrawMemberImplementation.39 +3 DirectDraw Members =DirectDrawMembers.40 +4 DirectDraw Member Reference - DirectDraw Members - AddRef =AddRef.41 +4 Compact =Compact.42 +4 CreateClipper =CreateClipper.43 +4 CreatePalette =CreatePalette.44 +4 CreateSurface =CreateSurface.45 +4 DuplicateSurface =DuplicateSurface.46 +4 EnumDisplayModes =EnumDisplayModes.47 +4 EnumSurfaces =EnumSurfaces.48 +4 FlipToGDISurface =FlipToGDISurface.49 +4 DirectDraw Member Reference - DirectDraw Members - GetCaps =GetCaps.50 +4 GetDisplayMode =GetDisplayMode.51 +4 GetFourCCCodes =GetFourCCCodes.52 +4 GetGDISurface =GetGDISurface.53 +4 GetMonitorFrequency =GetMonitorFrequency.54 +4 GetScanLine =GetScanLine.55 +4 GetVerticalBlankStatus =GetVerticalBlankStatus.56 +4 DirectDraw Member Reference - DirectDraw Members - Initialize =Initialize.57 +4 DirectDraw Member Reference - DirectDraw Members - QueryInterface =QueryInterface.58 +4 DirectDraw Member Reference - DirectDraw Members - Release =Release.59 +4 RestoreDisplayMode =RestoreDisplayMode.60 +4 SetCooperativeLevel =SetCooperativeLevel.61 +4 SetDisplayMode =SetDisplayMode.62 +4 WaitForVerticalBlank =WaitForVerticalBlank.63 +2 DirectDrawSurface Member Reference +3 DirectDrawSurface Member Reference - Overview =Overview.64 +3 DIRECTDRAWSURFACE Member Implementation =DIRECTDRAWSURFACEMemberImplementation.65 +3 DirectDrawSurface Member Reference - Members =Members.66 +4 AddAttachedSurface =AddAttachedSurface.67 +4 AddOverlayDirtyRect =AddOverlayDirtyRect.68 +4 DirectDrawSurface Member Reference - Members - AddRef =AddRef.69 +4 Blt =Blt.70 +4 BltBatch =BltBatch.71 +4 BltFast =BltFast.72 +4 DeleteAttachedSurfaces =DeleteAttachedSurfaces.73 +4 EnumAttachedSurfaces =EnumAttachedSurfaces.74 +4 EnumOverlayZOrders =EnumOverlayZOrders.75 +4 Flip =Flip.76 +4 GetAttachedSurface =GetAttachedSurface.77 +4 GetBltStatus =GetBltStatus.78 +4 DirectDrawSurface Member Reference - Members - GetCaps =GetCaps.79 +4 GetClipper =GetClipper.80 +4 GetColorKey =GetColorKey.81 +4 GetDC =GetDC.82 +4 GetFlipStatus =GetFlipStatus.83 +4 GetOverlayPosition =GetOverlayPosition.84 +4 GetPalette =GetPalette.85 +4 GetPixelFormat =GetPixelFormat.86 +4 GetSurfaceDesc =GetSurfaceDesc.87 +4 DirectDrawSurface Member Reference - Members - Initialize =Initialize.88 +4 IsLost =IsLost.89 +4 Lock =Lock.90 +4 DirectDrawSurface Member Reference - Members - QueryInterface =QueryInterface.91 +4 DirectDrawSurface Member Reference - Members - Release =Release.92 +4 ReleaseDC =ReleaseDC.93 +4 Restore =Restore.94 +4 SetClipper =SetClipper.95 +4 SetColorKey =SetColorKey.96 +4 SetOverlayPosition =SetOverlayPosition.97 +4 SetPalette =SetPalette.98 +4 Unlock =Unlock.99 +4 UpdateOverlay =UpdateOverlay.100 +4 UpdateOverlayDisplay =UpdateOverlayDisplay.101 +4 UpdateOverlayZOrder =UpdateOverlayZOrder.102 +2 DirectDrawPalette Member Reference +3 DirectDrawPalette Member Reference - Overview =Overview.103 +3 DIRECTDRAWPALETTE Member Implementation =DIRECTDRAWPALETTEMemberImplementation.104 +3 DirectDrawPalette Member Reference - Members =Members.105 +4 DirectDrawPalette Member Reference - Members - AddRef =AddRef.106 +4 DirectDrawPalette Member Reference - Members - GetCaps =GetCaps.107 +4 GetEntries =GetEntries.108 +4 DirectDrawPalette Member Reference - Members - Initialize =Initialize.109 +4 DirectDrawPalette Member Reference - Members - QueryInterface =QueryInterface.110 +4 DirectDrawPalette Member Reference - Members - Release =Release.111 +4 SetEntries =SetEntries.112 +2 DirectDrawClipper Member Reference +3 DirectDrawClipper Member Reference - Overview =Overview.113 +3 DIRECTDRAWCLIPPER Member Implementation =DIRECTDRAWCLIPPERMemberImplementation.114 +3 DirectDrawClipper Member Reference - Members =Members.115 +4 DirectDrawClipper Member Reference - Members - AddRef =AddRef.116 +4 GetClipList =GetClipList.117 +4 GetHWnd =GetHWnd.118 +4 DirectDrawClipper Member Reference - Members - Initialize =Initialize.119 +4 IsClipListChanged =IsClipListChanged.120 +4 DirectDrawClipper Member Reference - Members - QueryInterface =QueryInterface.121 +4 DirectDrawClipper Member Reference - Members - Release =Release.122 +4 SetClipList =SetClipList.123 +4 SetHWnd =SetHWnd.124 diff --git a/docs/winhelp/archive/directx1/ddraw.hlp b/docs/winhelp/archive/directx1/ddraw.hlp new file mode 100644 index 0000000..2a4c3f6 Binary files /dev/null and b/docs/winhelp/archive/directx1/ddraw.hlp differ diff --git a/docs/winhelp/archive/directx1/dinput.cnt b/docs/winhelp/archive/directx1/dinput.cnt new file mode 100644 index 0000000..2925e33 --- /dev/null +++ b/docs/winhelp/archive/directx1/dinput.cnt @@ -0,0 +1,21 @@ +:Base dinput.hlp +:Title DirectInput +:Index DirectInput=DINPUT.HLP +1 DirectInput +2 About DirectInput +2 Introduction to Joysticks =dinput_2_ +2 Joystick Capabilities =dinput_3_ +2 Joystick Calibration and Testing =dinput_4_ +2 Joystick Position =dinput_5_ +2 DirectInput Reference +2 Joystick Groups =dinput_7_ +3 Functions +3 Introduction =dinput_9_ +3 joyConfigChanged =dinput_10_ +3 joyGetDevCaps =dinput_11_ +3 joyGetNumDevs =dinput_12_ +3 joyGetPosEx =dinput_13_ +3 Structures +3 Introduction =dinput_15_ +3 JOYCAPS =dinput_16_ +3 JOYINFOEX =dinput_17_ diff --git a/docs/winhelp/archive/directx1/dinput.hlp b/docs/winhelp/archive/directx1/dinput.hlp new file mode 100644 index 0000000..22061d3 Binary files /dev/null and b/docs/winhelp/archive/directx1/dinput.hlp differ diff --git a/docs/winhelp/archive/directx1/dplay.cnt b/docs/winhelp/archive/directx1/dplay.cnt new file mode 100644 index 0000000..5b9c15c --- /dev/null +++ b/docs/winhelp/archive/directx1/dplay.cnt @@ -0,0 +1,63 @@ +:Base dplay.hlp +:Title DirectPlay +:Index DirectPlay=DPLAY.HLP +1 DirectPlay +2 Help Contents Topic =HelpContents1 +2 DirectPlay +3 About DirectPlay =AboutDirectPlay.2 +3 DirectPlay Architecture =DirectPlayArchitecture.3 +3 Globally Unique Identifiers =GloballyUniqueIdentifiers.4 +3 Using DirectPlay =UsingDirectPlay.5 +3 Session Management =SessionManagement.6 +3 Player Management =PlayerManagement.7 +3 Group Management =GroupManagement.8 +3 Message Management =MessageManagement.9 +2 DirectPlay Stuctures +3 Structure Summary =StructureSummary.10 +3 Data Structures +4 DPCAPS =DPCAPS.12 +4 DPSESSIONDESC =DPSESSIONDESC.13 +3 System Messages +4 System Messages =SystemMessageStructures.14 +4 DPMSG_ADDPLAYER =DPMSG.ADDPLAYER.15 +4 DPMSG_DELETEPLAYER =DPMSG.DELETEPLAYER.16 +4 DPMSG_GENERIC =DPMSG.GENERIC.17 +4 DPMSG_GROUPADD =DPMSG.GROUPADD.18 +4 DPMSG_GROUPDELETE =DPMSG.GROUPDELETE.19 +2 DirectPlay Return Values +3 DP_OK =DP.OK.20 +3 DirectPlay Error Return Codes =DirectPlayErrorReturnCodes.21 +2 DirectPlay APIs +3 APIs =APIs.22 +3 DirectPlayCreate =DirectPlayCreate.23 +4 DirectPlayEnumerate =DirectPlayEnumerate.24 +2 DirectPlay Members +3 Member Summary =MemberSummary.25 +3 DirectPlay Members +4 DirectPlay Members = DirectPlayMembers.26 +4 AddPlayerToGroup =AddPlayerToGroup.27 +4 AddRef =AddRef.28 +4 Close =Close.29 +4 CreateGroup =CreateGroup.30 +4 CreatePlayer =CreatePlayer.31 +4 DeletePlayerFromGroup =DeletePlayerFromGroup.32 +4 DestroyGroup =DestroyGroup.33 +4 DestroyPlayer =DestroyPlayer.34 +4 EnableNewPlayers =EnableNewPlayers.35 +4 EnumGroups =EnumGroups.36 +4 EnumGroupPlayers =EnumGroupPlayers.37 +4 EnumPlayers =EnumPlayers.38 +4 EnumSessions =EnumSessions.39 +4 GetCaps =GetCaps.40 +4 GetMessageCount =GetMessageCount.41 +4 GetPlayerCaps =GetPlayerCaps.42 +4 GetPlayerName =GetPlayerName.43 +4 Initialize =Initialize.44 +4 Open =Open.45 +4 QueryInterface =QueryInterface.46 +4 Receive =Receive.47 +4 Release =Release.48 +4 SaveSession =SaveSession.49 +4 Send =Send.50 +4 SetPlayerName =SetPlayerName.51 + diff --git a/docs/winhelp/archive/directx1/dplay.hlp b/docs/winhelp/archive/directx1/dplay.hlp new file mode 100644 index 0000000..58c9c37 Binary files /dev/null and b/docs/winhelp/archive/directx1/dplay.hlp differ diff --git a/docs/winhelp/archive/directx1/dsound.cnt b/docs/winhelp/archive/directx1/dsound.cnt new file mode 100644 index 0000000..438a082 --- /dev/null +++ b/docs/winhelp/archive/directx1/dsound.cnt @@ -0,0 +1,87 @@ +:Base dsound.hlp +:Title DirectSound +:Index DirectSound=DSOUND.HLP +1 DirectSound +2 About DirectSound +2 Introduction =dsound_2_ +3 Object Types +3 Introduction =dsound_4_ +3 The DirectSound Object =dsound_5_ +3 The DirectSoundBuffer Object =dsound_6_ +2 Software Emulation =dsound_7_ +2 Device Drivers =dsound_8_ +2 System Integration =dsound_9_ +3 DirectSound Features +3 Mixing =dsound_11_ +3 Hardware Acceleration =dsound_12_ +3 Access to the Primary Buffer =dsound_13_ +2 IDirectSound Interface +2 Introduction =dsound_15_ +2 Device Capabilities =dsound_16_ +2 Creating Buffers =dsound_17_ +2 Speaker Configuration =dsound_18_ +2 Hardware Memory Management =dsound_19_ +2 IDirectSoundBuffer Interface +2 IDirectSoundBuffer Introduction =dsound_21_ +2 Play Management =dsound_22_ +2 Sound-Environment Management =dsound_23_ +2 Information =dsound_24_ +2 Memory Management =dsound_25_ +2 IUnknown Interface =dsound_26_ +2 Using DirectSound +2 Introduction =dsound_28_ +2 Implementation: A Broad Overview =dsound_29_ +2 Creating a DirectSound Object =dsound_30_ +2 Querying the Hardware Capabilities =dsound_31_ +3 Creating Sound Buffers +3 Introduction =dsound_33_ +3 Creating a Basic Sound Buffer =dsound_34_ +3 Control Options =dsound_35_ +3 Static and Streaming Sound Buffers =dsound_36_ +3 Hardware and Software Sound Buffers =dsound_37_ +3 Primary and Secondary Sound Buffers =dsound_38_ +2 Writing to Sound Buffers =dsound_39_ +2 Using the DirectSound Mixer =dsound_40_ +2 Using a Custom Mixer =dsound_41_ +2 Using Compressed Wave Formats =dsound_42_ +2 DirectSound Reference +3 Functions +3 DirectSoundCreate =dsound_45_ +3 DirectSoundEnumCallback =dsound_46_ +3 DirectSoundEnumerate =dsound_47_ +3 IDirectSound Interface and Member Functions +3 IDirectSound =dsound_49_ +3 IDirectSound::Compact =dsound_50_ +3 IDirectSound::CreateSoundBuffer =dsound_51_ +3 IDirectSound::DuplicateSoundBuffer =dsound_52_ +3 IDirectSound::GetCaps =dsound_53_ +3 IDirectSound::GetSpeakerConfig =dsound_54_ +3 IDirectSound::Initialize =dsound_55_ +3 IDirectSound::SetCooperativeLevel =dsound_56_ +3 IDirectSound::SetSpeakerConfig =dsound_57_ +3 IDirectSoundBuffer Interface and Member Functions +3 IDirectSoundBuffer =dsound_59_ +3 IDirectSoundBuffer::GetCaps =dsound_60_ +3 IDirectSoundBuffer::GetCurrentPosition =dsound_61_ +3 IDirectSoundBuffer::GetFormat =dsound_62_ +3 IDirectSoundBuffer::GetFrequency =dsound_63_ +3 IDirectSoundBuffer::GetPan =dsound_64_ +3 IDirectSoundBuffer::GetStatus =dsound_65_ +3 IDirectSoundBuffer::GetVolume =dsound_66_ +3 IDirectSoundBuffer::Initialize =dsound_67_ +3 IDirectSoundBuffer::Lock =dsound_68_ +3 IDirectSoundBuffer::Play =dsound_69_ +3 IDirectSoundBuffer::Restore =dsound_70_ +3 IDirectSoundBuffer::SetCurrentPosition =dsound_71_ +3 IDirectSoundBuffer::SetFormat =dsound_72_ +3 IDirectSoundBuffer::SetFrequency =dsound_73_ +3 IDirectSoundBuffer::SetPan =dsound_74_ +3 IDirectSoundBuffer::SetVolume =dsound_75_ +3 IDirectSoundBuffer::Stop =dsound_76_ +3 IDirectSoundBuffer::Unlock =dsound_77_ +3 Structures +3 DSBCAPS =dsound_79_ +3 DSBUFFERDESC =dsound_80_ +3 DSCAPS =dsound_81_ +3 Constants +3 Error Values =dsound_83_ diff --git a/docs/winhelp/archive/directx1/dsound.hlp b/docs/winhelp/archive/directx1/dsound.hlp new file mode 100644 index 0000000..d5d8810 Binary files /dev/null and b/docs/winhelp/archive/directx1/dsound.hlp differ diff --git a/docs/winhelp/archive/directx1/gamesdk.cnt b/docs/winhelp/archive/directx1/gamesdk.cnt new file mode 100644 index 0000000..f5072a7 --- /dev/null +++ b/docs/winhelp/archive/directx1/gamesdk.cnt @@ -0,0 +1,29 @@ +:Base gamesdk.hlp +:Title Windows 95 Game SDK +:Index Introducing the Windows 95 Game SDK =GAMESDK.HLP +:include legal.cnt +1 Introducing the Game Software Development Kit +2 Programming Games in Windows +2 Introduction =gamesdk_2_ +2 Reasons for Developing Windows-Based Games =gamesdk_3_ +2 Providing Standards for Hardware Accelerators =gamesdk_4_ +2 Windows 95 Game Features +2 Introduction =gamesdk_6_ +2 DirectDraw =gamesdk_7_ +2 DirectSound =gamesdk_8_ +2 DirectPlay =gamesdk_9_ +2 DirectInput =gamesdk_10_ +2 AutoPlay =gamesdk_11_ +2 Sample Applications =gamesdk_12_ +2 Games and the Component Object Model +2 Introduction =gamesdk_14_ +2 The Component Object Model =gamesdk_15_ +2 Accessing COM Objects Using C =gamesdk_16_ +2 Game SDK COM Interfaces =gamesdk_17_ +1 Conventions =gamesdk_18_ +:include ddraw.cnt +:include dsound.cnt +:include dplay.cnt +:include dinput.cnt +:include install.cnt +:include autoplay.cnt diff --git a/docs/winhelp/archive/directx1/gamesdk.hlp b/docs/winhelp/archive/directx1/gamesdk.hlp new file mode 100644 index 0000000..36550c3 Binary files /dev/null and b/docs/winhelp/archive/directx1/gamesdk.hlp differ diff --git a/docs/winhelp/archive/directx1/install.cnt b/docs/winhelp/archive/directx1/install.cnt new file mode 100644 index 0000000..ce4944f --- /dev/null +++ b/docs/winhelp/archive/directx1/install.cnt @@ -0,0 +1,10 @@ +:Base install.hlp +:Title DirectSetup +:Index DirectSetup=INSTALL.HLP +1 DirectSetup +2 Contents Topic =HelpContents1 +2 About DirectSetup = AboutDirectSetup.2 +2 Using DirectSetup = UsingDirectSetup.3 +2 DirectSetup API +3 API =API.4 +4 DirectXSetup = DirectXSetup.5 diff --git a/docs/winhelp/archive/directx1/install.hlp b/docs/winhelp/archive/directx1/install.hlp new file mode 100644 index 0000000..9117d4a Binary files /dev/null and b/docs/winhelp/archive/directx1/install.hlp differ diff --git a/docs/winhelp/archive/directx1/legal.cnt b/docs/winhelp/archive/directx1/legal.cnt new file mode 100644 index 0000000..3030fd2 --- /dev/null +++ b/docs/winhelp/archive/directx1/legal.cnt @@ -0,0 +1,4 @@ +:Base legal.hlp +:Title Copyright Notice +:Index Introducing the Windows 95 Game SDK =LEGAL.HLP +1 Copyright Notice=legal_0_ diff --git a/docs/winhelp/archive/directx1/legal.hlp b/docs/winhelp/archive/directx1/legal.hlp new file mode 100644 index 0000000..c97deb3 Binary files /dev/null and b/docs/winhelp/archive/directx1/legal.hlp differ diff --git a/docs/winhelp/archive/directx2/directx.cnt b/docs/winhelp/archive/directx2/directx.cnt new file mode 100644 index 0000000..32868bb --- /dev/null +++ b/docs/winhelp/archive/directx2/directx.cnt @@ -0,0 +1,1154 @@ +:base directx.hlp +:title Microsoft DirectX 2 SDK +:link directx.hlp +:link selfsame +1 Copyrights and Trademarks=legal_0000000000000001 +1 Introducing the DirectX 2 Software Development Kit +2 Using DirectX 2 in Windows +2 Using DirectX 2 in Windows=dxintro_0001000101000000 +2 Reasons for Developing DirectX Windows Applications=dxintro_0001000101010000 +2 Providing Standards for Hardware Accelerators=dxintro_0001000101020000 +2 DirectX 2 Components +2 DirectX 2 Components=dxintro_0001000102000000 +2 DirectDraw=dxintro_0001000102010000 +2 DirectSound=dxintro_0001000102020000 +2 DirectPlay=dxintro_0001000102030000 +2 Direct3D=dxintro_0001000102040000 +2 DirectInput=dxintro_0001000102050000 +2 AutoPlay=dxintro_0001000102060000 +2 Sample Applications=dxintro_0001000102070000 +2 DirectX and the Component Object Model +2 The Component Object Model=dxintro_0001000103010000 +2 IUnknown=dxintro_0001000103020000 +2 DirectX 2 SDK COM Interfaces=dxintro_0001000103030000 +2 C++ and the COM Interface=dxintro_0001000103040000 +2 Accessing COM Objects Using C=dxintro_0001000103050000 +2 Interface Method Names and Syntax=dxintro_0001000103060000 +2 Using Macro Definitions=dxintro_0001000103070000 +2 Floating-point Precision=dxintro_0001000103080000 +2 Differences Between the Game SDK and the DirectX 2 SDK +2 Differences Between the Game SDK and the DirectX 2 SDK=dxintro_0001000104000000 +2 DirectDraw=dxintro_0001000104010000 +2 DirectSound=dxintro_0001000104020000 +2 DirectPlay=dxintro_0001000104030000 +2 Direct3D=dxintro_0001000104040000 +2 DirectInput=dxintro_0001000104050000 +2 AutoPlay=dxintro_0001000104060000 +2 DirectSetup=dxintro_0001000104070000 +1 Conventions=dxintro_0001000105000000 +1 DirectDraw +2 Overview +2 About DirectDraw=ddoverv_0001000201010000 +2 Introduction to DirectDraw=ddoverv_0001000201020000 +3 Architectural Overview +3 DirectDraw=ddoverv_0001000201030100 +3 DirectDraw HAL=ddoverv_0001000201030200 +3 DirectDraw Software Emulation=ddoverv_0001000201030300 +3 Types of DirectDraw Objects=ddoverv_0001000201030400 +3 Using DirectDraw +3 IDirectDraw2 Interface=ddoverv_0001000201040100 +3 Multiple DirectDraw Objects per Process=ddoverv_0001000201040200 +3 Support for High Resolutions and True Color Bit Depths=ddoverv_0001000201040300 +3 Primary Surface Resource Sharing Model=ddoverv_0001000201040400 +3 Changing Modes and Exclusive Access=ddoverv_0001000201040500 +3 Creating DirectDraw Objects Using CoCreateInstance=ddoverv_0001000201040600 +3 Using DirectDrawSurface +3 IDirectDrawSurface2 Interface=ddoverv_0001000201050100 +3 Frame Buffer Access=ddoverv_0001000201050200 +3 Losing Surfaces=ddoverv_0001000201050300 +3 Surface Format Support in the HEL=ddoverv_0001000201050400 +3 Color and Format Conversion=ddoverv_0001000201050500 +3 Color Keying=ddoverv_0001000201050600 +3 Specifying Color Keys=ddoverv_0001000201050700 +3 Flipping Surfaces and GDI's Frame Rate=ddoverv_0001000201050800 +3 Overlay Z-Order=ddoverv_0001000201050900 +3 Palettes and Pixel Formats=ddoverv_0001000201050a00 +3 Blitting To and From System Memory Surfaces=ddoverv_0001000201050b00 +3 Using DirectDrawPalette +3 Setting Palettes on Non-Primary Surfaces=ddoverv_0001000201060100 +3 Sharing Palettes=ddoverv_0001000201060200 +3 New Palette Types=ddoverv_0001000201060300 +3 Using DirectDrawClipper +3 Driver Independent Clippers=ddoverv_0001000201070100 +3 Clip Lists=ddoverv_0001000201070200 +3 Sharing Clippers=ddoverv_0001000201070300 +3 Creating Clipper Objects Using CoCreateInstance=ddoverv_0001000201070400 +3 Support for 3D Surfaces +3 Texture Maps=ddoverv_0001000201080100 +3 Mipmaps=ddoverv_0001000201080200 +3 Z-Buffers=ddoverv_0001000201080300 +3 Direct3D Integration with DirectDraw +3 Direct3D Driver Interface=ddoverv_0001000201090100 +3 Direct3D Device Interface=ddoverv_0001000201090200 +3 Direct3D Texture Interface=ddoverv_0001000201090300 +3 DirectDraw HEL and Direct3D=ddoverv_0001000201090400 +2 Reference +3 Functions +3 Functions=ddref_0001000202010000 +3 DirectDrawCreate=ddref_0001000202010100 +3 DirectDrawCreateClipper=ddref_0001000202010200 +3 DirectDrawEnumerate=ddref_0001000202010300 +3 Callback Functions +3 Callback Functions=ddref_0001000202020000 +3 Callback=ddref_0001000202020100 +3 EnumCallback=ddref_0001000202020200 +3 EnumModesCallback=ddref_0001000202020300 +3 EnumSurfacesCallback=ddref_0001000202020400 +3 fnCallback=ddref_0001000202020500 +3 IDirectDraw Interface +3 IDirectDraw Interface=ddref_0001000202030000 +3 IDirectDraw Interface Method Groups=ddref_0001000202030100 +3 IDirectDraw::AddRef=ddref_0001000202030200 +3 IDirectDraw::Compact=ddref_0001000202030300 +3 IDirectDraw::CreateClipper=ddref_0001000202030400 +3 IDirectDraw::CreatePalette=ddref_0001000202030500 +3 IDirectDraw::CreateSurface=ddref_0001000202030600 +3 IDirectDraw::DuplicateSurface=ddref_0001000202030700 +3 IDirectDraw2::EnumDisplayModes=ddref_0001000202030800 +3 IDirectDraw::EnumSurfaces=ddref_0001000202030900 +3 IDirectDraw::FlipToGDISurface=ddref_0001000202030a00 +3 IDirectDraw2::GetAvailableVidMem=ddref_0001000202030b00 +3 IDirectDraw::GetCaps=ddref_0001000202030c00 +3 IDirectDraw::GetDisplayMode=ddref_0001000202030d00 +3 IDirectDraw::GetFourCCCodes=ddref_0001000202030e00 +3 IDirectDraw::GetGDISurface=ddref_0001000202030f00 +3 IDirectDraw::GetMonitorFrequency=ddref_0001000202031000 +3 IDirectDraw::GetScanLine=ddref_0001000202031100 +3 IDirectDraw::GetVerticalBlankStatus=ddref_0001000202031200 +3 IDirectDraw::Initialize=ddref_0001000202031300 +3 IDirectDraw::QueryInterface=ddref_0001000202031400 +3 IDirectDraw::Release=ddref_0001000202031500 +3 IDirectDraw::RestoreDisplayMode=ddref_0001000202031600 +3 IDirectDraw::SetCooperativeLevel=ddref_0001000202031700 +3 IDirectDraw2::SetDisplayMode=ddref_0001000202031800 +3 IDirectDraw::WaitForVerticalBlank=ddref_0001000202031900 +3 IDirectDrawSurface Interface +3 IDirectDrawSurface Interface=ddref_0001000202040000 +3 IDirectDrawSurface Interface Method Groups=ddref_0001000202040100 +3 IDirectDrawSurface::AddAttachedSurface=ddref_0001000202040200 +3 IDirectDrawSurface::AddOverlayDirtyRect=ddref_0001000202040300 +3 IDirectDrawSurface::AddRef=ddref_0001000202040400 +3 IDirectDrawSurface::Blt=ddref_0001000202040500 +3 IDirectDrawSurface::BltBatch=ddref_0001000202040600 +3 IDirectDrawSurface::BltFast=ddref_0001000202040700 +3 IDirectDrawSurface::DeleteAttachedSurface=ddref_0001000202040800 +3 IDirectDrawSurface::EnumAttachedSurfaces=ddref_0001000202040900 +3 IDirectDrawSurface::EnumOverlayZOrders=ddref_0001000202040a00 +3 IDirectDrawSurface::Flip=ddref_0001000202040b00 +3 IDirectDrawSurface::GetAttachedSurface=ddref_0001000202040c00 +3 IDirectDrawSurface::GetBltStatus=ddref_0001000202040d00 +3 IDirectDrawSurface::GetCaps=ddref_0001000202040e00 +3 IDirectDrawSurface::GetClipper=ddref_0001000202040f00 +3 IDirectDrawSurface::GetColorKey=ddref_0001000202041000 +3 IDirectDrawSurface::GetDC=ddref_0001000202041100 +3 IDirectDrawSurface2::GetDDInterface=ddref_0001000202041200 +3 IDirectDrawSurface::GetFlipStatus=ddref_0001000202041300 +3 IDirectDrawSurface::GetOverlayPosition=ddref_0001000202041400 +3 IDirectDrawSurface::GetPalette=ddref_0001000202041500 +3 IDirectDrawSurface::GetPixelFormat=ddref_0001000202041600 +3 IDirectDrawSurface::GetSurfaceDesc=ddref_0001000202041700 +3 IDirectDrawSurface::Initialize=ddref_0001000202041800 +3 IDirectDrawSurface::IsLost=ddref_0001000202041900 +3 IDirectDrawSurface::Lock=ddref_0001000202041a00 +3 IDirectDrawSurface2::PageLock=ddref_0001000202041b00 +3 IDirectDrawSurface2::PageUnlock=ddref_0001000202041c00 +3 IDirectDrawSurface::QueryInterface=ddref_0001000202041d00 +3 IDirectDrawSurface::Release=ddref_0001000202041e00 +3 IDirectDrawSurface::ReleaseDC=ddref_0001000202041f00 +3 IDirectDrawSurface::Restore=ddref_0001000202042000 +3 IDirectDrawSurface::SetClipper=ddref_0001000202042100 +3 IDirectDrawSurface::SetColorKey=ddref_0001000202042200 +3 IDirectDrawSurface::SetOverlayPosition=ddref_0001000202042300 +3 IDirectDrawSurface::SetPalette=ddref_0001000202042400 +3 IDirectDrawSurface::Unlock=ddref_0001000202042500 +3 IDirectDrawSurface::UpdateOverlay=ddref_0001000202042600 +3 IDirectDrawSurface::UpdateOverlayDisplay=ddref_0001000202042700 +3 IDirectDrawSurface::UpdateOverlayZOrder=ddref_0001000202042800 +3 IDirectDrawPalette Interface +3 IDirectDrawPalette Interface=ddref_0001000202050000 +3 IDirectDrawPalette Interface Method Groups=ddref_0001000202050100 +3 IDirectDrawPalette::AddRef=ddref_0001000202050200 +3 IDirectDrawPalette::GetCaps=ddref_0001000202050300 +3 IDirectDrawPalette::GetEntries=ddref_0001000202050400 +3 IDirectDrawPalette::Initialize=ddref_0001000202050500 +3 IDirectDrawPalette::QueryInterface=ddref_0001000202050600 +3 IDirectDrawPalette::Release=ddref_0001000202050700 +3 IDirectDrawPalette::SetEntries=ddref_0001000202050800 +3 IDirectDrawClipper Interface +3 IDirectDrawClipper Interface Method Groups=ddref_0001000202060100 +3 IDirectDrawClipper::AddRef=ddref_0001000202060200 +3 IDirectDrawClipper::GetClipList=ddref_0001000202060300 +3 IDirectDrawClipper::GetHWnd=ddref_0001000202060400 +3 IDirectDrawClipper::Initialize=ddref_0001000202060500 +3 IDirectDrawClipper::IsClipListChanged=ddref_0001000202060600 +3 IDirectDrawClipper::QueryInterface=ddref_0001000202060700 +3 IDirectDrawClipper::Release=ddref_0001000202060800 +3 IDirectDrawClipper::SetClipList=ddref_0001000202060900 +3 IDirectDrawClipper::SetHWnd=ddref_0001000202060a00 +3 Structures +3 DDBLTBATCH=ddref_0001000202070100 +3 DDBLTFX=ddref_0001000202070200 +3 DDCAPS=ddref_0001000202070300 +3 DDCOLORKEY=ddref_0001000202070400 +3 DDOVERLAYFX=ddref_0001000202070500 +3 DDPIXELFORMAT=ddref_0001000202070600 +3 DDSCAPS=ddref_0001000202070700 +3 DDSURFACEDESC=ddref_0001000202070800 +2 Return Values=ddref_0001000202080000 +1 DirectSound +2 Overview +2 About DirectSound=dsound_0001000301010000 +3 Object Types +3 Object Types=dsound_0001000301020000 +3 The DirectSound Object=dsound_0001000301020100 +3 The DirectSoundBuffer Object=dsound_0001000301020200 +2 Software Emulation=dsound_0001000301030000 +2 Device Drivers=dsound_0001000301040000 +2 System Integration=dsound_0001000301050000 +3 DirectSound Features +3 Mixing=dsound_0001000301060100 +3 Hardware Acceleration=dsound_0001000301060200 +3 Write Access to the Primary Buffer=dsound_0001000301060300 +3 IDirectSound Interface +3 IDirectSound Interface=dsound_0001000301070000 +3 Device Capabilities=dsound_0001000301070100 +3 Creating Buffers=dsound_0001000301070200 +3 Speaker Configuration=dsound_0001000301070300 +3 Hardware Memory Management=dsound_0001000301070400 +3 IDirectSoundBuffer Interface +3 IDirectSoundBuffer Interface=dsound_0001000301080000 +3 Play Management=dsound_0001000301080100 +3 Sound-Environment Management=dsound_0001000301080200 +3 Retrieving Information=dsound_0001000301080300 +3 Memory Management +3 Memory Management=dsound_0001000301090000 +3 IUnknown Interface=dsound_0001000301090100 +2 Implementation: A Broad Overview=dsound_00010003010a0000 +2 Creating a DirectSound Object=dsound_00010003010b0000 +2 Creating a DirectSound Object Using CoCreateInstance=dsound_00010003010c0000 +2 Querying the Hardware Capabilities=dsound_00010003010d0000 +3 Creating Sound Buffers +3 Creating a Basic Sound Buffer=dsound_00010003010e0100 +3 Control Options=dsound_00010003010e0200 +3 Static and Streaming Sound Buffers=dsound_00010003010e0300 +3 Hardware and Software Sound Buffers=dsound_00010003010e0400 +3 Primary and Secondary Sound Buffers=dsound_00010003010e0500 +2 Writing to Sound Buffers=dsound_00010003010f0000 +2 Using the DirectSound Mixer=dsound_0001000301100000 +2 Using a Custom Mixer=dsound_0001000301110000 +2 Using Compressed Wave Formats=dsound_0001000301120000 +2 Reference +3 Functions +3 Functions=dsound_0001000302010000 +3 DirectSoundCreate=dsound_0001000302010100 +3 DirectSoundEnumerate=dsound_0001000302010200 +3 Callback Functions +3 Callback Functions=dsound_0001000302020000 +3 DSEnumCallback=dsound_0001000302020100 +3 IDirectSound Interface +3 IDirectSound Interface Method Groups=dsound_0001000302030100 +3 IDirectSound::AddRef=dsound_0001000302030200 +3 IDirectSound::Compact=dsound_0001000302030300 +3 IDirectSound::CreateSoundBuffer=dsound_0001000302030400 +3 IDirectSound::DuplicateSoundBuffer=dsound_0001000302030500 +3 IDirectSound::GetCaps=dsound_0001000302030600 +3 IDirectSound::GetSpeakerConfig=dsound_0001000302030700 +3 IDirectSound::Initialize=dsound_0001000302030800 +3 IDirectSound::QueryInterface=dsound_0001000302030900 +3 IDirectSound::Release=dsound_0001000302030a00 +3 IDirectSound::SetCooperativeLevel=dsound_0001000302030b00 +3 IDirectSound::SetSpeakerConfig=dsound_0001000302030c00 +3 IDirectSoundBuffer Interface +3 IDirectSoundBuffer Interface Method Groups=dsound_0001000302040100 +3 IDirectSoundBuffer::AddRef=dsound_0001000302040200 +3 IDirectSoundBuffer::GetCaps=dsound_0001000302040300 +3 IDirectSoundBuffer::GetCurrentPosition=dsound_0001000302040400 +3 IDirectSoundBuffer::GetFormat=dsound_0001000302040500 +3 IDirectSoundBuffer::GetFrequency=dsound_0001000302040600 +3 IDirectSoundBuffer::GetPan=dsound_0001000302040700 +3 IDirectSoundBuffer::GetStatus=dsound_0001000302040800 +3 IDirectSoundBuffer::GetVolume=dsound_0001000302040900 +3 IDirectSoundBuffer::Initialize=dsound_0001000302040a00 +3 IDirectSoundBuffer::Lock=dsound_0001000302040b00 +3 IDirectSoundBuffer::Play=dsound_0001000302040c00 +3 IDirectSoundBuffer::QueryInterface=dsound_0001000302040d00 +3 IDirectSoundBuffer::Release=dsound_0001000302040e00 +3 IDirectSoundBuffer::Restore=dsound_0001000302040f00 +3 IDirectSoundBuffer::SetCurrentPosition=dsound_0001000302041000 +3 IDirectSoundBuffer::SetFormat=dsound_0001000302041100 +3 IDirectSoundBuffer::SetFrequency=dsound_0001000302041200 +3 IDirectSoundBuffer::SetPan=dsound_0001000302041300 +3 IDirectSoundBuffer::SetVolume=dsound_0001000302041400 +3 IDirectSoundBuffer::Stop=dsound_0001000302041500 +3 IDirectSoundBuffer::Unlock=dsound_0001000302041600 +3 Structures +3 DSBCAPS=dsound_0001000302050100 +3 DSBUFFERDESC=dsound_0001000302050200 +3 DSCAPS=dsound_0001000302050300 +2 Return Values=dsound_0001000302060000 +1 DirectPlay +2 Overview +2 Overview=dplay_0001000401000000 +2 DirectPlay Architecture=dplay_0001000401010000 +2 Globally Unique Identifiers=dplay_0001000401020000 +2 Using DirectPlay=dplay_0001000401030000 +2 Session Management=dplay_0001000401040000 +2 Player Management=dplay_0001000401050000 +2 Group Management=dplay_0001000401060000 +2 Message Management=dplay_0001000401070000 +2 Reference +3 Functions +3 Functions=dplay_0001000402010000 +3 DirectPlayCreate=dplay_0001000402010100 +3 DirectPlayEnumerate=dplay_0001000402010200 +3 Callback Functions +3 Callback Functions=dplay_0001000402020000 +3 EnumDPCallback=dplay_0001000402020100 +3 EnumPlayersCallback=dplay_0001000402020200 +3 EnumSessionsCallback=dplay_0001000402020300 +3 IDirectPlay Interface +3 IDirectPlay Interface Method Groups=dplay_0001000402030100 +3 IDirectPlay::AddPlayerToGroup=dplay_0001000402030200 +3 IDirectPlay::AddRef=dplay_0001000402030300 +3 IDirectPlay::Close=dplay_0001000402030400 +3 IDirectPlay::CreateGroup=dplay_0001000402030500 +3 IDirectPlay::CreatePlayer=dplay_0001000402030600 +3 IDirectPlay::DeletePlayerFromGroup=dplay_0001000402030700 +3 IDirectPlay::DestroyGroup=dplay_0001000402030800 +3 IDirectPlay::DestroyPlayer=dplay_0001000402030900 +3 IDirectPlay::EnableNewPlayers=dplay_0001000402030a00 +3 IDirectPlay::EnumGroupPlayers=dplay_0001000402030b00 +3 IDirectPlay::EnumGroups=dplay_0001000402030c00 +3 IDirectPlay::EnumPlayers=dplay_0001000402030d00 +3 IDirectPlay::EnumSessions=dplay_0001000402030e00 +3 IDirectPlay::GetCaps=dplay_0001000402030f00 +3 IDirectPlay::GetMessageCount=dplay_0001000402031000 +3 IDirectPlay::GetPlayerCaps=dplay_0001000402031100 +3 IDirectPlay::GetPlayerName=dplay_0001000402031200 +3 IDirectPlay::Initialize=dplay_0001000402031300 +3 IDirectPlay::Open=dplay_0001000402031400 +3 IDirectPlay::QueryInterface=dplay_0001000402031500 +3 IDirectPlay::Receive=dplay_0001000402031600 +3 IDirectPlay::Release=dplay_0001000402031700 +3 IDirectPlay::SaveSession=dplay_0001000402031800 +3 IDirectPlay::Send=dplay_0001000402031900 +3 IDirectPlay::SetPlayerName=dplay_0001000402031a00 +3 Structures +3 Structures=dplay_0001000402040000 +3 DPCAPS=dplay_0001000402040100 +3 DPSESSIONDESC=dplay_0001000402040200 +3 System Messages=dplay_0001000402040300 +3 DPMSG_ADDPLAYER=dplay_0001000402040400 +3 DPMSG_DELETEPLAYER=dplay_0001000402040500 +3 DPMSG_GENERIC=dplay_0001000402040600 +3 DPMSG_GROUPADD=dplay_0001000402040700 +3 DPMSG_GROUPDELETE=dplay_0001000402040800 +2 Return Values=dplay_0001000402050000 +1 Direct3D +2 Direct3D Overview +3 Microsoft's 3D-Graphics Solutions +3 Microsoft's 3D-Graphics Solutions=3dchoice_0001000501010000 +3 Direct3D=3dchoice_0001000501010100 +3 DirectDraw=3dchoice_0001000501010200 +3 OpenGL=3dchoice_0001000501010300 +3 Direct3D Architecture +3 The Direct3D Vision=d3dintro_0001000501020100 +3 Rendering Engine=d3dintro_0001000501020200 +3 Execute Buffers=d3dintro_0001000501020300 +3 Transformation Module=d3dintro_0001000501020400 +3 Lighting Module=d3dintro_0001000501020500 +3 Rasterization Module=d3dintro_0001000501020600 +3 Colors and Fog=d3dintro_0001000501020700 +3 States and State Overrides=d3dintro_0001000501020800 +3 Direct3D File Format=d3dintro_0001000501020900 +3 A Technical Foundation for 3D Programming +3 A Technical Foundation for 3D Programming=rmmath_0001000501030000 +3 3D Coordinate Systems=rmmath_0001000501030100 +3 3D Transformations=rmmath_0001000501030200 +3 Polygons=rmmath_0001000501030300 +3 Triangle Strips and Fans=rmmath_0001000501030400 +3 Vectors and Quaternions=rmmath_0001000501030500 +3 Floating-point Precision=rmmath_0001000501030600 +3 Performance Optimization +3 Performance Optimization=perfopt_0001000501040000 +3 Clip Tests on Execution=perfopt_0001000501040100 +3 Batching Primitives=perfopt_0001000501040200 +3 Texture Size=perfopt_0001000501040300 +3 Triangle Flags=perfopt_0001000501040400 +3 Ramp Performance Tips=perfopt_0001000501040500 +3 Ramp Textures=perfopt_0001000501040600 +3 Z-Buffers=perfopt_0001000501040700 +3 Copy Mode=perfopt_0001000501040800 +2 Retained-Mode Overview +2 About Retained Mode=rmabout_0001000502010000 +3 Introduction to Direct3D Retained-Mode Objects +3 Introduction to Direct3D Retained-Mode Objects=rmobject_0001000502020000 +3 Objects and Interfaces=rmobject_0001000502020100 +3 Objects and Reference Counting=rmobject_0001000502020200 +3 Direct3DRMAnimation and Direct3DRMAnimationSet=rmobject_0001000502020300 +3 Direct3DRMDevice and Direct3DRMDeviceArray=rmobject_0001000502020400 +3 Direct3DRMFace and Direct3DRMFaceArray=rmobject_0001000502020500 +3 Direct3DRMFrame and Direct3DRMFrameArray=rmobject_0001000502020600 +3 Direct3DRMLight and Direct3DRMLightArray=rmobject_0001000502020700 +3 Direct3DRMMaterial=rmobject_0001000502020800 +3 Direct3DRMMesh and Direct3DRMMeshBuilder=rmobject_0001000502020900 +3 Direct3DRMObject=rmobject_0001000502020a00 +3 Direct3DRMPickedArray=rmobject_0001000502020b00 +3 Direct3DRMShadow=rmobject_0001000502020c00 +3 Direct3DRMTexture=rmobject_0001000502020d00 +3 Direct3DRMUserVisual=rmobject_0001000502020e00 +3 Direct3DRMViewport and Direct3DRMViewportArray=rmobject_0001000502020f00 +3 Direct3DRMVisual and Direct3DRMVisualArray=rmobject_0001000502021000 +3 Direct3DRMWrap=rmobject_0001000502021100 +3 Wrapping Types=rmobject_0001000502021200 +3 Direct3D Retained-Mode Tutorial +3 Direct3D Retained-Mode Tutorial=rmtutor_0001000502030000 +3 Setting up the Windows Environment=rmtutor_0001000502030100 +3 Enumerating Direct3D Device Drivers=rmtutor_0001000502030200 +3 Initialization=rmtutor_0001000502030300 +3 Creating a Direct3DRM Device and Viewport=rmtutor_0001000502030400 +3 Setting the Render State=rmtutor_0001000502030500 +3 Setting Up the Virtual Environment=rmtutor_0001000502030600 +3 Setting Up the Lights=rmtutor_0001000502030700 +3 Loading and Adding a Mesh=rmtutor_0001000502030800 +3 Releasing the Direct3DRM Objects=rmtutor_0001000502030900 +3 OverrideDefaults and ReadMouse=rmtutor_0001000502030a00 +3 Rendering into a Viewport=rmtutor_0001000502030b00 +2 Immediate-Mode Overview +2 About Immediate Mode=imabout_0001000503010000 +3 Introduction to Direct3D Immediate-Mode Objects +3 Introduction to Direct3D Immediate-Mode Objects=imobject_0001000503020000 +3 Direct3D Object Types=imobject_0001000503020100 +3 Direct3D Interface Objects=imobject_0001000503020200 +3 Direct3D Device Objects=imobject_0001000503020300 +3 Direct3D Texture Objects=imobject_0001000503020400 +3 Direct3D Material Objects=imobject_0001000503020500 +3 Direct3D Light Objects=imobject_0001000503020600 +3 Direct3D Viewport Objects=imobject_0001000503020700 +3 Direct3D Execute-Buffer Objects=imobject_0001000503020800 +3 Object Connectivity=imobject_0001000503020900 +3 Direct3D Immediate-Mode Tutorial +3 Direct3D Immediate-Mode Tutorial=d3dtutor_0001000503030000 +3 Beginning Initialization=d3dtutor_0001000503030100 +3 Creating DirectDraw and Direct3D Objects=d3dtutor_0001000503030200 +3 Setting Up the Device-Creation Callback Function=d3dtutor_0001000503030300 +3 Initializing the Viewport=d3dtutor_0001000503030400 +3 Setting the Immediate-Mode Render State=d3dtutor_0001000503030500 +3 Completing Initialization=d3dtutor_0001000503030600 +3 Running the Rendering Loop=d3dtutor_0001000503030700 +3 Cleaning Up=d3dtutor_0001000503030800 +2 Retained-Mode Reference +3 Functions +3 Direct3DRMCreate=rmfuncs_0001000504010100 +3 D3DRMColorGetAlpha=rmfuncs_0001000504010200 +3 D3DRMColorGetBlue=rmfuncs_0001000504010300 +3 D3DRMColorGetGreen=rmfuncs_0001000504010400 +3 D3DRMColorGetRed=rmfuncs_0001000504010500 +3 D3DRMCreateColorRGB=rmfuncs_0001000504010600 +3 D3DRMCreateColorRGBA=rmfuncs_0001000504010700 +3 D3DRMFREEFUNCTION=rmfuncs_0001000504010800 +3 D3DRMMALLOCFUNCTION=rmfuncs_0001000504010900 +3 D3DRMMatrixFromQuaternion=rmfuncs_0001000504010a00 +3 D3DRMQuaternionFromRotation=rmfuncs_0001000504010b00 +3 D3DRMQuaternionMultiply=rmfuncs_0001000504010c00 +3 D3DRMQuaternionSlerp=rmfuncs_0001000504010d00 +3 D3DRMREALLOCFUNCTION=rmfuncs_0001000504010e00 +3 D3DRMVectorAdd=rmfuncs_0001000504010f00 +3 D3DRMVectorCrossProduct=rmfuncs_0001000504011000 +3 D3DRMVectorDotProduct=rmfuncs_0001000504011100 +3 D3DRMVectorModulus=rmfuncs_0001000504011200 +3 D3DRMVectorNormalize=rmfuncs_0001000504011300 +3 D3DRMVectorRandom=rmfuncs_0001000504011400 +3 D3DRMVectorReflect=rmfuncs_0001000504011500 +3 D3DRMVectorRotate=rmfuncs_0001000504011600 +3 D3DRMVectorScale=rmfuncs_0001000504011700 +3 D3DRMVectorSubtract=rmfuncs_0001000504011800 +3 Callback Functions +3 D3DRMDEVICEPALETTECALLBACK=rmfuncs_0001000504020100 +3 D3DRMFRAMEMOVECALLBACK=rmfuncs_0001000504020200 +3 D3DRMLOADCALLBACK=rmfuncs_0001000504020300 +3 D3DRMLOADTEXTURECALLBACK=rmfuncs_0001000504020400 +3 D3DRMOBJECTCALLBACK=rmfuncs_0001000504020500 +3 D3DRMUPDATECALLBACK=rmfuncs_0001000504020600 +3 D3DRMUSERVISUALCALLBACK=rmfuncs_0001000504020700 +3 D3DRMWRAPCALLBACK=rmfuncs_0001000504020800 +3 IDirect3DRM Array Interfaces +3 Introduction to Array Interfaces=rmarray_0001000504030100 +3 IDirect3DRMArray Interface Method Groups=rmarray_0001000504030200 +3 IDirect3DRMArray::AddRef=rmarray_0001000504030300 +3 IDirect3DRMArray::GetSize=rmarray_0001000504030400 +3 IDirect3DRMArray::QueryInterface=rmarray_0001000504030500 +3 IDirect3DRMArray::Release=rmarray_0001000504030600 +3 IDirect3DRMDeviceArray Interface Method Groups=rmarray_0001000504030700 +3 IDirect3DRMDeviceArray::AddRef=rmarray_0001000504030800 +3 IDirect3DRMDeviceArray::GetElement=rmarray_0001000504030900 +3 IDirect3DRMDeviceArray::GetSize=rmarray_0001000504030a00 +3 IDirect3DRMDeviceArray::QueryInterface=rmarray_0001000504030b00 +3 IDirect3DRMDeviceArray::Release=rmarray_0001000504030c00 +3 IDirect3DRMFaceArray Interface Method Groups=rmarray_0001000504030d00 +3 IDirect3DRMFaceArray::AddRef=rmarray_0001000504030e00 +3 IDirect3DRMFaceArray::GetElement=rmarray_0001000504030f00 +3 IDirect3DRMFaceArray::GetSize=rmarray_0001000504031000 +3 IDirect3DRMFaceArray::QueryInterface=rmarray_0001000504031100 +3 IDirect3DRMFaceArray::Release=rmarray_0001000504031200 +3 IDirect3DRMFrameArray Interface Method Groups=rmarray_0001000504031300 +3 IDirect3DRMFrameArray::AddRef=rmarray_0001000504031400 +3 IDirect3DRMFrameArray::GetElement=rmarray_0001000504031500 +3 IDirect3DRMFrameArray::GetSize=rmarray_0001000504031600 +3 IDirect3DRMFrameArray::QueryInterface=rmarray_0001000504031700 +3 IDirect3DRMFrameArray::Release=rmarray_0001000504031800 +3 IDirect3DRMLightArray Interface Method Groups=rmarray_0001000504031900 +3 IDirect3DRMLightArray::AddRef=rmarray_0001000504031a00 +3 IDirect3DRMLightArray::GetElement=rmarray_0001000504031b00 +3 IDirect3DRMLightArray::GetSize=rmarray_0001000504031c00 +3 IDirect3DRMLightArray::QueryInterface=rmarray_0001000504031d00 +3 IDirect3DRMLightArray::Release=rmarray_0001000504031e00 +3 IDirect3DRMPickedArray Interface Method Groups=rmarray_0001000504031f00 +3 IDirect3DRMPickedArray::AddRef=rmarray_0001000504032000 +3 IDirect3DRMPickedArray::GetPick=rmarray_0001000504032100 +3 IDirect3DRMPickedArray::GetSize=rmarray_0001000504032200 +3 IDirect3DRMPickedArray::QueryInterface=rmarray_0001000504032300 +3 IDirect3DRMPickedArray::Release=rmarray_0001000504032400 +3 IDirect3DRMViewportArray Interface Method Groups=rmarray_0001000504032500 +3 IDirect3DRMViewportArray::AddRef=rmarray_0001000504032600 +3 IDirect3DRMViewportArray::GetElement=rmarray_0001000504032700 +3 IDirect3DRMViewportArray::GetSize=rmarray_0001000504032800 +3 IDirect3DRMViewportArray::QueryInterface=rmarray_0001000504032900 +3 IDirect3DRMViewportArray::Release=rmarray_0001000504032a00 +3 IDirect3DRMVisualArray Interface Method Groups=rmarray_0001000504032b00 +3 IDirect3DRMVisualArray::AddRef=rmarray_0001000504032c00 +3 IDirect3DRMVisualArray::GetElement=rmarray_0001000504032d00 +3 IDirect3DRMVisualArray::GetSize=rmarray_0001000504032e00 +3 IDirect3DRMVisualArray::QueryInterface=rmarray_0001000504032f00 +3 IDirect3DRMVisualArray::Release=rmarray_0001000504033000 +3 IDirect3DRM Interface +3 IDirect3DRM Interface Method Groups=rmid3drm_0001000504040100 +3 IDirect3DRM::AddRef=rmid3drm_0001000504040200 +3 IDirect3DRM::AddSearchPath=rmid3drm_0001000504040300 +3 IDirect3DRM::CreateAnimation=rmid3drm_0001000504040400 +3 IDirect3DRM::CreateAnimationSet=rmid3drm_0001000504040500 +3 IDirect3DRM::CreateDevice=rmid3drm_0001000504040600 +3 IDirect3DRM::CreateDeviceFromClipper=rmid3drm_0001000504040700 +3 IDirect3DRM::CreateDeviceFromD3D=rmid3drm_0001000504040800 +3 IDirect3DRM::CreateDeviceFromSurface=rmid3drm_0001000504040900 +3 IDirect3DRM::CreateFace=rmid3drm_0001000504040a00 +3 IDirect3DRM::CreateFrame=rmid3drm_0001000504040b00 +3 IDirect3DRM::CreateLight=rmid3drm_0001000504040c00 +3 IDirect3DRM::CreateLightRGB=rmid3drm_0001000504040d00 +3 IDirect3DRM::CreateMaterial=rmid3drm_0001000504040e00 +3 IDirect3DRM::CreateMesh=rmid3drm_0001000504040f00 +3 IDirect3DRM::CreateMeshBuilder=rmid3drm_0001000504041000 +3 IDirect3DRM::CreateObject=rmid3drm_0001000504041100 +3 IDirect3DRM::CreateShadow=rmid3drm_0001000504041200 +3 IDirect3DRM::CreateTexture=rmid3drm_0001000504041300 +3 IDirect3DRM::CreateTextureFromSurface=rmid3drm_0001000504041400 +3 IDirect3DRM::CreateUserVisual=rmid3drm_0001000504041500 +3 IDirect3DRM::CreateViewport=rmid3drm_0001000504041600 +3 IDirect3DRM::CreateWrap=rmid3drm_0001000504041700 +3 IDirect3DRM::EnumerateObjects=rmid3drm_0001000504041800 +3 IDirect3DRM::GetDevices=rmid3drm_0001000504041900 +3 IDirect3DRM::GetNamedObject=rmid3drm_0001000504041a00 +3 IDirect3DRM::GetSearchPath=rmid3drm_0001000504041b00 +3 IDirect3DRM::Load=rmid3drm_0001000504041c00 +3 IDirect3DRM::LoadTexture=rmid3drm_0001000504041d00 +3 IDirect3DRM::LoadTextureFromResource=rmid3drm_0001000504041e00 +3 IDirect3DRM::QueryInterface=rmid3drm_0001000504041f00 +3 IDirect3DRM::Release=rmid3drm_0001000504042000 +3 IDirect3DRM::SetDefaultTextureColors=rmid3drm_0001000504042100 +3 IDirect3DRM::SetDefaultTextureShades=rmid3drm_0001000504042200 +3 IDirect3DRM::SetSearchPath=rmid3drm_0001000504042300 +3 IDirect3DRM::Tick=rmid3drm_0001000504042400 +3 IDirect3DRMAnimation Interface +3 IDirect3DRMAnimation Interface Method Groups=rmanim_0001000504050100 +3 IDirect3DRMAnimation::AddPositionKey=rmanim_0001000504050200 +3 IDirect3DRMAnimation::AddRef=rmanim_0001000504050300 +3 IDirect3DRMAnimation::AddRotateKey=rmanim_0001000504050400 +3 IDirect3DRMAnimation::AddScaleKey=rmanim_0001000504050500 +3 IDirect3DRMAnimation::DeleteKey=rmanim_0001000504050600 +3 IDirect3DRMAnimation::GetOptions=rmanim_0001000504050700 +3 IDirect3DRMAnimation::QueryInterface=rmanim_0001000504050800 +3 IDirect3DRMAnimation::Release=rmanim_0001000504050900 +3 IDirect3DRMAnimation::SetFrame=rmanim_0001000504050a00 +3 IDirect3DRMAnimation::SetOptions=rmanim_0001000504050b00 +3 IDirect3DRMAnimation::SetTime=rmanim_0001000504050c00 +3 IDirect3DRMAnimationSet Interface +3 IDirect3DRMAnimationSet Interface Method Groups=rmanimst_0001000504060100 +3 IDirect3DRMAnimationSet::AddAnimation=rmanimst_0001000504060200 +3 IDirect3DRMAnimationSet::AddRef=rmanimst_0001000504060300 +3 IDirect3DRMAnimationSet::DeleteAnimation=rmanimst_0001000504060400 +3 IDirect3DRMAnimationSet::Load=rmanimst_0001000504060500 +3 IDirect3DRMAnimationSet::QueryInterface=rmanimst_0001000504060600 +3 IDirect3DRMAnimationSet::Release=rmanimst_0001000504060700 +3 IDirect3DRMAnimationSet::SetTime=rmanimst_0001000504060800 +3 IDirect3DRMDevice Interface +3 IDirect3DRMDevice Interface Method Groups=rmdevice_0001000504070100 +3 IDirect3DRMDevice::AddRef=rmdevice_0001000504070200 +3 IDirect3DRMDevice::AddUpdateCallback=rmdevice_0001000504070300 +3 IDirect3DRMDevice::DeleteUpdateCallback=rmdevice_0001000504070400 +3 IDirect3DRMDevice::GetBufferCount=rmdevice_0001000504070500 +3 IDirect3DRMDevice::GetColorModel=rmdevice_0001000504070600 +3 IDirect3DRMDevice::GetDirect3DDevice=rmdevice_0001000504070700 +3 IDirect3DRMDevice::GetDither=rmdevice_0001000504070800 +3 IDirect3DRMDevice::GetHeight=rmdevice_0001000504070900 +3 IDirect3DRMDevice::GetTrianglesDrawn=rmdevice_0001000504070a00 +3 IDirect3DRMDevice::GetQuality=rmdevice_0001000504070b00 +3 IDirect3DRMDevice::GetShades=rmdevice_0001000504070c00 +3 IDirect3DRMDevice::GetTextureQuality=rmdevice_0001000504070d00 +3 IDirect3DRMDevice::GetViewports=rmdevice_0001000504070e00 +3 IDirect3DRMDevice::GetWidth=rmdevice_0001000504070f00 +3 IDirect3DRMDevice::GetWireframeOptions=rmdevice_0001000504071000 +3 IDirect3DRMDevice::Init=rmdevice_0001000504071100 +3 IDirect3DRMDevice::InitFromClipper=rmdevice_0001000504071200 +3 IDirect3DRMDevice::InitFromD3D=rmdevice_0001000504071300 +3 IDirect3DRMDevice::QueryInterface=rmdevice_0001000504071400 +3 IDirect3DRMDevice::Release=rmdevice_0001000504071500 +3 IDirect3DRMDevice::SetBufferCount=rmdevice_0001000504071600 +3 IDirect3DRMDevice::SetDither=rmdevice_0001000504071700 +3 IDirect3DRMDevice::SetQuality=rmdevice_0001000504071800 +3 IDirect3DRMDevice::SetShades=rmdevice_0001000504071900 +3 IDirect3DRMDevice::SetTextureQuality=rmdevice_0001000504071a00 +3 IDirect3DRMDevice::Update=rmdevice_0001000504071b00 +3 IDirect3DRMFace Interface +3 IDirect3DRMFace Interface Method Groups=rmface_0001000504080100 +3 IDirect3DRMFace::AddRef=rmface_0001000504080200 +3 IDirect3DRMFace::AddVertex=rmface_0001000504080300 +3 IDirect3DRMFace::AddVertexAndNormalIndexed=rmface_0001000504080400 +3 IDirect3DRMFace::GetColor=rmface_0001000504080500 +3 IDirect3DRMFace::GetMaterial=rmface_0001000504080600 +3 IDirect3DRMFace::GetNormal=rmface_0001000504080700 +3 IDirect3DRMFace::GetTexture=rmface_0001000504080800 +3 IDirect3DRMFace::GetTextureCoordinateIndex=rmface_0001000504080900 +3 IDirect3DRMFace::GetTextureCoordinates=rmface_0001000504080a00 +3 IDirect3DRMFace::GetTextureTopology=rmface_0001000504080b00 +3 IDirect3DRMFace::GetVertex=rmface_0001000504080c00 +3 IDirect3DRMFace::GetVertexCount=rmface_0001000504080d00 +3 IDirect3DRMFace::GetVertexIndex=rmface_0001000504080e00 +3 IDirect3DRMFace::GetVertices=rmface_0001000504080f00 +3 IDirect3DRMFace::QueryInterface=rmface_0001000504081000 +3 IDirect3DRMFace::Release=rmface_0001000504081100 +3 IDirect3DRMFace::SetColor=rmface_0001000504081200 +3 IDirect3DRMFace::SetColorRGB=rmface_0001000504081300 +3 IDirect3DRMFace::SetMaterial=rmface_0001000504081400 +3 IDirect3DRMFace::SetTexture=rmface_0001000504081500 +3 IDirect3DRMFace::SetTextureCoordinates=rmface_0001000504081600 +3 IDirect3DRMFace::SetTextureTopology=rmface_0001000504081700 +3 IDirect3DRMFrame Interface +3 IDirect3DRMFrame Interface Method Groups=rmframe_0001000504090100 +3 IDirect3DRMFrame::AddChild=rmframe_0001000504090200 +3 IDirect3DRMFrame::AddLight=rmframe_0001000504090300 +3 IDirect3DRMFrame::AddMoveCallback=rmframe_0001000504090400 +3 IDirect3DRMFrame::AddRef=rmframe_0001000504090500 +3 IDirect3DRMFrame::AddRotation=rmframe_0001000504090600 +3 IDirect3DRMFrame::AddScale=rmframe_0001000504090700 +3 IDirect3DRMFrame::AddTransform=rmframe_0001000504090800 +3 IDirect3DRMFrame::AddTranslation=rmframe_0001000504090900 +3 IDirect3DRMFrame::AddVisual=rmframe_0001000504090a00 +3 IDirect3DRMFrame::DeleteChild=rmframe_0001000504090b00 +3 IDirect3DRMFrame::DeleteLight=rmframe_0001000504090c00 +3 IDirect3DRMFrame::DeleteMoveCallback=rmframe_0001000504090d00 +3 IDirect3DRMFrame::DeleteVisual=rmframe_0001000504090e00 +3 IDirect3DRMFrame::GetChildren=rmframe_0001000504090f00 +3 IDirect3DRMFrame::GetColor=rmframe_0001000504091000 +3 IDirect3DRMFrame::GetLights=rmframe_0001000504091100 +3 IDirect3DRMFrame::GetMaterialMode=rmframe_0001000504091200 +3 IDirect3DRMFrame::GetOrientation=rmframe_0001000504091300 +3 IDirect3DRMFrame::GetParent=rmframe_0001000504091400 +3 IDirect3DRMFrame::GetPosition=rmframe_0001000504091500 +3 IDirect3DRMFrame::GetRotation=rmframe_0001000504091600 +3 IDirect3DRMFrame::GetScene=rmframe_0001000504091700 +3 IDirect3DRMFrame::GetSceneBackground=rmframe_0001000504091800 +3 IDirect3DRMFrame::GetSceneBackgroundDepth=rmframe_0001000504091900 +3 IDirect3DRMFrame::GetSceneFogColor=rmframe_0001000504091a00 +3 IDirect3DRMFrame::GetSceneFogEnable=rmframe_0001000504091b00 +3 IDirect3DRMFrame::GetSceneFogMode=rmframe_0001000504091c00 +3 IDirect3DRMFrame::GetSceneFogParams=rmframe_0001000504091d00 +3 IDirect3DRMFrame::GetSortMode=rmframe_0001000504091e00 +3 IDirect3DRMFrame::GetTexture=rmframe_0001000504091f00 +3 IDirect3DRMFrame::GetTextureTopology=rmframe_0001000504092000 +3 IDirect3DRMFrame::GetTransform=rmframe_0001000504092100 +3 IDirect3DRMFrame::GetVelocity=rmframe_0001000504092200 +3 IDirect3DRMFrame::GetVisuals=rmframe_0001000504092300 +3 IDirect3DRMFrame::GetZbufferMode=rmframe_0001000504092400 +3 IDirect3DRMFrame::InverseTransform=rmframe_0001000504092500 +3 IDirect3DRMFrame::Load=rmframe_0001000504092600 +3 IDirect3DRMFrame::LookAt=rmframe_0001000504092700 +3 IDirect3DRMFrame::Move=rmframe_0001000504092800 +3 IDirect3DRMFrame::QueryInterface=rmframe_0001000504092900 +3 IDirect3DRMFrame::Release=rmframe_0001000504092a00 +3 IDirect3DRMFrame::SetColor=rmframe_0001000504092b00 +3 IDirect3DRMFrame::SetColorRGB=rmframe_0001000504092c00 +3 IDirect3DRMFrame::SetMaterialMode=rmframe_0001000504092d00 +3 IDirect3DRMFrame::SetOrientation=rmframe_0001000504092e00 +3 IDirect3DRMFrame::SetPosition=rmframe_0001000504092f00 +3 IDirect3DRMFrame::SetRotation=rmframe_0001000504093000 +3 IDirect3DRMFrame::SetSceneBackground=rmframe_0001000504093100 +3 IDirect3DRMFrame::SetSceneBackgroundDepth=rmframe_0001000504093200 +3 IDirect3DRMFrame::SetSceneBackgroundImage=rmframe_0001000504093300 +3 IDirect3DRMFrame::SetSceneBackgroundRGB=rmframe_0001000504093400 +3 IDirect3DRMFrame::SetSceneFogColor=rmframe_0001000504093500 +3 IDirect3DRMFrame::SetSceneFogEnable=rmframe_0001000504093600 +3 IDirect3DRMFrame::SetSceneFogMode=rmframe_0001000504093700 +3 IDirect3DRMFrame::SetSceneFogParams=rmframe_0001000504093800 +3 IDirect3DRMFrame::SetSortMode=rmframe_0001000504093900 +3 IDirect3DRMFrame::SetTexture=rmframe_0001000504093a00 +3 IDirect3DRMFrame::SetTextureTopology=rmframe_0001000504093b00 +3 IDirect3DRMFrame::SetVelocity=rmframe_0001000504093c00 +3 IDirect3DRMFrame::SetZbufferMode=rmframe_0001000504093d00 +3 IDirect3DRMFrame::Transform=rmframe_0001000504093e00 +3 IDirect3DRMLight Interface +3 IDirect3DRMLight Interface Method Groups=rmlight_00010005040a0100 +3 IDirect3DRMLight::AddRef=rmlight_00010005040a0200 +3 IDirect3DRMLight::GetColor=rmlight_00010005040a0300 +3 IDirect3DRMLight::GetConstantAttenuation=rmlight_00010005040a0400 +3 IDirect3DRMLight::GetEnableFrame=rmlight_00010005040a0500 +3 IDirect3DRMLight::GetLinearAttenuation=rmlight_00010005040a0600 +3 IDirect3DRMLight::GetPenumbra=rmlight_00010005040a0700 +3 IDirect3DRMLight::GetQuadraticAttenuation=rmlight_00010005040a0800 +3 IDirect3DRMLight::GetRange=rmlight_00010005040a0900 +3 IDirect3DRMLight::GetType=rmlight_00010005040a0a00 +3 IDirect3DRMLight::GetUmbra=rmlight_00010005040a0b00 +3 IDirect3DRMLight::QueryInterface=rmlight_00010005040a0c00 +3 IDirect3DRMLight::Release=rmlight_00010005040a0d00 +3 IDirect3DRMLight::SetColor=rmlight_00010005040a0e00 +3 IDirect3DRMLight::SetColorRGB=rmlight_00010005040a0f00 +3 IDirect3DRMLight::SetConstantAttenuation=rmlight_00010005040a1000 +3 IDirect3DRMLight::SetEnableFrame=rmlight_00010005040a1100 +3 IDirect3DRMLight::SetLinearAttenuation=rmlight_00010005040a1200 +3 IDirect3DRMLight::SetPenumbra=rmlight_00010005040a1300 +3 IDirect3DRMLight::SetQuadraticAttenuation=rmlight_00010005040a1400 +3 IDirect3DRMLight::SetRange=rmlight_00010005040a1500 +3 IDirect3DRMLight::SetType=rmlight_00010005040a1600 +3 IDirect3DRMLight::SetUmbra=rmlight_00010005040a1700 +3 IDirect3DRMMaterial Interface +3 IDirect3DRMMaterial Interface Method Groups=rmmatrl_00010005040b0100 +3 IDirect3DRMMaterial::AddRef=rmmatrl_00010005040b0200 +3 IDirect3DRMMaterial::GetEmissive=rmmatrl_00010005040b0300 +3 IDirect3DRMMaterial::GetPower=rmmatrl_00010005040b0400 +3 IDirect3DRMMaterial::GetSpecular=rmmatrl_00010005040b0500 +3 IDirect3DRMMaterial::QueryInterface=rmmatrl_00010005040b0600 +3 IDirect3DRMMaterial::Release=rmmatrl_00010005040b0700 +3 IDirect3DRMMaterial::SetEmissive=rmmatrl_00010005040b0800 +3 IDirect3DRMMaterial::SetPower=rmmatrl_00010005040b0900 +3 IDirect3DRMMaterial::SetSpecular=rmmatrl_00010005040b0a00 +3 IDirect3DRMMesh Interface +3 IDirect3DRMMesh Interface Method Groups=rmmesh_00010005040c0100 +3 IDirect3DRMMesh::AddGroup=rmmesh_00010005040c0200 +3 IDirect3DRMMesh::AddRef=rmmesh_00010005040c0300 +3 IDirect3DRMMesh::GetBox=rmmesh_00010005040c0400 +3 IDirect3DRMMesh::GetGroup=rmmesh_00010005040c0500 +3 IDirect3DRMMesh::GetGroupColor=rmmesh_00010005040c0600 +3 IDirect3DRMMesh::GetGroupCount=rmmesh_00010005040c0700 +3 IDirect3DRMMesh::GetGroupMapping=rmmesh_00010005040c0800 +3 IDirect3DRMMesh::GetGroupMaterial=rmmesh_00010005040c0900 +3 IDirect3DRMMesh::GetGroupQuality=rmmesh_00010005040c0a00 +3 IDirect3DRMMesh::GetGroupTexture=rmmesh_00010005040c0b00 +3 IDirect3DRMMesh::GetVertices=rmmesh_00010005040c0c00 +3 IDirect3DRMMesh::QueryInterface=rmmesh_00010005040c0d00 +3 IDirect3DRMMesh::Release=rmmesh_00010005040c0e00 +3 IDirect3DRMMesh::Scale=rmmesh_00010005040c0f00 +3 IDirect3DRMMesh::SetGroupColor=rmmesh_00010005040c1000 +3 IDirect3DRMMesh::SetGroupColorRGB=rmmesh_00010005040c1100 +3 IDirect3DRMMesh::SetGroupMapping=rmmesh_00010005040c1200 +3 IDirect3DRMMesh::SetGroupMaterial=rmmesh_00010005040c1300 +3 IDirect3DRMMesh::SetGroupQuality=rmmesh_00010005040c1400 +3 IDirect3DRMMesh::SetGroupTexture=rmmesh_00010005040c1500 +3 IDirect3DRMMesh::SetVertices=rmmesh_00010005040c1600 +3 IDirect3DRMMesh::Translate=rmmesh_00010005040c1700 +3 IDirect3DRMMeshBuilder Interface +3 IDirect3DRMMeshBuilder Interface Method Groups=rmmshbld_00010005040d0100 +3 IDirect3DRMMeshBuilder::AddFace=rmmshbld_00010005040d0200 +3 IDirect3DRMMeshBuilder::AddFaces=rmmshbld_00010005040d0300 +3 IDirect3DRMMeshBuilder::AddFrame=rmmshbld_00010005040d0400 +3 IDirect3DRMMeshBuilder::AddMesh=rmmshbld_00010005040d0500 +3 IDirect3DRMMeshBuilder::AddMeshBuilder=rmmshbld_00010005040d0600 +3 IDirect3DRMMeshBuilder::AddNormal=rmmshbld_00010005040d0700 +3 IDirect3DRMMeshBuilder::AddRef=rmmshbld_00010005040d0800 +3 IDirect3DRMMeshBuilder::AddVertex=rmmshbld_00010005040d0900 +3 IDirect3DRMMeshBuilder::CreateFace=rmmshbld_00010005040d0a00 +3 IDirect3DRMMeshBuilder::CreateMesh=rmmshbld_00010005040d0b00 +3 IDirect3DRMMeshBuilder::GenerateNormals=rmmshbld_00010005040d0c00 +3 IDirect3DRMMeshBuilder::GetBox=rmmshbld_00010005040d0d00 +3 IDirect3DRMMeshBuilder::GetColorSource=rmmshbld_00010005040d0e00 +3 IDirect3DRMMeshBuilder::GetFaceCount=rmmshbld_00010005040d0f00 +3 IDirect3DRMMeshBuilder::GetFaces=rmmshbld_00010005040d1000 +3 IDirect3DRMMeshBuilder::GetPerspective=rmmshbld_00010005040d1100 +3 IDirect3DRMMeshBuilder::GetQuality=rmmshbld_00010005040d1200 +3 IDirect3DRMMeshBuilder::GetTextureCoordinates=rmmshbld_00010005040d1300 +3 IDirect3DRMMeshBuilder::GetVertexColor=rmmshbld_00010005040d1400 +3 IDirect3DRMMeshBuilder::GetVertexCount=rmmshbld_00010005040d1500 +3 IDirect3DRMMeshBuilder::GetVertices=rmmshbld_00010005040d1600 +3 IDirect3DRMMeshBuilder::Load=rmmshbld_00010005040d1700 +3 IDirect3DRMMeshBuilder::QueryInterface=rmmshbld_00010005040d1800 +3 IDirect3DRMMeshBuilder::Release=rmmshbld_00010005040d1900 +3 IDirect3DRMMeshBuilder::ReserveSpace=rmmshbld_00010005040d1a00 +3 IDirect3DRMMeshBuilder::Save=rmmshbld_00010005040d1b00 +3 IDirect3DRMMeshBuilder::Scale=rmmshbld_00010005040d1c00 +3 IDirect3DRMMeshBuilder::SetColor=rmmshbld_00010005040d1d00 +3 IDirect3DRMMeshBuilder::SetColorRGB=rmmshbld_00010005040d1e00 +3 IDirect3DRMMeshBuilder::SetColorSource=rmmshbld_00010005040d1f00 +3 IDirect3DRMMeshBuilder::SetMaterial=rmmshbld_00010005040d2000 +3 IDirect3DRMMeshBuilder::SetNormal=rmmshbld_00010005040d2100 +3 IDirect3DRMMeshBuilder::SetPerspective=rmmshbld_00010005040d2200 +3 IDirect3DRMMeshBuilder::SetQuality=rmmshbld_00010005040d2300 +3 IDirect3DRMMeshBuilder::SetTexture=rmmshbld_00010005040d2400 +3 IDirect3DRMMeshBuilder::SetTextureCoordinates=rmmshbld_00010005040d2500 +3 IDirect3DRMMeshBuilder::SetTextureTopology=rmmshbld_00010005040d2600 +3 IDirect3DRMMeshBuilder::SetVertex=rmmshbld_00010005040d2700 +3 IDirect3DRMMeshBuilder::SetVertexColor=rmmshbld_00010005040d2800 +3 IDirect3DRMMeshBuilder::SetVertexColorRGB=rmmshbld_00010005040d2900 +3 IDirect3DRMMeshBuilder::Translate=rmmshbld_00010005040d2a00 +3 IDirect3DRMObject Interface +3 IDirect3DRMObject Interface Method Groups=rmobject_00010005040e0100 +3 IDirect3DRMObject::AddDestroyCallback=rmobject_00010005040e0200 +3 IDirect3DRMObject::AddRef=rmobject_00010005040e0300 +3 IDirect3DRMObject::Clone=rmobject_00010005040e0400 +3 IDirect3DRMObject::DeleteDestroyCallback=rmobject_00010005040e0500 +3 IDirect3DRMObject::GetAppData=rmobject_00010005040e0600 +3 IDirect3DRMObject::GetClassName=rmobject_00010005040e0700 +3 IDirect3DRMObject::GetName=rmobject_00010005040e0800 +3 IDirect3DRMObject::QueryInterface=rmobject_00010005040e0900 +3 IDirect3DRMObject::Release=rmobject_00010005040e0a00 +3 IDirect3DRMObject::SetAppData=rmobject_00010005040e0b00 +3 IDirect3DRMObject::SetName=rmobject_00010005040e0c00 +3 IDirect3DRMShadow Interface +3 IDirect3DRMShadow Interface Method Groups=rmshadow_00010005040f0100 +3 IDirect3DRMShadow::AddRef=rmshadow_00010005040f0200 +3 IDirect3DRMShadow::Init=rmshadow_00010005040f0300 +3 IDirect3DRMShadow::QueryInterface=rmshadow_00010005040f0400 +3 IDirect3DRMShadow::Release=rmshadow_00010005040f0500 +3 IDirect3DRMTexture Interface +3 IDirect3DRMTexture Interface Method Groups=rmtextur_0001000504100100 +3 IDirect3DRMTexture::AddRef=rmtextur_0001000504100200 +3 IDirect3DRMTexture::Changed=rmtextur_0001000504100300 +3 IDirect3DRMTexture::GetColors=rmtextur_0001000504100400 +3 IDirect3DRMTexture::GetDecalOrigin=rmtextur_0001000504100500 +3 IDirect3DRMTexture::GetDecalScale=rmtextur_0001000504100600 +3 IDirect3DRMTexture::GetDecalSize=rmtextur_0001000504100700 +3 IDirect3DRMTexture::GetDecalTransparency=rmtextur_0001000504100800 +3 IDirect3DRMTexture::GetDecalTransparentColor=rmtextur_0001000504100900 +3 IDirect3DRMTexture::GetImage=rmtextur_0001000504100a00 +3 IDirect3DRMTexture::GetShades=rmtextur_0001000504100b00 +3 IDirect3DRMTexture::InitFromFile=rmtextur_0001000504100c00 +3 IDirect3DRMTexture::InitFromResource=rmtextur_0001000504100d00 +3 IDirect3DRMTexture::InitFromSurface=rmtextur_0001000504100e00 +3 IDirect3DRMTexture::QueryInterface=rmtextur_0001000504100f00 +3 IDirect3DRMTexture::Release=rmtextur_0001000504101000 +3 IDirect3DRMTexture::SetColors=rmtextur_0001000504101100 +3 IDirect3DRMTexture::SetDecalOrigin=rmtextur_0001000504101200 +3 IDirect3DRMTexture::SetDecalScale=rmtextur_0001000504101300 +3 IDirect3DRMTexture::SetDecalSize=rmtextur_0001000504101400 +3 IDirect3DRMTexture::SetDecalTransparency=rmtextur_0001000504101500 +3 IDirect3DRMTexture::SetDecalTransparentColor=rmtextur_0001000504101600 +3 IDirect3DRMTexture::SetShades=rmtextur_0001000504101700 +3 IDirect3DRMUserVisual Interface +3 IDirect3DRMUserVisual Interface Method Groups=rmuservz_0001000504110100 +3 IDirect3DRMUserVisual::AddRef=rmuservz_0001000504110200 +3 IDirect3DRMUserVisual::Init=rmuservz_0001000504110300 +3 IDirect3DRMUserVisual::QueryInterface=rmuservz_0001000504110400 +3 IDirect3DRMUserVisual::Release=rmuservz_0001000504110500 +3 IDirect3DRMViewport Interface +3 IDirect3DRMViewport Interface Method Groups=rmviewpt_0001000504120100 +3 IDirect3DRMViewport::AddRef=rmviewpt_0001000504120200 +3 IDirect3DRMViewport::Clear=rmviewpt_0001000504120300 +3 IDirect3DRMViewport::Configure=rmviewpt_0001000504120400 +3 IDirect3DRMViewport::ForceUpdate=rmviewpt_0001000504120500 +3 IDirect3DRMViewport::GetBack=rmviewpt_0001000504120600 +3 IDirect3DRMViewport::GetCamera=rmviewpt_0001000504120700 +3 IDirect3DRMViewport::GetDevice=rmviewpt_0001000504120800 +3 IDirect3DRMViewport::GetDirect3DViewport=rmviewpt_0001000504120900 +3 IDirect3DRMViewport::GetField=rmviewpt_0001000504120a00 +3 IDirect3DRMViewport::GetFront=rmviewpt_0001000504120b00 +3 IDirect3DRMViewport::GetHeight=rmviewpt_0001000504120c00 +3 IDirect3DRMViewport::GetPlane=rmviewpt_0001000504120d00 +3 IDirect3DRMViewport::GetProjection=rmviewpt_0001000504120e00 +3 IDirect3DRMViewport::GetUniformScaling=rmviewpt_0001000504120f00 +3 IDirect3DRMViewport::GetWidth=rmviewpt_0001000504121000 +3 IDirect3DRMViewport::GetX=rmviewpt_0001000504121100 +3 IDirect3DRMViewport::GetY=rmviewpt_0001000504121200 +3 IDirect3DRMViewport::Init=rmviewpt_0001000504121300 +3 IDirect3DRMViewport::InverseTransform=rmviewpt_0001000504121400 +3 IDirect3DRMViewport::Pick=rmviewpt_0001000504121500 +3 IDirect3DRMViewport::QueryInterface=rmviewpt_0001000504121600 +3 IDirect3DRMViewport::Release=rmviewpt_0001000504121700 +3 IDirect3DRMViewport::Render=rmviewpt_0001000504121800 +3 IDirect3DRMViewport::SetBack=rmviewpt_0001000504121900 +3 IDirect3DRMViewport::SetCamera=rmviewpt_0001000504121a00 +3 IDirect3DRMViewport::SetField=rmviewpt_0001000504121b00 +3 IDirect3DRMViewport::SetFront=rmviewpt_0001000504121c00 +3 IDirect3DRMViewport::SetPlane=rmviewpt_0001000504121d00 +3 IDirect3DRMViewport::SetProjection=rmviewpt_0001000504121e00 +3 IDirect3DRMViewport::SetUniformScaling=rmviewpt_0001000504121f00 +3 IDirect3DRMViewport::Transform=rmviewpt_0001000504122000 +3 IDirect3DRMWinDevice Interface +3 IDirect3DRMWinDevice Interface Method Groups=rmwindev_0001000504130100 +3 IDirect3DRMWinDevice::AddRef=rmwindev_0001000504130200 +3 IDirect3DRMWinDevice::HandleActivate=rmwindev_0001000504130300 +3 IDirect3DRMWinDevice::HandlePaint=rmwindev_0001000504130400 +3 IDirect3DRMWinDevice::QueryInterface=rmwindev_0001000504130500 +3 IDirect3DRMWinDevice::Release=rmwindev_0001000504130600 +3 IDirect3DRMWrap Interface +3 IDirect3DRMWrap Interface Method Groups=rmwrap_0001000504140100 +3 IDirect3DRMWrap::AddRef=rmwrap_0001000504140200 +3 IDirect3DRMWrap::Apply=rmwrap_0001000504140300 +3 IDirect3DRMWrap::ApplyRelative=rmwrap_0001000504140400 +3 IDirect3DRMWrap::Init=rmwrap_0001000504140500 +3 IDirect3DRMWrap::QueryInterface=rmwrap_0001000504140600 +3 IDirect3DRMWrap::Release=rmwrap_0001000504140700 +3 Structures +3 D3DRMBOX=rmtypes_0001000504150100 +3 D3DRMIMAGE=rmtypes_0001000504150200 +3 D3DRMLOADMEMORY=rmtypes_0001000504150300 +3 D3DRMLOADRESOURCE=rmtypes_0001000504150400 +3 D3DRMPALETTEENTRY=rmtypes_0001000504150500 +3 D3DRMPICKDESC=rmtypes_0001000504150600 +3 D3DRMQUATERNION=rmtypes_0001000504150700 +3 D3DRMVECTOR4D=rmtypes_0001000504150800 +3 D3DRMVERTEX=rmtypes_0001000504150900 +3 Enumerated Types +3 D3DRMCOLORSOURCE=rmtypes_0001000504160100 +3 D3DRMCOMBINETYPE=rmtypes_0001000504160200 +3 D3DRMFILLMODE=rmtypes_0001000504160300 +3 D3DRMFOGMODE=rmtypes_0001000504160400 +3 D3DRMFRAMECONSTRAINT=rmtypes_0001000504160500 +3 D3DRMLIGHTMODE=rmtypes_0001000504160600 +3 D3DRMLIGHTTYPE=rmtypes_0001000504160700 +3 D3DRMMATERIALMODE=rmtypes_0001000504160800 +3 D3DRMPALETTEFLAGS=rmtypes_0001000504160900 +3 D3DRMPROJECTIONTYPE=rmtypes_0001000504160a00 +3 D3DRMRENDERQUALITY=rmtypes_0001000504160b00 +3 D3DRMSHADEMODE=rmtypes_0001000504160c00 +3 D3DRMSORTMODE=rmtypes_0001000504160d00 +3 D3DRMTEXTUREQUALITY=rmtypes_0001000504160e00 +3 D3DRMUSERVISUALREASON=rmtypes_0001000504160f00 +3 D3DRMWRAPTYPE=rmtypes_0001000504161000 +3 D3DRMXOFFORMAT=rmtypes_0001000504161100 +3 D3DRMZBUFFERMODE=rmtypes_0001000504161200 +3 Other Types +3 D3DRMANIMATIONOPTIONS=rmtypes_0001000504170100 +3 D3DRMCOLORMODEL=rmtypes_0001000504170200 +3 D3DRMLOADOPTIONS=rmtypes_0001000504170300 +3 D3DRMMAPPING=rmtypes_0001000504170400 +3 D3DRMMATRIX4D=rmtypes_0001000504170500 +3 D3DRMSAVEOPTIONS=rmtypes_0001000504170600 +2 Return Values=rmtypes_0001000504180000 +2 Immediate-Mode Reference +3 Macros +3 D3DDivide=d3dapi_0001000505010100 +3 D3DMultiply=d3dapi_0001000505010200 +3 D3DRGB=d3dapi_0001000505010300 +3 D3DRGBA=d3dapi_0001000505010400 +3 D3DSTATE_OVERRIDE=d3dapi_0001000505010500 +3 D3DVAL=d3dapi_0001000505010600 +3 D3DVALP=d3dapi_0001000505010700 +3 RGB_GETBLUE=d3dapi_0001000505010800 +3 RGB_GETGREEN=d3dapi_0001000505010900 +3 RGB_GETRED=d3dapi_0001000505010a00 +3 RGB_MAKE=d3dapi_0001000505010b00 +3 RGB_TORGBA=d3dapi_0001000505010c00 +3 RGBA_GETALPHA=d3dapi_0001000505010d00 +3 RGBA_GETBLUE=d3dapi_0001000505010e00 +3 RGBA_GETGREEN=d3dapi_0001000505010f00 +3 RGBA_GETRED=d3dapi_0001000505011000 +3 RGBA_MAKE=d3dapi_0001000505011100 +3 RGBA_SETALPHA=d3dapi_0001000505011200 +3 RGBA_TORGB=d3dapi_0001000505011300 +3 Callback Functions +3 D3DENUMDEVICESCALLBACK=d3dapi_0001000505020100 +3 D3DENUMTEXTUREFORMATSCALLBACK=d3dapi_0001000505020200 +3 D3DVALIDATECALLBACK=d3dapi_0001000505020300 +3 IDirect3D Interface +3 IDirect3D Interface Method Groups=id3dapi_0001000505030100 +3 IDirect3D::AddRef=id3dapi_0001000505030200 +3 IDirect3D::CreateLight=id3dapi_0001000505030300 +3 IDirect3D::CreateMaterial=id3dapi_0001000505030400 +3 IDirect3D::CreateViewport=id3dapi_0001000505030500 +3 IDirect3D::EnumDevices=id3dapi_0001000505030600 +3 IDirect3D::FindDevice=id3dapi_0001000505030700 +3 IDirect3D::Initialize=id3dapi_0001000505030800 +3 IDirect3D::QueryInterface=id3dapi_0001000505030900 +3 IDirect3D::Release=id3dapi_0001000505030a00 +3 IDirect3DDevice Interface +3 IDirect3DDevice Interface Method Groups=id3ddevc_0001000505040100 +3 IDirect3DDevice::AddRef=id3ddevc_0001000505040200 +3 IDirect3DDevice::AddViewport=id3ddevc_0001000505040300 +3 IDirect3DDevice::BeginScene=id3ddevc_0001000505040400 +3 IDirect3DDevice::CreateExecuteBuffer=id3ddevc_0001000505040500 +3 IDirect3DDevice::CreateMatrix=id3ddevc_0001000505040600 +3 IDirect3DDevice::DeleteMatrix=id3ddevc_0001000505040700 +3 IDirect3DDevice::DeleteViewport=id3ddevc_0001000505040800 +3 IDirect3DDevice::EndScene=id3ddevc_0001000505040900 +3 IDirect3DDevice::EnumTextureFormats=id3ddevc_0001000505040a00 +3 IDirect3DDevice::Execute=id3ddevc_0001000505040b00 +3 IDirect3DDevice::GetCaps=id3ddevc_0001000505040c00 +3 IDirect3DDevice::GetDirect3D=id3ddevc_0001000505040d00 +3 IDirect3DDevice::GetMatrix=id3ddevc_0001000505040e00 +3 IDirect3DDevice::GetPickRecords=id3ddevc_0001000505040f00 +3 IDirect3DDevice::GetStats=id3ddevc_0001000505041000 +3 IDirect3DDevice::Initialize=id3ddevc_0001000505041100 +3 IDirect3DDevice::NextViewport=id3ddevc_0001000505041200 +3 IDirect3DDevice::Pick=id3ddevc_0001000505041300 +3 IDirect3DDevice::QueryInterface=id3ddevc_0001000505041400 +3 IDirect3DDevice::Release=id3ddevc_0001000505041500 +3 IDirect3DDevice::SetMatrix=id3ddevc_0001000505041600 +3 IDirect3DDevice::SwapTextureHandles=id3ddevc_0001000505041700 +3 IDirect3DExecuteBuffer Interface +3 IDirect3DExecuteBuffer Interface Method Groups=id3dexbf_0001000505050100 +3 IDirect3DExecuteBuffer::AddRef=id3dexbf_0001000505050200 +3 IDirect3DExecuteBuffer::GetExecuteData=id3dexbf_0001000505050300 +3 IDirect3DExecuteBuffer::Initialize=id3dexbf_0001000505050400 +3 IDirect3DExecuteBuffer::Lock=id3dexbf_0001000505050500 +3 IDirect3DExecuteBuffer::Optimize=id3dexbf_0001000505050600 +3 IDirect3DExecuteBuffer::QueryInterface=id3dexbf_0001000505050700 +3 IDirect3DExecuteBuffer::Release=id3dexbf_0001000505050800 +3 IDirect3DExecuteBuffer::SetExecuteData=id3dexbf_0001000505050900 +3 IDirect3DExecuteBuffer::Unlock=id3dexbf_0001000505050a00 +3 IDirect3DExecuteBuffer::Validate=id3dexbf_0001000505050b00 +3 IDirect3DLight Interface +3 IDirect3DLight Interface Method Groups=id3dlite_0001000505060100 +3 IDirect3DLight::AddRef=id3dlite_0001000505060200 +3 IDirect3DLight::GetLight=id3dlite_0001000505060300 +3 IDirect3DLight::Initialize=id3dlite_0001000505060400 +3 IDirect3DLight::QueryInterface=id3dlite_0001000505060500 +3 IDirect3DLight::Release=id3dlite_0001000505060600 +3 IDirect3DLight::SetLight=id3dlite_0001000505060700 +3 IDirect3DMaterial Interface +3 IDirect3DMaterial Interface Method Groups=id3dmat_0001000505070100 +3 IDirect3DMaterial::AddRef=id3dmat_0001000505070200 +3 IDirect3DMaterial::GetHandle=id3dmat_0001000505070300 +3 IDirect3DMaterial::GetMaterial=id3dmat_0001000505070400 +3 IDirect3DMaterial::Initialize=id3dmat_0001000505070500 +3 IDirect3DMaterial::QueryInterface=id3dmat_0001000505070600 +3 IDirect3DMaterial::Release=id3dmat_0001000505070700 +3 IDirect3DMaterial::Reserve=id3dmat_0001000505070800 +3 IDirect3DMaterial::SetMaterial=id3dmat_0001000505070900 +3 IDirect3DMaterial::Unreserve=id3dmat_0001000505070a00 +3 IDirect3DTexture Interface +3 IDirect3DTexture Interface Method Groups=id3dtext_0001000505080100 +3 IDirect3DTexture::AddRef=id3dtext_0001000505080200 +3 IDirect3DTexture::GetHandle=id3dtext_0001000505080300 +3 IDirect3DTexture::Initialize=id3dtext_0001000505080400 +3 IDirect3DTexture::Load=id3dtext_0001000505080500 +3 IDirect3DTexture::PaletteChanged=id3dtext_0001000505080600 +3 IDirect3DTexture::QueryInterface=id3dtext_0001000505080700 +3 IDirect3DTexture::Release=id3dtext_0001000505080800 +3 IDirect3DTexture::Unload=id3dtext_0001000505080900 +3 IDirect3DViewport Interface +3 IDirect3DViewport Interface Method Groups=id3dview_0001000505090100 +3 IDirect3DViewport::AddLight=id3dview_0001000505090200 +3 IDirect3DViewport::AddRef=id3dview_0001000505090300 +3 IDirect3DViewport::Clear=id3dview_0001000505090400 +3 IDirect3DViewport::DeleteLight=id3dview_0001000505090500 +3 IDirect3DViewport::GetBackground=id3dview_0001000505090600 +3 IDirect3DViewport::GetBackgroundDepth=id3dview_0001000505090700 +3 IDirect3DViewport::GetViewport=id3dview_0001000505090800 +3 IDirect3DViewport::Initialize=id3dview_0001000505090900 +3 IDirect3DViewport::LightElements=id3dview_0001000505090a00 +3 IDirect3DViewport::NextLight=id3dview_0001000505090b00 +3 IDirect3DViewport::QueryInterface=id3dview_0001000505090c00 +3 IDirect3DViewport::Release=id3dview_0001000505090d00 +3 IDirect3DViewport::SetBackground=id3dview_0001000505090e00 +3 IDirect3DViewport::SetBackgroundDepth=id3dview_0001000505090f00 +3 IDirect3DViewport::SetViewport=id3dview_0001000505091000 +3 IDirect3DViewport::TransformVertices=id3dview_0001000505091100 +3 Structures +3 D3DBRANCH=id3dtype_00010005050a0100 +3 D3DCOLORVALUE=id3dtype_00010005050a0200 +3 D3DDEVICEDESC=id3dtype_00010005050a0300 +3 D3DEXECUTEBUFFERDESC=id3dtype_00010005050a0400 +3 D3DEXECUTEDATA=id3dtype_00010005050a0500 +3 D3DFINDDEVICERESULT=id3dtype_00010005050a0600 +3 D3DFINDDEVICESEARCH=id3dtype_00010005050a0700 +3 D3DHVERTEX=id3dtype_00010005050a0800 +3 D3DINSTRUCTION=id3dtype_00010005050a0900 +3 D3DLIGHT=id3dtype_00010005050a0a00 +3 D3DLIGHTDATA=id3dtype_00010005050a0b00 +3 D3DLIGHTINGCAPS=id3dtype_00010005050a0c00 +3 D3DLIGHTINGELEMENT=id3dtype_00010005050a0d00 +3 D3DLINE=id3dtype_00010005050a0e00 +3 D3DLINEPATTERN=id3dtype_00010005050a0f00 +3 D3DLVERTEX=id3dtype_00010005050a1000 +3 D3DMATERIAL=id3dtype_00010005050a1100 +3 D3DMATRIX=id3dtype_00010005050a1200 +3 D3DMATRIXLOAD=id3dtype_00010005050a1300 +3 D3DMATRIXMULTIPLY=id3dtype_00010005050a1400 +3 D3DPICKRECORD=id3dtype_00010005050a1500 +3 D3DPOINT=id3dtype_00010005050a1600 +3 D3DPRIMCAPS=id3dtype_00010005050a1700 +3 D3DPROCESSVERTICES=id3dtype_00010005050a1800 +3 D3DRECT=id3dtype_00010005050a1900 +3 D3DSPAN=id3dtype_00010005050a1a00 +3 D3DSTATE=id3dtype_00010005050a1b00 +3 D3DSTATS=id3dtype_00010005050a1c00 +3 D3DSTATUS=id3dtype_00010005050a1d00 +3 D3DTEXTURELOAD=id3dtype_00010005050a1e00 +3 D3DTLVERTEX=id3dtype_00010005050a1f00 +3 D3DTRANSFORMCAPS=id3dtype_00010005050a2000 +3 D3DTRANSFORMDATA=id3dtype_00010005050a2100 +3 D3DTRIANGLE=id3dtype_00010005050a2200 +3 D3DVECTOR=id3dtype_00010005050a2300 +3 D3DVERTEX=id3dtype_00010005050a2400 +3 D3DVIEWPORT=id3dtype_00010005050a2500 +3 Enumerated Types +3 D3DBLEND=id3dtype_00010005050b0100 +3 D3DCMPFUNC=id3dtype_00010005050b0200 +3 D3DCOLORMODEL=id3dtype_00010005050b0300 +3 D3DCULL=id3dtype_00010005050b0400 +3 D3DFILLMODE=id3dtype_00010005050b0500 +3 D3DFOGMODE=id3dtype_00010005050b0600 +3 D3DLIGHTSTATETYPE=id3dtype_00010005050b0700 +3 D3DLIGHTTYPE=id3dtype_00010005050b0800 +3 D3DOPCODE=id3dtype_00010005050b0900 +3 D3DRENDERSTATETYPE=id3dtype_00010005050b0a00 +3 D3DSHADEMODE=id3dtype_00010005050b0b00 +3 D3DTEXTUREADDRESS=id3dtype_00010005050b0c00 +3 D3DTEXTUREBLEND=id3dtype_00010005050b0d00 +3 D3DTEXTUREFILTER=id3dtype_00010005050b0e00 +3 D3DTRANSFORMSTATETYPE=id3dtype_00010005050b0f00 +3 Other Types +3 D3DCOLOR=id3dtype_00010005050c0100 +3 D3DVALUE=id3dtype_00010005050c0200 +2 Return Values=id3dtype_00010005050d0000 +1 DirectInput +2 Overview +2 Introduction to Joysticks=dinput_0001000601010000 +2 Joystick Capabilities=dinput_0001000601020000 +2 Joystick Calibration and Testing=dinput_0001000601030000 +2 Joystick Position=dinput_0001000601040000 +2 Reference +2 Joystick Groups=dinput_0001000602010000 +3 Functions +3 joyConfigChanged=dinput_0001000602020100 +3 joyGetDevCaps=dinput_0001000602020200 +3 joyGetNumDevs=dinput_0001000602020300 +3 joyGetPosEx=dinput_0001000602020400 +3 Structures +3 JOYCAPS=dinput_0001000602030100 +3 JOYINFOEX=dinput_0001000602030200 +2 Return Values=dinput_0001000602040000 +1 DirectSetup +2 Overview +2 About DirectSetup=dsetup_0001000701010000 +2 Using DirectSetup=dsetup_0001000701020000 +2 Reference +3 Functions +3 Functions=dsetup_0001000702010000 +3 DirectXSetup=dsetup_0001000702010100 +1 AutoPlay +2 Overview +2 About AutoPlay=autoplay_0001000801010000 +2 How AutoPlay Works=autoplay_0001000801020000 +2 The Autorun.inf File=autoplay_0001000801030000 +3 Tips for Writing AutoPlay Applications +3 Opening a Startup Application=autoplay_0001000801040100 +3 Loading in the Background=autoplay_0001000801040200 +3 Conserving Hard Disk Space=autoplay_0001000801040300 +3 Using the Registry=autoplay_0001000801040400 +3 Setting the NoDriveTypeAutoRun Value=autoplay_0001000801040500 +2 Suppressing AutoPlay=autoplay_0001000801050000 +2 AutoPlay for MS-DOS-Based Applications=autoplay_0001000801060000 +2 Reference +2 defaulticon=autoplay_0001000802000100 +2 icon=autoplay_0001000802000200 +2 open=autoplay_0001000802000300 +2 shell=autoplay_0001000802000400 +2 shell\verb=autoplay_0001000802000500 diff --git a/docs/winhelp/archive/directx2/directx.hlp b/docs/winhelp/archive/directx2/directx.hlp new file mode 100644 index 0000000..e0814fb Binary files /dev/null and b/docs/winhelp/archive/directx2/directx.hlp differ diff --git a/docs/winhelp/archive/readme.txt b/docs/winhelp/archive/readme.txt new file mode 100644 index 0000000..94e83be --- /dev/null +++ b/docs/winhelp/archive/readme.txt @@ -0,0 +1,9 @@ +This directory contains an archive of the documentation for both the +Microsoft Game SDK and Microsoft DirectX 2 SDK. The Game SDK information +is located in the \DIRECTX1 directory. The DirectX 2 SDK information +is located in the \DIRECTX2 directory. + +The information found in these directories is not directly related +to the documentation for the DirectX 3 SDK. However, it is included here +in case you need information about previous versions of a COM interface. + diff --git a/docs/winhelp/directx.GID b/docs/winhelp/directx.GID new file mode 100644 index 0000000..96e0be2 Binary files /dev/null and b/docs/winhelp/directx.GID differ diff --git a/docs/winhelp/directx.cnt b/docs/winhelp/directx.cnt new file mode 100644 index 0000000..beff53f --- /dev/null +++ b/docs/winhelp/directx.cnt @@ -0,0 +1,1332 @@ +:base directx.hlp +:title Microsoft DirectX 3 SDK +:link directx.hlp +:link selfsame +1 Copyrights and Trademarks=legal_0001000000000001 +1 Introducing DirectX 3 +2 DirectX Goals +2 DirectX Goals=dxintro_0001010101000000 +2 Benefits of Developing DirectX Windows Applications=dxintro_0001010101010000 +2 Providing Guidelines for Hardware Development=dxintro_0001010101020000 +2 The DirectX SDK +2 The DirectX SDK=dxintro_0001010102000000 +2 DirectX SDK Components=dxintro_0001010102010000 +2 Using Macro Definitions=dxintro_0001010102020000 +2 DirectX and the Component Object Model +2 DirectX and the Component Object Model=dxintro_0001010103000000 +2 The Component Object Model=dxintro_0001010103010000 +3 IUnknown Interface +3 IUnknown Interface=dxintro_0001010103020000 +3 IUnknown::AddRef=dxintro_0001010103020100 +3 IUnknown::QueryInterface=dxintro_0001010103020200 +3 IUnknown::Release=dxintro_0001010103020300 +2 DirectX COM Interfaces=dxintro_0001010103030000 +2 C++ and the COM Interface=dxintro_0001010103040000 +2 Accessing COM Objects by Using C=dxintro_0001010103050000 +2 Interface Method Names and Syntax=dxintro_0001010103060000 +1 What's New in the DirectX 3 SDK?=dxintro_0001010104000000 +1 Conventions=dxintro_0001010105000000 +1 DirectDraw +1 About DirectDraw=ddoverv_0001010201000000 +1 DirectDraw Architecture=ddoverv_0001010202000000 +2 DirectDraw Overview +2 DirectDraw Overview=ddoverv_0001010203000000 +2 DirectDraw=ddoverv_0001010203010000 +2 Other DirectDraw Features=ddoverv_0001010203020000 +2 DirectDraw HAL=ddoverv_0001010203030000 +2 DirectDraw HEL=ddoverv_0001010203040000 +2 Types of DirectDraw Objects=ddoverv_0001010203050000 +2 Width and Pitch=ddoverv_0001010203060000 +3 Support for 3D Surfaces +3 Support for 3D Surfaces=ddoverv_0001010203070000 +3 Texture Maps=ddoverv_0001010203070100 +3 Mipmaps=ddoverv_0001010203070200 +3 Z-Buffers=ddoverv_0001010203070300 +3 Direct3D Integration with DirectDraw +3 Direct3D Integration with DirectDraw=ddoverv_0001010203080000 +3 Direct3D Driver Interface=ddoverv_0001010203080100 +3 Direct3D Device Interface=ddoverv_0001010203080200 +3 Direct3D Texture Interface=ddoverv_0001010203080300 +3 DirectDraw HEL and Direct3D=ddoverv_0001010203080400 +2 Mode X Display Mode=ddoverv_0001010203090000 +3 Pixel Formats +3 Pixel Formats=ddoverv_00010102030a0000 +3 Texture Map Formats=ddoverv_00010102030a0100 +3 Off-Screen Surface Formats=ddoverv_00010102030a0200 +2 DirectDraw Interface Overviews +2 DirectDraw Interface Overviews=ddoverv_0001010204000000 +3 IDirectDraw2 Interface +3 IDirectDraw2 Interface=ddoverv_0001010204010000 +3 DirectDraw Objects=ddoverv_0001010204010100 +3 What's New in IDirectDraw2?=ddoverv_0001010204010200 +3 Multiple DirectDraw Objects per Process=ddoverv_0001010204010300 +3 Support for High Resolutions and True-Color Bit Depths=ddoverv_0001010204010400 +3 Primary Surface Resource Sharing Model=ddoverv_0001010204010500 +3 Changing Modes and Exclusive Access=ddoverv_0001010204010600 +3 Creating DirectDraw Objects by Using CoCreateInstance=ddoverv_0001010204010700 +3 IDirectDrawClipper Interface +3 IDirectDrawClipper Interface=ddoverv_0001010204020000 +3 Clip Lists=ddoverv_0001010204020100 +3 Sharing DirectDrawClipper Objects=ddoverv_0001010204020200 +3 Driver-Independent DirectDrawClipper Objects=ddoverv_0001010204020300 +3 Creating DirectDrawClipper Objects with CoCreateInstance=ddoverv_0001010204020400 +3 IDirectDrawPalette Interface +3 IDirectDrawPalette Interface=ddoverv_0001010204030000 +3 DirectDrawPalette Objects=ddoverv_0001010204030100 +3 Setting Palettes on Non-Primary Surfaces=ddoverv_0001010204030200 +3 Sharing Palettes=ddoverv_0001010204030300 +3 Palette Types=ddoverv_0001010204030400 +3 Using DirectDraw Palettes in Windowed Mode=ddoverv_0001010204030500 +3 IDirectDrawSurface2 Interface +3 IDirectDrawSurface2 Interface=ddoverv_0001010204040000 +3 DirectDrawSurface Objects=ddoverv_0001010204040100 +3 What's New in IDirectDrawSurface2?=ddoverv_0001010204040200 +3 Creating Surfaces=ddoverv_0001010204040300 +3 Frame-Buffer Access=ddoverv_0001010204040400 +3 Flipping Surfaces and GDI's Frame Rate=ddoverv_0001010204040500 +3 Losing Surfaces=ddoverv_0001010204040600 +3 Color and Format Conversion=ddoverv_0001010204040700 +3 Color Keying=ddoverv_0001010204040800 +3 Overlay Z-Order=ddoverv_0001010204040900 +3 Multiple Palettes for Off-Screen Surfaces=ddoverv_0001010204040a00 +3 Blitting to and from System Memory Surfaces=ddoverv_0001010204040b00 +2 DirectDraw Tutorials +2 DirectDraw Tutorials=ddoverv_0001010205000000 +3 Tutorial 1: The Basics of DirectDraw +3 Tutorial 1: The Basics of DirectDraw=ddoverv_0001010205010000 +3 Step 1: Creating a DirectDraw Object=ddoverv_0001010205010100 +3 Step 2: Determining the Application's Behavior=ddoverv_0001010205010200 +3 Step 3: Changing the Display Mode=ddoverv_0001010205010300 +3 Step 4: Creating Flipping Surfaces=ddoverv_0001010205010400 +3 Step 5: Rendering to the Surfaces=ddoverv_0001010205010500 +3 Step 6: Writing to the Surface=ddoverv_0001010205010600 +3 Step 7: Flipping the Surfaces=ddoverv_0001010205010700 +3 Step 8: Deallocating the DirectDraw Objects=ddoverv_0001010205010800 +3 Tutorial 2: Loading Bitmaps on the Back Buffer +3 Tutorial 2: Loading Bitmaps on the Back Buffer=ddoverv_0001010205020000 +3 Step 1: Creating the Palette=ddoverv_0001010205020100 +3 Step 2: Setting the Palette=ddoverv_0001010205020200 +3 Step 3: Loading a Bitmap on the Back Buffer=ddoverv_0001010205020300 +3 Step 4: Flipping the Surfaces=ddoverv_0001010205020400 +3 Tutorial 3: Blitting from an Off-Screen Surface +3 Tutorial 3: Blitting from an Off-Screen Surface=ddoverv_0001010205030000 +3 Step 1: Creating the Off-Screen Surfaces=ddoverv_0001010205030100 +3 Step 2: Loading the Bitmaps to the Off-Screen Surfaces=ddoverv_0001010205030200 +3 Step 3: Blitting the Off-Screen Surfaces to the Back Buffer=ddoverv_0001010205030300 +3 Tutorial 4: Color Keys and Bitmap Animation +3 Tutorial 4: Color Keys and Bitmap Animation=ddoverv_0001010205040000 +3 Step 1: Setting the Color Key=ddoverv_0001010205040100 +3 Step 2: Creating a Simple Animation=ddoverv_0001010205040200 +3 Tutorial 5: Dynamically Modifying Palettes +3 Tutorial 5: Dynamically Modifying Palettes=ddoverv_0001010205050000 +3 Step 1: Loading the Palette Entries=ddoverv_0001010205050100 +3 Step 2: Rotating the Palettes=ddoverv_0001010205050200 +2 Other DirectDraw Samples=ddoverv_0001010205060000 +3 Optimizations and Customizations +3 Optimizations and Customizations=ddoverv_0001010205070000 +3 Getting the Flip and Blit Status=ddoverv_0001010205070100 +3 Blitting with Color Fill=ddoverv_0001010205070200 +3 Determining the Capabilities of the Display Hardware=ddoverv_0001010205070300 +3 Storing Bitmaps in Display Memory=ddoverv_0001010205070400 +3 Triple Buffering=ddoverv_0001010205070500 +2 DirectDraw Reference +3 Functions +3 DirectDrawCreate=ddref_0001010206010100 +3 DirectDrawCreateClipper=ddref_0001010206010200 +3 DirectDrawEnumerate=ddref_0001010206010300 +3 Callback Functions +3 Callback=ddref_0001010206020100 +3 EnumModesCallback=ddref_0001010206020200 +3 EnumSurfacesCallback=ddref_0001010206020300 +3 fnCallback=ddref_0001010206020400 +3 IDirectDraw2 +3 IDirectDraw2=ddref_0001010206030000 +3 IDirectDraw2::Compact=ddref_0001010206030100 +3 IDirectDraw2::CreateClipper=ddref_0001010206030200 +3 IDirectDraw2::CreatePalette=ddref_0001010206030300 +3 IDirectDraw2::CreateSurface=ddref_0001010206030400 +3 IDirectDraw2::DuplicateSurface=ddref_0001010206030500 +3 IDirectDraw2::EnumDisplayModes=ddref_0001010206030600 +3 IDirectDraw2::EnumSurfaces=ddref_0001010206030700 +3 IDirectDraw2::FlipToGDISurface=ddref_0001010206030800 +3 IDirectDraw2::GetAvailableVidMem=ddref_0001010206030900 +3 IDirectDraw2::GetCaps=ddref_0001010206030a00 +3 IDirectDraw2::GetDisplayMode=ddref_0001010206030b00 +3 IDirectDraw2::GetFourCCCodes=ddref_0001010206030c00 +3 IDirectDraw2::GetGDISurface=ddref_0001010206030d00 +3 IDirectDraw2::GetMonitorFrequency=ddref_0001010206030e00 +3 IDirectDraw2::GetScanLine=ddref_0001010206030f00 +3 IDirectDraw2::GetVerticalBlankStatus=ddref_0001010206031000 +3 IDirectDraw2::Initialize=ddref_0001010206031100 +3 IDirectDraw2::RestoreDisplayMode=ddref_0001010206031200 +3 IDirectDraw2::SetCooperativeLevel=ddref_0001010206031300 +3 IDirectDraw2::SetDisplayMode=ddref_0001010206031400 +3 IDirectDraw2::WaitForVerticalBlank=ddref_0001010206031500 +3 IDirectDrawClipper +3 IDirectDrawClipper=ddref_0001010206040000 +3 IDirectDrawClipper::GetClipList=ddref_0001010206040100 +3 IDirectDrawClipper::GetHWnd=ddref_0001010206040200 +3 IDirectDrawClipper::Initialize=ddref_0001010206040300 +3 IDirectDrawClipper::IsClipListChanged=ddref_0001010206040400 +3 IDirectDrawClipper::SetClipList=ddref_0001010206040500 +3 IDirectDrawClipper::SetHWnd=ddref_0001010206040600 +3 IDirectDrawPalette +3 IDirectDrawPalette=ddref_0001010206050000 +3 IDirectDrawPalette::GetCaps=ddref_0001010206050100 +3 IDirectDrawPalette::GetEntries=ddref_0001010206050200 +3 IDirectDrawPalette::Initialize=ddref_0001010206050300 +3 IDirectDrawPalette::SetEntries=ddref_0001010206050400 +3 IDirectDrawSurface2 +3 IDirectDrawSurface2=ddref_0001010206060000 +3 IDirectDrawSurface2::AddAttachedSurface=ddref_0001010206060100 +3 IDirectDrawSurface2::AddOverlayDirtyRect=ddref_0001010206060200 +3 IDirectDrawSurface2::Blt=ddref_0001010206060300 +3 IDirectDrawSurface2::BltBatch=ddref_0001010206060400 +3 IDirectDrawSurface2::BltFast=ddref_0001010206060500 +3 IDirectDrawSurface2::DeleteAttachedSurface=ddref_0001010206060600 +3 IDirectDrawSurface2::EnumAttachedSurfaces=ddref_0001010206060700 +3 IDirectDrawSurface2::EnumOverlayZOrders=ddref_0001010206060800 +3 IDirectDrawSurface2::Flip=ddref_0001010206060900 +3 IDirectDrawSurface2::GetAttachedSurface=ddref_0001010206060a00 +3 IDirectDrawSurface2::GetBltStatus=ddref_0001010206060b00 +3 IDirectDrawSurface2::GetCaps=ddref_0001010206060c00 +3 IDirectDrawSurface2::GetClipper=ddref_0001010206060d00 +3 IDirectDrawSurface2::GetColorKey=ddref_0001010206060e00 +3 IDirectDrawSurface2::GetDC=ddref_0001010206060f00 +3 IDirectDrawSurface2::GetDDInterface=ddref_0001010206061000 +3 IDirectDrawSurface2::GetFlipStatus=ddref_0001010206061100 +3 IDirectDrawSurface2::GetOverlayPosition=ddref_0001010206061200 +3 IDirectDrawSurface2::GetPalette=ddref_0001010206061300 +3 IDirectDrawSurface2::GetPixelFormat=ddref_0001010206061400 +3 IDirectDrawSurface2::GetSurfaceDesc=ddref_0001010206061500 +3 IDirectDrawSurface2::Initialize=ddref_0001010206061600 +3 IDirectDrawSurface2::IsLost=ddref_0001010206061700 +3 IDirectDrawSurface2::Lock=ddref_0001010206061800 +3 IDirectDrawSurface2::PageLock=ddref_0001010206061900 +3 IDirectDrawSurface2::PageUnlock=ddref_0001010206061a00 +3 IDirectDrawSurface2::ReleaseDC=ddref_0001010206061b00 +3 IDirectDrawSurface2::Restore=ddref_0001010206061c00 +3 IDirectDrawSurface2::SetClipper=ddref_0001010206061d00 +3 IDirectDrawSurface2::SetColorKey=ddref_0001010206061e00 +3 IDirectDrawSurface2::SetOverlayPosition=ddref_0001010206061f00 +3 IDirectDrawSurface2::SetPalette=ddref_0001010206062000 +3 IDirectDrawSurface2::Unlock=ddref_0001010206062100 +3 IDirectDrawSurface2::UpdateOverlay=ddref_0001010206062200 +3 IDirectDrawSurface2::UpdateOverlayDisplay=ddref_0001010206062300 +3 IDirectDrawSurface2::UpdateOverlayZOrder=ddref_0001010206062400 +3 Structures +3 DDBLTBATCH=ddref_0001010206070100 +3 DDBLTFX=ddref_0001010206070200 +3 DDCAPS=ddref_0001010206070300 +3 DDCOLORKEY=ddref_0001010206070400 +3 DDOVERLAYFX=ddref_0001010206070500 +3 DDPIXELFORMAT=ddref_0001010206070600 +3 DDSCAPS=ddref_0001010206070700 +3 DDSURFACEDESC=ddref_0001010206070800 +2 Return Values=ddref_0001010206080000 +1 DirectSound +1 About DirectSound=dsound_0001010301000000 +2 DirectSound Architecture +2 DirectSound Architecture=dsound_0001010302000000 +2 Architectural Overview=dsound_0001010302010000 +3 Object Types +3 Object Types=dsound_0001010302020000 +3 The DirectSound Object=dsound_0001010302020100 +3 The DirectSoundBuffer Object=dsound_0001010302020200 +2 Software Emulation=dsound_0001010302030000 +2 Device Drivers=dsound_0001010302040000 +2 Cooperative Levels=dsound_0001010302050000 +2 System Integration=dsound_0001010302060000 +2 DirectSound Overview +2 DirectSound Overview=dsound_0001010303000000 +3 DirectSound Features +3 DirectSound Features=dsound_0001010303010000 +3 Mixing=dsound_0001010303010100 +3 Hardware Acceleration=dsound_0001010303010200 +3 Write Access to the Primary Buffer=dsound_0001010303010300 +3 Three-Dimensional Sound +3 Three-Dimensional Sound=dsound_0001010303020000 +3 Perception of Sound Positions=dsound_0001010303020100 +3 Listeners=dsound_0001010303020200 +3 Sound Cones=dsound_0001010303020300 +3 Minimum and Maximum Distances=dsound_0001010303020400 +3 Position Versus Velocity=dsound_0001010303020500 +3 Integration with Direct3D=dsound_0001010303020600 +3 Units of Measure and Distance Factors=dsound_0001010303020700 +3 Mono and Stereo Sources=dsound_0001010303020800 +2 DirectSound Interface Overviews +2 DirectSound Interface Overviews=dsound_0001010304000000 +3 IDirectSound Interface +3 IDirectSound Interface=dsound_0001010304010000 +3 Device Capabilities=dsound_0001010304010100 +3 Creating Buffers=dsound_0001010304010200 +3 Speaker Configuration=dsound_0001010304010300 +3 Hardware Memory Management=dsound_0001010304010400 +3 IDirectSound3DBuffer Interface +3 IDirectSound3DBuffer Interface=dsound_0001010304020000 +3 Obtaining an IDirectSound3DBuffer Interface Pointer=dsound_0001010304020100 +3 Batch Parameter Manipulation=dsound_0001010304020200 +3 Minimum and Maximum Distance Values=dsound_0001010304020300 +3 Operation Mode=dsound_0001010304020400 +3 Position and Velocity=dsound_0001010304020500 +3 Sound Projection Cones=dsound_0001010304020600 +3 IDirectSound3DListener Interface +3 IDirectSound3DListener Interface=dsound_0001010304030000 +3 Obtaining an IDirectSound3DListener Interface Pointer=dsound_0001010304030100 +3 Batch Parameter Manipulation=dsound_0001010304030200 +3 Deferred Settings=dsound_0001010304030300 +3 Distance Factor=dsound_0001010304030400 +3 Doppler Factor=dsound_0001010304030500 +3 Listener Position and Velocity=dsound_0001010304030600 +3 Listener Orientation=dsound_0001010304030700 +3 Rolloff Factor=dsound_0001010304030800 +3 IDirectSoundBuffer Interface +3 IDirectSoundBuffer Interface=dsound_0001010304040000 +3 Play Management=dsound_0001010304040100 +3 Sound-Environment Management=dsound_0001010304040200 +3 Retrieving Information=dsound_0001010304040300 +3 Memory Management=dsound_0001010304040400 +2 DirectSound Examples +2 DirectSound Examples=dsound_0001010305000000 +2 Creating a DirectSound Object=dsound_0001010305010000 +2 Creating a DirectSound Object by Using CoCreateInstance=dsound_0001010305020000 +2 Querying the Hardware Capabilities=dsound_0001010305030000 +3 Creating Sound Buffers +3 Creating Sound Buffers=dsound_0001010305040000 +3 Creating a Basic Sound Buffer=dsound_0001010305040100 +3 Control Options=dsound_0001010305040200 +3 Static and Streaming Sound Buffers=dsound_0001010305040300 +3 Hardware and Software Sound Buffers=dsound_0001010305040400 +3 Primary and Secondary Sound Buffers=dsound_0001010305040500 +2 Writing to Sound Buffers=dsound_0001010305050000 +2 Using the DirectSound Mixer=dsound_0001010305060000 +2 Using a Custom Mixer=dsound_0001010305070000 +2 Using Compressed Wave Formats=dsound_0001010305080000 +2 DirectSound Reference +3 Functions +3 DirectSoundCreate=dsound_0001010306010100 +3 DirectSoundEnumerate=dsound_0001010306010200 +3 Callback Function +3 DSEnumCallback=dsound_0001010306020100 +3 IDirectSound +3 IDirectSound=dsound_0001010306030000 +3 IDirectSound::Compact=dsound_0001010306030100 +3 IDirectSound::CreateSoundBuffer=dsound_0001010306030200 +3 IDirectSound::DuplicateSoundBuffer=dsound_0001010306030300 +3 IDirectSound::GetCaps=dsound_0001010306030400 +3 IDirectSound::GetSpeakerConfig=dsound_0001010306030500 +3 IDirectSound::Initialize=dsound_0001010306030600 +3 IDirectSound::SetCooperativeLevel=dsound_0001010306030700 +3 IDirectSound::SetSpeakerConfig=dsound_0001010306030800 +3 IDirectSound3DBuffer +3 IDirectSound3DBuffer=dsound_0001010306040000 +3 IDirectSound3DBuffer::GetAllParameters=dsound_0001010306040100 +3 IDirectSound3DBuffer::GetConeAngles=dsound_0001010306040200 +3 IDirectSound3DBuffer::GetConeOrientation=dsound_0001010306040300 +3 IDirectSound3DBuffer::GetConeOutsideVolume=dsound_0001010306040400 +3 IDirectSound3DBuffer::GetMaxDistance=dsound_0001010306040500 +3 IDirectSound3DBuffer::GetMinDistance=dsound_0001010306040600 +3 IDirectSound3DBuffer::GetMode=dsound_0001010306040700 +3 IDirectSound3DBuffer::GetPosition=dsound_0001010306040800 +3 IDirectSound3DBuffer::GetVelocity=dsound_0001010306040900 +3 IDirectSound3DBuffer::SetAllParameters=dsound_0001010306040a00 +3 IDirectSound3DBuffer::SetConeAngles=dsound_0001010306040b00 +3 IDirectSound3DBuffer::SetConeOrientation=dsound_0001010306040c00 +3 IDirectSound3DBuffer::SetConeOutsideVolume=dsound_0001010306040d00 +3 IDirectSound3DBuffer::SetMaxDistance=dsound_0001010306040e00 +3 IDirectSound3DBuffer::SetMinDistance=dsound_0001010306040f00 +3 IDirectSound3DBuffer::SetMode=dsound_0001010306041000 +3 IDirectSound3DBuffer::SetPosition=dsound_0001010306041100 +3 IDirectSound3DBuffer::SetVelocity=dsound_0001010306041200 +3 IDirectSound3DListener +3 IDirectSound3DListener=dsound_0001010306050000 +3 IDirectSound3DListener::CommitDeferredSettings=dsound_0001010306050100 +3 IDirectSound3DListener::GetAllParameters=dsound_0001010306050200 +3 IDirectSound3DListener::GetDistanceFactor=dsound_0001010306050300 +3 IDirectSound3DListener::GetDopplerFactor=dsound_0001010306050400 +3 IDirectSound3DListener::GetOrientation=dsound_0001010306050500 +3 IDirectSound3DListener::GetPosition=dsound_0001010306050600 +3 IDirectSound3DListener::GetRolloffFactor=dsound_0001010306050700 +3 IDirectSound3DListener::GetVelocity=dsound_0001010306050800 +3 IDirectSound3DListener::SetAllParameters=dsound_0001010306050900 +3 IDirectSound3DListener::SetDistanceFactor=dsound_0001010306050a00 +3 IDirectSound3DListener::SetDopplerFactor=dsound_0001010306050b00 +3 IDirectSound3DListener::SetOrientation=dsound_0001010306050c00 +3 IDirectSound3DListener::SetPosition=dsound_0001010306050d00 +3 IDirectSound3DListener::SetRolloffFactor=dsound_0001010306050e00 +3 IDirectSound3DListener::SetVelocity=dsound_0001010306050f00 +3 IDirectSoundBuffer +3 IDirectSoundBuffer=dsound_0001010306060000 +3 IDirectSoundBuffer::GetCaps=dsound_0001010306060100 +3 IDirectSoundBuffer::GetCurrentPosition=dsound_0001010306060200 +3 IDirectSoundBuffer::GetFormat=dsound_0001010306060300 +3 IDirectSoundBuffer::GetFrequency=dsound_0001010306060400 +3 IDirectSoundBuffer::GetPan=dsound_0001010306060500 +3 IDirectSoundBuffer::GetStatus=dsound_0001010306060600 +3 IDirectSoundBuffer::GetVolume=dsound_0001010306060700 +3 IDirectSoundBuffer::Initialize=dsound_0001010306060800 +3 IDirectSoundBuffer::Lock=dsound_0001010306060900 +3 IDirectSoundBuffer::Play=dsound_0001010306060a00 +3 IDirectSoundBuffer::Restore=dsound_0001010306060b00 +3 IDirectSoundBuffer::SetCurrentPosition=dsound_0001010306060c00 +3 IDirectSoundBuffer::SetFormat=dsound_0001010306060d00 +3 IDirectSoundBuffer::SetFrequency=dsound_0001010306060e00 +3 IDirectSoundBuffer::SetPan=dsound_0001010306060f00 +3 IDirectSoundBuffer::SetVolume=dsound_0001010306061000 +3 IDirectSoundBuffer::Stop=dsound_0001010306061100 +3 IDirectSoundBuffer::Unlock=dsound_0001010306061200 +3 Structures +3 DS3DBUFFER=dsound_0001010306070100 +3 DS3DLISTENER=dsound_0001010306070200 +3 DSBCAPS=dsound_0001010306070300 +3 DSBUFFERDESC=dsound_0001010306070400 +3 DSCAPS=dsound_0001010306070500 +2 Return Values=dsound_0001010306080000 +1 DirectPlay +1 About DirectPlay=dplay_0001010401000000 +2 DirectPlay Architecture +2 DirectPlay Architecture=dplay_0001010402000000 +2 DirectPlay Component=dplay_0001010402010000 +2 DirectPlayLobby Component=dplay_0001010402020000 +2 Service Providers=dplay_0001010402030000 +2 DirectPlay Overview +2 DirectPlay Overview=dplay_0001010403000000 +2 Session Management=dplay_0001010403010000 +2 Player Management=dplay_0001010403020000 +2 Group Management=dplay_0001010403030000 +2 Message Management=dplay_0001010403040000 +2 Data Management=dplay_0001010403050000 +2 Using System Messages=dplay_0001010403060000 +2 Synchronization=dplay_0001010403070000 +2 DirectPlay Address=dplay_0001010403080000 +3 What's New in DirectPlay Version 3? +3 What's New in DirectPlay Version 3?=dplay_0001010403090000 +3 New DirectPlay 3 Methods=dplay_0001010403090100 +3 Migrating to the IDirectPlay2 Interface=dplay_0001010403090200 +2 DirectPlay Interface Overviews +2 DirectPlay Interface Overviews=dplay_0001010404000000 +2 IDirectPlay Interface=dplay_0001010404010000 +2 IDirectPlay2 Interface=dplay_0001010404020000 +3 IDirectPlayLobby Interface +3 IDirectPlayLobby Interface=dplay_0001010404030000 +3 Unicode Versus ANSI DirectPlayLobby Interfaces=dplay_0001010404030100 +3 Registering Lobby-able Applications=dplay_0001010404030200 +2 DirectPlay Tutorials +2 DirectPlay Tutorials=dplay_0001010405000000 +3 Tutorial 1: Connecting by Using the Lobby +3 Tutorial 1: Connecting by Using the Lobby=dplay_0001010405010000 +3 Step 1: Creating a DirectPlayLobby Object=dplay_0001010405010100 +3 Step 2: Retrieving the Connection Settings=dplay_0001010405010200 +3 Step 3: Configuring the Session Description=dplay_0001010405010300 +3 Step 4: Connecting to a Session=dplay_0001010405010400 +3 Step 5: Creating a Player=dplay_0001010405010500 +3 Tutorial 2: Connecting by Using a Dialog Box +3 Tutorial 2: Connecting by Using a Dialog Box=dplay_0001010405020000 +3 Step 1: Enumerating the Service Providers=dplay_0001010405020100 +3 Step 2: Creating the DirectPlay Object=dplay_0001010405020200 +3 Step 3: Joining a Session=dplay_0001010405020300 +3 Step 4: Creating a Session=dplay_0001010405020400 +3 Step 5: Creating a Player=dplay_0001010405020500 +2 DirectPlay Reference +3 Functions +3 DirectPlayCreate=dplay_0001010406010100 +3 DirectPlayEnumerate=dplay_0001010406010200 +3 DirectPlayLobbyCreate=dplay_0001010406010300 +3 Callback Functions +3 EnumAddressCallback=dplay_0001010406020100 +3 EnumAddressTypeCallback=dplay_0001010406020200 +3 EnumDPCallback=dplay_0001010406020300 +3 EnumLocalApplicationsCallback=dplay_0001010406020400 +3 EnumPlayersCallback2=dplay_0001010406020500 +3 EnumSessionsCallback2=dplay_0001010406020600 +3 IDirectPlay2 +3 IDirectPlay2=dplay_0001010406030000 +3 IDirectPlay2::AddPlayerToGroup=dplay_0001010406030100 +3 IDirectPlay2::Close=dplay_0001010406030200 +3 IDirectPlay2::CreateGroup=dplay_0001010406030300 +3 IDirectPlay2::CreatePlayer=dplay_0001010406030400 +3 IDirectPlay2::DeletePlayerFromGroup=dplay_0001010406030500 +3 IDirectPlay2::DestroyGroup=dplay_0001010406030600 +3 IDirectPlay2::DestroyPlayer=dplay_0001010406030700 +3 IDirectPlay2::EnumGroupPlayers=dplay_0001010406030800 +3 IDirectPlay2::EnumGroups=dplay_0001010406030900 +3 IDirectPlay2::EnumPlayers=dplay_0001010406030a00 +3 IDirectPlay2::EnumSessions=dplay_0001010406030b00 +3 IDirectPlay2::GetCaps=dplay_0001010406030c00 +3 IDirectPlay2::GetGroupData=dplay_0001010406030d00 +3 IDirectPlay2::GetGroupName=dplay_0001010406030e00 +3 IDirectPlay2::GetMessageCount=dplay_0001010406030f00 +3 IDirectPlay2::GetPlayerAddress=dplay_0001010406031000 +3 IDirectPlay2::GetPlayerCaps=dplay_0001010406031100 +3 IDirectPlay2::GetPlayerData=dplay_0001010406031200 +3 IDirectPlay2::GetPlayerName=dplay_0001010406031300 +3 IDirectPlay2::GetSessionDesc=dplay_0001010406031400 +3 IDirectPlay2::Initialize=dplay_0001010406031500 +3 IDirectPlay2::Open=dplay_0001010406031600 +3 IDirectPlay2::Receive=dplay_0001010406031700 +3 IDirectPlay2::Send=dplay_0001010406031800 +3 IDirectPlay2::SetGroupData=dplay_0001010406031900 +3 IDirectPlay2::SetGroupName=dplay_0001010406031a00 +3 IDirectPlay2::SetPlayerData=dplay_0001010406031b00 +3 IDirectPlay2::SetPlayerName=dplay_0001010406031c00 +3 IDirectPlay2::SetSessionDesc=dplay_0001010406031d00 +3 IDirectPlayLobby +3 IDirectPlayLobby=dplay_0001010406040000 +3 IDirectPlayLobby::Connect=dplay_0001010406040100 +3 IDirectPlayLobby::CreateAddress=dplay_0001010406040200 +3 IDirectPlayLobby::EnumAddress=dplay_0001010406040300 +3 IDirectPlayLobby::EnumAddressTypes=dplay_0001010406040400 +3 IDirectPlayLobby::EnumLocalApplications=dplay_0001010406040500 +3 IDirectPlayLobby::GetConnectionSettings=dplay_0001010406040600 +3 IDirectPlayLobby::ReceiveLobbyMessage=dplay_0001010406040700 +3 IDirectPlayLobby::RunApplication=dplay_0001010406040800 +3 IDirectPlayLobby::SendLobbyMessage=dplay_0001010406040900 +3 IDirectPlayLobby::SetConnectionSettings=dplay_0001010406040a00 +3 IDirectPlayLobby::SetLobbyMessageEvent=dplay_0001010406040b00 +3 Structures +3 DPCAPS=dplay_0001010406050100 +3 DPCOMPORTADDRESS=dplay_0001010406050200 +3 DPLAPPINFO=dplay_0001010406050300 +3 DPLCONNECTION=dplay_0001010406050400 +3 DPNAME=dplay_0001010406050500 +3 DPSESSIONDESC2=dplay_0001010406050600 +3 System Messages +3 DPLMSG_GENERIC=dplay_0001010406060100 +3 DPMSG_ADDPLAYERTOGROUP=dplay_0001010406060200 +3 DPMSG_CREATEPLAYERORGROUP=dplay_0001010406060300 +3 DPMSG_DELETEPLAYERFROMGROUP=dplay_0001010406060400 +3 DPMSG_DESTROYPLAYERORGROUP=dplay_0001010406060500 +3 DPMSG_GENERIC=dplay_0001010406060600 +3 DPMSG_HOST=dplay_0001010406060700 +3 DPMSG_SESSIONLOST=dplay_0001010406060800 +3 DPMSG_SETPLAYERORGROUPDATA=dplay_0001010406060900 +3 DPMSG_SETPLAYERORGROUPNAME=dplay_0001010406060a00 +2 Return Values=dplay_0001010406070000 +1 Direct3D +2 Direct3D Overview +3 About Direct3D +3 About Direct3D=3dchoice_0001020101000000 +4 Direct3D +4 Direct3D=3dchoice_0001020101010000 +4 Retained Mode=3dchoice_0001020101010100 +4 Immediate Mode=3dchoice_0001020101010200 +4 Hardware Abstraction and Emulation=3dchoice_0001020101010300 +3 DirectDraw=3dchoice_0001020101020000 +3 OpenGL=3dchoice_0001020101030000 +3 Direct3D Architecture +3 Direct3D Architecture=d3dintro_0001020102000000 +3 The Direct3D Vision=d3dintro_0001020102010000 +3 Rendering Engine=d3dintro_0001020102020000 +3 Execute Buffers=d3dintro_0001020102030000 +3 Transformation Module=d3dintro_0001020102040000 +3 Lighting Module=d3dintro_0001020102050000 +3 Rasterization Module=d3dintro_0001020102060000 +4 Colors and Fog +4 Colors and Fog=d3dintro_0001020102070000 +4 Palette Entries=d3dintro_0001020102070100 +4 Fog=d3dintro_0001020102070200 +3 States and State Overrides=d3dintro_0001020102080000 +3 Direct3D File Format=d3dintro_0001020102090000 +3 A Technical Foundation for 3D Programming +3 A Technical Foundation for 3D Programming=rmmath_0001020103000000 +4 3D Coordinate Systems +4 3D Coordinate Systems=rmmath_0001020103010000 +4 Direct3D's Coordinate System=rmmath_0001020103010100 +4 U- and V-Coordinates=rmmath_0001020103010200 +4 3D Transformations +4 3D Transformations=rmmath_0001020103020000 +4 Translation=rmmath_0001020103020100 +4 Rotation=rmmath_0001020103020200 +4 Scaling=rmmath_0001020103020300 +4 Polygons +4 Polygons=rmmath_0001020103030000 +4 Geometry Requirements=rmmath_0001020103030100 +4 Face and Vertex Normals=rmmath_0001020103030200 +4 Shade Modes=rmmath_0001020103030300 +4 Triangle Interpolants=rmmath_0001020103030400 +3 Triangle Strips and Fans=rmmath_0001020103040000 +3 Vectors, Vertices, and Quaternions=rmmath_0001020103050000 +3 Floating-point Precision=rmmath_0001020103060000 +3 Performance Optimization +3 Performance Optimization=perfopt_0001020104000000 +3 Clip Tests on Execution=perfopt_0001020104010000 +3 Batching Primitives=perfopt_0001020104020000 +3 Texture Size=perfopt_0001020104030000 +3 Triangle Flags=perfopt_0001020104040000 +3 Ramp Performance Tips=perfopt_0001020104050000 +3 Ramp Textures=perfopt_0001020104060000 +3 Z-Buffers=perfopt_0001020104070000 +3 Copy Mode=perfopt_0001020104080000 +2 Retained-Mode Overview +2 About Retained Mode=rmabout_0001020201000000 +3 Introduction to Direct3D Retained-Mode Objects +3 Introduction to Direct3D Retained-Mode Objects=rmobject_0001020202000000 +3 Objects and Interfaces=rmobject_0001020202010000 +3 Objects and Reference Counting=rmobject_0001020202020000 +3 IDirect3DRM Interface=rmobject_0001020202030000 +3 IDirect3DRMAnimation and IDirect3DRMAnimationSet Interfaces=rmobject_0001020202040000 +4 IDirect3DRMDevice and IDirect3DRMDeviceArray Interfaces +4 IDirect3DRMDevice and IDirect3DRMDeviceArray Interfaces=rmobject_0001020202050000 +4 Quality=rmobject_0001020202050100 +4 Color Models=rmobject_0001020202050200 +4 Window Management=rmobject_0001020202050300 +3 IDirect3DRMFace and IDirect3DRMFaceArray Interfaces=rmobject_0001020202060000 +4 IDirect3DRMFrame and IDirect3DRMFrameArray Interfaces +4 IDirect3DRMFrame and IDirect3DRMFrameArray Interfaces=rmobject_0001020202070000 +4 Hierarchies=rmobject_0001020202070100 +4 Transformations=rmobject_0001020202070200 +4 Motion=rmobject_0001020202070300 +4 Callback Functions=rmobject_0001020202070400 +4 IDirect3DRMLight and IDirect3DRMLightArray Interfaces +4 IDirect3DRMLight and IDirect3DRMLightArray Interfaces=rmobject_0001020202080000 +4 Ambient=rmobject_0001020202080100 +4 Directional=rmobject_0001020202080200 +4 Parallel Point=rmobject_0001020202080300 +4 Point=rmobject_0001020202080400 +4 Spotlight=rmobject_0001020202080500 +3 IDirect3DRMMaterial Interface=rmobject_0001020202090000 +3 IDirect3DRMMesh and IDirect3DRMMeshBuilder Interfaces=rmobject_00010202020a0000 +3 Direct3DRMObject=rmobject_00010202020b0000 +3 IDirect3DRMPickedArray Interface=rmobject_00010202020c0000 +3 IDirect3DRMShadow Interface=rmobject_00010202020d0000 +4 IDirect3DRMTexture Interface +4 IDirect3DRMTexture Interface=rmobject_00010202020e0000 +4 Decals=rmobject_00010202020e0100 +4 Texture Colors=rmobject_00010202020e0200 +4 Mipmaps=rmobject_00010202020e0300 +4 Texture Filtering=rmobject_00010202020e0400 +4 Texture Transparency=rmobject_00010202020e0500 +3 IDirect3DRMUserVisual Interface=rmobject_00010202020f0000 +4 IDirect3DRMViewport and IDirect3DRMViewportArray Interface +4 IDirect3DRMViewport and IDirect3DRMViewportArray Interface=rmobject_0001020202100000 +4 Camera=rmobject_0001020202100100 +4 Viewing Frustum=rmobject_0001020202100200 +4 Transformations=rmobject_0001020202100300 +4 Picking=rmobject_0001020202100400 +3 IDirect3DRMVisual and IDirect3DRMVisualArray Interfaces=rmobject_0001020202110000 +4 IDirect3DRMWrap Interface +4 IDirect3DRMWrap Interface=rmobject_0001020202120000 +4 Wrapping Flags=rmobject_0001020202120100 +4 Flat=rmobject_0001020202120200 +4 Cylindrical=rmobject_0001020202120300 +4 Spherical=rmobject_0001020202120400 +4 Chrome=rmobject_0001020202120500 +3 Direct3D Retained-Mode Tutorial +3 Direct3D Retained-Mode Tutorial=rmtutor_0001020203000000 +4 About Helworld.c +4 About Helworld.c=rmtutor_0001020203010000 +4 Limitations of the Sample=rmtutor_0001020203010100 +4 Static Libraries=rmtutor_0001020203010200 +4 DirectDraw's Windowed Mode=rmtutor_0001020203010300 +3 Definitions and Global Variables=rmtutor_0001020203020000 +4 Windows Setup and Initialization +4 Windows Setup and Initialization=rmtutor_0001020203030000 +4 The WinMain Function=rmtutor_0001020203030100 +4 The InitApp Function=rmtutor_0001020203030200 +4 The Main Window Procedure=rmtutor_0001020203030300 +4 Enumerating Device Drivers +4 Enumerating Device Drivers=rmtutor_0001020203040000 +4 The EnumDrivers Function=rmtutor_0001020203040100 +4 The enumDeviceFunc Callback Function=rmtutor_0001020203040200 +4 The BPPToDDBD Helper Function=rmtutor_0001020203040300 +4 Setting up the 3D Environment +4 Setting up the 3D Environment=rmtutor_0001020203050000 +4 Creating the Device and Viewport=rmtutor_0001020203050100 +4 Setting the Render State=rmtutor_0001020203050200 +3 The Rendering Loop=rmtutor_0001020203060000 +4 Creating the Scene +4 Creating the Scene=rmtutor_0001020203070000 +4 The MyScene Function=rmtutor_0001020203070100 +4 The MakeMyFrames Function=rmtutor_0001020203070200 +4 The MakeMyLights Function=rmtutor_0001020203070300 +4 The SetMyPositions Function=rmtutor_0001020203070400 +4 The MakeMyMesh Function=rmtutor_0001020203070500 +4 The MakeMyWrap Function=rmtutor_0001020203070600 +4 The AddMyTexture Function=rmtutor_0001020203070700 +3 Cleaning Up=rmtutor_0001020203080000 +2 Immediate-Mode Overview +2 About Immediate Mode=imabout_0001020301000000 +3 Introduction to Direct3D Immediate-Mode Objects +3 Introduction to Direct3D Immediate-Mode Objects=imobject_0001020302000000 +3 Direct3D Object Types=imobject_0001020302010000 +3 IDirect3D Interface=imobject_0001020302020000 +3 IDirect3DDevice Interface=imobject_0001020302030000 +4 IDirect3DTexture Interface +4 IDirect3DTexture Interface=imobject_0001020302040000 +4 Texture Wrapping=imobject_0001020302040100 +4 Texture Filtering and Blending=imobject_0001020302040200 +4 Mipmaps=imobject_0001020302040300 +4 Transparency and Translucency=imobject_0001020302040400 +3 IDirect3DMaterial Interface=imobject_0001020302050000 +3 IDirect3DLight Interface=imobject_0001020302060000 +3 IDirect3DViewport Interface=imobject_0001020302070000 +3 IDirect3DExecuteBuffer Interface=imobject_0001020302080000 +3 Object Connectivity=imobject_0001020302090000 +4 Scene Management +4 Scene Management=imobject_00010203020a0000 +4 Hidden Surface Removal=imobject_00010203020a0100 +4 2D and 3D Interaction=imobject_00010203020a0200 +4 Scene-Management Procedure=imobject_00010203020a0300 +3 Direct3D Immediate-Mode Tutorial +3 Direct3D Immediate-Mode Tutorial=d3dtutor_0001020303000000 +3 Step 1: Beginning Initialization=d3dtutor_0001020303010000 +3 Step 2: Creating DirectDraw and Direct3D Objects=d3dtutor_0001020303020000 +3 Step 3: Setting Up the Device-Creation Callback Function=d3dtutor_0001020303030000 +3 Step 4: Initializing the Viewport=d3dtutor_0001020303040000 +3 Step 5: Setting the Immediate-Mode Render State=d3dtutor_0001020303050000 +3 Step 6: Completing Initialization=d3dtutor_0001020303060000 +3 Step 7: Running the Rendering Loop=d3dtutor_0001020303070000 +3 Step 8: Cleaning Up=d3dtutor_0001020303080000 +2 Retained-Mode Reference +3 Functions +3 Direct3DRMCreate=rmfuncs_0001020401000100 +3 D3DRMColorGetAlpha=rmfuncs_0001020401000200 +3 D3DRMColorGetBlue=rmfuncs_0001020401000300 +3 D3DRMColorGetGreen=rmfuncs_0001020401000400 +3 D3DRMColorGetRed=rmfuncs_0001020401000500 +3 D3DRMCreateColorRGB=rmfuncs_0001020401000600 +3 D3DRMCreateColorRGBA=rmfuncs_0001020401000700 +3 D3DRMFREEFUNCTION=rmfuncs_0001020401000800 +3 D3DRMMALLOCFUNCTION=rmfuncs_0001020401000900 +3 D3DRMMatrixFromQuaternion=rmfuncs_0001020401000a00 +3 D3DRMQuaternionFromRotation=rmfuncs_0001020401000b00 +3 D3DRMQuaternionMultiply=rmfuncs_0001020401000c00 +3 D3DRMQuaternionSlerp=rmfuncs_0001020401000d00 +3 D3DRMREALLOCFUNCTION=rmfuncs_0001020401000e00 +3 D3DRMVectorAdd=rmfuncs_0001020401000f00 +3 D3DRMVectorCrossProduct=rmfuncs_0001020401001000 +3 D3DRMVectorDotProduct=rmfuncs_0001020401001100 +3 D3DRMVectorModulus=rmfuncs_0001020401001200 +3 D3DRMVectorNormalize=rmfuncs_0001020401001300 +3 D3DRMVectorRandom=rmfuncs_0001020401001400 +3 D3DRMVectorReflect=rmfuncs_0001020401001500 +3 D3DRMVectorRotate=rmfuncs_0001020401001600 +3 D3DRMVectorScale=rmfuncs_0001020401001700 +3 D3DRMVectorSubtract=rmfuncs_0001020401001800 +3 Callback Functions +3 D3DRMDEVICEPALETTECALLBACK=rmfuncs_0001020402000100 +3 D3DRMFRAMEMOVECALLBACK=rmfuncs_0001020402000200 +3 D3DRMLOADCALLBACK=rmfuncs_0001020402000300 +3 D3DRMLOADTEXTURECALLBACK=rmfuncs_0001020402000400 +3 D3DRMOBJECTCALLBACK=rmfuncs_0001020402000500 +3 D3DRMUPDATECALLBACK=rmfuncs_0001020402000600 +3 D3DRMUSERVISUALCALLBACK=rmfuncs_0001020402000700 +3 D3DRMWRAPCALLBACK=rmfuncs_0001020402000800 +3 IDirect3DRM Array Interfaces +3 IDirect3DRM Array Interfaces=rmarray_0001020403000000 +3 IDirect3DRMArray=rmarray_0001020403010000 +4 IDirect3DRMArray::GetSize=rmarray_0001020403010100 +3 IDirect3DRMDeviceArray=rmarray_0001020403020000 +4 IDirect3DRMDeviceArray::GetElement=rmarray_0001020403020100 +4 IDirect3DRMDeviceArray::GetSize=rmarray_0001020403020200 +3 IDirect3DRMFaceArray=rmarray_0001020403030000 +4 IDirect3DRMFaceArray::GetElement=rmarray_0001020403030100 +4 IDirect3DRMFaceArray::GetSize=rmarray_0001020403030200 +3 IDirect3DRMFrameArray=rmarray_0001020403040000 +4 IDirect3DRMFrameArray::GetElement=rmarray_0001020403040100 +4 IDirect3DRMFrameArray::GetSize=rmarray_0001020403040200 +3 IDirect3DRMLightArray=rmarray_0001020403050000 +4 IDirect3DRMLightArray::GetElement=rmarray_0001020403050100 +4 IDirect3DRMLightArray::GetSize=rmarray_0001020403050200 +3 IDirect3DRMPickedArray=rmarray_0001020403060000 +4 IDirect3DRMPickedArray::GetPick=rmarray_0001020403060100 +4 IDirect3DRMPickedArray::GetSize=rmarray_0001020403060200 +3 IDirect3DRMViewportArray=rmarray_0001020403070000 +4 IDirect3DRMViewportArray::GetElement=rmarray_0001020403070100 +4 IDirect3DRMViewportArray::GetSize=rmarray_0001020403070200 +3 IDirect3DRMVisualArray=rmarray_0001020403080000 +4 IDirect3DRMVisualArray::GetElement=rmarray_0001020403080100 +4 IDirect3DRMVisualArray::GetSize=rmarray_0001020403080200 +3 IDirect3DRM +3 IDirect3DRM=rmid3drm_0001020404000000 +3 IDirect3DRM::AddSearchPath=rmid3drm_0001020404000100 +3 IDirect3DRM::CreateAnimation=rmid3drm_0001020404000200 +3 IDirect3DRM::CreateAnimationSet=rmid3drm_0001020404000300 +3 IDirect3DRM::CreateDevice=rmid3drm_0001020404000400 +3 IDirect3DRM::CreateDeviceFromClipper=rmid3drm_0001020404000500 +3 IDirect3DRM::CreateDeviceFromD3D=rmid3drm_0001020404000600 +3 IDirect3DRM::CreateDeviceFromSurface=rmid3drm_0001020404000700 +3 IDirect3DRM::CreateFace=rmid3drm_0001020404000800 +3 IDirect3DRM::CreateFrame=rmid3drm_0001020404000900 +3 IDirect3DRM::CreateLight=rmid3drm_0001020404000a00 +3 IDirect3DRM::CreateLightRGB=rmid3drm_0001020404000b00 +3 IDirect3DRM::CreateMaterial=rmid3drm_0001020404000c00 +3 IDirect3DRM::CreateMesh=rmid3drm_0001020404000d00 +3 IDirect3DRM::CreateMeshBuilder=rmid3drm_0001020404000e00 +3 IDirect3DRM::CreateObject=rmid3drm_0001020404000f00 +3 IDirect3DRM::CreateShadow=rmid3drm_0001020404001000 +3 IDirect3DRM::CreateTexture=rmid3drm_0001020404001100 +3 IDirect3DRM::CreateTextureFromSurface=rmid3drm_0001020404001200 +3 IDirect3DRM::CreateUserVisual=rmid3drm_0001020404001300 +3 IDirect3DRM::CreateViewport=rmid3drm_0001020404001400 +3 IDirect3DRM::CreateWrap=rmid3drm_0001020404001500 +3 IDirect3DRM::EnumerateObjects=rmid3drm_0001020404001600 +3 IDirect3DRM::GetDevices=rmid3drm_0001020404001700 +3 IDirect3DRM::GetNamedObject=rmid3drm_0001020404001800 +3 IDirect3DRM::GetSearchPath=rmid3drm_0001020404001900 +3 IDirect3DRM::Load=rmid3drm_0001020404001a00 +3 IDirect3DRM::LoadTexture=rmid3drm_0001020404001b00 +3 IDirect3DRM::LoadTextureFromResource=rmid3drm_0001020404001c00 +3 IDirect3DRM::SetDefaultTextureColors=rmid3drm_0001020404001d00 +3 IDirect3DRM::SetDefaultTextureShades=rmid3drm_0001020404001e00 +3 IDirect3DRM::SetSearchPath=rmid3drm_0001020404001f00 +3 IDirect3DRM::Tick=rmid3drm_0001020404002000 +3 IDirect3DRMAnimation +3 IDirect3DRMAnimation=rmanim_0001020405000000 +3 IDirect3DRMAnimation::AddPositionKey=rmanim_0001020405000100 +3 IDirect3DRMAnimation::AddRotateKey=rmanim_0001020405000200 +3 IDirect3DRMAnimation::AddScaleKey=rmanim_0001020405000300 +3 IDirect3DRMAnimation::DeleteKey=rmanim_0001020405000400 +3 IDirect3DRMAnimation::GetOptions=rmanim_0001020405000500 +3 IDirect3DRMAnimation::SetFrame=rmanim_0001020405000600 +3 IDirect3DRMAnimation::SetOptions=rmanim_0001020405000700 +3 IDirect3DRMAnimation::SetTime=rmanim_0001020405000800 +3 IDirect3DRMAnimationSet +3 IDirect3DRMAnimationSet=rmanimst_0001020406000000 +3 IDirect3DRMAnimationSet::AddAnimation=rmanimst_0001020406000100 +3 IDirect3DRMAnimationSet::DeleteAnimation=rmanimst_0001020406000200 +3 IDirect3DRMAnimationSet::Load=rmanimst_0001020406000300 +3 IDirect3DRMAnimationSet::SetTime=rmanimst_0001020406000400 +3 IDirect3DRMDevice +3 IDirect3DRMDevice=rmdevice_0001020407000000 +3 IDirect3DRMDevice::AddUpdateCallback=rmdevice_0001020407000100 +3 IDirect3DRMDevice::DeleteUpdateCallback=rmdevice_0001020407000200 +3 IDirect3DRMDevice::GetBufferCount=rmdevice_0001020407000300 +3 IDirect3DRMDevice::GetColorModel=rmdevice_0001020407000400 +3 IDirect3DRMDevice::GetDirect3DDevice=rmdevice_0001020407000500 +3 IDirect3DRMDevice::GetDither=rmdevice_0001020407000600 +3 IDirect3DRMDevice::GetHeight=rmdevice_0001020407000700 +3 IDirect3DRMDevice::GetTrianglesDrawn=rmdevice_0001020407000800 +3 IDirect3DRMDevice::GetQuality=rmdevice_0001020407000900 +3 IDirect3DRMDevice::GetShades=rmdevice_0001020407000a00 +3 IDirect3DRMDevice::GetTextureQuality=rmdevice_0001020407000b00 +3 IDirect3DRMDevice::GetViewports=rmdevice_0001020407000c00 +3 IDirect3DRMDevice::GetWidth=rmdevice_0001020407000d00 +3 IDirect3DRMDevice::GetWireframeOptions=rmdevice_0001020407000e00 +3 IDirect3DRMDevice::Init=rmdevice_0001020407000f00 +3 IDirect3DRMDevice::InitFromClipper=rmdevice_0001020407001000 +3 IDirect3DRMDevice::InitFromD3D=rmdevice_0001020407001100 +3 IDirect3DRMDevice::SetBufferCount=rmdevice_0001020407001200 +3 IDirect3DRMDevice::SetDither=rmdevice_0001020407001300 +3 IDirect3DRMDevice::SetQuality=rmdevice_0001020407001400 +3 IDirect3DRMDevice::SetShades=rmdevice_0001020407001500 +3 IDirect3DRMDevice::SetTextureQuality=rmdevice_0001020407001600 +3 IDirect3DRMDevice::Update=rmdevice_0001020407001700 +3 IDirect3DRMFace +3 IDirect3DRMFace=rmface_0001020408000000 +3 IDirect3DRMFace::AddVertex=rmface_0001020408000100 +3 IDirect3DRMFace::AddVertexAndNormalIndexed=rmface_0001020408000200 +3 IDirect3DRMFace::GetColor=rmface_0001020408000300 +3 IDirect3DRMFace::GetMaterial=rmface_0001020408000400 +3 IDirect3DRMFace::GetNormal=rmface_0001020408000500 +3 IDirect3DRMFace::GetTexture=rmface_0001020408000600 +3 IDirect3DRMFace::GetTextureCoordinateIndex=rmface_0001020408000700 +3 IDirect3DRMFace::GetTextureCoordinates=rmface_0001020408000800 +3 IDirect3DRMFace::GetTextureTopology=rmface_0001020408000900 +3 IDirect3DRMFace::GetVertex=rmface_0001020408000a00 +3 IDirect3DRMFace::GetVertexCount=rmface_0001020408000b00 +3 IDirect3DRMFace::GetVertexIndex=rmface_0001020408000c00 +3 IDirect3DRMFace::GetVertices=rmface_0001020408000d00 +3 IDirect3DRMFace::SetColor=rmface_0001020408000e00 +3 IDirect3DRMFace::SetColorRGB=rmface_0001020408000f00 +3 IDirect3DRMFace::SetMaterial=rmface_0001020408001000 +3 IDirect3DRMFace::SetTexture=rmface_0001020408001100 +3 IDirect3DRMFace::SetTextureCoordinates=rmface_0001020408001200 +3 IDirect3DRMFace::SetTextureTopology=rmface_0001020408001300 +3 IDirect3DRMFrame +3 IDirect3DRMFrame=rmframe_0001020409000000 +3 IDirect3DRMFrame::AddChild=rmframe_0001020409000100 +3 IDirect3DRMFrame::AddLight=rmframe_0001020409000200 +3 IDirect3DRMFrame::AddMoveCallback=rmframe_0001020409000300 +3 IDirect3DRMFrame::AddRotation=rmframe_0001020409000400 +3 IDirect3DRMFrame::AddScale=rmframe_0001020409000500 +3 IDirect3DRMFrame::AddTransform=rmframe_0001020409000600 +3 IDirect3DRMFrame::AddTranslation=rmframe_0001020409000700 +3 IDirect3DRMFrame::AddVisual=rmframe_0001020409000800 +3 IDirect3DRMFrame::DeleteChild=rmframe_0001020409000900 +3 IDirect3DRMFrame::DeleteLight=rmframe_0001020409000a00 +3 IDirect3DRMFrame::DeleteMoveCallback=rmframe_0001020409000b00 +3 IDirect3DRMFrame::DeleteVisual=rmframe_0001020409000c00 +3 IDirect3DRMFrame::GetChildren=rmframe_0001020409000d00 +3 IDirect3DRMFrame::GetColor=rmframe_0001020409000e00 +3 IDirect3DRMFrame::GetLights=rmframe_0001020409000f00 +3 IDirect3DRMFrame::GetMaterialMode=rmframe_0001020409001000 +3 IDirect3DRMFrame::GetOrientation=rmframe_0001020409001100 +3 IDirect3DRMFrame::GetParent=rmframe_0001020409001200 +3 IDirect3DRMFrame::GetPosition=rmframe_0001020409001300 +3 IDirect3DRMFrame::GetRotation=rmframe_0001020409001400 +3 IDirect3DRMFrame::GetScene=rmframe_0001020409001500 +3 IDirect3DRMFrame::GetSceneBackground=rmframe_0001020409001600 +3 IDirect3DRMFrame::GetSceneBackgroundDepth=rmframe_0001020409001700 +3 IDirect3DRMFrame::GetSceneFogColor=rmframe_0001020409001800 +3 IDirect3DRMFrame::GetSceneFogEnable=rmframe_0001020409001900 +3 IDirect3DRMFrame::GetSceneFogMode=rmframe_0001020409001a00 +3 IDirect3DRMFrame::GetSceneFogParams=rmframe_0001020409001b00 +3 IDirect3DRMFrame::GetSortMode=rmframe_0001020409001c00 +3 IDirect3DRMFrame::GetTexture=rmframe_0001020409001d00 +3 IDirect3DRMFrame::GetTextureTopology=rmframe_0001020409001e00 +3 IDirect3DRMFrame::GetTransform=rmframe_0001020409001f00 +3 IDirect3DRMFrame::GetVelocity=rmframe_0001020409002000 +3 IDirect3DRMFrame::GetVisuals=rmframe_0001020409002100 +3 IDirect3DRMFrame::GetZbufferMode=rmframe_0001020409002200 +3 IDirect3DRMFrame::InverseTransform=rmframe_0001020409002300 +3 IDirect3DRMFrame::Load=rmframe_0001020409002400 +3 IDirect3DRMFrame::LookAt=rmframe_0001020409002500 +3 IDirect3DRMFrame::Move=rmframe_0001020409002600 +3 IDirect3DRMFrame::SetColor=rmframe_0001020409002700 +3 IDirect3DRMFrame::SetColorRGB=rmframe_0001020409002800 +3 IDirect3DRMFrame::SetMaterialMode=rmframe_0001020409002900 +3 IDirect3DRMFrame::SetOrientation=rmframe_0001020409002a00 +3 IDirect3DRMFrame::SetPosition=rmframe_0001020409002b00 +3 IDirect3DRMFrame::SetRotation=rmframe_0001020409002c00 +3 IDirect3DRMFrame::SetSceneBackground=rmframe_0001020409002d00 +3 IDirect3DRMFrame::SetSceneBackgroundDepth=rmframe_0001020409002e00 +3 IDirect3DRMFrame::SetSceneBackgroundImage=rmframe_0001020409002f00 +3 IDirect3DRMFrame::SetSceneBackgroundRGB=rmframe_0001020409003000 +3 IDirect3DRMFrame::SetSceneFogColor=rmframe_0001020409003100 +3 IDirect3DRMFrame::SetSceneFogEnable=rmframe_0001020409003200 +3 IDirect3DRMFrame::SetSceneFogMode=rmframe_0001020409003300 +3 IDirect3DRMFrame::SetSceneFogParams=rmframe_0001020409003400 +3 IDirect3DRMFrame::SetSortMode=rmframe_0001020409003500 +3 IDirect3DRMFrame::SetTexture=rmframe_0001020409003600 +3 IDirect3DRMFrame::SetTextureTopology=rmframe_0001020409003700 +3 IDirect3DRMFrame::SetVelocity=rmframe_0001020409003800 +3 IDirect3DRMFrame::SetZbufferMode=rmframe_0001020409003900 +3 IDirect3DRMFrame::Transform=rmframe_0001020409003a00 +3 IDirect3DRMLight +3 IDirect3DRMLight=rmlight_000102040a000000 +3 IDirect3DRMLight::GetColor=rmlight_000102040a000100 +3 IDirect3DRMLight::GetConstantAttenuation=rmlight_000102040a000200 +3 IDirect3DRMLight::GetEnableFrame=rmlight_000102040a000300 +3 IDirect3DRMLight::GetLinearAttenuation=rmlight_000102040a000400 +3 IDirect3DRMLight::GetPenumbra=rmlight_000102040a000500 +3 IDirect3DRMLight::GetQuadraticAttenuation=rmlight_000102040a000600 +3 IDirect3DRMLight::GetRange=rmlight_000102040a000700 +3 IDirect3DRMLight::GetType=rmlight_000102040a000800 +3 IDirect3DRMLight::GetUmbra=rmlight_000102040a000900 +3 IDirect3DRMLight::SetColor=rmlight_000102040a000a00 +3 IDirect3DRMLight::SetColorRGB=rmlight_000102040a000b00 +3 IDirect3DRMLight::SetConstantAttenuation=rmlight_000102040a000c00 +3 IDirect3DRMLight::SetEnableFrame=rmlight_000102040a000d00 +3 IDirect3DRMLight::SetLinearAttenuation=rmlight_000102040a000e00 +3 IDirect3DRMLight::SetPenumbra=rmlight_000102040a000f00 +3 IDirect3DRMLight::SetQuadraticAttenuation=rmlight_000102040a001000 +3 IDirect3DRMLight::SetRange=rmlight_000102040a001100 +3 IDirect3DRMLight::SetType=rmlight_000102040a001200 +3 IDirect3DRMLight::SetUmbra=rmlight_000102040a001300 +3 IDirect3DRMMaterial +3 IDirect3DRMMaterial=rmmatrl_000102040b000000 +3 IDirect3DRMMaterial::GetEmissive=rmmatrl_000102040b000100 +3 IDirect3DRMMaterial::GetPower=rmmatrl_000102040b000200 +3 IDirect3DRMMaterial::GetSpecular=rmmatrl_000102040b000300 +3 IDirect3DRMMaterial::SetEmissive=rmmatrl_000102040b000400 +3 IDirect3DRMMaterial::SetPower=rmmatrl_000102040b000500 +3 IDirect3DRMMaterial::SetSpecular=rmmatrl_000102040b000600 +3 IDirect3DRMMesh +3 IDirect3DRMMesh=rmmesh_000102040c000000 +3 IDirect3DRMMesh::AddGroup=rmmesh_000102040c000100 +3 IDirect3DRMMesh::GetBox=rmmesh_000102040c000200 +3 IDirect3DRMMesh::GetGroup=rmmesh_000102040c000300 +3 IDirect3DRMMesh::GetGroupColor=rmmesh_000102040c000400 +3 IDirect3DRMMesh::GetGroupCount=rmmesh_000102040c000500 +3 IDirect3DRMMesh::GetGroupMapping=rmmesh_000102040c000600 +3 IDirect3DRMMesh::GetGroupMaterial=rmmesh_000102040c000700 +3 IDirect3DRMMesh::GetGroupQuality=rmmesh_000102040c000800 +3 IDirect3DRMMesh::GetGroupTexture=rmmesh_000102040c000900 +3 IDirect3DRMMesh::GetVertices=rmmesh_000102040c000a00 +3 IDirect3DRMMesh::Scale=rmmesh_000102040c000b00 +3 IDirect3DRMMesh::SetGroupColor=rmmesh_000102040c000c00 +3 IDirect3DRMMesh::SetGroupColorRGB=rmmesh_000102040c000d00 +3 IDirect3DRMMesh::SetGroupMapping=rmmesh_000102040c000e00 +3 IDirect3DRMMesh::SetGroupMaterial=rmmesh_000102040c000f00 +3 IDirect3DRMMesh::SetGroupQuality=rmmesh_000102040c001000 +3 IDirect3DRMMesh::SetGroupTexture=rmmesh_000102040c001100 +3 IDirect3DRMMesh::SetVertices=rmmesh_000102040c001200 +3 IDirect3DRMMesh::Translate=rmmesh_000102040c001300 +3 IDirect3DRMMeshBuilder +3 IDirect3DRMMeshBuilder=rmmshbld_000102040d000000 +3 IDirect3DRMMeshBuilder::AddFace=rmmshbld_000102040d000100 +3 IDirect3DRMMeshBuilder::AddFaces=rmmshbld_000102040d000200 +3 IDirect3DRMMeshBuilder::AddFrame=rmmshbld_000102040d000300 +3 IDirect3DRMMeshBuilder::AddMesh=rmmshbld_000102040d000400 +3 IDirect3DRMMeshBuilder::AddMeshBuilder=rmmshbld_000102040d000500 +3 IDirect3DRMMeshBuilder::AddNormal=rmmshbld_000102040d000600 +3 IDirect3DRMMeshBuilder::AddVertex=rmmshbld_000102040d000700 +3 IDirect3DRMMeshBuilder::CreateFace=rmmshbld_000102040d000800 +3 IDirect3DRMMeshBuilder::CreateMesh=rmmshbld_000102040d000900 +3 IDirect3DRMMeshBuilder::GenerateNormals=rmmshbld_000102040d000a00 +3 IDirect3DRMMeshBuilder::GetBox=rmmshbld_000102040d000b00 +3 IDirect3DRMMeshBuilder::GetColorSource=rmmshbld_000102040d000c00 +3 IDirect3DRMMeshBuilder::GetFaceCount=rmmshbld_000102040d000d00 +3 IDirect3DRMMeshBuilder::GetFaces=rmmshbld_000102040d000e00 +3 IDirect3DRMMeshBuilder::GetPerspective=rmmshbld_000102040d000f00 +3 IDirect3DRMMeshBuilder::GetQuality=rmmshbld_000102040d001000 +3 IDirect3DRMMeshBuilder::GetTextureCoordinates=rmmshbld_000102040d001100 +3 IDirect3DRMMeshBuilder::GetVertexColor=rmmshbld_000102040d001200 +3 IDirect3DRMMeshBuilder::GetVertexCount=rmmshbld_000102040d001300 +3 IDirect3DRMMeshBuilder::GetVertices=rmmshbld_000102040d001400 +3 IDirect3DRMMeshBuilder::Load=rmmshbld_000102040d001500 +3 IDirect3DRMMeshBuilder::ReserveSpace=rmmshbld_000102040d001600 +3 IDirect3DRMMeshBuilder::Save=rmmshbld_000102040d001700 +3 IDirect3DRMMeshBuilder::Scale=rmmshbld_000102040d001800 +3 IDirect3DRMMeshBuilder::SetColor=rmmshbld_000102040d001900 +3 IDirect3DRMMeshBuilder::SetColorRGB=rmmshbld_000102040d001a00 +3 IDirect3DRMMeshBuilder::SetColorSource=rmmshbld_000102040d001b00 +3 IDirect3DRMMeshBuilder::SetMaterial=rmmshbld_000102040d001c00 +3 IDirect3DRMMeshBuilder::SetNormal=rmmshbld_000102040d001d00 +3 IDirect3DRMMeshBuilder::SetPerspective=rmmshbld_000102040d001e00 +3 IDirect3DRMMeshBuilder::SetQuality=rmmshbld_000102040d001f00 +3 IDirect3DRMMeshBuilder::SetTexture=rmmshbld_000102040d002000 +3 IDirect3DRMMeshBuilder::SetTextureCoordinates=rmmshbld_000102040d002100 +3 IDirect3DRMMeshBuilder::SetTextureTopology=rmmshbld_000102040d002200 +3 IDirect3DRMMeshBuilder::SetVertex=rmmshbld_000102040d002300 +3 IDirect3DRMMeshBuilder::SetVertexColor=rmmshbld_000102040d002400 +3 IDirect3DRMMeshBuilder::SetVertexColorRGB=rmmshbld_000102040d002500 +3 IDirect3DRMMeshBuilder::Translate=rmmshbld_000102040d002600 +3 IDirect3DRMObject +3 IDirect3DRMObject=rmobject_000102040e000000 +3 IDirect3DRMObject::AddDestroyCallback=rmobject_000102040e000100 +3 IDirect3DRMObject::Clone=rmobject_000102040e000200 +3 IDirect3DRMObject::DeleteDestroyCallback=rmobject_000102040e000300 +3 IDirect3DRMObject::GetAppData=rmobject_000102040e000400 +3 IDirect3DRMObject::GetClassName=rmobject_000102040e000500 +3 IDirect3DRMObject::GetName=rmobject_000102040e000600 +3 IDirect3DRMObject::SetAppData=rmobject_000102040e000700 +3 IDirect3DRMObject::SetName=rmobject_000102040e000800 +3 IDirect3DRMShadow +3 IDirect3DRMShadow=rmshadow_000102040f000000 +3 IDirect3DRMShadow::Init=rmshadow_000102040f000100 +3 IDirect3DRMTexture +3 IDirect3DRMTexture=rmtextur_0001020410000000 +3 IDirect3DRMTexture::Changed=rmtextur_0001020410000100 +3 IDirect3DRMTexture::GetColors=rmtextur_0001020410000200 +3 IDirect3DRMTexture::GetDecalOrigin=rmtextur_0001020410000300 +3 IDirect3DRMTexture::GetDecalScale=rmtextur_0001020410000400 +3 IDirect3DRMTexture::GetDecalSize=rmtextur_0001020410000500 +3 IDirect3DRMTexture::GetDecalTransparency=rmtextur_0001020410000600 +3 IDirect3DRMTexture::GetDecalTransparentColor=rmtextur_0001020410000700 +3 IDirect3DRMTexture::GetImage=rmtextur_0001020410000800 +3 IDirect3DRMTexture::GetShades=rmtextur_0001020410000900 +3 IDirect3DRMTexture::InitFromFile=rmtextur_0001020410000a00 +3 IDirect3DRMTexture::InitFromResource=rmtextur_0001020410000b00 +3 IDirect3DRMTexture::InitFromSurface=rmtextur_0001020410000c00 +3 IDirect3DRMTexture::SetColors=rmtextur_0001020410000d00 +3 IDirect3DRMTexture::SetDecalOrigin=rmtextur_0001020410000e00 +3 IDirect3DRMTexture::SetDecalScale=rmtextur_0001020410000f00 +3 IDirect3DRMTexture::SetDecalSize=rmtextur_0001020410001000 +3 IDirect3DRMTexture::SetDecalTransparency=rmtextur_0001020410001100 +3 IDirect3DRMTexture::SetDecalTransparentColor=rmtextur_0001020410001200 +3 IDirect3DRMTexture::SetShades=rmtextur_0001020410001300 +3 IDirect3DRMUserVisual +3 IDirect3DRMUserVisual=rmuservz_0001020411000000 +3 IDirect3DRMUserVisual::Init=rmuservz_0001020411000100 +3 IDirect3DRMViewport +3 IDirect3DRMViewport=rmviewpt_0001020412000000 +3 IDirect3DRMViewport::Clear=rmviewpt_0001020412000100 +3 IDirect3DRMViewport::Configure=rmviewpt_0001020412000200 +3 IDirect3DRMViewport::ForceUpdate=rmviewpt_0001020412000300 +3 IDirect3DRMViewport::GetBack=rmviewpt_0001020412000400 +3 IDirect3DRMViewport::GetCamera=rmviewpt_0001020412000500 +3 IDirect3DRMViewport::GetDevice=rmviewpt_0001020412000600 +3 IDirect3DRMViewport::GetDirect3DViewport=rmviewpt_0001020412000700 +3 IDirect3DRMViewport::GetField=rmviewpt_0001020412000800 +3 IDirect3DRMViewport::GetFront=rmviewpt_0001020412000900 +3 IDirect3DRMViewport::GetHeight=rmviewpt_0001020412000a00 +3 IDirect3DRMViewport::GetPlane=rmviewpt_0001020412000b00 +3 IDirect3DRMViewport::GetProjection=rmviewpt_0001020412000c00 +3 IDirect3DRMViewport::GetUniformScaling=rmviewpt_0001020412000d00 +3 IDirect3DRMViewport::GetWidth=rmviewpt_0001020412000e00 +3 IDirect3DRMViewport::GetX=rmviewpt_0001020412000f00 +3 IDirect3DRMViewport::GetY=rmviewpt_0001020412001000 +3 IDirect3DRMViewport::Init=rmviewpt_0001020412001100 +3 IDirect3DRMViewport::InverseTransform=rmviewpt_0001020412001200 +3 IDirect3DRMViewport::Pick=rmviewpt_0001020412001300 +3 IDirect3DRMViewport::Render=rmviewpt_0001020412001400 +3 IDirect3DRMViewport::SetBack=rmviewpt_0001020412001500 +3 IDirect3DRMViewport::SetCamera=rmviewpt_0001020412001600 +3 IDirect3DRMViewport::SetField=rmviewpt_0001020412001700 +3 IDirect3DRMViewport::SetFront=rmviewpt_0001020412001800 +3 IDirect3DRMViewport::SetPlane=rmviewpt_0001020412001900 +3 IDirect3DRMViewport::SetProjection=rmviewpt_0001020412001a00 +3 IDirect3DRMViewport::SetUniformScaling=rmviewpt_0001020412001b00 +3 IDirect3DRMViewport::Transform=rmviewpt_0001020412001c00 +3 IDirect3DRMWinDevice +3 IDirect3DRMWinDevice=rmwindev_0001020413000000 +3 IDirect3DRMWinDevice::HandleActivate=rmwindev_0001020413000100 +3 IDirect3DRMWinDevice::HandlePaint=rmwindev_0001020413000200 +3 IDirect3DRMWrap +3 IDirect3DRMWrap=rmwrap_0001020414000000 +3 IDirect3DRMWrap::Apply=rmwrap_0001020414000100 +3 IDirect3DRMWrap::ApplyRelative=rmwrap_0001020414000200 +3 IDirect3DRMWrap::Init=rmwrap_0001020414000300 +3 Structures +3 D3DRMBOX=rmtypes_0001020415000100 +3 D3DRMIMAGE=rmtypes_0001020415000200 +3 D3DRMLOADMEMORY=rmtypes_0001020415000300 +3 D3DRMLOADRESOURCE=rmtypes_0001020415000400 +3 D3DRMPALETTEENTRY=rmtypes_0001020415000500 +3 D3DRMPICKDESC=rmtypes_0001020415000600 +3 D3DRMQUATERNION=rmtypes_0001020415000700 +3 D3DRMVECTOR4D=rmtypes_0001020415000800 +3 D3DRMVERTEX=rmtypes_0001020415000900 +3 Enumerated Types +3 D3DRMCOLORSOURCE=rmtypes_0001020416000100 +3 D3DRMCOMBINETYPE=rmtypes_0001020416000200 +3 D3DRMFILLMODE=rmtypes_0001020416000300 +3 D3DRMFOGMODE=rmtypes_0001020416000400 +3 D3DRMFRAMECONSTRAINT=rmtypes_0001020416000500 +3 D3DRMLIGHTMODE=rmtypes_0001020416000600 +3 D3DRMLIGHTTYPE=rmtypes_0001020416000700 +3 D3DRMMATERIALMODE=rmtypes_0001020416000800 +3 D3DRMPALETTEFLAGS=rmtypes_0001020416000900 +3 D3DRMPROJECTIONTYPE=rmtypes_0001020416000a00 +3 D3DRMRENDERQUALITY=rmtypes_0001020416000b00 +3 D3DRMSHADEMODE=rmtypes_0001020416000c00 +3 D3DRMSORTMODE=rmtypes_0001020416000d00 +3 D3DRMTEXTUREQUALITY=rmtypes_0001020416000e00 +3 D3DRMUSERVISUALREASON=rmtypes_0001020416000f00 +3 D3DRMWRAPTYPE=rmtypes_0001020416001000 +3 D3DRMXOFFORMAT=rmtypes_0001020416001100 +3 D3DRMZBUFFERMODE=rmtypes_0001020416001200 +3 Other Types +3 D3DRMANIMATIONOPTIONS=rmtypes_0001020417000100 +3 D3DRMCOLORMODEL=rmtypes_0001020417000200 +3 D3DRMLOADOPTIONS=rmtypes_0001020417000300 +3 D3DRMMAPPING=rmtypes_0001020417000400 +3 D3DRMMATRIX4D=rmtypes_0001020417000500 +3 D3DRMSAVEOPTIONS=rmtypes_0001020417000600 +2 Return Values=rmtypes_0001020418000000 +2 Immediate-Mode Reference +3 Macros +3 D3DDivide=d3dapi_0001020501000100 +3 D3DMultiply=d3dapi_0001020501000200 +3 D3DRGB=d3dapi_0001020501000300 +3 D3DRGBA=d3dapi_0001020501000400 +3 D3DSTATE_OVERRIDE=d3dapi_0001020501000500 +3 D3DVAL=d3dapi_0001020501000600 +3 D3DVALP=d3dapi_0001020501000700 +3 RGB_GETBLUE=d3dapi_0001020501000800 +3 RGB_GETGREEN=d3dapi_0001020501000900 +3 RGB_GETRED=d3dapi_0001020501000a00 +3 RGB_MAKE=d3dapi_0001020501000b00 +3 RGB_TORGBA=d3dapi_0001020501000c00 +3 RGBA_GETALPHA=d3dapi_0001020501000d00 +3 RGBA_GETBLUE=d3dapi_0001020501000e00 +3 RGBA_GETGREEN=d3dapi_0001020501000f00 +3 RGBA_GETRED=d3dapi_0001020501001000 +3 RGBA_MAKE=d3dapi_0001020501001100 +3 RGBA_SETALPHA=d3dapi_0001020501001200 +3 RGBA_TORGB=d3dapi_0001020501001300 +3 Callback Functions +3 D3DENUMDEVICESCALLBACK=d3dapi_0001020502000100 +3 D3DENUMTEXTUREFORMATSCALLBACK=d3dapi_0001020502000200 +3 D3DVALIDATECALLBACK=d3dapi_0001020502000300 +3 IDirect3D +3 IDirect3D=id3dapi_0001020503000000 +3 IDirect3D::CreateLight=id3dapi_0001020503000100 +3 IDirect3D::CreateMaterial=id3dapi_0001020503000200 +3 IDirect3D::CreateViewport=id3dapi_0001020503000300 +3 IDirect3D::EnumDevices=id3dapi_0001020503000400 +3 IDirect3D::FindDevice=id3dapi_0001020503000500 +3 IDirect3D::Initialize=id3dapi_0001020503000600 +3 IDirect3DDevice +3 IDirect3DDevice=id3ddevc_0001020504000000 +3 IDirect3DDevice::AddViewport=id3ddevc_0001020504000100 +3 IDirect3DDevice::BeginScene=id3ddevc_0001020504000200 +3 IDirect3DDevice::CreateExecuteBuffer=id3ddevc_0001020504000300 +3 IDirect3DDevice::CreateMatrix=id3ddevc_0001020504000400 +3 IDirect3DDevice::DeleteMatrix=id3ddevc_0001020504000500 +3 IDirect3DDevice::DeleteViewport=id3ddevc_0001020504000600 +3 IDirect3DDevice::EndScene=id3ddevc_0001020504000700 +3 IDirect3DDevice::EnumTextureFormats=id3ddevc_0001020504000800 +3 IDirect3DDevice::Execute=id3ddevc_0001020504000900 +3 IDirect3DDevice::GetCaps=id3ddevc_0001020504000a00 +3 IDirect3DDevice::GetDirect3D=id3ddevc_0001020504000b00 +3 IDirect3DDevice::GetMatrix=id3ddevc_0001020504000c00 +3 IDirect3DDevice::GetPickRecords=id3ddevc_0001020504000d00 +3 IDirect3DDevice::GetStats=id3ddevc_0001020504000e00 +3 IDirect3DDevice::Initialize=id3ddevc_0001020504000f00 +3 IDirect3DDevice::NextViewport=id3ddevc_0001020504001000 +3 IDirect3DDevice::Pick=id3ddevc_0001020504001100 +3 IDirect3DDevice::SetMatrix=id3ddevc_0001020504001200 +3 IDirect3DDevice::SwapTextureHandles=id3ddevc_0001020504001300 +3 IDirect3DExecuteBuffer +3 IDirect3DExecuteBuffer=id3dexbf_0001020505000000 +3 IDirect3DExecuteBuffer::GetExecuteData=id3dexbf_0001020505000100 +3 IDirect3DExecuteBuffer::Initialize=id3dexbf_0001020505000200 +3 IDirect3DExecuteBuffer::Lock=id3dexbf_0001020505000300 +3 IDirect3DExecuteBuffer::Optimize=id3dexbf_0001020505000400 +3 IDirect3DExecuteBuffer::SetExecuteData=id3dexbf_0001020505000500 +3 IDirect3DExecuteBuffer::Unlock=id3dexbf_0001020505000600 +3 IDirect3DExecuteBuffer::Validate=id3dexbf_0001020505000700 +3 IDirect3DLight +3 IDirect3DLight=id3dlite_0001020506000000 +3 IDirect3DLight::GetLight=id3dlite_0001020506000100 +3 IDirect3DLight::Initialize=id3dlite_0001020506000200 +3 IDirect3DLight::SetLight=id3dlite_0001020506000300 +3 IDirect3DMaterial +3 IDirect3DMaterial=id3dmat_0001020507000000 +3 IDirect3DMaterial::GetHandle=id3dmat_0001020507000100 +3 IDirect3DMaterial::GetMaterial=id3dmat_0001020507000200 +3 IDirect3DMaterial::Initialize=id3dmat_0001020507000300 +3 IDirect3DMaterial::Reserve=id3dmat_0001020507000400 +3 IDirect3DMaterial::SetMaterial=id3dmat_0001020507000500 +3 IDirect3DMaterial::Unreserve=id3dmat_0001020507000600 +3 IDirect3DTexture +3 IDirect3DTexture=id3dtext_0001020508000000 +3 IDirect3DTexture::GetHandle=id3dtext_0001020508000100 +3 IDirect3DTexture::Initialize=id3dtext_0001020508000200 +3 IDirect3DTexture::Load=id3dtext_0001020508000300 +3 IDirect3DTexture::PaletteChanged=id3dtext_0001020508000400 +3 IDirect3DTexture::Unload=id3dtext_0001020508000500 +3 IDirect3DViewport +3 IDirect3DViewport=id3dview_0001020509000000 +3 IDirect3DViewport::AddLight=id3dview_0001020509000100 +3 IDirect3DViewport::Clear=id3dview_0001020509000200 +3 IDirect3DViewport::DeleteLight=id3dview_0001020509000300 +3 IDirect3DViewport::GetBackground=id3dview_0001020509000400 +3 IDirect3DViewport::GetBackgroundDepth=id3dview_0001020509000500 +3 IDirect3DViewport::GetViewport=id3dview_0001020509000600 +3 IDirect3DViewport::Initialize=id3dview_0001020509000700 +3 IDirect3DViewport::LightElements=id3dview_0001020509000800 +3 IDirect3DViewport::NextLight=id3dview_0001020509000900 +3 IDirect3DViewport::SetBackground=id3dview_0001020509000a00 +3 IDirect3DViewport::SetBackgroundDepth=id3dview_0001020509000b00 +3 IDirect3DViewport::SetViewport=id3dview_0001020509000c00 +3 IDirect3DViewport::TransformVertices=id3dview_0001020509000d00 +3 Structures +3 D3DBRANCH=id3dtype_000102050a000100 +3 D3DCOLORVALUE=id3dtype_000102050a000200 +3 D3DDEVICEDESC=id3dtype_000102050a000300 +3 D3DEXECUTEBUFFERDESC=id3dtype_000102050a000400 +3 D3DEXECUTEDATA=id3dtype_000102050a000500 +3 D3DFINDDEVICERESULT=id3dtype_000102050a000600 +3 D3DFINDDEVICESEARCH=id3dtype_000102050a000700 +3 D3DHVERTEX=id3dtype_000102050a000800 +3 D3DINSTRUCTION=id3dtype_000102050a000900 +3 D3DLIGHT=id3dtype_000102050a000a00 +3 D3DLIGHTDATA=id3dtype_000102050a000b00 +3 D3DLIGHTINGCAPS=id3dtype_000102050a000c00 +3 D3DLIGHTINGELEMENT=id3dtype_000102050a000d00 +3 D3DLINE=id3dtype_000102050a000e00 +3 D3DLINEPATTERN=id3dtype_000102050a000f00 +3 D3DLVERTEX=id3dtype_000102050a001000 +3 D3DMATERIAL=id3dtype_000102050a001100 +3 D3DMATRIX=id3dtype_000102050a001200 +3 D3DMATRIXLOAD=id3dtype_000102050a001300 +3 D3DMATRIXMULTIPLY=id3dtype_000102050a001400 +3 D3DPICKRECORD=id3dtype_000102050a001500 +3 D3DPOINT=id3dtype_000102050a001600 +3 D3DPRIMCAPS=id3dtype_000102050a001700 +3 D3DPROCESSVERTICES=id3dtype_000102050a001800 +3 D3DRECT=id3dtype_000102050a001900 +3 D3DSPAN=id3dtype_000102050a001a00 +3 D3DSTATE=id3dtype_000102050a001b00 +3 D3DSTATS=id3dtype_000102050a001c00 +3 D3DSTATUS=id3dtype_000102050a001d00 +3 D3DTEXTURELOAD=id3dtype_000102050a001e00 +3 D3DTLVERTEX=id3dtype_000102050a001f00 +3 D3DTRANSFORMCAPS=id3dtype_000102050a002000 +3 D3DTRANSFORMDATA=id3dtype_000102050a002100 +3 D3DTRIANGLE=id3dtype_000102050a002200 +3 D3DVECTOR=id3dtype_000102050a002300 +3 D3DVERTEX=id3dtype_000102050a002400 +3 D3DVIEWPORT=id3dtype_000102050a002500 +3 Enumerated Types +3 D3DBLEND=id3dtype_000102050b000100 +3 D3DCMPFUNC=id3dtype_000102050b000200 +3 D3DCOLORMODEL=id3dtype_000102050b000300 +3 D3DCULL=id3dtype_000102050b000400 +3 D3DFILLMODE=id3dtype_000102050b000500 +3 D3DFOGMODE=id3dtype_000102050b000600 +3 D3DLIGHTSTATETYPE=id3dtype_000102050b000700 +3 D3DLIGHTTYPE=id3dtype_000102050b000800 +3 D3DOPCODE=id3dtype_000102050b000900 +3 D3DRENDERSTATETYPE=id3dtype_000102050b000a00 +3 D3DSHADEMODE=id3dtype_000102050b000b00 +3 D3DTEXTUREADDRESS=id3dtype_000102050b000c00 +3 D3DTEXTUREBLEND=id3dtype_000102050b000d00 +3 D3DTEXTUREFILTER=id3dtype_000102050b000e00 +3 D3DTRANSFORMSTATETYPE=id3dtype_000102050b000f00 +3 Other Types +3 D3DCOLOR=id3dtype_000102050c000100 +3 D3DVALUE=id3dtype_000102050c000200 +2 Return Values=id3dtype_000102050d000000 +1 DirectInput +1 New Information for DirectX 3=dinput_0001030101000000 +2 Overview +2 Introduction to Joysticks=dinput_0001030102010000 +2 Joystick Capabilities=dinput_0001030102020000 +2 Joystick Calibration and Testing=dinput_0001030102030000 +2 Joystick Position=dinput_0001030102040000 +2 Reference +2 Joystick Groups=dinput_0001030103010000 +3 Functions +3 joyConfigChanged=dinput_0001030103020100 +3 joyGetDevCaps=dinput_0001030103020200 +3 joyGetNumDevs=dinput_0001030103020300 +3 joyGetPosEx=dinput_0001030103020400 +3 Structures +3 JOYCAPS=dinput_0001030103030100 +3 JOYINFOEX=dinput_0001030103030200 +2 Return Values=dinput_0001030103040000 +1 DirectSetup +1 About DirectSetup=dsetup_0001030201000000 +2 DirectSetup Overview +2 DirectSetup Overview=dsetup_0001030202000000 +2 Using the DirectXSetup Function=dsetup_0001030202010000 +3 Preparing a DirectX Application for Installation +3 Preparing a DirectX Application for Installation=dsetup_0001030202020000 +3 Creating the Setup Program=dsetup_0001030202020100 +3 Setting Up the Application Directory=dsetup_0001030202020200 +2 Enabling AutoPlay=dsetup_0001030202030000 +2 DirectSetup Reference +3 Functions +3 DirectXRegisterApplication=dsetup_0001030203010100 +3 DirectXSetup=dsetup_0001030203010200 +3 Structure +3 DIRECTXREGISTERAPP=dsetup_0001030203020100 +2 Return Values=dsetup_0001030203030000 +1 AutoPlay +2 Overview +2 About AutoPlay=autoplay_0001030301010000 +2 How AutoPlay Works=autoplay_0001030301020000 +2 The Autorun.inf File=autoplay_0001030301030000 +3 Tips for Writing AutoPlay Applications +3 Tips for Writing AutoPlay Applications=autoplay_0001030301040000 +3 Opening a Startup Application=autoplay_0001030301040100 +3 Loading in the Background=autoplay_0001030301040200 +3 Conserving Hard Disk Space=autoplay_0001030301040300 +3 Using the Registry=autoplay_0001030301040400 +3 Setting the NoDriveTypeAutoRun Value=autoplay_0001030301040500 +2 Suppressing AutoPlay=autoplay_0001030301050000 +2 AutoPlay for MS-DOS-Based Applications=autoplay_0001030301060000 +2 Reference +3 Commands +3 defaulticon=autoplay_0001030302010100 +3 icon=autoplay_0001030302010200 +3 open=autoplay_0001030302010300 +3 shell=autoplay_0001030302010400 +3 shell\verb=autoplay_0001030302010500 +1 Glossary +1 A=glossary_0001030401000000 +1 B=glossary_0001030402000000 +1 C=glossary_0001030403000000 +1 D=glossary_0001030404000000 +1 E=glossary_0001030405000000 +1 F=glossary_0001030406000000 +1 G=glossary_0001030407000000 +1 H=glossary_0001030408000000 +1 L=glossary_0001030409000000 +1 M=glossary_000103040a000000 +1 N=glossary_000103040b000000 +1 O=glossary_000103040c000000 +1 P=glossary_000103040d000000 +1 Q=glossary_000103040e000000 +1 R=glossary_000103040f000000 +1 S=glossary_0001030410000000 +1 T=glossary_0001030411000000 +1 U=glossary_0001030412000000 +1 V=glossary_0001030413000000 +1 W=glossary_0001030414000000 +1 Z=glossary_0001030415000000 diff --git a/docs/winhelp/directx.hlp b/docs/winhelp/directx.hlp new file mode 100644 index 0000000..81616ef Binary files /dev/null and b/docs/winhelp/directx.hlp differ diff --git a/docs/worddoc/autoplay.doc b/docs/worddoc/autoplay.doc new file mode 100644 index 0000000..f184174 Binary files /dev/null and b/docs/worddoc/autoplay.doc differ diff --git a/docs/worddoc/d3dimref.doc b/docs/worddoc/d3dimref.doc new file mode 100644 index 0000000..48fbb7b Binary files /dev/null and b/docs/worddoc/d3dimref.doc differ diff --git a/docs/worddoc/d3dover.doc b/docs/worddoc/d3dover.doc new file mode 100644 index 0000000..42474c4 Binary files /dev/null and b/docs/worddoc/d3dover.doc differ diff --git a/docs/worddoc/d3drmref.doc b/docs/worddoc/d3drmref.doc new file mode 100644 index 0000000..3cc2688 Binary files /dev/null and b/docs/worddoc/d3drmref.doc differ diff --git a/docs/worddoc/ddraw.doc b/docs/worddoc/ddraw.doc new file mode 100644 index 0000000..951d0cf Binary files /dev/null and b/docs/worddoc/ddraw.doc differ diff --git a/docs/worddoc/dinput.doc b/docs/worddoc/dinput.doc new file mode 100644 index 0000000..7a8a4c7 Binary files /dev/null and b/docs/worddoc/dinput.doc differ diff --git a/docs/worddoc/dinput3e.doc b/docs/worddoc/dinput3e.doc new file mode 100644 index 0000000..e5877f1 Binary files /dev/null and b/docs/worddoc/dinput3e.doc differ diff --git a/docs/worddoc/dplay.doc b/docs/worddoc/dplay.doc new file mode 100644 index 0000000..7d13e61 Binary files /dev/null and b/docs/worddoc/dplay.doc differ diff --git a/docs/worddoc/dsetup.doc b/docs/worddoc/dsetup.doc new file mode 100644 index 0000000..bb15f08 Binary files /dev/null and b/docs/worddoc/dsetup.doc differ diff --git a/docs/worddoc/dsound.doc b/docs/worddoc/dsound.doc new file mode 100644 index 0000000..e8a7f22 Binary files /dev/null and b/docs/worddoc/dsound.doc differ diff --git a/docs/worddoc/dxintro.doc b/docs/worddoc/dxintro.doc new file mode 100644 index 0000000..e403daa Binary files /dev/null and b/docs/worddoc/dxintro.doc differ diff --git a/docs/worddoc/glossary.doc b/docs/worddoc/glossary.doc new file mode 100644 index 0000000..3ce8298 Binary files /dev/null and b/docs/worddoc/glossary.doc differ diff --git a/docs/worddoc/readme.txt b/docs/worddoc/readme.txt new file mode 100644 index 0000000..ee69e7d --- /dev/null +++ b/docs/worddoc/readme.txt @@ -0,0 +1,15 @@ +The DirectX documentation in this directory contains the same information +as the WinHelp documentation in the WinHelp directory of this SDK. The +WinHelp format of the documentation is generally easier to use than the Word +format because of its many hypertext links and other navigational aids. + +Before printing any of the Word documentation, you should rebuild the table +of contents for that file so that the page numbers are accurate for your +printer. To do this, select the table of contents in Word, right-click the +selection, and then click Update Field. In the Update Table Of Contents +dialog box, click the Update Entire Table option, and then click OK. + +The Word format of the Direct3D documentation is provided in several +files so that the file sizes are more manageable. (The Direct3D +documentation appears as one section in the WinHelp format.) + diff --git a/dx3dsdk.inf b/dx3dsdk.inf new file mode 100644 index 0000000..5662cd8 --- /dev/null +++ b/dx3dsdk.inf @@ -0,0 +1,12 @@ +[version] +signature="$CHICAGO$" + +[DefaultInstall] +AddReg=add.reg + +[add.reg] +HKLM,"%DP%","D3D Path",,"C:\CODE\DXSDK3\sdk\media" + +[Strings] +DP = "Software\Microsoft\Direct3D" + diff --git a/foxbear/foxbear.art b/foxbear/foxbear.art new file mode 100644 index 0000000..efe82d4 Binary files /dev/null and b/foxbear/foxbear.art differ diff --git a/foxbear/foxbear.exe b/foxbear/foxbear.exe new file mode 100755 index 0000000..83114e9 Binary files /dev/null and b/foxbear/foxbear.exe differ diff --git a/iklowns/data/backdrop.bmp b/iklowns/data/backdrop.bmp new file mode 100644 index 0000000..8aaa249 Binary files /dev/null and b/iklowns/data/backdrop.bmp differ diff --git a/iklowns/data/bang.wav b/iklowns/data/bang.wav new file mode 100644 index 0000000..2d270b9 Binary files /dev/null and b/iklowns/data/bang.wav differ diff --git a/iklowns/data/bigtbig.bmp b/iklowns/data/bigtbig.bmp new file mode 100644 index 0000000..de42d96 Binary files /dev/null and b/iklowns/data/bigtbig.bmp differ diff --git a/iklowns/data/bigtbig.tle b/iklowns/data/bigtbig.tle new file mode 100644 index 0000000..d162de0 Binary files /dev/null and b/iklowns/data/bigtbig.tle differ diff --git a/iklowns/data/bigtop.bmp b/iklowns/data/bigtop.bmp new file mode 100644 index 0000000..e428d8d Binary files /dev/null and b/iklowns/data/bigtop.bmp differ diff --git a/iklowns/data/bigtop.tle b/iklowns/data/bigtop.tle new file mode 100644 index 0000000..a115364 Binary files /dev/null and b/iklowns/data/bigtop.tle differ diff --git a/iklowns/data/bigtsml.bmp b/iklowns/data/bigtsml.bmp new file mode 100644 index 0000000..dcbafeb Binary files /dev/null and b/iklowns/data/bigtsml.bmp differ diff --git a/iklowns/data/bigtsml.tle b/iklowns/data/bigtsml.tle new file mode 100644 index 0000000..ee91246 Binary files /dev/null and b/iklowns/data/bigtsml.tle differ diff --git a/iklowns/data/bkgrnd.bmp b/iklowns/data/bkgrnd.bmp new file mode 100644 index 0000000..98ae0ca Binary files /dev/null and b/iklowns/data/bkgrnd.bmp differ diff --git a/iklowns/data/blow1.wav b/iklowns/data/blow1.wav new file mode 100644 index 0000000..aae9ebc Binary files /dev/null and b/iklowns/data/blow1.wav differ diff --git a/iklowns/data/blow2.wav b/iklowns/data/blow2.wav new file mode 100644 index 0000000..f75e99d Binary files /dev/null and b/iklowns/data/blow2.wav differ diff --git a/iklowns/data/c1block.bmp b/iklowns/data/c1block.bmp new file mode 100644 index 0000000..d1d1e0b Binary files /dev/null and b/iklowns/data/c1block.bmp differ diff --git a/iklowns/data/c1block.spr b/iklowns/data/c1block.spr new file mode 100644 index 0000000..e959d67 --- /dev/null +++ b/iklowns/data/c1block.spr @@ -0,0 +1,77 @@ +[BlockLeft] +C1blol01.dib=1 +C1blol03.dib=1 +C1blol05.dib=1 +C1blol07.dib=1 +C1blol09.dib=1 + +[C1blol01.dib] +X=0 +Y=0 +Width=57 +Height=133 + +[C1blol03.dib] +X=57 +Y=0 +Width=57 +Height=133 + +[C1blol05.dib] +X=57 +Y=0 +Width=57 +Height=133 + +[C1blol07.dib] +X=171 +Y=0 +Width=57 +Height=133 + +[C1blol09.dib] +X=114 +Y=0 +Width=57 +Height=133 + +[Sequences] +BlockLeft=3 +BlockRight=3 + +[BlockRight] +C1blor01.dib=1 +C1blor03.dib=1 +C1blor05.dib=1 +C1blor07.dib=1 +C1blor09.dib=1 + +[C1blor01.dib] +X=0 +Y=133 +Width=58 +Height=133 + +[C1blor03.dib] +X=58 +Y=133 +Width=58 +Height=133 + +[C1blor05.dib] +X=58 +Y=133 +Width=58 +Height=133 + +[C1blor07.dib] +X=174 +Y=133 +Width=58 +Height=133 + +[C1blor09.dib] +X=116 +Y=133 +Width=58 +Height=133 diff --git a/iklowns/data/c1duck.bmp b/iklowns/data/c1duck.bmp new file mode 100644 index 0000000..cb71020 Binary files /dev/null and b/iklowns/data/c1duck.bmp differ diff --git a/iklowns/data/c1duck.spr b/iklowns/data/c1duck.spr new file mode 100644 index 0000000..e0b00d2 --- /dev/null +++ b/iklowns/data/c1duck.spr @@ -0,0 +1,78 @@ +[DuckLeft] +C1ducl01.dib=1 +C1ducl05.dib=1 +C1ducl09.dib=1 +C1ducl13.dib=1 +C1ducl17.dib=1 + +[C1ducl01.dib] +X=0 +Y=0 +Width=58 +Height=132 + +[C1ducl05.dib] +X=58 +Y=0 +Width=66 +Height=132 + +[C1ducl09.dib] +X=124 +Y=0 +Width=74 +Height=134 + +[C1ducl13.dib] +X=198 +Y=0 +Width=70 +Height=134 + +[C1ducl17.dib] +X=268 +Y=0 +Width=63 +Height=133 + +[Sequences] +DuckLeft=5 +DuckRight=5 + +[DuckRight] +C1ducr01.dib=1 +C1ducr05.dib=1 +C1ducr09.dib=1 +C1ducr13.dib=1 +C1ducr17.dib=1 + +[C1ducr01.dib] +X=0 +Y=134 +Width=72 +Height=132 + +[C1ducr05.dib] +X=72 +Y=134 +Width=68 +Height=131 + +[C1ducr09.dib] +X=140 +Y=134 +Width=65 +Height=131 + +[C1ducr13.dib] +X=205 +Y=134 +Width=68 +Height=131 + +[C1ducr17.dib] +X=273 +Y=134 +Width=72 +Height=132 + diff --git a/iklowns/data/c1piefac.bmp b/iklowns/data/c1piefac.bmp new file mode 100644 index 0000000..f4219cd Binary files /dev/null and b/iklowns/data/c1piefac.bmp differ diff --git a/iklowns/data/c1piefac.spr b/iklowns/data/c1piefac.spr new file mode 100644 index 0000000..43125d0 --- /dev/null +++ b/iklowns/data/c1piefac.spr @@ -0,0 +1,63 @@ +[PieFaceLeft] +C1pfal01.dib=1 +C1pfal03.dib=1 +C1pfal05.dib=1 +Piefacel.bmp=1 + +[C1pfal01.dib] +X=0 +Y=0 +Width=70 +Height=133 + +[C1pfal03.dib] +X=70 +Y=0 +Width=70 +Height=133 + +[C1pfal05.dib] +X=140 +Y=0 +Width=70 +Height=133 + +[Piefacel.bmp] +X=210 +Y=0 +Width=70 +Height=133 + +[Sequences] +PieFaceLeft=4 +PieFaceRight=4 + +[PieFaceRight] +C1pfar01.dib=1 +C1pfar03.dib=1 +C1pfar05.dib=1 +Piefacer.bmp=1 + +[C1pfar01.dib] +X=0 +Y=133 +Width=70 +Height=133 + +[C1pfar03.dib] +X=70 +Y=133 +Width=58 +Height=133 + +[C1pfar05.dib] +X=128 +Y=133 +Width=58 +Height=133 + +[Piefacer.bmp] +X=186 +Y=133 +Width=58 +Height=133 diff --git a/iklowns/data/c1piehed.bmp b/iklowns/data/c1piehed.bmp new file mode 100644 index 0000000..4764726 Binary files /dev/null and b/iklowns/data/c1piehed.bmp differ diff --git a/iklowns/data/c1piehed.spr b/iklowns/data/c1piehed.spr new file mode 100644 index 0000000..8572f16 --- /dev/null +++ b/iklowns/data/c1piehed.spr @@ -0,0 +1,63 @@ +[PieHeadLeft] +C1phel01.dib=1 +C1phel03.dib=1 +C1phel05.dib=1 +Pieheadl.bmp=1 + +[C1phel01.dib] +X=0 +Y=0 +Width=100 +Height=133 + +[C1phel03.dib] +X=100 +Y=0 +Width=76 +Height=133 + +[C1phel05.dib] +X=176 +Y=0 +Width=57 +Height=133 + +[Pieheadl.bmp] +X=233 +Y=0 +Width=57 +Height=133 + +[Sequences] +PieHeadLeft=4 +PieHeadRight=4 + +[PieHeadRight] +C1pher01.dib=1 +C1pher03.dib=1 +C1pher05.dib=1 +Pieheadr.bmp=1 + +[C1pher01.dib] +X=0 +Y=133 +Width=101 +Height=133 + +[C1pher03.dib] +X=101 +Y=133 +Width=101 +Height=133 + +[C1pher05.dib] +X=202 +Y=133 +Width=101 +Height=133 + +[Pieheadr.bmp] +X=303 +Y=133 +Width=101 +Height=133 diff --git a/iklowns/data/c1poke.bmp b/iklowns/data/c1poke.bmp new file mode 100644 index 0000000..e8deea4 Binary files /dev/null and b/iklowns/data/c1poke.bmp differ diff --git a/iklowns/data/c1poke.spr b/iklowns/data/c1poke.spr new file mode 100644 index 0000000..962601b --- /dev/null +++ b/iklowns/data/c1poke.spr @@ -0,0 +1,77 @@ +[PokeLeft] +C1eyel01.dib=1 +C1eyel03.dib=1 +C1eyel05.dib=1 +C1eyel07.dib=1 +C1eyel09.dib=1 + +[C1eyel01.dib] +X=0 +Y=0 +Width=61 +Height=133 + +[C1eyel03.dib] +X=61 +Y=0 +Width=61 +Height=133 + +[C1eyel05.dib] +X=61 +Y=0 +Width=61 +Height=133 + +[C1eyel07.dib] +X=183 +Y=0 +Width=61 +Height=133 + +[C1eyel09.dib] +X=122 +Y=0 +Width=61 +Height=133 + +[Sequences] +PokeLeft=3 +PokeRight=3 + +[PokeRight] +C1eyer01.dib=1 +C1eyer03.dib=1 +C1eyer05.dib=1 +C1eyer07.dib=1 +C1eyer09.dib=1 + +[C1eyer01.dib] +X=0 +Y=133 +Width=58 +Height=133 + +[C1eyer03.dib] +X=58 +Y=133 +Width=58 +Height=133 + +[C1eyer05.dib] +X=58 +Y=133 +Width=59 +Height=133 + +[C1eyer07.dib] +X=175 +Y=133 +Width=58 +Height=133 + +[C1eyer09.dib] +X=117 +Y=133 +Width=58 +Height=133 diff --git a/iklowns/data/c1run.bmp b/iklowns/data/c1run.bmp new file mode 100644 index 0000000..eb82040 Binary files /dev/null and b/iklowns/data/c1run.bmp differ diff --git a/iklowns/data/c1run.spr b/iklowns/data/c1run.spr new file mode 100644 index 0000000..1293662 --- /dev/null +++ b/iklowns/data/c1run.spr @@ -0,0 +1,119 @@ +[RunLeft] +C1-rul01.dib=1 +C1-rul03.dib=1 +C1-rul05.dib=1 +C1-rul07.dib=1 +C1-rul09.dib=1 +C1-rul11.dib=1 +C1-rul13.dib=1 +C1-rul15.dib=1 + +[C1-rul01.dib] +X=0 +Y=0 +Width=110 +Height=125 + +[C1-rul03.dib] +X=110 +Y=0 +Width=94 +Height=137 + +[C1-rul05.dib] +X=204 +Y=0 +Width=91 +Height=134 + +[C1-rul07.dib] +X=295 +Y=0 +Width=107 +Height=131 + +[C1-rul09.dib] +X=402 +Y=0 +Width=110 +Height=123 + +[C1-rul11.dib] +X=512 +Y=0 +Width=95 +Height=131 + +[C1-rul13.dib] +X=607 +Y=0 +Width=91 +Height=137 + +[C1-rul15.dib] +X=698 +Y=0 +Width=106 +Height=130 + +[Sequences] +RunLeft=8 +RunRight=8 + +[RunRight] +C1-rur01.dib=1 +C1-rur03.dib=1 +C1-rur05.dib=1 +C1-rur07.dib=1 +C1-rur09.dib=1 +C1-rur11.dib=1 +C1-rur13.dib=1 +C1-rur15.dib=1 + +[C1-rur01.dib] +X=0 +Y=137 +Width=105 +Height=123 + +[C1-rur03.dib] +X=105 +Y=137 +Width=87 +Height=136 + +[C1-rur05.dib] +X=192 +Y=137 +Width=90 +Height=133 + +[C1-rur07.dib] +X=282 +Y=137 +Width=110 +Height=130 + +[C1-rur09.dib] +X=392 +Y=137 +Width=106 +Height=125 + +[C1-rur11.dib] +X=498 +Y=137 +Width=87 +Height=132 + +[C1-rur13.dib] +X=585 +Y=137 +Width=95 +Height=138 + +[C1-rur15.dib] +X=680 +Y=137 +Width=109 +Height=131 diff --git a/iklowns/data/c1sad.bmp b/iklowns/data/c1sad.bmp new file mode 100644 index 0000000..6e0da4e Binary files /dev/null and b/iklowns/data/c1sad.bmp differ diff --git a/iklowns/data/c1sad.spr b/iklowns/data/c1sad.spr new file mode 100644 index 0000000..f5313b2 --- /dev/null +++ b/iklowns/data/c1sad.spr @@ -0,0 +1,151 @@ +[C1SadDone] +C1sadl10.dib=1 + +[C1SadLeft] +C1sadl01.dib=1 +C1sadl02.dib=1 +C1sadl03.dib=1 +C1sadl04.dib=1 +C1sadl05.dib=1 +C1sadl06.dib=1 +C1sadl07.dib=1 +C1sadl08.dib=1 +C1sadl09.dib=1 +C1sadl10.dib=1 + +[C1sadl01.dib] +X=0 +Y=0 +Width=140 +Height=140 + +[C1sadl02.dib] +X=140 +Y=0 +Width=140 +Height=140 + +[C1sadl03.dib] +X=280 +Y=0 +Width=140 +Height=140 + +[C1sadl04.dib] +X=420 +Y=0 +Width=140 +Height=140 + +[C1sadl05.dib] +X=560 +Y=0 +Width=140 +Height=140 + +[C1sadl06.dib] +X=700 +Y=0 +Width=140 +Height=140 + +[C1sadl07.dib] +X=840 +Y=0 +Width=140 +Height=140 + +[C1sadl08.dib] +X=980 +Y=0 +Width=140 +Height=140 + +[C1sadl09.dib] +X=1120 +Y=0 +Width=140 +Height=140 + +[C1sadl10.dib] +X=1260 +Y=0 +Width=140 +Height=140 + +[Sequences] +C1SadLeft=10 +C1SadRight=10 +C1SadDone=1 + +[C1SadRight] +C1sadr01.dib=1 +C1sadr02.dib=1 +C1sadr03.dib=1 +C1sadr04.dib=1 +C1sadr05.dib=1 +C1sadr06.dib=1 +C1sadr07.dib=1 +C1sadr08.dib=1 +C1sadr09.dib=1 +C1sadr10.dib=1 + +[C1sadr01.dib] +X=0 +Y=140 +Width=140 +Height=140 + +[C1sadr02.dib] +X=140 +Y=140 +Width=140 +Height=140 + +[C1sadr03.dib] +X=280 +Y=140 +Width=140 +Height=140 + +[C1sadr04.dib] +X=420 +Y=140 +Width=140 +Height=140 + +[C1sadr05.dib] +X=560 +Y=140 +Width=140 +Height=140 + +[C1sadr06.dib] +X=700 +Y=140 +Width=140 +Height=140 + +[C1sadr07.dib] +X=840 +Y=140 +Width=140 +Height=140 + +[C1sadr08.dib] +X=980 +Y=140 +Width=140 +Height=140 + +[C1sadr09.dib] +X=1120 +Y=140 +Width=140 +Height=140 + +[C1sadr10.dib] +X=1260 +Y=140 +Width=140 +Height=140 diff --git a/iklowns/data/c1stand.bmp b/iklowns/data/c1stand.bmp new file mode 100644 index 0000000..9cb6933 Binary files /dev/null and b/iklowns/data/c1stand.bmp differ diff --git a/iklowns/data/c1stand.spr b/iklowns/data/c1stand.spr new file mode 100644 index 0000000..d466bd8 --- /dev/null +++ b/iklowns/data/c1stand.spr @@ -0,0 +1,21 @@ +[StandLeft] +C1thrl01.dib=1 + +[C1thrl01.dib] +X=0 +Y=0 +Width=57 +Height=133 + +[Sequences] +StandLeft=1 +StandRight=1 + +[StandRight] +C1thrr01.dib=1 + +[C1thrr01.dib] +X=0 +Y=133 +Width=79 +Height=133 diff --git a/iklowns/data/c1throw.bmp b/iklowns/data/c1throw.bmp new file mode 100644 index 0000000..065d6bd Binary files /dev/null and b/iklowns/data/c1throw.bmp differ diff --git a/iklowns/data/c1throw.spr b/iklowns/data/c1throw.spr new file mode 100644 index 0000000..f864750 --- /dev/null +++ b/iklowns/data/c1throw.spr @@ -0,0 +1,63 @@ +[ThrowLeft] +c1thrl01.dib=1 +c1thrl05.dib=1 +c1thrl09.dib=1 +c1thrl13.dib=1 + +[c1thrl01.dib] +X=0 +Y=0 +Width=57 +Height=133 + +[c1thrl05.dib] +X=57 +Y=0 +Width=57 +Height=133 + +[c1thrl09.dib] +X=114 +Y=0 +Width=57 +Height=133 + +[c1thrl13.dib] +X=171 +Y=0 +Width=57 +Height=133 + +[Sequences] +ThrowLeft=4 +ThrowRight=4 + +[ThrowRight] +c1thrr01.dib=1 +c1thrr05.dib=1 +c1thrr09.dib=1 +c1thrr13.dib=1 + +[c1thrr01.dib] +X=0 +Y=133 +Width=80 +Height=133 + +[c1thrr05.dib] +X=80 +Y=133 +Width=79 +Height=133 + +[c1thrr09.dib] +X=159 +Y=133 +Width=79 +Height=133 + +[c1thrr13.dib] +X=238 +Y=133 +Width=73 +Height=133 diff --git a/iklowns/data/c1turn.bmp b/iklowns/data/c1turn.bmp new file mode 100644 index 0000000..ee61630 Binary files /dev/null and b/iklowns/data/c1turn.bmp differ diff --git a/iklowns/data/c1turn.spr b/iklowns/data/c1turn.spr new file mode 100644 index 0000000..5900f19 --- /dev/null +++ b/iklowns/data/c1turn.spr @@ -0,0 +1,64 @@ +[Left2Right] +C1turl01.dib=1 +C1turl05.dib=1 +C1turl09.dib=1 +C1turl13.dib=1 + +[C1turl01.dib] +X=0 +Y=0 +Width=76 +Height=133 + +[C1turl05.dib] +X=76 +Y=0 +Width=60 +Height=136 + +[C1turl09.dib] +X=136 +Y=0 +Width=68 +Height=138 + +[C1turl13.dib] +X=204 +Y=0 +Width=86 +Height=138 + +[Sequences] +Left2Right=4 +Right2Left=4 + +[Right2Left] +C1turr01.dib=1 +C1turr05.dib=1 +C1turr09.dib=1 +C1turr13.dib=1 + +[C1turr01.dib] +X=0 +Y=138 +Width=84 +Height=135 + +[C1turr05.dib] +X=84 +Y=138 +Width=73 +Height=131 + +[C1turr09.dib] +X=157 +Y=138 +Width=65 +Height=135 + +[C1turr13.dib] +X=222 +Y=138 +Width=67 +Height=134 + diff --git a/iklowns/data/c1walk.bmp b/iklowns/data/c1walk.bmp new file mode 100644 index 0000000..c8c1b83 Binary files /dev/null and b/iklowns/data/c1walk.bmp differ diff --git a/iklowns/data/c1walk.spr b/iklowns/data/c1walk.spr new file mode 100644 index 0000000..d88d28c --- /dev/null +++ b/iklowns/data/c1walk.spr @@ -0,0 +1,105 @@ +[WalkLeft] +C1wall11.dib=1 +C1wall13.dib=1 +C1wall15.dib=1 +C1wall02.dib=1 +C1wall04.dib=1 +C1wall06.dib=1 +C1wall08.dib=1 + +[C1wall11.dib] +X=0 +Y=0 +Width=64 +Height=137 + +[C1wall13.dib] +X=64 +Y=0 +Width=74 +Height=136 + +[C1wall15.dib] +X=138 +Y=0 +Width=83 +Height=135 + +[C1wall02.dib] +X=221 +Y=0 +Width=70 +Height=135 + +[C1wall04.dib] +X=291 +Y=0 +Width=68 +Height=135 + +[C1wall06.dib] +X=359 +Y=0 +Width=80 +Height=137 + +[C1wall08.dib] +X=439 +Y=0 +Width=83 +Height=136 + +[Sequences] +WalkLeft=7 +WalkRight=7 + +[WalkRight] +C1walr11.dib=1 +C1walr13.dib=1 +C1walr15.dib=1 +C1walr02.dib=1 +C1walr04.dib=1 +C1walr06.dib=1 +C1walr08.dib=1 + +[C1walr11.dib] +X=0 +Y=137 +Width=72 +Height=134 + +[C1walr13.dib] +X=72 +Y=137 +Width=79 +Height=139 + +[C1walr15.dib] +X=151 +Y=137 +Width=83 +Height=138 + +[C1walr02.dib] +X=234 +Y=137 +Width=74 +Height=138 + +[C1walr04.dib] +X=308 +Y=137 +Width=72 +Height=133 + +[C1walr06.dib] +X=380 +Y=137 +Width=83 +Height=135 + +[C1walr08.dib] +X=463 +Y=137 +Width=79 +Height=134 diff --git a/iklowns/data/c1walk45.bmp b/iklowns/data/c1walk45.bmp new file mode 100644 index 0000000..2fdba43 Binary files /dev/null and b/iklowns/data/c1walk45.bmp differ diff --git a/iklowns/data/c1walk45.spr b/iklowns/data/c1walk45.spr new file mode 100644 index 0000000..36ed46d --- /dev/null +++ b/iklowns/data/c1walk45.spr @@ -0,0 +1,237 @@ +[InLeft] +c1u45L01.DIB=1 +c1u45L03.DIB=1 +c1u45L05.DIB=1 +c1u45L07.DIB=1 +c1u45L09.DIB=1 +c1u45L11.DIB=1 +c1u45L13.DIB=1 +c1u45L15.DIB=1 + +[c1u45L01.DIB] +X=0 +Y=0 +Width=67 +Height=133 + +[c1u45L03.DIB] +X=67 +Y=0 +Width=54 +Height=131 + +[c1u45L05.DIB] +X=121 +Y=0 +Width=57 +Height=133 + +[c1u45L07.DIB] +X=178 +Y=0 +Width=64 +Height=136 + +[c1u45L09.DIB] +X=242 +Y=0 +Width=59 +Height=135 + +[c1u45L11.DIB] +X=301 +Y=0 +Width=54 +Height=132 + +[c1u45L13.DIB] +X=355 +Y=0 +Width=60 +Height=134 + +[c1u45L15.DIB] +X=415 +Y=0 +Width=67 +Height=135 + +[Sequences] +InLeft=8 +InRight=8 +OutLeft=8 +OutRight=8 + +[InRight] +c1u45R01.DIB=1 +c1u45R03.DIB=1 +c1u45R05.DIB=1 +c1u45R07.DIB=1 +c1u45R09.DIB=1 +c1u45R11.DIB=1 +c1u45R13.DIB=1 +c1u45R15.DIB=1 + +[c1u45R01.DIB] +X=0 +Y=136 +Width=66 +Height=135 + +[c1u45R03.DIB] +X=66 +Y=136 +Width=66 +Height=132 + +[c1u45R05.DIB] +X=132 +Y=136 +Width=66 +Height=132 + +[c1u45R07.DIB] +X=198 +Y=136 +Width=69 +Height=134 + +[c1u45R09.DIB] +X=267 +Y=136 +Width=64 +Height=134 + +[c1u45R11.DIB] +X=331 +Y=136 +Width=66 +Height=131 + +[c1u45R13.DIB] +X=397 +Y=136 +Width=66 +Height=136 + +[c1u45R15.DIB] +X=463 +Y=136 +Width=66 +Height=137 + +[OutLeft] +C1w45l01.dib=1 +C1w45l03.dib=1 +C1w45l05.dib=1 +C1w45l07.dib=1 +C1w45l09.dib=1 +C1w45l11.dib=1 +C1w45l13.dib=1 +C1w45l15.dib=1 + +[C1w45l01.dib] +X=0 +Y=273 +Width=70 +Height=138 + +[C1w45l03.dib] +X=70 +Y=273 +Width=60 +Height=138 + +[C1w45l05.dib] +X=130 +Y=273 +Width=64 +Height=137 + +[C1w45l07.dib] +X=194 +Y=273 +Width=70 +Height=136 + +[C1w45l09.dib] +X=264 +Y=273 +Width=67 +Height=136 + +[C1w45l11.dib] +X=331 +Y=273 +Width=60 +Height=139 + +[C1w45l13.dib] +X=391 +Y=273 +Width=65 +Height=137 + +[C1w45l15.dib] +X=456 +Y=273 +Width=71 +Height=135 + +[OutRight] +C1w45r01.dib=1 +C1w45r03.dib=1 +C1w45r05.dib=1 +C1w45r07.dib=1 +C1w45r09.dib=1 +C1w45r11.dib=1 +C1w45r13.dib=1 +C1w45r15.dib=1 + +[C1w45r01.dib] +X=0 +Y=412 +Width=65 +Height=136 + +[C1w45r03.dib] +X=65 +Y=412 +Width=52 +Height=139 + +[C1w45r05.dib] +X=117 +Y=412 +Width=57 +Height=136 + +[C1w45r07.dib] +X=174 +Y=412 +Width=62 +Height=135 + +[C1w45r09.dib] +X=236 +Y=412 +Width=55 +Height=138 + +[C1w45r11.dib] +X=291 +Y=412 +Width=52 +Height=138 + +[C1w45r13.dib] +X=343 +Y=412 +Width=66 +Height=139 + +[C1w45r15.dib] +X=409 +Y=412 +Width=69 +Height=137 diff --git a/iklowns/data/c2block.bmp b/iklowns/data/c2block.bmp new file mode 100644 index 0000000..d58f15c Binary files /dev/null and b/iklowns/data/c2block.bmp differ diff --git a/iklowns/data/c2block.spr b/iklowns/data/c2block.spr new file mode 100644 index 0000000..1660be5 --- /dev/null +++ b/iklowns/data/c2block.spr @@ -0,0 +1,49 @@ +[C2BlockLeft] +C2blol01.dib=1 +C2blol05.dib=1 +C2blol09.dib=1 + +[C2blol01.dib] +X=0 +Y=0 +Width=57 +Height=133 + +[C2blol05.dib] +X=57 +Y=0 +Width=57 +Height=133 + +[C2blol09.dib] +X=114 +Y=0 +Width=57 +Height=133 + +[Sequences] +C2BlockLeft=3 +C2BlockRight=3 + +[C2BlockRight] +C2blor01.dib=1 +C2blor05.dib=1 +C2blor09.dib=1 + +[C2blor01.dib] +X=0 +Y=133 +Width=58 +Height=133 + +[C2blor05.dib] +X=58 +Y=133 +Width=58 +Height=133 + +[C2blor09.dib] +X=116 +Y=133 +Width=58 +Height=133 diff --git a/iklowns/data/c2duck.bmp b/iklowns/data/c2duck.bmp new file mode 100644 index 0000000..98ab17d Binary files /dev/null and b/iklowns/data/c2duck.bmp differ diff --git a/iklowns/data/c2duck.spr b/iklowns/data/c2duck.spr new file mode 100644 index 0000000..331c453 --- /dev/null +++ b/iklowns/data/c2duck.spr @@ -0,0 +1,77 @@ +[C2DuckLeft] +C2ducl01.dib=1 +C2ducl05.dib=1 +C2ducl09.dib=1 +C2ducl13.dib=1 +C2ducl17.dib=1 + +[C2ducl01.dib] +X=0 +Y=0 +Width=58 +Height=132 + +[C2ducl05.dib] +X=58 +Y=0 +Width=66 +Height=132 + +[C2ducl09.dib] +X=124 +Y=0 +Width=74 +Height=134 + +[C2ducl13.dib] +X=198 +Y=0 +Width=70 +Height=134 + +[C2ducl17.dib] +X=268 +Y=0 +Width=63 +Height=133 + +[Sequences] +C2DuckLeft=5 +C2DuckRight=5 + +[C2DuckRight] +C2ducr01.dib=1 +C2ducr05.dib=1 +C2ducr09.dib=1 +C2ducr13.dib=1 +C2ducr17.dib=1 + +[C2ducr01.dib] +X=0 +Y=134 +Width=72 +Height=132 + +[C2ducr05.dib] +X=72 +Y=134 +Width=68 +Height=131 + +[C2ducr09.dib] +X=140 +Y=134 +Width=65 +Height=131 + +[C2ducr13.dib] +X=205 +Y=134 +Width=68 +Height=131 + +[C2ducr17.dib] +X=273 +Y=134 +Width=72 +Height=132 diff --git a/iklowns/data/c2piefac.bmp b/iklowns/data/c2piefac.bmp new file mode 100644 index 0000000..2aea263 Binary files /dev/null and b/iklowns/data/c2piefac.bmp differ diff --git a/iklowns/data/c2piefac.spr b/iklowns/data/c2piefac.spr new file mode 100644 index 0000000..02d7dfc --- /dev/null +++ b/iklowns/data/c2piefac.spr @@ -0,0 +1,63 @@ +[C2PieFaceLeft] +C2pfal01.dib=1 +C2pfal03.dib=1 +C2pfal05.dib=1 +C2pfacel.bmp=1 + +[C2pfal01.dib] +X=0 +Y=0 +Width=70 +Height=133 + +[C2pfal03.dib] +X=70 +Y=0 +Width=70 +Height=133 + +[C2pfal05.dib] +X=140 +Y=0 +Width=70 +Height=133 + +[C2pfacel.bmp] +X=210 +Y=0 +Width=70 +Height=133 + +[Sequences] +C2PieFaceLeft=4 +C2PieFaceRight=4 + +[C2PieFaceRight] +C2pfar01.dib=1 +C2pfar03.dib=1 +C2pfar05.dib=1 +C2pfacer.bmp=1 + +[C2pfar01.dib] +X=0 +Y=133 +Width=70 +Height=133 + +[C2pfar03.dib] +X=70 +Y=133 +Width=58 +Height=133 + +[C2pfar05.dib] +X=128 +Y=133 +Width=58 +Height=133 + +[C2pfacer.bmp] +X=186 +Y=133 +Width=58 +Height=133 diff --git a/iklowns/data/c2piehed.bmp b/iklowns/data/c2piehed.bmp new file mode 100644 index 0000000..f808cdb Binary files /dev/null and b/iklowns/data/c2piehed.bmp differ diff --git a/iklowns/data/c2piehed.spr b/iklowns/data/c2piehed.spr new file mode 100644 index 0000000..0da187b --- /dev/null +++ b/iklowns/data/c2piehed.spr @@ -0,0 +1,63 @@ +[C2PieHeadLeft] +C2phel01.dib=1 +C2phel03.dib=1 +C2phel05.dib=1 +C2pheadl.bmp=1 + +[C2phel01.dib] +X=0 +Y=0 +Width=100 +Height=133 + +[C2phel03.dib] +X=100 +Y=0 +Width=76 +Height=133 + +[C2phel05.dib] +X=176 +Y=0 +Width=57 +Height=133 + +[C2pheadl.bmp] +X=233 +Y=0 +Width=57 +Height=133 + +[Sequences] +C2PieHeadLeft=4 +C2PieHeadRight=4 + +[C2PieHeadRight] +C2pher01.dib=1 +C2pher03.dib=1 +C2pher05.dib=1 +C2pheadr.bmp=1 + +[C2pher01.dib] +X=0 +Y=133 +Width=101 +Height=133 + +[C2pher03.dib] +X=101 +Y=133 +Width=101 +Height=133 + +[C2pher05.dib] +X=202 +Y=133 +Width=101 +Height=133 + +[C2pheadr.bmp] +X=303 +Y=133 +Width=101 +Height=133 diff --git a/iklowns/data/c2poke.bmp b/iklowns/data/c2poke.bmp new file mode 100644 index 0000000..1822432 Binary files /dev/null and b/iklowns/data/c2poke.bmp differ diff --git a/iklowns/data/c2poke.spr b/iklowns/data/c2poke.spr new file mode 100644 index 0000000..b118d17 --- /dev/null +++ b/iklowns/data/c2poke.spr @@ -0,0 +1,49 @@ +[C2PokeLeft] +C2eyel01.dib=1 +C2eyel05.dib=1 +C2eyel09.dib=1 + +[C2eyel01.dib] +X=0 +Y=0 +Width=61 +Height=133 + +[C2eyel05.dib] +X=61 +Y=0 +Width=61 +Height=133 + +[C2eyel09.dib] +X=122 +Y=0 +Width=61 +Height=133 + +[Sequences] +C2PokeLeft=3 +C2PokeRight=3 + +[C2PokeRight] +C2eyer01.dib=1 +C2eyer05.dib=1 +C2eyer09.dib=1 + +[C2eyer01.dib] +X=0 +Y=133 +Width=58 +Height=133 + +[C2eyer05.dib] +X=58 +Y=133 +Width=59 +Height=133 + +[C2eyer09.dib] +X=117 +Y=133 +Width=58 +Height=133 diff --git a/iklowns/data/c2run.bmp b/iklowns/data/c2run.bmp new file mode 100644 index 0000000..2af321b Binary files /dev/null and b/iklowns/data/c2run.bmp differ diff --git a/iklowns/data/c2run.spr b/iklowns/data/c2run.spr new file mode 100644 index 0000000..fe6b5d5 --- /dev/null +++ b/iklowns/data/c2run.spr @@ -0,0 +1,119 @@ +[C2RunLeft] +C2-rul01.dib=1 +C2-rul03.dib=1 +C2-rul05.dib=1 +C2-rul07.dib=1 +C2-rul09.dib=1 +C2-rul11.dib=1 +C2-rul13.dib=1 +C2-rul15.dib=1 + +[C2-rul01.dib] +X=0 +Y=0 +Width=110 +Height=125 + +[C2-rul03.dib] +X=110 +Y=0 +Width=94 +Height=137 + +[C2-rul05.dib] +X=204 +Y=0 +Width=91 +Height=134 + +[C2-rul07.dib] +X=295 +Y=0 +Width=107 +Height=131 + +[C2-rul09.dib] +X=402 +Y=0 +Width=110 +Height=123 + +[C2-rul11.dib] +X=512 +Y=0 +Width=95 +Height=131 + +[C2-rul13.dib] +X=607 +Y=0 +Width=91 +Height=137 + +[C2-rul15.dib] +X=698 +Y=0 +Width=106 +Height=130 + +[Sequences] +C2RunLeft=8 +C2RunRight=8 + +[C2RunRight] +C2-rur01.dib=1 +C2-rur03.dib=1 +C2-rur05.dib=1 +C2-rur07.dib=1 +C2-rur09.dib=1 +C2-rur11.dib=1 +C2-rur13.dib=1 +C2-rur15.dib=1 + +[C2-rur01.dib] +X=0 +Y=137 +Width=105 +Height=123 + +[C2-rur03.dib] +X=105 +Y=137 +Width=87 +Height=136 + +[C2-rur05.dib] +X=192 +Y=137 +Width=90 +Height=133 + +[C2-rur07.dib] +X=282 +Y=137 +Width=110 +Height=130 + +[C2-rur09.dib] +X=392 +Y=137 +Width=106 +Height=125 + +[C2-rur11.dib] +X=498 +Y=137 +Width=87 +Height=132 + +[C2-rur13.dib] +X=585 +Y=137 +Width=95 +Height=138 + +[C2-rur15.dib] +X=680 +Y=137 +Width=109 +Height=131 diff --git a/iklowns/data/c2sad.bmp b/iklowns/data/c2sad.bmp new file mode 100644 index 0000000..f30fa16 Binary files /dev/null and b/iklowns/data/c2sad.bmp differ diff --git a/iklowns/data/c2sad.spr b/iklowns/data/c2sad.spr new file mode 100644 index 0000000..9c19247 --- /dev/null +++ b/iklowns/data/c2sad.spr @@ -0,0 +1,77 @@ +[C2SadLeft] +C2sadl01.dib=1 +C2sadl02.dib=1 +C2sadl03.dib=1 +C2sadl04.dib=1 +C2sadl05.dib=1 +C2sadl06.dib=1 +C2sadl07.dib=1 +C2sadl08.dib=1 +C2sadl09.dib=1 + +[C2sadl01.dib] +X=0 +Y=0 +Width=54 +Height=135 + +[C2sadl02.dib] +X=54 +Y=0 +Width=57 +Height=136 + +[C2sadl03.dib] +X=111 +Y=0 +Width=59 +Height=136 + +[C2sadl04.dib] +X=170 +Y=0 +Width=62 +Height=136 + +[C2sadl05.dib] +X=232 +Y=0 +Width=64 +Height=136 + +[C2sadl06.dib] +X=296 +Y=0 +Width=65 +Height=136 + +[C2sadl07.dib] +X=361 +Y=0 +Width=64 +Height=136 + +[C2sadl08.dib] +X=425 +Y=0 +Width=61 +Height=136 + +[C2sadl09.dib] +X=486 +Y=0 +Width=60 +Height=136 + +[Sequences] +C2SadLeft=9 +C2SadDone=1 + +[C2SadDone] +C2sadl10.dib=1 + +[C2sadl10.dib] +X=0 +Y=136 +Width=45 +Height=130 diff --git a/iklowns/data/c2stand.bmp b/iklowns/data/c2stand.bmp new file mode 100644 index 0000000..7728dc7 Binary files /dev/null and b/iklowns/data/c2stand.bmp differ diff --git a/iklowns/data/c2stand.spr b/iklowns/data/c2stand.spr new file mode 100644 index 0000000..56bc79c --- /dev/null +++ b/iklowns/data/c2stand.spr @@ -0,0 +1,21 @@ +[C2StandLeft] +C2thrl01.dib=1 + +[C2thrl01.dib] +X=0 +Y=0 +Width=57 +Height=133 + +[Sequences] +C2StandLeft=1 +C2StandRight=1 + +[C2StandRight] +C2thrr01.dib=1 + +[C2thrr01.dib] +X=0 +Y=133 +Width=78 +Height=133 diff --git a/iklowns/data/c2throw.bmp b/iklowns/data/c2throw.bmp new file mode 100644 index 0000000..cc00ac2 Binary files /dev/null and b/iklowns/data/c2throw.bmp differ diff --git a/iklowns/data/c2throw.spr b/iklowns/data/c2throw.spr new file mode 100644 index 0000000..bae5341 --- /dev/null +++ b/iklowns/data/c2throw.spr @@ -0,0 +1,63 @@ +[C2ThrowLeft] +c2thrl01.dib=1 +c2thrl05.dib=1 +c2thrl09.dib=1 +c2thrl13.dib=1 + +[c2thrl01.dib] +X=0 +Y=0 +Width=57 +Height=133 + +[c2thrl05.dib] +X=57 +Y=0 +Width=57 +Height=133 + +[c2thrl09.dib] +X=114 +Y=0 +Width=57 +Height=133 + +[c2thrl13.dib] +X=171 +Y=0 +Width=57 +Height=133 + +[Sequences] +C2ThrowLeft=4 +C2ThrowRight=4 + +[C2ThrowRight] +c2thrr01.dib=1 +c2thrr05.dib=1 +c2thrr09.dib=1 +c2thrr13.dib=1 + +[c2thrr01.dib] +X=0 +Y=133 +Width=80 +Height=133 + +[c2thrr05.dib] +X=80 +Y=133 +Width=79 +Height=133 + +[c2thrr09.dib] +X=159 +Y=133 +Width=79 +Height=133 + +[c2thrr13.dib] +X=238 +Y=133 +Width=73 +Height=133 diff --git a/iklowns/data/c2turn.bmp b/iklowns/data/c2turn.bmp new file mode 100644 index 0000000..7adcb7f Binary files /dev/null and b/iklowns/data/c2turn.bmp differ diff --git a/iklowns/data/c2turn.spr b/iklowns/data/c2turn.spr new file mode 100644 index 0000000..83129df --- /dev/null +++ b/iklowns/data/c2turn.spr @@ -0,0 +1,63 @@ +[C2Left2Right] +C2turr01.dib=1 +C2turr05.dib=1 +C2turr09.dib=1 +C2turr13.dib=1 + +[C2turr01.dib] +X=0 +Y=0 +Width=76 +Height=133 + +[C2turr05.dib] +X=76 +Y=0 +Width=60 +Height=136 + +[C2turr09.dib] +X=136 +Y=0 +Width=68 +Height=138 + +[C2turr13.dib] +X=204 +Y=0 +Width=86 +Height=138 + +[Sequences] +C2Left2Right=4 +C2Right2Left=4 + +[C2Right2Left] +C2turl01.dib=1 +C2turl05.dib=1 +C2turl09.dib=1 +C2turl13.dib=1 + +[C2turl01.dib] +X=0 +Y=138 +Width=84 +Height=135 + +[C2turl05.dib] +X=84 +Y=138 +Width=73 +Height=131 + +[C2turl09.dib] +X=157 +Y=138 +Width=65 +Height=135 + +[C2turl13.dib] +X=222 +Y=138 +Width=67 +Height=134 diff --git a/iklowns/data/c2walk.bmp b/iklowns/data/c2walk.bmp new file mode 100644 index 0000000..acd960e Binary files /dev/null and b/iklowns/data/c2walk.bmp differ diff --git a/iklowns/data/c2walk.spr b/iklowns/data/c2walk.spr new file mode 100644 index 0000000..b3ecf04 --- /dev/null +++ b/iklowns/data/c2walk.spr @@ -0,0 +1,119 @@ +[C2WalkLeft] +C2wall01.dib=1 +C2wall03.dib=1 +C2wall05.dib=1 +C2wall07.dib=1 +C2wall09.dib=1 +C2wall11.dib=1 +C2wall13.dib=1 +C2wall15.dib=1 + +[C2wall01.dib] +X=0 +Y=0 +Width=83 +Height=133 + +[C2wall03.dib] +X=83 +Y=0 +Width=64 +Height=134 + +[C2wall05.dib] +X=147 +Y=0 +Width=74 +Height=136 + +[C2wall07.dib] +X=221 +Y=0 +Width=84 +Height=137 + +[C2wall09.dib] +X=305 +Y=0 +Width=78 +Height=137 + +[C2wall11.dib] +X=383 +Y=0 +Width=64 +Height=137 + +[C2wall13.dib] +X=447 +Y=0 +Width=74 +Height=136 + +[C2wall15.dib] +X=521 +Y=0 +Width=83 +Height=135 + +[Sequences] +C2WalkLeft=8 +C2WalkRight=8 + +[C2WalkRight] +C2walr01.dib=1 +C2walr03.dib=1 +C2walr05.dib=1 +C2walr07.dib=1 +C2walr09.dib=1 +C2walr11.dib=1 +C2walr13.dib=1 +C2walr15.dib=1 + +[C2walr01.dib] +X=0 +Y=137 +Width=79 +Height=136 + +[C2walr03.dib] +X=79 +Y=137 +Width=71 +Height=137 + +[C2walr05.dib] +X=150 +Y=137 +Width=79 +Height=134 + +[C2walr07.dib] +X=229 +Y=137 +Width=84 +Height=135 + +[C2walr09.dib] +X=313 +Y=137 +Width=74 +Height=135 + +[C2walr11.dib] +X=387 +Y=137 +Width=72 +Height=134 + +[C2walr13.dib] +X=459 +Y=137 +Width=79 +Height=139 + +[C2walr15.dib] +X=538 +Y=137 +Width=83 +Height=138 diff --git a/iklowns/data/c2walk45.bmp b/iklowns/data/c2walk45.bmp new file mode 100644 index 0000000..9acbd41 Binary files /dev/null and b/iklowns/data/c2walk45.bmp differ diff --git a/iklowns/data/c2walk45.spr b/iklowns/data/c2walk45.spr new file mode 100644 index 0000000..732b420 --- /dev/null +++ b/iklowns/data/c2walk45.spr @@ -0,0 +1,237 @@ +[C2InLeft] +c2u45L01.DIB=1 +c2u45L03.DIB=1 +c2u45L05.DIB=1 +c2u45L07.DIB=1 +c2u45L09.DIB=1 +c2u45L11.DIB=1 +c2u45L13.DIB=1 +c2u45L15.DIB=1 + +[c2u45L01.DIB] +X=0 +Y=0 +Width=67 +Height=133 + +[c2u45L03.DIB] +X=67 +Y=0 +Width=54 +Height=131 + +[c2u45L05.DIB] +X=121 +Y=0 +Width=57 +Height=133 + +[c2u45L07.DIB] +X=178 +Y=0 +Width=64 +Height=136 + +[c2u45L09.DIB] +X=242 +Y=0 +Width=59 +Height=135 + +[c2u45L11.DIB] +X=301 +Y=0 +Width=54 +Height=132 + +[c2u45L13.DIB] +X=355 +Y=0 +Width=60 +Height=134 + +[c2u45L15.DIB] +X=415 +Y=0 +Width=67 +Height=135 + +[Sequences] +C2InLeft=8 +C2InRight=8 +C2OutLeft=8 +C2OutRight=8 + +[C2InRight] +c2u45R01.DIB=1 +c2u45R03.DIB=1 +c2u45R05.DIB=1 +c2u45R07.DIB=1 +c2u45R09.DIB=1 +c2u45R11.DIB=1 +c2u45R13.DIB=1 +c2u45R15.DIB=1 + +[c2u45R01.DIB] +X=0 +Y=136 +Width=66 +Height=135 + +[c2u45R03.DIB] +X=66 +Y=136 +Width=66 +Height=132 + +[c2u45R05.DIB] +X=132 +Y=136 +Width=66 +Height=132 + +[c2u45R07.DIB] +X=198 +Y=136 +Width=69 +Height=134 + +[c2u45R09.DIB] +X=267 +Y=136 +Width=64 +Height=134 + +[c2u45R11.DIB] +X=331 +Y=136 +Width=66 +Height=131 + +[c2u45R13.DIB] +X=397 +Y=136 +Width=66 +Height=136 + +[c2u45R15.DIB] +X=463 +Y=136 +Width=66 +Height=137 + +[C2OutLeft] +C2w45l01.dib=1 +C2w45l03.dib=1 +C2w45l05.dib=1 +C2w45l07.dib=1 +C2w45l09.dib=1 +C2w45l11.dib=1 +C2w45l13.dib=1 +C2w45l15.dib=1 + +[C2w45l01.dib] +X=0 +Y=273 +Width=70 +Height=138 + +[C2w45l03.dib] +X=70 +Y=273 +Width=60 +Height=138 + +[C2w45l05.dib] +X=130 +Y=273 +Width=64 +Height=137 + +[C2w45l07.dib] +X=194 +Y=273 +Width=70 +Height=136 + +[C2w45l09.dib] +X=264 +Y=273 +Width=67 +Height=136 + +[C2w45l11.dib] +X=331 +Y=273 +Width=60 +Height=139 + +[C2w45l13.dib] +X=391 +Y=273 +Width=65 +Height=137 + +[C2w45l15.dib] +X=456 +Y=273 +Width=71 +Height=135 + +[C2OutRight] +C2w45r01.dib=1 +C2w45r03.dib=1 +C2w45r05.dib=1 +C2w45r07.dib=1 +C2w45r09.dib=1 +C2w45r11.dib=1 +C2w45r13.dib=1 +C2w45r15.dib=1 + +[C2w45r01.dib] +X=0 +Y=412 +Width=65 +Height=136 + +[C2w45r03.dib] +X=65 +Y=412 +Width=52 +Height=139 + +[C2w45r05.dib] +X=117 +Y=412 +Width=57 +Height=136 + +[C2w45r07.dib] +X=174 +Y=412 +Width=62 +Height=135 + +[C2w45r09.dib] +X=236 +Y=412 +Width=55 +Height=138 + +[C2w45r11.dib] +X=291 +Y=412 +Width=52 +Height=138 + +[C2w45r13.dib] +X=343 +Y=412 +Width=66 +Height=139 + +[C2w45r15.dib] +X=409 +Y=412 +Width=69 +Height=137 diff --git a/iklowns/data/clouds.bmp b/iklowns/data/clouds.bmp new file mode 100644 index 0000000..6d66911 Binary files /dev/null and b/iklowns/data/clouds.bmp differ diff --git a/iklowns/data/clouds.spr b/iklowns/data/clouds.spr new file mode 100644 index 0000000..6bc4976 --- /dev/null +++ b/iklowns/data/clouds.spr @@ -0,0 +1,31 @@ +[Cloud1] +Cloud1-2.bmp=1 + +[Cloud1-2.bmp] +X=0 +Y=0 +Width=215 +Height=33 + +[Sequences] +Cloud1=1 +Cloud2=1 +Cloud3=1 + +[Cloud2] +Cloud2-2.bmp=1 + +[Cloud2-2.bmp] +X=0 +Y=33 +Width=136 +Height=48 + +[Cloud3] +Cloud3-2.bmp=1 + +[Cloud3-2.bmp] +X=0 +Y=81 +Width=149 +Height=43 diff --git a/iklowns/data/clown0.bmp b/iklowns/data/clown0.bmp new file mode 100644 index 0000000..0ea10d0 Binary files /dev/null and b/iklowns/data/clown0.bmp differ diff --git a/iklowns/data/clown0.spr b/iklowns/data/clown0.spr new file mode 100644 index 0000000..770c757 --- /dev/null +++ b/iklowns/data/clown0.spr @@ -0,0 +1,21 @@ +[Stand] +Clownl.dib=1 + +[Clownl.dib] +X=0 +Y=0 +Width=160 +Height=352 + +[Sequences] +Stand=1 +LeftStand=1 + +[LeftStand] +Clownr.dib=1 + +[Clownr.dib] +X=0 +Y=352 +Width=160 +Height=352 diff --git a/iklowns/data/credit.bmp b/iklowns/data/credit.bmp new file mode 100644 index 0000000..048120a Binary files /dev/null and b/iklowns/data/credit.bmp differ diff --git a/iklowns/data/credits.bmp b/iklowns/data/credits.bmp new file mode 100644 index 0000000..e233e67 Binary files /dev/null and b/iklowns/data/credits.bmp differ diff --git a/iklowns/data/foreg1.bmp b/iklowns/data/foreg1.bmp new file mode 100644 index 0000000..70cb855 Binary files /dev/null and b/iklowns/data/foreg1.bmp differ diff --git a/iklowns/data/foreg1.tle b/iklowns/data/foreg1.tle new file mode 100644 index 0000000..45891f0 Binary files /dev/null and b/iklowns/data/foreg1.tle differ diff --git a/iklowns/data/fw0.bmp b/iklowns/data/fw0.bmp new file mode 100644 index 0000000..bc2e93e Binary files /dev/null and b/iklowns/data/fw0.bmp differ diff --git a/iklowns/data/fw0.spr b/iklowns/data/fw0.spr new file mode 100644 index 0000000..034bed6 --- /dev/null +++ b/iklowns/data/fw0.spr @@ -0,0 +1,109 @@ +[Turn] +Ferris01.dib=1 +Ferris02.dib=1 +Ferris03.dib=1 +Ferris04.dib=1 +Ferris05.dib=1 +Ferris06.dib=1 +Ferris07.dib=1 +Ferris08.dib=1 +Ferris09.dib=1 +Ferris10.dib=1 +Ferris11.dib=1 +Ferris12.dib=1 +Ferris13.dib=1 +Ferris14.dib=1 +Ferris15.dib=1 + +[Ferris01.dib] +X=0 +Y=0 +Width=188 +Height=170 + +[Ferris02.dib] +X=188 +Y=0 +Width=188 +Height=170 + +[Ferris03.dib] +X=376 +Y=0 +Width=188 +Height=170 + +[Ferris04.dib] +X=564 +Y=0 +Width=188 +Height=170 + +[Ferris05.dib] +X=752 +Y=0 +Width=188 +Height=170 + +[Ferris06.dib] +X=940 +Y=0 +Width=187 +Height=170 + +[Ferris07.dib] +X=1127 +Y=0 +Width=187 +Height=170 + +[Ferris08.dib] +X=1314 +Y=0 +Width=187 +Height=170 + +[Ferris09.dib] +X=1501 +Y=0 +Width=187 +Height=170 + +[Ferris10.dib] +X=1688 +Y=0 +Width=186 +Height=170 + +[Ferris11.dib] +X=1874 +Y=0 +Width=186 +Height=170 + +[Ferris12.dib] +X=2060 +Y=0 +Width=186 +Height=170 + +[Ferris13.dib] +X=2246 +Y=0 +Width=186 +Height=170 + +[Ferris14.dib] +X=2432 +Y=0 +Width=187 +Height=170 + +[Ferris15.dib] +X=2619 +Y=0 +Width=187 +Height=170 + +[Sequences] +Turn=15 diff --git a/iklowns/data/fwstatic.bmp b/iklowns/data/fwstatic.bmp new file mode 100644 index 0000000..e6ae9cb Binary files /dev/null and b/iklowns/data/fwstatic.bmp differ diff --git a/iklowns/data/fwstatic.spr b/iklowns/data/fwstatic.spr new file mode 100644 index 0000000..b22d017 --- /dev/null +++ b/iklowns/data/fwstatic.spr @@ -0,0 +1,11 @@ +[DontTurn] +ferris01.dib=1 + +[ferris01.dib] +X=0 +Y=0 +Width=188 +Height=170 + +[Sequences] +DontTurn=1 diff --git a/iklowns/data/ground1.bmp b/iklowns/data/ground1.bmp new file mode 100644 index 0000000..c1d08cb Binary files /dev/null and b/iklowns/data/ground1.bmp differ diff --git a/iklowns/data/ground1.tle b/iklowns/data/ground1.tle new file mode 100644 index 0000000..1d408db Binary files /dev/null and b/iklowns/data/ground1.tle differ diff --git a/iklowns/data/iklowns.pal b/iklowns/data/iklowns.pal new file mode 100644 index 0000000..4fc3c3c Binary files /dev/null and b/iklowns/data/iklowns.pal differ diff --git a/iklowns/data/instruct.bmp b/iklowns/data/instruct.bmp new file mode 100644 index 0000000..8b50459 Binary files /dev/null and b/iklowns/data/instruct.bmp differ diff --git a/iklowns/data/intro.bmp b/iklowns/data/intro.bmp new file mode 100644 index 0000000..d462569 Binary files /dev/null and b/iklowns/data/intro.bmp differ diff --git a/iklowns/data/klown.mid b/iklowns/data/klown.mid new file mode 100644 index 0000000..d22cc4c Binary files /dev/null and b/iklowns/data/klown.mid differ diff --git a/iklowns/data/load.bmp b/iklowns/data/load.bmp new file mode 100644 index 0000000..ed52811 Binary files /dev/null and b/iklowns/data/load.bmp differ diff --git a/iklowns/data/nyuk.wav b/iklowns/data/nyuk.wav new file mode 100644 index 0000000..9fdb5ef Binary files /dev/null and b/iklowns/data/nyuk.wav differ diff --git a/iklowns/data/pie.bmp b/iklowns/data/pie.bmp new file mode 100644 index 0000000..e039368 Binary files /dev/null and b/iklowns/data/pie.bmp differ diff --git a/iklowns/data/pie.spr b/iklowns/data/pie.spr new file mode 100644 index 0000000..90384f5 --- /dev/null +++ b/iklowns/data/pie.spr @@ -0,0 +1,32 @@ +[Sequences] +Pie=4 + +[Pie] +pie0.bmp=1 +pie1.bmp=1 +pie2.bmp=1 +pie3.bmp=1 + +[pie0.bmp] +x=1 +y=0 +width=8 +height=13 + +[pie1.bmp] +x=12 +y=0 +width=8 +height=13 + +[pie2.bmp] +x=1 +y=15 +width=8 +height=13 + +[pie3.bmp] +x=12 +y=15 +width=8 +height=13 diff --git a/iklowns/data/piefly.bmp b/iklowns/data/piefly.bmp new file mode 100644 index 0000000..8df56e8 Binary files /dev/null and b/iklowns/data/piefly.bmp differ diff --git a/iklowns/data/piefly.spr b/iklowns/data/piefly.spr new file mode 100644 index 0000000..ab4ef46 --- /dev/null +++ b/iklowns/data/piefly.spr @@ -0,0 +1,77 @@ +[FlyLeft] +Piefll01.dib=1 +Piefll02.dib=1 +Piefll03.dib=1 +Piefll04.dib=1 +Piefll05.dib=1 + +[Piefll01.dib] +X=0 +Y=0 +Width=22 +Height=21 + +[Piefll02.dib] +X=22 +Y=0 +Width=22 +Height=21 + +[Piefll03.dib] +X=44 +Y=0 +Width=22 +Height=21 + +[Piefll04.dib] +X=66 +Y=0 +Width=22 +Height=21 + +[Piefll05.dib] +X=88 +Y=0 +Width=22 +Height=21 + +[Sequences] +FlyLeft=5 +FlyRight=5 + +[FlyRight] +Pieflr01.dib=1 +Pieflr02.dib=1 +Pieflr03.dib=1 +Pieflr04.dib=1 +Pieflr05.dib=1 + +[Pieflr01.dib] +X=0 +Y=21 +Width=22 +Height=21 + +[Pieflr02.dib] +X=22 +Y=21 +Width=22 +Height=21 + +[Pieflr03.dib] +X=44 +Y=21 +Width=22 +Height=21 + +[Pieflr04.dib] +X=66 +Y=21 +Width=22 +Height=21 + +[Pieflr05.dib] +X=88 +Y=21 +Width=22 +Height=21 diff --git a/iklowns/data/piehit2.wav b/iklowns/data/piehit2.wav new file mode 100644 index 0000000..cf181b5 Binary files /dev/null and b/iklowns/data/piehit2.wav differ diff --git a/iklowns/data/plane.bmp b/iklowns/data/plane.bmp new file mode 100644 index 0000000..679b828 Binary files /dev/null and b/iklowns/data/plane.bmp differ diff --git a/iklowns/data/plane.spr b/iklowns/data/plane.spr new file mode 100644 index 0000000..3e2590f --- /dev/null +++ b/iklowns/data/plane.spr @@ -0,0 +1,109 @@ +[Fly] +Plane-01.dib=1 +Plane-02.dib=1 +Plane-03.dib=1 +Plane-04.dib=1 +Plane-05.dib=1 +Plane-06.dib=1 +Plane-07.dib=1 +Plane-08.dib=1 +Plane-09.dib=1 +Plane-10.dib=1 +Plane-11.dib=1 +Plane-12.dib=1 +Plane-13.dib=1 +Plane-14.dib=1 +Plane-15.dib=1 + +[Plane-01.dib] +X=0 +Y=0 +Width=285 +Height=32 + +[Plane-02.dib] +X=285 +Y=0 +Width=285 +Height=32 + +[Plane-03.dib] +X=570 +Y=0 +Width=285 +Height=32 + +[Plane-04.dib] +X=855 +Y=0 +Width=285 +Height=32 + +[Plane-05.dib] +X=1140 +Y=0 +Width=285 +Height=32 + +[Plane-06.dib] +X=1425 +Y=0 +Width=285 +Height=32 + +[Plane-07.dib] +X=1710 +Y=0 +Width=285 +Height=32 + +[Plane-08.dib] +X=1995 +Y=0 +Width=285 +Height=32 + +[Plane-09.dib] +X=2280 +Y=0 +Width=285 +Height=32 + +[Plane-10.dib] +X=2565 +Y=0 +Width=285 +Height=32 + +[Plane-11.dib] +X=2850 +Y=0 +Width=285 +Height=32 + +[Plane-12.dib] +X=3135 +Y=0 +Width=285 +Height=32 + +[Plane-13.dib] +X=3420 +Y=0 +Width=285 +Height=32 + +[Plane-14.dib] +X=3705 +Y=0 +Width=285 +Height=32 + +[Plane-15.dib] +X=3990 +Y=0 +Width=285 +Height=32 + +[Sequences] +Fly=15 diff --git a/iklowns/data/plane.wav b/iklowns/data/plane.wav new file mode 100644 index 0000000..2bb51ee Binary files /dev/null and b/iklowns/data/plane.wav differ diff --git a/iklowns/data/rollcost.bmp b/iklowns/data/rollcost.bmp new file mode 100644 index 0000000..8996627 Binary files /dev/null and b/iklowns/data/rollcost.bmp differ diff --git a/iklowns/data/rollcost.tle b/iklowns/data/rollcost.tle new file mode 100644 index 0000000..025fad2 Binary files /dev/null and b/iklowns/data/rollcost.tle differ diff --git a/iklowns/data/run.wav b/iklowns/data/run.wav new file mode 100644 index 0000000..d3c9cf6 Binary files /dev/null and b/iklowns/data/run.wav differ diff --git a/iklowns/data/sideattr.bmp b/iklowns/data/sideattr.bmp new file mode 100644 index 0000000..c2aa886 Binary files /dev/null and b/iklowns/data/sideattr.bmp differ diff --git a/iklowns/data/sideattr.tle b/iklowns/data/sideattr.tle new file mode 100644 index 0000000..7f5c108 Binary files /dev/null and b/iklowns/data/sideattr.tle differ diff --git a/iklowns/data/sideb.bmp b/iklowns/data/sideb.bmp new file mode 100644 index 0000000..b8c2bd7 Binary files /dev/null and b/iklowns/data/sideb.bmp differ diff --git a/iklowns/data/sideb.tle b/iklowns/data/sideb.tle new file mode 100644 index 0000000..c5d5864 Binary files /dev/null and b/iklowns/data/sideb.tle differ diff --git a/iklowns/data/sidef.bmp b/iklowns/data/sidef.bmp new file mode 100644 index 0000000..16c2899 Binary files /dev/null and b/iklowns/data/sidef.bmp differ diff --git a/iklowns/data/sidef.tle b/iklowns/data/sidef.tle new file mode 100644 index 0000000..083fa3f Binary files /dev/null and b/iklowns/data/sidef.tle differ diff --git a/iklowns/data/splash.bmp b/iklowns/data/splash.bmp new file mode 100644 index 0000000..d8b7a0b Binary files /dev/null and b/iklowns/data/splash.bmp differ diff --git a/iklowns/data/throw.wav b/iklowns/data/throw.wav new file mode 100644 index 0000000..5d44698 Binary files /dev/null and b/iklowns/data/throw.wav differ diff --git a/iklowns/data/walk.wav b/iklowns/data/walk.wav new file mode 100644 index 0000000..468fbfc Binary files /dev/null and b/iklowns/data/walk.wav differ diff --git a/iklowns/data/woob.wav b/iklowns/data/woob.wav new file mode 100644 index 0000000..c8a4d0f Binary files /dev/null and b/iklowns/data/woob.wav differ diff --git a/iklowns/iklowns.exe b/iklowns/iklowns.exe new file mode 100755 index 0000000..f50f663 Binary files /dev/null and b/iklowns/iklowns.exe differ diff --git a/iklowns/iklowns.gam b/iklowns/iklowns.gam new file mode 100644 index 0000000..ca89fe8 --- /dev/null +++ b/iklowns/iklowns.gam @@ -0,0 +1,240 @@ +[General] +useddraw=1 +doublebuffer=1 +; Sound Modes: 0=DirectSound, 1=waveOut, 2=sndPlaySound +soundmode=0 +dlls=krusty.dll,misc.dll +datapath=data +; If two-players on one machine, character for second klown +SecondKlown=Klown2 +; If one-player, computer generated klown... +RoboKlown=Klown2 +; If n-players, character for remote klowns +RemoteKlown=Klown2 +; if ForceProfile is given, real machine is ignored & this profile is used +;ForceProfile=Full + +[Profiles] +; processor, bus type, min system memory, min vid memory, video software +; see cgglobals.h for definitions of values +Full=3,3,8,1,1 +Med=3,0,8,1,1 +Low=0,0,0,0,1 + +[KRUSTY.DLL] +aggression=5 +mobility=15 +fastklown=0 +fastvel=200 +debugout=0 +piespeed=200 +pierange=600 +MouseSensitivity=75 +JoystickSensitivity=33 +RunThreshold=50 +RemoteUpdateInterval=1000 +RemoteTimeout=30 + +[Levels] +Rumble=1 + +[Rumble] +Full=RumbleFull +Med=RumbleMed +Low=RumbleLow +Bare=RumbleBare +; NOTE: must always have a Default +Default=RumbleGDI + +[IntroScreens] +Bitmap=credits.BMP,instruct.BMP +Delay=4 + +[OptionScreens] +Bitmap=BACKDROP.BMP +TextRect=150,100,590,380 +DefaultColor=255,0,0 +DefaultShadow=149,149,149 +SelectColor=255,255,255 +SelectShadow=0,0,0 +FontFamily=SS_TIMES +MouseSensitivity=75 +JoystickSensitivity=33 +Timeout=30 + +[CreditScreens] +Bitmap=BACKDROP.BMP +TextRect=100,5,590,475 +DefaultColor=255,255,0 +DefaultShadow=0,0,0 +FontFamily=SS_TIMES +LinesPerScreen=12 +ScrollRate=2 +Music=KLOWN.MID + +[LoadingScreens] +Bitmap=LOAD.BMP +HotSpot=333,273 +DefaultColor=255,0,0 +DefaultShadow=0,0,0 +FontFamily=SS_TIMES +TextRect=100,350,600,400 +SoundStart=blow1.wav,63,loop +SoundUpdate=blow2.wav,63,noloop +SoundEnd=bang.wav,127,noloop +Music=KLOWN.MID + +[RumbleFull] +WorldX=1920 +WorldY=704 +StartX=-390 +StartY=-240 +Music=KLOWN.MID +Palette=iklowns.pal +Graphics=RumbleGraphicsFull +WinLose=CREDIT.BMP + +[RumbleMed] +WorldX=1920 +WorldY=704 +StartX=-390 +StartY=-240 +Music=KLOWN.MID +Palette=iklowns.pal +Graphics=RumbleGraphicsMed +WinLose=CREDIT.BMP + +[RumbleLow] +WorldX=1920 +WorldY=704 +StartX=-390 +StartY=-240 +Music=KLOWN.MID +Palette=iklowns.pal +Graphics=RumbleGraphicsLow +WinLose=CREDIT.BMP + +[RumbleBare] +WorldX=1920 +WorldY=704 +StartX=-390 +StartY=-240 +Music=KLOWN.MID +Palette=iklowns.pal +Graphics=RumbleGraphicsBare +WinLose=CREDIT.BMP + +[RumbleGDI] +WorldX=1920 +WorldY=704 +StartX=-390 +StartY=-240 +Music=KLOWN.MID +Palette=iklowns.pal +Graphics=RumbleGraphicsLow +WinLose=CREDIT.BMP + +; graphics list for full profile (pentium, PCI, etc.) +[RumbleGraphicsFull] +Sky=Sky +sidef=TiledImage,14,-960,-105 +foreg1=TiledImage,1,-960,115 +BigTBig=TiledImage,20,-400,-40 +RollCost=TiledImage,72,100,-5 +BigTop=TiledImage,60,200,30 +BigTSml=TiledImage,70,40,104 +sideb=TiledImage,15,-960,-40 +ground1=TiledImage,13,-960,80 +; note: numbers are: zmin, zmax, xpos, ypos, numactions, preload, remote object name +; The actions MUST match the number of actions actually defined... +Ferris=Character,128,128,-60,20,1,1 +Plane=Character,129,129,700,0,1,1 +Cloud1=Character,180,180,300,0,1,1 +Cloud2=Character,260,260,350,50,1,1 +Cloud3=Character,340,340,0,40,1,1 +Klown=Character,2,12,-210,30,32,1,Klown2 +Klown2=Character,2,12,210,30,32,0 +Pie=Character,255,255,500,0,2,0 + +; graphics list for med profile (same as full with no PCI) +[RumbleGraphicsMed] +Sky=Sky +sidef=TiledImage,14,-960,-105 +foreg1=TiledImage,1,-960,115 +;BigTBig=TiledImage,20,-400,-40 +;RollCost=TiledImage,72,100,-5 +BigTop=TiledImage,60,200,30 +BigTSml=TiledImage,70,40,104 +sideb=TiledImage,15,-960,-40 +ground1=TiledImage,13,-960,80 +; note: numbers are: zmin, zmax, xpos, ypos, numactions, preload, remote object name +; The actions MUST match the number of actions actually defined... +StaticFerris=Character,128,128,-60,20,1,1 +Plane=Character,129,129,700,0,1,1 +Cloud1=Character,180,180,300,0,1,1 +;Cloud2=Character,260,260,350,50,1,1 +;Cloud3=Character,340,340,0,40,1,1 +Klown=Character,2,12,-210,30,32,1,Klown2 +Klown2=Character,2,12,210,30,32,0 +Pie=Character,255,255,500,0,2,0 + +; graphics list for low profile (dog slow machine) +[RumbleGraphicsLow] +Sky=Sky +sidef=TiledImage,14,-960,-105 +;foreg1=TiledImage,1,-960,115 +;BigTBig=TiledImage,20,-400,-40 +;RollCost=TiledImage,72,100,-5 +BigTop=TiledImage,60,200,30 +;BigTSml=TiledImage,70,40,104 +sideb=TiledImage,15,-960,-40 +ground1=TiledImage,13,-960,80 +; note: numbers are: zmin, zmax, xpos, ypos, numactions, preload, remote object name +; The actions MUST match the number of actions actually defined... +StaticFerris=Character,128,128,-60,20,1,1 +;Plane=Character,129,129,700,0,1,1 +Cloud1=Character,180,180,300,0,1,1 +;Cloud2=Character,260,260,350,50,1,1 +;Cloud3=Character,340,340,0,40,1,1 +Klown=Character,2,12,-210,30,32,1,Klown2 +Klown2=Character,2,12,210,30,32,0 +Pie=Character,255,255,500,0,2,0 + +; graphics list for bare profile (testing) +[RumbleGraphicsBare] +Sky=Sky +;sidef=TiledImage,14,-960,-105 +;foreg1=TiledImage,1,-960,115 +;BigTBig=TiledImage,20,-400,-40 +;RollCost=TiledImage,72,100,-5 +;BigTop=TiledImage,60,200,30 +;BigTSml=TiledImage,70,40,104 +;sideb=TiledImage,15,-960,-40 +ground1=TiledImage,13,-960,80 +; note: numbers are: zmin, zmax, xpos, ypos, numactions, preload, remote object name +; The actions MUST match the number of actions actually defined... +;StaticFerris=Character,128,128,-60,20,1,1 +;Plane=Character,129,129,700,0,1,1 +;Cloud1=Character,180,180,300,0,1,1 +;Cloud2=Character,260,260,350,50,1,1 +;Cloud3=Character,340,340,0,40,1,1 +Klown=Character,2,12,-210,30,32,1,Klown2 +Klown2=Character,2,12,210,30,32,0 +Pie=Character,255,255,500,0,2,0 + + +[Ferris] +Turn=0 + +[Turn] +SequenceFile=fw0.spr +SequenceName=Turn +Rate=15 + +[StaticFerris] +DontTurn=0 + +[DontTurn] +SequenceFile=fwstatic.spr +SequenceName=DontTurn + diff --git a/iklowns/iklowns.ovl b/iklowns/iklowns.ovl new file mode 100644 index 0000000..aabcd33 Binary files /dev/null and b/iklowns/iklowns.ovl differ diff --git a/iklowns/krusty.dll b/iklowns/krusty.dll new file mode 100644 index 0000000..4c5f85f Binary files /dev/null and b/iklowns/krusty.dll differ diff --git a/iklowns/misc.dll b/iklowns/misc.dll new file mode 100644 index 0000000..037c4ac Binary files /dev/null and b/iklowns/misc.dll differ diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..df5ee41 --- /dev/null +++ b/readme.txt @@ -0,0 +1,90 @@ +======================== += DirectX 3 SDK Readme = +======================== + +To install the DirectX SDK and/or DirectX, please run SETUP.EXE from the root +directory. + +Overview +-------- +Welcome to the DirectX 3 SDK. If you did a full installation, +you will find a number of directories installed on your hard disk: + +DOCS - Help and Readme files for each of the DirectX components +FOXBEAR - Fox & Bear sample demo of DirectDraw/DirectSound +IKLOWNS - Immortal Klowns sample demo of DirectDraw/DirectSound +ROCKEM - Direct3D sample demo +SDK - DirectX SDK. Contains sample code, libraries, include files, + and debug versions of the DirectX components + +You will also find the following directories useful. They are located on +the CD, but are not installed onto your hard disk: + +DEBUG - Debug version of DirectX redistributable components +EXTRAS - Contain drivers that have not completed the Microsoft QA process +LICENSE - License agreement +REDIST - DirectX redistributable components +SAMPGAME - A sample demo which uses DirectX redistributable components +WEBDIST - Compressed DirectX components useful for web distribution + +Please see the readme file for each component (DirectDraw, Direct3D, +DirectSound, DirectPlay, and DirectInput) for more information. These +readme files can be found in the DOCS directory. + + +New for this Release +-------------------- + +1) DirectPlay 3, including an Internet Service Provider and redesigned + easy-to-use interfaces. + +2) DirectSound3D for positional audio. + +3) DirectInput for easy control of mouse and keyboard. + +4) Direct3D MMX acceleration. + +5) New display, 3D, and sound drivers. + + +Release Notes +------------- + +1) There is an EXTRAS directory that contains third-party display and sound + drivers that have not completed the Microsoft QA process. We include the + drivers on the SDK as a convenience for you. Please see the license.txt + file in the EXTRAS directory for the license agreements pertaining to + these components. + +2) This SDK will install on Windows NT version 4.0 and higher for x86 + processors. However, it will not install any DirectX runtime components + on NT, since DirectX is built in to NT. The 4.0 release contains + the DirectX 2 release of DirectDraw, DirectSound, and DirectPlay. + Direct3D and the DirectX 3 components (new DirectPlay, Direct3DSound, + DirectInput) will be available in NT 4.0 service pack releases in the + near future. + + Be advised that many of the sample applications will not run on NT until + the components they require (mainly D3D) have been installed through a + service pack. Please be patient with us! + +3) If you use the Watcom compiler, please get the latest version - it + contains the latest Windows header files that you will need to compile + DirectX samples. We have deleted our sdk\samples\watinc directory (which + used to contain those header files) because you should get the Watcom + files to be completely up-to-date. + +4) You should know that Direct3D and DirectSound3D were designed to run on + Pentium-class processors. Both use floating point math, and are + therefore quite slow on machines which do not have math co-processors. + If you use these components, make sure you try your application on a + 486 (especially a 486SX) to verify that it runs adequately. If it doesn't, + we recommend that you detect the processor at setup time and refuse to + run on those machines. + +5) Users of the ATI-TV tuner option will experience loss of TV tuner and + MPEG viewing functionality after installing DirectX drivers. If this + happens, the user should uninstall the DirectX drivers by going to the + control panel, selecting Add/Remove Programs, then selecting DirectX + drivers and pressing the "Restore Display Drivers" button. + diff --git a/rockem/arena.x b/rockem/arena.x new file mode 100644 index 0000000..fad6f8e --- /dev/null +++ b/rockem/arena.x @@ -0,0 +1,1450 @@ +xof 0302txt 0064 +template Header { + <3D82AB43-62DA-11cf-AB39-0020AF71E433> + WORD major; + WORD minor; + DWORD flags; +} + +template Vector { + <3D82AB5E-62DA-11cf-AB39-0020AF71E433> + FLOAT x; + FLOAT y; + FLOAT z; +} + +template Coords2d { + <F6F23F44-7686-11cf-8F52-0040333594A3> + FLOAT u; + FLOAT v; +} + +template Matrix4x4 { + <F6F23F45-7686-11cf-8F52-0040333594A3> + array FLOAT matrix[16]; +} + +template ColorRGBA { + <35FF44E0-6C7C-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; + FLOAT alpha; +} + +template ColorRGB { + <D3E16E81-7835-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; +} + +template IndexedColor { + <1630B820-7842-11cf-8F52-0040333594A3> + DWORD index; + ColorRGBA indexColor; +} + +template Boolean { + <4885AE61-78E8-11cf-8F52-0040333594A3> + WORD truefalse; +} + +template Boolean2d { + <4885AE63-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template MaterialWrap { + <4885AE60-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template TextureFilename { + <A42790E1-7810-11cf-8F52-0040333594A3> + STRING filename; +} + +template Material { + <3D82AB4D-62DA-11cf-AB39-0020AF71E433> + ColorRGBA faceColor; + FLOAT power; + ColorRGB specularColor; + ColorRGB emissiveColor; + [...] +} + +template MeshFace { + <3D82AB5F-62DA-11cf-AB39-0020AF71E433> + DWORD nFaceVertexIndices; + array DWORD faceVertexIndices[nFaceVertexIndices]; +} + +template MeshFaceWraps { + <4885AE62-78E8-11cf-8F52-0040333594A3> + DWORD nFaceWrapValues; + Boolean2d faceWrapValues; +} + +template MeshTextureCoords { + <F6F23F40-7686-11cf-8F52-0040333594A3> + DWORD nTextureCoords; + array Coords2d textureCoords[nTextureCoords]; +} + +template MeshMaterialList { + <F6F23F42-7686-11cf-8F52-0040333594A3> + DWORD nMaterials; + DWORD nFaceIndexes; + array DWORD faceIndexes[nFaceIndexes]; + [Material] +} + +template MeshNormals { + <F6F23F43-7686-11cf-8F52-0040333594A3> + DWORD nNormals; + array Vector normals[nNormals]; + DWORD nFaceNormals; + array MeshFace faceNormals[nFaceNormals]; +} + +template MeshVertexColors { + <1630B821-7842-11cf-8F52-0040333594A3> + DWORD nVertexColors; + array IndexedColor vertexColors[nVertexColors]; +} + +template Mesh { + <3D82AB44-62DA-11cf-AB39-0020AF71E433> + DWORD nVertices; + array Vector vertices[nVertices]; + DWORD nFaces; + array MeshFace faces[nFaces]; + [...] +} + +Header { + 1; + 0; + 1; +} + +Mesh { + 164; + -509.760864;-418.136444;-863.679443;, + -466.708588;-418.137299;890.074646;, + -605.528442;-95.125122;678.490051;, + -998.383423;-418.136810;-48.462238;, + -880.561401;-418.136627;-474.215302;, + -738.448608;-418.136505;-676.000427;, + -139.410217;-418.136322;-996.193115;, + 205.181686;-418.136322;-987.733948;, + 483.728363;-418.136444;-888.068176;, + 818.229065;-418.136566;-599.525757;, + 986.405762;-418.136749;-243.946945;, + 1005.706177;-418.136932;148.922470;, + 818.229065;-418.137115;601.532104;, + 439.531586;-418.137299;912.321655;, + 156.429657;-418.137360;998.199402;, + -284.128326;-418.137299;965.702087;, + -801.209717;-418.137115;601.532104;, + -988.686340;-418.136932;148.922470;, + 997.246643;-188.884811;197.675293;, + 895.455627;-95.124893;223.171524;, + 742.920349;-95.125015;545.679260;, + 846.720764;-188.885056;561.077759;, + 648.046570;-188.885162;780.280945;, + 553.185669;-95.125153;735.414001;, + 348.130768;-188.885239;950.181030;, + 230.678268;-95.125198;887.949036;, + 57.975639;-188.885315;1007.896545;, + -125.652954;-95.125076;905.454468;, + -139.410217;-188.885284;998.199585;, + -331.111328;-188.885239;950.181030;, + -382.424255;-95.125160;827.563660;, + -631.026794;-188.885162;780.280945;, + -880.561401;-188.885025;476.221832;, + -836.237000;-95.124939;350.908905;, + -980.227173;-188.884811;197.675293;, + -895.941040;-95.124672;135.165833;, + -895.941040;-95.124680;-133.159500;, + -980.227173;-188.884689;-195.668777;, + -922.860046;-188.884583;-384.782928;, + -818.050415;-95.124565;-389.930847;, + -801.209717;-188.884430;-599.525757;, + -638.031372;-95.124420;-645.538086;, + -592.019043;-188.884384;-808.716370;, + -341.395660;-95.124344;-843.743652;, + -284.128326;-188.884277;-963.695496;, + -90.301964;-188.884277;-1002.249756;, + -36.355202;-95.124306;-912.242737;, + 253.460159;-188.884277;-976.892639;, + 273.930817;-95.124313;-873.972717;, + 609.038818;-188.884384;-808.716370;, + 622.547852;-95.124420;-676.483704;, + 721.349487;-188.884430;-711.836487;, + 853.256714;-95.124603;-348.902466;, + 939.879883;-188.884583;-384.782928;, + 1015.403198;-188.884735;-48.462208;, + 921.756226;-95.124718;-43.862041;, + -412.364868;-95.124382;-658.926392;, + -524.849854;-95.124451;-546.426147;, + -636.946472;-95.124504;-441.080963;, + -686.756287;-95.124550;-351.057495;, + -725.945435;-95.124588;-268.492096;, + 426.350616;-95.124367;-660.925049;, + 404.913300;-95.124359;-674.393066;, + -268.926666;-95.124496;-424.244751;, + -774.182434;-95.124657;-4.997503;, + -744.480225;-95.124634;-155.931580;, + -499.258789;-95.124687;-4.997503;, + -141.506195;-95.124588;-215.769913;, + -180.116196;-95.124619;-172.606064;, + -230.511444;-95.124680;-109.106934;, + 262.796906;-95.124489;-439.001526;, + -255.041565;-95.124763;-4.997503;, + -240.241516;-95.124725;-60.986412;, + 527.804749;-95.124420;-573.076050;, + -121.273987;-95.124832;75.974876;, + -141.310745;-95.124779;1.196889;, + -121.274124;-95.124725;-73.581116;, + -66.532890;-95.124695;-128.322464;, + 8.245086;-95.124680;-148.359268;, + 136.553513;-95.124634;-229.900833;, + 83.023079;-95.124702;-128.322647;, + -339.386353;-95.125191;702.153198;, + -239.844910;-95.125069;478.473114;, + -127.782547;-95.124924;226.657135;, + -63.752640;-95.124924;244.517105;, + 189.934555;-95.124672;-177.455978;, + 237.352859;-95.124695;-130.869339;, + 157.801254;-95.124771;1.196710;, + 83.023346;-95.124847;130.716019;, + 8.245354;-95.124870;150.752762;, + -66.532639;-95.124870;130.716110;, + 137.764450;-95.124733;-73.581451;, + -194.079697;-95.125153;743.516235;, + -87.321465;-95.125099;777.463013;, + 8.329406;-95.124916;264.622955;, + 72.383354;-95.124886;246.850861;, + 144.492859;-95.124840;226.843842;, + 272.529541;-95.124718;5.989942;, + 255.981567;-95.124702;-58.392082;, + 137.764587;-95.124802;75.974716;, + -36.737411;-95.125107;779.131714;, + 75.287613;-95.125145;779.404297;, + 246.068604;-95.125175;737.264404;, + 262.455902;-95.124985;440.721069;, + 372.871857;-95.125175;693.328247;, + 395.254669;-95.125168;681.496704;, + 546.636292;-95.124756;-22.868746;, + 753.291687;-95.124664;-195.022186;, + 729.310852;-95.124596;-304.452942;, + 705.464294;-95.124565;-349.093567;, + 649.686829;-95.124504;-446.248199;, + 790.122864;-95.124741;-48.503696;, + 8.329406;-92.201492;264.622955;, + 125.697510;-92.201477;774.895813;, + -112.442253;-92.201477;774.316345;, + 144.492859;-92.201309;226.843719;, + 395.254669;-92.201469;681.496643;, + -339.386353;-92.201485;702.153015;, + -127.782547;-92.201309;226.657028;, + -141.506195;-92.201347;-215.769928;, + -223.580521;-92.201324;-124.015350;, + -651.477112;-92.201118;-419.781830;, + -734.782532;-92.201363;-244.270538;, + -774.182434;-92.201332;-4.997512;, + -255.041565;-92.201332;-4.997512;, + -412.364868;-92.201378;-658.926453;, + 237.352859;-92.201401;-130.869324;, + 620.578003;-92.201149;-487.649506;, + 739.146057;-92.201248;-281.124725;, + 136.553482;-92.201172;-229.900818;, + 404.913361;-92.201088;-674.393250;, + 790.122986;-92.201355;-48.503719;, + 272.529480;-92.201271;5.989976;, + 157.801254;-92.277321;1.196713;, + 137.764587;-92.277328;75.974716;, + 8.245265;-92.277321;1.196759;, + 83.023346;-92.277336;130.716019;, + 8.245354;-92.277344;150.752762;, + -66.532639;-92.277336;130.716110;, + -121.273987;-92.277328;75.974876;, + -141.310745;-92.277321;1.196893;, + -121.274124;-92.277290;-73.581116;, + -66.532890;-92.277283;-128.322464;, + 8.245086;-92.277275;-148.359268;, + 83.023079;-92.277283;-128.322647;, + 137.764450;-92.277290;-73.581451;, + -605.528442;-95.125153;678.490051;, + 895.455627;-95.124893;223.171524;, + 742.920349;-95.125015;545.679260;, + 553.185669;-95.125153;735.414001;, + 230.678268;-95.125198;887.949036;, + -125.652954;-95.125076;905.454468;, + -382.424255;-95.125191;827.563660;, + -836.237000;-95.124939;350.908905;, + -895.941040;-95.124672;135.165833;, + -895.941040;-95.124680;-133.159500;, + -818.050415;-95.124565;-389.930847;, + -638.031372;-95.124420;-645.538086;, + -341.395660;-95.124374;-843.743652;, + -36.355202;-95.124306;-912.242737;, + 273.930817;-95.124313;-873.972717;, + 622.547852;-95.124420;-676.483704;, + 853.256714;-95.124603;-348.902466;, + 921.756226;-95.124718;-43.862041;; + + 222; + 3;37,4,3;, + 3;38,4,37;, + 3;40,4,38;, + 3;40,5,4;, + 3;42,5,40;, + 3;42,0,5;, + 3;44,0,42;, + 3;44,6,0;, + 3;45,6,44;, + 3;45,7,6;, + 3;47,7,45;, + 3;47,8,7;, + 3;49,8,47;, + 3;49,9,8;, + 3;51,9,49;, + 3;53,9,51;, + 3;53,10,9;, + 3;54,10,53;, + 3;54,11,10;, + 3;18,11,54;, + 3;18,12,11;, + 3;21,12,18;, + 3;22,12,21;, + 3;22,13,12;, + 3;24,13,22;, + 3;24,14,13;, + 3;26,14,24;, + 3;26,15,14;, + 3;28,15,26;, + 3;29,15,28;, + 3;31,1,29;, + 3;29,1,15;, + 3;31,16,1;, + 3;32,16,31;, + 3;32,17,16;, + 3;34,17,32;, + 3;37,3,34;, + 3;34,3,17;, + 3;54,19,18;, + 3;19,20,18;, + 3;18,20,21;, + 3;20,23,21;, + 3;21,23,22;, + 3;24,22,23;, + 3;23,25,24;, + 3;26,24,25;, + 3;27,26,25;, + 3;28,26,27;, + 3;27,30,28;, + 3;28,30,29;, + 3;31,29,30;, + 3;2,31,30;, + 3;32,31,2;, + 3;2,33,32;, + 3;34,32,33;, + 3;35,34,33;, + 3;35,36,34;, + 3;37,34,36;, + 3;38,37,36;, + 3;39,38,36;, + 3;38,39,40;, + 3;41,40,39;, + 3;42,40,41;, + 3;41,43,42;, + 3;44,42,43;, + 3;43,46,44;, + 3;44,46,45;, + 3;45,46,47;, + 3;46,48,47;, + 3;49,47,48;, + 3;50,49,48;, + 3;51,49,50;, + 3;50,52,51;, + 3;53,51,52;, + 3;54,53,55;, + 3;55,53,52;, + 3;19,54,55;, + 3;83,82,81;, + 3;84,83,81;, + 3;81,92,94;, + 3;94,84,81;, + 3;92,93,95;, + 3;95,94,92;, + 3;96,95,93;, + 3;93,100,103;, + 3;103,96,93;, + 3;100,101,103;, + 3;102,104,105;, + 3;101,102,103;, + 3;105,103,102;, + 3;112,114,113;, + 3;112,113,115;, + 3;115,113,116;, + 3;114,112,117;, + 3;117,112,118;, + 3;119,121,120;, + 3;120,121,122;, + 3;120,122,123;, + 3;120,123,124;, + 3;121,119,125;, + 3;126,128,127;, + 3;126,127,129;, + 3;129,127,130;, + 3;128,126,131;, + 3;131,126,132;, + 3;133,135,134;, + 3;134,135,136;, + 3;136,135,137;, + 3;137,135,138;, + 3;138,135,139;, + 3;139,135,140;, + 3;140,135,141;, + 3;141,135,142;, + 3;142,135,143;, + 3;143,135,144;, + 3;144,135,145;, + 3;145,135,133;, + 3;121,125,57;, + 3;56,57,125;, + 3;121,57,58;, + 3;58,59,121;, + 3;59,122,121;, + 3;59,60,122;, + 3;125,63,56;, + 3;60,123,122;, + 3;60,65,123;, + 3;119,63,125;, + 3;127,73,130;, + 3;130,73,61;, + 3;130,61,62;, + 3;123,64,66;, + 3;65,64,123;, + 3;119,67,63;, + 3;66,124,123;, + 3;71,124,66;, + 3;119,120,67;, + 3;68,67,120;, + 3;69,68,120;, + 3;120,72,69;, + 3;70,130,62;, + 3;70,129,130;, + 3;79,129,70;, + 3;71,120,124;, + 3;120,71,72;, + 3;127,110,73;, + 3;129,79,85;, + 3;139,74,90;, + 3;90,138,139;, + 3;139,140,74;, + 3;140,141,75;, + 3;74,140,75;, + 3;76,75,141;, + 3;141,142,76;, + 3;77,76,142;, + 3;142,143,77;, + 3;143,144,78;, + 3;77,143,78;, + 3;144,145,80;, + 3;78,144,80;, + 3;117,81,92;, + 3;117,118,81;, + 3;118,83,82;, + 3;118,112,83;, + 3;81,118,82;, + 3;83,112,84;, + 3;84,112,94;, + 3;98,126,86;, + 3;126,129,86;, + 3;85,86,129;, + 3;134,99,133;, + 3;133,99,87;, + 3;136,137,88;, + 3;137,138,89;, + 3;88,137,89;, + 3;89,138,90;, + 3;145,133,91;, + 3;145,91,80;, + 3;133,87,91;, + 3;92,114,117;, + 3;114,92,93;, + 3;100,114,93;, + 3;112,115,94;, + 3;115,95,94;, + 3;115,116,96;, + 3;95,115,96;, + 3;116,103,96;, + 3;132,126,97;, + 3;97,126,98;, + 3;134,136,99;, + 3;99,136,88;, + 3;100,113,114;, + 3;113,100,101;, + 3;113,101,102;, + 3;102,116,113;, + 3;104,116,102;, + 3;103,116,105;, + 3;106,132,97;, + 3;116,104,105;, + 3;106,131,132;, + 3;131,111,107;, + 3;107,128,131;, + 3;107,108,128;, + 3;128,108,109;, + 3;109,127,128;, + 3;127,109,110;, + 3;111,131,106;, + 3;156,155,157;, + 3;157,155,158;, + 3;158,155,159;, + 3;159,155,160;, + 3;160,155,161;, + 3;161,155,154;, + 3;161,154,153;, + 3;161,153,146;, + 3;161,146,152;, + 3;161,152,151;, + 3;161,151,150;, + 3;161,150,149;, + 3;161,149,162;, + 3;162,149,148;, + 3;162,148,147;, + 3;162,147,163;; + + MeshMaterialList { + 3; + 222; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2; + Material { + 1.000000;1.000000;0.000000;1.000000;; + 29.000000; + 0.768627;0.768627;0.768627;; + 0.000000;0.000000;0.000000;; + TextureFilename { + "gdk_fill.ppm"; + } + } + Material { + 0.066667;0.066667;0.066667;1.000000;; + 25.000000; + 1.000000;1.000000;1.000000;; + 0.000000;0.000000;0.000000;; + } + Material { + 1.000000;1.000000;1.000000;1.000000;; + 15.000000; + 0.000000;0.000000;0.000000;; + 0.000000;0.000000;0.000000;; + TextureFilename { + "gdk_fill.ppm"; + } + } + } + MeshNormals { + 281; + -0.478434;-0.023088;-0.877820;, + -0.513663;-0.019389;0.857773;, + -0.501055;0.722024;0.477100;, + -0.997321;0.003663;-0.073064;, + -0.910930;-0.039890;-0.410627;, + -0.724168;-0.010650;-0.689541;, + -0.170866;-0.031963;-0.984776;, + 0.146440;-0.008894;-0.989180;, + 0.478056;-0.014197;-0.878215;, + 0.807875;-0.032077;-0.588481;, + 0.971451;-0.033798;-0.234820;, + 0.989704;-0.037440;0.138148;, + 0.782155;-0.051683;0.620936;, + 0.477863;-0.040690;0.877491;, + 0.139034;-0.024856;0.989976;, + -0.188979;-0.046382;0.980885;, + -0.797178;-0.046338;0.601964;, + -0.965095;-0.040664;0.258724;, + 0.972871;-0.013218;0.230969;, + 0.669600;0.711620;0.212679;, + 0.697325;0.701086;0.149052;, + 0.617521;0.692520;0.372939;, + 0.844771;-0.010578;0.535024;, + 0.557100;0.717609;0.417943;, + 0.628008;-0.017369;0.778013;, + 0.437782;0.708062;0.554071;, + 0.422888;0.712077;0.560457;, + 0.328933;0.017757;0.944186;, + 0.265524;0.701979;0.660850;, + 0.154368;0.733160;0.662304;, + 0.024493;-0.047537;0.998569;, + 0.047594;0.715499;0.696991;, + -0.070257;0.728736;0.681181;, + -0.146855;-0.047353;0.988024;, + -0.134349;0.722061;0.678659;, + -0.374975;0.021236;0.926792;, + -0.268212;0.707827;0.653485;, + -0.282169;0.713143;0.641723;, + -0.646881;0.012618;0.762486;, + -0.446610;0.688458;0.571458;, + -0.889469;-0.022954;0.456419;, + -0.608299;0.702579;0.369262;, + -0.638423;0.719843;0.272475;, + -0.991217;0.023119;0.130210;, + -0.708505;0.690417;0.146100;, + -0.708948;0.699138;0.092735;, + -0.705655;0.701385;-0.100544;, + -0.981950;-0.026561;-0.187267;, + -0.705655;0.701385;-0.100544;, + -0.918966;-0.015847;-0.394019;, + -0.647672;0.708630;-0.279935;, + -0.612996;0.724978;-0.314074;, + -0.803183;0.014182;-0.595564;, + -0.569734;0.703672;-0.424557;, + -0.479766;0.730301;-0.486298;, + -0.602316;0.017757;-0.798060;, + -0.412756;0.697934;-0.585253;, + -0.284138;0.725851;-0.626423;, + -0.329137;-0.003467;-0.944276;, + -0.207799;0.712127;-0.670593;, + -0.032572;0.005332;-0.999455;, + -0.040220;0.703908;-0.709152;, + -0.035844;0.722861;-0.690063;, + 0.282509;0.028433;-0.958843;, + 0.153227;0.696015;-0.701487;, + 0.243429;0.723633;-0.645831;, + 0.545231;-0.007880;-0.838249;, + 0.371191;0.710825;-0.597449;, + 0.452377;0.734999;-0.505105;, + 0.749174;-0.007881;-0.662326;, + 0.541288;0.713241;-0.445302;, + 0.619892;0.717664;-0.317320;, + 0.913974;0.021393;-0.405209;, + 0.649879;0.707079;-0.278741;, + 0.997868;0.000082;-0.065269;, + 0.699072;0.714950;-0.012055;, + 0.705797;0.707079;-0.043472;, + -0.707155;-0.000015;-0.707059;, + 0.853247;-0.000011;-0.521507;, + -0.599156;0.517366;-0.611018;, + -0.796240;0.200626;-0.570746;, + -0.889629;0.000009;-0.456685;, + -0.932439;-0.167941;-0.319927;, + 0.519032;0.445579;-0.729428;, + 0.531977;-0.000064;-0.846759;, + -0.856075;-0.000014;-0.516851;, + 0.853247;-0.000011;-0.521507;, + 0.000000;0.000003;1.000000;, + -0.981182;-0.000000;-0.193086;, + -0.857495;-0.489219;-0.159271;, + 0.000000;0.000003;1.000000;, + 0.853247;-0.000003;-0.521507;, + 0.745330;0.000003;0.666696;, + 0.680916;0.444080;0.582362;, + 0.906795;0.000010;0.421571;, + -0.856075;-0.000014;-0.516851;, + 0.000000;0.000003;1.000000;, + 0.966793;0.000001;0.255561;, + 0.871114;-0.444071;0.209672;, + 0.672864;-0.142847;-0.725843;, + -0.707106;-0.000000;0.707108;, + -0.965926;-0.000000;0.258820;, + -0.965926;0.000000;-0.258818;, + -0.965926;-0.000001;0.258820;, + -0.965926;0.000000;-0.258818;, + -0.707108;0.000000;-0.707106;, + -0.707108;0.000000;-0.707106;, + -0.258820;0.000000;-0.965926;, + 0.258818;0.000000;-0.965926;, + -0.258820;0.000000;-0.965926;, + -0.856075;-0.000006;-0.516851;, + -0.700824;-0.000011;0.713334;, + 0.707106;0.000000;-0.707108;, + 0.258818;0.000000;-0.965926;, + -0.907564;0.114928;-0.403881;, + -0.273784;0.000060;0.961791;, + -0.913617;-0.000025;-0.406575;, + -0.208608;-0.973583;-0.092835;, + -0.913617;-0.000015;-0.406575;, + -0.907564;0.114928;-0.403881;, + -0.913617;-0.000015;-0.406575;, + 0.268675;-0.000035;-0.963231;, + -0.000000;1.000000;0.000001;, + 0.268676;-0.000038;-0.963231;, + -0.700824;-0.000011;0.713334;, + -0.866368;-0.000003;0.499407;, + 0.965926;-0.000000;0.258819;, + 0.965926;0.000000;-0.258820;, + 0.258820;-0.000000;0.965926;, + 0.707107;0.000001;0.707106;, + -0.258818;-0.000000;0.965926;, + 0.258820;-0.000001;0.965926;, + -0.707106;-0.000000;0.707108;, + -0.258818;-0.000000;0.965926;, + 0.965926;0.000000;-0.258820;, + 0.707106;0.000000;-0.707108;, + -0.000000;1.000000;0.000000;, + -0.248834;-0.482049;0.840066;, + -0.000001;1.000000;0.000000;, + -0.141809;-0.168636;0.975424;, + -0.000000;1.000000;0.000000;, + 0.000685;-0.000000;-1.000000;, + -0.000001;1.000000;0.000000;, + -0.267355;0.000003;-0.963598;, + -0.000001;1.000000;0.000000;, + 0.875644;-0.000020;-0.482957;, + -0.267354;-0.000040;-0.963598;, + -0.968520;-0.000023;0.248936;, + 0.104704;-0.000009;0.994503;, + -0.968520;-0.000001;0.248937;, + 0.965926;-0.000000;0.258819;, + 0.707107;-0.000000;0.707106;, + 0.000000;1.000000;0.000000;, + -0.013766;0.743938;0.668107;, + 0.000000;1.000000;0.000001;, + 0.094418;-0.100648;0.990432;, + 0.000001;1.000000;0.000002;, + 0.292164;-0.142842;0.945641;, + 0.000000;1.000000;0.000000;, + 0.875644;-0.000009;-0.482958;, + 0.000001;1.000000;0.000002;, + 0.372181;0.445604;0.814198;, + 0.000001;1.000000;0.000002;, + 0.875644;-0.000009;-0.482958;, + 0.467327;0.000018;0.884085;, + 0.104704;-0.000009;0.994503;, + 0.851901;-0.482114;-0.204529;, + 0.915645;-0.168639;-0.364904;, + 0.585462;0.743957;-0.322121;, + 0.810531;-0.100646;-0.576983;, + 0.969828;-0.000042;-0.243791;, + 0.104704;0.000003;0.994503;, + 0.000000;1.000000;-0.000000;, + 0.000685;-0.000018;-1.000000;, + 0.000000;1.000000;-0.000000;, + 0.172030;0.431894;0.885366;, + 0.000000;1.000000;-0.000000;, + -0.097626;0.320694;0.942138;, + -0.000001;1.000000;0.000000;, + -0.267355;0.000000;-0.963598;, + 0.875644;-0.000020;-0.482957;, + 0.000000;1.000000;0.000000;, + 0.875644;-0.000020;-0.482957;, + 0.372181;0.445601;0.814200;, + -0.000000;1.000000;-0.000000;, + -0.248834;-0.482049;0.840066;, + -0.913617;-0.000025;-0.406575;, + 0.000001;1.000000;0.000001;, + -0.913617;-0.000025;-0.406575;, + 0.268675;-0.000035;-0.963231;, + 0.000000;1.000000;0.000000;, + 0.853247;0.000001;-0.521507;, + 0.745330;0.000003;0.666696;, + 0.000000;1.000000;0.000000;, + 0.890720;0.000005;0.454553;, + 0.000000;1.000000;0.000000;, + -0.774106;0.285676;-0.564934;, + -0.000000;1.000000;0.000001;, + -0.932438;-0.167945;-0.319927;, + -0.000000;1.000000;-0.000000;, + -0.857489;-0.489230;-0.159269;, + 0.000000;0.000003;1.000000;, + -0.000000;1.000000;0.000000;, + -0.000000;0.000003;1.000000;, + 0.966793;0.000001;0.255561;, + 0.000001;1.000000;-0.000000;, + -0.707155;-0.000023;-0.707059;, + 0.853247;-0.000011;-0.521507;, + -0.000000;1.000000;0.000001;, + -0.866368;-0.000003;0.499407;, + -0.000000;1.000000;0.000001;, + 0.680725;0.431920;-0.591657;, + -0.000000;1.000000;0.000001;, + 0.864722;0.320713;-0.386522;, + 0.000001;1.000000;0.000002;, + -0.856075;0.000000;-0.516851;, + -0.700824;-0.000011;0.713334;, + 0.000000;1.000000;0.000000;, + 0.519033;0.445576;-0.729429;, + -0.856075;-0.000014;-0.516851;, + -0.000000;1.000000;0.000000;, + 0.104704;0.000004;0.994503;, + 0.851901;-0.482114;-0.204529;, + 0.000000;1.000000;-0.000001;, + -0.968520;-0.000023;0.248936;, + 0.104704;-0.000009;0.994503;, + 0.000000;1.000000;0.000000;, + 0.965926;-0.000000;0.258819;, + 0.965926;0.000000;-0.258820;, + 0.000000;1.000000;0.000000;, + 0.965926;-0.000000;0.258819;, + 0.707107;-0.000000;0.707106;, + 0.000000;1.000000;0.000000;, + -0.000000;1.000000;0.000000;, + 0.258820;-0.000000;0.965926;, + 0.707107;-0.000000;0.707106;, + -0.000000;1.000000;0.000000;, + 0.258820;-0.000000;0.965926;, + -0.258818;-0.000000;0.965926;, + 0.000000;1.000000;0.000000;, + -0.707106;-0.000000;0.707108;, + -0.258818;-0.000000;0.965926;, + 0.000000;1.000000;0.000000;, + -0.707106;-0.000000;0.707108;, + -0.965926;-0.000000;0.258820;, + 0.000000;1.000000;0.000000;, + -0.965926;-0.000000;0.258820;, + -0.965926;0.000000;-0.258818;, + 0.000000;1.000000;0.000000;, + -0.965926;0.000000;-0.258818;, + -0.707108;0.000000;-0.707106;, + 0.000000;1.000000;0.000000;, + -0.707108;0.000000;-0.707106;, + -0.258820;0.000000;-0.965926;, + -0.000000;1.000000;0.000000;, + -0.258820;0.000000;-0.965926;, + 0.258818;0.000000;-0.965926;, + 0.000000;1.000000;0.000000;, + 0.258818;0.000000;-0.965926;, + 0.707106;0.000000;-0.707108;, + -0.000000;1.000000;0.000000;, + 0.707106;0.000000;-0.707108;, + 0.965926;0.000000;-0.258820;, + 0.000000;1.000000;0.000001;, + 0.000000;1.000000;0.000000;, + -0.000000;1.000000;0.000000;, + 0.000000;1.000000;0.000001;, + 0.000000;1.000000;0.000001;, + -0.000001;1.000000;0.000000;, + -0.000000;1.000000;0.000000;, + 0.000000;1.000000;0.000001;, + -0.000000;1.000000;-0.000000;, + -0.000000;1.000000;0.000000;, + -0.000000;1.000000;0.000000;, + -0.000000;1.000000;0.000000;, + 0.000000;1.000000;0.000001;, + -0.000000;1.000000;0.000000;, + -0.000000;1.000000;0.000000;, + 0.000000;1.000000;0.000001;, + 0.000000;1.000000;0.000001;, + -0.000001;1.000000;0.000001;; + + 222; + 3;47,4,3;, + 3;49,4,47;, + 3;52,4,49;, + 3;52,5,4;, + 3;55,5,52;, + 3;55,0,5;, + 3;58,0,55;, + 3;58,6,0;, + 3;60,6,58;, + 3;60,7,6;, + 3;63,7,60;, + 3;63,8,7;, + 3;66,8,63;, + 3;66,9,8;, + 3;69,9,66;, + 3;72,9,69;, + 3;72,10,9;, + 3;74,10,72;, + 3;74,11,10;, + 3;18,11,74;, + 3;18,12,11;, + 3;22,12,18;, + 3;24,12,22;, + 3;24,13,12;, + 3;27,13,24;, + 3;27,14,13;, + 3;30,14,27;, + 3;30,15,14;, + 3;33,15,30;, + 3;35,15,33;, + 3;38,1,35;, + 3;35,1,15;, + 3;38,16,1;, + 3;40,16,38;, + 3;40,17,16;, + 3;43,17,40;, + 3;47,3,43;, + 3;43,3,17;, + 3;75,20,19;, + 3;20,21,19;, + 3;19,21,23;, + 3;21,26,23;, + 3;23,26,25;, + 3;28,25,26;, + 3;26,29,28;, + 3;31,28,29;, + 3;32,31,29;, + 3;34,31,32;, + 3;32,37,34;, + 3;34,37,36;, + 3;39,36,37;, + 3;2,39,37;, + 3;41,39,2;, + 3;2,42,41;, + 3;44,41,42;, + 3;45,44,42;, + 3;45,46,44;, + 3;48,44,46;, + 3;50,48,46;, + 3;51,50,46;, + 3;50,51,53;, + 3;54,53,51;, + 3;56,53,54;, + 3;54,57,56;, + 3;59,56,57;, + 3;57,62,59;, + 3;59,62,61;, + 3;61,62,64;, + 3;62,65,64;, + 3;67,64,65;, + 3;68,67,65;, + 3;70,67,68;, + 3;68,71,70;, + 3;73,70,71;, + 3;75,73,76;, + 3;76,73,71;, + 3;20,75,76;, + 3;119,117,114;, + 3;122,119,114;, + 3;114,136,140;, + 3;140,122,114;, + 3;136,138,142;, + 3;142,140,136;, + 3;144,142,138;, + 3;138,152,158;, + 3;158,144,138;, + 3;152,154,158;, + 3;156,160,162;, + 3;154,156,158;, + 3;162,158,156;, + 3;172,176,174;, + 3;172,174,178;, + 3;178,174,181;, + 3;176,172,184;, + 3;184,172,187;, + 3;190,195,193;, + 3;193,195,197;, + 3;193,197,199;, + 3;193,199,202;, + 3;195,190,205;, + 3;208,212,210;, + 3;208,210,214;, + 3;214,210,217;, + 3;212,208,220;, + 3;220,208,223;, + 3;226,232,229;, + 3;229,232,233;, + 3;233,232,236;, + 3;236,232,239;, + 3;239,232,242;, + 3;242,232,245;, + 3;245,232,248;, + 3;248,232,251;, + 3;251,232,254;, + 3;254,232,257;, + 3;257,232,260;, + 3;260,232,226;, + 3;196,206,79;, + 3;77,79,206;, + 3;196,79,80;, + 3;80,81,196;, + 3;81,198,196;, + 3;81,82,198;, + 3;207,86,78;, + 3;82,200,198;, + 3;82,89,200;, + 3;191,86,207;, + 3;211,99,218;, + 3;218,99,83;, + 3;218,83,84;, + 3;201,87,90;, + 3;89,88,200;, + 3;191,91,86;, + 3;90,203,201;, + 3;96,203,90;, + 3;192,194,92;, + 3;93,92,194;, + 3;94,93,194;, + 3;194,98,94;, + 3;95,219,85;, + 3;95,215,219;, + 3;110,215,95;, + 3;97,194,204;, + 3;194,97,98;, + 3;211,169,99;, + 3;216,111,124;, + 3;243,100,132;, + 3;132,240,243;, + 3;244,246,101;, + 3;247,249,102;, + 3;101,246,103;, + 3;104,102,249;, + 3;250,252,105;, + 3;106,105,252;, + 3;253,255,107;, + 3;256,258,108;, + 3;107,255,109;, + 3;259,261,112;, + 3;108,258,113;, + 3;185,115,137;, + 3;186,188,116;, + 3;188,120,118;, + 3;189,173,121;, + 3;116,188,118;, + 3;121,173,123;, + 3;123,173,141;, + 3;149,209,125;, + 3;209,216,125;, + 3;124,125,216;, + 3;230,150,227;, + 3;227,150,126;, + 3;234,237,128;, + 3;238,241,130;, + 3;128,237,131;, + 3;130,241,133;, + 3;262,228,134;, + 3;261,135,112;, + 3;228,127,134;, + 3;137,177,185;, + 3;177,137,139;, + 3;153,177,139;, + 3;173,179,141;, + 3;179,143,141;, + 3;180,182,145;, + 3;143,179,146;, + 3;182,159,145;, + 3;224,209,147;, + 3;147,209,149;, + 3;231,235,151;, + 3;151,235,129;, + 3;153,175,177;, + 3;175,153,155;, + 3;175,155,157;, + 3;157,183,175;, + 3;161,183,157;, + 3;159,182,163;, + 3;165,225,148;, + 3;183,161,164;, + 3;165,221,225;, + 3;222,170,166;, + 3;166,213,222;, + 3;166,167,213;, + 3;213,167,168;, + 3;168,211,213;, + 3;211,168,169;, + 3;171,221,165;, + 3;273,272,274;, + 3;274,272,275;, + 3;275,272,276;, + 3;276,272,277;, + 3;277,272,278;, + 3;278,272,271;, + 3;278,271,270;, + 3;278,270,263;, + 3;278,263,269;, + 3;278,269,268;, + 3;278,268,267;, + 3;278,267,266;, + 3;278,266,279;, + 3;279,266,265;, + 3;279,265,264;, + 3;279,264,280;; + } + MeshTextureCoords { + 164; + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.268884;0.856707;, + 0.207531;0.795346;, + 0.146390;0.737888;, + 0.119222;0.688786;, + 0.097847;0.643752;, + 0.726345;0.857798;, + 0.714652;0.865143;, + 0.347119;0.728705;, + 0.071537;0.500034;, + 0.087737;0.582358;, + 0.221489;0.500034;, + 0.416618;0.614996;, + 0.395559;0.591453;, + 0.368072;0.556819;, + 0.637138;0.736753;, + 0.354693;0.500034;, + 0.362765;0.530572;, + 0.781681;0.809882;, + 0.427654;0.455869;, + 0.416725;0.496656;, + 0.427653;0.537442;, + 0.457511;0.567299;, + 0.498297;0.578228;, + 0.568281;0.622703;, + 0.539083;0.567300;, + 0.308688;0.114332;, + 0.362981;0.236334;, + 0.424104;0.373683;, + 0.459027;0.363941;, + 0.597396;0.594098;, + 0.623260;0.568689;, + 0.579870;0.496656;, + 0.539084;0.426012;, + 0.498297;0.415083;, + 0.457511;0.426012;, + 0.568941;0.537442;, + 0.387943;0.091771;, + 0.446172;0.073256;, + 0.498343;0.352975;, + 0.533280;0.362668;, + 0.572611;0.373581;, + 0.642446;0.494041;, + 0.633420;0.529157;, + 0.568941;0.455869;, + 0.473762;0.072346;, + 0.534864;0.072197;, + 0.628014;0.095181;, + 0.636952;0.256925;, + 0.697176;0.119146;, + 0.709384;0.125599;, + 0.791953;0.509782;, + 0.904669;0.603680;, + 0.891589;0.663366;, + 0.878582;0.687715;, + 0.848160;0.740706;, + 0.924758;0.523764;, + 0.498343;0.352975;, + 0.562359;0.074656;, + 0.432471;0.074972;, + 0.572611;0.373581;, + 0.709384;0.125599;, + 0.308688;0.114332;, + 0.424104;0.373683;, + 0.416618;0.614996;, + 0.371852;0.564950;, + 0.138464;0.726270;, + 0.093027;0.630541;, + 0.071537;0.500034;, + 0.354693;0.500034;, + 0.268884;0.856707;, + 0.623260;0.568689;, + 0.832283;0.763288;, + 0.896953;0.650643;, + 0.568281;0.622703;, + 0.714652;0.865143;, + 0.924758;0.523764;, + 0.642446;0.494041;, + 0.579870;0.496656;, + 0.568941;0.455869;, + 0.498297;0.496656;, + 0.539084;0.426012;, + 0.498297;0.415083;, + 0.457511;0.426012;, + 0.427654;0.455869;, + 0.416725;0.496656;, + 0.427653;0.537442;, + 0.457511;0.567299;, + 0.498297;0.578228;, + 0.539083;0.567300;, + 0.568941;0.537442;, + 0.163232;0.126306;, + 0.985206;0.375649;, + 0.901675;0.199037;, + 0.797771;0.095133;, + 0.621159;0.011602;, + 0.426023;0.002015;, + 0.285410;0.044670;, + 0.036891;0.305697;, + 0.004196;0.423843;, + 0.004196;0.570785;, + 0.046850;0.711399;, + 0.145433;0.851375;, + 0.307878;0.959917;, + 0.474925;0.997429;, + 0.644845;0.976471;, + 0.835756;0.868322;, + 0.962097;0.688931;, + 0.999609;0.521883;; + } +} diff --git a/rockem/block1.wav b/rockem/block1.wav new file mode 100644 index 0000000..40e874b Binary files /dev/null and b/rockem/block1.wav differ diff --git a/rockem/block2.wav b/rockem/block2.wav new file mode 100644 index 0000000..cbb0452 Binary files /dev/null and b/rockem/block2.wav differ diff --git a/rockem/block3.wav b/rockem/block3.wav new file mode 100644 index 0000000..a61bcc1 Binary files /dev/null and b/rockem/block3.wav differ diff --git a/rockem/cboo.wav b/rockem/cboo.wav new file mode 100644 index 0000000..d358e7a Binary files /dev/null and b/rockem/cboo.wav differ diff --git a/rockem/cloop.wav b/rockem/cloop.wav new file mode 100644 index 0000000..4bf936c Binary files /dev/null and b/rockem/cloop.wav differ diff --git a/rockem/cyeah.wav b/rockem/cyeah.wav new file mode 100644 index 0000000..eb73ff4 Binary files /dev/null and b/rockem/cyeah.wav differ diff --git a/rockem/debris_b.x b/rockem/debris_b.x new file mode 100644 index 0000000..c4a3159 --- /dev/null +++ b/rockem/debris_b.x @@ -0,0 +1,236 @@ +xof 0302txt 0064 +template Header { + <3D82AB43-62DA-11cf-AB39-0020AF71E433> + WORD major; + WORD minor; + DWORD flags; +} + +template Vector { + <3D82AB5E-62DA-11cf-AB39-0020AF71E433> + FLOAT x; + FLOAT y; + FLOAT z; +} + +template Coords2d { + <F6F23F44-7686-11cf-8F52-0040333594A3> + FLOAT u; + FLOAT v; +} + +template Matrix4x4 { + <F6F23F45-7686-11cf-8F52-0040333594A3> + array FLOAT matrix[16]; +} + +template ColorRGBA { + <35FF44E0-6C7C-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; + FLOAT alpha; +} + +template ColorRGB { + <D3E16E81-7835-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; +} + +template IndexedColor { + <1630B820-7842-11cf-8F52-0040333594A3> + DWORD index; + ColorRGBA indexColor; +} + +template Boolean { + <4885AE61-78E8-11cf-8F52-0040333594A3> + WORD truefalse; +} + +template Boolean2d { + <4885AE63-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template MaterialWrap { + <4885AE60-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template TextureFilename { + <A42790E1-7810-11cf-8F52-0040333594A3> + STRING filename; +} + +template Material { + <3D82AB4D-62DA-11cf-AB39-0020AF71E433> + ColorRGBA faceColor; + FLOAT power; + ColorRGB specularColor; + ColorRGB emissiveColor; + [...] +} + +template MeshFace { + <3D82AB5F-62DA-11cf-AB39-0020AF71E433> + DWORD nFaceVertexIndices; + array DWORD faceVertexIndices[nFaceVertexIndices]; +} + +template MeshFaceWraps { + <4885AE62-78E8-11cf-8F52-0040333594A3> + DWORD nFaceWrapValues; + Boolean2d faceWrapValues; +} + +template MeshTextureCoords { + <F6F23F40-7686-11cf-8F52-0040333594A3> + DWORD nTextureCoords; + array Coords2d textureCoords[nTextureCoords]; +} + +template MeshMaterialList { + <F6F23F42-7686-11cf-8F52-0040333594A3> + DWORD nMaterials; + DWORD nFaceIndexes; + array DWORD faceIndexes[nFaceIndexes]; + [Material] +} + +template MeshNormals { + <F6F23F43-7686-11cf-8F52-0040333594A3> + DWORD nNormals; + array Vector normals[nNormals]; + DWORD nFaceNormals; + array MeshFace faceNormals[nFaceNormals]; +} + +template MeshVertexColors { + <1630B821-7842-11cf-8F52-0040333594A3> + DWORD nVertexColors; + array IndexedColor vertexColors[nVertexColors]; +} + +template Mesh { + <3D82AB44-62DA-11cf-AB39-0020AF71E433> + DWORD nVertices; + array Vector vertices[nVertices]; + DWORD nFaces; + array MeshFace faces[nFaces]; + [...] +} + +Header { + 1; + 0; + 1; +} + +Mesh { + 10; + 0.082451;-0.082450;-6.700000;, + 0.082451;0.082451;-6.700000;, + -0.082451;0.082451;-6.700000;, + -0.082451;-0.082450;-6.700000;, + 3.349999;-3.350001;-0.000000;, + 3.350000;3.350000;0.000000;, + -3.349999;3.350001;0.000000;, + -3.350002;-3.349998;-0.000000;, + 0.000000;0.000000;-6.700000;, + 0.000000;-0.000000;-0.000000;; + + 16; + 3;0,8,1;, + 3;1,8,2;, + 3;2,8,3;, + 3;3,8,0;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,5,9;, + 3;5,6,9;, + 3;6,7,9;, + 3;7,4,9;; + + MeshMaterialList { + 1; + 1; + 0;; + Material { + 0.274510;0.325490;0.905882;1.000000;; + 30.000000; + 0.768627;0.768627;0.768627;; + 0.000000;0.000000;0.000000;; + } + } + MeshNormals { + 26; + 0.000000;0.000000;-1.000000;, + 0.898808;-0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.000000;0.000000;-1.000000;, + 0.898808;-0.000000;-0.438343;, + 0.000000;0.898808;-0.438343;, + 0.000000;0.000000;-1.000000;, + 0.000000;0.898808;-0.438343;, + -0.898808;0.000000;-0.438343;, + 0.000000;0.000000;-1.000000;, + -0.898808;0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.898808;-0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.000000;-0.000000;1.000000;, + 0.898808;-0.000000;-0.438343;, + 0.000000;0.898808;-0.438343;, + 0.000000;-0.000000;1.000000;, + 0.000000;0.898808;-0.438343;, + -0.898808;0.000000;-0.438343;, + 0.000000;-0.000000;1.000000;, + -0.898808;0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.000000;-0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + 0.000000;-0.000000;1.000000;; + + 16; + 3;0,24,3;, + 3;3,24,6;, + 3;6,24,9;, + 3;9,24,0;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,17,25;, + 3;17,20,25;, + 3;20,23,25;, + 3;23,14,25;; + } + MeshTextureCoords { + 10; + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;; + } +} diff --git a/rockem/debris_r.x b/rockem/debris_r.x new file mode 100644 index 0000000..8e1fad2 --- /dev/null +++ b/rockem/debris_r.x @@ -0,0 +1,236 @@ +xof 0302txt 0064 +template Header { + <3D82AB43-62DA-11cf-AB39-0020AF71E433> + WORD major; + WORD minor; + DWORD flags; +} + +template Vector { + <3D82AB5E-62DA-11cf-AB39-0020AF71E433> + FLOAT x; + FLOAT y; + FLOAT z; +} + +template Coords2d { + <F6F23F44-7686-11cf-8F52-0040333594A3> + FLOAT u; + FLOAT v; +} + +template Matrix4x4 { + <F6F23F45-7686-11cf-8F52-0040333594A3> + array FLOAT matrix[16]; +} + +template ColorRGBA { + <35FF44E0-6C7C-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; + FLOAT alpha; +} + +template ColorRGB { + <D3E16E81-7835-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; +} + +template IndexedColor { + <1630B820-7842-11cf-8F52-0040333594A3> + DWORD index; + ColorRGBA indexColor; +} + +template Boolean { + <4885AE61-78E8-11cf-8F52-0040333594A3> + WORD truefalse; +} + +template Boolean2d { + <4885AE63-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template MaterialWrap { + <4885AE60-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template TextureFilename { + <A42790E1-7810-11cf-8F52-0040333594A3> + STRING filename; +} + +template Material { + <3D82AB4D-62DA-11cf-AB39-0020AF71E433> + ColorRGBA faceColor; + FLOAT power; + ColorRGB specularColor; + ColorRGB emissiveColor; + [...] +} + +template MeshFace { + <3D82AB5F-62DA-11cf-AB39-0020AF71E433> + DWORD nFaceVertexIndices; + array DWORD faceVertexIndices[nFaceVertexIndices]; +} + +template MeshFaceWraps { + <4885AE62-78E8-11cf-8F52-0040333594A3> + DWORD nFaceWrapValues; + Boolean2d faceWrapValues; +} + +template MeshTextureCoords { + <F6F23F40-7686-11cf-8F52-0040333594A3> + DWORD nTextureCoords; + array Coords2d textureCoords[nTextureCoords]; +} + +template MeshMaterialList { + <F6F23F42-7686-11cf-8F52-0040333594A3> + DWORD nMaterials; + DWORD nFaceIndexes; + array DWORD faceIndexes[nFaceIndexes]; + [Material] +} + +template MeshNormals { + <F6F23F43-7686-11cf-8F52-0040333594A3> + DWORD nNormals; + array Vector normals[nNormals]; + DWORD nFaceNormals; + array MeshFace faceNormals[nFaceNormals]; +} + +template MeshVertexColors { + <1630B821-7842-11cf-8F52-0040333594A3> + DWORD nVertexColors; + array IndexedColor vertexColors[nVertexColors]; +} + +template Mesh { + <3D82AB44-62DA-11cf-AB39-0020AF71E433> + DWORD nVertices; + array Vector vertices[nVertices]; + DWORD nFaces; + array MeshFace faces[nFaces]; + [...] +} + +Header { + 1; + 0; + 1; +} + +Mesh { + 10; + 0.082451;-0.082450;-6.700000;, + 0.082451;0.082451;-6.700000;, + -0.082451;0.082451;-6.700000;, + -0.082451;-0.082450;-6.700000;, + 3.349999;-3.350001;-0.000000;, + 3.350000;3.350000;0.000000;, + -3.349999;3.350001;0.000000;, + -3.350002;-3.349998;-0.000000;, + 0.000000;0.000000;-6.700000;, + 0.000000;-0.000000;-0.000000;; + + 16; + 3;0,8,1;, + 3;1,8,2;, + 3;2,8,3;, + 3;3,8,0;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,5,9;, + 3;5,6,9;, + 3;6,7,9;, + 3;7,4,9;; + + MeshMaterialList { + 1; + 1; + 0;; + Material { + 0.905882;0.274510;0.274510;1.000000;; + 29.000000; + 0.768627;0.768627;0.768627;; + 0.000000;0.000000;0.000000;; + } + } + MeshNormals { + 26; + 0.000000;0.000000;-1.000000;, + 0.898808;-0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.000000;0.000000;-1.000000;, + 0.898808;-0.000000;-0.438343;, + 0.000000;0.898808;-0.438343;, + 0.000000;0.000000;-1.000000;, + 0.000000;0.898808;-0.438343;, + -0.898808;0.000000;-0.438343;, + 0.000000;0.000000;-1.000000;, + -0.898808;0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.898808;-0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.000000;-0.000000;1.000000;, + 0.898808;-0.000000;-0.438343;, + 0.000000;0.898808;-0.438343;, + 0.000000;-0.000000;1.000000;, + 0.000000;0.898808;-0.438343;, + -0.898808;0.000000;-0.438343;, + 0.000000;-0.000000;1.000000;, + -0.898808;0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.000000;-0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + 0.000000;-0.000000;1.000000;; + + 16; + 3;0,24,3;, + 3;3,24,6;, + 3;6,24,9;, + 3;9,24,0;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,17,25;, + 3;17,20,25;, + 3;20,23,25;, + 3;23,14,25;; + } + MeshTextureCoords { + 10; + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;; + } +} diff --git a/rockem/defend1.wav b/rockem/defend1.wav new file mode 100644 index 0000000..ff34787 Binary files /dev/null and b/rockem/defend1.wav differ diff --git a/rockem/defend2.wav b/rockem/defend2.wav new file mode 100644 index 0000000..a83ac59 Binary files /dev/null and b/rockem/defend2.wav differ diff --git a/rockem/demech.x b/rockem/demech.x new file mode 100644 index 0000000..1e7dcd3 --- /dev/null +++ b/rockem/demech.x @@ -0,0 +1,3819 @@ +xof 0302txt 0064 +template Header { + <3D82AB43-62DA-11cf-AB39-0020AF71E433> + WORD major; + WORD minor; + DWORD flags; +} + +template Vector { + <3D82AB5E-62DA-11cf-AB39-0020AF71E433> + FLOAT x; + FLOAT y; + FLOAT z; +} + +template Coords2d { + <F6F23F44-7686-11cf-8F52-0040333594A3> + FLOAT u; + FLOAT v; +} + +template Matrix4x4 { + <F6F23F45-7686-11cf-8F52-0040333594A3> + array FLOAT matrix[16]; +} + +template ColorRGBA { + <35FF44E0-6C7C-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; + FLOAT alpha; +} + +template ColorRGB { + <D3E16E81-7835-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; +} + +template IndexedColor { + <1630B820-7842-11cf-8F52-0040333594A3> + DWORD index; + ColorRGBA indexColor; +} + +template Boolean { + <4885AE61-78E8-11cf-8F52-0040333594A3> + WORD truefalse; +} + +template Boolean2d { + <4885AE63-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template MaterialWrap { + <4885AE60-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template TextureFilename { + <A42790E1-7810-11cf-8F52-0040333594A3> + STRING filename; +} + +template Material { + <3D82AB4D-62DA-11cf-AB39-0020AF71E433> + ColorRGBA faceColor; + FLOAT power; + ColorRGB specularColor; + ColorRGB emissiveColor; + [...] +} + +template MeshFace { + <3D82AB5F-62DA-11cf-AB39-0020AF71E433> + DWORD nFaceVertexIndices; + array DWORD faceVertexIndices[nFaceVertexIndices]; +} + +template MeshFaceWraps { + <4885AE62-78E8-11cf-8F52-0040333594A3> + DWORD nFaceWrapValues; + Boolean2d faceWrapValues; +} + +template MeshTextureCoords { + <F6F23F40-7686-11cf-8F52-0040333594A3> + DWORD nTextureCoords; + array Coords2d textureCoords[nTextureCoords]; +} + +template MeshMaterialList { + <F6F23F42-7686-11cf-8F52-0040333594A3> + DWORD nMaterials; + DWORD nFaceIndexes; + array DWORD faceIndexes[nFaceIndexes]; + [Material] +} + +template MeshNormals { + <F6F23F43-7686-11cf-8F52-0040333594A3> + DWORD nNormals; + array Vector normals[nNormals]; + DWORD nFaceNormals; + array MeshFace faceNormals[nFaceNormals]; +} + +template MeshVertexColors { + <1630B821-7842-11cf-8F52-0040333594A3> + DWORD nVertexColors; + array IndexedColor vertexColors[nVertexColors]; +} + +template Mesh { + <3D82AB44-62DA-11cf-AB39-0020AF71E433> + DWORD nVertices; + array Vector vertices[nVertices]; + DWORD nFaces; + array MeshFace faces[nFaces]; + [...] +} + +template FrameTransformMatrix { + <F6F23F41-7686-11cf-8F52-0040333594A3> + Matrix4x4 frameMatrix; +} + +template Frame { + <3D82AB46-62DA-11cf-AB39-0020AF71E433> + [...] +} + +template FloatKeys { + <10DD46A9-775B-11cf-8F52-0040333594A3> + DWORD nValues; + array FLOAT values[nValues]; +} + +template TimedFloatKeys { + <F406B180-7B3B-11cf-8F52-0040333594A3> + DWORD time; + FloatKeys tfkeys; +} + +template AnimationKey { + <10DD46A8-775B-11cf-8F52-0040333594A3> + DWORD keyType; + DWORD nKeys; + array TimedFloatKeys keys[nKeys]; +} + +template AnimationOptions { + <E2BF56C0-840F-11cf-8F52-0040333594A3> + DWORD openclosed; + DWORD positionquality; +} + +template Animation { + <3D82AB4F-62DA-11cf-AB39-0020AF71E433> + [...] +} + +template AnimationSet { + <3D82AB50-62DA-11cf-AB39-0020AF71E433> + [Animation] +} + +Header { + 1; + 0; + 1; +} + +Material x3ds_mat_01MECHHAND { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHHN.GIF"; + } +} +Material x3ds_mat_02MECHARM { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHLA.GIF"; + } +} +Material x3ds_mat_01GROIN { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHGR.GIF"; + } +} +Material x3ds_mat_02MECHLEG { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHLL.GIF"; + } +} +Material x3ds_mat_01MECHLEG { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHUL.GIF"; + } +} +Material x3ds_mat_01HEAD { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHHD.GIF"; + } +} +Material x3ds_mat_REDPLASTIC { + 1.000000, 0.368627, 0.368627, 1.000000;; + 30.800001; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; +} +Material x3ds_mat_01BACK { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.400000; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHBK.GIF"; + } +} +Material x3ds_mat_01MECHARM { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHUA.GIF"; + } +} +Material x3ds_mat_01CHEST { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.400000; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHCH.GIF"; + } +} + +Frame x3ds_xGroin { + FrameTransformMatrix { + -1.000000, 0.000000, 0.000000, 0.000000, + 0.000000, 0.000000, 1.000000, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + 0.000000, 35.534382, 1.024473, 1.000000;; + } + Mesh xGroin { + + 31; + -2.000033; -0.000005; -10.091250;, + -0.555553; -0.000005; -10.091250;, + 1.666685; -0.000005; -10.091250;, + -1.192545; -7.018511; -6.581248;, + -3.066506; -0.638034; -6.581249;, + -2.555453; 5.104383; -6.581252;, + -0.851815; 7.018551; -6.581251;, + 0.851807; 7.018506; -6.581251;, + 1.192535; -7.018467; -6.581248;, + -2.333362; -11.356153; 3.071271;, + -6.000067; -1.032373; 3.071292;, + -5.000066; 8.258989; 3.071267;, + -1.666681; 11.356154; 3.071267;, + 1.666685; 11.356243; 3.071267;, + 5.000067; 8.259121; 3.071267;, + 6.000000; -1.032373; 3.071269;, + 2.333369; -11.356200; 3.071271;, + -7.000063; -10.455877; 5.703794;, + -17.999998; -1.012086; 5.703773;, + -15.000134; 7.487371; 5.703790;, + -5.000066; 10.320596; 5.703789;, + 15.000134; 7.487412; 5.703790;, + 17.999998; -1.012087; 5.703768;, + 7.000071; -10.455922; 5.703794;, + -5.833399; -8.955485; 10.091297;, + -15.000132; -0.814138; 10.091291;, + -12.499999; 6.513076; 10.091294;, + -4.166667; 8.955388; 10.091293;, + 12.500134; 6.513030; 10.091294;, + 15.000134; -0.814141; 10.091295;, + 5.833402; -8.955529; 10.091297;; + + 53; + 3;1,4,0;, + 3;1,3,4;, + 3;0,5,1;, + 3;0,4,5;, + 3;1,5,6;, + 3;1,7,2;, + 3;1,6,7;, + 3;2,3,1;, + 3;2,8,3;, + 3;3,10,4;, + 3;3,9,10;, + 3;4,11,5;, + 3;4,10,11;, + 3;5,12,6;, + 3;5,11,12;, + 3;6,13,7;, + 3;6,12,13;, + 3;7,13,14;, + 3;7,15,2;, + 3;7,14,15;, + 3;2,16,8;, + 3;2,15,16;, + 3;8,9,3;, + 3;8,16,9;, + 3;9,18,10;, + 3;9,17,18;, + 3;10,19,11;, + 3;10,18,19;, + 3;11,20,12;, + 3;11,19,20;, + 3;12,20,13;, + 3;13,21,14;, + 3;14,22,15;, + 3;14,21,22;, + 3;15,23,16;, + 3;15,22,23;, + 3;16,17,9;, + 3;16,23,17;, + 3;17,25,18;, + 3;17,24,25;, + 3;18,26,19;, + 3;18,25,26;, + 3;19,27,20;, + 3;19,26,27;, + 3;20,27,13;, + 3;13,28,21;, + 3;13,27,28;, + 3;21,29,22;, + 3;21,28,29;, + 3;22,30,23;, + 3;22,29,30;, + 3;23,24,17;, + 3;23,30,24;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01GROIN} + } + MeshNormals { + 64; + -0.000000;-0.983877;-0.178844;, + -0.599572;0.408149;-0.688424;, + -0.560307;-0.381698;-0.735094;, + 0.000000;0.508170;-0.861257;, + -0.000000;-0.447290;-0.894389;, + 0.559687;0.421739;-0.713363;, + -0.000000;-0.447290;-0.894389;, + 0.937160;-0.239286;-0.253915;, + -0.880351;-0.277520;-0.384663;, + 0.000009;-0.721590;-0.692320;, + -0.680092;-0.595592;-0.427487;, + -0.956486;0.091041;-0.277212;, + -0.776351;0.298631;-0.555067;, + -0.612329;0.585593;-0.531164;, + -0.595762;0.530237;-0.603255;, + 0.000019;0.721585;-0.692326;, + 0.573074;0.533170;-0.622347;, + 0.634858;0.683287;-0.360658;, + 0.000013;-0.721591;-0.692319;, + 0.969727;-0.158439;-0.185813;, + -0.603915;-0.361812;-0.710196;, + 0.000004;-0.998923;-0.046402;, + -0.776502;-0.254344;-0.576501;, + -0.537039;0.077572;-0.839983;, + -0.815733;0.081072;-0.572719;, + -0.490500;0.710156;-0.505063;, + -0.643035;0.648313;-0.407671;, + -0.000027;0.999717;-0.023791;, + -0.010253;0.995713;0.091928;, + 0.398539;0.900274;-0.175139;, + 0.488511;0.525776;-0.696359;, + 0.507328;0.077991;-0.858217;, + 0.768552;0.139116;-0.624480;, + 0.584865;-0.268944;-0.765246;, + 0.845605;-0.234038;-0.479769;, + -0.000010;-0.998923;-0.046406;, + -0.654640;-0.753300;0.063125;, + -0.000009;-0.946205;0.323569;, + -0.582828;-0.600451;-0.547512;, + -0.943651;0.328188;0.042606;, + -0.654989;0.198844;-0.729006;, + -0.275500;0.960845;0.029596;, + -0.400693;0.869473;-0.288898;, + -0.014416;0.942381;0.334230;, + 0.328385;0.846238;-0.419578;, + 0.943441;0.328186;0.047052;, + 0.657040;0.204764;-0.725514;, + 0.655845;-0.753077;-0.052365;, + 0.593011;-0.504799;-0.627309;, + -0.000003;-0.946198;0.323589;, + -0.609542;-0.686312;0.396779;, + -0.000003;-0.946203;0.323573;, + -0.598574;-0.685369;0.414704;, + -0.799848;0.272917;0.534565;, + -0.802248;0.278457;0.528072;, + -0.263482;0.899018;0.349777;, + -0.132000;0.918501;0.372736;, + -0.028788;0.952884;0.301966;, + 0.168538;0.913545;0.370176;, + 0.807613;0.275554;0.521374;, + 0.802809;0.278603;0.527141;, + 0.596840;-0.672007;0.438393;, + 0.597512;-0.684374;0.417866;, + -0.000004;-0.946204;0.323572;; + 53; + 3;2,10,0;, + 3;2,8,10;, + 3;1,12,3;, + 3;1,11,12;, + 3;2,13,14;, + 3;3,16,5;, + 3;3,15,16;, + 3;6,9,4;, + 3;6,18,9;, + 3;8,22,10;, + 3;8,20,22;, + 3;11,24,12;, + 3;11,23,24;, + 3;13,26,14;, + 3;13,25,26;, + 3;15,28,16;, + 3;15,27,28;, + 3;17,29,30;, + 3;16,32,5;, + 3;16,31,32;, + 3;7,34,19;, + 3;7,33,34;, + 3;18,21,9;, + 3;18,35,21;, + 3;20,38,22;, + 3;20,36,38;, + 3;23,40,24;, + 3;23,39,40;, + 3;25,42,26;, + 3;25,41,42;, + 3;27,43,28;, + 3;29,44,30;, + 3;31,46,32;, + 3;31,45,46;, + 3;33,48,34;, + 3;33,47,48;, + 3;35,37,21;, + 3;35,49,37;, + 3;36,52,38;, + 3;36,50,52;, + 3;39,54,40;, + 3;39,53,54;, + 3;41,56,42;, + 3;41,55,56;, + 3;43,57,28;, + 3;29,58,44;, + 3;29,56,58;, + 3;45,60,46;, + 3;45,59,60;, + 3;47,62,48;, + 3;47,61,62;, + 3;49,51,37;, + 3;49,63,51;; + } + MeshTextureCoords { + 31; + 0.546412;0.933469;, + 0.511654;0.933469;, + 0.458180;0.933469;, + 0.526982;0.782985;, + 0.572075;0.782985;, + 0.559777;0.782985;, + 0.518783;0.782985;, + 0.477788;0.782985;, + 0.469589;0.782985;, + 0.554433;0.369152;, + 0.642665;0.369151;, + 0.618602;0.369152;, + 0.538391;0.369152;, + 0.458180;0.369152;, + 0.377969;0.369152;, + 0.353907;0.369152;, + 0.442138;0.369152;, + 0.666728;0.256288;, + 0.931421;0.256289;, + 0.859233;0.256288;, + 0.618602;0.256288;, + 0.137338;0.256288;, + 0.065150;0.256289;, + 0.329843;0.256288;, + 0.638654;0.068183;, + 0.859233;0.068183;, + 0.799074;0.068183;, + 0.598548;0.068183;, + 0.197495;0.068183;, + 0.137338;0.068183;, + 0.357917;0.068183;; + } + } + + Frame x3ds_xChest { + FrameTransformMatrix { + -1.000000, 0.000000, 0.000000, 0.000000, + -0.000000, -1.000000, 0.000000, 0.000000, + 0.000000, 0.000000, 1.000000, 0.000000, + 0.426950, -1.024468, 11.366159, 1.000000;; + } + Mesh xChest { + + 40; + -5.406384; -9.499996; -0.774913;, + -14.573050; -1.772723; -0.774910;, + -12.073050; 5.181822; -0.774907;, + -3.739717; 7.500004; -0.774907;, + 4.593616; 7.500004; -0.774907;, + 12.926949; 5.181822; -0.774910;, + 15.426949; -1.772723; -0.774914;, + 6.260283; -9.499996; -0.774913;, + -8.859015; -15.499998; 25.225092;, + -23.451246; -1.491749; 25.225090;, + -19.471548; 11.115673; 25.225096;, + -6.205883; 15.318148; 25.225096;, + 7.059781; 15.318148; 25.225096;, + 20.325445; 11.115673; 25.225096;, + 24.305143; -1.491749; 25.225090;, + 9.712914; -15.499998; 25.225092;, + -10.054240; -15.499997; 34.225082;, + -33.573051; -1.863631; 34.225082;, + -22.032743; 10.409095; 34.225082;, + -7.059614; 14.500003; 34.225082;, + 7.913515; 14.500003; 34.225082;, + 22.886644; 10.409095; 34.225082;, + 34.426949; -1.863631; 34.225082;, + 10.908140; -15.499997; 34.225082;, + -10.850827; -11.500252; 40.225082;, + -39.573051; -2.106037; 47.225090;, + -23.739717; 8.348755; 42.225098;, + -7.628605; 9.167019; 40.225098;, + 8.482507; 9.167019; 40.225098;, + 24.593618; 8.348755; 42.225090;, + 40.426949; -2.106037; 47.225090;, + 11.704728; -11.500252; 40.225082;, + -8.517495; -9.499994; 43.225082;, + -18.573050; -2.227266; 43.225090;, + -14.573050; 4.318189; 43.225098;, + -5.961939; 6.500007; 43.225098;, + 6.815839; 6.500007; 43.225090;, + 15.426950; 4.318189; 43.225090;, + 19.426950; -2.227266; 43.225090;, + 9.371394; -9.499994; 43.225082;; + + 70; + 3;0,9,1;, + 3;1,9,2;, + 3;0,8,9;, + 3;9,10,2;, + 3;2,11,3;, + 3;2,10,11;, + 3;3,12,4;, + 3;3,11,12;, + 3;4,13,5;, + 3;4,12,13;, + 3;5,14,6;, + 3;5,13,14;, + 3;6,15,7;, + 3;6,14,15;, + 3;7,8,0;, + 3;7,15,8;, + 3;8,17,9;, + 3;8,16,17;, + 3;9,18,10;, + 3;9,17,18;, + 3;10,19,11;, + 3;10,18,19;, + 3;11,20,12;, + 3;11,19,20;, + 3;12,21,13;, + 3;12,20,21;, + 3;13,22,14;, + 3;13,21,22;, + 3;14,23,15;, + 3;14,22,23;, + 3;15,16,8;, + 3;15,23,16;, + 3;16,25,17;, + 3;16,24,25;, + 3;17,26,18;, + 3;17,25,26;, + 3;18,27,19;, + 3;18,26,27;, + 3;19,28,20;, + 3;19,27,28;, + 3;20,29,21;, + 3;20,28,29;, + 3;21,30,22;, + 3;21,29,30;, + 3;22,31,23;, + 3;22,30,31;, + 3;23,24,16;, + 3;23,31,24;, + 3;24,33,25;, + 3;24,32,33;, + 3;25,34,26;, + 3;25,33,34;, + 3;26,35,27;, + 3;26,34,35;, + 3;27,36,28;, + 3;27,35,36;, + 3;28,37,29;, + 3;28,36,37;, + 3;29,38,30;, + 3;29,37,38;, + 3;30,39,31;, + 3;30,38,39;, + 3;31,32,24;, + 3;31,39,32;, + 3;37,39,38;, + 3;36,39,37;, + 3;36,32,39;, + 3;35,32,36;, + 3;35,33,32;, + 3;34,33,35;; + MeshMaterialList { + 2; + 70; + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_01BACK} + {x3ds_mat_01CHEST} + } + MeshNormals { + 88; + -0.650995;-0.723751;-0.228890;, + 0.000000;-0.974391;-0.224860;, + -0.630534;-0.747987;-0.207225;, + -0.894967;0.321720;-0.309080;, + -0.899082;0.303417;-0.315579;, + -0.272342;0.915691;-0.295533;, + -0.255614;0.918875;-0.300549;, + 0.000000;0.957642;-0.287961;, + 0.000000;0.957642;-0.287961;, + 0.272548;0.916640;-0.292383;, + 0.256974;0.923763;-0.283949;, + 0.899082;0.303417;-0.315579;, + 0.894967;0.321720;-0.309080;, + 0.649687;-0.721872;-0.238346;, + 0.623476;-0.739614;-0.253474;, + 0.000000;-0.974391;-0.224860;, + -0.592597;-0.735803;-0.327753;, + 0.000000;-0.993577;-0.113156;, + -0.627516;-0.684776;-0.370547;, + -0.846659;0.369049;-0.383368;, + -0.915063;0.288852;-0.281468;, + -0.288159;0.954384;-0.078204;, + -0.286130;0.941081;-0.180268;, + -0.000000;0.994932;-0.100550;, + 0.000000;0.994932;-0.100550;, + 0.288029;0.953917;-0.084156;, + 0.284948;0.937354;-0.200430;, + 0.805421;0.413325;-0.424806;, + 0.840105;0.278624;-0.465394;, + 0.612424;-0.738201;-0.282836;, + 0.664713;-0.722563;-0.189894;, + 0.000000;-0.993577;-0.113156;, + -0.405419;-0.910419;0.082297;, + 0.000000;-0.957096;0.289770;, + -0.528719;-0.784443;-0.324201;, + -0.656992;0.692463;-0.298087;, + -0.789210;0.537054;-0.297861;, + -0.169555;0.935537;0.309874;, + -0.269038;0.931504;0.244784;, + -0.000000;0.917665;0.397355;, + 0.000000;0.917665;0.397355;, + 0.167433;0.931814;0.322007;, + 0.275612;0.957904;0.080362;, + 0.660560;0.741019;-0.120626;, + 0.729124;0.541464;-0.418562;, + 0.446769;-0.890468;-0.086398;, + 0.573798;-0.817112;-0.055524;, + -0.000000;-0.957096;0.289770;, + -0.136334;-0.572759;0.808307;, + 0.000000;-0.832067;0.554676;, + -0.195803;-0.806978;0.557179;, + -0.175779;0.515191;0.838856;, + -0.544400;0.783128;0.300564;, + -0.005950;0.707002;0.707186;, + -0.061460;0.847479;0.527259;, + -0.000000;0.747432;0.664339;, + 0.000000;0.747432;0.664339;, + 0.013296;0.633065;0.773985;, + 0.045031;0.769592;0.636946;, + 0.179371;0.455292;0.872087;, + 0.488614;0.794147;0.361368;, + 0.133669;-0.718562;0.682496;, + 0.323520;-0.890918;0.318748;, + 0.000000;-0.832067;0.554676;, + -0.415209;-0.574084;0.705712;, + 0.000000;-0.832017;0.554750;, + 0.000000;-0.000000;1.000000;, + -0.125496;-0.398449;0.908565;, + 0.185278;-0.113227;0.976141;, + 0.000000;-0.000001;1.000000;, + 0.124763;0.127164;0.984004;, + -0.039366;0.155367;0.987072;, + 0.000000;-0.000001;1.000000;, + 0.001540;0.487185;0.873297;, + 0.000000;0.747367;0.664412;, + 0.000001;-0.000001;1.000000;, + 0.000000;0.747366;0.664413;, + 0.173828;0.686055;0.706479;, + -0.000000;-0.000000;1.000000;, + 0.042888;0.569361;0.820968;, + 0.085553;0.052282;0.994961;, + -0.000001;-0.000000;1.000000;, + -0.050303;0.118343;0.991698;, + -0.182465;0.252282;0.950295;, + -0.000001;-0.000000;1.000000;, + -0.044699;-0.323568;0.945148;, + 0.000000;-0.832017;0.554750;, + -0.000001;-0.000000;1.000000;; + 70; + 3;0,18,2;, + 3;3,19,4;, + 3;0,16,18;, + 3;19,20,4;, + 3;5,22,6;, + 3;5,21,22;, + 3;7,24,8;, + 3;7,23,24;, + 3;9,26,10;, + 3;9,25,26;, + 3;11,28,12;, + 3;11,27,28;, + 3;13,30,14;, + 3;13,29,30;, + 3;15,17,1;, + 3;15,31,17;, + 3;16,34,18;, + 3;16,32,34;, + 3;19,36,20;, + 3;19,35,36;, + 3;21,38,22;, + 3;21,37,38;, + 3;23,40,24;, + 3;23,39,40;, + 3;25,42,26;, + 3;25,41,42;, + 3;27,44,28;, + 3;27,43,44;, + 3;29,46,30;, + 3;29,45,46;, + 3;31,33,17;, + 3;31,47,33;, + 3;32,50,34;, + 3;32,48,50;, + 3;35,52,36;, + 3;35,51,52;, + 3;37,54,38;, + 3;37,53,54;, + 3;39,56,40;, + 3;39,55,56;, + 3;41,58,42;, + 3;41,57,58;, + 3;43,60,44;, + 3;43,59,60;, + 3;45,62,46;, + 3;45,61,62;, + 3;47,49,33;, + 3;47,63,49;, + 3;48,67,50;, + 3;48,64,67;, + 3;51,70,52;, + 3;51,68,70;, + 3;53,73,54;, + 3;53,71,73;, + 3;55,76,56;, + 3;55,74,76;, + 3;57,79,58;, + 3;57,77,79;, + 3;59,82,60;, + 3;59,80,82;, + 3;61,85,62;, + 3;61,83,85;, + 3;63,65,49;, + 3;63,86,65;, + 3;81,87,84;, + 3;78,87,81;, + 3;78,66,87;, + 3;75,66,78;, + 3;75,69,66;, + 3;72,69,75;; + } + MeshTextureCoords { + 40; + 0.427128;1.000148;, + 0.312615;1.000148;, + 0.343846;1.000148;, + 0.447949;1.000148;, + 0.552051;1.000148;, + 0.656154;1.000148;, + 0.687385;1.000148;, + 0.572872;1.000148;, + 0.383997;0.458321;, + 0.201706;0.458321;, + 0.251421;0.458321;, + 0.417140;0.458321;, + 0.582860;0.458321;, + 0.748579;0.458321;, + 0.798294;0.458321;, + 0.616003;0.458321;, + 0.369065;0.270766;, + 0.075261;0.270766;, + 0.219426;0.270766;, + 0.406475;0.270766;, + 0.593525;0.270766;, + 0.780574;0.270766;, + 0.924739;0.270766;, + 0.630935;0.270766;, + 0.359114;0.145729;, + 0.000307;-0.000148;, + 0.198102;0.104050;, + 0.399367;0.145729;, + 0.600633;0.145729;, + 0.801898;0.104050;, + 0.999693;-0.000148;, + 0.640886;0.145729;, + 0.388263;0.083210;, + 0.262646;0.083210;, + 0.312615;0.083210;, + 0.420188;0.083210;, + 0.579812;0.083210;, + 0.687385;0.083210;, + 0.737354;0.083210;, + 0.611737;0.083210;; + } + } + + Frame x3ds_xRU_Arm { + FrameTransformMatrix { + -0.965926, -0.000000, -0.258819, 0.000000, + 0.000000, -1.000000, -0.000000, 0.000000, + -0.258819, -0.000000, 0.965926, 0.000000, + -22.158115, 0.000006, 34.682274, 1.000000;; + } + Mesh xRU_Arm { + + 12; + -5.501477; 0.000004; -2.449525;, + -2.458304; 6.273185; -0.692550;, + 3.628045; 6.273181; 2.821392;, + 6.671256; -0.000001; 4.578400;, + 3.628039; -6.273170; 2.821389;, + -2.458306; -6.273180; -0.692544;, + 8.608694; 0.000001; -22.981846;, + 10.805939; 4.394533; -21.713266;, + 15.200456; 4.394531; -19.176115;, + 17.397690; -0.000002; -17.907520;, + 15.200446; -4.394547; -19.176085;, + 10.805936; -4.394485; -21.713276;; + + 20; + 3;7,0,1;, + 3;6,0,7;, + 3;8,1,2;, + 3;7,1,8;, + 3;9,2,3;, + 3;8,2,9;, + 3;10,3,4;, + 3;9,3,10;, + 3;11,4,5;, + 3;10,4,11;, + 3;6,5,0;, + 3;11,5,6;, + 3;0,2,1;, + 3;0,3,2;, + 3;0,4,3;, + 3;0,5,4;, + 3;7,8,9;, + 3;7,9,10;, + 3;7,10,11;, + 3;7,11,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHARM} + } + MeshNormals { + 36; + -0.716210;0.493166;-0.493793;, + -0.719557;-0.487560;-0.494492;, + -0.499999;-0.000001;0.866026;, + -0.718101;0.487469;-0.496693;, + 0.037713;0.997151;-0.065320;, + -0.499999;-0.000001;0.866026;, + 0.037713;0.997151;-0.065320;, + 0.785986;0.493148;0.372868;, + -0.499999;-0.000001;0.866026;, + 0.788019;0.487565;0.375908;, + 0.785740;-0.493168;0.373360;, + -0.500000;0.000001;0.866026;, + 0.789195;-0.487476;0.373548;, + 0.037714;-0.997151;-0.065321;, + -0.500000;-0.000001;0.866026;, + 0.037714;-0.997151;-0.065321;, + -0.715906;-0.493147;-0.494252;, + -0.499998;0.000002;0.866027;, + -0.714286;0.498840;-0.490870;, + -0.715906;-0.493147;-0.494252;, + 0.499999;0.000001;-0.866026;, + -0.716210;0.493166;-0.493793;, + 0.037713;0.997151;-0.065320;, + 0.499996;-0.000007;-0.866027;, + 0.037713;0.997151;-0.065320;, + 0.783919;0.498709;0.369811;, + 0.499996;-0.000007;-0.866027;, + 0.785986;0.493148;0.372868;, + 0.782250;-0.498838;0.373156;, + 0.499996;-0.000007;-0.866027;, + 0.785740;-0.493168;0.373360;, + 0.037701;-0.997152;-0.065325;, + 0.499999;-0.000002;-0.866026;, + 0.037714;-0.997151;-0.065321;, + -0.712222;-0.498712;-0.493989;, + 0.500003;0.000001;-0.866024;; + 20; + 3;21,0,3;, + 3;18,0,21;, + 3;24,4,6;, + 3;22,4,24;, + 3;27,7,9;, + 3;25,7,27;, + 3;30,10,12;, + 3;28,10,30;, + 3;33,13,15;, + 3;31,13,33;, + 3;19,16,1;, + 3;34,16,19;, + 3;2,8,5;, + 3;2,11,8;, + 3;2,14,11;, + 3;2,17,14;, + 3;23,26,29;, + 3;23,29,32;, + 3;23,32,35;, + 3;23,35,20;; + } + MeshTextureCoords { + 12; + 0.250000;-0.011257;, + 0.081267;-0.011257;, + 0.918734;-0.011257;, + 0.750000;-0.011257;, + 0.581266;-0.011257;, + 0.418733;-0.011257;, + 0.250000;1.011257;, + 0.083334;1.011257;, + 0.916666;1.011257;, + 0.750000;1.011257;, + 0.583334;1.011257;, + 0.416666;1.011257;; + } + } + + Frame x3ds_xRL_Arm { + FrameTransformMatrix { + 1.000000, -0.000000, -0.000000, 0.000000, + -0.000000, 1.000000, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + 13.822151, 0.000003, -20.565968, 1.000000;; + } + Mesh xRL_Arm { + + 24; + 8.013477; 0.000005; -35.874058;, + 12.494552; 9.237302; -33.286903;, + 21.456678; 9.237297; -28.112616;, + 25.937769; -0.000003; -25.525463;, + 21.456680; -9.237155; -28.112616;, + 12.494545; -9.237296; -33.286919;, + -4.837206; 0.000002; -3.067563;, + -2.639963; 4.394546; -1.798980;, + 1.754547; 4.394532; 0.738177;, + 3.951795; -0.000002; 2.006753;, + 1.754554; -4.394534; 0.738174;, + -2.639967; -4.394532; -1.798978;, + 5.120436; -0.663049; -1.830179;, + 10.395203; -0.663048; -7.844885;, + 9.816457; -0.663051; 4.948281;, + 5.120435; 0.336947; -1.830175;, + 10.395203; 0.336951; -7.844885;, + 9.816456; 0.336949; 4.948285;, + 15.652800; -0.663047; -15.309710;, + 20.927570; -0.663046; -21.324427;, + 20.348825; -0.663049; -8.531265;, + 15.652801; 0.336953; -15.309710;, + 20.927568; 0.336950; -21.324423;, + 20.348825; 0.336947; -8.531264;; + + 32; + 3;0,7,1;, + 3;0,6,7;, + 3;1,8,2;, + 3;1,7,8;, + 3;2,9,3;, + 3;2,8,9;, + 3;3,10,4;, + 3;3,9,10;, + 3;4,11,5;, + 3;4,10,11;, + 3;5,6,0;, + 3;5,11,6;, + 3;2,0,1;, + 3;3,0,2;, + 3;4,0,3;, + 3;5,0,4;, + 3;8,7,9;, + 3;9,7,10;, + 3;10,7,11;, + 3;11,7,6;, + 3;12,13,14;, + 3;13,17,14;, + 3;13,16,17;, + 3;14,15,12;, + 3;14,17,15;, + 3;16,15,17;, + 3;18,19,20;, + 3;19,23,20;, + 3;19,22,23;, + 3;20,21,18;, + 3;20,23,21;, + 3;22,21,23;; + MeshMaterialList { + 2; + 32; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHARM} + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 64; + -0.811971;0.490075;-0.317063;, + -0.814533;-0.484496;-0.319062;, + 0.500000;0.000000;-0.866025;, + -0.815268;0.484377;-0.317359;, + -0.068845;0.990475;0.119243;, + 0.500000;0.000000;-0.866025;, + -0.068845;0.990475;0.119243;, + 0.679969;0.490008;0.545467;, + 0.500000;0.000000;-0.866025;, + 0.683580;0.484497;0.545876;, + 0.680568;-0.490079;0.544656;, + 0.500000;0.000001;-0.866025;, + 0.682472;-0.484384;0.547362;, + -0.068833;-0.990476;0.119249;, + 0.500000;-0.000000;-0.866025;, + -0.068833;-0.990476;0.119249;, + -0.812373;-0.490007;-0.316139;, + 0.500001;0.000001;-0.866025;, + -0.808639;0.495752;-0.316753;, + -0.812373;-0.490007;-0.316139;, + -0.500002;0.000000;0.866024;, + -0.811971;0.490075;-0.317063;, + -0.068842;0.990475;0.119244;, + -0.499998;0.000000;0.866027;, + -0.068845;0.990475;0.119243;, + 0.676328;0.495497;0.545035;, + -0.499998;0.000000;0.866027;, + 0.679969;0.490008;0.545467;, + 0.678635;-0.495752;0.541927;, + -0.499998;0.000000;0.866027;, + 0.680568;-0.490079;0.544656;, + -0.068843;-0.990476;0.119239;, + -0.499999;-0.000001;0.866026;, + -0.068833;-0.990476;0.119249;, + -0.810178;-0.495497;-0.313201;, + -0.499996;0.000000;0.866028;, + -0.000000;-1.000000;-0.000000;, + -0.822008;-0.000003;0.569476;, + -0.000000;-1.000000;-0.000000;, + 0.998978;0.000001;0.045192;, + -0.000000;-1.000000;-0.000000;, + 0.998978;0.000001;0.045192;, + -0.822008;-0.000003;0.569476;, + -0.822008;-0.000003;0.569476;, + -0.000001;1.000000;0.000000;, + 0.998978;-0.000000;0.045193;, + -0.000001;1.000000;0.000000;, + 0.998978;0.000001;0.045192;, + -0.822008;-0.000003;0.569476;, + -0.000001;1.000000;0.000000;, + -0.000000;-1.000000;-0.000000;, + -0.822007;0.000001;0.569477;, + -0.000000;-1.000000;-0.000000;, + 0.998978;-0.000000;0.045192;, + -0.000000;-1.000000;-0.000000;, + 0.998978;-0.000000;0.045192;, + -0.822007;0.000001;0.569477;, + -0.822007;0.000001;0.569477;, + 0.000001;1.000000;0.000000;, + 0.998978;0.000002;0.045192;, + 0.000001;1.000000;0.000000;, + 0.998978;-0.000000;0.045192;, + -0.822007;-0.000001;0.569477;, + 0.000001;1.000000;0.000000;; + 32; + 3;0,21,3;, + 3;0,18,21;, + 3;4,24,6;, + 3;4,22,24;, + 3;7,27,9;, + 3;7,25,27;, + 3;10,30,12;, + 3;10,28,30;, + 3;13,33,15;, + 3;13,31,33;, + 3;16,19,1;, + 3;16,34,19;, + 3;8,2,5;, + 3;11,2,8;, + 3;14,2,11;, + 3;17,2,14;, + 3;26,23,29;, + 3;29,23,32;, + 3;32,23,35;, + 3;35,23,20;, + 3;36,38,40;, + 3;39,47,41;, + 3;39,45,47;, + 3;42,43,37;, + 3;42,48,43;, + 3;46,44,49;, + 3;50,52,54;, + 3;53,61,55;, + 3;53,59,61;, + 3;56,57,51;, + 3;56,62,57;, + 3;60,58,63;; + } + MeshTextureCoords { + 24; + 0.250000;2.476449;, + 0.081266;2.476449;, + 0.918734;2.476449;, + 0.750000;2.476449;, + 0.581266;2.476449;, + 0.418734;2.476449;, + 0.250000;1.042238;, + 0.083334;1.042238;, + 0.916666;1.042238;, + 0.750000;1.042238;, + 0.583334;1.042238;, + 0.416666;1.042238;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_xR_Hand { + FrameTransformMatrix { + -0.965926, 0.000000, -0.258819, 0.000000, + -0.258819, -0.000000, 0.965925, 0.000000, + 0.000000, 1.000000, 0.000000, 0.000000, + 17.201626, -0.532497, -26.974564, 1.000000;; + } + Mesh xR_Hand { + + 8; + -6.156250; -13.356396; -4.582500;, + 6.843750; -13.356392; -4.582499;, + 3.756248; -0.356396; -2.650548;, + -3.068748; -0.356396; -2.650548;, + -6.156250; -13.356396; 4.582500;, + 6.843750; -13.356392; 4.582499;, + 3.756248; -0.356396; 2.650487;, + -3.068748; -0.356396; 2.650487;; + + 10; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHHAND} + } + MeshNormals { + 20; + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;-0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.972937;0.231073;-0.000000;, + 0.000000;0.146997;-0.989137;, + -0.972937;0.231073;-0.000000;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;, + 0.000000;-1.000000;0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.147002;0.989136;, + 0.972937;0.231073;0.000000;, + 0.000000;0.147002;0.989136;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;; + 10; + 3;0,6,3;, + 3;0,8,6;, + 3;1,13,10;, + 3;1,4,13;, + 3;5,16,14;, + 3;5,7,16;, + 3;9,11,18;, + 3;9,2,11;, + 3;12,17,19;, + 3;12,15,17;; + } + MeshTextureCoords { + 8; + 0.032627;0.773816;, + 0.032627;0.773815;, + 0.231505;-0.195808;, + 0.231505;-0.195808;, + 0.976087;0.773816;, + 0.976087;0.773815;, + 0.777202;-0.195808;, + 0.777202;-0.195808;; + } + } + } + } + } + + Frame x3ds_xLU_Arm { + FrameTransformMatrix { + -0.965926, -0.000000, -0.258819, 0.000000, + 0.000000, -1.000000, -0.000000, 0.000000, + -0.258819, -0.000000, 0.965926, 0.000000, + 22.800379, 0.000008, 34.682274, 1.000000;; + } + Mesh xLU_Arm { + + 12; + 5.988962; 0.000003; 0.629320;, + 2.475010; 6.273185; 0.629320;, + -4.552896; 6.273124; 0.629312;, + -8.066902; 0.000002; 0.629321;, + -4.552895; -6.273167; 0.629311;, + 2.475007; -6.273119; 0.629326;, + 4.035431; 0.000003; -24.207542;, + 1.498257; 4.394476; -24.207481;, + -3.576344; 4.394535; -24.207447;, + -6.113496; 0.000003; -24.207460;, + -3.576342; -4.394542; -24.207460;, + 1.498262; -4.394542; -24.207493;; + + 20; + 3;0,7,1;, + 3;0,6,7;, + 3;1,8,2;, + 3;1,7,8;, + 3;2,9,3;, + 3;2,8,9;, + 3;3,10,4;, + 3;3,9,10;, + 3;4,11,5;, + 3;4,10,11;, + 3;5,6,0;, + 3;5,11,6;, + 3;2,0,1;, + 3;3,0,2;, + 3;4,0,3;, + 3;5,0,4;, + 3;8,7,9;, + 3;9,7,10;, + 3;10,7,11;, + 3;11,7,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHARM} + } + MeshNormals { + 36; + 0.867150;0.493170;-0.069530;, + 0.870399;-0.487563;-0.068461;, + -0.000001;-0.000001;1.000000;, + 0.870241;0.487469;-0.071097;, + -0.000009;0.997152;-0.075422;, + -0.000001;-0.000001;1.000000;, + -0.000009;0.997152;-0.075422;, + -0.867118;0.493150;-0.070072;, + -0.000001;-0.000001;1.000000;, + -0.870397;0.487569;-0.068456;, + -0.867151;-0.493168;-0.069524;, + 0.000000;0.000001;1.000000;, + -0.870238;-0.487476;-0.071089;, + 0.000007;-0.997152;-0.075422;, + 0.000000;-0.000001;1.000000;, + 0.000007;-0.997152;-0.075422;, + 0.867118;-0.493148;-0.070077;, + -0.000002;0.000002;1.000000;, + 0.864021;0.498848;-0.067959;, + 0.867118;-0.493148;-0.070077;, + -0.000022;0.000001;-1.000000;, + 0.867150;0.493170;-0.069530;, + 0.000011;0.997151;-0.075427;, + -0.000007;0.000007;-1.000000;, + -0.000009;0.997152;-0.075422;, + -0.863800;0.498709;-0.071685;, + -0.000007;0.000007;-1.000000;, + -0.867118;0.493150;-0.070072;, + -0.864027;-0.498838;-0.067955;, + -0.000007;0.000007;-1.000000;, + -0.867151;-0.493168;-0.069524;, + -0.000001;-0.997152;-0.075423;, + -0.000002;-0.000001;-1.000000;, + 0.000007;-0.997152;-0.075422;, + 0.863799;-0.498711;-0.071691;, + -0.000006;0.000001;-1.000000;; + 20; + 3;0,21,3;, + 3;0,18,21;, + 3;4,24,6;, + 3;4,22,24;, + 3;7,27,9;, + 3;7,25,27;, + 3;10,30,12;, + 3;10,28,30;, + 3;13,33,15;, + 3;13,31,33;, + 3;16,19,1;, + 3;16,34,19;, + 3;8,2,5;, + 3;11,2,8;, + 3;14,2,11;, + 3;17,2,14;, + 3;26,23,29;, + 3;29,23,32;, + 3;32,23,35;, + 3;35,23,20;; + } + MeshTextureCoords { + 12; + 0.250000;-0.011257;, + 0.081267;-0.011257;, + 0.918734;-0.011257;, + 0.750000;-0.011257;, + 0.581266;-0.011257;, + 0.418733;-0.011257;, + 0.250000;1.011257;, + 0.083334;1.011257;, + 0.916666;1.011257;, + 0.750000;1.011257;, + 0.583334;1.011257;, + 0.416666;1.011257;; + } + } + + Frame x3ds_xLL_Arm { + FrameTransformMatrix { + 1.000000, -0.000000, -0.000000, 0.000000, + -0.000000, 1.000000, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + -0.446584, 0.000005, -24.389263, 1.000000;; + } + Mesh xLL_Arm { + + 24; + 9.756407; 0.000006; -35.407063;, + 4.582108; 9.237305; -35.407040;, + -5.766471; 9.237184; -35.407040;, + -10.940788; 0.000005; -35.407043;, + -5.766469; -9.237268; -35.407063;, + 4.582115; -9.237293; -35.407051;, + 4.482169; 0.000002; -0.570457;, + 1.945006; 4.394486; -0.570453;, + -3.129325; 4.394474; -0.570462;, + -5.666486; 0.000001; -0.570473;, + -3.129334; -4.394471; -0.570465;, + 1.945009; -4.394471; -0.570457;, + -4.525237; -0.663046; -4.414725;, + -6.085963; -0.663051; -12.261003;, + -11.981339; -0.663046; -0.892426;, + -4.525237; 0.336950; -4.414725;, + -6.085961; 0.336952; -12.261005;, + -11.981338; 0.336954; -0.892433;, + -6.906761; -0.663049; -21.354527;, + -8.467486; -0.663040; -29.200804;, + -14.362860; -0.663049; -17.832241;, + -6.906761; 0.336958; -21.354527;, + -8.467486; 0.336956; -29.200804;, + -14.362861; 0.336954; -17.832237;; + + 32; + 3;7,0,1;, + 3;6,0,7;, + 3;8,1,2;, + 3;7,1,8;, + 3;9,2,3;, + 3;8,2,9;, + 3;10,3,4;, + 3;9,3,10;, + 3;11,4,5;, + 3;10,4,11;, + 3;6,5,0;, + 3;11,5,6;, + 3;0,2,1;, + 3;0,3,2;, + 3;0,4,3;, + 3;0,5,4;, + 3;7,8,9;, + 3;7,9,10;, + 3;7,10,11;, + 3;7,11,6;, + 3;13,12,14;, + 3;17,13,14;, + 3;16,13,17;, + 3;15,14,12;, + 3;17,14,15;, + 3;15,16,17;, + 3;19,18,20;, + 3;23,19,20;, + 3;22,19,23;, + 3;21,20,18;, + 3;23,20,21;, + 3;21,22,23;; + MeshMaterialList { + 2; + 32; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHARM} + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 64; + 0.861718;0.490078;0.131402;, + 0.864937;-0.484496;0.130951;, + -0.000000;0.000002;-1.000000;, + 0.864723;0.484376;0.132795;, + -0.000012;0.990475;0.137689;, + -0.000000;0.000002;-1.000000;, + -0.000012;0.990475;0.137689;, + -0.861601;0.490013;0.132404;, + -0.000000;0.000002;-1.000000;, + -0.864933;0.484503;0.130952;, + -0.861717;-0.490079;0.131403;, + -0.000001;0.000001;-1.000000;, + -0.864721;-0.484379;0.132795;, + -0.000003;-0.990475;0.137691;, + -0.000001;0.000002;-1.000000;, + -0.000003;-0.990475;0.137691;, + 0.861603;-0.490010;0.132403;, + 0.000001;-0.000002;-1.000000;, + 0.858676;0.495758;0.130003;, + 0.861603;-0.490010;0.132403;, + 0.000001;-0.000000;1.000000;, + 0.861718;0.490078;0.131402;, + -0.000003;0.990475;0.137691;, + -0.000002;-0.000002;1.000000;, + -0.000012;0.990475;0.137689;, + -0.858232;0.495502;0.133849;, + -0.000002;-0.000002;1.000000;, + -0.861601;0.490013;0.132404;, + -0.858676;-0.495757;0.130005;, + -0.000002;-0.000002;1.000000;, + -0.861717;-0.490079;0.131403;, + -0.000000;-0.990475;0.137691;, + -0.000003;0.000000;1.000000;, + -0.000003;-0.990475;0.137691;, + 0.858232;-0.495502;0.133850;, + -0.000002;-0.000000;1.000000;, + 0.000000;-1.000000;0.000001;, + 0.427141;0.000000;0.904185;, + 0.000000;-1.000000;0.000001;, + -0.887737;-0.000002;-0.460352;, + 0.000000;-1.000000;0.000001;, + -0.887737;-0.000002;-0.460352;, + 0.427141;0.000000;0.904185;, + 0.427141;0.000000;0.904185;, + 0.000001;1.000000;0.000000;, + -0.887737;-0.000000;-0.460352;, + 0.000001;1.000000;0.000000;, + -0.887737;-0.000002;-0.460352;, + 0.427141;0.000006;0.904185;, + 0.000001;1.000000;0.000000;, + -0.000001;-1.000000;-0.000001;, + 0.427140;-0.000000;0.904185;, + -0.000001;-1.000000;-0.000001;, + -0.887737;0.000001;-0.460352;, + -0.000001;-1.000000;-0.000001;, + -0.887737;0.000001;-0.460352;, + 0.427140;-0.000000;0.904185;, + 0.427140;-0.000000;0.904185;, + -0.000001;1.000000;-0.000000;, + -0.887737;0.000000;-0.460352;, + -0.000001;1.000000;-0.000000;, + -0.887737;0.000001;-0.460352;, + 0.427140;-0.000003;0.904185;, + -0.000001;1.000000;-0.000000;; + 32; + 3;21,0,3;, + 3;18,0,21;, + 3;24,4,6;, + 3;22,4,24;, + 3;27,7,9;, + 3;25,7,27;, + 3;30,10,12;, + 3;28,10,30;, + 3;33,13,15;, + 3;31,13,33;, + 3;19,16,1;, + 3;34,16,19;, + 3;2,8,5;, + 3;2,11,8;, + 3;2,14,11;, + 3;2,17,14;, + 3;23,26,29;, + 3;23,29,32;, + 3;23,32,35;, + 3;23,35,20;, + 3;38,36,40;, + 3;47,39,41;, + 3;45,39,47;, + 3;43,42,37;, + 3;48,42,43;, + 3;44,46,49;, + 3;52,50,54;, + 3;61,53,55;, + 3;59,53,61;, + 3;57,56,51;, + 3;62,56,57;, + 3;58,60,63;; + } + MeshTextureCoords { + 24; + 0.250000;2.476449;, + 0.081266;2.476449;, + 0.918734;2.476449;, + 0.750000;2.476449;, + 0.581266;2.476449;, + 0.418734;2.476449;, + 0.250000;1.042238;, + 0.083334;1.042238;, + 0.916666;1.042238;, + 0.750000;1.042238;, + 0.583334;1.042238;, + 0.416666;1.042238;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_xL_Hand { + FrameTransformMatrix { + -0.965926, 0.000000, -0.258819, 0.000000, + -0.258819, -0.000000, 0.965925, 0.000000, + 0.000000, 1.000000, 0.000000, 0.000000, + -1.719950, -0.532492, -32.044582, 1.000000;; + } + Mesh xL_Hand { + + 8; + -6.357616; -13.356400; -4.582500;, + 6.642384; -13.356396; -4.582499;, + 3.554882; -0.356400; -2.650548;, + -3.270115; -0.356400; -2.650548;, + -6.357616; -13.356400; 4.582500;, + 6.642384; -13.356396; 4.582499;, + 3.554882; -0.356399; 2.650487;, + -3.270115; -0.356399; 2.650487;; + + 10; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHHAND} + } + MeshNormals { + 20; + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;-0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.972937;0.231073;-0.000000;, + 0.000000;0.146997;-0.989137;, + -0.972937;0.231073;-0.000000;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;, + 0.000000;-1.000000;0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.147002;0.989136;, + 0.972937;0.231073;0.000000;, + 0.000000;0.147002;0.989136;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;; + 10; + 3;0,6,3;, + 3;0,8,6;, + 3;1,13,10;, + 3;1,4,13;, + 3;5,16,14;, + 3;5,7,16;, + 3;9,11,18;, + 3;9,2,11;, + 3;12,17,19;, + 3;12,15,17;; + } + MeshTextureCoords { + 8; + 0.032628;0.773816;, + 0.032628;0.773815;, + 0.231506;-0.195808;, + 0.231506;-0.195808;, + 0.976087;0.773816;, + 0.976087;0.773815;, + 0.777203;-0.195808;, + 0.777203;-0.195808;; + } + } + } + } + } + + Frame x3ds_xHead { + FrameTransformMatrix { + 0.996195, -0.087156, 0.000000, 0.000000, + -0.087156, -0.996195, -0.000000, 0.000000, + 0.000000, 0.000000, -1.000000, 0.000000, + 0.000000, 0.320932, 43.031708, 1.000000;; + } + Mesh xHead { + + 14; + 0.425325; 1.962787; -19.572998;, + 8.670237; -5.947898; -18.382002;, + 11.100914; 4.408364; -18.855011;, + 1.451953; 10.441894; -18.855013;, + -9.223644; 5.996317; -18.855013;, + -8.846230; -4.605626; -18.382004;, + -0.560038; -8.044583; -15.549453;, + 8.843442; -3.382582; -2.678222;, + 11.100921; 4.408369; -3.122056;, + 1.451952; 10.441850; -3.122057;, + -9.223644; 5.996321; -3.121079;, + -8.571328; -2.049199; -2.677742;, + -0.522815; -9.619122; -0.089201;, + 0.425325; -0.037214; 3.679871;; + + 24; + 3;0,2,1;, + 3;0,3,2;, + 3;0,4,3;, + 3;0,5,4;, + 3;0,6,5;, + 3;0,1,6;, + 3;1,8,7;, + 3;1,2,8;, + 3;2,9,8;, + 3;2,3,9;, + 3;3,10,9;, + 3;3,4,10;, + 3;4,11,10;, + 3;4,5,11;, + 3;5,12,11;, + 3;5,6,12;, + 3;6,7,12;, + 3;6,1,7;, + 3;13,11,12;, + 3;13,10,11;, + 3;13,9,10;, + 3;13,8,9;, + 3;13,7,8;, + 3;13,12,7;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01HEAD} + } + MeshNormals { + 60; + 0.081687;-0.064598;-0.994562;, + 0.049012;0.078380;-0.995718;, + -0.036962;0.088760;-0.995367;, + -0.093941;-0.047711;-0.994434;, + 0.153237;-0.381582;-0.911545;, + -0.201835;-0.348186;-0.915439;, + 0.081687;-0.064598;-0.994562;, + -0.201835;-0.348186;-0.915439;, + 0.967436;-0.252527;0.017281;, + 0.263240;-0.952568;0.152705;, + 0.081687;-0.064598;-0.994562;, + 0.049012;0.078380;-0.995718;, + 0.973545;-0.228497;-0.000000;, + 0.530181;0.847885;-0.000000;, + 0.049012;0.078380;-0.995718;, + -0.036962;0.088760;-0.995367;, + 0.530184;0.847883;0.000002;, + -0.384421;0.923158;0.000003;, + -0.036962;0.088760;-0.995367;, + -0.093941;-0.047711;-0.994434;, + -0.384425;0.923156;-0.000000;, + -0.998267;-0.057694;0.011560;, + -0.093941;-0.047711;-0.994434;, + 0.153237;-0.381582;-0.911545;, + -0.999136;-0.034537;0.023112;, + -0.542700;-0.839759;0.016782;, + 0.153237;-0.381582;-0.911545;, + -0.201835;-0.348186;-0.915439;, + -0.354072;-0.930491;-0.093913;, + 0.406709;-0.912942;0.033536;, + 0.960443;-0.276327;0.034547;, + 0.406709;-0.912942;0.033536;, + 0.568127;-0.118223;0.814405;, + 0.465161;-0.363520;0.807142;, + 0.967436;-0.252527;0.017281;, + 0.530181;0.847885;-0.000000;, + 0.310171;0.496038;0.811012;, + 0.568127;-0.118223;0.814405;, + 0.530181;0.847885;-0.000000;, + -0.384421;0.923158;0.000003;, + -0.227200;0.545780;0.806538;, + 0.310171;0.496038;0.811012;, + -0.384421;0.923158;0.000003;, + -0.996729;-0.080813;0.000000;, + -0.576846;-0.001758;0.816851;, + -0.227200;0.545780;0.806538;, + -0.998267;-0.057694;0.011560;, + -0.700901;-0.701945;0.126536;, + -0.514933;-0.269185;0.813870;, + -0.576846;-0.001758;0.816851;, + -0.542700;-0.839759;0.016782;, + 0.535392;-0.840126;-0.086851;, + -0.514933;-0.269185;0.813870;, + 0.465161;-0.363520;0.807142;, + -0.514933;-0.269185;0.813870;, + -0.576846;-0.001758;0.816851;, + -0.227200;0.545780;0.806538;, + 0.310171;0.496038;0.811012;, + 0.568127;-0.118223;0.814405;, + 0.465161;-0.363520;0.807142;; + 24; + 3;0,10,6;, + 3;1,14,11;, + 3;2,18,15;, + 3;3,22,19;, + 3;4,26,23;, + 3;5,7,27;, + 3;8,34,30;, + 3;8,12,34;, + 3;13,38,35;, + 3;13,16,38;, + 3;17,42,39;, + 3;17,20,42;, + 3;21,46,43;, + 3;21,24,46;, + 3;25,50,47;, + 3;25,28,50;, + 3;29,31,51;, + 3;29,9,31;, + 3;54,48,52;, + 3;55,44,49;, + 3;56,40,45;, + 3;57,36,41;, + 3;58,32,37;, + 3;59,53,33;; + } + MeshTextureCoords { + 14; + 0.023465;0.004861;, + 0.658502;0.065512;, + 0.821431;0.041424;, + 0.999136;0.041424;, + 0.180988;0.041424;, + 0.342098;0.065512;, + 0.493676;0.209760;, + 0.695904;0.865226;, + 0.821431;0.842624;, + 0.999136;0.842624;, + 0.180988;0.842657;, + 0.305883;0.865234;, + 0.497409;0.997055;, + 0.480761;1.188995;; + } + } + + Frame x3ds_xSpike01 { + FrameTransformMatrix { + 0.996195, -0.087156, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + -0.087156, -0.996195, -0.000000, 0.000000, + 23.054602, 0.275466, -15.502022, 1.000000;; + } + Mesh xSpike01 { + + 11; + 20.302296; 3.477874; -0.000000;, + 20.272556; 3.517951; -0.047165;, + 20.272556; 3.517951; 0.047166;, + 12.276608; -2.642800; 0.000000;, + 11.329418; -1.366189; -1.502582;, + 11.329418; -1.366188; 1.502582;, + -22.691582; -3.647179; -0.000001;, + -22.691582; -0.615793; -2.957998;, + -22.691582; -0.615791; 2.957999;, + 20.282467; 3.504585; 0.000000;, + -22.691582; -1.626259; 0.000000;; + + 18; + 3;0,9,1;, + 3;1,9,2;, + 3;2,9,0;, + 3;0,4,3;, + 3;0,1,4;, + 3;1,5,4;, + 3;1,2,5;, + 3;2,3,5;, + 3;2,0,3;, + 3;3,7,6;, + 3;3,4,7;, + 3;4,8,7;, + 3;4,5,8;, + 3;5,6,8;, + 3;5,3,6;, + 3;6,7,10;, + 3;7,8,10;, + 3;8,6,10;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 26; + -0.802935;-0.596066;-0.000210;, + -0.416581;0.546239;0.726693;, + -0.416545;0.546192;-0.726749;, + -0.802935;-0.596066;-0.000210;, + -0.416558;0.546177;0.726753;, + 0.479311;-0.877645;0.000000;, + -0.803289;-0.595589;0.000000;, + 0.479311;-0.877645;0.000000;, + -0.416582;0.546239;-0.726693;, + -0.152721;0.683170;0.714112;, + -0.224967;0.667993;-0.709348;, + -0.219854;0.670684;0.708411;, + 0.236642;-0.971597;0.000000;, + 0.236642;-0.971597;0.000000;, + -0.154600;0.681720;-0.715092;, + -0.020056;0.698250;0.715573;, + -0.018467;0.727343;-0.686026;, + 1.000000;0.000000;0.000000;, + -0.015613;0.729119;0.684209;, + -0.022052;-0.999757;0.000000;, + 1.000000;0.000000;0.000000;, + -0.022052;-0.999757;0.000000;, + -0.015212;0.698309;-0.715635;, + 1.000000;0.000000;0.000000;, + -0.802935;-0.596066;-0.000210;, + 1.000000;0.000000;0.000000;; + 18; + 3;0,24,3;, + 3;3,24,6;, + 3;6,24,0;, + 3;1,11,9;, + 3;1,4,11;, + 3;5,13,12;, + 3;5,7,13;, + 3;8,10,14;, + 3;8,2,10;, + 3;9,18,15;, + 3;9,11,18;, + 3;12,21,19;, + 3;12,13,21;, + 3;14,16,22;, + 3;14,10,16;, + 3;17,20,25;, + 3;20,23,25;, + 3;23,17,25;; + } + } + } + + Frame x3ds_Spike02 { + FrameTransformMatrix { + 0.996195, -0.087156, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + -0.087156, -0.996195, -0.000000, 0.000000, + -22.163496, 4.231537, -15.502023, 1.000000;; + } + Mesh Spike02 { + + 11; + -20.302298; 3.477874; -0.000000;, + -20.272558; 3.517951; -0.047165;, + -20.272558; 3.517951; 0.047166;, + -12.276606; -2.642800; 0.000000;, + -11.329420; -1.366189; -1.502582;, + -11.329420; -1.366188; 1.502582;, + 22.691582; -3.647179; -0.000001;, + 22.691582; -0.615793; -2.957998;, + 22.691582; -0.615791; 2.957999;, + -20.282469; 3.504585; 0.000000;, + 22.691582; -1.626259; 0.000000;; + + 18; + 3;9,0,1;, + 3;9,1,2;, + 3;9,2,0;, + 3;4,0,3;, + 3;1,0,4;, + 3;5,1,4;, + 3;2,1,5;, + 3;3,2,5;, + 3;0,2,3;, + 3;7,3,6;, + 3;4,3,7;, + 3;8,4,7;, + 3;5,4,8;, + 3;6,5,8;, + 3;3,5,6;, + 3;7,6,10;, + 3;8,7,10;, + 3;6,8,10;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 26; + 0.802935;-0.596066;-0.000210;, + 0.416581;0.546239;0.726693;, + 0.416545;0.546192;-0.726749;, + 0.802935;-0.596066;-0.000210;, + 0.416558;0.546177;0.726753;, + -0.479311;-0.877645;0.000000;, + 0.803289;-0.595589;-0.000000;, + -0.479311;-0.877645;0.000000;, + 0.416582;0.546239;-0.726693;, + 0.152721;0.683170;0.714111;, + 0.224967;0.667994;-0.709348;, + 0.219854;0.670684;0.708411;, + -0.236642;-0.971597;0.000000;, + -0.236642;-0.971597;0.000000;, + 0.154600;0.681720;-0.715092;, + 0.020056;0.698250;0.715573;, + 0.018467;0.727343;-0.686026;, + -1.000000;0.000000;0.000000;, + 0.015613;0.729119;0.684209;, + 0.022052;-0.999757;0.000000;, + -1.000000;0.000000;0.000000;, + 0.022052;-0.999757;0.000000;, + 0.015212;0.698309;-0.715635;, + -1.000000;0.000000;0.000000;, + 0.802935;-0.596066;-0.000210;, + -1.000000;0.000000;0.000000;; + 18; + 3;24,0,3;, + 3;24,3,6;, + 3;24,6,0;, + 3;11,1,9;, + 3;4,1,11;, + 3;13,5,12;, + 3;7,5,13;, + 3;10,8,14;, + 3;2,8,10;, + 3;18,9,15;, + 3;11,9,18;, + 3;21,12,19;, + 3;13,12,21;, + 3;16,14,22;, + 3;10,14,16;, + 3;20,17,25;, + 3;23,20,25;, + 3;17,23,25;; + } + } + } + } + } + + Frame x3ds_xRU_Leg { + FrameTransformMatrix { + -0.996195, 0.000000, -0.087156, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + 0.087156, -0.000000, -0.996195, 0.000000, + 6.849589, 0.163909, 2.374461, 1.000000;; + } + Mesh xRU_Leg { + + 8; + -11.013890; -7.083223; -1.154131;, + 3.719292; -7.083223; -1.154224;, + 3.719293; 7.083232; -1.154223;, + -11.013890; 7.083232; -1.154134;, + -10.314070; -5.595806; 40.157955;, + 3.019466; -5.595746; 40.157955;, + 3.019406; 5.595754; 40.157948;, + -10.314070; 5.595694; 40.157944;; + + 12; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHLEG} + } + MeshNormals { + 24; + -0.000006;0.000000;-1.000000;, + 0.000005;-0.999352;0.035981;, + -0.999857;0.000000;0.016937;, + -0.000006;0.000000;-1.000000;, + 0.000000;-0.999352;0.035982;, + 0.999857;0.000005;0.016937;, + -0.000006;0.000000;-1.000000;, + 0.999857;-0.000000;0.016939;, + -0.000005;0.999352;0.035982;, + -0.000006;-0.000000;-1.000000;, + 0.000000;0.999352;0.035984;, + -0.999857;0.000000;0.016937;, + 0.000005;-0.999352;0.035981;, + -0.999857;0.000000;0.016937;, + -0.000000;0.000001;1.000000;, + 0.000005;-0.999352;0.035981;, + 0.999857;0.000005;0.016937;, + -0.000000;0.000001;1.000000;, + 0.999857;0.000005;0.016937;, + -0.000005;0.999352;0.035982;, + -0.000000;0.000001;1.000000;, + -0.000005;0.999352;0.035982;, + -0.999857;0.000000;0.016937;, + -0.000000;0.000001;1.000000;; + 12; + 3;0,6,3;, + 3;0,9,6;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,20,23;, + 3;14,17,20;; + } + MeshTextureCoords { + 8; + 0.384951;0.041750;, + 0.616604;0.041750;, + 0.856692;0.041750;, + 0.141781;0.041750;, + 0.384951;0.914882;, + 0.616604;0.914882;, + 0.856692;0.914882;, + 0.141781;0.914882;; + } + } + + Frame x3ds_xRL_Leg { + FrameTransformMatrix { + 0.996195, -0.000000, -0.087156, 0.000000, + -0.087156, -0.000000, -0.996195, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + -3.359494, 0.259708, 38.976967, 1.000000;; + } + Mesh xRL_Leg { + + 26; + 9.229027; -71.518196; -17.699999;, + -10.562513; -71.518204; -17.699999;, + -8.726734; 0.601814; -5.908439;, + 7.393265; 0.601810; -5.908437;, + 11.931103; -75.798187; 11.700004;, + -13.264593; -75.798187; 11.699999;, + -8.726734; 0.601814; 5.908560;, + 7.393263; 0.601810; 5.908562;, + -9.401619; -8.003811; 0.055164;, + -9.401621; -19.983799; 0.055164;, + -21.381618; -5.008812; 0.055162;, + -9.401619; -8.003811; 1.552658;, + -9.401621; -19.983799; 1.552658;, + -21.381618; -5.008812; 1.552657;, + -9.406624; -28.501522; 0.062683;, + -9.406624; -40.501522; 0.062684;, + -21.406624; -25.501520; 0.062688;, + -9.406624; -28.501522; 1.562678;, + -9.406624; -40.501522; 1.562678;, + -21.406624; -25.501520; 1.562676;, + -9.411629; -50.486736; 0.070203;, + -9.411633; -62.506737; 0.070203;, + -21.431629; -47.481735; 0.070202;, + -9.411629; -50.486736; 1.572698;, + -9.411633; -62.506737; 1.572698;, + -21.431629; -47.481735; 1.572697;; + + 30; + 3;2,0,1;, + 3;3,0,2;, + 3;5,0,4;, + 3;1,0,5;, + 3;6,1,5;, + 3;2,1,6;, + 3;7,2,6;, + 3;3,2,7;, + 3;4,3,7;, + 3;0,3,4;, + 3;6,4,7;, + 3;5,4,6;, + 3;8,9,10;, + 3;9,13,10;, + 3;9,12,13;, + 3;10,11,8;, + 3;10,13,11;, + 3;12,11,13;, + 3;14,15,16;, + 3;15,19,16;, + 3;15,18,19;, + 3;16,17,14;, + 3;16,19,17;, + 3;18,17,19;, + 3;20,21,22;, + 3;21,25,22;, + 3;21,24,25;, + 3;22,23,20;, + 3;22,25,23;, + 3;24,23,25;; + MeshMaterialList { + 2; + 30; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHLEG} + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 66; + -0.000000;0.161357;-0.986896;, + 0.000000;-0.989569;-0.144059;, + 0.995537;0.039363;-0.085767;, + -0.000000;0.161357;-0.986896;, + 0.000000;-0.989569;-0.144059;, + -0.998354;0.039138;-0.041929;, + -0.000000;0.161357;-0.986896;, + -0.999676;0.025446;0.000000;, + 0.000000;1.000000;0.000000;, + 0.000000;0.161357;-0.986896;, + 0.000000;1.000000;0.000000;, + 0.997858;0.049375;-0.042925;, + 0.000000;-0.989569;-0.144059;, + 0.997858;0.049375;-0.042925;, + -0.000000;0.075587;0.997139;, + 0.000000;-0.989569;-0.144059;, + -0.995087;0.052754;-0.083776;, + -0.000000;0.075587;0.997139;, + -0.998354;0.039138;-0.041929;, + 0.000000;1.000000;0.000000;, + -0.000000;0.075587;0.997139;, + 0.000000;1.000000;0.000000;, + 0.998241;0.059291;0.000000;, + -0.000000;0.075587;0.997139;, + 0.000000;0.000000;-1.000000;, + 0.242536;0.970143;-0.000000;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970143;-0.000000;, + 0.242536;0.970143;-0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970143;0.000000;, + -0.000000;0.000000;1.000000;, + -0.000000;-0.000000;-1.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;-0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + -0.000000;-0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970142;0.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;, + -0.780869;-0.624695;0.000000;, + -0.000000;-0.000000;1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + 0.242536;0.970142;0.000000;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000001;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000001;, + 0.242536;0.970142;0.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;-0.000001;, + 0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;; + 30; + 3;6,0,3;, + 3;9,0,6;, + 3;15,1,12;, + 3;4,1,15;, + 3;18,5,16;, + 3;7,5,18;, + 3;21,8,19;, + 3;10,8,21;, + 3;13,11,22;, + 3;2,11,13;, + 3;20,14,23;, + 3;17,14,20;, + 3;24,26,28;, + 3;27,35,29;, + 3;27,33,35;, + 3;30,31,25;, + 3;30,36,31;, + 3;34,32,37;, + 3;38,40,42;, + 3;41,49,43;, + 3;41,47,49;, + 3;44,45,39;, + 3;44,50,45;, + 3;48,46,51;, + 3;52,54,56;, + 3;55,63,57;, + 3;55,61,63;, + 3;58,59,53;, + 3;58,64,59;, + 3;62,60,65;; + } + MeshTextureCoords { + 26; + 0.424682;0.899973;, + 0.582679;0.899974;, + 0.647431;0.013392;, + 0.363113;0.013392;, + 0.131246;0.952588;, + 0.861902;0.952588;, + 0.838511;0.013392;, + 0.151531;0.013392;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_xR_Foot { + FrameTransformMatrix { + -0.000000, 0.000000, 1.000000, 0.000000, + -0.000000, 1.000000, -0.000000, 0.000000, + -1.000000, -0.000000, -0.000000, 0.000000, + -0.849463, -62.299637, -2.502151, 1.000000;; + } + Mesh xR_Foot { + + 8; + -37.191723; -17.003931; 4.286171;, + 7.580331; -17.003948; 6.445354;, + 5.179023; -0.329530; 4.340307;, + -27.147438; -7.877935; 1.341817;, + -37.191738; -17.003931; -4.286145;, + 7.580253; -17.003933; -6.445303;, + 5.179095; -0.329522; -4.340269;, + -27.147472; -7.877943; -1.341796;; + + 10; + 3;2,0,1;, + 3;3,0,2;, + 3;5,0,4;, + 3;1,0,5;, + 3;7,2,6;, + 3;3,2,7;, + 3;4,3,7;, + 3;0,3,4;, + 3;6,4,7;, + 3;5,4,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 20; + -0.123025;0.309552;0.942890;, + -0.000000;-1.000000;0.000000;, + -0.672464;0.740130;0.000001;, + -0.047832;0.118323;0.991822;, + -0.000000;-1.000000;-0.000001;, + -0.123025;0.309552;0.942890;, + -0.227388;0.973804;-0.000001;, + -0.192728;0.486970;0.851890;, + -0.227389;0.973804;0.000000;, + -0.672466;0.740128;0.000006;, + -0.000000;-1.000000;0.000000;, + -0.672466;0.740128;0.000006;, + -0.123024;0.309551;-0.942891;, + -0.000000;-1.000000;0.000000;, + -0.047831;0.118323;-0.991822;, + -0.227388;0.973804;-0.000001;, + -0.123024;0.309551;-0.942891;, + -0.227388;0.973804;-0.000001;, + -0.672466;0.740128;0.000006;, + -0.192727;0.486968;-0.851891;; + 10; + 3;5,0,3;, + 3;7,0,5;, + 3;13,1,10;, + 3;4,1,13;, + 3;17,6,15;, + 3;8,6,17;, + 3;11,9,18;, + 3;2,9,11;, + 3;16,12,19;, + 3;14,12,16;; + } + } + } + } + } + + Frame x3ds_xLU_Leg { + FrameTransformMatrix { + -0.996195, 0.000000, 0.087156, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + -0.087156, -0.000000, -0.996195, 0.000000, + -5.995696, 0.163911, 2.695590, 1.000000;; + } + Mesh xLU_Leg { + + 8; + -2.905127; -7.083223; -0.791073;, + 11.828092; -7.083163; -0.790935;, + 11.828092; 7.083232; -0.790933;, + -2.905124; 7.083232; -0.791067;, + -2.205291; -5.595747; 40.521160;, + 11.128267; -5.595746; 40.521164;, + 11.128268; 5.595754; 40.521152;, + -2.205273; 5.595753; 40.521152;; + + 12; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHLEG} + } + MeshNormals { + 24; + 0.000009;0.000000;-1.000000;, + 0.000000;-0.999352;0.035982;, + -0.999857;0.000000;0.016938;, + 0.000009;0.000000;-1.000000;, + 0.000004;-0.999352;0.035981;, + 0.999857;-0.000000;0.016938;, + 0.000009;0.000000;-1.000000;, + 0.999857;-0.000000;0.016937;, + -0.000000;0.999352;0.035983;, + 0.000009;0.000000;-1.000000;, + -0.000000;0.999352;0.035982;, + -0.999857;0.000002;0.016938;, + 0.000000;-0.999352;0.035982;, + -0.999857;0.000002;0.016938;, + -0.000000;0.000001;1.000000;, + 0.000000;-0.999352;0.035982;, + 0.999857;-0.000000;0.016938;, + -0.000000;0.000001;1.000000;, + 0.999857;-0.000000;0.016938;, + -0.000000;0.999352;0.035983;, + -0.000000;0.000001;1.000000;, + -0.000000;0.999352;0.035983;, + -0.999857;0.000002;0.016938;, + -0.000000;0.000001;1.000000;; + 12; + 3;0,6,3;, + 3;0,9,6;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,20,23;, + 3;14,17,20;; + } + MeshTextureCoords { + 8; + 0.384951;0.041750;, + 0.616604;0.041750;, + 0.856692;0.041750;, + 0.141781;0.041750;, + 0.384951;0.914882;, + 0.616604;0.914882;, + 0.856692;0.914882;, + 0.141781;0.914882;; + } + } + + Frame x3ds_xLL_Leg { + FrameTransformMatrix { + 0.996195, 0.000000, 0.087156, 0.000000, + 0.087156, -0.000000, -0.996195, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + 3.943336, 0.259716, 39.672768, 1.000000;; + } + Mesh xLL_Leg { + + 26; + -9.017391; -71.197044; -17.699999;, + 10.774149; -71.197052; -17.699999;, + 8.938375; 0.922958; -5.908498;, + -7.181622; 0.922955; -5.908498;, + -11.719472; -75.477051; 11.700000;, + 13.476221; -75.477051; 11.700000;, + 8.938375; 0.922958; 5.908501;, + -7.181622; 0.922955; 5.908501;, + 9.618265; -7.680378; 0.062687;, + 9.618269; -19.680382; 0.062687;, + 21.618265; -4.680378; 0.062687;, + 9.618265; -7.680378; 1.562681;, + 9.618269; -19.680382; 1.562681;, + 21.618265; -4.680378; 1.562681;, + 9.618265; -28.180374; 0.062689;, + 9.618265; -40.180374; 0.062689;, + 21.618265; -25.180378; 0.062694;, + 9.618265; -28.180374; 1.562683;, + 9.618265; -40.180374; 1.562683;, + 21.618265; -25.180378; 1.562684;, + 9.618269; -50.180374; 0.062691;, + 9.618265; -62.180374; 0.062691;, + 21.618269; -47.180374; 0.062691;, + 9.618269; -50.180374; 1.562685;, + 9.618265; -62.180374; 1.562685;, + 21.618269; -47.180374; 1.562685;; + + 30; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;, + 3;9,8,10;, + 3;13,9,10;, + 3;12,9,13;, + 3;11,10,8;, + 3;13,10,11;, + 3;11,12,13;, + 3;15,14,16;, + 3;19,15,16;, + 3;18,15,19;, + 3;17,16,14;, + 3;19,16,17;, + 3;17,18,19;, + 3;21,20,22;, + 3;25,21,22;, + 3;24,21,25;, + 3;23,22,20;, + 3;25,22,23;, + 3;23,24,25;; + MeshMaterialList { + 2; + 30; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHLEG} + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 66; + 0.000000;0.161356;-0.986896;, + -0.000000;-0.989569;-0.144060;, + -0.995537;0.039364;-0.085767;, + 0.000000;0.161356;-0.986896;, + -0.000000;-0.989569;-0.144060;, + 0.998354;0.039138;-0.041929;, + 0.000000;0.161356;-0.986896;, + 0.999676;0.025446;0.000000;, + -0.000000;1.000000;0.000000;, + -0.000000;0.161356;-0.986896;, + -0.000000;1.000000;0.000000;, + -0.997857;0.049375;-0.042925;, + -0.000000;-0.989569;-0.144060;, + -0.997857;0.049375;-0.042925;, + -0.000000;0.075588;0.997139;, + -0.000000;-0.989569;-0.144060;, + 0.995087;0.052753;-0.083776;, + 0.000000;0.075588;0.997139;, + 0.998354;0.039138;-0.041929;, + -0.000000;1.000000;0.000000;, + -0.000000;0.075588;0.997139;, + -0.000000;1.000000;0.000000;, + -0.998241;0.059291;0.000000;, + -0.000000;0.075588;0.997139;, + 0.000000;0.000000;-1.000000;, + -0.242536;0.970142;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + -0.242535;0.970143;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242535;0.970143;0.000000;, + -0.242535;0.970143;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242535;0.970143;0.000000;, + -0.000000;0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + -0.242536;0.970142;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.000000;-0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;; + 30; + 3;0,6,3;, + 3;0,9,6;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,20,23;, + 3;14,17,20;, + 3;26,24,28;, + 3;35,27,29;, + 3;33,27,35;, + 3;31,30,25;, + 3;36,30,31;, + 3;32,34,37;, + 3;40,38,42;, + 3;49,41,43;, + 3;47,41,49;, + 3;45,44,39;, + 3;50,44,45;, + 3;46,48,51;, + 3;54,52,56;, + 3;63,55,57;, + 3;61,55,63;, + 3;59,58,53;, + 3;64,58,59;, + 3;60,62,65;; + } + MeshTextureCoords { + 26; + 0.424682;0.899973;, + 0.582679;0.899974;, + 0.647431;0.013392;, + 0.363113;0.013392;, + 0.131246;0.952588;, + 0.861902;0.952588;, + 0.838511;0.013392;, + 0.151531;0.013392;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_xL_Foot { + FrameTransformMatrix { + -0.000000, 0.000000, 1.000000, 0.000000, + -0.000000, 1.000000, -0.000000, 0.000000, + -1.000000, -0.000000, -0.000000, 0.000000, + 1.061086, -63.263023, -2.697744, 1.000000;; + } + Mesh xL_Foot { + + 8; + -36.996124; -15.719404; -4.210043;, + 7.775687; -15.719419; -6.330903;, + 5.374388; 0.954521; -4.263234;, + -26.951843; -6.593406; -1.317977;, + -36.995773; -15.719404; 4.210084;, + 7.775620; -15.719404; 6.330931;, + 5.374463; 0.954529; 4.263263;, + -26.951632; -6.593413; 1.317985;; + + 10; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 20; + -0.121241;0.305074;-0.944580;, + 0.000000;-1.000000;0.000000;, + -0.672469;0.740125;0.000028;, + -0.046996;0.116259;-0.992106;, + -0.000000;-1.000000;0.000001;, + -0.121241;0.305074;-0.944580;, + -0.227378;0.973807;0.000001;, + -0.190220;0.480642;-0.856037;, + -0.227375;0.973807;0.000021;, + -0.672460;0.740133;0.000056;, + 0.000000;-1.000000;0.000000;, + -0.672460;0.740133;0.000056;, + -0.121242;0.305075;0.944579;, + 0.000000;-1.000000;0.000000;, + -0.046997;0.116259;0.992106;, + -0.227378;0.973807;0.000001;, + -0.121242;0.305075;0.944579;, + -0.227378;0.973807;0.000001;, + -0.672460;0.740133;0.000056;, + -0.190222;0.480644;0.856035;; + 10; + 3;0,5,3;, + 3;0,7,5;, + 3;1,13,10;, + 3;1,4,13;, + 3;6,17,15;, + 3;6,8,17;, + 3;9,11,18;, + 3;9,2,11;, + 3;12,16,19;, + 3;12,14,16;; + } + } + } + } + } +} +AnimationSet x3ds_animset_0 { + Animation x3ds_anim_0 { + {x3ds_xGroin} + AnimationKey { + 0; + 9; + 0; 4; -0.000000, -0.000000, -0.707107, -0.707107;;, + 77; 4; -0.000000, -0.000000, -0.707107, -0.707107;;, + 85; 4; -0.000000, -0.000000, -0.675590, -0.737277;;, + 93; 4; -0.000000, -0.000000, -0.707107, -0.707107;;, + 115; 4; 0.000000, -0.000000, 0.000000, -1.000000;;, + 135; 4; 0.000000, -0.000000, 0.000000, -1.000000;;, + 160; 4; -0.000000, -0.000000, -0.707107, -0.707107;;, + 161; 4; -0.000000, -0.000000, -0.707107, -0.707107;;, + 216; 4; -0.000000, -0.000000, -0.707107, -0.707107;;; + } + AnimationKey { + 1; + 5; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 93; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 29; + 0; 3; 0.000000, 35.534382, 1.024473;;, + 1; 3; 0.000000, 23.889210, 1.024473;;, + 15; 3; 0.000000, 18.884680, 2.903347;;, + 30; 3; 0.000000, 23.889210, 1.024473;;, + 33; 3; 0.000000, 23.889210, 1.024473;;, + 43; 3; 0.000000, 20.962900, 1.024473;;, + 52; 3; 0.000000, 25.059750, 1.024473;;, + 61; 3; 0.000000, 23.518040, 5.044694;;, + 68; 3; 0.000000, 18.818790, 12.939010;;, + 76; 3; 0.000000, 23.518040, 5.044694;;, + 77; 3; 0.000000, 23.518040, 5.044694;;, + 93; 3; 0.000000, 23.518040, 5.044694;;, + 100; 3; 0.000000, 29.812460, 75.539871;;, + 104; 3; 0.000000, 19.677170, 97.369331;;, + 115; 3; 0.000000, -67.336800, 139.859100;;, + 135; 3; 0.000000, -67.336998, 139.859100;;, + 145; 3; 0.000000, -13.702706, 104.629173;;, + 146; 3; 0.000000, -12.018229, 99.536301;;, + 160; 3; 0.000000, 23.518040, 5.044694;;, + 161; 3; 0.000000, 23.518040, 5.044694;;, + 175; 3; 0.000000, 33.713287, -37.066116;;, + 178; 3; 0.000000, 24.016308, -39.583458;;, + 181; 3; 0.000000, 33.713287, -37.066116;;, + 184; 3; 0.000000, 24.016308, -39.583458;;, + 187; 3; 0.000000, 33.713287, -37.066116;;, + 190; 3; 0.000000, 24.016308, -39.583458;;, + 193; 3; 0.000000, 33.713287, -37.066116;;, + 207; 3; 0.000000, 33.713287, -37.066116;;, + 216; 3; 0.000000, 23.518040, 5.044694;;; + } + } + + Animation x3ds_anim_1 { + {x3ds_xChest} + AnimationKey { + 0; + 23; + 0; 4; 0.000000, -0.000000, -0.000000, -1.000000;;, + 1; 4; 0.258819, 0.000000, -0.000000, -0.965926;;, + 15; 4; 0.317305, 0.000000, -0.000000, -0.948324;;, + 30; 4; 0.258819, 0.000000, -0.000000, -0.965926;;, + 31; 4; 0.258819, 0.000000, -0.000000, -0.965926;;, + 43; 4; -0.095846, -0.000000, -0.000000, -0.995396;;, + 52; 4; 0.442381, 0.058240, 0.116812, -0.887278;;, + 61; 4; 0.258819, -0.000000, -0.000000, -0.965926;;, + 68; 4; 0.332019, -0.072538, -0.264839, -0.902420;;, + 76; 4; 0.258819, -0.000000, -0.000001, -0.965926;;, + 77; 4; 0.258819, -0.000000, -0.000001, -0.965926;;, + 85; 4; 0.535255, 0.003802, -0.087074, -0.840182;;, + 93; 4; 0.258819, -0.000000, -0.000001, -0.965926;;, + 95; 4; 0.221903, -0.017679, -0.071612, -0.972275;;, + 102; 4; 0.122182, -0.024167, -0.140528, -0.982212;;, + 115; 4; -0.000001, 0.000000, -0.000000, -1.000000;;, + 135; 4; -0.000001, -0.000000, 0.529919, -0.848048;;, + 139; 4; 0.030693, 0.002685, 0.581681, -0.812834;;, + 160; 4; 0.258820, -0.000000, -0.000000, -0.965926;;, + 161; 4; 0.258820, -0.000000, -0.000001, -0.965926;;, + 175; 4; -0.017452, -0.000000, -0.000000, -0.999848;;, + 207; 4; -0.017452, -0.000000, -0.000000, -0.999848;;, + 216; 4; 0.258820, -0.000000, -0.000001, -0.965926;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 0.426950, -1.024470, 11.366163;;, + 77; 3; 0.426950, -1.024470, 11.366163;;, + 115; 3; 0.426950, -1.024470, 11.366163;;, + 135; 3; 0.426950, -1.024470, 11.366163;;; + } + } + + Animation x3ds_anim_2 { + {x3ds_xRU_Arm} + AnimationKey { + 0; + 30; + 0; 4; -0.000000, 0.130526, 0.000000, -0.991445;;, + 1; 4; -0.065263, 0.113039, 0.495722, -0.858616;;, + 15; 4; -0.056193, 0.117811, 0.426828, -0.894864;;, + 30; 4; -0.065263, 0.113039, 0.495723, -0.858616;;, + 31; 4; -0.065263, 0.113039, 0.495723, -0.858616;;, + 43; 4; 0.053090, 0.119242, -0.403256, -0.905730;;, + 52; 4; -0.220806, -0.041267, 0.855768, -0.466049;;, + 61; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 68; 4; -0.025312, 0.111794, -0.475054, -0.872459;;, + 76; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 77; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 85; 4; 0.133832, 0.353720, 0.308203, -0.872916;;, + 93; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 96; 4; -0.200990, -0.200282, 0.412420, -0.865679;;, + 97; 4; -0.132674, -0.082403, 0.416033, -0.895837;;, + 98; 4; -0.201870, -0.265437, 0.361052, -0.870881;;, + 99; 4; -0.134623, -0.131057, 0.365286, -0.911739;;, + 100; 4; -0.228976, -0.420777, 0.283694, -0.830683;;, + 115; 4; -0.000001, -0.398748, 0.000001, -0.917061;;, + 135; 4; -0.078327, -0.125349, -0.524098, -0.838734;;, + 139; 4; -0.071913, -0.092789, -0.291009, -0.949491;;, + 160; 4; -0.065263, 0.113040, 0.495724, -0.858616;;, + 161; 4; -0.065263, 0.113040, 0.495724, -0.858616;;, + 175; 4; -0.165429, -0.450070, 0.634668, -0.606026;;, + 178; 4; -0.307408, -0.362634, 0.387903, -0.789638;;, + 182; 4; -0.174187, -0.394643, 0.618206, -0.657068;;, + 185; 4; -0.280338, -0.279007, 0.343836, -0.851671;;, + 188; 4; -0.185051, -0.307103, 0.545153, -0.757794;;, + 192; 4; -0.218786, -0.219812, 0.386801, -0.868447;;, + 216; 4; -0.065264, 0.113036, 0.495726, -0.858615;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -22.158115, 0.000001, 34.682266;;, + 77; 3; -22.158115, 0.000001, 34.682266;;, + 115; 3; -22.158115, 0.000001, 34.682266;;, + 135; 3; -22.158115, 0.000001, 34.682266;;; + } + } + + Animation x3ds_anim_3 { + {x3ds_xRL_Arm} + AnimationKey { + 0; + 26; + 0; 4; 1.000000, 0.000000, -0.000000, -0.000000;;, + 1; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 15; 4; 0.909961, 0.414693, -0.000000, -0.000000;;, + 30; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 31; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 43; 4; 0.622515, 0.782608, 0.000000, -0.000000;;, + 52; 4; 0.998630, 0.052336, -0.000000, -0.000000;;, + 61; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 68; 4; 0.987688, 0.156435, -0.000000, -0.000000;;, + 76; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 77; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 85; 4; 0.673714, 0.675106, -0.106243, 0.281164;;, + 93; 4; 0.866025, 0.500000, 0.000000, -0.000000;;, + 96; 4; 0.846469, 0.531913, 0.010984, -0.020921;;, + 115; 4; 1.000000, -0.000001, -0.000000, 0.000000;;, + 135; 4; 0.913546, 0.406736, -0.000000, 0.000000;;, + 139; 4; 0.981076, 0.193621, -0.000000, -0.000000;;, + 160; 4; 0.866026, 0.499999, -0.000000, 0.000000;;, + 161; 4; 0.866026, 0.499999, -0.000000, 0.000000;;, + 175; 4; 0.898794, 0.438370, -0.000000, 0.000000;;, + 178; 4; 0.668687, 0.743544, -0.000000, 0.000000;;, + 182; 4; 0.826796, 0.562503, -0.000000, 0.000000;;, + 185; 4; 0.651408, 0.758727, -0.000000, 0.000000;;, + 188; 4; 0.705617, 0.708593, -0.000000, 0.000000;;, + 192; 4; 0.616021, 0.787730, -0.000000, 0.000000;;, + 216; 4; 0.866010, 0.500027, -0.000000, 0.000000;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 13.822151, 0.000000, -20.565975;;, + 77; 3; 13.822151, 0.000000, -20.565975;;, + 115; 3; 13.822151, 0.000000, -20.565975;;, + 135; 3; 13.822151, 0.000000, -20.565975;;; + } + } + + Animation x3ds_anim_4 { + {x3ds_xR_Hand} + AnimationKey { + 0; + 11; + 0; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 52; 4; 0.085633, 0.098509, -0.650446, -0.748253;;, + 68; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 77; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 85; 4; 0.095461, 0.089019, -0.725097, -0.676164;;, + 93; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 115; 4; 0.092296, 0.092296, -0.701057, -0.701058;;, + 135; 4; 0.092296, 0.092296, -0.701057, -0.701058;;, + 160; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 161; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 216; 4; 0.083025, 0.100717, -0.630637, -0.765023;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 17.201632, -0.532498, -26.974579;;, + 77; 3; 17.201632, -0.532498, -26.974579;;, + 115; 3; 17.201632, -0.532498, -26.974579;;, + 135; 3; 17.201632, -0.532498, -26.974579;;; + } + } + + Animation x3ds_anim_5 { + {x3ds_xLU_Arm} + AnimationKey { + 0; + 31; + 0; 4; -0.000000, 0.130526, 0.000000, -0.991445;;, + 1; 4; -0.017037, 0.129409, 0.129410, -0.982963;;, + 15; 4; -0.027138, 0.127674, 0.206133, -0.969779;;, + 30; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 31; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 43; 4; -0.326088, 0.265924, 0.458283, -0.782897;;, + 52; 4; 0.023797, -0.004380, -0.508650, -0.860633;;, + 61; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 68; 4; 0.039250, 0.124485, -0.298134, -0.945558;;, + 76; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 77; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 85; 4; 0.014321, -0.216242, 0.302516, -0.928180;;, + 93; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 96; 4; 0.012473, 0.472295, 0.098587, -0.875821;;, + 97; 4; -0.005733, 0.314325, 0.091301, -0.944897;;, + 98; 4; 0.002467, 0.403792, 0.085230, -0.910869;;, + 99; 4; -0.005563, 0.316457, 0.079674, -0.945239;;, + 100; 4; 0.010565, 0.509467, 0.073742, -0.857260;;, + 115; 4; -0.000001, 0.566409, -0.000008, -0.824124;;, + 135; 4; 0.176893, 0.283087, -0.499530, -0.799400;;, + 139; 4; 0.283098, 0.024951, -0.406064, -0.868531;;, + 160; 4; -0.017038, 0.129412, 0.129402, -0.982964;;, + 161; 4; -0.017038, 0.129412, 0.129403, -0.982964;;, + 175; 4; 0.405692, 0.534219, 0.553941, -0.493126;;, + 178; 4; 0.585778, 0.368487, 0.379184, -0.614249;;, + 182; 4; 0.448058, 0.532485, 0.549044, -0.462877;;, + 185; 4; 0.592036, 0.367183, 0.377829, -0.609849;;, + 188; 4; 0.502752, 0.483163, 0.496528, -0.516967;;, + 192; 4; 0.598794, 0.362383, 0.372267, -0.609543;;, + 207; 4; 0.476089, 0.472560, 0.479925, -0.565420;;, + 216; 4; -0.017039, 0.129409, 0.129408, -0.982964;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 22.800381, -0.000005, 34.682266;;, + 77; 3; 22.800381, -0.000005, 34.682266;;, + 115; 3; 22.800381, -0.000005, 34.682266;;, + 135; 3; 22.800381, -0.000005, 34.682266;;; + } + } + + Animation x3ds_anim_6 { + {x3ds_xLL_Arm} + AnimationKey { + 0; + 26; + 0; 4; 1.000000, 0.000000, -0.000000, -0.000000;;, + 1; 4; 0.819152, 0.573576, -0.000000, -0.000000;;, + 15; 4; 0.848048, 0.529919, -0.000000, -0.000000;;, + 30; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 31; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 43; 4; 0.737277, 0.675591, -0.000000, -0.000000;;, + 52; 4; 0.642787, 0.766045, 0.000000, -0.000000;;, + 61; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 68; 4; 0.939693, 0.342020, -0.000000, -0.000000;;, + 76; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 77; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 85; 4; 0.441186, 0.831001, 0.214867, -0.261961;;, + 93; 4; 0.819152, 0.573576, -0.000000, 0.000000;;, + 96; 4; 0.932169, 0.360972, -0.014558, 0.023425;;, + 115; 4; 1.000000, -0.000000, -0.000000, -0.000000;;, + 135; 4; 0.874620, 0.484809, -0.000000, -0.000000;;, + 139; 4; 0.980002, 0.198988, -0.000000, -0.000000;;, + 160; 4; 0.819152, 0.573576, -0.000000, 0.000000;;, + 161; 4; 0.819152, 0.573577, -0.000000, 0.000000;;, + 175; 4; 0.902585, 0.430511, -0.000000, 0.000000;;, + 178; 4; 0.674571, 0.738210, -0.000000, 0.000000;;, + 182; 4; 0.836374, 0.548160, -0.000000, 0.000000;;, + 185; 4; 0.666576, 0.745437, -0.000000, 0.000000;;, + 188; 4; 0.756143, 0.654407, -0.000000, 0.000000;;, + 192; 4; 0.686772, 0.726874, -0.000000, 0.000000;;, + 216; 4; 0.819140, 0.573595, -0.000000, 0.000000;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -0.446586, 0.000001, -24.389267;;, + 77; 3; -0.446586, 0.000001, -24.389267;;, + 115; 3; -0.446586, 0.000001, -24.389267;;, + 135; 3; -0.446586, 0.000001, -24.389267;;; + } + } + + Animation x3ds_anim_7 { + {x3ds_xL_Hand} + AnimationKey { + 0; + 10; + 0; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 68; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 77; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 85; 4; 0.099989, 0.083901, -0.759491, -0.637289;;, + 93; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 115; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 135; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 160; 4; 0.088182, 0.096234, -0.669811, -0.730970;;, + 161; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 216; 4; 0.088182, 0.096234, -0.669810, -0.730970;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -1.719951, -0.532492, -32.044598;;, + 77; 3; -1.719951, -0.532492, -32.044598;;, + 115; 3; -1.719951, -0.532492, -32.044598;;, + 135; 3; -1.719951, -0.532492, -32.044598;;; + } + } + + Animation x3ds_anim_8 { + {x3ds_xHead} + AnimationKey { + 0; + 26; + 0; 4; -0.000000, -0.999048, 0.043619, -0.000000;;, + 6; 4; -0.000000, -0.997564, -0.069756, -0.000000;;, + 15; 4; -0.000000, -0.999657, -0.026177, -0.000000;;, + 26; 4; -0.000000, -0.999391, 0.034899, -0.000000;;, + 52; 4; 0.057153, -0.973623, -0.220877, -0.002109;;, + 61; 4; -0.000000, -0.999391, 0.034900, -0.000000;;, + 68; 4; -0.328848, -0.929469, 0.165640, 0.022582;;, + 76; 4; -0.000000, -0.999391, 0.034900, -0.000000;;, + 77; 4; -0.000000, -0.999391, 0.034900, -0.000000;;, + 85; 4; 0.130447, -0.990841, 0.034601, 0.004555;;, + 93; 4; 0.000000, -0.999391, 0.034900, -0.000000;;, + 115; 4; -0.000000, -0.999048, 0.043621, -0.000000;;, + 135; 4; -0.000000, -0.999048, 0.043621, -0.000000;;, + 175; 4; -0.000000, -0.999048, 0.043621, -0.000000;;, + 177; 4; 0.121753, -0.991602, 0.043296, 0.005316;;, + 179; 4; -0.017436, -0.998896, 0.043614, -0.000761;;, + 181; 4; 0.139040, -0.989326, 0.043196, 0.006071;;, + 183; 4; -0.034867, -0.998440, 0.043594, -0.001522;;, + 185; 4; 0.121752, -0.991602, 0.043296, 0.005316;;, + 187; 4; -0.026153, -0.998706, 0.043606, -0.001142;;, + 189; 4; 0.142432, -0.972455, -0.180232, 0.039500;;, + 191; 4; -0.109249, -0.975409, -0.173314, -0.081269;;, + 193; 4; 0.130401, -0.990501, 0.043248, 0.005694;;, + 195; 4; -0.043578, -0.998097, 0.043579, -0.001903;;, + 197; 4; 0.173153, -0.983648, 0.043642, 0.023447;;, + 199; 4; -0.065922, -0.988029, 0.137452, 0.023655;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 8; + 0; 3; 0.000000, 0.320922, 43.031700;;, + 93; 3; 0.000000, 0.320922, 43.031700;;, + 115; 3; 0.000000, 0.320922, 43.031700;;, + 135; 3; 0.000000, 0.320922, 43.031700;;, + 160; 3; 0.000000, 0.320922, 43.031700;;, + 161; 3; 0.000000, 0.320922, 43.031700;;, + 175; 3; 0.000000, 0.320922, 43.031700;;, + 216; 3; 0.000000, 0.320922, 43.031700;;; + } + } + + Animation x3ds_anim_9 { + {x3ds_xSpike01} + AnimationKey { + 0; + 6; + 0; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 77; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 93; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 115; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 135; 4; 0.706433, -0.706434, 0.030844, 0.030844;;, + 175; 4; 0.706433, -0.706434, 0.030844, 0.030844;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 23.054602, 0.275461, -15.502029;;, + 77; 3; 23.054602, 0.275461, -15.502029;;, + 115; 3; 23.054602, 0.275461, -15.502029;;, + 135; 3; 23.054602, 0.275461, -15.502029;;; + } + } + + Animation x3ds_anim_10 { + {x3ds_Spike02} + AnimationKey { + 0; + 6; + 0; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 77; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 93; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 115; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 135; 4; 0.706433, -0.706434, 0.030844, 0.030844;;, + 175; 4; 0.706433, -0.706434, 0.030844, 0.030844;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -22.163496, 4.231531, -15.502030;;, + 77; 3; -22.163496, 4.231531, -15.502030;;, + 115; 3; -22.163496, 4.231531, -15.502030;;, + 135; 3; -22.163496, 4.231531, -15.502030;;; + } + } + + Animation x3ds_anim_11 { + {x3ds_xRU_Leg} + AnimationKey { + 0; + 30; + 0; 4; 0.043619, -0.000000, -0.999048, 0.000000;;, + 1; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 21; 4; 0.124791, -0.009789, -0.874977, 0.467703;;, + 30; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 37; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 43; 4; 0.125169, 0.001125, -0.912411, 0.389664;;, + 52; 4; 0.125097, 0.004401, -0.922298, 0.365647;;, + 61; 4; 0.124939, 0.007674, -0.931554, 0.341379;;, + 68; 4; 0.125154, 0.002217, -0.915776, 0.381687;;, + 76; 4; 0.124939, 0.007674, -0.931554, 0.341379;;, + 77; 4; 0.124939, 0.007674, -0.931554, 0.341379;;, + 85; 4; 0.124485, 0.013117, -0.945558, 0.300420;;, + 93; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 100; 4; 0.240075, 0.038409, -0.943098, 0.226838;;, + 115; 4; 0.250380, -0.000000, -0.968148, -0.000000;;, + 135; 4; 0.250380, -0.000000, -0.968148, -0.000000;;, + 139; 4; 0.230082, -0.060758, -0.927524, 0.288220;;, + 146; 4; 0.215704, -0.060817, -0.923441, 0.311497;;, + 150; 4; 0.209892, -0.016602, -0.963089, 0.167717;;, + 160; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 161; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 175; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 178; 4; 0.124460, 0.013347, -0.946112, 0.298672;;, + 181; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 184; 4; 0.124460, 0.013347, -0.946112, 0.298672;;, + 187; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 190; 4; 0.124460, 0.013347, -0.946112, 0.298672;;, + 193; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 207; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 216; 4; 0.124939, 0.007674, -0.931554, 0.341378;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 6.849594, 0.163909, 2.374462;;, + 77; 3; 6.849594, 0.163909, 2.374462;;, + 115; 3; 6.849594, 0.163909, 2.374462;;, + 135; 3; 6.849594, 0.163909, 2.374462;;; + } + } + + Animation x3ds_anim_12 { + {x3ds_xRL_Leg} + AnimationKey { + 0; + 30; + 0; 4; 0.706434, 0.706434, -0.030844, -0.030844;;, + 1; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 11; 4; 0.438280, 0.897779, -0.019136, -0.039198;;, + 21; 4; 0.422215, 0.905446, -0.018434, -0.039533;;, + 26; 4; 0.439586, 0.897141, -0.019193, -0.039170;;, + 30; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 37; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 43; 4; 0.484348, 0.873787, -0.021147, -0.038150;;, + 52; 4; 0.499524, 0.865201, -0.021810, -0.037775;;, + 61; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 68; 4; 0.573030, 0.818373, -0.025019, -0.035731;;, + 76; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 77; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 93; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 115; 4; 0.706434, 0.706434, -0.030844, -0.030844;;, + 135; 4; 0.706434, 0.706434, -0.030844, -0.030844;;, + 139; 4; 0.319106, 0.946715, -0.013933, -0.041334;;, + 146; 4; 0.007542, 0.999020, -0.000329, -0.043618;;, + 150; 4; -0.025078, 0.998734, 0.001095, -0.043606;;, + 160; 4; 0.536789, 0.842588, -0.023437, -0.036788;;, + 161; 4; 0.536789, 0.842588, -0.023437, -0.036788;;, + 175; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 178; 4; 0.267123, 0.962675, -0.011663, -0.042031;;, + 181; 4; 0.655435, 0.753991, -0.028617, -0.032920;;, + 184; 4; 0.267123, 0.962675, -0.011663, -0.042031;;, + 187; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 190; 4; 0.267123, 0.962675, -0.011663, -0.042031;;, + 193; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 207; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 216; 4; 0.536789, 0.842588, -0.023437, -0.036788;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -3.359494, 0.259702, 38.976971;;, + 77; 3; -3.359494, 0.259702, 38.976971;;, + 115; 3; -3.359494, 0.259702, 38.976971;;, + 135; 3; -3.359494, 0.259702, 38.976971;;; + } + } + + Animation x3ds_anim_13 { + {x3ds_xR_Foot} + AnimationKey { + 0; + 29; + 0; 4; 0.707107, 0.000000, 0.707107, -0.000000;;, + 1; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 11; 4; 0.693619, 0.137449, 0.693620, -0.137448;;, + 21; 4; 0.703851, 0.067776, 0.703851, -0.067776;;, + 26; 4; 0.702932, 0.076726, 0.702932, -0.076726;;, + 30; 4; 0.701057, 0.092296, 0.701058, -0.092296;;, + 37; 4; 0.701057, 0.092296, 0.701058, -0.092296;;, + 52; 4; 0.700211, 0.098511, 0.700211, -0.098511;;, + 61; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 68; 4; 0.690345, 0.153046, 0.690346, -0.153046;;, + 76; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 77; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 93; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 115; 4; 0.707107, -0.000000, 0.707107, 0.000000;;, + 135; 4; 0.707107, -0.000000, 0.707107, 0.000000;;, + 139; 4; 0.636494, 0.308019, 0.636494, -0.308019;;, + 146; 4; 0.705581, -0.046427, 0.705581, 0.046427;;, + 150; 4; 0.682577, -0.184629, 0.682578, 0.184629;;, + 160; 4; 0.701057, 0.092298, 0.701057, -0.092298;;, + 161; 4; 0.701057, 0.092298, 0.701057, -0.092298;;, + 175; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 178; 4; 0.691481, -0.147833, 0.691481, 0.147833;;, + 181; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 184; 4; 0.691481, -0.147833, 0.691481, 0.147833;;, + 187; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 190; 4; 0.691481, -0.147833, 0.691481, 0.147833;;, + 193; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 207; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 216; 4; 0.701057, 0.092298, 0.701057, -0.092298;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 3; + 0; 3; -0.849455, -62.299629, -3.801312;;, + 115; 3; -0.849455, -62.299629, -3.801312;;, + 135; 3; -0.849455, -62.299629, -3.801312;;; + } + } + + Animation x3ds_anim_14 { + {x3ds_xLU_Leg} + AnimationKey { + 0; + 30; + 0; 4; -0.043619, -0.000000, -0.999048, 0.000000;;, + 1; 4; -0.128543, 0.007574, -0.976382, -0.173483;;, + 11; 4; -0.134779, 0.015787, -0.981832, -0.132631;;, + 21; 4; -0.128729, 0.003084, -0.969733, -0.207452;;, + 30; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 37; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 43; 4; -0.128201, 0.012056, -0.981842, -0.139302;;, + 52; 4; -0.128201, 0.012056, -0.981842, -0.139302;;, + 61; 4; -0.128543, 0.007574, -0.976383, -0.173482;;, + 68; 4; -0.128751, 0.001960, -0.967886, -0.215906;;, + 76; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 77; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 85; 4; -0.128751, 0.001960, -0.967886, -0.215907;;, + 93; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 100; 4; -0.098715, 0.012488, -0.994248, -0.039635;;, + 115; 4; -0.199368, -0.000000, -0.979925, -0.000000;;, + 135; 4; -0.180689, 0.084257, -0.888113, 0.414134;;, + 139; 4; -0.148626, 0.124737, -0.776470, 0.599538;;, + 160; 4; -0.128542, 0.007574, -0.976383, -0.173482;;, + 161; 4; -0.128542, 0.007574, -0.976383, -0.173482;;, + 175; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 178; 4; -0.112759, 0.062175, -0.955955, 0.263761;;, + 181; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 184; 4; -0.112759, 0.062175, -0.955955, 0.263761;;, + 187; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 190; 4; -0.112759, 0.062175, -0.955955, 0.263761;;, + 193; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 207; 4; -0.124735, 0.031962, -0.991546, 0.016007;;, + 212; 4; -0.128488, 0.008447, -0.977538, -0.166852;;, + 216; 4; -0.128542, 0.007575, -0.976383, -0.173479;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -5.995693, 0.163913, 2.695592;;, + 77; 3; -5.995690, 0.163913, 2.695592;;, + 115; 3; -5.995690, 0.163913, 2.695592;;, + 135; 3; -5.995690, 0.163913, 2.695592;;; + } + } + + Animation x3ds_anim_15 { + {x3ds_xLL_Leg} + AnimationKey { + 0; + 34; + 0; 4; 0.706434, 0.706434, 0.030844, 0.030844;;, + 1; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 6; 4; 0.551866, 0.832791, 0.024095, 0.036360;;, + 11; 4; 0.510806, 0.858589, 0.022302, 0.037487;;, + 21; 4; 0.521998, 0.851831, 0.022791, 0.037192;;, + 26; 4; 0.541375, 0.839649, 0.023637, 0.036660;;, + 30; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 37; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 43; 4; 0.522001, 0.851829, 0.022791, 0.037192;;, + 52; 4; 0.544120, 0.837873, 0.023757, 0.036582;;, + 61; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 68; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 76; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 77; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 93; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 104; 4; 0.564968, 0.823959, 0.024667, 0.035975;;, + 115; 4; 0.706434, 0.706434, 0.030844, 0.030844;;, + 135; 4; 0.087073, 0.995247, 0.003802, 0.043453;;, + 139; 4; -0.244382, 0.968698, -0.010670, 0.042294;;, + 155; 4; 0.218585, 0.974843, 0.009544, 0.042563;;, + 160; 4; 0.580151, 0.813340, 0.025330, 0.035511;;, + 161; 4; 0.580151, 0.813340, 0.025330, 0.035511;;, + 168; 4; 0.350698, 0.935472, 0.015312, 0.040844;;, + 172; 4; 0.439930, 0.896972, 0.019208, 0.039163;;, + 175; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 178; 4; 0.300421, 0.952809, 0.013117, 0.041600;;, + 181; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 184; 4; 0.300421, 0.952809, 0.013117, 0.041600;;, + 187; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 190; 4; 0.300421, 0.952809, 0.013117, 0.041600;;, + 193; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 207; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 212; 4; 0.495151, 0.867712, 0.021619, 0.037885;;, + 216; 4; 0.580152, 0.813340, 0.025330, 0.035511;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 3.943333, 0.259710, 39.672764;;, + 77; 3; 3.943333, 0.259710, 39.672764;;, + 115; 3; 3.943333, 0.259710, 39.672764;;, + 135; 3; 3.943333, 0.259710, 39.672764;;; + } + } + + Animation x3ds_anim_16 { + {x3ds_xL_Foot} + AnimationKey { + 0; + 34; + 0; 4; 0.707107, 0.000000, 0.707107, -0.000000;;, + 1; 4; 0.687569, -0.165071, 0.687569, 0.165071;;, + 6; 4; 0.680588, -0.191834, 0.680588, 0.191834;;, + 11; 4; 0.677475, -0.202553, 0.677475, 0.202553;;, + 21; 4; 0.676210, -0.206736, 0.676210, 0.206736;;, + 26; 4; 0.677620, -0.202065, 0.677621, 0.202065;;, + 30; 4; 0.687569, -0.165071, 0.687569, 0.165071;;, + 37; 4; 0.687569, -0.165071, 0.687569, 0.165071;;, + 43; 4; 0.681390, -0.188966, 0.681390, 0.188966;;, + 52; 4; 0.690346, -0.153046, 0.690346, 0.153046;;, + 61; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 68; 4; 0.679364, -0.196123, 0.679364, 0.196123;;, + 76; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 77; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 93; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 100; 4; 0.705872, 0.041770, 0.705872, -0.041770;;, + 104; 4; 0.698511, 0.109917, 0.698512, -0.109917;;, + 115; 4; 0.707107, -0.000002, 0.707107, 0.000002;;, + 135; 4; 0.612373, 0.353552, 0.612373, -0.353552;;, + 139; 4; 0.672346, 0.218976, 0.672346, -0.218976;;, + 155; 4; 0.659223, -0.255782, 0.659223, 0.255782;;, + 160; 4; 0.687569, -0.165072, 0.687569, 0.165072;;, + 161; 4; 0.687569, -0.165072, 0.687569, 0.165072;;, + 168; 4; 0.705347, 0.049859, 0.705347, -0.049859;;, + 172; 4; 0.706854, -0.018889, 0.706854, 0.018889;;, + 175; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 178; 4; 0.690338, -0.153079, 0.690338, 0.153079;;, + 181; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 184; 4; 0.690338, -0.153079, 0.690338, 0.153079;;, + 187; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 190; 4; 0.690338, -0.153079, 0.690338, 0.153079;;, + 193; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 207; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 216; 4; 0.687562, -0.165103, 0.687562, 0.165103;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 3; + 0; 3; 1.061092, -63.263000, -4.043970;;, + 115; 3; 1.061092, -63.263000, -4.043970;;, + 135; 3; 1.061092, -63.263000, -4.043970;;; + } + } + +} + diff --git a/rockem/demechbk.ppm b/rockem/demechbk.ppm new file mode 100644 index 0000000..eb79012 Binary files /dev/null and b/rockem/demechbk.ppm differ diff --git a/rockem/demechbt.ppm b/rockem/demechbt.ppm new file mode 100644 index 0000000..175a1a3 Binary files /dev/null and b/rockem/demechbt.ppm differ diff --git a/rockem/demechch.ppm b/rockem/demechch.ppm new file mode 100644 index 0000000..c71d873 Binary files /dev/null and b/rockem/demechch.ppm differ diff --git a/rockem/demechgr.ppm b/rockem/demechgr.ppm new file mode 100644 index 0000000..ed3ebeb Binary files /dev/null and b/rockem/demechgr.ppm differ diff --git a/rockem/demechh1.ppm b/rockem/demechh1.ppm new file mode 100644 index 0000000..043967e Binary files /dev/null and b/rockem/demechh1.ppm differ diff --git a/rockem/demechh2.ppm b/rockem/demechh2.ppm new file mode 100644 index 0000000..1c0c79a Binary files /dev/null and b/rockem/demechh2.ppm differ diff --git a/rockem/demechhd.ppm b/rockem/demechhd.ppm new file mode 100644 index 0000000..95cbfd4 --- /dev/null +++ b/rockem/demechhd.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 32 +255 +��������������������L$$L$$L$$L,,L$$L,,L$$L$$L,,L$$L$$L$$L$$L$$L$$L$$L$$L$$L,,L$$L$$L$$L$$L$$L,,��������������������������������������T,,L,,������$$�����$$�<<�44�$$��������T$$L$$�������������������������������������L,,L$$L$$L$$L$$L$$L$$L,,L,,L$$L$$L,,L,,L$$L$$L,,L$$L$$L,,L,,L$$L,,L$$L$$L$$L$$L,,L$$L,,�����������������������������������L$$L$$L$$L,,L,,L$$L,,L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L,,L,,L$$L,,L$$�����������������������������������L,,���L$$�������������������L$$���L$$�����������������������������������L$$��<<�44L$$�����$$�����<<�44�$$�������L$$��$$�44L,,�����������������������������������L$$��44�<<L$$���������$$�DD�<<��������L,,���<<L$$�����������������������������������L$$��<<�<<L,,������$$����<<�44���$$�$$����L$$���<<L$$�����������������������������������L$$L,,L,,L$$L$$L$$L$$L,,L,,T$$�����44�<<��$$�L$$L$$L$$L,,L$$L,,L,,L$$L,,L,,�����������������������������������L$$L$$L$$L$$L$$L,,L,,L$$L$$L,,T$$���$$�<<�<<��T$$L,,L$$L$$L$$L,,L$$L$$L,,L$$L$$�����������������������������������L$$��������L$$L$$L,,���<<�<<��$$L$$L$$��������L$$�����������������������������������L$$�����������L$$L$$L$$L,,L$$L,,����������L,,�����������������������������������T$$��������$$���L$$L$$L$$L$$L$$����$$�������L$$�����������������������������������T�L$$L,,L,,L$$L$$T$$������$$�������T$$L$$L$$L$$L$$L,,�L$$�����������������������������������\���$|$�T$$L$$L$$L$$L,,����<<�<<��L$$L$$L$$L$$L$$$|$|���L$$�����������������������������������\���$|$|$|$|L,,L$$L$$L,,T$$��<<�<<�$$L,,L$$L,,L$$$�$|$|,����L$$�����������������������������������L$$���4�$|$|$|$|,�L$$L$$L,,L$$L,,L$$L$$L$$L$$$|$|$|$|4�4����L,,�����������������������������������L$$�$$��<�<�4�4�������������4�4�4�4�4����L,,�����������������������������������L$$���������������������������L$$�����������������������������������L$$\$$�����������$$��<<�44���$$��������L,,L,,�����������������������������������L,,L$$���������$$�L,,L$$L$$L$$L,,L$$��������L$$L$$�������������������������������������L,,L$$��������L,,L$$L$$L$$L,,L$$L,,L$$������\$$L,,���������������������������������������L,,L$$�������L$$�t�t��t���tL,,L$$�����L$$L$$L,,�����������������������������������������L,,L,,L,,L,,L$$\$$�L$$�|�t��t���tL,,L$$�\$$L,,L$$L,,L$$��������������������������������������������������L,,�t�t��t���tL$$L,,��������������������������������������������������������L,,�|�t��|���tL$$L,,��������������������������������������������������������L,,�t�t��t���tL$$L,,��������������������������������������������������������L$$��t��t���tL,,L,,��������������������������������������������������������L,,�t�t��t���tL$$L$$��������������������������������������������������������L,,�t�t��t���tL$$L$$��������������������������������������������������������L$$L$$L$$L$$L,,L$$L$$L,,���������������������������������������������������������L,,L$$L,,L$$L,,L,,���������������������������� \ No newline at end of file diff --git a/rockem/demechhn.ppm b/rockem/demechhn.ppm new file mode 100644 index 0000000..2f54801 Binary files /dev/null and b/rockem/demechhn.ppm differ diff --git a/rockem/demechla.ppm b/rockem/demechla.ppm new file mode 100644 index 0000000..adcfef1 --- /dev/null +++ b/rockem/demechla.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 64 +255 +���������������������������������������������������������������������������LLLLLLT$$T\TTTTTTTTTTTTTTTTTTTTTTTLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTTTTTTTTTTTTTTTTTTTTTTLTTLLLLL���������������������������������������������������������������������������������������������������LLLLLL\TT����������TT$$����������LLTLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������TT����������LTLLLL���������������������������������������������������������������������������������������������������TTTLLL\TT����������TT����������LTLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������T$$T����������LLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT����������TT����������LTLLLL���������������������������������������������������������������������������������������������������LLLLLLT\L����������TT����������TLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT����������T$$T����������LTLLLL�������||������������������������������������������������������������������������������������������LLLTLLTTT����������TT����������TLTTTT������������������������TLLLLLTTTLLLTTTTTTLLLTTTLLLLLLLLLTLLLLLLLLTLLLLLTLLLLLTTTLLLLLLLLLLLLTTTLLLLLLLLLTTT����������T$$T����������TLTLLLTLLLLLLLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLTTTLLL\TT����������TT����������LTLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������������������������������������������������������������������������LLLTLLTTT����������T$$T����������LTLLLL���������������������������������������������������������������������������������������������������LLLLLL\TT����������TT����������TLTLLL���������������������������������������������������������������������������������������������������TTTLLLTTT����������T$$T����������LTLLLL���������������������������������������������������������������������������������������������������LLLTLLT$$\T����������TT����������TLTLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������TT����������TLLLLL����||���������������������������������������������������������������������������������������������LLLTTTT\T����������T\����������TLTLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������TT����������TLLLLL���������������������������������������������������������������������������������������������������LLLTLLTTT�\TTTTTTT\TTTTTTTTTT��TLTLLL���������������������������������������������������������������������������������������������������LLLLLLT\T�TTTTTTTTTTTTTTLTTTT��TLTLLL���������������������������������������������������������������������������������������������������TTTTLLTTT�TTT$$TTTLTTTLLLLLLLLT��TLLLLL���������������������������������������������������������������������������������������������������LLLLLL\TT�T$$TTTTTTT$$TTT$$TT$$TTTT$$TT��TLTLLL���������������������������������������������������������������������������������������������������TTTLLLTTT�TTT$$TTT$$TTTTTTTTTT$$TTT��TLLLLL���������������������������������������������������������������������������������������������������LLLTLLTTT�T$$T����������������T��TLTLLL���������������������������������������������������������������������������������������������������TTTLLLTTT�T$$T����������������T$$��TLLLLL���������������������������������������������������������������������������������������������������LLLLLL\TT�TT$$����������������T��TTLLLL���������������������������������������������������������������������������������������������������TTTLLLTTT�TT�<<�44�<<�<<�<<�<<�44�<<�<<�<<�<<�44�<<�<<�<<�44T��TLLLLL���������������������������������������������������������������������������������������������������TLLLLL\TT�T$$T�<<�<<�<<�<<�44�<<�<<�<<�<<�44�<<�<<�<<�44�<<�<<T��TLTLLL���������������������������������������������������������������������������������������������������LLLLLLTTT�TT�44�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�44T��\LLLLL���������������������������������������������������������������������������������������������������LLLTTTTTT�TL����������������L��\LLLLL���������������������������������������������������������������������������������������������������LLLLLL\TT�T$$T����������������T��TLLLLL���������������������������������������������������������������������������������������������������LLLTLLTTT�TT����������������T��TLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT�TT$$����������������T��TLLLLL���������������������������������������������������������������������������������������������������LLLLLL\$$TT�TTTT$$TTT$$TTTTTT$$TTTT$$TT��TLLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT�T$$TT$$TT$$TTTT$$TT$$TTTTTTTT��TLLLLL���������������������������������������������������������������������������������������������������TTTTLLTTT�TT����������������T��TTLLLL���������������������������������������������������������������������������������������������������LLLLLLT\T�T$$T����������������T��TLTLLL���������������������������������������������������������������������������������������������������LLLLLLT\T�TT����������������T��TLTTTT���������������������������������������������������������������������������������������������������TTTTLLT$$TT�TT$$�44�44�<<�<<�<<�44�<<�<<�<<�<<�<<�44�<<�44�<<�44T��TLL$$LLL���������������������������������������������������������������������������������������������������LLLLLLT\T�TT�<<�<<�<<�44�<<�<<�44�44�<<�44�<<�<<�44�<<�<<�<<T��TLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT�TT�44�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�44T��TLLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT�TT����������������T��TLTLLL���������������������������������������������������������������������������������������������������LLLTTT\T\�TT����������������T��TLLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT�TT����������������T��TLTLLL���������������������������������������������������������������������������������������������������LLLTTTT\T�TT����������������T��LTLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT�TTTTTTTTTTTTTTTTTTT��TLTLLL���������������������������������������������������������������������������������������������������TTTTLLT\T�TTTTTTTTTTTTTTTTTTT��TLTLLL���������������������������������������������������������������������������������������������������LLLLLLTTT�TTTTTTTTTTTTTTTTTTT��TLLLLL���������������������������������������������������������������������������������������������������LLLLLL\TT�TTTTTTTTLTLTTTTTLTT��TLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT�TTTTTTTTTTTTTTTTTTT��TLLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������TT����������LLTLLL���������������������������������������������������������������������������������������������������LLLTTT\TT����������TT����������TTLLLL���������������������������������������������������������������������������������������������������LLLTLLTTT����������TT����������LLLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������TT����������TLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT����������TT����������TLTLLL���������������������������������������������������������������������������������������������������LLLLLL\TT����������TT����������TTLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������TT����������LLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT����������TT����������TTLLLL���������������������������������������������������������������������������������������������������LLLLLLT\T����������TT����������TLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT����������TT����������TTLLLL���������������������������������������������������������������������������������������������������LLLLLLT\TTTTT\T\TTTTTTTTTTTTTT\TLLTTT���������������������������������������������������������������������������������������������������LLLTLLT$$TTT\TTTTTTTTTTTTTTTTTTTTTTLLLL���������������������������������������������������������������������������������������������������TTTLLL\$$T\\TTTTTTT$$TTTTTTTTTT$$TTTT\$$LTTTT������������������������ \ No newline at end of file diff --git a/rockem/demechll.ppm b/rockem/demechll.ppm new file mode 100644 index 0000000..584ec95 --- /dev/null +++ b/rockem/demechll.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 128 +255 +�������������������������������������������������������������������$$���������$$���$$�������������������������������������������������������������������������������������������������������������������������������������������TTT$$TTT$$TTT$$TTTTTTTT�������������������������������������������������������������������������������������������������������������������������������������\TTTTTTTTTTTT$$TT$$TL$$������������������������������������������������������������������������������������������������������������������������������������$$�T$$���������������T�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T$$�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T$$�������������������������������������������������������������������������������������������������������������������������������������T$$�44�44�<<�<<�<<�<<�44�<<�<<�<<�<<�<<�<<�<<�44T�������������������������������������������������������������������������������������������������������������������������������������T�<<�<<�44�44�<<�44�<<�44�<<�<<�44�<<�<<�<<�<<T$$�������������������������������������������������������������������������������������������������������������������������������������T$$�44�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�44T�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T�������������������������������������������������������������������������������������������������������������������������������������T���������������T$$�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T�������������������������������������������������������������������������������������������������������������������������������������TTTTTT$$TTTT$$TTTTT$$T\�������������������������������������������������������������������������������������������������������������������������������������T$$TT$$TTTTT$$TTTT$$TTTTT�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T�������������������������������������������������������������������������������������������������������������������������������������T���������������T�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T�������������������������������������������������������������������������������������������������������������������������������������T�44�44�<<�<<�<<�<<�<<�<<�<<�<<�44�<<�<<�<<�44T$$�������������������������������������������������������������������������������������������������������������������������������������T�<<�<<�44�<<�44�<<�44�<<�<<�<<�<<�44�44�<<�<<T�������������������������������������������������������������������������������������������������������������������������������������T$$�44�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�44T�������������������������������������������������������������������������������������������������������������������������������������T���������������T�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T$$�������������������������������������������������������������������������������������������������������������������������������������T���������������T������������������������������������������������������������������������������������������������������������������������������������,,�TTTTTTTTTTTTTTTT\$$�������������������������������������������������������������������������������������������������������������������������������������TTTTTTTTTTTTTTTTT$$��������������������������������������������������������������������������������������������������������������������������������������\�������������\�$$��������������������������������������������������������������������������������������������������������������������������������������T�������������T���������������������������������������������������������������������������������������������������������������������������������������T�������������T���������������������������������������������������������������������������������������������������������������������������������������T�������������T������������������������������������������������������������������LLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLT$$T$$TTT$$TTT$$TTT$$TTTL$$TT$$TT$$TT$$LLLTTTLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTT$$TTTTTLT$$T$$TTT$$TTTTTTTT$$LLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL������������������������������������������������������������������TT$$��������44�<<�<<�������\T���������������������������������������������������������������������������������������������������������������������������������T$$T��������<<�<<�<<�������T$$\���������������������������������������������������������������������������������������������������������������������������������TT$$��������<<�44�<<�������TT���������������������������������������������������������������������������������������������������������������������������������TT��������<<�44�<<�������TT���������������������������������������������������������������������������������������������������������������������������������T$$T��������<<�<<�44�������T$$T���������������������������������������������������������������������������������������������������������������������������������TT��������44�<<�<<�������TT���������������������������������������������������������������������LLLLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLLLLTTTLLLLLLLLLLLLLLL���T$$T��������<<�<<�<<�������T$$T���TTTLLLLLLLLLTTTLLLTTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLTTTLLLLLLLLLTTTLLLTTTLLLLLLTTTTTTLLLLLLTTTLLLTTTLLLTTT���TT��������44�<<�44�������TT���LLLLLLLLLLLLLLLTTTLLLTTTLLLLLLLLLTTTLLLTTTTTTLLLLLLTTTLLL���������LLLLLLT$$TT$$T$$TTT$$TTTT$$TTTTLLLLLL���T$$T��������<<�<<�<<�������T$$T���TTTLLLTT$$TTTTTT$$TTTTTTT$$LLLLLL���������LLLLLLd�������������TLLLLLL���TT��������<<�<<�<<�������T$$T���LLLLLLd�������������TLLLLLL���������LLLLLLT�������������TLLLTTT���T\$$��������44�<<�<<�������TT���LLLTTTT$$�������������TLLLLLL���������TTTLLLT�������������T$$TTTLLL���T$$T��������<<�44�<<�������T$$T���LLLLLLT$$�������������TLLLTTT���������LLLLLLT$$�������������TLLLLLL���TT��������<<�<<�<<�������TT���LLLTTTT�������������T$$TTTLLL���������LLLLLLT�44�<<�44�<<�<<�<<�44�<<�<<�<<�<<�44�<<T$$LLLTTT���TT$$��������44�<<�44�������T$$T���LLLLLLT$$�44�<<�44�<<�<<�<<�<<�44�<<�<<�<<�<<�44T$$LLLLLL���������LLLLLLT$$�<<�44�<<�<<�44�44�<<�<<�<<�44�<<�<<�<<TLLLLLL���T$$T��������<<�<<�<<�������TT���LLLTTTT$$�44�<<�<<�<<�44�<<�44�<<�44�<<�44�<<�<<TLLLLLL���������LLLLLLT�������������TLLLLLL���TT$$��������<<�<<�<<�������TT���LLLTTTT�������������T$$LLLLLL���������TTTLLLT�������������TLLLLLL���TT��������<<�<<�44�������TT$$���LLLLLLT�������������TTTTLLL���������LLLLLLT$$�������������TLLLTTT���T$$T��������44�<<�<<�������TT$$���LLLTTTT$$�������������T$$LLLLLL���������LLLTTTT�������������TTLLLLL���T\$$��������<<�<<�44�������T$$T���LLLLLLT�������������TLLLLLL���������LLLLLLT$$TTTT$$TTT$$TTT$$TTT$$TLLLLLL���TT��������<<�<<�<<�������TT$$���LLLTTTT$$TTTT$$TTT$$TTTT$$T$$TT$$LLLLLL���������LLLTTTTT$$TTTTTTTTTTTTTLLLLLL���\$$T��������44�<<�<<�������TT���LLLLLLTT$$TTTTTTT$$T$$TTTTTLLLLLL���������LLLTTTT�������������TLLLLLL���T$$T��������44�<<�<<�������T$$T���LLLLLLT�������������TLLLLLL���������LLLLLLT$$�������������TTTTLLL���TT$$��������<<�<<�44�������TT���LLLTTTT�������������TLLLTTT���������TTTLLLT�������������T$$LLLLLL���TT��������44�<<�<<�������T$$T���LLLLLLT$$�������������T$$LLLLLL���������LLLLLLT�<<�44�<<�<<�<<�<<�<<�<<�<<�<<�44�<<�<<TLLLTTT���TT$$��������<<�<<�44�������TT$$���LLLLLLT�<<�<<�<<�44�<<�<<�<<�<<�44�<<�<<�<<�<<TLLLTTT���������TTTLLLT$$�44�<<�44�<<�44�44�<<�44�44�<<�<<�<<�44T$$LLLLLL���T$$T��������<<�<<�<<�������T$$T���TTTLLLT�<<�44�44�<<�<<�<<�<<�44�<<�44�<<�<<�44T$$LLLLLL���������LLLLLLT�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�44�<<�<<TLLLLLL���TT$$��������<<�44�<<�������TT���LLLLLLT�<<�<<�<<�<<�44�<<�<<�<<�<<�<<�<<�<<�<<TTTTLLL���������LLLTTTT�������������TLLLLLL���TT��������<<�44�<<�������TT$$���LLLTTTT�������������TTTTLLL���������LLLLLLT�������������TLLLLLL���T$$T��������<<�<<�<<�������T$$T���LLLLLLT�������������T$$LLLLLL���������TTTLLL\$$�������������T$$LLLLLL���TT$$��������44�<<�44�������TT$$���LLLTTT\$$�������������TTTTLLL���������LLLLLLTTTTTT\$$TTTTTTTTTTTLLL���T$$T��������<<�<<�<<�������T$$T���LLLLLLTTTTTTTTTTTTTTTLLLLLL���������LLLTTTTTTTTTTTTTTTTTT$$LLLLLL���TT$$��������44�<<�<<�������TT$$���LLLLLLTTTTTTTTTTTTTTT$$TTTLLL���������LLLLLLLLLTTTLLLTTTLLLLLLLLLLLLTTTTTTLLLTTTLLLTTTLLLLLLLLL���TT��������<<�<<�<<�������T$$T���LLLTTTTTTLLLTTTTTTLLLLLLLLLTTTLLLLLLTTTLLLLLLLLLTTTLLLLLL���������LLLLLL���������������������������������������������LLLLLL���T$$\��������<<�<<�<<�������T$$T���LLLLLL���������������������������������������������LLLLLL���������LLLTTT���������������������������������������������LLLLLL���TT$$��������<<�<<�44�������T$$T���LLLTTT���������������������������������������������TTTLLL���������LLLLLL���������������������������������������������TTTLLL���TT��������44�<<�<<�������TT$$���LLLLLL���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������LLLLLL���TT$$��������<<�<<�44�������TT���LLLLLL���������������������������������������������TTTLLL���������TTTLLL���������������������������������������������TTTLLL���TT$$��������44�<<�<<�������T$$T���LLLTTT���������������������������������������������LLLLLL���������LLLTTT���������������������������������������������LLLLLL���TT$$��������44�<<�<<�������TT$$���LLLLLL���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������TTTLLL���TT\TT\\T\TTT\T\\T\\T$$T���LLLLLL���������������������������������������������LLLTTT���������LLLTTT���������������������������������������������LLLLLL���T$$\TT\TTTT\\TTTT\TTTTT$$���LLLTTT���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������TTTLLL���TT�\�\�d�\�\�\�d�d�\�d�d�\�d�d�\�d�TT$$T���LLLLLL���������������������������������������������LLLTTT���������LLLLLL���������������������������������������������LLLLLL���TT$$�\�d�\�d�d�d�d�d�\�d�d�\�d�d�d�\�\LT$$���LLLTTT���������������������������������������������LLLLLL���������LLLTTT���������������������������������������������TTTLLL���TT�\����������������\T$$T���LLLLLL���������������������������������������������LLLTTT���������LLLLLL���������������������������������������������TTTLLL���TT�\�������������������������������\T$$T���LLLLLL���������������������������������������������LLLLLL���������TTTLLL���������������������������������������������LLLLLL���TT$$�\�������������������������������\TL$$���TTTLLL���������������������������������������������TTTLLL���������LLLLLL���������������������������������������������TTTLLL���TT�\�������������������������������\T$$T���LLLLLL���������������������������������������������LLLLLL���������LLLTTT���������������������������������������������LLLLLL���TT$$�\�������������������������������\TL$$���LLLTTT���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������TTTLLL���TT�\�������������������������������\T$$T���LLLLLL���������������������������������������������TTTLLL���������LLLTTT���������������������������������������������LLLLLL���TT$$�\�������������������������������\LT$$���LLLTTT���������������������������������������������LLLTTT���������TTTLLLlllllllllTTTlllllllllllllllllllllllllllllllllLLLLLL���TT$$�\����������������\TL$$���TTTLLLllllllllllllllllllllllllllllllTTTlllTTTllllllTTTLLL���������LLLLLLllllllTTTlllllllllTTTllllllllllllTTTlllllllllLLLTTT���TT�\����������������\T$$T���LLLLLLllllllTTTlllTTTllllllTTTlllllllllllllllllllllLLLLLL���������TTTLLLlllllllllllllllTTTllllllllllllllllllTTTllllllLLLLLL���\T$$�\�\�d�\�\�d�\�\�d�d�d�\�d�\�d�\�TTL$$���LLLLLLlllllllllllllllllllllllllllllllllTTTlllTTTlllLLLLLL���������LLLLLLlllTTTlllTTTlllllllllTTTlllTTTlllllllllllllllLLLLLL���TT�d�d�\�d�d�\�d�\�\�\�\�d�\�\�d�\�TT$$T���TTTLLLlllTTTlllTTTllllllTTTllllllllllllllllllllllllLLLLLL���������TTTLLLllllllllllllllllllllllllllllllllllllTTTllllllLLLLLL���TT$$�\�\�d�\�d�\�d�d�d�d�\�d�d�d�d�\�\TL$$���LLLLLLlllllllllllllllTTTllllllTTTlllTTTlllTTTllllllLLLLLL���������LLLLLLllllllllllllllllllllllllTTTlllTTTllllllllllllLLLTTT���TT�\����������������\TT$$���LLLLLLllllllTTTllllllllllllllllllllllllllllllllllllLLLTTT���������LLLTTTllllllTTTllllllllllllllllllllllllTTTlllllllllLLLLLL���LT$$�\�������������������������������\T$$L$$���LLLLLLlllTTTllllllllllllllllllTTTllllllllllllTTTlllTTTLLL���������LLLLLLlllllllllllllllTTTlllTTTlllllllllllllllllllllLLLTTT���TT$$�\�������������������������������\TL$$���LLLLLLlllllllllTTTlllllllllllllllllllllTTTlllllllllLLLLLL���������LLLLLLlllTTTlllllllllllllllllllllTTTllllllllllllTTTLLLLLL���LT$$�\�������������������������������\TT$$���LLLTTTlllllllllllllllllllllTTTllllllllllllTTTllllllLLLTTT���������TTTLLLlllllllllTTTllllllllllllTTTllllllllllllllllllTTTLLL���TT$$�\�������������������������������\T$$L$$���LLLLLLTTTllllllllllllTTTllllllllllllTTTllllllllllllLLLLLL���������LLLLLLllllllllllllllllllllllllllllllTTTlllTTTllllllLLLLLL���T$$L�\�������������������������������\TT$$���LLLLLLllllllllllllllllllTTTlllllllllllllllTTTllllllLLLLLL���������LLLLLLllllllTTTlllTTTlllTTTllllllllllllllllllllllllTTTLLL���T$$T�\�������������������������������TT$$L���TTTLLLllllllTTTlllTTTllllllllllllllllllTTTlllllllllTTTLLL���������LLLLLLTTTllllllllllllTTTlllTTTlllTTTllllllTTTllllllLLLLLL���TT$$�\����������������\LT$$���LLLLLLlllllllllTTTlllllllllllllllTTTlllllllllllllllLLLTTT���������LLLLLLlllllllllllllllllllllllllllllllllllllllllllllLLLTTT���T$$L�\����������������\T$$L���TTTLLLllllllTTTllllllTTTlllllllllllllllllllllllllllLLLLLL���������TTTLLLlllllllllTTTlllllllllTTTlllTTTlllTTTlllTTTlllLLLLLL���TT$$�d�\�d�\�\�\�\�\�d�\�\�\�\�\�d�\�TT$$T���LLLLLLllllllllllllllllllTTTlllTTTlllTTTllllllTTTlllTTTLLL���������LLLLLLllllllTTTllllllllllllllllllllllllllllllllllllLLLLLL���LT$$�\�d�\�d�d�d�d�\�d�\�d�d�d�\�d�d�\T$$L���LLLLLLllllllTTTlllTTTllllllllllllllllllllllllllllllLLLLLL���������LLLLLLlllllllllllllllllllllllllllllllllllllllllllllTTTLLL���TT$$�\����������������\TT$$���LLLTTTlllllllllllllllllllllllllllllllllllllllllllllTTTLLL���������LLLLLLLLLLLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���TT$$�\�������������������������������TT$$L���LLLLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLTTTTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���L$$T�\�������������������������������\T$$T���LLLLLLLLLLLLTTTTTTLLLTTTTTTLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTT���T\�\�������������������������������TT$$L���TTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLTTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\�������������������������������\T$$T���LLLLLLLLLLLLTTTTTTLLLTTTTTTLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLTTTLLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���TT�\�������������������������������TT$$L���LLLLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLTTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\�������������������������������\T$$T���LLLLLLLLLLLLTTTTTTLLLTTTLLLLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLTTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���T\�\����������������\T$$T���LLLLLLLLLLLLTTTTTTLLLTTTTTTLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLTTTLLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���T\�\����������������TT$$L���LLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLTTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���T\�d�\�d�\�\�\�\�\�\�d�d�\�\�\�d�\�\T$$T���LLLLLLLLLLLLTTTTTTLLLTTTTTTLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTT���T\�\�d�\�d�d�d�d�d�d�d�\�d�d�\�d�d�TT$$L���TTTLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\��������������܄�\T$$T$$���LLLLLLLLLLLLTTTTTTLLLTTTLLLLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLLLLTTTLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���TT�\����������������\LT$$���LLLLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTLLL���������TTTLLLLLLTTTLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���T\�\�������������������������������\TL$$���LLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLLLLLLLLLLTTTTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\�������������������������������\T$$T$$���LLLLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLLLLTTTLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���T\�\�������������������������������\TL$$���LLLTTTTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\�������������������������������\T$$T���LLLLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLTTTLLLTTTLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���T\�\�������������������������������\T$$L���LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\�������������������������������\L$$T���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���T\�\����������������\T$$T���LLLLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������TTTLLLLLLLLLLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���TT$$�\�d�\�d�d�\�d�d�\�d�d�d�d�\�d�\�\TL���TTTLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLLLLTTTLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\�d�\�d�d�\�d�d�\�\�\�\�\�d�\�d�\T$$T$$���LLLLLLLLLTTTLLLLLLTTTLLLTTTLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLTTTLLLLLLTTTTTTLLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���TT$$TTT$$LTL$$TLT$$LTT$$LT$$LT$$L$$T$$L���TTTLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLLLLTTTLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LT$$L$$LT$$T$$T$$T$$L$$L$$T$$T$$T$$T$$L$$LT$$L$$\$$LT$$���LLLLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLTTTLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTT���T$$T�����������������TT���TTTLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLTTTLLLLLLTTTTTTLLLTTTLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���T$$L�����������������L$$T���TTTLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTTTTLLLTTTLLLLLLLLLTTTLLL���������LLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT$$�����������������TL$$���LLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������������������������������������������������������������������LT$$�����������������T$$T���������������������������������������������������������������������������������������������������������������������������������TT$$�����������������T$$L���������������������������������������������������������������TLT$$LLT$$LLT$$LLLT$$T$$LT$$T$$LT$$T$$LT$$T$$LTTTTTT$$TLTTT$$LT$$T$$LT$$TL$$TLL$$TL$$LL$$L$$L$$L$$T$$L$$T$$L$$L$$L$$L$$L$$L$$L$$LL$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$TT$$T$$T$$TT$$T$$T$$T$$TT$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$ \ No newline at end of file diff --git a/rockem/demechua.ppm b/rockem/demechua.ppm new file mode 100644 index 0000000..e81b0d5 --- /dev/null +++ b/rockem/demechua.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +32 32 +255 +���������������d�d�d�d�d�d�d�d�d�d�d�d����������������\�d�����������������d�����������d܌���������������d�d�����������������d�����������d��������������܌�d�d�����������������d�������������������d����������������d�d�����������������d�������������������d����������������d�d�����������������d�������������������d����������������d�d�����������������d�������������������d����������������d�\�����������������d��������������������d����������������d�d�����������������d�������t��|��t��������d���������������d�d�d�����������������d��������t��t��t��������d���������������d�d�d�����������������d�������t��t��t���������d��������������d�d�d�����������������d��������t��t��t��������d������������܌�d�d�d�����������������d�������t��t��|��������d���������܌��d�d�d�d�����������������d�������|��t��t���������d������������d�d�d�d�����������������d�������t��t��|��������d�����������d��d�d�����������������d�������|��t��t���������d��������܌�\�d��d�d�����������������d�������t��t��|���������d��������\�d���d�d�����������������d�������t��t��t��������d�����܌��d�d���d�d�����������������d�������t��|��|��������d��������d�d���d�d�����������������d�������t��t��t��������d�������d�d���d�d�����������������d�������t��t��t��������d������d�����d�d�����������������d�������t��t��t��������d������d�����d�d�����������������d�������t��t��t��������d������d������d�d�����������������d���������t��t��������d������d������d�d�����������������d�������������������d������d������d�d�����������������d�������������������d������d�������d�d�����������������d�������������������d������d�������d�d�����������������d�������������������d������d�������d�d�����������������d�����������d������d�������d�d�����������������d�����������d������d�������d�d�����������������d�d�d�d�d�d�d�d�d�d�d�d������\�������d�d�����������������d�d�d�d�d�d�d�d�d�d�d�d������\�������d�d�� \ No newline at end of file diff --git a/rockem/demechul.ppm b/rockem/demechul.ppm new file mode 100644 index 0000000..e86e8b9 --- /dev/null +++ b/rockem/demechul.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 64 +255 +�����������T�L�|��������������������|�|�T�T�������������������\�\�\�������������������L�T�t���������������������|�L�T�������������������T�T�|�|�����������������|�|�L�T���������������������\�T�\��������������������\�L�|������������������|܄�T�T�������������������T�T�|�|���������������|�|�T�T�T���������������������\�T�\���������������������T�T�L�|�����������������|�T�T�������������������L�T��|���������������t�|�T�T�����������������������T�T�\�����������������������T�T�|����������������|�|�T�T�������������������T�T�|�|�������������|�|�T�T�������������������������T�T�\�������������������������L�T�|���������������|�T�T�������������������T�T�|��������������|�|�T�T�������������������������T�T�\�������������������������T�T�|��������������|�|�T�T�������������������L�T܄�|�������������|�|�T�T������������������������T�T�\������������������������L�T܄�|�������������܄�L�T�������������������T�T�|�������������|�\�T�������������������������T�T�\�������������������������L�T��������������|�T�T�������������������T�L�|�������������|�\�\�����������������T�\�����T�T�\�����T�d�����������������T�L��|������������|�T�T�������������������T�T�|�����������|�\�T�t����������������\�T�����\�T�\�����T�T������������������T�T�|����������|��T�L�������������������T�T�|�|����������|�T�\������������������\�T�����\�T�d�����T�T������������������T�L��|��������܄�|�T�T�������������������T�T�|����������|��T�T�������������������T�T�����\�T�\�����T�T�������������������T�T�|܄���������|�|�T�T�������������������T�T�|܄���������|�d�T�t������������������T�T�����d�T�\�����T�T������������������L�T�T�|���������|܄�T�T�������������������T�\�|�|��������|�T�\��������������������T�\�����\�T�T�����T�T������������������T�L�T�|��������|��L�T�������������������T�L�|�|�������|�|�T�T�����|��������������T�T�����T�T�\�����\�T�����������܌��T�����T�T�|��������|��L�T�������������������T�T�|�|������|�t�T�L���d�|܄��������������\�T�����\�\�\�����T�T���������������T�����T�L�\�|�������|�T�T�������������������L�L�t�t�����܄�L�T�����T�|���������������T�T�����\�T�\�����\�T���������������\�\���T�T�L܄�|�����|��L�T�������������������T�T�t�|�|�|��|�T�T�����T�|��������������T�T�����\�T�\�����T�\��������������\�T�����T�L��|�|�|��|�L�T�������������������T�L�|��|�|�|�d�T�T�����T���������������T�T�����\�\�\�����T�T��������������\�\�T���T�L�|܄�|��|�|�T�T�������������������T�\�|�t�|��|�T�T�D���T�T���������������T�T�����\�\�\�����T�T���������������\�T���T�L�L�|��|�|��L�T�������������������T�\�|��|��|�T�L�T���T�T��������������T�T�T�����T�\�T�����T�T�T��������������T�\���D�T�L�|���|�|�L�T�������������������T�\�|܄�|�|�|�T�T�����T�T��������������T�T�L�����T�\�\�����T�T�T��������������\�T�����T�T�|�|�|��|�T�T�������������������\�T�|܄�|�|�|�T�L�����T�T�������������T�T�L�����T�\�\�����T�T�T�������������\�T�����T�L�|�|�|�|��T�\�������������������\�L�\�|�|�\�T�L�T�����\�T�������������L�T�T�����\�T�\�����T�T�T�������������\�\�����T�L�T�T�|��T�T�\�������������L�T����T�T��|�T�L�T�������T�T܌������܌���|�L�T�������\�\�T�������T�T�|��܌������܌�\�\�������L�T�L��|�L�T���|�T�T�������T�T�|���T�L�T�T�T�L�T�������\�T�����������T�L�T�������T�\�\�������T�T�T�����������\�\�L�����T�L�T�T�T�T�T����T�L�������T�T�|���T�T�T�T�T�T�������\�T�\܌����������T�T�������\�\�\�T�\������L�T�����������\�T�T�����T�L�T�T�T�T�T���|�T�T�������L�T�|�����T�T�T�\�T�������\�T�����܌���T�L�T�������\�T�\�\�\�������T�L�T��܌�����T�\�L�������T�T�T�T�T�����|�T�T�������D�T�|�������T�L�T�\�������T�\�|���܄���T�L�T�����T�\�T�����\�T�����T�T�T܄������\�\�T�������T�T�T�L�������|�T�L�������\�T�|������T�T�\�T�������\�T�|�܄��܄�T�L�T�������\�T�\�����d�\�������T�T�T�܌����|�\�T�������T�T�T���������|�T�T�������\�\�|�t�������T�T�\�������T�\���|����L�T�������\�\�\���������\�\����ܔ�T�\����|���T�\�������T�T�T���������T�T�������T�\�t�|�������T�T�\�������T�T�|�����L�T�L�������T�\�T���������T�\�������T�T�t�܌�|���T�\�������T�L�T��������t�T�T���������\�T�|������t�T�\�������T�T��|�܌��L�T�L�������\�T�����������\�\�\������T�T�܌��|܄�\�\�T�����T�T�T�����|��T�T�����������\�T�|�|�����|�T�\�����T�L�\�|�����L�T�������\�T�\�����������|�\�T�������T�T����|��d�T�T�����T�\�T�����|��T�T�����������l�\�T�|��|�|�T�\�����T�T�d�|����T�L�T�����d�T�\�������������\�T�\�����T�T�\�܄�|��|�L�T�����T�T�T���|��T�T�l�������������T�\�t�|�|�|�T�\�����T�L�|܄�|���T�T�������T�\�T�������������|�\�T������T�T����|��T�L�����T�T�T���|�l�T�T�����������������T�\�t�|��\�T�����T�L܄����T�T�T�����d�\�\�|��������������T�\�T�����T�T�T�܌���T�L�����\�T�T���T�T�������������������T�T�t�|�|�T�\�����T�T�|����\�T�������\�\�T�|�������������|�\�\�\�������T�\����|�L�T�����\�T�T��l�T�T�������������������t�T�T�|��\�\�����T�L���܄�T�T�������T�\�\��������������|�\�\�T�������T�T܄��܄�T�L�����T�T�T��T�T�l���������������������l�\�L�\�\�\�����T�T���t�\�T�T�����\�T�T�\���������������\�\�T�T�����T�T�\�t�܄�T�T�����T�T�T�L�T�t�������������������������T�\�\�T�\�����L�T�|��T�T�T�������\�T�\�\܌��������������\�\�\�T�\�����T�T�T��|�L�T�����T�T�T�L�T�����������������������������L�T�\�\�����T�L�T�T�T�T�T�����T�\�T�T�\܌��������������\�\��T�T�T��ܜ�T�T�T�T�L�T�����\�T�T�T�������������������������������T�T�T�\�����T�T�T�T�T�T�������T�T�T�\�\���������������\�\��\�T�T�����T�T�T�T�T�T�����T�T�T�T���������������������������������L�\�T�����T�T�T�T�T�T�����d�T�T܄�\�\�܌�������������\�\���T�T����ܜ�T�T�T�L�T�����T�T�T�������������������������������������T�\�����T�T�T�T�T�������T�T���\�\���������������\�\܌����T�T�����T�T�T�T�T�����T�T���������������������������������������\�\�����T�T�T�T���������T�T�܌�\�\���������������\�\�����T�T�������T�\�T�L�����T�T�����������������������������������������������T�L�T�T�������T�T��܌��\�\���������������\�\�������T�T�����T�T�T�T�������������������������������������������������������T�T�T�������T�T�\�����\�\�܌����������܌��\�\�������T�T�������\�T�T�������������������������������������������������������T�L�T�������T�T����܌��\�\���������������\�\�������T�T�T�����T�T�T�������������������������������������������������������T�T�T�����T�T�T����܌��\�\�܌�������������\�\��������T�T�����T�T�\�������������������������������������������������������T�T�T�����T�\��������\�\������������܌��\�\��|������T�T�����T�T�T�������������������������������������������������������T�\�T�����T�T������\�\����������\�\������T�\�����\�T�T�������������������������������������������������������T�\�T�����T�T�\�T�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�T�����T�T�T�������������������������������������������������������T�\�T�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�����\�T�T�������������������������������������������������������T�\�T�����T�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�\�����T�\�T�������������������������������������������������������T�T�\�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�����\�T�T�������������������������������������������������������T�T�\�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�\�����\�T�T�������������������������������������������������������T�T�\�����T�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�����T�T�T�������������������������������������������������������T�\�T�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�����\�T�T�������������������������������������������������������T�\�T�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�����T�\�T�������������������������������������������������������T�T�\�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�T�����\�\�T�������������������������������������������������������\�T�\�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�����\�T�\�����������������������������������������������������������������\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�\�\�\�\�\�T�\���������������������������������������������������������������������������d�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�\������������������������������������ \ No newline at end of file diff --git a/rockem/gdk_fill.ppm b/rockem/gdk_fill.ppm new file mode 100644 index 0000000..ddaa32a --- /dev/null +++ b/rockem/gdk_fill.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 64 +255 +�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������|���|���|���|���|���|���|���|���|���|���|���|���|���|���|���|���|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�\�d�\�d�\�d�\�d�\�d�\�d�\�d�\�d�\�d�\�d�\�d�\�d�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�\�T�\�T�\�T�\�T�\�T�\�T�\�T�\�T�\�T�\�T�\�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�L�T�L�T�L�T�L�T�L�T�L�T�L�T�L�T�L�T�L�T�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�L�D�L�D�L�D�L�D�L�D�L�D�L�D�L�D�L�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�<�D�<�D�<�D�<�D�<�D�<�D�<�D�<�D�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�<�4�<�4�<�4�<�4�<�4�<�4�<�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�,�4�,�4�,�4�,�4�,�4�,�4�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�,�$�,�$�,�$�,�$�,�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$��$��$��$��$�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� \ No newline at end of file diff --git a/rockem/head.wav b/rockem/head.wav new file mode 100644 index 0000000..711c9eb Binary files /dev/null and b/rockem/head.wav differ diff --git a/rockem/intro.wav b/rockem/intro.wav new file mode 100644 index 0000000..f1c05e7 Binary files /dev/null and b/rockem/intro.wav differ diff --git a/rockem/punch.wav b/rockem/punch.wav new file mode 100644 index 0000000..cf99981 Binary files /dev/null and b/rockem/punch.wav differ diff --git a/rockem/punch1.wav b/rockem/punch1.wav new file mode 100644 index 0000000..f0ff8ad Binary files /dev/null and b/rockem/punch1.wav differ diff --git a/rockem/punch2.wav b/rockem/punch2.wav new file mode 100644 index 0000000..eaa2690 Binary files /dev/null and b/rockem/punch2.wav differ diff --git a/rockem/punch3.wav b/rockem/punch3.wav new file mode 100644 index 0000000..c4cedfc Binary files /dev/null and b/rockem/punch3.wav differ diff --git a/rockem/punch4.wav b/rockem/punch4.wav new file mode 100644 index 0000000..7db7faf Binary files /dev/null and b/rockem/punch4.wav differ diff --git a/rockem/random1.wav b/rockem/random1.wav new file mode 100644 index 0000000..0b808e5 Binary files /dev/null and b/rockem/random1.wav differ diff --git a/rockem/random2.wav b/rockem/random2.wav new file mode 100644 index 0000000..4f7b4aa Binary files /dev/null and b/rockem/random2.wav differ diff --git a/rockem/random3.wav b/rockem/random3.wav new file mode 100644 index 0000000..8bb4a65 Binary files /dev/null and b/rockem/random3.wav differ diff --git a/rockem/random4.wav b/rockem/random4.wav new file mode 100644 index 0000000..2a3a0fb Binary files /dev/null and b/rockem/random4.wav differ diff --git a/rockem/random5.wav b/rockem/random5.wav new file mode 100644 index 0000000..0317639 Binary files /dev/null and b/rockem/random5.wav differ diff --git a/rockem/random6.wav b/rockem/random6.wav new file mode 100644 index 0000000..4cd138d Binary files /dev/null and b/rockem/random6.wav differ diff --git a/rockem/revdn1.wav b/rockem/revdn1.wav new file mode 100644 index 0000000..b58f1a3 Binary files /dev/null and b/rockem/revdn1.wav differ diff --git a/rockem/revdn2.wav b/rockem/revdn2.wav new file mode 100644 index 0000000..ec19555 Binary files /dev/null and b/rockem/revdn2.wav differ diff --git a/rockem/revdn3.wav b/rockem/revdn3.wav new file mode 100644 index 0000000..2840af1 Binary files /dev/null and b/rockem/revdn3.wav differ diff --git a/rockem/revup1.wav b/rockem/revup1.wav new file mode 100644 index 0000000..6058df1 Binary files /dev/null and b/rockem/revup1.wav differ diff --git a/rockem/revup2.wav b/rockem/revup2.wav new file mode 100644 index 0000000..c33e3cf Binary files /dev/null and b/rockem/revup2.wav differ diff --git a/rockem/revup3.wav b/rockem/revup3.wav new file mode 100644 index 0000000..384aa59 Binary files /dev/null and b/rockem/revup3.wav differ diff --git a/rockem/rockem3d.bin b/rockem/rockem3d.bin new file mode 100644 index 0000000..a2f52af Binary files /dev/null and b/rockem/rockem3d.bin differ diff --git a/rockem/rockem3d.exe b/rockem/rockem3d.exe new file mode 100755 index 0000000..740149a Binary files /dev/null and b/rockem/rockem3d.exe differ diff --git a/rockem/rockem3d.mid b/rockem/rockem3d.mid new file mode 100644 index 0000000..b111a02 Binary files /dev/null and b/rockem/rockem3d.mid differ diff --git a/rockem/rockem3d.pal b/rockem/rockem3d.pal new file mode 100644 index 0000000..0da6e81 Binary files /dev/null and b/rockem/rockem3d.pal differ diff --git a/rockem/skmech.x b/rockem/skmech.x new file mode 100644 index 0000000..1d7aa99 --- /dev/null +++ b/rockem/skmech.x @@ -0,0 +1,3565 @@ +xof 0302txt 0064 +template Header { + <3D82AB43-62DA-11cf-AB39-0020AF71E433> + WORD major; + WORD minor; + DWORD flags; +} + +template Vector { + <3D82AB5E-62DA-11cf-AB39-0020AF71E433> + FLOAT x; + FLOAT y; + FLOAT z; +} + +template Coords2d { + <F6F23F44-7686-11cf-8F52-0040333594A3> + FLOAT u; + FLOAT v; +} + +template Matrix4x4 { + <F6F23F45-7686-11cf-8F52-0040333594A3> + array FLOAT matrix[16]; +} + +template ColorRGBA { + <35FF44E0-6C7C-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; + FLOAT alpha; +} + +template ColorRGB { + <D3E16E81-7835-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; +} + +template IndexedColor { + <1630B820-7842-11cf-8F52-0040333594A3> + DWORD index; + ColorRGBA indexColor; +} + +template Boolean { + <4885AE61-78E8-11cf-8F52-0040333594A3> + WORD truefalse; +} + +template Boolean2d { + <4885AE63-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template MaterialWrap { + <4885AE60-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template TextureFilename { + <A42790E1-7810-11cf-8F52-0040333594A3> + STRING filename; +} + +template Material { + <3D82AB4D-62DA-11cf-AB39-0020AF71E433> + ColorRGBA faceColor; + FLOAT power; + ColorRGB specularColor; + ColorRGB emissiveColor; + [...] +} + +template MeshFace { + <3D82AB5F-62DA-11cf-AB39-0020AF71E433> + DWORD nFaceVertexIndices; + array DWORD faceVertexIndices[nFaceVertexIndices]; +} + +template MeshFaceWraps { + <4885AE62-78E8-11cf-8F52-0040333594A3> + DWORD nFaceWrapValues; + Boolean2d faceWrapValues; +} + +template MeshTextureCoords { + <F6F23F40-7686-11cf-8F52-0040333594A3> + DWORD nTextureCoords; + array Coords2d textureCoords[nTextureCoords]; +} + +template MeshMaterialList { + <F6F23F42-7686-11cf-8F52-0040333594A3> + DWORD nMaterials; + DWORD nFaceIndexes; + array DWORD faceIndexes[nFaceIndexes]; + [Material] +} + +template MeshNormals { + <F6F23F43-7686-11cf-8F52-0040333594A3> + DWORD nNormals; + array Vector normals[nNormals]; + DWORD nFaceNormals; + array MeshFace faceNormals[nFaceNormals]; +} + +template MeshVertexColors { + <1630B821-7842-11cf-8F52-0040333594A3> + DWORD nVertexColors; + array IndexedColor vertexColors[nVertexColors]; +} + +template Mesh { + <3D82AB44-62DA-11cf-AB39-0020AF71E433> + DWORD nVertices; + array Vector vertices[nVertices]; + DWORD nFaces; + array MeshFace faces[nFaces]; + [...] +} + +template FrameTransformMatrix { + <F6F23F41-7686-11cf-8F52-0040333594A3> + Matrix4x4 frameMatrix; +} + +template Frame { + <3D82AB46-62DA-11cf-AB39-0020AF71E433> + [...] +} + +template FloatKeys { + <10DD46A9-775B-11cf-8F52-0040333594A3> + DWORD nValues; + array FLOAT values[nValues]; +} + +template TimedFloatKeys { + <F406B180-7B3B-11cf-8F52-0040333594A3> + DWORD time; + FloatKeys tfkeys; +} + +template AnimationKey { + <10DD46A8-775B-11cf-8F52-0040333594A3> + DWORD keyType; + DWORD nKeys; + array TimedFloatKeys keys[nKeys]; +} + +template AnimationOptions { + <E2BF56C0-840F-11cf-8F52-0040333594A3> + DWORD openclosed; + DWORD positionquality; +} + +template Animation { + <3D82AB4F-62DA-11cf-AB39-0020AF71E433> + [...] +} + +template AnimationSet { + <3D82AB50-62DA-11cf-AB39-0020AF71E433> + [Animation] +} + +Header { + 1; + 0; + 1; +} + +Material x3ds_mat_BLUEPLASTIC { + 0.043137, 0.152941, 0.650980, 1.000000;; + 23.600000; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; +} +Material x3ds_mat_01MECHHAND { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHHN.GIF"; + } +} +Material x3ds_mat_02MECHARM { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHLA.GIF"; + } +} +Material x3ds_mat_01GROIN { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHGR.GIF"; + } +} +Material x3ds_mat_02MECHLEG { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHLL.GIF"; + } +} +Material x3ds_mat_01MECHLEG { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHUL.GIF"; + } +} +Material x3ds_mat_01HEAD { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHJD.GIF"; + } +} +Material x3ds_mat_01BACK { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.400000; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHBK.GIF"; + } +} +Material x3ds_mat_01MECHARM { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHUA.GIF"; + } +} +Material x3ds_mat_01CHEST { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.400000; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHCH.GIF"; + } +} + +Frame x3ds_Groin { + FrameTransformMatrix { + 1.000000, -0.000000, 0.000000, 0.000000, + 0.000000, 0.000000, -1.000000, 0.000000, + 0.000000, 1.000000, 0.000000, 0.000000, + 0.000000, 35.534382, 1.024473, 1.000000;; + } + Mesh Groin { + + 31; + -2.000034; -0.000005; -10.091249;, + -0.555553; -0.000005; -10.091249;, + 1.666685; -0.000005; -10.091249;, + -1.192545; -7.018517; -6.581245;, + -3.066506; -0.638034; -6.581247;, + -2.555454; 5.104384; -6.581249;, + -0.851815; 7.018556; -6.581249;, + 0.851807; 7.018508; -6.581249;, + 1.192535; -7.018472; -6.581245;, + -2.333362; -11.356157; 3.071276;, + -6.000068; -1.032373; 3.071294;, + -5.000067; 8.258990; 3.071271;, + -1.666681; 11.356154; 3.071271;, + 1.666685; 11.356246; 3.071271;, + 5.000068; 8.259124; 3.071271;, + 6.000000; -1.032373; 3.071272;, + 2.333369; -11.356207; 3.071276;, + -7.000064; -10.455878; 5.703798;, + -17.999998; -1.012086; 5.703774;, + -15.000135; 7.487373; 5.703794;, + -5.000067; 10.320599; 5.703794;, + 15.000135; 7.487417; 5.703794;, + 17.999998; -1.012087; 5.703772;, + 7.000072; -10.455922; 5.703798;, + -5.833400; -8.955488; 10.091302;, + -15.000134; -0.814139; 10.091294;, + -12.499999; 6.513080; 10.091298;, + -4.166667; 8.955393; 10.091298;, + 12.500135; 6.513032; 10.091298;, + 15.000135; -0.814141; 10.091298;, + 5.833403; -8.955536; 10.091299;; + + 53; + 3;1,4,0;, + 3;1,3,4;, + 3;0,5,1;, + 3;0,4,5;, + 3;1,5,6;, + 3;1,7,2;, + 3;1,6,7;, + 3;2,3,1;, + 3;2,8,3;, + 3;3,10,4;, + 3;3,9,10;, + 3;4,11,5;, + 3;4,10,11;, + 3;5,12,6;, + 3;5,11,12;, + 3;6,13,7;, + 3;6,12,13;, + 3;7,13,14;, + 3;7,15,2;, + 3;7,14,15;, + 3;2,16,8;, + 3;2,15,16;, + 3;8,9,3;, + 3;8,16,9;, + 3;9,18,10;, + 3;9,17,18;, + 3;10,19,11;, + 3;10,18,19;, + 3;11,20,12;, + 3;11,19,20;, + 3;12,20,13;, + 3;13,21,14;, + 3;14,22,15;, + 3;14,21,22;, + 3;15,23,16;, + 3;15,22,23;, + 3;16,17,9;, + 3;16,23,17;, + 3;17,25,18;, + 3;17,24,25;, + 3;18,26,19;, + 3;18,25,26;, + 3;19,27,20;, + 3;19,26,27;, + 3;20,27,13;, + 3;13,28,21;, + 3;13,27,28;, + 3;21,29,22;, + 3;21,28,29;, + 3;22,30,23;, + 3;22,29,30;, + 3;23,24,17;, + 3;23,30,24;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01GROIN} + } + MeshNormals { + 64; + -0.000000;-0.983877;-0.178844;, + -0.599572;0.408149;-0.688424;, + -0.560307;-0.381698;-0.735093;, + 0.000000;0.508170;-0.861257;, + -0.000000;-0.447290;-0.894389;, + 0.559687;0.421739;-0.713363;, + -0.000000;-0.447290;-0.894389;, + 0.937160;-0.239286;-0.253915;, + -0.880351;-0.277520;-0.384663;, + 0.000009;-0.721590;-0.692320;, + -0.680092;-0.595592;-0.427487;, + -0.956486;0.091041;-0.277212;, + -0.776351;0.298631;-0.555067;, + -0.612329;0.585592;-0.531163;, + -0.595763;0.530237;-0.603254;, + 0.000020;0.721585;-0.692326;, + 0.573074;0.533170;-0.622347;, + 0.634858;0.683287;-0.360657;, + 0.000014;-0.721592;-0.692319;, + 0.969727;-0.158439;-0.185813;, + -0.603915;-0.361813;-0.710196;, + 0.000004;-0.998923;-0.046402;, + -0.776502;-0.254344;-0.576501;, + -0.537039;0.077572;-0.839983;, + -0.815733;0.081073;-0.572719;, + -0.490500;0.710156;-0.505063;, + -0.643035;0.648313;-0.407671;, + -0.000027;0.999717;-0.023792;, + -0.010253;0.995713;0.091927;, + 0.398539;0.900274;-0.175139;, + 0.488511;0.525776;-0.696359;, + 0.507328;0.077991;-0.858217;, + 0.768552;0.139116;-0.624480;, + 0.584865;-0.268944;-0.765246;, + 0.845605;-0.234038;-0.479769;, + -0.000011;-0.998923;-0.046406;, + -0.654640;-0.753300;0.063125;, + -0.000010;-0.946205;0.323569;, + -0.582828;-0.600451;-0.547512;, + -0.943651;0.328187;0.042606;, + -0.654989;0.198844;-0.729006;, + -0.275500;0.960845;0.029596;, + -0.400693;0.869473;-0.288898;, + -0.014416;0.942382;0.334229;, + 0.328384;0.846238;-0.419578;, + 0.943441;0.328185;0.047052;, + 0.657040;0.204764;-0.725514;, + 0.655845;-0.753077;-0.052365;, + 0.593011;-0.504799;-0.627309;, + -0.000003;-0.946197;0.323591;, + -0.609542;-0.686312;0.396779;, + -0.000003;-0.946203;0.323573;, + -0.598574;-0.685369;0.414704;, + -0.799848;0.272917;0.534565;, + -0.802248;0.278457;0.528072;, + -0.263482;0.899018;0.349777;, + -0.132000;0.918501;0.372736;, + -0.028788;0.952884;0.301965;, + 0.168538;0.913545;0.370176;, + 0.807613;0.275554;0.521374;, + 0.802809;0.278602;0.527141;, + 0.596840;-0.672007;0.438393;, + 0.597512;-0.684374;0.417866;, + -0.000004;-0.946204;0.323571;; + 53; + 3;2,10,0;, + 3;2,8,10;, + 3;1,12,3;, + 3;1,11,12;, + 3;2,13,14;, + 3;3,16,5;, + 3;3,15,16;, + 3;6,9,4;, + 3;6,18,9;, + 3;8,22,10;, + 3;8,20,22;, + 3;11,24,12;, + 3;11,23,24;, + 3;13,26,14;, + 3;13,25,26;, + 3;15,28,16;, + 3;15,27,28;, + 3;17,29,30;, + 3;16,32,5;, + 3;16,31,32;, + 3;7,34,19;, + 3;7,33,34;, + 3;18,21,9;, + 3;18,35,21;, + 3;20,38,22;, + 3;20,36,38;, + 3;23,40,24;, + 3;23,39,40;, + 3;25,42,26;, + 3;25,41,42;, + 3;27,43,28;, + 3;29,44,30;, + 3;31,46,32;, + 3;31,45,46;, + 3;33,48,34;, + 3;33,47,48;, + 3;35,37,21;, + 3;35,49,37;, + 3;36,52,38;, + 3;36,50,52;, + 3;39,54,40;, + 3;39,53,54;, + 3;41,56,42;, + 3;41,55,56;, + 3;43,57,28;, + 3;29,58,44;, + 3;29,56,58;, + 3;45,60,46;, + 3;45,59,60;, + 3;47,62,48;, + 3;47,61,62;, + 3;49,51,37;, + 3;49,63,51;; + } + MeshTextureCoords { + 31; + 0.546412;0.933469;, + 0.511654;0.933469;, + 0.458180;0.933469;, + 0.526982;0.782985;, + 0.572075;0.782985;, + 0.559777;0.782985;, + 0.518783;0.782985;, + 0.477788;0.782985;, + 0.469589;0.782985;, + 0.554433;0.369152;, + 0.642665;0.369151;, + 0.618602;0.369152;, + 0.538391;0.369152;, + 0.458180;0.369152;, + 0.377969;0.369152;, + 0.353907;0.369152;, + 0.442138;0.369152;, + 0.666728;0.256288;, + 0.931421;0.256289;, + 0.859233;0.256288;, + 0.618602;0.256288;, + 0.137338;0.256288;, + 0.065150;0.256289;, + 0.329843;0.256288;, + 0.638654;0.068183;, + 0.859233;0.068183;, + 0.799074;0.068183;, + 0.598548;0.068183;, + 0.197495;0.068183;, + 0.137338;0.068183;, + 0.357917;0.068183;; + } + } + + Frame x3ds_Chest { + FrameTransformMatrix { + 1.000000, 0.000000, 0.000000, 0.000000, + -0.000000, 1.000000, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + -0.426950, 1.024469, 11.366162, 1.000000;; + } + Mesh Chest { + + 40; + -5.406384; -9.499996; -0.774913;, + -14.573050; -1.772723; -0.774910;, + -12.073050; 5.181822; -0.774907;, + -3.739717; 7.500004; -0.774907;, + 4.593616; 7.500004; -0.774907;, + 12.926949; 5.181822; -0.774910;, + 15.426949; -1.772723; -0.774914;, + 6.260283; -9.499996; -0.774913;, + -8.859015; -15.499998; 25.225092;, + -23.451246; -1.491749; 25.225090;, + -19.471548; 11.115673; 25.225096;, + -6.205883; 15.318148; 25.225096;, + 7.059781; 15.318148; 25.225096;, + 20.325445; 11.115673; 25.225096;, + 24.305143; -1.491749; 25.225090;, + 9.712914; -15.499998; 25.225092;, + -10.054240; -15.499997; 34.225082;, + -33.573051; -1.863631; 34.225082;, + -22.032743; 10.409095; 34.225082;, + -7.059614; 14.500003; 34.225082;, + 7.913515; 14.500003; 34.225082;, + 22.886644; 10.409095; 34.225082;, + 34.426949; -1.863631; 34.225082;, + 10.908140; -15.499997; 34.225082;, + -10.850827; -11.500252; 40.225082;, + -31.573050; -2.106038; 41.225090;, + -23.739717; 8.348755; 42.225098;, + -7.628605; 9.167019; 40.225098;, + 8.482507; 9.167019; 40.225098;, + 24.593618; 8.348755; 42.225090;, + 32.426949; -2.106038; 41.225090;, + 11.704728; -11.500252; 40.225082;, + -8.517495; -9.499994; 43.225082;, + -18.573050; -2.227266; 43.225090;, + -14.573050; 4.318189; 43.225098;, + -5.961939; 6.500007; 43.225098;, + 6.815839; 6.500007; 43.225090;, + 15.426950; 4.318189; 43.225090;, + 19.426950; -2.227266; 43.225090;, + 9.371394; -9.499994; 43.225082;; + + 70; + 3;0,9,1;, + 3;1,9,2;, + 3;0,8,9;, + 3;9,10,2;, + 3;2,11,3;, + 3;2,10,11;, + 3;3,12,4;, + 3;3,11,12;, + 3;4,13,5;, + 3;4,12,13;, + 3;5,14,6;, + 3;5,13,14;, + 3;6,15,7;, + 3;6,14,15;, + 3;7,8,0;, + 3;7,15,8;, + 3;8,17,9;, + 3;8,16,17;, + 3;9,18,10;, + 3;9,17,18;, + 3;10,19,11;, + 3;10,18,19;, + 3;11,20,12;, + 3;11,19,20;, + 3;12,21,13;, + 3;12,20,21;, + 3;13,22,14;, + 3;13,21,22;, + 3;14,23,15;, + 3;14,22,23;, + 3;15,16,8;, + 3;15,23,16;, + 3;16,25,17;, + 3;16,24,25;, + 3;17,26,18;, + 3;17,25,26;, + 3;18,27,19;, + 3;18,26,27;, + 3;19,28,20;, + 3;19,27,28;, + 3;20,29,21;, + 3;20,28,29;, + 3;21,30,22;, + 3;21,29,30;, + 3;22,31,23;, + 3;22,30,31;, + 3;23,24,16;, + 3;23,31,24;, + 3;24,33,25;, + 3;24,32,33;, + 3;25,34,26;, + 3;25,33,34;, + 3;26,35,27;, + 3;26,34,35;, + 3;27,36,28;, + 3;27,35,36;, + 3;28,37,29;, + 3;28,36,37;, + 3;29,38,30;, + 3;29,37,38;, + 3;30,39,31;, + 3;30,38,39;, + 3;31,32,24;, + 3;31,39,32;, + 3;37,39,38;, + 3;36,39,37;, + 3;36,32,39;, + 3;35,32,36;, + 3;35,33,32;, + 3;34,33,35;; + MeshMaterialList { + 2; + 70; + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_01BACK} + {x3ds_mat_01CHEST} + } + MeshNormals { + 88; + -0.650995;-0.723751;-0.228890;, + 0.000000;-0.974391;-0.224860;, + -0.630534;-0.747987;-0.207225;, + -0.894967;0.321720;-0.309080;, + -0.899082;0.303417;-0.315579;, + -0.272342;0.915691;-0.295533;, + -0.255614;0.918875;-0.300549;, + 0.000000;0.957642;-0.287961;, + 0.000000;0.957642;-0.287961;, + 0.272548;0.916640;-0.292383;, + 0.256974;0.923763;-0.283949;, + 0.899082;0.303417;-0.315579;, + 0.894967;0.321720;-0.309080;, + 0.649687;-0.721872;-0.238346;, + 0.623476;-0.739614;-0.253474;, + 0.000000;-0.974391;-0.224860;, + -0.592597;-0.735803;-0.327753;, + 0.000000;-0.993577;-0.113156;, + -0.627516;-0.684776;-0.370547;, + -0.846659;0.369049;-0.383368;, + -0.915063;0.288852;-0.281468;, + -0.288159;0.954384;-0.078204;, + -0.286130;0.941081;-0.180268;, + -0.000000;0.994932;-0.100550;, + 0.000000;0.994932;-0.100550;, + 0.288029;0.953917;-0.084156;, + 0.284948;0.937354;-0.200430;, + 0.805421;0.413325;-0.424806;, + 0.840105;0.278624;-0.465394;, + 0.612424;-0.738201;-0.282836;, + 0.664713;-0.722563;-0.189894;, + 0.000000;-0.993577;-0.113156;, + -0.460440;-0.868344;0.184319;, + 0.000000;-0.957096;0.289770;, + -0.546338;-0.811570;-0.207047;, + -0.753038;0.645392;-0.128076;, + -0.789210;0.537054;-0.297861;, + -0.169555;0.935537;0.309874;, + -0.269038;0.931504;0.244784;, + -0.000000;0.917665;0.397355;, + 0.000000;0.917665;0.397355;, + 0.167433;0.931814;0.322007;, + 0.275612;0.957904;0.080362;, + 0.753370;0.657303;0.019667;, + 0.778010;0.578988;-0.243874;, + 0.468713;-0.883303;0.009149;, + 0.573798;-0.817112;-0.055524;, + -0.000000;-0.957096;0.289770;, + -0.309902;-0.616721;0.723613;, + 0.000000;-0.832067;0.554676;, + -0.357822;-0.755836;0.548339;, + -0.413278;0.254886;0.874205;, + -0.677530;0.516275;0.523844;, + -0.005950;0.707002;0.707186;, + -0.061460;0.847479;0.527259;, + -0.000000;0.747432;0.664339;, + 0.000000;0.747432;0.664339;, + 0.013296;0.633065;0.773985;, + 0.045031;0.769592;0.636946;, + 0.446324;0.289292;0.846821;, + 0.686668;0.532100;0.495334;, + 0.318002;-0.685018;0.655458;, + 0.392151;-0.818553;0.419747;, + 0.000000;-0.832067;0.554676;, + -0.415209;-0.574084;0.705712;, + 0.000000;-0.832017;0.554750;, + 0.000000;-0.000000;1.000000;, + -0.283804;-0.500875;0.817667;, + -0.150574;0.092016;0.984307;, + 0.000000;-0.000001;1.000000;, + -0.131964;0.040870;0.990412;, + -0.039366;0.155367;0.987072;, + 0.000000;-0.000001;1.000000;, + 0.001540;0.487185;0.873297;, + 0.000000;0.747367;0.664412;, + 0.000001;-0.000001;1.000000;, + 0.000000;0.747366;0.664413;, + 0.173828;0.686055;0.706479;, + -0.000000;-0.000000;1.000000;, + 0.042888;0.569361;0.820968;, + 0.085553;0.052282;0.994961;, + -0.000001;-0.000000;1.000000;, + 0.118785;0.035793;0.992275;, + 0.150620;-0.208254;0.966408;, + -0.000001;-0.000000;1.000000;, + 0.223800;-0.466352;0.855821;, + 0.000000;-0.832017;0.554750;, + -0.000001;-0.000000;1.000000;; + 70; + 3;0,18,2;, + 3;3,19,4;, + 3;0,16,18;, + 3;19,20,4;, + 3;5,22,6;, + 3;5,21,22;, + 3;7,24,8;, + 3;7,23,24;, + 3;9,26,10;, + 3;9,25,26;, + 3;11,28,12;, + 3;11,27,28;, + 3;13,30,14;, + 3;13,29,30;, + 3;15,17,1;, + 3;15,31,17;, + 3;16,34,18;, + 3;16,32,34;, + 3;19,36,20;, + 3;19,35,36;, + 3;21,38,22;, + 3;21,37,38;, + 3;23,40,24;, + 3;23,39,40;, + 3;25,42,26;, + 3;25,41,42;, + 3;27,44,28;, + 3;27,43,44;, + 3;29,46,30;, + 3;29,45,46;, + 3;31,33,17;, + 3;31,47,33;, + 3;32,50,34;, + 3;32,48,50;, + 3;35,52,36;, + 3;35,51,52;, + 3;37,54,38;, + 3;37,53,54;, + 3;39,56,40;, + 3;39,55,56;, + 3;41,58,42;, + 3;41,57,58;, + 3;43,60,44;, + 3;43,59,60;, + 3;45,62,46;, + 3;45,61,62;, + 3;47,49,33;, + 3;47,63,49;, + 3;48,67,50;, + 3;48,64,67;, + 3;51,70,52;, + 3;51,68,70;, + 3;53,73,54;, + 3;53,71,73;, + 3;55,76,56;, + 3;55,74,76;, + 3;57,79,58;, + 3;57,77,79;, + 3;59,82,60;, + 3;59,80,82;, + 3;61,85,62;, + 3;61,83,85;, + 3;63,65,49;, + 3;63,86,65;, + 3;81,87,84;, + 3;78,87,81;, + 3;78,66,87;, + 3;75,66,78;, + 3;75,69,66;, + 3;72,69,75;; + } + MeshTextureCoords { + 40; + 0.427128;1.000148;, + 0.312615;1.000148;, + 0.343846;1.000148;, + 0.447949;1.000148;, + 0.552051;1.000148;, + 0.656154;1.000148;, + 0.687385;1.000148;, + 0.572872;1.000148;, + 0.383997;0.458321;, + 0.201706;0.458321;, + 0.251421;0.458321;, + 0.417140;0.458321;, + 0.582860;0.458321;, + 0.748579;0.458321;, + 0.798294;0.458321;, + 0.616003;0.458321;, + 0.369065;0.270766;, + 0.075261;0.270766;, + 0.219426;0.270766;, + 0.406475;0.270766;, + 0.593525;0.270766;, + 0.780574;0.270766;, + 0.924739;0.270766;, + 0.630935;0.270766;, + 0.359114;0.145729;, + 0.000307;-0.000148;, + 0.198102;0.104050;, + 0.399367;0.145729;, + 0.600633;0.145729;, + 0.801898;0.104050;, + 0.999693;-0.000148;, + 0.640886;0.145729;, + 0.388263;0.083210;, + 0.262646;0.083210;, + 0.312615;0.083210;, + 0.420188;0.083210;, + 0.579812;0.083210;, + 0.687385;0.083210;, + 0.737354;0.083210;, + 0.611737;0.083210;; + } + } + + Frame x3ds_RU_Arm { + FrameTransformMatrix { + -0.965926, -0.000000, -0.258819, 0.000000, + 0.000000, -1.000000, -0.000000, 0.000000, + -0.258819, -0.000000, 0.965926, 0.000000, + -22.158115, 0.000006, 34.682274, 1.000000;; + } + Mesh RU_Arm { + + 12; + -5.501477; 0.000004; -2.449525;, + -2.458304; 6.273188; -0.692550;, + 3.628045; 6.273185; 2.821392;, + 6.671256; -0.000001; 4.578400;, + 3.628039; -6.273173; 2.821389;, + -2.458306; -6.273183; -0.692544;, + 8.608694; 0.000001; -22.981846;, + 10.805939; 4.394536; -21.713266;, + 15.200456; 4.394535; -19.176115;, + 17.397690; -0.000002; -17.907520;, + 15.200446; -4.394550; -19.176085;, + 10.805936; -4.394485; -21.713276;; + + 20; + 3;7,0,1;, + 3;6,0,7;, + 3;8,1,2;, + 3;7,1,8;, + 3;9,2,3;, + 3;8,2,9;, + 3;10,3,4;, + 3;9,3,10;, + 3;11,4,5;, + 3;10,4,11;, + 3;6,5,0;, + 3;11,5,6;, + 3;0,2,1;, + 3;0,3,2;, + 3;0,4,3;, + 3;0,5,4;, + 3;7,8,9;, + 3;7,9,10;, + 3;7,10,11;, + 3;7,11,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHARM} + } + MeshNormals { + 36; + -0.716210;0.493166;-0.493793;, + -0.719558;-0.487559;-0.494492;, + -0.499999;-0.000001;0.866026;, + -0.718101;0.487469;-0.496693;, + 0.037713;0.997151;-0.065320;, + -0.499999;-0.000001;0.866026;, + 0.037713;0.997151;-0.065320;, + 0.785987;0.493148;0.372868;, + -0.499999;-0.000001;0.866026;, + 0.788019;0.487564;0.375908;, + 0.785740;-0.493168;0.373360;, + -0.500000;0.000002;0.866026;, + 0.789195;-0.487476;0.373548;, + 0.037714;-0.997151;-0.065321;, + -0.500000;-0.000002;0.866026;, + 0.037714;-0.997151;-0.065321;, + -0.715906;-0.493147;-0.494252;, + -0.499998;0.000002;0.866027;, + -0.714286;0.498840;-0.490870;, + -0.715906;-0.493147;-0.494252;, + 0.499999;0.000001;-0.866026;, + -0.716210;0.493166;-0.493793;, + 0.037713;0.997151;-0.065320;, + 0.499996;-0.000007;-0.866027;, + 0.037713;0.997151;-0.065320;, + 0.783919;0.498709;0.369812;, + 0.499996;-0.000007;-0.866027;, + 0.785987;0.493148;0.372868;, + 0.782250;-0.498838;0.373156;, + 0.499996;-0.000007;-0.866027;, + 0.785740;-0.493168;0.373360;, + 0.037701;-0.997152;-0.065325;, + 0.499999;-0.000002;-0.866026;, + 0.037714;-0.997151;-0.065321;, + -0.712222;-0.498712;-0.493989;, + 0.500003;0.000001;-0.866024;; + 20; + 3;21,0,3;, + 3;18,0,21;, + 3;24,4,6;, + 3;22,4,24;, + 3;27,7,9;, + 3;25,7,27;, + 3;30,10,12;, + 3;28,10,30;, + 3;33,13,15;, + 3;31,13,33;, + 3;19,16,1;, + 3;34,16,19;, + 3;2,8,5;, + 3;2,11,8;, + 3;2,14,11;, + 3;2,17,14;, + 3;23,26,29;, + 3;23,29,32;, + 3;23,32,35;, + 3;23,35,20;; + } + MeshTextureCoords { + 12; + 0.250000;-0.011257;, + 0.081267;-0.011257;, + 0.918734;-0.011257;, + 0.750000;-0.011257;, + 0.581266;-0.011257;, + 0.418733;-0.011257;, + 0.250000;1.011257;, + 0.083334;1.011257;, + 0.916666;1.011257;, + 0.750000;1.011257;, + 0.583334;1.011257;, + 0.416666;1.011257;; + } + } + + Frame x3ds_RL_Arm { + FrameTransformMatrix { + 1.000000, -0.000000, -0.000000, 0.000000, + -0.000000, 1.000000, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + 13.822151, 0.000003, -20.565968, 1.000000;; + } + Mesh RL_Arm { + + 24; + 8.013477; 0.000005; -35.874058;, + 12.494552; 9.237309; -33.286903;, + 21.456678; 9.237304; -28.112616;, + 25.937769; -0.000003; -25.525463;, + 21.456680; -9.237155; -28.112616;, + 12.494545; -9.237303; -33.286919;, + -4.837206; 0.000002; -3.067563;, + -2.639963; 4.394549; -1.798980;, + 1.754547; 4.394535; 0.738177;, + 3.951795; -0.000002; 2.006753;, + 1.754554; -4.394537; 0.738174;, + -2.639967; -4.394535; -1.798978;, + 5.120436; -0.663049; -1.830179;, + 10.395203; -0.663048; -7.844885;, + 9.816457; -0.663051; 4.948281;, + 5.120435; 0.336947; -1.830175;, + 10.395203; 0.336952; -7.844885;, + 9.816456; 0.336949; 4.948285;, + 15.652800; -0.663047; -15.309710;, + 20.927570; -0.663046; -21.324427;, + 20.348825; -0.663049; -8.531265;, + 15.652801; 0.336953; -15.309710;, + 20.927568; 0.336950; -21.324423;, + 20.348825; 0.336947; -8.531264;; + + 32; + 3;0,7,1;, + 3;0,6,7;, + 3;1,8,2;, + 3;1,7,8;, + 3;2,9,3;, + 3;2,8,9;, + 3;3,10,4;, + 3;3,9,10;, + 3;4,11,5;, + 3;4,10,11;, + 3;5,6,0;, + 3;5,11,6;, + 3;2,0,1;, + 3;3,0,2;, + 3;4,0,3;, + 3;5,0,4;, + 3;8,7,9;, + 3;9,7,10;, + 3;10,7,11;, + 3;11,7,6;, + 3;12,13,14;, + 3;13,17,14;, + 3;13,16,17;, + 3;14,15,12;, + 3;14,17,15;, + 3;16,15,17;, + 3;18,19,20;, + 3;19,23,20;, + 3;19,22,23;, + 3;20,21,18;, + 3;20,23,21;, + 3;22,21,23;; + MeshMaterialList { + 2; + 32; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHARM} + {x3ds_mat_BLUEPLASTIC} + } + MeshNormals { + 64; + -0.811971;0.490075;-0.317063;, + -0.814533;-0.484496;-0.319062;, + 0.500000;0.000000;-0.866025;, + -0.815268;0.484377;-0.317359;, + -0.068845;0.990475;0.119243;, + 0.500000;0.000000;-0.866025;, + -0.068845;0.990475;0.119243;, + 0.679969;0.490008;0.545467;, + 0.500000;0.000000;-0.866025;, + 0.683580;0.484497;0.545876;, + 0.680568;-0.490079;0.544656;, + 0.500000;0.000001;-0.866025;, + 0.682472;-0.484384;0.547362;, + -0.068832;-0.990476;0.119249;, + 0.500000;-0.000000;-0.866025;, + -0.068832;-0.990476;0.119249;, + -0.812373;-0.490007;-0.316139;, + 0.500001;0.000001;-0.866025;, + -0.808639;0.495752;-0.316753;, + -0.812373;-0.490007;-0.316139;, + -0.500002;0.000000;0.866024;, + -0.811971;0.490075;-0.317063;, + -0.068842;0.990475;0.119244;, + -0.499998;0.000000;0.866027;, + -0.068845;0.990475;0.119243;, + 0.676328;0.495497;0.545035;, + -0.499998;0.000000;0.866027;, + 0.679969;0.490008;0.545467;, + 0.678635;-0.495752;0.541927;, + -0.499998;0.000000;0.866027;, + 0.680568;-0.490079;0.544656;, + -0.068843;-0.990476;0.119239;, + -0.499999;-0.000001;0.866026;, + -0.068832;-0.990476;0.119249;, + -0.810178;-0.495496;-0.313202;, + -0.499996;0.000000;0.866028;, + -0.000000;-1.000000;-0.000000;, + -0.822008;-0.000003;0.569476;, + -0.000000;-1.000000;-0.000000;, + 0.998978;0.000001;0.045192;, + -0.000000;-1.000000;-0.000000;, + 0.998978;0.000001;0.045192;, + -0.822008;-0.000003;0.569476;, + -0.822008;-0.000003;0.569476;, + -0.000001;1.000000;0.000000;, + 0.998978;-0.000000;0.045193;, + -0.000001;1.000000;0.000000;, + 0.998978;0.000001;0.045192;, + -0.822008;-0.000003;0.569476;, + -0.000001;1.000000;0.000000;, + -0.000000;-1.000000;-0.000000;, + -0.822007;0.000001;0.569477;, + -0.000000;-1.000000;-0.000000;, + 0.998978;-0.000000;0.045192;, + -0.000000;-1.000000;-0.000000;, + 0.998978;-0.000000;0.045192;, + -0.822007;0.000001;0.569477;, + -0.822007;0.000001;0.569477;, + 0.000001;1.000000;0.000000;, + 0.998978;0.000002;0.045192;, + 0.000001;1.000000;0.000000;, + 0.998978;-0.000000;0.045192;, + -0.822007;-0.000001;0.569477;, + 0.000001;1.000000;0.000000;; + 32; + 3;0,21,3;, + 3;0,18,21;, + 3;4,24,6;, + 3;4,22,24;, + 3;7,27,9;, + 3;7,25,27;, + 3;10,30,12;, + 3;10,28,30;, + 3;13,33,15;, + 3;13,31,33;, + 3;16,19,1;, + 3;16,34,19;, + 3;8,2,5;, + 3;11,2,8;, + 3;14,2,11;, + 3;17,2,14;, + 3;26,23,29;, + 3;29,23,32;, + 3;32,23,35;, + 3;35,23,20;, + 3;36,38,40;, + 3;39,47,41;, + 3;39,45,47;, + 3;42,43,37;, + 3;42,48,43;, + 3;46,44,49;, + 3;50,52,54;, + 3;53,61,55;, + 3;53,59,61;, + 3;56,57,51;, + 3;56,62,57;, + 3;60,58,63;; + } + MeshTextureCoords { + 24; + 0.250000;2.476449;, + 0.081266;2.476449;, + 0.918734;2.476449;, + 0.750000;2.476449;, + 0.581266;2.476449;, + 0.418734;2.476449;, + 0.250000;1.042238;, + 0.083334;1.042238;, + 0.916666;1.042238;, + 0.750000;1.042238;, + 0.583334;1.042238;, + 0.416666;1.042238;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_R_Hand { + FrameTransformMatrix { + -0.965926, 0.000000, -0.258819, 0.000000, + -0.258819, -0.000000, 0.965925, 0.000000, + 0.000000, 1.000000, 0.000000, 0.000000, + 17.201626, -0.532497, -26.974564, 1.000000;; + } + Mesh R_Hand { + + 8; + -6.156250; -13.356396; -4.582500;, + 6.843750; -13.356392; -4.582499;, + 3.756248; -0.356396; -2.650550;, + -3.068748; -0.356396; -2.650550;, + -6.156250; -13.356396; 4.582500;, + 6.843750; -13.356392; 4.582499;, + 3.756248; -0.356396; 2.650486;, + -3.068748; -0.356396; 2.650486;; + + 10; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHHAND} + } + MeshNormals { + 20; + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;-0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.972937;0.231073;-0.000000;, + 0.000000;0.146997;-0.989137;, + -0.972937;0.231073;-0.000000;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;, + 0.000000;-1.000000;0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.147002;0.989136;, + 0.972937;0.231073;0.000000;, + 0.000000;0.147002;0.989136;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;; + 10; + 3;0,6,3;, + 3;0,8,6;, + 3;1,13,10;, + 3;1,4,13;, + 3;5,16,14;, + 3;5,7,16;, + 3;9,11,18;, + 3;9,2,11;, + 3;12,17,19;, + 3;12,15,17;; + } + MeshTextureCoords { + 8; + 0.032627;0.773816;, + 0.032627;0.773815;, + 0.231505;-0.195808;, + 0.231505;-0.195808;, + 0.976087;0.773816;, + 0.976087;0.773815;, + 0.777202;-0.195808;, + 0.777202;-0.195808;; + } + } + } + } + } + + Frame x3ds_LU_Arm { + FrameTransformMatrix { + -0.965926, -0.000000, -0.258819, 0.000000, + 0.000000, -1.000000, -0.000000, 0.000000, + -0.258819, -0.000000, 0.965926, 0.000000, + 22.800379, 0.000008, 34.682274, 1.000000;; + } + Mesh LU_Arm { + + 12; + 5.988949; 0.000003; 0.629316;, + 2.474997; 6.273188; 0.629317;, + -4.552909; 6.273124; 0.629308;, + -8.066915; 0.000002; 0.629317;, + -4.552907; -6.273170; 0.629307;, + 2.474994; -6.273119; 0.629322;, + 4.035422; 0.000003; -24.207560;, + 1.498248; 4.394476; -24.207499;, + -3.576368; 4.394538; -24.207462;, + -6.113520; 0.000003; -24.207476;, + -3.576366; -4.394546; -24.207474;, + 1.498253; -4.394546; -24.207510;; + + 20; + 3;0,7,1;, + 3;0,6,7;, + 3;1,8,2;, + 3;1,7,8;, + 3;2,9,3;, + 3;2,8,9;, + 3;3,10,4;, + 3;3,9,10;, + 3;4,11,5;, + 3;4,10,11;, + 3;5,6,0;, + 3;5,11,6;, + 3;2,0,1;, + 3;3,0,2;, + 3;4,0,3;, + 3;5,0,4;, + 3;8,7,9;, + 3;9,7,10;, + 3;10,7,11;, + 3;11,7,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHARM} + } + MeshNormals { + 36; + 0.867150;0.493170;-0.069529;, + 0.870399;-0.487563;-0.068461;, + -0.000001;-0.000001;1.000000;, + 0.870241;0.487469;-0.071097;, + -0.000009;0.997152;-0.075422;, + -0.000001;-0.000001;1.000000;, + -0.000009;0.997152;-0.075422;, + -0.867118;0.493150;-0.070072;, + -0.000001;-0.000001;1.000000;, + -0.870397;0.487569;-0.068456;, + -0.867152;-0.493168;-0.069523;, + 0.000000;0.000001;1.000000;, + -0.870238;-0.487476;-0.071088;, + 0.000007;-0.997152;-0.075421;, + 0.000000;-0.000001;1.000000;, + 0.000007;-0.997152;-0.075421;, + 0.867118;-0.493148;-0.070077;, + -0.000002;0.000002;1.000000;, + 0.864021;0.498848;-0.067959;, + 0.867118;-0.493148;-0.070077;, + -0.000022;0.000001;-1.000000;, + 0.867150;0.493170;-0.069529;, + 0.000012;0.997151;-0.075427;, + -0.000007;0.000007;-1.000000;, + -0.000009;0.997152;-0.075422;, + -0.863800;0.498709;-0.071684;, + -0.000007;0.000007;-1.000000;, + -0.867118;0.493150;-0.070072;, + -0.864027;-0.498838;-0.067955;, + -0.000007;0.000007;-1.000000;, + -0.867152;-0.493168;-0.069523;, + -0.000001;-0.997152;-0.075423;, + -0.000002;-0.000002;-1.000000;, + 0.000007;-0.997152;-0.075421;, + 0.863799;-0.498710;-0.071691;, + -0.000007;0.000001;-1.000000;; + 20; + 3;0,21,3;, + 3;0,18,21;, + 3;4,24,6;, + 3;4,22,24;, + 3;7,27,9;, + 3;7,25,27;, + 3;10,30,12;, + 3;10,28,30;, + 3;13,33,15;, + 3;13,31,33;, + 3;16,19,1;, + 3;16,34,19;, + 3;8,2,5;, + 3;11,2,8;, + 3;14,2,11;, + 3;17,2,14;, + 3;26,23,29;, + 3;29,23,32;, + 3;32,23,35;, + 3;35,23,20;; + } + MeshTextureCoords { + 12; + 0.250000;-0.011257;, + 0.081267;-0.011257;, + 0.918734;-0.011257;, + 0.750000;-0.011257;, + 0.581266;-0.011257;, + 0.418733;-0.011257;, + 0.250000;1.011257;, + 0.083334;1.011257;, + 0.916666;1.011257;, + 0.750000;1.011257;, + 0.583334;1.011257;, + 0.416666;1.011257;; + } + } + + Frame x3ds_LL_Arm { + FrameTransformMatrix { + 1.000000, -0.000000, -0.000000, 0.000000, + -0.000000, 1.000000, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + -0.446584, 0.000005, -24.389263, 1.000000;; + } + Mesh LL_Arm { + + 24; + 9.756407; 0.000006; -35.407063;, + 4.582108; 9.237311; -35.407040;, + -5.766471; 9.237184; -35.407040;, + -10.940788; 0.000005; -35.407043;, + -5.766469; -9.237275; -35.407063;, + 4.582115; -9.237300; -35.407051;, + 4.482169; 0.000002; -0.570457;, + 1.945006; 4.394486; -0.570453;, + -3.129325; 4.394474; -0.570462;, + -5.666486; 0.000001; -0.570473;, + -3.129334; -4.394471; -0.570465;, + 1.945009; -4.394471; -0.570457;, + -4.525237; -0.663046; -4.414725;, + -6.085963; -0.663051; -12.261003;, + -11.981339; -0.663046; -0.892426;, + -4.525237; 0.336950; -4.414725;, + -6.085961; 0.336952; -12.261005;, + -11.981338; 0.336954; -0.892433;, + -6.906761; -0.663049; -21.354527;, + -8.467486; -0.663040; -29.200804;, + -14.362860; -0.663049; -17.832241;, + -6.906761; 0.336958; -21.354527;, + -8.467486; 0.336956; -29.200804;, + -14.362861; 0.336954; -17.832237;; + + 32; + 3;7,0,1;, + 3;6,0,7;, + 3;8,1,2;, + 3;7,1,8;, + 3;9,2,3;, + 3;8,2,9;, + 3;10,3,4;, + 3;9,3,10;, + 3;11,4,5;, + 3;10,4,11;, + 3;6,5,0;, + 3;11,5,6;, + 3;0,2,1;, + 3;0,3,2;, + 3;0,4,3;, + 3;0,5,4;, + 3;7,8,9;, + 3;7,9,10;, + 3;7,10,11;, + 3;7,11,6;, + 3;13,12,14;, + 3;17,13,14;, + 3;16,13,17;, + 3;15,14,12;, + 3;17,14,15;, + 3;15,16,17;, + 3;19,18,20;, + 3;23,19,20;, + 3;22,19,23;, + 3;21,20,18;, + 3;23,20,21;, + 3;21,22,23;; + MeshMaterialList { + 2; + 32; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHARM} + {x3ds_mat_BLUEPLASTIC} + } + MeshNormals { + 64; + 0.861718;0.490078;0.131402;, + 0.864937;-0.484496;0.130951;, + -0.000000;0.000002;-1.000000;, + 0.864723;0.484376;0.132795;, + -0.000012;0.990475;0.137689;, + -0.000000;0.000002;-1.000000;, + -0.000012;0.990475;0.137689;, + -0.861601;0.490013;0.132404;, + -0.000000;0.000002;-1.000000;, + -0.864933;0.484503;0.130952;, + -0.861717;-0.490079;0.131403;, + -0.000001;0.000001;-1.000000;, + -0.864721;-0.484379;0.132795;, + -0.000003;-0.990475;0.137691;, + -0.000001;0.000002;-1.000000;, + -0.000003;-0.990475;0.137691;, + 0.861603;-0.490010;0.132403;, + 0.000001;-0.000002;-1.000000;, + 0.858676;0.495758;0.130003;, + 0.861603;-0.490010;0.132403;, + 0.000001;-0.000000;1.000000;, + 0.861718;0.490078;0.131402;, + -0.000003;0.990475;0.137691;, + -0.000002;-0.000002;1.000000;, + -0.000012;0.990475;0.137689;, + -0.858232;0.495502;0.133849;, + -0.000002;-0.000002;1.000000;, + -0.861601;0.490013;0.132404;, + -0.858676;-0.495757;0.130005;, + -0.000002;-0.000002;1.000000;, + -0.861717;-0.490079;0.131403;, + -0.000000;-0.990475;0.137691;, + -0.000003;0.000000;1.000000;, + -0.000003;-0.990475;0.137691;, + 0.858232;-0.495502;0.133850;, + -0.000002;-0.000000;1.000000;, + 0.000000;-1.000000;0.000001;, + 0.427141;0.000000;0.904185;, + 0.000000;-1.000000;0.000001;, + -0.887737;-0.000002;-0.460352;, + 0.000000;-1.000000;0.000001;, + -0.887737;-0.000002;-0.460352;, + 0.427141;0.000000;0.904185;, + 0.427141;0.000000;0.904185;, + 0.000001;1.000000;0.000000;, + -0.887737;-0.000000;-0.460352;, + 0.000001;1.000000;0.000000;, + -0.887737;-0.000002;-0.460352;, + 0.427141;0.000006;0.904185;, + 0.000001;1.000000;0.000000;, + -0.000001;-1.000000;-0.000001;, + 0.427140;-0.000000;0.904185;, + -0.000001;-1.000000;-0.000001;, + -0.887737;0.000001;-0.460352;, + -0.000001;-1.000000;-0.000001;, + -0.887737;0.000001;-0.460352;, + 0.427140;-0.000000;0.904185;, + 0.427140;-0.000000;0.904185;, + -0.000001;1.000000;-0.000000;, + -0.887737;0.000000;-0.460352;, + -0.000001;1.000000;-0.000000;, + -0.887737;0.000001;-0.460352;, + 0.427140;-0.000003;0.904185;, + -0.000001;1.000000;-0.000000;; + 32; + 3;21,0,3;, + 3;18,0,21;, + 3;24,4,6;, + 3;22,4,24;, + 3;27,7,9;, + 3;25,7,27;, + 3;30,10,12;, + 3;28,10,30;, + 3;33,13,15;, + 3;31,13,33;, + 3;19,16,1;, + 3;34,16,19;, + 3;2,8,5;, + 3;2,11,8;, + 3;2,14,11;, + 3;2,17,14;, + 3;23,26,29;, + 3;23,29,32;, + 3;23,32,35;, + 3;23,35,20;, + 3;38,36,40;, + 3;47,39,41;, + 3;45,39,47;, + 3;43,42,37;, + 3;48,42,43;, + 3;44,46,49;, + 3;52,50,54;, + 3;61,53,55;, + 3;59,53,61;, + 3;57,56,51;, + 3;62,56,57;, + 3;58,60,63;; + } + MeshTextureCoords { + 24; + 0.250000;2.476449;, + 0.081266;2.476449;, + 0.918734;2.476449;, + 0.750000;2.476449;, + 0.581266;2.476449;, + 0.418734;2.476449;, + 0.250000;1.042238;, + 0.083334;1.042238;, + 0.916666;1.042238;, + 0.750000;1.042238;, + 0.583334;1.042238;, + 0.416666;1.042238;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_L_Hand { + FrameTransformMatrix { + -0.965926, 0.000000, -0.258819, 0.000000, + -0.258819, -0.000000, 0.965925, 0.000000, + 0.000000, 1.000000, 0.000000, 0.000000, + -1.719950, -0.532492, -32.044582, 1.000000;; + } + Mesh L_Hand { + + 8; + -6.357616; -13.356400; -4.582500;, + 6.642384; -13.356396; -4.582499;, + 3.554882; -0.356400; -2.650550;, + -3.270115; -0.356400; -2.650550;, + -6.357616; -13.356400; 4.582500;, + 6.642384; -13.356396; 4.582499;, + 3.554882; -0.356399; 2.650486;, + -3.270115; -0.356399; 2.650486;; + + 10; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHHAND} + } + MeshNormals { + 20; + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;-0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.972937;0.231073;-0.000000;, + 0.000000;0.146997;-0.989137;, + -0.972937;0.231073;-0.000000;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;, + 0.000000;-1.000000;0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.147002;0.989136;, + 0.972937;0.231073;0.000000;, + 0.000000;0.147002;0.989136;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;; + 10; + 3;0,6,3;, + 3;0,8,6;, + 3;1,13,10;, + 3;1,4,13;, + 3;5,16,14;, + 3;5,7,16;, + 3;9,11,18;, + 3;9,2,11;, + 3;12,17,19;, + 3;12,15,17;; + } + MeshTextureCoords { + 8; + 0.032628;0.773816;, + 0.032628;0.773815;, + 0.231506;-0.195808;, + 0.231506;-0.195808;, + 0.976087;0.773816;, + 0.976087;0.773815;, + 0.777203;-0.195808;, + 0.777203;-0.195808;; + } + } + } + } + } + + Frame x3ds_Head { + FrameTransformMatrix { + 0.996195, -0.087156, 0.000000, 0.000000, + -0.087156, -0.996195, -0.000000, 0.000000, + 0.000000, 0.000000, -1.000000, 0.000000, + 0.000000, 0.320932, 43.031708, 1.000000;; + } + Mesh Head { + + 14; + 0.425325; 1.962787; -19.572998;, + 8.670237; -5.947898; -18.382002;, + 11.100914; 4.408364; -18.855011;, + 1.451953; 10.441894; -18.855013;, + -9.223644; 5.996317; -18.855013;, + -8.846230; -4.605626; -18.382004;, + -0.560038; -8.044583; -15.549453;, + 8.843442; -3.382582; -2.678222;, + 11.100921; 4.408369; -3.122056;, + 1.451952; 10.441850; -3.122057;, + -9.223644; 5.996321; -3.121026;, + -8.571328; -2.049199; -2.677688;, + -0.522815; -9.619122; -0.089148;, + 0.425325; -0.037214; 3.679924;; + + 24; + 3;0,2,1;, + 3;0,3,2;, + 3;0,4,3;, + 3;0,5,4;, + 3;0,6,5;, + 3;0,1,6;, + 3;1,8,7;, + 3;1,2,8;, + 3;2,9,8;, + 3;2,3,9;, + 3;3,10,9;, + 3;3,4,10;, + 3;4,11,10;, + 3;4,5,11;, + 3;5,12,11;, + 3;5,6,12;, + 3;6,7,12;, + 3;6,1,7;, + 3;13,11,12;, + 3;13,10,11;, + 3;13,9,10;, + 3;13,8,9;, + 3;13,7,8;, + 3;13,12,7;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01HEAD} + } + MeshNormals { + 60; + 0.081687;-0.064598;-0.994562;, + 0.049012;0.078380;-0.995718;, + -0.036962;0.088760;-0.995367;, + -0.093941;-0.047711;-0.994434;, + 0.153237;-0.381582;-0.911545;, + -0.201835;-0.348186;-0.915439;, + 0.081687;-0.064598;-0.994562;, + -0.201835;-0.348186;-0.915439;, + 0.967436;-0.252527;0.017281;, + 0.263240;-0.952568;0.152705;, + 0.081687;-0.064598;-0.994562;, + 0.049012;0.078380;-0.995718;, + 0.973545;-0.228497;-0.000000;, + 0.530181;0.847885;-0.000000;, + 0.049012;0.078380;-0.995718;, + -0.036962;0.088760;-0.995367;, + 0.530184;0.847883;0.000002;, + -0.384421;0.923158;0.000003;, + -0.036962;0.088760;-0.995367;, + -0.093941;-0.047711;-0.994434;, + -0.384425;0.923156;-0.000000;, + -0.998267;-0.057694;0.011560;, + -0.093941;-0.047711;-0.994434;, + 0.153237;-0.381582;-0.911545;, + -0.999136;-0.034537;0.023112;, + -0.542700;-0.839759;0.016782;, + 0.153237;-0.381582;-0.911545;, + -0.201835;-0.348186;-0.915439;, + -0.354072;-0.930491;-0.093912;, + 0.406709;-0.912942;0.033537;, + 0.960443;-0.276327;0.034547;, + 0.406709;-0.912942;0.033537;, + 0.568130;-0.118225;0.814402;, + 0.465164;-0.363520;0.807140;, + 0.967436;-0.252527;0.017281;, + 0.530181;0.847885;-0.000000;, + 0.310173;0.496041;0.811010;, + 0.568130;-0.118225;0.814402;, + 0.530181;0.847885;-0.000000;, + -0.384421;0.923158;0.000003;, + -0.227197;0.545783;0.806537;, + 0.310173;0.496041;0.811010;, + -0.384421;0.923158;0.000003;, + -0.996729;-0.080813;0.000000;, + -0.576846;-0.001758;0.816851;, + -0.227197;0.545783;0.806537;, + -0.998267;-0.057694;0.011560;, + -0.700901;-0.701945;0.126535;, + -0.514933;-0.269185;0.813870;, + -0.576846;-0.001758;0.816851;, + -0.542700;-0.839759;0.016782;, + 0.535392;-0.840126;-0.086851;, + -0.514933;-0.269185;0.813870;, + 0.465164;-0.363520;0.807140;, + -0.514933;-0.269185;0.813870;, + -0.576846;-0.001758;0.816851;, + -0.227197;0.545783;0.806537;, + 0.310173;0.496041;0.811010;, + 0.568130;-0.118225;0.814402;, + 0.465164;-0.363520;0.807140;; + 24; + 3;0,10,6;, + 3;1,14,11;, + 3;2,18,15;, + 3;3,22,19;, + 3;4,26,23;, + 3;5,7,27;, + 3;8,34,30;, + 3;8,12,34;, + 3;13,38,35;, + 3;13,16,38;, + 3;17,42,39;, + 3;17,20,42;, + 3;21,46,43;, + 3;21,24,46;, + 3;25,50,47;, + 3;25,28,50;, + 3;29,31,51;, + 3;29,9,31;, + 3;54,48,52;, + 3;55,44,49;, + 3;56,40,45;, + 3;57,36,41;, + 3;58,32,37;, + 3;59,53,33;; + } + MeshTextureCoords { + 14; + 0.023465;0.004861;, + 0.658502;0.065512;, + 0.821431;0.041424;, + 0.999136;0.041424;, + 0.180988;0.041424;, + 0.342098;0.065512;, + 0.493676;0.209760;, + 0.695904;0.865226;, + 0.821431;0.842624;, + 0.999136;0.842624;, + 0.180988;0.842657;, + 0.305883;0.865234;, + 0.497409;0.997055;, + 0.480761;1.188995;; + } + } + } + } + + Frame x3ds_RU_Leg { + FrameTransformMatrix { + 0.996195, 0.000000, -0.087156, 0.000000, + -0.000000, -1.000000, -0.000000, 0.000000, + -0.087156, 0.000000, -0.996195, 0.000000, + -6.849588, -0.163910, 2.374464, 1.000000;; + } + Mesh RU_Leg { + + 8; + -11.013890; -7.083223; -1.154131;, + 3.719295; -7.083223; -1.154224;, + 3.719296; 7.083232; -1.154223;, + -11.013890; 7.083232; -1.154134;, + -10.314070; -5.595809; 40.157955;, + 3.019470; -5.595746; 40.157955;, + 3.019406; 5.595754; 40.157948;, + -10.314070; 5.595690; 40.157944;; + + 12; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHLEG} + } + MeshNormals { + 24; + -0.000006;0.000000;-1.000000;, + 0.000005;-0.999352;0.035981;, + -0.999857;0.000000;0.016937;, + -0.000006;0.000000;-1.000000;, + 0.000000;-0.999352;0.035982;, + 0.999857;0.000006;0.016937;, + -0.000006;0.000000;-1.000000;, + 0.999857;-0.000000;0.016939;, + -0.000005;0.999352;0.035982;, + -0.000006;-0.000000;-1.000000;, + 0.000000;0.999352;0.035984;, + -0.999857;0.000000;0.016937;, + 0.000005;-0.999352;0.035981;, + -0.999857;0.000000;0.016937;, + -0.000000;0.000001;1.000000;, + 0.000005;-0.999352;0.035981;, + 0.999857;0.000006;0.016937;, + -0.000000;0.000001;1.000000;, + 0.999857;0.000006;0.016937;, + -0.000005;0.999352;0.035982;, + -0.000000;0.000001;1.000000;, + -0.000005;0.999352;0.035982;, + -0.999857;0.000000;0.016937;, + -0.000000;0.000001;1.000000;; + 12; + 3;0,6,3;, + 3;0,9,6;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,20,23;, + 3;14,17,20;; + } + MeshTextureCoords { + 8; + 0.384951;0.041750;, + 0.616604;0.041750;, + 0.856692;0.041750;, + 0.141781;0.041750;, + 0.384951;0.914882;, + 0.616604;0.914882;, + 0.856692;0.914882;, + 0.141781;0.914882;; + } + } + + Frame x3ds_RL_Leg { + FrameTransformMatrix { + 0.996195, -0.000000, -0.087156, 0.000000, + -0.087156, -0.000000, -0.996195, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + -3.359494, 0.259708, 38.976967, 1.000000;; + } + Mesh RL_Leg { + + 26; + 9.229027; -71.518196; -17.699999;, + -10.562513; -71.518204; -17.699999;, + -8.726734; 0.601814; -5.908435;, + 7.393265; 0.601810; -5.908433;, + 11.931103; -75.798187; 11.700004;, + -13.264593; -75.798187; 11.699999;, + -8.726734; 0.601814; 5.908564;, + 7.393263; 0.601810; 5.908566;, + -9.401619; -8.003811; 0.055164;, + -9.401621; -19.983799; 0.055164;, + -21.381618; -5.008812; 0.055162;, + -9.401619; -8.003811; 1.552658;, + -9.401621; -19.983799; 1.552658;, + -21.381618; -5.008812; 1.552657;, + -9.406624; -28.501522; 0.062683;, + -9.406624; -40.501522; 0.062684;, + -21.406624; -25.501520; 0.062688;, + -9.406624; -28.501522; 1.562678;, + -9.406624; -40.501522; 1.562678;, + -21.406624; -25.501520; 1.562676;, + -9.411629; -50.486736; 0.070203;, + -9.411633; -62.506737; 0.070203;, + -21.431629; -47.481735; 0.070202;, + -9.411629; -50.486736; 1.572698;, + -9.411633; -62.506737; 1.572698;, + -21.431629; -47.481735; 1.572697;; + + 30; + 3;2,0,1;, + 3;3,0,2;, + 3;5,0,4;, + 3;1,0,5;, + 3;6,1,5;, + 3;2,1,6;, + 3;7,2,6;, + 3;3,2,7;, + 3;4,3,7;, + 3;0,3,4;, + 3;6,4,7;, + 3;5,4,6;, + 3;8,9,10;, + 3;9,13,10;, + 3;9,12,13;, + 3;10,11,8;, + 3;10,13,11;, + 3;12,11,13;, + 3;14,15,16;, + 3;15,19,16;, + 3;15,18,19;, + 3;16,17,14;, + 3;16,19,17;, + 3;18,17,19;, + 3;20,21,22;, + 3;21,25,22;, + 3;21,24,25;, + 3;22,23,20;, + 3;22,25,23;, + 3;24,23,25;; + MeshMaterialList { + 2; + 30; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHLEG} + {x3ds_mat_BLUEPLASTIC} + } + MeshNormals { + 66; + -0.000000;0.161357;-0.986896;, + 0.000000;-0.989569;-0.144059;, + 0.995537;0.039363;-0.085767;, + -0.000000;0.161357;-0.986896;, + 0.000000;-0.989569;-0.144059;, + -0.998354;0.039138;-0.041929;, + -0.000000;0.161357;-0.986896;, + -0.999676;0.025446;0.000000;, + 0.000000;1.000000;0.000000;, + 0.000000;0.161357;-0.986896;, + 0.000000;1.000000;0.000000;, + 0.997858;0.049375;-0.042925;, + 0.000000;-0.989569;-0.144059;, + 0.997858;0.049375;-0.042925;, + -0.000000;0.075587;0.997139;, + 0.000000;-0.989569;-0.144059;, + -0.995087;0.052754;-0.083776;, + -0.000000;0.075587;0.997139;, + -0.998354;0.039138;-0.041929;, + 0.000000;1.000000;0.000000;, + -0.000000;0.075587;0.997139;, + 0.000000;1.000000;0.000000;, + 0.998241;0.059291;0.000000;, + -0.000000;0.075587;0.997139;, + 0.000000;0.000000;-1.000000;, + 0.242536;0.970143;-0.000000;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970143;-0.000000;, + 0.242536;0.970143;-0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970143;0.000000;, + -0.000000;0.000000;1.000000;, + -0.000000;-0.000000;-1.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;-0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + -0.000000;-0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970142;0.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;, + -0.780869;-0.624695;0.000000;, + -0.000000;-0.000000;1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + 0.242536;0.970142;0.000000;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000001;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000001;, + 0.242536;0.970142;0.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;-0.000001;, + 0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;; + 30; + 3;6,0,3;, + 3;9,0,6;, + 3;15,1,12;, + 3;4,1,15;, + 3;18,5,16;, + 3;7,5,18;, + 3;21,8,19;, + 3;10,8,21;, + 3;13,11,22;, + 3;2,11,13;, + 3;20,14,23;, + 3;17,14,20;, + 3;24,26,28;, + 3;27,35,29;, + 3;27,33,35;, + 3;30,31,25;, + 3;30,36,31;, + 3;34,32,37;, + 3;38,40,42;, + 3;41,49,43;, + 3;41,47,49;, + 3;44,45,39;, + 3;44,50,45;, + 3;48,46,51;, + 3;52,54,56;, + 3;55,63,57;, + 3;55,61,63;, + 3;58,59,53;, + 3;58,64,59;, + 3;62,60,65;; + } + MeshTextureCoords { + 26; + 0.424682;0.899973;, + 0.582679;0.899974;, + 0.647431;0.013392;, + 0.363113;0.013392;, + 0.131246;0.952588;, + 0.861902;0.952588;, + 0.838511;0.013392;, + 0.151531;0.013392;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_R_Foot { + FrameTransformMatrix { + -0.000000, 0.000000, 1.000000, 0.000000, + -0.000000, 1.000000, -0.000000, 0.000000, + -1.000000, -0.000000, -0.000000, 0.000000, + -0.849463, -62.299637, -2.502151, 1.000000;; + } + Mesh R_Foot { + + 8; + -37.191723; -17.003931; 4.286171;, + 7.580331; -17.003948; 6.445354;, + 5.179023; -0.329503; 4.340307;, + -27.147438; -7.877935; 1.341817;, + -37.191738; -17.003931; -4.286145;, + 7.580253; -17.003933; -6.445300;, + 5.179095; -0.329495; -4.340262;, + -27.147472; -7.877943; -1.341796;; + + 10; + 3;2,0,1;, + 3;3,0,2;, + 3;5,0,4;, + 3;1,0,5;, + 3;7,2,6;, + 3;3,2,7;, + 3;4,3,7;, + 3;0,3,4;, + 3;6,4,7;, + 3;5,4,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_BLUEPLASTIC} + } + MeshNormals { + 20; + -0.123025;0.309552;0.942890;, + -0.000000;-1.000000;0.000000;, + -0.672464;0.740130;0.000001;, + -0.047832;0.118323;0.991822;, + -0.000000;-1.000000;-0.000001;, + -0.123025;0.309552;0.942890;, + -0.227389;0.973804;-0.000001;, + -0.192729;0.486970;0.851889;, + -0.227389;0.973804;0.000000;, + -0.672466;0.740128;0.000006;, + -0.000000;-1.000000;0.000000;, + -0.672466;0.740128;0.000006;, + -0.123024;0.309552;-0.942891;, + -0.000000;-1.000000;0.000000;, + -0.047831;0.118323;-0.991822;, + -0.227389;0.973804;-0.000001;, + -0.123024;0.309552;-0.942891;, + -0.227389;0.973804;-0.000001;, + -0.672466;0.740128;0.000006;, + -0.192728;0.486969;-0.851891;; + 10; + 3;5,0,3;, + 3;7,0,5;, + 3;13,1,10;, + 3;4,1,13;, + 3;17,6,15;, + 3;8,6,17;, + 3;11,9,18;, + 3;2,9,11;, + 3;16,12,19;, + 3;14,12,16;; + } + } + } + } + } + + Frame x3ds_LU_Leg { + FrameTransformMatrix { + 0.996195, 0.000000, 0.087156, 0.000000, + 0.000000, -1.000000, -0.000000, 0.000000, + 0.087156, 0.000000, -0.996195, 0.000000, + 5.995695, -0.163910, 2.695593, 1.000000;; + } + Mesh LU_Leg { + + 8; + -2.905133; -7.083223; -0.791073;, + 11.828092; -7.083160; -0.790935;, + 11.828092; 7.083232; -0.790933;, + -2.905131; 7.083232; -0.791068;, + -2.205294; -5.595747; 40.521160;, + 11.128267; -5.595746; 40.521164;, + 11.128268; 5.595754; 40.521152;, + -2.205276; 5.595753; 40.521152;; + + 12; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHLEG} + } + MeshNormals { + 24; + 0.000009;0.000000;-1.000000;, + 0.000000;-0.999352;0.035982;, + -0.999857;0.000000;0.016938;, + 0.000009;0.000000;-1.000000;, + 0.000004;-0.999352;0.035981;, + 0.999857;-0.000000;0.016938;, + 0.000009;0.000000;-1.000000;, + 0.999857;-0.000000;0.016937;, + -0.000000;0.999352;0.035983;, + 0.000009;0.000000;-1.000000;, + -0.000000;0.999352;0.035982;, + -0.999857;0.000002;0.016938;, + 0.000000;-0.999352;0.035982;, + -0.999857;0.000002;0.016938;, + -0.000000;0.000001;1.000000;, + 0.000000;-0.999352;0.035982;, + 0.999857;-0.000000;0.016938;, + -0.000000;0.000001;1.000000;, + 0.999857;-0.000000;0.016938;, + -0.000000;0.999352;0.035983;, + -0.000000;0.000001;1.000000;, + -0.000000;0.999352;0.035983;, + -0.999857;0.000002;0.016938;, + -0.000000;0.000001;1.000000;; + 12; + 3;0,6,3;, + 3;0,9,6;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,20,23;, + 3;14,17,20;; + } + MeshTextureCoords { + 8; + 0.384951;0.041750;, + 0.616604;0.041750;, + 0.856692;0.041750;, + 0.141781;0.041750;, + 0.384951;0.914882;, + 0.616604;0.914882;, + 0.856692;0.914882;, + 0.141781;0.914882;; + } + } + + Frame x3ds_LL_Leg { + FrameTransformMatrix { + 0.996195, 0.000000, 0.087156, 0.000000, + 0.087156, -0.000000, -0.996195, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + 3.943336, 0.259716, 39.672768, 1.000000;; + } + Mesh LL_Leg { + + 26; + -9.017391; -71.197044; -17.699999;, + 10.774149; -71.197052; -17.699999;, + 8.938375; 0.922958; -5.908498;, + -7.181622; 0.922955; -5.908498;, + -11.719472; -75.477051; 11.700000;, + 13.476221; -75.477051; 11.700000;, + 8.938375; 0.922958; 5.908501;, + -7.181622; 0.922955; 5.908501;, + 9.618265; -7.680378; 0.062687;, + 9.618269; -19.680382; 0.062687;, + 21.618265; -4.680378; 0.062687;, + 9.618265; -7.680378; 1.562681;, + 9.618269; -19.680382; 1.562681;, + 21.618265; -4.680378; 1.562681;, + 9.618265; -28.180374; 0.062689;, + 9.618265; -40.180374; 0.062689;, + 21.618265; -25.180378; 0.062694;, + 9.618265; -28.180374; 1.562683;, + 9.618265; -40.180374; 1.562683;, + 21.618265; -25.180378; 1.562684;, + 9.618269; -50.180374; 0.062691;, + 9.618265; -62.180374; 0.062691;, + 21.618269; -47.180374; 0.062691;, + 9.618269; -50.180374; 1.562685;, + 9.618265; -62.180374; 1.562685;, + 21.618269; -47.180374; 1.562685;; + + 30; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;, + 3;9,8,10;, + 3;13,9,10;, + 3;12,9,13;, + 3;11,10,8;, + 3;13,10,11;, + 3;11,12,13;, + 3;15,14,16;, + 3;19,15,16;, + 3;18,15,19;, + 3;17,16,14;, + 3;19,16,17;, + 3;17,18,19;, + 3;21,20,22;, + 3;25,21,22;, + 3;24,21,25;, + 3;23,22,20;, + 3;25,22,23;, + 3;23,24,25;; + MeshMaterialList { + 2; + 30; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHLEG} + {x3ds_mat_BLUEPLASTIC} + } + MeshNormals { + 66; + 0.000000;0.161356;-0.986896;, + -0.000000;-0.989569;-0.144060;, + -0.995537;0.039364;-0.085767;, + 0.000000;0.161356;-0.986896;, + -0.000000;-0.989569;-0.144060;, + 0.998354;0.039138;-0.041929;, + 0.000000;0.161356;-0.986896;, + 0.999676;0.025446;0.000000;, + -0.000000;1.000000;0.000000;, + -0.000000;0.161356;-0.986896;, + -0.000000;1.000000;0.000000;, + -0.997857;0.049375;-0.042925;, + -0.000000;-0.989569;-0.144060;, + -0.997857;0.049375;-0.042925;, + -0.000000;0.075588;0.997139;, + -0.000000;-0.989569;-0.144060;, + 0.995087;0.052753;-0.083776;, + 0.000000;0.075588;0.997139;, + 0.998354;0.039138;-0.041929;, + -0.000000;1.000000;0.000000;, + -0.000000;0.075588;0.997139;, + -0.000000;1.000000;0.000000;, + -0.998241;0.059291;0.000000;, + -0.000000;0.075588;0.997139;, + 0.000000;0.000000;-1.000000;, + -0.242536;0.970142;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + -0.242535;0.970143;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242535;0.970143;0.000000;, + -0.242535;0.970143;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242535;0.970143;0.000000;, + -0.000000;0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + -0.242536;0.970142;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.000000;-0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;; + 30; + 3;0,6,3;, + 3;0,9,6;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,20,23;, + 3;14,17,20;, + 3;26,24,28;, + 3;35,27,29;, + 3;33,27,35;, + 3;31,30,25;, + 3;36,30,31;, + 3;32,34,37;, + 3;40,38,42;, + 3;49,41,43;, + 3;47,41,49;, + 3;45,44,39;, + 3;50,44,45;, + 3;46,48,51;, + 3;54,52,56;, + 3;63,55,57;, + 3;61,55,63;, + 3;59,58,53;, + 3;64,58,59;, + 3;60,62,65;; + } + MeshTextureCoords { + 26; + 0.424682;0.899973;, + 0.582679;0.899974;, + 0.647431;0.013392;, + 0.363113;0.013392;, + 0.131246;0.952588;, + 0.861902;0.952588;, + 0.838511;0.013392;, + 0.151531;0.013392;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_L_Foot { + FrameTransformMatrix { + -0.000000, 0.000000, 1.000000, 0.000000, + -0.000000, 1.000000, -0.000000, 0.000000, + -1.000000, -0.000000, -0.000000, 0.000000, + 1.061086, -63.263023, -2.697744, 1.000000;; + } + Mesh L_Foot { + + 8; + -36.996124; -15.719404; -4.210043;, + 7.775673; -15.719419; -6.330903;, + 5.374375; 0.954521; -4.263234;, + -26.951843; -6.593406; -1.317977;, + -36.995773; -15.719404; 4.210084;, + 7.775607; -15.719404; 6.330931;, + 5.374449; 0.954529; 4.263263;, + -26.951618; -6.593413; 1.317985;; + + 10; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_BLUEPLASTIC} + } + MeshNormals { + 20; + -0.121241;0.305074;-0.944580;, + 0.000000;-1.000000;0.000000;, + -0.672469;0.740125;0.000028;, + -0.046996;0.116259;-0.992106;, + -0.000000;-1.000000;0.000001;, + -0.121241;0.305074;-0.944580;, + -0.227378;0.973807;0.000001;, + -0.190220;0.480642;-0.856037;, + -0.227375;0.973807;0.000022;, + -0.672459;0.740134;0.000060;, + 0.000000;-1.000000;0.000000;, + -0.672459;0.740134;0.000060;, + -0.121242;0.305076;0.944579;, + 0.000000;-1.000000;0.000000;, + -0.046997;0.116259;0.992106;, + -0.227378;0.973807;0.000001;, + -0.121242;0.305076;0.944579;, + -0.227378;0.973807;0.000001;, + -0.672459;0.740134;0.000060;, + -0.190222;0.480645;0.856035;; + 10; + 3;0,5,3;, + 3;0,7,5;, + 3;1,13,10;, + 3;1,4,13;, + 3;6,17,15;, + 3;6,8,17;, + 3;9,11,18;, + 3;9,2,11;, + 3;12,16,19;, + 3;12,14,16;; + } + } + } + } + } +} +AnimationSet x3ds_animset_0 { + Animation x3ds_anim_0 { + {x3ds_Groin} + AnimationKey { + 0; + 11; + 0; 4; 0.707107, 0.707107, 0.000000, 0.000000;;, + 77; 4; 0.707107, 0.707107, 0.000000, 0.000000;;, + 85; 4; 0.707107, 0.707107, 0.000000, 0.000000;;, + 93; 4; 0.707107, 0.707107, 0.000000, 0.000000;;, + 115; 4; 0.000000, 1.000000, 0.000000, -0.000000;;, + 135; 4; 0.000000, 1.000000, 0.000000, -0.000000;;, + 160; 4; 0.707107, 0.707106, -0.000000, -0.000000;;, + 161; 4; -0.707107, -0.707106, 0.000000, 0.000000;;, + 175; 4; -0.705815, -0.705815, -0.042718, -0.042718;;, + 193; 4; -0.706998, -0.706997, -0.012419, -0.012419;;, + 216; 4; -0.707107, -0.707106, 0.000001, 0.000001;;; + } + AnimationKey { + 1; + 5; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 93; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 29; + 0; 3; 0.000000, 35.534382, 1.024473;;, + 1; 3; 0.000000, 23.889210, 1.024473;;, + 15; 3; 0.000000, 18.884680, 2.903347;;, + 30; 3; 0.000000, 23.889210, 1.024473;;, + 33; 3; 0.000000, 23.889210, 1.024473;;, + 43; 3; 0.000000, 20.962900, 1.024473;;, + 52; 3; 0.000000, 25.059750, 1.024473;;, + 61; 3; 0.000000, 23.518040, 5.044694;;, + 68; 3; 0.000000, 18.818790, 12.939010;;, + 76; 3; 0.000000, 23.518040, 5.044694;;, + 77; 3; 0.000000, 23.518040, 5.044694;;, + 93; 3; 0.000000, 23.518040, 5.044694;;, + 100; 3; 0.000000, 29.812460, -75.539803;;, + 104; 3; 0.000000, 19.677170, -97.369301;;, + 115; 3; 0.000000, -67.336800, -156.016006;;, + 135; 3; 0.000000, -67.336800, -139.858002;;, + 145; 3; 0.000000, -13.702700, -104.629097;;, + 146; 3; 0.000000, -12.018200, -99.536301;;, + 160; 3; 0.000000, 23.518040, -5.044694;;, + 161; 3; 0.000000, 23.518040, -5.044694;;, + 175; 3; 0.000000, 33.713280, 22.388664;;, + 178; 3; 0.000000, 24.016300, 24.758060;;, + 181; 3; 0.000000, 33.713280, 26.460903;;, + 184; 3; 0.000000, 24.016300, 25.572514;;, + 187; 3; 0.000000, 33.713280, 26.460907;;, + 190; 3; 0.000000, 24.016300, 26.386951;;, + 193; 3; 0.000000, 33.713280, 26.460903;;, + 207; 3; 0.000000, 33.713280, 26.460907;;, + 216; 3; 0.000000, 23.518040, -5.044694;;; + } + } + + Animation x3ds_anim_1 { + {x3ds_Chest} + AnimationKey { + 0; + 23; + 0; 4; 0.000000, -0.000000, -0.000000, -1.000000;;, + 1; 4; 0.258819, 0.000000, -0.000000, -0.965926;;, + 15; 4; 0.317305, 0.000000, -0.000000, -0.948324;;, + 30; 4; 0.258819, 0.000000, -0.000000, -0.965926;;, + 31; 4; 0.258819, 0.000000, -0.000000, -0.965926;;, + 43; 4; -0.095846, -0.000000, -0.000000, -0.995396;;, + 52; 4; 0.442381, 0.058240, 0.116812, -0.887278;;, + 61; 4; 0.258819, -0.000000, -0.000000, -0.965926;;, + 68; 4; 0.332019, -0.072538, -0.264839, -0.902420;;, + 76; 4; 0.258819, -0.000000, -0.000001, -0.965926;;, + 77; 4; 0.258819, -0.000000, -0.000001, -0.965926;;, + 85; 4; 0.535255, 0.003802, -0.087074, -0.840182;;, + 93; 4; 0.258819, -0.000000, -0.000001, -0.965926;;, + 95; 4; 0.221903, -0.017679, -0.071612, -0.972275;;, + 102; 4; 0.122182, -0.024167, -0.140528, -0.982212;;, + 115; 4; -0.000001, 0.000000, -0.000000, -1.000000;;, + 135; 4; -0.000001, -0.000000, 0.529919, -0.848048;;, + 139; 4; 0.030693, 0.002685, 0.581681, -0.812834;;, + 160; 4; 0.258820, -0.000000, -0.000000, -0.965926;;, + 161; 4; 0.258820, -0.000000, -0.000001, -0.965926;;, + 175; 4; -0.017452, -0.000000, -0.000000, -0.999848;;, + 207; 4; -0.017452, -0.000000, -0.000000, -0.999848;;, + 216; 4; 0.258820, -0.000000, -0.000001, -0.965926;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 0.426950, -1.024470, 11.366163;;, + 77; 3; 0.426950, -1.024470, 11.366163;;, + 115; 3; 0.426950, -1.024470, 11.366163;;, + 135; 3; 0.426950, -1.024470, 11.366163;;; + } + } + + Animation x3ds_anim_2 { + {x3ds_RU_Arm} + AnimationKey { + 0; + 30; + 0; 4; -0.000000, 0.130526, 0.000000, -0.991445;;, + 1; 4; -0.065263, 0.113039, 0.495722, -0.858616;;, + 15; 4; -0.056193, 0.117811, 0.426828, -0.894864;;, + 30; 4; -0.065263, 0.113039, 0.495723, -0.858616;;, + 31; 4; -0.065263, 0.113039, 0.495723, -0.858616;;, + 43; 4; 0.053090, 0.119242, -0.403256, -0.905730;;, + 52; 4; -0.220806, -0.041267, 0.855768, -0.466049;;, + 61; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 68; 4; -0.025312, 0.111794, -0.475054, -0.872459;;, + 76; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 77; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 85; 4; 0.133832, 0.353720, 0.308203, -0.872916;;, + 93; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 96; 4; -0.200990, -0.200282, 0.412420, -0.865679;;, + 97; 4; -0.132674, -0.082403, 0.416033, -0.895837;;, + 98; 4; -0.201870, -0.265437, 0.361052, -0.870881;;, + 99; 4; -0.134623, -0.131057, 0.365286, -0.911739;;, + 100; 4; -0.228976, -0.420777, 0.283694, -0.830683;;, + 115; 4; -0.000001, -0.398748, 0.000001, -0.917061;;, + 135; 4; -0.078327, -0.125349, -0.524098, -0.838734;;, + 139; 4; -0.071913, -0.092789, -0.291009, -0.949491;;, + 160; 4; -0.065263, 0.113040, 0.495724, -0.858616;;, + 161; 4; -0.065263, 0.113040, 0.495724, -0.858616;;, + 175; 4; -0.165429, -0.450070, 0.634668, -0.606026;;, + 178; 4; -0.307408, -0.362634, 0.387903, -0.789638;;, + 182; 4; -0.174187, -0.394643, 0.618206, -0.657068;;, + 185; 4; -0.280338, -0.279007, 0.343836, -0.851671;;, + 188; 4; -0.185051, -0.307103, 0.545153, -0.757794;;, + 192; 4; -0.218786, -0.219812, 0.386801, -0.868447;;, + 216; 4; -0.065263, 0.113040, 0.495724, -0.858616;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -22.158115, 0.000001, 34.682266;;, + 77; 3; -22.158115, 0.000001, 34.682266;;, + 115; 3; -22.158115, 0.000001, 34.682266;;, + 135; 3; -22.158115, 0.000001, 34.682266;;; + } + } + + Animation x3ds_anim_3 { + {x3ds_RL_Arm} + AnimationKey { + 0; + 26; + 0; 4; 1.000000, 0.000000, -0.000000, -0.000000;;, + 1; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 15; 4; 0.909961, 0.414693, -0.000000, -0.000000;;, + 30; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 31; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 43; 4; 0.622515, 0.782608, 0.000000, -0.000000;;, + 52; 4; 0.998630, 0.052336, -0.000000, -0.000000;;, + 61; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 68; 4; 0.987688, 0.156435, -0.000000, -0.000000;;, + 76; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 77; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 85; 4; 0.673714, 0.675106, -0.106243, 0.281164;;, + 93; 4; 0.866025, 0.500000, 0.000000, -0.000000;;, + 96; 4; 0.846469, 0.531913, 0.010984, -0.020921;;, + 115; 4; 1.000000, -0.000001, -0.000000, 0.000000;;, + 135; 4; 0.913546, 0.406736, -0.000000, 0.000000;;, + 139; 4; 0.981076, 0.193621, -0.000000, -0.000000;;, + 160; 4; 0.866026, 0.499999, -0.000000, 0.000000;;, + 161; 4; 0.866026, 0.499999, -0.000000, 0.000000;;, + 175; 4; 0.898794, 0.438370, -0.000000, 0.000000;;, + 178; 4; 0.668687, 0.743544, -0.000000, 0.000000;;, + 182; 4; 0.826796, 0.562503, -0.000000, 0.000000;;, + 185; 4; 0.651408, 0.758727, -0.000000, 0.000000;;, + 188; 4; 0.705617, 0.708593, -0.000000, 0.000000;;, + 192; 4; 0.616021, 0.787730, -0.000000, 0.000000;;, + 216; 4; 0.866026, 0.499999, -0.000000, 0.000000;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 13.822151, 0.000000, -20.565975;;, + 77; 3; 13.822151, 0.000000, -20.565975;;, + 115; 3; 13.822151, 0.000000, -20.565975;;, + 135; 3; 13.822151, 0.000000, -20.565975;;; + } + } + + Animation x3ds_anim_4 { + {x3ds_R_Hand} + AnimationKey { + 0; + 11; + 0; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 52; 4; 0.085633, 0.098509, -0.650446, -0.748253;;, + 68; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 77; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 85; 4; 0.095461, 0.089019, -0.725097, -0.676164;;, + 93; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 115; 4; 0.092296, 0.092296, -0.701057, -0.701058;;, + 135; 4; 0.092296, 0.092296, -0.701057, -0.701058;;, + 160; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 161; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 216; 4; 0.083025, 0.100717, -0.630637, -0.765023;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 17.201632, -0.532498, -26.974579;;, + 77; 3; 17.201632, -0.532498, -26.974579;;, + 115; 3; 17.201632, -0.532498, -26.974579;;, + 135; 3; 17.201632, -0.532498, -26.974579;;; + } + } + + Animation x3ds_anim_5 { + {x3ds_LU_Arm} + AnimationKey { + 0; + 31; + 0; 4; -0.000000, 0.130526, 0.000000, -0.991445;;, + 1; 4; -0.017037, 0.129409, 0.129410, -0.982963;;, + 15; 4; -0.027138, 0.127674, 0.206133, -0.969779;;, + 30; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 31; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 43; 4; -0.326088, 0.265924, 0.458283, -0.782897;;, + 52; 4; 0.023797, -0.004380, -0.508650, -0.860633;;, + 61; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 68; 4; 0.039250, 0.124485, -0.298134, -0.945558;;, + 76; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 77; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 85; 4; 0.014321, -0.216242, 0.302516, -0.928180;;, + 93; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 96; 4; 0.012473, 0.472295, 0.098587, -0.875821;;, + 97; 4; -0.005733, 0.314325, 0.091301, -0.944897;;, + 98; 4; 0.002467, 0.403792, 0.085230, -0.910869;;, + 99; 4; -0.005563, 0.316457, 0.079674, -0.945239;;, + 100; 4; 0.010565, 0.509467, 0.073742, -0.857260;;, + 115; 4; -0.000001, 0.566409, -0.000008, -0.824124;;, + 135; 4; 0.176893, 0.283087, -0.499530, -0.799400;;, + 139; 4; 0.283098, 0.024951, -0.406064, -0.868531;;, + 160; 4; -0.017038, 0.129412, 0.129402, -0.982964;;, + 161; 4; -0.017038, 0.129412, 0.129403, -0.982964;;, + 175; 4; 0.405692, 0.534219, 0.553941, -0.493126;;, + 178; 4; 0.585778, 0.368487, 0.379184, -0.614249;;, + 182; 4; 0.448058, 0.532485, 0.549044, -0.462877;;, + 185; 4; 0.592036, 0.367183, 0.377829, -0.609849;;, + 188; 4; 0.502752, 0.483163, 0.496528, -0.516967;;, + 192; 4; 0.598794, 0.362383, 0.372267, -0.609543;;, + 207; 4; 0.476089, 0.472560, 0.479925, -0.565420;;, + 216; 4; -0.017038, 0.129412, 0.129402, -0.982964;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 22.800381, -0.000005, 34.682266;;, + 77; 3; 22.800381, -0.000005, 34.682266;;, + 115; 3; 22.800381, -0.000005, 34.682266;;, + 135; 3; 22.800381, -0.000005, 34.682266;;; + } + } + + Animation x3ds_anim_6 { + {x3ds_LL_Arm} + AnimationKey { + 0; + 26; + 0; 4; 1.000000, 0.000000, -0.000000, -0.000000;;, + 1; 4; 0.819152, 0.573576, -0.000000, -0.000000;;, + 15; 4; 0.848048, 0.529919, -0.000000, -0.000000;;, + 30; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 31; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 43; 4; 0.737277, 0.675591, -0.000000, -0.000000;;, + 52; 4; 0.642787, 0.766045, 0.000000, -0.000000;;, + 61; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 68; 4; 0.939693, 0.342020, -0.000000, -0.000000;;, + 76; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 77; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 85; 4; 0.441186, 0.831001, 0.214867, -0.261961;;, + 93; 4; 0.819152, 0.573576, -0.000000, 0.000000;;, + 96; 4; 0.932169, 0.360972, -0.014558, 0.023425;;, + 115; 4; 1.000000, -0.000000, -0.000000, -0.000000;;, + 135; 4; 0.874620, 0.484809, -0.000000, -0.000000;;, + 139; 4; 0.980002, 0.198988, -0.000000, -0.000000;;, + 160; 4; 0.819152, 0.573576, -0.000000, 0.000000;;, + 161; 4; 0.819152, 0.573577, -0.000000, 0.000000;;, + 175; 4; 0.902585, 0.430511, -0.000000, 0.000000;;, + 178; 4; 0.674571, 0.738210, -0.000000, 0.000000;;, + 182; 4; 0.836374, 0.548160, -0.000000, 0.000000;;, + 185; 4; 0.666576, 0.745437, -0.000000, 0.000000;;, + 188; 4; 0.756143, 0.654407, -0.000000, 0.000000;;, + 192; 4; 0.686772, 0.726874, -0.000000, 0.000000;;, + 216; 4; 0.819152, 0.573576, -0.000000, 0.000000;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -0.446586, 0.000001, -24.389267;;, + 77; 3; -0.446586, 0.000001, -24.389267;;, + 115; 3; -0.446586, 0.000001, -24.389267;;, + 135; 3; -0.446586, 0.000001, -24.389267;;; + } + } + + Animation x3ds_anim_7 { + {x3ds_L_Hand} + AnimationKey { + 0; + 10; + 0; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 68; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 77; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 85; 4; 0.099989, 0.083901, -0.759491, -0.637289;;, + 93; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 115; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 135; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 160; 4; 0.088182, 0.096234, -0.669811, -0.730970;;, + 161; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 216; 4; 0.088182, 0.096234, -0.669810, -0.730970;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -1.719951, -0.532492, -32.044598;;, + 77; 3; -1.719951, -0.532492, -32.044598;;, + 115; 3; -1.719951, -0.532492, -32.044598;;, + 135; 3; -1.719951, -0.532492, -32.044598;;; + } + } + + Animation x3ds_anim_8 { + {x3ds_Head} + AnimationKey { + 0; + 26; + 0; 4; -0.000000, -0.999048, 0.043619, -0.000000;;, + 6; 4; -0.000000, -0.997564, -0.069756, -0.000000;;, + 15; 4; -0.000000, -0.999657, -0.026177, -0.000000;;, + 26; 4; -0.000000, -0.999391, 0.034899, -0.000000;;, + 52; 4; 0.057153, -0.973623, -0.220877, -0.002109;;, + 61; 4; -0.000000, -0.999391, 0.034900, -0.000000;;, + 68; 4; -0.328848, -0.929469, 0.165640, 0.022582;;, + 76; 4; -0.000000, -0.999391, 0.034900, -0.000000;;, + 77; 4; -0.000000, -0.999391, 0.034900, -0.000000;;, + 85; 4; 0.130447, -0.990841, 0.034601, 0.004555;;, + 93; 4; 0.000000, -0.999391, 0.034900, -0.000000;;, + 115; 4; -0.000000, -0.999048, 0.043621, -0.000000;;, + 135; 4; -0.000000, -0.999048, 0.043621, -0.000000;;, + 175; 4; -0.000000, -0.999048, 0.043621, -0.000000;;, + 177; 4; 0.121753, -0.991602, 0.043296, 0.005316;;, + 179; 4; -0.017436, -0.998896, 0.043614, -0.000761;;, + 181; 4; 0.139040, -0.989326, 0.043196, 0.006071;;, + 183; 4; -0.034867, -0.998440, 0.043594, -0.001522;;, + 185; 4; 0.121752, -0.991602, 0.043296, 0.005316;;, + 187; 4; -0.026153, -0.998706, 0.043606, -0.001142;;, + 189; 4; 0.142432, -0.972455, -0.180232, 0.039500;;, + 191; 4; -0.109249, -0.975409, -0.173314, -0.081269;;, + 193; 4; 0.130401, -0.990501, 0.043248, 0.005694;;, + 195; 4; -0.043578, -0.998097, 0.043579, -0.001903;;, + 197; 4; 0.173153, -0.983648, 0.043642, 0.023447;;, + 199; 4; -0.065922, -0.988029, 0.137452, 0.023655;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 8; + 0; 3; 0.000000, 0.320922, 43.031700;;, + 93; 3; 0.000000, 0.320922, 43.031700;;, + 115; 3; 0.000000, 0.320922, 43.031700;;, + 135; 3; 0.000000, 0.320922, 43.031700;;, + 160; 3; 0.000000, 0.320922, 43.031700;;, + 161; 3; 0.000000, 0.320922, 43.031700;;, + 175; 3; 0.000000, 0.320922, 43.031700;;, + 216; 3; 0.000000, 0.320922, 43.031700;;; + } + } + + Animation x3ds_anim_9 { + {x3ds_RU_Leg} + AnimationKey { + 0; + 30; + 0; 4; 0.043619, -0.000000, -0.999048, 0.000000;;, + 1; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 21; 4; 0.124791, -0.009789, -0.874977, 0.467703;;, + 30; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 37; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 43; 4; 0.125169, 0.001125, -0.912411, 0.389664;;, + 52; 4; 0.125097, 0.004401, -0.922298, 0.365647;;, + 61; 4; 0.124939, 0.007674, -0.931554, 0.341379;;, + 68; 4; 0.125154, 0.002217, -0.915776, 0.381687;;, + 76; 4; 0.124939, 0.007674, -0.931554, 0.341379;;, + 77; 4; 0.124939, 0.007674, -0.931554, 0.341379;;, + 85; 4; 0.124485, 0.013117, -0.945558, 0.300420;;, + 93; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 100; 4; 0.240075, 0.038409, -0.943098, 0.226838;;, + 115; 4; 0.250380, -0.000000, -0.968148, -0.000000;;, + 135; 4; 0.250380, -0.000000, -0.968148, -0.000000;;, + 139; 4; 0.230082, -0.060758, -0.927524, 0.288220;;, + 146; 4; 0.215704, -0.060817, -0.923441, 0.311497;;, + 150; 4; 0.209892, -0.016602, -0.963089, 0.167717;;, + 160; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 161; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 175; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 178; 4; 0.124460, 0.013347, -0.946112, 0.298672;;, + 181; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 184; 4; 0.124460, 0.013347, -0.946112, 0.298672;;, + 187; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 190; 4; 0.124460, 0.013347, -0.946112, 0.298672;;, + 193; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 207; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 216; 4; 0.124939, 0.007674, -0.931554, 0.341378;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 6.849594, 0.163909, 2.374462;;, + 77; 3; 6.849594, 0.163909, 2.374462;;, + 115; 3; 6.849594, 0.163909, 2.374462;;, + 135; 3; 6.849594, 0.163909, 2.374462;;; + } + } + + Animation x3ds_anim_10 { + {x3ds_RL_Leg} + AnimationKey { + 0; + 30; + 0; 4; 0.706434, 0.706434, -0.030844, -0.030844;;, + 1; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 11; 4; 0.438280, 0.897779, -0.019136, -0.039198;;, + 21; 4; 0.422215, 0.905446, -0.018434, -0.039533;;, + 26; 4; 0.439586, 0.897141, -0.019193, -0.039170;;, + 30; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 37; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 43; 4; 0.484348, 0.873787, -0.021147, -0.038150;;, + 52; 4; 0.499524, 0.865201, -0.021810, -0.037775;;, + 61; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 68; 4; 0.573030, 0.818373, -0.025019, -0.035731;;, + 76; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 77; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 93; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 115; 4; 0.706434, 0.706434, -0.030844, -0.030844;;, + 135; 4; 0.706434, 0.706434, -0.030844, -0.030844;;, + 139; 4; 0.319106, 0.946715, -0.013933, -0.041334;;, + 146; 4; 0.007542, 0.999020, -0.000329, -0.043618;;, + 150; 4; -0.025078, 0.998734, 0.001095, -0.043606;;, + 160; 4; 0.536789, 0.842588, -0.023437, -0.036788;;, + 161; 4; 0.536789, 0.842588, -0.023437, -0.036788;;, + 175; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 178; 4; 0.267123, 0.962675, -0.011663, -0.042031;;, + 181; 4; 0.655435, 0.753991, -0.028617, -0.032920;;, + 184; 4; 0.267123, 0.962675, -0.011663, -0.042031;;, + 187; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 190; 4; 0.267123, 0.962675, -0.011663, -0.042031;;, + 193; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 207; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 216; 4; 0.536789, 0.842588, -0.023437, -0.036788;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -3.359494, 0.259702, 38.976971;;, + 77; 3; -3.359494, 0.259702, 38.976971;;, + 115; 3; -3.359494, 0.259702, 38.976971;;, + 135; 3; -3.359494, 0.259702, 38.976971;;; + } + } + + Animation x3ds_anim_11 { + {x3ds_R_Foot} + AnimationKey { + 0; + 29; + 0; 4; 0.707107, 0.000000, 0.707107, -0.000000;;, + 1; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 11; 4; 0.693619, 0.137449, 0.693620, -0.137448;;, + 21; 4; 0.703851, 0.067776, 0.703851, -0.067776;;, + 26; 4; 0.702932, 0.076726, 0.702932, -0.076726;;, + 30; 4; 0.701057, 0.092296, 0.701058, -0.092296;;, + 37; 4; 0.701057, 0.092296, 0.701058, -0.092296;;, + 52; 4; 0.700211, 0.098511, 0.700211, -0.098511;;, + 61; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 68; 4; 0.690345, 0.153046, 0.690346, -0.153046;;, + 76; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 77; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 93; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 115; 4; 0.707107, -0.000000, 0.707107, 0.000000;;, + 135; 4; 0.707107, -0.000000, 0.707107, 0.000000;;, + 139; 4; 0.636494, 0.308019, 0.636494, -0.308019;;, + 146; 4; 0.705581, -0.046427, 0.705581, 0.046427;;, + 150; 4; 0.682577, -0.184629, 0.682578, 0.184629;;, + 160; 4; 0.701057, 0.092298, 0.701057, -0.092298;;, + 161; 4; 0.701057, 0.092298, 0.701057, -0.092298;;, + 175; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 178; 4; 0.691481, -0.147833, 0.691481, 0.147833;;, + 181; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 184; 4; 0.691481, -0.147833, 0.691481, 0.147833;;, + 187; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 190; 4; 0.691481, -0.147833, 0.691481, 0.147833;;, + 193; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 207; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 216; 4; 0.701057, 0.092298, 0.701057, -0.092298;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 3; + 0; 3; -0.849455, -62.299629, -3.801312;;, + 115; 3; -0.849455, -62.299629, -3.801312;;, + 135; 3; -0.849455, -62.299629, -3.801312;;; + } + } + + Animation x3ds_anim_12 { + {x3ds_LU_Leg} + AnimationKey { + 0; + 30; + 0; 4; -0.043619, -0.000000, -0.999048, 0.000000;;, + 1; 4; -0.128543, 0.007574, -0.976382, -0.173483;;, + 11; 4; -0.134779, 0.015787, -0.981832, -0.132631;;, + 21; 4; -0.128729, 0.003084, -0.969733, -0.207452;;, + 30; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 37; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 43; 4; -0.128201, 0.012056, -0.981842, -0.139302;;, + 52; 4; -0.128201, 0.012056, -0.981842, -0.139302;;, + 61; 4; -0.128543, 0.007574, -0.976383, -0.173482;;, + 68; 4; -0.128751, 0.001960, -0.967886, -0.215906;;, + 76; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 77; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 85; 4; -0.128751, 0.001960, -0.967886, -0.215907;;, + 93; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 100; 4; -0.098715, 0.012488, -0.994248, -0.039635;;, + 115; 4; -0.199368, -0.000000, -0.979925, -0.000000;;, + 135; 4; -0.180689, 0.084257, -0.888113, 0.414134;;, + 139; 4; -0.148626, 0.124737, -0.776470, 0.599538;;, + 160; 4; -0.128542, 0.007574, -0.976383, -0.173482;;, + 161; 4; -0.128542, 0.007574, -0.976383, -0.173482;;, + 175; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 178; 4; -0.112759, 0.062175, -0.955955, 0.263761;;, + 181; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 184; 4; -0.112759, 0.062175, -0.955955, 0.263761;;, + 187; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 190; 4; -0.112759, 0.062175, -0.955955, 0.263761;;, + 193; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 207; 4; -0.124735, 0.031962, -0.991546, 0.016007;;, + 212; 4; -0.128488, 0.008447, -0.977538, -0.166852;;, + 216; 4; -0.128542, 0.007575, -0.976383, -0.173479;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -5.995693, 0.163913, 2.695592;;, + 77; 3; -5.995690, 0.163913, 2.695592;;, + 115; 3; -5.995690, 0.163913, 2.695592;;, + 135; 3; -5.995690, 0.163913, 2.695592;;; + } + } + + Animation x3ds_anim_13 { + {x3ds_LL_Leg} + AnimationKey { + 0; + 34; + 0; 4; 0.706434, 0.706434, 0.030844, 0.030844;;, + 1; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 6; 4; 0.551866, 0.832791, 0.024095, 0.036360;;, + 11; 4; 0.510806, 0.858589, 0.022302, 0.037487;;, + 21; 4; 0.521998, 0.851831, 0.022791, 0.037192;;, + 26; 4; 0.541375, 0.839649, 0.023637, 0.036660;;, + 30; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 37; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 43; 4; 0.522001, 0.851829, 0.022791, 0.037192;;, + 52; 4; 0.544120, 0.837873, 0.023757, 0.036582;;, + 61; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 68; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 76; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 77; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 93; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 104; 4; 0.564968, 0.823959, 0.024667, 0.035975;;, + 115; 4; 0.706434, 0.706434, 0.030844, 0.030844;;, + 135; 4; 0.087073, 0.995247, 0.003802, 0.043453;;, + 139; 4; -0.244382, 0.968698, -0.010670, 0.042294;;, + 155; 4; 0.218585, 0.974843, 0.009544, 0.042563;;, + 160; 4; 0.580151, 0.813340, 0.025330, 0.035511;;, + 161; 4; 0.580151, 0.813340, 0.025330, 0.035511;;, + 168; 4; 0.350698, 0.935472, 0.015312, 0.040844;;, + 172; 4; 0.439930, 0.896972, 0.019208, 0.039163;;, + 175; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 178; 4; 0.300421, 0.952809, 0.013117, 0.041600;;, + 181; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 184; 4; 0.300421, 0.952809, 0.013117, 0.041600;;, + 187; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 190; 4; 0.300421, 0.952809, 0.013117, 0.041600;;, + 193; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 207; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 212; 4; 0.495151, 0.867712, 0.021619, 0.037885;;, + 216; 4; 0.580152, 0.813340, 0.025330, 0.035511;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 3.943333, 0.259710, 39.672764;;, + 77; 3; 3.943333, 0.259710, 39.672764;;, + 115; 3; 3.943333, 0.259710, 39.672764;;, + 135; 3; 3.943333, 0.259710, 39.672764;;; + } + } + + Animation x3ds_anim_14 { + {x3ds_L_Foot} + AnimationKey { + 0; + 34; + 0; 4; 0.707107, 0.000000, 0.707107, -0.000000;;, + 1; 4; 0.687569, -0.165071, 0.687569, 0.165071;;, + 6; 4; 0.680588, -0.191834, 0.680588, 0.191834;;, + 11; 4; 0.677475, -0.202553, 0.677475, 0.202553;;, + 21; 4; 0.676210, -0.206736, 0.676210, 0.206736;;, + 26; 4; 0.677620, -0.202065, 0.677621, 0.202065;;, + 30; 4; 0.687569, -0.165071, 0.687569, 0.165071;;, + 37; 4; 0.687569, -0.165071, 0.687569, 0.165071;;, + 43; 4; 0.681390, -0.188966, 0.681390, 0.188966;;, + 52; 4; 0.690346, -0.153046, 0.690346, 0.153046;;, + 61; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 68; 4; 0.679364, -0.196123, 0.679364, 0.196123;;, + 76; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 77; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 93; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 100; 4; 0.705872, 0.041770, 0.705872, -0.041770;;, + 104; 4; 0.698511, 0.109917, 0.698512, -0.109917;;, + 115; 4; 0.707107, -0.000002, 0.707107, 0.000002;;, + 135; 4; 0.612373, 0.353552, 0.612373, -0.353552;;, + 139; 4; 0.672346, 0.218976, 0.672346, -0.218976;;, + 155; 4; 0.659223, -0.255782, 0.659223, 0.255782;;, + 160; 4; 0.687569, -0.165072, 0.687569, 0.165072;;, + 161; 4; 0.687569, -0.165072, 0.687569, 0.165072;;, + 168; 4; 0.705347, 0.049859, 0.705347, -0.049859;;, + 172; 4; 0.706854, -0.018889, 0.706854, 0.018889;;, + 175; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 178; 4; 0.690338, -0.153079, 0.690338, 0.153079;;, + 181; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 184; 4; 0.690338, -0.153079, 0.690338, 0.153079;;, + 187; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 190; 4; 0.690338, -0.153079, 0.690338, 0.153079;;, + 193; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 207; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 216; 4; 0.687569, -0.165072, 0.687569, 0.165072;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 3; + 0; 3; 1.061092, -63.263000, -4.043970;;, + 115; 3; 1.061092, -63.263000, -4.043970;;, + 135; 3; 1.061092, -63.263000, -4.043970;;; + } + } + +} + diff --git a/rockem/skmechbk.ppm b/rockem/skmechbk.ppm new file mode 100644 index 0000000..3bc590d --- /dev/null +++ b/rockem/skmechbk.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 128 +255 +,<DDDLDLDLDLDDDDDDLDLLDDLLDDDDL$$TDDLL$$LLDLDLDLDLDD$<DLDDDDDDDDDDDDDLDDDLDLDLDLDLDLDLDLDLD$DDDDLDLDLLDDDDDDLDLDLDLDLDLDLLLLLDLLLLLLLL$<LD�������������������������������������������������������������������������DDL�������������������������������������������������������������������������DLD��TT�TT�TT�TT�TT�TT�\\�\\�TT�TT�\\�\\�TT�\\�\\�TT�TT�TT������������������������������������������������������LDL��TT�TT�\\�\\�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT������������������������������������������������������DLD��TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT���������������������������������������������������������LLD��TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT���������������������������������������������������������LDL��TT�TT�\\�TT��������������������������������������������������������������������DLL��TT�TT�TT���������������������������������������������������������������������LDL��TT�TT�TT���������������������������������������������������������������������DLL��TT�TT����������������������������������������������������������������������DDL��TT�TT����������������������������������������������������������������������DLL��TT�TT����������������������������������������������������������������������DLL��TT�TT������������������������������������������������������������������L���DLL��TT�TT������������������������������������������������������������������L���DLD��TT�������������������������������������������������������������������L���DLL��TT�������������������������������������������������������������������L���DLL��TT�������������������������������������������������������������������L���DDL���������������������������������������������������������������������D���DLD���������������������������������������������������������������������L���$<LL���������������������������������������������������������������������L���$<LD���������������������������������������������������������������������L���DLD���������������������������������������������������������������������L���DDL��������������������������������������������������������������������DL���DLD��������������������������������������������������������������������LL���DLD��������������������������������������������������������������������DL���LLD��������������������������������������������������������������������LL���DLL��������������������������������������������������������������������DL���DLD��������������������������������������������������������������������LL���DDL��������������������������������������������������������������������DL���DDL��������������������������������������������������������������������DL���DLD���T����������������������������������������������������������������LD���DDL���\����������������������������������������������������������������DL���DLD���D���������������������������������������������������������������LDL���LDL���L���������������������������������������������������������������LLL���DLD���D�������������������LDLLL��������������������������������������DLLD���DLL���L�����������������DLDDLDL��������������������������������������DLDL���DLD���L����������������DLLDLDLD������������������������������������LDLDLL���DLD���L����������������DLLDLDLD������������������������������������LDLDLL���DLL���DL���������������DLDLDLLD�����������������������������LDLLLLLDLDLLD���LLL���LL�������������LLLDLDLLLL������������������L��������LLLLDDLDLLDLDDL���DDL���LD������������LDLDLDLLDLD������������������DD������LDLDLDLDDLDLDLLD���DLL���LLL����������DLLLLDLDDLLL������������������DLLL��LLLLDLDLDLDLLLLDDL���LDL���DLLD�������LDLDLDDLDLDLDL������������������LLDLDDLLDDLDLLLDLDLDDLLD���DLL���LLLLL����LDLDDLDLDLLDLDLD������������������LDLLDLDDLDLLDLDLLLLDLDDL���DLD���LDLDLDDLLLLDLLLLDLDLLLDDL������������������LLLLLDLLLLLLLDDLDLDLDLLL���DLD���LDLDLDDLLLLDLLLLDLDLLLDDL������������������LLLLLDLLLLLLLDDLDLDLDLLL���DLL���LDDLDLDLDLDLLDLDLLLLDLDLD������������������DDLDLLLLDDLDLLLLLDLDLDLD���LLD���LDLDDLLLLDLDLLDLDLDDLDLDL������������������LLLLDLDLDLDLDLLDDLDLDLLL���LLL���LDDLDLDLDLLLDDLLDDLLDDLLL������������������LDLDLDLLLLL�������LLLDDL���DLD���LLLLLLLDLDLDLLDLDLDDLDLDL������������������DDLLLLDLD����������DLLLL���DLL���LDDLDLDLLDDLDDLLLLLLDLDLD������������������DLLLDL��������������LDLD���LDL����LLDDLLL�����LDLDLDLDDLDL������������������LLD�����������������LLDL���DLD����LLLLLD�������LDLDLLLDLLD������������������L�������������������DLL����DLD����LLLLLD�������LDLDLLLDLLD������������������L�������������������DLL����DLL����DLDDL���������LLLDDLLLLL��������������������������������������LDL����DLD�����LLLL����������DDLLDDLDL��������������������������������������LDD����DLL�����LDLD�����������LLDLLDDL��������������������������������������LDL����LLD�����DLDL���������������������������������������������������������LLL����DLD�����LDDL���������������������������������������������������������LDL������������LLDL���������������������������������������������������������DLL������������DLLL���������������������������������������������������������LDL������������DLLL���������������������������������������������������������LDL������������LDDL��������������������������������������������������������LLDD������������LLLD��������������������������������������������������������DDLL������������LDLL��������������������������������������������������������LDL�������������DLLD�������������������������������������������������������LDDL��������������LDLL������������������������������������������������������LDLD��������������LLLL������������������������������������������������������DLDL���������������DLLD����������������������������������������������������LLDLL���������������DLLD����������������������������������������������������LLDLL���������������LDDLD������LDLDLDDLDL������������������LDLDLLDLL��������LLLL����������������LLLDLD���LDLDDLLLLDLD������������������DLDLDLLLDLD�����LLLDL����������������LDDLLDLDLDLDLDLDLLLLL������������������LLDDLLDDLDLD��LDLDLD������������������LLDLDDLDLDLDLDLDLDDL������������������DLLLLLLLLLLLLLLLLLLL�������������������DLDLDLLLLLDDLLDDLLD������������������LDDDDDDDDDDDLDLDDLDL�������������������LLLDLDLDLLLLLLLLLLL������������������LLLLLLLLLLLLLDDLDLLL��������������������DDLDLDL�������������������������������������������LDDLL���������������������DDLDLDL�������������������������������������������LDDLL���������������������LDLLLL��������������������������������������������DDLD�����������������������LDL����DDLDDLLDDLDLDLDLDDDDLLDDLLD����LDL�����������������������TL����LDLDLLDLDDDLDLDLDLDLLDDLDLLLLD���LL����������������������������LDLLLDLDLDLDDDDDDDDDDDDLDLDDDDLD�������������������������L�����DDL������������������������������������������������������DLDD����L�������������������LD���DLLD������������������������������������������������������������DDDL���LL��������������������\���LL������������������������������������������������������������������$<LLT�\DL��������������������\���LL������������������������������������������������������������������$<LLT�\DL���������������������DLLDD�����������������������������������������ܤ�������������������������DDLDL\����������������������LDDL�������������������������������������������ܤ���������������������������DLL\������������������������\\<d������Dd���<��������������������������������ܜ���������������������������DL�������������������������������Ĝ���<\���L��������������������������������ܜ����������������������������������������������������������������<d�����<������������������������������������������������������������������������������������������<dD\�����L��<����������������������������������������������������������������������������������������LdD\�����<��<������������������������������ܤ��������������������������������������������������������������LdD\�����<��<������������������������������ܤ��������������������������������������������������������������Dd<\�����<��L������������������������������ܤ��������������������������������������������������������������LdD\�����L��<������������������������������ܜ�����������������������D\D\�����������������������������������<\Dd�����D��<������������������������������Ԥ�����������������������D\<\�����������������������������������<\D\�����D��D������������������������������ܤ�����������������������<\Ld�����������������������������������<\Ld�����<��D������������������������������ܤ�����������������������D\<d�����������������������������������DdD\�����D��D������������������������������ܜ�����������������������D\Dd�����������������������������������<\Dd�����D��D��D�����������������������������������������������D\<\�����������������������������������<\Dd�����D��D��D�����������������������������������������������D\<\�����������������������������������LdD\�����D��<��D��D���������������������������������������������<\Ld�����������������������������������<\Dd�����<��L��D��<��������������������������ܤ�����������������������D\<d�����������������������������������LdD\�����D��<��<��D��������������������������ܜ�����������������������<\Ld�����������������������������������<\Dd���������<��D��D��D����������������������Ԥ�����������������������D\Dd�����������������������������������<\Ld�����������T��<��D��D��������������������ܜ�����������������������<\Ld�����������������������������������<\Dd���������������D��D��<������������������ܤ�����������������������D\Dd�����������������������������������Dd<\�������������������<������������������ܤ�����������������������<\Ld�����������������������������������Dd<\�������������������<������������������ܤ�����������������������<\Ld�����������������������������������<\Dd��������������������������������������������������������Dd<\�����������������������������������<\Ld�����������������������������������������������������Dd<\Ld�����������������������������������<\Dd������������������������������������������������������������D\Ld<\�����������������������������������<\Ld������������������������������������������������������������Dd<\Ld�����������������������������������<dD\������������������������������������������������������������Ld<\Dd�����������������������������������Ld<\D\��������������������������������������������������������D\D\<dLd�����������������������������������D\<d<dD\���������������������$������$�������������������Ld<\<\DdD\�����������������������������������D\<d<dD\���������������������$������$�������������������Ld<\<\DdD\�����������������������������������<\LdLd<\D\LdLd����������������������������������������D\DdLd<\Ld�����������������������������������D\<d<dD\D\<d<\D\D\�������$�������������������������D\Dd<dD\<\Dd<\�����������������������������������D\DdLd<\<\LdLd<d<dLdLd������������������������������DdD\<\LdLdD\D\<dLd����������������������������������D\DdDdD\D\D\D\D\D\D\D\<d������������������DdLd<\<\Dd<\LdLd<\D\DdLd<\D\���������������D\LdD\LdDd<dLdLd<dDdLdLdDd<dLdLd<\LdLd<\<\LdLd<d<dLdLd<d<\Ld������������������D\<\DdDdD\LdD\D\DdLd<\D\<dLdLd<dDdLdLdDd<dLdLd<dDdLdLdD\DdD\D\D\D\D\D\D\D\D\D\D\D\D\D\D\DdD\D\DdDdD\D\D\D\D\D\D\DdD\<\D\D\<\Dd<\DdD\DdD\DdD\DdDdD\D\DdD\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\DdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdD\DdD\DdD\DdD\DdD\D\DdD\DdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdD\DdD\DdD\DdD\DdD\D\DdD\DdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDd \ No newline at end of file diff --git a/rockem/skmechbt.ppm b/rockem/skmechbt.ppm new file mode 100644 index 0000000..3f6819d Binary files /dev/null and b/rockem/skmechbt.ppm differ diff --git a/rockem/skmechch.ppm b/rockem/skmechch.ppm new file mode 100644 index 0000000..4c6c0dc --- /dev/null +++ b/rockem/skmechch.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 128 +255 +LLLLLLLLLLLLLLLLLLLLLLLLLLLLLD���������������LLLLLLLLLLLLLLLLLLLLLLLLLLLLDLDLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTT�TT�\\�TT�\\�\\�TT�TT�\\�TT�TT�\\�\\�TT�TT�\\�\\�TT�TT�\\�TT�TT�\\�\\�TT�TT�\\�TT����������������\\�\\�TT�\\�TT�TT�\\�\\�TT�\\�\\�TT�TT�\\�\\�TT�TT�\\�\\�TT�\\�\\�TT�TT�\\�\\�TT�TT�LLL\\�TT�\\�\\�TT�TT�\\�\\�TT�\\�\\�TT�TT�\\�\\�TT�TT�\\�\\�TT�\\�\\�TT�TT�\\�\\�TT�\\����������������TT�TT�\\�TT�\\�\\�TT�TT�\\�TT�TT�\\�\\�TT�TT�\\�\\�TT�TT�\\�TT�TT�\\�\\�TT�TT�\\�\\�LLDTT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�\\�TT�TT����������������\\�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�LLDTT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�\\�TT�TT����������������\\�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�LLL\\�TT������������������������TT�TT�\\����������������TT�\\�TT������������������������TT�TT�DLDTT�\\�������������������������TT�TT����������������\\�TT��������������������������TT�LLLTT�TT��������������������������\\����������������TT���������������������������TT�L��������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������������������������Դ�������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������������������Դ�������������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ�����DL\\�����������������������������������������������������������������������LLLTT�����������������������������������������������������������������������LDLTT�����������������������������������������������������������������������LLL\\�����������������������������������������������������������������������LLL\\�����������������������������������������������������������������������LDLTT�����������������������������������������������������������������������DLL\\�����������������������������������������������������������������������LDLTT�����������������������������������������������������������������������L�����������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������Ԕ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������Ԕ����������������������������������������������������������������������������������������������Դ����������������������������������������������������������������������������������������������ܜ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܜ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܔ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܜ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܔ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܔ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܜ�����LDL���������������������������������������������������������������������LDLLD���������������������������������������������������������������������LLLDL���������������������������������������������������������������������LDLDL���������������������������������������������������������������������LDLLL���������������������������������������������������������������������LLLDL���������������������������������������������������������������������LDLLL���������������������������������������������������������������������DLLLL���������������������������������������������������������������������DD�����������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������Ԝ����������������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������Ԝ����������������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������ܔ����������������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������������ܜ�������������������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������ܜ����������������������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������Ԕ����������������������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������ܜ�������������������������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������ܜ�������������������������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������ܔ�������������������������LLDL���������������������������������������������������������������DLLLL��LLLLD�������������������������������������������������������������LDDLD���LDLDLD�����������������������������������������������������������LLLDLL���LDLDLD�����������������������������������������������������������LLLDLL���LLLLLLLL�������������������������������������������������������LLLLLLL����LLDLLLLLDL�����������������D���������������D�����������������DLLLLLDDL����LDLDLLLLLLL��������������LDL���������������LLL�������������DLLLDLDDLLL����DLLLLDLLDLDLLLLLLLLLLLLLLLLDLDLDLDDLLLLLLLLLLLLLLLLDLLLLLLDL�����DLLLLLLLLLLLLLLLLLLLLLLLLLL$$L$$T$$L$$TLLLLLLLLLLLLLLLLLLLLLLLDDLLL�����DLLLLLLLLLLLLLLLLLLLLLLLLLL$$L$$T$$L$$TLLLLLLLLLLLLLLLLLLLLLLLDDLLL�����LLDLLL�����������������������������������������������������������LLDL�����DLLLL������������������������������������������������������������LLLL�����LLDL�������������������������������������������������������������DLLL�����LDLL�������������������������������������������������������������LLLL�����LDLL�������������������������������������������������������������LLLL�����$<LDLL\\������������������������������������������������������������DLLL�������LDLTT������������������������������������������������������������L����������LLLTT�TT�����������������������������������������������������������D������������LLTT����������������������������������������������������������LL������������LDTT�TT���������������������������������������������������������L�������������LDTT�TT���������������������������������������������������������L��������������LTT�\\�TT�������������������������������������������������������TT�L���������������LTT�\\�����TT�\\�\\�TT�TT�\\�TT�\\�TT�TT�\\�\\�TT�TT����������������TT�TT�\\�\\�TT�TT�TT�TT�\\�TT�\\�TT�TT�\\�������\\�DL���������������LTT�\\�TT���TT�TT�TT�TT�\\�TT�TT�\\�TT�\\�TT�TT�TT�TT�TT����������������TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�\\����TT�TT�LL���������������LLTT�\\�TT�TT�TT�TT�\\�TT�TT�DLDDDDDDLDLLDLLDDLLLLLLDLDDLTT�TT�TT�\\��TT�\\�TT�L����������������LLTT�\\�TT�TT�TT�TT�\\�TT�TT�DLDDDDDDLDLLDLLDDLLLLLLDLDDLTT�TT�TT�\\��TT�\\�TT�L����������������DLDTT�\\�\\�TT�\\�TT�DLLLDLLLLLDDLDLLLDDLDLDLLLDLLLLTT�TT�TT�TT�TT�TT�TT�D�����������������LDTT�TT�TT�TT�TT�$DLD���������������������������DLLLTT�\\�TT�TT�L������������������DLTT�\\�\\�TT�DL�������������������������������LDTT�TT�TT�LL�������������������LLTT�TT�TT�LL�<dD\DdD\D\DdLdD\<\LdDd<\D\DdD\<d<\D\D\Dd<\D\Ld<\LdD\LdD\��DLLTT�LDL��������������������LDLLL�D\LdLdLdDdDdLdDdLdLdDdD\LdDdD\DdD\LdLdLdLdLdLdDdDdLdD\D\DdLd��LLLLLL��������������������LDLLL�D\LdLdLdDdDdLdDdLdLdDdD\LdDdD\DdD\LdLdLdLdLdLdDdDdLdD\D\DdLd��LLLLLL��������������������DLLL��DdLd�����������������������������������������������������������D\<d��LDLL����������������������DLD�<\LT�������������������������������������������������������������LdDdLd��LD��������������������������DdLd�����������������������������������������������������������������D\<\Ld�����������������������������D\L\�������������������������������������������������������������������L\Ld����������������������������LdDd���������������������������������������������������������������������D\<d����������������������������LdDd���������������������������������������������������������������������D\<d���������������������������<dLd���������<��D��D��D��<��D��<��D��<��D���������������ܴD��<��L��D��<��<��D��D��<��D��D��D��D�����D\���������������������������LdD\�������<��<��D��<��<��D��<��D��D��<��<���������������ܬ<��<��D��D��D��D��D��D��<��D��<��D��D��D���Ld���������������������������DdLd�����<��L��D��<��D��<��D��D��D��D��D��D���������������ܬD��D��D��D��<��<��D��<��D��D��D��D��<��D���D\���������������������������LdD\�����<��D�D\Dd<\D\DdLdD\<\LdDd<\D\<dLdLdDd<dLdLdD\Dd<\D\<\LdLdD\�D��<���Ld���������������������������LdD\�����<��D�D\Dd<\D\DdLdD\<\LdDd<\D\<dLdLdDd<dLdLdD\Dd<\D\<\LdLdD\�D��<���Ld���������������������������Ld<d���D��<�DdLdDdLdDdLdDdLdDdLdD\LdD\D\D\D\D\D\LdD\LdLdLdDdLdDdD\LdLd�D��<�D\���������������������������<\Ld���D�DdD\�����������������������������������������������������������DdD\�D�Dd���������������������������Ld<d���D�D\Ld�����������������������������������������������������������L\Ld�<�Dd����������������������������Ld��LdDd���������������������������������������������������������������L\D\<d����������������������������LdLdD\�������������������������������������������������������������������Ld<\����������������������������LdLdD\�������������������������������������������������������������������Ld<\�����������������������������D\Ld�������������������������������������������������������������������DdLd�����������������������������Ld<d�����D��<��D��D��<��D��<��D��D��D���������������ܬ<��<��D��<��D��D��<��<��D��<��D��<�������Dd�����������������������������D\Ld�����<��D��<��D��<��<��D��D��<��<���������������ܬD��D��D��D��<��D��<��<��D��D��D��<�������Ld�����������������������������Ld<d���<��<�DdD\D\DdLdDdLdD\Ld<\<\Ld<\DdD\<\LdDdD\<\DdD\Ld<\D\�<��<�����Dd�����������������������������Ld<d���<��<�DdD\D\DdLdDdLdD\Ld<\<\Ld<\DdD\<\LdDdD\<\DdD\Ld<\D\�<��<�����Dd�����������������������������D\Dd���D�LdD\DdDdLdLdD\DdLdDd<\D\DdD\D\DdLdDdLdDdLdDdLdDdLdLdDd�<��D���Ld�����������������������������DdLd���D�D\Dd���������������������������������������������������L\Ld�D��<���Dd�����������������������������LdD\�<��D�Ld�������������������������������������������������������L\D\�<��<�<d�����������������������������<dLd�D�D\������������������������������������$����������������������LdDd�D�D\�����������������������������LdL\�D�Ld�����������������������������������������������������������D\Dd�<�Ld�����������������������������LdL\�D�Ld�����������������������������������������������������������D\Dd�<�Ld�����������������������������Ld<d�D�Ld�������������������������������������������������������������Ld�D�D\������������������������������Dd�<�<\�������������������������������������������������������������<\D\<d������������������������������LdD\Ld�����<��<��D��<��D��D��D��D���������������ܴD��D��D��D��D��<��D��D��<��L��L��<���LdDdLd�������������������������������<dLd���<��D��D��D��D��<��<��D��<���������������ܴD��D��<��D��<��D��D��D��D��<��<��D�����<d��������������������������������<dLd���<��D��D��D��D��<��<��D��<���������������ܴD��D��<��D��<��D��D��D��D��<��<��D�����<d��������������������������������DdD\���<��D��<��D��<��D��D��<��<���������������ܬ<��<��D��D��<��<��D��<��D��D��D��<��<���Ld��������������������������������<\Ld�<��L��<�Ld<\D\DdLd<\D\DdLd<\LdDdD\Dd<\D\DdDd<\DdD\LdDd�D��D��<�Ld��������������������������������Ld<d�<��<�LdLdDdDdLdDdLdD\DdDdD\D\DdDdLdLdLdD\D\LdLdDdLdLdD\�D��D�D\��������������������������������D\Ld�L��<�D\�������������������������������������������������D\Dd�D��D�<d��������������������������������<dLd�<��D�D\�������������������������������������������������Ld<\�<��D�Ld��������������������������������<dLd�<��D�D\�������������������������������������������������Ld<\�<��D�Ld��������������������������������LdD\�<��D�Dd�������������������������������������������������<dLd�<��D�Dd��������������DdD\Dd<\Dd<\Dd<\Dd<\DdLdDdLdDdLdDdLdDdLdDdLd<\�������������������������������������������������DdD\<\DdLd<\D\LdDdD\LdDdD\<\DdLd<\D\LdDdLdD\D\LdLdD\D\LdLdD\LdLdD\D\LdLdD\D\LdLdD\LdLdD\D\LdLdD\D\D\D\D\D\D\DdLdD\D\LdLdD\D\LdD\D\LdLdD\D\LdLdD\D\LdD\D\LdLdD\D\LdLdD\LdDdDdDdDdDdDdDdDdDdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdDdDdDdDdDdDdDdDdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDd \ No newline at end of file diff --git a/rockem/skmechgr.ppm b/rockem/skmechgr.ppm new file mode 100644 index 0000000..b6d1cf6 Binary files /dev/null and b/rockem/skmechgr.ppm differ diff --git a/rockem/skmechhn.ppm b/rockem/skmechhn.ppm new file mode 100644 index 0000000..ce1be9c Binary files /dev/null and b/rockem/skmechhn.ppm differ diff --git a/rockem/skmechjd.ppm b/rockem/skmechjd.ppm new file mode 100644 index 0000000..dd47891 Binary files /dev/null and b/rockem/skmechjd.ppm differ diff --git a/rockem/skmechla.ppm b/rockem/skmechla.ppm new file mode 100644 index 0000000..a77499a Binary files /dev/null and b/rockem/skmechla.ppm differ diff --git a/rockem/skmechll.ppm b/rockem/skmechll.ppm new file mode 100644 index 0000000..2873eb8 --- /dev/null +++ b/rockem/skmechll.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 128 +255 +��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������LLLLLLLLLLLLLLLLL�������������������������������������������������������������������������������������������������������������������������������������LLLLLLLLLLLLLLLLL�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������LTT�TT�\\�\\�TT�TT�TT�TT�TT�TT�TT�TT�\\�TT�\\�L�������������������������������������������������������������������������������������������������������������������������������������L\\�\\�TT�TT�\\�\\�\\�\\�\\�\\�\\�\\�\\�\\�TT�L�������������������������������������������������������������������������������������������������������������������������������������LTT�TT�\\�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������LLLLLLLLLLLLLLLLL�������������������������������������������������������������������������������������������������������������������������������������LLLLLLLLLLLLLLLLL�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L\\�TT�\\�TT�TT�TT�TT�\\�TT�TT�\\�TT�TT�\\�TT�L�������������������������������������������������������������������������������������������������������������������������������������LTT�\\�\\�\\�\\�\\�\\�TT�\\�\\�TT�\\�TT�\\�TT�L�������������������������������������������������������������������������������������������������������������������������������������LTT�TT�TT�TT�TT�TT�\T�TT�\T�TT�\T�TT�TT�\\�TT�L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������LLLLLLLL$<$<$<$<$<LDLL�������������������������������������������������������������������������������������������������������������������������������������LLLLLLLLLLLLLLLL$D��������������������������������������������������������������������������������������������������������������������������������������L�������������L���������������������������������������������������������������������������������������������������������������������������������������L�������������L���������������������������������������������������������������������������������������������������������������������������������������D�������������L���������������������������������������������������������������������������������������������������������������������������������������L�������������L������������������������������������������������������������������LLLLLLTTTLLLLLLTTTLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLLLLTLLLLLLLLLLLLLLLLLLLLLLLLLLTTTTTTLLLTTTLLLTTTLLLTTTLLLTTTTTTLLLTTTTTTLLLLLLLLLLLLTTTTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL\LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL������������������������������������������������������������������LL�������TT�\\�\\��������DL���������������������������������������������������������������������������������������������������������������������������������LL�������\\�TT�\\��������LD���������������������������������������������������������������������������������������������������������������������������������DL�������\\�\\�TT��������LL���������������������������������������������������������������������������������������������������������������������������������LL�������TT�\\�\\��������LL���������������������������������������������������������������������������������������������������������������������������������LL�������\\�TT�\\��������LL���������������������������������������������������������������������������������������������������������������������������������LL�������\\�\\�TT��������LL���������������������������������������������������������������������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLLLLLLLTTTLLLLLLTTTLLLLLLTTT���LL�������\\�TT�\\��������LL���LLLLLLTTTLLLTTTTTTLLLTTTLLLLLLTTTLLLTTTLLLLLLTTTLLLLLLTTT���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLTTTLLL���LL�������TT�\\�\\��������DL���TTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLL���������LLLLLLLLLLLLLLLLLLLDTLLLLLL���DL�������\\�TT�\\��������TL���LLLLLLLDLLLLLLLLLLLLLLLLLLL���������LLLLLLL������������LLLLLLLL���LL�������\\�TT�\\��������LT���LLLLLLLL������������LLLLTTT���������LLLLLLL������������LLTTTLLL���LL�������TT�\\�\\��������DL���LLLTTTLL������������LLLLLLL���������LLLLLLL������������LLLLLLLL���LL�������\\�TT�\\��������LD���LLLLLLLL������������LLLLTTT���������LLLTTTL������������LLLLLTTT���LL�������\\�\\�TT��������DL���LLLTTTLL������������LLLLLLL���������LLLLLLLTT�\\�\\�TT�\\�\\�TT�\\�\\�TT�TT�TT�LLTTTLLL���LL�������\\�TT�\\��������LL���LLLLLLLLTT�\\�\\�TT�TT�TT�TT�TT�\\�TT�TT�TT�LLLLTTT���������TTTLLLL\\�TT�\\�TT�\\�\\�\\�TT�TT�\\�\\�TT�LLLLLLLL���LL�������TT�\\�\\��������LL���LLLTTTLLTT�TT�TT�\\�\\�\\�\\�TT�\\�TT�\\�TT�LLLLLLL���������LLLLLLL������������LTLLLLLL���LL�������\\�\\�TT��������DL���LLLTTTLL������������LTTTLLL���������LLLTTTL������������L\TTTLLL���LL�������\\�TT�\\��������LL���LLLLLLLD������������LLLLLLL���������LLLLLLL������������DTLLLLLL���LL�������TT�\\�\\��������LL���LLLLLLLL������������DLLLLLL���������LLLTTTT������������LLTTTLLL���LD�������\\�TT�\\��������LD���LLLTTTLD������������LTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLL���LD�������\\�\\�TT��������LL���LLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLLLLLLLLLLLLLLLLTTTLLL���LD�������\\�TT�\\��������LL���LLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLL������������LLTTTLLL���LL�������\\�TT�\\��������LD���LLLTTTLD������������LLLLTTT���������LLLLLLL������������LTLLLLLL���LL�������\\�\\�TT��������LL���LLLLLLLL������������LLLLLLL���������LLLTTTL������������LLTTTLLL���LL�������\\�TT�\\��������LD���LLLTTTLL������������LLLLLLL���������LLLLLLL\\�TT�TT�TT�\\�\\�TT�\\�\\�TT�\\�TT�LLLLLLLL���LD�������TT�\\�\\��������TL���LLLLLLLL\\�TT�TT�TT�\\�TT�\\�\\�TT�\\�TT�TT�LLLLLLL���������LLLLLLLTT�\\�\\�\\�TT�TT�\\�TT�TT�\\�TT�TT�LLLLLLLL���LL�������\\�TT�\\��������DL���LLLLLLLLTT�\\�\\�\\�TT�\\�TT�TT�\\�\\�\\�TT�LTTTLLL���������TTTLLLLTT�TT�TT�TT�TT�\T�TT�\T�\T�TT�\\�TT�LLTTTLLL���LL�������\\�\\�TT��������LL���LLLTTTLL\\�TT�TT�TT�TT�\T�TT�TT�TT�TT�TT�TT�LLLLLLL���������LLLTTTL������������LLLLLLLL���LL�������TT�\\�\\��������LL���TTTLLLLL������������LTTTLLL���������LLLLLLL������������LLLLLLLL���LD�������\\�TT�\\��������LL���LLLLLLLL������������DLLLLLL���������TTTLLLL������������LLTTTLLL���LL�������\\�\\�TT��������DL���LLLTTTLD������������LLLLLLL���������LLLLLLLDLLLLDD$<$<$<DDLLLLLLLL���LL�������\\�TT�\\��������LL���LLLLLLLLLLL$<$<$<$<D$<DDLLTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLL���LL�������TT�\\�\\��������DL���LLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLLLLTTTLLLTTTLLLLLLTTTLLLTTTTTTLLLLLLLLLLLLLLLLLLLLL���LL�������\\�TT�\\��������LL���TTTLLLLLLTTTLLLLLLLLLTTTLLLLLLLLLTTTLLLLLLLLLLLLTTTLLLLLL���������LLLLLL���������������������������������������������LLLLLL���LT�������\\�TT�\\��������LL���LLLTTT���������������������������������������������LLLTTT���������LLLTTT���������������������������������������������LLLLLL���DL�������TT�\\�\\��������DL���LLLLLL���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������LLLTTT���LD�������\\�TT�\\��������LL���LLLTTT���������������������������������������������LLLTTT���������TTTLLL���������������������������������������������TTTLLL���DL�������\\�\\�TT��������DL���LLLLLL���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������LLLLLL���LD�������\\�TT�\\��������DL���LLLTTT���������������������������������������������LLLTTT���������LLLTTT���������������������������������������������LLLLLL���LL�������\\�TT�TT��������LL���LLLTTT���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������LLLLLL���LDLLLLLLLLLLLLLLLLLLL���LLLLLL���������������������������������������������TTTLLL���������LLLTTT���������������������������������������������TTTLLL���LLLLLLLLLLLLLLLLLLDLL���LLLTTT���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������LLLLLL���LTLdDdLdLdLdDdLdLdDdLdLdLdLdLdLdLdDdLL���LLLLLL���������������������������������������������TTTLLL���������LLLTTT���������������������������������������������TTTLLL���LDDdLdLdLdLdLdLdLdLdLdLdLdLdLdLdDdDdLL���LLLTTT���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������LLLLLL���DLLd�ČČ̌̌̌̔ČԌ̌̌̌̌̌̌�LdLL���LLLLLL���������������������������������������������TTTLLL���������LLLLLL���������������������������������������������LLLLLL���DLLd������������������������������DdLL���LLLLLL���������������������������������������������TTTLLL���������LLLLLL���������������������������������������������LLLLLL���LDDd������������������������������LdLL���LLLTTT���������������������������������������������LLLLLL���������TTTLLL���������������������������������������������LLLTTT���LLLd�L��<��D��<��D��D��D��<��D��D��<��D��D��<��L�DdDL���LLLLLL���������������������������������������������LLLLLL���������LLLTTT���������������������������������������������LLLLLL���LLDd�<��D��<��<��D��<��D��D��D��D��D��D��D��D��<�L\LL���LLLTTT���������������������������������������������TTTLLL���������TTTLLL���������������������������������������������LLLLLL���LLLd�L��<��D��D��<��L��D��<��D��D��<��D��D��<��D�LdLD���LLLLLL���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������TTTLLL���LLDd������������������������������LdLL���LLLTTT���������������������������������������������LLLLLL���������LLLLLLllllllTTTllllllllllllllllllllllllllllllTTTlllTTTLLL���LLLd�Č̌̌Č̌̌̌̌̔Č̌̌̌Č�DdLL���LLLTTTlllTTTlllTTTlllllllllllllllllllllllllllllllllLLLLLL���������LLLLLLlllllllllllllllTTTTTTllllllllllllTTTlllllllllLLLLLL���LLLd�̌ČČ̌ČČČČČČČČČ̌�LdLL���LLLLLLllllllllllllllllllllllllllllllTTTllllllllllllLLLLLL���������LLLLLLlllTTTlllTTTllllllllllllllllllllllllTTTllllllLLLLLL���DDDdLdDdLdLdLdLdLdLdLdLdLdLdLdL\LdLdLL���LLLTTTllllllTTTlllTTTlllllllllTTTllllllllllllTTTlllLLLTTT���������LLLLLLllllllllllllllllllTTTllllllllllllTTTlllllllllLLLLLL���LLLdLdLdLdLdDdLdLdDdLdLdDdLdLdDdLdDdLL���LLLLLLllllllllllllllllllTTTllllllllllllllllllllllllLLLLLL���������LLLTTTllllllTTTlllllllllllllllTTTTTTlllllllllllllllLLLLLL���LLLdLdLdLdLdLdLdLdLdLdLdLdLdLdLdLdL\LL���LLLLLLlllTTTlllllllllTTTlllllllllTTTlllTTTlllllllllLLLTTT���������LLLLLLlllllllllllllllTTTlllllllllllllllllllllTTTlllLLLTTT���LLLd�ČČ̌̌̌̔ČԌ̌̌̌̌̌̌�DdLL���TTTLLLllllllllllllllllllllllllTTTlllllllllTTTllllllLLLLLL���������LLLLLLllllllllllllllllllllllllTTTTTTlllllllllllllllLLLLLL���LLLd������������������������������DdLL���LLLLLLllllllTTTllllllllllllllllllllllllllllllTTTlllLLLLLL���������LLLLLLlllllllllllllllTTTlllllllllllllllllllllTTTlllTTTLLL���LLD\������������������������������LdLL���LLLLLLllllllllllllTTTlllTTTllllllllllllTTTlllllllllLLLTTT���������TTTLLLlllTTTllllllllllllTTTlllllllllTTTllllllllllllLLLLLL���LLLd�L��D��<��D��<��D��D��D��<��<��D��D��<��D��D�LdLL���LLLLLLlllllllllllllllllllllllllllllllllllllllllllllLLLLLL���������LLLLLLlllllllllTTTlllllllllllllllllllllllllllllllllLLLTTT���LLDd�<��<��L��D��D��<��<��D��D��D��D��<��D��<��D�D\LL���LLLTTTlllTTTlllllllllTTTllllllTTTlllTTTlllTTTllllllLLLTTT���������LLLLLLllllllTTTlllllllllTTTllllllllllllllllllllllllLLLLLL���LLLd�L��<��D��D��D��<��D��<��D��<��D��D��D��<��D�LdLL���LLLLLLlllllllllTTTllllllTTTllllllllllllllllllllllllLLLLLL���������LLLTTTllllllllllllTTTllllllllllllllllllTTTlllTTTlllLLLLLL���LLLd������������������������������DdLL���LLLLLLlllllllllllllllllllllllllllllllllTTTlllTTTlllLLLLLL���������LLLLLLlllllllllTTTlllllllllllllllTTTlllllllllllllllLLLLLL���LLLd�̌̌Č̌Č̌̌̌ČČ̌̌̌̔�DdLL���LLLLLLlllllllllllllllllllllllllllTTTlllllllllllllllLLLLLL���������LLLTTTllllllTTTlllllllllllllllTTTllllllllllllllllllLLLLLL���LDLd�ČČ̌̌Č̌Č̌ČČČČČČ�DdDL���TTTLLLllllllllllllllllllllllllTTTllllllllllllllllllLLLLLL���������LLLLLLllllllllllllTTTlllllllllllllllTTTllllllTTTlllTTTLLL���LDLdLdDdLdLdDdLdLdDdLdLdLdLdLdLdDdLdLL���LLLLLLlllTTTllllllTTTlllllllllllllllTTTllllllTTTlllTTTLLL���������LLLLLLlllllllllllllllllllllllllllllllllllllllllllllLLLLLL���L$<LdLdLdLdLdLdLdLdLdLdLdLdLdLdLdLdD\LL���TTTLLLlllllllllllllllllllllllllllllllllllllllllllllLLLLLL���������LLLTTTlllllllllllllllllllllllllllllllllllllllllllllLLLLLL���LDL\�ČČ̌̔Č̔Č̔Č̌̌Ԍ̌̌�LdLL���LLLLLLlllllllllllllllllllllllllllllllllllllllllllllLLLLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLDd������������������������������LdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LDLd������������������������������DdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLLd�D��<��D��D��<��D��D��D��<��D��<��D��D��<��L�DdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LDLd�L��<��D��D��D��D��D��D��D��<��L��<��<��D��<�LdLL���LLLLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLLd�D��<��L��D��<��D��D��<��D��D��<��D��D��<��L�LdLL���LLLTTTTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������TTTLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LLLd������������������������������DdLL���LLLLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTT���������TTTLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LLLd�̌̌Č̌Č̌Č̌ČČ̌̌̌Č�DdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLDd�ČČ̌̌Č̌̌Č̔ČČČČ̌�LdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LLLdDdLdDdDdLdLdDdLdLdDdLdLdDdLdLdDdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLDdLdLdLdLdLdLdLdLdLdLdLdLdLdLdLdLdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LDLd�ČČ̌̌̌̌̔Č̌̌̌̌̌̌�DdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLLd�Č̌̌̔ĔČԔĔĔĔĔĔĔĔ�LdDL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLDd������������������������������LdLD���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LLLd�D��D��<��D��D��D��<��D��<��D��<��D��D��<��L�LdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLDd�<��<��L��D��<��D��D��D��D��<��D��D��<��D��<�LdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LLLd�L��<��D��D��D��D��D��<��D��D��D��<��<��L��<�LdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLDd������������������������������LdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������TTTLLLLLLTTTLLLLLLTTTLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LLLd������������������������������DdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLLLLTTTLLLTTTTTTLLLTTTTTTLLL���LLDd�̌ČČ̌ČČĄČČĄČČČ̌�DdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLL���LLLdLdLdLdLdLdDdLdLdLdDdLdLdLdDdLdLdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������TTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLLLLTTTTTTLLL���LLDdLdDdDdDdDdLdDdDdDdLdDdDdDdLdDdDdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLL���L\DTLLLLLLLLLLLLLLLLL���LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTLLLLLLTTTTTTLLLLLLTTTLLL���DLLLLLLLLLLLLLLLLLLLL���LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLLLLL���LD�����������������LL���LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLTTT���LL�����������������LL���LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLL���LL�����������������LL���LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������������������������������������������������������������������LL�����������������LL���������������������������������������������������������������������������������������������������������������������������������LL�����������������LL���������������������������������������������������������������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL \ No newline at end of file diff --git a/rockem/skmechua.ppm b/rockem/skmechua.ppm new file mode 100644 index 0000000..f25a6af --- /dev/null +++ b/rockem/skmechua.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +32 32 +255 +�������������̌�LdDdD\LdLdLdLdLdLdDdD\Dd�Ĥ������������̄�D\<d���������������Č�Dd�Č̌ČĔČČČČČ�Ld�Ĥ������������Ą�LdLd���������������̌�Dd�ČČČČ̌̌̌̌Č�Dd�Ĥ������������̄�D\Dd���������������̌�Ld�̤�����������������Ld�Ĭ������������Ą�LdLd���������������Č�Ld�̬�����������������Ld�Ĥ������������Ą�D\Ld���������������Č�Dd�̤�����������������Dd�Ĥ������������̄�LdLd���������������Č�Ld�̤�����������������Ld�Ĭ������������Ą�LdLd���������������Ĕ�Ld�Ĥ�����������������Ld�Ĭ������������̄�LdDd���������������Č�Dd�̬����D��D��D���������Dd�Ĭ�������������D\LdLd���������������Č�Ld�̤����D��D��D���������Ld�Ĥ�������������<dLdLd���������������̔�D\�Ĭ����D��D��D���������Dd�Ĭ����������̌�D\LdDd������������������Ld�̤����D��D��D���������Dd�Ĥ����������̄�LdD\Ld���������������Č�Ld�̤����D��D��D���������Ld�Ĭ��������Ą�DdDdLdLd���������������Č�Ld�Ĥ����D��D��D���������Dd�Ĥ��������Č�<\D\LdLd���������������Č�Ld�̤����D��D��D���������Ld�Ĥ������ČĄ�Ld��LdLd���������������Ĕ�Ld�Ĥ����D��D��D���������Dd�Ĭ������̄�L\Ld��LdLd������������������Dd�Ĥ����D��D��D���������D\�̤����̄�LdDd�Ą�D\Dd������������������Dd�̬����D��D��D���������Ld�Ĥ����Č�DdLd�Ą�LdLd���������������Č�Ld�Ĥ����D��D��D���������D\�̬����̄�LdD\�̌�LdLd���������������̄�Ld�̬����<��D��D���������Ld�Ĥ��̌Ą�DdLd�Ą�DdLd���������������Č�Ld�̤����D��L��D���������Ld�Ĥ��̌�D\�ĄĄĄ�LdLd���������������̌�Dd�Ĭ����D��D��D���������Dd�Ĥ��̌�Ld�Č̌̄�D\<d���������������Ą�Ld�̤����D��D��L���������Ld�Ĥ��̄�D\�̌ĴD��LdLd���������������̌�<\�Ĥ������<��<���������Dd�Ĭ��̄�<d�̌ĴD���LdLd���������������̌�Dd�̤�����������������Ld�Ĥ��̄�D\�Č̴D��LdLd���������������Č�Ld�Ĥ�����������������Ld�Ĭ��̄�Ld�̴D��D���LdLd���������������̌�Ld�̤�����������������D\�̤��̄�Dd�ĴD��<���LdLd���������������̌�Dd�Ĭ�����������������Ld�Ĥ��Ą�D\�̴D��D��LdLd���������������Č�Dd�ČČČČČČ̌̌Č�Ld�Ĥ��̄�Ld�̴D��D��LdLd���������������Č�Ld�Č̌̄ĄĄČĄČĄ�Ld�Ĥ��̌�Dd�Ĭ<��D���LdLd������������������D\LdD\<\LdLdLdLdLdLdLdLd�Ĭ��̌�Ld�ļL��D��DdLd���������������̔�DdDdLdLdDdLdDdLdLdLdLdLd�Ĥ��̌�L\�̼L��L���LdLd�� \ No newline at end of file diff --git a/rockem/skmechul.ppm b/rockem/skmechul.ppm new file mode 100644 index 0000000..07ed06e --- /dev/null +++ b/rockem/skmechul.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 64 +255 +����������DdLd�Č̜������������������Ą�<\Ld������������������LdD\Ld������������������Ld<\Ld�Č̤����������������̄�LdD\������������������LdDd�ČĜ����������������Ą�<\<\Dd������������������LdDdLd��������������������LdDd�ĄĤ����������������̌�D\<d������������������LdDd�ĄĤ��������������Ą�D\Dd����������������������LdD\Ld��������������������LdLdDd�ĄĤ��������������̌�Dd<\������������������D\Ld�Ą̤��������������̄�D\<d����������������������LdDdLd����������������������DdLd�Ą̬��������������Č�<\Ld������������������LdDd�Ą̬������������Ą�<\Ld������������������������LdD\Ld������������������������LdLd�Č̤������������Č�D\<d������������������LdLd�ĄĬ������������̄�DdD\������������������������LdDdLd������������������������LdDd�ĄĬ������������̌�D\Ld������������������DdLd�ČĤ������������Ą�D\Dd�����Ĥ�����������������Ld<dLd�������������������Ĝ���DdLd�Č̤������������Č�D\Dd������������������LdDd�Ą̤����������Č�<\Ld�����ČĤ�����������������LdDdLd�������������������̤�����D\Ld�Č̤����������Č�D\Ld������������������LdLd�ČĤ����������̄�D\<d�����̌Ĥ���������L\L\����LdDdLd����D\LT�����������̌Ĥ���D\Dd�ČĬ����������̌�DdD\������������������LdDd�ČĤ��������̄�Dd<\�����̄ČĜ���������Dd<\����D\LdLT����<d<\�����������̌ČĤ���LdDd�ČĬ��������̌�LdD\������������������DdLd�Ą̤��������Č�<\Ld�����Č̄Ĥ���������<\Ld����LdDdLd����D\<d�����������ĄČ̤���DdLd�Č̤��������Č�<\Dd������������������Ld<\�ČĤ��������Ą�DdD\�����̌Ĭ�����������Ld<d����LdLdDd����<d<\�����������̄Č̤���LdLd�Č̬��������̌�Ld<\������������������LdLd�ČĤ��������Ą�<dD\�����Č̤�����������Dd<\����LdDdLd����DdD\�������������̄Ĥ���LdDdLd�Ĭ��������̌�Ld<\������������������D\Ld�ČĤ������Č�<\Ld�����Č̄Ĭ�����������LdLd����Ld<dLd����<\D\�̤����������ČĤ�����D\Ld�Č̤������Č�<\Ld������������������<\Ld�ĄĤ������Č�D\Dd�����ĄČĤ�����������LdLd����LdDdLd����D\<\�̬����������Č�Dl����DdLd�Č̤������Č�<\Ld������������������LdDd�ČĬ����̌�D\D\Ld��L\�Č̤�������������D\Dd����Ld<dLd����<\<\�Ĭ�������������<\D\��LdDdLd�Č̬����̌�Ld<\������������������<\Ld�Ą̤����Č�D\Dd����Dd�Č̬�������������<\Ld����LdD\Ld����<\<\�̤�������������D\<d��DdLdD\�Č̤����Č�<\Ld������������������LdD\�̌Č̌Č̌�<dDd����Ld�Č̤����������Č�<\Ld����LdDdLd����D\<\�Ą̤�����������D\<\����DdLd�Č̌ĄČČ�<\Ld������������������LdDd�ČČČ̌�D\Ld<\��LdLd�Č̬����������̌�LdDd����LdD\Ld����<d<\�̄Ĭ�����������L\<\D\��LdD\�Č̄ČČ̌�Ld<\������������������LdLd�ČČ̌Ą�D\<\Dd��Ld<d�Ĥ����������̌Č�<dLd����LdDdLd����<d<\�ČČĤ�����������<\D\��Ld<\D\�̌ČČ̌�Ld<\������������������DdLd�Č̌ČĄ�LdDdL\��LdLd�̤����������̌�Ld<\Ld����LdD\Ld����<\D\D\�Ą̤�����������D\<d��LdLdDd�ĄČ̌Č�<\Ld������������������LdDd�ČČ̄Ą�DdD\����LdD\�Ĥ����������̌�LdDdLd����LdDdLd����Dd<\<\�̌Ĥ�����������<\<\����Ld<\�Č̌ČČ�D\<d������������������LdLd�ČČ̄Č�D\<d����LdLd�Ĭ��������̌Č�LdD\Ld����Ld<\Ld����Dd<\<\�̌ĄĬ���������<\D\����LdDdD\�Č̌Č�DdD\������������������DdLdD\�̌�D\LdD\Ld����LdL\�̤��������Č̌�LdDdLd����D\LdLd����D\<\D\�Č̄Ĥ���������D\<d����D\LdLdDd�Č�Ld<\Ld������������<\Ld�Ĥ�DdLd�Č�LdLdLd������LdLd�̬������ČČ̄�LdD\������LdD\Ld������<\<\�Č̌Ą̤�������D\<\������LdLdD\�̄�D\Ld����<\Ld������Ld<\�̤�LdDdLd<\DdD\Ld������LdL\�Ĥ������̌Č�Ld<dLd������LdDdLd������D\D\<\�̌ČĬ�������<\Ld<\����LdDd<\LdDdLdDd����LdLd������DdD\�̤�LdD\LdLdLdDd������D\LdD\�̬������Č̌�LdLd������L\LdD\DdLd������LT<\�ČČĤ�������Ld<\<d����DdLdD\LdD\LdLd����D\Ld������DdD\�̤���DdLdDd<\Ld������D\Ld�̌Č̤��̌̄�LdDdLd������D\DdLdD\Ld������D\<\<\�̌Č̤��Č�D\DdLd������LdDd<\LdLd������DdLd������Ld<\�̤�����LdLdLdDd������LdLd�ČČ̌ČČČ�LdDdL\����L\DdLd����LdDd����DT<\Dd�Č̄ČČ̌�LdDd<\������LdLdLdDd��������LdD\������Dd<\�̤�����LdDdLdDd������LdDd�Č̌Č̌Č�D\LdLd������LdDdL\����LdLd�����L\<\Ld�ČČČ̌Č�LdDd������LdDdLd�������̌�LdDd������LdD\�̤�������LdD\Ld������<dLd�ČČ̌ČČ�<dLd������L\DdLd��������DdLd������Dd<\�̌Č̌Č̌�<\Ld������LdD\Ld�������Č�DdLd������DdD\�ČĤ�����LdDdLd������LdLd�Č̌Č̌�LdDdLd������LdDdLd��������LdDd������Ld<\�ČČČ̌Č�Ld<\������LdDdLd�����̄Č�DdLd��������Ld<d�Ĥ�������LdDd������LdDd�ČČ̌Č�D\DdLd������LdLd����������L\LdDd������LdLd�̌Č̌Č�<\D\<\����LdD\Ld�����Č�Ld<\Dd��������D\Dd�Č̜�����D\Ld����LdD\Ld�̌ČČ̄�LdLd������D\D\Ld������������DdLd������DdLd�̌ČČ̌Ą�Dd<\����LdDdLd���Č̌�D\<d����������D\D\Ld�Ą̔��LdLd����LdD\Ld�ČČ̌�D\LdLd����LTLdLd�̤�����������L\DdLd����D\<\���̌ČČ̌�Ld<d����LdDdLd���Č�D\<\Dd������������Dd<\�ĄČČ�LdD\����LdDd�Č̌ČČ�LdD\������LdDdD\�Ĭ����������̄�LdDd������Ld�ĄČČ̌Č�Ld<\����Ld<\Ld�Č�D\<dLd����������������DdD\�Ą̌�LdDd����LdLd�Č̌Č�Ld<dDd����LdD\Ld�ĄĬ����������̄�DdLdDd������D\DT�Č̌Č�Ld<\����Dd<\Ld�Č�DdD\������������������DdD\���Č�DdLd����DdLd�̌Č̌�D\Ld������LdDdLd�Ą̬����������Ą�LdD\Ld������<dD\�̌ČČ�Dd<\����<\LdLd��Ld<dLd������������������L\DdLd�Ą�DdLd����LdD\�ČČČ�LdD\������Ld<\Dd�ĄĬ����������̌�DdLdDd������<\<\�Č̌Č�Ld<\����LdDdD\��Ld<\Dd��������������������LdDdD\<dD\Ld����LdLd�ČĄ�LdLdDd����LdDdD\Ld�Ą̬����������̌�DdLdDdD\����LdDd<\�̌Č�Dd<\����LdLdD\Ld<dD\������������������������<\LdD\DdLd����D\Ld�̌�D\DdLd������LdDdLdDd�ĄĤ����������Ą�LdD\LdLdDd����Ld<\DT�̄�Ld<\����D\<dLd<\Ld����������������������������<\Dd<dD\����DdLdLd<dLdDdLd����DdLdDdLdDd�ĄĬ����������̄�D\Dd��LdDdLd����Dd<\D\<\LdLd����D\<dDdLd������������������������������LdD\LdDT����Ld<dD\LdD\Ld������LdDdLdDdLd�Ą̤����������̄�DdLd�Č�D\Ld����LdDd<\DdD\Ld����LdD\LdDd��������������������������������Dd<\Ld����D\LdLdDdLdLd����D\DdLd��LdDd�ĄĬ����������Ą�LdD\�̄�LdDd������D\LdLdDdLd����<\DdLd������������������������������������<\Dd����LdDdLdD\Ld������D\Dd�Ą�D\Ld�ČĤ����������̄�LdDd�ĄĤ�<dL\����LdLd<dLdLd����<\Ld��������������������������������������LdDd����LdD\Ld<d��������DdLd�Č�LdDd�Ą̬����������Č�DdLd�ĄĤ�LdD\������LdD\LdDd����DdLd����������������������������������������������LdDdD\Ld������LdLd���Ą�LdDd�Ą̬����������Ą�DdD\�ĄĤ���D\Ld����LdDdD\Ld������������������������������������������������������DdLdDd������<dLdLd���Ą�DdLd�ĄĬ����������̄�LdDd�Č̜���<dLd������Ld<dLd������������������������������������������������������LdD\Ld������LdDd�����̄�LdDd�Ą̬����������Č�DdLd�Ą̤���LdLdDT����LdD\D\������������������������������������������������������LdDdLd����LdDdLd�����̌�LdDd�Č̤����������Ą�DdLd�ĄĤ�����LdLd����LdDdD\������������������������������������������������������LdD\Ld����DdLd�Ĥ����Ą�D\Dd�ĄĤ����������̄�LdDd�̄Ĥ�����DdLd����Ld<\Ld������������������������������������������������������Ld<dLd����D\Ld�̄ĄĄĄ�D\Dd�̄ĄČ̄ĄĄĄĄ�DdLd�̄ĄĄĄ�D\Ld����Dd<\Ld������������������������������������������������������LdD\Ld����LdDdD\D\LdDdLdLdD\LdD\Ld<dD\LdDdLd<dLd<\DdD\LdDdD\LdDd����Ld<dD\������������������������������������������������������LdDdLd����<dLdLdLd<dLdD\<dLdDdLdDdLdDdLd<\LdD\LdLdLdDdLd<\LdDdLd����Ld<\Ld������������������������������������������������������LdD\Ld����D\LdLdDdLdD\<dLdDdLdDdLdDdLdDdLdD\Dd<\LdDdLdDdLd<dLdLd����Ld<dLd������������������������������������������������������LdDdLd����Ld<dD\DdLdLdD\LdD\Ld<\LdD\LdD\Ld<dLdLdLdD\Ld<\LdLdD\Ld����LdD\<d������������������������������������������������������LdD\Ld����LdD\LdLdDdLdD\Ld<\LdD\LdD\LdD\LdDdLdLdLdDdD\Ld<\DdLdDd����LdDd<\������������������������������������������������������LdDdLd����DdLdDdD\LdD\DdLdDdLdDdLd<dLdDdLd<\LdD\Dd<\LdLdLdLdD\Ld����LdDdLd������������������������������������������������������LdDdLd����LdD\LdLdDdLdLd<\LdD\LdD\LdD\LdDdLdDdLdLdLdDdD\LdLdDdLd����LdD\Ld������������������������������������������������������LdDdLd����LdDdLdLdLdLdLdDdD\LdD\LdD\Ld<dLdDdLdDdLdLdLdDdD\D\LdDd����Ld<\Ld������������������������������������������������������Ld<dLd����DdLd<\<\Dd<\Dd<\LdLd<dLdDdLdD\Ld<\Ld<\Dd<\Dd<\LdLdDdLd����LdDdLd������������������������������������������������������L\LdLd����LdD\DdDdD\DdD\Dd<\LdLdDdLd<\LdD\DdD\DdD\DdD\DdD\LdDdLd����LdLdDd����������������������������������������������������������������LdLdLdLdLdLdLdLdLdDdD\LdDdLdLdLdLdLdLdLdLdLdLdLdD\L\Ld��������������������������������������������������������������������������T\LdDdLdDdLdLdDdLdLdDdLdLdLdDdLdLdDdLdLdDdLdLdDdLdDdT\������������������������������������ \ No newline at end of file diff --git a/rockem/splash.pal b/rockem/splash.pal new file mode 100644 index 0000000..3464b70 Binary files /dev/null and b/rockem/splash.pal differ diff --git a/rockem/walk0.wav b/rockem/walk0.wav new file mode 100644 index 0000000..f7589f6 Binary files /dev/null and b/rockem/walk0.wav differ diff --git a/rockem/walk1.wav b/rockem/walk1.wav new file mode 100644 index 0000000..ec0883d Binary files /dev/null and b/rockem/walk1.wav differ diff --git a/rockem/whoosh1.wav b/rockem/whoosh1.wav new file mode 100644 index 0000000..af2f5f3 Binary files /dev/null and b/rockem/whoosh1.wav differ diff --git a/rockem/whoosh2.wav b/rockem/whoosh2.wav new file mode 100644 index 0000000..abdd32b Binary files /dev/null and b/rockem/whoosh2.wav differ diff --git a/samples/MyFoxBear/Debug/MyFoxBear.exe b/samples/MyFoxBear/Debug/MyFoxBear.exe new file mode 100755 index 0000000..dbb8999 Binary files /dev/null and b/samples/MyFoxBear/Debug/MyFoxBear.exe differ diff --git a/samples/MyFoxBear/Debug/MyFoxBear.ilk b/samples/MyFoxBear/Debug/MyFoxBear.ilk new file mode 100644 index 0000000..d25373a Binary files /dev/null and b/samples/MyFoxBear/Debug/MyFoxBear.ilk differ diff --git a/samples/MyFoxBear/Debug/MyFoxBear.pdb b/samples/MyFoxBear/Debug/MyFoxBear.pdb new file mode 100644 index 0000000..e7bacce Binary files /dev/null and b/samples/MyFoxBear/Debug/MyFoxBear.pdb differ diff --git a/samples/MyFoxBear/Debug/bmp.obj b/samples/MyFoxBear/Debug/bmp.obj new file mode 100644 index 0000000..d8ef878 Binary files /dev/null and b/samples/MyFoxBear/Debug/bmp.obj differ diff --git a/samples/MyFoxBear/Debug/ddraw.obj b/samples/MyFoxBear/Debug/ddraw.obj new file mode 100644 index 0000000..345b8f1 Binary files /dev/null and b/samples/MyFoxBear/Debug/ddraw.obj differ diff --git a/samples/MyFoxBear/Debug/ddutil.obj b/samples/MyFoxBear/Debug/ddutil.obj new file mode 100644 index 0000000..c0292fe Binary files /dev/null and b/samples/MyFoxBear/Debug/ddutil.obj differ diff --git a/samples/MyFoxBear/Debug/dsutil.obj b/samples/MyFoxBear/Debug/dsutil.obj new file mode 100644 index 0000000..3498129 Binary files /dev/null and b/samples/MyFoxBear/Debug/dsutil.obj differ diff --git a/samples/MyFoxBear/Debug/fbsound.obj b/samples/MyFoxBear/Debug/fbsound.obj new file mode 100644 index 0000000..6f463a3 Binary files /dev/null and b/samples/MyFoxBear/Debug/fbsound.obj differ diff --git a/samples/MyFoxBear/Debug/foxbear.obj b/samples/MyFoxBear/Debug/foxbear.obj new file mode 100644 index 0000000..6cfcb29 Binary files /dev/null and b/samples/MyFoxBear/Debug/foxbear.obj differ diff --git a/samples/MyFoxBear/Debug/foxbear.res b/samples/MyFoxBear/Debug/foxbear.res new file mode 100644 index 0000000..ee94933 Binary files /dev/null and b/samples/MyFoxBear/Debug/foxbear.res differ diff --git a/samples/MyFoxBear/Debug/gameproc.obj b/samples/MyFoxBear/Debug/gameproc.obj new file mode 100644 index 0000000..8a139f6 Binary files /dev/null and b/samples/MyFoxBear/Debug/gameproc.obj differ diff --git a/samples/MyFoxBear/Debug/gfx.obj b/samples/MyFoxBear/Debug/gfx.obj new file mode 100644 index 0000000..aeb7745 Binary files /dev/null and b/samples/MyFoxBear/Debug/gfx.obj differ diff --git a/samples/MyFoxBear/Debug/plane.obj b/samples/MyFoxBear/Debug/plane.obj new file mode 100644 index 0000000..522ec3c Binary files /dev/null and b/samples/MyFoxBear/Debug/plane.obj differ diff --git a/samples/MyFoxBear/Debug/sprite.obj b/samples/MyFoxBear/Debug/sprite.obj new file mode 100644 index 0000000..104f98f Binary files /dev/null and b/samples/MyFoxBear/Debug/sprite.obj differ diff --git a/samples/MyFoxBear/Debug/tile.obj b/samples/MyFoxBear/Debug/tile.obj new file mode 100644 index 0000000..ae0f6e7 Binary files /dev/null and b/samples/MyFoxBear/Debug/tile.obj differ diff --git a/samples/MyFoxBear/Debug/vc60.idb b/samples/MyFoxBear/Debug/vc60.idb new file mode 100644 index 0000000..0d1d2a5 Binary files /dev/null and b/samples/MyFoxBear/Debug/vc60.idb differ diff --git a/samples/MyFoxBear/Debug/vc60.pdb b/samples/MyFoxBear/Debug/vc60.pdb new file mode 100644 index 0000000..af112bd Binary files /dev/null and b/samples/MyFoxBear/Debug/vc60.pdb differ diff --git a/samples/MyFoxBear/MyFoxBear.dsp b/samples/MyFoxBear/MyFoxBear.dsp new file mode 100644 index 0000000..685d17a --- /dev/null +++ b/samples/MyFoxBear/MyFoxBear.dsp @@ -0,0 +1,184 @@ +# Microsoft Developer Studio Project File - Name="MyFoxBear" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=MyFoxBear - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "MyFoxBear.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "MyFoxBear.mak" CFG="MyFoxBear - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "MyFoxBear - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "MyFoxBear - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "MyFoxBear - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "D:\code\dxsdk3\sdk\inc" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 winmm.lib fastfile.lib ddraw.lib dsound.lib dxguid.lib dinput.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"D:\code\dxsdk3\sdk\lib" + +!ELSEIF "$(CFG)" == "MyFoxBear - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "D:\code\dxsdk3\sdk\inc" /I "D:\code\dxsdk3\sdk\samples\misc" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# SUBTRACT CPP /X +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 winmm.lib fastfile.lib ddraw.lib dsound.lib dxguid.lib dinput.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"D:\code\dxsdk3\sdk\lib" + +!ENDIF + +# Begin Target + +# Name "MyFoxBear - Win32 Release" +# Name "MyFoxBear - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\bmp.c +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\ddraw.c +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\misc\dsutil.c +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\fbsound.c +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\foxbear.c +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\foxbear.rc +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\gameproc.c +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\gfx.c +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\plane.c +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\sprite.c +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\tile.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\sdk\samples\misc\dsutil.h +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\fbsound.h +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\foxbear.h +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\gameproc.h +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\gfx.h +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\plane.h +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\rcids.h +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\sprite.h +# End Source File +# Begin Source File + +SOURCE=..\..\sdk\samples\foxbear\tile.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/samples/MyFoxBear/MyFoxBear.dsw b/samples/MyFoxBear/MyFoxBear.dsw new file mode 100644 index 0000000..f8d727a --- /dev/null +++ b/samples/MyFoxBear/MyFoxBear.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "MyFoxBear"=.\MyFoxBear.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/samples/MyFoxBear/MyFoxBear.ncb b/samples/MyFoxBear/MyFoxBear.ncb new file mode 100644 index 0000000..8a0d380 Binary files /dev/null and b/samples/MyFoxBear/MyFoxBear.ncb differ diff --git a/samples/MyFoxBear/MyFoxBear.opt b/samples/MyFoxBear/MyFoxBear.opt new file mode 100644 index 0000000..4b332f3 Binary files /dev/null and b/samples/MyFoxBear/MyFoxBear.opt differ diff --git a/samples/MyFoxBear/MyFoxBear.plg b/samples/MyFoxBear/MyFoxBear.plg new file mode 100644 index 0000000..cb7769e --- /dev/null +++ b/samples/MyFoxBear/MyFoxBear.plg @@ -0,0 +1,16 @@ +<html> +<body> +<pre> +<h1>Build Log</h1> +<h3> +--------------------Configuration: MyFoxBear - Win32 Debug-------------------- +</h3> +<h3>Command Lines</h3> + + + +<h3>Results</h3> +MyFoxBear.exe - 0 error(s), 0 warning(s) +</pre> +</body> +</html> diff --git a/samples/MyFoxBear/backlist.dat b/samples/MyFoxBear/backlist.dat new file mode 100644 index 0000000..0432733 --- /dev/null +++ b/samples/MyFoxBear/backlist.dat @@ -0,0 +1,15 @@ +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 123 118 118 118 118 119 120 118 118 118 118 118 118 118 118 118 121 122 118 118 118 118 +118 118 118 118 118 121 122 118 118 118 118 118 118 118 118 118 119 120 118 118 118 118 123 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/samples/MyFoxBear/forelist.dat b/samples/MyFoxBear/forelist.dat new file mode 100644 index 0000000..e449c3e --- /dev/null +++ b/samples/MyFoxBear/forelist.dat @@ -0,0 +1,15 @@ + 27 44 44 44 44 44 44 44 44 43 44 44 44 38 0 0 0 0 0 0 0 27 44 44 44 44 44 41 44 44 44 44 44 44 38 0 0 0 0 0 27 44 44 44 44 44 44 44 44 43 44 44 44 38 0 0 0 0 0 0 0 27 44 44 44 44 44 41 44 44 44 44 44 44 38 0 0 0 0 0 + 26 44 44 41 44 44 42 44 44 44 44 44 36 37 0 0 0 0 0 0 0 26 44 44 40 44 44 44 44 44 44 43 44 36 37 0 0 0 0 0 26 44 44 41 44 44 42 44 44 44 44 44 36 37 0 0 0 0 0 0 0 26 44 44 40 44 44 44 44 44 44 43 44 36 37 0 0 0 0 0 + 25 24 44 44 44 44 44 44 44 30 31 34 35 0 0 0 0 0 0 0 0 25 24 44 44 44 39 44 44 44 30 31 34 35 0 0 0 0 0 0 25 24 44 44 44 44 44 44 44 30 31 34 35 0 0 0 0 0 0 0 0 25 24 44 44 44 39 44 44 44 30 31 34 35 0 0 0 0 0 0 + 0 23 22 21 20 19 17 18 28 29 32 33 0 0 0 0 0 0 0 0 0 0 23 22 21 20 19 17 18 28 29 32 33 0 0 0 0 0 0 0 0 23 22 21 20 19 17 18 28 29 32 33 0 0 0 0 0 0 0 0 0 0 23 22 21 20 19 17 18 28 29 32 33 0 0 0 0 0 0 0 + 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 16 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 15 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 7 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 7 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 14 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 13 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 12 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 16 0 0 0 0 0 0 0 0 0 0 0 + 0 0 8 7 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 8 7 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 51 52 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 51 52 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 + 49 0 0 0 0 0 1 2 0 0 45 46 47 48 0 0 0 0 54 53 0 0 0 0 0 0 0 1 2 0 0 57 58 0 0 55 56 0 0 0 49 0 0 0 0 0 1 2 0 0 45 46 47 48 0 0 0 0 54 53 0 0 0 0 0 0 0 1 2 0 0 57 58 0 0 55 56 0 0 0 + 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 60 61 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 60 61 50 50 50 50 50 + 50 50 60 61 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 60 61 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 60 61 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 60 61 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 diff --git a/samples/MyFoxBear/fox.ico b/samples/MyFoxBear/fox.ico new file mode 100644 index 0000000..2e2b890 Binary files /dev/null and b/samples/MyFoxBear/fox.ico differ diff --git a/samples/MyFoxBear/foxbear.art b/samples/MyFoxBear/foxbear.art new file mode 100644 index 0000000..efe82d4 Binary files /dev/null and b/samples/MyFoxBear/foxbear.art differ diff --git a/samples/MyFoxBear/foxbear.def b/samples/MyFoxBear/foxbear.def new file mode 100644 index 0000000..67ea40c --- /dev/null +++ b/samples/MyFoxBear/foxbear.def @@ -0,0 +1,3 @@ +NAME FOXBEAR + +DESCRIPTION 'Fox & Bear Sample Game' diff --git a/samples/MyFoxBear/jump.wav b/samples/MyFoxBear/jump.wav new file mode 100644 index 0000000..134cd88 Binary files /dev/null and b/samples/MyFoxBear/jump.wav differ diff --git a/samples/MyFoxBear/midlist.dat b/samples/MyFoxBear/midlist.dat new file mode 100644 index 0000000..e3674b6 --- /dev/null +++ b/samples/MyFoxBear/midlist.dat @@ -0,0 +1,15 @@ + 0 110 117 117 117 117 117 114 117 117 117 117 111 0 110 117 117 117 117 117 114 117 117 117 117 111 0 110 117 117 117 117 117 114 117 117 117 117 111 0 + 0 99 117 112 117 117 117 117 117 117 117 117 109 0 99 117 112 117 117 117 117 117 117 117 117 109 0 99 117 112 117 117 117 117 117 117 117 117 109 0 + 0 98 117 117 117 117 117 117 117 115 117 108 107 0 98 117 117 117 117 117 117 117 115 117 108 107 0 98 117 117 117 117 117 117 117 115 117 108 107 0 + 0 97 117 117 117 113 117 117 117 117 117 105 106 0 97 117 117 117 113 117 117 117 117 117 105 106 0 97 117 117 117 113 117 117 117 117 117 105 106 0 + 0 96 95 117 117 117 117 117 117 117 117 104 0 0 96 95 117 117 117 117 117 117 117 117 104 0 0 96 95 117 117 117 117 117 117 117 117 104 0 0 + 0 0 94 93 92 91 89 90 100 101 102 103 0 0 0 94 93 92 91 89 90 100 101 102 103 0 0 0 94 93 92 91 89 90 100 101 102 103 0 0 + 0 0 84 83 0 0 87 88 0 0 0 0 0 0 0 84 83 0 0 87 88 0 0 0 0 0 0 0 84 83 0 0 87 88 0 0 0 0 0 0 + 0 86 85 82 81 80 78 79 0 0 0 0 0 0 86 85 82 81 80 78 79 0 0 0 0 0 0 86 85 82 81 80 78 79 0 0 0 0 0 0 + 0 0 0 0 0 0 76 77 72 73 74 75 0 0 0 0 0 0 0 76 77 72 73 74 75 0 0 0 0 0 0 0 76 77 72 73 74 75 0 0 + 0 0 0 0 0 0 69 70 71 0 0 0 0 0 0 0 0 0 0 69 70 71 0 0 0 0 0 0 0 0 0 0 69 70 71 0 0 0 0 0 + 0 0 0 0 0 0 67 68 0 0 0 0 0 0 0 0 0 0 0 67 68 0 0 0 0 0 0 0 0 0 0 0 67 68 0 0 0 0 0 0 + 0 0 0 0 0 0 65 66 0 0 0 0 0 0 0 0 0 0 0 65 66 0 0 0 0 0 0 0 0 0 0 0 65 66 0 0 0 0 0 0 + 0 0 0 0 0 0 63 64 0 0 0 0 0 0 0 0 0 0 0 63 64 0 0 0 0 0 0 0 0 0 0 0 63 64 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/samples/MyFoxBear/miss01.wav b/samples/MyFoxBear/miss01.wav new file mode 100644 index 0000000..8300b78 Binary files /dev/null and b/samples/MyFoxBear/miss01.wav differ diff --git a/samples/MyFoxBear/miss02.wav b/samples/MyFoxBear/miss02.wav new file mode 100644 index 0000000..8e5e9da Binary files /dev/null and b/samples/MyFoxBear/miss02.wav differ diff --git a/samples/MyFoxBear/rgb332.pal b/samples/MyFoxBear/rgb332.pal new file mode 100644 index 0000000..189199b Binary files /dev/null and b/samples/MyFoxBear/rgb332.pal differ diff --git a/samples/MyFoxBear/stop.wav b/samples/MyFoxBear/stop.wav new file mode 100644 index 0000000..834b1ee Binary files /dev/null and b/samples/MyFoxBear/stop.wav differ diff --git a/samples/MyFoxBear/strike01.wav b/samples/MyFoxBear/strike01.wav new file mode 100644 index 0000000..0615e4a Binary files /dev/null and b/samples/MyFoxBear/strike01.wav differ diff --git a/samples/MyFoxBear/strike02.wav b/samples/MyFoxBear/strike02.wav new file mode 100644 index 0000000..513c0a8 Binary files /dev/null and b/samples/MyFoxBear/strike02.wav differ diff --git a/samples/MyFoxBear/stunned.wav b/samples/MyFoxBear/stunned.wav new file mode 100644 index 0000000..3950a8c Binary files /dev/null and b/samples/MyFoxBear/stunned.wav differ diff --git a/samples/MyFoxBear/surflist.dat b/samples/MyFoxBear/surflist.dat new file mode 100644 index 0000000..90c984f --- /dev/null +++ b/samples/MyFoxBear/surflist.dat @@ -0,0 +1,15 @@ + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/samples/MyFoxBear/throw.wav b/samples/MyFoxBear/throw.wav new file mode 100644 index 0000000..87cd36d Binary files /dev/null and b/samples/MyFoxBear/throw.wav differ diff --git a/samples/MyFoxBear/wavdata/16-22/jump.wav b/samples/MyFoxBear/wavdata/16-22/jump.wav new file mode 100644 index 0000000..134cd88 Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-22/jump.wav differ diff --git a/samples/MyFoxBear/wavdata/16-22/miss01.wav b/samples/MyFoxBear/wavdata/16-22/miss01.wav new file mode 100644 index 0000000..8300b78 Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-22/miss01.wav differ diff --git a/samples/MyFoxBear/wavdata/16-22/miss02.wav b/samples/MyFoxBear/wavdata/16-22/miss02.wav new file mode 100644 index 0000000..8e5e9da Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-22/miss02.wav differ diff --git a/samples/MyFoxBear/wavdata/16-22/stop.wav b/samples/MyFoxBear/wavdata/16-22/stop.wav new file mode 100644 index 0000000..834b1ee Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-22/stop.wav differ diff --git a/samples/MyFoxBear/wavdata/16-22/strike01.wav b/samples/MyFoxBear/wavdata/16-22/strike01.wav new file mode 100644 index 0000000..0615e4a Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-22/strike01.wav differ diff --git a/samples/MyFoxBear/wavdata/16-22/strike02.wav b/samples/MyFoxBear/wavdata/16-22/strike02.wav new file mode 100644 index 0000000..513c0a8 Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-22/strike02.wav differ diff --git a/samples/MyFoxBear/wavdata/16-22/stunned.wav b/samples/MyFoxBear/wavdata/16-22/stunned.wav new file mode 100644 index 0000000..3950a8c Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-22/stunned.wav differ diff --git a/samples/MyFoxBear/wavdata/16-22/throw.wav b/samples/MyFoxBear/wavdata/16-22/throw.wav new file mode 100644 index 0000000..87cd36d Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-22/throw.wav differ diff --git a/samples/MyFoxBear/wavdata/16-44/jump.wav b/samples/MyFoxBear/wavdata/16-44/jump.wav new file mode 100644 index 0000000..5c0b8bd Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-44/jump.wav differ diff --git a/samples/MyFoxBear/wavdata/16-44/miss01.wav b/samples/MyFoxBear/wavdata/16-44/miss01.wav new file mode 100644 index 0000000..15b38be Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-44/miss01.wav differ diff --git a/samples/MyFoxBear/wavdata/16-44/miss02.wav b/samples/MyFoxBear/wavdata/16-44/miss02.wav new file mode 100644 index 0000000..1a15f40 Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-44/miss02.wav differ diff --git a/samples/MyFoxBear/wavdata/16-44/stop.wav b/samples/MyFoxBear/wavdata/16-44/stop.wav new file mode 100644 index 0000000..7becea5 Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-44/stop.wav differ diff --git a/samples/MyFoxBear/wavdata/16-44/strike01.wav b/samples/MyFoxBear/wavdata/16-44/strike01.wav new file mode 100644 index 0000000..1654965 Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-44/strike01.wav differ diff --git a/samples/MyFoxBear/wavdata/16-44/strike02.wav b/samples/MyFoxBear/wavdata/16-44/strike02.wav new file mode 100644 index 0000000..5826391 Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-44/strike02.wav differ diff --git a/samples/MyFoxBear/wavdata/16-44/stunned.wav b/samples/MyFoxBear/wavdata/16-44/stunned.wav new file mode 100644 index 0000000..ad75538 Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-44/stunned.wav differ diff --git a/samples/MyFoxBear/wavdata/16-44/throw.wav b/samples/MyFoxBear/wavdata/16-44/throw.wav new file mode 100644 index 0000000..a7f9e8a Binary files /dev/null and b/samples/MyFoxBear/wavdata/16-44/throw.wav differ diff --git a/samples/MyFoxBear/wavdata/8-11/jump.wav b/samples/MyFoxBear/wavdata/8-11/jump.wav new file mode 100644 index 0000000..232381b Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-11/jump.wav differ diff --git a/samples/MyFoxBear/wavdata/8-11/miss01.wav b/samples/MyFoxBear/wavdata/8-11/miss01.wav new file mode 100644 index 0000000..a2d84db Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-11/miss01.wav differ diff --git a/samples/MyFoxBear/wavdata/8-11/miss02.wav b/samples/MyFoxBear/wavdata/8-11/miss02.wav new file mode 100644 index 0000000..27f2373 Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-11/miss02.wav differ diff --git a/samples/MyFoxBear/wavdata/8-11/stop.wav b/samples/MyFoxBear/wavdata/8-11/stop.wav new file mode 100644 index 0000000..c5eeaba Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-11/stop.wav differ diff --git a/samples/MyFoxBear/wavdata/8-11/strike01.wav b/samples/MyFoxBear/wavdata/8-11/strike01.wav new file mode 100644 index 0000000..300c5e0 Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-11/strike01.wav differ diff --git a/samples/MyFoxBear/wavdata/8-11/strike02.wav b/samples/MyFoxBear/wavdata/8-11/strike02.wav new file mode 100644 index 0000000..68e1213 Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-11/strike02.wav differ diff --git a/samples/MyFoxBear/wavdata/8-11/stunned.wav b/samples/MyFoxBear/wavdata/8-11/stunned.wav new file mode 100644 index 0000000..8fa5a5f Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-11/stunned.wav differ diff --git a/samples/MyFoxBear/wavdata/8-11/throw.wav b/samples/MyFoxBear/wavdata/8-11/throw.wav new file mode 100644 index 0000000..c187ba6 Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-11/throw.wav differ diff --git a/samples/MyFoxBear/wavdata/8-22/jump.wav b/samples/MyFoxBear/wavdata/8-22/jump.wav new file mode 100644 index 0000000..dd9b2a4 Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-22/jump.wav differ diff --git a/samples/MyFoxBear/wavdata/8-22/miss01.wav b/samples/MyFoxBear/wavdata/8-22/miss01.wav new file mode 100644 index 0000000..9b96d94 Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-22/miss01.wav differ diff --git a/samples/MyFoxBear/wavdata/8-22/miss02.wav b/samples/MyFoxBear/wavdata/8-22/miss02.wav new file mode 100644 index 0000000..7ec24c1 Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-22/miss02.wav differ diff --git a/samples/MyFoxBear/wavdata/8-22/stop.wav b/samples/MyFoxBear/wavdata/8-22/stop.wav new file mode 100644 index 0000000..cebe334 Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-22/stop.wav differ diff --git a/samples/MyFoxBear/wavdata/8-22/strike01.wav b/samples/MyFoxBear/wavdata/8-22/strike01.wav new file mode 100644 index 0000000..ef2cb56 Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-22/strike01.wav differ diff --git a/samples/MyFoxBear/wavdata/8-22/strike02.wav b/samples/MyFoxBear/wavdata/8-22/strike02.wav new file mode 100644 index 0000000..06de180 Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-22/strike02.wav differ diff --git a/samples/MyFoxBear/wavdata/8-22/stunned.wav b/samples/MyFoxBear/wavdata/8-22/stunned.wav new file mode 100644 index 0000000..2a1a5d4 Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-22/stunned.wav differ diff --git a/samples/MyFoxBear/wavdata/8-22/throw.wav b/samples/MyFoxBear/wavdata/8-22/throw.wav new file mode 100644 index 0000000..da2a301 Binary files /dev/null and b/samples/MyFoxBear/wavdata/8-22/throw.wav differ diff --git a/sdk/bin/camera.x b/sdk/bin/camera.x new file mode 100644 index 0000000..a8166d6 Binary files /dev/null and b/sdk/bin/camera.x differ diff --git a/sdk/bin/conv3ds.exe b/sdk/bin/conv3ds.exe new file mode 100755 index 0000000..fb7c14b Binary files /dev/null and b/sdk/bin/conv3ds.exe differ diff --git a/sdk/bin/convx.exe b/sdk/bin/convx.exe new file mode 100755 index 0000000..e58a3ce Binary files /dev/null and b/sdk/bin/convx.exe differ diff --git a/sdk/bin/convxof.exe b/sdk/bin/convxof.exe new file mode 100755 index 0000000..4d7f40e Binary files /dev/null and b/sdk/bin/convxof.exe differ diff --git a/sdk/bin/d3dtest.exe b/sdk/bin/d3dtest.exe new file mode 100755 index 0000000..e314e24 Binary files /dev/null and b/sdk/bin/d3dtest.exe differ diff --git a/sdk/bin/ddcaps.exe b/sdk/bin/ddcaps.exe new file mode 100755 index 0000000..9e17370 Binary files /dev/null and b/sdk/bin/ddcaps.exe differ diff --git a/sdk/bin/ddex1.exe b/sdk/bin/ddex1.exe new file mode 100755 index 0000000..3254190 Binary files /dev/null and b/sdk/bin/ddex1.exe differ diff --git a/sdk/bin/ddex2.exe b/sdk/bin/ddex2.exe new file mode 100755 index 0000000..6128015 Binary files /dev/null and b/sdk/bin/ddex2.exe differ diff --git a/sdk/bin/ddex3.exe b/sdk/bin/ddex3.exe new file mode 100755 index 0000000..86aef17 Binary files /dev/null and b/sdk/bin/ddex3.exe differ diff --git a/sdk/bin/ddex4.exe b/sdk/bin/ddex4.exe new file mode 100755 index 0000000..01fcfcd Binary files /dev/null and b/sdk/bin/ddex4.exe differ diff --git a/sdk/bin/ddex5.exe b/sdk/bin/ddex5.exe new file mode 100755 index 0000000..5d933b5 Binary files /dev/null and b/sdk/bin/ddex5.exe differ diff --git a/sdk/bin/ddtest.exe b/sdk/bin/ddtest.exe new file mode 100755 index 0000000..78ea2c7 Binary files /dev/null and b/sdk/bin/ddtest.exe differ diff --git a/sdk/bin/diquick.exe b/sdk/bin/diquick.exe new file mode 100755 index 0000000..f5566da Binary files /dev/null and b/sdk/bin/diquick.exe differ diff --git a/sdk/bin/donut.exe b/sdk/bin/donut.exe new file mode 100755 index 0000000..b17a969 Binary files /dev/null and b/sdk/bin/donut.exe differ diff --git a/sdk/bin/donuts.exe b/sdk/bin/donuts.exe new file mode 100755 index 0000000..3ff2dde Binary files /dev/null and b/sdk/bin/donuts.exe differ diff --git a/sdk/bin/dplaunch.exe b/sdk/bin/dplaunch.exe new file mode 100755 index 0000000..399e6e3 Binary files /dev/null and b/sdk/bin/dplaunch.exe differ diff --git a/sdk/bin/ds3dview.exe b/sdk/bin/ds3dview.exe new file mode 100755 index 0000000..dff72c0 Binary files /dev/null and b/sdk/bin/ds3dview.exe differ diff --git a/sdk/bin/dsshow.exe b/sdk/bin/dsshow.exe new file mode 100755 index 0000000..1717978 Binary files /dev/null and b/sdk/bin/dsshow.exe differ diff --git a/sdk/bin/dsshow3d.exe b/sdk/bin/dsshow3d.exe new file mode 100755 index 0000000..e967ee0 Binary files /dev/null and b/sdk/bin/dsshow3d.exe differ diff --git a/sdk/bin/dsstream.exe b/sdk/bin/dsstream.exe new file mode 100755 index 0000000..c6117ec Binary files /dev/null and b/sdk/bin/dsstream.exe differ diff --git a/sdk/bin/duel.exe b/sdk/bin/duel.exe new file mode 100755 index 0000000..9ee5cd2 Binary files /dev/null and b/sdk/bin/duel.exe differ diff --git a/sdk/bin/dxview.exe b/sdk/bin/dxview.exe new file mode 100755 index 0000000..0eed5e9 Binary files /dev/null and b/sdk/bin/dxview.exe differ diff --git a/sdk/bin/fdfilter.exe b/sdk/bin/fdfilter.exe new file mode 100755 index 0000000..2a9f33c Binary files /dev/null and b/sdk/bin/fdfilter.exe differ diff --git a/sdk/bin/ffcreate.exe b/sdk/bin/ffcreate.exe new file mode 100755 index 0000000..138bc55 Binary files /dev/null and b/sdk/bin/ffcreate.exe differ diff --git a/sdk/bin/flip2d.exe b/sdk/bin/flip2d.exe new file mode 100755 index 0000000..1fce2a0 Binary files /dev/null and b/sdk/bin/flip2d.exe differ diff --git a/sdk/bin/flipcube.exe b/sdk/bin/flipcube.exe new file mode 100755 index 0000000..6edcbd7 Binary files /dev/null and b/sdk/bin/flipcube.exe differ diff --git a/sdk/bin/globe.exe b/sdk/bin/globe.exe new file mode 100755 index 0000000..9570a99 Binary files /dev/null and b/sdk/bin/globe.exe differ diff --git a/sdk/bin/memtime.exe b/sdk/bin/memtime.exe new file mode 100755 index 0000000..3ba0cb5 Binary files /dev/null and b/sdk/bin/memtime.exe differ diff --git a/sdk/bin/mid2strm.exe b/sdk/bin/mid2strm.exe new file mode 100755 index 0000000..f0d61b1 Binary files /dev/null and b/sdk/bin/mid2strm.exe differ diff --git a/sdk/bin/mmxtog.exe b/sdk/bin/mmxtog.exe new file mode 100755 index 0000000..169e90a Binary files /dev/null and b/sdk/bin/mmxtog.exe differ diff --git a/sdk/bin/mslogo.x b/sdk/bin/mslogo.x new file mode 100644 index 0000000..191b315 Binary files /dev/null and b/sdk/bin/mslogo.x differ diff --git a/sdk/bin/mstream.exe b/sdk/bin/mstream.exe new file mode 100755 index 0000000..c6b11f4 Binary files /dev/null and b/sdk/bin/mstream.exe differ diff --git a/sdk/bin/palette.exe b/sdk/bin/palette.exe new file mode 100755 index 0000000..1f53e2d Binary files /dev/null and b/sdk/bin/palette.exe differ diff --git a/sdk/bin/scrawl.exe b/sdk/bin/scrawl.exe new file mode 100755 index 0000000..a0db1d3 Binary files /dev/null and b/sdk/bin/scrawl.exe differ diff --git a/sdk/bin/stretch.exe b/sdk/bin/stretch.exe new file mode 100755 index 0000000..9ef1889 Binary files /dev/null and b/sdk/bin/stretch.exe differ diff --git a/sdk/bin/teapot.x b/sdk/bin/teapot.x new file mode 100644 index 0000000..06fccfd Binary files /dev/null and b/sdk/bin/teapot.x differ diff --git a/sdk/bin/tunnel.exe b/sdk/bin/tunnel.exe new file mode 100755 index 0000000..28c6908 Binary files /dev/null and b/sdk/bin/tunnel.exe differ diff --git a/sdk/bin/twist.exe b/sdk/bin/twist.exe new file mode 100755 index 0000000..a469807 Binary files /dev/null and b/sdk/bin/twist.exe differ diff --git a/sdk/bin/viewer.exe b/sdk/bin/viewer.exe new file mode 100755 index 0000000..a222b14 Binary files /dev/null and b/sdk/bin/viewer.exe differ diff --git a/sdk/bin/wormhole.exe b/sdk/bin/wormhole.exe new file mode 100755 index 0000000..1493412 Binary files /dev/null and b/sdk/bin/wormhole.exe differ diff --git a/sdk/inc/d3d.h b/sdk/inc/d3d.h new file mode 100644 index 0000000..f24b948 --- /dev/null +++ b/sdk/inc/d3d.h @@ -0,0 +1,392 @@ +/*==========================================================================; + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3d.h + * Content: Direct3D include file + * + ***************************************************************************/ + +#ifndef _D3D_H_ +#define _D3D_H_ + +#include <stdlib.h> + +#ifdef _WIN32 +#define COM_NO_WINDOWS_H +#include <objbase.h> +#else +#include "d3dcom.h" +#endif + +#ifdef _WIN32 +#define D3DAPI WINAPI +#else +#define D3DAPI +#endif + +/* + * Interface IID's + */ +#if defined( _WIN32 ) && !defined( _NO_COM) +DEFINE_GUID( IID_IDirect3D, 0x3BBA0080,0x2421,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirect3DTexture, 0x2CDCD9E0,0x25A0,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirect3DLight, 0x4417C142,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); +DEFINE_GUID( IID_IDirect3DMaterial, 0x4417C144,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); +DEFINE_GUID( IID_IDirect3DExecuteBuffer,0x4417C145,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); +DEFINE_GUID( IID_IDirect3DViewport, 0x4417C146,0x33AD,0x11CF,0x81,0x6F,0x00,0x00,0xC0,0x20,0x15,0x6E ); +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Data structures + */ +#ifdef __cplusplus + +/* 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined */ +struct IDirect3D; +struct IDirect3DDevice; +struct IDirect3DExecuteBuffer; +struct IDirect3DLight; +struct IDirect3DMaterial; +struct IDirect3DTexture; +struct IDirect3DViewport; +typedef struct IDirect3D *LPDIRECT3D; +typedef struct IDirect3DDevice *LPDIRECT3DDEVICE; +typedef struct IDirect3DExecuteBuffer *LPDIRECT3DEXECUTEBUFFER; +typedef struct IDirect3DLight *LPDIRECT3DLIGHT; +typedef struct IDirect3DMaterial *LPDIRECT3DMATERIAL; +typedef struct IDirect3DTexture *LPDIRECT3DTEXTURE; +typedef struct IDirect3DViewport *LPDIRECT3DVIEWPORT; + +#else + +typedef struct IDirect3D *LPDIRECT3D; +typedef struct IDirect3DDevice *LPDIRECT3DDEVICE; +typedef struct IDirect3DExecuteBuffer *LPDIRECT3DEXECUTEBUFFER; +typedef struct IDirect3DLight *LPDIRECT3DLIGHT; +typedef struct IDirect3DMaterial *LPDIRECT3DMATERIAL; +typedef struct IDirect3DTexture *LPDIRECT3DTEXTURE; +typedef struct IDirect3DViewport *LPDIRECT3DVIEWPORT; + +#endif + +#include "d3dtypes.h" +#include "d3dcaps.h" + +/* + * IDirect3D + */ +#undef INTERFACE +#define INTERFACE IDirect3D +DECLARE_INTERFACE_(IDirect3D, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + STDMETHOD_(ULONG, Release) (THIS) PURE; + /*** IDirect3D methods ***/ + STDMETHOD(Initialize) (THIS_ REFIID) PURE; + STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID) PURE; + STDMETHOD(CreateLight) (THIS_ LPDIRECT3DLIGHT*, IUnknown*) PURE; + STDMETHOD(CreateMaterial) (THIS_ LPDIRECT3DMATERIAL*, IUnknown*) PURE; + STDMETHOD(CreateViewport) (THIS_ LPDIRECT3DVIEWPORT*, IUnknown*) PURE; + STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirect3D_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirect3D_EnumDevices(p, a, b) (p)->lpVtbl->EnumDevices(p, a, b) +#define IDirect3D_CreateLight(p, a, b) (p)->lpVtbl->CreateLight(p, a, b) +#define IDirect3D_CreateMaterial(p, a, b) (p)->lpVtbl->CreateMaterial(p, a, b) +#define IDirect3D_CreateViewport(p, a, b) (p)->lpVtbl->CreateViewport(p, a, b) +#define IDirect3D_FindDevice(p, a, b) (p)->lpVtbl->FindDevice(p, a, b) +#endif + +/* + * IDirect3DDevice + */ +#undef INTERFACE +#define INTERFACE IDirect3DDevice +DECLARE_INTERFACE_(IDirect3DDevice, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + STDMETHOD_(ULONG, Release) (THIS) PURE; + /*** IDirect3DDevice methods ***/ + STDMETHOD(Initialize) (THIS_ LPDIRECT3D, LPGUID, LPD3DDEVICEDESC) PURE; + STDMETHOD(GetCaps) (THIS_ LPD3DDEVICEDESC, LPD3DDEVICEDESC) PURE; + STDMETHOD(SwapTextureHandles) (THIS_ LPDIRECT3DTEXTURE, LPDIRECT3DTEXTURE) PURE; + STDMETHOD(CreateExecuteBuffer) (THIS_ LPD3DEXECUTEBUFFERDESC, LPDIRECT3DEXECUTEBUFFER*, IUnknown*) PURE; + STDMETHOD(GetStats) (THIS_ LPD3DSTATS) PURE; + STDMETHOD(Execute) (THIS_ LPDIRECT3DEXECUTEBUFFER, LPDIRECT3DVIEWPORT, DWORD) PURE; + STDMETHOD(AddViewport) (THIS_ LPDIRECT3DVIEWPORT) PURE; + STDMETHOD(DeleteViewport) (THIS_ LPDIRECT3DVIEWPORT) PURE; + STDMETHOD(NextViewport) (THIS_ LPDIRECT3DVIEWPORT, LPDIRECT3DVIEWPORT*, DWORD) PURE; + STDMETHOD(Pick) (THIS_ LPDIRECT3DEXECUTEBUFFER, LPDIRECT3DVIEWPORT, DWORD, LPD3DRECT) PURE; + STDMETHOD(GetPickRecords)(THIS_ LPDWORD, LPD3DPICKRECORD) PURE; + STDMETHOD(EnumTextureFormats) (THIS_ LPD3DENUMTEXTUREFORMATSCALLBACK, LPVOID) PURE; + STDMETHOD(CreateMatrix) (THIS_ LPD3DMATRIXHANDLE) PURE; + STDMETHOD(SetMatrix) (THIS_ D3DMATRIXHANDLE, LPD3DMATRIX) PURE; + STDMETHOD(GetMatrix) (THIS_ D3DMATRIXHANDLE, LPD3DMATRIX) PURE; + STDMETHOD(DeleteMatrix) (THIS_ D3DMATRIXHANDLE) PURE; + STDMETHOD_(HRESULT, BeginScene) (THIS) PURE; + STDMETHOD_(HRESULT, EndScene) (THIS) PURE; + STDMETHOD(GetDirect3D) (THIS_ LPDIRECT3D*) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirect3DDevice_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice_Initialize(p, a, b, c) (p)->lpVtbl->Initialize(p, a, b, c) +#define IDirect3DDevice_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) +#define IDirect3DDevice_SwapTextureHandles(p, a, b) (p)->lpVtbl->SwapTextureHandles(p, a, b) +#define IDirect3DDevice_CreateExecuteBuffer(p, a, b, c) (p)->lpVtbl->CreateExecuteBuffer(p, a, b, c) +#define IDirect3DDevice_GetStats(p, a) (p)->lpVtbl->CreateViewport(p, a) +#define IDirect3DDevice_Execute(p, a, b, c) (p)->lpVtbl->Execute(p, a, b, c) +#define IDirect3DDevice_AddViewport(p, a) (p)->lpVtbl->AddViewport(p, a) +#define IDirect3DDevice_DeleteViewport(p, a) (p)->lpVtbl->DeleteViewport(p, a) +#define IDirect3DDevice_NextViewport(p, a, b) (p)->lpVtbl->NextViewport(p, a, b) +#define IDirect3DDevice_Pick(p, a, b, c, d) (p)->lpVtbl->Pick(p, a, b, c, d) +#define IDirect3DDevice_GetPickRecords(p, a, b) (p)->lpVtbl->GetPickRecords(p, a, b) +#define IDirect3DDevice_EnumTextureFormats(p, a, b) (p)->lpVtbl->EnumTextureFormats(p, a, b) +#define IDirect3DDevice_CreateMatrix(p, a) (p)->lpVtbl->CreateMatrix(p, a) +#define IDirect3DDevice_SetMatrix(p, a, b) (p)->lpVtbl->SetMatrix(p, a, b) +#define IDirect3DDevice_GetMatrix(p, a, b) (p)->lpVtbl->GetMatrix(p, a, b) +#define IDirect3DDevice_DeleteMatrix(p, a) (p)->lpVtbl->DeleteMatrix(p, a) +#define IDirect3DDevice_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice_GetDirect3D(p, a) (p)->lpVtbl->GetDirect3D(p, a) +#endif + +/* + * IDirect3DExecuteBuffer + */ +#undef INTERFACE +#define INTERFACE IDirect3DExecuteBuffer +DECLARE_INTERFACE_(IDirect3DExecuteBuffer, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + STDMETHOD_(ULONG, Release) (THIS) PURE; + /*** IDirect3DExecuteBuffer methods ***/ + STDMETHOD(Initialize) (THIS_ LPDIRECT3DDEVICE, LPD3DEXECUTEBUFFERDESC) PURE; + STDMETHOD(Lock) (THIS_ LPD3DEXECUTEBUFFERDESC) PURE; + STDMETHOD_(HRESULT, Unlock) (THIS) PURE; + STDMETHOD(SetExecuteData) (THIS_ LPD3DEXECUTEDATA) PURE; + STDMETHOD(GetExecuteData) (THIS_ LPD3DEXECUTEDATA) PURE; + STDMETHOD(Validate) (THIS_ LPDWORD, LPD3DVALIDATECALLBACK, LPVOID, DWORD) PURE; + STDMETHOD(Optimize) (THIS_ DWORD) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DExecuteBuffer_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirect3DExecuteBuffer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DExecuteBuffer_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DExecuteBuffer_Initialize(p, a, b) (p)->lpVtbl->Initialize(p, a, b) +#define IDirect3DExecuteBuffer_Lock(p, a) (p)->lpVtbl->Lock(p, a) +#define IDirect3DExecuteBuffer_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DExecuteBuffer_SetExecuteData(p, a) (p)->lpVtbl->SetExecuteData(p, a) +#define IDirect3DExecuteBuffer_Validate(p, a, b, c, d) (p)->lpVtbl->Validata(p, a, b, c, d) +#endif + +/* + * Flags for execute buffer calls + */ +#define D3DNEXT_NEXT 0x00000001l +#define D3DNEXT_HEAD 0x00000002l +#define D3DNEXT_TAIL 0x00000004l + +/* + * IDirect3DLight + */ +#undef INTERFACE +#define INTERFACE IDirect3DLight +DECLARE_INTERFACE_(IDirect3DLight, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + STDMETHOD_(ULONG, Release) (THIS) PURE; + /*** IDirect3DLight methods ***/ + STDMETHOD(Initialize) (THIS_ LPDIRECT3D) PURE; + STDMETHOD(SetLight) (THIS_ LPD3DLIGHT) PURE; + STDMETHOD(GetLight) (THIS_ LPD3DLIGHT) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DLight_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirect3DLight_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DLight_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DLight_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirect3DLight_SetLight(p, a) (p)->lpVtbl->SetLight(p, a) +#define IDirect3DLight_GetLight(p, a) (p)->lpVtbl->GetLight(p, a) +#endif + +/* + * IDirect3DMaterial + */ +#undef INTERFACE +#define INTERFACE IDirect3DMaterial +DECLARE_INTERFACE_(IDirect3DMaterial, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + STDMETHOD_(ULONG, Release) (THIS) PURE; + /*** IDirect3DMaterial methods ***/ + STDMETHOD(Initialize) (THIS_ LPDIRECT3D) PURE; + STDMETHOD(SetMaterial) (THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetMaterial) (THIS_ LPD3DMATERIAL) PURE; + STDMETHOD(GetHandle) (THIS_ LPDIRECT3DDEVICE, LPD3DMATERIALHANDLE) PURE; + STDMETHOD_(HRESULT, Reserve) (THIS) PURE; + STDMETHOD_(HRESULT, Unreserve) (THIS) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DMaterial_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirect3DMaterial_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DMaterial_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DMaterial_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirect3DMaterial_SetMaterial(p, a) (p)->lpVtbl->SetMaterial(p, a) +#define IDirect3DMaterial_GetMaterial(p, a) (p)->lpVtbl->GetMaterial(p, a) +#define IDirect3DMaterial_GetHandle(p, a, b) (p)->lpVtbl->GetHandle(p, a, b) +#define IDirect3DMaterial_Reserve(p) (p)->lpVtbl->Reserve(p) +#define IDirect3DMaterial_Unreserve(p) (p)->lpVtbl->Unreserve(p) +#endif + +/* + * IDirect3DTexture + */ +#undef INTERFACE +#define INTERFACE IDirect3DTexture +DECLARE_INTERFACE_(IDirect3DTexture, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + STDMETHOD_(ULONG, Release) (THIS) PURE; + /*** IDirect3DTexture methods ***/ + STDMETHOD(Initialize) (THIS_ LPDIRECT3DDEVICE, LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(GetHandle) (THIS_ LPDIRECT3DDEVICE, LPD3DTEXTUREHANDLE) PURE; + STDMETHOD(PaletteChanged) (THIS_ DWORD, DWORD) PURE; + STDMETHOD(Load) (THIS_ LPDIRECT3DTEXTURE) PURE; + STDMETHOD_(HRESULT, Unload) (THIS) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DTexture_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirect3DTexture_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DTexture_Initialize(p, a, b) (p)->lpVtbl->Initialize(p, a, b) +#define IDirect3DTexture_GetHandle(p, a, b) (p)->lpVtbl->GetHandle(p, a, b) +#define IDirect3DTexture_PaletteChanged(p, a, b) (p)->lpVtbl->PaletteChanged(p, a, b) +#define IDirect3DTexture_Load(p, a) (p)->lpVtbl->Load(p, a) +#define IDirect3DTexture_Unload(p) (p)->lpVtbl->Unload(p) +#endif + +/* + * IDirect3DViewport + */ +#undef INTERFACE +#define INTERFACE IDirect3DViewport +DECLARE_INTERFACE_(IDirect3DViewport, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE; + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + STDMETHOD_(ULONG, Release) (THIS) PURE; + /*** IDirect3DViewport methods ***/ + STDMETHOD(Initialize) (THIS_ LPDIRECT3D) PURE; + STDMETHOD(GetViewport) (THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(SetViewport) (THIS_ LPD3DVIEWPORT) PURE; + STDMETHOD(TransformVertices) (THIS_ DWORD, LPD3DTRANSFORMDATA, DWORD, LPDWORD) PURE; + STDMETHOD(LightElements) (THIS_ DWORD, LPD3DLIGHTDATA) PURE; + STDMETHOD(SetBackground) (THIS_ D3DMATERIALHANDLE) PURE; + STDMETHOD(GetBackground) (THIS_ LPD3DMATERIALHANDLE, LPBOOL) PURE; + STDMETHOD(SetBackgroundDepth) (THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(GetBackgroundDepth) (THIS_ LPDIRECTDRAWSURFACE*, LPBOOL) PURE; + STDMETHOD(Clear) (THIS_ DWORD, LPD3DRECT, DWORD) PURE; + STDMETHOD(AddLight) (THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(DeleteLight) (THIS_ LPDIRECT3DLIGHT) PURE; + STDMETHOD(NextLight) (THIS_ LPDIRECT3DLIGHT, LPDIRECT3DLIGHT*, DWORD) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DViewport_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirect3DViewport_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DViewport_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DViewport_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirect3DViewport_GetViewport(p, a) (p)->lpVtbl->GetViewport(p, a) +#define IDirect3DViewport_SetViewport(p, a) (p)->lpVtbl->SetViewport(p, a) +#define IDirect3DViewport_TransformVertices(p, a, b, c, d) (p)->lpVtbl->TransformVertices(p, a, b, c, d) +#define IDirect3DViewport_LightElements(p, a, b) (p)->lpVtbl->LightElements(p, a, b) +#define IDirect3DViewport_SetBackground(p, a) (p)->lpVtbl->SetBackground(p, a) +#define IDirect3DViewport_GetBackground(p, a, b) (p)->lpVtbl->GetBackground(p, a, b) +#define IDirect3DViewport_Clear(p, a, b, c) (p)->lpVtbl->Clear(p, a, b, c) +#define IDirect3DViewport_AddLight(p, a) (p)->lpVtbl->AddLight(p, a) +#define IDirect3DViewport_DeleteLight(p, a) (p)->lpVtbl->DeleteLight(p, a) +#define IDirect3DViewport_NextLight(p, a, b, c) (p)->lpVtbl->NextLight(p, a, b, c) +#endif + +/* + * Direct3D Errors + * DirectDraw error codes are used when errors not specified here. + */ +#define D3D_OK DD_OK +#define D3DERR_BADMAJORVERSION MAKE_DDHRESULT(700) +#define D3DERR_BADMINORVERSION MAKE_DDHRESULT(701) + +#define D3DERR_EXECUTE_CREATE_FAILED MAKE_DDHRESULT(710) +#define D3DERR_EXECUTE_DESTROY_FAILED MAKE_DDHRESULT(711) +#define D3DERR_EXECUTE_LOCK_FAILED MAKE_DDHRESULT(712) +#define D3DERR_EXECUTE_UNLOCK_FAILED MAKE_DDHRESULT(713) +#define D3DERR_EXECUTE_LOCKED MAKE_DDHRESULT(714) +#define D3DERR_EXECUTE_NOT_LOCKED MAKE_DDHRESULT(715) + +#define D3DERR_EXECUTE_FAILED MAKE_DDHRESULT(716) +#define D3DERR_EXECUTE_CLIPPED_FAILED MAKE_DDHRESULT(717) + +#define D3DERR_TEXTURE_NO_SUPPORT MAKE_DDHRESULT(720) +#define D3DERR_TEXTURE_CREATE_FAILED MAKE_DDHRESULT(721) +#define D3DERR_TEXTURE_DESTROY_FAILED MAKE_DDHRESULT(722) +#define D3DERR_TEXTURE_LOCK_FAILED MAKE_DDHRESULT(723) +#define D3DERR_TEXTURE_UNLOCK_FAILED MAKE_DDHRESULT(724) +#define D3DERR_TEXTURE_LOAD_FAILED MAKE_DDHRESULT(725) +#define D3DERR_TEXTURE_SWAP_FAILED MAKE_DDHRESULT(726) +#define D3DERR_TEXTURE_LOCKED MAKE_DDHRESULT(727) +#define D3DERR_TEXTURE_NOT_LOCKED MAKE_DDHRESULT(728) +#define D3DERR_TEXTURE_GETSURF_FAILED MAKE_DDHRESULT(729) + +#define D3DERR_MATRIX_CREATE_FAILED MAKE_DDHRESULT(730) +#define D3DERR_MATRIX_DESTROY_FAILED MAKE_DDHRESULT(731) +#define D3DERR_MATRIX_SETDATA_FAILED MAKE_DDHRESULT(732) +#define D3DERR_MATRIX_GETDATA_FAILED MAKE_DDHRESULT(733) +#define D3DERR_SETVIEWPORTDATA_FAILED MAKE_DDHRESULT(734) + +#define D3DERR_MATERIAL_CREATE_FAILED MAKE_DDHRESULT(740) +#define D3DERR_MATERIAL_DESTROY_FAILED MAKE_DDHRESULT(741) +#define D3DERR_MATERIAL_SETDATA_FAILED MAKE_DDHRESULT(742) +#define D3DERR_MATERIAL_GETDATA_FAILED MAKE_DDHRESULT(743) + +#define D3DERR_LIGHT_SET_FAILED MAKE_DDHRESULT(750) + +#define D3DERR_SCENE_IN_SCENE MAKE_DDHRESULT(760) +#define D3DERR_SCENE_NOT_IN_SCENE MAKE_DDHRESULT(761) +#define D3DERR_SCENE_BEGIN_FAILED MAKE_DDHRESULT(762) +#define D3DERR_SCENE_END_FAILED MAKE_DDHRESULT(763) + +#ifdef __cplusplus +}; +#endif + +#endif /* _D3D_H_ */ diff --git a/sdk/inc/d3dcaps.h b/sdk/inc/d3dcaps.h new file mode 100644 index 0000000..60a44c1 --- /dev/null +++ b/sdk/inc/d3dcaps.h @@ -0,0 +1,290 @@ +/*==========================================================================; + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dcaps.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _D3DCAPS_H +#define _D3DCAPS_H + +/* + * Pull in DirectDraw include file automatically: + */ +#include <ddraw.h> + +#pragma pack(4) + +/* Description of capabilities of transform */ + +typedef struct _D3DTRANSFORMCAPS { + DWORD dwSize; + DWORD dwCaps; +} D3DTRANSFORMCAPS, *LPD3DTRANSFORMCAPS; + +#define D3DTRANSFORMCAPS_CLIP 0x00000001L /* Will clip whilst transforming */ + +/* Description of capabilities of lighting */ + +typedef struct _D3DLIGHTINGCAPS { + DWORD dwSize; + DWORD dwCaps; /* Lighting caps */ + DWORD dwLightingModel; /* Lighting model - RGB or mono */ + DWORD dwNumLights; /* Number of lights that can be handled */ +} D3DLIGHTINGCAPS, *LPD3DLIGHTINGCAPS; + +#define D3DLIGHTINGMODEL_RGB 0x00000001L +#define D3DLIGHTINGMODEL_MONO 0x00000002L + +#define D3DLIGHTCAPS_POINT 0x00000001L /* Point lights supported */ +#define D3DLIGHTCAPS_SPOT 0x00000002L /* Spot lights supported */ +#define D3DLIGHTCAPS_DIRECTIONAL 0x00000004L /* Directional lights supported */ +#define D3DLIGHTCAPS_PARALLELPOINT 0x00000008L /* Parallel point lights supported */ +#define D3DLIGHTCAPS_GLSPOT 0x00000010L /* GL syle spot lights supported */ + +/* Description of capabilities for each primitive type */ + +typedef struct _D3DPrimCaps { + DWORD dwSize; + DWORD dwMiscCaps; /* Capability flags */ + DWORD dwRasterCaps; + DWORD dwZCmpCaps; + DWORD dwSrcBlendCaps; + DWORD dwDestBlendCaps; + DWORD dwAlphaCmpCaps; + DWORD dwShadeCaps; + DWORD dwTextureCaps; + DWORD dwTextureFilterCaps; + DWORD dwTextureBlendCaps; + DWORD dwTextureAddressCaps; + DWORD dwStippleWidth; /* maximum width and height of */ + DWORD dwStippleHeight; /* of supported stipple (up to 32x32) */ +} D3DPRIMCAPS, *LPD3DPRIMCAPS; + +/* D3DPRIMCAPS dwMiscCaps */ + +#define D3DPMISCCAPS_MASKPLANES 0x00000001L +#define D3DPMISCCAPS_MASKZ 0x00000002L +#define D3DPMISCCAPS_LINEPATTERNREP 0x00000004L +#define D3DPMISCCAPS_CONFORMANT 0x00000008L +#define D3DPMISCCAPS_CULLNONE 0x00000010L +#define D3DPMISCCAPS_CULLCW 0x00000020L +#define D3DPMISCCAPS_CULLCCW 0x00000040L + +/* D3DPRIMCAPS dwRasterCaps */ + +#define D3DPRASTERCAPS_DITHER 0x00000001L +#define D3DPRASTERCAPS_ROP2 0x00000002L +#define D3DPRASTERCAPS_XOR 0x00000004L +#define D3DPRASTERCAPS_PAT 0x00000008L +#define D3DPRASTERCAPS_ZTEST 0x00000010L +#define D3DPRASTERCAPS_SUBPIXEL 0x00000020L +#define D3DPRASTERCAPS_SUBPIXELX 0x00000040L +#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L +#define D3DPRASTERCAPS_FOGTABLE 0x00000100L +#define D3DPRASTERCAPS_STIPPLE 0x00000200L + +/* D3DPRIMCAPS dwZCmpCaps, dwAlphaCmpCaps */ + +#define D3DPCMPCAPS_NEVER 0x00000001L +#define D3DPCMPCAPS_LESS 0x00000002L +#define D3DPCMPCAPS_EQUAL 0x00000004L +#define D3DPCMPCAPS_LESSEQUAL 0x00000008L +#define D3DPCMPCAPS_GREATER 0x00000010L +#define D3DPCMPCAPS_NOTEQUAL 0x00000020L +#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L +#define D3DPCMPCAPS_ALWAYS 0x00000080L + +/* D3DPRIMCAPS dwSourceBlendCaps, dwDestBlendCaps */ + +#define D3DPBLENDCAPS_ZERO 0x00000001L +#define D3DPBLENDCAPS_ONE 0x00000002L +#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L +#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L +#define D3DPBLENDCAPS_SRCALPHA 0x00000010L +#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L +#define D3DPBLENDCAPS_DESTALPHA 0x00000040L +#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L +#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L +#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L +#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L +#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L +#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L + +/* D3DPRIMCAPS dwShadeCaps */ + +#define D3DPSHADECAPS_COLORFLATMONO 0x00000001L +#define D3DPSHADECAPS_COLORFLATRGB 0x00000002L +#define D3DPSHADECAPS_COLORGOURAUDMONO 0x00000004L +#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L +#define D3DPSHADECAPS_COLORPHONGMONO 0x00000010L +#define D3DPSHADECAPS_COLORPHONGRGB 0x00000020L + +#define D3DPSHADECAPS_SPECULARFLATMONO 0x00000040L +#define D3DPSHADECAPS_SPECULARFLATRGB 0x00000080L +#define D3DPSHADECAPS_SPECULARGOURAUDMONO 0x00000100L +#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L +#define D3DPSHADECAPS_SPECULARPHONGMONO 0x00000400L +#define D3DPSHADECAPS_SPECULARPHONGRGB 0x00000800L + +#define D3DPSHADECAPS_ALPHAFLATBLEND 0x00001000L +#define D3DPSHADECAPS_ALPHAFLATSTIPPLED 0x00002000L +#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L +#define D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED 0x00008000L +#define D3DPSHADECAPS_ALPHAPHONGBLEND 0x00010000L +#define D3DPSHADECAPS_ALPHAPHONGSTIPPLED 0x00020000L + +#define D3DPSHADECAPS_FOGFLAT 0x00040000L +#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L +#define D3DPSHADECAPS_FOGPHONG 0x00100000L + +/* D3DPRIMCAPS dwTextureCaps */ + +#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L +#define D3DPTEXTURECAPS_POW2 0x00000002L +#define D3DPTEXTURECAPS_ALPHA 0x00000004L +#define D3DPTEXTURECAPS_TRANSPARENCY 0x00000008L +#define D3DPTEXTURECAPS_BORDER 0x00000010L +#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L + +/* D3DPRIMCAPS dwTextureFilterCaps */ + +#define D3DPTFILTERCAPS_NEAREST 0x00000001L +#define D3DPTFILTERCAPS_LINEAR 0x00000002L +#define D3DPTFILTERCAPS_MIPNEAREST 0x00000004L +#define D3DPTFILTERCAPS_MIPLINEAR 0x00000008L +#define D3DPTFILTERCAPS_LINEARMIPNEAREST 0x00000010L +#define D3DPTFILTERCAPS_LINEARMIPLINEAR 0x00000020L + +/* D3DPRIMCAPS dwTextureBlendCaps */ + +#define D3DPTBLENDCAPS_DECAL 0x00000001L +#define D3DPTBLENDCAPS_MODULATE 0x00000002L +#define D3DPTBLENDCAPS_DECALALPHA 0x00000004L +#define D3DPTBLENDCAPS_MODULATEALPHA 0x00000008L +#define D3DPTBLENDCAPS_DECALMASK 0x00000010L +#define D3DPTBLENDCAPS_MODULATEMASK 0x00000020L +#define D3DPTBLENDCAPS_COPY 0x00000040L + +/* D3DPRIMCAPS dwTextureAddressCaps */ +#define D3DPTADDRESSCAPS_WRAP 0x00000001L +#define D3DPTADDRESSCAPS_MIRROR 0x00000002L +#define D3DPTADDRESSCAPS_CLAMP 0x00000004L + +/* + * Description for a device. + * This is used to describe a device that is to be created or to query + * the current device. + */ +typedef struct _D3DDeviceDesc { + DWORD dwSize; /* Size of D3DDEVICEDESC structure */ + DWORD dwFlags; /* Indicates which fields have valid data */ + D3DCOLORMODEL dcmColorModel; /* Color model of device */ + DWORD dwDevCaps; /* Capabilities of device */ + D3DTRANSFORMCAPS dtcTransformCaps; /* Capabilities of transform */ + BOOL bClipping; /* Device can do 3D clipping */ + D3DLIGHTINGCAPS dlcLightingCaps; /* Capabilities of lighting */ + D3DPRIMCAPS dpcLineCaps; + D3DPRIMCAPS dpcTriCaps; + DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */ + DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */ + DWORD dwMaxBufferSize; /* Maximum execute buffer size */ + DWORD dwMaxVertexCount; /* Maximum vertex count */ +} D3DDEVICEDESC, *LPD3DDEVICEDESC; + +typedef HRESULT (FAR PASCAL * LPD3DENUMDEVICESCALLBACK)(LPGUID lpGuid, LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC, LPD3DDEVICEDESC, LPVOID); + +/* D3DDEVICEDESC dwFlags indicating valid fields */ + +#define D3DDD_COLORMODEL 0x00000001L /* dcmColorModel is valid */ +#define D3DDD_DEVCAPS 0x00000002L /* dwDevCaps is valid */ +#define D3DDD_TRANSFORMCAPS 0x00000004L /* dtcTransformCaps is valid */ +#define D3DDD_LIGHTINGCAPS 0x00000008L /* dlcLightingCaps is valid */ +#define D3DDD_BCLIPPING 0x00000010L /* bClipping is valid */ +#define D3DDD_LINECAPS 0x00000020L /* dpcLineCaps is valid */ +#define D3DDD_TRICAPS 0x00000040L /* dpcTriCaps is valid */ +#define D3DDD_DEVICERENDERBITDEPTH 0x00000080L /* dwDeviceRenderBitDepth is valid */ +#define D3DDD_DEVICEZBUFFERBITDEPTH 0x00000100L /* dwDeviceZBufferBitDepth is valid */ +#define D3DDD_MAXBUFFERSIZE 0x00000200L /* dwMaxBufferSize is valid */ +#define D3DDD_MAXVERTEXCOUNT 0x00000400L /* dwMaxVertexCount is valid */ + +/* D3DDEVICEDESC dwDevCaps flags */ + +#define D3DDEVCAPS_FLOATTLVERTEX 0x00000001L /* Device accepts floating point */ + /* for post-transform vertex data */ +#define D3DDEVCAPS_SORTINCREASINGZ 0x00000002L /* Device needs data sorted for increasing Z*/ +#define D3DDEVCAPS_SORTDECREASINGZ 0X00000004L /* Device needs data sorted for decreasing Z*/ +#define D3DDEVCAPS_SORTEXACT 0x00000008L /* Device needs data sorted exactly */ + +#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */ +#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */ +#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */ +#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */ +#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */ +#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */ + +#define D3DFDS_COLORMODEL 0x00000001L /* Match color model */ +#define D3DFDS_GUID 0x00000002L /* Match guid */ +#define D3DFDS_HARDWARE 0x00000004L /* Match hardware/software */ +#define D3DFDS_TRIANGLES 0x00000008L /* Match in triCaps */ +#define D3DFDS_LINES 0x00000010L /* Match in lineCaps */ +#define D3DFDS_MISCCAPS 0x00000020L /* Match primCaps.dwMiscCaps */ +#define D3DFDS_RASTERCAPS 0x00000040L /* Match primCaps.dwRasterCaps */ +#define D3DFDS_ZCMPCAPS 0x00000080L /* Match primCaps.dwZCmpCaps */ +#define D3DFDS_ALPHACMPCAPS 0x00000100L /* Match primCaps.dwAlphaCmpCaps */ +#define D3DFDS_SRCBLENDCAPS 0x00000200L /* Match primCaps.dwSourceBlendCaps */ +#define D3DFDS_DSTBLENDCAPS 0x00000400L /* Match primCaps.dwDestBlendCaps */ +#define D3DFDS_SHADECAPS 0x00000800L /* Match primCaps.dwShadeCaps */ +#define D3DFDS_TEXTURECAPS 0x00001000L /* Match primCaps.dwTextureCaps */ +#define D3DFDS_TEXTUREFILTERCAPS 0x00002000L /* Match primCaps.dwTextureFilterCaps */ +#define D3DFDS_TEXTUREBLENDCAPS 0x00004000L /* Match primCaps.dwTextureBlendCaps */ +#define D3DFDS_TEXTUREADDRESSCAPS 0x00008000L /* Match primCaps.dwTextureBlendCaps */ + +/* + * FindDevice arguments + */ +typedef struct _D3DFINDDEVICESEARCH { + DWORD dwSize; + DWORD dwFlags; + BOOL bHardware; + D3DCOLORMODEL dcmColorModel; + GUID guid; + DWORD dwCaps; + D3DPRIMCAPS dpcPrimCaps; +} D3DFINDDEVICESEARCH, *LPD3DFINDDEVICESEARCH; + +typedef struct _D3DFINDDEVICERESULT { + DWORD dwSize; + GUID guid; /* guid which matched */ + D3DDEVICEDESC ddHwDesc; /* hardware D3DDEVICEDESC */ + D3DDEVICEDESC ddSwDesc; /* software D3DDEVICEDESC */ +} D3DFINDDEVICERESULT, *LPD3DFINDDEVICERESULT; + +/* + * Description of execute buffer. + */ +typedef struct _D3DExecuteBufferDesc { + DWORD dwSize; /* size of this structure */ + DWORD dwFlags; /* flags indicating which fields are valid */ + DWORD dwCaps; /* capabilities of execute buffer */ + DWORD dwBufferSize; /* size of execute buffer data */ + LPVOID lpData; /* pointer to actual data */ +} D3DEXECUTEBUFFERDESC, *LPD3DEXECUTEBUFFERDESC; + +/* D3DEXECUTEBUFFER dwFlags indicating valid fields */ + +#define D3DDEB_BUFSIZE 0x00000001l /* buffer size valid */ +#define D3DDEB_CAPS 0x00000002l /* caps valid */ +#define D3DDEB_LPDATA 0x00000004l /* lpData valid */ + +/* D3DEXECUTEBUFFER dwCaps */ + +#define D3DDEBCAPS_SYSTEMMEMORY 0x00000001l /* buffer in system memory */ +#define D3DDEBCAPS_VIDEOMEMORY 0x00000002l /* buffer in device memory */ +#define D3DDEBCAPS_MEM (D3DDEBCAPS_SYSTEMMEMORY|D3DDEBCAPS_VIDEOMEMORY) + +#pragma pack() + +#endif /* _D3DCAPS_H_ */ diff --git a/sdk/inc/d3drm.h b/sdk/inc/d3drm.h new file mode 100644 index 0000000..3f6248a --- /dev/null +++ b/sdk/inc/d3drm.h @@ -0,0 +1,135 @@ +/*==========================================================================; + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3drm.h + * Content: Direct3DRM include file + * + ***************************************************************************/ + +#ifndef __D3DRM_H__ +#define __D3DRM_H__ + +#include "ddraw.h" +#include "d3drmobj.h" + +#ifdef __cplusplus +extern "C" { +struct IDirect3DRM; +#endif + + +typedef void (CDECL *D3DRMDEVICEPALETTECALLBACK) + (LPDIRECT3DRMDEVICE lpDirect3DRMDev, LPVOID lpArg, DWORD dwIndex, LONG red, LONG green, LONG blue); + +DEFINE_GUID(IID_IDirect3DRM, 0x2bc49361, 0x8327, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +WIN_TYPES(IDirect3DRM, DIRECT3DRM); + + +/* Create a Direct3DRM API */ +STDAPI Direct3DRMCreate(LPDIRECT3DRM FAR *lplpDirect3DRM); + +#undef INTERFACE +#define INTERFACE IDirect3DRM + +DECLARE_INTERFACE_(IDirect3DRM, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD(CreateObject) + (THIS_ REFCLSID rclsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppv) PURE; + STDMETHOD(CreateFrame) (THIS_ LPDIRECT3DRMFRAME, LPDIRECT3DRMFRAME *) PURE; + STDMETHOD(CreateMesh) (THIS_ LPDIRECT3DRMMESH *) PURE; + STDMETHOD(CreateMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER *) PURE; + STDMETHOD(CreateFace) (THIS_ LPDIRECT3DRMFACE *) PURE; + STDMETHOD(CreateAnimation) (THIS_ LPDIRECT3DRMANIMATION *) PURE; + STDMETHOD(CreateAnimationSet)(THIS_ LPDIRECT3DRMANIMATIONSET *) PURE; + STDMETHOD(CreateTexture) (THIS_ LPD3DRMIMAGE, LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(CreateLight) (THIS_ D3DRMLIGHTTYPE, D3DCOLOR, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateLightRGB) + (THIS_ D3DRMLIGHTTYPE, D3DVALUE, D3DVALUE, D3DVALUE, LPDIRECT3DRMLIGHT *) PURE; + STDMETHOD(CreateMaterial) (THIS_ D3DVALUE, LPDIRECT3DRMMATERIAL *) PURE; + STDMETHOD(CreateDevice) (THIS_ DWORD, DWORD, LPDIRECT3DRMDEVICE *) PURE; + + /* Create a Windows Device using DirectDraw surfaces */ + STDMETHOD(CreateDeviceFromSurface) + ( THIS_ LPGUID lpGUID, LPDIRECTDRAW lpDD, + LPDIRECTDRAWSURFACE lpDDSBack, LPDIRECT3DRMDEVICE * + ) PURE; + + /* Create a Windows Device using D3D objects */ + STDMETHOD(CreateDeviceFromD3D) + ( THIS_ LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpD3DDev, + LPDIRECT3DRMDEVICE * + ) PURE; + + STDMETHOD(CreateDeviceFromClipper) + ( THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, + int width, int height, LPDIRECT3DRMDEVICE *) PURE; + + STDMETHOD(CreateTextureFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS, LPDIRECT3DRMTEXTURE *) PURE; + + STDMETHOD(CreateShadow) + ( THIS_ LPDIRECT3DRMVISUAL, LPDIRECT3DRMLIGHT, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, + LPDIRECT3DRMVISUAL * + ) PURE; + STDMETHOD(CreateViewport) + ( THIS_ LPDIRECT3DRMDEVICE, LPDIRECT3DRMFRAME, DWORD, DWORD, + DWORD, DWORD, LPDIRECT3DRMVIEWPORT * + ) PURE; + STDMETHOD(CreateWrap) + ( THIS_ D3DRMWRAPTYPE, LPDIRECT3DRMFRAME, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, + D3DVALUE ou, D3DVALUE ov, + D3DVALUE su, D3DVALUE sv, + LPDIRECT3DRMWRAP * + ) PURE; + STDMETHOD(CreateUserVisual) (THIS_ D3DRMUSERVISUALCALLBACK, LPVOID lPArg, LPDIRECT3DRMUSERVISUAL *) PURE; + STDMETHOD(LoadTexture) (THIS_ const char *, LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(LoadTextureFromResource) (THIS_ HRSRC rs, LPDIRECT3DRMTEXTURE *) PURE; + + STDMETHOD(SetSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(AddSearchPath) (THIS_ LPCSTR) PURE; + STDMETHOD(GetSearchPath) (THIS_ DWORD *size_return, LPSTR path_return); + //STDMETHOD(GetSearchPath) (THIS_ int *return_count, char ***return_path) PURE; + STDMETHOD(SetDefaultTextureColors)(THIS_ DWORD) PURE; + STDMETHOD(SetDefaultTextureShades)(THIS_ DWORD) PURE; + + STDMETHOD(GetDevices) (THIS_ LPDIRECT3DRMDEVICEARRAY *) PURE; + STDMETHOD(GetNamedObject) (THIS_ const char *, LPDIRECT3DRMOBJECT *) PURE; + + STDMETHOD(EnumerateObjects) (THIS_ D3DRMOBJECTCALLBACK, LPVOID) PURE; + + STDMETHOD(Load) + ( THIS_ LPVOID, LPVOID, LPIID *, DWORD, D3DRMLOADOPTIONS, + D3DRMLOADCALLBACK, LPVOID, D3DRMLOADTEXTURECALLBACK, LPVOID, + LPDIRECT3DRMFRAME + ) PURE; + STDMETHOD(Tick) (THIS_ D3DVALUE) PURE; +}; + +#define D3DRM_OK DD_OK +#define D3DRMERR_BADOBJECT MAKE_DDHRESULT(781) +#define D3DRMERR_BADTYPE MAKE_DDHRESULT(782) +#define D3DRMERR_BADALLOC MAKE_DDHRESULT(783) +#define D3DRMERR_FACEUSED MAKE_DDHRESULT(784) +#define D3DRMERR_NOTFOUND MAKE_DDHRESULT(785) +#define D3DRMERR_NOTDONEYET MAKE_DDHRESULT(786) +#define D3DRMERR_FILENOTFOUND MAKE_DDHRESULT(787) +#define D3DRMERR_BADFILE MAKE_DDHRESULT(788) +#define D3DRMERR_BADDEVICE MAKE_DDHRESULT(789) +#define D3DRMERR_BADVALUE MAKE_DDHRESULT(790) +#define D3DRMERR_BADMAJORVERSION MAKE_DDHRESULT(791) +#define D3DRMERR_BADMINORVERSION MAKE_DDHRESULT(792) +#define D3DRMERR_UNABLETOEXECUTE MAKE_DDHRESULT(793) + +#ifdef __cplusplus +}; +#endif + +#endif /* _D3DRMAPI_H_ */ + diff --git a/sdk/inc/d3drmdef.h b/sdk/inc/d3drmdef.h new file mode 100644 index 0000000..f4e2eb1 --- /dev/null +++ b/sdk/inc/d3drmdef.h @@ -0,0 +1,403 @@ +/*==========================================================================; + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3drm.h + * Content: Direct3DRM include file + * + ***************************************************************************/ + +#ifndef __D3DRMDEFS_H__ +#define __D3DRMDEFS_H__ + +#include <stddef.h> +#include "d3dtypes.h" + +#ifdef WIN32 +#define D3DRMAPI __stdcall +#else +#define D3DRMAPI +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +#ifndef TRUE +#define FALSE 0 +#define TRUE 1 +#endif + +typedef struct _D3DRMVECTOR4D +{ D3DVALUE x, y, z, w; +} D3DRMVECTOR4D, *LPD3DRMVECTOR4D; + +typedef D3DVALUE D3DRMMATRIX4D[4][4]; + +typedef struct _D3DRMQUATERNION +{ D3DVALUE s; + D3DVECTOR v; +} D3DRMQUATERNION, *LPD3DRMQUATERNION; + +typedef struct _D3DRMBOX +{ D3DVECTOR min, max; +} D3DRMBOX, *LPD3DRMBOX; + +typedef void (*D3DRMWRAPCALLBACK) + (LPD3DVECTOR, int* u, int* v, LPD3DVECTOR a, LPD3DVECTOR b, LPVOID); + +typedef enum _D3DRMLIGHTTYPE +{ D3DRMLIGHT_AMBIENT, + D3DRMLIGHT_POINT, + D3DRMLIGHT_SPOT, + D3DRMLIGHT_DIRECTIONAL, + D3DRMLIGHT_PARALLELPOINT +} D3DRMLIGHTTYPE, *LPD3DRMLIGHTTYPE; + +typedef enum _D3DRMSHADEMODE { + D3DRMSHADE_FLAT = 0, + D3DRMSHADE_GOURAUD = 1, + D3DRMSHADE_PHONG = 2, + + D3DRMSHADE_MASK = 7, + D3DRMSHADE_MAX = 8 +} D3DRMSHADEMODE, *LPD3DRMSHADEMODE; + +typedef enum _D3DRMLIGHTMODE { + D3DRMLIGHT_OFF = 0 * D3DRMSHADE_MAX, + D3DRMLIGHT_ON = 1 * D3DRMSHADE_MAX, + + D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX, + D3DRMLIGHT_MAX = 8 * D3DRMSHADE_MAX +} D3DRMLIGHTMODE, *LPD3DRMLIGHTMODE; + +typedef enum _D3DRMFILLMODE { + D3DRMFILL_POINTS = 0 * D3DRMLIGHT_MAX, + D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX, + D3DRMFILL_SOLID = 2 * D3DRMLIGHT_MAX, + + D3DRMFILL_MASK = 7 * D3DRMLIGHT_MAX, + D3DRMFILL_MAX = 8 * D3DRMLIGHT_MAX +} D3DRMFILLMODE, *LPD3DRMFILLMODE; + +typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY; + +#define D3DRMRENDER_WIREFRAME (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_WIREFRAME) +#define D3DRMRENDER_UNLITFLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_SOLID) +#define D3DRMRENDER_FLAT (D3DRMSHADE_FLAT+D3DRMLIGHT_ON+D3DRMFILL_SOLID) +#define D3DRMRENDER_GOURAUD (D3DRMSHADE_GOURAUD+D3DRMLIGHT_ON+D3DRMFILL_SOLID) +#define D3DRMRENDER_PHONG (D3DRMSHADE_PHONG+D3DRMLIGHT_ON+D3DRMFILL_SOLID) + +typedef enum _D3DRMTEXTUREQUALITY +{ D3DRMTEXTURE_NEAREST, /* choose nearest texel */ + D3DRMTEXTURE_LINEAR, /* interpolate 4 texels */ + D3DRMTEXTURE_MIPNEAREST, /* nearest texel in nearest mipmap */ + D3DRMTEXTURE_MIPLINEAR, /* interpolate 2 texels from 2 mipmaps */ + D3DRMTEXTURE_LINEARMIPNEAREST, /* interpolate 4 texels in nearest mipmap */ + D3DRMTEXTURE_LINEARMIPLINEAR /* interpolate 8 texels from 2 mipmaps */ +} D3DRMTEXTUREQUALITY, *LPD3DRMTEXTUREQUALITY; + +typedef enum _D3DRMCOMBINETYPE +{ D3DRMCOMBINE_REPLACE, + D3DRMCOMBINE_BEFORE, + D3DRMCOMBINE_AFTER +} D3DRMCOMBINETYPE, *LPD3DRMCOMBINETYPE; + +typedef D3DCOLORMODEL D3DRMCOLORMODEL, *LPD3DRMCOLORMODEL; + +typedef enum _D3DRMPALETTEFLAGS +{ D3DRMPALETTE_FREE, /* renderer may use this entry freely */ + D3DRMPALETTE_READONLY, /* fixed but may be used by renderer */ + D3DRMPALETTE_RESERVED /* may not be used by renderer */ +} D3DRMPALETTEFLAGS, *LPD3DRMPALETTEFLAGS; + +typedef struct _D3DRMPALETTEENTRY +{ unsigned char red; /* 0 .. 255 */ + unsigned char green; /* 0 .. 255 */ + unsigned char blue; /* 0 .. 255 */ + unsigned char flags; /* one of D3DRMPALETTEFLAGS */ +} D3DRMPALETTEENTRY, *LPD3DRMPALETTEENTRY; + +typedef struct _D3DRMIMAGE +{ int width, height; /* width and height in pixels */ + int aspectx, aspecty; /* aspect ratio for non-square pixels */ + int depth; /* bits per pixel */ + int rgb; /* if false, pixels are indices into a + palette otherwise, pixels encode + RGB values. */ + int bytes_per_line; /* number of bytes of memory for a + scanline. This must be a multiple + of 4. */ + void* buffer1; /* memory to render into (first buffer). */ + void* buffer2; /* second rendering buffer for double + buffering, set to NULL for single + buffering. */ + unsigned long red_mask; + unsigned long green_mask; + unsigned long blue_mask; + unsigned long alpha_mask; /* if rgb is true, these are masks for + the red, green and blue parts of a + pixel. Otherwise, these are masks + for the significant bits of the + red, green and blue elements in the + palette. For instance, most SVGA + displays use 64 intensities of red, + green and blue, so the masks should + all be set to 0xfc. */ + int palette_size; /* number of entries in palette */ + D3DRMPALETTEENTRY* palette; /* description of the palette (only if + rgb is false). Must be (1<<depth) + elements. */ +} D3DRMIMAGE, *LPD3DRMIMAGE; + +typedef enum _D3DRMWRAPTYPE +{ D3DRMWRAP_FLAT, + D3DRMWRAP_CYLINDER, + D3DRMWRAP_SPHERE, + D3DRMWRAP_CHROME +} D3DRMWRAPTYPE, *LPD3DRMWRAPTYPE; + +#define D3DRMWIREFRAME_CULL 1 /* cull backfaces */ +#define D3DRMWIREFRAME_HIDDENLINE 2 /* lines are obscured by closer objects */ + +typedef enum _D3DRMPROJECTIONTYPE +{ D3DRMPROJECT_PERSPECTIVE, + D3DRMPROJECT_ORTHOGRAPHIC +} D3DRMPROJECTIONTYPE, *LPD3DRMPROJECTIONTYPE; + +typedef enum _D3DRMXOFFORMAT +{ D3DRMXOF_BINARY, + D3DRMXOF_COMPRESSED, + D3DRMXOF_TEXT +} D3DRMXOFFORMAT, *LPD3DRMXOFFORMAT; + +typedef DWORD D3DRMSAVEOPTIONS; +#define D3DRMXOFSAVE_NORMALS 1 +#define D3DRMXOFSAVE_TEXTURECOORDINATES 2 +#define D3DRMXOFSAVE_MATERIALS 4 +#define D3DRMXOFSAVE_TEXTURENAMES 8 +#define D3DRMXOFSAVE_ALL 15 +#define D3DRMXOFSAVE_TEMPLATES 16 + +typedef enum _D3DRMCOLORSOURCE +{ D3DRMCOLOR_FROMFACE, + D3DRMCOLOR_FROMVERTEX +} D3DRMCOLORSOURCE, *LPD3DRMCOLORSOURCE; + +typedef enum _D3DRMFRAMECONSTRAINT +{ D3DRMCONSTRAIN_Z, /* use only X and Y rotations */ + D3DRMCONSTRAIN_Y, /* use only X and Z rotations */ + D3DRMCONSTRAIN_X /* use only Y and Z rotations */ +} D3DRMFRAMECONSTRAINT, *LPD3DRMFRAMECONSTRAINT; + +typedef enum _D3DRMMATERIALMODE +{ D3DRMMATERIAL_FROMMESH, + D3DRMMATERIAL_FROMPARENT, + D3DRMMATERIAL_FROMFRAME +} D3DRMMATERIALMODE, *LPD3DRMMATERIALMODE; + +typedef enum _D3DRMFOGMODE +{ D3DRMFOG_LINEAR, /* linear between start and end */ + D3DRMFOG_EXPONENTIAL, /* density * exp(-distance) */ + D3DRMFOG_EXPONENTIALSQUARED /* density * exp(-distance*distance) */ +} D3DRMFOGMODE, *LPD3DRMFOGMODE; + +typedef enum _D3DRMZBUFFERMODE { + D3DRMZBUFFER_FROMPARENT, /* default */ + D3DRMZBUFFER_ENABLE, /* enable zbuffering */ + D3DRMZBUFFER_DISABLE /* disable zbuffering */ +} D3DRMZBUFFERMODE, *LPD3DRMZBUFFERMODE; + +typedef enum _D3DRMSORTMODE { + D3DRMSORT_FROMPARENT, /* default */ + D3DRMSORT_NONE, /* don't sort child frames */ + D3DRMSORT_FRONTTOBACK, /* sort child frames front-to-back */ + D3DRMSORT_BACKTOFRONT /* sort child frames back-to-front */ +} D3DRMSORTMODE, *LPD3DRMSORTMODE; + +typedef DWORD D3DRMANIMATIONOPTIONS; +#define D3DRMANIMATION_OPEN 0x01L +#define D3DRMANIMATION_CLOSED 0x02L +#define D3DRMANIMATION_LINEARPOSITION 0x04L +#define D3DRMANIMATION_SPLINEPOSITION 0x08L +#define D3DRMANIMATION_SCALEANDROTATION 0x00000010L +#define D3DRMANIMATION_POSITION 0x00000020L + +typedef DWORD D3DRMLOADOPTIONS; + +#define D3DRMLOAD_FROMFILE 0x00L +#define D3DRMLOAD_FROMRESOURCE 0x01L +#define D3DRMLOAD_FROMMEMORY 0x02L +#define D3DRMLOAD_FROMSTREAM 0x04L + +#define D3DRMLOAD_BYNAME 0x10L +#define D3DRMLOAD_BYPOSITION 0x20L +#define D3DRMLOAD_BYGUID 0x40L +#define D3DRMLOAD_FIRST 0x80L + +#define D3DRMLOAD_INSTANCEBYREFERENCE 0x100L +#define D3DRMLOAD_INSTANCEBYCOPYING 0x200L + +typedef struct _D3DRMLOADRESOURCE { + HMODULE hModule; + LPCTSTR lpName; + LPCTSTR lpType; +} D3DRMLOADRESOURCE, *LPD3DRMLOADRESOURCE; + +typedef struct _D3DRMLOADMEMORY { + LPVOID lpMemory; + DWORD dSize; +} D3DRMLOADMEMORY, *LPD3DRMLOADMEMORY; + +typedef enum _D3DRMUSERVISUALREASON { + D3DRMUSERVISUAL_CANSEE, + D3DRMUSERVISUAL_RENDER +} D3DRMUSERVISUALREASON, *LPD3DRMUSERVISUALREASON; + + +typedef DWORD D3DRMMAPPING, D3DRMMAPPINGFLAG, *LPD3DRMMAPPING; +static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPU = 1; +static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPV = 2; +static const D3DRMMAPPINGFLAG D3DRMMAP_PERSPCORRECT = 4; + +typedef struct _D3DRMVERTEX +{ D3DVECTOR position; + D3DVECTOR normal; + D3DVALUE tu, tv; + D3DCOLOR color; +} D3DRMVERTEX, *LPD3DRMVERTEX; + +typedef LONG D3DRMGROUPINDEX; /* group indexes begin a 0 */ +static const D3DRMGROUPINDEX D3DRMGROUP_ALLGROUPS = -1; + +/* + * Create a color from three components in the range 0-1 inclusive. + */ +extern D3DCOLOR D3DRMAPI D3DRMCreateColorRGB(D3DVALUE red, + D3DVALUE green, + D3DVALUE blue); + +/* + * Create a color from four components in the range 0-1 inclusive. + */ +extern D3DCOLOR D3DRMAPI D3DRMCreateColorRGBA(D3DVALUE red, + D3DVALUE green, + D3DVALUE blue, + D3DVALUE alpha); + +/* + * Get the red component of a color. + */ +extern D3DVALUE D3DRMAPI D3DRMColorGetRed(D3DCOLOR); + +/* + * Get the green component of a color. + */ +extern D3DVALUE D3DRMAPI D3DRMColorGetGreen(D3DCOLOR); + +/* + * Get the blue component of a color. + */ +extern D3DVALUE D3DRMAPI D3DRMColorGetBlue(D3DCOLOR); + +/* + * Get the alpha component of a color. + */ +extern D3DVALUE D3DRMAPI D3DRMColorGetAlpha(D3DCOLOR); + +/* + * Add two vectors. Returns its first argument. + */ +extern LPD3DVECTOR D3DRMAPI D3DRMVectorAdd(LPD3DVECTOR d, + LPD3DVECTOR s1, + LPD3DVECTOR s2); + +/* + * Subtract two vectors. Returns its first argument. + */ +extern LPD3DVECTOR D3DRMAPI D3DRMVectorSubtract(LPD3DVECTOR d, + LPD3DVECTOR s1, + LPD3DVECTOR s2); +/* + * Reflect a ray about a given normal. Returns its first argument. + */ +extern LPD3DVECTOR D3DRMAPI D3DRMVectorReflect(LPD3DVECTOR d, + LPD3DVECTOR ray, + LPD3DVECTOR norm); + +/* + * Calculate the vector cross product. Returns its first argument. + */ +extern LPD3DVECTOR D3DRMAPI D3DRMVectorCrossProduct(LPD3DVECTOR d, + LPD3DVECTOR s1, + LPD3DVECTOR s2); +/* + * Return the vector dot product. + */ +extern D3DVALUE D3DRMAPI D3DRMVectorDotProduct(LPD3DVECTOR s1, + LPD3DVECTOR s2); + +/* + * Scale a vector so that its modulus is 1. Returns its argument or + * NULL if there was an error (e.g. a zero vector was passed). + */ +extern LPD3DVECTOR D3DRMAPI D3DRMVectorNormalize(LPD3DVECTOR); +#define D3DRMVectorNormalise D3DRMVectorNormalize + +/* + * Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)). + */ +extern D3DVALUE D3DRMAPI D3DRMVectorModulus(LPD3DVECTOR v); + +/* + * Set the rotation part of a matrix to be a rotation of theta radians + * around the given axis. + */ + +extern LPD3DVECTOR D3DRMAPI D3DRMVectorRotate(LPD3DVECTOR r, LPD3DVECTOR v, LPD3DVECTOR axis, D3DVALUE theta); + +/* + * Scale a vector uniformly in all three axes + */ +extern LPD3DVECTOR D3DRMAPI D3DRMVectorScale(LPD3DVECTOR d, LPD3DVECTOR s, D3DVALUE factor); + +/* + * Return a random unit vector + */ +extern LPD3DVECTOR D3DRMAPI D3DRMVectorRandom(LPD3DVECTOR d); + +/* + * Returns a unit quaternion that represents a rotation of theta radians + * around the given axis. + */ + +extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionFromRotation(LPD3DRMQUATERNION quat, + LPD3DVECTOR v, + D3DVALUE theta); + +/* + * Calculate the product of two quaternions + */ +extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionMultiply(LPD3DRMQUATERNION q, + LPD3DRMQUATERNION a, + LPD3DRMQUATERNION b); + +/* + * Interpolate between two quaternions + */ +extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionSlerp(LPD3DRMQUATERNION q, + LPD3DRMQUATERNION a, + LPD3DRMQUATERNION b, + D3DVALUE alpha); + +/* + * Calculate the matrix for the rotation that a unit quaternion represents + */ +extern void D3DRMAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D dmMat, LPD3DRMQUATERNION lpDqQuat); + + +#if defined(__cplusplus) +}; +#endif + +#endif diff --git a/sdk/inc/d3drmobj.h b/sdk/inc/d3drmobj.h new file mode 100644 index 0000000..b00cf08 --- /dev/null +++ b/sdk/inc/d3drmobj.h @@ -0,0 +1,727 @@ +/*==========================================================================; + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3drm.h + * Content: Direct3DRM include file + * + ***************************************************************************/ + +#ifndef _D3DRMOBJ_H_ +#define _D3DRMOBJ_H_ + +#include <objbase.h> /* Use Windows header files */ +#define VIRTUAL + +#include "d3drmdef.h" +#include "d3d.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The methods for IUnknown + */ +#define IUNKNOWN_METHODS(kind) \ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) kind; \ + STDMETHOD_(ULONG, AddRef) (THIS) kind; \ + STDMETHOD_(ULONG, Release) (THIS) kind + +/* + * The methods for IDirect3DRMObject + */ +#define IDIRECT3DRMOBJECT_METHODS(kind) \ + STDMETHOD(Clone) (THIS_ LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj) kind; \ + STDMETHOD(AddDestroyCallback) (THIS_ D3DRMOBJECTCALLBACK, LPVOID argument) kind; \ + STDMETHOD(DeleteDestroyCallback) (THIS_ D3DRMOBJECTCALLBACK, LPVOID argument) kind; \ + STDMETHOD(SetAppData) (THIS_ DWORD data) kind; \ + STDMETHOD_(DWORD, GetAppData) (THIS) kind; \ + STDMETHOD(SetName) (THIS_ LPCSTR) kind; \ + STDMETHOD(GetName) (THIS_ LPDWORD lpdwSize, LPSTR lpName) kind; \ + STDMETHOD(GetClassName) (THIS_ LPDWORD lpdwSize, LPSTR lpName) kind + + +#define WIN_TYPES(itype, ptype) \ + typedef interface itype FAR *LP##ptype, FAR **LPLP##ptype + +WIN_TYPES(IDirect3DRMObject, DIRECT3DRMOBJECT); +WIN_TYPES(IDirect3DRMDevice, DIRECT3DRMDEVICE); +WIN_TYPES(IDirect3DRMViewport, DIRECT3DRMVIEWPORT); +WIN_TYPES(IDirect3DRMFrame, DIRECT3DRMFRAME); +WIN_TYPES(IDirect3DRMVisual, DIRECT3DRMVISUAL); +WIN_TYPES(IDirect3DRMMesh, DIRECT3DRMMESH); +WIN_TYPES(IDirect3DRMMeshBuilder, DIRECT3DRMMESHBUILDER); +WIN_TYPES(IDirect3DRMFace, DIRECT3DRMFACE); +WIN_TYPES(IDirect3DRMLight, DIRECT3DRMLIGHT); +WIN_TYPES(IDirect3DRMTexture, DIRECT3DRMTEXTURE); +WIN_TYPES(IDirect3DRMWrap, DIRECT3DRMWRAP); +WIN_TYPES(IDirect3DRMMaterial, DIRECT3DRMMATERIAL); +WIN_TYPES(IDirect3DRMAnimation, DIRECT3DRMANIMATION); +WIN_TYPES(IDirect3DRMAnimationSet, DIRECT3DRMANIMATIONSET); +WIN_TYPES(IDirect3DRMUserVisual, DIRECT3DRMUSERVISUAL); +WIN_TYPES(IDirect3DRMShadow, DIRECT3DRMSHADOW); +WIN_TYPES(IDirect3DRMArray, DIRECT3DRMOBJECTARRAY); +WIN_TYPES(IDirect3DRMDeviceArray, DIRECT3DRMDEVICEARRAY); +WIN_TYPES(IDirect3DRMFaceArray, DIRECT3DRMFACEARRAY); +WIN_TYPES(IDirect3DRMViewportArray, DIRECT3DRMVIEWPORTARRAY); +WIN_TYPES(IDirect3DRMFrameArray, DIRECT3DRMFRAMEARRAY); +WIN_TYPES(IDirect3DRMVisualArray, DIRECT3DRMVISUALARRAY); +WIN_TYPES(IDirect3DRMPickedArray, DIRECT3DRMPICKEDARRAY); +WIN_TYPES(IDirect3DRMLightArray, DIRECT3DRMLIGHTARRAY); + +/* + * Direct3DRM Object classes + */ +DEFINE_GUID(CLSID_CDirect3DRMDevice, 0x4fa3568e, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMViewport, 0x4fa3568f, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMFrame, 0x4fa35690, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMesh, 0x4fa35691, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMeshBuilder, 0x4fa35692, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMFace, 0x4fa35693, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMLight, 0x4fa35694, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMTexture, 0x4fa35695, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMWrap, 0x4fa35696, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMMaterial, 0x4fa35697, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMAnimation, 0x4fa35698, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMAnimationSet, 0x4fa35699, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMUserVisual, 0x4fa3569a, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(CLSID_CDirect3DRMShadow, 0x4fa3569b, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); + +/* + * Direct3DRM Object interfaces + */ +DEFINE_GUID(IID_IDirect3DRMObject, 0xeb16cb00, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMDevice, 0xe9e19280, 0x6e05, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMViewport, 0xeb16cb02, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFrame, 0xeb16cb03, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMVisual, 0xeb16cb04, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMesh, 0xa3a80d01, 0x6e12, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMeshBuilder, 0xa3a80d02, 0x6e12, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFace, 0xeb16cb07, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMLight, 0xeb16cb08, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMTexture, 0xeb16cb09, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMWrap, 0xeb16cb0a, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMMaterial, 0xeb16cb0b, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMAnimation, 0xeb16cb0d, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMAnimationSet, 0xeb16cb0e, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMDeviceArray, 0xeb16cb10, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMViewportArray, 0xeb16cb11, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFrameArray, 0xeb16cb12, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMVisualArray, 0xeb16cb13, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMLightArray, 0xeb16cb14, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMPickedArray, 0xeb16cb16, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMFaceArray, 0xeb16cb17, 0xd271, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMUserVisual, 0x59163de0, 0x6d43, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); +DEFINE_GUID(IID_IDirect3DRMShadow, 0xaf359780, 0x6ba3, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); + +typedef void (CDECL *D3DRMOBJECTCALLBACK)(LPDIRECT3DRMOBJECT obj, LPVOID arg); +typedef void (CDECL *D3DRMFRAMEMOVECALLBACK)(LPDIRECT3DRMFRAME obj, LPVOID arg, D3DVALUE delta); +typedef void (CDECL *D3DRMUPDATECALLBACK)(LPDIRECT3DRMDEVICE obj, LPVOID arg, int, LPD3DRECT); +typedef int (CDECL *D3DRMUSERVISUALCALLBACK) + ( LPDIRECT3DRMUSERVISUAL obj, LPVOID arg, D3DRMUSERVISUALREASON reason, + LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view + ); +typedef HRESULT (CDECL *D3DRMLOADTEXTURECALLBACK) + (char *tex_name, void *arg, LPDIRECT3DRMTEXTURE *); +typedef void (CDECL *D3DRMLOADCALLBACK) + (LPDIRECT3DRMOBJECT object, REFIID objectguid, LPVOID arg); + + + +typedef struct _D3DRMPICKDESC +{ + ULONG ulFaceIdx; + LONG lGroupIdx; + D3DVECTOR vPosition; + +} D3DRMPICKDESC, *LPD3DRMPICKDESC; + +#undef INTERFACE +#define INTERFACE IDirect3DRMObject + +/* + * Base class + */ +DECLARE_INTERFACE_(IDirect3DRMObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMVisual + +DECLARE_INTERFACE_(IDirect3DRMVisual, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMDevice + +DECLARE_INTERFACE_(IDirect3DRMDevice, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMDevice methods + */ + STDMETHOD(Init)(THIS_ ULONG width, ULONG height) PURE; + STDMETHOD(InitFromD3D)(THIS_ LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpD3DDev) PURE; + STDMETHOD(InitFromClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper, LPGUID lpGUID, int width, int height) PURE; + + STDMETHOD(Update)(THIS) PURE; + STDMETHOD(AddUpdateCallback)(THIS_ D3DRMUPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(DeleteUpdateCallback)(THIS_ D3DRMUPDATECALLBACK, LPVOID arg) PURE; + STDMETHOD(SetBufferCount)(THIS_ DWORD) PURE; + STDMETHOD_(DWORD, GetBufferCount)(THIS) PURE; + + STDMETHOD(SetDither)(THIS_ BOOL) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetTextureQuality)(THIS_ D3DRMTEXTUREQUALITY) PURE; + + STDMETHOD(GetViewports)(THIS_ LPDIRECT3DRMVIEWPORTARRAY *return_views) PURE; + + STDMETHOD_(BOOL, GetDither)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetTrianglesDrawn)(THIS) PURE; + STDMETHOD_(DWORD, GetWireframeOptions)(THIS) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(D3DCOLORMODEL, GetColorModel)(THIS) PURE; + STDMETHOD_(D3DRMTEXTUREQUALITY, GetTextureQuality)(THIS) PURE; + STDMETHOD(GetDirect3DDevice)(THIS_ LPDIRECT3DDEVICE *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMViewport + +DECLARE_INTERFACE_(IDirect3DRMViewport, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMViewport methods + */ + STDMETHOD(Init) + ( THIS_ LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMFRAME camera, + DWORD xpos, DWORD ypos, DWORD width, DWORD height + ) PURE; + STDMETHOD(Clear)(THIS) PURE; + STDMETHOD(Render)(THIS_ LPDIRECT3DRMFRAME) PURE; + + STDMETHOD(SetFront)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetBack)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetField)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetUniformScaling)(THIS_ BOOL) PURE; + STDMETHOD(SetCamera)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(SetProjection)(THIS_ D3DRMPROJECTIONTYPE) PURE; + STDMETHOD(Transform)(THIS_ D3DRMVECTOR4D *d, D3DVECTOR *s) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DRMVECTOR4D *s) PURE; + STDMETHOD(Configure)(THIS_ LONG x, LONG y, DWORD width, DWORD height) PURE; + STDMETHOD(ForceUpdate)(THIS_ DWORD x1, DWORD y1, DWORD x2, DWORD y2) PURE; + STDMETHOD(SetPlane)(THIS_ D3DVALUE left, D3DVALUE right, D3DVALUE bottom, D3DVALUE top) PURE; + + STDMETHOD(GetCamera)(THIS_ LPDIRECT3DRMFRAME *) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DRMDEVICE *) PURE; + STDMETHOD(GetPlane)(THIS_ D3DVALUE *left, D3DVALUE *right, D3DVALUE *bottom, D3DVALUE *top) PURE; + STDMETHOD(Pick)(THIS_ LONG x, LONG y, LPDIRECT3DRMPICKEDARRAY *return_visuals) PURE; + + STDMETHOD_(BOOL, GetUniformScaling)(THIS) PURE; + STDMETHOD_(LONG, GetX)(THIS) PURE; + STDMETHOD_(LONG, GetY)(THIS) PURE; + STDMETHOD_(DWORD, GetWidth)(THIS) PURE; + STDMETHOD_(DWORD, GetHeight)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetField)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetBack)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetFront)(THIS) PURE; + STDMETHOD_(D3DRMPROJECTIONTYPE, GetProjection)(THIS) PURE; + STDMETHOD(GetDirect3DViewport)(THIS_ LPDIRECT3DVIEWPORT *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFrame + +DECLARE_INTERFACE_(IDirect3DRMFrame, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMFrame methods + */ + STDMETHOD(AddChild)(THIS_ LPDIRECT3DRMFRAME child) PURE; + STDMETHOD(AddLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(AddMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK, VOID *arg) PURE; + STDMETHOD(AddTransform)(THIS_ D3DRMCOMBINETYPE, D3DRMMATRIX4D) PURE; + STDMETHOD(AddTranslation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScale)(THIS_ D3DRMCOMBINETYPE, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(AddRotation)(THIS_ D3DRMCOMBINETYPE, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(AddVisual)(THIS_ LPDIRECT3DRMVISUAL) PURE; + STDMETHOD(GetChildren)(THIS_ LPDIRECT3DRMFRAMEARRAY *children) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD(GetLights)(THIS_ LPDIRECT3DRMLIGHTARRAY *lights) PURE; + STDMETHOD_(D3DRMMATERIALMODE, GetMaterialMode)(THIS) PURE; + STDMETHOD(GetParent)(THIS_ LPDIRECT3DRMFRAME *) PURE; + STDMETHOD(GetPosition)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR return_position) PURE; + STDMETHOD(GetRotation)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR axis, LPD3DVALUE return_theta) PURE; + STDMETHOD(GetScene)(THIS_ LPDIRECT3DRMFRAME *) PURE; + STDMETHOD_(D3DRMSORTMODE, GetSortMode)(THIS) PURE; + STDMETHOD(GetTexture)(THIS_ LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(GetTransform)(THIS_ D3DRMMATRIX4D return_matrix) PURE; + STDMETHOD(GetVelocity)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR return_velocity, BOOL with_rotation) PURE; + STDMETHOD(GetOrientation)(THIS_ LPDIRECT3DRMFRAME reference, LPD3DVECTOR dir, LPD3DVECTOR up) PURE; + STDMETHOD(GetVisuals)(THIS_ LPDIRECT3DRMVISUALARRAY *visuals) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(InverseTransform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK, LPVOID lpArg)PURE; + STDMETHOD(LookAt)(THIS_ LPDIRECT3DRMFRAME target, LPDIRECT3DRMFRAME reference, D3DRMFRAMECONSTRAINT) PURE; + STDMETHOD(Move)(THIS_ D3DVALUE delta) PURE; + STDMETHOD(DeleteChild)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(DeleteLight)(THIS_ LPDIRECT3DRMLIGHT) PURE; + STDMETHOD(DeleteMoveCallback)(THIS_ D3DRMFRAMEMOVECALLBACK, VOID *arg) PURE; + STDMETHOD(DeleteVisual)(THIS_ LPDIRECT3DRMVISUAL) PURE; + STDMETHOD_(D3DCOLOR, GetSceneBackground)(THIS) PURE; + STDMETHOD(GetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE *) PURE; + STDMETHOD_(D3DCOLOR, GetSceneFogColor)(THIS) PURE; + STDMETHOD_(BOOL, GetSceneFogEnable)(THIS) PURE; + STDMETHOD_(D3DRMFOGMODE, GetSceneFogMode)(THIS) PURE; + STDMETHOD(GetSceneFogParams)(THIS_ D3DVALUE *return_start, D3DVALUE *return_end, D3DVALUE *return_density) PURE; + STDMETHOD(SetSceneBackground)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneBackgroundRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetSceneBackgroundDepth)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(SetSceneBackgroundImage)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetSceneFogEnable)(THIS_ BOOL) PURE; + STDMETHOD(SetSceneFogColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetSceneFogMode)(THIS_ D3DRMFOGMODE) PURE; + STDMETHOD(SetSceneFogParams)(THIS_ D3DVALUE start, D3DVALUE end, D3DVALUE density) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD_(D3DRMZBUFFERMODE, GetZbufferMode)(THIS) PURE; + STDMETHOD(SetMaterialMode)(THIS_ D3DRMMATERIALMODE) PURE; + STDMETHOD(SetOrientation) + ( THIS_ LPDIRECT3DRMFRAME reference, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz + ) PURE; + STDMETHOD(SetPosition)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetRotation)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta) PURE; + STDMETHOD(SetSortMode)(THIS_ D3DRMSORTMODE) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetVelocity)(THIS_ LPDIRECT3DRMFRAME reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation) PURE; + STDMETHOD(SetZbufferMode)(THIS_ D3DRMZBUFFERMODE) PURE; + STDMETHOD(Transform)(THIS_ D3DVECTOR *d, D3DVECTOR *s) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMMesh + +DECLARE_INTERFACE_(IDirect3DRMMesh, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMesh methods + */ + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(AddGroup)(THIS_ unsigned vCount, unsigned fCount, unsigned vPerFace, unsigned *fData, D3DRMGROUPINDEX *returnId) PURE; + STDMETHOD(SetVertices)(THIS_ D3DRMGROUPINDEX id, unsigned index, unsigned count, D3DRMVERTEX *values) PURE; + STDMETHOD(SetGroupColor)(THIS_ D3DRMGROUPINDEX id, D3DCOLOR value) PURE; + STDMETHOD(SetGroupColorRGB)(THIS_ D3DRMGROUPINDEX id, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetGroupMapping)(THIS_ D3DRMGROUPINDEX id, D3DRMMAPPING value) PURE; + STDMETHOD(SetGroupQuality)(THIS_ D3DRMGROUPINDEX id, D3DRMRENDERQUALITY value) PURE; + STDMETHOD(SetGroupMaterial)(THIS_ D3DRMGROUPINDEX id, LPDIRECT3DRMMATERIAL value) PURE; + STDMETHOD(SetGroupTexture)(THIS_ D3DRMGROUPINDEX id, LPDIRECT3DRMTEXTURE value) PURE; + + STDMETHOD_(unsigned, GetGroupCount)(THIS) PURE; + STDMETHOD(GetGroup)(THIS_ D3DRMGROUPINDEX id, unsigned *vCount, unsigned *fCount, unsigned *vPerFace, DWORD *fDataSize, unsigned *fData) PURE; + STDMETHOD(GetVertices)(THIS_ D3DRMGROUPINDEX id, DWORD index, DWORD count, D3DRMVERTEX *returnPtr) PURE; + STDMETHOD_(D3DCOLOR, GetGroupColor)(THIS_ D3DRMGROUPINDEX id) PURE; + STDMETHOD_(D3DRMMAPPING, GetGroupMapping)(THIS_ D3DRMGROUPINDEX id) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetGroupQuality)(THIS_ D3DRMGROUPINDEX id) PURE; + STDMETHOD(GetGroupMaterial)(THIS_ D3DRMGROUPINDEX id, LPDIRECT3DRMMATERIAL *returnPtr) PURE; + STDMETHOD(GetGroupTexture)(THIS_ D3DRMGROUPINDEX id, LPDIRECT3DRMTEXTURE *returnPtr) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMShadow + +DECLARE_INTERFACE_(IDirect3DRMShadow, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMShadow methods + */ + STDMETHOD(Init) + ( THIS_ LPDIRECT3DRMVISUAL visual, LPDIRECT3DRMLIGHT light, + D3DVALUE px, D3DVALUE py, D3DVALUE pz, + D3DVALUE nx, D3DVALUE ny, D3DVALUE nz + ) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFace + +DECLARE_INTERFACE_(IDirect3DRMFace, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMFace methods + */ + STDMETHOD(AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddVertexAndNormalIndexed)(THIS_ DWORD vertex, DWORD normal) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + + STDMETHOD(GetVertex)(THIS_ DWORD index, D3DVECTOR *vertex, D3DVECTOR *normal) PURE; + STDMETHOD(GetVertices)(THIS_ DWORD *vertex_count, D3DVECTOR *coords, D3DVECTOR *normals); + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD vertex, D3DVALUE *u, D3DVALUE *v) PURE; + STDMETHOD(GetTextureTopology)(THIS_ BOOL *wrap_u, BOOL *wrap_v) PURE; + STDMETHOD(GetNormal)(THIS_ D3DVECTOR *) PURE; + STDMETHOD(GetTexture)(THIS_ LPDIRECT3DRMTEXTURE *) PURE; + STDMETHOD(GetMaterial)(THIS_ LPDIRECT3DRMMATERIAL *) PURE; + + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(int, GetVertexIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(int, GetTextureCoordinateIndex)(THIS_ DWORD which) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMMeshBuilder + +DECLARE_INTERFACE_(IDirect3DRMMeshBuilder, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMeshBuilder methods + */ + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK, LPVOID lpArg) PURE; + STDMETHOD(Save)(THIS_ const char *filename, D3DRMXOFFORMAT, D3DRMSAVEOPTIONS save) PURE; + STDMETHOD(Scale)(THIS_ D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) PURE; + STDMETHOD(Translate)(THIS_ D3DVALUE tx, D3DVALUE ty, D3DVALUE tz) PURE; + STDMETHOD(SetColorSource)(THIS_ D3DRMCOLORSOURCE) PURE; + STDMETHOD(GetBox)(THIS_ D3DRMBOX *) PURE; + STDMETHOD(GenerateNormals)(THIS) PURE; + STDMETHOD_(D3DRMCOLORSOURCE, GetColorSource)(THIS) PURE; + + STDMETHOD(AddMesh)(THIS_ LPDIRECT3DRMMESH) PURE; + STDMETHOD(AddMeshBuilder)(THIS_ LPDIRECT3DRMMESHBUILDER) PURE; + STDMETHOD(AddFrame)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(AddFace)(THIS_ LPDIRECT3DRMFACE) PURE; + STDMETHOD(AddFaces) + ( THIS_ DWORD vcount, D3DVECTOR *vertices, DWORD ncount, D3DVECTOR *normals, + DWORD *data, LPDIRECT3DRMFACEARRAY* + ) PURE; + STDMETHOD(ReserveSpace)(THIS_ DWORD vertex_Count, DWORD normal_count, DWORD face_count) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetTexture)(THIS_ LPDIRECT3DRMTEXTURE) PURE; + STDMETHOD(SetMaterial)(THIS_ LPDIRECT3DRMMATERIAL) PURE; + STDMETHOD(SetTextureTopology)(THIS_ BOOL wrap_u, BOOL wrap_v) PURE; + STDMETHOD(SetQuality)(THIS_ D3DRMRENDERQUALITY) PURE; + STDMETHOD(SetPerspective)(THIS_ BOOL) PURE; + STDMETHOD(SetVertex)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetNormal)(THIS_ DWORD index, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(SetTextureCoordinates)(THIS_ DWORD index, D3DVALUE u, D3DVALUE v) PURE; + STDMETHOD(SetVertexColor)(THIS_ DWORD index, D3DCOLOR) PURE; + STDMETHOD(SetVertexColorRGB)(THIS_ DWORD index, D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + + STDMETHOD(GetFaces)(THIS_ LPDIRECT3DRMFACEARRAY*) PURE; + STDMETHOD(GetVertices) + ( THIS_ DWORD *vcount, D3DVECTOR *vertices, DWORD *ncount, D3DVECTOR *normals, DWORD *face_data_size, DWORD *face_data + ) PURE; + STDMETHOD(GetTextureCoordinates)(THIS_ DWORD index, D3DVALUE *u, D3DVALUE *v) PURE; + + STDMETHOD_(int, AddVertex)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD_(int, AddNormal)(THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(CreateFace)(THIS_ LPDIRECT3DRMFACE*) PURE; + STDMETHOD_(D3DRMRENDERQUALITY, GetQuality)(THIS) PURE; + STDMETHOD_(BOOL, GetPerspective)(THIS) PURE; + STDMETHOD_(int, GetFaceCount)(THIS) PURE; + STDMETHOD_(int, GetVertexCount)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetVertexColor)(THIS_ DWORD index) PURE; + + STDMETHOD(CreateMesh)(THIS_ LPDIRECT3DRMMESH*) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMLight + +DECLARE_INTERFACE_(IDirect3DRMLight, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMLight methods + */ + STDMETHOD(SetType)(THIS_ D3DRMLIGHTTYPE) PURE; + STDMETHOD(SetColor)(THIS_ D3DCOLOR) PURE; + STDMETHOD(SetColorRGB)(THIS_ D3DVALUE red, D3DVALUE green, D3DVALUE blue) PURE; + STDMETHOD(SetRange)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetUmbra)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetPenumbra)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetConstantAttenuation)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetLinearAttenuation)(THIS_ D3DVALUE) PURE; + STDMETHOD(SetQuadraticAttenuation)(THIS_ D3DVALUE) PURE; + + STDMETHOD_(D3DVALUE, GetRange)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetUmbra)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetPenumbra)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetConstantAttenuation)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetLinearAttenuation)(THIS) PURE; + STDMETHOD_(D3DVALUE, GetQuadraticAttenuation)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetColor)(THIS) PURE; + STDMETHOD_(D3DRMLIGHTTYPE, GetType)(THIS) PURE; + + STDMETHOD(SetEnableFrame)(THIS_ LPDIRECT3DRMFRAME) PURE; + STDMETHOD(GetEnableFrame)(THIS_ LPDIRECT3DRMFRAME*) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMTexture + +DECLARE_INTERFACE_(IDirect3DRMTexture, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMTexture methods + */ + STDMETHOD(InitFromFile)(THIS_ const char *filename) PURE; + STDMETHOD(InitFromSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDS) PURE; + STDMETHOD(InitFromResource)(THIS_ HRSRC) PURE; + STDMETHOD(Changed)(THIS_ BOOL pixels, BOOL palette) PURE; + + STDMETHOD(SetColors)(THIS_ DWORD) PURE; + STDMETHOD(SetShades)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalSize)(THIS_ D3DVALUE width, D3DVALUE height) PURE; + STDMETHOD(SetDecalOrigin)(THIS_ LONG x, LONG y) PURE; + STDMETHOD(SetDecalScale)(THIS_ DWORD) PURE; + STDMETHOD(SetDecalTransparency)(THIS_ BOOL) PURE; + STDMETHOD(SetDecalTransparentColor)(THIS_ D3DCOLOR) PURE; + + STDMETHOD(GetDecalSize)(THIS_ D3DVALUE *width_return, D3DVALUE *height_return) PURE; + STDMETHOD(GetDecalOrigin)(THIS_ LONG *x_return, LONG *y_return) PURE; + + STDMETHOD_(D3DRMIMAGE *, GetImage)(THIS) PURE; + STDMETHOD_(DWORD, GetShades)(THIS) PURE; + STDMETHOD_(DWORD, GetColors)(THIS) PURE; + STDMETHOD_(DWORD, GetDecalScale)(THIS) PURE; + STDMETHOD_(BOOL, GetDecalTransparency)(THIS) PURE; + STDMETHOD_(D3DCOLOR, GetDecalTransparentColor)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMWrap + +DECLARE_INTERFACE_(IDirect3DRMWrap, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMWrap methods + */ + STDMETHOD(Init) + ( THIS_ D3DRMWRAPTYPE, LPDIRECT3DRMFRAME ref, + D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, + D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, + D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, + D3DVALUE ou, D3DVALUE ov, + D3DVALUE su, D3DVALUE sv + ) PURE; + STDMETHOD(Apply)(THIS_ LPDIRECT3DRMOBJECT) PURE; + STDMETHOD(ApplyRelative)(THIS_ LPDIRECT3DRMFRAME frame, LPDIRECT3DRMOBJECT) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMMaterial + +DECLARE_INTERFACE_(IDirect3DRMMaterial, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMMaterial methods + */ + STDMETHOD(SetPower)(THIS_ D3DVALUE power) PURE; + STDMETHOD(SetSpecular)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + STDMETHOD(SetEmissive)(THIS_ D3DVALUE r, D3DVALUE g, D3DVALUE b) PURE; + + STDMETHOD_(D3DVALUE, GetPower)(THIS) PURE; + STDMETHOD(GetSpecular)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; + STDMETHOD(GetEmissive)(THIS_ D3DVALUE* r, D3DVALUE* g, D3DVALUE* b) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMAnimation + +DECLARE_INTERFACE_(IDirect3DRMAnimation, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMAnimation methods + */ + STDMETHOD(SetOptions)(THIS_ D3DRMANIMATIONOPTIONS flags) PURE; + STDMETHOD(AddRotateKey)(THIS_ D3DVALUE time, D3DRMQUATERNION *q) PURE; + STDMETHOD(AddPositionKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(AddScaleKey)(THIS_ D3DVALUE time, D3DVALUE x, D3DVALUE y, D3DVALUE z) PURE; + STDMETHOD(DeleteKey)(THIS_ D3DVALUE time) PURE; + STDMETHOD(SetFrame)(THIS_ LPDIRECT3DRMFRAME frame) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; + + STDMETHOD_(D3DRMANIMATIONOPTIONS, GetOptions)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMAnimationSet + +DECLARE_INTERFACE_(IDirect3DRMAnimationSet, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMAnimationSet methods + */ + STDMETHOD(AddAnimation)(THIS_ LPDIRECT3DRMANIMATION aid) PURE; + STDMETHOD(Load)(THIS_ LPVOID filename, LPVOID name, D3DRMLOADOPTIONS loadflags, D3DRMLOADTEXTURECALLBACK, LPVOID lpArg, LPDIRECT3DRMFRAME parent)PURE; + STDMETHOD(DeleteAnimation)(THIS_ LPDIRECT3DRMANIMATION aid) PURE; + STDMETHOD(SetTime)(THIS_ D3DVALUE time) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMUserVisual + +DECLARE_INTERFACE_(IDirect3DRMUserVisual, IDirect3DRMVisual) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMUserVisual methods + */ + STDMETHOD(Init)(THIS_ D3DRMUSERVISUALCALLBACK fn, void *arg) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMArray + +DECLARE_INTERFACE_(IDirect3DRMArray, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + /* No GetElement method as it would get overloaded + * in derived classes, and overloading is + * a no-no in COM + */ +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMDeviceArray + +DECLARE_INTERFACE_(IDirect3DRMDeviceArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMDEVICE *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFrameArray + +DECLARE_INTERFACE_(IDirect3DRMFrameArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMFRAME *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMViewportArray + +DECLARE_INTERFACE_(IDirect3DRMViewportArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMVIEWPORT *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMVisualArray + +DECLARE_INTERFACE_(IDirect3DRMVisualArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMVISUAL *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMPickedArray + +DECLARE_INTERFACE_(IDirect3DRMPickedArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetPick)(THIS_ DWORD index, LPDIRECT3DRMVISUAL *, LPDIRECT3DRMFRAMEARRAY *, LPD3DRMPICKDESC) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMLightArray + +DECLARE_INTERFACE_(IDirect3DRMLightArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMLIGHT *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirect3DRMFaceArray + +DECLARE_INTERFACE_(IDirect3DRMFaceArray, IDirect3DRMArray) +{ + IUNKNOWN_METHODS(PURE); + + STDMETHOD_(DWORD, GetSize)(THIS) PURE; + STDMETHOD(GetElement)(THIS_ DWORD index, LPDIRECT3DRMFACE *) PURE; +}; + +#ifdef __cplusplus +}; +#endif +#endif /* _D3DRMOBJ_H_ */ diff --git a/sdk/inc/d3drmwin.h b/sdk/inc/d3drmwin.h new file mode 100644 index 0000000..6cda7e6 --- /dev/null +++ b/sdk/inc/d3drmwin.h @@ -0,0 +1,48 @@ +/*==========================================================================; + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3drm.h + * Content: Direct3DRM include file + * + ***************************************************************************/ + +#ifndef __D3DRMWIN_H__ +#define __D3DRMWIN_H__ + +#ifndef WIN32 +#define WIN32 +#endif + +#include "d3drm.h" +#include "ddraw.h" +#include "d3d.h" + +/* + * GUIDS used by Direct3DRM Windows interface + */ +DEFINE_GUID(IID_IDirect3DRMWinDevice, 0xc5016cc0, 0xd273, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); + +WIN_TYPES(IDirect3DRMWinDevice, DIRECT3DRMWINDEVICE); + +#undef INTERFACE +#define INTERFACE IDirect3DRMWinDevice + +DECLARE_INTERFACE_(IDirect3DRMWinDevice, IDirect3DRMObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECT3DRMOBJECT_METHODS(PURE); + + /* + * IDirect3DRMWinDevice methods + */ + + /* Repaint the window with the last frame which was rendered. */ + STDMETHOD(HandlePaint)(THIS_ HDC hdc) PURE; + + /* Respond to a WM_ACTIVATE message. */ + STDMETHOD(HandleActivate)(THIS_ WORD wparam) PURE; +}; + + +#endif diff --git a/sdk/inc/d3dtypes.h b/sdk/inc/d3dtypes.h new file mode 100644 index 0000000..64343b7 --- /dev/null +++ b/sdk/inc/d3dtypes.h @@ -0,0 +1,956 @@ +/*==========================================================================; + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dtypes.h + * Content: Direct3D types include file + * + ***************************************************************************/ + +#ifndef _D3DTYPES_H_ +#define _D3DTYPES_H_ + +#ifndef WIN32 +#include "subwtype.h" +#else +#include <windows.h> +#endif + +#include <ddraw.h> + +#pragma pack(4) + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/* D3DVALUE is the fundamental Direct3D fractional data type */ + +#define D3DVALP(val, prec) ((float)(val)) +#define D3DVAL(val) ((float)(val)) +typedef float D3DVALUE, *LPD3DVALUE; +#define D3DDivide(a, b) (float)((double) (a) / (double) (b)) +#define D3DMultiply(a, b) ((a) * (b)) + +typedef LONG D3DFIXED; + +#ifndef RGB_MAKE +/* + * Format of CI colors is + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | alpha | color index | fraction | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +#define CI_GETALPHA(ci) ((ci) >> 24) +#define CI_GETINDEX(ci) (((ci) >> 8) & 0xffff) +#define CI_GETFRACTION(ci) ((ci) & 0xff) +#define CI_ROUNDINDEX(ci) CI_GETINDEX((ci) + 0x80) +#define CI_MASKALPHA(ci) ((ci) & 0xffffff) +#define CI_MAKE(a, i, f) (((a) << 24) | ((i) << 8) | (f)) + +/* + * Format of RGBA colors is + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | alpha | red | green | blue | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +#define RGBA_GETALPHA(rgb) ((rgb) >> 24) +#define RGBA_GETRED(rgb) (((rgb) >> 16) & 0xff) +#define RGBA_GETGREEN(rgb) (((rgb) >> 8) & 0xff) +#define RGBA_GETBLUE(rgb) ((rgb) & 0xff) +#define RGBA_MAKE(r, g, b, a) ((D3DCOLOR) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))) + +/* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs + * The float values must be in the range 0..1 + */ +#define D3DRGB(r, g, b) \ + (0xff000000L | ( ((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255)) +#define D3DRGBA(r, g, b, a) \ + ( (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \ + | (((long)((g) * 255)) << 8) | (long)((b) * 255) \ + ) + +/* + * Format of RGB colors is + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ignored | red | green | blue | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +#define RGB_GETRED(rgb) (((rgb) >> 16) & 0xff) +#define RGB_GETGREEN(rgb) (((rgb) >> 8) & 0xff) +#define RGB_GETBLUE(rgb) ((rgb) & 0xff) +#define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff)) +#define RGB_MAKE(r, g, b) ((D3DCOLOR) (((r) << 16) | ((g) << 8) | (b))) +#define RGBA_TORGB(rgba) ((D3DCOLOR) ((rgba) & 0xffffff)) +#define RGB_TORGBA(rgb) ((D3DCOLOR) ((rgb) | 0xff000000)) + +#endif + +/* + * Flags for Enumerate functions + */ + +/* + * Stop the enumeration + */ +#define D3DENUMRET_CANCEL DDENUMRET_CANCEL + +/* + * Continue the enumeration + */ +#define D3DENUMRET_OK DDENUMRET_OK + +typedef HRESULT (WINAPI* LPD3DVALIDATECALLBACK)(LPVOID lpUserArg, DWORD dwOffset); +typedef HRESULT (WINAPI* LPD3DENUMTEXTUREFORMATSCALLBACK)(LPDDSURFACEDESC lpDdsd, LPVOID lpContext); + +typedef DWORD D3DCOLOR, D3DCOLOR, *LPD3DCOLOR; + +typedef DWORD D3DMATERIALHANDLE, *LPD3DMATERIALHANDLE; +typedef DWORD D3DTEXTUREHANDLE, *LPD3DTEXTUREHANDLE; +typedef DWORD D3DMATRIXHANDLE, *LPD3DMATRIXHANDLE; + +typedef struct _D3DCOLORVALUE { + union { + D3DVALUE r; + D3DVALUE dvR; + }; + union { + D3DVALUE g; + D3DVALUE dvG; + }; + union { + D3DVALUE b; + D3DVALUE dvB; + }; + union { + D3DVALUE a; + D3DVALUE dvA; + }; +} D3DCOLORVALUE; + +typedef struct _D3DRECT { + union { + LONG x1; + LONG lX1; + }; + union { + LONG y1; + LONG lY1; + }; + union { + LONG x2; + LONG lX2; + }; + union { + LONG y2; + LONG lY2; + }; +} D3DRECT, *LPD3DRECT; + +typedef struct _D3DVECTOR { + union { + D3DVALUE x; + D3DVALUE dvX; + }; + union { + D3DVALUE y; + D3DVALUE dvY; + }; + union { + D3DVALUE z; + D3DVALUE dvZ; + }; +} D3DVECTOR, *LPD3DVECTOR; + + +/* + * Vertex data types supported in an ExecuteBuffer. + */ + +/* + * Homogeneous vertices + */ + +typedef struct _D3DHVERTEX { + DWORD dwFlags; /* Homogeneous clipping flags */ + union { + D3DVALUE hx; + D3DVALUE dvHX; + }; + union { + D3DVALUE hy; + D3DVALUE dvHY; + }; + union { + D3DVALUE hz; + D3DVALUE dvHZ; + }; +} D3DHVERTEX, *LPD3DHVERTEX; + +/* + * Transformed/lit vertices + */ +typedef struct _D3DTLVERTEX { + union { + D3DVALUE sx; /* Screen coordinates */ + D3DVALUE dvSX; + }; + union { + D3DVALUE sy; + D3DVALUE dvSY; + }; + union { + D3DVALUE sz; + D3DVALUE dvSZ; + }; + union { + D3DVALUE rhw; /* Reciprocal of homogeneous w */ + D3DVALUE dvRHW; + }; + union { + D3DCOLOR color; /* Vertex color */ + D3DCOLOR dcColor; + }; + union { + D3DCOLOR specular; /* Specular component of vertex */ + D3DCOLOR dcSpecular; + }; + union { + D3DVALUE tu; /* Texture coordinates */ + D3DVALUE dvTU; + }; + union { + D3DVALUE tv; + D3DVALUE dvTV; + }; +} D3DTLVERTEX, *LPD3DTLVERTEX; + +/* + * Untransformed/lit vertices + */ +typedef struct _D3DLVERTEX { + union { + D3DVALUE x; /* Homogeneous coordinates */ + D3DVALUE dvX; + }; + union { + D3DVALUE y; + D3DVALUE dvY; + }; + union { + D3DVALUE z; + D3DVALUE dvZ; + }; + DWORD dwReserved; + union { + D3DCOLOR color; /* Vertex color */ + D3DCOLOR dcColor; + }; + union { + D3DCOLOR specular; /* Specular component of vertex */ + D3DCOLOR dcSpecular; + }; + union { + D3DVALUE tu; /* Texture coordinates */ + D3DVALUE dvTU; + }; + union { + D3DVALUE tv; + D3DVALUE dvTV; + }; +} D3DLVERTEX, *LPD3DLVERTEX; + +/* + * Untransformed/unlit vertices + */ + +typedef struct _D3DVERTEX { + union { + D3DVALUE x; /* Homogeneous coordinates */ + D3DVALUE dvX; + }; + union { + D3DVALUE y; + D3DVALUE dvY; + }; + union { + D3DVALUE z; + D3DVALUE dvZ; + }; + union { + D3DVALUE nx; /* Normal */ + D3DVALUE dvNX; + }; + union { + D3DVALUE ny; + D3DVALUE dvNY; + }; + union { + D3DVALUE nz; + D3DVALUE dvNZ; + }; + union { + D3DVALUE tu; /* Texture coordinates */ + D3DVALUE dvTU; + }; + union { + D3DVALUE tv; + D3DVALUE dvTV; + }; +} D3DVERTEX, *LPD3DVERTEX; + +/* + * Matrix, viewport, and tranformation structures and definitions. + */ + +typedef struct _D3DMATRIX { + D3DVALUE _11, _12, _13, _14; + D3DVALUE _21, _22, _23, _24; + D3DVALUE _31, _32, _33, _34; + D3DVALUE _41, _42, _43, _44; +} D3DMATRIX, *LPD3DMATRIX; + +typedef struct _D3DVIEWPORT { + DWORD dwSize; + DWORD dwX; + DWORD dwY; /* Top left */ + DWORD dwWidth; + DWORD dwHeight; /* Dimensions */ + D3DVALUE dvScaleX; /* Scale homogeneous to screen */ + D3DVALUE dvScaleY; /* Scale homogeneous to screen */ + D3DVALUE dvMaxX; /* Min/max homogeneous x coord */ + D3DVALUE dvMaxY; /* Min/max homogeneous y coord */ + D3DVALUE dvMinZ; + D3DVALUE dvMaxZ; /* Min/max homogeneous z coord */ +} D3DVIEWPORT, *LPD3DVIEWPORT; + +/* + * Values for clip fields. + */ +#define D3DCLIP_LEFT 0x00000001L +#define D3DCLIP_RIGHT 0x00000002L +#define D3DCLIP_TOP 0x00000004L +#define D3DCLIP_BOTTOM 0x00000008L +#define D3DCLIP_FRONT 0x00000010L +#define D3DCLIP_BACK 0x00000020L +#define D3DCLIP_GEN0 0x00000040L +#define D3DCLIP_GEN1 0x00000080L +#define D3DCLIP_GEN2 0x00000100L +#define D3DCLIP_GEN3 0x00000200L +#define D3DCLIP_GEN4 0x00000400L +#define D3DCLIP_GEN5 0x00000800L + +/* + * Values for d3d status. + */ +#define D3DSTATUS_CLIPUNIONLEFT D3DCLIP_LEFT +#define D3DSTATUS_CLIPUNIONRIGHT D3DCLIP_RIGHT +#define D3DSTATUS_CLIPUNIONTOP D3DCLIP_TOP +#define D3DSTATUS_CLIPUNIONBOTTOM D3DCLIP_BOTTOM +#define D3DSTATUS_CLIPUNIONFRONT D3DCLIP_FRONT +#define D3DSTATUS_CLIPUNIONBACK D3DCLIP_BACK +#define D3DSTATUS_CLIPUNIONGEN0 D3DCLIP_GEN0 +#define D3DSTATUS_CLIPUNIONGEN1 D3DCLIP_GEN1 +#define D3DSTATUS_CLIPUNIONGEN2 D3DCLIP_GEN2 +#define D3DSTATUS_CLIPUNIONGEN3 D3DCLIP_GEN3 +#define D3DSTATUS_CLIPUNIONGEN4 D3DCLIP_GEN4 +#define D3DSTATUS_CLIPUNIONGEN5 D3DCLIP_GEN5 + +#define D3DSTATUS_CLIPINTERSECTIONLEFT 0x00001000L +#define D3DSTATUS_CLIPINTERSECTIONRIGHT 0x00002000L +#define D3DSTATUS_CLIPINTERSECTIONTOP 0x00004000L +#define D3DSTATUS_CLIPINTERSECTIONBOTTOM 0x00008000L +#define D3DSTATUS_CLIPINTERSECTIONFRONT 0x00010000L +#define D3DSTATUS_CLIPINTERSECTIONBACK 0x00020000L +#define D3DSTATUS_CLIPINTERSECTIONGEN0 0x00040000L +#define D3DSTATUS_CLIPINTERSECTIONGEN1 0x00080000L +#define D3DSTATUS_CLIPINTERSECTIONGEN2 0x00100000L +#define D3DSTATUS_CLIPINTERSECTIONGEN3 0x00200000L +#define D3DSTATUS_CLIPINTERSECTIONGEN4 0x00400000L +#define D3DSTATUS_CLIPINTERSECTIONGEN5 0x00800000L +#define D3DSTATUS_ZNOTVISIBLE 0x01000000L + +#define D3DSTATUS_CLIPUNIONALL ( \ + D3DSTATUS_CLIPUNIONLEFT | \ + D3DSTATUS_CLIPUNIONRIGHT | \ + D3DSTATUS_CLIPUNIONTOP | \ + D3DSTATUS_CLIPUNIONBOTTOM | \ + D3DSTATUS_CLIPUNIONFRONT | \ + D3DSTATUS_CLIPUNIONBACK | \ + D3DSTATUS_CLIPUNIONGEN0 | \ + D3DSTATUS_CLIPUNIONGEN1 | \ + D3DSTATUS_CLIPUNIONGEN2 | \ + D3DSTATUS_CLIPUNIONGEN3 | \ + D3DSTATUS_CLIPUNIONGEN4 | \ + D3DSTATUS_CLIPUNIONGEN5 \ + ) + +#define D3DSTATUS_CLIPINTERSECTIONALL ( \ + D3DSTATUS_CLIPINTERSECTIONLEFT | \ + D3DSTATUS_CLIPINTERSECTIONRIGHT | \ + D3DSTATUS_CLIPINTERSECTIONTOP | \ + D3DSTATUS_CLIPINTERSECTIONBOTTOM | \ + D3DSTATUS_CLIPINTERSECTIONFRONT | \ + D3DSTATUS_CLIPINTERSECTIONBACK | \ + D3DSTATUS_CLIPINTERSECTIONGEN0 | \ + D3DSTATUS_CLIPINTERSECTIONGEN1 | \ + D3DSTATUS_CLIPINTERSECTIONGEN2 | \ + D3DSTATUS_CLIPINTERSECTIONGEN3 | \ + D3DSTATUS_CLIPINTERSECTIONGEN4 | \ + D3DSTATUS_CLIPINTERSECTIONGEN5 \ + ) + +#define D3DSTATUS_DEFAULT ( \ + D3DSTATUS_CLIPINTERSECTIONALL | \ + D3DSTATUS_ZNOTVISIBLE) + + +/* + * Options for direct transform calls + */ +#define D3DTRANSFORM_CLIPPED 0x00000001l +#define D3DTRANSFORM_UNCLIPPED 0x00000002l + +typedef struct _D3DTRANSFORMDATA { + DWORD dwSize; + LPVOID lpIn; /* Input vertices */ + DWORD dwInSize; /* Stride of input vertices */ + LPVOID lpOut; /* Output vertices */ + DWORD dwOutSize; /* Stride of output vertices */ + LPD3DHVERTEX lpHOut; /* Output homogeneous vertices */ + DWORD dwClip; /* Clipping hint */ + DWORD dwClipIntersection; + DWORD dwClipUnion; /* Union of all clip flags */ + D3DRECT drExtent; /* Extent of transformed vertices */ +} D3DTRANSFORMDATA, *LPD3DTRANSFORMDATA; + +/* + * Structure defining position and direction properties for lighting. + */ +typedef struct _D3DLIGHTINGELEMENT { + D3DVECTOR dvPosition; /* Lightable point in model space */ + D3DVECTOR dvNormal; /* Normalised unit vector */ +} D3DLIGHTINGELEMENT, *LPD3DLIGHTINGELEMENT; + +/* + * Structure defining material properties for lighting. + */ +typedef struct _D3DMATERIAL { + DWORD dwSize; + union { + D3DCOLORVALUE diffuse; /* Diffuse color RGBA */ + D3DCOLORVALUE dcvDiffuse; + }; + union { + D3DCOLORVALUE ambient; /* Ambient color RGB */ + D3DCOLORVALUE dcvAmbient; + }; + union { + D3DCOLORVALUE specular; /* Specular 'shininess' */ + D3DCOLORVALUE dcvSpecular; + }; + union { + D3DCOLORVALUE emissive; /* Emissive color RGB */ + D3DCOLORVALUE dcvEmissive; + }; + union { + D3DVALUE power; /* Sharpness if specular highlight */ + D3DVALUE dvPower; + }; + D3DTEXTUREHANDLE hTexture; /* Handle to texture map */ + DWORD dwRampSize; +} D3DMATERIAL, *LPD3DMATERIAL; + +typedef enum _D3DLIGHTTYPE { + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3, + D3DLIGHT_PARALLELPOINT = 4, + D3DLIGHT_GLSPOT = 5, +} D3DLIGHTTYPE; + +/* + * Structure defining a light source and its properties. + */ +typedef struct _D3DLIGHT { + DWORD dwSize; + D3DLIGHTTYPE dltType; /* Type of light source */ + D3DCOLORVALUE dcvColor; /* Color of light */ + D3DVECTOR dvPosition; /* Position in world space */ + D3DVECTOR dvDirection; /* Direction in world space */ + D3DVALUE dvRange; /* Cutoff range */ + D3DVALUE dvFalloff; /* Falloff */ + D3DVALUE dvAttenuation0; /* Constant attenuation */ + D3DVALUE dvAttenuation1; /* Linear attenuation */ + D3DVALUE dvAttenuation2; /* Quadratic attenuation */ + D3DVALUE dvTheta; /* Inner angle of spotlight cone */ + D3DVALUE dvPhi; /* Outer angle of spotlight cone */ +} D3DLIGHT, *LPD3DLIGHT; + +typedef struct _D3DLIGHTDATA { + DWORD dwSize; + LPD3DLIGHTINGELEMENT lpIn; /* Input positions and normals */ + DWORD dwInSize; /* Stride of input elements */ + LPD3DTLVERTEX lpOut; /* Output colors */ + DWORD dwOutSize; /* Stride of output colors */ +} D3DLIGHTDATA, *LPD3DLIGHTDATA; + +typedef enum _D3DCOLORMODEL { + D3DCOLOR_MONO = 1, + D3DCOLOR_RGB = 2, +} D3DCOLORMODEL; + +/* + * Options for clearing + */ +#define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */ +#define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */ + +/* + * Execute buffers are allocated via Direct3D. These buffers may then + * be filled by the application with instructions to execute along with + * vertex data. + */ + +/* + * Supported op codes for execute instructions. + */ +typedef enum _D3DOPCODE { + D3DOP_POINT = 1, + D3DOP_LINE = 2, + D3DOP_TRIANGLE = 3, + D3DOP_MATRIXLOAD = 4, + D3DOP_MATRIXMULTIPLY = 5, + D3DOP_STATETRANSFORM = 6, + D3DOP_STATELIGHT = 7, + D3DOP_STATERENDER = 8, + D3DOP_PROCESSVERTICES = 9, + D3DOP_TEXTURELOAD = 10, + D3DOP_EXIT = 11, + D3DOP_BRANCHFORWARD = 12, + D3DOP_SPAN = 13, + D3DOP_SETSTATUS = 14, +} D3DOPCODE; + +typedef struct _D3DINSTRUCTION { + BYTE bOpcode; /* Instruction opcode */ + BYTE bSize; /* Size of each instruction data unit */ + WORD wCount; /* Count of instruction data units to follow */ +} D3DINSTRUCTION, *LPD3DINSTRUCTION; + +/* + * Structure for texture loads + */ +typedef struct _D3DTEXTURELOAD { + D3DTEXTUREHANDLE hDestTexture; + D3DTEXTUREHANDLE hSrcTexture; +} D3DTEXTURELOAD, *LPD3DTEXTURELOAD; + +/* + * Structure for picking + */ +typedef struct _D3DPICKRECORD { + BYTE bOpcode; + BYTE bPad; + DWORD dwOffset; + D3DVALUE dvZ; +} D3DPICKRECORD, *LPD3DPICKRECORD; + +/* + * The following defines the rendering states which can be set in the + * execute buffer. + */ + +typedef enum _D3DSHADEMODE { + D3DSHADE_FLAT = 1, + D3DSHADE_GOURAUD = 2, + D3DSHADE_PHONG = 3, +} D3DSHADEMODE; + +typedef enum _D3DFILLMODE { + D3DFILL_POINT = 1, + D3DFILL_WIREFRAME = 2, + D3DFILL_SOLID = 3, +} D3DFILLMODE; + +typedef struct _D3DLINEPATTERN { + WORD wRepeatFactor; + WORD wLinePattern; +} D3DLINEPATTERN; + +typedef enum _D3DTEXTUREFILTER { + D3DFILTER_NEAREST = 1, + D3DFILTER_LINEAR = 2, + D3DFILTER_MIPNEAREST = 3, + D3DFILTER_MIPLINEAR = 4, + D3DFILTER_LINEARMIPNEAREST = 5, + D3DFILTER_LINEARMIPLINEAR = 6, +} D3DTEXTUREFILTER; + +typedef enum _D3DBLEND { + D3DBLEND_ZERO = 1, + D3DBLEND_ONE = 2, + D3DBLEND_SRCCOLOR = 3, + D3DBLEND_INVSRCCOLOR = 4, + D3DBLEND_SRCALPHA = 5, + D3DBLEND_INVSRCALPHA = 6, + D3DBLEND_DESTALPHA = 7, + D3DBLEND_INVDESTALPHA = 8, + D3DBLEND_DESTCOLOR = 9, + D3DBLEND_INVDESTCOLOR = 10, + D3DBLEND_SRCALPHASAT = 11, + D3DBLEND_BOTHSRCALPHA = 12, + D3DBLEND_BOTHINVSRCALPHA = 13, +} D3DBLEND; + +typedef enum _D3DTEXTUREBLEND { + D3DTBLEND_DECAL = 1, + D3DTBLEND_MODULATE = 2, + D3DTBLEND_DECALALPHA = 3, + D3DTBLEND_MODULATEALPHA = 4, + D3DTBLEND_DECALMASK = 5, + D3DTBLEND_MODULATEMASK = 6, + D3DTBLEND_COPY = 7, +} D3DTEXTUREBLEND; + +typedef enum _D3DTEXTUREADDRESS { + D3DTADDRESS_WRAP = 1, + D3DTADDRESS_MIRROR = 2, + D3DTADDRESS_CLAMP = 3, +} D3DTEXTUREADDRESS; + +typedef enum _D3DCULL { + D3DCULL_NONE = 1, + D3DCULL_CW = 2, + D3DCULL_CCW = 3, +} D3DCULL; + +typedef enum _D3DCMPFUNC { + D3DCMP_NEVER = 1, + D3DCMP_LESS = 2, + D3DCMP_EQUAL = 3, + D3DCMP_LESSEQUAL = 4, + D3DCMP_GREATER = 5, + D3DCMP_NOTEQUAL = 6, + D3DCMP_GREATEREQUAL = 7, + D3DCMP_ALWAYS = 8, +} D3DCMPFUNC; + +typedef enum _D3DFOGMODE { + D3DFOG_NONE = 0, + D3DFOG_EXP = 1, + D3DFOG_EXP2 = 2, + D3DFOG_LINEAR = 3 +} D3DFOGMODE; + +/* + * Amount to add to a state to generate the override for that state. + */ +#define D3DSTATE_OVERRIDE_BIAS 256 + +/* + * A state which sets the override flag for the specified state type. + */ +#define D3DSTATE_OVERRIDE(type) ((DWORD) (type) + D3DSTATE_OVERRIDE_BIAS) + +typedef enum _D3DTRANSFORMSTATETYPE { + D3DTRANSFORMSTATE_WORLD = 1, + D3DTRANSFORMSTATE_VIEW = 2, + D3DTRANSFORMSTATE_PROJECTION = 3, +} D3DTRANSFORMSTATETYPE; + +typedef enum _D3DLIGHTSTATETYPE { + D3DLIGHTSTATE_MATERIAL = 1, + D3DLIGHTSTATE_AMBIENT = 2, + D3DLIGHTSTATE_COLORMODEL = 3, + D3DLIGHTSTATE_FOGMODE = 4, + D3DLIGHTSTATE_FOGSTART = 5, + D3DLIGHTSTATE_FOGEND = 6, + D3DLIGHTSTATE_FOGDENSITY = 7, +} D3DLIGHTSTATETYPE; + +typedef enum _D3DRENDERSTATETYPE { + D3DRENDERSTATE_TEXTUREHANDLE = 1, /* Texture handle */ + D3DRENDERSTATE_ANTIALIAS = 2, /* Antialiasing prim edges */ + D3DRENDERSTATE_TEXTUREADDRESS = 3, /* D3DTEXTUREADDRESS */ + D3DRENDERSTATE_TEXTUREPERSPECTIVE = 4, /* TRUE for perspective correction */ + D3DRENDERSTATE_WRAPU = 5, /* TRUE for wrapping in u */ + D3DRENDERSTATE_WRAPV = 6, /* TRUE for wrapping in v */ + D3DRENDERSTATE_ZENABLE = 7, /* TRUE to enable z test */ + D3DRENDERSTATE_FILLMODE = 8, /* D3DFILL_MODE */ + D3DRENDERSTATE_SHADEMODE = 9, /* D3DSHADEMODE */ + D3DRENDERSTATE_LINEPATTERN = 10, /* D3DLINEPATTERN */ + D3DRENDERSTATE_MONOENABLE = 11, /* TRUE to enable mono rasterization */ + D3DRENDERSTATE_ROP2 = 12, /* ROP2 */ + D3DRENDERSTATE_PLANEMASK = 13, /* DWORD physical plane mask */ + D3DRENDERSTATE_ZWRITEENABLE = 14, /* TRUE to enable z writes */ + D3DRENDERSTATE_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */ + D3DRENDERSTATE_LASTPIXEL = 16, /* TRUE for last-pixel on lines */ + D3DRENDERSTATE_TEXTUREMAG = 17, /* D3DTEXTUREFILTER */ + D3DRENDERSTATE_TEXTUREMIN = 18, /* D3DTEXTUREFILTER */ + D3DRENDERSTATE_SRCBLEND = 19, /* D3DBLEND */ + D3DRENDERSTATE_DESTBLEND = 20, /* D3DBLEND */ + D3DRENDERSTATE_TEXTUREMAPBLEND = 21, /* D3DTEXTUREBLEND */ + D3DRENDERSTATE_CULLMODE = 22, /* D3DCULL */ + D3DRENDERSTATE_ZFUNC = 23, /* D3DCMPFUNC */ + D3DRENDERSTATE_ALPHAREF = 24, /* D3DFIXED */ + D3DRENDERSTATE_ALPHAFUNC = 25, /* D3DCMPFUNC */ + D3DRENDERSTATE_DITHERENABLE = 26, /* TRUE to enable dithering */ + D3DRENDERSTATE_BLENDENABLE = 27, /* TRUE to enable alpha blending */ + D3DRENDERSTATE_FOGENABLE = 28, /* TRUE to enable fog */ + D3DRENDERSTATE_SPECULARENABLE = 29, /* TRUE to enable specular */ + D3DRENDERSTATE_ZVISIBLE = 30, /* TRUE to enable z checking */ + D3DRENDERSTATE_SUBPIXEL = 31, /* TRUE to enable subpixel correction */ + D3DRENDERSTATE_SUBPIXELX = 32, /* TRUE to enable correction in X only */ + D3DRENDERSTATE_STIPPLEDALPHA = 33, /* TRUE to enable stippled alpha */ + D3DRENDERSTATE_FOGCOLOR = 34, /* D3DCOLOR */ + D3DRENDERSTATE_FOGTABLEMODE = 35, /* D3DFOGMODE */ + D3DRENDERSTATE_FOGTABLESTART = 36, /* Fog table start */ + D3DRENDERSTATE_FOGTABLEEND = 37, /* Fog table end */ + D3DRENDERSTATE_FOGTABLEDENSITY = 38, /* Fog table density */ + D3DRENDERSTATE_STIPPLEENABLE = 39, /* TRUE to enable stippling */ + D3DRENDERSTATE_STIPPLEPATTERN00 = 64, /* Stipple pattern 01... */ + D3DRENDERSTATE_STIPPLEPATTERN01 = 65, + D3DRENDERSTATE_STIPPLEPATTERN02 = 66, + D3DRENDERSTATE_STIPPLEPATTERN03 = 67, + D3DRENDERSTATE_STIPPLEPATTERN04 = 68, + D3DRENDERSTATE_STIPPLEPATTERN05 = 69, + D3DRENDERSTATE_STIPPLEPATTERN06 = 70, + D3DRENDERSTATE_STIPPLEPATTERN07 = 71, + D3DRENDERSTATE_STIPPLEPATTERN08 = 72, + D3DRENDERSTATE_STIPPLEPATTERN09 = 73, + D3DRENDERSTATE_STIPPLEPATTERN10 = 74, + D3DRENDERSTATE_STIPPLEPATTERN11 = 75, + D3DRENDERSTATE_STIPPLEPATTERN12 = 76, + D3DRENDERSTATE_STIPPLEPATTERN13 = 77, + D3DRENDERSTATE_STIPPLEPATTERN14 = 78, + D3DRENDERSTATE_STIPPLEPATTERN15 = 79, + D3DRENDERSTATE_STIPPLEPATTERN16 = 80, + D3DRENDERSTATE_STIPPLEPATTERN17 = 81, + D3DRENDERSTATE_STIPPLEPATTERN18 = 82, + D3DRENDERSTATE_STIPPLEPATTERN19 = 83, + D3DRENDERSTATE_STIPPLEPATTERN20 = 84, + D3DRENDERSTATE_STIPPLEPATTERN21 = 85, + D3DRENDERSTATE_STIPPLEPATTERN22 = 86, + D3DRENDERSTATE_STIPPLEPATTERN23 = 87, + D3DRENDERSTATE_STIPPLEPATTERN24 = 88, + D3DRENDERSTATE_STIPPLEPATTERN25 = 89, + D3DRENDERSTATE_STIPPLEPATTERN26 = 90, + D3DRENDERSTATE_STIPPLEPATTERN27 = 91, + D3DRENDERSTATE_STIPPLEPATTERN28 = 92, + D3DRENDERSTATE_STIPPLEPATTERN29 = 93, + D3DRENDERSTATE_STIPPLEPATTERN30 = 94, + D3DRENDERSTATE_STIPPLEPATTERN31 = 95, +} D3DRENDERSTATETYPE; + +#define D3DRENDERSTATE_STIPPLEPATTERN(y) (D3DRENDERSTATE_STIPPLEPATTERN00 + (y)) + +typedef struct _D3DSTATE { + union { + D3DTRANSFORMSTATETYPE dtstTransformStateType; + D3DLIGHTSTATETYPE dlstLightStateType; + D3DRENDERSTATETYPE drstRenderStateType; + }; + union { + DWORD dwArg[1]; + D3DVALUE dvArg[1]; + }; +} D3DSTATE, *LPD3DSTATE; + +/* + * Operation used to load matrices + * hDstMat = hSrcMat + */ +typedef struct _D3DMATRIXLOAD { + D3DMATRIXHANDLE hDestMatrix; /* Destination matrix */ + D3DMATRIXHANDLE hSrcMatrix; /* Source matrix */ +} D3DMATRIXLOAD, *LPD3DMATRIXLOAD; + +/* + * Operation used to multiply matrices + * hDstMat = hSrcMat1 * hSrcMat2 + */ +typedef struct _D3DMATRIXMULTIPLY { + D3DMATRIXHANDLE hDestMatrix; /* Destination matrix */ + D3DMATRIXHANDLE hSrcMatrix1; /* First source matrix */ + D3DMATRIXHANDLE hSrcMatrix2; /* Second source matrix */ +} D3DMATRIXMULTIPLY, *LPD3DMATRIXMULTIPLY; + +/* + * Operation used to transform and light vertices. + */ +typedef struct _D3DPROCESSVERTICES { + DWORD dwFlags; /* Do we transform or light or just copy? */ + WORD wStart; /* Index to first vertex in source */ + WORD wDest; /* Index to first vertex in local buffer */ + DWORD dwCount; /* Number of vertices to be processed */ + DWORD dwReserved; /* Must be zero */ +} D3DPROCESSVERTICES, *LPD3DPROCESSVERTICES; + +#define D3DPROCESSVERTICES_TRANSFORMLIGHT 0x00000000L +#define D3DPROCESSVERTICES_TRANSFORM 0x00000001L +#define D3DPROCESSVERTICES_COPY 0x00000002L +#define D3DPROCESSVERTICES_OPMASK 0x00000007L + +#define D3DPROCESSVERTICES_UPDATEEXTENTS 0x00000008L +#define D3DPROCESSVERTICES_NOCOLOR 0x00000010L + + +/* + * Triangle flags + */ + +/* + * Tri strip and fan flags. + * START loads all three vertices + * EVEN and ODD load just v3 with even or odd culling + * START_FLAT contains a count from 0 to 29 that allows the + * whole strip or fan to be culled in one hit. + * e.g. for a quad len = 1 + */ +#define D3DTRIFLAG_START 0x00000000L +#define D3DTRIFLAG_STARTFLAT(len) (len) /* 0 < len < 30 */ +#define D3DTRIFLAG_ODD 0x0000001eL +#define D3DTRIFLAG_EVEN 0x0000001fL + +/* + * Triangle edge flags + * enable edges for wireframe or antialiasing + */ +#define D3DTRIFLAG_EDGEENABLE1 0x00000100L /* v0-v1 edge */ +#define D3DTRIFLAG_EDGEENABLE2 0x00000200L /* v1-v2 edge */ +#define D3DTRIFLAG_EDGEENABLE3 0x00000400L /* v2-v0 edge */ +#define D3DTRIFLAG_EDGEENABLETRIANGLE \ + (D3DTRIFLAG_EDGEENABLE1 | D3DTRIFLAG_EDGEENABLE2 | D3DTRIFLAG_EDGEENABLE3) + +/* + * Primitive structures and related defines. Vertex offsets are to types + * D3DVERTEX, D3DLVERTEX, or D3DTLVERTEX. + */ + +/* + * Triangle list primitive structure + */ +typedef struct _D3DTRIANGLE { + union { + WORD v1; /* Vertex indices */ + WORD wV1; + }; + union { + WORD v2; + WORD wV2; + }; + union { + WORD v3; + WORD wV3; + }; + WORD wFlags; /* Edge (and other) flags */ +} D3DTRIANGLE, *LPD3DTRIANGLE; + +/* + * Line strip structure. + * The instruction count - 1 defines the number of line segments. + */ +typedef struct _D3DLINE { + union { + WORD v1; /* Vertex indices */ + WORD wV1; + }; + union { + WORD v2; + WORD wV2; + }; +} D3DLINE, *LPD3DLINE; + +/* + * Span structure + * Spans join a list of points with the same y value. + * If the y value changes, a new span is started. + */ +typedef struct _D3DSPAN { + WORD wCount; /* Number of spans */ + WORD wFirst; /* Index to first vertex */ +} D3DSPAN, *LPD3DSPAN; + +/* + * Point structure + */ +typedef struct _D3DPOINT { + WORD wCount; /* number of points */ + WORD wFirst; /* index to first vertex */ +} D3DPOINT, *LPD3DPOINT; + + +/* + * Forward branch structure. + * Mask is logically anded with the driver status mask + * if the result equals 'value', the branch is taken. + */ +typedef struct _D3DBRANCH { + DWORD dwMask; /* Bitmask against D3D status */ + DWORD dwValue; + BOOL bNegate; /* TRUE to negate comparison */ + DWORD dwOffset; /* How far to branch forward (0 for exit)*/ +} D3DBRANCH, *LPD3DBRANCH; + +/* + * Status used for set status instruction. + * The D3D status is initialised on device creation + * and is modified by all execute calls. + */ +typedef struct _D3DSTATUS { + DWORD dwFlags; /* Do we set extents or status */ + DWORD dwStatus; /* D3D status */ + D3DRECT drExtent; +} D3DSTATUS, *LPD3DSTATUS; + +#define D3DSETSTATUS_STATUS 0x00000001L +#define D3DSETSTATUS_EXTENTS 0x00000002L +#define D3DSETSTATUS_ALL (D3DSETSTATUS_STATUS | D3DSETSTATUS_EXTENTS) + +/* + * Statistics structure + */ +typedef struct _D3DSTATS { + DWORD dwSize; + DWORD dwTrianglesDrawn; + DWORD dwLinesDrawn; + DWORD dwPointsDrawn; + DWORD dwSpansDrawn; + DWORD dwVerticesProcessed; +} D3DSTATS, *LPD3DSTATS; + +/* + * Execute options. + * When calling using D3DEXECUTE_UNCLIPPED all the primitives + * inside the buffer must be contained within the viewport. + */ +#define D3DEXECUTE_CLIPPED 0x00000001l +#define D3DEXECUTE_UNCLIPPED 0x00000002l + +typedef struct _D3DEXECUTEDATA { + DWORD dwSize; + DWORD dwVertexOffset; + DWORD dwVertexCount; + DWORD dwInstructionOffset; + DWORD dwInstructionLength; + DWORD dwHVertexOffset; + D3DSTATUS dsStatus; /* Status after execute */ +} D3DEXECUTEDATA, *LPD3DEXECUTEDATA; + +/* + * Palette flags. + * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw. + */ +#define D3DPAL_FREE 0x00 /* Renderer may use this entry freely */ +#define D3DPAL_READONLY 0x40 /* Renderer may not set this entry */ +#define D3DPAL_RESERVED 0x80 /* Renderer may not use this entry */ + +#if defined(__cplusplus) +}; +#endif + +#pragma pack() + +#endif /* _D3DTYPES_H_ */ diff --git a/sdk/inc/ddraw.h b/sdk/inc/ddraw.h new file mode 100644 index 0000000..224181f --- /dev/null +++ b/sdk/inc/ddraw.h @@ -0,0 +1,3102 @@ +/*==========================================================================; + * + * Copyright (C) 1994-1996 Microsoft Corporation. All Rights Reserved. + * + * File: ddraw.h + * Content: DirectDraw include file + * + ***************************************************************************/ + +#ifndef __DDRAW_INCLUDED__ +#define __DDRAW_INCLUDED__ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#define COM_NO_WINDOWS_H +#include <objbase.h> +#else +#define IUnknown void +#define CO_E_NOTINITIALIZED 0x800401F0L +#endif + +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GUIDS used by DirectDraw objects + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +DEFINE_GUID( CLSID_DirectDraw, 0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 ); +DEFINE_GUID( CLSID_DirectDrawClipper, 0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 ); +DEFINE_GUID( IID_IDirectDraw, 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); +DEFINE_GUID( IID_IDirectDrawSurface, 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 ); + +DEFINE_GUID( IID_IDirectDrawPalette, 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); +DEFINE_GUID( IID_IDirectDrawClipper, 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); + +#endif + +/*============================================================================ + * + * DirectDraw Structures + * + * Various structures used to invoke DirectDraw. + * + *==========================================================================*/ + +struct IDirectDraw; +struct IDirectDrawSurface; +struct IDirectDrawPalette; +struct IDirectDrawClipper; + +typedef struct IDirectDraw FAR *LPDIRECTDRAW; +typedef struct IDirectDraw2 FAR *LPDIRECTDRAW2; +typedef struct IDirectDrawSurface FAR *LPDIRECTDRAWSURFACE; +typedef struct IDirectDrawSurface2 FAR *LPDIRECTDRAWSURFACE2; + +typedef struct IDirectDrawPalette FAR *LPDIRECTDRAWPALETTE; +typedef struct IDirectDrawClipper FAR *LPDIRECTDRAWCLIPPER; + +typedef struct _DDFXROP FAR *LPDDFXROP; +typedef struct _DDSURFACEDESC FAR *LPDDSURFACEDESC; + +/* + * API's + */ +#if (defined (WIN32) || defined( _WIN32 ) ) && !defined( _NO_COM ) +//#if defined( _WIN32 ) && !defined( _NO_ENUM ) + typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKA)(GUID FAR *, LPSTR, LPSTR, LPVOID); + typedef BOOL (FAR PASCAL * LPDDENUMCALLBACKW)(GUID FAR *, LPWSTR, LPWSTR, LPVOID); + extern HRESULT WINAPI DirectDrawEnumerateW( LPDDENUMCALLBACKW lpCallback, LPVOID lpContext ); + extern HRESULT WINAPI DirectDrawEnumerateA( LPDDENUMCALLBACKA lpCallback, LPVOID lpContext ); + #ifdef UNICODE + typedef LPDDENUMCALLBACKW LPDDENUMCALLBACK; + #define DirectDrawEnumerate DirectDrawEnumerateW + #else + typedef LPDDENUMCALLBACKA LPDDENUMCALLBACK; + #define DirectDrawEnumerate DirectDrawEnumerateA + #endif + extern HRESULT WINAPI DirectDrawCreate( GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter ); + extern HRESULT WINAPI DirectDrawCreateClipper( DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter ); + #ifdef WINNT + //This is the user-mode entry stub to the kernel mode procedure. + extern HRESULT NtDirectDrawCreate( GUID FAR *lpGUID, HANDLE *lplpDD, IUnknown FAR *pUnkOuter ); + #endif +#endif + +#define REGSTR_KEY_DDHW_DESCRIPTION "Description" +#define REGSTR_KEY_DDHW_DRIVERNAME "DriverName" +#define REGSTR_PATH_DDHW "Hardware\\DirectDrawDrivers" + +#define DDCREATE_HARDWAREONLY 0x00000001l +#define DDCREATE_EMULATIONONLY 0x00000002l + +#ifdef WINNT +typedef long HRESULT; +#endif + +//#ifndef WINNT +typedef HRESULT (FAR PASCAL * LPDDENUMMODESCALLBACK)(LPDDSURFACEDESC, LPVOID); +typedef HRESULT (FAR PASCAL * LPDDENUMSURFACESCALLBACK)(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID); +//#endif +/* + * DDCOLORKEY + */ +typedef struct _DDCOLORKEY +{ + DWORD dwColorSpaceLowValue; // low boundary of color space that is to + // be treated as Color Key, inclusive + DWORD dwColorSpaceHighValue; // high boundary of color space that is + // to be treated as Color Key, inclusive +} DDCOLORKEY; + +typedef DDCOLORKEY FAR* LPDDCOLORKEY; + +/* + * DDBLTFX + * Used to pass override information to the DIRECTDRAWSURFACE callback Blt. + */ +typedef struct _DDBLTFX +{ + DWORD dwSize; // size of structure + DWORD dwDDFX; // FX operations + DWORD dwROP; // Win32 raster operations + DWORD dwDDROP; // Raster operations new for DirectDraw + DWORD dwRotationAngle; // Rotation angle for blt + DWORD dwZBufferOpCode; // ZBuffer compares + DWORD dwZBufferLow; // Low limit of Z buffer + DWORD dwZBufferHigh; // High limit of Z buffer + DWORD dwZBufferBaseDest; // Destination base value + DWORD dwZDestConstBitDepth; // Bit depth used to specify Z constant for destination + union + { + DWORD dwZDestConst; // Constant to use as Z buffer for dest + LPDIRECTDRAWSURFACE lpDDSZBufferDest; // Surface to use as Z buffer for dest + }; + DWORD dwZSrcConstBitDepth; // Bit depth used to specify Z constant for source + union + { + DWORD dwZSrcConst; // Constant to use as Z buffer for src + LPDIRECTDRAWSURFACE lpDDSZBufferSrc; // Surface to use as Z buffer for src + }; + DWORD dwAlphaEdgeBlendBitDepth; // Bit depth used to specify constant for alpha edge blend + DWORD dwAlphaEdgeBlend; // Alpha for edge blending + DWORD dwReserved; + DWORD dwAlphaDestConstBitDepth; // Bit depth used to specify alpha constant for destination + union + { + DWORD dwAlphaDestConst; // Constant to use as Alpha Channel + LPDIRECTDRAWSURFACE lpDDSAlphaDest; // Surface to use as Alpha Channel + }; + DWORD dwAlphaSrcConstBitDepth; // Bit depth used to specify alpha constant for source + union + { + DWORD dwAlphaSrcConst; // Constant to use as Alpha Channel + LPDIRECTDRAWSURFACE lpDDSAlphaSrc; // Surface to use as Alpha Channel + }; + union + { + DWORD dwFillColor; // color in RGB or Palettized + DWORD dwFillDepth; // depth value for z-buffer + LPDIRECTDRAWSURFACE lpDDSPattern; // Surface to use as pattern + }; + DDCOLORKEY ddckDestColorkey; // DestColorkey override + DDCOLORKEY ddckSrcColorkey; // SrcColorkey override +} DDBLTFX; + +typedef DDBLTFX FAR* LPDDBLTFX; + + +/* + * DDSCAPS + */ +typedef struct _DDSCAPS +{ + DWORD dwCaps; // capabilities of surface wanted +} DDSCAPS; + +typedef DDSCAPS FAR* LPDDSCAPS; + +/* + * DDCAPS + */ +#define DD_ROP_SPACE (256/32) // space required to store ROP array + +typedef struct _DDCAPS +{ + DWORD dwSize; // size of the DDDRIVERCAPS structure + DWORD dwCaps; // driver specific capabilities + DWORD dwCaps2; // more driver specific capabilites + DWORD dwCKeyCaps; // color key capabilities of the surface + DWORD dwFXCaps; // driver specific stretching and effects capabilites + DWORD dwFXAlphaCaps; // alpha driver specific capabilities + DWORD dwPalCaps; // palette capabilities + DWORD dwSVCaps; // stereo vision capabilities + DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 + DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 + DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 + DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 + DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 + DWORD dwVidMemTotal; // total amount of video memory + DWORD dwVidMemFree; // amount of free video memory + DWORD dwMaxVisibleOverlays; // maximum number of visible overlays + DWORD dwCurrVisibleOverlays; // current number of visible overlays + DWORD dwNumFourCCCodes; // number of four cc codes + DWORD dwAlignBoundarySrc; // source rectangle alignment + DWORD dwAlignSizeSrc; // source rectangle byte size + DWORD dwAlignBoundaryDest; // dest rectangle alignment + DWORD dwAlignSizeDest; // dest rectangle byte size + DWORD dwAlignStrideAlign; // stride alignment + DWORD dwRops[DD_ROP_SPACE]; // ROPS supported + DDSCAPS ddsCaps; // DDSCAPS structure has all the general capabilities + DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + DWORD dwReserved1; // reserved + DWORD dwReserved2; // reserved + DWORD dwReserved3; // reserved + DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts + DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts + DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts + DWORD dwSVBRops[DD_ROP_SPACE];// ROPS supported for System->Vmem blts + DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts + DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts + DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts + DWORD dwVSBRops[DD_ROP_SPACE];// ROPS supported for Vmem->System blts + DWORD dwSSBCaps; // driver specific capabilities for System->System blts + DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts + DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts + DWORD dwSSBRops[DD_ROP_SPACE];// ROPS supported for System->System blts + DWORD dwReserved4; // reserved + DWORD dwReserved5; // reserved + DWORD dwReserved6; // reserved +} DDCAPS; + +typedef DDCAPS FAR* LPDDCAPS; + + + +/* + * DDPIXELFORMAT + */ +typedef struct _DDPIXELFORMAT +{ + DWORD dwSize; // size of structure + DWORD dwFlags; // pixel format flags + DWORD dwFourCC; // (FOURCC code) + union + { + DWORD dwRGBBitCount; // how many bits per pixel + DWORD dwYUVBitCount; // how many bits per pixel + DWORD dwZBufferBitDepth; // how many bits for z buffers + DWORD dwAlphaBitDepth; // how many bits for alpha channels + }; + union + { + DWORD dwRBitMask; // mask for red bit + DWORD dwYBitMask; // mask for Y bits + }; + union + { + DWORD dwGBitMask; // mask for green bits + DWORD dwUBitMask; // mask for U bits + }; + union + { + DWORD dwBBitMask; // mask for blue bits + DWORD dwVBitMask; // mask for V bits + }; + union + { + DWORD dwRGBAlphaBitMask; // mask for alpha channel + DWORD dwYUVAlphaBitMask; // mask for alpha channel + }; +} DDPIXELFORMAT; + +typedef DDPIXELFORMAT FAR* LPDDPIXELFORMAT; + +/* + * DDOVERLAYFX + */ +typedef struct _DDOVERLAYFX +{ + DWORD dwSize; // size of structure + DWORD dwAlphaEdgeBlendBitDepth; // Bit depth used to specify constant for alpha edge blend + DWORD dwAlphaEdgeBlend; // Constant to use as alpha for edge blend + DWORD dwReserved; + DWORD dwAlphaDestConstBitDepth; // Bit depth used to specify alpha constant for destination + union + { + DWORD dwAlphaDestConst; // Constant to use as alpha channel for dest + LPDIRECTDRAWSURFACE lpDDSAlphaDest; // Surface to use as alpha channel for dest + }; + DWORD dwAlphaSrcConstBitDepth; // Bit depth used to specify alpha constant for source + union + { + DWORD dwAlphaSrcConst; // Constant to use as alpha channel for src + LPDIRECTDRAWSURFACE lpDDSAlphaSrc; // Surface to use as alpha channel for src + }; + DDCOLORKEY dckDestColorkey; // DestColorkey override + DDCOLORKEY dckSrcColorkey; // DestColorkey override + DWORD dwDDFX; // Overlay FX + DWORD dwFlags; // flags +} DDOVERLAYFX; + +typedef DDOVERLAYFX FAR *LPDDOVERLAYFX; + +/* + * DDBLTBATCH: BltBatch entry structure + */ +typedef struct _DDBLTBATCH +{ + LPRECT lprDest; + LPDIRECTDRAWSURFACE lpDDSSrc; + LPRECT lprSrc; + DWORD dwFlags; + LPDDBLTFX lpDDBltFx; +} DDBLTBATCH; + +typedef DDBLTBATCH FAR * LPDDBLTBATCH; + +/* + * callbacks + */ +typedef DWORD (FAR PASCAL *LPCLIPPERCALLBACK)(LPDIRECTDRAWCLIPPER lpDDClipper, HWND hWnd, DWORD code, LPVOID lpContext ); +#ifdef STREAMING +typedef DWORD (FAR PASCAL *LPSURFACESTREAMINGCALLBACK)(DWORD); +#endif + + +/* + * INTERACES FOLLOW: + * IDirectDraw + * IDirectDrawClipper + * IDirectDrawPalette + * IDirectDrawSurface + */ + +/* + * IDirectDraw + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDraw +DECLARE_INTERFACE_( IDirectDraw, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDraw methods ***/ + STDMETHOD(Compact)(THIS) PURE; + STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE; + STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR * ) PURE; + STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK ) PURE; + STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK ) PURE; + STDMETHOD(FlipToGDISurface)(THIS) PURE; + STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; + STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; + STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE FAR *) PURE; + STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; + STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; + STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; + STDMETHOD(RestoreDisplayMode)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; + STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD) PURE; + STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDraw_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDraw_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDraw_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDraw_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectDraw_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) +#define IDirectDraw_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) +#define IDirectDraw_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) +#define IDirectDraw_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) +#define IDirectDraw_EnumDisplayModes(p, a, b, c, d) (p)->lpVtbl->EnumDisplayModes(p, a, b, c, d) +#define IDirectDraw_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) +#define IDirectDraw_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) +#define IDirectDraw_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) +#define IDirectDraw_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) +#define IDirectDraw_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) +#define IDirectDraw_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) +#define IDirectDraw_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) +#define IDirectDraw_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) +#define IDirectDraw_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) +#define IDirectDraw_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirectDraw_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) +#define IDirectDraw_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) +#define IDirectDraw_SetDisplayMode(p, a, b, c) (p)->lpVtbl->SetDisplayMode(p, a, b, c) +#define IDirectDraw_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) +#endif + +#endif + +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDraw2 +DECLARE_INTERFACE_( IDirectDraw2, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDraw methods ***/ + STDMETHOD(Compact)(THIS) PURE; + STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE; + STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE; + STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE FAR * ) PURE; + STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK ) PURE; + STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK ) PURE; + STDMETHOD(FlipToGDISurface)(THIS) PURE; + STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; + STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; + STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE FAR *) PURE; + STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; + STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; + STDMETHOD(Initialize)(THIS_ GUID FAR *) PURE; + STDMETHOD(RestoreDisplayMode)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; + STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD, DWORD, DWORD) PURE; + STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS, LPDWORD, LPDWORD) PURE; +}; +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDraw2_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDraw2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDraw2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDraw2_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectDraw2_CreateClipper(p, a, b, c) (p)->lpVtbl->CreateClipper(p, a, b, c) +#define IDirectDraw2_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d) +#define IDirectDraw2_CreateSurface(p, a, b, c) (p)->lpVtbl->CreateSurface(p, a, b, c) +#define IDirectDraw2_DuplicateSurface(p, a, b) (p)->lpVtbl->DuplicateSurface(p, a, b) +#define IDirectDraw2_EnumDisplayModes(p, a, b, c, d) (p)->lpVtbl->EnumDisplayModes(p, a, b, c, d) +#define IDirectDraw2_EnumSurfaces(p, a, b, c, d) (p)->lpVtbl->EnumSurfaces(p, a, b, c, d) +#define IDirectDraw2_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) +#define IDirectDraw2_GetCaps(p, a, b) (p)->lpVtbl->GetCaps(p, a, b) +#define IDirectDraw2_GetDisplayMode(p, a) (p)->lpVtbl->GetDisplayMode(p, a) +#define IDirectDraw2_GetFourCCCodes(p, a, b) (p)->lpVtbl->GetFourCCCodes(p, a, b) +#define IDirectDraw2_GetGDISurface(p, a) (p)->lpVtbl->GetGDISurface(p, a) +#define IDirectDraw2_GetMonitorFrequency(p, a) (p)->lpVtbl->GetMonitorFrequency(p, a) +#define IDirectDraw2_GetScanLine(p, a) (p)->lpVtbl->GetScanLine(p, a) +#define IDirectDraw2_GetVerticalBlankStatus(p, a) (p)->lpVtbl->GetVerticalBlankStatus(p, a) +#define IDirectDraw2_Initialize(p, a) (p)->lpVtbl->Initialize(p, a) +#define IDirectDraw2_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) +#define IDirectDraw2_SetCooperativeLevel(p, a, b) (p)->lpVtbl->SetCooperativeLevel(p, a, b) +#define IDirectDraw2_SetDisplayMode(p, a, b, c, d, e) (p)->lpVtbl->SetDisplayMode(p, a, b, c, d, e) +#define IDirectDraw2_WaitForVerticalBlank(p, a, b) (p)->lpVtbl->WaitForVerticalBlank(p, a, b) +#define IDirectDraw2_GetAvailableVidMem(p, a, b, c) (p)->lpVtbl->GetAvailableVidMem(p, a, b, c) +#endif + +#endif + +/* + * IDirectDrawPalette + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawPalette +DECLARE_INTERFACE_( IDirectDrawPalette, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawPalette methods ***/ + STDMETHOD(GetCaps)(THIS_ LPDWORD) PURE; + STDMETHOD(GetEntries)(THIS_ DWORD,DWORD,DWORD,LPPALETTEENTRY) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD, LPPALETTEENTRY) PURE; + STDMETHOD(SetEntries)(THIS_ DWORD,DWORD,DWORD,LPPALETTEENTRY) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawPalette_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDrawPalette_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawPalette_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawPalette_GetCaps(p, a) (p)->lpVtbl->GetCaps(p, a) +#define IDirectDrawPalette_GetEntries(p, a, b, c, d) (p)->lpVtbl->GetEntries(p, a, b, c, d) +#define IDirectDrawPalette_Initialize(p, a, b, c) (p)->lpVtbl->Initialize(p, a, b, c) +#define IDirectDrawPalette_SetEntries(p, a, b, c, d) (p)->lpVtbl->SetEntries(p, a, b, c, d) +#endif + +#endif + +/* + * IDirectDrawClipper + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawClipper +DECLARE_INTERFACE_( IDirectDrawClipper, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawClipper methods ***/ + STDMETHOD(GetClipList)(THIS_ LPRECT, LPRGNDATA, LPDWORD) PURE; + STDMETHOD(GetHWnd)(THIS_ HWND FAR *) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, DWORD) PURE; + STDMETHOD(IsClipListChanged)(THIS_ BOOL FAR *) PURE; + STDMETHOD(SetClipList)(THIS_ LPRGNDATA,DWORD) PURE; + STDMETHOD(SetHWnd)(THIS_ DWORD, HWND ) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawClipper_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b) +#define IDirectDrawClipper_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawClipper_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawClipper_GetClipList(p, a, b, c) (p)->lpVtbl->GetClipList(p, a, b, c) +#define IDirectDrawClipper_GetHWnd(p, a) (p)->lpVtbl->GetHWnd(p, a) +#define IDirectDrawClipper_Initialize(p, a, b) (p)->lpVtbl->Initialize(p, a, b) +#define IDirectDrawClipper_IsClipListChanged(p, a) (p)->lpVtbl->IsClipListChanged(p, a) +#define IDirectDrawClipper_SetClipList(p, a, b) (p)->lpVtbl->SetClipList(p, a, b) +#define IDirectDrawClipper_SetHWnd(p, a, b) (p)->lpVtbl->SetHWnd(p, a, b) +#endif + +#endif + +/* + * IDirectDrawSurface and related interfaces + */ +#if defined( _WIN32 ) && !defined( _NO_COM ) +#undef INTERFACE +#define INTERFACE IDirectDrawSurface +DECLARE_INTERFACE_( IDirectDrawSurface, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPVOID) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawSurface_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) +#define IDirectDrawSurface_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#endif + +/* + * IDirectDrawSurface2 and related interfaces + */ +#undef INTERFACE +#define INTERFACE IDirectDrawSurface2 +DECLARE_INTERFACE_( IDirectDrawSurface2, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectDrawSurface methods ***/ + STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE2) PURE; + STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT) PURE; + STDMETHOD(Blt)(THIS_ LPRECT,LPDIRECTDRAWSURFACE2, LPRECT,DWORD, LPDDBLTFX) PURE; + STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH, DWORD, DWORD ) PURE; + STDMETHOD(BltFast)(THIS_ DWORD,DWORD,LPDIRECTDRAWSURFACE2, LPRECT,DWORD) PURE; + STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD,LPDIRECTDRAWSURFACE2) PURE; + STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) PURE; + STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE2, DWORD) PURE; + STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS, LPDIRECTDRAWSURFACE2 FAR *) PURE; + STDMETHOD(GetBltStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetCaps)(THIS_ LPDDSCAPS) PURE; + STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER FAR*) PURE; + STDMETHOD(GetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(GetDC)(THIS_ HDC FAR *) PURE; + STDMETHOD(GetFlipStatus)(THIS_ DWORD) PURE; + STDMETHOD(GetOverlayPosition)(THIS_ LPLONG, LPLONG ) PURE; + STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE FAR*) PURE; + STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT) PURE; + STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC) PURE; + STDMETHOD(IsLost)(THIS) PURE; + STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC,DWORD,HANDLE) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC) PURE; + STDMETHOD(Restore)(THIS) PURE; + STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE; + STDMETHOD(SetColorKey)(THIS_ DWORD, LPDDCOLORKEY) PURE; + STDMETHOD(SetOverlayPosition)(THIS_ LONG, LONG ) PURE; + STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE) PURE; + STDMETHOD(Unlock)(THIS_ LPVOID) PURE; + STDMETHOD(UpdateOverlay)(THIS_ LPRECT, LPDIRECTDRAWSURFACE2,LPRECT,DWORD, LPDDOVERLAYFX) PURE; + STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD) PURE; + STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD, LPDIRECTDRAWSURFACE2) PURE; + /*** Added in the v2 interface ***/ + STDMETHOD(GetDDInterface)(THIS_ LPVOID FAR *) PURE; + STDMETHOD(PageLock)(THIS_ DWORD) PURE; + STDMETHOD(PageUnlock)(THIS_ DWORD) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectDrawSurface2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectDrawSurface2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectDrawSurface2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectDrawSurface2_AddAttachedSurface(p,a) (p)->lpVtbl->AddAttachedSurface(p,a) +#define IDirectDrawSurface2_AddOverlayDirtyRect(p,a) (p)->lpVtbl->AddOverlayDirtyRect(p,a) +#define IDirectDrawSurface2_Blt(p,a,b,c,d,e) (p)->lpVtbl->Blt(p,a,b,c,d,e) +#define IDirectDrawSurface2_BltBatch(p,a,b,c) (p)->lpVtbl->BltBatch(p,a,b,c) +#define IDirectDrawSurface2_BltFast(p,a,b,c,d,e) (p)->lpVtbl->BltFast(p,a,b,c,d,e) +#define IDirectDrawSurface2_DeleteAttachedSurface(p,a,b) (p)->lpVtbl->DeleteAttachedSurface(p,a,b) +#define IDirectDrawSurface2_EnumAttachedSurfaces(p,a,b) (p)->lpVtbl->EnumAttachedSurfaces(p,a,b) +#define IDirectDrawSurface2_EnumOverlayZOrders(p,a,b,c) (p)->lpVtbl->EnumOverlayZOrders(p,a,b,c) +#define IDirectDrawSurface2_Flip(p,a,b) (p)->lpVtbl->Flip(p,a,b) +#define IDirectDrawSurface2_GetAttachedSurface(p,a,b) (p)->lpVtbl->GetAttachedSurface(p,a,b) +#define IDirectDrawSurface2_GetBltStatus(p,a) (p)->lpVtbl->GetBltStatus(p,a) +#define IDirectDrawSurface2_GetCaps(p,b) (p)->lpVtbl->GetCaps(p,b) +#define IDirectDrawSurface2_GetClipper(p,a) (p)->lpVtbl->GetClipper(p,a) +#define IDirectDrawSurface2_GetColorKey(p,a,b) (p)->lpVtbl->GetColorKey(p,a,b) +#define IDirectDrawSurface2_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirectDrawSurface2_GetFlipStatus(p,a) (p)->lpVtbl->GetFlipStatus(p,a) +#define IDirectDrawSurface2_GetOverlayPosition(p,a,b) (p)->lpVtbl->GetOverlayPosition(p,a,b) +#define IDirectDrawSurface2_GetPalette(p,a) (p)->lpVtbl->GetPalette(p,a) +#define IDirectDrawSurface2_GetPixelFormat(p,a) (p)->lpVtbl->GetPixelFormat(p,a) +#define IDirectDrawSurface2_GetSurfaceDesc(p,a) (p)->lpVtbl->GetSurfaceDesc(p,a) +#define IDirectDrawSurface2_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectDrawSurface2_IsLost(p) (p)->lpVtbl->IsLost(p) +#define IDirectDrawSurface2_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirectDrawSurface2_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#define IDirectDrawSurface2_Restore(p) (p)->lpVtbl->Restore(p) +#define IDirectDrawSurface2_SetClipper(p,a) (p)->lpVtbl->SetClipper(p,a) +#define IDirectDrawSurface2_SetColorKey(p,a,b) (p)->lpVtbl->SetColorKey(p,a,b) +#define IDirectDrawSurface2_SetOverlayPosition(p,a,b) (p)->lpVtbl->SetOverlayPosition(p,a,b) +#define IDirectDrawSurface2_SetPalette(p,a) (p)->lpVtbl->SetPalette(p,a) +#define IDirectDrawSurface2_Unlock(p,b) (p)->lpVtbl->Unlock(p,b) +#define IDirectDrawSurface2_UpdateOverlay(p,a,b,c,d,e) (p)->lpVtbl->UpdateOverlay(p,a,b,c,d,e) +#define IDirectDrawSurface2_UpdateOverlayDisplay(p,a) (p)->lpVtbl->UpdateOverlayDisplay(p,a) +#define IDirectDrawSurface2_UpdateOverlayZOrder(p,a,b) (p)->lpVtbl->UpdateOverlayZOrder(p,a,b) +#define IDirectDrawSurface2_GetDDInterface(p,a) (p)->lpVtbl->GetDDInterface(p,a) +#define IDirectDrawSurface2_PageLock(p,a) (p)->lpVtbl->PageLock(p,a) +#define IDirectDrawSurface2_PageUnlock(p,a) (p)->lpVtbl->PageUnlock(p,a) +#endif + + +#endif + + +/* + * DDSURFACEDESC + */ +typedef struct _DDSURFACEDESC +{ + DWORD dwSize; // size of the DDSURFACEDESC structure + DWORD dwFlags; // determines what fields are valid + DWORD dwHeight; // height of surface to be created + DWORD dwWidth; // width of input surface + LONG lPitch; // distance to start of next line (return value only) + DWORD dwBackBufferCount; // number of back buffers requested + union + { + DWORD dwMipMapCount; // number of mip-map levels requested + DWORD dwZBufferBitDepth; // depth of Z buffer requested + DWORD dwRefreshRate; // refresh rate (used when display mode is described) + }; + DWORD dwAlphaBitDepth; // depth of alpha buffer requested + DWORD dwReserved; // reserved + LPVOID lpSurface; // pointer to the associated surface memory + DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use + DDCOLORKEY ddckCKDestBlt; // color key for destination blt use + DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use + DDCOLORKEY ddckCKSrcBlt; // color key for source blt use + DDPIXELFORMAT ddpfPixelFormat; // pixel format description of the surface + DDSCAPS ddsCaps; // direct draw surface capabilities +} DDSURFACEDESC; + +/* + * ddsCaps field is valid. + */ +#define DDSD_CAPS 0x00000001l // default + +/* + * dwHeight field is valid. + */ +#define DDSD_HEIGHT 0x00000002l + +/* + * dwWidth field is valid. + */ +#define DDSD_WIDTH 0x00000004l + +/* + * lPitch is valid. + */ +#define DDSD_PITCH 0x00000008l + +/* + * dwBackBufferCount is valid. + */ +#define DDSD_BACKBUFFERCOUNT 0x00000020l + +/* + * dwZBufferBitDepth is valid. + */ +#define DDSD_ZBUFFERBITDEPTH 0x00000040l + +/* + * dwAlphaBitDepth is valid. + */ +#define DDSD_ALPHABITDEPTH 0x00000080l + + + +/* + * ddpfPixelFormat is valid. + */ +#define DDSD_PIXELFORMAT 0x00001000l + +/* + * ddckCKDestOverlay is valid. + */ +#define DDSD_CKDESTOVERLAY 0x00002000l + +/* + * ddckCKDestBlt is valid. + */ +#define DDSD_CKDESTBLT 0x00004000l + +/* + * ddckCKSrcOverlay is valid. + */ +#define DDSD_CKSRCOVERLAY 0x00008000l + +/* + * ddckCKSrcBlt is valid. + */ +#define DDSD_CKSRCBLT 0x00010000l + +/* + * dwMipMapCount is valid. + */ +#define DDSD_MIPMAPCOUNT 0x00020000l + + /* + * dwRefreshRate is valid + */ +#define DDSD_REFRESHRATE 0x00040000l + + +/* + * All input fields are valid. + */ +#define DDSD_ALL 0x0007f9eel + + +/*============================================================================ + * + * Direct Draw Capability Flags + * + * These flags are used to describe the capabilities of a given Surface. + * All flags are bit flags. + * + *==========================================================================*/ + +/**************************************************************************** + * + * DIRECTDRAWSURFACE CAPABILITY FLAGS + * + ****************************************************************************/ +/* + * This bit currently has no meaning. + */ +#define DDSCAPS_3D 0x00000001l + +/* + * Indicates that this surface contains alpha information. The pixel + * format must be interrogated to determine whether this surface + * contains only alpha information or alpha information interlaced + * with pixel color data (e.g. RGBA or YUVA). + */ +#define DDSCAPS_ALPHA 0x00000002l + +/* + * Indicates that this surface is a backbuffer. It is generally + * set by CreateSurface when the DDSCAPS_FLIP capability bit is set. + * It indicates that this surface is THE back buffer of a surface + * flipping structure. DirectDraw supports N surfaces in a + * surface flipping structure. Only the surface that immediately + * precedeces the DDSCAPS_FRONTBUFFER has this capability bit set. + * The other surfaces are identified as back buffers by the presence + * of the DDSCAPS_FLIP capability, their attachment order, and the + * absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER + * capabilities. The bit is sent to CreateSurface when a standalone + * back buffer is being created. This surface could be attached to + * a front buffer and/or back buffers to form a flipping surface + * structure after the CreateSurface call. See AddAttachments for + * a detailed description of the behaviors in this case. + */ +#define DDSCAPS_BACKBUFFER 0x00000004l + +/* + * Indicates a complex surface structure is being described. A + * complex surface structure results in the creation of more than + * one surface. The additional surfaces are attached to the root + * surface. The complex structure can only be destroyed by + * destroying the root. + */ +#define DDSCAPS_COMPLEX 0x00000008l + +/* + * Indicates that this surface is a part of a surface flipping structure. + * When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and + * DDSCAP_BACKBUFFER bits are not set. They are set by CreateSurface + * on the resulting creations. The dwBackBufferCount field in the + * DDSURFACEDESC structure must be set to at least 1 in order for + * the CreateSurface call to succeed. The DDSCAPS_COMPLEX capability + * must always be set with creating multiple surfaces through CreateSurface. + */ +#define DDSCAPS_FLIP 0x00000010l + +/* + * Indicates that this surface is THE front buffer of a surface flipping + * structure. It is generally set by CreateSurface when the DDSCAPS_FLIP + * capability bit is set. + * If this capability is sent to CreateSurface then a standalonw front buffer + * is created. This surface will not have the DDSCAPS_FLIP capability. + * It can be attached to other back buffers to form a flipping structure. + * See AddAttachments for a detailed description of the behaviors in this + * case. + */ +#define DDSCAPS_FRONTBUFFER 0x00000020l + +/* + * Indicates that this surface is any offscreen surface that is not an overlay, + * texture, zbuffer, front buffer, back buffer, or alpha surface. It is used + * to identify plain vanilla surfaces. + */ +#define DDSCAPS_OFFSCREENPLAIN 0x00000040l + +/* + * Indicates that this surface is an overlay. It may or may not be directly visible + * depending on whether or not it is currently being overlayed onto the primary + * surface. DDSCAPS_VISIBLE can be used to determine whether or not it is being + * overlayed at the moment. + */ +#define DDSCAPS_OVERLAY 0x00000080l + +/* + * Indicates that unique DirectDrawPalette objects can be created and + * attached to this surface. + */ +#define DDSCAPS_PALETTE 0x00000100l + +/* + * Indicates that this surface is the primary surface. The primary + * surface represents what the user is seeing at the moment. + */ +#define DDSCAPS_PRIMARYSURFACE 0x00000200l + +/* + * Indicates that this surface is the primary surface for the left eye. + * The primary surface for the left eye represents what the user is seeing + * at the moment with the users left eye. When this surface is created the + * DDSCAPS_PRIMARYSURFACE represents what the user is seeing with the users + * right eye. + */ +#define DDSCAPS_PRIMARYSURFACELEFT 0x00000400l + +/* + * Indicates that this surface memory was allocated in system memory + */ +#define DDSCAPS_SYSTEMMEMORY 0x00000800l + +/* + * Indicates that this surface can be used as a 3D texture. It does not + * indicate whether or not the surface is being used for that purpose. + */ +#define DDSCAPS_TEXTURE 0x00001000l + +/* + * Indicates that a surface may be a destination for 3D rendering. This + * bit must be set in order to query for a Direct3D Device Interface + * from this surface. + */ +#define DDSCAPS_3DDEVICE 0x00002000l + +/* + * Indicates that this surface exists in video memory. + */ +#define DDSCAPS_VIDEOMEMORY 0x00004000l + +/* + * Indicates that changes made to this surface are immediately visible. + * It is always set for the primary surface and is set for overlays while + * they are being overlayed and texture maps while they are being textured. + */ +#define DDSCAPS_VISIBLE 0x00008000l + +/* + * Indicates that only writes are permitted to the surface. Read accesses + * from the surface may or may not generate a protection fault, but the + * results of a read from this surface will not be meaningful. READ ONLY. + */ +#define DDSCAPS_WRITEONLY 0x00010000l + +/* + * Indicates that this surface is a z buffer. A z buffer does not contain + * displayable information. Instead it contains bit depth information that is + * used to determine which pixels are visible and which are obscured. + */ +#define DDSCAPS_ZBUFFER 0x00020000l + +/* + * Indicates surface will have a DC associated long term + */ +#define DDSCAPS_OWNDC 0x00040000l + +/* + * Indicates surface should be able to receive live video + */ +#define DDSCAPS_LIVEVIDEO 0x00080000l + +/* + * Indicates surface should be able to have a stream decompressed + * to it by the hardware. + */ +#define DDSCAPS_HWCODEC 0x00100000l + +/* + * Surface is a 320x200 or 320x240 ModeX surface + */ +#define DDSCAPS_MODEX 0x00200000l + +/* + * Indicates surface is one level of a mip-map. This surface will + * be attached to other DDSCAPS_MIPMAP surfaces to form the mip-map. + * This can be done explicitly, by creating a number of surfaces and + * attaching them with AddAttachedSurface or by implicitly by CreateSurface. + * If this bit is set then DDSCAPS_TEXTURE must also be set. + */ +#define DDSCAPS_MIPMAP 0x00400000l + + + +/* + * Indicates that memory for the surface is not allocated until the surface + * is loaded (via the Direct3D texture Load() function). + */ +#define DDSCAPS_ALLOCONLOAD 0x04000000l + + + + /**************************************************************************** + * + * DIRECTDRAW DRIVER CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * Display hardware has 3D acceleration. + */ +#define DDCAPS_3D 0x00000001l + +/* + * Indicates that DirectDraw will support only dest rectangles that are aligned + * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively. + * READ ONLY. + */ +#define DDCAPS_ALIGNBOUNDARYDEST 0x00000002l + +/* + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively. READ ONLY. + */ +#define DDCAPS_ALIGNSIZEDEST 0x00000004l +/* + * Indicates that DirectDraw will support only source rectangles that are aligned + * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively. + * READ ONLY. + */ +#define DDCAPS_ALIGNBOUNDARYSRC 0x00000008l + +/* + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively. READ ONLY. + */ +#define DDCAPS_ALIGNSIZESRC 0x00000010l + +/* + * Indicates that DirectDraw will create video memory surfaces that have a stride + * alignment equal to DIRECTDRAWCAPS.dwAlignStride. READ ONLY. + */ +#define DDCAPS_ALIGNSTRIDE 0x00000020l + +/* + * Display hardware is capable of blt operations. + */ +#define DDCAPS_BLT 0x00000040l + +/* + * Display hardware is capable of asynchronous blt operations. + */ +#define DDCAPS_BLTQUEUE 0x00000080l + +/* + * Display hardware is capable of color space conversions during the blt operation. + */ +#define DDCAPS_BLTFOURCC 0x00000100l + +/* + * Display hardware is capable of stretching during blt operations. + */ +#define DDCAPS_BLTSTRETCH 0x00000200l + +/* + * Display hardware is shared with GDI. + */ +#define DDCAPS_GDI 0x00000400l + +/* + * Display hardware can overlay. + */ +#define DDCAPS_OVERLAY 0x00000800l + +/* + * Set if display hardware supports overlays but can not clip them. + */ +#define DDCAPS_OVERLAYCANTCLIP 0x00001000l + +/* + * Indicates that overlay hardware is capable of color space conversions during + * the overlay operation. + */ +#define DDCAPS_OVERLAYFOURCC 0x00002000l + +/* + * Indicates that stretching can be done by the overlay hardware. + */ +#define DDCAPS_OVERLAYSTRETCH 0x00004000l + +/* + * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces + * other than the primary surface. + */ +#define DDCAPS_PALETTE 0x00008000l + +/* + * Indicates that palette changes can be syncd with the veritcal refresh. + */ +#define DDCAPS_PALETTEVSYNC 0x00010000l + +/* + * Display hardware can return the current scan line. + */ +#define DDCAPS_READSCANLINE 0x00020000l + +/* + * Display hardware has stereo vision capabilities. DDSCAPS_PRIMARYSURFACELEFT + * can be created. + */ +#define DDCAPS_STEREOVIEW 0x00040000l + +/* + * Display hardware is capable of generating a vertical blank interrupt. + */ +#define DDCAPS_VBI 0x00080000l + +/* + * Supports the use of z buffers with blt operations. + */ +#define DDCAPS_ZBLTS 0x00100000l + +/* + * Supports Z Ordering of overlays. + */ +#define DDCAPS_ZOVERLAYS 0x00200000l + +/* + * Supports color key + */ +#define DDCAPS_COLORKEY 0x00400000l + +/* + * Supports alpha surfaces + */ +#define DDCAPS_ALPHA 0x00800000l + +/* + * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set) + */ +#define DDCAPS_COLORKEYHWASSIST 0x01000000l + +/* + * no hardware support at all + */ +#define DDCAPS_NOHARDWARE 0x02000000l + +/* + * Display hardware is capable of color fill with bltter + */ +#define DDCAPS_BLTCOLORFILL 0x04000000l + +/* + * Display hardware is bank switched, and potentially very slow at + * random access to VRAM. + */ +#define DDCAPS_BANKSWITCHED 0x08000000l + +/* + * Display hardware is capable of depth filling Z-buffers with bltter + */ +#define DDCAPS_BLTDEPTHFILL 0x10000000l + +/* + * Display hardware is capable of clipping while bltting. + */ +#define DDCAPS_CANCLIP 0x20000000l + +/* + * Display hardware is capable of clipping while stretch bltting. + */ +#define DDCAPS_CANCLIPSTRETCHED 0x40000000l + +/* + * Display hardware is capable of bltting to or from system memory + */ +#define DDCAPS_CANBLTSYSMEM 0x80000000l + + + /**************************************************************************** + * + * MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2) + * + ****************************************************************************/ + +/* + * Display hardware is certified + */ +#define DDCAPS2_CERTIFIED 0x00000001l + +/* + * Driver cannot interleave 2D operations (lock and blt) to surfaces with + * Direct3D rendering operations between calls to BeginScene() and EndScene() + */ +#define DDCAPS2_NO2DDURING3DSCENE 0x00000002l + +/**************************************************************************** + * + * DIRECTDRAW FX ALPHA CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * Supports alpha blending around the edge of a source color keyed surface. + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHAEDGEBLEND 0x00000001l + +/* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value becomes + * more opaque as the alpha value increases. (0 is transparent.) + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHAPIXELS 0x00000002l + +/* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value + * becomes more transparent as the alpha value increases. (0 is opaque.) + * This flag can only be set if DDCAPS_ALPHA is set. + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHAPIXELSNEG 0x00000004l + +/* + * Supports alpha only surfaces. The bit depth of an alpha only surface can be + * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. + * (0 is transparent.) + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHASURFACES 0x00000008l + +/* + * The depth of the alpha channel data can range can be 1,2,4, or 8. + * The NEG suffix indicates that this alpha channel becomes more transparent + * as the alpha value increases. (0 is opaque.) This flag can only be set if + * DDCAPS_ALPHA is set. + * For Blt. + */ +#define DDFXALPHACAPS_BLTALPHASURFACESNEG 0x00000010l + +/* + * Supports alpha blending around the edge of a source color keyed surface. + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND 0x00000020l + +/* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value becomes + * more opaque as the alpha value increases. (0 is transparent.) + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHAPIXELS 0x00000040l + +/* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value + * becomes more transparent as the alpha value increases. (0 is opaque.) + * This flag can only be set if DDCAPS_ALPHA is set. + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG 0x00000080l + +/* + * Supports alpha only surfaces. The bit depth of an alpha only surface can be + * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. + * (0 is transparent.) + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHASURFACES 0x00000100l + +/* + * The depth of the alpha channel data can range can be 1,2,4, or 8. + * The NEG suffix indicates that this alpha channel becomes more transparent + * as the alpha value increases. (0 is opaque.) This flag can only be set if + * DDCAPS_ALPHA is set. + * For Overlays. + */ +#define DDFXALPHACAPS_OVERLAYALPHASURFACESNEG 0x00000200l + +/**************************************************************************** + * + * DIRECTDRAW FX CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * Uses arithmetic operations to stretch and shrink surfaces during blt + * rather than pixel doubling techniques. Along the Y axis. + */ +#define DDFXCAPS_BLTARITHSTRETCHY 0x00000020l + +/* + * Uses arithmetic operations to stretch during blt + * rather than pixel doubling techniques. Along the Y axis. Only + * works for x1, x2, etc. + */ +#define DDFXCAPS_BLTARITHSTRETCHYN 0x00000010l + +/* + * Supports mirroring left to right in blt. + */ +#define DDFXCAPS_BLTMIRRORLEFTRIGHT 0x00000040l + +/* + * Supports mirroring top to bottom in blt. + */ +#define DDFXCAPS_BLTMIRRORUPDOWN 0x00000080l + +/* + * Supports arbitrary rotation for blts. + */ +#define DDFXCAPS_BLTROTATION 0x00000100l + +/* + * Supports 90 degree rotations for blts. + */ +#define DDFXCAPS_BLTROTATION90 0x00000200l + +/* + * DirectDraw supports arbitrary shrinking of a surface along the + * x axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSHRINKX 0x00000400l + +/* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the x axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSHRINKXN 0x00000800l + +/* + * DirectDraw supports arbitrary shrinking of a surface along the + * y axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSHRINKY 0x00001000l + +/* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the y axis (vertical direction) for blts. + */ +#define DDFXCAPS_BLTSHRINKYN 0x00002000l + +/* + * DirectDraw supports arbitrary stretching of a surface along the + * x axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSTRETCHX 0x00004000l + +/* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the x axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSTRETCHXN 0x00008000l + +/* + * DirectDraw supports arbitrary stretching of a surface along the + * y axis (horizontal direction) for blts. + */ +#define DDFXCAPS_BLTSTRETCHY 0x00010000l + +/* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the y axis (vertical direction) for blts. + */ +#define DDFXCAPS_BLTSTRETCHYN 0x00020000l + +/* + * Uses arithmetic operations to stretch and shrink surfaces during + * overlay rather than pixel doubling techniques. Along the Y axis + * for overlays. + */ +#define DDFXCAPS_OVERLAYARITHSTRETCHY 0x00040000l + +/* + * Uses arithmetic operations to stretch surfaces during + * overlay rather than pixel doubling techniques. Along the Y axis + * for overlays. Only works for x1, x2, etc. + */ +#define DDFXCAPS_OVERLAYARITHSTRETCHYN 0x00000008l + +/* + * DirectDraw supports arbitrary shrinking of a surface along the + * x axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSHRINKX 0x00080000l + +/* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the x axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSHRINKXN 0x00100000l + +/* + * DirectDraw supports arbitrary shrinking of a surface along the + * y axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSHRINKY 0x00200000l + +/* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the y axis (vertical direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSHRINKYN 0x00400000l + +/* + * DirectDraw supports arbitrary stretching of a surface along the + * x axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSTRETCHX 0x00800000l + +/* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the x axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSTRETCHXN 0x01000000l + +/* + * DirectDraw supports arbitrary stretching of a surface along the + * y axis (horizontal direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSTRETCHY 0x02000000l + +/* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the y axis (vertical direction) for overlays. + */ +#define DDFXCAPS_OVERLAYSTRETCHYN 0x04000000l + +/* + * DirectDraw supports mirroring of overlays across the vertical axis + */ +#define DDFXCAPS_OVERLAYMIRRORLEFTRIGHT 0x08000000l + +/* + * DirectDraw supports mirroring of overlays across the horizontal axis + */ +#define DDFXCAPS_OVERLAYMIRRORUPDOWN 0x10000000l + +/**************************************************************************** + * + * DIRECTDRAW STEREO VIEW CAPABILITIES + * + ****************************************************************************/ + +/* + * The stereo view is accomplished via enigma encoding. + */ +#define DDSVCAPS_ENIGMA 0x00000001l + +/* + * The stereo view is accomplished via high frequency flickering. + */ +#define DDSVCAPS_FLICKER 0x00000002l + +/* + * The stereo view is accomplished via red and blue filters applied + * to the left and right eyes. All images must adapt their colorspaces + * for this process. + */ +#define DDSVCAPS_REDBLUE 0x00000004l + +/* + * The stereo view is accomplished with split screen technology. + */ +#define DDSVCAPS_SPLIT 0x00000008l + +/**************************************************************************** + * + * DIRECTDRAWPALETTE CAPABILITIES + * + ****************************************************************************/ + +/* + * Index is 4 bits. There are sixteen color entries in the palette table. + */ +#define DDPCAPS_4BIT 0x00000001l + +/* + * Index is onto a 8 bit color index. This field is only valid with the + * DDPCAPS_1BIT, DDPCAPS_2BIT or DDPCAPS_4BIT capability and the target + * surface is in 8bpp. Each color entry is one byte long and is an index + * into destination surface's 8bpp palette. + */ +#define DDPCAPS_8BITENTRIES 0x00000002l + +/* + * Index is 8 bits. There are 256 color entries in the palette table. + */ +#define DDPCAPS_8BIT 0x00000004l + +/* + * Indicates that this DIRECTDRAWPALETTE should use the palette color array + * passed into the lpDDColorArray parameter to initialize the DIRECTDRAWPALETTE + * object. + */ +#define DDPCAPS_INITIALIZE 0x00000008l + +/* + * This palette is the one attached to the primary surface. Changing this + * table has immediate effect on the display unless DDPSETPAL_VSYNC is specified + * and supported. + */ +#define DDPCAPS_PRIMARYSURFACE 0x00000010l + +/* + * This palette is the one attached to the primary surface left. Changing + * this table has immediate effect on the display for the left eye unless + * DDPSETPAL_VSYNC is specified and supported. + */ +#define DDPCAPS_PRIMARYSURFACELEFT 0x00000020l + +/* + * This palette can have all 256 entries defined + */ +#define DDPCAPS_ALLOW256 0x00000040l + +/* + * This palette can have modifications to it synced with the monitors + * refresh rate. + */ +#define DDPCAPS_VSYNC 0x00000080l + +/* + * Index is 1 bit. There are two color entries in the palette table. + */ +#define DDPCAPS_1BIT 0x00000100l + +/* + * Index is 2 bit. There are four color entries in the palette table. + */ +#define DDPCAPS_2BIT 0x00000200l + + +/**************************************************************************** + * + * DIRECTDRAWPALETTE SETENTRY CONSTANTS + * + ****************************************************************************/ + + +/**************************************************************************** + * + * DIRECTDRAWPALETTE GETENTRY CONSTANTS + * + ****************************************************************************/ + +/* 0 is the only legal value */ + +/**************************************************************************** + * + * DIRECTDRAWSURFACE SETPALETTE CONSTANTS + * + ****************************************************************************/ + + +/**************************************************************************** + * + * DIRECTDRAW BITDEPTH CONSTANTS + * + * NOTE: These are only used to indicate supported bit depths. These + * are flags only, they are not to be used as an actual bit depth. The + * absolute numbers 1, 2, 4, 8, 16, 24 and 32 are used to indicate actual + * bit depths in a surface or for changing the display mode. + * + ****************************************************************************/ + +/* + * 1 bit per pixel. + */ +#define DDBD_1 0x00004000l + +/* + * 2 bits per pixel. + */ +#define DDBD_2 0x00002000l + +/* + * 4 bits per pixel. + */ +#define DDBD_4 0x00001000l + +/* + * 8 bits per pixel. + */ +#define DDBD_8 0x00000800l + +/* + * 16 bits per pixel. + */ +#define DDBD_16 0x00000400l + +/* + * 24 bits per pixel. + */ +#define DDBD_24 0X00000200l + +/* + * 32 bits per pixel. + */ +#define DDBD_32 0x00000100l + +/**************************************************************************** + * + * DIRECTDRAWSURFACE SET/GET COLOR KEY FLAGS + * + ****************************************************************************/ + +/* + * Set if the structure contains a color space. Not set if the structure + * contains a single color key. + */ +#define DDCKEY_COLORSPACE 0x00000001l + +/* + * Set if the structure specifies a color key or color space which is to be + * used as a destination color key for blt operations. + */ +#define DDCKEY_DESTBLT 0x00000002l + +/* + * Set if the structure specifies a color key or color space which is to be + * used as a destination color key for overlay operations. + */ +#define DDCKEY_DESTOVERLAY 0x00000004l + +/* + * Set if the structure specifies a color key or color space which is to be + * used as a source color key for blt operations. + */ +#define DDCKEY_SRCBLT 0x00000008l + +/* + * Set if the structure specifies a color key or color space which is to be + * used as a source color key for overlay operations. + */ +#define DDCKEY_SRCOVERLAY 0x00000010l + + +/**************************************************************************** + * + * DIRECTDRAW COLOR KEY CAPABILITY FLAGS + * + ****************************************************************************/ + +/* + * Supports transparent blting using a color key to identify the replaceable + * bits of the destination surface for RGB colors. + */ +#define DDCKEYCAPS_DESTBLT 0x00000001l + +/* + * Supports transparent blting using a color space to identify the replaceable + * bits of the destination surface for RGB colors. + */ +#define DDCKEYCAPS_DESTBLTCLRSPACE 0x00000002l + +/* + * Supports transparent blting using a color space to identify the replaceable + * bits of the destination surface for YUV colors. + */ +#define DDCKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004l + +/* + * Supports transparent blting using a color key to identify the replaceable + * bits of the destination surface for YUV colors. + */ +#define DDCKEYCAPS_DESTBLTYUV 0x00000008l + +/* + * Supports overlaying using colorkeying of the replaceable bits of the surface + * being overlayed for RGB colors. + */ +#define DDCKEYCAPS_DESTOVERLAY 0x00000010l + +/* + * Supports a color space as the color key for the destination for RGB colors. + */ +#define DDCKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020l + +/* + * Supports a color space as the color key for the destination for YUV colors. + */ +#define DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040l + +/* + * Supports only one active destination color key value for visible overlay + * surfaces. + */ +#define DDCKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080l + +/* + * Supports overlaying using colorkeying of the replaceable bits of the + * surface being overlayed for YUV colors. + */ +#define DDCKEYCAPS_DESTOVERLAYYUV 0x00000100l + +/* + * Supports transparent blting using the color key for the source with + * this surface for RGB colors. + */ +#define DDCKEYCAPS_SRCBLT 0x00000200l + +/* + * Supports transparent blting using a color space for the source with + * this surface for RGB colors. + */ +#define DDCKEYCAPS_SRCBLTCLRSPACE 0x00000400l + +/* + * Supports transparent blting using a color space for the source with + * this surface for YUV colors. + */ +#define DDCKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800l + +/* + * Supports transparent blting using the color key for the source with + * this surface for YUV colors. + */ +#define DDCKEYCAPS_SRCBLTYUV 0x00001000l + +/* + * Supports overlays using the color key for the source with this + * overlay surface for RGB colors. + */ +#define DDCKEYCAPS_SRCOVERLAY 0x00002000l + +/* + * Supports overlays using a color space as the source color key for + * the overlay surface for RGB colors. + */ +#define DDCKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000l + +/* + * Supports overlays using a color space as the source color key for + * the overlay surface for YUV colors. + */ +#define DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000l + +/* + * Supports only one active source color key value for visible + * overlay surfaces. + */ +#define DDCKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000l + +/* + * Supports overlays using the color key for the source with this + * overlay surface for YUV colors. + */ +#define DDCKEYCAPS_SRCOVERLAYYUV 0x00020000l + +/* + * there are no bandwidth trade-offs for using colorkey with an overlay + */ +#define DDCKEYCAPS_NOCOSTOVERLAY 0x00040000l + + +/**************************************************************************** + * + * DIRECTDRAW PIXELFORMAT FLAGS + * + ****************************************************************************/ + +/* + * The surface has alpha channel information in the pixel format. + */ +#define DDPF_ALPHAPIXELS 0x00000001l + +/* + * The pixel format contains alpha only information + */ +#define DDPF_ALPHA 0x00000002l + +/* + * The FourCC code is valid. + */ +#define DDPF_FOURCC 0x00000004l + +/* + * The surface is 4-bit color indexed. + */ +#define DDPF_PALETTEINDEXED4 0x00000008l + +/* + * The surface is indexed into a palette which stores indices + * into the destination surface's 8-bit palette. + */ +#define DDPF_PALETTEINDEXEDTO8 0x00000010l + +/* + * The surface is 8-bit color indexed. + */ +#define DDPF_PALETTEINDEXED8 0x00000020l + +/* + * The RGB data in the pixel format structure is valid. + */ +#define DDPF_RGB 0x00000040l + +/* + * The surface will accept pixel data in the format specified + * and compress it during the write. + */ +#define DDPF_COMPRESSED 0x00000080l + +/* + * The surface will accept RGB data and translate it during + * the write to YUV data. The format of the data to be written + * will be contained in the pixel format structure. The DDPF_RGB + * flag will be set. + */ +#define DDPF_RGBTOYUV 0x00000100l + +/* + * pixel format is YUV - YUV data in pixel format struct is valid + */ +#define DDPF_YUV 0x00000200l + +/* + * pixel format is a z buffer only surface + */ +#define DDPF_ZBUFFER 0x00000400l + +/* + * The surface is 1-bit color indexed. + */ +#define DDPF_PALETTEINDEXED1 0x00000800l + +/* + * The surface is 2-bit color indexed. + */ +#define DDPF_PALETTEINDEXED2 0x00001000l + +/*=========================================================================== + * + * + * DIRECTDRAW CALLBACK FLAGS + * + * + *==========================================================================*/ + +/**************************************************************************** + * + * DIRECTDRAW ENUMSURFACES FLAGS + * + ****************************************************************************/ + +/* + * Enumerate all of the surfaces that meet the search criterion. + */ +#define DDENUMSURFACES_ALL 0x00000001l + +/* + * A search hit is a surface that matches the surface description. + */ +#define DDENUMSURFACES_MATCH 0x00000002l + +/* + * A search hit is a surface that does not match the surface description. + */ +#define DDENUMSURFACES_NOMATCH 0x00000004l + +/* + * Enumerate the first surface that can be created which meets the search criterion. + */ +#define DDENUMSURFACES_CANBECREATED 0x00000008l + +/* + * Enumerate the surfaces that already exist that meet the search criterion. + */ +#define DDENUMSURFACES_DOESEXIST 0x00000010l + + +/**************************************************************************** + * + * DIRECTDRAW ENUMDISPLAYMODES FLAGS + * + ****************************************************************************/ + +/* + * Enumerate Modes with different refresh rates. EnumDisplayModes guarantees + * that a particular mode will be enumerated only once. This flag specifies whether + * the refresh rate is taken into account when determining if a mode is unique. + */ +#define DDEDM_REFRESHRATES 0x00000001l + + +/**************************************************************************** + * + * DIRECTDRAW SETCOOPERATIVELEVEL FLAGS + * + ****************************************************************************/ + +/* + * Exclusive mode owner will be responsible for the entire primary surface. + * GDI can be ignored. used with DD + */ +#define DDSCL_FULLSCREEN 0x00000001l + +/* + * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode + */ +#define DDSCL_ALLOWREBOOT 0x00000002l + +/* + * prevents DDRAW from modifying the application window. + * prevents DDRAW from minimize/restore the application window on activation. + */ +#define DDSCL_NOWINDOWCHANGES 0x00000004l + +/* + * app wants to work as a regular Windows application + */ +#define DDSCL_NORMAL 0x00000008l + +/* + * app wants exclusive access + */ +#define DDSCL_EXCLUSIVE 0x00000010l + + +/* + * app can deal with non-windows display modes + */ +#define DDSCL_ALLOWMODEX 0x00000040l + + +/**************************************************************************** + * + * DIRECTDRAW BLT FLAGS + * + ****************************************************************************/ + +/* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the destination surface as the alpha channel for this blt. + */ +#define DDBLT_ALPHADEST 0x00000001l + +/* + * Use the dwConstAlphaDest field in the DDBLTFX structure as the alpha channel + * for the destination surface for this blt. + */ +#define DDBLT_ALPHADESTCONSTOVERRIDE 0x00000002l + +/* + * The NEG suffix indicates that the destination surface becomes more + * transparent as the alpha value increases. (0 is opaque) + */ +#define DDBLT_ALPHADESTNEG 0x00000004l + +/* + * Use the lpDDSAlphaDest field in the DDBLTFX structure as the alpha + * channel for the destination for this blt. + */ +#define DDBLT_ALPHADESTSURFACEOVERRIDE 0x00000008l + +/* + * Use the dwAlphaEdgeBlend field in the DDBLTFX structure as the alpha channel + * for the edges of the image that border the color key colors. + */ +#define DDBLT_ALPHAEDGEBLEND 0x00000010l + +/* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the source surface as the alpha channel for this blt. + */ +#define DDBLT_ALPHASRC 0x00000020l + +/* + * Use the dwConstAlphaSrc field in the DDBLTFX structure as the alpha channel + * for the source for this blt. + */ +#define DDBLT_ALPHASRCCONSTOVERRIDE 0x00000040l + +/* + * The NEG suffix indicates that the source surface becomes more transparent + * as the alpha value increases. (0 is opaque) + */ +#define DDBLT_ALPHASRCNEG 0x00000080l + +/* + * Use the lpDDSAlphaSrc field in the DDBLTFX structure as the alpha channel + * for the source for this blt. + */ +#define DDBLT_ALPHASRCSURFACEOVERRIDE 0x00000100l + +/* + * Do this blt asynchronously through the FIFO in the order received. If + * there is no room in the hardware FIFO fail the call. + */ +#define DDBLT_ASYNC 0x00000200l + +/* + * Uses the dwFillColor field in the DDBLTFX structure as the RGB color + * to fill the destination rectangle on the destination surface with. + */ +#define DDBLT_COLORFILL 0x00000400l + +/* + * Uses the dwDDFX field in the DDBLTFX structure to specify the effects + * to use for the blt. + */ +#define DDBLT_DDFX 0x00000800l + +/* + * Uses the dwDDROPS field in the DDBLTFX structure to specify the ROPS + * that are not part of the Win32 API. + */ +#define DDBLT_DDROPS 0x00001000l + +/* + * Use the color key associated with the destination surface. + */ +#define DDBLT_KEYDEST 0x00002000l + +/* + * Use the dckDestColorkey field in the DDBLTFX structure as the color key + * for the destination surface. + */ +#define DDBLT_KEYDESTOVERRIDE 0x00004000l + +/* + * Use the color key associated with the source surface. + */ +#define DDBLT_KEYSRC 0x00008000l + +/* + * Use the dckSrcColorkey field in the DDBLTFX structure as the color key + * for the source surface. + */ +#define DDBLT_KEYSRCOVERRIDE 0x00010000l + +/* + * Use the dwROP field in the DDBLTFX structure for the raster operation + * for this blt. These ROPs are the same as the ones defined in the Win32 API. + */ +#define DDBLT_ROP 0x00020000l + +/* + * Use the dwRotationAngle field in the DDBLTFX structure as the angle + * (specified in 1/100th of a degree) to rotate the surface. + */ +#define DDBLT_ROTATIONANGLE 0x00040000l + +/* + * Z-buffered blt using the z-buffers attached to the source and destination + * surfaces and the dwZBufferOpCode field in the DDBLTFX structure as the + * z-buffer opcode. + */ +#define DDBLT_ZBUFFER 0x00080000l + +/* + * Z-buffered blt using the dwConstDest Zfield and the dwZBufferOpCode field + * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively + * for the destination. + */ +#define DDBLT_ZBUFFERDESTCONSTOVERRIDE 0x00100000l + +/* + * Z-buffered blt using the lpDDSDestZBuffer field and the dwZBufferOpCode + * field in the DDBLTFX structure as the z-buffer and z-buffer opcode + * respectively for the destination. + */ +#define DDBLT_ZBUFFERDESTOVERRIDE 0x00200000l + +/* + * Z-buffered blt using the dwConstSrcZ field and the dwZBufferOpCode field + * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively + * for the source. + */ +#define DDBLT_ZBUFFERSRCCONSTOVERRIDE 0x00400000l + +/* + * Z-buffered blt using the lpDDSSrcZBuffer field and the dwZBufferOpCode + * field in the DDBLTFX structure as the z-buffer and z-buffer opcode + * respectively for the source. + */ +#define DDBLT_ZBUFFERSRCOVERRIDE 0x00800000l + +/* + * wait until the device is ready to handle the blt + * this will cause blt to not return DDERR_WASSTILLDRAWING + */ +#define DDBLT_WAIT 0x01000000l + +/* + * Uses the dwFillDepth field in the DDBLTFX structure as the depth value + * to fill the destination rectangle on the destination Z-buffer surface + * with. + */ +#define DDBLT_DEPTHFILL 0x02000000l + + +/**************************************************************************** + * + * BLTFAST FLAGS + * + ****************************************************************************/ + +#define DDBLTFAST_NOCOLORKEY 0x00000000 +#define DDBLTFAST_SRCCOLORKEY 0x00000001 +#define DDBLTFAST_DESTCOLORKEY 0x00000002 +#define DDBLTFAST_WAIT 0x00000010 + +/**************************************************************************** + * + * FLIP FLAGS + * + ****************************************************************************/ + +#define DDFLIP_WAIT 0x00000001l + + +/**************************************************************************** + * + * DIRECTDRAW SURFACE OVERLAY FLAGS + * + ****************************************************************************/ + +/* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the destination surface as the alpha channel for the + * destination overlay. + */ +#define DDOVER_ALPHADEST 0x00000001l + +/* + * Use the dwConstAlphaDest field in the DDOVERLAYFX structure as the + * destination alpha channel for this overlay. + */ +#define DDOVER_ALPHADESTCONSTOVERRIDE 0x00000002l + +/* + * The NEG suffix indicates that the destination surface becomes more + * transparent as the alpha value increases. + */ +#define DDOVER_ALPHADESTNEG 0x00000004l + +/* + * Use the lpDDSAlphaDest field in the DDOVERLAYFX structure as the alpha + * channel destination for this overlay. + */ +#define DDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008l + +/* + * Use the dwAlphaEdgeBlend field in the DDOVERLAYFX structure as the alpha + * channel for the edges of the image that border the color key colors. + */ +#define DDOVER_ALPHAEDGEBLEND 0x00000010l + +/* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the source surface as the source alpha channel for this overlay. + */ +#define DDOVER_ALPHASRC 0x00000020l + +/* + * Use the dwConstAlphaSrc field in the DDOVERLAYFX structure as the source + * alpha channel for this overlay. + */ +#define DDOVER_ALPHASRCCONSTOVERRIDE 0x00000040l + +/* + * The NEG suffix indicates that the source surface becomes more transparent + * as the alpha value increases. + */ +#define DDOVER_ALPHASRCNEG 0x00000080l + +/* + * Use the lpDDSAlphaSrc field in the DDOVERLAYFX structure as the alpha channel + * source for this overlay. + */ +#define DDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100l + +/* + * Turn this overlay off. + */ +#define DDOVER_HIDE 0x00000200l + +/* + * Use the color key associated with the destination surface. + */ +#define DDOVER_KEYDEST 0x00000400l + +/* + * Use the dckDestColorkey field in the DDOVERLAYFX structure as the color key + * for the destination surface + */ +#define DDOVER_KEYDESTOVERRIDE 0x00000800l + +/* + * Use the color key associated with the source surface. + */ +#define DDOVER_KEYSRC 0x00001000l + +/* + * Use the dckSrcColorkey field in the DDOVERLAYFX structure as the color key + * for the source surface. + */ +#define DDOVER_KEYSRCOVERRIDE 0x00002000l + +/* + * Turn this overlay on. + */ +#define DDOVER_SHOW 0x00004000l + +/* + * Add a dirty rect to an emulated overlayed surface. + */ +#define DDOVER_ADDDIRTYRECT 0x00008000l + +/* + * Redraw all dirty rects on an emulated overlayed surface. + */ +#define DDOVER_REFRESHDIRTYRECTS 0x00010000l + +/* + * Redraw the entire surface on an emulated overlayed surface. + */ +#define DDOVER_REFRESHALL 0x00020000l + + +/* + * Use the overlay FX flags to define special overlay FX + */ +#define DDOVER_DDFX 0x00080000l + + +/**************************************************************************** + * + * DIRECTDRAWSURFACE LOCK FLAGS + * + ****************************************************************************/ + +/* + * The default. Set to indicate that Lock should return a valid memory pointer + * to the top of the specified rectangle. If no rectangle is specified then a + * pointer to the top of the surface is returned. + */ +#define DDLOCK_SURFACEMEMORYPTR 0x00000000L // default + +/* + * Set to indicate that Lock should wait until it can obtain a valid memory + * pointer before returning. If this bit is set, Lock will never return + * DDERR_WASSTILLDRAWING. + */ +#define DDLOCK_WAIT 0x00000001L + +/* + * Set if an event handle is being passed to Lock. Lock will trigger the event + * when it can return the surface memory pointer requested. + */ +#define DDLOCK_EVENT 0x00000002L + +/* + * Indicates that the surface being locked will only be read from. + */ +#define DDLOCK_READONLY 0x00000010L + +/* + * Indicates that the surface being locked will only be written to + */ +#define DDLOCK_WRITEONLY 0x00000020L + + +/**************************************************************************** + * + * DIRECTDRAWSURFACE PAGELOCK FLAGS + * + ****************************************************************************/ + +/* + * No flags defined at present + */ + + +/**************************************************************************** + * + * DIRECTDRAWSURFACE PAGEUNLOCK FLAGS + * + ****************************************************************************/ + +/* + * No flags defined at present + */ + + +/**************************************************************************** + * + * DIRECTDRAWSURFACE BLT FX FLAGS + * + ****************************************************************************/ + +/* + * If stretching, use arithmetic stretching along the Y axis for this blt. + */ +#define DDBLTFX_ARITHSTRETCHY 0x00000001l + +/* + * Do this blt mirroring the surface left to right. Spin the + * surface around its y-axis. + */ +#define DDBLTFX_MIRRORLEFTRIGHT 0x00000002l + +/* + * Do this blt mirroring the surface up and down. Spin the surface + * around its x-axis. + */ +#define DDBLTFX_MIRRORUPDOWN 0x00000004l + +/* + * Schedule this blt to avoid tearing. + */ +#define DDBLTFX_NOTEARING 0x00000008l + +/* + * Do this blt rotating the surface one hundred and eighty degrees. + */ +#define DDBLTFX_ROTATE180 0x00000010l + +/* + * Do this blt rotating the surface two hundred and seventy degrees. + */ +#define DDBLTFX_ROTATE270 0x00000020l + +/* + * Do this blt rotating the surface ninety degrees. + */ +#define DDBLTFX_ROTATE90 0x00000040l + +/* + * Do this z blt using dwZBufferLow and dwZBufferHigh as range values + * specified to limit the bits copied from the source surface. + */ +#define DDBLTFX_ZBUFFERRANGE 0x00000080l + +/* + * Do this z blt adding the dwZBufferBaseDest to each of the sources z values + * before comparing it with the desting z values. + */ +#define DDBLTFX_ZBUFFERBASEDEST 0x00000100l + +/**************************************************************************** + * + * DIRECTDRAWSURFACE OVERLAY FX FLAGS + * + ****************************************************************************/ + +/* + * If stretching, use arithmetic stretching along the Y axis for this overlay. + */ +#define DDOVERFX_ARITHSTRETCHY 0x00000001l + +/* + * Mirror the overlay across the vertical axis + */ +#define DDOVERFX_MIRRORLEFTRIGHT 0x00000002l + +/* + * Mirror the overlay across the horizontal axis + */ +#define DDOVERFX_MIRRORUPDOWN 0x00000004l + +/**************************************************************************** + * + * DIRECTDRAW WAITFORVERTICALBLANK FLAGS + * + ****************************************************************************/ + +/* + * return when the vertical blank interval begins + */ +#define DDWAITVB_BLOCKBEGIN 0x00000001l + +/* + * set up an event to trigger when the vertical blank begins + */ +#define DDWAITVB_BLOCKBEGINEVENT 0x00000002l + +/* + * return when the vertical blank interval ends and display begins + */ +#define DDWAITVB_BLOCKEND 0x00000004l + +/**************************************************************************** + * + * DIRECTDRAW GETFLIPSTATUS FLAGS + * + ****************************************************************************/ + +/* + * is it OK to flip now? + */ +#define DDGFS_CANFLIP 0x00000001l + +/* + * is the last flip finished? + */ +#define DDGFS_ISFLIPDONE 0x00000002l + +/**************************************************************************** + * + * DIRECTDRAW GETBLTSTATUS FLAGS + * + ****************************************************************************/ + +/* + * is it OK to blt now? + */ +#define DDGBS_CANBLT 0x00000001l + +/* + * is the blt to the surface finished? + */ +#define DDGBS_ISBLTDONE 0x00000002l + + +/**************************************************************************** + * + * DIRECTDRAW ENUMOVERLAYZORDER FLAGS + * + ****************************************************************************/ + +/* + * Enumerate overlays back to front. + */ +#define DDENUMOVERLAYZ_BACKTOFRONT 0x00000000l + +/* + * Enumerate overlays front to back + */ +#define DDENUMOVERLAYZ_FRONTTOBACK 0x00000001l + +/**************************************************************************** + * + * DIRECTDRAW UPDATEOVERLAYZORDER FLAGS + * + ****************************************************************************/ + +/* + * Send overlay to front + */ +#define DDOVERZ_SENDTOFRONT 0x00000000l + +/* + * Send overlay to back + */ +#define DDOVERZ_SENDTOBACK 0x00000001l + +/* + * Move Overlay forward + */ +#define DDOVERZ_MOVEFORWARD 0x00000002l + +/* + * Move Overlay backward + */ +#define DDOVERZ_MOVEBACKWARD 0x00000003l + +/* + * Move Overlay in front of relative surface + */ +#define DDOVERZ_INSERTINFRONTOF 0x00000004l + +/* + * Move Overlay in back of relative surface + */ +#define DDOVERZ_INSERTINBACKOF 0x00000005l + +/*=========================================================================== + * + * + * DIRECTDRAW RETURN CODES + * + * The return values from DirectDraw Commands and Surface that return an HRESULT + * are codes from DirectDraw concerning the results of the action + * requested by DirectDraw. + * + *==========================================================================*/ + +/* + * Status is OK + * + * Issued by: DirectDraw Commands and all callbacks + */ +#define DD_OK 0 + +/**************************************************************************** + * + * DIRECTDRAW ENUMCALLBACK RETURN VALUES + * + * EnumCallback returns are used to control the flow of the DIRECTDRAW and + * DIRECTDRAWSURFACE object enumerations. They can only be returned by + * enumeration callback routines. + * + ****************************************************************************/ + +/* + * stop the enumeration + */ +#define DDENUMRET_CANCEL 0 + +/* + * continue the enumeration + */ +#define DDENUMRET_OK 1 + +/**************************************************************************** + * + * DIRECTDRAW ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************/ + +/* + * This object is already initialized + */ +#define DDERR_ALREADYINITIALIZED MAKE_DDHRESULT( 5 ) + +/* + * This surface can not be attached to the requested surface. + */ +#define DDERR_CANNOTATTACHSURFACE MAKE_DDHRESULT( 10 ) + +/* + * This surface can not be detached from the requested surface. + */ +#define DDERR_CANNOTDETACHSURFACE MAKE_DDHRESULT( 20 ) + +/* + * Support is currently not available. + */ +#define DDERR_CURRENTLYNOTAVAIL MAKE_DDHRESULT( 40 ) + +/* + * An exception was encountered while performing the requested operation + */ +#define DDERR_EXCEPTION MAKE_DDHRESULT( 55 ) + +/* + * Generic failure. + */ +#define DDERR_GENERIC E_FAIL + +/* + * Height of rectangle provided is not a multiple of reqd alignment + */ +#define DDERR_HEIGHTALIGN MAKE_DDHRESULT( 90 ) + +/* + * Unable to match primary surface creation request with existing + * primary surface. + */ +#define DDERR_INCOMPATIBLEPRIMARY MAKE_DDHRESULT( 95 ) + +/* + * One or more of the caps bits passed to the callback are incorrect. + */ +#define DDERR_INVALIDCAPS MAKE_DDHRESULT( 100 ) + +/* + * DirectDraw does not support provided Cliplist. + */ +#define DDERR_INVALIDCLIPLIST MAKE_DDHRESULT( 110 ) + +/* + * DirectDraw does not support the requested mode + */ +#define DDERR_INVALIDMODE MAKE_DDHRESULT( 120 ) + +/* + * DirectDraw received a pointer that was an invalid DIRECTDRAW object. + */ +#define DDERR_INVALIDOBJECT MAKE_DDHRESULT( 130 ) + +/* + * One or more of the parameters passed to the callback function are + * incorrect. + */ +#define DDERR_INVALIDPARAMS E_INVALIDARG + +/* + * pixel format was invalid as specified + */ +#define DDERR_INVALIDPIXELFORMAT MAKE_DDHRESULT( 145 ) + +/* + * Rectangle provided was invalid. + */ +#define DDERR_INVALIDRECT MAKE_DDHRESULT( 150 ) + +/* + * Operation could not be carried out because one or more surfaces are locked + */ +#define DDERR_LOCKEDSURFACES MAKE_DDHRESULT( 160 ) + +/* + * There is no 3D present. + */ +#define DDERR_NO3D MAKE_DDHRESULT( 170 ) + +/* + * Operation could not be carried out because there is no alpha accleration + * hardware present or available. + */ +#define DDERR_NOALPHAHW MAKE_DDHRESULT( 180 ) + + +/* + * no clip list available + */ +#define DDERR_NOCLIPLIST MAKE_DDHRESULT( 205 ) + +/* + * Operation could not be carried out because there is no color conversion + * hardware present or available. + */ +#define DDERR_NOCOLORCONVHW MAKE_DDHRESULT( 210 ) + +/* + * Create function called without DirectDraw object method SetCooperativeLevel + * being called. + */ +#define DDERR_NOCOOPERATIVELEVELSET MAKE_DDHRESULT( 212 ) + +/* + * Surface doesn't currently have a color key + */ +#define DDERR_NOCOLORKEY MAKE_DDHRESULT( 215 ) + +/* + * Operation could not be carried out because there is no hardware support + * of the dest color key. + */ +#define DDERR_NOCOLORKEYHW MAKE_DDHRESULT( 220 ) + +/* + * No DirectDraw support possible with current display driver + */ +#define DDERR_NODIRECTDRAWSUPPORT MAKE_DDHRESULT( 222 ) + +/* + * Operation requires the application to have exclusive mode but the + * application does not have exclusive mode. + */ +#define DDERR_NOEXCLUSIVEMODE MAKE_DDHRESULT( 225 ) + +/* + * Flipping visible surfaces is not supported. + */ +#define DDERR_NOFLIPHW MAKE_DDHRESULT( 230 ) + +/* + * There is no GDI present. + */ +#define DDERR_NOGDI MAKE_DDHRESULT( 240 ) + +/* + * Operation could not be carried out because there is no hardware present + * or available. + */ +#define DDERR_NOMIRRORHW MAKE_DDHRESULT( 250 ) + +/* + * Requested item was not found + */ +#define DDERR_NOTFOUND MAKE_DDHRESULT( 255 ) + +/* + * Operation could not be carried out because there is no overlay hardware + * present or available. + */ +#define DDERR_NOOVERLAYHW MAKE_DDHRESULT( 260 ) + +/* + * Operation could not be carried out because there is no appropriate raster + * op hardware present or available. + */ +#define DDERR_NORASTEROPHW MAKE_DDHRESULT( 280 ) + +/* + * Operation could not be carried out because there is no rotation hardware + * present or available. + */ +#define DDERR_NOROTATIONHW MAKE_DDHRESULT( 290 ) + +/* + * Operation could not be carried out because there is no hardware support + * for stretching + */ +#define DDERR_NOSTRETCHHW MAKE_DDHRESULT( 310 ) + +/* + * DirectDrawSurface is not in 4 bit color palette and the requested operation + * requires 4 bit color palette. + */ +#define DDERR_NOT4BITCOLOR MAKE_DDHRESULT( 316 ) + +/* + * DirectDrawSurface is not in 4 bit color index palette and the requested + * operation requires 4 bit color index palette. + */ +#define DDERR_NOT4BITCOLORINDEX MAKE_DDHRESULT( 317 ) + +/* + * DirectDraw Surface is not in 8 bit color mode and the requested operation + * requires 8 bit color. + */ +#define DDERR_NOT8BITCOLOR MAKE_DDHRESULT( 320 ) + +/* + * Operation could not be carried out because there is no texture mapping + * hardware present or available. + */ +#define DDERR_NOTEXTUREHW MAKE_DDHRESULT( 330 ) + +/* + * Operation could not be carried out because there is no hardware support + * for vertical blank synchronized operations. + */ +#define DDERR_NOVSYNCHW MAKE_DDHRESULT( 335 ) + +/* + * Operation could not be carried out because there is no hardware support + * for zbuffer blting. + */ +#define DDERR_NOZBUFFERHW MAKE_DDHRESULT( 340 ) + +/* + * Overlay surfaces could not be z layered based on their BltOrder because + * the hardware does not support z layering of overlays. + */ +#define DDERR_NOZOVERLAYHW MAKE_DDHRESULT( 350 ) + +/* + * The hardware needed for the requested operation has already been + * allocated. + */ +#define DDERR_OUTOFCAPS MAKE_DDHRESULT( 360 ) + +/* + * DirectDraw does not have enough memory to perform the operation. + */ +#define DDERR_OUTOFMEMORY E_OUTOFMEMORY + +/* + * DirectDraw does not have enough memory to perform the operation. + */ +#define DDERR_OUTOFVIDEOMEMORY MAKE_DDHRESULT( 380 ) + +/* + * hardware does not support clipped overlays + */ +#define DDERR_OVERLAYCANTCLIP MAKE_DDHRESULT( 382 ) + +/* + * Can only have ony color key active at one time for overlays + */ +#define DDERR_OVERLAYCOLORKEYONLYONEACTIVE MAKE_DDHRESULT( 384 ) + +/* + * Access to this palette is being refused because the palette is already + * locked by another thread. + */ +#define DDERR_PALETTEBUSY MAKE_DDHRESULT( 387 ) + +/* + * No src color key specified for this operation. + */ +#define DDERR_COLORKEYNOTSET MAKE_DDHRESULT( 400 ) + +/* + * This surface is already attached to the surface it is being attached to. + */ +#define DDERR_SURFACEALREADYATTACHED MAKE_DDHRESULT( 410 ) + +/* + * This surface is already a dependency of the surface it is being made a + * dependency of. + */ +#define DDERR_SURFACEALREADYDEPENDENT MAKE_DDHRESULT( 420 ) + +/* + * Access to this surface is being refused because the surface is already + * locked by another thread. + */ +#define DDERR_SURFACEBUSY MAKE_DDHRESULT( 430 ) + +/* + * Access to this surface is being refused because no driver exists + * which can supply a pointer to the surface. + * This is most likely to happen when attempting to lock the primary + * surface when no DCI provider is present. + */ +#define DDERR_CANTLOCKSURFACE MAKE_DDHRESULT( 435 ) + +/* + * Access to Surface refused because Surface is obscured. + */ +#define DDERR_SURFACEISOBSCURED MAKE_DDHRESULT( 440 ) + +/* + * Access to this surface is being refused because the surface is gone. + * The DIRECTDRAWSURFACE object representing this surface should + * have Restore called on it. + */ +#define DDERR_SURFACELOST MAKE_DDHRESULT( 450 ) + +/* + * The requested surface is not attached. + */ +#define DDERR_SURFACENOTATTACHED MAKE_DDHRESULT( 460 ) + +/* + * Height requested by DirectDraw is too large. + */ +#define DDERR_TOOBIGHEIGHT MAKE_DDHRESULT( 470 ) + +/* + * Size requested by DirectDraw is too large -- The individual height and + * width are OK. + */ +#define DDERR_TOOBIGSIZE MAKE_DDHRESULT( 480 ) + +/* + * Width requested by DirectDraw is too large. + */ +#define DDERR_TOOBIGWIDTH MAKE_DDHRESULT( 490 ) + +/* + * Action not supported. + */ +#define DDERR_UNSUPPORTED E_NOTIMPL + +/* + * FOURCC format requested is unsupported by DirectDraw + */ +#define DDERR_UNSUPPORTEDFORMAT MAKE_DDHRESULT( 510 ) + +/* + * Bitmask in the pixel format requested is unsupported by DirectDraw + */ +#define DDERR_UNSUPPORTEDMASK MAKE_DDHRESULT( 520 ) + +/* + * vertical blank is in progress + */ +#define DDERR_VERTICALBLANKINPROGRESS MAKE_DDHRESULT( 537 ) + +/* + * Informs DirectDraw that the previous Blt which is transfering information + * to or from this Surface is incomplete. + */ +#define DDERR_WASSTILLDRAWING MAKE_DDHRESULT( 540 ) + +/* + * Rectangle provided was not horizontally aligned on reqd. boundary + */ +#define DDERR_XALIGN MAKE_DDHRESULT( 560 ) + +/* + * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver + * identifier. + */ +#define DDERR_INVALIDDIRECTDRAWGUID MAKE_DDHRESULT( 561 ) + +/* + * A DirectDraw object representing this driver has already been created + * for this process. + */ +#define DDERR_DIRECTDRAWALREADYCREATED MAKE_DDHRESULT( 562 ) + +/* + * A hardware only DirectDraw object creation was attempted but the driver + * did not support any hardware. + */ +#define DDERR_NODIRECTDRAWHW MAKE_DDHRESULT( 563 ) + +/* + * this process already has created a primary surface + */ +#define DDERR_PRIMARYSURFACEALREADYEXISTS MAKE_DDHRESULT( 564 ) + +/* + * software emulation not available. + */ +#define DDERR_NOEMULATION MAKE_DDHRESULT( 565 ) + +/* + * region passed to Clipper::GetClipList is too small. + */ +#define DDERR_REGIONTOOSMALL MAKE_DDHRESULT( 566 ) + +/* + * an attempt was made to set a clip list for a clipper objec that + * is already monitoring an hwnd. + */ +#define DDERR_CLIPPERISUSINGHWND MAKE_DDHRESULT( 567 ) + +/* + * No clipper object attached to surface object + */ +#define DDERR_NOCLIPPERATTACHED MAKE_DDHRESULT( 568 ) + +/* + * Clipper notification requires an HWND or + * no HWND has previously been set as the CooperativeLevel HWND. + */ +#define DDERR_NOHWND MAKE_DDHRESULT( 569 ) + +/* + * HWND used by DirectDraw CooperativeLevel has been subclassed, + * this prevents DirectDraw from restoring state. + */ +#define DDERR_HWNDSUBCLASSED MAKE_DDHRESULT( 570 ) + +/* + * The CooperativeLevel HWND has already been set. + * It can not be reset while the process has surfaces or palettes created. + */ +#define DDERR_HWNDALREADYSET MAKE_DDHRESULT( 571 ) + +/* + * No palette object attached to this surface. + */ +#define DDERR_NOPALETTEATTACHED MAKE_DDHRESULT( 572 ) + +/* + * No hardware support for 16 or 256 color palettes. + */ +#define DDERR_NOPALETTEHW MAKE_DDHRESULT( 573 ) + +/* + * If a clipper object is attached to the source surface passed into a + * BltFast call. + */ +#define DDERR_BLTFASTCANTCLIP MAKE_DDHRESULT( 574 ) + +/* + * No blter. + */ +#define DDERR_NOBLTHW MAKE_DDHRESULT( 575 ) + +/* + * No DirectDraw ROP hardware. + */ +#define DDERR_NODDROPSHW MAKE_DDHRESULT( 576 ) + +/* + * returned when GetOverlayPosition is called on a hidden overlay + */ +#define DDERR_OVERLAYNOTVISIBLE MAKE_DDHRESULT( 577 ) + +/* + * returned when GetOverlayPosition is called on a overlay that UpdateOverlay + * has never been called on to establish a destionation. + */ +#define DDERR_NOOVERLAYDEST MAKE_DDHRESULT( 578 ) + +/* + * returned when the position of the overlay on the destionation is no longer + * legal for that destionation. + */ +#define DDERR_INVALIDPOSITION MAKE_DDHRESULT( 579 ) + +/* + * returned when an overlay member is called for a non-overlay surface + */ +#define DDERR_NOTAOVERLAYSURFACE MAKE_DDHRESULT( 580 ) + +/* + * An attempt was made to set the cooperative level when it was already + * set to exclusive. + */ +#define DDERR_EXCLUSIVEMODEALREADYSET MAKE_DDHRESULT( 581 ) + +/* + * An attempt has been made to flip a surface that is not flippable. + */ +#define DDERR_NOTFLIPPABLE MAKE_DDHRESULT( 582 ) + +/* + * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly + * created. + */ +#define DDERR_CANTDUPLICATE MAKE_DDHRESULT( 583 ) + +/* + * Surface was not locked. An attempt to unlock a surface that was not + * locked at all, or by this process, has been attempted. + */ +#define DDERR_NOTLOCKED MAKE_DDHRESULT( 584 ) + +/* + * Windows can not create any more DCs + */ +#define DDERR_CANTCREATEDC MAKE_DDHRESULT( 585 ) + +/* + * No DC was ever created for this surface. + */ +#define DDERR_NODC MAKE_DDHRESULT( 586 ) + +/* + * This surface can not be restored because it was created in a different + * mode. + */ +#define DDERR_WRONGMODE MAKE_DDHRESULT( 587 ) + +/* + * This surface can not be restored because it is an implicitly created + * surface. + */ +#define DDERR_IMPLICITLYCREATED MAKE_DDHRESULT( 588 ) + +/* + * The surface being used is not a palette-based surface + */ +#define DDERR_NOTPALETTIZED MAKE_DDHRESULT( 589 ) + + +/* + * The display is currently in an unsupported mode + */ +#define DDERR_UNSUPPORTEDMODE MAKE_DDHRESULT( 590 ) + +/* + * Operation could not be carried out because there is no mip-map + * texture mapping hardware present or available. + */ +#define DDERR_NOMIPMAPHW MAKE_DDHRESULT( 591 ) + +/* + * The requested action could not be performed because the surface was of + * the wrong type. + */ +#define DDERR_INVALIDSURFACETYPE MAKE_DDHRESULT( 592 ) + + + +/* + * A DC has already been returned for this surface. Only one DC can be + * retrieved per surface. + */ +#define DDERR_DCALREADYCREATED MAKE_DDHRESULT( 620 ) + +/* + * The attempt to page lock a surface failed. + */ +#define DDERR_CANTPAGELOCK MAKE_DDHRESULT( 640 ) + +/* + * The attempt to page unlock a surface failed. + */ +#define DDERR_CANTPAGEUNLOCK MAKE_DDHRESULT( 660 ) + +/* + * An attempt was made to page unlock a surface with no outstanding page locks. + */ +#define DDERR_NOTPAGELOCKED MAKE_DDHRESULT( 680 ) + +/* + * An attempt was made to invoke an interface member of a DirectDraw object + * created by CoCreateInstance() before it was initialized. + */ +#define DDERR_NOTINITIALIZED CO_E_NOTINITIALIZED + +/* Alpha bit depth constants */ + + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/sdk/inc/dinput.h b/sdk/inc/dinput.h new file mode 100644 index 0000000..331403c --- /dev/null +++ b/sdk/inc/dinput.h @@ -0,0 +1,873 @@ +/**************************************************************************** + * + * Copyright (C) 1996 Microsoft Corporation. All Rights Reserved. + * + * File: dinput.h + * Content: DirectInput include file + * + ****************************************************************************/ + +#ifndef __DINPUT_INCLUDED__ +#define __DINPUT_INCLUDED__ + +#ifdef _WIN32 +#define COM_NO_WINDOWS_H +#include <objbase.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define DIRECTINPUT_VERSION 0x0300 + +/**************************************************************************** + * + * Class IDs + * + ****************************************************************************/ + +DEFINE_GUID(CLSID_DirectInput, 0x25E609E0,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(CLSID_DirectInputDevice,0x25E609E1,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Interfaces + * + ****************************************************************************/ + +DEFINE_GUID(IID_IDirectInputA, 0x89521360,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputW, 0x89521361,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(IID_IDirectInputDeviceA,0x5944E680,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDeviceW,0x5944E681,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Predefined object types + * + ****************************************************************************/ + +DEFINE_GUID(GUID_XAxis, 0xA36D02E0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_YAxis, 0xA36D02E1,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_ZAxis, 0xA36D02E2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RAxis, 0xA36D02E3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_UAxis, 0xA36D02E4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_VAxis, 0xA36D02E5,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_Button, 0xA36D02F0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Key, 0x55728220,0xD33C,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_POV, 0xA36D02F2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Predefined product GUIDs + * + ****************************************************************************/ + +DEFINE_GUID(GUID_SysMouse, 0x6F1D2B60,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboard,0x6F1D2B61,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Interfaces and Structures... + * + ****************************************************************************/ + +/**************************************************************************** + * + * IDirectInputDevice + * + ****************************************************************************/ + +#define DIDEVTYPE_DEVICE 1 +#define DIDEVTYPE_MOUSE 2 +#define DIDEVTYPE_KEYBOARD 3 +#define DIDEVTYPE_JOYSTICK 4 + +#define DIDEVTYPEMOUSE_UNKNOWN 1 +#define DIDEVTYPEMOUSE_TRADITIONAL 2 +#define DIDEVTYPEMOUSE_FINGERSTICK 3 +#define DIDEVTYPEMOUSE_TOUCHPAD 4 +#define DIDEVTYPEMOUSE_TRACKBALL 5 + +#define DIDEVTYPEKEYBOARD_PCXT 1 +#define DIDEVTYPEKEYBOARD_OLIVETTI 2 +#define DIDEVTYPEKEYBOARD_PCAT 3 +#define DIDEVTYPEKEYBOARD_PCENH 4 +#define DIDEVTYPEKEYBOARD_NOKIA1050 5 +#define DIDEVTYPEKEYBOARD_NOKIA9140 6 +#define DIDEVTYPEKEYBOARD_NEC98 7 +#define DIDEVTYPEKEYBOARD_NEC98LAPTOP 8 +#define DIDEVTYPEKEYBOARD_NEC98106 9 +#define DIDEVTYPEKEYBOARD_JAPAN106 10 +#define DIDEVTYPEKEYBOARD_JAPANAX 11 +#define DIDEVTYPEKEYBOARD_J3100 12 + +#define GET_DIDEVICE_TYPE(dwDevType) LOBYTE(dwDevType) +#define GET_DIDEVICE_SUBTYPE(dwDevType) HIBYTE(dwDevType) + +typedef struct _DIDEVCAPS { + DWORD dwSize; + DWORD dwFlags; + DWORD dwDevType; + DWORD dwAxes; + DWORD dwButtons; + DWORD dwPOVs; +} DIDEVCAPS, *LPDIDEVCAPS; + +#define DIDC_ATTACHED 0x00000001 +#define DIDC_POLLEDDEVICE 0x00000002 + +#define DIDFT_ALL 0x00000000 + +#define DIDFT_RELAXIS 0x00000001 +#define DIDFT_ABSAXIS 0x00000002 +#define DIDFT_AXIS 0x00000003 + +#define DIDFT_PSHBUTTON 0x00000004 +#define DIDFT_TGLBUTTON 0x00000008 +#define DIDFT_BUTTON 0x0000000C + +#define DIDFT_POV 0x00000010 + +#define DIDFT_ANYINSTANCE 0x0000FF00 +#define DIDFT_MAKEINSTANCE(n) ((BYTE)(n) << 8) +#define DIDFT_GETTYPE(n) LOBYTE(n) +#define DIDFT_GETINSTANCE(n) HIBYTE(n) + +typedef struct _DIOBJECTDATAFORMAT { + const GUID *pguid; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; +} DIOBJECTDATAFORMAT, *LPDIOBJECTDATAFORMAT; +typedef const DIOBJECTDATAFORMAT *LPCDIOBJECTDATAFORMAT; + +typedef struct _DIDATAFORMAT { + DWORD dwSize; + DWORD dwObjSize; + DWORD dwFlags; + DWORD dwDataSize; + DWORD dwNumObjs; + LPDIOBJECTDATAFORMAT rgodf; +} DIDATAFORMAT, *LPDIDATAFORMAT; +typedef const DIDATAFORMAT *LPCDIDATAFORMAT; + +#define DIDF_ABSAXIS 0x00000001 +#define DIDF_RELAXIS 0x00000002 + +extern const DIDATAFORMAT c_dfDIMouse; +extern const DIDATAFORMAT c_dfDIKeyboard; + +typedef struct DIDEVICEOBJECTINSTANCEA { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + CHAR tszName[MAX_PATH]; +} DIDEVICEOBJECTINSTANCEA, *LPDIDEVICEOBJECTINSTANCEA; +typedef struct DIDEVICEOBJECTINSTANCEW { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + WCHAR tszName[MAX_PATH]; +} DIDEVICEOBJECTINSTANCEW, *LPDIDEVICEOBJECTINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEOBJECTINSTANCEW DIDEVICEOBJECTINSTANCE; +typedef LPDIDEVICEOBJECTINSTANCEW LPDIDEVICEOBJECTINSTANCE; +#else +typedef DIDEVICEOBJECTINSTANCEA DIDEVICEOBJECTINSTANCE; +typedef LPDIDEVICEOBJECTINSTANCEA LPDIDEVICEOBJECTINSTANCE; +#endif // UNICODE +typedef const DIDEVICEOBJECTINSTANCEA *LPCDIDEVICEOBJECTINSTANCEA; +typedef const DIDEVICEOBJECTINSTANCEW *LPCDIDEVICEOBJECTINSTANCEW; +typedef const DIDEVICEOBJECTINSTANCE *LPCDIDEVICEOBJECTINSTANCE; + +typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKA)(LPCDIDEVICEOBJECTINSTANCEA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKW)(LPCDIDEVICEOBJECTINSTANCEW, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKW +#else +#define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKA +#endif // !UNICODE + +typedef struct DIPROPHEADER { + DWORD dwSize; + DWORD dwHeaderSize; + DWORD dwObj; + DWORD dwHow; +} DIPROPHEADER, *LPDIPROPHEADER; +typedef const DIPROPHEADER *LPCDIPROPHEADER; + +#define DIPH_DEVICE 0 +#define DIPH_BYOFFSET 1 +#define DIPH_BYID 2 + +typedef struct DIPROPDWORD { + DIPROPHEADER diph; + DWORD dwData; +} DIPROPDWORD, *LPDIPROPDWORD; +typedef const DIPROPDWORD *LPCDIPROPDWORD; + +typedef struct DIPROPRANGE { + DIPROPHEADER diph; + LONG lMin; + LONG lMax; +} DIPROPRANGE, *LPDIPROPRANGE; +typedef const DIPROPRANGE *LPCDIPROPRANGE; + +#define DIPROPRANGE_NOMIN ((LONG)0x80000000) +#define DIPROPRANGE_NOMAX ((LONG)0x7FFFFFFF) + +#ifdef __cplusplus +#define MAKEDIPROP(prop) (*(const GUID *)(prop)) +#else +#define MAKEDIPROP(prop) ((REFGUID)(prop)) +#endif + +#define DIPROP_BUFFERSIZE MAKEDIPROP(1) + +#define DIPROP_AXISMODE MAKEDIPROP(2) + +#define DIPROPAXISMODE_ABS 0 +#define DIPROPAXISMODE_REL 1 + +#define DIPROP_GRANULARITY MAKEDIPROP(3) + +#define DIPROP_RANGE MAKEDIPROP(4) + +typedef struct DIDEVICEOBJECTDATA { + DWORD dwOfs; + DWORD dwData; + DWORD dwTimeStamp; + DWORD dwSequence; +} DIDEVICEOBJECTDATA, *LPDIDEVICEOBJECTDATA; + +#define DIGDD_PEEK 0x00000001 + +#define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \ + ((int)((dwSequence1) - (dwSequence2)) cmp 0) + +#define DISCL_EXCLUSIVE 0x00000001 +#define DISCL_NONEXCLUSIVE 0x00000002 +#define DISCL_FOREGROUND 0x00000004 +#define DISCL_BACKGROUND 0x00000008 + +typedef struct DIDEVICEINSTANCEA { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + CHAR tszInstanceName[MAX_PATH]; + CHAR tszProductName[MAX_PATH]; +} DIDEVICEINSTANCEA, *LPDIDEVICEINSTANCEA; +typedef struct DIDEVICEINSTANCEW { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + WCHAR tszInstanceName[MAX_PATH]; + WCHAR tszProductName[MAX_PATH]; +} DIDEVICEINSTANCEW, *LPDIDEVICEINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE; +typedef LPDIDEVICEINSTANCEW LPDIDEVICEINSTANCE; +#else +typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE; +typedef LPDIDEVICEINSTANCEA LPDIDEVICEINSTANCE; +#endif // UNICODE +typedef const DIDEVICEINSTANCEA *LPCDIDEVICEINSTANCEA; +typedef const DIDEVICEINSTANCEW *LPCDIDEVICEINSTANCEW; +typedef const DIDEVICEINSTANCE *LPCDIDEVICEINSTANCE; + +#undef INTERFACE +#define INTERFACE IDirectInputDeviceW + +DECLARE_INTERFACE_(IDirectInputDeviceW, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceW methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; +}; + +typedef struct IDirectInputDeviceW *LPDIRECTINPUTDEVICEW; + +#undef INTERFACE +#define INTERFACE IDirectInputDeviceA + +DECLARE_INTERFACE_(IDirectInputDeviceA, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceA methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; +}; + +typedef struct IDirectInputDeviceA *LPDIRECTINPUTDEVICEA; + +#ifdef UNICODE +#define IID_IDirectInputDevice IID_IDirectInputDeviceW +#define IDirectInputDevice IDirectInputDeviceW +#define IDirectInputDeviceVtbl IDirectInputDeviceWVtbl +#else +#define IID_IDirectInputDevice IID_IDirectInputDeviceA +#define IDirectInputDevice IDirectInputDeviceA +#define IDirectInputDeviceVtbl IDirectInputDeviceAVtbl +#endif +typedef struct IDirectInputDevice *LPDIRECTINPUTDEVICE; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#endif + +/**************************************************************************** + * + * Mouse + * + ****************************************************************************/ + +typedef struct _DIMOUSESTATE { + LONG lX; + LONG lY; + LONG lZ; + BYTE rgbButtons[4]; +} DIMOUSESTATE, *LPDIMOUSESTATE; + +#define DIMOFS_X FIELD_OFFSET(DIMOUSESTATE, lX) +#define DIMOFS_Y FIELD_OFFSET(DIMOUSESTATE, lY) +#define DIMOFS_Z FIELD_OFFSET(DIMOUSESTATE, lZ) +#define DIMOFS_BUTTON0 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 0) +#define DIMOFS_BUTTON1 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 1) +#define DIMOFS_BUTTON2 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 2) +#define DIMOFS_BUTTON3 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 3) + +/**************************************************************************** + * + * Keyboard + * + ****************************************************************************/ + +/**************************************************************************** + * + * DirectInput keyboard scan codes + * + ****************************************************************************/ + +#define DIK_ESCAPE 0x01 +#define DIK_1 0x02 +#define DIK_2 0x03 +#define DIK_3 0x04 +#define DIK_4 0x05 +#define DIK_5 0x06 +#define DIK_6 0x07 +#define DIK_7 0x08 +#define DIK_8 0x09 +#define DIK_9 0x0A +#define DIK_0 0x0B +#define DIK_MINUS 0x0C /* - on main keyboard */ +#define DIK_EQUALS 0x0D +#define DIK_BACK 0x0E /* backspace */ +#define DIK_TAB 0x0F +#define DIK_Q 0x10 +#define DIK_W 0x11 +#define DIK_E 0x12 +#define DIK_R 0x13 +#define DIK_T 0x14 +#define DIK_Y 0x15 +#define DIK_U 0x16 +#define DIK_I 0x17 +#define DIK_O 0x18 +#define DIK_P 0x19 +#define DIK_LBRACKET 0x1A +#define DIK_RBRACKET 0x1B +#define DIK_RETURN 0x1C /* Enter on main keyboard */ +#define DIK_LCONTROL 0x1D +#define DIK_A 0x1E +#define DIK_S 0x1F +#define DIK_D 0x20 +#define DIK_F 0x21 +#define DIK_G 0x22 +#define DIK_H 0x23 +#define DIK_J 0x24 +#define DIK_K 0x25 +#define DIK_L 0x26 +#define DIK_SEMICOLON 0x27 +#define DIK_APOSTROPHE 0x28 +#define DIK_GRAVE 0x29 /* accent grave */ +#define DIK_LSHIFT 0x2A +#define DIK_BACKSLASH 0x2B +#define DIK_Z 0x2C +#define DIK_X 0x2D +#define DIK_C 0x2E +#define DIK_V 0x2F +#define DIK_B 0x30 +#define DIK_N 0x31 +#define DIK_M 0x32 +#define DIK_COMMA 0x33 +#define DIK_PERIOD 0x34 /* . on main keyboard */ +#define DIK_SLASH 0x35 /* / on main keyboard */ +#define DIK_RSHIFT 0x36 +#define DIK_MULTIPLY 0x37 /* * on numeric keypad */ +#define DIK_LMENU 0x38 /* left Alt */ +#define DIK_SPACE 0x39 +#define DIK_CAPITAL 0x3A +#define DIK_F1 0x3B +#define DIK_F2 0x3C +#define DIK_F3 0x3D +#define DIK_F4 0x3E +#define DIK_F5 0x3F +#define DIK_F6 0x40 +#define DIK_F7 0x41 +#define DIK_F8 0x42 +#define DIK_F9 0x43 +#define DIK_F10 0x44 +#define DIK_NUMLOCK 0x45 +#define DIK_SCROLL 0x46 /* Scroll Lock */ +#define DIK_NUMPAD7 0x47 +#define DIK_NUMPAD8 0x48 +#define DIK_NUMPAD9 0x49 +#define DIK_SUBTRACT 0x4A /* - on numeric keypad */ +#define DIK_NUMPAD4 0x4B +#define DIK_NUMPAD5 0x4C +#define DIK_NUMPAD6 0x4D +#define DIK_ADD 0x4E /* + on numeric keypad */ +#define DIK_NUMPAD1 0x4F +#define DIK_NUMPAD2 0x50 +#define DIK_NUMPAD3 0x51 +#define DIK_NUMPAD0 0x52 +#define DIK_DECIMAL 0x53 /* . on numeric keypad */ +#define DIK_F11 0x57 +#define DIK_F12 0x58 + +#define DIK_F13 0x64 /* (NEC PC98) */ +#define DIK_F14 0x65 /* (NEC PC98) */ +#define DIK_F15 0x66 /* (NEC PC98) */ + +#define DIK_KANA 0x70 /* (Japanese keyboard) */ +#define DIK_CONVERT 0x79 /* (Japanese keyboard) */ +#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */ +#define DIK_YEN 0x7D /* (Japanese keyboard) */ +#define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */ +#define DIK_CIRCUMFLEX 0x90 /* (Japanese keyboard) */ +#define DIK_AT 0x91 /* (NEC PC98) */ +#define DIK_COLON 0x92 /* (NEC PC98) */ +#define DIK_UNDERLINE 0x93 /* (NEC PC98) */ +#define DIK_KANJI 0x94 /* (Japanese keyboard) */ +#define DIK_STOP 0x95 /* (NEC PC98) */ +#define DIK_AX 0x96 /* (Japan AX) */ +#define DIK_UNLABELED 0x97 /* (J3100) */ +#define DIK_NUMPADENTER 0x9C /* Enter on numeric keypad */ +#define DIK_RCONTROL 0x9D +#define DIK_NUMPADCOMMA 0xB3 /* , on numeric keypad (NEC PC98) */ +#define DIK_DIVIDE 0xB5 /* / on numeric keypad */ +#define DIK_SYSRQ 0xB7 +#define DIK_RMENU 0xB8 /* right Alt */ +#define DIK_HOME 0xC7 /* Home on arrow keypad */ +#define DIK_UP 0xC8 /* UpArrow on arrow keypad */ +#define DIK_PRIOR 0xC9 /* PgUp on arrow keypad */ +#define DIK_LEFT 0xCB /* LeftArrow on arrow keypad */ +#define DIK_RIGHT 0xCD /* RightArrow on arrow keypad */ +#define DIK_END 0xCF /* End on arrow keypad */ +#define DIK_DOWN 0xD0 /* DownArrow on arrow keypad */ +#define DIK_NEXT 0xD1 /* PgDn on arrow keypad */ +#define DIK_INSERT 0xD2 /* Insert on arrow keypad */ +#define DIK_DELETE 0xD3 /* Delete on arrow keypad */ +#define DIK_LWIN 0xDB /* Left Windows key */ +#define DIK_RWIN 0xDC /* Right Windows key */ +#define DIK_APPS 0xDD /* AppMenu key */ + +/* + * Alternate names for keys, to facilitate transition from DOS. + */ +#define DIK_BACKSPACE DIK_BACK /* backspace */ +#define DIK_NUMPADSTAR DIK_MULTIPLY /* * on numeric keypad */ +#define DIK_LALT DIK_LMENU /* left Alt */ +#define DIK_CAPSLOCK DIK_CAPITAL /* CapsLock */ +#define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ +#define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ +#define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ +#define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ +#define DIK_RALT DIK_RMENU /* right Alt */ +#define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ +#define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ +#define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ +#define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ +#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ +#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ + +/**************************************************************************** + * + * IDirectInput + * + ****************************************************************************/ + +#define DIENUM_STOP 0 +#define DIENUM_CONTINUE 1 + +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKA)(LPCDIDEVICEINSTANCEA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKW)(LPCDIDEVICEINSTANCEW, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKW +#else +#define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKA +#endif // !UNICODE + +#define DIEDFL_ALLDEVICES 0x00000000 +#define DIEDFL_ATTACHEDONLY 0x00000001 + +#undef INTERFACE +#define INTERFACE IDirectInputW + +DECLARE_INTERFACE_(IDirectInputW, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputW methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; +}; + +typedef struct IDirectInputW *LPDIRECTINPUTW; + +#undef INTERFACE +#define INTERFACE IDirectInputA + +DECLARE_INTERFACE_(IDirectInputA, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputA methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; +}; + +typedef struct IDirectInputA *LPDIRECTINPUTA; + +#ifdef UNICODE +#define IID_IDirectInput IID_IDirectInputW +#define IDirectInput IDirectInputW +#define IDirectInputVtbl IDirectInputWVtbl +#else +#define IID_IDirectInput IID_IDirectInputA +#define IDirectInput IDirectInputA +#define IDirectInputVtbl IDirectInputAVtbl +#endif +typedef struct IDirectInput *LPDIRECTINPUT; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#endif + +extern HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter); +extern HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter); +#ifdef UNICODE +#define DirectInputCreate DirectInputCreateW +#else +#define DirectInputCreate DirectInputCreateA +#endif // !UNICODE + +/**************************************************************************** + * + * Return Codes + * + ****************************************************************************/ + +/* + * The operation completed successfully. + */ +#define DI_OK S_OK + +/* + * The device exists but is not currently attached. + */ +#define DI_NOTATTACHED S_FALSE + +/* + * The device buffer overflowed; some input was lost. + */ +#define DI_BUFFEROVERFLOW S_FALSE + +/* + * The change in device properties had no effect. + */ +#define DI_PROPNOEFFECT S_FALSE + +/* + * The device is a polled device. As a result, device buffering + * will not collect any data and event notifications will not be + * signalled until GetDeviceState is called. + */ +#define DI_POLLEDDEVICE ((HRESULT)0x00000002L) + +/* + * The application requires a newer version of DirectInput. + */ +#define DIERR_OLDDIRECTINPUTVERSION \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_OLD_WIN_VERSION) + +/* + * The application was written for an unsupported prerelease version + * of DirectInput. + */ +#define DIERR_BETADIRECTINPUTVERSION \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_RMODE_APP) + +/* + * The object could not be created due to an incompatible driver version + * or mismatched or incomplete driver components. + */ +#define DIERR_BADDRIVERVER \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BAD_DRIVER_LEVEL) + +/* + * The device or device instance is not registered with DirectInput. + */ +#define DIERR_DEVICENOTREG REGDB_E_CLASSNOTREG + +/* + * The requested object does not exist. + */ +#define DIERR_OBJECTNOTFOUND \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND) + +/* + * An invalid parameter was passed to the returning function, + * or the object was not in a state that admitted the function + * to be called. + */ +#define DIERR_INVALIDPARAM E_INVALIDARG + +/* + * The specified interface is not supported by the object + */ +#define DIERR_NOINTERFACE E_NOINTERFACE + +/* + * An undetermined error occured inside the DInput subsystem + */ +#define DIERR_GENERIC E_FAIL + +/* + * The DInput subsystem couldn't allocate sufficient memory to complete the + * caller's request. + */ +#define DIERR_OUTOFMEMORY E_OUTOFMEMORY + +/* + * The function called is not supported at this time + */ +#define DIERR_UNSUPPORTED E_NOTIMPL + +/* + * This object has not been initialized + */ +#define DIERR_NOTINITIALIZED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_READY) + +/* + * This object is already initialized + */ +#define DIERR_ALREADYINITIALIZED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_INITIALIZED) + +/* + * This object does not support aggregation + */ +#define DIERR_NOAGGREGATION CLASS_E_NOAGGREGATION + +/* + * Another app has a higher priority level, preventing this call from + * succeeding. + */ +#define DIERR_OTHERAPPHASPRIO E_ACCESSDENIED + +/* + * Access to the input device has been lost. It must be re-acquired. + */ +#define DIERR_INPUTLOST \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_READ_FAULT) + +/* + * The operation cannot be performed while the device is acquired. + */ +#define DIERR_ACQUIRED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BUSY) + +/* + * The operation cannot be performed unless the device is acquired. + */ +#define DIERR_NOTACQUIRED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INVALID_ACCESS) + +/* + * The specified property cannot be changed. + */ +#define DIERR_READONLY E_ACCESSDENIED + +/* + * The device already has an event notification associated with it. + */ +#define DIERR_HANDLEEXISTS E_ACCESSDENIED + +/* + * Data is not yet available. + */ +#ifndef E_PENDING +#define E_PENDING 0x80070007L +#endif + +#ifdef __cplusplus +}; +#endif + +#endif /* __DINPUT_INCLUDED__ */ + +/**************************************************************************** + * + * Definitions for non-IDirectInput (VJoyD) features defined more recently + * than the current sdk files + * + ****************************************************************************/ + +#ifdef _INC_MMSYSTEM +#ifndef MMNOJOY + +#ifndef __VJOYDX_INCLUDED__ +#define __VJOYDX_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Flag to indicate that the dwReserved2 field of the JOYINFOEX structure + * contains mini-driver specific data to be passed by VJoyD to the mini- + * driver instead of doing a poll. + */ +#define JOY_PASSDRIVERDATA 0x10000000l + +/* + * Informs the joystick driver that the configuration has been changed + * and should be reloaded from the registery. + * dwFlags is reserved and should be set to zero + */ +WINMMAPI MMRESULT WINAPI joyConfigChanged( DWORD dwFlags ); + +/* + * Hardware Setting indicating that the device is a headtracker + */ +#define JOY_HWS_ISHEADTRACKER 0x02000000l + +/* + * Hardware Setting indicating that the VxD is used to replace + * the standard analog polling + */ +#define JOY_HWS_ISGAMEPORTDRIVER 0x04000000l + +#ifdef __cplusplus +}; +#endif + +#endif /* __VJOYDX_INCLUDED__ */ + +#endif /* not MMNOJOY */ +#endif /* _INC_MMSYSTEM */ + +/**************************************************************************** + * + * Definitions for non-IDirectInput (VJoyD) features defined more recently + * than the current ddk files + * + ****************************************************************************/ + +#ifdef _INC_MMDDK +#ifndef MMNOJOYDEV + +#ifndef __VJOYDXD_INCLUDED__ +#define __VJOYDXD_INCLUDED__ +/* + * Poll type in which the do_other field of the JOYOEMPOLLDATA + * structure contains mini-driver specific data passed from an app. + */ +#define JOY_OEMPOLL_PASSDRIVERDATA 7 + +#endif /* __VJOYDXD_INCLUDED__ */ + +#endif /* not MMNOJOYDEV */ +#endif /* _INC_MMDDK */ diff --git a/sdk/inc/dplay.h b/sdk/inc/dplay.h new file mode 100644 index 0000000..722bea0 --- /dev/null +++ b/sdk/inc/dplay.h @@ -0,0 +1,1066 @@ +/*==========================================================================; + * + * Copyright (C) 1994-1996 Microsoft Corporation. All Rights Reserved. + * + * File: dplay.h + * Content: DirectPlay include file + * + ***************************************************************************/ + +#ifndef __DPLAY_INCLUDED__ +#define __DPLAY_INCLUDED__ + +#include <ole2.h> // for DECLARE_INTERFACE and HRESULT + +#define _FACDP 0x877 +#define MAKE_DPHRESULT( code ) MAKE_HRESULT( 1, _FACDP, code ) + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GUIDS used by DirectPlay objects + */ +DEFINE_GUID(IID_IDirectPlay2, 0x2b74f7c0, 0x9154, 0x11cf, 0xa9, 0xcd, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3); +DEFINE_GUID(IID_IDirectPlay2A,0x9d460580, 0xa822, 0x11cf, 0x96, 0xc, 0x0, 0x80, 0xc7, 0x53, 0x4e, 0x82); + + +/**************************************************************************** + * + * DirectPlay Structures + * + * Various structures used to invoke DirectPlay. + * + ****************************************************************************/ + +#ifndef IDIRECTPLAY2_OR_GREATER +typedef struct IDirectPlay FAR *LPDIRECTPLAY; +#else +typedef struct IUnknown FAR *LPDIRECTPLAY; +#endif + +typedef struct IDirectPlay2 FAR *LPDIRECTPLAY2; +typedef struct IDirectPlay2 FAR *LPDIRECTPLAY2A; +typedef struct IDirectPlay2 IDirectPlay2A; + +/* + * DPID + * DirectPlay player and group ID + */ +typedef DWORD DPID, FAR *LPDPID; + +/* + * DPID that system messages come from + */ +#define DPID_SYSMSG 0 + +/* + * DPID representing all players in the session + */ +#define DPID_ALLPLAYERS 0 + +/* + * DPCAPS + * Used to obtain the capabilities of a DirectPlay object + */ +typedef struct +{ + DWORD dwSize; // Size of structure, in bytes + DWORD dwFlags; // DPCAPS_xxx flags + DWORD dwMaxBufferSize; // Maximum message size, in bytes, for this service provider + DWORD dwMaxQueueSize; // Obsolete. + DWORD dwMaxPlayers; // Maximum players/groups (local + remote) + DWORD dwHundredBaud; // Bandwidth in 100 bits per second units; + // i.e. 24 is 2400, 96 is 9600, etc. + DWORD dwLatency; // Estimated latency; 0 = unknown + DWORD dwMaxLocalPlayers; // Maximum # of locally created players allowed + DWORD dwHeaderLength; // Maximum header length, in bytes, on messages + // added by the service provider + DWORD dwTimeout; // Service provider's suggested timeout value + // This is how long DirectPlay will wait for + // responses to system messages +} DPCAPS, FAR *LPDPCAPS; + +/* + * This DirectPlay object is the session host. If the host exits the + * session, another application will become the host and receive a + * DPSYS_HOST system message. + */ +#define DPCAPS_ISHOST 0x00000002 + +/* + * The service provider bound to this DirectPlay object can optimize + * group messaging. + */ +#define DPCAPS_GROUPOPTIMIZED 0x00000008 + +/* + * The service provider bound to this DirectPlay object can optimize + * keep alives (see DPSESSION_KEEPALIVE) + */ +#define DPCAPS_KEEPALIVEOPTIMIZED 0x00000010 + +/* + * The service provider bound to this DirectPlay object can optimize + * guaranteed message delivery. + */ +#define DPCAPS_GUARANTEEDOPTIMIZED 0x00000020 + +/* + * This DirectPlay object supports guaranteed message delivery. + */ +#define DPCAPS_GUARANTEEDSUPPORTED 0x00000040 + + + + +/* + * DPSESSIONDESC2 + * Used to describe the properties of a DirectPlay + * session instance + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // DPSESSION_xxx flags + GUID guidInstance; // ID for the session instance + GUID guidApplication; // GUID of the DirectPlay application. + // GUID_NULL for all applications. + DWORD dwMaxPlayers; // Maximum # players allowed in session + DWORD dwCurrentPlayers; // Current # players in session (read only) + union + { // Name of the session + LPWSTR lpszSessionName; // Unicode + LPSTR lpszSessionNameA; // ANSI + }; + union + { // Password of the session (optional) + LPWSTR lpszPassword; // Unicode + LPSTR lpszPasswordA; // ANSI + }; + DWORD dwReserved1; // Reserved for future MS use. + DWORD dwReserved2; + DWORD dwUser1; // For use by the application + DWORD dwUser2; + DWORD dwUser3; + DWORD dwUser4; +} DPSESSIONDESC2, FAR *LPDPSESSIONDESC2; + +/* + * LPCDPSESSIONDESC2 + * A constant pointer to DPSESSIONDESC2 + */ +typedef const DPSESSIONDESC2 FAR *LPCDPSESSIONDESC2; + +/* + * Applications cannot create new players in this session. + */ +#define DPSESSION_NEWPLAYERSDISABLED 0x00000001 + +/* + * If the DirectPlay object that created the session, the host, + * quits, then the host will attempt to migrate to another + * DirectPlay object so that new players can continue to be created + * and new applications can join the session. + */ +#define DPSESSION_MIGRATEHOST 0x00000004 + +/* + * This flag tells DirectPlay not to set the idPlayerTo and idPlayerFrom + * fields in player messages. This cuts two DWORD's off the message + * overhead. + */ +#define DPSESSION_NOMESSAGEID 0x00000008 + + +/* + * This flag tells DirectPlay to not allow any new applications to + * join the session. Applications already in the session can still + * create new players. + */ +#define DPSESSION_JOINDISABLED 0x00000020 + +/* + * This flag tells DirectPlay to detect when remote players + * exit abnormally (e.g. their computer or modem gets unplugged) + */ +#define DPSESSION_KEEPALIVE 0x00000040 + +/* + * This flag tells DirectPlay not to send a message to all players + * when a players remote data changes + */ +#define DPSESSION_NODATAMESSAGES 0x00000080 + +/* + * DPNAME + * Used to hold the name of a DirectPlay entity + * like a player or a group + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // Not used. Must be zero. + union + { // The short or friendly name + LPWSTR lpszShortName; // Unicode + LPSTR lpszShortNameA; // ANSI + }; + union + { // The long or formal name + LPWSTR lpszLongName; // Unicode + LPSTR lpszLongNameA; // ANSI + }; + +} DPNAME, FAR *LPDPNAME; + +/* + * LPCDPNAME + * A constant pointer to DPNAME + */ +typedef const DPNAME FAR *LPCDPNAME; + + +/**************************************************************************** + * + * Prototypes for DirectPlay callback functions + * + ****************************************************************************/ + +/* + * Callback for IDirectPlay2::EnumSessions + */ +typedef BOOL (FAR PASCAL * LPDPENUMSESSIONSCALLBACK2)( + LPCDPSESSIONDESC2 lpThisSD, + LPDWORD lpdwTimeOut, + DWORD dwFlags, + LPVOID lpContext ); + +/* + * This flag is set on the EnumSessions callback dwFlags parameter when + * the time out has occurred. There will be no session data for this + * callback. If *lpdwTimeOut is set to a non-zero value and the + * EnumSessionsCallback function returns TRUE then EnumSessions will + * continue waiting until the next timeout occurs. Timeouts are in + * milliseconds. + */ +#define DPESC_TIMEDOUT 0x00000001 + + +/* + * Callback for IDirectPlay2::EnumPlayers + * IDirectPlay2::EnumGroups + * IDirectPlay2::EnumGroupPlayers + */ +typedef BOOL (FAR PASCAL *LPDPENUMPLAYERSCALLBACK2)( + DPID dpId, + DWORD dwPlayerType, + LPCDPNAME lpName, + DWORD dwFlags, + LPVOID lpContext ); + + +/* + * Unicode callback for DirectPlayEnumerate + * This callback prototype will be used if compiling + * for Unicode strings + */ +typedef BOOL (FAR PASCAL * LPDPENUMDPCALLBACK)( + LPGUID lpguidSP, + LPWSTR lpSPName, + DWORD dwMajorVersion, + DWORD dwMinorVersion, + LPVOID lpContext); + +/* + * ANSI callback for DirectPlayEnumerate + * This callback prototype will be used if compiling + * for ANSI strings + */ +typedef BOOL (FAR PASCAL * LPDPENUMDPCALLBACKA)( + LPGUID lpguidSP, + LPSTR lpSPName, + DWORD dwMajorVersion, + DWORD dwMinorVersion, + LPVOID lpContext); + +/* + * API's + */ + +#ifdef UNICODE +#define DirectPlayEnumerate DirectPlayEnumerateW +#else +#define DirectPlayEnumerate DirectPlayEnumerateA +#endif // UNICODE + +extern HRESULT WINAPI DirectPlayEnumerateA( LPDPENUMDPCALLBACKA, LPVOID ); +extern HRESULT WINAPI DirectPlayEnumerateW( LPDPENUMDPCALLBACK, LPVOID ); +extern HRESULT WINAPI DirectPlayCreate( LPGUID lpGUID, LPDIRECTPLAY *lplpDP, IUnknown *pUnk); + +/**************************************************************************** + * + * IDirectPlay2 (and IDirectPlay2A) Interface + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlay2 +DECLARE_INTERFACE_( IDirectPlay2, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay2 methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPDPNAME,HANDLE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC2,DWORD,LPDPENUMSESSIONSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS,DWORD) PURE; + STDMETHOD(GetGroupData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetGroupName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerAddress) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID,LPDPCAPS,DWORD) PURE; + STDMETHOD(GetPlayerData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetSessionDesc) (THIS_ LPVOID,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetGroupData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetGroupName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetPlayerData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetSessionDesc) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlay2 interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay2_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlay2_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlay2_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlay2_CreatePlayer(p,a,b,c,d,e,f) (p)->lpVtbl->CreatePlayer(p,a,b,c,d,e,f) +#define IDirectPlay2_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlay2_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlay2_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlay2_EnableNewPlayers(p,a) (p)->lpVtbl->EnableNewPlayers(p,a) +#define IDirectPlay2_EnumGroupPlayers(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d,e) +#define IDirectPlay2_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlay2_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlay2_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlay2_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlay2_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlay2_GetGroupData(p,a,b,c,d) (p)->lpVtbl->GetGroupData(p,a,b,c,d) +#define IDirectPlay2_GetGroupName(p,a,b,c) (p)->lpVtbl->GetGroupName(p,a,b,c) +#define IDirectPlay2_GetPlayerAddress(p,a,b,c) (p)->lpVtbl->GetPlayerAddress(p,a,b,c) +#define IDirectPlay2_GetPlayerCaps(p,a,b,c) (p)->lpVtbl->GetPlayerCaps(p,a,b,c) +#define IDirectPlay2_GetPlayerData(p,a,b,c,d) (p)->lpVtbl->GetPlayerData(p,a,b,c,d) +#define IDirectPlay2_GetPlayerName(p,a,b,c) (p)->lpVtbl->GetPlayerName(p,a,b,c) +#define IDirectPlay2_GetSessionDesc(p,a,b) (p)->lpVtbl->GetSessionDesc(p,a,b) +#define IDirectPlay2_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlay2_Open(p,a,b) (p)->lpVtbl->Open(p,a,b) +#define IDirectPlay2_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlay2_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlay2_SetGroupData(p,a,b,c,d) (p)->lpVtbl->SetGroupData(p,a,b,c,d) +#define IDirectPlay2_SetGroupName(p,a,b,c) (p)->lpVtbl->SetGroupName(p,a,b,c) +#define IDirectPlay2_SetPlayerData(p,a,b,c,d) (p)->lpVtbl->SetPlayerData(p,a,b,c,d) +#define IDirectPlay2_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) +#define IDirectPlay2_SetSessionDesc(p,a,b) (p)->lpVtbl->SetSessionDesc(p,a,b) + +#else /* C++ */ + +#define IDirectPlay2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay2_AddRef(p) (p)->AddRef() +#define IDirectPlay2_Release(p) (p)->Release() +#define IDirectPlay2_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlay2_Close(p) (p)->Close() +#define IDirectPlay2_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlay2_CreatePlayer(p,a,b,c,d,e,f) (p)->CreatePlayer(a,b,c,d,e,f) +#define IDirectPlay2_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlay2_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlay2_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlay2_EnableNewPlayers(p,a) (p)->EnableNewPlayers(a) +#define IDirectPlay2_EnumGroupPlayers(p,a,b,c,d,e) (p)->EnumGroupPlayers(a,b,c,d,e) +#define IDirectPlay2_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlay2_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlay2_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlay2_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlay2_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlay2_GetGroupData(p,a,b,c,d) (p)->GetGroupData(a,b,c,d) +#define IDirectPlay2_GetGroupName(p,a,b,c) (p)->GetGroupName(a,b,c) +#define IDirectPlay2_GetPlayerAddress(p,a,b,c) (p)->GetPlayerAddress(a,b,c) +#define IDirectPlay2_GetPlayerCaps(p,a,b,c) (p)->GetPlayerCaps(a,b,c) +#define IDirectPlay2_GetPlayerData(p,a,b,c,d) (p)->GetPlayerData(a,b,c,d) +#define IDirectPlay2_GetPlayerName(p,a,b,c) (p)->GetPlayerName(a,b,c) +#define IDirectPlay2_GetSessionDesc(p,a,b) (p)->GetSessionDesc(a,b) +#define IDirectPlay2_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlay2_Open(p,a,b) (p)->Open(a,b) +#define IDirectPlay2_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlay2_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlay2_SetGroupData(p,a,b,c,d) (p)->SetGroupData(a,b,c,d) +#define IDirectPlay2_SetGroupName(p,a,b,c) (p)->SetGroupName(a,b,c) +#define IDirectPlay2_SetPlayerData(p,a,b,c,d) (p)->SetPlayerData(a,b,c,d) +#define IDirectPlay2_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) +#define IDirectPlay2_SetSessionDesc(p,a,b) (p)->SetSessionDesc(a,b) + +#endif + +/**************************************************************************** + * + * EnumPlayers API flags + * + ****************************************************************************/ + +/* + * Enumerate all players in the current session + */ +#define DPENUMPLAYERS_ALL 0x00000000 + +/* + * Enumerate only local (created by this application) players + */ +#define DPENUMPLAYERS_LOCAL 0x00000008 + +/* + * Enumerate only remote (non-local) players + */ +#define DPENUMPLAYERS_REMOTE 0x00000010 + +/* + * Enumerate groups along with the players + */ +#define DPENUMPLAYERS_GROUP 0x00000020 + +/* + * Enumerate players in another session (must supply lpguidInstance) + */ +#define DPENUMPLAYERS_SESSION 0x00000080 + + +/**************************************************************************** + * + * EnumSessions API flags + * + ****************************************************************************/ + +/* + * Enumerate sessions which can be joined + */ +#define DPENUMSESSIONS_AVAILABLE 0x00000001 + +/* + * Enumerate all sessions even if they can't be joined. + */ +#define DPENUMSESSIONS_ALL 0x00000002 + + + + + +/**************************************************************************** + * + * GetCaps and GetPlayerCaps API flags + * + ****************************************************************************/ + +/* + * The latency returned should be for guaranteed message sending. + * Default is non-guaranteed messaging. + */ +#define DPGETCAPS_GUARANTEED 0x00000001 + + +/**************************************************************************** + * + * GetGroupData, GetPlayerData API flags + * Remote and local Group/Player data is maintained separately. + * Default is DPGET_REMOTE. + * + ****************************************************************************/ + +/* + * Get the remote data (set by any DirectPlay object in + * the session using DPSET_REMOTE) + */ +#define DPGET_REMOTE 0x00000000 + +/* + * Get the local data (set by this DirectPlay object + * using DPSET_LOCAL) + */ +#define DPGET_LOCAL 0x00000001 + + +/**************************************************************************** + * + * Open API flags + * + ****************************************************************************/ + +/* + * Join the session that is described by the DPSESSIONDESC2 structure + */ +#define DPOPEN_JOIN 0x00000001 + +/* + * Create a new session as described by the DPSESSIONDESC2 structure + */ +#define DPOPEN_CREATE 0x00000002 + +/**************************************************************************** + * + * Receive API flags + * Default is DPRECEIVE_ALL + * + ****************************************************************************/ + +/* + * Get the first message in the queue + */ +#define DPRECEIVE_ALL 0x00000001 + +/* + * Get the first message in the queue directed to a specific player + */ +#define DPRECEIVE_TOPLAYER 0x00000002 + +/* + * Get the first message in the queue from a specific player + */ +#define DPRECEIVE_FROMPLAYER 0x00000004 + +/* + * Get the message but don't remove it from the queue + */ +#define DPRECEIVE_PEEK 0x00000008 + + +/**************************************************************************** + * + * Send API flags + * + ****************************************************************************/ + +/* + * Send the message using a guaranteed send method. + * Default is non-guaranteed. + */ +#define DPSEND_GUARANTEED 0x00000001 + +/* + * Send the message high-priority. Move to front of + * send queue of sender and the receive queue of the + * receipient + */ +#define DPSEND_HIGHPRIORITY 0x00000002 + +/* + * Application will be sending several more guaranteed messages to + * this player so the service provider may want to optimize for this. + * Implementation of this flag by a service provider is optional. + */ +#define DPSEND_OPENSTREAM 0x00000008 + +/* + * The optimization requested by DPSEND_OPENSTREAM is no longer + * needed. Resources allocated for DPSEND_OPENSTREAM may be released. + */ +#define DPSEND_CLOSESTREAM 0x00000010 + + +/**************************************************************************** + * + * SetGroupData, SetGroupName, SetPlayerData, SetPlayerName, + * SetSessionDesc API flags. + * Default is DPSET_REMOTE. + * + ****************************************************************************/ + +/* + * Propagate the data to all players in the session + */ +#define DPSET_REMOTE 0x00000000 + +/* + * Do not propagate the data to other players + */ +#define DPSET_LOCAL 0x00000001 + +/* + * Used with DPSET_REMOTE, use guaranteed message send to + * propagate the data + */ +#define DPSET_GUARANTEED 0x00000002 + + +/**************************************************************************** + * + * DirectPlay system messages and message data structures + * + * All system message come 'From' player DPID_SYSMSG. To determine what type + * of message it is, cast the lpData from Receive to DPMSG_GENERIC and check + * the dwType member against one of the following DPSYS_xxx constants. Once + * a match is found, cast the lpData to the corresponding of the DPMSG_xxx + * structures to access the data of the message. + * + ****************************************************************************/ + +/* + * A new player or group has been created in the session + * Use DPMSG_CREATEPLAYERORGROUP. Check dwPlayerType to see if it + * is a player or a group. + */ +#define DPSYS_CREATEPLAYERORGROUP 0x0003 + +/* + * A player has been deleted from the session + * Use DPMSG_DESTROYPLAYERORGROUP + */ +#define DPSYS_DESTROYPLAYERORGROUP 0x0005 + +/* + * A player has been added to a group + * Use DPMSG_ADDPLAYERTOGROUP + */ +#define DPSYS_ADDPLAYERTOGROUP 0x0007 + +/* + * A player has been removed from a group + * Use DPMSG_DELETEPLAYERFROMGROUP + */ +#define DPSYS_DELETEPLAYERFROMGROUP 0x0021 + +/* + * This DirectPlay object lost its connection with all the + * other players in the session. + * Use DPMSG_SESSIONLOST. + */ +#define DPSYS_SESSIONLOST 0x0031 + +/* + * The current host has left the session. + * This DirectPlay object is now the host. + * Use DPMSG_HOST. + */ +#define DPSYS_HOST 0x0101 + +/* + * The remote data associated with a player or + * group has changed. Check dwPlayerType to see + * if it is a player or a group + * Use DPMSG_SETPLAYERORGROUPDATA + */ +#define DPSYS_SETPLAYERORGROUPDATA 0x0102 + +/* + * The name of a player or group has changed. + * Check dwPlayerType to see if it is a player + * or a group. + * Use DPMSG_SETPLAYERORGROUPNAME + */ +#define DPSYS_SETPLAYERORGROUPNAME 0x0103 + +/* + * Used in the dwPlayerType field to indicate if it applies to a group + * or a player + */ +#define DPPLAYERTYPE_GROUP 0x00000000 +#define DPPLAYERTYPE_PLAYER 0x00000001 + +/* + * DPMSG_GENERIC + * Generic message structure used to identify the message type. + */ +typedef struct +{ + DWORD dwType; // Message type +} DPMSG_GENERIC, FAR *LPDPMSG_GENERIC; + +/* + * DPMSG_CREATEPLAYERORGROUP + * System message generated when a new player or group + * created in the session with information about it. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // ID of the player or group + DWORD dwCurrentPlayers; // current # players & groups in session + LPVOID lpData; // pointer to remote data + DWORD dwDataSize; // size of remote data + DPNAME dpnName; // structure with name info +} DPMSG_CREATEPLAYERORGROUP, FAR *LPDPMSG_CREATEPLAYERORGROUP; + +/* + * DPMSG_DESTROYPLAYERORGROUP + * System message generated when a player or group is being + * destroyed in the session with information about it. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // player ID being deleted + LPVOID lpLocalData; // copy of players local data + DWORD dwLocalDataSize; // sizeof local data + LPVOID lpRemoteData; // copy of players remote data + DWORD dwRemoteDataSize; // sizeof remote data +} DPMSG_DESTROYPLAYERORGROUP, FAR *LPDPMSG_DESTROYPLAYERORGROUP; + +/* + * DPMSG_ADDPLAYERTOGROUP + * System message generated when a player is being added + * to a group. + */ +typedef struct +{ + DWORD dwType; // Message type + DPID dpIdGroup; // group ID being added to + DPID dpIdPlayer; // player ID being added +} DPMSG_ADDPLAYERTOGROUP, FAR *LPDPMSG_ADDPLAYERTOGROUP; + +/* + * DPMSG_DELETEPLAYERFROMGROUP + * System message generated when a player is being + * removed from a group + */ +typedef DPMSG_ADDPLAYERTOGROUP DPMSG_DELETEPLAYERFROMGROUP; +typedef DPMSG_DELETEPLAYERFROMGROUP FAR *LPDPMSG_DELETEPLAYERFROMGROUP; + +/* + * DPMSG_SETPLAYERORGROUPDATA + * System message generated when remote data for a player or + * group has changed. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // ID of player or group + LPVOID lpData; // pointer to remote data + DWORD dwDataSize; // size of remote data +} DPMSG_SETPLAYERORGROUPDATA, FAR *LPDPMSG_SETPLAYERORGROUPDATA; + +/* + * DPMSG_SETPLAYERORGROUPNAME + * System message generated when the name of a player or + * group has changed. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // ID of player or group + DPNAME dpnName; // structure with new name info +} DPMSG_SETPLAYERORGROUPNAME, FAR *LPDPMSG_SETPLAYERORGROUPNAME; + +/* + * DPMSG_HOST + * System message generated when the host has migrated to this + * DirectPlay object. + * + */ +typedef DPMSG_GENERIC DPMSG_HOST; +typedef DPMSG_HOST FAR *LPDPMSG_HOST; + +/* + * DPMSG_SESSIONLOST + * System message generated when the connection to the session is lost. + * + */ +typedef DPMSG_GENERIC DPMSG_SESSIONLOST; +typedef DPMSG_SESSIONLOST FAR *LPDPMSG_SESSIONLOST; + +/**************************************************************************** + * + * DIRECTPLAY ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************/ +#define DP_OK S_OK +#define DPERR_ALREADYINITIALIZED MAKE_DPHRESULT( 5 ) +#define DPERR_ACCESSDENIED MAKE_DPHRESULT( 10 ) +#define DPERR_ACTIVEPLAYERS MAKE_DPHRESULT( 20 ) +#define DPERR_BUFFERTOOSMALL MAKE_DPHRESULT( 30 ) +#define DPERR_CANTADDPLAYER MAKE_DPHRESULT( 40 ) +#define DPERR_CANTCREATEGROUP MAKE_DPHRESULT( 50 ) +#define DPERR_CANTCREATEPLAYER MAKE_DPHRESULT( 60 ) +#define DPERR_CANTCREATESESSION MAKE_DPHRESULT( 70 ) +#define DPERR_CAPSNOTAVAILABLEYET MAKE_DPHRESULT( 80 ) +#define DPERR_EXCEPTION MAKE_DPHRESULT( 90 ) +#define DPERR_GENERIC E_FAIL +#define DPERR_INVALIDFLAGS MAKE_DPHRESULT( 120 ) +#define DPERR_INVALIDOBJECT MAKE_DPHRESULT( 130 ) +#define DPERR_INVALIDPARAM E_INVALIDARG +#define DPERR_INVALIDPARAMS DPERR_INVALIDPARAM +#define DPERR_INVALIDPLAYER MAKE_DPHRESULT( 150 ) +#define DPERR_NOCAPS MAKE_DPHRESULT( 160 ) +#define DPERR_NOCONNECTION MAKE_DPHRESULT( 170 ) +#define DPERR_NOMEMORY E_OUTOFMEMORY +#define DPERR_OUTOFMEMORY DPERR_NOMEMORY +#define DPERR_NOMESSAGES MAKE_DPHRESULT( 190 ) +#define DPERR_NONAMESERVERFOUND MAKE_DPHRESULT( 200 ) +#define DPERR_NOPLAYERS MAKE_DPHRESULT( 210 ) +#define DPERR_NOSESSIONS MAKE_DPHRESULT( 220 ) +#define DPERR_SENDTOOBIG MAKE_DPHRESULT( 230 ) +#define DPERR_TIMEOUT MAKE_DPHRESULT( 240 ) +#define DPERR_UNAVAILABLE MAKE_DPHRESULT( 250 ) +#define DPERR_UNSUPPORTED E_NOTIMPL +#define DPERR_BUSY MAKE_DPHRESULT( 270 ) +#define DPERR_USERCANCEL MAKE_DPHRESULT( 280 ) +#define DPERR_NOINTERFACE E_NOINTERFACE +#define DPERR_CANNOTCREATESERVER MAKE_DPHRESULT( 290 ) +#define DPERR_PLAYERLOST MAKE_DPHRESULT( 300 ) +#define DPERR_SESSIONLOST MAKE_DPHRESULT( 310 ) + + +#define DPERR_BUFFERTOOLARGE MAKE_DPHRESULT( 1000 ) +#define DPERR_CANTCREATEPROCESS MAKE_DPHRESULT( 1010 ) +#define DPERR_APPNOTSTARTED MAKE_DPHRESULT( 1020 ) +#define DPERR_INVALIDINTERFACE MAKE_DPHRESULT( 1030 ) +#define DPERR_NOSERVICEPROVIDER MAKE_DPHRESULT( 1040 ) +#define DPERR_UNKNOWNAPPLICATION MAKE_DPHRESULT( 1050 ) +#define DPERR_NOTLOBBIED MAKE_DPHRESULT( 1070 ) + + +/**************************************************************************** + * + * dplay 1.0 obsolete structures + interfaces + * Included for compatibility only. New apps should + * use IDirectPlay2 + * + ****************************************************************************/ + +// define this to ignore obsolete interfaces and constants +#ifndef IDIRECTPLAY2_OR_GREATER + +#define DPOPEN_OPENSESSION DPOPEN_JOIN +#define DPOPEN_CREATESESSION DPOPEN_CREATE + +#define DPENUMSESSIONS_PREVIOUS 0x00000004 + +#define DPENUMPLAYERS_PREVIOUS 0x00000004 + +#define DPSEND_GUARANTEE DPSEND_GUARANTEED +#define DPSEND_TRYONCE 0x00000004 + +#define DPCAPS_NAMESERVICE 0x00000001 +#define DPCAPS_NAMESERVER DPCAPS_ISHOST +#define DPCAPS_GUARANTEED 0x00000004 + +#define DPLONGNAMELEN 52 +#define DPSHORTNAMELEN 20 +#define DPSESSIONNAMELEN 32 +#define DPPASSWORDLEN 16 +#define DPUSERRESERVED 16 + +#define DPSYS_ADDPLAYER 0x0003 +#define DPSYS_DELETEPLAYER 0x0005 + +#define DPSYS_DELETEGROUP 0x0020 +#define DPSYS_DELETEPLAYERFROMGRP 0x0021 +#define DPSYS_CONNECT 0x484b + +typedef struct +{ + DWORD dwType; + DWORD dwPlayerType; + DPID dpId; + char szLongName[DPLONGNAMELEN]; + char szShortName[DPSHORTNAMELEN]; + DWORD dwCurrentPlayers; +} DPMSG_ADDPLAYER; + +typedef DPMSG_ADDPLAYER DPMSG_ADDGROUP; + +typedef struct +{ + DWORD dwType; + DPID dpIdGroup; + DPID dpIdPlayer; +} DPMSG_GROUPADD; + +typedef DPMSG_GROUPADD DPMSG_GROUPDELETE; +typedef struct +{ + DWORD dwType; + DPID dpId; +} DPMSG_DELETEPLAYER; + +typedef BOOL (PASCAL *LPDPENUMPLAYERSCALLBACK)( + DPID dpId, + LPSTR lpFriendlyName, + LPSTR lpFormalName, + DWORD dwFlags, + LPVOID lpContext ); + +typedef struct +{ + DWORD dwSize; + GUID guidSession; + DWORD dwSession; + DWORD dwMaxPlayers; + DWORD dwCurrentPlayers; + DWORD dwFlags; + char szSessionName[DPSESSIONNAMELEN]; + char szUserField[DPUSERRESERVED]; + DWORD dwReserved1; + char szPassword[DPPASSWORDLEN]; + DWORD dwReserved2; + DWORD dwUser1; + DWORD dwUser2; + DWORD dwUser3; + DWORD dwUser4; +} DPSESSIONDESC,*LPDPSESSIONDESC; + +typedef BOOL (PASCAL * LPDPENUMSESSIONSCALLBACK)( + LPDPSESSIONDESC lpDPSessionDesc, + LPVOID lpContext, + LPDWORD lpdwTimeOut, + DWORD dwFlags); + +/* + * IDirectPlay + */ +#undef INTERFACE +#define INTERFACE IDirectPlay +DECLARE_INTERFACE_( IDirectPlay, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPSTR,LPSTR,LPHANDLE) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPSTR,LPSTR) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(EnableNewPlayers) (THIS_ BOOL) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ DWORD, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ DWORD, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC,DWORD,LPDPENUMSESSIONSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID, LPDPCAPS) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPSTR,LPDWORD,LPSTR,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(SaveSession) (THIS_ LPSTR) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPSTR,LPSTR) PURE; +}; + +/**************************************************************************** + * + * IDirectPlay interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlay_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlay_CreateGroup(p,a,b,c) (p)->lpVtbl->CreateGroup(p,a,b,c) +#define IDirectPlay_CreatePlayer(p,a,b,c,d) (p)->lpVtbl->CreatePlayer(p,a,b,c,d) +#define IDirectPlay_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlay_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlay_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlay_EnableNewPlayers(p,a) (p)->lpVtbl->EnableNewPlayers(p,a) +#define IDirectPlay_EnumGroupPlayers(p,a,b,c,d) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d) +#define IDirectPlay_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlay_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlay_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlay_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectPlay_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlay_GetPlayerCaps(p,a,b) (p)->lpVtbl->GetPlayerCaps(p,a,b) +#define IDirectPlay_GetPlayerName(p,a,b,c,d,e) (p)->lpVtbl->GetPlayerName(p,a,b,c,d,e) +#define IDirectPlay_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlay_Open(p,a) (p)->lpVtbl->Open(p,a) +#define IDirectPlay_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlay_SaveSession(p,a) (p)->lpVtbl->SaveSession(p,a) +#define IDirectPlay_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlay_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) + +#else /* C++ */ + +#define IDirectPlay_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlay_Close(p) (p)->Close() +#define IDirectPlay_CreateGroup(p,a,b,c) (p)->CreateGroup(a,b,c) +#define IDirectPlay_CreatePlayer(p,a,b,c,d) (p)->CreatePlayer(a,b,c,d) +#define IDirectPlay_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlay_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlay_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlay_EnableNewPlayers(p,a) (p)->EnableNewPlayers(a) +#define IDirectPlay_EnumGroupPlayers(p,a,b,c,d) (p)->EnumGroupPlayers(a,b,c,d) +#define IDirectPlay_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlay_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlay_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlay_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectPlay_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlay_GetPlayerCaps(p,a,b) (p)->GetPlayerCaps(a,b) +#define IDirectPlay_GetPlayerName(p,a,b,c,d,e) (p)->GetPlayerName(a,b,c,d,e) +#define IDirectPlay_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlay_Open(p,a) (p)->Open(a) +#define IDirectPlay_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlay_SaveSession(p,a) (p)->SaveSession(a) +#define IDirectPlay_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlay_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) + +#endif + +DEFINE_GUID(IID_IDirectPlay, 0x5454e9a0, 0xdb65, 0x11ce, 0x92, 0x1c, 0x00, 0xaa, 0x00, 0x6c, 0x49, 0x72); + +#endif // IDIRECTPLAY2_OR_GREATER + +/**************************************************************************** + * + * IDirectPlay macros (included regardless of IDIRECTPLAY2_OR_GREATER flag) + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay_Release(p) (p)->lpVtbl->Release(p) + +#else + +#define IDirectPlay_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay_AddRef(p) (p)->AddRef() +#define IDirectPlay_Release(p) (p)->Release() + +#endif // IDirectPlay interface macros + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/sdk/inc/dplobby.h b/sdk/inc/dplobby.h new file mode 100644 index 0000000..c71d72b --- /dev/null +++ b/sdk/inc/dplobby.h @@ -0,0 +1,381 @@ +/*==========================================================================; + * + * Copyright (C) 1996 Microsoft Corporation. All Rights Reserved. + * + * File: dplobby.h + * Content: DirectPlayLobby include file + ***************************************************************************/ +#ifndef __DPLOBBY_INCLUDED__ +#define __DPLOBBY_INCLUDED__ + +#include "dplay.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * GUIDS used by DirectPlay objects + */ + +/* {AF465C71-9588-11cf-A020-00AA006157AC} */ +DEFINE_GUID(IID_IDirectPlayLobby, 0xaf465c71, 0x9588, 0x11cf, 0xa0, 0x20, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac); +/* {26C66A70-B367-11cf-A024-00AA006157AC} */ +DEFINE_GUID(IID_IDirectPlayLobbyA, 0x26c66a70, 0xb367, 0x11cf, 0xa0, 0x24, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac); + + + +/**************************************************************************** + * + * IDirectPlayLobby Structures + * + * Various structures used to invoke DirectPlayLobby. + * + ****************************************************************************/ + +typedef struct IDirectPlayLobby FAR *LPDIRECTPLAYLOBBY; +typedef struct IDirectPlayLobby FAR *LPDIRECTPLAYLOBBYA; +typedef struct IDirectPlayLobby IDirectPlayLobbyA; + + +/* + * DPLCONNECTION + * Used to hold all in the informaion needed to connect + * an application to a session or create a session + */ +typedef struct DPLCONNECTION +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags specific to this structure + LPDPSESSIONDESC2 lpSessionDesc; // Pointer to session desc to use on connect + LPDPNAME lpPlayerName; // Pointer to Player name structure + GUID guidSP; // GUID of the DPlay SP to use + LPVOID lpAddress; // Address for service provider + DWORD dwAddressSize; // Size of address data +} DPLCONNECTION, FAR *LPDPLCONNECTION; + +/* + * LPCDPLCONNECTION + * A constant pointer to DPLCONNECTION + */ +typedef const DPLCONNECTION FAR *LPCDPLCONNECTION; + +/* + * This application should create a new session as + * described by the DPSESIONDESC structure + */ +#define DPLCONNECTION_CREATESESSION DPOPEN_CREATE + +/* + * This application should join the session described by + * the DPSESIONDESC structure with the lpAddress data + */ +#define DPLCONNECTION_JOINSESSION DPOPEN_JOIN + + +/* + * DPLAPPINFO + * Used to hold information about a registered DirectPlay + * application + */ +typedef struct DPLAPPINFO +{ + DWORD dwSize; // Size of this structure + GUID guidApplication; // GUID of the Application + union + { + LPSTR lpszAppNameA; // Pointer to the Application Name + LPWSTR lpszAppName; + }; + +} DPLAPPINFO, FAR *LPDPLAPPINFO; + +/* + * LPCDPLAPPINFO + * A constant pointer to DPLAPPINFO + */ +typedef const DPLAPPINFO FAR *LPCDPLAPPINFO; + +/**************************************************************************** + * + * Enumeration Method Callback Prototypes + * + ****************************************************************************/ + +/* + * Callback for EnumAddress() + */ +typedef BOOL (FAR PASCAL *LPDPENUMADDRESSCALLBACK)( + REFGUID guidDataType, + DWORD dwDataSize, + LPCVOID lpData, + LPVOID lpContext); + +/* + * Callback for EnumAddressTypes() + */ +typedef BOOL (FAR PASCAL *LPDPLENUMADDRESSTYPESCALLBACK)( + REFGUID guidDataType, + LPVOID lpContext, + DWORD dwFlags); + +/* + * Callback for EnumLocalApplications() + */ +typedef BOOL (FAR PASCAL * LPDPLENUMLOCALAPPLICATIONSCALLBACK)( + LPCDPLAPPINFO lpAppInfo, + LPVOID lpContext, + DWORD dwFlags); + + +/**************************************************************************** + * + * DirectPlayLobby API Prototypes + * + ****************************************************************************/ +#ifdef UNICODE +#define DirectPlayLobbyCreate DirectPlayLobbyCreateW +#else +#define DirectPlayLobbyCreate DirectPlayLobbyCreateA +#endif /* UNICODE */ + +extern HRESULT WINAPI DirectPlayLobbyCreateW(LPGUID, LPDIRECTPLAYLOBBY *, IUnknown *, LPVOID, DWORD ); +extern HRESULT WINAPI DirectPlayLobbyCreateA(LPGUID, LPDIRECTPLAYLOBBYA *, IUnknown *, LPVOID, DWORD ); + + +/**************************************************************************** + * + * IDirectPlayLobby (and IDirectPlayLobbyA) Interface + * + ****************************************************************************/ +#undef INTERFACE +#define INTERFACE IDirectPlayLobby +DECLARE_INTERFACE_( IDirectPlayLobby, IUnknown ) +{ + /* IUnknown Methods */ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /* IDirectPlayLobby Methods */ + STDMETHOD(Connect) (THIS_ DWORD, LPDIRECTPLAY2 *, IUnknown FAR *) PURE; + STDMETHOD(CreateAddress) (THIS_ REFGUID, REFGUID, LPCVOID, DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(EnumAddress) (THIS_ LPDPENUMADDRESSCALLBACK, LPCVOID, DWORD, LPVOID) PURE; + STDMETHOD(EnumAddressTypes) (THIS_ LPDPLENUMADDRESSTYPESCALLBACK, REFGUID, LPVOID, DWORD) PURE; + STDMETHOD(EnumLocalApplications)(THIS_ LPDPLENUMLOCALAPPLICATIONSCALLBACK, LPVOID, DWORD) PURE; + STDMETHOD(GetConnectionSettings)(THIS_ DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(ReceiveLobbyMessage) (THIS_ DWORD, DWORD, LPDWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(RunApplication) (THIS_ DWORD, LPDWORD, LPDPLCONNECTION, HANDLE) PURE; + STDMETHOD(SendLobbyMessage) (THIS_ DWORD, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetConnectionSettings)(THIS_ DWORD, DWORD, LPDPLCONNECTION) PURE; + STDMETHOD(SetLobbyMessageEvent) (THIS_ DWORD, DWORD, HANDLE) PURE; + +}; + +/**************************************************************************** + * + * IDirectPlayLobby interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlayLobby_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayLobby_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayLobby_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlayLobby_Connect(p,a,b,c) (p)->lpVtbl->Connect(p,a,b,c) +#define IDirectPlayLobby_CreateAddress(p,a,b,c,d,e,f) (p)->lpVtbl->CreateAddress(p,a,b,c,d,e,f) +#define IDirectPlayLobby_EnumAddress(p,a,b,c,d) (p)->lpVtbl->EnumAddress(p,a,b,c,d) +#define IDirectPlayLobby_EnumAddressTypes(p,a,b,c,d) (p)->lpVtbl->EnumAddressTypes(p,a,b,c,d) +#define IDirectPlayLobby_EnumLocalApplications(p,a,b,c) (p)->lpVtbl->EnumLocalApplications(p,a,b,c) +#define IDirectPlayLobby_GetConnectionSettings(p,a,b,c) (p)->lpVtbl->GetConnectionSettings(p,a,b,c) +#define IDirectPlayLobby_ReceiveLobbyMessage(p,a,b,c,d,e) (p)->lpVtbl->ReceiveLobbyMessage(p,a,b,c,d,e) +#define IDirectPlayLobby_RunApplication(p,a,b,c,d) (p)->lpVtbl->RunApplication(p,a,b,c,d) +#define IDirectPlayLobby_SendLobbyMessage(p,a,b,c,d) (p)->lpVtbl->SendLobbyMessage(p,a,b,c,d) +#define IDirectPlayLobby_SetConnectionSettings(p,a,b,c) (p)->lpVtbl->SetConnectionSettings(p,a,b,c) +#define IDirectPlayLobby_SetLobbyMessageEvent(p,a,b,c) (p)->lpVtbl->SetLobbyMessageEvent(p,a,b,c) + +#else /* C++ */ + +#define IDirectPlayLobby_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayLobby_AddRef(p) (p)->AddRef() +#define IDirectPlayLobby_Release(p) (p)->Release() +#define IDirectPlayLobby_Connect(p,a,b,c) (p)->Connect(a,b,c) +#define IDirectPlayLobby_CreateAddress(p,a,b,c,d,e,f) (p)->CreateAddress(a,b,c,d,e,f) +#define IDirectPlayLobby_EnumAddress(p,a,b,c,d) (p)->EnumAddress(a,b,c,d) +#define IDirectPlayLobby_EnumAddressTypes(p,a,b,c,d) (p)->EnumAddressTypes(a,b,c,d) +#define IDirectPlayLobby_EnumLocalApplications(p,a,b,c) (p)->EnumLocalApplications(a,b,c) +#define IDirectPlayLobby_GetConnectionSettings(p,a,b,c) (p)->GetConnectionSettings(a,b,c) +#define IDirectPlayLobby_ReceiveLobbyMessage(p,a,b,c,d,e) (p)->ReceiveLobbyMessage(a,b,c,d,e) +#define IDirectPlayLobby_RunApplication(p,a,b,c,d) (p)->RunApplication(a,b,c,d) +#define IDirectPlayLobby_SendLobbyMessage(p,a,b,c,d) (p)->SendLobbyMessage(a,b,c,d) +#define IDirectPlayLobby_SetConnectionSettings(p,a,b,c) (p)->SetConnectionSettings(a,b,c) +#define IDirectPlayLobby_SetLobbyMessageEvent(p,a,b,c) (p)->SetLobbyMessageEvent(a,b,c) + +#endif + +/**************************************************************************** + * + * DirectPlayLobby Flags + * + ****************************************************************************/ + +/* + * This flag is a message flag used by GetApplicationData. It can be + * returned in the dwMessageFlags parameter to indicate a message from + * the system. + */ +#define DPLAD_SYSTEM 0x00000001 + + +/**************************************************************************** + * + * DirectPlayLobby system messages and message data structures + * + * All system message have a dwMessageFlags value of DPLAD_SYSTEM returned + * from a call to GetApplicationData. + * + ****************************************************************************/ + +/* + * DPLMSG_GENERIC + * Generic message structure used to identify the message type. + */ +typedef struct DPLMSG_GENERIC +{ + DWORD dwType; // Message type +} DPLMSG_GENERIC, FAR *LPDPLMSG_GENERIC; + + +/****************************************** + * + * Sytem message dwType values + * + *****************************************/ + +/* + * The application has read the connection settings. + * It is now O.K. for the lobby client to release + * its IDirectPlayLobby interface. + */ +#define DPLSYS_CONNECTIONSETTINGSREAD 0x00000001 + +/* + * The application's call to DirectPlayConnect failed + */ +#define DPLSYS_DPLAYCONNECTFAILED 0x00000002 + +/* + * The application has created a DirectPlay session. + */ +#define DPLSYS_DPLAYCONNECTSUCCEEDED 0x00000003 + +/* + * The application has terminated. + */ +#define DPLSYS_APPTERMINATED 0x00000004 + + +/**************************************************************************** + * + * DirectPlay Address ID's + * + ****************************************************************************/ + +/* DirectPlay Address + * + * A DirectPlay address consists of multiple chunks of data, each tagged + * with a GUID signifying the type of data in the chunk. The chunk also + * has a length so that unknown chunk types can be skipped. + * + * The EnumAddress() function is used to parse these address data chunks. + * The address data is passed to the SPInit method in the lpAddress field + * and the size is passed in the dwAddressSize field. These parameters are + * then passed to EnumAddress() to enumerate the tags. + */ + +/* + * DPADDRESS + * + * Header for block of address data elements + */ +typedef struct _DPADDRESS +{ + GUID guidDataType; + DWORD dwDataSize; +} DPADDRESS; + +typedef DPADDRESS FAR* LPDPADDRESS; + + /* + * DPAID_ServiceProvider + * + * Chunk is a GUID describing the service provider that created the chunk. + * All addresses must contain this chunk. + */ + +// {07D916C0-E0AF-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPAID_ServiceProvider, +0x7d916c0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/* + * DPAID_Phone + * + * Chunk is a string containing a phone number (i.e. "1-800-555-1212") + */ + +// {78EC89A0-E0AF-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPAID_Phone, +0x78ec89a0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/* + * DPAID_Inet + * + * Chunk is a string containing a TCP/IP host name or an IP address + *(i.e. "dplay.microsoft.com" or "137.55.100.173") + */ + +// {C4A54DA0-E0AF-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPAID_INet, +0xc4a54da0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/* + * DPCOMPORTADDRESS + * + * Used to specify com port settings. The constants that define baud rate, + * stop bits and parity are defined in WINBASE.H. The constants for flow + * control are given below. + */ + +#define DPCPA_NOFLOW 0 // no flow control +#define DPCPA_XONXOFFFLOW 1 // software flow control +#define DPCPA_RTSFLOW 2 // hardware flow control with RTS +#define DPCPA_DTRFLOW 3 // hardware flow control with DTR +#define DPCPA_RTSDTRFLOW 4 // hardware flow control with RTS and DTR + +typedef struct _DPCOMPORTADDRESS +{ + DWORD dwComPort; // COM port to use (1-4) + DWORD dwBaudRate; // baud rate (100-256k) + DWORD dwStopBits; // no. stop bits (1-2) + DWORD dwParity; // parity (none, odd, even, mark) + DWORD dwFlowControl; // flow control (none, xon/xoff, rts, dtr) +} DPCOMPORTADDRESS; + +typedef DPCOMPORTADDRESS FAR* LPDPCOMPORTADDRESS; + +/* + * DPAID_ComPort + * + * Chunk contains a DPCOMPORTADDRESS structure defining the serial port. + */ + +// {F2F0CE00-E0AF-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPAID_ComPort, +0xf2f0ce00, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +#ifdef __cplusplus +}; +#endif /* __cplusplus */ + +#endif /* __DPLOBBY_INCLUDED__ */ diff --git a/sdk/inc/dsetup.h b/sdk/inc/dsetup.h new file mode 100644 index 0000000..1041ec2 --- /dev/null +++ b/sdk/inc/dsetup.h @@ -0,0 +1,226 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: dsetup.h + * Content: DirectXSetup, error codes and flags + ***************************************************************************/ + +#ifndef __DSETUP_H__ +#define __DSETUP_H__ + +#ifdef _WIN32 +#define COM_NO_WINDOWS_H +#include <objbase.h> +#else +#define GUID void +#define LPGUID LPVOID +#define LPWSTR LPSTR +#define INT int +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// +// Setup Error Codes +// +#define DSETUPERR_BADWINDOWSVERSION -1 +#define DSETUPERR_SOURCEFILENOTFOUND -2 +#define DSETUPERR_BADSOURCESIZE -3 +#define DSETUPERR_BADSOURCETIME -4 +#define DSETUPERR_NOCOPY -5 +#define DSETUPERR_OUTOFDISKSPACE -6 +#define DSETUPERR_CANTFINDINF -7 +#define DSETUPERR_CANTFINDDIR -8 +#define DSETUPERR_INTERNAL -9 +//#define DSETUPERR_NTWITHNO3D -10 // obsolete, see docs +#define DSETUPERR_UNKNOWNOS -11 +#define DSETUPERR_USERHITCANCEL -12 +#define DSETUPERR_NOTPREINSTALLEDONNT -13 + + +// +// String Constants +// +#define MAX_INFLINE (16*1024) +#define MAX_DESCRIPTION 256 + +// +// DSETUP Flags +// +#define DSETUP_DDRAW 0x00000001 /* install DirectDraw */ +#define DSETUP_DSOUND 0x00000002 /* install DirectSound */ +#define DSETUP_DPLAY 0x00000004 /* install DirectPlay */ +#define DSETUP_DDRAWDRV 0x00000008 /* install DirectDraw Drivers */ +#define DSETUP_DSOUNDDRV 0x00000010 /* install DirectSound Drivers */ +#define DSETUP_DPLAYSP 0x00000020 /* install DirectPlay Providers */ +#define DSETUP_DVIDEO 0x00000040 /* install DirectVideo */ + +#define DSETUP_D3D 0x00000200 /* install Direct3D */ +// +// This flag is obsolete. +// For NT, we now return either 0 for pre installed or +// DSETUPERR_NOTPREINSTALLEDONNT which implies this version of DirectX +// is not installed on this machine. +// +//#define DSETUP_REQUIRESD3D 0x00000400 | DSETUP_D3D /* install Direct3D, pop up dialog box on NT, if no D3D present */ +#define DSETUP_DINPUT 0x00000800 /* install DirectInput */ +#define DSETUP_DIRECTXSETUP 0x00001000 /* install DirectXSetup DLL's */ +#define DSETUP_PROMPTFORDRIVERS 0x10000000 /* prompt when replacing display/audio drivers */ +#define DSETUP_RESTOREDRIVERS 0x20000000 /* restore display/audio drivers */ + + +#define DSETUP_DIRECTX (DSETUP_D3D | DSETUP_DDRAW | DSETUP_DSOUND | \ + DSETUP_DPLAY | DSETUP_DINPUT | \ + DSETUP_DDRAWDRV | DSETUP_DSOUNDDRV | \ + DSETUP_DPLAYSP) + + +// +// Data Structures +// +#ifndef UNICODE_ONLY +typedef struct _DIRECTXREGISTERAPPA { + DWORD dwSize; + DWORD dwFlags; + LPSTR lpszApplicationName; + LPGUID lpGUID; + LPSTR lpszFilename; + LPSTR lpszCommandLine; + LPSTR lpszPath; + LPSTR lpszCurrentDirectory; +} DIRECTXREGISTERAPPA, *PDIRECTXREGISTERAPPA, *LPDIRECTXREGISTERAPPA; +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY +typedef struct _DIRECTXREGISTERAPPW { + DWORD dwSize; + DWORD dwFlags; + LPWSTR lpszApplicationName; + LPGUID lpGUID; + LPWSTR lpszFilename; + LPWSTR lpszCommandLine; + LPWSTR lpszPath; + LPWSTR lpszCurrentDirectory; +} DIRECTXREGISTERAPPW, *PDIRECTXREGISTERAPPW, *LPDIRECTXREGISTERAPPW; +#endif //!ANSI_ONLY +#ifdef UNICODE +typedef DIRECTXREGISTERAPPW DIRECTXREGISTERAPP; +typedef PDIRECTXREGISTERAPPW PDIRECTXREGISTERAPP; +typedef LPDIRECTXREGISTERAPPW LPDIRECTXREGISTERAPP; +#else +typedef DIRECTXREGISTERAPPA DIRECTXREGISTERAPP; +typedef PDIRECTXREGISTERAPPA PDIRECTXREGISTERAPP; +typedef LPDIRECTXREGISTERAPPA LPDIRECTXREGISTERAPP; +#endif // UNICODE + + +// +// API +// +#ifndef UNICODE_ONLY +INT +WINAPI +DirectXSetupA( + HWND hWnd, + LPSTR lpszRootPath, + DWORD dwFlags + ); +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY +INT +WINAPI +DirectXSetupW( + HWND hWnd, + LPWSTR lpszRootPath, + DWORD dwFlags + ); +#endif //!ANSI_ONLY +#ifdef UNICODE +#define DirectXSetup DirectXSetupW +#else +#define DirectXSetup DirectXSetupA +#endif // !UNICODE + +#ifndef UNICODE_ONLY +INT +WINAPI +DirectXDeviceDriverSetupA( + HWND hWnd, + LPSTR lpszDriverClass, + LPSTR lpszINFPath, + LPSTR lpszDriverPath, + DWORD dwFlags + ); +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY +INT +WINAPI +DirectXDeviceDriverSetupW( + HWND hWnd, + LPWSTR lpszDriverClass, + LPWSTR lpszINFPath, + LPWSTR lpszDriverPath, + DWORD dwFlags + ); +#endif //!ANSI_ONLY +#ifdef UNICODE +#define DirectXDeviceDriverSetup DirectXDeviceDriverSetupW +#else +#define DirectXDeviceDriverSetup DirectXDeviceDriverSetupA +#endif // !UNICODE + +#ifndef UNICODE_ONLY +INT +WINAPI +DirectXRegisterApplicationA( + HWND hWnd, + LPDIRECTXREGISTERAPPA lpDXRegApp + ); +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY +INT +WINAPI +DirectXRegisterApplicationW( + HWND hWnd, + LPDIRECTXREGISTERAPPW lpDXRegApp + ); +#endif //!ANSI_ONLY +#ifdef UNICODE +#define DirectXRegisterApplication DirectXRegisterApplicationW +#else +#define DirectXRegisterApplication DirectXRegisterApplicationA +#endif // !UNICODE + +INT +WINAPI +DirectXSetupIsJapan( void ); + +INT +WINAPI +DirectXSetupIsJapanNec( void ); + + +// +// Function Pointers +// +#ifdef UNICODE +typedef INT (WINAPI * LPDIRECTXSETUP)(HWND, LPWSTR, DWORD); +typedef INT (WINAPI * LPDIRECTXDEVICEDRIVERSETUP)(HWND, LPWSTR, LPSTR, LPSTR, DWORD); +typedef INT (WINAPI * LPDIRECTXREGISTERAPPLICATION)(HWND, LPDIRECTXREGISTERAPPW); +#else +typedef INT (WINAPI * LPDIRECTXSETUP)(HWND, LPSTR, DWORD); +typedef INT (WINAPI * LPDIRECTXDEVICEDRIVERSETUP)(HWND, LPSTR, LPSTR, LPSTR, DWORD); +typedef INT (WINAPI * LPDIRECTXREGISTERAPPLICATION)(HWND, LPDIRECTXREGISTERAPPA); +#endif // UNICODE + +typedef INT (WINAPI * LPDIRECTXSETUPISJAPAN)(VOID); +typedef INT (WINAPI * LPDIRECTXSETUPISJAPANNEC)(VOID); + + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/sdk/inc/dsound.h b/sdk/inc/dsound.h new file mode 100644 index 0000000..874e6b1 --- /dev/null +++ b/sdk/inc/dsound.h @@ -0,0 +1,605 @@ +/*==========================================================================; + * + * Copyright (C) 1995,1996 Microsoft Corporation. All Rights Reserved. + * + * File: dsound.h + * Content: DirectSound include file + * + ***************************************************************************/ + +#ifndef __DSOUND_INCLUDED__ +#define __DSOUND_INCLUDED__ + +#include <d3dtypes.h> + +#ifdef _WIN32 +#define COM_NO_WINDOWS_H +#include <objbase.h> +#endif + +#define _FACDS 0x878 +#define MAKE_DSHRESULT( code ) MAKE_HRESULT( 1, _FACDS, code ) + +#ifdef __cplusplus +extern "C" { +#endif + +// Direct Sound Component GUID {47D4D946-62E8-11cf-93BC-444553540000} +DEFINE_GUID(CLSID_DirectSound, +0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0); + +// DirectSound 279afa83-4981-11ce-a521-0020af0be560 +DEFINE_GUID(IID_IDirectSound,0x279AFA83,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60); +// DirectSoundBuffer 279afa85-4981-11ce-a521-0020af0be560 +DEFINE_GUID(IID_IDirectSoundBuffer,0x279AFA85,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60); + +//DirectSound3DListener 279afa84-4981-11ce-a521-0020af0be560 +DEFINE_GUID(IID_IDirectSound3DListener,0x279AFA84,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60); +//DirectSound3DBuffer 279afa86-4981-11ce-a521-0020af0be560 +DEFINE_GUID(IID_IDirectSound3DBuffer,0x279AFA86,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60); + + +//==========================================================================; +// +// Structures... +// +//==========================================================================; +#ifdef __cplusplus +/* 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined */ +struct IDirectSound; +struct IDirectSoundBuffer; +struct IDirectSound3DListener; +struct IDirectSound3DBuffer; +#endif + +typedef struct IDirectSound *LPDIRECTSOUND; +typedef struct IDirectSoundBuffer *LPDIRECTSOUNDBUFFER; +typedef struct IDirectSoundBuffer **LPLPDIRECTSOUNDBUFFER; +typedef struct IDirectSound3DListener *LPDIRECTSOUND3DLISTENER; +typedef struct IDirectSound3DBuffer *LPDIRECTSOUND3DBUFFER; + + +typedef struct _DSCAPS +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwMinSecondarySampleRate; + DWORD dwMaxSecondarySampleRate; + DWORD dwPrimaryBuffers; + DWORD dwMaxHwMixingAllBuffers; + DWORD dwMaxHwMixingStaticBuffers; + DWORD dwMaxHwMixingStreamingBuffers; + DWORD dwFreeHwMixingAllBuffers; + DWORD dwFreeHwMixingStaticBuffers; + DWORD dwFreeHwMixingStreamingBuffers; + DWORD dwMaxHw3DAllBuffers; + DWORD dwMaxHw3DStaticBuffers; + DWORD dwMaxHw3DStreamingBuffers; + DWORD dwFreeHw3DAllBuffers; + DWORD dwFreeHw3DStaticBuffers; + DWORD dwFreeHw3DStreamingBuffers; + DWORD dwTotalHwMemBytes; + DWORD dwFreeHwMemBytes; + DWORD dwMaxContigFreeHwMemBytes; + DWORD dwUnlockTransferRateHwBuffers; + DWORD dwPlayCpuOverheadSwBuffers; + DWORD dwReserved1; + DWORD dwReserved2; +} DSCAPS, *LPDSCAPS; + +typedef struct _DSBCAPS +{ + + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwUnlockTransferRate; + DWORD dwPlayCpuOverhead; +} DSBCAPS, *LPDSBCAPS; + +typedef struct _DSBUFFERDESC +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; +} DSBUFFERDESC, *LPDSBUFFERDESC; + +typedef struct _DS3DBUFFER +{ + DWORD dwSize; + D3DVECTOR vPosition; + D3DVECTOR vVelocity; + DWORD dwInsideConeAngle; + DWORD dwOutsideConeAngle; + D3DVECTOR vConeOrientation; + LONG lConeOutsideVolume; + D3DVALUE flMinDistance; + D3DVALUE flMaxDistance; + DWORD dwMode; +} DS3DBUFFER, *LPDS3DBUFFER; + +typedef struct _DS3DLISTENER +{ + DWORD dwSize; + D3DVECTOR vPosition; + D3DVECTOR vVelocity; + D3DVECTOR vOrientFront; + D3DVECTOR vOrientTop; + D3DVALUE flDistanceFactor; + D3DVALUE flRolloffFactor; + D3DVALUE flDopplerFactor; +} DS3DLISTENER, *LPDS3DLISTENER; + + + +typedef LPVOID* LPLPVOID; + + +typedef BOOL (FAR PASCAL * LPDSENUMCALLBACKW)(const GUID FAR *, LPWSTR, LPWSTR, LPVOID); +typedef BOOL (FAR PASCAL * LPDSENUMCALLBACKA)(const GUID FAR *, LPSTR, LPSTR, LPVOID); + +extern HRESULT WINAPI DirectSoundCreate(const GUID * lpGUID, LPDIRECTSOUND * ppDS, IUnknown FAR *pUnkOuter ); +extern HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW lpCallback, LPVOID lpContext ); +extern HRESULT WINAPI DirectSoundEnumerateA(LPDSENUMCALLBACKA lpCallback, LPVOID lpContext ); + +#ifdef UNICODE +#define LPDSENUMCALLBACK LPDSENUMCALLBACKW +#define DirectSoundEnumerate DirectSoundEnumerateW +#else +#define LPDSENUMCALLBACK LPDSENUMCALLBACKA +#define DirectSoundEnumerate DirectSoundEnumerateA +#endif + +// +// IDirectSound +// +#undef INTERFACE +#define INTERFACE IDirectSound +#ifdef _WIN32 +DECLARE_INTERFACE_( IDirectSound, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectSound methods ***/ + + STDMETHOD( CreateSoundBuffer)(THIS_ LPDSBUFFERDESC, LPLPDIRECTSOUNDBUFFER, IUnknown FAR *) PURE; + STDMETHOD( GetCaps)(THIS_ LPDSCAPS ) PURE; + STDMETHOD( DuplicateSoundBuffer)(THIS_ LPDIRECTSOUNDBUFFER, LPLPDIRECTSOUNDBUFFER ) PURE; + STDMETHOD( SetCooperativeLevel)(THIS_ HWND, DWORD ) PURE; + STDMETHOD( Compact)(THIS ) PURE; + STDMETHOD( GetSpeakerConfig)(THIS_ LPDWORD ) PURE; + STDMETHOD( SetSpeakerConfig)(THIS_ DWORD ) PURE; + STDMETHOD( Initialize)(THIS_ const GUID * ) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectSound_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectSound_Release(p) (p)->lpVtbl->Release(p) +#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->lpVtbl->CreateSoundBuffer(p,a,b,c) +#define IDirectSound_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->lpVtbl->DuplicateSoundBuffer(p,a,b) +#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectSound_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectSound_GetSpeakerConfig(p,a) (p)->lpVtbl->GetSpeakerConfig(p,a) +#define IDirectSound_SetSpeakerConfig(p,b) (p)->lpVtbl->SetSpeakerConfig(p,b) +#define IDirectSound_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#else +#define IDirectSound_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectSound_AddRef(p) (p)->AddRef() +#define IDirectSound_Release(p) (p)->Release() +#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->CreateSoundBuffer(a,b,c) +#define IDirectSound_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->DuplicateSoundBuffer(a,b) +#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectSound_Compact(p) (p)->Compact() +#define IDirectSound_GetSpeakerConfig(p,a) (p)->GetSpeakerConfig(a) +#define IDirectSound_SetSpeakerConfig(p,b) (p)->SetSpeakerConfig(b) +#define IDirectSound_Initialize(p,a) (p)->Initialize(a) +#endif + +#endif + +// +// IDirectSoundBuffer +// +#undef INTERFACE +#define INTERFACE IDirectSoundBuffer +#ifdef _WIN32 +DECLARE_INTERFACE_( IDirectSoundBuffer, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectSoundBuffer methods ***/ + + STDMETHOD( GetCaps)(THIS_ LPDSBCAPS ) PURE; + STDMETHOD(GetCurrentPosition)(THIS_ LPDWORD,LPDWORD ) PURE; + STDMETHOD( GetFormat)(THIS_ LPWAVEFORMATEX, DWORD, LPDWORD ) PURE; + STDMETHOD( GetVolume)(THIS_ LPLONG ) PURE; + STDMETHOD( GetPan)(THIS_ LPLONG ) PURE; + STDMETHOD( GetFrequency)(THIS_ LPDWORD ) PURE; + STDMETHOD( GetStatus)(THIS_ LPDWORD ) PURE; + STDMETHOD( Initialize)(THIS_ LPDIRECTSOUND, LPDSBUFFERDESC ) PURE; + STDMETHOD( Lock)(THIS_ DWORD,DWORD,LPVOID,LPDWORD,LPVOID,LPDWORD,DWORD ) PURE; + STDMETHOD( Play)(THIS_ DWORD,DWORD,DWORD ) PURE; + STDMETHOD(SetCurrentPosition)(THIS_ DWORD ) PURE; + STDMETHOD( SetFormat)(THIS_ LPWAVEFORMATEX ) PURE; + STDMETHOD( SetVolume)(THIS_ LONG ) PURE; + STDMETHOD( SetPan)(THIS_ LONG ) PURE; + STDMETHOD( SetFrequency)(THIS_ DWORD ) PURE; + STDMETHOD( Stop)(THIS ) PURE; + STDMETHOD( Unlock)(THIS_ LPVOID,DWORD,LPVOID,DWORD ) PURE; + STDMETHOD( Restore)(THIS ) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectSoundBuffer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectSoundBuffer_Release(p) (p)->lpVtbl->Release(p) +#define IDirectSoundBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b) +#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c) +#define IDirectSoundBuffer_GetVolume(p,a) (p)->lpVtbl->GetVolume(p,a) +#define IDirectSoundBuffer_GetPan(p,a) (p)->lpVtbl->GetPan(p,a) +#define IDirectSoundBuffer_GetFrequency(p,a) (p)->lpVtbl->GetFrequency(p,a) +#define IDirectSoundBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a) +#define IDirectSoundBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundBuffer_Play(p,a,b,c) (p)->lpVtbl->Play(p,a,b,c) +#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->lpVtbl->SetCurrentPosition(p,a) +#define IDirectSoundBuffer_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a) +#define IDirectSoundBuffer_SetVolume(p,a) (p)->lpVtbl->SetVolume(p,a) +#define IDirectSoundBuffer_SetPan(p,a) (p)->lpVtbl->SetPan(p,a) +#define IDirectSoundBuffer_SetFrequency(p,a) (p)->lpVtbl->SetFrequency(p,a) +#define IDirectSoundBuffer_Stop(p) (p)->lpVtbl->Stop(p) +#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d) +#define IDirectSoundBuffer_Restore(p) (p)->lpVtbl->Restore(p) +#else +#define IDirectSoundBuffer_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectSoundBuffer_AddRef(p) (p)->AddRef() +#define IDirectSoundBuffer_Release(p) (p)->Release() +#define IDirectSoundBuffer_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->GetCurrentPosition(a,b) +#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->GetFormat(a,b,c) +#define IDirectSoundBuffer_GetVolume(p,a) (p)->GetVolume(a) +#define IDirectSoundBuffer_GetPan(p,a) (p)->GetPan(a) +#define IDirectSoundBuffer_GetFrequency(p,a) (p)->GetFrequency(a) +#define IDirectSoundBuffer_GetStatus(p,a) (p)->GetStatus(a) +#define IDirectSoundBuffer_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->Lock(a,b,c,d,e,f,g) +#define IDirectSoundBuffer_Play(p,a,b,c) (p)->Play(a,b,c) +#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->SetCurrentPosition(a) +#define IDirectSoundBuffer_SetFormat(p,a) (p)->SetFormat(a) +#define IDirectSoundBuffer_SetVolume(p,a) (p)->SetVolume(a) +#define IDirectSoundBuffer_SetPan(p,a) (p)->SetPan(a) +#define IDirectSoundBuffer_SetFrequency(p,a) (p)->SetFrequency(a) +#define IDirectSoundBuffer_Stop(p) (p)->Stop() +#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->Unlock(a,b,c,d) +#define IDirectSoundBuffer_Restore(p) (p)->Restore() +#endif + +#endif + +// +// IDirectSound3DListener +// +#undef INTERFACE +#define INTERFACE IDirectSound3DListener +#ifdef _WIN32 +DECLARE_INTERFACE_(IDirectSound3DListener, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDirectSound3D methods ***/ + STDMETHOD(GetAllParameters)(THIS_ LPDS3DLISTENER) PURE; + STDMETHOD(GetDistanceFactor)(THIS_ LPD3DVALUE) PURE; + STDMETHOD(GetDopplerFactor)(THIS_ LPD3DVALUE) PURE; + STDMETHOD(GetOrientation)(THIS_ LPD3DVECTOR, LPD3DVECTOR) PURE; + STDMETHOD(GetPosition)(THIS_ LPD3DVECTOR) PURE; + STDMETHOD(GetRolloffFactor)(THIS_ LPD3DVALUE ) PURE; + STDMETHOD(GetVelocity)(THIS_ LPD3DVECTOR) PURE; + STDMETHOD(SetAllParameters)(THIS_ LPDS3DLISTENER, DWORD) PURE; + STDMETHOD(SetDistanceFactor)(THIS_ D3DVALUE, DWORD) PURE; + STDMETHOD(SetDopplerFactor)(THIS_ D3DVALUE, DWORD) PURE; + STDMETHOD(SetOrientation)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE; + STDMETHOD(SetPosition)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE; + STDMETHOD(SetRolloffFactor)(THIS_ D3DVALUE, DWORD) PURE; + STDMETHOD(SetVelocity)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE; + STDMETHOD(CommitDeferredSettings)(THIS) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DListener_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectSound3DListener_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectSound3DListener_Release(p) (p)->lpVtbl->Release(p) +#define IDirectSound3DListener_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#define IDirectSound3DListener_GetDistanceFactor(p,a) (p)->lpVtbl->GetDistanceFactor(p,a) +#define IDirectSound3DListener_GetDopplerFactor(p,a) (p)->lpVtbl->GetDopplerFactor(p,a) +#define IDirectSound3DListener_GetOrientation(p,a,b) (p)->lpVtbl->GetOrientation(p,a,b) +#define IDirectSound3DListener_GetPosition(p,a) (p)->lpVtbl->GetPosition(p,a) +#define IDirectSound3DListener_GetRolloffFactor(p,a) (p)->lpVtbl->GetRolloffFactor(p,a) +#define IDirectSound3DListener_GetVelocity(p,a) (p)->lpVtbl->GetVelocity(p,a) +#define IDirectSound3DListener_SetAllParameters(p,a,b) (p)->lpVtbl->SetAllParameters(p,a,b) +#define IDirectSound3DListener_SetDistanceFactor(p,a,b) (p)->lpVtbl->SetDistanceFactor(p,a,b) +#define IDirectSound3DListener_SetDopplerFactor(p,a,b) (p)->lpVtbl->SetDopplerFactor(p,a,b) +#define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g) (p)->lpVtbl->SetOrientation(p,a,b,c,d,e,f,g) +#define IDirectSound3DListener_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d) +#define IDirectSound3DListener_SetRolloffFactor(p,a,b) (p)->lpVtbl->SetRolloffFactor(p,a,b) +#define IDirectSound3DListener_SetVelocity(p,a,b,c,d) (p)->lpVtbl->SetVelocity(p,a,b,c,d) +#define IDirectSound3DListener_CommitDeferredSettings(p) (p)->lpVtbl->CommitDeferredSettings(p) +#else +#define IDirectSound3DListener_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectSound3DListener_AddRef(p) (p)->AddRef() +#define IDirectSound3DListener_Release(p) (p)->Release() +#define IDirectSound3DListener_GetAllParameters(p,a) (p)->GetAllParameters(a) +#define IDirectSound3DListener_GetDistanceFactor(p,a) (p)->GetDistanceFactor(a) +#define IDirectSound3DListener_GetDopplerFactor(p,a) (p)->GetDopplerFactor(a) +#define IDirectSound3DListener_GetOrientation(p,a,b) (p)->GetOrientation(a,b) +#define IDirectSound3DListener_GetPosition(p,a) (p)->GetPosition(a) +#define IDirectSound3DListener_GetRolloffFactor(p,a) (p)->GetRolloffFactor(a) +#define IDirectSound3DListener_GetVelocity(p,a) (p)->GetVelocity(a) +#define IDirectSound3DListener_SetAllParameters(p,a,b) (p)->SetAllParameters(a,b) +#define IDirectSound3DListener_SetDistanceFactor(p,a,b) (p)->SetDistanceFactor(a,b) +#define IDirectSound3DListener_SetDopplerFactor(p,a,b) (p)->SetDopplerFactor(a,b) +#define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g) (p)->SetOrientation(a,b,c,d,e,f,g) +#define IDirectSound3DListener_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d) +#define IDirectSound3DListener_SetRolloffFactor(p,a,b) (p)->SetRolloffFactor(a,b) +#define IDirectSound3DListener_SetVelocity(p,a,b,c,d) (p)->SetVelocity(a,b,c,d) +#define IDirectSound3DListener_CommitDeferredSettings(p) (p)->CommitDeferredSettings() +#endif + +#endif + +// +// IDirectSound3DBuffer +// +#undef INTERFACE +#define INTERFACE IDirectSound3DBuffer +#ifdef _WIN32 +DECLARE_INTERFACE_(IDirectSound3DBuffer, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDirectSoundBuffer3D methods ***/ + STDMETHOD(GetAllParameters)(THIS_ LPDS3DBUFFER) PURE; + STDMETHOD(GetConeAngles)(THIS_ LPDWORD, LPDWORD) PURE; + STDMETHOD(GetConeOrientation)(THIS_ LPD3DVECTOR) PURE; + STDMETHOD(GetConeOutsideVolume)(THIS_ LPLONG) PURE; + STDMETHOD(GetMaxDistance)(THIS_ LPD3DVALUE) PURE; + STDMETHOD(GetMinDistance)(THIS_ LPD3DVALUE) PURE; + STDMETHOD(GetMode)(THIS_ LPDWORD) PURE; + STDMETHOD(GetPosition)(THIS_ LPD3DVECTOR) PURE; + STDMETHOD(GetVelocity)(THIS_ LPD3DVECTOR) PURE; + STDMETHOD(SetAllParameters)(THIS_ LPDS3DBUFFER, DWORD) PURE; + STDMETHOD(SetConeAngles)(THIS_ DWORD, DWORD, DWORD) PURE; + STDMETHOD(SetConeOrientation)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE; + STDMETHOD(SetConeOutsideVolume)(THIS_ LONG, DWORD) PURE; + STDMETHOD(SetMaxDistance)(THIS_ D3DVALUE, DWORD) PURE; + STDMETHOD(SetMinDistance)(THIS_ D3DVALUE, DWORD) PURE; + STDMETHOD(SetMode)(THIS_ DWORD, DWORD) PURE; + STDMETHOD(SetPosition)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE; + STDMETHOD(SetVelocity)(THIS_ D3DVALUE, D3DVALUE, D3DVALUE, DWORD) PURE; +}; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectSound3DBuffer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectSound3DBuffer_Release(p) (p)->lpVtbl->Release(p) +#define IDirectSound3DBuffer_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#define IDirectSound3DBuffer_GetConeAngles(p,a,b) (p)->lpVtbl->GetConeAngles(p,a,b) +#define IDirectSound3DBuffer_GetConeOrientation(p,a) (p)->lpVtbl->GetConeOrientation(p,a) +#define IDirectSound3DBuffer_GetConeOutsideVolume(p,a) (p)->lpVtbl->GetConeOutsideVolume(p,a) +#define IDirectSound3DBuffer_GetPosition(p,a) (p)->lpVtbl->GetPosition(p,a) +#define IDirectSound3DBuffer_GetMinDistance(p,a) (p)->lpVtbl->GetMinDistance(p,a) +#define IDirectSound3DBuffer_GetMaxDistance(p,a) (p)->lpVtbl->GetMaxDistance(p,a) +#define IDirectSound3DBuffer_GetMode(p,a) (p)->lpVtbl->GetMode(p,a) +#define IDirectSound3DBuffer_GetVelocity(p,a) (p)->lpVtbl->GetVelocity(p,a) +#define IDirectSound3DBuffer_SetAllParameters(p,a,b) (p)->lpVtbl->SetAllParameters(p,a,b) +#define IDirectSound3DBuffer_SetConeAngles(p,a,b,c) (p)->lpVtbl->SetConeAngles(p,a,b,c) +#define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->lpVtbl->SetConeOrientation(p,a,b,c,d) +#define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b)(p)->lpVtbl->SetConeOutsideVolume(p,a,b) +#define IDirectSound3DBuffer_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d) +#define IDirectSound3DBuffer_SetMinDistance(p,a,b) (p)->lpVtbl->SetMinDistance(p,a,b) +#define IDirectSound3DBuffer_SetMaxDistance(p,a,b) (p)->lpVtbl->SetMaxDistance(p,a,b) +#define IDirectSound3DBuffer_SetMode(p,a,b) (p)->lpVtbl->SetMode(p,a,b) +#define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d) (p)->lpVtbl->SetVelocity(p,a,b,c,d) +#else +#define IDirectSound3DBuffer_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectSound3DBuffer_AddRef(p) (p)->AddRef() +#define IDirectSound3DBuffer_Release(p) (p)->Release() +#define IDirectSound3DBuffer_GetAllParameters(p,a) (p)->GetAllParameters(a) +#define IDirectSound3DBuffer_GetConeAngles(p,a,b) (p)->GetConeAngles(a,b) +#define IDirectSound3DBuffer_GetConeOrientation(p,a) (p)->GetConeOrientation(a) +#define IDirectSound3DBuffer_GetConeOutsideVolume(p,a) (p)->GetConeOutsideVolume(a) +#define IDirectSound3DBuffer_GetPosition(p,a) (p)->GetPosition(a) +#define IDirectSound3DBuffer_GetMinDistance(p,a) (p)->GetMinDistance(a) +#define IDirectSound3DBuffer_GetMaxDistance(p,a) (p)->GetMaxDistance(a) +#define IDirectSound3DBuffer_GetMode(p,a) (p)->GetMode(a) +#define IDirectSound3DBuffer_GetVelocity(p,a) (p)->GetVelocity(a) +#define IDirectSound3DBuffer_SetAllParameters(p,a,b) (p)->SetAllParameters(a,b) +#define IDirectSound3DBuffer_SetConeAngles(p,a,b,c) (p)->SetConeAngles(a,b,c) +#define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->SetConeOrientation(a,b,c,d) +#define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b)(p)->SetConeOutsideVolume(a,b) +#define IDirectSound3DBuffer_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d) +#define IDirectSound3DBuffer_SetMinDistance(p,a,b) (p)->SetMinDistance(a,b) +#define IDirectSound3DBuffer_SetMaxDistance(p,a,b) (p)->SetMaxDistance(a,b) +#define IDirectSound3DBuffer_SetMode(p,a,b) (p)->SetMode(a,b) +#define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d) (p)->SetVelocity(a,b,c,d) +#endif + +#endif + + +/* + * Return Codes + */ + +#define DS_OK 0 + +/* + * The call failed because resources (such as a priority level) + * were already being used by another caller. + */ +#define DSERR_ALLOCATED MAKE_DSHRESULT( 10 ) +/* + * The control (vol,pan,etc.) requested by the caller is not available. + */ +#define DSERR_CONTROLUNAVAIL MAKE_DSHRESULT( 30 ) +/* + * An invalid parameter was passed to the returning function + */ +#define DSERR_INVALIDPARAM E_INVALIDARG +/* + * This call is not valid for the current state of this object + */ +#define DSERR_INVALIDCALL MAKE_DSHRESULT( 50 ) +/* + * An undetermined error occured inside the DSound subsystem + */ +#define DSERR_GENERIC E_FAIL +/* + * The caller does not have the priority level required for the function to + * succeed. + */ +#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT( 70 ) +/* + * The DSound subsystem couldn't allocate sufficient memory to complete the + * caller's request. + */ +#define DSERR_OUTOFMEMORY E_OUTOFMEMORY +/* + * The specified WAVE format is not supported + */ +#define DSERR_BADFORMAT MAKE_DSHRESULT( 100 ) +/* + * The function called is not supported at this time + */ +#define DSERR_UNSUPPORTED E_NOTIMPL +/* + * No sound driver is available for use + */ +#define DSERR_NODRIVER MAKE_DSHRESULT( 120 ) +/* + * This object is already initialized + */ +#define DSERR_ALREADYINITIALIZED MAKE_DSHRESULT( 130 ) +/* + * This object does not support aggregation + */ +#define DSERR_NOAGGREGATION CLASS_E_NOAGGREGATION +/* + * The buffer memory has been lost, and must be Restored. + */ +#define DSERR_BUFFERLOST MAKE_DSHRESULT( 150 ) +/* + * Another app has a higher priority level, preventing this call from + * succeeding. + */ +#define DSERR_OTHERAPPHASPRIO MAKE_DSHRESULT( 160 ) +/* + * The Initialize() member on the Direct Sound Object has not been + * called or called successfully before calls to other members. + */ +#define DSERR_UNINITIALIZED MAKE_DSHRESULT( 170 ) + + + + +//==========================================================================; +// +// Flags... +// +//==========================================================================; + +#define DSCAPS_PRIMARYMONO 0x00000001 +#define DSCAPS_PRIMARYSTEREO 0x00000002 +#define DSCAPS_PRIMARY8BIT 0x00000004 +#define DSCAPS_PRIMARY16BIT 0x00000008 +#define DSCAPS_CONTINUOUSRATE 0x00000010 +#define DSCAPS_EMULDRIVER 0x00000020 +#define DSCAPS_CERTIFIED 0x00000040 +#define DSCAPS_SECONDARYMONO 0x00000100 +#define DSCAPS_SECONDARYSTEREO 0x00000200 +#define DSCAPS_SECONDARY8BIT 0x00000400 +#define DSCAPS_SECONDARY16BIT 0x00000800 + + + +#define DSBPLAY_LOOPING 0x00000001 + + +#define DSBSTATUS_PLAYING 0x00000001 +#define DSBSTATUS_BUFFERLOST 0x00000002 +#define DSBSTATUS_LOOPING 0x00000004 + + +#define DSBLOCK_FROMWRITECURSOR 0x00000001 + + + +#define DSSCL_NORMAL 1 +#define DSSCL_PRIORITY 2 +#define DSSCL_EXCLUSIVE 3 +#define DSSCL_WRITEPRIMARY 4 + + + +// flags for IDirectSound3DBuffer::SetMode +#define DS3DMODE_NORMAL 0 // default must be 0 +#define DS3DMODE_HEADRELATIVE 1 +#define DS3DMODE_DISABLE 2 + +// flags for dwApply parameter of some 3D functions +#define DS3D_IMMEDIATE 0 +#define DS3D_DEFERRED 1 + +// default values for 3d factors +#define DS3D_DEFAULTDISTANCEFACTOR 1.0f +#define DS3D_DEFAULTROLLOFFFACTOR 1.0f +#define DS3D_DEFAULTDOPPLERFACTOR 1.0f + +#define DSBCAPS_PRIMARYBUFFER 0x00000001 +#define DSBCAPS_STATIC 0x00000002 +#define DSBCAPS_LOCHARDWARE 0x00000004 +#define DSBCAPS_LOCSOFTWARE 0x00000008 +#define DSBCAPS_CTRL3D 0x00000010 +#define DSBCAPS_CTRLFREQUENCY 0x00000020 +#define DSBCAPS_CTRLPAN 0x00000040 +#define DSBCAPS_CTRLVOLUME 0x00000080 +#define DSBCAPS_CTRLDEFAULT 0x000000E0 // Pan + volume + frequency. +#define DSBCAPS_CTRLALL 0x000000F0 // All control capabilities +#define DSBCAPS_STICKYFOCUS 0x00004000 +#define DSBCAPS_GLOBALFOCUS 0x00008000 +#define DSBCAPS_GETCURRENTPOSITION2 0x00010000 // More accurate play cursor under emulation + + + + +#define DSSPEAKER_HEADPHONE 1 +#define DSSPEAKER_MONO 2 +#define DSSPEAKER_QUAD 3 +#define DSSPEAKER_STEREO 4 +#define DSSPEAKER_SURROUND 5 + + + + + + +#ifdef __cplusplus +}; +#endif + +#endif /* __DSOUND_INCLUDED__ */ diff --git a/sdk/inc/fastfile.h b/sdk/inc/fastfile.h new file mode 100644 index 0000000..84f49fe --- /dev/null +++ b/sdk/inc/fastfile.h @@ -0,0 +1,24 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: fastfile.h + * Content: Definitions for fastfile access. + * + * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + * + ***************************************************************************/ + +typedef LPVOID HFASTFILE; + +extern BOOL FastFileInit( LPSTR fname, int max_handles ); +extern void FastFileFini( void ); +extern HFASTFILE FastFileOpen( LPSTR name ); +extern BOOL FastFileClose( HFASTFILE pfe ); +extern BOOL FastFileRead( HFASTFILE pfh, LPVOID ptr, int size ); +extern BOOL FastFileSeek( HFASTFILE pfe, int off, int how ); +extern long FastFileTell( HFASTFILE pfe ); +extern LPVOID FastFileLock( HFASTFILE pfe, int off, int len ); +extern BOOL FastFileUnlock( HFASTFILE pfe, int off, int len ); diff --git a/sdk/lib/d3drm.lib b/sdk/lib/d3drm.lib new file mode 100644 index 0000000..31f7a36 Binary files /dev/null and b/sdk/lib/d3drm.lib differ diff --git a/sdk/lib/ddraw.lbw b/sdk/lib/ddraw.lbw new file mode 100644 index 0000000..21a3edd Binary files /dev/null and b/sdk/lib/ddraw.lbw differ diff --git a/sdk/lib/ddraw.lib b/sdk/lib/ddraw.lib new file mode 100644 index 0000000..7dbd0aa Binary files /dev/null and b/sdk/lib/ddraw.lib differ diff --git a/sdk/lib/dinput.lib b/sdk/lib/dinput.lib new file mode 100644 index 0000000..b65e80b Binary files /dev/null and b/sdk/lib/dinput.lib differ diff --git a/sdk/lib/dplayx.lib b/sdk/lib/dplayx.lib new file mode 100644 index 0000000..3d2ac06 Binary files /dev/null and b/sdk/lib/dplayx.lib differ diff --git a/sdk/lib/dsetup.lib b/sdk/lib/dsetup.lib new file mode 100644 index 0000000..3271900 Binary files /dev/null and b/sdk/lib/dsetup.lib differ diff --git a/sdk/lib/dsound.lbw b/sdk/lib/dsound.lbw new file mode 100644 index 0000000..2f8071f Binary files /dev/null and b/sdk/lib/dsound.lbw differ diff --git a/sdk/lib/dsound.lib b/sdk/lib/dsound.lib new file mode 100644 index 0000000..dae02aa Binary files /dev/null and b/sdk/lib/dsound.lib differ diff --git a/sdk/lib/dxguid.lib b/sdk/lib/dxguid.lib new file mode 100644 index 0000000..b3e166e Binary files /dev/null and b/sdk/lib/dxguid.lib differ diff --git a/sdk/lib/fastfile.lbw b/sdk/lib/fastfile.lbw new file mode 100644 index 0000000..467ebf8 Binary files /dev/null and b/sdk/lib/fastfile.lbw differ diff --git a/sdk/lib/fastfile.lib b/sdk/lib/fastfile.lib new file mode 100644 index 0000000..e1214dc Binary files /dev/null and b/sdk/lib/fastfile.lib differ diff --git a/sdk/media/banana.ppm b/sdk/media/banana.ppm new file mode 100644 index 0000000..48549cc Binary files /dev/null and b/sdk/media/banana.ppm differ diff --git a/sdk/media/bang.wav b/sdk/media/bang.wav new file mode 100644 index 0000000..2d270b9 Binary files /dev/null and b/sdk/media/bang.wav differ diff --git a/sdk/media/bangbang.wav b/sdk/media/bangbang.wav new file mode 100644 index 0000000..84cf9e1 Binary files /dev/null and b/sdk/media/bangbang.wav differ diff --git a/sdk/media/bigship1.x b/sdk/media/bigship1.x new file mode 100644 index 0000000..f5c0dd7 Binary files /dev/null and b/sdk/media/bigship1.x differ diff --git a/sdk/media/blow1.wav b/sdk/media/blow1.wav new file mode 100644 index 0000000..aae9ebc Binary files /dev/null and b/sdk/media/blow1.wav differ diff --git a/sdk/media/blow2.wav b/sdk/media/blow2.wav new file mode 100644 index 0000000..f75e99d Binary files /dev/null and b/sdk/media/blow2.wav differ diff --git a/sdk/media/bounce.wav b/sdk/media/bounce.wav new file mode 100644 index 0000000..33bd786 Binary files /dev/null and b/sdk/media/bounce.wav differ diff --git a/sdk/media/c_bang.wav b/sdk/media/c_bang.wav new file mode 100644 index 0000000..4dc29b9 Binary files /dev/null and b/sdk/media/c_bang.wav differ diff --git a/sdk/media/camera.x b/sdk/media/camera.x new file mode 100644 index 0000000..a8166d6 Binary files /dev/null and b/sdk/media/camera.x differ diff --git a/sdk/media/chainsw.wav b/sdk/media/chainsw.wav new file mode 100644 index 0000000..9271f8a Binary files /dev/null and b/sdk/media/chainsw.wav differ diff --git a/sdk/media/checker.ppm b/sdk/media/checker.ppm new file mode 100644 index 0000000..779e3d4 Binary files /dev/null and b/sdk/media/checker.ppm differ diff --git a/sdk/media/cherry.x b/sdk/media/cherry.x new file mode 100644 index 0000000..6e0792f Binary files /dev/null and b/sdk/media/cherry.x differ diff --git a/sdk/media/cube.x b/sdk/media/cube.x new file mode 100644 index 0000000..4ccc49f Binary files /dev/null and b/sdk/media/cube.x differ diff --git a/sdk/media/d_bang.wav b/sdk/media/d_bang.wav new file mode 100644 index 0000000..f6c6658 Binary files /dev/null and b/sdk/media/d_bang.wav differ diff --git a/sdk/media/dropship.x b/sdk/media/dropship.x new file mode 100644 index 0000000..1e0bd0f Binary files /dev/null and b/sdk/media/dropship.x differ diff --git a/sdk/media/egg.x b/sdk/media/egg.x new file mode 100644 index 0000000..5eb91a5 Binary files /dev/null and b/sdk/media/egg.x differ diff --git a/sdk/media/gunfire.wav b/sdk/media/gunfire.wav new file mode 100644 index 0000000..44b37b1 Binary files /dev/null and b/sdk/media/gunfire.wav differ diff --git a/sdk/media/hum.wav b/sdk/media/hum.wav new file mode 100644 index 0000000..dae8d35 Binary files /dev/null and b/sdk/media/hum.wav differ diff --git a/sdk/media/jump.wav b/sdk/media/jump.wav new file mode 100644 index 0000000..134cd88 Binary files /dev/null and b/sdk/media/jump.wav differ diff --git a/sdk/media/lake.ppm b/sdk/media/lake.ppm new file mode 100644 index 0000000..5fa228f --- /dev/null +++ b/sdk/media/lake.ppm @@ -0,0 +1,1915 @@ +P6 +256 256 +255 +{��y��|��{��z��z��z��}�ہ��}�ڃ���ۄ�܀�܄�ނ�܂�܃����ۄ�ރ�ޅ�܃������߃�܃�݅�݆�ވ�ߊ�މ�߈�ދ�݊�߈��ދ����ސ�ᑩߏ�ގ�ߐ����ߏ�ޓ�ߔ�ޓ�ޔ�������ߓ�㖭���ߘ�ߙ�������ᛮߝ�❮ߜ�⡱ߠ�❰ᢵ➳❱ᠵ㟳⟴⟵⟰ߞ�ߣ�࠴⦵ᦴ⦴㦷㦵㧷㪺䦶㨷᪹⦹妶ॷ㥸㥷䪹䩹㩷ᮺ䨸⩺䨻楷㢶㧶᧹䤷㥷᧹䧹䧸⧸⫹㩹㪹䩹㰺⪹䨹䬺䪺䩸᭹⮺㭹㮸ᱺ᭷߱�㯸㲹ᳺߴ��ⶻᶽ㶽㵺᰽㱺ⴼᵽ䲺ⲽ㵽㱽������䷿㸾߷����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������窾棼皷嚸啸嚷嗵㖸撵喷噸䕷喴㓳䕶哳䏳䓵嗶哳䓵唳䓳䔳䗴䕴䔳䓳䔳䑲䖴䐲䒳䑳㕳△䕴䑲�~��{�ـ��z����x��~��|�ق��|���ۀ�ۂ�܂�݃�ۂ�ۂ�݇����ځ�چ�ڄ�ރ�ކ�܆�ۈ�݇�߆�ވ�ߌ�ލ����ދ�������������܋�ݏ�ޏ�ސ�ᐫ���ߑ�ڏ�ސ�ᔪߕ�ߔ�ߔ�ᖪݗ�ޕ�ߕ�ޖ�╭���⛳㟲♫ޙ�㞲������ᢲ���㟳➲✲⡲៴䛱ᠲ࠲ࡳᠶ䣵ࡵ㢰ॵ⨵ߧ�㧹䧹䨸᧸㧷ᦶࣷ㤸䪹䩹䫺䩹䬺䧹䧹䥹夸䥸䦸㧹䧹䧹㧹䧺䧸㨸⤸䦸㪸ૹ㫺㪺䪹䫹㬺䭸⯺䰸᮷ߴ�ⰺᱹ㳹�ⴻᵺ㴹⯸߱�䳺ⱺⱺⴽⱸ߱�㴾Ȿ崾䰿岾㴿䴿������涿�����������������������������������������������������������������������������������������������������������������������������������������������������������������������䴿������睼皻旵嚵䗵䚺昸旷喸擴◴㕵啸擵哳䔴䖵喸喴䖶唳㗳䗴䓶唴䔴䕴䒳䘳䘴䕳䓳䔳䖳㕵咴�{��|��|��}��|��|��}�݀�ۀ�݂�ހ�܁�ۄ�ۅ�݄�ۅ�ۂ�܇�ޅ�߆�ۆ�ۈ�݅�܆�ކ�ۆ�݅����߉�ވ�܉�ዩዧމ�ވ�ߊ�Ꭹߌ�߈�ގ��ޏ�Ꭹ���͏�ڒ�Ꭸޑ�ݕ�ޒ�ߔ�ޔ�������ޖ����▯㚰✰���✰������ߜ�ߞ�㟳⡲ᠴ⢴❳➰ߟ�ឯߝ�ᠳ㞴㢵៱ᢶ㥵ᤶ⢵⦶㦷䦹䧹㨷᩸㥸䦷⦸䫺䧹䩹䫺䧹䧹䧹䦹䤸䧹䦹䦹䢷㨹㧹䨻姺姹䦹䦹䫹⩹⪻䭼孺㮹㮹⬸ષᬷ߰�ⰺ㯻㲻⳺⳺Ჹ߲᳸�ᵻⴺ߶�ᵺ㱻⳼㴺㱽㳻ߵ�ᴽ㶿䲽屼ᱽⱿ����㱿䷿���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������袽杶䛺暹噺嚸晷営喵喸喵䓸撵喸嗸敳䘺斶喵䔴䔲䖵営啷嗶唳䘷斶嘴䕳㑳㓳䒱╵䕵傞�{��}��|��}�ہ��{���ۀ�ۀ�ކ�݂�ڄ�܆�݂�܆�چ�ڃ�څ�܉����݇�݈�މ����݉�݆�݇�߈�ވ�ߋ�ތ�ߋ�������ጨߍ�߈�ߎ�ސ�ߐ�ᑩߑ�������ޑ�Ꮸߔ����������ᓫߖ�㔭ᖯᗯᙱ☯♱◰⠴㠱ߞ�♯៱➯���㡳ᡴ៲ឱ���⛳㜲⟵䡶䡶㞱ߠ�㣸㦷⠶㦸䟲স㧹䨸⫺㧺姺䨸㨹䩹䫹䬻䪺䨺姹䨹䥸䦸䤸䧺姼娺㨷᧹䨹䦸䧹䩹䬺⩹㫺䬻䬼䮻䲼䬻㬷షݰ�㲻䳼⳼ⱸᵺ⳹ⴻⷽᶽ⳽ᵽⲺ㯺ⱽ㯿䯾岽㳼㱽嵿㴿䴿䰽㮽����糿������������������������������������������������������������������������������������������������������������������������������������������������������������������������������㵿��毿��橼娾礽碼碻噸䚷嚸噷嗷噹旷嚹昷唶啷嗹晷嚸嗸攷嗷唳䕵唴唴䕷嚸嚸哶営啶唵䗶嘷噹�~�ـ�ށ���ـ��{�܄�݀�ށ�݀�ۄ�ރ�ށ�܃�ڃ�م�߄�߅�݅�ډ�ۈ�݉�ވ�߉�܉�܈�ވ�߇�ވ�����ߌ�܋����ލ����ߌ�ߌ�ᐩލ�፪⒫���ݐ�ޑ�㓭㒫ᑫ⒪������◰ᕫ���ᘰ☱☰♯⚰៵䚱⛱㛲❳✱❱⟲㠴➳㟲➴䞳❴㞴䝵䠴឴㣷㣶⤷⥹䢶⧸䪻嫺䨺㩻娻㩺㪺婼娹䧸㩺䬽媻妸䩼妺妸䨻娻婻䨸⦹媹䧷᪹䫺䪹㬺ᬼ䪻䪺㪺䰽䬹⯺ⱹᱻ㳺⳽㴺ഽ㯻㱻㳾嵾䶾㵻⳼Ⲻⱽ䱾䬼寽巾㵽㵿嶽ⶽ��泾岼�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������浿����������穾社矿蜻场䜺晸曺営嚻昹曹昶嘷噸啷喷嘸嗶喸斷噶嗳䗶喷喷嚶䙴䕶唴嗵喷斵唷唶儝ۀ�ك��ځ��������܀�ۀ�ۂ�ۅ�ڄ�܈�څ�ކ�݇�܉�݈�݇�܈�܊�܈�ۉ�܋�߉�ތ�⍨߉��ޑ�ቧߋ�ቧߌ����≦ߍ�ጪ〈ጩ���ޏ�ݎ����ޏ�ᐫᏪ������ᐫߒ�㘱㓭ᕭ���♱☰♰☰✵䛲♱♰ߛ�ߞ�⠲⢶䜲⟲៳ᝳ❱⢶䡵⠶㛴䛴䢷䣷㢶㥸䧸㧹䧹䨹䬻䨹㫺㬽姺婻婼娻䩺䪼橺㩺嬼娻娺䨼楹姹䦻娹婺䫹䪻䪸⭽䭼䬻⫼孺䬺䯹᰽ⲺᲺ㱺㲾㰻ⲽ⳾㷼ⷼⰺᵾ㴽㳼㴼㳿泼⳾ᶾ��涾䶾峾��䵿㳾��������������������������������綿����緿����������������������������������������������������������������������������������������������������������������������������������������������������觾枽瞽机垻盻睿蛷䚹智暸噶䛺曼晹旹晻暸噸啵噸晹昹暷嚶営喵䙷噶嗳䘶喵嘹斷僟ڃ�ك�ځ��~���ف�݁�߃�݂�ׅ�܄�݆�݅��܆�ᅢވ�߈�݉�܇����މ�܋�ߊ�ڍ�܌�������ߋ�ߌ����ߋ�ሤ�ߊ�ዧߎ�ߋ����ݏ�ߏ�፩ߍ�ݑ�ߍ�ߒ����ߑ�ᓮ⓮⑫◱㖰⓪ߖ�㙰ᖮᗱ䘲㘱㘯⚲㘳䚱ឲ���㟴➴㞴㝳㝳ᡴ⟴㞴㟵䝴㤷㦸䥸䤶㤵ᦹ䧹䨹䪹㬹㪺䬻䧹䩽槹姹䨹䩻婼娺䬼娻墶⨼娺娺婻嫻䩹䪸᩻䭹⪹㭹⬺㭽䭺䯻⯹߮��ᱸޱ�䰼㴽䮺Ⲽ㴼᷾㶾����䱼Ჽ㴾䲺㶾尽⳾㳾��䶽����峿��⳾��䲾䳿������䶾���������������������������������������������������������������������������������������������������������������������������������������������������������������������������笾㧿砼硼皻曼盹圷⚹朼晻时固昷嘺暻曻癹昹暹暷坺査囹晷噹撴䙶嗴嚶喷喻発暷儢څ�݃������ނ�ۃ�܃�߄�݅�ބ�݄�ۃ�ڇ�݈�݆�ކ�߈�މ�܉�މ�܉�ߋ����Ꭷލ�ߎ�ݏ�ݍ�ߌ�ߍ����Ꭺኪ���߉����ጩ���Ꭻߍ����㍫ߐ����㐬╰⒭���ߑ�������╮◲䕯╮ᘱ☰◱㘲⚲♳㝵㜳⡱⟱⟴⢴៵䠴➳㝴⟵䠳㢷䡷䡶⤸䦸䤸䧸䧹䧹䧹䧹䨻櫻䪻嫼姹㭾娸⧸㧺䨺䩼娻姻樻婽樽檼橼氿㫻䪻嫹㮽䭼䧸㪹㭻��殼㭺⯽㲾䱼ⱼ⯼䲼㳽䲽㳾ⴻ㴾䴼㲽㶿㳿崻⳾䲽ⴽ嵾����嶾䷾䷾ල尽��������������������泿������������������������������������������������������������������������������������������������������������������������������������������������������������������������欿��覿禿矼枾盻曺囸暹暹暺暺昹智昶嚻盺暹晶埻矸壻堻暻昸嗸噹晸埻椿颾祽褽瀠݅�ى�܀�ڃ�݄�݅�܂�ބ�ރ����܄�م�ۇ�݄����ބ�݇�܆�݈�މ�ڈ�ዧ፨ߏ�ᒨ݊�ތ�܌�ߊ��ߌ����⎫⎪���ތ�ލ�Ꭻ���ߎ�ߒ�⒭ލ�ᐬ���ᓮ┮Ꭺߒ�┯⓯┮ᑮ┯ᖲᖱ㖰ᗳ㖱㚳㘰♳㗰៱ឳ✲ᠳ䡳៶㟶䝵⟴䢷㥷㟷䡷䥸䦸䤸䧹䧹䧹䧹䧹䨹䫹䫼姺䪻婸ᨹ㨺䧺䩹⪽樻䧺䧼槻娼䥻姼樺媻㬻䫼孼嬹᪻㩻媺䪼孼䬹ᮺ䰹⳻᱾䰽峾㰹ߴ���峻Ჿ䴾尼ᶽᴽ᱾㲽ⲻ㵾嵼ⴿ��嶽��ⶾ崼㴿峿��沾������岿��������������������������������縿��������������������������������������������������������������������������������������������������������������������������������竾歿歿笽⪾��觾磾砼杹曺朹噺嘸噷䙺暷嘺暸暺曺暺机桽��覼��椽埻眾瘷䝹禾稾��觿穾櫿愡݆�ׄ��ރ�݂�܆�܉�݇�߄�܄�ނ�߅�უ݊�ވ�܉�މ�݊�Ꭺጦ݊��ጧᏨݏ�ᔫ���ߍ�ߌ�������ݑ�ߏ�Ꮺᐫߐ�ߎ�������㏭፪������ᒫ���ᔮᒯ㕰㏰㕱䖱┮���䕱㕱╲䖲㘴䘳㚴㛰ᜲᠴ➱⣵㡴㡷䠶⢶⤸䡶䦹䧹䥸䥹䥶⧹䥹妹䦻婽槹䨻嫺䨺䪺⨻娼樸㨺䦺娺䫼嫹⨼姻姻䦽婽檾樻媼宽⬽嬻嬻Ⲽ᭻寽㫼殾岽ⲽ䭻㱻䲻⳿䲽Ⲿⱻ丿䶿峼㴼䷿㳻ⴾ����崿䲽ⴾ㵽��治᷾��嶾䶿��崿��������䯿䲿����籿������������������������������������������������������������������������������������������������������������������������������������������������������������������竿檿��禾樾������蠽睻垻曻朽曽瘸䚾瘹暺曼暻睼瞼禾��穾������襼��裾硾��礿覼槼����扟ւ�ᄡۉ�߆�އ�ن�ޅ�މ�܇�އ�އ�މ�݉����߅�݉�ތ�ጨ���Ꮹ���ݑ����ޓ�ޏ�⏫ᒫߎ�ލ�Ꭹތ�ዪޏ����⑬⓮⏮Ꮾ㐬⑭㗱⎬���ᑭ⓯㑮⓮◱㖱▲㖲䕳䘳䘳䓯㘳㖲㛵䚴䝶䡵䡴㟴䝴㟶䢷䣸䢷䥸䤸䨹䥸䦸䥸䦹姻楻楻樾稺䨻娼娺䬽橼樻婽橽檾檽婺娺䨽榼櫾樼奼��穼媽婼宼䮼䭾毾峾䲾⭽䰽����沽崿嵿䲻ಾ��尽����洿㯼������貿����嶾����浽��㷽ⶾ��������������������尾����篾�����������������������������������������������������������������������������������������������������������������������������������������������������������������覾樾����砽����螽����碾砽柽碾礿砿蟾祽橿槿����窾��竿窿��秾��襼����穽妽����燡܆�უ܆���߅�݆�܅�������߅����߉�ޅ�ڇ�݇�ވ�݉����ߎ����ᓬ፨ᓫ���〈ޑ����ߐ����ߎ�Ꮺߎ�㓬ᑫᑫᒮ⎬���⏮⏮㐬ᑮ⑭㔱㔮ᖰ◲㖲䗲㗴䖳䖱㗳䖲䗳䗴䙴䚳䘳䙴䗳䚵䞵䡴㟴㢶䡴㟶䢷䟶䢷䣸䥸䧹䥸䨹䧺䣺樽覽秺䪾詼樻媽欿樽檾檽榻妻媽樼娻婼媽婿禼槻姽橿檿窽嬾櫼䬺䭾櫼尿氿嬽㭾孾氽尿氿岾䯼����������氾��歼��毿����������派��������㷿��泿������������������������������������������������������������������������������������������������������������������������������������������������������������������������������訿������袾��衽秾��������������������������調������������������������秾禿詾��燢܉�݄�݆�݅�ވ�ވ�݈����߉�ߊ�ߋ�ۈ�ብފ����ߊ�ތ�ߏ�ގ�Ꭹ���ߏ�ᑪ���┭���ޓ�⒮⎩ߐ�ᐭᎪ���������������⑭⑯⑮㐬ᐭᐱ䖲䖯☲㖱㙳䗲䗲䙴䗳䖳䙳䘴䘳䗳䖳䙴䙵䜵䜴䞵㟵㢵䥷䠷䢷䞵䤸䥸䥹䣹她妺媼橽移嫿稻奺婽樽橼嫿穼橽檾櫿樽䧽檽嫽䮽⩽殿竿窿��椼樿窿竾笽款款孽嫾欽��毾����篾孽��簿��糾����紿����氿������粿��������������������浿������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������褿������������������������������������������������������������穿������牧ߊ�ڈ�݇�݈�މ�ۊ�މ�݈��މ�߈�ڊ�ފ�ݍ�ދ����ފ�⏩ߐ�ᔫ���⎪Ꮻᔭ┬⓱㏯⒭Ꮻᑭᒭ���ޓ�㔭���ᓮ⓯㐯⓲㒰ᒱ┱㑯㕲㘴䘳䗰㙴䗳䕰㚴䖲㕲䘴䖳䗴䙴䘴䙶嘳䝶䝵䡷䡶㣶䡵㡶䡶䝵䥸䤸䧹䠷䥹娹䥺妽橻䬼媾竾穾觽穽��笿欿橿欿橾橾��穼����簿檿橾槾秽檿秾窾��欿櫾欿櫾殾孽����������歾沿対������������������������������������������������沿������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������姿�����������������������������������������������������������������������������������珨އ�ދ�݉�܊����ވ����݈�ڈ�܉�����ߋ��ݎ����������ߕ����ᓬᎫ┫���ᔪߒ�ᓭᐬᒭᐬ⒫ᔮᑭ���㒫ߕ�⑭㖳㏬⑭╲⓰㔯㓮╰㗱㙳䗱㘴䖲䙴䙴䖲䖳䕳䖴䘴䚵嚶坶䝷坶䞷垵䞶䡶䥹䣸䠷䡷䧹䣷䡷䣻夼离壷䧺娺婼竿窾稺婼婾��竿��秼䩿櫾歾婾歿��������窿楼奾稽橾窿窾��筿������歾��毿歿欿������岽䳾��沿������������������������������������������������������䭾������������������������������������������������������������������������������������������������������������������������������������������������������������������������詿�������������������������������������������������������������������������������������������������蒪ߎ��ٍ�݊����ތ�ዩ���ފ�ސ�ጨߐ�ތ�ލ�ᒫᏪᑩݒ����ᑫᑬᖯ┬ᑫᔬ���������⒭ᘰ⓭ᕭ���ߗ�ᑭ╮㒮⓮ᓯᒮ◰◯ᗰ☱㘲䖯ᙳ㙴䚴䜵䙴䙵䙴䙴䙶嚷囶固朷坵䚵䠹桺砶䡷䣸䢷䝵㤺棸夸奸䡹塺棻祺婽樻䩽樻嫾��諾窿櫽䬿窾��訾��竾孾䬿������������������������������檿������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������铩ޖ�ۓ�ْ�ߐ�ތ�܊�ݍ�ᑨ������ከ߉�ސ�፨ߔ����ᓫ���ߓ�⒫���▬ߖ�╰▭���ᘳ䔯▰㛲⛱☰ᔯ◯▱䔮▰▱䖱㗰㖰ᙴ䗰▰㘲䙳䘲䘲䜳㛵䙴䙶噴䚷嚷噶囵䛵䡸䞶䜶䠶䞷壷䠷䣸䣸䟷奻硷䦺椺夺墺夺墷䧾騼媾檾竾��������������穽����款����������������������������������������������������������������������������������������������笿���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������砮���ܖ�ݒ�ޓ�ޑ�ߑ�ߒ����ߒ�ߏ�ݏ�����ߐ�ߒ�ގ�ߖ�ᓫߖ����ᑪޒ�ᖯ▯㗰ᚳឳ⢶䢴㢳㠵ᘱ☰┯◱◰㖰㗱㔯ᘳ㗯ᛴ䙴䙴䘲㘲㚳䜵䚵䜵䛶噶噵䛺杷嚵噵䞻杸墷䥻桷壸䤸䦻塸埸夺夹䤻榻奸䤺塹棺姻��穼檽櫿������������泿�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������饰ܞ�ۗ�ޖ�ޓ�ݑ�ݒ�ݐ�ޒ����ݓ����ގ�ߒ�ᑪ������☭⛯ߘ����ߗ�ߙ�ߜ�⚲㠷䢵㧷⦴᧶⧲ߩ�㤷㞵㙰╱䗲㘰☲㔯◲♴䘳䗯ᘳ䙴䙴䘲㘴䛵䚴䞴䞸圶噴䛸垸圶䜶䞸坵䟷奺墸夺棹壷䠹堺塸夻壺楻夻夼椽磹媾櫾窾詾��������������氾��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������許ަ�ߡ�ࢮޡ�ߖ����ᐩޑ����������ݓ����������ᕬ᛭ޝ�ޟ�࠱ᠳ⚯ߝ�ࡴ⟲⣴㤵㨵ੵߪ�ݩ�䧷䦷㜴䗯ᗰ◰ᘲ㘱♴䘰ᚴ䗰◲㘳䚳㛲㜶䙴䟵䞶䚴䟶䝶堸塸䠸柷塹堸䢹夻核埸墹堺壻樻桷䦽棺媼夹䥽楾磻榻娾����毿���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ꫲ۪�ߩ�ݧ�ܢ����ᔬᓪޏ�ޒ�ޔ�ޑ�ߕ�ߒ�ᖭᖬߚ�ޛ�ߣ�࠱ޠ�ޢ�ឳ⤷㥶ᤳ⦵⧴ݬ�ߩ�⭺㫸䫹䥵ᣴߘ�▰☲䙳䙰ᘯߚ�䘲㜱ߜ�㛴㚲㝵䝳㟵䝳⟵㠶䠶䡷䠹坸垶䣹墷䡷䤺妺堷䠸䧾楻楽楺姻夺䥼椺奼桼楾覾諾欿��篾����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������魵వݪ�ۭ�ަ�যܣ����ݓ�ޕ�ޖ�������ߘ�ᝰᜲឱ⟳ࡲߨ�ߨ�ۦ�রߥ�ߧ�੶⯺㫸㫳ީ�ⰺ㫶ⲹ㳻䪸⩹㣷㞲ᛳ㙱㞳㙱⛲㚱䝳㛴䜴䟵䞴㟴䣵឴㟶㢷䠷䟶夻栺榻奺䥻样䤹妼梸䦹䠹礽离墺好楽磺壽楼槿祻槽��驾���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������浺ⰵ�ݳ�ݫ�ޮ�ޭ�ߟ�ឲᡲᤱᢰޡ�ऴ⧴ߧ�ߧ�㫷શૹ㭹㯸ᬷ௷௷ᱹᱺ㰹㰹⪹⮺䲼䲺㯹᭹⭻䥶⡴⠶䛳㜲⟲⠵㤷䞴䠷䞶䜴䣶㡶⢵⣷⡷䢸埸夹夺槻墹堷䢸墺夼楻榻榻妼椻磼榼椼楼樿社觽稾秾�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������赸߱�ܴ�ݵ�ߴ��Ჸ⭷㮶᮶ᨴۨ�ੳߩ�ߪ�ਸ਼⫸㬴߮�Ჶް�୶௷ⰵ୷ⱷహ䰺㬶߯�ⱺᱺ㲺㵺㮹㧹䨶ᤶ❳㞳⠵䝳➱㢷䢶䝴㤸䞵䤸䣶⡴៷䢷䧺奺䡺塸夸䡸夹堷䤺墷䣸壸䦼棼棹墺妹䤺姽椽穿椺娿秽稽竿�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������鵶ݵ�൶ݵ�ܵ�ⴷݴ�൸౸ᴹಸᲸ߰�ష⯹䫶᰷߮�ߴ�ᱶഹ᮶ߴ�ⰹ⳺㳻㴺⳺㳺㴽䲼䳻䲾尺㬹⩹㧸䤶⡶䠳㢷䤶䡴㝳㣸䡶䢷䡵䟶䥸䦹䤹䥸䢺柷姻娽桺椺䣹妺壹䤻榻槽礽榻娽樽礼榿禿樽楾祾��誾������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������綹�ݸ�സ��ߵ�ߴ��ⶺ൹���ߵ�㵺ᵹ߱�ߴ�ᵺശ�߱�ߵ�߲�ߴ�ⶼ㴻㵻ᶼ㶽䷾��嵿嶼㴻㮺㮺㪷㧷㤸䤵㢴䤷䡶䢶䞴䢵㤸䢶䤷䧹䧹䣸䥸䤽硻碼禽棻妻姻楼椺奺榻婽檾棽磼橿礼������稾檿�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������縺ݵ�ݹ�ܴ�ڷ�Ḻߵ�߶�ฺݸ�ݺ�ݶ��ݴ�ݴ��⳻⳹ߵ�ᵸܵ�߲���ᴹ�᷼㵻��䶾䶼����㷿䶾崻䫺䯹㮹㬹㬶৲ࣵ㢶䡶⥸䡲⠲ᡸ䟶䦸䣷䠷䤷䣺��裼礼碽礹婽格楽䤻婽礼槹⦻娽祺娾禼檾槿����窾�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������鵺ཻٶ�ูܷ�ݺ�߹�Ḻ߶�ߺ�ܹ�ߵ�ᶺṺݸ��ඹݵ�ݴ�ߵ�ߴ�ර᷽Ḿ㺻྿乼⾽ߺ�䷿��䷿嶾永⭸㰹ᬸⱹ㨸䫸㪹䨸㧵䣷䠶㦹䣸䤴㤷㟴⥹䦹壸䨽榾��馻梸壽樿橽橽楼橽槾窽��������竿窿穿����髿�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������軸ں�ݷ�ݵ�⸸پ�ܷ�㹻�۷�Ḽ㵺ḻẼ㺽任ݷ�۶�߶�ߵ�ߵ�ൺḺݺ�⾻ݺ�㺾⼽ⷽ㽾⼾��㷾㸾䷼䳺㰷㱻㰹ⰺ㮸㮺㯸௷શ᪺䦸䣵㧹䦸䡷㤶⧹㤹姼槻妾櫿稻娻妻檿楺媿秿秾檽婿覿��窾������觿����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������涸ݷ�ݹ�ڵ�ڼ��຺߹�Ỽݸ�߶�߷�ⷻṻ߹��ݸ�㵺ߵ�ܴ��߶�ය⼽�⽿⺿㸺Ṽ䵻㵻㴻㴸ష䳺㳸୷⭶⯷௹ᬶު�㪸䦵㪶㩹䦹䨹䦸⥸䥹妺姻姹䥸䦷⥻奻槽��褼橿秽������窿������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������鴷ݶ�ܹ�ݶ�ߺ�߶�ݷ��ᶺ൶ݸ�ḻḹݺ�ݺ��ݵ�ܷ�ݶ�ߵ��⼼�ݺ�ຽ༾⸻༿㹽സ�Ⲻ㲺߳�㰻㲺⩴⫸䰴ޭ�ଷ୷⭶᪶⫹⨹䧹䦹䨼槹䧹䧹䧺娻娼婼娾榼橾槽��觾�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������赶ܵ���ڸ�ص�ܶ�຺۵�ݶ�ݴ��ܸ�ٵ�ߵ�߸�ݵ�ݶ��ܺ�ݵ�ߴ�ڵ�ݶ�ݻ��乺�යߵ��߶�᷻ഺ౸ⱷޮ�ݱ�௹ᰵާ�ެ�߭�߫�ݩ�ݯ�ݬ�ީ�ߪ�⩴ݭ�ஶਸ䧺䨹䧹䧹䧹䨹䪺䧻姺䨻娻娻��秽橽檿�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������鴴ڴ�ݷ�ܸ��ں�ڶ�ݸ�ܹ�ٸ��۲���߸�ܹ�ܷ�຺�ݶ�ߴ�ߴ�߳��ݵ��⸻ฺ��ߵ�ຼ᷻ᵹ�ݴ�ۭ�ஹ㵺ⱸ߰�߭�ޯ�߮�߭�ݬ�ߨ�ޭ�ޭ�ੵ߫�ެ�ਲި�㦶᪹㨹䩺䬺䧹䪽娻娺䨺䩾����觽���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������겲ش�ٶ�ܳ�ߵ�ܶ�ܸ�ݷ�ܵ�ݵ�ݵ�۵�ߵ�ݴ�ܶ��ูݹ�߸�۴�ܵ�ߵ�߳�ݱ�ܴ�ݵ�۶�ߵ�ݶ��ݹ�߶�ܴ��ݯ�ܰ�ݲ�ڲ�௷߯�୳ݮ�߬�ڮ�ݮ�ߪ�ެ�ߪ�ᨯݩ�ܧ�ީ�ޫ�ળߪ�ީ�ޫ�ߦ�⧹䧸䩻娺䩻姹㪺㫺䪼婽稺���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������鱳ٳ�ش�ڳ�ڴ�ܴ�ڷ���ض�ݵ�ݴ�۴��ݵ�ߴ�ߵ�ฺ���ݵ�ಷߴ���ݴ�ܯ��ߴ�ಶ�۳�ޮ�ۮ�ܫ�ܪ�ܰ�ޯ�ܱ�ߩ�ݭ�ܪ�ܩ�۬�۬�ޥ�ܦ�߬�ު�ީ�ר�ޮ�ܩ�ݯ�ި�ޫ�સ⦷䩸䩹䫺䫼嬻䫺䧺䨼橼櫽歿�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������꯱ٯ�װ�۵�ڲ�ݳ�ٷ��ܳ�۲��ܲ�ڳ�۳�ߵ�ܵ���ݵ�ܵ�ܳ�۲�۬�ڬ�ٰ�۱�ܳ�ݮ�ڭ�ڰ�٫�ګ�߱�߫�ج�ۮ�ܭ�ݭ�ܯ�۫�ܩ�ݫ�۪�ڬ�ۧ�ا�ۧ�ڧ�ڨ�ݪ�۪�٪�ܨ�ܪ�ި�ܩ�ݨ�⧲߫�ਹ䧸䧷৹䪽橹䬺䫺䪹㪺䩺婽����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������鱳ڰ�ٯ�ٰ�ڰ�ح�ڳ�ݲ�ܴ�ݯ�ۮ�ݱ�ڮ�ޱ�ݮ�۳�߳�۲�ܲ�ܳ�ݫ�ګ�ۭ�ܫ�ج�۬�ڮ�ޫ�٪�ڬ�٬�۬�۬�ܪ�ܬ�ܰ�ګ�ٮ�ݮ�ݫ�ޫ�ݨ�ܩ�ک�ۨ�ڨ�٧�٨�٪�٩�۪�ݨ�ݩ�ܧ�ަ�ݪ�ީ�⫷㩹䥵㧹䩹䩺䩺䪹䩸䩹䭼婺䫼姻媾�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������誱ګ�٪�ک�س�ٯ�ڲ�ۯ�ۭ�ݯ�ݰ�ڲ�ׯ�ڮ��ܬ�ݯ�ۮ�ٰ�ݰ�ٮ�ګ�ڭ�٨�ڧ�ڪ�٦�ۦ�ۨ�ت�٪�ݬ�ک�ۨ�٧�ޫ�ڧ�٭�ެ�ܫ�ݩ�ܧ�ئ�٤�ۧ�ا�٩�ت�ا�ۨ�ڧ�ک�٧�ݥ�ᦵᦵ⦴⧸䦷䧹䩺䨹䩷䬹䫹䬹㮺䪹䭹㬻������謿禵ி�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������箵ߪ�ڨ�ޯ�ٮ�ڭ�٬�٫�۰�ܮ��خ�ج�ݮ�ڭ�ܨ�ۨ�ݭ�٭�۫�ܨ�۬�ݨ�ڧ�ۦ�ڦ�ש�ڧ�ڨ�ث�ک�٭��ܮ�ڬ�߬�ߨ�ک�ܮ�ެ�߬�ݯ�ޫ�ڨ�ڤ�ة�ܨ�ج�ת�ڥ�ܦ�ڦ�ܪ�٧�ާ�ߩ�ߨ�⦵ॷ㤸㧺橷⬺䰻䫺䫹㫹㭹㫺䱾殽��竻垩Џ�Ə����ɰ�ݷ���������������������涾���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ꥦͯ�ܯ�ᰳݫ�ݮ�ܭ�ݫ�ܰ�ګ�ܬ�ګ�ک�٤�٦�ڧ�٦��ީ�٪�ڧ�ئ�ۧ�ܨ�ץ�֣�ئ�٣�٥�פ�٨�צ�ا�ۧ�ר�ק�ק�ڦ�ާ�߮�۪�ۧ�ݨ�ۦ�٨�ث�۫�ڨ�٪�٫�ت�ح�٨�ۨ�ۨ�ݨ�⦳⛬ܔ�ט�ϟ�ݦ�ହ䭹䬸㪷ᨷ᪷⮺䬼汾稲ې�Č����������������Р�٫�ܰ�崼䯼����������������庾༿亾��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������NXijm������ɬ�ׯ�߯�வަ�ݧ�۫�ک�ڧ�إ�ק�ק�ئ�֦�ܧ�٥�٦�ک�ڥ�ܡ�؟�Ң�آ�ؠ�ؠ�ٞ�ڧ�٧�ؤ�ܦ�٥�ۧ�ڧ�ۨ�ڦ�ߪ�ܪ�ۦ�ۦ�٧�ة�٫�ۦ�ܪ�ث�۬��֦�ڤ�ڨ�ا�ڥ�ݟ�Վ�Ɍ�č����ː�̝�ѧ�᭺娵㨵䬺䪲ޜ�Ώ�����������������������Ŝ�ƛ�ˠ�˖�̨����������������ᶻ��������䮲ڥ�է�ӵ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������4?O+9M<EV=G[afy�������ެ�੭ا�ݨ�ڧ�٢�٣�צ�ԣ�٥�ڨ�ؤ�٥�ؤ�נ�֟�Ԥ�֠�դ�נ�֢�٤�ئ�ؤ�١�ڢ�٦�٦�ݧ�ܦ�ݧ�٧�ۦ�ܧ�ڦ�ת�٨�ڭ�٪�٭�֧�ڭ�ت�٪�ڧ�Ԡ�գ�Ҙ�̖�ɔ�Ď�ƌ��Ë�������ɥ�ߪ�媵ᥳ���ɏ�������������������������Ĝ�ě�Ɵ�ͤ�ɤ�ˡ�̣�ɨ�ү���������庿����溾ޱ�֨�Ң�ǚ�ƚ�Ó����Ȫ�Ӯ�ף�η��ַ�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#3M0M'7R)6M,:N<DRBMcns���ï�ߨ�ެ�۫�ۣ�ڣ�ע�ץ�ب�ئ�ؠ�٣�ء�ן�֝�֢�؟�Ҡ�ע�ԟ�բ�֢�آ�ٞ�٠�֥�٤�ۤ�ب�ۧ�ۦ�ڥ�ݧ�ا�צ�٧�ק�٫�ج�ت�ت�֩�Ң�У�О�̢�͜�ɕ�˛��Ǔ����Ɣ�Œ�Ǎ����Ɩ��ϒ�Ǎ����������������Ĕ�������������Ƞ�ɧ�ɤ�ͧ�Ы�ѧ�Τ�̦�ͥ�Ц�ӵ������弿主᭯ا�Ω��Ο�ƚ��������������������x��n{�x}����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/J/J+9R)7P+9P,9O*8P8BWLQe�����ߨ�㩯١�أ�٤�ؤ�֣�ף�ח�՟�բ�Ԝ�ҝ�ס��ם�ԥ�Ԣ�ԣ�֡�ם�֢�գ�أ�ܦ�٠�ؤ�٤�ۦ�٦�ئ�צ�צ�Ԣ�ө�է�Ѣ�ң�̣�Т�Ϥ�̨�Т�Ϡ�Ν�Ȟ�ɞ�Ǜ�Ț�ș�ȝ�ȝ�ǝ�Ō�ƕ����������Ė�Š�ĕ�à�Ơ�Ţ�Ǥ�ʦ�Φ�̭�ͬ�ѫ�ͫ�է�Ѧ�̧�˦�̦�Ǩ�̪�Ы�Э�ְ�Ӭ�ϫ�ԫ�ͧ��Ρ�ț���������������������oz�gq�Ob�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������*8Q+8P,6H,7G+8N,9N,9Q*<Y5@UBI^lq���Ʃ�ߣ�ߦ�١�١�ڤ�ڡ�؟�ښ�П�Ҙ�ך�Ѡ�ԝ�Ҡ�Ҟ�Ԡ�դ�ҝ�ԡ�Ԧ�֣�Ѡ�Р�۞�١�ا�ק�ڥ�آ�٥�֢�Р�У�Т�Ȣ�ϥ�̦�Ѥ�Υ�Ψ�ϣ�ϟ�ͤ�̤�͢�ƚ�Ȧ�Ȩ�ʠ�̟�ɥ�ƣ�Ɵ�ʜ�ȟ�ɞ����Ş�ɟ�ƚ�ǜ�Ƣ�ǩ�Ȯ�ͫ�Ϩ�ѭ�ү�ү�Ѯ�ϭ�ͭ�ӭ�Ҩ�ʦ�ɧ�˧�̩�ʨ�Ϩ�ϭ�ϫ�Ϫ�ϫ�Ψ�ɦ�Ƥ��ş�������ɔ�����������|��_k�Ve{KYt�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������59G,6M.2=/8I17I,8I-;S->Y,:S.@]9AOVYm}����ܧ�㤭ۡ�ۥ�ݟ�ן�ٝ�О�Ԗ�֠�Κ�ӟ�ѝ�ӛ�Ҝ�ӡ�מ�՚�Ԣ�ա�ա�ԣ�ס�ա�ר�ء�գ�֤�ҡ�̜�ʛ�ʥ�ʡ�̤�ѡ�Ѩ�ˤ�ϟ�Υ�̧�Τ�ˤ�Ϩ�ϡ�ʢ�ͨ�̨�Ы�ϧ�ͧ�ͣ�Ө�˦�˝�̨��Ǟ�Ȧ�ʦ�ǥ�Ŧ�ɫ�Ұ�ѭ�Ҳ�ѱ�ղ�Ѱ�Ѯ�ϭ�έ�ϫ�Ҫ�̧�ͧ�Χ�Ҩ�ѭ�Ҭ�Ϋ�ͨ�̩�Ω�ʪ�̨�ɞ�ś���������������������y��eo�em�Vd}M^yci~������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������D>I55E39L56G.2B*5F,;T6>N17I4@Y9DVDMaIVlnu������ڥ�ޣ�ߚ�ڗ�͒�ɑ��ʖ�œ�ř�ʔ�ɒ�Ϝ�Ҟ�О�ҟ�ў�Ԟ�Ϛ�۠�֨�֞�ך�՝�ˠ�Ϟ�̠�ʠ�ɜ�ɢ�ȣ�ɠ�̣�ȧ�ͩ�Ψ�ɧ�Χ�Щ�ϡ�ʧ�˫�ը�Ϫ�ͮ�ί�Ъ�Э�ԫ�Ѥ�Ϥ�˦�Ω�Ϫ�Τ�ɪ�ͬ�Ω�̫�Ͳ�ӳ�ҳ�Ӳ�ӱ�Գ�ѳ�ү�ͬ�έ�Ь�Ϫ�̬�ͬ�Э�ҫ�Ѯ�Ӯ�ҭ�ϩ�ͧ�ʧ�ɨ�ϡ�ʛ������������������������t|�kw�hr�fq�Zk�Xg�Xe|Yh�s|����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������J@HD<M8:O/<Z+;T,9P0@X5>R/8L1?T6Gb9F[CNdKYqQ^slx�������}��s}���������������������������ĕ�Ɲ�Ж�Ԝ�Ѡ�͛�ԛ�Ӟ�ϕ�̘�Ɨ�ʝ�Ƞ�ș�ʠ�ǖ�̠�Ǡ�ơ�ˢ�ͨ�ͨ�ͦ�Ȧ�ԧ�Ϩ�̦�ʫ�ʫ�ͫ�ϫ�б�Ѳ�Գ�Ӵ�Щ�Υ�ͤ�ɪ�Ҫ�ϭ�֭�ͬ�ѭ�Ϯ�Ѭ�ͮ�ΰ�ҳ�ճ�Գ�ӱ�Ϯ�ͳ�ѱ�ӯ�ί�ͬ�ή�ά�Ю�ҳ�Ѯ�ͭ�̬�ϩ�̨�Ч�ȧ�ʟ�ɟ�������������Ŕ�����������u��ux�lq�ls�`n�_m�_m�is�es�hr�w|����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������JDQMEVKH[DDMCCSBBS7?U7DY6@V6AW8G]ALaLRd\`qVbzRc�dp�ir�nw�x}�t~�s~������������������������������Ȗ�ȕ�Ɩ�Ɩ�Ƒ�Ƙ�ǜ�ś�ǜ�ƚ�ʘ�ʠ�ș�Ƣ�Ǣ�ˢ�̩�˨�ҧ�Ϧ�˧�Ϩ�ɩ�Ъ�̮�ѭ�Ӱ�Ѯ�Ҭ�ͱ�ѳ�Ӱ�Ѯ�ϯ�Ь�ΰ�Ч�ɰ�Ѳ�Ѱ�ί�ӭ�ά�̰�α�ҳ�Ѵ�Ҳ�Ұ�ҳ�ѳ�ҳ�ѳ�ѱ�б�Ѱ�ϭ�α�ѯ�Ҫ�ή�˫�˨�ȧ�Χ�ƣ�Ɯ�����������������������������w{�t|�pw�jr�kt�bo�fq�gt�nv�lu�ks�gl�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������DQkLTpJPj=EU;;LACQKGQOJOMEQHDQ?DUNRgSUeMVnHTqNZx_i�ep�ou�s{�ox�ox�z������������������������������ő�Ē��������������ǟ��Ǚ����ŗ�ğ�Ǟ�Ȣ�ȡ�Ȥ�˧�ͧ�˧�Ʃ�ɮ�Ь�έ�̮�̭�̬�˳�а�б�ϲ�Ѱ�ҳ�Բ�ҵ�ϰ�ϭ�ѯ�ʹ�Ѱ�Я�ϲ�Ұ�ϲ�ѳ�Ҷ�ӵ�Ҵ�Ҳ�ұ�Ѵ�д�Ұ�Ҭ�ί�ͯ�Ͱ�ӭ�ͭ�ͩ�Ǫ�˧�ǧ�Þ�Ġ�£��������������������������||�yz�vw�sv�gq�\j`m�]n�er�gs�dl�a^vd[ojfypq~hn�}��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������T_yFSoAOl5Da(8R)8P3?VGGYML_KH\WQg_Xl\ZpRVqMXuY`zkgps�nw�lw�nx�ty�{��|����������������������������ŕ����ė����Ú����Ś�Ş�ř�������ǚ�ǚ����å�ħ�Ǧ�ɦ�˥�ɧ�ʪ�˫�ˮ�ͪ�ɮ�ʯ�ή�ΰ�в�ѱ�г�ϳ�ͳ�ұ�г�Ա�ұ�ͮ�Ͳ�е�Ѱ�Ͳ�Ұ�г�ӳ�ҳ�Զ�Ҵ�ҳ�ӳ�Ҵ�Ҵ�Ѳ�ϲ�ҭ�Я�̱�ͬ�ͫ�̪�ǩ�Ʀ�ƥ�ş�§� �ĝ�����������������������sw�nw�sv�lr�cj{]iz_h[k�^m�ap�go�_`rtp~���}~�ns�qw�sz�lz�|�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������KYt?Mi3Ea:Jh-=[2Cc@PoETuMQn\Un]\yTWrYWo[YsS[r^f}ij�fm�oy�wy�qx�y{�}�{������������������������������������������Ù����������ɘ�����������ħ�Ƨ�ȧ�ʥ�ʤ�ɭ�̫�˪�Ȭ�ɭ�ͭ�ά�̮�ϰ�ͳ�ѳ�г�Ӱ�ϱ�ϱ�ϳ�ҳ�в�ͮ�α�ϱ�ϰ�ʮ�Ϯ�γ�ѳ�г�ҳ�ҳ�Ҵ�и�б�Ͷ�Ͳ�Я�Ѯ�̯�̮�ɩ�ū�ɨ�Ǩ�ŧ�ƞ�������â�����������������������vy�lt�ou�sv�ru�fkvbk�Tc|Ui�cn�`n�bm�fm~vz����y|�z{�|�t���mz�gq�z�������»��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������?Kh=Kh7HfAMfDOiALhJUqRUqQYy^[|T\{NSqLLkOSn[XrW[sch�mn�uy�uy�{{�wy�}|�~~����������������������������������������������ě�������������ğ����¡�ʦ�Ħ�ǧ�ɬ�ǫ�˫�ɬ�ɩ�ȫ�ʬ�ͨ�ī�ɰ�̫�ɱ�Ͳ�α�ϲ�Ұ�ͳ�α�Ѱ�Ю�̮�ɷ�̮�ʱ�̯�̰�Ͳ�γ�г�Ѳ�ϲ�Ͳ�Ӳ�Ӷ�Ѳ�ҳ�Ѳ�ή�˯�ͧ�ƫ�Ƨ����Ĥ�����������������������������������~{�yw�vw�uw�tx�ho�ou�hr�^k�\l�co�ir�ln}pt�ry�{�������|�����tz�kq�jk~ffuonzsv�qn�{x�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������DNjEOlFMeKTmN\zEPnCPmGStQ\zY[zW[zYZpVQnTVo`^{_[odf�ll�rx�{{�z{�||�z|��~�|}������������������������������������Ù�������������������Ǟ����������¥�Ħ�Ŧ�ƨ�Ū�ɩ�ȫ�ʩ�Ȫ�ɫ�ɪ�ǭ�˭�˪�Ǭ�˯�ʮ�ʯ�̭�ʱ�˯�ͯ�ʲ�ϲ�Ͳ�α�̱�̵�Ϭ�̬�ή�ɱ�˲�̳�δ�г�ѱ�Ѱ�α�˱�ʮ�ʨ�Ǩ�Ȩ�Ʀ��������������������������������������������y�st�tt�qr�gm�em�`m�\k�Xi�en�jr�rt�tv�nr�|{�s{������sx�ut�iapkixsqoo�kk�kjzg_ia`pffuggwgfw������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������FOhFUqLTlITnM[uJ[yGTsHVwQZxTZy\Ys[\qWYs]ZoY]rgdzkh~no�ts�vw�ww�wz�z|�~|�}}��������������������������������������������������������Ş�������ǡ�š�ģ�Ŧ�Ŧ�ŧ�Ŧ�ȧ�Ǩ�Ū�ȩ�ȩ�ɩ�ɭ�ɭ�ɭ�ɫ�Ǭ�ȯ�ʮ�ʱ�ͯ�Ͱ�̰�ͳ�έ�̴�ӱ�б�Ͱ�ϫ�ʬ�ɭ�Ȯ�Ȯ�ɯ�̱�ϳ�ϯ�Ͱ�ʬ�ˬ�ʧ�š�Ʀ��ġ����������������������������������������zx�tk{ut�qw�jt�el~ikxak�ip�\athgnllvsr�qr�uv�x~�}�����zz�ynnbwrj|pq|mn~mlzklzgepaate^nkfsiamhet||�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������OVpM\vR\sIXvQ\xQ\{T]u\^t^_x^awed{bZo[VrbZsb]qeajf~haxpk�qq�xt�{{��{�yz��|�z��~����������������������������������������������������������Ť����¢����ĥ�Ŧ�Ħ�Ʀ�ŧ�Ʃ�ȫ�ʩ�ɪ�Ȭ�ɫ�ɩ�Ǭ�ɯ�ʭ�Ȭ�ʰ�Ϋ�ɯ�ʩ�Ư�̬�˯�̱�˱�ʮ�ȱ�̬�ˬ�ȯ�ʫ�Ǫ�Ȭ�ɯ�ʱ�ͫ�ɪ�Ǫ�ǧ�Ũ����ş������������������������������������~��{��{�|w�ys�pjxmm{kk}qr~pn}jdrb`q]Wghk|tw�pr}bfygm����y}�sx�y|�vv�on�rj}m^okhsil|dm�jexeasbapg\p_[n_cwdfutmz������������y�u~������Ž��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Y\q^_tRWpSYoXWm`]u\Ytnfqmg|f]re\oZXuUQm^[mfZpeb{ibvki}nk�mq�sq�xx�|y�{x��z��{��|��|���������������������������������������������������������ş����������������������ƨ�ǩ�ȭ�Ǯ�ǭ�ȫ�ɩ�í�ɭ�ʮ�ȫ�Ȫ�ǫ�ʫ�Ȫ�Ǫ�ȫ�ƪ�ƫ�Ǯ�ȫ�Ǭ�Ǫ�ɩ�Ǭ�ȭ�ǧ�«�ɭ�Ǫ�Ʈ�Ȩ�ȩ�Ȧ�Ħ����������������������������������������z��������|�yt�shwrjvkdxjewrl�rkzjcpe]nfYhogummxkjwgo�kp�wx�v{�ns�vv�nq�qy�cj}eesll|W_uPTmebod`uf_nh\i`\lS]pZbt\cuY]p\Ue[[i^bragwejybeof_hljty����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������[Wed^w^UlgYid[laZohYod[mdZmb^wb^paUj]Yjb]ugbxni�mj}op�vq�os�wx�{v�ws�}x�~x��y��{��{�z}������������������������������������������������������������������������������Ʀ�ħ����ǧ�ƥ�ì�Ũ�ƫ�ɫ�ɪ�ª�è�ȫ�˩�ǭ�ɧ�Ǯ�ƨ����ɬ�ʪ�Ǫ�Ȩ�ȩ�ɪ�ų�ʩ�Ƭ�ǰ�ȩ�Ŭ�ʬ�Ǧ������������������������������������~��|��x��z��}�����~����z�wm~tjzkdrjakd^mkeqmjsjbpg\l`Wc`YfaZjiktnq~nr�iplowrr|zy�or�mnwnt�el{XdwXbuY`sISiDPi^XkdZli[j_Zna_t\]m_]lf\jd[pb\q\[o`]njanfZrg^qc^nnen�z�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������c\jf]ll]mnarhZjjZebTfeXkdXdfZgfYji^nibykduqm�mh}ml�tj�nk�ur�rk�tu�un�ro�vq�tt�ty�zz�z{�}�}}��~��|������������������������������������������������������������������������æ�æ�æ����¨�Ʃ�Ʃ�§�Ŭ�Ǫ�ũ�ê�Ʃ�è�Ĩ����§�¨�ŧ�¥�������Ũ�ī�ĩ�ƪ�ƭ�ɫ�Ȩ���������������������������������������z��z��z�}x��|��~��}��������������w�ljxhbp_\mjbllgokblaWgeYh[O_aSegaqnq�pt�qs|gbmhfkhcrd]mkkrioyfhve_la_q`ZlZWiZ\k]_nSTk`Vii[jh^k`Xhb_njamgYlVUkd[n[\sRYs_`nk]jk`ri\lh\id[llbnpn����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������j\kiZji[mh[sdWgbVe\Tb]Uf[OVcUbi[lf^olbpmjylj|cb�kfvk`rh_upj{pl�ps�vv�qq�ru�ot�lr�ko�zz�|{�yy����|��{���������������������������������������������������������������������������������������������Ħ�¨����������Ĭ�¥����������������������é�æ�������¬�������������������������������������������w�so}|tz{w�|~���������~}�~z�{x�vv��~�em�dclkdokcmh\j`Vdxtzzrvnenj^eg\mjkvajzbk~dlv__k^Zmjm|gisjfvkfumgsg\hh[ilYckdogdvjkzhdqibmacpd[lhZihYdQUkLSg@Lc3Gc=Mh\_ra\sa_u_]o\`wYWp[ZlVTeYXidjxxr����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������cTccWadXegZhaVaYNZ\RZ]SY\TcUKVZP__Vj`Vpf\kf]ldZrd\oh^oj`voh|on�vq�us�vv�rt�plut�on�tu�ts�ns�xu�ww�}z��{��{��|��|��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������}��|�|t�un�yksvlzpl}zp}�y������|�kmvvr{�|�srykktmlyognkbmg^ordjlbllhqkgnlcismvb`ha_oedtd`n``ma`of_nfdvno|yv�thsnfwk_ihYji^molrnfsl\ii]kf^ngXf_XeLOdEKa@Ka9Lf4E`7HbGOeJRhMVlRVhW[pVYnYVjUSdUWkRShWXn~v����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������NHPaPVaS`_LPdOY[JM\HLhY`b\gJNYNELOKSQKYQKcRI`ZVi\WjfYk\[tji|kd}nr�qm�op�tp�mk�op�pl�qr�ki}mn�totm�up�zs�z�}|�{z��z��}��y��~�������������������}����������������������������������������������������������������������������������������������������������������������������������������������y�}w�xw�rm�a_xc_ruguulwso{~{�����~�}w��y�}v�{s{spwihxngslbthYihWacWceWa\T\f\cbXlq^cnfji`hiZfh^i]T^^Ugicmopzpktsn�pizh]modnwjtynwqfut^ikX^h]hp[ffVfWQhMLf[RcHMcKMbFK]<Ic9Id:Li>OlITiVVf^Tg]QfELg5D`1DcFPg^_ociy�����������羽�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������KHLOEPUERVCNVENVENQCKK=GL>FQDLP@GJBHKEMJGNMEPSN`WQd]RgYVk`\nkfukl�ljmj�rnqo�km�mo�lj|de�gi�iiqhysi{qj~qp�xt�uu�{w�{y�ww�xw�y}����}����z�x�|z��{��|��|�����������{�����������������������������������������������������������������������������������������������������y��}��|��������~�|y�zo|tjvtr�khzVXp]\pa^qpgqpr�uw����z}����st�vqwlitjm}baphdnieqg\ghZhiW^f\h_\kj[ijbpk^mmZbqY^gYeeQ^jYj_Shh]hganmk~ogscWhe\ol`nliujfvslvp`kgZij]kgYiialognaasPLe\O^_T\YS`BKa5F]0D]-?Y0B\FNeQQcKMdVSgQPe<Ke6G`JRmV]oPZkEPfcizx}�ah�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������I=HI@II=GO>IG=GN>IRAIHAJ;4AE;G@:EG:ED<EH=HMFNWMWRP\US\TScVP]YTdbateiyae~gi�gl�ik}jj�^_r\\tccvcbvcdxlexofulcwnktkh�lg|vr�ww�vu�y��z��y�z��x�wo�xr�z�}x��z��{��z��{��{��~����������}��������������������������������������������������������������������������������������~��z��|��~�}w�ss�|v�ujzzhswmmgu]asY`sWTi\Xnikou�zz�|}���{y�sv�mhwmkzlnzhlvVapV^mbdpjfmojvfcrmhmibhonfmimladdY_rakiYhi]kkcnkismjsj]kbWh]UgcZibblf`lnmvlenlhni`ljZccdlps~rsySZlZUnYPa[ReSSc9DW0B\"8P'9V2Db?Ne8IaAF_ZOiGM`<Ia;Kg<Le@OiETlEVmARjDQj������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������I<GH<FR?GR@H[EIbFHXBGS@JODPQ<FQ?HMBJH;CJ<GVEJUMSVNSKHMLFPMGPVQ\ZYkc^k]]le_lc[kb`of_p`YhdXccZkg^n\Xic^kd]ocan`\o\axe]olgztfmufrobprl}rlzultj�so�uo�up|sn�un|yt�vs�}x��y�u��z��|��z��{����������������������}�����}��{��|��~�����{��}��}��}��������|��|��������������������z��{��{�yx�vssf{qpixkdvqdlro}fctW[pR[p^Zpifsmq~yt|�|����w|�|{���{y�os�_htS_kIN\efjrpqpooonklnphqmbodWg]Td[]k^^ia\[f[\lhcomclmfqhdocYja[f^Zf]]ga[ijeoi`qk]jnclndhogjkipgjriqU^sDJVWXbrjpbYg=Hb3@W=J_7G_?NcBRj4EcMI_TMbWScDOf/@Y3E_9KfHUi9Ha:JcN[t���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������JAJRACWC?TDG_DGUCJZCH]HK_ELW?GU=ET?FI<EN=BOIJM@LQIQFIP<AO9:JUINWQ\bZddam[Uc]S]dVcdVacVc]U_aV^]RZ_UZST`VUecYeh_jkcnj^lj`mg[mnerk`rlbpictqepmbrmgyl_xjeulduueoxipwh{umu�uz�mv�tx�r|�y��x��w��x����}��}��|��|��{��|��{��|��|��t��w��{��z��{��~�����~��}��y��}��������������{��z�|y��x�{o|pfpl^dg`sh]okdtoaqresmbpqaoogtgbopaiuiswrz�{�|y�ww�~z�zy�lisjgqqhmkknidkpkcgkd^cXnifonojoianbUfdIcVPc^H]XXh`ZdiY`nX^k\^lU\f\]g^Wff^aihiphld[ek_gk]ipjpkemninnmoljrffmkjsLSeUQecalihpVZiOOgLM\6DZFRhGTg2E]7FaPLbPOe@Pi5F_(>\2E\4G_0Gb4F`1AZLZy������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������H=9D;:D9;K;6E:<@:<I<GK;;RAHWAJ]DIZGOH:CZFHV?ESEN\GLQJM?=G06B?>IPLVOOURMTXVaVQ^aSUVMX[KSXNSaNUbSViSWbTWYPT\S[`W]eW\iYedWbgXei]kj\feV]j`ka_nb[hk^mgXfj]kn^lj_jwfjqhwtcl{h|}hpzermp{oupw�ox�uz�z|�y}�y�y�t{�s��vx�rt�r}�kz~ft�ow�u{}on�ho�t{�js�jzkx�or�q��}�������~��|��|��u�wj{qclu_gsdif^i]SfeUbi[igXiiWbkZhoakrimokouiuym|z�wruvs{ljslema`oYVdl\iff`\dbcd]PWPY]blhfhhhnlmflgam_YjcK\TQe^SfUV\\PQ]OQV^[c\^c]fhypjwninnaoff\akcgkldakcjtnolkm`gofegiahgalaanecmY[hVahbhv[bs@Mf.@Z=H]IMZ=H]2BZBGZUMeLSiITh:Kf)A\,Da+?U8Hb7Hf5F_:Ki���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@15?37=08I:;602813C;A@71B9;N>IK>FUGOQAFQ@H^GK]GHXAF[EIVFLLBHMA@I>GQEGdPP^MOdVWSIPJENSBMjRQbQRSJQRGLPGSUJQ[SR]SUbVXcUTeUTiX\cQ\cOW]KNnRW_OP`[dtZbv_fj[hm\ducem^komullvm_jtdjp]hv_mbh�hk�gl�op�of�pk�qr�pm�di�jp�im�gm~\c{\e�el�gqygk|af~bm{ep|_gs^fnZcxbmsap�kt�z��y��w��q{�p{{ir~kxoezn\ieYhp^coZ\fXYhZekUbjUamZ^o_irejlajf^nriturxtorsdmlguvknrehj^lfajRXdBQVIQYNVRX^Znmlcjdnlogmhitg]mbP_QXqcZib[TUcX^g``nhjljo�th|vZnoj[^YVafJQ^`f_fdbb_erqqjkkY]bdikzro�vl|tm~zrpmpRU`adl`eqAOa6DY8G^AG^QK[HJY<FUOM^TOYRO[ANf-D[.D]8F]6Kh.If8Ng9Ia7Ig|�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������D67E56:/4<1:F;<G65E56F;>E89D>FJ@DK<AK>FI<=L@DHDGI<EH;@P@BUAJ\JJ]AEbMNGFN:8:K@?OCM=<N@=KXIJWJHK@@SGOVKQ`V^iWYcIGbNLhKImTQoVUy\[rSRjS]kGKzWZv[cyY[wYTlY]s_bykpmcliYbjZ^hXWs^bnRW�Z_x\`z]d�ba�\h�ih�il�pn�gf�ge�dd�\cvY^`f�^fiqm[brW[�[eZ`{[bz\dm[dv[etZis]o}al�ny�mz�pxwms{gprblu`ji^tf^lRTcSNZgWZhW\bQViXbfZe^Yf[QYn_k|rxf`f[Vefenfck\UdZVd[Q[cV]gV`fX\][ZI\RQ`[KY[bfdwtsaiilmjgmfUaW[c_JSUCM^V\`bSRq^_nX\m]ezpoong[c^Y_]QWXAMYLX[hmjRWY\[ckpe\jmclfpnpzsn�{n�t}omtrrmlniei^XaZbmRadVZhLI^QL[TOe][bg_i`YhWMcLN]5H^1D[/DZ1I`4Nh1Ga:JaBL`9Id^k�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������E48<12F58@10;/,H42B7=N::XFPhSR`RS^LHaNOLBDA50>5<85/@7:94<I:;G9>;88B:>.6F$+-&/9D>K57@@:>`EGlLPeMNhKJhNIiROnQOuQOyWQpOO_IMqKHvPPmRNzYU{WS_\|[OmUYwVRqUWlWUrafkWVjRPkQUjNQoQTzXP�\a{Y]�YZ�Y[�Z[�Z^�\d�^b�\d�af�`b�\_�[c�XZx^glZhhFGrYXzZ_zX\pZboY`qXVtY`qZdu[fy\h�ip�fq�jtl{xfm{bjt`ov]`q]d`SZVKTZJMaJQcRQ^SX]QVIIRDCL`S]jbhRRX9@NBFT>CQDK[SP[YMWVPY_MU]LVQa\I^UJZ`L\Sjspljftmiikk]c^PXU@JHCMVJMZZTbqbeyhnjchZRZlojrngYacVea=IQ:JPMUTV]`QSZ_\g_`dcidbinutj�~m}wgpmhvmeupkuql^_fkfmafmO]cUWjaUebXne[llevibqnl|f^ocUcXS`AL^<I[CUh6Ia6G^HVnGRl;Jc,@]<Kels�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������G4+?-/K4;E54F74I;;K70SEKdWXjXZ]LQ`LLjWTdJJWBBL8>W;<Q<BH:=Y:<X<DQ<CH::86>2.2<68O;<L@IH;CX>7P:;I:<O>BdEBfMIuLI{WZ�WQyUMzVU�XR�VQwULsWNsXTzYOoXSiTUlU\qROmQWpSLkUQsTM|UO}ST~UP�YX�^Z�\Y�YU�YX�YT�YU�VP�_\�\^�Z_�Z^�ZY�XU�abiPQiLWoRUtVSvOL|SQyXUsTSsSSyWVuWVmXZzY_|]g�fn�jr�hs�cg~[fz[cnOPkSVnX\rZbmJOkLQ�[ZpXUWPXEBK^HMcNRnY^n\aoURl[`eVVgSRUPRXHSWLQOJPUVZVf[FXZ@LSX`]agfOSTf`dqop\afCKSKNOVTZphijgjymq�w~_^mDI\Xa`aji[d^Q^];KMERSO\bZbced]khjhcfbc`jniusp�|k|vepnfyngytg�|k�{lypj\W\QWdf[hg^gf]k`\ka]k\Yh\Xaebm\]vXRiZXf[UZSW`LYf6Ie5Gc<MgFTiGUhFUj2E_5F_9Ie������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@1.D14>.2N66M:3N95H46\HHfPMdPJaHD[NO`SUdUaiTWdCBhEBiEA\>>ZEIgE@cDGeCEaFCF:>eA?xNKrWO`DEJ:9_BCtKDuNH�QKWN�^N�]R�WNYN�ZO�^UzVNqbcs[Wo__�nnq`^qQNrPNsOO�UN�WO�[W�_Y�[V�WQ�XQ�YU�VL�XQ�YW�ZY�YT�YS�VH�XV�XR�XO�YW�Z[{]c_FNhDJUW{VY{TS�RVuNM�VOuQQyQRxSOuWQtWX}X^�ee�lh�lo�_e^e|[d�Z\sOUoQWnQU�XW~[Zy\\oOPrVUrTMhRRlTP�ZX�d^~ZZ}\Z^^�`Y�]ZjPTfX[eY\WURSbZYg\Ua[U`SrpmiehQTYlcjqmh[ac7HM>FM[[\gghpjnlhl���iagQTXTZURYW^d\Xe]ALQQVZW_Tbj][_Zgef|nc�yg��j�}l�|l~slcfauqh��n|yl�ya�yi�whvlhkjnompnhm\Tg`WeWVfJMbKOeQWeVQeSTlZYl[SfTWe?Pd;MgV^mqpupsxintQ_p2Ec7GdWVelas������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������B21C.-M:<I4.O72Q:3aD@fPO]GGdOLcONiRJ\V\hVUhVUgLMjA>sIB[=7ZLKcIAwUJnIHmKJ`KKaFB�^XyZG|VN}TN�MC�UK�VM�_O�]T�`T�WF�\K�^R�ZP�_U�YL�^PqbYufa{rovaZWM�OHuRL�]R�[N�aS�YM�\M�UI�WJ�VK�UL�WN�VO�SH�UM�VQ�UI�VI�UL�bT�fX�__qNPzLP�SP�PG�VT�XP�XT�SQ�WL~VQ�VT�XQXT�_a�]V�ef�ff�lj�ef�_f�_^yVT}WW�TSwQR~_a�[T}SSrPO�\]|US]Y�b\�l`�ga�bX�d_u\UqXQ}a[nYTvc]}e`e]W]cY_aUW^YOXS^`_tlg}vtvtxa`a]^^:GNPTVPT\IHN`Z`lht���~jisiehnc\\Wdj]U`]HRTPUVOOONQOEMQTWStic�~f��j�|j��l��jvtj��l��l}yk}ybvpb~sb�{pwvpmoonlekdlpjxgcrHLXJQ^UZkYUfXPbPL_PUmVT_MTeQ^rfjqekq]jy^gqfkw_cmGRhX[r`XobTmkaw�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������K1/=.0O51E/+]94_=8bKEgQN_FB^PJma\jYS`OIoVRnXZoPHrD>xLCwK@wM<zRGvLEqHHbB>x[OtQGmOLfTL�gU�`P�bR�\Q�[O{TK�VN�XN�XK�YJ�YL�WL�WM�VL�[M�eW�lbk^yXM�VP�VM�TJ�\N�\L�_N�]P�eY�l`�vk�zp�sh�k\�uh�~i�zm�zn�yi�ti�tf�rf�g\�SH�[J�aP�aR�bL�hS�aS�_P�gY�^R�fZ�e\�\T�ZQ�i]�i\�b^�dc�gd�oidg�ef�`W�^Z�ZT�UP�h]�f_�`S�a^�_W�aZ�]V�lZ�qc�of�xzzjk}e^�n_�max\UsSOy^Wsiame]g^\[XXUYYVXWV[Zmpoopl[_`PZZESRRV_RT\TQV{vqyun����yl~uibhY]^Zii\vu]nn]LUWZ^XQWY\_Wxu_�y[�w^�wdtlcgbXda^keX�}d��k��k��j��j~|m�p��k�}i�{p��m��|����wjpiqkdnbbmbYgj\hiamjallhsdio\gj_it\dq^am`epikzgdw`\i]Xkb\o^TiPRn]Wmmmyoq�nt�������������{��~����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������E3*U71X;6S70oH>iHBiHCdOMcJDkTKs_\kabsQJrOGrSK|LEtNH~P@�OD�P>lF9XHAhUPnZS�oh�iZ�YL�]J�cO�cO�XHtGC|P?}P?�UJ�NC�WL�TG�QE�TL�OC�SJ�]Q�aN�^P�TG�QC�_P�bW�cY�mb�rd�|u�|r�tb�ma�}i�~l�~o�sc�|o�we�hV�yg�wh�zf��p�����}�����y��t�|r��q�ym�sc�r^�l\�eS�jP�bQ�n\�p_�h`�g^�i]�sf�le�lm�dZ�oc�ka�dW�f\�_P�bU�fT�m`�fY�aY�[VqQR�^S�e_��~��t��~�pe�gYx]PoQN�^[p[XdVRfWPj^`\XVga\WYTTXVY][kjaljjNWYDO[``fvwd}�n~�m�}m��k�qyrjg`Xqj^rp\xpXfj\5@J1=>\^Z|vbgm]aeVpsh|zaZXR`dWhngf`b�yc�}g�wjpqg��iw{i|}i�{k��p��f��f��d��j��q��w�vn�vj�wo�wt�wyvr{�w|�y~��yv{{jlkX[cQ^nTanmpxc]ndYoji|gbocdpZdppjupk|bYj\RkbVmbTieXdcUpeYkdVgaWj_[khl}�������������������������������������������������������������������������������������������������������������������������������������������������������������������������A/*V60b<7iC;hB8jB9i@;jJFuZTt]Vuc]jY[pXPXMNbSOwXO�SCyG9pD:k>3`>5�XLoMD�cT�jX�eR�YJ�VB~N>�UJ�SH�MF�RE�TJ�XP�]S�^S�]S�WL�]S�d\�cV�\Q�h]�j]�fW�g^�tf��p��r�pd�l\�n_�jR�gM�gP�gR�dM�hO�nY�jR�oT�pX�tY�hQ�jR�uZ�nV�tb��u��s��|��s��y��z��{��}���|q�wj�k^�nb�k]�]T�f]�ld�e`�l_�mb�ha�h\�bW�eY�^X�ZQ�\S�eZ�_U}[M�WS�ZQSM�b_�bW�`W�k]�wj�qb�_V~SR�UO�a[i^X_VXZQPXMM[YWWVWRPPQWUOON][[kjlQWRAISyvf�pym|l{|lywk}{jyyk�vc�r`uk]idW@KJ$./:HGrxaqrg^jVZg\��n}tdbgZgkagda�n��e�r`yvbz}k��rlq^yxc��j��i��g��m�}`qs^zubysfwpf�th�wh�ke�srzrrzz{xrw�{u��r�}nsrkWalXckVerfdpomyoourupeuj^stagzmhwmfqe_na\mg[pdWncZneZmdZq^XnaWkgaufas]_rsp�������������������������������������������������������������������������������������������������������������������������������������������������������������������`A?oE8yICzKCvE=~OI�SIuZXp\]qXToaVp]VoWS\JI\QP\OLlMHzG:q?/\:1~QG�^P�RH~OD�M=uUM�cS�fZ�ke�g_�i]}\W�to�j^�id�rc�qj�vk�l\�qf�nc�f`�f]�vk�ys�ve�xc�mV�fQ�kV�cO�eN�qV�hS�lP�mS�hR�gQ�kQ�nT�hQ�iO�hP�kW�jT�fS�u[�hP�^K�oY�jS�kS�iU�kW�oW�nR�lZ�pc�ma��m�~p�zq��z�}v�vk�tj�eb�b[�`Y�^U�e]�_V�]U�`X�^X�dT�^TvVMxUM�XNWL�ZO�fZ�[N�YP�XN�`U�bV�YO�XP�XTrVSoSLeTO_VYROPIKRYSOFKQLJLUOJQSVqd]yg[ztg��k�mx}lszc��vzuhuvcpue}k\n]RX^RFON=EKBLHjqeo~c_l^WaUkskryl}xcnlVljb~qk�}k�tato[q{gjxmi{tv�j��j�{e�|g�wc|yc��j��kkg]PWVNTOxl`�xk�rj�~p�zptpvqphnrfgnhllhjnYjnZwunZdlb^kjkomkjnnmmskaojVarilxkn}]ir[evacy`Yo]Sj^RldXn\UieVjjZhg\qb^yf\pbXih_sjavnh{�~����������������������������������������������������������������������������������������������������������������������������������������������������jI=wR@wNDyVJrJ>{OErSN|\Un\ZmZStc]raWf\WMEAYKJ_QJ^JGW40P7/hOG�[Q�YN}ZLtVR�_X�VK�]P�dV�k^�dX�[N�`S�cT�`R�]L�eS�ZK�`M�ZJ�XJ�ZL�\L�]K�_Q�u^�r\�mT�\K�\J�]K�^M�gO�iO�iP�kV�gO�eR�hR�hP�bR�_L�eM�fO�fQ�lT�n^�q_�dQ�eO�m[�fU�aP�iS�cN�^M�^P�VI�]K�XJ�ZK�eV�eW�l_�i^�me�vp�uk�vv�tnnV~nSoa�sW�iT}_Q�\M�SK�WL�VL�[L�^N�YS�ZP�_R�[N�VL�TN�QI�SK�TOtQJlUMnUOiSOXQOOHJMJIUPPKKMVRPSPPKHK_PMo\Y�vj}�okoeqy]nw`�}lvrcahX|s`�lYu_Wo^PhZKcmTfsfjqg`lYVe]frhrvkQ`Waf\}tgpkj~rlwom�rb�y`lwgtmeqe\hiQ\[rfZ�~iqn]zu\vr`�g{fzxbfe[��h��j~~j�zk{ukyun~{f}}mci]]idko`]d[rtacdaljnmpsosnmqu^glbgh_bifkpckwjmw]cp_`u_^uXMhXMh`Tj^QheWidXjh[olcvli{i[mfWkeWrjWqdVmbWke^ph`rkjx~��������������������������������������������������������������������������������������������������������������������������������������bYzbY~ke~i\zdZyf`�mi|gcl^^aRNgb^jc`l_VZPL797KIG@:;949L=?bJ@kH=xK>�R@�TE�QB�TB�WE�V@�VG�TE�ZF�[L�\G�YE�dO�YD�XD�YI�[H�YF�dN�fN�`N�eP�mU�eO�_L�[K�kP�`L�hQ�jO�`L�gM�dO�fP�cO�kU�cQ�eR�mX�eQ�]K�eN�oW�ub�r`�o]�gU�hO�`P�\K�_J�fR�[M�^N�ZL�YK�YL�ZL�[O�\N�YL�\O�fW�^V�cP�sf��m�r[tjU~rX}nYo[Lr]P�bO�aO�VL�VL�YN�UI�WO�VL�SN�`Z�l_�_W�WKQI{PN|XPiWSYQWcTSWMKTNRFHOH@DOJLECH@CE?<BDAMNAEicVjkZhl^mx_fqUSdRN[QR\Nty]yq\^UQ�dW�}gfqZ]gUdp`R^[`bUmthw{nbhhnlfzsqrkk�ql}vl�w`}p_O[Yp|pWadPZV]aN��\��i��e~{brnUb_OqeS��k��g��o��p��igdZVe[nz`npbx{ggn]jpapthR[XZ_UqmblnqglldprnttqppXedQ[aYbj[dainnpmllmrrhqgasXSlaYmf]kaTfZQegdzvo|tmwqh|i_rmZjgXkeZtcZoh[reYsi_rf`nlo�ow�������������������������������������������������������������������������������������������������������������������������������~MAsL;{PFtLD�PB{RF�gX{f[lUK[PPVOKrc[�tfsd[EDF:23>96V:0oC3k;3vG@�TH�UC�M=�WD�XF�YJ�OB�WC�WD�ZK�YL�]I�]F�\M�aP�iT�aQ�[K�ZI�bP�fS�iS�fO�]L�iM�eN�dP�fQ�gN�`M�iV�kP�_N�gP�jT�hS�kO�aO�^M�nX�eU�cM�sV�t^�ub�|]�ub�wi�jU�aP�eS�aR�YM�_M�fN�_M�XK�VI�WK�\N�bP�aN�gP�iY�dW�kOkbKniM�oPwmTxoStl\i^OpdUw_V�VH{OH�ZO�YN�\K�[O�QI�UK~bS�}wrg�\M�RJ�aN{_Qq`[eZWYNQ\PNWVXPPSIHQJJPB@J=AI879:7:;38ZTHzvbuy`ht]QaMMWS^lSekYglZfhM_WIaTMop]gm^R^MYc\}oX�xSoiTfmb}m�ztojn�}~��~�}k�tbwoalr_bfcZf^\cW~x`��l��h��g��noiVxtYrn_vr^�hpngdl]kocnn_{t^ag]MZ[V`[gma��hqp^_`Y]fdenb[iaaol\gn_jjblpbg`[cc^da�wk�sfrmbgjfhfcsnlssmqqrssykdqaYnebrbduhbxqk}qfui`vcUfWUiTTofWnn\hi]po_qmhuchqku����������������������������������������������������������������������������������������������������������������������������c;,sB5mB9lA:~LB�Q@{L;SCnTK^QLlb]EABAAEKKHrdZlO@sG;pF;vK<�Q?�TF�UD~RG{OF�fS�YK�`T�k`�ZJ�TD�YI�SD�WE�WC�ZH�\M�\K�^L�`Q�jP�jS�]J�_F�tZ�cR�\G�gP�cM�fN�kO�]L�\N�^M�hV�aP�fN�_L�dQ�fO�dM�jT�jU�kS�nX�rX��e��h�ya�wj�ui�tg�qc�ob�cW�gQ�\K�YK�dP�[M�VL�aQ�_R�eT�bT�dVaWvmRceIZYEVMA]WCUVESRH`ZFcWJiVOcSI�_W�bQ�\R�]Q�YN�SK�]W�o\�r^�rd|cR~bT�_O�hT�b[pe`eXXd[\YUVFOR09E5@D<AA99C@7976;B@CaXOsm\ioTV^O_p^MZNYdQ[_XNUQRWPniLLK@OXMafYDHEok]�]yhN[]Uqqlwpjjdbhb[�xs�xuznomeQ`ha^hWhjhnqaptjvtj~wnwsaqk`�}nsnafcVgcSWXR}tcig^QVRWcUR]Q`b^en[HTO=KDhla~ybxrXtw]EQTDP`cla]ifimp`icgidoocfiijkfskb|ncurjrmlkhghlehoebjhX^]cjkdhnbap_dsijqgk|njzf`n^awaWnZQmZQodXkiZoeZl[Ypa`ujfmhfv������������������������������������������������������������������������������������������������������������������������o;.h<2xLCyF<wG:yK:~O;�XN�gRwgU{udSNE^IAjOA[L�SB�NE{M>�SF�VJsF<uF;rJ2zMA�VH�RB�WC�`J�WF�ZK�Q?�WI�[I�VD�XD�XF�XA�ZE�_J�kQ�bM�_K�`J�bN�bL�]M�]M�`L�cM�\L�kW�bL�[I�[K�`N�^M�eN�\L�\J�cL�cP�lV�qZ�r]�|[�x]�zd�|k�vb�t^�u]�o[�s`�r]�^R�XK�XM�ZK�VH�YN�^N�aS�cS�f^�`TxWKqjT[ZEh_Hf\DaWCYLHGB?G@<MC=ZNFZH=r[P|aX�\V�e[�`X�WP�RI�YL�ZL�_T�bW�eW�YS�ZO�]P�j\�j_�pfzbSog[lcYd^XVPKTMGWHJ\JGjVR_YV^fZWaPM[Tly]M_RDTI<NCGTJ:GD9>:IHC[WMTYOILG�tm�yoILF^XO����wqcZ\�vx�rqxqrmglca\bf[LUNmjl�c��bmm[hhcc_W^`QjiaY^[Z^XAHHTTUyp_qmbgkZ^kSLVST`X`nXbm^pm]�}l|zg|{ebd^bd\^af][_X_c\chxqouqh~wetl\kicif_ffdxmitslfjfWa\jlecc_FR_Z_aX_a`gs[du]eq^dsglvbjvObwQPh^TecWkZQjTPm\VqMUnNZqe`tdWreYh���������������������������������������������������������������������������������������������������������������������PC�U?�VF�P>�VG�\H�aQ�g^�vc�{`�q^�gQ�nW�bT�[IyI=vE<xE<�QEvF<�K=tF:zB5vG>{L;�MC�MD�WH�N>�UD�XC�XG�SF�^M�\G�ZD�]K�iU�`K�\F�_M�bL�\L�XK�[K�aL�_L�aO�_J�^L�cN�`J�ZE�\L�YI�[E�[K�cP�YG�^M�fP�qV�uX�zb�}]�sX�w]�sb�qX�rZ�eT�iV�dR�eZ�\P�VI�VE�ZJ�XJ�ZM�ZL�YK�bJ�j[�]TW@oeSkiLWYSGLBAD3_WL[KGaG?iNKMKGkOCrOFyc`|g]�me�me��z�ol�YQ�QJ�VJ�UJ�VL�ZN�]R�QJ�UL�ZM�ZV�hZ��b�{f�va�cWuUP}WPw_Wk^Wdd[U\SO[Jk|_euW<LI<QHScHbj]JPA+/6??=HLIUWPY[N}ob�xn\TD�pZ�}z{w~cacRQTfadma\[SUe`cmf[ZVRynf��j{vblq]hgY{scih]^^TOOMqlbgf^�r_��e��f�}bryfdqeZkUQaT_lbvy_yrc��gtvkzxd��k�yj�zf�j}rf�{m`c^[a[\]^ei\_`ammj{qkmklP^_clinngcjbxuo�{h�qiK]YL^n\guZeraiu^jxFScMQk^QmeWl^SgNPi[QhRUjKUnQPldWkgYpcUfc[gacsio���������뫵Ѹ���������������������������������������������������������������������������������������������RHvI7�K<�R8�Q@�ZA�_H�XK�^F�XB�UE�S;�TK�SGqJ0rA5rD8t@5{JB}G>tA6c:1c9/sD9�S<zD;�K>�ND}JA�PC�S?�YI�SD�XK�ZM�\K�cM�]H�^J�\L�]J�aL�ZD�[K�^M�WH�L=�YI�ZF�^L�ZJ�YL�ZM�[K�[K�\J�ZI�]K�_L�_M�lW�dM�uV��Z~qS�vV�sX�jS�kY�qZ�hU�iW�_R�`V�]T�SG�UA�QB�WJ�TD�UB�TJ�^H�]K�UD�_JidHypNdaLMRJQVEZ\KUQB[PLTCDUI?PAA^FFdORbJKkFFvUL�cU�a[{aW�jb�^WwRK|OH�KB�RH�QJ�NH�RI�^P�v\soOwiU}y]�lQ�aT�]Y�a[g_V]^XR\UGZP]iPWoQ9FCIYBNbIPULKMI5488:7FICBMILXCRPN�xnn^L]WN~qm�xxf^a]ZbZW_\XZQOSie`�pYibVvjdaaWY^UupfV[QZ]Uig\lf[jgaffc`^W~eQ�}d�zdysZVbUO]TEWHO[U]bVfm`alafk`_k\Vd_ow`��l��k��i��k��rhmfgg]mk]je_sqcimefd^a\XW\^Tad\d`R[\lolrkfvjaWbbDScESjO^gWdlLZpGTfMQaMLiQMh\RgfYjbYjfYkeYq`TjeXkh[ihZihYkhZpeZihdsngv|u�dn�ly�������������������������������������������������������������������������������������������tP;hF1�T>{RE�XGy_CvZC�S:G;qC3tJ:�T@�XH�Q>�WE�P9�Y6�R;lB4o?5wD6j>/qL6|H<sD6�M<�LA�I7�SG�WK�WK�UH�XE�YF�\M�^C�YC�[I�bL�]K�YE�[K�U;�UB�ZJ�TG�Q?�QA�SA�ZL�WF�ZK�ZC�S?�[K�WF�ZH�ZI�_G�]L�_O�dN�nS��`��\�wR�tc�se�pb�oa�gW~aU�]N�aO�QD�M@�YH�QC�UE�RAK?�]M�uS�lO�pQ�tT�uQkaGON=MB6ndJXUHRJ8^R@8;9>81E8;N2+a@>d=<pC?qJF}LGxRIkIDu^S�qeyih�a^�bU{RJ�gS�xY�v\�z]�}\cgOwqRzmO{nY�lS�[O|ZOpXQXRJYaPM[KQaNDWP6F;=L<ALH256<89IDGbVMZ\NCKCFF;CCK�rnm`TXULrkj���nef�y~HGFJKMXYXnrkxn_VRXri`dXPyrc��ngaZYRQhgbfeZdf]WXQVXNPJJ�qX��b�{_`^N_g^UgWfrXnqWrq^UXRZd[cncam]Xh\gtcml_�se�~d�q_��jvvhSZRZ[Ycj]Xd^U[[`_eRYbCQ^CRZJY[EPV^_aJLVCMW,AU8GW@O\O`iIVcDK]FIYEMgPPgFL]VRbd`t\Wl^Si]Rg`TjbVjfZicWigYlf[uhdrhYjo]qg[lf`r������������������������������������������������������������������������������������������h9(mL9}_IgXD\O6cZ?RP>`WDaJ?tfM�|C�v>�t:�i4�r9�yA�q=�n;�rBuP4�W<�N?�RD�P>�PE�RB�YF�XC�ZF�[G�ZC�]F�ZK�[D�XE�`I�_D�[E�YD�WD�ZK�UB�TB�UE�W@�V@�TA�SB�TF�UF�P?�WA�ZK�XG�VH�VD�XG�\L�UA�L:�aF�tY�}V��\��a��]ymNymO�wV�uXjRq\KrNA�P?�VG�O:wF:}F8}E7|K@�bM�kL|rQ�zOqjFwoGvmIbYIm\TwgO{lKoaKKG8QL@@>8-'*;*/A01I55L80[;9Q58P9:T;:Z<9rID\M�hW�o`��r��h×jʡq��djoQbiF\eJ{�\~rR�tXx^NsOHuZL{RE�WM�cS{hXukV`[MPNDI@@FA>B>;bVO�|m�vmvleuhXmcZiYO}f_�ngg[Yk][����yy�poZUW\ZV^cVJTNKWSLVTxhc�~h��s��o�o�ye�}c�}`olWbhOfnVljUtl]loUVTIqcTkkV_lZen^hrXefYjgRIPGLSR]h^Zg[WdWJUNpo`�v]�q^�zg^cV_cZpsb|w^hd[JUXSUYOSZNV\ANS@QTGWVO\UFRZ@SZ6IYFX]KZd<O_NXeLH]KI_HMdRSiPLcMPcPOf_Yg[VfWRgUPk`YoeZk`TheWfeWi`VicYkh^qgYmfWhfcoqq�x������Բ�ᙤː��������������������������������������������������������������������s@3i@/c@7U=0H=0TNF`T?e]Me]?�j@�z<�n5�r9�`2]K%^M'`O*s_0`T-VI"�p7�n@�]@�O=�N?�YH�ZB�\J�X>�XB�S>�ZE�[G�YD�S8�N:�PC�WH�WG�S=�T=�QA�WE�RB�TD�OA�K;�UA�WC�YF�WG�V;�Q?�YA�TB�[F�_K�[K�YH�pQ��X��a�|R��W�~[}xS?F1DE-jiM��`acQ_YJu\I�I:rD6l:.X2)a9*\<,vC;�iOzQpnElf9heEjjHQS7=D3MF>�gK�tNueIhXGRA9Q@;HHNdUSs]ZwKCnG?]=7rIGqMNpKH{RJ�YM�hS�g[�eN��c��h��c��g�oOQ[F[gG[ZByrY�~\zqY�mT�aUzVJrF@qKG~QM�cQ�aT�aQ�[M�\S�WLyUG�q\�xgwh`�n^wm`�yk~kbo]aUJ�qm�{u��|�pm�shpkek`U\[P@FI5BJ4?;�sf��w{zg{xh��c��\��]�wX�{WklOijXofW_a_\b]ADN^OH�n_U_T9FBU`N`fRjdZRRKM\JKYPHXQVjVMaWRaTgj^um`�w`jgT>IGO[Lr\�u_ldYib]INUHNX8FR0BJ7HP<QY?T^M^^?N[2RdCVa7L[DNaUT`fam`YdXUe_`rV\jRVjRMdZUh[WgVUi^[mYWp\ZnUTn\Xlb[mkX`iYebWohYhgZj[]rfdqdZlrht���u��bu���iw�������������������������������������������������������������iI?RB7I1%J:,G90cQ?oaDdX6�uA�r9m8�u@�k4~^7XA#^N+jZ,aL)]U+~s=sk:rm1[F&gP-�R5�U<�YG�W=�V>�UI�RD�K6�L;�SApK8�K?~D9~C;}G<|G?xG:�S>tK8�M>tH@vB<�T5�O;�RB�ZL�UD�XB�M?�M>�SC�eO�aM�cO�xV��R�yN�xM�kE�rN�rMpoGUT==B1go[myaYgLQ[FbZBtQIM3+J.(M7,G.%^IF`[RmqWir[YYC�sMdc@UZADG;"$ $A8/kR=QE/WS:jUNkba�{v�|t�{s�h]}WK�\M�q]�s`�eP�`N�cS�`K�ZD�wV��`muR��R��k�oQegO�_�sU�uZ��^�ve�l�{k�{nh]oTMqNKqOE_BEuMIxVN�^T�aT�aN�oc�|f�ma|k[tpawjxm]�l`dTP��}������~p�lVrfPvk]jeU@KO9BI%/:h_\��m{^�z^�|Y~vX�|^~qOxpQslNwlTRNM>?FWXPr\P�lR�v]\cTT^Kkw_lo[olW\\K@PR:GH,?C2AF9HM7BOT`PSVQqg^@BE*8>=JQ^iTccVohXd^UbedCQV+9F/>P%8F,8E;MW=IYLYXN^[=M^&?LBQcgkelmdfbjb_mVbgR^jXhrPUjSOiZWkTTbSL^WPgZVkOXpdcncWihXci[lbWdeXhdVhbVjfcrlftfWgdWggeuhp����Tf�DYt���������������������������������������������������������V:,QD4KB-SK<[H2qVumFxw;�w<�u6ug.vg/s_*T@"WG#qY+hW%N@!UP'{m8sg5cM*^I#rV,hN$aD*�S1�S<�YE�UC�TG�L@�J@{H9tB;�SGvM<xE>D8�R<xI;{D:�NA�N@�O?�K>{J2�N?�Q=�S>�J?�L=�^I�YK�RD�eN�tV�tS�~Z�kB�{=�rF�xA�c3�g;�|QuMcbNptYJT@?I32A2CD3d[LB((A$#@#!\=3gaU>I6GUJ2@3?E1eaKf]LCD2&4#!'&%=--S=4\G8fRE�[P�hU�]H�eP�cO�bO�cR�fP�pQ�aN�iW�cO�_P�hU��]��YqpN��`��W��W�~]weOl[NsjTw|\mlU�sc�cZ�iY�|p��q�zj}iap^\w[VpJGsKJtNJ�\S�{l�yh|g^ng\wq^ojXa\Qr_Qvc\��y��x��q�sR�w`�o]�rdvo[ag\gfZ6=D^VR��dz{bqtY�|`�vVtS�zSthOqhPZVEGMEHPSEHIq_[~iS\aVVaLxz_pq[GSFKTAHVQTiOVbT;NG1FF>LCOZThn`\]UWQNJHD(2;,7?2=HELNdgRUZTeqd\n\?NO:EE4GN)9P,<O4CTIO[W^Z<LV5KUJTX[cc[gbVdfaiiQ_eGQ_J]dR^mXXiSSgVSgQPhQMfZRd_WeVSgVRhcWleWik_m^[l][iaZk[UjQWof\lm_oi^kogyrw�Sh�Uu�Uj�������������������������������������������������������I0$2*1/NM@qhJ�qJ{u9xu:�u1qd.eK!~c'`P):/]R*\V&YT-KE#VU(xj:VI(XB&�^9^=+N;$H7yL5�TB�WK�V@�WI�TD�XH�XD�VJ�SB}OD�TF�P?�XE�RA�MD�L?�J=�MC�XK�SB�QD�P9�T=�SB�XG�XM�UH�fN�xR�sQ�fL�wP�vD�|D�`6�_/�_2�`6yX9wmMejNfmTU[DDN@&/)5;2nbNO:-B,)V53eL?XcPIVC7A3@M8CP>@K?KR=;?:"#PTDcj[RVT�ZL�_M�bM�bN�jS�kP�gT�oX�jU�cM�fS�kR�nV�dS�dN�dP�iR�bP�wV�yZxyU��i�~T�{ZwkPprYup[goRjrQfiLnnOzpVy^SsNI{XO�eZ�sh�|j��l�td~g]yc\�nY��m�k`vh_}s`tr\geQVZO@>:G>9o_UnbT_WQ}jP�ub�s_odPleQkjXsgTwlT�za��bqsY�U��Z�uS{iSugObWKtmO]XKKOF\]]`_dagXfmVJZMN[GemR`eI@SD>LDBODj{U{�b]hN^k][pYTbL]i]QSW\WOWYL%3C,8>'07FKOtkR|~cdr\YeZbpabqbQb`4DUDMN`cYqmbCNX.>N?OWR_Z\a^S\eLYXM\\[b`U_m?WbJZfYUgVTgWYkWSgTNeXSf^XfVUbPOcSMb[OcZ[gWbr[dmfiq_bpFVq]Wmv^iucon_pk]ki`rkp�_o���È��������������������������������������������������I;5k\SMM532(MP9zeGxHnm5}v8G?Z@mU$P<!qZ*YT'd`2k\3^N%[M hW$lW&YDnT-S=&@2;+X<*�O8�P=�I-�H8�I6�O<�L<~Q<�aI~]LyaS�hM�hP�vR�_H�QA�VD�QF�WH�VG�PA�WG�]O�lP�mP��]��a��W��Z�sF�qC�|H�s@�m7�V&�Z2�_1�_4�[2�nFwrVnp_jdS?I7!)&8?0OP=.+'1,.hd]mxgYfN=?,79-]aMRaI1>4/1%m[I�uY��nbhQIL4eWC�kV�x^�{`�v\�pZ�dP�gS�cP�lS�iT�pS�pW�iR�iP�vZ�uX�iO�pN�hKz^C��]��d��_pzXhmQprVpy^enN^[ANS:_X=?62W88qB?NI�RH{WO�`Y�aP�eU�tg�ya~sec]XsoaipYV[X\_PbbLLD<OD?ILHNUHOKAh]LvjSrfW`YMYWHdcNynXoW}[w|YlqW�zW�vZ�~^�yR{oPjeMwiP\S?QSDUOLwdTrjMW[TenWS`HjxWelQO^NP\NP\STbK`iVfn[rxaTcT8HKDPKQ\V`dLQYK2CG0>9UWRxrV�~g��iinbamTUgcVgXVhY9LGvqawxayw_hkcY`Y?ISKYYAN\NY[DT_KZ_JUbP\`CV[8H[?FXLL[VTheaj`\dWRdYPb\UeWTeRQ\YR_^`c[fiblkmnj`hm_hkrmt�lp�oljkr]p|bmj[iPXpIWm6IeHYt���������������������������������������������-)<7-^^EQS<TP4pm:qs?gl5jq9TY-dX&rg1`[+q^.i`+^M(hS%V?UBqW-hY.n[*m]-D8B7<*Y<+�R?�P<�VA|XF{N:�WFwM=�N:|XDx^NxhL~qJ�{S��Sv]=}S=p@3r?/�J:�K;yF1�R@�ZI�hN�uZ�zX�tK�vB�|H�i<�n6��G�{;�}@�e2�gAf<]<w^@�jK�rV��bvx]GJ6?C4=C,2<+ROBnaOckXP_TXfNafQ]cPKYE;E/FQ;BH9}oV�dheGueHZP9IO<]UI�_M�pZ�oV�kW�gR�fR�qU�jW�cN�fQ�oU�lV�qW�rT�oM�rW�rT�lK�{`��X�iFkgGjsM]^F_dQ_gQ]cDY^HPRG=A96355),P5;eB<sMG�VL{PJwRK}]Q~^O�bT�aM~bO~oae`Vxqati^}qjzi_pd]`ZQQQ?VI=o[Lc\NZ[NUVIOSFbaQ�nV|jWohVfgVxx\�{[��`�yQzkLxaGwlN}gKB@?)0401-XRKbWOPOH[`XFUFU`HLU@7EEMZKhtT9?<9FACRINXGP`X?SQGTHPZL^^QacW=B;\bVvzfqr\efVbfQip_v{dry^rz^<ONfx]ryegiZnm^pjahj^T\O@MTBX`K\PFV[ESdKWY=QXWT^]PYcVbjcfkjmjjgkkda\g_ShZUeWOd`VbY]jL[iQ_TVg_RaYVdconi�xk�pg�niiflcfqvnslht=Pm;NgCUj0Ec5Icy�������������������趼һ�����������������K7(=3"7,HC,�o3tn-NW#NW%Wb'QX-\^3Y`,c_/ZT us8[K"bE"NA$\O&td,RB@9D76/C:UC"<0`=+iI2bA*\D%dH._H2dL2aL5UA)z_=�zV�}R�}QuhGTH/=,@%W.*r<'�M6�T@�fN�bK�pV�qS�hM�jL�o;�]2�Z/�i0�e2�g1��=�g;aQ3yaFwfMeV<qXH~hL~kPp_=�oK�}S�}NPO9g_K��]onY=I34=6GQ>>J<4;-LP5pmTreDlmRhsW[`DtmKggMktR`SA�ZG�`P�bN�qX�mO�cL�cM�iW�bP�ZL�hP�uU�uW�oW�oR�u\�w]Ɔ]��a��Z�rQ�{`IP;hdGruZU[AY[@AM7GQCBJC372525D20Y84K66R52d;3sFEzTLwPEzPLyXS�`U�ZP�^N�kV�s\�v_�}e��z����~y{v\viUe^PZRGD@8MO>meMl`OUMFDE<PNI�}[�tV�pJtcHmfHdS?teMf\HaVFIEC',,167_UKj`MWaKTdWKXKH[NG[OIT@S\@V_OO^H8EFHUE.993GIMbUO[YgnU_dOlt_lkVSVHW\J^dQisYhmYxw]il_]c\\fUahXak_otcci_]hW^f\TbXQaZN\VETY>QQ<KJHYW=MTJTXcagokiac\S]\U_`V_WXY`VR`_\h^UfYPgN\gO]YSbaJW[=JXFSRMXWwk^we_h]]xjcmlgX]b`dl\ckHZaQ]gYbmO\nQdso{����������������kr�jm{x�tz�vw~uz����I/:/2) =3&}h3�l1[`+:H#EI\^*gi3VV&pa-]K$cX+RI ]M&dY-C?0/.)0&%#!! !0-4/D2hH/vN0c@/�cJ|Q7cK.�rWz_Jw]>�wK~sDodAVP:;4&,!8(#v;/�P7�N7�]H�iO�lM�fMr_EjZFpX>t_9w[,sP)�b,�g1xW&�o3sR-M>%UN5k^B^R<r^;|eC�g;x^4{X3qW3�d9�uC�m@�yM��a=J4 ,1<-%"1;1CL>mmRisWfhNdp[]kU]dKa_Li_E�T<�iS�lR�_N�fI�eM�hO�`N�\L�ZF�fM�iP�dN�bM�uX�oY�w\�xW�{]Ōcʏm��u�hT��azq[HD7<?(?B,'!%-(>J?PLGZ?:W62T23W85_=:];?l@BpJFpO@QM�TLyQI{XQ�aW�`V�\O�gT�iR�kW�o`�|m��o�wf�zh{i\laTp_IaTIAG?-6-RVMmhUroKdU@qbPf[C>=5TKDg\IqcLf\PIOALNHbWLbXMZ[E8I<EXLASD!/0*;61<>8AB@LBL`SKZK*3%3BUMRbWbhWcjVluWupZkkOaeShn_ajTfiRfgMhj[\gQbk]XaS`h^fm``h`ZbZT]dimnWe\<HK=PT;KS;KJ<KU;IX?T]dea[ZV[aXQ[[Vd[VddQYYZQ`ULRUWcQWdN_hYifJYXFTU6GO=MKKW^V^Uhe_nc_�oblh`KVeS\c]k_Xe\Uba\d\ehgWhrZlv�������屺�Zh~T]lcjpP`gS_aN\gTac]ilE9&B0?:'D>"ja/vg7RE"bX*a_)SO$VD*ie4gY(r]/k[+k_/ZO$RG92!&&--99"13:7/+4,+)I=+s]<�pZ�zn�iO|dO�xh�o`�nL�sJwiEf^B`Z?j\@qZAlUGxI6�UF�\H�bLuaIueJo`FdW;ZY<NM;aU:�d1�[+~Y.kR)UAlU*�_+bJ$A>*\M.w`6n]6�n@|a4VA)HA%D;#J8I<'_K'nV3kfKO[E7<,/8%8@95<2GI;/7$ER?gvZdkUgX=f[HZX>ML3?6,�U=�kS�gT�m`�kY�nT�bM�bN�hO�eJ�UF�`M�dH�eL�eN�rP�iO�gQ�hQ̂a�~[Ʌhʐs��v��o~jbM7-WC5K=: $*54,^PD^RNX<6a<7kB<tC>hC3tJ>iC?rLC�jW�hW�~^��m��f��a��q�f�cV�eP�UG�UK�ZK�cO�f[�tj�zo�|rkdZ?AB>>B]YV[ROcXL�oW�sRxeHkdGLHC`WKubFfTE:?3CE?864.48:EF7CBAPK1<9-:6F_FVfN]gTEMD/9BALN/7.&,NYJ\dNahUYdTQXKNTHuvX_kVJSKBIGln[ssWS]KDLE>RO2A=RSQLTVDSUPSQbfdljeS[Y/9C3ALATM9MV=NK7MN;EKZe[QUN[_aFM^Q\Y_gZMST^X]gUa[YaLZaL\YM\XCST5DD8KURa[GX[BNSQ[Rce[vh[ph_U`dJY[NXWN\[SZVR\[Wf\Udcglrkil�����NJ��@YkJ\nZhuM_nTcqF\lNckMciD9)G3"VI&[W1FAl`,^Y([[,H<RP$gY*[S%UO$jc,YM%RG!j['ZS%99?GKP(8B#@L$=B"IK&<8@4D>0[J8eO<iT=pWGuXE{jT�v`�v_�oO�lHxc@ygLwdGqiGwmLseCseCiX<xfFiW>^WEd_?SV?OU7QS:NN6OR<KM)pV(rP)vW)oQ#�f1xX$uY+2/83@9$[N.rbBTI0t[4`N,1.'$4*n[5cS0C:VZ:WU?EH6ITACF7aaFISEN^LP\FYZG�uU�mQ�hJeZ<??/mH7�^IebJWgNQ^KUaLTSG{aQ�kR�eK�bC�iM�bK�]J�jN�zX�t[�~c�q_�x_�sUɆjƌpōk��h��e�}g�s]�gX|RF_5*V6)_;.mA6{I7Z93i<1|H9�P;j9.�fO��`��h��]��`��^��b��i��d�~h�y`�l[�`Q�cR�_S�OH�_Q�aX�|l��|��}�|roekbZ�p[tbQ^L>YSDziJYQAUPBZN?KC?254764B:8WKKPYHZjSPbR?[L=RI@JE7??!*0"(=FFOYMKPDJM@_dSqpX_cR^bSJHHENClvViu]\dRafPcjUjmWjvWTaK$21+65?BGMIDKS_[Upifmg_[d[]`T\SOKPO;DK3?J3BC?FO]b]MVRLTSKYX[a^IOLBJN\W^mU^lW[[aaSbXEP_CXZ9OLFXQM[W9HL;HLIWXKY[][Vihj\gbM]\GTWGURK]]IVU?LUT`Ynthts^lj`imr\kxH_hRevH]lIaeRihOafJ]mG\dD4"M@,OI&I?I>U> T>"Q7 Z5"^L*YI&UO%kb3HH%#$!C:N@<6eU(=;"*6>%''(13'WI5�mF]B�_CvU;qT6�];�gO�jN�fF�jJ�qS�yL�pHxpJvqGodDfeA_cDkdO_[;MO7MK3KQ1=D*FG1GH1DF1TW4GF*LH*gV)>/dF!jM(qS%+'F=&dU@LH2JG4E=+ZG+eW-A9PCbT+dV/p^9h\@_WC]YAh_RmdNcdM]YLFMC_dIMXAT^JVYDwkL�~_�uWT[D^U?gM7d\BTR;a]IKJ8@D3=/)�jT�tX�vV�hO�nV�pV�|`��g��i�}^�z_�~_�u[�}b�_��a�a����i^�n]�jX�aL�eQ�`Q�RC�ZH�T?�XB�S=�hV�jY��b��h��g�~a��`�yX��_�{Z��g��gxjPwwX�sZ�bQ�_U�WK�ZP~UO�]Q�ZS�f\�m`�i_�zo��u�xquida\O�qW]R?DA:C85A87530034R@=x[MsdQS]LF]D7HCM]JL[M?HF@HI8@EBHGLTIPZOtuXloUsu_bhP^aLlpTqzam{TcqRWbRY_Iw�gozY`gURWU6BD+:98DJIR\WZpfda[^X]XdidZUSjQRcQ]hVVcRT`LMdRLi]\d`]TXZ^hXNUSDOG>GKNNVlUXnV\d]bNYV=IM6AG9JQ>NM6@?=FI8CF4CH7DLPWVY_[=UPBS\CWVGZWL^bHXUFUXNZPKUKRaXU]YdcYS[]R[^WfmXjnUdhLagK`pTinIYk0,61 \R-\S+^R'nT,iM+u[,fM*S>"A4kV(XO!?772B=:3KD#KF#OI"G691=<,0 ]H0�h;�n3�[1�\5|U3�hHrL9h@+�\;�X=�hK�~QzrKvuI|vIrkCngFc`C]]?XT:SO4RS9HH1@?,:;%LJ2LC,9>(CH+48#/629<,lR lO#qS)@949%TR8KK.NN/TN.FE*NB&QB]O$|lBkZ=vkFvlPb]IWP;]S=pgOukTymPobN�wZkdNc[=WO4KL7f_Dc]DIH3E>-I7'V?0bP9dO8[O8hYHV?5T7&�hQ�oX�vY�wY��b�y\��d��]�xV�yY�qP�oO�lO�oS�}b��i��t��r�wg�s`�pX�t^�zc�~f��f�z`�xW�w_�qY�xb�{d�z^�}e��e�c�~\�pW�^�wX�wX�sQgKreJhTH�ZM�]O�gV�_R�UM�SLPL�XP�aS�jW�p\�we��m�|p��v��oxh]paY}`Z}eVgMEYDAiRHvVK}\PlTIYUBOUGP[HIOEHPNYZSRSIHIF9@CKPJyu[rmWikO_cPJP9joVx�\puTajRT_NLWGoy\gvZVgWTdW@PH#/>?CJJMSYUUzoiwomje_af\[UTeNRcLXdOVmVZpOUoOTiVXdZXVXVHJHFHMFNSKLNCFPQHP\NQ^[UIZWCY]?ML>NP<MO9NH?LSATS8HM6DJ=ISOYZO]WFTSCST>SW?LML^R@QQ<JH<IH?SVI[aMYVU\[_aTaf[bmo[nkO`kWgm^hgdntD.]?)na/QJKC=6L9J3J9_O QH"aU%E>UNOD>8QI&ID?AgJ(jF,pL5_E1N:#<0�[0�q4�b8yW6sN*nI,fI*cN/xS2�e:}i<�kAt`9n\;hT2dgGh^?rW6raH[XAJG0PO3CF647)LD3_R:VL6.1#=?(::&8;,;=fU"yi/�n+ZE%*3 DJ0EG.OQ69=-JK7[[@-3!$*a`@shLYU:rgHVU;ZW=@B-DD,VY@QV<beFaSG`aReoTj^CsZBbX?lfNYQ;LD7MN>PGA�eP�lTfZHd^EeZIbVI�cP�rV�^J�xW��X��X�{S�S�xN�uQ�xR|jGp\Ar`C�bI�vX�~_hN�s\�nY�v\�qY�r\�s\�rZ�q[�oQ�y]�~`��^�tW�y]�{XxuY�watcL�rU�lR�oV�qX�pX�pX�sU�jITN;�]P�YM�eS�\O�cN�\K�ZM�lW��j�{a�uX�mR�ya��^�nQ�hZ�n\�n_�oh�ym�xp�g^aPQ]KEuRI�c[�pf�vh�k^q]Ui_T]WPdXUdZPgNFbSHmmQqmSohLZdOFJ@uzVsxYuyWv}YkZbqU`kOYhPWhOet`4BA".:;DNKPj[\m_`e\_of[jifUNVSDIfMVcHMlOOiOQaDKhPRiXYeYXMKYPHG]YYZUWMDSJAIRMSPVQDPQCOH;GH9LLGSN`]Z_[PbdSBLO9IR5CIeqgxvO[Y2@F>MI3EF:MK>SRG`NEZU<PSAXJ^cR��X��]��[��X��`�~^koidigZhcjE.[>%dS,cO.dO*G8![A'rM#L:"z]+iX(?=?9a[.FEME/,!! 6,a@S7jJ&sL.wR/oI&�U$�i+�a*}V){V%�j=�[.wQ+}[1w\4}a7pY6z`9]P2oX7wc@k`>YZ@_Y6[S8\S;JH0SK6HE0:8#JG1RJ2KF3=@%IL1@A$:A%23\F"y\-fT'iM$L= "/=D.QV>MM4AG-S[;)-34ZW2tpLjdHd`@\\ADF,XW=LK/FG158,&0;*IO7NP6R^E[YCzlRRQ>i^HkjQIK@LP:>C7CA9~jRlUCi\LggS;H/EF6�cP�jP�|X��Z�V��Z�rS�wL�uN�wL�oMxiGwjG�nP�}^�sU�pR�kO�pR�rUq]L�jO~dO�dNu\NpVK~hR}eLjVC_R9kdC{qPzsTlbJj\F�uT�u]�jPm[H�x[�oW�cK�kPMA6wRC�[O�_M�cV�cS�`P�fQ�|b�wf�t_�tUseO{t_��a�mX�oW�qX�oV~UH}VK�m`�th�xo}j^|g^gUN�f[�iV�dV�oU�jYmYT]ROcSMpFB�m\sqZigQgfOfeOCK>iqRgpXu}[hqR`oQ_mVcmVFWFIZIR`S@NK'.2'1=WU\�xn}l`rf\j\TVPLGCKNAMcQTZAHXJKUJOUDG_LMgSPZHLXJOfVYpZ_gUWdSU^QRmSNfKJIBE8@E0>9.ANIKL�pT��^�~Z�zYxq\c`Ptzey�mZjTCSW>MK1>@?SI=OO6LI?XK<LIppO��V��S��P�~R��R��W��T��Y��_|{bQ?1O>0^R+ha:jW7fT6�y>�z5�z:vh2w`0kV/z^0�q4rb*VK64 =&L5c@wR.gK&{Q)�f2�TnR)mP&J8K2_G"�Y&^;\B"VB&XI(ZB!aO,\L/pZ3VT0QT7QQ=SN4ZO;OT8BE.<7&FD&<?&RN4RO5JI1MR.9?+=>&ED&9=)bG!wS'uO'*'PJ'9849 UO:OJ3C@/[^@-1 &hhGmkKfcCb[>_]<QN2f_EBA.65% #4;,>=*]V;;A,NT@UYHEN:EM:KN9DK1WN6[D3NH9YePUaR]f[PXJ@H:8:/�iN��^�|V��U�nM�xU}gE�qN��R�yW�mTlY>l\B�nP�rVxiHh`JbYBh`JhcGseP�dOxgHcYDfWBt^?v^OqXDhM=nYKVL8_ZA��Y�tT�wU�rSwiMeZGkX=�nO�nN�jPt\JD</oH:�aP�eY�dV�[N�cV�hT�s^�uX�y\xfS�tZ�}Z�|a�`��g�ya�mX�sZ�bQ�^N~SI�]N�mc�|q�n~e_kXM]S�^PpXM}^Oj]Pk[MfQM�rXsoVkpTbbRqiN]`JW[GioXalOWcI[aNgrPrlP|_PTKKGIC>=:99?78>gd]�sj~j]_WQQNNta]ve`kX[�g^�la}^YlKMpZX�xokcz^VlNRr`cn]]fTXhNRTJToXVpVQ�cXtg^jbY~oQ�sQ�xT�rR�uQ�wU��\��e��k��i�sX\kT5LM2EL<UJ6EEX^H�|Z|vT�zT��V�wP��Q�|O�S�tH�wO}lG�zR�a`K4_F0`J)v^3�w5�z5�|4�v+�w.mU!`N#�p,��6�x8�r(u]!ZFN?!Q/^< �U/yU*qT&�j6�j+�Y"pS$�_1[F!^Cx[,P<;-G;D4iS-iQ.bK%s]7nW5XK,]_<ZV;nY<lcCML-C;&42 <F+46%KI.ZZ:HG3EI-<:'QM7GD,GK-dU&_L'\M"QEhZ,;8.3%JH2VU:RN6OO;1:&HF*pqJ]bB^\@SS8_a=ZV9ZX:@D,79'!&,/'QN@OH69A-FL679-9=.59*JE1CD0KQ:>@1F;,a\JLWAFT:<K4'4+(2*m_F�~Y��X��Z��[�yQ�}KxlB~lIrg@lc@�tJnZ=oeGypOVS8NN2_[?cY?ZXAqjU|hMl]AaSBWN;gV9rbLcVFq[IiTHjUC^N>TM:dXChY>SK:mcG~lKo]F�fK|aI�nR�pRn\Hw\HgNAuLE�^R�fS�cS�hV�mZ�{f��i�}_�x\��b�{Y��b�wX�rW�wX�sU�uZ�xc�va�`R�VI�gR�dT�hW�yl��tsi]mYS�cX�vg�hX|ZO{^TrXusRghPefRlgSPQGdfJ^`JltU^fJ`gSm{VdgT�q]�aQ�h\~]QsRNjWK�q_pezi`r^Z�g]�of�p`�yg��t��i�yc�kn�|j��k�yk�ydnY[[RSTPMd\bqZ^t\Y�x}zd`�xc��m��d��c�wT�kI�jP�xX�lN�mL�rLwcF�mT�tR�pU^hcPcV?PGa`N��X��Z��S��Y��T�O�yO�yJ��SqfHxlBviE~mJ~sS�r:�o2�i2��B�v2�q.kU�s!�q-q\'^Nyg(mY$vZ#_RIE?5P>dD${V1V0�Z.x^7�r;�ZtO^K!XDM5[D}_+_D'8/?7302*:2E:aS1ZN/LE#`O,TN/]W7VX:@I,LQ1HH+>G(WT>HE-TT4GL19;(@@*OK1RR8><&XI$t]/pQ#>5nY(\E!45 VU;TR7FQ6+:#CI2}xVnqMXY;c\@^^@YU=QN/JP.DF-66')'=>)VV:EC28@.%.#'17(=8%40#19.HN4fP9[X<X]KU_KaU@#!J8+bY=��Y�~S�{S��X��W�uE�~U�kJ�yO{qH�pI�zNvbGmaDjjS\ZCkeIjaEh]JoeE`^FPO6MA3ZI7_R;[M9UL:rcFfYFeU?\SCNG>LG8eU=GB)./*KB5]V?tbLteC�lL|eMfIoXAhU@TF8C=9J@4wPC�cQ�[G�aR��g��m��k��e��c�}Z�}_�wW�pU�yX�kR�eR�lW�sZ�{_�}a�pb�kZ�q]�q\��r����zq�te�k\vXT�kW�td�oZsrVkhRhdJ][FLN<�w��|~^flQovTksWSaKnfS�cX�g\�aY�q_�kY�_P�`S�`S�g[�zm�zl�rg{cW�ph�zbokZ�rd�m��dtn_|^T�XScTSXSWobbtcdkRUvWT�qh�~e��c��b��b�|W�mR}hK�mB�kI�fG�eF�mS�~Y�oR|cO�rW�}_ffS{xT��R��PsvRunB�uH�{JnfDvjIxk:mc?ZYAujBj\Dg`G�u,��3�z)�z2�n%�o,G8?2aNv[&^IC?c\!VMbKTF=4@5YD �i2�a3�zG�b8�`1~^%WAUA lR#hEnM#aKA/^FgL"4,1*A7MJ%KM'WZ4IK'EB'JH1OL&GJ0IA(07 AK0AH.BE.SE-EA.EB/>@-EC)28"@@4<9)AB/88OO%LN&xc,`S%-*PT7xtO[Z@TS6giAvuL^cIec;ihGe_FKK2SS3>B**1#CB3QH3IH.[\8LI1!#.)&`R7UC,BK=GO:.9$14(_WD�yX��]��a��e�Y�|M��U�zO�{R�pG��P�vN{gJ�uZviM{pQ}jO{kJqcCf[AukOZU:XN;fU=j\DEE0N@/s_JzeHlYESI8NF;KI<RH576+C?.<:0A<0cW=g[EibEkaIycF|hKgS>eRDkXB�iV�uZ�fJ�lU�oY��k��f�~[}tT�xZvkQ�mT�~`��a�|Z�qQ�mP�nUx`H{`Hy^D��g��h��k�wc�kW�lX�c�������eY}g]�w`��g�vZyqQiiOigQeaPpkY��q��o�}gmtR`lJFO<DM;KS8|eS�]Ry\W�eY�^M�NG�aV�cU�qd�vc�rhg^YlZTm]\l`^h[W�iZ�ziuuYOKEO?GmIK{^^^QMTMPaZ^sW[�f_�~f�}g�yc��c��Y�vM�sO�mN�gEznOpdK�vK�~L�~P�vP�zU�vL�}]�wa��Y��RmqNnkF{vJ�yKyk@��UvoC�zItnDwoLslEvkF�uO�t-}g(�s0t^#nX�z.�w6o[!f!�p(�l'|i#aVjY��:�t)�o(�|-nR!~V'�\'�c.�m5�g-_.eH([EqIUBA6.'5-5+R:H7O?#D=73PC]Q/9>!XX0]R3RK1<F-@@0:B.<B.:<'CG,JC(GC,]dGMO577$5<$98 ?=&2:(!+8;YV#FB$28A;%KF-\cCZZ:qjFsmG_bACI-]]8^]7SQ1>F/GJ3JK1GP/39&-3%/2$7@+15(BF6$*$%%23"!)-*,%!kR7��\��[��Z�|R�yQ�Q�zL�zK{L�vM��]�yW�yU�xX�zXwqPsfD]S;a\:ifIc]?\T9^UCcaK[Y>HD6I=1t`DoaDfVBQG8SI;971/0(::+m\FfU>n_@eR9><0f^>`[CyhK|hLWL6}iJy_J~aI�w\�t[�mX�zf�|d��c|y[tiKshM��_��b�vX�_�x]�iP�yYz`HJF7TG5oWF�w]��d��j��f�jX�yb��g��s�������vc{l[�o]�|\�w[xqTynWjdUx{XwyWrpV��bquYnwUNY@2=5_\M�kY�_O�\Q�]X�[N�i^�oe�xk�{j�ye�gY�lZ�uc�h]�dZ�la�oZ�v_}dVmYSvVR�YR�aU�p_�dY{_V�iZ��h�~f�~`��]��W�{R�uS�tT�`D�gJ�iIxgJ�}P�uQw\>�lM�yZ��\�lQ�pV��WomIY^I}zL��V��NvoLwmF�~R��P��P��J�}MuFuiATFMEkU$]QePyk(ti*}p,{]!pa"�o#n[$4/\GE<ZHfW!yf cRN;dIxW)kQ!^KvT#lR#RGTB7/-&/)0)# @-U:@.5.H;[O(WT-LR)]`0NP&7;$5>) ,(/@A(@B-@G1O[=S\9?B(@?%KL2CE3=A+59!@D aOdM"kR&WP216"UN,LP4T]@_bBcgDOW3DL,AF125GP3BF--1$@F2\]=5<%/:=)DH1"(,8!!*)+!AB0#8* ENJFQENF5w^A�qG��X�~N{c>xk?��V��S�wGsL{qNmbAfeJc\?^P;^X=pdDhcEKL9OQ;XZ=XV:`\CAE0A@)76(41&\L;pXAq_DZR@FB0;5)D<3?>121'27/;<'H?2A7($(43(SC7\VBeU>gX<n_EZM>gJ=�fT�u^��b��`�|\�{b�y]�^�v\��f�w[�yX�kO{fN�qS\VEh[AlZDq[GzbK�tX�u\��e��k��h�}j�yg�{]��i��|�wm}`K�s`{mY�|Z�_tqTl]@}rVzVddJ��fnuZ_gCY^I]iQ�fQ�jY�hV�cV�j]�`Z�}l�sb�k\�se�yg�u_�ua�wb�ud�lX�oS�eQ�hT�s_�xg�va�r]�l]�pX�td�r`��j��d�|a��b��^�WwlM�qN|dKfY;h`C`Y<XX:c`?�|N�|K�tN�tN��V�|T��^��R�|S{{M��X��L�{N��Oli<��W��P�{Lyf<rl@wlDf`@xl&}f'}n)dY"VL#ZU%..bVua#^S�o,k\)@7XKu`$lW&31>5^I-, 45cS!/,D:YJU@IEl_$XH#''&</^OhS Y;@.3)5-J>ZP*NM,GF(IP-3:!A@*;:--*..8!>F)TV7LQ3CG*ZS3VO6HJ2IH+QM%ie)tZ SG I=J>$'87SY@hgAZbAEI0LP1XeA19%$-PO/MH2RV9\];>B..3":<+>H/-5$"'RP59;+IG5#&%=H8kmN~sP��X�xM�xS|uGgb7aT2shB�uO�sGpl?zsNUT2OQ6ZW7SW<bZDqjFQP8LM3SS:Y^FHQ;NM:PV<FE4D;%C<,`M;XL@E@,G?.j\B}gJgVCD@25<-D@,C@357/+-#;9)-,!=2'..UJ2w_CTL?kI3�hM�jU�xa�uVymOoiK�wU�{Y�}a��f�x\��e�sQznOkdHQL:YM7h\BkN�mQyaM�tZ�{^�~`��i��l��h�d�x^�r^�ve��t�����hspUsnOyoY�}`��b��`��i}|U��\\_NW^GcfDhXD�bN�m^�oW�bO�p\��h�{g�ob�iW�mY�jW�gX�m^�o]�p`�iW�t[�hT�gQ�r[�p_�n]�q_�kW�rZ�u`�ta��j��j��g��d��Y�vQ�xS�~WzhHtiFroJ��Q�sJ�Y��W��S�rK��[��g��h��[��]��j��i��_��\��[��f��`�OneBvg>�sNqHa^7zpH�z2{d&{p#d[h_-BC54SFB?HG>;aO�~1fT"90i%�v+SA + % "%?6mU!WObN#\I{[!gOfT!�h-cH#iEdA8*(!WD hT3ID0>;"7,6241;=$33&.)1 ;=&RN556&?@+?F+\[+_[(sk2i]%_Rne0)(=/#&-/II1PV=__4JU2*4'13[Y7UP6[Y7bZ:X\?UU3UQ6>E126"76 TT:6?%17# +:8'PP7990$"bP-�sJuoEyzKnlJOT4XR.i^=�uK��[WV;da?qtQfjOgmLLV>CI3R\BSU9^aEKT7JQ;`hL[_?JI2;7&PA+iXCgZ@VK5KA+fXCt_KcRCA<0.1)MRBPL7TG9HF4?8&%&'$&!(&53*SJ3TC4QC5�qM��`��d�w_}wQroOffJ}zV�[acJmaG�qU�uP�y[�}VxdK}dP�pS�zW�rN`WBcYClM�t[��`��g��^��a��k��d�y]�v\��t��}��dkgDvoM��ct�agxVqx_p}Yt{VdkNHT@WYD�pX�gR�cT�bQ�r`�g�oY�lW�iX�n]�aW�gX�hV��et��f��o�r^�iW�gO�nY�o[�mZ�o[�jV�oa�q]�y[��a��d��^{YelR��[�~R�tPmhGupL[V9�sP�xR��Y�~R�yS��d��f��Y��i��[��k��h��`�{R��^��]��c��]�vM�}MvjBypA|j;b[8ypERJh]!]YWT ^\#85 //#0*A> !PL:5G:9-fQjX`SF4I85*>5<0--4-H?!`(�YtXK8sR(wV"T9W;O=aE$3-9*fT-`X=nZ:eB)503.ZN.1/&$%'15 @@&;5RQ-mc<xg-aZ%jZ(|j%�n,�^*Q@* #&HH/n^3be?lhHGR2.5 RU6a_:IS5UT/icDUR7a_<SR9U\:IM1PV6[^?[_?=D0&$" !(48) lJ1eS6hcA\S2b_7gkB{P{mG�zNywMVS<deExtSdcBysTmkETX:O]:NT<=E0<D1%)#+4%16*=<0$%OF.WI4f[B_L6n]J[R9ZO@D<3DC575%$%% !%&&"*)#&+'86,D9)>2(`S@�~Y�xY��b��o��h��`�v[�~Z�|Z�kO�uY~mLsfKvgKjcJdZAVH:gVDyhM�pOkL�{X�{\��dɖmƑfƓa��l��n��k�pZ��q��i|qL��d��kfvQUdJixUjxX_oSeqU[U=eO@�dR�[N�aU�mZ�jS�gR�^K�[Q�{g��r��h�va��mӴyָvʱyɭt��l�lY�aV�ue�p]�qa�qa�te�~j�q`tcU�{a��a�{TekWrpL��]�vOrlL`_CukIm`?neG�oQ�uR�sM�|O��e��U�wG��U��\��a�~M��R�yL��^��W��\��W��\��X��U�yJrfAZY5mjAYS%g\,NI hb*ee&SRKP36AAABEF^U#J@pZ"G?[Mt^"ob#TI�h$�k+�t){c"�[!eJH@eO fX(Q@_JN=`B`IE13$E+U6J2?,E3=973LK+>5.,-1 $&$)(30kU/rd6vi5gb'w`'M?qb%zi(]I�h*TF&20D=&;2"hT0kh@}xRooMW\?WT7uqCZa>ekBY_=SU3FM4WY:5>!")"*+2 &-,3!+2"" %,#*0%5<0! + B6&vhGspKmlDxsDvvN}{TujCzsDuhC��T[X8WS9qkHuoP_^BSS75A/'/'5<*8>,3<'7<)cdD_dG`_@IA+$#WH5iW8qbGoeF]U?MI<fXBGA333*"&#' !##!=:6__KmsRnjO~|\�]�nP�~\�sT�vZzmP�qTncE�lO�qQ{hL�wY�iPh\KpfOo^E�hO�kO��^Õ[��R��Q��U��`��k��n�wf�v_��k��x��jx�^\nIL_AWiRXhHepW[iU�ye�cQ{SH�iV�gY�na�aR�VM�SI�mZ��k{�V��l��k��s¯n��p��h��c��d��e��p��s��p��o��m��c��n��gto[��a��f��Y��^��`��YoiO^]Db_DYZ@zoN��P��b�`�wY�xK��Q��W��X��Qce=fmE]bHdc:_`>`bCd`:rK�qG�}L��\��Z��VvM�xJ�}Rmh.ok6[Y%\["fe%MN:=EH:=XVPOrb$l\%w\ qc#68LP"RZ*=3�v1�l+XG6.00D=KF=8^OD:@6$%<1E<5,0%7-)9)8.,-=@+?D$75-5GE$=?! (, ,-MCje1nn6lg-^Y(\Mpd)UHwe2vl8pi5f_2ie<<9 WP/[]:qiBvvHgkD^[;{wN`Y?d_>jgEdeEU]8Z_9RQ0!*2AC)[Q1ZY7LH10/"#!&),'37(=?7*,& IJ0f_9feA{vKpqELV2\\<�rI��U��U�}ItoCa`7]]9ZZBAJ1:D+?B-fh>srQnpOhkHb^?QL9LI2CC/LG/33'"E>0ML4II5[S9HE.LG4ZSAUO?J?-88)US877'!'&'//92]jQgqTU]ConOv~W{vR�tQ�VxnV{oPnhF�yS�pUmbM`[BvbHv[F�|^�qU~uTmeKbV@��R��T��L�G��L{tCngS`f]ryfxxe��������h��sbqRXfN\iPI^D���Xd[d`Nx\N{cT��n���ǯ�����}��z���}��s��l��������t��[��`��m��f��]��Y�������������c��V��]��f��c��d��`��[��Z��a��V��Y�xS��Z��W�~T|�_q�]`iE{pW��b��]��W��]��V��b��T��UVX6[ZBXS8kjC��]�zP��X~uKrnA�zI��S��V��_^b-hd-=B58>AB>=7<95:i`"l_aP VX"lb'rk(?>w|Djm9{n*RF8/ZJ#^PAAHGSL!(1222&' )( &&%(#'"!" .")%2/5,JC 14BC;?/2@F&#'&-()0`^-jv=um6oc2ib&qf/PL!IF e^-NQ'MK'TR*LO(8;$RS6Y`7�tN�uRpmDkiEkj@OR1LF+DJ6MX7RX>ST5FF/01 IM'SR7?@(PX55:$)/ "! '+% &*/% + "!_c:clHbh@de?qhD~vG��R�|Sde=kj?QU@T[?P\@FO2@K0\kLLX88@*CP?CJ4/9'.8$5=',3(68'A;%_V>j]BXO:aX6FC,MH3`Z=FJ6<B2AE56:)75* +& &#'-6.?H37?*ER9rxV��Z��f�sV��a��]�W{rQ{yW`[GzsUpiE�pV{kMzpRk[JocNk_I��a��\��P��D�L��Mhm<mmJLVF\dM�|i���ư������������z��{��~�����qdJ�kT����ú�ķ�ø˸����wsz��~��n��v����������s��h��[��[��^x~Zsv|��z��l��f��Z��]��Q��n�����v��r��d��S��V��X��Y��Z�xU��`��bqxVjpFmsK��b��c��c~{MknBnnBxqGlm;��O{zY��_xzJ�S��P�|XwzN]_;mlC��R��[��P�~Tii.mf2SR.;7B@6>#)&-@BLK]PYLSQj\!XTl^&ji,rq0f`"++(.BEfW%SN!aXQF + '(,0 !)+%(;..($ #<2+- '"8:"@D"-0 26DICK"fX&}l0cQWR$UR(ZY.db5X\054AA'OO0ID)HE*ni@wuN�{P�sJ�kF�sKWP5RQ6EJ.IS6W]>AE(#*;>(FM00:)#+'0*#)-# + *+8?(E@&�yJ~{KszM��Y��dyxLrkEosKpzVcpS:F&DQ8=H0'(NO7VZF>C1Z[@JP0AD346(JD4[T7SJ531!?4(J@3H@3RM7F?-?7+JR<\Z=GI9 '!# %/!RU<u|T{[��c�wX{wZkZ@m`J�oN}pSwlLziQlcI]V?RUAS]?II:@=6;9)a\CxlQ��M}�Jpx;_e7Sa;�yW�gRreYɿ������鷤��������������~}��������h�{[ǰ��ϴ�г����������~|j[c[vwcwockosz|�������[eLtRgyMV^Ipy������`��T��[��T��S��n��z�~���v��h��R��X��V�|KqiL�wV��as~\u{P�~Y��[��Y��V��YmoBWX6b\>a[;ed>X[8��V��[sw@liIwtD`fA^cA~{JefC}C|{Isc@�qORQ$HMPU+HN%@F 7ABB!JB"SN#34%+VPeW[R7=ZZ#db&aZJ=-1.013$%+" ?@#( +))$$ -3!$ !%*"%2/3)54NO-*.CB'8=46'' + !AC =>" dZ"~w7aU ld6rf=xj8�v=YQ.cf?cf<[[-ZY1JL(UQ*smEyQdX<XS4g_5mfDogASR0cd;NQ8_fCKJ.+/!&0%&+!))2 &+% &" + + 75�zIzrJ`c9��U��TspGmkI�}ZcfH_cGNY:.9, +04"txTvuVca?__@MO9 $-)JD-c[DZN5SJ/XN;VP?`X>teItfLm`HHC1/0#))$)# "&AF0svR�|Z�zXtzRfpQX^K|qQ�lLxgIrhNWV?_aC]c?uiFCH2'0)-1!MI5QR@lgEueDNW9clFXaCflS�kY�QE��v������������������Ǭ�������������o��q��l��e��cʱeؼq������Y`M=L7TYJwr[^_Jko`��z��}`aNjtVhq[kg^Ļ�������l��l��d{tN���������|oe�~f��glkB��P�vNmkC��\~}]lqMcf?�Y}~TfkK��X��J}rN�|K��U��Y��_md@��Y��W��SvJde:em?|zM��Z��Y��L�~J��Z��YUU&YX'SS$QT&13?Bba/QJ&05./;4MK*GD GB), MK"RR k`%aY'5,3('.2<+0 +$" + TK VK!%!_W6zsFfe9]Z,B@!WI,LE&&-%/$.+,<?rg1lm:[X+nj5mh7GM(Y_5KL)14PQ'DE CA&aY6mfCTS8MN1KM.8;TW2bb:ha:snCbdBC>+7C(($!# + + + + +#cc<uuFuqK��QnoHwqLtsNjoN^iIMT6Yb=KP.`bDvvS��\X`E:A)<B-47*,/-,`U<XN6NG-eS:]T?YT6KK4qlN_`=PL;ID4%)"">A5spQtiJzqO��W��g��a|xYccB.0;=-~|YzSbaITP<(,#/7(``DsfJmdGc^DhcHbdMibIBJ?ZH8w</�TC�sX��p����������������������������õv~V��e��`��X��g��S��U��g��~X`MBP9<K:^cJvS��c��_��h�x]xmXSS<ZeQyyc������Ư�����ó��������������������s�w_��qvdNvpJfkKflL]fDZeBd`@|}V�~S��KwuGlh@vpFxvPigMLK1LQ(�}Hxo8��Fbb4nqK_gGenF��S|tD_Z*��P��O��Poo8LT!<>8:B<GGAB #5.]W&WR)F@ TM5.!# +* +;:)0 + + %+GC-/',%$$)* +8<83aY0QK$@B %&,.QP+}qAQO+C@*41/2")-# -.ic0kk3ab0kq@SX-HJOU,CB$::'(,ac;{vLsoJII,fd<QW4IB)hj=X\7\X3cc>FI003#&2!' + + + + +07YV3ywMW]5af>vxMYZBSZCNZ>Q\?O^DV^EgmBUZ9ikIfdELU>KZ>4A1HS:,4$"65%IC261#dV:_T6^TBbZ@TK7;>)<9$66$.)*,)0''+"!!$# !(3/ ?:'02&16(W]=MU>KN2�}N�zU��`�}UnoD;C3@C/��]kfI:H+/5,+5+$-!;?,]bJ[]?OO83=/BR<JREHXC:F8-*'kB-��W��g��Tţb������������������������ɼ�nxNy�N��V��Y��e��Y��T��[��g[eN6D/U]I��cvv]��[�vR�cN�r^�ta�x^kgH]XBxr]���ş�ө���z��x��y������ή�ͧ�Ƥ�έ�Ϭ������x�}d�|\��o��W��[��V��S~|M��W��Q��U��TZZ91?"7?%_c9V[8�|JpjCLT/_aG;?)ejD��S�xI��R~~J��Ve]+AA24:C?E?@0:=>OF%JH37:;9:.,&' ,:DE*3#," ,7#){i#j\~f(|e,>3 &)^U.US%HH ML"kb3ACI?LK+"%(0 + +"% SU%NP)TX+]d4DJ%"(1:>G'39,-NT9r}QR[5VY0ED#WR4dc;ka=[S8>C&okATM36:8B'09!#"=B(IJ-CC(37' + + + +.2AB%ag@EN-uwK{wO|sMokCceMdjMcfJfmK`hIJX<Q[<FM6/:)?M6,7@S6<J0;C/$)!/3VQ7`V4nb<PF2@A+YR<JF,@@'''1.;8%66("),!+0&'+ E.O6'M<(dG-IA)VV7}pJ��Y�~Z�xX_aK6>&)+kkHsuY>A1.7&$3(2A,GD-qnP`]D]Q=:B.).):;+-8/)2-!+*)-'�nBͩf��N��Y��J��h���������������ɹ����ķ�txP��V��^��R��^��`��U��XtwUfbH}oc��e��c^jNmhK��U�qOgG;{eU�}]�}V^eLiqL_jGprH�xYpW@�sX��u������������������ɝ�Ȏrϝ�؟yȇjˎuΖo��`��T�zNqjIlgAkc>��N��SuvFNY4LY5��P��Y��Sfb8ng9��KYZ68;(hc6~�D��G�I��Vxs4j_1ZY(?::<IEXZ/GERX)EF!:8,43<'$ + +(,!%!>@^Y!�p*��4q'bSIB)" 55][-?<HA VT,,/''.5! + & $']c3[b2\X.:=!1> )229%>A,LF+ipF`gAPX:SX8@C*5;%?B"lg<hc9BC*@<&$#JL.CG.)/HI.=@)ntFV]6@E,/3"""'!!(%+,!$!(!IP.EN0")ce<ggIliJniDinIfbBe_@NP2NY9^hCQZ98B+*0& MXBBK,?H33<-3- ZQ/dY<lbGOI-48&50 ,0166=$ST8MM9<4%-, $**..()-$)(62)%( 5-%?1 F8+QG2UM8�yU��\��f��g�~ZvyVGM2ypKxpQ�}\~xRV`AGX5y{RysLXX>neDhdH;C.CF3ACA"**%/,#!,1-lkL��^�~PsuQ��QqmS��u���������������̮������d��������s��}��|��m��o��|��}��������~����|�z]kbIxhZ��u��r��k��z��p��j��n�����n}pa��c��m��s��i��n��n��qp�a�u]�~f�}_��u��~��f��b��b�~W��k��b��S��QopF��]��U��S��\fn;gl:��c��_\[2LG0PK)bm:��[��XrsEjc7HG<>,0:5/,LS(=B").01//(,*/ $&AA $ $$ !&''LF{h%}h+\SULLJ " /2 &)-YV,MJ%>BGL#-/ &&:6 +35Ya1sr;:>"14,/'),^_5Y^9JQ-MP0kj?tiB[S.0/ZX4nkC\W5TL.>='MG'QO1LT@CB)AF.KP2LL2--! HF.YS3^]847&((,#9=1"!%,.$)! $+2>% )[^=t{X`iJ^g=acBOL<X[6@@+KN;UY<AL/4=%(-% 8@*HR=$(JF1*-"$("!*- //&(.2'+4"28&-0 """&$$#/+%;4,?0-=1)R=,[C3C7,]>-�S=�rN�qT�\��c��l��o��o�b�|^uV�|ZrfG�_tiLX[EN[9^gFMS<:>)HL68=.'-%.0*16.-3%.32HJArmV�}l��r��l��p��r��x��������z������������������γ�ĭ����ƭ����������������¯���������������u��_��d��k��t��i�����������������������_�����������������������z�xe��u�����������l��j��b��j��c��\��`��OqjG��_��P|H�J��OvyD��Z��Q�wL��a��J�M��X��Q��X&-% + +!+3 + +'-!' +&+APcc,XV(UQQI35 +23 HC -.EE+%#a^1s{?CI =<).$'HG68\O%YN#HD#JH!43 AF SS#Y[*Y[15;MH$7<!#0DH,.3"PT4^f;hk@soF~lDoe=j^;ukBkf=]T5xdAg^>aV+QJ,BA+GD.$%&(KO689"C@!�zGga8fa7tlATO5:?'9:""$%#$-7%>K,kiGhrQV^>@M4!$"$5;%#(PV<LT=28)8B*P]?FS:qgGG@/'% ')! .7$9<-=<()*!+*!Q0#O3%P.!O+ O*T/ z=,�R6�`B�zWă[�ySƂ^Å\��f��g��oŖr��o�]r^Ij]B�vVj`B>;&?@/psR[\G-4%12'AD08E2@G6ZbG��a��k��v��w��q��w��y��{��|��~���������������������l��r��|��~��������������w��x�������u��o��v��q��s��m��h��g��f��^��S�qO�oL�|R�Z�|T�z[��c��b�����z�vW�w[�~\�~W�rR��������}��x��o��[�|R��]��V��X��T��b��]��G|�Lrs=�zC��U��U��M��[��R��[��N��U��e��[GJ%- + +!)/0*,&*2501&)'.&("&,0%/ *1df.�9tn+DD";B-2C?/220GIDDON#>@\^2QV(@DAC!# (/9C=8D7MJ"aW,96 #*DI#>A"EM$_c.Q[)MR&RU2af4if706E@"39!KR*DG)jk>vnDrqAFF*wlDokBfZ7XP/FE'YP2_R/64!LJ6WY:57"gbBG?'85OW2TU0ztJzpGto>qlCvs@AB)!&#'.1101!#&#'(&'KJ0DK0 )GPC#"-IO3LV;;<''("31()PG2:6) $>I2hgB\X8KJ5QK;I/ A%J'Y.!P3&S6*rF,�]D�vY͈cƀX�wT��f��b��\i��i��r��i��h�yV�rQ��^�pQ45%$,34"IC,')$72&;6+KF3ZY>qqO��^��m��o��l��n��p��v��u��k��z��y̺�ʬ���wê�Į���z�����o�T��d�y^�v[��f��u��t��s��q��r��w��t��q��q��m��|��w��y��~��}��z��y��v��t��k��g��j��[��`��Z��\�sT�y[�uY�yY�~a��Y�uR�nT�rW��_��a��\{qC��R��]��W��U��S��Ub^5:@#FP2v�VX]-~zA��P�zC��e��`��R��U��Yհg��[`X#DE $*06" %)097OK,$*KL&DDAC=<D="!$ QS_Z " + +)75"# + 157:37jg7ba.22$)12HG04%( 00[S-qd.d_.pf,[T(JB"1.20 +0<LZ)MV,@F"TW0W\.GL&e]2QO%WQ)]f5BJ&DB*xtM�vI|mExnDtiDe^8ME+aQ:NG-bV3LF,TN0<9%_Z=PQ3;<'JH,86&:?%GH'MO(JL,EI&UU+\X0;< /6$4=&/4#'--04<'16&53!40 6151ZN-L@(CA'21-//;%EXA$55$LJ-_R;/ #"-," "+%,12!TI2<?-A@-93*0&;$P-X3#k;(�N;�nI�rN�sT�uS�}W��Y��Y�zZ�pR��aÏdře��e��a��l��q��v�nTcZAUW7e_AscG�kM~kQ�{]�~c��i��t��z��x��r��o��s��i��o��y��m��l��q��y��v��s��w��x��w��u��u��g��b~nZxeL��]��_��j��k��g��n��u��u��z��u��}��{��x��~��x��x��y��}�����{��{����~��}��|��x��{��r��t��m��l��l��c��i��b��U��a��f��f��W��Q~vBvsChf5QQ1nkAni;ca:md;ywIdrDcg:yw>��Z��X��i��`��M��S��W��U()"! + //FB%:?!7A -1 $ %$ $($*&()) + + + TU#CG#DE ).36CC;8DDVQ1HE/).<AAD"VT,RS&]Z$i\-QR 35F="gV.gZ3F>(+S`-,61=9BW_-AI"_a1CF >E@H"-3UU1wrFsa;|hK�{ME@%C@)HI&bY:FG4NF'ID&$#:2 [W1Y\C6.!$"1+33e[5VN+NK,qg?l[9E:!A7!//'!9%" %%%=7OG"OH"dG!�_9��O�sA�mHpcClmDRV2MR. , ")+&1. !"#94&@=0$%!)%""0+H6%H9$F;#,%6/!G9(E3 >/%F1#<%6#I#K2$�V3�bA�V�xR�rO�xW�x[Ïh��i��^�qQ��\��cēn��ipĝvã~ȥŦx��~��z��u��~�����z��x��}�����������oȗukĄcȊhȋgɊmȍqg�\��^��e��j��o��m��k��w��s��T��X�|S�x\�V��O��O��d��X��S��e��{��y��������~��~��z��{��v��m��r��p��l��x��{��v��v�����v��h��n��z��e�|Z�}[��b��c��]�|T�vQ�yP�sG�gGupD^dFXJ0NG/^W8e[G��Tqi=_W:MM-��^�R'-;E)EL->> aa5NR2cb?�yM��LƝV34[Z5GG*,* +65cZCLK<#'04 "!"# +(!1, " ;849<A$FD+2F? OL'KH#ZQ+US7DA#BD%^Z4hh0ei4VN!OKXR%H@RAp[5SJ!F=-21:V`2 ';F#JR.CL$EQ#NT*39LT&EJ#15HG&tgDjh@d^;DB"@I$!*53')53SO,<:(=;$;7 JD*OB'550-A=#rk:\U/QS+ynEh^7_S1YK,>4#7'@*>2kO+�\.�o>�g=�wB�rI�yQ��`�yU�wW��]�gD]P:5/!%'("+%:7!//'"�t`���rdXSB.o\<o_>iU<\F5YB)s]?y^Ct\A�iO�w[�uU�uM�|W�uX�vU�xW�~Y��o��j��s��q��p��l��o��k��a�~O�}Q��b��o��p��l��t��t��y��z��t��y��}����|��|��y������������z��xœnÔuu��qɔo��w��sƃf��e�~Z�{[�zY��i��o��k��d��s��Z��Z�{Y�{[�uYqN��]��[��RyzD��X�Q��a��t����w��w��z��w��s��w��{��o��y��v��n��w��w��p��l��b��r��r��h��[��_��d��e��_��`��]��Z�W�qS��TtnHcV8ybDzfA�uY�}XME.g`D$'xuVbX<.8 7B'3<&079��R��Y��H��>>>BE!')<@3979)- ,0&) + BG')2 + + +8/UQ"SR#LB#K8 F86-85$61#F;%ZP/C?!UI"PAkU.TC%AF*KN"A:LF&\T)me1SW!NS SK&DD YU)35%&OH&VO)750/2;17 3>;D,0(1-4JT.PR)MK%#)+WM6RN5=>"IH'=D!8?#(1!%+/A?14 -1.1;7'84.1,3;@IJ.ST2=@"XT+gd8g]6<<":363#52%P:'m@&�`;�j=�vQ�m?�tI��\��X��^�^�zS�}]��c��c�yV�gG�fH�rR�|V��[�zZua?��mϬ��~^��Y��i��j��g��d��i��i��o��u��s��r��t��v��w��u����uv��s��i��_��a��i��V��S��l��Tkl<b_6kb=��_��Z��r��y��p��w��x��x��y��z��t��w��x��y��u��z��~��z��w��u��r��q��{��~��w�����y��s��q��r��n��j��i��mÓld��k��e��c~uW�{P|nOq`B��Y��g��Y{uCba8V_?�uK��j��t��s��{�����|��y���ĭ~��{��|��r��x��z��x��u��w��{��}��o��p��l��k��k��q��n��n��n��m��t��q��o��l��i��j��\��y���?4#H?*-- NH8CF5.6 HS2Xe>Yd:hsDv|I��Q��\��K��=HJ,;B!PN"ho=W_.ma4^[0LT&UP(LC)65KG(=C!&1'!' +" @=>=9@RR"ZV'FFWR#MHSN&GA"(+ &)55;?<9VGkR,J>49=<84a\<dX$C@'(@=,(!# + #.2" =@#?D%`_4]^-9/qW2TK/!!30QL1MF'@>%?>$0/GA$YR1n^>OF+=9$&-2DA ,,:4j`5}uBD@"X@"zX7�g?s`?�sV�pI�uN�wL��\��a��a��Y�|R��Z��]��^��i��o��n��q��s��k��p��w��s��p��o��t��n��o��o��w��s��r��y��y��x��r��y��s��v��t��v��y��t��o��s��k��i��i��Z��d��S��LvxA��P�wH{G�zMmb9ywH��P��]��q��q��w��z��y��x��s��w��z��w��t��q��w��{��u��t��w��x��z����v��������t��m��s��t��r��ij��aNJfȊfb�~^��^w`CufHd^Ag\@�gR��f�nF}lGnX8�~[��i��n��m��u����w��m��r��xȭ~���Ŭ��xī�ʲ�Ǯ~��zŮ~��zƫ{Ĥw��s��p tÝr��y��m��n��k��r��tÝp��p��p��p��s��rΰ���{xe@�kFSL4}tXe]M;:*��l��S��jwnAk]/�v?��?��S[\8uuDsr<Zg5LY0gk8KJ'>=KJ$PO"NL#LK$FO#7A#&04==D"T]0?N&@L DCFG"j`-pl;[X'?=-4' + ""$8<@=FB$&8.=3'NN6]\>;?&?@4:$ AH'HJ$JGSJ(&)&* ()'.# '$CJ)fh7JJ(;:1* + +0/je=II';;!IC%�{W��c�|QxjBja:kb=cU<*'d[BRL*{q?]V1=7B8yX7��j��e��^��k��a��[��_��b��d��[��^��Y�|G�|U��f��h��k��m��o��s��n��q��q��f��m��p��w��s��s��q��o��v��t��u��s��u��s��s��q��p��u��w��q��\��]��[��]��_��Q��M��X��R��a��UxvPdf=fg=msEkoB_f5~zE��]��g��q��y��t��s��y��z��{��w��s��v��u��r��s��q��u��l��{��m��g��tĜw��a��f��cÕtiďn��eăećg��l��bŅ]�vT�hH�hO�sT�}[�xU��e��h��`�wW��e��f��Y��j��m{���ٷ���vԳ���z��rʳ�ͳ���x��}Ʊ�ì{��}��x�����y��v��u��k��r��o��m��m��gĕl��mǓrĕw��p��h��v��i��s��m��o��h��h�����tPA'xhP��\��B�~C�uA�|A��I��K��[Wb17@ ( +&/8@'0 +*2QY,=IkqCZf8BL$(0 !$+JW,U]4[f<fk:MQ,<G(U_0}�PjrG_iAR`9:E"7;�cA�sk?:OQ&pg6dY-UK'XJ)eU<UY,<= MO#ec<DG$$$QX4XZ,ZR%;5 + + + +AI##/5,-78!) +!+$)" ;C%4=AB&96�{b��k�yIhj=dc62:][Ak^?`XEYe:LR'G?'77!08]V,��������\��\��[��a��f��e��c��c��b��g��m��h��j��n��n��i��i��p��o��j��q��q��p��r��p��s��r��p��q��s��q��q��u��v��m��o��s��q��q��e��k��\��c��V��[��Uhl>gh8��O��]��g��VqtHpsEIO+elIsxI�~M��X��d��Z��o��r��}��w��yú�Ž���x��v��v��y��x��s��u��j��s��~��v��x��w��z��i��p��p��m��r��w��tȎj��g��d��e��`Ɔaā^�b��a��[�~\LJcА`�~_DŽa�~^�yZ�{W��]��^��i��pǫ�՞�ܶ�ҧ���qԶ��ʶ��|��l��t��u��x��s��x��n��m��o��l��p��o��r��k��lrƛtÓoĝ�ȣ�Ôoȝo��m��r��l��������j��_��^��_ß���o��M��J��IÜX��M��GɕL[a0AC"* )*15>0;$++3LR)��Xac@`f>bc@fn>KT+PN.@D NV,��c��a��a��W��\w�Uz�R��d��_lyFK[+1<*- >@�|Mh`1mi=woCrDuf5\K+bO+]W;! MR%PN4IM(:B%O\4hc<cX7)&'-/6 + +84+/%+!'?F&!' $7A ohJG>)66& #EV'AK"=?CI&fP4�lN;<%+506%9@ 9<JP6T`7X\/w[[W?GL(KO(lg9��q��]��X��k��m��e��n��i��e��o��n��m��r��l��l��i��p��n��i��s��n��q��p��l��r��s��j��o��q��r��q��n��q��f��q��j��h��n��f��g��k��m��^��]��f��X��VlwLqvE��Y��k��S�U��azwK_a8UY6�tYxtC��T��S��[��s��r��t��s��s��x��p��i��r��r��v��~��y��u��q��s��t��q��w��{��w��q�����r��i��c��o��z��m��g��d��i��_ŋfƐiők�~]��a��d��e�~d�{]��bȅi��a��g��c��g��l��`��c��f��k��z��{ຜ�mN��b��u��s��n��r��q��o��p��m��m��q��h��l��k��i��n��on��t��yŖtoŚx��n��q��m��s��z��X��\��d��l��g��]��`��LȖE��=��KÐRdd1RX%6BQW$ai3EH!AJ#US$SV3lkH��Vs}Q��U��b��[��U��\��X��X��e��[��a��b��]��f��h��k��dOY+[a4ol;dc:em@y|FkpA?B';2'bgENU4l^CWD2;6"2;/47?![j?YeCCK%woT}zb<C">J'(+DD$-- +#*"$QE!7/$. &"::%5A��ka^?55" "DP+IR#EN'knGvoKth@aY1:@$ +0hgFfo@W_6Z\4Xa6FK*ZW/nrB|�I��Y��t��m��h��b��o��r��o��r��q��s��p��p��t��r��r��r��s��m��i��p��i��i��i��r��i��m��l��j��l��j��m��q��o��g��j��p��u��w��h��k��j��]��O��PnwDdm=��P��g��d��f��[��e~}Mx}Mdh?�~SLO-RX7x|LrzF��W��c��l��s��s��v��q��j��o��d��o��r��t��s��l��v��m��g��k��g��q��v���͵���t��{��q��{��u��p��d��d��\��l��kąf��]��W�zZ�zVÂ`�z[�uW�uZÄa��[k��l��a��h͟x�{[��]��Z��^����xzV��|ɢ���v��r��k��m��q��q��i��q��m��k��n��h��e��k��q��p��j��jÚuŖr��oƛ|��r��o��sĔp��rēn��n��f��a��_�s?��c��V��P��J��C<A6>;D$p~G}�Qw�OurJedHdiEWf?Yg7gn7��Q��]��Y��V��T��Z��_��`��\��f��f��X��Z��`��a��\fk:|~T��h��h��g��r��g�rPseIhi<CG$OJ&ZR/=<#0:%&Sd3Xb(47bV;PK<@B 48//"$$ %&"&96B7 "AO)*6% "4Bo~M>I+" )%/8AHT.b^?�°���dZ917$#OV5]kAZc9CH"JO-dh=jl?�I��Q��]��p��q��������|��p��r��u��q��r��q��r��m��t��t��p��k��m��d��p��l��o��e��l��m��m��n��j��l��o��l��n��n��r��o��h���һ���d��e��d��R~�K��O_f@JP,�tS��X��OwuB��Q��^[c@np@GU+e^?W^B^fDgl;rn@lpE��j��q��p��s��s��t��o��o��f��i��p��m��k��k��i��l��m��o��h��k��i��s̹���w��w��u��z��t��x��wÙp��l��i��f��j��l��v��l��l��kƇi�{^^�}_ǀ`�{[��^��b��g��i��sƦ���l��l��d��h��[��s��x��m��y��w��j��l��m��f��d��i��b��d��g��g��b��i��f��d��i��k��l��lȖoʕo��g��rş�Ǘx��yŕoÕiŕkȜt��V��Q��P�}>��E�r=NY,IZ*wyMz�Qv�S��a��bv{Js�L�Py�Q��T��U��V�V��S�Z��Z��U~�R��[��b��i��l��r��g��_��Z��b��n��s��k��Yx�T}�V�QuqHV[/IE%>7SM+TE47$%>A!<IVX%NP':9.-^](UP!B@ FG::LQ'9786', +47BL(Ud9# +,8T_.6>"$%''3,3S[:yxLxlG��|������BL#C@ ?B$)408![]=��[��Ws{IY]1osB\a;KS2rtOcfCuyJ��p�ǪѼ������a��j��j��l��j��h��k��n��l��r��q��p��k��j��k��l��n��l��l��j��n��l��r��p��m��p��k��p��l��k��l��n��p��]��b��Ujs>tvD��ZquFAJ'YT8kfJ:C%^d7szHjl=]b=R\1KR5lqJvzMXe=V[.ag7MY/mxD��Z��k��u��s��u��k��q��v��u��w��k��h��l��k��d��g��m��x��w��h��h��p��g��q�����x��u��o��k��e��n��j��h��m��l��q��n��w��l��k��g��e��`��l��h��k��l��j��p��l��q��m��o��s��s��o��n��`��n��p��x��r��p��h��j��b��g��h��bŦ�ͫ�Ǡz��i��d��g��b��a��e��kÓl��n��k��iŦ������s��g��b��b��k��l��c��U�v5��@��Ins<ee>RM*V^)V_6UR1em8z�Ly�L��U��[��_��T��Z��[��\��Z��]��]��d��V��Y��`��b��j��f��b��_��d��i��b��f��c��X��g~�VDJ%?>hd;97^R)ZN'E>aU(�vGsd6l]08;9<^Z(oc5WQ(08.79;[Z2US+_[-?5E9K> 99-7$82QL)vlETX,FW'LU)`a6YZ2sj?soA�Q��[7= k_:g_;LU-BH+[aC�yG�n>�{F|�OxyIOQ8<H)NY7WZ4JU,trD�Y��W�|Y�tI�xS�Q��e��q��o��k��k��p��p��q��q��k��n��m��o��s��r��q��r��n��n��n��r��r��t��r��n��m��o��m��l��i��]��a��Sx}L��\rvJu�OT]:klNa`C%4\c7�MMO-ia9tnDlh8��V��dkvNntC~�O��PrrEab2��T��l��x��q��s��p��u��x��s��l��l��h��p��o��n��k��q��x��v��k��n��h��j��p��h��`��V�~Y��d��s��o��r��m��k��p��w��v��k��m��p��u��k��o��q��m��q��s��p��o��p��k��p��d��w��r��s��t��p�����Ǭ������n��c��˧���y��i×u���ۺ���j��[��_��e��h��^��c��z��v��`��}Ü������d�yU�yT��e��k��i��c�X��Lzw>�~CHD! 59.38?>?QP!\d0YV&Yb.ef2��R��\��^��V��R��\��_��\��\��[��a��a��Z��^��e��Y��Y��\��d��`~�R��W��Z��_��Oif2dZ-CDGA>7 MH*WR'm]*dU.H=;9iP-te2NFKF#)@B"FBcP%aT+\O(L;=3IAG?! !;A %9>OY+HS+$0!+15G9 OD&PO+5<O[3RU2<:^_7LK*��i�S{kElX7{hCjlEJQ*?J/:G#a`:|vLrqBhmCfoJ_m?fs?syIXb0?B(e`8yk@_W4`c?ulF��Z��d��q��r��u��}��t��x��v��r��q��n��z��t��r��s��t��s��s��r��p��m��s��w��t��q��k��t��s��t��p��n��p��]��b��ow�PmwIwR��d�{Sbo=dj:~vK|pE�{M��V�R��]�{W��V��UuyI{|HtxM_b8nn@��n��s��r��s��m��q��q��t��x��s��q��s��t��s��u��y��w��x��{��{��w��f��u��d��X��\��d��\��s��y��s��u��s��t��{��y��x��x��r��d��o��r��s��t��r��x��t��r��t��w��q��p��s��r��r��p��t��t�����}����y��m��d��w��x��jծ�����Ķɢ���i��c��m��h��j��e��o��o��k��n��p��f��`��a�{X��e�~]��u��s��Y��]��R��GCA"**),!" *0RI#@;C@PGNP bk4t�G~�Uv�Jz�O}�T��Q��R��W��Z��T��S��Y��S��U��Y��S��W��U��WW^5U\)q|H��Vs{L`d5nm>qtEak9CM%<8-njFx{JgY0{jFbb3LR)\P)hV-L;"D>!@J&1@!0;KR(i\/TN'`W-IB $#//"**/8>LO%CIac1TV,"+&76XP-{g@l]6HA+MP,OR+]i:RZ2[\=yLwwMqb@�mI�eBscAFA#6;DF&KW-do;q}Egk;srF��\ck@mn>��pw�MWb9fmBb];\[5{xP��V{uIw{L��o����z��u��s��x��z��o��s��z��{��w��w��u��|��{��x��v��s��s��r��s��x��w��w��s��v��y��u��}��t��t��s��jguCntDu}M��R��f��bw�P{{I}|MijBdf<�J��XwkAuFQX1Ye:V]5ouJ��m��i��{��z��w��{��u��|��y��u��x��z��q��u��|��z����|��|��{��{��z��m��T��W��d��h��b��^��V��Z��n��]��[��[��T��[��`��i��[��S��X��]��_��z��v��s��w��v��t��w��u��o��r��r��q��s��v��r��r��s��q��p��o��q��n��h��i��j��s��|��|��t��v��f��g��f��j��r��n��g��l��k��i��e�{U��^��d��b�[��d��i��e��c��D�|63:-.(++(()JG"8;GKGF$44>DP\,as;q�Lw�Nv�Ty�Q�Q��V��Z��Wx�Y��T��R��Y��]��Z��V��Vz�I<C`j8rGp|EDU(Z^.y~C�KitA7@(MF1kL}pD�pU�xWgY7RS/67!C> OI)NH#LX/]m>csDu|PpvIFZ,:>FJ) # )62?HM&:>! +/1ZL/]I'}qEh\;niBfi@[c5'/ED&��U[\6bc>xkF�yRbW8oj<VV3BA3anB{Iu{Jv{Fms?nyG_g>ll8mwMo{J^p?U^5keDwtU��c��e~~S`d8ouG��z��s��w��t��q��y��y��s��z��x��p��u��x��y��s��|��u��z��y��v��t��v��|��u��r��������}��r��p��k��Z��^��e��Wko<�S��jt�N��TovB��RnpGqrH��K�zGj^8�{[ppS-?FU2{�P��i��s��s��s��t��u��r��s��u��u��t��s��s��s��s��w��z��}��w��t��|��r��Y}yS�z\��d��f��g��e��Y�zR�uO��ezvPjqNsvP�~P�yO��Y��RyyS��V��\��a��y��}��t��x��x��y��x��q��r��r��x��q��v��u��q��r��o��o��q��o��j��q��p��m��o��o��g��i��l��f��h��h��b��e��m��l��d��b��k��k�}U�xS�}T��b��b��Z��\��Y��b��T��J�~>+/%- *<C;F#t�KprCkh8>I!09+046>Idr4u�Jh�En�I~�Rr�Jq�Fr�Oz�Vq�Jn�Ky�P��S��W{�X��T~�QT^0-;9G!Sl:Rb0ho@s�Rw�P_o<.:DD0]QA<>$yuIrc9SQ5T\9NQ.cd9kf>^[/LV,hzD�^��ZXi93B + + *#* ',4'0.4ID(VM3KQ1]a<twI3=!UVCPP2��_��cgrIifCqiAg];GN.Yd6DI8n|O>R'N^/��Ws|PoxBUa5t~I:F%JU6]m<BP+trQyyQ��j��h��n��q��s��u��s��q��s��r��w��v��t��s��w��r��w��u��x��v��v��y��}��t��w��s��t��y��k��g��a��m��s��h��a��P��]��c��o��p��c��u�����n��s��e��j��e��W�yK��W��b��g��_�zR��_��q��o��q��q��r��r��h��m��w��l��b��m��v��k��s��q��{��x��|����z��}��{��g��W�]��m��_��[��l��f{rPZR7thNznN�|R�WwtT}{W|yTooLnoO��c��c��b��n��r��q��q��r��p��p��r��p��q��x��p��v��s��w��w��u��u��o��v��r��r��p��q��q��r��p��r��q��k��c��l��j��o��s�]vxKrnL�}a��i��j��p�zY��d��h��a�|T��Y��a��e��` \;?0:J[6PZ3Z`7FS&?Q#K^/Wi2J`,Og-_u;]t7by9Ti7Vq9dz<f{=]x=\o;Yv7J]+M]+Rc5Ph9Oh4?R,0@ *75D Ib/AQ)Y`0_g:Vd2:I( />;)MF>$1fj:?='FP2ctFsq>�S|oEbZ.b`6`a1grAo�JM_+ ) + +'&1*2&!-,6>"EE**'6;!bo=��VXm58H!(2P\4��^r�Mv~IyzPX[:jf=fjBM]/>H#x�[Vf3K[.P^1ryGq~TN^1��X��g��[��i��]��h��m��u��k��s��v��t��l��l��v��p��q��r��o��s��u��x��{��|��s��v��t��x��t��r��s��y��w��q��q��y��u��i��y��v��d��TllR��i��u��~��v��ǫ�Ӷ�ġv��g��Y��i��c�zK��W��VtdB�tL�~W��hęv��{��i��r��u��o��g��\��n��~��v��j��mƞtƟo��nĪ|Ģq̦|ǥr¨xƧz��u��r��u�~V��n�zX�YtmI��iƥz��nUxhH��\�tM��c��b��c��k�uN�~R����{��p��v��{�����}��m��t��m��m��v��v��t��v��s��t��o��q��t��x��s��y��u��{��m��s��n��n��p��n��n��o��n��o��n��o��p��d�TjoN}yR�uQ�xQ��k��j��d��_��b��V��Z��d��`��ZèZ+2-8EG-KH35C2C2D2B3A+A/F!5M#-F$-A!+7 )55E:Q$2L'2C 6D.@1B.?,<2A6E&+>"0" ,3AKQ&LU$bf6le:^[/CS'6J"9@'IE4--0; GC1@A$nn@ch@_dA[P-]G#AG"?H2>)71@". +));#0!$4!3<#&0Wd9Wr8Xl>Nd,9K"Xm=k�IqxK{sN`g<��SnqFVT4^f>;G'7A%m}LUa07?3>Wf8��Yp|Pv�S��a��\��^��i��c~�Zw�V��`��_��f|�a��\��f��Wv~Po�Sj|OTvGf~Kz�W{�^v�[��^��o��q��m��v��x��r��z��z��v��l��l��r��u��������~��q��f��m��l��d��t��r��v��kӱ������]��_��T��g��_��\�uGSI%fZ7��jΤ|ʚm����tr�p\rÖnƙv×lƓjĒi��p��i��d��d��jÛxȚvŒkȗmɛyƟv��oŕlƚw��o��k��t��d�xZ��b��sä{��w��y��x��~��g��d��n��u��x��j��y��j��o��j��]��m��q��o��c�yX��]��j��f��t��m��h��m��w�����m��f��c��a��n��y��t��|��}��q��d��k��i��o��p��m��q��i��k��b�uP��U��`��q��n��W�zX��X��O��KȬn��g��aɪb��_��G��SCE-?E1?D-$!$"""$)!,#/$0$0(:,@.F.E)8-@0B3E%;+>%+<!0='5&( ,)!.)0==CD&(,MG&9="',5_[F$#[L8K@.NE*JH)wm?xj>^T5_Z26="/*81?&2!-&# +(4#/.<*8$. + +$!..E!&:*=&1%18K'AR*1?;D%MS1`c43? QM3$.$%/7E/>+9.<>L%DT'>K(<Q,@X1=N-:P+R_<��vEZ.8Y+E\1>Z/=_6Gf9WrERrASm<Mj;Jk?De:>_1Nj?Lh9Ol;Oj;Sl?YnAayCbyDcyNx�W��^��h��s��k��f��p��l��l��r��u��u��u��w��w��j��q��g��p��h��l���į���p��v��e��}��`��Z��Z��_��hətʟqɛvͰ�ͫ���p��l��k��q��j��b��jp��d��h��e��iŜxà�ɣ}̡|Ӯ�Ϋ�ȥ{ġ~Ȥ���}ŦyΨ�Ъ�Ôtɠ{ˠ{��q��p��w��{��x��}��i�~Z��f��hרyֲ�Ĝrƚs��h��`��kǚr��c��`�qJ�vR��f�|X�}T�uQhYA�mN��e��p��X�vT��d��c��Y�}]��g��pɥ|��z�����x��g��h��l��i��n��p�wWneJYQ3b]C��eű��OhgB^XDic@�x3��Kΰd��i��^��Q��K��E��R!# *$0!.*)) -'61B+;'65E:L1C&2%"$&'2+9+9& -%3!.,II(@@*#*,;\P8%!pXMg\M$$EB @?")#,!-%2%2(5#%&# !(>M%;J!% #%!#%'!)&!-=G/8D%@K,TU:*4%6;*9?%HI'5A$*5!,:5@'/=2A$:G,4@%5C&/=%LW>�m3H'8I,6F+7M+:T.A^9@f;A_5Jd=Fe<=_3Ba?@]2LlBNl;TjCMg5Tn?WoBawAy�Q��]��]��b��f��m��l��r��p��o��l��p��g��n��k��r��u��t��z��u��d��m��k��hɱ�Ǯ���r��l��n�\ʛmȖrМpˠuęlʜsФ|ѨzФzǣ̭�ʣ}Úu��{��pŗq��sǘoȕlěnԯ�Ш�۷��ج��⸓巊ݵ�Ҳ�ͫ�ر�ٮ�Ҩ�Μw˟w˟wșqŚx��nʥ���o��h��n��s��oÕuӢ�ˢ��w��v��g��e��k��m��b�z]�iP�iP�}Y�sQ�tSlLpcC|tV��j��o��j��`��_��_��f��d��k��j��k��h��f��t��u��d��]��]��[��c�z]�qYtiQdkL�P��m��\eaBqfI~r[��M��6͡I��Lzs-��G��K��P��G $# %%#$*7+9$1('(+8) ,+<0D @P&7D4D2A2@(83@FP$7@HG&>>%:>>BDB&�p_�nYscN6/SG#?>"/+-/*"--:1@ /=*7!-"&2+7*/"" + +'3AN#6D" +$&%( ,%'$$(3u|QruVMM0CE,8;0*/,0-9%. !."-)"/(6#(%1.;&WX?zti/<%1=#7D'9G+GS-EM1Z[7SR.QS5UX9`_;rl>lpHktBgk@x|RmoDu{K��O��\��c��c��h��d��h��[��b��j��e��h��_��d��f��d��r��s��o��t��q��t��p��w��u��c��`ǰ���s��Z��p��x��g��Y��^��h��l��d�{R�fE�eB�oI��a��h��f��c��q��t��n��]��Q��[�xT��S��i͡}ҥ�ۮ�ְ�ڴ�Ѫ�֬�͞}հ��ț|ʞzĜzȞy��s��m��h��y��m��e��f��l��l��p��g��k��m��q��s��v��m��k��e�~W}vR��Y��b��e��]��_��`��a��l��i��c��j��f��e��f��g��c��e��`��b��k�����s��d��\��a��_��\��_��`�xUttO��Z��X�T�^��R�|Q��[�~;�m%t`)uv0��J��D��Q��K + *$##"'&$$!%3 -%'7)70@9JBS)AP/=.<,<>HB;@AFM!ST)MS*ga;c_;aY4IE#�{^�uUdM0TAXD%SH+3+KC=924:;'! ## /1! + + +(/I[/L_1" $!$)kgDb\<ME)RCMM% #%*#&#'(.,2*.=5@5+-A=%dSB/,bX.hA�a9�k=�pG�yL�n@�uH�vD�zN��R��U�r=�yI��T�~G��K��J��W��V��V��R��V��^��R��T��W��b��\��c��l��h��a��_��f��_��Y��m��g��h��m��f��gy�\��h�����}�����w|S��VqwPqqQxyVgnKU^?EI1?>+FG2S[AeoOOQ4<B(gnPeqPdtMfsMarLjxL\^@cU3m`=�zT�]��uƣ~ĥ�Þ{��x��r��yÝz��p��k��e��s��o��e�{a��i��l�|^whJ`bBq}Sy~U`cAmmN��c�_��_��i��j��k��g��e��g��g��a��f��j��e��c��c��i��e��d��j��a��c��_��\��Z��]��[��Z��i��u��l��a�~]��[��V��\��a�z_�sO��[��h��N�yB��Y��S��Zӟ[˥h��B��U��K��A��G�{A��E + + +" + + + 52SCI=DH'0&$/*,/3/]C oU(w]/i<^]/tl9}t<pg<kd6lT0bJ0I:#",#) +#!,!6*+% $#.) + + + + !) + + ! ,+PE#nZ7eJ+oQ;H8&[@#mY+RJ'3,)H:G6D5 WG&cL07,L< H;#71VJ*mX5kZ.�{P��Z��O�g7�m3o].~k<�zE�r<��T��[�yD�{J�M�xD�l8�~G�zJ��G��Z��S��Y��Uʞk i_��^��f��d��f��dƚi��g��eƙc˧qámŜd��_��a��^��]��a��k��g��tŞz�xY�zZLd5_xG`vET]9ckKpzQNe2CZ9:H-7I/R\CJX8EV8_pIt�Yn�Uw�W��i�b��n��~��w��p�|U�wT��i��q��l��o��r��m�x]��j�|ZygM�rP��c��a�uRqdHxlLxqTthJjfB`bDqiAuoFmgEzoH|T�}X��Y��_��_��a��g��`��^��b��^��a��m��c��_��e��e��]��b��d��_��f��Z��]��]��]��T��\��l��l��e�{\�}S�zV��Y�yU�{X�xZ�vQ��hɮu��S��I��^ϢWəO��N��bğ]ók��S�u0��<�~2��A +"")# B7 @8ma/ + * X;?'+! +- " + +/"@2<-ZDcP-=5WK';1, + + + +$# + + + + + + + +*!*6:IG'YU1YJ)yj>YI)uZ(gZ)B=#D7!eX4^R/_R0se=}qF�wKbbAZS0\V0a];zhG�pO�pH�vC�mE�oBkR&hM!R> }i?�kB�nB�xJ��R��P�{O��K}l;cU*�zM�sJ��Q��U��W��d��^��lǞs��j��V��d��l��d��[��X��d��iȜo��k��i��n��_��f��hʢs��n��r��c˚[��Ml9eZ4(2AH$LL+6.SI5klLbg?_iBTe9KZ8tpUZ\=alAqyBy�M��a��[��Y��^��e��h��h��h��`��_�[��b��\��t��t�zSumA�uV�rYwnK~qO�|T�vQujEjb=qfBtiIrfHuiBynAziFymKymJrJyR�yN�X�X��^��c��d��`��_��\��`��f��g��_��_��e��b��\��c��]��_��`��\��[��^��U��U��\��m��q��_�W��W�vR�{R�xV�}R�wT�vPçpħr�}C�k4��Iϯeͮ_��Q�s+{h+yh)�{7�q0�p1��[��F + + "(';8 + + + .+?2-$ &# &!,(*&&B8OC$[H&UH)>?#=B ;?+402_R7SB)+# + + %(%,!"! !! +&*7*7 + !/3G&:R)I\.AN0E\4Ne<Vl:Ne6Ha;FZ:I`9Tg:;;#,+@G(+2 %LT0US3OL6OI*EE&KG)PJ1gX9[0�f;�mF�tZ�qB�r@�`5�j?�d?�b?�mE�qI�zP�xM�zT��Y��V��T��U��Q��P�xO|iF�sH��S�~W��a��T��b��b��^��X��]��]��[��Z��a��[��Q��Y��a��\��T��U��\��\��X��X��^��_��_�|[�pHriDktH��X|~N�O��U��Z��d��c��[��]��_��b{{Pz�S��S��S��Z��\��^��W��P�}Z�}W��W��a��e��q��p��������x��t��p��m�f�{\�uWrNvjJreGyiE}jGvhHyjIykI|jG}lNzlIqK�sN�yR�~S��]��^��`��]��b��`��c��Y��`��^��f��`��a��`��^��c��c��b��]�V�V�U�zR�yT��Y��_��j��\�|]�wW�xQ�zQ�tP�|R��U��eîp��d��Z��J��J��E�u7��K�x<�^"rN�j(��G��H��W��H + + + !#*)6#/"-'1+7)5"/$0( -!-''($/*6:D.71;=J$9I$:D(CK(AE!=>*JB:RF.?7!8;;5?> GQ*S[3Q[3T^2Qe6Ne2FZ0H]-G[4Ic5Re6# +.<#3C$ >O-:J$>O&<J(!,@K%LX3^e9TV>(4)3"%,5*3 &37"`cCTW6//#)+&)++ + )L0sC�[8w_ExT)~Q4�]7�iD�gB�^<�gGwX7nV6ZM5R?(L?-OI+[Q3aY7\X9HL3}mS����x_\Y8qlCvtJnoHkm=usEqsGqpFosBnrDquFprBywNxtJmo@lh<mlCqp@nn7oqCnpEwwJyyL��T��`��j��l��f�{k�sV~�Q��R��U{Pz~RyQyRw{Ks�LlxKr�Mw}TqvJjwIrzLs{Nw}O{�Ov|O�~P�xT�{O�xR�~[��h��n�����������������������z��l�~`�vTzvNxiIuhFvhLviKthBwjFwjGvjFxjHxiF{nJ}rN|xV�xS�yS�|\�[��\��_�_��Z��_��d��b�a��`��^��^�a��c��b��b�~^�_�~Z�|W�yV�{V�}^�Z�}^��a�vW�vS�yR�tQ�vN��Z��a��P��S��Q��e��_��C��A��K��C�i0�v3��>vr5��H��6��8��; "&%%''&&&(!"$!. + $#%".&36C(DQ5;E%:>#OQ1HH*B=/ +TH:2,"EL!LN+RZ1`p;ao>`n9`uF\r@_xAbvAaxCau>Pf97E# + +/:&. +:H(.90?"- + + E50-% + &(**01"(*56.1 '' + "R<#hV@R8b;sN-wU1gW7TK0ZM,74 4, P?6���qdU''94 GA&JE.DE,ON/RP4WT:QT4WU8[\6``:`e>dg>^_9X];]Z5bf<ag>ehCkj>vsEzqE��`��h��h�v^�vW�ua~qP�}NzwH�{O~{LzMx}IxyKy}Nw~MhsEnwJwzNpwMkvKqxGnwMtwQyzPy~M~{M�vM�{R�V��V��\��i��p�����������}�������v��q��g�xT�pMxkDxgCzfCygIwkC~lH|hEmH}i@wiGwjH�sM�pP�{T�|U��R��X��^�[��X��Z��\��_��[�^��W��_��a�}`��_��a��\�{Z�~W�]�yW�yV�wW�yW�{_��`�z`�rR�tR�vR�qO�tN��]��MvY+��b��Z��O��N�u1~n*�t5��:��9��;��Q��Eq{A�H��5��=3;29/7#' (!*& '+% # + + + + + + ! !" RF<'& +'$! + + + + + # + + + 63--! + ,28:!64""*( !)E@.i\L+". J6K75.)'16 *'+ B>5B7+ !2,3023 -2!22!=;'NG-IJ1GL.OP-ON,MH+YR.YW4_Y<g[8sk=pG��g��e�xT�tL}qI�zYsoI|vFup<or?{xK{zLx|L|{T}}OuxJgrHjqJtxLkwIjtDloIouJtxSz{Mx{MxxJ�uK�{U�yS�}R��Z��k��y�������������~�����w��l��d�uN�sLzjBzhEve=xfHvh>whFmF�mK|iBxgHnO�rL�uP�zP��Y�~T��[��^��\��]�z^��V��_��`��`�Y��b��Y�zT��_��]��a�yR��R�|X�vR�wR�wR�yU�|^�~b�vR�uO�tP�rK�rJrN�qH�tN�v=��O��ZʜS��Q��K�g#�7��2��Aud(�z7��eqm5~w?��8��T687:+1#% $ #* +$(+ "#)04 +# + + + $! $ + + + + + + + + + "" + :7!540-?C%" !% )!( 67!iaC + ) "# + + !'&97<8"?;%@9;7!A<%F=%IG-RK+`O/sX8�oJ��m�xY�rOxn>{oA�tSed@oo@\`2U`;om>kkAjo?qqCyyKtwM_kCci9nuFfn?enDbkFkpFnrHrvEtxJxvKuN�wQ�yR�xR�U��d��p��~����������������~��m��f�|U�sJ}eDrd<ra?yiCsc=~lC}kH~jIvj>we@�nG�uM�zQ�zQ��V�}V��`��d��]��[��\��Y��[��]��_�|Y��`��^��\��W��[��b��W��W�sI�wO�tM�wL�xR�{T�z]�tT�sQ�rH�sG�pGzi>~lE�}Q��Oå\©h��J��P��=��G��[�r+�g*dQYO}l*��\��C��.��> + + + 8:! +4 ( + '&9:%;3.* + + + + + + + + + + + + + + + <D* 9;!GM.') ')! "%+!%$$-" + =?0!%(#(' + +(3!" ))(' "/2#,.58$<9&JH)>;65<;&A4%NF(H?)TD&gP,�sQ�|d~lB~pDpj<vk>|tQ\Z5ieAXY3IP-XY3ec>]^7ni=vqHjlF[c:Xa5`f;[b=W\?`e>\h;cl>knEmmDppFvnH|rK�tL�sQ�yW��`��z������ģ���������������w��o�xY�sM|pDsaBq`>uc>n^D~nD|kA�nFygBth?~tI�sO�|S�~T�R��S��T��c��b�|W��W��X��`��f��_�~U�~X��Y��Y��U��\��V��X�{T�xM�tJ�wH�rH�tR�~X��\��^�sN�pG�qI�yL��Z�}C��S��P��7��=��E��O��O��e��[rf,y\3O?iX�_��K��E�y/��C + + + + ,2 + + + 6@*0 + + + ""(%&& "&# + + + + + + +$, &.5.1)('*&(4##($27&. (.,.*.HI+<>%.2$* *2 + + ,.+( #39%18/333IJ/IK,D?$@B)?>'FH%?>"C<!SI(xeGsgRnb<ti<ma9ha8mgA_\4ea;UR.LL'RQ.NP,JQ%]\4mk>^`9KT2HS6TW7QY8LQ2MU7X[7W]9[e<bgEljBqlHujBymE�sQ�yQ�}]��o��������������������������v��]�tGxm?ugErcAqe>tfFwkB|mCwjFsfCugE{lF|rN�wO�|P�zN�xK�}S�T��U�~V��]�{V�~\��a�~_�X�}T��U�|R��X��U��W�~Z�~T�sN�rH�wI�sP�rK�~R��V��^��g�T��M�N��p��_��L��K��I��F��GƖ[��I�e"�|=�zC��F�w)q^%\P)��P��Y��E�w; + + + + + + + +&0.8 + + # +-4 ( + + +# 41( !"655,*' + + + + + + + + + + + +-'" $%%(%&?:"GC#)* %0*4$*# $#+ +&$(01AA'JJ)C@07#(, !#% , + + +" "*%)+,();=%DF&DE$<?$??'=A"99 ?9NE)j^BaW;_Y/ke=h[5Z\5_X3XX6a_6XO0LF)LJ)DF$@G)KR0][6TR4GI%;G+DI+GL-GO0IP2JP1JL/OQ8Y_>^b6`^9ibCtiF�qJ�sP�}V��q���ʰ�ɮ������������������}�\�wOviCqfAma>ne<oi?yoA|qCwpHncDqiEumIyqI�wK�}R�yN�}O��T�|R�zT�{T��W�}T�{]��`�~^�{R�wV�{V�|X�zX�}X�zS�{R�vR�rJ�rA�rI�rH�sI��V��V��[��g��S\��\��n��\��JǪ`��H��O��N��L��AnUwS��:��E��?��F��K��@��N�y,vc " + + + + & + + + + +()/++! + + + + +# +,+"'4/44&&0(6/! + + + + + + *(84<6'% "77+.#)+(D9&A9!#$ #:@ %*%- + !#&+-1:9MO.ED+7?$57!-2!&+'(#.$0& + + ""'*,/0276?B/76559,346A?'WW>QH*QG'WZ6\X0ZX0SR+ML-_W5RO-GF'IH,<? 2=?E'RP0KO+:?)5<!<B$9<+5>&<?'?@*9>*KM2OU8QU6PR2[Y<h\:yc=�rO��b������Ϲ�Ͷ�¥�Ū�ǯ������������g}tNtiBkj<ifBme=oi?|nDwqDvoEkhAie@ooG|vSwwR�wP�~U�zQ�}P�{R�}U�xV�|W�vP��]�}Y�yX�|Y�xR�ySxV�xS�~[�wQ�{R�sR�uQ�mG�oO�lE�m?�rF��Z��K�uB�zC��Q��b��K�y8��X��i��Xĭl��kɵm�~>bL"�r.��<�w0��?��S��<�j2��Ry\#vx) + + + + + + + + 46QB@8., ' + + $%'#$ ##:76053PG*,* + + + + + + &,((/ + 53;510!'02<"$*05%)85OA'PC(E881 #'<D!+1$ (,A@%IF(95A<'PL+GG*59"1826$)0 %-&.!"*%. ( " !#&125;/28>#.0--03(+,.9: LL1;8?<!MR*MO.QP)JJ#IH$WS/QM+HH$DE$9?4?:>!II*@F(47*.266=#4525$;9"5<(8?+FG*JN2LM4PR5[V9n\=�nG�~d���̲�������˸�ʶ�Ĵ�ê���������lxqInl9mlEjkBpm@qnAvqEvtKpoJffFdfDjmErsRruP}yQ�vP~uMwtM}tM|uL|yL}tO|rT�yR�yV�_�zU|xVztOytT�wX�wX�yY�xY�rK�oJ�hE`<�uM��X��]��S��O��M��U��?��WpY%��B��M��K��_Я_ȭ\ݸuƛ]�y7�{2��O�x-��F�x6]QqV$�e(x\��3 + + "& + + + + + **ME;:A>/* ! + +(20 + !'&& # + "! & +%*10/2!,%2:#%&(=4IB%?9$70! #'.0;4B' "01\W,WP.VR8QH$?@&15,1-3%-"+(2!!+%/#,$ !!#&& " !$96!>@#29%BF)/3**+0$('+24AB-.344CH'GJ$JK*FF)?D"SM+NJ*GD'<B)9="<>$=C&<C(45,/'-*2 +3+/)//2.27<&;=)C@)DI+@E/LE,eP;vcC�}_���ϼ����������ƽ�Ų�į���������usoJom>ohBom@ttFuuC{uIsoJljG`^@]_FabFfnGknFtuLyvHrlCniCtoDuoFoiEpjHxqP{uR�wd��fxsSrkLumK|sP|tPtS�wW�uU�pL�iG�gF�bH��d̩k��]�G�nE�|F��M��>��I�wC��H��I��P��?�~6�{,ƟY��B�r%�|/�q�n+�}=�sA��7�j(�q9��I��1 !! +! + + + # %" + !!$& 53.*/* + +#!/*% (' + + + " -.!"!"-/82378!% 83!##09;A5>>B?@"$ +HK!IN)IH+QQ2BF'9:/8#1?!%+#!('0&&2.7 &.$!"()*)&'#&&)!$&) 9:"HI(FL*GM'67*0*0 ' %03 ;?(&,&+9;%??#=F+FA":=GF)JG,AA&7> <B=>$>?#7;49%,1 &,(0 &+#'+./200!95 ID'@B"=A?A&HC-_L/xaB�{a������������������п�̺����������noUnm>wqGtuIyuI|tIwwKsoLffKW[;UX:[bAadAkgCpnHrnFob:nd>mdHmhFc_Egc@llNwtX��b�{atlPngGrkLtnP|sX~yX�vZ�q]�pO�jM~_AwWB�{SŘ^��P�mFwgD�lC�r<�x>��W��B�}8��^��y��G�l7�}?��e��D��.qa+[Jxt0XOwg*ĊC��Gq0��8�s, + + + + + + + + "$$%2/&$! *(6/*+,- + + + + + + %2! + + + +(/+/&,"& + & (4#." )/7&.(0+/ !$EI!GK!49QR-GF&9< 8@(9G),8$, * &-*8"-"! "%'%#))+(%)&*,-(%!" !15NO.X]/R[4@@"*3$/ (+/7:-$&$(6<!47#5:59489:%DC%884899;@!8=;="36.1!*.%-!)!&*0/1"00#89#JD(EE&@C!CA&L@,XD.mY3�|\���������������̺�Ͼ�Ů��������sjhKjkCvsKvsE�}I}uG~yOlmP_cHSTCOQ;T\>\`EZ]Fhi@qbCnb:d\8b^>]^CW[8]X@cbLwoV�xg�~nymWhgIpdLphOuoV{pQ~sS{rR}nM}gM{_BrS:�b?̡i��[��X��Jj`0rh3�w<ȞQ��8��Oūlʹs��[��;�vH~Z*�o-ήY��K�`*B?fg!ph�h6�u5��E��Z|d0 + .1! !! + $&.-%( &' + + + + + + + + '(%& + + %#%&) # + + + + + + + + + ". + + +((**,# !#& 04,1)-38BA"?B"LM(CI!3637.6/:!*$#+"+#+)/!!'%" "#! "#*)//)'!$"+,9:"GJ$\_3KP(2:(."(!9:"MP-;A"2:=@#>=$56!(-(.;>(88-359697: 8=&AA#79&.3,/!(+#%)+/!/2":7#E?*PI+OJ*PK-JH+LF-XC1kK=�{i����������ɷ�Ī�IJ�����������yo]_Ef\8rkCxO�{P�|M|vNolIZZCNN7CG1KQ8VV@^[BbaAmc?kc<YT9XW5UV7VR9YT<f\LokT�~f�|^vmZiaK^[CjaJlhNoiMulHpjKuiMrd@oX7lS>kU3�}G��RѠU��G��C��G��S��c��R¦_��]��b��@��>�i;tV�c#�p({`!j\'k],�u;��Av*�n*�o/�u7�|9 + $ $&2,10 .2"% + +!% + + + + + "--@;+ + +&( # + + + +() + + + + + + + !&.%% ./-15=8> ,1$*:<DC!HJ*AC!<>*5'0)&'"$ &%!"""%"&$"!((&)36ZU-MN)KM(8A#6;$DE&[_5WZ.SS-NL+RO079!&+ &CA)8; 659<#>>!GF&C@%D?'78&35/2 21"$)%()20C=&QH,eO.`T-_S-ZM,RE+RE8bF0�ra�����������̷�����������������stiOPF^U1oiCtM�}S�uNzuQfcHVR@OM:FG4IK8RR=XX=da@lf:b\8[V7ZV5VU2VL5UK5^XAokPwoP{v[voYh^GZRE\[GgZHlaEjeAhbGoa:j^9eQ/_O2\O3�d8��W̚X��S��^��l��pȬoǔR��T��U��O��?��]�vB~m(�j(��:��>��G��G��C��<zk)�t9�n'��S��J + + + + >8 !$ "! + + + !! '' + + + + + + + + + + + + + + + + + -0%, + + %"0489<A.7"/4/0.2>;EH ;? 46,2&/(#,5 .7#+!$&%"$!!"!((::TR,TN2II&VZ+@H'IK'!&26JO#UV,PS-BA%IM'=?$02%26#9<$JH';;!>?$ED&<<'C:)86%44!6598!01$++()--KA-cR1pZ0o\1n\0aP,ZM/UK5VK9j\M��������ȱ����~��������}�}u�wiij\JJ9TJ4i\>|oI�|V�wWvoKd\HUQ=CE1FH6KH4PO7UXBc_;fc>g^:b_2YY2WR5WK0TM2[TAoZGvoLzrUpiM`[@VR>WRBcZBaYBa`Bb[7c\9aX9\Q3RH/MG/�j4ĜF��E�k5�|8��M��=Ũ]��P��V��VĢ\��K��V��L~t7cU�y;��H�y,��R��QJ@�o0�o2��=��Y��T + + + ++-(& +)'"! " !!' + + ++& + + + + + + + + + + + + + + + + + + + + + + + '05 +(&*+*+(-#,39@>>;<:EH'57+/(-16&%)&)2!"*/*.#' %%#!#%#'#&%,.[X1NP+VS)VS+JJ#KN+7:25?E HG"ST,AD$59%.5(,!%)/=?"HG)?< <:$GC,>9(?8$:6 46 95$66$:331./54OB)jR3qW6{]0qZ2hW0_R6ZN>TJ<ZO?hZĮ������ycgWUYDedQwzhZ\TabV>B8==(QG0eQ8ocGodIqgEp_E]V>QI<FC4DB0HH2RR@WV@`^Ce^8h_<ZX4OO3MJ1QH1RG4VP=ZR@naJrhLa[FYS2SK5RM5XT?_Z<\W9^W3[U9\S7WP*PF)HA"p\6��A�c*q`4x=gd*�q0��>Ʈ\��R��M��A�s+�g$��?��5��P��H��C�r*ΫZսp�r)�{<�h.�m4�y/�w-% + + + + +"%)!+ -'2% + + $ + + &1$ + + + + + + + + "." + + $(" " %,),%& !>?:; .4&/%1(,9944EB342368#',<;$28,.#(% !#&(**$ +)-,+))+! %$ (+64MH,YW.VT.US/ED&DE#EFAC&JG%CG#6;,02715.47<A? CB%EB"B@%7485"<363!?6"74#53"4054"C9)SE-gQ1kS3pX6t[<n[8dUDPI7ME.OG5c[Kyi`�rfeZMCK2FM;gm^MW>RUEOR:26*14!B:%UM3hT:mb>p]EcTDUK7PE9KB7GB2IG4TH6VR9]YAb\:XW9ZU1QI+RM0PF2M@/PH8VQ:_YA`[?]R9QM:OH0OJ7WQ6XQ7XT2XV6[W2YS0WO-KD&VH(��Q��X�y=�j>�}K�6vY!�w@ڷo��A�s<�s9��<��F��B��Iϭm��U�z3��N��2ȞJ�uƞZ�n,��E��Ck_& + & + + + + + + + + + + + "%! + + + + + + + &'&*1<<,-24 MD$HM$<C&<D"14',,165ON(0634== $-11&+$-#')"'!"$ -)/,$#*(GE&TN/VQ.QI(OO+YW*MK'GJ"QS(FG!4<:@$BH,@A#@E$GA&G?$E?+B='65#65<464930.:05.:7)J=$WB-hN4aK:gP3oW=gWA_T@ME3D=-I>,OG7^YEvo`MJ4BE0DK:TYDDQ;BH2>D//7&13!33!D:,WL7^V?aU:RJ7LD3KA5E?6E>.HF5NH1PL7VS=[U:ZV5VS.OP2JH/J=.KD1H?2MG0SO?XP8RN:IA0IA3KA6KG1NK7PM2VP8XS2WJ,RH,F>(`R.��I�j0ŖW��`��Y��M�d+�{8��G�|3��?�t>�i3�i,��U��[��\��D��U��T��8��OŒ\��K�x5ȠK��I��@ + + + + + + ! + + +! + %( + + + + + % + ! ),% + + + (*$ 5541 @7KD#CE"JD%;<!=<:8=>#GC":7 32/."&)%'$&%,#%*"(#*$###"/,(("# "#NG)B@*<9:< QM,]K*WJ/f^5GI'88?B#NQ-ZT+VM+MH(@;'D>$C<!;6"31612/83 620/1/!D7#L>*V?,`E2\C3ZK;dW:bV:PI5D</=3)G=*D>,A=,43$17&6:'69);B)8D/<C,8B+(4)0!+183$K;+NA3QC/OA4I8.?92HA6A;/C>/HE:RK=OL8VO6]X7QI/IE)FC,@;-F@1J>.H@+OH2SL6MJ6JB-CA2B;,LE1LF0OL,OL5PK,PH/MF*G?'MB+vW/�qD��h��`¡a��M�_+�y<��A��U��J��>pU,�j:��r��a��Hhj2�Awf0��aںv�|6�~F��P��P��G��: + + + + + + + + + +#! + + + + !$#$$' + + ! + " + -/460/&) + +###&)' +<+NB%NJ'JJ'J@";8OI*OJ)?A 57,.+''*)+!#&$***+.0") %## &! #"67((%'('?1V<*R8"aR3VN2IH%JG*TO.YL*SD%ED'D:&C>%:7533.+(.,:39.1-9.K9'P<'O7*Q;-XD1QE6PE3SG1D8&72(83"=4%>6)77%/53415/4%DA0DG3;@(5="&1#,''(70"=4&>4/84+<51;4,C8.?<0?9.J>1K@3JD0PJ2QM2MJ3BB)B>+B8'D9,=5*@:-G>.IC2@?.>8'<8,A;,GB.B@/FH2PR>LK0NG,J?%E=(GB3tlB��P��W��I��7��=�f6��K��U��U�{9�~>r^8��F��>sv6�vE��`��U��KЬe��O��L��T��L��M��DbT + %!+) ! + + + + + + '& +$ ! + + + + +! +! + ! +"")4655-.//#' + "" + #%(*5625&)9643 $ ;7MF#NG(NG+E>!OC&JC!>@@< 76A:97!34!1/ 1.42,, '%!!&'*%! !# %&!(&53%$'$.*7)B(N-[?*]K4WN2KC(=;(:7?4"93"D7"EB'@9 8.:2.+&'*(+'/)>2S>,N:-L;)O<&L>/C;)C8(<2$=4 91$0(60#94$:8.1.0*1$.IH6KK4=B,05"&0"-'(1/&2)0$* * 5-'84+?6,=5)C;,F?.B9,A8*GD/LF-@;+A<':8,@7-:7(<3'=5*75%35)94%63,<6+=;5DA3BA.JH6HF-GE%DB&E?'BB,RK+~h<ug=�d-�d#ȣ>��M��?pT(\Z;vyD��N��\˓Z�i>29!��V��V��YʼnGϞZ��P��J��B��X��P��B��B + + &# (' + +E6($ +# + + <+ + + + + +"& +%&* (* + !$ !+ $ ! +!+/55+.10,.(* +#% $ +"$07*-03.3("! (& + $"C>LC"EA$FE!LFD=9892<8B@ ?8 88 ?6938944%%!")($#%($&-, *$(%$# !%% $"$'&.).*2,/+" %#!( >$X4W6!P>,ND$>=#2.54<2$G;$RF*UD-I<&=4"751,%&% (70%F6&D5&:3)B6)C4%7/3(6,6,!.)) * 30"36(,(*'+%@A.EC25=%*3%/&1($*+ -' *& 1.!42)4-!31)94'85";9':7+>9(33"73#73&45,12'52(3-3/$01%/-64%2/#54+;:&>@-BA/FA)HC*IF8>>+=9-B<-IE5SI/s;�~@��N��g�k@��ErhHrgD��M��M�zM�o9hX,��[��O��S�q>�i;�x<��]МP�~&�b%��[��l + + +>-/#! +# + + + !! + & & + + +# + %(.0//'',-.2$(#%() # # $ ('.'(*$#$)-TC&NE%KG"LJ%@=$:97665:87787513/+.,-%& &,*,-($!+(.(%%!)*##6180,*/- 0''"!3'B)G(!I+I3 H7"JF%@@"<=&97D<#MA*UE)P@'G7$I9)=3 .,5..'5-#0'2+50%6.7+6/$0(&##!+%"!,+23 ',&))) ,27;%-5&.'$.$.'!(#( !".)#0/'.,&10%21(0, 51*53+32&00%/*"1)12(00&1. -.".0%/-#)' *-&/* 43*25*:8*89(=:%FA%@;+EH<E@.?3'97&bV:��F�[��F��v�|K��R�uH��J��E�{6��M��K��2��B��N��O�o>�x8�v>١f��Y�|/�c(��T��= + + + ! + +, 2$ 0$ *' +, ! + + + +#% ! ,! + + &($$ ,2!&##& (# "'"""#("'$+ &" T?$eG%\J#NH(>9868/?<22#".) $()- %'"$#,,&%## %#'%&%%% ""$"!&),):-502,0($ 5'F+J2A)<%A) 5!A4)LA)ID)CA*B@'H>%G<)N>%L9!K:G>%H8"=-D4*"+"-),&+ (' #$!!!,2'+&)$)#$+18*4+*"-)3!",&&'�*3. 0-$-+"()")%*("-+#+( ("(&!/2",."'+&(*&(*&#!)$ +$12+/1&23$22%84=:"=6!>8(?;+=7&33!��a۞evR&�j/�>��O�z4��G��S��o��eDZb��X��O��C�v6�}S��[��C�}7ŋM��W�n3�d$�k%��6 + + + + + + +# + + *1" 1%'* 4"#**"* 0*&' + + + + + + + + +). </00&%$##!'(#$6&9/$" %!V6_4V?$JA">8?;43;8 @;"841-'(2373&(!$ #'+-+*'(&"!%$'&#!*$&!" ('..,-211.('+(616+1)3. 7&H.!<( B(;/$C3)?2%H9,F:&;:)88$48#=7$B9M>$J@'MA)H9"E5#3(.!* )& "*.&+$(&%,'1)2$0(!+&2%/)'"!++%((((%') ! !#!$""$% )) (+!&(# !#&!!#!#'$'($*+&.10/311924;2@IDBG@HHBB>3EF?HKL<=8_SB�b?�vW~nR�}L��Eɥf��Q��I��N��Q��J��]��M��K��O��O��^��P�~5��H��H��M�x>�})ĩI + + + + + + + + + + + + + +% + ,A,>,1"& ' 6$+ * 7&2'9153 + + + + # + )- + + +"&$"(6)))$%! + .!* &"22N&\+T0ZD$F?!A85010=9911+)("!;2H?):5%71*+-,.,0*;.6.-**&,"4*,%#($'(54:9#56 ;1G;(0,<181=4"?5:18.2*"E7);-!6/%B6*>7-04'<4*>7'95 32-/5:"=7@3J8M=+<3*!! !)',!")"$1%0#-'3!')(2#-!'&"")#!&!% # %!% "!!&%(-+)+,&'-4;M1:C6=<FPXBNa>HWCLLIPVOT\WcpFLNZXVzgiɚp��XrwP��Yڶj��b��h��`��`��5��<�{;�<�{6��U��C��E��JfBvQ+uQ'�w8��J> + + + + + + + + + + + # + ?'J2=)0!#3#.('*")/#+( + && + + ! $)"# + + + $ '+#( %#!! '&,$#" $O.f4d8`>([F(TAC<51:2@5!0-,'+)90M?+;7 <03/3.!3.1*:.8- A4$@5#84$>15/":74390D<$E<%H=&E8L<'D7!J6#A6 <3!?13/6."12 =;*4. 1*".* ,-&+)#53A68000;=$A9:4802-/,""%+!' '/ )4&-)"+$'1$-# ,#$&+&$%)#('$'%!(,"'$&/3&+/'.8'.59@K:DR;BN=LXKZgGUfM\lM[oM\tdp�zn^��p���Ǧq��d�}Yկcƥ_��R��\��R��<��3�~/�};�|K�tB�qE�v>��Eyp@�b?�tJfY7�lE��q��� + + + + +# + + 53**& # & %$% )$ '! ((# !# + +(* '*&) + + + #"&%+4/1)*& ,#5'$'!B-d6#a5"e9j9l>*]<%ZE'RB&E: E7 B2>41/*&4. <;"91:14)9,)!+#,"2$=08/:04(4+C8!=2L=*RF#OF)LA&M<(I< D<%K:N<%D7"++ '++,+'*)"46"?<76 <6 ;9&,+)#! ! # + #)&*%#$+(2%,#-)&#,'1'$#!$&#& #$"&$$ !#)0@$)5-3;?Mb09BCQdPf~HUc9DMATofmyrt~��g�qұd��S͠e��Tɢ_ʫc��K��=��:��?�|=�g)��W��Qͥ]�wS{T$ÛP�yL��mֵl��zhnj]dccr + + + + + + + +)( +$ + =82:?:5214*41) -* (%(*!*"! ,! "/0! ))73"! ''*& + + + + + ' (& J)@,0/)/#*(;-X4 ^2h7X)j9#j:j:%j9g>!cC.R;K:M>F9!B7!"$#"%%' #'*+ )' )!3+40!F=!><%C?#=?%C?"C8MC*RI'NC%A7&++)$ ""%!)*/,#$%%)*488; :6!.. ""!##!!$' (&%!*(0$-#-& ()%.!)%#!&(#%$!"! "##" *16(,*)3D(4E4CX0>P;RaJ\p>O]MYpnvw��i��j��r̰qʥaԵtşW��K��]��YL��BĕWkk5\K-�o2����`�y?��D��I}n4�|j���ʯiȩp��[�nGueQ +! + + +!%# % ,1558BEFCC@88<:77+ 1239"4(/$#! !) 1#$ '$! + + ($)' + "& # 'E*A0!?3"A2!@)O-X-V-a6']1^3!X2^1Y.^5U5G2B5UM$E>46 +&"%&#&*&,$-&, -)0+9875!229A6<36<4!D>&32!)*,+$ %$)+$% $'1++)'/",.32367/0((%(&("%"##! %""$&$-"+$,$)"(%0&#%& &&"* (%# ! !&&!$"$'"$".>%))4C2>L;Lh8F\8CMFZpOh�Zo���v��pȟc��ZǶwŬmqȣUĨTÙP��6��P��<֨X�QY[acadolj��q�w@�D��Fzp4ɽ���f��E�x:��G�i$�^2 ) +-% 1--&+! + .+'# +#($')+37;;<EDB?@B5>!36</3;";#7'/$.#6*8,-( 7&;*) 4&%% " +"&")"(.&'$-,!#& + +! &4.&42*3(8 @$C!H)O(N(H%F%D N0A5)'B9JC @;33!*$,#)")"'%)!('!+"**.$,2):4 ./$%&-1 37 &)"&! !#<7+86,**.*/.!&'"& &!$)(%%/%0'/120.*,))(%"$$## #% &#!&% ! ''&-(,&'%% $) (%- '!%!!" #"'"'"$&1&/>,7H+4=0>T;H^I]|Ec�Um�Vo�q{u��r��s��d³mζtĒQ�z2ÓGաP��I��A��FĖJ��U��f�����o��R�t.��P�sGquA��A�|0}g*yz)xg4�]-�s; !$ ("3,;-9) *$&!,&,)*! + + ! +"'.1,64?F&C>EDDBFA74.0 =9<"D)E+B'J,H,?K*Z7I2I3*$&!%% +# (&%%%#" '' )%%"* + + "% +#)6"1+D#@+:$J7B>$*88K@A;53,)$'%)'!)!%!#% %%) (3%(!31 0+!#$()',$(1/#') B</D?282$1--,(($'(+08!#*).$(',*/&&!!%(#%%" %&&%$"#"*(-& &%$&& &#! !!%#!% # $&'0A2Ed9Jh9Hc6E[?NdOe�B\v>QiTo�[u������~nҵfԹiʫab��?D��T��J��S�|?��IáG��y��`��_��>��W��^��a�y<��ib3lc(��Qݪd×U + + + ++!6)-$*!)#,"( $*&' *.+56B":>4D"FEDCDF?8<9=45:= ;EQ,L(U)`7H3?+/ 1!, ( -0')( " #)()*"! + '."- + + + + + %) -(C/H> '(0QF<5'*#$$&&0#(1.$%'%%') #/()*"%$$*()$#75,'$*(+&72*@9/31&#$"%!12!08$)0,0')*,.,**'' &('*'$$%"""%#&%%"## $ "")%+)',4'2C>Pq>RrEVuFWuFTjKa�Lf�Ql�Kf�[w�]x������idz�Ķsүc�zCzZ+��R��T��lӮqϨY�|9��^���p`�xW��[��b��R�|3��:ğh��_̛f��GÊI̕X��P +'# +& & %) +2!/-629240=3E I"F D?F!FI=DE=B@=:;@BG!KO,P/3!6 1/. .'0)./% )1- /2 % + +#!+((*$% $!"-$/).'PC(ME$;7UG;/ $%.&$(')50,%%#( ! *+"%$"&" ++#2.#$#<92+-#" 98'49#14&22 0/.1-.-/$(#( " 0) &$$ $! & !&"#!$ &"'*4)4D,8N8Hf<NmEXxPg�EYwRe�[v�d��Wr�q�����n��~�����˲}��K��:wn*m]%�{;��f�V�}@ΡR��C��Ns}^m���~��T��v�����eřM̓I��VͦsѡK�s?�{>��A "! + + + #!)))**-0-15<75598;"GFC"DBDDE#CEACDB<?G"G$I!V,<$I*=(5#8)0.,$.&$* 0!61+62 %&.$+! ! $*"*# !/&*)5"QD&YI%YI(K>'("'"%(*/%-"( ()%'!(' !$"..'#&# +.0364)45&41.0)+)."%$" !#)(!&%%*!" &%'3#.=.<S:MlGZyK_�I^�a|�a}�[u�g��c{�������������qϞnٗS��:��8�v2��T��c����tW�~c��E�~4�q-~}b�������p��8�~G¦s�xA�x-�r/��S�p>D6�m(�[) + + + + +( (*).10 -2054;/6<4=><F"GBJG G'DG!K$CCBD#F F%E&F$J%R)G+H*@.1)/*,()$($-))$)!.$851431#-#-&/#1,$-## ""#*',(,'*!$))'#/1"M:aF$QH&(,#" )(*'('#$!&("$$!#2.*+'!#&%!$! (*-1#+/%%$#'$ "'"%%% #%% !! %-+;6$*!&$( # ! #&.)5%/B2?WOd�Qi�Qh�\t�l��m��i��o��f�������������d��VƐ^�;ę@��5�k��U�|l��m��j�����S�o+}i=�~m��a��f�����_��T�������V|dA�i4|ng�{Q�RtT& #' ' '+(-*+-.,- 54718<; D"C>@BC C!BE E!E DE#CE"G"K"I!D&<+,*+*+)+(*'5,0$1&9(="<9:75=1/5(+ $ ),'"$(%, +") )'+(2$:,+%"#(#"$ "1-"&&-/'#" !#$$)"%,*.,""$(&! &&"**,+22!!& %!"( #!#"!#$ & *9!,=,;S@SvNe�^w�h��n��l��l��t��|�Ȋ�Ǜ�������������q��cŕT��G̟Q��G��a��o��������R��P��P�x=��k��l��g��S��M�{>�z:��w�����^��O�~Zzy|fT4YI*hY( + + + ! + ! +#"+.(%*,!)4*#8,"2'4&B"?9A>CE E"DGK!G$D C K#I G!CA(<.//0+2*;*C'D#@*91568519537"7)! * )()% '&+%,'&&+% #" + + + ! --!%'!%+* %(&+,( +."$*"&%#:/30#(%!&%!#*%/)0!3222!00')#" !#%!&#"%% !"%!# # %")"+$/%#1#*<"-@5FbLg�a�i��r��}��x�̀��}��~�҅�ը��ڠTqƤ�§�ư������l��H��T��Q�����k��h��p��e��a��P�C��V��S��L�2gf2USmj3����|Cwk���{uOjgSRL&VV5z|O + + + + + %' +"$% &#.* /"6;%7( >!FM&DGL#DJS"G$AE!GL#C!87+1%:$C$I(F#CF!56955*/214$:0%-&0-#$(%!# "$())+)))+%%"# + + %!" 2. !($!$!+-*-+# "!'# "'$'*&%*(#&&!(/0 ')$'!&#) #$&(! $$#$ "$!*$*#(%#,'4F.>U#)2D6Hf1>X<StRm�c�k��r����w���Ђ�́�у�Ԁ�ч��Ǯ����Ğtʡ^ʲn��}��[��X��U��r��Q{~=�|?wr5��U���ҳvğ\�f.�q(��`mi.{a����l��t[P"�}N��`P8n[!H594{i' + + + + + + + + + + + ! !"$ " ")-#2!4$A*@$@@!@"BDI!GGOK#H%A$B+E,F/"M+C"G*=*G0"?0"=)"A&?* 9+"7*!3,#5*2' .'5-".&,%.)! !(,/)-+ ! "# (# &"#( !%"&!,1/*,$''%#!!'$% %%%*"% !($(&$%!# &!! #%'$% !" "((,/?N*4F%,;6Hd:Kf5Gc@OlPl�>RrEY}\y�[x�q��|��}�τ�م�և�Ј��~�׆��ّ����{ԛ]ȗ_�}X��J��O�>�u5K��L�o(jY*wf.��L�}H��X��T�e:�zg��8�|\psT��j�����v۽���r�pF��P^M!$\L ��G��A + + + + + + + + + + ## + + ## #( ,2'1-5!5$A1$=-@*E#I(J+H+I0 E%M4#WA.K1B'>(B6*?7)F8%<.<*A3$=4&4-!5&0".1#+#-".***$$#$$$ $-(.())&# &#$ $" ! &###'!$$!%'!"(*0(*')$)%'"%+""#"""'' ##"!$ $" "# ,8B:MeCVuI`�;PrJ`�`y�^z�Ys�Wo�i��i��n��w�̅�څ�փ��׀�ԃ���Ԃ�،�پ��Ϫw��wƟ������o�{B��O�s6�p-c&cW-Xet���פd٢^äjkjq\awo{���}��_�����mˣgŰz��H�s2�r7��Lee3xn2�q*��^��Z + + + + + + + + + + + + + + + + + # + & )(+* , ,!4(,"/ +5%;*9+7(8&:":)3%$08'9"70$6#+23. 1/+()+)(()()%&&&*# !$2$( 5' + /(/$# ("$)&#% + +%%##! )&!# !&*.%*!%!$%)*,-/ %) ' !#$!&!"$ $%$$#%!!"#"++(2; '."*7$*#/$,8'3E+6F*8MWs�h��c�g��l��l��j��p��q��q��v�ʃ�ׄ��~����ف�ւ�Ӄ��Մ�ր�آ��������Ĝp������~lY�v[�};` xd$WSw�����̘TϮk��v������u����e��Vèb��TЪj��~xo<�}1�v0��3��L��Q��N��u��f + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "($$* '(*+( % &'#$#)"'-$' '')&&&"()(&'( #'%*#% &)!,*")*'$$ '%"%+&#! " !$!!"$$ "&#!!!!*$)#'" %#'##&1.(+#*!&#'$" ! %) $,"'/'1?'1A8H`+7J0@Z1>V/;M)7N6HeH\�Ea�Pi�BY�Tl�x��v��t��t��u��|��x��~��z��z�ς�ԃ��~��~�Ӏ��~�Հ�Ҁ��}��}������}�ܚ���������������{{��R��X��J��MbgS{�ǁ�ء����������������������=�|.mi,zg$�w*��7��>|r:��[��`�}5�w;{{6��j + + + + + + + + + + + + + + + + + + + + + + + + +)## (!! % + + ""!#()" ! !'#!*'! & $"+*!#%%#%!"(++)-%)!%$*$($ 0,)'()&$! #&!!)!(#!",;N5He9Nm6JhFZ{Yu�Xs�Oe�Rf�]w�Nd�Vo�b}�b}�l��`}�`��m��~��~��}��{�Ҁ�Ӏ��~�Ղ�ւ��}�Հ��{�҄����{��}��~����|��{��~��~��z��~�ֹ��˳�������������Ȣg��O��o��{�zv���������ȷ����˹���S�yp��m��`��G�|.�q=��=�m�m(��F��^��F�g*kS!��K��Q + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +" + + + + + !# #")!(!& "#"+*-&" &%%(..+.*.$(&*!*'-"*!1'%%! !! "/$/?CX{Zx�e��n��v��u��y��v��{��r��v��v��o��f��o��w��}�Ӂ��|��x��x��y��y��z��}��z��x��y��|��v��x��x��{��|��w��z��|��z��y��}�э�ʙ��à���������â�����ڨ]��T�ynlgwlt���~ǥ�՟`��������o��c��i�s#�o2�x>��T��S��,~r(sY�t%��M�]"�g)��@��F��D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ,**(&(%"#")%'$%$)#+$**.!" .5Fa?SsQj�m��w��|��x��|��s��z��~��w��z��w��y��u��w��y��y��}��z��v��x��x��y��x��y��{��x��w��v��}��y��v��{��}��v��|��|��v��~��v��w�֠�������������������������g���������q�❞�������d~������j�yg�}K��A��Y��Z��x��Y{{*_Ye^$��E��;�x;�i&�w%��I��M + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +! "&"$ "$#'!#%((.#(!" &3 0A+Pl�d��x��|��v��|��u��w��y��t��v��s��x��u��w��}��v��t��x��v��v��x��w��v��y��u��w��y��t��t��w��x��u��x��t��v��y��t��t��t��v��s��z�и����{��������|������r�ɐ��������w�˖����z��W��e��������m�����U��W��b��Z��H�u+nn)�r-��1qQ#F(�o4lK">$ +��M��X + + + + + + + + + + + + + + + + + + + + + + + + + + + +! +#"!"""'" ):=V|<Tv5JhC[�o��z��}��v��t��x��u��s��t��u��x��s��u��u��x��t��t��x��u��s��t��t��t��t��t��s��x��w��t��r��s��t��s��w��s��s��u��r��r��s��v��x��w�Ѵ��Ěq��������p��l���q��r�Ӕ�����m�Ъ��ȍ[��1sg4~��\oz�|I��{v�Y��U��O��B��@{l#��[��n�{#��@rW(��Y�oCO5/yvA��< + + + + + + + + + + + + + + + + + + + ! + + + 1Ed3GhF`�c��f��t��s��x��t��s��r��s��s��s��r��r��s��r��s��t��r��r��s��s��r��s��s��s��s��t��q��v��u��s��r��r��s��t��s��s��t��s��r��t��t��s��t��u��n�͌�������������c��X���o��m��p��t���~�����~P�Y(O[g[|�s��io\��o|�o��w��=��=��>vd�j.xa-��7��H��T��>��Mh��h��6 + + + + + + + + + + " " $#'&!#$%!% "% # !&#%* (& + '5J_z�m��r��u��r��v��s��p��o��r��r��q��o��t��p��t��r��r��r��r��r��o��r��r��k��o��q��s��o��m��p��q��m��p��s��o��r��q��o��r��q��n��q��m��l��s��q��p��r��u��p��t�ƥ�����������uy�o��p��u��|��q�ʟ�����}������������Z��������Kua-�x,�^�Q�y;Ũd�y3��1�4��8��B��s�}J + + + + + + + + + + " "!$%%$! "!&!*%$$"!) !($,""($#* %,$)-#'2#(/%-7")2 &- $(!( "(#"("", %") (! "#!#('+7#*8'-6)6 #(##(! !! + + + + + F^�i��u��x��s��u��n��r��r��q��s��n��p��n��k��m��k��n��e��l��p��m��k��k��i��j��h��h��l��k��l��e��i��h��g��j��l��h��j��g��h��k��j��p��o��f��g��m��j��h��m��q��i��n�ҋ����������\���l��k��n��k��k��p�Ɋ����k��`��f���u�������n~�mRR?:9&jQ&�s<vg@�o1aQ �|.me1ujK��f��O��K + + + + + + + + $ %"%!!%&'( **&%!#$!*%- '2, '-(#-"+',#+3%(6%+:),5&0@+29+-8'-7'/=+28&.7'.8&,2$+9#0!$*'*,"'-'*0$+:(--'0$/"%)#/=#*;(*6%)2",6& )$! ! + + + + +,F_�n��s��o��n��s��n��n��n��n��n��l��l��o��g��l��h��m��k��h��i��k��f��f��h��i��h��k��e��h��h��i��j��f��m��l��i��k��g��g��d��k��h��e��j��e��n��j��j��h��g��j��m��h��k��h��e��|��������j��g��j��h��c��f�ƅ����p��]��r��}�����t��h��~_cI%+7@B^clDFMIBTX)KD%5<0��b��Eː1��K + + + + + + + + + + $&%$%&$%)'('."/#.- ($0&-%-!&7 '1 %1 &4!&3"-@)07'1@(/5%-=+18-5@.6>,0:*0?-19.5?+2>+2B*05)/6'.:&/8.5;*.9.14*3@+4<)-7(0@%+;)4E*2@&-5!*7#/@ )%!+ *(& " + + + + + + + + + + +>Wr�r��p��l��t��m��t��n��n��j��h��n��i��l��j��i��h��f��h��f��f��i��`��l��f��e��j��h��h��c��d��c��h��c��c��f��d��h��a��c��i��a��b��g��e��g��f��g��a��f��i��c��e��f��c��k��h��h��h��_��a��h��h��f��e��~�����ѷ���©}˧]ɭi��X�z>��_ɥ�|mVSI)78.;<.MVdD;/45'(�y\��`�q-uQ&lsi + + + + + $#%%%%.#1!/)!.#1%3&5"/'8%3$4"/".!)4!)/(7&0>$0?&+8',:&0@&/=%/C&1E,6F-9J-3?-6G-8G-6E.9H,4F+7M,6C,4D*5E(1?*0>,5C)1A+3A+4I.9G.5:+2F.9J(3F-6B,2A")=#*9&/:&/$/$-", *'$ !! + + +!-)< +<Pmo��l��m��s��n��k��j��n��m��j��j��n��j��l��l��l��h��g��g��d��i��h��e��g��e��e��`��f��b��g��f��h��d��_��d��`��`��e��f��a��a��_��^��e��f��d��d��e��i��a��c��b��f��`��g��d��g��h��e��`��e��e��b��b��a�ƪ��˔\Ȓc��kw����}��i��[{rN��c��o�yLeN2DHP4>LBKWhoyHDBG3��dysD��8��FxsJ + + + + + + + + + + $+'(*/!-&:#8%2'8 *$5 *;'6%4&8'5)3'3'8(<",<':*3@&/B*4D)3G)6K-8G+2C+5G'4P-8J.7C,7H+9R-7G,8M,8I39H.8G-9K,5I,2D-3<,7M-5A-6@,9O.8I,8K.8J.7E-9N-6E.4;*5F$.>$+3$-%0#(#-)($ "$. + + + + + + + #->9MoBY~@X|=Rsf�l��j��l��j��p��k��j��l��l��f��h��h��h��b��i��i��c��c��a��_��e��b��b��c��c��e��_��e��a��_��c��b��`��d��d��c��`��]��b��_��_��^��^��^��b��_��`��^��c��^��b��^��`��`��_��^��b��_��a��]~�b��`��a��]��d��v���~e�k-ah6j��������Yl�b{����{zgzyZojr^v�l�h}�j{�^j�W[SwmL|hXwi=vb@rme + + + + + + + + + + + #"%%+ 4#4!5'=(9#1&3(4%2!)<!+9&5(8(9*:#1F"+7#->$0D );%/=,6F+4A(5F(6M+6F*8M'2E+7J-9J.8L,9N3:O29K09M/8H2:L.9N/9O-8H,5D+1D-7B.9N-8H.7E.7F09L19K5:K.8I+7L+3H-8I.9I)2@!)<#+:&3'0#+ )&! ' + + + + + + +'7R=On`x�j��e~�e��i��i��i��i��j��k��l��l��k��i��i��k��e��e��h��f��d��e��f��g��`��^��\��_��_��a��\��^��_��_��`��[��\��]~�]��\~�b��^��]��\��[~�_��[�[��\��]~�]��^��[�_��\��Y{�d��_��\��^��Z~�\��\�]}�^��]}�`��^��_��]�b��b�ė��x}`}�d��u��t��h��h��f��c~�w��������~��m��Pl�-4,Vhvpxip��Sc�VWeUj� + + + + + + + + !!'/++#6$5":'9&7)=&9':"*7(<);!.B",= +@!-B,>#*>$*:)4H%0F'1@*7L(5H*7L+6J-7E,7I.:R-9M-8M7;M-:P09N/:Q4<R4:O6:K4:N-9O,8J-7D.7H,8J49G,9N29J19K3:N3:L1:N,9Q3:O1:N,7I.9K'1F!)9"-A#.)6!) '''!"!$ + + + + + + + + + + + ("()9TF[~Wl�cy�i�i}�g~�h~�g}�f|�i��k��f|�g}�h�i��g~�j��e�e��`~�f��b��f��b�b��c��_��[~�`��\��Z�\��a��Z~�Z�X}�Y�]�[��Y�[}�_��Z}�Wx�[��Yz�^}�Xy�Y{�Y~�[��Y}�Y{�Y|�X{�[~�Z|�Z~�Y|�[�Z}�^��Y~�X|�^��Z~�Y|�\��^~�\~�^��`��^��Z|�]~�a��]��\�]�g��|�����m��h����ͤ{ŝyŢq���]��Wv�O\mh��d��d��[~�g�lx� + + + + + + + + + + + + !$$&&*"6#6&:&7)9!)8&@'?#-= &9$+<!.A"-?$3J!,?(5I+7H#.@'/A'2D)2F'1C)2E-8I-7F-7I*4L,9P+9N2:N19O4:O2:N7:L7=R6=R0;P5<Q-<V;;M0:Q08H4:L1:M29L1:N/:P1:O4:M0:O2:O9;L2;O4:N3:O,8J-9N+7N*3>#.B$0#-8%6*,''' + + + ""1#4OD]�`w�e|�i��i�i}�g|�c|�g|�g~�h|�h~�f{�i��g~�h��g�f}�f|�f��a|�f��e~�a{�`�a��]|�^��e��]|�]��\~�^��Y�Z~�Z��Z}�Z�Y}�Y|�]�Z~�[��]��[|�Y|�Xx�Xy�Xz�]�Yz�Y{�Y|�Y{�Y|�Wz�Wy�Y}�Y}�Y}�X|�X|�Y|�Y{�\��Z}�X{�X{�Y}�Wx�]�Z}�\�_}�]}�Ww�\}�Z}�c��]�^��Vz����������������υK��V�~�������|��d��h��b��c�q��a��]��]z� + + + + + + + + #&%(*'!20%;(:&?(A*? ,A'<(A!,@ +B .I .C$0F"1F".B*5F"0H*6M'4H#1F+8O,7F-4C)3G+6J+4I,:S+9Q4:N2:N.9O09O4:N9<N5>U7>S.;P8>O.<V8>O39N29O19N3=T4<O09N6:L0:O4;R1;Q1:O;@O=BP09N5:M-:Q,8N.7E&1B!/E'7",:$2#0%/(!0) + + + + + + + + + +%'9T2Il2Fg5GiH_�_w�dy�f{�i��g}�ez�i~�j{�cw�bx�ay�ey�by�cz�i{�f|�h~�h~�e�az�d}�f~�`|�`}�`{�`|�[z�\z�Zz�^�Xy�Xz�X{�W|�_��Yz�X{�Z~�]��X{�Y}�X|�Y|�Z~�Y}�Xz�Xz�Yz�Ww�Ww�Ww�Wx�Xz�Xy�Ww�Wx�Wx�Ww�Yz�X|�X{�Wy�Xz�Wx�Wy�Wx�Y|�Y{�Z}�Wx�X|�Y|�Wy�Wy�]~�[z�Yy�Z{�^z�Xx�[{�^��[}�Z}�|��k}����z��h~��}l��s�~r�r0��h���c�_~�]|�`|�ax�Wv�Vz�h�� + + + + + + !$&,/1!6"6(<(< +7"+=+G -C-A!+; +A".@!-A /J*=%3L#1F(5J(3D(4L%1G&4K*7N+:Q,9L'1D,7M,7N,9P+9P-9P+9P3:N/;P/<S4=X5>T2@S5?Q7<O-;T3?R/<Q1>P7?P1=T6BV7=R6;Q7AX-;R1=Q3<O0?S5<O0:O9?N/9O,9N,7J,7H$2G':$-;(;'8#5"/ .% + + + + + '9%4M-E, 0&9X%7R'7Q+@aGc�Ut�Sp�Ro�Zz�a~�d}�e|�dz�fz�`w�`x�dx�gy�^v�^x�ax�_y�bw�`y�e|�d{�e{�e{�cz�bz�_|�c~�^z�^{�^{�`�]z�]|�Zy�^{�Wy�X|�Vw�Z|�Xy�Wy�Y|�X{�X{�Wz�Wz�Xz�Xz�Xy�Ww�Ww�Ww�Wv�Xx�Uu�Ww�Wv�Wv�Xz�Ww�Xx�Ww�Ww�Ww�Wy�Wx�Ww�Ww�Ww�Wy�Wy�Wx�Wx�X{�Wy�Wx�X{�X|�Xy�Zy�Wy�Wx�\|�[z�Y{�Yz�[|�]}�`}�_|�d�^z�^~�a~�f{�c�`{�euulqyi��`~�^z�]~�\}�_�]z�Xx�_~� + + + + + + + %+(3#5%8$5)C':!-A+?+A"-C+B .F#1M ,B+@#-?"-@%1F,B%3H"1G(5N%->&1D(3H+5J+3G+9R,:Q,9P+9P2:N.9O+9O-:P/<R-<R0=V2@X3;Q.=V2>Q/<R-<X8@Q0<P3?R3>X5AX4BZ1?U8BQ-:P0<Q0>R0=S0=R1>S3>P2<S.:R-8J(6K!-B*:$.=*A)4"-#2#2&! !" +!,=RtTs�Xz�Je�@X�D]�E_�>Y�4P|Jj�Xx�Z{�\z�Xx�[y�Yx�[x�_z�_y�cx�bw�\s�by�av�bz�^z�^v�]u�_x�`v�cz�`x�_y�by�bz�a{�^z�`y�e{�c{�bz�`z�_y�_z�Yy�\{�Zw�]y�\y�X{�Xw�Ww�Vw�Wy�Ww�Wx�X{�Xy�Wx�Wx�Xw�Xx�Ww�Ut�Qq�Rs�Pp�Us�Us�Us�Wv�Wv�Vt�Ww�Ww�Ww�Ww�Vv�Ww�Ww�Ww�Vv�Ww�Wx�Xx�Ww�Ww�Wy�Ww�Wx�Xy�Wx�Wx�Xy�X{�Xz�Xy�Xw�]|�]|�_}�[z�b}�_y�a|�b�^|�^~�]|�a��c{�[z�Xx�Z}�Yz�Zx�Vy�Tu�Oi�Yy� + + + + + + + + + + $"*-3%:&<':,D.G-A-G!0I$1G$3M 0I)B"/B /D!/D/H-C .D 0G$0A$0E'4H$3K+6L*8P)7N*5G*7M,6G-8K,9Q.9P,9O29K.:P/:R3<P1?U1<R/<T4>R5<N3>R1?T/<T6=R3=R3@U3@Y,;T/>U1=P5@P+9R.<R/=R5=P2>S4@W/=W.:T.9M,9Q(3G#.B#+8 +>'7&6):#1)##$#! % + + + +&)6M$5 /EAX{Po�Vw�Xx�Ww�Yy�[|�Z{�Ts�Ww�Ut�Vu�Wv�Vu�Us�Xw�Vw�Yw�Zx�Yt�[u�Ys�]u�]r�\r�]u�`w�[t�^w�Ws�`x�av�_y�cw�Zt�\x�ay�_y�bv�`w�_v�_y�^w�]u�_u�Zv�^y�Zu�Xu�by�\v�Ut�Us�Vu�Tt�Vv�Vv�Vu�Wv�Rt�Uu�Ut�Rs�Rs�Tr�Ut�Rr�Jk�Us�Vt�Ss�Vv�Uu�Ut�Vu�Wv�Ww�Vv�Ts�Jm�Oo�Wu�Vv�Uu�Ww�Uu�Ss�Wv�Wv�Xx�Vu�Ww�Vu�Wv�Wx�Xx�Xz�Xx�[x�Xw�Zx�Zz�Zy�\y�]z�]y�\x�_y�[x�]y�Wx�[y�]y�Xy�Vu�Zy�\{�Tt�Hl�Kl�kro�b + + + + + + + + .M"7[1V3[,M-$(08#8+F+D.D%3L#0E"3N#3N&8Y'8T#3M 1K .F .B.F/E.C -? ->!/F#.B*7O%4J(4G+8N&5M+8M)5I*5F'4H,7I.9P,9P+9P-9P.:Q1=S0=U/;Q2>X1>T0>V2?W6?O6AZ/?Y/>Z0?V2AV.=W0;P4>S-<U.;P1<R4<P.=T;CS,;T0>T3?S4>Q29M*6G)4C$1F%2F$/C'6+>'6!0(7!+ * +",*&" %1D ."("1H4Hh7Mr.@[*):RWw�Xw�Vt�Us�Ur�Tq�Ts�Qq�Wv�Vu�Ur�Wu�Vu�Ur�Vt�Ur�Tr�Ww�Ur�Vs�Ys�Zs�Zq�Ys�Xr�Ys�Vs�Zs�Zr�[t�\s�Zu�^r�^v�]s�]s�_u�_u�]s�bt�\v�\t�^u�[t�at�]t�Zr�Zs�\r�Zr�Up�Yr�Tq�Uq�Ts�Tp�Tp�Tr�Sq�Pm�Tp�Sq�Rq�Pp�Vt�Pn�Qm�Kl�Om�Lm�Us�On�Qo�Lm�Qp�Tt�Qp�Rr�Rn�Qn�Jm�Ro�Uq�Mn�Tr�Wu�Us�Rq�Vu�Tt�Rs�Vt�Ts�Us�Us�Ur�Wu�Wu�Yx�_x�Yw�^x�Zw�^y�\y�`x�Zu�\v�]u�Us�\x�Zw�Wu�Ws�Us�Vt�Ww�Ut�`t���xzj_��q��g + + + + + + &;&;c*@h)=a%:_$8Y&;`#6V 5W/P,H.I 1M1P"3M"4R#4O$7W'6O%6S%7U&8V'7S'9X(8T%4N0L%2G$1D$1F"1H .C -@$3L&3G)6J)7N,9P,9O,:Q,:R-:P+9N2:O.9N+8N+9R1<S1?X3>R/;P3C\.?Z1@Y.;S/?[.=V4<O2?W,<X.:O/<S.;R2?V.<U2>S6?S2@U.=U4C\2?S1>V3@S1>R+9P,8N&4H%2F"0F&0> +8"/A ->"0%3(4%2!*#/"/%" $$5#3(:0FjDa�Kg�Mi�Wt�Hb�Kh�Lh�Rp�Po�So�Tp�Pq�Qo�Rq�Vu�Sq�Tq�Ss�Wu�Tq�Vu�Tr�Yv�Vr�Tq�Vs�Ur�Uq�Uq�Uq�Wq�Xr�Yq�Yq�[s�Xq�Yr�[u�Yq�bu�^t�[s�^u�^s�Zp�^s�^t�Zu�_s�]t�]t�\u�ds�cv�]q�]s�Wp�Ys�Wr�Sn�Tm�Sp�Qo�Rn�Rn�Mk�Mm�Ol�Sq�Ml�Jj�Nk�Pp�Vt�Mk�Km�On�Hl�Nn�Pn�Po�Ts�Po�Qn�On�Kh�Tp�Nn�Gi�Ml�Qn�Rq�Sn�Ml�Mm�Ij�Vt�On�Ro�Tt�Qp�Vs�Ur�Xw�Yx�]u�[w�[v�Zx�^w�Ys�_w�[v�\x�\u�\w�\v�Zv�]x�Ws�Yv�Xv�Vr�Us�Us�Pp�oy���h�v]usc�z| + + + + +#!0L.Ci.Di0Dd/Aa.@a);])<^*;W'8U$6S&8W%5N(9V$8T 3Q'9W&9X$:_'7Q$8Y(9Y)8R&8W)9W(;],;X$5R'6Q'6O#2I+@ -C!.H#0F+9Q+9P,9P,9P,9P,9N,9O,9N,9Q+9P-9Q29I,8K/=T2=Q,9Q.<S2?S/<V6@W0=U)9U,9Q.:P2>R,9Q2=P0=Q-;Q.=T0=U4?P0>T3=T/<S1?W2@Y/=V3A\0>T/<Q,9P&3E(4G#.B!-B!.?*>+<(6+=#/&3#1#1!-&& + + $%80Hi;V�5P|E\Pi�Ol�Pn�Pj�Ml�Lh�Pn�Pn�On�Om�Mk�Pp�Mm�Kk�Nn�Jl�Oo�Qn�Sp�Tr�Rn�Tp�Tp�Sp�Tp�Sm�Ur�Tp�So�Rn�Yq�Tn�Vp�Xn�Wo�\p�Wo�[r�Yr�\q�_r�^t�\p�_u�]s�Yp�Zs�Zs�]t�]t�]r�Yr�av�[o�_q�bs�Zr�Xo�Wo�Zq�Um�Xm�Qk�To�Tn�Pk�Nm�Nl�Pm�Lj�Mj�Kj�Li�Ok�Pk�Kj�Mk�Qm�Jh�Ii�Ki�Jk�Mk�Hg�Ef�Kh�Fd�Lf�Lj�Be�Ok�Lh�Ii�Jl�Ij�Nl�Ij�Rn�On�Oo�No�Qq�Uq�Ut�Ur�Vr�Vp�Xt�]u�\u�[u�^v�\s�\t�Zv�\v�]t�Yu�Xs�Ws�Wt�Sp�Ts�Ws�Vq�Yq�Sp�Tt�Zs�j��Ll�[q� + + !#3N/Dj1Eg2Ee0Dc2C`3Fg/A\/@\.>Z,=\-9P*;X(8T(9W%6R(8S%8T&:Z'7S%9Y(9W*:U*9U):X*<\):W&;`(:Z+:T):Y(;\'8T%3I'4I%4J&6O*8O(6N-:P,9P,9Q-8I,8L-8I.9P,9P,:Q-:Q.:O0;Q,9Q/=T2@W0=T/=S.=W.:S09P/=V1>S1@X.<S,9P-:Q.;Q-<V/>U.;R0>U5?T0@Z/>W.<T,;V2;S,9P,9P,8N*8M'3F#0H#.B",>!.>!->,?+<'6&4"/$.".#-( +#2(6L):S;RsKf�He�>Vw>TwOk�Pl�Lg�Jg�Mi�Gf�Pj�Pi�Nh�Ok�Ni�Ol�Mj�Ok�Qk�Kj�Mm�Nm�Pk�Sm�Ok�Rn�Tn�Rn�Sp�Sm�Sn�Rm�Rn�Yq�Tn�Sp�Rn�Yq�Xo�Vn�Sm�Vq�So�Vq�Zs�Uo�[s�Zp�\s�Yo�[q�Zs�Xq�Xq�^r�Vn�Yq�`q�]o�ar�_r�[p�Yo�Xn�[n�Xo�Ul�Sj�Pi�Sm�Sn�Lh�Nj�Oj�Ii�Lj�Ff�Ki�Ii�Mj�Nk�Kh�Lh�Jh�Ii�Li�Nk�Jf�Li�Gg�Kh�Hf�Gf�Hg�Kg�Lh�Ge�Pl�Lj�Df�Nm�Mi�Oo�Ml�Om�Pp�Oo�Wu�Us�Tq�Wt�Yv�\u�^s�[s�[s�`s�\q�\v�[u�\u�Zr�]u�Xp�Vu�\s�Vr�Ut�Up�Tp�Tm�Sp�Ur�Sp�Pm�Sp�s���� "3(9S/Ch3Gi6He4Ge1Hi2Db0Cb3C]/?Z/A_-<X->\+;Z+<Y'7S(;X*:T,=Y%8W%9X$7U':Z+:T+:U'8U&9Z)8S'8S&9Z'9Y):W%8X);](9Y'9W+;W(8U*7O+9O'5N(6N+9O,9P,9Q,9Q+9Q1:N09N-9P0=R-:Q.;S0<Q4AU+:R/=T.;R/;R4=R/<T-:O/<Q.=X,;V,9O,9P,9P.;Q.;Q3AT0>U2>Q/?W.<S3:P0<W,<T,9P,9Q-7I+5C'4H%2E'4J%3J"/D%0>"/>*8*=(5&8".'6#1" !0FOj�Rl�Rl�Sl�Rl�Sk�Qi�Qj�Ni�Pk�Kh�Li�Mh�Gd�Mg�Lh�Li�Ng�Oj�Mi�Jj�Nl�Ni�Ki�Ll�Ml�Pl�Rm�Oj�Pl�Ok�Rl�So�So�Sn�Rl�Rm�Tn�Yp�Vo�Rk�Pl�Wn�Tm�Tm�To�To�Vp�Sn�]r�Vo�Yp�Vq�Wo�\r�Yn�Zp�Wn�Wo�]o�^p�Zp�bu�ap�^q�\p�Vm�Wl�Ym�Ym�Pj�Qj�Qj�Pj�Mi�Qj�Oi�Qj�Ki�Hd�Jf�G_�Mg�Rm�Gc�Ni�Df�Mh�Fe�Hd�Lf�Ge�Fa�Jd�Db�If�Bc�Fd�Hg�Ij�Mi�Gg�Lk�Pj�Lh�Mi�Ml�Ll�Nk�Qq�Qp�Po�Tr�Vr�Wr�Yr�Wr�Ys�Ys�Zr�[t�`s�[v�^u�Yp�Xs�Zt�Pk�Wr�Wr�Tp�Vr�Wr�Tq�Tr�So�Qk�So�So�Nk�s��"-!+"1I0Eh5Ik1Ef4Hi5F_3Fe1C`5Ge1C`3Eb-=Y,<W,>],>^)9W(8S*:P'8U*=[':Y)9V#4O(8T+<[':Y(:W$7V'9X*:Y'7T(:W(9X*:X+;V);[*<[+;X*;Y)9V(7Q'5M+8O%4L+9P)8P,9P,9P,9P*9P0;S-:R+:T,9P+8P2?U1@Z.<U0>V.;Q,9O,:R+:R2=P.;Q-;S/<S,9P,9P,9P,9O.;Q,9P-;T/<R.:Q-;Q+9S-:R,:U.;Q+9Q,9Q,8N)6M)6L'6O$3L&3H!0E"1F!.=+@%1$5&7%4!/' + + + + );Nh�Vp�Rj�Qh�Pf�Rj�Rj�Rh�Pi�Le�Lf�Mg�Je�Ke�Pi�Oi�Mg�Lg�Kf�Lj�Kh�Ig�Ll�Be�Mj�Jg�Ql�Ig�Lh�Mk�Oj�Qn�Qj�Sm�Rk�Qj�Qk�Qk�Qj�Rk�Uk�Tm�Sl�Rm�Rn�Rl�Ml�Ro�Sn�Rl�Rm�Vo�Uo�Yn�Yp�Wm�Vn�Wn�[n�Wm�]q�\q�\n�Xm�cp�`o�[p�Xm�\n�Rj�Sk�Vl�Sj�Pj�Pj�Oh�Jf�Kg�Lh�If�Gc�Kf�Fb�Kh�E`�Gb�Je�Eb�Fc�Hd�E`�He�Ic�D^�E`�Gb�Fd�Ea�Eb�Ec�Gd�Ie�Fe�Fe�Hf�Ig�Gf�Ki�Hh�Ji�Nm�Op�Lk�Ur�So�Vs�Vr�Wp�\t�Wp�[q�Zv�[t�^r�\u�Xq�Zt�Wp�Up�Yq�Up�Uo�Xo�Ur�Yq�So�Sn�Sn�Sn�Qn�Uo�v|�7Km?Ld?Ml7Hf9Hc<Jf:Hf7Gc5Hg3Fd/Bc5E_4D^2BY1A],=])9V-=Y,<T)=Z):V->Z*9T*:W(9V)8Q(<\+<V(;Y)9R,>`*<]->]+=Z*=],=[-=Y-=Y+;[-=\*;X+:V+;Y);\*;X+9R+:T&6P+8P,8O,9O,9O*:U+:R,9Q,9O0;R,9R,:R,:S.;Q,:R.>[/>Z,8P+8P,:R/;N)7M'6O)7P,9P*:W.<S-:T0:S2A[3<Q-;R+9R,9P,9O+9Q+9S+8M*8Q,;T*8P,:Q)7L+6F#1E",<#.;+:(8$2&8"/% #7*A$1H/@^<SxGa�Ri�Xk�Yl�Yl�Th�Pe�Rd~Qg�Ld�Og�Pi�Le�Ph�Lf�Nf�Ph�Je�Kf�Nh�Ig�Hh�Li�Gg�Kf�Lh�Hg�Kk�Kg�Kh�Gg�Lf�Rl�Mi�Pj�Rl�Qk�Sn�Rl�Ql�Wl�Rj�Pj�Wm�Sk�Sl�Om�De�Ol�Sn�Rn�Tp�Un�Rl�Xo�[p�Zn�Wm�[m�\o�cr�Xl�Wm�\n�ao�`o�`p�Xm�]n�Yk�Sj�Wi�Qh�Si�Ri�Mf�Md�Jg�Ic�Ha�Hc�Je�Id�Jf�Gc�C_�Hb�Gc�Ic�Fd�Id�Gc�Kd�Ga�E`�Fc�Ec�A\�Fb�Ed�Fd�Fd�Eb�Ec�De�D`�Ji�Fh�Ol�Fh�Hg�Mm�Rn�Nl�Ts�Rl�Vp�Ws�Yq�Sp�^w�Vr�Yq�Vo�To�Zr�[q�Rm�Un�Uq�So�Ut�Tn�Sq�Tp�Un�Rl�Sn�Pk�Kk�`g~�y]�vZ;KhAMd>Lk@Le=Kh9Ga@Ld;Kg9G[6F\;I_6Hb2C`7F[3C^.?_,=Z0A]-<U):T1?W+=X/?Z,:T+;U+8P+>Z+<W+;T,;R+=^+;X,?`+;Y,@^-=Z*<\/A`.=U,<W/>X+;W)=`+<\,;X0?Y1@[.>X,=[-?],:T,9O,9N,9P,9P,9P,9P,9O,8N.<U->[.Ae,?_.<T(6O-9O+8N+8M!1K&4M$1E&8T)8R.<S/=W0;P.<S+9P,;T,9Q,9P+8O,9N/=S-=Z0B_3Ff.Cg5Ge1Cb):Y'5O$1F!/D'9'8&5$0 ) "% + +;OnMg�Ib�Md�Ri�Xm�Od�Pf�Sh�Tj�Ui�Rg�Qh�Qh�Pe�Qf�Qf�Th�Qi�Qg�Qi�Qg�Ld�Ng�Jd�Id�Ff�Jh�If�Ed�Lh�If�Ed�Jg�Id�Gd�He�Kg�Nh�Jf�Qj�Mg�Mg�Qk�Qk�Qj�Tm�Rk�Rl�Ql�Qj�Sl�Ql�Qi�Li�Pm�Ol�Tp�Ul�Wl�Sk�]n�Uk�\n�^o�Vl�bp�Yk�\l�_o�bp�Ym�Yl�[n�\i�Ui�Rf�Qh�Pg�Pf�Rg�Nd�Oe�Jf�I`�Ib�Ib�Ib�Gc�Fc�Jb�G_�G^�D^�Fb�C_�E`�Fb�C_�D_�D`�Fa�Fa�D]�D]�Fa�Ea�D^�Ga�D`�Fb�Kf�Hd�Hg�Gg�Kh�Qk�Ql�To�Ok�Rq�So�So�So�So�To�Qm�Xq�\t�Zr�Wl�Tm�Tn�Rn�Yr�Sl�Rl�Sl�Vn�Rl�Rl�Pj�Rl�Ql�Rk�Pl�Vk�vt��rk=Kc@M`BNc?Le<KdALa>Ke<Jf3Ec8DW8E]1AZ3AW5C[5E\3E_1@W1A\0@Y*;T0@Y0?X/?W+;Q,<T.=W.?Z)9U'9U.<V.?\,<X,=^,=Z0?W,?^->]->].=X1A[/Bc,=[0@]1AZ0@]2A[3AU/?[/?X,>`*<]);[,;U,9P+8O,9P-;R+;V0?Z2Ef+>a+>a-@b@Nh4Da*9V!/F .B+= /F#3L(8P(6N.;Q0>U/>V.:P.;Q+8O+9Q*8P'8T.?]6Ji6Km6Jk3Gj5Ij2Gj6Jl2Fi,:S"2M%1E-?&7):-?+?) " "3*?<PpTi�Si�Tf�Sg�Wj�Rf�Oe�Pd�Rg�Rg�Wg�Xh�Uc}Qe�Qd�Qf�Qf�Nc�Pf�Lc�Jb�Pg�Ri�Le�Ke�Ge�Gc�Ea�Gc�Da�Hc�Id�Gd�Ie�Hf�Kh�Hg�Je�Mg�Pi�Og�Ph�Qj�Qj�Qj�Qj�Rj�Qk�Pj�Pi�Qj�Pi�Sm�Mi�Pl�Rk�Qk�Ym�Ym�[n�Zm�Vl�Zm�_o�Wl�^p�\m�]m�]n�`n�bn�Yk�[k�Wi�Wh�Qd�Rg�O_�Ng�Nc�Jb�LbLe�I_�K`�H`�F\�Ga�Ee�Ic�Ga�F_�D_�H`�BZ�Og�Mf�C\�F^�C\�C]�E_�Gc�D^�C^�F`�E^�Ca�Ec�Id�Ca�Jg�Bb�Ee�Fe�Fh�Hh�Kk�Lj�Gg�Rm�Pm�Rn�Up�Zr�Rn�Sn�Sm�So�Uo�Sn�Rm�Tp�Rm�To�Rl�Ql�Rm�Rk�Qj�Pj�Rm�Lh�Qj�Qk�Oi���z��g?JdAK^=K_?Md=H_?K[9Hb<G`;F[:DZ8F]2?Y6E]6Fb3D_5F`3C\3AW0@X/AV1>S0=R.>W.<U/>V-;T.;Q):V*;X+;S0?Z,<W0?W.>Z.=V.A`/?Z/?X,=[/A^0@[4CZ2C]->Z1B`0?X/?Z.>Y.=W+<Y-?_.>\-Ae*;W'8S*;Z*=`,?b-Bg1Ei+@f+@f,@f2Eh/Ch-Bf"4Q!/D*= 1I 1K'6N#3L+8N*7N+8O*7N.;P+9Q(9V.Ac/Dh5Jl1Gl3Kt5Kn2Gj4Hk0Ei4Jo6Jj3Fh)<_,=[!1K(9,A#6T3Da$6Q,!0#6"3!1-?ZD\�Of�Pe�Qg�Tf�Rh�Rg�Re�RdOd�Ug�Rh�PaL`�K^O`�J`�Qc�Ne�Lc�Lc�K`�Ph�Pf�Ne�He�E`�A_�C`�Eb�Fa�Jf�B`�Ja�Kc�Ic�Gb�If�If�Lg�Ke�Ng�Pi�Pi�Rj�Qj�Qj�Rj�Sg�Oi�Rl�Oh�Qj�Oh�Oi�Nh�Mh�Mh�Rj�]o�Ul�Zm�[n�Wm�Wj�Yl�[l�Xk�[k�_l�Xl�[l�^m�Xi�[i�Se�Sh�SeOb�Qa}Pd�O`}H`�F_�I`�G]�F^�Kb�H]}D]�Ga�D^�E^�Da�D^�B[�B[�D]�Gb�@WzB[�H`�CZA\�B]�D[�A[�G_�A[�Ba�A_�D`�Ba�Cd�C^�Gf�<`�Ac�@c�Bc�Hg�Jg�Lj�Ih�Hh�Nk�So�Sm�Qj�Qj�Ql�Rm�Sl�Rl�Pn�Mk�Rn�To�Ol�Mj�Rm�Qi�Ki�Nj�Mh�Pj�Qi�Kf�Rj�jxwEMeBLg@Ld@M_DNb>JaAMc?Kc9D]3C`6Ed7C^9Ga;E\8E^9H^2C_1?X1@Y1>V.=V*9S+:U,<V.?Z/?Y/>Y+=[1AZ0@X2AY0?V,=X/A`2B]2C^.?^1@Z4CZ/>W3AV.>Y/?[+;W.>Y/@^.=W*9T%9Y(<]&:]-?_(<\%;_*Bg+Ae*>b(>e(=d+@e)>e(=d-Cg,Ag,Bh/Fj+Dk/Ei&;[.G!.B#2K):V-=\.?\/@\/@\3E`2Dc0Ce4Hk2Fi4Ik5Ko3Hn4Kr3Im2Jt6Kp4Im7Kl6Lp5Im4Kp1Dg0Df5Hf6Gd5He6Hg2Fh<PpDZ~La�CXxBXyPg�Sf�Ri�Sg�Yg�TdSf�Qf�Qa}We�Qc�Pb�S`}Od�Sd�P`�Te�T`yRd�La�L`�Lc�Na�Jb�Lc�Ic�D^�A]�Fb�Gc�E^�Id�Fb�Ia�Ha�Ib�G`�Kf�Ib�Nf�Ld�Nf�Ld�Og�Pg�Ti�Rh�Of�Mg�Oh�Nf�Pi�Oh�Qj�Og�Og�Oh�Qh�Qj�Ri�Th�Zn�`k�\k�[l�[l�[k�Yj�Xk�^m�]k�Wj�`l�Xh�Yj�Sg�Qd�Se�Re�Pd~K]}La�I]}I]{K`�H\}I]|Ka�EZzH`�F_�C_�Ia�C[�H_�BYB^�C[�I`�EZyC[�F^�B[�D^�AYD[�AZ�Eb�A[�Ea�Ea�@_�@`�Fd�@\�<^�?a�Ab�Ec�?`�<]�Ec�Cb�Gf�Hf�Mj�Ml�Ql�Rl�Qk�Rm�Kh�Kg�Pi�Qj�Jg�Jg�Nk�Qk�Hf�Oj�Pj�Mj�Qk�Nk�Pi�Oh�fw�izwcsj>K`EOb?Me=K_?J^@K^<H_:G]=EZ:G^>I_<G`9E]>I`=J`5F_1@X/@`1A[/?Y+:U.<V/=S0@V/>V0?X2@W0>U1B^1AZ5CX2B\2C\1B]/?\1B^2B^2B[/?X-<W.>Y*;Y,:S.=W-:R,;V-=Z)<Z(9U+;Y*;X&:]$:]*@e*@d%=c&>e"<f+Ag&=d)?e'@h(@g'>g'?f+Ck-Bh+Dl1Jo2Gj2Ec0Dc6Ij5Lr4Im1Hl5Ij/Ek3Ip4Ik5Jm2Gj3Hl3Ip2Iq4Il5Kq5Io7Lq6Jk4Il4Lr8Lo5Jn;Np=Sv<RuAVz@Tu@TuATuH\}H\|J]zUh�Vj�Sh�Zh�Zi�WfSeUh�XfRb{O^yQ`|Sb{Uc~Ta~Tb~Sa~Ve�Ra}Sc�Ob�Ma�F\�L_�L`�Ja�G_�C^�A]�@\�F`�G_�C[�E_�F_�G^�F^�F]�G`�Jc�H`�Me�Of�Mf�Nf�Nf�Jb�Mb�Pf�Oc�Od�Ob�Nc�Qe�Mh�Pe�Nc�Kd�Kc�Mc�Sf�Tf�Sf�Vg�We�XeTg�Ye~Ui�Th�Wg�[i�Yd~Yh�^h�Vf�Vh�Ud�SbQaRcK\xL\{J[{H[zI^HZwGZ|FXtI\xDZ�E\�DXwI]{BZ�H^�Fa�D[�AW{C[�BX|G\�@W}BZ�?X�AY�>W>W�@Z�@\�B^�?\�?]�@_�A_�?`�@_�@\�<]�9[�;Y�@\�:Z�=\�A`�:Z�>\�Da�Fd�Cb�If�Lg�Lf�Gb�Gb�Kf�Jg�Ni�Ge�Ni�Ig�Jh�Mi�Jg�Ii�Mi�Qj�Qi�Qj�Uj�SjtPdmEQfCNdBOcAJ_?Kh@GX7E_;H\=I[9GbCL\7Gb?I]?J]@L^5AW3AY3BY4D]1@X0@[4Ea6F]5CU3C]1@Z3AW8FY7FX5E[2@W3C]2BY2AZ2C^/?Z2B]0@Y,;S*:U,:R->[.<U/>V/=T*:X+<\*;U)9T%9Z&=^*=^&=a&?e%?f&?h(@g)@f(>e&?h*?g$=f'Ai$@l%>f-Dj+Ci(Ah)Cj+Fm,Hp3Jp/Ei1Hl1Fi.Fl1Fj/Dg/Di1Hm1Fi6Jm2Ho6Lv2Gk5Mt9Mr:Hl7Jm6Ik4Hj6Jl7Il=Rx:Os?Ru=Qq>SvCUt=Pr@RrG[yLaMa�Ue}Rd}Wh�Wf�Zg~Sd}Vd}Vc{Oa�Tc~Q^wO`�O_{Se�M_�N`�P`{P`~K^}M^|K^�H^�H^�F^�F]�Ja�@^�?[�?Z�>Z�A\�AZ�D_�@\�AZ�G`�G]�H`�Ja�Ka�Ja�L`�Ka�Pc�Te�Oe�Ob�Mc�Pc�Re�L_�Re�Sf�Kb�Nb�La�Lc�Qd�Nd�L`�Qc�Of�Uf�Ue�Sb�Ud�Qf�Vd�Wh�Uc}Vg�Xh�Rb�]g}Se�VdTcRa}Pb}M^Pb�O[vM[xJ\{GYyH[zHZxGYxGZ{I\yEZ}GYyBZ�H]|DZ{EZ|BY~CYzEZ}@Vz?VzCYCZ�DZ�?W<V�@Z�?X�>Z�>Y�=[�=Z�;Y�;\�<Z�=Z�;\�=\�>\�9W�9W�:X�9W�:X�;[�9Y�8W�9V�:Z�<[�D_�E`�F`�Jc�Fb�F`�Ic�Fb�Id�Fa�Hf�Gc�Jg�Ge�Hd�Nh�Qj�Rj�Qj�Pj�Qj�Nf�IRcFNdAMiGOfCNf;F[.@_@I^=H\9F`?J^@KbBMg<H_<Jc7E_:G]2B]0@Y3Ec3BX4E`4D_2@V7H`4BX4CX:H]5DY/?Z1@W/>V3BY2B[->\2C^0?X/>W,=W)9T,9P,;S.=V,;V+:U.=W+9T)=Y);Y+<W&;[+Aa*@c&=b#;d*Bh&>e#<e&?g'>e*@f(@f&?e%=e'?f(Ah*Ck+Dl+Af+Ag*Bi.Gn*Cj1In0Gl7Km3Hk2Gj0Df4Im4Kr7Mq6Ii5Jn4Jn4Im7Jk8Jl4Hj/Dh3Gi5Il7Jm4Jo6Ms:Mr9Qx>Qq?TzDVsDWvHZ{HZxO\wP_|Ra|Qa|Wf~YhXc�Yd}XdyRc~SazQ^zS]uPb~Qa~S\vP_~Qc�O^{N_~K]}J`�Kb�K`�B[�E^�E_�C`�A_�A]�A\�BZ�@Y�D\�AYF^�I_�Mb�Lc�I^�K`�I`�Lb�L`�Oa�Sb�Qb�O`�Oc�Pd�Qg�Ma�Ob�Pc�J`�Pf�L`�G_�Oc�Sg�P`�Qd�Pf�Q`�Qd�Qc�Rf�SbQg�Oc�Tc�Zf�Tf�\k�Yf�Sc~UdzTeSa{Rb}Pa{M]}K[wL]zK[uHXvHXtHWqI[yEZ{FXx@TtDVvG[~=Rw@VxBX|ATuF\�CY}H]�CY|@X�CX{BY~<U@W~B[�:T~>Y�<X�;Y�9W�;[�:Z�:Y�9W�9W�9W�9Y�9W�9W�9W�9W�:X�:Z�9X�:Z�9V�9W�;Y�@\�?]�:X�@\�Gb�C]�Gb�F_�Gb�Aa�Cc�Ha�Fc�Kh�Ib�Mg�Qk�Ri�Ri�Rj�Rj�Mg�FNbENgFMeFOc;Jf=Ie?K`CMbGMa<JdCI[=Jc>Kc<G_:F]7D]6D[2B[0>W5Gb=J^7G]5E[5F^3D\4BX3?R3C^6CY3CZ7F]4D]/?\6CX1AZ/>W.?Z2AW/<S*:U+<X,:Q.;S,:R+:V*9T1A\+=X&7R&9[+;[,@`,Di'<](?c*Ag$=e&?g&>e(@g*Bl'>d(?b%=d)Ck#;d)Ck+Bh4Il+Ch)Dk,Fm,Gp5Lq1Gl5Ij6Km/Gn.El3Im3Hk.Ci7Ms0Hn2Jq/Di3Gi2Gj/Eh5Ij3Jp4Ks6Hj8Ko9Os?Os?NrARr@QrGWuFVvFUrHZxL]{P`{P`�N_|T`zR`|Xe~S`{R\xR^vQ^wN`|M[xOa�N\tM^xK[zK\vL]zL]}L`�H\~G\�C\�BY~D[BZ�C]�>V|B]�E]�@\�F]�E_�EYyCZ~E\�G\�OaM_�M`�I`�Pd�PazRf�Sc�Oa�Ob�Ne�Ma�Of�Pa�Qa�Mc�Pb�Pa�K`�J`�Kb�Kc�Lc�Qc�Rd�Pb�Rb�Ma�Pc�S`zRc�Ra}Ue�\e�Xe�We�Yh�Ud�Yc{Sc}O_zPa�O_}O]yJ\xI[yIZvGYyFWuEVsCTpBUvGXv>Tu?RpFYyAVwCVtBVwCWsD[�@UwCX~CYAX@UyCZ�=U}>W�<W�:U�<Y�:X�<X�9W�9W�9V�9V�:Y�9W�9W�9W�9W�9W�9W�9W�9W�9V�:Y�:Y�9W�9W�9V�>Z�D^�>Z�@]�F_�A\�Fb�Hd�Ea�Hd�Hb�Hb�Ha�Ph�Me�Og�Rk�Qh�Rh�Pf�Rg�Oi�BK`EMaALbEM_EL^:HcBMbCMb?KgCKaBKa@Kh@L`=Jd8Ga:G_6C[1?Y1A^5C\>IY1A]5BV3C[7E\7E[5CX8CZ8DX4C_8E_2?W6DW2AZ4@[*9T,=[-=X/;R+;V*<Y+;T-<W-:R+:T-<U1?U(7O,<S+=_,=^-?]4Il1Ee1Gj0Ej%=e(Ah(Bi&?g(?g(?e$<a+Ci(Bi)Bj)Dl&Cl'Bm*Ci-Fm,Ch/Fj2Fi/Gk+En.Fl,Ck-Cg3Hj4Hi.Bg0Go2Gn4Hp3Gj4Hj<Lk;Jh7Ij7Jn3In:Mr:Mq9MrAOqCSsDTt:Nn>Qq@SsHXrGXuGWqLZsM[xO^zM^{P_xUdzP_|Q_wKZuN\uO\xQ\xJ\wN]vM]zJ\zIYsK]yM`}H]}@V{FZ}E[?V~?X�<U=X�=W>[�BWxCXyF\}CY}EY|H]~H]}J^|M_{M_~R_{M_�QcMaQcP^yPc�Q`Qb�M`�Od�PbOc�Qc�Oa�L`�Ka�I]�I_�H`�Mb�Re�Mb�Ma�Nb�ScSc~Q]wUd�[d�Ue�Yg�Wf�\g�Ve�Vd�Ye}R`{O]wK^}M\vMZtIZxJZwI]}GXsCUsGXuCToCTqCVvETpBSo?QpFXtDWwCVv@UvDXyBVxAU{F[�@W}>SvAW{?W<W�;U�;T~<W�9V�:W�9W�9W�9W�9W�9W�9X�9V�9W�9W�9V�9W�8V�8V�9V�9X�9W�9W�9W�:X�<X�B]�:X�@Z�E]�B[�C^�A\�E^�H_�D_�Ha�Jb�Mf�Ld�Lb�Pg�Rh�Ne�Mf�Oc�Qi�?Kc:G[<I_?KdBLc@I]?Kd;GZ;Jd>Jd<Ic?IZ:I_5E`8Ec;H_7CZ7C\8G`8E\:G^5E_9GZ:F`;H`8F`>J]=Jb?J^;F\5@X3AW8E\6C^5D]3BZ0?X.=W4D\0=S.?Z)9U,=X.<R1?T1A].=W-=W-@_*:U*<\.?\2Ef1Dc2Ca.Ek*>c.Ad(>d$;_)@f'>e'@f(?a(>d*Ci0Fi3Hj2Hk*Dj(Eo0Gm+Bh)@g-Ch2Gj+Dl4Hj2Hn4Jo3Hj4Ik8Ns;PrAOp<Lm:Mm:LmCQn>Ll;Ln;Np;Lo?Mq=Mo>Qt?QtCTu?Oo>QpGSjEUpDTqCUsJZrN]uM]vP]vO_uS\sT_tP\uN]vM]tM\uP\sJZwN_{N]uHYvI\{I^�H\}D\�@V|>SvDY~>U{A[�BY~?WAY�@X}@W{CZD[�GZ{H^}G]�FYzK_M`M`}Q`zOaLc�Pe�O`Q`zQe�Ob�Qc�Pa�Pb�Pc�Rb�M`�M_�Ka�L_�J_�Na�I]K`�Nb�O_Rb�Qd�Tc}Sf�S`|Qd�]g�Yc~Yg�Pb�Zf�XfUd�S`|L[wP`zO^zQbzNbI[{L]zHYuHZxGWrDTpDVuFTpDTqEUs@Sr?SvEWvDWwFXwDVtH[{CXzARsGY{B[�@U{?TwAX}CZ=U}9T�=V�;Rz8V�9W�9W�9W�9W�9V�9T�9U�9V�9V�6Py:W�4S�5T�7S�8U�9W�9V�8S:T;U�?Z�>Z�B\�>Z�>[�AZ�B[�E^�Ib�G_�Ia�Jb�Ld�Ja�Md�J`�Rh�Pf�Og�Of�Mc�AKa>G`>I`>I[BK_;G^>F\@HZ9Hb@Ka<Ha>G\9Hb=I`=Hb8Fa3A[;DZ4@Y:FX:D`AIZ>J_>J`@Jc@K^=J`2Dd8F\1@Y5C_9E^>H_:EX5CY9E\3AV5E]4D]0>S0@U1F`-=U/=U1>U1A[.;S)9S*<Y+=Z-<V*=^/Bc*=b/A_,?a+>a)=a/Bd)=a(?f%=e(@d)?c,Ae&=e)Ah(Bj,Bg/Dh+Cj.Hq-Fn-Ch,Dl/Hn3Im0Ej2Kt3Il7Kl8Lm<Ot:Mm<NmANk<Nl8Ji=Ki8Jl;Kk>Mp;Ln<Kn?OrFYyFToIYuIVtKXsLXpGXuK[vDUqHYrGYtK\vM[uLYuS^rN^uN]rJZsP^tN[vN]tLYpL\tIZuL[uJZsHZxJ]}CWvBY|>U|AX=Sw>W~BY}>TzAWzD[DWyDXyBZ�EYyJ_�K\zN`�K`L_|M_}Oa~M_zM^|Pa~O_|PaPc�J[|K_Ob�QazPc�U_Qc�Pc�NaM^}I_�L_�H^�Nc�Ma�M`}Na}Qb}K`�Rb|Ub}WdySe�Wc~Zh�Xc�XeQb}R`|L\}K_~P`xN^{K\{N^|KZwIZwIZyDUsDUsDUrDTo=MjETsBRp@PqARr>QoEVtASrCUsASsDUvAVx@Uw@UxBX|?W;Qv>Uz<Rv<U~>U~<S{<Y�;W�9V�9W�9W�9W�8Qz9W�8R}7U�3O{9V�8R{6Q3N{7Pz9V�8R{8R|7Ox:Qw?Y�;V�?Y�;X�9W�>Z�=X�B[�C^�G_�Ea�Hd�Md�La�Lb�Nd�Pe�Oc�Pa}Nf�H^�?IaFM`CMgBK`=H_;He;G[5A\<Id;I_9G^=I_;H^=Ia;G_:Gd6A[;EX9D\9DX8Ga@JcDLf@Lf?LfBMc?Kd=H_7Fb:F];I`4B\<G\9FZ4B[7CW4C[3BY4D[.>S/?U6D[.?[0A^2AX1>R/>W.=U,<V+:T(<]'9W+=])<^+?a*=]-Bd0C].Aa.Ac%9\-Bg.Df-Bb,Ci(>e-Ej+Ch)Ck-Fl/Eh-Ej-Gm1Jq-Ci-Dk3Jq3Im3Kp9No;OoBTrFWrFVrFVrASqBPl<Nk@Po?QqAOnGTpESoJXsN]uIYtFTqGVsMYrR^sO^uOYsM[vHXrKZrL\vHXtKZpO^tQauQ`uS_sO]tN[rN]uL]wRauJZsJ[rOayL_yJ[wM^vAVyAUwEZ@Uw@VyCWwCX{AVwF[{F[}I]|I\zIZxJ]}IZvM`~K\wM`�K\wK]zO`yP_ySb{N]tNa{Ob{Pb|P]wN^yOa�Ra}Sc|We~Sb|N_�Tb}Mb�I\~K`�Ma�Pa|K]~Qa}K_�Nb�Mb�Oa~Qb�Tb|XdSe^d~[e~Ue�Wh�VazS^wQbP`|Q^yN\sL\uT_wYcyQ\uN]uJYrDTpBTr?Qo@Sr?QpAQpAPlBSqCSmDUtARrGXvDWuCTq?Tx@UxBW{@Ss?W~=U}>W�<Sz>V=W�;U:Rz8V�8U�9U�9W�8Q{9V�9T�8R|9W�9V�5P}3Ny8T�8T�8R{8S~8V�9U�<X�>W�;W�:W�8W�;X�=X�@Y�@[�BZ�C[�H]�G^�I`�J`�J^Me�Od�La�Od�Nb�K_�=H`?J`?LcBKd?H^?I^=E[;Hc?K`<I_=J_7Fa<Ha=F]<F_6E]?GZ@I^;Fa9DZ;G\?KdDOiEMcGQcAKeCLa@JdCK^@Kb@Lg:E]:FZ8DY5BZ5C\2A\2@W1?W2AX0>T2AW.=X0?W.;R0>V5CV1?S,;T0Ca.?Z+=\.Cf,>^1B_*;Z0Ec1Eb.Bb->Z.?].Aa0Gi-Df0Df/Eh+En-Fm/Gk-Fl,Dj,Gn6Jk8Mo6Jl1Fj/Ei3Hl7Lr8Km=Qr;Mj>PmHUlDSmDSlARmHWqHVpGSjHXrFVrM[sVdxV`sN[rIYrJVnNZpO[rLZuKXrLXoIWpJXqHVmHUkKXoP^xR^sO\rP^tN[rO\tP^xN]xO`uM_yO]vL\wHYwHZuJ[v?Ss=Sx=Qr?V|=QrH\|AVxH\~CX|DXyK]vFZzFYwSbvP`tM_yK]xJ[vM[uL]xJ[vN_{O_zO^vL]xN]|R`zQ`zQ^xQd�TaxN[wRb�Pa�Tb~TcQb�Sa{Ob�N_|O`zP_xN`|IYxF]�P`{Q`|Pb~WdwZg{Tc~Yaw]g}Yf|Tc�VbyR`yS`wP]wU_sO`zO^wO^xP\rOZoR^uO\tKYqESlCSpCPnFSpCSq<Oo?OmDSmBSpCTrBSrEUuCTrIZvFVt?SvAUx?Ux@St9Pu:Or>Ru=X�9Qz<T}7T�9W�7Py9U�9T�8R{9T�8T�9U�9T6Q|3Q�8S�8Q{8Qz6Nu7R|7Py;T};U:T~9U�9W�;X�:T@W~@Y�C[�F\�G]�E[~J`�H]�J^J`�Oe�Qa�Ia�jbk�n[;H[AL`>I_CI[AKeCM`?H_<D\=I_=I`;Gb;G^AJbAL_AH^BK`>J\=I_>Jb>I_BLfEMb@McBMdFOfCMgDMcEOcDNc@Lb9Gd9Ie6F`3D^0@[7F\2C_3C_3BZ2AY1@V4C[1>V1@X.>W4CY.=V/=T1?W/A^2C`.?[4Fa2B]2Ef6Ii5F`6Gb/Bb3C^/Cd1Dd/Cc0Db-Cf0Fi,Cj+Dk+Bh4Ij,Ci4Ij7Kl6Lp6Jj7Km7Mq8Mn<Oo9Nq:NnBVtJ[uGUmESiAQlCToEVtKZsM\pIYpO[pLXrO\tNZrR^uO]tIXsK\uIXpHWqGUmGWqGUmHVoGVnOZnNYoNXoS]uO\sO\uN[vM^xN\vS]tVcvXdzQ]uIZuGWsCXyDWuCVv@Uw>Uz?Ux7MqCY~@TwEXxHZzJ[xK[wL]zJ]}Mb�M]wL_|N`{Q]sP]zSd~RdN`}N_|Rb{P_zP^{Q]xQ`|Rb~R`zTc{Sb~R_{SbSayT]uSdQ^wP`|Na�O\vN`}N_zObL^|M^{Oa}Rc|\f{Ub{Xf�ZcwYd~[e{W`vSc~S_{U^vQ`}S`wP_xR`zM[wQ^sQ_uQ^tN\rMZsPZqKYsHVmARpARpFWsDUrBRpBTpDTrDWuAQrCTqIYtIYwM\uIZwFYx?Rr@Vy=Rv>Tw;RwC\�>Uy=W�>U|;T{9Rz8Qz7S~4S�8Ou7Pz6Ow8R|5Oz6Oz8R|6Ox1Kv9T;Qs:T:S|8U�8S~8S=W�=X�=V�AY�AX~EZ~E[}AW|F\~Md�K`�Lb�H^�Le�Va�]Yijib?K`AKcEM]@KaCMeBL`?J`@KfCMdBNa;E^@LcBLe7D[?I^=Ia;H_:FZ?I\CMgHRdCOeANg@Lc>Ld?Mi@Ka9F\=Kc<I_9F_;G]8F_:E[6DZ4CY6F]2C]3B\/>V1AY-=Y/?X2AX0?Y.>X.=U2?V6EY1?W/?Z5E\6F^.A\&9W+>^-?^5Fc/A`0B_7If2Da1Dd4Ge1Fi1Fh/Dg0Eh1Gj1Hm,Fm5Kp2Jo5Jm6Jk6Jj7Km<Po:Nm7Lm;Nn7Kl?Qn=On;Kf<Lg@RpFVoM[oM[mKYnM]tMZsN[rKXmP\oQ]sKXoHYuHXqEUmCSmEToARoHUmDSmDUqGUkHUkKWoLZoMZmNYqN[sJXpLXrLZrNYpHVrGUrATtDWw=Ol=Qr<Pr@Tv>Sw>RuFYx?TwFYzHZwIZwKZuM^{J]|O`{R_uQ_{K[vK[uRb|S`{QayN^{R_yNZtP^uMZuNZvP[vS_vUbtS`wWawS]yU`vT^vPazP^tP^yO^{Q^wTb|Q`}P`~N^yP]zO`yJ\|T_vYczWe|Wc}[bzVdyWd|X`{UaxS]uTbzU_xRa|N\vR^xO\zN]uM[sMZuNZtOZrN[sJVqFUmGVoDToEUpHXrETmEWtDWxHXuBTrAQoDUrFWrLZtGUpFWuAUvBUv>Ru@Tv=PqBUsBVt?X�?V}>X�;Rw6Ms8R|5Ow4Oz2N|/Jv5Oy4Mu6Q|<PtGXw7Py3N{4Ks3Lv5Mu8Q|7R~4Mw9T;U�:T|?X�>U|?W}BZ~EYz?W|Hb�G^I\|K^�PXgiaIa_UIOU=Jb=I^<F^;Jd;G]7E\9G_9Ga?J];Jb@HZ9H\9G_;D\<G_@J`8C_:AV:G[CNaEOaBMa@Ld=I]?Kc>J`=I^;FZ8G`:F_9E^=Jg9C\7E]:I_>I^7DX.?],<V-@[.@\,;S*<V4E^1@Y6Gb4D_0?X1?V0@Z1B_1?W5E^&?^#;\9Z.@]0Db.A_/A_1C`2B_0De5He6If4Ge5Ij5Ij7Kk6Jk4Il2Gk5Jl5Jk6Jk8Kl7Jk<On;Nn7Kl>Qp7Kj;Mj<Nl?Pm>Ng@QkCRlIXnHXoIXmP_qKWoOZpNXnUasSasNXnN[qM\qNZpMWlKWmFUoGTlGVoLVkPZnN[pIXqLZoKYoIVlMZsKYpKYuHVoAOlDSr@Qq>QqBSt?Qp@RrDWw>Qr:Pt>QqATvCTsEUsGZyJZxIXtM[uM]vKZxK\yMYsM\xM[wP\uN^{O\vN[uO]vN\xN]wL\xN]uIYuN]wTa|QbzT`tO]wQ_zQ]tKZvPZuR]uR_xP_}T_xR_yO^wS]tP^zJ\}Q^xT^wS^z[f}ZaxV`x]f~af|Ua{UbzX_wV^wT`zQ`yR]sP^xP]vM[qMZpKZuO\tKYrJUnOWpMWoHVoHWoGXsHXtETqGVpFWuCQmEUpDSkFUnCTpDUq?QpDUtFVtBUu@RqASs9OtBX~@TvDX{<Sz>Tz;S|;Rx6Q|5Nx2Ks/Jv4O}3Mw5P|2Mx8LoBOm:Qx,Iw0Ly0Iq3Lt4Nw4Nu8S5P{7Q{7Py;Sy@Uz>V~:S{?V}>VBX|BZP[szlg~jbgaTadTwaU:Hd8DX:G_4D`5?U0>W3BW5DZ6D\;G[9H_<G[6Fc9DZ@I_EL^@I`7E]?G[DNbAK\@J^<Ja:G_=J]8F_7F_=FX=F`<Ie;G_9D]8E[4C\4D[2@Y2C\.>[(;V+@X*=[+@\/@Z->Y1A\2AZ2@W2B\.>Y/>V8H_5DY3D_5F`3Ge.Ca-@]0Cb3Fc0B^/B^.?\,Aa4Gb8H`2Fg5Ii9Jd6Ii6Ii4Fc6Hi8Ll8Km8Kj?Rp8Lk=Po<Po:NmASr<OmGUk@PkDTnFUnCTqHWoKXpM\pN\oO\pQ^qZbnV_oT_rU`pP\pYcpN[oP[rQ[nR\oLWkIWmIVlNXlO[oPYkJVlKWoNXpJVkIVmIXpBRmAPnAQn=Mo<Nn9Mm<Nm=Po?QpARoCUrASq;NnCUuBTtDUtBTsFWuDToDUqJ[sKZvIYtIZuJZrHWpJXrEVsN\sM]vQ^zQ^xOZxIYvL^uJZuM^wQ_yT^vU_vN\vK[tN[sIWnJXuN\sR]tQ\vS^uP\uR_yMZwO]zO\uM]vQ^yQ]xWbw]av[ewYf}YavYcyYbwUatU`xQ^vSayUbvR`vS`tP]sNYoOZqP\qMYrU\qX^tZavMXqETnDTnHXuHUtHWsGXuFVsCSmFUoHXs@RpFWsEVsFVsFVrEWw>QoATt@TxFYzFXwFZ{?Tw@Uw?Tw9Qv6Mu4Lr5Lq4Ls1Ks6Lp;Nq3Ku8Px7Il8Ks,Gr1Lx;Nr9Mp5Nx3Nx6Nx7S�6Ox8Ns9Qx:T~;S{8Qz=U}>Ty<Sz<U|Xdrzh�{dblX\\,ON:2A\4BY2B[)<Z0@Y5E`4@T8E\4@V4B]1Ba?J[=I`7CW?HZ>Jd<G]<H[<F[;GX7CW=FX;I`:CW8CV8E_6F`=FX<F]<G]>H\3@W/>Y.<W-:P+>^0?V.>Z,=X-=W':Y0?V1AX1AW4E`3C\6E[2B\7F[5CW4E_6F_:Lh6Hc5Ij6He7Hb6Ig4Fc6Ga1Da4Gd5Ih5Ga6Ij1Hg5He7Kk:Lj6Jh6F]>NhCRk>Ol?NfAQl<Ni;MiBSpCSnCSn@QmDSkEUmKWiGVoKZpR`qS]mS]pS_lZdr^hrdjp]gsZesZcq\ep_hrZbnT\nR\pQ^oU`pNZmMWkKUgMYmETkGSfGTlCRlHThFRkESnDTp=MlDRmDRl>Nn>NmETn>OlCRmDTpCTq>OkEWtCUrDUsGWtARqCSr@RqATrCSoHYvGWsCUqGVrHWrIZvIZuK[tJYuLXsJYuQ\tFToHXtO]uR]tLZsOYrN^yLZuKYrHVnGVnFTnHWqR\tQ_tP]tN\tT]tQ^vQ]uP[vN[xO\wO\zKYtM]xS^wQ_{Q\vP\vVbsQ_xRbyN[sP[sS^tS_zT[nTZlPZpMYsLXqKWlQWeXbs]csQYoO[qO^vR]uS[qP[rJ[uKXrGYwPZvKVjFToFUpBSq=NlDRlBRn<Mh@RpCRm@QkMWkEVs@QnDWwBUu=Qs8Lp6Mq6Ij<Ll1Gl3Kt3Hm0Gp2Gk1De0Go.Hs2Ip2Jq9Lm:Pt3Mw5Nx8R{4Io=Px:Mq9Ov:Pv7Kl8Or;Rx<Rw=Sv<Sy;PuOYu\q]OYL<OW5CX4C[,;R'6P-:R8EZ;F[8CV6E\7E\5D]9F[7DZ5C[5C]=H[8G]:EZ=GW3BW3@X=CQ3AY7BV6C\7@V3BW5CX:CX6D^6C^->Z0=R1?W(7R/?Z/>T0@V.@],=Z-<V3C]3AV6DZ6F\5E^7G_4CW:I`>Ka6Ih:G_9Je5G`7Jg9Ml5Gf1Ca4Fb>Nd8G_6F^6Ie9G\;Jd4Hd5Hf:Li;Ja;Kf;MjBPf;Li9JgAPg=OlBTnCUmHVkDTkDSlETlDUoKYnHVnFSfOZlV`oU`lW^mU^m^fraeo\dkcgo_dn[dqXbqV`qY\kXaqR[kUZlV_oO\oOYkU^jOYmLUhJTiKSjLYpP[lQ[qOWmIUmDRlFTlARnAOlDSmHVnGWpGVlCSoIXpCUrFUrESmGUqGXu>OoBTrCUsDUsFVqDUsCSqBRoARqCSr@RmGXtHWsIWrIXrHUnGXsCUrLZvN[sNZsNZtLYqPWpMXrO]qLXmHTkLVkHTlKYqLYqOZsQZrQ[uKZuP]tKZtLZvIXuJVrFSpKYuQ[uNZuS_vPYrP\sQ\tOYsQZtPZsR\pS]uR[rOWmOXmMYqOYsKWmOXnOYqSYpQ\sYbyVauV\rU`sV`rR\rP[pO\zOYq@Nb=Ok>Po?Po>Nj9Jj<Lk;Nn>On;Lj=Pn<Ml<Mm@Tu>Nl9Ln=On>Rs;Op6Ij3Hi5Ij0Eh3Im1Js1It:Jh5Jo5Lr4Gh6Mq7Mq6Km6Km6Mr3Kr=Ps?Qu=Sx7LmHTp9Lm:Ps8Os=Qq=Qr:Ps8Nv<RwFYq>Ww\ku-<U-;T0?W/>W*9R2AX4B[6CW1B]3BY/>X7D[4@Z:EX5CX8F[7CY5@V3B\6C]7CZJNZ2?U;ET1@Y;DU8DU4>T2=R0?X/>Y/@]1@X1AZ.>X1@Y/>U2@V1@Y1B]0?Y4D^1?T.?X4D[9H^5F_9H]AM`6F^;Jd>Ke?Nh=Kb<Ke7Hb6Gb5Gb5D]<Lc:Jc8G]6G`>La>Nh8Jh=OlAOiAPj=Le=Ni?Oh;Lf=Mh?Qm@RnJXjFZnJXjGVi?PjJXmHWmMZkJYnP]oVao[dpX`oYbq\erafpaepZaq\dpbfo]cn`ejX`pNWjW_nPYkR^pLYlQ\jQ\mP[lIVlMVlQ[mT[lR[oZcuR^tQ[mLWoN\uQ^sJTmNVkQ_rP[nR]oKXmKWlHUmFRnGTmIYtFTsGUsBQoCSo8Ll>PpCUt>Nl@Rq?QoAPoDTuBSpFUoJYuDQkHWpGWsHXsJYuFTpIVmLYoQZrW]oP\tPYpT\oNWmQXmRXlJVoNXoMWnLXpMVlJUlIWqITlEOgBSp@PoDRoETrHXsJVpRZsV]qMZsJXqLYqOZsQZtN]uNYpR[sN[sOYqRYmMYrNZrPYpLVmOXnU]oU`uU`tR[sS_sWftYasU`qT^oOZpHWrAOf;Mh?Po>On?Lc<NnANn=Lm?Nj:MmASp>PnBPo8Mp:No:Ln:Lm;Lg7Kj7Km4Kp3Im6Lp6Lq2Ip5Il4Gf1Gl4Jn8Mo:Nm=Np7Jl3Gi2Iq3Kv?OpDLhDNk9Os9Kl9Jk:No<NjDRl;On8Qx>Qq>Qp?QqDVunuq/J!2L$4M"3L/I-<U-;R+;V3?T-<X0@Z1A\3AZ4@V5DY5CY3B[-=V1?XEK\EJ[QT^HMZ:AU0=U3?T-=X;AT4?S,<V.=V.>[-;T.=W2AV2A[.;S/>U/=U/?X/>Y/@Z2AY5F\4D\=HX6DZ@K\:I^9Id7E[@MfDQjCPi?Lb7G`9I`;H]8G_:H]<Lf=J[=J_<Le:Jb<J`:IbCQh;Lk=MiCRlHUjCRkHTd>PjCUnGUiLYjM[mCRkCRiIVkHWlLXhIWkPXfW`lYaqR^n\^c[`l_cn`cm[bj\es^fq[^k]eoW`pU^nT_nQZmQYgS[kOUePYfLYkU\lOZnLViPXkRZmT^qS^sN\oU`r[etUbuWarW_qXcrW`pNWlM[rJWlFRjHTmJTnMXqHXsIVr@Rq=On8Ll:Mn:Mk8JhBQoANi>LjCQoHZxFUpESoDSpAQoDSrJWoIVnFRkFToM\sS\pO[pLXoMWmHUjIQeHSkJSiNVjMYlMWlHTkITlALg@OmFOgDOi>Ok:LmDOkFRlETtIXsRYoMVkFUoMYnPYoNXmPYpO[oMYpPZrOZpPYnPXkMZnLYnOYpS]sS[pT^sT\pVbt[atU_uT^uS[qS\lIQ`JUkFVoDRj@Qm>Qp?Pn9Lm>QqANiBOl<Nq>RsAQn:Li9Ki;Pr6Kl9Km:Lm9Ki5Ii4Hj1Gl/Ej1Ho4Hk2Gj5Ij4Ij3Hk1Gk9Hb>Kf9Jl4Hj3Gi:Kj?Oq=KkCLeBOk;Lm8Hi@Po?Ok5Hf>Pm;Mm;Mn@Sq:Nn>Qq?Rr?Om*I+J)H(F-J"2L)H/J*8O-:T/=T.;Q0?X,:R-<V-=Z+9P(7R)7P?DTBJZQQZQR_3=S.:O/<O7?U7AW,:Q/>W0?V0@Z.;R-:R1@W3@T-;Q2AY5CW2C\.?Z/>U0?U4CY4D]9FY:EW8F[<HV?I^4D[2D`:H]9H_7Ha8H`9H_.?\2Ea<J]?Lf9F[;I_:Jb@M]=Ng>LdDPeANfBQjCOdCOfESkDTjCO^MWdBPfIUiFRbFUkCPcJTdGVnEQfITfPXjW\nS]rU\md^d]Ygtmoc`c`bi_ft`eq^cp[cqX_oW`pS\iRXfQWkQUdRYmX]nVbsWcvU_pKUiLVgQ\pW_qYarVarU^qW`t\dsWbtX_rYboRZkNZoLVmITjHToESnLXoJVlIWoDUqCRl>Qo<Oo?QpBRo?Pp@QpBRpDPkESoJZvGVrAQoKZvFTpFRnGTpFTnIXrN[sR]sK[sIWmIRdFPhIQfENbCMeEOhGNaIQeFQhFOcHRhDNgAMf@Lh>Li;Kh>KfCQnFUnBQnKVnJWpIUpITiMZnMXnRZoS[rOXoJUnJWnMXnRZmN]sR]oOZpS]qT\sWatZ`rS]qS\nV[qNZuMXrIWpCNa:Kg@Pl@Pk>QnBSqDRl>Mk@Pl>Oi:Jg;Lk?Pp>Oo;Mm7Jk9Jk7Ig6Jj?Po9Kk7Kk3Ff,Bg4Ho0Dg4Hi7Jj:Je5Hg3Gj5Ij5Ik6Hh<Ki9Kk9Km:Kk=Nl;Kg9Il;Km;Jh8JjCNf;Jf7Kj8Ih;Jd<Mk=PpDVs:Mn<MmAOl<Mm'?$A#A!A.I-L C&F0K'6N)7P,:Q-:R,9P*7O#3P'6O&5M$3L>ET8BR^^jPQ\$3M)7P.:P:@V,8P*8O-:R*8P+:T.=U3BU1>U;CP5@Q=GW;G[8FZ7EZ2AX/?Y6DY4C]5AU4C]3AW2?U6DZ9DT0@]5C\6E\5Ga9H`:FV8Ha6Gc8He8Ga8Fc<Ia>Lb<HZ8G_>J\8Ha9G\=Kd=Lb;I^<J_CRfEN`^TPMT_DQc?K[ANf=LdMWeSZYQ[jHRfQ]eYc`hq_bm^g_@h^Ro_TWLC\_hR[mQZsMUlRYgRVbPYkJV`IOUOWeQW_U__Z]][`\TQWVbUP\aKUjPXmQYlR\oQXjJVlMVkPZrIRmBNhT]bSYePXlOXlQWkLVmO[pP\sGSmFSrGUqHVpGWuEUsIUpJVsHWrJYsGVqETrJWqHWqIYrEUo@SoDUrKXsKUpFRmETqM[sTavQ[oHRmCQlDPfHQcIRdFOcEOgHPhDL`FOb?LdEOc>KfBLb:I`:Jd:Je?Kg=Lj<LfBOkDRnFTnIUlFRiFQhESjCPeHTjCQlKWkKUjIWnQ\pO[qQZoQ[nLYlLUgMZtR\sS\rRXkOYjJUpGSjGRi=Kb?Mf?Oj=Li;Nm:Lk<Ki;Ji;Kj6Ji5Ik;On>Om:Kj;Ml8Kl9Kk6Hf3Gh9H`5Ge4Il:Hi=Hg1Fh1Ei1Fi2Fg5Gf4E_-Bg5GiAMj6Il8If=Km=Ln;Ll;Jf7Ga8Ih;KhARm;Ml7Jf8Gb:Jg=Lk7Ji:Kj>Pp>Op?NhBQh8Ik6Ik)$ +'?"1E)I$E%F"D.K+6F.8L/<Q,:R&5O(6N,;S)8R"4QFH\0;TjdgQT^#3N.8M?EU4@U.;Q)7O*9T0?X+9Q2?U4BV4>U3<L:?K;FY6BWBEQDM\3B[1@Y3>Q-:R.<U-:R0>U,;S+9S.;O/=V,=[+<X.=W/?Z2@X7BS2B]->]1@Y3D^5AV6D[1BZ:CV9EY9EW9G\BHY>FX:ET9G[GISNEOeF>TIN=BO@BK?K^QXbdnI[k4[mCU`@DR)ev?`r=DZ(Rh*ft6bg3JK+IE)O\H@RPMdJcwLXiDZlDUd<N\)[j;^lB`v?Tf7Q\-IM#ag5Ve5HWWM[aLZ_LVYTRLGPhGPkFTrLTbV[YRYHBKQ=CLJOVLUlLXpR[iKUiLRhKU`LXjFTrGVrETnFQlBOkEUpIUnCOhGRoJUnHWpKZqKZtLYpIXpM[rO[tGWuFSoJYsQ]rQ\pMWmGSjJVhGO^@Mc@Lb@KXDMdEOfFN_BLaCN^AKfCNh:G_?Ka:Jg=Ke?LhBLg>JeEPh@LfDOd?Mg@LbAOd=Jc;Jb@MgHQfGRhFQiIUoIVoJUhGRjJVlFSiIVmJVkP[nNWlGSkIReEOhDQk>Mh@Qn7Gd8Ji6Ij8Kj8Jj7Jk:Lk8Jk:Ef;Nn<Je=Kh6Jk3Gi3Gj6Ij.Ce1Ca0Cf0Df8HiEMi0Fj5Gh7Jk5Ii2Dd5Fa5Fb6Hh=Ie6Jj<Kc@Kd:Jk9Ih=Kj?KcENf9Ji:Kj:Lk8Ji8Ii;Lk=Nl>Ng@Ol;Ml;LmAPkEOk<Ji4Hj(9+(5/:4=$%+# #1,+ "&+0'",* )'#/=,?#<GGR,6KwpnNR^%3H2<O5?R*6J,9R-:U.<W7CY0<U3<O9CTBBG<9311&.4<58BEH?+8L,8M,7G/J!1M*8Q-9P-9P+;W)9Y.>\,=[-:V3=S1=Z4AX/=T/>Y5?W+:T1>U8AV6@X3?W7CXGET\IMJDOLINOEOFENEDN:;MC:AN6&V8"C3!:4MP,YeQhnAdu<Ql.dx4Vi(R_(ct4Wu'Ca"Xl3Tn3Lb*Je/D_#D]!>X"Eb'\w4Sc+G['EX/Pd-_u6^u4^v;@V&7M#Uk2Zg0D]-Vn;Sm:Ja/Tc(DN%5AI@QQCROQa8KY9D+9)8KI/NOCERC[c?[f:JQ4EN#>G3LS]:Kh:Ji7Ij5IiDRl>Nm>KhHPnJSmHPfKXqLXpIWrAQmBPlFVqDSpIZvKXpGTmFUmCQiHUmQYnKSfGOaIQd@IaEL]IP`LO`JQaHQdIPcHOgDNbFNbDMf>Ld9IeBMa?IXBL[>Ja8E[6Gb;GY<Ka<I_?K`?Le@Ka=I_?JfHOcFQiDPgBOiEQoJQcEObDQiGQdGP^>Nj<K_:Je>Nm@L`9Jh9Jj?Nf6Ff4Gi1Fh4Ee8Hf.Bf4Dc1Ca3Db4Eb0Dh1Ei-Ag2Ed1Eg0Cc.Cf2Db3D_1Dd1Dg6Gg1B`3Ee:Ki6He5Hg:Hc<Kg3Fh<Kh;Kf:Jf;Ji5Gd:Ib9Ga9Kl<Kh<Mj7Jf:Kk:IgAKfBN`>On@Nh@Pm;Ll;Jc2Fg3Gh)4;G6DFQ<E%$%'- )7C"%&-%!-%. ?E9#*3qh`CFO#;18E+3='2@2?O3A?3A=2B9HU?@H,PJ-?B#3=!(,24",2#"( &,7&.>(>.L'4N-7M3;J,8M6AUBKW>KW@MJ;B69@=<EI6>U@CV=AW.9S(8U4<UCER?EOOWRX[Fi]6VL$S9N31, .6A>3*D2UA'<4@<]O%[]%^j/eh,Wf+Rd+]n,Rb)[t2Rl+Ld Xm/R]N_'Oe)Hd$Oj)Hg >`#@^%Nc0;KXl4K_(Uj5To7Wm8^x9Mf3Ll7Ph/C\)E^+]y:?X!5HHa'?V">T ER#DR3<3C/<8N@X@SQc-Nh*Vr.He&D['>T'2A=*;>M(;\)=c6Ij4Ff4FhCMfHQiFQkDNhGRlJUlHVpFSnFSmCQmCQlESkGTjGTkBPl?MfESlGSiITfGPcKQhGL`LN^GL]EM[DK_GM`JO]FNfCL^@KdENc<Ic9Fa6BU6DW4B^7CZ=H\9Gc8E\8F`:EY8G^7Jf<I[>JeBLb@KdBKeBPiBNcDLiDMc=JaALgAMdAMd=Lg;I_;H^<LlBOe<Kh7Jf7Ge6C_5Fa3Fe1Eg*>a.Ab*@f+@g.Ab0Cf1B`.Ad-@b.?^.Bf0@\-?_,<Z0A_5Fb4Gh3A]5D`5Hg6Gd5Eb<Jf7Fe8Ge<Hd=Lj>Lc7Hb<Jf8Hb5Ij<J`9Ki7G_5Ii4Fb8If<Kh=Ll8Ic>Ll@Nl9Ki:Jd5Gf5Dc,>`(.-8(1FG6@-9%,!-0?2;?F'2'5#-AH>J03fe>4<.(3!.8 '-.;?P(=R/@1GJc#BX,6,"/&*6,8%+!+14-:?+0754?59B0HM/7;$@L5N]:>M!=W)7K2?8F*0<144-*.<#0H&2DAJD^lCNf4Ob,FW"EPBP=07* ;95E!9A D5LM&>Ccg8fa7DI!QVDR9EXe.^q0Rg%>R9HM\'Z_/@<AO:O6DG[&D\*Ka0Kk0Gd0E]-Yq/B_)B]/Ee2Yu=Kh3=Z.7J'&9 .*::K/>)4(5 .&3/<0=%1%1!-0>,<2G6JIa<@X27H7N4F4I!UF0S6*(5Q&7W1<V';^0A_9Ie:Jh@LfENdDOiDNhCMg?Nk=Kh?MkFUnJTiHTmFQmIUnT^oKUlKQhIQiCOgEL_IO`JN`OS\KO\FJYELXGMaELa=H]CK\CL`AKfENg?H[8E[2@X4?X<G]7D\4BY3?\=H\6Hg@Kg9G^DL_<G]>KaDMeEPgDOgFNdALf;IhFPlCLfDOhCNf>Kg@LhBMf7F_;Jc>Mg8Ec3Eg1Dc1Cb.@].Bf+@f(<a*>d3Fe/A_1B`*>_0B`/Cf.Bf->\.>Z/Ba0Cd7F\8H`8F]1C`4Fd7Gd>Jd:Hf=If8F_:IdDPd?Ka;Je9Hc=Ja<Jb<J^9Hb5Ff5Ec4E_8G^9G_;Ki:Ib:If:Ll7Hg5E`1B[4Ed4C_ +" ! +! !* -'4-:-:2;-2>D&4%2" #"/&2##1)6 &"&*:"- +'$1'3/;0</;*403&' 0<.8&3'3.:(*7,$+/3>)2?&:S$CZ(F\)4F:N1=>@.0%(5;8E'.1,19,5 49%+(,&*#-:2:-9%2.93=)/ (2'4%3)(4-@/=IXA0=!&3+9*9+: -%$$ &$#! %&&$&#"%*$1=+%/,:.=,9&4%*%&+4&&0/+0,(:W.=S*:Z3>U@H[IL\DMfSQk8Ij4Ee<LiALdERn]`kiiSYeZ`o\TiJQaHTdP^jP_mCRcFZpEXgJblIWc=R[@?IM1A`;B\FLbFNc>I^@K]AJ[>E\AH\>Ib>IeEL\AKd?J\=Ha?J_DLbDMf?I_>G`0CcCKZ@Kf?KeALc<I[AKd?KeCQk=KgEMdFMbCMd@L`=FX:E^5Gi@Ih9Fc<Jl7Ie-?`,?a-Ad*@f*>a,@e->^)=^*>`(=c(9W+=_.>]+=].?\4E`.@^6CZ.?\3AW<H];G^;Ic9Fa9E]@Ke@Ka8Gf8Ie8E_AMf<Kc:Ic;GX5Fc6B]8Ge6Gc1@Y6Gd3D_7Ge6Hg5Fd3Ff1Ec5C]0@^.Bc2A[! + + + +21 + # + %&1!,!"%%&%' '* + + + + + +%! !#!1) %"&!$&%#%$%&&$#''%&"",&!& "#*!)-'*%KLJ5<>.7B.9N2?Y3Bc-=Z9C[:@@SQ#NZ&EX,:N4HLc/K]'CU Wj0Ri)Jd!FZ%O`(GXCO&/;81<A=>DEGVDIZ9D[-<V1>U;CY5B]9D\<E`>Hc<CX9CY=F^>F]EL]?Ia>Hb;H`>Ha=HdDMcALc>G]CJaAMf>Ic9F`>J_:Fb;Ga9D\8D_@Le>Gd?Fb;IgQS\>H[3D`/Be,>_+@f0Ba1Ej.Bf0B_2Eb0?Z,=Y3Fg3BZ0?[/A`1C`0@\1A[0B`2A[3@S=HZ9F_6Ea;G_;Fb;D[6E[8F`7Fc7F`9G^<J_6E[6CX6D_8E^8Hb3D_4D_:G_5Ed8Gc4Fc4Fb5F`6Fb.>]2B^;Je + + + !& + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#$ $%".$1 %&$%&&2!+$)$%&* +%% #&($!)/ +#$%%%$"/!-6C(*)%1*!- )$))&(08L4<S3<M4;?/;K-:O.;T1;M5?L6?Q0>VCDQAAO=EV:E\>EY?EX@IeEM\@I^EM^JNbINa9Gc;D^7E_BKa@I^GP_LZ\CIQERT\hWesQ\`3JJ5IS=`lYkpgGTQHQV6D]0?[5D]4E`.?[7CZ2C`8Ia=J_8G]9G^;G]:F[6E_=DV/=V/>X:E[2A]8D\;G^;G_0A[=I_>Je=Kc9D[>JdAJbCM\3BZ7E^5E]3CZ6Gb5D`2Ee<H\9Ib9Hc5Gc4CZ/?Y/?]XY\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (Uac$ + &*)#$!&$ ,(#! &)7#0,$! + +!"!" )$%(##*'4+8*%$ ")$+"* )#-'!)) ,&-!/<+)5$$*02-7:A66;8<K6>S8D[@EWAEZKCK9=K9Gh6D\@HUQ`TReG_rBO`1PX%TW'|�Fgn,Wg#nx6Ob(r�>|�B`s.QZ)BS82BW/<\+:Z3;S2?^1?W<GY<I[;EWGJZ5BV4C_7C\.>U9Ic8E\7BX4C]5CZ5D_:D]:E\:EV7E]:G_AJ]?K`?H];Ia@KdAMc:F]6Gc:Gb4Fc1Cc3D_4E^7F\6G_.=X3C\:K]6?N + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +892 + +#"!$%" % $& +*!"%!- , +&&%&$$##,"!#! + &"%)(-1059254& $9:A4:C6<(?U&<Q#=RCX"Nb"R\&uy;dj)[f+Vl/Up-Hb$Xs1Hh-Rf.^e.=J/S_RCPE;AL6>X9=V9E_<H`2B]6@T6BV7C`7C[6C]=E\@FV5@U7@X9E[@J`JOcAJ_9B]5@[=F[=I^<Kf?GV:F^9E`:EZ2AZ>I`<FV9FY7E^1Db0?X/>X0A\,@_,?Z1?O@HY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +! % + + ! # #"&%""#&!# "& ' #$"0&4BNR[#7PDQ C_&Qh"9LRg/<RR_.vn4`i'bt9OW%=D%QT4EM>LM:A8;0>[;EU7E]BFXEH_KOf<F^AI]=D^@ISHOPDMA@F9??AAJA8BP;FS@IW9Gf<E^:CX=Ig=H]8BU:F^3BX5AV5AZ/>Z8DX9G_5CW+;W(9U&9U*:T + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +! + + + + + + + + + + + + + + + + + +' + + + + + $" + + + + + + + # &%# #%%%%! +!",% + + + + &'5,:%0"*FLGPBE:HHX#DN7F!9J"Qb/F^)SY+QK+^P2`N63:0ND4>A9EM@>H?<ED>J>Sc6Te3al4DM#CMH[&7H"GV1<A#/636@Q:BY;F\DJIIGF8AI=GW8E_=H]9G]:E[7AU/<T*:W-<U+;X.>\ + + + + + + + + + + + + + + + + + + + + ! + + + ( + + + ;)( + + + + + + + + +# + % + + +! ('" !&$# + + + + + + + + + /1.83, + + !0+*-=;4*1& !(3.=)72@CO$=J(<GHS*EQ)<P!;GEU*J`2?S(@M&9DCT%`n2Xa(Vl8Ve&Ue*Y]%M]"?P;H<H(DJ1DH/45*+ &(C>;BEOIOb=IZ<CW0;U2B[4D\,;R4D^3@L + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &# + + + + +"7/)&( $ &%$'#0/@(33C(.=6F.>9HAO#8IMZ%C[)Rf3]d+R^*ZTY["La'Se/HZ#Ua*c`*CK:DF6E56:B<-6BR:E]=Fa<D[9F[7DZ5DS=K/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + % + + + + +' - '( + +' + + + + + +! + + (#-&)7".#-0<4?#CM*RZ.HQ"HN'ROXT(UR#?MRW'^[ R_+Rj*HW+FL<B;2:=.6?V<F]DJ`?I`,:U2>GJ]( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ">* + + + + +% + + + + + + + + +- &! ) + + + + + + + + +% +H>$92NB29KT*TQ#SW&GMIS'[W)DOP](HPIX#P[)CR-EI$FF;GJ==HB>DF&2E6:A`_: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + # + + + + + + + + + + + + ! + + + + $ + + + + + + + + + + + +--&);;@I!7I7GFT(]JODOY(HQI\(Tj0@O*KY-Za0V]+JX'8D 6>PJ*lZ7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + * + + + + + + + $" + + + + + + + + % + %$ + + + + + + + + + + + # + + + + + + + #-,8(0/<FCNG#@>ADLJGMCL HP!Ta0I`'F[$=DB:`W'IM + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +% " + + + + + + + + + + + + + + + + + + #$ + + + + + + + + + + + + + + + + + + + + + + + + + "&-*1--)(>3@:9@6/.+04?C1<WCA5HH#>M% \ No newline at end of file diff --git a/sdk/media/land4.x b/sdk/media/land4.x new file mode 100644 index 0000000..3d23e8c Binary files /dev/null and b/sdk/media/land4.x differ diff --git a/sdk/media/level.wav b/sdk/media/level.wav new file mode 100644 index 0000000..f2b171c Binary files /dev/null and b/sdk/media/level.wav differ diff --git a/sdk/media/miss01.wav b/sdk/media/miss01.wav new file mode 100644 index 0000000..8300b78 Binary files /dev/null and b/sdk/media/miss01.wav differ diff --git a/sdk/media/miss02.wav b/sdk/media/miss02.wav new file mode 100644 index 0000000..8e5e9da Binary files /dev/null and b/sdk/media/miss02.wav differ diff --git a/sdk/media/mslogo.x b/sdk/media/mslogo.x new file mode 100644 index 0000000..191b315 Binary files /dev/null and b/sdk/media/mslogo.x differ diff --git a/sdk/media/multi.x b/sdk/media/multi.x new file mode 100644 index 0000000..59d190c Binary files /dev/null and b/sdk/media/multi.x differ diff --git a/sdk/media/ncube.x b/sdk/media/ncube.x new file mode 100644 index 0000000..d49bb30 Binary files /dev/null and b/sdk/media/ncube.x differ diff --git a/sdk/media/nyuk.wav b/sdk/media/nyuk.wav new file mode 100644 index 0000000..9fdb5ef Binary files /dev/null and b/sdk/media/nyuk.wav differ diff --git a/sdk/media/p_bang.wav b/sdk/media/p_bang.wav new file mode 100644 index 0000000..46fbc71 Binary files /dev/null and b/sdk/media/p_bang.wav differ diff --git a/sdk/media/piehit2.wav b/sdk/media/piehit2.wav new file mode 100644 index 0000000..cf181b5 Binary files /dev/null and b/sdk/media/piehit2.wav differ diff --git a/sdk/media/plane.wav b/sdk/media/plane.wav new file mode 100644 index 0000000..2bb51ee Binary files /dev/null and b/sdk/media/plane.wav differ diff --git a/sdk/media/rev.wav b/sdk/media/rev.wav new file mode 100644 index 0000000..6b81b2a Binary files /dev/null and b/sdk/media/rev.wav differ diff --git a/sdk/media/rmlogo.x b/sdk/media/rmlogo.x new file mode 100644 index 0000000..6d470ad Binary files /dev/null and b/sdk/media/rmlogo.x differ diff --git a/sdk/media/run.wav b/sdk/media/run.wav new file mode 100644 index 0000000..d3c9cf6 Binary files /dev/null and b/sdk/media/run.wav differ diff --git a/sdk/media/s_bang.wav b/sdk/media/s_bang.wav new file mode 100644 index 0000000..ed1efb1 Binary files /dev/null and b/sdk/media/s_bang.wav differ diff --git a/sdk/media/shield.wav b/sdk/media/shield.wav new file mode 100644 index 0000000..25eb74f Binary files /dev/null and b/sdk/media/shield.wav differ diff --git a/sdk/media/skid.wav b/sdk/media/skid.wav new file mode 100644 index 0000000..de0ea3d Binary files /dev/null and b/sdk/media/skid.wav differ diff --git a/sdk/media/sphere0.x b/sdk/media/sphere0.x new file mode 100644 index 0000000..e4ddcb8 Binary files /dev/null and b/sdk/media/sphere0.x differ diff --git a/sdk/media/sphere1.x b/sdk/media/sphere1.x new file mode 100644 index 0000000..9c0975f Binary files /dev/null and b/sdk/media/sphere1.x differ diff --git a/sdk/media/sphere2.x b/sdk/media/sphere2.x new file mode 100644 index 0000000..c95e694 Binary files /dev/null and b/sdk/media/sphere2.x differ diff --git a/sdk/media/sphere3.x b/sdk/media/sphere3.x new file mode 100644 index 0000000..a21a007 Binary files /dev/null and b/sdk/media/sphere3.x differ diff --git a/sdk/media/sphere4.x b/sdk/media/sphere4.x new file mode 100644 index 0000000..d95f455 Binary files /dev/null and b/sdk/media/sphere4.x differ diff --git a/sdk/media/stop.wav b/sdk/media/stop.wav new file mode 100644 index 0000000..834b1ee Binary files /dev/null and b/sdk/media/stop.wav differ diff --git a/sdk/media/strike01.wav b/sdk/media/strike01.wav new file mode 100644 index 0000000..0615e4a Binary files /dev/null and b/sdk/media/strike01.wav differ diff --git a/sdk/media/strike02.wav b/sdk/media/strike02.wav new file mode 100644 index 0000000..513c0a8 Binary files /dev/null and b/sdk/media/strike02.wav differ diff --git a/sdk/media/stunned.wav b/sdk/media/stunned.wav new file mode 100644 index 0000000..3950a8c Binary files /dev/null and b/sdk/media/stunned.wav differ diff --git a/sdk/media/teapot.x b/sdk/media/teapot.x new file mode 100644 index 0000000..06fccfd Binary files /dev/null and b/sdk/media/teapot.x differ diff --git a/sdk/media/tex1.ppm b/sdk/media/tex1.ppm new file mode 100644 index 0000000..051a39a Binary files /dev/null and b/sdk/media/tex1.ppm differ diff --git a/sdk/media/tex2.ppm b/sdk/media/tex2.ppm new file mode 100644 index 0000000..2bca8db Binary files /dev/null and b/sdk/media/tex2.ppm differ diff --git a/sdk/media/tex3.ppm b/sdk/media/tex3.ppm new file mode 100644 index 0000000..74a60fc Binary files /dev/null and b/sdk/media/tex3.ppm differ diff --git a/sdk/media/tex4.ppm b/sdk/media/tex4.ppm new file mode 100644 index 0000000..588b1e8 Binary files /dev/null and b/sdk/media/tex4.ppm differ diff --git a/sdk/media/tex5.ppm b/sdk/media/tex5.ppm new file mode 100644 index 0000000..19d1a0a --- /dev/null +++ b/sdk/media/tex5.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Jasc Media Center +256 256 +255 +!!)!!)!!)!!)!)1!)1!!)!!)!)1!)1!)1!)1))))))!!)!!))))))))!))!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)))1))1111))1))1))1))1))1))1))1))1111111111))1))1)))))))1))1))1))))))1))1))))1))1))1))1!)1!)1))1))1))1119119))1))1))1))1))1!)1))1))1111111111111111111111))))))1))1))))1))1))11111))1))1))1))9119119119119))1))1))1))1111111))1))1))1))1))1))1))1))1111111))1))1))1))1))1))1))1))1))111)19)19111111))1)19)19)19111111111111)19)19111111)19)19))1))1))1))1)19)19119119))1))1))1))1))1))1111111))1))1))))))))1))1))1))1))1))1))1))1))1)19)19)19))1))1))1))1))1))1)19)19)19)19))1))1)19)19!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!!)!!)!)1!)1!)1!)1)))))))))!!))))))))!))!!)!!)!!)))))))))))))))))))!!1))1))1))1))1))1))1))1))1))1))1))1111111111))1))1)))))))1))1))1))))))))))))))1))1))1))1!)1!)1))1))1))1))1))1))1))1))1))1))1!)1))1))1111111111111111111))1))))))1))1))))1))1))11111))1))1))9119119119999119111))1))1))1111111111))1))1))1))1))1))1))1111111119119111))1))1))1))111111111)19)19111111111)19)19119111111111111)19119111111111)19))1))1))1))1)19)19119119119))1))1))1))1))1111111))1))1))))))))1))1))1))1))1))1))1))1))1))1)19)19))1))1))1))1))1))1)19)19)19)19))1))1)19)19!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1))))))!)1!)1!)1!!))))))))))))))))))))!!)!!)!!)!!1))1)))))))))))1))1))1))1))1))1))1))1))1)))!!)))1))1))1))1))1))1))1))1))))))))))))))))))))))))))))1))1))))))))1))1!!)!!)))1))1))1))1111111))1))1!)1))1111111))1))1))))))))))))))))))1))1))))1))1))11111))1))9119119119199999999119111))1))1111111111111))1))1))1))1))1))1))1119119119119111))1))1))111119119))1))1119119119119119119))1))1))1))1119119119111111111)19)19119119))1)19119119119119)19)19111111))1))1119))1))1))1))1))1))1))1))))))))1))1))1))1))1)19)19)19)19))1))1))1)19)19))1))1)19)19))1)19)19!)9))1))1!)1!)1!)1!)1!)1!)1!)9!)9!)1!)1!)9!)9))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)))))))!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1))))))!)1!)1!!)!!)))))))))))))))1)))))))!!)!!1))1))1))))))))1))1))1))1))1))1))1))1))1))1)))!!)))1))1))1))1))1))1))1)))))))))))))))))))))))))))))))1))1))))))))1))1!!)!!)))1))1))1))1111111))1))1!)1))1))1111))1))1)))))))))))))))))))))))1))1))11111111))1))9119119119199999999199111))1))1111111111111111))1))1))1))1))1))1119119999999111))1))111111119119))1))1119119119119119119)19))1))1))1111119119119111111)19119119119111))1119119119119)19)19111111))1111119119))1))1))1111111))1))))))))1))1))1))1))1))1)19)19)19)19))1))1)19)19))1))1!)9!)9))1))1)19!)9))1))1!)1!)1!)9!)9!)1!)1!)9!)9!)1!)1!)9!)9))1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)))))))!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!)))))))))1))1))))))1))1))1))))))))1))1))1)))!!)!!1))1))9))9))1))1))1))1))1))1))111111))))))))))))))))))))1))1))))))))1))1))))))))1))1))1)))!)1!)1))1))1))1))1))1))1))1))1))1))1))1))1))1111111111111111111))1))1))1))11111119111111111))1119119199999999199111))1))1111111111111111111))1))1111111111119119999999111))1))111111111111119119111111119119))1))1119119119119111111119119))1))1119119)19)19111111111)19)19)19)19))1))1))1111111119)19))1))1))1111111))1)))))1))1))1))1))1))1))1)19)19)19))1))1))1)19)19))1))1!)9!)9!)9)19!)9!)9!)9!)1!)1!)1!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1))1))1))1))1!)1!)9!)9!)1))1))1!)9!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!)))))))))1))1))1)))1))1)))!!)!!1))1))1))1)))!!)!!1))1))9))9))1))1))1))1))1))111111))1))))))))1))1))))))))1))1))1))1111111)))))1))1))1))))))!)1!)1))1))1))1))1))1))1))1))1))1))1))1))1111111111111111111111111))1))11111119119111111111))9119119191191199199111))1))1111111111111111111))1))1111111111111119119111111))1))111111111111119119111111111119))1))1119119119119111111111119)19))1119119)19119111111))1))1)19)19))1))1))1))1111111119)19))1))1))1111111111))1))1))1))1111))1))1))1))1)19)19))1))1))1)19)19))1))1))1!)9!)9!)9!)9!)9!)9!)9!)1!)1!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1))1))1))1))1!)1!)9!)9))1))1))1!)9!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1))))))))))))!!)!!))!))!)))))))))))))1))1))))))!!1))1))1))1))1))1))1))1))1))1))9))9111))1))1))1))111111))1)))))1111))11111))))))))))1))1))1111111))1))1))1))1))))))))1))1))1))1))1))1!)1!)1!)1!)1))1))1))1))11111111111111111111111111111111111119119111111111119119199191111119119119111))111111111111111111111111111111))1))11111111111))1))1))1))111111119119119111111))1)19119119119119119119119119))1))1119119))1)19119119))1))1))1))1))1))1))1))1111111))1119119119))1))1119119119119111))1))1))1111111))1))1))1)19)19)19)19)19)19)19))1))1))1)19!)9!)9!)1!)1!)9!)9!)1!)1!)9!)9!)9!)9!)9!)9!)9!)1))1))1!)1))1))1))1!)1!)1))1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1))1))))))))))))!!)!!))!))!)))))))))))))1))1))))))!!1))1))1))1))1))1))1))1))1))1))9))9))1))1))1))111111))1))))))1111111111111111)))))))1))1111111111))1))1))1))1))))))))1))1))1))1))1))1!)1!)1!)1!)1))1))1))1))11111111111111111111111111111111111111119111111119199999999111111119119119))1))111111111111111111111111111111))1))11111111))1))1))1))1))111119119119111111111))1))1119119119119119119119119))1)19119119))1))1119119)19))1))1))1))1))1))1111111111)19)19119119111))1119119119119119119)19))1111111111))1))1))1)19119119119)19)19))1))1))1))1)19!)1!)1!)1!)9!)1))1))1!)1!)9)19)19!)9!)9!)9))1))1))1!)9!)9))1))1))1))1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!)!!)!!)!!))))!!)!!)!)1!)1!)1!)1))1)))))))))))))))!)1!)1))))))))))))))1111))))))1))1))1))1))1))1))1))1))1))1))1))1))9))9))9))1))111111))1)))))11111111111))1))111111111111111111111111))1))1))))))))1))1))1))1111111))1))1!)1!)1))1))1))1))1))))))111111))))))111111111111))1))11111111111111119191199999999119119119119))1))1))111111111111111111111))1))1))1))11111111119))9))1))1))1))111119119111111119119119111111111119119119119111111111119)19)19119119111))1119119119119)19)19119119111))1119119)19)19111111119119119919999119119111111111))1))1))1))1119119119119)19))1))1))1)19)19!)1!)1!)1!)1!)1!)1))1))1))1))1)19)19))1))1))1))1))1))1!)9!)9!)9))1))1))1))1!)1!)1!)1))1))1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!)!!)!!)!!)!!))!))!))!))!)!)1!)1!)1))1))))))!!)!!)))))))))1!)1))1))))))))1111111))))))1111))1))1))1))1))1))1))1))1))1))1))1))9))1))1))111))1))))))1111111111111))1))111111111111111111111111))1))1))))))))1))1))1))1111111111))1!)1!)1))1))1))1))1))))))111111))))))111111111111))1))11111111111119119991191199119119119119))9))1))1))111111111111111111))1))1))11111111111111119))9))1))1))1))11111111111111111919B119119111111119119119119111111119119)19)19119119))1))1119119119119)19119119119111))1119119)19)1911111111911991999999B99B119119111111))1))1))1119119119119119119))1))1))1)19))1!)1!)1!)9!)9!)1))1))1))1))1))1)19)19))1))1))1))1))1))1)19!)9!)9!)9))1))1!)9!)9!)1!)1))1))1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!)!!)!!)!!)!!)!!))!))!))!))!)!)1!)1))1)))))))))!!)!!)))))))))1))1111))1))1))1111111))))))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1)))))))1))11111111111111111))1))111111111111111111119119))1))1))))))))1))1))))))111111111))1))1!)1))1))1))11111111111111111111111111111111111111111111111119119119999991191111111111119))9))9))1))111111111111111111))1))1))11111111111111119))9))1))1))1))11111111111111111919B119119111111119119119119119119119119119119119119))1)1911919B119119119119119119119119))1))111911911911911911999999B9BB9BB119119119111))1))1119119119119119119119119)19)19))1))1))1)19)19)19))1))1))1))1)19)19))1)19)19)19)19))1))1))1)19)19!)9!)9)19)19!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!)!!)!!)!!)!!)!!)!!))!))!))))!!)!)1!)1))))))))))))!!)!!)))))))))1))1111))1))1))1111111))))))1111))1))1))1))1))1))1))1))1))1))1))1))1))1))1))))))))))11111111111111111))1))111111111111111111119119))1))1))))))))1))1))))))111111111))1))1!)1))1))11111111111111111111111111111111111111111111111119119119119111191191111111111119))9))1))1))111111111111111111))1))1))11119119111111119119111111111))1))11111111111111999999B119111111119119119119119119119119119119119119))1)1919B19B119119119119119119119119))1))111911999999911911999B9BB9BB99B119119119119))1))1119119119119119119119119119)19))1))1)19)19)19)19))1))1))1)19)19)19))1)1919B19B119)19))1))1119)19!)9!)9)19)19)19!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!)!!)!!)!!)!!)!!)!!))!))!)!!)!!)!!)!!)!!))))))))))!!)!!))!))))))))))))))))))))))1))1))1111111111111))1))))))))1))1))))))))))))))1))1))1))1)))!))!))))))11111111))1))111111111111111111))1))1111111))1))1))))))))1))1))1))1111111))1))1))1))1))11111111111111111111111111111111111111111111111111119119119119111191191111111111111))1))1))1))111111111111)19)19111111))11119119111111119119119119111))1))11111111111191999999B11911111111191991991911911911911911911911911911911919B19B119119119119119119)19)1911111111999999999911911999999B99B99B119119119119111111119119119119111111119119119119))1))1))1)19)19)19))1))1)19)19119119)1911911919B19B119119119119)19!)9!)9)19)19))1))1!)1!)1!)1!)1!)9!)9!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!)!!)!!))!))!)!!)!!))!))!)!!)!!)!!)!!)))))))!!)!!))!))!)))))))))))))))))))1))1111111111111111111))))))))1))111)))))))))1))1))111111))))!))!)))))))1111111))1))111111111111111111)19111111111111))1))1))1))1))1))1))1))1))1))1))1))1))11111111111111111111111111111111111111111111111111111119119119199191191199199111111111111))1))1))111111111111)19)19111111))11119119111111119119119119111))1))11111111111191999911911911111191991991999911911911911911911911911911911919B19B11911919B19B119119)19)1911111111999999999999911999999999B99B119119119999111111119119119119111111119119119119)19))1))1)19)19)19)19))1)19119119119)1911911919B19B19B119119119)19)19)19)19)19))1))1!)1!)1))1))1!)9!)9))1))1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!)!!)!!))!))!)!!)!!))!))!)!!)!!))))))))))))))!))!!)!!)!!1))1))))))))))))))1111111111111111111111))1))1))111111)))))))))1))111111111))1)))))))))111111111111111111111111111111119119119111111111111))1))1111111))1))1))1))1))1))1)))1))1))1))1))1))1))1111111111111111111119119111))1))911911911911999999919919999999911111111111111111111111))1))1))11111111111111111111111))1))9))9))9111111))1))1))1))1))11111911911111111911911999999911911911911111111911911911919B11911911911919B19B19B11911911911111111111111911999999B99B99999999B99B11911999999911911111911911911911911919B19B119)19)19)19)19)19)19)19)19))1111111119119)19)1911919B19B19J19B119)19)19)19)19)19)19)19!)1!)1!)1))1))1))1))1))1))1))1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!!)))))))))))))))))!))!))))1))1))1))))))))))))))1111111111111111111))1))1))111111111))1))))))1))111111))1))1))1)))11111111111111111111111111111111911919B119111111111111))1111111111))1))1))1))1))1))11))1))1))1))1))1))1))1))1111111111111111119119119))911911B9191199999999999999999BB99999911111111111111111111))1))11111111111111111111111111))1))9))9))9))1))1))1))1))1))1))11111911911111111999B11911911911911911911111111911911911919B19B11911919B19B19B19B11911911911911111111911911919B99B99B19B19B99B99B99B99B99999911911911911911911911911919B19B)19)19)19)19)19)19)19)19)19119111111119119)19)1911919B19J9BJ19B119)19)19)19)19)19)19!)9!)9!)1))1))1))1))1))1))1))1))1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!)!!)!!)!!)!!)!!)!!))))!!)!)1!)1))))))))))))))))))))))))1))1))))))))))))))))))))111111))1))11111))1))1))1))1))111111111))1))))))111111119119))111111111111111111111111111111111111911919B1191111))111111111111111111))1))1))11111111111111111))1))1))1))1))1))9111111111111))1))9))911911B91B91B91B99B999999999999B9BBBBBBB99911111111111911119111))11111191191111111119199199119119))1))1))9))9))1))1))1))1))1))1))11111111911999999911911911911999911911111911911911911911911911911919B19B19B11911911911911911911911911911999B9BB9BB99B99B9BB9BB9BB99B999119119119119119119)19119119119119))1))1119119111111)19)19119119119119119119))1)1911919B9BJ9BJ99B119119))1)19)19)19)19!)9!)9))1))1)19))1))1))1)19)19!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!)!!)!!)!!)!!)!!)!!)!!))))))))))!!)!!))))))))))))))))))))))))))))1))))1)))))))))))))))1))1)))))))))))1))1))1))1))1))111111111))1))))))11111111911911111111911911111111111111111111111111919B1191199111))111111111111111111))1))11111111111111111111111))1))1))1))1119119111111111))1))9))9))B91B91B91B99B99B999999999B9BBBBBBBBBB99B999111119119191191111111119199191111119199199199199111))1))1))9))9))1))1))1))1))1))1))1))11111999999999999911911911991991911911911911911911911999911911919B19B11911911911911911911999B99B99B99B9BB9BB9BB9BB99B9BB9BJ9BJ9BB19B119119119119119)19)19119119119119))1))1119119111111119119119119119119119111))1)1911919B9BJ99B19B119111))1)19)19)19)19!)9!)9))1))1!)9!)9))1))1!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!)!!)!!)!!)!!)!!)!!))!))!)))))))!!)!!)))))))))))))))1))1))1))))))))1111))1))1)))))))!!)!!))))))))))!!)))1))1))1))1))111111))1))))))1111111191191199119111191191111))91111111111111199999B99B9999199119119111111111111111111111111111111111119119111111111))1))1111119119199191111111))9))9))B91B91J99B99B99999B99B99BBBBBBB99B99B99B999999991191191111111119199199119111111191199199191111))1))1))1))1))1))1))1))1))1))1))1))11111991999999999911911999999991911911911911911911999B99B11911919B19B11911911919B19B19B19B99B99B9BB9BB9BB99B99B9BB9BB9BB9BB9BJ9BJ19B119119119119119119119119119119119119119119119119119119119119119119119119))1))1)1919B19B19B19B119119)19)19)19)19)19)19!)9!)9))1))1!)9!)9!)1!)1!)9!)9!)1!)1!)1!)1))1))1!)1!)1!!)!!)!!)!!)!!)!!)!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)))))))!!)!!)!!)!!))))!!))))))))))!!)!!)))))))))))))))1))1))))))))))))1111))))))))))))!!)!!)!!)!!)!!)!!)!!1))1))1))1))111))1))))))1111111191191191199119199991191111))91191111111191999999B99B9999999999999119111111111111111111111111111111119119111111111111111111119119199199191111))9))911911B91J99B99B99999B99B99BBBBBBB99B99B99B99B99999119))11111119199199119119119191191199199191111111111))1))1))1))1111))11111111111111191999999999911911911911999999911911911911911999999B99B11911919B19B19B99B19B19B19B19B99B9BB9BJ9BJ9BJ9BB99B99B9BBBBB9BB9BB9BJ99B99B119119119119119119119119119119119119119119119119119119119119119119119119))1)1911911919B19B19B119119)19)19)19)19119)19)19!)9))1))1)19!)9!)1!)1!)9)19!)1!)1!)1!)1))1))1))1!)1!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!))))))))))!!)!!))))))))))!!)))))))!!)!!)))))))))))))))1))))!))!!)!!))))))))))!!))))))))))!!)!!)!!)!!)!!)!!1))1))1))1)))))))))))1111119199199199199119119119999111111))1))9119199199199199999999B99999999199199111111))111111911911111111111911911911911911911911911911911911911911911911911911911B91B91B91B91B99B99B99J99J99J99B99B91999B99999111))11111119199191111119119191191199199119119119119111))1))1))11111191191191191999999B99B9B99B919B19B19B19B99B99B9991191191191199999B99B999911919B99B9BB9BB99B99B9BB9BB9BB9BB9BJ9BJ9BJ9BB99B99B9BB9BB9BB9BB9BB99B99991999B99B99911911911911911911911911911911911911911911911911911911911911911911911911911919B19B19B19B19B)19119119119119)19))1))1))1)19)19!)9!)9)19)19))1))1!)1!)1))1))1))1))1)))))))))))1))1))1!!)!!)!)1!)1!)1!)1!!)!!)!!)!!))))))))!))!)!!)!!)!!))))))))))!!)!!))))))))))))))))))))))))))!))!!)!!)!!)!!)!!1)))))))))))))))!!)!!)!!)!!1))1))9119))1)))))))11111119199199199199119119119119119111))1))1))911999BBB999919999B999B99999999199199111))1))111111911911111111911911911911911911911911911911911911911911911911911911911911B99B91B91B91B99B99JB9J99J99J91B9191199991911111111111191991911111191991911911991191191191191991191111111111999999999999999999999B99B9B99B919B19B19B19B99B99B9991191191199199999B99B999911999B99B9BB9BB9BB99B9BB9BBBBB9BJ9BJ9BJ9BJ9BB99B99B9BB9BB9BJ9BB9BB99991999999B99B99991911911911911911911919B19B11911911911911911999999B19B19B11911911911911919B19B19B19B19B19B19B11911919B19B119))1))1))1)19)19)19)19)19))1))1))1!)1!)1))1))1))1))1))))))))1))1))1))1)))!!)!)1!)1!)1!)1!!)!!)!!)))))))))))!))!)!!)!!)!!)!!)))))))!!)!!))))))))))))))))1))1))))))))))))!!)!!1))1))1))111))))))1))1)))!!)!!)))1))9119111111111119119199199199199119119119119199119111))1))1))1))91199BBBBBBBBBBBBBBBB99B9999999199199119))9))911911911911911911911911911911911911911911911911911919919919911911911911911911B99B99B91B91B99B99BBBJB9J91J91B9191191991991191191191191191191111111999999991191191191191191191191199999B9BB9B99B9BBBBBB99991991999999911999B99B99B99B99B99B11911999999999911999B99B11911999B99B99B99B9BB9BB9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJBBB9BB9BB9BJ9BJ9BB9991199999BB99B99991111911911999B99B99B99B99B99B99911911911911999B9BB99B19B19B11911911919B19B19B19B19B19B19B19B11911919B19B)19))1)19)19)19)19)19)19)19))1))1))1!)1!)1))1))1))1))1))1))1!)1!)1))1))1))1))1))1))1!)1!!)!!)!!)))1))1)))))))!))!)!!)!!))!))!)))))))))))))))1))1))))))1))1))1))1))))1)))))))))1))111111))1))))))))11)))!!)!!1))1119119111111111119119199199199199199119119119199199111))1))1))1))911BBB9BJBBBBBBBBBBBBBBB9999119119119119))9))9119999119119))9))911911911911911911911911911911911911919919911911911911911B99B99B99B99B99B99B99B99B99J91B91B91999999919911911911911911911911919119999999911911911911911911911911B99BBBBBB9BB9BBBBBBBB99991991999911911999B99B99B99B99B99B99999999999999911999B99B99B99B99B99B99B99B9BB9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BB9BB9BJ9BJ9BB99B11999B9BB9BB99911911911999B9BB9BJ9BJ9BJ9BJ99B99B1191191191199BB9BJ9BJ9BJ19B19B11999B19J19J19B19B19B19B19B19B11911911919B)19)19)19)19)19)19)19)19))1))1))1))1))1!)1))1))1))1))1))1))1!)1!)1))1))1))1))1))1))1!!)!!)!!)))1))1))1)))))))!))))!!)!!))!))!))))))))))))1))1))11)))))))))))111111))))))))))))1))1))))))))1))1)))))))))!!)!!1))1111111111111111111119119199999999199199119199999999111))1))1))9))B99B99BBBBBBBBBB99B99BBB9999119))9119119))9))9119999119111))1))911911911911911911911911911911111111111919911B91B91B91B91B99B91B99B99B99B99B99B99B91B91B919B99B9B99999911911911911911911919919999999911911919919911911911911911B99B9999B99B9BB9BB99991991999999999911999B99B99B99B99B99B9999999999991191199B99BB9BB9BB9BB9BB9BB9BB9BJ9BJ9BJ9BJ9BJBJRBJR9BJ9BJ9BJJJJJJJBBB9BB9BB9BB99B19B11999B9BB9BB99911919B99B9BB9BJ9BJBJRBJR9BJ9BJ19B19B11911999B9BJ9BJ9BJ9BJ19B19B99B9BB9BJ19J19J19B19B19B19B19B119119119119)1919B19B19B19B)19)19)19))1))1)19)19))1))1))1))1))1))1))1))1))1))1))1))1))1))1!)1!!)!!)!!)))1))1))1))1))))))))))))))))))))))))))))))111111))))))1))1))))))))111111))))))))))))1))1))))))))1))1)))))))))))1))1))1))1))1))1111111111119119999999999191119119199999999119))1))1))911B99BBBBBB9BJBBBB99B99BBBB999119))9119119))9))9119119119111))1))911911911911911911911911911911111111911911B91B91B91B91B99B99B91B91B99BBBBBBB99B91B91B91B999B9B99B99B99911911911B91B919999199199999999999999199999999119))9))91199999999999B99B9B99B99999999B99B911911999B99B99B99B99B99B9999999999999999999999BB9BB9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJJJJBJRBJR9BR9BJ9BJBBBJJJJJJ9BJ9BB9BB9BB9BB99B11999B99B99B99919B9BJ9BJ9BJJJJBJRBJRBJR9BR9BJ19B19B1199999BB9BJ9BR9BR9BJ19B19B9BB9BJ9BJ19J19J19B19B19B19B19B11911911911919B19B19B19B19B19B19B)19)19))1)19)19))1))1))1))1))1))1))1))1))1))1))1))1))1))1)))!!)!!)!!)))1))1))1))1))1))))))))))))))))))))))))))1111111))))))111111))))))111111))1))))))1))1))1))))))))1))1)))))))))))1))1))1))1))1))1))1111119199999999999991111111119119999119))9))1))9))911B99BBBJJJ9BJBBBBBBBBBB99B999119119))9))9))9))9))9119119119))9))911999919919919911111111911911911911911911B91B91B91911B99B99B99B99JB9BBBBBBB99B91J91J99B99B99B99B99B99911911B99B99B99B999999999199199999999999999999119))1))91199999999B9999999B99B999B99B9BB99B11911999B9BB9BB9BB99B99B1199999999B999B99B99B9BB9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BRBJRBJR9BR9BJ9BJ9BJBJRBJR9BJBBB9BJ9BJ9BB99B99B99B99999999999B9BB9BJBJRBJRBJRBJR9BR9BR9BR19J19B11999999B9BJ9BR9BR9BJ19B11999B9BJ9BJ19J19B19B19B19B19B19B19B)1911911911919B19J19J19B19B119119)19)19)19)19)19))1))1))1119119))1))1))1))1))1))1))1))1))))))!!)!!)))1))1))1))1))1))1111))1))1))1))))))))1))1))1)))))1))1111111))))))111111)))))))))1))1))1))))))))1))1))))))))1))1))1))1))1))1))1))91191191999999B9999991111111119119119119))9))9))911911B99BBBJJJBBBBBBBBBBBBB99B999999119))9))9))9))9))9))911911911911911999999919911911911111911911911911911911B91B99B91999B99B99B99B99B99JB9B99J91J91J91JB9BBBB99B99B99B99911911B99B99B99B99B999999199199999999999999119111111119119199999999999999999B999B99B99B99B11911999B9BB9BB9BB99B99B1199999B99BB9BB99B99B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJBJRBJRBJRBJRBJR9BR9BJ9BJBJRBJR9BJ9BJ9BJ9BJ9BJ9BB9BB99B99999999B9BB9BJJJJBJRBJRBJRBJRBJZBJZ9BR9BJ99B99999999B9BJ9BJ9BJ9BB99B99B9BJ9BJ19J19J19B19B19B19B19B19B19B19B11911919B19B19J19J19B119119119)19)19)19)19)19)19))1))1111119)19))1))1))1))1)19)19))1))1)))!!)!)1))1))1))1))1))1))1111111))1))1)))))1))1))1))))))))1))11111111111111111))))))!!)!!)))1))1))))))!!1))1)))))))))))1))9))9))1))1))1))111911919999999999999911111911911911911911911911B91B91B91B99BBBJB9JB9B99B99B99B99B91B919))9))9))9))9))9))9))911911919B99B99999911911B91911911911911911911911B99B99B99B99B99BBBBBBB99B99B99B99B99J91J91J91JB9BBBB999B9B99B99B91B999B9B99B99B999999999199199199999999119111))11191191191191199999999999999999999999999999999999B99B99B99B9999999999B999B99B99B99B99B99B9BB9BJ9BB9BJJJJJJJ9BJ9BJJJJBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJR9BJ9BJ9BJ9BJ9BB9BB9BB9BB9BB9BJ9BJ9BRBJRBJRBJRBJZBJZBJZBJZ9BR9BJ99B99B99B9BJ9BJ9BB99B9BB9BB9BJ19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19))1))1))1)19)19)19))1))1)19)19119111))1))1!)1!)1))1))1))1))1))))))111111111))1))1))1111111))1))1))1)))111111111111111))))!!)!!)!!)))1))1))1))1))1))111)))))))))1))9))9))1))1))1))111919999999999999999999911911911999999999911B91B91B91B91B91B99J91J91B99B99B99B91B91B919))9))9))9))J91J91J91B91919999B99B91B91B91B91B91B91911911911911911911B99B99B99B99B99BBBBBBB99B999B9B99B91J91J91J91JB9BBB9B9999B99B99B91B999B99B9B99B9999999999991991191191191191111191191191191191191199999999999999999999B99999999B99B9BB9BB99B99BB99B999B999B99B99B99B99B9BB9BB9BB9BBBBBJJJJJJ9BJ9BRJJJBJRBJRBJRBJRBJRBJRBJRJJJJJJBJRBJRBJR9BJ9BJ9BJ9BJ9BB9BB9BB9BB9BB9BJ9BJBJRBJRBJRBJZBJZBJZBJZBJR9BJ9BB99B9BB9BJ9BJ99B99B9BB9BJ9BJ19J19B11919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19))1))1))1)19)19))1))1)19119119119))1))1!)1!)1))1))1))1))1))))))))1111111111))1))1111111))1))1))))))111111111111))1))))!!)!!)!))))1))1))1))111111111))))))1))1))1))1))1))1))111111919999999999999999999999B99B99B99999919919B99B99B99B91B91B91B91B91B99B99B91B91B919119119))9))J91J91J91J91B91B99999B91B91B91B91B91B91B91B91911911911911911999B99B99B99B99B99BBBB999B9999B99J91J91J91J91B99B99B99B91B91B91B91B91B99B999999999B999999991999991191191191991991191191191191191199999999999BBBBBBB9BB99B99999BBBB9BJ9BJ9BJ9BB9BB9B99B999B99B99999999B9BBBBBBBB9BBBBB9BJ9BJ9BR9BRBJRBJRBJRBJRBJZBJZBJZBJRJJJJJJBJRBJRBJRBJRJJJJJJ9BJ9BJ9BB9BBBBBBBB9BB9BJBJRBJRBJRBJRBJZBJZBJRBJR9BJ99B9BB9BB99B99B99B9BJ9BJ9BJ9BJ19J99B11919B19B19B19J19J19B19B19B19B19B11911911919B19B19B19B19B19B19B19B)19119119119119119119119119))1))1119119119111))1!)1!)1!)1))1))1))1))1))1))1))))))111111))1))1)))))1))1))1))))))111111111111)))))))!!)!))))))11))1))111111111111))1)))1))1))1))1))1))1))1))111999B9999999999B99B999B99B99B99BBBBBB919919999B99B99B99B99B91B91B91B99B91B91B919119119119))B91J91JB9J91J91J91B99B99B91B91B91B91B91B91B91B91B91911911911911B99B99B99B99B99B99B99B99B99B99B99J91J91J91J91JB9B99B99B91B91B91B91B91B99B999999999B99B9B99B999999119119199999999999119119119119999B99B9999999BBB9BJ9BJ9BB99999BBBB9BJ9BJ9BJ9BB9BB9BB9B99BB99B99B99B9BB9BBBBBBBB9BB9BB9BJ9BJBJRBJRBJRBJRBJRBJZBJZBJZBJZBJRJJJJJJBJRBJRBJZBJRBJRJJJ9BJ9BJ9BJBBBBBBBBBBBB9BJBJRBJRBJRBJRBJRBJRBJR9BJ9BJ9BJ9BJ9BB99B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ99B19B19B19J19J9BJ19J19B19B19B19B11911919B19B19J9BJ19B19B19B19B19B19B119119119119119119119119119111119119119)19))1))1!)1!)1))1))1))1))1))1))1))))))111111))1))1))))))))1))1))))))1111111111))))))!!)!!)!)))11111))1))))))))1))1))1111111))1))1))1))1))1))1))111999BBB99999B9BB9BB99B999999BBBBBBBBB999919999B99JB9JB9B99B99B99B91B91B91911911B91B91911B91J91J99JB9JB9JB9JB9JB9J99J91B91B91B91B91B91B91B91B91B91B99B99B99B99B99B91B99B99B99B99B99B99B99B99J91J91J91J91JB9BBBB99B91B91B91B91B91B99B999B99B99B99B9B99B99B999119119999B99B9999911B91B999999999B99B9911999BBB9BJ9BB99B9999999BB9BJ9BJ9BB99B99B99B9BB9BB9BJ9BB9BB9BB9BB9BJBBB9BB9BJBJRBJRJJJBJRBJRBJZBJZJJZBJZBJZBJZBJRBJRJJJBJRBJRBJRBJRBJRJJJ9BJ9BJJJJ9BJBBBBBB9BJBJRBJRBJR9BR9BJBJRBJR9BR9BJ9BJ9BJ9BJ9BJ99B9BJ9BJ9BJ9BJ9BJJJJJJJ9BJ9BJ9BJ19J19J19J9BJ9BJ19J19B19B19B19B19B19B19J9BJ9BJ9BJ9BJ9BB99B99B19B11911911911911911911919B11911911911919B)19))1))1))1))1))1))1))1))1))1))1)))1))111111))1)))))))))))))))))11111111111))1))1)))!!)!!)))1))1111))1))))))))1))1))1111111))1))1))1))1))1))1))91191999999999B9BB9BB999999999B99BBBBBB999919B99B99JB9JB9B99B99B99B91B91911911999B91B91B91B91J99J99J99J99JB9JB9JB9JB9J91B91B91B919))9))B91B91B91B91B99B99B99B99B99B91B99B99B99B99B99BBBBBBJB9J91J91J91J91JB9B99B99B91J91J91B91B91B99B999B99B99BBBBBB99B99B999119119999B99B9999999B99B99B99B999B99B9911999BBB9BJ9BB9999999999BB9BB9BB9BB9999999999BB9BJ9BJ9BB9BB9BB9BJ9BJ9BJBBB9BJBJRBJRBJRBJRBJZBJZJJZJRZJRZBJZBJZBJZBJRJJJBJRBJRBJRBJRBJRJJJ9BJJJJBJRJJJ9BJ9BJBJRBJRBJRBJR9BJ9BJBJRBJR9BJ9BJ9BJJJJJJJ9BJ9BJ9BJ9BJ9BJ9BJ9BJJJJBJRBJR9BR9BJ9BJ19J9BJ9BR9BJ9BJ19J19B19B19B19B19J9BJ9BJ9BJ9BRBJR9BJ9BB9BB99B19B19B11911911911919B19B19B11911911919B19B)19))1))1))1))1))1))1))1))11111111))111))1))))))))))))))))))1111111111))1))1))1))))))!!)!!1))1111))1))1))1))1111111))1))1))1))))))))1))911911911919919919999BBBBBB999919999B99B99B99911B91B99J99B99B99B91B91B99B919))911999B99B91B91B91J91J91J91J91J91J91J91JB9J91B919))9))9))9))9))B91J91J91J91J99B99B99B99B99JB9J99B99B99B99BBBBBBBBBJB9J99J91B91B91B99B99B99B91J91J91B91B91B91911911999BBBBBBB99B99B99B99999999B99B999B99B99B9B99B99B999B99B999999B9BJ9BJ9BB9999999999B99BB9BB9B99B99B99B99BB9BJ9BJ9BB9B99BB9BJBJRBJRJJJJJJJJJBJRBJRBJRBJZBJZBJZBJZBJZBRcBRcBJZBJRJJJBJRBJRBJRBJRJJJJJJJJJJJJBJRBJR9BJBBB9BJ9BJBJRBJR9BJ9BJBJRBJR9BJ9BB9BJ9BJBJR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJBJR9BR9BR9BR9BR9BJ9BJ9BR9BR9BJ9BJ9BJ19J19B19B19J9BJ9BJ9BJBJRBJRBJR9BJ9BJ9BJ19J19B19B119119)1919B19B19B11911911919B19B119111))1))1))1))1111111111111111111))))))))11111111111111111111111))1))1))1))1))1))1))1))1))1))1))1))1))1))1111111111))1))1))1))1))1))911911919919919911919B99B99919999B99B99B99B99911B91J99J99B91B91B91B99B99B91911911B91B91B91B91J91J91J91J91J91J91J91J91J91J91B919))9))9))9))9))J91J91J91J91J91J99B91B99JB9JB9JB9J99B99B99BBB9BJBBBBBBJB9B99B91911911911911B919))J91B91B91911911911999BBBBBBB99B99B99B99999999B99B999B99BB9B9999B99B999B99B999999BBBBBBB9BB9B99999999B99B99B99B99B99BB9B99BB9BJBBB9BB9B99BB9BJBJRBJZBJRJJJJJJBJRBJRBJZBJZBJZBJZBJZBJZBJZJRZBJZBJRJJJBJRBJRBJRBJRBJRJJRJJJBJRBJRBJRJJJJJJ9BJ9BJ9BJ9BJ9BJ9BRBJRBJR9BJ9BB9BJ9BJBJRBJR9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BRBJRBJR9BR9BJ9BJ9BR9BJ9BJ9BJ9BJ9BJ19B19B9BJ9BJ9BJ9BJBJRBJZBJR9BR9BJ9BJ9BJ19J19B119)19)1911919B19B11911911919B19B119119)19))1))1111111111111111111111))))))1111111111111111111111111))1))9119111111))1))1))1))1))))))))1))1111111111111111))1))1))1))1))911911999999919111911911B99999999B99B99B99B99B99B91B91B91B91B91J99JB9B99B91B91B91B91B91B91B91J91J91J91J91J91J919))9))B91B919))J91J91J91J91J91J91J91J91J91J91J91J99B99JB9JB9JB9B99B99B99BBBBBBRJBRJBBBBB99B919))911911911B919))9))B91B919119119999999BBBBBB99B99B99B999B99999999999B99B9999911911911B99B999999B99BB9BB9B99B99B99B99B99B99B99B99BB9BB9BB9BBBBBBBB9BB9BB9BB9BJ9BRBJZBJRJJRJJRJJRJJZJJZJJZJRZBJZBJZJJZJJZJJRJJRJJJJJJBJRBJZBJRBJRBJZJRZJJRBJRBJRBJRBJRBJRBJRBJR9BJ9BJBJRBJRBJZBJR9BJ9BB9BJBJRBJRJJJ9BJ9BJ9BJ9BJ9BJ9BJBJRBJRBJRBJRBJRJJJ9BJ9BJ9BR9BJ99B99B9BJ9BJ19B19B99B9BJ9BJ9BJ9BRBJR9BR9BR9BJ9BJ9BR9BJ19B11911911911919B99B11911911911919B119119))1))1119111111111111111111111))))))1111111111111111111111111))9119199199119))9111111111))))))))1))1111111111111111))1))1))1))1))911911B99BBB9999111))911999999B99B99B99B99B99B99B99B91B91B91B91JB9JB9B99B99B91B91B91B91B91B91J91J91J91J91J91J919))9))B91B91J91J91J91J91J91J91J91J91J91J91J91J91JB9BBBBBBBBBJB9B99B99BBBBBB9BJJJJRJBBBBB99B919))911911911911911B91B91B9191199999999B9B9B99B99B99B99B999B99B999B9999B9999911911911999B99B99B999B99B99B99B99B99B99B99B99BB9B99BB9BB9BJ9BBBBBBBBBBBBBB9BB9BB9BJBJRBJRJJRJJRJRZJRZJRZJJZJJZJJZBJZBJZJJZJJZJJRBJRBJRBJRBJRBJRBJRBJZJRZJRZJJRJJRBJRBJRJJRJJRBJRBJR9BB9BJBJRBJZBJZBJR9BJ9BJ9BJBJRBJRJJJ9BJ9BJJJJJJJ9BJ9BJBJRBJRJJJJJJJJJ9BJ9BJ9BJ9BJ9BJ99B99B9BJ9BJ19B19B19B9BJ9BR9BR9BR9BR9BR9BJ9BJ9BJ9BR9BR19J19B11911911999B99B99B119119119119119119))1))1119119111111119119111111))))))1111111111111111111111119119119199199119119119111111))1))1))1))1))1111111111))1))1))1))1))1))111999BBBBBBB99911911911911B99B99B99B99B99B99B99B99B99B91B91B91B99B99J99J99B99B99B99B99B91B91J91J91J91J91J91J91B91B91B91B91J91J91J91J91J91J919))B91J91J91J91J91JB9RJBRJBRJBJB9B99BBBBBB9BJ9BJ9BJBBBBBBJB9B91911911911911911911B91B91B91911911999B99B99B99BBBJB9B99B999B99BB9BB99B999911911911B91B99999B99B99B999BB99B99999999B9BB9BB9BB9BB9BB9BJ9BJBBBBBBBBBBBB9BJ9BJ9BJ9BJBJRJJRJJRJJRJRZJRcJRZJRZBJZBJZJJZJJZJRZJRZBJRBJRBJRBJRBJRBJRBJRBJZJRcRRcJRZJJRJJZJJRJJRJJRBJRJJJ9BJ9BJBJRBJZBJZBJR9BJ9BJ9BJBJRJJRJJRBJR9BJJJRJJJJJJ9BJBJRBJRBJR9BJ9BJ9BJ9BR9BR9BJ99B99B99B19J19J99B99B19B19J9BRBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BJ19B11911999999B9BJ9BJ19B119119119119119))1))1119119911911119119111111111111119119111111111111))1))19199199199199119119119111111))1))1))1))1))1111111))1))1))1))1))1))1))911999BBBBBBBBB999911911919B99B99B99B99B99B99B99B99B99B99B91B91B99B99J99J99B99B99B99B99B91B919))J91J91J91J91B91B91B91B91B91J91J91J91J91J91J919))9))J91J91J91J91JB9RJBRJBRJBJB9BBBBBB9BJ9BJ9BJ9BBBBBBBBBBBB99B91B91911911919999999B99B999119999B99B9B99BBBBBBBBBB99B999B99BB9BB9BB999911999B99B99B999B99B9B99B9999B99B99999999B99B9BB9BJ9BJ9BJ9BJ9BJ9BJBBBBBB9BJ9BJ9BJ9BJJJJJJRJJRJJRJJRJRZJRcJRZJRZBJZBJZJJZJJZJRZJRZBJZBJRBJRBJRJJJJJJBJRBJZJRcRRcJRZJJZJRZJJZJJRJJJJJJJJJ9BJ9BJBJRBJZBJZBJR9BJ9BJBJRBJRJJZBJZBJRBJRJJRJJRJJJ9BJBJRBJRBJR9BJ9BJ9BJ9BR9BR9BJ9BJ99B99B19J9BJ99B99B19B19J9BRBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BJ9BJ19B19B99B9BJ9BJ9BJ19B119119119119119))1)19119119911919119119111111111111119119111111111111))1))19199199199191111111111111111111))1))1111111111))1111111))1))1))1))111911999B99BBBBBB999919919919B99BBBBBBBBBBBBBBBBBBBBBB99B99B99B99B99B99B99B99B99911911911B91B91B91B91J99J99B91B91J91J99B91B91J91J91J91J91J91J919))J91J91J91J91J91J91JB9JB9BBBBBBBBBBBB9BJ9BJ9BJ9BBB99BBBBBBJ91B91B919119999999999B99B99B99B99B99B99B99B9BBBBBBBBBB99B999B99BBBBBBBB999999BBBBBBB999B99B99B99999999999999999B9B99BBBBBB9BJ9BJ9BJBBBBBBJJJJJJJJJ9BJBBBBBB9BJBJRJJRJJZBJRBJRJRZJRcJRZJRZBJZBJZBJZJRZJRZJRZBJZBJZJJRBJRBJRBJRBJRJJZJRZJRZBJZBJZJRZJJZBJR9BJ9BJ9BJJJJJJJBJRBJRBJRBJR9BRBJRBJZBJZBJZBJRBJRBJRBJRBJR9BJ9BJJJJBJRBJRBJR9BJ9BJ9BR9BR9BR9BJ19J9BJ9BB9BB99B19J19J9BJ9BRBJZBJRBJR9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19B1191191191191191191191191191191191191191111111111111111111111111111111111119199199199111111))1))1))1111111))1))1111111))1))1111111111))1))111111999B99B99BBBBBBBBB999919999BBBBBBBBBBBBBBBBBBBBBJB9B99B99B99B99B99B99B99B99911911911B91B91B91B91B91J99J99B91B91J99J99B91B91J91J91J91J91J91J91J91J91J91J91J91J91J91JB9JB9BBBBBBBBBBBB9BJ9BJ9BJ9BBB99BBBJB9J91J91B9199999999B9B99B99B99B99B9B99B99B999B99B9BBBBBBB99B999999B9BBBBBBBBBBBBBBBBBBBBB9BB9BB9BB99B99B9999999B9BBBBBBBBB9BJ9BJ9BJ9BJBBBBBBJJJBJRBJRJJJBBB9BJJJJJJRJJZJJZBJRBJRJJZJRZJRZJRZJRZBJZBJZBJZJRZJRZJRZJRZJJRJJRBJRBJRJJZJRZJRZJRZBJZBJZJRcJRZJJJ9BJ9BJJJJJJJBJRBJRBJZBJZBJR9BRBJRBJZJRZBJRBJRBJRBJRBJRBJR9BJJJJJJJJJJBJR9BJ9BJJJJ9BR9BR9BR9BJ19J9BJ9BB9BB9BJ19J9BJ9BJ9BRBJRBJRBJR9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19B19B1191191191191191191191191191191191191111111111111111111111111111111111119199199199111111))1))1))1))1111))1))1))1111111111111111111111))1))111911B99B99BBBBBBBBBBBB999999BBBBBBBBBBBBBBBBBBB99B91B99B99BBBBBBJB9B99B99999911911B99B99B91B91B91B91J91J91B91B91B91B99911911J91J91J91J91J91J91J91J91J91J91J91J91J91JB9JB9BBBRJBRJB9BJ9BJ9BJ9BJ9BJBBBJB9J91J91J91B999999999999B99B99B99B9B99B99JB9B99B99B99B99B99B99B99911999B99BBBBBB9BJBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB9BJ9BJJJJJJJJJJBBBBBBJJJBJRJJJJJJJJJJJJJJRJJZJJZJJZJJRJJRJJZJJZJJZJJZJRZJRZJRcJRcJRZJRZJRZJRZBJZBJZBJRJJRJJRJJZJRZJRZJJZJJZJRZJRZJJRJJJJJJJJRBJRBJRBJRBJZBJZBJZ9BRBJRBJZJRZJJRJJRBJRBJRBJRBJRBJRBJRBJRJJRJJJJJJ9BJ9BJ9BR9BR9BJ9BJ99B99B99B9BJ9BJ9BJ9BJ9BJBJRBJZBJZBJR9BR9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J119119119119119119119119119119119119119119119119111111119111111111))1)199199119119111111))1))1))1))1))1))1))1))1))111111111111111111111911911911B99B99BBBBBBBBBBBB99999BBBBBBBBBBBBBBBBB99B99B91B99B99BBBBBBBBBB99B99999999999999B99B91B91B91B91J91J91B91911B91B91911911B91J91J91J91J91J91J91J91J91J91J91J91J99JB9JB9BBBRJBRJBJJJ9BJ9BJ9BJ9BJBBBJB9J91J91B91B999999999999999B99BBBBBB99JB9JB9JB9B99B99B91B91B99B99B99911B91B999BJ9BJB99B99BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB9BJ9BJ9BJJJJJJJ9BJBBBBBBJJJJJJBJRJJJJJJJJJJJRJJZJJZJJZJJRJJRJJZJJZJJZJRZJRZJRZJRcJRcJRcJRZJRZJRZBRcBJZJJRJJRJJZJRZJRcJRZJJZJJZJRZJRZJRZJJRJJRBJRBJRBJRJJZJRZBJZBJZBJRBJRJJZJRZJRZJJRBJRBJRJJRJJRBJRBJRJJRJJRJJRJJJ9BJ9BJ9BR9BR9BJ99B99B99B9BJ9BJ9BR9BJ9BJ9BJBJRBJZBJZBJZBJRBJR9BR9BR9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BJ99B99B99B99B19B19B119119119119119119119119119119119119119119111111))1)191111111111111111111))1)))))1))1))1))))))))111111111111111111111911911999B99BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBJ99J99B99B99BBBBBBBBBB99B91B91B9999B999999B91B91B91B91J91J919119))9))B91911B99B91B91J91J91J91J91J91J99J99J99B91B91JB9JB9JB9JB9BBBRJBJJJ9BJ9BJBBB9BBB99B99B91B91B91B919999999999999999BBBBBBBBJB9JB9B99B99B99B91B91B99B99B99B99911999BBBBBBB99B999B99BB9BB9BB9B99BBBBBBBBBBB9BBBBB9BJ9BJ9BJ9BJ9BJ9BB9BBJJJJJRJJRJJRJJJJJJJJRJJRBJRBJZJRZJRZBJZBJZJRZJRZRRZRRZJZcJRcBRcBRcBJZBJZJRZJRZJJZJJRJJZJRZJRcJRcJRZJRZJRcJZcJRZJJZBJRBJRBJRBJRJRZRRZJJRBJRJJRJJRJRZJRZJJZJJZJJRJJRJJRJJRJJRJJRJJRJJRJRZBJZBJRBJR9BR9BR9BJ9BB9BJ9BJ9BJ9BJ9BR9BR9BJ9BB9BJBJZBJZBRcBJZBJZBJR9BR9BR9BRBJR9BR9BR9BJ9BB9BJ9BJ9BRBJR9BR9BJ9BJ9BJ9BJ9BJ19J19B11911911911911911911911911919B19B1191111111111111111111111))1))1111111111))))))!!1))))))))))1111111111111111111911919911999BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB99J99J99B99B99JB9BBBBBBB99B91B91B99BBB999919B91B91B91B91J99B999119))9))B91B99B99B99B99B99J99J91J91JB9JB9JB9BBBB99B99JB9JB9JB9BBBBBBBBB9BJ9BJ9BJBBB9BB999999B91B91B9191191199999999999B9BBBBBBBBB99B99B99B99B99B91B91B99B99B99B99911999BBBBBB9119119B99BB9B99B99B9BBBBBBBBB9BB9BBBBBBBB9BJ9BJ9BJ9BJ9BB9BBJJJJJRJJRJJRBJRJJRJJRJJRBJRBJRBJZJRcJRZJRZJRZJRcRZcRZcJZcJRcBRcBRcBJZBJZJRZJRZJJZJJZJRZJRcJZcJZcJRcJRcJZcJZcJRcJJZBJZBJRBJRBJZJRZRRZJJRJJRJJJJJRJRZJRZJRZJJRJJRJJRJJRJJRJJRJJRJRZJRZJRcJRZBJRBJRBJR9BJ9BJ9BJ9BJ9BJ9BJBJRBJRBJR9BJ9BB9BJ9BRBRcBRcBJZBJZBJZ9BR9BRBJRBJRBJR9BR9BJ9BB9BJ9BR9BRBJRBJR9BJ9BJJJJBJR9BJ19J19B11999911911911911911911919B19B19B1191191111111111119111111111))1))1111111111))1)))!!))))))111111111111111111919919919999999BBBBBBBBBBBBBBBBBBBBBBBB99B999B99B99B99B99B91B91B91B91J99J99BBBBBBB99B91B99B99999919B91B91J99JB9B99B91B919))9))B91B99B99B99B99B91B91B91B99JB9BBBJB9B99BBBBBBJB9JB9BBBBBBBBBBBB9BB9BJ9BJ9BJ9BB99B9999119119119119119999BB9BB9BB9BBBBBBBBB99B99B99B99B99B91B91B91B99B99B99B99B99BBB9B9911911BBBBBBB99B99B99BBBBBBBBBBBB9BBBBBBBBBBB9BJ9BJBBBBBBBBB9BJBJRJJRJJRJJRJJRRRZRRZJJRBJRBJZJRcJRcJRcJRcJRcJZcJZcJRcJRcJRcJRcJRZJRZJRZJRZJRZJRZJRcJZcJZkJZkJRcJRcJZcJZcJRcJJZJJZJJZJJZJRZJRZJRZJJRJJJJJJJJRBJZJRZJRZJJRJJRJJRJJJJJRJRZJRcJZcJZcJZcJRZBJZBJRBJRJJJ9BJ9BJ9BB9BJBJRBJRBJRBJRJJJ9BJ9BJ9BRBRcBRcBJZ9BRBJZBJZBJRBJRBJR9BR9BJ9BJ9BJJJJBJR9BRBJR9BR9BJ9BJ9BJ9BJ9BB99B19J19B99B99B19B19B19B19B19B19B19B)1919B119)19))11191199999111))1))1))1))1111111111)))!!)!!1))111111111111111919919999999999999BBBBBBBBB9BJ9BJBBBBBBBBB999999B99B99B99B99B919))9))B91J99BBBBBBBBBBBBB99B99B99B99B99B91B91JB9B99B99911B919))9))B91B99BBBB99B99B99B91B91B99BBBBBBBBBBBBBBBBBBBBBBBBJJJJJJ9BJBBB9BB9BB9BJ9BJ9BJ9BB9999199119119119999B99BB9BB9BJ9BJBBBBBBJB9B99B99B99B99B99B91B91B91911911B99B999B9999911B99BBBBBBBBBB99BBBBBBBBBBBBB999B9BBB9BJBBBBBBBBBBBBBBB9BJJJJJJRJJRJJRJJJJJRRRcRRcJJRJJRBJZJRZRRcRRcJRcJRcJZcJZcJZcJRcJRcJRcJRcJRZJRZJRZJRZJRcJZcJZkJZkJZcJRcJRcJZcJZcJRcJRZJJZJJZJRZJRZJRZJJZJJRJJRJJRJJRBJZJRZJJRJJRJJRJJRJJRJRZJRZJZcJZcJZcJRcJRZBJZBJRJJJJJJBJRBJR9BJ9BJBJRBJRBJRBJRBJRJJJ19J19JBJZBJZBJZBJZBJZBJZBJZBJR9BR9BR9BR9BJJJJJJJ9BR9BR9BR9BJ9BJ9BJ9BJ9BJ99B99B19J9BJ99B19B19B19B19B19B19B19B)1919B19B19B119)191191199999111)))))1))1111))1))1))1)))!!)!!1))111111111111111111919BBBBBB999999BBBBBBBBBBBBBBBBBBBBBBBB999999B99B99BBBB99J919))9))B91BBBRRJBBBBBBJJJBBBB99B99BBBJB9B91B91B99B99999919B91B91B91B91B99BBBB99B99B99B99B91B99BBBBBBBBBBBBBBBBBBBBBJJJJJJJJJJJJ9BJBBBBBB9BJ9BJ9BJ9BB99B9999199199199999999BB9BJ9BJ9BJ9BBBBBBBBBBBBBBJB9JB9B99B99B91B91B91B91B99B99999999B99B99BBBBBBB99B99BBBBBBBBBBBB9B99B9BBB9BJ9BB9B99B9BBB9BJBJRJJRJJRJJRJJRJJJJJRJRZJRcJJZJJRJJZJRZJZcJZcJRcJRcJZcJZcRZcRZcJRcJRcJRcJRcJJZJRZJRcJZcJZkJZkJZcJRcJRcJRcRZcRZcJRcJRcJRZJRZJRZJRZJJRJJRJJRJJRJRZJRZJRZJRZJJRJJRJJRJJZJRZJRZJRZJRcJRcJRcJRcJRZJRZBJR9BJ9BJ9BR9BRBJRBJRBJRBJRBJRBJRBJRBJR19J19J9BRBJZBJZBJZBJZBJRBJZBJZ9BR9BR9BR9BRJJJJJJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BJ19B19B9BJ9BJ19B19B19J19J19B19B19B19B19B19B19B19B19B1191191199111111)))))1111119111))1)))))))))))111111111111111111911999BBBBBBBBB99BBBBBBBBBBBBBBBBBBBBBBBBB99B999B99B99BBBB99J919))9))911BBBRRJRJBBBBJJJBBBB99B99BBBJB9B99B91B99B99999919B99B91B91B91B99BBBB99B99BBBBBBB99B99BBBBBBBBBBBBBBBBBBJJJJJJJJJBJRBJRJJJBBB9BJBJRBJRBJR9BJ9BB99B91991999999B99B9BB9BJ9BJ9BJBBBBBBBBBBBBBBBJB9JB9B99B99B99B91B91B91B99B99911B91B99BBBBBBBBBBBBBBBBBBBBB9BJBBB9BBBBBJJJ9BJ9BB999999BBBJJJJJRJJRJJRJJRJJRJJJBJRJRZJRZJRZJJZJJZJRZJZcJZcJRZJRZJZcRZcRZcRZcJRcJRcJRcJRZJJZJRZJRcJZcJZkJZcJRcJRcJRcJZcRZkRZkJRcJRcJRZJRZJRZJRZJJRJJRRRJJRZJRZJRcJRcJRZJJRJJRJJZJRZJRcJRcJRZJRZJRZJRZJRZJRZJRZJJRJJJ9BJ9BRBJZBJZBJRBJRBJRBJRBJRBJZ9BR9BR9BJ9BJBJRBRcBRcBJZBJRBJZBJZ9BR9BR9BRBJRBJRBJR9BR9BJ9BJ9BJ9BJ9BR9BR9BR19B19B9BJ9BJ19B19B19B19B19B19B19B19B19B11911911919B19B1191191111111))1))111111911111))1))))))111111111111111111111919999999BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB99B99B99B99B99J99B919))911JB9RJBJJJJJJBBBBBBB99999B99B99B99B99BBBBBBB99B99B99B91B91B91999999B99BBBBBBJJJBBBBBBBBBBBBBBBBBBBBBBBBJJJJJJBJRBJRBJRJJJRJBJJJJJRBJZBJR9BR9BJ99B999999BBB9BJ9BJ9BB9BJ9BBBBBBBBRJBBBBB99B99B99B99B99B91B99B99B919999B99B9B91B99BBBBBBB99B99BBB9BJBBBBBB9BJ9BJ9BJ9BJJJJBBBBBB999999B99BBBJJJJJRJJRJJRJJRBJRBJRJRZRRZJRZJRZJRZJRZRRZRRZJRZJRZRRcRZcJRcJRcJRcJRcJRcJRZJRZJRZJRcJRcJRcJRcJRcJRcJZcJZkRcsRZkJRcJRZJRZJRZJRZJRZJRZRRZRRZRRZJRcJRcJRcJRZJJRJJRJJZJRZJRcJRcJRZJRZJJZJJZJRZJRZJJRBJRBJR9BR9BRBJRBJZBJZJJZJJR9BJJJJBJRBJZ9BR9BR9BRBJRBJZBJZBJZ9BRBJZBJZ9BR9BRBJRBJRBJR9BR9BR9BR9BJ9BJ9BJJJJBJR9BR9BJ99B9BJ9BJ99B19B19B11911911919B19B119119119119)19)1919B19B1111111111))111111911111))1)))11111111111111111111111199999B99999BBBB9BJBBB9BJBBBBBBBBBBBBBBBBBBBBBBBBB99B99B99B99JB9J99B91911B99BBBJJJJJJBBB999999999999999BBBBBBBBBB99B99B99B99B99B91B9199999BB99BBBBBB9BJ9BJ9BJBBBBBBBBBBBB9BJ9BJJJJJJJBJRBJRJJRJJRJJJJJRJJZJJZBJZBJRJJJBBB99BBBB9BJJJJJJJ9BJBBBBBBBBBBBBJB9JB9B99B99B99B99B99B91B99B999119999B9B99B91B99BBBBBBB99B99BBB9BJBBBBBBJJJJJJ9BJ9BJJJJJJJBBB999999BBBBBBJJJJJJJJRJJRJJRBJZBJZJJRRRZJRZJRZJRZJRZRRZRRZJRZJRcRZcRZcJZcJRcJRcJRcJRZJRZJRZJRZJRcJRcJRcJRcJRcJZcJZcRZkRcsRZkJRcJRZJRZJRZJRcJRcRRZRRZRRZJRZJRcJRcJRZJRZJRZJRZJRZJRZJRZJRZJRZJRZJJZJRZJJZJRZJJRJJRBJRBJRBJRBJZBJZBJZJRZJJR9BJ9BJBJRBJZBJZ9BR9BRBJZBJZBJZBJZ9BRBJZBJZBJZBJRBJRBJR9BR9BRBJZ9BR9BR9BJ9BJJJJBJR9BR9BJ9BJ9BJ99B99B99B11911911911919B119119119119119)19)1919B19B91911111111111111111111111111111111111111111191191191999B9BBBBBBBBBBB9BJJJJJJJ9BJ9BJBBBBBBBBBBBBBBBBBBB99B91B99B99BBBJB9J99B91B99B99JJJJJJBBBB99999999B99B99BBBBBB999911B99B999B99B9B91B99BBBBBBB999B9B99BBB9BJ9BJBBBBBB9BJ9BJ9BJJJJJJJJJJJJJBJRJJRJJRRRJRRZJRZJJZJJRBJRJJRJJJBBBBBB9BJJJJJJRJJJ9BJBBBBBBJB9J91J91B99B99B99B99B99B99B91B91911999B99B99B99B99BBBBBB999999BBBBBBB99BBBJJJJJJBBBBBBJJJJJJ9BJ9BB9BB9BJJJJJJJJJJJJRJRZJRZBJZJRZJJRJJRBJZBJZJRZJJRJRZJRZJRcJZcRZcRZkRZkJZcJRcJRZBJZBJZJRZJRZJRcRRcRZcJZcJZcJZcRZcRZkJZkJZkJRcJRcJRcJRcJZcRZcRRZRRZJRZJRZBJZBJZJRZJRZJRcJRcJRcJRZJRZJRZJRZJRZRRZJRZBJRBJRJJZJJRBJRBJRJJRJRZJRcBJZBJZBJRBJRBJRBJZBJZBJZBJZBJRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BRBJRBJR9BR9BR9BJ9BJ9BR9BR9BR9BJ19B19B9BB9BB19B11919B11911911911911911919B)19)1911911991991911111111111111111111111111111111111191991991999B9BBBBBBBBBBBBBBBBBJJJJJJ9BJBBBBBBBBBBBBBBB9BJBBBBBBB99B99B99BBBBBBJB9J99B99B99BBBJJJBBBBBB999999B99B99BBBBBB999999B99B999BB9BBB99B99BBBBBB9BB9B99B99BB9BJ9BJ9BJBBB9BJ9BJJJJJJJJJJJJJJJJJJRJJRRRZRZcRZcJRcJRZJRZJJRJJRJJR9BJ9BJ9BJBJRJJRJJR9BJBBBBBBJ99J91B91B99BBBB99B99B99B99B91B91911B91B99B99B99B99BBBBBB911911BBBBBBB99BBBJJJJJJBBB9BBJJJBJRJJJJJJJJJJJJJJJJJJJJRJRZJRZJRcJRcJRZJJRJJRBJZJRZJRZJRZJRZJRcJZcRZkRZkRZkRZkRZkJRcJRZBJZBJZJRZJRcRRcRZcRZcRZcJZcRZkRZkRZkRZkJZkJRcJRcJZcJZcJZcJZcRZcRRZJRcJRcBJZBJZJRZJRcJZkJZkJZkJRcJRZJJRJRZJRZRRZRRZJJZBJZJJZJJZJJRBJRJJRJRZJRcJRcBJZBJRBJRBJZBJZBJZBJZBJZBJRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BRBJRBJRBJR9BR9BJ9BJ9BR9BR9BR9BJ19B19B9BB9BB19B19B19B19B11911911911911919B)19)1911911999911911911911911911911111111111111911911911999B99B99B99BBBBBBBBBBBBBBBB9BJ9BJBBBBBBBBBBBBBBBBBB9BJ9BJBBBBBBB99B99BBBBBBJB9J99B99B99BBBJJJ9BJ9BB999999B99BBBBBBBBBBBBB99BBBBBBBBBBBBBBBB99B99B99B99BBBBBBBBBJJJJJJJJJ9BJ9BJ9BJJJJJJJJJRJJRJJRJJRRRJRRZRZcRZkRZcRZcRZcJRZJJRJJJ9BJ9BJBJRBJRJJRJJR9BJBBBJB9JB9B91B91B99BBBBBBB99B99B99B99B91B91B91J99J99B919999B99B9911911999BBBBBBJJJJJJJJJ9BJBBBJJJJJRJJRJJRJJRJJJJJJJJJJJZJRZJRZJRcRRcJRZJJZJJZJRcJZcRRcJRZJRZJRcRZkRcsRZkRZkRZkRZkJZcJRcJJZJJZJRcRZcRZcRZcRZkRZkRZkRZkRZkRcsRZkRZkJZcJZcRZcRZcJRcBRcJZcRZcJZcJRcJRcJRcJRcJZkRZkRcsRcsJZkJRcJRZJJZJRZRRZRRcRRcJRcJJZJJZJRZJJZBJRBJZBRcBJZBJRBJRBJZBJZBJRBJRBJRBJR9BR9BRBJZBRcBJZBJZBJZ9BR9BR9BRBJZBJZBJRBJR9BR9BRBJRBJR9BJ9BJ9BR9BR9BR9BJ19B19B9BB9BB9BJ19J19J19B19B)1919B)19119119)19)1911911911911911911911919B11911911111111911911911911919B9BJ9BJBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB9BJ9BJ9BJ9BJBBBB99B99B99JB9J99B99B99B99BBBJJJJJJ9BJBBB999BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB99B99B99BBBBBB9BJ9BJJJJJJJJJJ9BJ9BJJJJBJRJJRJJRJJRJJRJRZRRZRRcRZcRZcRZcRZkRZcJRZJJRJJRBJRBJZBJZJJRJJJ9BJBBBJB9JB9B91B91B99B99B99B99B99B99B99B91B91B91J99J99B919999B99B9999999999BBBJJJJJJJJJJJJ9BJJJJJJRJJRJJRJJRJJRJJJJJJJJRJJZJRZJRZJRZRRcRRcJRZJRcJZcRZcRZcRRcJZcJZkRcsZcsRcsRZkRZkRZkRZkJRcJJZJJZJRcRZcJZcJZcRZkRZkRZkRZkRcsRcsZcsRZkJZcJZcRZcRZkJRcBRcJZcJZcJZcJZcJRcJRcJZkJZkRcsRcsRcsRZkJRcJRZJJZJJZJRcRZcRZkRZcJRZJJZJRZBJZBJZBJRBJZBJZBJRBJZJRcJRcBJZBJRBJRBJR9BJ9BRBJZBRcBRcBJZBJZ9BR9BRBJZBJZBJZBJZBJR9BJ9BJBJRBJR9BJ9BJ9BR9BR9BJ19J19B19B99B9BB19J19J19J19J19B19B19B19B11911919B)1911911919B19B19B19B19B19B19B11911911911911911911999B99B99B99BBBBBBBBBB9BBBBBBBBBBBBBB9BJ9BJBBBBBBBBB9BJ9BJBBB9BJBBBB99B91B91B91B91B91J99JB9JJJJJJJJJ9BJBBBB99B99B99B99JB9BBBBBBBBBBBBB99B99BBBJJJBBBBBBB99BBBBBBBBBBBB9BJJJJJJJJJJJJJBJRBJRBJRJJJJJRJJRJRZJRZJRZJRZRRZRZcRZcRZcRZcJRcJRcJRcJRZJJZJJRJJJJJJBBBJB9J99B91B91B91B91B91B91B99B99B99B91B91B91B99JB9B99B999B99B9B99B99BBBBBB9BJJJRJJRJJRJJJBJRJJZJRZJJRJRJJRJJRJJJRJJRJJRJJRJRZRRZRRcRRcRZcRZkRZkRZkRZcRZcRZkRcsZcsZc{RcsRcsRcsRcsRZkJZcJRZJRZJRcJRcJRcJZcJZcJZcRZcRZkRcsZk{ZcsRZkJZcJRcRZkZcsRZkJZkJZkJZcJRcJRcJZcJZkJZkJZkJZkRcsRcsRZkJZcJRZJRZJRZJRcJZkRZkJZcJRZJJZJRZBJZBJZBJZJJRJJRJJZJRZJZcJZcBJZBJZBJR9BJ9BJBJRBJZBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZBJR9BR9BR9BR9BR9BR9BR9BJ9BJ9BJ19J19J19J19B19B19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B11911911911911911999B99B99B99B99BBBB9BB9BBBBBBBBBBBBBB9BJ9BJ9BJ9BJ9BJJJJBBBBBBBBBBBBB99B91B91B91B91B91B99JB9BBBJJJJJJBBBBBBB99B99B99J99JB9JB9BBBBBBBBBB99B99BBBJJJJJJRJBB99B99BBB9BJBBBBBBJJJJJJJJJBJRBJRBJZBJRJJJJJRJJRJRZJRZJJRJJJJJRRRZRZcRZkRZkRZkRZkJZcJRcJRZJJRJJJJJJRJBBBBJB9B99B91B99B919))B91B99B99B99B91B91B91B99B99B99B99B999B9B99B99BBB9BJJJJJJRJJRJJRJJJBJRJRZJRZJJRJRJJRJJJRJJRJJRJJRJJRRRZRRZRRcRZcRZkRZkRZkRZkRZkRZkRcsZcsZk{Zc{RcsRcsRcsRZkRZkRZcJRcJRcJRcJRcJRcJRcJZcRZkRZkRcsZk{Zk{ZcsRZkJZcJZcZcsZcsRcsRcsRZkJZcJRcJRcJZkRZkJZkJZkJZkRcsRZkRZkJZcJRcJRcJRcJZcRZkJZkJRcJRZJJZBJZBRcBRcJRZJJRJJRJRZJRcJZcJZcJRcBJZBJR9BJ9BJ9BJBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BRBJRBJR9BR9BR9BJ9BJ19B19J19J19J19B19B19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B19J19J19B19B11911911911911911911999B99B99B99B99BBBBBBB9BB9BBBBB9BJ9BJ9BJ9BJ9BJJJJJJJ9BJBBBBBBBBBB99B91B91B91B91B91B99B99B99B99BBBBBBBBB999999B99J99J99B99B99BBBBBBBBBBBBBBBRJBRJBBBBB99B999BJJJJ9BB9BBJJJJJJJJJBJRBJZBJZJJRJJJJJJJJRJRZJJZJJJJJJJRJJJRJZcRZkRZkRZkRZkRZcRZcJRZJJRJJJRJBRJBBBBBBBJB9JB9B99B999))J91JB9B99B99B91B99B99B99B99BBBB99B99B999B99BB9BBBBBJJJJJJJJRJJRJJJJJJJJRJRZJJRJJRJJRJJRJJRJJRJRZJRZRRcRZcRZcRZcRZkRZkRcsRcsRZkRZkRcsRcsZk{Zk{ZcsRcsRZkRZkRZcRZcJZcJZcRZcJZcJRcJRcJZkRcsRcsZcsZc{ZcsRcsJZkJRcRZkZcsZcsRcsRcsRZkRZkJZcJZkRZkRZkJZkJZkRcsRcsRZkRZkRZkJZcJZcRZcRZcRZcRZkJRcJRZJRZJRcJRcJRcJRcJRZJRZJRZJRZJRcJRcBRcBRcBJZBJRBJRBJRBJRBJRBJZ9BR9BR9BRBJRBJZBJZBJZBJZ9BR9BRBJRJJJBJRBJR9BR9BJ9BJ19B19B19J19J19J9BJ9BJ9BJ19J19B19B19B)19)1919B19B119119)19)1919B19B19B19B19J19J19B19B11911911911911911911911999B99B99B99BBBBBBBBBB9BB9BJ9BJ9BJ9BJ9BJJJJJJRJJR9BJBBBBBBB99B99B91B91B91B91B99B99B99B91B99BBBBBB99B999B99B99J99J99B99B99BBB9BJ9BJBBBBBBBBBBBBB99B99B99JJJJJJ9BJ9BB9BJJJJJJJBJRBJZBJZJJRJJJJJRJJRJRZJRZJJRJJJJRJJJRJZcJZcRZcRZcRZcRZcRZcRRZJRZJJRJJJRJBBBBBBBB99B99B99J99J91J91J99B99B91999B99B99B99B99999999911B91B99BBBBBB9BJJJJJJJJJRJJRRJBJJJJJRJJRJRZJRZJRZJJRJJRJJRJRZJRcJRcRRcRZcRZcRZkRZkRcsRZkRZkRZkRZkRcsZcsZcsZcsRZkRZkRZcRZcRZcJZcJZcRZcRZcJRcJZcJZkRcsRcsRcsZc{Rc{RZkJZkJZkRZkZcsZcsRcsRcsZcsRZkRZkRZkRZkRZkRcsRcsZcsZcsRZkRZkRZkRZkJZcJZcRZcRZcRZcJZcJRcJRcJRcJZcJRcJRcJRcJRcJRZJRZBJZBJZBRcBRcBRcBJZBJRBJRBJRBJR9BR9BR9BRBJRBJRBJRBJZBJZ9BR9BR9BR9BRJJJJJJ9BJ9BJ9BJ99B19B19B19J9BJ9BJ9BJ9BJ9BJ19J19B19B19B19B)1919B19B119119)19)1919B19B19B19B19B19B19B19B11911911911911911911911999B99B99BBBBBBBBBBBBBBBB9BJJJJ9BJ9BJ9BJJJJJJRJJR9BJBBBJ99J99B99B919))911B99BBBB99B91B91B999BJ9BJ99B999B99JB9J91J91J91B99BBBBBB9BJJJJJJJBBBBBBBBB9999B99BJ9BJ9BJ9BJ9BJJJJBJRBJZBJZBJZJJJJJJBJRJRZJRZRRZRRJRRJRRJRRZRRZRRZJRZJRZRZcRZcRZcRRZJRZJJZJJRJJJBBBB99B99B99B99J99JB9J91J91B91B91999B99B91B91B91B91B919))911B99RJBBBBJJJJJJJJRJJRJJRJJJJJJJJJJJRJJZJJZJJZJJZJJRJJRJRZJRZJRZRRZRRcRZcRZkRZkJZkJZcRZcRZcRZkRcsRZkRZkRZkRZkJZcJZcRZcRZcJZcJZcJZkJZkJZcJZkJZkJZkJZkRcsRc{Rc{RcsRZkJZkRcsRcsZcsRcsRcsZcsRcsRcsRcsRZkRZkRZkRZkRcsRZkRZkRZkZcsRZkJZcJRZJRZJRcRZcRZcJRcJRcJZcJZcJRcJRcJRcJRcJRZJRZBJZBJZJRcJRcJZcJRcBJZBJRBJRBJRBJRBJRBJRBJRBJRBJR9BRBJZ9BR9BR9BR9BR9BR9BJ9BJ99B9BJ9BJ19J19J9BJ9BJ9BJ9BJ9BJ99B19B19B19J19J19B19B19B19B19B19B)19)1919B19B19B19B19B19B19B19B19B11911911911911911999B99B99BBBBBBBBBBBBBBBBBBB9BJ9BJ9BJ9BJJJJJJJJJRJJR9BJBBBJ99J91B919119))911B99BBBB99B99B99BBB9BJ9BJ99BB99J99J99J91J91J91J99BBB9BJJJJJJJJJJ9BJ9BJBBBBBBBBBBBB9BJ9BJJJJ9BJ9BJBJRBJZBJZJRZJJRJJRJRZJRZRRZRRZRRZRRZRRZRRZRRZRRZJJRJRZRZcRZcRZcRZcJRcJRZJRZJJRBBBB999BBBBBB99JB9JB9JB9J91B91B91911B91B91B91B91B919119))911B99RJBJJJJJJJJRJJRJJRJJRJJJJJJJJJJJRJJRJJZJJZJJRJJRJJRJRZJRZJJRJRZRRZRRcRZkRZkJZcJZcRRZRRZRZkRZkRZcRZcRZcRZkJZcJZcRZcRZcRZcJZkJZkJZkJZkJZkJZkJZkJZkJZkRc{Zk{RcsRZkJZkJZkRZkRZkRcsZcsZcsZcsRcsRcsRZkRZkZcsZcsRZkRZkRZkRZkZcsRZkJRcJJZJJZJRcRZcRZcJRcJRcJZcJZcJZcJRcJRcJRcJRZJRZBJZBJZJRcJZcRZkJZcBRcBJZBJZBJRBJRBJRBJR9BJ9BJBJR9BR9BR9BR9BR9BJ9BJ9BR9BJ99B99B9BJ9BJ19J19J9BJ9BJ9BJ9BJ9BJ19J19B19B19J19J19B19B19B19B19B19B19B)1919B19B19B19B19B19B19B19B19B11911911911911999B99B99B99B9BB9BB9BB9BB9BB9BB9BJ9BJ9BJJJJ9BJ9BJJJJJJJ9BJBBBB99B91B91911111911B99JB9BBBBBBBBBJJJ9BJBBBB99B91J91J91J99JB9J99J99BBBJJJJJJJJJBBBBBB9BJJJJRJBBBBBBB9BJJJJJJJJJJJJJBJRBJZJRZRZcRZcRZcRRZRRZRRcRRcRRcRRcRRcRRZRRZRRZJRZJRZJRZRZcRZcRZcRRZJRZJRZJJRJJJBBBBBBBBBBBBJB9B99B91B91B91B91B91B91B91B99B99B919119999B99B9BBBRJBJJJJJRJRZJJRJJJJJJJJJJJJJJRJJRJJRJJRJJRJJRJJRJJRRRJJRZJRZRRZRRZRZcRZkRZcRZcJRcJRZJRcJRcRZcRZcRZcRZcRZcRZcJZcJZcRZcRZkRZkRcsRcsRcsRcsRcsJZkRZkRc{Zc{RcsRcsJZkJZkRcsZcsZcsZcsRcsRcsZcsZcsRZkRZkZcsZcsRZkRZcJZcJZkRZkRZkRRZJRZJRZRRcRZcRZcJRcJRcJZcJZcJZcJZcJRcJRcJRZJRZBJZBJZJRcJZcRZkJZkBRcBJZBJZBJZBJZBJR9BJ9BB9BJ9BJBJRBJR9BR9BR9BR9BJ9BR9BJ9BB9BB9BJ9BJ19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B11911911911999B99B99B99B9BB9BJ9BJ9BB9BB9BB9BJ9BJ9BJJJJ9BJ9BJ9BJJJJ9BJBBBB99B99911911911B99J99JB9BBB9BJ9BJBBBBBBB99B99B99B91J91JB9BBBJ99J99BBBJJJJJJJJJBBB9BJJJJJJJJJJBBBBBB9BJ9BJJJJJJJJJJBJRBJZJRZRZcRZkRZkRRZRRZRRZRRcRRcRRcRRcRZcRZcRZcJRZJRZJRZRRZRZcRZcRZcRRZJRcJRZJJRJJJJJJJJJJJJBBBB99B91B99B919))9))B91B99B99B99B999999B99B99B9B99BBBJJJJJRJJRJJRJJJJJJJJJJJJJJRJJRJRZJRZJJRJJRJJRRRJRRJJRZJRZRRZRRZJRcJZcRZcRZcJRZJRZJJZJRZRZcRZkRZcRZcRZcRZcJZcJZcJZcRZcRZkRcsRcsRcsRcsRcsRZkRZkZc{Zc{RcsRZkJZkRZkRZkZcsZcsZcsRcsRcsZcsZcsRZkRZkZcsRZkRZcRZcJZcJZkRZkRZcRRZRRZRRcRRcRZcJZcJRcJRcJZcRZcRZcJZcJRcJRcJRcJRZBJZBRcJRcJZcJZkJZkBRcBRcBRcBJZBJZBJR9BJ9BB9BJ9BJBJRBJR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J19B99B99911911999B99B99B9BB9BJ9BJ9BJ9BJBBBBBB9BJ9BJBBBBBBBBBBBBBBB9BJBBBBBBBBBB99999B99B99J99JB9BBBBBBBBBBBBB99999999BBBBBBB91B99BBBBBBB99B99JB9BBBJJJJJJ9BJJJJRRJJRJJJJBBBBBB9BJ9BJ9BJ9BJ9BJBJRBJZBJRBJZJRcJZcRRZRRZJRZJRZRRZRZcRZcRZcRZcRZcJRcJRZJRZRRZRZcRZcRZcRZcJRcJRZJRZJJRJJRJJJJJJBBBB99B99B99J99J91J91J99B99B99B99B99B99B99B99B99BBBRJBJJJRJBJJJJJJJJRJJRJJRJJJJJJJRZJRcJRcJRZJJRJJRRRJRRZJRZJRZRRZRRZJRZJRcRRcRZcRRZJRZJJRJRZRZcRZkRZcRZcRZcJZcJZcJZcJRcJRcRZcRZkRZkRcsJZkRcsRZkRcsZk{Rc{RcsRZcRZcRZcRZkZcsRcsRcsRZkRZkRcsRcsRcsRZkRZkRZcRRcRZcRZkRZkRZkRZcRZcRZcRZcRRcJRcJRcRZcRZcRZcRZcRZcRZcJRcJRcJRcJRcJRcJRcJZcJZcJRcBRcBRcBJZBJZBJZBJZBJR9BRBJRJJJJJJBJRBJR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J19J19B99B99B99919B99B99B99B9BBBBB9BJ9BJ9BJBBBBBB9BJBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB99B99J99JB9RJBJJJ9BJBBB99B999999BBBBBBBBBB99BBBJJJJJJB99B99J99JB9BBBJJJJJJJJJRRJJJJBBBBBBBBBBBBBBBBBB9BJJJJBJRBJRBJRBJZBJZJZcRRZRRZJJZJRZRRZRZcRZcRZcRZkJZcJRcJRZRRZRZcRZcRZkRZkRZkJZcJRcJRcJRZJJRRRJJJJJJJBBBB99BBBJB9J91J91J99B99B99B99B99B99B99B99B99B99BBBRJBBBBBBBBBBJJJJJRJJRJJJJJJJJRJRZJRZJRZJJRJJRRRZRRZJRZJRZRRZRRZJRZJRZJRcRRcRRZRRZJRZJRZJRcRZcRZcRZcJZcJZcJZcJZcJRcJZcRZkRcsRcsRcsJZkJZkRZkRcsRc{Rc{RcsRZkRZkRZkRZkRZkRcsRcsRZkRZkRcsRcsRcsRZkRZkRZcRRcRZcRZkRZkRZcRZcRZkRZkRZkJRcJRZJRZJRcRZcRRcRRcRZcRZcJZcJRcJRcJRcJRcJZcJZcJZcJRcBRcJRZBJZBRcBJZBJZBJRBJZBJRBJRJJJBJR9BJ9BJ9BJ9BJ9BB9BJ9BJ9BJ9BJ9BJ9BJ19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B11911919B19B19B19J19J19J19B19B19B19B99B99B9BJ9BJ99B99BBBBBBBBBBBBB9BB9BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBJB9J99JB9JJJJJRJJJ9BJBBB9BBBBBBBBBBBBBBBBBJJJRRJBBBB99B91J99J99J99JB9BBBBBBRJBRJBBBBB99B99B99B91B999BJBJRJJRJJRBJZJRZJRZRZcRZcRZcJRZJRZRZcRZcRZcRZcJZcJZcJRZRRZRZcRZcRZkRZkZcsRcsRZkJZcJZcJRZRRJRJBRRJJJJBBBBBBBBBJB9JB9J91B91B99B99B99B99B99B99BBBB99B99B99BBBBBBBBBBBBBBBJRJJJRJJJRJBJJJJJJJJJJJJJJRJJRRRZRRZJJRJJRRRJRRZRRZJRZJRZJRZJRZJRZJZcJZcJRcJRcRZcRZcJZcJZcJZcJZcJZkRcsRc{Rc{Rc{Rc{RcsJZkRZkRcsRc{Zk{ZcsZcsZcsRZkRZkRZkRcsRcsRcsRcsZcsZcsRZkRZkRZkRZkRZcRZcRZkRZkRZcRZcZcsZcsRZkJRcJRcJRZJRcJRZJRZJRZJZcJZcJZcJRcBJZBRcJZcJZcJRcJRcJZcJZcJRcJRcBRcBJZBJZBJZBJZJJZBJR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J19J19J19J19J99B99B19J19J19J19B19B19B19J19J19B19B19B19B11911919B19B19B19J19J19B19B19B19B19B99B99B99B9BJ99B99BBBBBBBBBBBBB9BB9BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBJB9BBBJJRJJRJJJJJJJJJ9BJBBBBBBBBBBBBJJJJJJRRJRJBB99B91B99J99J91JB9BBBBBBBBBB99B99B99B91B91B91B99BBBBJRJJRJJRJRZJRcRZcRZcRZkRZcJRZJRZJZcRZkRZcRZcJZcRZcRZcRZcRZcRZkRZkZcsZk{Zk{RcsRZkRZkRZcRRJRRJRRJJJR9BJBBBBBBJB9JB9J91B91B99BBBBBBB99B99BBBRJBBBBB99B99B99BBBBBB999B99JJJJRJJJJRJBJJJJJJJJJJJJJJJJJRJRZRRZJJRJJRRRZRRZRRZRRZJRZJRZJRZJRcJZcJZcJRZJRZRZcRZcJZcJZkJZkRZkRZkRcsRc{Zk{Zk{Rc{RcsRcsRcsRcsRc{Zk{Zk{ZcsZcsRcsRZkRZkRcsRcsRcsRcsZcsZcsRZkRZkRZkRZkRZkRZkRZkRZkRRcRRcRZkZcsRZkRRcJRcJRZJRZJRZJJRJRZJZcJZkJZkJZcJRcBJZJZcJRcBRcBRcJRcJZcJRcBRcBRcBRcBJZBJZJJZJJRBJRBJR9BJ9BJ9BJ9BJ9BJ9BJ9BB9BB99B9BJ9BJ9BJ9BJ19J19J19J19J99B99B99B19J19J19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19B19B11919B19B99B99BBBBBBB9BJ9BJBBBBBB99B99B999999BBBBBBBBBBBBBBBBBBB99B99BBBBBBJB9BBBJJJJJJJJJJJJJJRJJJBBBB99BBBBBBJJJJJJRRJRJBB99B91B99B99B99B99RJBRJBB99B99B99B91911911B91B99BBB9BJJJRJRZJRcRZkRZkZcsRZkRZcRRZJRZJZcJZcRZkRZkRZcRZcRZkRZkRZkRcsZcsZk{cs�cs�Zk{ZcsZcsZcsRZcRRZRRZRRJJJJBBBBBBJB9J91J91B91B99RJBBBBB99B99BBBRJBBBBBBBBBBBBBBBBB999B9B99BBBRJBJJJJJJJJJJJJJJJJJJJJRJJRJRZJRZJRZRRZRZcRZcRZcRZcJRZJRZJRcRZcRRZRRZRRZRRZRZcRZcJZkJZkRZkRZkRZkRcsZc{Zk{Rc{Rc{Rc{Rc{Zc{Zc{Zc{Zc{Zc{Zc{ZcsRcsRZkRZkRcsRcsZcsZcsRcsRcsRZkRZkRZkRZkJZkRcsRZkRZkRZcRRZRZcRZkRZcRRcRRZJRZJRZJRZJJRJRZRZcRZkJZkJZcJRcJRcJRcJRZBJZBJZBRcJRcJRcBRcBRcBJZBJZBJRJJRJJRBJRBJRBJRBJRBJR9BR9BR9BJ9BB9BB99B99B9BJ9BJ99B99B9BJ9BJ99B99B99911919B19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19B19B11911911999B99BBBBBBB9BJ9BJBBB99B99B99B999B99BBBBBBBBBBBBBBBJB9B99B99B99BBBJB9JB9BBBJJJJJJJJJJJRJJJBBBBBB99BBBB9BJJJJJJJBBBB99B91B99B99B99B99RJBRJBB99B99B91B91911911B91B99B999BJJJRJRZJRcRZkZcsZcsRZkRZcRZcRZcRZcRZkRZkRZkRZcRZcRZkRcsRcsRcsZk{Zk{cs�cs�Zk{Zk{Zk{ZcsRZkRZcRRZRRJJJJBBBBBBB99J91B91B99BBBRJBRJBB99B99BBBRJBRJBBBBBBBBBBB99B999B9B99B99BBBJRJJJRJJJJJJJJJJJJJJJJJRJRZJRZRRZRRZRZcRZkRZkRZcJRcJRcRZcRZcRRZRRZRRZRZcRZcRZcJZkJZkRcsRZkRZkRZkRcsZc{Rc{Rc{Zc{Zc{Zc{Zc{Zc{Zc{Zc{Zc{ZcsZcsZcsRZkRcsRcsZcsZcsRcsRcsRcsRZkRZkRZkJZkRcsRcsRZkRZcRRZRZcRZcRRcRRcRZcRZcJRZJRZJRZJRZRZcRZkJZcJZcJRcJRcJRZBJZBJZBJZBJZBRcBRcBRcBRcBRcBJZBJRBJRJJRBJRBJZBJZBJR9BR9BR9BR9BJ9BJ9BB99B9BB9BJ9BJ99B99B9BJ9BJ99B11911911911919B19B19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B99B99991999999B9BBBBBBBB9BB9BB9BB9BB99B99B99BBBBBBBBBBB99B99B99B99BBBBBBB99B99B91B99JB9BBBJJJJJJJJJ9BJBBB9BB9BJ9BJBBBBBBB99B99B99B99B99B99B99BBBBBBBBBJB9B99B99B91999999B99B99BBBRJBJJJJJRJZcRZkZcsZcsZcsZcsZcsZcsRZkRZkRZkRZkRZcRZcRZkRcsRcsRcsZc{Zk{Zk{Zk{Zk{Zk{Zk{ZcsRcsRZcRRZJJRJJJBBBBBBJB9B99B99BBBBBBRJBRJBB99B99BBBJJJJJJJJJJJJBBBBBB9B99B99B9B99BBBJJJJRJJJJJJJJJJJJJJJJJJRJRZRRZRRJRRJRZcRZkRZkRZkRZcRRcRZcRZcRRcRRZRRZRRcRZcRZcRZkRZkJZkJZcJZkJZkJZkRcsRc{Rc{Zc{Zc{ZcsZcsZcsZcsZcsZk{ZcsZcsZcsZcsRcsRcsZcsZcsZk{Zk{ZcsZcsRZkRZkRcsRcsZcsZcsRZcRZcRZcRZcJRcJRZJZcRZcRRZJRZJRZJRZRZcRZcJZcJRcJRZJRZBRcBRcBRcBJZBJZBJZJRcJRcBRcBRcBJZBJZBJZBJZJJZJJZBJZBJZBJR9BR9BJ9BJ9BJ9BJ9BB9BB9BJ9BR19J19J9BJ99B19B11919B19B19B19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B99B99B99999999B9BBBBBBBB9BB9BB9BB9BB9BB9BBBBBBBBBBBB99B99B99B99B99BBBBBBB99B91B91B99JB9BBBJJJ9BJ9BJBBB9BB9BJ9BR9BJBBBB99B99B99B99B99B99B99BBBBBBBBBBBBB99B99B99B9999BBBBBBBBBBJB9RJBJRJRRJRZcRZkRZkZcsZcsZcsZcsZcsRZkRZkRZkRZkRZcRZkRZkRcsZcsZcsRcsRc{Zc{Zc{Zk{Zk{Zk{ZcsRcsRZcJRZJJRJJJJJJBBBBBBBBBBBBBBBBBBRJBRJBBBBBBBJJJJJJJJJJJJJJJJJJBBB9B9B99B99B99BBBJJJJJRJJJJJJJJJJJJJRJJJRRRZRRZRRJRRJRRcRZkRZkRZkRZcRRcRZcRZcRRcRRcRRcRZcRZcRZcRZkRZkRZkJZcJZkJZkJZkRcsRc{Zk{Zk{Zc{ZcsZcsZcsZcsZcsZcsZk{ZcsZcsRcsRcsRcsZcsZcsZk{Zk{ZcsZcsRZcRZkRZkZcsZcsZcsRZkRZcRZkRZcJRZJRZJZcRZcRZcRRZJRZJRcRRcRZcJZcJRcJRZJRZBRcBRcBRcBRcBJZBJZJRcJRcBRcBRcBJZBJZBJZBJZJJZJJZBJZBJRBJRBJR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR19J9BJ9BJ19B19B19B19B19B19B19B19B19J19J19B19B19B19B19B19B19B19B11911919B19B19J19J19B19B19B11911999B99B9BB99B99BBBBBBB9BJ9BJBBBBBBBBB9BJBBBBBB99B999B99B99JB9BBBB99B99B99B91B91JB9BBBBBBBBBBBBBBBBBBBBB9BJ9BRBJRBBBJB9B99B99911999B99BBBBBBBBBBBBBBBB99B99BBBBBB9BJ9BJJJJBBBJB9JB9RRJRRZRZcRZkRZkRZkRZkZcsZcsRZkRZkJZkRZkRZkRZkRZkRZkZcsZcsZcsRcsJZkRc{Rc{Rc{Rc{Zk{ZcsRZkJZcJRZJJRJJJJJJBBBBBBBBBBBBRJBRJBBBBBBBBBBRJBJRJJRJJJRJJRJJRJRJRJBBBBBBBB99B99BBBRRJRRJJRJJRJJRJJJRJRZJRZJRZJRZJRZJRZRRcRZcRZcRZcRZcRZcRZcRZcRRcRRcZZcRZkRZcRZcRZkRZkRZkRZkRZkRZkRcsRc{Zk{Zk{Zk{Zk{Zc{ZcsZcsZcsZcsZcsZk{Zc{RcsRcsRcsRZkZcsZcsZcsZcsZcsRZcRZcRZkZcsZcsZcsZcsZcsRZkRZkRZcRRZRRZRZcRZcRZcRZcJRZJRZRRcRZkRZkJZkJZcJRcJRcJRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJRBJRBJRBJR9BJ9BJJJJ9BJ9BJ9BJ9BJ9BR9BR9BR9BJ19J9BJ19J19J19J99B19B19B19B19B19B19B19B19B19B19B19B19B19B11911919B19B19J19J19B19B11911911919B9BB9BB99B99B99BBBB9BJ9BJBBBBBB9BJ9BJBBBB99999999B99B99BBBJB9B99B91B91B91B99JB9JB9BBBB99B99B99BBB9BJJJJBJR9BJJJJBBBB99911911999BBBBBBBBB9BJBBBBBBB99B99BBB9BJ9BJ9BJ9BJBBBJ91JB9RRJRZcRZcRZcRRcRZcRZkRZkRZcRZcJZkJZkRZkRZkRZkRZkZcsZcsck{Zk{RcsRc{Rc{Zk{Rc{Zk{Zk{ZcsRZkJRZJJRJJJJJJRJBBBBBBBBBBRJBRJBRJBBBBBBBRJBJJJJRJJRJJJRJJRJRJJRJJJJRJBRJBRJBBBBBBBJJJRRJJRJJRJJRJJJRJRZJRZJRZJJRJRZJRZRRZRZcRZcRZkRZcRZcRZcRZcRRcRZcZZcRZkRZcRZkRZkRcsRcsRcsRZkRZkRcsZk{Zk{Zk{Zk{Zk{Zc{Zk{Zk{ZcsZcsZcsZcsZc{RcsRcsRZkRZkZcsZcsZcsZcsRZkRZcRZcRZkZcsZcsZcsZcsZcsZcsRZkRZcRZcRZcRZcRZcRZkRZcJRcJRZRRcRZkRZkRZkJZkJZcJZcJRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJRBJRBJRBJR9BR9BJJJJJJJ9BJ9BJ9BJ9BJ9BR9BR9BJ19J9BJ9BJ19J19B99B19B19B19B19B19B19B19B19B19B19B19B19B19B11911919B19B19B19B19B19B11911911919B99B99B99999999B99BBBBBBBBBB9BJJJJ9BJB99911B91B99BBBBBBB99B99B99B99B91B91B99B99B99B99B99B99B99BBB9BJBJR9BJ9BJ9BJBBBB99911999999BBBBBB9BB9BJBBBBBBB999999B99BB9BB9BJBBBJB9JB9BBBRRJRRZRZcRZkRRcRZcRZcRZcRZcRZkRZkRZkRZkRZkRZkRcsZcsZk{Zk{Zk{cs�cs�c{�cs�Zk{Zk{Zk{ZcsRZkJRZJJJRJBBBBRJBRJBBBBRJBJJJJJJRJBRJBRJBJRJJJJJJJJJJJJRJJRJJJJJJJJJJJJJRJJJJRJBRJBJJJJJJJJJJJJJJJJJJRRZRRZJRZJJRJJRJJRRRZRZcRZkRZkRZkRZcRZcRZcRZcRZcRRcRZcRZcRZkRZkRZkRcsRcsRZkRZkZcsZk{Zk{Zk{Zk{Zk{Zk{Zk{ck{ck{ZcsZcsZcsZcsZcsZcsRZkRZkZcsZk{ZcsZcsRZcRZcRZcRZkRZkZcsZcsZcsZcsZcsRZkRZcRZcRRcJZcJZcRZcRZcRRcRRcRZcRZcRZcJZkJZkJZkJZkJRcBJZBJZBRcBRcBJZBJZBJZBJZBJZBJZBRcBJZBJZBJR9BR9BRBJRBJRBJRBJRBJRBJR9BR9BR9BR9BR9BR9BR9BJ9BJ19J19J19B19B19B19B19J19J19J19B19B19B19B19B19B19B19B19B11911919B19B19B19B19B19B11911919B19B19B99B99999999B99B99BBBB99B9BB9BJBBB999911B99BBBBBBBBBB99B99B99B99B91B91B99B99B99B99B99B99BBB9BJBJRBJR9BJ9BJ9BJBBB999911999BBBBBBBBBBBB9BBBBBBBB9999999999B99BBBBBB99B99J99BBBRRJRRZRZcRZcRZcRZcRZcRZkRZkRZkRZkRZkRZkZcsZcsZk{Zk{Zk{Zk{Zk{cs�c{�c{�Zk{Zk{ZcsZk{Zc{RZkRRZJJJBBBBBBRJBRJBRJBRJBJJJJJJJJJRJBJJJJRJJJRJJJJJJJJRJJJJJJRJBBBBJJJJJJJRJJJJRJBJJJJJJJJJJJJJJJJJJRRJRRZRRJJJRJJRJJRJJRRRZRZkRZkRZcRZcRZcRZcRZcRZcRRcRZcRZkRZkRZkRcsRcsRcsRcsZcsZcsZk{Zk{Zk{Zk{Zk{Zk{Zk{ck{ck{ZcsZcsZcsZcsZcsZcsZcsZcsZk{Zk{ZcsZcsRZkRZcRZcRZkRZkZcsZcsZcsZcsRZkRZkRZcRZcRZcJZcRZcRZkRZcRZcRZcRZcRZcJZcJZcJZcJZkJZkJRcBJZBJZBJZBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZBJZ9BRBJRBJRBJRBJR9BR9BR9BRBJR9BR9BR9BR9BR9BJ9BJ19J19J19B19B19B19B19J19J19J19J19B19B19B19B19B19B99B19B19B19B19B19B19B19B19B19B11911919B19B19B99BBBBBBB9BB9BB99B99999999999B99BB99B99BBBBBBBBBBBBBBBB99J99J99B91B91B91B99B91B99B99BBBBBB9BJ9BJ9BJBBBBBB9BJ9BJ99B999999B99BBBBBBB99B999B99B9999999999B99BBBB99B91J91J91RJBRRJRRZRRZRZcRZcZcsRZkZcsZcsZcsRcsRZkZcsZcsck{cs�cs�Zk{Zk{Zk{Zk{Zk{Zk{Zc{RcsRcsZk{Zk{RcsRZcRRJBBBBBBJB9RJBRJBBBBRJBJJJJJJJJJJJJJJJJJRJJRJJRJJJJJJRJBRJBBBBBBBBBBRJBRJBRJBBBB9BJJJJJRJJRJJJRJJRJJRJJRJJRJJRJJRJJRRRZRZcRZcRRcRRcRZcRZcJZcJZkRZkRcsRcsRcsRcsRcsRcsZc{ZcsZcsZcsZk{Zk{Zk{Zk{Zk{ck{Zk{ZcsZcsZcsZcsZcsZcsZcsZcsZk{Zk{Zk{ZcsZcsZcsZcsRZkRZkRZkZcsZcsZcsZcsRcsRZkRZkRZcRZcRZcRZcRZcRZkRZkRZkRZkRZcRZcJZcJRcJRcJRcJZkJZcBJZBJZJRZJRcBRcBRcJRcJRcBRcBRcBRcBRcBRcBJZBJZBJZBJRBJR9BJ9BR9BR9BRBJRBJR9BR9BR9BR9BJ9BJ9BJ9BJ9BJ19J19B19J19B19B19B19B19B19J19B19B19B19B19B99B99B19B19B19B19B19B19B19B19B19B11919B19B99B99B99BBBBBBB9BB999919119919919999BBBBBBBBB9BJBBBBBBBBBBBBJ99J91B91B91B99B99B91B99B99BBB9BJ9BJ9BJBBBBBBBBB9BJBBB99B999B99B99BBBBBBB99B99B999B999B999999B99B99JB9J91J91J91RJBRRJRRZRRZRZcZcsZcsRZkRZkZcsZk{ZcsZcsZcsZcscs�c{�c{�Zk{Zc{RcsRc{Rc{Zc{Rc{RcsRcsZk{Zk{Zk{RZcRRJRRJJJJRJBRJBRJBRRJJJRJJRJJRJJJJJJJJRJJRRRZRRJJJJRJBRJBRJBBBBBBBBBBBBBRJBRJBBBBBBBJJJJRJJRJJRJJJRJJRJRJJJJJJJJJRJJRJRZRRZRRZRZcRZcRZcRZcJZkJZkRcsRcsRcsRcsRcsRcsZcsZc{Zk{Zk{Zk{Zk{Zk{Zk{Zk{cs�cs�ck{ZcsZcsZcsck{ZcsZcsZcsZcsZk{Zk{Zk{ZcsZcsZcsZcsZcsRcsRcsZcsZcsZcsZcsRcsRZkRZkRZcRZcRZcRZcRZkRZkRZkRZkRZkRZcRZcJZcJRcJRcJRcJZcJZcJRcBJZJRZJRZBRcBRcJRcJRcBRcBRcBRcBRcBRcBRcBJZBJZBJR9BR9BJ9BJ9BRBJRBJRBJR9BR9BR9BR9BJ9BJ9BJ9BJ9BJ19J19J19J19J19B11919B19B19J19J19B19B19B19B99B99B19B19B19B19B19B19B19B19B19B19B19B19B9BB9BB99B99BBBBBBB999919119119999999BBBBBB9BJ9BJBBBBBBBBBB99B99B91B91B91B99B99B99B99B99BBB9BB9BBBBBBBB9BB9BB9BB9BBB99B99B99B99BBBJB9B99B99B99BBB99B999999B91B99B99J91J91J91JB9RRJRRZRRZRZcZcsZcsJZcJRcRZkZc{ck{ck{RcsRcsZk{cs�cs�Zk{RcsRcsRcsZc{Zk{Zk{Rc{Rc{Zc{Zk{Zk{ZcsRRZRRJJJRJJRRJBRRJZZcZcsRRZRRJRRJJJRJJRJJRRRZRRJJJJBBBRJBRJBJJJBBBBBBBBBRJBRJBRJBRJBJJJJJJJJJJJJJJRJRJJJJJJJJJJBJRJJRRRZRRZRZcRZcRZcRZcRRcRZkRcsRZkRZkRcsRcsZcsZcsRcsZcsZk{Zk{Zk{Zk{cs�cs�cs�cs�cs�cs�ZcsZcsck{ck{ck{ZcsRZkRcsZk{Zk{Zk{Zk{Zk{ZcsRcsRcsZcsZcsRcsRZkZcsZcsZcsZcsZcsZcsZZcZZcRZkRZkRZkRZkRZkRZcRZcJZcRZkRZkJZcJZcJRcBRcBJZBJZBJZBJZBJZBJZBJZBRcBRcBRcBJZBJZBRcBRcBJZBJZ9BR9BRBJR9BJJJJBJRBJR9BR9BR9BR9BR9BJ9BJ9BJ9BJ9BJ19J19J19J19J19B11919B19B19J19J19B19B19B19B99B19B19B19B19B19B19B19B19J19J19B19B19B19B9BB9BB99B99BBBBBBB999919119119999BBBBBBBBB9BJJJJBBBBBBBBBB99B99B91B91B99BBBRJBB99B99BBBBBB9BB9BBBBBBBB9BB9BJ9BJ9BBB99B99JB9BBBJB9JB9B99B99BBB99B99B999999911999B91J91J91J91JB9RJBRRJRZcRZkZcsRZkJRZBJZJZkZcsck{ck{RcsRcsRcsZk{Zk{Zk{RcsRcsRc{Zk{Zk{cs�Zk{Zk{Zk{Zk{Zk{ZcsRZkRZcRZcRRZRRJRRZZcsZcsRZcJRZRRZRRZRRZRZcRZcRRZJJRJJJJJJJJJJJJJJJRJBRJBRJBRJBRJBRJBJJJ9BJ9BJJJJJJJJRJJJJJJJJJJJJJJJRJJRRRZRZcRZcRZcRZcRRcRZkRZkRZkRZkRZkRcsZcsZcsRcsRcsZk{Zk{Zk{cs�cs�cs�cs�cs�cs�Zk{ZcsZcsck{ck{ck{ZcsRcsRcsZcsZk{Zk{Zk{Zk{ZcsZcsRcsZc{Zc{ZcsRZkZcsZcsZcsZcsZcsZcsZcsZcsRZkRZkRZkRZkRZcRZcRZcJZcRZkRZkRZcJZcJRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBRcBJZBJZBJZBRcBRcBJZBJZBJZ9BRBJRBJRJJJJJJ9BR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BJ9BJ19J19J19J19B19B19B19B19J19J19B19B19B19B19B19B11911919B19B19B19J9BJ9BJ19B11911919B9BBBBBBBBBBB99B99B999919919999BBBBBBBBBBBB9BJJJJJJJBBBBBBB99B99B91911B99RRJRRJBBB99999B9BB9BJ9BJBBB9BB9BJ9BJ9BJ9BB999B99BBBRJBJB9J99B99999999999999B99999999999B91B91J91J91J91JB9RRJRZkZcsZcsRZcJRZJRcRZkZcsZcsZcsRZkRZkZcsZk{Zk{Zk{Zc{RcsRc{Zk{cs�cs�Zk{Zk{cs�Zk{Zk{Rc{Rc{RcsZcsZcsRZcRZcRZkRZkJRcJRZJJRRRZRZkZcsRZkRZcJRZJJRJJRJJJJJJJJJJJJJJJRJBRJBRJBJJJBBBBBBBBBBBBJJJJJJJJJJJJJJJJJJJJJJJJRRJRRZRZcRZkJZkJZcJRcJZcRZkRZkRZkRZkRZkZcsZcsZc{Zk{Zk{cs�cs�cs�cs�cs�cs�ck{ZcsZcsZk{ck{ck{ck{ZcsZcsZcsZcsZk{Zk{Zk{Zk{ZcsZc{Zc{ZcsZcsZcsZcsRZkRZkZcsZcsZcsZcsZcsZcsRZkRZcRZkRZkRZcRZcRZcRZkRZkJZkJZcJRcJRcJRcBRcBRcBRcBJZBJZBJZBRcBRcBJZBJZBJZBJZBRcBRcBJZBJZBJZBJZBJZ9BR9BJ9BJ9BR9BR9BR9BR9BR9BJ9BJ9BJ19J19J9BJ9BJ19J19J19J19B99B99B9BJ19J19B19B19B19B19B19B19B19B19B19B19J19J9BJ99B99B11911999B9BB9BBBBB99B99B999999999919919999BBBBBBBBBBBB9BJ9BJ9BJBBBB99B99B99911BBBJJRJJRBBB99B9BB9BJ9BJ9BJ9BB9BB9BJ9BJ9BJBBBB99JB9JB9JB9J99B99B99999119119999B99999999911911911B91J91J91JB9RRJZcsZcsRZkRZcJZcJZcRZkRZkZcsRcsZcsZcsZc{Zk{Rc{Rc{Zk{Zk{Rc{Rc{cs�cs�Zk{Zk{cs�cs�Rc{Rc{Rc{Zk{Zk{ZcsRZkRZkRZkRZkJRcJRZJJRRRZZcsZk{Zc{RZkJZkJRcJRZJJRJJJJJJJRJJRJJJJJJJJJJJJJBBBBBBBBBBBBBBBRJBJJJJJJJJJJJJJJJJJJRRJRRZRZcJZcRZkJZkJRcJZcRZkRZkRZkRZkRZkRcsZcsZc{Zk{Zk{cs�cs�cs�cs�c{�cs�ck{ZcsZcsZcsck{ck{ZcsZcsZk{Zk{Zk{ZcsZcsZcsZcsZcsZk{Zc{ZcsZcsZcsZcsRZcRZkZcsZcsZcsRZcZcsRZkRZcRZcRZkRZkRRcRRcRZcRZkJZkJZkJRcJRcJRcJRcJRcBRcBJZBJZBJZBJZBRcBRcBJZBJZBJZBJZBRcBRcBJZBJZBJZBJZBJZBJZ9BR9BJ9BR9BR9BR9BR9BJ9BJ9BJ9BJ19J19J9BJ9BJ19J19J19J19J99B99B19J19B19B19B19B19B19B19B19B19B19B19B19J19J99B99B99B99B99B99B99B99B99B99B99991999911911111191999999B99BBBBBBB9BJ9BJBBBB99B99B91911BBBRRJRRZBBB99B9BJBJR9BJ9BB9BB9BB9BJ9BJ9BJBBBBBBJB9JB9JB9J99B99B99BBB99B999999B99999999911911911B91J91J91JB9RRJRZcRcsRZkRZkRZkRZkRZkRcsRcsRcsZcsZc{Zk{Zk{RcsRcsRc{Rc{Rc{Rc{cs�cs�Zk{Rc{Zk{Rc{Rc{Rc{RcsRcsRc{RcsRcsRcsRcsRcsRZkJRZJJRRRJZcsZk{Zc{ZcsRcsRZkRZcRRZJJRJRJJRJJRJJRJJRJRRJJJRJJJBBBBBBRJBRJBRJBJJJJJJJRJJRJJJJJJRRRJRRZJRcJZcRZcRZcJZcJZcRZcRZkRZkRZkRZkRcsRcsZcsZcsZk{Zk{cs�cs�cs�c{�c{�cs�ZcsZcsZcsck{ck{ZcsZcsZk{ck{ck{ZcsZcsZcsZcsZcsZc{Zc{RZkRZkZcsZcsZcsZcsZcsZcsZcsRZkRZcRRcRZcRZcJZkJZkJZcJZcJZcJZkJZkJZkJZkJZcJRcJRcJRcJRZBJZBJZBJZBJZBRcBJZBJZBJZBJRBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BJ9BR9BR9BR9BJ9BJ9BJ19J19B19B9BJ9BJ19J19J19J19B19B19B19B19B19B19B19B19B19J19J19B19B19J99B99B99B99B99B99B99B99B99B99B99B91991911911911111111191999B99BBBBBBBBBB9BJBBBBBBB99B91911JB9RRJRRJBBB99B9BJBJR9BJ9BB9BB9BB9BJ9BJ9BJJJJBBBJB9JB9JB9B99B99BBB99B9BB99B99B99B99B999999999B99B91J91J91JB9RRJRZcZcsRcsZcsZcsZcsZcsRcsRcsRcsZc{Zk{Zk{Zk{ZcsRcsRc{Rc{Rc{Zk{cs�cs�Zk{Rc{Rc{Rc{Rc{RcsRcsRcsRc{Rc{RcsRcsRc{Rc{RcsRZkRRZRRZRZkZcsZc{Zc{RcsRZkRZcRRZJRJJJJJRJJRJJJRJJRRRJRRJJJJJJJJJJJJJJJJJJJJJJJJJJRJJJRJJRJJRRRZRRcJRcJZcRZcRZcJZcJZcJZcRZcRZkRZkRcsRcsRcsRcsZk{Zk{Zk{Zk{cs�cs�c{�c{�cs�ck{ZcsZcsck{ck{ZcsZcsZk{ck{Zk{ZcsZcsZcsZcsZcsZc{ZcsRZkRZkZcsZcsZcsZcsZcsZcsZcsRZkRZcRZcRZcRZkJZkJZkJZkJZcJZcJZkRcsRcsJZkJZcJRcJRcJRZBJZBJRBJRBJZJRZBJZBJZBJZBJZBJRBJRBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BJ9BJ9BR9BJ9BJ99B9BJ99B19B19B99B9BJ19J19J19J19J19B19B19B19B19B19B9BJ99B99B99B19B19B99B99B99999999B99B99B19J9BJ9BJ99B99B99991911111111191991191999BBBBBBBBBBBBBBBBBBBBBBB99B91B91B99JJJJJJBBBBBB9BJ9BJBBBBBB99B9BB9BB9BJJJRJJJRJBJB9BBBJB9B999999999BB9BJ9BJ9BB9BBBBBBBBBBBBBBB99JB9J91J91RJBRRJZcsZcsZcsZcsRZkRcsZcsZc{ZcsZcsZk{Zk{Zk{Zk{Zc{ZcsZcsZk{Zk{c{�Zk{cs�cs�cs�Zk{Zk{Zk{Rc{RcsRcsRc{Rc{Rc{Rc{Rc{Rc{Rc{RcsZcsZcsRcsRcsZc{Zc{RcsRZkRZcRRJJJJRJBJRJJJRJJRJJRJJJJJJRRJRRJRRJRRJJRJJRJJRJJRJJJRJJRJJRJJRJRcRZcJZcRZcRZcRZcJZcJRcJZcRZkRZkRcsRcsRcsRc{Rc{Rc{Rc{Zk{c{�c{�cs�cs�cs�cs�cs�ck{ck{ck{ZcsZcsZcsZk{Zk{ZcsZcsck{ck{Zk{ZcsZcsZcsZcsZcsZcsZcsZcsZcsRcsRcsRcsRZkRZcRZcRZkRZkRZkRZkRZkRZkRZkRZkRZkRZkJZcJRcJRZJRZBJZBJZBJRBJRJRZJRcBJZBJZBJZBJZBJZ9BRBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BJ9BJ9BJ9BJ99B99B99B99B99B99B99B9BJ19J19J19J19J19J19B19B19B19B19B9BJ9BJ99B99919B19B99B99911911919B99B19B19J9BJ9BJ99B99B99B999111111119919919999BBBBBBBBBBBBBBBBBBBBBBBBB99B99B99B99BBB9BJ9BJ9BJ9BJ9BJBBB99B99B9BB9BJJJJBJRJJJBBBBBBBBBBBBB999999999BB9BJ9BJ9BJ9BJ9BJ9BJ9BJBBBBBBJB9J91JB9RJBRRZZcsck{ZcsZcsRZkRcsZcsZc{ZcsZcsZk{Zk{Zk{Zk{Zk{Zc{Zc{Zk{c{�c{�Zk{Zk{cs�cs�Zk{Zk{Rc{RcsRcsRcsRc{Rc{Rc{Rc{Zk{Zk{Rc{Rc{Zk{Rc{RcsRcsZc{Zc{RZkRZcRRZJJRBBBBBBJJJJJRRRZJJRJJJRJBJRJRRJRRJRRJJRJJRJJRJJJRJJRJJRJJRJRZJRcJZcRZcRZcRZcJRcJRZJRcJZcRZkRZkRcsRcsRcsRc{Zk{Rc{Zk{Zk{c{�ks�ks�cs�cs�cs�cs�cs�ck{Zk{ZcsZcsZk{Zk{ZcsZcsZcsck{ck{Zk{ZcsZcsZcsZcsZcsZcsZcsZcsZcsRcsRcsRcsZcsRZkRZcRZkRZkRZkRZkRZkRZkRZkRZkRZkRZkJZcJRcJRZJRcJRcBJZBJZBJZJRcJRcBJZBJZBJZBJZBJZ9BRBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BJ9BJ9BJ9BJ99B99B99B99B99B99B9BJ9BJ9BJ19J19J19J19J19J19B19B19B19B9BJ9BJ99B11919B19B11911919B19B19B19B19B99B99B99BBBBBBB99B999911111119119999BBB99B99B99B99BBBBBBB9BJ9BJBBBB99B99B99BBBJJJJJJ9BJ9BJ9BJBBB9BB9BB9BJ9BJBJRJJJ9BJBBBBBBBBBBBBBBB99999B99B9BB9BJ9BJ9BJ9BJBBB9BBB99JB9JB9B99JB9JJJRRZZcsZk{RZkRZkRZkZcsZcsZcsZcsZc{Zk{Zk{Zk{Zk{Zk{Zk{Zk{c{�c{�c{�c{�Zk{Zk{Zk{Zk{RcsRcsRcsRc{Rc{Rc{Rc{RcsZcsZk{cs�Zk{Rc{Rc{RcsRcsRcsZc{Zc{RZkRZcJRZJJRBBBBBBJJJJJRRRZRRZJRJJJJJJJJJJJJJJJJRJBJJJJJRJJRJJRJJRJJRJRZJRZJRZRZcRZcJRcJRZJRZRRZRZcRZkRZkRZkRZkZcsZk{Zk{Zk{Zk{c{�c{�ks�ks�cs�cs�cs�cs�cs�ck{ZcsZcsck{ck{ck{ZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsRZkRZcRZcRZkRZkRZkRZkRZkRZkJZkJZkJZkJRcJRcJZcJZkJRcJRcBJZBRcBRcJRcJRZBJZBJZBJRBJRBJRBJR9BR9BR9BRBJZBJZBJZBJZBJZ9BR9BR9BR9BJ9BJ9BJ9BB9BB9BJ9BJ19J19J9BJ9BJ9BJ9BJ9BJ9BJ19J19J19B19B19B19B9BJ99B19B11919B19B11911919B19B19B19B99B99B99B99BBBBBBB99B99999991111911999BBBB99B99B99B99B99BBBB9BJ9BJBBBBBBB99B99JJJJJJJJJ9BJ9BJ9BJ9BJ9BB9BB9BJBJRBJR9BJBBBBBBBBBBBBBBBBBBBBB99B9BB9BB9BJ9BJJJJ9BJBBB9BBB99BBBBBBB99RJBJJRRZcZcsZcsRZkRZkZcsZcsZcsZcsZk{Zk{Zk{Zk{Zk{Zk{Zk{cs�c{�c{�c{�c{�Zk{Zk{Rc{Rc{Rc{RcsJZkJZkRcsRc{Rc{RcsRcsRcsZk{Zk{Zk{Rc{RcsRcsRcsZcsZc{ZcsRZkRRcRRZJJJBBBBBBRJBJJRRRZRRZRRJJRJJJJJJJJJJJJJRJBJJJJJRJJRJJRJJRJJRJJRJJRJRZRZcRZcJRcJRZRRZRRZRZcRZkRZkRZkZcsZcsZk{Zk{Zk{c{�c{�cs�c{�ks�cs�cs�cs�Zk{ck{ck{Zk{Zk{ck{ck{ck{ck{ZcsZcsZcsZcsZcsck{ZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsRZkRZkRZkRZkRZkRZkRZkRZkRZkJZkJZkJZkJZkJZkJZkJZkJZkJZcJRcBRcBRcJRcJRcBJZBJZBJZBJZBJRBJRBJR9BR9BR9BRBJZBJZBJZBJZBJZ9BR9BR9BJ9BR9BJ9BJ9BJ9BJ9BR1BR19J9BJ9BJ9BJ9BJ9BJ9BJ19J19J19B19B19B19B19B19B19B19B11911919B19B19B99B99B99B99B99B99B99B99B99B99991991991991999999B99B99B999BBBBBB9BB9BB9BJ9BJBBBBBBB99RJBRRJJJRJJJ9BJ9BJ9BJ9BJ9BBBBBBBBBJRBJR9BJ9BJBBBBBB9BJ9BJ9BJBBB9BJ9BJ9BJ9BJJJJJJJJJJBBBBBBBBB9BJJJJRJBJJJJJRJRcRZcRZkRZkZcsZk{Zk{Zk{Zk{Zk{Zk{Zk{Zc{Zc{Zk{cs�cs�cs�cs�cs�Zk{Zk{Rc{RcsRcsRc{Rc{RcsRcsJZkRZkRcsRcsRcsRcsRcsRc{Rc{Rc{RcsRcsRcsRcsRcsRcsRZkRZcRRZJJJJJJBBBRJBJJJJJRRRZRRJRRJJJJRJBRJBJJJJJJJJRJJRJJRJJRJJRJRJJJRJJRJRcRZkRZkJRZJRZRRcRZcRZcRZkRcsZcsZcsZcsRc{Zk{c{�c{�cs�cs�cs�cs�cs�ck{Zk{Zk{ck{ck{ck{Zk{Zk{Zk{ck{ck{ck{ZcsZcsZcsZcsZcsZcsZcsRZkRZkRZkRcsRZkRZkZcsZcsZcsZcsRcsRcsRcsRZkRZkRZkRZkJZkRZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZcJZcJRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BRBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J19J19J19B19B19B19B11911919B19B19B11919B19B99B99B99B99B99B99B99B99B99B99991991991991991999999B99B999B99BBBBBBBBB9BJ9BJ9BJBBBBBBBBBBBBJJJJJJ9BJ9BBBBBBBB9BB99BBBBBBB9BJBJR9BJBBBBBBBBB9BJJJJ9BJ9BJ9BJ9BJ9BJ9BJJJJJJJRJBBBBBBB9BJJJJJJRRRJRRZJRZJRcJZcRZkZcsZcsZk{Zk{Zk{Zk{Zk{Zk{Zk{Zc{RcsZc{Zk{cs�Zk{Zk{Zk{Zk{Zk{Rc{RcsRcsRc{Rc{RcsRZkJZkJZkRcsRcsRcsRcsRcsRcsRcsRcsRcsRcsRcsRcsRcsRcsRZkRZcRRZRRJJJJJJJJJJJJJJJRRRJRRJRRJJJJRJBRJBJJJJJRJJRJJRJRJJJRJJRJRJJJRJRZJRcRZkRZkJRcJRcJRcRZcRZcZcsZk{Zk{ZcsZcsRc{Zk{Zk{cs�ck{ck{cs�cs�cs�ck{Zk{Zcsck{ck{ck{ck{Zk{Zk{ck{ck{ZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsRcsRcsRcsZcsZcsZcsZcsZcsRcsRcsZcsRcsRcsRZkRZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZcJZcJRcJRcBRcBJZBJZBRcBRcBJZBJZBJZBJR9BR9BRBJRBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BJ99B9BJ9BJ9BJ9BJ9BJ19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B99B99B99999999B99B99B99B99B99991991911911991991999B99B99BBBBBBB9BJ9BJ9BJ9BJ9BJBBBBBBBBBBBBBBBBBBBBB99B99B99B99B99B9BB9BB9BJ9BJ9BJBBB9BJ9BJJJJBJRBJRBJR9BJ9BJ9BJ9BJ9BJJJJBBBBBBBBB9BJJJJJJRRRZRZcJRcJRcRZcRZkRZkZcsZc{Zk{Zk{Zk{Zk{Zc{Zc{Rc{RcsRcsZk{cs�Zk{cs�c{�c{�cs�Zk{Rc{Rc{Zc{RcsRZkJZkJZkRcsRcsRc{RcsRcsRcsRcsRcsRcsRcsRcsRZkRZkRcsRc{RcsRZcRRZRRJRRJJJRJJRJJJJJRRRJRRJJJRJJJRJBRJBJJJJJRJJRJJRJJRJJRJJRJJRRRZJZcJZcRZcRZcRZcJZcJZcRZcRZkZcsZk{Zk{ZcsZcsZcsZcsZcsZcsck{ck{cs�cs�cs�ck{ck{ck{ck{cs�cs�cs�ck{ck{ck{ZcsZcsZcsZcsZk{Zc{Zc{ZcsZcsZcsZcsZk{ZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsRcsRcsRcsRZkRZkRZkJZkJZkJZkJZkJZkJZkJZcJZcJZkJZkJZkJZkJZkBRcBRcBRcBRcBRcBJZBJRBJRBJR9BR9BR9BR9BRBJZBJZ9BR9BR9BJ9BR9BR9BR9BJ9BJ9BJ9BJ99B99B9BJ9BJ9BJ9BJ9BJ9BJ19B19B19B19B19B19B19B19B19B19B19B19B19B19B99B99991991999B99B99B99B99999999999911911991999999B99BBBBBBB9BJ9BJ9BJ9BJ9BJ9BJRJBBBBBBBBBBBBBB9999991991999999B9BB9BB9BJ9BJ9BJ9BJ9BJ9BJJJJJJJJJJBJR9BJ9BJBBBBBBBBBBBBBBBB99B99BBB9BJJJJJRZRZcRZcJRZJRZRRZRZcRZkRcsZcsZc{Zk{Zk{Zc{Zc{Zc{Rc{RcsRcsZk{Zk{Zk{Zk{Zk{cs�cs�Zk{Rc{Rc{Zk{Zc{RZkJZkRcsRcsRc{Rc{RcsRcsRcsRcsRcsRcsRcsJZkJZkRZkRcsRc{RZkRZcRZcRZcRRZRRZJJRJJRRRJRRJRRZJJRJJJJJJJJJJJJJJRJRZJRZJRZJJRJJRRRZRZcRZcJZcRZcRZcRZcRZcRZcRZkZcsZcsZk{Zk{ZcsZcsZcsZcsZcsZcsck{cs�cs�cs�cs�cs�ck{ck{cs�cs�cs�cs�cs�ck{ZcsZcsZcsZcsZk{Zk{Zc{ZcsZcsZcsZk{Zk{Zk{Zk{Zk{ZcsZcsZcsZcsZcsZcsZcsZcsRZkRZkRcsRcsRcsRZkRZkJZkJZkJZkJZkJZkJZkJZcJZcJZkJZkJZkJZkJZkJRcBRcBRcBRcBRcBJZBJRBJRBJR9BR9BR9BR9BRBJZBJZ9BR9BR19J19J9BR9BR9BR9BJ9BR9BJ9BB99B9BJ9BJ9BJ9BJ9BJ99B19B19B19B19B19B19B19B19B19B19B19B11911911911911911911999B99B99B99999B99B9BB9BB11911999999999B99BBBBBBB9BJ9BJBBBBBBBBB9BJJJJBBBB99B99BBBBBBB9991991999999B9BB9BJ9BJ9BJ9BJ9BJ9BJ9BJJJJ9BJ9BJ9BJ9BJBBBBBBBBBJB9JB9JB9B91B99BBB9BJJJJJRZRZcRZcJRZJJRJJRJRZRZkRcsRcsRcsRc{Rc{Rc{Rc{Zc{ZcsRcsRcsZc{Zk{Zc{Zc{Zk{Zk{Zk{Rc{Rc{Rc{cs�Zk{RcsRZkRcsRcsRcsRcsRc{Rc{RcsRcsZc{RcsJZkJRcJZkRcsRcsRcsJZkRZkRcsZcsRRZRRJRRZRRZRRZRRZRRZJJRJJRJJJJJJJJRRRZRRZJRZJRZJRZRRZRZcRZcRZcRRcRZcRZcRZcRZkRZkZcsZcsck{ck{ZcsZcsZcsZcsZcsck{ck{ck{ck{cs�cs�cs�cs�cs�ck{cs�cs�cs�cs�Zk{ZcsZcsZcsZcsZc{ck{ck{ZcsZcsZcsZcsZk{Zk{Zk{Zc{ZcsZcsZcsZcsRcsZcsZcsZcsZcsRZkRZkRZkRcsRcsRZkJZcJZcJZcJZkJZkJZkJZcJZkJZkJZkJZkJZkJZkJRcJRcBRcBRcBRcBRcBJZBJR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BJ19J19J9BR9BR9BR9BR9BR9BJ19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B11911911911911911911999999B99B99999999B9BB9BB9BB99B11999999999999B99BBBB9BJ9BJBBBBBBBBB9BJ9BJBBBB99B99JB9BBBBBB99B99B99B9BB9BJ9BJJJJ9BJ9BJ9BJ9BJ9BJBBB9BB9BB9BB9BB99BBBBJB9JB9JB9J91B91B99BBB9BJJJJJJRRRcRRcRRZJJRJJJJJRRZcRcsRcsRc{Rc{Rc{Rc{Zk{Zk{ZcsZcsRcsZc{Zc{Zc{Zc{Zc{Zc{Zk{Rc{Rc{Zk{cs�cs�Zk{RcsRcsRcsJZkJZkRc{Zc{RcsRcsRc{RcsJZkJZcRZkRcsRcsRZkJZkRZkRc{ZcsRZcRRZRRZRZcRZcRRZRRZRRZJJRJJRJJRJRZRRZRZcJRZJRZRRZRRZRZcRZcRRcRRcRZcRZcRZcRZkZcsZcsZcsZcsck{ck{ZcsZcsZcsck{ck{cs�ck{ck{cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�Zk{Zk{ZcsZcsZc{Zk{ck{ck{ZcsZcsRZkZcsZk{Zk{Zk{Zk{Zk{ZcsZcsZcsRcsRcsZcsZcsZcsRZkRZkRZkRcsRcsJZkJZcJZcJZcJZkJZkJZcJZcJZkJZkJZkJZkJZkJZkJRcJRcBRcBRcBRcBRcBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BJ19J19J9BR9BR9BR9BR1BR19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B11911911911911911991999991999999999B9BB9BB99B99999B19B11911911999999BBBB9BJ9BJBBBBBB9BJBBBBBBB99B99B99B99BBBBBB9BJ9BJ9BJ9BJ9BJ9BJJJJBJR9BJ9BJ99B99B99B9BB9BB9BB9BB9BBB99RJBRJBJB9J99J99J99BBBBBBJJJJJRJRcRZcRZcJRZJJRJJRRZcZc{Zk{Zk{Zk{Zk{cs�cs�Zk{ZcsRcsRc{Rc{Zk{Zk{Zk{Zc{Zc{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{RcsJZkJZkJZkRcsRcsRcsRcsRcsRcsRcsRZkRcsRcsRcsRcsJZkJZkRcsRcsRZkRZcRZcRZcJRcJRZRRZRRZRRZRRZRRZRRZRZcRZcRRZRRZRRZRRZRZcRZcJRZJRcRRcRZcRZkRZkZcsZcsRcsZcsck{ck{ZcsZcsZcsZk{cs�cs�ck{ck{cs�cs�cs�cs�ck{cs�cs�c{�cs�Zk{cs�Zk{Zc{Zc{Zk{Zk{Zk{Zk{Zk{ZcsRZkRZkZcsZk{Zk{cs�ck{ck{Zk{ZcsRcsRcsZcsZcsRcsRcsRcsRcsRcsJZkJZkJZkJZkJZkJZkJZkJZcJZcJZkJZkJZkJZkJZkJZkBRcBRcBRcBRcBRcBRcBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR19J19J19J9BJ9BJ19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B11911911911911911991991999999B9BB9BBBBB99B99999B99B11911991999999B9BJ9BJ9BJBBBBBB9BJBBBB99B99B99B99BBBBBB9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJBJR9BJ9BB9999999999BB9BB9BB9BB9B9B99JB9JB9J99J91J91JB9JB9BBB9BJJJRRZcRZkRZkRZcJJRJRZRZkZk{cs�c{�Zk{Zk{cs�Zk{Zk{Zc{Zc{Rc{Rc{Rc{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Rc{Rc{Zk{Zk{RcsJZkJZkRcsRZkRcsRcsRcsRcsRcsRcsRcsRcsRcsRcsRcsJZkJZkJZkRZkRZkRZkRZkRZcJRZJRZJRZRRZRRZRRZRRZRZcRZcRZcRRZRRZRRZRRZRRZJRZJRZJRZRZcRZkRZkRZkZcsZcsRcsRcsZcsck{Zcsck{ZcsZk{cs�cs�cs�cs�cs�cs�cs�cs�ck{cs�cs�c{�Zk{Zk{cs�cs�Zk{Zc{Zk{Zk{ZcsZcsZk{Zc{ZcsZcsZcsZk{Zk{Zk{cs�ck{Zk{Zk{ZcsRcsRZkRZkRcsRcsRcsRcsJZkJZkJZkJZkJZkJZkJZkJZkJZcJZcJZkJZkJZkJZkJZkJZkBRcBRcBRcBRcBRcBRcBJZBJZBRcBRcBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR19J19J19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B11911919B19B19B19B11911911911911111111999999B99BBBBBBB9BB9BB9BB99B9999199199999BB9BJ9BJ9BJBBBBBB9BJ9BJBBBB99B99BBBBBB9BJBBBBBBBBBBBBBBBBBBBBBBBB9BJ9BJ9BB9BB9B99B99B99BB9B99B9999B99J91J91J91J91J91J91JB9BBBBBBJJRRZkZcsZcsRZcJRZJRZRZkZk{cs�c{�c{�cs�Zk{Zk{Zc{Zc{Zk{Zk{Rc{Rc{Zc{Zc{Zk{Zk{Rc{Zk{Zk{Zk{Rc{Rc{Zc{RcsRZkJZkRZkRZkJZkRZkRcsRcsRcsRcsRZkRZkRcsRcsRcsRcsJZkJZkJZkRZkRZkRZkRZcRRZJRZJJRJJRRRJRRZRRZRRZRRZRZcRZcRZcRZcRRcRRcJRZJRZJRZRRZRZcRZkRZkRcsZcsZk{ZcsZcsZcsZcsZcsck{ck{cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�Zk{Zk{cs�cs�Zk{Zk{ck{ck{Zk{Zk{Zk{Zk{ZcsZcsZk{Zk{Rc{Zk{Zk{Zk{Zk{Zk{ZcsZcsRcsRcsRcsRcsRcsRcsJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJRcBRcBRcBJZBJZBRcBRcBJZ9BR9BR19J19J19J19J9BJ9BR9BR9BR9BR9BJ9BJ19J19J19J19J19J19J19J19J19B19B19J19J19B19B19B19B11911919B19B19B19B11911999911911111111919B19B99BBBBBBB9BB9BJ9BJ99B99991999999B9BB9BJ9BJ9BJBBBBBB9BJ9BJBBBBBBBBBJJJJJJJJJBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB9BJ9BB9BB9B99B99B99B99B9999B99B91J91J91J91J91J91J99BBB9BJJRZRZkZcsZcsRZkJRcJRcRZkZcsZk{c{�c{�cs�Zc{RcsRc{Zk{Zk{Zk{Zk{Zk{Zk{Zc{Rc{Rc{Rc{Rc{Rc{Rc{Rc{RcsRcsRZkJZkJZkRZkRZkJZkRZkRZkRcsRcsRZkJZkJZkRcsRcsRcsRcsJZkJZkJZkRZkRZkRZkRZcJJRJJRJJRJJRJRZRRZRRZRRJRRZRRcRRcRZkRZcRRcRRcJRZJRZJRZRRZRZcRZkRZkZcsZk{Zk{ZcsZcsZZcZcsZcsck{ck{cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�Zk{Zk{cs�Zk{Zk{Zk{ck{ck{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Rc{Rc{Rc{Zc{Zk{ZcsZcsZcsRcsRcsRcsRcsRcsRcsJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkBRcBRcBJZBJZBJZBJZBJZBJZ9BR19J19J19J19J19J9BJ9BR9BRBJR9BR9BJ9BJ19J19J19J19J19J19J19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B11911911911911911999B99B119119BBBBBBBBB9BJ9BJ99B11911999999B9BB9BJ9BJ9BJBBB9BJ9BJ9BJBBBBBBJJJJJRJJRJJJ9BJBBB9BB9BB99B99B9BBBBB9BB9BB9BJ9BJ9BB9BB9999999BB9BB99B999B99B91B91B91B91B91JB9RJBJJJJRZRZkZcsZk{RcsRZkJZcRZkZcsZk{Zk{c{�cs�Rc{RcsRc{Zk{Zk{Zk{Zk{Zk{cs�Zk{RcsRcsZk{Zk{Rc{Rc{Zk{Zc{RcsJZkJZkJZkRZkRZkRZkRZkRZkRZkRZkRZkJZkJZkRZkRcsRcsRcsJZkJZkJZkRcsRZkRZcRRZJJRJJJJJJJJZJRZJRZJJRJJRRRZRRcRZkRZkRZcJZcJZcRRZJRZJRZJRcRZkRZkZcsZcsZcsZk{ck{ZcsRZkRZkZcsck{ck{cs�cs�c{�cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{cs�Zk{Zk{Zk{Zk{Rc{Zc{ZcsZcsRc{RcsRZkRZkRcsRcsRcsRcsJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJRcJRcJRcBRcBJZBJZBJZBJZBJZBJZBJZ9BR19J19J9BR9BR9BR9BR9BR9BR9BR9BR9BJ19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B11911911911911999B119119119999BBB9BB9BB9BB99B11911999999B9BB9BJ9BJ9BJJJJJJJJJJ9BJBBBBBBJJJJJRJJRJJJBBBBBB9BB9BB99B99B9BB9BB9BB9BJ9BJ9BJ9BJ99B9999999BB9BB99B999B99B99B99B99999B99BBBRRJJJJJRZRZcZcsZk{Zk{ZcsRcsRZkRcsZcsZk{cs�Zk{RcsRcsRc{Zk{Zk{Zk{Zk{Zk{Zk{Rc{JZkJZkZk{Zk{Zk{Rc{Zk{Rc{JZkJZkJZkJZkRZkRZkRZkRZkRZkRZkRZkRZkJZkJZkRcsRcsRcsRcsJZkJZkRcsRcsRZkJRcJRZJJRJJJJJRJRZJRZJRZJJRJJRJRZRRcRZcRZcRZcJZkJZcRRZRRZJRZJRcRZkZcsck{ck{ZcsZcscs�ck{ZcsZcsZcsck{ck{ck{cs�cs�cs�cs�cs�cs�cs�c{�c{�cs�cs�cs�Zk{Zk{Zk{Zk{Zk{Zk{ZcsZc{Zk{Zk{Zk{Zk{Zk{ck{cs�Zk{Zk{ZcsRc{RcsZcsZcsRc{Rc{RZkRZkRcsRcsRcsRcsRZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJRcJRcBRcBJZBJZBJZBJZBJZBJZBJZBJR9BR9BR9BR9BRBJR9BR9BR9BR9BR9BR9BR9BJ19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B11911911911911911911991991999999B9BB9BB99B91991999999B9BB9BJ9BJBJRJJRJJJJJJBBBBBBBBBBBBJJJJJJJJJBBB99BBBB9BJBBB99B9BB9BJ9BJ9BJ9BJ9BJ9BJ99B99999B9BJ9BJBBBBBBBBBBBBBBBBBBBBBBBBJJJJJJJJJRRZRZkZcsRc{Zk{cs�cs�Zk{RcsRc{Rc{Zk{Rc{RcsRcsZc{Zc{Zk{Zk{Zk{Zk{Rc{JZkJZkJZkRcsZc{Rc{Rc{Zk{RcsJZkJZkJRcJZcJZcJZkJZkRZkRZkRcsRcsRZkRZkRZkRcsRc{RcsRZkJZkJZkRcsRcsRZkJZcJRZJJZJJZJRZJRZRRZJRZJJRJJRJRZRRZRRZRRZRZcJZkJZkRRZRRZJRZRZcZcscs�cs�ck{RZkRcsZk{cs�ck{ck{ZcsZcsZcsZcsck{ck{cs�cs�ck{cs�cs�c{�cs�cs�Zk{Zk{c{�cs�Zk{Zk{Zk{Zk{ZcsZcsck{cs�Zk{Zk{Zk{Zk{Zk{Zk{Zk{ZcsRcsRZkRZkZcsZk{Zc{RcsRZkRcsRcsRcsRcsRcsRcsJZkJZkJZkJZkJZkJZkJZkJZkJZcJZcJZkJZkJZkJZkJZkJRcBRcBRcBRcBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BR9BR9BJ19J19J19J19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B11911911911911991999991999999B99B99B99B9999199199999BB9BJBJRBJRJJRJJRJJJBBBBBBBBBB99BBBBBBBBB99B99B9BJ9BJBBBBBB99B9BBBBB9BJ9BJ9BJ9BJ9BB999BBBBBB9BJ9BJ9BJ9BJ9BJ9BJBBBBBB9BJJJRJRZJRZRZcZcsZcsRc{Zk{c{�c{�Zk{Zk{Zk{Rc{Rc{RcsRcsRcsZc{Zc{RcsRc{Zk{Zk{RcsJZkJZkRcsRZkRcsRcsRc{Rc{RcsJZkJRcJRcJRZJRcJZcJZcJZkJZkRcsRcsRcsRZkRZkRc{Rc{RcsRZkJZkRZkRZkRZkJZkJZcJRcJRcJRcJRZRRZRRJJJRJJRJJRJJRRRZRRZRRZRZcJZkJZkRZcRZcRZcZcsck{cs�ck{ZcsRZkRZkZk{cs�cs�ck{ZcsZcsRZkZcsZcsck{cs�cs�ck{ck{cs�cs�cs�cs�Zk{Zk{c{�cs�Zk{Zk{Zk{ZcsZcsZcsck{cs�Zk{Zk{Zk{Zk{Zk{Zk{Zk{RcsRZkRZkRcsZcsZk{Zk{RcsRcsRcsRcsRcsZcsZcsRcsRcsJZkJZkJZkJZkJZcJZkJZkJZcJZcJZkJZkJZkJZkJZkJRcJRcBRcBRcBRcBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BR9BR9BJ19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19B19B11919B19B19B19B11911911991999999999999B9BJ9BJBBBBBB99B999919999BBB9BJBJRBJRJJRJJRJJJ9BJBBBBBBB99B99BBBBBB9BB9BB9BJ9BJ9BJBBB99B999BBBBBB9BJ9BJ9BJBBBBBBB9999999B9BJ9BJ9BJBBBBBB9BB99B9BJJJRRZcRZcRZkZcsZcsZc{Zk{cs�c{�Zk{Zk{Zk{Zk{RcsRcsRcsRc{Rc{Rc{RcsRcsZc{Zc{RcsRcsRcsRcsRcsRcsRcsRcsRc{Rc{JZkJRcJJZJRZJRZRZcRZcJZkJZkJZkRZkRZkRZkRcsZk{Zk{RcsRcsRZkRZcRZcRRcRRcRRcRZcJRcRRcRRZRRJRRJJRJJRJJRJJJRRRZRZcRRcRRcRZcRZkRZkZcsZcsZcsck{ck{ZcsZcsRZcRZkRcsZk{cs�ck{ck{ZcsZcsZcsck{ck{cs�cs�ck{ck{cs�cs�cs�cs�cs�cs�cs�Zk{Zk{Zc{ZcsZcsRcsRcsZk{Zk{Zk{Zk{Zk{cs�cs�Zk{Zk{RcsZcsZcsZcsZc{Zk{Zk{RcsRZkRZkRZkRcsZcsZcsRcsRcsRcsJZkJZkJZcJRcJRcJRcJRcJZkJZkJZkJRcBRcBRcJRcJRcJRcBRcBRcBJZBJZBRcBJZ9BR9BJ9BR9BR9BR9BRBJZBJZ9BR9BR9BR9BR9BJ19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19J19B19B19J19B19B11919B19B19B19B19B99999999999B9BB99B99B9BJ9BJBBBBBB9BB99B999999BBB9BJ9BJBJRBJRJJRJJJJJJ9BJBBBB99B99BBB9BJ9BJ9BJ9BJ9BJ9BJBBBBBB999BBB9BJBJRBJRJJJ9BJBBBBBB99999BBBBBBBBBBBBB9BB9BB99B9BJJRZRZcRZkRZkRZkZcsZcsZk{Zk{cs�cs�cs�cs�Zk{ZcsRcsRc{Rc{Zk{Rc{RcsRcsRc{Zc{RcsRcsRcsZcsRcsRcsRcsRcsRc{Rc{JZkJRcJJZJJZRRcRZkRZkRZkJZkJZkRZkRZkRZkRcsZk{Zk{ZcsRcsRZkRZkRRcRRZRRZRRcRZcRZkRZcRRZRRZRRJJRJJRJJRJJJRJRZRRZRRcRZcRZkRZkZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZcsZk{cs�ck{ck{ck{Zk{Zk{ck{ck{cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�ck{Zc{ZcsZk{ZcsRcsRcsZk{Zk{Zk{Zk{cs�cs�ck{Zk{Zc{RcsZcsZcsZcsZc{Zk{ZcsRcsRcsRZkRZkRcsRcsRcsRcsRcsRZkJZkJZcJRcJRcJRcJRcJZkJZkJZkJZkBRcBRcBRcBRcJRcJRcBRcBRcBJZBJZBRcBJZ9BR9BJ9BR9BR9BR9BRBJZBJZ9BR9BR9BR9BR9BJ19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19J19B19B19B19B11911919B19B19B99B99B99B99999B9BJ9BJ9BB99B99B99B9BB9BB9BB99B99B99BBBBBBB9BJ9BJBJRBJRJJRJJJ9BJBBBB99B999BJBJR9BJ9BJBBBBBB99B99BBBBBBBBBB9BJJJZJJZJJJ9BJ9BJ9BJ9BB9BB9BB9BB99B99B9B99BB9BB9BJJJZRZcRZcRZcRZcRZkZcsZk{Zk{Zk{cs�cs�cs�Zk{Rc{RcsZc{Zc{Zc{Rc{Rc{Rc{Rc{Rc{RcsRcsZcsZc{Rc{Rc{Rc{Rc{Zc{RcsRZkJRcJJZJJZRZkRcsRcsRcsRcsRZkRZkRZkJZkRcsZc{Zc{RcsRcsRcsRZkRZcRRJJJRRRZRZkRZkRZcRRZRRZRRZJJRJJRJJRJJRJJRJJRJRZRZkRcsZk{Zk{ZcsRZcRZcRZcRZcZcsZcsZk{Zk{Zcsck{cs�cs�ck{ck{ck{ck{ck{ck{cs�c{�cs�cs�cs�cs�cs�Zk{ck{cs�cs�cs�ZcsZcsck{ck{ZcsZcsZc{Zk{Zk{ck{cs�cs�Zk{Zk{ZcsZcsRZkZcsZcsZcsRcsRcsRcsRcsRcsRcsRcsJZkRZkRZkRZkJZkJZkJZkJRcJRcJRcJZkJZkJZkJZkJZkBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BR9BR9BR19J19J19J19J19J19J19B19B19B19B19B19J19J19B19B19B19B19B19B19B19B11911919B19B99B99B99B99B99B9BB9BJ9BJ99B99999B9BB9BB9BB99B99B99B9BBBBBBBBBBB9BJ9BJBJRJJRJJJ9BJBBBB99BBB9BJBJR9BJBBBBBBB9999999999BBBB9BJJJJJJRBJR9BJBBBBBB9BJ9BJ9BB9B9999999999999B99BBB9BJBJRJRcRZcRZkRZcRZkZcsZk{Rc{Rc{Zk{cs�c{�cs�Zk{Rc{Zc{Zc{Zc{Zk{Zk{Zk{Rc{Rc{RcsRcsZc{Zk{Rc{Rc{Rc{Zk{Zk{Zc{RZkJRcJRZJRcRZkRcsRcsRcsRcsRZkRZkRZkJZcRZkRcsRc{RcsRcsRcsRZkRZcRRZJJRRRZRZkRcsRZcRRcRRZRRZRRZJJRJJRJJRJJRJRZRRcRZkZk{Zk{Zk{ZcsRZcJRZJRZRZcZcsck{cs�ck{ck{ck{cs�cs�ck{ck{ck{cs�ck{cs�cs�cs�cs�cs�cs�cs�Zk{Zk{Zk{ck{cs�cs�ZcsZcsck{ck{ZcsZcsZcsZc{Zk{cs�cs�cs�Zk{ZcsZcsZcsRZkRZkZcsZcsZcsRcsRcsRcsRcsRcsRcsJZkJZkJZkJZkJZcJZkJRcJRcJRcJZkJZkJZkJZkJZkBRcBRcJRcBRcBRcBRcBRcBRcBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BJ19J9BR9BR9BJ19J19J19J19J19J9BJ19J19B19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B99B99B9BJ19B19B9BJ9BJBBBBBB99999999B9BB9BJBBB99B9999BBBBBBBBBBB9BJ9BJ9BJ9BJJJJJJJBBB999B99BBBJJJ9BJ9BJ9BBBBB999B9999999999B9BJJJJ9BJ9BJBBB99B9BB9BBBBBBBB999999999999999BBBBBBJJJJJJJRZRZkZcsRZkZcsZcsZcsRcsRcsZk{cs�c{�cs�Zk{Rc{Rc{Zk{Zk{Zk{Zk{Zk{RcsJZkJZkRcsZc{Zk{Rc{Rc{RcsRcsRc{Rc{RZkRZcJRcJRcRZkRZkRZkRZkRZkRZkRZkRZkRZkRZkRcsRcsRcsRcsRcsRZkRZcRZcRRcRZcZcsZcsRZkRRcRRZRRZRRJJJRJJRJJRJJZJRcRZkZcsZcsZcsZcsZcsRZcRZcRZcZcsZk{cs�cs�ck{ck{ck{ck{ck{ZcsZcsck{ck{ck{ck{ck{ck{ck{cs�cs�Zk{Zk{Zk{Zk{Zk{cs�ck{Zk{Zk{ck{ck{ZcsZcsZcsZc{Zk{Zk{cs�cs�Zk{ZcsZcsRZkRZkRZkRZkZcsZcsZcsRcsRZkRcsRcsRcsJZkJZkJZcJRcJRcJRcJRcBRcBRcJZkJZkJZkJZkBRcBRcJZkJZkJZkJRcBRcBJZBJZBJZBRcBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BJ19J19J19J19J19J19J19J9BJ9BJ19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B99B99B9BJ9BJ19B19B19J9BJBBBB9999999999B9BJ9BJ9BJBBBBBBBBBBBBBBBBBB9BJ9BJ9BJ9BJ9BJBBBBBBB99BBBBBBJJJBBB9BB9999999999999991199999BB9BJ9BB99B999999999BBBBBBBBBBBB99B999999999BBBBBBJJJJJJJRZRZcZcsZcsZk{Zk{Zk{ZcsZcsZk{cs�c{�cs�Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{RcsJZkJZkRcsRc{Zc{RcsRcsRcsRcsRc{Rc{RcsRZkRZkRZkRZkRZkRZkRZkRZkRZkRZkRZkRZkRZkRcsRcsRcsRcsRcsRZkRZkRZcRZcRZkZcsZcsRZkRZcRRZRRJRRJJJRJJRJJRJJZJRcRZkZcsZcsZcsZcsZcsRZkRZcRZcZcsZcsck{cs�ck{ck{ck{ck{ck{ZcsZk{ck{cs�cs�cs�ck{ck{ck{ck{Zk{Zk{Zk{Zk{Zk{Zk{Zk{ck{Zk{Zk{ck{ck{ZcsZcsZc{Zk{Zk{Zk{Zk{Zk{ZcsRZkRZkRZkRZkRZkRZkRZkZcsZcsRZkRZkRcsRcsRcsRZkJZkJZcJRcJRcJRcJRcBRcBRcJRcJZkJZkJRcBRcBRcBRkJZkJZkJRcBRcBRcBJZBJZBRcBRcBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BRBJR9BR9BJ19J19J19J19J19J19J19J9BJ9BJ19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B99B9BJ9BJ9BJ19B19B19J9BJ9BJ9BB99999B99B9BJ9BJ9BJ9BJBBBBBBBBBBBBBBB9BJ9BJ9BJ9BJBBBBBBBBBBBBBBBBBB9BJ9BB11911191991911111111199999999B9BB99B919919BBBBBBBBBBBB9BJBBB9BB9B9999B99BBBJJJJJRJRZJRcRZkZk{Zk{cs�Zk{Zk{Zk{cs�cs�Zk{Zk{Zk{Zk{Zk{Zk{Zk{Rc{Zk{Rc{Rc{Rc{JZkJZkRc{Rc{RZkRZkRcsZk{Rc{Rc{RcsRcsRZkRZkRcsRcsRcsRZkRZkRZkJZcJZkRZkRcsRcsRcsRcsRcsRcsRZkJZkJRcRRcRZcRZkZcsRZkRZcRRZRRJJJRJJRJJRJJRJJRJRZRRcRZcRZcRZkRcsRcsZcsZcsZZcZZcZZcZcsck{cs�cs�cs�ck{ck{ck{ck{cs�cs�cs�cs�cs�cs�cs�Zk{Zk{Zk{Zk{Zk{ZcsZcsZk{Zk{Zk{Zk{ck{ck{Zk{Zc{Zk{Zk{Zc{Zc{Zk{Zc{ZcsRZkRcsRcsRcsRcsRZkRZkRcsRcsRZkRZkRZkRcsRcsRZkRZkJZkJZcJZcJZcJZkJZkJZkBRcBRcJRcJRcJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZBJZBJZBJZ9BR9BR9BR9BRBJR9BR9BJ19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J9BJ9BJ9BJ19B19B9BJ9BJ9BB9BB99B99B9BJ9BJ9BJ9BJ9BJ9BJBBBBBBBBBBBBBBB9BJ9BJ9BJBBBBBBBBBBBBBBB99B99B99911111111111111111111191191999999B999999999BBB9BJ9BB9BB9BJ9BJ9BB9B99B9B99BBBJJJJRZJRcRRcRZkZk{c{�c{�cs�Zk{Zk{cs�Zk{Rc{Rc{Zk{Zk{Zk{Zk{Rc{RcsRc{Rc{Zk{Rc{RcsRcsRc{RcsRZkRZkRcsRc{Rc{Rc{RcsRcsRcsZcsZcsRcsRcsRZkRZkRZcJZcJZcJZkRcsRcsRcsRcsRcsRcsJZkJRcJRcJRcRRcRZcRZkRZkRZkRRZRRZJRZJRZJRZJJRJJRJJRRRZRZcRZcRZkRcsZcsZcsZcsZcsZZcZZcZcscs�ks�ks�cs�cs�ck{ck{cs�cs�c{�cs�cs�cs�cs�Zk{Zk{Zk{Zk{Zk{Zk{ZcsZcsZcsZk{Zk{Zk{Zk{Zk{Zk{Zc{Zk{Zk{Zc{Zc{Zc{ZcsRcsRcsRcsRcsRcsRcsRZkRcsRcsRcsRZkRZkRZkRZkZcsRZkRZkJZkJZcJZcJZkJZkJZkJRcBRcBRcJRcJRcJZkJZkBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B11911919B19B19J19J19J19J9BJ9BJ9BJ9BJ99B99B99B9BJ9BJ9BJ9BJ9BJ9BB9BB9BJBBBBBBBBBBBBBBBBBB9BJ9BJBBBBBBB999999199999999999111111111111111119119199999999999999B99BB9BJ9BB9BB9BJ9BB99B999999BBBJJJBJRJJZJRcRZcZcsZk{cs�cs�Zk{Zk{Zk{Zk{Rc{Rc{Rc{Rc{Zk{Zk{Zk{RcsRcsRc{Zk{Zk{Zc{Rc{RcsRcsRcsRcsRcsRZkRcsRc{RcsJZkRZkRcsZc{ZcsRcsRZkJZkRZcRZcJZcJZcJZkJZkRZkRZkRZkRZkRZkJZkJRcJRZJRZJRZJRZRZcRZkZcsRRZRRZRRZRRZRRZRRZRRJRRJRZcZcsZcsZcsRcsZcsZcsck{ck{ZcsZcsck{cs�ks�ks�ks�cs�ck{cs�cs�c{�c{�cs�cs�cs�cs�cs�cs�Zk{Zk{Zk{ZcsZcsRZkZcsZcsZcsZk{Zk{Zk{Zc{Zc{Rc{Rc{Rc{Rc{RcsRcsZcsZc{Zc{ZcsRZkRZkRcsRcsRcsRcsRcsRcsRcsRcsRZkRZkRZkJZkJZkJZkJZkJZkJRcBRcBRcBRcJRcJRcJZkJZkBRcBRcBRcBRcBJZBJZBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BJ19J19J19J19B19B19B19B19B19B19J19J19J19B19B19B19B19B19B19B19B19B19B19B11911911919B19B19J19J19J9BJ9BJ9BJ9BJ99B99B9BJ9BJ9BJJJJ9BJ9BJ9BB9BB9BJ9BJBBBBBBBBBBBB9BJJJJJJJJJJBBB99B99991991191999B99B1191111111119119119199199199999B99BB9BB9BB9BB9BB9BB9BBBBBB999B9BBBJJJJJRJRZJZcRZcZcsZk{Zk{Zk{Zk{Zc{RcsRc{Rc{Zk{Zk{Rc{Rc{Rc{Rc{RcsRcsRcsRc{Zc{Zc{Rc{Rc{RcsRcsRc{Rc{JZkJZkRc{RcsRZkRZkRcsZc{RcsRZkJZkJZkRZkRZcJZcJZkJZkJZkRZkRZkRZkRZkJZkJRcJRZJJZJRZJRZJJZJRZRZkZcsRRZRRZRRZRRZRRZRRZJJRJJRRZcZcsZcsZcsZcsZcsck{ck{ck{ck{ck{cs�ks�ks�ks�ks�cs�cs�cs�ks�c{�c{�cs�cs�cs�cs�cs�cs�Zk{Zk{Zk{ZcsZcsRZkZcsZcsZk{Zk{Zk{Zk{Zk{Zc{Rc{Rc{Rc{Rc{RcsRcsZc{Zc{Zk{ZcsRZkJZkRcsRcsRcsRZkRZkRcsRcsRcsRZkRZkRZkJZkJZkJZkJZkJRcBRcBRcBRcBRcJRcJRcJRcJZkBRcBRcBRcBRcBJZBJZBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR19J19J19J19B19B19B19B19B19B19J19J19J19B19B19B19B19B19B19B19B19B19B19B11911911911919B19B19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJBBB9BB9BB9BB9BJBJRBJRBJRJJRJJJJJJBBBBBB99991191999B9BJ99B999911911999B9991191199999B9BB9BB99B99B9BB9BB9BBB99BBBBBBB99B99BBBJJRJRZRZkRZcRZkZc{Zk{Zk{Zk{RcsRcsRc{Zk{Zk{Zk{Zc{Rc{Rc{Rc{Rc{RcsRcsJZkRcsRcsJZkRcsRcsRc{Rc{Rc{RcsRcsZc{ZcsRZkRZcRZkRZkRZkJZkRcsRcsRZkRZkJZkJZkJZkRZkRZkRZkRZkRZkRZkJRcJJRJJJJRZRRZJJRRRZRZcRZkRRZRRJRRJRRJRRJJJRJJJJJJRRZRZkZcsZcsZcsck{ZcsZcsck{ck{cs�ks�ks�ks�ks�cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�cs�Zk{Zk{Zk{Zk{Zk{ZcsRZkRZkZcsZk{Zk{Zk{Zk{Zk{Zk{Zk{Zc{Zc{Zc{Zc{Zc{Zc{Zc{Zc{Zc{Rc{RcsJZkJZkRZkRZkRZcJZcJZcJZkJZkRZkRZkJZkJZkJZkJZkJZkJRcBRcBRcBRcJRcJRcJRcBRcBRcJZkJZkBRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBRcBRcBJZBJZBJZBJZ9BR9BR9BR9BR9BJ19J19J19B19B19B19B19B19J19J19B19B19B19B19B19J19J19B19B19B19B11911911911911919B19B19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BB9BB9BJBJRBJRBJRBJRBJRJJJJJJ9BJ9BJBBB99999B9BJ9BR9BJB99999911B99B9991191199999B9BB9BB9999999BB9BB9BBB99B99JB9JB9BBBBBBJJRJRZRZkRZkRZkZcsZk{Zk{Zk{ZcsRcsRc{Rc{Zk{Zk{Zk{Zc{Rc{Rc{Rc{Rc{JZkJZkJZkJZkJZkJZkRcsRc{Rc{RcsRcsRcsZc{Zc{RcsRZkRZkRZkJZkJZkRcsRcsRcsRZkRZkJZkRZkRZkRZkRZkRcsRcsJZkJRZJJJJJJRRJRRJRRJJJRRRZRZcRZcRRZJJRRRJRRJJJJJJJJJJJJRRZcZcsZk{ck{ck{ck{Zcsck{ck{ks�k{�k{�ks�ks�cs�ks�ks�cs�cs�cs�cs�cs�cs�cs�cs�Zk{Zk{Zk{Zk{Zc{ZcsRZkRcsZcsZk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zc{Zc{Zk{Zk{Zk{Zc{Zc{Zc{Zc{RcsJZkJZkJZcRZcRZcJRcJRcJRcJZkJZkJZkJZkJZkJZkJZkJZcJZcJRcBRcJRcJRcJRcJRcBRcBRcJZkJZkBRcBRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BJ19J19J19J19B19B19B19B19B19B19B19B19B19B19B19J19J19B19B19B19B11911911911919B19B19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJBJRBJR9BJ9BJ9BJ9BJBJRBJR9BJJJJJJJJJJ9BJ9BJJJJ9BJ99B9BJ9BRBJR9BJB9991191199999991991911999B9BBBBB9999999B99BBBBBBBBB99B91B99BBBJJJBJRJRZJRcRZkRcsZcsZk{Zk{Zk{Zc{Zc{Rc{Rc{RcsRcsZk{Zk{Rc{Rc{Rc{RcsRZkJZkJZkJZkJZkJZkRcsRcsRcsRcsRcsRcsRc{Rc{RcsJZkJZkJZkRcsRcsRcsRcsRcsRZkRZkRZkJZkJZkRZcRZkRc{RcsJZkJRZJJRRRJRRJJJRJJJJJJJJRRRZZZcRZcJJRRJBJJJJJJJJJJJRBJRJZcZcscs�cs�cs�ck{ck{cs�cs�cs�ks�ks�ks�ks�ks�ks�ks�cs�cs�cs�cs�c{�c{�cs�ck{Zk{Zk{Zk{Zk{RcsRcsZcsZcsZk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{ZcsZcsZk{Zk{Zk{Zc{Zc{Zc{Zc{ZcsRZkJRcJRZRZcRZcJRcJRcJRcJRcJZcJZkJZkJZkJZkJZkJZkJZkJZkJRcJRcJRcJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZBRcBRcBJZBJZBJR9BR9BR9BRBJZ9BR9BR9BR9BR19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B11911911911919B19B19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BR9BJ9BJ9BJ9BJ9BJBJRBJR9BR9BJ9BJ9BJBJRBJR9BJBBB9BJ9BJ9BJJJJJJRJJR9BJ9BJBJR9BJ9BJB999119119999999199199999BBBBBBBB99B9999999BB9BJBBB999911B99BBBJJJBJRJRZJRcRZkZcsZk{Zk{Zk{Zk{Zk{Zc{Zk{Rc{JZkRcsZk{cs�Zk{Rc{Zk{RcsRZkJZkJZkJZkRcsRcsRcsRcsRZkRcsJZkRcsRc{Rc{RcsJZkJZkJZkRcsRcsRcsRcsRZkRZkRZkRZkRZkRZkRZkRZkRc{RcsJZkJRZJJRJJRRRJJJRJJJJJJJRJRRZRZkZZcJJRRJBJJJJJJJJRJRZJJZRZcZcscs�cs�c{�cs�cs�cs�c{�cs�cs�ks�ks�ks�ks�ks�ks�cs�cs�cs�cs�c{�cs�cs�ck{Zk{Zk{ZcsZcsRcsRcsZcsZcsZk{Zk{Zk{Zk{ZcsZcsZk{ZcsZcsZcsZcsZcsZk{Zk{Zk{Zc{Rc{ZcsZcsRZkJRcJRZRZcRZcJZcJRcJRcJRcJZcJZcJZkJZkJZkJZkJZkJZkJZkJRcJRcJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZBJZBRcBRcBJZBJR9BR9BJ9BJ9BR9BR9BR9BR9BR19J19J19J19J19J19J19B19B19B19B19B19B19B)1919B19B19B19B19B19B19B19B119119)19)1919B19B19J19J19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ99B99B9BJ9BJ9BJ9BJBJRBJR9BJ9BJ9BJ9BJ9BJ9BJ9BJJJJJJJJJRJRZJJZBJR9BR9BJ9BJ9BJBBB999911B91999919999BBBJJJ9BJBBB9BB99999999B9BB9BBB99B91999BBB9BJJJRJRZJZcRZcRZkZk{Zk{Zk{Zk{Zc{Zc{Rc{Rc{RcsZc{Zk{cs�Zk{Zk{Zk{RcsJZkJZkJZkRcsRcsRcsRcsJZkJZkJZkRcsRcsRcsRcsRcsRcsJZkJZkRZkRZkRcsRcsJZcJZcJZcRZkRZkRcsRcsRcsRcsRcsRZcJRZJJZJJRJJRRRJRRJRRJRRJRRZRZkZZcRRZJJJJJJJJRJRZJRZJRcRZkZcsck{cs�c{�cs�cs�cs�cs�cs�cs�ks�ks�ks�ks�ks�ks�cs�cs�cs�cs�cs�cs�cs�cs�Zk{ZcsZcsZcsZcsZcsZk{Zk{Zk{Zk{Zk{Zc{RcsRcsZcsZcsZcsZcsRZkRcsZk{Zk{Zk{Rc{RcsRcsRcsRZkJZcJRcRZcRZcJZcJZcJZcJZcJZcJZcJZkJZkJRcJRcJZkJZkJRcJRcJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZ9BR9BRBJZBJZBJZ9BR9BR9BR9BJ19J19J9BR9BR9BR9BR19J19J19J19J19J19J19B19B19B19J19B)19)1919B19B19B19B19B19B19B19B119119)1919B19B19B19B19J19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ99B99B9BJ9BJ9BJ9BJBJRBJR9BJ9BJ9BJ9BR9BJJJJJJJJJJJJRJJRJJZBJZBJR9BJ9BJBBBBBBBBB999B91B91B9191199BJJJJJRJJJBBB9BB99999999B99B9BBB99B999B99BBJJJJJRJZcJZkRZcRZkZk{Zk{Zk{Zk{Zc{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Rc{RcsRcsRcsRcsRcsRcsRcsRcsJZkJZkRZkRcsRcsRcsRZkRZkRcsRcsRcsRZkRZkRcsJZkJRcJRcJRcRZkZcsZcsRcsRcsRcsRZkRZcJRcJRcJJZJJRRRJRRZRRZRRZRRZRZkRZkRRZJRZJRZRRZRZcRZkRZcRZkZcsZk{cs�cs�cs�cs�cs�cs�cs�c{�c{�ks�ks�ks�cs�cs�cs�cs�cs�cs�ck{ck{cs�Zk{Zk{Zk{ZcsZcsZcsZk{Zk{Zk{ZcsZcsZc{Zc{RcsRcsZcsZcsZcsZcsRZkRZkZcsZk{Rc{Rc{RcsRcsRcsRcsRZkJZcRZcRZcJZkJZkJZkJZkJZcJZcJZkJRcJRcJRcJRcJRcJRcJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZ9BR9BR9BRBJZBJZ9BR9BR9BR9BR9BR19J19J9BR9BR9BR1BR19J19J9BJ9BJ19J19J19B19B19B19J19B119)1919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J9BJ9BJ19J9BJ9BR9BR9BJ9BJ9BB9BJ9BJBJRBJRBJRBJRBJR9BJ9BJ9BRBJRBJRJJRBJRBJRBJRBJRBJRBJRBJR9BJBBBBBB999999B99B99B99B9999999BJJJJJRJJJBBB9BB99999999999B9BBBBBBBBBBB9BJJJJJJRJRcJZkRZkRcsZc{Zk{Rc{Rc{Zk{Zk{Zk{cs�cs�Zk{Zk{Rc{Zk{Rc{RcsJZkRc{Rc{RcsRcsRcsRcsRcsRcsRcsRcsRcsRcsRZkRZkRZkRZkRcsRcsRZkRZkRZkJZkJRcJRcJZcRZkRZkZcsRcsRcsRcsRZkJZkJZcJZcRRZJJRJJRRRZRRZJJRJRZZZcRZkRZcRRcRRcRZcRZkZcsRZkZcsZcsZcsck{cs�cs�ks�c{�c{�ks�ks�c{�c{�ks�cs�ck{ck{cs�cs�cs�cs�cs�cs�Zk{Zk{Zk{cs�cs�Zk{Zk{Zk{Zk{ZcsZcsZcsZc{Zc{Zc{Zc{Zc{Zc{Zc{ZcsZcsZcsZcsZcsRc{Rc{Rc{Rc{Rc{RcsRZkRZcJZcJZkJZkJZkJZkJZkJZcJZcJZcJZcJRcJRcJRcJRcJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR19J19J19J9BJ9BJ9BR9BJ19B19B11911919B19B19B19B19B19B19J19J19B19B19B19J19B19B19B19B19B19B19B19B19J19J9BJ9BJ19J19J9BR9BR9BJ9BJ9BJJJJBJRBJRBJRBJRBJRBJR9BJ9BJBJRBJRJJRJJRBJRBJRBJR9BJ9BJ9BJ9BJ9BJBBBBBB999919B99B99B99B99999BBB9BJJJJ9BJBBB9BB9B999B99B9BB9BJ9BJ9BJ9BJBJRJJRJRZJZcRZkRZkZcsZcsZc{Zk{Zk{Zk{Zk{Zk{c{�c{�cs�Rc{Rc{Rc{Rc{RcsRcsRc{Rc{RcsRcsRcsRcsRcsRcsRcsRcsRcsRcsRZkRZkJZkRZkRcsZcsRc{RcsJZkJZcJZcJZcJZcJZkRZkRcsRcsRcsRcsRcsJZkJZkRZkRZcRRJJJRRRZRRZJJRJJRRZcRZkRZkRZcRZcRZkZcsZcsZcsZcsZcsck{ck{cs�cs�cs�cs�cs�c{�ks�c{�c{�ks�cs�ZcsZcscs�cs�ck{ck{cs�cs�Zk{Zk{cs�c{�c{�cs�Zk{Zk{Zk{ZcsRcsRcsZcsZc{Zc{Zc{Zc{Zc{Zc{Zc{ZcsZcsZcsZcsRc{Rc{Rc{Rc{Rc{RcsRZkRZkJZkJZkJZkJZkJZkJZkJZcJZcJZcJZcJZcJRcJRcJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BJ19J19J19J9BJ9BJ9BR9BR19J19B11911919B19B19B19B19B19B19J19J19B19B19J19J19B19B19B19B19B19J19J19J19J19J9BJ9BJ19J1BR9BR9BJ9BJ9BJ9BJJJJBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRJJRJJJ9BJBBBBBB9BJ9BJ9BJBBB99B999B99B99B99B99BBBBBBBBB9BJ9BB9BBBBBBBBBBBBBB9BJJJJJJJBJRBJRBJRJRZRZcRZkRcsRZkZcsZcsZcscs�Zk{Zk{Zk{Zk{Zk{cs�Zk{Zk{Rc{Rc{Rc{Rc{RcsRcsRcsRcsRcsRZkJZkJZkRZkRcsZcsRc{Rc{RcsRZkRZkRZkRZkZcsZk{Zk{RZkJZkRZkRZkJZcJZcRZkRcsRcsRcsRcsRcsRZkRZkRZkRZcJJRRRJRRZRRJJJRJJRRRZRZcRZkRZkJZcRZkRZkZcsZcsck{ck{cs�cs�cs�cs�ck{Zk{Zk{cs�c{�ks�ks�c{�cs�Zk{Zcsck{ck{ck{ck{cs�cs�Zk{Zk{c{�c{�c{�Zk{Zk{Zk{Zk{ZcsRcsRZkZcsZcsZcsZcsZc{Zc{Rc{Rc{Zc{ZcsRcsRcsRc{Rc{RcsRcsRcsRcsRcsRcsRcsRZkJZkJZkJZkJZkJZcJZcJZkJZkJZkJZkJZkJZcJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZ9BR9BR9BR9BR9BR9BR9BJ19J19J9BR9BR9BR19J19J19J9BJ9BR9BR9BJ19J19B19B19B19B19B19B19B19B19B19B19J19J19B19B19B19B19B19B19J19J19J19J19J19J9BJ9BJ9BJ19J9BJ9BJ9BJ9BJ9BJ9BJ9BJBJRBJRBJRBJRBJRBJRBJRBJR9BJBJRBJRJJRJJJJJJBBBBBBBBBBBB9BJ9BJ9BJ9BB99BB99B99999999BBBBBB9BB9BB9BB9BJ9BJJJJJJJJJJBJRJJRJJRJJRBJRBJZJRcRZkRZkRcsRZkRZkZcsZk{cs�Zk{Zk{Zc{Rc{Rc{Zk{Zk{Zk{Rc{Rc{Rc{Rc{Rc{JZkJZkRcsRcsJZkJZkJZkRZkRZkRcsRc{Rc{RcsRcsRcsRcsRcsZcsZk{Zk{RcsJZkRZkRZkJZcJZcRZkRcsRcsRcsRcsRcsRZkRZkRZkRZcJRZJRZRRZJRZJJRJJRJRZRZcRZkRcsRZkZcsZcsZcsck{ck{ck{cs�ks�ks�cs�cs�ck{ck{cs�cs�ks�cs�cs�Zk{Zk{ZcsZk{ck{ck{ck{cs�c{�Zk{cs�c{�cs�Zk{Zk{Zk{Zk{Zc{ZcsRcsRZkZcsZcsRcsRcsZc{Zc{Rc{Zk{Zk{Zc{ZcsRcsRc{Rc{RcsJZkRcsRcsRcsRcsRcsRcsJZkJZkJZkJZkJZcJZcJZkJZkJZkJZkJZkJZkJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZ9BR9BR9BJ9BR9BR9BR9BJ19J19B19J9BJ9BR9BR9BJ19J19J9BJ9BR9BR9BR19J19B19B19B19B19B19B19B19B19B19B19J19J19B19B19B19B19B19J19J19J19J19J19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJJJJJJJJJJ9BJ9BJBBB9BB9BBBBB9BJ9BJ9BJ9BBBBBBBBB999B999999999B99B9BJ9BJ9BJ9BJJJJJJRJJRJRZJRZJRZJRZJJRJJRJRcRZkRZkRZkRZkRZkZcsZk{Zk{Zk{Zc{Zc{Rc{Rc{Zk{Zk{Zk{Rc{RcsRcsRc{Rc{JZkJZkRcsRcsRcsRZkRZkRZkRcsRcsRcsRcsRcsRcsRc{Rc{RcsRcsZcsRcsRcsJZkJRcJRcJRcRZkRcsRcsRcsRcsRcsRcsRcsRZkJZkJRcRRcRRZJRZJRZJRZRRZJRZRZcZcsck{ck{ck{ck{ck{ck{ck{Zk{ck{c{�c{�c{�cs�cs�cs�cs�cs�cs�cs�Zk{ZcsZc{Zk{Zk{Zk{ZcsZk{cs�c{�cs�cs�cs�Zk{Zk{Zk{Zk{Zc{ZcsZcsRcsRcsZcsZc{ZcsZc{Zc{Zc{Zc{Zk{Zc{Zc{Zc{Zc{Rc{Rc{Rc{RcsRcsRcsRcsRcsRcsRcsJZkJZkJZcJZcJZkJZkJZkJZkJZkJZkJZkJZkBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZBJZBJZBJZBJZ9BR9BJ9BR9BR9BR19J99B99B9BJ9BJ19J9BJ9BJ9BJ9BJ9BR9BR9BR9BR19J19B19B19B19B19B19B19B19B)1919B19B19B19B19B19B19B19B19J19J19J19J19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJJJJJJJ9BJ9BJBBBBBB9BB9BJJJJ9BJ9BR9BJBBBBBBBBBBBB9BB9B999999999B9BB9BJ9BJJJJJJRJJRJRZJRZJRZJRcJRZJJRJJRJRZJZcRZcRZcRZkRZkRcsZc{Rc{Rc{Zk{Zk{Zk{Rc{Rc{RcsRc{RcsRcsRcsRc{Rc{RcsRcsRcsRcsRcsRZkRZkRZkRZkRcsRZkRZkRZkRcsRc{Rc{RcsRcsRcsRcsRcsJZkJRcJRcJZkRZkRcsRcsRcsRcsRcsRcsZcsRcsRcsJZkRZkRRcJRZJRZRRcRRcRRcRZkck{cs�cs�cs�ck{ck{ck{Zk{ZcsZcscs�c{�c{�c{�ks�ks�cs�ck{ck{ZcsZcsZcsZcsZc{Zk{Zk{ZcsZk{cs�c{�c{�cs�Zk{Zk{Zk{Zk{Zc{Zc{ZcsZcsRcsRcsZc{Zc{Zk{Zc{Zc{Zc{Zc{Zc{Rc{Rc{Zc{Zc{Rc{Rc{Zc{RcsJZkJZkRcsRcsRcsJZkJZkJZkJZcJZcJZkJZkJZkJZkJZkJZkJZkJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZ9BR9BR9BRBJZ9BR9BR9BJ9BR9BR9BJ19J99B9BB9BJ9BJ19J19J9BJ9BJ9BJ9BJ9BR9BR9BJ19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B11919B19B19B19J19J19B19B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BRBJRBJR9BJ9BJ9BJ9BJBJRBJRBJRBJRBJRBJR9BJBBBBBB9BB9BJJJRBJR9BR9BJBBBBBBBBB9BB9BB99B9999999B99BB9BB9BJJJJJJRBJRBJZJJRRRZRZcJRcJJRJJJJJRJJRRRZRZcJZkJZkRcsZcsZc{Zk{Zk{cs�Zk{Rc{RcsJZkJZkRcsRc{Rc{Rc{Rc{RcsRc{Rc{Rc{RZkJZcJZkJZkJZkJZkJZkJZkRZkRZkRcsRcsJZkRcsRc{Rc{RcsJZkRZkRZkJZkJZkRcsRcsJZkRcsRcsZcsZc{Zc{Rc{RcsRZkJZcJRZJRZJRcRRcRRcZcsck{c{�cs�cs�cs�ck{ZcsZcsZcsZcsZcsck{cs�ks�ks�cs�ck{ck{ck{ck{ZcsZk{ZcsZcsZk{ck{ck{ck{cs�cs�cs�cs�cs�cs�Zk{Zk{Zk{Zk{ZcsZcsRcsRc{Zk{Zk{Zk{Rc{Zc{Zc{ZcsRcsRcsRcsRcsRcsRcsRcsRcsRcsJZkJZkRcsRcsRcsJZkJZkJRcJRcJRcJZkJZkJRcJRcJRcJRcBRcBRcJRcJRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J19J19J9BJ9BJ19J19J19B19B19J19J19B19B19B19J19J19B19B19B19B19J11911919B19B19B19B19B19B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BRBJRBJRBJR9BJ9BJ9BJBJRBJRBJRBJRBJRBJRBJR9BJBBB9BJBJRJJZBJZ9BJ99BBBBBBB9BB9BB9BB99B99B9999999B99BB9BJJJRJJRBJRBJRJJRJRZRZcRZcJRZJJRJJRJJRRRZRZcJZkRcsRcsRcsZcsZk{Zk{cs�Zk{Rc{RcsJZkJZkRcsRc{Rc{Rc{Rc{Rc{Rc{Rc{Rc{RZkJZcJZkJZkJZcJZcJZcJZcJZcJZkRZkRcsJZkRcsRc{RcsJZkJZkRcsRcsRZkJZkRcsRcsJZkJZkRZkRcsZcsZk{Zk{Rc{RcsJZcJRcJRZRRcRZcRZkZcscs�c{�c{�cs�cs�ck{ZcsRZkRZcZZcZcsck{cs�ks�ks�cs�ck{ZcsZcsZcsZcsZk{ZcsZcsZk{ck{ck{ck{cs�cs�cs�cs�cs�Zk{Zk{Zk{Zk{Zk{ZcsZcsRcsZc{Zk{Zk{Rc{Rc{Zk{Zc{ZcsRcsJZkJZkRcsRcsRcsZcsZcsRcsRcsJZkRcsRcsRcsJZkJZkJZkJRcJRcJZkJZkJRcJRcJRcJRcBRcBRcJRcJRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BR9BR9BR9BJ9BJ9BJ9BJ19J19J19J19J19J19J19B19B19B19J19J19B19B19J19J19J19B19B19B19J19J19B19B19B19B19B19B19B19B19J9BJ19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BRBJRBJR9BJ9BJ9BJ9BJBJRBJRBJRBJRBJRBJR9BJJJJJJRJJZBJZBJR9BJ9BBBBBBBB99B9BB9B99BB99B99B99999999B9BJJRZJRZBJR9BJBJRJRZRZkRZkJRZJJZJRZRRZJRZRZcRZkRcsRZkRZkZcsZk{Zk{Zk{Zc{Rc{Rc{RcsJZkJZkJZkRcsRc{Rc{Rc{Rc{Rc{Rc{RcsJZkJZkJZkRZcRZcJZcJRcBJZJRcJZkRcsRcsRcsRcsJZkJZkJZkRcsRcsRcsRcsRcsRcsRcsRcsRZkRZkZcsZcsZk{Rc{RcsJZkJZcJZcRZcRZcZcsZc{cs�c{�c{�cs�Zk{ZcsZcsZcsRZcRZcZcsZk{cs�c{�ks�cs�ck{ZcsZcsZcsZcsZcsZk{Zk{ZcsZcsck{ck{ck{ck{cs�Zk{Zk{Zk{Zk{Zk{Zk{Zk{Rc{ZcsZcsZcsRc{Rc{Zc{Zc{Zk{Zk{ZcsRcsRcsRcsRZkRcsZcsZc{Zc{RcsRcsJZkRcsJZkJZkJZkRZkRZkJZkJZkJZkJZkJRcJRcJRcJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BJ19J9BJ9BR9BR9BR9BR9BR9BJ9BJ19J19J19J19J19J19B19B19B19J19J19J19J19J19J19B19B19B19B19J19J19B19B19B19B19B19B19B19B19B19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BJ9BJ9BJ9BJBJRBJRBJRBJRBJR9BJ9BJJJJJJRBJRBJR9BJ9BB99BB9999B99B99B9B999999999999999999BBJRJRcJRcJJJBBB9BJJRZRZkRZkJZcJRcRZcRZcJZcRZkRcsRcsRZkRZkZcsZk{Zc{Zc{Zc{Zk{Zk{Rc{RcsJZkJZkRcsRc{Rc{Rc{Rc{Rc{RcsRcsRcsJZkJRcRZcRZcJRcJRcBJZBRcJZkRcsRcsRZkJZkJZkJZkJZkRZkRcsRcsRcsRcsRcsRcsRcsJZkRZkRZkZcsZc{Zc{RcsRcsRZkRZkRZcZcsZk{Zk{cs�cs�cs�cs�Zk{Zcsck{ZcsRRZRRZZcsck{cs�c{�ks�cs�ck{ZcsZcsZcsZcsZcsZk{Zk{ZcsZcsck{cs�ck{cs�Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Rc{RcsZcsZcsZcsRc{Zc{Zk{Zk{Zk{ZcsZcsRcsRcsRZkZcsZc{Zc{Zc{RcsRcsJZkJZkJZkJZkRZkRZkRZkJZkJZkJZkJRcJRcJRcJRcJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBRcBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR1BR19J9BJ9BJ9BR9BRBJR9BR9BJ9BJ19J19J19J19J19J19J19B19B19B19J19J19J19J19B19B19B19B19B19B19J19B19B19B19B19B19B19J19J19B19B19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJBJRBJRBJRBJR9BJ9BJ9BJBJRJJJ9BJ9BJ99B119119919919999999999919111111999BBB9BBBJRJRcJRcJJJBBB9BJJRZRZkZcsRZkRZcRZcRZcRZkRcsZc{ZcsRZkRZkZcsZk{Rc{Zk{Zk{Zk{Zk{Rc{JZkJZkRc{Rc{RcsZcsZk{Zk{RcsRcsRcsRZkJZkJRcJRcJRcJRcJRcBRcJRcRZkRZkRZkJZkJZkJZkJZkJZkJZkJZkJZkRZkRZkRZkRcsRcsRcsRcsRcsZcsZc{Zc{Zc{RcsRcsRZkZcsZk{Zk{cs�cs�ck{cs�ck{Zk{Zcsck{ZcsRRZZZcck{cs�cs�ks�ks�cs�ck{ck{ZcsZcsZcsZcsZk{ZcsZcsZcsck{cs�cs�cs�Zk{Zk{Zk{Zk{Zk{Zk{Zk{ZcsRcsRcsZc{Zc{ZcsZcsZk{Zk{ck{ck{ZcsRZkRZkRZkRZkZcsZc{Zc{RcsRcsJZkJZkJZkJZkRcsRZkRZkJZkBRcBRcJZcJZcJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BJ9BR9BR9BR1BR19J9BR9BR9BR9BRBJZ9BR9BJ19J19J19J19J19J9BJ9BJ9BJ19J19B19B19B19B19B19B)1919B19J19J19B19B19B19B19B19B11919B19B19J19B19B19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJBJRBJRBJR9BJ9BB9BB9BJBJRJJJ9BJ9BJ9BB119119119999999999919111111111999BBBBBBBJRJZcJZkBJR9BJJJJRRZRZcZcsRZkRZkRZkRZkZcsZc{Zc{ZcsRZkRZcRcsZc{Rc{Zk{Zk{Zk{Zk{Rc{RcsRcsRc{Rc{RcsRcsZk{Zk{RcsRcsRZkRZkRZcJZcJZcJRcJRcJRcBJZBRcRZcRZkJZkJZkJZkJZkJZkJZkJZcJZcJZcJZcJZcJZkRcsRcsRcsRcsRcsRcsRcsZc{Zc{Zc{ZcsZcsZk{cs�cs�cs�cs�ck{ck{ck{Zk{ZcsZcsZZcZZcZZcck{cs�cs�ks�ks�cs�ck{ck{ZcsZcsZcsZk{ZcsZcsZcsZcsck{cs�c{�cs�Zk{Zk{Zk{Zk{Zk{Zk{ZcsZcsZcsRcsZc{Zc{ZcsZcsZcsZk{ck{ck{ZcsRZkRZkRZkRZkRcsZc{Zc{RcsJZkJZkJZkJZkJZkRcsRZkJZkJRcJRcJRcJZcJZcJRcBRcBRcBRcBRcBRcBRcBRcBRcJRcJRcBRcBJZBJZ9BR9BRBJZBJZBJZBJZBJZ9BR9BJ9BR9BR9BR9BR9BJ9BR9BR9BR9BRBJZ9BR9BJ19J19J19J19J19J9BJ9BJ9BJ19B19B19B19B19B19B19B)1919B19J19J19B19B19B19B)19)1911911919B19B19B19J19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BRBJRBJRBJRBJRBJRBJRBJRBJRBJR9BJ9BJ9BJJJJBJRJJJJJJ9BB99B11999B99B999919919911911911999999BBBJJJRZcRZkJRZBJRJJRJRZRZcZcsRZkRcsZcsZc{Zc{Zc{Zc{RcsRZcJRcRZkRcsRc{Zk{Zk{cs�Zk{Zk{Zc{RcsRc{Rc{RcsRcsRc{Zk{ZcsZcsRZkRZkJZcJZcJZkJRcJRcJRZBJRBJZJZcRZkRcsJZkJRcJRcJZkJZkJRcJRcJRcJRcJRcJZcRcsRcsRZkRZkRZkRcsRcsRcsZc{Zc{Zc{Zk{Zk{c{�c{�cs�Zk{Zk{Zk{Zk{Zk{ZcsZcsZZcZZcZcsck{cs�cs�c{�c{�c{�Zk{Zcsck{ck{Zc{Zc{ZcsZcsZcsZk{ck{cs�c{�c{�Zk{Zk{Zk{Zk{Zk{Zk{Zc{Zc{Zc{ZcsRcsRcsZcsZcsZcsZk{Zk{Zk{ZcsZcsRZkRZkJZkRcsZc{Zc{RcsJZkRZkRZkJZkJZkJZkJZkJZkJZkJZcJZcJZcJZcJZcJRcBRcBRcBRcBRcBRcJRcJRcJZkJZkJRcBRcBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BR9BR9BR9BR9BR9BR9BJ19B19B19J19J9BJ19J19B19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B)19)1911911911919B19B19J19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BRBJRBJRBJRBJRBJRBJRBJRBJRBJR9BJ9BJBBB9BJJJRJJRJJJ9BJ9BB9BB9BJ9BB99991999999999999999999BBBBBJRJZcRZkJZcJRZJRZRRZRZkRcsRZkRcsZcsZc{Zc{Zc{Zc{ZcsRZkJZkRcsRcsRc{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zc{Rc{RcsRcsRc{Zc{ZcsRZkRZkRZkJZcJZkJZkJZkJRcBJZBJRBJZJZcRZkRcsRcsJZcJRcJZkJZkJRcJRcJRcJRcJRcJZcRZkRcsRZkRZkRZkRZkRZkRcsRcsZcsZc{Zk{Zk{c{�c{�c{�cs�Zk{cs�cs�ck{ck{ZcsZcsZcsck{ck{cs�cs�cs�cs�cs�Zk{ck{ck{ZcsZc{Zc{Zk{Zk{Zk{Zk{Zk{cs�c{�c{�Zk{Zk{Zk{Zk{Zk{Zk{Zc{Zc{Zc{Zc{RcsRcsZcsZcsZk{Zk{Zk{ZcsZcsRZkRZkRZkJZkRcsRcsRcsRcsJZkRZkRZkRZkJZkJZkJZkJZkJZkJZcJZcJZcJZcJZcJZcJRcBRcBRcBRcBRcJRcJZkRZkRZkJZkBRcBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR19J19J9BR9BR9BJ9BJ9BR9BJ19B19B19J19J19J19B19B19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J19B19B19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BRBJRBJR9BR9BJ9BJ9BJ9BR9BJ9BJ9BJ9BB9BJJJRJJR9BJ9BJ9BJ9BJ9BJ99B99999999B9BB99B99999B9BB9BJBJRJRZJZcJZcRZcRZcRZcZcsZcsRZkRZkRZkZcsZc{Zc{Zk{Zc{Rc{Rc{Rc{Zc{Zc{Zk{Zk{Rc{Rc{Zk{Zk{Zk{Zk{Rc{Zc{Zc{Zc{Zc{RcsRcsRcsRZkJZkJZkRZkRZcJRcBJZBJRBJZJRcRZkRcsRcsJZkJZkRZkJZkJZkJRcJRcJZcJZcRZkRZkRZkJZcJZcRZkRZkRZkRZkRZkRZkZcsZk{Zk{cs�c{�c{�c{�cs�c{�c{�c{�cs�ZcsZcsZcsck{ck{cs�cs�cs�Zk{Zcsck{ck{ck{ZcsZcsZcsZk{ck{cs�cs�c{�c{�c{�cs�Zk{Zk{cs�cs�Zk{Zk{Zk{Zk{Zk{Zk{Rc{RcsZcsZk{Zk{Zk{ZcsZcsZcsRcsRZkRZkJZcRZkRcsRcsRZkRZkRZkRZkRZkRZkJZkJZkRcsRZkJZcJRcJRcJRcJZkJZkJRcBRcBRcBRcBRcJRcJZkRZkRZkJZkBRcBJZBJZ9BRBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR19J19J9BR9BRBJZ9BR9BJ9BR19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19B19B19B19B19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJBBB9BB9BJJJJBJR9BJ9BJ9BJ9BJ9BJ9BJ99B999BBB9BB9BB9BB9BB9BJBJRBJZJRZJZcRZcRZkRZcRZkZc{Zc{ZcsRZkRZkRcsZcsZc{ZcsRc{Rc{Zk{Zk{Zc{Zc{Zc{Rc{Rc{Rc{Zk{Zk{Zk{Rc{RcsRcsZcsZc{RcsRcsJZkRcsRcsJZkJZkRZkRZkJZkBRcBJZBRcJZkRZkRcsRZkRZkJZkRcsRcsJZkJZkJZkRZkRZkRZkRZkRZcJZcJZcJZcRZcRZcJZcJZcJZkRcsZk{Zk{cs�c{�c{�c{�c{�c{�c{�ks�cs�ck{ck{ck{ck{ck{cs�c{�cs�ZcsZcsck{cs�ck{ZcsZcsZcsck{cs�cs�c{�c{�c{�cs�cs�Zk{cs�cs�cs�cs�Zk{Zk{Zk{Zk{Zk{Rc{Rc{Zk{Zk{Zk{Zk{ZcsZcsRcsRcsRZkRZkJZcRZkRZkRcsRZkRZkRZkRZkRZkRZcJZkRZkRcsRZkJRcJRZBRcBRcJZkJRcBRcBJZBRcBRcBRcJRcJZkJZkJZkJRcBJZBJR9BR9BRBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR19J19J9BR9BRBJZBJR9BR19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19B19B19B19B19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BJ9BJ9BJ9BJ9BJ9BJ9BB9BB9BJ9BJJJJ9BJ9BJ9BJ9BB9BJ9BR9BJ99B999BBBBBBBBBBBB9BJJJJJJRJRZJRcJZcRZkRZkRZcRZkZcsZk{Zk{ZcsRcsRcsRcsRcsRZkRZkZcsZk{Zc{Zc{Zc{Zk{Rc{Rc{cs�Zk{Zk{Rc{RcsJZkRZkRZkRcsRcsRc{Rc{RcsRZkJZkJZkJZkJZkJZkJZkJRcJZcJZkJZkRZkRZkJZkJZkRcsRcsJZkJZkRcsRcsRcsRZkJZkJZcRZcRZcJRcJRcJRcJZcJZkRcsZc{Zk{Zk{cs�c{�c{�c{�k{�k{�k{�c{�cs�cs�ck{cs�cs�cs�cs�c{�cs�ck{ck{cs�cs�cs�cs�Zk{ck{ck{cs�c{�c{�cs�cs�cs�cs�c{�c{�c{�c{�cs�Zk{Zk{Zk{Zc{Zc{Rc{Rc{Zk{Zk{Zk{Zc{ZcsRcsRcsRcsRZkRZkJZkJZkRcsRcsRcsRcsRcsJZkJZcJRcJZcJZkRZkJZcJRcJRZBRcBRcJRcBRcBJZBJZBRcBRcBRcJRcJZkJZkJZkJZkBJZBJR9BR9BRBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR19J19J9BR9BR9BR9BR9BJ19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B)1919B19B19B19B19B19B19B19B19B19B19B19B19J19J19B19B19B19B19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJBJRBJR9BJ9BJBJRBJRBBB999BBBBBBBBB9BJJJJJJRJJRJRZJZcRZkRZkRZkRZkRZkRcsZc{Zc{ZcsRcsRcsRcsJZkJZkRZkRZkZcsZcsZc{Zc{Zc{Rc{Zk{cs�Zk{Rc{Rc{RcsJZkJZkJZkJZkRcsRc{Rc{RcsRcsRZkJZkJZkJZkJZkRcsRZkRZkJZkJZkJZkJZkRZkRZkRcsRcsJZkJZkRcsRcsRcsRcsJZkJZcRZcRZcBRcBRcJRcJZkJZkRcsRcsZk{Zk{cs�c{�c{�c{�k{�k{�k{�c{�cs�cs�ck{cs�ks�ks�ks�c{�c{�cs�cs�cs�cs�c{�cs�cs�cs�ck{cs�cs�c{�cs�cs�cs�cs�c{�c{�c{�c{�cs�ck{Zk{Zk{Zc{Zc{Rc{Rc{Zk{Zk{Zc{Zc{RcsRcsRcsRcsRcsRZkRZkJZkRcsRcsZcsRcsRcsJZkJZkJRcJZcJZcJZcJRcJRZJRZBRcBRcBRcBJZBJZBJZBJZBRcBRcBRcJRcJZkJZkBRcBJZ9BR9BR9BRBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR19J19J9BR9BR9BR9BR9BJ19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B)1919B19B19B19B19B19B19B19B19B19B19J19J19B19B19B19B19B19B19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BRBJRBJRBJRBJRBJRBJR9BJ9BJ9BJ9BJBJRBJRBJRBJRBJRJJZBJRBBB99999B9BB9BB9BJJJJJJJJJJJJRJRcRZkRcsRcsRcsRcsRcsRcsRcsRZkRcsRZkRZkJZkRZcRZkRcsRcsRcsRcsRcsRcsRc{Zk{Zk{Rc{Rc{Rc{Zc{RcsRcsJZkRc{Rc{RcsRcsRc{Rc{RZkJZkJZkJZkJZkRZkRcsRcsJZkJZkJZkRcsRcsRcsRcsJZkJZkJZkJZkJZkRcsRcsJZkJZcJZcJZcJRcJRcJZkRcsJZkJZkRcsRcsZk{cs�c{�c{�c{�c{�c{�c{�c{�cs�Zk{Zk{cs�c{�ks�ks�c{�c{�cs�ck{ck{cs�cs�cs�cs�cs�ck{ck{cs�cs�cs�cs�cs�cs�cs�c{�c{�c{�cs�ck{Zk{Zk{Zk{Rc{Rc{Rc{Zk{Zc{Zc{Rc{Rc{RcsRcsRcsRcsRZkRZkRZkJZkRcsZc{Zc{RcsJZkJZkRZkJZkJZcJZcJRcJRcBRcBRcBRcJRcJRcBRcBJZBJZBJZBRcBRcBRcJRcJRcBRcBJZBJZ9BR9BRBJZBJZBJZ9BR9BR9BR9BR9BR9BJ9BJ9BJ19J19J19J9BJ9BR9BR9BR9BJ19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J19B19B19B19B19B19B19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJBJRBJRBJRBJRBJRBJRBJRBJR9BJ9BJ9BJBJRBJRBJRBJZBJZJJZBJRBBB9999BB9BB9BB9BJ9BJJJJJJJBJRJRZJZkRZkRcsRcsRcsRcsJZkJRcJZcRZkRZkRZcJZcRRZRZcRZkRcsRcsRcsRZkRcsZc{Zc{Rc{Rc{Rc{Zk{Zc{RcsJZkJZkRcsRcsRcsRcsRc{Rc{RcsRZkRZkJZkJZkJZkRcsRcsRZkJZkJZkRcsRc{Rc{RcsJZkJZkJZkJZkRZkRcsRcsRZkJZkJZcJZcJRcJZcRZkRcsRcsJZkRZkRcsZk{cs�c{�c{�c{�c{�c{�c{�c{�cs�Zk{Zk{Zk{c{�ks�ks�c{�cs�cs�ck{ck{ck{cs�cs�cs�cs�ck{ck{ck{cs�cs�cs�cs�cs�cs�c{�c{�c{�cs�ck{Zk{Zk{Rc{Rc{Rc{Zk{Zc{Zc{Rc{Rc{Rc{RcsRcsRcsRcsRcsRZkRZkJZkRcsRc{Rc{RcsJZkRcsRZkJZkJZcJRcBRcBRcBRcBRcBRcJRcJRcBRcBRcBJZBJZBRcBRcBRcBRcBRcBJZBJZBJZ9BR9BRBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BJ9BJ19J19J9BJ9BJ9BJ9BR9BR9BJ19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BRBJRBJRBJRBJRBJRBJRBJRJJJ9BJBBBBBB9BJBJRBJZBJZBJZBJR9BJ9BB9B99B9BBB9BJ9BJJJJJJJBJRJRZJRcRZkRcsRcsRcsRZkJZcJRZJRZJZcRZkRZcRRZJJRJRZRZcRZkRcsRcsRZkRcsZc{Zk{Rc{Rc{Zk{Zc{RZkJZkJZkJZkJZkRcsRcsRc{RcsRcsRcsRcsRcsJZkJZkJZkRcsRcsRcsRZkJZkJZkRcsRcsRcsRcsJZkJZkRcsRcsRcsRcsRcsRZkJZcJRcJZcJZcJZkRZkRcsRcsRcsRcsZk{cs�c{�c{�c{�k{�k{�k{�c{�cs�Zk{Zk{cs�c{�ks�ks�c{�cs�cs�ck{ck{cs�cs�cs�cs�ck{ck{ck{Zk{Zk{Zk{cs�c{�c{�c{�c{�c{�c{�cs�cs�Zk{Zc{Rc{Rc{Zk{Zk{ZcsRcsRcsRcsZcsZcsRcsRcsRcsRcsRcsJZkJZkJZkRcsRcsRcsRcsRZkJZkJZcJZcBRcBRcJRcJRcBRcBRcBRcBRcBRcBRcBJZBJZBRcBRcBRcBRcBJZBJZBJZBJZ9BR9BR9BRBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR19J19J9BJ9BJ19J19J19J19J19J19J19J19J19B19B19B19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BRBJRBJRBJRBJRBJRBJRBJR9BJBBBBBBBBBBBBBJRBJZBJZBJZBJRBJRJJJ9BB9B9BBB9BJ9BJ9BJJJJJJRJRZJRcRZcRZkRcsJZkJZcJRZJJRJJZJRcRZcRRZJJRJJJJJRRRZRZkRcsRcsRZkRcsRcsRc{Rc{Zk{Zc{RcsJZcJRcJZkJZkJZkRZkZc{Zc{RcsRZkRcsRcsRcsJZkJZkJZkJZkRcsRcsRcsRZkJZkJZkJZkRcsRcsRcsRcsRcsRcsRcsRcsRcsRZkJRcJRcJZcJZkJZcJZkRcsRcsRcsZcsZk{Zk{c{�c{�k{�k{�k{�k{�c{�cs�Zk{Zk{cs�c{�c{�ks�cs�cs�ck{ck{ck{cs�cs�cs�ck{ck{ck{ck{Zk{Zk{cs�c{�c{�c{�c{�cs�cs�cs�cs�Zk{Zc{Zc{Rc{Zk{Zk{Zk{RcsRcsRcsZcsZcsZcsZcsRcsRcsRcsRcsJZkJZkJZkJZkJZkRcsRZkJZcJZcJZcJRcBRcBRcJRcJRcBRcBRcBRcBRcBRcBJZBJZBJZBRcBRcBRcBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR19J19J19J9BJ9BJ9BJ19J19J19J19J19J19J19B19B19B19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B19J19J19B19B19B19B19B19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJBJRBJRBJRBJRBJRBJRBJR9BJ9BJBBBB99BBB9BJBJRJJZJJZBJRBJRJJRJJJBBB9BB9BJ9BJ9BJ9BJJJJJJRJRZJZcRZkRZkJZkJZkJRZJJRJJRJJRRRZRRZJJRJJJJJJJJRRZcRZkJZkRcsRcsRcsRcsRcsZc{Zc{RcsJZkJZcJZcRZkJZkJZkJZkRc{Rc{RcsRZkRZkJZkJZcJZkJZkJZkJZkRcsRcsRcsRcsJZkJZkJZkJZkRcsRcsRcsRZkRZkRZkRZkRZkRZkJZkJRcJZkJZkJZcJZkRZkRcsRcsRcsRc{Zk{cs�c{�c{�c{�c{�c{�cs�Zk{ck{ck{cs�cs�c{�cs�cs�ck{ck{ck{ck{ck{ck{ck{ZcsZcsck{ck{ck{Zk{cs�c{�c{�c{�Zk{ZcsZcsZcsZc{Zk{Zk{Zk{Zk{Zk{Zk{Rc{RcsRcsZcsZcsZcsZcsZc{Zc{RcsRcsRcsJZkJZkJZcJZkRZkRZkJZkJZcJZcJZkJZkBRcBRcJRcJRcBRcBRcBRcBRcBJZBJZBRcBRcBRcBRcBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR19J9BJ9BJ9BJ9BR9BR9BR9BR19J19J19J19J9BJ9BR9BR9BJ19J19J19J19J19J19B19B19B19B19J19J19B19B19B19B19B)19)19)1919B19B19B19B19B19B19J19J19B19B19B19B19B19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BRBJRBJRBJRBJRBJRBJR9BJBBBBBBBBB9BJBJRBJZJJZJJZBJRBJRJJRJJJ9BJ9BJ9BJ9BJ9BJJJJBJRJRZJZcRZkRZkRZkRZkJZcJJRJJJJJJJJRRRZRRZJJRJJRJJRJRZRZcRZkJZkJZkJZkRcsJZkRcsRcsZcsRcsJZkJZkJZkRZkRcsRcsRcsRc{Rc{RcsRcsRZkJZkJZcJZkJZkJZkJZkJZkRcsRcsRcsRZkJZkJZkJZkJZkRcsRcsJZkJZkRZkRZkRZkRZkJZkJZkJZkRZkRZkRZkRcsRcsRZkRcsRcsZk{cs�c{�c{�c{�c{�c{�Zk{Zk{ck{ck{ck{cs�cs�cs�cs�ck{Zk{Zk{Zk{ck{ck{ck{Zk{Zk{ck{cs�ck{cs�cs�cs�c{�Zk{Zk{ZcsZcsZcsZcsZc{Zk{Zk{Zk{Zk{Rc{Rc{RcsRcsZc{Zc{RcsRcsZc{Zc{RcsRcsRcsJZkJRcJRcRZcRZkJZkJZkJZcJZcJZkBRkBRcBRcJRcJRcBRcBRcBRcBJZBJZBJZBJZBRcBRcBRcBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR19J19J9BJ9BJ9BJ9BJ9BR9BR19J19J19J19J19J9BJ9BR9BR9BJ19J19J19J19J19B19B19B19B19B19J19J19B19B19B19B)19)19)19)1919B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BRBJRBJRBJR9BJ9BJ99B99BBBB9BJBJRBJZBJZBJZBJZBJRJJJJJJ9BJ9BJ9BJ9BJJJJJJRBJRBJZJRcRZkRZkRcsRcsRZcBJRBBBJJJRRJRRZRRZJRZBJZBJZJRZRZkRZkRZkJZkJZkJZkRZkRcsRcsRcsRcsRcsRcsJZkJZkJZkRc{Rc{Zc{Zc{Rc{Rc{RcsRZkRcsJZkJZkJZkJZcJZkRcsRcsRZkJZcJZcJZkJZkJZkJZkRcsRZkRZkRZkRcsRcsRcsRcsRcsRZkRcsRcsRcsRcsRZkRZkRZkRcsRc{cs�c{�c{�c{�c{�c{�c{�Zk{ZcsZcsck{cs�cs�cs�cs�cs�Zk{Zk{Zcsck{ck{cs�cs�cs�Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{ZcsZcsZcsZk{Zk{Zc{Zc{Zc{Zc{Rc{Rc{Rc{Rc{Zk{Zk{RcsRcsZcsZcsRcsRcsRZkJZkJRcJRcRZkRZkJZkJZcJZcJZcJRcBRcBRcBRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZBRcBRcBJZBRcBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BJ9BJ9BJ9BJ9BR9BR9BR19J19J19J19J19J9BJ9BJ9BJ9BJ19J19J19J19J19B19B19B19B19B19B19B19B19B)1919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BRBJRBJRBJR9BJ99B99B9BB9BJBJRBJRBJZBJZBJZBJZBJR9BJ9BJ9BJ9BJ9BJJJJJJRJJRBJRBJZJRcRZkRcsRcsRcsJZcBJR9BJJJJJJRRRZRZcJZcJZkJZkJZkRZkRZkRZkJZkJZkRZkRZkRZkRZkRZkRcsRcsRcsRcsRZkRcsRc{Zk{Zc{Zc{Zk{Rc{RcsRcsJZkJZkJZkJRcJZcJZkRZkRZkJZkJZcJZkJZkJZkJZkJZkJZkRZkRZkRcsRcsRcsRcsRcsRcsRcsZcsZk{Zk{ZcsRcsRZkRcsRc{Zk{Zk{c{�c{�c{�c{�c{�c{�Zk{ZcsZcsck{cs�cs�cs�c{�c{�cs�Zk{Zk{ZcsZk{cs�c{�c{�cs�Zk{cs�cs�Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zc{Zc{Zc{Rc{Rc{Rc{Zk{RcsRcsRcsZcsZcsRcsRcsRZkJZcJRcJZcRZkRZkRZkRZkJZkJRcJRcBRcBRcBRcBRcBJZBJZBJZBJZBJZBJZBJZ9BRBJZBRcBRcJRcBRcBRcBRcBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BJ9BJ9BJ9BR9BR19J19J19J19J19J19J9BJ9BJ19J19J19J19J19J19J19B19B19B19B19B19B19B19B)19)1919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J19B19B9BJ9BJ19J19J9BJ9BJ9BJ9BJ9BR9BR9BR9BRBJRBJR9BR9BJ99BBBB9BJBJRBJZJJZBJRBJRBJRBJR9BJ9BJ9BJ9BJJJJJJJJJRJJRJJRJJRJRcRZkRZkRZkJZkJRcBJZBJRJJRJRZJRZJZcRZkRcsRcsRc{RcsRcsJZkJZkRcsRZkRZkRZkRZkRZkRcsRcsRcsRcsRcsZc{Rc{Rc{RcsZcsZk{Zc{RcsJZkJZkJZcJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkRZkRcsRcsRcsRZkRZkRcsRcsRcsZk{Zk{Zk{Zk{RcsRcsRc{Zk{cs�Zk{Zk{cs�cs�cs�cs�c{�Zk{ZcsZcsck{cs�cs�cs�c{�c{�c{�cs�ck{ck{Zk{Zk{cs�c{�cs�cs�ck{ck{cs�Zk{Zk{Zk{ZcsZk{Zk{Rc{Zc{Zk{Zk{Zk{Zk{Zk{Zc{Zc{Zc{Zc{RcsRZkRcsRcsZcsZcsZcsRcsRZkJZkJZkJZcRZkRZkZcsRcsJZkJRcJRcJRcBRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZJRcJZcJZkJZkBRcBRcBJZBJZBJR9BRBJZBJZ9BR9BR9BR9BR9BJ9BJ9BR9BR9BJ19J19J19J19J19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B)19)19)19)19)19)19)19)1919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19B19B9BJ9BJ9BJ19J9BJ9BJ9BJ9BR9BR9BR9BR9BRBJR9BR9BJ9BJBBBBBBBJRBJZJRZJRZBJZBJRBJRBJR9BJ9BJBBB9BJJJJJJJJJRJJRJJRJJRJRcRZkRZkRZkJZkJZkJRcJRcJRcJRcJRcJZkRZkRcsRc{Zk{ZcsRcsRcsRcsRcsZcsRZkRZkRZkRZkRcsRcsRcsRcsZc{Zk{Rc{RcsRcsRcsZcsRcsRcsJZkRZkRZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZcJZcJZcRZkRcsRcsRcsZcsZcsRZkJZkJZkZc{Zk{cs�cs�Zk{Zk{Zk{Zk{cs�cs�Zk{Zk{Zk{Zk{Zk{Zk{cs�cs�ZcsZcsZcscs�cs�c{�c{�c{�c{�c{�cs�ck{Zk{Zk{Zk{cs�cs�cs�cs�ck{cs�Zk{Zk{ZcsZcsZk{Zk{Rc{Zc{Zk{Zk{Zk{Zk{Zk{Zc{Zc{Zc{RcsRZkRZkRcsRcsZcsZcsRcsRZkJZkJRcJZkRZkRZkRZkZcsRcsJZkJRcJRcJRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZJRcJZcJZkJZkJZkJRcBRcBJZBJZBJR9BRBJZBJZ9BR9BR9BR9BR19J19J9BR9BR9BJ19J19J19J19J19J19J19J19J19J19J19J19J19J19J19B19B19B19J19J19B19B)19)19)19)19)19)19)19)1919B19B19B19B19B19B19B19B19B19B19B)1919B19B99B99B99B9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BBB99BBBBJRJRZJRZJRcBRcBJZBJRBJR9BJBBB9BBBBBJJJJJJJJRJJRJJRJRZRZcRZkRcsRcsJZkJZkJZcJZcJZcRZkRZkRZkRZkRcsRc{Zk{Zk{ZcsRcsRcsZcsZcsZcsZc{Zc{ZcsZcsRcsRcsRcsRc{Rc{RcsRcsRcsRcsRcsRcsRcsRcsRZkRZkRcsJZkJZkJZkRcsRcsJZkJZkJZkJZkJZcJZcJZcRZkRcsZc{Zc{Zc{Zc{RcsJZkJZkZc{cs�c{�c{�c{�cs�cs�cs�cs�Zk{cs�cs�ck{ck{ck{Zk{cs�Zk{ZcsZcsZcsck{c{�ks�c{�c{�c{�c{�cs�ck{Zk{Zk{Zk{cs�cs�cs�cs�cs�Zk{Zk{Zk{Zk{Zk{ZcsZcsZcsZk{Zk{Zk{Zk{Zk{Zk{Rc{Rc{RcsRcsRcsRcsRcsRcsZcsZcsRcsRZkJRcJRcRZkRZkJZkJZkRZkRZkRZkJZkJZcJRcBJZBJZBJZBJZBJZBJZBJZBJZJRcJRcBJZJRcJZcJZkJZkJZkJRcJRZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BJ19J19J9BR9BR9BJ19J19J19J9BJ9BJ19J19J19J19J19J19J19J19J19B19B19J19J19J19J19B19B19B19B)19)19)19)19)19)1919B19B19B19B19B19B19B19B19B19B)19)1919B19B19B99B9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BR9BJ9BJ99B9BBBBBBBB9BJBJRJRZJRZJRcJRcBRcBJZBJR9BJBBB9B99B99BJBJRJJRJJRJJZJRZJZcRZkRZkJZkJZkJZkJZkRZkRZkRZkRZkRZkRcsRcsRc{Zk{Zk{ZcsRcsRcsZcsZcsZc{Zc{Zc{Zc{RcsRcsRZkRcsRc{Rc{RcsRcsRcsRcsJZkJZkRcsZcsZcsRcsRcsJZkJZkJZkRcsRZkJZkJZkRZkRZkJZcJZcJZcRZkRcsZc{Zc{Zc{Zk{Zc{RZkRZkZk{cs�cs�c{�c{�c{�cs�cs�cs�Zk{cs�ck{ZcsZcsZcsZcsZk{Zk{ZcsZcsZcsck{ks�ks�c{�cs�c{�cs�cs�ck{Zk{Zk{ck{cs�cs�cs�Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{ZcsZcsZk{Zk{Zk{Zk{Zk{Zk{Rc{Rc{RcsRcsRcsRcsRcsRcsZcsZcsRcsJZkJRcJRcRZcRZkJZkJZkRZkRZkRZkRZkJZcJRcBJZBJZBJZBJZBJZBJZBJZBJZJRcJRcBJZJRcJZkJZkJZkJZkJRcBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BJ19J9BJ9BR9BR9BR9BJ19J19J9BJ9BJ9BJ19J19J19J19J19J19J19J19B19B19B19B19J19J19J19B19B19B19B)19)19)19)19)19)1919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J9BJ9BJ9BJ19J9BJ9BR9BR9BR9BJ9BR9BR9BR9BJ9BJ9BJ9BJ9BJBBB9BJBJRBJZJJZJRZJRcBJZBJZBJRJJJBBB99999B9BJBJRJJRJJRBJZBRcJRcJZcJRcJZcJZkRZkRZkRZkRZcJZcJZkRZkRZkRcsZcsZcsRcsRcsZcsZcsRcsRcsRcsRcsRcsRcsRcsJZkJZkRZkRc{Zc{RcsRZkRZkJZkJZkRZkRZkZcsRcsRcsRZkJZkJZkJZkJZkJZkJZkRZkRZkRZkJZkJZkJZcJZkRcsRc{Zc{Zk{Zk{Zk{Zc{RcsRc{Rc{Rc{Zk{cs�c{�cs�cs�cs�cs�cs�Zk{RZkJZcJZcRZkZcsZk{ZcsZcsZcscs�c{�c{�c{�cs�cs�cs�cs�cs�ck{ck{Zk{cs�cs�cs�Zk{Zk{cs�cs�Zk{Zk{ck{Zk{Zk{Zk{ZcsZk{Zk{Zc{Zc{Zc{Zc{Zc{Zc{ZcsRcsRcsRcsRcsRcsRcsRZkRZkRZcRZcJZkJZkRcsRcsRZkRZkRZkJZkJRcJRcBRcBRcBRcBRcBRcBRcBJZBRcJZcJZcJRcJRcJZkJZkJZkJZkBRcBRcBJZBJZBJZBJZ9BR9BR9BR9BR9BJ19J9BR9BR9BR9BR9BR9BR9BJ9BJ9BJ19J19J19J19J19J19J19J19B19B19B19B19B19B19J19J19B19B19B19B)19)19)19)19)19)1919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J9BJ9BJ19J9BJ9BR9BR9BJ9BJ9BR9BR9BR9BJ9BJ9BJ9BJJJJ9BJJJJBJRBJZJJZJJZBJZBJZBJZBJRBJR9BJBBB99BBJRBJRJJRJJRJRZBRcJRcJRcJRcJRcJRcJZcRZkRZkJZcJZcJZkJZkRcsZcsZcsZcsRcsJZkRc{Zc{RcsJZkJZkJZkRcsRcsRcsJZkJZkRZkZcsZc{ZcsRZkRZkJZkRZkRZkRZkRZkZcsRcsRZkJZkJZkJZkJZkJZkJZkRZkRZkRZkJZkJZkJZcJZcJZkJZkRc{Zk{Zk{Zk{Zk{Zk{Zk{Rc{Rc{Rc{cs�cs�Zk{Zk{cs�cs�c{�Zk{RZkJZcJZcRZkZcsZcsZcsZcsck{cs�cs�cs�cs�Zk{ck{ck{ck{cs�cs�ck{Zk{Zk{cs�cs�Zk{Zk{cs�cs�cs�cs�ck{Zk{Zk{Zk{ZcsZcsZcsZc{Zc{Zc{Zc{Zc{Zc{ZcsRcsRcsRcsRcsRcsRcsRZkRZkRZkRZkJZkJZkRcsRcsRZkRZkJZkJZkJRcJRcBRcBRcBRcBRcBRcBRcBJZJRcJZcJZcJRcJRcJZkJZkJZkBRcBRcBJZBJZBJZBJZBJZBJZ9BR9BR9BR19J19J9BR9BR19J19J9BR9BR9BJ9BJ19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19J19B19B19B19B)19)19)19)19)19)19119119)1919B11911919B19B19B19B19J19J19B19B19B19J9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BRBJR9BJ9BJ9BJ9BJ9BJ9BJBJRBJRJJZJJZJJZBJZBJZBJRBJRBJRBJR9BJ9BJJJJJJRJJRJJZJRZJRcJRcJZkJZcJRcJRcJRcJZkRZkJZkJZkJZkRcsRc{Zk{ck{ZcsRcsJZkRc{Zk{RcsRZkJZkJZkRcsRcsRcsJZkJZkRZkZcsZcsZcsRcsRcsRZkRZkRZcRZcRZkZcsZc{RcsJZkJZkJZkJZkJZkRcsRZkJZkJZkJZcJZcJZkJZkJRcJZkRc{Zk{Zk{Zk{Zc{Zk{Zk{Zk{Zk{Zk{Zk{cs�cs�Zk{Rc{cs�k{�c{�Zk{RcsRcsZcsZcsZcsZcsZcsck{ck{ck{Zk{Zk{Zk{ZcsZcsZcsZk{Zk{Zk{Zk{Zk{ck{cs�Zk{Zk{Zk{Zk{cs�ck{Zk{Zc{Zk{ZcsZcsZcsZcsZcsZk{Zk{Zc{Zc{ZcsRcsRcsRcsRcsRcsRcsRcsRcsRZkJZkJZkJZkJZkJZkRZkRZkJZkJZkJZkJZkJRcBRcBRcBRcBRcBJZBJZJRcJRcJZcJRcJRcJRcJZkJZkJZkBRcBJZBJZBJZBJZ9BRBJZBJZBJZ9BR9BR19J19J9BJ9BJ19J9BJ9BR9BR9BJ19J19J19J19J19J19J19J19B19B19B19B11911919B19B19B19B19B19B19B19B19B19B)19)19)19)19119119)1919B11911919B19B19B19B19J19J19B19B19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BRBJRBJR9BJ9BJ9BJ9BJBJRBJRJJZJRZJJZBJZBJZBJZBJZBJZBJZBJR9BJJJJJJRJJRJJRJJZJRZJRcJZkRZkJZkJZcJRcJRcJZkJZkJZkJZkJZkRcsRc{Zc{ZcsZcsRcsRcsRc{Rc{RcsRZkRcsRcsRcsRcsRcsRZkJZcJZcRZkZcsRcsRcsZcsRcsRZkRZcRZcRZkZcsRc{RcsJZkJZkJZkJZkRcsRcsRZkJZkJZkJZcJZcJZkJRcJRcJZcRcsZk{Zk{Zk{Zc{Zc{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Rc{Zk{c{�c{�Zk{Zc{Zk{Zk{Zk{ZcsZcsZk{ck{ck{ZcsZcsZk{Zk{Zk{Zk{ZcsZk{Zk{Zk{ZcsZcsck{cs�Zk{Zk{Zk{Zk{ck{Zk{Zk{Zc{Zk{ZcsZcsZcsZcsZcsZk{Zk{Zk{Zc{RcsRcsRcsRcsRcsRcsRcsRcsRcsRcsJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJZkJRcBRcBRcBRcBRcBJZBJZJRcJRcJRcJRcBRcBRcBRcJRcBRcBJZBJZBJZBJZBJZ9BR9BRBJZBJZ9BR9BR1BR19J9BJ9BJ19J9BJ9BR9BR9BR19J19J19J19J19J19J19J19B19B19B19B11911919B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)1919B19B19B19B19B19B19B19B19B19B19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BJ9BJBJRBJR9BJ9BJ9BJ9BJBJRBJZJJZJRZJRZBJZJJZJJZJJZJJZJJZBJR9BJ9BJJJRJRZJJRJJRBJZJRcJZkRZkJZkJZkJZcJZcJZkJZkJZkRZkRcsRcsRcsRcsRcsRcsJZkRcsRc{Rc{RcsRcsRcsRcsRcsRcsRZkRZkJRcJZcRZkZcsRcsRc{Zc{ZcsRZkRZkRZkRZkRcsRcsRcsJZkJZcJZcRcsRcsRZkJZkRcsRZkJZkJZkJZkJZcJZcRZkRcsZc{Rc{Rc{RcsRcsRcsRc{Zk{Zk{Zk{Zk{Zk{Zc{Zc{Zk{Zk{Zk{Zk{Rc{Rc{Zk{Zk{ck{Zk{ZcsZcsZcsck{ck{ck{ck{cs�cs�ck{ck{cs�ck{ZcsZcsZk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{ck{Zk{ZcsRZkRZkZcsZcsZk{Zk{Zk{Rc{RcsRcsRcsRcsRcsRcsRZkRZkJZkJZkRcsJZkJZkJZkJZkJZkJRcJRcJZkJZkJZcJRcBRcBRcJRcJRcBRcBRcBRcJRZBJZBRcBRcBRcBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BRBJZ9BR9BR19J19J19J19J19J19J9BR9BR9BR9BJ19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)1919B19B19B19B19B19B19B19B19B19B19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BRBJRBJR9BJ9BJ9BJ9BJBJRBJZBJZJJZBJZBJZJJZJJZJJZJJZJJZBJRJJJJJJBJRJJZJJRJJRBJZBRcJRcJZkJZkJZkJZcJZkJZkJZkJZkRZkRcsRcsRcsJZkJZkJZkJZkRcsRcsRcsJZkJZkRcsRcsRcsRZkRZkRZkJZcJZcRZkRcsRc{Rc{Zk{Zc{ZcsZcsRZkRZkRcsRcsRcsJZkJRcJRcJZkRZkRZkRZkRcsRcsJZkJZkJZcJZcJZcJZcRZkRcsRc{Rc{RcsRZkRZkRcsRcsZk{Zk{Zk{Zc{ZcsZcsZc{Zc{Rc{Rc{Rc{Rc{Zk{ck{ck{Zk{Zk{Zk{ck{ck{cs�cs�cs�cs�cs�cs�cs�cs�Zk{ZcsZcsZk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{ck{ck{ZcsZcsRZkZcsZcsZcsZc{Rc{Rc{RcsRcsRcsRcsRcsRcsRZkRZkJZkJZkRcsRcsJZkJZkJZkBRcBRcBRcJRcJZkJZcJRcBRcJRcJRcJRcBRcBRcBJZBJZBJZBJZBRcBJZBJZBJRBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BRBJZ9BR9BR19J19J19J19J19J19J19J9BR9BR9BJ19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)1919B19B19B19B19B19B19J19J19B19B19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BRBJR9BJ9BJ9BJ9BJBJRBJZBJRBJZJJZJJZBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJZBRcBRcJRcJZcJZcJZcJZkJZkJZkJZkJZkRcsRcsRcsRcsRcsRcsJZkJZkJZkJZkJZkJZkJZkRcsRcsRZkRcsRZkRZkRZkRZkRcsRc{Rc{Zk{Zc{ZcsZcsRZkRZkRcsRcsRZkJZkJRcJRcJZcRZkRZkRZkRcsJZkJZkJZkJZcJZcJRcJZcJZkRcsZc{Zc{RcsJZkJZkJZkJZkRcsRc{Zk{RcsRcsRcsRcsRc{Rc{Rc{Rc{Rc{Zk{ck{ck{cs�cs�cs�ck{ck{cs�cs�cs�Zk{Zk{cs�cs�Zk{Zk{ZcsZcsZk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{cs�cs�ck{ZcsRZkZcsRZkRcsRcsRc{Rc{ZcsRZkRZkJZkRcsRcsRZkJZkJZkJZkJZkJZkJZkJZkJRcBRcBRcBRcJRcJRcJZkJZkJRcJRcJRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BJ19J19J19J19J19J19J19J9BJ9BJ19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)1919B19B19B19B19B19B19B19J19J19B19B19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BRBJRBJRBJRBJRJJZJJZBJZBJR9BJ9BJBJRBJRBJRBJRBJRBJRBJRBJZBJZBJZBJZJRcJZcJZkJZkJZkJZkJZkJZkJZkRcsRcsRcsRcsRcsRcsJZkJZkJZkJZkJZcJZkJZkRcsRZkRZkRcsRcsRcsRcsRcsRcsRc{Rc{Zc{Zc{Zk{ZcsRZkRZkRcsRcsRZkRZkJZcJRcJZcJZcRZkRZkJZkJZkJZkJZkJZkJZcJRcJRcJZkRcsZc{ZcsRZkJZcJZkRZkJZkRcsRc{Rc{RcsRcsRcsRcsRc{Zk{Zk{Zk{Zk{ck{ck{cs�cs�cs�cs�cs�cs�cs�cs�Zk{Zk{Zk{cs�cs�Zk{ZcsZcsZcsZcsZk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{cs�ck{ZcsZcsRZkRZkRcsRcsRc{Rc{Zk{ZcsRZkJZkRcsRZkJZkJZkJZkJZkJZkJZkJZkJRcBRcBRcBRcJRcJRcJRcJZkJZkJRcJRcBRcBJZBJZBJRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BJ9BJ19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)1919B19B11911919B19B19B19B19B19B19B19B19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BJ9BJ9BB9BJ9BRBJRBJRBJRBJZBJZJRcJJZBJR9BJ9BJBJRBJRBJRBJRJJZJJZBJRBJRBJRBJZBJZJRcJZcJZkJZkJZkJZkJZkJZkJZkJZkRcsRcsRcsJZkJZkJZkRcsRcsRZkJRcJRcJZkRZkRcsRcsRcsRcsJZkRcsZc{Zc{RcsRcsRcsZcsZk{Zc{RcsRcsRcsRcsRcsJZkJZcJZcJZcJZkJZkRcsJZkJZkJZkJZkJZkJZcJZcJZcJZkRcsRc{RcsJZkJZkRZkRZkRcsRc{Rc{Rc{Zc{ZcsRc{Rc{Rc{Zk{cs�cs�cs�cs�cs�cs�Zk{Zk{cs�cs�cs�cs�Zk{Zk{Zk{cs�c{�cs�Zk{ZcsZcsZcsZc{Rc{Zc{Zk{Zk{Rc{Zk{Zk{Zk{Zk{Zk{Zc{Zc{ZcsRcsRcsZcsZk{Rc{Rc{Zk{ZcsRcsRZkRZkJZkJZkJZkJZkJZkJZkJZcJRcJRcBRcBRcJZkJZkJRcJRcBRcBRcBRcBRcBJZBJZ9BRBJRBJZBJZBJZ9BRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BRBJZ9BRBJR9BR9BJ19J19J19J19J19J19J19J19J19J19J19J19J19J9BJ19J19B19B19B19B19B19B19B19B)1919B19B19B19B19B119119)19)19)19)19)19)1919B11911911919B19B19B19B19B19B19B19B19B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BJ9BJ9BB9BJ9BR9BJBJRBJRBJZBJZBRcJRZJJRJJJ9BJBJRBJRBJRBJZJJZJJZBJRBJRBJRBJZJRZJRcJZkJZkJZkJZkJZkJZkJZcJZkJZkJZkRcsRZkRZkJZkJZkJZkRcsRZkJRZJRZJRcRZkRZkRcsRcsRcsJZkRcsRc{Zc{RcsRZkRZkRcsRcsZcsRcsRcsRcsRcsJZkJZkJZcJZcJZcJZkJZkJZkJZcJZcJZkJZkRZkRZkRZkJZkJZkJZkRc{RcsJZkRZkRZkZcsZc{Zk{Zk{Zk{Zc{Zc{Zk{Rc{Rc{Zk{c{�ks�ks�c{�c{�cs�Zk{Zk{cs�cs�cs�cs�Zk{Zk{Zk{Zk{cs�Zk{Zk{Zc{Zk{Zk{Zc{Rc{Zc{Zc{Zk{Rc{Zk{Zk{Zk{Zk{Zc{ZcsZc{Zc{RcsRcsRcsZc{Rc{Rc{Zc{Zc{RcsJZkJZkJZcJZcJZcJZkJZkJZcJZcJRcJRcBRcBRcJZkJZkJRcBRcBRcBRcBRcBJZBJZBJZ9BR9BRBJZBJZ9BR9BRBJZBJZBJZBJZBRcBRcBJZBJZBJZBJZ9BR9BRBJZBJZ9BR9BJ19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B)1919B19B19B19B119119)19)19)19)19)19)1911911911919B19B19B19B19B11911919B19B19B99B9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BB9BJ9BJ9BJ9BJBJRBJZBJZBJZBJZBJZBJRBJRBJRBJRBJZBJZBJZBJRBJRBJRBJZBJZJRcJRcJZkJZkJZkJZkJZkJZkJZcJZkJZkJZkJZkRZkRZkRZkRcsJZkJZkJZcJRcJRcJZcJZkJZkJZkJZkJZkRcsRcsRcsRcsRcsRcsRZkRZkRZkRZkRZkRZkRZkJZkJZkJZkJRcJRcJZcJZkJZkJZkBRcJRcJZcRZkRZkRZkRZkRZkJZkJZkRcsRcsRZkRZkRZkRcsZcsZk{Zk{Zk{Zc{Zc{Zk{Zk{Zk{cs�c{�c{�c{�c{�c{�c{�cs�ck{ck{cs�cs�Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zc{Zc{Zc{ZcsZk{Zk{Zc{Zc{ZcsRcsRcsRcsRcsRZkRZkRcsRcsRcsZcsZcsRcsRcsJZkJZkJZcJRcJZcJZcJZcJZcJRcJRcJRcJZkJZkBRcBRcBRcBRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BRBJZBJZBJZBRcBRcBRcBRcBJZBJZBJZ9BR9BRBJZBJZ9BR19J19J19J19J19J19J19J19J19J19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19119119)19)1919B19B19B19B11911919B19B99B99B9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BB9BJ9BJ9BJ9BJBJRBJZBJZBJZBJZBJZBJZBJRBJRBJZBJZBJZBJRBJRBJRBJZBJZJRZJRcJRcJZcJZkJZkJZkJZkJZkJZcJZkJZkJZkJZkJZkRZkRZkRcsJZkJZkJZkJRcJRcJZcJZcJZkJZkJZkJZkRZkRZkRZkRcsRcsRcsRZkJZcRZkRZkRZkRZkJZkJZkJZkJZcJRcJZcJZcJZcJZkJRcBRcJRcJZkRZkRZkRZkRZkRZcJZkJZkRcsRcsRZkRZkRZkZcsZk{Zk{Zk{Zk{Zk{Zk{Zk{cs�cs�cs�cs�Zk{Zk{cs�cs�cs�cs�ck{ck{ck{ck{ck{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zc{Zc{Zc{ZcsZcsZc{ZcsRcsRZkRcsRcsRcsRcsRZkRZkRZkRZkRcsRcsRcsRcsJZkJZkJZkJZcJRcJRcJZcJZcJRcJRcJRcJRcJZkJZkBRcBRcBRcBRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BRBJZBJZBJZBRcBRcBRcBRcBRcBJZ9BR9BR9BRBJZBJZ1BR19J9BJ9BJ19J19J19J19J19J19J19J19J19B19B19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19)1911911919B19B11911919B19B99B99B9BJ9BJ9BJ9BJ9BR9BR9BJ9BR9BR9BR9BR9BR9BR9BR9BJ9BB9BJ9BJ9BB9BJBJRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJRBJRBJZJJZJRZJRcJRcJRcJZcJZcJZkJZkJZkJZcJZcJZkJZkJZkJZkJZkJZkRcsRcsRcsRZkRZcJRcJRcJZkRZkRcsRcsRZkJZcJRcJZkRZkRcsRcsRZkJZcRZkRZkRZkJZkJZkJZcJRcJRcJZcJZcJZcJZcJZkJZkJRcJZcJZkRZkRcsRZkRZcRZcJZcRZkRcsRc{RcsRcsRcsZk{Zk{Zk{cs�cs�Zk{Rc{Rc{Zk{cs�cs�Zk{Zc{Zk{Zk{cs�cs�Zk{Zk{Zk{Zk{ck{Zk{Zk{Zk{Zc{Zc{Zk{Zk{Zk{Zk{Zk{Zc{Zc{Zc{Zc{Zc{Zc{Zc{ZcsRcsRZkRZkRcsRcsRcsRcsRcsJZkRZkRZkRcsRcsRcsJZkJZkJZkJZkJZkJRcJRcJRcJRcJRcJZkJZkJRcJRcJRcJRcJRcBRcBRcBRcBRcBRcBJZBJZBJZ9BRBJZBJZBJZ9BR9BRBJZBJZBJZBJZBRcBRcBRcBRcBJZ9BR9BR9BRBJZBJZ1BR19J9BR9BR9BJ19J19J19J19J19J19J19J19J19B19B19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B)19)19119119)19)19)19)19)19)19)19)1911911919B19B19B11919B19B19B99B9BJ9BJ9BJ9BJ9BR9BR9BJ9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BJ9BB9BJBJRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJRBJRBJRBJRJJRJJZBJZBRcBJZJRZJZcJZcJZkJZcJZcJZcJZcJZkJZkJZkJZkJZkRZkRcsRcsRcsRZkRZkJZkJZkRcsRcsRcsRZkJRcJRcJZkRZkRcsRcsRZkJZcRZcRZkJZkJZkJZkJZkJRcJRcJZcJZcJZkJZkJZkJZkJZcJZcJRcJZkRZkRZkRZcRRZJZcRZkZc{Zc{RcsRcsRc{Zk{Zk{cs�cs�cs�Rc{Rc{Rc{Zk{cs�Zk{Zk{Zc{Zc{Zc{ck{ck{Zk{Zk{Zk{ZcsZcsZcsZk{Zk{Zc{Zc{Zk{Zk{Zk{Zk{Zc{Zc{Zc{Zc{Zc{Zc{Zc{ZcsRcsRZkRZkRZkRZkRcsRcsRcsRcsJZkRZkRZkRZkRcsJZkJZkJZkJZkJZkJZkJRcJRcBRcBRcJZkJZkJZkJZkJRcJRcJZkJZkBRcBRcBRcBRcBRcBRcBJZBJZ9BRBJRBJZBJZ9BR9BRBJZBJZBJZBJZBRcBRcBRcBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BJ19J19J19J19J19J19J19J19J19B19B19B19B19B19J19J19B19B19B19B19B19B19B19B)19)1919B119)19)19119119)19)19)19)19)19)19)19)1919B19B19B19B19B19B19B19B19B19J9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BJ9BJ99B9BBBJRBJZBJZBJZBJZBJZBJZBJR9BRBJZBJZBJZBJR9BJ9BJJJJBJRBJZBJZBJZBJZBJZJRcJRcJRcJRcBRcJRcJZkJZkJZkJZkJZkJZkJZkRZkRcsRcsRcsRcsJZkJZkJZkJZkJZkJZkRZcRZcJZkJZkRcsRcsJZkJZcJZcJZkRZkRcsRcsRZkJZcJRcJRcJZcJZkJZkJZkJRcJRcJRcBRcJRcRZcRZcRZcRZcJZcRZkZc{Zc{ZcsRcsRc{Zk{Zk{Zk{cs�Zk{Rc{Rc{Zk{Zk{cs�Zk{Zk{Zc{Zc{Zk{Zk{cs�ck{ck{ZcsZcsZcsZcsZc{Zc{Zc{Zc{Zc{Zc{ZcsZcsZc{Zc{ZcsZcsZcsRcsRcsRcsRcsRZkRZkRZcRZkRZkRZkRcsRcsRcsRZkRZkRZkRZkRZkJZkJZkJZkJZkJZkJRcJRZBRcBRcJRcJZcJZkJZkJZkJZkJZkJZkBRcBRcBRcBRcBRcBRcBJZBJZBJZBJZBJZBJZ9BR9BRBJZBJZBJZBRcBRcBRcBJZBJZBJR9BR9BJ9BJ9BR9BRBJZ9BR9BR19J19J19J19J19J19J19J1BR19J19B19B19J19J19J19J19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)1919B19B19B19B19B19B19B19B19B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BJ9BJ9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ99B99B9BJBJRBJZBJZBJZBJZBJRBJR9BR9BRBJZBJR9BJ9BJ9BJ9BJBJRBJRBJZBJZBJRBJZJRcJZcJRcJRcBRcJRcJZkJZkJZkJZkJZkJZkJZkJZkJZkRcsRcsRcsJZkJZkJZkJZkJZkJZcRZcRZkJZkJZkRcsRZkJZkJZcJZcRZkRZkRcsRcsRZkJZkJZcJRcJZcJZkJZkJZkJZkJRcJRcBRcJRcJRcRZcRZkRZkJZcRZkRcsZc{ZcsZcsRc{Zk{Zk{Zk{cs�Zk{Zk{Zk{Zk{cs�Zk{Zk{Zc{RcsRcsZc{Zk{ck{ck{ZcsZcsZcsZcsZcsZcsZc{Zc{Zc{Zc{ZcsZcsZcsZc{ZcsRZkRZkRZkRcsRZkRcsRcsRZkRZkRZcRZcRZkRZkRcsRcsRZkRZkRZkRZcRZcRZkJZkJZkJZkJZkJRcJRcJRZBRcBRcJZcJZcJZcJZcJZkJZkJZkBRcBRcBJZBRcBRcBRcBJZBJZBJZBJZBJZBJZBJZ9BR9BRBJZBJZBJZBRcBRcBJZBJZBJR9BR9BJ19J19J9BJ9BRBJZ9BR1BR19J19J19J19J19J19J19J19J19J19B19B19B19J19J19J19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)1919B11911919B19B19B19B19B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJBBB99B99B9BJBJRBJZBJZBJZBJRBJZBJZ9BR9BRBJZBJZ9BR9BJ9BJBJRBJRBJRBJRBJZBJZBJZJZcJZkJZkJZcJZcJZcJZkJZkJZkJZkJZkJZkJZkJZkJZcJZcJZkJZkJZkJZkJZkJZkJZkJZcJRcJZcJZkJZkJZkJZcJZcJZkRZkRcsRZkJZkJZkJZkJZkJZkJZcRZkJZkJZkJZkJZkJZkJRcJRcJRcRZcRZkRZkRZkRZcRZkRcsZcsZcsZk{Zk{Zk{Zk{cs�cs�cs�Zk{Zk{Zk{Zk{Zk{Zc{RcsRcsRcsRcsZk{Zk{ZcsZcsRZkRZkZcsZcsZcsZcsZk{Zk{Zk{ZcsZc{ZcsZcsRZkJRcJRcRZkRcsRZkRZkRcsRcsRZkRZcRZcRZkJZkRcsRZkRZkRZkRZkRZkRZkJZcJZcJZkJZkJZcJRcJRcJRcBRcJRcJZcJZcJRcBRcJRcJRcBRcBRcBJZBJZBJZBJZBJZBJZ9BR9BRBJZBJZBRcBJZ9BR9BRBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BJ19J19J9BR9BR9BR9BR9BR19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19J19J19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19))1)19)19)19)19)19)19)19)1911911919B19B19B19B99B99B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BB9BB9BBBJRBJZBJZBJRBJRBJZBJZ9BR9BRBJZBJZBJR9BRBJRBJRBJRBJRBJRBJZBJZBRcJRcJZcJZkJZkJZcJRcJRcJZkJZkJZkJZkJZkJZkJRcJRcJRcJZcJZkJZkJZkJZkJZkJZkJZkJZcJZcJZkJZkJZkJZcJZcJZkRZkRZkJZkJZkJZkJZkJZkJZkRZkRZkRZkJZkJZkJZkJZkJZkJZcJRcJRcRZcRZkRZkRZcRZkRZkRcsZc{Zk{Zk{Zk{Zk{Zk{cs�Zk{Zk{Zk{Zk{Zk{Zk{ZcsRcsRcsRcsRcsZcsck{ZcsRZkRZcRZcZcsZcsZcsZcsZk{Zk{Zk{ZcsZc{ZcsZcsRZcJRZJRcRZkRcsRZkRZkRcsRcsRZkRZcRZkRZkJZkJZkRZkRZcJZcJRcJZkJZkJZcJZcJZkJZkJRcJRcJRcJRcBRcJRcJZcJZcJRcBRcJRcBRcBRcBJZBJZBJZBJZBJZBJZBJZ9BR9BRBJZBJZBRcBJZ9BR9BR9BRBJZBJZBJZBJZBJZBJZ9BR9BR19J19J19J9BR9BR9BR9BR9BJ19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19J19J19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19))1))1))1)19)19)19)19)19)19)19)1911919B19B19B11919B19B9BJ99B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BJ9BJ9BJ9BJ9BB9BB9BJBJRBJRBJZBJRBJRBJRBJR9BR9BRBJZBJZBJRBJR9BR9BRBJRBJRBJZBJZBJZBJZBJZJRcJZcJZcBRcBRcJRcJRcJZkJZkJZkJZcJRcBRcJRcJRcJZcJZkJZkJZkJZkJZkRZkRcsRcsJZkJZkJZkRZkRZkRZcJZcJZcJZkJZkJZkRcsRZkJZkJZkRcsRcsRZkJZcJRcJZcJZkRZkJZkJZcJRcJRcRZcRZcRZcRZkRZkRcsZc{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Zk{Rc{Rc{Zc{ZcsZcsZcsRcsZcsck{ck{ZcsZZcRZkRZkRZkZcsRZkRcsZk{Zk{Zk{Zc{ZcsZcsRZkRZkJZcRZkRcsRcsRcsRcsRcsRcsRZkRZkRcsRcsRcsRcsRZkRZcJRZJRZJRcJZkJZcJZcJZkJZkJRcJRcJRcBRcBRcBRcJRcJZcJRcJRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BRBJZBJZBJZBJZ9BR9BR9BRBJZBJZBJZBJZBJZBJZBJZ9BR19J19J19J9BJ9BR9BR9BR9BJ19J19J19J19J19J19J19J19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19))1))1))1))1)19)19)19)19)19)19)19)1919B19B19B19B11919B19B19J99B99B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BJ9BJ9BJ9BJ9BB9BJ9BJ9BRBJRBJR9BR9BRBJRBJRBJRBJZBJZBJZBJRBJR9BR9BRBJRBJRBJRBJZBJZBJZBJZJRZJZcJRcBRcBRcJRcJRcJRcJZkJZcJRcBRcBRcBRcJRcJZcJZkJZkJZkJZkJZkRZkRcsRcsRZkJZkJZkRZkRZkJZcJRcJRcJRcJZkJZkRcsRZkJZkJZkRcsRZkJZkJRcJRcJRcRZcRZkJZcJRcJRZJRZRRZRRZRZcRZkRZkRcsRcsZcsZcsZcsZcsZcsZcsZcsZk{Zk{Rc{Rc{Zc{Zc{ZcsZcsZcsZcsck{ZcsZZcZZcRZkRZkRZkRZkRcsRcsZcsZk{Zc{ZcsZcsRZkRZkRZkRZkRZkRZkRcsRcsRcsRcsRZkRZkRZkRcsRcsRcsRZkRZkJZcJJZJJZJRcJZcJZcJZcJZkJZkJRcJRcBRcBRcBRcBRcJRcJRcJRcJRcBRcBRcBJZBJZBJZBJZBRcBJZBJZBJZ9BR9BRBJZBJZBJZBJZ9BR9BR9BR9BR9BRBJZBJZBJZBJZ9BR9BJ19J19J9BJ9BJ9BJ9BR9BR9BJ19J19J19J19J19J19J19J19B19B19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B119)19)19)19))1))1))1))1))1)19)19)19)19)19)19)19)1919B19B19B19B19B19B19B19B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BJ9BJ9BJ9BB9BB9BJ9BJ9BRBJRBJR9BR9BR9BR9BRBJZBJZBJZBJZ9BRBJRBJRBJRBJRBJRBJRBJRBJZBRcBJZBJZJRcBRcBRcBRcJRcJRcJRcBRcJRcBRcBJZBJZBRcJRcJZkJZkJZkJZkJZkJZkJZkRZkRZkJZkJZkJZkJZcJRcBRcBRcBRcJRcJZkJZkJZkJZkJZkJZkJZkJZkJZcJRcBJZJRcJZcRZcJRcJRZJRZJRZRZcZZcZZcRZkRZkRcsRcsRZkRZkRZkRZkRZkZcsZcsRcsRcsZc{Zc{Zc{Zc{Zc{Zc{Zc{Zc{ZcsZcsRZcZZcRZkRZkRZkRcsZcsZc{RcsRcsZcsZcsRZkRZkRZkRZkRZkRZcRZkRZkRZkRZkRZkRZkRZkRZkRZkJZkJZkJZkJZcJRcJRZJRZRRZRZcJZcJZcJZkJZkJRcJRcBRcBRcBJZBJZBRcBRcBRcBRcBRcBRcBJZBJZJRZJRcBRcBRcBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BRBJZBJZ9BR9BJ9BJ9BJ9BJ9BJ19J9BJ9BJ9BJ19J19J19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19))1))1))1!)1)19)19)19)19)19)19)19)19)19)1919B19B19B19B19B19B11919B19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BB9BB9BJ9BJ9BRBJRBJRBJR9BR9BRBJRBJRBJZBJZBJZ9BR9BRBJRBJR9BJ9BJ9BJBJRBJZBRcBJZBJZBRcBRcBRcBRcJRcJRcBRcBRcBRcBRcBJZBJZBRcJRcJZcJZkJZkJZkJZkJZkJZkJZcJZcJZcJZkJZkJRcBRcBRcBRcBRcBRcJRcJZkJZkJZkJZkJZkRZkJZkJRcJRcJRZJRcRZcRZcJRcJRZJJRRRZZZcZcsRZkRZkRZkRZkRZkRZcRZcRZcRZcRZcRZkZcsRcsRcsZcsZc{Zc{Zc{Zc{Zc{Zc{ZcsZcsZcsRZkRZkRZkRZkZcsRcsZcsZcsZcsRZkZcsRZkRZkRZkRZkRZkRZcRZcRZcRZcRZcRZkRZkRZkRZcJZcJZkJZkJZkJRcJRcJRcJRZJRZRRZJRZJRcJRcJZkJZkJRcJRcBRcBJZBJZBJZBRcBRcBRcBRcBRcBJZBJZBJZJRZJRcBRcBRcBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ19J19J9BJ9BJ19J19J19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19))1))1!)1!)1!)1!)9))1)19)19)19)19)19)19)1911911919B19B19B11911919B19B9BJ9BJ9BJ9BJ19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BRBJRBJRBJRJJJJJJBJR9BRBJZBJZ9BRBJRJJJ9BJ9BB9BB9BJBJZBJZBRcBJZBJZBJZBJZBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZBRcJRcJZcJZkJZkJZkJZkJZkJRcJZcJZcJZkJZkJZkBRcBRcBRcBRcBJZBRcJRcJZcJZkJZkJZkRZkRZkRZkJZcJRcRZcZZcRZkRZcRZcJRZRRJRRZZZcZcsZcsRZkRZcRRcRRcRRcRZcRZcRZkRZkRZcZcsZcsZc{ZcsZcsZc{Zc{RcsRcsRcsRcsZcsZcsRZkRZkRZkZcsZcsZcsZcsZcsZcsZcsRZkRZkRZkRZcRZkRZcRZcRZcRRZRZcJZcJZkRZkRZkJRcJRcRZkRZkJRcJRcRZcRRcJRZJRZJRZJRcBRcJRcJZcJZcJRcBRcBJZBJZBJZBJZBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBRcBRcBJZBJZ9BR9BR9BR9BRBJZBJZ9BR9BR9BR9BR9BJ19J9BR9BR19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J9BJ19J19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19))1))1!)9!)9!)1!)1))1))1)19)19)19)19)19)1911911919B19B11911911919B19J19J9BJ9BJ19J19J19J99B9BJ9BJ9BJ9BJ9BB9BB9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJBJRBJRBJRJJJJJJ9BR9BRBJRBJR9BR9BJ9BJ9BB99B9BB9BRBJZBJZBJZBJZBRcJRcBRcBRcBRcBRcBRcBRcBRcBRcBRcBJZBJZBRcBRcJRcJZcJZkJZkJZkJRcJRcJRcJZkJZkJZkJRcBRcJRcJRcJRcBJZBJZJRZJRcJZkJZkJZkJZkRZkRZkJZcJRcRZcZZcZZcZZcRRZRRZRRZRRZRZcZZcZZcRZcRRcRRcRRcRRcRRZRRcRZkRZkRZcRZkZcsZc{RcsRcsZcsZcsRcsRcsRcsRcsZcsZcsZcsRZkRZkRZkZcsZcsRZkRZkZcsZcsRZkRZkRZcRZcRZcRZcRZcRZcRZcRZcRZkRZkRZkJZcJRZJRZJZcRZcJRZJRZRZcRZcJRZJJZJRcJRcBRcJRcJZcJRcJRcBRcBJZBJZBJZBJZBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZBRcBJZBJZ9BR9BR9BRBJZBJZBJZ9BR9BR9BR9BR9BR19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19))1))1!)9!)9!)1!)1))1))1)19)19)19)19)19)1919B19B19B19B19B19B19B19B19J19J19B19B19B19B19B99B9BJ9BJ9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BJ9BJ9BJBBBJJJJJJ9BJ9BJ9BRBJR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BJ9BJ9BRBJZBJZBJZBRcJRcJZcJZcBRcBRcBRcBRcJRcBRcBRcBRcJRcJRcBRcBRcJRcJZkJZkJZcJRcBRcBJZJRcJZkJZkJRcBRcJRcJRZJRZJRZBJZBJZBJZJZcJZkJZkJZcJZcJZkJZkJZcJRcRRZRRZRRZRRZRRZRRZJRZJRZRRZRRZRRZRRZRZcRZcRZkRZcRRZRRZRZcRZcRZcRZkZcsZcsRcsRcsRcsRcsRcsRcsRcsRcsRZkZcsZcsZcsRZkRZkRZkRZkRZkRZkRZkRZkRZkRZcRRcRRcRZcRZcRZkRZkRZcRZcRZkRZkRZkJZcJRZJRZJRcJRcJRZJRZJRcJRcBJZBJZJRcJZcJZcJRcJRcBRcJRcBRcBJZBJZBJZBJZBJZBJZBRcBRcBJZBJZBJR9BRBJZBJZBJZBJZBJZBJZ9BR9BR9BRBJZBJZBJZ9BR9BR9BR9BR9BR9BR19J19J19J19J9BJ9BJ19J19J19J19J9BJ9BJ19J19J19J19J19J19J19B19B19J19J19B19B19B19B19B19B19B19B11911919B19B19B19B)19)19)19)19)19)19))1))1!)1!)1))1))1))1)19)19)19)19)19)19)1919B19B19B19B19B19B19B19B19B19B19B19B19B19B99B99B9BJ9BJ9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BJ9BJ9BJ9BJJJJBJR9BJ9BJ9BR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BRBJRBJR9BR9BRBJZBJZBRcJRcJZcJRcBRcBRcBRcBRcJRcJRcBRcBRcBRcJRcBRcJRcJZkRZkRZkJRcJRcBJZBJZJRcJZcJZcBJZBJZJRZJRZJRZJRZBJZBJZJRZJZcJZcJRcJRcJRcJRcJRcJRcJRZJRZRRJJJRRRJRRZRRZJRcJRZJRZJJRJJRJJRRZcRZcRZcRZcRRZRRZRZcRZcRZcRZkZcsZcsRcsRcsRZkRZkRZkRcsRcsRZkRZkRcsZcsZcsRZkRZkRZkRZcRZcRZcRZkRZkRZcRZcRRcRRZRRZRRZRZkRZkRZcRZkRZkRZkRZkJRcJRcJRZJRZJRZJRZJRcJRcJRcBRcBJZJRcJRcJZcJZcJRcBRcJRcJRcBJZBJZBJZBJZBJZBRcBRcBRcBJZBJR9BR9BRBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BRBJZBJZ9BR9BR9BR9BRBJZ9BR9BR19J19J19J9BJ9BJ19J19J19J19J9BJ9BJ9BJ19J19J19J19J19J19B19B19J19J19B19B19B19B19B19B19B19B11911919B19B19B19B)19)19)19)19)19)19))1))1!)1!)1))1))1)19)19)19)19)19)19)19)1919B19B19B19B19B19B19B19B19B19B19J99B99B99B99B19J19J9BJ9BJ9BJ9BJ9BB99B99B9BJ9BJJJJJJJ9BJBJRBJRBJR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BRBJRBJRBJRBJZBJZBJZBRcBRcBRcBRcBRcBRcBRcJRcJRcJZkJZkBRcBRcJRcJZkZcsZcsRZkJRcJRcJRZJRcJRcJZcJRcBJZBJZJJZJRZJRcJRcBJZBJZJRZRRZJRcJRcJRZJRZJRcJRcJRcJRZJJRJJJJJJJJJRRZRZcJZcJRcJJRJJRJJRJRZRRZRRZJRZJRZJZcRZcRZcRZcRZkRZkRZkZcsRcsRZkRZkRZkRZkRZkRZkRZkRcsRcsZcsZcsRcsRZkRZcRRcRZcRZcRZcRZcRRZRRZJRZJRZRRZRRZRZcRZkJZcRZcRZkRZkJZkJZkJZcJZcRRZJRZJRcJRcJZcJZcJRcJRcBRcBRcJRcJRcJRcJRcJRcJRcBRcBRcBJZBJZBRcBRcBRcBRcBJZBJR9BR9BRBJRBJZBJZBJZBJZ9BR9BR9BR9BR9BRBJZ9BR9BR9BJ9BR9BRBJZBJZ9BR19J19J19J19J19J19J19J19J19J19J9BJ9BR19J19B19B19J19J)19)1919J19J19B19B19B19B19B19B19B19B119)1919B19B19B19B)19)19)19)19)19!)9!)1!)1!)1!)1!)1!)9)19)19!)9!)9)19119)19)1919B19B19B19B19B19B19B19B19B19B9BJ9BJ99B99B19J19J19J19J9BJ9BJ9BJ9BB99B99B9BJ9BJJJJBJRBJRBJR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BRBJRBJRBJZBJZBJZBJZBJZBRcBRcBRcBRcBRcBRcJRcJZkBRkBRcBRcJZkRcsZk{ZcsRZkJRcJRZJRZJRcJRcJRcJRcBJZBJZJJZJJZJRZJRcBRcJRZRRZRRZJRZJRZJRZJRZJRZJRZJRZJRZJRZJJRJJJJJRRRZRZkRZkJZcJJRJJRJJRRRZRRZRRZRRZJRZJRcJZcRZcRZcRZkRZkRZkRZkRZkRZkRZkRZcRZcRZcRZcRZkRZkRcsRcsRcsRZkRZkRRcRRcRZcRZkRZkRZcRRZRRZJRZJRZRRZRZcRZkRZkJZcJZcRZkRZkJZkJZkJZcJZcRRZJRZJRcJZcJZcJZcJZcJRcBRcBRcJRcJRcJRcJRcJRcJRcBRcBRcBJZBJZBRcBRcBRcBJZBJZBJZ9BRBJRBJRBJRBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR19J19J9BR9BRBJZ9BR9BR19J9BJ9BJ19J19J19J19J19J19J19J19J9BJ19J19B19B19B19J19B19B19J19B19B19B19B19B19B19B19B19B)19)19)1919B19B19B)19)19)19)19)19!)9!)1!)1!)1!)1!)9!)9)19)19!)9!)9)19)19)19)1919B19B19B19B19B19B19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ19B19B19B19B99B9BB9BJ9BJ99B99B9BJ9BJ9BRBJRBJRBJR9BR9BR9BR9BRBJZBJR9BR9BJ9BR9BR9BR9BR9BR9BR9BR9BRBJRBJRBJZBJZBJZBJZBJZBJZBJZBJZBRcBRcBRcBRcBRcBRcBJZBJZJZkZcsck{Zk{RZkJRcJRcJRZJRZBRcBRcBRcBRcBJZJJRJJRJJZJRZJRZJRZRRZRRZJRZJRZJRZJRZRRZRRZJZcJZcJZcJRcJRZJRZRZcRZkRZkJZcJJRJJJJJRRRJRRZRZcRZcJRcJRZJRZRRcRZcRZkRZkRZkZcsZcsRZkRZcRZcRZcRZcRZcRZcRZkRZkRZkRZkRZkRZcJZcRZcRZkZcsRZkRZkRZcRRZRRcRRcRZcRZkRZkJZkJZcJZcRZcRZkJZkJZkJRcJRZJRZJRZJRZJZcJZkJZkJRcJRcBRcBRcJRcJRcJRcJRcJRcJRcBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJRBJRBJR9BR9BR9BR9BR9BR9BR9BR9BJ19J9BJ9BJ19J19J9BRBJR9BR9BR19J19J9BR9BR9BJ19J19J19J19J19J19J19J19B19B19J19B19B19B19J19J19B19B19B19B19B)1919B19B19B19B)19)1919B19B19B19B)19)19)19)19)19!)9!)1!)1!)9!)9!)1!)1)19)19!)9)19)19)19)19)1919B19B19B19B19B19B99B9BJ9BJ9BJ9BJ9BJ9BJ19B19B19B19B19B99B99B9BJ9BJ99B99B9BJ9BJ9BJ9BRBJRBJR9BR9BR9BR9BRBJZBJR9BR9BJ9BR9BR9BR9BR9BR9BR9BR9BRBJRBJRBJZBJZBJZBJZBJZBJZBJZBJZBJZBRcBRcBRcBRcBJZBJRBJZJZcZcsck{ck{RZkJRZJRZJRZBJZBJZBRcBRcBJZJRZJJRJJRJJRJJZJRZJRZRRZRRZJRZJRZJRZJRZRRZRRZJZcJZcJZkJZcJRcJRcRZcRZcJZcJRcJJRJJRJJRRRJRRZRZcRZkRZcJRZJJZRRcRZcRZkRZkRZcRZcRZkRZkRZcRRZRZcJRcJRcRZcRZcRZcJZkJZkRZcRZcJZcRZkZcsZcsZcsRZkRZcRRcRRcRZcRZkRZkRZkJZkJZcJZcRZcRZcJZkJZcJRcJRZJJZJJZJRcJZcJZkJZkJRcJRcBRcBRcJRcJRcJRcJRcJZcJRcBJZBJRBJRBJRBJRBJRBJRBJRBJZBJZBJZBJR9BR9BR9BR9BR9BR9BR9BR9BR9BR19J9BJ9BJ9BJ9BR9BR9BR9BR9BR19J19J9BR9BR9BJ19J19J19J19J19J19J19B19B19B19J19J19B19B19J19J19B19B19B19B19B)1919B19B19B19B)19)1919B19B19B19B119)19)19)19)19!)9!)1!)1!)9!)9!)1!)1)19)19))1))1)19)19)19)19)19)1919B19B11911919B19B19J9BJ19B19B19B19B19B19B19B19B99B99B9BJ9BJ19B19B19J9BJ9BJ9BJBJRBJRBJRBJR9BR9BR9BR9BR9BR9BR9BJ9BJ9BR9BR9BJ9BR9BRBJRBJRBJRBJZBJZBJZ9BRBJZBJZBJZBJZBJZBJZBRcBJZBJZBJRBJRJJRJRZRZkck{ck{RZkJJZJJRJJRJRZJRcJRcJRcJRZJJZJJRJJRJJRJJRJRZJRZJRZJRZJRZJRZJRZJRZJRZJRZJRcJZcJRcJRcJRcJRcRRZRRZJZcJRcJJRJJRJJRJRZRRcRZcRZcRZcJRZJRZJZcRZkRZkRZcRZcRZcRZkRZcRZcRZcJRcJRZJRZJRcRZcRZcJZcJZcRRZRZcRZcRZkRZkZcsZcsZcsRZcRRcJRcJZcRZkRZkRZkRZkJZcRZcRZcRZcJZkJZcRZcJRZJRZJRZJZcJZcJZcJZcJRcBJZJRZJRZJRZBJZBJZJRcJZcJZcBJZBJRBJRBJRBJR9BRBJRBJRBJZBJZBJZBJZ9BR9BRBJZBJZ9BR9BR9BR9BR9BR9BR19J9BJ9BR9BR9BR9BR9BR9BR9BJ19J9BJ19J19J19J19J19J19J19J19B19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)1919B19B19B19B19B119)19)19!)9!)9))1))1!)1!)1!)1!)1)19)19))1))1)19)19)19)19)19)1919B19B11911919B19B19B19B19B19B19B19B19B19B19B19B19B99B99B19B19B19B9BJ9BJBBB9BJ9BJ9BRBJRBJRBJR9BR9BR9BR9BR9BR9BJ9BJ9BR9BR19J19J9BRBJZBJRBJRBJZBJZ9BR9BRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJRJJJJJRJJRJRcZcsZcsJZcBJRJJRJJRJRZJRcJRcJRcJRZJJRJJRJJRJJRJJRJRZJRZJJZJJRJJRJJRJRZJRZJRZJRZJRcJRcJRcJRcJRcJRcRRZRRZJRZJRZJJRJJRJRZJRcRRcRZcRZcJZcJRcJRcRZkRZkRZcRZcRZcJZcRZcRZcRZkRZcJRcJRZJRZJRZRZcRZcRZcJZcRZcRZcRZcRZkRZkRZkZcsZcsRZcRRcJZcJZkRZkRZkRZkRZkJZcJZcJZcRZcJZcJZcRRZJRZJRZJRcJRcJZcJZcJZcBJZBJZJRZJRZBJZBJZBJZJRcJZcJRcBJZBJRBJRJJJBJR9BRBJRBJRBJZBJZBJZBJZ9BR9BRBJZBJZ9BR9BR9BR9BRBJR9BR1BR19J9BR9BR19J19J9BR9BR9BJ19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)1919B19B19B19B19B119)19)19!)9!)9))1))1))1!)1!)1!)1!)9!)9!)9)19)19)19)19)19)1919B11911919B19B19B19B19B19B19B19B19B19B19B19B11911919B19B19B19B19B19B9BB9BB9BB9BB9BJ9BRBJRBJRBJR9BR9BJ9BJ9BR9BR9BR9BR9BR19J19J1BR9BRBJZBJRBJRBJZBJZBJRBJRBJZBJZBRcBRcBJZBJZBJZBJZBJZ9BR9BJJJJJJJJRZJRcJZcJRcBJZJJRJJRJRZBJZBRcJRZJRZJJRJJRJJRBJZBJZJJZJJZJJRJJRJJRJJRJJZJRZJRZJRZJRZJRcJZcJZcJRcJRcRRcRRZJRZJJRJJRJJRJRZRRcRRcRRcJZcJZcRZcRZcRZcRZkRZkRZkRZcRZcRRcRRcRZkRZcRZcRRZRRZRZcJZcJZcRZcRZcRZkRZcJZcJZkRZkRZkRZkRZkRZcRZcRZkRZkJZkRZkRZkRZkJZcJRcJRcJZcJZkJZcJRZJJRJRZJRcBJZJRcJZkJZkBJZBJZBJZBJZBJZBJZBJZJRcJRcBRcBJZBJZBJRBJR9BR9BR9BR9BRBJRBJZBJZ9BR9BR9BRBJZBJZ9BR9BR9BR9BRBJR9BR19J19J9BJ9BJ19J19J9BR9BR9BJ19J9BJ9BJ19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19J19J19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19!)9!)9!)1))1))1))1))1))1!)9!)9!)9)19)19)19)19)19)1919B11911919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B9BB9BB99B99B9BJ9BRBJRBJR9BR9BR9BJ9BJ9BR9BR9BR9BJ19J19J19J9BR9BR9BRBJRBJRBJZBJZBJRBJRBJZBRcBRcBRcBJZBJZBJZBJZBJZ9BR9BJ9BJJJJJJRBJZBJZBJZBJZJJRJJRBJZBJZBJZBJZBJZJJRJJRJJRBJZBJZJJZJJRJJRJJRJJRJJRJJZJJZJRZJRZJRZJRZJZcJZcJRcJRcRRcJRZJJRJJJJJRJRZRRZRRcRRcRRcJZcJZcRZcRZcRZcJRcJRcJRcRZcRZcRRcRRcRRcRZcRRZRRZRRZRZcJZcJZcJZcRZcRZkRZkJZcJZcRZkRZkRZcRRcRZcRZkRZkRZkJZkRZkRZkRZkJRcJRcJRcJRcJZcJRcJJRJJRJRZJRcBJZJRcJZkJZcBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJR9BR9BR9BR9BR9BRBJRBJRBJR9BR9BR9BR9BRBJZBJZ9BR9BR9BR9BR9BR9BR9BR19J19J19J19J9BJ9BR9BR9BJ19J9BJ9BJ19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19J19J19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19!)9!)1!)1!)1))1))1))1))1!)9!)9))1))1)19)19)19)1919B19B11911919B19B19B19B19B19B19B19B19B19B19B19B99B99B19B19B19B99B99B9BJ9BJ9BJ99B9BJ9BJ9BR9BR9BJ9BR9BR9BR9BR9BR9BR9BJ19J19J19J9BJ9BJ9BJ9BR9BR9BR9BR9BR9BRBJZBJZBJZBRcBRcBJZBJZBJZBJZ9BR9BRBJRBJRBJRBJRBJZBJZBJZBJZBJZJRZJRcBRcBJZBJRBJRBJZBJZBJZBJZBJZJRZJJRJJRJJRJJRJJRJJZBJZBJZBJZJJZJRZJRcJRcJRcJRZJRcJRZBJRBJRBJRJRZRRZRRcRRcRRcRRcRZcJZcJZcJRcJRZJJRJRZRZcRZkJRcJRZJRZRRZJRZJRZJRZJRcJZcJZcJRcJRcRZcRZkRZkRZkRZkRZcRRZRRZRZcRZkJZcJZkRZkRZkRZkJZkJRcJRcJRZJRcBRcJRZJJRJJRJRZBRcJRcJRcJZcJRcBRcBJZBJRBJRBJRBJRBJZBJZBJZ9BR9BR9BR9BR9BJ9BJ9BJBJRBJRJJJBJRBJZBJZ9BR9BRBJRBJRBJR9BR9BR9BJ9BR9BR9BR9BR19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J19J19J19J19J19B19B19B19B19B19B19B19J19J19B19B19B19B19B19B119)1919B19B)19)1911919B)19)1919B19B)19)19)19!)9!)1!)1!)1!)1!)1!)1!)1!)1!)9)19))1111)19)19)19)1919B19B11911911919B19B19B19B19B19B19B19B19B19B19B19J9BJ19B19B99B99B9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BJ9BJ9BR9BR9BR9BR9BR9BJ19J19J19J9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BRBJRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJRBJRBJRBJZBJZBJZBJZBRcBRcBJZBJZBJRBJRBJZBJZBJZBRcJRZJJRJJRJJRJJRJJRJJRJJZBJZBJZBJZBJZJJZJRcJRcJRZJRZJRZJRZBJZBJZJJZJRZRRcRZcRRZRRZRRcRRcRZcJZcJRcJRZJJRJJRJRcRZcJRZJRZJJRJJRJRZJRZJRZJRZJZcJZcJRZJRZRRcRZkRZkRZkRZkRZcRRZRRZRZcRZcJZcJZcRZcRZcJZcJRcJRcJRcJRZJRZBJZBJRJJRBJRBJZBJZJRcJRcJRcJRcBRcBJZBJRBJRBJRBJR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BJ9BJBJRBJRJJJBJRBJRBJZBJZ9BRBJRBJRBJR9BR19J19J9BR9BR9BR9BR19J19J9BJ9BJ9BJ9BJ9BJ9BJ19J19J19J19J19J19J19J19J19B19B19B19B19B19B19J19J19B19B19B19B19B19B)19)1919B19B)1911919B19B)19)1911919B)19)19!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1!)9)19)19)19)19)19)19)19)1919B19B11911911919B19B19B19B19B19B11911919B19B19B19B9BJ9BJ19B19B9BJ9BJ19B19B19J9BJ9BR9BR9BJ9BJ9BR9BR9BR9BJ9BJ19J19J19J9BJ9BJ19J9BR9BRBJR9BR9BR9BR9BR9BR9BR9BRBJZBJZBJZBJZBJZBRcBRcBJZBJZBJZBJZBJZBJR9BR9BR9BRBJZBJZBJZBJZBJZJJZJJZBJRBJRBJZBJZBJZJRZJJRJJRBJRBJRBJRBJRJJZJJZBJZBJZBJZBJZJRZJRcJRcJRZJJZJRZJRZJRcJRZJRcRZcRZcJRZJJRJRZJRcRRcRZcJZcJRcJRZJRZJRcJRZJRZJJRBJRBJRJRZRRZRRZRRZRRcRRcRRZRRZRZcRZkRZkRZkRZkJZcJRZJRZJRcJZcRZcRRcJRcJRZJRcJRcJRcJRcBRcJRZJJRJJRJJJJJJBJRBJZBJZBJZBRcBJZBJZBJZBJRBJRBJR9BR9BR9BRBJRBJR9BR9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BRBJZBJZ9BR9BR9BRBJR9BR9BJ19J19J9BJ9BJ19J19J19J9BJ9BJ9BJ9BJ9BJ19J19J19J19J19J19B19B19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B)19)1919B19B19B19B19B)19)19)19)19)19)19)19)19)19!)1!)1!)1!)1!)1!)1!)1!)1!)9)19)19)19)19)19)19)19)19)1919B19B11911911919B19B19B19B19B11911919B19B19B19B9BJ9BJ19B19B9BJ9BJ19B19B19J9BR9BR9BR9BJ9BJ9BR9BR9BJ9BJ19J19J19J9BJ9BJ9BJ19J9BR9BRBJR9BR9BR9BR9BR9BR9BR9BR9BRBJZBJZBJZBJZBRcBRcBJZBJZJRcBJZBJZBJZBJZ9BR9BR9BRBJZBJZBJRBJRJJZJJZBJRBJRBJZBJZBJZBJZJJRBJRBJRBJRBJRBJZJJZJJZBJZBJZBJZBJZJRZJRZJRZJRZJJZJRZRRcRRcJRZJRZRRcJRcJJRJJRJRZJRZJRZRRcRZcJZcJRcJRZJRZJRZJRZJRZBJZBJZJRZRRZRRZRRZRRcRRZRRZRRZRZcRZkRZkRZkJZcJRcJRZJRZJRcJRcRRcRRcJRZJRZJRZJRZJRcJRcBRcBJZJJRJJJBBB9BJBJRBJZBJZBJZBJZBJZBJZBJZBJRBJR9BR9BR9BRBJRBJRBJR9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BJ19J19J19J19J19J19J19J9BJ9BJ9BJ9BJ19J19J19J19J19J19J19B19B19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B)1919B19B19B19B19B)19)19)19)19)19)19)19)19)19)19!)1!)1!)1!)1!)1!)1!)1!)1!)1))1)19)19)19)19)19)19)19)1919B19B19B11911911919B19B19B19B11911919B19B19B19B19B19B19B19B9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BJBJRBJR9BJ9BJ9BJ9BJ9BJ9BJ99B99B9BJ9BJ9BR9BR9BR9BR9BR9BR9BR9BR9BRBJRBJZBJZBJZ9BRBJZBJZBJZBJZBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJRBJRBJRBJRBJRBJZBJZBJZBJZBJZBJRBJRBJRBJRBJZJJZJJZJJZBJZBJZBJZBJZJJZJJZJJRJJRJRZJRcJRcJRZJRZJRZJRZJRZJRZJRZJRZJRZJJZJRZRZcRZkJRcJRZJJRJJRJRZJRcJRZJRcJZcJZcJZcJZcJRcJRZJJRJJRJZcRZkRZkRZcJRcJRcRRZRRZJRcJRcJRcJRZJRZJRZBJZBJZJRZJRZBJZBJZBJZ9BJ9BB9BB9BRBJZBJZBJZBJZBJZBJZBJZJJJ9BJ9BR9BRBJRJJJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BRBJRBJR9BJ9BJ9BR9BRBJRBJR9BR9BR9BJ9BJ19J19J19J19J9BR9BR9BJ19J9BJ9BJ9BJ19J19J19J19J19J19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B)19)1919B19B19B19B119)19)19)19)19)19)19)19)19)19)19)19!)1!)1!)1!)1!)1!)1!)1!)1!)1))1))1)19!)9!)9)19)19)19)19)1919B19B19B11911919B19B19B19B11911919B19B19B19B19B19B19B19B9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BJ9BJBJR9BJ9BJ9BJ9BJ9BJ9BJ9BJ99B9BB9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BRBJRBJZBJZBJZ9BRBJZBJZBJZBJZBRcBRcBJZBJZBRcBRcBJZBJZBJZBJZBJRBJRBJRBJRBJRBJZBJZBJZBJZBJZBJZBJRBJRBJZJJZJJZJJZJJZJRZBJZBJZBJZJJZJJRJJRJJRJRZJRZJRZJRZJJRJJRJJZJJZJRZJRcJRcJRZJJZJJZJRcRZcJZcJRZJJRJJRJRZJRcRRcRZcRZcJZcJZcJRcJRcJRZJJRJJRJRZJZcRZcJRcJRcJRcRRZRRZJRcJRcJRZJRZJRZJRZBJZBJZJRZJRZBJZBJZBJZ9BR9BB9BJBJRBJZBJZBJZBJRBJRBJZBJZJJJ9BJ9BJBJRJJJJJJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BRBJRJJJJJJ9BR9BRBJRBJR9BR9BR9BR9BJ9BJ19J19J9BJ9BR9BR9BJ19J9BJ9BJ19J19J19J19J19J19J19J19J)1919B19J19J19B19B19B19B19B19B19B19B19B19B19B119)19)1911919B19B119)19)19)19)19)19)19)19)19)19)19)19)19!)1!)1!)1!)1!)1!)1!)1!)1!)9!)1))1))1)19)19)19)19)19)19)19)1919B19B11911919B19B19B11919B19B19B19B19B19B19B19B19B19B9BJ9BJ9BJ19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BRBJZBJZ9BR9BRBJZBJZ9BR9BRBJZBJZBJZBJZBJZBRcBJZBJZBJZBJZBJRBJRBJZBJZ9BR9BRBJZBJZBJZBJZBJZBJZBJZJRZJJZJJZBJRBJRJJZJJZBJZBJZJJRRRJRRJJRZJRZJJZJJZJJZJRZJRZBJZBJZJRZJZcRZkRZcJRZJJZJRZJRcJZcJZcJRcJRZJRZJRZRRcRRcRRcRRcRRcJRcJRcJRZJJRJJRJRZJRcJRZJRcJZcJZcJRZJRZJRcJRcJRZJRZJRcJRcJRcJRZJRZBJZBJZBJZBJZBJR9BRBJRBJZBJZBJZBJRBJRBJRBJRBJRBJR9BJJJJJJJ9BJ9BJ19J9BJ9BJ9BB9BJ19J9BJ9BJ9BJ9BRBJRBJRBJR9BR9BJ9BJ9BR9BR9BR9BR9BR9BR19J19J9BJ9BJ19J19J19J19J19J19J19B19B19J19J9BJ19J19B19B19J19J19J19B19B19B19B19B19B19B19B19B119)19)19)19)19)19119)19)19)19)19)19)19)19)19)19)19!)9!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1!)9!)9!)1!)1))1)19)19)19)19)19)19)1919B19B11911911919B11911919B19B19B19B19B19B19B19B19B19B19B9BJ19J19J19J99B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J99B9BJ9BJ19J19J19J9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BR9BRBJZ9BR9BRBJZ9BR9BR9BRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJRBJZBJZBJZ9BR9BRBJZBJZBJZBJZBJZBJZBJZBJZJRZBJZBJRBJRJJRJJZBJZBJZJJRJJRRRZRRZJRZJJZJJZJRZJRZJRcBRcBRcBRcJZcRZkRZkJRcJRZJRZJRcJZcJZcJZcJRcJJZJJZRRcRZcRRcRRcRRcRRcJRcJRZJJRJJRJRZJRZJRZJRcRZcRZcJRZJRZJRZJRcJRcJRcJRcJRcJRZJRZBJZBJZBJZBJZBJZBJRBJZBJZJRZBJZBJZBJRBJRBJRBJRBJRBJRBJRBJRJJJ9BJ19J19J9BJ9BB9BB99B19J9BJ9BJ9BJ9BRBJZBJZ9BR9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BJ19J9BJ9BJ19J19J19J19J19J19J19B19B19B19J19J19B19B19B19J19J19J19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19!)9!)9!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1!)9!)9!)1!)1))1))1!)9)19)19)19)19)19)19)19)1911911911919B19B19B19B19B19B19B11911911919B19B19B19B9BJ9BJ19B19B99B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ99B99B19B19B9BJ9BJ9BJ9BJ9BR9BR9BR9BRBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJRBJZBJZBJZBJRBJRBJZBJZBJRBJRBJRBJZBJRBJZBJZBJZBJRBJRBJRBJZBJZBJZBJRBJRRRZRRZJJZJJZRRZRRcJRcJRcJZcJRcBRcJRcJZkRZkJZcJRcJRcJRcJRcJRcJRcJRZJRZJRZRZcRZcRZcJZcRZcJZcJRcJRZJJRJJRJJZJRZJRcJZcRZcRRcJZcJRcJRZJRZJRcJZcJZcJRcBJZBJZBJZBJZBJZBJZBJZBJRBJZJJZJRZJRZJRZBJZBJRBJRBJZBJZBJRBJRBJR9BJ9BB99B9BJ9BJ9BJ9BB19B19J9BR9BR9BJ9BJ9BRBJR9BR9BJ19J9BJ9BJ9BJ9BJ1BR1BR9BJ9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BJ19J19B19B19B19B19B19B19B19B19J19J19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19))1))1!)1!)1!)1)19)19!)1!)1!)1!)1!)1!)1!)1!)1!)9!)9!)1))1))1))1!)9)19)19)19)19)19)19)19)19)1911911919B19B19B19B19B19B11911911911919B19B19B19B19B99B19B19B99999B9BJ9BJ9BJ99B99B9BJ9BJ9BJ99B19B19B19B19B9BJ9BJ9BJ9BR9BJ19J19J9BRBJZ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BRBJZBJZBJZBJZBJZBJZBJZBJZBJRBJZBJZBJZBJRBJRBJZBJZBJZBJRBJRBJRBJRBJRBJZBJZBJZBJR9BRBJZBJZBJZBJZBJRJRZRRZJJZJJZRRZRRcJRcJRcJZcJZcJRcBRcJRcJZkJZkJZcJZcJRcJRcJRcJRZJRZJRZJRcRRcRZcJZcJRcJZcJRcJRZJRZJRZJRZJRZJRcJZcJZcRRcRRcJZcJZcJRcJRcJZcJZcJRcJRZBJRBJRBJZJRZBJZBJZBJRBJRBJRJJZJRZJRZJRcJRZBJZBJZBJZBJZBJRBJR9BR9BJ99B99B99B99B99B99B19J19J9BJ9BR9BJ9BR9BR9BR9BJ9BJ19J19J9BJ9BJ19J19J19J19J9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BJ9BJ19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19))1))1!)1!)1!)1!)1)19))1!)1!)1!)1!)1!)1!)1!)1!)1!)9!)9))1))1!)1!)9)19)19)19)19)19)19)19)19)19)19)19)1919B19B19B19B11911911911911919B19B19B19B19B19B19B19B99B99999B9BJ9BJ99B99B19B19B9BJ9BJ9BJ19J19J19B19B19B9BJ9BJ9BJ9BJ19J9BJ9BR9BR9BR19J19J9BR9BRBJR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BRBJRBJRBJRBJRBJR9BR9BRBJRBJZBJZBJZBJRJJRJJRJJRBJZBJZBJZBJZBJZBJZBJZBJZBJZJJZJRZJRZJJZJJZJJZJRZBRcBRcJRcJRcJRcJRcBRcJRcJZkJZkJRcJRcJZcJRcJRcJRZJRcJRcJRcJRcJRZJJZJJZJRZJRZJRcJRcJZcJZcJRcJRcJRZJRcJRcJZcJZcJZcJRcJRcJRcJRcJRZBJRBJRJJZJRZBJZBJZBJRJJJBJRBJZBJZJRcJRcBJZBJZBJZBJZBJZBJRBJR9BJ9BJ99B99B99919B19B19B19J9BJ9BJ9BJ9BJ9BR9BJ9BJ9BJ9BJ19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J9BJ9BJ9BJ19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19))1))1))1!)1!)1!)1!)9!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)9!)9))1))1!)9!)9)19119)19)19)19)19)19)19)19)19)19)1919B19B19B19B19B119)19)1911919B19B19B19B19B19B19B99B99B99B99B9BJ9BJ99B19B19B19B9BJ9BJ19J19J19J19B19B19B99B9BJ9BJ9BJ19J9BJ9BJ9BR9BR19J19J19J9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BRBJRBJRBJRBJR9BR9BRBJRBJZBRcBJZJJRJJJJJRJJRBJZBJZBJZBJZBJZBJZBJZJRZJRZJRZJRZJRZJJZJJZJJZJJZBRcBRcJRcJZcJZcJRcBJZBRcJRcJZkJZcJZcJZcJZcJRcJRZJRcJRcJRZJJZJJZJJZJJZJJZJJZJRZJZcJZkRZcJZcJRcJRZJRcJRcJZcJZcJZkJZcBRcBRcJRZBJZBJRBJRJJZJRZBJZBJZBJRBJRBJRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJR9BJ9BJ99B99B99B11911911919B19J9BJ9BB9BB9BJ9BR19J19J9BJ9BJ19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J9BJ9BJ19B19B19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19))1))1))1!)1!)1!)9!)9!)1!!)!)1!)1!)1!)1!)1!)1!)1!)1!)9!)9!)1!)1!)9)19)19)19)19)19)19)19)19)19)19)1919B19B11911919B19B19B119)19)1911911911911919B19B19B99B99B9BJ9BJ9BJ9BJ9BJ19J19B19J9BJ9BJ19J19B19B19B19B19B19B9BJ9BJ9BJ19J19J19J19J9BR9BR9BR19J19J19J9BR9BR9BR9BR9BRBJRBJRBJRBJRBJRBJR9BR9BR9BR9BR9BRBJRBJZBJZBJRBJRBJRBJZBJZBJZJJJJJJBJRBJRBJRBJZBJZBJZBJZBJZJJZJRZBJZBJZJRZJRZJJZJJZJRZJRZBRcJRcJZcRZcJZcJRcBRcBRcJRcJZcJZkJZkJZcJRcJRZJRZJRZJRZJJZJJZJRZRRcRRcJRZJJZJRZJRcJZcRRcRRcJZcJRcBRcBJZJRcJZcJZcJZcJRcBJZBRcBJZBJRBJRBJZJRZJRcBJZBJZBJRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJR9BJ9BJ9BB9BB99B19B11911919B19J9BJ9BB9BB9BJ1BR19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19B19B19J9BJ19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19!)1!)1))1)19)19)19!)1!!)!)1!)1!)1!)1!)1!)1!)1!)1!)9!)1!)1!)1!)9)19)19)19)19)19)19)19)19)19)19)1919B19B11911919B19B19B19B119)1911911911911919B19B99B99B99B9BJ9BJ9BJ9BJ9BJ19J9BJ9BJ9BJ19J19B19B19B19B19B19B19B9BJ9BJ19J19J19J19J19J9BR9BR9BR9BR19J19J19J9BR9BR9BR9BRBJRBJRBJRBJRBJRBJR9BR9BR9BR9BR9BR9BRBJZBJRBJRBJRBJRBJZBJZBJRJJJJJJBJRBJRBJRBJRBJZBJZBJRBJRJJRJJZJRZBJZJRZJRZJJZJJZJRZJRZBRcJRcJZcRZcJRcBRcBRcBRcJRcJRcJZkJZkJRcJRcJRcJRZJRZJRZJJZJJZRRcRZcRZcRRcJRZJJZJRZJRcRRcRZcRZcJZcBRcBJZBJZJRcJZcJZcJRcBJZBJZBJZBJRBJRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BJ9BJ9BB9BB99B19B19B11919B19J9BJ9BJ9BJ9BJ19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19J19B19B19B19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19))1!)1!)1)19)19)19))1!)1!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1))1))1!)9!)9))1))1)19)19)19)19)19)19)19)19)1911919B19B19B19B19B19B11911911911911919B11911999B99B99B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19B19B99B99B19B19B19B19B19J19J19J19J19J19J9BJ9BJ9BRBJR9BR9BR19J19J9BJ9BR9BR9BRBJRBJRBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BRBJRBJRBJRBJRBJR9BRBJRJJJJJJBJRBJR9BR9BRBJZBJRBJRJJJJJRJJRJJZJRZBJZBJZJJZJJZJJZJRZJRZJRcJRcJRcJRcBRcBRcBRcBRcBRcJRcJRcJZkJZkJRcJRZBJZBJZBJZJRZRRcRZkRZcRZcJRZJRZJRZJRcRZcRZcJZcJRcBRcBRcBJZJRcJZkJZkBRcBJZJRZJJZJJRBJRBJRBJZBJZBJZBJZBJZBJZ9BRBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BJ9BJ19B19B19B19B11919B19J9BJ9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BJ9BJ19J19J19J19J19J19J19J19J9BJ19J19B19B19B19B19J19J19B19B19J19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19!)9)19)19)19)19)19)19)19)19!)1!)1))1))1)19)19))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1))1))1!)9!)9))1))1)19)19)19)19)19)19)19)19)19)19)19)1919B19B19B11911911911911919B19B11911999B99B99B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ19B19B19B9BJ9BJ19B19B19B19B19B19J19J19J19J9BJ9BJ9BJ9BR9BR9BR9BR19J19J9BJ9BJ9BR9BRBJRBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BRBJRBJRBJRBJR9BR9BRJJJBJRBJRBJR9BR9BRBJRBJRJJJJJJJJJJJRJJRBJZBJZBJZJRZJJZJJZJJZJRZJRZJRcJRcBRcBRcBRcBRcBRcBRcBRcBRcJZkJZkJRcJRZBJZBJZBJZJRZJRcRZcRZcJRcJRcJRZJRZJRcJZcRZcJZcJRcBRcBRcBJZBRcJRcBRkBRcBJZJJZJJRJJRBJRBJRBJRBJZBJZBJZBJZBJZ9BRBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR19J19B19B19B19B19B19B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J19J19J19J19J19J19J19J19B19B19B19B19B19J19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19!)9)19)19)19)19)19)19)19)19!)1!)1))1))1)19))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)9)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)1919B19B119119)19)1919B19B11911999999B99B99B19J9BJ9BJ9BB99B9BJ19J19B19B19B9BJ9BJ19J19B19B19B19B19B19B19J19J99B99B9BJ9BJ9BJ9BR9BR9BR9BJ19J9BJ9BJ9BJ9BRBJZBJZBJZBJZBJZBJZ9BR9BRBJR9BR9BR9BJ9BRBJRBJRBJRJJJJJJBJR9BRBJRBJRBJRBJZ9BR9BRBJRJJJJJRJJRJJRJJRBJZBJZBJZBJZJRZJJZBJRBJRJRZJRZJRZJRcBRcBRcJZkJRcBRcBRcBRcBRcJRcJRcJRcBJZJJZJJZBJZJRZJRcJRcJRcJRcJRZJRZBJZBRcJRcJZcJZcJRcBRcBRcBJZBJZBRcBRcBRcBJZBJZBJRBJZBJRBJRBJRBJZBJZBRcBRcBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BRBJZ9BR9BR19J19J19J9BB9BB19B19J9BB9BJ9BJ19J19J9BJ9BR9BR9BJ19J19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19))1))1))1)19))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)9)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19119119119)19)19)1919B11911911919B99B19B19J19J9BJ9BJ99B99B19J19J19B19B99B9BJ19J19B19B19B19B19B19B19B19B19B99B99B99B9BJ19J19J9BR9BR9BJ19J9BJ9BJ9BJ9BR9BRBJZ9BR9BRBJZ9BR9BR9BR9BR9BR19J9BJ9BRBJRBJRBJRJJJJJJBJR9BRBJRBJR9BR9BR9BRBJRJJJJJJJJRJJRJJRJJRBJZBJZBJZBJZJRZJRZBJRBJRJRZJRZJRZJRZBJZBRcJZkJZkJRcBRcBRcBRcBJZJRZBJZBJZJJZJJZBJZBJZBJZBJZBJZJRZJRZJRZBJZBJZJRcJRcJRcJRcBRcBRcBJZBRcBRcBRcBRcBJZBJRBJRBJZBJZBJZBJRBJZBJZBRcBRcBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR19J19J19J9BJ9BJ9BB9BJ9BJ9BB9BB19J19J19J9BJ9BR9BR9BJ19J19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19))1))1)19)19))1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1))1))1!)9)19)19)19)19!)9))1))1)19)19)19)19)19)19)19)19119119111119)1919B19B19B11911919B19B19B19B19B19B99B99B99B99B9BJ9BJ19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J19J19J9BJ9BR9BR19J19J9BR9BR9BJ9BJ9BR9BR9BR9BR9BR9BR9BR9BR9BR19J9BR9BR9BR9BR9BR9BRBJR9BR9BR9BR9BR9BR9BR9BR9BRBJRJJJBJRBJRBJRJJRJJRJJZJJZJRZJRZBJZJRZJJZJJZJRZJRcJRZBJZBJZBRcJZkJZkJRcJRcBRcBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZJJZJJZJJZJRZJRZBJZBJZBJZBJZBRcBRcBRcBRcBRcBRcBJZBJZBJRBJRBJZBJZBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR1BR19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J19J19J9BJ9BJ19J19J19J19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B)19)1919B19B)19)19)19)19)19)1919B119)19)19)19)19)19)19)19!)9!)1))1)19)19))1))1!)9!)9))1))1)19)19))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1))1))1!)9)19)19)19)19!)1!)1))1)19)19)19)19)19)19)19)19119119))1)19)1919B19B)1911911911919B19B19B19B19B99B99B99B99B9BJ9BJ19J19B19B11919B19B19B19B19B19B19B19B19B19B19J19J19J19J19J9BJ9BR9BR19J9BJ9BR9BR9BJ9BJ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BRBJR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BRBJRJJJJJJBJRBJRBJRJJRJJRJJZJRZJRcBJZBJZJJZJJZBJZBJZBJZBJZBJRBJZJRcJZkJRcJRcBRcBJZBJRBJRBJZBJZBJZBJZBJRBJRBJZBJZBJZBJZJJZJJZJJZJJZBJZBJZBJZBJZBJZBJZBRcBRcBRcBRcBRcBJZBJZBJRBJRBJRBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BR9BR9BR9BR9BR19J19J19J19J9BJ9BJ19J19J9BJ9BJ19J19J19J19J19J19J9BJ9BJ19J19J19J19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B)1919B19B19B)19)19)19)19)19)1919B119)19)19)19)19)19)19)19!)9!)1!)1))1))1))1))1!)1!)1))1))1)19)19))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)9!)9!)9)19))1))1!)1!)9)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)1911911911911911911999999999919B19B99B9BB19B19B19B19B19B19B19B19B19B19B19B19J19J19J19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BRBJR9BJJJJBJRBJRBJRBJRBJRBJZJRZJRcBJZBJZBRcBRcBJZBJZBJZBJZBJRBJRBRcBRcBJZBJZBRcBRcBJZBJRJJZJRZBJZBJZBJRBJRBJZBJZBJZBJZJRZJRZJRcBJZBJZBJZBJZBRcBJZBJZBJZBJZBJZBJZBJZBJZBJZBJRBJRBJZBJZBJZBJZBJZBJZBJR9BR9BR9BR9BR9BR9BR9BR9BRBJR9BR9BJ19J19J19J19J19J9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BJ9BJ9BJ19J19J19J19J19J19J19J19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B)1919B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19!)1!)1))1))1))1))1))1))1!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)9!)9!)9!)1))1))1!)9)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)1911911911911911911999999919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J19J19J19J19J9BJ9BJ9BJ19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BR9BR9BJ9BJBJRBJRBJRBJRBJRBJRBJZBJZBJZBJZBRcBRcBJZBJZBJZBJRBJRBJRBJZBRcBJZBJZBJZBJZBJZBJRJJZJJZBJZBJZBJRBJRBJZBJZBJZBJZJRZJRZBRcBJZBJZBJZBJZJRZBJZBJZBJZBJZBJZBJZBJZBJZBJRBJRBJRBJRBJRBJZBJZBJZBJRBJR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BJ9BJ19J19J19J19J9BJ9BJ9BJ9BJ19J19J19J9BJ9BJ9BJ9BJ19J19J1BR19J19J19J19J19J19J19B19B19B19J19B19B19B19B19B19B19B19B19B19B19B)19)1919B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19!)1))1))1))1!)1!)1))1))1))1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)9!)9))1))1!)1!)9)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19))1))1))1)19)1911911911911911911919B19B11911919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B9BJ9BJ9BJ19J19J19J19J19J9BJ9BJ9BR9BR19J9BJ9BR9BR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BR9BR9BR9BR19J19J9BJ9BJ9BJ9BRBJRBJRBJZBJZBJRBJRBJRBJRBJZBJZBJZBJZBJRBJRBJZBJZBJRBJRBJZBJZBJZBJZJJZJJZBJZBJRJJZJJZJRZBJZBJRBJRBJRBJZBJZBJZBJZBJZJRZJJZBJRBJRJJRJJRJRZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BRBJRBJRBJRBJRBJRBJR9BR9BR9BR9BR9BR9BR9BRBJR9BR9BR19J19J19J19J19J9BJ9BJ9BJ9BJ19B19B9BJ9BJ9BJ19J19J19J19J1BR1BR19J19J19J9BJ19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B)19)1919B19B11911919B19B)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19))1))1!)1!)1!)1!)1!)1))1))1))1!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)9))1))1!)9!)9)19119)19)19!)9!)9)19)19)19)19)19)19)19)19)19))1))1))1))1))1119119)19)1911911919B19B11999919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B9BJ9BJ19J19J19J19J19J19J9BJ9BJ9BR9BR19J19J9BR9BR19J19J9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BJ9BR9BR9BR9BR9BJ9BJ9BR9BR9BRBJRBJRBJZBJZBJRBJR9BR9BRBJRBJZBJZBJZBJRBJRBJZBJZBJRBJRBJRBJRBJRBJRJJZJJZBJRBJRJJZJJZJJZBJRBJRBJRBJRBJRBJRBJRBJRBJRBJZJJZBJZBJRBJRJJRBJZBJZBJZBJZBJZBJZBJZBJZ9BR9BR9BR9BRBJRBJRBJRBJR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR19J19J19J19J19J19J9BJ9BJ9BJ19B19B19B9BJ9BJ19J19J19J19J19J19J19J19J19J19J19J19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B)19)1919B119)19)19119119)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19))1))1!)9!)9!)1!)1!)1!)1))1))1))1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)9!)9)19))1))1)19)19!)9!)9))1))1)19!)9)19)19)19)19111))1))1))1))1))1)19)19)19))111911911919B99B99B99B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J19J19J19J19J9BJ9BJ9BJ9BJ9BR9BR19J19J19J19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BRBJRBJRBJRBJRBJZBJRBJR9BR9BJ9BJ9BRBJZBJZBJZBJZBJZBJZ9BRBJRBJRBJRBJRBJRBJZJJZJJZBJRBJRJJZJJZBJRBJRBJRBJRJJRJJRJJRJJRBJRBJRBJRBJZBJZBJZBJRBJRBJRBJZBJZBJZBJZ9BRBJRBJR9BR9BR9BR9BRBJRBJRBJRBJZBJZBJZ9BR9BR9BR9BR9BR19J9BJ19J19J19J19J19J19J19J19B19B19B19B19B19J19J19J19J19J19J19J19J19J19J19J19J19J19B19B19B19B19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19119)19))1!)1)19)19)19)19)19)19!)1))1)19)19!)1!)1!)1!)1!)1))1))1))1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!)1!)1!)1!)1!)1!)1!)9!)9!)9))1))1))1)19!)9!)9)19))1))1)19!)9)19)19)19)19))1))1))1))1))1))1)19)19)19))111911911911999B99B99B99B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J19J19J19J19J9BJ9BJ9BJ9BJ9BR9BR9BJ19J19J19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BRBJRBJRBJRBJRBJRBJR9BR9BR9BJ9BJ9BR9BRBJZBJZBJZBJZBJZBJZBJRBJRBJRBJRBJRBJZBJZBJRBJRBJRJJZBJZBJRBJRBJRBJRBJRJJRJJRBJRBJRBJRBJRBJRBJZBJZBJZBJRBJRBJRBJZBJZ9BRBJRBJRBJR9BR9BR9BR9BRBJRBJRBJR9BRBJZBJZ9BR9BR9BR9BR19J19J19J19J19J19J19J19J19J19B19B19B19B19B19J19J19J19J19J19J19J19J19J19J19J19J19J19J19B19B19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B119)19)19)19)19)19)19)19)19)19)19)19)19)19!)1!)1)19)19)19)19)19))1!)1!)1))1))1!)1!)1!)1!)1!)1!)1))1))1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!)9!)9!)1))1))1))1)19!)9)19))1111))1)19)19)19)19111))1)19)19))1))1!)1!)9)19)19)19)1911911911911911999B99B99B19B19B11911919B19B19B19B19B19B19B19B19B19B19B19B19J19J19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BJ9BB9BB9BJ9BJ9BR9BR9BRBJRBJR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BRBJZBJZBJZBJZBRcBRcBJZBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJR9BR9BJ9BJ9BRBJRBJRJJJBJRBJRBJZBJZBJRBJRBJR9BR9BRBJRBJRBJR9BR9BR9BR9BR9BR9BJ9BJ9BJ9BR9BRBJZ9BR9BR9BR9BR9BJ19J19J19J19J19J19B19B19B19B19B19B19B19B19J19J19B19B19J19J19J19J19J19J19B19B19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B)19)19)19)1919B19B19B19B119)19)19)19)19)19)19)19)19)19)19)19!)9)19)19)19)19)19)19))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!)9!)1!)1))1))1)19!)9!)9))1))1))1)19)19)19)19)19))1))1!)9!)9)19))1)19)19)19)19)1911911911911911911911999B99B19B19B11911919B19B19B19B19B19B19B19B19B19B19B19B19J19J19J19J19J19J9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BJ9BB9BB9BJ9BJ9BR9BRBJRBJRBJR9BR9BRBJRBJR9BR9BR9BR9BR9BR9BRBJZBJZBJZBJZBRcBRcBJZBJZBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJR9BR19J19J9BJBJRBJRJJJBJRBJRBJRBJRBJRBJRBJR9BR9BRBJRBJR9BR9BR9BR9BR9BRBJR9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BR9BJ19J19J19J19J19J19B19B19B19B19B19B19B19B19J19B19B19B19J19J19J19J19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)1919B19B19B119)19)19)19)19)19)19)19)19)19)19!)9!)9)19)19)19)19)19))1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1))1))1))1))1))1!)9!)9!)9))1))1))1)19))1))1)19!)9!)9)19))1))1)19)19)19))1)19)1911911911911919B19B91999999999B99B99B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J9BJ19J19B19B9BJ9BJ9BJ9BJ9BJ9BJ19J9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BJ9BJ9BJ19J19J9BJ9BJ19J19J9BJ9BJ9BJ9BJ9BR9BRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJZ9BR9BR9BR9BR9BRBJZBJZBJZBJZBJZBJZ9BRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJR9BJ9BJ9BJ9BJBJRBJRBJRBJRBJR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BR9BRBJRBJR9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ19J19B19B19B19B19B19B19J19J19B19B19B19B19J19J19J19J9BJ19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B)19)19)1919B19B)19)19)19)19)19)19)19)19119)19)19)19)19)19)19)19!)9!)9!)1!)1!)1!)1))1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1))1))1))1))1!)9!)9!)9!)1))1))1!)9!)9)19))1)19!)9!)9!)9))1))1)19)19))1))1)19)1911911911911919B19B91991911911999B99B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19J19J19J19B19B19B9BJ9BJ19J19J9BJ9BJ9BJ19J9BJ9BJ19J19J19J19J9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BJ19J9BJ9BJ9BJ9BR9BR9BRBJRBJRBJRBJRBJRBJRJJJJJJBJRBJR9BR9BR9BR9BR9BR9BRBJZBJZBJZ9BR9BR9BRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJRBJR9BJ9BJ9BJ9BJ9BJBJRBJRBJRBJR9BR9BR9BR9BR9BR9BR9BR9BRBJR9BR9BR9BR9BRBJRBJR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19B11919B19B19B19B19J19J19B19B19B19B19B19J19J19J19J19B19B19B19J19B19B19B19B19B19B19B19B19B19B19B)19)19)1919B19B19B)19)19)19)19)19)19)19)19)19)19)19!)9)19)19)19)19!)9!)9!)1!)1!)1))1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!)1!)1!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1))1))1))1!)9!)9!)9!)1!)1))1))1!)9!)9)19)19))1)19!)9!)9))1))1)19)19)19)19)19)19)19)19)19)1911911911911911911911919B19B19B19B19B19B19B11911919B19B19B99B99B9BJ9BJ19J19B19B19B19B9BJ9BJ19J19J9BJ9BJ9BJ9BJ19J19J19J19J19J19J19J9BJ9BJ19J19J9BJ9BJ9BJ9BJ9BJ19J19J9BJ9BJ9BR9BR9BR9BR9BRBJRBJRBJR9BJ9BJ9BJ9BR9BR9BRBJRBJR9BR9BRBJRBJR9BR9BRBJRBJRBJRBJRBJRJJRJJRBJRJJJ9BJBJRBJR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJBJRBJRBJRBJR9BR9BR9BJJJJBJRBJR9BR9BRBJRJJJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J19J19B19B19J19J11911919B19B19B19B19B19B19B19B19J19J19B19B19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B)19)1919B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19!)9)19)19)19)19!)9!)9!)1))1))1)19)19!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!!)!!)!!)!!)!)1!)1!)1!!)!!)!!)!!)!!)!)1!)1!)1!)1))1))1!)9!)9!)9!)9!)1!)1))1))1!)9!)9)19)19))1))1)19!)1))1))1)19)19)19)19)19)19)19)19)1911911911911911911911911911919B19B19B19B19B11911911919B19B99B99B9BJ9BJ19J19B19B)1919B19B9BJ9BJ19J19J19J9BJ9BJ9BJ9BJ19J19J19J19J19J19J19J19J19J19J19J9BJ9BJ9BJ9BJ19J19J9BJ9BR9BR9BR9BR9BR9BR9BRBJR9BR9BJ9BJ19J9BJ9BJ9BRBJRBJRBJRBJRBJR9BJ9BJ9BRBJRBJRBJRBJRBJRJJRJJRJJJJJJ9BJ9BJBJR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BRBJRBJR9BR9BR9BJ9BJ9BJBJRBJR9BRBJRJJJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19J19J19B19B19B19J19B11911919B19B19B19B)19)1919B19B19J19J19B19B19J19J19B19B19J19J19B19B19B19B19B19B19B19B19B19B19B19B)19)1919B19B)19)19)19)19)19)19)19)19!)9!)9!)9)19)19)19)19!)9)19)19)19!)9!)9!)9))1))1)19)19!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!)1!)1!!)!!)!!)!!)!!)!)1!)1!)1!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)9!)9!)9!)9!)9!)1!)1!)1!)9!)9)19))1))1)19)19))1))1))1))1)19)19)19)19)19)19)19)1911911911911911911911911911911919B11911911911911911911919B99B99B99B9BJ19J19B19B19B19B19B19B19J9BJ9BJ19J19B19B19J9BJ99B99B19J19J19J19J19B19B19B19B19B19B19J9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BR9BJ9BJ9BJ9BJ9BR9BJ9BJ19J19J9BJ9BRBJRBJRBJZBJR9BJ9BJ9BJ9BJBJRBJRBJRBJRBJRBJRJJJ9BJ9BJ9BJ9BJ9BJBJR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BRBJRBJR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BB9BJ9BJ99B9BB9BJ9BR1BR19J19B19B19B19B99B99B19B19B19B19B19B19B11911919B19B19B19B19B19B19J19J19J19B19B19B19B19B19B19B)19)1919B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19)19!)9!)9!)9!)9)19)19)19)19)19)19!)9!)9!)9!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!)1!)1!)9!)9!)9!)9!)9!)1!)1!)1!)9!)9!)9))1))1)19!)9!)9))1))1))1))1)19)19)19)19)19)19)1911911911911911911911911911911911911911911911911911911911919B99B99B19B19B19B19B19B19B19B19B19B19B19J19J19B19B19B19B19B99B99B19J19J19J19B19B11919B19B)19)1919B19J19J19J19J9BJ9BJ9BR9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19B19B9BJ9BRBJRBJZBJZBJR9BJ9BJ9BJ9BRBJRBJRBJRBJRBJR9BJ9BJ9BJ9BJ9BJ9BJ9BJBJRBJR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJBJR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BB9BJ99B99B99B9BJ9BR1BR19J19B19B19B19B99B19B19B19B19B19B19B19B11911919B19B19B19B19B19B19B19J19J19B19B19B19B19B19B19B)19)1919B19B)19)19)19)19)19)19)19)19)19)19!)9!)9)19)19!)9!)9!)9!)9!)9)19)19)19119)19)19!)9!)9!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)))1))1!)9!)9!)9!)9))1))1))1))1!)9!)9!)1!)1))1)19!)9!)9))1))1))1))1)19)19)19)19)19)19119119119)19)1919B119119119119119119119119)19)1919B19B11911919B19B19B19B11911919B19B19B19B19B19B19B19B19B19B19B19B19B19B99B99B9BJ19J19B19B11911919B)19)19)1919B19B19B19B19B19B19J9BJ9BJ9BJ9BJ9BJ9BB9BB9BJ9BJ9BJ19J19B19B9BJ9BRBJRBJZBJZBJR9BJ9BJ9BRBJR9BR9BR9BJ9BJJJJJJJ9BJ9BJBJRBJR9BJ9BJBJRBJR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ99B9BB9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19J19B19B19B19B19J1BR9BR9BJ9BJ9BJ9BB9BB19B19B19B19B11911919B)1919B19B19B)1919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19!)9)19)19!)9!)9!)9!)9)19)19)19)19)19)19)19!)9!)9!)9!)1!)1!)9!)1!)1!)1!)1!)1!)1!)1))1))1!)1!)1!)1!!)!!)!!)!!)!!)!)1!)1!!)!!)!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)))1))1!)9!)9!)9))1))1))1))1))1!)9!)9!)1!)1!)9!)9!)9!)9))1))1))1))1)19)19)19)19)19)19119119)19)19)19)19119119119119119119119119)19)1919B19B11911911919B19B11911911919B19B19B19B19B19B19B19B19B19B19B19B19B19B99B99B19J19B19B119119119)19)19)1919B19B19B19B19B19B19B19B19J99B99B9BJ99B9BB9BB9BJ9BJ19J19B11919B9BJ9BRBJRBJRBJRBJR9BJ9BJBJRBJRBJR9BJ9BJ9BJJJJJJJ9BJ9BJBJRBJR9BJ9BJBJRBJR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ99B99B99B9BB9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BB9BB9BJ19B19B19B19B19B19J19J9BJ9BJ9BJ9BJ9BB9BB19B19B19B19B11911919B)1919B19B)19)1919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19!)9!)9!)9!)9!)9!)9)19)19)19)19)19)19)19)19!)9!)9!)9!)1!)1!)9!)9!)1!)1!)1!)1!)1!)1))1))1!)1!)1!)1!!)!!)!!)!!)!!)!)1!)1!!)!!)!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)))1))1!)9!)9))1))1!)1!)1!)1!)9!)1!)1!)1!)9!)9!)9!)9!)9!)9))1))1))1)19!)9!)9)19)19)19)19)19)19)19)19)1911911919B)1911911911911911919B11911911911911911911911911911919B19B19B19B19B19B19B19B19B19B19B19B19J19J99B99B19B19B19B11911911919B19B19B19B19B19B19B19B)19)1919B19B99B99B19B19B9BB9BJ9BJ9BJ19B19B11919B19J9BR9BJ9BJBJRBJR9BJ9BJBJRBJR9BJ9BJ9BJ9BJJJJJJJBJR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ99B99B99B9BB9BJ9BJ9BJ9BJ9BB9BJ9BJ9BJ9BB9BB9BB99B19B19B19B19B99B19J9BJ9BJ9BJ19B19B19B19B11911919B19B11911911919B19B19B19B19B19B19B)19)1919B19B19J19J19B19B19B19B19J19J19B19B)19)19)19)19)19)19)19)19)19)19119)19)19!)9!)9!)9!)9!)9)19)19)19)19)19)19)19)19!)9!)9!)9!)9!)1!)1)19)19))1))1!)1!)1!)9!)9!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!!)!!)!!)!)1))1))1!)9!)9))1))1))1!)1!)9!)9!)1!)1!)1!)9!)9!)9!)9!)9!)9!)9))1))1)19!)9!)9)19)19)19)19)19)19)19)19)19119119)19)1911911911911919B19B11911911911911911911911911911919B19B19B19B19B19B19B19B19B19B19B19B19J9BJ99B99B19B19B19B19B11911911919B19B19B19B19B19B19B)19)1919B19B99B19B19B19B99B9BB9BJ9BJ19B19B19B19B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ99B99B99B19B19J9BJ9BJ9BB9BB9BJ9BJ9BJ9BB9BB9BB99B19B19B19B99B99B19B19J9BJ19B19B19B19B11911911919B19B11911919B19B19B19B19B19B19B19B)19)1919B19B19J19J19B19B19B19B19J19J19B19B)19)19)19)19)19)19)19)19)19)19)19)19)19!)9!)9!)9!)9!)9)19)19)19)19)19)19)19)19!)9!)9!)9!)1!)1!)1))1))1))1))1!)1!)1!)9!)9!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)9!)9!)1))1))1))1!)9!)9!)1!)1!)1!)1!)9!)9))1))1!)9!)9))1))1))1)19))1))1))1)19)19)19)19)19)19)19)19)1919B19B119119119119119119119119119119119)19)19)19)19)1919B19B99B19B19B19B19B19B)19)1919B19B19B19B99B99B19B19B19B)1919B11911919B19B19B)19)1919B19B19B19B19J19J19B19B19B19B99B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJJJJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BR9BR9BJ9BJ9BJ9BB99B9BJ9BJ9BJ9BJ9BJ9BB9BB9BB99B99B99B9BJ99B99B19J9BJ9BB9BB9BJ19J19J9BJ9BJ9BB9BJ19J19B19B11911919B19B19B19B19B11919B11911911919B19B11911919B19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)1919B)19)19)19)19119)19)19)19!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9)19))1))1)19!)9!)9!)9!)1!)1!)9!)9!)1!)1!)9!)9!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)9!)1))1))1)19)19!)9!)1!)1!)1!)1!)1!)9))1))1!)1)19))1))1))1))1))1))1))1))1)19)19)19)19)19)19)1911911919B119119119999119119119119119119)19)19)19)19)1911911919B99B99B19B19B19B19B)19)1919B19B19B19B19B19B19B19B)19)1919B19B11999919B19B)19)1919B19B19B19B19J19J19B19B19B19B99B99B99B9BJ9BJ9BJ9BJ9BJ9BB9BB9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BR9BR9BJ9BJ9BJBBB99B99B99B9BJ9BJ9BJ9BB9BB9BB9BB99B99B9BJ9BJ99B99B19B9BJ9BJ9BJ9BJ19J19J19J9BJ9BB19J19J19B19B11911911919B19B19B11911911911911911911919B11919B19J19J19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19)19)19)19)19)19)19!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9))1))1!)9!)9!)9!)9!)1!)1!)9!)9!)1!)1!)9!)9!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!)1!)1!!)!!)!!)!)1!)1!)1!!)!!)!)1!)1!)1!)1))1))1))1))1))1))1))1))1)19)19!)1!!)))1))1))1))1!)9!)9))1))1))1))1))1))1))1))1))1))1))1)19)19)19))1))1119119119119119119919999119119999119119)19)19)19)19)1919B19B11911999B99B9BJ19J19B19B)19)1919B19B19B19B19B19B19B19B)19)19)1919B19B99B99B19B19B19B19B19B19B19B19B19B19B11911911999B99B9BB9BJ9BJ9BJ99B99B99B99B9BB9BJ9BBBBB9BJ9BJ9BJ9BJ9BJ9BBBBB9BB9BJ9BJ9BJ9BJ9BR9BJ9BJ9BB9BJ9BJ9BB99B99B99B99B99B9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ19B19B19B99B9BJ9BJ9BB99B19J19J9BB99B19B19B19B19B11911911919B19J19B11911911911911911911911919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)1919B)19)19)19)19)19!)9)19)19)19!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9)19)19!)9!)9!)9!)9!)1!)1!)1!)1))1)19))1))1!)1!)1!!)!!)!)1!)1!)1!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!!)!!)!!)!)1!)1!!)!!)!)1!)1!)1!)1))1))1))1))1))1119))1)19)19)19!)1!!)))1))1))1))1!)9)19)19111))1))1))1))1))1))1))1))1))1))1)19)19)19))111911911911911911991991911919B119119)19)19)19)19)19)1919B19B11911911999B99B99B19B)19)19)1919B19B19B19B19B19B19B19B)19)19)1919B99B99B99B99B19B19B19B19B19B19B19B11911911911919B99B99B9BB9BB9BJ99B99B99B99B99B9BB9BB9BB9BB9BJ9BJ9BJ99B9BB9BB9BB9BB9BJ9BJ9BJ9BJ9BJ9BJ9BBBBB9BJ9BJ9BB99B99B99B99B99B99B9BJ9BJ9BJ9BJ9BJ9BJ99B19B19B99999B9BJ19J99B99B9BJ19J99B19B19B19B19B19B19B11911919B19B19B119111111111111119111119)1919B11919B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B19B)19)19)19)19!)9!)9)19)19)19!19)19)19)19)19)19)19!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)1!)1!)1!)1!)1)19)19))1))1!)1!)1!!)!!)!)1!)1!)1!)1!!)!!)!!)!)1!)1!)1!)1!)1!)1!!)!!)!!)!)1!!)!!)!!)!)1!)1!)1!)1))1))1))1))1))1)19)19)19!)9!)9))1)))!)1!)1))1))1))1)19)19)19))1))1)19)19)19))1))1))1))1))1)19)19)19)19)19)19)19)19)1911911911919B19B119)19)19)1919B19B)19)19)19)19)1919B11999B99B19B119)19)19)1919B19B19B19B19B19B19B19B)19)1911911999BB9999999919B19B19B19B19B19B11911911911911919B99B9BB9BB99B19B19B19B99B9BB9BB99B99B9BB9BB9BJ9BB99B99B99B9BB9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BJ9BBBBB9BJ9BJ99B99B19B19B19B19B19B19B99B99B99B99B99B99B11911999B9BB9BB99B11999999B99B19B19B19B9BJ19J19B19B11911911919B119119))1))1))1111111111)19119119119119)19)1919B19B11911919B19B11911919B19B)1919B19B19B19B19B)19)19)19!)9!)9)19)19)19)19)19)19)19)19)19)19)19)19!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)1!)1!)1!)1!)1!)9!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1))1))1))1))1))1)19)19)19)19)19!)9))1))1!)1!)1))1))1))1))1)19)19))1))1)19)19)19)19))1))1))1)19)19)19)19)19)19)19)19)19)19)1911911919B19B)19)19)19)1919B19B)19)19)19)19)1919B119119119119)19))1)19)1919B19B19B19B19B19B19B119)19)19))111999999991911911919B19B19B19B11911911911911919B19B99B99B99B19B19B19B19B99B9BB9BB99B99B9BB9BB9BB9BB99B99B99B99B9BJ9BJ9BB9BB99B19J9BJ99B9BB9BB9BJ99B99B99B19B19B19B19B19B19B99B99B99B99B99B99B11911999B99B99B19B11911999B19B19B19B9BJ9BJ9BJ99B19B119119119119119119))1))))))111111))1))1119119119119)19)1919B19B11919B19B19B19B11919B19B)19)1919B19B19B)19)19)19)19!)9!)9)19)19)19)19)19)19)19)19)19)19)19)19!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)1!)1!)1!)1!)9!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!)1!)1!!)!!)!!)!!)!)1!)1))1))1))1))1))1)19)19)19)19)19)19)19!)9!)1))1))1!)1)19))1))1))1))1))1))1))1))1)19)19))1))1)19)19)19)19))1))1119119)19)19119119)19)19)19)19)19)19)19)19)19)19119119)19)19)19119119119119))1))1))1))1)1919B19B19B19B99B99B19B119)19)19))1111119119119)19)19)1919B19B11911919B19B)19)191191199999191191191191199199999BB9BB99B99B99B9BB9BB99B99B99B11919B9BJ9BJ9BB99B19B19B99B99B19B19B99B99B99B99B19B19B19B19B11911999B99B19B19B99B99B19B19B11911919B19B19B19B19B19B19B19B9BJ9BJ9BJ99B119119119999999119119))1))1))1111119))1))1119119119)1919B19B19B19B19B19B19B19B19B19B119)19)19)19)1919B19B)19)19)19)19)19!)9!)9)19)19)19)19)19)19)19!)9)19)19!)9!)9!)9!)9!)9!)9!)9!)9))1))1!)9!)9!)1!)1!)1!)9!)9!)9!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!)1!)1))1))1))1))1)19)19)19)19)19)19119)19)19!)9))1))1!)1!)9))1))1))1))1))1))1))1))1)19)19))1))1)19)19)19))1))1))1119119)19)19119119)19)19)19)19)19)19)19)19)19))1119119)19)19)19)19119119))1))1))1))1)19)19)1919B11911999999B999119)19)19))1))1119119)19)19)1911919B11911911919B19B)19)191199999191191191191191199199999BB9BB99B99B99B99B99B99B99B99B11919B99B99B99B11919B19B99B99B19B19B19B99B99B99B19B19B19B19B11911999B19B19B19B19B99B19B19B11911919B19B19B19B19B19B19B19B9BJ9BJ9BJ99B119119119119119119119)19))1))1119119))1))1119119)19)1919B19B19B19B19B19B19B19B19B119)19)19)19)19)19)19)19)19)19)19119)19)19)19)19)19!)9!)9)19)19)19!)9!)9!)9!)9!)9!)9!)9!)9!)9)19))1))1))1!)9!)9!)1!)1!)1!)9!)9!)1!)1!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!)1!)1!)1!)1))1))1!)9)19)19))1)19)19)19)19)19)19))1))1))1))1))1))1))1))1))1))1))1))1)19)19))1))1119119111111))1))1))1)19)19)19)19111119119)19)19)19)19)19)19))1))1))1)19)19!)9!)9)19)19)19)19!)9)19)19)19)19)19119119119119119119119)19)19)19)19)19)19)19)1919B19B119)19)19)19)19)19)191191191191191191191191191191199999BB9BB9BB99B19B11991999999B99B11911999B99B99B11911911999B99B19B19B19B19B19B11919B19B19B19B11911911919B19B19B11911919B99B99B99B11919B99B9BB99B99B11919B99B9BB9BJ19J19B119)19119119119119119))1))1111111))1))1119119)19)1911919B19B19B11911919B19B119119)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19!)9!)9!)9)19)19)19!)9!)9!)9!)9!)9!)9!)9!)9))1))1))1!)9)19)19))1))1))1))1!)1!)1!)1!!)!!)!)1!)1!)1))1))1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1))1))1!)1!)9))1))1)19)19)19)19)19))1))1))1))1))1))1))1))1))1))1))1))1))1)19)19))1))1119111111))1))1))1))1))1)19)19))1))1119119)19)19)19)19)19))1))1))1))1))1!)9!)9!)9)19)19)19!)9!)9)19)19)19)19)19)19119119119119)19)19)19)19)19)19)19)19)19)1919B19B)19)19)19)19)19)19)1911911911911911911911911911911911999B99B99B99B11911991999999999B11911999999B11911911911999B99B11911919B19B11911919B19B19B19B11911911911919B11911911999999B99B99B11999B9BB9BB9BB99B11911911919B19J19J19B119)19)19)19119119119)19))1111111))1))1119119)1911911911919B11911911919B119119119)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19!)9!)9!)9)19)19)19!)9!)9!)9)19)19!)9)19))1))1!)9!)9)19))1))1))1))1))1!)1!)1!!)!!)!!)!!)!)1!)1))1))1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)))1))1))1))1))1))1))1))1))1))1))1))1)19)19))1))1))1))1))1))1)19!)9))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1119119)19)19)19)19))1))1))1))1))1))1!)9!)9)19)19)19!)9))1))1))1))1!)1!)1)19)19)19)19)19)19)19)19)19)19)19)19))1))1)19)19)19)19)19)19)19)19)19)19)19)1911911919B19B11911911911911911999999999911911911911911911911911911911911919B19B19B19B99B99B11911911911911911911911911911919B19B11911911911911911911919B19B19B19B19B9BB9BB19B19B11911919B19B19B19B119119)19)19))1119119119119)19119119119119119119119119119119119119)19119119119119)19)19)19)19)19)19)19119)19)19)19)19)19)19)19)19)19)19!)9!)9!)9!)9!)9!)9!)9!)9)19)19)19)19)19)19!)9!)9)19)19))1))1!)1!)9!)9!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!)1!)1!)1))1))1))1))1))1))1))1))1))1))1))1))1)19)19))1))1))1))1))1))1!)9!)1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1119119)19)19)19))1))1))1))1))1))1))1!)9)19))1))1)19!)9))1))1))1))1!)1))1)19)19)19)19)19)19!)9!)9)19)19)19))1))1))1)19)19)19))1)19)19)19)19)19)19)19)1911911919B19B11911911911911911991991911911911911911911911911911911911911919B19B19B19B19B99B19B11999911911911911911911919B19B19B11911911911919B11911911919B19B19B19B9BB9BB19B19B11911919B19B19B)19119119)19)19))1119119119119)19119119119119119119119119119119119119)19)19119119)19)19)19)19)19)19)19)19)19)19!)9!)9)19)19!)9!)9)19)19)19!)9!)9!)9!)9!)9!)9!)9!)9)19)19)19)19)19!)9!)9!)9)19))1))1))1!)1!)9!)9!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1))1))1))1))1)19))1))1))1))1))1)19)19)19)19)19)19)19)19))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1111))1))1))1111))1))1))1))1))1))1)19)19)19))1))1))1)19))1))1)19)19!)1!)1))1))1))1))1))1))1!)9!)9))1))1)19)19119119)19)19!)1!)1))1))1))1))1!)1!)9)19)19111111119119)19)19)19)19)19)1911911911911911911911911911911911999911911911911911911911911911911919B19B19B19B19B19B19B19B19B99B99991919B19B19B19B19B19B19B11911911919B19B99B99B99911919B19B19B19B99B99B19B19B11911919B19B119119119119))1))1119119119119)19)1911911911911919B119119119119)19)19)19)19)19)19)19)19)19)19)19)19)19119)19)19!)9!)9)19)19)19)19!)9)19)19!)9!)9!)9)19)19)19)19!)9!)9)19)19)19)19!)9))1))1!)9!)9))1))1))1))1))1))1!)1!)1!)1!)1!)1!)1!!)!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1))1))1))1)19)19)19))1))1))1))1)19)19)19)19)19)19!)9!)1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1111111))1))1111111))1))1))1))1))1))1)19)19))1))1))1)19))1))1)19)19!)1!)1))1))1))1))1))1))1!)9!)9))1))1)19119119119119))1!)1!)1))1))1))1))1!)9!)9!)9))1111111119)19)19)19)19)19)19)1911911911911911911911911911911911911911911911911911911911911911911919B19B19B19B19B19B19B19B99B99B99911911919B19B19B19B19B11999999911919B19B19B99B11911919B19B19B19B19B119)19)1911919B19B19B119111119119))1))1119119119119)19)19)191199BB9BJ9BB19B119119)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19!)9!)9!)9)19)19)19)19!)9!)9!)9!)9!)9!)9)19)19)19)19!)9!)9)19)19)19)19!)1))1))1!)9!)1))1))1))1))1))1))1!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1))1))1)19)19)19)19))1))1))1))1))1))1)19)19)19))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1111))1))1))1111111))1))1))1))1))1))1)19)19))1))1))1))1))1))1))1))1)19)19))1))1)19)19)19!)1))1))1!)1)19))1119919919119))1!)1!)1))1))1))1))1!)9!)9!)1))1))1)19)19)19)19)19)19)19)19)19)1911911911911911911111111911911111111911911911911911911911911911919B19B19B19B19B19B11911999999999911911911911911911911991991999911911911911911919B19B19B19B19B19B119119)19)1911919B19B119)19))1)19)19)19)19))1111119119119)19))11199BJBJR9BJ9BB119119))1))1)19)19)19)19)19)19)19)19)19)19)19)19)19!)9!)9!)9!)9)19)19)19!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)1))1))1))1)19!)9!)1!)1))1))1))1))1))1))1!)1!)1!)1!)1!)1!!)!!)!!)!!)!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1))1)19)19)19)19))1))1))1))1))1))1)19)19)19))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1)19))1))1))1111111))1))1))1))1))1)19)19)19))1))1))1))1))1))1))1))1)19)19))1))1)19)19!)9!)9))1))1!)9!)9))1111919919111))1))1))1)19)19))1))1!)9!)1!)1))1)19)19)19)19)19)19)19)19)19)19)19)1911911911911911111111911911111111111911911911911911911911911911919B19B19B19B11911911999999999B11911911911911111111991999999911911911911911919B19B19B19B19B119119119)19)1919B19B19B119119))1)19)19)19)19))1))1119119119119))11199BRBJRBJRBBB119))1))1))1)19)19))1))1)19)19)19)19)19)19)19)19!)9!)9!)9!)9!)9)19)19)19)19!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)9!)1!)1!)1))1))1!)9!)9!)1))1))1))1!)1!)1))1))1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!)1!)1!)1!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1))1)19)19)19)19))1))1))1))1))1)19)19)19)19))1))1)19)19))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1111111))1))1111))1))1))1)19)19)19)19))1))1))1)19)19)19)19))1))1))1)19)19)19))1!)9!)9!)9!)9!)9)19))1111119119))1))1))1))1119119))1))1!)1!)1!)1))1))1))1111111)19)19)19!)9!)9)19)19111111111119119119119119)19)19111111111119119111111119119119)19)1911919B19B)19))111111199999999B11911911911111111111111911911911911911999B99B19B19B19B19B19B119119119)19)1919B19B19B19B119111)19)19)19))1))1))1119119119119))11199BJBJRJJJ9BB119))1)19)19)19)19)19)19)19)19)19)19)19)19))1))1!)9!)9)19)19)19)19)19)19))1))1!)9!)9!)1!)1!)1!)1))1))1!)1!)1!)1!)1))1))1!)9!)9!)1!)1))1))1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!!)!!)!)1!)1!!)!!)!)1!)1!)1!)1!)9!)9!)1!)1!)1!)1))1))1)19)19))1))1))1))1))1)19)19)19)19)19))1))1)19)19))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1)19))1111111111))1111111111))1))1)19)19)19)19))1))1)19)19)19)19)19)19))1))1))1)19))1))1)19!)9!)9!)9!)9))1))1))1119))1))1))1))1119119111))1))1!)1!)1!)1))1))1111111111119)19!)9!)9!)9)19))1))1))1111119119119119)19)19)19)19))1111119119111111119119111))1))1)1919B119))1))111111191999911911911911111111111111111911911911911911999B99B11911919B19B19B119119119)19)1919B19B19B19B119119)19)19))1))1))11111111191191191191199BBBBB9BB99B119))1)19)19)19)19)19)19)19)19)19)19)19)19))1))1)19)19)19)19)19)19)19)19))1)19)19!)9!)1!)1!)1!)1))1))1!)1!)1!)1!)1))1))1!)9!)9!)1!)1))1))1))1))1))1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!)1!!)!)1!)1!)1!)1!)9!)9!)1!)1!)1!)1))1))1))1))1!)9!)9))1))1)19)19)19)19)19)19))1))1))1))1!)1))1))1))1))1)))))1))1))1))1))))))))1))1)19)19111111111))1111111111111))1))1))1)19))1))1))1))1)19)19)19))1))1))1))1))1))1))1))1))1))1)19!)9!)9!)1!)1))1))1))1))1))1))1))1111111111))1))1!)1!)1!)1))1))1111111111119)19!)9!)9!)9)19))1))1))1))1119119119119)19)19)19)19))1))1))1))1111111119119111111)19)19)19)19111111111111119119119119111111))1)19))111911911911911911911911911911911911919B19B119119119)19)19)1911911919B19B)19)19)19))1))1111111111111119119))111911999B119119119119)19)19)19)19)19)19)19)19)19)19)19)19))1))1)19)19)19)19)19)19))1))1)19)19)19)19))1))1!)1!)9!)9!)1!)1!)1!)1!)1!)1))1))1))1!)1!)1!)1!)1!)9)19))1))1))1))1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1))1))1))1))1!)9!)9))1))1))1)19))1))1))1)19)19))1))1!)1!)1))1))1))1))1)))))1))1))1))1))))))))1))1)19)19111))1))1))1111111111))1))1))1))1))1))1))1))1))1)19)19))1))1))1))1))1))1))1))1))1))1111))1)19!)9!)1!)1))1))1))1))1))1))1))1111111))1))1))1!)1!)1!)1))1))1))1111111119)19)19)19)19))1))1))1))1))1))1119119)19)19)19)19)19))1))1))1))1111111111111111111)19)19)19111111111111111119119119119111111119)19)19119119119119119119119119119119119119119)19)19119119)19)19)19)1911919B)19)19)19))1))1))1))1111111111119119))1)19119119119119119119)19)19)19)19)19)19)19)19)19)19)19)19))1))1)19)19)19)19)19)19))1))1)19)19)19)19))1))1))1!)9!)9!)1!)1!)1!)1!)1!)1!)1))1))1!)1!)1!)1!)1!)9!)9))1))1))1))1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1))1))1!)1!)1))1))1))1))1))1))1))1))1))1))1)19!)9!)1!)1))))))))1))1))1))1111111))1))1))1))1))1))1)19))1))1)))))11111111))))1))1))1))1111111))1))1))1))1)19)19))1))1))1))1))1))1))1))1))1))1119)19))1!)1!)9!)1))1))1)19!)9!)1))1))1))1))1))1)19)19!)1!)1!)1!)1))1))1111111119)19)19))1))1111111))1))1))1))1))1)19)19)19)19)19)19))1))1119119111111111111111111)19)1911111111111111111111911911911911911911911911911911911991991911911911911911911919B19B119119)19)19)19)19)19)1919B19B)19)19)19))1))1))1))))))1))111119)19)19)19119119)19)19119119)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19!)9!)9!)9!)9)19))1))1)19)19))1))1))1))1!)1!)1!)1!)1!)1!)1!)1!)1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!)1!!)!!)))1))1!)1!)1))1))1))1))1))1))1))1))1))1))1!)9!)9!)1!)1))))))))1))1))1))1111111))1))1))1))1))1))1))1))1))1)))))1))11))1))))1))1))1))1111111))1))1))1))1)19)19))1))1))1))1))1))1))1))1))1))1)19)19))1!)1!)1!)9))1))1!)9!)9!)1!)1))1))1))1))1)19)19!)1!)1!)1!)1!)1))1))1111)19)19))1111111111111))1))1))1))1))1)19)19)19)19)19)19))1))1119119111111111111111111)19))111111111111111111111911911911911911911911911911911911991999911911911911911911919B19B119119)19)19)19)19)19)19)19)19)19))1))1))1))1))1))))))111111))1)19)19)19119119)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19)19!)9!)9!)9!)9!)9!)1))1))1))1)19))1))1))1))1!)1!)1!)1!)1!)1!)1!)1!)1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!!)!!)!!)))1))1))1))1))1))1))1))1))1!)1!)1))))))))1))1))1)))))1))1))1))1))1))1))1))1111111111))1))1))11))1)))))))1))1111111111))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1)19)19))1))1!)1!)1!)9!)9!)1!)1!)9!)1))1))1))1))1))1))1!)1!)1))1))1!)1!)1))1))1))1))1))1111111111))1))1))1111))1)19)19)19))1))1)19)19))1))1111111111111111111111111111111))1111111111))1)19)19)19119119119119119)19)1911911911911911911911919B19B119119)19)19)19)19)19)19119119119119)19)19119119))1))1))1))1))1111111))1))1)19)19)19119111111))1)19)19)19119)19)19)19!)9!)9)19))1))1)19!)9!)9)19)19)19))1))1)19)19))1))1))1))1))1))1!)1!)1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)))1))1))1))1))1))1))1))1!)1!)1))))))))1))1))))))))1))1))1))1))1))1))1)))))1111111111))))))1))1))))))))111111111111))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1)19)19))1))1))1!)1!)9!)9!)1!)1!)9!)9!)1!)1))1))1))1))1!)1!)1))1))1))1!)1))1))1))1))1111111111111))1))1111111)19)19)19))1))1))1)19)19))1))1111111111111111111111111111111))1))1111111119)19)19)19119119119119)19)19)19)1911911911911911911919B19B119119119)19)19)19))1111119119119119))1))1119119))1))1))1))1111111))1))1))1))1)19)19))1))1))1))1)19)19)19)19)19)19)19!)9!)9)19))1))1!)9!)9!)9!)9)19))1))1))1))1)19))1))1))1))1))1))1!)1!)1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)))1))1!)1!)1))1))1!)1!)1))1))1))))))))))))))))))))))))111111))1))1111))1))))))1111))))))))1))1))1))1))1))111111111111111111111111111))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1)19)19)19)19)19!)9!)9!)1!)1!)1!)1!)1!)9!)9)19))1))1))1!)1))1))1))1111111111111111111111111111))1)19))1))1))1))1)19)19))1))1))1111919919111111111111111111111111))1111119119119119119119119)19)19)19)19)19119119119119119119119119)19)19119119)19)19119119119119111))1)19)19119119))1))1))1))1111))1))1))1))1))1))1))1)19!)9!)9)19)19)19)19)19)19)19)19)19)19)19)19!)1!)1!)1!)9!)9!)1!)1))1))1))1))1)19!)9!)1!)1!)1!)1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)9!)1!)1!!)!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!)1))1))1!)1))1))1))1))1!)1))1))1)))))))))))))))))))))))1111111))1))1111))1))))))1))1)))!!1))1))1))1))1))1))1))111111111111111111111))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1)19)19)19)19)19)19)19!)1!)1!)1!)1!)1!)1!)9!)9)19))1))1))1))1))1))1111111111111111111111111111111))1))1))1))1))1))1)19))1))1))1))1111919919111111111111111111111111))1)19119119119119119119)19)19)19)19)19)19119119119119119119119119)19)19119119119)19119119119119))1))1)19)19119))1))1))1))1))1))1))1))1))1))1))1))1!)1!)9!)9!)9)19)19)19!)9!)9)19)19)19)19)19)19!)9!)9!)1!)1!)9!)9!)1!)1))1))1))1))1!)9!)9!)1!)1!)1!)1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)9!)1!)1!!)!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1))1))1))1))1))1))1))1)))))))))))))))))))))))))))))1))1))1111119))1))1))))))1))1111)))!!1))1))1))1))1))1))1)))))))1111111111111))1))1))1))1))1))1))1))1))1))1))1))1))1))1)19)19)19)19)19)19)19))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1111111111111919919111111))1))1111111))1))1))1))1))1))1))1111111111111111111111111111111111111111))1)19119119111111119)19)19))1)19)19)19)19119119119119119))1))1))1)19)19)19119119119119))1))1))1))1))1))1)19))1))1))1))1))1))1))1))1))1))1))1))1!)1!)1!)9!)9)19)19)19)19))1))1!)9)19)19))1))1))1!)9!)9))1))1!)9!)9))1))1!)9!)9!)1))1))1))1))1))1!)1!)1))1))1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1))1))1))1))1))1))1))))))))))))))))))))))))))))))))1))1))1))1))1))1))1)))1))1))1))1)))))1))1))1))1))1))1))1))))))))111111111111))1))1))1))1))1))1))1))1))1))1))1))1))1))1)19)19)19)19)19)19))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1111111111111111111111919919111))1))1111111111111))1))1))1))1))1111111111111111111111111111111111111111111)19)19119111111111)19)19))1))1)19)19)19119119119119119))1))1))1))1)19)19)19)19119119))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1!)1!)9)19))1))1!)9!)9))1))1!)1)19)19))1))1))1!)9!)9))1))1!)9!)9))1))1!)9!)9!)1!)1))1))1))1))1!)1!)1))1))1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!!)!)1!)1!)1))1))1!)1!)1))1))1))1!)1!)1!)1!!))))))))!))!)))))))))))!))))))1))1))1))1))1)))))11111111))1))1))1))1)))))))))))1))1))1))1))1))1))111111111))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1)19)19)19)19))1))1))1))1))1)19)19))1))1))1))1))1!)1!)1!)1))11119119119))1))111111111111))1))11111111))1))1111111111111111111111111))1))111111111111111111111111111111)19)19111111111))1)19)19))1))1119119119119111111111))1))1))1)19)19)19)19)19)19)19)19))1))1))1))1)19)19111111)19)19))1))1!)1!)1))1))1))1))1))1))1))1))1!)9!)9))1))1!)9!)9))1))1))1)19)19)19))1))1!)9!)9)19)19!)9!)9))1))1!)1!)1!)1!)1!)1!)1!)9!)9!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!)1!)1!)9!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!)1!)1))1))1!)1!)1))1))1!)1!)1!)1!)1!!)!!))!))!))!))!))))))))!))!)))1))1))1))1))))))1111111111))1))1))1))111)))))))))1))1))1))1))1))1))1))111))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1)19)19))1))1))1))1))1))1)19)19))1))1))1))1!)1!)1!)1!)1))1111B91B919))1))111111111111))1))11111111))9))111111111111111111111111111111111111111111111111111111111111))1111111111))1))1)19)19))1))1119119119111111111))1))1))1))1)19)19)19)19)19)19)19)19))1))1))1))1)19)19111111119)19))1))1!)1!)1))1))1))1))1))1))1))1)19)19!)1))1))1!)1!)9))1111111))1!)9!)9))1))1!)9!)9)19)19)19!)1))1))1))1!)1!)1!)1!)1!)1!)9!)9!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!)1!)1!)9!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!)1!)1))1))1!!)!!)!)1))1))1))1))1))1)))))))!))!))!))!))!))!))!))!)111111))1)))))))))1))1111111)))!!)!!1))1))1))1))1))1))1))1))1))1))1))111))))))))1))1))1))1111111))1))1))1))1))1))1))1))1)19)19))1))1))1))1))1))1))1))1))1))1!)1!)1!)1!)1))1))1))1))1))1111911B919))1))9111111111111111111111119))9))9119111111111111111111119119111111111))1))111111111111111111111111111))1))1))1119119))1))1111111111111111))1)19)19))1))1))1))1)19)19111111))1)19))1))1))1))1))1))1))1111119119))1))1!)1!)1!)1!)1!)9!)9))1))1)19!)9!)1!)1!)1!)1!)1))1))1111111))1!)9!)9))1))1!)9!)9)19))1))1))1))1))1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!!)!!)!!)!!)!!)!)1!)1!)1))1))1)))!!)!)1!)1))1))1))1))1)))))))!))!))!))!))!))!))!))))111111)))))))))))))))1))1))1)))!!)!!1))1))1))1))1))1))1111))1))1))1))1))))))))))1))1))1111111111))1))1))1))1))1))1))1))1)19)19))1))1))1))1))1))1))1))1))1))1!)1!)1!)1))1))1))1))1))11111119119111111119119111111111111111111))9))9))9111111111111111111111119119111111111))1))111111111111111111111111))1))1))1))1119119))1))1111111111111))1)19)19)19))1))1))1)19)19)19111111))1))1))1))1))1))1))1))1))1)19119119))1))1!)1!)1!)1!)1!)9!)9))1))1!)9!)9!)1!)1!)9!)9!)1))1))1))1))1)19!)9)19))1)19!)9!)9)19))1))1))1))1))1))1))1!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!!)!!)!!)!)1!)1!)1!)1!)1))1))))))!)1!)1))1))1))1!!)!!)))))!))!))!))!))!))!)))))))))1))1))))))))1))))))1))1))1)))!!)!!1))111111111))))))1111))1))1))1))1))))1))1))1)))111111))1))1))1))1))1))1!)1!)1))1))1))1))1))1))1))1))1))1))1))1))1))1))1)))))))))))1))1))1))1))1111111111111111111911911111111))1))11111))9))9))1111111111119119111111111111111111111111111111111))1))111111111))1))1))1))1))1))1))1))1))1))1))1))1))1)19)19)19))1))1))1)19)19)19)19))1))1))1))1))1))1))1))1))1))1))1)19119))1))1))1!)1!)1))1))1))1))1))1))1))1))1!)1!)9!)9!)9!)9!)1))1))1)19!)9))1))1)19)19!)9!)9!)9)19!)9))1))1))1))1!)1!)1!)1!)9!)9!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1))))))!)1!)1))1))1!!)!!)!!)!!))!))!))!))!))!))!)))))))))))))))))))))))))))))))1))1)))!!)!!1))111111))1))))))1))1))1))1))1))))))))))1))))))111111))1))1))1))1))1))1!)1!)1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))))))))))))))1))1))1))1))1111111111111111911911111111))11111))9))9))9))1111111111119119111111111111111111111111111111111))1))111))1))1))1))1))1))1))1))1))1))1))1))1)19)19)19)19)19))1))1))1))1)19)19)19)19))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1))1!)1!)1))1))1))1))1))1))1))1))1!)1!)9!)9!)9!)9!)1))1))1!)9)19))1))1!)9!)9!)9!)9!)9!)9!)9!)1))1))1!)1!)1!)1!)1!)9!)9!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!!!!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!!)!!)!!)!!)!!)!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!))!))!))!))!))!)))))))))))))))))!!)))))))))))))!!)!!)))1))1)))))))))))1)))))1))1))1))1))))))))))1))))))111111111))1))1))1))1!!)!!)!)1))1))1))1))1))1))1))1))1!)1!)1))1))1))1))1111111))))))!)1))1))1111)))))1))11111111))1))1111111111111111))9))9))9))1111111111111111111))1))111111111111111111))1)))1))1)))))))1))1))1))1))1))1))1))1))1))1))1)19)19)19)19111111))1))1111111))1))1))1))1))1))1))1))1))1))1))1))1)))))1))1))1))1)))!!)!!))!))!))))!)1!)1))1))1))1))1!)1!)1!)1!)1!)1))1))1!)1))1))1))1))1))1!)9!)9!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!!!!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!))!))!))!))!))!))!))!!)!!)!!)!!)!!)!!)!!))))))))))!!)!!)!!)))1))1))))))))1))1)))!!)!!1))1)))!!)))))))))))))))111111111111))1))1!!)!!)!!)!!)))1))1))1))1))1))1))1))1!)1!)1))1))1))1))1111111))))))!)1))1111111))))))))11111))1))1))1))1111111111111))9))9))9))1111111111111111111))1))111111111111111111))))))1))1))))))))))1))1))1))1))1))1))1))1))1))1)19)19)19)19111111))1))1111111))1))1))1))1))1))1))1))1))1))1))1))1))))))))1))1))))))!!)!!))!))!)!!)!!)!)1!)1))1))1!)1!)1!)1!)1!)1!)1))1))1!)1))1))1))1))1))1!)9!)9!)1!)1!)1!)1!)1!)1!!)!!)!)1!)1!)1!)1!)1!)1!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!)1!)1!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!!!!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!)!!) \ No newline at end of file diff --git a/sdk/media/tex6.ppm b/sdk/media/tex6.ppm new file mode 100644 index 0000000..525a5ac Binary files /dev/null and b/sdk/media/tex6.ppm differ diff --git a/sdk/media/tex7.ppm b/sdk/media/tex7.ppm new file mode 100644 index 0000000..599b6a7 Binary files /dev/null and b/sdk/media/tex7.ppm differ diff --git a/sdk/media/throw.wav b/sdk/media/throw.wav new file mode 100644 index 0000000..87cd36d Binary files /dev/null and b/sdk/media/throw.wav differ diff --git a/sdk/media/torus.x b/sdk/media/torus.x new file mode 100644 index 0000000..29b725f Binary files /dev/null and b/sdk/media/torus.x differ diff --git a/sdk/media/tpot0.x b/sdk/media/tpot0.x new file mode 100644 index 0000000..d559ce5 Binary files /dev/null and b/sdk/media/tpot0.x differ diff --git a/sdk/media/tpot1.x b/sdk/media/tpot1.x new file mode 100644 index 0000000..00cb304 Binary files /dev/null and b/sdk/media/tpot1.x differ diff --git a/sdk/media/tpot2.x b/sdk/media/tpot2.x new file mode 100644 index 0000000..c656588 Binary files /dev/null and b/sdk/media/tpot2.x differ diff --git a/sdk/media/tpot3.x b/sdk/media/tpot3.x new file mode 100644 index 0000000..2527a99 Binary files /dev/null and b/sdk/media/tpot3.x differ diff --git a/sdk/media/tree.x b/sdk/media/tree.x new file mode 100644 index 0000000..ee2a57f Binary files /dev/null and b/sdk/media/tree.x differ diff --git a/sdk/media/walk.wav b/sdk/media/walk.wav new file mode 100644 index 0000000..468fbfc Binary files /dev/null and b/sdk/media/walk.wav differ diff --git a/sdk/media/win95.ppm b/sdk/media/win95.ppm new file mode 100644 index 0000000..5d39845 --- /dev/null +++ b/sdk/media/win95.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +256 256 +255 +���ք��{�ք�ތ���{�ޔ�猵�{�ޔ�焵ތ��{�ތ���ބ�ބ�ޜ�ބ�ޔ�甽ޜ�������������������眽ޘ�֔�猽�{�ތ���s��s��s�ք��s��{��{��{��{��{�ބ�ޔ���眽ޥ�����֜�ޜ���甽���ޔ�ތ�ք�ބ�ތ�ބ�ތ�ތ��{��s��ބ�ތ��{�ތ�ޔ�ތ�ތ�ބ�ބ�ތ��{��{��{��{�Ό��֜�甽ޥ���������������������������������������������������������������������������������������������������������������ޔ�甽ތ�ބ�ބ��{�ތ��ތ�ތ�ބ�ތ�ބ��{�ޔ�猵�{��{��{��{�ބ��{��s��{��{��s��{��s�ք��s���{��s�ք�ބ��{�ބ�ތ�ތ�֘�֘�֜���������ޥ���������������������������������������������������������������������������������������������������������������������������������������������������ޜ���甽ޔ�猽ބ��{��{��s��s��{��s��s��s��{��s��s��{��{��{��{�ތ��ބ�ބ�ތ��{��{�ތ��{�ބ�ބ�ބ�ތ�ތ�ޔ�猽�{�ބ�ބ�ޔ�ޘ�֜�ޥ������������������ޘ�֔�甽猵ތ�ތ��{��{��s�ք��{�ބ��s��s��{��{��{�ތ�ޔ�������ޥ���������甽甽ޔ�猽�{�ބ�ބ�ބ�ތ�ބ��{��{�ތ�ތ�猽�ބ�ބ�ޔ�甽�{��{�ބ��s�ք��{��s�猵�ތ�ޘ�֜��������������������������������������������������������������������������������������������������������ޥ�������ޜ�ޜ�ޔ�ތ�ތ�ތ�ތ�ތ�ބ�ތ�ތ�֔�焽ބ��{�ތ�ބ��{�ք��{��{�ބ�ބ��s��{��{��{��{��{��{�ބ�Ό�ք���s��s��{�ބ�ޔ�甽ޘ�֜���ޥ�����������ޥ����������������������������������������������������������������������������������������������������������������������������������������������甽甽猽ޔ��{��{��s��{��{��s��s��s��s��s��s��s��{��{��{�ތ�ތ�ބ�ތ��猽焽ޔ�猽�{�ތ�ބ�ތ�ބ�ބ�ބ��{��{�ތ�ބ�ޔ�猵ޘ�֘�֜�ޥ���������������֜�ޔ�ބ�ތ�ތ�ތ�ޔ��{�ބ��{��{��{�ބ��{��{��s�ք�ތ�ޜ�����������������ޜ���猽ތ�ޔ�ތ�ތ��ބ�ބ�ތ�ތ�ތ�猵ތ�ތ�ބ�ޔ�ބ�ތ�֔�猽焵�{�ބ��{�ބ�ބ�ތ��ޔ�������������ޥ��������������������������������������������������������������������������������������������������������֔�猵ތ�ބ�ބ�ޔ�焵ތ�ތ�ޔ�ތ��ތ��{�ބ�ބ��{��s��{��{�ބ��{��{��s��{�ބ��{��{��{��{�ބ�΄��{��{�ބ�ބ�ބ��{�ޔ�����������������������������������������������������������������������������������������������������������������������������������������������������������甽焵ތ�猵ތ�ޔ��{��{��s��{��{��{��s��{��{��s��s��s��s��s�΄�ތ�焵ބ��{�ތ�ބ�ތ�ތ�ތ�ބ�ތ�ތ�ތ�ބ�ބ�ޔ�焵ތ�ތ�ބ�ޔ�甽ޘ�֘�֘�֥���������甽ޔ�ޜ�甽甽ތ�ބ�ބ�ބ�ބ�ބ��{��{�ބ�΄��{��{�ބ��s��ތ�ޘ�֜�������������������甽ޔ�猽ތ�ބ�ތ�ތ�ތ�ތ�ބ�ބ�ބ�ތ�ބ�ތ�ތ�ބ�ބ�ޔ�焵�{�ބ��{��{��{�ބ�ބ�ބ�ޔ�ޜ�ޥ��������������������������������������������������������������������������������������������������������ޜ�����������֔�ބ�ބ�ތ�ބ�ތ�ތ�猽ތ�ތ�ތ�ތ�ތ��{��{��{��{��{�ބ��{��{��{��s��{��{�ބ�ތ�ք��s��{�ބ��{�ބ�ބ��{�ތ�֔�猽ޔ�眽ޥ�������������������������������������������������������������������������������������������������������������������������������������������������������ޔ�ޔ�猵ތ�ބ��{��s��{��s��s��s��s��s��{��s��{��s��{��s��{�ք�ތ�ބ�ބ�ބ�ބ�ބ�ބ�ޔ�猽猽�{�ބ�ތ�ބ�ބ�ތ�ތ�猵�ތ�猽ޔ�甽ޜ���ޜ���֜���ޔ�ޘ�֔�甽ޔ�ތ�ބ�ތ�焵ބ��{�ބ�ބ��{��{��{�ބ��{��s��{��ޔ�����������������������甽ޜ�ޔ�ޔ�猽ތ�ޔ�ބ�ތ�焽ތ�ޔ�猽ތ�ބ�ބ�ބ��{�ތ�ބ�ބ��{��{�ބ��{��{��{�ք�ޔ�ޜ����������������������������������������������������������������������������������������������������������������������甽ތ�ބ�ބ�ޔ�ތ�ބ�ތ�ތ�ތ�ތ�ބ�ބ��{��{��{��{��{��{��{��{��{��s��{��{��{��{��{��{�ބ��{�ބ��{��s�ք�ތ�֔�猽ޔ������������������������������������������������������������������������������������������������������������������������������������������������������������ޜ�猵ބ��{��{�ބ��s��{��{��{��{��s��{��{��{��s��{��s��s��s�ք�ތ�ބ�ތ�ބ�ބ�ބ�ބ�ތ�猽ތ��{�ބ�ތ�焽ތ�ތ��ބ�ތ��ތ�电┽ޔ�甽ޔ���甽ތ�ޔ���甽ޔ�ޔ�ބ�ތ�ބ�ބ�ތ�猵�{��{��{�ބ��{�ތ��{�ބ��{�ތ�֔�ޘ�֜�ޜ�����������������ޜ�ތ�֔�猽ތ�ޔ�猽ތ�ތ��ބ�ބ�ބ�ތ�ތ�ތ�ތ��ތ�ބ�ބ��{��{�ބ��s�ք�ބ�ތ�֘�֜���������������������������������������������������������������������������������������������������������������������ޘ��猽ތ�ބ�ބ�ބ�ބ�ތ�焵ބ�ބ�ތ�ތ��{�ބ��{��{�ބ��{�ބ��{��{��s��{��{��s��{��{��{��s��{��{��{�ބ��{�ތ�ބ�ޔ�����ޥ�ޠ�������ޥ���ޫ��������������������������������������������������������������������������������������������������������������������������������������������✽ބ��{�ބ��{��{��{��s��{��s��s��s��s��{��s��{��{��{��{��{�΄�ތ��{�ތ�ބ�ތ�焵ތ�焽ބ�ތ�猽ބ�ބ�ބ�ބ�ޔ�猵ތ�ތ�ތ�ތ�ޔ�ޔ�ޜ�ޔ�猽ޔ�猽ޔ�猽ތ�ތ�֔�ބ�ބ�ބ��{�ބ�ތ�ք�ބ��{��{��{�ބ��{��{�ބ�΄�ތ�ތ�ޜ�ޜ���ޜ�������������甽ތ�焵ބ�ތ�ޔ�ޔ�ތ�ތ�焭ތ�ތ�ތ�焽�{�ތ�ތ��{��{��{�ބ��{�ք�ބ��s��{��s�ք�ބ�ޜ�ޠ����������������������������������������������������������������������������������������������������������������������֔�电┽ތ��{�ތ�ތ�ބ�ބ�ބ�ބ�ތ�ބ�ތ�猵�{��{��{��{��s�ք�ބ�ބ��{��{��{��s��s�ք��s��{��{��{��{��{�ބ��{��{��{�ތ�ޔ�ޜ�ޜ�������ޥ���֜�����������������������������������������������������������������������������������������������������������������������������������������������ބ��{��{��{��{��s��s��{��s��{��s��s��s��s��s��s��{��s��{���{�ބ�ބ�ބ�ޔ�ތ�ޔ�猽ތ��{�ތ��{�ބ�ތ�甽甽猽ތ�ތ�ތ�眽ޜ�ތ�ޔ�ތ�ޔ�猽��{�ތ�ތ�ޔ�ތ��焵ތ��{�ބ�ބ��{��{��s��{��{�ք�ތ��{��{�ތ���ޔ���֥���������������֔�ތ���ތ�ޔ���ޔ�猽ތ�ތ�ք�ތ�ք�ތ�ք�ތ�ތ�ތ�ޔ��{�ތ�焵ބ��{�ބ��{��{�ބ�ޔ�ޥ�ޫ���������������������������������������������������������������������������������������������������������������ޔ���֥�疷ք�ޔ�猽ތ�ތ�ތ�ތ��{�ބ�ބ��{�ތ��{�ތ��{��{��{�ބ��{�ތ��{��{��{��{��{��s��{��{��s��{��{��{��s��{��{�ތ�猵֔�猵֔�ޔ�ޔ�ޔ�ޜ���֘�֜�����������������������������������������������������������������������������������������������������������������������������������������������甽ބ��{��{�ތ��{��{��{��s��{��{��s��s��s��{��s��s��s��{��s���{�ބ�ތ�ބ�ބ�ބ�ޔ�猵�{��{�ޔ��{�ބ�ތ�甽ޔ�ޔ�ޔ�猽ޘ�֔�ޔ�猵�{�ތ��{�ބ�ބ�ތ�ބ�ޔ��{�ތ�ތ�ք�ތ�ބ�ތ�ތ��s���{�ބ�ބ�ބ��{��{��{��{�΄�ބ�ޔ�ތ�ޜ���ޥ���������֔�焽ތ�ތ��ތ�甽ޜ�猽ޔ�猽ތ��{�ބ�ބ�ތ�ތ��{��{��{�ޔ��{�ބ��{�ބ��{��{�ތ��{�ޔ�ޔ�ޜ�ޫ�������������������������������������������������������������������������������������������������������������眽ޜ�甽ޔ�ތ�ތ�ޔ�焵ޔ��{��{�ތ���{�ބ�ބ��{�ޔ��{��{��s��{��s�焽�s��{��{��{��s��s�ք��s��{��{��{��s��{��{��{��{��{��s��{�ޘ��֜�ޜ�甽ޔ�����֥�������������������������������������������������������������������������������������������������������������������������������������������֜�焽�{��{��{�ތ��{��{��{��s��s��s��{��s��s��{��s��s��s��s��s�֔��{�ތ�ބ�ތ�焵ތ�ք�ތ��{�ޔ�猵ބ�ތ�ޔ�猵֔�ޘ�֘�֔�ޔ�ޔ�甽ތ�ޔ��{�ބ�ތ�ޔ�猵�ތ���ք��{�ބ�ބ�ބ�ތ��{�ތ��{�ބ�ތ��{��{��{��{��s��{�ބ��{��{�ތ�ޔ�甽ޜ���甽猽ތ�ތ��s���{�ބ�ބ�ތ��猽ތ�֔�猽ތ�ք�ބ�ބ�ތ��{�ތ�ބ��{�ބ�ތ�ބ�ބ��s�֔�甽甽�������������������������������������������������������������������������������������������������������������������ޜ�ޜ�ޜ�ތ�ތ�猽ތ�ք��{��{��{��{�΄�ބ�΄�ބ��{��{��{��{��{��s��s��{��{��s��{��{�ބ��{��{�ބ��{��{��s��{��{��s��{��s��ތ��֔�ތ�ތ�֔�ޔ�������֜�����������������������������������������������������������������������������������������������������������������������������������������������{��s��{��s��s��s��s��s��s��{��s��{��s��s��s��s��s��{��s��{�Ό�焵ތ�ބ�ބ�ތ��ބ�ތ�猽�ތ��֔�ޔ�ތ�ބ�ޔ�ޜ�ޔ�ތ�甽猽�ތ�ތ�ތ�猵ތ�ބ��{�ތ�ք�ތ�ք�ބ�ބ�ބ�ތ�ބ��{�ք�ތ�电ℽބ��s��{��{��{��{��s�ք��{�ތ��{�ތ�ޔ�ތ�ޔ�焽ބ�ތ�ބ��{��{�ތ��焵ބ��{�ބ�ބ�ބ�ބ�ބ�ބ�ބ�ތ�ބ��{�ތ�ބ��{�ք�ބ��{�ތ�ތ�ތ�ޘ�֜���������������������������������������������������������������������������������������������������������������������֔�ޜ�ޘ��ތ�ތ�ބ�ތ�ބ�ބ��{�ތ��{��{��ބ��{��{�ބ��{�ބ��{�ބ��{��s��{��{�ތ��{�ތ��{��{��{��{�ք��s��s��{��{��{�ބ��{��{�ބ�ތ�ތ�ޔ�┽ޔ�甽����������������������������������������������������������������������������������������������������������������������������������������������ޜ�猽�{��{��s��{��s��s��s��{��{��{��{��s��{��{��{��s��{��{��{�ތ�ք�ބ�ތ�ތ�ބ�ބ�ތ�猵ք�ތ�ޔ�甽ތ�ޔ�ޔ���猵ޔ�ޔ�ތ�ޔ�甽ތ�ބ�ތ��{�ބ�ބ�ބ�ބ�ބ�ތ�ք�ބ�ބ�ބ�ތ�ބ��{�ޔ�ތ�ޜ�ޔ�焽ބ��{��{��{��{��{�ބ��{�ބ�ބ�ބ�ބ�ބ��{��{��{��{��{�ތ��{��s��{�ބ��{�ތ�焽ތ�ބ��{��ތ��ބ�ބ�ބ�ތ�ތ�焵ބ�ތ�ތ�ބ�ބ�ތ�֔�甽�����������������������������������������������������������������������������������������������������������������������ޜ�ޔ�ޔ�ތ�ބ�ބ�ތ�ތ�ބ�ބ��{�ބ�ބ�ބ�΄�ބ��{���{�ބ��{��{��{��{��s��{�ތ��{�ބ��{��{�ބ�ބ��{��{��{��{�ք��{��{��{��{��{�ބ�ތ�ք�ތ�ޔ�ޔ�甽��������ޫ�������������������������������������������������������������������������������������������������������������������������������������甽焵�{��{��{��s��{��{��s��{��{��s��{��{��{��s��s��{��s��s��s�֔�猽ޔ�甽ޔ�ބ�ބ�ބ�ތ��{�ތ�甽ތ�ޔ���甽ތ�ޔ�ޔ�ޔ�ޔ�甽ތ�ք�ތ��{�ތ��{�ބ�ބ�ތ�ބ��{�ތ�ބ�ތ�ބ�ތ�ތ�甽��֥���甽ބ�ތ�ք�ބ��{�ބ�ބ��{��{��{��{��{��s��s�ք��{��s��{��s�焵ބ��{�ބ�ބ��{�ތ�ބ�ތ��{�ބ�ތ�ބ�ބ�ބ�ބ�ތ�ޔ�焵ބ�ބ��{�ބ�ތ��{�ք�ތ�ޜ�ޥ������������������������������������������������������������������������������������������������������������������眽ޜ�ޜ�甽甽ތ�ޔ�ބ�ތ�焵ތ�ބ�ބ�ބ�ބ�ބ�ބ�ތ��{��{��{��{�ބ��{�ބ��{�ބ�ބ�ބ��{��{�ބ��{�ބ��{��{��{��s��{��{��{��{�ބ�ބ��{�ބ�ތ�ބ�ބ�ޔ�ޔ�甽�������������������������������������������������������������������������������������������������������������������������������������������댵�s��{��s��{��s��s��{��s��s��{��{��s��s��s��s��{��s��{��{��s��ޔ�ތ�ތ�ބ�ޔ�猽ތ��ތ�ތ�ތ�ޔ�猽ޔ���ތ�֔�ތ�ޔ�ތ�ޔ�ބ�ތ�ބ�ތ�ތ�ތ��{��{�ބ�ބ�ބ�ބ�ބ�ބ�ބ�ބ�ތ�����������ք��{�ք�ބ��{��{��{��s��s��{��s��s��{��{��{��{�ބ�ބ��s��{�ބ�ބ��{�ބ��{��{�ބ�ބ�ތ��ք�ބ�ބ�ބ�ބ�ބ�ޔ�猵ބ�ބ�ތ��{��{�ބ�ތ��ޔ�ޥ��������������������������������������������������������������������������������������������������������������������֜���ޔ�焵ތ��֔�ތ�ބ�ތ�ք�ބ��{�ބ�ތ�ބ��{�ބ�ބ�ބ��{�ތ�ք��{�ބ��{��s�焵�{��{��{�ބ��{�ք�ބ�ބ�ބ��{�ބ�ބ��{��{�ބ�΄�ބ�ބ�ބ�ތ�ތ�ޘ�֜�ޥ��������������������������������������������������������������������������������������������������������������������������������������������焵�s��s��{��s��s��{��{��{��s��s��s��s��s��{��{��{��s��{��{��{�֘�֔���猽猽ޔ�ޔ�甽甽ތ�ޔ�焽ތ�ޔ�猽ޔ�ތ�֔�ތ�ޔ�ޔ�甽甽猵�{��{�ބ��{�ބ�ބ�ބ��{��{��{�ތ��{�ތ�ޔ�ޥ���������甽焽ތ��{��{��{��{�ބ��s��{��{��{��s��{��{��{��{�ބ��{�ތ��{��{��{�ք��{��{�ք�ބ�ތ���{�ބ�ތ�ބ�ބ��{�ބ��{�ބ�ތ�ބ�ބ�ތ��{�ޔ�猽ޜ�����������������������������������������������������������������������������������������������������������������������甽ތ�ތ�ތ�ޔ�甽猽֜�ޔ�ބ�ބ��{�ތ�ތ�ތ�ք�ތ��{��{��s���{�ތ��{��{��{��{��{��{�ބ��s��{��{��{��{��{�ބ��{��{��{��{��{�ބ�ތ�甽猽ތ�֔�ޜ�眽ޫ����������������������������������������������������������������������������������������������������������������������������������������������ތ��s��s��s��s��s��s��s��s��s��s��s��s��{��s��{��{��s��{��s��{�֔�ތ�֔�甽甽ޔ�焵ބ�ތ��{�ތ�ތ�猽ޔ�ޔ�ޜ�疷�焵ޔ�ބ�ތ�ތ���ތ�ք�ބ�ބ�ތ��{�ތ��{��{�ބ�ބ�ޜ�ޥ�������������⌽ތ��{�ބ��s��{��{��{��{��{��s��{��{��s��s�ք��{��{��{��{��s��s���{��{�ބ��{��{�ތ��ք��{�ތ�ތ�ތ��{��{��{�ތ�ތ�ތ��{��{�ތ�֔����������������������������������������������������������������������������������������������������������������������֜�甽ތ�֔�甽ޔ�ޔ�猵֜�ޔ�ޔ�ޔ�猽ތ�ޔ�猵�{�ބ�ބ�ބ�ތ��{���{��{�ބ��{��{��{��{��{��{�ބ��{��{�ތ�焽ތ�ք��{�ބ�ބ��{�ތ�ތ�ޔ��{�ބ�ޔ���ޜ�ޘ�֫���������������������������������������������������������������������������������������������������������������������������������������֭�ޥ���焵�{��{��{��s��s��s��s�ք��s��{��{��s��s��s��s��s��s��{��{��{�ތ��ޔ�┽猽ތ�ޔ�ތ��{�ތ�ތ�甽��ތ�ޔ���甽甽甽猽֔�ޔ�焽ޔ�甽猽�{�ބ�ބ��{��{�ތ��{�ތ�ք�ޔ�������������甽��甽ބ��{��{��{��{��{��s��s��s��s��s��{��{�ބ��{��{�ބ��s��{��{��{��{�ބ��{��{�ބ��{���ք��{�ޔ�ބ��{��{��{�ތ�ք�ބ��{����ޔ�ޥ�������������������������������������������������������������������������������������������������������������֔�ޜ���ޜ���֜����֘�֜�ޔ�ޜ�ޔ�ޔ�猽֔�ޔ��{��{��{��{�ք��s��{��s��{�ބ��{�ބ��{��{�ތ��{��{�ބ�ބ�ބ�ތ�ޔ��{��{�ޔ�焵�{��{��{�ތ���{�ޜ�甽��֜�����������������������������������������������������������������������������������������������������������������������������������������┽������甽�{��{��{��s��s��{��{��{��s��s��{��s��{��s��s��s��s��s��s��{��s�֥�����ޔ�甽ތ�ޔ�甽甽�{�ޜ�ޔ�甽ތ�ތ�ތ�ޜ�ޜ�猽ތ�ތ��{��ތ�ތ��{�ބ�ބ�ބ�ބ�ތ�猭�{��{�ބ�ޥ������������֘�ք�ބ�ބ��{��{��{��{�ބ��{��s��s��{��{��{��s��{��s��s�ք��{��{��s���{�ތ��{�ތ�ք�ތ���{�ބ�ބ�ތ�ތ�猽��{�ތ��ތ�ބ�ބ�ބ�ޔ�ޔ���ޥ���������������������������������������������������������������������������������������������������������������֜�ޔ�ތ�ޔ�ޘ�֖�֔���֔�����猽ތ�ތ�ތ��{��{�ތ��{��{��s���s���{��{��{�ބ��s�猽ք�ք�ބ�ބ�ބ�ތ�ތ�ތ�ޔ�焽ތ��{�ތ�ބ�ތ�֔���������������������������������������������������������������������������������������������������������������������������������������������������ޜ�ޥ����{��s��s��s�ք��{��{��{��{��s��s��s��s��{��{��{��s��s��{��{��{��s�֜�ޜ�甽ޔ�ޔ�甽甽ތ��{�ތ�ތ�ޔ�ތ�ތ�ޔ�甽ޔ�ތ�ք�ޔ�ތ�猽�{�ތ�ތ��ބ�ބ�ތ�ބ�ބ�ބ�ޔ�猽ތ�ޜ������������甽ތ�ތ��ބ��{��{��{��{��{��s��{��s��{��s��s��s��{��{��{��{�ބ��{��s��{��{��s��s��{��{�ބ�ތ��{��{�ބ��{�ތ��{�ތ��{��{�ބ��{�ބ�ތ�ތ�ޘ�֥����������������������������������������������������������������������������������������������������������������������甽甽甽甽猽ތ�ޔ�甽ޜ�ޘ�֔�ޜ�猽ތ��{��{��{�ބ��{��{��{��{��{��{�ބ��s��{��{��{�ބ��{�ތ�ތ�ބ�ތ�ޜ�ޔ�焵ތ�猽ބ�ތ�ބ�ޔ�猵ޔ������������������������������������������������������������������������������������������������������������������������������������������������甽电�{��{��s��s��s��s��s��{��{�ބ��s��{��{��{��s��{��s��s��{��s��{��s��s�֜�ޜ�ޔ�甽ޔ�ޔ�ޘ�֔�甽甽猽ތ�ޔ�猽ތ�ތ�ޔ�猵ޔ�猽ތ�ތ�ތ�ބ�ތ��ތ�ބ�ބ��{�ބ�ބ�ތ�ތ�ޔ�ޥ������������猽猽ތ�ބ��{��{��{��{��{��{��{��{��{��s��{��s��{��s��{��{��{��{�ބ��{��{��{�ބ�ބ��{��{�ބ�ބ�ތ��ތ�ބ�ބ�ތ�ބ��{��{��{�ބ�ތ��ތ�ޜ�ޥ���������������������������������������������������������������������������������������������������������������������֔�ޔ�甽甽ޔ�猵ޔ�猽甽ޜ�甽ޔ���猽ބ�ތ�ބ��{�ބ��{�ބ��{��{�ބ�ބ��{�ބ��{�ބ��{�ތ�ތ�ތ�ތ�ޔ�ޔ�焵ތ�焵ތ�ތ�ތ�ތ�ބ�ތ��ޜ�ޜ���眽ޜ�ޥ�������������������������������������������������������������������������������������������������������������������������������������ޥ�甽猽�{��s��{��s��s��s��s��s��{��s��s��s��s��s��s��s��{��{��s��s��{��s��{�ޥ���甽ޜ�ޘ�֔�甽ތ�ޜ�ޔ�ޔ�ޔ�ޔ�甽ޔ�甽ބ�ޔ�ބ�ތ�ތ�ޔ�ތ�猵֔�ބ�ތ�ք�ބ�ތ�ބ�ބ�ތ�ތ�ޘ�֥���������딽ޔ�ތ�ބ�ބ�ބ��{�ބ��s�ք��{��{��s��{�ބ��s��s��s��{��s��{��{��{��{�ބ��{�ބ��{��{��{��{��{�ބ�ބ��{�ތ�ބ�ބ�ބ�ބ�ތ��{��{�ތ��ޔ�ޜ����������������������������������������������������������������������������������������������������������������������✽ޜ���甽猽猽ޔ�ތ�甽猽ތ�ޔ�ޜ�ޔ�ޘ�֔�猽�ք�ބ�ބ��{��{��{��{�ބ�ބ�ބ��{�ބ�ޔ�ބ�ތ�ތ�ޔ�ތ�ބ�ބ�ޔ�焵ބ�ތ�ތ�ބ�ތ�ޔ�ޔ�������������������������������������������������������������������������������������������������������������������������������������������������甽甽�{��{��{��s��s��s��s��s��s��{��{��s��s��s��{��s��{��s��{��s��s��{��s�֫���������ޘ�֜�ޔ�甽ޔ�甽ޔ�ތ�ޔ�猽猵֔�猽ތ��ޔ�ތ�ތ��ޔ�ތ�ބ�ތ�ބ�ބ�ތ�ޔ�┽ތ�ޘ�֥�������ޥ�电┽ތ�ք�ތ�ބ�ބ��{��{��s��{��{��s��s��s��{��{��{��s��s��s��s��{��s��{��{�ބ��{��{��{�ބ�ތ��{��ތ�ބ�ތ��{�ތ�ބ�ބ�ބ��{�ބ�ޔ�ޜ���������������������������������������������������������������������������������������������������������������������������ޔ�ޔ�ޔ�ޜ�猽ޔ�猭֔�ތ�ތ�ބ�ޔ�ޜ�甽甽ތ�ތ�猵ތ�ބ�ބ��{��{�ք�ބ�ބ�ތ���{�ބ�ބ�ތ�ތ��{�ތ�ތ�焵ތ�猽ތ�ތ�ޔ�ޔ�猽ތ�ޠ���֥�������������������������������������������������������������������������������������������������������������������������������������������������甽ބ�ބ��s��s��s��{��s��{��s��{��{��{��s��{��{��s��s��s��s��{��s��s��{�ޥ�������ޜ���ޜ�ޜ�ޜ�ޘ�֔�甽甽ތ�ޔ�猽ތ�猵ք�ބ�ޔ�ތ��ޔ�甽ތ�ތ�ބ�ތ�ތ�ތ�ޘ�֜���ޥ�������������猽ބ�ތ�ތ�ބ�ބ��{��{��{�ބ�ބ��s��s��s��{��{��s��{��s��{�ބ�ބ��s��{��{��{��{�ބ��{��{��{�ք��{�ތ�ք��{�ބ�ބ��{��s�ք��{��{�ތ�֜��������������������������������������������������������������������������������������������������������������������������眽ޜ�ޔ�ޔ�ޔ�ތ�ތ�֘�֔�ތ�猽ބ�ތ�ޔ�ޔ�焽ք�ތ�ބ�ތ�ބ�ބ��{�ބ�ތ�ބ�ބ�ބ�ބ�ތ��{�ތ�ބ�ޔ�ތ�ތ�焵ތ�ތ�ތ�ތ�甽焽ޔ�甽甽���������������������������������������������������������������������������������������������������������������������������������������甽��������甽ޔ�ބ��{��s��s��{��{��{��s�ք�ބ��{��{��{��s��s��{��{��{�ބ��s��{��{��{�ޥ�����������ޜ�ޜ�疷�ޔ�ޔ�ޔ�ތ�֔�ތ���{�ތ�ޔ�ތ�֔�猽ތ�ޔ�ތ�֔���֔���֔�ޥ�����������������甽眽ތ�ތ�ބ�ބ��{��{�ތ��{��s��{��s��s��{��{��s��{��{��s��s��s��s��s��{��{��{��{�ބ��{��{��{��{�ތ�ք�ތ��{�ތ��{��s���{��{�ތ��ޔ�����������������������������������������������������������������������������������������������������������������������������甽ޔ�ޔ�ޔ�甽甽猽�ތ�猽ބ�ތ�ތ�ތ�ք�ތ�ތ�ބ��{��{��{�ތ�ބ��{�ބ��{��{�ބ��{��{�ތ�ޔ�焽ޔ�焵ޔ�猽ޔ�猽ޔ�猽猽ބ�ތ�ޜ���֥���֜������������������������������������������������������������������������������������������������������������������������������ޜ�ޫ�������ޔ�猽��s��s��{��{��s��{��{�ތ��{�ތ�ބ��{��{��s��s��{��s��{�ք��s��s��{����������������甽�{�ތ�ތ�ޔ�ޔ�ތ��֔��{�ތ�ތ�ޔ�ތ�ތ�甽ޔ�ޔ�ޜ�甽ޜ����������������������ޘ��֖���{��{�ք��{��{��s�ք�ބ��{��{��{��{��{��s��{��{��s��{��{��s��s���{��s��s��{��{��ތ��{��s���ބ��{��{��s��{��{��{�ތ�֜���������������������������������������������������������������������������������������������������������������������������������ޘ��{�ތ�ޘ��ޔ�ℵ�{�ތ��{��{�ޔ�焵ބ�ތ��{��{�ޔ�猽�s�ք�ބ��{��{�ތ�֔��{�ބ�ބ�ބ�ބ�ބ��{��{�ތ�ތ�ތ�֜�ޔ�✽ތ�֜���ޘ�֜������������������������������������������������������������������������������������������������������������������������������������������֥�疷��s��{��{��s��{��{��{��s��ތ�ޔ�ބ��{�ތ��{��{��{��s��s��{��s��{�ޥ�������������������֜�ޔ�甽ޔ�ތ�֔�猵ތ�ޔ�甽ތ�ތ�֔���֔�碿Ԍ�ޥ���������������������������ޔ�焽ތ�ք��{��{��{��{��s��{�ބ�ބ��{��s��{���{��s�ք��s��{��s��{�ތ��{��{��{��{��{��{���{��{��{�ބ�ތ�ބ��{��{��{��{��s�ք�ބ�ޜ�ޥ�������������������������������������������������������������������������������������������������������������������������������������������ތ�ތ�ބ�ބ�ތ��{�ތ�ք��{�ތ��{�ބ�ތ���{��s��{�ބ�ބ��{��{��{��{�ތ�֔�焵ބ�ބ�ބ�ޔ�猽�{�ތ�ތ�ތ�ޔ�甽甽猽ތ�֔���֜��������������������������������������������������������������������������������������������������������������������������֥�����������甽ތ�ޔ��{��s��s��s��{��{�ތ�ތ��֔�甽猵��{��{��s��s��{��s��{��{��s�ֵ�����������������眽ޜ�甽����甽ޔ�ތ�ޔ�甽猽ޔ�甽����眽ޘ�֜�ޥ���������������������������猽֔�焵ތ�ք��{��{�ބ��{��{�ބ��{��{��{��{��{��{��{��s��s��{��{��s��{��{��{��{��{��{��{��{��s��{��ք��{��{�ތ���{��{�ބ�ބ�ބ�ޔ�ޥ�������������������������������������������������������������������������������������������������������������������������������������������֘�֔�猽ޔ�ތ�ތ�ތ�ޔ�猽ތ�ބ�ބ��{�ތ�ތ�ތ�ބ��{�ބ�ބ�ބ�ބ�΄��{��{�ބ��{��{�ބ�ތ�֔�猽甽��ք�ޔ�甽ބ�ތ�ޔ�猵ޔ�ޜ�ޜ�������������������������������������������������������������������������������������������������������������������������������������甽ޔ�ތ�ތ��{��s��{��s��s��{��{��{�ތ�ޔ�ޔ�猽ބ��{��{��s��{��s��s��{��{��{�ε���������������眽ޜ�ޔ�ޘ�֘�֜�����ޔ�ޜ�甽ޜ�ޔ�ޔ�ޜ�甽ޜ�����������������������������甽ޜ�猽ތ�ތ�ބ�ބ��{�ބ��s�焵ބ��{��{��{��{��{��s��{��{��{��{��{��{��{��s��s��{��{��{��{�ք�ބ�ބ�ތ��{�ބ�ބ�ބ��{�ބ��{�ބ��{�ތ�ޔ�ޜ��������������������������������������������������������������������������������������������������������������������������������������������┽ޔ�猽ޔ�ބ�ބ�ބ�ބ�ތ�ތ��{�ތ��{��{�ތ�ތ�ތ��{�ք�ބ��{��{�ބ��{��{��{�ތ�ބ�ބ�ތ�焵ޔ�甽ޔ�甽甽眽ޔ�ތ�ތ�֔�猵ޜ�ޜ�������������������������������������������������������������������������������������������������������������������ޥ�甽ޜ����������������֔�ޔ�甽�{��s��{��s��s��s�ք�ބ�ތ�ޔ�甽ބ�ބ�ބ�ތ��{��s��s��s��{��{��{�ε��������������������ޜ�甽ޔ�ޔ���֔�ޜ�甽甽甽ޜ���ޔ�ޜ�ޥ�����������������֜��������������������ޔ�ޔ�猽�{�ބ��s�ք��{��{��{��{��s��s��{��s��{��s��{��s�ք��{��{��{��{��{�ބ��{�ք�ބ�ބ��{�ބ��{��{��s�ք��{�ބ��{�ބ�ބ�ބ�ތ�֔�ޜ����������������������������������������������������������������������������������������������������������������������������������������甽ޔ�甽ޔ�猽ތ�ޔ�焽ބ�ތ�ބ��{�ބ�ބ�ތ�ބ�ބ�ތ�ބ�ބ�ބ�ބ�ބ��{��{��{��{��{�ބ�ތ�ޔ����֔�甽����ޔ�电┽ޔ���眽ޜ��������������������������������������������������������������������������������������������������������������������������������甽ތ�ޔ�ޔ���ބ��{��s��{��s�ք��s��{�ބ�ތ�֔�焵ބ�ބ�ބ��{��s��s��s��s��{��s��s�������������������ޫ�����甽ޜ�甽甽ޔ�猵ޔ�ތ�ޘ�֜�眽ޜ�ޜ�������������������������������������ޜ�ޔ���甽ތ�ތ�ތ�ބ�ބ��{��{�ބ��{��s��s��{��s��s��{��{��{��{��{��{��{��{�ބ��{��{��{�ބ�ތ�ބ�ބ�ބ��{��s�ք��{��{�ބ��{��{�ބ�ބ�ޔ���ޥ������������������������������������������������������������������������������������������������������������������������������������������甽ޔ�ތ�ތ�焵ބ�ބ��{��{��{�ބ�ބ�ބ�ބ�ތ�ބ�ބ�ބ�ބ�ބ�ބ�ބ�ބ�ތ��{��{��{�ބ�ބ�ޔ�甽猵ޜ�甽ޔ�甽甽����֔�ޔ�ޘ�֜����������������������������������������������������������������������������������������������������������������������������ޜ�ޜ�ތ�ޔ�ޔ�甽ތ��{��{��s��{��{�ބ�ބ�ބ�ޔ�ތ�ތ�ބ�ބ�ބ��{�ބ��{��{��{��{��{��s�����������������������ޔ�ޜ�ޘ�֔���甽甽ތ�ޔ���֜�ޜ�����ޥ�����ޜ�����眽ޜ�甽ޔ�������������������甽��甽ޔ�猽�{��{��{��{��s�焭�s��{�ބ��{��s��s��{�ք�΄��{��{��{��{��{��s��{��{�ք��{�ތ��{�ބ��{��{��{�ք��{�ބ��{�ބ�ބ�ބ�ބ�ތ�ޜ���֥������������������������������������������������������������������������������������������������������������������������������������������֜�ތ�ބ�ތ�ޔ�ބ�ބ�ތ��ތ��ބ�ބ�ތ��{�ތ�ތ�ބ��{��{�ބ��{�ތ��{�ބ��{�ބ�ބ�ބ�ބ�ތ�ޔ�ތ�ޜ�������ޜ���֔�甽��眽ޘ�֥�ޥ����������������������������������������������������������������������������������������������������������������������甽ތ�ތ�ތ�ތ��{��{��{��{��s��{�ބ�֔�ތ�ތ�焵ބ��{�ބ��{��{��{��s��s��s��{��{��s������������������������眽ޘ�֘�֖�֔�ޔ���֘�֜�眽ޜ�������֥���眽ޘ�֥�眽ޜ���֜��������������������������ތ��{��{��s��{�ބ��{��{��{��{�ބ��{��s��{��s��{��s��{��{��{��{�ބ��{���{��{�ތ���{�ބ�΄��{��{��{�ތ�ބ��{�ބ�ތ�ޔ�ޜ���֫�������������������������������������������������������������������������������������������������������������%)5��������������������������甽ތ�焵ތ�猽ޔ�甽ތ�ތ�ޔ�猽ތ�ތ��{��{�ތ�ք��{�ބ��{��{�ތ����{��{��{��{��{�ޔ�猽ޔ�猽��ޜ�ޜ���猽֔�ޔ�甽��������ޥ������������������������������������������������������������������������������������������������ޥ���������������֔�甽猽甽�{��s��{��{��{��{��{�ބ�ތ��ބ�ތ�焵ބ�ތ�ބ��{��{��{��{��s��{��{��{��{���������������������ޜ�ޘ�֘�֢�Ԙ�֜�ޔ���ޜ�ޔ�ޜ�������甽ޜ�甽����甽��ޜ�ޜ�������������������������������ޔ�焭ތ���{�ބ��{�ބ�ބ��s��{��s�Ό��s��{��s��{��{��{��{��{��{��{��{��{��{��{��{�ތ�ք�ބ��{�ތ��{��{��{�ތ��{�ބ�ބ�ތ�甽��֔�ޥ�������������������������������������������������������������������������������������������������������������������k�����������������֔�ޔ�甽ތ�ތ���{�ތ�֔�ޜ�ޔ�ތ�֜�猵�{��{��{�ތ�ք�ބ�ބ��{��{��{�ք�ބ�ބ��{�ތ��{�ޔ�ތ�ޔ�甽��֜�眽ޘ�֜���甽甽��֜�ޜ�������������������������������������������������������������������������������������������������������ޔ���ޘ�֘�֘�֔�ތ�ތ�ބ��{��{�ތ��{��{�ބ��{�ބ��{�ތ���ބ�ބ�ޔ�ތ�ތ�֔��{��{��{�ք��{��{��s��s����������������������������֜�ޜ�ޘ�֘�֘�֘�֜�����������������眽ޘ�֜�������������������������������ޘ�֔�ޜ�ބ�ބ���s��{��s�ք��{��{��{��{��{�ތ�������������������������������������넭ތ���{�ބ��{�ބ�ބ��s���{�ބ��{��{�ތ�ތ�֔��������������������������������������������������������������������������������������������������������������������������������������������֔�猽ބ�ތ��{��{�ޔ�ތ�ތ�ޔ�����֔��{�ބ��{�ބ�ބ�ބ��{�ބ��s���ք�ބ�ތ�ք��{�ޔ���猽ޜ���ޜ�����ޭ�ޔ�甽����֘�֜���������������������������������������������������������������������������������������������������ޔ�ޜ�甽ޜ�甽甽甽ތ�ތ�焽ތ�ބ�ތ��{�ތ��{�ތ�ք�ތ�ބ��{�ތ����֔�ތ�猽ޔ�ތ�ތ��ބ�ބ��{�ބ��{��{���������������������������ޜ���֜���ޘ�֜�����������������������������������������������������������֜�甽甽ތ�ތ�ք��{�ބ��{�ބ�ބ��{��s��{��s��{�ޜ�����甽甽甽��甽������������s��{�ބ��{��{�ބ��{��{�ބ��{��{�ތ��{�ք�ތ�֔�ޜ���ޥ�������������������������������������������������������������������������������������������������������������������������������������甽ތ�ތ�ބ�ތ�ތ��ք�ބ�ތ�֔�甽ތ�ތ��{�ބ�ބ�ބ�ބ�ތ�ބ�ބ��{�ބ��{�ބ��{�ބ��{�ք�ޔ�猽甽甽甽ޜ�ޜ���֜�ޜ���ޘ�֜�ޥ������������������������������������������������������������������������������������������������������甽ޔ�ޔ�ބ�ޔ�猽ތ�ޔ�猽ބ��{��{�ք�ތ�ތ�ތ�焭ބ�ք�ބ�ތ��{�ތ�猵ޔ���֔�ތ�ތ�֜�ޔ�ބ�ތ��{��{�ބ��s����������������������������ޜ�����ޜ���֜�ޜ�ޥ�������������������眽ޠ�����������������������������֔�ޔ�ޜ�甽ތ�ބ�ބ�ބ��s��{��s��{��s��s��{��{��s��{��{��{��{�ބ��{��������������씽ބ��{��ތ�ބ�ތ��{�ތ�ք�ބ�ބ��{�ބ�ތ�ބ�ޔ�����ޥ���������������������������������������������������������������������������������������������������������������������������������甽甽ޔ�甽ބ��{�ތ�ޔ�ބ�ބ�ބ�ތ�ޔ�焵ތ�ތ�ތ�ބ��{�ք�ތ�ބ��{�ތ��{�ބ��{�ބ�ބ�ތ�ބ�ތ�ޔ�ޔ���������ޜ�����眽ޜ�ޥ�������������������������������������������������������������������������������������������������딽ޔ�ތ�ބ�ބ�ތ�ތ�֜�甽猽ބ��{��{��{��{�ތ�ބ��{�ք��{��{�ތ�ތ�ތ�ޔ�ޔ�ޔ�ޔ�ޔ�ޔ�ޜ�ޘ�֔�猽ތ�ބ�ބ��{���������������������������������ޜ�������ޜ�����������������������������������������������������ޜ�甽ތ�ތ�ބ��{�ք�ބ��{�ބ��s��{��{��s��{��{��{��{��s�֔����������������ℽ�{��{��{�ބ��{�ք�ބ�ބ�ބ�ބ��{��ތ�ބ��{��猵ޔ��������������������������������������������������������������������������������������������������������ᠧ�������������������������������ޜ�ޘ�֔�ޔ�猽ޔ�焽ބ�ބ�ތ�ތ�ތ��{�ތ��{�ބ�ބ�ބ�ބ�ތ�ތ�ތ�ք�ބ��{��{��{�ބ��{��ތ�ތ�ތ�ޔ�ޔ�ޜ�������ӥ���眽ޥ�����������������������������������������������������������������������������������������������������ތ�ތ�ތ�ބ�ޔ�ޔ�甽焵ބ��{��{�ބ�ތ�ޔ�ℽތ�ބ��{��{�ބ�ތ�ք�ބ�ޔ���֜���猽֔���ޜ���甽ތ�焵�{�ބ����������������������������������ޜ�����ޜ��������������������������������������������������������֜�猽ބ�ބ��{�ބ��s��{��{��{��s��{��{��{��{��{�֠���������������{��{��{��{��{�ބ�ބ��{�ބ�ބ�ބ�ބ�ބ�ބ��{�ބ��{��{��ތ�֔�����眽ޫ���������������������������������������������������������������������������������������������������砧�JSU����������������������ޥ��k��s�Δ�ބ�ތ�ތ�ތ�焵ބ�ތ�ތ�ތ��{�ބ�ބ��{�ބ��{�ބ��{��{��{�ބ��{�ބ��{�ބ��{�ބ�ތ�ތ�ޔ�甽ޔ�����������眽ޫ���ޫ������������������������������������������������������������������������������������������������ޥ���猵ޔ�ޔ�甽焵ޔ�焽�{��{��{��{��{�ތ�ބ��{�ބ�ބ�ބ�ބ�ބ�ބ�ތ�ޔ�������ޔ�猽ޜ�甽��֜�ޔ�ތ�ތ��{��{������������������������������������������ޜ������������������������������������������������������甽甽ތ�焽�s��{��{�ބ��{�ބ��{��{��{��{��{�ތ��������������s��{��{��{��{��{�ބ��s�ք��{�ތ�ք��{�ބ�ބ�ބ�ތ�ބ�ތ��{��{�ބ�ތ�ޔ�甽��������������������������������������������������������������������������������������������������������������ajn����������������������Z��%l�/o�\����ޔ�焵ތ�ބ�ތ�ތ��{�ތ�ք�ބ��{��{�ބ�ބ�ތ�焵ބ�ބ�ބ��{��{��{��{��{�ތ�ތ�ތ�ޔ�甽��ޜ������������������������������������������������������������������������������������������������������������������甽猽ތ�ޔ�ޔ�猽ބ��{��{�ބ��{��{�ތ�ބ�ތ��{�ބ��{�ބ�ބ�ތ�ތ��ތ�ޜ�ޜ�甽ޘ�֔�ޘ�֥�����ޔ�ތ�ބ�ބ�ތ�������������������������������������ޜ�ޘ�֜�������ޥ�������������������֘�֥������������������������甽甽ތ��{��{��{��{��s�ք��{��{��{��{��s��{�ތ��������������{��s��{��{��{��{��{��{���{��{�ք��{��{�ތ��{�ތ��{��{�ތ��ބ�ތ�ތ�ޜ�甽ޥ��������������������������������������������������������������������������������������������������������������������ޭ�ӭ�ӵ���ޭ�ӫ����M��/o�/o�f�Z�����ޔ�ތ�ތ��{���{�ތ��{�ތ�ތ�ք�ތ��{�ތ��{�ބ�ބ��{�ބ��{��{�ތ�ބ�ތ��֔�甽ޜ���������������������������������������������������������������������������������������������������������������ޜ�甽甽ތ�֘�֔��{��{�Ό�ք�ބ��{�ތ�ބ�ތ�ތ��s��{�ބ��{�ք��{�ތ��{�ޔ�ޘ�֘�֘�֜�ޜ�ޜ���ޜ���֘��ބ�ބ��{�������������������������ޥ�������������ޥ�������������������������眽ޔ�������������������������ޜ���甽ޔ�ތ��{��{��s���{��{��{��s��{��s��{��s��{��{�ތ��������������s��{�ބ��{�ބ��{��{��{��{��{�ތ�ք�ބ��{�ތ����ތ�ޔ�ބ�ޔ���֔�������������������ޜ��������������������������������������������������矲��������������������������������������������֥�֥�ֽ���ֶ�ҽ����Z��%l�%l�f�Z����ޔ�ބ�ޔ��{�ޔ��{��{�ތ��{�ބ�ތ�ބ��{�ތ��{��{�ބ�ތ��{�ތ��{��s��ޔ�猽ޜ���ޔ�������ֵ������������������������������������������������������������������������������������������������������������ޘ�֜�ޜ���֥�甽�{��s��{�ބ��{�֔�ބ�ބ�ތ���{��{�ބ�ތ�ބ�ތ�猽ޔ��{�ޜ���������������甽猽ބ�ބ�ތ��{������������������������������������������甽ޜ���������������������������������������������������ޘ����ތ��{��{��{��s��s��{��{��s��s��s��s��s��{��{��{�ތ���������������s��s��{��{��{��{��{�ބ��{�ތ�ք�ތ��ތ�ތ�猽ބ�ތ�ޖ��ޘ�֘�֜������������������������������������������������������������������ajn���%)5������������������������������������ӭ�Ӣ�ԥ�ʥ�ֶ�ҭ�ӽ����h��%l�f�%l�B{���ތ�ބ�ބ�ތ�ތ�ތ�ք�ބ�ބ�ބ��{�ތ�ތ��{��{�ތ�焵�{�ބ�ތ��{��{�ތ�甽甽甽ޔ�ޜ���֜���������������������������������������������������������������������������������������������������������������ޜ�ޜ�������甽甽猵�{��{��{�ބ�ބ�ބ�ތ��{�ތ��{�ތ��{�ތ�ބ�ބ�ތ�甽疷֘�֜�ޥ���������甽ޔ�猽ތ��ތ��{������������������������������������������֥�甽��������������ޥ�������眽ޜ���������������������ޜ�ޔ�ޔ�猵��{�ބ��{�ބ��{��{��{��s��{��{��{��s��s��s��{��s��s��{��{��s����������������{�ބ�ބ��s�ք�ބ�ބ�ބ�ބ�ބ�ބ��{�ތ�ք�ބ�ތ�֔�ޔ���������������ޜ�甽��ޜ������������������������������������������������ajn���������!y��������������������������ޜ�ޭ�Ә�֥�ʶ�Ң�ԭ�ӭ�ӵ�⌵�/o�f�%l�B{���ތ��ތ�焭ތ�焽ބ��{�ބ�ބ�ބ�ބ�ބ��{��{��{�ބ�ބ�ބ�ތ�ބ�ތ�ބ�ޜ���֜�ޜ�ޔ�����ޥ�������������������������������������������������������������������������������������������������������������������ޜ�ޔ�ޔ��{��{�ބ�ތ�ބ�ބ�ތ�ބ�ތ��{��{�ތ�猽ތ�ތ�ތ�ތ�ޘ�֜�甽����������甽ތ�ތ�ތ�ޔ�甽甽ތ���������������������������������������������ޜ�ޜ����������������������������������������������ބ�ތ�ބ�ބ��{��{��{��{��{��{��{��s��s��s��s��s��{�ֵ����������������������������{�ބ�ބ��{�ބ�ބ�ތ��{�ބ�ތ�焭ބ�ތ�ք�ތ�ތ�ޔ�甽ޔ�ޜ�ޜ�ޔ�ޜ�ޜ�甽ޠ�������������������������������������������������ajn������������ajn��������������������������֘�֢�Բ����ʶ�ҭ�ӭ�������s��J{�J{���ބ��{�ք�ބ�ބ��{�ք�ބ�ބ��\��k�˄��{�ތ��{�ބ�ބ�ބ�ތ�ތ�ޜ�ޘ�֜�ޜ���������ޜ��������������������������������������������������������������������������������������������������������������������������ޜ�ޔ�ތ�ޔ�猽�ބ��{�ք�ތ��{��{����{�ބ�ބ�ތ�ތ�ޜ�ޜ�ޜ�������������ޔ�猽甽����甽ތ���������������������������������������������ޜ���֘�֜�ޜ�ޥ���ޥ�����������������������������������猽ބ�ބ�ބ��{�ބ�ބ�ބ��{��s��{��s��{��{��s��{��{��{�������������������������������������댵�s���{�ބ�ބ�ތ�ތ�ބ��{�ތ�ތ�猵�{�ތ��ޔ�ޔ�ޘ�֔�ޔ�ޔ�甽甽ތ�֔�甽������������������������������������������������ajn������������fv|���������������������✽ޜ�ޥ�֥�ʥ�ʶ�ҥ�ʭ�ӭ������甽��猵ޔ�ތ�ބ��{��{��{�ތ��ބ�ބ��J{�%l�1s�\��s��s�ք�ތ�ޔ�����������������������������������������������������������������������������������������������������������������������������������������������ޥ���֔�猽ބ�ބ�ބ�ތ��{�ތ�ބ�ބ�ބ�ތ�ތ�ބ�ބ�ތ�ބ�ޔ�ޜ�ޥ�������������ޜ�ޔ�ޔ�ޔ���甽ޔ�ތ��������������������������������������������ޜ�����眽ޜ������������������������������������������ޔ�ތ�ބ�ތ��{��{�ք��{�ބ��{��s��{��s��s��s��X}�*?P��ތ�ތ�ތ�猵ތ�ތ�甽ތ�甽猽猽ބ��{���{�ބ�ބ�ބ�ބ�ތ�猽ތ��ބ�ތ�ބ�ބ�ޔ�甽猽ޔ�猽甽甽ޔ�ޔ�ތ�ޔ�ޜ�ޜ������������������������Բ����ʲ��������������ajn������������ajn��������������������������֜�ޘ�֢�ԭ�Ӷ�ҭ�ӭ�ޭ�ޜ�����֔�猽ތ��{��{��{��{��{��{�΄��{��{��B{�%l�/o�1s�g����ބ�ތ�ޜ�������������������������������������������������������������������������������������������������������������������������������������������ޜ���眽ޜ�猽ޔ�甽焵ބ�ތ�ތ�猽猽ތ�ք��{�ބ�ބ�ތ�ތ�ޔ�ޘ�֠���������眽ޜ���ޜ�ޔ�ޔ�ޜ���ޜ�甽ބ���������������������������������������������֠�������������������������������������������������焵ތ�ބ��{��{��{��{��s��s��s��g��Ns�!!1������������s��{��s��s��s��{��{��s��{��{��{��{��{�ތ�ք�ބ�ބ�ބ�ބ�ބ�ތ�ޔ�猵ތ�猽ބ�ބ�ތ�猵ތ�ք�ތ�ތ�ތ�ތ�猵ތ�ތ�֜���֜�������������������Ҷ�ҥ�ʥ�ʟ����ʥ��������ajn������������ajn��������������������✽ޘ�֘�֥�ʥ�֥�֜�ޜ�ޜ�����֔�ޜ�甽ތ���{��{��{��{�����s��{��{��J{�%l�%l�%l�g����猽甽ޥ����������������������������������������������������������������������������������������������������������������������������������������ӥ�����������甽ޘ��ތ�ޔ�猽焵ތ��甽ތ�ތ���{�ތ�ք�ޔ�甽��֜���ޥ���������������֜�������ℵތ��������������������������������������������������ޫ������������������������������������������������{�ބ�ބ��s��{��s��g��*?P������������������������������������������������ތ������s���{��ք��{�ք�ބ��{��{��{�ތ�ބ��{�ބ��{�ތ��{�ތ�ބ�ތ�ք�ތ�ބ��{��ތ�ޜ�ޥ�ޥ�������������������ӭ�Ӣ�Ԣ�ԟ�������������Խ��Qdu������������Qdu��������������������{����֘�֘�֜�ޘ�֘�֜�ޥ�����֜�����猭ք��s��{��{��s��{��s��s�ք��J{�%l�/o�1s�g����ތ�֔�ޫ��������������������������������������������������������������������������������������������������������������������������������������������ޥ�������甽ޔ�猽ޔ�甽猽ތ�ތ�ޔ�焵ޔ�甽ތ�ޔ�猽ޘ�֔�ޔ�ޘ�֜�����ޥ�����ޘ�֜���֜�ޥ�������ޔ�ބ������������������������������������������ޜ�ޥ����������������������������������������������������ޥ����ք��{��{��H_t��������������������������������������������������������������⌽������ތ���ބ��{�ބ��{��{��{��{��{��{��{�ބ��{�ބ�ތ���ތ��{�ތ�ޔ��{��{�ތ�֜�����֥�����������������ԥ�֝�ŝ�ş����������ʥ�����z��������������Qdu���������������ޜ����J{�B{�J{�h����ޥ�֥�����������疷�ތ�ք��{��{��{��{��{��{��s�΄��\��/o�f�1s�g��{��֜�����������������������������������������������������������������������������������������������������������������������������������������������ޥ������眽ޜ�猽�甽甽ތ�ތ�ք�ތ�ތ�ޔ�ތ��ޔ�ޔ�����ޘ�֥�������֘�֜�����甽ޜ���������眽ތ�ތ�猽����������������������������������������������������������������������������������������������������c��%)5������������������������������������������{�ބ�ބ��{��{��{�ބ��{��{��{�ք��{�ތ��{��{�ބ�Ό����{��ޔ�ތ�ޔ�猽ތ�焽�{�ތ���{�ބ�ބ�ޔ�焵ތ�ތ��֜�ޘ�֜�ޜ�ޥ��������������딭���ӥ�ʔ����������ť����Խ����⥹�*?P���ajn���������ԭ�ӥ���ޜ����J{�B{�B{�B{�/o�����������������ք��{��{��{��s��{��s��g��{��s��{��{��{��k��B{�J{�{��{�ޔ�ޫ���������������JSU���������������������������������������������������������������������������������������������������������������������������ޜ�������甽甽甽甽猽ތ�ބ�ބ�ތ�ތ�ޘ�֔���甽甽ޜ���֜�����甽ޘ�֘�֘��ޘ�֥�������ޔ�甽焭�s��{��������������������������������������������������������������������������������������������쥹�H_t!!1���������������������������������������������������s��s��{�ޔ�猽�{��{��s��{��{��{��{��{�ބ�ބ��{�ބ��{���{�ތ��{�ތ�ބ�ބ�ތ�ք�ބ�ތ��{�ތ�焽ބ�ބ�ބ�ތ�ތ�ޜ���֔�ޜ�ޜ�ޠ���ޭ���������JSUJSU�����ʟ�������Խ���������������Ғ��������ӭ�Ә�֢�Ԝ�ޜ�ޥ��M��B{�B{�B{�B{���������������֔�ޔ�ތ�ք��{��s��h��g��{��s��s��s�ք��{�ތ���{��{�ބ�Ό�֜�ޭ��������������%)5�������������������������������������������������������������������������������������������������������������������������������甽����ޜ�猽ތ�ތ��{�ތ�猵ތ�ޔ�ޔ�ޔ���������������ޜ���ޜ�ޜ�����������ޘ�֔��{��{��{������������������������������������������������������������������������������������y��JSU!���������������������������������������������������������������{���������������������{��{��s��s��{��{�ބ�ބ��{�ބ�ބ�ބ�ބ�ތ�ք��{�ތ�ބ��{�ք��{�ތ�ބ�ތ�ބ�ތ�ބ�ތ�甽ޔ�ޘ�֘�֘�֜�ޘ�֥�ޭ��ҽ�����*?P������(:-iw������Խ����������������������ӥ�ʥ�ʥ�ʔ�ʘ�֭�ӥ��M��B{�B{�B{�1s���ޫ�������������֔�ތ�ތ��{��s��{��g��g��s��{�����{��{�ք��{�ք�ބ�ތ�Ɩ�֘�֭�ӭ�����������������������������������������������������������������������������������������������������������������������������������������眽ޜ�������������猽ތ�ތ�ތ�ތ�ތ�ޔ�甽��������������������ޜ�ޜ�������������ތ�ތ��{��s��{����������������������������������������������������������������������������������H_t�����������������������������������������������������������������������������������������������{��{��{��{��{�ք��{��{��{�ބ�ތ�ބ�ބ�ބ�ތ�ބ�ބ��{�ބ�ބ�ބ�ބ�ތ�焵ތ�ބ�ބ�ތ�ޘ�֔�ޘ�֜�ތ�֔�ޘ�֘�֥�ʭ�ӭ�ӥ���*?P���������������Qdu�������������������������ӥ�ʝ�Ŕ�������ʢ�ԫ��B{�B{�B{�B{�%l���֥�����������ޔ�ޔ�ތ�ބ��{��{��s��{��{��s��s�ք��{��{��ք�ބ�ބ�Ό�֔�ʝ�ť�ʥ�ʥ�ʶ�ҵ��������������������������������������������������������������������������������������������������������������������������������������ޥ�������������猽ތ�ބ�ބ�ތ��ޔ�ޔ�ޫ����������������������ޠ���������������{��{��{��{����������������������������������������������������������������������������������H_t���������������������������������������������������������������%18Xq]s�������s��s��s��s�֔��������s��{��{��{��{��s�ք�ބ�΄�ބ�ތ�ތ�ތ�ބ�ބ�ތ�ބ�ބ�ތ��{�ބ�ބ�ބ�ބ��{�ތ�ޔ�甽ޜ�ޔ�ޘ��֔�ʔ�ʝ�ŝ�Ř�֜�ޭ�Ӷ��*?P���������������JSU������������������������Ӷ�ҥ�ʌ�Ɵ����������֢��Z��B{�7v�7v�1s�������������ޜ�������\��h��{��{��s��{��s��s�ք�ބ��{�ބ��{�ք��{�ք�Ό�Ɣ�ʝ�ŝ�Ţ�ԭ��ҭ�����������z������������������������������������������������������������������������������������������������������������������������ޫ�����������������猽ޔ�ޔ�⌽ޔ�ޔ�������������������������眽ޔ�ޜ���ޥ���ބ�ތ�猵�{��s��{��{���������������������������������������������������������������������������������������JSU������������������������������������������������)*?PX}�{��{��s��������s��{��s��s��{��{��������{��{��{��{��{��{��{�ބ�ބ�ބ�ބ��{�ތ��{�ޔ�焽�{�ތ�焵ބ��{�ބ�ތ�猽ބ�ތ�ޔ�甽ތ�ޔ�ތ�֔�ʌ�΄�Ɛ�����������������*?P���������������JSU��������������������������ҥ�ʔ�������������ʥ�ޘ��g��B{�B{�1s���ޥ���眽ޜ�ޜ�ޜ�ޔ�ޘ�֔��f�f�/o�Z�����s�ք�Ό��{��{���{�ބ�ތ��{��Ɣ�������������ʶ�ҭ�ޫ��!���������z�����������������������������������������������������������������������������������������������������������������������������������ӥ���眽ޜ�ޜ�ޜ�甽���������������������������ޔ�ޔ���甽甽���ތ��{��{�ք��s��{��������������������������������������������������������������������������������������JSU������������������������������������*?PZ��s��{��s��s��s��{��{��������s��s��{��s��{��{��������{�ބ��s��{��s��{�ބ��{�΄�ބ�Ό���{�ތ�ք�ބ�ބ�ބ��{��{��{�ބ�ތ��{�ބ�ބ�ތ�ޔ�甽ޘ�֝�Ŕ�ʔ�Ƅ����������������Ŷ��%)5���������������Qdu������������������������ԥ�ʥ�ʔ�������ʥ�ʥ�֭�ޥ�����{��B{�����֔�ޔ�ޔ�ޖ�֥�֘�֔�ބ��f�f�f�f�f�{��{��{�ތ�ք�ތ�ތ�ތ��ք�������������������ʶ�Ҷ�ҭ�ޭ��fv|���y��������������������������������и��������������������������������������������������������������������������������������������������������ޜ�������������ޫ���������������������֘��֘�֔�甽猽�{��{��s��{��s��s��s��������������������������������������������������������������������������������������JSU������������������������������*?Ps��{��s��{��s��{��s��{��{��s��{��s�ք��������{��{��{��{�ޫ��������s��{��{��s��s���{��{�ތ��{��{�ތ���{�ބ�ތ�ތ�ތ�甽猽�{�ޔ�ތ�焽ތ���{�ތ�֖�֘�֘����{��{�����������������*?P���������������ajn���������������������ӥ�ֶ�Ҷ�ҥ�ʠ����Ҷ�ҭ��������ޥ���猽��ƌ�֖���֔�ތ��/o�f�f�f�f�s���{�ބ�ތ�ބ�ޔ�ތ�ތ��ք�Ό�ƌ�Ɣ����Ŷ�Ҷ�ҽ����������֒��������������������������������c%�Z!�|J��������������������������������������������������������������������������������������������������������������������������������������ތ��ބ�ބ�ތ��s��{��s��s��s��s�ք��s������������������������������������������������������������������������������������������JSU���������������������������������!8Xq{��{��{��{��{��{��{��s��{��{�����������{��{�����������{�ބ��s��{��{�ތ��s���{�ք��s��s���{�ތ�ބ�ތ��ބ�ތ�ތ�ތ�ք��{�ބ�ތ�ք�ޔ�猽֘�֥��֖�֔��{�����{��������������*?P���������������ajn��������������������h��B{�\����ʥ�ʌ�ֶ�ҭ������������ޜ�ތ�ތ�Ƅ�ƌ�ƌ�ƌ�ƌ�ƌ�ƥ��/o�f�f�f�f�s��ތ�焵ބ�ތ�ޔ�ޘ���{�ք�Ζ�֔�ʠ����ʥ�ʥ�֭�ޭ������������������������������������������^)�^%�^%�d0����������������������������������������������������������������������������������������������������������������������������������电ℵބ�ބ��{��{��s��{��{��{��{��s��{��s���������������������������������������������������������������������������������������������JSU���������������������������������������������)*?PZ��s��s��s��{��{��s�����{��{�ޥ�ބ��s��s��{��{��{��s��{��{��{��{�ބ��{��{�ތ�ތ�ތ��{�ބ�ބ�ތ�猽猽ք�ތ�ބ�ބ�ތ�ތ�ތ��ތ�֖��Δ�����{��z��������������(:-���������������ajn����������������g��B{�B{�B{�Z�������֭�ӭ��������������ӌ�֔�����{����������Ɩ���/o�f�f�f�f�{��{�ބ�ބ�ބ�Ό�ޜ�ޔ�ތ�ތ��Ns���Ō�֝�ŝ�ť�ʥ�֭�ӵ����������������ԭ�������Խ���������������^)�^%�^%�^)��������������������������������������������������������������������������������������������������������������������������������������������ތ��{��{��{��s��{��{��{��{��{��s��s��s��{�����������������������������������������������������������������������������������������딭�JSU���������������������������������������������������!!1*?PX}�s��s��s��{��s��{��{��s��{��{��{��{��s��{��{��{��{��{��{��{�ބ�ބ�ބ�΄�ތ�ބ�ք�ތ�焵ތ�焽ތ��{�ބ�ބ�ބ�ތ�ތ��֖���Ƅ�����������������������%)5���������������ajn�����ԭ�ޭ�������Ե����h��B{�B{�B{�B{�B{���ӽ�������������딽ޔ�ʄ�Ƅ��{��{��{����ƌ�֔��f�f�f�f�f�{��ތ��{�ք�Ό�ތ�ބ�ތ���*?P�����ޭ����Խ������������������Ҷ�ҭ������������������^)�^%�^%�^)����������������������������������������������������������������������������������������������������������������������������������������������뜽ބ��s��{��{��s��s��s��{��s��s��{��{��{��s��������������������������������������������������������������������������������������������������iw�JSU)���������������������������������������������������������������������������������s�ք��{��{��{��{�ބ��{��{��{�ք�ތ��{�ބ�ބ�ތ�焵ތ�猵ތ�ބ�ބ�ބ�ތ�ބ�ތ�ތ�ތ��֘��֔�ʐ��{�����������������������JSU���������ajn��ޭ�ӥ�ʥ�ʭ�ӭ����Խ��g��B{�B{�B{�B{�B{���ӵ�������������由ʔ�ʌ�Ƅ��{��{��{�������Ό��s��B{�f�f�f�����{���{��{��΄��{�ք�����������(:-��ޭ��������������������ԭ��������������������ǜ~�^)�^%�^)������������������������������������������������������������������������������������������������������������������������������������������������ޥ�甽�{��{��{��{��s��{��s��s��s��s��s��{��s��{�������������������������������������������������������������������������������������������������������������焭�Ns�*?P)���������������������������������������������������������������������{��s��{�ބ��{�ք��{��{��{��{��s���{��ք�ބ�ބ�ބ�ބ�ބ�ތ�ք�ތ���{��ք�ޖ������y��*?Py�������������ʭ�ӽ����y��%)5���Qdu������ŝ�ť�ʥ�ʶ�ҽ��g��B{�B{�B{�B{�B{���������������ޜ�ޜ�ޝ�Ō�ƌ��{��{�����{����Ό��֔��{��\��B{���ބ�΄��{��{��{��{��{��{��s��������������������������������ӭ�����������������������������и��|J���������������������������������и�����������������������������������������������������������������������������������������������������������������{��s��s��s��s��s��s��s��s��s��{��s��s��s������������������������������������������������������������������������������������������������������������ބ��{��{��{��s��Ns����������������������������������s��s��s��{��s��s�����������{��s��{��{�ބ��s�ք�ބ��{��s�ք�ބ��{�ތ�ބ�ބ�ތ�ބ�ތ�ބ�ބ�ބ�ތ�ތ���{�ք�ތ�ƌ�ƌ�Ό�֝��|�����������!k�������ʭ����Ե������쐥�iw���ʝ�Š�������������ʽ��\��B{�B{�B{�B{�B{��������������ޘ�֘��{�Ό�Ƅ�Ƅ�����{��{�Ό�ƌ�ƌ�ތ�ތ��{�ތ�ތ�Ƅ��{��{��{��{��s��{��{�Ό��������������������������������������������������������������������������������������������������и��^%�^)ǜ~��������������������������������������������������������������������������������������������������ޥ���猵ބ��{��{��{��s��{��s��s��s��{��{��s��{��s��{�������������������������������������������������������������������������������������������������������甽ތ��{��s��c��*?P���������������������������������������s��{��s��{��{��s��s��������{��{��{��{��{��{��{��{��{��{��{��{��{���{�ބ�ތ�ބ�ބ�ޔ�猭ք�ތ�ք�ބ�΄��{�Ό�ƌ�Ƅ����Ɣ�Ǝ�����������������JSU�����ӽ���������ޥ�ʝ�Œ�������������ʶ��Z��B{�B{�B{�B{�1s��������ޫ�뜽ޜ�ޜ�猵�f�/o�Z�������ƌ�ƌ�ƌ�����ތ���{�Ό��g��h��s��k��h��s��{�Ό��������������������������������������������������������������������������������������������������и��^%�c%�c%�|J�������������������������������������������������������������������������������������������������甽�{��s��{��s��{��s��s��s��s��{��s��{��s��s��s��s�������������������������������������������������������������������������������������������������������{��*?P���������������������������������������������������s��s��s��s��{�ތ�ތ��������{��{��{��s��{��{�ބ��{�ބ�ތ�ք��{��{��{�ތ�ބ�ޔ�焽ތ��{�ތ���{�ބ��{�ք�΄��{��������{�����{�������������������������ʽ��������ԥ�ޥ�ʔ��������������������V��B{�B{�B{�B{�1s���ޭ�ޥ�֭�ӭ�ޥ�֜�ޘ���/o�%l�f�f�/o�{�Ό���{�ք�ބ�ތ�ތ�ތ��{��s��h��h��{��Z��g��s��{�����������������������������������������������������������������������������������������������������������c%�c%�g%�|J�������������������������������������������������������������������������������������������������猽ތ���{��{��{��s��{��s��s��s��s��{��s��{��{��s����������������������������������������������������������������������������������������������������z��*?P���������������������������������������������������������{�ք��������������{�ބ��{��{��s��{��{��{��{��{��{��{��{�ބ�ބ�ތ��{��{�ބ�ބ�ބ��{�ތ�ޔ�猽��{��{�΄��{��{��{��{��{��{��z�������������������������������������Ӕ�Ɲ�Œ�����������������Z��B{�B{�1s�B{�1s���ޭ����ԭ�ӥ�ʘ�֔�ޘ���f�%l�%l�f�f�h��������ք�ތ��{��{��{��c��k��k��k��{��|��{�΄�������������ޥ���������ԫ����������ǜ~����������������������������������������������������������������������^%�c%�c%�|J�����������������������������������������������������������������������������������������������������{��{��s��s��{��s��{��s��s��s��s��s��s��{��{�����������������������������������������������������������������������������������������������Qdu���������������������������������������������������������������������������������������������{��s��{��{��{�ބ��{��{��{�ք��{��{��{��{�ތ��{�ތ�ތ��{�ތ��{�ތ�ތ�ք�ތ�ք��{��{��{��k��{��s��{��k�������������������������ʵ��������ޭ�ӥ�ʝ�Š�������������ʥ�ʭ�ޔ��g��B{�B{�/o���֭�ӥ�ʔ�ʟ����֖�֘��{��/o�%l�%l�f�f�s�Ό��ބ�ޔ�ތ�ތ�ތ���{��h��|��g��k��k�����{����Ţ��ajn��������ӵ�����ޭ�ӭ�������������c%�c%�|Jи�������������������������������������������������������������ǜ~�^%�c%�|J�������������������������������������������������������������������������������������������������甽�{��s��s��s��s��s��s��{��s��{��s��s��s��s���������������������������������������������������������������������������������������������������JSU������������������������������������������������������������8XqX}�g�����������{��{�ޔ�����������s��{��{��{��{�ބ��{��{�ք�ބ��{�ބ�ބ��{�ބ��{�ք�ބ�ބ�ތ��ք�ތ�ބ�΄��{��s��{��z��k��k��s��k�������������������������ʵ���������ޥ�ʲ����������������ʥ�ֶ�ҽ�������s��B{���֥�ʟ�������������ʖ�ք��%l�f�f�f�f�h�����ތ�ތ��ތ�ތ���H_tc��{��s��{��{��{�������ʭ�����iw�!!1��ޭ�ޜ�ޥ�֭�ӭ�ӽ������������c%�c%�c%�^%�|J���������������������������������������������������������������и��|J���������������������������������(:-������������������������������������������������������ޜ���甽ތ��{��{��s��{��{��{��s��s��{��s��{��s��s��{����������������������������������������������������������������������������������������������JSU������������������������������������������������*?PHp�s��s�ք��s�ֵ�����{��{��s��{��{��{��������{��{�ք�ބ��{�ք�ބ��{��{��{�ބ��{��{��{��{�ބ�ބ�ތ�ބ��{�ތ�ތ�ք�ބ��{��s��{��k��k��k��k��k��fv|�����������������������ʵ���������ޥ��Gt�c����������ť�ʶ�ҽ�������������ʥ�ʔ�����������������{��%l�%l�f�f�f�k�˖�ք�ތ��֖�֖��ބ�����!JSUz����������ť�ʭ�ޭ������␥���ޥ�֭�Ӣ�ԭ�ӭ����Խ���������^%�c%�c%�^%�|J������������������������������������������������������������������������������������������������������������������������������������������������������������������甽�s��{��s��s��{��s��s��s��s��s��{��s��{��s�����������������������������������������������������������������������������������������������������JSU������������������������������������%)5H_t{��{��{��s��s��{��{��s��������{��s��{��{�ބ��{��������{��s��{��{�ބ��{��{�ք�ބ�ތ��{��{�ބ��{��{�ք��{�ތ�ք�ތ�ބ�ބ�ތ��{�΄��s��{��k��d�iw�k��z��Ns������������������������ʭ������ޭ�ޭ��%l�%l�/o�g����ƥ�ʭ���������������ʝ�Ő�����������������h��%l�%l�f�f�f�h����ƌ�ƌ�΄�΄�Ό��{������������*?P�����ʶ�ҭ�ޭ��������✽�Ң�ԥ�ʥ�ʶ�Ҷ�ҽ���������c%�g%�^%�^%�|J�����������������������������������������������������������������������������������������������������������������������������������������������������������������ޘ�֔�焵ބ��s��{��s��s��{��{��s��{��s��{��{��s�ք���������������������������������������������������������������������������������������������������H_t������������������������������%1Z��{��{��{��{��{��{��s��{��s��{��s�ֵ�����{��s��{��{��{��{�������넵�{��{��s��{��{��{��{�ބ��{��{�ք�Ό�ތ�ք�ބ�ބ�ބ�ބ�ތ��{��{��{���{��{��k��iw�d�d�d�k��fv|��������������������������Ӷ����ԭ�ޥ�ʭ��/o�%l�1s�1s�1s�B{�������������������ޥ�ʔ��{�����{��������{��k��%l�%l�%l�f�f�h�����ƌ�Ƅ�������ƌ�Ό�����������������d���ӽ��������������ޥ�֖�֝�ş����ʝ�Ŷ��������и��^%�^%�c%�^%�|J�����������������������������������������������������������������������������������ѽ����������������������������������������������������������������������������眽ޜ�猵ք��{��{��s��s��s��{��{��s��{��s��s��s��s��s�����������������������������������������������������������������������������������������������������JSU���������������������������������������*?Pg��s��s��{��{��s��{��s��s���������ބ��s��{�����������s��{��{��{��{��{��{��{�ބ�ބ��{��{��{�ތ��ք�ތ�ތ���{��{�ތ�ք�ބ��{��s��k��c��d�d�iw�k��Qdu��������������������������ʖ�֥����ԭ�ӥ��/o�1s�1s�1s�J{�J{�B{�Z�������������֔�Ɣ��������{��{��{�����{��1s�%l�%l�f�f�g�����{��{�΄����������ƌ�����������������d���ӭ������������ޭ�Ӕ����������������������Բ���^%�c%�^%�^%�|J���������������������������и������������������������������������������������������������������������������������������������������������������������������������ޥ�甽���ބ�ބ��s��{��{��s��s��s��{��s��s��{��{��{�����������������������������������������������������������������������������������������������������JSU���������������������������������������������������*?Ps��{��s��{��{��{��������������������������{��{��{��{��{�ތ���{��{�ބ�ބ�ތ���{��{��{�ք�ބ�Ό�ތ�����{�Ό��{��s��s��k��d�d�d�k��fv|��������������������������Ɵ����ƌ�ƥ�ʢ��1s�1s�1s�1s�J{�J{�1s�Z����������������Ԍ�Ɣ��{��{��{��{��{�������֖��s��1s�f�f�h��{��{��{��{��{�����{��������������������y����ҵ����������뜽ޘ��ƥ�ʔ�������������ҽ����и��|J�Z!�^%�|J���������������������������ǜ~�Z!�^)ǜ~������������������������������������������������������������%)5���������������������������������������������������������������猽ތ���{��{��s��{��s��s��s��{��s��s��{��s��{��s�����������������������������������������������������������������������������������������������������k��������������������������������������������������������8Xqs��s��{�ޔ�����������������{��{��{��{�ބ��{��{��{��{�ބ�ބ�ތ�ބ��{��{�ތ��{�ބ�ބ��{��{��ތ��{��{�ք�΄��s��k��d�iw�d�c��z��fv|������������������������������������������7v�B{�B{�B{�B{�1s�1s�Z����������ޥ�֥�ʄ��{��s��{�����{�������֖��֘���Z��g��{��{��z��{��k��{��{��������������������k����������������֜�ޘ��Ɩ�֔����������ʥ����Խ�����������и�ǜ~���������������������������ǜ~�^%�^%�^%�^%ǜ~������������������������������������������������������������y�������������������������������������������������ޜ�ޔ�ޜ�碿Ԗ�֔�ބ��{��{��s��s��s��s��{��s��{��{��s��s��{���������������������������������������������������������������������������������������������������������焥�d�*?P���������������������������������������������������������s��{�ބ��{��{��{��{��{��{��{��{�ބ�ތ��{��{��{��{��{��{�ք�ތ��{�ބ�ބ�ބ��{�ތ��{�ք�ބ��{�΄��{�΄��Qdu*?Piw�c��k��z��������ajn������������������z��{�����������B{�B{�B{�B{�1s�B{�B{�Z���������ޜ�ޘ��B{�M��Z��{�����������ƌ�Θ�֔�ތ��ք��{��s��k��k��k��{��{��{�����������������k������������������癓������ԥ�ʥ�ʶ�������ԭ���������������������������������������������ǜ~�^%�Z!�^%�^%ǜ~��������������������������������������������������������������������������������������������������������������������֔�ޔ�ޔ�ޔ�ތ�ތ��s��{��{��s��{��s��s��s��{��{��s��{��{�������������������������������������������������������������������������������������������������������甽ތ�ބ�ބ��{��c��Ns�%1���������������������������������������������������������{�ޔ�����������{��{�ބ��{��{��{��s��{�ބ�ބ�ބ�ތ�ބ��{��{��{�ք��{��{��{��s�ք��{��{��{��{��Qdu���������)H_tk��{�������ʘ���JSU���z�����{��z��{��������7v�B{�B{�1s�B{�1s�1s�Z����ޘ�֜�ޘ�֢�Ԕ��Gt�7v�1s�B{�Z��s����ʖ�֘�֔�ޔ�ތ���{��{��{��d�iw�k��k��{��������������������k�����������ޜ�ޥ�眽��|J�^%�|J��������ӭ�ӽ�������������������������������������������������ǜ~�^%�^%�^%�^%и��������������������������������������������������������������������������������������������������������������������딽猵ޔ�甽ޔ�ތ�猵�{��{��{��s��s��s��s��s��{��s��{��s��{����������������������������������������������������������������������������������������������������ޘ�֔�ޔ�ބ�ތ�ބ�ބ��{�ބ��s��R{�*?P��������������������������������������������ބ�����������������{��{��{��{�ބ��{�ބ��{��{��{��ތ��ތ�ք�ބ��{��{��{�΄��{��{��{��{��{��H_t���������������8Xq�����ť�֜�ޥ�猵�Qdu(k��{��z��c��k��������B{�B{�B{�7v�7v�1s�7v�J{�����֝�Ŕ�����J{�B{�7v�B{�B{�7v�J{�{����ޔ�ޔ�ޔ�ތ�΄��{��s��k��k��k��k��{�����������������������k������ֶ�Ҝ�ޢ�Ԝ�ޥ�ޥ���|J�^%�c%�c%�^)ǜ~�����������������������������������������������������ǜ~�^%�^%�^%�^%и����������������������������y�����������������������������������������������������������������������������������������甽ޔ�ޔ�ޔ�ތ�ތ�ތ��{��{��{��{��s��s��{��s��s��{��s��s�����������������������������������������������������������������������������������������������������ޔ�ތ��{�ބ��{��{��s�ք��{��{��{��{��Z��8Xq!!1���������������������������������{�ޜ��������{��������{��{��{��{�ބ��{�ބ��{�ބ��{��{�ތ�ތ�ތ��{��{��{��{��{��{��{��{��s��s��{��8Xq���������������������*?Pd���Ԕ�ތ�֘������z��z��y��z��{�����B{�B{�B{�7v�B{�1s�1s�J{�{�����{�������Ό��Gt�B{�B{�B{�B{�1s�1s�/o���ޘ�֔�ތ��ք�����{��k��k��k��k��k��{��!���������������d���֘�֖���֘�֭�ӫ���|J�c%�c%�c%�c%�d0�����������������������������������ɶ�����������������ǜ~�^%�^%�^%�^%и����������������������������*?P���(:-fv|���������������������������������������������������������������������������������甽猽ތ�焵ބ��{��{��s��s��s��{��s��s��s��s��s��{���������������������������������������������������������������������������������������������������由ʄ��{��{��k��k��s��s��h��k��s��h��{��h��k��h��h��8Xq)�������������������{��������{��s��������{��{��{��{��{��s��{�ք�ބ��{��{��{�ބ��{��{�ބ��{��{��h��{��g��g��|��k��{��8Xq������������������������������s����֢�Ԕ�ʐ�����{��c��k��k��k��{��7v�B{�1s�B{�1s�1s�1s�J{�{��s��{��{��s�����J{�7v�B{�7v�B{�B{�1s�/o���֔�ޔ�ތ��ք��d�fv|z��k��k��z��{��{�����fv|%1���������d���֘��ƌ�Ɣ�ʔ�ʥ�ֽ���|J�^%�^%�c%�c%�|J�����������������������������������ɶ�Ҷ�����������������и��|J�^%�^%и����������������������������(:-������������������������������������������������������������������������������������������ޔ�甽ތ��ք��{��{��{��s��{��{��{��s��{��s��{��{��s���������������������������������������������������������������������������������������������������H_t������������������������������������������������������)���������������{��{��������s��{�������댵�{��s�猽�{�ބ��{��{�ބ��{�����{��{�ބ��s��{��g��g��c��k��c��c��k��JSU������������������������������{����ޝ�Ō�΄��{�����c��k��y��s��{��Z��J{�1s�B{�1s�B{�/o�J{�|��c��{��g��{�����1s�B{�B{�7v�B{�1s�B{�/o����֖�����iw����JSUk��|��{����ƌ��֠�℥�*?P]s���Ƅ��{��{����������ʭ���|J�^%�c%�c%�c%�d0���������������������������������������и��������������������������|Jи����������������������������(:-��������������������������������������������������������������������������������������������ތ��{�ތ�ք��s��{��{��{��{�΄��{��{��{��s��{��{��������������������������������������������������������������������������������������������������JSU���������������������������������������������������{��)�����������������ޔ��������{�����������s�ք��{��{��{�ތ��{�ބ�ބ��{��{�ތ��{��{�ބ��{��{��h��s��c��d�]s�iw�k��k��JSU��������������������������������Ɯ�ޘ�֔�ʌ��{��z��k��k��c��s��{��{����΄��c��/o�/o�/o�Z��c��d�c��c��c��{��W��7v�B{�B{�B{�B{�1s�/o���Ζ��Ζ��ƌ��k��������������!!1iw���ƌ�֥�֘�֜�ޜ�ތ��ƌ�ƌ��{��{���������������|J�^%�c%�^%�^%�d0���������������������������ǜ~���������������������������������������������������������������������%)5������������������������������������������������������������������������������������������眽ޘ�֘�֔��{�ބ��{��s��{��{��s��s��{��s��s��{��{��{����������������������������������������������������������������������������������������������������JSU���������������������������������������������������s��)������������������������{��{�������섵ބ��{��{��s��{�ތ��{��{��{��{��{��{��{��{�ބ��{��{��s��c��c��X}�d�d�d�c��JSU�����������������������������������֘���{��W��s��z��c��c��z��{��{����Ό�ƌ�ք��c��/o�M��c��k��k��d�c��{��J{�B{�7v�B{�B{�1s�B{�1s�{�ƌ�Ɣ����Ό�ƌ��c��������������������fv|��֢�Ԣ�Ԙ��֔��{��{��{��z����������ʥ���|J�^%�c%�^%�^%�d0�������������������������Z!�^%�d0ǜ~������������������������������������������������������������(:-��������������������������������������������������������������������������������������������甽ޜ�焵�{��{��s��s��s��s��{��{��s��s��{��s��s��{���������������������������������������������������������������������������������������������������JSU���������������������������������������������������{��)������������{����댵�{�ބ�ތ��{�ބ��{��{��{��{��{��s��{��{��{�ބ�ތ�ތ���{��{��{��{��h��s��c��d�R{�R{�]s�d�*?P�������������������������������������ք��B{�B{�B{�Z��s��{��{��{����Ό��ƌ�Ƅ��s��c��d�d�d�]s�k��s��J{�B{�1s�B{�7v�B{�B{�1s�������{�����������k����������������������������ޘ�֜�ޘ�֝�Ō���{�����z���������������^)�^%�^%�^%�^%�d0��眽ޥ�ޭ�ӵ���������������Z!�^%�c%�^%�d0ǜ~������������������������������������������и����������(��������������������������������������������������������������������������������������������ޔ�猽ތ��{��{��{��{��{��s��s��{��{��s��s��s��{����������������������������������������������������������������������������������������������������JSU���������������������������������������������������{��)������������{��{�ޔ�ޫ������s���{��{�ք��s��ք��{�ބ��{�ބ�ތ�ބ�΄�ބ�ތ��{�ք��{��{��k��W��R{�R{�]s�]s�iw�*?P�����������������������������������Ό�Ό�Ƅ��B{�B{�B{�B{�1s�Z��|����ƌ�Ƅ�΄�ތ��{��{��c��d�d�]s�d�c��{��B{�B{�B{�B{�B{�B{�B{�J{�s�����{��{��{�����d������������������������ޔ�ޜ�甽ޔ�ތ�֔��������z�������������ʗ�|�^)�^%�^%�^%�d0��ޘ�֥�ʔ�ʥ�ʭ�ӽ���������^%�c%�^%�^%�^%ǜ~�����������������������������������Բ�����������������!��������������������������������������������������������������������������������������ޥ�ޜ�ޔ�ޔ�猽�{��{��{��{��s��{��s��s��{��{��{��s��{��{���������������������������������������������������������������������������������������������������JSU���������������������������������������������������{��)������������������������������������{��{��{��{��{��s��{��{��{��{��{��{�ք�ތ�ތ��{��{��s��{��k��W��W��]s�]s�]s�]s�*?P������������������������������{����Ό�Ƅ��{��B{�B{�B{�B{�7v�B{�7v�B{�g����Ό���{��{��k��d�d�]s�W��d�k��Gt�7v�B{�B{�B{�B{�B{�J{�s��{��{��k��{��{��]s������������������������ޘ�֜�ޘ�֘�֘�֥�ʠ����������������Ƙ�֜�ޘ�֙���wV�^%�d0��ޔ�ʌ�ƒ����Ɲ�ť�ʭ������^%�^%�^%�^%�^%ǜ~�����������������������������������ɶ����������������ޙ��JSU����������������������������������������������������������������������������������������ބ�ބ�ބ��{��s��s��{��s��s��s��s��{��s��s��s��{���������������������������������������������������������������������������������������������������JSU���������������������������������������������������{��)�������������������������������������{�ބ��{��{��{��{��{��{��{�ބ�ބ�ތ��ބ�ބ��{��{��{��c��c��d�]s�R{�Ns�]s�(:-������������������������������s��{��{��{��s��1s�B{�B{�B{�B{�B{�1s�1s�/o�{�Ό���{��{��s��c��d�d�d�d�c��s��g��M��B{�V��B{�V��B{�s��{��k��k��z��{��Ns���������������������������ބ�ޘ�֔�ޢ�ԥ�ֲ�������Ɛ����������Ɲ�ť�֥�����甭������ք��{��{��{��{����Ƣ�Բ���^%�c%�^)�^%�^%ǜ~�����������������������y��������и����и�������������������JSU������������������������������������������������������������������������������ތ���{��{��s��s��{��s��s��s��{��s��s��s��s��s���������������������������������������������������������������������������������������������������{��R{�R{�QduR{�QduHp�Ns�Hp�R{�Ns�Ns�Hp�Ns�R{�Ns�Ns�Ns�Hp�{��X}�R{�Ns�R{�*?P�����焭�{��{��{�ބ��������s��{��{��s�ք�ބ�΄��{�ބ�ބ��{�ތ��{�ތ��ք��{��s��c��d�]s�]s�R{�]s�]s�(:-������������������������������c��k��s��{��{��1s�B{�B{�B{�B{�1s�1s�1s�/o�{�Ό�ք��{��{��s��c��c��d�c��c��k��s��{�����{��Z��J{�B{�J{�s��z��iw�k��c��k��]s����������������������������Ό��֘�֥�֥���Z!�wV������{����ʔ�ޥ��������ޖ��΄��{��s��{����������ʲ���^%�c%�^%�^%�^%ǜ~������������������������s�y������JSU����������������������������������������������������������������������������������������������������������������֜�ތ�ބ��{��s��s��s��s��{��s��s��s��{�ބ��{��{��������������������������������������������������������������������������������������������������猽�{��s��{��{��k��k��h��h��g��g��g��s��g��k��g��k��h��s��{��s��s��{��{��������{�ބ��{�ބ��s��{��������{��{��{��{��{��{��{�ք��{�ތ��ބ���{�ބ�΄��s��{��s��c��d�]s�]s�d�d�*?P������������������������������d�d�s��k��c��J{�B{�1s�1s�1s�1s�/o�/o�%l�{��{���s��{��/o�/o�c��c��k��c��g��{��{����ƌ�Ό���g��J{�s��k��iw�d�k��c��R{�����������������������������Ζ�֖�֖�֔���Z!�Z!�Z!�d0�����Ƙ�ֵ���������ޥ�ޔ�ʌ��{��{��{��k���������������c%�^%�^%�^)�^%ǜ~������������������������fv|������������z�������������������������������������������������������������������������������������������������������֔�ތ��ք��{��{��{��s��s��s��s��s��s��s��s��{��{�ε�������������������������������������������������������������������������������������������������8Xq���������������������������������������������������{��s��s��s���������{��{��{��{���{��������s�ք��{��{��s��{�ތ�ք�ބ�ބ��{�ތ�ތ��{�ތ��{��{��g��s��c��d�]s�iw�iw�iw�*?P������������������������������]s�d�c��c��k��1s�1s�1s�1s�/o�/o�1s�%l�/o�h�����{��{�΄��/o�1s�1s�/o�J{�{��{��{����Ό�Ό����{��{��{��k��W��d�d�k��Qdu��������������������������ƌ��ƌ�ƌ����Z!�Z!�Z!�Z!�Z!�Z!�wV������������ތ�֔��{��{��c�����{��{����Ơ���c%�^)�^%�^)�^%�|J������������������������fv|���������������JSU�������������������������������������������������������������������������������������������������甽��֘�֔�甽猵�{��{��s��{��s��s��{�΄��s��s��{��s��s�����������������������������������������������������������������������������������������������甽�JSU���������������������������������������������������!{��s��{��{��{�ޔ��������{��s���{�ތ�������焵�{��{��{��{��{��{�ބ�ބ�ތ�猵�ތ�ƌ��{��{��s��{��g��d�]s�*?P]s�k��y��k��fv|%1���������������������R{�d�d�d�c��1s�/o�/o�/o�/o�/o�/o�%l�/o�h��{��{��{��{��/o�1s�1s�1s�1s�1s�J{�{�Ƅ�Ό�ƌ���ƌ��{��{��iw�d�]s�d�k��Qdu������������������������{��{����Ƅ��{�ΐ���Z!�Z!�Z!�Z!�Z!�^%�^%�������������ք�΄��{��c��z��s��{���������wV�^%�^%�^%�^%ǜ~������������������������fv|���������������*?P��������������������������������������������������������������������������������������������������甽ޜ�甽ޜ�猽ք�ބ��{��s��s��{��s��{��s��s��{��s��{�������������������������������������������������������������������������������������������猽ބ��8Xq���������������������������������������������������s��{��{��s��{�ބ��������������������������{��{��{��{��{�ބ��{��{�ބ�ބ�ބ�ތ�ބ�ތ�֖��{�΄��s��{��{��c��c�����������!ajnk��{��{��s��8Xq������������Ns�R{�R{�d�W��%l�f�%l�f�f�f�%l�f�/o�s��s��s��s��{��1s�1s�1s�1s�1s�B{�B{�B{�Z��{�Ό��ք��{��{��k��d�iw�d�d�d�H_t���������������������������k��{��{��|��{��{���Z!�Z!�Z!�Z!�Z!�Z!�^%��|������ޔ�ޖ�ք�����{��{��s��{��{�������ޥ�����ǜ~�|J�^%�|J������������������������fv|���������������JSU�����������������������������������������������������������������������������������������������眽ޜ���֜���猽ބ�ތ��{��s��{��{��s��{��s��{��{��s�ք��s�ֽ�����������������������������������������������������������������������������������甽ތ�ބ��*?P���������������������������������������������������{��{��{�ބ��{��{��{���������������������{��s�ք��{�ք��{��{�ތ��{�ք��{��{�ތ��{��ƌ��{��s��|��k��c��k�����������������*?Pk��������{��Qdu(:-������]s�R{�]s�]s�W��f�f�f�%l�f�%l�f�/o�f�k��k��h��{��s��1s�1s�1s�1s�B{�B{�B{�B{�B{�\����ք�Ό�ƌ��Qdufv|k��k��d�d�k��k��%)5���������������������{��k��c��k��k��|��{���Z!�Z!�Z!�Z!�Z!�Z!�^%��|������ޘ�֖��Ƅ��������{����������Ř�ֽ����������и�и������ɶ�����������������fv|���������������*?P������������������������������������������������������������������������������������������������甽ޜ�甽甽甽ތ��{��{��s��{��s��s��s��s��s��{��s��s��{�ޥ������������������������������������������������������������������������������甽ތ�ތ�ք��*?P���������������������������������������������������s��{��s�焵ބ��{��{��{�ք�ޥ���焽ބ�ތ��{��{��{��{��{�ބ��{�ބ��{�ք�ބ�ބ�ބ��{��{�����{��s��s��c��k��k�����������������������(:-d����{��|��R{�*?PNs�R{�]s�]s�R{�f�f�f�f�f�f�f�f�f�c��c��k��c��g��1s�1s�1s�1s�1s�7v�B{�B{�M��s�����{��Ƅ��*?P���)JSUd�d�k��{�����s��JSU������������{��{��d�d�c��s��s���Z!�Z!�Z!�Z!�Z!�Z!�^%��|�������֔�ތ�֗�|�c%�wV�����Ɣ����ʭ�ӽ����������������������ɲ�����������������ajn���������������*?P����������������������������������������������������������������������������������������������✽ޜ�甽ޜ�ބ�ތ�ք��s��{��s��s��{��s��s��{��s��{��s��{��s�֜�甽ޔ�猽֔�ޥ����������������������������������������������������������������甽ބ�ތ�ތ�ք��*?P���������������������������������������������������{��{��{��s��{�ބ��s�ք��{�ބ��s��{��{�������ℵ�{�ބ��{�ތ�ތ�ք��{�ք�ބ�ބ�ތ�ތ�Ƅ��{��s��|��g��k��c��c�����������������������������)Qduc��s��c��]s�R{�]s�d�Hp�f�f�f�f�%l�f�f�f�f�d�c��c��c��k��/o�1s�1s�1s�1s�B{�B{�V��M��Z�����{����΄��*?P���������*?PQdu���{���������Qdu!!1������z��k��d�W��d�k��{���Z!�Z!�Z!�Z!�Z!�Z!�^%��|��������֗�|�c%�c%�c%�d0�����ʽ�������������������������ɲ�����������������ajn���������������*?P���������������������������������������������������������������������������������������������ޔ�ޔ�ބ�ތ�ބ��{��s��s��{��s��{��s��{��{��s��s��{��s��s�֥�甽�{�ތ�ք�ތ�ޜ�����������������������������������������������������������֘��ތ��{��{�ބ��8Xq������������*?P8Xq{��s�ք��{��{��{�ޥ�������������������딽ބ��{��{�ތ�猽�{�ք�ބ�ތ�ք�ތ��{��{��{��k��k��k��k��k��{��������������������������������������H_td�fv|]s�]s�]s�d�Gt�Gt�/o�f�f�f�f�f�f�X}�W��X}�]s�c��/o�1s�1s�1s�1s�1s�B{�B{�B{�c��{�����{��{��*?P������������������)ajn{�ƌ���ތ��k��*?Pz��d�d�d�k��k������Z!�Z!�Z!�Z!�Z!�^%�^%��|��ޖ�֔�┱ʔ�▷֗�|�g%�c%�g%�g%�c%�^%�wV�����������������������ɲ�����и����������ajn���������������JSU�����������������������������������������������������������������������������������������������甽猵ބ��{�ބ��{��s��s��s��{��{��{��{��s��s��{��s��{��{�ޜ�猵ތ�ބ�ތ��{�ޔ�ޜ���֥�������������������������������������������������甽猽ބ�ބ�ތ��s��{��{��{�ބ��{��{��s��{�ބ��{��s�ք��{��s��Ns����������)s��s��s��{��{��s�֜��������������������������������������{�ތ��{�ބ�ބ��{�ބ�ތ��ƌ��{��{��k��c��k��k��k��k��������������������������������������JSUc�����*?PR{�]s�c��c��|��|��J{�/o�f�f�f�f�R{�R{�R{�X}�W��/o�1s�1s�1s�B{�B{�B{�B{�V��Z��h��h��{��{��%)5���������������������������JSU��Ζ�֖��{�����z��k��iw�k��k��k������Z!�Z!�Z!�Z!�^%�^%�^%�wV��֔�������ƌ�Ɩ�֗�|�g%�g%�g%�g%�c%�g%�^%�����������������������ɲ��������и�������fv|���������������JSU����������������������������������������������������������������������������������������������甽猵�{�ޔ��s��{�ބ��{��s��{��{��s��{��{��s��{��s��s��s�֭�ތ�ތ�焵�{�ތ�猽ތ�ޔ�ޥ���������������������������������������������ޜ�猽ޔ�ބ��{��{��{��{��s��{��s��s��{��{��{��{��{��{��{��{��{��s�����������*?Ps��{��s��{��{�ބ��{��{��{�ބ��{�ތ��{�������ޔ�������猽��ք�ތ��{�ތ�Ό��ƌ��{��{��k��c��d�iw�iw�k��������������������������������������8Xqz�����������8Xqk��k��g��{��{��s��/o�f�f�R{�]s�R{�]s�d�/o�1s�1s�1s�1s�1s�B{�Z��V��Z��k��s��{��{��*?P������������������������������s������{��{��{��iw�k��d�iw�{��{���^%�Z!�Z!�Z!�^%�^%�^%�wV��ʠ�����{����ƌ�Η�|�c%�g%�g%�g%�g%�g%�c%���������������������ajn���и�и����������������z�����������JSU���������������������������������������������������������������������������������������������┽ޔ��{��{��s��{��{��s��s��s��s��{��s��s��s��s��s��s��s�Θ�֔�ތ�ބ�ބ�ތ�ބ��{�ޔ�ޔ������������������������������������甽ޔ�ބ�ބ��{�ތ��{��s��{��s��s��s��s��s��s��s��{��{��{��s��{��s�����������������s��{��{��s��{��{��{��{��{��{��{��{��{��������{��������{�ތ�ք�ތ�ք�ބ�ތ�ތ���{��{��{��d�iw�d�d�iw�iw�������������������������������������JSUk�����������������*?Ph��{��{��{��|��c��Hp�]s�Ns�R{�R{�]s�/o�%l�1s�1s�1s�J{�B{�B{�V��Gt�k��c��d�k��*?P������������������������������|����Ό�ƌ��{��{��z��d�k��c��{���������wV�Z!�^%�^%�^%�^%�wV���z�����{��{����Ɨ�|�g%�^%�g%�g%�g%�g%�c%������������������������(:-���������������������������%)5(:-��������������������������������������������������������������������������������������������电⌵ք��s��s��{��s��s��s��s��s��{��s��s��s��s��{��{��{�Υ���猽�{�ތ�ք�ބ�ތ�ތ�ք�ޔ�ޥ�����������������������������������ތ�ތ��{��s��{��{��k��Z��Z��g��Z��Z��k��Z��Z��Z��c��Z��X}�%1���������������d�{��{��s��{��{��{�ބ��{��{��s��{��s��������{�������넵�{�ބ�ބ�ތ�ތ�ތ�ތ��ƌ��{��{��k��iw�iw�Ns�]s�d�������������������������������������JSUz��������������������������%1H_t{��|��g��c��]s�R{�R{�R{�R{�/o�1s�1s�1s�1s�1s�B{�B{�V��Gt�d�d�d�iw�)9������������������������������s�����΄�΄��{��{��k��z��{�������������֘�֙���wV�^%�^%�wV{��z��k��k��s��{����|�g%�g%�c%�c%�g%�g%�c%������������������������������!ajn�����������������������������������������������������������������������������������������������������������������ޔ�ތ�ތ��{�ބ��{��{��s��s��s��s��s��s��s��s��s��{��{��{��{�֥���焵ތ�ք�ތ�ބ�ތ�ތ��甽ޜ�ޜ��������������������������甽猽ބ�ބ��{��{��{��{��{��*?P������������������������������������������������������8Xq{��{��{��{��{��{�ޜ�������������������딽ބ�ބ��{�ބ�ބ�ބ�ތ�ތ���Ό��{��k��k��iw�d�fv|]s�iw�������������������������������������*?Pk��������������������������������*?PR{�d�]s�R{�R{�Ns�]s�/o�1s�1s�1s�7v�B{�B{�B{�V��Gt�R{�]s�R{�d�%1������������������������������s�������{���wV�wVy��{�������������Ό�Ζ�֜�眽ޝ�ŧwV�wV{��k��k��s��z��{����|�g%�g%�g%�g%�g%�g%�c%���������������������������������������*?P�����������������������������������������������������������������������������������������������������������ޔ�ބ�ބ��{��s��s��s��s��s��s��{��s��s��{��s��{��s��{��{��s�֭�ӥ�甽ބ�ބ�ބ�ތ�ތ�ޔ�┽ޔ�ޔ���ޘ�֥������������������������猽�{�ք�ބ��{�ބ��{��*?P������������������������������������������������������8Xq{��s��{��{��{����������������������������������댵�{��{�ތ�ބ�ތ�ތ�ޔ�ތ��ƌ��{��{��k��d�]s�]s�]s�iw�������������������������������������*?Pk��������������������������������������R{�Ns�8XqR{�R{�]s�W��Z��J{�/o�1s�7v�B{�B{�M��X}�]s�Ns�Ns�]s�%)5������������������������������s�����ք�Ό�Ƽd0�^%�^)�wVy�����{����Ɣ�ʌ��֢�Ԗ���{��k��z��k��k��k��{���wV�g%�p.�g%�g%�g%�g%�p.����������������������������������������������������������������������������������������������������������������������������������������������������甽甽ބ��{��{��s��{��s��{��s��s��s��s�ք��s��s��s��s��{��{�ք�Υ�����焵�{�ބ�ބ�ތ�ތ�ތ�ޔ�ޜ���������������������������甽猽ބ��{��{��{��{��{��s��*?P������������������������������������������������������X}�s��{��{��{��������������������������댽ބ�ތ�ބ�ބ�ބ�ބ�ތ�ޔ�ތ�֖���s��{��c��d�d�]s�]s�]s�������������������������������������*?Pd�������������������������������������Qdu*?P���!8XqNs�c��k��s��{��Z��J{�B{�B{�V��Gt�R{�]s�Ns�]s�!!1������������������������������{����Δ�ʌ�ƌ�μd0�^%�^%�^%�^%�d0�����Ɩ���֔�ތ���{��|��c��iw�d�z������wV�p.�g%�g%�{1�p.�g%�p.и�����������������������������������������������������������������������������������������������������������������������������������������眽ޘ�֔�甽ތ�ތ�ք��{��{��s��s��s��s��s��{��s��{��s��s��s��{��{��{��s�֜�甽ޔ�猽ބ�ބ�ތ��ތ�ޔ�甽ޜ���ޜ�ޥ���������������������猽猽ք��{��{��{��{��{��s��*?P������������������������������������������������������s��{�ބ��s��s��������{�ބ�΄��s��{�ބ��������{�ބ��{�ބ�ތ�ތ�ތ�ތ�ތ�ބ�ޔ�ތ��{��{��{��k��d�]s�d�R{�d�������������������������������������*?Pc�����������������������������������������Qdu*?P���������*?Pc��{��{�΄��{��k��J{�B{�Gt�R{�Ns�R{�R{�%1������������������������������s�������Ό�֔�d0�^%�^%�^%�^%�^%�^%�Z!��|��Ɯ�ޜ�由ʌ��{��c��c��d�y��k�������|�g%�p.�p.�p.�{1�{1�C�����Ų������������������������������������������������������������������������������������������������������������������������������������������甽ޔ�ޔ�ބ�ބ�ބ��{��{��{��s��{��s��s��{��s��s��{��s��s��{��s��{�ޥ�����猵ք�ތ��ތ�ޘ�֔�ޜ�ޜ�ޜ���ޜ�������������������ޜ�甽焵�{�ބ��s��{��{��s��{��*?P���������������������������������������������������%)5���{��s��{��{������{��{��{��{�ތ��{�ޫ�댽�{��{�ք�ތ�ތ�ޔ�猵ބ�ޔ���疷֝�Ō��{��{��z��k��d�d�R{�iw�������������������������������������*?PR{�������������������������������������8Xq*?P���������������*?P{�����{��k��c��X}�R{�R{�Ns�Ns�Ns�!������������������������������z��{��{�������ּd0�^%�^%�^%�^%�^%�^%�^%�c%��|��ޭ�ޥ�֠�����{��y��k��k��s������������|J�p.�{1�C�C�C������и���������������������������������������������������������������������������������������������������������������������������������������֜�ޔ�ތ�ތ�ތ��{��s��s��s��{��s��s��s��s��{��{��{��s��s��s��{��s�֥�����ޔ�ޘ��ތ�猽ތ�֜�������ޜ����������������������ތ�ޔ�焽ތ��{��{��s���s��s��*?P���������������������������������������������������k��{��s��s��s��{��s��s��{�ބ��{��{�ތ��{��{��{�ބ��{�ބ�ތ��{��{��{�ތ�ޔ�猵֖���{��{��{��{��k��iw�iw�d�iw�)������������������������������������%)5R{�������������������������������������d�*?P���������������������������{��{��k��d�R{�R{�Ns�Ns�]s�!������������������������������c��k��{��{��{�μd0�^%�^%�^%�^%�^%�^%�^%�c%��|������ޥ�ʌ��{�����z��k��z�����������������и��p.�C�C���������������������������������������������������������������������������������������������������������������������������������������������֜���甽猽��{�ތ��{��s��{��{��s��s��s��{��s��s��s��s��{��{��s��s�ֵ�����֔���֔�ތ�ތ�ޘ�֔�ޘ�֥�������������������������甽猵�ބ��s��s��s��s��{��{��8Xq���������������������������������������������8Xqs��{��{��s��{��{��{��{��{��{��{��s��{��{�ޠ�������⌽ބ��{��{��{�ތ��{�ޔ�ތ�ޔ�ޔ�ތ�ƌ��{��{��k��k��d�d�d�iw�d�Qdu*?P���������������������������%)5Ns�������������������������������������H_tJSU������������������������������8Xqd�d�]s�R{�Ns�]s�)������������������������������d�z��c��k��{���d0�^%�^%�^%�^%�^%�^%�^)�c%�������ӥ�֖�֧wV�d0�wV{�������������ʭ�ӽ�����������и��wV��������������������������������������������������������������������������������������������������������������������������������������ޥ�����֜�ޘ�֔�ޔ�ބ�ތ��{��s��s��s��s��s��s��s��{��{��{��{��s��s��{��{��{������������ޔ���甽ޘ�֘�֜�������������������������猽ޘ�ք��{��{��s��{��{��s��s��s��s��h��h��g��h��8Xq������������)9Z��{��{��{��{��{��{��s��s��s��{��{��{��{��{��{��{���������{��{��ք��{�ތ��猽ބ�ޔ�猽ޖ��ƌ�ƒ��{��y��c��k��k��d�*?Pd�iw�d�8Xq!���������������������!!1Ns����������������������������������������H_tQdu������������������������������������*?Pd�]s�]s�Ns�R{�Qdu!!1���������������������������iw�c��iw�k��{���d0�^%�^%�^%�^%�^%�c%�c%�c%�����ޘ�֘��֧wV�g%�g%�^)�|J��������ʽ�������������������ɲ�����������������������������������������������������������������������������������������������������������������������������������������������ޔ�ޔ�ތ�猵ބ��s��s��{��s��{��s��s��{��{��s��{��s��{��{��s��s��s�֫�����������֜�����������������������������������ބ�ތ��{��{��{��{��s��{��s��s��{��{��s��H_t������������������������������)c��s��{��{��s��{��{��{��{��{��{��{��{�ބ�ބ��������섵ތ�ք�ތ�ބ�ބ�ބ�ތ�ތ�ތ�ތ���ƌ��{��{��{��z��k��z��iw����(:-Qduc��k��Ns�*?P������������(:-R{�������������������������������������Ns�Qdu������������������������������������*?Pk��JSU!!18Xq]s�]s�d�d�JSU!������������������d�d�k��iw�c���d0�^%�^%�^%�c%�^%�^%�c%�c%�����Δ�ʌ�֘�֧wV�g%�g%�{1�g%�p.�|Jǜ~��������������������ɲ�����������������������������������������������������������������������������������������������������������������������������������������֔�猽ބ��{��s��s��{��{��s��s��s��{��s�ք��{��{��s��s��s��{��s�֥���������ޔ�ޜ���ޜ�����������������������������甽ބ��{�ތ��s��s��s��s��{��{��s��s��s��*?P������������������������������������������Hp�s��{��s��{��{�ބ��{��{��{��{�ބ��{��{��{�ޜ�焵�{�ބ�ތ�ބ�ބ�ބ�ބ�ތ�ބ�ތ�ތ���{�Ό�Ƅ��s��{��k��k��z��]s�������������!H_tc��c��X}�JSU)������*?PHp�������������������������������������H_tH_t������������������������������������*?Pk��*?P������*?P]s�s��{�����c��*?P������������iw�d�iw�k��c���d0�c%�^%�^%�^%�c%�c%�c%�c%�wV��Ɣ����Δ�ʧwV�{1�{1�{1�{1�p.�{1�{1�{1ǜ~��������������ɲ���������������������������������������������������������������������������������������������������������������������������������������ޥ�甽ޔ�⌽ބ��{��s��s��s��{��{��s��{��{��s��s��{��{��{��s��s��{��s�Ϋ���������������甽����������������������ޥ���甽ތ�ތ�ބ�ބ��{��{��s��{��{��{��s��s��*?P������������������������������������������������W��{��{��{��{��s��{��{��{��{��{��s��{��{��{��{�ތ��{��{�ތ�ތ�ބ�ބ��{�ތ�ބ�ތ��Ό�ք��{��|��{��c��k��z��]s�������������������*?PNs�W��d�8Xq!!1JSUR{����������������������������������������H_t8Xq������������������������������������*?Pc��JSU���������������%)5Ns������֢��{��JSU���]s�k��k��]s�k���d0�^%�c%�^%�c%�c%�c%�c%�c%s�y|�����{����ƧwV�p.�p.�{1�{1�{1�p.�{1�{1�wV�����������ޙ��fv|������������������JSU����������������������������������������������������������������������������������������������������������������眽ޔ�猵ތ��{��{��s��s��{��s��{��{��{��{��{��{��s��s��{��s��{��s��s�֥�����������������眽ޜ�������眽ޥ�����������甽ތ�ք�ބ��{�ބ��{��s��{��s��s��s�ք��s�����������������������������������������������������)s��{��s��s��{��{��{�ބ�ބ��{�ք��s�ք��{��{�ތ��{��{�ބ�΄�ތ��ք��{�ބ��{����{�����{��k��{��k��k��Qdu���������������������������!8XqNs�]s�R{�fv|)������������������������������������8Xq8Xq������������������������������������*?Pk��8Xq���������������������8Xq�����ƌ��{��Qdud�d�d�iw�c���d0�^%�^%�c%�c%�c%�c%�c%�g%�wV{��k��{��{���wV�{1�g%�C�C�{1�{1�C�C�|J������������y��������(:-fv|��������������⛬�(:-��������������������������������������������������������������������������������������������֘�֜���������甽ޔ�猽�{�ք��{��s��{��s��{��s��s��{��s��{��s��{��s��s��s��s��s�Ό��֜�ޜ�����������ޔ�ޜ���������������������ޔ�ބ��{�ތ��{��{��{��s��{��s��s��{��s��*?P������������������������������������������������������g��{��{��s��s��{��{��s��{��{��{��{��{��{��{��{��{��{��s���{�ބ�ތ�ք��{�ތ��ƌ��{��{�����c��z��k��k��8Xq������������������������������������*?PH_t]s�k��H_t!!1������������������������������8XqH_t������������������������������������%1k��JSU������������������������������%)5iw�{��z��c��k��iw�d�c���d0�c%�c%�c%�c%�c%�c%�^%�g%�wVc��c��k��k���|J�g%�C�C�{1�C�C�C�C�|J������������y��������������fv|������������������ajn������������������������������������������������������������������������������������֜�����猵ތ�ޔ�ޔ�ތ��{��{��{��s��s��s��{��s��{��{��{��{��{��s��s��s��{��{�֔�猵֔�甽������������֥�����������֥�������ޔ�ޔ�猽�{�ތ��s��{��{��s��s��s��s��s��{��)������������������������������������������������������H_ts��s���s��{��{��{�ބ��{��{��{��{��{��{�ք�ބ�ބ�ތ��{�ތ��{�ތ�ބ�ބ��{���{��{��{��z��k��k��k��k��*?P���������������������������������������*?P/o�Gt�]s�d�k��JSU���������������������H_t8Xq������������������������������������)c��JSU������������������������������������k��]s�Qdud�iw�d�iw�{������wV�c%�c%�c%�g%�g%�g%s�yW��d�iw�k���|J�C�C�C�C�C�C�C�C�|J������������y�����������������������JSU�����������������������������������������������������������������������������������������������������������ޜ�ޥ�甽ތ���ޔ�焵ބ��{��s��{��{��s��{��s��s��s��s��s��{��s��s��{��{��s��ޔ�猽ޔ�眽ޜ���������������֥�����������甽ތ�ք��{�֔��{�ބ��{��s��s��s��{��s��s��{��)������������������������������������������������������8Xq{��{��{��s��{��{��{��{��{��{��s��{��{��{�ބ��{��{��{�ތ��{�ބ�΄�ތ��{�ք�ބ��{��{��{��k��d�d�d�iw�)���������������������������������������8Xq1s�1s�1s�/o�X}�d�k��Ns�%)5���������������H_t8Xq������������������������������������d�8Xq������������������������������������k��fv|���!fv|{����������ʥ�ʙ���^)�c%�^%�g%�wVW��]s�d�k���wV�C�{1�C�C�C�C�C�{1�|J������������s�y���������������������������!�������������������������������������������������������������������������������������������ޥ�����ޘ���ބ�ތ��{��{��{��s��{��s��{��s��s��{�΄��s��s��s��s��{��s��{��{��s�֔�甽甽��֜���ޜ�����������������������֔�焵ބ�ބ�ތ��s��{�ބ��{��{��{��s��s��{��{��s��)���������������W��k��s��{��s��s��g��8Xq���������������H_t{��{��{�ބ��s��{��{��{��{��{��{��s��{��{��{�ބ�ބ�ބ�ބ��{�ބ�ބ�ބ�ތ��ք��{�����s��c��d�]s�]s�d����������������������������������������Hp�1s�1s�1s�1s�1s�B{�J{�c��c��]s�*?P������H_t8Xq���������������������������������)d�JSU������������������������������������k��d�������������!ajn�����ť�ʌ�΄�ƙ���d0�g%�wVd�d�iw�d��|J�C�p.�C�C�C�C�C�C�|J��ʶ��������fv|�����������������������������������������������������������������������������������������������������������������������������֔�ތ�ބ�ބ��{��{��s��s��s��s��{��s��s��s��s��{��{��s��s�΄��{��s��s��s��s��{�ޔ�猽ޔ�┽ޜ�������������������������ތ�ք��{��{��{��{��s��{��{��s��{��s��s��{��s��{��%)5������������R{�{��{��s��s��s��{��{��s��H_t������������R{�s��{��{��{��{��{��{��{��{�ބ��s��{��s��{��{��{��{�ބ��{�ބ�ބ�ބ�ތ��{��{�΄��{�����k��k��]s�]s�]s�]s����������������������������������������/o�7v�1s�1s�1s�B{�B{�B{�B{�J{�Gt�W��R{�8Xq!H_tH_t���������������������������������)d�JSU������������������������������������k��d����������������JSU������Ν��{��z��y��k��iw�d�d��|J�C�C�C�C�C�C�C�{1�|J������������fv|��������������������������������������������������������������������������������������������������ޫ�������������������ޜ�����֜�ޔ�ބ��{�ބ��{��{��s��s��{��{��s��s��s��s��{��s��s��{��{��{��s��s��{��s��s��s�֔�ޜ����ޔ���������������������ޜ�ޔ�ތ��{�ބ��{��{��{��s��{��{��s��{��s��s��s��s��{��{��R{�������������{��s��s��s��s��{��{��s��s��{�����������{��{��s��{��{�ք��s�ք��{��{�ބ�ބ��{�ք�ބ�ބ��{��{�ތ��{��{�ބ�ބ�ބ�ބ�ތ�ք��{��{��k��d�]s�R{�]s�R{�������������������������������������������/o�1s�7v�7v�B{�7v�B{�B{�B{�B{�B{�Z��Gt�R{�R{�Ns�H_t������������������������������������!!1]s�JSU������������������������������������c��d�����������������������*?Py����ʒ�����k��iw�d�]s�d��|J�C�{1�C�{1�C�{1�{1�C�|J������������ajn��������������������������������������������������������������������������������������������������������������������������ޔ�ތ�ތ��{�ք�ބ��{��s��{��s��s�ք��s��s��{��s��{��s��s��s��s��s��s��{��s��{��{�Δ�猽ޔ�ޘ�֘�֜�ޜ���������������ޔ���֔�ތ��{�ބ�ބ��{��{��s��{��{��s��{��s��s��s��{��s��{��s��*?P���������8Xqs��s��s��s��{��s��{��{��H_t���������H_ts��{��{�ք��{��{��{��s��{��{��{��{��{��{��{��{�ބ��{�ބ�ބ�ބ�ބ�ތ�ք��{��{�΄��{��k��z��d�d�]s�Ns�Ns����������������������������������������1s�B{�7v�B{�B{�B{�B{�B{�B{�B{�V��V��V��V��J{�Hp�Ns�R{�H_t)9������������������������]s�JSU������������������������������������d�d�������������������������������JSUc��iw�k��iw�d�k���wV�|J�{1�{1�{1�{1�{1�C�C�|J������������ajn��������������������������������������������������������������������������������������������������������������������ޜ���甽ޔ�ތ�ބ��{��{��s��{��s��{��{��s��s��{��s��{��{��s��{��{��{��s��s��s��{��{��s��s�֔�甽ޔ�ޔ�ޜ���������������������猽ޔ�猽ބ�ތ�ތ��{��{��s��{��{��{��{��s��s��{��s��{��{��k��g��%1���������)H_tH_tH_tH_t8Xq8Xq*?P���������H_tQdu8Xq8Xq8Xq8XqQdug��{�ބ��{��{��{��{��{��{��{��{�ބ�ބ��{��{�ބ�ބ�ք�ބ��{��Ƅ��s��k��d�]s�]s�Ns�8Xq���������������������������������������7v�B{�1s�1s�B{�B{�B{�B{�B{�B{�B{�M��V��\��V��g��V��W��W��X}�]s�*?P������������������]s�JSU������������������������������������d�d����������������������������������! k��%)5Qdud�k��z��{�����ǜ~�|J�p.�{1�{1�C�C�|J������������ajn����������������������������������������������������������������������������������������������������������������������֔�猽�ބ��{��{��{��{��s��{��{��s��s��{��s��{��s��{��s��s��{��{��s��{��s��s��s��s��{�֔�甽��֜�����֜����������������ޔ�猽ޔ�ތ��{�ބ�ބ��{��{��s��s��{��s��s��s��{��{��{��{��*?P������������������������������������������������������������������������R{����{��{��{��{��{��{��s��{�ބ��{��{�ތ���{�ތ��{���{�֒��{��k��d�]s�]s�Ns�R{�8Xq���������������������������������������B{�B{�J{�1s�B{�B{�B{�B{�B{�B{�B{�B{�\��g��g��g��g��g��g��c��iw�d�c��Hp�)������������d�8Xq������������������������������������Ns�W�����������������������������������8'd�!��� JSUy����������ҽ�����ǜ~�C�C�C�|J������������ajn���������������������������������������������������������������������������������������������ޜ�����ޥ���ޜ�ޜ���֥����ތ�ބ�ތ�ތ�猽ބ��s��{��{��s��s��s��{��{��s��{��s��s��s��s��s��s��s��{��s��s��s��s��{��s�֔�ޘ�֔�ޔ�ޜ�ޜ�ޥ�������������甽甽ޔ�ޔ�甽ތ�ބ�ތ�ބ��{��{��s��{��{��{��s��{��{��s��s��s��*?P������������������������������������������������������������������������Ns���ބ�ތ��{��{��s��s��{��{��{�ބ��{��{��{�ތ�ތ�ބ�Ό���{��{��k��W��]s�]s�Ns�R{�*?P���������������������������������������)B{�B{�B{�B{�B{�B{�B{�M��B{�\��B{�g��g��k��g��s��g��s��s��s��g��h��g��k��k��d�%)5���������iw�JSU������������������������������������Ns�fv|���������������������������������! c��%)5������������(:-�����������������и��|J�|J������������ajn��������������������������������������������������������������������������������������������ޘ�֖�֜�眽ތ�ޔ�ތ�ޜ�甽甽ތ��焭ތ�ք��{�ތ��{��s��{��{��s��{��{��{��s���{��s��s��s��s��{��{��s��s��{��{��{��s��s�Μ�甽ޜ�ޘ�֜�ޘ�֜�������������ޜ�ޜ�ޔ��{�ތ�ޔ�猽ބ�ބ�ބ��{��{��{��{��s��s��s��{��{��{��{��*?P������������������������������������������������������������������������Ns�{��{��{��{�ތ��{��{��{�ބ��{�ք��{�ތ�ތ��ތ�ք�ޖ��ք�����c��d�Ns�R{�Ns�]s�)���������������������������������������!9B{�B{�B{�B{�B{�B{�B{�V��Z��Z��g��g��g��s��h��h��s��s��{��s��k��h��g��g��g��iw�k��fv|Qdu)iw�8Xq������������������������������������Qdu]s����������������������������������! z��%)5�����������������������������ɶ��������������������JSU�������������������������������������������������������������������������������������������甽��֘�֜�ޔ�猽�{�ބ�ބ�ތ�ޔ�猽ބ��{�ބ�ބ�΄��{��s��s��{��s��s��{��s��{��{��{��{��s��{��{��{��s��{��s��s��s��s��s��s��s�֜�甽ޜ�����ޜ�����������������甽猽ތ�ތ�ޔ�猽ތ���{��{��{��{��s��{��{��s��s��s��{�ք��*?P������������������������������������������������������������������������Hp����{�ބ��{��s��{��{��{��{��{�ތ�ބ�ޔ�焽ތ�ތ�ޘ���Ƅ��{��c��W��]s�R{�R{�Ns����������������������������������������*?PB{�B{�B{�B{�B{�B{�M��M��B{�g��g��k��s��{��{��{��{��{��{��h��s��g��g��g��\��B{�J{�d�iw�iw�y��Qdu������������������������������������Qdu]s����������������������������������! z��%)5������������������������JSUy�����������������������ajn���������������������������������������������������������������������������������������������ޜ�甽ޔ�ތ��{��{�ބ��{�ތ��{��{��{��{�ބ�΄��{��s�ք��{��s��s��s�ք��s��s��s��{��s��s��{��s��s��s��s��s��s��{��{��s��s��s�֜�ޜ�ޜ�ޜ�ޜ�������������������ތ�ތ�猽ޔ�ޔ�甽ތ�ބ�ބ�ބ��{��s��s��{��s��{��s��s��{��s��*?P������������������������������������������������������������������������Hp�{�ބ��{��{��{��{��{��{��{��{�ބ�ބ�ތ�ތ�ޔ�ޔ�ތ�֘��ք��|��k��]s�R{�R{�R{�Qdu������������������������������������������8XqV��B{�B{�B{�B{�B{�M��V��\��h��s��{��{��{�΄��{��{��{��{��s��k��g��g��\��\��g��V��M��J{�c��iw�y��R{�JSU���������������������������ajnfv|���������������������������������d�%)5���������������������������������8'������������������ajn����������������������������������������������������������������������������������������眽ޔ�甽ޔ�甽焵�{��{�ބ��s��{��s��{�ބ��{��{��s��{��s��{��s��s��s�ք��s��{��s��s��s��s��{��{��s��{��s��s��{��s��s��s��{��{��s�֔�ޜ���ޔ�ޜ�������������������ޔ�猽�{�ތ�ތ�ޔ�ތ�ތ��{��{�ތ��{��{��{��s��s��s��{��s��s��*?P������������������������������������������������������������������������Ns�{�ބ��{��s�ք�ތ��{��{��{�ބ��{�ތ�眽ޔ�甽ޜ�ޔ�ޘ���{��{��iw�d�Ns�Ns�Ns�H_t������������������������������������������8XqM��B{�B{�B{�M��B{�V��Z��Z��h��k��{��{�΄�΄�Ό��{��{��s��h��s��g��g��Z��V��V��V��Z��M��B{�7v�M��d�y��z��Qdu(:-���������������������ajn]s����������������������������������d�%)5�������������������������������������y��ajn������������ajn%)5��������������������������������������������������������������������������������������ޔ�ތ�ތ��{��{�ބ��{��s���{��s��{��s��s��{��s��s��{��s��{��{��{��s��s��s��{��s��{��s��s��s��s��s��s��{��{��s��{��s��s�֜�甽ޜ�������������������甽ޜ�ޔ�ބ�ބ�ތ�ތ�ތ�ބ�ބ�ބ�ބ��s��{��{��{��s��s��s��{��{��{��8Xq���������������R{�{��{��{�ބ��{��{��{��{��{�ք�ތ�ތ�ޔ�ޖ��֘�֔�ތ�֔��{��k��c��]s�Ns�Ns�R{�8Xq������������������������������������������Gt�V��M��M��V��V��M��Z��\��k��h��{��{��{�΄�΄�΄��{��{��s��g��g��g��g��Z��Z��M��M��M��B{�B{�B{�B{�*?P!!1iw����������JSU������������ajn]s�������������������������������������d�%)5�������������������������������������fv|��� JSUy��������������JSU��������������������������������������������������������������������������֜�甽ޔ�焵ބ�ތ�ք��{��s��{��{��s��s��s��{��{��s��{��s��{��s��{��{��{��s��{��{��s��s��{��s��s��s��{��s��s��{��{��s��{��{�Θ�֜�ޜ�ޥ���������������眽ޜ�ޜ�焵ބ��{�ތ�ބ�ބ�ބ�ތ�ތ��{��{�ބ��{�ބ��s��{��s��s��{��{��{��s��s��{��s��R{�!!1���������������H_tk��s��{��{��{��{��{��{��{��s��{�ބ�ބ��{��{��{��{��s��{��{��{�ބ�ބ�ބ�ތ�ޜ���֘�����{��{��d�]s�]s�Ns�Ns�%)5���������������������������������������Z��V��M��B{�M��V��M��g��g��k��{��{��{��{�΄�Ό��{��{��{��s��g��k��g��g��V��M��M��B{�B{�J{�B{�B{�7v�8Xq������!ajny��������iw�%)5���fv|iw�������������������������������������Ns�%)5�������������������������������������s�y������������%)5iw�������������ajn!�����������������������������������������������������������������֔�ޔ�⌽֔�ތ�ތ�ބ�ބ��{��{��{��{��{��s��{��s��s��{��s��s��{��s��{��{��s��s��{��{��{��{��{��s��{��s��{��{��s��s��s��{��{��{�ޥ�甽ޥ�ޥ�������������������猽ބ�ތ��{��{�ތ�焭ބ�ތ��{��{��{��{��{��{��{��s��s��{��{��{��{��s��s��g��������������������������������Hp�{��{��{��{��{��{��{��{��s��{��{��{��{��s��{��{�ތ��{��{�ތ�ބ�ތ�ޔ�ތ�甽ޔ�ޘ��ƌ��{��c��c��R{�R{�R{�Ns�)���������������������������������������g��\��\��B{�B{�M��g��g��g��s��{��{��{��{�΄�΄��{��{��{��s��s��k��g��g��V��Z��Z��\��B{�B{�B{�7v�7v�8Xq���������������! ajn���������JSUfv|d�������������������������������������]s�%)5�������������������������������������y�����������������������8Xq�����������*?P�����������������������������������������ޘ�֔�ޔ�ޔ�ޔ�ޜ�ޔ�甽甽ތ�ތ��{��{��s��{��{��s��s��s��s��s��s��{��s��{��s��s��s��{��{��s��s��{��s��s��{��s��{��s��{��{��s��s��{��{��{�Μ�������������������������ތ�甽猭�{��{��{�ބ�ބ��{�ބ�ތ�ތ��{��{��{��{��{��s��s��{��s��s��s��Z�����������������������������������������8Xq{��{��{��{�ތ��s��s�ք��{��s��{��{�ތ���{��s��s�ք�ބ�ބ�ތ��ޔ�甽猵�Ƅ��{��{��c��d�R{�Ns�fv|Ns�������������������������������������������*?Pg��B{�g��B{�B{�B{�M��g��h��{��{��{��{��{�΄��{��{��{��s��g��g��k��g��g��g��Z��B{�B{�J{�B{�B{�B{�1s�8Xq������������������������PN)������z��k��!������������������������������������fv|%)5�������������������������������������iw����������������������������!�����������������������������������������������������֥���甽��ބ�ތ�ޔ�ޖ�֜�猽ޔ�猽�{��s��s��{��s��s��{��s��s�΄��{��{��s��s��s��s��{��{��s��s��s��s��{��s��{��s��{��{��{��s��s��{��{��s��s�֥�����������������������甽ތ�焵�{��s��{��{��{��s��{��s��{��{��{��{��s��{��s��{��{��s��{��{��{��������������������������������������������Hp�{��{��{��{��{��{��{��{��{�ބ��{��s��{��{��{�ބ��{�ބ�ބ�ބ�ތ�ތ�ތ��ބ�΄�΄��{��d�d�R{�R{�Ns�H_t������������������������������������������*?Pg��\��\��g��\��\��\��g��h��{��{��{��{�΄��{��{��{��{��s��g��g��g��g��V��\��M��B{�B{�B{�B{�7v�J{�1s�8Xq�������������������������������O&�wV���iw�!!1������������������������������fv|%)5���������������������������������������iw����������������������������������JSU��������������������������������������֜�ޔ�甽ބ�ތ�ތ�ޔ���ޘ��ބ�ތ��{��{��{��s��{��{��s��{��s��s��s��{��s��{��{��{��{��s��s��{��{��{��{��s��s�ք��{��s��s��{��s��s��s��{��{�Υ���������������������ޜ���ք��{��{��{��{��{��{��s��s��s��{��{��s��{��{��{��s��{��{��s�ք��s��*?P���������������������������������������������{��{��{��s��{��{��{��{�ބ��{�ބ�ބ�ބ��{��{��{��{��{�ބ�ބ�ބ�ބ��{��{���{��{��k��d�d�]s�]s�Ns�*?P������������������������������������������8XqV��V��Z��Z��Z��g��g��g��s��{��{��{��{��{��{��{��{��s��k��s��g��g��\��V��Z��M��B{�B{�B{�B{�B{�7v�7v�8Xq�������������������������������O&�^%�^)�wV���y��ajn���������������������������fv|%)5���������������������������������������������������������������������������������z����������������������������������甽眽ޔ�猵ք�ތ�ބ�ތ�ތ�ޜ�ޔ�ތ���{��{��s��s��{��{��{��s��{��s��{��{��s��s��s��{��s��s��{��{��s��s��s��{��s��s��{��s��{��{��s��{��{��s��{��s�֥�������������������ޘ��ތ�ތ�ބ�ތ�ք�ބ��{��s��{��s��s��{��{��{��{��s��s��{��s��{��s��s��k�����������������������������������������������������8Xq{��{��{��{��{��{�ބ�ތ��{��{��{��{�ބ��{��{�ބ�ބ�ބ��{��{�ތ�ބ�ތ��Ƅ��{��k��d�d�Ns�Ns�fv|%)5������������������������������������������Hp�M��V��V��V��V��g��g��k��s��s��s��{��{��{��{��s��s��s��k��k��h��g��V��V��V��V��B{�B{�7v�B{�B{�1s�7v�8Xq�������������������������������O&�^%�^%�^%�^%�d0�wV���fv|(:-���������������fv|%)5���������������������������������������y�����������������������������������������Qdu����������������������������֜�ޜ���ބ�ތ�ބ��{��{�ތ�ޔ�ޘ�֘�ք�ބ�ބ�ބ��{��{��s��{��{��s��{��s��{��s��s��{��{��{��s��s��s��s��{��s��s��{��{��s��s��s��{��{��s��s��{��s��s��s��s�֠�����������������甽ޜ�甽ޔ�ޔ�ތ�ބ�ޔ��{��{��{��{��s��s��s��{��s��{��{��s��{��{��{��s��s��8Xq���������������������������������������������������){��{��{��{��{��{��{��{��{��{��{��{��{��{��{��{�ބ��{�ބ�ބ�ތ���{�ք�΄��{��k��d�]s�R{�Ns�Ns�������������������������������������������M��B{�V��B{�g��g��g��h��s��{��{��{��s��{��s��s��s��s��h��s��k��g��g��Z��V��M��B{�B{�7v�J{�7v�7v�1s�1s�8Xq�������������������������������O&�^%�^%�^%�c%�c%�c%�p.�wV������JSU! ������fv|(:-���������������������������������������iw����������������������������������������JSU��������������������������ޘ�֔�ޔ�甽ބ��{��{��{�ބ��{�ތ�猽ބ�ތ�ބ�ތ��{��{��{��s��s��s��s��s��{��s��s��s��s��s��{��{��s��{��s��s��s��{��s��s��s��{��s��s�ք��s��s��s��s��{��{��{�֥�������ޥ�������ޜ���ޔ�ޘ�֘�֔�ޔ�猽ބ�ތ��{��{��{��{��s��s��{��{��s��s��s��s��s��s��s��{��)���������������*?P8Xq8Xq8Xq*?P!!1������������������s��{��s�焵ބ��s��{�ބ��{��{��{�ބ�΄�ބ��{��{��{�ބ�ބ�ބ�ބ��{��{��{��{��g��d�]s�]s�R{�Ns�H_t������������������������������������������)V��Z��g��g��g��h��s��k��{��{��{��s��h��s��s��h��s��h��k��s��h��g��Z��V��V��B{�B{�B{�B{�1s�B{�1s�1s�7v�8Xq�������������������������������O&�^%�^%�^%�c%�g%�c%�^)�c%�g%�|J������JSU%)5fv|*?P������������������������������������ajnfv|���������������������������������������(:-��������������眽ޜ���������ޜ�ޔ�ޔ�ތ��{�ތ��{��{��{��{�ބ�ބ�ބ�ބ�ބ�ބ��{�ބ��{��{��s��{��{��s��s��s��{��s��{��{��s��s��s��{��s��s��s��s��s��{��{��s��{��{��{��s��{��{��{��{��s��s�֜�������������������֜�ޔ�ޔ�甽ޔ�ތ�ތ�ބ�ތ��{��{��{��{��{��s��{��{��s��s��s��{��{��{��{��������������8Xqs��{��{��s��{��s��{��g�����������������W�����{��{�ތ��{��{�ބ��{��{�ބ��s��{��{��{�ބ��{�ބ��{�ތ���{�ք��{��h��s��d�]s�Ns�R{�Ns�*?P������������������������������������������*?PV��g��g��s��s��h��{��s��{��{��s��s��{��s��s��s��h��s��g��g��g��g��g��B{�Z��B{�B{�B{�X}�1s�1s�1s�1s�1s�8Xq�������������������������������d0�^%�^%�^%�g%�g%�g%�g%�g%�p.�{1�{1�{1ǜ~���������PN)������������������������������������ajniw����������������������������������������!!1����������ޔ�ޥ�����ޜ�ޥ�������ޜ�ޔ�ޔ�焵�{��{��{��{��{�ބ��{��{�ބ��{�ބ�ބ�ބ�ބ��s��{��{��{��s��{��{��{��s��{��{��s��{��s��s��s��s��s��{��s��s��{��s��s��s��s��s��s��s��s��{��{��{�ޜ�ޥ���������֘�֜�ޥ���甽����ޜ�甽ތ�ޔ�甽猵�{�ބ��s��{��{��s��s��{��s��{��s��{��{��s��{�����������s��{��s��s��s��{��{��{��{��8Xq������������R{�{��{��{��{��s��{�ތ��{��{��{��{��{��s��s�ք��{�ބ��{��{��{��{��{��{��{��c��R{�d�]s�Ns�]s�)������������������������������������������H_th��k��{��{��{��{��{��{��{��{��s��s��g��s��h��h��h��k��s��g��g��\��M��\��B{�B{�1s�J{�1s�1s�1s�7v�1s�7v�8Xq�������������������������������d0�^%�^%�c%�g%�g%�g%�{1�{1�{1�{1�{1�C�C�C�|J��|���y��!!1������������������������������ajnfv|���������������������������������������������֜�眽ޜ�ޜ�����ޔ�ޥ���������֜�ޔ�猽�{�ބ��{��s��{��{��s��{�ތ��ք��{��{��{��s��{��{��s��s��s��s��{��{��s��s��s��{��s��{��s��s��s��{��s��s��s��{��{��s��s��s��{��{��s��s��s��s�֜�ޥ�眽ޜ�ޠ���������֜���甽����ޜ����ތ��{��{��s�ք��{��s���s��s��s��{��{��s��{��{�Ό�����������!!1s��s��s��s��{��{��{��{��{��c��������������R{�{�ތ��{��{��{��{�ބ�ބ��{��{��{��{��s�ք��{��{�ք��{��s��{�ބ��{��s��g��c��d�d�Ns�R{�Ns����������������������������������������������g��h��{��{��{�Ζ��{��{�Ζ��{��{��s��g��s��s��g��h��s��k��g��g��g��\��B{�M��B{�B{�B{�1s�J{�B{�1s�1s�1s�7v�8Xq�������������������������������d0�c%�^%�c%�g%�c%�g%�{1�{1�{1�{1�C�C�C�C�C�C�Cǜ~������iw����������������������ajnfv|�������������������������������������������֥�猽֔���ޜ�����ޜ�ޥ�����������֥�����ބ��{��s��{��{�ތ���{��{�ք��s�ք��s��s��s��s��{��{��s��{��s��s��{��s��s��s��s��{��s��s��{��{��s��s��{��s��s��s��s��{��{��{��{��s��{�Μ���ޜ�眽ޥ�ޥ���ޘ�֘�֜���֜���ޘ�֔�ޔ��{��{�ތ��{��{��s��{��{��s��s��{��s��s��s��s��s��s��{��������������s��{��s��{��{��s��{��{��{��������������Gt�{��s��{��{��{�ބ��{��{��{��{��{��{��{��{��{��s��{��{��{��{��{��{��s��{��d�X}�]s�R{�Ns�*?P���������������������������������������������R{�{�Ό����ք�΄�Ό��{��s��s��g��s��k��k��s��g��g��g��g��B{�\��B{�B{�B{�1s�B{�1s�1s�1s�1s�1s�7v�*?P�������������������������������d0�^%�c%�c%�c%�g%�p.�{1�{1�{1�C�C�C�C�C�C�C�C�C�C�|Jǜ~������(:-���������������ajnfv|���������������������������������������������ޜ�甽��֜�����������������������֔�ތ��{��{��s��s��s��{��{��{��{��{��{��s��{��s��s��{��s��{��{��{��{��s��{��{��{��s��{��{��{��{��s��s��{��s��{��{��s��s��{��{��{��{��s��s��{�ޘ�֜�����ޜ���甽ޜ�������֘�֜�ތ���ތ��{��{��{��{��s��s��s��{��s��{��s��s��s��s��s��s��{��)������������Ns�s��{��{��{��{��k��!!1���������������g��{��{��s��{��{��{�ބ�ބ�ބ��{��{��{�ބ��{��{��{�ބ�ބ��{��{��{��h��{��k��c��]s�]s�R{�R{�!���������������������������������������������������JSU������֖��ք��{��s��g��g��k��k��g��g��g��g��M��B{�M��B{�B{�B{�7v�B{�B{�1s�1s�1s�1s�B{�B{�%)5�������������������������������Z!�c%�g%�c%�p.�p.�{1�{1�{1�C�C�C�C�C�C�C�C�C�C�C�C�C�Cǜ~���z��JSU������ajniw������������������������������������������Ό��ތ�ޘ�֜�ޘ�֜�������������ޜ�ޜ���ޖ�֔�ތ��{��{��s��{��s��{�ބ��{��{��{��{��s��s��s��{��{��s��{��s��s��s��s��{��{��s��s��{��s��s��{��{��{��{��s��{��{��{��{��s��s��s��{��s��s��s�֜�ޠ�����ޔ�ޔ�ޔ�ޜ�ޘ�֘�֜�甽ޔ�ތ�ތ�ތ�ք��{��{��s��s��s��s��{��{��s��s��{��{��s��s��s��s��s��%)5���������������������))������������������{��{��{��{�ބ�ބ��{��{��{��{��{��{�ބ��{�ބ��{�ք�ބ��s�ք��{��s��{��s��d�d�]s�R{�Ns�Ns�������������������������������������������������������������%)5iw����ք��{��s��s��g��g��g��g��g��g��g��V��M��M��Z��B{�B{�B{�B{�7v�B{�1s�7v�7v�B{�B{�)�������������������������������^)�c%�c%�p.�p.�{1�{1�{1�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�p.�C�|J������ajn*?Pfv|fv|������������������������������������������{����ޔ�ތ�ތ�ޔ�甽ޔ�ޜ�������ޜ���ޔ���甽ތ�ބ�ބ��{��s��s��s��{��{�ބ�ބ��s��{��s��s��s��{��s��{��s��s��s��{��{��s��{��{��s��{��{��s��{��s��{��s��s��s��s��s��{��{��{��{�ք��{��{��s��s�֜���֜�ޘ�֔�甽ޔ�����ޔ�ޘ�֔�ތ�焵ތ�焽�{��{��{��s��s��{��{��s��s��s��s��s��s��{��{��{��{��{��R{����������������������������������������������������*?P{��{��{�ބ�ބ��{�ބ��{��{�ބ��{�ތ��{��{�ބ��{��{�ބ��s��{��s��s��g��c��c��d�R{�]s�Ns�8Xq���������������������������������������������������������������������H_ts��{��s��h��k��g��g��g��g��g��V��g��V��V��M��B{�B{�B{�B{�1s�1s�1s�1s�B{�B{�B{��������������������������������c%�g%�c%�g%�{1�{1�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�p.�p.�g%�|J�wV���y��y��ajn%)5������������������������������������g����ތ�ބ�ތ�֜�ޔ�眽ޜ�ޜ�甽ޔ�甽ޔ�ޔ�甽猽ތ�ބ�ބ��{��s��s��{��s�ք��{��s��s��s��s��{��s��s��s��{��s��{��s��s��s��{��s��{��s��s��{��{��s��s��s��s��{��s��s��s��s��{�ބ��{�ބ�΄��{��s��ޘ�֜�ޜ�ޜ�ޜ�ޔ�ޔ�ޘ��֔�猽ތ�ތ��{�ބ��{��s��{��s��{��s��s��s��{��s��s��{��s��{��{��s��{��s��s��{��������������������������������������������������X}�{��{��{��{��{�ބ��{�ބ��{�ބ�΄��{��{��{��{��{��{��{�ބ�΄��{��s��g��c��X}�R{�]s�R{�]s�!������������������������������������������������������������������������������%)5R{�k��s��g��g��g��g��g��\��M��V��Z��V��B{�B{�B{�B{�1s�7v�B{�B{�B{�B{�B{��������������������������������^)�c%�{1�p.�{1�{1�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�g%�c%�g%�g%�c%�wV���y��z��iw�JSU!���������������������������c��{�ބ�ތ�ތ�ބ�ތ�ތ��ތ�ތ�ތ�ބ�ތ�ބ�ތ�ބ�ބ�ތ��{��{��{��s��{��s��s��{��s��{��s��{��s��{��s��{��s��s��{��s��s��{��{��s��{�ބ��{��{��s��s��{��{�ބ��s��{��s��s�ք��{�ޔ�猽ބ�ތ�ބ�ތ�ք�ޜ�����ބ�ޔ�ތ�ތ�ޔ�甽猽�ބ�ބ�ބ��s��{��{��s��s��s��{��{��s��s��s��{��s��s��s��{��s��{��s��s��{��Ns����������������������������������������������%1s�ք��s��{��{��{��{��{�ބ�ބ��{��{�ބ��{��{��{�ބ�ބ��{�ބ��{��s��h��g��c��X}�R{�R{�Qdufv|���������������������������������������������������������������������������������������8Xqg��g��g��g��\��V��B{�B{�Z��B{�B{�B{�7v�B{�1s�B{�1s�B{�B{�M��J{��������������������������������g%�p.�p.�p.�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�{1�p.�p.�c%�g%�g%�g%�c%�g%&#JSUd�z��{��Qdu!!1���������������������W��s�ք��{�ތ�ք�ބ��{�ބ��{��{��{��{�ބ�ބ�ބ��{��{��s��{��{��s��s��s��s��s��{��s��{��s��s��{��s��s��{��s��{��s��{��s��s��{��{�ք��{�ބ��{��s��s��{��{��{��s��{��s��s��{�ތ�ք�ތ�ތ�ތ�ތ�ބ�ތ�֜����֔�猵�ތ��{�ތ��{��{�ބ�ބ��{��s��{��{��s��s��s��s��{��s��s��{��{��s��s��s��s��s��s��s��s��{��s��*?P���������������������������������������g�����{��{��s��{�ބ��{�ތ��{��{��{��{��{��{��{��{��{�ք��{��s��s��s��h��k��c��Gt�R{�R{�R{�*?P������������������������������������������������������������������������������������������������!!1X}�g��g��M��B{�g��B{�B{�B{�B{�B{�B{�1s�1s�B{�B{�B{�V��Gt�������������������������������&#�g%�p.�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�{1�g%�g%�g%�c%�c%�c%�g%�c%�g%���������%)5fv|{��{��{��JSU������������X}�s�焭�{��{��{��s��s��{��{��{��{��s�ք��s��s��{��{��{��s��s��s��{��s��{��s��s��{��s��{��s��{��{��{��s��s��s��{��s��s��{�ތ�ք��{��{��s��{�ތ��{��s��{��{��s��s��{��s��{�ތ�֔�甽ތ�ޔ�甽ތ�ޔ���֜�甽ޔ�焵ބ�ބ�ތ��{��s��{��{��{�ބ��s��s��s��{��s��{��{��{��{��{��{��{��{��{��{��{��s��{��{��s��{��{��{��*?P������������������������������������{��8Xq���{��s��{��{��{�ބ�ބ��s�ք�ތ��{�ތ��{��{��{�ބ��{��s��s��{��c��c��W��R{�R{�R{�R{�������������������������������������������������������������������������������������������������������*?Pg��\��B{�B{�B{�B{�7v�B{�B{�B{�B{�B{�B{�B{�V��Hp�������������������������������PN)�{1�p.�C�C�C�C�C�C�[�C�C�C�C�C�C�C�C�C�C�C�C�{1�{1�g%�g%�g%�g%�c%�g%�c%�^)�g%�������������Qdu��ƌ�֜��{��)������d�s��{��{��{��s��{��s��s��s��{��s��s��{��{��{��{��{��s��s��{��s��{��{��s��s��{��{��{��{��{��{��{��s��s��s��s��s��{��{��{��{�ތ��{�ބ�ބ�ބ��{��{��s��s��s��s��{��{��s��{�ތ�ޔ�眽ތ�ޜ�ޔ���֔�猽ޔ�ތ�ތ�ތ�ތ��{��{��{��s��s��{��s��s�ք��{��s��s��{��s��s��{��s��{��{��{��s��{��{��{��{��{��{��s��s��s��s��{��X}�������������������������������������{��{��{��{�ބ��{�ބ��{�ބ�ބ��{��{��{��{��{��{�ބ��{��s��{��s��g��c��R{�Hp�R{�Ns�8Xq������������������������������������������������������������������������������������������������������������������!!1Hp�Z��B{�B{�B{�B{�B{�B{�B{�B{�B{�B{�g��8Xq�������������������������������O&�C�{1�C�C�C�C�C�[�[�C�C�C�C�C�C�C�C�C�C�C�C�{1�g%�{1�g%�g%�g%�g%�g%�g%�g%�c%�������������������*?P�����甽�{��8Xq8Xqs��{��{��s��s��s��{��s��{��{��s��s��{��s��s��{��s�ք��s��{��s��{��{��{��{��s��{��s��s��s��s��{��{��{��{��{��s��{��{��{�ތ�ބ��{�ބ��{�ք�ބ�ބ��{��{��s��s��s��{��s��{��{�ތ�֘�֜�ޜ�������ތ��ք�ތ��{�ބ��{��{��s��s��s��{��s��s�ք��{��{��s��s��s��s��s��s��s��{��s��s��{��s��s��{��{��s��s��s��s��s��s��s��s��Z��8Xq*?P)���������������������{��s��{��{��{��{�ބ�ބ�ބ��{�ބ�ތ��{��{��{�ބ�ބ��s��s��g��h��c��W��X}�R{�Ns�Ns�)������������������������������������������������������������������������������������������������������������������������*?PJ{�B{�B{�B{�B{�B{�V��M��Z��V��*?P�������������������������������|J�C�C�C�C�C�C�[�[�C�C�C�C�C�C�C�C�C�C�C�{1�{1�{1�p.�p.�g%�c%�g%�c%�g%�g%�c%�g%����������������������������!Ns�{��{��{��s��{��{��s��s��{��{��{��{��s��s��{��s��s��s��{��{��s��{��{��s��{��s��{��{��s��{��s��s��{��s��{��{��{��s��s��s��{��{��s��{�ބ��{�ބ�ތ�ތ�ތ�ބ��{�ބ��{��{��{��s��{�ބ�ތ�֔�ޠ�����������甽焵�{��{��{��s�ք��s��{��{��{��s��{��s��s��{��{��s��s��{��s��{��{��{��{��{��s��s��{��{��s��s��s��{��s��s��s��s��s��{��{��\��8Xq)������������������������s��s��s�焵ބ�ތ��{��{�ބ�ބ��{��s��{�ބ��{�ބ��{��{��s��s��c��Z��R{�Hp�R{�Hp�H_t���������������������������������������������! �wV���������������������������������������������������������������������������)9Hp�V��V��V��V��\��g��g��!!1�����������������������������|J�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�{1�p.�p.�p.�c%�c%�g%�g%�g%�c%�c%�c%�g%������������������������������������*?Pk��s��{��s��s��s��s��s��s��s��{��s��{��s��{��s��s��s��s��{��s��s��s��{��s��s��{��{��{��s��s��s��{��s��s��{��s��s��{��{��{��{��{�ބ�ބ�ތ�֔�ތ������{��{��{��{�ޔ�ޔ����������������{��{��{��{��s��{��{��s��{��{��s��s��s��s��{��s��s��s��s��s��s��s��s��s��s��s��{��s��s��{��{��s��{��{��s��{��s��{��c��8Xq!!1���������������������������������{��{��{��{�ք��{�ބ��{�ބ�ބ�ބ��{���{�ބ��{��s��s��s��g��g��W��R{�R{�Hp�Ns�%)5����������������������������������������������wV��l��l�wVPN)���������������������������������������������������������������������������8XqW��g��g��g��g�������������������������������� �C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�{1�{1�p.�{1�g%�c%�c%�g%�g%�c%�c%�c%�c%�c%����������������������������������������Hp�s��{��s��s��s��{��{��{��{��s��s��s��s��{��{��{��s��{��s��{��s��{��s��s��s��s��s��{��{��{��s��s��s��s��s��s��{��s��s��{��{�ބ�ތ�ބ�ޔ�ޔ�ޔ�ޔ�甽ޔ�焽ބ�ބ�ތ�猽ޔ�甽ޥ���������������쌽ބ��{��{��s��{��s��{��{��s�ք��s��{��{��{��s��{��{��{��{��s��s��{��s��{��{��s��{��s��{��s��{��{��{��{��Z��8Xq������������������������������������������{��s�ք�ބ��{��{�ބ�ބ��{�ބ�ބ�ބ��{��{��{��{��s��s��{��g��c��W��Hp�Hp�Ns�H_t�����������������������������������������������l��l��l��l��l�[PN)������������������������������������������������������������������������������*?PR{�g��W��������������������������������&#�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�p.�{1�{1�{1�{1�p.�g%�g%�g%�c%�g%�c%�g%�c%�^%�^%�c%������������������������������������������R{�{��s��s��{��{��s��{��s��{��s��s��{��{��{��{��{��s��s��s��s��s��s��s��{��{��{��s��{��s��{��s��s��s��s��{��{��{��s��{��s��{��{�ބ�ޔ�甽ޔ�ޔ�甽ޔ�甽ތ�ޔ�ތ�ތ�֔�ޔ��������������������딽猽ތ��{��{��{��{��s��{��s��s��s��s��s��{��s��s��{��{��{��s��{��{��s��s��s��{��{��{��s��{��s��s��{��Ns����������������������������������������������������s��s��s��{��{�ބ��{�ބ�ބ��{�ބ��{�ތ��{�ބ��{��s��k��k��c��c��X}�Ns�Ns�Ns�%)5���������������������������������������������PN)��l��l��l��l��l��L��L��L�t8'������������������������������������������������������������������������������)!������������������������������PN)�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�{1�{1�p.�{1�p.�{1�{1�g%�g%�c%�g%�g%�c%�c%�c%�^%�^%�c%������������������������������������������X}�{��s��s��s��{��s��{��s��{��s��s��s��s��{��s��s��{��s��s��s��s��s��s��{��s��s��s��s��s��s��{��s��s��{��{��s��{��{��s��s��s��{�ք�ތ�֔�焵ތ�ޔ�ޔ�猽ޔ�ޔ�甽甽��֜�ޘ�֥������������������ޘ�֘�ք�ބ��s��s��{��s��s��s��{��{��s��{��s��s��{��s��{��s��{��{��s��{��{��s��s��{��s��s��{��s��s��Ns�������������������������������������������������*?P{��s��{��{��{��{�ބ��{��{��{�ބ�ތ��{�ބ��{��s��{��h��g��c��X}�R{�R{�Hp�H_t������������������������������������������������ǜ~��l��l��l��l��l��l��L��L��L��B��;PN) ����������������������������������������������������������������������������������������������������������wV�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�{1�p.�g%�{1�p.�g%�g%�^%�g%�c%�c%�^%�^%�^%�^%�d0������������������������������������������X}�{��s��s��{��s��{��s��{��{��{��{��{��s��s��{��{��s��s��s��{��s��{��s��{��s��{��s��{��{��s��s��{��s��s��s��s��s��s��s��s��{��s�ք�ތ�猽ބ�ޔ�ތ�ތ�ޖ�֘�֘�֜�ޘ�֜�ޘ�֘�֥������������������씽ޥ�甽ޔ�焽�{��s��{��s��{��{��{��s��{��s��{��s��s��s��s��{��s��s��s��{��s��s��{��{��s��s��s��s��s��Ns�������������������������������������������*?Ps��{��{��{�ބ��s��{��s�ք��{�ބ�ބ��{�ތ��{��{��{��s��s��g��s��c��c��]s�]s�Ns�R{�%1���������������������������������������������8'��l��l��l��l��l��l��l��L��L��B��L��B��B��B۲'8'�������������������������������������������������������������������������������������������������|J�C�C�C�C�C�[�C�C�C�C�C�C�C�C�C�C�C�{1�p.�g%�g%�g%�p.�g%�g%�c%�c%�c%�^%�^%�^)�^%�d0������������������������������������������X}�{��s��s��{��s��s��s��s��s��s��{��{��{��s��s��s��s��{��s��s��s��s��{��s��s��s��{��{��s��s��s��s��{��{��{��s��{��s��{��s��s��{��{�ތ�焵ބ�ޔ�ތ�֔�ތ�֔�ޔ���ޘ�֔�ޘ�֥������������������������ޔ�甽焵�s��s��{��s��{��s��s��{��s��{��{��{��{��{��s��s��s��s��{��s��{��{��s��{�ބ��{��s��{��{��Ns�������������������������������!Ns�s�Ό��{��{��{��s��{��{��{��{��{��s�ք�ބ�ބ��{��{��s��s��{��s��s��s��g��c��d�R{�R{�Ns�8Xq������������������������������������������������ǜ~��l��l��l��l��l��l��l��L��L��L��L��L��B��;��;��-۲'PN)������������������������������������������������������������������������������������������! �C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�{1�p.�p.�g%�p.�g%�g%�g%�^%�c%�c%�c%�^%�c%�^%�^%�d0������������������������������������������g��{��s��{��{��{��s��{��s��s��s��s��{��{��s��s��{��{��s��s��s��{��s��s�΄��{��{��s��s��s��{��{��s��{��s�ք��{��{�ބ��{��s��{��{��{�ބ�ތ�ތ�ތ�ޔ�ތ�ޜ���֜�����甽甽ޥ���������������������֔�ޔ�ޔ�焵ބ��{��s��{��{��s��{��s��s��{��{��s��{��s��{��s��{��{��{��s��{��s��{��s��{��{��{��{��{��Hp����������������������������*?PW�����{��{��{��{��{��s��s��s��{��{��{�ބ�ބ��{��s��{��s��{��s��s��{��h��g��Gt�X}�R{�R{�R{�)���������������������������������������������8'��l��l��l��l��l��L��l��l��l��L��L��L��L��L��;��-��-�������t8'���������������������������������������������������������������������������������&#�|J�C�C�C�C�C�C�C�C�C�C�C�C�C�C�{1�C�p.�{1�p.�g%�g%�p.�c%�g%�c%�g%�c%�^%�c%�^%�^%�^%�O&������������������������������������������g��{��{��{��{��s��{��{��{��{��s��s��s��{��s��{��{��s��s��s��s��s��s��s��s��s��{��s��s��{��s��s��{��{��{��{�ތ��{�ބ�ބ��{��s��{��{�ތ�ބ�ތ�֔�猵ޜ����������������������������������������甽猵ތ�焵�{��{��s��s��s��s��s��s��s��{��{��s��{��s��{��s��s��{��s��s��{��s��{��{��s��{��s��{��c��������������������������������������%18XqW��{��{��s��{��{��{��{��{�ބ��{��{��{��s��{��{��s��s��h��g��c��d�R{�R{�Ns�*?P�������������������������������������������������wV��L��l��l��L��L��l��l��l��L��L��L��L��L��B��B��-������������۲'�O& ������������������������������������������������������������������������������8'�O&�[�C�C�C�C�C�C�C�C�C�C�C�{1�{1�p.�p.�{1�{1�p.�g%�g%�g%�c%�^%�^%�c%�^%�^%�^%�^%PN)���������������������������������������s��{��{��{��s��{��s��{��s��{��{��{��s��s��s��s��s��s��{��{��s��{��{��s��{��s��{��{��s��s��s��s��{��s���{�ބ�ބ�ބ��{�ތ��{��{�ތ�ބ�ތ�ޔ�ޜ�ޜ�眽ޜ�������������������������������������ޜ�甽甽ތ�猽�{��{��{��s��{��s��s��s��s��s��{��s��s��{��{��s��s��s��{��s��s��s��{��{��s��s��s��s��s��s��k��Ns�*?P������������������������������������*?P{�ބ��s��{��{��{��{��{��{��{��{��{��{��s��s��h��c��c��W��X}�R{�Ns����������������������������������������������&#��L��L��L��L��L��L��l��L��l��l��L��L��L��L��L��B��-�������������������t8'������������������������������������������������������������������������������PN)�|J�[�C�C�C�C�C�C�C�C�{1�C�C�{1�{1�g%�g%�c%�g%�c%�^%�c%�c%�^%�^%�^%�^%�^%8'���������������������������������������{��s��s��s��s��{��{��s��s��s��s��s��{��{��s��{��s��s��s�ք��s��s��s��s��s��s��{��{��s��s��s��{��s���{��{��{�ބ��{�ތ�ք�ބ�ބ�ތ�֔�ޔ���������������������������������������������������֔�ޔ�猵ބ�ތ�ބ��s��{��s��{��s��{��s��s�ք��{��{��s��{��{��{��s��s��s��s��s��s��{��{��s��{��{��{��{��{��s��{��{��c��8Xq%1������������������������{��{��{��{��{��{��{��{��{��s�ք��s��s��s��{��g��c��W��R{�Ns�Hp�%)5�������������������������������������������������wV��L��L��L��L��L��L��L��L��L��L��L��L��L��L��L��B��-���������������������������PN)����������������������������������������������������������������������������8'�wV�C�C�C�C�C�C�{1�{1�{1�p.�{1�g%�g%�g%�g%�g%�c%�^%�c%�^%�^%�^%�^%�^%�^%8'���������������������������������������{��s��s��{��{��s��{��s��s�ք��s��{��{��{��{��{��s��s��{��s��{��s��s��s��{��{��{��s��s��s��s�ք��{��{��{��{��{�ބ��{�ބ�ތ�ތ�ތ�ޔ�ޜ���������������������������������������������������������ޔ�甽ތ�ބ�ބ�ބ��s�ք��s��s��s��s��{��s��s��s��{��{��{��{��{��s��{��s��{��s��{��{��{��{��s��s��{��s��{��{��{��{��{��{��s��g��H_t���������������������s��{��s��{��{��s��{��{��{��{��{��{��s��{��h��c��W��R{�R{�R{�H_t������������������������������������������������! ��;��;��B��L��L��L��L��L��L��L��L��L��L��L��L��L��B��;��-���������������������������������t&#�������������������������������������������������������������������������������O&�{1�C�{1�C�C�C�C�g%�p.�p.�g%�c%�g%�g%�c%�g%�^%�^%�c%�^%�^%�^%�^%! ���������������������������������������{��{��{��{��s��{��s��s��s��{��s��s��s��s��s��s��s��s��s��{��{��s��s��{��s��s��{��{��s��{�ބ�΄�ބ��{��{�ތ��{�ք�ބ�ބ��{�ބ�ތ�֔�����ޥ������������������������������������������������������甽甽ތ���{�ބ��{��s��{��{��{��s��s��s��{��s��s��s��{��s��{��s��s��{��{��{��s��{��s��s��{��{��{��{��s��s��s��s��8Xq���������������������������������!{��{��{��{��{�ބ�΄��{��{��{��s��s��{��g��k��Gt�R{�R{�R{�R{��������������������������������������������������t��-��;��B��B��B��L��L��L��L��L��L��L��L��L��L��L��L��B��;������������������������������������-۲'PN) ������������������������������������������������������������������������������PN)�d0�C�C�C�{1�{1�^%�g%�g%�g%�c%�c%�c%�c%�g%�^%�^%�c%�^%�^%�^%������������������������������������������){��s��{��{��s��s��s��s��s��s��{��{��s��s��s��s��{��{��{��s��s��{��{��{��s��s��{��{��{�ބ��{��{�ބ�ތ��{��{�ބ��{�ތ�ބ�ތ��ޔ�ޘ�֥�������������������������������������������������������������ތ�ބ�ބ�ޔ�猵�{��{��{��s��s��{��s��{��s��s��s��s��{��s��s��s��s��{��s��s��s�ք��{��{��s��{��s��h��*?P������������������������������������������������{��{��{��{�ތ��{�ބ�ބ��s��{��s��s��g��c��W��W��]s�Hp�R{�%)5������������������������������������������������&#��������-��;��B��;��B��L��L��L��L��L��L��L��L��L��L��L��B��-����������������������������������-��;��B��L�|J ����������������������������������������������������������������������������������O&�{1�g%�g%�g%�g%�g%�g%�g%�c%�c%�^%�^%�^%�c%�^%�^%�^%�Z!������������������������������������������*?P{��s��s��{��{��{��s��s��{��s��s��s��s��{��{��{��{��{��s��{��s��{��s��s��{��{��{��{�ք�ބ��{��{��{��{�ތ��s�ք�ބ�ބ��{�ތ�ޘ�֜�����������������������������������������������������������������ތ�ބ�ތ��{�ބ��{��{��{�ބ��{��s��s��s��s��{��{��{��{��s��{��{��{��s��{��{��{��{��{��{��s��s��s��s��Hp����������������������������������������������������!���{��{��{��{��{��{��{��s��s��s��{��c��k��X}�R{�R{�Hp�8Xq���������������������������������������������������۲'�����������-��-��;��B��B��L��L��L��L��L��L��L��L��L��L��B��;����������������������������������-��B��;��L��L �������������������������������������������������������������������������������������8'�d0�{1�g%�c%�c%�c%�c%�^%�^%�c%�^%�^%�c%�^%�^%�d0������������������������������������������8Xqs��{��{��{��{��s��{��s��{��{��{��s��s��{��s��s��s��s��s��s��s��s��s��s��{��{��s��s��{�ބ��{�ތ��{��{��{�ބ�ތ�ބ��{�ތ�֔���������������������������������������������������������������������ތ�ތ��{�ބ��{��{��s��{��s��{��s��s��s��s��s��{��s��{��s��{��s��s��{��s��s��s��{��{��s��{��s��{��{��Ns����������������������������������������������%)5R{�h��s��{��{��{��s��s��s��s��s��{��s��s��g��c��X}�R{�R{�H_t������������������������������������������������PN)������������������-��;��-��;��B��L��L��L��L��L��L��L��L��B��B��-��-��������������������������������-��;��B��L۲'������������������������������������������������������������������������������������������������PN)�^)�g%�c%�c%�^%�^%�^%�^%�^%�^%�^%�c%�V������������������������������������������Ns�{��s��s��s��s��{��{��{��s��s��{��{��s��s��s��s��{��{��{��s��s��s��{�ք��{��s��s��{�ބ�ބ��{��{�ք��{�ք�ތ�ތ�ބ�ތ�ތ�֜�ޜ�ޫ�����������������������������������������������������������������眽ޔ�ℽތ��{��s�ք��s��s��s��{��{��s��{��s��s��s��s��s��{��{��s��{��s��s��s��{��s��{��{��s��s��{��s��Ns����������������������������������%1QduZ��s��{��{�ބ��{�ބ�ތ��{��{��{��{��s��s��s��g��g��Z��X}�R{�R{�Hp�)������������������������������������������������ �����������������������������-��;��B��L��L��L��L��L��L��L��B��;��-��-���������������������������������-��;��;��L&#�������������������������������������������������������������������������������������������������������8'�O&�c%�^%�^%�^%�^%�^%�^%�^%�^%�O&������������������������������������������Z��s��{��s��s��{��{��s��{��s��s��s��s��s��{��{��{��s��{��s��{��s��s��s��{��{��{��s��{�ބ��{�ބ��{�ތ�ބ�ތ��ތ�ތ�ޔ�┽��֠�����������������������������������������������������������������������ބ�ބ�ބ��{��s��s��s��s��{��s��{��s��s��{��s��s��s��s��{��s��s��{��{��s��s��s��{��s��{��{��{��s��{��Ns����������������������������%)5Z�����s�ք�ބ��{�ބ��{��{��{�ބ��{�ބ��{��{��s��s��s��g��Z��c��X}�R{�Ns�)9����������������������������������������������������t�����������������������������-��;��B��L��L��L��L��L��L��L��B��;��;�������������������������������������-��;۲'���������������������������������������������������������������������������������������������������������������! PN)�d0�c%�^%�^%�^%�^%�^%8'���������������������������������������s��s��s��s��s��s��{��s��s��{��s��{��s��s��s��{��s��s��s��s��s��s��s��s��{��s��s��s��{��{�ބ�ބ�ތ�猽ޔ�猽֔�┽ޔ�ޔ�ޜ���֥��������������������������������������������������������������������猽ބ��{��{��{��s��s��{��{��s��{��s��s��{��{��s��{��s��s��{��s��{��{��s��s��{��s��s��{��{��{��{��s��Ns����������������������������������)8Xqc��s�ք��{��{��{��{��{��{��{��{��s��s��k��g��c��c��X}�R{�R{�*?P���������������������������������������������������8'������������������������������-����-��B��L��L��L��L��L��L��L��L��B��-��-�������������������������������������;PN)��������������������������������������|PN)������������������������������������������������������������������������������8'�O&�^%�^%�^%�^% ���������������������������������������){��{��{��{��s��s��{��s��{��s��{��s��s��s��{��{��{��s��{��s��s��{��s��{��{��{��{��s��{��{��{��{�ތ�֔�猽֔�甽甽ޔ�ޜ�ޘ�֥�ޜ������������������������������������������������������������������������{��{��{�ބ��{��s��s��{��{��s��{��{��s��s��s��s��s��s��s��{��s��{��s��{��{��s��{��{��{��s��s��s��s��k��*?P���������������������������������������*?Pc��k��{�ބ�ބ��s��s��{��h��k��k��g��c��c��R{�]s�8Xq����������������������������������������������������������������������������������-��-��-��;��B��L��L��L��L��L��L��L��B��-��-������������������������������������۲'���������������������������������(:-�Ƀ�Ƀ�Ƀ�ɃJSU�������������������������������������������������������������������������������O&�V�Z!������������������������������������������%)5{��{��{��{��s��{��{��s��s��s��s��s��s��{��s��s��s��{��{��s��s��s��{��{��{��{��s��{�ބ��{��ތ�ޔ���眽ޠ�����֔��������������������������������������������������������������������������������ތ�ք�ބ��{��{��{��{��s��{��s��s��s��s��{��s��s��s��s��s��s��s��{��{��s��{��s��s��s��{��s��s��s��s��s��s��{��k��*?P������������������������������������{��{��s��s��s��s��s��h��g��c��X}�X}�R{�8Xq�������������������������������������������������������t�����������������������������������-��-��;��L��L��L��L��L��L��L��L��B��-��-�������������������������������������t���������������������������������s�y�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�i(������������������������������������������������������������������������������! ������������������������������������������8Xqs��s��s��{��s��{��s�ք��s��s��{��{��s��{��s��{��s��{��s��s��{��s��s��{��{�ތ����ތ�ޔ�ތ�ޔ�ޜ���ޥ�������������������������������������������������������������������������������������s��{��{��s�ք��s��{��{��{��s��s��s��{��s��s��{��{��{��{��{��s��s��s��s��{��s��{��s��s��{��s��{��s��s��s��s��{��s���{��*?P���������������������������������{��s��{��s��s��h��g��g��c��]s�R{�H_t�������������������������������������������������������O&����������������������������������;��-��-����-��B��L��L��L��L��L��L��L��B��;����������������������������������������������������������������������Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�ɃJSU������������������������������������������������������������������������������������������������������������������������Ns�s��{��s��{��{��{��s��s��{��{��{��{��s��{��s��{��s��{��s��s��{��s��{��s���{�ޔ�猵ք�ތ�ޔ�ޜ�ޜ�����ޥ������������������������������������������������������������������������������������{��{��{�ބ��{��{��{��s���{��s��s��s��s��{��{��s��s��s��s��s��s��{��s��{��s��{��{��s��s��{��s��{��s��{��{��s��{��s��Hp�{��{��s��g��*?P�����������������������΄�΄��s��s��g��k��c��c��X}�R{�Qdu�������������������������������������������������������t������������������������������;��;��;����-��-��B��L��L��L��L��L��L��L��L��;��-����-�������������������������������t���������������������������������JSU�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�i(:-���������������������������������������������������������������������������������������������������������������Z��{��{��{��{��s��s��s��s��s��s��{��s��{��s��s��s��{��{��s��s��{��{��{��{��{�ތ��{�ތ�ޔ�猵֔�ޘ�֥�������������������������������������������������������������������������������������������s��{��{��{��{��{��s��{��s��{��s��s��{��s��s��s��s��{��s��s��s��s��s��s�ք��s��{��s��{��{��s��{��s��{��{��s��s��R{�s��s��{��s��{��X}�!!1������������������{��s��{��k��h��Z��c��X}�R{�8Xq���������������������������������������������������������������! �O&��������������������-��;��-������-��;��B��L��L��L��L��L��L��L��L��;��-��-��-�����������������������������������������������������������x�ix�i�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�ib�LPN)������������������������������������������������������������������������������������������������������s��s��s��s��s��{��{��s��{��s��{��{��{��s��s��s��s��{��s��s��s��s��s��{��s�ք�ތ�ތ�ތ�ޔ�ޘ�֜�������������ޥ���������������������������������������������������������������������������������{��{��{�ք��{��{��{��{��{��s��{��{��s��{��{��s��{��s��{��{��s��{��{��s��s��{��s��s��{��{��{��{��{��s��s��s��Ns����������{��{��{��g��)���������������{��{��{��s��s��Z��W��R{�R{�*?P������������������������������������������������������������������������ 8'�t�����������������������-��;��B��B��L��L��L��L��L��L��;��B��B��-��;��;��-��-������������������PN)���������������������������������PN)x�ix�i�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�ix�ix�ib�LC�.(���������������������������������������������������������������������������������������������%1s��s��{��{��{��{��{��s��s��s��{��{��{��s��s��s��{��{��s��s��{��s��s��s��{�ބ�ތ�ތ�ޔ�����ޜ������������������������������������������������������������������������������������������������{��{�ބ�ބ��{��{��s��s��s��{��{��{��s��{��s��s��{��s��s��{��{��{��s��s��s��s��{��{��{��s��{��{��{��s��s��c��������������k��s��s�����������������������Ns�c��{��{��g��h��Z��X}�X}�R{�*?P������������������������������������������������������������������������������������! �t�������������������-��;��;��L��L��L��L��L��L��L��B��B��B��;��B��B��;��;��-�������������� ���������������������������������x�ix�ix�i�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�ix�ix�ib�Lb�Lb�LX�G(:-������������������������������������������������������������������������������������*?P{��s��{��s��s��{��s��s��s��s��{��s��{��{��s��{��s��s��s��s��s��{��{��s��{�ք�ބ�ތ�ޜ���������眽ޫ����������������������������������������������������������������������������������������������{��{��{��{��{��s��s��{��{��s��{��s��s��s��s��{��{��s��s��s��{��s��s��{��{��{��s��s��s��s��{��s��{�ބ��%1������������Hp�s��*?P���������������������������s��{��s��g��Z��c��X}�Ns�%1���������������������������������������������������������������������������������������������PN)�t�������������-��;��L��L��L��L��L��L��L��L��B��;��;��;��B��B��B��;��-��-�����������8'���������������������������������(:-x�ix�ix�ix�i�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�ix�ix�ib�Lb�Lb�Lb�Lb�Lb�LPN)(������������������������������������������������������������������������������d�s��s��s��s��s��s��s��{��s��s��s��s��s��{��s��{��s��{��{��{��s��s��{��s��{��{�ք�ޔ�电�������������������������������������������������������������������������������������������������������s�ք��s��{��{��{��{��s��{��{��s��s��s��{��s��{��s��{��s��s��{��s��s��{��s��{��s��s��{��s��{��s��s��{��h�����������������8Xqs�����������������������������JSUk��|��g��c��X}�X}�)9�������������������������������������������������������������������������������������������������������t۲'����-��B��;��L��L��L��L��L��L��;��;��B��;��-��-��B��B��B��-����������t���������������������������������x�ix�ix�ix�ix�i�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�ix�ib�Lb�Lb�Lb�Lb�Lb�Lb�Lb�LL�7(:-������������������������������������������������������������������g��s��s��s��{��{��s��s��{��s��s��{��s��{��s��s��{��{��{��{��s��s��{��s��{��s��ބ�ޘ�֜�����������������������������������������������������������������������������������������������������������s��{��{��{��{��{��{��{��{��{��s��s��{��{��s��s��{��s��{��{��s��s��{��s��{��s��{��{��{��s��{��s��{��{��8Xq���������������*?PNs�������������������������������g��g��J{�c��R{�R{�R{�H_t%)5���������������������������������������������������������������������������������������������������������PN)۲'��;��L��L��L��L��L��L��L��;��B��B��;����;��-��B��B��-������������������������������������������PN)x�ix�ix�ix�ix�i�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�ix�ib�Lb�Lb�Lb�Lb�LL�7L�7L�7L�7L�7L�7C�.������������������������������������������������������������%)5���s�ք��{��s��s��{��s��s��s��{��{��{��{��s��{��s��s��s��s��{��s��s��s��s��{��{�ތ�֘�֜�������ޥ�����������������������������������������������������������������������������������������������������{��{��{��{��{��s��{��{��{��{��{��s��s��s��s��s��s��s��s��{��s��{��s��s��s��{��{��s��s��s��s��{��{��s��%1������������H_ts��!!1���������������������������������c��g��c��d�R{�R{�R{�H_tNs�H_t8Xq����������������������������������������������������������������������������������������������������������wV��L��L��L��L��L��L��;��B��B��;��;��B��-��B��B��;������8'���������������������������������x�ix�ix�ix�ix�i�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�ix�ix�ib�Lb�Lb�Lb�Lb�Lb�Lb�LX�GL�7L�7L�7L�7C�.C�.(:-������������������������������������������������������Qdu{�ބ��s��s��s��{��{��s��s��s��s��s��{��s��{��{��{��s��{��{��{��s��s��s��{��s��{�ތ�֜���ޥ�������ޥ������������������������������������������������������������������������������������������������������{�ބ�ބ��s��s��{��s��s��s��{��{��s��s��s��{��s��{��s��s��s��{��s��s��{��{��s��{��{��s��s��{��{��s��)���������{��{�����������������W��W��������������Qdug��c��c��Gt�R{�Hp�R{�Hp�Hp�Ns�R{�8Xq*?P��������������������������������������������������������������������������������������������������������� PN)�[��L��L��L��L��L��B��;��;��B��;��;��;��B��-���t������������������������������������JSUb�Lb�Lx�ix�ix�i�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�ix�ix�ix�ib�Lb�Lb�Lb�Lb�Lb�LL�7L�7L�7L�7L�7L�7C�.L�7C�.C�.���������������������������������������������Z��s��s��{��s��{��s��{��s��s��s��{��s��s��s��{��{��s��s��{��{��s��{��s��s��s��{��{�ޜ�������֥���ޜ����������������������������������������������������������������������������������������������������{��{��{��s��{��s��{��s��s��{��s��{��{��{��s��s��s��{��s��s��{��s��{��{��s��{��s��s��s��{��s��{��s��{��!���������!!1s�ք��������������{�ބ�����������8Xqg��g��c��X}�R{�R{�X}�Hp�Hp�Ns�R{�Hp�Ns�QduJSU!!1������������������������������������������������������������������������������������������������������8'�wV��L��L��B��B��-��-��-��B��;��;��B��;۲'������������������������������������(b�Lb�Lb�Lx�ix�ix�ix�i�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�ix�ix�ix�ib�Lb�Lb�Lb�Lb�LL�7L�7L�7L�7L�7L�7L�7L�7C�.C�.C�.C�.������������������������������������������s��s��{��s��s��{��{��s��{��s��s��{��{��s��{��{��{��{��{��s��s��{��s�ք��s��{��{��{�ތ���甽ޔ�ޥ���ޥ���������������������������������������������������������������������������������������������������s��{��s��s��{��{��{��s��{��s��{��s��s��s��s��s��{��{��s��s��s��{��s��{��s��{��{��s��{��s��{��{��{��{�����������%1{��{�����������������{��{�����������8Xqs��|��g��c��c��W��c��Gt�R{�R{�R{�R{�Ns�Ns�Ns�Ns�8Xq*?P������������������������������������������������������������������������������������������������������PN)۲'��B��B��-��B��B��;��-��;��; ���������������������������������X�Gb�Lb�Lb�Lx�ix�ix�ix�i�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�ix�ix�ix�ib�Lb�Lb�Lb�Lb�LL�7L�7L�7L�7L�7L�7C�.C�.C�.C�.C�.(:-������������������������������������������*?Ps��{��{��s��s��{��s��s��s��s��s��s��s��s��{��{��{��s��{��{��{��s��s��s��{��s��{��{�ތ�猽甽ޔ�����ޥ��������������������������������������������������������������������������������������������������s��s��s��{��s��s��s��s��s��s��s��s��s��{��s��s��{��s��{��s��{��s��{��{��s��s��s��s��s��{��{��{��{��{��!���������%1{��s�����������������!!1s��{��������������8Xqk��h��g��g��g��c��Z��c��c��d�R{�R{�R{�Ns�R{�R{�Ns�R{�Ns�8Xq!���������������������������������������������������������������������������������������������������������PN)�wV��;��B��;��;��-۲'&#������������������������������������C�.b�Lb�Lb�Lb�Lx�ix�ix�ix�i�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�ix�ix�ix�ib�Lb�Lb�Lb�Lb�Lb�LL�7L�7L�7L�7L�7C�.C�.C�.C�.C�.������������������������������������������X}�{��s��s��{��s��s��s��{��{��s��s��{��{��s��{��s��{��s��s��{��{��{��s��s��{��{��s�ք�ބ�ތ�ތ�ތ�ޜ�ޜ�������������������������������������������������������������������������������������������������������{��{��{��s��s��s��{��{��s��{��s��{��s��{��s��s��{��s��s��{��s��{��s��s��{��s��s��{��{��s��s��{��{��s��)���������{��R{����������������*?P{��8Xq������������X}�s��s��h��g��{��g��s��g��Z��c��c��R{�X}�R{�R{�R{�R{�Ns�Ns�Ns�Ns�Qdu(:-������������������������������������������������������������������������������������������������������PN)۲'��;۲'8'������������������������������������(L�7L�7b�Lb�Lb�Lb�Lx�ix�ix�ix�i�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀ�Ƀx�ix�ix�ib�Lb�Lb�Lb�LL�7L�7L�7L�7L�7L�7L�7L�7C�.L�7L�7C�.C�.������������������������������������������{��s��s��{��{��s��{��s��s��{��s��{��s��s��s��{��{��s��{��s��s��s��s��{��{��{��s��{��{�ބ�ބ�ތ�֜�����������������������������������������������������������������������������������������������������������s��{��s��s��s��s��{��{��{��{��s��{��s��s��s��{��s��{��s��s��{��s��s��s��s��{��{��{��s��s��{��s��{��{��%)5������������*?P������������������H_tW�����������������g��s��s��s��{��{��s��g��g��|��c��g��c��c��W��X}�X}�]s�R{�R{�Ns�fv|Ns�Ns�Ns�*?P���������������������������������������������������������������������������������������������������������8'8'������������������������������������L�7L�7L�7b�Lb�Lb�Lb�Lx�ix�ix�ix�i�Ƀ�Ƀ�Ƀ�Ƀx�i�Ƀ�Ƀ�Ƀ�Ƀx�ix�ix�ix�ix�ib�Lb�LL�7L�7b�LL�7L�7L�7L�7L�7L�7L�7L�7L�7C�.(������������������������������������������*?Ps��{��s��{��{��{��{��s��{��s��s��s��s��s��{��{��s��s��s��{��{��s��{��s��{��{��{��{��{�ބ�ތ��֔�ޜ�ޠ�����������������������������������������������������������������������������������������������������s��{��s��s��{��{��{��s��s��s��s��s��s��s��s��s��s��{��s��s��{��{��s��s��{��{��s��{��s��{��s��{��s��s��H_t���������������������������������Z��X}�������������s��s��s��s��{��{��s��s��s��s��{��g��g��g��g��c��c��X}�]s�R{�]s�R{�R{�R{�]s�R{�]s�R{�*?P������������������������������������������������������������������������������������������������������������������������������������������C�.L�7L�7L�7X�Gb�Lb�Lb�Lx�ix�ix�ix�ix�ix�ix�i�Ƀx�i�Ƀ�Ƀx�ix�ix�ix�ix�ix�ib�Lb�Lb�Lb�LL�7L�7L�7L�7L�7L�7L�7L�7L�7C�.L�7C�.������������������������������������������Z��{��{��{��{��{��{��{��{��{��s��s��{��{��{��s��{��{��s��s��{��{��s��s��s��{��{��{��{��{��ޔ�猭֔�ޘ�֜����������������������������������������������������������������������������������������������������{��{��s��{�ބ��s��s��{��{��s��s��{��{��s��{��s��{��s��{��s��s��{��{��{��s��{��s��{��s��{��s��{��s��s��s��������������������������������{��k��������������8Xq{��s��{��{��s��{��s��s��s��s��s��s��s��s��g��g��c��c��c��c��]s�R{�R{�R{�R{�]s�Ns�R{�]s�]s�8Xq���������������������������������������������������������������������������������������������������������������������������������PN)L�7L�7L�7L�7X�GL�7b�Lb�Lb�Lx�ix�ix�ix�ix�ix�ix�ix�i�Ƀ�Ƀ�Ƀx�ix�ix�ix�ix�ib�Lb�Lb�LL�7b�LL�7L�7L�7L�7L�7L�7L�7L�7L�7L�7(:-������������������������������������������s��{��s��s��{��s��s��s��s��s��{��{��{��{��s��{��{��s��s��s�ք��s��s��{��{��s�ք��{��s��{���{�ތ�֔�ޜ�ޜ�ޜ�������ޥ�����������������������������������������������������������������������������������������s��s��s��s��s��s��{��{��{��{��s��s��s��s��s��{��{��{��s��s��{��s��{��{��s��{��s��s��s��s��{��s��{��{��{��*?P���������������������������%1{��s��������������s��{��{��{��{��s��{��s��{��s��s��{��s��s��{��s��h��{��|��\��s��c��c��Gt�c��]s�R{�]s�R{�]s�R{�fv|]s�Qdu(:-������������������������������������������������������������������������������������������������������������������������(:-L�7L�7L�7L�7X�GL�7b�Lb�Lb�Lb�Lx�ix�ix�ix�ix�ix�ix�ix�ix�ix�i�Ƀx�ix�ix�ix�ib�Lb�Lb�Lb�LL�7b�LL�7L�7L�7L�7L�7L�7L�7L�7L�7L�7���������������������������������������������8Xq{��s��s��{��s��s��{��{��s��{��{��s��s��s��{��s��s��s��{��s��s��s��s��s��{��s�ք��{�ބ�Ό�猽ތ�ތ�ތ�ޔ�ޜ�ޜ�ޜ�����������������������������������������������������������������������������������������������s��{��s��{��{��{��s��{��{��s��{��s��s��{��s��s��s��s��{��s��{��{��s��{��s��{��s��s��{��{��s��s��s��s��s��h�����������������������������X}�{��s�����������R{�s��{��{��{��{��{��s��s��s��{��{��{��{��s��{��{��s��k��s��g��h��c��c��c��c��c��c��W��R{�]s�d�]s�]s�]s�R{�Ns�JSU!������������������������������������������������������������������������������������������������������������b�LL�7L�7L�7L�7L�7L�7L�7L�7b�Lb�Lb�Lx�ix�ix�ix�ix�ix�ix�ix�ix�ix�ix�ix�ix�ix�ib�Lb�Lb�LL�7b�LL�7L�7L�7L�7L�7L�7L�7L�7L�7L�7(:-���������������������������������������������s��s��s��s��s��{��s��s��s��s��s��s��s��{��{��{��s��{��{��s��{��s��s��{��{��{��{��{��{�ބ�ބ�ބ��{�ތ��{��ޔ���ޜ����������������������������������������������������������������������������������������������{��s��s��{��{��s��s��{��s��s��{��s��{��{��s��s��s��s��{��s��s��s��s��s��s��{��{��{��{��s��s��s��{��{��s��{��R{����������������������*?P{��{��{��������X}�s��s��s��{��s��{��s��s��s��{��s��s��s��{��{�ބ��{��s��{��s��k��s��h��s��g��g��k��c��c��Gt�W��d�]s�d�d�d�]s�iw�d�Qdu%)5������������������������������������������������������������������������������������������������������(:-C�.L�7L�7L�7L�7L�7b�Lb�Lb�Lb�Lb�Lx�ix�ix�ix�ix�ix�ix�ix�ix�ix�ix�ix�ix�ib�Lb�Lb�Lb�LX�GL�7L�7L�7L�7L�7L�7L�7L�7L�7C�.���������������������������������������������%1{��{��s��{��s��s��s��s��{��{��{��s��{��s��s��s��{��{��{��s��s��{��{��s�ք�΄�ބ��{�ބ�ބ�ބ�ބ��{�ޔ�焽ތ�甽ޜ���ޠ����������������������������������������������������������������������������������������������s��s��s��s��s��s��{��s��{��s��s��s��{��s��{��{��{��{��s��s��s��s��{��s��s��s��{��s��{��s��{��s��s��s��{��s��s��Z��)���������8Xq{��{��{��s��R{�c��)9%)5R{�{��{��s��{��{��{��{��s��{��s��s�ք��{��{��{��{��{��s��s��s��s��s��s��{��h��s��g��c��d�d�c��d�X}�d�d�iw�iw�d�iw�fv|JSU!���������������������������������������������������������������������������������������������������������(PN)L�7L�7b�Lb�Lb�Lb�Lb�Lb�Lb�Lx�ix�ix�ix�ix�ix�ix�ix�ix�ix�ix�ib�Lb�Lb�Lb�Lb�LL�7L�7L�7L�7L�7L�7L�7L�7L�7L�7(:-���������������������������������������������Z��s��{��{��s��{��{��s��s��s��s��{��{��s��s��s��{��{��s��{��s��s��{��s��{��{�ބ�ބ�ބ�ބ�ތ�ք��{�ք��{�ތ�猽ޔ�甽ޜ������������������������������������������������������������������������������������������������s��s��{��{��s��s��{��{��s��s��s��s��{��{��s��s��{��s��{��s��s��s��{��s��{��{��s��{��s��s��s��{��{��{��{��{��s��s��s��h��X}�g��s��{��{��s��s��{��s��!!1s��{��{��s��{��s��{��{��{��s��s��s�焭�{��{��{��{��{��{��{��{��{��{��{��{��{��{��c��h��k��k��k��k��k��d�y��iw�d�d�iw�d�d�Qdu%)5������������������������������������������������������������������������������������������������������(:-X�GX�Gb�Lb�Lb�Lb�Lb�Lx�ix�ix�ix�ix�ix�ix�ix�ix�ix�ix�ib�Lb�Lb�Lb�LL�7X�GL�7L�7L�7L�7L�7L�7L�7L�7C�.���������������������������������������������!!1���{��s��{��{��{��s��s��{��s��{��s��{��s��s��s��{��{��{��{��s��s��s��{��{��{�ބ�ބ�ބ�ބ��{�ބ��{�ތ�ք�ބ�ބ�ޔ�ޜ�ޜ�ޜ�ޜ���������������������������������������������������������������������������������������������s��{��s��s��{��{��s��s��{��{��{��{��s��s��s��{��{��{��{��s��s��s��s��{��s��{��{��s��s��{��{��s��{��{��{��s��s��s��{��s��{��s��s��s��{��{��{��{�ތ��%)5%1!!1k��{��s��{��{��s��{��s��{��s��{��{��{��s���s��{��{��{��{�ބ��{��{��{��{��{��s��s��{��{��{��{��{��{��k��k��k��iw�k��iw�iw�iw�iw�d�R{�JSU���������������������������������������������������������������������������������������������������������X�GX�Gb�Lb�Lb�Lb�Lx�ix�ix�ix�ix�ix�ix�ix�ix�ib�Lb�Lb�Lb�LL�7L�7L�7L�7L�7L�7L�7L�7L�7L�7L�7���������������������������������������������Hp�s��{��s��s��{��{��{��{��s��{��s��{��s��s��s��s��{��s��{��s��s��s��{��{��{��{��{��{�ބ�ބ��{�ބ�ތ��{�ބ�ތ�ޔ�ތ�֜�ޔ�ޥ�ޫ��������������������������������������������������������������������������������������������{��{��{��s��{��{��s��{��s��{��{��s��{��{��s��s��{��{��s��s��s��{��s��{��{��{��s��s��s��s��s��s��s��{��s��{��s��{��{��{��{��s��s��s��s��s��{��{��{��s��%1s��s��{��{��{��{��{��s��{��{��{��{��s�ք��{�ބ�ބ��s��{��{�ތ��ބ�Ό�ބ�ތ��{��{��s���{����΄��{��{��{��{��{��z��{��k��k��iw�d�]s�d�iw�iw�Qdu!!1������������������������������������������������������������������������������������������������������������(:-b�Lb�Lb�Lb�Lb�Lb�Lx�ix�ix�ix�ix�ix�ib�Lb�Lb�Lb�LL�7L�7L�7L�7L�7L�7L�7L�7L�7L�7PN)���������������������������������������������{��{��{��s��{��s��{��{��s��{��{��{��{��s��{��s��{��{��s��s��s��s��{��s��{��{�ތ��{��s��{��{�ބ��{��{�ތ��{�ބ�ބ�ތ�ޔ�ޜ�����������������������������������������������������������������������������������������������s��s��s��s��{�ބ��s��{��s��{��s�ք��{��s��{��{��{��{��{��s��{��s��s��{��{��{��s��{��s��{��s��s��s��{��{��s��s��s��{��s��{��{��{��{��{��s��{��{��{��{��{�ބ��s��{��{��s��{��{��s��{��s��{��s��s��s��{��{�ބ��{��{��{�ތ�֔��{�ތ��ޜ�猵ޘ��{��{�Ό��Ό��Ό�ƌ�ƌ�ƌ��{�΄��������k��k��iw�k��iw�]s�iw�iw�iw�fv|JSU���������������������������������������������������������������������������������������������������������X�Gx�ib�Lx�ix�ix�ix�ix�ib�Lb�Lb�Lb�Lb�LL�7X�GL�7L�7L�7L�7L�7L�7L�7L�7C�.������������������������������������������������8Xqs��{��{��{��s��{��s��s��{��{��{��s��s��{��{��{�ք��s��s��s��{��{��s��{��{��s��s��{�ք��{��{��s��{��{��{��{��{��{�֔���֜������������������������������������������������������������������������������������������������s��s��{��{��{��s��{��s��{��s��{��{��s��s��{��s���s��s��s��s��s��{��s��s��{��s��s��s��{��s��{��s��{��s��{��s��{��{��s��{��s��s��s��{��s��s��{������������������{��{��{��{��{��{��{��s��{��{��{��s��{�ބ��{��{�ބ��{��{��{�ތ�ޔ�猽֜�ޘ�֔�甽ޔ�ޔ�ޘ��Ό��Ό���ƌ�Ƅ�����{��{��z��{��k��iw�k��iw�iw�iw�iw�d�Qdu%)5���������������������������������������������������������������������������������������������������������(:-x�ix�ib�Lx�ib�Lb�Lb�Lb�Lb�Lb�LL�7b�LL�7L�7L�7L�7L�7L�7L�7L�7���������������������������������������������){��{��s��{��{��s��{��s��{��s��s��s��{��s��{��s��s��{��s��{��{��{��{��s��{��{��{��s��s��{��s��s��s��{��{��{�ތ�ތ�ք�ބ�ޔ�甽ޜ�������������������������������������������������������������������������������������������{��{��{��s��s��s��s��{��s��{��s��s��s��s��{��{��{��s��s��{��{��s��{��{��{��{��{��s��{��s��{��s��{��{��{��s��{���������{��s��{��s��{��{������������������������������{��{��{��{��s��{��s��{��{��{�ք��{��{��{��{��{��{�ތ�ޔ�ތ�ޜ�����猽ޜ�甽甽ޘ�֜�ޘ�֘��֔�ތ���ƌ�Ɣ�����{�����s��s��z��k��k��k��k��k��iw�iw�Qdu*?P������������������������������������������������������������������������������������������������������(X�Gx�ib�Lb�Lb�Lb�Lb�Lb�LX�GX�GL�7X�GL�7L�7L�7L�7L�7(������������������������������������������������Hp�s��{��s��s��{��s��{��s��{��s��s��{��s��{��{��{��s��s��{��s��{��s��s��{��s��{��{��{��s��s��s��{��s��{��s��{�ތ��{�ތ�ތ�ތ�ޔ��������������������������������������������������������������������������������������������{��s��s��s��s��{��{��s��{��{��{��{��s��s��s��{��s��{��s��{��s��{��s��{��{��s��s��s��{��s��s��{��{��{��s��{��������������{��s��{��s��s�����������������������������������������s��{��{��{��{��{��s��s��s��{��{��s��{�ތ��猵ތ�ޘ�֜�����֜�ޠ���֜�甽ޔ���֜�碿Ԝ�ޥ�ʘ�֜�ޥ�ʥ�ʝ�Ŕ��������{�����z��z��y��k��y��iw�d�]s�]s�Ns�H_t%)5���������������������������������������������������������������������������������������������������������PN)b�Lx�ib�Lb�LX�GX�Gb�LX�GL�7L�7L�7L�7L�7(:-������������������������������������������������)9{��s��s��s��s��{��{��{��s��{��s��s��s��{��{��s��s��s��s��{��{��{��s��s��{��{��{��s��{��{��{��{��{��{��{�ބ��{�ތ�ތ�ތ�ތ�ޜ�����ޜ�����������������������������������������������������������������������������������������{��{��s��s��s��{��s��s��s��{��{��s��{��s��{��{��s��s��{��s��s��{��{��s��{��s��{��s��{��s��s��s��s��s��{���������������s��{��{��{������������������������������������������{��{��{��s��{��s��s��{��s��{�ބ��{��{�ބ�ބ�ބ�ތ�ޜ���ޜ�甽ޔ���֔�ޜ���ޠ�┽����������ޭ�ޭ�ޭ�Ӣ�ԥ�ʝ�Ō�Ɣ��{��������z��z��c��k��d�d�]s�]s�Ns�d�Qdu*?P���������������������������������������������������������������������������������������������������������(:-X�Gb�Lb�Lb�LX�GL�7X�GL�7L�7b�LPN)���������������������������������������������������c��s��{��{��s��s��s��s��s��s��{��{��{��s��{��s��{��{��s��s��s��s��{��s��{��s��s��s��{��{��{��{��s��s��{��{��{�ބ�ތ���甽ޔ�甽ޥ������������������������������������������������������������������������������������������s��{��{��{��s��s��{��{��{��s��s��{��{��s��{��{��{��{��s��{��s��{��{��s�ք��{��{��s��{��{��s��s��{��{��s��������������s��{��s��{�ބ����������������넭�s��s��{�ބ�����������������s��s��{��s��s��s��s��{��s��{��{��{�ބ�ބ�ތ�ޔ�ޜ�ޘ�֜�ޔ�ޘ�֔���ޔ�������ޜ���眽ޥ�����������ޭ�ޭ�Ӣ�Ԕ�ʔ����Ɛ��{��{��{��k��k��d�]s�]s�]s�R{�Ns�R{�Ns�8Xq!!1���������������������������������������������������������������������������������������������������������PN)X�Gb�Lb�LL�7L�7L�7PN)���������������������������������������������������*?P{��{��{��s��s�ք��s�ք��s��s��{��s��s��s��s��{��{��s��s��s��s��{��{��{��s��s��{��s��{��{��s��{��{��s��s��{�ބ��{�ތ�ք�ތ�ތ�ޔ�ޜ��������������������������������������������������������������������������������������������{��s��s��s��s��{��s��s��{��{��s��s��{��{��s��{��s��{��s��{��s��{��{��s��{��{��s��{��{��{��{��{��{��s�ֵ�����������{��s��s��s��{��������������{��{��{��s�ք��{��{��{�ޥ��������������s��{��s��s��{��{��s��s��s�ք�΄�ތ��{�ތ�֔�甽ޜ�甽��ޔ�ޘ�֔���甽ޜ�ޜ�ޥ��������������������ޜ�ޘ���Ό�Ɣ��������{��s��c��d�d�d�R{�R{�Ns�Ns�Ns�Ns�H_t*?P���������������������������������������������������������������������������������������������������������(C�.b�LX�GC�.������������������������������������������������������k��{��s��{��{��{��s��{��s��{��s��s��s��s��s��{��s��s��s��{��{��{��{��s��{��{��s��{��{��{��{��s��s��{��{��s��{��s�焭�{��ք�ޔ�ޔ�ޜ���ޥ����������������������������������������������������������������������������������������s��s��{�ք��s��s��s��s��{��{��{��s��s��{��s��s��s��{��s��s��{��s��s��{��{��{��{��s��s��{��s��s��{��s��������������{��s��s��s��s��������������{��{��s��s��{��{��{��{��{��������������s��s��s��{��s�΄��s��s��s�ք�Ό��֔��{�ޜ�疷֜�������֘�֘�֔�ތ�֜�ޔ���ޥ���������������������ޜ�ޘ�֘�֖���ƌ��{��{��{��c��c��c��d�]s�R{�]s�Ns�Hp�Ns�R{�R{�*?P!���������������������������������������������������������������������������������������������������������(:-������������������������������������������������������X}�{��{��s��{��{��{��s��{��{��{��s��{��s��{��s��s��s��{��s�ք��s��s��s��{��{��{��s��s��{��{��s��{��{��{�ބ��{��s��{�ޔ��{�ք�ބ�ޔ�ޔ�ޘ�֜���������������ޭ��������������������������������������������������������������������������{��{��s��s��s�ք��{��s��{��s��{��{��s��{��s��{��s��s��s��{��{��s��{��s��{��{��{��s��s��{��s��{��{��{�����������{��s��s��s��s��{�����������s��{��{��{��s��s��s��{��{��{��s�����������s��s��{��{��{��{��{��{��{��{��{�ޘ�֔�ޔ���֔���猽֥�眽ޥ���֖�֜�ޜ�������ޥ�����������������������������֜�ތ��ƌ��{��{��{��|��g��c��c��d�W��]s�]s�R{�]s�R{�]s�R{�fv|*?P������������������������������������������������������������������������������������������������������������������������������������������������������������)���s��s��s��s��s��s��s��s��{��{��s��{��s��{��s��{��{��s��s��s��{��{��s��{��{��{��s��{��{��{��{��{��s��{�ބ��s��{��{�ތ��ބ�ތ�ތ�֔�ޔ��������������������������������������������������������������������������������������������{��s��s��{��s��s��{��s��{��{��s��s��s��s��{��{��s��{��{��{��s��{��{��{��{��s��{��{��s��{��s��s��s��s�����������{��{��{��{��s��s�����������s��{��{��s��{��{��s��{��s��s��s�����������{��{��s��s��{��{��{��{��{��{�ք�ތ��{�ޔ�甽ޥ���ޘ�֔�ޘ�֔�ޘ��ޔ�ޔ�ޔ��������������������������ӥ���眽ޜ�ޔ�ޘ�֘��ƌ��{��s��s��{��c��{��c��d�c��d�X}�]s�]s�]s�]s�]s�]s�Ns�8Xq!������������������������������������������������������������������������������������������������������������������������������������������������s��s��{��{��s��s��{��s��{��{��s��{��s��s�ք��{��s��{��{��s��s��s��{��s��s��s��{��{��{��{��s��{��s��{��{��s��s��{�ބ��{��{��{�ތ��ޔ�ޔ�ޘ�֘�֜����������������������������������������������������������������������������������������{��{��s��{��s��s��{��s��{��{��s��s��{��{��s��s��{��{��s��s��{��{��{��s��s��s��s��s��s��s��s��{��s��{�����������s��s��s��s��s��s�����������s��{��{��s��{��s��s��{��s��{��s�����������s��s��s��{��{��{��{��{��s��{��{�ތ�焽ތ�甽��甽��֥�����֘��֔�甽�������������������������������������ޘ�֔�ތ��ք�΄��{��{��s��s��|��c��c��c��W��d�X}�R{�d�d�d�]s�]s�]s�ajn*?P���������������������������������������������������������������������������������������������������������������������������������������X}�s��s��s��s��{��s��{��{��{��s��{��{��s��{��s��{��{��{��s��{��{��{��s��{��{��s��{�ބ��{��{�ބ��s�焭�{��{��{��{��{��{��{��{�ք�ތ��ޘ�֔���֜�ޥ����������������������������������������������������������������������������������������s��s��{��s��s��{��s��s�ք��s��s��s��s��s��s��s��s��s��s��s��s��{��s��s��s��{��{��{��s��s��s��s��{��s�����������{��s��{��{��s��{�����������s��s�ք��{��s��s��s��s��{��{��{�����������{��{��{��{��{��{��{��{��{��{��{�ބ��{�֘�֜�ޜ�ޔ�ޜ���ޥ���眽ޔ�ޜ���ޜ�ޜ�ޜ���֥����������������������������֘�֔�ޔ�ތ��{��{��{��s��s��s��g��h��h��s��c��k��d�c��k��]s�k��iw�d�iw�iw�iw�d�JSU!������������������������������������������������������������������������������������������������������������������������������*?P{��{��{��{��{��{��s��s��s��s��s��s��s��s��s��{��s��s��{��s��s��{��s��{��s��{��{��{��{��{��{�ބ�ބ��{��{��{�ބ��{��{��{�ބ�ބ�ތ�ބ�ޔ�电┽��ޜ�������������������������������������������������������������������������������������������s��{��s��{��{��s��s��s��s��{��{��{��s��s��s��s��s��s��s��s��s��{��{��s��s��{��{��{��{��s��s��s��s��s��������������{��s��{��s��s�����������{��s��s��{��s��{��s��{��{��{��{�����������ބ��{��{��{��{��{��{��{��{�ބ��{��{�֔�甽ޘ�֔�ތ�֔�ޘ�֜�甽ޔ�ޘ�֜�ޜ���ޜ�ޜ�����������������������������眽ޜ�ބ�ތ���{�ބ��{��s��{��s��{��k��{��s��|��s��k��z��k��k��k��k��k��k��k��iw�k��iw�ajn*?P������������������������������������������������������������������������������������������������������������������!!1{��s��s�ք��s��s��s��s��s��{��s��s��{��s��{��s��s��{��{��s�ք��s��{��s��s��{��{��s�ք�ބ�ބ��{��{��{�ބ��{�ބ��{��{��{��{��{�ތ���ޜ�ޜ�ޜ���֜�����������������������������������������������������������������������������������������������s��{��{��s��s��{��{��{��{��s��{��s��s��{��{��s��s��s��{��s��{��{��s��{��{��{��s��s��s��s��{��{��s�ֵ�����������s��{��{��{��{�ޜ�����������{��s��{��s��s��s��s��s��{�ޥ�����������{��{��{��{��{�ބ��{�ބ��{��{�ބ��s�ք�ތ�ތ�ޔ�ޔ�甽ތ�ޔ�⌽֔�ޔ�甽甽ޔ�ޜ�ޔ�甽ޜ�����ޥ����������������������ޜ�ތ�ޔ�⌽ބ�ބ��{�ք��{��s��s��{��s��{��s��s��{��{�����{��{��k��s��z��k��z��k��y��y��y��y��y��JSU!���������������������������������������������������������������������������������������������������������h��{��s��{��s��{��s��{��s��s��{��s��{��s��{��s��{��{��{��s��s�ք��s��{��s��s�ք��{��{��{�ބ��{��{�ބ�ބ�ތ�ք�ބ��{�ބ�ބ��{�ބ�ތ�֔�甽甽ޜ�甽ޜ���甽������������������������������������������������������������������������������������������{��s��s��s��s��s��{��{��s��{��{��{��{��s��{��s��s��{��{��s��{��s��s��s��s��{��{��{��{��s��s��{��s��{��s��������������{��s��s��{��{��������������{��{��s��s�ք��{��s��{�������������ބ��{��{��{��{�ބ��{��{�ބ��s��{��{��{�ބ�ބ�ބ�ތ�ތ�ބ�ތ��{�ތ��ބ�ތ�ތ�ޔ�ޜ�ޔ�眽ޜ�������������������������֘�֔�甽ތ�ތ�焽�{�ք��{��{��s��{��{��{��{��{�΄�Ό�ƌ�Ƅ�����{�����z��{��z��z��z��y��y��y��y��z�����fv|(:-������������������������������������������������������������������������������������������������X}�s��{��{��{��s��{��s��s��{��s��{��s��{��{��s��{��s��{��s��{��s��{��s��s��s��s��{��{��{�ބ�ބ��{�ބ�ބ�ތ�ތ�ތ�ք��{�ތ�ք�ބ�ބ�ބ�ތ�ޔ�ޔ�ޔ�甽眽ޜ�ޥ���������������������������������������������������������������������������������������������s��{��{��{��{��s��{��s��s��s��{��s��s��s��{��s��{��s��s��{��{��s��{��{��s��{��s��{��{��s��s��{��s��{��s�ֵ��������������s��{��{��s�ք��������������s��s�ք��s��s�ք��������������{�ބ�ބ�ބ�ތ�ތ��{��{�ތ��{��{�ބ�ބ�ތ���{�ތ�ބ�ޔ�猵�{��{��{�ބ�ތ��ތ�ޔ�甽ޘ�֘�֘�֜�眽ޫ�������������������猵ޔ�ޘ�֔�ބ�ބ�ޔ��{��{��s��{��ތ�ք�ތ�ƌ�Ό��ƌ�Ό�ƌ�Ό�Ɣ�����{��{��{�����z��������������������������ajn���������������������������������������������������������������������������������������H_t{��s��{��{��s��s��s��s��{��s��{��{��{��{��s��s��{��{��{��{��{��{��{��s��s��s��{��s��{��{��{�ބ�ބ�ތ�ތ�ތ��ޔ�ބ�ޔ��{�ތ�猵ތ��ޔ�ޔ���֜�甽����ޥ����������������������������������������������������������������������������������������������{��{��s��s��s��s��s��s��s��{��s��{��s��{��{��{��{�Ό��{��s��s��{��s��s��s��s��{��{��s��s��{��s��s��s��{��s��������������������{��{��s��{���������������{�ތ��������������������{�ބ�ތ�ބ�ތ�ތ�ތ��{�ބ��s�ք�ތ�ތ�ތ��{�ޔ�猽ބ�ޔ�猽ތ��{�ތ��{�ބ�ބ�ތ�ޜ�ޔ�����֜�甽��������ޥ�������ޜ�������֔����ތ�֔�ބ�ތ��{�ތ��{�ޔ��{�ބ�ބ�ޖ��֔�ޘ��֘�֔�ʝ�Ō�ƌ�Ơ����Ơ�����������������������������������s�y%)5������������������������������������������������������������������������������H_t���{��{��{��s��{��{��s��{��s��s��{��{��s��s��{��{��s��{��s��{��s��s��s��s��s��{��{��{��s��{��{��{�ތ�ތ�ޔ����֜�甽ތ�ތ�ބ�ތ�֔�猽ތ�֜�ޘ�֜�ޘ�֥���������������������������������������������������������������������������������������������������s��s��s��{��s��{��{��{��s��{��{��s��s��s��{��{��s��{��{��s��s��{��{��{��s��{��{��s��s��{�ބ��{��s��{��{��{��s�����������������������������������������������������������������{�ބ�ބ�ތ�ތ�ތ��{��{�ތ��{�ބ�ތ��{�ތ��{�ތ�ތ�֔�ތ��ބ��{���ք�ބ�ބ�ތ�ބ�ތ�ތ�ޔ�ޠ�������������������������ޘ�֜���焵ތ�ތ�ք�ތ��{�ޔ�ޔ�焵ތ�ތ�ޔ�ޔ���֖�֘�֜�ޜ�ޜ�ޘ�֘�֥�ʖ�֥�ʥ�ʝ�ş�����������������������������������z��ajn������������������������������������������������������������������JSU���{��s��s��s��{��{��s��{��s��s��{��s��{��s��{��{��s��s��{��s��{��{��{��{��s��{��{��{��{��{��{�ބ�ބ�ތ�猵֔�ޔ�ޘ�֜�ޔ�ޘ��ތ�ތ�ޔ�ތ�ޘ�֘�֥���������������������������������������������������������������������������������������������������������{��{��s��s��s��s��{��{��s��s��{��{��{��{��{��{��s��{��s��s��{��{��s��{��{��s��s��s��s��{��{��{��s��{��{��s��{��{�ޥ��������������������������������������������������������{��{��{�ތ�ތ�ޔ�ތ�ތ�ބ�ތ��{�ބ�ބ��{�ތ�甽甽甽ތ�猽ޔ�猽ތ�ޔ�焵ތ�焽ތ�ތ�猽ބ�ތ�ޜ�甽����������������������ޥ�甽甽ޔ�ތ�ބ��{�ބ��{�ތ��ތ��{�ތ�甽甽ޜ�ޜ�ޘ�֥�����������ޭ��ҭ��ҭ�ӥ�ʲ����ş�����������������������������������fv|(:-���������������������������������������������������������*?P��ޜ�ބ��{��{��{��s��s��s��{��{��{��s��{��s��{��{��{��{��{��s��{��{��s��s��{��s��s��s�ք��{��{�ք�ތ�ބ�ޜ�猽甽眽ޜ�����֔�ޔ�ޔ�ޜ�����֜�ޜ�ޜ����������������������������������������������������������������������������������������������������������{��s��{��s��s��{��{��{��{��{�ބ��s��{��s��{��s��{��{��s��s��s��s��{��s��{��s��s��s��s��{��s��s��s��s��{��s��s��s�֫��������������������������������������������������{�ބ��{�ބ�ބ��ޔ�ޔ�ޔ�ބ�ތ�ބ�ބ�ތ�ބ�ތ�ތ�猽֔�ތ�ޔ�ތ�ބ�ތ�ތ�ބ�ތ�ބ�ބ�ބ�ޔ�焽�{�ބ�ބ�ޔ�ޜ�眽ޥ�������ޜ���ޜ�ޜ���֔�ތ�ޔ�甽ތ��{��{��{��{�ތ�ބ�ބ�ޔ�ޔ�┽ޔ�ޔ�ޜ�����ޥ����������������������������Զ�����������������������������������������y��ajn!���������������������������������������������JSU������ތ��{��s��{�ބ��{��{��s��{��{��s��s��s��{��s��s��{��{��s��s��s��{��s��s��s��{��{��{�ބ�ބ�ތ�猵ތ�ތ�֘�֜�������甽ޔ�ޔ�ޘ�֔�甽ޔ���ޠ���ޫ�������������������������������������������������������������������������������������������������������s��s��s��s��s��s��{��s��s��s��s��s��s��s��{��{��s��s��{��s��{��{��{��s��{��s��{��{��{��s��{��s��{��s��s��s��{��������������s�ք�ޥ�������������������������������焵ތ��{�ބ�ތ�ބ�ތ�ޜ�ޖ�֔�ބ�ތ�ޔ�ތ�ތ�ތ��ތ�ޔ�ތ�猽ތ�ތ�ބ�ތ��ք�ތ�焵ބ�ތ�甽焵ތ�ތ�ޔ�ޔ�ޜ�ޜ�ޔ���ޜ���֜�ޔ�ޜ�ޔ�ޔ�ℵތ��{��{��{�ބ�ތ��{��{�ތ��猽ޔ�ޜ�ޜ�ޜ�ޜ����������������������������������������ѽ����������Զ��������������������������������������fv|(:-���������������������������������JSU������ޜ�焵�{��{��s��s��s��{��s��s��s��s��s��{��{��s��{��s��{��{��{��{��s��s��{��s��{��{��{�ބ�ތ��甽ޔ���֔�ޘ�֔�甽甽��֔�ޜ�������甽ޥ�ޥ����������������������������������������������������������������������������������������������������������������s��{��s��s��s��s��{��s��s��{��{��{��{��s��s��s��{��{��s��s��{��s��s��s��{��s��s��{��s��s��s��{��{��s��{�����������������{��s��s��s�ֵ�������������������������������������������넽ޔ�甽猽֔�ޔ�甽甽ޔ�猽甽ޔ�猽甽ޔ�甽ތ�ތ�ބ�ތ�ބ�ތ��ބ�ބ�ބ�ތ�ތ�ބ�ތ�ތ�ޔ�ޜ�ޔ���֔�ޔ�ޔ�甽ޔ�ތ�ބ�ތ��{�ބ��{��{��{��{��s�焭ބ�ބ�ތ�ބ�ޔ�ޔ�甽��ޥ����������������������������������������������������������и�������������������������������������y��JSU!������������������������JSU����������ބ��s��{��{��s��s��s��s��{��{��s��{��s��{��{��s��s��s��{��s��s��s��s��s��s��s��s�ք�ބ��{�ބ�ޔ�甽ޔ�ޔ�ޔ�甽ޔ�ޔ�ޔ�ޜ���������ޥ�����������������������������������������������������������������������������������������������������������������{��s��{��{�ք��s��s��{��s��s��{��s��{��s��s��{��{��{��s��s��{��s��{��s��{��s��s��{��{��s��{��{��s��{��{���������������s��s��{��{��s����������������������������������������������넽ޔ�ޔ�ޜ�ޜ�甽ޔ�ޔ�ޔ�ޔ�ޜ�眽ޔ�ތ�甽甽ބ�ތ�ބ�ތ�ބ�ތ�ތ�ބ�ބ�ތ�ޔ�焽ތ��{�ޔ�猽ތ�ބ�ތ�ތ�ޔ�焵ބ�ތ�ބ�ތ�ބ��{���{��{��{�ބ��{��s�猽ք�ތ�ޔ�甽ޜ���֜�ޜ�����������������������������������������������������������������������ɲ�����������������������������������y��(:-���������fv|����������猽ތ��s��s��s��{��s��s��s��s��{��s��s��s��s��s��{��{��{��s��s��{��{��{��{��s��{��{�ބ�ބ��s�ք�ތ�ޔ�ޔ�ތ�ޔ�甽����������������������������������������������������������������������������������������������������������������������������������s��{��s��s��s��s��s��{��s�ք��s��s�ք��s��{��{��s��{��{��s��s��s��s��s��s��s��s��{��{��s��s��{��s��s��s��������������{��{��s��s��{��s�ք��������������{�ބ�ޔ�甽����������������딽猽��猽ތ�ތ�֔�ޔ�ޔ�ޜ�甽��֔�ޔ�甽焵ތ�ބ�ތ�֔�ތ�ތ�ބ�ތ�ք�ބ�ބ��{�ތ��ք�ތ�ތ�焽ބ�ތ�ޔ�猽ތ�ތ��{��{��s��{��s��{��{��{��{��{��{��{�ތ��ތ�ޔ�ޔ�ޜ��������������������������������������������������������������������������������ɲ��������������������������������������ajnz������������֜�甽ބ��{��{��s��{��s��s��{��s��s��s��{��s��{��s��s��s��s��s��s��s��s��{��{��{��s��s��s��{�ޔ�猽ތ�ޜ�ޔ�眽ޔ�⌵֘�֥�������ޥ����������������������������������������������������������������������������������������������������������������������������{��s��{��s��{��s��{��s��s��{��s��s��{��{��s��s��s��s��{�ބ��{��{��s��s��s��s��s��{��{��s��s��s��{�֥�����������s��{��{��{��{��s��{��{��{�����������{�ބ��s��{��{��{�������������甽焵ޘ�֔�ޜ�ޔ�ތ�ޜ�ޔ�ޜ�ޘ�֜�甽ޘ�֔�猽焽ބ��{�ތ�ތ��{�ބ�ޔ�焽ތ��{�ތ�ތ��ތ��{�ބ�ޔ�猽ތ��{�ތ���{��s���{�ތ��{��{��{�ތ�ք��{��{��{��{��{�ޔ�ޔ�ޘ�֜�ޜ���֥���������������������������������������������������������������������������������Բ����������������������������Զ�ҥ�ֵ�������������ޘ��ތ�焽ބ��{��{��s��s��s��s��s��{��s��s��s��s��{��s��{��s��{��s��s��s��{��{��{��{��s��{�ތ���{�ޔ�甽甽ޔ�ތ�ޔ�ޖ�֔�ޘ�֥���������ޜ�������������������������������������������������������������������������������������������������������������������s��s��{��s��{��s��s��s��s��s��s��s��s��s��{��{��s��{��{��s��s��s��s��{��s��s��s��{��{��{��s��s��s��s�����������{��{��s��s��s��{��s��s��s��{�ބ�����������{��{��s��{��{�������������댽ތ�֜�ޘ���֔�ޔ�ޘ�֔�ޥ�甽ޘ�֘�֔�猽ք�ބ�ތ�ޔ�猵ք�ބ�ތ��{�ބ�ތ��{��{��{��ތ�ބ�ތ��ތ���{��{��{��{��{��{��{�ތ��{��{��{��{�ބ��{��{��{��{�ޔ�甽ޔ�����������������������������������������������������������������������������������������������ɶ�ҥ�ʲ����ʲ�������ԭ�ӽ���������������ޜ�甽猵ޔ�焵ތ��{��s��s��s��{��{��s��s��{��{��{��s��{��{��s��s��{��{��s��{��s��{��{��s��s��{��s��{�ތ��ތ�ޔ�ތ�ޔ�甽ޔ�甽ޜ�������������������������������������������������������������������������������������������������������������������������������{��{�ބ��s��s��{��{��s��s��s��s��s��s��{��{��{��s��{��{��{��{��s��s��{��s�ք��s��{��s��s��{��{��{��{�����������{��s��{��{��s��{��s��s��{��s��s�����������s��s��{��{��{�������������猽猽甽ތ�ޜ�ތ�ޔ�ޔ�ޔ�ޔ�ޜ�ޘ�֔�甽甽ޔ�猽ތ�ބ�ބ�ބ�ތ�ތ�ބ�ބ�ބ�ބ�ތ�ք��{�ք�ބ�ބ�ތ��{��{�ބ�ބ��{��{��{�ބ�ބ�ބ��s��{�ބ��s��{��{��{�ބ��{�ތ�ޔ�ޔ�ޜ�ޜ������������������������������������������������������������������������������������������������������������������Խ�����������������֔�ތ��ތ�ބ��{�ބ��{��s��{��{��s��s��{��s��s��{��s��s��{��s��s��{��{��s�ք��{��s��s��s��s��s��{��{�ބ�ތ�ބ�ތ�ތ�ޔ�ޜ�ޥ���������������ޭ����������������������������������������������������������������������������������������������������������������������s��{��s��s��s��s��s��{��{��s��s��{��{��{��s��{��s��{��s��s��s��{��{��s��{��s��{��s��s��s��{��{��{��s�����������s��s��s��s��s��s��{��{��s��s��s�֥�����������s��{��s��{�������������猽ޔ�ޔ�ތ�ޔ�ޔ�ޔ�ޔ�ޜ���ޘ�֜�ޔ�甽ތ�ޔ�ތ�ބ�ތ�猽ބ��{��{�ތ��{�ބ�ބ�ބ�ތ�ބ��{��{��{��{�ބ�ބ��{�ބ�ބ��{��{�ք��{��{�ބ��s��{�ބ��{�ބ�ބ�ތ�ތ�ބ�ޔ�甽ޔ�ޜ���������������������������������������������������������������������������������������������������������ԭ�����������������������甽ތ�ތ�ތ�ތ�ތ��{�ބ��s��{��s��s��s��{��{��s��s��{��{��s��s��s��s��{��s��{��s��{��{��{��s��s��s��{�ތ�焵ތ��{�ތ�ބ�ޔ�ޜ�ޜ�����������������������������������������������������������������������������������������������������������������������������������s��s��s��s��s��s��s��s��{��{��{��s��s��{��s��s��s��s��s��s��s��{��s��{��s��s��s��s��s��s��s��s��s��s�����������s��s��{��s��s��s��s��{��s��{��s�֜�����������{��s��s�ք�������������댵ތ�ތ�ޔ�ޜ�ޔ�����֥���眽ޔ�ޘ��֔�猽ބ�ތ�ބ�ބ��{�ތ�ބ��{�ք�ތ�ބ�ބ��{�ތ��{�ބ��{��{��{��{��s��{��{�ބ�ބ�ބ��{��{�ބ��{�ބ��{��{�ބ�ބ�ތ�ޔ�ޔ���֔����������������������������������������������������������������������������������������������������������������������������Ӝ�����甽甽ޔ�ޔ�猽ޔ�ޔ�ބ�ބ��s��{��{��s��{��s��{��{��{��{��s��s��s��s��s��s��s��s��{��s��{��s��s��{�ތ��{��{��{�ބ�ބ�ބ�ޔ�����֜����������������������������������������������������������������������������������������������������������������������������������{�ބ��s��{��s��{��{��s��{��{��s��{��{��s��{��s��{��s��s��s��s��s��s��{�ބ��{��s��{��{��s��{��{��{��{�����������s��s��{��s��s��{��s��{��{��{��s�֥�����������s��{�ބ�ބ�������������猵ތ�ބ�ތ�ޜ�ޜ���ޜ�����ޜ�甽��猽ތ�ތ�ތ�ބ�ބ�ތ�ތ�猽ތ��{�ބ��{��{��{��{��{��{��{�ބ�ބ�ބ��{��{��{��{�ބ��{��{��{��s��{��{�ބ��{��{��{�ތ�֔�┽甽��ޜ���������������������������������������������������������������������������������������������������������������������������ޥ���ޜ�甽甽猽ތ�ޔ�甽ތ�ބ��{���s��{��s��s��s��{��s��s��{��{��s��{��{��s��s��s��{��{��s��{��s��s��{��s��{��{��{�ބ�ތ�ք�ބ�ތ�ޔ�ޜ���������ޥ�ޥ�������������������������������������������������������������������������������������������������������������������������s��s��s��{��s��s��s��s��{��s��s��{��{��{��s��{��s��{��s��{��{��s��s��s��s��s��{��s��s��s��{��s��{��s�����������{��{��s��s��s��s��s��{��s��{��s��������������{��{��{��{�������������猽ބ�ތ�ތ�ޜ���֜�ޥ���������֔�ޜ�甽ތ�ބ��{�ތ��{�ބ�ބ�ބ�ބ�ބ��{�ބ��{��{�ބ�ބ��s�ք��{��{��{�ތ���{��{�ބ��{��{��s���{�ބ��{�ބ�ތ�ތ�ޘ�֔�眽ޜ������������������������������������������������������������������������������������������������������������������������������ޥ�ޜ���ޔ�ޔ�ތ�ތ�甽甽猽ބ�ތ�ބ��{��{��{��s��s��s��s��s��s��{��{��{��{��s��s��s��s��s��{��{��s��{��{��{��{��{��{��{��s��{�ބ�ބ�ޜ�����������眽ޫ�����������������������������������������������������������������������������������������������������������������������{��{�ބ��s��{��{��{��s��{��{��{��s��s��s��s��{��s��{��s��{�ބ��s��{��s��{��s��s��s��{��{��{��s��{��s��������������s��s��{��s��s��s��s��s��{�ބ�����������{��s�ք��{��{������������{�ތ�ތ�ޜ�甽ޥ�����ޜ�ޘ�֥���ޔ�ޔ�ޔ�猵ތ�ތ�ތ��{�ތ��ބ�ބ�ބ��{��{��{��{��{��{��{��{��{��{�ބ�ތ��{��{��{��{��{��{��s��s��{��s��{�ބ�ބ�ޔ�ޔ�ޜ��������������������������������������������������������������������������������������������������������������������������������ޥ���ޔ�ޜ�ޔ�猽ތ�甽ޔ�ޔ�ޔ�ޔ�猽ބ�ތ��{��{��s��s��s��{��s��{��s��{��{��s��{��s��{�ބ��s��s��{��{��s��s��{��{��{��{��{��{��s��{��{�ބ�ތ��֜�ޜ����������������������������������������������������������������������������������������������������������������������������������s��s��{��{��{��{��{���{��s��{��s��{��s��s��{��s��s��s��{��s��s��s��{��{��{��s��s��s��{��{��{��{��s�֜�����������{��s��{��s��{��{��s��s��{��������������{��{��s��{�ތ��������������{�ތ�ք�ތ�ޘ�֘�֥���������֜�ޘ��ޔ�ތ�֔�甽�{�ތ�ތ�ޔ�猵ބ��{�ք��s�֔�猭�s��s��s��{��{�ބ��{��{��{��{�ބ��{�ބ��{�ތ��{��{��{�ބ�ބ�ބ�ޔ�甽ޜ���֫������������������������������������������������������������������������������������������������������������������������ޜ���֥�甽ޔ�ޜ�ޔ�ތ�ތ��ޜ�ޔ�甽ބ�ބ��{��{��{��s��s��{��s��{��{��s��s��{��{��{��s��{��s��{��{��s��{��{��s��{��{��{��{��s��s��s��s�ք��{�ތ�ޘ��֔����������������������������������������������������������������������������������������������������������������������������������{��s��s��s��{��{��s��s��{��s��{��s��s��{��s��s��{��s��{��s��s��s��s��s��{��s��s��s��s��s��{��{��s��{�ބ��������������{��s��{��{��{��s��{�����������������{��{��s��{��{�������������ތ�ބ�ތ�֜�甽������ޥ���ޥ�����֔�猽�ބ�ތ��{��{�ބ�Ό�ތ��{��{��s��{��{�ބ��{��{��s��{��s�焽�{��{��{��{��{��{��{��{��{��{�ބ�ބ��{��{�ތ�ޥ�����ޫ��������������������������������������������������������������������������������������������������������������������������ޘ�֜���������甽ޜ�����֔�ތ�ތ�ބ��{��{��{��s��s��s��s��s��{��s��s��s��s��s��s��{��{��{��{��{��{��s��s��s��s��s��s��s��{��{��s��ք�ތ�֔�甽甽��������������������������������������������������������������������������������������������������������������������������������s��s��s��{��s��{��s��s��s��s��s��{��{��s��s��s��s��s��s��s��{��s��{��s��s��s��{��s��{��s��{��s��s��s��s�֔������������������s�ք������������������{��s��{��{��{�ބ��������������{�ތ�ބ�ތ�֜�ޘ�֜�������������֔�甽ޔ�猽ք�ތ�ތ�ތ�ތ�ތ�ބ�ބ�ތ��{�ބ��{�ތ��{��{��{��{��{��{��{��{�ބ��s��{�ބ��{��ք��{��{��s��{�ތ�ޔ�������������������������������������������������������������������������������������������������������������������������������֥�������֜����ޔ�ޔ��{�ތ��ތ�ք�ބ��{��s��s��s��s��s��s��s��{��s��{��s��{��s��s��s��{��s��{��{��{��s��{��{��{��{��s��{�ބ��s��{��{��s�ք�ތ�ޔ�甽ޜ�������������������������������������������������������������������������������������������������������������������������������{��{��{��s��s��{��s��{��s�ք��{��{��s��{��s��s��{��{��{��s��{��{��s��{��{��{��s��{��s��{��s��{��s��s��s��{�ֵ�����������������������������������������s��{��{��{�ބ��{�������������焵ބ�ތ�ތ�ޔ�ޔ���������������甽ޘ�֔�ތ�ތ�ބ�ބ�ތ�ބ�ތ�ތ�ތ�焽�{��{��s��{��{��{�ބ�ބ��{��s��{�ތ��{��{�ބ�ބ�ބ��{��{���{��{�ބ�ބ�ތ�ޔ��������������������������������������������������������������������������������������������������������������������������֜�ޜ�ޜ�ޜ���֔�ޔ�ޔ�ތ�ބ�ބ�ބ�ބ��{��{�ք��{��s��s��{��s��s��{��s��{��{��{��s��{��{��s��s��{��s��s��s��{��{��{��s��s��s��{��{��{�ބ��{��{�ބ�ބ��{�ތ�ޔ���������������������������������������������������������������������������������������������������������������������������������s��s��{��{��s��{��s��s��s��s��{��s��{��s��s��{��s��s��{��s��{��{��s��s��s��s��{��s��s��s��s��{��{��s��s��s��{������������������������������������s��s��{��{��s��{��{�֜�������ℵބ�ތ�ޔ�ޘ�֜�ޜ�ޭ�ޥ�������ޥ�����甽甽ބ�ބ�ތ��ތ�ބ�ތ�ބ�ބ�ބ��{�ބ��s��{�ބ��{�ބ��{��{��{��{��{��{�ބ�ތ�ބ�ބ��{�ބ�ބ�ބ�ބ�ތ�ތ�ޜ�眽ޥ�����������������������������������������������������������������������������������������������������������������������֜�甽ޔ�眽ތ�ޔ�ތ�ޔ�焵ބ�ތ�ޔ�ބ�ބ�ތ�ބ�ބ��{��s��s��s��{��{��{��s��{��s��s��s��{��s��s��{��{��s��s�ք��s��s��s��{��s�ք�ބ��s��{��{��{��{��{�ބ�ބ�ތ�ޘ�֘�֜�����������������������������������������������������������������������������������������������������������������������������{��s��s��{��{��{��s��s��s��s��s��s��{��s��s��{��s��s��s��{��{��s��s��s��{��{��s��s��{��{��s��{��{��{��{��s��s��{��{��������������������������{��s��{�ބ��{��{��{�ބ�ބ��s�ք��{�ބ�ތ�ބ�ތ�ޔ�ޜ���������������眽ޔ���甽ތ�ބ�ބ��{�ތ�ޔ�ބ�ބ�ބ�ބ��{�ބ��{��{��{��{��{�ބ��{��s��{��{��{�ބ�ބ��{�ތ�焵ބ�ތ�ք�ބ�ބ�ބ�ތ�ޔ�������眽ޫ���������������������������������������������������������������������������������������������������������������甽ތ�ތ�ތ�猵ք��{�ތ�ތ�ތ�ތ�ބ��s�ք�ބ��{��{�ބ��s��{��s��{��s��s��s��s��s��s��{��s��s��s��s��s��{��{��s��s��{��s��s��{��{��{�ތ���s�ք��{��{�ބ��s�ք�ބ�ތ�ޔ�ޜ�ޜ��������������������������������������������������������������������������������������������������������������������������{��{��s��s��{��s��{��{��{��{��{��{��{��s��s��{��{��{��s��{��s��s��{��s��{��s��s��s��s��{��s��s��s��{��{��{��{��s��s��s��{��s�猵ބ��{��s��{�ބ��s��{��{��{��{��s��{��{��{��{��ބ�ބ�ތ�ބ�ޘ�֔�ޥ���ޜ�������������ޔ�ތ�ތ�ބ�ތ��{��{�ޔ�ތ�ބ��{��{�ބ�ބ��{��{��{��{��{��{��{��s��{�ބ�ބ�ބ�ތ�ބ�ބ�ތ�焽�{�ք�ތ�ք�ތ��ޔ�ޔ�ޔ������������������������������������������������������������������������������������������������������������������뜽ޔ�猽ބ�ބ�ތ�ތ�ތ�焵ބ�ތ��{��{��{�ބ��{��{��s��s��s��s��{��s��s��s��s��s��s��s��s��s��s��{��s��{��s��{��s��s��{��s�ք��s��{�ބ��{��{��{��{�ބ�ބ��{��{�ބ�ތ�ބ�ޔ�ޔ�ތ�ޜ�ޜ�ޥ��������������������������������������������������������������������������������������������������������������������s��s��{��{��{��s��s��{��s��s��{��s��{��s��{��s��s��s��{��s��{��s��{��s��s��{��{��{��s��{��{��{��{��{��{��{��{��{��{��{��{��{��{��s��s��{��{��{��s��{��{��s��s��{��{��{��{��{��{�ބ�ބ�ތ�ތ�ޜ�����������������ޔ�ޥ�甽猽���ތ��{�ތ�ބ�ބ�ބ��{�ބ��{��{��s��{�ބ��{��{��s�ք��{�ތ�焽ބ�ބ�ޔ�ތ�ތ�֔�猽�{�ބ�ތ�ތ�ތ�ޔ�ޘ�֘�֔������������������������������������������������������������������������������������������������������������������猽ބ��{�ތ�ތ���{�ބ�ބ�ބ�ބ�ތ���{��{��{��{��s��s��{��s��{��{��{��{��{��{��s��s��s��s��s��s��{��s��s��{�΄��{��{��{��s��{��{��{��{��{��{�ք��{��{��{��s��ք�ބ�ޔ�ޔ�ތ��ޘ�ֵ�����������������������������������������������������������������������������������������������������������������{��{��{��s��{��{��s��{��s��s��s��s��{��{��{��s��s��{��{��s��s��{��s��{��s���{��s��s��s��s��{��{��{�ބ��{��{��{��{�ތ��{��{��{��{��s��{��{��s��{��{��{�ބ��{��{��{��ތ��{��{�ތ�ބ�ތ�ޔ�����������ޥ�������ޘ�֔�眽ޔ�猽ތ�ތ��{�ޔ�猽ތ�ބ�ޔ��{�ބ�ޔ�猭�{��{��{��{��{��{�ތ��{�Ό��猽ބ�ބ��{�ޔ�猽ތ�ތ�ތ�焽ބ�ޔ�ޔ�ޔ�ޜ������������������������������������������������������������������������������������������������������������������猽֔�ބ��{��{�ތ�ތ��{�ބ�ތ�ބ��{��{��{��{��s��{��{��{��{��{��{��s��{��s��s��{��{��{��s��s��s��s��s��s��s��{��{��{��{��s��s��{�ބ��{�ޔ��{�ބ��{��{��{��s��s��{�ތ�ބ�ބ�ޔ�ޔ�ޜ�猽ތ�֜�����������������������������������������������������������������������������������������������������������������{��s��s��s��s��{��s��s��s��{��s��s��s��s��s��s��s��{��s��s��{��{��s��{��{��s��{��s��{��{��{��s��{��{��{��{��{��{��{�ތ��s��{��{��s��s��{��{��{��{��{��{�ބ��{��{��{��s��{��{�ޔ�猵�{�ތ�ޔ�甽��֜�ޜ�����������甽ޜ�甽ޔ�ތ�ތ�ބ�ޔ�猵�{�ބ�ބ�ބ�ބ��{��s��{�ބ��{��s��{�ބ��{�ތ��{�ތ�ބ�ތ�焽�{�ތ�ތ��{��{��{�ތ�ބ�ތ�ތ�ޔ�ޘ�֜�ޥ���������������������������������������������������������������������������������������������������������������甽猽�{�ބ��{��{��{��{��{�ބ��{�ք��{��{��{��{��s��s��{��s��{��s��s��{��s��s��s��s��s��{��{��s��s��{��{��{��s��{��{��{��s�ք��{��s��{��{�ތ��{�ބ��{�ބ��s��{��{��{�ތ�ք�ޔ�甽甽ތ�ޔ�ޔ����������������������������������������������������������������������������������������������������������������s��{��s��s��s��s��{��{��{��{��s��s��s��{��s��s��s��{��s��{��s��{��s��{��{��s��{�ބ��{��{��s��s��{��{��s��{�ބ��{��s��{��{�ބ��{�ބ��{��s��{��s��{��s��{��s��{�ބ��{��s��{�ތ�ք�ބ�ޔ�猽ޔ�ޘ�֥���������������������֔�猽ބ��{�ތ�ތ��ބ�ބ�ތ��{��{��{��{��{��{�ބ��{��{�ބ��{�ޔ�焵�{�ބ�ބ�ބ�ތ��{��{��{�ތ�ބ�ތ�ބ�ތ�猵ޔ�ޜ�ޜ���������������������������������������������������������������������������������������������������������ޔ�猽ބ��{�ބ�ބ�Ό��{��s��{��{��{��{��{��{��{��s��{��s��s��s��s��{��s��{��s��{��{��s�ք��{��{��s��s��s��s��s��{��{��{��s��{��s��s��s��{��{��{�ބ��{��{��{��{��{��{�ބ�ބ�ބ�ތ�ތ�ބ�ޔ�ޔ������������������������������������������������������������������������������������������������������������������s��s��{��s��s��s��{��{��s��s��{��{��s��{��{��{��{��{��{��s��{��{��s��{��s��{��s��{��s��{��{��s��{��{��{��{��s�焵�{�ބ��{��{��s��{��s��{��s��{��{��s��{��{��{��{��{��{�ބ�ބ��{�ތ�ތ�ޔ�甽ޜ�����������������֜�甽甽ޔ�ތ�猽ތ�ք�ބ�ބ�ބ�ބ�ބ��{��{��{��{��{��{��{��{��{�ބ�ބ�ތ�ބ��{��{�ބ�ބ�ތ�ބ�ތ�ބ�ތ�ތ�ޔ�ތ�ތ�ޔ���甽������������������������������������������������������������������������������������������������眽ޔ�ތ�ބ�ބ�ք�ބ��{��{�ބ��{��{��{��{��{��{��{��{��s��s��s��{��s��s��s��{��{��s��{��s��{��{��{��s��{��s��s��s��s��s��{��s��s��{��s��s��{��{��{��{�ބ��{�ބ��{�ބ��{�ބ�ބ�ބ�ބ�ތ�ތ�ބ�ޔ�ޖ�֜�ޜ�ޫ������������������������������������������������������������������������������������������������������������s��s��s��s��s��{��{��s��{��s��{��s��{��{��{��s��s��s��s��s��s��{��{�ބ��s��{�ބ��{��{��{��{��{��{��{�ք��{��{�ބ��{��{��s��{��{��{��s��{��{��{��s�ք��s��{�ބ��{�ބ��{��{��{�ބ�ބ�ތ�ބ�ޔ�ޜ�ޜ���������������甽ޔ�ޔ�ތ�ތ�ތ�ތ�猽�{�ބ�ތ�ք�ބ��{��{��{��{��{�ބ��s��{��{��{��{�ބ�ތ�焵ބ��{�ބ��{�ք�ބ�ބ�ބ�ތ�ތ�ތ�ޔ�甽ޜ���֜����������������������������������������������������������������������������������������眽ޜ�甽甽ބ�ތ�ބ��{��{�ތ�ք��{�ތ�焵�{�ބ�ބ��{��s��s��{��{��s��{��{��{��s��{��{��s��s��{��{��s��s��s��{��s��{��s��s��s��s��{��{��s��{��s��s��s��s��{��{��{��{��{��{��{�ބ�ތ�ބ�ތ�ތ�ޔ�ޔ�ޔ�ޜ�碿Ԡ�������������������������������������������������������������������������������������������������������������s��{��s��s��{��s��s��s��s��s��{��s��{��{��s��s��{��s��s��s��{��s��s��{��{��{��s��s��s��s��{��{��{�ތ�ք�ބ��{�ބ��s���{��{�ބ�ބ�ބ��{��s��{��{��{�ބ�ބ��{��s��{��{�ބ��s�ք�ބ�ތ�ތ�ޘ�֘�֠�������������ޘ�֔�甽ތ�ބ�ތ�ބ��{�ތ��ބ��{�ք��{��{��{��s�ք��{��{��{��{��{��{�ބ��{�ބ�ބ�ބ��{�ބ��{��{�ք�ތ�ތ�ތ�ތ�ޔ�猽ޔ�ޔ�甽��ޘ�֥������������������������������������������������������������������ޥ���ޥ���ޜ�������ޜ�甽甽猵ތ�ք��{��{��{��{�ք��{��s�ք�ބ��{��{��s��s��s��s��s��{��s��{��{��{��{��s��{��{��{��s�ք��{��s��s��s��s��s��s��s��s��s��s��{��s��{��s��s��s�ք��{�ބ��{��{�ބ�ބ��s�ք�ބ�ބ�ޔ�甽ޔ�甽ޔ�ޘ�֘�֥����������������������������������������������������������������������������������������������������������s��{��s��{��s��s��{��{��{��{��s��s��{��{��{��{��s��s��{��s��s��s��s��s��{��{��{��{��s��{�ބ��{��{��s��{��{��{��{��{�ބ��{��{�ք��{��{��{��s�ք��{�ބ��{��{��{��{��{��s��{�ތ�ք�ބ�ބ�ތ�ތ�ޘ�֜�������������ޔ�猽ތ�ތ�ބ�ބ�ބ�ތ��{�ތ�焭�{��{��{��{��{��{��s��{��{��{�ބ��{�ք��{�ބ�ބ�ބ��{��{��{��{�ք��{�ބ�ބ�ތ�ޔ�甽ޔ�猵֔�甽ޜ���ޥ�������������������������������������������������������������������甽��֜�ޔ�ޜ���֔�ޔ�ޔ��{�ބ�ބ��{�ք�ތ�ތ�ք��{��{��{��{�ބ��{��s��{��{��{��s��{��{��{��{��{��s��s��s��s��{��{��s��{��s��s��s��s��{��s��{��{��s��s��s��s��s��{��{��s��{��{��{��{�ބ��{��{��{�ޔ��{��{�ތ�ޔ�ޔ�ޔ�甽ޘ�֘�֜������������������������������������������������������������������������������������������������������������{��{��{��{��s��s��s��s��s��s��{��s��s��{��s��{��{��s��s��s��s��{��s��{��{��{��{��s��{��{��{��{��{�ބ�ތ�ք��{��{��{��{�ތ��{��s��{��{�ބ��{�ބ��{�ބ��s��{��{��{��{��{�ތ�ބ�ބ�ބ�ބ�ތ�ތ�ޘ�֥���֜�ޥ�����ޜ�猽ތ�ތ��{�ތ�ք�ބ��{��{���{��{��{��{��s��s��{��{��{��{��{��{��{��{��s��{��{��s�ք��s��ք�ބ���{�ތ�ތ�ތ�֔�ތ�ޘ��֔�ޘ�֜�ޜ�ޥ������������������������������������������������������֖�֘�֜�ޔ�ޜ�ޘ�֜�甽ތ�ޔ�甽甽ތ�ޔ�猽�{��{��{�ք�ބ�ތ�ބ�ތ�ޔ��{�ބ��{��s��{��{��{��s��{��s��s��{��s��{��s��{��s��{��s��{��{��s��s��s��s��s��s��s��s��s��s��{��s��s��s�ք��{��{��s��s��s��{��{��s��s�ք��s��{�ބ�ޔ�ޔ�甽ޔ�����ޥ�֜�ޔ���������������������������������������������������������������������������������������������������������{��s��{�ބ��s��s��s��{��s��s��s��s��{��{��s��{��s��{��{��{��{��{��s��s��{��{��s��{�ބ�ބ��s��{�ތ��{��s���ք��{��{��{��{��{�ބ��{��{��{�ތ��{��s��{��{��s��{�ބ�ތ��{�ތ�ތ�ބ�ތ�ތ�ޔ�ޔ�ޜ���眽ޠ�����甽ތ�ޔ��{�ތ�ތ�焵ތ��{��s��{��{�ބ��{��{�ބ��{��s��{��s��{��s��{��s��{��s��s��s��s��{��{���{�ތ��{��{�ތ�ބ�ތ���֔�ޘ�֘�֜���֜�ޥ����������������������������������������������������ތ�ޘ�֔�ޔ�ޔ���֔�甽猽ޔ�甽甽ތ�ޔ��{�ތ��{��{��{��{����{�ތ��{��{��{��s��{��s��s��s��s��s��{��{��s��{��s��{��s��s��s��{��{��{��s��s��s��{��s��s��s��s��{��{��s��s��s��s��{��s��{��{��s��s��{��s��s��{��{��{�ތ��ޔ�甽ތ�ޔ���֥���ޥ�������������������������������������������������������������������������������������������������������������{��s��{��{��s��{��{��s��s��{��s��s��s��{��s��{��s��s��s��{��s��s��s��{��{��s��{�ބ��{�ބ�ތ��{��{�ތ�ތ�ތ�ބ�ތ�ތ��{�ތ��{�ތ��{�ބ�ބ��{���{��s��{��{��{�ބ�ބ�ތ��{�ތ��{�ތ�ք�ޔ�ޔ�ޜ�����֜�ޥ�����猽ތ���{�ބ��{�ބ�ބ��{��{��{��s��{��s��{��{��{��{��s��{��{��{��s��s��s��{��{�ބ�΄��{��{�ތ�ބ�ތ�ޔ�猽ބ�ތ��{�ތ�ބ�ތ�ޔ���֜�ޘ�֜�眽ޥ�������������������������������������������������֔�ޔ�ޔ�ޜ�甽ޔ�ތ�ތ�ތ�ޔ�ބ�ތ���{��{��{��{�ބ��{��{�ބ�ތ���{��{�ބ��{��{��{��{���s��s��s��s��{��s��{��{��s��s��{��{��{��{��{��{��{��s��s��{��{��{��s��{��{��{��{��{��s��s��{��s��{��s��s�ք��{��s��{��s��s��ޔ�ޔ�ޔ�ތ�ޜ�ޥ���������������������������������������������������������������������������������������������������������������s��s��s��s��s�ք��{��{��{��s��s��s��{��s��s��{��{��{��{��s��s��s��s��{��{��s��{�ބ�ބ�ބ�ބ�ބ�ތ���{�ތ�ތ�ބ�ތ�ք�ތ��{�ތ�ބ�ތ��{��{��{�ތ��{��{�ބ��{��{��{���{�֔�焵ތ�ތ�ޔ�ޔ�甽����ޜ�眽ޜ�ޔ�猵ބ��{��{��{��{��{�ބ�ބ��{��{��{��{��{��{��{��{��s��{��s��s��{��s��{��s��s��{��{��s�ք��{�ބ�ތ�ތ��猵�{�ބ�ތ�ބ�ޔ�ތ�甽ޜ���ޜ��������������������������������������������������������ޔ�甽ތ�ޔ�ތ�ޔ�甽猽ތ�ޔ�猵ތ�ތ�焽�{��s��{��s��{��{��{��{��s��{��{��{��{��s��{��s��{��s��s��s��s��s��s��s��{��{��s��s��{��s��{��{��{��{��s��{��s��{��s��s��s��s��s��s��s��s��s�ք��{��{��{��s��s��s��{��{��s��{��{��{�ބ�ޔ�ޔ�ޘ�֜����������������������������������������������������������������������������������������������������������������s��{��{��{��{��s��{��s��{��s��s��s��s��s��s��{��s��{��s��{��{��{��{��{��{��{��s�ք�ބ�ބ�ބ�ތ�ތ�ތ�猽ތ�ޔ�ޔ�ޔ�猽֔�⌵�猽ބ��{��{��{��{�ބ��s�焵�{��{�ބ��{�ތ�ք�ބ�ތ�ތ�֔�������������ޜ�甽ތ�ބ��{��{�ބ��{��{�ք��s�ք�ބ�ބ��{��{��{��s��{��s��s��{��s��s��{��{��s��s��s��{��{��{�ބ�ބ�ބ�ބ�ބ�ބ�ބ�ތ�ބ�ތ�ތ�ތ�ޔ�甽ޜ���ޠ���ӫ����������������������������������������������딽ތ�ތ�ތ�ތ�ބ�ޔ�ޖ�֔�ޔ�ޜ�猽ޔ�ތ�ބ�ބ�ބ��s��s��s��{��{��s��{��{��{��{��s��s��s��s��{��s��{��{��{��s��{��s��{��{��{��{��s��s��{��s��{��s��{��{��s��s��s��s��{��s��{��{��s��s��s��s��s��s��s��{��s��{��s��{��s��s��s��{�ބ�Ό�ޔ�ޘ�֥������������������������������������������������������������������������������������������������������������������s��s��s��s��{��s��{��{��s��s��{��s��{��s��{��s��s��s��{��s��s��{��{��{��{�ބ�ބ�ބ�ބ�ތ�ބ�ބ�ބ�ޔ�甽ތ�ޔ�甽ތ�ޔ�ޔ�ޜ�眽ޔ�焽ބ��{��{�ބ��{�ބ��{��{��{��{��{�ބ�ތ�ބ�ތ�甽ތ�ޔ���ޜ�ޜ�����甽ޔ�ތ�ބ��{�ބ��{��s��{��s�ք��s��{��s��{��s��{��{��s��s��{��{��s��s��s��{��{��{��s�ք�ބ��{��{�ք�ބ�ބ�ބ�ބ�ތ�猵ބ�ބ�ބ�ތ�ޜ�ޔ�����������������������������������������������������������֔�ބ�ތ�ބ�ބ�ތ�焵ޔ�ޔ�ޔ�ޘ�֘�֔�甽ބ�ބ��{��{��{��{��s��s��s��{��{��{��{��s��s��s��{��s��{��s��s��s��s��s��s��s��s��s��s��{��s��s��s��{��{��{��s��s��s��s��s��{��{��{��{��s��s��s��{��s��s��s��s��{��s��s��s��s��{�ބ��{�ބ�ޔ���ޥ��������������������������������������������������������������������������������������������������������������������{��{��{��{��{��s��s��{��s��s��s��s��{��{��s��s��{��s��{��{��s��s��{���{�ބ�ބ�ބ�ތ�ބ�ތ�ޔ�ޔ�ތ�ޔ�ތ�ޔ�甽ޜ�甽甽ޘ�֔�ޔ�ތ�ތ��{��s�ք��{��{��{�ބ��{�ք�ތ���{�ք�ތ�ބ�ތ�ޔ�ޔ�ޜ�ޜ���ޘ�֔�ތ�ތ�焵�{�ބ��s��{��{��s��{��{��{��s��s��{��s��{��{��{��{��s��s��{��{��{��{��s��s��{��{��{�ބ�ބ�ބ�ބ�ތ�ބ�ބ�ތ�ތ�ބ�ބ�ތ�ք�ޜ�ޜ�ޜ����������������������������������������������������⌽ք�ބ�ބ�ބ��{�ތ�ތ�ތ�ޔ���֔�ޘ�֔�⌽ք��s��s��{��{��s��s��s��{��{�ބ��s��{��s��{��s��s��{��s��{��s��s��s��{��{��{��{��s��s��{��s��{��{��{��s��s��{��s��s��s��s��{��s��{��{��s�ք��s��{��s��{��s��s��s��{��s��{��{��{��{��ޔ�ޜ�����������������������������������������������������������������������������������������������������������������������{��{��s��{��s��s��{��{��{��{��s��{��{�ք��{��s��{��{��{��{��{��s��{��{��s��s�ք�ތ�ތ�ތ�ބ�ތ�ޔ�甽甽ތ�ޔ�甽眽ޘ�֘�֜�ޜ�甽ޔ��{�ބ��s��s��{��{��{��{��{�ބ��{��{��{�ތ�焵ތ�ތ�ޔ�����ޔ���֔�甽ތ�ބ�ބ��{�ބ��s��{��s��{��{��{��s��s��{��s��{��s��{��s��s��{��s��s��s��s��{��s��s��{��{�ބ��{���{��{�ބ�ތ�猽焽ބ�ތ��{�ބ�ޔ�ތ�ޔ���ޜ�������������������������������������������������뜽ޔ�ބ��{��{��{��{�ބ��{�ބ��{�ތ��ޔ�猽ތ�ބ��{��{��s��s��s��{��{��s��s��s��s��s��s��s��{��{��s��s��{��s��s��s��{��{��{��{��s��s��s��{��s��s��s��{��{��s��{��s��s��{��s��s��s��{��s��{��s��s��s��{��s��s��{��s��{��{��s��s��{�ք�ތ�ތ�ޔ�ޥ�������������������������������������������������������������������������������������������������������������������s��{��{��{��s��{��s��s��s��s��{��{��s��s��s��{��s��s��s��{��s��{��{��{��{��{��{�ތ�ބ�ތ�ތ����֔�甽ޜ�甽ޥ�������ޜ�甽甽�{�ք�ބ��{��{��{��s�ք��{��{�ތ�ތ�ތ�ތ�ތ�ތ�ތ�ޔ������֔�ޔ�ތ�ބ�ބ�ބ��{��{��s��s��{��s��{��{��s��s��s��s��s��{��s��{��{��{��s�ք��{��{��s��s�猭�{��{�ތ�ބ�ބ�΄�ތ�猽ތ��ބ�ތ�ޔ�甽猵֔�ތ�ޔ�ޜ������������������������������������������������甽ޔ��{�ތ��{��s��s��{��{�ތ��{���ބ�ބ�ބ��{��{��{��s��s��{��s��{��s��s��{�ބ��{��s��{��{��{��{��s��{��s��{��s��s��s��s��{��s��s��s��s��s��{��{��s��{��{��s��s��{��{��s��s��s��s��s��s��s��s��s��s��{��{��s��s��s��{��{��{��{�ތ��ޔ�������������������������������������������������������������������������������������������������������������������������s��{��{��{��{��{��s��{��s��{��s�ք��s��s��s��{��s��s��{��{��s��{��s��{��{�ތ�ք�ތ�猽�{�ޔ�甽ތ��ތ�ޘ�֔���������֜�眽ޜ�甽焽�{�ޔ��s��{�ބ�ބ��{��{��{��{�ޔ��{�ތ��{�ք�ބ�ތ�ތ�ޔ�ތ�ތ�ތ�ބ��{��{��s��s��{��s��s��s��{��{��{��{��{��{��{��s��{��{��s��s��s��{��{��s��s��{��s��{��s���{���{�ތ��{�ތ�ތ�ތ�ތ��{�ތ�ތ�֔�猽ޔ�ޘ�֜��������������������������������������������뜽ޘ�֜�ތ�ތ��{��{��{��{��s��{�ތ��{�ބ�ތ�焽�{��s��{��s��s��{��{��{��s��{��{��{��{��s��s��{��{�ބ��s��s��s��{��{��{��{��s��{��s��s��{��{��s��s��{��{��s��{��s��s��s��{��{��s��s��{��{��s��s��s��s��{��s��s��{��s��s��s��s��{��s��{��{�ތ�ބ�ޔ�ޜ�ޥ��������������������������������������������������������������������������������������������������������������������{��{��s��s��s��s��{��{��s��{��{��{��s��{��s��s��s��s��{��s��s��{��{��{��{�ތ�ތ�֔�ތ�ބ�ތ�ތ�ތ�ޜ�甽甽ޜ�眽ޜ�������ޥ���甽ތ��{��{��s��{��s��ք��{�ތ��{��{��{�ބ��{�ք�ތ�ތ��{�ޔ�猵�ք��{��{��{��{��s��{��{��s��{��s��s��{��s��s��{��s��{��s��s��s��{��s��s��s��s��s��{��{��{��{��s��{��{�ބ�ތ��{�ޔ�焭΄�ތ�ք�ތ�ތ�ތ�猵֔�ޜ����������������������������������������������������疷��{��{��s��{��{��{��{��s��{��{��{��{��s��{��s��{��s��{��{��{��{��s��s���s��s��s��s��s��{��s��s��s��s��s��{��s��s��s��{��{��{��s��s��s��s��{��{��s��s��{��s��s��s��{��s��{��s��s��s��s��{��{��s��s��{��{��s��s��s��s��s��s�ք�ބ�ޔ�ތ�֜�ޜ������������������������������������������������������������������������������������������������������������������s��s��s��{��{��{��{��s��s��{��s��{��{��{��s��s��{��{��s��{��s��{��{��{�ބ�ބ�ޔ�ޔ���֔�ޔ�猽ޜ�ޔ�甽ޜ�ޜ�������������眽ޔ�猽�{��{��{��{�ބ�ބ�ބ�ތ��{�ބ��{�ބ�ބ�ք�ބ�ބ�ތ�猽�{�ބ��{��{��{��s��{��s��{��s��s��{��s��s��s��s��s��{��s��s��s��{��s��s��s��s��{��s��{��s��s��{��s��{��{�ބ�ބ�ބ��{�ތ�ތ�ތ�ތ�ބ�ބ�ތ�֔�ތ�ޔ�甽�����������������������������������������������������甽甽ތ��{��{��{��s��{��{��s��{��s��s��s��s��s��{��s��{��{��s��{��s��{��s��{��s��{��s��s��s��{��s��s��s��s��s��{��s��s��s��s��s��{��s��s��s��{��s��{��{��s��{��s��{��s��{��{��{��{��{��s��s��s��s��{��s��{��s��s��s��s��s��s��{�ބ�ބ�ބ�ޘ�֥�����������������������������������������������������������������������������������������������������������������������s��{��s��s��s��s��s��s��s��s��{��s��s��{��{��s��{��s��s��s��s��s��{��{��{�ބ�ތ�ޔ�ޔ����甽猽ޘ�֜�ޜ�ޠ���������������甽焽ތ��{��{�ތ��{��{�ތ�ބ�ބ�ތ�ބ��{�ތ��{�ބ��{�ք�ބ�ބ��{��{��{��s��{��{��{�ބ��s��s��s��s��{��{��s��s��s��s��s��{��s��s��{��{��s��{��{��{��{��{��s��{��{�ބ�ތ�ބ�ބ�ބ�ތ�焽ތ�ք�ޔ�ތ�ބ�ޔ�ޔ�甽甽ޘ�֘�֥�������������������������������������������ޘ�֔�猵ք�ބ��{��s��{��{��{��s��{��s��s��{��s��s��s��s��{��{��s��s��{��{��s��{��{��{��{��{��s��s��s��{��{��s��{��s��s��{��{��{��{��s��s��s��s��s��s��{��{��s��{��s��{��s��s��s��s��{��s��s��{��s��s��s��{��{��s��s��s��{��{��s��s��{��{�ތ�ޔ�ތ�ޜ�眽ޫ������������������������������������������������������������������������������������������������������������������s��s��{��{��s��s��s��s��{��{��s��s��{��{��{��s��s��s��{��s��{��{��{��{��{�ބ�ތ�ޔ�ޘ�֜�ޘ�֔�ޜ�ޔ�ޜ���������������������ޔ�ބ��{�ބ��{��{�ք�ބ�ބ�ތ�ތ�ք�ބ�ބ��{�ބ�ބ�ބ�ތ��{�ބ��{��s��s��s��s��{��s��{��s��s��s��s��s��s�ք��s��s��{��s��s��s��s��s��{��{��s��s��s��{��{��{��{��{�ބ�ބ�ބ�ތ�ބ�ބ�ބ�ތ�ތ�ޔ�ތ�ތ�ތ�ޔ���֜���ޫ�������������������������������������������甽甽ބ��{��{��s��{��s��{��s��s��s��s��{��s��s��{��{��s��s��{��s�ք��s��s��{��s��s��{��s��s��s��s��s��s��s��s��s��s��{��{��{��s��s��s��s��{��{��{��s��s��s��s��s��s��{��s��{��{��s��s��s��{��s��s��{��{��s��s��s��s��s��s��s��s��s��{�ތ�甽ޔ���ޜ����������������������������������������������������������������������������������������������������������������������s��{��s��{��s��s��s��{��{��{��{��{��s��s��s��{��s��s��s��s��s��{��{�ք��{�ތ�ք�ތ�ޔ�ޜ�甽��֘�֘�֥�����������������ӥ���甽ބ�ބ�ބ�ތ��{�ބ�ބ�ބ�ބ��{�ބ��{��{�ބ��{�ބ�ބ�ބ��s��{��{��{��{��s�ք��s��{��s��s��s��{��{��s��{��s��{��s��s��{��s��s��s��{��s��s��s��s��{��{��s��s��{�ތ�ք�ބ�ބ�ބ�ތ�ބ�ތ�ތ�ތ�猽ޔ�甽甽甽��ޜ���������������������������������������������甽ތ�ބ�ބ��{��{��{��s��s��{��s��{��s��s��s��s��s��s��{��{��s��s��s��{��s��s��s��s��{��s��{��s��{��s��s��s��{�ބ��{��s��s��s��{��s��s��{�ք��s��s��s��{��s��s��{��{��s��s��{��s��{��{��s��s��s��{��{��s��{��s��s��{��s��s��s��s��s��{�ބ�ތ�ޔ�甽ޜ���֜�������������������������������������������������������������������������������������������������������������������s��s��{��s��s��s��s��{��{��{��s��s��s��s��s��s��{��s��{��s��{��s��s��{�ބ�ބ���ޔ�ޔ�ޔ�ޔ�ޔ�����������������������甽ޔ�猵ތ��{��{�ތ�ތ�ބ��{��ބ�ތ�ք��{�ބ��{��{��s��{��{��{��{��{��s��{��{��{��s��{��{��{��s��{��s��s��s��s��{��s��s��s��{��{��s��s��s��{��{��s��{��{��{��{��{�ބ�ބ�ތ�ތ�焽ތ�ބ�ބ�ތ�ޔ�ޔ�甽��֥�甽ޜ���������������������������������������������֔�ބ�ބ��{��{��s��s��s��s��{��{��{��{��{��{��s��{��s��s��s��s��{��s��s��{��s��s��{��{��s��s��s��s��{��{��s��s��s��{��s��s��s��{��{��{��{��s��s��s��s��s��s��s��s��s��{��s��s��{��s��s��s��{��{��{��s��s��{��s��{��{��{��s��s��{��{��s��s�ք�ޔ�������ޜ������������������������������������������������������������������������������������������������������������������s��s��{��s��s��s��{��{��{��s��{��{��s��s��s��{��s��{��{��s��s��{��{��{��{�ތ�ք�ތ�ޔ�ޔ�ޔ�ޘ�֜���֥��������������������ޜ�ޔ�猽�{�ތ�ބ�ބ�ތ�ք�ތ�猭�s��{��{�ބ��{��{�ތ��s��{��s�焵�{��{��{��{��{��{��{��s��s��s��{��s��s��s��s��s��s��s��s��s��s��s��s��s��{��s��{�ބ��s���{��{�ބ��{�ބ�ތ�猽猭�֔�猽ތ�ޘ�֔���ޜ�ޥ�������ޫ�������������������������������������猽�{�ތ��{��{��{��s��{��s��s��{��s��{��s��s��s��s��{��s��{��s��{��{��s��{��s��s��{��s��s��s��{��{��{��s��{��s��{��{��{��s��s��{��{��{��s��s��{��s��{��s��{��{��s��{��s��{��{��s��s��s��{��{��s��{��{��{��s��s��{��{��s��s��{��{��{��{��{�ބ�ތ�ތ�ޜ�疷֥������������������������������������������������������������������������������������������������������������������� \ No newline at end of file diff --git a/sdk/media/woob.wav b/sdk/media/woob.wav new file mode 100644 index 0000000..c8a4d0f Binary files /dev/null and b/sdk/media/woob.wav differ diff --git a/sdk/readme.txt b/sdk/readme.txt new file mode 100644 index 0000000..4951b5f --- /dev/null +++ b/sdk/readme.txt @@ -0,0 +1,26 @@ +This directory contains all SDK components. + +To ensure compatability with all editors, all tabs have been replaced +with spaces in all source files. + +BIN: + Sample app executables + +INC: + contains include files for DirectDraw, Direct3D, DirectSound, DirectInput + and DirectPlay + +LIB: + contains library files for DirectDraw, DirectSound, and DirectPlay + *.LIB : COFF libraries (used by Microsoft Visual C++ 2.0 or higher) + *.LBW : 32-bit OMF libraries (used by Watcom C/C++ 10.0) + +SAMPLES: + Contains all sample code. See readme.txt file in this directory for + more details. + +Notes for users of Visual C++ 4.2 +--------------------------------- +Visual C++ 4.2 includes the DX2 header files and libraries. If you are +getting errors compiling, make sure that the DX3 include +and lib paths come before the MSVC++ 4.2 include and lib paths. diff --git a/sdk/samples/d3dbld.mk b/sdk/samples/d3dbld.mk new file mode 100644 index 0000000..c27e3a9 --- /dev/null +++ b/sdk/samples/d3dbld.mk @@ -0,0 +1,33 @@ +############################################################################ +# +# Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. +# +# File: d3dbld.mk +# Content: Master makefile for Microsoft Visual C++ 2.0 +# For controlling what gets built (debug, retail, clean) +# +############################################################################ + +goal: debug.mak + +all : debug.mak retail.mak + +debug retail: $@.mak + +!ifndef MAKENAME +MAKENAME = default.mk +!endif + +debug.mak retail.mak: + @if not exist $(@B)\nul md $(@B) + @cd $(@B) + @nmake -nologo -f ..\$(MAKENAME) DEBUG="$(@B)" + @cd .. + @echo *** Done making $(@B) *** + +clean: debug.cln retail.cln + +debug.cln retail.cln: + @if exist $(@B)\nul del $(@B) < ..\yes >nul + @if exist $(@B)\nul rd $(@B) >nul + @echo *** $(@B) is clean *** diff --git a/sdk/samples/d3dsdk.mk b/sdk/samples/d3dsdk.mk new file mode 100644 index 0000000..1c51e9b --- /dev/null +++ b/sdk/samples/d3dsdk.mk @@ -0,0 +1,115 @@ +############################################################################ +# +# Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. +# +# File: d3dsdk.mk +# Content: Rules for building the components of the SDK. +# For use with MSVC 2.0 or higher +# +############################################################################ + +!if "$(GSDKROOT)" == "" +GSDKROOT=..\..\.. +!endif + +############################################################################# +# +# Set up include & lib path +# +############################################################################# +INCLUDE=$(GSDKROOT)\inc;..\..\misc;$(INCLUDE) +LIB=$(GSDKROOT)\lib;$(LIB) + +############################################################################# +# +# new suffixes +# +############################################################################# +.SUFFIXES: +.SUFFIXES: .asm .c .cpp .exe .dll .h .inc .lib .sym .rc .res + +############################################################################# +# +# C compiler definitions +# +############################################################################# +CC =cl +CFLAGS = $(CFLAGS) -W3 -WX -c -Zp +CFLAGS =$(CFLAGS) -G5 -DIS_32 -DWIN32 +!ifndef LOGO +CFLAGS =$(CFLAGS) -nologo +!endif + +############################################################################# +# +# Linker definitions +# +############################################################################# +LINK =link -link +LFLAGS =$(LFLAGS) -nodefaultlib -align:0x1000 +!ifndef LOGO +LFLAGS =$(LFLAGS) -nologo +!endif + +############################################################################# +# +# resource compiler definitions +# +############################################################################# +RCFLAGS =$(RCFLAGS) -I.. +RCFLAGS =$(RCFLAGS) -DWIN32 -DIS_32 +RC = rc + +############################################################################# +# +# assembler definitions +# +############################################################################# +ASM = ml +AFLAGS =$(AFLAGS) -DIS_32 -DWIN32 +AFLAGS =$(AFLAGS) -W3 -WX -Zd -c -Cx -DMASM6 + +############################################################################# +# +# librarian definitions +# +############################################################################# +LIBEXE = lib + +############################################################################# +# +# targets +# +############################################################################# + +goal: $(GOALS) + +{..}.c{}.obj: + @$(CC) @<< +$(CFLAGS) -Fo$(@B).obj ..\$(@B).c +<< + +{..\..\misc}.c{}.obj: + @$(CC) @<< +$(CFLAGS) -Fo$(@B).obj ..\..\misc\$(@B).c +<< + +{..}.cpp{}.obj: + @$(CC) @<< +$(CFLAGS) -Fo$(@B).obj ..\$(@B).cpp +<< + +{..\..\misc}.cpp{}.obj: + @$(CC) @<< +$(CFLAGS) -Fo$(@B).obj ..\..\misc\$(@B).cpp +<< + +{..}.asm{}.obj: + $(ASM) $(AFLAGS) -Fo$(@B).obj ..\$(@B).asm + +{..}.rc{}.res: + $(RC) $(RCFLAGS) -r -Fo$(@B).res ..\$(@B).rc + +{..\..\misc}.rc{}.res: + $(RC) $(RCFLAGS) -r -Fo$(@B).res ..\..\misc\$(@B).rc + diff --git a/sdk/samples/ddex1/ddex1.cpp b/sdk/samples/ddex1/ddex1.cpp new file mode 100644 index 0000000..34e7f89 --- /dev/null +++ b/sdk/samples/ddex1/ddex1.cpp @@ -0,0 +1,295 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: ddex1.cpp + * Content: Direct Draw example program 1. Creates a Direct Draw + * object and then a primary surface with a back buffer. + * Slowly flips between the primary surface and the back + * buffer. Press F12 to terminate the program. + * + ***************************************************************************/ + +#define NAME "DDExample1" +#define TITLE "Direct Draw Example 1" + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <ddraw.h> +#include <stdlib.h> +#include <stdarg.h> +#include "resource.h" + +#define TIMER_ID 1 +#define TIMER_RATE 500 + +LPDIRECTDRAW lpDD; // DirectDraw object +LPDIRECTDRAWSURFACE lpDDSPrimary; // DirectDraw primary surface +LPDIRECTDRAWSURFACE lpDDSBack; // DirectDraw back surface +BOOL bActive; // is application active? + +/* + * finiObjects + * + * finished with all objects we use; release them + */ +static void finiObjects( void ) +{ + if( lpDD != NULL ) + { + if( lpDDSPrimary != NULL ) + { + lpDDSPrimary->Release(); + lpDDSPrimary = NULL; + } + lpDD->Release(); + lpDD = NULL; + } +} /* finiObjects */ + +char szMsg[] = "Page Flipping Test: Press F12 to exit"; +char szFrontMsg[] = "Front buffer (F12 to quit)"; +char szBackMsg[] = "Back buffer (F12 to quit)"; + +long FAR PASCAL WindowProc( HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam ) +{ + PAINTSTRUCT ps; + RECT rc; + SIZE size; + static BYTE phase = 0; + HDC hdc; + + switch( message ) + { + case WM_ACTIVATEAPP: + bActive = wParam; + break; + + case WM_CREATE: + break; + + case WM_SETCURSOR: + SetCursor(NULL); + return TRUE; + + case WM_TIMER: + // Flip surfaces + if( bActive ) + { + if (lpDDSBack->GetDC(&hdc) == DD_OK) + { + SetBkColor( hdc, RGB( 0, 0, 255 ) ); + SetTextColor( hdc, RGB( 255, 255, 0 ) ); + if( phase ) + { + TextOut( hdc, 0, 0, szFrontMsg, lstrlen(szBackMsg) ); + phase = 0; + } + else + { + TextOut( hdc, 0, 0, szBackMsg, lstrlen(szBackMsg) ); + phase = 1; + } + lpDDSBack->ReleaseDC(hdc); + } + + while( 1 ) + { + HRESULT ddrval; + ddrval = lpDDSPrimary->Flip( NULL, 0 ); + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + ddrval = lpDDSPrimary->Restore(); + if( ddrval != DD_OK ) + { + break; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + break; + } + } + } + break; + + case WM_KEYDOWN: + switch( wParam ) + { + case VK_ESCAPE: + case VK_F12: + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; + } + break; + + case WM_PAINT: + BeginPaint( hWnd, &ps ); + GetClientRect(hWnd, &rc); + GetTextExtentPoint( ps.hdc, szMsg, lstrlen(szMsg), &size ); + SetBkColor( ps.hdc, RGB( 0, 0, 255 ) ); + SetTextColor( ps.hdc, RGB( 255, 255, 0 ) ); + TextOut( ps.hdc, (rc.right - size.cx)/2, (rc.bottom - size.cy)/2, + szMsg, sizeof( szMsg )-1 ); + EndPaint( hWnd, &ps ); + break; + + case WM_DESTROY: + finiObjects(); + PostQuitMessage( 0 ); + break; + } + + return DefWindowProc(hWnd, message, wParam, lParam); + +} /* WindowProc */ + +/* + * doInit - do work required for every instance of the application: + * create the window, initialize data + */ +static BOOL doInit( HINSTANCE hInstance, int nCmdShow ) +{ + HWND hwnd; + WNDCLASS wc; + DDSURFACEDESC ddsd; + DDSCAPS ddscaps; + HRESULT ddrval; + HDC hdc; + char buf[256]; + + /* + * 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, IDI_APPLICATION ); + wc.hCursor = LoadCursor( NULL, IDC_ARROW ); + wc.hbrBackground = NULL; + 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 ); + + /* + * create the main DirectDraw object + */ + ddrval = DirectDrawCreate( NULL, &lpDD, NULL ); + if( ddrval == DD_OK ) + { + // Get exclusive mode + ddrval = lpDD->SetCooperativeLevel( hwnd, + DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); + if(ddrval == DD_OK ) + { + ddrval = lpDD->SetDisplayMode( 640, 480, 8 ); + if( ddrval == DD_OK ) + { + // Create the primary surface with 1 back buffer + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | + DDSCAPS_COMPLEX; + ddsd.dwBackBufferCount = 1; + ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL ); + if( ddrval == DD_OK ) + { + // Get a pointer to the back buffer + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + ddrval = lpDDSPrimary->GetAttachedSurface(&ddscaps, + &lpDDSBack); + if( ddrval == DD_OK ) + { + // draw some text. + if (lpDDSPrimary->GetDC(&hdc) == DD_OK) + { + SetBkColor( hdc, RGB( 0, 0, 255 ) ); + SetTextColor( hdc, RGB( 255, 255, 0 ) ); + TextOut( hdc, 0, 0, szFrontMsg, lstrlen(szFrontMsg) ); + lpDDSPrimary->ReleaseDC(hdc); + } + + if (lpDDSBack->GetDC(&hdc) == DD_OK) + { + SetBkColor( hdc, RGB( 0, 0, 255 ) ); + SetTextColor( hdc, RGB( 255, 255, 0 ) ); + TextOut( hdc, 0, 0, szBackMsg, lstrlen(szBackMsg) ); + lpDDSBack->ReleaseDC(hdc); + } + + // Create a timer to flip the pages + if( SetTimer( hwnd, TIMER_ID, TIMER_RATE, NULL ) ) + { + return TRUE; + } + } + } + } + } + } + + wsprintf(buf, "Direct Draw Init Failed (%08lx)\n", ddrval ); + MessageBox( hwnd, buf, "ERROR", MB_OK ); + finiObjects(); + DestroyWindow( hwnd ); + return FALSE; +} /* doInit */ + +/* + * WinMain - initialization, message loop + */ +int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + + lpCmdLine = lpCmdLine; + hPrevInstance = hPrevInstance; + + if( !doInit( hInstance, nCmdShow ) ) + { + return FALSE; + } + + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return msg.wParam; + +} /* WinMain */ diff --git a/sdk/samples/ddex1/ddex1.def b/sdk/samples/ddex1/ddex1.def new file mode 100644 index 0000000..b819846 --- /dev/null +++ b/sdk/samples/ddex1/ddex1.def @@ -0,0 +1,10 @@ +NAME ddex1.exe + +DESCRIPTION 'Direct Draw Example Program 1 (C) Microsoft 1995' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/ddex1/ddex1.rc b/sdk/samples/ddex1/ddex1.rc new file mode 100644 index 0000000..966cd77 --- /dev/null +++ b/sdk/samples/ddex1/ddex1.rc @@ -0,0 +1,9 @@ +#include "resource.h" + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END +END diff --git a/sdk/samples/ddex1/makefile b/sdk/samples/ddex1/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/ddex1/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/ddex1/makefile.wat b/sdk/samples/ddex1/makefile.wat new file mode 100644 index 0000000..b705d4b --- /dev/null +++ b/sdk/samples/ddex1/makefile.wat @@ -0,0 +1,2 @@ +MAKENAME=watcom.mk +!include ..\watbld.mk diff --git a/sdk/samples/ddex1/msvc.mk b/sdk/samples/ddex1/msvc.mk new file mode 100644 index 0000000..f9f27cc --- /dev/null +++ b/sdk/samples/ddex1/msvc.mk @@ -0,0 +1,42 @@ +NAME = ddex1 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = ddex1.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/ddex1/readme.txt b/sdk/samples/ddex1/readme.txt new file mode 100644 index 0000000..489d241 --- /dev/null +++ b/sdk/samples/ddex1/readme.txt @@ -0,0 +1,4 @@ +DirectDraw example program 1. + +Creates a DirectDraw object and then a primary surface with a back buffer. +Slowly flips between the primary surface and the back buffer. diff --git a/sdk/samples/ddex1/resource.h b/sdk/samples/ddex1/resource.h new file mode 100644 index 0000000..4351064 --- /dev/null +++ b/sdk/samples/ddex1/resource.h @@ -0,0 +1,2 @@ +#define IDR_MENU 102 +#define IDM_EXIT 40001 diff --git a/sdk/samples/ddex1/watcom.mk b/sdk/samples/ddex1/watcom.mk new file mode 100644 index 0000000..9913857 --- /dev/null +++ b/sdk/samples/ddex1/watcom.mk @@ -0,0 +1,33 @@ +NAME = ddex1 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =..\..\..\lib\ddraw.lib + +OBJS = ddex1.obj + +SYS = nt_win + +!ifdef DEBUG +COPT =-DDEBUG -d2 +LOPT = debug all +ROPT =-DDEBUG +!else +COPT =-oaxt -d1 +LOPT = +ROPT = +!endif + +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +!include ..\..\watsdk.mk + +$(NAME).$(EXT): $(OBJS) $(NAME).lnk $(RES) + $(LINK) $(LFLAGS) @$(NAME).lnk + $(RC) $(RES) diff --git a/sdk/samples/ddex2/back.bmp b/sdk/samples/ddex2/back.bmp new file mode 100644 index 0000000..9a099c1 Binary files /dev/null and b/sdk/samples/ddex2/back.bmp differ diff --git a/sdk/samples/ddex2/ddex2.cpp b/sdk/samples/ddex2/ddex2.cpp new file mode 100644 index 0000000..3f21f7c --- /dev/null +++ b/sdk/samples/ddex2/ddex2.cpp @@ -0,0 +1,296 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: ddex2.cpp + * Content: Direct Draw example program 2. Adds functionality to + * example program 1. Changes the video mode to 640x480x8. + * Reads a bitmap file from disk and copies it into the + * back buffer and then slowly flips between the primary + * surface and the back buffer. Press F12 to exit the program. + * + ***************************************************************************/ + +#define NAME "DDExample2" +#define TITLE "Direct Draw Example 2" + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <ddraw.h> +#include <stdlib.h> +#include <stdarg.h> +#include "resource.h" +#include "ddutil.h" + +#define TIMER_ID 1 +#define TIMER_RATE 250 + +LPDIRECTDRAW lpDD; // DirectDraw object +LPDIRECTDRAWSURFACE lpDDSPrimary; // DirectDraw primary surface +LPDIRECTDRAWSURFACE lpDDSBack; // DirectDraw back surface +LPDIRECTDRAWPALETTE lpDDPal; // DirectDraw palette +BOOL bActive; // is application active? + +char szBackground[] = "BACK"; + +/* + * finiObjects + * + * finished with all objects we use; release them + */ +static void finiObjects( void ) +{ + if( lpDD != NULL ) + { + if( lpDDSPrimary != NULL ) + { + lpDDSPrimary->Release(); + lpDDSPrimary = NULL; + } + if( lpDDPal != NULL ) + { + lpDDPal->Release(); + lpDDPal = NULL; + } + lpDD->Release(); + lpDD = NULL; + } + +} /* finiObjects */ + +char szFrontMsg[] = "Front buffer (F12 to quit)"; +char szBackMsg[] = "Back buffer (F12 to quit)"; + +long FAR PASCAL WindowProc( HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam ) +{ + static BYTE phase = 0; + HDC hdc; + + switch( message ) + { + case WM_ACTIVATEAPP: + bActive = wParam; + break; + + case WM_CREATE: + break; + + case WM_TIMER: + // Flip surfaces + if( bActive ) + { + if (lpDDSBack->GetDC(&hdc) == DD_OK) + { + SetBkColor( hdc, RGB( 0, 0, 255 ) ); + SetTextColor( hdc, RGB( 255, 255, 0 ) ); + if( phase ) + { + TextOut( hdc, 0, 0, szFrontMsg, lstrlen(szBackMsg) ); + phase = 0; + } + else + { + TextOut( hdc, 0, 0, szBackMsg, lstrlen(szBackMsg) ); + phase = 1; + } + lpDDSBack->ReleaseDC(hdc); + } + while( 1 ) + { + HRESULT ddrval; + ddrval = lpDDSPrimary->Flip( NULL, 0 ); + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + ddrval = lpDDSPrimary->Restore(); + + if( ddrval != DD_OK ) + { + break; + } + + ddrval = DDReLoadBitmap(lpDDSBack, szBackground); + + if( ddrval != DD_OK ) + { + break; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + break; + } + } + } + break; + + case WM_SETCURSOR: + SetCursor(NULL); + return TRUE; + + case WM_KEYDOWN: + switch( wParam ) + { + case VK_ESCAPE: + case VK_F12: + DestroyWindow( hWnd ); + return 0; + } + break; + + case WM_DESTROY: + finiObjects(); + PostQuitMessage( 0 ); + break; + } + + return DefWindowProc(hWnd, message, wParam, lParam); + +} /* WindowProc */ + +/* + * doInit - do work required for every instance of the application: + * create the window, initialize data + */ +static BOOL doInit( HINSTANCE hInstance, int nCmdShow ) +{ + HWND hwnd; + WNDCLASS wc; + DDSURFACEDESC ddsd; + DDSCAPS ddscaps; + HRESULT ddrval; + + /* + * 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, IDI_APPLICATION ); + wc.hCursor = LoadCursor( NULL, IDC_ARROW ); + wc.hbrBackground = NULL; + 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 ); + + /* + * create the main DirectDraw object + */ + ddrval = DirectDrawCreate( NULL, &lpDD, NULL ); + if( ddrval != DD_OK ) + goto error; + + // Get exclusive mode + ddrval = lpDD->SetCooperativeLevel( hwnd, + DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); + if(ddrval != DD_OK ) + goto error; + + // Set the video mode to 640x480x8 + ddrval = lpDD->SetDisplayMode( 640, 480, 8); + if(ddrval != DD_OK) + goto error; + + // Create the primary surface with 1 back buffer + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | + DDSCAPS_COMPLEX; + ddsd.dwBackBufferCount = 1; + ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL ); + if( ddrval != DD_OK ) + goto error; + + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + ddrval = lpDDSPrimary->GetAttachedSurface(&ddscaps, &lpDDSBack); + + if( ddrval != DD_OK ) + goto error; + + lpDDPal = DDLoadPalette(lpDD, szBackground); + + if (lpDDPal == NULL) + goto error; + + ddrval = lpDDSPrimary->SetPalette(lpDDPal); + + if( ddrval != DD_OK ) + goto error; + + // load a bitmap into the back buffer. + ddrval = DDReLoadBitmap(lpDDSBack, szBackground); + + if( ddrval != DD_OK ) + goto error; + + // Create a timer to flip the pages + if( !SetTimer( hwnd, TIMER_ID, TIMER_RATE, NULL ) ) + goto error; + + return TRUE; + +error: + finiObjects(); + MessageBox( hwnd, "DirectDraw Init FAILED", TITLE, MB_OK ); + DestroyWindow( hwnd ); + return FALSE; +} /* doInit */ + +/* + * WinMain - initialization, message loop + */ +int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + + lpCmdLine = lpCmdLine; + hPrevInstance = hPrevInstance; + + if( !doInit( hInstance, nCmdShow ) ) + { + return FALSE; + } + + while(GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return msg.wParam; + +} /* WinMain */ diff --git a/sdk/samples/ddex2/ddex2.def b/sdk/samples/ddex2/ddex2.def new file mode 100644 index 0000000..5522757 --- /dev/null +++ b/sdk/samples/ddex2/ddex2.def @@ -0,0 +1,10 @@ +NAME ddex2.exe + +DESCRIPTION 'Direct Draw Example Program 2 (C) Microsoft 1995' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/ddex2/ddex2.rc b/sdk/samples/ddex2/ddex2.rc new file mode 100644 index 0000000..0987788 --- /dev/null +++ b/sdk/samples/ddex2/ddex2.rc @@ -0,0 +1,11 @@ +#include "resource.h" + +BACK BITMAP BACK.BMP + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END +END diff --git a/sdk/samples/ddex2/makefile b/sdk/samples/ddex2/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/ddex2/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/ddex2/makefile.wat b/sdk/samples/ddex2/makefile.wat new file mode 100644 index 0000000..b705d4b --- /dev/null +++ b/sdk/samples/ddex2/makefile.wat @@ -0,0 +1,2 @@ +MAKENAME=watcom.mk +!include ..\watbld.mk diff --git a/sdk/samples/ddex2/msvc.mk b/sdk/samples/ddex2/msvc.mk new file mode 100644 index 0000000..f1563a5 --- /dev/null +++ b/sdk/samples/ddex2/msvc.mk @@ -0,0 +1,42 @@ +NAME = ddex2 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = ddex2.obj ddutil.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/ddex2/readme.txt b/sdk/samples/ddex2/readme.txt new file mode 100644 index 0000000..b667709 --- /dev/null +++ b/sdk/samples/ddex2/readme.txt @@ -0,0 +1,6 @@ +DirectDraw example program 2. + +Adds functionality to example program 1. +Changes the video mode to 640x480x8. Reads a bitmap file from disk and +copies it into the back buffer and then slowly flips between the primary +surface and the back buffer. diff --git a/sdk/samples/ddex2/resource.h b/sdk/samples/ddex2/resource.h new file mode 100644 index 0000000..4351064 --- /dev/null +++ b/sdk/samples/ddex2/resource.h @@ -0,0 +1,2 @@ +#define IDR_MENU 102 +#define IDM_EXIT 40001 diff --git a/sdk/samples/ddex2/watcom.mk b/sdk/samples/ddex2/watcom.mk new file mode 100644 index 0000000..7b0aa0a --- /dev/null +++ b/sdk/samples/ddex2/watcom.mk @@ -0,0 +1,33 @@ +NAME = ddex2 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =..\..\..\lib\ddraw.lib + +OBJS = ddex2.obj ddutil.obj + +SYS = nt_win + +!ifdef DEBUG +COPT =-DDEBUG -d2 +LOPT = debug all +ROPT =-DDEBUG +!else +COPT =-oaxt -d1 +LOPT = +ROPT = +!endif + +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +!include ..\..\watsdk.mk + +$(NAME).$(EXT): $(OBJS) $(NAME).lnk $(RES) + $(LINK) $(LFLAGS) @$(NAME).lnk + $(RC) $(RES) diff --git a/sdk/samples/ddex3/ddex3.cpp b/sdk/samples/ddex3/ddex3.cpp new file mode 100644 index 0000000..8938bb6 --- /dev/null +++ b/sdk/samples/ddex3/ddex3.cpp @@ -0,0 +1,403 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: ddex3.cpp + * Content: Direct Draw example program 3. Adds functionality to + * example program 2. Creates two offscreen surfaces in + * addition to the primary surface and back buffer. Loads + * a bitmap file into each offscreen surface. Uses BltFast + * to copy the contents of an offscreen surface to the back + * buffer and then flips the buffers and copies the next + * offscreen surface to the back buffer. Press F12 to exit + * the program. This program requires at least 1.2 Megs of + * video ram. + * + ***************************************************************************/ + +#define NAME "DDExample3" +#define TITLE "Direct Draw Example 3" + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <ddraw.h> +#include <stdlib.h> +#include <stdarg.h> +#include "resource.h" +#include "ddutil.h" // DDLoadPalette, DDCopyBitmap + +// Name of our bitmap resource. +char szBitmap[] = "DDEX3"; + +BOOL InitSurfaces( void ); + +#define TIMER_ID 1 +#define TIMER_RATE 500 + +LPDIRECTDRAW lpDD; // DirectDraw object +LPDIRECTDRAWSURFACE lpDDSPrimary; // DirectDraw primary surface +LPDIRECTDRAWSURFACE lpDDSBack; // DirectDraw back surface +LPDIRECTDRAWSURFACE lpDDSOne; // Offscreen surface 1 +LPDIRECTDRAWSURFACE lpDDSTwo; // Offscreen surface 2 +LPDIRECTDRAWPALETTE lpDDPal; // DirectDraw palette +BOOL bActive; // is application active? + +/* + * finiObjects + * + * finished with all objects we use; release them + */ +static void finiObjects( void ) +{ + if( lpDD != NULL ) + { + if( lpDDSPrimary != NULL ) + { + lpDDSPrimary->Release(); + lpDDSPrimary = NULL; + } + if( lpDDSOne != NULL ) + { + lpDDSOne->Release(); + lpDDSOne = NULL; + } + if( lpDDSTwo != NULL ) + { + lpDDSTwo->Release(); + lpDDSTwo = NULL; + } + if( lpDDPal != NULL ) + { + lpDDPal->Release(); + lpDDPal = NULL; + } + lpDD->Release(); + lpDD = NULL; + } +} /* finiObjects */ + +/* + * restoreAll + * + * restore all lost objects + */ +HRESULT restoreAll( void ) +{ + HRESULT ddrval; + + ddrval = lpDDSPrimary->Restore(); + if( ddrval == DD_OK ) + { + ddrval = lpDDSOne->Restore(); + if( ddrval == DD_OK ) + { + ddrval = lpDDSTwo->Restore(); + if( ddrval == DD_OK ) + { + InitSurfaces(); + } + } + } + return ddrval; + +} /* restoreAll */ + +long FAR PASCAL WindowProc( HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam ) +{ + static int phase = 0; + RECT rcRect; + + switch( message ) + { + case WM_ACTIVATEAPP: + bActive = wParam; + break; + + case WM_CREATE: + break; + + case WM_SETCURSOR: + SetCursor(NULL); + return TRUE; + + case WM_TIMER: + if( bActive ) + { + HRESULT ddrval; + LPDIRECTDRAWSURFACE pdds; + + rcRect.left = 0; + rcRect.top = 0; + rcRect.right = 640; + rcRect.bottom = 480; + if(phase) + { + pdds = lpDDSTwo; + phase = 0; + } + else + { + pdds = lpDDSOne; + phase = 1; + } + while( 1 ) + { + ddrval = lpDDSBack->BltFast( 0, 0, pdds, &rcRect, FALSE ); + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + ddrval = restoreAll(); + if( ddrval != DD_OK ) + { + break; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + break; + } + } + + // Flip surfaces + while( 1 ) + { + ddrval = lpDDSPrimary->Flip( NULL, 0 ); + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + ddrval = restoreAll(); + if( ddrval != DD_OK ) + { + break; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + break; + } + } + } + break; + + case WM_KEYDOWN: + switch( wParam ) + { + case VK_ESCAPE: + case VK_F12: + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; + } + break; + + case WM_DESTROY: + finiObjects(); + PostQuitMessage( 0 ); + break; + } + + return DefWindowProc(hWnd, message, wParam, lParam); + +} /* WindowProc */ + +/* + * This function is called if the initialization function fails + */ +BOOL initFail( HWND hwnd ) +{ + finiObjects(); + MessageBox( hwnd, "DirectDraw Init FAILED", TITLE, MB_OK ); + DestroyWindow( hwnd ); + return FALSE; + +} /* initFail */ + +/* + * doInit - do work required for every instance of the application: + * create the window, initialize data + */ +static BOOL doInit( HINSTANCE hInstance, int nCmdShow ) +{ + HWND hwnd; + WNDCLASS wc; + DDSURFACEDESC ddsd; + DDSCAPS ddscaps; + HRESULT ddrval; + + /* + * 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, IDI_APPLICATION ); + 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( + 0, + 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 ); + + /* + * create the main DirectDraw object + */ + ddrval = DirectDrawCreate( NULL, &lpDD, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Get exclusive mode + ddrval = lpDD->SetCooperativeLevel( hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Set the video mode to 640x480x8 + ddrval = lpDD->SetDisplayMode( 640, 480, 8); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Create the primary surface with 1 back buffer + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | + DDSCAPS_COMPLEX; + ddsd.dwBackBufferCount = 1; + ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + ddrval = lpDDSPrimary->GetAttachedSurface(&ddscaps, &lpDDSBack); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Create a offscreen bitmap. + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.dwHeight = 480; + ddsd.dwWidth = 640; + ddrval = lpDD->CreateSurface( &ddsd, &lpDDSOne, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Create another offscreen bitmap. + ddrval = lpDD->CreateSurface( &ddsd, &lpDDSTwo, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Create a Direct Draw Palette and associate it with the front buffer + lpDDPal = DDLoadPalette(lpDD, szBitmap); + + if (lpDDPal) + lpDDSPrimary->SetPalette( lpDDPal ); + + if( !InitSurfaces() ) + { + return initFail(hwnd); + } + + // Create a timer to flip the pages + if( !SetTimer( hwnd, TIMER_ID, TIMER_RATE, NULL ) ) + { + return initFail(hwnd); + } + + return TRUE; + +} /* doInit */ + +/* + * WinMain - initialization, message loop + */ +int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + + lpCmdLine = lpCmdLine; + hPrevInstance = hPrevInstance; + + if( !doInit( hInstance, nCmdShow ) ) + { + return FALSE; + } + + while( GetMessage( &msg, NULL, 0, 0 ) ) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return msg.wParam; + +} /* WinMain */ + +/* + * InitSurfaces - This function reads the bitmap file FRNTBACK.BMP + * and stores half of it in offscreen surface 1 and the other half in + * offscreen surface 2. + */ +BOOL InitSurfaces( void ) +{ + HBITMAP hbm; + + // Load our bitmap resource. + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); + + if (hbm == NULL) + return FALSE; + + DDCopyBitmap(lpDDSOne, hbm, 0, 0, 640, 480); + DDCopyBitmap(lpDDSTwo, hbm, 0, 480, 640, 480); + DeleteObject(hbm); + + return TRUE; + +} /* readBMPIntoSurfaces */ diff --git a/sdk/samples/ddex3/ddex3.def b/sdk/samples/ddex3/ddex3.def new file mode 100644 index 0000000..fa3f55c --- /dev/null +++ b/sdk/samples/ddex3/ddex3.def @@ -0,0 +1,10 @@ +NAME ddex3.exe + +DESCRIPTION 'Direct Draw Example Program 3 (C) Microsoft 1995' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/ddex3/ddex3.rc b/sdk/samples/ddex3/ddex3.rc new file mode 100644 index 0000000..53affe3 --- /dev/null +++ b/sdk/samples/ddex3/ddex3.rc @@ -0,0 +1,11 @@ +#include "resource.h" + +DDEX3 BITMAP FRNTBACK.BMP + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END +END diff --git a/sdk/samples/ddex3/frntback.bmp b/sdk/samples/ddex3/frntback.bmp new file mode 100644 index 0000000..d7d1347 Binary files /dev/null and b/sdk/samples/ddex3/frntback.bmp differ diff --git a/sdk/samples/ddex3/makefile b/sdk/samples/ddex3/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/ddex3/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/ddex3/makefile.wat b/sdk/samples/ddex3/makefile.wat new file mode 100644 index 0000000..b705d4b --- /dev/null +++ b/sdk/samples/ddex3/makefile.wat @@ -0,0 +1,2 @@ +MAKENAME=watcom.mk +!include ..\watbld.mk diff --git a/sdk/samples/ddex3/msvc.mk b/sdk/samples/ddex3/msvc.mk new file mode 100644 index 0000000..fcb8489 --- /dev/null +++ b/sdk/samples/ddex3/msvc.mk @@ -0,0 +1,42 @@ +NAME = ddex3 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = ddex3.obj ddutil.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/ddex3/readme.txt b/sdk/samples/ddex3/readme.txt new file mode 100644 index 0000000..ebb7814 --- /dev/null +++ b/sdk/samples/ddex3/readme.txt @@ -0,0 +1,9 @@ +DirectDraw example program 3. + +Adds functionality to example program 2. Creates two offscreen surfaces in +addition to the primary surface and back buffer. Loads a bitmap file into +each offscreen surface. Uses BltFast to copy the contents of an offscreen +surface to the back buffer and then flips the buffers and copies the next +offscreen surface to the back buffer. + +This program requires at least 1.2 Megs of video ram. diff --git a/sdk/samples/ddex3/resource.h b/sdk/samples/ddex3/resource.h new file mode 100644 index 0000000..4351064 --- /dev/null +++ b/sdk/samples/ddex3/resource.h @@ -0,0 +1,2 @@ +#define IDR_MENU 102 +#define IDM_EXIT 40001 diff --git a/sdk/samples/ddex3/watcom.mk b/sdk/samples/ddex3/watcom.mk new file mode 100644 index 0000000..72f10f1 --- /dev/null +++ b/sdk/samples/ddex3/watcom.mk @@ -0,0 +1,33 @@ +NAME = ddex3 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =..\..\..\lib\ddraw.lib + +OBJS = ddex3.obj ddutil.obj + +SYS = nt_win + +!ifdef DEBUG +COPT =-DDEBUG -d2 +LOPT = debug all +ROPT =-DDEBUG +!else +COPT =-oaxt -d1 +LOPT = +ROPT = +!endif + +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +!include ..\..\watsdk.mk + +$(NAME).$(EXT): $(OBJS) $(NAME).lnk $(RES) + $(LINK) $(LFLAGS) @$(NAME).lnk + $(RC) $(RES) diff --git a/sdk/samples/ddex4/all.bmp b/sdk/samples/ddex4/all.bmp new file mode 100644 index 0000000..7dc2ede Binary files /dev/null and b/sdk/samples/ddex4/all.bmp differ diff --git a/sdk/samples/ddex4/ddex4.cpp b/sdk/samples/ddex4/ddex4.cpp new file mode 100644 index 0000000..63f12b9 --- /dev/null +++ b/sdk/samples/ddex4/ddex4.cpp @@ -0,0 +1,405 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: ddex4.cpp + * Content: Direct Draw example program 4. Adds functionality to + * example program 3. Creates a flipping surface and loads + * a bitmap image into an offscreen surface. Uses BltFast to + * copy portions of the offscreen surface to the back buffer + * to generate an animation. Illustrates watching return + * code from BltFast to prevent image tearing. This program + * requires 1.2 Meg of video ram. + * + ***************************************************************************/ + +#define NAME "DDExample4" +#define TITLE "Direct Draw Example 4" + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <ddraw.h> +#include "resource.h" +#include "ddutil.h" + +char szBitmap[] = "ALL"; + +LPDIRECTDRAW lpDD; // DirectDraw object +LPDIRECTDRAWSURFACE lpDDSPrimary; // DirectDraw primary surface +LPDIRECTDRAWSURFACE lpDDSBack; // DirectDraw back surface +LPDIRECTDRAWSURFACE lpDDSOne; // Offscreen surface 1 +LPDIRECTDRAWPALETTE lpDDPal; // DirectDraw palette +BOOL bActive; // is application active? + +/* + * restoreAll + * + * restore all lost objects + */ +HRESULT restoreAll( void ) +{ + HRESULT ddrval; + + ddrval = lpDDSPrimary->Restore(); + if( ddrval == DD_OK ) + { + ddrval = lpDDSOne->Restore(); + if( ddrval == DD_OK ) + { + DDReLoadBitmap(lpDDSOne, szBitmap); + } + } + return ddrval; + +} /* restoreAll */ + +/* + * updateFrame + * + * Decide what needs to be blitted next, wait for flip to complete, + * then flip the buffers. + */ +void updateFrame( void ) +{ + static DWORD lastTickCount[3] = {0,0,0}; + static int currentFrame[3] = {0,0,0}; + DWORD thisTickCount; + RECT rcRect; + DWORD delay[3] = {50, 78, 13}; + int i; + int xpos[3] = {288, 190, 416}; + int ypos[3] = {128, 300, 256}; + HRESULT ddrval; + + // Decide which frame will be blitted next + thisTickCount = GetTickCount(); + for(i=0; i<3; i++) + { + if((thisTickCount - lastTickCount[i]) > delay[i]) + { + // Move to next frame; + lastTickCount[i] = thisTickCount; + currentFrame[i]++; + if(currentFrame[i] > 59) + { + currentFrame[i] = 0; + } + } + } + + // Blit the stuff for the next frame + rcRect.left = 0; + rcRect.top = 0; + rcRect.right = 640; + rcRect.bottom = 480; + while( 1 ) + { + ddrval = lpDDSBack->BltFast( 0, 0, lpDDSOne, + &rcRect, DDBLTFAST_NOCOLORKEY ); + + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + ddrval = restoreAll(); + if( ddrval != DD_OK ) + { + return; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + return; + } + } + if(ddrval != DD_OK) + { + return; + } + + for( i=0; i<3; i++ ) + { + rcRect.left = currentFrame[i]%10*64; + rcRect.top = currentFrame[i]/10*64 + 480; + rcRect.right = currentFrame[i]%10*64 + 64; + rcRect.bottom = currentFrame[i]/10*64 + 64 + 480; + + while( 1 ) + { + ddrval = lpDDSBack->BltFast( xpos[i], ypos[i], lpDDSOne, + &rcRect, DDBLTFAST_SRCCOLORKEY ); + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + ddrval = restoreAll(); + if( ddrval != DD_OK ) + { + return; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + return; + } + } + } + + // Flip the surfaces + while( 1 ) + { + ddrval = lpDDSPrimary->Flip( NULL, 0 ); + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + ddrval = restoreAll(); + if( ddrval != DD_OK ) + { + break; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + break; + } + } + +} /* updateFrame */ + + +/* + * finiObjects + * + * finished with all objects we use; release them + */ +static void finiObjects( void ) +{ + if( lpDD != NULL ) + { + if( lpDDSPrimary != NULL ) + { + lpDDSPrimary->Release(); + lpDDSPrimary = NULL; + } + if( lpDDSOne != NULL ) + { + lpDDSOne->Release(); + lpDDSOne = NULL; + } + if( lpDDPal != NULL ) + { + lpDDPal->Release(); + lpDDPal = NULL; + } + lpDD->Release(); + lpDD = NULL; + } +} /* finiObjects */ + +long FAR PASCAL WindowProc( HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam ) +{ + switch( message ) + { + case WM_ACTIVATEAPP: + bActive = wParam; + break; + + case WM_SETCURSOR: + SetCursor(NULL); + return TRUE; + + case WM_CREATE: + break; + + case WM_KEYDOWN: + switch( wParam ) + { + case VK_ESCAPE: + case VK_F12: + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; + } + break; + + case WM_DESTROY: + finiObjects(); + PostQuitMessage( 0 ); + break; + } + + return DefWindowProc(hWnd, message, wParam, lParam); + +} /* WindowProc */ + +/* + * This function is called if the initialization function fails + */ +BOOL initFail( HWND hwnd ) +{ + finiObjects(); + MessageBox( hwnd, "DirectDraw Init FAILED", TITLE, MB_OK ); + DestroyWindow( hwnd ); + return FALSE; + +} /* initFail */ + +/* + * doInit - do work required for every instance of the application: + * create the window, initialize data + */ +static BOOL doInit( HINSTANCE hInstance, int nCmdShow ) +{ + HWND hwnd; + WNDCLASS wc; + DDSURFACEDESC ddsd; + DDSCAPS ddscaps; + HRESULT ddrval; + + /* + * 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, IDI_APPLICATION ); + wc.hCursor = LoadCursor( NULL, IDC_ARROW ); + wc.hbrBackground = GetStockBrush(BLACK_BRUSH); + wc.lpszMenuName = NAME; + wc.lpszClassName = NAME; + RegisterClass( &wc ); + + /* + * create a window + */ + hwnd = CreateWindowEx( + 0, + 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 ); + + /* + * create the main DirectDraw object + */ + ddrval = DirectDrawCreate( NULL, &lpDD, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Get exclusive mode + ddrval = lpDD->SetCooperativeLevel( hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Set the video mode to 640x480x8 + ddrval = lpDD->SetDisplayMode( 640, 480, 8); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Create the primary surface with 1 back buffer + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | + DDSCAPS_COMPLEX; + ddsd.dwBackBufferCount = 1; + ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + ddrval = lpDDSPrimary->GetAttachedSurface(&ddscaps, &lpDDSBack); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // create and set the palette + lpDDPal = DDLoadPalette(lpDD, szBitmap); + + if (lpDDPal) + lpDDSPrimary->SetPalette(lpDDPal); + + // Create the offscreen surface, by loading our bitmap. + lpDDSOne = DDLoadBitmap(lpDD, szBitmap, 0, 0); + + if( lpDDSOne == NULL ) + { + return initFail(hwnd); + } + + // Set the color key for this bitmap (black) + DDSetColorKey(lpDDSOne, RGB(0,0,0)); + + return TRUE; +} /* doInit */ + +/* + * WinMain - initialization, message loop + */ +int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + + lpCmdLine = lpCmdLine; + hPrevInstance = hPrevInstance; + + if( !doInit( hInstance, nCmdShow ) ) + { + return FALSE; + } + + while( 1 ) + { + if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + { + if( !GetMessage( &msg, NULL, 0, 0 ) ) + return msg.wParam; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else if( bActive ) + { + updateFrame(); + } + else + { + // make sure we go to sleep if we have nothing else to do + WaitMessage(); + } + } +} /* WinMain */ diff --git a/sdk/samples/ddex4/ddex4.def b/sdk/samples/ddex4/ddex4.def new file mode 100644 index 0000000..866b502 --- /dev/null +++ b/sdk/samples/ddex4/ddex4.def @@ -0,0 +1,10 @@ +NAME ddex4.exe + +DESCRIPTION 'Direct Draw Example Program 4 (C) Microsoft 1995' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/ddex4/ddex4.rc b/sdk/samples/ddex4/ddex4.rc new file mode 100644 index 0000000..5d5030c --- /dev/null +++ b/sdk/samples/ddex4/ddex4.rc @@ -0,0 +1,11 @@ +#include "resource.h" + +ALL BITMAP ALL.BMP + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END +END diff --git a/sdk/samples/ddex4/makefile b/sdk/samples/ddex4/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/ddex4/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/ddex4/makefile.wat b/sdk/samples/ddex4/makefile.wat new file mode 100644 index 0000000..b705d4b --- /dev/null +++ b/sdk/samples/ddex4/makefile.wat @@ -0,0 +1,2 @@ +MAKENAME=watcom.mk +!include ..\watbld.mk diff --git a/sdk/samples/ddex4/msvc.mk b/sdk/samples/ddex4/msvc.mk new file mode 100644 index 0000000..7550fe4 --- /dev/null +++ b/sdk/samples/ddex4/msvc.mk @@ -0,0 +1,42 @@ +NAME = ddex4 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = ddex4.obj ddutil.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/ddex4/readme.txt b/sdk/samples/ddex4/readme.txt new file mode 100644 index 0000000..657d28c --- /dev/null +++ b/sdk/samples/ddex4/readme.txt @@ -0,0 +1,10 @@ +Direct Draw example program 4. + +Adds functionality to example program 3. Creates a flipping surface and +loads a bitmap image into an offscreen surface. Uses BltFast to copy +portions of the offscreen surface to the back buffer to generate an +animation. + +Illustrates watching the return code from BltFast to prevent tearing. + +This program requires 1.2 Meg of video ram. diff --git a/sdk/samples/ddex4/resource.h b/sdk/samples/ddex4/resource.h new file mode 100644 index 0000000..4351064 --- /dev/null +++ b/sdk/samples/ddex4/resource.h @@ -0,0 +1,2 @@ +#define IDR_MENU 102 +#define IDM_EXIT 40001 diff --git a/sdk/samples/ddex4/watcom.mk b/sdk/samples/ddex4/watcom.mk new file mode 100644 index 0000000..009f5bb --- /dev/null +++ b/sdk/samples/ddex4/watcom.mk @@ -0,0 +1,33 @@ +NAME = ddex4 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =..\..\..\lib\ddraw.lib + +OBJS = ddex4.obj ddutil.obj + +SYS = nt_win + +!ifdef DEBUG +COPT =-DDEBUG -d2 +LOPT = debug all +ROPT =-DDEBUG +!else +COPT =-oaxt -d1 +LOPT = +ROPT = +!endif + +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +!include ..\..\watsdk.mk + +$(NAME).$(EXT): $(OBJS) $(NAME).lnk $(RES) + $(LINK) $(LFLAGS) @$(NAME).lnk + $(RC) $(RES) diff --git a/sdk/samples/ddex5/all.bmp b/sdk/samples/ddex5/all.bmp new file mode 100644 index 0000000..2264bf4 Binary files /dev/null and b/sdk/samples/ddex5/all.bmp differ diff --git a/sdk/samples/ddex5/ddex5.cpp b/sdk/samples/ddex5/ddex5.cpp new file mode 100644 index 0000000..18ab53c --- /dev/null +++ b/sdk/samples/ddex5/ddex5.cpp @@ -0,0 +1,465 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: ddex5.cpp + * Content: Direct Draw example program 5. Adds functionality to + * example program 4. Uses GetEntries() to read a palette, + * modifies the entries, and then uses SetEntries() to update + * the palette. This program requires 1.2 Meg of video ram. + * + ***************************************************************************/ + +#define NAME "DDExample5" +#define TITLE "Direct Draw Example 5" + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <ddraw.h> +#include "resource.h" +#include "ddutil.h" + +char szBitmap[] = "ALL"; + +LPDIRECTDRAW lpDD; // DirectDraw object +LPDIRECTDRAWSURFACE lpDDSPrimary; // DirectDraw primary surface +LPDIRECTDRAWSURFACE lpDDSBack; // DirectDraw back surface +LPDIRECTDRAWSURFACE lpDDSOne; // Offscreen surface 1 +LPDIRECTDRAWPALETTE lpDDPal; // The primary surface palette +BOOL bActive; // is application active? + +BYTE torusColors[256]; // Marks the colors used in the torus + +/* + * restoreAll + * + * restore all lost objects + */ +HRESULT restoreAll( void ) +{ + HRESULT ddrval; + + ddrval = lpDDSPrimary->Restore(); + if( ddrval == DD_OK ) + { + ddrval = lpDDSOne->Restore(); + if( ddrval == DD_OK ) + { + DDReLoadBitmap(lpDDSOne, szBitmap); + } + } + return ddrval; + +} /* restoreAll */ + +/* + * updateFrame + * + * Decide what needs to be blitted next, wait for flip to complete, + * then flip the buffers. + */ +void updateFrame( void ) +{ + static DWORD lastTickCount[4] = {0,0,0,0}; + static int currentFrame[3] = {0,0,0}; + DWORD thisTickCount; + RECT rcRect; + DWORD delay[4] = {50, 78, 13, 93}; + int i; + int xpos[3] = {288, 190, 416}; + int ypos[3] = {128, 300, 256}; + PALETTEENTRY pe[256]; + HRESULT ddrval; + + // Decide which frame will be blitted next + thisTickCount = GetTickCount(); + for(i=0; i<3; i++) + { + if((thisTickCount - lastTickCount[i]) > delay[i]) + { + // Move to next frame; + lastTickCount[i] = thisTickCount; + currentFrame[i]++; + if(currentFrame[i] > 59) + currentFrame[i] = 0; + } + } + + // Blit the stuff for the next frame + rcRect.left = 0; + rcRect.top = 0; + rcRect.right = 640; + rcRect.bottom = 480; + while( 1 ) + { + ddrval = lpDDSBack->BltFast( 0, 0, lpDDSOne, + &rcRect, DDBLTFAST_NOCOLORKEY ); + + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + ddrval = restoreAll(); + if( ddrval != DD_OK ) + { + return; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + return; + } + } + if(ddrval != DD_OK) + { + return; + } + + for(i=0; i<3; i++) + { + rcRect.left = currentFrame[i]%10*64; + rcRect.top = currentFrame[i]/10*64 + 480; + rcRect.right = currentFrame[i]%10*64 + 64; + rcRect.bottom = currentFrame[i]/10*64 + 64 + 480; + + while( 1 ) + { + ddrval = lpDDSBack->BltFast( xpos[i], ypos[i], lpDDSOne, + &rcRect, DDBLTFAST_SRCCOLORKEY ); + + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + ddrval = restoreAll(); + if( ddrval != DD_OK ) + { + return; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + return; + } + } + } + + if( (thisTickCount - lastTickCount[3]) > delay[3] ) + { + // Change the palette + if(lpDDPal->GetEntries( 0, 0, 256, pe ) != DD_OK) + { + return; + } + + for(i=1; i<256; i++) + { + if(!torusColors[i]) + { + continue; + } + pe[i].peRed = (pe[i].peRed+2) % 256; + pe[i].peGreen = (pe[i].peGreen+1) % 256; + pe[i].peBlue = (pe[i].peBlue+3) % 256; + } + + if(lpDDPal->SetEntries( 0, 0, 256, pe) != DD_OK) + { + return; + } + + lastTickCount[3] = thisTickCount; + } + + // Flip the surfaces + while( 1 ) + { + ddrval = lpDDSPrimary->Flip( NULL, 0 ); + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + ddrval = restoreAll(); + if( ddrval != DD_OK ) + { + break; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + break; + } + } + +} /* updateFrame */ + +/* + * finiObjects + * + * finished with all objects we use; release them + */ +static void finiObjects( void ) +{ + if( lpDD != NULL ) + { + if( lpDDSPrimary != NULL ) + { + lpDDSPrimary->Release(); + lpDDSPrimary = NULL; + } + if( lpDDSOne != NULL ) + { + lpDDSOne->Release(); + lpDDSOne = NULL; + } + if( lpDDPal != NULL ) + { + lpDDPal->Release(); + lpDDPal = NULL; + } + lpDD->Release(); + lpDD = NULL; + } + +} /* finiObjects */ + +long FAR PASCAL WindowProc( HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam ) +{ + switch( message ) + { + case WM_ACTIVATEAPP: + bActive = wParam; + break; + + case WM_SETCURSOR: + SetCursor(NULL); + return TRUE; + + case WM_CREATE: + break; + + case WM_KEYDOWN: + switch( wParam ) + { + case VK_ESCAPE: + case VK_F12: + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; + } + break; + + case WM_DESTROY: + finiObjects(); + PostQuitMessage( 0 ); + break; + } + + return DefWindowProc(hWnd, message, wParam, lParam); + +} /* WindowProc */ + + + +/* + * This function is called if the initialization function fails + */ +BOOL initFail( HWND hwnd ) +{ + finiObjects(); + MessageBox( hwnd, "DirectDraw Init FAILED", TITLE, MB_OK ); + DestroyWindow( hwnd ); + return FALSE; + +} /* initFail */ + +/* + * doInit - do work required for every instance of the application: + * create the window, initialize data + */ +static BOOL doInit( HINSTANCE hInstance, int nCmdShow ) +{ + HWND hwnd; + WNDCLASS wc; + DDSURFACEDESC ddsd; + DDSCAPS ddscaps; + HRESULT ddrval; + + /* + * 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, IDI_APPLICATION ); + wc.hCursor = LoadCursor( NULL, IDC_ARROW ); + wc.hbrBackground = GetStockBrush(BLACK_BRUSH); + wc.lpszMenuName = NAME; + wc.lpszClassName = NAME; + RegisterClass( &wc ); + + /* + * create a window + */ + hwnd = CreateWindowEx( + 0, + 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 + */ + ddrval = DirectDrawCreate( NULL, &lpDD, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Get exclusive mode + ddrval = lpDD->SetCooperativeLevel( hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Set the video mode to 640x480x8 + ddrval = lpDD->SetDisplayMode( 640, 480, 8); + if(ddrval != DD_OK) + { + return initFail(hwnd); + } + + // Create the primary surface with 1 back buffer + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | + DDSCAPS_COMPLEX; + ddsd.dwBackBufferCount = 1; + ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + ddrval = lpDDSPrimary->GetAttachedSurface(&ddscaps, &lpDDSBack); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // create and set the palette + lpDDPal = DDLoadPalette(lpDD, szBitmap); + + if (lpDDPal) + lpDDSPrimary->SetPalette(lpDDPal); + + // Create the offscreen surface, by loading our bitmap. + lpDDSOne = DDLoadBitmap(lpDD, szBitmap, 0, 0); + + if( lpDDSOne == NULL ) + { + return initFail(hwnd); + } + + // set the color key to black + DDSetColorKey(lpDDSOne, RGB(0,0,0)); + + // + // Mark the colors used in the torus frames + // + int i,x,y; + + // First, set all colors as unused + for(i=0; i<256; i++) + { + torusColors[i] = 0; + } + + // lock the surface and scan the lower part (the torus area) + // and remember all the index's we find. + ddsd.dwSize = sizeof(ddsd); + while (lpDDSOne->Lock(NULL, &ddsd, 0, NULL) == DDERR_WASSTILLDRAWING) + ; + + // Now search through the torus frames and mark used colors + for( y=480; y<480+384; y++ ) + { + for( x=0; x<640; x++ ) + { + torusColors[((BYTE *)ddsd.lpSurface)[y*ddsd.lPitch+x]] = 1; + } + } + + lpDDSOne->Unlock(NULL); + + return TRUE; + +} /* doInit */ + +/* + * WinMain - initialization, message loop + */ +int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + + lpCmdLine = lpCmdLine; + hPrevInstance = hPrevInstance; + + if( !doInit( hInstance, nCmdShow ) ) + { + return FALSE; + } + + while( 1 ) + { + if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + { + if( !GetMessage( &msg, NULL, 0, 0 ) ) + { + return msg.wParam; + } + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else if( bActive ) + { + updateFrame(); + } + else + { + // make sure we go to sleep if we have nothing else to do + WaitMessage(); + } + } +} /* WinMain */ diff --git a/sdk/samples/ddex5/ddex5.def b/sdk/samples/ddex5/ddex5.def new file mode 100644 index 0000000..78f668f --- /dev/null +++ b/sdk/samples/ddex5/ddex5.def @@ -0,0 +1,10 @@ +NAME ddex5.exe + +DESCRIPTION 'Direct Draw Example Program 5 (C) Microsoft 1995' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/ddex5/ddex5.rc b/sdk/samples/ddex5/ddex5.rc new file mode 100644 index 0000000..5d5030c --- /dev/null +++ b/sdk/samples/ddex5/ddex5.rc @@ -0,0 +1,11 @@ +#include "resource.h" + +ALL BITMAP ALL.BMP + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END +END diff --git a/sdk/samples/ddex5/makefile b/sdk/samples/ddex5/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/ddex5/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/ddex5/makefile.wat b/sdk/samples/ddex5/makefile.wat new file mode 100644 index 0000000..b705d4b --- /dev/null +++ b/sdk/samples/ddex5/makefile.wat @@ -0,0 +1,2 @@ +MAKENAME=watcom.mk +!include ..\watbld.mk diff --git a/sdk/samples/ddex5/msvc.mk b/sdk/samples/ddex5/msvc.mk new file mode 100644 index 0000000..6c76bce --- /dev/null +++ b/sdk/samples/ddex5/msvc.mk @@ -0,0 +1,42 @@ +NAME = ddex5 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = ddex5.obj ddutil.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/ddex5/readme.txt b/sdk/samples/ddex5/readme.txt new file mode 100644 index 0000000..18c8eb8 --- /dev/null +++ b/sdk/samples/ddex5/readme.txt @@ -0,0 +1,6 @@ +Direct Draw example program 5. + +Adds functionality to example program 4. Uses GetEntries() to read a palette, +modifies the entries, and then uses SetEntries() to update the palette. + +This program requires 1.2 Meg of video ram. diff --git a/sdk/samples/ddex5/resource.h b/sdk/samples/ddex5/resource.h new file mode 100644 index 0000000..4351064 --- /dev/null +++ b/sdk/samples/ddex5/resource.h @@ -0,0 +1,2 @@ +#define IDR_MENU 102 +#define IDM_EXIT 40001 diff --git a/sdk/samples/ddex5/watcom.mk b/sdk/samples/ddex5/watcom.mk new file mode 100644 index 0000000..7f1676e --- /dev/null +++ b/sdk/samples/ddex5/watcom.mk @@ -0,0 +1,33 @@ +NAME = ddex5 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =..\..\..\lib\ddraw.lib + +OBJS = ddex5.obj ddutil.obj + +SYS = nt_win + +!ifdef DEBUG +COPT =-DDEBUG -d2 +LOPT = debug all +ROPT =-DDEBUG +!else +COPT =-oaxt -d1 +LOPT = +ROPT = +!endif + +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +!include ..\..\watsdk.mk + +$(NAME).$(EXT): $(OBJS) $(NAME).lnk $(RES) + $(LINK) $(LFLAGS) @$(NAME).lnk + $(RC) $(RES) diff --git a/sdk/samples/donut/donut.bmp b/sdk/samples/donut/donut.bmp new file mode 100644 index 0000000..2b9595b Binary files /dev/null and b/sdk/samples/donut/donut.bmp differ diff --git a/sdk/samples/donut/donut.cpp b/sdk/samples/donut/donut.cpp new file mode 100644 index 0000000..5314fe2 --- /dev/null +++ b/sdk/samples/donut/donut.cpp @@ -0,0 +1,460 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: donut.cpp + * + ***************************************************************************/ + +#define NAME "Donut" +#define TITLE "Donut" + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <ddraw.h> +#include "resource.h" +#include "ddutil.h" + +char szBitmap[] = "DONUT"; + +int gPos = 0; +BOOL gExclusive = FALSE; +int gMode = 0; +HWND hwnd; + +LPDIRECTDRAW lpDD; // DirectDraw object +LPDIRECTDRAWSURFACE lpDDSPrimary; // DirectDraw primary surface +LPDIRECTDRAWSURFACE lpDDSOne; // Offscreen surface 1 +LPDIRECTDRAWSURFACE lpDDSTwo; // Offscreen surface 2 +LPDIRECTDRAWPALETTE lpDDPal; // DirectDraw palette +BOOL bActive; // is application active? + +/* + * restoreAll + * + * restore all lost objects + */ +HRESULT restoreAll( void ) +{ + HRESULT ddrval; + + ddrval = lpDDSPrimary->Restore(); + if( ddrval == DD_OK ) + { + ddrval = lpDDSOne->Restore(); + if( ddrval == DD_OK ) + { + ddrval = lpDDSTwo->Restore(); + if( ddrval == DD_OK ) + { + DDReLoadBitmap(lpDDSOne, szBitmap); + } + } + } + return ddrval; + +} /* restoreAll */ + +/* + * updateFrame + * + * Decide what needs to be blitted next, wait for flip to complete, + * then flip the buffers. + */ +void updateFrame( void ) +{ + static DWORD lastTickCount = 0; + static int currentFrame = 0; + static BOOL haveBackground = FALSE; + DWORD thisTickCount; + RECT rcRect; + DWORD delay = 17; + HRESULT ddrval; + int pos; + + thisTickCount = GetTickCount(); + if((thisTickCount - lastTickCount) <= delay) + { + return; + } + + switch( gPos ) + { + case 0: pos = 0; break; + case 1: pos = 64; break; + case 2: pos = 128; break; + } + rcRect.left = 0; + rcRect.top = 0; + rcRect.right = 64; + rcRect.bottom = 64; + + // restore a previously saved patch + while( haveBackground ) + { + ddrval = lpDDSPrimary->BltFast( pos, 0, lpDDSTwo, &rcRect, FALSE ); + if( ddrval == DD_OK ) + { + haveBackground = TRUE; + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + ddrval = restoreAll(); + if( ddrval != DD_OK ) + { + return; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + return; + } + } + + rcRect.left = pos; + rcRect.right = pos+64; + // Save the current primary surface that we are about to overwrite + while( 1 ) + { + haveBackground = FALSE; + ddrval = lpDDSTwo->BltFast( 0, 0, lpDDSPrimary, + &rcRect, DDBLTFAST_NOCOLORKEY); + + if( ddrval == DD_OK ) + { + haveBackground = TRUE; + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + ddrval = restoreAll(); + if( ddrval != DD_OK ) + { + return; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + return; + } + } + + thisTickCount = GetTickCount(); + if((thisTickCount - lastTickCount) > delay) + { + // Move to next frame; + lastTickCount = thisTickCount; + currentFrame++; + if(currentFrame > 59) + { + currentFrame = 0; + } + } + + // Blit the stuff for the next frame + rcRect.left = currentFrame%10*64; + rcRect.top = currentFrame/10*64; + rcRect.right = currentFrame%10*64 + 64; + rcRect.bottom = currentFrame/10*64 + 64; + + while( 1 ) + { + ddrval = lpDDSPrimary->BltFast( pos, 0, lpDDSOne, + &rcRect, DDBLTFAST_SRCCOLORKEY); + + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + ddrval = restoreAll(); + if( ddrval != DD_OK ) + { + return; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + return; + } + } + if(ddrval != DD_OK) + { + return; + } +} /* updateFrame */ + + +/* + * finiObjects + * + * finished with all objects we use; release them + */ +static void finiObjects( void ) +{ + if( lpDD != NULL ) + { + if( lpDDSPrimary != NULL ) + { + lpDDSPrimary->Release(); + lpDDSPrimary = NULL; + } + if( lpDDSOne != NULL ) + { + lpDDSOne->Release(); + lpDDSOne = NULL; + } + if( lpDDPal != NULL ) + { + lpDDPal->Release(); + lpDDPal = NULL; + } + lpDD->Release(); + lpDD = NULL; + } + // Clean up the screen on exit + RedrawWindow( NULL, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | + RDW_ALLCHILDREN ); + +} /* finiObjects */ + +long FAR PASCAL WindowProc( HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam ) +{ + hwnd = hWnd; + switch( message ) + { + case WM_ACTIVATEAPP: + bActive = wParam; + break; + + case WM_SETCURSOR: + SetCursor(NULL); + return TRUE; + + case WM_PALETTECHANGED: + if ((HWND)wParam == hWnd) + break; + // fall through to WM_QUERYNEWPALETTE + case WM_QUERYNEWPALETTE: + // install our palette here + if (lpDDPal) + { + lpDDSPrimary->SetPalette(lpDDPal); + } + DDReLoadBitmap(lpDDSOne, szBitmap); + break; + + case WM_CREATE: + break; + + case WM_KEYDOWN: + switch( wParam ) + { + case VK_ESCAPE: + case VK_F12: + PostMessage(hWnd,WM_CLOSE,0,0); + break; + } + break; + + case WM_DESTROY: + finiObjects(); + PostQuitMessage( 0 ); + break; + } + + return DefWindowProc(hWnd, message, wParam, lParam); + +} /* WindowProc */ + +/* + * This function is called if the initialization function fails + */ +BOOL initFail( HWND hwnd ) +{ + finiObjects(); + MessageBox( hwnd, "DirectDraw Init FAILED", TITLE, MB_OK ); + DestroyWindow( hwnd ); + return FALSE; + +} /* initFail */ + +/* + * doInit - do work required for every instance of the application: + * create the window, initialize data + */ +static BOOL doInit( HINSTANCE hInstance, int nCmdShow ) +{ + HWND hwnd; + WNDCLASS wc; + DDSURFACEDESC ddsd; + HRESULT ddrval; + + /* + * 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, IDI_APPLICATION ); + 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( + 0, + NAME, + TITLE, + WS_POPUP, + 0, + 0, + 1, + 1, + NULL, + NULL, + hInstance, + NULL ); + + if( !hwnd ) + { + return FALSE; + } + + ShowWindow( hwnd, nCmdShow ); + UpdateWindow( hwnd ); + + /* + * create the main DirectDraw object + */ + ddrval = DirectDrawCreate( NULL, &lpDD, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Get exclusive mode if requested + if(gExclusive) + { + ddrval = lpDD->SetCooperativeLevel( hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); + } + else + { + ddrval = lpDD->SetCooperativeLevel( hwnd, DDSCL_NORMAL ); + } + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Set the video mode to 640x480x8 + switch( gMode ) + { + case 1: ddrval = lpDD->SetDisplayMode( 640, 480, 8); break; + case 2: ddrval = lpDD->SetDisplayMode( 800, 600, 8); break; + case 3: ddrval = lpDD->SetDisplayMode( 1024, 768, 8); break; + case 4: ddrval = lpDD->SetDisplayMode( 1280, 1024, 8); break; + } + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // Create the primary surface + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + lpDDPal = DDLoadPalette(lpDD, szBitmap); + + if (lpDDPal) + { + lpDDSPrimary->SetPalette(lpDDPal); + } + + lpDDSOne = DDLoadBitmap(lpDD, szBitmap, 0, 0); + if( lpDDSOne == NULL ) + { + return initFail(hwnd); + } + + // set color key to black + DDSetColorKey(lpDDSOne, RGB(0,0,0)); + + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.dwHeight = 64; + ddsd.dwWidth = 64; + ddrval = lpDD->CreateSurface( &ddsd, &lpDDSTwo, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + return TRUE; +} /* doInit */ + +/* + * WinMain - initialization, message loop + */ +int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + LPSTR c; + + for(c=lpCmdLine; *c != '\0'; c++) + { + switch( *c ) + { + case '0': gPos = 0; break; + case '1': gPos = 1; break; + case '2': gPos = 2; break; + case 'X': gExclusive = TRUE; break; + case 'A': gExclusive = TRUE; gMode = 1; break; + case 'B': gExclusive = TRUE; gMode = 2; break; + case 'C': gExclusive = TRUE; gMode = 3; break; + case 'D': gExclusive = TRUE; gMode = 4; break; + } + } + + if( !doInit( hInstance, nCmdShow ) ) + { + return FALSE; + } + + while( 1 ) + { + if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + { + if( !GetMessage( &msg, NULL, 0, 0 ) ) + return msg.wParam; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else if( !gExclusive || bActive ) + { + updateFrame(); + } + else + { + WaitMessage(); + } + } +} /* WinMain */ diff --git a/sdk/samples/donut/donut.def b/sdk/samples/donut/donut.def new file mode 100644 index 0000000..4c6dddc --- /dev/null +++ b/sdk/samples/donut/donut.def @@ -0,0 +1,10 @@ +NAME donut.exe + +DESCRIPTION 'A rotating rubber donut (C) Microsoft 1995' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/donut/donut.rc b/sdk/samples/donut/donut.rc new file mode 100644 index 0000000..373855f --- /dev/null +++ b/sdk/samples/donut/donut.rc @@ -0,0 +1,11 @@ +#include "resource.h" + +DONUT BITMAP DONUT.BMP + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END +END diff --git a/sdk/samples/donut/makefile b/sdk/samples/donut/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/donut/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/donut/makefile.wat b/sdk/samples/donut/makefile.wat new file mode 100644 index 0000000..b705d4b --- /dev/null +++ b/sdk/samples/donut/makefile.wat @@ -0,0 +1,2 @@ +MAKENAME=watcom.mk +!include ..\watbld.mk diff --git a/sdk/samples/donut/msvc.mk b/sdk/samples/donut/msvc.mk new file mode 100644 index 0000000..6896ea1 --- /dev/null +++ b/sdk/samples/donut/msvc.mk @@ -0,0 +1,42 @@ +NAME = donut +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = donut.obj ddutil.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/donut/readme.txt b/sdk/samples/donut/readme.txt new file mode 100644 index 0000000..bcbd535 --- /dev/null +++ b/sdk/samples/donut/readme.txt @@ -0,0 +1,26 @@ +This program is useful for testing multiple exclusive mode apps interacting +with multiple non-exclusive mode apps. The program displays a rotating +donut in the upper left corner of the screen. It may be terminated by +pressing Esc or F12. + +Various command line switches can be specified to modify the characteristics +of this program. Each switch consists of one character and need not be +preceeded with a dash or slash. The switches are as follows: + +0 - Display in far left position +1 - Display in middle position +2 - Display in right position +X - Use exclusive mode +A - Switch mode to 640x480x8 and use exclusive mode +B - Switch mode to 800x600x8 and use exclusive mode +C - Switch mode to 1024x768x8 and use exclusive mode +D - Switch mode to 1280x1024x8 and use exclusive mode + +The switches may be combined. If two switches are used which contradict, +the last switch specified will be in effect. + +If this program is running in non-exclusive mode, it attempts to continue to +run even when it loses focus. If it is running in exclusive mode, the +program does not attempt to modify the screen when it doesn't have focus. + + diff --git a/sdk/samples/donut/resource.h b/sdk/samples/donut/resource.h new file mode 100644 index 0000000..4351064 --- /dev/null +++ b/sdk/samples/donut/resource.h @@ -0,0 +1,2 @@ +#define IDR_MENU 102 +#define IDM_EXIT 40001 diff --git a/sdk/samples/donut/watcom.mk b/sdk/samples/donut/watcom.mk new file mode 100644 index 0000000..2a9ac3d --- /dev/null +++ b/sdk/samples/donut/watcom.mk @@ -0,0 +1,33 @@ +NAME = donut +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =..\..\..\lib\ddraw.lib + +OBJS = donut.obj ddutil.obj + +SYS = nt_win + +!ifdef DEBUG +COPT =-DDEBUG -d2 +LOPT = debug all +ROPT =-DDEBUG +!else +COPT =-oaxt -d1 +LOPT = +ROPT = +!endif + +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +!include ..\..\watsdk.mk + +$(NAME).$(EXT): $(OBJS) $(NAME).lnk $(RES) + $(LINK) $(LFLAGS) @$(NAME).lnk + $(RC) $(RES) diff --git a/sdk/samples/donuts/bangbang.wav b/sdk/samples/donuts/bangbang.wav new file mode 100644 index 0000000..84cf9e1 Binary files /dev/null and b/sdk/samples/donuts/bangbang.wav differ diff --git a/sdk/samples/donuts/bounce.wav b/sdk/samples/donuts/bounce.wav new file mode 100644 index 0000000..33bd786 Binary files /dev/null and b/sdk/samples/donuts/bounce.wav differ diff --git a/sdk/samples/donuts/c_bang.wav b/sdk/samples/donuts/c_bang.wav new file mode 100644 index 0000000..4dc29b9 Binary files /dev/null and b/sdk/samples/donuts/c_bang.wav differ diff --git a/sdk/samples/donuts/d_bang.wav b/sdk/samples/donuts/d_bang.wav new file mode 100644 index 0000000..f6c6658 Binary files /dev/null and b/sdk/samples/donuts/d_bang.wav differ diff --git a/sdk/samples/donuts/donuts.bmp b/sdk/samples/donuts/donuts.bmp new file mode 100644 index 0000000..2c0015d Binary files /dev/null and b/sdk/samples/donuts/donuts.bmp differ diff --git a/sdk/samples/donuts/donuts.c b/sdk/samples/donuts/donuts.c new file mode 100644 index 0000000..2782334 --- /dev/null +++ b/sdk/samples/donuts/donuts.c @@ -0,0 +1,1880 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: donuts.c + * Content: Shoot-em-up game + * + * + ***************************************************************************/ +#include "donuts.h" + + +LPDIRECTDRAWSURFACE lpFrontBuffer; +LPDIRECTDRAWSURFACE lpBackBuffer; +LPDIRECTDRAWSURFACE lpDonut; +LPDIRECTDRAWSURFACE lpPyramid; +LPDIRECTDRAWSURFACE lpCube; +LPDIRECTDRAWSURFACE lpSphere; +LPDIRECTDRAWSURFACE lpShip; +LPDIRECTDRAWSURFACE lpNum; +LPDIRECTDRAW lpDD; +LPDIRECTDRAWPALETTE lpArtPalette; +LPDIRECTDRAWPALETTE lpSplashPalette; +BOOL bSoundEnabled = FALSE; +BOOL bPlayIdle = FALSE; +BOOL bPlayBuzz = FALSE; +BOOL bPlayRev = FALSE; +DWORD lastInput = 0; +BOOL lastThrust = FALSE; +BOOL lastShield = FALSE; +int showDelay = 0; +HWND hWndMain; +BOOL bShowFrameCount=TRUE; +BOOL bIsActive; +BOOL bMouseVisible; +DWORD dwFrameCount; +DWORD dwFrameTime; +DWORD dwFrames; +DWORD dwFramesLast; +BOOL bUseEmulation; +BOOL bTest=FALSE; +BOOL bStress=FALSE; +DWORD dwTransType; +RGBQUAD SPalette[256]; +DWORD lastTickCount; +int score; +int ProgramState; +int level; +int restCount; +DWORD dwFillColor; +BOOL bSpecialEffects = FALSE; +DWORD ShowLevelCount = 3000; +DWORD ScreenX; +DWORD ScreenY; +DWORD ScreenBpp; +BOOL bWantSound = TRUE; //global hack to turn off sound + +int getint(char**p, int def); + +#ifdef DEBUG +char DebugBuf[256]; +BOOL bHELBlt = FALSE; +#endif + +DBLNODE DL; // Display List + +#ifdef USE_DSOUND +LPDIRECTSOUND lpDS; +HSNDOBJ hsoBeginLevel = NULL; +HSNDOBJ hsoEngineIdle = NULL; +HSNDOBJ hsoEngineRev = NULL; +HSNDOBJ hsoSkidToStop = NULL; +HSNDOBJ hsoShieldBuzz = NULL; +HSNDOBJ hsoShipExplode = NULL; +HSNDOBJ hsoFireBullet = NULL; +HSNDOBJ hsoShipBounce = NULL; +HSNDOBJ hsoDonutExplode = NULL; +HSNDOBJ hsoPyramidExplode = NULL; +HSNDOBJ hsoCubeExplode = NULL; +HSNDOBJ hsoSphereExplode = NULL; +#endif + + +void setup_game(void) +{ + restCount = GetTickCount(); + initLevel( ++level ); + // set the palette + lpFrontBuffer->lpVtbl->SetPalette( lpFrontBuffer, lpArtPalette ); +} + +/* + * MainWndproc + * + * Callback for all Windows messages + */ +long FAR PASCAL MainWndproc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + PAINTSTRUCT ps; + HDC hdc; + + switch( message ) + { + case WM_ACTIVATEAPP: + bIsActive = (BOOL) wParam; + if( bIsActive ) + { + bMouseVisible = FALSE; + lastTickCount = GetTickCount(); + bSpecialEffects = FALSE; + } + else + { + bMouseVisible = TRUE; + } + break; + + case WM_CREATE: + break; + + case WM_SETCURSOR: + if( !bMouseVisible ) + { + SetCursor(NULL); + } + else + { + SetCursor(LoadCursor( NULL, IDC_ARROW )); + } + return TRUE; + + case WM_KEYDOWN: + switch( wParam ) + { + case VK_NUMPAD7: + lastInput |= KEY_SHIELD; + break; + case VK_NUMPAD5: + lastInput |= KEY_STOP; + break; + case VK_DOWN: + case VK_NUMPAD2: + lastInput |= KEY_DOWN; + break; + case VK_LEFT: + case VK_NUMPAD4: + lastInput |= KEY_LEFT; + break; + case VK_RIGHT: + case VK_NUMPAD6: + lastInput |= KEY_RIGHT; + break; + case VK_UP: + case VK_NUMPAD8: + lastInput |= KEY_UP; + break; + case VK_NUMPAD3: + lastInput |= KEY_THROW; + break; + case VK_SPACE: + lastInput |= KEY_FIRE; + break; + case VK_F5: + bShowFrameCount = !bShowFrameCount; + if( bShowFrameCount ) + { + dwFrameCount = 0; + dwFrameTime = timeGetTime(); + } + break; + case VK_RETURN: + if( ProgramState == PS_SPLASH ) + { + ProgramState = PS_BEGINREST; + setup_game(); + } + break; + case VK_ESCAPE: + case VK_F12: + PostMessage( hWnd, WM_CLOSE, 0, 0 ); + return 0; + case VK_F3: +#ifdef USE_DSOUND + if(bWantSound) + { + if( bSoundEnabled ) + { + DestroySound(); + } + else + { + InitializeSound(); + } + } +#endif + break; + case VK_F1: + bSpecialEffects = !bSpecialEffects; + break; + } + break; + + + case WM_KEYUP: + switch( wParam ) + { + case VK_NUMPAD7: + lastInput &= ~KEY_SHIELD; + break; + case VK_NUMPAD5: + lastInput &= ~KEY_STOP; + break; + case VK_DOWN: + case VK_NUMPAD2: + lastInput &= ~KEY_DOWN; + break; + case VK_LEFT: + case VK_NUMPAD4: + lastInput &= ~KEY_LEFT; + break; + case VK_RIGHT: + case VK_NUMPAD6: + lastInput &= ~KEY_RIGHT; + break; + case VK_UP: + case VK_NUMPAD8: + lastInput &= ~KEY_UP; + break; + case VK_NUMPAD3: + lastInput &= ~KEY_THROW; + break; + case VK_SPACE: + lastInput &= ~KEY_FIRE; + break; + } + break; + + case WM_ERASEBKGND: + return 1; + + case WM_PAINT: + hdc = BeginPaint( hWnd, &ps ); + EndPaint( hWnd, &ps ); + return 1; + + case WM_DESTROY: + lastInput=0; + DestroyGame(); + PostQuitMessage( 0 ); + break; + + default: + break; + } + return DefWindowProc(hWnd, message, wParam, lParam); + +} /* MainWndproc */ + +/* + * initApplication + * + * Do that Windows initialization stuff... + */ +static BOOL initApplication( HANDLE hInstance, int nCmdShow ) +{ + WNDCLASS wc; + BOOL rc; + + wc.style = CS_DBLCLKS; + wc.lpfnWndProc = MainWndproc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon( hInstance, "DONUTS_ICON"); + wc.hCursor = LoadCursor( NULL, IDC_ARROW ); + wc.hbrBackground = GetStockObject( BLACK_BRUSH ); + wc.lpszMenuName = NULL; + wc.lpszClassName = "DonutsClass"; + rc = RegisterClass( &wc ); + if( !rc ) + { + return FALSE; + } + + hWndMain = CreateWindowEx(0, // WS_EX_TOPMOST, + "DonutsClass", + "Donuts", + WS_VISIBLE | // so we don't have to call ShowWindow + WS_POPUP | // non-app window + WS_SYSMENU, // so we get an icon in the tray + 0, + 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + NULL, + NULL, + hInstance, + NULL ); + + if( !hWndMain ) + { + return FALSE; + } + + UpdateWindow( hWndMain ); + + return TRUE; + +} /* initApplication */ + +/* + * WinMain + */ +int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, + int nCmdShow ) +{ + MSG msg; + + while( lpCmdLine[0] == '-' ) + { + lpCmdLine++; + + switch (*lpCmdLine++) + { + case 'e': + bUseEmulation = TRUE; + break; + case 't': + bTest = TRUE; + break; + case 'S': + bWantSound = FALSE; + break; + case 'x': + bStress= TRUE; + bTest = TRUE; + break; + } + while( IS_SPACE(*lpCmdLine) ) + { + lpCmdLine++; + } + } + + ScreenX = getint(&lpCmdLine, 640); + ScreenY = getint(&lpCmdLine, 480); + ScreenBpp = getint(&lpCmdLine, 8); + + if( !initApplication(hInstance, nCmdShow) ) + { + return FALSE; + } + + if( !InitializeGame() ) + { + DestroyWindow( hWndMain ); + return FALSE; + } + + dwFrameTime = timeGetTime(); + + while( 1 ) + { + if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + { + if( !GetMessage( &msg, NULL, 0, 0 ) ) + { + return msg.wParam; + } + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else if ( bIsActive ) + { + UpdateFrame(); + } + else + { + WaitMessage(); + } + } +} /* WinMain */ + + +void DestroyGame( void ) +{ +} + +BOOL InitializeGame( void ) +{ + DDCAPS ddcaps; + HRESULT ddrval; + DDSURFACEDESC ddsd; + DDSCAPS ddscaps; +#ifdef NT_HACK + DDSURFACEDESC DDSurfDesc; +#endif + + score = 0; + if( bTest ) + ShowLevelCount = 1000; + + if( bUseEmulation ) + ddrval = DirectDrawCreate( (LPVOID) DDCREATE_EMULATIONONLY, &lpDD, NULL ); + else + ddrval = DirectDrawCreate( NULL, &lpDD, NULL ); + + if( ddrval != DD_OK ) + return CleanupAndExit("DirectDrawCreate Failed!"); + + ddrval = lpDD->lpVtbl->SetCooperativeLevel( lpDD, hWndMain, + DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); + if( ddrval != DD_OK ) + return CleanupAndExit("SetCooperativeLevel Failed"); + + #ifdef NT_HACK + DDSurfDesc.dwSize = sizeof(DDSurfDesc); + ddrval = lpDD->lpVtbl->GetDisplayMode(lpDD,&DDSurfDesc); + if(ddrval == DD_OK) + ScreenBpp = DDSurfDesc.ddpfPixelFormat.dwRGBBitCount; + #endif + + // set the mode + ddrval = lpDD->lpVtbl->SetDisplayMode( lpDD, ScreenX, ScreenY, ScreenBpp ); + if( ddrval != DD_OK ) + return CleanupAndExit("SetDisplayMode Failed!"); + + // check the color key hardware capabilities + dwTransType = DDBLTFAST_SRCCOLORKEY; + ddcaps.dwSize = sizeof( ddcaps ); + +#ifdef DEBUG + if( GetProfileInt( "Donuts", "force_dest_blt", 0) ) + { + dwTransType = DDBLTFAST_DESTCOLORKEY; + } + bHELBlt = GetProfileInt( "Donuts", "force_HEL_blt", bHELBlt ); +#endif + + // Create surfaces + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | + DDSCAPS_COMPLEX; + ddsd.dwBackBufferCount = 1; + ddrval = lpDD->lpVtbl->CreateSurface( lpDD, &ddsd, &lpFrontBuffer, NULL ); + if( ddrval != DD_OK ) + return CleanupAndExit("CreateSurface FrontBuffer Failed!"); + + // get a pointer to the back buffer + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + ddrval = lpFrontBuffer->lpVtbl->GetAttachedSurface( + lpFrontBuffer, + &ddscaps, + &lpBackBuffer ); + if( ddrval != DD_OK ) + return CleanupAndExit("GetAttachedDurface Failed!"); + + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; +#ifdef DEBUG + if( bHELBlt ) + ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; +#endif + ddsd.dwWidth = 320; + ddsd.dwHeight = 384; + ddrval = lpDD->lpVtbl->CreateSurface( lpDD, &ddsd, &lpDonut, NULL ); + if( ddrval != DD_OK ) + return CleanupAndExit("CreateSurface lpDonut Failed!"); + + ddsd.dwHeight = 128; + ddrval = lpDD->lpVtbl->CreateSurface( lpDD, &ddsd, &lpPyramid, NULL ); + if( ddrval != DD_OK ) + return CleanupAndExit("CreateSurface lpPyramid Failed!"); + + ddsd.dwHeight = 32; + ddrval = lpDD->lpVtbl->CreateSurface( lpDD, &ddsd, &lpCube, NULL ); + if( ddrval != DD_OK ) + return CleanupAndExit("CreateSurface lpCube Failed!"); + + ddsd.dwHeight = 32; + ddrval = lpDD->lpVtbl->CreateSurface( lpDD, &ddsd, &lpSphere, NULL ); + if( ddrval != DD_OK ) + return CleanupAndExit("CreateSurface lpSphere Failed!"); + // Set the background color fill color + + ddsd.dwHeight = 256; + ddrval = lpDD->lpVtbl->CreateSurface( lpDD, &ddsd, &lpShip, NULL ); + if( ddrval != DD_OK ) + return CleanupAndExit("CreateSurface lpShip Failed!"); + + ddsd.dwHeight = 16; + ddrval = lpDD->lpVtbl->CreateSurface( lpDD, &ddsd, &lpNum, NULL ); + if( ddrval != DD_OK ) + return CleanupAndExit("CreateSurface lpNum Failed!"); + + if( !RestoreSurfaces() ) + return CleanupAndExit("RestoreSurfaces Failed!"); + + DL.next = DL.prev = &DL; // null display list + DL.type = OBJ_SHIP; + DL.surf = lpShip; + lastTickCount = GetTickCount(); + +#ifdef USE_DSOUND + if(bWantSound) + { + InitializeSound(); + } +#endif + if(bTest) + { + ProgramState = PS_ACTIVE; + setup_game(); + } + else + { + ProgramState = PS_SPLASH; + } + return TRUE; +} + +BOOL CleanupAndExit( char *err) +{ +#ifdef DEBUG + wsprintf(DebugBuf, "___CleanupAndExit err = %s\n", err ); + OutputDebugString( DebugBuf ); +#endif + + // make the cursor visible + SetCursor(LoadCursor( NULL, IDC_ARROW )); + bMouseVisible = TRUE; + + if( lpDonut != NULL ) + lpDonut->lpVtbl->Release( lpDonut ); + + if( lpPyramid != NULL ) + lpPyramid->lpVtbl->Release( lpPyramid ); + + if( lpCube != NULL ) + lpCube->lpVtbl->Release( lpCube ); + + if( lpSphere != NULL ) + lpSphere->lpVtbl->Release( lpSphere ); + + if( lpShip != NULL ) + lpShip->lpVtbl->Release( lpShip ); + + if( lpNum != NULL ) + lpNum->lpVtbl->Release( lpNum ); + + if( lpFrontBuffer != NULL ) + lpFrontBuffer->lpVtbl->Release( lpFrontBuffer ); + + if( lpArtPalette != NULL ) + lpArtPalette->lpVtbl->Release( lpArtPalette ); + + if( lpSplashPalette != NULL ) + lpSplashPalette->lpVtbl->Release( lpSplashPalette ); + + if( lpDD != NULL ) + lpDD->lpVtbl->Release( lpDD ); + + // + // warn user if there is one + // + + if( !bStress ) + { + MessageBox( hWndMain, err, "ERROR", MB_OK ); + } + return FALSE; +} + +void bltSplash( void ) +{ + HRESULT ddrval; + HBITMAP hbm; + + // set the palette before loading the splash screen + lpFrontBuffer->lpVtbl->SetPalette( lpFrontBuffer, lpSplashPalette ); + + hbm = (HBITMAP)LoadImage( GetModuleHandle( NULL ), "SPLASH", IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION ); + if ( NULL == hbm ) + return; + + // if the surface is lost, DDCopyBitmap will fail and the surface will + // be restored in FlipScreen. + ddrval = DDCopyBitmap( lpBackBuffer, hbm, 0, 0, 0, 0 ); + + DeleteObject( hbm ); + + FlipScreen(); +} + +#ifdef USE_DSOUND +// +// play a sound, but first set the panning according to where the +// object is on the screen. fake 3D sound. +// +void playPanned(HSNDOBJ hSO, DBLNODE *object) +{ + IDirectSoundBuffer *pDSB = SndObjGetFreeBuffer(hSO); + + if(!bWantSound) + return; // No sound our Work is done + + if (pDSB) + { + switch(ScreenX) + { + case 320: + IDirectSoundBuffer_SetPan(pDSB, (LONG)((20000.0 * + ((object->dst.right + object->dst.left) / 2) / 320.0) - 10000.0)); + break; + case 640: + IDirectSoundBuffer_SetPan(pDSB, (LONG)((20000.0 * + ((object->dst.right + object->dst.left) / 2) / 640.0) - 10000.0)); + break; + case 1024: + IDirectSoundBuffer_SetPan(pDSB, (LONG)((20000.0 * + ((object->dst.right + object->dst.left) / 2) / 1024.0) - 10000.0)); + break; + case 1280: + IDirectSoundBuffer_SetPan(pDSB, (LONG)((20000.0 * + ((object->dst.right + object->dst.left) / 2) / 1280.0) - 10000.0)); + break; + } + + IDirectSoundBuffer_Play(pDSB, 0, 0, 0); + } +} +#endif + +void UpdateFrame( void ) +{ + switch( ProgramState ) + { + case PS_SPLASH: + // display the splash screen + bltSplash(); + return; + case PS_ACTIVE: + UpdateDisplayList(); + CheckForHits(); + DrawDisplayList(); + if ( isDisplayListEmpty() ) + { +#ifdef USE_DSOUND + if(bWantSound) + { + SndObjStop(hsoEngineIdle); + SndObjStop(hsoEngineRev); + } +#endif + bPlayIdle = FALSE; + bPlayRev = FALSE; + lastThrust = lastShield = FALSE; + ProgramState = PS_BEGINREST; + restCount = GetTickCount(); + initLevel( ++level ); + } + return; + case PS_BEGINREST: +#ifdef USE_DSOUND + if(bWantSound) + { + SndObjPlay(hsoBeginLevel, 0); + } +#endif + ProgramState = PS_REST; + // + // FALLTHRU + // + case PS_REST: + if( ( GetTickCount() - restCount ) > ShowLevelCount ) + { +#ifdef USE_DSOUND + if(bWantSound) + { + SndObjPlay(hsoEngineIdle, DSBPLAY_LOOPING); + } +#endif + bPlayIdle = TRUE; + lastTickCount = GetTickCount(); + ProgramState = PS_ACTIVE; + } + else + { + DisplayLevel(); + } + return; + } +} + +void DisplayLevel( void ) +{ + char buf[10]; + + EraseScreen(); + buf[0] = 10 + '0'; + buf[1] = 11 + '0'; + buf[2] = 12 + '0'; + buf[3] = 11 + '0'; + buf[4] = 10 + '0'; + buf[5] = '\0'; + bltScore( buf, ScreenX/2-64, ScreenY/2-8 ); + buf[0] = level / 100 + '0'; + buf[1] = level / 10 + '0'; + buf[2] = level % 10 + '0'; + buf[3] = '\0'; + bltScore( buf, ScreenX/2+22, ScreenY/2-8 ); + FlipScreen(); +} + +void bltScore( char *num, int x, int y ) +{ + char *c; + RECT src; + int i; + HRESULT ddrval; + + for(c=num; *c != '\0'; c++) + { + while( 1 ) + { + i = *c - '0'; + src.left = i*16; + src.top = 0; + src.right = src.left + 16; + src.bottom = src.top + 16; + ddrval = lpBackBuffer->lpVtbl->BltFast( lpBackBuffer, x, y, lpNum, &src, dwTransType ); + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + if( !RestoreSurfaces() ) + return; + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + return; + } + } + x += 16; + } +} + +void CheckForHits( void ) +{ + LPDBLNODE bullet, target, save; + int frame, x, y, l, t; + BOOL hit; + + // update screen rects + target = &DL; + do + { + frame = (DWORD)target->frame; + switch( target->type ) + { + case OBJ_DONUT: + target->dst.left = (DWORD)target->posx; + target->dst.top = (DWORD)target->posy; + target->dst.right = target->dst.left + 64; + target->dst.bottom = target->dst.top + 64; + target->src.left = 64 * (frame % 5); + target->src.top = 64 * (frame /5); + target->src.right = target->src.left + 64; + target->src.bottom = target->src.top + 64; + break; + case OBJ_PYRAMID: + target->dst.left = (DWORD)target->posx; + target->dst.top = (DWORD)target->posy; + target->dst.right = target->dst.left + 32; + target->dst.bottom = target->dst.top + 32; + target->src.left = 32 * (frame % 10); + target->src.top = 32 * (frame /10); + target->src.right = target->src.left + 32; + target->src.bottom = target->src.top + 32; + break; + case OBJ_SPHERE: + target->dst.left = (DWORD)target->posx; + target->dst.top = (DWORD)target->posy; + target->dst.right = target->dst.left + 16; + target->dst.bottom = target->dst.top + 16; + target->src.left = 16 * (frame % 20); + target->src.top = 16 * (frame /20); + target->src.right = target->src.left + 16; + target->src.bottom = target->src.top + 16; + break; + case OBJ_CUBE: + target->dst.left = (DWORD)target->posx; + target->dst.top = (DWORD)target->posy; + target->dst.right = target->dst.left + 16; + target->dst.bottom = target->dst.top + 16; + target->src.left = 16 * (frame % 20); + target->src.top = 16 * (frame /20); + target->src.right = target->src.left + 16; + target->src.bottom = target->src.top + 16; + break; + case OBJ_SHIP: + target->dst.left = (DWORD)target->posx; + target->dst.top = (DWORD)target->posy; + target->dst.right = target->dst.left + 32; + target->dst.bottom = target->dst.top + 32; + if( lastShield ) + target->src.top = 32 * (frame / 10) + 128; + else + target->src.top = 32 * (frame /10); + target->src.left = 32 * (frame % 10); + target->src.right = target->src.left + 32; + target->src.bottom = target->src.top + 32; + break; + case OBJ_BULLET: + frame = (DWORD)target->frame/20 % 4; + target->dst.left = (DWORD)target->posx; + target->dst.top = (DWORD)target->posy; + target->dst.right = target->dst.left + 3; + target->dst.bottom = target->dst.top + 3; + target->src.left = BULLET_X + frame*4; + target->src.top = BULLET_Y; + target->src.right = target->src.left + 3; + target->src.bottom = target->src.top + 3; + break; + } + target = target->next; + } + while( target != &DL ); + + bullet=&DL; + do + { + hit = FALSE; + if((bullet->type != OBJ_BULLET) && (bullet != &DL)) + { + bullet = bullet->next; + continue; + } + + x = (bullet->dst.left + bullet->dst.right) / 2; + y = (bullet->dst.top + bullet->dst.bottom) / 2; + for(target=DL.next; target != &DL; target = target->next) + { + if( ( target->type != OBJ_DONUT ) && + ( target->type != OBJ_PYRAMID ) && + ( target->type != OBJ_SPHERE ) && + ( target->type != OBJ_CUBE ) ) + continue; + + if( (x >= target->dst.left) && + (x < target->dst.right) && + (y >= target->dst.top) && + (y < target->dst.bottom) ) + { + if ((bullet != &DL) || !lastShield) + { + // the bullet hit the target + switch( target->type ) + { + case OBJ_DONUT: +#ifdef USE_DSOUND + if(bWantSound) + { + playPanned(hsoDonutExplode, target); + } +#endif + addObject( OBJ_PYRAMID, target->dst.left, + target->dst.top, -1.0, -1.0 ); + addObject( OBJ_PYRAMID, target->dst.left, + target->dst.top, -1.0, -1.0 ); + addObject( OBJ_PYRAMID, target->dst.left, + target->dst.top, -1.0, -1.0 ); + score += 10; + break; + case OBJ_PYRAMID: +#ifdef USE_DSOUND + if(bWantSound) + { + playPanned(hsoPyramidExplode, target); + } +#endif + addObject( OBJ_SPHERE, target->dst.left, + target->dst.top, -1.0, -1.0 ); + addObject( OBJ_CUBE, target->dst.left, + target->dst.top, -1.0, -1.0 ); + addObject( OBJ_CUBE, target->dst.left, + target->dst.top, -1.0, -1.0 ); + score += 20; + break; + case OBJ_CUBE: +#ifdef USE_DSOUND + if(bWantSound) + { + playPanned(hsoCubeExplode, target); + } +#endif + addObject( OBJ_SPHERE, target->dst.left, + target->dst.top, -1.0, -1.0 ); + addObject( OBJ_SPHERE, target->dst.left, + target->dst.top, -1.0, -1.0 ); + break; + score += 40; + case OBJ_SPHERE: +#ifdef USE_DSOUND + if(bWantSound) + { + playPanned(hsoSphereExplode, target); + } +#endif + score += 20; + } + + l = target->dst.left; + t = target->dst.top; + DeleteFromList( target ); + } + + hit = TRUE; + } + + if( hit ) + { + if( bullet == &DL ) + { + hit = FALSE; + if (!lastShield && !showDelay && !bTest) + { +#ifdef USE_DSOUND + if(bWantSound) + { + playPanned(hsoShipExplode, bullet); + } +#endif + score -= 150; + if (score < 0) + score = 0; + + addObject( OBJ_SPHERE, l, t, -1.0, -1.0 ); + addObject( OBJ_SPHERE, l, t, -1.0, -1.0 ); + addObject( OBJ_SPHERE, l, t, -1.0, -1.0 ); + addObject( OBJ_SPHERE, l, t, -1.0, -1.0 ); + addObject( OBJ_BULLET, l, t, + randDouble( -0.5, 0.5 ), randDouble( -0.5, 0.5 ) ); + addObject( OBJ_BULLET, l, t, + randDouble( -0.5, 0.5 ), randDouble( -0.5, 0.5 ) ); + addObject( OBJ_BULLET, l, t, + randDouble( -0.5, 0.5 ), randDouble( -0.5, 0.5 ) ); + addObject( OBJ_BULLET, l, t, + randDouble( -0.5, 0.5 ), randDouble( -0.5, 0.5 ) ); + addObject( OBJ_BULLET, l, t, + randDouble( -0.5, 0.5 ), randDouble( -0.5, 0.5 ) ); + addObject( OBJ_BULLET, l, t, + randDouble( -0.5, 0.5 ), randDouble( -0.5, 0.5 ) ); + addObject( OBJ_BULLET, l, t, + randDouble( -0.5, 0.5 ), randDouble( -0.5, 0.5 ) ); + addObject( OBJ_BULLET, l, t, + randDouble( -0.5, 0.5 ), randDouble( -0.5, 0.5 ) ); + addObject( OBJ_BULLET, l, t, + randDouble( -0.5, 0.5 ), randDouble( -0.5, 0.5 ) ); + addObject( OBJ_BULLET, l, t, + randDouble( -0.5, 0.5 ), randDouble( -0.5, 0.5 ) ); + initShip(TRUE); + } + } + + break; + } + } + + if( hit ) + { + save = bullet; + bullet = bullet->next; + + DeleteFromList( save ); + } + else + { + bullet = bullet->next; + } + + } while (bullet != &DL); +} + +void EraseScreen( void ) +{ + DDBLTFX ddbltfx; + HRESULT ddrval; + + if( bSpecialEffects ) // cool looking screen with no colorfill + return; + + // Erase the background + ddbltfx.dwSize = sizeof( ddbltfx ); + ddbltfx.dwFillColor = dwFillColor; + while( 1 ) + { + ddrval = lpBackBuffer->lpVtbl->Blt( lpBackBuffer, NULL, NULL, + NULL, DDBLT_COLORFILL, &ddbltfx ); + + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + if( !RestoreSurfaces() ) + return; + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + return; + } + } +} + +void FlipScreen( void ) +{ + HRESULT ddrval; + + // Flip the surfaces + while( 1 ) + { + ddrval = lpFrontBuffer->lpVtbl->Flip( lpFrontBuffer, NULL, 0 ); + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + if( !RestoreSurfaces() ) + { + return; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + break; + } + } +} + +void DrawDisplayList( void ) +{ + LPDBLNODE this; + LPDBLNODE last; + HRESULT ddrval; + char scorebuf[11]; + int rem; + + // blt everything in reverse order if we are doing destination transparency + // calculate score string + scorebuf[0] = score/10000000 + '0'; + rem = score % 10000000; + scorebuf[1] = rem/1000000 + '0'; + rem = score % 1000000; + scorebuf[2] = rem/100000 + '0'; + rem = score % 100000; + scorebuf[3] = rem/10000 + '0'; + rem = score % 10000; + scorebuf[4] = rem/1000 + '0'; + rem = score % 1000; + scorebuf[5] = rem/100 + '0'; + rem = score % 100; + scorebuf[6] = rem/10 + '0'; + rem = score % 10; + scorebuf[7] = rem + '0'; +#ifdef USE_DSOUND + if( bSoundEnabled ) + { + scorebuf[8] = 14 + '0'; + scorebuf[9] = 13 + '0'; + scorebuf[10] = '\0'; + } + else +#endif + { + scorebuf[8] = '\0'; + } + + EraseScreen(); + if( dwTransType == DDBLTFAST_DESTCOLORKEY ) + { + bltScore(scorebuf, 10, ScreenY-26); + + if( bShowFrameCount ) + DisplayFrameRate(); + + this = DL.next; // start with the topmost bitmap + last = DL.next; // don't blt it twice + + if (showDelay) + last = &DL; + } + else + { + this = &DL; // start with the bottommost bitmap (the ship) + last = &DL; // don't blt it twice + + if (showDelay) + this = this->prev; + } + + do + { + while( 1 ) + { + ddrval = lpBackBuffer->lpVtbl->BltFast( lpBackBuffer, this->dst.left, this->dst.top, this->surf, &(this->src), dwTransType ); + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + if( !RestoreSurfaces() ) + return; + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + return; + } + } + if( dwTransType != DDBLTFAST_DESTCOLORKEY ) + { + this = this->prev; + } + else + { + this = this->next; + } + } + while( this != last ); + + if( dwTransType != DDBLTFAST_DESTCOLORKEY ) + { + bltScore(scorebuf, 10, ScreenY-26); + + if( bShowFrameCount ) + DisplayFrameRate(); + } + + FlipScreen(); +} + +void DisplayFrameRate( void ) +{ + DWORD time2; + char buff[256]; + + dwFrameCount++; + time2 = timeGetTime() - dwFrameTime; + if( time2 > 1000 ) + { + dwFrames = (dwFrameCount*1000)/time2; + dwFrameTime = timeGetTime(); + dwFrameCount = 0; + } + if( dwFrames == 0 ) + { + return; + } + + if (dwFrames != dwFramesLast) + { + dwFramesLast = dwFrames; + } + + if( dwFrames > 99 ) + { + dwFrames = 99; + } + buff[0] = (char)((dwFrames / 10) + '0'); + buff[1] = (char)((dwFrames % 10) + '0'); + buff[2] = '\0'; + bltScore(buff, ScreenX/2-25, 10); +} + +void DeleteFromList( LPDBLNODE this ) +{ + this->next->prev = this->prev; + this->prev->next = this->next; + LocalFree( this ); +} + +void UpdateDisplayList( void ) +{ + LPDBLNODE this; + LPDBLNODE save; + DWORD thisTickCount = GetTickCount(); + DWORD tickDiff = thisTickCount - lastTickCount; + double maxx, maxy; + double maxframe; + DWORD input = lastInput; + BOOL event = FALSE; + + if( bTest ) + { + input |= (KEY_RIGHT | KEY_FIRE); + } + lastTickCount = thisTickCount; + + if (showDelay) + { + showDelay -= (int)tickDiff; + if (showDelay < 0) + { + showDelay = 0; + lastShield = FALSE; + initShip( FALSE ); + } + } + + // update the ship + if( !showDelay ) + { + DL.posx += DL.velx * (double)tickDiff; + DL.posy += DL.vely * (double)tickDiff; + } + if( DL.posx > MAX_SHIP_X ) + { + DL.posx = MAX_SHIP_X; + DL.velx = -DL.velx; + event = TRUE; + } + else if ( DL.posx < 0 ) + { + DL.posx =0; + DL.velx = -DL.velx; + event = TRUE; + } + if( DL.posy > MAX_SHIP_Y ) + { + DL.posy = MAX_SHIP_Y; + DL.vely = -DL.vely; + event = TRUE; + } + else if ( DL.posy < 0 ) + { + DL.posy =0; + DL.vely = -DL.vely; + event = TRUE; + } + if (event) + { +#ifdef USE_DSOUND + if(bWantSound) + { + playPanned(hsoShipBounce, &DL); + } +#endif + event = FALSE; + } + + if ((event = (showDelay || ((input & KEY_SHIELD) == KEY_SHIELD))) != + lastShield) + { + if (event && !showDelay) + { +#ifdef USE_DSOUND + if(bWantSound) + { + SndObjPlay(hsoShieldBuzz, DSBPLAY_LOOPING); + } +#endif + bPlayBuzz = TRUE; + } + else + { +#ifdef USE_DSOUND + if(bWantSound) + { + SndObjStop(hsoShieldBuzz); + } +#endif + bPlayBuzz = FALSE; + } + lastShield = event; + } + if (event) + { + input &= ~(KEY_FIRE); + } + + if (input & KEY_FIRE) + { + if( !showDelay ) + { + // add a bullet to the scene + score--; + if(score < 0) + score = 0; + +#ifdef USE_DSOUND + if(bWantSound) + { + SndObjPlay(hsoFireBullet, 0); + } +#endif + addObject( OBJ_BULLET, Dirx[(int)DL.frame]*6.0 + 16.0 + DL.posx, + Diry[(int)DL.frame]*6.0 + 16.0 + DL.posy, + Dirx[(int)DL.frame]*500.0/1000.0, + Diry[(int)DL.frame]*500.0/1000.0 ); + } + } + + event = FALSE; + if( input & KEY_LEFT ) + { + DL.frame -= 1.0; + if( DL.frame < 0.0 ) + DL.frame += MAX_SHIP_FRAME; + } + if( input & KEY_RIGHT ) + { + DL.frame += 1.0; + if( DL.frame >= MAX_SHIP_FRAME) + DL.frame -= MAX_SHIP_FRAME; + } + if( input & KEY_UP ) + { + DL.velx += Dirx[(int)DL.frame] * 10.0/1000.0; + DL.vely += Diry[(int)DL.frame] * 10.0/1000.0; + event = TRUE; + } + if( input & KEY_DOWN ) + { + DL.velx -= Dirx[(int)DL.frame] * 10.0/1000.0; + DL.vely -= Diry[(int)DL.frame] * 10.0/1000.0; + event = TRUE; + } + + if (event != lastThrust) + { + if (event) + { + input &= ~KEY_STOP; +#ifdef USE_DSOUND + if(bWantSound) + { + SndObjStop(hsoSkidToStop); + SndObjPlay(hsoEngineRev, DSBPLAY_LOOPING); + } +#endif + bPlayRev = TRUE; + } + else + { +#ifdef USE_DSOUND + if(bWantSound) + { + SndObjStop(hsoEngineRev); + } +#endif + bPlayRev = FALSE; + } + + lastThrust = event; + } + + if( input & KEY_STOP ) + { +#ifdef USE_DSOUND + if(bWantSound) + { + if (DL.velx || DL.vely) + playPanned(hsoSkidToStop, &DL); + } +#endif + + DL.velx = 0; + DL.vely = 0; + } + + this = DL.next; + do + { + this->posx += this->velx * (double)tickDiff; + this->posy += this->vely * (double)tickDiff; + this->frame += this->delay * (double)tickDiff; + switch( this->type ) + { + case OBJ_DONUT: + maxx = (double)MAX_DONUT_X; + maxy = (double)MAX_DONUT_Y; + maxframe = (double)MAX_DONUT_FRAME; + break; + case OBJ_PYRAMID: + maxx = (double)MAX_PYRAMID_X; + maxy = (double)MAX_PYRAMID_Y; + maxframe = (double)MAX_PYRAMID_FRAME; + break; + case OBJ_SPHERE: + maxx = (double)MAX_SPHERE_X; + maxy = (double)MAX_SPHERE_Y; + maxframe = (double)MAX_SPHERE_FRAME; + break; + case OBJ_CUBE: + maxx = (double)MAX_CUBE_X; + maxy = (double)MAX_CUBE_Y; + maxframe = (double)MAX_CUBE_FRAME; + break; + case OBJ_BULLET: + maxx = (double)MAX_BULLET_X; + maxy = (double)MAX_BULLET_Y; + maxframe = (double)MAX_BULLET_FRAME; + if( this->frame >= (double)MAX_BULLET_FRAME ) + { + save = this; + this = this->next; + DeleteFromList( save ); + continue; + } + break; + } + if( this != &DL ) + { + if( this->posx > maxx ) + { + this->posx = maxx; + this->velx = -this->velx; + } + else if ( this->posx < 0 ) + { + this->posx =0; + this->velx = -this->velx; + } + if( this->posy > maxy ) + { + this->posy = maxy; + this->vely = -this->vely; + } + else if ( this->posy < 0 ) + { + this->posy =0; + this->vely = -this->vely; + } + if( this->frame >= maxframe ) + { + this->frame -= maxframe; + } + this = this->next; + } + } + while( this != &DL ); +} + +BOOL isDisplayListEmpty( void ) +{ + LPDBLNODE ptr; + + for(ptr=DL.next; ptr != &DL; ptr = ptr->next) + { + if(ptr->type != OBJ_BULLET) + return FALSE; + } + return TRUE; +} + +void initShip( BOOL delay ) +{ + DL.posx = (double)(ScreenX/2-16); // center the ship + DL.posy = (double)(ScreenY/2-16); + DL.frame = 0.0; + if( bTest ) + { + DL.velx = 0.25; + DL.vely = 0.5; + } + else + { + DL.velx = DL.vely = 0.0; // not moving + } + if( !bTest && delay ) + showDelay = DEF_SHOW_DELAY; +} + +void initLevel( int level ) +{ + int i; + + // clear any stray bullets out of the display list + while( DL.next != &DL ) + { + DeleteFromList( DL.next ); + } + for(i=0; i<(2*level-1); i++) + { + addObject( OBJ_DONUT, -1.0, -1.0, -1.0, -1.0 ); + } + initShip(TRUE); +} + +void addObject( SHORT type, double x, double y, double vx, double vy ) +{ + LPDBLNODE new; + + new = (LPDBLNODE) LocalAlloc( LPTR, sizeof( DBLNODE ) ); + if( new == NULL) + return; + + new->type = type; + switch( type ) + { + case OBJ_DONUT: + if( x < 0.0) // no position specified? + { + new->posx = randDouble( 0.0, (double)MAX_DONUT_X ); + new->posy = randDouble( 0.0, (double)MAX_DONUT_Y ); + } + else + { + new->posx = x; + new->posy = y; + } + new->velx = randDouble( -50.0/1000.0, 50.0/1000.0 ); + new->vely = randDouble( -50.0/1000.0, 50.0/1000.0 ); + new->frame = randDouble( 0, 30 ); + new->delay = 30.0*randDouble( 0.1, 0.4 )/1000.0; + new->surf = lpDonut; + linkObject( new ); + break; + case OBJ_PYRAMID: + if( x < 0) // no position specified? + { + new->posx = randDouble( 0.0, (double)MAX_PYRAMID_X ); + new->posy = randDouble( 0.0, (double)MAX_PYRAMID_Y ); + } + else + { + new->posx = x; + new->posy = y; + } + new->velx = 1.5*randDouble( -50.0/1000.0, 50.0/1000.0 ); + new->vely = 1.5*randDouble( -50.0/1000.0, 50.0/1000.0 ); + new->frame = randDouble( 0, 30 ); + new->delay = 40.0*randDouble( 0.3, 1.0 )/1000.0; + new->surf = lpPyramid; + linkObject( new ); + break; + case OBJ_SPHERE: + if( x < 0) // no position specified? + { + new->posx = randDouble( 0.0, (double)MAX_SPHERE_X ); + new->posy = randDouble( 0.0, (double)MAX_SPHERE_Y ); + } + else + { + new->posx = x; + new->posy = y; + } + new->velx = 3.0*randDouble( -50.0/1000.0, 50.0/1000.0 ); + new->vely = 3.0*randDouble( -50.0/1000.0, 50.0/1000.0 ); + new->frame = randDouble( 0, 30 ); + new->delay = 40.0*randDouble( 1.5, 2.0 )/1000.0; + new->surf = lpSphere; + linkObject( new ); + break; + case OBJ_CUBE: + if( x < 0) // no position specified? + { + new->posx = randDouble( 0.0, (double)MAX_CUBE_X ); + new->posy = randDouble( 0.0, (double)MAX_CUBE_Y ); + } + else + { + new->posx = x; + new->posy = y; + } + new->velx = 4.0*randDouble( -50.0/1000.0, 50.0/1000.0 ); + new->vely = 4.0*randDouble( -50.0/1000.0, 50.0/1000.0 ); + new->frame = randDouble( 0, 30 ); + new->delay = 40.0*randDouble( 0.8, 2.0 )/1000.0; + new->surf = lpCube; + linkObject( new ); + break; + case OBJ_BULLET: + new->posx = x; + new->posy = y; + new->velx = vx; + new->vely = vy; + new->frame = 0.0; + new->delay = 1.0; + new->surf = lpNum; + linkObject( new ); + break; + } +} + +void linkObject( LPDBLNODE new ) +{ + new->next = DL.next; + new->prev = &DL; + DL.next->prev = new; + DL.next = new; +} + +void linkLastObject( LPDBLNODE new ) +{ + new->prev = DL.prev; + new->next = &DL; + DL.prev->next = new; + DL.prev = new; +} + + +BOOL RestoreSurfaces( void ) +{ + HRESULT ddrval; + HBITMAP hbm; + + ddrval = lpFrontBuffer->lpVtbl->Restore(lpFrontBuffer); + if( ddrval != DD_OK ) + return FALSE; + ddrval = lpDonut->lpVtbl->Restore(lpDonut); + if( ddrval != DD_OK ) + return FALSE; + ddrval = lpPyramid->lpVtbl->Restore(lpPyramid); + if( ddrval != DD_OK ) + return FALSE; + ddrval = lpCube->lpVtbl->Restore(lpCube); + if( ddrval != DD_OK ) + return FALSE; + ddrval = lpSphere->lpVtbl->Restore(lpSphere); + if( ddrval != DD_OK ) + return FALSE; + ddrval = lpShip->lpVtbl->Restore(lpShip); + if( ddrval != DD_OK ) + return FALSE; + ddrval = lpNum->lpVtbl->Restore(lpNum); + if( ddrval != DD_OK ) + return FALSE; + + // Create and set the palette for the splash bitmap + lpSplashPalette = DDLoadPalette( lpDD, "SPLASH" ); + if( NULL == lpSplashPalette ) + return CleanupAndExit("DDLoadPalette SPLASH"); + + // Create and set the palette for the art bitmap + lpArtPalette = DDLoadPalette( lpDD, "DONUTS8" ); + if( NULL == lpArtPalette ) + return CleanupAndExit("DDLoadPalette DONUTS"); + + // set the palette before loading the art + lpFrontBuffer->lpVtbl->SetPalette( lpFrontBuffer, lpArtPalette ); + + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), "DONUTS8", IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION ); + + if( NULL == hbm ) + return FALSE; + + ddrval = DDCopyBitmap( lpDonut, hbm, 0, 0, 320, 384 ); + if( ddrval != DD_OK ) + { + DeleteObject( hbm ); + return FALSE; + } + + // NOTE: Why are we calling LoadImage again? StretchBlt (which is + // called in DDCopyBitmap) does not work properly when performing + // an 8-bpp to 24- or 32-bpp blt multiple times from the same + // bitmap. The workaround is to call LoadImage before each + // StretchBlt because the first StretchBlt after a LoadImage will + // work. + if(ScreenBpp >= 24) + { + DeleteObject( hbm ); + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), "DONUTS8", IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION ); + + if( NULL == hbm ) + return FALSE; + } + + ddrval = DDCopyBitmap( lpPyramid, hbm, 0, 384, 320, 128 ); + if( ddrval != DD_OK ) + { + DeleteObject( hbm ); + return FALSE; + } + + if(ScreenBpp >= 24) + { + DeleteObject( hbm ); + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), "DONUTS8", IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION ); + + if( NULL == hbm ) + return FALSE; + } + + ddrval = DDCopyBitmap( lpSphere, hbm, 0, 512, 320, 32 ); + if( ddrval != DD_OK ) + { + DeleteObject( hbm ); + return FALSE; + } + + if(ScreenBpp >= 24) + { + DeleteObject( hbm ); + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), "DONUTS8", IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION ); + + if( NULL == hbm ) + return FALSE; + } + + ddrval = DDCopyBitmap( lpCube, hbm, 0, 544, 320, 32 ); + if( ddrval != DD_OK ) + { + DeleteObject( hbm ); + return FALSE; + } + + if(ScreenBpp >= 24) + { + DeleteObject( hbm ); + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), "DONUTS8", IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION ); + + if( NULL == hbm ) + return FALSE; + } + + ddrval = DDCopyBitmap( lpShip, hbm, 0, 576, 320, 256 ); + if( ddrval != DD_OK ) + { + DeleteObject( hbm ); + return FALSE; + } + + if(ScreenBpp >= 24) + { + DeleteObject( hbm ); + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), "DONUTS8", IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION ); + + if( NULL == hbm ) + return FALSE; + } + + ddrval = DDCopyBitmap( lpNum, hbm, 0, 832, 320, 16 ); + if( ddrval != DD_OK ) + { + DeleteObject( hbm ); + return FALSE; + } + + DeleteObject( hbm ); + + // set colorfill colors and color keys according to bitmap contents + dwFillColor = DDColorMatch( lpDonut, CLR_INVALID ); + + DDSetColorKey( lpDonut, CLR_INVALID ); + DDSetColorKey( lpPyramid, CLR_INVALID ); + DDSetColorKey( lpCube, CLR_INVALID ); + DDSetColorKey( lpSphere, CLR_INVALID ); + DDSetColorKey( lpShip, CLR_INVALID ); + DDSetColorKey( lpNum, CLR_INVALID ); + + return TRUE; +} + + +int randInt( int low, int high ) +{ + int range = high - low; + int num = rand() % range; + return( num + low ); +} + +double randDouble( double low, double high ) +{ + double range = high - low; + double num = range * (double)rand()/(double)RAND_MAX; + return( num + low ); +} + +#ifdef USE_DSOUND +void InitializeSound( void ) +{ + if(!bWantSound) + return; // out of here + bSoundEnabled = FALSE; + if (SUCCEEDED(DirectSoundCreate(NULL, &lpDS, NULL))) + { + if (SUCCEEDED(lpDS->lpVtbl->SetCooperativeLevel(lpDS, hWndMain, + DSSCL_NORMAL))) + { + hsoBeginLevel = SndObjCreate(lpDS, "BeginLevel", 1); + hsoEngineIdle = SndObjCreate(lpDS, "EngineIdle", 1); + hsoEngineRev = SndObjCreate(lpDS, "EngineRev", 1); + hsoSkidToStop = SndObjCreate(lpDS, "SkidToStop", 1); + hsoShieldBuzz = SndObjCreate(lpDS, "ShieldBuzz", 1); + hsoShipExplode = SndObjCreate(lpDS, "ShipExplode", 1); + hsoFireBullet = SndObjCreate(lpDS, "Gunfire", 25); + hsoShipBounce = SndObjCreate(lpDS, "ShipBounce", 4); + hsoDonutExplode = SndObjCreate(lpDS, "DonutExplode", 10); + hsoPyramidExplode = SndObjCreate(lpDS, "PyramidExplode", 12); + hsoCubeExplode = SndObjCreate(lpDS, "CubeExplode", 15); + hsoSphereExplode = SndObjCreate(lpDS, "SphereExplode", 10); + bSoundEnabled = TRUE; + +//#ifdef USE_DSOUND this should be dead code Josephc + if( bPlayIdle ) + SndObjPlay(hsoEngineIdle, DSBPLAY_LOOPING); + + if( bPlayBuzz ) + SndObjPlay(hsoShieldBuzz, DSBPLAY_LOOPING); + + if( bPlayRev ) + SndObjPlay(hsoEngineRev, DSBPLAY_LOOPING); +//#endif + } + else + { + lpDS->lpVtbl->Release(lpDS); + lpDS = NULL; + } + } +} + +void DestroySound( void ) +{ + if(!bWantSound) + return; //No work to be done + bSoundEnabled = FALSE; + if (lpDS) + { + SndObjDestroy(hsoBeginLevel); + hsoBeginLevel = NULL; + SndObjDestroy(hsoEngineIdle); + hsoEngineIdle = NULL; + SndObjDestroy(hsoEngineRev); + hsoEngineRev = NULL; + SndObjDestroy(hsoSkidToStop); + hsoSkidToStop = NULL; + SndObjDestroy(hsoShieldBuzz); + hsoShieldBuzz = NULL; + SndObjDestroy(hsoShipExplode); + hsoShipExplode = NULL; + SndObjDestroy(hsoFireBullet); + hsoFireBullet = NULL; + SndObjDestroy(hsoShipBounce); + hsoShipBounce = NULL; + SndObjDestroy(hsoDonutExplode); + hsoDonutExplode = NULL; + SndObjDestroy(hsoPyramidExplode); + hsoPyramidExplode = NULL; + SndObjDestroy(hsoCubeExplode); + hsoCubeExplode = NULL; + SndObjDestroy(hsoSphereExplode); + hsoSphereExplode = NULL; + + lpDS->lpVtbl->Release(lpDS); + lpDS = NULL; + } +} +#endif + +int getint(char**p, int def) +{ + int i=0; + + + while (IS_SPACE(**p)) + (*p)++; + + if (!IS_NUM(**p)) + return def; + + while (IS_NUM(**p)) + i = i*10 + *(*p)++ - '0'; + + while (IS_SPACE(**p)) + (*p)++; + + return i; +} + diff --git a/sdk/samples/donuts/donuts.h b/sdk/samples/donuts/donuts.h new file mode 100644 index 0000000..351155f --- /dev/null +++ b/sdk/samples/donuts/donuts.h @@ -0,0 +1,238 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: donuts.h + * Content: main include file + * + * + ***************************************************************************/ + +#ifndef DONUTS_INCLUDED +#define DONUTS_INCLUDED + +#undef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <ddraw.h> +#ifdef USE_DSOUND +#include <dsound.h> +#endif +#include <stdio.h> +#include <stdlib.h> +#include <io.h> +#include "resource.h" +#include "ddutil.h" +#ifdef USE_DSOUND +#include "dsutil.h" +#endif + +#define DEF_SHOW_DELAY (2000) + +#define IS_NUM(c) ((c) >= '0' && (c) <= '9') +#define IS_SPACE(c) ((c) == ' ' || (c) == '\r' || (c) == '\n' || (c) == '\t' || (c) == 'x') + + +/* + * keyboard commands + */ + +#define KEY_STOP 0x00000001l +#define KEY_DOWN 0x00000002l +#define KEY_LEFT 0x00000004l +#define KEY_RIGHT 0x00000008l +#define KEY_UP 0x00000010l +#define KEY_FIRE 0x00000020l +#define KEY_THROW 0x00000040l +#define KEY_SHIELD 0x00000080l + +enum +{ + OBJ_DONUT = 0, + OBJ_PYRAMID, + OBJ_CUBE, + OBJ_SPHERE, + OBJ_SHIP, + OBJ_BULLET +}; + + +// program states +enum +{ + PS_SPLASH, + PS_ACTIVE, + PS_BEGINREST, + PS_REST +}; + +#define MAX_SCREEN_X (ScreenX-1) +#define MAX_SCREEN_Y (ScreenY-1) +#define MAX_DONUT_X MAX_SCREEN_X - 64 +#define MAX_DONUT_Y MAX_SCREEN_Y - 64 +#define MAX_DONUT_FRAME 30 +#define MAX_PYRAMID_X MAX_SCREEN_X - 32 +#define MAX_PYRAMID_Y MAX_SCREEN_Y - 32 +#define MAX_PYRAMID_FRAME 40 +#define MAX_SPHERE_X MAX_SCREEN_X - 16 +#define MAX_SPHERE_Y MAX_SCREEN_Y - 16 +#define MAX_SPHERE_FRAME 40 +#define MAX_CUBE_X MAX_SCREEN_X - 16 +#define MAX_CUBE_Y MAX_SCREEN_Y - 16 +#define MAX_CUBE_FRAME 40 +#define MAX_SHIP_X MAX_SCREEN_X - 32 +#define MAX_SHIP_Y MAX_SCREEN_Y - 32 +#define MAX_SHIP_FRAME 40 +#define MAX_BULLET_X MAX_SCREEN_X - 3; +#define MAX_BULLET_Y MAX_SCREEN_Y - 3; +#define MAX_BULLET_FRAME 400 + + +// Offsets for the bullet bitmap +#define BULLET_X 304 +#define BULLET_Y 0 + + +/* + * structures + */ + +/* + * DBLNODE - a node in a generic doubly-linked list + */ +typedef struct _DBLNODE +{ + struct _DBLNODE FAR *next; // link to next node + struct _DBLNODE FAR *prev; // link to previous node + SHORT type; // type of object + double posx, posy; // actual x and y position + double velx, vely; // x and y velocity (pixels/millisecond) + double frame; // current frame + double delay; // frame/millisecond + RECT src, dst; // source and destination rects + LPDIRECTDRAWSURFACE surf; // surface containing bitmap +} DBLNODE; +typedef DBLNODE FAR *LPDBLNODE; + +double Dirx[40] = +{ + 0.000000, + 0.156434, + 0.309017, + 0.453991, + 0.587785, + 0.707107, + 0.809017, + 0.891007, + 0.951057, + 0.987688, + 1.000000, + 0.987688, + 0.951057, + 0.891007, + 0.809017, + 0.707107, + 0.587785, + 0.453990, + 0.309017, + 0.156434, + 0.000000, + -0.156435, + -0.309017, + -0.453991, + -0.587785, + -0.707107, + -0.809017, + -0.891007, + -0.951057, + -0.987688, + -1.000000, + -0.987688, + -0.951056, + -0.891006, + -0.809017, + -0.707107, + -0.587785, + -0.453990, + -0.309017, + -0.156434 +}; + +double Diry[40] = +{ + -1.000000, + -0.987688, + -0.951057, + -0.891007, + -0.809017, + -0.707107, + -0.587785, + -0.453990, + -0.309017, + -0.156434, + 0.000000, + 0.156434, + 0.309017, + 0.453991, + 0.587785, + 0.707107, + 0.809017, + 0.891007, + 0.951057, + 0.987688, + 1.000000, + 0.987688, + 0.951057, + 0.891006, + 0.809017, + 0.707107, + 0.587785, + 0.453990, + 0.309017, + 0.156434, + 0.000000, + -0.156435, + -0.309017, + -0.453991, + -0.587785, + -0.707107, + -0.809017, + -0.891007, + -0.951057, + -0.987688 +}; + + +/* + * fn prototypes + */ +void DestroyGame( void ); +BOOL InitializeGame( void ); +void makeFontStuff( void ); +void UpdateFrame( void ); +BOOL CleanupAndExit( char *err ); +BOOL RestoreSurfaces( void ); +BOOL isDisplayListEmpty( void ); +void initShip( BOOL delay ); +void initLevel( int level ); +void addObject( SHORT type, double x, double y, double vx, double vy ); +void linkObject( LPDBLNODE new ); +void linkLastObject( LPDBLNODE new ); +void UpdateDisplayList( void ); +void DrawDisplayList( void ); +int randInt( int low, int high ); +double randDouble( double low, double high ); +void DeleteFromList( LPDBLNODE this ); +void CheckForHits( void ); +void bltScore( char *num, int x, int y ); +void DisplayFrameRate( void ); +void bltSplash( void ); +void EraseScreen( void ); +void FlipScreen( void ); +void DisplayLevel( void ); +void InitializeSound( void ); +void DestroySound( void ); + +#endif diff --git a/sdk/samples/donuts/donuts.ico b/sdk/samples/donuts/donuts.ico new file mode 100644 index 0000000..35cb7b8 Binary files /dev/null and b/sdk/samples/donuts/donuts.ico differ diff --git a/sdk/samples/donuts/donuts.rc b/sdk/samples/donuts/donuts.rc new file mode 100644 index 0000000..172295b --- /dev/null +++ b/sdk/samples/donuts/donuts.rc @@ -0,0 +1,20 @@ +DONUTS_ICON ICON donuts.ico + +DONUTS8 BITMAP donuts.bmp +SPLASH BITMAP SPLASH.BMP + +BeginLevel WAV level.wav + +EngineIdle WAV hum.wav +EngineRev WAV rev.wav +SkidToStop WAV skid.wav +ShieldBuzz WAV shield.wav + +Gunfire WAV gunfire.wav +ShipBounce WAV bounce.wav +ShipExplode WAV bangbang.wav + +DonutExplode WAV d_bang.wav +PyramidExplode WAV p_bang.wav +CubeExplode WAV c_bang.wav +SphereExplode WAV s_bang.wav diff --git a/sdk/samples/donuts/gunfire.wav b/sdk/samples/donuts/gunfire.wav new file mode 100644 index 0000000..44b37b1 Binary files /dev/null and b/sdk/samples/donuts/gunfire.wav differ diff --git a/sdk/samples/donuts/hum.wav b/sdk/samples/donuts/hum.wav new file mode 100644 index 0000000..dae8d35 Binary files /dev/null and b/sdk/samples/donuts/hum.wav differ diff --git a/sdk/samples/donuts/level.wav b/sdk/samples/donuts/level.wav new file mode 100644 index 0000000..f2b171c Binary files /dev/null and b/sdk/samples/donuts/level.wav differ diff --git a/sdk/samples/donuts/makefile b/sdk/samples/donuts/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/donuts/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/donuts/msvc.mk b/sdk/samples/donuts/msvc.mk new file mode 100644 index 0000000..5b4b8a0 --- /dev/null +++ b/sdk/samples/donuts/msvc.mk @@ -0,0 +1,40 @@ +NAME = donuts +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib dsound.lib + +OBJS = donuts.obj dsutil.obj ddutil.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/donuts/p_bang.wav b/sdk/samples/donuts/p_bang.wav new file mode 100644 index 0000000..46fbc71 Binary files /dev/null and b/sdk/samples/donuts/p_bang.wav differ diff --git a/sdk/samples/donuts/readme.txt b/sdk/samples/donuts/readme.txt new file mode 100644 index 0000000..8766b50 --- /dev/null +++ b/sdk/samples/donuts/readme.txt @@ -0,0 +1,54 @@ +Space Donuts Sample Game +------------------ + +This game demonstrates many of the features of DirectDraw. It will take +advantage of hardware acceleration if it is supported by the driver. + +Roids defaults to 640x480 at 256 colors. You may specify a different +resolution and pixel depth on the command line (roids 800x600x16). + +This program requires less than 1 Meg of video ram. However, all of its +art may not fit in the vram on a 1 Meg rectangular memory card. + +The commands which this game recognizes are listed on the opening screen. + + ESC, F12 - Quit + NUMPAD 4 - Turn left + NUMPAD 6 - Turn right + NUMPAD 5 - Stop moving + NUMPAD 8 - Accelerate forward + NUMPAD 2 - Accelerate backward + SPACEBAR - Fire + NUMPAD 7 - Shield + ENTER - Starts game + F5 - toggle frame rate display + F3 - toggle audio + F1 - toggle cheesy trails effect + +Command line switches: + + -e - Use emulation, not hardware acceleration + -t - Test mode. Runs game for you. + -x - Stress mode. Never halt if you can help it. + -S - turn off sound + + These switches may be followed by three option numbers representing: + X resolution + Y resolution + Bits per pixel + + + +Sound code +---------- + +The sound code in this application is deliberately designed +to be stressful. For example, each bullet on the screen uses a different +sound buffer. Over 70 sound buffers are created (including duplicates) +and 20-25 may be playing at any time. This could be made much more +efficient, but we wanted code to stress our API and mixer. + +The sounds are implemented using the helper functions in dsutil.h and +dsutil.c (found in the sdk\samples\misc directory). These helper +functions may help you to add sound to your application quickly and +easily. diff --git a/sdk/samples/donuts/resource.h b/sdk/samples/donuts/resource.h new file mode 100644 index 0000000..5d93f5b --- /dev/null +++ b/sdk/samples/donuts/resource.h @@ -0,0 +1 @@ +#define DONUTS_ICON 101 diff --git a/sdk/samples/donuts/rev.wav b/sdk/samples/donuts/rev.wav new file mode 100644 index 0000000..6b81b2a Binary files /dev/null and b/sdk/samples/donuts/rev.wav differ diff --git a/sdk/samples/donuts/s_bang.wav b/sdk/samples/donuts/s_bang.wav new file mode 100644 index 0000000..ed1efb1 Binary files /dev/null and b/sdk/samples/donuts/s_bang.wav differ diff --git a/sdk/samples/donuts/shield.wav b/sdk/samples/donuts/shield.wav new file mode 100644 index 0000000..25eb74f Binary files /dev/null and b/sdk/samples/donuts/shield.wav differ diff --git a/sdk/samples/donuts/skid.wav b/sdk/samples/donuts/skid.wav new file mode 100644 index 0000000..de0ea3d Binary files /dev/null and b/sdk/samples/donuts/skid.wav differ diff --git a/sdk/samples/donuts/splash.bmp b/sdk/samples/donuts/splash.bmp new file mode 100644 index 0000000..355cd5e Binary files /dev/null and b/sdk/samples/donuts/splash.bmp differ diff --git a/sdk/samples/dplaunch/dplaunch.c b/sdk/samples/dplaunch/dplaunch.c new file mode 100644 index 0000000..f1c3c45 --- /dev/null +++ b/sdk/samples/dplaunch/dplaunch.c @@ -0,0 +1,582 @@ +/*========================================================================== + * + * Copyright (C) 1996 Microsoft Corporation. All Rights Reserved. + * + * File: dplaunch.c + * Content: Implementation of a DirectPlay launching utility + * + ***************************************************************************/ + +#define INITGUID +#define WIN32_LEAN_AND_MEAN + +#include <windows.h> +#include <windowsx.h> +#include <objbase.h> +#include <cguid.h> + +#include "dplay.h" +#include "dplobby.h" + +#include "resource.h" + +// maximum size of a string name +#define NAMEMAX 200 + +// service provider information +typedef struct { + GUID guidServiceProvider; // guid of service provider + GUID guidAddressType; // address type required by service provider +} SPINFO, *LPSPINFO; + +typedef struct { + HWND hWnd; + LPDIRECTPLAYLOBBYA lpDPLobbyA; +} ENUMINFO, *LPENUMINFO; + +// GUID for sessions this application creates +// {D559FC00-DC12-11cf-9C4E-00A0C905425E} +DEFINE_GUID(MY_SESSION_GUID, +0xd559fc00, 0xdc12, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +// prototypes +BOOL CALLBACK LauncherWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +HRESULT InitializeLauncherWindow(HWND hWnd, LPDIRECTPLAYLOBBYA *lplpDPlayLobby); +void DestroyLauncherWindow(HWND hWnd, LPDIRECTPLAYLOBBYA lpDPlayLobby); +void LaunchDirectPlayApplication(HWND hWnd, LPDIRECTPLAYLOBBYA lpDPlayLobby); + + +// --------------------------------------------------------------------------- +// WinMain +// --------------------------------------------------------------------------- +// Description: Main windows entry point. +// Arguments: +// HINSTANCE [in] Standard windows stuff +// HINSTANCE [in] +// LPSTR [in] +// int [in] +// Returns: +// int +int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow ) +{ + return DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_LAUNCHERDIALOG), NULL, LauncherWndProc, (LPARAM) hInstance); +} + + +// --------------------------------------------------------------------------- +// LauncherWndProc +// --------------------------------------------------------------------------- +// Description: Message callback function for Launcher dialog. +// Arguments: +// HWND [in] Dialog window handle. +// UINT [in] Window message identifier. +// WPARAM [in] Depends on message. +// LPARAM [in] Depends on message. +// Returns: +// BOOL TRUE if message was processed internally. +BOOL CALLBACK LauncherWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + static HINSTANCE hInst; + static LPDIRECTPLAYLOBBYA lpDPlayLobby; + HRESULT hr; + + switch(uMsg) + { + case WM_INITDIALOG: + // Save the instance handle + hInst = (HINSTANCE)lParam; + + // Initialize dialog with launcher information + lpDPlayLobby = NULL; + hr = InitializeLauncherWindow(hWnd, &lpDPlayLobby); + break; + + case WM_DESTROY: + // Destroy launcher information in dialog + DestroyLauncherWindow(hWnd, lpDPlayLobby); + + // Return failure + EndDialog(hWnd, FALSE); + + break; + + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case IDC_RUNAPPBUTTON: + // get settings and launch application + LaunchDirectPlayApplication(hWnd, lpDPlayLobby); + + break; + + case IDCANCEL: + // Return failure + EndDialog(hWnd, TRUE); + + break; + } + + break; + } + + // Allow for default processing + return FALSE; +} + +// --------------------------------------------------------------------------- +// EnumApp +// --------------------------------------------------------------------------- +// Description: Enumeration callback called by DirectPlay. +// Enumerates the applications registered with DirectPlay. +// Arguments: +// LPDPLAPPINFO [in] information about the application +// LPVOID [in] user-defined context +// DWORD [in] flags +// Returns: +// BOOL TRUE to continue enumerating +BOOL FAR PASCAL EnumApp(LPCDPLAPPINFO lpAppInfo, LPVOID lpContext, DWORD dwFlags) +{ + HWND hWnd = lpContext; + LRESULT iIndex; + LPGUID lpGuid; + + // store application name in combo box + iIndex = SendDlgItemMessage(hWnd, IDC_APPCOMBO, CB_ADDSTRING, 0, (LPARAM) lpAppInfo->lpszAppNameA); + if (iIndex == LB_ERR) + goto Failure; + + // make space for application GUID + lpGuid = (LPGUID) GlobalAllocPtr(GHND, sizeof(GUID)); + if (lpGuid == NULL) + goto Failure; + + // store pointer to GUID in combo box + *lpGuid = lpAppInfo->guidApplication; + SendDlgItemMessage(hWnd, IDC_APPCOMBO, CB_SETITEMDATA, (WPARAM) iIndex, (LPARAM) lpGuid); + +Failure: + return (TRUE); +} + +// --------------------------------------------------------------------------- +// EnumAddressType +// --------------------------------------------------------------------------- +// Description: Enumeration callback called by DirectPlayLobby. +// Enumerates the address types supported by the +// given Service Provider. +// Arguments: +// REFGUID [in] GUID of the address type +// LPVOID [in] user-defined context +// DWORD [in] flags +// Returns: +// BOOL FALSE to stop enumerating after the first callback +BOOL FAR PASCAL EnumAddressType(REFGUID guidAddressType, LPVOID lpContext, + DWORD dwFlags) +{ + LPGUID lpguidAddr = (LPGUID)lpContext; + + + // Save the address type guid in the pointer + *lpguidAddr = *guidAddressType; + + // Note: It is possible that some Service Providers will contain more + // than one address type. We are only using the first address type + // returned in this sample. A good application should save all + // address types. + return FALSE; +} + + +// --------------------------------------------------------------------------- +// EnumSP +// --------------------------------------------------------------------------- +// Description: Enumeration callback called by DirectPlay. +// Enumerates service providers registered with DirectPlay. +// Arguments: +// LPGUID [in] GUID of service provider +// LPTSTR [in] name of service provider +// DWORD [in] major version of DirectPlay +// DWORD [in] minor version of DirectPlay +// LPVOID [in] user-defined context +// Returns: +// BOOL TRUE to continue enumerating +BOOL FAR PASCAL EnumSP(LPGUID lpGuid, LPTSTR lptszDesc, DWORD dwMajorVersion, + DWORD dwMinorVersion, LPVOID lpContext) +{ + LPENUMINFO lpEnumInfo = (LPENUMINFO)lpContext; + LPDIRECTPLAYLOBBYA lpDPLobbyA = lpEnumInfo->lpDPLobbyA; + HWND hWnd = lpEnumInfo->hWnd; + HRESULT hr; + LRESULT iIndex; + LPSPINFO lpSPInfo; + + // store service provider name in combo box + iIndex = SendDlgItemMessage(hWnd, IDC_SPCOMBO, CB_ADDSTRING, 0, (LPARAM) lptszDesc); + if (iIndex == LB_ERR) + goto Failure; + + // make space for service provider info + lpSPInfo = (LPSPINFO) GlobalAllocPtr(GHND, sizeof(SPINFO)); + if (lpSPInfo == NULL) + goto Failure; + + // Initialize the guid to GUID_NULL in case it has no address types + memset(lpSPInfo, 0, sizeof(SPINFO)); + + // store service provider GUID and address type in combo box + lpSPInfo->guidServiceProvider = *lpGuid; + + // Get the address type for the Service Provider + hr = lpDPLobbyA->lpVtbl->EnumAddressTypes(lpDPLobbyA, + (LPDPLENUMADDRESSTYPESCALLBACK)EnumAddressType, + lpGuid, &lpSPInfo->guidAddressType, 0L); + + SendDlgItemMessage(hWnd, IDC_SPCOMBO, CB_SETITEMDATA, (WPARAM) iIndex, (LPARAM) lpSPInfo); + +Failure: + return (TRUE); +} + +// --------------------------------------------------------------------------- +// InitializeLauncherWindow +// --------------------------------------------------------------------------- +// Description: Initializes the window for the Launcher. +// Arguments: +// HWND [in] Window handle. +// LPDIRECTPLAYLOBBYA [out] IDirectPlayLobby interface. +// Returns: +// HRESULT any errors initializing the window +HRESULT InitializeLauncherWindow(HWND hWnd, LPDIRECTPLAYLOBBYA *lplpDPlayLobby) +{ + LPDIRECTPLAYLOBBYA lpDPlayLobbyA = NULL; + ENUMINFO EnumInfo; + HRESULT hr; + + // get a ANSI DirectPlay lobby interface + hr = DirectPlayLobbyCreate(NULL, &lpDPlayLobbyA, NULL, NULL, 0); + if FAILED(hr) + goto Failure; + + // put all the DirectPlay applications in a combo box + lpDPlayLobbyA->lpVtbl->EnumLocalApplications(lpDPlayLobbyA, EnumApp, hWnd, 0); + + // setup the EnumInfo structure + EnumInfo.hWnd = hWnd; + EnumInfo.lpDPLobbyA = lpDPlayLobbyA; + + // put all the service providers in a combo box + DirectPlayEnumerate(EnumSP, &EnumInfo); + + // initialize the controls + SendDlgItemMessage(hWnd, IDC_APPCOMBO, CB_SETCURSEL, (WPARAM) 0, 0); + SendDlgItemMessage(hWnd, IDC_SPCOMBO, CB_SETCURSEL, (WPARAM) 0, 0); + SendDlgItemMessage(hWnd, IDC_HOSTRADIO, BM_SETCHECK, (WPARAM) BST_CHECKED, 0); + + // return the ANSI lobby interface + *lplpDPlayLobby = lpDPlayLobbyA; + + return (DP_OK); + +Failure: + + return (hr); +} + +// --------------------------------------------------------------------------- +// DestroyLauncherWindow +// --------------------------------------------------------------------------- +// Description: Destroys the launcher window. +// Arguments: +// HWND [in] Window handle. +// LPDIRECTPLAYLOBBYA [in] DirectPlay Lobby interface to destroy +// Returns: +// Nothing +void DestroyLauncherWindow(HWND hWnd, LPDIRECTPLAYLOBBYA lpDPlayLobby) +{ + WPARAM index; + LRESULT lpData; + + // destroy the GUID's stored with each app name + index = 0; + while (TRUE) + { + lpData = SendDlgItemMessage(hWnd, IDC_APPCOMBO, CB_GETITEMDATA, (WPARAM) index, 0); + if ((lpData == CB_ERR) || (lpData == 0)) + break; + + GlobalFreePtr((LPVOID) lpData); + index += 1; + } + + // destroy the GUID's stored with each service provider name + index = 0; + while (TRUE) + { + lpData = SendDlgItemMessage(hWnd, IDC_SPCOMBO, CB_GETITEMDATA, (WPARAM) index, 0); + if ((lpData == CB_ERR) || (lpData == 0)) + break; + + GlobalFreePtr((LPVOID) lpData); + index += 1; + } + + // release the lobby interface + if (lpDPlayLobby) + lpDPlayLobby->lpVtbl->Release(lpDPlayLobby); +} + +// --------------------------------------------------------------------------- +// CreateAddress +// --------------------------------------------------------------------------- +// Description: Wrapper for the IDirectPlayLobby::CreateAddress() method. +// Arguments: +// LPDIRECTPLAYLOBBYA [in] DirectPlay Lobby interface to use +// LPGUID [in] GUID of servicer provider to create address for +// LPGUID [in] GUID of address data type +// LPSTR [in] string to use as address data +// LPVOID* [out] pointer to return address in +// LPDWORD [out] pointer to return address size in +// Returns: +// HRESULT any error creating the address +HRESULT CreateAddress(LPDIRECTPLAYLOBBYA lpDPlayLobby, + LPGUID lpguidServiceProvider, + LPGUID lpguidAddressType, LPSTR lpszAddressText, + LPVOID *lplpAddress, LPDWORD lpdwAddressSize) +{ + LPVOID lpAddress = NULL; + DWORD dwAddressSize = 0; + HRESULT hr; + + // check for invalid address types + if (IsEqualGUID(lpguidAddressType, &GUID_NULL)) + return (DPERR_INVALIDPARAM); + + // see how much room is needed to store this address + hr = lpDPlayLobby->lpVtbl->CreateAddress(lpDPlayLobby, lpguidServiceProvider, + lpguidAddressType, lpszAddressText, strlen(lpszAddressText) + 1, + NULL, &dwAddressSize); + if (hr != DPERR_BUFFERTOOSMALL) + goto Failure; + + // allocate space + lpAddress = GlobalAllocPtr(GHND, dwAddressSize); + if (lpAddress == NULL) + { + hr = DPERR_NOMEMORY; + goto Failure; + } + + // create the address + hr = lpDPlayLobby->lpVtbl->CreateAddress(lpDPlayLobby, lpguidServiceProvider, + lpguidAddressType, lpszAddressText, strlen(lpszAddressText) + 1, + lpAddress, &dwAddressSize); + if FAILED(hr) + goto Failure; + + // return the address info + *lplpAddress = lpAddress; + *lpdwAddressSize = dwAddressSize; + + return (DP_OK); + +Failure: + if (lpAddress) + GlobalFreePtr(lpAddress); + + return (hr); +} + +// --------------------------------------------------------------------------- +// RunApplication +// --------------------------------------------------------------------------- +// Description: Wrapper for the IDirectPlayLobby::RunApplication() method. +// Arguments: +// LPDIRECTPLAYLOBBYA [in] DirectPlay Lobby interface to use +// LPGUID [in] GUID of application to launch +// LPGUID [in] GUID of session to host with +// LPSTR [in] GUID of service provider to connect with +// LPVOID [in] service-provider address to connect to +// DWORD [in] length of address +// LPSTR [in] name of session to host +// LPSTR [in] name of our player +// BOOL [in] TRUE to host session, FALSE to join +// Returns: +// HRESULT any error running the application +HRESULT RunApplication(LPDIRECTPLAYLOBBYA lpDPlayLobby, + LPGUID lpguidApplication, + LPGUID lpguidInstance, + LPGUID lpguidServiceProvider, + LPVOID lpAddress, + DWORD dwAddressSize, + LPSTR lpszSessionName, + LPSTR lpszPlayerName, + BOOL bHostSession) +{ + DWORD appID; + DPSESSIONDESC2 sessionInfo; + DPNAME playerName; + DPLCONNECTION connectInfo; + HRESULT hr; + + if (lpDPlayLobby == NULL) + return (DPERR_NOINTERFACE); + + // fill out session description + ZeroMemory(&sessionInfo, sizeof(DPSESSIONDESC2)); + sessionInfo.dwSize = sizeof(DPSESSIONDESC2); // Size of structure + sessionInfo.dwFlags = 0; // DPSESSION_xxx flags + sessionInfo.guidInstance = *lpguidInstance; // ID for the session instance + sessionInfo.guidApplication = *lpguidApplication;// GUID of the DirectPlay application. + sessionInfo.dwMaxPlayers = 0; // Maximum # players allowed in session + sessionInfo.dwCurrentPlayers = 0; // Current # players in session (read only) + sessionInfo.lpszSessionNameA = lpszSessionName; // ANSI name of the session + sessionInfo.lpszPasswordA = NULL; // ANSI password of the session (optional) + sessionInfo.dwReserved1 = 0; // Reserved for future MS use. + sessionInfo.dwReserved2 = 0; + sessionInfo.dwUser1 = 0; // For use by the application + sessionInfo.dwUser2 = 0; + sessionInfo.dwUser3 = 0; + sessionInfo.dwUser4 = 0; + + // fill out player name + ZeroMemory(&playerName, sizeof(DPNAME)); + playerName.dwSize = sizeof(DPNAME); // Size of structure + playerName.dwFlags = 0; // Not used. Must be zero. + playerName.lpszShortNameA = lpszPlayerName; // ANSI short or friendly name + playerName.lpszLongNameA = lpszPlayerName; // ANSI long or formal name + + // fill out connection description + ZeroMemory(&connectInfo, sizeof(DPLCONNECTION)); + connectInfo.dwSize = sizeof(DPLCONNECTION); // Size of this structure + if (bHostSession) + connectInfo.dwFlags = DPLCONNECTION_CREATESESSION; // Create a new session + else + connectInfo.dwFlags = DPLCONNECTION_JOINSESSION; // Join existing session + connectInfo.lpSessionDesc = &sessionInfo; // Pointer to session desc to use on connect + connectInfo.lpPlayerName = &playerName; // Pointer to Player name structure + connectInfo.guidSP = *lpguidServiceProvider; // GUID of the DPlay SP to use + connectInfo.lpAddress = lpAddress; // Address for service provider + connectInfo.dwAddressSize = dwAddressSize; // Size of address data + + // launch and connect the game + hr = lpDPlayLobby->lpVtbl->RunApplication(lpDPlayLobby, + 0, // Flags + &appID, // App ID + &connectInfo, // Connection data + NULL); // Connect event + return (hr); +} + +// --------------------------------------------------------------------------- +// LaunchDirectPlayApplication +// --------------------------------------------------------------------------- +// Description: Gathers information from the dialog and runs the application. +// Arguments: +// HWND [in] Window handle. +// LPDIRECTPLAYLOBBYA [in] DirectPlay Lobby interface to use +// Returns: +// Nothing +void LaunchDirectPlayApplication(HWND hWnd, LPDIRECTPLAYLOBBYA lpDPlayLobby) +{ + GUID guidApplication, guidSession, guidServiceProvider, guidAddressType; + LPSTR lpPlayerName, lpSessionName; + LPVOID lpAddress = NULL; + DWORD dwAddressSize; + LPSPINFO lpSPInfo; + char strPlayerName[NAMEMAX], strSessionName[NAMEMAX], strAddressText[NAMEMAX]; + LRESULT iApp, iSP, iHost; + HRESULT hr; + + SetDlgItemText(hWnd, IDC_STATUSEDIT, "Launching..."); + + // get guid of application to launch + iApp = SendDlgItemMessage(hWnd, IDC_APPCOMBO, CB_GETCURSEL, (WPARAM) 0, 0); + if (iApp == CB_ERR) + goto Failure; + + iApp = SendDlgItemMessage(hWnd, IDC_APPCOMBO, CB_GETITEMDATA, (WPARAM) iApp, 0); + if ((iApp == CB_ERR) || (iApp == 0)) + goto Failure; + + guidApplication = *((LPGUID) iApp); + + // get info for service provider to use for the connection + iSP = SendDlgItemMessage(hWnd, IDC_SPCOMBO, CB_GETCURSEL, (WPARAM) 0, 0); + if (iSP == CB_ERR) + goto Failure; + + iSP = SendDlgItemMessage(hWnd, IDC_SPCOMBO, CB_GETITEMDATA, (WPARAM) iSP, 0); + if ((iSP == CB_ERR) || (iSP == 0)) + goto Failure; + + lpSPInfo = (LPSPINFO) iSP; + guidServiceProvider = lpSPInfo->guidServiceProvider; // GUID of service provider + guidAddressType = lpSPInfo->guidAddressType; // address type required by service provider + + // get guid of session to create. + guidSession = MY_SESSION_GUID; + + // get name of our player + GetDlgItemText(hWnd, IDC_PLAYEREDIT, strPlayerName, NAMEMAX); + lpPlayerName = strPlayerName; + + // get host vs. join flag + iHost = SendDlgItemMessage(hWnd, IDC_HOSTRADIO, BM_GETCHECK, (WPARAM) 0, 0); + if (iHost == BST_CHECKED) + { + iHost = TRUE; // we are hosting a session + lpAddress = NULL; // don't need an address to host + dwAddressSize = 0; + + // get name of session + GetDlgItemText(hWnd, IDC_SESSIONEDIT, strSessionName, NAMEMAX); + lpSessionName = strSessionName; + } + else + { + iHost = FALSE; // we are joining an existing session + lpSessionName = NULL; // don't need a session name if we are joining + + lpAddress = NULL; // assume we don't need address data + dwAddressSize = 0; + + // the service provider supports address data + if (!IsEqualGUID(&guidAddressType, &GUID_NULL)) + { + // get service-provider specific address data as a string + GetDlgItemText(hWnd, IDC_ADDRESSEDIT, strAddressText, NAMEMAX); + + // convert string to a DirectPlay address + hr = CreateAddress(lpDPlayLobby, &guidServiceProvider, + &guidAddressType, strAddressText, + &lpAddress, &dwAddressSize); + } + } + + // launch the application + hr = RunApplication(lpDPlayLobby, + &guidApplication, + &guidSession, + &guidServiceProvider, + lpAddress, dwAddressSize, + lpSessionName, lpPlayerName, + iHost); + if FAILED(hr) + goto Failure; + + SetDlgItemText(hWnd, IDC_STATUSEDIT, "Launch successful"); + + if (lpAddress) + GlobalFreePtr(lpAddress); + return; + +Failure: + if (lpAddress) + GlobalFreePtr(lpAddress); + + SetDlgItemText(hWnd, IDC_STATUSEDIT, "Launch failed"); + + return; +} + diff --git a/sdk/samples/dplaunch/dplaunch.mak b/sdk/samples/dplaunch/dplaunch.mak new file mode 100644 index 0000000..053ff5f --- /dev/null +++ b/sdk/samples/dplaunch/dplaunch.mak @@ -0,0 +1,216 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=dplaunch - Win32 Debug +!MESSAGE No configuration specified. Defaulting to dplaunch - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "dplaunch - Win32 Release" && "$(CFG)" !=\ + "dplaunch - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "dplaunch.mak" CFG="dplaunch - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "dplaunch - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "dplaunch - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "dplaunch - Win32 Debug" +RSC=rc.exe +MTL=mktyplib.exe +CPP=cl.exe + +!IF "$(CFG)" == "dplaunch - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\dplaunch.exe" + +CLEAN : + -@erase "$(INTDIR)\dplaunch.obj" + -@erase "$(INTDIR)\dplaunch.res" + -@erase "$(OUTDIR)\dplaunch.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\ + /Fp"$(INTDIR)/dplaunch.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/dplaunch.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/dplaunch.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib uuid.lib dplayx.lib /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib uuid.lib dplayx.lib /nologo\ + /subsystem:windows /incremental:no /pdb:"$(OUTDIR)/dplaunch.pdb" /machine:I386\ + /out:"$(OUTDIR)/dplaunch.exe" +LINK32_OBJS= \ + "$(INTDIR)\dplaunch.obj" \ + "$(INTDIR)\dplaunch.res" + +"$(OUTDIR)\dplaunch.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "dplaunch - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "dplaunch" +# PROP BASE Intermediate_Dir "dplaunch" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\dplaunch.exe" + +CLEAN : + -@erase "$(INTDIR)\dplaunch.obj" + -@erase "$(INTDIR)\dplaunch.res" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(OUTDIR)\dplaunch.exe" + -@erase "$(OUTDIR)\dplaunch.ilk" + -@erase "$(OUTDIR)\dplaunch.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ + /Fp"$(INTDIR)/dplaunch.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/dplaunch.res" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/dplaunch.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib uuid.lib dplayx.lib /nologo /subsystem:windows /debug /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib uuid.lib dplayx.lib /nologo\ + /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)/dplaunch.pdb" /debug\ + /machine:I386 /out:"$(OUTDIR)/dplaunch.exe" +LINK32_OBJS= \ + "$(INTDIR)\dplaunch.obj" \ + "$(INTDIR)\dplaunch.res" + +"$(OUTDIR)\dplaunch.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "dplaunch - Win32 Release" +# Name "dplaunch - Win32 Debug" + +!IF "$(CFG)" == "dplaunch - Win32 Release" + +!ELSEIF "$(CFG)" == "dplaunch - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\dplaunch.c +DEP_CPP_DPLAU=\ + {$(INCLUDE)}"\dplay.h"\ + {$(INCLUDE)}"\dplobby.h"\ + + +"$(INTDIR)\dplaunch.obj" : $(SOURCE) $(DEP_CPP_DPLAU) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\dplaunch.rc + +"$(INTDIR)\dplaunch.res" : $(SOURCE) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/sdk/samples/dplaunch/dplaunch.rc b/sdk/samples/dplaunch/dplaunch.rc new file mode 100644 index 0000000..e8fb5fc --- /dev/null +++ b/sdk/samples/dplaunch/dplaunch.rc @@ -0,0 +1,159 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_LAUNCHERDIALOG DIALOGEX 0, 0, 253, 170 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "DirectPlay Launcher" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + COMBOBOX IDC_APPCOMBO,84,8,162,70,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SPCOMBO,84,26,162,90,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_PLAYEREDIT,84,44,162,14,ES_AUTOHSCROLL + EDITTEXT IDC_SESSIONEDIT,84,76,162,14,ES_AUTOHSCROLL + EDITTEXT IDC_ADDRESSEDIT,84,104,162,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "Run Application",IDC_RUNAPPBUTTON,188,129,58,14 + PUSHBUTTON "Quit",IDCANCEL,188,149,58,14 + CONTROL "Host session",IDC_HOSTRADIO,"Button",BS_AUTORADIOBUTTON, + 7,65,65,10 + CONTROL "Join session",IDC_JOINRADIO,"Button",BS_AUTORADIOBUTTON, + 7,93,54,10 + LTEXT "Application",IDC_STATIC,7,10,66,8 + LTEXT "Connection",IDC_STATIC,7,28,66,8 + LTEXT "Player name",IDC_STATIC,7,46,66,8 + LTEXT "Session name",IDC_STATIC,28,79,48,8 + LTEXT "Session address",IDC_STATIC,28,107,56,8 + LTEXT "Status",IDC_STATIC,7,132,21,8 + EDITTEXT IDC_STATUSEDIT,84,129,96,14,ES_AUTOHSCROLL | ES_READONLY +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_LAUNCHERDIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 246 + TOPMARGIN, 7 + BOTTOMMARGIN, 163 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Microsoft Corporation\0" + VALUE "FileDescription", "DirectPlay Launcher Utility\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "dplaunch\0" + VALUE "LegalCopyright", "Copyright � 1996\0" + VALUE "OriginalFilename", "dplaunch.exe\0" + VALUE "ProductName", "DirectPlay Launcher\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sdk/samples/dplaunch/makefile b/sdk/samples/dplaunch/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/dplaunch/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/dplaunch/makefile.wat b/sdk/samples/dplaunch/makefile.wat new file mode 100644 index 0000000..b705d4b --- /dev/null +++ b/sdk/samples/dplaunch/makefile.wat @@ -0,0 +1,2 @@ +MAKENAME=watcom.mk +!include ..\watbld.mk diff --git a/sdk/samples/dplaunch/msvc.mk b/sdk/samples/dplaunch/msvc.mk new file mode 100644 index 0000000..3ed783f --- /dev/null +++ b/sdk/samples/dplaunch/msvc.mk @@ -0,0 +1,40 @@ +NAME = dplaunch +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =libcmt.lib kernel32.lib user32.lib dplayx.lib\ + gdi32.lib uuid.lib libc.lib + +OBJS = dplaunch.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/dplaunch/readme.txt b/sdk/samples/dplaunch/readme.txt new file mode 100644 index 0000000..8d75f05 --- /dev/null +++ b/sdk/samples/dplaunch/readme.txt @@ -0,0 +1,40 @@ +DPLAUNCH +-------- + +Sample application to demonstrate how to launch a DirectPlay application +using the IDirectPlayLobby::RunApplication function. + +Instructions: + +1) Choose which application to launch. This dropdown listbox uses + IDirectPlayLobby::EnumLocalApplications to see what applications + are available. +2) Choose which service provider to use. +3) Choose the player name for this machine +4) Choose either "Host Session" and supply a name for the session + - or - + Choose "Join Session" and supply the network address of the machine + that is hosting the session. IPX requires no network address, + Internet TCP/IP requires an IP address or machine name, modem requires + a phone number to call. +5) Click on "Run Application" + +Notes: + +- Make sure you use DPLAUNCH to launch an application on one machine + with the "Host Session" option first. Then launch the application + on other machines (using DPLAUNCH) with the same service provider using + the "Join Session" option and the network address of the host (if needed) + +- DPLAUNCH will only join sessions that were created using DPLAUNCH. The + reason is that the session instance GUID is hard coded in DPLAUNCH. + Normally, DirectPlay generates one (if the application was not lobbied) + or a lobby server generates one and passes it to the lobby clients. + +- A real lobby client would be an application similar to DPLAUNCH but it + would be communicating with some lobby server to obtain all the + parameters for the IDirectPlayLobby::RunApplication call. + +- DirectPlay 3 does not include any APIs specifically geared towards + implementing a lobby server. + diff --git a/sdk/samples/dplaunch/resource.h b/sdk/samples/dplaunch/resource.h new file mode 100644 index 0000000..71bc994 --- /dev/null +++ b/sdk/samples/dplaunch/resource.h @@ -0,0 +1,26 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by dplaunch.rc +// +#define IDD_DIALOG1 101 +#define IDD_LAUNCHERDIALOG 102 +#define IDC_HOSTRADIO 1000 +#define IDC_JOINRADIO 1001 +#define IDC_APPCOMBO 1002 +#define IDC_SPCOMBO 1003 +#define IDC_ADDRESSEDIT 1004 +#define IDC_PLAYEREDIT 1005 +#define IDC_SESSIONEDIT 1006 +#define IDC_RUNAPPBUTTON 1007 +#define IDC_STATUSEDIT 1008 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sdk/samples/dplaunch/watcom.mk b/sdk/samples/dplaunch/watcom.mk new file mode 100644 index 0000000..bd5d038 --- /dev/null +++ b/sdk/samples/dplaunch/watcom.mk @@ -0,0 +1,32 @@ +NAME = dplaunch +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS = ..\..\..\lib\dplayx.lbw + +OBJS = dplaunch.obj + +SYS = nt_win + +!ifdef DEBUG +COPT =-DDEBUG -d2 +LOPT = debug all +ROPT =-DDEBUG +!else +COPT =-oaxt -d1 +LOPT = +ROPT = +!endif + +RES = $(NAME).res + +CFLAGS =$(COPT) -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +!include ..\..\watsdk.mk + +$(NAME).$(EXT): $(OBJS) $(NAME).lnk $(RES) + $(LINK) $(LFLAGS) @$(NAME).lnk + $(RC) $(RES) diff --git a/sdk/samples/ds3dview/ds3dvi.h b/sdk/samples/ds3dview/ds3dvi.h new file mode 100644 index 0000000..e1a1bd8 --- /dev/null +++ b/sdk/samples/ds3dview/ds3dvi.h @@ -0,0 +1,57 @@ +/************************************************************************************************************ + + Direct3DRM and DirectSound 3D interface designed for the Viewer Sample Application + + (c) 1996 Microsoft Corporation + +************************************************************************************************************/ + +#ifndef ___DS3DVIEWER_INTERNAL +#define ___DS3DVIEWER_INTERNAL + +// "Internal" structure definitions and other include information used by +// the DS3DVIEW application. We put this stuff here so other modules can +// access it without great pain. + +// Info for the 3D3RM (RL info) +typedef struct _AppInfo +{ + // The parent frame + LPDIRECT3DRMFRAME scene; + // The frame for the camera (a child of the scene) + LPDIRECT3DRMFRAME camera; + + // Device for Windows + LPDIRECT3DRMDEVICE dev; + // Defines how the 3D scene is rendered into the 2D window + LPDIRECT3DRMVIEWPORT view; + + // Defines which color model (RGB/Ramp) is used for rendering - used when creating a device + // from the RL api + D3DRMCOLORMODEL model; + + // Whether or not the window is minimized (modified by the resizing handler) + BOOL bMinimized; +} AppInfo; + + + +/* +** Error Checking code +*/ +BOOL D3DRM_SUCCEED(HRESULT result, int force_critical = -1, char* info = NULL); +BOOL DS3D_SUCCEED(HRESULT result, int force_critical = -1, char* info = NULL); + + +/****** DirectSound3D Helper Stuff ************************************/ + +// Simple thing to copy vectors to each other independant of type +#define RLV_TO_DSV(in,out) out.x = in.x;\ + out.y = in.y;\ + out.z = in.z; + + +#endif + + + diff --git a/sdk/samples/ds3dview/ds3dview.def b/sdk/samples/ds3dview/ds3dview.def new file mode 100644 index 0000000..5b0c331 --- /dev/null +++ b/sdk/samples/ds3dview/ds3dview.def @@ -0,0 +1,10 @@ +NAME DS3DVIEW + +DESCRIPTION 'Reality Lab Example Program (C) Microsoft 1995' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/ds3dview/dsutil3d.c b/sdk/samples/ds3dview/dsutil3d.c new file mode 100644 index 0000000..cfb3ad4 --- /dev/null +++ b/sdk/samples/ds3dview/dsutil3d.c @@ -0,0 +1,519 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: dsutil3d.c + * Content: Routines for dealing with sounds from resources -- this + * version has been modified and extended somewhat from the + * version found in the SAMPLES\MISC directory. + * + * + ***************************************************************************/ + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include "dsound.h" + +typedef struct +{ + BYTE *pbWaveData; // pointer into wave resource (for restore) + DWORD cbWaveSize; // size of wave data (for restore) + int iAlloc; // number of buffers. + int iCurrent; // current buffer + IDirectSoundBuffer* Buffers[1]; // list of buffers + +} SNDOBJ, *HSNDOBJ; + +#define _HSNDOBJ_DEFINED +#include "dsutil3d.h" + +static const char c_szWAV[] = "WAV"; + +/////////////////////////////////////////////////////////////////////////////// +// +// DSLoadSoundBuffer - Loads a .WAV into a sound buffer and returns the sound buffer +// +/////////////////////////////////////////////////////////////////////////////// + +IDirectSoundBuffer *DSLoadSoundBuffer(IDirectSound *pDS, LPCTSTR lpName) +{ + IDirectSoundBuffer *pDSB = NULL; + DSBUFFERDESC dsBD = {0}; + BYTE *pbWaveData; + void *pvBase; + + dsBD.dwSize = sizeof(dsBD); + dsBD.dwFlags = DSBCAPS_STATIC | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY + | DSBCAPS_LOCSOFTWARE; + + if (DSGetWaveResource(NULL, lpName, &dsBD.lpwfxFormat, &pbWaveData, &dsBD.dwBufferBytes)) + { + if (SUCCEEDED(IDirectSound_CreateSoundBuffer(pDS, &dsBD, &pDSB, NULL))) + { + if (!DSFillSoundBuffer(pDSB, pbWaveData, dsBD.dwBufferBytes)) + { + IDirectSoundBuffer_Release(pDSB); + pDSB = NULL; + } + } + else + { + pDSB = NULL; + } + } else if (DSGetWaveFile(NULL, lpName, &dsBD.lpwfxFormat, &pbWaveData, + &dsBD.dwBufferBytes, &pvBase)) + { + if (SUCCEEDED(IDirectSound_CreateSoundBuffer(pDS, &dsBD, &pDSB, NULL))) + { + if (!DSFillSoundBuffer(pDSB, pbWaveData, dsBD.dwBufferBytes)) + { + IDirectSoundBuffer_Release(pDSB); + pDSB = NULL; + } + } + else + { + pDSB = NULL; + } + UnmapViewOfFile (pvBase); + } + + return pDSB; +} + + +/////////////////////////////////////////////////////////////////////////////// +// +// DSLoad3DSoundBuffer - Loads a .WAV into a 3D sound buffer and returns the sound buffer +// +/////////////////////////////////////////////////////////////////////////////// + +IDirectSoundBuffer *DSLoad3DSoundBuffer(IDirectSound *pDS, LPCTSTR lpName) +{ + IDirectSoundBuffer *pDSB = NULL; + DSBUFFERDESC dsBD = {0}; + BYTE *pbWaveData; + void *pvBase; + + dsBD.dwSize = sizeof(dsBD); + dsBD.dwFlags = DSBCAPS_STATIC | DSBCAPS_CTRL3D | DSBCAPS_CTRLVOLUME + | DSBCAPS_CTRLFREQUENCY | DSBCAPS_LOCSOFTWARE + | DSBCAPS_STICKYFOCUS; + + if (DSGetWaveResource(NULL, lpName, &dsBD.lpwfxFormat, &pbWaveData, &dsBD.dwBufferBytes)) + { + if (SUCCEEDED(IDirectSound_CreateSoundBuffer(pDS, &dsBD, &pDSB, NULL))) + { + if (!DSFillSoundBuffer(pDSB, pbWaveData, dsBD.dwBufferBytes)) + { + IDirectSoundBuffer_Release(pDSB); + pDSB = NULL; + } + } + else + { + pDSB = NULL; + } + } else if (DSGetWaveFile(NULL, lpName, &dsBD.lpwfxFormat, &pbWaveData, + &dsBD.dwBufferBytes, &pvBase)) + { + if (SUCCEEDED(IDirectSound_CreateSoundBuffer(pDS, &dsBD, &pDSB, NULL))) + { + if (!DSFillSoundBuffer(pDSB, pbWaveData, dsBD.dwBufferBytes)) + { + IDirectSoundBuffer_Release(pDSB); + pDSB = NULL; + } + } + else + { + pDSB = NULL; + } + UnmapViewOfFile (pvBase); + } + + return pDSB; +} + + +/////////////////////////////////////////////////////////////////////////////// +// +// DSReloadSoundBuffer +// +/////////////////////////////////////////////////////////////////////////////// + +BOOL DSReloadSoundBuffer(IDirectSoundBuffer *pDSB, LPCTSTR lpName) +{ + BOOL result=FALSE; + BYTE *pbWaveData; + DWORD cbWaveSize; + void *pvBase; + + if (DSGetWaveResource(NULL, lpName, NULL, &pbWaveData, &cbWaveSize)) + { + if (SUCCEEDED(IDirectSoundBuffer_Restore(pDSB)) && + DSFillSoundBuffer(pDSB, pbWaveData, cbWaveSize)) + { + result = TRUE; + } + } else if( DSGetWaveFile(NULL, lpName, NULL, &pbWaveData, &cbWaveSize, &pvBase)) + { + if (SUCCEEDED(IDirectSoundBuffer_Restore(pDSB)) && + DSFillSoundBuffer(pDSB, pbWaveData, cbWaveSize)) + { + result = TRUE; + } + UnmapViewOfFile (pvBase); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// DSGetWaveResource +// +/////////////////////////////////////////////////////////////////////////////// +BOOL DSGetWaveResource(HMODULE hModule, LPCTSTR lpName, + WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pcbWaveSize) +{ + HRSRC hResInfo; + HGLOBAL hResData; + void * pvRes; + + if (((hResInfo = FindResource(hModule, lpName, c_szWAV)) != NULL) && + ((hResData = LoadResource(hModule, hResInfo)) != NULL) && + ((pvRes = LockResource(hResData)) != NULL) && + DSParseWaveResource(pvRes, ppWaveHeader, ppbWaveData, pcbWaveSize)) + { + return TRUE; + } + + return FALSE; + +} + + +/////////////////////////////////////////////////////////////////////////////// +// +// DSGetWaveFile +// +/////////////////////////////////////////////////////////////////////////////// +BOOL DSGetWaveFile(HMODULE hModule, LPCTSTR lpName, + WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pcbWaveSize, + void **ppvBase) +{ + void *pvRes; + HANDLE hFile, hMapping; + + *ppvBase = NULL; + + hFile = CreateFile (lpName, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, 0, NULL); + if (hFile == INVALID_HANDLE_VALUE) return FALSE; + + hMapping = CreateFileMapping (hFile, NULL, PAGE_READONLY, 0, 0, NULL); + if (hMapping == INVALID_HANDLE_VALUE) + { + CloseHandle (hFile); + return FALSE; + } + + CloseHandle (hFile); + + pvRes = MapViewOfFile (hMapping, FILE_MAP_READ, 0, 0, 0); + if (pvRes == NULL) + { + CloseHandle (hMapping); + return FALSE; + } + + CloseHandle (hMapping); + + if (DSParseWaveResource(pvRes, ppWaveHeader, ppbWaveData, pcbWaveSize) == FALSE) + { + UnmapViewOfFile (pvRes); + return FALSE; + } + + *ppvBase = pvRes; + return TRUE; +} + + +/////////////////////////////////////////////////////////////////////////////// +// SndObj fns +/////////////////////////////////////////////////////////////////////////////// + +SNDOBJ *SndObjCreate(IDirectSound *pDS, LPCTSTR lpName, int iConcurrent) +{ + SNDOBJ *pSO = NULL; + LPWAVEFORMATEX pWaveHeader; + BOOL fFound = FALSE; + BYTE *pbData; + UINT cbData; + void * pvBase; + + if (DSGetWaveResource(NULL, lpName, &pWaveHeader, &pbData, &cbData)) + fFound = TRUE; + if (DSGetWaveFile(NULL, lpName, &pWaveHeader, &pbData, &cbData, &pvBase)) + { + fFound = TRUE; + UnmapViewOfFile( pvBase ); + } + if( fFound ) + { + if (iConcurrent < 1) + iConcurrent = 1; + + if ((pSO = (SNDOBJ *)LocalAlloc(LPTR, sizeof(SNDOBJ) + + (iConcurrent-1) * sizeof(IDirectSoundBuffer *))) != NULL) + { + int i; + + pSO->iAlloc = iConcurrent; + pSO->pbWaveData = pbData; + pSO->cbWaveSize = cbData; + pSO->Buffers[0] = DSLoadSoundBuffer(pDS, lpName); + + for (i=1; i<pSO->iAlloc; i++) + { + if (FAILED(IDirectSound_DuplicateSoundBuffer(pDS, + pSO->Buffers[0], &pSO->Buffers[i]))) + { + pSO->Buffers[i] = DSLoadSoundBuffer(pDS, lpName); + if (!pSO->Buffers[i]) { + SndObjDestroy(pSO); + pSO = NULL; + break; + } + } + } + } + } + + return pSO; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +void SndObjDestroy(SNDOBJ *pSO) +{ + if (pSO) + { + int i; + + for (i=0; i<pSO->iAlloc; i++) + { + if (pSO->Buffers[i]) + { + IDirectSoundBuffer_Release(pSO->Buffers[i]); + pSO->Buffers[i] = NULL; + } + } + LocalFree((HANDLE)pSO); + } +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +IDirectSoundBuffer *SndObjGetFreeBuffer(SNDOBJ *pSO) +{ + IDirectSoundBuffer *pDSB; + + if (pSO == NULL) + return NULL; + + if (pDSB = pSO->Buffers[pSO->iCurrent]) + { + HRESULT hres; + DWORD dwStatus; + + hres = IDirectSoundBuffer_GetStatus(pDSB, &dwStatus); + + if (FAILED(hres)) + dwStatus = 0; + + if ((dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING) + { + if (pSO->iAlloc > 1) + { + if (++pSO->iCurrent >= pSO->iAlloc) + pSO->iCurrent = 0; + + pDSB = pSO->Buffers[pSO->iCurrent]; + hres = IDirectSoundBuffer_GetStatus(pDSB, &dwStatus); + + if (SUCCEEDED(hres) && (dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING) + { + IDirectSoundBuffer_Stop(pDSB); + IDirectSoundBuffer_SetCurrentPosition(pDSB, 0); + } + } + else + { + pDSB = NULL; + } + } + + if (pDSB && (dwStatus & DSBSTATUS_BUFFERLOST)) + { + if (FAILED(IDirectSoundBuffer_Restore(pDSB)) || + !DSFillSoundBuffer(pDSB, pSO->pbWaveData, pSO->cbWaveSize)) + { + pDSB = NULL; + } + } + } + + return pDSB; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +BOOL SndObjPlay(SNDOBJ *pSO, DWORD dwPlayFlags) +{ + BOOL result = FALSE; + + if (pSO == NULL) + return FALSE; + + if ((!(dwPlayFlags & DSBPLAY_LOOPING) || (pSO->iAlloc == 1))) + { + IDirectSoundBuffer *pDSB = SndObjGetFreeBuffer(pSO); + if (pDSB != NULL) { + result = SUCCEEDED(IDirectSoundBuffer_Play(pDSB, 0, 0, dwPlayFlags)); + } + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +BOOL SndObjStop(SNDOBJ *pSO) +{ + int i; + + if (pSO == NULL) + return FALSE; + + for (i=0; i<pSO->iAlloc; i++) + { + IDirectSoundBuffer_Stop(pSO->Buffers[i]); + IDirectSoundBuffer_SetCurrentPosition(pSO->Buffers[i], 0); + } + + return TRUE; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +BOOL DSFillSoundBuffer(IDirectSoundBuffer *pDSB, BYTE *pbWaveData, DWORD cbWaveSize) +{ + if (pDSB && pbWaveData && cbWaveSize) + { + LPVOID pMem1, pMem2; + DWORD dwSize1, dwSize2; + + if (SUCCEEDED(IDirectSoundBuffer_Lock(pDSB, 0, cbWaveSize, + &pMem1, &dwSize1, &pMem2, &dwSize2, 0))) + { + CopyMemory(pMem1, pbWaveData, dwSize1); + + if ( 0 != dwSize2 ) + CopyMemory(pMem2, pbWaveData+dwSize1, dwSize2); + + IDirectSoundBuffer_Unlock(pDSB, pMem1, dwSize1, pMem2, dwSize2); + return TRUE; + } + } + + return FALSE; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +BOOL DSParseWaveResource(void *pvRes, WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData,DWORD *pcbWaveSize) +{ + DWORD *pdw; + DWORD *pdwEnd; + DWORD dwRiff; + DWORD dwType; + DWORD dwLength; + + if (ppWaveHeader) + *ppWaveHeader = NULL; + + if (ppbWaveData) + *ppbWaveData = NULL; + + if (pcbWaveSize) + *pcbWaveSize = 0; + + pdw = (DWORD *)pvRes; + dwRiff = *pdw++; + dwLength = *pdw++; + dwType = *pdw++; + + if (dwRiff != mmioFOURCC('R', 'I', 'F', 'F')) + goto exit; // not even RIFF + + if (dwType != mmioFOURCC('W', 'A', 'V', 'E')) + goto exit; // not a WAV + + pdwEnd = (DWORD *)((BYTE *)pdw + dwLength-4); + + while (pdw < pdwEnd) + { + dwType = *pdw++; + dwLength = *pdw++; + + switch (dwType) + { + case mmioFOURCC('f', 'm', 't', ' '): + if (ppWaveHeader && !*ppWaveHeader) + { + if (dwLength < sizeof(WAVEFORMAT)) + goto exit; // not a WAV + + *ppWaveHeader = (WAVEFORMATEX *)pdw; + + if ((!ppbWaveData || *ppbWaveData) && + (!pcbWaveSize || *pcbWaveSize)) + { + return TRUE; + } + } + break; + + case mmioFOURCC('d', 'a', 't', 'a'): + if ((ppbWaveData && !*ppbWaveData) || + (pcbWaveSize && !*pcbWaveSize)) + { + if (ppbWaveData) + *ppbWaveData = (LPBYTE)pdw; + + if (pcbWaveSize) + *pcbWaveSize = dwLength; + + if (!ppWaveHeader || *ppWaveHeader) + return TRUE; + } + break; + } + + pdw = (DWORD *)((BYTE *)pdw + ((dwLength+1)&~1)); + } + +exit: + return FALSE; +} diff --git a/sdk/samples/ds3dview/dsutil3d.h b/sdk/samples/ds3dview/dsutil3d.h new file mode 100644 index 0000000..6094337 --- /dev/null +++ b/sdk/samples/ds3dview/dsutil3d.h @@ -0,0 +1,264 @@ + +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: dsutil.cpp + * Content: Routines for dealing with sounds from resources + * + * + ***************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// These Load functions will first look in the Win32 resources, and then they +// will attempt to find the given name as a file on disk. +// +// DSLoadSoundBuffer Loads an IDirectSoundBuffer from a Win32 resource in +// the current application, or alternately from disk. +// +// DSLoad3DSoundBuffer Loads an IDirectSoundBuffer from a Win32 resource in +// the current application, and asks for DSBCAPS_CTRL3D. +// +// Params: +// pDS -- Pointer to an IDirectSound that will be used to create +// the buffer. +// +// lpName -- Name of WAV resource to load the data from. Can be a +// resource id specified using the MAKEINTRESOURCE macro. +// +// Returns an IDirectSoundBuffer containing the wave data or NULL on error. +// +// example: +// in the application's resource script (.RC file) +// Turtle WAV turtle.wav +// +// some code in the application: +// IDirectSoundBuffer *pDSB = DSLoadSoundBuffer(pDS, "Turtle"); +// +// if (pDSB) +// { +// IDirectSoundBuffer_Play(pDSB, 0, 0, DSBPLAY_TOEND); +// /* ... */ +// +// or you can substitute the first line above as: +// IDirectSoundBuffer *pDSB = DSLoadSoundBuffer(pDS, "turtle.wav"); +// +/////////////////////////////////////////////////////////////////////////////// +IDirectSoundBuffer *DSLoadSoundBuffer(IDirectSound *pDS, LPCTSTR lpName); +IDirectSoundBuffer *DSLoad3DSoundBuffer(IDirectSound *pDS, LPCTSTR lpName); + +/////////////////////////////////////////////////////////////////////////////// +// +// DSReloadSoundBuffer Reloads an IDirectSoundBuffer from a Win32 resource in +// the current application. normally used to handle +// a DSERR_BUFFERLOST error. Will also attempt to find +// the given name as a file, if there is no resource. +// Params: +// pDSB -- Pointer to an IDirectSoundBuffer to be reloaded. +// +// lpName -- Name of WAV resource to load the data from. Can be a +// resource id specified using the MAKEINTRESOURCE macro. +// +// Returns a BOOL indicating whether the buffer was successfully reloaded. +// +// example: +// in the application's resource script (.RC file) +// Turtle WAV turtle.wav +// +// some code in the application: +// TryAgain: +// HRESULT hres = IDirectSoundBuffer_Play(pDSB, 0, 0, DSBPLAY_TOEND); +// +// if (FAILED(hres)) +// { +// if ((hres == DSERR_BUFFERLOST) && +// DSReloadSoundBuffer(pDSB, "Turtle")) +// { +// goto TryAgain; +// } +// /* deal with other errors... */ +// } +// +/////////////////////////////////////////////////////////////////////////////// +BOOL DSReloadSoundBuffer(IDirectSoundBuffer *pDSB, LPCTSTR lpName); + +/////////////////////////////////////////////////////////////////////////////// +// +// DSGetWaveResource Finds a WAV resource in a Win32 module. +// +// Params: +// hModule -- Win32 module handle of module containing WAV resource. +// Pass NULL to indicate current application. +// +// lpName -- Name of WAV resource to load the data from. Can be a +// resource id specified using the MAKEINTRESOURCE macro. +// +// ppWaveHeader-- Optional pointer to WAVEFORMATEX * to receive a pointer to +// the WAVEFORMATEX header in the specified WAV resource. +// Pass NULL if not required. +// +// ppbWaveData -- Optional pointer to BYTE * to receive a pointer to the +// waveform data in the specified WAV resource. Pass NULL if +// not required. +// +// pdwWaveSize -- Optional pointer to DWORD to receive the size of the +// waveform data in the specified WAV resource. Pass NULL if +// not required. +// +// Returns a BOOL indicating whether a valid WAV resource was found. +// +/////////////////////////////////////////////////////////////////////////////// +BOOL DSGetWaveResource(HMODULE hModule, LPCTSTR lpName, + WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pdwWaveSize); + +/////////////////////////////////////////////////////////////////////////////// +// +// DSGetWaveFile Finds a WAV file on disk and uses a memory mapped file to +// get a memory image of the file. +// +// Params: +// hModule -- Win32 module handle of module containing WAV resource. +// Pass NULL to indicate current application. +// +// lpName -- Name of WAV resource to load the data from. Can be a +// resource id specified using the MAKEINTRESOURCE macro. +// +// ppWaveHeader-- Optional pointer to WAVEFORMATEX * to receive a pointer to +// the WAVEFORMATEX header in the specified WAV resource. +// Pass NULL if not required. +// +// ppbWaveData -- Optional pointer to BYTE * to receive a pointer to the +// waveform data in the specified WAV resource. Pass NULL if +// not required. +// +// pdwWaveSize -- Optional pointer to DWORD to receive the size of the +// waveform data in the specified WAV resource. Pass NULL if +// not required. +// +// ppvBase -- Required out-parameter which receives the base-address of +// the file mapping. This is needed for the caller to Unmap +// the file. +// +// Returns a BOOL indicating whether a valid WAV file was found and mapped. +// The caller is responsible for calling UnmapViewOfFile(*ppvBase) when they +// are done with the "memory" for the file. +// +/////////////////////////////////////////////////////////////////////////////// +BOOL DSGetWaveFile(HMODULE hModule, LPCTSTR lpName, WAVEFORMATEX **ppWaveHeader, + BYTE **ppbWaveData, DWORD *pdwWaveSize, void **ppvBase); + +/////////////////////////////////////////////////////////////////////////////// +// +// HSNDOBJ Handle to a SNDOBJ object. +// +// SNDOBJs are implemented in dsutil as an example layer built on top +// of DirectSound. +// +// A SNDOBJ is generally used to manage individual +// sounds which need to be played multiple times concurrently. A +// SNDOBJ represents a queue of IDirectSoundBuffer objects which +// all refer to the same buffer memory. +// +// A SNDOBJ also automatically reloads the sound resource when +// DirectSound returns a DSERR_BUFFERLOST +// +/////////////////////////////////////////////////////////////////////////////// +#ifndef _HSNDOBJ_DEFINED +#define _HSNDOBJ_DEFINED +DECLARE_HANDLE32(HSNDOBJ); +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// SndObjCreate Loads a SNDOBJ from a Win32 resource in +// the current application. +// +// Params: +// pDS -- Pointer to an IDirectSound that will be used to create +// the SNDOBJ. +// +// lpName -- Name of WAV resource to load the data from. Can be a +// resource id specified using the MAKEINTRESOURCE macro. +// +// iConcurrent -- Integer representing the number of concurrent playbacks of +// to plan for. Attempts to play more than this number will +// succeed but will restart the least recently played buffer +// even if it is not finished playing yet. +// +// Returns an HSNDOBJ or NULL on error. +// +// NOTES: +// SNDOBJs automatically restore and reload themselves as required. +// +/////////////////////////////////////////////////////////////////////////////// +HSNDOBJ SndObjCreate(IDirectSound *pDS, LPCTSTR lpName, int iConcurrent); + +/////////////////////////////////////////////////////////////////////////////// +// +// SndObjDestroy Frees a SNDOBJ and releases all of its buffers. +// +// Params: +// hSO -- Handle to a SNDOBJ to free. +// +/////////////////////////////////////////////////////////////////////////////// +void SndObjDestroy(HSNDOBJ hSO); + +/////////////////////////////////////////////////////////////////////////////// +// +// SndObjPlay Plays a buffer in a SNDOBJ. +// +// Params: +// hSO -- Handle to a SNDOBJ to play a buffer from. +// +// dwPlayFlags -- Flags to pass to IDirectSoundBuffer::Play. It is not +// legal to play an SndObj which has more than one buffer +// with the DSBPLAY_LOOPING flag. Pass 0 to stop playback. +// +/////////////////////////////////////////////////////////////////////////////// +BOOL SndObjPlay(HSNDOBJ hSO, DWORD dwPlayFlags); + +/////////////////////////////////////////////////////////////////////////////// +// +// SndObjStop Stops one or more buffers in a SNDOBJ. +// +// Params: +// hSO -- Handle to a SNDOBJ to play a buffer from. +// +/////////////////////////////////////////////////////////////////////////////// +BOOL SndObjStop(HSNDOBJ hSO); + +/////////////////////////////////////////////////////////////////////////////// +// +// SndObjGetFreeBuffer returns one of the cloned buffers that is +// not currently playing +// +// Params: +// hSO -- Handle to a SNDOBJ +// +// NOTES: +// This function is provided so that callers can set things like pan etc +// before playing the buffer. +// +// EXAMPLE: +// ... +// +/////////////////////////////////////////////////////////////////////////////// +IDirectSoundBuffer *SndObjGetFreeBuffer(HSNDOBJ hSO); + +/////////////////////////////////////////////////////////////////////////////// +// +// helper routines +// +/////////////////////////////////////////////////////////////////////////////// + +BOOL DSFillSoundBuffer(IDirectSoundBuffer *pDSB, BYTE *pbWaveData, DWORD dwWaveSize); +BOOL DSParseWaveResource(void *pvRes, WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pdwWaveSize); + +#ifdef __cplusplus +} +#endif diff --git a/sdk/samples/ds3dview/file.cpp b/sdk/samples/ds3dview/file.cpp new file mode 100644 index 0000000..481ef4d --- /dev/null +++ b/sdk/samples/ds3dview/file.cpp @@ -0,0 +1,108 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: file.cpp + * + * DESCRIPTION: Functionality to let users pick files and return their + * names to the object viewer (one for XOF, one for WAV) + * + ***************************************************************************/ + +#include "d3drmwin.h" +#include "resource.h" +#include <windows.h> +#include <stdio.h> +#include <string.h> + +/* +** Lets the user select a new geometry file to load and returns the full path and filename +*/ + +char* OpenNewFile( HWND hwnd ) +{ + static char file[256]; + static char fileTitle[256]; + static char filter[] = "Geometry files (*.x)\0*.x\0" + "All Files (*.*)\0*.*\0"; + OPENFILENAME ofn; + + strcpy( file, ""); + strcpy( fileTitle, ""); + + // Set up the OPENFILENAME structure + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwnd; +#ifdef WIN32 + ofn.hInstance = (HANDLE) GetWindowLong(hwnd, GWL_HINSTANCE); +#else + ofn.hInstance = (HANDLE) GetWindowWord(hwnd, GWW_HINSTANCE); +#endif + ofn.lpstrFilter = filter; + ofn.lpstrCustomFilter = (LPSTR) NULL; + ofn.nMaxCustFilter = 0L; + ofn.nFilterIndex = 1L; + ofn.lpstrFile = file; + ofn.nMaxFile = sizeof(file); + ofn.lpstrFileTitle = fileTitle; + ofn.nMaxFileTitle = sizeof(fileTitle); + ofn.lpstrInitialDir = NULL; + ofn.lpstrTitle = "Open a File"; + ofn.nFileOffset = 0; + ofn.nFileExtension = 0; + ofn.lpstrDefExt = "*.x"; + ofn.lCustData = 0; + + ofn.Flags = OFN_SHOWHELP | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; + + // Call windows functionality to make it happen! + if (GetOpenFileName(&ofn)) + return (char*)ofn.lpstrFile; + else + return NULL; +} + +/* +** Lets the user select a new .WAV file to load and returns it's full path and filename +*/ + +char* OpenNewSoundFile( HWND hwnd ) +{ + static char file[256]; + static char fileTitle[256]; + static char filter[] = "Sound files (*.wav)\0*.wav\0" + "All Files (*.*)\0*.*\0"; + OPENFILENAME ofn; + + strcpy( file, ""); + strcpy( fileTitle, ""); + + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwnd; +#ifdef WIN32 + ofn.hInstance = (HANDLE) GetWindowLong(hwnd, GWL_HINSTANCE); +#else + ofn.hInstance = (HANDLE) GetWindowWord(hwnd, GWW_HINSTANCE); +#endif + ofn.lpstrFilter = filter; + ofn.lpstrCustomFilter = (LPSTR) NULL; + ofn.nMaxCustFilter = 0L; + ofn.nFilterIndex = 1L; + ofn.lpstrFile = file; + ofn.nMaxFile = sizeof(file); + ofn.lpstrFileTitle = fileTitle; + ofn.nMaxFileTitle = sizeof(fileTitle); + ofn.lpstrInitialDir = NULL; + ofn.lpstrTitle = "Open a File"; + ofn.nFileOffset = 0; + ofn.nFileExtension = 0; + ofn.lpstrDefExt = "*.wav"; + ofn.lCustData = 0; + + ofn.Flags = OFN_SHOWHELP | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; + + if (GetOpenFileName(&ofn)) + return (char*)ofn.lpstrFile; + else + return NULL; +} diff --git a/sdk/samples/ds3dview/file.h b/sdk/samples/ds3dview/file.h new file mode 100644 index 0000000..f0e6ba3 --- /dev/null +++ b/sdk/samples/ds3dview/file.h @@ -0,0 +1,9 @@ +#ifndef ___VIEWER_FILE_OPENERS +#define ___VIEWER_FILE_OPENERS + +char* OpenNewFile(HWND); +char* OpenNewSoundFile(HWND); + +#endif + + diff --git a/sdk/samples/ds3dview/makefile b/sdk/samples/ds3dview/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/ds3dview/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/ds3dview/makefile.wat b/sdk/samples/ds3dview/makefile.wat new file mode 100644 index 0000000..b705d4b --- /dev/null +++ b/sdk/samples/ds3dview/makefile.wat @@ -0,0 +1,2 @@ +MAKENAME=watcom.mk +!include ..\watbld.mk diff --git a/sdk/samples/ds3dview/msvc.mk b/sdk/samples/ds3dview/msvc.mk new file mode 100644 index 0000000..ef5d3b4 --- /dev/null +++ b/sdk/samples/ds3dview/msvc.mk @@ -0,0 +1,42 @@ +NAME = ds3dview +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib\ + comdlg32.lib gdi32.lib winmm.lib libc.lib dsound.lib + +OBJS = viewer.obj file.obj rodcone.obj rlds3d.obj dsutil3d.obj + +!if "$(DEBUG)" == "debug" +COPT =-DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-Otyb1 +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = viewer.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/ds3dview/readme.txt b/sdk/samples/ds3dview/readme.txt new file mode 100644 index 0000000..95f7e4f --- /dev/null +++ b/sdk/samples/ds3dview/readme.txt @@ -0,0 +1,55 @@ +Reality Lab / DirectSound 3D Viewer Sample + +DS3DVIEW.EXE + +This sample is a simple extension of the 3D object viewer sample that shipped +with DirectX 2. It allows you to attach sounds to objects and move them around +a bit in 3D. + +Viewer Notes: +------------- +The initial scene has a light source in the top right. To see this the view +can be moved backwards and forwards using the T and R keys. Additional objects +can be loaded from the file menu, and new light sources can be added from the +lights menu. Objects can be rotated with the left mouse button and dragged +with the right. + +The last object that was rotated or dragged is the current selection. + +The device quality can be altered using the Renderer menu. Using this menu the +type of device used can also be switched from ramp to RGB. When using the RGB +device the colour of lights in the scene can be changed in the same way as you +change the colour of objects. In 256 colour mode it is advisable to dither an +RGB device for best results. + + + +Additional keyboard controls + +T Forwards. +R Back. +Z Move current selection forwards. +X Move current selection back. +G Gouraud shade +F Flat Shade +D Dither toggle. +Delete Delete the current selection. + + +Sound Notes: +------------ + +To attach a sound to an object, select the object and then select the "Attach Sound" +command from the Sound menu. You can then select a WAV file to load. To hear the +sound, select "Play Sound Once" or "Play Sound Looping." To hear some neat effects, +try "Orbit" which will orbit the object/sound around the listener, or "Bullet," +which will shoot the object/sound past the listener's head. + +Properties for the sound or the listener can also be modified using the appropriate +menu commands and dialogs. + + +Current Known Issues for DX 3, Beta 1: +-------------------------------------- +* Double-cones are not currently implemented right -- the outer cone is simply set + to be the same as the inside cone, which is always valid. diff --git a/sdk/samples/ds3dview/resource.h b/sdk/samples/ds3dview/resource.h new file mode 100644 index 0000000..9358335 --- /dev/null +++ b/sdk/samples/ds3dview/resource.h @@ -0,0 +1,66 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by viewer.rc +// +#define MENU_FILE_ABOUT 1 +#define MENU_FILE_OPEN 2 +#define MENU_FILE_EXIT 3 +#define MENU_FILE_NEW_WINDOW 4 +#define MENU_EDIT_CUT 100 +#define MENU_EDIT_COPY 101 +#define MENU_EDIT_PASTE 102 +#define MENU_EDIT_DELETE 103 +#define MENU_EDIT_COLOUR 104 +#define MENU_EDIT_BOXES 105 +#define MENU_QUALITY_LIGHTING 200 +#define MENU_QUALITY_POINTS 201 +#define MENU_QUALITY_WIREFRAME 202 +#define MENU_QUALITY_SOLID 203 +#define MENU_QUALITY_FLAT 204 +#define MENU_QUALITY_GOURAUD 205 +#define MENU_QUALITY_PHONG 206 +#define MENU_MODEL_MONO 207 +#define MENU_MODEL_RGB 208 +#define MENU_DITHER 209 +#define MENU_TEXTURE_FILTERING 210 +#define MENU_LIGHT_DIRECTIONAL 301 +#define MENU_LIGHT_PARALLEL_POINT 302 +#define MENU_LIGHT_POINT 303 +#define MENU_LIGHT_SPOT 304 +#define MENU_SOUND_ATTACHSOUND 401 +#define MENU_SOUND_REMOVESOUND 402 +#define MENU_SOUND_REMOVEALLSOUNDS 403 +#define MENU_SOUND_PLAYSOUND 404 +#define MENU_SOUND_PLAYSOUNDLOOPING 405 +#define MENU_SOUND_STOPSOUND 406 +#define MENU_SOUND_STOPALLSOUNDS 407 +#define MENU_MOTION_ORBITSELECTEDOBJECT 501 +#define MENU_MOTION_BULLETSELECTEDOBJECT 502 +#define IDC_ORBIT 1005 +#define IDC_BULLET 1006 +#define IDC_EDIT1 1007 +#define IDC_CONEANGLE 1007 +#define IDC_EDIT2 1008 +#define IDC_CONEOUTSIDEVOLUME 1008 +#define IDC_EDIT3 1009 +#define IDC_MINIMUMDISTANCE 1009 +#define IDC_EDIT4 1011 +#define IDC_MAXIMUMDISTANCE 1011 +#define IDC_DISTANCEFACTOR 1012 +#define IDC_ROLLOFFFACTOR 1013 +#define IDC_DOPPLERFACTOR 1014 +#define MENU_SOUND_GLOBALPROPERTIES 40015 +#define MENU_SOUND_SELECTEDSOUNDPROPERTIES 40016 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 106 +#define _APS_NEXT_COMMAND_VALUE 40019 +#define _APS_NEXT_CONTROL_VALUE 1015 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sdk/samples/ds3dview/rlds3d.cpp b/sdk/samples/ds3dview/rlds3d.cpp new file mode 100644 index 0000000..b2fa210 --- /dev/null +++ b/sdk/samples/ds3dview/rlds3d.cpp @@ -0,0 +1,2159 @@ +/************************************************************************************************************ + + Direct3DRM and DirectSound3D interface designed for the Viewer Sample Application + + (c) 1996 Microsoft Corporation + +************************************************************************************************************/ + + +#include "rlds3d.h" +#include "ds3dvi.h" // "Internal" include stuff, like some structures + +// For resource symbols +#include "resource.h" + +#include "d3drmwin.h" + +#include <windows.h> +#include <windowsx.h> + +#include <stdio.h> +#include <string.h> +#include <malloc.h> +#include <math.h> +#include <direct.h> + +#include <objbase.h> +#include <initguid.h> + +#include "rodcone.h" +#include "file.h" + +#include <mmsystem.h> +#include "dsound.h" +#include "dsutil3d.h" + + +/* +** This is an interface between the viewer and the RL/DS3D APIs which provides the +** functionality required by the viewer in simplified form. +** +** Note: This is not an object-oriented API since there should only be need for one +** copy at a time and this way C++ to C conversions should be fairly easy +** +** DESCRIPTION: The user interfaces the 3D world and objects therein by selecting an item +** with the mouse (on the screen) and performing operations on that item. The user will +** also be able to perform operations on the camera and a few global operations applied +** to all objects. +** +** USAGE: Create the interface using RLDS3D_Initialize() (returns FALSE if not created) +** and remove it using RLDS3D_Deinitialize(). The Render() functionality draws the world +** on the screen. Other functionality as described. +*/ + +/* +*********************************** GLOBALS ************************************* +*/ + +/* +** VIEWER LPDIRECT3DRMFRAME APPDATA STRUCTURE +** +** Pointers to this class are placed (as necessary) in the appdata fields for LPDIRECT3DRMFRAMEs. Any +** necessary data to be attached to frames should be added to this class +*/ + +class FRAMEAPPDATA { +public: + // Sound buffer interfaces (the standard one and the 3D interface) + LPDIRECTSOUNDBUFFER Sound; + LPDIRECTSOUND3DBUFFER i3DSound; + + // Whether or not this frame is currently in orbit (and thus contained in a temporary frame) + BOOL bOrbiting; + // Whether or not this frame is a bullet (and thus has a bullet callback and dialog) + BOOL bBullet; + // A window handle associated with the orbiting/bullet state which controls speed, etc. + HWND hDlg; + + FRAMEAPPDATA() : Sound(NULL), i3DSound(NULL), bOrbiting(FALSE), bBullet(FALSE), hDlg(0) {}; + ~FRAMEAPPDATA() { + if (i3DSound) i3DSound->Release(); + if (Sound) Sound->Release(); + }; +}; +typedef FRAMEAPPDATA* LPFRAMEAPPDATA; + +// Interface to the D3DRM functions +LPDIRECT3DRM lpD3DRM = NULL; + +// Pointer to the Directsound API +LPDIRECTSOUND lpDS = NULL; + +// Clipper for the DDraw surface +LPDIRECTDRAWCLIPPER lpDDClipper = NULL; + +// Handle to the API's parent window (passed in Initialize) +HWND hwndParent; + +// Handle to our instance +HANDLE hinst; + +AppInfo* info; + +/* +** Globals used for editing what is in the D3DRM world +*/ + +// Selected frame (contains visual currently selected by user) +LPDIRECT3DRMFRAME sFrame = NULL; + +// Whether or not editing box should be shown around the selected object +BOOL showBoxes = FALSE; + +// Currently selected visual (if one is selected) +static LPDIRECT3DRMMESHBUILDER sVisual = NULL; + +// Currently selected light (if one is selected) +static LPDIRECT3DRMLIGHT sLight = NULL; + +// Box/Speaker cone to go around the selected item (if boxes are on and if there IS a speaker) +static LPDIRECT3DRMMESH selectionBox = NULL; +static LPDIRECT3DRMMESH selectionSpeaker = NULL; + +// Clipboard frame and visual allowing cutting and pasting +LPDIRECT3DRMFRAME clipboardFrame = NULL; +LPDIRECT3DRMVISUAL clipboardVisual = NULL; + +/* +** Globals for DirectSound3D +*/ + +// Listener information (connected to the camera) +LPDIRECTSOUND3DLISTENER lp3DListenerInfo; + +// Primary Buffer (we don't REALLY need a pointer to it but we keep it just in case) +LPDIRECTSOUNDBUFFER lpDSBuff; + +/* +************************ Internal function declarations **************************** +*/ + +// These are not part of the interface and are just used by the RLDS3D functions +static BOOL CreateDevice(HWND win, AppInfo* info); +HRESULT loadTextures(char *name, void *arg, LPDIRECT3DRMTEXTURE *tex); +char* LSTRRCHR( const char* lpString, int bChar ); +static void PlaceMesh(LPDIRECT3DRMMESHBUILDER mesh, AppInfo *info); +static BOOL CreateScene(AppInfo* info); +static BOOL RebuildDevice(HWND win, AppInfo* info, int width, int height); +static LPDIRECT3DRMMESHBUILDER makeBox(D3DRMBOX*); +void SelectVisual(LPDIRECT3DRMMESHBUILDER visual, LPDIRECT3DRMFRAME frame); +int ChooseNewColor(HWND, D3DCOLOR*); +void RemoveSoundRecord(LPDIRECT3DRMFRAME owner); +void releaseSoundCallback(LPDIRECT3DRMFRAME frame); +void StopOrbiting(LPDIRECT3DRMFRAME stopme); +void UpdateConeVisual(void); + +/* +*********************** Error checker functions ************************************ +*/ + +/* +** These are wrapped around DS or D3DRM calls to appropriately catch errors and handle them. +** +** The generalized cases are coded, callers can pass forced reactions to errors by using the force_critical variables +*/ + +/* +** In this code the general philosophy for when to use the viewer is when requesting anything from something outside the +** program. Thus, asking a frame which we know exists to accept an added visual doesn't get checked, but trying to create +** a new frame (which tries to allocate memory) is checked in case we've run out of free memory. +*/ + +BOOL D3DRM_SUCCEED(HRESULT result, int force_critical, char* info) { + if (result == D3DRM_OK) return TRUE; + // Could be 0 for non-critical, 1 for non-critical but reports it, or 2 for critical (notify and quit) + int priority = 0; + char* error_string; + switch (result) { + case D3DRMERR_BADALLOC: error_string = "Out of memory"; priority = 2; break; + case D3DRMERR_BADDEVICE: error_string = "Device is not compatible with renderer"; priority = 2; break; + case D3DRMERR_BADFILE: error_string = "Data file is corrupt"; priority = 2; break; + case D3DRMERR_BADMAJORVERSION: error_string = "Bad DLL major version"; priority = 2; break; + case D3DRMERR_BADMINORVERSION: error_string = "Bad DLL minor version"; priority = 2; break; + case D3DRMERR_BADOBJECT: error_string = "Object expected in argument"; priority = 2; break; + case D3DRMERR_BADTYPE: error_string = "Bad argument type passed"; priority = 1; break; + case D3DRMERR_BADVALUE: error_string = "Bad argument value passed"; priority = 1; break; + case D3DRMERR_FACEUSED: error_string = "Face already used in a mesh"; priority = 1; break; + case D3DRMERR_FILENOTFOUND: error_string = "File cannot be opened"; priority = 1; break; + case D3DRMERR_NOTDONEYET: error_string = "Unimplemented function called"; priority = 1; break; + case D3DRMERR_NOTFOUND: error_string = "Object not found in specified place"; priority = 1; break; + case D3DRMERR_UNABLETOEXECUTE: error_string = "Unable to carry out procedure"; priority = 2; break; + default: error_string = "D3DRM Error: Unable to continue"; priority = 2; break; + } + + int ret; + if (force_critical >= 0) priority = force_critical; + if (priority == 1) { + ret = MessageBox(hwndParent, error_string, "D3DRM Warning", MB_APPLMODAL|MB_ICONWARNING|MB_OK); + } + else if (priority == 2) { + ret = MessageBox(hwndParent, error_string, "D3DRM Fatal Error", MB_APPLMODAL|MB_ICONSTOP|MB_OK); + PostMessage(hwndParent, WM_CLOSE,0,0); + } + return FALSE; +} + +/* +** DS isn't vital for the viewer to run so error messages don't force a quit +*/ + +BOOL DS3D_SUCCEED(HRESULT result, int force_critical, char* info) { + if (result == DS_OK) return TRUE; + // Could be 0 for no message, 1 for non-critical (simply needs to report it), or 2 for critical (notify and quit) + int priority = 0; + char* error_string = NULL; + switch (result) { + case DSERR_ALLOCATED: error_string = "Requested resources already in use"; priority = 1; break; + case DSERR_ALREADYINITIALIZED: error_string = "Object already initialized"; priority = 0; break; + case DSERR_BADFORMAT: error_string = "Wave format not supported"; priority = 0; break; + case DSERR_BUFFERLOST: error_string = "Buffer lost and must be restored"; priority = 0; break; + case DSERR_CONTROLUNAVAIL: error_string = "Control requested not available"; priority = 0; break; + case DSERR_GENERIC: error_string = "Undetermined error"; priority = 1; break; + case DSERR_INVALIDCALL: error_string = "Invalid call for object's current state"; priority = 0; break; + case DSERR_INVALIDPARAM: error_string = "Invalid parameters passed to object"; priority = 0; break; + case DSERR_NOAGGREGATION: error_string = "Object does not support aggregation"; priority = 1; break; + case DSERR_NODRIVER: error_string = "No sound driver available"; priority = 1; break; +// case DSERR_NOINTERFACE: error_string = "Requested COM interface not available"; priority = 0; break; + case DSERR_OUTOFMEMORY: error_string = "Out of memory"; priority = 1; break; + case DSERR_PRIOLEVELNEEDED: error_string = "Caller does not have required priority level"; priority = 0; break; +// case DSERR_UNINITIALIZED: error_string = "DirectSound not initialized"; priority = 1; break; + case DSERR_UNSUPPORTED: error_string = "Unsupported function called"; priority = 0; break; + default: error_string = "Undetermined error"; priority = 1; break; + } + + int ret; + if (force_critical >= 0) priority = force_critical; + if (priority == 1) { + ret = MessageBox(hwndParent, error_string, "DS3D Warning", MB_APPLMODAL|MB_ICONWARNING|MB_OK); + } + else if (priority == 2) { + ret = MessageBox(hwndParent, error_string, "DS3D Fatal Error", MB_APPLMODAL|MB_ICONSTOP|MB_OK); + PostMessage(hwndParent, WM_CLOSE,0,0); + } + return FALSE; +} + + + + +/* +************************ INITIALIZATION/DEINITIALIZATION **************************** +*/ + +/* +** Initialize will attach itself to the passed window. Call initialize after +** getting a handle for your window but before you display it. +** +** Initialize will initialize the D3DRM API and return false if it fails. It will +** also attempt to initialize a DirectSound3D API, but failing this does not +** justify a failed Initialize (since the 3D sound isn't a necessary part of +** the viewer) +*/ + +BOOL RLDS3D_Initialize(HWND hwndPW, HANDLE this_inst) { + + if (!hwndPW) return FALSE; + + hinst = this_inst; + hwndParent = hwndPW; + + // D3DRM API INIT - we force non-critical warnings here because the initialization returns a boolean for success + + // Call Direct3DRMCreate to try to make a D3DRM object + if (!D3DRM_SUCCEED(Direct3DRMCreate(&lpD3DRM), 1)) return FALSE; + + + if (!D3DRM_SUCCEED(DirectDrawCreateClipper(0, &lpDDClipper, NULL),1)) { + lpD3DRM->Release(); + return FALSE; + } + + if (!D3DRM_SUCCEED(lpDDClipper->SetHWnd(0, hwndParent),1)) { + lpDDClipper->Release(); + lpD3DRM->Release(); + return FALSE; + } + + + // Set up D3DRM information structure + info = (AppInfo*) malloc(sizeof(AppInfo)); + if (!info) { + lpDDClipper->Release(); + lpD3DRM->Release(); + return FALSE; + } + + info->model = D3DCOLOR_MONO; + + // Calls our internal function to create a viewport and device and attach it to the window (CreateDevice in misc. functionality) + // (also fills in the global information structure "info" for what D3DRM can do and is currently doing) + if (CreateDevice(hwndParent, info) == FALSE) { + lpDDClipper->Release(); + lpD3DRM->Release(); + return FALSE; + } + + // DIRECTSOUND 3D INIT - note, if this fails the entire initialization is still OK. + + // Description for our primary buffer creation + DSBUFFERDESC dsbd; + + int ret = IDRETRY; + + // Try to create the Directsound objects until we either do it, are told to ignore it, or are told to abort + while (ret == IDRETRY) { + // Create the directsound object + if (DS3D_SUCCEED(DirectSoundCreate(NULL, &lpDS, NULL))) { + // Set cooperative level + if (DS3D_SUCCEED(lpDS->SetCooperativeLevel(hwndParent, DSSCL_PRIORITY))) { + // Create a primary buffer so we can query for a 3D Listener interface + memset(&dsbd, 0, sizeof(DSBUFFERDESC)); + dsbd.dwSize = sizeof(DSBUFFERDESC); + dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRL3D; + if (DS3D_SUCCEED(lpDS->CreateSoundBuffer(&dsbd, &lpDSBuff, NULL))) { + + // Make the primary 44.1 KHz so that it sounds better + WAVEFORMATEX wfx; + wfx.wFormatTag = WAVE_FORMAT_PCM; + wfx.nChannels = 2; + wfx.nSamplesPerSec = 44100; + wfx.nAvgBytesPerSec = 44100*2*2; + wfx.nBlockAlign = 4; + wfx.wBitsPerSample = 16; + wfx.cbSize = 0; + lpDSBuff->SetFormat(&wfx); + + // Get the 3D listener information (error currently ignored) + if (DS3D_SUCCEED(lpDSBuff->QueryInterface(IID_IDirectSound3DListener, (void**) &lp3DListenerInfo))) { + lp3DListenerInfo->SetDopplerFactor(D3DVAL(100.0), DS3D_IMMEDIATE); + } + else { + // Failed to get listener info + lpDSBuff->Release(); + lpDS->Release(); + lpDS = NULL; + } + } + else { + // Failed to create a primary buffer + lpDS->Release(); + lpDS = NULL; + } + } + else { + // Failed to set cooperative level + lpDS->Release(); + lpDS = NULL; + } + } + + // Warn that we could create the DirectSound object + if (!lpDS) { + ret = MessageBox(hwndParent, "DirectSound 3D could not initialize", "Warning", MB_APPLMODAL|MB_ICONWARNING|MB_ABORTRETRYIGNORE); + if (ret == IDABORT) { + lpDDClipper->Release(); + lpD3DRM->Release(); + return FALSE; + } + } + else ret = IDOK; + } + return TRUE; +} + +/* +** Deinitializes +*/ + +void RLDS3D_Deinitialize() { + // Releases the DSound interface... this is very important! + if (lpDS != NULL) { + lpDSBuff->Release(); + lpDS->Release(); + } + info->dev->Release(); + lpDDClipper->Release(); + lpD3DRM->Release(); + free(info); +} + +/* +******************************************** ADDING/REMOVING/EDITING OBJECTS ********************************* +*/ + +/* +** Loads XOF file into the RL world (with textures) +*/ + +void RLDS3D_LoadXOF(char* file) { + if (!file) return; + LPDIRECT3DRMMESHBUILDER builder = NULL; + if (D3DRM_SUCCEED(lpD3DRM->CreateMeshBuilder(&builder))) { + if (builder->Load(file, NULL, D3DRMLOAD_FROMFILE, loadTextures, NULL) != D3DRM_OK) { + MessageBox(hwndParent, "Unable to load file", "D3DRM Fatal Error", MB_APPLMODAL|MB_ICONEXCLAMATION|MB_OK); + builder->Release(); + return; + } + PlaceMesh(builder, info); + builder->Release(); + } +} + +/* +** Sets/Gets whether or not boxes are shown around selected item +*/ + +BOOL RLDS3D_GetBoxes(void) { + return showBoxes; +} + +void RLDS3D_SetBoxes(BOOL new_val) { + showBoxes = new_val; + // Re-selects the currently selected visual so that the box is generated/destroyed around it + RLDS3D_UpdateSelectionBox(); +} + +/* +** Updates the bounding box around the selected visual (this could be done using a render callback function to compare the +** frame's scaling and transform functions instead) +*/ + +void RLDS3D_UpdateSelectionBox(void) { + // When we select this visual, we destroy any existing box and create a new one around it if showBoxes is true. + SelectVisual(sVisual, sFrame); +} + +/* +** Deselects the currently selected 3D visual. +*/ + +void RLDS3D_DeselectVisual() +{ + // Removes the bounding box from around it if it's there + if (sFrame && selectionBox) { + sFrame->DeleteVisual(selectionBox); + sFrame->DeleteVisual(selectionSpeaker); + } + + + sFrame = NULL; + sLight = NULL; + sVisual = NULL; + selectionBox = NULL; + selectionSpeaker = NULL; +} + +/* +** Given coordinates it selects the first visual under those coordinates in the window's viewport +*/ + +void RLDS3D_FindAndSelectVisual(int x, int y, LPBOOL changed) { + LPDIRECT3DRMVISUAL visual; + LPDIRECT3DRMFRAME frame; + LPDIRECT3DRMPICKEDARRAY picked; + LPDIRECT3DRMFRAMEARRAY frames; + LPDIRECT3DRMMESHBUILDER mesh; + LPDIRECT3DRMVIEWPORT view = info->view; + + LPDIRECT3DRMFRAME oldframe = sFrame; + + /* + * Make sure we don't try to select the selection box of the current + * selection. + */ + RLDS3D_DeselectVisual(); + + view->Pick(x, y, &picked); + if (picked) + { if (picked->GetSize()) + { + // Get the top-level visual + picked->GetPick(0, &visual, &frames, 0); + // The frames that contain the visual are placed into a framearray in heiarchical order, take the + // last one (the one most closely associated with the visual) + frames->GetElement(frames->GetSize() - 1, &frame); + // We can only select meshes so we query the visual to make sure it is one + if (D3DRM_SUCCEED(visual->QueryInterface(IID_IDirect3DRMMeshBuilder, (void **) &mesh), 0)) + { + // If we're clicking on an orbiting frame then we need to stop it. + StopOrbiting(frame); + SelectVisual(mesh, frame); + mesh->Release(); + } + frame->Release(); + frames->Release(); + visual->Release(); + } + picked->Release(); + } + if (changed) { + if (sFrame == oldframe) *changed = FALSE; else *changed = TRUE; + } +} + +/* +** Cuts the current selection to the clipboard +*/ + +void RLDS3D_CutVisual() +{ + LPDIRECT3DRMFRAME frame; + + if (clipboardFrame) + clipboardFrame->Release(); + + if (sFrame) + { clipboardFrame = sFrame; + clipboardVisual = sVisual; + + // If a 3D sound is attached, remove it (sounds not carried to clipboard) + RemoveSoundRecord(clipboardFrame); + RLDS3D_DeselectVisual(); + + clipboardFrame->AddRef(); + clipboardFrame->GetParent(&frame); + if (frame) { + frame->DeleteChild(clipboardFrame); + frame->Release(); + } + } +} + +/* +** Copies the current selection to the clipboard +*/ + +void RLDS3D_CopyVisual() +{ + LPDIRECT3DRMFRAME frame; + + if (sFrame) + { + // Things could really foul up if the clones aren't created so we make sure they are + if (!D3DRM_SUCCEED(sFrame->Clone(0, IID_IDirect3DRMFrame, (void **) &clipboardFrame))) { + // If we've failed, we must make sure the clipboard is empty! + clipboardVisual->Release(); + clipboardVisual = NULL; + return; + } + + if (!D3DRM_SUCCEED(sVisual->Clone(0, IID_IDirect3DRMVisual, (void **) &clipboardVisual))) { + // If we've failed, we must make sure the clipboard is empty! + clipboardFrame->Release(); + clipboardFrame = NULL; + return; + } + + // If a 3D sound is attached, remove it (sounds not carried to clipboard) + RemoveSoundRecord(clipboardFrame); + + clipboardFrame->AddVisual(clipboardVisual); + clipboardVisual->Release(); + + clipboardFrame->GetParent(&frame); + if (frame) { + frame->DeleteChild(clipboardFrame); + frame->Release(); + } + } +} + +/* +** Pastes the current selection to the window +*/ + +void RLDS3D_PasteVisual() +{ + if (clipboardFrame) + { + LPDIRECT3DRMFRAME frame; + LPDIRECT3DRMVISUAL visual; + + if (!D3DRM_SUCCEED(clipboardFrame->Clone(0, IID_IDirect3DRMFrame, (void **) &frame))) return; + if (!D3DRM_SUCCEED(clipboardVisual->Clone(0, IID_IDirect3DRMVisual, (void **) &visual))) { + frame->Release(); + return; + } + + frame->AddVisual(visual); + info->scene->AddChild(frame); + visual->Release(); + frame->Release(); + } +} + +/* +** Deletes the current selection from the world without copying to the clipboard +*/ + +void RLDS3D_DeleteVisual() +{ + if (sFrame) { + LPDIRECT3DRMFRAME parent, frame; + // Make a copy of the selected frame ('cause deselecting it will make it inaccessible) + frame = sFrame; + // If a 3D sound is attached, remove it + RemoveSoundRecord(frame); + + // Deselect the frame (removes bounding box, etc, also sets sFrame to NULL) + RLDS3D_DeselectVisual(); + if (frame->GetAppData()) delete (FRAMEAPPDATA*)frame->GetAppData(); + frame->GetParent(&parent); + if (parent) { + parent->DeleteChild(frame); + parent->Release(); + } + } +} + +/* +** Add a directional light +*/ + +void RLDS3D_AddDirectionalLight() { + LPDIRECT3DRMMESHBUILDER builder; + LPDIRECT3DRMLIGHT light; + LPDIRECT3DRMFRAME frame; + + if (D3DRM_SUCCEED(lpD3DRM->CreateMeshBuilder(&builder))) { + if (D3DRM_SUCCEED(builder->Load("camera.x", NULL, D3DRMLOAD_FROMFILE, NULL, NULL))) { + builder->SetQuality(D3DRMRENDER_UNLITFLAT); + if (D3DRM_SUCCEED(lpD3DRM->CreateLightRGB(D3DRMLIGHT_DIRECTIONAL, D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0), &light))) { + if (D3DRM_SUCCEED(lpD3DRM->CreateFrame(info->scene, &frame))) { + frame->SetPosition(info->camera, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(10.0)); + frame->AddVisual(builder); + frame->AddLight(light); + frame->Release(); + } + light->Release(); + } + } + builder->Release(); + } +} + +/* +** Add a parallel point light +*/ + +void RLDS3D_AddParallelPointLight() { + LPDIRECT3DRMMESHBUILDER builder; + LPDIRECT3DRMLIGHT light; + LPDIRECT3DRMFRAME frame; + + if (D3DRM_SUCCEED(lpD3DRM->CreateMeshBuilder(&builder))) { + if (D3DRM_SUCCEED(builder->Load("sphere2.x", NULL, D3DRMLOAD_FROMFILE, NULL, NULL))) { + builder->SetQuality(D3DRMRENDER_UNLITFLAT); + builder->Scale(D3DVAL(0.2), D3DVAL(0.2), D3DVAL(0.2)); + if (D3DRM_SUCCEED(lpD3DRM->CreateLightRGB(D3DRMLIGHT_PARALLELPOINT, D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0), &light))) { + if (D3DRM_SUCCEED(lpD3DRM->CreateFrame(info->scene, &frame))) { + frame->SetPosition(info->camera, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(10.0)); + frame->AddVisual(builder); + frame->AddLight(light); + frame->Release(); + } + light->Release(); + } + } + builder->Release(); + } +} + +/* +** Add Point Light +*/ + +void RLDS3D_AddPointLight() { + LPDIRECT3DRMMESHBUILDER builder; + LPDIRECT3DRMLIGHT light; + LPDIRECT3DRMFRAME frame; + + if (D3DRM_SUCCEED(lpD3DRM->CreateMeshBuilder(&builder))) { + if (D3DRM_SUCCEED(builder->Load("sphere2.x", NULL, D3DRMLOAD_FROMFILE, NULL, NULL))) { + builder->SetQuality(D3DRMRENDER_UNLITFLAT); + builder->Scale(D3DVAL(0.2), D3DVAL(0.2), D3DVAL(0.2)); + if (D3DRM_SUCCEED(lpD3DRM->CreateLightRGB(D3DRMLIGHT_POINT, D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0), &light))) { + if (D3DRM_SUCCEED(lpD3DRM->CreateFrame(info->scene, &frame))) { + frame->SetPosition(info->camera, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(10.0)); + frame->AddVisual(builder); + frame->AddLight(light); + frame->Release(); + } + light->Release(); + } + } + builder->Release(); + } +} + +/* +** Add a spotlight +*/ + +void RLDS3D_AddSpotlight() { + LPDIRECT3DRMMESHBUILDER builder; + LPDIRECT3DRMLIGHT light; + LPDIRECT3DRMFRAME frame; + + if (D3DRM_SUCCEED(lpD3DRM->CreateMeshBuilder(&builder))) { + if (D3DRM_SUCCEED(builder->Load("camera.x", NULL, D3DRMLOAD_FROMFILE, NULL, NULL))) { + builder->SetQuality(D3DRMRENDER_UNLITFLAT); + if (D3DRM_SUCCEED(lpD3DRM->CreateLightRGB(D3DRMLIGHT_SPOT, D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0), &light))) { + if (D3DRM_SUCCEED(lpD3DRM->CreateFrame(info->scene, &frame))) { + frame->SetPosition(info->camera, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(10.0)); + frame->AddVisual(builder); + frame->AddLight(light); + frame->Release(); + } + light->Release(); + } + } + builder->Release(); + } +} + + +/* +*********************************** OBJECT MOTION/SCALING/COLORING **************************************** +*/ + +/* +** Chooses a new color and sets the selected object to it... handles the selection of the color, etc. +*/ + +void RLDS3D_SetSelColour(void) { + if (!sFrame) return; + LPDIRECT3DRMMESHBUILDER mesh; + + if (!D3DRM_SUCCEED(sVisual->QueryInterface(IID_IDirect3DRMMeshBuilder, (void**) &mesh),0)) return; + + if (sLight) + { + D3DCOLOR c = sLight->GetColor(); + + if (ChooseNewColor(hwndParent, &c)) { + mesh->SetColor(c); + sLight->SetColor(c); + } + } else { + D3DCOLOR c; + + if (mesh->GetFaceCount()) { + LPDIRECT3DRMFACEARRAY faces; + LPDIRECT3DRMFACE face; + mesh->GetFaces(&faces); + faces->GetElement(0, &face); + c = face->GetColor(); + face->Release(); + faces->Release(); + } else + c = D3DRMCreateColorRGB(D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)); + + if (ChooseNewColor(hwndParent, &c)) + mesh->SetColor(c); + } + + mesh->Release(); +} + + +/* +** Moves the camera relative to itself by providing scalars to multiply against the CAMERA-RELATIVE unit vectors +** forwards/up/right. +*/ + +void RLDS3D_SetCamVelRelToCam(D3DVALUE forward, D3DVALUE up, D3DVALUE right) { + D3DVECTOR vDir, vUp, vRight; + info->camera->GetOrientation(info->scene, &vDir, &vUp); + // Cross the UP vector and the RIGHT vector to get the FORWARDS vector + D3DRMVectorCrossProduct(&vRight, &vUp, &vDir); + info->camera->SetVelocity(info->scene, vDir.x*forward + vUp.x*up + vRight.x*right, + vDir.y*forward + vUp.y*up + vRight.y*right, + vDir.z*forward + vUp.z*up + vRight.z*right, + TRUE); +} + +/* +** Rotates the camera around its three axis +** +** forward_axis is roll, up_axis is yaw, right_axis is pitch +*/ + +void RLDS3D_SetCamRotForward(D3DVALUE forward_axis) { + info->camera->SetRotation(info->camera, 0.0f, 0.0f, 1.0f, forward_axis); +} + +void RLDS3D_SetCamRotUp(D3DVALUE up_axis) { + info->camera->SetRotation(info->camera, 0.0f, 1.0f, 0.0f, up_axis); +} + +void RLDS3D_SetCamRotRight(D3DVALUE right_axis) { + info->camera->SetRotation(info->camera, 1.0f, 0.0f, 0.0f, right_axis); +} + +/* +** Scales the currently selected object by the scale factors... +*/ + +void RLDS3D_ScaleSelected(D3DVALUE sx, D3DVALUE sy, D3DVALUE sz) { + if (!sFrame) return; + if (!sVisual) return; + RLDS3D_StopOrbitSelected(); + sVisual->Scale(sx, sy, sz); + RLDS3D_UpdateSelectionBox(); +} + +/* +** Moves the currently selected object in the 3D world relative to the camera +*/ + +void RLDS3D_SetSelectedVelRelToCam(D3DVALUE forward, D3DVALUE up, D3DVALUE right) { + if (!sFrame) return; + RLDS3D_StopOrbitSelected(); + D3DVECTOR vDir, vUp, vRight; + info->camera->GetOrientation(info->scene, &vDir, &vUp); + D3DRMVectorCrossProduct(&vRight, &vUp, &vDir); + sFrame->SetVelocity(info->scene, vDir.x*forward + vUp.x*up + vRight.x*right, + vDir.y*forward + vUp.y*up + vRight.y*right, + vDir.z*forward + vUp.z*up + vRight.z*right, + TRUE); +} + +/* +** Rotates the currently selected object relative to the camera's frame when passed +** a vector for the axis and an angle of rotation. +** This is useful because the AXIS which is specified is relative to what appears on the screen with it's origin at the camera +** (ie: (0,0,1) will be an axis straight into the screen and thus things will spin around the centre of the screen) +*/ + +void RLDS3D_SetSelectedRotRelToCam(D3DVALUE AxisX, D3DVALUE AxisY, D3DVALUE AxisZ, D3DVALUE angle) { + if (!sFrame) return; + RLDS3D_StopOrbitSelected(); + sFrame->SetRotation(info->camera, AxisX, AxisY, AxisZ, angle); +} + +/* +** Moves the currently selected object by x/y pixels on the screen from it's relative position. Allows a user +** to drag objects around the screen using the mouse. Assumes that the distance from the frame to the screen +** will remain constant +*/ + +void RLDS3D_MoveSelectedPosByScreenCoords(double delta_x, double delta_y) { + if (!sFrame) return; + RLDS3D_StopOrbitSelected(); + D3DVECTOR p1; + D3DRMVECTOR4D p2; + sFrame->GetPosition(info->scene, &p1); + info->view->Transform(&p2, &p1); + // returned value is in homogenous coords so we need to multiply by w to get vector coords + p2.x += D3DMultiply(D3DVAL((D3DVALUE)delta_x), p2.w); + p2.y += D3DMultiply(D3DVAL((D3DVALUE)delta_y), p2.w); + info->view->InverseTransform(&p1, &p2); + sFrame->SetPosition(info->scene, p1.x, p1.y, p1.z); +} + +void RLDS3D_GetDistanceFactor(D3DVALUE *temp) { + lp3DListenerInfo->GetDistanceFactor(temp); +} + +void RLDS3D_GetDopplerFactor(D3DVALUE *temp) { + lp3DListenerInfo->GetDopplerFactor(temp); +} + +void RLDS3D_GetRolloffFactor(D3DVALUE *temp) { + lp3DListenerInfo->GetRolloffFactor(temp); +} + +void RLDS3D_SetDistanceFactor(D3DVALUE temp) { + lp3DListenerInfo->SetDistanceFactor(temp, DS3D_IMMEDIATE); +} + +void RLDS3D_SetDopplerFactor(D3DVALUE temp) { + lp3DListenerInfo->SetDopplerFactor(temp, DS3D_IMMEDIATE); +} + +void RLDS3D_SetRolloffFactor(D3DVALUE temp) { + lp3DListenerInfo->SetRolloffFactor(temp, DS3D_IMMEDIATE); +} + +void RLDS3D_CommitDeferredSettings(void) { + lp3DListenerInfo->CommitDeferredSettings(); +} + +BOOL RLDS3D_SoundSelected(void) { + if (!lpDS) return FALSE; + if (!sFrame) return FALSE; + if (!sFrame->GetAppData()) return FALSE; + if (!((LPFRAMEAPPDATA)(sFrame->GetAppData()))->i3DSound) return FALSE; + return TRUE; +} + +void RLDS3D_GetSelConeAngles(LPDWORD inner, LPDWORD outer) { + if (!RLDS3D_SoundSelected) return; + ((LPFRAMEAPPDATA)(sFrame->GetAppData()))->i3DSound->GetConeAngles(inner, outer); +} + +void RLDS3D_GetSelConeOutsideVolume(LPLONG temp) { + if (!RLDS3D_SoundSelected) return; + ((LPFRAMEAPPDATA)(sFrame->GetAppData()))->i3DSound->GetConeOutsideVolume(temp); +} + +void RLDS3D_GetSelMinimumDistance(D3DVALUE *temp) { + if (!RLDS3D_SoundSelected) return; + ((LPFRAMEAPPDATA)(sFrame->GetAppData()))->i3DSound->GetMinDistance(temp); +} + +void RLDS3D_GetSelMaximumDistance(D3DVALUE *temp) { + if (!RLDS3D_SoundSelected) return; + ((LPFRAMEAPPDATA)(sFrame->GetAppData()))->i3DSound->GetMaxDistance(temp); +} + +void RLDS3D_SetSelConeAngles(DWORD inner, DWORD outer) { + if (!RLDS3D_SoundSelected) return; + ((LPFRAMEAPPDATA)(sFrame->GetAppData()))->i3DSound->SetConeAngles(inner, outer, DS3D_IMMEDIATE); + UpdateConeVisual(); +} + +void RLDS3D_SetSelConeOutsideVolume(LONG temp) { + if (!RLDS3D_SoundSelected) return; + ((LPFRAMEAPPDATA)(sFrame->GetAppData()))->i3DSound->SetConeOutsideVolume(temp, DS3D_IMMEDIATE); +} + +void RLDS3D_SetSelMinimumDistance(D3DVALUE temp) { + if (!RLDS3D_SoundSelected) return; + ((LPFRAMEAPPDATA)(sFrame->GetAppData()))->i3DSound->SetMinDistance(temp, DS3D_IMMEDIATE); +} + +void RLDS3D_SetSelMaximumDistance(D3DVALUE temp) { + if (!RLDS3D_SoundSelected) return; + ((LPFRAMEAPPDATA)(sFrame->GetAppData()))->i3DSound->SetMaxDistance(temp, DS3D_IMMEDIATE); +} + + + + + +/* +** Orbit control windows have a pointer to the orbiting frame attached to them. The frame, in return, has the handle of the window in it's +** frameappdata. When the window is used (the value modified/Stop Orbit button hit) the window modifies the frame and itself appropriately. +** When the frame is modified (ie: Destroyed) it passes messages to the window appropriately. +*/ + +/* +** Structure to store info about an orbit +*/ + +struct ORBITDATA { + LPDIRECT3DRMFRAME orbit_frame; + LPDIRECT3DRMFRAME child_frame; + D3DVECTOR axis; // Axis around which the orbit is going + D3DVALUE speed; // Speed (angles per second) +}; + +typedef ORBITDATA* LPORBITDATA; + +/* +** Structure to store info about a bullet, used by both the dialog box and the callback function +*/ + +struct BULLETDATA { + LPDIRECT3DRMFRAME bullet_frame; + D3DVECTOR vStartPosition; + D3DVECTOR vDirection; + D3DVALUE fSpeed; + D3DVALUE fTime; +}; + +typedef BULLETDATA* LPBULLETDATA; + +static void CDECL bulletCallback(LPDIRECT3DRMFRAME obj, void* arg, D3DVALUE delta) { + LPBULLETDATA binfo = (LPBULLETDATA)arg; + if (binfo->fTime <= D3DVAL(0.0)) { + binfo->fTime = D3DVAL(10.0); // Ten seconds, 5 for before and 5 for after. + D3DVALUE mult = D3DDivide(D3DMultiply(binfo->fTime, binfo->fSpeed), D3DVAL(-2.0)); // Calculate the displacement multiplier for calculating starting position + obj->SetPosition(info->scene, binfo->vStartPosition.x + D3DMultiply(mult, binfo->vDirection.x), + binfo->vStartPosition.y + D3DMultiply(mult, binfo->vDirection.y), + binfo->vStartPosition.z + D3DMultiply(mult, binfo->vDirection.z)); + } + else binfo->fTime -= delta; +} + + +/* +** Stops the passed frame from orbiting or from bulleting +*/ + +void StopOrbiting(LPDIRECT3DRMFRAME stopme) { + // If it isn't orbiting we don't need to stop it! + if (!stopme) return; + if (!stopme->GetAppData()) return; + FRAMEAPPDATA* data = (FRAMEAPPDATA*)stopme->GetAppData(); + if (data->bOrbiting) { + if (data->hDlg) { + // We explicitly call EndDialog on the orbit's control without sending it any message. As a result we have + // to grab it's associated orbitdata and delete it ourselves. + LPORBITDATA orbit_data = (LPORBITDATA)GetWindowLong(data->hDlg, DWL_USER); + if (orbit_data) delete orbit_data; + EndDialog(data->hDlg, TRUE); + } + + // Get its parent + LPDIRECT3DRMFRAME parent; + stopme->GetParent(&parent); + + // Put this frame back into the scene frame (this assumes that's where it came from) + info->scene->AddChild(stopme); + + // The parent frame of an orbiting visual is only around to make the object orbit, so we don't need it + parent->Release(); + data->bOrbiting = FALSE; + data->hDlg = 0; + } + if (data->bBullet) { + if (data->hDlg) { + LPBULLETDATA bullet_data = (LPBULLETDATA)GetWindowLong(data->hDlg, DWL_USER); + stopme->SetPosition(info->scene, bullet_data->vStartPosition.x, bullet_data->vStartPosition.y, bullet_data->vStartPosition.z); + if (bullet_data) delete bullet_data; + EndDialog(data->hDlg, TRUE); + stopme->DeleteMoveCallback(bulletCallback, bullet_data); + } + stopme->SetVelocity(info->scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), TRUE); + data->bBullet = FALSE; + data->hDlg = 0; + } +} + +void RLDS3D_StopOrbitSelected() { + StopOrbiting(sFrame); +} + +/* +** Windows procedure for the orbit dialog box +*/ + +BOOL CALLBACK OrbitDlgProc(HWND win, UINT msg, WPARAM wparam, LPARAM lparam) +{ + lparam = lparam; + + LPORBITDATA my_data = (ORBITDATA*)GetWindowLong(win, DWL_USER); + char lpszTS[100]; + + switch (msg) + { + case WM_INITDIALOG: + // We've set it up to pass in the pointer to our case-specific data (through WM_INITDIALOG) + // so we tuck it away for later use. This points to the ORBITDATA structure associated with + // this dialog box + SetWindowLong(win, DWL_USER, lparam); + sprintf(lpszTS, "%f", ((LPORBITDATA)lparam)->speed); + SendDlgItemMessage(win, IDC_ORBIT, WM_SETTEXT, 0, (LPARAM) lpszTS); + SendDlgItemMessage(win, IDC_ORBIT, EM_SETLIMITTEXT, 100, 0); + return TRUE; + + case WM_COMMAND: + { + if (wparam == IDOK) { + // Stopping the orbit will end the dialog for us. + StopOrbiting(my_data->child_frame); + return TRUE; + } + else if (HIWORD(wparam) == EN_UPDATE && LOWORD(wparam) == IDC_ORBIT) { + // Get string length + int stringlength = SendDlgItemMessage(win, IDC_ORBIT, EM_LINELENGTH, 0, 0); + // Check to make sure the string isn't too long - atof accepts up to 100 chars + if (stringlength > 99) return TRUE; + lpszTS[0] = (char)stringlength; + // Get string + SendDlgItemMessage(win, IDC_ORBIT, EM_GETLINE, 0, (LPARAM) lpszTS); + lpszTS[stringlength] = 0; + // Store speed and set new rotation + my_data->speed = D3DVAL(atof(lpszTS)); + my_data->orbit_frame->SetRotation(info->scene, my_data->axis.x, my_data->axis.y, my_data->axis.z, my_data->speed); + return TRUE; + } + else return FALSE; + } + break; + } + return FALSE; +} + +/* +** Windows proc for the bullet dialog box +*/ + +BOOL CALLBACK BulletDlgProc(HWND win, UINT msg, WPARAM wparam, LPARAM lparam) +{ + lparam = lparam; + + LPBULLETDATA my_data = (BULLETDATA*)GetWindowLong(win, DWL_USER); + char lpszTS[100]; + + switch (msg) + { + case WM_INITDIALOG: + // We've set it up to pass in the pointer to our case-specific data (through WM_INITDIALOG) + // so we tuck it away for later use. This points to the ORBITDATA structure associated with + // this dialog box + SetWindowLong(win, DWL_USER, lparam); + sprintf(lpszTS, "%f", ((LPBULLETDATA)lparam)->fSpeed); + SendDlgItemMessage(win, IDC_BULLET, WM_SETTEXT, 0, (LPARAM) lpszTS); + SendDlgItemMessage(win, IDC_BULLET, EM_SETLIMITTEXT, 100, 0); + return TRUE; + + case WM_COMMAND: + { + if (wparam == IDOK) { + // Stopping the orbit will end the dialog for us. + StopOrbiting(my_data->bullet_frame); + return TRUE; + } + else if (HIWORD(wparam) == EN_UPDATE && LOWORD(wparam) == IDC_BULLET) { + // Get string length + int stringlength = SendDlgItemMessage(win, IDC_BULLET, EM_LINELENGTH, 0, 0); + // Check to make sure the string isn't too long - atof accepts up to 100 chars + if (stringlength > 99) return TRUE; + lpszTS[0] = (char)stringlength; + // Get string + SendDlgItemMessage(win, IDC_BULLET, EM_GETLINE, 0, (LPARAM) lpszTS); + lpszTS[stringlength] = 0; + + // Store speed and set + my_data->fSpeed = D3DVAL(atof(lpszTS)); + my_data->bullet_frame->SetVelocity(info->scene, D3DMultiply(my_data->vDirection.x, my_data->fSpeed), + D3DMultiply(my_data->vDirection.y, my_data->fSpeed), + D3DMultiply(my_data->vDirection.z, my_data->fSpeed), + TRUE); + return TRUE; + } + else return FALSE; + } + break; + } + return FALSE; +} + + + +/* +** Orbits the currently selected object around the camera... creates a frame which is centred at the camera and contains +** the selected frame, and then rotates that frame around the camera +*/ + +ULONG orbit_num = 1; + +void RLDS3D_OrbitSelected(void) { + if (!sFrame) return; + StopOrbiting(sFrame); + FRAMEAPPDATA* tempdat; + + // Need to create orbit data, if not then can't orbit + LPORBITDATA orbitdat = new ORBITDATA; + if (!orbitdat) return; + + if (!sFrame->GetAppData()) { + tempdat = new FRAMEAPPDATA(); + if (!tempdat) return; + sFrame->SetAppData((ULONG)(tempdat)); + } + else { + tempdat = (LPFRAMEAPPDATA)sFrame->GetAppData(); + } + + // Create a frame. Centre it around the camera. Add the selected frame. Rotate it! + LPDIRECT3DRMFRAME orbiting_frame; + + if (!D3DRM_SUCCEED(lpD3DRM->CreateFrame(info->scene, &orbiting_frame))) return; + + orbiting_frame->SetPosition(info->camera, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)); + orbiting_frame->SetOrientation(info->camera, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0)); + orbiting_frame->AddChild(sFrame); + + D3DVECTOR vDir, vUp; + info->camera->GetOrientation(info->scene, &vDir, &vUp); + + // Store orbit info + orbitdat->orbit_frame = orbiting_frame; + orbitdat->child_frame = sFrame; + orbitdat->speed = D3DVAL(1.0); + orbitdat->axis.x = vUp.x; + orbitdat->axis.y = vUp.y; + orbitdat->axis.z = vUp.z; + + orbiting_frame->SetRotation(info->scene, vUp.x, vUp.y, vUp.z, orbitdat->speed); + + // Set the boolean in the frame's appinfo to tell everyone it's orbiting + tempdat->bOrbiting = TRUE; + + // Create a dialog box and orbitinfo so that this thing has something to control it + HWND mydial = CreateDialogParam(hinst, "OrbitBox", hwndParent, (int(__stdcall*)(void))OrbitDlgProc, (LONG)orbitdat); + if (mydial) { + char name_string[50]; + sprintf(name_string, "Orbit #%i", orbit_num++); + SetWindowText(mydial, name_string); + ShowWindow(mydial, SW_SHOW); + UpdateWindow(mydial); + tempdat->hDlg = mydial; + } +} + +/* +** Bullet the currently selected object. Bullets have two properties: Speed and bullet-time. The bullet passes through it's original +** position along the path defined by the viewer's original viewpoint (it heads towards the viewer). It takes 5 seconds to get to the +** viewer and five seconds once past the viewer, and continues doing thus until the bullet is stopped. Speed is controlled by the user. +*/ + +ULONG bullet_num = 1; + +void RLDS3D_BulletSelected(void) { + if (!sFrame) return; + StopOrbiting(sFrame); + + FRAMEAPPDATA* tempdat; + if (!sFrame->GetAppData()) { + tempdat = new FRAMEAPPDATA(); + if (!tempdat) return; + sFrame->SetAppData((ULONG)(tempdat)); + } + else { + tempdat = (LPFRAMEAPPDATA)sFrame->GetAppData(); + } + + // Create a new bullet object and attach our callback to the frame (it will release itself and put itself back + // into position when it's done!) + + LPBULLETDATA bs = new BULLETDATA; + if (!bs) return; + + sFrame->GetPosition(info->scene, &(bs->vStartPosition)); + + D3DVECTOR vDir, vUp; + info->camera->GetOrientation(info->scene, &vDir, &vUp); + // velocity heading towards camera + bs->vDirection.x = -vDir.x; + bs->vDirection.y = -vDir.y; + bs->vDirection.z = -vDir.z; + + bs->bullet_frame = sFrame; + bs->fTime = D3DVAL(10.0); // Ten seconds, 5 for before and 5 for after. + bs->fSpeed = D3DVAL(10.0); + + D3DVALUE mult = D3DDivide(D3DMultiply(bs->fTime, bs->fSpeed), D3DVAL(-2.0)); // Calculate the displacement multiplier for calculating starting position + + sFrame->SetPosition(info->scene, bs->vStartPosition.x + D3DMultiply(mult, bs->vDirection.x), + bs->vStartPosition.y + D3DMultiply(mult, bs->vDirection.y), + bs->vStartPosition.z + D3DMultiply(mult, bs->vDirection.z)); + + sFrame->SetVelocity(info->scene, D3DMultiply(bs->vDirection.x, bs->fSpeed), + D3DMultiply(bs->vDirection.y, bs->fSpeed), + D3DMultiply(bs->vDirection.z, bs->fSpeed), + TRUE); + + sFrame->AddMoveCallback(bulletCallback, (void*)bs); + + // Set the boolean in the frame's appinfo to tell everyone it's orbiting + tempdat->bBullet = TRUE; + + // Create a dialog box and orbitinfo so that this thing has something to control it + HWND mydial = CreateDialogParam(hinst, "BulletBox", hwndParent, (int(__stdcall*)(void))BulletDlgProc, (LONG)bs); + if (mydial) { + char name_string[50]; + sprintf(name_string, "Bullet #%i", bullet_num++); + SetWindowText(mydial, name_string); + ShowWindow(mydial, SW_SHOW); + UpdateWindow(mydial); + tempdat->hDlg = mydial; + } +} + +/* +********************************** DIRECTSOUND 3D FUNCTIONS ***************************************** +*/ + +/* +** The RLDS3D interface allows you to attach sound(s) to the selected object which can then be played and +** whose 3D audio position will update according to the RL object's position +** +** Some functionality is applied to all sounds, and as a result, the RLDS3D interface keeps a record of +** existing sounds and which frames they are attached to. Removal of a frame and/or a sound updates these +** records +*/ + +/* +** CALLBACKS - update position as 3D objects move around +*/ + + +// The listener callback is attached to the camera. This is done in CreateScene() +static void CDECL listenerCallback(LPDIRECT3DRMFRAME obj, void* arg, D3DVALUE delta) +{ + arg = arg; + if (!lpDS) return; + D3DVECTOR rlvCameraInfo, rlvCameraUp; + + info->camera->GetPosition(info->scene, &rlvCameraInfo); + lp3DListenerInfo->SetPosition(rlvCameraInfo.x, rlvCameraInfo.y, + rlvCameraInfo.z, DS3D_DEFERRED); + + info->camera->GetOrientation(info->scene, &rlvCameraInfo, &rlvCameraUp); + lp3DListenerInfo->SetOrientation(rlvCameraInfo.x, rlvCameraInfo.y, + rlvCameraInfo.z, rlvCameraUp.x, + rlvCameraUp.y, rlvCameraUp.z, DS3D_DEFERRED); + + info->camera->GetVelocity(info->scene, &rlvCameraInfo, TRUE); + lp3DListenerInfo->SetVelocity(rlvCameraInfo.x, rlvCameraInfo.y, + rlvCameraInfo.z, DS3D_DEFERRED); + + lp3DListenerInfo->CommitDeferredSettings(); +} + + +// Sounds are updated whenever their frame moves using Render Callbacks. This is the callback function. +static void CDECL soundCallback(LPDIRECT3DRMFRAME obj, void* arg, D3DVALUE delay) +{ + arg = arg; + LPDIRECT3DRMFRAME tFrame = (LPDIRECT3DRMFRAME)obj; + if (!lpDS) return; + // Get the sound from the frame's app data + LPFRAMEAPPDATA lpAppDat = (LPFRAMEAPPDATA)tFrame->GetAppData(); + if (!lpAppDat) return; + // Get the 3D sound buffer and remove the sound callback if it's NULL since it shouldn't exist + if (!lpAppDat->Sound || !lpAppDat->i3DSound) { + releaseSoundCallback(tFrame); + return; + } + D3DVECTOR rlvVisualInfo, rlvVisualUp; + + tFrame->GetPosition(info->scene, &rlvVisualInfo); + lpAppDat->i3DSound->SetPosition(rlvVisualInfo.x, rlvVisualInfo.y, + rlvVisualInfo.z, DS3D_DEFERRED); + + tFrame->GetOrientation(info->scene, &rlvVisualInfo, &rlvVisualUp); + lpAppDat->i3DSound->SetConeOrientation(rlvVisualInfo.x, rlvVisualInfo.y, + rlvVisualInfo.z, DS3D_DEFERRED); + + tFrame->GetVelocity(info->scene, &rlvVisualInfo, TRUE); + lpAppDat->i3DSound->SetVelocity(rlvVisualInfo.x, rlvVisualInfo.y, + rlvVisualInfo.z, DS3D_DEFERRED); + + lp3DListenerInfo->CommitDeferredSettings(); +} + +// This adds a sound callback function to a frame +void setSoundCallback(LPDIRECT3DRMFRAME frame) { + frame->AddMoveCallback(soundCallback, NULL); +} + +// Removes a sound callback from a frame +void releaseSoundCallback(LPDIRECT3DRMFRAME frame) { + frame->DeleteMoveCallback(soundCallback, NULL); +} + +/* +** Sound records - keeps track of which frames have sounds associated with them and +** adds/removes the sounds as required. +*/ + +struct SoundRecord { + LPDIRECT3DRMFRAME lpFrame; + SoundRecord* next; +}; + +SoundRecord* top = NULL; + +BOOL Recurse_Remove(LPDIRECT3DRMFRAME owner, SoundRecord* record) { + if (!record) return FALSE; + if (Recurse_Remove(owner, record->next)) { + SoundRecord* temp = record->next; + record->next = temp->next; + delete temp; + } + if (owner == record->lpFrame) return TRUE; + return FALSE; +} + +// Removes a frame from the records +void RemoveSoundRecord(LPDIRECT3DRMFRAME owner) { + if (!owner) return; + + // Don't bother deleting frames without appdata and a sound associated with them + // because they SHOULDN'T be on the list. + if (!owner->GetAppData()) return; + LPFRAMEAPPDATA data = (LPFRAMEAPPDATA)(owner->GetAppData()); + if (!data->Sound) return; + + // Release the sound and remove the soundrecord from the list. + data->i3DSound->Release(); + data->i3DSound = NULL; + data->Sound->Release(); + data->Sound = NULL; + releaseSoundCallback(owner); + + if (Recurse_Remove(owner, top)) { + SoundRecord* temp = top; + top = top->next; + delete temp; + } +} + +// Adds a frame to the records +void AddSoundRecord(LPDIRECT3DRMFRAME owner, char* sound_filename) { + if (!lpDS) return; + if (!owner) return; + if (!sound_filename) return; + + // Removes all previous sounds from this frame + RemoveSoundRecord(owner); + + // Create frame data for this frame if it hasn't already been done + LPFRAMEAPPDATA data = (LPFRAMEAPPDATA)(owner->GetAppData()); + if (!data) { + data = new FRAMEAPPDATA(); + if (!data) return; + owner->SetAppData((ULONG)data); + } + + // Create the sound and attach it to the frame + data->Sound = DSLoad3DSoundBuffer(lpDS, sound_filename); + if (!data->Sound) return; + + // Query to get the 3D interface, destroy the sound buffer if it's not available... + data->Sound->QueryInterface(IID_IDirectSound3DBuffer, (void**)&data->i3DSound); + if (!data->i3DSound) { + data->Sound->Release(); + data->Sound = NULL; + return; + } + + // Set the minimum distance at which the sound's amplitude should decay. + data->i3DSound->SetMinDistance((D3DVALUE)10.0, DS3D_IMMEDIATE); + + setSoundCallback(owner); + + SoundRecord* temp = new SoundRecord; + temp->next = top; + top = temp; + top->lpFrame = owner; +} + +/* +** Functionality for users +*/ + +// Stops all the sounds in the world. (Actually, only in the local RL world.) +// Runs through the records of all the sounds and stops them. +void RLDS3D_StopAllSounds() { + if (!lpDS) return; + SoundRecord* temp = top; + while (temp) { + LPFRAMEAPPDATA data = (LPFRAMEAPPDATA)(temp->lpFrame->GetAppData()); + if (data) { + if (data->Sound) data->Sound->Stop(); + } + temp = temp->next; + } +} + +// Removes all sounds in the world +void RLDS3D_RemoveAllSounds() { + if (!lpDS) return; + while (top) RemoveSoundRecord(top->lpFrame); + UpdateConeVisual(); +} + +// Plays the sound associated with the currently selected object +void RLDS3D_PlaySound(BOOL bIsLooping) { + if (!sFrame) return; + if (!lpDS) return; + LPFRAMEAPPDATA lpAppDat = (LPFRAMEAPPDATA)sFrame->GetAppData(); + if (lpAppDat) { + if (lpAppDat->Sound) { + lpAppDat->Sound->Stop(); + lpAppDat->Sound->SetCurrentPosition(0); + if (bIsLooping) { + lpAppDat->Sound->Play(0,0,DSBPLAY_LOOPING); + } + else { + lpAppDat->Sound->Play(0,0,0); + } + } + } +} + +// Stops the sound associated with the currently selected object +void RLDS3D_StopSelectedSound() { + if (!sFrame) return; + if (!lpDS) return; + LPFRAMEAPPDATA lpAppDat = (LPFRAMEAPPDATA)sFrame->GetAppData(); + if (lpAppDat) { + if (lpAppDat->Sound) { + lpAppDat->Sound->Stop(); + } + } +} + +// Removes the sound from the currently selected object +void RLDS3D_RemoveSound() { + RLDS3D_StopSelectedSound(); + if (!sFrame) return; + if (!lpDS) return; + RemoveSoundRecord(sFrame); + UpdateConeVisual(); +} + +// Attaches a sound (filename provided) to the selected frame +void RLDS3D_AttachSound(char* filename) { + // Removes the sound attached to the currently selected item (if it exists) + RLDS3D_RemoveSound(); + if (!sFrame) return; + if (!lpDS) return; + AddSoundRecord(sFrame, filename); + UpdateConeVisual(); +} + +/* +************************************* MISC. MAINTENANCE FUNCTIONS ************************************** +*/ + +/* +** Allows external users access to the RL Device to deal with Windows-related issues +** (See case WM_ACTIVATE: and case WM_PAINT: in viewer source for examples of HandleActivate() and HandlePaint()) +** Design note: This was done to save time from the conversion from the old version of the viewer rather than +** having RLDS3D_HandleActivate(), etc. +*/ + +LPDIRECT3DRMDEVICE RLDS3D_WinDevice() { + if (!info) return NULL; + return info->dev; +} + +/* +** Handles activation messages from the window +*/ + +void RLDS3D_HandleActivate(WPARAM wparam) { + if (!info || !info->dev) return; + LPDIRECT3DRMWINDEVICE windev; + if (D3DRM_SUCCEED(info->dev->QueryInterface(IID_IDirect3DRMWinDevice, (void **) &windev))) { + windev->HandleActivate(wparam); + windev->Release(); + } +} + +/* +** Handles paint messages from the window - the paintstruct which BeginPaint has been called on is +** passed to it +*/ + +void RLDS3D_HandlePaint(PAINTSTRUCT* ps) { + if (!info) return; + LPDIRECT3DRMWINDEVICE windev; + if (D3DRM_SUCCEED(info->dev->QueryInterface(IID_IDirect3DRMWinDevice, (void **) &windev))) { + windev->HandlePaint(ps->hdc); + windev->Release(); + } +} + +/* +** Tells whether or not sound is initialized +*/ + +BOOL RLDS3D_SoundInitialized() { + if (lpDS) return TRUE; + return FALSE; +} + +/* +** Tells whether or not a frame is selected +*/ + +BOOL RLDS3D_FrameSelected() { + if (sFrame) return TRUE; + return FALSE; +} + +/* +** Render the scene into the viewport. +*/ + +void RLDS3D_Render(D3DVALUE time_delta) +{ + // When the WM_SIZE message passes 0's as size to the ResizeViewport we know that it's minimized, in which case we don't render it. + if (info->bMinimized == TRUE) return; + D3DRM_SUCCEED(info->scene->Move(time_delta)); + D3DRM_SUCCEED(info->view->Clear()); + D3DRM_SUCCEED(info->view->Render(info->scene)); + D3DRM_SUCCEED(info->dev->Update()); +} + + +/* + * Resize the viewport and device when the window size changes. + */ +void RLDS3D_ResizeViewport(int width, int height) +{ + int view_width = info->view->GetWidth(); + int view_height = info->view->GetHeight(); + int dev_width = info->dev->GetWidth(); + int dev_height = info->dev->GetHeight(); + + if (!(width && height)) { + info->bMinimized = TRUE; + return; + + } + else info->bMinimized = FALSE; + + if (view_width == width && view_height == height) + return; + else info->bMinimized = FALSE; + + if (width <= dev_width && height <= dev_height) { + info->view->Release(); + D3DRM_SUCCEED(lpD3DRM->CreateViewport(info->dev, info->camera, 0, 0, width, height, &info->view)); + info->view->SetBack(D3DVAL(400.0)); + } + + int ret; + if (!RebuildDevice(hwndParent, info, width, height)) { + ret = MessageBox(hwndParent, "Unable to create Direct3D device", "D3DRM Fatal Error", MB_APPLMODAL|MB_ICONSTOP|MB_OK); + PostMessage(hwndParent, WM_CLOSE,0,0); + }; +} + +/* +** Sets/Gets the polygon fill mode +*/ + +D3DRMFILLMODE RLDS3D_GetPolygonFillMode(void) { + return (D3DRMFILLMODE)(info->dev->GetQuality() & D3DRMFILL_MASK); +} + +void RLDS3D_SetPolygonFillMode(D3DRMFILLMODE quality) { + D3DRMRENDERQUALITY oldq = info->dev->GetQuality(); + oldq = (oldq & ~D3DRMFILL_MASK) | quality; + info->dev->SetQuality(oldq); +} + +/* +** Sets/Gets the polygon shading mode +*/ + +D3DRMSHADEMODE RLDS3D_GetPolygonShadeMode(void) { + return (D3DRMSHADEMODE)(info->dev->GetQuality() & D3DRMSHADE_MASK); +} + +void RLDS3D_SetPolygonShadeMode(D3DRMSHADEMODE quality) { + D3DRMRENDERQUALITY oldq = info->dev->GetQuality(); + oldq = (oldq & ~D3DRMSHADE_MASK) | quality; + info->dev->SetQuality(oldq); +} + + +/* +** Sets/Gets the color model for the viewport (RGB or mono (256-color-based)) +*/ + +D3DRMCOLORMODEL RLDS3D_GetColourModel(void) { + return info->model; +} + +void RLDS3D_SetColourModel(D3DRMCOLORMODEL model) { + info->model = model; + int ret; + if (!RebuildDevice(hwndParent, info, info->dev->GetWidth(), info->dev->GetHeight())) { + ret = MessageBox(hwndParent, "Unable to selected Direct3D device", "D3DRM Fatal Error", MB_APPLMODAL|MB_ICONSTOP|MB_OK); + PostMessage(hwndParent, WM_CLOSE,0,0); + } +} + +/* +** Sets/Gets whether or not lighting is on +*/ + +BOOL RLDS3D_GetLighting(void) { + D3DRMLIGHTMODE mode = (D3DRMLIGHTMODE)(info->dev->GetQuality() & D3DRMLIGHT_MASK); + if (mode == D3DRMLIGHT_ON) return TRUE; + return FALSE; +} + +void RLDS3D_SetLighting(BOOL new_val) { + D3DRMRENDERQUALITY qual = info->dev->GetQuality() & ~D3DRMLIGHT_MASK; + if (new_val) qual |= D3DRMLIGHT_ON; else qual |= D3DRMLIGHT_OFF; + info->dev->SetQuality(qual); +} + +/* +** Sets/Gets whether or not dithering is on +*/ + +BOOL RLDS3D_GetDither(void) { + return info->dev->GetDither(); +} + +void RLDS3D_SetDither(BOOL dither) { + info->dev->SetDither(dither); +} + +/* +** Sets/Gets texture quality (only relevant for RGB modes) +*/ + +D3DRMTEXTUREQUALITY RLDS3D_GetTextureQuality(void) { + return info->dev->GetTextureQuality(); +} + +void RLDS3D_SetTextureQuality(D3DRMTEXTUREQUALITY new_quality) { + info->dev->SetTextureQuality(new_quality); +} + + +/* +************************************* INTERNAL FUNCTIONS (Not part of API) ******************************** +*/ + +/* +** Given a bounding box this generates a visual representation of it using rods and cones +*/ + +static LPDIRECT3DRMMESHBUILDER makeBox(D3DRMBOX* box) +{ + LPDIRECT3DRMMESHBUILDER mesh; + static D3DVECTOR zero = {D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)}; + static D3DVECTOR dir = {D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)}; + D3DVECTOR a, b; + + if (!D3DRM_SUCCEED(lpD3DRM->CreateMeshBuilder(&mesh))) return NULL; + + dir.z = box->max.z + D3DVAL(1.0); + AddRod(mesh, D3DVAL(0.05), zero, dir); + a = dir; + a.z += D3DVAL(0.6); + AddCone(mesh, D3DVAL(0.2), dir, a); + a = box->min; + b = a; + b.y = box->max.y; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.x = box->max.x; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.y = box->min.y; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.x = box->min.x; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.z = box->max.z; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.x = box->max.x; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.y = box->max.y; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.x = box->min.x; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.y = box->min.y; + AddRod(mesh, D3DVAL(0.05), a, b); + b.y = box->max.y; a = b; b.z = box->min.z; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b = box->max; b.z = box->min.z; + AddRod(mesh, D3DVAL(0.05), a, b); + a.y = box->min.y; b = a; b.z = box->min.z; + AddRod(mesh, D3DVAL(0.05), a, b); + + if (!D3DRM_SUCCEED(mesh->SetColor(D3DRMCreateColorRGB(D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0))))) { + mesh->Release(); + return NULL; + } + return mesh; +} + +/* +** Given a box, this creates a mesh in the shape of a 16-sided speaker cone aimed forward with requested angle +*/ + +#define CONE_POINTS 16 +#define pi 3.14159 + +static LPDIRECT3DRMMESHBUILDER makeSpeaker(D3DRMBOX* box, D3DVALUE in_angle) { + if (!box) return NULL; + + D3DVALUE angle = in_angle / D3DVAL(2.0); + DWORD* speaker_faces = new DWORD[CONE_POINTS*4+1]; + if (!speaker_faces) return NULL; + memset(speaker_faces, 0, sizeof(DWORD[CONE_POINTS*4+1])); + + LPDIRECT3DRMMESHBUILDER mesh; + if (!D3DRM_SUCCEED(lpD3DRM->CreateMeshBuilder(&mesh))) { + delete speaker_faces; + return NULL; + } + + static D3DVECTOR zero = {D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)}; + + D3DVECTOR v[CONE_POINTS+1]; + + // center of the cone + v[CONE_POINTS] = zero; + + int looper; + + // Angle along XZ plane which is rotated CONE_POINT times to form cone + D3DVECTOR base_angle; + base_angle.z = (box->max.z + D3DVAL(2.0)) * (D3DVALUE)cos(angle * pi / 180.0); + base_angle.x = (box->max.z + D3DVAL(2.0)) * (D3DVALUE)sin(angle * pi / 180.0); + base_angle.y = D3DVAL(0.0); + + for (looper=0; looper<CONE_POINTS; looper++) { + v[looper].z = base_angle.z; + v[looper].x = base_angle.x * (D3DVALUE)cos((looper*2*pi)/CONE_POINTS); + v[looper].y = base_angle.x * (D3DVALUE)sin((looper*2*pi)/CONE_POINTS); + speaker_faces[looper*4] = 3; + speaker_faces[looper*4+1] = looper % CONE_POINTS; + speaker_faces[looper*4+2] = (looper + 1) % CONE_POINTS; + speaker_faces[looper*4+3] = CONE_POINTS; + } + + v[CONE_POINTS] = zero; + + if (!D3DRM_SUCCEED(mesh->AddFaces(CONE_POINTS+1, v, 0, NULL, speaker_faces, NULL))) { + delete speaker_faces; + mesh->Release(); + return NULL; + } + + for (looper=0; looper<CONE_POINTS; looper++) { + speaker_faces[looper*4+2] = looper % CONE_POINTS; + speaker_faces[looper*4+1] = (looper + 1) % CONE_POINTS; + } + + if (!D3DRM_SUCCEED(mesh->AddFaces(CONE_POINTS+1, v, 0, NULL, speaker_faces, NULL))) { + delete speaker_faces; + mesh->Release(); + return NULL; + } + + delete speaker_faces; + + if (!D3DRM_SUCCEED(mesh->SetColor(D3DRMCreateColorRGB(D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0))))) { + mesh->Release(); + return NULL; + } + + if (!D3DRM_SUCCEED(mesh->SetQuality((mesh->GetQuality() & ~D3DRMSHADE_MASK) | D3DRMSHADE_FLAT))) { + mesh->Release(); + return NULL; + } + + return mesh; +} + +/* +** Selects the given visual inside the given frame +*/ + +void UpdateConeVisual(void) { + if (!sFrame) return; + if (!sFrame->GetAppData()) return; + LPFRAMEAPPDATA fd = (LPFRAMEAPPDATA)sFrame->GetAppData(); + if (!fd->i3DSound) return; + if (showBoxes && sVisual) + { D3DRMBOX box; + LPDIRECT3DRMMESHBUILDER builder; + sFrame->DeleteVisual(selectionSpeaker); + sVisual->GetBox(&box); + DWORD temp, outer; + fd->i3DSound->GetConeAngles(&temp, &outer); + builder = makeSpeaker(&box, D3DVAL(temp)); + builder->CreateMesh(&selectionSpeaker); + sFrame->AddVisual(selectionSpeaker); + selectionSpeaker->Release(); + builder->Release(); + } + +} + +void SelectVisual(LPDIRECT3DRMMESHBUILDER visual, LPDIRECT3DRMFRAME frame) { + RLDS3D_DeselectVisual(); + sVisual = visual; + sFrame = frame; + + if (sVisual) + { LPDIRECT3DRMLIGHTARRAY lights; + + sLight = 0; + sFrame->GetLights(&lights); + if (lights) + { if (lights->GetSize()) + { lights->GetElement(0, &sLight); + sLight->Release(); /* reinstate reference count */ + } + lights->Release(); + } + + if (showBoxes && visual) + { D3DRMBOX box; + LPDIRECT3DRMMESHBUILDER builder; + + sVisual->GetBox(&box); + builder = makeBox(&box); + builder->CreateMesh(&selectionBox); + sFrame->AddVisual(selectionBox); + selectionBox->Release(); + builder->Release(); + UpdateConeVisual(); + } + } +} + +LPGUID +FindDevice(D3DCOLORMODEL cm) +{ + LPDIRECTDRAW lpDD; + LPDIRECT3D lpD3D; + D3DFINDDEVICESEARCH search; + static D3DFINDDEVICERESULT result; + HRESULT error; + + if (DirectDrawCreate(NULL, &lpDD, NULL) != DD_OK) + return NULL; + + if (lpDD->QueryInterface(IID_IDirect3D, (void**) &lpD3D) != DD_OK) { + lpDD->Release(); + return NULL; + } + + memset(&search, 0, sizeof search); + search.dwSize = sizeof search; + search.dwFlags = D3DFDS_COLORMODEL; + search.dcmColorModel = (cm == D3DCOLOR_MONO) ? D3DCOLOR_MONO : D3DCOLOR_RGB; + + memset(&result, 0, sizeof result); + result.dwSize = sizeof result; + + error = lpD3D->FindDevice(&search, &result); + + lpD3D->Release(); + lpDD->Release(); + + if (error != D3D_OK) + return NULL; + else + return &result.guid; +} + +/* + * Create the device and viewport. + */ + +static BOOL CreateDevice(HWND win, AppInfo* info) +{ + RECT r; + int bpp; + HDC hdc; + + GetClientRect(win, &r); + if (!D3DRM_SUCCEED(lpD3DRM->CreateDeviceFromClipper(lpDDClipper, NULL, r.right, r.bottom, &info->dev))) return FALSE; + + hdc = GetDC(win); + bpp = GetDeviceCaps(hdc, BITSPIXEL); + ReleaseDC(win, hdc); + switch (bpp) + { + case 1: + info->dev->SetShades(4); + lpD3DRM->SetDefaultTextureShades(4); + break; + case 16: + info->dev->SetShades(32); + lpD3DRM->SetDefaultTextureColors(64); + lpD3DRM->SetDefaultTextureShades(32); + info->dev->SetDither(FALSE); + break; + case 24: + info->dev->SetShades(256); + lpD3DRM->SetDefaultTextureColors(64); + lpD3DRM->SetDefaultTextureShades(256); + info->dev->SetDither(FALSE); + break; + default: + info->dev->SetDither(FALSE); + } + if (!CreateScene(info)) { + info->dev->Release(); + return FALSE; + } + if (!D3DRM_SUCCEED(lpD3DRM->CreateViewport(info->dev, info->camera, 0, 0, info->dev->GetWidth(), info->dev->GetHeight(), &info->view))) { + info->dev->Release(); + return FALSE; + } + info->view->SetBack(D3DVAL(5000.0)); + return TRUE; +} + +/* + * Creates a simple scene and adds it to the main scene + */ + +static BOOL CreateScene(AppInfo* info) +{ + LPDIRECT3DRMFRAME light; + LPDIRECT3DRMLIGHT light1, light2; + + // Note that if something fails, we don't bother freeing up everything we've created... the caller to CreateScene should destroy + // the lpD3DRM object and that should happily release everything created with it. + // Also note that, since we're just the viewer, if there's a critical error we pass a quit message with our error message since + // we'd want to quit if the initialize failed anyways... + + if (!D3DRM_SUCCEED(lpD3DRM->CreateFrame(NULL, &info->scene))) return FALSE; + if (!D3DRM_SUCCEED(lpD3DRM->CreateLightRGB(D3DRMLIGHT_DIRECTIONAL, D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0), &light1))) return FALSE; + if (!D3DRM_SUCCEED(lpD3DRM->CreateLightRGB(D3DRMLIGHT_AMBIENT, D3DVAL(0.1), D3DVAL(0.1), D3DVAL(0.1), &light2))) return FALSE; + if (!D3DRM_SUCCEED(lpD3DRM->CreateFrame(info->scene, &light))) return FALSE; + + light->SetPosition(info->scene, D3DVAL(2.0), D3DVAL(2.0), D3DVAL(5.0)); + light->SetOrientation(info->scene, D3DVAL(-1.0), D3DVAL(-1.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0)); + light->AddLight(light1); + info->scene->AddLight(light2); + + if (!D3DRM_SUCCEED(lpD3DRM->CreateFrame(info->scene, &info->camera))) return FALSE; + info->camera->SetPosition(info->scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)); + // Add a callback to the camera's frame so that the listener is updated with the camera + info->camera->AddMoveCallback(listenerCallback, NULL); + + light->Release(), light1->Release(), light2->Release(); + return TRUE; +} + +/* + * Regenerate the device if the color model changes or the window size + * changes. + */ +static BOOL RebuildDevice(HWND win, AppInfo* info, int width, int height) +{ + int old_dither = info->dev->GetDither(); + D3DRMRENDERQUALITY old_quality = info->dev->GetQuality(); + int old_shades = info->dev->GetShades(); + + info->view->Release(); + info->dev->Release(); + + LPGUID guid = FindDevice(info->model); + + if (!guid) return FALSE; + + if (!D3DRM_SUCCEED(lpD3DRM->CreateDeviceFromClipper(lpDDClipper, guid, width, height, &info->dev))) return FALSE; + + info->dev->SetDither(old_dither); + info->dev->SetQuality(old_quality); + info->dev->SetShades(old_shades); + width = info->dev->GetWidth(); + height = info->dev->GetHeight(); + if (!D3DRM_SUCCEED(lpD3DRM->CreateViewport(info->dev, info->camera, 0, 0, width, height, &info->view))) return FALSE; + info->view->SetBack(D3DVAL(400.0)); + return TRUE; +} + +/* + * Place an object in front of the camera. + */ +static void PlaceMesh(LPDIRECT3DRMMESHBUILDER mesh, AppInfo *info) +{ + LPDIRECT3DRMFRAME frame; + + if (!D3DRM_SUCCEED(lpD3DRM->CreateFrame(info->scene, &frame))) return; + frame->AddVisual(mesh); + frame->SetPosition(info->camera, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(15.0)); + frame->Release(); +} + +HRESULT loadTextures(char *name, void *arg, LPDIRECT3DRMTEXTURE *tex) +{ + char* ext = LSTRRCHR(name, (int)'.'); + + if (ext && !lstrcmpi(ext, ".ppm")) + if (D3DRM_SUCCEED(lpD3DRM->LoadTexture(name, tex))) return 0; + return -1; +} + +/* +** Finds the last occurance of bChar in a null-terminated string, good for finding a pointer to the extension of a filename +*/ +char* LSTRRCHR( const char* lpString, int bChar ) +{ + if( lpString != NULL ) + { + const char* lpBegin; + + lpBegin = lpString; + + while( *lpString != 0 ) + { + lpString++; + } + + while( 1 ) + { + if( *lpString == bChar ) + { + return (char*)lpString; + } + + if( lpString == lpBegin ) + { + break; + } + + lpString--; + } + } + + return NULL; +} /* LSTRRCHR */ + + +/* +** Strange little function to pick a color from a table using standardized Windows stuff +*/ + +int ChooseNewColor(HWND win, D3DCOLOR* current) +{ + CHOOSECOLOR cc; + COLORREF clr; + COLORREF aclrCust[16]; + int i; + + for (i = 0; i < 16; i++) + aclrCust[i] = RGB(255, 255, 255); + + clr = + RGB + ( (int) (255 * D3DRMColorGetRed(*current)), + (int) (255 * D3DRMColorGetGreen(*current)), + (int) (255 * D3DRMColorGetBlue(*current)) + ); + + memset(&cc, 0, sizeof(CHOOSECOLOR)); + cc.lStructSize = sizeof(CHOOSECOLOR); + cc.hwndOwner = win; + cc.rgbResult = clr; + cc.lpCustColors = aclrCust; + cc.Flags = CC_RGBINIT|CC_FULLOPEN; + + if (ChooseColor(&cc)) + { *current = + D3DRMCreateColorRGB + ( D3DVAL(GetRValue(cc.rgbResult) / D3DVAL(255.0)), + D3DVAL(GetGValue(cc.rgbResult) / D3DVAL(255.0)), + D3DVAL(GetBValue(cc.rgbResult) / D3DVAL(255.0)) + ); + return TRUE; + } + else return FALSE; +} diff --git a/sdk/samples/ds3dview/rlds3d.h b/sdk/samples/ds3dview/rlds3d.h new file mode 100644 index 0000000..8f38752 --- /dev/null +++ b/sdk/samples/ds3dview/rlds3d.h @@ -0,0 +1,345 @@ +#ifndef ___RLDS3D_HEADER_FILE +#define ___RLDS3D_HEADER_FILE + +#include "d3drmwin.h" + +/* +** This is an interface between the viewer and the RL/DS3D APIs which provides the +** functionality required by the viewer in simplified form. +** +** Note: This is not an object-oriented API since there should only be need for one +** copy at a time and this way C++ to C conversions should be fairly easy +** +** DESCRIPTION: The user interfaces the 3D world and objects therein by selecting items +** with the mouse (on the screen) and performing operations on that item. The user will +** also be able to perform operations on the camera and a few global operations applied +** to all objects. +** +** USAGE: Create the interface using RLDS3D_Initialize() (returns FALSE if not created) +** and remove it using RLDS3D_Deinitialize(). The RLDS3D_Render() functionality draws the world +** on the screen. +*/ + +/* +************************ INITIALIZATION/DEINITIALIZATION **************************** +*/ + +/* +** Initialize will attach itself to the passed window. Call initialize after +** getting a handle for your window but before you display it. +** +** Initialize will initialize the RL API and return false if it fails. It will +** also attempt to initialize a DirectSound3D API, but failing this does not +** justify a failed Initialize (since the 3D sound isn't a necessary part of +** the viewer) +*/ + +BOOL RLDS3D_Initialize(HWND hwndPW, HANDLE this_inst); + +/* +** Deinitializes where necessary (assumes program quits after calling this otherwise it'd free up memory, etc...) +*/ + +void RLDS3D_Deinitialize(); + +/* +*************************** ADDING/REMOVING/EDITING OBJECTS ********************************* +*/ + +/* +** Loads XOF file into the RL world (with textures) +*/ + +void RLDS3D_LoadXOF(char* file); + +/* +** Sets/Gets whether or not boxes are shown around selected item +*/ + +BOOL RLDS3D_GetBoxes(void); +void RLDS3D_SetBoxes(BOOL new_val); + +/* +** Updates the bounding box around the selected visual (this could be done using a render callback function to compare the +** frame's scaling and transform functions instead) +*/ + +void RLDS3D_UpdateSelectionBox(void); + +/* +** Deselects the currently selected 3D visual. +*/ + +void RLDS3D_DeselectVisual(); + +/* +** Given coordinates it selects the first visual under those coordinates in the window's viewport +*/ + +void RLDS3D_FindAndSelectVisual(int x, int y, LPBOOL changed = NULL); + +/* +** Cuts the current selection to the clipboard +*/ + +void RLDS3D_CutVisual(); + +/* +** Copies the current selection to the clipboard +*/ + +void RLDS3D_CopyVisual(); + +/* +** Pastes the current selection to the window +*/ + +void RLDS3D_PasteVisual(); + +/* +** Deletes the current selection from the world without copying to the clipboard +*/ + +void RLDS3D_DeleteVisual(); + +/* +** Add a directional light +*/ +void RLDS3D_AddDirectionalLight(); + +/* +** Add a parallel point light +*/ +void RLDS3D_AddParallelPointLight(); + +/* +** Add Point Light +*/ +void RLDS3D_AddPointLight(); + +/* +** Add a spotlight +*/ +void RLDS3D_AddSpotlight(); + +/* +*********************************** OBJECT MOTION/SCALING/COLOURING **************************************** +*/ + +/* +** Sets the selected object's colour +*/ + +void RLDS3D_SetSelColour(); + +/* +** Moves the camera relative to itself by providing scalars to multiply against the CAMERA-RELATIVE unit vectors +** forwards/up/right. +*/ + +void RLDS3D_SetCamVelRelToCam(D3DVALUE forward, D3DVALUE up, D3DVALUE right); + +/* +** Rotates the camera around its three axis +** +** forward_axis is roll, up_axis is yaw, right_axis is pitch +** (Only one affects at a time) +*/ + +void RLDS3D_SetCamRotForward(D3DVALUE forward_axis); +void RLDS3D_SetCamRotUp(D3DVALUE up_axis); +void RLDS3D_SetCamRotRight(D3DVALUE right_axis); + +/* +** Scales the selected object in the x/y/z axis of it's orientation by the specified values +*/ + +void RLDS3D_ScaleSelected(D3DVALUE sx, D3DVALUE sy, D3DVALUE sz); + +/* +** Moves the currently selected object in the 3D world relative to the camera +*/ + +void RLDS3D_SetSelectedVelRelToCam(D3DVALUE forward, D3DVALUE up, D3DVALUE right); + +/* +** Rotates the currently selected object relative to the camera's frame when passed +** a vector for the axis and an angle of rotation. +** This is useful because the AXIS which is specified is relative to what appears on the screen with it's origin at the camera +** (ie: (0,0,1) will be an axis straight into the screen and thus things will spin around the centre of the screen) +*/ + +void RLDS3D_SetSelectedRotRelToCam(D3DVALUE AxisX, D3DVALUE AxisY, D3DVALUE AxisZ, D3DVALUE angle); + +/* +** Moves the currently selected object by x/y pixels on the screen from it's relative position. Allows a user +** to drag objects around the screen using the mouse. Assumes that the distance from the frame to the screen +** will remain constant +*/ + +void RLDS3D_MoveSelectedPosByScreenCoords(double delta_x, double delta_y); + +/* +** Orbits the selected object around the camera +*/ + +void RLDS3D_OrbitSelected(void); +void RLDS3D_StopOrbitSelected(); + +/* +** Bullets it towards the camera +*/ + +void RLDS3D_BulletSelected(void); + +/* +********************** DIRECTSOUND 3D INTERFACE ****************************** +*/ + +/* +** Stops all sounds from playing +*/ + +void RLDS3D_StopAllSounds(); + +/* +** Removes all of the sounds +*/ + +void RLDS3D_RemoveAllSounds(); + +/* +** Plays the sound associated with the currently selected object +*/ + +void RLDS3D_PlaySound(BOOL bIsLooping); + +/* +** Stops the sound associated with the currently selected object +*/ + +void RLDS3D_StopSelectedSound(); + +/* +** Removes the sound from the currently selected object +*/ + +void RLDS3D_RemoveSound(); +/* +** Attaches a sound (filename provided) to the selected frame +*/ + +void RLDS3D_AttachSound(char* filename); + +/* +** Global parameter mods +*/ +void RLDS3D_GetDistanceFactor(D3DVALUE *temp); +void RLDS3D_GetDopplerFactor(D3DVALUE *temp); +void RLDS3D_GetRolloffFactor(D3DVALUE *temp); +void RLDS3D_SetDistanceFactor(D3DVALUE temp); +void RLDS3D_SetDopplerFactor(D3DVALUE temp); +void RLDS3D_SetRolloffFactor(D3DVALUE temp); + +void RLDS3D_CommitDeferredSettings(void); + +/* +** Selected sound parameter modifications +*/ + +BOOL RLDS3D_SoundSelected(void); +void RLDS3D_GetSelConeAngles(LPDWORD inner, LPDWORD outer); +void RLDS3D_GetSelConeOutsideVolume(LPLONG temp); +void RLDS3D_GetSelMinimumDistance(D3DVALUE *temp); +void RLDS3D_GetSelMaximumDistance(D3DVALUE *temp); +void RLDS3D_SetSelConeAngles(DWORD inner, DWORD outer); +void RLDS3D_SetSelConeOutsideVolume(LONG temp); +void RLDS3D_SetSelMinimumDistance(D3DVALUE temp); +void RLDS3D_SetSelMaximumDistance(D3DVALUE temp); + +/* +************************************* MISC. MAINTENANCE FUNCTIONS ************************************** +*/ + +/* +** Allows external users access to the RL Device to deal with Windows-related issues +** (See case WM_ACTIVATE: and case WM_PAINT: in viewer source for examples of HandleActivate() and HandlePaint()) +** Design note: This was done to save time from the conversion from the old version of the viewer rather than +** having RLDS3D_HandleActivate(), etc. +*/ + +LPDIRECT3DRMDEVICE RLDS3D_WinDevice(); + +// Handles window activation (pass the wparam from the winproc) +void RLDS3D_HandleActivate(WPARAM wparam); + +// Handles paint messages from the window. Pass this one the paintstructure created using BeginPaint +void RLDS3D_HandlePaint(PAINTSTRUCT* ps); + +// Tells whether or not something is currently selected + +BOOL RLDS3D_FrameSelected(); + +/* +** Renders the scene's next frame into the viewport. +*/ + +void RLDS3D_Render(D3DVALUE time_delta); + +/* + * Resize the viewport and device when the window size changes. + */ + +void RLDS3D_ResizeViewport(int width, int height); + +/* +** Returns whether or not the 3D Sound API was actually initialized properly +*/ + +BOOL RLDS3D_SoundInitialized(); + +/* +** Sets/Gets the current polygon fill mode +*/ + +D3DRMFILLMODE RLDS3D_GetPolygonFillMode(void); +void RLDS3D_SetPolygonFillMode(D3DRMFILLMODE quality); + +/* +** Sets/Gets the current polygon shade mode +*/ + +void RLDS3D_SetPolygonShadeMode(D3DRMSHADEMODE quality); +D3DRMSHADEMODE RLDS3D_GetPolygonShadeMode(void); + +/* +** Sets/Gets the colour model for the viewport (RGB or ramp) +*/ + +D3DRMCOLORMODEL RLDS3D_GetColourModel(void); +void RLDS3D_SetColourModel(D3DRMCOLORMODEL model); + +/* +** Sets/Gets whether or not the lights affect the visuals +*/ + +void RLDS3D_SetLighting(BOOL new_val); +BOOL RLDS3D_GetLighting(void); + +/* +** Sets/Gets whether or not dithering is on +*/ + +BOOL RLDS3D_GetDither(void); +void RLDS3D_SetDither(BOOL dither); + +/* +** Sets/Gets texture quality (only relevant for RGB modes) +*/ + +D3DRMTEXTUREQUALITY RLDS3D_GetTextureQuality(void); +void RLDS3D_SetTextureQuality(D3DRMTEXTUREQUALITY new_quality); + +#endif + + diff --git a/sdk/samples/ds3dview/rodcone.cpp b/sdk/samples/ds3dview/rodcone.cpp new file mode 100644 index 0000000..f5285be --- /dev/null +++ b/sdk/samples/ds3dview/rodcone.cpp @@ -0,0 +1,279 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: rodcone.cpp + * + ***************************************************************************/ + +/* + * Sample code for building objects out of rods and cones. + */ + +#include "d3drmwin.h" +#include "resource.h" +#include "rodcone.h" +#include <math.h> + +static unsigned long rod_faces[] = +{ 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, /* end 1 */ + 4, 0, 0, 1, 1, 9, 1, 8, 0, /* side 0 */ + 4, 1, 1, 2, 2, 10, 2, 9, 1, /* side 1 */ + 4, 2, 2, 3, 3, 11, 3, 10, 2, /* side 2 */ + 4, 3, 3, 4, 4, 12, 4, 11, 3, /* side 3 */ + 4, 4, 4, 5, 5, 13, 5, 12, 4, /* side 4 */ + 4, 5, 5, 6, 6, 14, 6, 13, 5, /* side 5 */ + 4, 6, 6, 7, 7, 15, 7, 14, 6, /* side 6 */ + 4, 7, 7, 0, 0, 8, 0, 15, 7, /* side 7 */ + 8, 8, 0, 9, 1, 10, 2, 11, 3, 12, 4, 13, 5, 14, 6, 15, 7, /* end 2 */ + 0, +}; + +/* +** Error function which is actually defined in rlds3d.cpp +*/ + +BOOL D3DRM_SUCCEED(HRESULT result, int force_critical = -1, char* info = NULL); + +void AddRod(LPDIRECT3DRMMESHBUILDER mesh, D3DVALUE radius, D3DVECTOR a, D3DVECTOR b) +{ + if (!mesh) return; + D3DVECTOR d, u, r; + D3DVECTOR v[16]; + D3DVECTOR n[8]; + D3DVALUE f; + int i; + + /* + * Find the unit vector along the rod. + */ + d.x = b.x - a.x; + d.y = b.y - a.y; + d.z = b.z - a.z; + D3DRMVectorNormalise(&d); + + /* + * Pick a vector normal to d + */ + if (d.y != D3DVAL(0.0) || d.z != D3DVAL(0.0)) + { u.x = D3DVAL(0.0); + if (d.y == D3DVAL(0.0)) + { u.y = D3DVAL(1.0); + u.z = D3DVAL(0.0); + } else + { D3DVALUE n_fix = + D3DVAL(1.0) + + D3DDivide(D3DMultiply(d.z, d.z), D3DMultiply(d.y, d.y)); +#ifdef FIXED_POINT_API + double un_val = (double)n_fix / (double)(1<<16); + u.z = D3DVAL(sqrt(1/un_val)); +#else + u.z = D3DVAL(sqrt(D3DDivide(D3DVAL(1.0), D3DVAL(n_fix)))); +#endif + u.y = -D3DMultiply(u.z, D3DDivide(d.z, d.y)); + } + } else + { u.x = D3DVAL(0.0); + u.y = D3DVAL(0.0); + u.z = D3DVAL(1.0); + } + + /* + * Now find a vector normal to them both, to give us a coordinate + * system in the plane normal to the rod. + */ + D3DRMVectorCrossProduct(&r, &d, &u); + + /* + * Scale down the coordinates to the radius of the rod. + */ + u.x = D3DMultiply(u.x, radius); + u.y = D3DMultiply(u.y, radius); + u.z = D3DMultiply(u.z, radius); + r.x = D3DMultiply(r.x, radius); + r.y = D3DMultiply(r.y, radius); + r.z = D3DMultiply(r.z, radius); + + /* + * Calculate the corners of an octagon. + */ + f = D3DVAL((float)sqrt((double)2) / (2 * (1 + (float)sqrt((double)2) / 2))); + v[0].x = u.x + D3DMultiply(r.x, f); + v[0].y = u.y + D3DMultiply(r.y, f); + v[0].z = u.z + D3DMultiply(r.z, f); + + v[1].x = D3DMultiply(u.x, f) + r.x; + v[1].y = D3DMultiply(u.y, f) + r.y; + v[1].z = D3DMultiply(u.z, f) + r.z; + + v[2].x = D3DMultiply(-u.x, f) + r.x; + v[2].y = D3DMultiply(-u.y, f) + r.y; + v[2].z = D3DMultiply(-u.z, f) + r.z; + + v[3].x = -u.x + D3DMultiply(r.x, f); + v[3].y = -u.y + D3DMultiply(r.y, f); + v[3].z = -u.z + D3DMultiply(r.z, f); + + v[4].x = -u.x - D3DMultiply(r.x, f); + v[4].y = -u.y - D3DMultiply(r.y, f); + v[4].z = -u.z - D3DMultiply(r.z, f); + + v[5].x = D3DMultiply(-u.x, f) - r.x; + v[5].y = D3DMultiply(-u.y, f) - r.y; + v[5].z = D3DMultiply(-u.z, f) - r.z; + + v[6].x = D3DMultiply(u.x, f) - r.x; + v[6].y = D3DMultiply(u.y, f) - r.y; + v[6].z = D3DMultiply(u.z, f) - r.z; + + v[7].x = u.x - D3DMultiply(r.x, f); + v[7].y = u.y - D3DMultiply(r.y, f); + v[7].z = u.z - D3DMultiply(r.z, f); + + /* + * Add the rod endpoints and calculate the vertex normals. + */ + for (i = 0; i < 8; i++) + { n[i] = v[i]; + D3DRMVectorNormalise(&n[i]); + v[i + 8].x = v[i].x + b.x; + v[i + 8].y = v[i].y + b.y; + v[i + 8].z = v[i].z + b.z; + v[i].x += a.x; + v[i].y += a.y; + v[i].z += a.z; + } + + /* + * Now add the faces. + */ + D3DRM_SUCCEED(mesh->AddFaces(16, v, 8, n, rod_faces, NULL)); +} + +static unsigned long cone_faces[] = +{ 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, /* end 1 */ + 3, 0, 0, 1, 1, 8, 1, /* side 0 */ + 3, 1, 1, 2, 2, 8, 1, /* side 1 */ + 3, 2, 2, 3, 3, 8, 1, /* side 2 */ + 3, 3, 3, 4, 4, 8, 1, /* side 3 */ + 3, 4, 4, 5, 5, 8, 1, /* side 4 */ + 3, 5, 5, 6, 6, 8, 1, /* side 5 */ + 3, 6, 6, 7, 7, 8, 1, /* side 6 */ + 3, 7, 7, 0, 0, 8, 1, /* side 7 */ + 0, +}; + +void AddCone(LPDIRECT3DRMMESHBUILDER mesh, D3DVALUE radius, D3DVECTOR a, D3DVECTOR b) +{ + if (!mesh) return; + D3DVECTOR d, u, r; + D3DVECTOR v[16]; + D3DVECTOR n[8]; + D3DVALUE f; + int i; + + /* + * Find the unit vector along the rod. + */ + d.x = b.x - a.x; + d.y = b.y - a.y; + d.z = b.z - a.z; + D3DRMVectorNormalise(&d); + + /* + * Pick a vector normal to d + */ + if (d.y != D3DVAL(0.0) || d.z != D3DVAL(0.0)) + { u.x = D3DVAL(0.0); + if (d.y == D3DVAL(0.0)) + { u.y = D3DVAL(1.0); + u.z = D3DVAL(0.0); + } else + { D3DVALUE n_fix = + D3DVAL(1.0) + + D3DDivide(D3DMultiply(d.z, d.z), D3DMultiply(d.y, d.y)); +#ifdef FIXED_POINT_API + double un_val = (double)n_fix / (double)(1<<16); + u.z = D3DVAL(sqrt(1 / un_val)); +#else + u.z = D3DVAL(sqrt(D3DVAL(1.0) / D3DVAL(n_fix))); +#endif + u.y = - D3DDivide(D3DMultiply(u.z, d.z), d.y); + } + } else + { u.x = D3DVAL(0.0); + u.y = D3DVAL(0.0); + u.z = D3DVAL(1.0); + } + + /* + * Now find a vector normal to them both, to give us a coordinate + * system in the plane normal to the rod. + */ + D3DRMVectorCrossProduct(&r, &d, &u); + + /* + * Scale down the coordinates to the radius of the rod. + */ + u.x = D3DMultiply(u.x, radius); + u.y = D3DMultiply(u.y, radius); + u.z = D3DMultiply(u.z, radius); + r.x = D3DMultiply(r.x, radius); + r.y = D3DMultiply(r.y, radius); + r.z = D3DMultiply(r.z, radius); + + /* + * Calculate the corners of an octagon. + */ + f = D3DVAL((float)sqrt((double)2) / (2 * (1 + (float)sqrt((double)2) / 2))); + v[0].x = u.x + D3DMultiply(r.x, f); + v[0].y = u.y + D3DMultiply(r.y, f); + v[0].z = u.z + D3DMultiply(r.z, f); + + v[1].x = D3DMultiply(u.x, f) + r.x; + v[1].y = D3DMultiply(u.y, f) + r.y; + v[1].z = D3DMultiply(u.z, f) + r.z; + + v[2].x = D3DMultiply(-u.x, f) + r.x; + v[2].y = D3DMultiply(-u.y, f) + r.y; + v[2].z = D3DMultiply(-u.z, f) + r.z; + + v[3].x = -u.x + D3DMultiply(r.x, f); + v[3].y = -u.y + D3DMultiply(r.y, f); + v[3].z = -u.z + D3DMultiply(r.z, f); + + v[4].x = -u.x - D3DMultiply(r.x, f); + v[4].y = -u.y - D3DMultiply(r.y, f); + v[4].z = -u.z - D3DMultiply(r.z, f); + + v[5].x = D3DMultiply(-u.x, f) - r.x; + v[5].y = D3DMultiply(-u.y, f) - r.y; + v[5].z = D3DMultiply(-u.z, f) - r.z; + + v[6].x = D3DMultiply(u.x, f) - r.x; + v[6].y = D3DMultiply(u.y, f) - r.y; + v[6].z = D3DMultiply(u.z, f) - r.z; + + v[7].x = u.x - D3DMultiply(r.x, f); + v[7].y = u.y - D3DMultiply(r.y, f); + v[7].z = u.z - D3DMultiply(r.z, f); + + v[8] = b; + + /* + * Calculate the vertex normals. + */ + for (i = 0; i < 8; i++) + { n[i] = v[i]; + D3DRMVectorNormalise(&n[0]); + v[i].x += a.x; + v[i].y += a.y; + v[i].z += a.z; + } + + /* + * Now add the faces. + */ + + D3DRM_SUCCEED(mesh->AddFaces(9, v, 8, n, cone_faces, NULL)); +} diff --git a/sdk/samples/ds3dview/rodcone.h b/sdk/samples/ds3dview/rodcone.h new file mode 100644 index 0000000..874f616 --- /dev/null +++ b/sdk/samples/ds3dview/rodcone.h @@ -0,0 +1,10 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: rodcone.h + * + ***************************************************************************/ + +void AddRod(LPDIRECT3DRMMESHBUILDER mesh, D3DVALUE radius, D3DVECTOR a, D3DVECTOR b); +void AddCone(LPDIRECT3DRMMESHBUILDER mesh, D3DVALUE radius, D3DVECTOR a, D3DVECTOR b); diff --git a/sdk/samples/ds3dview/viewer.cpp b/sdk/samples/ds3dview/viewer.cpp new file mode 100644 index 0000000..56c32c2 --- /dev/null +++ b/sdk/samples/ds3dview/viewer.cpp @@ -0,0 +1,895 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: viewer.cpp + * + ***************************************************************************/ + + + +#define INITGUID +#include "d3drmwin.h" +#include "resource.h" + +#include <windows.h> +#include <stdio.h> +#include <string.h> +#include <malloc.h> +#include <math.h> +#include <direct.h> + +#include "rlds3d.h" +#include "file.h" + + +static char ViewerClass[32] = "ViewerClass"; + +static BOOL FirstInstance(HANDLE); +static BOOL AnyInstance(HANDLE, HWND*); +long FAR PASCAL WindowProc(HWND, UINT, WPARAM, LPARAM); +static void Idle(); + +BOOL CALLBACK WaitBoxDlgProc(HWND, UINT, WPARAM, LPARAM); + +BOOL AboutBoxOn = FALSE; + + +/* + * Initialization, message loop + */ + +int PASCAL WinMain + (HANDLE this_inst, HANDLE prev_inst, LPSTR cmdline, int cmdshow) +{ + MSG msg; + int idle; + int done = FALSE; + HACCEL accel; + + + DWORD prev_tick; + DWORD this_tick; + D3DVALUE time_delta; + + prev_inst = prev_inst; + cmdline = cmdline; + + // Register our class if necessary + if (!prev_inst) { + // Do the stuff for if this is the first instance of the program. + if (!FirstInstance(this_inst)) return FALSE; + } + + // Create our window and get it's handle (needs to be done whether we're first or not) + HWND win; + if (!AnyInstance(this_inst, &win)) return FALSE; + + // Initialize the RLDS3D interface + if (!RLDS3D_Initialize(win, this_inst)) { + // If it doesn't initialize then we don't have anything we need to clean up, so we just exit + exit(-1); + } + + // Show our window! + ShowWindow(win, cmdshow); + UpdateWindow(win); + + // Load accelerators + accel = LoadAccelerators(this_inst, "ViewerAccel"); + + prev_tick = timeGetTime(); + + + while (!done) + { idle = TRUE; + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { idle = FALSE; + if (msg.message == WM_QUIT) + { done = TRUE; + break; + } + + if (!TranslateAccelerator(msg.hwnd, accel, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + } + if (idle) Idle(); + this_tick = timeGetTime(); + time_delta = D3DVAL((float)((this_tick - prev_tick)/1000.0)); + prev_tick = this_tick; + RLDS3D_Render(time_delta); + } + RLDS3D_Deinitialize(); + return msg.wParam; +} + +/* + * Register window class for the application, and do any other + * application initialization + */ +static BOOL FirstInstance(HANDLE this_inst) +{ + WNDCLASS wc; + BOOL rc; + + /* + * set up and register window class + */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = this_inst; + wc.hIcon = LoadIcon(this_inst, "ViewerIcon"); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = "ViewerMenu"; + wc.lpszClassName = ViewerClass; + rc = RegisterClass(&wc); + + return rc; +} + +/* + * Do work required for every instance of the application: + * create the window, initialize data + */ +static BOOL AnyInstance(HANDLE this_inst, HWND* window_handle) +{ + HWND win; + char szCaption[] = "DirectSound3D Demo"; + + /* + * create main window + */ + win = + CreateWindow + ( ViewerClass, /* class */ + szCaption, /* caption */ + WS_OVERLAPPEDWINDOW, /* style */ + CW_USEDEFAULT, /* init. x pos */ + CW_USEDEFAULT, /* init. y pos */ + 400, /* init. x size */ + 400, /* init. y size */ + NULL, /* parent window */ + NULL, /* menu handle */ + this_inst, /* program handle */ + NULL /* create parms */ + ); + + + if (!win) return FALSE; + *window_handle = win; + return TRUE; +} + +/* + * Processes messages for the about dialog. + */ +BOOL FAR PASCAL AboutDlgProc + (HWND win, unsigned msg, WORD wparam, LONG lparam) +{ + lparam = lparam; + + switch (msg) + { + case WM_INITDIALOG: + return TRUE; + + case WM_COMMAND: + if (wparam == IDOK) + { + AboutBoxOn = FALSE; + EndDialog(win, TRUE); + return TRUE; + } + break; + case WM_CLOSE: + { + AboutBoxOn = FALSE; + EndDialog(win, TRUE); + return FALSE; + } + break; + } + return FALSE; +} + +static int + left_drag = FALSE, right_drag = FALSE, + last_x, last_y; + +static void Idle() +{ + // Stop selected item being dragged from rotating/moving + if (left_drag) { + RLDS3D_SetSelectedRotRelToCam(D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0)); + } + if (right_drag) { + RLDS3D_SetSelectedVelRelToCam(D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)); + } +} + +static int FillModeToMenuItem(D3DRMFILLMODE fm) +{ + switch (fm) { + case D3DRMFILL_POINTS: + return 2; + + case D3DRMFILL_WIREFRAME: + return 3; + + case D3DRMFILL_SOLID: + return 4; + } + return -1; +} + +// Sets the polygon fill mode and checks/unchecks the appropriate menu items +static void SetFillMode(HWND win, D3DRMFILLMODE fm) +{ + HMENU menu; + D3DRMFILLMODE oldfm = RLDS3D_GetPolygonFillMode(); + menu = GetMenu(win); + menu = GetSubMenu(menu, 2); + CheckMenuItem(menu, FillModeToMenuItem(oldfm), + MF_BYPOSITION|MF_UNCHECKED); + CheckMenuItem(menu, FillModeToMenuItem(fm), + MF_BYPOSITION|MF_CHECKED); + RLDS3D_SetPolygonFillMode(fm); +} + +static int ShadeModeToMenuItem(D3DRMSHADEMODE sm) +{ + switch (sm) { + case D3DRMSHADE_FLAT: + return 6; + + case D3DRMSHADE_GOURAUD: + return 7; + + case D3DRMSHADE_PHONG: + return 8; + } + return -1; +} + +// Sets the polygon shade mode and checks/unchecks the appropriate menu items +static void SetShadeMode(HWND win, D3DRMSHADEMODE sm) +{ + HMENU menu; + D3DRMSHADEMODE oldsm = RLDS3D_GetPolygonShadeMode(); + + menu = GetMenu(win); + menu = GetSubMenu(menu, 2); + CheckMenuItem(menu, ShadeModeToMenuItem(oldsm), + MF_BYPOSITION|MF_UNCHECKED); + CheckMenuItem(menu, ShadeModeToMenuItem(sm), + MF_BYPOSITION|MF_CHECKED); + RLDS3D_SetPolygonShadeMode(sm); +} + +// Sets the rendering model and checks/unchecks the appropriate menu items +static void SetModel(HWND win, D3DRMCOLORMODEL model) +{ + HMENU menu; + D3DRMCOLORMODEL oldModel = RLDS3D_GetColourModel(); + + if (oldModel == model) return; + + RLDS3D_SetColourModel(model); + + menu = GetMenu(win); + menu = GetSubMenu(menu, 2); + CheckMenuItem(menu, 9 + (int) oldModel, MF_BYPOSITION|MF_UNCHECKED); + CheckMenuItem(menu, 9 + (int) model, MF_BYPOSITION|MF_CHECKED); +} + +// Toggles dithering and checks/unchecks menu item +static void ToggleDither(HWND win) +{ + HMENU menu; + int dither = RLDS3D_GetDither(); + int checked; + dither = !dither; + RLDS3D_SetDither(dither); + + menu = GetMenu(win); + menu = GetSubMenu(menu, 2); + + if (dither) checked = MF_CHECKED; + else checked = MF_UNCHECKED; + + CheckMenuItem(menu, 13, MF_BYPOSITION|checked); +} + +// Toggles texture filtering and checks/unchecks menu item +static void ToggleTextureFiltering(HWND win) +{ + HMENU menu; + D3DRMTEXTUREQUALITY tq = RLDS3D_GetTextureQuality(); + int checked; + if (tq == D3DRMTEXTURE_NEAREST) + tq = D3DRMTEXTURE_LINEAR; + else + tq = D3DRMTEXTURE_NEAREST; + + RLDS3D_SetTextureQuality(tq); + menu = GetMenu(win); + menu = GetSubMenu(menu, 2); + + if (tq == D3DRMTEXTURE_LINEAR) checked = MF_CHECKED; + else checked = MF_UNCHECKED; + + CheckMenuItem(menu, 14, MF_BYPOSITION|checked); +} + +// Ditto for lighting +static void ToggleLighting(HWND win) +{ + HMENU menu; + menu = GetMenu(win); + menu = GetSubMenu(menu, 2); + if (RLDS3D_GetLighting()) { + CheckMenuItem(menu, 0, (MF_BYPOSITION | MF_UNCHECKED)); + RLDS3D_SetLighting(FALSE); + } + else { + CheckMenuItem(menu, 0, (MF_BYPOSITION | MF_CHECKED)); + RLDS3D_SetLighting(TRUE); + } +} + +/* +** Windows procs for the sound param dlg boxes +*/ + +BOOL CALLBACK WaitBoxDlgProc(HWND win, UINT msg, WPARAM wparam, LPARAM lparam) { + return FALSE; +}; + +BOOL CALLBACK GlobalParamDlgProc(HWND win, UINT msg, WPARAM wparam, LPARAM lparam) +{ + lparam = lparam; + + char lpszTS[100]; + + switch (msg) + { + case WM_INITDIALOG: + { + // Set up our edit fields appropriately + D3DVALUE temp; + RLDS3D_GetDistanceFactor(&temp); + sprintf(lpszTS, "%f",temp); + SendDlgItemMessage(win, IDC_DISTANCEFACTOR, WM_SETTEXT, 0, (LPARAM) lpszTS); + SendDlgItemMessage(win, IDC_DISTANCEFACTOR, EM_SETLIMITTEXT, 10, 0); + RLDS3D_GetRolloffFactor(&temp); + sprintf(lpszTS, "%f",temp); + SendDlgItemMessage(win, IDC_ROLLOFFFACTOR, WM_SETTEXT, 0, (LPARAM) lpszTS); + SendDlgItemMessage(win, IDC_ROLLOFFFACTOR, EM_SETLIMITTEXT, 10, 0); + RLDS3D_GetDopplerFactor(&temp); + sprintf(lpszTS, "%f",temp); + SendDlgItemMessage(win, IDC_DOPPLERFACTOR, WM_SETTEXT, 0, (LPARAM) lpszTS); + SendDlgItemMessage(win, IDC_DOPPLERFACTOR, EM_SETLIMITTEXT, 10, 0); + return TRUE; + } + case WM_CLOSE: + EndDialog(win, TRUE); + return FALSE; + + case WM_COMMAND: + { + if (HIWORD(wparam) == EN_UPDATE && LOWORD(wparam) == IDC_DOPPLERFACTOR) { + // Get value from edit box (get length, check lenth, set first char to length, request string, end it with 0) + int stringlength = SendDlgItemMessage(win, IDC_DOPPLERFACTOR, EM_LINELENGTH, 0, 0); + if (stringlength > 10) return TRUE; + lpszTS[0] = (char)stringlength; + SendDlgItemMessage(win, IDC_DOPPLERFACTOR, EM_GETLINE, 0, (LPARAM) lpszTS); + lpszTS[stringlength] = 0; + // Set value in RLDS3D (convert string to long and go crazy with the bad boy) + // No real need for error checking 'cause the edit field is numbers only + RLDS3D_SetDopplerFactor(D3DVAL(atof(lpszTS))); + return TRUE; + } + else if (HIWORD(wparam) == EN_UPDATE && LOWORD(wparam) == IDC_ROLLOFFFACTOR) { + // Get value from edit box (get length, check lenth, set first char to length, request string, end it with 0) + int stringlength = SendDlgItemMessage(win, IDC_ROLLOFFFACTOR, EM_LINELENGTH, 0, 0); + if (stringlength > 10) return TRUE; + lpszTS[0] = (char)stringlength; + SendDlgItemMessage(win, IDC_ROLLOFFFACTOR, EM_GETLINE, 0, (LPARAM) lpszTS); + lpszTS[stringlength] = 0; + // Set value in RLDS3D (convert string to long and go crazy with the bad boy) + RLDS3D_SetRolloffFactor(D3DVAL(atof(lpszTS))); + return TRUE; + } + else if (HIWORD(wparam) == EN_UPDATE && LOWORD(wparam) == IDC_DISTANCEFACTOR) { + // Get value from edit box (get length, check lenth, set first char to length, request string, end it with 0) + int stringlength = SendDlgItemMessage(win, IDC_DISTANCEFACTOR, EM_LINELENGTH, 0, 0); + if (stringlength > 10) return TRUE; + lpszTS[0] = (char)stringlength; + SendDlgItemMessage(win, IDC_DISTANCEFACTOR, EM_GETLINE, 0, (LPARAM) lpszTS); + lpszTS[stringlength] = 0; + // Set value in RLDS3D (convert string to long and go crazy with the bad boy) + RLDS3D_SetDistanceFactor(D3DVAL(atof(lpszTS))); + return TRUE; + } + else return FALSE; + } + break; + } + return FALSE; +} + +HWND hSelCfgDlg = 0; + +BOOL CALLBACK SelectedParamDlgProc(HWND win, UINT msg, WPARAM wparam, LPARAM lparam) +{ + lparam = lparam; + + char lpszTS[100]; + + switch (msg) + { + case WM_INITDIALOG: + { + // Set up our edit fields appropriately + D3DVALUE temp; + LONG temp2; + DWORD temp3, temp4; + // Ignores the out side cone angle for now, which is fine, because elsewhere we + // set it to equal the inside angle + RLDS3D_GetSelConeAngles(&temp3, &temp4); + sprintf(lpszTS, "%i",temp3); + SendDlgItemMessage(win, IDC_CONEANGLE, WM_SETTEXT, 0, (LPARAM) lpszTS); + SendDlgItemMessage(win, IDC_CONEANGLE, EM_SETLIMITTEXT, 10, 0); + RLDS3D_GetSelConeOutsideVolume(&temp2); + sprintf(lpszTS, "%i",temp2); + SendDlgItemMessage(win, IDC_CONEOUTSIDEVOLUME, WM_SETTEXT, 0, (LPARAM) lpszTS); + SendDlgItemMessage(win, IDC_CONEOUTSIDEVOLUME, EM_SETLIMITTEXT, 10, 0); + RLDS3D_GetSelMaximumDistance(&temp); + sprintf(lpszTS, "%f",temp); + SendDlgItemMessage(win, IDC_MAXIMUMDISTANCE, WM_SETTEXT, 0, (LPARAM) lpszTS); + SendDlgItemMessage(win, IDC_MAXIMUMDISTANCE, EM_SETLIMITTEXT, 10, 0); + RLDS3D_GetSelMinimumDistance(&temp); + sprintf(lpszTS, "%f",temp); + SendDlgItemMessage(win, IDC_MINIMUMDISTANCE, WM_SETTEXT, 0, (LPARAM) lpszTS); + SendDlgItemMessage(win, IDC_MINIMUMDISTANCE, EM_SETLIMITTEXT, 10, 0); + hSelCfgDlg = win; + return TRUE; + } + + case WM_CLOSE: + EndDialog(win, TRUE); + hSelCfgDlg = 0; + return FALSE; + + case WM_COMMAND: + { + if (HIWORD(wparam) == EN_UPDATE && LOWORD(wparam) == IDC_CONEANGLE) { + // Get value from edit box (get length, check lenth, set first char to length, request string, end it with 0) + int stringlength = SendDlgItemMessage(win, IDC_CONEANGLE, EM_LINELENGTH, 0, 0); + if (stringlength > 10) return TRUE; + lpszTS[0] = (char)stringlength; + SendDlgItemMessage(win, IDC_CONEANGLE, EM_GETLINE, 0, (LPARAM) lpszTS); + lpszTS[stringlength] = 0; + // Set value in RLDS3D (convert string to long and go crazy with the bad boy) + // No real need for error checking 'cause the edit field is numbers only + RLDS3D_SetSelConeAngles((DWORD)atol(lpszTS), (DWORD)atol(lpszTS)); + return TRUE; + } + else if (HIWORD(wparam) == EN_UPDATE && LOWORD(wparam) == IDC_CONEOUTSIDEVOLUME) { + // Get value from edit box (get length, check lenth, set first char to length, request string, end it with 0) + int stringlength = SendDlgItemMessage(win, IDC_CONEOUTSIDEVOLUME, EM_LINELENGTH, 0, 0); + if (stringlength > 10) return TRUE; + lpszTS[0] = (char)stringlength; + SendDlgItemMessage(win, IDC_CONEOUTSIDEVOLUME, EM_GETLINE, 0, (LPARAM) lpszTS); + lpszTS[stringlength] = 0; + // Set value in RLDS3D (convert string to long and go crazy with the bad boy) + RLDS3D_SetSelConeOutsideVolume(atol(lpszTS)); + return TRUE; + } + else if (HIWORD(wparam) == EN_UPDATE && LOWORD(wparam) == IDC_MAXIMUMDISTANCE) { + // Get value from edit box (get length, check lenth, set first char to length, request string, end it with 0) + int stringlength = SendDlgItemMessage(win, IDC_MAXIMUMDISTANCE, EM_LINELENGTH, 0, 0); + if (stringlength > 10) return TRUE; + lpszTS[0] = (char)stringlength; + SendDlgItemMessage(win, IDC_MAXIMUMDISTANCE, EM_GETLINE, 0, (LPARAM) lpszTS); + lpszTS[stringlength] = 0; + // Set value in RLDS3D (convert string to long and go crazy with the bad boy) + RLDS3D_SetSelMaximumDistance(D3DVAL(atof(lpszTS))); + return TRUE; + } + else if (HIWORD(wparam) == EN_UPDATE && LOWORD(wparam) == IDC_MINIMUMDISTANCE) { + // Get value from edit box (get length, check lenth, set first char to length, request string, end it with 0) + int stringlength = SendDlgItemMessage(win, IDC_MINIMUMDISTANCE, EM_LINELENGTH, 0, 0); + if (stringlength > 10) return TRUE; + lpszTS[0] = (char)stringlength; + SendDlgItemMessage(win, IDC_MINIMUMDISTANCE, EM_GETLINE, 0, (LPARAM) lpszTS); + lpszTS[stringlength] = 0; + // Set value in RLDS3D (convert string to long and go crazy with the bad boy) + RLDS3D_SetSelMinimumDistance(D3DVAL(atof(lpszTS))); + return TRUE; + } + else return FALSE; + } + break; + } + return FALSE; +} + +#define SIGN_EXTEND(w) ((((int)(w)) << 16) >> 16) + +/* + * Handle messages for the main application window + */ + +LONG FAR PASCAL WindowProc(HWND win, UINT msg, WPARAM wparam, LPARAM lparam) +{ + HANDLE inst_handle; + static HCURSOR oldCursor = NULL; + + switch (msg) + { + case WM_KEYDOWN: + { + switch (wparam) + { + + case 'A': + RLDS3D_SetCamVelRelToCam(D3DVAL(5.0), D3DVAL(0.0), D3DVAL(0.0)); + break; + + case 'Z': + RLDS3D_SetCamVelRelToCam(D3DVAL(-5.0), D3DVAL(0.0), D3DVAL(0.0)); + break; + + case VK_RIGHT: + RLDS3D_SetCamRotUp(D3DVAL(1.0)); + break; + case VK_LEFT: + RLDS3D_SetCamRotUp(D3DVAL(-1.0)); + break; + case VK_UP: + RLDS3D_SetCamRotRight(D3DVAL(1.0)); + break; + case VK_DOWN: + RLDS3D_SetCamRotRight(D3DVAL(-1.0)); + break; + } + } + break; + + case WM_KEYUP: + switch (wparam) + { + case VK_LEFT: + case VK_RIGHT: + case VK_UP: + case VK_DOWN: + // Stop the camera from rotating completely + RLDS3D_SetCamRotForward(D3DVAL(0.0)); + break; + + case 'A': + case 'Z': + RLDS3D_SetCamVelRelToCam(D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)); + break; + } + break; + + case WM_LBUTTONDOWN: + { HCURSOR hCur; + int x = LOWORD(lparam); + int y = HIWORD(lparam); + last_x = x; + last_y = y; + BOOL bChanged = FALSE; + RLDS3D_FindAndSelectVisual(x, y, &bChanged); + // Get rid of the Selected Object Cfg dialog if we've selected a new object + if (bChanged && hSelCfgDlg) EndDialog(hSelCfgDlg, TRUE); + left_drag = TRUE; + SetCapture(win); + /* change to a groovy cursor */ + hCur = LoadCursor(NULL, IDC_ARROW); + if (hCur) oldCursor = SetCursor(hCur); + else oldCursor = NULL; + } + break; + + case WM_LBUTTONUP: + ReleaseCapture(); + left_drag = FALSE; + if (oldCursor) SetCursor(oldCursor); + break; + + case WM_RBUTTONDOWN: + { + HCURSOR hCur; + int x = LOWORD(lparam); + int y = HIWORD(lparam); + last_x = x; + last_y = y; + BOOL bChanged = FALSE; + RLDS3D_FindAndSelectVisual(x, y, &bChanged); + // Get rid of the Selected Object Cfg dialog if we've selected a new object + if (bChanged && hSelCfgDlg) EndDialog(hSelCfgDlg, TRUE); + right_drag = TRUE; + SetCapture(win); + /* change to a groovy cursor */ + hCur = LoadCursor(NULL, IDC_ARROW); + if (hCur) oldCursor = SetCursor(hCur); + else oldCursor = NULL; + } + break; + + case WM_RBUTTONUP: + right_drag = FALSE; + ReleaseCapture(); + if (oldCursor) SetCursor(oldCursor); + break; + + case WM_MOUSEMOVE: + if ((wparam & MK_LBUTTON) && left_drag) + { double delta_x, delta_y; + delta_x = SIGN_EXTEND(LOWORD(lparam)) - last_x; + delta_y = -SIGN_EXTEND((HIWORD(lparam)) - last_y); + last_x = SIGN_EXTEND(LOWORD(lparam)); + last_y = SIGN_EXTEND(HIWORD(lparam)); + { + double delta_r = sqrt(delta_x * delta_x + delta_y * delta_y); + double radius = 50; + double denom; + + denom = 0.05 * sqrt(radius * radius + delta_r * delta_r); + + if (delta_r == 0 || denom == 0) break; + RLDS3D_SetSelectedRotRelToCam(D3DDivide(D3DVAL((float) delta_y), D3DVAL((float) delta_r)), + D3DDivide(D3DVAL((float) -delta_x), D3DVAL((float) delta_r)), + D3DVAL(0.0), + D3DDivide(D3DVAL((float) delta_r), D3DVAL((float) denom))); + } + } + else if ((wparam & MK_RBUTTON) && right_drag) + { double delta_x, delta_y; + + delta_x = SIGN_EXTEND(LOWORD(lparam)) - last_x; + delta_y = SIGN_EXTEND(HIWORD(lparam)) - last_y; + last_x = SIGN_EXTEND(LOWORD(lparam)); + last_y = SIGN_EXTEND(HIWORD(lparam)); + RLDS3D_MoveSelectedPosByScreenCoords(delta_x, delta_y); + } + break; + case WM_COMMAND: + switch( wparam & 0xffff ) + { + case MENU_MOTION_ORBITSELECTEDOBJECT: + { + RLDS3D_OrbitSelected(); + } + break; + case MENU_MOTION_BULLETSELECTEDOBJECT: + { + RLDS3D_BulletSelected(); + } + break; + case MENU_SOUND_ATTACHSOUND: + { + if (RLDS3D_SoundInitialized()) + { + if (RLDS3D_FrameSelected()) { + char* file = OpenNewSoundFile(win); + if (file) RLDS3D_AttachSound(file); + } + else MessageBox(win, "No object selected to attach a sound to!", "Doh!", MB_ICONEXCLAMATION); + } + else MessageBox(win, "Sound not initialized!", "Doh!", MB_ICONEXCLAMATION); + } + break; + case MENU_SOUND_REMOVESOUND: + RLDS3D_RemoveSound(); + break; + case MENU_SOUND_REMOVEALLSOUNDS: + RLDS3D_RemoveAllSounds(); + break; + + case MENU_SOUND_PLAYSOUND: + RLDS3D_PlaySound(FALSE); + break; + case MENU_SOUND_PLAYSOUNDLOOPING: + RLDS3D_PlaySound(TRUE); + break; + case MENU_SOUND_STOPSOUND: + RLDS3D_StopSelectedSound(); + break; + + case MENU_SOUND_STOPALLSOUNDS: + RLDS3D_StopAllSounds(); + break; + + case MENU_SOUND_SELECTEDSOUNDPROPERTIES: + { + if (RLDS3D_SoundInitialized()) { + if (RLDS3D_SoundSelected()) { + inst_handle = (HANDLE) GetWindowLong(win, GWL_HINSTANCE); + HWND mydial = CreateDialog(inst_handle, "SelectedParamBox", win, (int(__stdcall*)(void))SelectedParamDlgProc); + if (mydial) { + ShowWindow(mydial, SW_SHOW); + UpdateWindow(mydial); + } + } + else MessageBox(win, "No sound currently selected", "Doh!", MB_ICONEXCLAMATION); + } + else MessageBox(win, "Sound not initialized!", "Doh!", MB_ICONEXCLAMATION); + } + break; + case MENU_SOUND_GLOBALPROPERTIES: + { + if (RLDS3D_SoundInitialized()) { + inst_handle = (HANDLE) GetWindowLong(win, GWL_HINSTANCE); + HWND mydial = CreateDialog(inst_handle, "GlobalParamBox", win, (int(__stdcall*)(void))GlobalParamDlgProc); + if (mydial) { + ShowWindow(mydial, SW_SHOW); + UpdateWindow(mydial); + } + } + else MessageBox(win, "Sound not initialized!", "Doh!", MB_ICONEXCLAMATION); + } + break; + + case MENU_FILE_ABOUT: + { + inst_handle = (HANDLE) GetWindowLong(win, GWL_HINSTANCE); + DialogBox(inst_handle,"AboutBox", win, (int(__stdcall*)(void))AboutDlgProc); + } + break; + + case MENU_FILE_OPEN: + { + char *file = OpenNewFile(win); + if (file) { + RLDS3D_LoadXOF(file); + } + } + break; + + case MENU_FILE_EXIT: + PostQuitMessage(0); + break; + + case MENU_EDIT_CUT: + RLDS3D_CutVisual(); + break; + + case MENU_EDIT_COPY: + RLDS3D_CopyVisual(); + break; + + case MENU_EDIT_PASTE: + RLDS3D_PasteVisual(); + break; + + case MENU_EDIT_DELETE: + RLDS3D_DeleteVisual(); + break; + + case MENU_EDIT_COLOUR: + // Currently everything is handled there but the selection wheel maybe should be out here? + RLDS3D_SetSelColour(); + break; + + case MENU_EDIT_BOXES: + { + HMENU menu; + if (RLDS3D_GetBoxes() == TRUE) RLDS3D_SetBoxes(FALSE); else RLDS3D_SetBoxes(TRUE); + int checked = (RLDS3D_GetBoxes()==TRUE) ? MF_CHECKED : MF_UNCHECKED; + menu = GetMenu(win); + menu = GetSubMenu(menu, 1); + CheckMenuItem(menu, MENU_EDIT_BOXES, MF_BYCOMMAND|checked); + } + break; + + case MENU_QUALITY_LIGHTING: + ToggleLighting(win); + break; + + // Fill Modes + case MENU_QUALITY_POINTS: + SetFillMode(win, D3DRMFILL_POINTS); + break; + + case MENU_QUALITY_WIREFRAME: + SetFillMode(win, D3DRMFILL_WIREFRAME); + break; + + case MENU_QUALITY_SOLID: + SetFillMode(win, D3DRMFILL_SOLID); + break; + + // Shading modes + case MENU_QUALITY_FLAT: + SetShadeMode(win, D3DRMSHADE_FLAT); + break; + + case MENU_QUALITY_GOURAUD: + SetShadeMode(win, D3DRMSHADE_GOURAUD); + break; + + case MENU_QUALITY_PHONG: + SetShadeMode(win, D3DRMSHADE_PHONG); + break; + + // Color models + case MENU_MODEL_MONO: + SetModel(win, D3DCOLOR_MONO); + break; + + case MENU_MODEL_RGB: + SetModel(win, D3DCOLOR_RGB); + break; + + case MENU_DITHER: + ToggleDither(win); + break; + + case MENU_TEXTURE_FILTERING: + ToggleTextureFiltering(win); + break; + + case MENU_LIGHT_DIRECTIONAL: + RLDS3D_AddDirectionalLight(); + break; + case MENU_LIGHT_PARALLEL_POINT: + RLDS3D_AddParallelPointLight(); + break; + case MENU_LIGHT_POINT: + RLDS3D_AddPointLight(); + break; + case MENU_LIGHT_SPOT: + RLDS3D_AddSpotlight(); + break; + } + break; + + case WM_DESTROY: + PostQuitMessage( 0 ); + break; + + case WM_SIZE: + { + int width = LOWORD(lparam); + int height = HIWORD(lparam); + RLDS3D_ResizeViewport(width, height); + } + break; + + case WM_ACTIVATE: + { + RLDS3D_HandleActivate(wparam); + } + break; + + case WM_PAINT: + if (RLDS3D_WinDevice()) + { + RECT r; + PAINTSTRUCT ps; + + if (GetUpdateRect(win, &r, FALSE)) + { BeginPaint(win, &ps); + RLDS3D_HandlePaint(&ps); + EndPaint(win, &ps); + } + } + else return DefWindowProc(win, msg, wparam, lparam); + + default: + return DefWindowProc(win, msg, wparam, lparam); + } + return 0L; +} + diff --git a/sdk/samples/ds3dview/viewer.ico b/sdk/samples/ds3dview/viewer.ico new file mode 100644 index 0000000..a506456 Binary files /dev/null and b/sdk/samples/ds3dview/viewer.ico differ diff --git a/sdk/samples/ds3dview/viewer.rc b/sdk/samples/ds3dview/viewer.rc new file mode 100644 index 0000000..444d1ce --- /dev/null +++ b/sdk/samples/ds3dview/viewer.rc @@ -0,0 +1,314 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +VIEWERICON ICON DISCARDABLE "viewer.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +VIEWERMENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&About...", MENU_FILE_ABOUT + MENUITEM "&Add 3D Visual...", MENU_FILE_OPEN + MENUITEM SEPARATOR + MENUITEM "E&xit", MENU_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Cu&t", MENU_EDIT_CUT + MENUITEM "&Copy", MENU_EDIT_COPY + MENUITEM "&Paste", MENU_EDIT_PASTE + MENUITEM "&Delete", MENU_EDIT_DELETE + MENUITEM SEPARATOR + MENUITEM "C&hange Colour...", MENU_EDIT_COLOUR + MENUITEM SEPARATOR + MENUITEM "&Bounding Boxes", MENU_EDIT_BOXES + END + POPUP "&Renderer" + BEGIN + MENUITEM "&Lighting\tCtrl+L", MENU_QUALITY_LIGHTING + , CHECKED + MENUITEM SEPARATOR + MENUITEM "&Points\tCtrl+P", MENU_QUALITY_POINTS + MENUITEM "&Wireframe\tCtrl+W", MENU_QUALITY_WIREFRAME + MENUITEM "&Solid\tCtrl+S", MENU_QUALITY_SOLID, CHECKED + MENUITEM SEPARATOR + MENUITEM "&Flat\tCtrl+F", MENU_QUALITY_FLAT, CHECKED + MENUITEM "&Gouraud\tCtrl+G", MENU_QUALITY_GOURAUD + MENUITEM "Ph&ong\tCtrl+O", MENU_QUALITY_PHONG + MENUITEM SEPARATOR + MENUITEM "&Mono Model", MENU_MODEL_MONO, CHECKED + MENUITEM "&RGB Model", MENU_MODEL_RGB + MENUITEM SEPARATOR + MENUITEM "&Dithered\tCtrl+D", MENU_DITHER + MENUITEM "&Texture Filtering", MENU_TEXTURE_FILTERING + END + POPUP "&Lights" + BEGIN + MENUITEM "&Directional", MENU_LIGHT_DIRECTIONAL + MENUITEM "&Parallel Point", MENU_LIGHT_PARALLEL_POINT + MENUITEM "P&oint", MENU_LIGHT_POINT + MENUITEM "&Spot", MENU_LIGHT_SPOT + END + POPUP "&Sound" + BEGIN + MENUITEM "Attach Sound\tCtrl-A", MENU_SOUND_ATTACHSOUND + MENUITEM "Remove Sound", MENU_SOUND_REMOVESOUND + MENUITEM "Remove All Sounds", MENU_SOUND_REMOVEALLSOUNDS + MENUITEM SEPARATOR + MENUITEM "Play Sound Once\tCtrl-P", MENU_SOUND_PLAYSOUND + MENUITEM "Play Sound Looping\tCtrl-L", MENU_SOUND_PLAYSOUNDLOOPING + MENUITEM "Stop Sound\tCtrl-S", MENU_SOUND_STOPSOUND + MENUITEM "Stop All Sounds", MENU_SOUND_STOPALLSOUNDS + MENUITEM SEPARATOR + MENUITEM "Global Properties", MENU_SOUND_GLOBALPROPERTIES + MENUITEM "Selected Sound Properties", MENU_SOUND_SELECTEDSOUNDPROPERTIES + + END + POPUP "Motion" + BEGIN + MENUITEM "Orbit Selected Object", MENU_MOTION_ORBITSELECTEDOBJECT + + MENUITEM "Bullet Selected Object", MENU_MOTION_BULLETSELECTEDOBJECT + + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +VIEWERACCEL ACCELERATORS MOVEABLE PURE +BEGIN + "D", MENU_DITHER, VIRTKEY, CONTROL, NOINVERT + "F", MENU_QUALITY_FLAT, VIRTKEY, CONTROL, NOINVERT + "G", MENU_QUALITY_GOURAUD, VIRTKEY, CONTROL, NOINVERT + "L", MENU_QUALITY_LIGHTING, VIRTKEY, CONTROL, NOINVERT + "O", MENU_QUALITY_PHONG, VIRTKEY, CONTROL, NOINVERT + "P", MENU_QUALITY_POINTS, VIRTKEY, CONTROL, NOINVERT + "S", MENU_QUALITY_GOURAUD, VIRTKEY, CONTROL, NOINVERT + VK_DELETE, MENU_EDIT_DELETE, VIRTKEY, NOINVERT + VK_DELETE, MENU_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT + VK_INSERT, MENU_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + VK_INSERT, MENU_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT + "W", MENU_QUALITY_FLAT, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +ABOUTBOX DIALOG DISCARDABLE 22, 17, 144, 75 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU + +CAPTION "About DirectSound3D Viewer" + +FONT 8, "MS Sans Serif" +BEGIN + CTEXT "Copyright � 1996 Microsoft Corporation",-1,0,40,144,8 + DEFPUSHBUTTON "OK",IDOK,53,59,32,14,WS_GROUP + ICON "ViewerIcon",-1,59,15,21,20 +END + + +ORBITBOX DIALOG DISCARDABLE 0, 0, 64, 55 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | WS_POPUP | WS_CAPTION +CAPTION "Houston" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Stop Orbit",IDOK,7,34,50,14 + EDITTEXT IDC_ORBIT,7,7,50,13 +END + +BULLETBOX DIALOG DISCARDABLE 0, 0, 64, 55 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | WS_POPUP | WS_CAPTION +CAPTION "Smith & Wesson" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Stop Bullet",IDOK,7,34,50,14 + EDITTEXT IDC_BULLET,7,7,50,13 +END + +GLOBALPARAMBOX DIALOG DISCARDABLE 0, 0, 272, 90 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "3D Sound - World Parameters" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "DISTANCE FACTOR:",IDC_STATIC,7,11,70,8 + EDITTEXT IDC_DISTANCEFACTOR,83,8,40,14 + LTEXT "Meters per unit distance in the world",IDC_STATIC, + 130,12,125,8 + LTEXT "ROLLOFF FACTOR:",IDC_STATIC,7,31,66,8 + EDITTEXT IDC_ROLLOFFFACTOR,83,28,40,14 + LTEXT "% of real world attenuation due to distance",IDC_STATIC, + 130,31,134,8 + LTEXT "DOPPLER FACTOR:",IDC_STATIC,7,51,68,8 + EDITTEXT IDC_DOPPLERFACTOR,83,48,40,14 + LTEXT "% of real world doppler effect applied",IDC_STATIC,130, + 51,116,8 +END + +SELECTEDPARAMBOX DIALOG DISCARDABLE 0, 0, 132, 177 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "3D Sound - Selected Object Parameters" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Cone Properties",IDC_STATIC,7,7,120,80 + LTEXT "CONE ANGLE:",IDC_STATIC,16,26,49,8 + EDITTEXT IDC_CONEANGLE,78,23,40,14 + LTEXT "Attenuation outside cone (1/100ths dB, must be negative)", + IDC_STATIC,16,46,56,33 + EDITTEXT IDC_CONEOUTSIDEVOLUME,78,50,40,14 + GROUPBOX "Volume Attenuation Characteristics",IDC_STATIC,7,92,120, + 76 + LTEXT "Minimum Distance for attenuation effects",IDC_STATIC,16, + 104,64,28 + EDITTEXT IDC_MINIMUMDISTANCE,78,106,40,14,ES_AUTOHSCROLL + LTEXT "Maximum Distance for attenuation effects",IDC_STATIC,16, + 132,64,28 + EDITTEXT IDC_MAXIMUMDISTANCE,78,134,40,14,ES_AUTOHSCROLL +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + "ORBITBOX", DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 57 + TOPMARGIN, 7 + BOTTOMMARGIN, 48 + END + + "BULLETBOX", DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 57 + TOPMARGIN, 7 + BOTTOMMARGIN, 48 + END + + "GLOBALPARAMBOX", DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 265 + TOPMARGIN, 7 + BOTTOMMARGIN, 83 + HORZGUIDE, 25 + HORZGUIDE, 45 + HORZGUIDE, 65 + HORZGUIDE, 85 + END + + "SELECTEDPARAMBOX", DIALOG + BEGIN + LEFTMARGIN, 7 + VERTGUIDE, 14 + TOPMARGIN, 7 + BOTTOMMARGIN, 168 + HORZGUIDE, 30 + HORZGUIDE, 55 + HORZGUIDE, 70 + HORZGUIDE, 108 + END + + "WAITBOX", DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 114 + TOPMARGIN, 7 + BOTTOMMARGIN, 15 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sdk/samples/ds3dview/watcom.mk b/sdk/samples/ds3dview/watcom.mk new file mode 100644 index 0000000..aaeccd4 --- /dev/null +++ b/sdk/samples/ds3dview/watcom.mk @@ -0,0 +1,43 @@ +NAME = ds3dview +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =..\..\..\lib\ddraw.lib ..\..\..\lib\d3drm.lib ..\..\..\lib\dsound.lib uuid.lib ole32.lib comctl32.lib + +OBJS = viewer.obj file.obj rodcone.obj rlds3d.obj dsutil3d.obj + +SYS = nt_win + +!ifdef DEBUG +COPT =-DDEBUG -d2 +LOPT = debug all +ROPT =-DDEBUG +!else +COPT =-oaxt -d1 +LOPT = +ROPT = +!endif + +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +!include ..\..\watsdk.mk + +$(NAME).$(EXT): $(OBJS) tmp.lib $(NAME).lnk $(RES) + $(LINK) $(LFLAGS) library tmp.lib @$(NAME).lnk + $(RC) $(RES) + +# +# need this because Watcom's libs don't have the ACM entries and the IMPORT +# statement on the linker doesn't work the way we want +# +tmp.lib : tmp.lbc + @wlib -q tmp.lib @tmp.lbc > NUL + +tmp.lbc : ..\$(MAKENAME) + @%write tmp.lbc ++_acmMetrics.'MSACM32.DLL'._acmMetrics.acmMetrics diff --git a/sdk/samples/dsshow/debug.h b/sdk/samples/dsshow/debug.h new file mode 100644 index 0000000..d64de72 --- /dev/null +++ b/sdk/samples/dsshow/debug.h @@ -0,0 +1,80 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: debug.h + * Content: debug header + * + ***************************************************************************/ +#ifndef __DEBUG_INCLUDED__ +#define __DEBUG_INCLUDED__ +#ifdef __cplusplus +extern "C" +{ +#endif + +// +// +// +// +#ifdef DEBUG + #define DEBUG_SECTION "Debug" // section name for + #define DEBUG_MODULE_NAME "DSSHOW" // key name and prefix for output + #define DEBUG_MAX_LINE_LEN 255 // max line length (bytes!) +#endif + + +// +// based code makes since only in win 16 (to try and keep stuff out of +// [fixed] data segments, etc)... +// +#ifndef BCODE +#ifdef _WIN32 + #define BCODE +#else + #define BCODE _based(_segname("_CODE")) +#endif +#endif + + + + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +#ifdef DEBUG + BOOL WINAPI DbgEnable(BOOL fEnable); + UINT WINAPI DbgGetLevel(void); + UINT WINAPI DbgSetLevel(UINT uLevel); + UINT WINAPI DbgInitialize(BOOL fEnable); + void WINAPI _Assert( char * szFile, int iLine ); + + void FAR CDECL dprintf(UINT uDbgLevel, LPSTR szFmt, ...); + + #define D(x) {x;} + #define DPF dprintf + #define DPI(sz) {static char BCODE ach[] = sz; OutputDebugStr(ach);} + #define ASSERT(x) if( !(x) ) _Assert( __FILE__, __LINE__) +#else + #define DbgEnable(x) FALSE + #define DbgGetLevel() 0 + #define DbgSetLevel(x) 0 + #define DbgInitialize(x) 0 + + #ifdef _MSC_VER + #pragma warning(disable:4002) + #endif + + #define D(x) + #define DPF() + #define DPI(sz) + #define ASSERT(x) +#endif + +#ifdef __cplusplus +} +#endif +#endif // __DEBUG_INCLUDED__ diff --git a/sdk/samples/dsshow/dsenum.c b/sdk/samples/dsshow/dsenum.c new file mode 100644 index 0000000..0a461af --- /dev/null +++ b/sdk/samples/dsshow/dsenum.c @@ -0,0 +1,142 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: dstrenum.c + * Content: Illustrates enumerating DirectSound drivers + * + ***************************************************************************/ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <dsound.h> +#include <memory.h> + +#include "dsenum.h" +#include "resource.h" + +extern HINSTANCE hInst; +extern HWND hWndMain; + + + +/****************************************************************************/ +/* DoDSoundEnumerate() */ +/* */ +/* This function takes care of handling the DirectSound enumeration, which*/ +/* simply means creating a dialog box, at this point... */ +/****************************************************************************/ +BOOL DoDSoundEnumerate( LPGUID lpGUID ) + { + if( DialogBoxParam( hInst, MAKEINTRESOURCE(IDD_DSENUMBOX), hWndMain, + DSEnumDlgProc, (LPARAM)lpGUID )) + return( TRUE ); + + return( FALSE ); + } + +/****************************************************************************/ +/* DSEnumDlgProc() */ +/* */ +/* Dialog procedure for the DSound enumeration choice dialog. Allows the */ +/* user to choose from installed drivers. Returns TRUE on error. */ +/****************************************************************************/ +BOOL CALLBACK DSEnumDlgProc( HWND hDlg, UINT msg, + WPARAM wParam, LPARAM lParam ) + { + static HWND hCombo; + static LPGUID lpGUID; + LPGUID lpTemp; + int i; + + switch( msg ) + { + case WM_INITDIALOG: + hCombo = GetDlgItem( hDlg, IDC_DSENUM_COMBO ); + lpGUID = (LPGUID)lParam; + + if( DirectSoundEnumerate( (LPDSENUMCALLBACK)DSEnumProc, &hCombo ) != DS_OK ) + { + EndDialog( hDlg, TRUE ); + return( TRUE ); + } + if( ComboBox_GetCount( hCombo )) + ComboBox_SetCurSel( hCombo, 0 ); + else + { + EndDialog( hDlg, TRUE ); + return( TRUE ); + } + return( TRUE ); + + + case WM_COMMAND: + switch( LOWORD( wParam )) + { + case IDOK: + for( i = 0; i < ComboBox_GetCount( hCombo ); i++ ) + { + lpTemp = (LPGUID)ComboBox_GetItemData( hCombo, i ); + if( i == ComboBox_GetCurSel( hCombo )) + { + if( lpTemp != NULL ) + memcpy( lpGUID, lpTemp, sizeof(GUID)); + else + lpGUID = NULL; + } + if( lpTemp ) + LocalFree( lpTemp ); + } + // If we got the NULL GUID, then we want to open the default + // sound driver, so return with an error and the init code + // will know not to pass in the guID and will send NULL + // instead. + if( lpGUID == NULL ) + EndDialog( hDlg, TRUE ); + else + EndDialog( hDlg, FALSE ); + return( TRUE ); + + case IDCANCEL: + // Force a NULL GUID + EndDialog( hDlg, TRUE ); + return( TRUE ); + } + break; + + + default: + return( FALSE ); + } + + return( FALSE ); + } + + +/****************************************************************************/ +/* DSEnumProc() */ +/* */ +/* This is the Enumeration procedure called by DirectSoundEnumerate with */ +/* the parameters of each DirectSound Object available in the system. */ +/****************************************************************************/ +BOOL CALLBACK DSEnumProc( LPGUID lpGUID, LPSTR lpszDesc, + LPSTR lpszDrvName, LPVOID lpContext ) + { + HWND hCombo = *(HWND *)lpContext; + LPGUID lpTemp = NULL; + + if( lpGUID != NULL ) + { + if(( lpTemp = LocalAlloc( LPTR, sizeof(GUID))) == NULL ) + return( TRUE ); + + memcpy( lpTemp, lpGUID, sizeof(GUID)); + } + + ComboBox_AddString( hCombo, lpszDesc ); + ComboBox_SetItemData( hCombo, + ComboBox_FindString( hCombo, 0, lpszDesc ), + lpTemp ); + return( TRUE ); + } diff --git a/sdk/samples/dsshow/dsenum.h b/sdk/samples/dsshow/dsenum.h new file mode 100644 index 0000000..3eb360a --- /dev/null +++ b/sdk/samples/dsshow/dsenum.h @@ -0,0 +1,25 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: dsenum.h + * Content: Direct Sound Enumeration defines + * + * + ***************************************************************************/ + +#ifndef __DSENUM_INCLUDED__ +#define __DSENUM_INCLUDED__ + + +// Function declarations + +BOOL DoDSoundEnumerate( LPGUID ); + +BOOL CALLBACK DSEnumProc( LPGUID, LPSTR, LPSTR, LPVOID ); +BOOL CALLBACK DSEnumDlgProc( HWND, UINT, WPARAM, LPARAM ); + + +#endif + + diff --git a/sdk/samples/dsshow/dsshow.def b/sdk/samples/dsshow/dsshow.def new file mode 100644 index 0000000..683ef99 --- /dev/null +++ b/sdk/samples/dsshow/dsshow.def @@ -0,0 +1,3 @@ +NAME DSSHOW + +DESCRIPTION 'DirectSound Sample App' diff --git a/sdk/samples/dsshow/dsshow.rc b/sdk/samples/dsshow/dsshow.rc new file mode 100644 index 0000000..d2ee2e7 --- /dev/null +++ b/sdk/samples/dsshow/dsshow.rc @@ -0,0 +1,192 @@ +//Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "winver.h" +#include "dlgs.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINMENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Open", IDPD_FILE_OPEN + MENUITEM "E&xit", IDPD_FILE_EXIT + END + POPUP "&Options" + BEGIN + MENUITEM "&Output Type", IDPD_OPTIONS_OUTPUTTYPE + MENUITEM "&Check Latency", IDPD_CHECKLATENCY + MENUITEM "&Enumerate Drivers", IDPD_ENUMDRIVERS + END + POPUP "&Help" + BEGIN + MENUITEM "About", IDPD_HELP_ABOUT + END +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "#include ""dlgs.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +///////////////////////////////////////////////////////////////////////////// +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OUTPUTBUFFERTYPE DIALOG DISCARDABLE 0, 0, 209, 215 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Output Buffer Type" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",ID_OK,24,187,50,14 + PUSHBUTTON "Cancel",ID_CANCEL,79,187,50,14 + LISTBOX IDC_FORMATS,20,40,167,133,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP | LBS_NOTIFY + LTEXT "Pick Output Buffer Type",IDC_STATIC,13,25,84,10 + PUSHBUTTON "&Apply",ID_APPLY,135,187,50,14 +END + +IDD_ABOUT DIALOG DISCARDABLE 0, 0, 186, 81 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",ID_OK,65,54,50,14 + CTEXT "Direct Sound Test Application",IDC_STATIC,39,7,133,12 + CTEXT "Copyright (c) 1995-1996 Microsoft Corporation",IDC_STATIC,41, + 20,133,24 + ICON IDI_ICON3,IDC_STATIC,9,8,18,20 +END + +IDD_CHECKLATENCY DIALOG DISCARDABLE 0, 0, 256, 159 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Check Latency" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "&Done",ID_DONE,105,140,50,14 + LISTBOX IDC_FILES_LB,18,24,143,82, + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LTEXT "Files Loaded:",IDC_STATIC,10,9,46,10 + DEFPUSHBUTTON "&Play",ID_PLAY,184,28,50,14 + PUSHBUTTON "&Stop",ID_STOP,184,47,50,14 + LTEXT "You can use this dialog to quickly start and stop sounds to check their latency", + IDC_STATIC,9,113,229,22 + LTEXT "Beta Dialog: Not fully tested",IDC_STATIC,162,4,92,11 +END + +IDD_DSENUMBOX DIALOG DISCARDABLE 0, 0, 184, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Choose a DirectSound Driver..." +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,34,43,50,14 + PUSHBUTTON "Cancel",IDCANCEL,100,43,50,14 + COMBOBOX IDC_DSENUM_COMBO,4,12,176,36,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Driver Description:",IDC_STATIC,4,4,116,8 +END + +IDD_FILEOPEN_NEST DIALOG DISCARDABLE 0, 0, 294, 95 +STYLE DS_MODALFRAME | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS | + WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Create as a ""sticky buffer""",IDC_FONEST_STICKY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,59,77,215,10 + LTEXT "",stc32,7,7,280,70 +END + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +IDI_APP ICON DISCARDABLE "GENERIC.ICO" +IDI_ICON1 ICON DISCARDABLE "icon1.ico" +IDI_ICON2 ICON DISCARDABLE "icon2.ico" +IDI_ICON3 ICON DISCARDABLE "icon3.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""winver.h""\r\n" + "#include ""dlgs.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +///////////////////////////////////////////////////////////////////////////// +#endif // APSTUDIO_INVOKED + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sdk/samples/dsshow/generic.ico b/sdk/samples/dsshow/generic.ico new file mode 100644 index 0000000..9024ceb Binary files /dev/null and b/sdk/samples/dsshow/generic.ico differ diff --git a/sdk/samples/dsshow/icon1.ico b/sdk/samples/dsshow/icon1.ico new file mode 100644 index 0000000..d3f65ab Binary files /dev/null and b/sdk/samples/dsshow/icon1.ico differ diff --git a/sdk/samples/dsshow/icon2.ico b/sdk/samples/dsshow/icon2.ico new file mode 100644 index 0000000..21926a9 Binary files /dev/null and b/sdk/samples/dsshow/icon2.ico differ diff --git a/sdk/samples/dsshow/icon3.ico b/sdk/samples/dsshow/icon3.ico new file mode 100644 index 0000000..3bd250c Binary files /dev/null and b/sdk/samples/dsshow/icon3.ico differ diff --git a/sdk/samples/dsshow/makefile b/sdk/samples/dsshow/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/dsshow/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/dsshow/msvc.mk b/sdk/samples/dsshow/msvc.mk new file mode 100644 index 0000000..28a470a --- /dev/null +++ b/sdk/samples/dsshow/msvc.mk @@ -0,0 +1,42 @@ +NAME = dsshow +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib dsound.lib \ + comdlg32.lib gdi32.lib winmm.lib msacm32.lib libc.lib uuid.lib ole32.lib comctl32.lib + +OBJS = shell.obj wassert.obj wave.obj dsenum.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/dsshow/readme.txt b/sdk/samples/dsshow/readme.txt new file mode 100644 index 0000000..6338d84 --- /dev/null +++ b/sdk/samples/dsshow/readme.txt @@ -0,0 +1,36 @@ +DirectSound Mixing Test (dsshow) +-------------------------------- + +This app allows the user to play with most of the controls exposed by +DirectSoundBuffers, including the mixing of multiple sounds, and changing +frequency, pan, and volume of those sounds. + +Open one or more .wav files using the File.Open dialog. A control bar will +be displayed for each file opened. Dsshow uses static buffers for its sounds +and is therefore designed for short sounds only. If you try to open a file +that is very large, you will run out of system memory - beware! + +The control bar for each sound contains a bunch of things. First, the file +name is displayed at the top. The next line states whether the buffer is +mixed in software (SW) or hardware (HW), and whether the buffer is playing +or stopped. Dsshow will put buffers in hardware whenever possible. On the +next two lines, the current play and write cursors are displayed. They are +updated every half second or so. Then there are sliders to control the +buffers frequency, pan, and volume settings. At the bottom, there is a +Play/Stop button (it morphs back and forth, try it!) and a Close button (to +delete the file from the view), and a checkbox for Looping. + +The dsshow title bar tells you information about the hardware mixing +capabilities of your sound card. It displays the number of free hw mixing +channels and hw memory (if you have an ISA card like most people). If both +of those numbers are 0, your card does not have hardware mixing. + +There are also two interesting things you can do from the Options menu. +First, you can set the format of the primary buffer by selecting +Options.Output Type. This will list the formats supported by the primary +buffer, and let you choose one. Also, you can toggle Options.Enumerate Drivers +which will show you what objects DirectSoundEnumerate will list for you, +and allow you to select one. This only happens when you start up Dsshow, +so to see the effect, select this menu item, exit Dsshow, and then run Dsshow +again. + diff --git a/sdk/samples/dsshow/resource.h b/sdk/samples/dsshow/resource.h new file mode 100644 index 0000000..7ca58d4 --- /dev/null +++ b/sdk/samples/dsshow/resource.h @@ -0,0 +1,42 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by main.rc +// +#define ID_APPLY 3 +#define IDR_MAINMENU 101 +#define IDD_OUTPUTBUFFERTYPE 102 +#define IDD_ABOUT 103 +#define IDD_DSENUMBOX 109 +#define IDI_ICON1 104 +#define IDI_ICON2 105 +#define IDI_ICON3 107 +#define IDD_CHECKLATENCY 108 +#define IDD_FILEOPEN_NEST 110 +#define IDC_FONEST_STICKY 111 +#define IDC_FORMATS 1000 +#define ID_OK 1001 +#define ID_CANCEL 1002 +#define ID_DONE 1004 +#define IDC_FILES_LB 1005 +#define ID_PLAY 1006 +#define ID_STOP 1007 +#define IDC_DSENUM_COMBO 1008 +#define ID_FILE_EXIT 40002 +#define IDPD_FILE_EXIT 40002 +#define IDPD_FILE_OPEN 40003 +#define IDPD_OPTIONS_OUTPUTTYPE 40004 +#define IDPD_HELP_ABOUT 40005 +#define IDPD_CHECKLATENCY 40006 +#define IDPD_ENUMDRIVERS 40007 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 112 +#define _APS_NEXT_COMMAND_VALUE 40008 +#define _APS_NEXT_CONTROL_VALUE 1009 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sdk/samples/dsshow/shell.c b/sdk/samples/dsshow/shell.c new file mode 100644 index 0000000..61de4f6 --- /dev/null +++ b/sdk/samples/dsshow/shell.c @@ -0,0 +1,3127 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: shell.c + * Content: Direct Sound show-off. + * This app basically uses the direct sound api's and pops up some + * controls that the user can play with at runtime to change + * the sound frequency, panning, volume, etc. It has a few + * other functions built in. + * + * This app also takes a couple command-line parameters. The format is: + * + * DSShow [/PLAY [/LOOP]] [file] [file] ... + * + * Specifying /PLAY causes any specified files to be played as they're + * opened. Adding the /LOOP causes them to loop as well. /LOOP without + * /PLAY means nothing. Everything else is assumed to be one or more file + * names. Filenames can be enclosed in quotes. This also means you can + * drag and drop files onto the program's icon + * + * + ***************************************************************************/ + +#define INITGUID +#include <windows.h> +#include <windowsx.h> +#include <commctrl.h> +#include <commdlg.h> +#include <stdio.h> + +#include <mmsystem.h> +#include <mmreg.h> +#include <msacm.h> +#include <dsound.h> + + +#include "wassert.h" +#include "wave.h" + +#include "resource.h" +#include "shell.h" +#include "dsenum.h" + + +/* Procedure called when the application is loaded for the first time */ + +BOOL ClassInit( hInstance ) +HANDLE hInstance; +{ + WNDCLASS myClass; + + myClass.hCursor = LoadCursor( NULL, IDC_ARROW ); + myClass.hIcon = LoadIcon( hInstance, MAKEINTRESOURCE(IDI_ICON3)); + myClass.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU); + myClass.lpszClassName = (LPSTR)szAppName; + myClass.hbrBackground = (HBRUSH)(COLOR_WINDOW); + myClass.hInstance = hInstance; + myClass.style = CS_HREDRAW | CS_VREDRAW; + myClass.lpfnWndProc = WndProc; + myClass.cbClsExtra = 0; + myClass.cbWndExtra = 0; + + if (!RegisterClass( &myClass ) ) + return FALSE; + + return TRUE; /* Initialization succeeded */ +} + + +/* + * This "hook procedure" is called by the common dialog code for certain + * events that may occur during the life of our nested dialog structure. + * We nest the Explorer style dialog inside our file open dialog so we + * can addd a check box for stick buffers. + */ +UINT CALLBACK FileOpenCustomTemplateDlgProc( hDlg, message, wParam, lParam ) +HWND hDlg; +UINT message; +WPARAM wParam; +LPARAM lParam; +{ + static LPOPENFILENAME lpofn = NULL; + + switch( message ) + { + case WM_INITDIALOG: + lpofn = (LPOPENFILENAME)lParam; + + /* Set the flag to match the current state of the check box control */ + *((LPBOOL)lpofn->lCustData) = SendDlgItemMessage( hDlg, IDC_FONEST_STICKY, + BM_GETCHECK, 0, 0 ); + return TRUE; + + case WM_NOTIFY: + switch(((LPOFNOTIFY)lParam)->hdr.code) + { + case CDN_SELCHANGE: + /* Use this area to process anything that must be updated when the + * user changes the selection in the Common Dialog Box. + * NOTE: Provided only for informational purposes + */ + return FALSE; + + case CDN_FILEOK: + /* We can do lots of things in this notification message. The most + * important is that we can decide whether the Common Dialog call will + * go through or whether it will fail. I decided to handle the checkbox + * control in this one place versus 4 others... -PRN + */ + Assert( lpofn != NULL ); + *((LPBOOL)lpofn->lCustData) = SendDlgItemMessage( hDlg, IDC_FONEST_STICKY, + BM_GETCHECK, 0, 0 ); + /* Returning zero signifies that we "approve" of the OK command, + * and allows the common dialog to finish. + */ + return FALSE; + } + /* Let the default dialog do/continue processing */ + return FALSE; + } + return FALSE; +} + + +int PASCAL WinMain( hInstance, hPrevInstance, lpszCmdLine, cmdShow ) +HINSTANCE hInstance, hPrevInstance; +LPSTR lpszCmdLine; +int cmdShow; +{ + MSG msg; + HWND hWnd; + + // We must call this to ensure the common controls are setup for + // this application + InitCommonControls(); + + if (!hPrevInstance) { + /* Call initialization procedure if this is the first instance */ + if (!ClassInit( hInstance )) + return FALSE; + } + + + hWnd = CreateWindow((LPSTR)szAppName, + (LPSTR)szMessage, + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, + CW_USEDEFAULT, + DX_MINWINDOW, + DY_MINWINDOW, + (HWND)NULL, + (HMENU)NULL, + (HANDLE)hInstance, + (LPSTR)NULL + ); + + if (!hWnd) return (int)msg.wParam; + + // Make a long line across the top. + CreateWindow( + "STATIC", + "", + WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, + 0, + 0, + 8000, + 2, + hWnd, + (HMENU)0, + hInst, + NULL); + + + /* Save instance handle for DialogBox */ + hInst = hInstance; + + ShowWindow( hWnd, cmdShow ); + + if( lpszCmdLine && *lpszCmdLine ) + if( !ParseCommandLine( lpszCmdLine )) + goto Exit_WinMain; + + /* Polling messages from event queue */ + while (GetMessage((LPMSG)&msg, NULL, 0, 0)) { + TranslateMessage((LPMSG)&msg); + DispatchMessage((LPMSG)&msg); + } + +Exit_WinMain: + DestroyWindow(hWnd); + UnregisterClass(szAppName, hInstance); + return (int)msg.wParam; +} + +/* This function updates the status window by writing the specified + string to the window, prepended by a string indicating whether + the buffer is in hardware or software +*/ +void UpdateStatus(FILEINFO *pFileInfo, DWORD dwStatus) +{ + TCHAR szStatus[200]; + DWORD dwPlay, dwWrite; + HRESULT hr; + + lstrcpy(szStatus, pFileInfo->fHardware ? szHW : szSW); + if (dwStatus & DSBSTATUS_BUFFERLOST) + { + lstrcat(szStatus, szLost); + SendMessage(pFileInfo->hWndStatus_TXT, WM_SETTEXT, 0, (LPARAM)szStatus); + } + else if (dwStatus & DSBSTATUS_PLAYING) + { + lstrcat(szStatus, szPlaying); + SendMessage(pFileInfo->hWndStatus_TXT, WM_SETTEXT, 0, (LPARAM)szStatus); + } + else + { + lstrcat(szStatus, szStopped); + SendMessage(pFileInfo->hWndStatus_TXT, WM_SETTEXT, 0, (LPARAM)szStatus); + } + if (pFileInfo->fSticky) + { + lstrcat(szStatus, szSticky); + SendMessage(pFileInfo->hWndStatus_TXT, WM_SETTEXT, 0, (LPARAM)szStatus); + } + hr = IDirectSoundBuffer_GetCurrentPosition(pFileInfo->pDSB, &dwPlay, &dwWrite); + if (DS_OK == hr) { + wsprintf(szStatus, szFmtPlayPosition, dwPlay); + SendMessage(pFileInfo->hWndPlayPosition_TXT, WM_SETTEXT, 0, (LPARAM)szStatus); + wsprintf(szStatus, szFmtWritePosition, dwWrite); + SendMessage(pFileInfo->hWndWritePosition_TXT, WM_SETTEXT, 0, (LPARAM)szStatus); + } + + return; +} + +/* This function updates the main window title to show some + relevant information about the direct sound object +*/ +void UpdateMainStatus() +{ + DSCAPS dsc; + TCHAR szTitle[200]; + + // Update main window title with some relevant info + dsc.dwSize = sizeof(dsc); + IDirectSound_GetCaps(gpds, &dsc); + wsprintf(szTitle, "%s : free hw memory = %dKb, free hw buffers = %d", + szMessage, (dsc.dwFreeHwMemBytes+512)/1024, + dsc.dwFreeHwMixingAllBuffers); + SendMessage(hWndMain, WM_SETTEXT, 0, (LPARAM)szTitle); + return; +} + + +/* This routine will set up everything needed for the app to run. + + Input: + hWnd - App main window handle + + Output: + None. + +*/ + +int AppInit(HWND hWnd) + +{ + + UINT cT; + DSBUFFERDESC dsbd; + BOOL fUseGuid; + HRESULT hr; + DWORD dw; + + // Set up the global window handle. + hWndMain = hWnd; + + // Set up the global File...Open dialog's start directory + GetMediaStartPath(); + + // Set up the file info header + FileInfoFirst.pNext = NULL; + FileInfoFirst.pwfx = NULL; + FileInfoFirst.cox = COX_STARTCONTROL; + FileInfoFirst.coy = COY_STARTCONTROL; + + // Clear the coordinate buffer. Used to find the next available + // position to use for a new control. -1 is the invalid value. + for (cT=0; cT<MAXCONTROLS; cT++) rgfcoxAvail[cT] = FALSE; + + // Setup the timer... + if ((dwTimer = SetTimer(hWnd, 1, TIMERPERIOD, NULL)) == 0) { + MessageBox(hWnd, "Cannot allocate timer, aborting", "DirectSound Demo", + MB_OK|MB_ICONSTOP); + return -1; + } + + // Now set up all the direct sound stuff... + + // Get the largest waveformatex structure. + if (MMSYSERR_NOERROR != acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FORMAT, &dw)) + { + MessageBox(hWnd, "ACM Metrics failed, aborting", "DirectSound Demo", + MB_OK|MB_ICONSTOP); + return -1; + } + + + // Setup the format, frequency, volume, etc. + if ((FileInfoFirst.pwfx = GlobalAllocPtr(GPTR, dw)) == NULL) + { + MessageBox(hWnd, "Out of Memory", "DirectSound Demo", + MB_OK|MB_ICONSTOP); + return -1; + } + + + + FileInfoFirst.pwfx->wFormatTag = WAVE_FORMAT_PCM; + FileInfoFirst.pwfx->nChannels = 2; + FileInfoFirst.pwfx->nSamplesPerSec = 22050; + FileInfoFirst.pwfx->nAvgBytesPerSec = 22050*2*2; + FileInfoFirst.pwfx->nBlockAlign = 4; + FileInfoFirst.pwfx->wBitsPerSample = 16; + FileInfoFirst.pwfx->cbSize = 0; + +#ifdef STARTEIGHTBITS + + FileInfoFirst.pwfx->wFormatTag = WAVE_FORMAT_PCM; + FileInfoFirst.pwfx->nChannels = 2; + FileInfoFirst.pwfx->nSamplesPerSec = 22050; + FileInfoFirst.pwfx->nAvgBytesPerSec = 22050*1*2; + FileInfoFirst.pwfx->nBlockAlign = 2; + FileInfoFirst.pwfx->wBitsPerSample = 8; + FileInfoFirst.pwfx->cbSize = 0; + + +#endif +#ifdef STARTMONO + FileInfoFirst.pwfx->wFormatTag = WAVE_FORMAT_PCM; + FileInfoFirst.pwfx->nChannels = 1; + FileInfoFirst.pwfx->nSamplesPerSec = 22050; + FileInfoFirst.pwfx->nAvgBytesPerSec = 22050*1*2; + FileInfoFirst.pwfx->nBlockAlign = 2; + FileInfoFirst.pwfx->wBitsPerSample = 16; + FileInfoFirst.pwfx->cbSize = 0; +#endif + + // Optionally enumerate DSOUND devices and allow the user to pick one... + + if (!SUCCEEDED(CoInitialize(NULL))) { + MessageBox(hWnd, "Failed to initialize COM library", "DirectSound Demo", MB_OK | MB_ICONSTOP); + return -1; + } + + fEnumDrivers = (BOOL)GetProfileInt( "DSSHOW", "EnumDrivers", FALSE ); + fUseGuid = (fEnumDrivers && !DoDSoundEnumerate(&guID)); + + hr = CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSound, &gpds); + + if (SUCCEEDED(hr) && (NULL != gpds)) { + + hr = IDirectSound_Initialize(gpds, fUseGuid ? &guID : NULL); + if (SUCCEEDED(hr)) { + + // Note we need to set the level to be priority to set the + // format of the primary buffer + hr = IDirectSound_SetCooperativeLevel(gpds, hWndMain, DSSCL_PRIORITY); + if (SUCCEEDED(hr)) { + + // Set up the primary direct sound buffer. + ZeroMemory(&dsbd, sizeof(dsbd)); + dsbd.dwSize = sizeof(dsbd); + dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER; + + hr = IDirectSound_CreateSoundBuffer(gpds, &dsbd, &(FileInfoFirst.pDSB), NULL); + if (SUCCEEDED(hr)) { + + hr = IDirectSoundBuffer_Play(FileInfoFirst.pDSB, 0, 0, DSBPLAY_LOOPING); + if (SUCCEEDED(hr)) { + + UpdateMainStatus(); + + } else { + MessageBox(hWnd, "Cannot play primary buffer", + "DirectSound Demo", MB_OK|MB_ICONSTOP); + IDirectSoundBuffer_Release(FileInfoFirst.pDSB); + FileInfoFirst.pDSB = NULL; + } + + } else { + MessageBox(hWnd, "Cannot create primary buffer", + "DirectSound Demo", MB_OK|MB_ICONSTOP); + } + + } else { + MessageBox(hWnd, "DirectSound SetCooperativeLevel failed", + "DirectSound Demo", MB_OK|MB_ICONSTOP); + } + + } else { + MessageBox(hWnd, "Failed to Initialize DirectSound object", + "DirectSound Demo", MB_OK | MB_ICONSTOP); + } + + if (!SUCCEEDED(hr)) { + IDirectSound_Release(gpds); + gpds = NULL; + } + + } else { + MessageBox(hWnd, "Failed to create DirectSound COM object", + "DirectSound Demo", MB_OK | MB_ICONSTOP); + } + + if (SUCCEEDED(hr)) { + return 0; + } else { + CoUninitialize(); + return -1; + } +} + +/* This will destroy all the created objects, allocated memory, etc. Must be called + before termination of app. + + Input: + hWnd - Window handle of main window + + Output: + None. + +*/ +void AppDestroy( HWND hWnd ) +{ + + HRESULT hr = 0; + + if (dwTimer != 0) + { + KillTimer(hWnd, dwTimer); + dwTimer = 0; + } + + + StopAllDSounds(hWnd, &FileInfoFirst); + FreeAllList(hWnd, &FileInfoFirst); + + + // Destroy the direct sound buffer. + if(FileInfoFirst.pDSB != NULL) + { + IDirectSoundBuffer_Stop(FileInfoFirst.pDSB); + IDirectSoundBuffer_Release(FileInfoFirst.pDSB); + FileInfoFirst.pDSB = NULL; + } + + // Destroy the direct sound object. + if (gpds != NULL) + { + IDirectSound_Release(gpds); + gpds = NULL; + CoUninitialize(); + } + + if (FileInfoFirst.pwfx != NULL) + { + GlobalFreePtr(FileInfoFirst.pwfx); + FileInfoFirst.pwfx = NULL; + } + + if (FileInfoFirst.pbData != NULL) + { + GlobalFreePtr(FileInfoFirst.pbData); + FileInfoFirst.pbData = NULL; + } + + WriteProfileString( "DSSHOW", "EnumDrivers", fEnumDrivers ? "1" : "0" ); + +} + +/* Procedures which make up the window class. */ +long FAR PASCAL WndProc( hWnd, message, wParam, lParam ) +HWND hWnd; +unsigned message; +WPARAM wParam; +LPARAM lParam; +{ + + + + switch (message) + { + + case WM_CREATE: + if (AppInit(hWnd)) return (-1); + break; + + case WM_TIMER: + if (!UIMainWindowTimerHandler(hWnd, wParam, lParam)) + return(DefWindowProc(hWnd, message, wParam, lParam)); + break; + + + case WM_HSCROLL: + if (!UIMainWindowHSBHandler(hWnd, wParam, lParam)) + return(DefWindowProc(hWnd, message, wParam, lParam)); + + break; + + case WM_VSCROLL: + if (!UIMainWindowVSBHandler(hWnd, wParam, lParam)) + return(DefWindowProc(hWnd, message, wParam, lParam)); + break; + + + case WM_INITMENU: + if((HMENU)wParam != GetMenu( hWnd )) + break; + CheckMenuItem((HMENU)wParam, IDPD_ENUMDRIVERS, + fEnumDrivers ? MF_CHECKED : MF_UNCHECKED ); + break; + + case WM_COMMAND: + if (!UIMainWindowCMDHandler(hWnd, wParam, lParam)) + return(DefWindowProc(hWnd, message, wParam, lParam)); + break; + + break; + + /*case WM_PAINT: + { + + break; + }*/ + + + case WM_DESTROY: + AppDestroy(hWnd); + PostQuitMessage( 0 ); + break; + + default: + return DefWindowProc( hWnd, message, wParam, lParam ); + break; + + } + + return(0L); +} + +/* This routine will pop up the open file dialog and open a file, and make any internal + arrangements so we know the file is loaded. + + Input: + hWnd - Handle of parent window. + + Output: + None. + +*/ +void PD_FileOpen( HWND hWnd ) +{ + + char szFileName[MAX_PATH]; + UINT cSamples; + FILEINFO *pFileInfo = NULL; + int nFileName; + BOOL fSticky; + + if (GetNumControls(&FileInfoFirst) >= MAXCONTROLS) + { + MessageBox(hWnd, "No more controls allowed", + "Hold on a sec...", MB_OK); + return; + } + + // Open the file, and check its format, etc. + if (OpenFileDialog(hWnd, szFileName, &nFileName, &fSticky)) + { + + // Allocate the memory for the structure. + if ((pFileInfo = GlobalAllocPtr(GPTR, sizeof(FILEINFO))) == NULL) + { + MessageBox(hWnd, "Cannot add this file", + "Out of Memory", MB_OK|MB_ICONSTOP); + goto ERROR_DONE_ROUTINE; + } + + pFileInfo->pbData = NULL; + pFileInfo->pwfx = NULL; + pFileInfo->pDSB = NULL; + pFileInfo->fSticky = fSticky; + strcpy(pFileInfo->szFileName, szFileName); + + if (WaveLoadFile(szFileName, &pFileInfo->cbSize, + &cSamples, &pFileInfo->pwfx, &pFileInfo->pbData) != 0) + { + MessageBox(hWnd, "Bad wave file or file too big to fit in memory", + "Cannot load wave", MB_OK|MB_ICONSTOP); + goto ERROR_DONE_ROUTINE; + } + + GetNextControlCoords(&FileInfoFirst, + &pFileInfo->cox, &pFileInfo->coy); + + if (NewDirectSoundBuffer(pFileInfo) != 0) + { + MessageBox(hWnd, "Cannot create new buffer", + "Direct Sound Error", MB_OK|MB_ICONSTOP); + goto ERROR_DONE_ROUTINE; + } + + Assert(pFileInfo->pbData != NULL); + + // If we fail after this, make sure to update the list!!! + if (AddToList(&FileInfoFirst, pFileInfo) != 0) + { + MessageBox(hWnd, "Cannot add file to list", + "Out of Memory", MB_OK|MB_ICONSTOP); + goto ERROR_DONE_ROUTINE; + } + + pFileInfo->nFileName = nFileName; + CreateControl(hWnd, pFileInfo, pFileInfo->pwfx->nSamplesPerSec, + (MAXPAN_TB-MINPAN_TB)/2, MINVOL_TB ); + ChangeOutputVol(pFileInfo); + ChangeOutputFreq(pFileInfo); + ChangeOutputPan(pFileInfo); + UpdateMainStatus(); + + } + + goto DONE_ROUTINE; + +ERROR_DONE_ROUTINE: + if (pFileInfo != NULL) + { + + ReleaseDirectSoundBuffer(pFileInfo); + + if (pFileInfo->pwfx != NULL) + { + GlobalFreePtr(pFileInfo->pwfx); + + } + if (pFileInfo->pbData != NULL) + { + GlobalFreePtr(pFileInfo->pbData); + } + + GlobalFreePtr(pFileInfo); + pFileInfo = NULL; + } + +DONE_ROUTINE: + return; + +} + +/* This routine will initialize a new direct sound buffer, + set the data in the buffer, + set the rate, format, etc... + + Input: + pFileInfo - Pointer to file info with all + nessecary info filled, + like pbData, cbData, etc... + + Output: + 0 if successful, else the error code. + +*/ + +int NewDirectSoundBuffer( + FILEINFO *pFileInfo + ) +{ + + DSBUFFERDESC dsbd; + DSBCAPS dsbc; + HRESULT hr; + BYTE *pbData = NULL; + BYTE *pbData2 = NULL; + DWORD dwLength; + DWORD dwLength2; + + // Set up the direct sound buffer. + memset(&dsbd, 0, sizeof(DSBUFFERDESC)); + dsbd.dwSize = sizeof(DSBUFFERDESC); + dsbd.dwFlags = 0; + dsbd.dwFlags |= DSBCAPS_STATIC; + // Use new GetCurrentPosition() accuracy (DirectX 2 feature) + dsbd.dwFlags |= DSBCAPS_CTRLDEFAULT | DSBCAPS_GETCURRENTPOSITION2; + if (pFileInfo->fSticky) + dsbd.dwFlags |= DSBCAPS_STICKYFOCUS; + dsbd.dwBufferBytes = pFileInfo->cbSize; + dsbd.lpwfxFormat = pFileInfo->pwfx; + if ((hr = gpds->lpVtbl->CreateSoundBuffer(gpds, + &dsbd, + &(pFileInfo->pDSB), + NULL )) != 0) + { + goto ERROR_IN_ROUTINE; + } + + // Ok, lock the sucker down, and copy the memory to it. + if ((hr = pFileInfo->pDSB->lpVtbl->Lock(pFileInfo->pDSB, + 0, + pFileInfo->cbSize, + &pbData, + &dwLength, + &pbData2, + &dwLength2, + 0L)) != 0) + { + goto ERROR_IN_ROUTINE; + } + + Assert(pbData != NULL); + memcpy(pbData, pFileInfo->pbData, pFileInfo->cbSize); + + // Ok, now unlock the buffer, we don't need it anymore. + if ((hr = pFileInfo->pDSB->lpVtbl->Unlock(pFileInfo->pDSB, + pbData, pFileInfo->cbSize, + NULL, 0)) != 0) + { + goto ERROR_IN_ROUTINE; + } + + pbData = NULL; + + if ((hr = pFileInfo->pDSB->lpVtbl->SetVolume(pFileInfo->pDSB, + MAXVOL_VAL)) != 0) + { + goto ERROR_IN_ROUTINE; + } + + if ((hr = pFileInfo->pDSB->lpVtbl->SetPan(pFileInfo->pDSB, + MIDPAN_VAL)) != 0) + { + goto ERROR_IN_ROUTINE; + } + + dsbc.dwSize = sizeof(dsbc); + if (hr = IDirectSoundBuffer_GetCaps(pFileInfo->pDSB, &dsbc)) + { + goto ERROR_IN_ROUTINE; + } + + if (dsbc.dwFlags & DSBCAPS_LOCHARDWARE) { + pFileInfo->fHardware = TRUE; + } else { + pFileInfo->fHardware = FALSE; + } + + goto DONE_ROUTINE; + +ERROR_IN_ROUTINE: + if (pbData != NULL) + { + hr = pFileInfo->pDSB->lpVtbl->Unlock(pFileInfo->pDSB, pbData, + pFileInfo->cbSize, NULL, 0); + pbData = NULL; + } + + if (pFileInfo->pDSB != NULL) + { + pFileInfo->pDSB->lpVtbl->Release(pFileInfo->pDSB); + pFileInfo->pDSB = NULL; + } + +DONE_ROUTINE: + + return(hr); + +} + +/* This routine will release a direct sound buffer, + freeing up memory, resources, + whatever. + + Input: + pFileInfo - Pointer to the file info, + with the proper stuff set. + + Output: + 0 if successful, else the error code. + +*/ +int ReleaseDirectSoundBuffer( FILEINFO *pFileInfo ) +{ + + if (pFileInfo->pDSB != NULL) + { + pFileInfo->pDSB->lpVtbl->Release(pFileInfo->pDSB); + pFileInfo->pDSB = NULL; + } + + return(0); + +} + +/* This routine will find the next x and y coordinates to + write the control to. + The rgfcoxAvail is an array of booleans. + If false, then the index can be + used as an x coordinate. + + Input: + pFileInfoHead - Header of the linked list. + pcox, pcoy - Filled upon return with next + coordinates to use. + + Output: + Only pcox and pcoy change. + +*/ + +void GetNextControlCoords( + FILEINFO *pFileInfoHead, + int *pcox, + int *pcoy + ) +{ + UINT cT; + + for (cT=0; cT<MAXCONTROLS; cT++) + { + if (rgfcoxAvail[cT] == FALSE) + { + rgfcoxAvail[cT] = TRUE; + break; + } + + } + + if (cT == MAXCONTROLS) + { + Assert(FALSE); + // Couldn't find a place to put control, shouldn't happen though. + cT = 666; // Well, at least put it off screen. + } + + *pcox = cT*DX_CONTROLSPACING+COX_STARTCONTROL; //Offsetting the text from the border + *pcoy = COY_STARTCONTROL; + + +} + +/* + CreateControl + + This will create the control used for the window, actually it is a + bundle of controls put together. I was thinking of a good way to + figure out id codes for the controls but found no good way except a + "funny" way...I'm going to use the x coordinate of the control as the + id for the first control, then id+1 for the second control. Since + all the controls have different x coordinates, this is fine, as long + as the # of windows in the control is not more than the spacing of + the controls. + + Input: + hWnd - Parent Window. + pFileInfo - Pointer to FileInfo structure with the cox and coy filled. + dwFreq, dwPan, dwVol- Default track bar values. + + Output: + 0 if successful, else the error code. + +*/ +int CreateControl( //This creates Child WAV Windows + HWND hWnd, + FILEINFO *pFileInfo, + DWORD dwFreq, + DWORD dwPan, + DWORD dwVol + ) + +{ + + int cox, + coy; + int coxOld, + coyOld; + int nError = 0; + DWORD idBase; + SIZE Size; + HDC hDC = NULL; +/* int cT; + RECT rc;*/ + + /* Figure out the values of dwPan and dwVol that the track bars like */ + + idBase = pFileInfo->cox; + Assert(pFileInfo != NULL); + cox = pFileInfo->cox+DX_TEXTSPACING; + coy = pFileInfo->coy+DY_TEXTSPACING; //We may have to shift this + + coxOld = cox; + coyOld = coy; + coy -= 8; //We must adjust to fit the text in the border + + if ((hDC = GetDC(hWnd)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + + if (!GetTextExtentPoint32(hDC, pFileInfo->szFileName+pFileInfo->nFileName, strlen(pFileInfo->szFileName+pFileInfo->nFileName), &Size)) + { + nError = -1; + goto DONE_ROUTINE; + } + + //Creates the Filename window + if ((pFileInfo->hWndFileName_TXT = CreateWindow( + "STATIC", + pFileInfo->szFileName+pFileInfo->nFileName, + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + cox, + coy, + DX_FILENAME_TXT, + Size.cy, + hWnd, + (HMENU)0, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + //Create line under Filename + cox += DX_LOOPEDSPACING; + coy += Size.cy + DY_TEXTSPACING + DY_LOOPEDSPACING; + + if ((pFileInfo->hWndFileName_EDGE = CreateWindow( + "STATIC", + "", + WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, + cox, + coy - (DY_LOOPEDSPACING+DY_TEXTSPACING)/2, + DX_LINEEDGE, + DY_LINEEDGE, + hWnd, + (HMENU)0, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + // Now create status if required. + + #ifdef SHOWSTATUS + + if (!GetTextExtentPoint32(hDC, szPlaying, strlen(szPlaying), &Size)) + { + nError = -1; + goto DONE_ROUTINE; + } + + + //Creates Status Window + if ((pFileInfo->hWndStatus_TXT = CreateWindow( + "STATIC", + "", + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + cox, + coy, + DX_STATUS_TXT, + Size.cy, // + DY_TEXTSPACING, + hWnd, + (HMENU)0, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + cox += DX_LOOPEDSPACING; + coy += Size.cy + DY_TEXTSPACING + DY_LOOPEDSPACING; + + //Create line under Status + if ((pFileInfo->hWndStatus_EDGE = CreateWindow( + "STATIC", + "", + WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, + cox, + coy - (DY_LOOPEDSPACING+DY_TEXTSPACING)/2, + DX_LINEEDGE, + DY_LINEEDGE, + hWnd, + (HMENU)0, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + //Creates PlayPos Window + if ((pFileInfo->hWndPlayPosition_TXT = CreateWindow( + "STATIC", "", + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + cox, + coy, + DX_STATUS_TXT, + Size.cy, + hWnd, + NULL, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + cox += DX_LOOPEDSPACING; + coy += Size.cy + DY_TEXTSPACING + DY_LOOPEDSPACING; //Create line under PlayPos + + if ((pFileInfo->hWndPlayPosition_EDGE = CreateWindow( + "STATIC", "", + WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, + cox, + coy - (DY_LOOPEDSPACING+DY_TEXTSPACING)/2, + DX_LINEEDGE, + DY_LINEEDGE, + hWnd, + NULL, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + //Creates WritePos Window + if ((pFileInfo->hWndWritePosition_TXT = CreateWindow( + "STATIC", "", + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + cox, + coy, + DX_STATUS_TXT, + Size.cy, + hWnd, + NULL, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + cox += DX_LOOPEDSPACING; + coy += Size.cy + DY_TEXTSPACING + DY_LOOPEDSPACING; + + //Create line under WritePos + if ((pFileInfo->hWndWritePosition_EDGE = CreateWindow( + "STATIC", "", + WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, + cox, + coy - (DY_LOOPEDSPACING+DY_TEXTSPACING)/2, + DX_LINEEDGE, + DY_LINEEDGE, + hWnd, + NULL, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + #endif + + //Set up the Freq Text + if (!GetTextExtentPoint32(hDC, szFreq, strlen(szFreq), &Size)) + { + nError = -1; + goto DONE_ROUTINE; + } + + // Make the frequency text there. + if ((pFileInfo->hWndFreq_TXT = CreateWindow( + "STATIC", + szFreq, + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + cox, + coy, + DX_FREQ_TXT, + Size.cy, + hWnd, + (HMENU)0, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + coy += Size.cy; + + // Make the frequency trackbar. + if ((pFileInfo->hWndFreq_TB = CreateWindow( + TRACKBAR_CLASS, + "", + WS_CHILD | WS_VISIBLE | TBS_HORZ | TBS_BOTH, + cox, + coy, + DX_FREQ_TB, + DY_FREQ_TB, + hWnd, + (HMENU)(idBase+idFreqTB), + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + SendMessage(pFileInfo->hWndFreq_TB, TBM_SETRANGEMIN, FALSE, MINFREQ_TB / FREQFACTOR ); + SendMessage(pFileInfo->hWndFreq_TB, TBM_SETRANGEMAX, FALSE, MAXFREQ_TB / FREQFACTOR ); + + SendMessage(pFileInfo->hWndFreq_TB, TBM_SETPAGESIZE, 0, FREQPAGE ); + SendMessage(pFileInfo->hWndFreq_TB, TBM_SETPOS, TRUE, (dwFreq + FREQADD)/FREQFACTOR); + pFileInfo->dwFreq = dwFreq; + + + coy += DY_FREQ_TB+DY_PANSPACING; + + if ((pFileInfo->hWndFreq_EDGE = CreateWindow( + "STATIC", + "", + WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, + cox, + coy - (DY_PANSPACING+DY_TEXTSPACING)/2, + DX_LINEEDGE, + DY_LINEEDGE, + hWnd, + (HMENU)0, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + //Adjusts the relative position of the Text + coy -= (((DY_PANSPACING+DY_TEXTSPACING)/2)-((DY_LOOPEDSPACING+DY_TEXTSPACING)/2)); + + if (!GetTextExtentPoint32(hDC, szPan, strlen(szPan), &Size)) + { + nError = -1; + goto DONE_ROUTINE; + } + + + // Make the pan text there. + if ((pFileInfo->hWndPan_TXT = CreateWindow( + "STATIC", + szPan, + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + cox, + coy, + DX_PAN_TXT, + Size.cy, + hWnd, + (HMENU)0, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + coy += Size.cy; + + // Make the pan trackbar. + if ((pFileInfo->hWndPan_TB = CreateWindow( + TRACKBAR_CLASS, + "", + WS_CHILD | WS_VISIBLE | TBS_HORZ | TBS_BOTH, + cox, + coy, + DX_PAN_TB, + DY_PAN_TB, + hWnd, + (HMENU)(idBase+idPanTB), + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + SendMessage(pFileInfo->hWndPan_TB, TBM_SETRANGE, FALSE, MAKELONG(MINPAN_TB, MAXPAN_TB)); + SendMessage(pFileInfo->hWndPan_TB, TBM_SETPOS, TRUE, dwPan); + SendMessage(pFileInfo->hWndPan_TB, TBM_SETPAGESIZE, 0, PANPAGE ); + pFileInfo->dwPan = dwPan; + + + coy += DY_PAN_TB + DY_VOLSPACING; + + if ((pFileInfo->hWndPan_EDGE = CreateWindow( + "STATIC", + "", + WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, + cox, + coy - (DY_VOLSPACING+DY_TEXTSPACING)/2, + DX_LINEEDGE, + DY_LINEEDGE, + hWnd, + (HMENU)0, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + //Adjusts the relative position of the Text + coy -= (((DY_PANSPACING+DY_TEXTSPACING)/2)-((DY_LOOPEDSPACING+DY_TEXTSPACING)/2)); + + if (!GetTextExtentPoint32(hDC, szVolume, strlen(szVolume), &Size)) + { + nError = -1; + goto DONE_ROUTINE; + } + + // Make the volume text there. + if ((pFileInfo->hWndVol_TXT = CreateWindow( + "STATIC", + szVolume, + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + cox, + coy, + DX_VOL_TXT, + Size.cy, + hWnd, + (HMENU)idBase, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + coy += Size.cy; + + // Make the volume trackbars. + // Create main volume bar. + if ((pFileInfo->hWndVolM_TB = CreateWindow( + TRACKBAR_CLASS, + "", + WS_CHILD | WS_VISIBLE | TBS_VERT | TBS_BOTH, + cox, + coy, + DX_VOL_TB, + DY_VOL_TB, + hWnd, + (HMENU)(idBase+idVolMTB), + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + SendMessage(pFileInfo->hWndVolM_TB, TBM_SETRANGE, FALSE, MAKELONG(MINVOL_TB, MAXVOL_TB)); + SendMessage(pFileInfo->hWndVolM_TB, TBM_SETPOS, TRUE, dwVol); + pFileInfo->dwVol = MAXVOL_TB - dwVol; + + + + // Now the left volume. + if ((pFileInfo->hWndVolL_TB = CreateWindow( + TRACKBAR_CLASS, + "", + WS_CHILD | WS_VISIBLE |WS_DISABLED| TBS_VERT | TBS_BOTH, + cox+DX_VOL_TB+DX_VOLSPACING_TB, + coy, + DX_VOL_TB, + DY_VOL_TB, + hWnd, + (HMENU)(idBase+idVolLTB), + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + SendMessage(pFileInfo->hWndVolL_TB, TBM_SETRANGE, FALSE, MAKELONG(MINVOL_TB, MAXVOL_TB)); + SendMessage(pFileInfo->hWndVolL_TB, TBM_SETPOS, TRUE, MAXVOL_TB); + + if ((pFileInfo->hWndVolL_TXT = CreateWindow( + "STATIC", + "L", + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + cox+DX_VOL_TB*3/2+DX_VOLSPACING_TB/2, + coy+DY_VOL_TB+DY_VOLSPACINGY, + DX_VOLUMECHAR, + Size.cy, + hWnd, + (HMENU)0, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + + // And right volume. + if ((pFileInfo->hWndVolR_TB = CreateWindow( + TRACKBAR_CLASS, + "", + WS_CHILD | WS_VISIBLE | WS_DISABLED | TBS_VERT | TBS_BOTH, + cox+DX_VOL_TB*2+DX_VOLSPACING_TB*2, + coy, + DX_VOL_TB, + DY_VOL_TB, + hWnd, + (HMENU)(idBase+idVolRTB), + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + SendMessage(pFileInfo->hWndVolR_TB, + TBM_SETRANGE, FALSE, MAKELONG(MINVOL_TB, MAXVOL_TB)); + SendMessage(pFileInfo->hWndVolR_TB, + TBM_SETPOS, TRUE, MAXVOL_TB); + + if ((pFileInfo->hWndVolR_TXT = CreateWindow( + "STATIC", + "R", + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + cox+DX_VOL_TB*5/2+DX_VOLSPACING_TB/2+2, + // +2 to look nice. + coy+DY_VOL_TB+DY_VOLSPACINGY, + DX_VOLUMECHAR, + Size.cy, + hWnd, + (HMENU)0, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + + coy += DY_VOL_TB + DY_BEFOREFIRSTBUTTON; //Line under L & R + + if ((pFileInfo->hWndVol_EDGE = CreateWindow( + "STATIC", + "", + WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, + cox, + coy - (DY_BEFOREFIRSTBUTTON)/2, + DX_LINEEDGE, + DY_LINEEDGE, + hWnd, + (HMENU)0, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + + + if (!GetTextExtentPoint32(hDC, szPlay, strlen(szPlay), &Size)) + { + nError = -1; + goto DONE_ROUTINE; + } + + + //Create Play Button + if ((pFileInfo->hWndPlay_BN = CreateWindow( + "BUTTON", + szPlay, + WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, + cox, + coy, + DX_BUTTONSPACING, + Size.cy + DY_BUTTONSPACING, + hWnd, + (HMENU)(idBase+idPlayBN), + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + //coy += Size.cy + DY_BUTTONSPACING + DY_BETWEENBUTTONS; + + if (!GetTextExtentPoint32(hDC, szPlay, strlen(szPlay), &Size)) + { + nError = -1; + goto DONE_ROUTINE; + } + + //Make Remove button + if ((pFileInfo->hWndRemove_BN = CreateWindow( + "BUTTON", + szRemove, + WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, + cox + DX_BUTTONSPACING + DY_BETWEENBUTTONS, + coy, + DX_BUTTONSPACING, + Size.cy + DY_BUTTONSPACING, + hWnd, + (HMENU)(idBase+idRemoveBN), + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + coy += Size.cy + DY_BUTTONSPACING+ DY_BETWEENBUTTONS; + + + //Set up Looped Checkbox + if (!GetTextExtentPoint32(hDC, szLooped, strlen(szLooped), &Size)) + { + nError = -1; + goto DONE_ROUTINE; + } + + //Create Looped Checkbox window + if ((pFileInfo->hWndLooped_BN = CreateWindow( + "BUTTON", + szLooped, + WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, + cox, + coy, + DX_LOOPED_TXT, + Size.cy + DY_TEXTSPACING -2, + hWnd, + (HMENU)(idBase+idLoopedBN), + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + + // Don't need the between buttons spacing + // because there are no more controls. + coy += Size.cy;// + DY_BUTTONSPACING; //+ DY_BETWEENBUTTONS; + + if ((pFileInfo->hWndWhole_EDGE = CreateWindow( + "STATIC", + "", + WS_CHILD | WS_VISIBLE | SS_ETCHEDFRAME, + coxOld-DX_FRAMEEDGE, + coyOld-DY_FRAMEEDGE, + DX_CONTROLSPACING-DX_FRAMEEDGEINNER, + coy - coyOld + DY_FRAMEEDGE*2, + hWnd, + (HMENU)0, + hInst, + NULL)) == NULL) + { + nError = -1; + goto DONE_ROUTINE; + } + + + SetAllText(pFileInfo); + UpdateLRVolume(pFileInfo); + + +DONE_ROUTINE: + if (hDC != NULL) + { + if (ReleaseDC(hWnd, hDC) == 0) + { + nError = -1; + goto DONE_ROUTINE; + } + } + + return(nError); + +} + +/* This will add to the linked list of FileInfo's. + The FileInfo's keep track of the + files loaded, and this is done in a linked list format + + Input: + pFileInfoHead - Top of linked list. + pFileInfo - Pointer to entry to add. + + Output: + 0 if successful, else the error code. + +*/ + +int AddToList( + FILEINFO *pFileInfoHead, + FILEINFO *pFileInfo + ) +{ + + pFileInfo->pNext = NULL; + pFileInfo->fPlaying = FALSE; + + while (pFileInfoHead->pNext != NULL) + { + pFileInfoHead = pFileInfoHead->pNext; + } + + pFileInfoHead->pNext = pFileInfo; + + return(0); + +} + +/* This routine will get the number of controls in the window. + Can be used to determine new size of window. + + Input: + pFileInfoHead - Header of linked list. + + Output: + # of controls. + +*/ + +int GetNumControls( FILEINFO *pFileInfoHead ) +{ + + int cT = 0; + + while (pFileInfoHead->pNext != NULL) + { + pFileInfoHead = pFileInfoHead->pNext; + cT++; + } + + return(cT); + +} + +/* This routine will free the whole linked list in pFileInfoFirst, + including all the + memory used by the wave file, waveformatex structure, etc. + +*/ +int FreeAllList( + HWND hWnd, + FILEINFO *pFileInfoFirst + ) +{ + + FILEINFO *pFileInfo, *pFileNext; + UINT cT; + + Assert(pFileInfoFirst != NULL); + pFileInfo = pFileInfoFirst->pNext; + + while (pFileInfo != NULL) + { + ReleaseDirectSoundBuffer(pFileInfo); + GlobalFreePtr(pFileInfo->pwfx); + GlobalFreePtr(pFileInfo->pbData); + pFileNext = pFileInfo->pNext; + GlobalFreePtr(pFileInfo); + pFileInfo = pFileNext; + } + + for (cT=0; cT<MAXCONTROLS; cT++) + rgfcoxAvail[cT] = FALSE; + + + + return(0); + + +} + +/* This routine will remove an entry from the list, i.e. will remove + pFileInfo and all its allocated memory from the list pointed by the header + by pFileInfoHead + + Input: + pFileInfo - Pointer to entry to remove. + pFileInfoHead - Head, first entry. + + Output: + 0 if successful, else the error. + +*/ +int RemoveFromList( + FILEINFO *pFileInfo, + FILEINFO *pFileInfoHead + ) +{ + + FILEINFO *pFileNext; + + Assert(pFileInfoHead != NULL); + + // This used to be pFileInfoHead != NULL + while (pFileInfoHead->pNext != NULL) + { + if (pFileInfoHead->pNext == pFileInfo) + { + Assert(pFileInfo->cox/DX_CONTROLSPACING < MAXCONTROLS); + rgfcoxAvail[pFileInfo->cox/DX_CONTROLSPACING] = FALSE; + + DestroyWindow(pFileInfo->hWndFileName_TXT); + DestroyWindow(pFileInfo->hWndFreq_TB); + DestroyWindow(pFileInfo->hWndFreq_TXT); + DestroyWindow(pFileInfo->hWndPan_TB); + DestroyWindow(pFileInfo->hWndPan_TXT); + DestroyWindow(pFileInfo->hWndVol_TXT); + DestroyWindow(pFileInfo->hWndVolL_TB); + DestroyWindow(pFileInfo->hWndVolR_TB); + DestroyWindow(pFileInfo->hWndVolM_TB); + DestroyWindow(pFileInfo->hWndLooped_BN); + DestroyWindow(pFileInfo->hWndPlay_BN); + DestroyWindow(pFileInfo->hWndRemove_BN); + DestroyWindow(pFileInfo->hWndFileName_EDGE); + DestroyWindow(pFileInfo->hWndLooped_EDGE); + DestroyWindow(pFileInfo->hWndFreq_EDGE); + DestroyWindow(pFileInfo->hWndPan_EDGE); + DestroyWindow(pFileInfo->hWndVol_EDGE); + DestroyWindow(pFileInfo->hWndWhole_EDGE); + DestroyWindow(pFileInfo->hWndVolL_TXT); + DestroyWindow(pFileInfo->hWndVolR_TXT); + #ifdef SHOWSTATUS + DestroyWindow(pFileInfo->hWndStatus_TXT); + DestroyWindow(pFileInfo->hWndStatus_EDGE); + DestroyWindow(pFileInfo->hWndPlayPosition_TXT); + DestroyWindow(pFileInfo->hWndPlayPosition_EDGE); + DestroyWindow(pFileInfo->hWndWritePosition_TXT); + DestroyWindow(pFileInfo->hWndWritePosition_EDGE); + #endif + + + + + GlobalFree(pFileInfoHead->pNext->pwfx); + GlobalFree(pFileInfoHead->pNext->pbData); + pFileNext = pFileInfoHead->pNext->pNext; + GlobalFreePtr(pFileInfoHead->pNext); + pFileInfoHead->pNext = pFileNext; + break; + } + pFileInfoHead = pFileInfoHead->pNext; + } + + return(0); +} + +/* This will pop up the open file dialog and allow the user to pick one file. + + Input: + hWnd - Handle of parent window. + pszFileName - String to store filename in, must be at least MAX_PATH long. + + + Output: + TRUE if a file was picked successfully, else FALSE (user didn't pick a file) + + */ +BOOL OpenFileDialog( + HWND hWnd, + LPSTR pszFileName, + int *nFileName, + LPBOOL lpfSticky + ) +{ + + BOOL fReturn, + fValid; + OPENFILENAME ofn; + + pszFileName[0] = 0; + + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = hWnd; + ofn.hInstance = hInst; + ofn.lpstrFilter = "Wave Files\0*.wav\0All Files\0*.*\0\0"; + ofn.lpstrCustomFilter = NULL; + ofn.nMaxCustFilter = 0; + ofn.nFilterIndex = 1; + ofn.lpstrFile = pszFileName; + ofn.nMaxFile = MAX_PATH; + ofn.lpstrFileTitle = NULL; + ofn.nMaxFileTitle = 0; + ofn.lpstrInitialDir = gszCDStartPath; + ofn.lpstrTitle = "File Open"; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_EXPLORER + | OFN_ENABLETEMPLATE | OFN_ENABLEHOOK | OFN_HIDEREADONLY; + ofn.nFileOffset = 0; + ofn.nFileExtension = 0; + ofn.lpstrDefExt = "wav"; + ofn.lCustData = (LONG)lpfSticky; + ofn.lpfnHook = FileOpenCustomTemplateDlgProc; + ofn.lpTemplateName = MAKEINTRESOURCE(IDD_FILEOPEN_NEST); + + fValid = FALSE; + do { + + if (fReturn = GetOpenFileName(&ofn)) + { + // Set the start path for the next time this dialog is opened + lstrcpy( gszCDStartPath, pszFileName ); + gszCDStartPath[ofn.nFileOffset] = '\0'; + + fValid = IsValidWave(pszFileName); + if (!fValid) + { + MessageBox(hWnd, "Wave files must be PCM format!", + "Invalid Wave File", MB_OK|MB_ICONSTOP); + } + else + *nFileName = ofn.nFileOffset; + } + else fValid = TRUE; // Force break out of loop. + + } while (!fValid); + + return(fReturn); + +} + +/* This function will determine if the filename passed + in is a valid wave for this + app, that is a PCM wave. + + Input: + pszFileName - FileName to check. + + Output: + FALSE if not a valid wave, TRUE if it is. + +*/ +BOOL IsValidWave( + LPSTR pszFileName + ) + +{ + BOOL fReturn = FALSE; + int nError = 0; + HMMIO hmmio; + MMCKINFO mmck; + WAVEFORMATEX *pwfx; + + if ((nError = WaveOpenFile(pszFileName, &hmmio, &pwfx, &mmck)) != 0) + { + goto ERROR_IN_ROUTINE; + } + + if (pwfx->wFormatTag != WAVE_FORMAT_PCM) + { + goto ERROR_IN_ROUTINE; + } + + WaveCloseReadFile(&hmmio, &pwfx); + + fReturn = TRUE; + +ERROR_IN_ROUTINE: + return(fReturn); + +} + +BOOL UIMainWindowVSBHandler( + HWND hWnd, + WPARAM wParam, + LPARAM lParam + ) +{ + + FILEINFO *pFileInfo; + BOOL fReturn = FALSE; + + pFileInfo = FileInfoFirst.pNext; + + Assert(pFileInfo != NULL); + + while (pFileInfo != NULL) + { + + if ((HWND)lParam == pFileInfo->hWndVolM_TB) + { + pFileInfo->dwVol = MAXVOL_TB - + SendMessage(pFileInfo->hWndVolM_TB, TBM_GETPOS, 0, 0); + ChangeOutputVol(pFileInfo); + SetAllText(pFileInfo); + UpdateLRVolume(pFileInfo); + fReturn = TRUE; + } + + pFileInfo = pFileInfo->pNext; + + } + + return (fReturn); + +} + + +/* This routine will handle all the calls to the WM_HSCROLL + for the main window, that + is, all the horizontal scrollbar (and trackbar) messages. + + Input: + Standard parameters (minus the "message" parameter) + for a window callback, though + this is called from the window callback. + + Output: + FALSE if the message isn't processed, else TRUE if it is. + If FALSE, the + return procedure should call the default windows procedure. + + +*/ +BOOL UIMainWindowHSBHandler( + HWND hWnd, + WPARAM wParam, + LPARAM lParam + ) +{ + + FILEINFO *pFileInfo; + BOOL fReturn = FALSE; + + pFileInfo = FileInfoFirst.pNext; + + Assert(pFileInfo != NULL); + + while (pFileInfo != NULL) + { + + if ((HWND)lParam == pFileInfo->hWndFreq_TB) + { + pFileInfo->dwFreq = (SendMessage(pFileInfo->hWndFreq_TB, + TBM_GETPOS, 0, 0) * FREQFACTOR) - FREQADD; + ChangeOutputFreq(pFileInfo); + SetAllText(pFileInfo); + fReturn = TRUE; + } + + else if ((HWND)lParam == pFileInfo->hWndPan_TB) + { + pFileInfo->dwPan = SendMessage(pFileInfo->hWndPan_TB, + TBM_GETPOS, 0, 0); + ChangeOutputPan(pFileInfo); + SetAllText(pFileInfo); + UpdateLRVolume(pFileInfo); + fReturn = TRUE; + } + + pFileInfo = pFileInfo->pNext; + + } + + return (fReturn); + + + +} + +/* This routine will handle all the calls to the WM_COMMAND + for the main window. + + Input: + Standard parameters (minus the "message" parameter) + for a window callback, though + this is called from the window callback. + + Output: + FALSE if the message isn't processed, else TRUE if it is. + If FALSE, the + return procedure should call the default windows procedure. + + +*/ +BOOL UIMainWindowCMDHandler( + HWND hWnd, + WPARAM wParam, + LPARAM lParam + ) +{ + + BOOL fReturn = FALSE; + FILEINFO *pFileInfo; + FILEINFO *pFileInfoNext; + DWORD dwLooping; + + pFileInfo = FileInfoFirst.pNext; + while (pFileInfo != NULL) + { + + pFileInfoNext = pFileInfo->pNext; + + if ((HWND)lParam == pFileInfo->hWndLooped_BN) + { + pFileInfo->fLooped = SendMessage(pFileInfo->hWndLooped_BN, + BM_GETCHECK, 0, 0); + // If it is playing then reset the looping to be proper + if( pFileInfo->fPlaying ) { + if( pFileInfo->fLooped ) { + dwLooping = DSBPLAY_LOOPING; + } else { + dwLooping = 0; + } + pFileInfo->pDSB->lpVtbl->Play(pFileInfo->pDSB, + 0, 0, dwLooping ); + } + fReturn = TRUE; + } + else if ((HWND)lParam == pFileInfo->hWndPlay_BN) + { + if (pFileInfo->fPlaying) + { + if (StopDSound(hWnd, pFileInfo) == 0) + { + SendMessage((HWND)lParam, + WM_SETTEXT, 0, (LPARAM)(LPCTSTR)szPlay); + +#ifdef SHOWSTATUS + UpdateStatus(pFileInfo, 0); +#endif + + fReturn = TRUE; + break; + } + + } + else + { + if (StartDSound(hWnd, pFileInfo) == 0) + { + SendMessage((HWND)lParam, + WM_SETTEXT, 0, (LPARAM)(LPCTSTR)szStop); +#ifdef SHOWSTATUS + UpdateStatus(pFileInfo, DSBSTATUS_PLAYING); +#endif + + fReturn = TRUE; + break; + } + + } + fReturn = TRUE; + } + + else if ((HWND)lParam == pFileInfo->hWndRemove_BN) + { + ReleaseDirectSoundBuffer(pFileInfo); + RemoveFromList(pFileInfo, &FileInfoFirst); + UpdateMainStatus(); + + fReturn = TRUE; + } + + + pFileInfo = pFileInfoNext; + + } + + if (!fReturn) + { + + switch(wParam) + { + + case IDPD_FILE_EXIT: + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; + + case IDPD_FILE_OPEN: + PD_FileOpen(hWnd); + break; + + case IDPD_HELP_ABOUT: + DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), + hWnd, (DLGPROC)DLGHelpAbout); + break; + + case IDPD_OPTIONS_OUTPUTTYPE: + DialogBox(hInst, MAKEINTRESOURCE(IDD_OUTPUTBUFFERTYPE), + hWnd, (DLGPROC)DLGOutputBufferType); + break; + + case IDPD_CHECKLATENCY: + StopAllDSounds(hWnd, &FileInfoFirst); + // Now fake that we're on in each voice so the + //timer will update the + // strings in the window. + pFileInfo = FileInfoFirst.pNext; + while (pFileInfo != NULL) + { + pFileInfo->fPlaying = TRUE; + pFileInfo = pFileInfo->pNext; + } + + DialogBox(hInst, MAKEINTRESOURCE(IDD_CHECKLATENCY), + hWnd, (DLGPROC)DLGCheckLatency); + break; + + case IDPD_ENUMDRIVERS: + fEnumDrivers = !fEnumDrivers; + if( fEnumDrivers ) + { + MessageBox( hWnd, + "Drivers will not be enumerated until DSSHOW is run again.", + szAppName, MB_OK ); + } + break; + + default: + return(FALSE); + + } + } + + return(TRUE); + + +} + +/* This routine will handle the timer messages. + + Input: + Standard input. + + Output: + TRUE if processed message, otherwise FALSE + +*/ +BOOL UIMainWindowTimerHandler( + HWND hWnd, + WPARAM wParam, + LPARAM lParam + ) +{ + + FILEINFO *pFileInfo; + BOOL fReturn = FALSE; + DWORD dwStatus = 0; + + for (pFileInfo = FileInfoFirst.pNext; pFileInfo != NULL; pFileInfo = pFileInfo->pNext) + { + HRESULT hr; + + hr = IDirectSoundBuffer_GetStatus(pFileInfo->pDSB, &dwStatus); + if (DS_OK != hr) continue; + + if (dwStatus & DSBSTATUS_BUFFERLOST) { + LPBYTE pbData, pbData2; + DWORD dwLength, dwLength2; + + // + // Restore the buffer, rewrite data, and play + // + hr = IDirectSoundBuffer_Restore(pFileInfo->pDSB); + if (DS_OK == hr) { + + hr = IDirectSoundBuffer_Lock(pFileInfo->pDSB, 0, + pFileInfo->cbSize, + &pbData, &dwLength, + &pbData2, &dwLength2, + 0); + + if (DS_OK == hr) { + + Assert(pbData != NULL); + Assert(pFileInfo->pbData != NULL); + memcpy(pbData, pFileInfo->pbData, pFileInfo->cbSize); + + hr = IDirectSoundBuffer_Unlock(pFileInfo->pDSB, + pbData, dwLength, + NULL, 0); + + if (DS_OK == hr) { + + if (pFileInfo->fPlaying) { + if (pFileInfo->fLooped) { + IDirectSoundBuffer_Play( pFileInfo->pDSB, 0, 0, + DSBPLAY_LOOPING ); + } else { + IDirectSoundBuffer_Play( pFileInfo->pDSB, 0, 0, + 0 ); + } + } + + IDirectSoundBuffer_GetStatus(pFileInfo->pDSB, &dwStatus); + + } + } + } + } + +#ifdef SHOWSTATUS + UpdateStatus(pFileInfo, dwStatus); +#endif + + if (!(dwStatus & DSBSTATUS_BUFFERLOST)) + { + if ((pFileInfo->fPlaying) && (!(dwStatus & DSBSTATUS_PLAYING)) ) + { + if (StopDSound(hWnd, pFileInfo) == 0) + { + SendMessage(pFileInfo->hWndPlay_BN, + WM_SETTEXT, 0, (LPARAM)(LPCTSTR)szPlay); + } + } + } + + pFileInfo->fLost = dwStatus & DSBSTATUS_BUFFERLOST; + + fReturn = TRUE; + } + + return (fReturn); + +} + + + +/* This routine will start a sound to be played. + + Input: + hWnd - Of parent window. + pFileInfo - Pointer to file to start, + which is loaded and the + data is filled in the structure, + such as pbData, + etc. + + Output: + 0 if successful, else the error code. + +*/ +int StartDSound( + HWND hWnd, + FILEINFO *pFileInfo + ) +{ + + HRESULT hr = 0; + DWORD dwLooped; + DWORD dwStatus = 0; + + // Already playing? + + // Start sound here.... + dwLooped = 0; + if (pFileInfo->fLooped) { + dwLooped = DSBPLAY_LOOPING; + } + + + if ((hr = pFileInfo->pDSB->lpVtbl->GetStatus(pFileInfo->pDSB, + &dwStatus)) == 0) + { + if ((dwStatus&DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING) + { + // Don't bother playing, just restart + if ((hr = pFileInfo->pDSB->lpVtbl->SetCurrentPosition( + pFileInfo->pDSB, 0)) != 0) + { + MessageBox(hWnd, "Cannot set current position", + "Direct Sound Error", MB_OK); + } + } + // Yes gotos are bad but this is real life not school. + else goto PLAY_THE_THING; + } + + else + { +PLAY_THE_THING: + if ((hr = pFileInfo->pDSB->lpVtbl->Play(pFileInfo->pDSB, + 0, 0, dwLooped)) != 0) + { + MessageBox(hWnd, "Cannot start playing", + "Direct Sound Error", MB_OK); + } + else + pFileInfo->fPlaying = TRUE; + } + + return(hr); + + +} + +/* This routine will stop a sound which is playing. + + Input: + hWnd - Of parent window. + pFileInfo - Pointer to file to stop playing. + + Output: + 0 if successful, else the error code. + +*/ +int StopDSound( HWND hWnd, + FILEINFO *pFileInfo + ) + +{ + HRESULT hr = 0; + + if (!pFileInfo->fPlaying) + return(0); + + + // Stop sound here... + if ((hr = pFileInfo->pDSB->lpVtbl->Stop(pFileInfo->pDSB)) != 0) + { + MessageBox(hWnd, "Cannot stop sound", + "Direct Sound Error", MB_OK); + } + else + pFileInfo->fPlaying = FALSE; + + return(hr); + +} + +/* This routine will stop all the sounds which are playing. + + Input: + hWnd - Of parent window. + pFileInfo - Pointer to file to stop playing. + (i.e. the head) + + Output: + 0 if successful, else the error code. + +*/ +int StopAllDSounds( + HWND hWnd, + FILEINFO *pFileInfo + ) + +{ + + while (pFileInfo->pNext != NULL) + { + StopDSound(hWnd, pFileInfo->pNext); + pFileInfo = pFileInfo->pNext; + } + + return(0); + +} + + + +/* This routine will set the freq, vol and pan slider text + according to the value + passed in. + + Input: + pFileInfo - File pointer to set frequency for. + + The dwFreq in the pFileInfo structure must be set. + This also uses the window handle + in the pFileInfo structure. + + Output: + None. + +*/ +void SetAllText( + FILEINFO *pFileInfo + ) +{ + char szBufT[128]; + + sprintf(szBufT, "%s: %lu Hz ", + szFreq, pFileInfo->dwFreq); + SetWindowText(pFileInfo->hWndFreq_TXT, szBufT); + + // Change PAN val to show full range + sprintf(szBufT, "%s: %ld", szPan, + (((LONG)(pFileInfo->dwPan) + SHIFTPAN_TB) * MULTPAN_TB ) ); + SetWindowText(pFileInfo->hWndPan_TXT, szBufT); + + // Change VOLUME val to show full range + sprintf(szBufT, "%s: %ld", szVolume, + (((LONG)(pFileInfo->dwVol) + SHIFTVOL_TB) * MULTVOL_TB )); + SetWindowText(pFileInfo->hWndVol_TXT, szBufT); + + +} + +/* This routine will update the left and right + volume according to main volume + and pan. + + Input: + pFileInfo - Pointer to fileinfo to update. + + Output: + Nothing worth using. + + +*/ +void UpdateLRVolume( + FILEINFO *pFileInfo + ) +{ + + int volLeft, volRight; + + if (pFileInfo->dwPan < MIDPAN_TB) + { + volLeft = pFileInfo->dwVol; + volRight = (((int)pFileInfo->dwPan) + *(int)pFileInfo->dwVol)/((int)MIDPAN_TB); + } + else + { + volLeft = ((((int)pFileInfo->dwPan - MAXPAN_TB)*-1) + *(int)pFileInfo->dwVol)/((int)MIDPAN_TB); + volRight = pFileInfo->dwVol; + } + + + + SendMessage(pFileInfo->hWndVolL_TB, TBM_SETPOS, TRUE, MAXVOL_TB-volLeft); + SendMessage(pFileInfo->hWndVolR_TB, TBM_SETPOS, TRUE, MAXVOL_TB-volRight); + + + +} + +/* This will change the output panning position for a certain FILEINFO. + This is + done by sending messages to the direct sound driver + + Input: + pFileInfo - FileInfo to set. This must contain the + panning value to set. + + Output: + 0 if successful, else the error code. + +*/ +int ChangeOutputPan( + FILEINFO *pFileInfo + ) + +{ + + HRESULT hr = 0; + + + // Change PAN val since TB does not go full range + if ((hr = pFileInfo->pDSB->lpVtbl->SetPan(pFileInfo->pDSB, + (((pFileInfo->dwPan) + SHIFTPAN_TB) * MULTPAN_TB) )) != 0) + { + goto ERROR_DONE_ROUTINE; + } + +ERROR_DONE_ROUTINE: + return(hr); + +} + +/* This will change the output freq for a certain FILEINFO. This is + done by sending messages to the direct sound driver + + Input: + pFileInfo - FileInfo to set. This must contain the + freq value to set. + + Output: + 0 if successful, else the error code. + +*/ +int ChangeOutputFreq( + FILEINFO *pFileInfo + ) + +{ + + HRESULT hr = 0; + + + if ((hr = pFileInfo->pDSB->lpVtbl->SetFrequency(pFileInfo->pDSB, pFileInfo->dwFreq)) != 0) + { + goto ERROR_DONE_ROUTINE; + } + +ERROR_DONE_ROUTINE: + return(hr); + +} + + + +/* This will change the output vol for a certain FILEINFO. This is + done by sending messages to the direct sound driver + + Input: + pFileInfo - FileInfo to set. This must contain the + freq value to set. + + Output: + 0 if successful, else the error code. + +*/ +int ChangeOutputVol( + FILEINFO *pFileInfo + ) + +{ + + HRESULT hr = 0; + + + // Shift VOLUME val by 4 bits since TB does not go full range + if ((hr = pFileInfo->pDSB->lpVtbl->SetVolume(pFileInfo->pDSB, + (((pFileInfo->dwVol) + SHIFTVOL_TB) * MULTVOL_TB) )) != 0) + { + goto ERROR_DONE_ROUTINE; + } + +ERROR_DONE_ROUTINE: + return(hr); + +} + + +/* This is the dialog box handler for the check latency dialog box. + + Input: + Standard dialog box input. + + Output: + Standard dialog box output. + +*/ + +long FAR PASCAL DLGCheckLatency( + HWND hWnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam + ) +{ + + static HWND hWndFiles_LB; + FILEINFO *pFileInfo = NULL; + int nSelected; + int cT; + + + switch(uMsg) + { + case WM_INITDIALOG: + hWndFiles_LB = GetDlgItem(hWnd, IDC_FILES_LB); + + pFileInfo = FileInfoFirst.pNext; + while (pFileInfo != NULL) + { + SendMessage(hWndFiles_LB, + LB_ADDSTRING, + 0, + (LPARAM)(pFileInfo->szFileName + + pFileInfo->nFileName)); + pFileInfo = pFileInfo->pNext; + } + + break; + + case WM_COMMAND: + switch(wParam) + { + case ID_DONE: + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; + + case ID_PLAY: + if ((nSelected = SendMessage(hWndFiles_LB, + LB_GETCURSEL, 0, 0)) + != LB_ERR) + { + for (cT=0, pFileInfo = FileInfoFirst.pNext; + pFileInfo != NULL; + pFileInfo = pFileInfo->pNext, cT++) + { + if (cT == nSelected) + { + StartDSound(hWnd, pFileInfo); + break; + } + } + + } + + break; + + case ID_STOP: + StopAllDSounds(hWnd, &FileInfoFirst); + break; + + default: + break; + + } + break; + + case WM_CLOSE: + StopAllDSounds(hWnd, &FileInfoFirst); + EndDialog(hWnd, 0); + break; + + default: + return(0); + break; + + } + + return(1); + +} + + +/* The help about dialog procedure. + + Input: + Standard windows dialog procedure. + + Output: + Standard windows dialog procedure. + +*/ +long FAR PASCAL DLGHelpAbout( + HWND hWnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam + ) +{ + switch(uMsg) + { + case WM_INITDIALOG: + break; + + case WM_COMMAND: + switch(wParam) + { + case ID_OK: + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; + + default: + break; + + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + + default: + return(0); + break; + + } + + return(1); + +} + + +/* The help about dialog procedure. + + Input: + Standard windows dialog procedure. + + Output: + Standard windows dialog procedure. + +*/ + +long FAR PASCAL DLGOutputBufferType( + HWND hWnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam + ) +{ + + static HWND hWndFormats_LB = NULL; + int cT; + int nSelection; + + + switch(uMsg) + { + case WM_INITDIALOG: + // Get the windows we need. + hWndFormats_LB = GetDlgItem(hWnd, IDC_FORMATS); + + // Put the strings in the list box. + for (cT=0; cT<C_DROPDOWNPCMFORMATS; cT++) + SendMessage(hWndFormats_LB, + LB_ADDSTRING, 0, (LPARAM)rgszTypes[cT]); + + // Get the current format and highlight it in the list box. + if ((nSelection = FormatToIndex(hWnd, &FileInfoFirst)) != LB_ERR) + { + SendMessage(hWndFormats_LB, LB_SETCURSEL, nSelection, 0); + } + + + break; + + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case IDC_FORMATS: + if( HIWORD( wParam ) == LBN_DBLCLK ) + { + SendMessage( hWnd, WM_COMMAND, MAKEWPARAM( ID_OK, 0 ), + 0L ); + } + break; + + case ID_OK: + if ((nSelection = SendMessage(hWndFormats_LB, + LB_GETCURSEL, 0, 0)) != LB_ERR) + { + if (IndexToFormat(hWnd, &FileInfoFirst, nSelection) + == 0) + PostMessage(hWnd, WM_CLOSE, 0, 0); + } + break; + + case ID_CANCEL: + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; + + case ID_APPLY: + if ((nSelection = SendMessage(hWndFormats_LB, + LB_GETCURSEL, 0, 0)) != LB_ERR) + IndexToFormat(hWnd, &FileInfoFirst, nSelection); + + break; + + + default: + break; + + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + + default: + return(0); + break; + + } + + return(1); + +} + +/* This routine will determine the output format in + terms of an integer from the + current output rate, type, etc. + stored in the direct sound routines. Integer + values designate the string # in rgszTypes, + i.e. index 0 is 8000kHz, 8 bit mono, + etc... + + Input: + hWnd - Handle of the current window. + pFileInfo - Pointer to the file info to retrieve the format for. + + Output: + The index of the format, LB_ERR if undetermined. + +*/ +int FormatToIndex( + HWND hWnd, + FILEINFO *pFileInfo + ) + +{ + + WAVEFORMATEX wfx; + DWORD dwWaveStyle; + DWORD dwSize; + int nError = 0; + + // Get the format. + if ((nError = pFileInfo->pDSB->lpVtbl->GetFormat(pFileInfo->pDSB, + &wfx, sizeof(wfx), &dwSize)) != 0) + { + goto ERROR_IN_ROUTINE; + } + if( dwSize > sizeof( wfx ) ) { + nError = DSERR_GENERIC; + goto ERROR_IN_ROUTINE; + } + + + // Change wfx to an integer. + // Assume theres an error and check all parameters to + // see if its valid. + nError = LB_ERR; + dwWaveStyle = 0; + + if (wfx.wFormatTag != WAVE_FORMAT_PCM) + goto ERROR_IN_ROUTINE; + + // Check the channels + if (wfx.nChannels == 1); + else if (wfx.nChannels == 2) + dwWaveStyle |= 1; + else + goto ERROR_IN_ROUTINE; + + // Check the bits... + if (wfx.wBitsPerSample == 8); + else if (wfx.wBitsPerSample == 16) + dwWaveStyle |= 2; + else + goto ERROR_IN_ROUTINE; + + // Check the rate. + if (wfx.nSamplesPerSec == 8000); + else if (wfx.nSamplesPerSec == 11025) + dwWaveStyle |= 4; + else if (wfx.nSamplesPerSec == 22050) + dwWaveStyle |= 8; + else if (wfx.nSamplesPerSec == 44100) + dwWaveStyle |= 12; + else + goto ERROR_IN_ROUTINE; + + nError = (int)dwWaveStyle; + +ERROR_IN_ROUTINE: + return(nError); +} + + +/* This will convert an index (from a list box for instance) + to a format by passing + in the format to direct sound. + + Input: + hWnd - Handle to window. + pFileInfo - Pointer to current file info. + index - Index value to convert to a + waveformat structure. + + Output: + 0 if successful, else the error code. + +*/ +int IndexToFormat( + HWND hWnd, + FILEINFO *pFileInfo, + int index + ) + +{ + + int nError = 0; + + + pFileInfo->pwfx->wFormatTag = WAVE_FORMAT_PCM; + + pFileInfo->pwfx->nChannels = 2; // Assume stereo. + if ((index%2) == 0) + pFileInfo->pwfx->nChannels = 1; // Its mono. + + // Assume 16 bit + pFileInfo->pwfx->nBlockAlign = 2*pFileInfo->pwfx->nChannels; + pFileInfo->pwfx->wBitsPerSample = 16; + if ((index%4) < 2) { + // Its 8 bit. + pFileInfo->pwfx->nBlockAlign = 1*pFileInfo->pwfx->nChannels; + pFileInfo->pwfx->wBitsPerSample = 8; + } + + pFileInfo->pwfx->nSamplesPerSec = 44100; // Assume 44.1 kHz + if (index < 4) + pFileInfo->pwfx->nSamplesPerSec = 8000; + else if (index < 8) + pFileInfo->pwfx->nSamplesPerSec = 11025; + else if (index < 12) + pFileInfo->pwfx->nSamplesPerSec = 22050; + + + pFileInfo->pwfx->nAvgBytesPerSec = pFileInfo->pwfx->nSamplesPerSec * + pFileInfo->pwfx->nBlockAlign; + pFileInfo->pwfx->cbSize = 0; + + if ((nError = pFileInfo->pDSB->lpVtbl->SetFormat(pFileInfo->pDSB, + pFileInfo->pwfx)) != DS_OK) { + MessageBox(hWnd, "Cannot set format buffer", + "Direct Sound Error", MB_OK); + goto ERROR_DONE_ROUTINE; + + } + +ERROR_DONE_ROUTINE: + return(nError); + +} + + +/****************************************************************************/ +/* GetMediaStartPath() */ +/* */ +/* This helper function attempts to get the media directory for Direct3D, */ +/* which is where all the installed DX wave files go. If it can't find that */ +/* it settles for the media sub-directory of the Windows directory. */ +/****************************************************************************/ +void GetMediaStartPath( void ) + { + HKEY hReg; + DWORD cbStartPathLen; + + if( ERROR_SUCCESS != RegOpenKeyEx( HKEY_LOCAL_MACHINE, + gszRegKeyDirect3D, + 0, KEY_READ, &hReg )) + { + goto REG_OPEN_FAILED; + } + else + { + // Query the Registry for the path to the media directory + cbStartPathLen = sizeof( gszCDStartPath ); + if( ERROR_SUCCESS != RegQueryValueEx( hReg, gszRegValueD3DPath, + NULL, NULL, + gszCDStartPath, &cbStartPathLen )) + { + goto REG_OPEN_FAILED; + } + RegCloseKey( hReg ); + hReg = NULL; + } + + return; + +REG_OPEN_FAILED: + // Start off by getting the Windows directory -- we're trying to build a + // file path like "C:\WINDOWS\MEDIA", but the WINDOWS directory could be + // named anything, so we must ask. + GetWindowsDirectory( gszCDStartPath, sizeof(gszCDStartPath)); + // If there's no trailing backslash, append one + if( lstrcmp( &gszCDStartPath[lstrlen(gszCDStartPath)], TEXT("\\") )) + lstrcat( gszCDStartPath, TEXT("\\")); + // Now add on the MEDIA part of the path + lstrcat( gszCDStartPath, TEXT("MEDIA")); + } + + +///////////////////////////////////////////////////////////////////////////// +// fGetToken() +// +// Parses the command-line string "in place" starting at pszStart. A ptr +// to the start of the next token and it's length will be the out parameters, +// or NULL and 0 if no token. Note that *ppszRet will NOT be NULL-terminated +// since the string is part of another string. That's what then length is for. +// +// Returns: TRUE if a token was retrieved, or FALSE if there was no token. +// +BOOL fGetToken( PSTR pszStart, PSTR *ppszRet, int *pcchRet ) + { + PSTR pszCur = pszStart; + PSTR pszTokStart; + + if( !pszStart || NULL == ppszRet || NULL == pcchRet ) + return FALSE; + + // Skip leading whitespace + while( *pszCur && (*pszCur == ' ' || *pszCur == '\t')) + pszCur++; + + *ppszRet = NULL; + *pcchRet = 0; + + if( *pszCur ) + { + pszTokStart = pszCur; + + while( *pszCur && *pszCur != ' ' && *pszCur != '\t' ) + pszCur++; + + *ppszRet = pszTokStart; + *pcchRet = (int)(pszCur - pszTokStart); + } + + if( *pcchRet != 0 ) + return TRUE; + else + return FALSE; + } + + +/////////////////////////////////////////////////////////////////////////// +// fMatchToken() +// +// Attempts to match the first cchLen characters of pszDatum to the +// string at pszString. The comparison is case-insensitive (this function +// is designed for command-line switch matching). +// +// Returns: TRUE if the first cchLen characters are a match, else FALSE. +// +BOOL fMatchToken( PSTR pszString, PSTR pszDatum, int cchLen ) + { + int i; + + for( i = 0; i < cchLen; i++ ) + { + if( CharLower( (LPTSTR)MAKELONG( pszString[i], 0 )) + != CharLower( (LPTSTR)MAKELONG( pszDatum[i], 0 ))) + return FALSE; + } + return TRUE; + } + + +//////////////////////////////////////////////////////////////////////////// +// ParseCommandLine() +// +// Given a command-line string without the module name, this function will +// parse the command line and takes action on whatever it finds there. +// +// Returns: TRUE if successful, or FALSE if there was an error. +// +BOOL ParseCommandLine(LPSTR lpszCmdLine) + { + PSTR pszCur,pszToken; + PSTR ppszFiles[MAXCONTROLS]; + BOOL fStartPlaying = FALSE, fStartLooping = FALSE; + int cchTokLen = 0, i, nFilesFound; + + pszCur = lpszCmdLine; + + // First get all the command line switches + while( fGetToken(pszCur, &pszToken, &cchTokLen) && + (pszToken[0] == '/' || pszToken[0] == '-' )) + { + pszCur = pszToken + cchTokLen; + pszToken++; + + if( fMatchToken( pszToken, "PLAY", 4 )) + { + fStartPlaying = TRUE; + } + else if( fMatchToken( pszToken, "LOOP", 4 )) + { + fStartLooping = TRUE; + } + else + { + // We don't recognize this mysterious switch, so eat it and move on + } + } + + // Anything left on the command-line will be treated as a filename and + // we'll attempt to open it after we've found them all + nFilesFound = 0; + while( fGetToken(pszCur, &pszToken, &cchTokLen) && nFilesFound < MAXCONTROLS ) + { + pszCur = pszToken + cchTokLen; + ppszFiles[nFilesFound] = GlobalAllocPtr( GPTR, (cchTokLen+1)*sizeof(char)); + // Copy the token out of the command-line string and into our buffer + CopyMemory( ppszFiles[nFilesFound], pszToken, cchTokLen*sizeof(char)); + // Append a NULL terminator to what we just copied (to be safe) + *(ppszFiles[nFilesFound] + cchTokLen) = 0; + nFilesFound++; + } + // This function will take the array of strings we've created and open + // each string as a file. It will obey the global fStartPlaying and + // fStartLooping flags we may have already set above + if( nFilesFound ) + BatchOpenFiles( ppszFiles, nFilesFound, fStartPlaying, fStartLooping ); + + // Free the space we allocated + for( i = 0; i < nFilesFound; i++ ) + { + GlobalFreePtr( ppszFiles[i] ); + ppszFiles[i] = NULL; + } + + // Returning TRUE means the caller should continue doing what they + // were doing: we succeeded. + return TRUE; + } + + +//////////////////////////////////////////////////////////////////////////// +// BatchOpenFiles() +// +// Takes an array of string pointers and tries to open each as a file to +// playback. If fPlay is TRUE, the files will be played as they are being +// opened. If fLoop is TRUE, they will also be set to loop. +// +// Returns: FALSE in the event of catastrophic failure, otherwise TRUE. +// +BOOL BatchOpenFiles( PSTR *ppszFiles, int nFiles, BOOL fPlay, BOOL fLoop ) + { + int i; + FILEINFO *pfi; + DWORD cSamples; + + // Cap the number of files we can load out of the given set if we'd load + // too many otherwise + if( GetNumControls(&FileInfoFirst) + nFiles > MAXCONTROLS ) + nFiles = MAXCONTROLS - GetNumControls(&FileInfoFirst); + + for( i = 0; i < nFiles; i++ ) + { + if(( pfi = GlobalAllocPtr(GPTR, sizeof(FILEINFO))) == NULL ) + goto BOF_Fail; + + ZeroMemory( pfi, sizeof(FILEINFO)); + strcpy( pfi->szFileName, ppszFiles[i] ); + + if( WaveLoadFile( ppszFiles[i], &pfi->cbSize, &cSamples, + &pfi->pwfx, &pfi->pbData ) != 0 ) + goto BOF_LoopError; + + GetNextControlCoords( &FileInfoFirst, &pfi->cox, &pfi->coy ); + if( NewDirectSoundBuffer(pfi) != 0) + goto BOF_LoopError; + Assert( pfi->pbData != NULL ); + + if( AddToList( &FileInfoFirst, pfi ) != 0 ) + goto BOF_LoopError; + + pfi->nFileName = 0; + + if( CreateControl( hWndMain, pfi, pfi->pwfx->nSamplesPerSec, + (MAXPAN_TB-MINPAN_TB)/2, MINVOL_TB ) != 0 ) + { + ReleaseDirectSoundBuffer(pfi); + RemoveFromList( pfi, &FileInfoFirst ); + // RemoveFromList will do all the cleanup + pfi = NULL; + goto BOF_LoopError; + } + ChangeOutputVol(pfi); + ChangeOutputFreq(pfi); + ChangeOutputPan(pfi); + + // LOOP is only obeyed if PLAY was also specified + if( fPlay ) + { + if( fLoop ) + { + pfi->fLooped = TRUE; + SendMessage( pfi->hWndLooped_BN, BM_SETCHECK, TRUE, 0L ); + } + SendMessage( hWndMain, WM_COMMAND, 0, (LPARAM)pfi->hWndPlay_BN ); + } + + // Avoid the in-loop error cleanup by using a continue statement here + // to jump back up to the top + continue; + + // Cleanup code in case we fail to open a particular file -- we should + // just ignore this one and continue because we might still be able to + // open other files + BOF_LoopError: + if( NULL != pfi ) + { + if( NULL != pfi->pwfx ) + { + GlobalFreePtr(pfi->pwfx); + pfi->pwfx = NULL; + } + if( NULL != pfi->pbData ) + { + GlobalFreePtr(pfi->pbData); + pfi->pbData = NULL; + } + + ReleaseDirectSoundBuffer(pfi); + GlobalFreePtr(pfi); + pfi = NULL; + } + } + + UpdateMainStatus(); + + return TRUE; + +BOF_Fail: + return FALSE; + } + + diff --git a/sdk/samples/dsshow/shell.h b/sdk/samples/dsshow/shell.h new file mode 100644 index 0000000..d6f77cc --- /dev/null +++ b/sdk/samples/dsshow/shell.h @@ -0,0 +1,297 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: shell.h + * Content: DirectSound shell header + * + ***************************************************************************/ +#ifndef __SHELL_INCLUDED__ +#define __SHELL_INCLUDED__ +// If this is defined, then an extra text string under the filename will show +// if the file is stopped or playing. +#define SHOWSTATUS + +#define MAXCONTROLS 8 + +// For setting the ranges on the freq, vol, etc. +// dwFreq*FREQMUL+FREQADD = # to show on screen. + +#define FREQFACTOR (5) +#define FREQADD (0) +#define FREQPAGE (100) +#define PANPAGE (5) + +#define MINFREQ_TB 0 +#define MAXFREQ_TB 100000 +#define MINPAN_TB 0 +#define MIDPAN_TB 400 +#define MAXPAN_TB 800 +#define SHIFTPAN_TB (-400) +#define MULTPAN_TB (10L) +#define MINPAN_VAL (-400) +#define MIDPAN_VAL 0 +#define MAXPAN_VAL 400 +#define MINVOL_TB 0 +#define MAXVOL_TB 400 +#define SHIFTVOL_TB (-400) +#define MULTVOL_TB (10L) +#define MINVOL_VAL -400 +#define MAXVOL_VAL 0 + + +// Id code deltas +#define idFreqTB 1 +#define idPanTB 2 +#define idVolLTB 3 +#define idVolRTB 4 +#define idVolMTB 5 +#define idLoopedBN 6 +#define idPlayBN 7 +#define idRemoveBN 8 + + +// UI stuff. + + +#define DX_WIN_BORDER 30 +#define DY_WIN_BORDER 30 +#define DX_MINWINDOW 640 +#define DY_MINWINDOW 450 // Was 560 Must tweek to keep above the taskbar <= 450 + +#define DX_CONTROLSPACING 150 +#define DY_CONTROLSPACING 0 + +#define DX_LINEEDGE (DX_CONTROLSPACING - 20) +#define DY_LINEEDGE (1) + + +#define COX_STARTCONTROL (20) // Defines the left edge of the first file window +#define COY_STARTCONTROL (10) // Defines the upper edge of the first file window + +#define DX_TEXTSPACING 5 +#define DY_TEXTSPACING 10 + +#define DX_LOOPEDSPACING 0 //Relative horizontal offset of top four areas +#define DY_LOOPEDSPACING -6 //Space offset around lines + +#define DX_STATUSSPACING 0 + +#ifdef SHOWSTATUS +#define DY_STATUSSPACING 8 +#else +#define DY_STATUSSPACING 0 +#endif + + +#define DX_FREQSPACING 0 +#define DY_FREQSPACING 10 + +#define DY_PANSPACING 10 +#define DY_VOLSPACING 10 + +//Establish the Widths of various windows: +#define DX_FILENAME_TXT 120 //Filename window +#define DX_STATUS_TXT 120 //Status window +#define DX_FREQ_TXT 120 //Frequency window +#define DX_PAN_TXT 100 //Pan window +#define DX_VOL_TXT 100 //Volume window +#define DX_LOOPED_TXT 100 //Checkbox + 'Looped' window + +//Establish slider sizes: +#define DX_FREQ_TB 130 //Frequency slider width +#define DY_FREQ_TB 40 //Frequency slider height +#define DX_PAN_TB 130 //Pan slider width +#define DY_PAN_TB 40 //Pan slider height +#define DX_VOL_TB 40 //Master volume slider width +#define DY_VOL_TB 100 //Master volume slider height +#define DX_VOLSPACING_TB 5 //Distance between master volume and its label + +#define DX_VOLUMECHAR 15 +#define DY_VOLSPACINGY -5 //Distance between channel mixers and L & R labels + +#define DX_BUTTONSPACING 61 //Width of the Play and Remove buttons +#define DY_BUTTONSPACING 10 +#define DY_BEFOREFIRSTBUTTON 18 //Distance above and below Volume->buttons line +#define DY_BETWEENBUTTONS 5 //Vertical space between buttons + +#define DX_FRAMEEDGE 10 //Distance between leftmost control and the window edge +#define DY_FRAMEEDGE 10 //Distance between outermost contol and the window edge +#define DX_FRAMEEDGEINNER 4 //Distance between file windows + + +// To check for stopping of sounds, a timer is set...use this for the rate. +#define TIMERPERIOD 500 // In milliseconds + +// In Options/Output Type, there are strings to pick the format...Here are the number of them. +#define C_DROPDOWNPCMFORMATS 16 + +typedef struct _fileinfo + { + BYTE *pbData; // Pointer to actual data of file. + UINT cbSize; // Size of data. + WAVEFORMATEX *pwfx; // Pointer to waveformatex structure. + + DWORD dwFreq; // Frequency. + DWORD dwPan; // Panning info. + DWORD dwVol; // Total volume. + BOOL fLooped; // Looped? + + BOOL fPlaying; // Is this one playing? + BOOL fLost; // Is this one lost? + BOOL fHardware; // Is this a hardware buffer? + BOOL fSticky; // Is this a sticky buffer? + + int cox; // Coordinates of where the structure is + int coy; // printed. + + // HWND's needed. + HWND hWndFileName_TXT; // Filename text string. + HWND hWndFreq_TB; // Trackbar handle. + HWND hWndFreq_TXT; // Text string for freq. + HWND hWndPan_TB; // Trackbar handle. + HWND hWndPan_TXT; // Text string for pan. + HWND hWndVol_TXT; // Text string for volume. + HWND hWndVolL_TB; // Trackbar for volume left. + HWND hWndVolR_TB; // Trackbar for volume right. + HWND hWndVolM_TB; // Main volume. + HWND hWndLooped_BN; // Looped + HWND hWndPlay_BN; // Play + HWND hWndRemove_BN; // Remove. + + HWND hWndFileName_EDGE; // The line under filename. + HWND hWndLooped_EDGE; // The line under looped. + HWND hWndFreq_EDGE; // The line under freq. + HWND hWndPan_EDGE; // The line under pan. + HWND hWndVol_EDGE; // The line under volume. + HWND hWndWhole_EDGE; // The whole surrounding edge. + HWND hWndVolL_TXT; // For the L + HWND hWndVolR_TXT; // For the R + + #ifdef SHOWSTATUS + HWND hWndStatus_TXT; // For status. + HWND hWndStatus_EDGE; + HWND hWndPlayPosition_TXT; + HWND hWndPlayPosition_EDGE; + HWND hWndWritePosition_TXT; + HWND hWndWritePosition_EDGE; + #endif + + LPDIRECTSOUNDBUFFER pDSB; // Pointer to direct sound buffer. + + int nFileName; // Index to filename, not including dir. + char szFileName[MAX_PATH]; + struct _fileinfo *pNext; // Pointer to next file. + + } FILEINFO; + + +char szAppName[] = "Direct Sound Demo"; +char szMessage[] = "Direct Sound Demo"; + +char gszCDStartPath[MAX_PATH]; // The path to start the Open dialog in + +// Registry Key and Value names that allow us to retrive a path something like +// "C:\DXSDK\SDK\MEDIA", but matching the current install. +const TCHAR gszRegKeyDirect3D[] = TEXT("Software\\Microsoft\\Direct3D"); +const TCHAR gszRegValueD3DPath[] = TEXT("D3D Path"); + +HANDLE hInst; +HWND hWndMain = NULL; +DWORD dwTimer = 0; // Timer handle. +GUID guID; +BOOL fEnumDrivers = FALSE; + +/* This is the main head of the linked list, but its only used for the + pNext which will point to the first FILEINFO structure, or NULL if there + are no files loaded */ +FILEINFO FileInfoFirst; // Start of linked list. + +char szFreq[] = "Freq"; +char szPan[] = "Pan"; +char szVolume[] = "Volume"; +char szLooped[] = "Looped"; +char szPlay[] = "Play"; +char szStop[] = "Stop"; +char szRemove[] = "Close"; + +#ifdef SHOWSTATUS +char szFmtPlayPosition[] = "Play %d"; +char szFmtWritePosition[] = "Write %d"; +char szPlaying[] = "Playing"; +char szStopped[] = "Stopped"; +char szSticky[] = "Sticky"; +char szLost[] = "Lost"; +char szHW[] = "HW-"; +char szSW[] = "SW-"; +#endif + + +char *rgszTypes[C_DROPDOWNPCMFORMATS] = + { // Index + "8.000 kHz, 8-Bit, Mono", // 0 + "8.000 kHz, 8-Bit, Stereo", // 1 + "8.000 kHz, 16-Bit, Mono", // 2 + "8.000 kHz, 16-Bit, Stereo", // 3 + "11.025 kHz, 8-Bit, Mono", // 4 + "11.025 kHz, 8-Bit, Stereo", // 5 + "11.025 kHz, 16-Bit, Mono", // 6 + "11.025 kHz, 16-Bit, Stereo", // 7 + "22.050 kHz, 8-Bit, Mono", // 8 + "22.050 kHz, 8-Bit, Stereo", // 9 + "22.050 kHz, 16-Bit, Mono", // 10 + "22,050 kHz, 16-Bit, Stereo", // 11 + "44.100 kHz, 8-Bit, Mono", // 12 + "44.100 kHz, 8-Bit, Stereo", // 13 + "44.100 kHz, 16-Bit, Mono", // 14 + "44.100 kHz, 16-Bit, Stereo" // 15 + }; + +BOOL rgfcoxAvail[MAXCONTROLS]; + +LPDIRECTSOUND gpds = NULL; + + +long FAR PASCAL WndProc(HWND, unsigned, WPARAM, LPARAM); +long FAR PASCAL DLGHelpAbout(HWND, UINT, WPARAM, LPARAM); +long FAR PASCAL DLGOutputBufferType(HWND, UINT, WPARAM, LPARAM); +long FAR PASCAL DLGCheckLatency(HWND, UINT, WPARAM, LPARAM); +UINT CALLBACK FileOpenCustomTemplateDlgProc(HWND, UINT, WPARAM, LPARAM); + +BOOL ClassInit(HANDLE); +void PD_FileOpen(HWND); +BOOL OpenFileDialog(HWND, LPSTR, int *, LPBOOL); +BOOL IsValidWave(LPSTR); +void GetMediaStartPath(void); + +int CreateControl(HWND, FILEINFO *, DWORD, DWORD, DWORD); +void GetNextControlCoords(FILEINFO *, int *, int *); +int AddToList(FILEINFO *, FILEINFO *); +int FreeAllList(HWND, FILEINFO *); +int RemoveFromList(FILEINFO *, FILEINFO *); +int GetNumControls(FILEINFO *); +int StartDSound(HWND, FILEINFO *); +int StopDSound(HWND, FILEINFO *); +int StopAllDSounds(HWND, FILEINFO *); + +BOOL UIMainWindowVSBHandler(HWND, WPARAM, LPARAM); +BOOL UIMainWindowHSBHandler(HWND, WPARAM, LPARAM); +BOOL UIMainWindowCMDHandler(HWND, WPARAM, LPARAM); +BOOL UIMainWindowTimerHandler(HWND, WPARAM, LPARAM); +void SetAllText(FILEINFO *); +void UpdateLRVolume(FILEINFO *); + +void AppDestroy(HWND); +BOOL AppInit(HWND); +BOOL ParseCommandLine(PSTR); +BOOL BatchOpenFiles(PSTR *,int,BOOL,BOOL); + +int NewDirectSoundBuffer(FILEINFO *); +int ReleaseDirectSoundBuffer(FILEINFO *); +int ChangeOutputPan(FILEINFO *); +int ChangeOutputFreq(FILEINFO *); +int ChangeOutputVol(FILEINFO *); + +int FormatToIndex(HWND, FILEINFO *); +int IndexToFormat(HWND, FILEINFO *, int); +#endif diff --git a/sdk/samples/dsshow/wassert.c b/sdk/samples/dsshow/wassert.c new file mode 100644 index 0000000..f7536d4 --- /dev/null +++ b/sdk/samples/dsshow/wassert.c @@ -0,0 +1,44 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: wassert.c + * Content: Windows assert handler + * You must externally define hWndMain and szAppName for this + * to work. + * + ***************************************************************************/ + +#include <windows.h> + +extern HWND hWndMain; +extern char szAppName[]; + +#include "wassert.h" + + +#ifdef ASSERT +void AssertFail(char szErr[], char szFileName[], int nLine, char szMessage[]) + { + char szT[256]; + + if (szMessage != NULL) + wsprintf(szT, "Assert(%s);\nFile %s, line %d. %s", szErr, szFileName, nLine, szMessage); + else + wsprintf(szT, "Assert(%s);\nFile %s, line %d.", szErr, szFileName, nLine); + switch (MessageBox(hWndMain, szT, szAppName, MB_ABORTRETRYIGNORE | MB_ICONSTOP | MB_APPLMODAL)) + { + case IDABORT: + SendMessage(hWndMain, WM_CLOSE, 0, 0); + case IDRETRY: + _asm int 3; + // Fall Through // + case IDIGNORE: + break; + + } // switch + } // AssertFail + + +#endif // ASSERT + diff --git a/sdk/samples/dsshow/wassert.h b/sdk/samples/dsshow/wassert.h new file mode 100644 index 0000000..4bccb58 --- /dev/null +++ b/sdk/samples/dsshow/wassert.h @@ -0,0 +1,28 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: wassert.h + * Content: assert header + * + ***************************************************************************/ +#ifndef __WASSERT_INCLUDED__ +#define __WASSERT_INCLUDED__ + +#ifdef _DEBUG +#define ASSERT // Enable the Assert() macro +#endif + +#ifdef ASSERT + +void AssertFail(char [], char [], int, char[]); +#define Assert(f) ((f) ? (void)NULL : (void)AssertFail(#f, __FILE__, __LINE__,NULL)) +#define AssertMessage(f, szMessage) ((f) ? (void)NULL : (void)AssertFail(#f, __FILE__, __LINE__, szMessage)) + +#else +#define Assert(f) (void)NULL // Macro that does nothing +#define AssertMessage(f, szMessage) (void)NULL + +#endif // ~ASSERT + +#endif diff --git a/sdk/samples/dsshow/wave.c b/sdk/samples/dsshow/wave.c new file mode 100644 index 0000000..c62d977 --- /dev/null +++ b/sdk/samples/dsshow/wave.c @@ -0,0 +1,895 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: wave.c + * Content: Wave library routines. + * This file is used for loading/saving waves, and reading and + * writing waves in smaller blocks. + * Uses WaveOpenFile, WaveReadFile and WaveCloseReadFile for + * single block access to reading wave files. + * Uses WaveCreateFile, WaveWriteFile, WaveCloseWriteFile for + * single block access for writing wave files. + * Uses WaveLoadFile to load a whole wave file into memory. + * Uses WaveSaveFile to save a whole wave file into memory. + * + ***************************************************************************/ + +/* PROTOTYPES */ +#include <windows.h> +#include <mmsystem.h> +#include "wave.h" +#include "wassert.h" +#include "windowsx.h" + + +/* ROUTINES */ +/* -------------------------------------------------------*/ + +/* This function will open a wave input file and prepare it for reading, + * so the data can be easily + * read with WaveReadFile. Returns 0 if successful, the error code if not. + * pszFileName - Input filename to load. + * phmmioIn - Pointer to handle which will be used + * for further mmio routines. + * ppwfxInfo - Ptr to ptr to WaveFormatEx structure + * with all info about the file. + * +*/ +int WaveOpenFile( + char *pszFileName, // (IN) + HMMIO *phmmioIn, // (OUT) + WAVEFORMATEX **ppwfxInfo, // (OUT) + MMCKINFO *pckInRIFF // (OUT) + ) +{ + HMMIO hmmioIn; + MMCKINFO ckIn; // chunk info. for general use. + PCMWAVEFORMAT pcmWaveFormat; // Temp PCM structure to load in. + WORD cbExtraAlloc; // Extra bytes for waveformatex + int nError; // Return value. + + + // Initialization... + *ppwfxInfo = NULL; + nError = 0; + hmmioIn = NULL; + + if ((hmmioIn = mmioOpen(pszFileName, NULL, MMIO_ALLOCBUF | MMIO_READ)) == NULL) + { + nError = ER_CANNOTOPEN; + goto ERROR_READING_WAVE; + } + + if ((nError = (int)mmioDescend(hmmioIn, pckInRIFF, NULL, 0)) != 0) + { + goto ERROR_READING_WAVE; + } + + + if ((pckInRIFF->ckid != FOURCC_RIFF) || (pckInRIFF->fccType != mmioFOURCC('W', 'A', 'V', 'E'))) + { + nError = ER_NOTWAVEFILE; + goto ERROR_READING_WAVE; + } + + /* Search the input file for for the 'fmt ' chunk. */ + ckIn.ckid = mmioFOURCC('f', 'm', 't', ' '); + if ((nError = (int)mmioDescend(hmmioIn, &ckIn, pckInRIFF, MMIO_FINDCHUNK)) != 0) + { + goto ERROR_READING_WAVE; + } + + /* Expect the 'fmt' chunk to be at least as large as <PCMWAVEFORMAT>; + * if there are extra parameters at the end, we'll ignore them */ + + if (ckIn.cksize < (long) sizeof(PCMWAVEFORMAT)) + { + nError = ER_NOTWAVEFILE; + goto ERROR_READING_WAVE; + } + + /* Read the 'fmt ' chunk into <pcmWaveFormat>.*/ + if (mmioRead(hmmioIn, (HPSTR) &pcmWaveFormat, (long) sizeof(pcmWaveFormat)) != (long) sizeof(pcmWaveFormat)) + { + nError = ER_CANNOTREAD; + goto ERROR_READING_WAVE; + } + + + // Ok, allocate the waveformatex, but if its not pcm + // format, read the next word, and thats how many extra + // bytes to allocate. + if (pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_PCM) + cbExtraAlloc = 0; + + else + { + // Read in length of extra bytes. + if (mmioRead(hmmioIn, (LPSTR) &cbExtraAlloc, + (long) sizeof(cbExtraAlloc)) != (long) sizeof(cbExtraAlloc)) + { + nError = ER_CANNOTREAD; + goto ERROR_READING_WAVE; + } + + } + + // Ok, now allocate that waveformatex structure. + if ((*ppwfxInfo = GlobalAlloc(GMEM_FIXED, sizeof(WAVEFORMATEX)+cbExtraAlloc)) == NULL) + { + nError = ER_MEM; + goto ERROR_READING_WAVE; + } + + // Copy the bytes from the pcm structure to the waveformatex structure + memcpy(*ppwfxInfo, &pcmWaveFormat, sizeof(pcmWaveFormat)); + (*ppwfxInfo)->cbSize = cbExtraAlloc; + + // Now, read those extra bytes into the structure, if cbExtraAlloc != 0. + if (cbExtraAlloc != 0) + { + if (mmioRead(hmmioIn, (LPSTR) (((BYTE*)&((*ppwfxInfo)->cbSize))+sizeof(cbExtraAlloc)), + (long) (cbExtraAlloc)) != (long) (cbExtraAlloc)) + { + nError = ER_NOTWAVEFILE; + goto ERROR_READING_WAVE; + } + } + + /* Ascend the input file out of the 'fmt ' chunk. */ + if ((nError = mmioAscend(hmmioIn, &ckIn, 0)) != 0) + { + goto ERROR_READING_WAVE; + + } + + + goto TEMPCLEANUP; + +ERROR_READING_WAVE: + if (*ppwfxInfo != NULL) + { + GlobalFree(*ppwfxInfo); + *ppwfxInfo = NULL; + } + + if (hmmioIn != NULL) + { + mmioClose(hmmioIn, 0); + hmmioIn = NULL; + } + +TEMPCLEANUP: + *phmmioIn = hmmioIn; + + return(nError); + +} + +/* This routine has to be called before WaveReadFile as it searchs for the chunk to descend into for + reading, that is, the 'data' chunk. For simplicity, this used to be in the open routine, but was + taken out and moved to a separate routine so there was more control on the chunks that are before + the data chunk, such as 'fact', etc... */ + +int WaveStartDataRead( + HMMIO *phmmioIn, + MMCKINFO *pckIn, + MMCKINFO *pckInRIFF + ) +{ + int nError; + + nError = 0; + + // Do a nice little seek... + if ((nError = mmioSeek(*phmmioIn, pckInRIFF->dwDataOffset + sizeof(FOURCC), SEEK_SET)) == -1) + { + Assert(FALSE); + } + + nError = 0; + // Search the input file for for the 'data' chunk. + pckIn->ckid = mmioFOURCC('d', 'a', 't', 'a'); + if ((nError = mmioDescend(*phmmioIn, pckIn, pckInRIFF, MMIO_FINDCHUNK)) != 0) + { + goto ERROR_READING_WAVE; + } + + goto CLEANUP; + +ERROR_READING_WAVE: + +CLEANUP: + return(nError); +} + + +/* This will read wave data from the wave file. Makre sure we're descended into + the data chunk, else this will fail bigtime! + hmmioIn - Handle to mmio. + cbRead - # of bytes to read. + pbDest - Destination buffer to put bytes. + cbActualRead- # of bytes actually read. + + + +*/ + + +int WaveReadFile( + HMMIO hmmioIn, // IN + UINT cbRead, // IN + BYTE *pbDest, // IN + MMCKINFO *pckIn, // IN. + UINT *cbActualRead // OUT. + + ) +{ + + MMIOINFO mmioinfoIn; // current status of <hmmioIn> + int nError; + UINT cT, cbDataIn; + + nError = 0; + + if (nError = mmioGetInfo(hmmioIn, &mmioinfoIn, 0) != 0) + { + goto ERROR_CANNOT_READ; + } + + cbDataIn = cbRead; + if (cbDataIn > pckIn->cksize) + cbDataIn = pckIn->cksize; + + pckIn->cksize -= cbDataIn; + + for (cT = 0; cT < cbDataIn; cT++) + { + /* Copy the bytes from the io to the buffer. */ + if (mmioinfoIn.pchNext == mmioinfoIn.pchEndRead) + { + if ((nError = mmioAdvance(hmmioIn, &mmioinfoIn, MMIO_READ)) != 0) + { + goto ERROR_CANNOT_READ; + } + if (mmioinfoIn.pchNext == mmioinfoIn.pchEndRead) + { + nError = ER_CORRUPTWAVEFILE; + goto ERROR_CANNOT_READ; + } + } + + // Actual copy. + *((BYTE*)pbDest+cT) = *((BYTE*)mmioinfoIn.pchNext)++; + } + + if ((nError = mmioSetInfo(hmmioIn, &mmioinfoIn, 0)) != 0) + { + goto ERROR_CANNOT_READ; + } + + *cbActualRead = cbDataIn; + goto FINISHED_READING; + +ERROR_CANNOT_READ: + *cbActualRead = 0; + +FINISHED_READING: + return(nError); + +} + +/* This will close the wave file openned with WaveOpenFile. + phmmioIn - Pointer to the handle to input MMIO. + ppwfxSrc - Pointer to pointer to WaveFormatEx structure. + + Returns 0 if successful, non-zero if there was a warning. + +*/ +int WaveCloseReadFile( + HMMIO *phmmio, // IN + WAVEFORMATEX **ppwfxSrc // IN + ) +{ + + if (*ppwfxSrc != NULL) + { + GlobalFree(*ppwfxSrc); + *ppwfxSrc = NULL; + } + + if (*phmmio != NULL) + { + mmioClose(*phmmio, 0); + *phmmio = NULL; + } + + return(0); + +} + +/* This routine will create a wave file for writing. This will automatically overwrite any + existing file with the same name, so be careful and check before hand!!! + pszFileName - Pointer to filename to write. + phmmioOut - Pointer to HMMIO handle that is used for further writes + pwfxDest - Valid waveformatex destination structure. + pckOut - Pointer to be set with the MMCKINFO. + pckOutRIFF - Pointer to be set with the RIFF info. + +*/ +int WaveCreateFile( + char *pszFileName, // (IN) + HMMIO *phmmioOut, // (OUT) + WAVEFORMATEX *pwfxDest, // (IN) + MMCKINFO *pckOut, // (OUT) + MMCKINFO *pckOutRIFF // (OUT) + + ) +{ + + int nError; // Return value. + DWORD dwFactChunk; // Contains the actual fact chunk. Garbage until WaveCloseWriteFile. + MMCKINFO ckOut1; + + dwFactChunk = (DWORD)-1; + nError = 0; + + *phmmioOut = mmioOpen(pszFileName, NULL, + MMIO_ALLOCBUF | MMIO_READWRITE|MMIO_CREATE); + + if (*phmmioOut == NULL) + { + nError = ER_CANNOTWRITE; + goto ERROR_CANNOT_WRITE; // cannot save WAVE file + } + + /* Create the output file RIFF chunk of form type 'WAVE'. + */ + pckOutRIFF->fccType = mmioFOURCC('W', 'A', 'V', 'E'); + pckOutRIFF->cksize = 0; + if ((nError = mmioCreateChunk(*phmmioOut, pckOutRIFF, MMIO_CREATERIFF)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + /* We are now descended into the 'RIFF' chunk we just created. + * Now create the 'fmt ' chunk. Since we know the size of this chunk, + * specify it in the MMCKINFO structure so MMIO doesn't have to seek + * back and set the chunk size after ascending from the chunk. + */ + pckOut->ckid = mmioFOURCC('f', 'm', 't', ' '); + pckOut->cksize = sizeof(PCMWAVEFORMAT); // we know the size of this ck. + if ((nError = mmioCreateChunk(*phmmioOut, pckOut, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + /* Write the PCMWAVEFORMAT structure to the 'fmt ' chunk if its that type. */ + if (pwfxDest->wFormatTag == WAVE_FORMAT_PCM) + { + if (mmioWrite(*phmmioOut, (HPSTR) pwfxDest, sizeof(PCMWAVEFORMAT)) + != sizeof(PCMWAVEFORMAT)) + { + nError = ER_CANNOTWRITE; + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + } + + else + { + // Write the variable length size. + if ((UINT)mmioWrite(*phmmioOut, (HPSTR) pwfxDest, sizeof(*pwfxDest)+pwfxDest->cbSize) + != (sizeof(*pwfxDest)+pwfxDest->cbSize)) + { + nError = ER_CANNOTWRITE; + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + } + + /* Ascend out of the 'fmt ' chunk, back into the 'RIFF' chunk. + */ + if ((nError = mmioAscend(*phmmioOut, pckOut, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + // Now create the fact chunk, not required for PCM but nice to have. This is filled + // in when the close routine is called. + ckOut1.ckid = mmioFOURCC('f', 'a', 'c', 't'); + ckOut1.cksize = 0; + if ((nError = mmioCreateChunk(*phmmioOut, &ckOut1, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + if (mmioWrite(*phmmioOut, (HPSTR)&dwFactChunk, sizeof(dwFactChunk)) != sizeof(dwFactChunk)) + { + nError = ER_CANNOTWRITE; + goto ERROR_CANNOT_WRITE; + } + + // Now ascend out of the fact chunk... + if ((nError = mmioAscend(*phmmioOut, &ckOut1, 0)) != 0) + { + nError = ER_CANNOTWRITE; // cannot write file, probably + goto ERROR_CANNOT_WRITE; + } + + + + goto DONE_CREATE; + +ERROR_CANNOT_WRITE: + // Maybe delete the half-written file? Ah forget it for now, its good to leave the + // file there for debugging... + +DONE_CREATE: + return(nError); + +} + +/* This routine has to be called before any data is written to the wave output file, via wavewritefile. This + sets up the data to write, and creates the data chunk. +*/ + +int WaveStartDataWrite( + HMMIO *phmmioOut, // (IN) + MMCKINFO *pckOut, // (IN) + MMIOINFO *pmmioinfoOut // (OUT) + ) +{ + + int nError; + + nError = 0; + /* Create the 'data' chunk that holds the waveform samples. */ + pckOut->ckid = mmioFOURCC('d', 'a', 't', 'a'); + pckOut->cksize = 0; + if ((nError = mmioCreateChunk(*phmmioOut, pckOut, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + if ((nError = mmioGetInfo(*phmmioOut, pmmioinfoOut, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; + } + + goto CLEANUP; +ERROR_CANNOT_WRITE: + +CLEANUP: + return(nError); +} + +/* This routine will write out data to a wave file. + hmmioOut - Handle to hmmioOut filled by WaveCreateFile + cbWrite - # of bytes to write out. + pbSrc - Pointer to source. + pckOut - pointer to ckOut filled by WaveCreateFile + cbActualWrite - # of actual bytes written. + pmmioinfoOut - Pointer to mmioinfoOut filled by WaveCreateFile. + + Returns 0 if successful, else the error code. + + */ + + +int WaveWriteFile( + HMMIO hmmioOut, // (IN) + UINT cbWrite, // (IN) + BYTE *pbSrc, // (IN) + MMCKINFO *pckOut, // (IN) + UINT *cbActualWrite, // (OUT) + MMIOINFO *pmmioinfoOut // (IN) + ) +{ + + + int nError; + UINT cT; + + nError = 0; + + *cbActualWrite = 0; + + for (cT=0; cT < cbWrite; cT++) + { + if (pmmioinfoOut->pchNext == pmmioinfoOut->pchEndWrite) + { + pmmioinfoOut->dwFlags |= MMIO_DIRTY; + if ((nError = mmioAdvance(hmmioOut, pmmioinfoOut, MMIO_WRITE)) != 0) + { + goto ERROR_CANNOT_WRITE; + } + } + *((BYTE*)pmmioinfoOut->pchNext)++ = *((BYTE*)pbSrc+cT); + (*cbActualWrite)++; + } + + +ERROR_CANNOT_WRITE: + // What to do here? Well, for now, nothing, just return that error. (maybe delete the + // file later? + + return(nError); + +} + + + +/* This routine will close a wave file used for writing. Returns 0 if successful, else + the error code. + phmmioOut - Pointer to mmio handle for saving. + pckOut - Pointer to the MMCKINFO for saving. + pckOutRiff - Pointer to the riff MMCKINFO for saving. + pmmioinfoOut- Pointer to mmioinfo for saving. + cSamples - # of samples saved, for the fact chunk. For PCM, this isn't used but + will be written anyway, so this can be zero as long as programs ignore + this field when they load PCM formats. + + + +*/ +int WaveCloseWriteFile( + HMMIO *phmmioOut, // (IN) + MMCKINFO *pckOut, // (IN) + MMCKINFO *pckOutRIFF, // (IN) + MMIOINFO *pmmioinfoOut, // (IN) + DWORD cSamples // (IN) + ) +{ + + int nError; + + nError = 0; + + if (*phmmioOut == NULL) + return(0); + + pmmioinfoOut->dwFlags |= MMIO_DIRTY; + if ((nError = mmioSetInfo(*phmmioOut, pmmioinfoOut, 0)) != 0) + { + // cannot flush, probably... + goto ERROR_CANNOT_WRITE; + } + + /* Ascend the output file out of the 'data' chunk -- this will cause + * the chunk size of the 'data' chunk to be written. + */ + if ((nError = mmioAscend(*phmmioOut, pckOut, 0)) != 0) + goto ERROR_CANNOT_WRITE; // cannot write file, probably + + + // Do this here instead... + if ((nError = mmioAscend(*phmmioOut, pckOutRIFF, 0)) != 0) + goto ERROR_CANNOT_WRITE; // cannot write file, probably + + + nError = mmioSeek(*phmmioOut, 0, SEEK_SET); + if ((nError = (int)mmioDescend(*phmmioOut, pckOutRIFF, NULL, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; + } + + nError = 0; + pckOut->ckid = mmioFOURCC('f', 'a', 'c', 't'); + if ((nError = mmioDescend(*phmmioOut, pckOut, pckOutRIFF, MMIO_FINDCHUNK)) == 0) + { + // If it didn't fail, write the fact chunk out, if it failed, not critical, just + // assert (below). + nError = mmioWrite(*phmmioOut, (HPSTR)&cSamples, sizeof(DWORD)); + nError = mmioAscend(*phmmioOut, pckOut, 0); + nError = 0; + } + else + { + nError = 0; + Assert(FALSE); + } + +// CANTWRITEFACT: + /* Ascend the output file out of the 'RIFF' chunk -- this will cause + * the chunk size of the 'RIFF' chunk to be written. + */ + if ((nError = mmioAscend(*phmmioOut, pckOutRIFF, 0)) != 0) + goto ERROR_CANNOT_WRITE; // cannot write file, probably + + + +ERROR_CANNOT_WRITE: + if (*phmmioOut != NULL) + { + mmioClose(*phmmioOut, 0); + *phmmioOut = NULL; + } + + return(nError); + +} + +/* This routine will copy from a source wave file to a destination wave file all those useless chunks + (well, the ones useless to conversions, etc --> apparently people use them!). The source will be + seeked to the begining, but the destination has to be at a current pointer to put the new chunks. + This will also seek back to the start of the wave riff header at the end of the routine. + + phmmioIn - Pointer to input mmio file handle. + pckIn - Pointer to a nice ckIn to use. + pckInRiff - Pointer to the main riff. + phmmioOut - Pointer to output mmio file handle. + pckOut - Pointer to nice ckOut to use. + pckOutRiff - Pointer to the main riff. + + + Returns 0 if successful, else the error code. If this routine fails, it still attemps to seek back to + the start of the wave riff header, though this too could be unsuccessful. +*/ + +int WaveCopyUselessChunks( + HMMIO *phmmioIn, + MMCKINFO *pckIn, + MMCKINFO *pckInRiff, + HMMIO *phmmioOut, + MMCKINFO *pckOut, + MMCKINFO *pckOutRiff) +{ + + int nError; + + nError = 0; + // First seek to the stinking start of the file, not including the riff header... + if ((nError = mmioSeek(*phmmioIn, pckInRiff->dwDataOffset + sizeof(FOURCC), SEEK_SET)) == -1) + { + nError = ER_CANNOTREAD; + goto ERROR_IN_PROC; + } + + nError = 0; + + while (mmioDescend(*phmmioIn, pckIn, pckInRiff, 0) == 0) + { + + // quickly check for corrupt RIFF file--don't ascend past end! + if ((pckIn->dwDataOffset + pckIn->cksize) > (pckInRiff->dwDataOffset + pckInRiff->cksize)) + goto ERROR_IN_PROC; + + switch (pckIn->ckid) + { + // explicitly skip these... + case mmioFOURCC('f', 'm', 't', ' '): + break; + + case mmioFOURCC('d', 'a', 't', 'a'): + break; + + case mmioFOURCC('f', 'a', 'c', 't'): + break; + + case mmioFOURCC('J', 'U', 'N', 'K'): + break; + + case mmioFOURCC('P', 'A', 'D', ' '): + break; + + case mmioFOURCC('c', 'u', 'e', ' '): + break; + + // copy chunks that are OK to copy + case mmioFOURCC('p', 'l', 's', 't'): + // although without the 'cue' chunk, it doesn't make much sense + riffCopyChunk(*phmmioIn, *phmmioOut, pckIn); + break; + + case mmioFOURCC('D', 'I', 'S', 'P'): + riffCopyChunk(*phmmioIn, *phmmioOut, pckIn); + break; + + + // don't copy unknown chunks + default: + break; + } + + + // step up to prepare for next chunk.. + mmioAscend(*phmmioIn, pckIn, 0); + } + +ERROR_IN_PROC: + { + int nErrorT; + // Seek back to riff header + nErrorT = mmioSeek(*phmmioIn, pckInRiff->dwDataOffset + sizeof(FOURCC), SEEK_SET); + } + + return(nError); +} + +/** BOOL RIFFAPI riffCopyChunk(HMMIO hmmioSrc, HMMIO hmmioDst, const LPMMCKINFO lpck) + * + * DESCRIPTION: + * + * + * ARGUMENTS: + * (LPWAVECONVCB lpwc, LPMMCKINFO lpck) + * + * RETURN (BOOL NEAR PASCAL): + * + * + * NOTES: + * + ** */ + +BOOL riffCopyChunk(HMMIO hmmioSrc, HMMIO hmmioDst, const LPMMCKINFO lpck) +{ + MMCKINFO ck; + HPSTR hpBuf; + + // + // + // + hpBuf = (HPSTR)GlobalAllocPtr(GHND, lpck->cksize); + if (!hpBuf) + return (FALSE); + + ck.ckid = lpck->ckid; + ck.cksize = lpck->cksize; + if (mmioCreateChunk(hmmioDst, &ck, 0)) + goto rscc_Error; + + if (mmioRead(hmmioSrc, hpBuf, lpck->cksize) != (LONG)lpck->cksize) + goto rscc_Error; + + if (mmioWrite(hmmioDst, hpBuf, lpck->cksize) != (LONG)lpck->cksize) + goto rscc_Error; + + if (mmioAscend(hmmioDst, &ck, 0)) + goto rscc_Error; + + if (hpBuf) + GlobalFreePtr(hpBuf); + + return (TRUE); + +rscc_Error: + + if (hpBuf) + GlobalFreePtr(hpBuf); + + return (FALSE); +} /* RIFFSupCopyChunk() */ + + + +/* This routine loads a full wave file into memory. Be careful, wave files can get + pretty big these days :). + szFileName - sz Filename + cbSize - Size of loaded wave (returned) + cSamples - # of samples loaded. + ppwfxInfo - Pointer to pointer to waveformatex structure. The wfx structure + IS ALLOCATED by this routine! Make sure to free it! + ppbData - Pointer to a byte pointer (globalalloc) which is allocated by this + routine. Make sure to free it! + + Returns 0 if successful, else the error code. +*/ + +int WaveLoadFile( + char *pszFileName, // (IN) + UINT *cbSize, // (OUT) + DWORD *pcSamples, // (OUT) + WAVEFORMATEX **ppwfxInfo, // (OUT) + BYTE **ppbData // (OUT) + ) +{ + + HMMIO hmmioIn; + MMCKINFO ckInRiff; + MMCKINFO ckIn; + int nError; + UINT cbActualRead; + + *ppbData = NULL; + *ppwfxInfo = NULL; + *cbSize = 0; + + if ((nError = WaveOpenFile(pszFileName, &hmmioIn, ppwfxInfo, &ckInRiff)) != 0) + { + goto ERROR_LOADING; + } + + if ((nError = WaveStartDataRead(&hmmioIn, &ckIn, &ckInRiff)) != 0) + { + goto ERROR_LOADING; + } + + // Ok, size of wave data is in ckIn, allocate that buffer. + if ((*ppbData = (BYTE *)GlobalAlloc(GMEM_FIXED, ckIn.cksize)) == NULL) + { + nError = ER_MEM; + goto ERROR_LOADING; + } + + if ((nError = WaveReadFile(hmmioIn, ckIn.cksize, *ppbData, &ckIn, &cbActualRead)) != 0) + { + goto ERROR_LOADING; + } + + *cbSize = cbActualRead; + goto DONE_LOADING; + +ERROR_LOADING: + if (*ppbData != NULL) + { + GlobalFree(*ppbData); + *ppbData = NULL; + } + if (*ppwfxInfo != NULL) + { + GlobalFree(*ppwfxInfo); + *ppwfxInfo = NULL; + } + +DONE_LOADING: + // Close the wave file. + if (hmmioIn != NULL) + { + mmioClose(hmmioIn, 0); + hmmioIn = NULL; + } + + return(nError); + +} + +/* This routine saves a wave file in currently in memory. + pszFileName - FileName to save to. Automatically overwritten, be careful! + cbSize - Size in bytes to write. + cSamples - # of samples to write, used to make the fact chunk. (if !PCM) + pwfxDest - Pointer to waveformatex structure. + pbData - Pointer to the data. +*/ + +int WaveSaveFile( + char *pszFileName, // (IN) + UINT cbSize, // (IN) + DWORD cSamples, // (IN) + WAVEFORMATEX *pwfxDest, // (IN) + BYTE *pbData // (IN) + ) +{ + + HMMIO hmmioOut; + MMCKINFO ckOut; + MMCKINFO ckOutRIFF; + MMIOINFO mmioinfoOut; + UINT cbActualWrite; + int nError; + + if ((nError = WaveCreateFile(pszFileName, &hmmioOut, pwfxDest, &ckOut, &ckOutRIFF)) != 0) + { + goto ERROR_SAVING; + } + + if ((nError = WaveStartDataWrite(&hmmioOut, &ckOut, &mmioinfoOut)) != 0) + { + goto ERROR_SAVING; + } + + if ((nError = WaveWriteFile(hmmioOut, cbSize, pbData, &ckOut, &cbActualWrite, &mmioinfoOut)) != 0) + { + goto ERROR_SAVING; + } + + if ((nError = WaveCloseWriteFile(&hmmioOut, &ckOut, &ckOutRIFF, &mmioinfoOut, cSamples)) != 0) + { + goto ERROR_SAVING; + } + +ERROR_SAVING: + + return(nError); + +} diff --git a/sdk/samples/dsshow/wave.h b/sdk/samples/dsshow/wave.h new file mode 100644 index 0000000..3e78e11 --- /dev/null +++ b/sdk/samples/dsshow/wave.h @@ -0,0 +1,56 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: wave.h + * Content: wave header + * + ***************************************************************************/ +#ifndef __WAVE_INCLUDED__ +#define __WAVE_INCLUDED__ +#include "windows.h" + +#define WAVEVERSION 1 + +#ifndef ER_MEM +#define ER_MEM 0xe000 +#endif + +#ifndef ER_CANNOTOPEN +#define ER_CANNOTOPEN 0xe100 +#endif + +#ifndef ER_NOTWAVEFILE +#define ER_NOTWAVEFILE 0xe101 +#endif + +#ifndef ER_CANNOTREAD +#define ER_CANNOTREAD 0xe102 +#endif + +#ifndef ER_CORRUPTWAVEFILE +#define ER_CORRUPTWAVEFILE 0xe103 +#endif + +#ifndef ER_CANNOTWRITE +#define ER_CANNOTWRITE 0xe104 +#endif + + + +int WaveOpenFile(char *, HMMIO *, WAVEFORMATEX **, MMCKINFO *); +int WaveStartDataRead(HMMIO *, MMCKINFO *, MMCKINFO *); +int WaveReadFile(HMMIO, UINT, BYTE *, MMCKINFO *, UINT *); +int WaveCloseReadFile(HMMIO *, WAVEFORMATEX **); + +int WaveCreateFile(char *, HMMIO *, WAVEFORMATEX *, MMCKINFO *, MMCKINFO *); +int WaveStartDataWrite(HMMIO *, MMCKINFO *, MMIOINFO *); +int WaveWriteFile(HMMIO, UINT, BYTE *, MMCKINFO *, UINT *, MMIOINFO *); +int WaveCloseWriteFile(HMMIO *, MMCKINFO *, MMCKINFO *, MMIOINFO *, DWORD); + +int WaveLoadFile(char *, UINT *, DWORD *, WAVEFORMATEX **, BYTE **); +int WaveSaveFile(char *, UINT, DWORD, WAVEFORMATEX *, BYTE *); + +int WaveCopyUselessChunks(HMMIO *, MMCKINFO *, MMCKINFO *, HMMIO *, MMCKINFO *, MMCKINFO *); +BOOL riffCopyChunk(HMMIO, HMMIO, const LPMMCKINFO); +#endif diff --git a/sdk/samples/dsshow3d/dblist.cpp b/sdk/samples/dsshow3d/dblist.cpp new file mode 100644 index 0000000..aea717f --- /dev/null +++ b/sdk/samples/dsshow3d/dblist.cpp @@ -0,0 +1,234 @@ +#include <windows.h> +#include "debug.h" + +template<class T> +DbLinkedList<T>::DbLinkedList() +{ + m_pTail = m_pHead = m_pCurrent = NULL; +} + + +template<class T> +DbLinkedList<T>::DbLinkedList( T emptyElt ) +{ + m_pTail = m_pHead = m_pCurrent = NULL; + m_emptyT = emptyElt; +} + + +template<class T> +DbLinkedList<T>::~DbLinkedList() +{ + Clear(); +} + + +template<class T> +void DbLinkedList<T>::Clear( void ) +{ + DblNode<T> *pTemp; + + while( m_nElementCount ) + { + pTemp = m_pHead->pNext; + delete m_pHead; + m_pHead = pTemp; + m_nElementCount--; + } + + m_pHead = m_pTail = m_pCurrent = NULL; +} + + +template<class T> +void DbLinkedList<T>::Remove( T val ) +{ + DblNode<T> *pTemp = m_pHead; + + while( pTemp ) + { + if( pTemp->value == val ) + { + if( pTemp->pNext ) + pTemp->pNext->pPrev = pTemp->pPrev; + if( pTemp->pPrev ) + pTemp->pPrev->pNext = pTemp->pNext; + if( m_pHead == pTemp ) + m_pHead = pTemp->pNext; + if( m_pTail == pTemp ) + m_pTail = pTemp->pPrev; + + delete pTemp; + + m_nElementCount--; + pTemp = NULL; + return; + } + + pTemp = pTemp->pNext; + } +} + +template<class T> +void DbLinkedList<T>::RemoveCurrent() +{ + if( m_pCurrent ) + { + ASSERT( m_nElementCount > 0 ); + + if( m_pCurrent->pNext ) + m_pCurrent->pNext->pPrev = m_pCurrent->pPrev; + if( m_pCurrent->pPrev ) + m_pCurrent->pPrev->pNext = m_pCurrent->pNext; + if( m_pHead == m_pCurrent ) + m_pHead = m_pCurrent->pNext; + if( m_pTail == m_pCurrent ) + m_pTail = m_pCurrent->pPrev; + + delete m_pCurrent; + + m_nElementCount--; + m_pCurrent = NULL; + } +} + +template<class T> +T DbLinkedList<T>::GetCurrent() +{ + if( m_pCurrent ) + { + ASSERT( m_nElementCount > 0 ); + + return m_pCurrent->value; + } + return m_emptyT; +} + +// TRUE == success, FALSE == failure +template<class T> +BOOL DbLinkedList<T>::InsertAfterCurrent( T val ) +{ + DbNode<T> *pTemp = new DbNode<T>; + + if( NULL == pTemp ) + return FALSE; + + if( NULL == m_pCurrent ) + { + AssertValid(); + if( NULL != m_pHead ) + { + pTemp->value = val; + pTemp->pPrev = m_pHead; + pTemp->pNext = m_pHead->pNext; + if( m_pHead->pNext ) + m_pHead->pNext->pPrev = pTemp; + if( m_pTail == m_pHead ) + m_pTail = pTemp; + } + } else { + pTemp->value = val; + pTemp->pPrev = m_pCurrent; + pTemp->pNext = m_pCurrent->pNext; + if( m_pCurrent->pNext ) + m_pCurrent->pNext->pPrev = pTemp; + // If we were pointing at the tail, we are no longer pointing + // at it because we put a new element after the current one. + if( m_pTail == m_pCurrent ) + m_pTail = pTemp; + } + + return TRUE; +} + + +// TRUE == success, FALSE == failure +template<class T> +BOOL DbLinkedList<T>::InsertBeforeCurrent( T val ) +{ + DbNode<T> *pTemp = new DbNode<T>; + + if( NULL == pTemp ) + return FALSE; + + if( NULL == m_pCurrent ) + { + AssertValid(); + if( NULL != m_pHead ) + { + pTemp->value = val; + pTemp->pPrev = m_pHead; + pTemp->pNext = m_pHead->pNext; + if( m_pHead->pNext ) + m_pHead->pNext->pPrev = pTemp; + if( m_pTail == m_pHead ) + m_pTail = pTemp; + } + } else { + pTemp->value = val; + pTemp->pPrev = m_pCurrent; + pTemp->pNext = m_pCurrent->pNext; + if( m_pCurrent->pNext ) + m_pCurrent->pNext->pPrev = pTemp; + // If we were pointing at the tail, we are no longer pointing + // at it because we put a new element after the current one. + if( m_pTail == m_pCurrent ) + m_pTail = pTemp; + } + + return TRUE; +} + + +template<class T> +void DbLinkedList<T>::Append( T val ) +{ + DblNode<T> *pNode = new DblNode<T>; + + if( NULL == pNode ) + return; + + AssertValid(); + + pNode->value = val; + pNode->pNext = NULL; + pNode->pPrev = m_pTail; + + if( m_pTail ) + m_pTail->pNext = pNode; + if( !m_pHead ) + m_pHead = pNode; + m_pTail = pNode; + m_nElementCount++; + + // If there were no elements in the list, the m_pCurrent will be NULL + if( NULL == m_pCurrent ) + { + ASSERT( m_nElementCount == 1 ); + m_pCurrent = m_pHead; + } +} + + +// Do some assertions that determine whether or not this object is in a valid +// state. If it's not, one of these will fire. +template<class T> +void DbLinkedList<T>::AssertValid( void ) +{ + if( m_nElementCount ) + { + // If there are elements, then both these pointers should point + // at a legitimate DbNode object, or the list is corrupted + ASSERT( NULL != m_pHead ); + ASSERT( NULL != m_pTail ); + ASSERT( NULL != m_pCurrent ); + } + else + { + ASSERT( NULL == m_pHead ); + ASSERT( NULL == m_pTail ); + ASSERT( NULL == m_pCurrent ); + } +} + + diff --git a/sdk/samples/dsshow3d/dblist.h b/sdk/samples/dsshow3d/dblist.h new file mode 100644 index 0000000..7ec574b --- /dev/null +++ b/sdk/samples/dsshow3d/dblist.h @@ -0,0 +1,78 @@ +#ifndef __DBLIST_H__ +#define __DBLIST_H__ + +#include "debug.h" + +#ifndef __cplusplus +#error DBList.h included from a C file! +#endif + +template<class A> +class DblNode +{ +friend class DbLinkedList<A>; + +private: + class DblNode<A> *pNext; + class DblNode<A> *pPrev; + + A value; +}; + +template <class T> +class DbLinkedList +{ +private: + +public: + DbLinkedList(); + DbLinkedList( T emptyElt ); + ~DbLinkedList(); + + inline void SetEmpty( T emptyElt ) { m_emptyT = emptyElt; } + + inline BOOL IsAtTail() { ASSERT( NULL != m_pCurrent ); + return (m_pCurrent->pNext == NULL); } + + void Clear( void ); + void RemoveCurrent(); + void Remove( T ); + BOOL InsertAfterCurrent( T val ); + BOOL InsertBeforeCurrent( T val ); + T GetCurrent(); + void Append( T ); + + inline void SetAtHead() { m_pCurrent = m_pHead; } + inline void SetAtTail() { m_pCurrent = m_pTail; } + + void AssertValid(); + + inline int GetElementCount( void ) { return m_nElementCount; } + + DbLinkedList<T> &operator++() + { if( m_pCurrent && m_pCurrent->pNext ) m_pCurrent = m_pCurrent->pNext; return *this; } + DbLinkedList<T> &operator++( int ) + { if( m_pCurrent && m_pCurrent->pNext ) m_pCurrent = m_pCurrent->pNext; return *this; } + DbLinkedList<T> &operator--() + { if( m_pCurrent && m_pCurrent->pPrev ) m_pCurrent = m_pCurrent->pPrev; return *this; } + DbLinkedList<T> &operator--( int ) + { if( m_pCurrent && m_pCurrent->pPrev ) m_pCurrent = m_pCurrent->pPrev; return *this; } + + +protected: + DblNode<T> *m_pHead; + DblNode<T> *m_pTail; + DblNode<T> *m_pCurrent; + + int m_nElementCount; + T m_emptyT; +}; + + +// Because of the way templates work, we must include the code from the +// header file. +#include "DbList.cpp" + + +#endif + diff --git a/sdk/samples/dsshow3d/debug.c b/sdk/samples/dsshow3d/debug.c new file mode 100644 index 0000000..c09c806 --- /dev/null +++ b/sdk/samples/dsshow3d/debug.c @@ -0,0 +1,413 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: debug.c + * Content: debug code + * + ***************************************************************************/ + +#include <windows.h> +#include <windowsx.h> +#include <stdarg.h> +#include <dsound.h> +#include "debug.h" + +#if defined(DEBUG) || defined(_DEBUG) + + +// +// since we don't UNICODE our debugging messages, use the ASCII entry +// points regardless of how we are compiled. +// +#ifdef _WIN32 + #include <wchar.h> +#else + #define lstrcatA lstrcat + #define lstrlenA lstrlen + #define GetProfileIntA GetProfileInt + #define OutputDebugStringA OutputDebugString + #define wsprintfA wsprintf + #define MessageBoxA MessageBox +#endif + +// +// +// +BOOL __gfDbgEnabled = TRUE; // master enable +UINT __guDbgLevel = 0; // current debug level + + +//--------------------------------------------------------------------------; +// +// void DbgVPrintF +// +// Description: +// +// +// Arguments: +// LPSTR szFormat: +// +// va_list va: +// +// Return (void): +// No value is returned. +// +//--------------------------------------------------------------------------; + +void FAR CDECL DbgVPrintF +( + LPSTR szFormat, + va_list va +) +{ + char ach[DEBUG_MAX_LINE_LEN]; + BOOL fDebugBreak = FALSE; + BOOL fPrefix = TRUE; + BOOL fCRLF = TRUE; + + ach[0] = '\0'; + + for (;;) + { + switch (*szFormat) + { + case '!': + fDebugBreak = TRUE; + szFormat++; + continue; + + case '`': + fPrefix = FALSE; + szFormat++; + continue; + + case '~': + fCRLF = FALSE; + szFormat++; + continue; + } + + break; + } + + if (fDebugBreak) + { + ach[0] = '\007'; + ach[1] = '\0'; + } + + if (fPrefix) + { + lstrcatA(ach, DEBUG_MODULE_NAME ": "); + } + +#ifdef _WIN32 + wvsprintfA(ach + lstrlenA(ach), szFormat, va); +#else + wvsprintf(ach + lstrlenA(ach), szFormat, (LPSTR)va); +#endif + + if (fCRLF) + { + lstrcatA(ach, "\r\n"); + } + + OutputDebugStringA(ach); + + if (fDebugBreak) + { + DebugBreak(); + } +} // DbgVPrintF() + + +//--------------------------------------------------------------------------; +// +// void dprintf +// +// Description: +// dprintf() is called by the DPF() macro if DEBUG is defined at compile +// time. It is recommended that you only use the DPF() macro to call +// this function--so you don't have to put #ifdef DEBUG around all +// of your code. +// +// Arguments: +// UINT uDbgLevel: +// +// LPSTR szFormat: +// +// Return (void): +// No value is returned. +// +//--------------------------------------------------------------------------; + +void FAR CDECL dprintf +( + UINT uDbgLevel, + LPSTR szFormat, + ... +) +{ + va_list va; + + if (!__gfDbgEnabled || (__guDbgLevel < uDbgLevel)) + return; + + va_start(va, szFormat); + DbgVPrintF(szFormat, va); + va_end(va); +} // dprintf() + + +//--------------------------------------------------------------------------; +// +// BOOL DbgEnable +// +// Description: +// +// +// Arguments: +// BOOL fEnable: +// +// Return (BOOL): +// Returns the previous debugging state. +// +//--------------------------------------------------------------------------; + +BOOL WINAPI DbgEnable +( + BOOL fEnable +) +{ + BOOL fOldState; + + fOldState = __gfDbgEnabled; + __gfDbgEnabled = fEnable; + + return (fOldState); +} // DbgEnable() + + +//--------------------------------------------------------------------------; +// +// UINT DbgSetLevel +// +// Description: +// +// +// Arguments: +// UINT uLevel: +// +// Return (UINT): +// Returns the previous debugging level. +// +//--------------------------------------------------------------------------; + +UINT WINAPI DbgSetLevel +( + UINT uLevel +) +{ + UINT uOldLevel; + + uOldLevel = __guDbgLevel; + __guDbgLevel = uLevel; + + return (uOldLevel); +} // DbgSetLevel() + + +//--------------------------------------------------------------------------; +// +// UINT DbgGetLevel +// +// Description: +// +// +// Arguments: +// None. +// +// Return (UINT): +// Returns the current debugging level. +// +//--------------------------------------------------------------------------; + +UINT WINAPI DbgGetLevel +( + void +) +{ + return (__guDbgLevel); +} // DbgGetLevel() + + +//--------------------------------------------------------------------------; +// +// UINT DbgInitialize +// +// Description: +// +// +// Arguments: +// BOOL fEnable: +// +// Return (UINT): +// Returns the debugging level that was set. +// +//--------------------------------------------------------------------------; + +UINT WINAPI DbgInitialize +( + BOOL fEnable +) +{ + UINT uLevel; + + uLevel = GetProfileIntA(DEBUG_SECTION, DEBUG_MODULE_NAME, (UINT)-1); + if ((UINT)-1 == uLevel) + { + // + // if the debug key is not present, then force debug output to + // be disabled. this way running a debug version of a component + // on a non-debugging machine will not generate output unless + // the debug key exists. + // + uLevel = 0; + fEnable = FALSE; + } + + DbgSetLevel(uLevel); + DbgEnable(fEnable); + + return (__guDbgLevel); +} // DbgInitialize() + + +//--------------------------------------------------------------------------; +// +// void _Assert +// +// Description: +// This routine is called if the ASSERT macro (defined in debug.h) +// tests and expression that evaluates to FALSE. This routine +// displays an "assertion failed" message box allowing the user to +// abort the program, enter the debugger (the "retry" button), or +// ignore the assertion and continue executing. The message box +// displays the file name and line number of the _Assert() call. +// +// Arguments: +// char * szFile: Filename where assertion occurred. +// int iLine: Line number of assertion. +// +//--------------------------------------------------------------------------; + +#ifndef _WIN32 +#pragma warning(disable:4704) +#endif + +void WINAPI _Assert +( + char * szFile, + int iLine +) +{ + static char ach[300]; // debug output (avoid stack overflow) + int id; +#ifndef _WIN32 + int iExitCode; +#endif + + wsprintfA(ach, "Assertion failed in file %s, line %d. [Press RETRY to debug.]", (LPSTR)szFile, iLine); + + id = MessageBoxA(NULL, ach, "Assertion Failed", + MB_SYSTEMMODAL | MB_ICONHAND | MB_ABORTRETRYIGNORE ); + + switch (id) + { + + case IDABORT: // Kill the application. +#ifndef _WIN32 + iExitCode = 0; + _asm + { + mov ah, 4Ch + mov al, BYTE PTR iExitCode + int 21h + } +#else + FatalAppExit(0, TEXT("Good Bye")); +#endif // WIN16 + break; + + case IDRETRY: // Break into the debugger. + DebugBreak(); + break; + + case IDIGNORE: // Ignore assertion, continue executing. + break; + } +} // _Assert + +#ifndef _WIN32 +#pragma warning(default:4704) +#endif + +#endif // #if defined(DEBUG) || defined(_DEBUG) + +// Silly little function gives meaningful error messages from HRESULT's +LPSTR TranslateDSError( HRESULT hr ) + { + switch( hr ) + { + case DSERR_ALLOCATED: + return "DSERR_ALLOCATED"; + + case DSERR_CONTROLUNAVAIL: + return "DSERR_CONTROLUNAVAIL"; + + case DSERR_INVALIDPARAM: + return "DSERR_INVALIDPARAM"; + + case DSERR_INVALIDCALL: + return "DSERR_INVALIDCALL"; + + case DSERR_GENERIC: + return "DSERR_GENERIC"; + + case DSERR_PRIOLEVELNEEDED: + return "DSERR_PRIOLEVELNEEDED"; + + case DSERR_OUTOFMEMORY: + return "DSERR_OUTOFMEMORY"; + + case DSERR_BADFORMAT: + return "DSERR_BADFORMAT"; + + case DSERR_UNSUPPORTED: + return "DSERR_UNSUPPORTED"; + + case DSERR_NODRIVER: + return "DSERR_NODRIVER"; + + case DSERR_ALREADYINITIALIZED: + return "DSERR_ALREADYINITIALIZED"; + + case DSERR_NOAGGREGATION: + return "DSERR_NOAGGREGATION"; + + case DSERR_BUFFERLOST: + return "DSERR_BUFFERLOST"; + + case DSERR_OTHERAPPHASPRIO: + return "DSERR_OTHERAPPHASPRIO"; + + case DSERR_UNINITIALIZED: + return "DSERR_UNINITIALIZED"; + + default: + return "Unknown HRESULT"; + } + } + + diff --git a/sdk/samples/dsshow3d/debug.h b/sdk/samples/dsshow3d/debug.h new file mode 100644 index 0000000..74b8472 --- /dev/null +++ b/sdk/samples/dsshow3d/debug.h @@ -0,0 +1,88 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: debug.h + * Content: debug header + * + ***************************************************************************/ +#ifndef __DEBUG_INCLUDED__ +#define __DEBUG_INCLUDED__ +#ifdef __cplusplus +extern "C" +{ +#endif + +LPSTR TranslateDSError( HRESULT ); + +// +// +// +// +#ifdef DEBUG + #define DEBUG_SECTION "Debug" // section name for + #define DEBUG_MODULE_NAME "DSSHOW3D" // key name and prefix for output + #define DEBUG_MAX_LINE_LEN 255 // max line length (bytes!) +#endif + + +// +// based code makes since only in win 16 (to try and keep stuff out of +// [fixed] data segments, etc)... +// +#ifndef BCODE +#ifdef _WIN32 + #define BCODE +#else + #define BCODE _based(_segname("_CODE")) +#endif +#endif + + + + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +#if defined(DEBUG) || defined(_DEBUG) + BOOL WINAPI DbgEnable(BOOL fEnable); + UINT WINAPI DbgGetLevel(void); + UINT WINAPI DbgSetLevel(UINT uLevel); + UINT WINAPI DbgInitialize(BOOL fEnable); + void WINAPI _Assert( char * szFile, int iLine ); + + void FAR CDECL dprintf(UINT uDbgLevel, LPSTR szFmt, ...); + + #define D(x) {x;} + #define DPF dprintf + #define DPI(sz) {static char BCODE ach[] = sz; OutputDebugStr(ach);} + #define ASSERT(x) if( !(x) ) _Assert( __FILE__, __LINE__) +#else + #define DbgEnable(x) FALSE + #define DbgGetLevel() 0 + #define DbgSetLevel(x) 0 + #define DbgInitialize(x) 0 + + #ifdef _MSC_VER + #pragma warning(disable:4002) + #endif + + #define D(x) + #define DPF() + #define DPI(sz) + #define ASSERT(x) +#endif + +#if defined(DEBUG) || defined(_DEBUG) +#define ASSERT_HWND( h ) ASSERT( IsWindow((h)) ) +#else +#define ASSERT_HWND( h ) ASSERT( NULL != (h) ) +#endif + +#ifdef __cplusplus +} +#endif +#endif // __DEBUG_INCLUDED__ diff --git a/sdk/samples/dsshow3d/dsenum.c b/sdk/samples/dsshow3d/dsenum.c new file mode 100644 index 0000000..ad17062 --- /dev/null +++ b/sdk/samples/dsshow3d/dsenum.c @@ -0,0 +1,142 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: dstrenum.c + * Content: Illustrates enumerating DirectSound drivers + * + ***************************************************************************/ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <dsound.h> +#include <memory.h> + +#include "dsenum.h" +#include "resource.h" + +extern HINSTANCE ghInst; +extern HWND hWndMain; + + + +/****************************************************************************/ +/* DoDSoundEnumerate() */ +/* */ +/* This function takes care of handling the DirectSound enumeration, which*/ +/* simply means creating a dialog box, at this point... */ +/****************************************************************************/ +BOOL DoDSoundEnumerate( LPGUID lpGUID ) + { + if( DialogBoxParam( ghInst, MAKEINTRESOURCE(IDD_DSENUMBOX), hWndMain, + DSEnumDlgProc, (LPARAM)lpGUID )) + return( TRUE ); + + return( FALSE ); + } + +/****************************************************************************/ +/* DSEnumDlgProc() */ +/* */ +/* Dialog procedure for the DSound enumeration choice dialog. Allows the */ +/* user to choose from installed drivers. Returns TRUE on error. */ +/****************************************************************************/ +BOOL CALLBACK DSEnumDlgProc( HWND hDlg, UINT msg, + WPARAM wParam, LPARAM lParam ) + { + static HWND hCombo; + static LPGUID lpGUID; + LPGUID lpTemp; + int i; + + switch( msg ) + { + case WM_INITDIALOG: + hCombo = GetDlgItem( hDlg, IDC_DSENUM_COMBO ); + lpGUID = (LPGUID)lParam; + + if( DirectSoundEnumerate( (LPDSENUMCALLBACK)DSEnumProc, &hCombo ) != DS_OK ) + { + EndDialog( hDlg, TRUE ); + return( TRUE ); + } + if( ComboBox_GetCount( hCombo )) + ComboBox_SetCurSel( hCombo, 0 ); + else + { + EndDialog( hDlg, TRUE ); + return( TRUE ); + } + return( TRUE ); + + + case WM_COMMAND: + switch( LOWORD( wParam )) + { + case IDOK: + for( i = 0; i < ComboBox_GetCount( hCombo ); i++ ) + { + lpTemp = (LPGUID)ComboBox_GetItemData( hCombo, i ); + if( i == ComboBox_GetCurSel( hCombo )) + { + if( lpTemp != NULL ) + memcpy( lpGUID, lpTemp, sizeof(GUID)); + else + lpGUID = NULL; + } + if( lpTemp ) + LocalFree( lpTemp ); + } + // If we got the NULL GUID, then we want to open the default + // sound driver, so return with an error and the init code + // will know not to pass in the guID and will send NULL + // instead. + if( lpGUID == NULL ) + EndDialog( hDlg, TRUE ); + else + EndDialog( hDlg, FALSE ); + return( TRUE ); + + case IDCANCEL: + // Force a NULL GUID + EndDialog( hDlg, TRUE ); + return( TRUE ); + } + break; + + + default: + return( FALSE ); + } + + return( FALSE ); + } + + +/****************************************************************************/ +/* DSEnumProc() */ +/* */ +/* This is the Enumeration procedure called by DirectSoundEnumerate with */ +/* the parameters of each DirectSound Object available in the system. */ +/****************************************************************************/ +BOOL CALLBACK DSEnumProc( LPGUID lpGUID, LPSTR lpszDesc, + LPSTR lpszDrvName, LPVOID lpContext ) + { + HWND hCombo = *(HWND *)lpContext; + LPGUID lpTemp = NULL; + + if( lpGUID != NULL ) + { + if(( lpTemp = LocalAlloc( LPTR, sizeof(GUID))) == NULL ) + return( TRUE ); + + memcpy( lpTemp, lpGUID, sizeof(GUID)); + } + + ComboBox_AddString( hCombo, lpszDesc ); + ComboBox_SetItemData( hCombo, + ComboBox_FindString( hCombo, 0, lpszDesc ), + lpTemp ); + return( TRUE ); + } diff --git a/sdk/samples/dsshow3d/dsenum.h b/sdk/samples/dsshow3d/dsenum.h new file mode 100644 index 0000000..24cd829 --- /dev/null +++ b/sdk/samples/dsshow3d/dsenum.h @@ -0,0 +1,32 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: dsenum.h + * Content: Direct Sound Enumeration defines + * + * + ***************************************************************************/ + +#ifndef __DSENUM_INCLUDED__ +#define __DSENUM_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +// Function declarations + +BOOL DoDSoundEnumerate( LPGUID ); + +BOOL CALLBACK DSEnumProc( LPGUID, LPSTR, LPSTR, LPVOID ); +BOOL CALLBACK DSEnumDlgProc( HWND, UINT, WPARAM, LPARAM ); + + +#ifdef __cplusplus +}; +#endif + + +#endif + diff --git a/sdk/samples/dsshow3d/dsshow3d.cpp b/sdk/samples/dsshow3d/dsshow3d.cpp new file mode 100644 index 0000000..a02a8ed --- /dev/null +++ b/sdk/samples/dsshow3d/dsshow3d.cpp @@ -0,0 +1,1384 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: DSShow3d.c + * Content: Direct Sound show-off, including 3D Sound. + * + * + ***************************************************************************/ + +//#pragma warning( disable: 4102 4101 ) + +#define INITGUID +#include <windows.h> +#include <windowsx.h> +#include <commctrl.h> +#include <commdlg.h> +#include <cguid.h> + +#include <mmsystem.h> +#include <mmreg.h> +#include <msacm.h> +#include <dsound.h> + +#include "DSShow3D.h" +#define INIT_GVARS +#include "GVars.h" + +#include "MainWnd.h" +#include "FileInfo.h" + +#include "wave.h" +#include "debug.h" + +static char szOpenStartDir[MAX_PATH]; + +// Format codes used to compactly represent each possible output format +// +// The code is: FFCBB where... +// +// FF -> Frequency 8=8000, 11=11025, 22=22050, 44=44100 +// C -> # of channels (1 or 2) +// BB -> Bits 08 is 8-bit, 16 is 16-bit +// +// Use the FormatCodeToWFX() function to set a WAVEFORMATEX structure +// based on a format code, or FormatCodeToText() to get a text string +// representing the format. +// + +#define FC_GETFREQCODE(fc) ((fc) / 1000) +#define FC_GETBITS(fc) ((fc) % 100) +#define FC_GETCHANNELS(fc) (((fc) % 1000) / 100) + +// Functions limited in scope to this file + +static BOOL InitializeDSound( void ); +static void FreeDSound( void ); +static BOOL InitInstance( HINSTANCE, LPSTR, int ); +static BOOL InitPrimarySoundBuffer( void ); +static void GetMediaPath( LPSTR, int ); +static BOOL LoadRegistrySettings( void ); +static BOOL SaveRegistrySettings( void ); +static BOOL ParseCommandLine( LPSTR lpszCmdLine ); +static BOOL fMatchToken( PSTR pszString, PSTR pszDatum, int cchLen ); +static BOOL fGetToken( PSTR pszStart, PSTR *ppszRet, int *pcchRet ); + + +/* InitializeDSound() + * + * Initialize the DirectSound object and other stuff we'll use like the + * primary buffer and 3D listener object. + */ +BOOL InitializeDSound( void ) + { + HRESULT hr; + + hr = CoCreateInstance( CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER, + IID_IDirectSound, (void**)&gpds ); + + if (FAILED(hr) || (NULL == gpds)) + { + DPF( 0, "Could not create a DSound object (%s)", TranslateDSError(hr)); + MessageBox( AppWnd.GetHwnd(), "Unable to get a DirectSound object", + "COM Failure", MB_OK | MB_ICONSTOP ); + goto ID_ExitError; + } + DPF( 2, "Got an IDirectSound object" ); + + if( grs.fDefaultDevice ) + { + DPF( 2, "Using default device as first choice" ); + hr = gpds->Initialize( &GUID_NULL ); + } + else + { + if( FAILED( hr = gpds->Initialize( &grs.guPreferredDevice ))) + { + DPF( 0, "Initialize failed on preferred device, using default" ); + if( IDNO == MessageBox( GetActiveWindow(), + "Unable to use preferred device. Use default instead?", + gszAppName, MB_YESNO )) + { + DPF( 2, "User chose not to use default device instead" ); + goto ID_ExitReleaseDS; + } + else + { + DPF( 2, "Falling back to default device" ); + hr = gpds->Initialize( &GUID_NULL ); + } + } + } + if (FAILED(hr)) + { + DPF( 0, "Failed Initialize() on IDirectSound object (%s)", TranslateDSError(hr)); + MessageBox( AppWnd.GetHwnd(), "Could not initialize DirectSound object", + gszAppName, MB_OK | MB_ICONSTOP ); + goto ID_ExitReleaseDS; + } + + if( grs.fUseExclusiveMode ) + { + hr = gpds->SetCooperativeLevel( AppWnd.GetHwnd(), DSSCL_EXCLUSIVE); + DPF( 3, "Received DSSCL_EXCLUSIVE" ); + } + else + { + hr = gpds->SetCooperativeLevel( AppWnd.GetHwnd(), DSSCL_PRIORITY); + DPF( 3, "Received DSSCL_PRIORITY" ); + } + if (FAILED(hr)) + { + DPF( 0, "Couldn't SetCooperativeLevel() (%s)", TranslateDSError(hr)); + MessageBox( AppWnd.GetHwnd(), "Could not SetCooperativeLevel()", + gszAppName, MB_OK | MB_ICONSTOP ); + goto ID_ExitReleaseDS; + } + + DPF( 3, "Creating Primary Buffer" ); + + if( !InitPrimarySoundBuffer()) + { + DPF( 0, "Failed on call to InitPrimarySoundBuffer()" ); + goto ID_ExitReleaseDS; + } + + // Return SUCCESS + return TRUE; + +ID_ExitReleaseDS: + // The InitPrimarySoundBuffer() call should have cleaned up + // after itself if it failed + + ASSERT( NULL == gp3DListener ); + ASSERT( NULL == gpdsbPrimary ); + + if( NULL != gpds ) + { + gpds->Release(); + gpds = NULL; + } + +ID_ExitError: + return FALSE; + } + + +void FreeDSound() + { + if( NULL != gpdsbPrimary ) + { + gpdsbPrimary->Stop(); + gpdsbPrimary->Release(); + gpdsbPrimary = NULL; + } + if( NULL != gp3DListener ) + { + gp3DListener->Release(); + gp3DListener = NULL; + } + if( NULL != gpds ) + { + gpds->Release(); + gpds = NULL; + } + } + + +/* InitInstance() + * + * This function is responsible for all initialization that must occur + * when a new instance of our application is started. + */ +BOOL InitInstance( HINSTANCE hInstance, LPSTR lpszCommandLine, int cmdShow ) + { + WNDCLASS myClass; + + myClass.hCursor = LoadCursor(NULL, IDC_ARROW); + myClass.hIcon = LoadIcon( hInstance, MAKEINTRESOURCE(IDI_SPEAKER_RGB_3D)); + myClass.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU); + myClass.lpszClassName = (LPSTR)gszAppWndClass; + myClass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1); + myClass.hInstance = hInstance; + myClass.style = CS_HREDRAW | CS_VREDRAW; + myClass.lpfnWndProc = MainWndProc; + myClass.cbClsExtra = 0; + myClass.cbWndExtra = 0; + + if (!RegisterClass( &myClass )) + return FALSE; + + // Load the current registry settings + LoadRegistrySettings(); + gdwOutputFormat = grs.dwPreferredFormat; + + if( !AppWnd.Create()) + goto II_ExitError; + + AppWnd.ShowWindow( cmdShow ); + AppWnd.UpdateWindow(); + + /* Continue doing other initialization stuff */ + + // Setup the timer... + if ((gdwTimer = SetTimer(AppWnd.GetHwnd(), 1, TIMERPERIOD, NULL)) == 0) + { + MessageBox(AppWnd.GetHwnd(), "Cannot allocate timer, aborting", gszAppCaption, + MB_OK|MB_ICONSTOP); + goto II_ExitError; + } + + // Get the largest waveformatex structure. + if (MMSYSERR_NOERROR != acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FORMAT, + &gcbMaxWaveFormatSize)) + { + MessageBox(AppWnd.GetHwnd(), "ACM Metrics failed, aborting", gszAppCaption, + MB_OK|MB_ICONSTOP); + goto II_ExitError; + } + + // Initialize the COM subsystem and create our DirectSound stuff + + if (!SUCCEEDED(CoInitialize(NULL))) + { + MessageBox( AppWnd.GetHwnd(), "Failed to initialize COM library", + gszAppCaption, MB_OK | MB_ICONSTOP); + goto II_ExitError; + } + else + gfCOMInitialized = TRUE; + + // Initialize the DirectSound global interfaces + if( !InitializeDSound()) + goto II_ExitShutdownCOM; + + if( !ParseCommandLine( lpszCommandLine )) + goto II_ExitFreeDSound; + + return TRUE; // TRUE indicates success + + +II_ExitFreeDSound: + FreeDSound(); + +II_ExitShutdownCOM: + if( gfCOMInitialized ) + { + DPF( 0, "Calling CoUninitialize from InitInstance error cleanup" ); + CoUninitialize(); + } + +II_ExitError: + + return FALSE; // FALSE indicates failure on initialization + } // InitInstance() + + +/* WinMain() + * + * Main entry point for this program's execution. Everything starts here. + */ +int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpszCmdLine, int cmdShow) + { + MSG msg; + + DbgInitialize( TRUE ); + + InitCommonControls(); + + // Save instance handle + ghInst = hInstance; + + if (!InitInstance(hInstance, lpszCmdLine, cmdShow)) + return 0; + + /* Polling messages from event queue */ + while (GetMessage((LPMSG)&msg, NULL, 0, 0)) + { + // Only Translate and Dispatch the message if it's not going + // to one of our many modeless dialog windows + if( !IsDialogMessage( ghwndListener, &msg ) + && (NULL == ghDlgActive || !IsDialogMessage( ghDlgActive, &msg ))) + { + TranslateMessage((LPMSG)&msg); + DispatchMessage((LPMSG)&msg); + } + } + + UnregisterClass(gszAppWndClass, hInstance); + return (int)msg.wParam; + } // WinMain() + + +/* InitPrimarySoundBuffer() + * + * Creates and initializes the primary sound buffer for the application. + * We need the primary buffer in order to get the 3D listener interface and + * also to select output format type. + */ +BOOL InitPrimarySoundBuffer( void ) + { + HRESULT hr; + DSBUFFERDESC dsbd; + int nCurFormat; + + ZeroMemory( &dsbd, sizeof(DSBUFFERDESC)); + + gpwfxFormat = new WAVEFORMATEX; + if( NULL == gpwfxFormat ) + return FALSE; + + ZeroMemory( gpwfxFormat, sizeof(WAVEFORMATEX)); + + gpwfxFormat->wFormatTag = WAVE_FORMAT_PCM; + + FormatCodeToWFX( gdwOutputFormat, gpwfxFormat ); + DPF( 2, "Initial format code: %lu", gdwOutputFormat ); + + dsbd.dwSize = sizeof(DSBUFFERDESC); + dsbd.dwFlags = DSBCAPS_CTRL3D | DSBCAPS_PRIMARYBUFFER; + + if( FAILED( hr = gpds->CreateSoundBuffer( &dsbd, &gpdsbPrimary, NULL ))) + { + DPF( 0, "Couldn't create primary buffer (%s)", TranslateDSError(hr)); + goto IPSB_ExitError; + } + + if( FAILED( hr = gpdsbPrimary->SetFormat( gpwfxFormat ))) + { + DisableFormatCode( gdwOutputFormat ); + + // If we couldn't load the desired format, then try everything starting + // at really high quality, and degrading to 8M8 (yuck) + nCurFormat = 0; + DPF( 2, "Unable to SetFormat() preferred format to %lu", gdwOutputFormat ); + + while( FAILED( hr ) && nCurFormat < NUM_FORMATENTRIES ) + { + gdwOutputFormat = aFormatOrder[nCurFormat]; + FormatCodeToWFX( gdwOutputFormat, gpwfxFormat ); + DPF( 2, "Trying format code: %lu", gdwOutputFormat ); + + hr = gpdsbPrimary->SetFormat( gpwfxFormat ); + if( FAILED(hr)) + { + DisableFormatCode( gdwOutputFormat ); + DPF( 2, "Return from SetFormat on primary buffer = %s", TranslateDSError(hr)); + } + else + { + EnableFormatCode( gdwOutputFormat ); + DPF( 2, "Succeeded on SetFormat() for code %lu", gdwOutputFormat ); + } + + nCurFormat++; + } + } + if( FAILED( hr )) + { + DPF( 0, "Failed SetFormat() on all formats!" ); + goto IPSB_ExitError; + } + + if( FAILED( hr = gpdsbPrimary->QueryInterface( IID_IDirectSound3DListener, + (void**)&gp3DListener))) + { + DPF( 0, "Couldn't QI primary buffer for 3D listener interface (%s)", TranslateDSError(hr)); + goto IPSB_ExitError; + } + if( FAILED( hr = gpdsbPrimary->Play( 0, 0, DSBPLAY_LOOPING ))) + { + DPF( 0, "Couldn't play primary buffer (%s)", TranslateDSError(hr)); + goto IPSB_ExitRelease; + } + + return TRUE; + +IPSB_ExitRelease: + if( gp3DListener ) + { + DPF( 0, "Releasing 3D Listener in InitPrimarySoundBuffer() error cleanup" ); + gp3DListener->Release(); + gp3DListener = NULL; + } + if( gpdsbPrimary ) + { + DPF( 0, "Releasing Primary in InitPrimarySoundBuffer() error cleanup" ); + gpdsbPrimary->Stop(); + gpdsbPrimary->Release(); + gpdsbPrimary = NULL; + } + +IPSB_ExitError: + return FALSE; + } + + +/* This will pop up the open file dialog and allow the user to pick one file. + + Input: + hWnd - Handle of parent window. + pszFileName - String to store filename in, must be >= MAX_PATH long. + + + Output: + TRUE if a file was picked successfully or FALSE if the user didn't + pick a file) + + */ +BOOL OpenFileDialog( HWND hWnd, LPSTR pszFileName, + int *nFileName, LPDWORD lpdwFlags ) + { + BOOL fReturn, + fValid; + OPENFILENAME ofn; + + pszFileName[0] = 0; + + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = hWnd; + ofn.hInstance = ghInst; + ofn.lpstrFilter = "Wave Files\0*.wav\0All Files\0*.*\0\0"; + ofn.lpstrCustomFilter = NULL; + ofn.nMaxCustFilter = 0; + ofn.nFilterIndex = 1; + ofn.lpstrFile = pszFileName; + ofn.nMaxFile = MAX_PATH; + ofn.lpstrFileTitle = NULL; + ofn.nMaxFileTitle = 0; + ofn.lpstrInitialDir = grs.szInitialDir; + ofn.lpstrTitle = "File Open"; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_EXPLORER + | OFN_ENABLETEMPLATE | OFN_ENABLEHOOK + | OFN_HIDEREADONLY; + ofn.nFileOffset = 0; + ofn.nFileExtension = 0; + ofn.lpstrDefExt = "wav"; + ofn.lCustData = (LONG)lpdwFlags; + ofn.lpfnHook = FileOpenCustomTemplateDlgProc; + ofn.lpTemplateName = MAKEINTRESOURCE(IDD_FILEOPEN_NEST); + + fValid = FALSE; + do + { + if( fReturn = GetOpenFileName( &ofn )) + { + fValid = IsValidWave( pszFileName ); + if( !fValid ) + MessageBox( hWnd, "Wave files must be PCM format!", + "Invalid Wave File", MB_OK|MB_ICONSTOP ); + else + *nFileName = ofn.nFileOffset; + } + else + fValid = TRUE; // Force break out of loop. + } while( !fValid ); + + return fReturn; + } + +/* + * + * +This function will determine if the filename passed + in is a valid wave for this + app, that is a PCM wave. + + Input: + pszFileName - FileName to check. + + Output: + FALSE if not a valid wave, TRUE if it is. + +*/ +BOOL IsValidWave( LPSTR pszFileName ) + { + BOOL fReturn = FALSE; + int nError = 0; + HMMIO hmmio; + MMCKINFO mmck; + WAVEFORMATEX *pwfx; + + if ((nError = WaveOpenFile(pszFileName, &hmmio, &pwfx, &mmck)) != 0) + { + goto ERROR_IN_ROUTINE; + } + + if (pwfx->wFormatTag != WAVE_FORMAT_PCM) + { + goto ERROR_IN_ROUTINE; + } + + WaveCloseReadFile(&hmmio, &pwfx); + + fReturn = TRUE; + +ERROR_IN_ROUTINE: + return fReturn; + } + + +/* AboutDlgProc() + * + * Standard dialog procedure for the About box. As simple as can be. + */ +BOOL CALLBACK AboutDlgProc( HWND hWnd, UINT uMsg, + WPARAM wParam, LPARAM lParam ) + { + switch(uMsg) + { + case WM_INITDIALOG: + break; + + case WM_COMMAND: + switch(wParam) + { + case ID_OK: + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; + + default: + break; + + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + + default: + return FALSE; + break; + + } + + return TRUE; +} + + +/* FileOpenCustomTemplateDlgProc() + * + * This "hook procedure" is called by the common dialog code for certain + * events that may occur during the life of our nested dialog structure. + * We nest the Explorer style dialog inside our file open dialog so we + * can add a check box for stick buffers. + */ +UINT CALLBACK FileOpenCustomTemplateDlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) + { + static LPOPENFILENAME lpofn = NULL; + static HWND hStickyRadio, h3DCheck, hLocalRadio, hGlobalRadio; + static HWND hGetPosRadio, hGetPos2Radio; + + switch( message ) + { + case WM_INITDIALOG: + lpofn = (LPOPENFILENAME)lParam; + + h3DCheck = GetDlgItem( hDlg, IDC_FONEST_3D ); + hLocalRadio = GetDlgItem( hDlg, IDC_FONEST_LOCAL_RADIO ); + hStickyRadio = GetDlgItem( hDlg, IDC_FONEST_STICKY_RADIO ); + hGlobalRadio = GetDlgItem( hDlg, IDC_FONEST_GLOBAL_RADIO ); + hGetPosRadio = GetDlgItem( hDlg, IDC_FONEST_GETPOS_RADIO ); + hGetPos2Radio = GetDlgItem( hDlg, IDC_FONEST_GETPOS2_RADIO ); + + Button_SetCheck( hGetPos2Radio, TRUE ); + + if( grs.dwDefaultFocusFlag & DSBCAPS_STICKYFOCUS ) + Button_SetCheck( hStickyRadio, TRUE ); + else if( grs.dwDefaultFocusFlag & DSBCAPS_GLOBALFOCUS ) + Button_SetCheck( hGlobalRadio, TRUE ); + else + { + ASSERT( grs.dwDefaultFocusFlag == 0 ); + Button_SetCheck( hLocalRadio, TRUE ); + } + + Button_SetCheck( h3DCheck, grs.fOpen3D ); + + *((LPDWORD)lpofn->lCustData) = 0; + + return TRUE; + + + case WM_NOTIFY: + switch(((LPOFNOTIFY)lParam)->hdr.code) + { + case CDN_SELCHANGE: + /* Use this area to process anything that must be updated when the + * user changes the selection in the Common Dialog Box. + * NOTE: Provided only for informational purposes + */ + return FALSE; + + case CDN_FILEOK: + /* We can do lots of things in this notification message. The most + * important is that we can decide whether the Common Dialog call + * will go through or whether it will fail. I decided to handle + * the checkbox control in this one place versus 4 others... + */ + ASSERT( lpofn != NULL ); + /* Set flags to match the current state of the check box controls */ + + /* Use normal GetPosition */ + *((LPDWORD)lpofn->lCustData) |= + Button_GetCheck(hGetPosRadio)? OPENFILENAME_F_GETPOS : 0; + /* Use DSBCAPS_GETCURRENTPOSITION2 */ + *((LPDWORD)lpofn->lCustData) |= + Button_GetCheck(hGetPos2Radio)? OPENFILENAME_F_GETPOS2 : 0; + + /* Local buffer focus */ + *((LPDWORD)lpofn->lCustData) |= + Button_GetCheck(hStickyRadio)? OPENFILENAME_F_LOCALFOCUS : 0; + /* Sticky buffer focus */ + *((LPDWORD)lpofn->lCustData) |= + Button_GetCheck(hStickyRadio)? OPENFILENAME_F_STICKYFOCUS : 0; + /* Global sound focus */ + *((LPDWORD)lpofn->lCustData) |= + Button_GetCheck(hGlobalRadio)? OPENFILENAME_F_GLOBALFOCUS : 0; + /* 3D Buffer */ + *((LPDWORD)lpofn->lCustData) |= + Button_GetCheck(h3DCheck)? OPENFILENAME_F_3D : 0; + /* Returning zero signifies that we "approve" of the OK command, + * and allows the common dialog to finish. + */ + return FALSE; + } + /* Let the default dialog do/continue processing */ + return FALSE; + } + return FALSE; +} + + +/* SettingsDlgProc() + * + * DialogBox procedure for the Settings dialog, which sets a bunch of + * the application-global settings stored in our global REGSETTINGS struct. + */ +BOOL CALLBACK SettingsDlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) + { + static BOOL fSettingsSaved; + static HWND hInitialDirEdit, hDeviceCombo, hDeviceText, hDefaultCheck; + static HWND hFormatCombo, hExclusiveCheck, hOpen3DCheck, hFocusCombo; + + int ndx, i, idxLocal, idxSticky, idxGlobal; + char szFormat[32]; + LPGUID lpguTemp; + + switch( message ) + { + case WM_INITDIALOG: + hInitialDirEdit = GetDlgItem( hDlg, IDC_SETTINGS_INITIALDIR_EDIT ); + hDeviceCombo = GetDlgItem( hDlg, IDC_SETTINGS_DSD_DEVICE_COMBO ); + hFormatCombo = GetDlgItem( hDlg, IDC_SETTINGS_DSD_FORMAT_COMBO ); + hFocusCombo = GetDlgItem( hDlg, IDC_SETTINGS_FOCUS_COMBO ); + hDeviceText = GetDlgItem( hDlg, IDC_SETTINGS_DSD_DEVICE_TEXT ); + hDefaultCheck = GetDlgItem( hDlg, IDC_SETTINGS_DSD_DEFAULT_CHECK ); + hExclusiveCheck = GetDlgItem( hDlg, IDC_SETTINGS_EXCLUSIVE_CHECK ); + hOpen3DCheck = GetDlgItem( hDlg, IDC_SETTINGS_OPEN3D_CHECK ); + + // We use this flag to determine the return value from DialogBox() + // FALSE indicates no change, TRUE means a change occurred. + fSettingsSaved = FALSE; + + // Add all the format strings to the combo box + for( i = 0; i < NUM_FORMATENTRIES; i ++ ) + { + // Only add formats that are available on this card (this will + // ignore any formats we couldn't SetFormat() with at startup, + // and any we have since found to be unusable as well). + if( !fdFormats[i].fEnable ) + continue; + + if( FormatCodeToText(fdFormats[i].dwCode, szFormat, sizeof(szFormat))) + { + ndx = ComboBox_AddString( hFormatCombo, szFormat ); + ComboBox_SetItemData( hFormatCombo, ndx, fdFormats[i].dwCode ); + } + } + + DirectSoundEnumerate( (LPDSENUMCALLBACK)DSEnumProc, (LPVOID)&hDeviceCombo ); + + // Add the three focus choices to the listbox, and set the item data + // for each to the appropriate flag + idxLocal = ComboBox_AddString( hFocusCombo, "Local" ); + ComboBox_SetItemData( hFocusCombo, idxLocal, 0 ); + idxSticky = ComboBox_AddString( hFocusCombo, "Sticky" ); + ComboBox_SetItemData( hFocusCombo, idxSticky, DSBCAPS_STICKYFOCUS ); + idxGlobal = ComboBox_AddString( hFocusCombo, "Global" ); + ComboBox_SetItemData( hFocusCombo, idxGlobal, DSBCAPS_GLOBALFOCUS ); + + // Select the proper Drop List item + if( grs.dwDefaultFocusFlag == DSBCAPS_STICKYFOCUS ) + ComboBox_SetCurSel( hFocusCombo, idxSticky ); + else if( grs.dwDefaultFocusFlag == DSBCAPS_GLOBALFOCUS ) + ComboBox_SetCurSel( hFocusCombo, idxGlobal ); + else + ComboBox_SetCurSel( hFocusCombo, idxLocal ); + + // Set the states of checkboxes and controls that depend on them + Button_SetCheck( hDefaultCheck, grs.fDefaultDevice ); + Button_SetCheck( hExclusiveCheck, grs.fUseExclusiveMode ); + Button_SetCheck( hOpen3DCheck, grs.fOpen3D ); + Static_Enable( hDeviceCombo, !grs.fDefaultDevice ); + Static_Enable( hDeviceText, !grs.fDefaultDevice ); + + Edit_LimitText( hInitialDirEdit, sizeof(grs.szInitialDir)); + Edit_SetText( hInitialDirEdit, grs.szInitialDir ); + + if (FormatCodeToText(grs.dwPreferredFormat, szFormat, sizeof(szFormat))) + { + ComboBox_SetCurSel( hFormatCombo, ComboBox_FindString( hFormatCombo, + -1, szFormat )); + } + + return TRUE; + + case WM_COMMAND: + switch( LOWORD(wParam)) + { + case IDC_SETTINGS_DSD_DEFAULT_CHECK: + grs.fDefaultDevice = !grs.fDefaultDevice; + Static_Enable( hDeviceCombo, !grs.fDefaultDevice ); + Static_Enable( hDeviceText, !grs.fDefaultDevice ); + // By selecting the first item, we wipe out the state where + // the user could come in with the box checked, uncheck it, + // and leave without selecting anything + ComboBox_SetCurSel( hDeviceCombo, 0 ); + break; + + case IDC_SETTINGS_BROWSE_INITIALDIR_BUTTON: + { + OPENFILENAME ofn; + + ZeroMemory( &ofn, sizeof(ofn)); + // Fill in the ofn structure and do the Common Dialog call + } + break; + + case IDOK: + grs.fDefaultDevice = Button_GetCheck( hDefaultCheck ); + if( !grs.fDefaultDevice ) + { + lpguTemp = (LPGUID)ComboBox_GetItemData( hDeviceCombo, + ComboBox_GetCurSel( hDeviceCombo )); + if( NULL != lpguTemp ) + grs.guPreferredDevice = *lpguTemp; + else + grs.guPreferredDevice = GUID_NULL; + } + else + grs.guPreferredDevice = GUID_NULL; + + grs.fOpen3D = Button_GetCheck( hOpen3DCheck ); + grs.fUseExclusiveMode = Button_GetCheck( hExclusiveCheck ); + grs.dwPreferredFormat = ComboBox_GetItemData( hFormatCombo, + ComboBox_GetCurSel( hFormatCombo )); + grs.dwDefaultFocusFlag = ComboBox_GetItemData( hFocusCombo, + ComboBox_GetCurSel( hFocusCombo )); + Edit_GetText( hInitialDirEdit, grs.szInitialDir, + sizeof(grs.szInitialDir)); + + SaveRegistrySettings(); + fSettingsSaved = TRUE; + SendMessage( hDlg, WM_CLOSE, 0, 0 ); + break; + + case IDCANCEL: + fSettingsSaved = FALSE; + SendMessage( hDlg, WM_CLOSE, 0, 0 ); + break; + + default: + return FALSE; + } + return TRUE; + break; + + case WM_CLOSE: + EndDialog( hDlg, fSettingsSaved ); + return TRUE; + + case WM_DESTROY: + while( ComboBox_GetCount( hDeviceCombo )) + { + lpguTemp = (LPGUID)ComboBox_GetItemData( hDeviceCombo, 0 ); + if( NULL != lpguTemp ) + delete lpguTemp; + ComboBox_DeleteString( hDeviceCombo, 0 ); + } + return TRUE; + + default: + return FALSE; + } + ASSERT( FALSE ); + return FALSE; + } + + +/* LoadRegistrySettings() + * + * Load application global REGSETTINGS structure values from the registry. + */ +BOOL LoadRegistrySettings( void ) + { + HKEY hReg; + DWORD dwVal; + DWORD cbValSize; + BOOL fRet = TRUE; + + // Load current settings from our registry key + if( ERROR_SUCCESS != RegOpenKeyEx( HKEY_CURRENT_USER, REG_SETTINGS_KEY, + 0, KEY_READ, &hReg )) + { + GetMediaPath( grs.szInitialDir, sizeof(grs.szInitialDir)); + + grs.fDefaultDevice = TRUE; + grs.fUseExclusiveMode = FALSE; + grs.fOpen3D = FALSE; + grs.dwDefaultFocusFlag = 0; + grs.szInitialDir[0] = '\0'; + grs.dwPreferredFormat = aFormatOrder[0]; + fRet = TRUE; + goto LRS_Return; + } + + // Load the "Use DirectSound Default Device" flag + cbValSize = sizeof(dwVal); + if( ERROR_SUCCESS != RegQueryValueEx( hReg, REG_SETTING_DEVICE_DEFAULT, + NULL, NULL, (LPBYTE)&dwVal, + &cbValSize )) + { + grs.fDefaultDevice = TRUE; + fRet = FALSE; + } + else + { + grs.fDefaultDevice = (BOOL)dwVal; + + if( !grs.fDefaultDevice ) + { + // Load the GUID for the preferred device (only if it's not the default) + cbValSize = sizeof(grs.guPreferredDevice); + if( ERROR_SUCCESS != RegQueryValueEx( hReg, REG_SETTING_DEVICE_GUID, + NULL, NULL, + (LPBYTE)&grs.guPreferredDevice, + &cbValSize )) + { + // Copy GUID_NULL into the guPreferredDevice (only works in C++) + grs.guPreferredDevice = GUID_NULL; + fRet = FALSE; + } + } + } + + cbValSize = sizeof(dwVal); + if( ERROR_SUCCESS != RegQueryValueEx( hReg, REG_SETTING_USE_EXCLUSIVE, + NULL, NULL, (LPBYTE)&dwVal, + &cbValSize )) + { + grs.fUseExclusiveMode = FALSE; + fRet = FALSE; + } + else + grs.fUseExclusiveMode = (BOOL)dwVal; + + // Load the flag telling sus whether to default to 2D or 3D + cbValSize = sizeof(dwVal); + if( ERROR_SUCCESS != RegQueryValueEx( hReg, REG_SETTING_OPEN3D, + NULL, NULL, (LPBYTE)&dwVal, + &cbValSize )) + { + grs.fOpen3D = FALSE; + fRet = FALSE; + } + else + grs.fOpen3D = (BOOL)dwVal; + + // Load the coded version of the preferred output format + cbValSize = sizeof(grs.dwPreferredFormat); + if( ERROR_SUCCESS != RegQueryValueEx( hReg, REG_SETTING_OUTPUT_FORMAT, + NULL, NULL, + (LPBYTE)&grs.dwPreferredFormat, + &cbValSize )) + { + grs.dwPreferredFormat = aFormatOrder[0]; + fRet = FALSE; + } + + // Load the default focus DSBCAPS flags + cbValSize = sizeof(grs.dwDefaultFocusFlag); + if( ERROR_SUCCESS != RegQueryValueEx( hReg, REG_SETTING_FOCUS_FLAG, + NULL, NULL, + (LPBYTE)&grs.dwDefaultFocusFlag, + &cbValSize )) + { + grs.dwDefaultFocusFlag = 0; + fRet = FALSE; + } + + // Load the initial directory for WAVE files + cbValSize = sizeof(grs.szInitialDir); + if( ERROR_SUCCESS != RegQueryValueEx( hReg, REG_SETTING_INITIAL_DIR, + NULL, NULL, + (LPBYTE)&grs.szInitialDir, + &cbValSize )) + { + GetMediaPath( grs.szInitialDir, sizeof(grs.szInitialDir)); + fRet = FALSE; + } + + if( hReg != NULL ) + { + RegCloseKey( hReg ); + hReg = NULL; + } + +LRS_Return: + return fRet; + } + + +/* SaveRegistrySettings() + * + * Write the values in the REGSETTINGS global structure to the registry. + */ +BOOL SaveRegistrySettings( void ) + { + HKEY hReg; + DWORD dwVal, dwCreateDisposition; + BOOL fRet = TRUE; + + // Save current settings to our registry key + if( ERROR_SUCCESS != RegCreateKeyEx( HKEY_CURRENT_USER, REG_SETTINGS_KEY, + 0, NULL, 0, KEY_WRITE, NULL, &hReg, + &dwCreateDisposition )) + { + fRet = FALSE; + goto SRS_Return; + } + + // Save the "Use DirectSound Default Device" flag + dwVal = (DWORD)grs.fDefaultDevice; + if( ERROR_SUCCESS != RegSetValueEx( hReg, REG_SETTING_DEVICE_DEFAULT, + 0, REG_DWORD, (LPBYTE)&dwVal, + sizeof(DWORD))) + { + fRet = FALSE; + } + else + { + if( !grs.fDefaultDevice ) + { + // Save the GUID for the preferred device (only if it's not the default) + if( ERROR_SUCCESS != RegSetValueEx( hReg, REG_SETTING_DEVICE_GUID, + 0, REG_BINARY, + (LPBYTE)&grs.guPreferredDevice, + sizeof(GUID))) + { + fRet = FALSE; + } + } + } + + // Use DSSCL_EXCLUSIVE ?? + dwVal = (DWORD)grs.fUseExclusiveMode; + if( ERROR_SUCCESS != RegSetValueEx( hReg, REG_SETTING_USE_EXCLUSIVE, + 0, REG_DWORD, (LPBYTE)&dwVal, + sizeof(DWORD))) + { + fRet = FALSE; + } + + // Open in 3D by default ? + dwVal = (DWORD)grs.fOpen3D; + if( ERROR_SUCCESS != RegSetValueEx( hReg, REG_SETTING_OPEN3D, + 0, REG_DWORD, (LPBYTE)&dwVal, + sizeof(DWORD))) + { + fRet = FALSE; + } + + // Save the coded version of the preferred output format + if( ERROR_SUCCESS != RegSetValueEx( hReg, REG_SETTING_OUTPUT_FORMAT, + 0, REG_DWORD, + (LPBYTE)&grs.dwPreferredFormat, + sizeof(DWORD))) + { + fRet = FALSE; + } + + // Save the coded version of the preferred output format + if( ERROR_SUCCESS != RegSetValueEx( hReg, REG_SETTING_FOCUS_FLAG, + 0, REG_DWORD, + (LPBYTE)&grs.dwDefaultFocusFlag, + sizeof(DWORD))) + { + fRet = FALSE; + } + + // Save the initial directory for WAVE files + if( ERROR_SUCCESS != RegSetValueEx( hReg, REG_SETTING_INITIAL_DIR, + 0, REG_SZ, + (LPBYTE)&grs.szInitialDir, + lstrlen(grs.szInitialDir))) + { + fRet = FALSE; + } + + RegCloseKey( hReg ); + hReg = NULL; + +SRS_Return: + return fRet; + } + + +/* GetMediaPath() + * + * In the absence of a registry value, this function is called to pick a + * starting point for the File|Open dialog. Usually \DXSDK\SDK\MEDIA. + */ +void GetMediaPath( LPSTR lpszBuf, int nBuf ) + { + HKEY hReg; + DWORD cbStartPathLen; + + if( ERROR_SUCCESS != RegOpenKeyEx( HKEY_LOCAL_MACHINE, + REG_DIRECT3D_KEY, + 0, KEY_READ, &hReg )) + { + goto REG_OPEN_FAILED; + } + else + { + // Query the Registry for the path to the media directory + cbStartPathLen = sizeof( szOpenStartDir ); + if( ERROR_SUCCESS != RegQueryValueEx( hReg, REG_D3DPATH_VAL, + NULL, NULL, + (LPBYTE)szOpenStartDir, + &cbStartPathLen )) + { + goto REG_OPEN_FAILED; + } + RegCloseKey( hReg ); + hReg = NULL; + } + + return; + +REG_OPEN_FAILED: + // Start off by getting the Windows directory -- we're trying to build a + // file path like "C:\WINDOWS\MEDIA", but the WINDOWS directory could be + // named anything, so we must ask. + GetWindowsDirectory( szOpenStartDir, sizeof(szOpenStartDir)); + // If there's no trailing backslash, append one + if( lstrcmp( &szOpenStartDir[lstrlen(szOpenStartDir)], TEXT("\\") )) + lstrcat( szOpenStartDir, TEXT("\\")); + // Now add on the MEDIA part of the path + lstrcat( szOpenStartDir, TEXT("MEDIA")); + } + + +/* FormatCodeToText() + * + * This function reads format codes and puts out a text string for them. + * It does not check for invalid codes. FALSE return means the buffer was + * invalid in some way, TRUE means success. + * + */ +BOOL FormatCodeToText( DWORD dwFormat, LPSTR lpszBuf, int nBufSize ) + { + DWORD dwFreq; + + // The longest string we'll ever put in is 21 characters (including NULL) + if( NULL == lpszBuf || nBufSize < 21 ) + return FALSE; + + // Extract the sample rate + dwFreq = FC_GETFREQCODE(dwFormat); + dwFreq = ( dwFreq == 8 ? 8000 : (dwFreq / 11) * 11025); + + wsprintf( lpszBuf, "%u Hz, %u-bit %s", dwFreq, FC_GETBITS(dwFormat), + FC_GETCHANNELS(dwFormat) == 1 ? "Mono" : "Stereo" ); + + return TRUE; + } + + +/* FormatCodeToWFX() + * + * This function reads format codes and fills most of the fields of a + * WAVEFORMATEX structure based on the values read. It does not fill the + * wFormatTag or cbSize members. + * + */ +BOOL FormatCodeToWFX( DWORD dwFormat, PWAVEFORMATEX pwfx ) + { + DWORD dwFreq; + + if( NULL == pwfx ) + return FALSE; + + // Extract the sample rate + dwFreq = FC_GETFREQCODE(dwFormat); + pwfx->nSamplesPerSec = ( dwFreq == 8 ? 8000 : (dwFreq / 11) * 11025); + + pwfx->wBitsPerSample = (WORD)FC_GETBITS(dwFormat); + pwfx->nChannels = (WORD)FC_GETCHANNELS(dwFormat); + + // The nBlockAlign calculation below only works for whole-byte samples + ASSERT( pwfx->wBitsPerSample % 8 == 0 ); + + pwfx->nBlockAlign = pwfx->nChannels * (pwfx->wBitsPerSample / 8); + pwfx->nAvgBytesPerSec = pwfx->nBlockAlign * pwfx->nSamplesPerSec; + + return TRUE; + } + + +/* FormatCodeFromCommandID() + * + * Returns the Format Code that matches the given command ID. + */ +DWORD FormatCodeFromCommandID( WORD wID ) + { + int i; + + for( i = 0; i < NUM_FORMATENTRIES; i++ ) + { + if( fdFormats[i].wCommandID == wID ) + return fdFormats[i].dwCode; + } + return 0; + } + + +/* CommandIDFromFormatCode() + * + * Searchs our FORMATDATA array and returns the Command ID corresponding + * to the given format code, or 0 if there is no such valid format code. + */ +WORD CommandIDFromFormatCode( DWORD dwCode ) + { + int i; + + for( i = 0; i < NUM_FORMATENTRIES; i++ ) + { + if( fdFormats[i].dwCode == dwCode ) + return fdFormats[i].wCommandID; + } + return 0; + } + + +void DisableFormatCode( DWORD dwCode ) + { + int i; + + for( i = 0; i < NUM_FORMATENTRIES; i++ ) + { + if( fdFormats[i].dwCode == dwCode ) + { + fdFormats[i].fEnable = FALSE; + break; + } + } + } + + +void EnableFormatCode( DWORD dwCode ) + { + int i; + + for( i = 0; i < NUM_FORMATENTRIES; i++ ) + { + if( fdFormats[i].dwCode == dwCode ) + { + fdFormats[i].fEnable = TRUE; + break; + } + } + } + + +/* DSEnumProc() + * + * DirectSoundEnumerate() callback procedure which fills a combo box with + * the description strings of all devices and attachs a pointer to a GUID, + * which must be freed later by calling delete. + */ +BOOL CALLBACK DSEnumProc( LPGUID lpguDevice, LPSTR lpszDesc, + LPSTR lpszDrvName, LPVOID lpContext ) + { + HWND hCombo = *(HWND *)lpContext; + LPGUID lpguTemp = NULL; + int idx; + + if( NULL != lpguDevice ) + { + lpguTemp = new GUID; + // We failed to allocate storage, so continue with next device + if( NULL == lpguTemp ) + return( TRUE ); + + CopyMemory( lpguTemp, lpguDevice, sizeof(GUID)); + } + + idx = ComboBox_AddString( hCombo, lpszDesc ); + ComboBox_SetItemData( hCombo, + ComboBox_FindString( hCombo, 0, lpszDesc ), + lpguTemp ); + + if( !grs.fDefaultDevice ) + { + if( NULL == lpguTemp ) + { + if( grs.guPreferredDevice == GUID_NULL ) + ComboBox_SetCurSel( hCombo, idx ); + } + else if( *lpguTemp == grs.guPreferredDevice ) + ComboBox_SetCurSel( hCombo, idx ); + } + + return( TRUE ); + } + + +/* fGetToken() + * + * Parses the command-line string "in place" starting at pszStart. A ptr + * to the start of the next token and it's length will be the out parameters, + * or NULL and 0 if no token. Note that *ppszRet will NOT be NULL-terminated + * since the string is part of another string. That's what then length is for. + * + * Returns: TRUE if a token was retrieved, or FALSE if there was no token. + */ +BOOL fGetToken( PSTR pszStart, PSTR *ppszRet, int *pcchRet ) + { + PSTR pszCur = pszStart; + PSTR pszTokStart; + + if( !pszStart || NULL == ppszRet || NULL == pcchRet ) + return FALSE; + + // Skip leading whitespace + while( *pszCur && (*pszCur == ' ' || *pszCur == '\t')) + pszCur++; + + *ppszRet = NULL; + *pcchRet = 0; + + if( *pszCur ) + { + pszTokStart = pszCur; + + while( *pszCur && *pszCur != ' ' && *pszCur != '\t' ) + pszCur++; + + *ppszRet = pszTokStart; + *pcchRet = (int)(pszCur - pszTokStart); + } + + if( *pcchRet != 0 ) + return TRUE; + else + return FALSE; + } + + +/* fMatchToken() + * + * Attempts to match the first cchLen characters of pszDatum to the + * string at pszString. The comparison is case-insensitive (this function + * is designed for command-line switch matching). + * + * Returns: TRUE if the first cchLen characters are a match, else FALSE. + */ +BOOL fMatchToken( PSTR pszString, PSTR pszDatum, int cchLen ) + { + int i; + + for( i = 0; i < cchLen; i++ ) + { + if( CharLower( (LPTSTR)MAKELONG( pszString[i], 0 )) + != CharLower( (LPTSTR)MAKELONG( pszDatum[i], 0 ))) + return FALSE; + } + return TRUE; + } + + +/* ParseCommandLine() + * + * Given a command-line string without the module name, this function will + * parse the command line and takes action on whatever it finds there. + * + * Returns: TRUE if successful, or FALSE if there was an error. + */ +BOOL ParseCommandLine(LPSTR lpszCmdLine) + { + PSTR pszCur,pszToken; + PSTR ppszFiles[MAXCONTROLS]; + BOOL fStartPlaying = FALSE, fStartLooping = FALSE; + int cchTokLen = 0, i, nFilesFound; + + pszCur = lpszCmdLine; + + // First get all the command line switches + while( fGetToken(pszCur, &pszToken, &cchTokLen) && + (pszToken[0] == '/' || pszToken[0] == '-' )) + { + pszCur = pszToken + cchTokLen; + pszToken++; + + if( fMatchToken( pszToken, "PLAY", 4 )) + { + fStartPlaying = TRUE; + } + else if( fMatchToken( pszToken, "LOOP", 4 )) + { + fStartLooping = TRUE; + } + else + { + // We don't recognize this mysterious switch, so eat it and move on + } + } + + // Anything left on the command-line will be treated as a filename and + // we'll attempt to open it after we've found them all + nFilesFound = 0; + while( fGetToken(pszCur, &pszToken, &cchTokLen) && nFilesFound < MAXCONTROLS ) + { + pszCur = pszToken + cchTokLen; + ppszFiles[nFilesFound] = new char[cchTokLen+1]; + // Copy the token out of the command-line string and into our buffer + CopyMemory( ppszFiles[nFilesFound], pszToken, cchTokLen*sizeof(char)); + // Append a NULL terminator to what we just copied (to be safe) + *(ppszFiles[nFilesFound] + cchTokLen) = 0; + nFilesFound++; + } + // This function will take the array of strings we've created and open + // each string as a file. It will obey the global fStartPlaying and + // fStartLooping flags we may have already set above + if( nFilesFound ) + AppWnd.BatchOpenFiles( ppszFiles, nFilesFound, fStartPlaying, fStartLooping ); + + // Free the space we allocated + for( i = 0; i < nFilesFound; i++ ) + { + delete[] ppszFiles[i]; + ppszFiles[i] = NULL; + } + + // Returning TRUE means the caller should continue doing what they + // were doing: we succeeded. + return TRUE; + } + + diff --git a/sdk/samples/dsshow3d/dsshow3d.def b/sdk/samples/dsshow3d/dsshow3d.def new file mode 100644 index 0000000..2909bef --- /dev/null +++ b/sdk/samples/dsshow3d/dsshow3d.def @@ -0,0 +1,3 @@ +NAME DSSHOW3D + +DESCRIPTION 'DirectSound3D Demo' diff --git a/sdk/samples/dsshow3d/dsshow3d.h b/sdk/samples/dsshow3d/dsshow3d.h new file mode 100644 index 0000000..81d9b21 --- /dev/null +++ b/sdk/samples/dsshow3d/dsshow3d.h @@ -0,0 +1,95 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: DSShow3D.h + * Content: DirectSound Mixing Test with 3D sound main header file + * + ***************************************************************************/ +#ifndef __DSSHOW3D_H__ +#define __DSSHOW3D_H__ + +#define QQUOTE(x) #x +#define QUOTE(y) QQUOTE(y) +#define REMIND(str) __FILE__ "(" QUOTE(__LINE__) ") : " str + +#include <mmsystem.h> +#include <dsound.h> +#include <d3dtypes.h> + +#include "resource.h" +#include "debug.h" + +#define MAXCONTROLS 200 // An insanely large number of controls + +// To check for stopping of sounds, a timer is set...use this for the rate. +#define TIMERPERIOD 300 // In milliseconds + + +#define OPENFILENAME_F_LOCALFOCUS 0x00000001 +#define OPENFILENAME_F_STICKYFOCUS 0x00000002 +#define OPENFILENAME_F_GLOBALFOCUS 0x00000004 + +#define OPENFILENAME_F_GETPOS 0x00000008 +#define OPENFILENAME_F_GETPOS2 0x00000010 + +#define OPENFILENAME_F_3D 0x00000020 + + +#define MAXVOL_VAL 0 +#define MIDPAN_VAL 0 + +// Registry Keys and Values +#define REG_SETTINGS_KEY TEXT("Software\\Microsoft\\DSShow3D") +#define REG_SETTING_DEVICE_DEFAULT TEXT("UseDSoundDefault") +#define REG_SETTING_USE_EXCLUSIVE TEXT("UseExclusiveMode") +#define REG_SETTING_OUTPUT_FORMAT TEXT("PreferredOutputFormat") +#define REG_SETTING_FOCUS_FLAG TEXT("Focus") +#define REG_SETTING_OPEN3D TEXT("DefaultOpen3D") +#define REG_SETTING_INITIAL_DIR TEXT("InitialDirectory") +#define REG_SETTING_DEVICE_GUID TEXT("PreferredDevice") +#define REG_DIRECT3D_KEY TEXT("Software\\Microsoft\\Direct3D") +#define REG_D3DPATH_VAL TEXT("D3D Path") + + +typedef struct tag_rs +{ + BOOL fDefaultDevice; // Use the DSound default device? + BOOL fOpen3D; // Default to opening in 3D? + BOOL fUseExclusiveMode; // Use exclusive mode? + DWORD dwDefaultFocusFlag; // The DSBCAPS flag for the default focus + DWORD dwPreferredFormat; // Preferred output format + char szInitialDir[MAX_PATH]; // Initial open directory + GUID guPreferredDevice; // GUID of preferred device, if not default +} REGSETTINGS, *PREGSETTINGS; + + +typedef struct tag_fd +{ + DWORD dwCode; + WORD wCommandID; + BOOL fEnable; +} FORMATDATA, *PFORMATDATA; + +/////////////////////////////////////////////////////////////////////// +// Function prototypes +// + +BOOL CALLBACK DSEnumProc( LPGUID, LPSTR, LPSTR, LPVOID ); +BOOL CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM); +BOOL CALLBACK SettingsDlgProc(HWND, UINT, WPARAM, LPARAM); +UINT CALLBACK FileOpenCustomTemplateDlgProc(HWND, UINT, WPARAM, LPARAM); + +BOOL OpenFileDialog(HWND, LPSTR, int *, LPDWORD); +BOOL IsValidWave(LPSTR); + +BOOL FormatCodeToWFX( DWORD, PWAVEFORMATEX ); +BOOL FormatCodeToText( DWORD, LPSTR, int ); + +DWORD FormatCodeFromCommandID( WORD ); +WORD CommandIDFromFormatCode( DWORD ); +void DisableFormatCode( DWORD ); +void EnableFormatCode( DWORD ); + + +#endif // __DSSHOW3D_H__ diff --git a/sdk/samples/dsshow3d/dsshow3d.rc b/sdk/samples/dsshow3d/dsshow3d.rc new file mode 100644 index 0000000..5f05dca --- /dev/null +++ b/sdk/samples/dsshow3d/dsshow3d.rc @@ -0,0 +1,492 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "reshead.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""reshead.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_SPEAKER_RGB ICON DISCARDABLE "icon3.ico" +IDI_SPEAKER_RGB_3D ICON DISCARDABLE "icon1.ico" +IDI_SMALL_3D ICON DISCARDABLE "ico00001.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINMENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Open", IDC_FILE_OPEN + MENUITEM "E&xit", IDC_FILE_EXIT + END + POPUP "&Options" + BEGIN + POPUP "&Output Format" + BEGIN + MENUITEM "8000 Hz 8-bit Mono", ID_OPTIONS_FORMAT_8M8 + MENUITEM "8000 Hz 16-bit Mono", ID_OPTIONS_FORMAT_8M16 + MENUITEM "8000 Hz 8-bit Stereo", ID_OPTIONS_FORMAT_8S8 + MENUITEM "8000 Hz 16-bit Stereo", ID_OPTIONS_FORMAT_8S16 + MENUITEM SEPARATOR + MENUITEM "11025 Hz 8-bit Mono", ID_OPTIONS_FORMAT_11M8 + MENUITEM "11025 Hz 16-bit Mono", ID_OPTIONS_FORMAT_11M16 + MENUITEM "11025 Hz 8-bit Stereo", ID_OPTIONS_FORMAT_11S8 + MENUITEM "11025 Hz 16-bit Stereo", ID_OPTIONS_FORMAT_11S16 + MENUITEM SEPARATOR + MENUITEM "22050 Hz 8-bit Mono", ID_OPTIONS_FORMAT_22M8 + MENUITEM "22050 Hz 16-bit Mono", ID_OPTIONS_FORMAT_22M16 + MENUITEM "22050 Hz 8-bit Stereo", ID_OPTIONS_FORMAT_22S8 + MENUITEM "22050 Hz 16-bit Stereo", ID_OPTIONS_FORMAT_22S16 + MENUITEM SEPARATOR + MENUITEM "44100 Hz 8-bit Mono", ID_OPTIONS_FORMAT_44M8 + MENUITEM "44100 Hz 16-bit Mono", ID_OPTIONS_FORMAT_44M16 + MENUITEM "44100 Hz 8-bit Stereo", ID_OPTIONS_FORMAT_44S8 + MENUITEM "44100 Hz 16-bit Stereo", ID_OPTIONS_FORMAT_44S16 + END + MENUITEM SEPARATOR + MENUITEM "&Settings...", IDC_OPTIONS_SETTINGS + END + POPUP "&Buffers" + BEGIN + MENUITEM "&Cascade", IDC_BUFFERS_CASCADE + MENUITEM "&Minimize All", IDC_BUFFERS_MINIMIZEALL + MENUITEM "&Restore All", IDC_BUFFERS_RESTOREALL + MENUITEM SEPARATOR + MENUITEM "Close &All", IDC_BUFFERS_CLOSEALL + END + POPUP "&Help" + BEGIN + MENUITEM "&About...", IDC_HELP_ABOUT + END +END + +IDM_POPUPS MENU DISCARDABLE +BEGIN + POPUP "FREQ_CONTEXT" + BEGIN + MENUITEM "File Default", ID_FREQCONTEXT_FILEDEFAULT + MENUITEM SEPARATOR + MENUITEM "8000 Hz", ID_FREQCONTEXT_8000HZ + MENUITEM "11025 Hz", ID_FREQCONTEXT_11025HZ + MENUITEM "22050 Hz", ID_FREQCONTEXT_22050HZ + MENUITEM "44100 Hz", ID_FREQCONTEXT_44100HZ + END + POPUP "VOL_CONTEXT" + BEGIN + MENUITEM "0 dB (100%)", ID_VOLCONTEXT_0DB + MENUITEM "-10 dB (50%)", ID_VOLCONTEXT_10DB + MENUITEM "-20 dB (25%)", ID_VOLCONTEXT_20DB + MENUITEM "-30 dB (12.5%)", ID_VOLCONTEXT_30DB + MENUITEM "-100 dB (virtually silent)", ID_VOLCONTEXT_100DB + END + POPUP "PAN_CONTEXT" + BEGIN + MENUITEM "Center", ID_PANCONTEXT_CENTER + MENUITEM SEPARATOR + MENUITEM "10 dB Left", ID_PANCONTEXT_10DB_LEFT + MENUITEM "10 dB Right", ID_PANCONTEXT_10DB_RIGHT + MENUITEM SEPARATOR + MENUITEM "Full Left", ID_PANCONTEXT_FULL_LEFT + MENUITEM "Full Right", ID_PANCONTEXT_FULL_RIGHT + END + POPUP "OUTERVOL_CONTEXT" + BEGIN + MENUITEM "0 dB (100%)", ID_OUTERVOLCONTEXT_0DB + MENUITEM "-10 dB (50%)", ID_OUTERVOLCONTEXT_10DB + MENUITEM "-20 dB (25%)", ID_OUTERVOLCONTEXT_20DB + MENUITEM "-30 dB (12.5%)", ID_OUTERVOLCONTEXT_30DB + MENUITEM "-100 dB (virtually silent)", ID_OUTERVOLCONTEXT_100DB + END + POPUP "POS_CONTEXT" + BEGIN + MENUITEM "Origin", ID_POSCONTEXT_ORIGIN + MENUITEM "Listener Position", ID_POSCONTEXT_LISTENERPOSITION + + END +END + +IDM_BUFFERDLG MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Open...", ID_BUFFERDLG_FILE_OPEN + MENUITEM "&Close", IDCANCEL + END + MENUITEM "&Duplicate!", ID_BUFFERDLG_DUPLICATE +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DSENUMBOX DIALOG DISCARDABLE 0, 0, 184, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Choose a DirectSound Driver..." +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,34,43,50,14 + PUSHBUTTON "Cancel",IDCANCEL,100,43,50,14 + COMBOBOX IDC_DSENUM_COMBO,4,12,176,36,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Driver Description:",IDC_STATIC,4,4,116,8 +END + +IDD_FILEOPEN_NEST DIALOG DISCARDABLE 0, 0, 287, 122 +STYLE DS_MODALFRAME | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS | + WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "",1119,7,7,280,70 + CONTROL "Create as a &3D buffer",IDC_FONEST_3D,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,6,82,92,11 + CONTROL "&Local",IDC_FONEST_LOCAL_RADIO,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,12,104,48,10 + CONTROL """&Sticky""",IDC_FONEST_STICKY_RADIO,"Button", + BS_AUTORADIOBUTTON,62,104,48,10 + CONTROL "&Global",IDC_FONEST_GLOBAL_RADIO,"Button", + BS_AUTORADIOBUTTON,112,104,48,10 + CONTROL "&Normal (DX 1 behavior)",IDC_FONEST_GETPOS_RADIO, + "Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,172, + 92,101,10 + CONTROL "&Enhanced Accuracy (DX2)",IDC_FONEST_GETPOS2_RADIO, + "Button",BS_AUTORADIOBUTTON,172,104,102,10 + GROUPBOX "GetCurrentPosition() Behavior",IDC_FONEST_GETPOS_GROUP, + 168,82,110,34 + GROUPBOX "Sound Focus Type",IDC_STATIC,6,94,158,22 +END + +IDD_ABOUT DIALOG DISCARDABLE 0, 0, 208, 73 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",ID_OK,79,52,50,14 + LTEXT "DSShow3D",IDC_STATIC,40,8,93,9 + LTEXT "Copyright (c) 1995-1996 Microsoft Corporation", + IDC_STATIC,40,32,164,12 + ICON IDI_SPEAKER_RGB_3D,IDC_STATIC,9,8,18,20 + LTEXT "A DirectSound3D sample application",IDC_STATIC,40,20, + 136,8 +END + +IDD_BUFFER DIALOGEX 0, 0, 178, 122 +STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_ACCEPTFILES +MENU IDM_BUFFERDLG +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + PUSHBUTTON "&Play",IDC_BUFFERDLG_PLAY_BUTTON,4,82,37,14 + CONTROL "&Looped",IDC_BUFFERDLG_LOOPED_CHECK,"Button", + BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,45,82,37,14 + CONTROL "Slider3",IDC_BUFFERDLG_FREQ_SLIDER,"msctls_trackbar32", + TBS_NOTICKS | WS_TABSTOP,87,22,85,15 + CONTROL "Slider4",IDC_BUFFERDLG_VOL_SLIDER,"msctls_trackbar32", + TBS_NOTICKS | WS_TABSTOP,87,50,85,15 + CONTROL "Slider4",IDC_BUFFERDLG_PAN_SLIDER,"msctls_trackbar32", + TBS_NOTICKS | WS_TABSTOP,87,78,85,15 + LTEXT "Frequency:",IDC_STATIC,92,14,38,8 + RTEXT "",IDC_BUFFERDLG_FREQ_TEXT,130,14,38,8 + LTEXT "Write Cursor:",IDC_STATIC,4,38,42,8 + LTEXT "Play Cursor:",IDC_STATIC,4,28,42,8 + RTEXT "",IDC_BUFFERDLG_WRITECURSOR_TEXT,48,38,34,8 + RTEXT "",IDC_BUFFERDLG_PLAYCURSOR_TEXT,48,28,34,8 + GROUPBOX "2D Buffer Properties",IDC_STATIC,86,4,88,92 + LTEXT "Volume:",IDC_STATIC,92,40,32,8 + RTEXT "",IDC_BUFFERDLG_VOL_TEXT,126,40,42,8 + RTEXT "",IDC_BUFFERDLG_PAN_TEXT,116,68,52,8 + LTEXT "Pan:",IDC_STATIC,92,68,22,8 + LTEXT "Focus Mode:",IDC_STATIC,4,62,48,8 + RTEXT "",IDC_BUFFERDLG_FOCUS_TEXT,52,62,30,8 + LTEXT "GetPos Mode:",IDC_STATIC,4,72,52,8,WS_DISABLED + RTEXT "",IDC_BUFFERDLG_GETPOS_TEXT,56,72,26,8,WS_DISABLED + LTEXT "Data Format:",IDC_STATIC,4,4,50,8 + RTEXT "",IDC_BUFFERDLG_DATAFORMAT_TEXT,4,14,78,8 + CONTROL "",IDC_STATIC,"Static",SS_GRAYFRAME | SS_SUNKEN,4,48,78, + 2 + CONTROL "",IDC_STATIC,"Static",SS_GRAYFRAME | SS_SUNKEN,4,24,78, + 2 + CONTROL "",IDC_STATIC,"Static",SS_GRAYFRAME | SS_SUNKEN,0,0,178, + 1 + LTEXT "Buffer Type:",IDC_STATIC,4,52,44,8 + RTEXT "",IDC_BUFFERDLG_BUFFERTYPE_TEXT,48,52,34,8 + CONTROL "Slider1",IDC_BUFFERDLG_PROGRESS_SLIDER, + "msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,38,100, + 120,18 + LTEXT "Progress:",IDC_STATIC,4,104,34,8 + RTEXT "",IDC_BUFFERDLG_PROGRESS_TEXT,158,111,16,8 + CONTROL "Spin3",IDC_BUFFERDLG_PROGRESS_SPIN,"msctls_updown32", + UDS_SETBUDDYINT | UDS_ARROWKEYS | UDS_HORZ,158,101,16,8 +END + +IDD_BUFFER3D DIALOGEX 0, 0, 276, 146 +STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_ACCEPTFILES +MENU IDM_BUFFERDLG +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "&Play",IDC_BUFFERDLG_PLAY_BUTTON,4,84,37,14 + CONTROL "&Looped",IDC_BUFFERDLG_LOOPED_CHECK,"Button", + BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,45,84,37,14 + CONTROL "Disable 3D effects",IDC_BUFFERDLG_DISABLE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,6,105,80,8 + CONTROL "Slider3",IDC_BUFFERDLG_FREQ_SLIDER,"msctls_trackbar32", + TBS_NOTICKS | WS_TABSTOP,87,27,85,15 + CONTROL "Slider4",IDC_BUFFERDLG_VOL_SLIDER,"msctls_trackbar32", + TBS_NOTICKS | WS_TABSTOP,87,60,85,15 + CONTROL "Slider4",IDC_BUFFERDLG_OUTERVOL_SLIDER, + "msctls_trackbar32",TBS_NOTICKS,87,93,85,15 + CONTROL "Slider1",IDC_BUFFERDLG_PROGRESS_SLIDER, + "msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,38,122, + 120,18 + CONTROL "Spin3",IDC_BUFFERDLG_PROGRESS_SPIN,"msctls_updown32", + UDS_SETBUDDYINT | UDS_ARROWKEYS | UDS_HORZ,158,123,16,8 + CONTROL "Slider2",IDC_BUFFERDLG_X_SLIDER,"msctls_trackbar32", + WS_TABSTOP,182,14,60,12 + CONTROL "Slider2",IDC_BUFFERDLG_Y_SLIDER,"msctls_trackbar32", + WS_TABSTOP,182,32,60,12 + CONTROL "Slider2",IDC_BUFFERDLG_Z_SLIDER,"msctls_trackbar32", + WS_TABSTOP,182,50,60,12 + EDITTEXT IDC_BUFFERDLG_INNERANGLE_EDIT,210,75,30,14, + ES_AUTOHSCROLL,WS_EX_NOPARENTNOTIFY + CONTROL "Spin1",IDC_BUFFERDLG_INNERANGLE_SPIN,"msctls_updown32", + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS,235,75,9,14 + EDITTEXT IDC_BUFFERDLG_OUTERANGLE_EDIT,210,94,30,14, + ES_AUTOHSCROLL,WS_EX_NOPARENTNOTIFY + CONTROL "Spin1",IDC_BUFFERDLG_OUTERANGLE_SPIN,"msctls_updown32", + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS,235,94,9,14 + GROUPBOX "3D Buffer Properties",IDC_STATIC,178,4,94,113 + LTEXT "Frequency:",IDC_STATIC,92,19,38,8 + LTEXT "Progress:",IDC_STATIC,4,126,34,8 + RTEXT "",IDC_BUFFERDLG_FREQ_TEXT,130,19,38,8 + LTEXT "Write Cursor:",IDC_STATIC,4,38,42,8 + LTEXT "Play Cursor:",IDC_STATIC,4,28,42,8 + RTEXT "",IDC_BUFFERDLG_WRITECURSOR_TEXT,48,38,34,8 + RTEXT "",IDC_BUFFERDLG_PLAYCURSOR_TEXT,48,28,34,8 + GROUPBOX "2D Buffer Properties",IDC_STATIC,86,4,88,113 + LTEXT "Inner Volume:",IDC_STATIC,92,50,46,8 + RTEXT "",IDC_BUFFERDLG_VOL_TEXT,138,50,30,8 + LTEXT "Focus Mode:",IDC_STATIC,4,62,48,8 + RTEXT "",IDC_BUFFERDLG_FOCUS_TEXT,52,62,30,8 + LTEXT "GetPos Mode:",IDC_STATIC,4,72,52,8,WS_DISABLED + RTEXT "",IDC_BUFFERDLG_GETPOS_TEXT,56,72,26,8,WS_DISABLED + LTEXT "Data Format:",IDC_STATIC,4,4,50,8 + RTEXT "",IDC_BUFFERDLG_DATAFORMAT_TEXT,4,14,74,8 + CONTROL "",IDC_STATIC,"Static",SS_GRAYFRAME | SS_SUNKEN,4,48,78, + 2 + CONTROL "",IDC_STATIC,"Static",SS_GRAYFRAME | SS_SUNKEN,4,24,78, + 2 + CONTROL "",IDC_STATIC,"Static",SS_GRAYFRAME | SS_SUNKEN,0,0,276, + 1 + LTEXT "Buffer Type:",IDC_STATIC,4,52,44,8 + RTEXT "",IDC_BUFFERDLG_BUFFERTYPE_TEXT,48,52,34,8 + LTEXT "X:",IDC_STATIC,242,16,8,8 + LTEXT "Y:",IDC_STATIC,242,34,8,8 + LTEXT "Z:",IDC_STATIC,242,52,8,8 + LTEXT "Outer Volume:",IDC_STATIC,92,83,46,8 + RTEXT "",IDC_BUFFERDLG_OUTERVOL_TEXT,138,83,30,8 + LTEXT "Inner:",IDC_STATIC,188,78,22,8 + LTEXT "Outer:",IDC_STATIC,188,96,22,8 + GROUPBOX "Cone Angles",IDC_STATIC,184,65,60,46 + LTEXT "",IDC_BUFFERDLG_PROGRESS_TEXT,158,133,16,8 + LTEXT "",IDC_BUFFERDLG_Z_TEXT,250,52,16,8 + LTEXT "",IDC_BUFFERDLG_Y_TEXT,250,34,16,8 + LTEXT "",IDC_BUFFERDLG_X_TEXT,250,16,16,8 +END + +IDD_3DLISTENER DIALOG DISCARDABLE 0, 0, 134, 116 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION +CAPTION "3D Listener Object Settings" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Distance Factor:",IDC_STATIC,4,8,54,8 + EDITTEXT IDC_LISTENER_DISTANCEFACTOR_EDIT,58,4,34,14, + ES_AUTOHSCROLL + LTEXT "meters/unit",IDC_STATIC,94,8,36,8 + LTEXT "Doppler Factor:",IDC_STATIC,4,24,52,8,WS_DISABLED + EDITTEXT IDC_LISTENER_DOPPLERFACTOR_EDIT,58,20,34,14, + ES_AUTOHSCROLL | WS_DISABLED + LTEXT "times real",IDC_STATIC,94,24,34,8,WS_DISABLED + EDITTEXT IDC_LISTENER_ROLLOFFFACTOR_EDIT,58,36,34,14, + ES_AUTOHSCROLL + LTEXT "RollOff Factor:",IDC_STATIC,4,40,48,8 + LTEXT "times real",IDC_STATIC,94,40,34,8 + CONTROL "Slider1",IDC_LISTENER_X_SLIDER,"msctls_trackbar32", + TBS_NOTICKS | WS_TABSTOP,6,62,86,15 + LTEXT "X:",IDC_STATIC,94,64,10,8 + LTEXT "",IDC_LISTENER_X_TEXT,104,64,22,8 + CONTROL "Slider1",IDC_LISTENER_Y_SLIDER,"msctls_trackbar32", + TBS_NOTICKS | WS_TABSTOP,6,79,86,15 + LTEXT "Y:",IDC_STATIC,94,81,10,8 + LTEXT "",IDC_LISTENER_Y_TEXT,104,81,22,8 + CONTROL "Slider1",IDC_LISTENER_Z_SLIDER,"msctls_trackbar32", + TBS_NOTICKS | WS_TABSTOP,6,96,86,15 + LTEXT "Z:",IDC_STATIC,94,98,10,8 + LTEXT "",IDC_LISTENER_Z_TEXT,104,98,22,8 + GROUPBOX "Head Position",IDC_STATIC,4,52,126,60 +END + +IDD_SETTINGS DIALOG DISCARDABLE 0, 0, 226, 126 +STYLE DS_ABSALIGN | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "Settings" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Use DirectSound Default",IDC_SETTINGS_DSD_DEFAULT_CHECK, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,14,100,10 + COMBOBOX IDC_SETTINGS_DSD_DEVICE_COMBO,8,36,156,33, + CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SETTINGS_DSD_FORMAT_COMBO,8,62,156,78, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Use DirectSound Exclusive Mode", + IDC_SETTINGS_EXCLUSIVE_CHECK,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,4,84,124,10 + CONTROL "Open 3D as Default",IDC_SETTINGS_OPEN3D_CHECK,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,132,84,86,10 + EDITTEXT IDC_SETTINGS_INITIALDIR_EDIT,4,108,114,14,ES_AUTOHSCROLL + PUSHBUTTON "Browse...",IDC_SETTINGS_BROWSE_INITIALDIR_BUTTON,120, + 108,38,14 + COMBOBOX IDC_SETTINGS_FOCUS_COMBO,164,108,58,45,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,172,8,50,14 + PUSHBUTTON "Cancel",IDCANCEL,172,25,50,14 + GROUPBOX "DirectSound Device",IDC_STATIC,4,4,164,76 + LTEXT "Preferred Device:",IDC_SETTINGS_DSD_DEVICE_TEXT,8,26,60, + 8 + LTEXT "Preferred Output Format:",IDC_STATIC,8,52,84,8 + LTEXT "Initial Directory:",IDC_STATIC,4,98,54,8 + LTEXT "Default Focus:",IDC_STATIC,164,98,52,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_BUFFER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 171 + TOPMARGIN, 7 + BOTTOMMARGIN, 115 + END + + IDD_BUFFER3D, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 249 + TOPMARGIN, 7 + BOTTOMMARGIN, 111 + END + + IDD_3DLISTENER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 127 + TOPMARGIN, 7 + BOTTOMMARGIN, 109 + END + + IDD_SETTINGS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 219 + TOPMARGIN, 7 + BOTTOMMARGIN, 119 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUFFERTYPE_HARDWARE "Hardware" + IDS_BUFFERTYPE_SOFTWARE "Software" + IDS_FOCUSMODE_LOCAL "Local" + IDS_FOCUSMODE_STICKY "Sticky" + IDS_FOCUSMODE_GLOBAL "Global" + IDS_GETPOSMODE_NORMAL "Normal" + IDS_GETPOSMODE_GETPOS2 "Accurate (DX2)" + IDS_DATAFORMAT_STEREO "%u Hz %u bit, Stereo" + IDS_DATAFORMAT_MONO "%u Hz %u bit, Mono" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sdk/samples/dsshow3d/fileinfo.cpp b/sdk/samples/dsshow3d/fileinfo.cpp new file mode 100644 index 0000000..591fe2b --- /dev/null +++ b/sdk/samples/dsshow3d/fileinfo.cpp @@ -0,0 +1,1470 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// FileInfo.cpp +// +// Implementation of the FileInfo class, which is the main class used to +// data and user interface elements associated with a sound buffer in DSShow3D. +// +// + + +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <dsound.h> +#include <commctrl.h> + +#include "DSShow3D.h" +#include "GVars.h" +#include "FileInfo.h" +#include "wave.h" +#include "debug.h" + + +int FileInfo::m_xNextPos = 0; +int FileInfo::m_yNextPos = 0; + +/////////////////////////////////////////////////////////////////////////////// +// FileInfo() +// +// Class constructor -- the pmw parameter defaults to NULL, but it should be +// something useful before the class is really used. +// +FileInfo::FileInfo( MainWnd *pmw ) +{ + m_pmwOwner = pmw; + m_pbData = NULL; + m_pwfx = NULL; + ZeroMemory( m_szFileName, sizeof(m_szFileName)); + m_nFileIndex = 0; + m_hwndInterface = NULL; + ZeroMemory( &m_ht, sizeof(HWNDTABLE)); + m_dwInternalFlags = 0; + m_fPlayButtonSaysPlay = TRUE; + + ZeroMemory( &m_dsbd, sizeof(DSBUFFERDESC)); + m_pDSB = NULL; +} + + +/////////////////////////////////////////////////////////////////////////////// +// ~FileInfo() +// +// Class destructor. +// +FileInfo::~FileInfo() +{ + m_pmwOwner = NULL; + + if( m_pDSB != NULL ) + { + m_pDSB->Release(); + m_pDSB = NULL; + } + if( m_pwfx ) + { + GlobalFree( m_pwfx ); + m_pwfx = NULL; + } + if( m_pbData ) + { + GlobalFree( m_pbData ); + m_pbData = NULL; + } +} + + +/////////////////////////////////////////////////////////////////////////////// +// SetFileName() +// +// Set the internal filename data variable and implicitly update the caption +// to reflect the change. +// +void FileInfo::SetFileName( LPSTR lpsz, int nIndx ) +{ + lstrcpy( m_szFileName, lpsz ); + m_nFileIndex = nIndx; + + // If this Assert fails, then we were handed a bad index value + ASSERT( m_nFileIndex < lstrlen( m_szFileName )); + + UpdateFileName(); +} + + +/////////////////////////////////////////////////////////////////////////////// +// LoadWave() +// +// Given a filename and an index to the partial filename (i.e. an index into +// the possibly full pathname where the actual filename begins), this function +// will do everything needed to load a file into the FileInfo structure. +// +// Returns 0 on success, non-zero on failure. +// +int FileInfo::LoadWave( LPSTR lpszFile, int nIndx ) +{ + SetFileName( lpszFile, nIndx ); + + // TODO: Need to add in support for ACM filters here + + // TODO: Need to determine what's "too big" to load static and then + // setup something for streaming the buffer instead. + if( WaveLoadFile( m_szFileName, &m_cbDataSize, &m_pwfx, &m_pbData ) != 0 ) + { + // There had better be a MainWnd object, or something is really messed + ASSERT( m_pmwOwner ); + m_pmwOwner->MessageBox( "Bad wave file or file too big to fit in memory", + MB_OK|MB_ICONSTOP ); + goto LW_Error; + } + + if( NewDirectSoundBuffer() != 0 ) + { + // There had better be a MainWnd object, or something is really messed + ASSERT( m_pmwOwner ); + m_pmwOwner->MessageBox( "Cannot create new DirectSoundBuffer object", + MB_OK|MB_ICONSTOP ); + goto LW_Error; + } + + m_dwInternalFlags |= FI_INTERNALF_LOADED; + + // If we haven't failed in loading so far, this point will be a valid + // pointer to the wave's data. + ASSERT( NULL != m_pbData ); + + // Create the ControlPod interface object + CreateInterface( m_pmwOwner->GetHwnd()); + + return 0; + +LW_Error: + return -1; +} + + +/////////////////////////////////////////////////////////////////////////////// +// NewDirectSoundBuffer() +// +// This function does all the work to create a new DirectSound buffer, and +// gets the interface pointers for both 2D and 3D (if the buffer is 3D). +// +int FileInfo::NewDirectSoundBuffer() + { + DSBCAPS dsbc; + HRESULT hr; + BYTE *pbWrite1 = NULL; + BYTE *pbWrite2 = NULL; + DWORD cbLen1; + DWORD cbLen2; + + /* Set up the direct sound buffer. */ + m_dsbd.dwSize = sizeof(DSBUFFERDESC); + + // We already set the flags to zero in the constructor. Don't do it again + // or we might wipe out anything a derived class has setup. + m_dsbd.dwFlags |= DSBCAPS_STATIC; + m_dsbd.dwFlags |= DSBCAPS_CTRLDEFAULT; // !!! default + // The derived class will pick its 3D flags + if( m_dwInternalFlags & IsSticky()) + { + ASSERT( !IsGlobal()); + m_dsbd.dwFlags |= DSBCAPS_STICKYFOCUS; + } + if( m_dwInternalFlags & IsGlobal()) + { + ASSERT( !IsSticky()); + m_dsbd.dwFlags |= DSBCAPS_GLOBALFOCUS; + } + + // This flag can only be set if the open dialog detected emulation and + // allowed the proper radio buttons to be enabled + if( m_dwInternalFlags & IsUsingGetPos2()) + m_dsbd.dwFlags |= DSBCAPS_GETCURRENTPOSITION2; + + m_dsbd.dwBufferBytes = m_cbDataSize; + m_dsbd.lpwfxFormat = m_pwfx; + + /* Make sure these are NULL before we start */ + m_pDSB = NULL; + + if( FAILED( hr = gpds->CreateSoundBuffer( &m_dsbd, &m_pDSB, NULL ))) + { + goto ERROR_IN_ROUTINE; + } + + /* Ok, lock the sucker down, and copy the memory to it. */ + if( FAILED( hr = m_pDSB->Lock( 0, m_cbDataSize, &pbWrite1, &cbLen1, + &pbWrite2, &cbLen2, 0L ))) + { + goto ERROR_IN_ROUTINE; + } + + ASSERT( pbWrite1 != NULL ); + ASSERT( cbLen1 == m_cbDataSize ); + + CopyMemory( pbWrite1, m_pbData, m_cbDataSize ); + + ASSERT( 0 == cbLen2 ); + ASSERT( NULL == pbWrite2 ); + + /* Ok, now unlock the buffer, we don't need it anymore. */ + if( FAILED( hr = m_pDSB->Unlock( pbWrite1, m_cbDataSize, pbWrite2, 0 ))) + { + goto ERROR_IN_ROUTINE; + } + + pbWrite1 = NULL; + + if (FAILED(hr = m_pDSB->SetVolume( MAXVOL_VAL ))) + { + goto ERROR_IN_ROUTINE; + } + + if (!Is3D()) { + if( FAILED( hr = m_pDSB->SetPan( MIDPAN_VAL ))) + { + goto ERROR_IN_ROUTINE; + } + } + + dsbc.dwSize = sizeof(dsbc); + if( hr = m_pDSB->GetCaps( &dsbc )) + { + goto ERROR_IN_ROUTINE; + } + + if( dsbc.dwFlags & DSBCAPS_LOCHARDWARE ) + { + m_dwInternalFlags |= FI_INTERNALF_HARDWARE; + } + else + { + m_dwInternalFlags &= ~FI_INTERNALF_HARDWARE; + } + + goto DONE_ROUTINE; + +ERROR_IN_ROUTINE: + if( pbWrite1 != NULL ) + { + hr = m_pDSB->Unlock( pbWrite1, m_cbDataSize, pbWrite2, 0 ); + pbWrite1 = NULL; + } + + if( NULL != m_pDSB ) + { + m_pDSB->Release(); + m_pDSB = NULL; + } + +DONE_ROUTINE: + return hr; + } + + +/////////////////////////////////////////////////////////////////////////////// +// SendDestroyRequest() +// +// Ask the owning window object to destroy us and remove any information +// it may be keeping about our existence. +// +void FileInfo::SendDestroyRequest() + { + // We must have an owner to send the request to. We should never + // have gotten any further than the CreateInterface() without one. + ASSERT( NULL != m_pmwOwner ); + + m_pmwOwner->DestroyFileInfo( this ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// SendDestroyRequest() +// +// Plays a buffer or updates playback flags according to some class state +// variables like our looping flag. +// +void FileInfo::PlayBuffer( void ) +{ + if( m_pDSB ) + { + if( IsLooped()) + m_pDSB->Play( 0, 0, DSBPLAY_LOOPING ); + else + m_pDSB->Play( 0, 0, 0 ); + + m_dwInternalFlags |= FI_INTERNALF_PLAYING; + } +} + + +/////////////////////////////////////////////////////////////////////////////// +// StopBuffer() +// +// Stop the buffer and reset it's position to the start. +// +void FileInfo::StopBuffer( void ) +{ + if( m_pDSB ) + { + m_pDSB->Stop(); + m_pDSB->SetCurrentPosition( 0 ); + + // Clear our internal state bit + m_dwInternalFlags &= ~FI_INTERNALF_PLAYING; + } +} + + +void FileInfo::Close( void ) + { + SendMessage( m_hwndInterface, WM_COMMAND, MAKELONG(IDCANCEL, 0), 0L ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// DuplicateBuffer() +// +// Initializes this FileInfo object by duplicating the given one. +// +void FileInfo::Duplicate( FileInfo *pfiSource ) + { + if( NULL == pfiSource || NULL == pfiSource->m_pDSB || + !(pfiSource->m_dwInternalFlags & FI_INTERNALF_LOADED)) + return; + + m_cbDataSize = pfiSource->m_cbDataSize; + m_nFileIndex = pfiSource->m_nFileIndex; + m_dwInternalFlags = pfiSource->m_dwInternalFlags; + m_pmwOwner = pfiSource->m_pmwOwner; + + m_pwfx = (PWAVEFORMATEX)new BYTE[sizeof(WAVEFORMATEX) + + pfiSource->m_pwfx->cbSize]; + m_pbData = new BYTE[pfiSource->m_cbDataSize]; + + CopyMemory( m_pbData, pfiSource->m_pbData, pfiSource->m_cbDataSize ); + CopyMemory( m_pwfx, pfiSource->m_pwfx, + sizeof(WAVEFORMATEX) + pfiSource->m_pwfx->cbSize); + CopyMemory( &m_dsbd, &pfiSource->m_dsbd, sizeof(m_dsbd)); + CopyMemory( &m_szFileName, pfiSource->m_szFileName, sizeof(m_szFileName)); + + ASSERT( NULL != pfiSource->m_pDSB ); + ASSERT( NULL != gpds ); + + HRESULT hr; + + if( FAILED( hr = gpds->DuplicateSoundBuffer(pfiSource->m_pDSB, &m_pDSB))) + { + DPF( 0, "Failed to DuplicateSoundBuffer() (%s)", TranslateDSError(hr)); + } + else + { + CreateInterface( m_pmwOwner->GetHwnd()); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// CreateInterface() +// +// Creates an interface window. A return of TRUE indicates success. +// +BOOL FileInfo::CreateInterface( HWND hwndOwner ) + { + m_hwndInterface = CreateDialogParam( ghInst, MAKEINTRESOURCE(IDD_BUFFER), + hwndOwner, (DLGPROC)FileInfoDlgProc, + (LPARAM)this ); + + if( NULL == m_hwndInterface ) + goto FICI_Fail; + + UpdateFileName(); + + CascadeWindow(); + + ShowWindow( m_hwndInterface, SW_SHOW ); + + // This flag tells us an interface window was successfully created + m_dwInternalFlags |= FI_INTERNALF_INTERFACE; + return TRUE; + + +FICI_Fail: + if( m_hwndInterface ) + { + DestroyWindow( m_hwndInterface ); + m_hwndInterface = NULL; + } + // Clear the flag that says we have a good interface window created + m_dwInternalFlags &= ~FI_INTERNALF_INTERFACE; + return FALSE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// ResetCascade() +// +// +// +void FileInfo::ResetCascade( void ) + { + POINT ptParent; + + ptParent.x = ptParent.y = 0; + ClientToScreen( m_pmwOwner->GetHwnd(), &ptParent ); + m_xNextPos = ptParent.x; + m_yNextPos = ptParent.y; + } + + +/////////////////////////////////////////////////////////////////////////////// +// MinimizeWindow() +// +// +// +void FileInfo::MinimizeWindow( void ) + { + ShowWindow( m_hwndInterface, SW_MINIMIZE ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// RestoreWindow() +// +// +// +void FileInfo::RestoreWindow( void ) + { + SendMessage( m_hwndInterface, WM_SYSCOMMAND, SC_RESTORE, 0L ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// CascadeWindow() +// +// +// +void FileInfo::CascadeWindow( void ) + { + RECT rcWind; + int nStep; + + // Don't move minimized windows + if( IsIconic( m_hwndInterface )) + return; + + GetWindowRect( m_hwndInterface, &rcWind ); + + if( m_xNextPos + (rcWind.right - rcWind.left) > GetSystemMetrics(SM_CXSCREEN)) + ResetCascade(); + else if( m_yNextPos + (rcWind.bottom - rcWind.top) > GetSystemMetrics(SM_CYSCREEN)) + ResetCascade(); + + SetWindowPos( m_hwndInterface, NULL, m_xNextPos, m_yNextPos, + 0, 0, SWP_NOSIZE | SWP_NOZORDER ); + // Move diagonally by the height of the title bar + nStep = GetSystemMetrics(SM_CYCAPTION); + m_xNextPos += nStep; + m_yNextPos += nStep; + } + + +/////////////////////////////////////////////////////////////////////////////// +// FileInfoDlgProc() +// +// Window message callback function for all Interface DLGs'. Route messages +// to message handler functions +// +BOOL CALLBACK FileInfoDlgProc( HWND hDlg, UINT message, + WPARAM wParam, LPARAM lParam ) + { + FileInfo *pfi; + + switch( message ) + { + // The first step is to stash our class object pointer in the user data + // and Initialize all our controls and internal data members. + case WM_INITDIALOG: + ASSERT( NULL != lParam ); + pfi = (FileInfo *)lParam; + SetWindowLong( hDlg, DWL_USER, (LONG)pfi ); + + if( !pfi->OnInitDialog( hDlg, wParam )) + { + DestroyWindow( hDlg ); + } + return TRUE; + + // By setting the global variable that tracks the active dialog, + // we can easily dispatch keyboard messages to the proper dialog + // through IsDialogMessage() in our main message pump. + case WM_ACTIVATE: + if( !wParam ) + ghDlgActive = NULL; + else + ghDlgActive = hDlg; + return TRUE; + + case WM_INITMENU: + pfi = (FileInfo*)GetWindowLong( hDlg, DWL_USER ); + ASSERT( NULL != pfi ); + return pfi->OnInitMenu( wParam, lParam ); + + case WM_DROPFILES: + pfi = (FileInfo*)GetWindowLong( hDlg, DWL_USER ); + ASSERT( NULL != pfi ); + return pfi->m_pmwOwner->SendMessage( WM_DROPFILES, wParam, lParam ); + + case WM_COMMAND: + pfi = (FileInfo*)GetWindowLong( hDlg, DWL_USER ); + ASSERT( NULL != pfi ); + return pfi->OnCommand( wParam, lParam ); + + // Handle this to deal with right-clicks on our controls -- we have a + // bunch of different context menus that we can popup + case WM_CONTEXTMENU: + pfi = (FileInfo*)GetWindowLong( hDlg, DWL_USER ); + ASSERT( NULL != pfi ); + return pfi->OnContextMenu( hDlg, LOWORD(lParam), HIWORD(lParam)); + + // Trackbar slider notifications come through here + case WM_HSCROLL: + pfi = (FileInfo*)GetWindowLong( hDlg, DWL_USER ); + ASSERT( NULL != pfi ); + return pfi->OnHScroll( LOWORD(wParam), (LONG)HIWORD(wParam), (HWND)lParam ); + + case WM_DESTROY: + pfi = (FileInfo*)GetWindowLong( hDlg, DWL_USER ); + ASSERT( NULL != pfi ); + pfi->OnDestroy(); + return TRUE; + + default: + return FALSE; + } + + ASSERT( FALSE ); + } + + +/* OnInitMenu() + * + * Updates the state of items on the menus in response to a WM_INITMENU + * message, which means the menu is about to be displayed. + */ +BOOL FileInfo::OnInitMenu( WPARAM wParam, LPARAM lParam ) + { + HMENU hSys = GetSystemMenu( m_hwndInterface, FALSE ); + + EnableMenuItem( hSys, SC_MAXIMIZE, MF_BYCOMMAND | MF_GRAYED ); + EnableMenuItem( hSys, SC_SIZE, MF_BYCOMMAND | MF_GRAYED ); + return TRUE; + } + + +/* OnInitDialog() + * + * Handles the initialization of the FilInfo interface window, which is + * actually a modeless dialog. + */ +BOOL FileInfo::OnInitDialog( HWND hDlg, WPARAM wParam ) + { + TCHAR szBuf1[64], tszFmt[64]; + + // Grab a bunch of handles and store them for easy access later + m_ht.hPlayButton = GetDlgItem( hDlg, IDC_BUFFERDLG_PLAY_BUTTON ); + m_ht.hLoopedCheck = GetDlgItem( hDlg, IDC_BUFFERDLG_LOOPED_CHECK ); + m_ht.hProgressSlider = GetDlgItem( hDlg, IDC_BUFFERDLG_PROGRESS_SLIDER ); + m_ht.hProgressText = GetDlgItem( hDlg, IDC_BUFFERDLG_PROGRESS_TEXT ); + m_ht.hProgressSpin = GetDlgItem( hDlg, IDC_BUFFERDLG_PROGRESS_SPIN ); + m_ht.hFreqText = GetDlgItem( hDlg, IDC_BUFFERDLG_FREQ_TEXT ); + m_ht.hFreqSlider = GetDlgItem( hDlg, IDC_BUFFERDLG_FREQ_SLIDER ); + m_ht.hVolText = GetDlgItem( hDlg, IDC_BUFFERDLG_VOL_TEXT ); + m_ht.hVolSlider = GetDlgItem( hDlg, IDC_BUFFERDLG_VOL_SLIDER ); + m_ht.hPanText = GetDlgItem( hDlg, IDC_BUFFERDLG_PAN_TEXT ); + m_ht.hPanSlider = GetDlgItem( hDlg, IDC_BUFFERDLG_PAN_SLIDER ); + m_ht.hPlayCursorText = GetDlgItem( hDlg, IDC_BUFFERDLG_PLAYCURSOR_TEXT ); + m_ht.hWriteCursorText = GetDlgItem( hDlg, IDC_BUFFERDLG_WRITECURSOR_TEXT ); + m_ht.hDataFormatText = GetDlgItem( hDlg, IDC_BUFFERDLG_DATAFORMAT_TEXT ); + m_ht.hBufferTypeText = GetDlgItem( hDlg, IDC_BUFFERDLG_BUFFERTYPE_TEXT ); + m_ht.hFocusModeText = GetDlgItem( hDlg, IDC_BUFFERDLG_FOCUS_TEXT ); + m_ht.hGetPosModeText = GetDlgItem( hDlg, IDC_BUFFERDLG_GETPOS_TEXT ); + + // Load, fill in and set the string describing the format of the sound data + if( m_pwfx->nChannels == 1 ) + LoadString( ghInst, IDS_DATAFORMAT_MONO, tszFmt, sizeof(tszFmt)-1); + else + LoadString( ghInst, IDS_DATAFORMAT_STEREO, tszFmt, sizeof(tszFmt)-1); + wsprintf( szBuf1, tszFmt, m_pwfx->nSamplesPerSec, m_pwfx->wBitsPerSample ); + + Static_SetText( m_ht.hDataFormatText, szBuf1 ); + + // Set the Buffer Type text to HARDWARE or SOFTWARE + if( IsHardware()) + LoadString( ghInst, IDS_BUFFERTYPE_HARDWARE, szBuf1, sizeof(szBuf1)-1); + else + LoadString( ghInst, IDS_BUFFERTYPE_SOFTWARE, szBuf1, sizeof(szBuf1)-1); + Static_SetText( m_ht.hBufferTypeText, szBuf1 ); + + // Set the focus type to LOCAL, STICKY, or GLOBAL + if( IsSticky()) + LoadString( ghInst, IDS_FOCUSMODE_STICKY, szBuf1, sizeof(szBuf1)-1); + else if( IsGlobal()) + LoadString( ghInst, IDS_FOCUSMODE_GLOBAL, szBuf1, sizeof(szBuf1)-1); + else + LoadString( ghInst, IDS_FOCUSMODE_LOCAL, szBuf1, sizeof(szBuf1)-1); + Static_SetText( m_ht.hFocusModeText, szBuf1 ); + + if( Is3D()) + { + Static_Enable( m_ht.hPanText, FALSE ); + Static_Enable( m_ht.hPanSlider, FALSE ); + } + + // Set the range, page size, etc. of our "slider" (trackbar) controls + SetSliders(); + + // Update the state of the UI elements that change + UpdateUI(); + return TRUE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// OnContextMenu() +// +// Handles a right-click in the client area by popping up a menu if we have +// one we'd like to display, or returning otherwise. TRUE indicates the message +// was "handled" and no further processing is needed. FALSE means the message +// was not handled. +// +BOOL FileInfo::OnContextMenu( HWND hwnd, int x, int y ) + { + HMENU hm, hSub; + int nSubMenu = -1, idFrom = 0; + POINT pt = { x, y }; + RECT rectWind1, rectWind2; + + // Set the sub-menu to the Frequency context menu if we hit the Freq. Slider + // or text control + GetWindowRect( m_ht.hFreqSlider, &rectWind1 ); + GetWindowRect( m_ht.hFreqText, &rectWind2 ); + + if( PtInRect( &rectWind1, pt ) || PtInRect( &rectWind2, pt )) + nSubMenu = 0; + + // Set the sub-menu to the Volume context menu if we hit the Vol. Slider + // or text control + GetWindowRect( m_ht.hVolSlider, &rectWind1 ); + GetWindowRect( m_ht.hVolText, &rectWind2 ); + + if( PtInRect( &rectWind1, pt ) || PtInRect( &rectWind2, pt )) + nSubMenu = 1; + + // Only have pan on non-3D buffers + if (!Is3D()) + { + // Set the sub-menu to the Pan context menu if we hit the Pan Slider + // or text control + GetWindowRect( m_ht.hPanSlider, &rectWind1 ); + GetWindowRect( m_ht.hPanText, &rectWind2 ); + + if( PtInRect( &rectWind1, pt ) || PtInRect( &rectWind2, pt )) + nSubMenu = 2; + } + + // We didn't detect any "interesting" hotspots, so return as unprocessed. + if( nSubMenu < 0 ) + return FALSE; + + // If we make it here, we're gonna popup a context menu of some sort + + // Attempt to load our menu. If we fail, we still handled the message + // so return TRUE + if(( hm = LoadMenu( ghInst, MAKEINTRESOURCE(IDM_POPUPS))) == NULL ) + return TRUE; + + hSub = GetSubMenu( hm, nSubMenu ); + TrackPopupMenu( hSub, TPM_LEFTALIGN | TPM_RIGHTBUTTON, + pt.x, pt.y, 0, m_hwndInterface, NULL ); + + DestroyMenu( hm ); + + return TRUE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// SetSliders() +// +// Sets the range, page size, tic frequency, and other parameters of all the +// trackbar controls we use in the interface. +// +void FileInfo::SetSliders( void ) + { + DWORD dSampleRateRange = FREQ_SLIDER_MAX - FREQ_SLIDER_MIN; + UDACCEL udAccel; + + // Scale the sample rate range into an acceptable span and keep + // track of the multiplying constant we'll have to use later when + // we want to set positions based on real values + m_dwFreqSliderFactor = 1; + while( dSampleRateRange > 10000 ) + { + dSampleRateRange /= 10; + m_dwFreqSliderFactor *= 10; + } + + SendMessage( m_ht.hFreqSlider, TBM_SETRANGEMIN, + FALSE, (LPARAM)FREQ_SLIDER_MIN / m_dwFreqSliderFactor ); + SendMessage( m_ht.hFreqSlider, TBM_SETRANGEMAX, + FALSE, (LPARAM)FREQ_SLIDER_MAX / m_dwFreqSliderFactor ); + SendMessage( m_ht.hFreqSlider, TBM_SETPAGESIZE, 0, + FREQ_SLIDER_PAGESIZE_HZ / m_dwFreqSliderFactor ); + + SendMessage( m_ht.hProgressSpin, UDM_SETBUDDY, (WPARAM)m_ht.hProgressSlider, 0 ); + SendMessage( m_ht.hProgressSpin, UDM_SETRANGE, 0, MAKELONG(PROGRESS_MAX, PROGRESS_MIN)); + SendMessage( m_ht.hProgressSpin, UDM_SETPOS, 0, MAKELONG(0,0)); + udAccel.nSec = 0; + udAccel.nInc = PROGRESS_MAX / 20; + SendMessage( m_ht.hProgressSpin, UDM_SETACCEL, 1, (LPARAM)&udAccel ); + + SendMessage( m_ht.hProgressSlider, TBM_SETRANGEMIN, FALSE, (LPARAM)PROGRESS_MIN ); + SendMessage( m_ht.hProgressSlider, TBM_SETRANGEMAX, FALSE, (LPARAM)PROGRESS_MAX ); + SendMessage( m_ht.hProgressSlider, TBM_SETPAGESIZE, FALSE, (LPARAM)PROGRESS_MAX / 20 ); + SendMessage( m_ht.hProgressSlider, TBM_SETTICFREQ, (WPARAM)PROGRESS_TIC, 0 ); + + // Intentionally set the range backwards because a large number means + // a smaller value + SendMessage( m_ht.hVolSlider, TBM_SETRANGEMIN, FALSE, + (LPARAM)(VOL_MIN + VOL_SLIDER_SHIFT) / VOL_SLIDER_FACTOR ); + SendMessage( m_ht.hVolSlider, TBM_SETRANGEMAX, FALSE, + (LPARAM)(VOL_MAX + VOL_SLIDER_SHIFT) / VOL_SLIDER_FACTOR ); + SendMessage( m_ht.hVolSlider, TBM_SETPAGESIZE, 0, + VOL_SLIDER_PAGE / VOL_SLIDER_FACTOR ); + // NOTE: No TICs on the volume slider + + SendMessage( m_ht.hPanSlider, TBM_SETRANGEMIN, FALSE, + (LPARAM)(PAN_MIN + PAN_SLIDER_SHIFT) / PAN_SLIDER_FACTOR ); + SendMessage( m_ht.hPanSlider, TBM_SETRANGEMAX, FALSE, + (LPARAM)(PAN_MAX + PAN_SLIDER_SHIFT) / PAN_SLIDER_FACTOR ); + SendMessage( m_ht.hPanSlider, TBM_SETPAGESIZE, 0, + PAN_SLIDER_PAGE / PAN_SLIDER_FACTOR ); + // NOTE: No TICs on the pan slider + + // Update the display from the buffer's current settings + UpdateFreqUI( 0, TRUE ); + UpdateVolUI( 0, TRUE ); + UpdatePanUI( 0, TRUE ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdateUI() +// +// This function is normally called from the MainWnd object's timer handler +// to refresh the UI elements that are time-dependent. These are things like +// the play and write cursors and the progress. +// +void FileInfo::UpdateUI( void ) + { + char szText[8]; + DWORD dwStatus, dwPlay, dwWrite; + + if( NULL == m_pDSB ) + return; + + if( FAILED( m_pDSB->GetStatus( &dwStatus ))) + return; + + if( dwStatus & DSBSTATUS_BUFFERLOST ) + { + LPBYTE pb1, pb2; + DWORD cb1, cb2; + + if( SUCCEEDED( m_pDSB->Restore())) + { + if( SUCCEEDED( m_pDSB->Lock( 0, m_cbDataSize, &pb1, &cb1, &pb2, &cb2, 0 ))) + { + ASSERT( m_cbDataSize == cb1 ); + if( NULL != m_pbData ) + CopyMemory( pb1, m_pbData, m_cbDataSize ); + m_pDSB->Unlock( pb1, m_cbDataSize, pb2, 0 ); + + if(IsPlaying()) + PlayBuffer(); + } + } + } + else + { + if( dwStatus & DSBSTATUS_PLAYING ) + SetPlaying( TRUE ); + else + SetPlaying( FALSE ); + } + + Button_SetCheck( m_ht.hLoopedCheck, IsLooped()); + + UpdatePlayButton(); + + m_pDSB->GetCurrentPosition( &dwPlay, &dwWrite ); + wsprintf( szText, "%u", dwPlay ); + Static_SetText( m_ht.hPlayCursorText, szText ); + wsprintf( szText, "%u", dwWrite ); + Static_SetText( m_ht.hWriteCursorText, szText ); + + UpdateProgressUI( dwPlay ); + + return; + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdateProgressUI() +// +// +// +void FileInfo::UpdateProgressUI( DWORD dwPlayPos ) + { + char szText[8]; + FLOAT fPercentage; + + // TODO: Set the progress slider position + fPercentage = ((FLOAT)dwPlayPos / (FLOAT)(m_cbDataSize-1)); + + SendMessage( m_ht.hProgressSlider, TBM_SETPOS, TRUE, (LPARAM)(PROGRESS_MAX * fPercentage)); + SendMessage( m_ht.hProgressSpin, UDM_SETPOS, TRUE, MAKELONG((PROGRESS_MAX * fPercentage), 0)); + + wsprintf( szText, "%i%%", (int)(100 * fPercentage)); + Static_SetText( m_ht.hProgressText, szText ); + } + +/////////////////////////////////////////////////////////////////////////////// +// UpdateVolUI() +// +// Updates the position of the volume slider and text. You can specify that +// it get the volume from the buffer by passing TRUE to fFromBuffer, or you can +// specify a volume by putting it in lForceVol and setting fFromBuffer = FALSE. +// +void FileInfo::UpdateVolUI( LONG lForceVol, BOOL fFromBuffer ) + { + LONG lVol; + char szText[16]; + + if( fFromBuffer ) + { + if( NULL != m_pDSB ) + { + m_pDSB->GetVolume( &lVol ); + } + else + lVol = 0; + } + else + lVol = lForceVol; + + SendMessage( m_ht.hVolSlider, TBM_SETPOS, (WPARAM)TRUE, + (LPARAM)(lVol + VOL_SLIDER_SHIFT) / VOL_SLIDER_FACTOR ); + + // Print volume in decibels + wsprintf( szText, "%i dB", lVol / 100 ); + + Static_SetText( m_ht.hVolText, szText ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdatePanUI() +// +// Updates the position of the panning slider and text. You can specify that +// it get the pan from the buffer by passing TRUE to fFromBuffer, or you can +// specify a pan by putting it in lForcePan and setting fFromBuffer = FALSE. +// +void FileInfo::UpdatePanUI( LONG lForcePan, BOOL fFromBuffer ) + { + LONG lPan; + char szText[16]; + + if ( Is3D()) + { + lForcePan = 0; + fFromBuffer = FALSE; + } + + if( fFromBuffer ) + { + if( NULL != m_pDSB ) + { + m_pDSB->GetPan( &lPan ); + } + else + lPan = 0; + } + else + lPan = lForcePan; + + SendMessage( m_ht.hPanSlider, TBM_SETPOS, (WPARAM)TRUE, + (LPARAM)(lPan + PAN_SLIDER_SHIFT) / PAN_SLIDER_FACTOR ); + + // Print pan in decibels + wsprintf( szText, "%i dB", lPan / 100 ); + + Static_SetText( m_ht.hPanText, szText ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdateFreqUI() +// +// Updates the position of the freq slider and text. You can specify that +// it get the freq from the buffer by passing TRUE to fFromBuffer, or you can +// specify a freq by putting it in dwForceFreq and setting fFromBuffer = FALSE. +// +void FileInfo::UpdateFreqUI( DWORD dwForceFreq, BOOL fFromBuffer ) + { + DWORD dwFreq; + char szText[16]; + + if( fFromBuffer ) + { + if( NULL != m_pDSB ) + m_pDSB->GetFrequency( &dwFreq ); + else + dwFreq = 0; + } + else + dwFreq = dwForceFreq; + + SendMessage( m_ht.hFreqSlider, TBM_SETPOS, + (WPARAM)TRUE, (LPARAM)dwFreq / m_dwFreqSliderFactor ); + + wsprintf( szText, "%u Hz", dwFreq ); + + Static_SetText( m_ht.hFreqText, szText ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdatePlayButton() +// +// Uses an internal state flag and the "IsPlaying" flag to determine and set +// the proper text (Play/Stop) for the Play button. +// +void FileInfo::UpdatePlayButton( void ) + { + if( m_fPlayButtonSaysPlay && IsPlaying()) + { + // Set to "Stop" + m_fPlayButtonSaysPlay = FALSE; + Button_SetText( m_ht.hPlayButton, TEXT("Stop")); + } + else if( !m_fPlayButtonSaysPlay && !IsPlaying()) + { + // Set to "Play" + Button_SetText( m_ht.hPlayButton, TEXT("Play")); + m_fPlayButtonSaysPlay = TRUE; + } + else + return; + } + + +/////////////////////////////////////////////////////////////////////////////// +// OnHScroll() +// +// Main message handler for the WM_HSCROLL message. this function basically +// figures out which horizontal scrolling control is responsible for sending +// the message and passes on handling to an appropriate function for handling. +// +BOOL FileInfo::OnHScroll( WORD wNotification, LONG lPos, HWND hControl ) + { + if( !hControl ) + return FALSE; + + if( hControl == m_ht.hProgressSpin ) + { + HandleProgressSpinScroll( wNotification, lPos ); + return TRUE; + } + else if( hControl == m_ht.hProgressSlider ) + { + HandleProgressSliderScroll( wNotification, lPos ); + return TRUE; + } + else if( hControl == m_ht.hFreqSlider ) + { + HandleFreqSliderScroll( wNotification, lPos ); + return TRUE; + } + else if( hControl == m_ht.hVolSlider ) + { + HandleVolSliderScroll( wNotification, lPos ); + return TRUE; + } + else if( hControl == m_ht.hPanSlider ) + { + HandlePanSliderScroll( wNotification, lPos ); + return TRUE; + } + else + return FALSE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// HandleFreqSliderScroll() +// +// Helper function for OnHScroll() which handles the WM_HSCROLL message for +// the Frequency slider. Figures out the next position, sets it, and updates +// the UI elements that are affected (text). +// +void FileInfo::HandleFreqSliderScroll( WORD wNot, LONG lPos ) + { + DWORD dwFreq; + + switch( wNot ) + { + case TB_THUMBTRACK: + if( NULL != m_pDSB ) + { + if( SUCCEEDED( m_pDSB->SetFrequency( lPos * m_dwFreqSliderFactor ))) + { + UpdateFreqUI( lPos * m_dwFreqSliderFactor, FALSE ); + } + } + break; + + case TB_ENDTRACK: + case TB_LINEDOWN: + case TB_LINEUP: + case TB_PAGEDOWN: + case TB_PAGEUP: + lPos = SendMessage( m_ht.hFreqSlider, TBM_GETPOS, 0, 0 ); + if( NULL != m_pDSB ) + { + if( SUCCEEDED( m_pDSB->SetFrequency( lPos * m_dwFreqSliderFactor ))) + { + UpdateFreqUI( lPos * m_dwFreqSliderFactor, FALSE ); + } + else + { + if( SUCCEEDED( m_pDSB->GetFrequency( &dwFreq ))) + { + SendMessage( m_ht.hFreqSlider, TBM_SETPOS, + TRUE, dwFreq / m_dwFreqSliderFactor ); + } + } + } + break; + } + + } + + +/////////////////////////////////////////////////////////////////////////////// +// HandleProgressSliderScroll() +// +// +// +void FileInfo::HandleProgressSliderScroll( WORD wNot, LONG lPos ) + { + BOOL fUpdate = TRUE; + + switch( wNot ) + { + case TB_THUMBTRACK: + if( IsPlaying()) + fUpdate = FALSE; + break; + + case TB_ENDTRACK: + fUpdate = FALSE; + break; + case TB_LINEDOWN: + case TB_LINEUP: + case TB_PAGEDOWN: + case TB_PAGEUP: + lPos = SendMessage( m_ht.hProgressSlider, TBM_GETPOS, 0, 0 ); + break; + + default: + fUpdate = FALSE; + } + + if( fUpdate && NULL != m_pDSB ) + { + FLOAT fPercentage = ((FLOAT)lPos / 10000); + + m_pDSB->SetCurrentPosition( (DWORD)(fPercentage * (m_cbDataSize-1))); + UpdateUI(); +// UpdateProgressUI( (DWORD)(fPercentage * (m_cbDataSize-1))); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// HandleProgressSpinScroll() +// +// +// +void FileInfo::HandleProgressSpinScroll( WORD wNot, LONG lPos ) + { + BOOL fUpdate = TRUE; + + switch( wNot ) + { + case SB_THUMBPOSITION: + lPos = SendMessage( m_ht.hProgressSpin, UDM_GETPOS, 0, 0 ); + break; + + default: + fUpdate = FALSE; + } + + if( fUpdate && NULL != m_pDSB ) + { + FLOAT fPercentage = ((FLOAT)lPos / 10000); + + m_pDSB->SetCurrentPosition( (DWORD)(fPercentage * (m_cbDataSize-1))); + UpdateUI(); + UpdateProgressUI( (DWORD)(fPercentage * (m_cbDataSize-1))); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// HandleVolSliderScroll() +// +// Helper function for OnHScroll() which handles the WM_HSCROLL message for +// the Volume slider. Figures out the next position, sets it, and updates +// the UI elements that are affected (text). +// +void FileInfo::HandleVolSliderScroll( WORD wNot, LONG lPos ) + { + BOOL fUpdate = TRUE; + + switch( wNot ) + { + case TB_THUMBTRACK: + break; + + case TB_ENDTRACK: + case TB_LINEDOWN: + case TB_LINEUP: + case TB_PAGEDOWN: + case TB_PAGEUP: + lPos = SendMessage( m_ht.hVolSlider, TBM_GETPOS, 0, 0 ); + break; + + default: + fUpdate = FALSE; + } + + if( fUpdate && NULL != m_pDSB ) + { + m_pDSB->SetVolume( (lPos * VOL_SLIDER_FACTOR) - VOL_SLIDER_SHIFT ); + DPF( 1, "SetVolume: %i", (lPos * VOL_SLIDER_FACTOR) - VOL_SLIDER_SHIFT ); + UpdateVolUI( (lPos * VOL_SLIDER_FACTOR) - VOL_SLIDER_SHIFT, FALSE ); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// HandlePanSliderScroll() +// +// Helper function for OnHScroll() which handles the WM_HSCROLL message for +// the Pan slider. Figures out the next position, sets it, and updates the UI +// elements that are affected (text). +// +void FileInfo::HandlePanSliderScroll( WORD wNot, LONG lPos ) + { + BOOL fUpdate = TRUE; + + switch( wNot ) + { + case TB_THUMBTRACK: + break; + + case TB_ENDTRACK: + case TB_LINEDOWN: + case TB_LINEUP: + case TB_PAGEDOWN: + case TB_PAGEUP: + lPos = SendMessage( m_ht.hPanSlider, TBM_GETPOS, 0, 0 ); + break; + + default: + fUpdate = FALSE; + } + + if( fUpdate && NULL != m_pDSB ) + { + m_pDSB->SetPan( (lPos * PAN_SLIDER_FACTOR) - PAN_SLIDER_SHIFT ); + UpdatePanUI( (lPos * PAN_SLIDER_FACTOR) - PAN_SLIDER_SHIFT, FALSE ); + } + } + + +/* OnDestroy() + * + */ +void FileInfo::OnDestroy() + { + SendDestroyRequest(); + return; + } + + +/////////////////////////////////////////////////////////////////////////////// +// OnCommand() +// +// Handles WM_COMMAND messages sent to the dialog interface. +// +BOOL FileInfo::OnCommand( WPARAM wParam, LPARAM lParam ) + { + ASSERT( NULL != m_hwndInterface ); + + // These three functions break out the handling of the WM_COMMAND messages + // that will be sent by various context menus. There's no real difference + // between these and other messages, but keeping them seperate emphasizes + // where they come from and keeps our switch a bit shorter. + if( HandleFreqContext( wParam ) || HandleVolContext( wParam ) + || HandlePanContext( wParam )) + { + return TRUE; + } + + switch( LOWORD( wParam )) + { + case ID_BUFFERDLG_FILE_OPEN: + // For convenience, the File|Open command is on the dialog's menu. + // If we see it, we should reflect it to the parent for processing. + ASSERT( NULL != m_pmwOwner ); + SendMessage( m_pmwOwner->GetHwnd(), WM_COMMAND, + MAKEWPARAM( IDC_FILE_OPEN, 0 ), 0L ); + break; + + case ID_BUFFERDLG_DUPLICATE: + m_pmwOwner->DuplicateBuffer( this ); + break; + + case IDCANCEL: + // This is what the dialog subsystem will send us when the user + // clicks the Close button from the caption bar or the System menu + DestroyWindow( m_hwndInterface ); + break; + + case IDC_BUFFERDLG_PLAY_BUTTON: + // Handle the Play button depending on whether or not the buffer is + // playing or stopped. + if( IsPlaying()) + { + StopBuffer(); + } + else + { + PlayBuffer(); + } + UpdatePlayButton(); + break; + + case IDC_BUFFERDLG_LOOPED_CHECK: + // Toggle the state of the looping flag with an XOR + m_dwInternalFlags ^= FI_INTERNALF_LOOPED; + + // Calling Play will update the looping state in DSound + if( IsPlaying()) + PlayBuffer(); + break; + + default: + // FALSE means we didn't want to deal with the message + return FALSE; + } + + // TRUE means we processed the message + return TRUE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdateFileName() +// +// Updates the file name which is displayed in the dialog window caption. +// +void FileInfo::UpdateFileName( void ) + { + if( NULL != m_hwndInterface ) + { + SendMessage( m_hwndInterface, WM_SETTEXT, 0L, + (LPARAM)&m_szFileName[m_nFileIndex] ); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// HandlePanContext() +// +// Handle WM_COMMAND messages from the Pan context menu. Returns TRUE if a +// message was handled. +// +BOOL FileInfo::HandlePanContext( WPARAM wParam ) + { + switch( LOWORD( wParam )) + { + case ID_PANCONTEXT_CENTER: + if( m_pDSB ) + { + m_pDSB->SetPan(0); + UpdatePanUI( 0, FALSE ); + } + break; + case ID_PANCONTEXT_10DB_LEFT: + if( m_pDSB ) + { + m_pDSB->SetPan(-1000); + UpdatePanUI( -1000, FALSE ); + } + break; + case ID_PANCONTEXT_10DB_RIGHT: + if( m_pDSB ) + { + m_pDSB->SetPan(1000); + UpdatePanUI( 1000, FALSE ); + } + break; + case ID_PANCONTEXT_FULL_LEFT: + if( m_pDSB ) + { + m_pDSB->SetPan(-10000); + UpdatePanUI( -10000, FALSE ); + } + break; + case ID_PANCONTEXT_FULL_RIGHT: + if( m_pDSB ) + { + m_pDSB->SetPan(10000); + UpdatePanUI( 10000, FALSE ); + } + break; + + default: + return FALSE; + } + + return TRUE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// HandleVolContext() +// +// Handle WM_COMMAND messages from the Vol context menu. Returns TRUE if a +// message was handled. +// +BOOL FileInfo::HandleVolContext( WPARAM wParam ) + { + switch( LOWORD( wParam )) + { + case ID_VOLCONTEXT_0DB: + if( m_pDSB ) + { + m_pDSB->SetVolume(0); + UpdateVolUI( 0, FALSE ); + } + break; + case ID_VOLCONTEXT_10DB: + if( m_pDSB ) + { + m_pDSB->SetVolume(-1000); + UpdateVolUI( -1000, FALSE ); + } + break; + case ID_VOLCONTEXT_20DB: + if( m_pDSB ) + { + m_pDSB->SetVolume(-2000); + UpdateVolUI( -2000, FALSE ); + } + break; + case ID_VOLCONTEXT_30DB: + if( m_pDSB ) + { + m_pDSB->SetVolume(-3000); + UpdateVolUI( -3000, FALSE ); + } + break; + case ID_VOLCONTEXT_100DB: + if( m_pDSB ) + { + m_pDSB->SetVolume(-10000); + UpdateVolUI( -10000, FALSE ); + } + break; + + default: + return FALSE; + } + + return TRUE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// HandleFreqContext() +// +// Handle WM_COMMAND messages from the Freq context menu. Returns TRUE if a +// message was handled. +// +BOOL FileInfo::HandleFreqContext( WPARAM wParam ) + { + switch( LOWORD( wParam )) + { + case ID_FREQCONTEXT_FILEDEFAULT: + if( m_pDSB ) + { + if( SUCCEEDED( m_pDSB->SetFrequency(m_pwfx->nSamplesPerSec))) + UpdateFreqUI( m_pwfx->nSamplesPerSec, FALSE ); + } + break; + + case ID_FREQCONTEXT_8000HZ: + if( m_pDSB ) + { + if( SUCCEEDED( m_pDSB->SetFrequency(8000))) + UpdateFreqUI( 8000, FALSE ); + } + break; + + case ID_FREQCONTEXT_11025HZ: + if( m_pDSB ) + { + if( SUCCEEDED( m_pDSB->SetFrequency(11025))) + UpdateFreqUI( 11025, FALSE ); + } + break; + + case ID_FREQCONTEXT_22050HZ: + if( m_pDSB ) + { + if( SUCCEEDED( m_pDSB->SetFrequency(22050))) + UpdateFreqUI( 22050, FALSE ); + } + break; + + case ID_FREQCONTEXT_44100HZ: + if( m_pDSB ) + { + if( SUCCEEDED( m_pDSB->SetFrequency(44100))) + UpdateFreqUI( 44100, FALSE ); + } + break; + + default: + return FALSE; + } + return TRUE; + } + diff --git a/sdk/samples/dsshow3d/fileinfo.h b/sdk/samples/dsshow3d/fileinfo.h new file mode 100644 index 0000000..0ab6b8a --- /dev/null +++ b/sdk/samples/dsshow3d/fileinfo.h @@ -0,0 +1,194 @@ +#ifndef __FILEINFO_H__ +#define __FILEINFO_H__ + + +#include <windows.h> +#include <mmsystem.h> +#include <dsound.h> + +#define FREQ_SLIDER_PAGESIZE_HZ 1000 // Move 1000 Hz per page +#define FREQ_SLIDER_MAX 100000 +#define FREQ_SLIDER_MIN 100 + +#define VOL_SLIDER_FACTOR 100 // Scaling factor +#define VOL_SLIDER_SHIFT 10000 // Offset (guarantees >0 range) +#define VOL_SLIDER_PAGE 500 +#define VOL_MIN -10000 +#define VOL_MAX 0 + +#define PAN_SLIDER_FACTOR 100 // Scaling factor +#define PAN_SLIDER_SHIFT 10000 // Offset (guarantees >0 range) +#define PAN_SLIDER_PAGE 500 +#define PAN_MIN -10000 +#define PAN_MAX 10000 + +#define PROGRESS_MIN 0 +#define PROGRESS_MAX 10000 +#define PROGRESS_TIC 1000 + +// Internal class state flags +#define FI_INTERNALF_3D 0x00000001 +#define FI_INTERNALF_HARDWARE 0x00000002 +#define FI_INTERNALF_LOOPED 0x00000004 +#define FI_INTERNALF_PLAYING 0x00000008 +#define FI_INTERNALF_LOST 0x00000010 +#define FI_INTERNALF_LOADED 0x00000020 +#define FI_INTERNALF_STATIC 0x00000040 +#define FI_INTERNALF_STREAMING 0x00000080 +#define FI_INTERNALF_USEGETPOS2 0x00000100 +#define FI_INTERNALF_INTERFACE 0x00000200 +#define FI_INTERNALF_STICKY 0x00000400 +#define FI_INTERNALF_GLOBAL 0x00000800 + +typedef struct tag_hwtable +{ + HWND hLoopedCheck; + HWND hProgressSlider, hProgressText, hProgressSpin; + HWND hFreqText, hFreqSlider; + HWND hVolText, hVolSlider; + HWND hPanText, hPanSlider; + HWND hDataFormatText; + HWND hPlayCursorText, hWriteCursorText; + HWND hBufferTypeText, hFocusModeText, hGetPosModeText; + HWND hPlayButton; + +} HWNDTABLE, *PHWNDTABLE; + +class FileInfo +{ +friend BOOL CALLBACK FileInfoDlgProc( HWND, UINT, WPARAM, LPARAM ); + +// Useful protected member functions +protected: + virtual BOOL OnInitDialog( HWND, WPARAM ); + virtual BOOL OnInitMenu( WPARAM, LPARAM ); + virtual BOOL OnCommand( WPARAM, LPARAM ); + virtual BOOL OnHScroll( WORD, LONG, HWND ); + virtual BOOL OnContextMenu( HWND, int, int ); + virtual void OnDestroy(); + + virtual BOOL CreateInterface( HWND ); + virtual void UpdateFileName( void ); + void UpdatePlayButton( void ); + + virtual void SetSliders( void ); + + void UpdateProgressUI( DWORD ); + void UpdateVolUI( LONG, BOOL ); + void UpdatePanUI( LONG, BOOL ); + void UpdateFreqUI( DWORD, BOOL ); + + void HandleFreqSliderScroll( WORD, LONG ); + void HandleVolSliderScroll( WORD, LONG ); + void HandlePanSliderScroll( WORD, LONG ); + void HandleProgressSliderScroll( WORD, LONG ); + void HandleProgressSpinScroll( WORD, LONG ); + + BOOL HandleFreqContext( WPARAM ); + BOOL HandleVolContext( WPARAM ); + BOOL HandlePanContext( WPARAM ); + + inline void SetInternalFlag( BOOL fSet, DWORD dwVal ) + { if( fSet ) m_dwInternalFlags |= dwVal; + else m_dwInternalFlags &= ~dwVal; } + +public: + FileInfo( class MainWnd *pmw = NULL ); + virtual ~FileInfo(); + + int LoadWave( LPSTR lpszFile, int nIndx ); + virtual int NewDirectSoundBuffer( void ); + void SetFileName( LPSTR lpsz, int nIndx ); + void PlayBuffer( void ); + void StopBuffer( void ); + + void Close( void ); + + virtual void UpdateUI( void ); + virtual void Duplicate( FileInfo * ); + + void CascadeWindow( void ); + void ResetCascade( void ); + void MinimizeWindow( void ); + void RestoreWindow( void ); + + void SetOwner( class MainWnd *pmw ) { if( pmw ) m_pmwOwner = pmw; } + + inline void Set3D( BOOL fNew ) + { SetInternalFlag( fNew, FI_INTERNALF_3D ); } + + inline void SetPlaying( BOOL fNew ) + { SetInternalFlag( fNew, FI_INTERNALF_PLAYING ); } + + inline void SetSticky( BOOL fNew ) + { SetInternalFlag( fNew, FI_INTERNALF_STICKY ); } + + inline void SetGlobal( BOOL fNew ) + { SetInternalFlag( fNew, FI_INTERNALF_GLOBAL ); } + + inline void SetLooped( BOOL fNew ) + { SetInternalFlag( fNew, FI_INTERNALF_LOOPED ); } + + inline void SetUseGetPos2( BOOL fNew ) + { SetInternalFlag( fNew, FI_INTERNALF_USEGETPOS2 ); } + + inline BOOL Is3D() + { return (m_dwInternalFlags & FI_INTERNALF_3D); } + + inline BOOL IsPlaying() + { return (m_dwInternalFlags & FI_INTERNALF_PLAYING ); } + + inline BOOL IsLooped() + { return (m_dwInternalFlags & FI_INTERNALF_LOOPED ); } + + inline BOOL IsSticky() + { return (m_dwInternalFlags & FI_INTERNALF_STICKY ); } + + inline BOOL IsGlobal() + { return (m_dwInternalFlags & FI_INTERNALF_GLOBAL ); } + + inline BOOL IsHardware() + { return (m_dwInternalFlags & FI_INTERNALF_HARDWARE ); } + + inline BOOL IsUsingGetPos2() + { return (m_dwInternalFlags & FI_INTERNALF_USEGETPOS2 ); } + + // Send a request to the owner MainWnd object that this object be + // destroyed, which may involve more than a simple delete (like removal + // from a list or something). + void SendDestroyRequest( void ); + +// Member data +protected: + LPBYTE m_pbData; // Pointer to actual data of file. + UINT m_cbDataSize; // Size of data. + LPWAVEFORMATEX m_pwfx; // Pointer to waveformatex structure. + DSBUFFERDESC m_dsbd; + + DWORD m_dwFreqSliderFactor; // Scaling factor + + DWORD m_dwInternalFlags; // A bit field of flags + + HWND m_hwndInterface; + HWNDTABLE m_ht; // A table of all the control HWND's + + BOOL m_fPlayButtonSaysPlay; + + char m_szFileName[MAX_PATH]; + int m_nFileIndex; // Index to filename, without dir. + + class MainWnd* m_pmwOwner; + + LPDIRECTSOUNDBUFFER m_pDSB; // Pointer to direct sound buffer. + + static int m_xNextPos, m_yNextPos; +}; + +typedef FileInfo * PFILEINFO; + +BOOL CALLBACK FileInfoDlgProc( HWND, UINT, WPARAM, LPARAM ); + + +#endif // __FILEINFO_H__ + + diff --git a/sdk/samples/dsshow3d/finfo3d.cpp b/sdk/samples/dsshow3d/finfo3d.cpp new file mode 100644 index 0000000..67cd01a --- /dev/null +++ b/sdk/samples/dsshow3d/finfo3d.cpp @@ -0,0 +1,979 @@ +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <commctrl.h> +#include <dsound.h> + +#include "wave.h" +#include "debug.h" +#include "DSShow3D.h" +#include "FInfo3D.h" +#include "GVars.h" + + +/////////////////////////////////////////////////////////////////////////////// +// FileInfo3D() +// +// Class constructor for the 3D interface/information class. +// +FileInfo3D::FileInfo3D( MainWnd * pmw ) : FileInfo( pmw ) + { + ZeroMemory( &m_ht3d, sizeof(HWNDTABLE3D)); + ZeroMemory( &m_vPos, sizeof(D3DVECTOR)); + m_pDSB3D = NULL; + + m_dwInternalFlags |= FI_INTERNALF_3D; + + m_dwInnerAngle = FI3D_DEFAULT_INNER_ANGLE; + m_dwOuterAngle = FI3D_DEFAULT_OUTER_ANGLE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// ~FileInfo3D() +// +// Virtual destructor for the FileInfo3D class. Should deallocate any space +// allocated by the constructor. +// +FileInfo3D::~FileInfo3D() + { + // If we do an allocation of memory specific to the FileInfo3D class, + // we should free it here. + + // Release the 3D interface + if( m_pDSB3D != NULL ) + { + m_pDSB3D->Release(); + m_pDSB3D = NULL; + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// NewDirectSoundBuffer() +// +// Virtual function which handles opening a new sound bufer by setting some +// flags and calling down to the base class handler, which actually does most +// of the work. Upon return, this function will do a bit more work to get a 3D +// interface. +// +int FileInfo3D::NewDirectSoundBuffer() + { + HRESULT hr; + + m_dsbd.dwFlags = DSBCAPS_CTRL3D; + + if( !FileInfo::NewDirectSoundBuffer()) + { + // Try to grab the 3D interface pointer + + if( FAILED( hr = m_pDSB->QueryInterface( IID_IDirectSound3DBuffer, + (void **)&m_pDSB3D ))) + { + DPF( 0, "QI for DS3DBuffer interface: %s", TranslateDSError(hr)); + return -1; + } + return 0; + } + else + return -1; + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +BOOL FileInfo3D::OnInitDialog( HWND hDlg, WPARAM wParam ) + { + HRESULT hr; + char szTS[6]; + + // Grab some 3D interface HWND's and pass along to the base class + m_ht3d.hXSlider = GetDlgItem( hDlg, IDC_BUFFERDLG_X_SLIDER ); + m_ht3d.hYSlider = GetDlgItem( hDlg, IDC_BUFFERDLG_Y_SLIDER ); + m_ht3d.hZSlider = GetDlgItem( hDlg, IDC_BUFFERDLG_Z_SLIDER ); + m_ht3d.hOuterVolSlider = GetDlgItem( hDlg, IDC_BUFFERDLG_OUTERVOL_SLIDER ); + m_ht3d.hOuterVolText = GetDlgItem( hDlg, IDC_BUFFERDLG_OUTERVOL_TEXT ); + m_ht3d.hInnerAngleEdit = GetDlgItem( hDlg, IDC_BUFFERDLG_INNERANGLE_EDIT ); + m_ht3d.hInnerAngleSpin = GetDlgItem( hDlg, IDC_BUFFERDLG_INNERANGLE_SPIN ); + m_ht3d.hOuterAngleEdit = GetDlgItem( hDlg, IDC_BUFFERDLG_OUTERANGLE_EDIT ); + m_ht3d.hOuterAngleSpin = GetDlgItem( hDlg, IDC_BUFFERDLG_OUTERANGLE_SPIN ); + m_ht3d.hXText = GetDlgItem( hDlg, IDC_BUFFERDLG_X_TEXT ); + m_ht3d.hYText = GetDlgItem( hDlg, IDC_BUFFERDLG_Y_TEXT ); + m_ht3d.hZText = GetDlgItem( hDlg, IDC_BUFFERDLG_Z_TEXT ); + m_ht3d.hDisable3D = GetDlgItem( hDlg, IDC_BUFFERDLG_DISABLE ); + + // The tab order in the dialog must be such that the spin control is + // immediately after the edit control it is expected to auto-buddy to. + // That case is tested here. + ASSERT( (HWND)SendMessage( m_ht3d.hInnerAngleSpin, + UDM_GETBUDDY, 0, 0 ) == m_ht3d.hInnerAngleEdit ); + + // If this fails, the tab order in the dialog resource is wrong (see above) + ASSERT( (HWND)SendMessage( m_ht3d.hOuterAngleSpin, + UDM_GETBUDDY, 0, 0 ) == m_ht3d.hOuterAngleEdit ); + + SendMessage( m_ht3d.hInnerAngleSpin, UDM_SETRANGE, 0, MAKELONG( 360, 0 )); + SendMessage( m_ht3d.hOuterAngleSpin, UDM_SETRANGE, 0, MAKELONG( 360, 0 )); + + SendMessage( m_ht3d.hInnerAngleSpin, UDM_SETPOS, + 0, MAKELONG(m_dwInnerAngle, 0)); + wsprintf( szTS, "%u", m_dwInnerAngle ); + Edit_SetText( m_ht3d.hInnerAngleEdit, szTS ); + + SendMessage( m_ht3d.hOuterAngleSpin, UDM_SETPOS, + 0, MAKELONG(m_dwOuterAngle, 0)); + wsprintf( szTS, "%u", m_dwOuterAngle ); + Edit_SetText( m_ht3d.hOuterAngleEdit, szTS ); + + if( m_pDSB3D ) + { + if( FAILED( hr = m_pDSB3D->SetConeAngles( m_dwInnerAngle, + m_dwOuterAngle, DS3D_IMMEDIATE ))) + DPF( 0, "SetConeAngles: %s", TranslateDSError(hr)); + + m_pDSB3D->GetPosition( &m_vPos ); + } + + return FileInfo::OnInitDialog( hDlg, wParam ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +BOOL FileInfo3D::OnCommand( WPARAM wParam, LPARAM lParam ) + { + BOOL fRet = FALSE; + + if( HandleOuterVolContext( wParam ) || HandlePositionContext( wParam )) + fRet = TRUE; + else if( HandleConeInnerEditNotify( wParam, lParam )) + fRet = TRUE; + else if( HandleConeOuterEditNotify( wParam, lParam )) + fRet = TRUE; + else if( HandleDisableNotify( wParam, lParam )) + fRet = TRUE; + else + fRet = FileInfo::OnCommand( wParam, lParam ); + + return fRet; + } + + +/////////////////////////////////////////////////////////////////////////////// +// OnHScroll() +// +// +// +BOOL FileInfo3D::OnHScroll( WORD wNotification, LONG lPos, HWND hControl ) + { + if( !hControl ) + return FALSE; + if( hControl == m_ht3d.hOuterVolSlider ) + HandleOuterVolSliderScroll( wNotification, lPos ); + else if( hControl == m_ht3d.hXSlider ) + HandleXSliderScroll( wNotification, lPos ); + else if( hControl == m_ht3d.hYSlider ) + HandleYSliderScroll( wNotification, lPos ); + else if( hControl == m_ht3d.hZSlider ) + HandleZSliderScroll( wNotification, lPos ); + // All messages we don't handle pass through to the base class + else + return FileInfo::OnHScroll( wNotification, lPos, hControl ); + + return TRUE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void FileInfo3D::HandleOuterVolSliderScroll( WORD wNot, LONG lPos ) + { + HRESULT hr; + BOOL fUpdate = TRUE; + + switch( wNot ) + { + case TB_THUMBTRACK: + break; + + case TB_ENDTRACK: + case TB_LINEDOWN: + case TB_LINEUP: + case TB_PAGEDOWN: + case TB_PAGEUP: + lPos = SendMessage( m_ht3d.hOuterVolSlider, TBM_GETPOS, 0, 0 ); + break; + + default: + fUpdate = FALSE; + } + + if( fUpdate && NULL != m_pDSB3D ) + { +// DPF( 3, "SetConeOutsideVolume: %i", ( lPos * VOL_SLIDER_FACTOR ) - VOL_SLIDER_SHIFT ); + if( FAILED( hr = m_pDSB3D->SetConeOutsideVolume(( lPos * VOL_SLIDER_FACTOR ) + - VOL_SLIDER_SHIFT, DS3D_IMMEDIATE ))) + DPF( 0, "SetConeOutsideVolume: %s", TranslateDSError(hr)); + UpdateOuterVolUI(( lPos * VOL_SLIDER_FACTOR ) - VOL_SLIDER_SHIFT, + FALSE ); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void FileInfo3D::HandleXSliderScroll( WORD wNot, LONG lPos ) + { + HRESULT hr; + BOOL fUpdate = TRUE; + + switch( wNot ) + { + case TB_THUMBTRACK: + break; + + case TB_ENDTRACK: + case TB_LINEDOWN: + case TB_LINEUP: + case TB_PAGEDOWN: + case TB_PAGEUP: + lPos = SendMessage( m_ht3d.hXSlider, TBM_GETPOS, 0, 0 ); + break; + + default: + fUpdate = FALSE; + } + + if( fUpdate && NULL != m_pDSB3D ) + { + m_vPos.x = D3DVAL(lPos * X_SLIDER_FACTOR) - POS_SLIDER_SHIFT; +// DPF( 3, "Setting buffer pos: (%i, %i, %i)", +// (int)m_vPos.x, (int)m_vPos.y, (int)m_vPos.z ); + if( FAILED( hr = m_pDSB3D->SetPosition( m_vPos.x, m_vPos.y, + m_vPos.z, DS3D_IMMEDIATE ))) + DPF( 0, "SetPosition: %s", TranslateDSError(hr)); + UpdateXSliderUI((lPos * X_SLIDER_FACTOR) - POS_SLIDER_SHIFT, FALSE ); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void FileInfo3D::HandleYSliderScroll( WORD wNot, LONG lPos ) + { + HRESULT hr; + BOOL fUpdate = TRUE; + + switch( wNot ) + { + case TB_THUMBTRACK: + break; + + case TB_ENDTRACK: + case TB_LINEDOWN: + case TB_LINEUP: + case TB_PAGEDOWN: + case TB_PAGEUP: + lPos = SendMessage( m_ht3d.hYSlider, TBM_GETPOS, 0, 0 ); + break; + + default: + fUpdate = FALSE; + } + + if( fUpdate && NULL != m_pDSB3D ) + { + m_vPos.y = D3DVAL(lPos * Y_SLIDER_FACTOR) - POS_SLIDER_SHIFT; +// DPF( 3, "Setting buffer pos: (%i, %i, %i)", +// (int)m_vPos.x, (int)m_vPos.y, (int)m_vPos.z ); + if( FAILED( hr = m_pDSB3D->SetPosition( m_vPos.x, m_vPos.y, + m_vPos.z, DS3D_IMMEDIATE ))) + DPF( 0, "SetPosition: %s", TranslateDSError(hr)); + UpdateYSliderUI((lPos * Y_SLIDER_FACTOR) - POS_SLIDER_SHIFT, FALSE ); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void FileInfo3D::HandleZSliderScroll( WORD wNot, LONG lPos ) + { + HRESULT hr; + BOOL fUpdate = TRUE; + + switch( wNot ) + { + case TB_THUMBTRACK: + break; + + case TB_ENDTRACK: + case TB_LINEDOWN: + case TB_LINEUP: + case TB_PAGEDOWN: + case TB_PAGEUP: + lPos = SendMessage( m_ht3d.hZSlider, TBM_GETPOS, 0, 0 ); + break; + + default: + fUpdate = FALSE; + } + + if( fUpdate && NULL != m_pDSB3D ) + { + m_vPos.z = D3DVAL(lPos * Z_SLIDER_FACTOR) - POS_SLIDER_SHIFT; +// DPF( 3, "Setting buffer pos: (%i, %i, %i)", +// (int)m_vPos.x, (int)m_vPos.y, (int)m_vPos.z ); + if( FAILED( hr = m_pDSB3D->SetPosition( m_vPos.x, m_vPos.y, + m_vPos.z, DS3D_IMMEDIATE ))) + DPF( 0, "SetPosition: %s", TranslateDSError(hr)); + UpdateZSliderUI((lPos * Z_SLIDER_FACTOR) - POS_SLIDER_SHIFT, FALSE ); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdateOuterVolUI() +// +// +// +// +// +void FileInfo3D::UpdateOuterVolUI( LONG lForceVol, BOOL fFromBuffer ) + { + HRESULT hr; + LONG lVol; + char szText[16]; + + if( fFromBuffer ) + { + if( NULL != m_pDSB3D ) + { + if( FAILED( hr = m_pDSB3D->GetConeOutsideVolume( &lVol ))) + DPF( 0, "GetConeOutsideVolume: %s", TranslateDSError(hr)); + } + else + lVol = 0; + } + else + lVol = lForceVol; + + SendMessage( m_ht3d.hOuterVolSlider, TBM_SETPOS, (WPARAM)TRUE, + (LPARAM)(lVol + VOL_SLIDER_SHIFT) / VOL_SLIDER_FACTOR ); + + // Print volume in decibels + wsprintf( szText, "%i dB", lVol / 100 ); + + Static_SetText( m_ht3d.hOuterVolText, szText ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +BOOL FileInfo3D::OnContextMenu( HWND hDlg, int x, int y ) + { + HMENU hm, hSub; + int nSubMenu = -1; + POINT pt = { x, y }; + RECT rectWind1, rectWind2, rectWind3; + + // Set the sub-menu to the Outer Volume context menu if we hit the proper + // slider or text control + GetWindowRect( m_ht3d.hOuterVolSlider, &rectWind1 ); + GetWindowRect( m_ht3d.hOuterVolText, &rectWind2 ); + + if( PtInRect( &rectWind1, pt ) || PtInRect( &rectWind2, pt )) + nSubMenu = 3; + + // Set the POS_CONTEXT submenu if there's a click on the position sliders + // or text controls + GetWindowRect( m_ht3d.hXSlider, &rectWind1 ); + GetWindowRect( m_ht3d.hYSlider, &rectWind2 ); + GetWindowRect( m_ht3d.hZSlider, &rectWind3 ); + + if( PtInRect( &rectWind1, pt ) || PtInRect( &rectWind2, pt ) + || PtInRect( &rectWind3, pt )) + nSubMenu = 4; + + GetWindowRect( m_ht3d.hXText, &rectWind1 ); + GetWindowRect( m_ht3d.hYText, &rectWind2 ); + GetWindowRect( m_ht3d.hZText, &rectWind3 ); + + if( PtInRect( &rectWind1, pt ) || PtInRect( &rectWind2, pt ) + || PtInRect( &rectWind3, pt )) + nSubMenu = 4; + + // We didn't detect any "interesting" hotspots, so pass along to base class + if( nSubMenu < 0 ) + return FileInfo::OnContextMenu( hDlg, x, y ); + + // If we make it here, we're gonna popup a context menu of some sort + + // Attempt to load our menu. If we fail, we still handled the message + // so return TRUE + if(( hm = LoadMenu( ghInst, MAKEINTRESOURCE(IDM_POPUPS))) == NULL ) + return TRUE; + + hSub = GetSubMenu( hm, nSubMenu ); + TrackPopupMenu( hSub, TPM_LEFTALIGN | TPM_RIGHTBUTTON, + pt.x, pt.y, 0, m_hwndInterface, NULL ); + + DestroyMenu( hm ); + + return TRUE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void FileInfo3D::OnDestroy() + { + FileInfo::OnDestroy(); + return; + } + + +void FileInfo3D::Duplicate( FileInfo *pfiSource ) + { + HRESULT hr; + + FileInfo::Duplicate( pfiSource ); + + if( FAILED( hr = m_pDSB->QueryInterface( IID_IDirectSound3DBuffer, + (void **)&m_pDSB3D ))) + { + DPF( 0, "QI for DS3DBuffer interface: %s", TranslateDSError(hr)); + } + else + { + // Update the UI from the interface we just got + UpdateOuterVolUI( 0, TRUE ); + UpdateXSliderUI( 0, TRUE ); + UpdateYSliderUI( 0, TRUE ); + UpdateZSliderUI( 0, TRUE ); + + m_pDSB3D->GetConeAngles( &m_dwInnerAngle, &m_dwOuterAngle ); + + DWORD dwMode; + char szTS[6]; + + SendMessage( m_ht3d.hInnerAngleSpin, UDM_SETPOS, + 0, MAKELONG(m_dwInnerAngle, 0)); + wsprintf( szTS, "%u", m_dwInnerAngle ); + Edit_SetText( m_ht3d.hInnerAngleEdit, szTS ); + + SendMessage( m_ht3d.hOuterAngleSpin, UDM_SETPOS, + 0, MAKELONG(m_dwOuterAngle, 0)); + wsprintf( szTS, "%u", m_dwOuterAngle ); + Edit_SetText( m_ht3d.hOuterAngleEdit, szTS ); + + m_pDSB3D->GetMode( &dwMode ); + Button_SetCheck( m_ht3d.hDisable3D, dwMode == DS3DMODE_DISABLE ); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// CreateInterface() +// +// Very similar to the interface creation code for 2D objects, but creates a +// different dialog. (Eventually may do more stuff related to D3D display). +// +BOOL FileInfo3D::CreateInterface( HWND hwndOwner ) + { + m_hwndInterface = CreateDialogParam( ghInst, MAKEINTRESOURCE(IDD_BUFFER3D), + hwndOwner, (DLGPROC)FileInfo3DDlgProc, + (LPARAM)this ); + + if( NULL == m_hwndInterface ) + goto FICI_Fail; + else + UpdateFileName(); + + CascadeWindow(); + ShowWindow( m_hwndInterface, SW_SHOW ); + + // This flag tells us an interface window was successfully created + m_dwInternalFlags |= FI_INTERNALF_INTERFACE; + return TRUE; + + +FICI_Fail: + if( m_hwndInterface ) + { + DestroyWindow( m_hwndInterface ); + m_hwndInterface = NULL; + } + // Clear the flag that says we have a good interface window created + m_dwInternalFlags &= ~FI_INTERNALF_INTERFACE; + return FALSE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void FileInfo3D::SetSliders( void ) + { + // Do 3D controls slider initialization + + // Intentionally set the range backwards because a large number means + // a smaller value + SendMessage( m_ht3d.hOuterVolSlider, TBM_SETRANGEMIN, FALSE, + (LPARAM)(VOL_MIN + VOL_SLIDER_SHIFT) / VOL_SLIDER_FACTOR ); + SendMessage( m_ht3d.hOuterVolSlider, TBM_SETRANGEMAX, FALSE, + (LPARAM)(VOL_MAX + VOL_SLIDER_SHIFT) / VOL_SLIDER_FACTOR ); + SendMessage( m_ht3d.hOuterVolSlider, TBM_SETPAGESIZE, 0, + VOL_SLIDER_PAGE / VOL_SLIDER_FACTOR ); + // NOTE: No TICs on the cone volume slider + + SendMessage( m_ht3d.hXSlider, TBM_SETRANGEMIN, FALSE, + (LPARAM)(POS_SLIDER_MIN + POS_SLIDER_SHIFT) / X_SLIDER_FACTOR ); + SendMessage( m_ht3d.hXSlider, TBM_SETRANGEMAX, FALSE, + (LPARAM)(POS_SLIDER_MAX + POS_SLIDER_SHIFT) / X_SLIDER_FACTOR ); + SendMessage( m_ht3d.hXSlider, TBM_SETPAGESIZE, 0, X_SLIDER_FACTOR ); + + SendMessage( m_ht3d.hYSlider, TBM_SETRANGEMIN, FALSE, + (LPARAM)(POS_SLIDER_MIN + POS_SLIDER_SHIFT) / Y_SLIDER_FACTOR ); + SendMessage( m_ht3d.hYSlider, TBM_SETRANGEMAX, FALSE, + (LPARAM)(POS_SLIDER_MAX + POS_SLIDER_SHIFT) / Y_SLIDER_FACTOR ); + SendMessage( m_ht3d.hYSlider, TBM_SETPAGESIZE, 0, Y_SLIDER_FACTOR ); + + SendMessage( m_ht3d.hZSlider, TBM_SETRANGEMIN, FALSE, + (LPARAM)(POS_SLIDER_MIN + POS_SLIDER_SHIFT) / Z_SLIDER_FACTOR ); + SendMessage( m_ht3d.hZSlider, TBM_SETRANGEMAX, FALSE, + (LPARAM)(POS_SLIDER_MAX + POS_SLIDER_SHIFT) / Z_SLIDER_FACTOR ); + SendMessage( m_ht3d.hZSlider, TBM_SETPAGESIZE, 0, Z_SLIDER_FACTOR ); + +// SendMessage( m_ht3d.hOuterVolSlider, TBM_SETPAGESIZE, 0, +// VOL_SLIDER_PAGE / VOL_SLIDER_FACTOR ); + // NOTE: No TICs on the position sliders + + // Update the display from the buffer's current settings + UpdateOuterVolUI( 0, TRUE ); + UpdateXSliderUI( 0, TRUE ); + UpdateYSliderUI( 0, TRUE ); + UpdateZSliderUI( 0, TRUE ); + + FileInfo::SetSliders(); + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void FileInfo3D::UpdateUI( void ) + { + FileInfo::UpdateUI(); + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdateFileName() +// +// Updates the file name which is displayed in the dialog window caption. +// +void FileInfo3D::UpdateFileName( void ) + { + char szTitle[MAX_PATH + 5]; + + if( NULL != m_hwndInterface ) + { + lstrcpy( szTitle, &m_szFileName[m_nFileIndex] ); + lstrcat( szTitle, TEXT(" (3D)")); + SendMessage( m_hwndInterface, WM_SETTEXT, 0L, (LPARAM)szTitle ); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// FileInfo3DDlgProc() +// +// +// +BOOL CALLBACK FileInfo3DDlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) + { + FileInfo3D *pfi3d; + + switch( message ) + { + // The first step is to stash our class object pointer in the user data + // and Initialize all our controls and internal data members. + case WM_INITDIALOG: + ASSERT( NULL != lParam ); + pfi3d = (FileInfo3D *)lParam; + SetWindowLong( hDlg, DWL_USER, (LONG)pfi3d ); + + if( !pfi3d->OnInitDialog( hDlg, wParam )) + { + DestroyWindow( hDlg ); + } + return TRUE; + + case WM_COMMAND: + pfi3d = (FileInfo3D*)GetWindowLong( hDlg, DWL_USER ); + // It's possible to get notification messages from child controls + // before we have been given a WM_INITDIALOG message. This is not + // a good thing for dereferencing the pointer because we won't have + // class info. Specifically, the spin controls in our dialog force + // the edit control to send EN_CHANGE and EN_UPDATE messages when + // they set the text of the edit control they're tied to. + if( NULL == pfi3d || NULL == pfi3d->m_hwndInterface ) + return FALSE; + return !pfi3d->OnCommand( wParam, lParam ); + + // Handle this to deal with right-clicks on our controls -- we have a + // bunch of different context menus that we can popup + case WM_CONTEXTMENU: + pfi3d = (FileInfo3D*)GetWindowLong( hDlg, DWL_USER ); + ASSERT( NULL != pfi3d ); + return pfi3d->OnContextMenu( hDlg, LOWORD(lParam), HIWORD(lParam)); + + // Trackbar slider notifications come through here + case WM_HSCROLL: + pfi3d = (FileInfo3D*)GetWindowLong( hDlg, DWL_USER ); + ASSERT( NULL != pfi3d ); + return pfi3d->OnHScroll( LOWORD(wParam), (LONG)HIWORD(wParam), (HWND)lParam ); + + case WM_DESTROY: + pfi3d = (FileInfo3D*)GetWindowLong( hDlg, DWL_USER ); + ASSERT( NULL != pfi3d ); + pfi3d->OnDestroy(); + return TRUE; + + default: + return FileInfoDlgProc( hDlg, message, wParam, lParam ); + } + + ASSERT( FALSE ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// HandleOuterVolContext() +// +// Pre-process the parameters to WM_COMMAND messages we get and sees if we +// knows how to handle any of them. We know how to handle any message that +// comes from the Outer Volume controls' context menu. +// +BOOL FileInfo3D::HandleOuterVolContext( WPARAM wParam ) + { + HRESULT hr; + + switch( wParam ) + { + case ID_OUTERVOLCONTEXT_0DB: + if( FAILED( hr = m_pDSB3D->SetConeOutsideVolume( 0, + DS3D_IMMEDIATE ))) + DPF( 0, "SetConeOutsideVolume: %s", TranslateDSError(hr)); + UpdateOuterVolUI( 0, TRUE ); + break; + + case ID_OUTERVOLCONTEXT_10DB: + if( FAILED( hr = m_pDSB3D->SetConeOutsideVolume( -1000, + DS3D_IMMEDIATE ))) + DPF( 0, "SetConeOutsideVolume: %s", TranslateDSError(hr)); + UpdateOuterVolUI( -1000, TRUE ); + break; + + case ID_OUTERVOLCONTEXT_20DB: + if( FAILED( hr = m_pDSB3D->SetConeOutsideVolume( -2000, + DS3D_IMMEDIATE ))) + DPF( 0, "SetConeOutsideVolume: %s", TranslateDSError(hr)); + UpdateOuterVolUI( -2000, TRUE ); + break; + + case ID_OUTERVOLCONTEXT_30DB: + if( FAILED( hr = m_pDSB3D->SetConeOutsideVolume( -3000, + DS3D_IMMEDIATE ))) + DPF( 0, "SetConeOutsideVolume: %s", TranslateDSError(hr)); + UpdateOuterVolUI( -3000, TRUE ); + break; + + case ID_OUTERVOLCONTEXT_100DB: + if( FAILED( hr = m_pDSB3D->SetConeOutsideVolume( -10000, + DS3D_IMMEDIATE ))) + DPF( 0, "SetConeOutsideVolume: %s", TranslateDSError(hr)); + UpdateOuterVolUI( -10000, TRUE ); + break; + + default: + return FALSE; + } + + return TRUE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// HandlePositionContext() +// +// Pre-process the parameters to WM_COMMAND messages we get and sees if we +// knows how to handle any of them. We know how to handle any message that +// comes from the Position controls' context menu. +// +BOOL FileInfo3D::HandlePositionContext( WPARAM wParam ) + { + D3DVECTOR d3dListener; + + switch( wParam ) + { + case ID_POSCONTEXT_ORIGIN: + ASSERT( NULL != m_pDSB3D ); + m_pDSB3D->SetPosition( D3DVAL(0), D3DVAL(0), D3DVAL(0), DS3D_IMMEDIATE ); + UpdateXSliderUI( 0, TRUE ); + UpdateYSliderUI( 0, TRUE ); + UpdateZSliderUI( 0, TRUE ); + break; + + case ID_POSCONTEXT_LISTENERPOSITION: + ASSERT( NULL != m_pDSB3D ); + ASSERT( NULL != gp3DListener ); + gp3DListener->GetPosition( &d3dListener ); + m_pDSB3D->SetPosition( d3dListener.x, d3dListener.y, + d3dListener.z, DS3D_IMMEDIATE ); + UpdateXSliderUI( (DWORD)d3dListener.x, TRUE ); + UpdateYSliderUI( (DWORD)d3dListener.y, TRUE ); + UpdateZSliderUI( (DWORD)d3dListener.z, TRUE ); + break; + + default: + return FALSE; + } + + return TRUE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdateXSliderUI() +// +// Update anything that displays the position of the X slider in some manner +// to reflect the new position, either from the buffer or from the parameter. +// +void FileInfo3D::UpdateXSliderUI( LONG lForcePos, BOOL fFromBuffer ) + { + char szText[8]; + LONG lPos; + + if( fFromBuffer ) + { + if( NULL != m_pDSB3D ) + { + m_pDSB3D->GetPosition( &m_vPos ); + lPos = (LONG)m_vPos.x; + } + else + lPos = 0; + } + else + lPos = lForcePos; + + SendMessage( m_ht3d.hXSlider, TBM_SETPOS, (WPARAM)TRUE, + (LPARAM)(lPos + POS_SLIDER_SHIFT) / X_SLIDER_FACTOR ); + wsprintf( szText, "%i", lPos ); + Static_SetText( m_ht3d.hXText, szText ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdateYSliderUI() +// +// Update anything that displays the position of the Y slider in some manner +// to reflect the new position, either from the buffer or from the parameter. +// +void FileInfo3D::UpdateYSliderUI( LONG lForcePos, BOOL fFromBuffer ) + { + char szText[8]; + LONG lPos; + + if( fFromBuffer ) + { + if( NULL != m_pDSB3D ) + { + m_pDSB3D->GetPosition( &m_vPos ); + lPos = (LONG)m_vPos.y; + } + else + lPos = 0; + } + else + lPos = lForcePos; + + SendMessage( m_ht3d.hYSlider, TBM_SETPOS, (WPARAM)TRUE, + (LPARAM)(lPos + POS_SLIDER_SHIFT) / Y_SLIDER_FACTOR ); + wsprintf( szText, "%i", lPos ); + Static_SetText( m_ht3d.hYText, szText ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdateZSliderUI() +// +// Update anything that displays the position of the Z slider in some manner +// to reflect the new position, either from the buffer or from the parameter. +// +void FileInfo3D::UpdateZSliderUI( LONG lForcePos, BOOL fFromBuffer ) + { + char szText[8]; + LONG lPos; + + if( fFromBuffer ) + { + if( NULL != m_pDSB3D ) + { + m_pDSB3D->GetPosition( &m_vPos ); + lPos = (LONG)m_vPos.z; + } + else + lPos = 0; + } + else + lPos = lForcePos; + + SendMessage( m_ht3d.hZSlider, TBM_SETPOS, (WPARAM)TRUE, + (LPARAM)(lPos + POS_SLIDER_SHIFT) / Z_SLIDER_FACTOR ); + wsprintf( szText, "%i", lPos ); + Static_SetText( m_ht3d.hZText, szText ); + } + + +BOOL FileInfo3D::HandleConeInnerEditNotify( WPARAM wParam, LPARAM lParam ) + { + HRESULT hr; + BOOL fRet = FALSE; + LONG lValue; + char szTS[6]; + + if( HIWORD( wParam ) == EN_CHANGE ) + { + if( (HWND)lParam == m_ht3d.hInnerAngleEdit ) + { + Edit_GetText( m_ht3d.hInnerAngleEdit, szTS, sizeof(szTS)); + lValue = atol(szTS); + if( lValue < 0 ) + { + Edit_SetText( m_ht3d.hInnerAngleEdit, "0" ); + return TRUE; + } + else + m_dwInnerAngle = (DWORD)lValue; + + // Make sure we haven't incremented the inner cone larger than + // the outer cone + if( m_dwInnerAngle > m_dwOuterAngle ) + { + m_dwOuterAngle = m_dwInnerAngle; + SendMessage( m_ht3d.hOuterAngleSpin, UDM_SETPOS, + 0, MAKELONG(m_dwOuterAngle, 0)); + wsprintf( szTS, "%u", m_dwOuterAngle ); + Edit_SetText( m_ht3d.hOuterAngleEdit, szTS ); + } + if( m_pDSB3D ) + if( FAILED( hr = m_pDSB3D->SetConeAngles( m_dwInnerAngle, + m_dwOuterAngle, DS3D_IMMEDIATE ))) + DPF( 0, "SetConeAngles: %s", TranslateDSError(hr)); + fRet = TRUE; + } + } + + return fRet; + } + + +BOOL FileInfo3D::HandleConeOuterEditNotify( WPARAM wParam, LPARAM lParam ) + { + HRESULT hr; + BOOL fRet = FALSE; + LONG lValue; + char szTS[6]; + + if( HIWORD( wParam ) == EN_CHANGE ) + { + if( (HWND)lParam == m_ht3d.hOuterAngleEdit ) + { + Edit_GetText( m_ht3d.hOuterAngleEdit, szTS, sizeof(szTS)); + lValue = atol(szTS); + if( lValue < 0 ) + { + Edit_SetText( m_ht3d.hOuterAngleEdit, "0" ); + return TRUE; + } + else + m_dwOuterAngle = (DWORD)lValue; + // Make sure we haven't decremented the outer cone smaller than + // the inner cone + if( m_dwInnerAngle > m_dwOuterAngle ) + { + m_dwInnerAngle = m_dwOuterAngle; + SendMessage( m_ht3d.hInnerAngleSpin, UDM_SETPOS, + 0, MAKELONG(m_dwInnerAngle, 0)); + wsprintf( szTS, "%u", m_dwInnerAngle ); + Edit_SetText( m_ht3d.hInnerAngleEdit, szTS ); + } + if( m_pDSB3D ) + if( FAILED( hr = m_pDSB3D->SetConeAngles( m_dwInnerAngle, + m_dwOuterAngle, DS3D_IMMEDIATE ))) + DPF( 0, "SetConeAngles: %s", TranslateDSError(hr)); + fRet = TRUE; + } + } + + return fRet; + } + +BOOL FileInfo3D::HandleDisableNotify( WPARAM wParam, LPARAM lParam ) + { + HRESULT hr; + BOOL fRet = FALSE; + + if( (HWND)lParam == m_ht3d.hDisable3D ) + { + if( Button_GetCheck( m_ht3d.hDisable3D )) + { + if( m_pDSB3D ) { + if( FAILED( hr = m_pDSB3D->SetMode( DS3DMODE_DISABLE, 0 ))) + DPF( 0, "SetMode: %s", TranslateDSError(hr)); + fRet = TRUE; + } + } + else + { + if( m_pDSB3D ) { + if( FAILED( hr = m_pDSB3D->SetMode( DS3DMODE_NORMAL, 0 ))) + DPF( 0, "SetMode: %s", TranslateDSError(hr)); + fRet = TRUE; + } + } + } + + return fRet; + } + diff --git a/sdk/samples/dsshow3d/finfo3d.h b/sdk/samples/dsshow3d/finfo3d.h new file mode 100644 index 0000000..d99aaac --- /dev/null +++ b/sdk/samples/dsshow3d/finfo3d.h @@ -0,0 +1,94 @@ +#ifndef __FILEINFO3D_H__ +#define __FILEINFO3D_H__ + +#include "FileInfo.h" + +#define CONEVOL_MIN -10000 +#define CONEVOL_MAX 0 +#define CONEVOL_SLIDER_FACTOR 100 +#define CONEVOL_SLIDER_SHIFT 10000 +#define CONEVOL_SLIDER_PAGE 500 + +#define X_SLIDER_FACTOR 1 +#define Y_SLIDER_FACTOR 1 +#define Z_SLIDER_FACTOR 1 + +#define POS_SLIDER_MIN -50 // Centimeters +#define POS_SLIDER_MAX 50 // Centimeters +#define POS_SLIDER_SHIFT 50 // Shift so min is 0 + +#define FI3D_DEFAULT_INNER_ANGLE 90 +#define FI3D_DEFAULT_OUTER_ANGLE 120 + +typedef struct tag_ht3d +{ + HWND hXSlider, hYSlider, hZSlider; + HWND hOuterVolText, hOuterVolSlider; + HWND hInnerAngleEdit, hInnerAngleSpin; + HWND hOuterAngleEdit, hOuterAngleSpin; + HWND hXText, hYText, hZText; + HWND hDisable3D; +} HWNDTABLE3D; + + + +class FileInfo3D : public FileInfo +{ +friend BOOL CALLBACK FileInfo3DDlgProc( HWND, UINT, WPARAM, LPARAM ); + +public: + FileInfo3D( MainWnd *pmw = NULL ); + virtual ~FileInfo3D(); + + virtual int NewDirectSoundBuffer( void ); + + virtual void Duplicate( FileInfo * ); + + virtual void UpdateUI( void ); + virtual void UpdateFileName( void ); + +// Useful protected member functions +protected: + virtual BOOL OnInitDialog( HWND, WPARAM ); + virtual BOOL OnCommand( WPARAM, LPARAM ); + virtual BOOL OnHScroll( WORD, LONG, HWND ); + virtual BOOL OnContextMenu( HWND, int, int ); + virtual void OnDestroy(); + + virtual BOOL CreateInterface( HWND ); + virtual void SetSliders( void ); + + void HandleOuterVolSliderScroll( WORD, LONG ); + void HandleXSliderScroll( WORD, LONG ); + void HandleYSliderScroll( WORD, LONG ); + void HandleZSliderScroll( WORD, LONG ); + + BOOL HandleConeInnerEditNotify( WPARAM, LPARAM ); + BOOL HandleConeOuterEditNotify( WPARAM, LPARAM ); + + BOOL HandleDisableNotify( WPARAM, LPARAM ); + + BOOL HandleOuterVolContext( WPARAM ); + BOOL HandlePositionContext( WPARAM ); + + void UpdateOuterVolUI( LONG, BOOL ); + void UpdateXSliderUI( LONG, BOOL ); + void UpdateYSliderUI( LONG, BOOL ); + void UpdateZSliderUI( LONG, BOOL ); + +protected: + HWNDTABLE3D m_ht3d; + D3DVECTOR m_vPos; + DWORD m_dwInnerAngle, m_dwOuterAngle; + + LPDIRECTSOUND3DBUFFER m_pDSB3D; // DirectSound 3D buffer interface +}; + + +typedef FileInfo3D * PFILEINFO3D; + +BOOL CALLBACK FileInfo3DDlgProc( HWND, UINT, WPARAM, LPARAM ); + +#endif + + diff --git a/sdk/samples/dsshow3d/gvars.h b/sdk/samples/dsshow3d/gvars.h new file mode 100644 index 0000000..0e9f6be --- /dev/null +++ b/sdk/samples/dsshow3d/gvars.h @@ -0,0 +1,103 @@ +#ifndef __GVARS_H__ +#define __GVARS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +class FileInfo; +class MainWnd; +class FileInfo3D; +class ListenerInfo; + +#include <dsound.h> +#include "DSShow3d.h" +#include "MainWnd.h" + +// Make sure to change this if you add format code entries to fdFormats[] +#define NUM_FORMATENTRIES 16 + +#ifdef INIT_GVARS + +char gszAppName[] = "DSShow3D"; +char gszAppCaption[] = "DirectSound 3D Mixing Test"; +char gszAppWndClass[] = "DSShow3D_MainApp_WndClass"; + +FORMATDATA fdFormats[] = { { 8108, ID_OPTIONS_FORMAT_8M8, TRUE }, + { 8116, ID_OPTIONS_FORMAT_8M16, TRUE }, + { 8208, ID_OPTIONS_FORMAT_8S8, TRUE }, + { 8216, ID_OPTIONS_FORMAT_8S16, TRUE }, + { 11108, ID_OPTIONS_FORMAT_11M8, TRUE }, + { 11116, ID_OPTIONS_FORMAT_11M16, TRUE }, + { 11208, ID_OPTIONS_FORMAT_11S8, TRUE }, + { 11216, ID_OPTIONS_FORMAT_11S16, TRUE }, + { 22108, ID_OPTIONS_FORMAT_22M8, TRUE }, + { 22116, ID_OPTIONS_FORMAT_22M16, TRUE }, + { 22208, ID_OPTIONS_FORMAT_22S8, TRUE }, + { 22216, ID_OPTIONS_FORMAT_22S16, TRUE }, + { 44108, ID_OPTIONS_FORMAT_44M8, TRUE }, + { 44116, ID_OPTIONS_FORMAT_44M16, TRUE }, + { 44208, ID_OPTIONS_FORMAT_44S8, TRUE }, + { 44216, ID_OPTIONS_FORMAT_44S16, TRUE } }; + + +DWORD aFormatOrder[] = { 44216, 44116, 44208, 44108, 22216, 22116, 22208, 22108, + 11216, 11116, 11208, 11108, 8216, 8116, 8208, 8108 }; + +HINSTANCE ghInst; +HWND hWndMain = NULL; +HWND ghDlgActive = NULL; +DWORD gdwTimer = 0; // Timer handle. +DWORD gcbMaxWaveFormatSize= 0; +DWORD gdwOutputFormat = 0; +BOOL gfCOMInitialized = FALSE; +REGSETTINGS grs; + +PWAVEFORMATEX gpwfxFormat = NULL; +ListenerInfo * gpListenerInfo = NULL; +HWND ghwndListener = NULL; + +LPDIRECTSOUND gpds = NULL; +LPDIRECTSOUNDBUFFER gpdsbPrimary = NULL; +LPDIRECTSOUND3DLISTENER gp3DListener = NULL; + +MainWnd AppWnd; + +#else // INIT_GVARS + +extern char gszAppName[]; +extern char gszAppCaption[]; +extern char gszAppWndClass[]; + +extern FORMATDATA fdFormats[]; +extern DWORD aFormatOrder[]; + +extern HINSTANCE ghInst; +extern HWND hWndMain; +extern HWND ghDlgActive; +extern DWORD gdwTimer; // Timer handle. +extern DWORD gcbMaxWaveFormatSize; +extern DWORD gdwOutputFormat; +extern BOOL gfCOMInitialized; +extern REGSETTINGS grs; + +extern PWAVEFORMATEX gpwfxFormat; +extern ListenerInfo * gpListenerInfo; +extern HWND ghwndListener; + +extern LPDIRECTSOUND gpds; +extern LPDIRECTSOUNDBUFFER gpdsbPrimary; +extern LPDIRECTSOUND3DLISTENER gp3DListener; + +extern MainWnd AppWnd; + +#endif // INIT_GVARS + + +#ifdef __cplusplus +} +#endif + +#endif // __GVARS_H__ + + diff --git a/sdk/samples/dsshow3d/ico00001.ico b/sdk/samples/dsshow3d/ico00001.ico new file mode 100644 index 0000000..74ed991 Binary files /dev/null and b/sdk/samples/dsshow3d/ico00001.ico differ diff --git a/sdk/samples/dsshow3d/icon1.ico b/sdk/samples/dsshow3d/icon1.ico new file mode 100644 index 0000000..7bdf3a4 Binary files /dev/null and b/sdk/samples/dsshow3d/icon1.ico differ diff --git a/sdk/samples/dsshow3d/icon3.ico b/sdk/samples/dsshow3d/icon3.ico new file mode 100644 index 0000000..3bd250c Binary files /dev/null and b/sdk/samples/dsshow3d/icon3.ico differ diff --git a/sdk/samples/dsshow3d/lsnrinfo.cpp b/sdk/samples/dsshow3d/lsnrinfo.cpp new file mode 100644 index 0000000..f3205e7 --- /dev/null +++ b/sdk/samples/dsshow3d/lsnrinfo.cpp @@ -0,0 +1,416 @@ +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <dsound.h> +#include <commctrl.h> + +#include "DSShow3D.h" +#include "debug.h" +#include "GVars.h" +#include "LsnrInfo.h" + + +ListenerInfo::ListenerInfo() + { + m_hDistanceEdit = m_hDopplerEdit = m_hRolloffEdit = NULL; + m_hXSlider = m_hYSlider = m_hZSlider = NULL; + m_hXText = m_hYText = m_hZText = NULL; + + m_vPos.x = m_vPos.y = m_vPos.z = (D3DVALUE)0.0; + } + + +ListenerInfo::~ListenerInfo() + { + } + + +BOOL ListenerInfo::OnInitDialog( HWND hDlg, WPARAM wParam ) + { + m_hDistanceEdit = GetDlgItem( hDlg, IDC_LISTENER_DISTANCEFACTOR_EDIT ); + m_hDopplerEdit = GetDlgItem( hDlg, IDC_LISTENER_DOPPLERFACTOR_EDIT ); + m_hRolloffEdit = GetDlgItem( hDlg, IDC_LISTENER_ROLLOFFFACTOR_EDIT ); + + m_hXSlider = GetDlgItem( hDlg, IDC_LISTENER_X_SLIDER ); + m_hYSlider = GetDlgItem( hDlg, IDC_LISTENER_Y_SLIDER ); + m_hZSlider = GetDlgItem( hDlg, IDC_LISTENER_Z_SLIDER ); + + m_hXText = GetDlgItem( hDlg, IDC_LISTENER_X_TEXT ); + m_hYText = GetDlgItem( hDlg, IDC_LISTENER_Y_TEXT ); + m_hZText = GetDlgItem( hDlg, IDC_LISTENER_Z_TEXT ); + + // Initialize the distance factor to metres + Edit_SetText( m_hDistanceEdit, "1.0" ); + Edit_SetText( m_hRolloffEdit, "1.0" ); + + gp3DListener->SetPosition( D3DVAL(0.0f), D3DVAL(0.0f), D3DVAL(-10.0f), DS3D_IMMEDIATE ); +// gp3DListener->CommitDeferredSettings(); + + SetSliders(); + + return TRUE; + } + + +void ListenerInfo::UpdateUI( void ) + { + UpdateXSliderUI( 0, TRUE ); + UpdateYSliderUI( 0, TRUE ); + UpdateZSliderUI( 0, TRUE ); + } + + +BOOL ListenerInfo::OnCommand( WPARAM wParam, LPARAM lParam ) + { + char szEdit[16]; + + if( HIWORD(wParam) == EN_CHANGE ) + { + if( (HWND)lParam == m_hDistanceEdit ) + { + Edit_GetText( m_hDistanceEdit, szEdit, sizeof(szEdit)); + + ASSERT( NULL != gp3DListener ); + DPF( 3, "Setting Distance Factor: %s", szEdit ); + gp3DListener->SetDistanceFactor(D3DVAL(atof(szEdit)), DS3D_IMMEDIATE ); + } + else if((HWND)lParam == m_hDopplerEdit ) + { + Edit_GetText( m_hDopplerEdit, szEdit, sizeof(szEdit)); + + ASSERT( NULL != gp3DListener ); + DPF( 3, "Setting Doppler Factor: %s", szEdit ); + gp3DListener->SetDopplerFactor(D3DVAL(atof(szEdit)), DS3D_IMMEDIATE ); + } + else if((HWND)lParam == m_hRolloffEdit ) + { + Edit_GetText( m_hRolloffEdit, szEdit, sizeof(szEdit)); + + ASSERT( NULL != gp3DListener ); + DPF( 3, "Setting Rolloff Factor: %s", szEdit ); + gp3DListener->SetRolloffFactor(D3DVAL(atof(szEdit)), DS3D_IMMEDIATE ); + } + } + return FALSE; + } + + +/////////////////////////////////////////////////////////////////////////////// +// OnHScroll() +// +// Main message handler for the WM_HSCROLL message. this function basically +// figures out which horizontal scrolling control is responsible for sending +// the message and passes on handling to an appropriate function for handling. +// +BOOL ListenerInfo::OnHScroll( WORD wNotification, LONG lPos, HWND hControl ) + { + if( !hControl ) + return FALSE; + + if( hControl == m_hXSlider ) + { + HandleXSliderScroll( wNotification, lPos ); + return TRUE; + } + else if( hControl == m_hYSlider ) + { + HandleYSliderScroll( wNotification, lPos ); + return TRUE; + } + else if( hControl == m_hZSlider ) + { + HandleZSliderScroll( wNotification, lPos ); + return TRUE; + } + else + return FALSE; + } + + +void ListenerInfo::OnDestroy( void ) + { + } + + +BOOL CALLBACK ListenerInfoDlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) + { + PLISTENERINFO pli; + + switch( message ) + { + case WM_INITDIALOG: + ASSERT( lParam != NULL ); + pli = (PLISTENERINFO)lParam; + SetWindowLong( hDlg, DWL_USER, (LONG)pli ); + + if( !pli->OnInitDialog( hDlg, wParam )) + DestroyWindow( hDlg ); + return TRUE; + + case WM_HSCROLL: + pli = (PLISTENERINFO)GetWindowLong( hDlg, DWL_USER ); + ASSERT( NULL != pli ); + return !pli->OnHScroll( LOWORD(wParam), (LONG)HIWORD(wParam), (HWND)lParam ); + + case WM_COMMAND: + pli = (PLISTENERINFO)GetWindowLong( hDlg, DWL_USER ); + // It's possible to get child notifications before the + // INITDIALOG message, so we'll handle a NULL class item + // here a less stringently + if( !pli ) + return FALSE; + return !pli->OnCommand( wParam, lParam ); + + case WM_DESTROY: + pli = (PLISTENERINFO)GetWindowLong( hDlg, DWL_USER ); + ASSERT( NULL != pli ); + pli->OnDestroy(); + return TRUE; + + default: + return FALSE; + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void ListenerInfo::SetSliders( void ) + { + SendMessage( m_hXSlider, TBM_SETRANGEMIN, FALSE, + (LPARAM)(LISTENER_SLIDER_MIN + LISTENER_SLIDER_SHIFT) / LISTENER_SLIDER_FACTOR ); + SendMessage( m_hXSlider, TBM_SETRANGEMAX, FALSE, + (LPARAM)(LISTENER_SLIDER_MAX + LISTENER_SLIDER_SHIFT) / LISTENER_SLIDER_FACTOR ); + SendMessage( m_hXSlider, TBM_SETPAGESIZE, 0, LISTENER_SLIDER_FACTOR); + + SendMessage( m_hYSlider, TBM_SETRANGEMIN, FALSE, + (LPARAM)(LISTENER_SLIDER_MIN + LISTENER_SLIDER_SHIFT) / LISTENER_SLIDER_FACTOR ); + SendMessage( m_hYSlider, TBM_SETRANGEMAX, FALSE, + (LPARAM)(LISTENER_SLIDER_MAX + LISTENER_SLIDER_SHIFT) / LISTENER_SLIDER_FACTOR ); + SendMessage( m_hYSlider, TBM_SETPAGESIZE, 0, LISTENER_SLIDER_FACTOR); + + SendMessage( m_hZSlider, TBM_SETRANGEMIN, FALSE, + (LPARAM)(LISTENER_SLIDER_MIN + LISTENER_SLIDER_SHIFT) / LISTENER_SLIDER_FACTOR ); + SendMessage( m_hZSlider, TBM_SETRANGEMAX, FALSE, + (LPARAM)(LISTENER_SLIDER_MAX + LISTENER_SLIDER_SHIFT) / LISTENER_SLIDER_FACTOR ); + SendMessage( m_hZSlider, TBM_SETPAGESIZE, 0, LISTENER_SLIDER_FACTOR); + + UpdateUI(); + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void ListenerInfo::HandleXSliderScroll( WORD wNot, LONG lPos ) + { + HRESULT hr; + BOOL fUpdate = TRUE; + + switch( wNot ) + { + case TB_THUMBTRACK: + break; + + case TB_ENDTRACK: + case TB_LINEDOWN: + case TB_LINEUP: + case TB_PAGEDOWN: + case TB_PAGEUP: + lPos = SendMessage( m_hXSlider, TBM_GETPOS, 0, 0 ); + break; + + default: + fUpdate = FALSE; + } + + if( fUpdate && NULL != gp3DListener ) + { + m_vPos.x = D3DVAL(lPos * LISTENER_SLIDER_FACTOR) - LISTENER_SLIDER_SHIFT; + DPF( 3, "Setting listener pos: (%i, %i, %i)", (int)m_vPos.x, (int)m_vPos.y, (int)m_vPos.z ); + if( FAILED( hr = gp3DListener->SetPosition( m_vPos.x, m_vPos.y, + m_vPos.z, DS3D_IMMEDIATE ))) + DPF( 0, "IDirectSound3DListener::SetPosition returned : %s", TranslateDSError(hr)); + UpdateXSliderUI((lPos * LISTENER_SLIDER_FACTOR) - LISTENER_SLIDER_SHIFT, FALSE ); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void ListenerInfo::HandleYSliderScroll( WORD wNot, LONG lPos ) + { + HRESULT hr; + BOOL fUpdate = TRUE; + + switch( wNot ) + { + case TB_THUMBTRACK: + break; + + case TB_ENDTRACK: + case TB_LINEDOWN: + case TB_LINEUP: + case TB_PAGEDOWN: + case TB_PAGEUP: + lPos = SendMessage( m_hYSlider, TBM_GETPOS, 0, 0 ); + break; + + default: + fUpdate = FALSE; + } + + if( fUpdate && NULL != gp3DListener ) + { + m_vPos.y = D3DVAL(lPos * LISTENER_SLIDER_FACTOR) - LISTENER_SLIDER_SHIFT; + DPF( 3, "Setting listener pos: (%i, %i, %i)", (int)m_vPos.x, (int)m_vPos.y, (int)m_vPos.z ); + if( FAILED( hr = gp3DListener->SetPosition( m_vPos.x, m_vPos.y, + m_vPos.z, DS3D_IMMEDIATE ))) + DPF( 0, "IDirectSound3DListener::SetPosition returned : %s", TranslateDSError(hr)); + UpdateYSliderUI((lPos * LISTENER_SLIDER_FACTOR) - LISTENER_SLIDER_SHIFT, FALSE ); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void ListenerInfo::HandleZSliderScroll( WORD wNot, LONG lPos ) + { + HRESULT hr; + BOOL fUpdate = TRUE; + + switch( wNot ) + { + case TB_THUMBTRACK: + break; + + case TB_ENDTRACK: + case TB_LINEDOWN: + case TB_LINEUP: + case TB_PAGEDOWN: + case TB_PAGEUP: + lPos = SendMessage( m_hZSlider, TBM_GETPOS, 0, 0 ); + break; + + default: + fUpdate = FALSE; + } + + if( fUpdate && NULL != gp3DListener ) + { + m_vPos.z = D3DVAL(lPos * LISTENER_SLIDER_FACTOR) - LISTENER_SLIDER_SHIFT; + DPF( 3, "Setting listener pos: (%i, %i, %i)", (int)m_vPos.x, (int)m_vPos.y, (int)m_vPos.z ); + if( FAILED( hr = gp3DListener->SetPosition( m_vPos.x, m_vPos.y, + m_vPos.z, DS3D_IMMEDIATE ))) + DPF( 0, "IDirectSound3DListener::SetPosition returned : %s", TranslateDSError(hr)); + UpdateZSliderUI((lPos * LISTENER_SLIDER_FACTOR) - LISTENER_SLIDER_SHIFT, FALSE ); + } + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdateXSliderUI() +// +// Update anything that displays the position of the X slider in some manner +// to reflect the new position, either from the buffer or from the parameter. +// +void ListenerInfo::UpdateXSliderUI( LONG lForcePos, BOOL fFromInterface ) + { + char szText[8]; + LONG lPos; + + if( fFromInterface ) + { + if( NULL != gp3DListener ) + { + gp3DListener->GetPosition( &m_vPos ); + lPos = (LONG)m_vPos.x; + } + else + lPos = 0; + } + else + lPos = lForcePos; + + SendMessage( m_hXSlider, TBM_SETPOS, (WPARAM)TRUE, + (LPARAM)(lPos + LISTENER_SLIDER_SHIFT) / LISTENER_SLIDER_FACTOR ); + wsprintf( szText, "%i", lPos ); + Static_SetText( m_hXText, szText ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdateYSliderUI() +// +// Update anything that displays the position of the Y slider in some manner +// to reflect the new position, either from the buffer or from the parameter. +// +void ListenerInfo::UpdateYSliderUI( LONG lForcePos, BOOL fFromInterface ) + { + char szText[8]; + LONG lPos; + + if( fFromInterface ) + { + if( NULL != gp3DListener ) + { + gp3DListener->GetPosition( &m_vPos ); + lPos = (LONG)m_vPos.y; + } + else + lPos = 0; + } + else + lPos = lForcePos; + + SendMessage( m_hYSlider, TBM_SETPOS, (WPARAM)TRUE, + (LPARAM)(lPos + LISTENER_SLIDER_SHIFT) / LISTENER_SLIDER_FACTOR ); + wsprintf( szText, "%i", lPos ); + Static_SetText( m_hYText, szText ); + } + + +/////////////////////////////////////////////////////////////////////////////// +// UpdateZSliderUI() +// +// Update anything that displays the position of the Z slider in some manner +// to reflect the new position, either from the buffer or from the parameter. +// +void ListenerInfo::UpdateZSliderUI( LONG lForcePos, BOOL fFromInterface ) + { + char szText[8]; + LONG lPos; + + if( fFromInterface ) + { + if( NULL != gp3DListener ) + { + gp3DListener->GetPosition( &m_vPos ); + lPos = (LONG)m_vPos.z; + } + else + lPos = 0; + } + else + lPos = lForcePos; + + SendMessage( m_hZSlider, TBM_SETPOS, (WPARAM)TRUE, + (LPARAM)(lPos + LISTENER_SLIDER_SHIFT) / LISTENER_SLIDER_FACTOR ); + wsprintf( szText, "%i", lPos ); + Static_SetText( m_hZText, szText ); + } + + + + diff --git a/sdk/samples/dsshow3d/lsnrinfo.h b/sdk/samples/dsshow3d/lsnrinfo.h new file mode 100644 index 0000000..c6fefc7 --- /dev/null +++ b/sdk/samples/dsshow3d/lsnrinfo.h @@ -0,0 +1,51 @@ +#ifndef __LISTENERINFO_H__ +#define __LISTENERINFO_H__ + +#define LISTENER_SLIDER_MAX (50) +#define LISTENER_SLIDER_MIN (-LISTENER_SLIDER_MAX) +#define LISTENER_SLIDER_FACTOR (1) +#define LISTENER_SLIDER_SHIFT (LISTENER_SLIDER_MAX) + +class ListenerInfo +{ +friend BOOL CALLBACK ListenerInfoDlgProc( HWND, UINT, WPARAM, LPARAM ); + +public: + ListenerInfo(); + ~ListenerInfo(); + + void UpdateUI( void ); + +// Useful protected member functions +protected: + BOOL OnInitDialog( HWND, WPARAM ); + BOOL OnCommand( WPARAM, LPARAM ); + BOOL OnHScroll( WORD, LONG, HWND ); + void OnDestroy( void ); + + void HandleXSliderScroll( WORD, LONG ); + void HandleYSliderScroll( WORD, LONG ); + void HandleZSliderScroll( WORD, LONG ); + + void UpdateXSliderUI( LONG, BOOL ); + void UpdateYSliderUI( LONG, BOOL ); + void UpdateZSliderUI( LONG, BOOL ); + + void SetSliders( void ); + +protected: + HWND m_hDistanceEdit, m_hDopplerEdit, m_hRolloffEdit; + HWND m_hXSlider, m_hYSlider, m_hZSlider; + HWND m_hXText, m_hYText, m_hZText; + + D3DVECTOR m_vPos; +}; + + +typedef ListenerInfo * PLISTENERINFO; + +BOOL CALLBACK ListenerInfoDlgProc( HWND, UINT, WPARAM, LPARAM ); + +#endif + + diff --git a/sdk/samples/dsshow3d/mainwnd.cpp b/sdk/samples/dsshow3d/mainwnd.cpp new file mode 100644 index 0000000..3313926 --- /dev/null +++ b/sdk/samples/dsshow3d/mainwnd.cpp @@ -0,0 +1,655 @@ +#include <windows.h> +#include <windowsx.h> +#include <commctrl.h> +#include <commdlg.h> + +#include "resource.h" +#include "DSShow3D.h" +#include "GVars.h" + +#include "MainWnd.h" +#include "FInfo3D.h" +#include "FileInfo.h" +#include "LsnrInfo.h" +#include "wave.h" +#include "debug.h" + +static HWND hMainWndClient; + +MainWnd::MainWnd() +{ + m_fCreated = FALSE; + m_hwnd = NULL; + m_n3DBuffers = 0; + ZeroMemory( &m_dscaps, sizeof(DSCAPS)); + m_dscaps.dwSize = sizeof(m_dscaps); +} + + +MainWnd::~MainWnd() +{ + // This situation should never really occur, but we should make sure + // that there are no coding errors by asserting that fact. + if( m_hwnd ) + { + ASSERT_HWND(m_hwnd); + ::DestroyWindow( m_hwnd ); + m_hwnd = NULL; + m_fCreated = FALSE; + } +} + + +BOOL MainWnd::Create() +{ + if( m_fCreated ) + return FALSE; + + ASSERT( NULL == m_hwnd ); + m_hwnd = CreateWindowEx( WS_EX_ACCEPTFILES, + gszAppWndClass, + gszAppCaption, + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, + CW_USEDEFAULT, + 200, + 150, + (HWND)NULL, + (HMENU)NULL, + (HANDLE)ghInst, + (LPSTR)NULL ); + + if( !m_hwnd ) + return FALSE; + + SetWindowLong( m_hwnd, GWL_USERDATA, (LONG)this ); + m_fCreated = TRUE; + + EnableMenuItem(GetMenu(m_hwnd), 2, MF_BYPOSITION | + (m_dlInfoList.GetElementCount() ? MF_ENABLED : MF_GRAYED)); + DrawMenuBar( m_hwnd ); + + UpdateStatus(); + + return TRUE; +} + + +int MainWnd::MessageBox( LPCSTR lpcszMessage, UINT uType ) +{ + return ::MessageBox( m_hwnd, lpcszMessage, gszAppName, uType ); +} + +int MainWnd::MessageBox( UINT uResID, UINT uType ) +{ + // TODO Make the 512 some defined constant + LPTSTR lptszMessage = new TCHAR[512]; + int nRet; + + if( !lptszMessage ) + return 0; + + LoadString( ghInst, uResID, lptszMessage, 512 ); + nRet = ::MessageBox( m_hwnd, lptszMessage, gszAppName, uType ); + delete[] lptszMessage; + + return nRet; +} + +BOOL MainWnd::OnTimer( WPARAM wParam, LPARAM lParam ) +{ + // Move to the Head of the list + m_dlInfoList.SetAtHead(); + + if( NULL != gpListenerInfo ) + gpListenerInfo->UpdateUI(); + + // While the current element isn't NULL, call OnTimer on each FileInfo + for( int i = 0; i < m_dlInfoList.GetElementCount(); i++ ) + { + m_dlInfoList.GetCurrent()->UpdateUI(); + // Overloaded increment moves to next position in the list + m_dlInfoList++; + } + return TRUE; +} + +void MainWnd::OnDestroy() +{ + HRESULT hr = 0; + + if( gdwTimer != 0 ) + { + KillTimer( m_hwnd, gdwTimer ); + gdwTimer = 0; + } + + if( NULL != gpwfxFormat ) + { + delete gpwfxFormat; + gpwfxFormat = NULL; + } + + /* Destroy the direct sound object. */ + if( gp3DListener != NULL ) + { + DPF( 3, "Releasing 3D Listener in MainWnd::OnDestroy()" ); + gp3DListener->Release(); + gp3DListener = NULL; + } + if( gpdsbPrimary ) + { + DPF( 3, "Releasing Primary in MainWnd::OnDestroy()" ); + gpdsbPrimary->Stop(); + gpdsbPrimary->Release(); + gpdsbPrimary = NULL; + } + if( gpds != NULL ) + { + DPF( 3, "Releasing DSound object in MainWnd::OnDestroy()" ); + gpds->Release(); + gpds = NULL; + } + + if( gfCOMInitialized ) + CoUninitialize(); + +// WriteProfileString( gszAppName, "EnumDrivers", gfEnumDrivers ? "1" : "0" ); + + if( m_hwnd ) + m_hwnd = NULL; + return; +} + + +/* MainWndProc() + * + * Window message handler function for the main application window. + * For the most part, this sucker just dispatchs calls to some helper + * functions in this module which do the actual handling. + */ +LRESULT CALLBACK MainWndProc( HWND hWnd, unsigned message, WPARAM wParam, LPARAM lParam ) +{ + if( !hWnd ) + return 0L; + + // This will be a valid pointer to the class object for any message + // after the WM_CREATE + MainWnd *pmw = (MainWnd *)GetWindowLong( hWnd, GWL_USERDATA ); + + switch (message) + { + case WM_CREATE: + // If we want to do anything with the class here, we'll have + // to modify the code to pass pmw in LPARAM since there's no + // other way to get it yet: the code that sets the WindowLong + // user data has not yet executed + break; + + case WM_ACTIVATE: + ASSERT( NULL != pmw ); + pmw->UpdateStatus(); + break; + + case WM_TIMER: + ASSERT( NULL != pmw ); + if (!pmw->OnTimer(wParam, lParam)) + return(DefWindowProc(hWnd, message, wParam, lParam)); + break; + + case WM_DROPFILES: + ASSERT( NULL != pmw ); + if( !pmw->OnDropFiles( wParam )) + return(DefWindowProc(hWnd, message, wParam, lParam)); + break; + + case WM_PAINT: + ASSERT( NULL != pmw ); + if( !pmw->OnPaint(wParam, lParam)) + return(DefWindowProc(hWnd, message, wParam, lParam)); + break; + + case WM_INITMENU: + ASSERT( NULL != pmw ); + if((HMENU)wParam != GetMenu( hWnd )) + break; + return pmw->OnInitMenu( wParam ); + break; + + case WM_COMMAND: + ASSERT( NULL != pmw ); + if (!pmw->OnCommand(wParam, lParam)) + return DefWindowProc(hWnd, message, wParam, lParam); + break; + + case WM_DESTROY: + ASSERT( NULL != pmw ); + pmw->OnDestroy(); + PostQuitMessage(0); + break; + + default: + return DefWindowProc( hWnd, message, wParam, lParam ); + break; + } + + return 0L; +} + + +BOOL MainWnd::OnInitMenu( WPARAM wParam ) +{ + int i; + + CheckMenuItem( (HMENU)wParam, + CommandIDFromFormatCode( gdwOutputFormat ), + MF_BYCOMMAND | MF_CHECKED ); + + for( i = 0; i < NUM_FORMATENTRIES; i++ ) + { + if( !fdFormats[i].fEnable ) + EnableMenuItem((HMENU)wParam, + CommandIDFromFormatCode( fdFormats[i].dwCode ), + MF_BYCOMMAND | MF_GRAYED ); + else + EnableMenuItem((HMENU)wParam, + CommandIDFromFormatCode( fdFormats[i].dwCode ), + MF_BYCOMMAND | MF_ENABLED ); + } + // If there are no buffers open, then disable the buffers menu + EnableMenuItem((HMENU)wParam, 2, MF_BYPOSITION | + (m_dlInfoList.GetElementCount() ? MF_ENABLED : MF_GRAYED)); + return TRUE; +} + +/* OnDropFiles() + * + * Handles the WM_DROPFILES message, which is a message sent when someone + * drags and drops files onto our application window. + */ +BOOL MainWnd::OnDropFiles( WPARAM wParam ) +{ + WORD wNumFiles = DragQueryFile((HDROP)wParam, (UINT)-1, NULL, (UINT)0 ); + WORD nFile, nPathLength; + LPSTR lpszFile; + + for( nFile = 0; nFile < wNumFiles; nFile++ ) + { + nPathLength = DragQueryFile((HDROP)wParam, nFile, NULL, 0 ) + 1; + if(( lpszFile = new char[nPathLength] ) == NULL ) + continue; + DragQueryFile((HDROP)wParam, nFile, lpszFile, nPathLength ); + + // Open the file + OnFileOpen( lpszFile ); + + delete[] lpszFile; + } + + DragFinish((HDROP)wParam); + return TRUE; +} + + +/* OnCommand() + * + * WM_COMMAND message handler for the main window procedure. + */ +BOOL MainWnd::OnCommand( WPARAM wParam, LPARAM lParam ) +{ + HRESULT hr; + DWORD dwNewFormat; + int i = 0; + + if(( dwNewFormat = FormatCodeFromCommandID( LOWORD(wParam))) != 0 ) + { + CheckMenuItem( GetMenu( m_hwnd ), + CommandIDFromFormatCode( gdwOutputFormat ), + MF_BYCOMMAND | MF_UNCHECKED ); + FormatCodeToWFX( dwNewFormat, gpwfxFormat ); + DPF( 2, "Setting output format to code: %lu", dwNewFormat ); + hr = gpdsbPrimary->SetFormat( gpwfxFormat ); + if( SUCCEEDED( hr )) + gdwOutputFormat = dwNewFormat; + else + { + DisableFormatCode( dwNewFormat ); + EnableMenuItem( GetMenu( m_hwnd ), + CommandIDFromFormatCode( dwNewFormat ), + MF_BYCOMMAND | MF_GRAYED ); + FormatCodeToWFX( gdwOutputFormat, gpwfxFormat ); + gpdsbPrimary->SetFormat( gpwfxFormat ); + } + return TRUE; + } + + switch( LOWORD(wParam)) + { + case IDC_FILE_EXIT: + PostMessage(WM_CLOSE, 0, 0); + break; + + case IDC_FILE_OPEN: + OnFileOpen( NULL ); + UpdateStatus(); + break; + + case IDC_OPTIONS_SETTINGS: + DialogBox(ghInst, MAKEINTRESOURCE(IDD_SETTINGS), + m_hwnd, (DLGPROC)SettingsDlgProc); + UpdateStatus(); + break; + + case IDC_BUFFERS_MINIMIZEALL: + m_dlInfoList.SetAtHead(); + for( i = 0; i < m_dlInfoList.GetElementCount(); i++) + { + m_dlInfoList.GetCurrent()->MinimizeWindow(); + m_dlInfoList++; + } + break; + + case IDC_BUFFERS_RESTOREALL: + m_dlInfoList.SetAtHead(); + for( i = 0; i < m_dlInfoList.GetElementCount(); i++) + { + m_dlInfoList.GetCurrent()->RestoreWindow(); + m_dlInfoList++; + } + break; + + case IDC_BUFFERS_CLOSEALL: + while( m_dlInfoList.GetElementCount()) + { + m_dlInfoList.SetAtHead(); + m_dlInfoList.GetCurrent()->Close(); + // Element is removed from the list by processing elsewhere + } + EnableMenuItem(GetMenu(m_hwnd), 2, MF_BYPOSITION | + (m_dlInfoList.GetElementCount() ? MF_ENABLED : MF_GRAYED)); + DrawMenuBar( m_hwnd ); + break; + + case IDC_BUFFERS_CASCADE: + m_dlInfoList.SetAtHead(); + for( i = 0; i < m_dlInfoList.GetElementCount(); i++) + { + if( 0 == i ) + m_dlInfoList.GetCurrent()->ResetCascade(); + m_dlInfoList.GetCurrent()->CascadeWindow(); + m_dlInfoList++; + } + break; + + case IDC_HELP_ABOUT: + DialogBox(ghInst, MAKEINTRESOURCE(IDD_ABOUT), + m_hwnd, (DLGPROC)AboutDlgProc); + break; + + default: + return FALSE; + } + + /* If we broke out of the switch, it means we handled the message + * so we return TRUE to indicate this. + */ + return TRUE; +} + + +/* DuplicateBuffer() + * + * Does the work of duplicating a FileInfo object. + */ +void MainWnd::DuplicateBuffer( FileInfo *pfiSource ) +{ + FileInfo *pfiNew; + + if( NULL == pfiSource ) + return; + + if( m_dlInfoList.GetElementCount() >= MAXCONTROLS ) + { + MessageBox( "No more controls allowed" ); + return; + } + + if( pfiSource->Is3D()) + { + m_n3DBuffers++; + pfiNew = new FileInfo3D( this ); + } + else + pfiNew = new FileInfo( this ); + + if( NULL == pfiNew ) + return; + + pfiNew->Duplicate( pfiSource ); + m_dlInfoList.Append( pfiNew ); +} + + +/* OnFileOpen() + * + * Handles the File|Open menu command. + */ +FileInfo *MainWnd::OnFileOpen( LPSTR lpszForcePath ) +{ + char szFileName[MAX_PATH]; + FileInfo *pFileInfo = NULL; + LPSTR lpszFileTitle; + int nFileIndex; + DWORD dwFlags; + + if( m_dlInfoList.GetElementCount() >= MAXCONTROLS ) + { + MessageBox( "No more controls allowed" ); + return NULL; + } + + if( NULL != lpszForcePath ) + { + dwFlags = OPENFILENAME_F_GETPOS2; + if( grs.dwDefaultFocusFlag & DSBCAPS_STICKYFOCUS ) + dwFlags |= OPENFILENAME_F_STICKYFOCUS; + else if( grs.dwDefaultFocusFlag & DSBCAPS_GLOBALFOCUS ) + dwFlags |= OPENFILENAME_F_GLOBALFOCUS; + + if( grs.fOpen3D ) + dwFlags |= OPENFILENAME_F_3D; + lpszFileTitle = strrchr( lpszForcePath, '\\' ); + if( NULL == lpszFileTitle ) + nFileIndex = 0; + else + nFileIndex = lpszFileTitle - lpszForcePath + sizeof(char); + lstrcpy( szFileName, lpszForcePath ); + } + else + { + // Open the file, and check its format, etc. + if( !OpenFileDialog( m_hwnd, szFileName, &nFileIndex, &dwFlags )) + return NULL; + } + + // Allocate the memory for the structure. + if( dwFlags & OPENFILENAME_F_3D ) + { + pFileInfo = new FileInfo3D( this ); + } + else + pFileInfo = new FileInfo( this ); + + if( NULL == pFileInfo ) + { + MessageBox( "Cannot add this file -- out of memory", + MB_OK|MB_ICONSTOP ); + goto ERROR_DONE_ROUTINE; + } + + if( m_dlInfoList.GetElementCount() == 0 ) + pFileInfo->ResetCascade(); + + m_dlInfoList.Append( pFileInfo ); + + pFileInfo->SetSticky((dwFlags & OPENFILENAME_F_STICKYFOCUS) + ? TRUE : FALSE ); + pFileInfo->SetGlobal((dwFlags & OPENFILENAME_F_GLOBALFOCUS) + ? TRUE : FALSE ); + pFileInfo->Set3D((dwFlags & OPENFILENAME_F_3D) ? TRUE : FALSE ); + pFileInfo->SetUseGetPos2((dwFlags & OPENFILENAME_F_GETPOS2) + ? TRUE : FALSE ); + + if( pFileInfo->LoadWave( szFileName, nFileIndex ) != 0 ) + { + m_dlInfoList.Remove( pFileInfo ); + goto ERROR_DONE_ROUTINE; + } + + // If we fail after this, make sure to update the list!!! + if( pFileInfo->Is3D()) + { + if( m_n3DBuffers++ == 0 ) + { + // We only want to create this dialog once, and if this is the + // first 3D buffer opened, then there should be no listener DLG yet + ASSERT( NULL == ghwndListener ); + + gpListenerInfo = new ListenerInfo; + ghwndListener = CreateDialogParam( ghInst, + MAKEINTRESOURCE(IDD_3DLISTENER), + AppWnd.GetHwnd(), + (DLGPROC)ListenerInfoDlgProc, + (LPARAM)(gpListenerInfo)); + ::ShowWindow( ghwndListener, SW_SHOW ); + } + } + + // If there are no buffers open, then disable the buffers menu + EnableMenuItem(GetMenu(m_hwnd), 2, MF_BYPOSITION | + (m_dlInfoList.GetElementCount() ? MF_ENABLED : MF_GRAYED)); + DrawMenuBar( m_hwnd ); + + return pFileInfo; + + +ERROR_DONE_ROUTINE: + if( pFileInfo != NULL ) + { + delete pFileInfo; + pFileInfo = NULL; + } + return NULL; +} + + +/* DestroyFileInfo() + * + * Destroys a FileInfo structure and removes it from the list. + */ +void MainWnd::DestroyFileInfo( FileInfo *pfi ) +{ + if( NULL == pfi ) + return; + + if( pfi->Is3D() ) + { + if( --m_n3DBuffers == 0 ) + { + ::DestroyWindow( ghwndListener ); + ghwndListener = NULL; + delete gpListenerInfo; + gpListenerInfo = NULL; + } + } + + m_dlInfoList.Remove( pfi ); + delete pfi; + UpdateStatus(); +} + + +BOOL MainWnd::OnPaint( WPARAM wParam, LPARAM lParam ) + { + PAINTSTRUCT ps; + RECT rcClient; + SIZE sizeExtent; + char szText[128]; + + if( !BeginPaint( m_hwnd, &ps )) + return FALSE; + + GetClientRect( m_hwnd, &rcClient ); + + SetBkMode( ps.hdc, TRANSPARENT ); + + wsprintf( szText, "Free HW Mem: %luKb", m_dscaps.dwFreeHwMemBytes / 1024 ); + GetTextExtentPoint32( ps.hdc, szText, lstrlen(szText), &sizeExtent ); + + DrawText( ps.hdc, szText, -1, &rcClient, DT_TOP | DT_LEFT ); + + wsprintf( szText, "Free HW Buffers: %lu", m_dscaps.dwFreeHwMixingStaticBuffers ); + rcClient.top += sizeExtent.cy; + DrawText( ps.hdc, szText, -1, &rcClient, DT_TOP | DT_LEFT ); + + EndPaint( m_hwnd, &ps ); + return TRUE; + } + + +void MainWnd::UpdateStatus( void ) + { + if( gpds ) + { + // Get updated statistics on the DSound device + gpds->GetCaps( &m_dscaps ); + + // Force a window client area repaint + InvalidateRect( m_hwnd, NULL, TRUE ); + UpdateWindow(); + } + } + +//////////////////////////////////////////////////////////////////////////// +// BatchOpenFiles() +// +// Takes an array of string pointers and tries to open each as a file to +// playback. If fPlay is TRUE, the files will be played as they are being +// opened. If fLoop is TRUE, they will also be set to loop. +// +// Returns: FALSE in the event of catastrophic failure, otherwise TRUE. +// +BOOL MainWnd::BatchOpenFiles( PSTR *ppszFiles, int nFiles, BOOL fPlay, BOOL fLoop ) +{ + FileInfo *pfi; + int i; + + // Cap the number of files we can load out of the given set if we'd load + // too many otherwise + if( m_dlInfoList.GetElementCount() >= MAXCONTROLS ) + { + MessageBox( "No more controls allowed" ); + return FALSE; + } + + for( i = 0; i < nFiles; i++ ) + { + if(( pfi = OnFileOpen( ppszFiles[i] )) == NULL ) + continue; + + // LOOP is only obeyed if PLAY was also specified + if( fPlay ) + { + if( fLoop ) + { + pfi->SetLooped( TRUE ); + } + pfi->PlayBuffer(); + } + + pfi->UpdateUI(); + } + + return TRUE; +} + diff --git a/sdk/samples/dsshow3d/mainwnd.h b/sdk/samples/dsshow3d/mainwnd.h new file mode 100644 index 0000000..180f12d --- /dev/null +++ b/sdk/samples/dsshow3d/mainwnd.h @@ -0,0 +1,61 @@ +#ifndef __MAINWND_H__ +#define __MAINWND_H__ + +// Pickup the ASSERT_HWND() macro +#include "DbList.h" + +class MainWnd +{ + friend LRESULT CALLBACK MainWndProc(HWND, unsigned, WPARAM, LPARAM); +public: + MainWnd(); + ~MainWnd(); + + BOOL Create(); + BOOL BatchOpenFiles( PSTR *, int, BOOL, BOOL ); + + void UpdateStatus( void ); + inline HWND GetHwnd() { return m_hwnd; } + + void DuplicateBuffer( FileInfo *pfiSource ); + void DestroyFileInfo( FileInfo *pfi ); + + // For convenience, we redefine some global window related functions as + // members of this class since we can automagically validate and pass the + // HWND for the class object. + BOOL UpdateWindow() { ASSERT_HWND( m_hwnd ); + return ::UpdateWindow( m_hwnd ); } + BOOL ShowWindow( int cmdShow ) { ASSERT_HWND( m_hwnd ); + return ::ShowWindow( m_hwnd, cmdShow ); } + LRESULT SendMessage( UINT m, WPARAM w, LPARAM l ) + { ASSERT_HWND( m_hwnd ); return ::SendMessage( m_hwnd, m, w, l ); } + LRESULT PostMessage( UINT m, WPARAM w, LPARAM l ) + { ASSERT_HWND( m_hwnd ); return ::PostMessage( m_hwnd, m, w, l ); } + int MessageBox( LPCSTR, UINT uType = MB_OK | MB_APPLMODAL ); + int MessageBox( UINT uResID, UINT uType = MB_OK | MB_APPLMODAL ); + +protected: + void OnDestroy( void ); + BOOL OnCommand( WPARAM, LPARAM ); + BOOL OnTimer( WPARAM, LPARAM ); + BOOL OnPaint( WPARAM, LPARAM ); + BOOL OnDropFiles( WPARAM ); + BOOL OnInitMenu( WPARAM ); + + FileInfo *OnFileOpen( LPSTR ); + +protected: + HWND m_hwnd; + BOOL m_fCreated; + int m_n3DBuffers; + DSCAPS m_dscaps; + + DbLinkedList<class FileInfo *> m_dlInfoList; + +}; + + + +#endif + + diff --git a/sdk/samples/dsshow3d/makefile b/sdk/samples/dsshow3d/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/dsshow3d/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/dsshow3d/makefile.wat b/sdk/samples/dsshow3d/makefile.wat new file mode 100644 index 0000000..b705d4b --- /dev/null +++ b/sdk/samples/dsshow3d/makefile.wat @@ -0,0 +1,2 @@ +MAKENAME=watcom.mk +!include ..\watbld.mk diff --git a/sdk/samples/dsshow3d/msvc.mk b/sdk/samples/dsshow3d/msvc.mk new file mode 100644 index 0000000..6103994 --- /dev/null +++ b/sdk/samples/dsshow3d/msvc.mk @@ -0,0 +1,43 @@ +NAME = DSShow3D +EXT = EXE + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib dsound.lib shell32.lib \ + comdlg32.lib gdi32.lib winmm.lib msacm32.lib libc.lib uuid.lib ole32.lib comctl32.lib + +OBJS = debug.obj lsnrinfo.obj wave.obj mainwnd.obj dsshow3d.obj fileinfo.obj \ + finfo3d.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Ox -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/dsshow3d/readme.txt b/sdk/samples/dsshow3d/readme.txt new file mode 100644 index 0000000..e63b4d8 --- /dev/null +++ b/sdk/samples/dsshow3d/readme.txt @@ -0,0 +1,49 @@ +DSShow3D -- DirectSound3D Sample +================================ + + +THIS SAMPLE IS STILL UNDER DEVELOPMENT, PLEASE SEE THE "KNOWN ISSUES" SECTION + +This program is an improved version of the DirectSound Show (DSSHOW) sample +that shipped in previous DirectX SDKs. It features a more compact interface, +support for 3D sounds and new buffer options, the ability to open countless +sounds (i.e. more than 8, which was dsshow's limit), and a new UI that takes +advantage of your entire desktop for placing (or minimizing) windows. + +Here are some things to try: + +* Right click on a volume, frequency, or pan control to select some common + settings. + +* Frequency control will use the full range reported by IDirectSound::GetCaps() + +* Open a bunch of files :) + +* Try using the various focus settings in the File|Open Box + + + +KNOWN ISSUES: +------------- +* No text controls for 3D position + +* Hopefully the client window will get a Direct3D visual representation of the + sound world you're playing with, but this isn't certain + +* Windows all open at the same position -- there will be a cascade option, and + new windows will cascade by default + +* 3D functionality not complete for buffer controls -- missing cone orientation, + min distance, max distance + +* 3D Listener controls not present -- on the way + +* Can't move progress indicator yet + +* Doesn't stream large files automagically (yet) + +* Progress updating is kind of rough (perhaps not frequent enough) + +* Setting frequency to 0 Hz by quickly dragging doesn't behave properly + +* App may not properly respond to user log off while running diff --git a/sdk/samples/dsshow3d/reshead.h b/sdk/samples/dsshow3d/reshead.h new file mode 100644 index 0000000..30b63c2 --- /dev/null +++ b/sdk/samples/dsshow3d/reshead.h @@ -0,0 +1,15 @@ +#ifdef APSTUDIO_INVOKED // Built from inside VC +#include "afxres.h" + +#else // Built from the command-line (some command-lines don't have MFC headers) + +#undef RC_INVOKED +#define RC_INVOKED + +#undef IDC_STATIC +#define IDC_STATIC -1 + +#include "windows.h" +#include "commctrl.h" + +#endif diff --git a/sdk/samples/dsshow3d/resource.h b/sdk/samples/dsshow3d/resource.h new file mode 100644 index 0000000..8bc4eba --- /dev/null +++ b/sdk/samples/dsshow3d/resource.h @@ -0,0 +1,158 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by dsshow3d.rc +// +#define IDR_MAINMENU 101 +#define IDB_SOUNDCARD 102 +#define IDD_ABOUT 103 +#define IDI_SPEAKER_RGB 107 +#define IDI_SPEAKER_RGB_3D 109 +#define IDD_DSENUMBOX 109 +#define IDB_WAVE_3D 110 +#define IDD_FILEOPEN_NEST 110 +#define IDB_WAVE_2D 111 +#define IDB_BUTTON_LOOP 115 +#define IDI_SMALL_3D 119 +#define IDB_OVERLAY_SW 121 +#define IDB_OVERLAY_HW 122 +#define IDB_OVERLAY_S 123 +#define IDB_OVERLAY_H 124 +#define IDB_BUTTON_CLOSE 127 +#define IDB_BUTTON_PLAY 128 +#define IDB_BUTTON_STOP 129 +#define IDB_BUTTON_AUDIBLE 130 +#define IDB_BUTTON_LOOP2 131 +#define IDB_BUTTON_MUTE 132 +#define IDD_BUFFER 132 +#define IDM_POPUPS 134 +#define IDD_BUFFER3D 135 +#define IDM_BUFFERDLG 135 +#define IDD_3DLISTENER 136 +#define IDD_SETTINGS 137 +#define IDS_MB_DRIVERENUM_MESSAGE 512 +#define ID_OK 1001 +#define IDC_FONEST_3D 1001 +#define IDC_FONEST_STICKY_RADIO 1007 +#define IDC_DSENUM_COMBO 1008 +#define IDC_FONEST_GLOBAL_RADIO 1008 +#define IDC_FONEST_GETPOS_RADIO 1009 +#define IDC_FONEST_GETPOS2_RADIO 1010 +#define IDC_FONEST_LOCAL_RADIO 1012 +#define IDC_FONEST_GETPOS_GROUP 1013 +#define IDC_BUFFERDLG_PLAY_BUTTON 1014 +#define IDC_BUFFERDLG_X_SLIDER 1022 +#define IDC_BUFFERDLG_FREQ_SLIDER 1023 +#define IDC_BUFFERDLG_Y_SLIDER 1024 +#define IDS_BUFFERTYPE_HARDWARE 1024 +#define IDC_BUFFERDLG_Z_SLIDER 1025 +#define IDS_BUFFERTYPE_SOFTWARE 1025 +#define IDC_BUFFERDLG_VOL_SLIDER 1026 +#define IDS_FOCUSMODE_LOCAL 1026 +#define IDC_BUFFERDLG_PAN_SLIDER 1027 +#define IDS_FOCUSMODE_STICKY 1027 +#define IDS_FOCUSMODE_GLOBAL 1028 +#define IDS_GETPOSMODE_NORMAL 1029 +#define IDS_GETPOSMODE_GETPOS2 1030 +#define IDC_BUFFERDLG_FOCUS_TEXT 1031 +#define IDS_DATAFORMAT_STEREO 1031 +#define IDC_BUFFERDLG_GETPOS_TEXT 1032 +#define IDS_DATAFORMAT_MONO 1032 +#define IDC_BUFFERDLG_PAN_TEXT 1033 +#define IDC_BUFFERDLG_VOL_TEXT 1034 +#define IDC_BUFFERDLG_FREQ_TEXT 1035 +#define IDC_BUFFERDLG_WRITECURSOR_TEXT 1036 +#define IDC_BUFFERDLG_DATAFORMAT_TEXT 1037 +#define IDC_BUFFERDLG_PLAYCURSOR_TEXT 1038 +#define IDC_BUFFERDLG_PROGRESS_SLIDER 1039 +#define IDC_BUFFERDLG_PROGRESS_SPIN 1057 +#define IDC_BUFFERDLG_OUTERVOL_SLIDER 1059 +#define IDC_BUFFERDLG_OUTERVOL_TEXT 1060 +#define IDC_BUFFERDLG_INNERANGLE_EDIT 1062 +#define IDC_BUFFERDLG_OUTERANGLE_EDIT 1063 +#define IDC_BUFFERDLG_OUTERANGLE_SPIN 1064 +#define IDC_BUFFERDLG_INNERANGLE_SPIN 1065 +#define IDC_BUFFERDLG_PROGRESS_TEXT 1066 +#define IDC_BUFFERDLG_BUFFERTYPE_TEXT 1067 +#define IDC_BUFFERDLG_LOOPED_CHECK 1068 +#define IDC_LISTENER_DISTANCEFACTOR_EDIT 1069 +#define IDC_LISTENER_DOPPLERFACTOR_EDIT 1070 +#define IDC_LISTENER_ROLLOFFFACTOR_EDIT 1071 +#define IDC_SETTINGS_DSD_DEVICE_COMBO 1072 +#define IDC_SETTINGS_DSD_DEFAULT_CHECK 1073 +#define IDC_SETTINGS_DSD_FORMAT_COMBO 1074 +#define IDC_SETTINGS_INITIALDIR_EDIT 1075 +#define IDC_SETTINGS_EXCLUSIVE_CHECK 1077 +#define IDC_SETTINGS_DSD_DEVICE_TEXT 1078 +#define IDC_SETTINGS_OPEN3D_CHECK 1079 +#define IDC_SETTINGS_FOCUS_COMBO 1080 +#define IDC_SETTINGS_BROWSE_INITIALDIR_BUTTON 1081 +#define IDC_LISTENER_X_SLIDER 1082 +#define IDC_LISTENER_X_TEXT 1083 +#define IDC_LISTENER_Y_SLIDER 1084 +#define IDC_BUFFERDLG_Z_TEXT 1084 +#define IDC_LISTENER_Y_TEXT 1085 +#define IDC_BUFFERDLG_Y_TEXT 1085 +#define IDC_LISTENER_Z_SLIDER 1086 +#define IDC_BUFFERDLG_X_TEXT 1086 +#define IDC_LISTENER_Z_TEXT 1087 +#define IDC_BUFFERDLG_DISABLE 1088 +#define ID_FREQCONTEXT_FILEDEFAULT 40001 +#define IDC_FILE_EXIT 40002 +#define ID_FREQCONTEXT_8000HZ 40002 +#define IDC_FILE_OPEN 40003 +#define ID_FREQCONTEXT_11025HZ 40003 +#define ID_FREQCONTEXT_22050HZ 40004 +#define IDC_HELP_ABOUT 40005 +#define ID_FREQCONTEXT_44100HZ 40005 +#define ID_VOLCONTEXT_0DB 40006 +#define IDC_OPTIONS_ENUMDRIVERS 40007 +#define ID_VOLCONTEXT_10DB 40007 +#define ID_VOLCONTEXT_20DB 40008 +#define ID_VOLCONTEXT_30DB 40009 +#define ID_VOLCONTEXT_100DB 40010 +#define ID_PANCONTEXT_CENTER 40011 +#define ID_PANCONTEXT_10DB_LEFT 40012 +#define ID_PANCONTEXT_10DB_RIGHT 40013 +#define ID_PANCONTEXT_FULL_LEFT 40014 +#define ID_PANCONTEXT_FULL_RIGHT 40015 +#define ID_BUFFERDLG_FILE_OPEN 40019 +#define ID_OUTERVOLCONTEXT_0DB 40020 +#define ID_OUTERVOLCONTEXT_10DB 40021 +#define ID_OUTERVOLCONTEXT_20DB 40022 +#define ID_OUTERVOLCONTEXT_30DB 40023 +#define ID_OUTERVOLCONTEXT_100DB 40024 +#define ID_OPTIONS_FORMAT_8M8 40025 +#define ID_OPTIONS_FORMAT_8M16 40026 +#define ID_OPTIONS_FORMAT_8S8 40027 +#define ID_OPTIONS_FORMAT_8S16 40028 +#define ID_OPTIONS_FORMAT_11M8 40029 +#define ID_OPTIONS_FORMAT_11M16 40030 +#define ID_OPTIONS_FORMAT_11S8 40031 +#define ID_OPTIONS_FORMAT_11S16 40032 +#define ID_OPTIONS_FORMAT_22M8 40033 +#define ID_OPTIONS_FORMAT_22M16 40034 +#define ID_OPTIONS_FORMAT_22S8 40035 +#define ID_OPTIONS_FORMAT_22S16 40036 +#define ID_OPTIONS_FORMAT_44S16 40037 +#define ID_OPTIONS_FORMAT_44S8 40038 +#define ID_OPTIONS_FORMAT_44M16 40039 +#define ID_OPTIONS_FORMAT_44M8 40040 +#define IDC_OPTIONS_SETTINGS 40041 +#define IDC_BUFFERS_MINIMIZEALL 40042 +#define IDC_BUFFERS_RESTOREALL 40043 +#define IDC_BUFFERS_CLOSEALL 40044 +#define IDC_BUFFERS_CASCADE 40045 +#define ID_POSCONTEXT_ORIGIN 40047 +#define ID_POSCONTEXT_LISTENERPOSITION 40049 +#define ID_BUFFERDLG_DUPLICATE 40050 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 138 +#define _APS_NEXT_COMMAND_VALUE 40051 +#define _APS_NEXT_CONTROL_VALUE 1087 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sdk/samples/dsshow3d/watcom.mk b/sdk/samples/dsshow3d/watcom.mk new file mode 100644 index 0000000..62f4447 --- /dev/null +++ b/sdk/samples/dsshow3d/watcom.mk @@ -0,0 +1,43 @@ +NAME = DSShow3D +EXT = EXE + +GOALS = $(NAME).$(EXT) + +LIBS =..\..\..\lib\ddraw.lib ..\..\..\lib\dsound.lib uuid.lib ole32.lib comctl32.lib + +OBJS = debug.obj lsnrinfo.obj wave.obj mainwnd.obj dsshow3d.obj fileinfo.obj finfo3d.obj + +SYS = nt_win + +!ifdef DEBUG +COPT =-DDEBUG -d2 +LOPT = debug all +ROPT =-DDEBUG +!else +COPT =-oaxt -d1 +LOPT = +ROPT = +!endif + +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +!include ..\..\watsdk.mk + +$(NAME).$(EXT): $(OBJS) tmp.lib $(NAME).lnk $(RES) + $(LINK) $(LFLAGS) library tmp.lib @$(NAME).lnk + $(RC) $(RES) + +# +# need this because Watcom's libs don't have the ACM entries and the IMPORT +# statement on the linker doesn't work the way we want +# +tmp.lib : tmp.lbc + @wlib -q tmp.lib @tmp.lbc > NUL + +tmp.lbc : ..\$(MAKENAME) + @%write tmp.lbc ++_acmMetrics.'MSACM32.DLL'._acmMetrics.acmMetrics diff --git a/sdk/samples/dsshow3d/wave.c b/sdk/samples/dsshow3d/wave.c new file mode 100644 index 0000000..fe74cb6 --- /dev/null +++ b/sdk/samples/dsshow3d/wave.c @@ -0,0 +1,894 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: wave.c + * Content: Wave library routines. + * This file is used for loading/saving waves, and reading and + * writing waves in smaller blocks. + * Uses WaveOpenFile, WaveReadFile and WaveCloseReadFile for + * single block access to reading wave files. + * Uses WaveCreateFile, WaveWriteFile, WaveCloseWriteFile for + * single block access for writing wave files. + * Uses WaveLoadFile to load a whole wave file into memory. + * Uses WaveSaveFile to save a whole wave file into memory. + * + ***************************************************************************/ + +/* PROTOTYPES */ +#include <windows.h> +#include <mmsystem.h> +#include "wave.h" +#include "debug.h" +#include "windowsx.h" + + +/* ROUTINES */ +/* -------------------------------------------------------*/ + +/* This function will open a wave input file and prepare it for reading, + * so the data can be easily + * read with WaveReadFile. Returns 0 if successful, the error code if not. + * pszFileName - Input filename to load. + * phmmioIn - Pointer to handle which will be used + * for further mmio routines. + * ppwfxInfo - Ptr to ptr to WaveFormatEx structure + * with all info about the file. + * +*/ +int WaveOpenFile( + char *pszFileName, // (IN) + HMMIO *phmmioIn, // (OUT) + WAVEFORMATEX **ppwfxInfo, // (OUT) + MMCKINFO *pckInRIFF // (OUT) + ) +{ + HMMIO hmmioIn; + MMCKINFO ckIn; // chunk info. for general use. + PCMWAVEFORMAT pcmWaveFormat; // Temp PCM structure to load in. + WORD cbExtraAlloc; // Extra bytes for waveformatex + int nError; // Return value. + + + // Initialization... + *ppwfxInfo = NULL; + nError = 0; + hmmioIn = NULL; + + if ((hmmioIn = mmioOpen(pszFileName, NULL, MMIO_ALLOCBUF | MMIO_READ)) == NULL) + { + nError = ER_CANNOTOPEN; + goto ERROR_READING_WAVE; + } + + if ((nError = (int)mmioDescend(hmmioIn, pckInRIFF, NULL, 0)) != 0) + { + goto ERROR_READING_WAVE; + } + + + if ((pckInRIFF->ckid != FOURCC_RIFF) || (pckInRIFF->fccType != mmioFOURCC('W', 'A', 'V', 'E'))) + { + nError = ER_NOTWAVEFILE; + goto ERROR_READING_WAVE; + } + + /* Search the input file for for the 'fmt ' chunk. */ + ckIn.ckid = mmioFOURCC('f', 'm', 't', ' '); + if ((nError = (int)mmioDescend(hmmioIn, &ckIn, pckInRIFF, MMIO_FINDCHUNK)) != 0) + { + goto ERROR_READING_WAVE; + } + + /* Expect the 'fmt' chunk to be at least as large as <PCMWAVEFORMAT>; + * if there are extra parameters at the end, we'll ignore them */ + + if (ckIn.cksize < (long) sizeof(PCMWAVEFORMAT)) + { + nError = ER_NOTWAVEFILE; + goto ERROR_READING_WAVE; + } + + /* Read the 'fmt ' chunk into <pcmWaveFormat>.*/ + if (mmioRead(hmmioIn, (HPSTR) &pcmWaveFormat, (long) sizeof(pcmWaveFormat)) != (long) sizeof(pcmWaveFormat)) + { + nError = ER_CANNOTREAD; + goto ERROR_READING_WAVE; + } + + + // Ok, allocate the waveformatex, but if its not pcm + // format, read the next word, and thats how many extra + // bytes to allocate. + if (pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_PCM) + cbExtraAlloc = 0; + + else + { + // Read in length of extra bytes. + if (mmioRead(hmmioIn, (LPSTR) &cbExtraAlloc, + (long) sizeof(cbExtraAlloc)) != (long) sizeof(cbExtraAlloc)) + { + nError = ER_CANNOTREAD; + goto ERROR_READING_WAVE; + } + + } + + // Ok, now allocate that waveformatex structure. + if ((*ppwfxInfo = GlobalAlloc(GMEM_FIXED, sizeof(WAVEFORMATEX)+cbExtraAlloc)) == NULL) + { + nError = ER_MEM; + goto ERROR_READING_WAVE; + } + + // Copy the bytes from the pcm structure to the waveformatex structure + memcpy(*ppwfxInfo, &pcmWaveFormat, sizeof(pcmWaveFormat)); + (*ppwfxInfo)->cbSize = cbExtraAlloc; + + // Now, read those extra bytes into the structure, if cbExtraAlloc != 0. + if (cbExtraAlloc != 0) + { + if (mmioRead(hmmioIn, (LPSTR) (((BYTE*)&((*ppwfxInfo)->cbSize))+sizeof(cbExtraAlloc)), + (long) (cbExtraAlloc)) != (long) (cbExtraAlloc)) + { + nError = ER_NOTWAVEFILE; + goto ERROR_READING_WAVE; + } + } + + /* Ascend the input file out of the 'fmt ' chunk. */ + if ((nError = mmioAscend(hmmioIn, &ckIn, 0)) != 0) + { + goto ERROR_READING_WAVE; + + } + + + goto TEMPCLEANUP; + +ERROR_READING_WAVE: + if (*ppwfxInfo != NULL) + { + GlobalFree(*ppwfxInfo); + *ppwfxInfo = NULL; + } + + if (hmmioIn != NULL) + { + mmioClose(hmmioIn, 0); + hmmioIn = NULL; + } + +TEMPCLEANUP: + *phmmioIn = hmmioIn; + + return(nError); + +} + +/* This routine has to be called before WaveReadFile as it searchs for the chunk to descend into for + reading, that is, the 'data' chunk. For simplicity, this used to be in the open routine, but was + taken out and moved to a separate routine so there was more control on the chunks that are before + the data chunk, such as 'fact', etc... */ + +int WaveStartDataRead( + HMMIO *phmmioIn, + MMCKINFO *pckIn, + MMCKINFO *pckInRIFF + ) +{ + int nError; + + nError = 0; + + // Do a nice little seek... + if ((nError = mmioSeek(*phmmioIn, pckInRIFF->dwDataOffset + sizeof(FOURCC), SEEK_SET)) == -1) + { + ASSERT(FALSE); + } + + nError = 0; + // Search the input file for for the 'data' chunk. + pckIn->ckid = mmioFOURCC('d', 'a', 't', 'a'); + if ((nError = mmioDescend(*phmmioIn, pckIn, pckInRIFF, MMIO_FINDCHUNK)) != 0) + { + goto ERROR_READING_WAVE; + } + + goto CLEANUP; + +ERROR_READING_WAVE: + +CLEANUP: + return(nError); +} + + +/* This will read wave data from the wave file. Makre sure we're descended into + the data chunk, else this will fail bigtime! + hmmioIn - Handle to mmio. + cbRead - # of bytes to read. + pbDest - Destination buffer to put bytes. + cbActualRead- # of bytes actually read. + + + +*/ + + +int WaveReadFile( + HMMIO hmmioIn, // IN + UINT cbRead, // IN + BYTE *pbDest, // IN + MMCKINFO *pckIn, // IN. + UINT *cbActualRead // OUT. + + ) +{ + + MMIOINFO mmioinfoIn; // current status of <hmmioIn> + int nError; + UINT cT, cbDataIn; + + nError = 0; + + if (nError = mmioGetInfo(hmmioIn, &mmioinfoIn, 0) != 0) + { + goto ERROR_CANNOT_READ; + } + + cbDataIn = cbRead; + if (cbDataIn > pckIn->cksize) + cbDataIn = pckIn->cksize; + + pckIn->cksize -= cbDataIn; + + for (cT = 0; cT < cbDataIn; cT++) + { + /* Copy the bytes from the io to the buffer. */ + if (mmioinfoIn.pchNext == mmioinfoIn.pchEndRead) + { + if ((nError = mmioAdvance(hmmioIn, &mmioinfoIn, MMIO_READ)) != 0) + { + goto ERROR_CANNOT_READ; + } + if (mmioinfoIn.pchNext == mmioinfoIn.pchEndRead) + { + nError = ER_CORRUPTWAVEFILE; + goto ERROR_CANNOT_READ; + } + } + + // Actual copy. + *((BYTE*)pbDest+cT) = *((BYTE*)mmioinfoIn.pchNext)++; + } + + if ((nError = mmioSetInfo(hmmioIn, &mmioinfoIn, 0)) != 0) + { + goto ERROR_CANNOT_READ; + } + + *cbActualRead = cbDataIn; + goto FINISHED_READING; + +ERROR_CANNOT_READ: + *cbActualRead = 0; + +FINISHED_READING: + return(nError); + +} + +/* This will close the wave file openned with WaveOpenFile. + phmmioIn - Pointer to the handle to input MMIO. + ppwfxSrc - Pointer to pointer to WaveFormatEx structure. + + Returns 0 if successful, non-zero if there was a warning. + +*/ +int WaveCloseReadFile( + HMMIO *phmmio, // IN + WAVEFORMATEX **ppwfxSrc // IN + ) +{ + + if (*ppwfxSrc != NULL) + { + GlobalFree(*ppwfxSrc); + *ppwfxSrc = NULL; + } + + if (*phmmio != NULL) + { + mmioClose(*phmmio, 0); + *phmmio = NULL; + } + + return(0); + +} + +/* This routine will create a wave file for writing. This will automatically overwrite any + existing file with the same name, so be careful and check before hand!!! + pszFileName - Pointer to filename to write. + phmmioOut - Pointer to HMMIO handle that is used for further writes + pwfxDest - Valid waveformatex destination structure. + pckOut - Pointer to be set with the MMCKINFO. + pckOutRIFF - Pointer to be set with the RIFF info. + +*/ +int WaveCreateFile( + char *pszFileName, // (IN) + HMMIO *phmmioOut, // (OUT) + WAVEFORMATEX *pwfxDest, // (IN) + MMCKINFO *pckOut, // (OUT) + MMCKINFO *pckOutRIFF // (OUT) + + ) +{ + + int nError; // Return value. + DWORD dwFactChunk; // Contains the actual fact chunk. Garbage until WaveCloseWriteFile. + MMCKINFO ckOut1; + + dwFactChunk = (DWORD)-1; + nError = 0; + + *phmmioOut = mmioOpen(pszFileName, NULL, + MMIO_ALLOCBUF | MMIO_READWRITE|MMIO_CREATE); + + if (*phmmioOut == NULL) + { + nError = ER_CANNOTWRITE; + goto ERROR_CANNOT_WRITE; // cannot save WAVE file + } + + /* Create the output file RIFF chunk of form type 'WAVE'. + */ + pckOutRIFF->fccType = mmioFOURCC('W', 'A', 'V', 'E'); + pckOutRIFF->cksize = 0; + if ((nError = mmioCreateChunk(*phmmioOut, pckOutRIFF, MMIO_CREATERIFF)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + /* We are now descended into the 'RIFF' chunk we just created. + * Now create the 'fmt ' chunk. Since we know the size of this chunk, + * specify it in the MMCKINFO structure so MMIO doesn't have to seek + * back and set the chunk size after ascending from the chunk. + */ + pckOut->ckid = mmioFOURCC('f', 'm', 't', ' '); + pckOut->cksize = sizeof(PCMWAVEFORMAT); // we know the size of this ck. + if ((nError = mmioCreateChunk(*phmmioOut, pckOut, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + /* Write the PCMWAVEFORMAT structure to the 'fmt ' chunk if its that type. */ + if (pwfxDest->wFormatTag == WAVE_FORMAT_PCM) + { + if (mmioWrite(*phmmioOut, (HPSTR) pwfxDest, sizeof(PCMWAVEFORMAT)) + != sizeof(PCMWAVEFORMAT)) + { + nError = ER_CANNOTWRITE; + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + } + + else + { + // Write the variable length size. + if ((UINT)mmioWrite(*phmmioOut, (HPSTR) pwfxDest, sizeof(*pwfxDest)+pwfxDest->cbSize) + != (sizeof(*pwfxDest)+pwfxDest->cbSize)) + { + nError = ER_CANNOTWRITE; + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + } + + /* Ascend out of the 'fmt ' chunk, back into the 'RIFF' chunk. + */ + if ((nError = mmioAscend(*phmmioOut, pckOut, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + // Now create the fact chunk, not required for PCM but nice to have. This is filled + // in when the close routine is called. + ckOut1.ckid = mmioFOURCC('f', 'a', 'c', 't'); + ckOut1.cksize = 0; + if ((nError = mmioCreateChunk(*phmmioOut, &ckOut1, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + if (mmioWrite(*phmmioOut, (HPSTR)&dwFactChunk, sizeof(dwFactChunk)) != sizeof(dwFactChunk)) + { + nError = ER_CANNOTWRITE; + goto ERROR_CANNOT_WRITE; + } + + // Now ascend out of the fact chunk... + if ((nError = mmioAscend(*phmmioOut, &ckOut1, 0)) != 0) + { + nError = ER_CANNOTWRITE; // cannot write file, probably + goto ERROR_CANNOT_WRITE; + } + + + + goto DONE_CREATE; + +ERROR_CANNOT_WRITE: + // Maybe delete the half-written file? Ah forget it for now, its good to leave the + // file there for debugging... + +DONE_CREATE: + return(nError); + +} + +/* This routine has to be called before any data is written to the wave output file, via wavewritefile. This + sets up the data to write, and creates the data chunk. +*/ + +int WaveStartDataWrite( + HMMIO *phmmioOut, // (IN) + MMCKINFO *pckOut, // (IN) + MMIOINFO *pmmioinfoOut // (OUT) + ) +{ + + int nError; + + nError = 0; + /* Create the 'data' chunk that holds the waveform samples. */ + pckOut->ckid = mmioFOURCC('d', 'a', 't', 'a'); + pckOut->cksize = 0; + if ((nError = mmioCreateChunk(*phmmioOut, pckOut, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + if ((nError = mmioGetInfo(*phmmioOut, pmmioinfoOut, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; + } + + goto CLEANUP; +ERROR_CANNOT_WRITE: + +CLEANUP: + return(nError); +} + +/* This routine will write out data to a wave file. + hmmioOut - Handle to hmmioOut filled by WaveCreateFile + cbWrite - # of bytes to write out. + pbSrc - Pointer to source. + pckOut - pointer to ckOut filled by WaveCreateFile + cbActualWrite - # of actual bytes written. + pmmioinfoOut - Pointer to mmioinfoOut filled by WaveCreateFile. + + Returns 0 if successful, else the error code. + + */ + + +int WaveWriteFile( + HMMIO hmmioOut, // (IN) + UINT cbWrite, // (IN) + BYTE *pbSrc, // (IN) + MMCKINFO *pckOut, // (IN) + UINT *cbActualWrite, // (OUT) + MMIOINFO *pmmioinfoOut // (IN) + ) +{ + + + int nError; + UINT cT; + + nError = 0; + + *cbActualWrite = 0; + + for (cT=0; cT < cbWrite; cT++) + { + if (pmmioinfoOut->pchNext == pmmioinfoOut->pchEndWrite) + { + pmmioinfoOut->dwFlags |= MMIO_DIRTY; + if ((nError = mmioAdvance(hmmioOut, pmmioinfoOut, MMIO_WRITE)) != 0) + { + goto ERROR_CANNOT_WRITE; + } + } + *((BYTE*)pmmioinfoOut->pchNext)++ = *((BYTE*)pbSrc+cT); + (*cbActualWrite)++; + } + + +ERROR_CANNOT_WRITE: + // What to do here? Well, for now, nothing, just return that error. (maybe delete the + // file later? + + return(nError); + +} + + + +/* This routine will close a wave file used for writing. Returns 0 if successful, else + the error code. + phmmioOut - Pointer to mmio handle for saving. + pckOut - Pointer to the MMCKINFO for saving. + pckOutRiff - Pointer to the riff MMCKINFO for saving. + pmmioinfoOut- Pointer to mmioinfo for saving. + cSamples - # of samples saved, for the fact chunk. For PCM, this isn't used but + will be written anyway, so this can be zero as long as programs ignore + this field when they load PCM formats. + + + +*/ +int WaveCloseWriteFile( + HMMIO *phmmioOut, // (IN) + MMCKINFO *pckOut, // (IN) + MMCKINFO *pckOutRIFF, // (IN) + MMIOINFO *pmmioinfoOut, // (IN) + DWORD cSamples // (IN) + ) +{ + + int nError; + + nError = 0; + + if (*phmmioOut == NULL) + return(0); + + pmmioinfoOut->dwFlags |= MMIO_DIRTY; + if ((nError = mmioSetInfo(*phmmioOut, pmmioinfoOut, 0)) != 0) + { + // cannot flush, probably... + goto ERROR_CANNOT_WRITE; + } + + /* Ascend the output file out of the 'data' chunk -- this will cause + * the chunk size of the 'data' chunk to be written. + */ + if ((nError = mmioAscend(*phmmioOut, pckOut, 0)) != 0) + goto ERROR_CANNOT_WRITE; // cannot write file, probably + + + // Do this here instead... + if ((nError = mmioAscend(*phmmioOut, pckOutRIFF, 0)) != 0) + goto ERROR_CANNOT_WRITE; // cannot write file, probably + + + nError = mmioSeek(*phmmioOut, 0, SEEK_SET); + if ((nError = (int)mmioDescend(*phmmioOut, pckOutRIFF, NULL, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; + } + + nError = 0; + pckOut->ckid = mmioFOURCC('f', 'a', 'c', 't'); + if ((nError = mmioDescend(*phmmioOut, pckOut, pckOutRIFF, MMIO_FINDCHUNK)) == 0) + { + // If it didn't fail, write the fact chunk out, if it failed, not critical, just + // assert (below). + nError = mmioWrite(*phmmioOut, (HPSTR)&cSamples, sizeof(DWORD)); + nError = mmioAscend(*phmmioOut, pckOut, 0); + nError = 0; + } + else + { + nError = 0; + ASSERT(FALSE); + } + +// CANTWRITEFACT: + /* Ascend the output file out of the 'RIFF' chunk -- this will cause + * the chunk size of the 'RIFF' chunk to be written. + */ + if ((nError = mmioAscend(*phmmioOut, pckOutRIFF, 0)) != 0) + goto ERROR_CANNOT_WRITE; // cannot write file, probably + + + +ERROR_CANNOT_WRITE: + if (*phmmioOut != NULL) + { + mmioClose(*phmmioOut, 0); + *phmmioOut = NULL; + } + + return(nError); + +} + +/* This routine will copy from a source wave file to a destination wave file all those useless chunks + (well, the ones useless to conversions, etc --> apparently people use them!). The source will be + seeked to the begining, but the destination has to be at a current pointer to put the new chunks. + This will also seek back to the start of the wave riff header at the end of the routine. + + phmmioIn - Pointer to input mmio file handle. + pckIn - Pointer to a nice ckIn to use. + pckInRiff - Pointer to the main riff. + phmmioOut - Pointer to output mmio file handle. + pckOut - Pointer to nice ckOut to use. + pckOutRiff - Pointer to the main riff. + + + Returns 0 if successful, else the error code. If this routine fails, it still attemps to seek back to + the start of the wave riff header, though this too could be unsuccessful. +*/ + +int WaveCopyUselessChunks( + HMMIO *phmmioIn, + MMCKINFO *pckIn, + MMCKINFO *pckInRiff, + HMMIO *phmmioOut, + MMCKINFO *pckOut, + MMCKINFO *pckOutRiff) +{ + + int nError; + + nError = 0; + // First seek to the stinking start of the file, not including the riff header... + if ((nError = mmioSeek(*phmmioIn, pckInRiff->dwDataOffset + sizeof(FOURCC), SEEK_SET)) == -1) + { + nError = ER_CANNOTREAD; + goto ERROR_IN_PROC; + } + + nError = 0; + + while (mmioDescend(*phmmioIn, pckIn, pckInRiff, 0) == 0) + { + + // quickly check for corrupt RIFF file--don't ascend past end! + if ((pckIn->dwDataOffset + pckIn->cksize) > (pckInRiff->dwDataOffset + pckInRiff->cksize)) + goto ERROR_IN_PROC; + + switch (pckIn->ckid) + { + // explicitly skip these... + case mmioFOURCC('f', 'm', 't', ' '): + break; + + case mmioFOURCC('d', 'a', 't', 'a'): + break; + + case mmioFOURCC('f', 'a', 'c', 't'): + break; + + case mmioFOURCC('J', 'U', 'N', 'K'): + break; + + case mmioFOURCC('P', 'A', 'D', ' '): + break; + + case mmioFOURCC('c', 'u', 'e', ' '): + break; + + // copy chunks that are OK to copy + case mmioFOURCC('p', 'l', 's', 't'): + // although without the 'cue' chunk, it doesn't make much sense + riffCopyChunk(*phmmioIn, *phmmioOut, pckIn); + break; + + case mmioFOURCC('D', 'I', 'S', 'P'): + riffCopyChunk(*phmmioIn, *phmmioOut, pckIn); + break; + + + // don't copy unknown chunks + default: + break; + } + + + // step up to prepare for next chunk.. + mmioAscend(*phmmioIn, pckIn, 0); + } + +ERROR_IN_PROC: + { + int nErrorT; + // Seek back to riff header + nErrorT = mmioSeek(*phmmioIn, pckInRiff->dwDataOffset + sizeof(FOURCC), SEEK_SET); + } + + return(nError); +} + +/** BOOL RIFFAPI riffCopyChunk(HMMIO hmmioSrc, HMMIO hmmioDst, const LPMMCKINFO lpck) + * + * DESCRIPTION: + * + * + * ARGUMENTS: + * (LPWAVECONVCB lpwc, LPMMCKINFO lpck) + * + * RETURN (BOOL NEAR PASCAL): + * + * + * NOTES: + * + ** */ + +BOOL riffCopyChunk(HMMIO hmmioSrc, HMMIO hmmioDst, const LPMMCKINFO lpck) +{ + MMCKINFO ck; + HPSTR hpBuf; + + // + // + // + hpBuf = (HPSTR)GlobalAllocPtr(GHND, lpck->cksize); + if (!hpBuf) + return (FALSE); + + ck.ckid = lpck->ckid; + ck.cksize = lpck->cksize; + if (mmioCreateChunk(hmmioDst, &ck, 0)) + goto rscc_Error; + + if (mmioRead(hmmioSrc, hpBuf, lpck->cksize) != (LONG)lpck->cksize) + goto rscc_Error; + + if (mmioWrite(hmmioDst, hpBuf, lpck->cksize) != (LONG)lpck->cksize) + goto rscc_Error; + + if (mmioAscend(hmmioDst, &ck, 0)) + goto rscc_Error; + + if (hpBuf) + GlobalFreePtr(hpBuf); + + return (TRUE); + +rscc_Error: + + if (hpBuf) + GlobalFreePtr(hpBuf); + + return (FALSE); +} /* RIFFSupCopyChunk() */ + + + +/* This routine loads a full wave file into memory. Be careful, wave files can get + pretty big these days :). + szFileName - sz Filename + cbSize - Size of loaded wave (returned) + cSamples - # of samples loaded. + ppwfxInfo - Pointer to pointer to waveformatex structure. The wfx structure + IS ALLOCATED by this routine! Make sure to free it! + ppbData - Pointer to a byte pointer (globalalloc) which is allocated by this + routine. Make sure to free it! + + Returns 0 if successful, else the error code. +*/ + +int WaveLoadFile( + char *pszFileName, // (IN) + UINT *cbSize, // (OUT) + WAVEFORMATEX **ppwfxInfo, // (OUT) + BYTE **ppbData // (OUT) + ) +{ + + HMMIO hmmioIn; + MMCKINFO ckInRiff; + MMCKINFO ckIn; + int nError; + UINT cbActualRead; + + *ppbData = NULL; + *ppwfxInfo = NULL; + *cbSize = 0; + + if ((nError = WaveOpenFile(pszFileName, &hmmioIn, ppwfxInfo, &ckInRiff)) != 0) + { + goto ERROR_LOADING; + } + + if ((nError = WaveStartDataRead(&hmmioIn, &ckIn, &ckInRiff)) != 0) + { + goto ERROR_LOADING; + } + + // Ok, size of wave data is in ckIn, allocate that buffer. + if ((*ppbData = (BYTE *)GlobalAlloc(GMEM_FIXED, ckIn.cksize)) == NULL) + { + nError = ER_MEM; + goto ERROR_LOADING; + } + + if ((nError = WaveReadFile(hmmioIn, ckIn.cksize, *ppbData, &ckIn, &cbActualRead)) != 0) + { + goto ERROR_LOADING; + } + + *cbSize = cbActualRead; + goto DONE_LOADING; + +ERROR_LOADING: + if (*ppbData != NULL) + { + GlobalFree(*ppbData); + *ppbData = NULL; + } + if (*ppwfxInfo != NULL) + { + GlobalFree(*ppwfxInfo); + *ppwfxInfo = NULL; + } + +DONE_LOADING: + // Close the wave file. + if (hmmioIn != NULL) + { + mmioClose(hmmioIn, 0); + hmmioIn = NULL; + } + + return(nError); + +} + +/* This routine saves a wave file in currently in memory. + pszFileName - FileName to save to. Automatically overwritten, be careful! + cbSize - Size in bytes to write. + cSamples - # of samples to write, used to make the fact chunk. (if !PCM) + pwfxDest - Pointer to waveformatex structure. + pbData - Pointer to the data. +*/ + +int WaveSaveFile( + char *pszFileName, // (IN) + UINT cbSize, // (IN) + DWORD cSamples, // (IN) + WAVEFORMATEX *pwfxDest, // (IN) + BYTE *pbData // (IN) + ) +{ + + HMMIO hmmioOut; + MMCKINFO ckOut; + MMCKINFO ckOutRIFF; + MMIOINFO mmioinfoOut; + UINT cbActualWrite; + int nError; + + if ((nError = WaveCreateFile(pszFileName, &hmmioOut, pwfxDest, &ckOut, &ckOutRIFF)) != 0) + { + goto ERROR_SAVING; + } + + if ((nError = WaveStartDataWrite(&hmmioOut, &ckOut, &mmioinfoOut)) != 0) + { + goto ERROR_SAVING; + } + + if ((nError = WaveWriteFile(hmmioOut, cbSize, pbData, &ckOut, &cbActualWrite, &mmioinfoOut)) != 0) + { + goto ERROR_SAVING; + } + + if ((nError = WaveCloseWriteFile(&hmmioOut, &ckOut, &ckOutRIFF, &mmioinfoOut, cSamples)) != 0) + { + goto ERROR_SAVING; + } + +ERROR_SAVING: + + return(nError); + +} diff --git a/sdk/samples/dsshow3d/wave.h b/sdk/samples/dsshow3d/wave.h new file mode 100644 index 0000000..92b007b --- /dev/null +++ b/sdk/samples/dsshow3d/wave.h @@ -0,0 +1,67 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: wave.h + * Content: wave header + * + ***************************************************************************/ +#ifndef __WAVE_INCLUDED__ +#define __WAVE_INCLUDED__ +#include <windows.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define WAVEVERSION 1 + +#ifndef ER_MEM +#define ER_MEM 0xe000 +#endif + +#ifndef ER_CANNOTOPEN +#define ER_CANNOTOPEN 0xe100 +#endif + +#ifndef ER_NOTWAVEFILE +#define ER_NOTWAVEFILE 0xe101 +#endif + +#ifndef ER_CANNOTREAD +#define ER_CANNOTREAD 0xe102 +#endif + +#ifndef ER_CORRUPTWAVEFILE +#define ER_CORRUPTWAVEFILE 0xe103 +#endif + +#ifndef ER_CANNOTWRITE +#define ER_CANNOTWRITE 0xe104 +#endif + + + +int WaveOpenFile(char *, HMMIO *, WAVEFORMATEX **, MMCKINFO *); +int WaveStartDataRead(HMMIO *, MMCKINFO *, MMCKINFO *); +int WaveReadFile(HMMIO, UINT, BYTE *, MMCKINFO *, UINT *); +int WaveCloseReadFile(HMMIO *, WAVEFORMATEX **); + +int WaveCreateFile(char *, HMMIO *, WAVEFORMATEX *, MMCKINFO *, MMCKINFO *); +int WaveStartDataWrite(HMMIO *, MMCKINFO *, MMIOINFO *); +int WaveWriteFile(HMMIO, UINT, BYTE *, MMCKINFO *, UINT *, MMIOINFO *); +int WaveCloseWriteFile(HMMIO *, MMCKINFO *, MMCKINFO *, MMIOINFO *, DWORD); + +int WaveLoadFile(char *, UINT *, WAVEFORMATEX **, BYTE **); +int WaveSaveFile(char *, UINT, DWORD, WAVEFORMATEX *, BYTE *); + +int WaveCopyUselessChunks(HMMIO *, MMCKINFO *, MMCKINFO *, HMMIO *, MMCKINFO *, MMCKINFO *); +BOOL riffCopyChunk(HMMIO, HMMIO, const LPMMCKINFO); + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/sdk/samples/dsstream/debug.c b/sdk/samples/dsstream/debug.c new file mode 100644 index 0000000..ebd7c8f --- /dev/null +++ b/sdk/samples/dsstream/debug.c @@ -0,0 +1,356 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: debug.c + * Content: debug code + * + ***************************************************************************/ + +#ifdef DEBUG + +#include <windows.h> +#include <windowsx.h> +#include <stdarg.h> +#include "debug.h" + + +// +// since we don't UNICODE our debugging messages, use the ASCII entry +// points regardless of how we are compiled. +// +#ifdef _WIN32 + #include <wchar.h> +#else + #define lstrcatA lstrcat + #define lstrlenA lstrlen + #define GetProfileIntA GetProfileInt + #define OutputDebugStringA OutputDebugString + #define wsprintfA wsprintf + #define MessageBoxA MessageBox +#endif + +// +// +// +BOOL __gfDbgEnabled = TRUE; // master enable +UINT __guDbgLevel = 0; // current debug level + + +//--------------------------------------------------------------------------; +// +// void DbgVPrintF +// +// Description: +// +// +// Arguments: +// LPSTR szFormat: +// +// va_list va: +// +// Return (void): +// No value is returned. +// +//--------------------------------------------------------------------------; + +void FAR CDECL DbgVPrintF +( + LPSTR szFormat, + va_list va +) +{ + char ach[DEBUG_MAX_LINE_LEN]; + BOOL fDebugBreak = FALSE; + BOOL fPrefix = TRUE; + BOOL fCRLF = TRUE; + + ach[0] = '\0'; + + for (;;) + { + switch (*szFormat) + { + case '!': + fDebugBreak = TRUE; + szFormat++; + continue; + + case '`': + fPrefix = FALSE; + szFormat++; + continue; + + case '~': + fCRLF = FALSE; + szFormat++; + continue; + } + + break; + } + + if (fDebugBreak) + { + ach[0] = '\007'; + ach[1] = '\0'; + } + + if (fPrefix) + { + lstrcatA(ach, DEBUG_MODULE_NAME ": "); + } + +#ifdef _WIN32 + wvsprintfA(ach + lstrlenA(ach), szFormat, va); +#else + wvsprintf(ach + lstrlenA(ach), szFormat, (LPSTR)va); +#endif + + if (fCRLF) + { + lstrcatA(ach, "\r\n"); + } + + OutputDebugStringA(ach); + + if (fDebugBreak) + { + DebugBreak(); + } +} // DbgVPrintF() + + +//--------------------------------------------------------------------------; +// +// void dprintf +// +// Description: +// dprintf() is called by the DPF() macro if DEBUG is defined at compile +// time. It is recommended that you only use the DPF() macro to call +// this function--so you don't have to put #ifdef DEBUG around all +// of your code. +// +// Arguments: +// UINT uDbgLevel: +// +// LPSTR szFormat: +// +// Return (void): +// No value is returned. +// +//--------------------------------------------------------------------------; + +void FAR CDECL dprintf +( + UINT uDbgLevel, + LPSTR szFormat, + ... +) +{ + va_list va; + + if (!__gfDbgEnabled || (__guDbgLevel < uDbgLevel)) + return; + + va_start(va, szFormat); + DbgVPrintF(szFormat, va); + va_end(va); +} // dprintf() + + +//--------------------------------------------------------------------------; +// +// BOOL DbgEnable +// +// Description: +// +// +// Arguments: +// BOOL fEnable: +// +// Return (BOOL): +// Returns the previous debugging state. +// +//--------------------------------------------------------------------------; + +BOOL WINAPI DbgEnable +( + BOOL fEnable +) +{ + BOOL fOldState; + + fOldState = __gfDbgEnabled; + __gfDbgEnabled = fEnable; + + return (fOldState); +} // DbgEnable() + + +//--------------------------------------------------------------------------; +// +// UINT DbgSetLevel +// +// Description: +// +// +// Arguments: +// UINT uLevel: +// +// Return (UINT): +// Returns the previous debugging level. +// +//--------------------------------------------------------------------------; + +UINT WINAPI DbgSetLevel +( + UINT uLevel +) +{ + UINT uOldLevel; + + uOldLevel = __guDbgLevel; + __guDbgLevel = uLevel; + + return (uOldLevel); +} // DbgSetLevel() + + +//--------------------------------------------------------------------------; +// +// UINT DbgGetLevel +// +// Description: +// +// +// Arguments: +// None. +// +// Return (UINT): +// Returns the current debugging level. +// +//--------------------------------------------------------------------------; + +UINT WINAPI DbgGetLevel +( + void +) +{ + return (__guDbgLevel); +} // DbgGetLevel() + + +//--------------------------------------------------------------------------; +// +// UINT DbgInitialize +// +// Description: +// +// +// Arguments: +// BOOL fEnable: +// +// Return (UINT): +// Returns the debugging level that was set. +// +//--------------------------------------------------------------------------; + +UINT WINAPI DbgInitialize +( + BOOL fEnable +) +{ + UINT uLevel; + + uLevel = GetProfileIntA(DEBUG_SECTION, DEBUG_MODULE_NAME, (UINT)-1); + if ((UINT)-1 == uLevel) + { + // + // if the debug key is not present, then force debug output to + // be disabled. this way running a debug version of a component + // on a non-debugging machine will not generate output unless + // the debug key exists. + // + uLevel = 0; + fEnable = FALSE; + } + + DbgSetLevel(uLevel); + DbgEnable(fEnable); + + return (__guDbgLevel); +} // DbgInitialize() + + +//--------------------------------------------------------------------------; +// +// void _Assert +// +// Description: +// This routine is called if the ASSERT macro (defined in debug.h) +// tests and expression that evaluates to FALSE. This routine +// displays an "assertion failed" message box allowing the user to +// abort the program, enter the debugger (the "retry" button), or +// ignore the assertion and continue executing. The message box +// displays the file name and line number of the _Assert() call. +// +// Arguments: +// char * szFile: Filename where assertion occurred. +// int iLine: Line number of assertion. +// +//--------------------------------------------------------------------------; + +#ifndef _WIN32 +#pragma warning(disable:4704) +#endif + +void WINAPI _Assert +( + char * szFile, + int iLine +) +{ + static char ach[300]; // debug output (avoid stack overflow) + int id; +#ifndef _WIN32 + int iExitCode; +#endif + + wsprintfA(ach, "Assertion failed in file %s, line %d. [Press RETRY to debug.]", (LPSTR)szFile, iLine); + + id = MessageBoxA(NULL, ach, "Assertion Failed", + MB_SYSTEMMODAL | MB_ICONHAND | MB_ABORTRETRYIGNORE ); + + switch (id) + { + + case IDABORT: // Kill the application. +#ifndef _WIN32 + iExitCode = 0; + _asm + { + mov ah, 4Ch + mov al, BYTE PTR iExitCode + int 21h + } +#else + FatalAppExit(0, TEXT("Good Bye")); +#endif // WIN16 + break; + + case IDRETRY: // Break into the debugger. + DebugBreak(); + break; + + case IDIGNORE: // Ignore assertion, continue executing. + break; + } +} // _Assert + +#ifndef _WIN32 +#pragma warning(default:4704) +#endif + +#endif // #ifdef DEBUG + diff --git a/sdk/samples/dsstream/debug.h b/sdk/samples/dsstream/debug.h new file mode 100644 index 0000000..f2de178 --- /dev/null +++ b/sdk/samples/dsstream/debug.h @@ -0,0 +1,80 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: debug.h + * Content: debug header + * + ***************************************************************************/ +#ifndef __DEBUG_INCLUDED__ +#define __DEBUG_INCLUDED__ +#ifdef __cplusplus +extern "C" +{ +#endif + +// +// +// +// +#ifdef DEBUG + #define DEBUG_SECTION "Debug" // section name for + #define DEBUG_MODULE_NAME "DSSTREAM" // key name and prefix for output + #define DEBUG_MAX_LINE_LEN 255 // max line length (bytes!) +#endif + + +// +// based code makes since only in win 16 (to try and keep stuff out of +// [fixed] data segments, etc)... +// +#ifndef BCODE +#ifdef _WIN32 + #define BCODE +#else + #define BCODE _based(_segname("_CODE")) +#endif +#endif + + + + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +#ifdef DEBUG + BOOL WINAPI DbgEnable(BOOL fEnable); + UINT WINAPI DbgGetLevel(void); + UINT WINAPI DbgSetLevel(UINT uLevel); + UINT WINAPI DbgInitialize(BOOL fEnable); + void WINAPI _Assert( char * szFile, int iLine ); + + void FAR CDECL dprintf(UINT uDbgLevel, LPSTR szFmt, ...); + + #define D(x) {x;} + #define DPF dprintf + #define DPI(sz) {static char BCODE ach[] = sz; OutputDebugStr(ach);} + #define ASSERT(x) if( !(x) ) _Assert( __FILE__, __LINE__) +#else + #define DbgEnable(x) FALSE + #define DbgGetLevel() 0 + #define DbgSetLevel(x) 0 + #define DbgInitialize(x) 0 + + #ifdef _MSC_VER + #pragma warning(disable:4002) + #endif + + #define D(x) + #define DPF() + #define DPI(sz) + #define ASSERT(x) +#endif + +#ifdef __cplusplus +} +#endif +#endif // __DEBUG_INCLUDED__ diff --git a/sdk/samples/dsstream/dsstream.c b/sdk/samples/dsstream/dsstream.c new file mode 100644 index 0000000..1f4ba9d --- /dev/null +++ b/sdk/samples/dsstream/dsstream.c @@ -0,0 +1,1617 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: dsstream.c + * Content: Illustrates streaming data from a disk WAVE file to a + * DirectSound secondary buffer for playback. + * + ***************************************************************************/ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <dsound.h> +#include <commctrl.h> +#include <commdlg.h> +#include <memory.h> +#include <cderr.h> + +#include "dsstream.h" +#include "wassert.h" + +char szAppClass[] = "DSStreamWndClass"; +char szAppName[] = "DSStream"; + +char szAppTitle[64]; +char szAppCaption[64]; +char szPan[32]; +char szVolume[32]; +char szFrequency[32]; +char szProgress[32]; +char szOpenFilter[128]; +char szOpenDLGTitle[64]; + + +char szTemp[256]; +char szDebug[128]; +char szFileBuffer[MAX_PATH]; +char szFileTitle[MAX_PATH]; +char szCDStartPath[MAX_PATH]; // The path to start the Open dialog in + +// Registry Key and Value names that allow us to retrive a path something like +// "C:\DXSDK\SDK\MEDIA", but matching the current install. +static const TCHAR gszRegKeyDirect3D[] = TEXT("Software\\Microsoft\\Direct3D"); +static const TCHAR gszRegValueD3DPath[] = TEXT("D3D Path"); + +// Size of longest token below +#define MAX_TOKEN_LEN 7 + + +static TCHAR gszPlayToken[] = TEXT("PLAY"); +static TCHAR gszLoopToken[] = TEXT("LOOP"); +static TCHAR gszCloseToken[] = TEXT("CLOSE"); +static TCHAR gszStickyToken[] = TEXT("STICKY"); +static TCHAR gszGlobalToken[] = TEXT("GLOBAL"); + +LPDIRECTSOUND lpDS = NULL; +LPDIRECTSOUNDBUFFER lpDSBStreamBuffer = NULL; + +WAVEINFOCA wiWave; + +HWND hWndMain, hWndPan, hWndPanText, hWndVol, hWndVolText, hWndFreqText; +HWND hWndBar, hWndPlay, hWndStop, hWndLoopCheck, hWndFreq, hWndProg; +HWND hWndProgText; + +#ifdef DEBUG +HWND hWndList; +#endif + +HINSTANCE hInst; + +static BOOL bFileOpen = FALSE, bPlaying = FALSE, bTimerInstalled = FALSE; +static BOOL bEnumDrivers = FALSE, gfCloseOnDone = FALSE; +static UINT uTimerID = 0, uLastPercent = 100; +static GUID guID; +static DWORD gdwFocus = 0; + +static BOOL InitApp( HINSTANCE ); +static BOOL InitInstance( HINSTANCE, int ); +static void BuildTitleBarText( void ); +// Call this in initialization to set the szCDStartPath[] global variable +static void GetMediaStartPath( void ); +static void FillDataBuffer( void ); +static void LoadFromCommandLine( LPSTR lpszCmd ); + +/****************************************************************************** + * WinMain() + * + * Entry point for all Windows programs - performs initialization, message loop + */ +int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow ) + { + MSG msg; + + hInst = hInstance; + + /* Make sure the common controls are loaded for our use */ + InitCommonControls(); + + + if( !hPrevInstance ) + if( !InitApp( hInstance )) + { + ErrorMessageBox( IDS_ERROR_APPINIT, MB_ICONSTOP ); + return( FALSE ); + } + + if( !InitInstance( hInstance, nCmdShow )) + { + ErrorMessageBox( IDS_ERROR_INSTANCEINIT, MB_ICONSTOP ); + return( FALSE ); + } + + // We know how to take exactly one file name from the command-line and open + // it as a file to play. We can also accept a couple command like /play, + // /close, and /loop + if( lpCmdLine[0] ) + LoadFromCommandLine( lpCmdLine ); + + while( GetMessage((LPMSG)&msg, NULL, 0, 0 )) + { + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } + + UnregisterClass( szAppClass, hInstance ); + return( msg.wParam ); + } /* End of WinMain() */ + + +/*****************************************************************************/ +/* InitApp() */ +/* */ +/* Inits things that only need to be created once for the this application */ +/* (like creating the window class). */ +/*****************************************************************************/ +static BOOL InitApp( HINSTANCE hInstance ) + { + WNDCLASS wc; + + /* Set up and register a window class */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpszClassName = szAppClass; + wc.lpfnWndProc = (WNDPROC)MainWindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = sizeof( DWORD ); + wc.hInstance = hInstance; + wc.hIcon = LoadIcon( hInstance, MAKEINTRESOURCE( IDI_ICON1 )); + wc.hCursor = LoadCursor( NULL, IDC_ARROW ); + wc.hbrBackground = (HBRUSH)(COLOR_WINDOW); + wc.lpszMenuName = MAKEINTRESOURCE( IDR_MAINMENU ); + + if( !RegisterClass( &wc )) + { + ErrorMessageBox( IDS_ERROR_REGISTERCLASS, MB_ICONSTOP ); + return( FALSE ); + } + return( TRUE ); + } /* End of InitApp() */ + + +/*****************************************************************************/ +/* InitInstance() */ +/* */ +/* Performs initialization that must be done for each application instance. */ +/* */ +/*****************************************************************************/ +static BOOL InitInstance( HINSTANCE hInstance, int nCmdShow ) + { + HWND hWnd; + HRESULT dsRetVal; + RECT crect; + int cx, cy; + UINT uCharsRead; + BOOL fUseGuid = FALSE; + HMENU hSysMenu; + + DbgInitialize( TRUE ); + + // Initialize the Media start path for common open boxes + GetMediaStartPath(); + + LoadString( hInstance, IDS_APP_TITLE, szAppTitle, sizeof(szAppTitle)); + LoadString( hInstance, IDS_APP_CAPTION, szAppCaption, sizeof(szAppCaption)); + LoadString( hInstance, IDS_TBTITLE_PAN, szPan, sizeof(szPan)); + LoadString( hInstance, IDS_TBTITLE_VOLUME, szVolume, sizeof(szVolume)); + LoadString( hInstance, IDS_TBTITLE_FREQUENCY, + szFrequency, sizeof(szFrequency)); + LoadString( hInstance, IDS_TBTITLE_PROGRESS, + szProgress, sizeof(szProgress)); + LoadString( hInstance, IDS_OPEN_DLGTITLE, + szOpenDLGTitle, sizeof(szOpenDLGTitle)); +/* This is a little trick designed to allow us to load a common dialog box + * filter string, which is really a concatentation of several NULL-terminated + * strings. Note that while is is possible to enter something else into the + * resource as placeholders for the NULL characters, this has the undesireable + * effect of forcing us to search-and-replace byte-by-byte and doesn't make it + * as easy to internationalize our strings... + */ + memset( szOpenFilter, 0, sizeof(szOpenFilter)); + uCharsRead = LoadString( hInstance, IDS_OPEN_FILTER1, + szOpenFilter, sizeof(szOpenFilter)) + 1; + uCharsRead += LoadString( hInstance, IDS_OPEN_FILTER2, + &szOpenFilter[uCharsRead], + sizeof(szOpenFilter) - uCharsRead ) + 1; + uCharsRead += LoadString( hInstance, IDS_OPEN_FILTER3, + &szOpenFilter[uCharsRead], + sizeof(szOpenFilter) - uCharsRead ) + 1; + LoadString( hInstance, IDS_OPEN_FILTER4, + &szOpenFilter[uCharsRead], + sizeof(szOpenFilter) - uCharsRead ); + + /* Calculate the size of the client window */ + cx = CONTROL_SPACE_CX + 2*BORDER_SPACE_CX + BUTTON_CX + PAN_TB_CX + + 2*GetSystemMetrics( SM_CXBORDER ) + PAN_TEXT_CX + TEXT_SPACE_CX; + + cy = 2*(BORDER_SPACE_CY + GetSystemMetrics( SM_CYBORDER )) + + PAN_TB_CY + VOL_TB_CY + FREQ_TB_CY + PROG_TB_CY + + GetSystemMetrics( SM_CYMENU ) + 3*CONTROL_SPACE_CY + + GetSystemMetrics( SM_CYCAPTION ); + + /* Create an application window */ +#ifdef DEBUG + hWnd = CreateWindow( szAppClass, /* class name */ + szAppCaption, /* caption for window */ + WS_OVERLAPPEDWINDOW /* style */ + & ~WS_THICKFRAME | WS_BORDER, + CW_USEDEFAULT, /* x position */ + CW_USEDEFAULT, /* y position */ + cx, /* width */ + cy + 200, /* height */ + NULL, /* parent window */ + NULL, /* menu */ + hInstance, /* instance */ + NULL ); /* parms */ +#else + hWnd = CreateWindow( szAppClass, /* class name */ + szAppCaption, /* caption for window */ + WS_OVERLAPPEDWINDOW /* style */ + & ~WS_THICKFRAME | WS_BORDER, + CW_USEDEFAULT, /* x position */ + CW_USEDEFAULT, /* y position */ + cx, /* width */ + cy, /* height */ + NULL, /* parent window */ + NULL, /* menu */ + hInstance, /* instance */ + NULL ); /* parms */ +#endif + + if( !hWnd ) + { + ErrorMessageBox( IDS_ERROR_MAINWNDCREATE, MB_ICONSTOP ); + return( FALSE ); + } + + hWndMain = hWnd; + GetClientRect( hWndMain, &crect ); + + // Apparently WM_INITMENU isn't called for the main window's context version + // of the system menu, so we must gray these at startup as well. + hSysMenu = GetSystemMenu( hWndMain, FALSE ); + EnableMenuItem( hSysMenu, SC_SIZE, MF_BYCOMMAND | MF_GRAYED ); + EnableMenuItem( hSysMenu, SC_MAXIMIZE, MF_BYCOMMAND | MF_GRAYED ); + +#ifdef DEBUG + cy = 2*BORDER_SPACE_CY + PAN_TB_CY + VOL_TB_CY + FREQ_TB_CY + PROG_TB_CY + + 3*CONTROL_SPACE_CY; + + hWndList = CreateWindow( "listbox", NULL, WS_CHILD | WS_VISIBLE + | LBS_NOINTEGRALHEIGHT | WS_VSCROLL, + 0, cy, crect.right-crect.left, + crect.bottom - crect.top - cy, + hWnd, NULL, hInstance, NULL ); +#endif + + /* Create some controls for things like volume, panning, etc. */ + if( CreateChildren( crect )) + return( FALSE ); + + ShowWindow( hWnd, nCmdShow ); + UpdateWindow( hWnd ); + + /* Create the main DirectSound object */ + + bEnumDrivers = GetProfileInt( "DSSTREAM", "EnumDrivers", FALSE ); + if( bEnumDrivers && !DoDSoundEnumerate( &guID )) + { + fUseGuid = TRUE; + } + dsRetVal = DirectSoundCreate( fUseGuid ? &guID : NULL, &lpDS, NULL ); + + + if( dsRetVal != DS_OK ) + { + ErrorMessageBox( IDS_ERROR_DSCREATE, MB_ICONSTOP ); + return( FALSE ); + } + + dsRetVal = lpDS->lpVtbl->SetCooperativeLevel( lpDS, + hWndMain, + DSSCL_NORMAL ); + if( dsRetVal != DS_OK ) + { + ErrorMessageBox( IDS_ERROR_DSCOOPERATIVE, MB_ICONSTOP ); + return( FALSE ); + } + + + return( TRUE ); + } /* End of InitInstance() */ + + +/****************************************************************************/ +/* MainWindowProc() */ +/* */ +/* Messages for our main window are handled here */ +/* */ +/****************************************************************************/ +extern LONG lInTimer; +LRESULT CALLBACK MainWindowProc( HWND hWnd, unsigned uMsg, + WPARAM wParam, LPARAM lParam ) + { +#ifndef DEBUG + LPMINMAXINFO lpMinMax; +#endif + DWORD dwCDErr = 0, dwProg; + float fPercent; + UINT uPercent; + BOOL bResult = FALSE; + int nChkErr; + HRESULT dsrval; + + switch( uMsg ) + { + case WM_DSSTREAM_PROGRESS: + dwProg = (DWORD)lParam; + dwProg = dwProg % wiWave.mmckInRIFF.cksize; + fPercent = (float)((dwProg * 100) + / wiWave.mmckInRIFF.cksize); + SendMessage( hWndProg, TBM_SETPOS, + TRUE, (DWORD)(float)(fPercent*(float)PROG_MULTIPLIER)); + uPercent = (UINT)fPercent; + if( uPercent != uLastPercent ) + { + uLastPercent = uPercent; + wsprintf( szTemp, "%s: %u%%", szProgress, uPercent ); + Static_SetText( hWndProgText, szTemp ); +#ifdef DEBUG + ListBox_AddString( hWndList, szTemp ); +#endif + } + break; + + /* + * This message will be posted by the helper DLL when the TimeFunc + * is done streaming the WAVE file. It serves as notification that the + * caller should terminate WAVE playback and end the MM timer event. + */ + case WM_DSSTREAM_DONE: + /* Emulate a WM_COMMAND to ourselves */ + SendMessage( hWnd, WM_COMMAND, MAKEWPARAM( IDM_STOP, 0 ), 0L ); + break; + +#ifdef DEBUG + case WM_DSSTREAM_DEBUG: + if( LOWORD(wParam) == DEBUGF_PLAYPOSITION ) + { + wsprintf( szDebug, "pp = %li", lParam ); + ListBox_AddString( hWndList, szDebug ); + DPF( 4, szDebug ); + } + else if( LOWORD(wParam) == DEBUGF_WRITEPOSITION ) + { + wsprintf( szDebug, "wp = %li", lParam ); + ListBox_AddString( hWndList, szDebug ); + DPF( 4, szDebug ); + } + else if( LOWORD(wParam) == DEBUGF_NEXTWRITE ) + { + wsprintf( szDebug, "nw = %li", lParam ); + ListBox_AddString( hWndList, szDebug ); + DPF( 4, szDebug ); + } + else if( LOWORD(wParam) == DEBUGF_SKIP ) + { + ListBox_AddString( hWndList, "Skipped segment read" ); + DPF( 5, szDebug ); + } + break; +#endif + + case WM_COMMAND: + switch( LOWORD( wParam )) + { + case IDM_FILE_OPEN: + { + OPENFILENAME ofn; + /* + * Clear out and fill in an OPENFILENAME structure in preparation + * for creating a common dialog box to open a file. + */ + memset( &ofn, 0, sizeof(OPENFILENAME)); + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hWnd; + ofn.hInstance = hInst; + ofn.lpstrFilter = szOpenFilter; + ofn.nFilterIndex = 1; + szFileBuffer[0] = '\0'; + ofn.lpstrFile = szFileBuffer; + ofn.nMaxFile = sizeof(szFileBuffer); + ofn.lpstrFileTitle = szFileTitle; + ofn.nMaxFileTitle = sizeof(szFileTitle); + ofn.lpstrInitialDir = szCDStartPath; + ofn.lpstrDefExt = "WAV"; + ofn.lpstrTitle = szOpenDLGTitle; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + + bResult = GetOpenFileName( &ofn ); /* Do the dialog box */ + + /* + * A return of TRUE indicates that the user did not select a filename. + * The possible reasons are: Cancel was clicked, or an error occured. + * If Cancel was clicked, the CommDlgExtendedError() function will not + * return a valid code. For anything else, an error code will come back. + */ + if( bResult == FALSE ) + { + dwCDErr = CommDlgExtendedError(); + if( dwCDErr ) + { + /* Handle a common dialog box error */ + HandleCommDlgError( dwCDErr ); + } + else /* Clicked Cancel, so finish msg processing */ + return( 0 ); + } + else + { + // Copy the directory name we opened from so that we start there + // next time we open the dialog box... + lstrcpy( szCDStartPath, szFileBuffer ); + szCDStartPath[ofn.nFileOffset] = '\0'; + + if( bFileOpen ) + { + // Before we force a close, disable auto close + // because the user has picked a new file and is + // obviously not ready for us to go away yet. + gfCloseOnDone = FALSE; + /* Need to close the previous file before we open a new one. The best + * way to do this is by faking a menu command, so that we only have the + * actual code in one place and it can easily be changed. + */ + SendMessage( hWnd, WM_COMMAND, + MAKEWPARAM( IDM_FILE_CLOSE, 0 ), 0L ); + } + + if(( nChkErr = StreamBufferSetup()) != 0 ) + { + // Error opening the WAVE file so abort + break; + } + else + { + bFileOpen = TRUE; + EnableMenuItem( GetMenu( hWnd ), IDM_PLAY, + MF_BYCOMMAND | MF_ENABLED ); + EnableWindow( hWndPlay, TRUE ); + EnableMenuItem( GetMenu( hWnd ), IDM_FILE_CLOSE, + MF_BYCOMMAND | MF_ENABLED ); + DrawMenuBar( hWnd ); + BuildTitleBarText(); + } + } + } + break; + + case IDM_FILE_CLOSE: + SendMessage( hWnd, WM_COMMAND, + MAKEWPARAM( IDM_STOP, + DSSTREAM_STOPF_NOREOPEN ), 0L ); + BuildTitleBarText(); + break; + + case IDM_OPTIONS_ENUMDRIVERS: + bEnumDrivers = !bEnumDrivers; + if( bEnumDrivers ) + { + LoadString( hInst, IDS_ENUMWARNING, szTemp, sizeof(szTemp)); + MessageBox( hWnd, szTemp, szAppCaption, MB_OK ); + } + break; + + case IDM_HELP_ABOUT: + DialogBox( hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWndMain, + (DLGPROC)DLG_About ); + break; + + case IDC_LOOPCHECK: + wiWave.bLoopFile = !wiWave.bLoopFile; + Button_SetCheck( hWndLoopCheck, wiWave.bLoopFile ); + if( !bPlaying && bFileOpen ) + ResetWavePlayer(); + break; + + case IDM_PLAY: +#ifdef DEBUG + wsprintf( szDebug, " bFileOpen = %s", + bFileOpen == TRUE ? "TRUE" : "FALSE" ); + DPF( 3, "IDM_PLAY Debug" ); + DPF( 3, szDebug ); + wsprintf( szDebug, " bTimerInstalled = %s", + bTimerInstalled == TRUE ? "TRUE" : "FALSE" ); + DPF( 3, szDebug ); + wsprintf( szDebug, " bPlaying = %s", + bPlaying == TRUE ? "TRUE" : "FALSE" ); + DPF( 3, szDebug ); +#endif + if( bPlaying ) + { + gfCloseOnDone = FALSE; + SendMessage( hWnd, WM_COMMAND, + MAKEWPARAM( IDM_STOP, 0 ), 0L ); + } + if( bFileOpen && lpDSBStreamBuffer ) + { + // Ensure that position is at 0, ready to go + dsrval = lpDSBStreamBuffer->lpVtbl->SetCurrentPosition( + lpDSBStreamBuffer, + 0 ); + dsrval = lpDSBStreamBuffer->lpVtbl->Play( lpDSBStreamBuffer, + 0, 0, DSBPLAY_LOOPING ); + } + else + { + bPlaying = bTimerInstalled = FALSE; + break; + } + + if( timeBeginPeriod( PLAYBACK_TIMER_PERIOD + / PLAYBACK_OVERSAMPLE ) != 0 ) + { + /* Can't create timer! */ + dsrval = lpDSBStreamBuffer->lpVtbl->Stop( lpDSBStreamBuffer ); + bPlaying = bTimerInstalled = FALSE; + break; + } + else + { + lInTimer = FALSE; + if(( uTimerID = timeSetEvent( PLAYBACK_TIMER_PERIOD + / PLAYBACK_OVERSAMPLE, + PLAYBACK_TIMER_ACCURACY, + TimeFunc, (DWORD)0, + TIME_PERIODIC )) != 0 ) + bTimerInstalled = TRUE; + } + bPlaying = TRUE; + EnableMenuItem( GetMenu( hWnd ), IDM_STOP, + MF_BYCOMMAND | MF_ENABLED ); + EnableWindow( hWndStop, TRUE ); + DrawMenuBar( hWnd ); + break; + + case IDM_STOP: +#ifdef DEBUG + wsprintf( szDebug, " bFileOpen = %s", + bFileOpen == TRUE ? "TRUE" : "FALSE" ); + DPF( 3, "IDM_STOP Debug" ); + DPF( 3, szDebug ); + wsprintf( szDebug, " bTimerInstalled = %s", + bTimerInstalled == TRUE ? "TRUE" : "FALSE" ); + DPF( 3, szDebug ); + wsprintf( szDebug, " bPlaying = %s", + bPlaying == TRUE ? "TRUE" : "FALSE" ); + DPF( 3, szDebug ); +#endif + wiWave.bDonePlaying = TRUE; + if( bTimerInstalled ) + { + timeKillEvent( uTimerID ); + timeEndPeriod( PLAYBACK_TIMER_PERIOD / PLAYBACK_OVERSAMPLE ); + // Busy wait for timer func to exit + while (InterlockedExchange(&lInTimer, TRUE)) Sleep(100); + bTimerInstalled = FALSE; + } + if( bPlaying ) + { + bPlaying = FALSE; + dsrval = lpDSBStreamBuffer->lpVtbl->Stop( lpDSBStreamBuffer ); + EnableMenuItem( GetMenu( hWnd ), IDM_STOP, + MF_BYCOMMAND | MF_GRAYED ); + EnableWindow( hWndStop, FALSE ); + DrawMenuBar( hWnd ); + } + // Short circuit to allow command-line forced shutdown + if(!( HIWORD(wParam) & DSSTREAM_STOPF_NOREOPEN ) + && !gfCloseOnDone ) + { + ResetWavePlayer(); + break; + } + else + { + if( bFileOpen ) + { + WaveCloseReadFile( &wiWave.hmmio, + &wiWave.pwfx ); + if( lpDSBStreamBuffer ) + dsrval = lpDSBStreamBuffer->lpVtbl->Release( + lpDSBStreamBuffer ); + + lpDSBStreamBuffer = NULL; + + bFileOpen = FALSE; + // The file is closed, so disable the close option + EnableMenuItem( GetMenu( hWnd ), IDM_FILE_CLOSE, + MF_BYCOMMAND | MF_GRAYED ); + EnableMenuItem( GetMenu( hWnd ), IDM_PLAY, + MF_BYCOMMAND | MF_GRAYED ); + EnableWindow( hWndPlay, FALSE ); + PostMessage( hWnd, WM_DSSTREAM_PROGRESS, 0L, 0L ); + if( gfCloseOnDone && + !(HIWORD(wParam) && DSSTREAM_STOPF_NOEXIT)) + SendMessage( hWnd, WM_COMMAND, + MAKEWPARAM( IDM_FILE_EXIT, 0 ), 0L ); + } + } + break; + + case IDM_FILE_EXIT: + DestroyWindow( hWnd ); + break; + } + break; +#ifndef DEBUG + case WM_GETMINMAXINFO: + /* + * We know exactly how big this window should be, and it's sort of a + * little pop-up control panel, so we can disable window sizing by + * forcing all the minimum and maximum sizes to be the calculated size. + */ + lpMinMax = (LPMINMAXINFO)lParam; + + lpMinMax->ptMaxSize.x = CONTROL_SPACE_CX + 2*BORDER_SPACE_CX + + BUTTON_CX + PAN_TB_CX + PAN_TEXT_CX + + TEXT_SPACE_CX + + 2*GetSystemMetrics( SM_CXBORDER ); + lpMinMax->ptMaxSize.y = 2*(BORDER_SPACE_CY + + GetSystemMetrics( SM_CYBORDER )) + + PAN_TB_CY + VOL_TB_CY + FREQ_TB_CY + + PROG_TB_CY + 3*CONTROL_SPACE_CY + + GetSystemMetrics( SM_CYMENU ) + + GetSystemMetrics( SM_CYCAPTION ); + + lpMinMax->ptMinTrackSize.x = lpMinMax->ptMaxTrackSize.x + = lpMinMax->ptMaxSize.x; + + lpMinMax->ptMinTrackSize.y = lpMinMax->ptMaxTrackSize.y + = lpMinMax->ptMaxSize.y; + break; +#endif + case WM_HSCROLL: + if(((HWND)lParam == hWndPan) && lpDSBStreamBuffer ) + { + HandlePanScroll( (int)LOWORD(wParam), (int)HIWORD(wParam)); + } + else if(((HWND)lParam == hWndVol) && lpDSBStreamBuffer ) + { + HandleVolScroll( (int)LOWORD(wParam), (int)HIWORD(wParam)); + } + else if(((HWND)lParam == hWndFreq) && lpDSBStreamBuffer ) + { + HandleFreqScroll( (int)LOWORD(wParam), (int)HIWORD(wParam)); + } + break; + + case WM_INITMENU: + { + HMENU hSysMenu = GetSystemMenu( hWnd, FALSE ); + + EnableMenuItem( hSysMenu, SC_MAXIMIZE, MF_BYCOMMAND | MF_GRAYED ); + EnableMenuItem( hSysMenu, SC_SIZE, MF_BYCOMMAND | MF_GRAYED ); + + if((HMENU)wParam != GetMenu( hWnd )) + break; + CheckMenuItem((HMENU)wParam, IDM_OPTIONS_ENUMDRIVERS, + bEnumDrivers ? MF_CHECKED : MF_UNCHECKED ); + } + break; + + case WM_DESTROY: + /* + * Free all the DirectSound objects we created + */ + SendMessage( hWnd, WM_COMMAND, + MAKEWPARAM( IDM_STOP, DSSTREAM_STOPF_NOREOPEN + | DSSTREAM_STOPF_NOEXIT ), 0 ); + + if( bTimerInstalled ) + { + timeKillEvent( uTimerID ); + timeEndPeriod( PLAYBACK_TIMER_PERIOD / PLAYBACK_OVERSAMPLE ); + // Busy wait for timer func to exit + while (InterlockedExchange(&lInTimer, TRUE)) Sleep(100); + bTimerInstalled = FALSE; + } + + if( lpDS ) dsrval = lpDS->lpVtbl->Release( lpDS ); + + WriteProfileString( "DSSTREAM", "EnumDrivers", + bEnumDrivers ? "1" : "0" ); + + PostQuitMessage( 0 ); + break; + + default: + return DefWindowProc( hWnd, uMsg, wParam, lParam ); + } + return 0L; + } /* WindowProc */ + + +/*****************************************************************************/ +/* DLG_About() */ +/* */ +/* Dialog procedure for the Help...About... box which simply pops up a */ +/* little copyright message and brief program description. */ +/* */ +/*****************************************************************************/ +BOOL CALLBACK DLG_About( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) + { + switch( msg ) + { + case WM_INITDIALOG: + break; + + case WM_COMMAND: + switch( LOWORD(wParam)) + { + case IDOK: + EndDialog( hDlg, FALSE ); + return( TRUE ); + + default: + break; + } + break; + + default: + return( FALSE ); + } + + return( FALSE ); + } + + +/*****************************************************************************/ +/* HandleCommDlgError() */ +/* */ +/* The function translates extended common dialog error codes into a */ +/* string resource ID, loads that string from our module, and displays it in */ +/* a message box. This implementation only covers the general CD error codes.*/ +/* */ +/*****************************************************************************/ +int HandleCommDlgError( DWORD dwError ) + { + char szTitle[128]; + UINT uMsgID; + + if( dwError == CDERR_DIALOGFAILURE ) + uMsgID = IDS_CDERR_DIALOGFAILURE; + else + uMsgID = (UINT)dwError + IDS_CDERR_GENERAL_BASE; + + LoadString( hInst, uMsgID, szTemp, sizeof(szTemp)); + LoadString( hInst, IDS_CDERR_TITLESTRING, szTitle, sizeof(szTitle)); + MessageBox( GetActiveWindow(), szTemp, szTitle, + MB_OK | MB_ICONEXCLAMATION ); + + return( 0 ); + } + + +/*****************************************************************************/ +/* StreamBufferSetup() */ +/* */ +/* This function uses the filename stored in the global character array to*/ +/* open a WAVE file. Then it creates a secondary DirectSoundBuffer object */ +/* which will later be used to stream that file from disk during playback. */ +/* */ +/*****************************************************************************/ +int StreamBufferSetup( void ) + { + DSBUFFERDESC dsbd; + HRESULT dsRetVal; + + int nChkErr; + + /* This portion of the WAVE I/O is patterned after what's in DSTRWAVE, which + * was in turn adopted from WAVE.C which is part of the DSSHOW sample. + */ + + if(( nChkErr = WaveOpenFile( szFileBuffer, &wiWave.hmmio, &wiWave.pwfx, &wiWave.mmckInRIFF )) != 0 ) + { + ErrorMessageBox( IDS_ERROR_WAVEFILEOPEN, MB_ICONEXCLAMATION ); + return( ERR_WAVE_OPEN_FAILED ); + } + + if( wiWave.pwfx->wFormatTag != WAVE_FORMAT_PCM ) + { + ErrorMessageBox( IDS_ERROR_WAVENOTPCM, MB_ICONEXCLAMATION ); + WaveCloseReadFile( &wiWave.hmmio, &wiWave.pwfx ); + return( ERR_WAVE_INVALID_FORMAT ); + } + /* Seek to the data chunk */ + if(( nChkErr = WaveStartDataRead( &wiWave.hmmio, &wiWave.mmck, &wiWave.mmckInRIFF )) != 0 ) + { + ErrorMessageBox( IDS_ERROR_WAVESEEKFAILED, MB_ICONEXCLAMATION ); + WaveCloseReadFile( &wiWave.hmmio, &wiWave.pwfx ); + return( ERR_WAVE_CORRUPTED_FILE ); + } + /* As a side note, mmck.ckSize will be the size of all the data in this file. + * That's something which might be handy when calculating the length... */ + + /* Calculate a buffer length, making sure it is an exact multiple of the + * buffer segment size. + */ + wiWave.dwBufferSize = ((DWORD)wiWave.pwfx->nAvgBytesPerSec + * (((NUM_BUFFER_SEGMENTS * PLAYBACK_TIMER_PERIOD) + / 10)) / 100); + +#ifdef DEBUG + wsprintf( szDebug, "BufferSize = %lu", wiWave.dwBufferSize ); + ListBox_AddString( hWndList, szDebug ); +#endif + /* + * Create the secondary DirectSoundBuffer object to receive our sound data. + */ + memset( &dsbd, 0, sizeof( DSBUFFERDESC )); + dsbd.dwSize = sizeof( DSBUFFERDESC ); + // Use new GetCurrentPosition() accuracy (DirectX 2 feature) + dsbd.dwFlags = DSBCAPS_CTRLDEFAULT | DSBCAPS_GETCURRENTPOSITION2 | gdwFocus; + dsbd.dwBufferBytes = wiWave.dwBufferSize; + + /* Set Format properties according to the WAVE file we just opened */ + dsbd.lpwfxFormat = wiWave.pwfx; + dsRetVal = lpDS->lpVtbl->CreateSoundBuffer( lpDS, + &dsbd, + &lpDSBStreamBuffer, + NULL ); + if( dsRetVal != DS_OK ) + { + ErrorMessageBox( IDS_ERROR_DSBCREATE, MB_ICONEXCLAMATION ); + return( ERR_CREATEDSB_FAILED ); + } + + wiWave.lpDSBStreamBuffer = lpDSBStreamBuffer; + wiWave.bFoundEnd = FALSE; + wiWave.dwBytesRemaining = 0; + wiWave.bLoopFile = Button_GetCheck( hWndLoopCheck ); + + FillDataBuffer(); + + wiWave.bDonePlaying = FALSE; + +#ifdef DEBUG + wsprintf( szDebug, "wiWave.dwBufferSize = %lu", wiWave.dwBufferSize ); + DPF( 3, "StreamBufferSetup Debug" ); + DPF( 3, szDebug ); +#endif + + SendMessage( hWndVol, TBM_SETPOS, TRUE, VOL_MAX ); + SendMessage( hWndPan, TBM_SETPOS, TRUE, PAN_CENTER ); + SendMessage( hWndFreq, TBM_SETPOS, TRUE, + (LPARAM)wiWave.pwfx->nSamplesPerSec / FREQ_MULTIPLIER ); + PostMessage( hWndMain, WM_DSSTREAM_PROGRESS, 0L, 0L ); + UpdateFromControls(); + return( 0 ); + } + + +/*****************************************************************************/ +/* ResetWavePlayer() */ +/* */ +/* Performs a subset of the above operations (in StreamBufferSetup). Things */ +/* not done include creating a DSB and opening the file (it's already open). */ +/* */ +/*****************************************************************************/ +void ResetWavePlayer( void ) + { + WaveStartDataRead( &wiWave.hmmio, &wiWave.mmck, &wiWave.mmckInRIFF ); + wiWave.bFoundEnd = FALSE; + wiWave.dwBytesRemaining = 0; + + FillDataBuffer(); + + wiWave.bDonePlaying = FALSE; + PostMessage( hWndMain, WM_DSSTREAM_PROGRESS, 0L, 0L ); + } + + +/*****************************************************************************/ +/* FillDataBuffer() */ +/* */ +/* This function fills the sound buffer with a block of data, starting at */ +/* the current read position. The entire buffer is filled. */ +/* */ +/*****************************************************************************/ +void FillDataBuffer( void ) + { + LPBYTE lpWrite1, lpWrite2; + DWORD dwLen1, dwLen2; + UINT uActualBytesWritten; + int nChkErr; + HRESULT dsRetVal; + + dsRetVal = lpDSBStreamBuffer->lpVtbl->Lock( lpDSBStreamBuffer, + 0, wiWave.dwBufferSize, + &((LPVOID)lpWrite1), &dwLen1, + &((LPVOID)lpWrite2), &dwLen2, + 0 ); + if( dsRetVal != DS_OK ) + { + return; + //ErrorMessageBox( IDS_ERROR_DSBLOCK, MB_EXLCAMATION ); + } + + Assert( NULL == lpWrite2 ); + Assert( 0 == dwLen2 ); + + if( dwLen1 ) + { + Assert( NULL != lpWrite1 ); + + nChkErr = WaveReadFile( wiWave.hmmio, (UINT)dwLen1, lpWrite1, + &wiWave.mmck, &uActualBytesWritten ); + if( uActualBytesWritten < dwLen1 ) + { + if( wiWave.bLoopFile ) + { + /* If the file is shorter than the buffer and we're looping, we need to + * read the file in again so that we don't get a block of silence before + * the timer loops playback. + */ + LPBYTE lpTemp = lpWrite1; + DWORD cbReadLoopTotal = dwLen1; + + do + { + /* Continue decrementing our count and moving our temp + * pointer forward until we've read the file enough times + * to fill the buffer. NOTE: It's probably not efficient + * to bother with the overhead of streaming a file that's + * not at least as large as the buffer... */ + lpTemp += uActualBytesWritten; + cbReadLoopTotal -= uActualBytesWritten; + nChkErr = WaveStartDataRead( &wiWave.hmmio, + &wiWave.mmck, + &wiWave.mmckInRIFF ); + nChkErr = WaveReadFile( wiWave.hmmio, (UINT)cbReadLoopTotal, + lpTemp, + &wiWave.mmck, &uActualBytesWritten ); + } while( uActualBytesWritten < cbReadLoopTotal ); + } + else + { + wiWave.bFoundEnd = TRUE; + wiWave.dwBytesRemaining = (DWORD)uActualBytesWritten; + DPF( 3,"Setting bFoundEnd in load" ); + + // Fill in silence + FillMemory( lpWrite1+uActualBytesWritten, + dwLen1-uActualBytesWritten, + (BYTE)(wiWave.pwfx->wBitsPerSample == 8 ? 128 : 0 )); + } + } + } + dsRetVal = lpDSBStreamBuffer->lpVtbl->Unlock( lpDSBStreamBuffer, + (LPVOID)lpWrite1, dwLen1, + (LPVOID)lpWrite2, 0 ); + + wiWave.dwNextWriteOffset = wiWave.dwProgress = 0; + } + + +/*****************************************************************************/ +/* CreateChildren() */ +/* */ +/* This function creates a bunch of child controls for the main window. */ +/* Most of them are used for controling various things about a playing sound */ +/* file, like volume and panning. Returns FALSE if no errors, TRUE otherwise.*/ +/* */ +/*****************************************************************************/ +int CreateChildren( RECT crect ) + { + SIZE Size; + HDC hDC; + int x, y; + UINT uType; + char szTemplate[128], szType[32]; + LPSTR lpszControl; + + LoadString( hInst, IDS_ERROR_CHILDTEMPLATE, szTemplate, sizeof(szTemplate)); + + /* Don't handle failure for this one, because the app will still run fine */ + hWndBar = CreateWindow( "static", NULL, + WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, + 0, 0, crect.right, 2, hWndMain, + (HMENU)0, hInst, NULL ); + + hDC = GetDC( hWndMain ); + if( !GetTextExtentPoint32( hDC, szPan, strlen(szPan), &Size )) + { + ErrorMessageBox( IDS_ERROR_GETTEXTEXTENT, MB_ICONEXCLAMATION ); + ReleaseDC( hWndMain, hDC ); + return( TRUE ); + } + ReleaseDC( hWndMain, hDC ); + + y = BORDER_SPACE_CY; + + /* STATIC control -- text label for the pan trackbar */ + if(( hWndPanText = CreateWindow( "static", szPan, + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + BORDER_SPACE_CX + PAN_TB_CX + TEXT_SPACE_CX, + y + (PAN_TB_CY - Size.cy)/2, + PAN_TEXT_CX, Size.cy, + hWndMain, (HMENU)0, hInst, NULL)) == NULL ) + { + lpszControl = szPan; + uType = IDS_ERROR_STATICTEXT; + goto DISPLAY_CREATE_FAILURE; + } + + /* PAN (left to right balance) trackbar control */ + if(( hWndPan = CreateWindow( TRACKBAR_CLASS, NULL, + WS_CHILD | WS_VISIBLE | TBS_HORZ | TBS_BOTTOM, + BORDER_SPACE_CX, + y, PAN_TB_CX, PAN_TB_CY, + hWndMain, (HMENU)0, hInst, NULL)) == NULL ) + { + lpszControl = szPan; + uType = IDS_ERROR_TRACKBAR; + goto DISPLAY_CREATE_FAILURE; + } + + SendMessage( hWndPan, TBM_SETRANGE, FALSE, MAKELONG( PAN_MIN, PAN_MAX )); + SendMessage( hWndPan, TBM_SETPOS, TRUE, PAN_CENTER ); + SendMessage( hWndPan, TBM_SETPAGESIZE, 0L, PAN_PAGESIZE ); + + y += PAN_TB_CY + CONTROL_SPACE_CY; + + /* STATIC control -- text label for the volume trackbar */ + if(( hWndVolText = CreateWindow( "static", szVolume, + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + BORDER_SPACE_CX + VOL_TB_CX + TEXT_SPACE_CX, + y + (VOL_TB_CY - Size.cy)/2, + VOL_TEXT_CX, Size.cy, + hWndMain, (HMENU)0, hInst, NULL)) == NULL ) + { + lpszControl = szVolume; + uType = IDS_ERROR_STATICTEXT; + goto DISPLAY_CREATE_FAILURE; + } + + /* Create the VOLUME trackbar */ + if(( hWndVol = CreateWindow( TRACKBAR_CLASS, NULL, + WS_CHILD | WS_VISIBLE | TBS_HORZ | TBS_BOTTOM, + BORDER_SPACE_CX, + y, VOL_TB_CX, VOL_TB_CY, + hWndMain, (HMENU)0, hInst, NULL)) == NULL ) + { + lpszControl = szVolume; + uType = IDS_ERROR_TRACKBAR; + goto DISPLAY_CREATE_FAILURE; + } + + SendMessage( hWndVol, TBM_SETRANGE, FALSE, + MAKELONG( VOL_MIN, VOL_MAX )); + SendMessage( hWndVol, TBM_SETPOS, TRUE, VOL_MAX ); + SendMessage( hWndVol, TBM_SETPAGESIZE, 0L, VOL_PAGESIZE ); + + y += VOL_TB_CY + CONTROL_SPACE_CY; + + /* STATIC control -- text label for the frequency trackbar */ + if(( hWndFreqText = CreateWindow( "static", szFrequency, + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + BORDER_SPACE_CX + FREQ_TB_CX + TEXT_SPACE_CX, + y + (FREQ_TB_CY - Size.cy)/2, + FREQ_TEXT_CX, Size.cy, + hWndMain, (HMENU)0, hInst, NULL)) == NULL ) + { + lpszControl = szFrequency; + uType = IDS_ERROR_STATICTEXT; + goto DISPLAY_CREATE_FAILURE; + } + + /* Create the FREQUENCY trackbar */ + if(( hWndFreq = CreateWindow( TRACKBAR_CLASS, NULL, + WS_CHILD | WS_VISIBLE | TBS_HORZ | TBS_BOTTOM, + BORDER_SPACE_CX, + y, FREQ_TB_CX, FREQ_TB_CY, + hWndMain, (HMENU)0, hInst, NULL)) == NULL ) + { + lpszControl = szFrequency; + uType = IDS_ERROR_TRACKBAR; + goto DISPLAY_CREATE_FAILURE; + } + + SendMessage( hWndFreq, TBM_SETRANGE, FALSE, MAKELONG( FREQ_MIN, FREQ_MAX )); + SendMessage( hWndFreq, TBM_SETPOS, TRUE, FREQ_MAX ); + SendMessage( hWndFreq, TBM_SETPAGESIZE, 0L, FREQ_PAGESIZE ); + + y += FREQ_TB_CY + CONTROL_SPACE_CY; + + /* STATIC control -- text label for the progress trackbar */ + if(( hWndProgText = CreateWindow( "static", szProgress, + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + BORDER_SPACE_CX + PROG_TB_CX + TEXT_SPACE_CX, + y + (PROG_TB_CY - Size.cy)/2, + PROG_TEXT_CX, Size.cy, + hWndMain, (HMENU)0, hInst, NULL)) == NULL ) + { + lpszControl = szProgress; + uType = IDS_ERROR_STATICTEXT; + goto DISPLAY_CREATE_FAILURE; + } + + /* Create the PROGRESSS trackbar */ + if(( hWndProg = CreateWindow( TRACKBAR_CLASS, NULL, + WS_CHILD | WS_VISIBLE | TBS_HORZ + | TBS_BOTTOM | WS_DISABLED, + BORDER_SPACE_CX, + y, PROG_TB_CX, PROG_TB_CY, + hWndMain, (HMENU)0, hInst, NULL)) == NULL ) + { + lpszControl = szProgress; + uType = IDS_ERROR_TRACKBAR; + goto DISPLAY_CREATE_FAILURE; + } + + SendMessage( hWndProg, TBM_SETRANGE, + FALSE, MAKELPARAM( PROG_MIN, PROG_MAX )); + SendMessage( hWndProg, TBM_SETPOS, TRUE, 0L ); + + x = BORDER_SPACE_CX + PAN_TEXT_CX + TEXT_SPACE_CX + + PAN_TB_CX + CONTROL_SPACE_CX; + y += PROG_TB_CY; + y -= 2*(BUTTON_CY + BUTTON_SPACE_CY) + CHECK_CY; + + /* Create the LOOPED CHECKBOX */ + LoadString( hInst, IDS_CHECK_LOOPED, szTemp, sizeof(szTemp)); + if(( hWndLoopCheck = CreateWindow( "button", szTemp, + WS_CHILD | WS_VISIBLE | BS_CHECKBOX, + x, y, CHECK_CX, CHECK_CY, hWndMain, + (HMENU)IDC_LOOPCHECK, hInst, NULL )) == NULL ) + { + lpszControl = szTemp; + uType = IDS_ERROR_CHECK; + goto DISPLAY_CREATE_FAILURE; + } + y += CHECK_CY + BUTTON_SPACE_CY; + + /* Create the PLAY BUTTON */ + LoadString( hInst, IDS_BUTTON_PLAY, szTemp, sizeof(szTemp)); + if(( hWndPlay = CreateWindow( "button", szTemp, + WS_CHILD | WS_VISIBLE | WS_DISABLED, + x, y, BUTTON_CX, BUTTON_CY, hWndMain, + (HMENU)IDM_PLAY, hInst, NULL )) == NULL ) + { + lpszControl = szTemp; + uType = IDS_ERROR_BUTTON; + goto DISPLAY_CREATE_FAILURE; + } + y += BUTTON_CY + BUTTON_SPACE_CY; + + /* Create the STOP BUTTON */ + LoadString( hInst, IDS_BUTTON_STOP, szTemp, sizeof(szTemp)); + if(( hWndStop = CreateWindow( "button", szTemp, + WS_CHILD | WS_VISIBLE | WS_DISABLED, + x, y, BUTTON_CX, BUTTON_CY, hWndMain, + (HMENU)IDM_STOP, hInst, NULL )) == NULL ) + { + lpszControl = szTemp; + uType = IDS_ERROR_BUTTON; + goto DISPLAY_CREATE_FAILURE; + } + + UpdateFromControls(); + goto RETURN_NORMAL; + +DISPLAY_CREATE_FAILURE: + LoadString( hInst, uType, szType, sizeof(szType)); + wsprintf( szTemp, szTemplate, lpszControl, szType ); + MessageBox( GetActiveWindow(), szTemp, + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + return( TRUE ); + +RETURN_NORMAL: + return( FALSE ); + } + + +/********************************************************************************/ +/* UpdateFromControls() */ +/* */ +/* This function gets all the required values from the DirectSoundBuffer and */ +/* updates the screen interface controls. */ +/* */ +/********************************************************************************/ +void UpdateFromControls( void ) + { + long lPan, lVol, lFreq; + HRESULT hr; + + lPan = (LONG)SendMessage( hWndPan, TBM_GETPOS, (WPARAM)0, (LPARAM)0 ); + lVol = (LONG)SendMessage( hWndVol, TBM_GETPOS, (WPARAM)0, (LPARAM)0 ); + lFreq = (LONG)SendMessage( hWndFreq, TBM_GETPOS, (WPARAM)0, (LPARAM)0 ); + + /* Set the volume and then the pan */ + if( lpDSBStreamBuffer ) + { + /* Set the volume */ + wsprintf( szTemp, "%s: %lidB", szVolume, + ( lVol + VOL_SHIFT ) / VOL_DIV ); + Static_SetText( hWndVolText, szTemp ); + + hr = lpDSBStreamBuffer->lpVtbl->SetVolume( lpDSBStreamBuffer, + (((lVol+VOL_SHIFT) * VOL_MULT)) ); + if( hr != 0 ) + DPF( 0, "Unable to SetVolume in UpdateFromControls()" ); + else + { + wsprintf( szDebug, "Set volume to %lidB", + ( lVol + VOL_SHIFT ) / VOL_DIV ); + DPF( 3, szDebug ); + } + + /* Set the Pan */ + wsprintf( szTemp, "%s: %lidB", szPan, ( lPan + PAN_SHIFT ) / PAN_DIV ); + Static_SetText( hWndPanText, szTemp ); + + hr = lpDSBStreamBuffer->lpVtbl->SetPan( lpDSBStreamBuffer, + (((lPan+PAN_SHIFT) * PAN_MULT)) ); + if( hr != 0 ) + DPF( 0, "Unable to SetPan in UpdateFromControls()" ); + else + { + wsprintf( szDebug, "Set pan to %lidB", + ( lPan + PAN_SHIFT ) / PAN_DIV ); + DPF( 3, szDebug ); + } + + /* Set the frequency */ + wsprintf( szTemp, "%s: %liHz", szFrequency, lFreq * FREQ_MULTIPLIER ); + Static_SetText( hWndFreqText, szTemp ); + + hr = lpDSBStreamBuffer->lpVtbl->SetFrequency( lpDSBStreamBuffer, + lFreq * FREQ_MULTIPLIER); + if( hr != 0 ) + DPF( 0, "Unable to SetFrequency in UpdateFromControls()" ); + else + { + wsprintf( szDebug, "Set frequency to %liHz", lFreq*FREQ_MULTIPLIER ); + DPF( 3, szDebug ); + } + } + return; + } + + +/********************************************************************************/ +/* HandlePanScroll() */ +/* */ +/* Handles the pan trackbar scroll when a WM_HSCROLL is received. */ +/* */ +/********************************************************************************/ +void HandlePanScroll( int nCode, int nPos ) + { + long lPan, lDelta; + + lPan = (LONG)SendMessage( hWndPan, TBM_GETPOS, (WPARAM)0, (LPARAM)0 ); + + switch( nCode ) + { + case TB_LINEUP: + if( lPan >= PAN_MIN - 1 ) + lDelta = -1; + break; + case TB_LINEDOWN: + if( lPan <= PAN_MAX + 1 ) + lDelta = 1; + break; + case TB_PAGEUP: + if( lPan >= PAN_MIN - PAN_PAGESIZE ) + lDelta = -16; + break; + case TB_PAGEDOWN: + if( lPan <= PAN_MAX + PAN_PAGESIZE ) + lDelta = 16; + break; + case TB_ENDTRACK: + return; + default: + lDelta = 0; + } + + if( lDelta ) + SendMessage( hWndPan, TBM_SETPOS, TRUE, lPan + lDelta ); + else + SendMessage( hWndPan, TBM_SETPOS, TRUE, (long)nPos ); + UpdateFromControls(); + } + + +/********************************************************************************/ +/* HandleVolScroll() */ +/* */ +/* Handles the volume trackbar scrolling when a WM_HSCROLL is received. */ +/* */ +/********************************************************************************/ +void HandleVolScroll( int nCode, int nPos ) + { + long lVol, lDelta; + + lVol = (LONG)SendMessage( hWndVol, TBM_GETPOS, (WPARAM)0, (LPARAM)0 ); + + switch( nCode ) + { + case TB_LINEDOWN: + if( lVol <= VOL_MAX - 1 ) + lDelta = 1; + break; + case TB_LINEUP: + if( lVol >= VOL_MIN + 1 ) + lDelta = -1; + break; + case TB_PAGEDOWN: + if( lVol <= VOL_MAX - VOL_PAGESIZE ) + lDelta = 10; + break; + case TB_PAGEUP: + if( lVol >= VOL_MIN + VOL_PAGESIZE ) + lDelta = -10; + break; + case TB_ENDTRACK: + return; + default: + lDelta = 0; + } + + if( lDelta ) + SendMessage( hWndVol, TBM_SETPOS, TRUE, (lVol + lDelta)); + else + SendMessage( hWndVol, TBM_SETPOS, TRUE, (long)nPos ); + UpdateFromControls(); + } + + +/********************************************************************************/ +/* HandleFreqScroll() */ +/* */ +/* Handles the volume trackbar scrolling when a WM_HSCROLL is received. */ +/* */ +/********************************************************************************/ +void HandleFreqScroll( int nCode, int nPos ) + { + long lFreq, lDelta; + + lFreq = (LONG)SendMessage( hWndFreq, TBM_GETPOS, (WPARAM)0, (LPARAM)0 ); + + switch( nCode ) + { + case TB_LINEDOWN: + if( lFreq <= FREQ_MAX-1 ) + lDelta = 1; + break; + case TB_LINEUP: + if( lFreq >= FREQ_MIN+1 ) + lDelta = -1; + break; + case TB_PAGEDOWN: + if( lFreq <= FREQ_MAX - FREQ_PAGESIZE ) + lDelta = 10; + break; + case TB_PAGEUP: + if( lFreq >= FREQ_MIN + FREQ_PAGESIZE ) + lDelta = -10; + break; + case TB_ENDTRACK: + return; + default: + lDelta = 0; + } + + if( lDelta ) + SendMessage( hWndFreq, TBM_SETPOS, TRUE, (lFreq + lDelta)); + else + SendMessage( hWndFreq, TBM_SETPOS, TRUE, (long)nPos ); + UpdateFromControls(); + } + + +/****************************************************************************/ +/* ErrorMessageBox() */ +/* */ +/* A little routine to load error messages from the string resource table */ +/* and pop them up in a MessageBox() for the world to see. The dwMBFlags */ +/* parameter allows the caller to specify the type of icon to use. */ +/* */ +/****************************************************************************/ +void ErrorMessageBox( UINT uID, DWORD dwMBFlags ) + { + LoadString( hInst, uID, szTemp, sizeof(szTemp)); + MessageBox( GetActiveWindow(), szTemp, szAppTitle, MB_OK | dwMBFlags ); + } + + +/****************************************************************************/ +/* BuildTitleBar() */ +/* */ +/* Small routine to build and set the title bar text depending on whether */ +/* or not a file is open. */ +/****************************************************************************/ +void BuildTitleBarText( void ) + { + char szTitle[ sizeof(szAppCaption) + MAX_PATH + sizeof(" - ")]; + + lstrcpy( szTitle, szAppCaption ); + if( bFileOpen ) + { + lstrcat( szTitle, " - " ); + lstrcat( szTitle, szFileTitle ); + } + SetWindowText( hWndMain, szTitle ); + } + + +/****************************************************************************/ +/* GetMediaStartPath() */ +/* */ +/* This helper function attempts to get the media directory for Direct3D, */ +/* which is where all the installed DX wave files go. If it can't find that */ +/* it settles for the media sub-directory of the Windows directory. */ +/****************************************************************************/ +void GetMediaStartPath( void ) + { + HKEY hReg; + DWORD cbStartPathLen; + + if( ERROR_SUCCESS != RegOpenKeyEx( HKEY_LOCAL_MACHINE, + gszRegKeyDirect3D, + 0, KEY_READ, &hReg )) + { + goto REG_OPEN_FAILED; + } + else + { + // Query the Registry for the path to the media directory + cbStartPathLen = sizeof( szCDStartPath ); + if( ERROR_SUCCESS != RegQueryValueEx( hReg, gszRegValueD3DPath, + NULL, NULL, + szCDStartPath, &cbStartPathLen )) + { + goto REG_OPEN_FAILED; + } + RegCloseKey( hReg ); + hReg = NULL; + } + + return; + +REG_OPEN_FAILED: + // Start off by getting the Windows directory -- we're trying to build a + // file path like "C:\WINDOWS\MEDIA", but the WINDOWS directory could be + // named anything, so we must ask. + GetWindowsDirectory( szCDStartPath, sizeof(szCDStartPath)); + // If there's no trailing backslash, append one + if( lstrcmp( &szCDStartPath[lstrlen(szCDStartPath)], TEXT("\\") )) + lstrcat( szCDStartPath, TEXT("\\")); + // Now add on the MEDIA part of the path + lstrcat( szCDStartPath, TEXT("MEDIA")); + } + + +void LoadFromCommandLine( LPSTR lpszCmd ) + { + LPSTR lpsz = lpszCmd; + LPSTR lpToken; + BOOL fStartPlaying = FALSE, fStartLooping = FALSE; + char szToken[MAX_TOKEN_LEN+1]; + int i; + + if( !lpsz ) + return; + + // Clear leading spaces + while( *lpsz == ' ' ) + lpsz++; + + // If we need to accept more command-line parameters later, we can + // extend the code below into a loop that searchs for each one. + while( *lpsz == '/' || *lpsz == '-' ) + { + // Don't advance lpsz until we're sure we really should be reading + // this string (i.e. we recognize that it's the play command + lpToken = ++lpsz; + for( i = 0; i < MAX_TOKEN_LEN; i++ ) + { + if( !*lpToken || *lpToken == ' ' ) + break; + szToken[i] = *lpToken++; + } + szToken[i] = 0; + + if( !lstrcmpi( szToken, gszPlayToken )) + { + // Automagically start playing the file + fStartPlaying = TRUE; + lpsz = lpToken; + } + else if( !lstrcmpi( szToken, gszLoopToken )) + { + // Set the player in looping mode at startup + fStartLooping = TRUE; + lpsz = lpToken; + } + else if( !lstrcmpi( szToken, gszStickyToken )) + { + // Use Sticky Focus for the buffer + gdwFocus = DSBCAPS_STICKYFOCUS; + lpsz = lpToken; + } + else if( !lstrcmpi( szToken, gszGlobalToken )) + { + // Use Global Focus for the buffer + gdwFocus = DSBCAPS_GLOBALFOCUS; + lpsz = lpToken; + } + else if( !lstrcmpi( szToken, gszCloseToken )) + { + // "/close" will cause the program to shutdown after it's done + // playing the file that was presumably loaded at the command-line + gfCloseOnDone = TRUE; + lpsz = lpToken; + } + else + { + // Unrecognized parameter followed the slash, so skip over it + // and find the next break + while( *lpsz && *lpsz != ' ' ) + lpsz++; + } + // Clear any spaces out again + while( *lpsz == ' ' ) + lpsz++; + } + + // If that's all that was on the command-line, simply return + if( !*lpsz ) + return; + + // ASSUMPTION: We assume that a single filename is the only remaining + // parameter. This works out okay because anything else will fail in the + // file load inside StreamBufferSetup(); + lstrcpy( szFileBuffer, lpsz ); + + // Search backwards and find the last backslash, stopping at the + // beginning of the file name + lpsz = &szFileBuffer[lstrlen(szFileBuffer)]; + + while( lpsz > szFileBuffer ) + { + if( *(lpsz-1) == '\\' ) + { + break; + } + lpsz--; + } + // Fake the szFileTitle, which normally gets set by the Common Dialog + lstrcpy( szFileTitle, lpsz ); + lstrcpy( szCDStartPath, szFileBuffer ); + szCDStartPath[lpsz-szFileBuffer] = 0; + + if( fStartLooping ) + { + // Allowing auto-close when the user will have plenty of time to click + // stop would cause the app to shutdown right as they hit the button, + // which is weird behavior. + gfCloseOnDone = FALSE; + Button_SetCheck( hWndLoopCheck, TRUE ); + } + + if( StreamBufferSetup() != 0 ) + { + // Error opening the WAVE file so abort + return; + } + else + { + bFileOpen = TRUE; + EnableMenuItem( GetMenu( hWndMain ), IDM_PLAY, + MF_BYCOMMAND | MF_ENABLED ); + EnableWindow( hWndPlay, TRUE ); + EnableMenuItem( GetMenu( hWndMain ), IDM_FILE_CLOSE, + MF_BYCOMMAND | MF_ENABLED ); + DrawMenuBar( hWndMain ); + BuildTitleBarText(); + + if( fStartPlaying ) + SendMessage( hWndMain, WM_COMMAND, MAKEWPARAM( IDM_PLAY, 0 ), 0L ); + } + } + diff --git a/sdk/samples/dsstream/dsstream.def b/sdk/samples/dsstream/dsstream.def new file mode 100644 index 0000000..9ea779a --- /dev/null +++ b/sdk/samples/dsstream/dsstream.def @@ -0,0 +1,10 @@ +NAME DSSTREAM + +DESCRIPTION 'DirectSound Streaming Playback Example' + +EXPORTS + DLG_About + DSEnumProc + DSEnumDlgProc + MainWindowProc + TimeFunc diff --git a/sdk/samples/dsstream/dsstream.h b/sdk/samples/dsstream/dsstream.h new file mode 100644 index 0000000..dfa65f6 --- /dev/null +++ b/sdk/samples/dsstream/dsstream.h @@ -0,0 +1,212 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: DSStream.h + * Content: DirectSound Stream Sample Application Header + * + ***************************************************************************/ +#ifndef __DSSTREAM_INCLUDED__ +#define __DSSTREAM_INCLUDED__ + +#include <dsound.h> +#include "resource.h" +#include "debug.h" + +/* WARNING -- Be careful about changing NUM_BUFFER_SEGMENTS -- it should be at + * least 3, or there will probably not be enough time for the interrupt to do + * its thing before the player catches up to it. Also, PLAYBACK_TIMER_PERIOD + * is set at 200 milliseconds because we are OVERSAMPLING by a factor of four. + * This is so we can shift the frequency on the fly and still keep up with the + * play cursor. The timer routine will only fill when necessary. Experiments + * have shown that the timer still operates well when interrupted every 50ms + * (and possibly even more often than that). If you do not require real-time + * frequency changes, you reduce the OVERSAMPLE as well as the TIMER_PERIOD. + * However, note that since a buffer segment is only an approximation of the + * number of bytes played per interrupt, it's a good idea to interupt a bit more + * often than the TIMER_PERIOD, just to make sure the timer isn't falling behind + * the player. If your frequency is fixed, the call to initialize the timer + * event could be changed to first calculate something like (TIMER_PERIOD * .8). + * This should ensure that the buffer is well maintained and system performance + * is maximized. + */ + +#define NUM_BUFFER_SEGMENTS 6 +#define PLAYBACK_TIMER_PERIOD 200 +#define PLAYBACK_OVERSAMPLE 4 +#define PLAYBACK_TIMER_ACCURACY 10 + +#define DSSTREAM_STOPF_NOREOPEN 0x0001 +#define DSSTREAM_STOPF_NOEXIT 0x0002 // Prevent the stop code from calling exit + +#define ERR_WAVE_OPEN_FAILED -100 +#define ERR_WAVE_INVALID_FORMAT -101 +#define ERR_CREATEDSB_FAILED -102 +#define ERR_WAVE_CORRUPTED_FILE -103 + + +#define BORDER_SPACE_CX 10 +#define BORDER_SPACE_CY 10 +#define CONTROL_SPACE_CX 4 +#define CONTROL_SPACE_CY 4 +#define TEXT_SPACE_CY 0 +#define TEXT_SPACE_CX 2 + +#define BUTTON_CX 70 +#define BUTTON_CY 32 +#define CHECK_CX 70 +#define CHECK_CY 22 +#define BUTTON_SPACE_CY 6 + +#define PAN_TEXT_CX 140 +#define VOL_TEXT_CX 140 +#define FREQ_TEXT_CX 140 +#define PROG_TEXT_CX 140 + +#define PAN_TB_CX 200 +#define PAN_TB_CY 30 +#define VOL_TB_CX 200 +#define VOL_TB_CY 30 +#define FREQ_TB_CX 200 +#define FREQ_TB_CY 30 +#define PROG_TB_CX 200 +#define PROG_TB_CY 30 + +// The values for PAN may change in range... + +//#define PAN_TB_MIN 0 +//#define PAN_TB_MAX 2000 +//#define PAN_TB_CENTER 1000 +//#define PAN_MULTIPLIER 1 +#define PAN_MIN 0 +#define PAN_MAX 800 +#define PAN_CENTER 400 +#define PAN_SHIFT (-400) +#define PAN_PAGESIZE 10 +#define PAN_DIV 10 +#define PAN_MULT 10 + +//#define PAN_DSB_MIN (-400) +//#define PAN_DSB_MAX 400 +//#define PAN_DSB_CENTER 0 + +//#define VOL_TB_MIN 0 +//#define VOL_TB_MAX 1000 +//#define VOL_MULTIPLIER 1 +#define VOL_SHIFT (-400) +#define VOL_MIN 0 +#define VOL_MAX 400 +#define VOL_PAGESIZE 10 +#define VOL_DIV 10 +#define VOL_MULT 10 +#define FREQ_MIN 441 +#define FREQ_MAX 4410 +#define FREQ_PAGESIZE 100 +#define FREQ_MULTIPLIER 10 +#define PROG_MIN 0 +#define PROG_MAX 10000 +#define PROG_MULTIPLIER 100 + + +/* WAVE I/O subsystem defines */ + +#define WAVEVERSION 1 + +#ifndef ER_MEM +#define ER_MEM 0xe000 +#endif + +#ifndef ER_CANNOTOPEN +#define ER_CANNOTOPEN 0xe100 +#endif + +#ifndef ER_NOTWAVEFILE +#define ER_NOTWAVEFILE 0xe101 +#endif + +#ifndef ER_CANNOTREAD +#define ER_CANNOTREAD 0xe102 +#endif + +#ifndef ER_CORRUPTWAVEFILE +#define ER_CORRUPTWAVEFILE 0xe103 +#endif + +#ifndef ER_CANNOTWRITE +#define ER_CANNOTWRITE 0xe104 +#endif + +/* Streaming communication defines and structures */ + +#define WM_DSSTREAM_DONE WM_USER + 0x100 /* Make our own app messages */ +#define WM_DSSTREAM_DEBUG WM_USER + 0x101 +#define WM_DSSTREAM_PROGRESS WM_USER + 0x102 + +#define DEBUGF_PLAYPOSITION 0x0300 +#define DEBUGF_WRITEPOSITION 0x0301 +#define DEBUGF_NEXTWRITE 0x0302 +#define DEBUGF_SKIP 0x0303 + +/* + * This structure keeps all the data that the TimeFunc callback uses in one + * place. In this implementation, that means the global data segement. This + * is setup so that if you wanted to put your callback in a DLL, all you'd need + * to do is pass the address of this structure as a parameter. + */ + +typedef struct waveinfoca_tag +{ + WAVEFORMATEX *pwfx; /* Wave Format data structure */ + HMMIO hmmio; /* MM I/O handle for the WAVE */ + MMCKINFO mmck; /* Multimedia RIFF chunk */ + MMCKINFO mmckInRIFF; /* Use in opening a WAVE file */ + LPDIRECTSOUNDBUFFER lpDSBStreamBuffer; /* Points to DirectSoundBuffer */ + DWORD dwBufferSize; /* Size of the entire buffer */ + DWORD dwNextWriteOffset; /* Offset to next buffer segment */ + DWORD dwProgress; /* Used with above to show prog. */ + DWORD dwBytesRemaining; /* Bytes 'til timer shutdown */ + BOOL bDonePlaying; /* Signals early abort to timer */ + BOOL bLoopFile; /* Should we loop playback? */ + BOOL bFoundEnd; /* Timer found file end */ +} WAVEINFOCA, *LPWAVEINFOCA; + +/* Function declarations */ + +LRESULT CALLBACK MainWindowProc( HWND, unsigned, WPARAM, LPARAM ); +BOOL CALLBACK DLG_About( HWND, UINT, WPARAM, LPARAM ); +void CALLBACK TimeFunc( UINT, UINT, DWORD, DWORD, DWORD ); +BOOL CALLBACK DSEnumDlgProc( HWND, UINT, WPARAM, LPARAM ); +BOOL CALLBACK DSEnumProc( LPGUID, LPSTR, LPSTR, LPVOID ); + +void ErrorMessageBox( UINT, DWORD ); +void HandlePanScroll( int, int ); +void HandleVolScroll( int, int ); +void HandleFreqScroll( int, int ); +void ResetWavePlayer( void ); +void UpdateFromControls( void ); + +int CreateChildren( RECT ); +int HandleCommDlgError( DWORD ); +int StreamBufferSetup( void ); + +BOOL DoDSoundEnumerate( LPGUID ); + +int WaveOpenFile(char *, HMMIO *, WAVEFORMATEX **, MMCKINFO *); +int WaveStartDataRead(HMMIO *, MMCKINFO *, MMCKINFO *); +int WaveReadFile(HMMIO, UINT, BYTE *, MMCKINFO *, UINT *); +int WaveCloseReadFile(HMMIO *, WAVEFORMATEX **); + +int WaveCreateFile(char *, HMMIO *, WAVEFORMATEX *, MMCKINFO *, MMCKINFO *); +int WaveStartDataWrite(HMMIO *, MMCKINFO *, MMIOINFO *); +int WaveWriteFile(HMMIO, UINT, BYTE *, MMCKINFO *, UINT *, MMIOINFO *); +int WaveCloseWriteFile(HMMIO *, MMCKINFO *, MMCKINFO *, MMIOINFO *, DWORD); + +int WaveLoadFile(char *, UINT *, DWORD *, WAVEFORMATEX **, BYTE **); +int WaveSaveFile(char *, UINT, DWORD, WAVEFORMATEX *, BYTE *); + +int WaveCopyUselessChunks(HMMIO *, MMCKINFO *, MMCKINFO *, HMMIO *, + MMCKINFO *, MMCKINFO *); +BOOL riffCopyChunk(HMMIO, HMMIO, const LPMMCKINFO); + +#endif /* __DSSTREAM_INCLUDED__ */ + diff --git a/sdk/samples/dsstream/dsstream.rc b/sdk/samples/dsstream/dsstream.rc new file mode 100644 index 0000000..7ae6bb7 --- /dev/null +++ b/sdk/samples/dsstream/dsstream.rc @@ -0,0 +1,245 @@ +//Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "winver.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINMENU MENU PRELOAD DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Open...", IDM_FILE_OPEN + MENUITEM "&Close", IDM_FILE_CLOSE, GRAYED + MENUITEM "E&xit", IDM_FILE_EXIT + END + MENUITEM "&Play!", IDM_PLAY, GRAYED + MENUITEM "&Stop!", IDM_STOP, GRAYED + POPUP "&Options" + BEGIN + MENUITEM "&Enumerate Drivers", IDM_OPTIONS_ENUMDRIVERS + END + POPUP "&Help" + BEGIN + MENUITEM "&About...", IDM_HELP_ABOUT + END +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""winver.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +///////////////////////////////////////////////////////////////////////////// +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 192, 85 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About DSStream" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,71,65,50,14 + LTEXT "DSStream Sample Application",IDC_STATIC,52,8,128,8 + ICON IDI_ICON1,IDC_STATIC,8,8,18,20 + LTEXT "Copyright (c) 1995-1996 Microsoft Corporation",IDC_STATIC, + 52,44,128,8 + LTEXT "Shows streaming WAVE audio from disk to a secondary DirectSoundBuffer", + IDC_STATIC,52,20,128,20 +END + +IDD_DSENUMBOX DIALOG DISCARDABLE 0, 0, 184, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Choose a DirectSound Driver..." +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,34,43,50,14 + PUSHBUTTON "Cancel",IDCANCEL,100,43,50,14 + COMBOBOX IDC_DSENUM_COMBO,4,12,176,36,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Driver Description:",IDC_STATIC,4,4,116,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +IDI_ICON1 ICON DISCARDABLE "icon3.ico" +IDI_ICON2 ICON DISCARDABLE "icon2.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Microsoft Corporation\0" + VALUE "FileDescription", "dsstream\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "dsstream\0" + VALUE "LegalCopyright", "Copyright (c) 1995-1996\0" + VALUE "OriginalFilename", "dsstream.exe\0" + VALUE "ProductName", "DirectSound Stream Playback Sample Application\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CDERR_GENERAL_BASE "Common Dialog Subsystem Error" + IDS_CDERR_FINDRESFAILURE "Could not find a required resource." + IDS_CDERR_INITIALIZATION + "Initialization failed: Memory resources may be running low." + IDS_CDERR_LOADRESFAILURE "Could not load a required resource." + IDS_CDERR_LOCKRESFAILURE "Could not lock a required resource." + IDS_CDERR_LOADSTRFAILURE "Could not load a required string resource" + IDS_CDERR_MEMALLOCFAILURE + "Unable to allocate sufficient memory for internal data structures: memory resources may be running low." + IDS_CDERR_MEMLOCKFAILURE "Could not lock a memory resource." + IDS_CDERR_NOHINSTANCE "The caller attempted to use a dialog template with specifiying an instance handle" + IDS_CDERR_NOHOOK "The caller requested use of a hook procedure, but failed to provide one." + IDS_CDERR_NOTEMPLATE "The caller requested use of a dialog template, but failed to provide one." + IDS_CDERR_REGISTERMSGFAIL + "The common dialog subsystem was unable to register a private message using RegisterWindowMessage()." + IDS_CDERR_STRUCTSIZE "The common dialog subsystem received a structure with an improper size member." + IDS_CDERR_DIALOGFAILURE "Unable to create dialog box." + IDS_CDERR_TITLESTRING "Common Dialog Error!" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_TBTITLE_PAN "Pan" + IDS_TBTITLE_VOLUME "Volume" + IDS_TBTITLE_FREQUENCY "Frequency" + IDS_TBTITLE_PROGRESS "Progress" + IDS_BUTTON_PLAY "Play" + IDS_BUTTON_STOP "Stop" + IDS_CHECK_LOOPED "Looped" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "DirectSound Stream" + IDS_APP_CAPTION "DirectSound Stream Sample Application" + IDS_APP_NAME "DSStream" + IDS_OPEN_DLGTITLE "Open WAVE File for Playback" + IDS_OPEN_FILTER1 "WAVE Audio Files (*.WAV)" + IDS_OPEN_FILTER2 "*.WAV" + IDS_OPEN_FILTER3 "All Files (*.*)" + IDS_OPEN_FILTER4 "*.*" + IDS_ENUMWARNING "Drivers will not be enumerated until DSStream is run again." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ERROR_APPINIT "Could not initialize application" + IDS_ERROR_INSTANCEINIT "Could not initialize an instance of this application" + IDS_ERROR_REGISTERCLASS "RegisterClass() failed while attempting to register the main application window class" + IDS_ERROR_MAINWNDCREATE "Could not create the main application window: CreateWindow() failed." + IDS_ERROR_DSCREATE "Could not create a Directsound object: Either the required device is busy, or the DirectSound subsystem is not properly installed." + IDS_ERROR_WAVEFILEOPEN "Could not open the requested WAVE file: Resources may be running low" + IDS_ERROR_WAVENOTPCM "The selected WAVE file is not a PCM encoded file and cannot be opened by this application." + IDS_ERROR_WAVESEEKFAILED + "An error occured while attempting to seek to the data chunk of the WAVE file: the file may be corrupt." + IDS_ERROR_DSBCREATE "The application was unable to create a DirectSoundBuffer object. Resources may be running low or the sound device may be busy." + IDS_ERROR_PAN "Pan" + IDS_ERROR_VOL "Volume" + IDS_ERROR_FREQ "Freq" + IDS_ERROR_DSCOOPERATIVE "Could not set Cooperative Level on DirectSound object!" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ERROR_PROG "Prog" + IDS_ERROR_CHILDTEMPLATE "Unable to create the %s %s control -- CreateWindow() failed in CreateChildren(). Resources may be running low." + IDS_ERROR_TRACKBAR "Trackbar" + IDS_ERROR_BUTTON "Button" + IDS_ERROR_STATICTEXT "Static Text" + IDS_ERROR_GETTEXTEXTENT "Unable to determine text size while creating child controls: GetTextExtentPoint32() failed." + IDS_ERROR_CHECK "Checkbox" +END + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sdk/samples/dsstream/dstrenum.c b/sdk/samples/dsstream/dstrenum.c new file mode 100644 index 0000000..0e43704 --- /dev/null +++ b/sdk/samples/dsstream/dstrenum.c @@ -0,0 +1,141 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: dstrenum.c + * Content: Illustrates enumerating DirectSound drivers + * + ***************************************************************************/ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <dsound.h> +#include <memory.h> + +#include "dsstream.h" + +extern HINSTANCE hInst; +extern HWND hWndMain; + + + +/****************************************************************************/ +/* DoDSoundEnumerate() */ +/* */ +/* This function takes care of handling the DirectSound enumeration, which*/ +/* simply means creating a dialog box, at this point... */ +/****************************************************************************/ +BOOL DoDSoundEnumerate( LPGUID lpGUID ) + { + if( DialogBoxParam( hInst, MAKEINTRESOURCE(IDD_DSENUMBOX), hWndMain, + DSEnumDlgProc, (LPARAM)lpGUID )) + return( TRUE ); + + return( FALSE ); + } + +/****************************************************************************/ +/* DSEnumDlgProc() */ +/* */ +/* Dialog procedure for the DSound enumeration choice dialog. Allows the */ +/* user to choose from installed drivers. Returns TRUE on error. */ +/****************************************************************************/ +BOOL CALLBACK DSEnumDlgProc( HWND hDlg, UINT msg, + WPARAM wParam, LPARAM lParam ) + { + static HWND hCombo; + static LPGUID lpGUID; + LPGUID lpTemp; + int i; + + switch( msg ) + { + case WM_INITDIALOG: + hCombo = GetDlgItem( hDlg, IDC_DSENUM_COMBO ); + lpGUID = (LPGUID)lParam; + + if( DirectSoundEnumerate( (LPDSENUMCALLBACK)DSEnumProc, &hCombo ) != DS_OK ) + { + EndDialog( hDlg, TRUE ); + return( TRUE ); + } + if( ComboBox_GetCount( hCombo )) + ComboBox_SetCurSel( hCombo, 0 ); + else + { + EndDialog( hDlg, TRUE ); + return( TRUE ); + } + return( TRUE ); + + + case WM_COMMAND: + switch( LOWORD( wParam )) + { + case IDOK: + for( i = 0; i < ComboBox_GetCount( hCombo ); i++ ) + { + lpTemp = (LPGUID)ComboBox_GetItemData( hCombo, i ); + if( i == ComboBox_GetCurSel( hCombo )) + { + if( lpTemp != NULL ) + memcpy( lpGUID, lpTemp, sizeof(GUID)); + else + lpGUID = NULL; + } + if( lpTemp ) + LocalFree( lpTemp ); + } + // If we got the NULL GUID, then we want to open the default + // sound driver, so return with an error and the init code + // will know not to pass in the guID and will send NULL + // instead. + if( lpGUID == NULL ) + EndDialog( hDlg, TRUE ); + else + EndDialog( hDlg, FALSE ); + return( TRUE ); + + case IDCANCEL: + // Force a NULL GUID + EndDialog( hDlg, TRUE ); + return( TRUE ); + } + break; + + + default: + return( FALSE ); + } + + return( FALSE ); + } + + +/****************************************************************************/ +/* DSEnumProc() */ +/* */ +/* This is the Enumeration procedure called by DirectSoundEnumerate with */ +/* the parameters of each DirectSound Object available in the system. */ +/****************************************************************************/ +BOOL CALLBACK DSEnumProc( LPGUID lpGUID, LPSTR lpszDesc, + LPSTR lpszDrvName, LPVOID lpContext ) + { + HWND hCombo = *(HWND *)lpContext; + LPGUID lpTemp = NULL; + + if( lpGUID != NULL ) + { + if(( lpTemp = LocalAlloc( LPTR, sizeof(GUID))) == NULL ) + return( TRUE ); + + memcpy( lpTemp, lpGUID, sizeof(GUID)); + } + + ComboBox_AddString( hCombo, lpszDesc ); + ComboBox_SetItemData( hCombo, + ComboBox_FindString( hCombo, 0, lpszDesc ), + lpTemp ); + return( TRUE ); + } diff --git a/sdk/samples/dsstream/dstrtime.c b/sdk/samples/dsstream/dstrtime.c new file mode 100644 index 0000000..512fe65 --- /dev/null +++ b/sdk/samples/dsstream/dstrtime.c @@ -0,0 +1,328 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: Dstrtime.c + * Content: This source file contains a Multimedia Timer Callback + * procedure which is used by the DirectSound Stream Sample + * application to update the playback buffer at regular intervals + * + ***************************************************************************/ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <dsound.h> +#include <commctrl.h> +#include <commdlg.h> +#include <memory.h> +#include <cderr.h> + +#include "dsstream.h" + +extern HWND hWndMain; +extern char szDebug[]; +extern WAVEINFOCA wiWave; + +LONG lInTimer = FALSE; + +void CALLBACK TimeFunc( UINT uTimerID, UINT uMsg, DWORD dwUser, + DWORD dw1, DWORD dw2 ) + { + LPBYTE lpWrite1, lpWrite2, lpTemp; + DWORD dwLen1, dwLen2, dwPlay, dwWrite, dwPlayedLength, dwWriteLength; + DWORD dwLeftToRead, dwStatus; + int nChkErr; + UINT uChkErr; + BOOL fRefillLostBuffer = FALSE; + HRESULT hr; + + if (InterlockedExchange(&lInTimer, TRUE)) return; + + /* See if the buffer has been lost */ + IDirectSoundBuffer_GetStatus( wiWave.lpDSBStreamBuffer, &dwStatus ); + if( DSBSTATUS_BUFFERLOST & dwStatus ) + { + // Restore the buffer and set some variables that will cause it + // to be filled again and replayed + hr = IDirectSoundBuffer_Restore( wiWave.lpDSBStreamBuffer ); + if( FAILED( hr )) + { + InterlockedExchange( &lInTimer, FALSE ); + return; + } + wiWave.dwNextWriteOffset = 0; + fRefillLostBuffer = TRUE; + } + + /* Get and print the current position of the play cursor */ + wiWave.lpDSBStreamBuffer->lpVtbl->GetCurrentPosition( + wiWave.lpDSBStreamBuffer, &dwPlay, &dwWrite ); + + /* If the play cursor is at the same spot as the last call, there are two + * possibilities. The first is that we were called extremely late and + * happened to land on an integer number of complete buffer cycles. This + * is not very likely. The other is that the play cursor didn't move. + * Since we're oversampling, this is very likely. In this case, we should + * bail. + */ + + if( dwPlay == wiWave.dwNextWriteOffset && !fRefillLostBuffer ) + { +#ifdef DEBUG + PostMessage( hWndMain, WM_DSSTREAM_DEBUG, + MAKEWPARAM( DEBUGF_SKIP, 0 ), 0 ); +#endif + InterlockedExchange(&lInTimer, FALSE); + return; + } + +#ifdef DEBUG + PostMessage( hWndMain, WM_DSSTREAM_DEBUG, + MAKEWPARAM( DEBUGF_PLAYPOSITION, 0 ), dwPlay ); +#endif + +#ifdef DEBUG + PostMessage( hWndMain, WM_DSSTREAM_DEBUG, + MAKEWPARAM( DEBUGF_WRITEPOSITION, 0 ), + wiWave.dwNextWriteOffset ); +#endif + + /* Have we found the end of the file and passed the buffer end? */ + if( wiWave.bFoundEnd && !wiWave.dwBytesRemaining ) + { + if( !wiWave.bDonePlaying ) + { + wiWave.bDonePlaying = TRUE; + PostMessage( hWndMain, WM_DSSTREAM_DONE, (WPARAM)0, (LPARAM)0 ); + } + InterlockedExchange(&lInTimer, FALSE); + return; + } + + if( dwPlay < wiWave.dwNextWriteOffset ) + { + /* Calculate how many writeable bytes there are behind the play cursor */ + dwPlayedLength = (dwPlay + wiWave.dwBufferSize - wiWave.dwNextWriteOffset); + } + else + { + /* Calculate how many writeable bytes there are behind the play cursor */ + dwPlayedLength = (dwPlay - wiWave.dwNextWriteOffset); + } + + // If the buffer was lost, then we need to start filling data at the start of + // the buffer, but we can decrease startup latency by only filling a segment + // or two this time around. + if( fRefillLostBuffer ) + dwWriteLength = 2 * wiWave.dwBufferSize / NUM_BUFFER_SEGMENTS; + else + dwWriteLength = dwPlayedLength; + + wiWave.dwProgress += dwPlayedLength; + + PostMessage( hWndMain, WM_DSSTREAM_PROGRESS, 0L, wiWave.dwProgress ); + + + /* + * If wiWave.bFoundEnd == TRUE, then we've finished reading in the file, + * but we need to wait until the buffer's play cursor passes the point we + * were at when we found out we were done reading. + */ + if( wiWave.bFoundEnd && wiWave.dwBytesRemaining ) + { + // Decrement the count of how many bytes we have to wait for before + // we can kill the timer procedure safely + if( dwPlayedLength > wiWave.dwBytesRemaining ) + wiWave.dwBytesRemaining = 0; + else + wiWave.dwBytesRemaining -= dwPlayedLength; + + if( wiWave.lpDSBStreamBuffer->lpVtbl->Lock( wiWave.lpDSBStreamBuffer, + wiWave.dwNextWriteOffset, + dwWriteLength, + &((LPVOID)lpWrite1), &dwLen1, + &((LPVOID)lpWrite2), &dwLen2, + 0 ) != 0 ) + { + OutputDebugString( "TimeFunc() could not lock DirectSoundBuffer" ); + InterlockedExchange(&lInTimer, FALSE); + return; + } + + /* Silence out both parts of the locked buffer */ + memset( lpWrite1, wiWave.pwfx->wBitsPerSample == 8 ? 128 : 0, dwLen1 ); + + if( lpWrite2 && dwLen2 ) + memset( lpWrite2, + wiWave.pwfx->wBitsPerSample == 8 ? 128 : 0, + dwLen2 ); + + wiWave.lpDSBStreamBuffer->lpVtbl->Unlock( wiWave.lpDSBStreamBuffer, + (LPVOID)lpWrite1, dwLen1, + (LPVOID)lpWrite2, dwLen2 ); + /* + * This code is stolen from the end of the routine -- we need to keep + * zeroing out buffer segments while we're waiting for the play cursor to + * catch up to the end of the WAVE data. + */ + wiWave.dwNextWriteOffset += dwWriteLength; + if( wiWave.dwNextWriteOffset >= wiWave.dwBufferSize ) + wiWave.dwNextWriteOffset -= wiWave.dwBufferSize; + +#ifdef DEBUG + PostMessage( hWndMain, WM_DSSTREAM_DEBUG, + MAKEWPARAM( DEBUGF_NEXTWRITE, 0 ), + wiWave.dwNextWriteOffset ); +#endif + InterlockedExchange(&lInTimer, FALSE); + return; + } + + /* Lock a segment of memory that is behind the play cursor */ + if( wiWave.lpDSBStreamBuffer->lpVtbl->Lock( wiWave.lpDSBStreamBuffer, + wiWave.dwNextWriteOffset, + dwWriteLength, + &((LPVOID)lpWrite1), &dwLen1, + &((LPVOID)lpWrite2), &dwLen2, + 0 ) != 0 ) + { + OutputDebugString( "TimeFunc() could not lock DirectSoundBuffer" ); + InterlockedExchange(&lInTimer, FALSE); + return; + } + + if( dwLen1 && !wiWave.bDonePlaying ) + { + nChkErr = WaveReadFile( wiWave.hmmio, (UINT)dwLen1, lpWrite1, + &wiWave.mmck, &uChkErr ); + if( uChkErr < (UINT)dwLen1 ) + { + if( !wiWave.bLoopFile ) + { + /* Zero out the rest of this block */ + if( wiWave.pwfx->wBitsPerSample == 8 ) + memset( lpWrite1+uChkErr, 128, ((UINT)dwLen1-uChkErr)); + else if( wiWave.pwfx->wBitsPerSample == 16 ) + memset( lpWrite1+uChkErr, 0, ((UINT)dwLen1-uChkErr)); + +/* Enable play completion detection code at the beginning of the next call */ + + wiWave.bFoundEnd = TRUE; + if( dwPlay > wiWave.dwNextWriteOffset ) + wiWave.dwBytesRemaining = (wiWave.dwNextWriteOffset + + wiWave.dwBufferSize - dwPlay); + else + wiWave.dwBytesRemaining = (wiWave.dwNextWriteOffset + - dwPlay); + } + else + { + lpTemp = lpWrite1; + dwLeftToRead = dwLen1; + do + { + /* Continue decrementing our count and moving our temp + * pointer forward until we've read the file enough times + * to fill the buffer. NOTE: It's probably not efficient + * to bother with the overhead of streaming a file that's + * not at least as large as the buffer... */ + lpTemp += uChkErr; + dwLeftToRead -= uChkErr; + nChkErr = WaveStartDataRead( &wiWave.hmmio, + &wiWave.mmck, + &wiWave.mmckInRIFF ); + nChkErr = WaveReadFile( wiWave.hmmio, (UINT)dwLeftToRead, + lpTemp, + &wiWave.mmck, &uChkErr ); + } while( uChkErr < dwLeftToRead ); + } + } + } + /* + * The bDonePlaying flag is set by the caller if the user stops playback + * before the end of the WAVE file is encountered. It tells us to cut this + * racket out and play nothing in case it takes the caller a couple + * interrupts to shut off the timer. + */ + else if( dwLen1 && wiWave.bDonePlaying ) + { + // Set the appropriate silence value + _fmemset( lpWrite1, + wiWave.pwfx->wBitsPerSample == 8 ? 128 : 0, + dwLen1); + } + + if( dwLen2 && !wiWave.bDonePlaying ) + { + nChkErr = WaveReadFile( wiWave.hmmio, (UINT)dwLen2, lpWrite2, + &wiWave.mmck, &uChkErr ); + if( uChkErr < (UINT)dwLen2 ) + { + if( !wiWave.bLoopFile ) + { + /* Zero out the rest of this block */ + if( wiWave.pwfx->wBitsPerSample == 8 ) + memset( lpWrite2+uChkErr, 128, ((UINT)dwLen2-uChkErr)); + else if( wiWave.pwfx->wBitsPerSample == 16 ) + memset( lpWrite2+uChkErr, 0, ((UINT)dwLen2-uChkErr)); + /* Enable play completion detection code at the beginning + * of the next call + */ + wiWave.bFoundEnd = TRUE; + if( dwPlay > wiWave.dwNextWriteOffset ) + wiWave.dwBytesRemaining = (wiWave.dwNextWriteOffset + + wiWave.dwBufferSize - dwPlay); + else + wiWave.dwBytesRemaining = (wiWave.dwNextWriteOffset + - dwPlay); + } + else + { + lpTemp = lpWrite2; + dwLeftToRead = dwLen2; + do + { + /* Continue decrementing our count and moving our temp + * pointer forward until we've read the file enough times + * to fill the buffer. NOTE: It's probably not efficient + * to bother with the overhead of streaming a file that's + * not at least as large as the buffer... */ + lpTemp += uChkErr; + dwLeftToRead -= uChkErr; + nChkErr = WaveStartDataRead( &wiWave.hmmio, + &wiWave.mmck, + &wiWave.mmckInRIFF ); + nChkErr = WaveReadFile( wiWave.hmmio, (UINT)dwLeftToRead, + lpTemp, + &wiWave.mmck, &uChkErr ); + } while( uChkErr < dwLeftToRead ); + } + } + } + else if( lpWrite2 && dwLen2 && wiWave.bDonePlaying ) + { + // Set the appropriate silence value + _fmemset( lpWrite2, + wiWave.pwfx->wBitsPerSample == 8 ? 128 : 0, + dwLen2 ); + } + + wiWave.lpDSBStreamBuffer->lpVtbl->Unlock( wiWave.lpDSBStreamBuffer, + (LPVOID)lpWrite1, dwLen1, + (LPVOID)lpWrite2, dwLen2 ); + + wiWave.dwNextWriteOffset += dwWriteLength; + if( wiWave.dwNextWriteOffset >= wiWave.dwBufferSize ) + wiWave.dwNextWriteOffset -= wiWave.dwBufferSize; + +#ifdef DEBUG + PostMessage( hWndMain, WM_DSSTREAM_DEBUG, + MAKEWPARAM( DEBUGF_NEXTWRITE, 0 ), + wiWave.dwNextWriteOffset ); +#endif + if( fRefillLostBuffer ) + IDirectSoundBuffer_Play( wiWave.lpDSBStreamBuffer, 0, 0, DSBPLAY_LOOPING ); + InterlockedExchange(&lInTimer, FALSE); + return; + } diff --git a/sdk/samples/dsstream/dstrwave.c b/sdk/samples/dsstream/dstrwave.c new file mode 100644 index 0000000..160394b --- /dev/null +++ b/sdk/samples/dsstream/dstrwave.c @@ -0,0 +1,901 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: dstrwave.c + * Content: Wave library routines. + * + * This file is used for loading/saving waves, and reading and + * writing waves in smaller blocks. + * Uses WaveOpenFile, WaveReadFile and WaveCloseReadFile for + * single block access to reading wave files. + * Uses WaveCreateFile, WaveWriteFile, WaveCloseWriteFile for + * single block access for writing wave files. + * Uses WaveLoadFile to load a whole wave file into memory. + * Uses WaveSaveFile to save a whole wave file from memory. + * + ***************************************************************************/ + +/* PROTOTYPES */ +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include "dsstream.h" +#include "wassert.h" + + +/* ROUTINES */ +/* -------------------------------------------------------*/ + +/* This function will open a wave input file and prepare it for reading, + * so the data can be easily + * read with WaveReadFile. Returns 0 if successful, the error code if not. + * pszFileName - Input filename to load. + * phmmioIn - Pointer to handle which will be used + * for further mmio routines. + * ppwfxInfo - Ptr to ptr to WaveFormatEx structure + * with all info about the file. + * +*/ +int WaveOpenFile( + char *pszFileName, // (IN) + HMMIO *phmmioIn, // (OUT) + WAVEFORMATEX **ppwfxInfo, // (OUT) + MMCKINFO *pckInRIFF // (OUT) + ) +{ + HMMIO hmmioIn; + MMCKINFO ckIn; // chunk info. for general use. + PCMWAVEFORMAT pcmWaveFormat; // Temp PCM structure to load in. + WORD cbExtraAlloc; // Extra bytes for waveformatex + int nError; // Return value. + + + // Initialization... + *ppwfxInfo = NULL; + nError = 0; + hmmioIn = NULL; + + if ((hmmioIn = mmioOpen(pszFileName, NULL, MMIO_ALLOCBUF | MMIO_READ)) == NULL) + { + nError = ER_CANNOTOPEN; + goto ERROR_READING_WAVE; + } + + if ((nError = (int)mmioDescend(hmmioIn, pckInRIFF, NULL, 0)) != 0) + { + goto ERROR_READING_WAVE; + } + + + if ((pckInRIFF->ckid != FOURCC_RIFF) || (pckInRIFF->fccType != mmioFOURCC('W', 'A', 'V', 'E'))) + { + nError = ER_NOTWAVEFILE; + goto ERROR_READING_WAVE; + } + + /* Search the input file for for the 'fmt ' chunk. */ + ckIn.ckid = mmioFOURCC('f', 'm', 't', ' '); + if ((nError = (int)mmioDescend(hmmioIn, &ckIn, pckInRIFF, MMIO_FINDCHUNK)) != 0) + { + goto ERROR_READING_WAVE; + } + + /* Expect the 'fmt' chunk to be at least as large as <PCMWAVEFORMAT>; + * if there are extra parameters at the end, we'll ignore them */ + + if (ckIn.cksize < (long) sizeof(PCMWAVEFORMAT)) + { + nError = ER_NOTWAVEFILE; + goto ERROR_READING_WAVE; + } + + /* Read the 'fmt ' chunk into <pcmWaveFormat>.*/ + if (mmioRead(hmmioIn, (HPSTR) &pcmWaveFormat, (long) sizeof(pcmWaveFormat)) != (long) sizeof(pcmWaveFormat)) + { + nError = ER_CANNOTREAD; + goto ERROR_READING_WAVE; + } + + + // Ok, allocate the waveformatex, but if its not pcm + // format, read the next word, and thats how many extra + // bytes to allocate. + if (pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_PCM) + cbExtraAlloc = 0; + + else + { + // Read in length of extra bytes. + if (mmioRead(hmmioIn, (LPSTR) &cbExtraAlloc, + (long) sizeof(cbExtraAlloc)) != (long) sizeof(cbExtraAlloc)) + { + nError = ER_CANNOTREAD; + goto ERROR_READING_WAVE; + } + + } + + // Ok, now allocate that waveformatex structure. + if ((*ppwfxInfo = GlobalAlloc(GMEM_FIXED, sizeof(WAVEFORMATEX)+cbExtraAlloc)) == NULL) + { + nError = ER_MEM; + goto ERROR_READING_WAVE; + } + + // Copy the bytes from the pcm structure to the waveformatex structure + memcpy(*ppwfxInfo, &pcmWaveFormat, sizeof(pcmWaveFormat)); + (*ppwfxInfo)->cbSize = cbExtraAlloc; + + // Now, read those extra bytes into the structure, if cbExtraAlloc != 0. + if (cbExtraAlloc != 0) + { + if (mmioRead(hmmioIn, (LPSTR) (((BYTE*)&((*ppwfxInfo)->cbSize))+sizeof(cbExtraAlloc)), + (long) (cbExtraAlloc)) != (long) (cbExtraAlloc)) + { + nError = ER_NOTWAVEFILE; + goto ERROR_READING_WAVE; + } + } + + /* Ascend the input file out of the 'fmt ' chunk. */ + if ((nError = mmioAscend(hmmioIn, &ckIn, 0)) != 0) + { + goto ERROR_READING_WAVE; + + } + + + goto TEMPCLEANUP; + +ERROR_READING_WAVE: + if (*ppwfxInfo != NULL) + { + GlobalFree(*ppwfxInfo); + *ppwfxInfo = NULL; + } + + if (hmmioIn != NULL) + { + mmioClose(hmmioIn, 0); + hmmioIn = NULL; + } + +TEMPCLEANUP: + *phmmioIn = hmmioIn; + + return(nError); + +} + +/* This routine has to be called before WaveReadFile as it searchs for the chunk to descend into for + reading, that is, the 'data' chunk. For simplicity, this used to be in the open routine, but was + taken out and moved to a separate routine so there was more control on the chunks that are before + the data chunk, such as 'fact', etc... */ + +int WaveStartDataRead( + HMMIO *phmmioIn, + MMCKINFO *pckIn, + MMCKINFO *pckInRIFF + ) +{ + int nError; + + nError = 0; + + // Do a nice little seek... + if ((nError = mmioSeek(*phmmioIn, pckInRIFF->dwDataOffset + sizeof(FOURCC), SEEK_SET)) == -1) + { + Assert(FALSE); + } + + nError = 0; + // Search the input file for for the 'data' chunk. + pckIn->ckid = mmioFOURCC('d', 'a', 't', 'a'); + if ((nError = mmioDescend(*phmmioIn, pckIn, pckInRIFF, MMIO_FINDCHUNK)) != 0) + { + goto ERROR_READING_WAVE; + } + + goto CLEANUP; + +ERROR_READING_WAVE: + +CLEANUP: + return(nError); +} + + +/* This will read wave data from the wave file. Makre sure we're descended into + the data chunk, else this will fail bigtime! + hmmioIn - Handle to mmio. + cbRead - # of bytes to read. + pbDest - Destination buffer to put bytes. + cbActualRead- # of bytes actually read. + + + +*/ + + +int WaveReadFile( + HMMIO hmmioIn, // IN + UINT cbRead, // IN + BYTE *pbDest, // IN + MMCKINFO *pckIn, // IN. + UINT *cbActualRead // OUT. + + ) +{ + + MMIOINFO mmioinfoIn; // current status of <hmmioIn> + int nError; + UINT cT, cbDataIn, uCopyLength; + + nError = 0; + + if (nError = mmioGetInfo(hmmioIn, &mmioinfoIn, 0) != 0) + { + goto ERROR_CANNOT_READ; + } + + cbDataIn = cbRead; + if (cbDataIn > pckIn->cksize) + cbDataIn = pckIn->cksize; + + pckIn->cksize -= cbDataIn; + + for (cT = 0; cT < cbDataIn; ) + { + /* Copy the bytes from the io to the buffer. */ + if (mmioinfoIn.pchNext == mmioinfoIn.pchEndRead) + { + if ((nError = mmioAdvance(hmmioIn, &mmioinfoIn, MMIO_READ)) != 0) + { + goto ERROR_CANNOT_READ; + } + if (mmioinfoIn.pchNext == mmioinfoIn.pchEndRead) + { + nError = ER_CORRUPTWAVEFILE; + goto ERROR_CANNOT_READ; + } + } + + // Actual copy. + uCopyLength = (UINT)(mmioinfoIn.pchEndRead - mmioinfoIn.pchNext); + if((cbDataIn - cT) < uCopyLength ) + uCopyLength = cbDataIn - cT; + memcpy( (BYTE*)(pbDest+cT), (BYTE*)mmioinfoIn.pchNext, uCopyLength ); + cT += uCopyLength; + mmioinfoIn.pchNext += uCopyLength; + } + + if ((nError = mmioSetInfo(hmmioIn, &mmioinfoIn, 0)) != 0) + { + goto ERROR_CANNOT_READ; + } + + *cbActualRead = cbDataIn; + goto FINISHED_READING; + +ERROR_CANNOT_READ: + *cbActualRead = 0; + +FINISHED_READING: + return(nError); + +} + +/* This will close the wave file openned with WaveOpenFile. + phmmioIn - Pointer to the handle to input MMIO. + ppwfxSrc - Pointer to pointer to WaveFormatEx structure. + + Returns 0 if successful, non-zero if there was a warning. + +*/ +int WaveCloseReadFile( + HMMIO *phmmio, // IN + WAVEFORMATEX **ppwfxSrc // IN + ) +{ + + if (*ppwfxSrc != NULL) + { + GlobalFree(*ppwfxSrc); + *ppwfxSrc = NULL; + } + + if (*phmmio != NULL) + { + mmioClose(*phmmio, 0); + *phmmio = NULL; + } + + return(0); + +} + +/* This routine will create a wave file for writing. This will automatically overwrite any + existing file with the same name, so be careful and check before hand!!! + pszFileName - Pointer to filename to write. + phmmioOut - Pointer to HMMIO handle that is used for further writes + pwfxDest - Valid waveformatex destination structure. + pckOut - Pointer to be set with the MMCKINFO. + pckOutRIFF - Pointer to be set with the RIFF info. + +*/ +int WaveCreateFile( + char *pszFileName, // (IN) + HMMIO *phmmioOut, // (OUT) + WAVEFORMATEX *pwfxDest, // (IN) + MMCKINFO *pckOut, // (OUT) + MMCKINFO *pckOutRIFF // (OUT) + + ) +{ + + int nError; // Return value. + DWORD dwFactChunk; // Contains the actual fact chunk. Garbage until WaveCloseWriteFile. + MMCKINFO ckOut1; + + dwFactChunk = (DWORD)-1; + nError = 0; + + *phmmioOut = mmioOpen(pszFileName, NULL, + MMIO_ALLOCBUF | MMIO_READWRITE|MMIO_CREATE); + + if (*phmmioOut == NULL) + { + nError = ER_CANNOTWRITE; + goto ERROR_CANNOT_WRITE; // cannot save WAVE file + } + + /* Create the output file RIFF chunk of form type 'WAVE'. + */ + pckOutRIFF->fccType = mmioFOURCC('W', 'A', 'V', 'E'); + pckOutRIFF->cksize = 0; + if ((nError = mmioCreateChunk(*phmmioOut, pckOutRIFF, MMIO_CREATERIFF)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + /* We are now descended into the 'RIFF' chunk we just created. + * Now create the 'fmt ' chunk. Since we know the size of this chunk, + * specify it in the MMCKINFO structure so MMIO doesn't have to seek + * back and set the chunk size after ascending from the chunk. + */ + pckOut->ckid = mmioFOURCC('f', 'm', 't', ' '); + pckOut->cksize = sizeof(PCMWAVEFORMAT); // we know the size of this ck. + if ((nError = mmioCreateChunk(*phmmioOut, pckOut, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + /* Write the PCMWAVEFORMAT structure to the 'fmt ' chunk if its that type. */ + if (pwfxDest->wFormatTag == WAVE_FORMAT_PCM) + { + if (mmioWrite(*phmmioOut, (HPSTR) pwfxDest, sizeof(PCMWAVEFORMAT)) + != sizeof(PCMWAVEFORMAT)) + { + nError = ER_CANNOTWRITE; + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + } + + else + { + // Write the variable length size. + if ((UINT)mmioWrite(*phmmioOut, (HPSTR) pwfxDest, sizeof(*pwfxDest)+pwfxDest->cbSize) + != (sizeof(*pwfxDest)+pwfxDest->cbSize)) + { + nError = ER_CANNOTWRITE; + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + } + + /* Ascend out of the 'fmt ' chunk, back into the 'RIFF' chunk. + */ + if ((nError = mmioAscend(*phmmioOut, pckOut, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + // Now create the fact chunk, not required for PCM but nice to have. This is filled + // in when the close routine is called. + ckOut1.ckid = mmioFOURCC('f', 'a', 'c', 't'); + ckOut1.cksize = 0; + if ((nError = mmioCreateChunk(*phmmioOut, &ckOut1, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + if (mmioWrite(*phmmioOut, (HPSTR)&dwFactChunk, sizeof(dwFactChunk)) != sizeof(dwFactChunk)) + { + nError = ER_CANNOTWRITE; + goto ERROR_CANNOT_WRITE; + } + + // Now ascend out of the fact chunk... + if ((nError = mmioAscend(*phmmioOut, &ckOut1, 0)) != 0) + { + nError = ER_CANNOTWRITE; // cannot write file, probably + goto ERROR_CANNOT_WRITE; + } + + + + goto DONE_CREATE; + +ERROR_CANNOT_WRITE: + // Maybe delete the half-written file? Ah forget it for now, its good to leave the + // file there for debugging... + +DONE_CREATE: + return(nError); + +} + +/* This routine has to be called before any data is written to the wave output file, via wavewritefile. This + sets up the data to write, and creates the data chunk. +*/ + +int WaveStartDataWrite( + HMMIO *phmmioOut, // (IN) + MMCKINFO *pckOut, // (IN) + MMIOINFO *pmmioinfoOut // (OUT) + ) +{ + + int nError; + + nError = 0; + /* Create the 'data' chunk that holds the waveform samples. */ + pckOut->ckid = mmioFOURCC('d', 'a', 't', 'a'); + pckOut->cksize = 0; + if ((nError = mmioCreateChunk(*phmmioOut, pckOut, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; // cannot write file, probably + } + + if ((nError = mmioGetInfo(*phmmioOut, pmmioinfoOut, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; + } + + goto CLEANUP; +ERROR_CANNOT_WRITE: + +CLEANUP: + return(nError); +} + +/* This routine will write out data to a wave file. + hmmioOut - Handle to hmmioOut filled by WaveCreateFile + cbWrite - # of bytes to write out. + pbSrc - Pointer to source. + pckOut - pointer to ckOut filled by WaveCreateFile + cbActualWrite - # of actual bytes written. + pmmioinfoOut - Pointer to mmioinfoOut filled by WaveCreateFile. + + Returns 0 if successful, else the error code. + + */ + + +int WaveWriteFile( + HMMIO hmmioOut, // (IN) + UINT cbWrite, // (IN) + BYTE *pbSrc, // (IN) + MMCKINFO *pckOut, // (IN) + UINT *cbActualWrite, // (OUT) + MMIOINFO *pmmioinfoOut // (IN) + ) +{ + + + int nError; + UINT cT; + + nError = 0; + + *cbActualWrite = 0; + + for (cT=0; cT < cbWrite; cT++) + { + if (pmmioinfoOut->pchNext == pmmioinfoOut->pchEndWrite) + { + pmmioinfoOut->dwFlags |= MMIO_DIRTY; + if ((nError = mmioAdvance(hmmioOut, pmmioinfoOut, MMIO_WRITE)) != 0) + { + goto ERROR_CANNOT_WRITE; + } + } + *((BYTE*)pmmioinfoOut->pchNext)++ = *((BYTE*)pbSrc+cT); + (*cbActualWrite)++; + } + + +ERROR_CANNOT_WRITE: + // What to do here? Well, for now, nothing, just return that error. (maybe delete the + // file later? + + return(nError); + +} + + + +/* This routine will close a wave file used for writing. Returns 0 if successful, else + the error code. + phmmioOut - Pointer to mmio handle for saving. + pckOut - Pointer to the MMCKINFO for saving. + pckOutRiff - Pointer to the riff MMCKINFO for saving. + pmmioinfoOut- Pointer to mmioinfo for saving. + cSamples - # of samples saved, for the fact chunk. For PCM, this isn't used but + will be written anyway, so this can be zero as long as programs ignore + this field when they load PCM formats. + + + +*/ +int WaveCloseWriteFile( + HMMIO *phmmioOut, // (IN) + MMCKINFO *pckOut, // (IN) + MMCKINFO *pckOutRIFF, // (IN) + MMIOINFO *pmmioinfoOut, // (IN) + DWORD cSamples // (IN) + ) +{ + + int nError; + + nError = 0; + + if (*phmmioOut == NULL) + return(0); + + pmmioinfoOut->dwFlags |= MMIO_DIRTY; + if ((nError = mmioSetInfo(*phmmioOut, pmmioinfoOut, 0)) != 0) + { + // cannot flush, probably... + goto ERROR_CANNOT_WRITE; + } + + /* Ascend the output file out of the 'data' chunk -- this will cause + * the chunk size of the 'data' chunk to be written. + */ + if ((nError = mmioAscend(*phmmioOut, pckOut, 0)) != 0) + goto ERROR_CANNOT_WRITE; // cannot write file, probably + + + // Do this here instead... + if ((nError = mmioAscend(*phmmioOut, pckOutRIFF, 0)) != 0) + goto ERROR_CANNOT_WRITE; // cannot write file, probably + + + nError = mmioSeek(*phmmioOut, 0, SEEK_SET); + if ((nError = (int)mmioDescend(*phmmioOut, pckOutRIFF, NULL, 0)) != 0) + { + goto ERROR_CANNOT_WRITE; + } + + nError = 0; + pckOut->ckid = mmioFOURCC('f', 'a', 'c', 't'); + if ((nError = mmioDescend(*phmmioOut, pckOut, pckOutRIFF, MMIO_FINDCHUNK)) == 0) + { + // If it didn't fail, write the fact chunk out, if it failed, not critical, just + // assert (below). + nError = mmioWrite(*phmmioOut, (HPSTR)&cSamples, sizeof(DWORD)); + nError = mmioAscend(*phmmioOut, pckOut, 0); + nError = 0; + } + else + { + nError = 0; + Assert(FALSE); + } + +// CANTWRITEFACT: + /* Ascend the output file out of the 'RIFF' chunk -- this will cause + * the chunk size of the 'RIFF' chunk to be written. + */ + if ((nError = mmioAscend(*phmmioOut, pckOutRIFF, 0)) != 0) + goto ERROR_CANNOT_WRITE; // cannot write file, probably + + + +ERROR_CANNOT_WRITE: + if (*phmmioOut != NULL) + { + mmioClose(*phmmioOut, 0); + *phmmioOut = NULL; + } + + return(nError); + +} + +/* This routine will copy from a source wave file to a destination wave file all those useless chunks + (well, the ones useless to conversions, etc --> apparently people use them!). The source will be + seeked to the begining, but the destination has to be at a current pointer to put the new chunks. + This will also seek back to the start of the wave riff header at the end of the routine. + + phmmioIn - Pointer to input mmio file handle. + pckIn - Pointer to a nice ckIn to use. + pckInRiff - Pointer to the main riff. + phmmioOut - Pointer to output mmio file handle. + pckOut - Pointer to nice ckOut to use. + pckOutRiff - Pointer to the main riff. + + + Returns 0 if successful, else the error code. If this routine fails, it still attemps to seek back to + the start of the wave riff header, though this too could be unsuccessful. +*/ + +int WaveCopyUselessChunks( + HMMIO *phmmioIn, + MMCKINFO *pckIn, + MMCKINFO *pckInRiff, + HMMIO *phmmioOut, + MMCKINFO *pckOut, + MMCKINFO *pckOutRiff) +{ + + int nError; + + nError = 0; + // First seek to the stinking start of the file, not including the riff header... + if ((nError = mmioSeek(*phmmioIn, pckInRiff->dwDataOffset + sizeof(FOURCC), SEEK_SET)) == -1) + { + nError = ER_CANNOTREAD; + goto ERROR_IN_PROC; + } + + nError = 0; + + while (mmioDescend(*phmmioIn, pckIn, pckInRiff, 0) == 0) + { + + // quickly check for corrupt RIFF file--don't ascend past end! + if ((pckIn->dwDataOffset + pckIn->cksize) > (pckInRiff->dwDataOffset + pckInRiff->cksize)) + goto ERROR_IN_PROC; + + switch (pckIn->ckid) + { + // explicitly skip these... + case mmioFOURCC('f', 'm', 't', ' '): + break; + + case mmioFOURCC('d', 'a', 't', 'a'): + break; + + case mmioFOURCC('f', 'a', 'c', 't'): + break; + + case mmioFOURCC('J', 'U', 'N', 'K'): + break; + + case mmioFOURCC('P', 'A', 'D', ' '): + break; + + case mmioFOURCC('c', 'u', 'e', ' '): + break; + + // copy chunks that are OK to copy + case mmioFOURCC('p', 'l', 's', 't'): + // although without the 'cue' chunk, it doesn't make much sense + riffCopyChunk(*phmmioIn, *phmmioOut, pckIn); + break; + + case mmioFOURCC('D', 'I', 'S', 'P'): + riffCopyChunk(*phmmioIn, *phmmioOut, pckIn); + break; + + + // don't copy unknown chunks + default: + break; + } + + + // step up to prepare for next chunk.. + mmioAscend(*phmmioIn, pckIn, 0); + } + +ERROR_IN_PROC: + { + int nErrorT; + // Seek back to riff header + nErrorT = mmioSeek(*phmmioIn, pckInRiff->dwDataOffset + sizeof(FOURCC), SEEK_SET); + } + + return(nError); +} + +/** BOOL RIFFAPI riffCopyChunk(HMMIO hmmioSrc, HMMIO hmmioDst, const LPMMCKINFO lpck) + * + * DESCRIPTION: + * + * + * ARGUMENTS: + * (LPWAVECONVCB lpwc, LPMMCKINFO lpck) + * + * RETURN (BOOL NEAR PASCAL): + * + * + * NOTES: + * + ** */ + +BOOL riffCopyChunk(HMMIO hmmioSrc, HMMIO hmmioDst, const LPMMCKINFO lpck) +{ + MMCKINFO ck; + HPSTR hpBuf; + + // + // + // + hpBuf = (HPSTR)GlobalAllocPtr(GHND, lpck->cksize); + if (!hpBuf) + return (FALSE); + + ck.ckid = lpck->ckid; + ck.cksize = lpck->cksize; + if (mmioCreateChunk(hmmioDst, &ck, 0)) + goto rscc_Error; + + if (mmioRead(hmmioSrc, hpBuf, lpck->cksize) != (LONG)lpck->cksize) + goto rscc_Error; + + if (mmioWrite(hmmioDst, hpBuf, lpck->cksize) != (LONG)lpck->cksize) + goto rscc_Error; + + if (mmioAscend(hmmioDst, &ck, 0)) + goto rscc_Error; + + if (hpBuf) + GlobalFreePtr(hpBuf); + + return (TRUE); + +rscc_Error: + + if (hpBuf) + GlobalFreePtr(hpBuf); + + return (FALSE); +} /* RIFFSupCopyChunk() */ + + + +/* This routine loads a full wave file into memory. Be careful, wave files can get + pretty big these days :). + szFileName - sz Filename + cbSize - Size of loaded wave (returned) + cSamples - # of samples loaded. + ppwfxInfo - Pointer to pointer to waveformatex structure. The wfx structure + IS ALLOCATED by this routine! Make sure to free it! + ppbData - Pointer to a byte pointer (globalalloc) which is allocated by this + routine. Make sure to free it! + + Returns 0 if successful, else the error code. +*/ + +int WaveLoadFile( + char *pszFileName, // (IN) + UINT *cbSize, // (OUT) + DWORD *pcSamples, // (OUT) + WAVEFORMATEX **ppwfxInfo, // (OUT) + BYTE **ppbData // (OUT) + ) +{ + + HMMIO hmmioIn; + MMCKINFO ckInRiff; + MMCKINFO ckIn; + int nError; + UINT cbActualRead; + + *ppbData = NULL; + *ppwfxInfo = NULL; + *cbSize = 0; + + if ((nError = WaveOpenFile(pszFileName, &hmmioIn, ppwfxInfo, &ckInRiff)) != 0) + { + goto ERROR_LOADING; + } + + if ((nError = WaveStartDataRead(&hmmioIn, &ckIn, &ckInRiff)) != 0) + { + goto ERROR_LOADING; + } + + // Ok, size of wave data is in ckIn, allocate that buffer. + if ((*ppbData = (BYTE *)GlobalAlloc(GMEM_FIXED, ckIn.cksize)) == NULL) + { + nError = ER_MEM; + goto ERROR_LOADING; + } + + if ((nError = WaveReadFile(hmmioIn, ckIn.cksize, *ppbData, &ckIn, &cbActualRead)) != 0) + { + goto ERROR_LOADING; + } + + *cbSize = cbActualRead; + goto DONE_LOADING; + +ERROR_LOADING: + if (*ppbData != NULL) + { + GlobalFree(*ppbData); + *ppbData = NULL; + } + if (*ppwfxInfo != NULL) + { + GlobalFree(*ppwfxInfo); + *ppwfxInfo = NULL; + } + +DONE_LOADING: + // Close the wave file. + if (hmmioIn != NULL) + { + mmioClose(hmmioIn, 0); + hmmioIn = NULL; + } + + return(nError); + +} + +/* This routine saves a wave file in currently in memory. + pszFileName - FileName to save to. Automatically overwritten, be careful! + cbSize - Size in bytes to write. + cSamples - # of samples to write, used to make the fact chunk. (if !PCM) + pwfxDest - Pointer to waveformatex structure. + pbData - Pointer to the data. +*/ + +int WaveSaveFile( + char *pszFileName, // (IN) + UINT cbSize, // (IN) + DWORD cSamples, // (IN) + WAVEFORMATEX *pwfxDest, // (IN) + BYTE *pbData // (IN) + ) +{ + + HMMIO hmmioOut; + MMCKINFO ckOut; + MMCKINFO ckOutRIFF; + MMIOINFO mmioinfoOut; + UINT cbActualWrite; + int nError; + + if ((nError = WaveCreateFile(pszFileName, &hmmioOut, pwfxDest, &ckOut, &ckOutRIFF)) != 0) + { + goto ERROR_SAVING; + } + + if ((nError = WaveStartDataWrite(&hmmioOut, &ckOut, &mmioinfoOut)) != 0) + { + goto ERROR_SAVING; + } + + if ((nError = WaveWriteFile(hmmioOut, cbSize, pbData, &ckOut, &cbActualWrite, &mmioinfoOut)) != 0) + { + goto ERROR_SAVING; + } + + if ((nError = WaveCloseWriteFile(&hmmioOut, &ckOut, &ckOutRIFF, &mmioinfoOut, cSamples)) != 0) + { + goto ERROR_SAVING; + } + +ERROR_SAVING: + + return(nError); + +} diff --git a/sdk/samples/dsstream/icon2.ico b/sdk/samples/dsstream/icon2.ico new file mode 100644 index 0000000..c564383 Binary files /dev/null and b/sdk/samples/dsstream/icon2.ico differ diff --git a/sdk/samples/dsstream/icon3.ico b/sdk/samples/dsstream/icon3.ico new file mode 100644 index 0000000..3bd250c Binary files /dev/null and b/sdk/samples/dsstream/icon3.ico differ diff --git a/sdk/samples/dsstream/makefile b/sdk/samples/dsstream/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/dsstream/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/dsstream/msvc.mk b/sdk/samples/dsstream/msvc.mk new file mode 100644 index 0000000..a8d8598 --- /dev/null +++ b/sdk/samples/dsstream/msvc.mk @@ -0,0 +1,42 @@ +NAME = dsstream +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib dsound.lib comdlg32.lib gdi32.lib \ + winmm.lib comctl32.lib libc.lib advapi32.lib + +OBJS = dsstream.obj dstrtime.obj dstrwave.obj wassert.obj debug.obj dstrenum.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/dsstream/readme.txt b/sdk/samples/dsstream/readme.txt new file mode 100644 index 0000000..c52f49f --- /dev/null +++ b/sdk/samples/dsstream/readme.txt @@ -0,0 +1,28 @@ +DirectSound Streaming Test (dsstream) +------------------------------------- + +This sample illustrates how to play a long sound using a streaming +DirectSoundBuffer. Because of this design, it may not work correctly when +using very short sounds, like only 1 or 2 seconds long. Those files are +more appropriate for static buffers; see DirectSound Mixing Test (dsshow) +for examples of how to code such buffers. + +Open a .wav files using the File.Open dialog. The UI of the sample only +allows you to open one file at a time; however, this is a limitation of the +sample, not a limitation of DirectSound. + +There are buttons to Play and Stop the file, and a checkbox to indicate +whether the file should be looped or not. Regardless of the checkbox, +the DirectSoundBuffer will be played with looping since a streaming buffer +is being used. + +There are sliders to control the sound's frequency, pan, and volume settings. +In addition, there is a slider indicating the progress through the sound +data. + +The last thing to know: you can toggle Options.Enumerate Drivers, which +will show you what objects DirectSoundEnumerate will list for you, and allow +you to select one. This only happens when you start up Dsstream, so to see +the effect, select this menu item, exit Dsstream, and then run Dsstream +again. + diff --git a/sdk/samples/dsstream/resource.h b/sdk/samples/dsstream/resource.h new file mode 100644 index 0000000..08bc18d --- /dev/null +++ b/sdk/samples/dsstream/resource.h @@ -0,0 +1,82 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by DSStream.rc +// +#define IDR_MAINMENU 101 +#define IDD_ABOUTBOX 102 +#define IDD_DSENUMBOX 103 +#define IDI_ICON1 107 +#define IDI_ICON2 108 +#define IDC_DSENUM_COMBO 1000 +#define IDS_TBTITLE_PAN 8192 +#define IDS_TBTITLE_VOLUME 8193 +#define IDS_TBTITLE_FREQUENCY 8194 +#define IDS_TBTITLE_PROGRESS 8195 +#define IDS_BUTTON_PLAY 8196 +#define IDS_BUTTON_STOP 8197 +#define IDS_CHECK_LOOPED 8198 +#define IDS_APP_TITLE 8208 +#define IDS_APP_CAPTION 8209 +#define IDS_APP_NAME 8210 +#define IDS_OPEN_DLGTITLE 8211 +#define IDS_OPEN_FILTER1 8212 +#define IDS_OPEN_FILTER2 8213 +#define IDS_OPEN_FILTER3 8214 +#define IDS_OPEN_FILTER4 8215 +#define IDS_ENUMWARNING 8216 +#define IDS_ERROR_APPINIT 8224 +#define IDS_ERROR_INSTANCEINIT 8225 +#define IDS_ERROR_REGISTERCLASS 8226 +#define IDS_ERROR_MAINWNDCREATE 8227 +#define IDS_ERROR_DSCREATE 8229 +#define IDS_ERROR_WAVEFILEOPEN 8230 +#define IDS_ERROR_WAVENOTPCM 8231 +#define IDS_ERROR_WAVESEEKFAILED 8232 +#define IDS_ERROR_DSBCREATE 8233 +#define IDS_ERROR_PAN 8234 +#define IDS_ERROR_VOL 8236 +#define IDS_ERROR_FREQ 8238 +#define IDS_ERROR_DSCOOPERATIVE 8239 +#define IDS_ERROR_PROG 8241 +#define IDS_ERROR_CHILDTEMPLATE 8244 +#define IDS_ERROR_TRACKBAR 8245 +#define IDS_ERROR_BUTTON 8246 +#define IDS_ERROR_STATICTEXT 8247 +#define IDS_ERROR_GETTEXTEXTENT 8248 +#define IDS_ERROR_CHECK 8249 +#define IDS_CDERR_GENERAL_BASE 16384 +#define IDS_CDERR_FINDRESFAILURE 16385 +#define IDS_CDERR_INITIALIZATION 16386 +#define IDS_CDERR_LOADRESFAILURE 16387 +#define IDS_CDERR_LOCKRESFAILURE 16388 +#define IDS_CDERR_LOADSTRFAILURE 16389 +#define IDS_CDERR_MEMALLOCFAILURE 16390 +#define IDS_CDERR_MEMLOCKFAILURE 16391 +#define IDS_CDERR_NOHINSTANCE 16392 +#define IDS_CDERR_NOHOOK 16393 +#define IDS_CDERR_NOTEMPLATE 16394 +#define IDS_CDERR_REGISTERMSGFAIL 16395 +#define IDS_CDERR_STRUCTSIZE 16396 +#define IDS_CDERR_DIALOGFAILURE 16397 +#define IDS_CDERR_TITLESTRING 16398 +#define IDC_LOOPCHECK 40001 +#define IDM_FILE_EXIT 40002 +#define IDM_HELP_ABOUT 40003 +#define IDM_FILE_OPEN 40004 +#define IDM_FILE_CLOSE 40005 +#define IDM_PLAY 40006 +#define IDM_STOP 40007 +#define IDM_OPTIONS_ENUMDRIVERS 40008 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 111 +#define _APS_NEXT_COMMAND_VALUE 40009 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sdk/samples/dsstream/wassert.c b/sdk/samples/dsstream/wassert.c new file mode 100644 index 0000000..4555900 --- /dev/null +++ b/sdk/samples/dsstream/wassert.c @@ -0,0 +1,45 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: wassert.c + * Content: Windows assert handler + * You must externally define hWndMain and szAppName for this + * to work. + * + ***************************************************************************/ + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + +extern HWND hWndMain; +extern char szAppName[]; + +#include "wassert.h" + + +#ifdef WASSERT +void AssertFail(char szErr[], char szFileName[], int nLine, char szMessage[]) + { + char szT[256]; + + if (szMessage != NULL) + wsprintf(szT, "Assert(%s);\nFile %s, line %d. %s", szErr, szFileName, nLine, szMessage); + else + wsprintf(szT, "Assert(%s);\nFile %s, line %d.", szErr, szFileName, nLine); + switch (MessageBox(hWndMain, szT, szAppName, MB_ABORTRETRYIGNORE | MB_ICONSTOP | MB_APPLMODAL)) + { + case IDABORT: + SendMessage(hWndMain, WM_CLOSE, 0, 0); + case IDRETRY: + _asm int 3; + // Fall Through // + case IDIGNORE: + break; + + } // switch + } // AssertFail + + +#endif // ASSERT + diff --git a/sdk/samples/dsstream/wassert.h b/sdk/samples/dsstream/wassert.h new file mode 100644 index 0000000..65eb765 --- /dev/null +++ b/sdk/samples/dsstream/wassert.h @@ -0,0 +1,36 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: wassert.h + * Content: assert header + * + ***************************************************************************/ +#ifndef __WASSERT_INCLUDED__ +#define __WASSERT_INCLUDED__ + +#ifdef DEBUG +#define WASSERT // Enable the Assert() macro +#endif + +#ifdef WASSERT + +#ifdef _cplusplus +extern "C" { +#endif + +void AssertFail(char [], char [], int, char[]); +#define Assert(f) ((f) ? (void)NULL : (void)AssertFail(#f, __FILE__, __LINE__,NULL)) +#define AssertMessage(f, szMessage) ((f) ? (void)NULL : (void)AssertFail(#f, __FILE__, __LINE__, szMessage)) + +#else +#define Assert(f) (void)NULL // Macro that does nothing +#define AssertMessage(f, szMessage) (void)NULL + +#ifdef _cplusplus +}; +#endif + +#endif // ~ASSERT + +#endif diff --git a/sdk/samples/duel/bfire.wav b/sdk/samples/duel/bfire.wav new file mode 100644 index 0000000..7587a0d Binary files /dev/null and b/sdk/samples/duel/bfire.wav differ diff --git a/sdk/samples/duel/comm.c b/sdk/samples/duel/comm.c new file mode 100644 index 0000000..cbcc842 --- /dev/null +++ b/sdk/samples/duel/comm.c @@ -0,0 +1,352 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: comm.c + * Content: DirectPlay related code + * + * + ***************************************************************************/ +#include "comm.h" +#include "lobby.h" + +/* + * Externals + */ +extern LPGUID glpGuid; // duel's guid +extern LPDPLCONNECTION glpdplConnection; // connection settings + +/* + * Globals + */ +LPDPSESSIONDESC2 glpdpSD; // current session description +LPDIRECTPLAY2 glpDP=NULL; // directplay object pointer + +/* + * DPlayClose + * + * Wrapper for DirectPlay Close API + */ +HRESULT DPlayClose(void) +{ + HRESULT hr=E_FAIL; + + if (glpDP) + hr = IDirectPlay2_Close(glpDP); + + return hr; +} + +/* + * DPlayCreate + * + * Wrapper for DirectPlay Create API. Retrieves a DirectPlay2/DirectPlay2A interface + * based on the UNICODE flag + * + */ +HRESULT DPlayCreate(LPGUID lpGuid) +{ + HRESULT hr=E_FAIL; + LPDIRECTPLAY lpDP=NULL; + + // create a DirectPlay1 interface + if ((hr = DirectPlayCreate(lpGuid, &lpDP, NULL)) == DP_OK) + { + if (lpDP) + { + // query for a DirectPlay2(A) interface +#ifdef UNICODE + hr = IDirectPlay_QueryInterface(lpDP,&IID_IDirectPlay2,(LPVOID *)&glpDP); +#else + hr = IDirectPlay_QueryInterface(lpDP,&IID_IDirectPlay2A,(LPVOID *)&glpDP); +#endif + // no longer need the DirectPlay1 interface + IDirectPlay_Release(lpDP); + } + } + + return hr; +} + +/* + * DPlayCreatePlayer + * + * Wrapper for DirectPlay CreatePlayer API. + */ + +HRESULT DPlayCreatePlayer(LPDPID lppidID, LPTSTR lptszPlayerName, HANDLE hEvent, + LPVOID lpData, DWORD dwDataSize) +{ + HRESULT hr=E_FAIL; + DPNAME name; + + ZeroMemory(&name,sizeof(name)); + name.dwSize = sizeof(DPNAME); + +#ifdef UNICODE + name.lpszShortName = lptszPlayerName; +#else + name.lpszShortNameA = lptszPlayerName; +#endif + + if (glpDP) + hr = IDirectPlay2_CreatePlayer(glpDP, lppidID, &name, hEvent, lpData, + dwDataSize, 0); + + return hr; +} + +/* + * DPlayCreateSession + * + * Wrapper for DirectPlay CreateSession API.Uses the global application guid (glpGuid). + */ +HRESULT DPlayCreateSession(LPTSTR lptszSessionName) +{ + HRESULT hr = E_FAIL; + DPSESSIONDESC2 dpDesc; + + ZeroMemory(&dpDesc, sizeof(dpDesc)); + dpDesc.dwSize = sizeof(dpDesc); + dpDesc.dwFlags = DPSESSION_MIGRATEHOST | DPSESSION_KEEPALIVE; + +#ifdef UNICODE + dpDesc.lpszSessionName = lptszSessionName; +#else + dpDesc.lpszSessionNameA = lptszSessionName; +#endif + + // set the application guid + if (glpGuid) + dpDesc.guidApplication = *glpGuid; + + if (glpDP) + hr = IDirectPlay2_Open(glpDP, &dpDesc, DPOPEN_CREATE); + + return hr; +} + +/* + * DPlayDestroyPlayer + * + * Wrapper for DirectPlay DestroyPlayer API. + */ +HRESULT DPlayDestroyPlayer(DPID pid) +{ + HRESULT hr=E_FAIL; + + if (glpDP) + hr = IDirectPlay2_DestroyPlayer(glpDP, pid); + + return hr; +} + +/* + * DPlayEnumPlayers + * + * Wrapper for DirectPlay API EnumPlayers + */ +HRESULT DPlayEnumPlayers(LPGUID lpSessionGuid, LPDPENUMPLAYERSCALLBACK2 lpEnumCallback, + LPVOID lpContext, DWORD dwFlags) +{ + HRESULT hr=E_FAIL; + + if (glpDP) + hr = IDirectPlay2_EnumPlayers(glpDP, lpSessionGuid, lpEnumCallback, lpContext, dwFlags); + + return hr; +} + +/* + * DPlayEnumSessions + * + * Wrapper for DirectPlay EnumSessions API. + */ +HRESULT DPlayEnumSessions(DWORD dwTimeout, LPDPENUMSESSIONSCALLBACK2 lpEnumCallback, + LPVOID lpContext, DWORD dwFlags) +{ + HRESULT hr = E_FAIL; + DPSESSIONDESC2 dpDesc; + + ZeroMemory(&dpDesc, sizeof(dpDesc)); + dpDesc.dwSize = sizeof(dpDesc); + if (glpGuid) + dpDesc.guidApplication = *glpGuid; + + if (glpDP) + hr = IDirectPlay2_EnumSessions(glpDP, &dpDesc, dwTimeout, lpEnumCallback, + lpContext, dwFlags); + + + return hr; +} + +/* + * DPlayGetPlayerData + * + * Wrapper for DirectPlay GetPlayerData API. + */ +HRESULT DPlayGetPlayerData(DPID pid, LPVOID lpData, LPDWORD lpdwDataSize, DWORD dwFlags) +{ + HRESULT hr=E_FAIL; + + if (glpDP) + hr = IDirectPlay2_GetPlayerData(glpDP, pid, lpData, lpdwDataSize, dwFlags); + + return hr; +} + +/* + * DPlayGetSessionDesc + * + * Wrapper for DirectPlay GetSessionDesc API. + */ +HRESULT DPlayGetSessionDesc(void) +{ + HRESULT hr=E_FAIL; + DWORD dwSize; + + // free old session desc, if any + if (glpdpSD) + { + free(glpdpSD); + glpdpSD = NULL; + } + + if (glpDP) + { + // first get the size for the session desc + if ((hr = IDirectPlay2_GetSessionDesc(glpDP, NULL, &dwSize)) == DPERR_BUFFERTOOSMALL) + { + // allocate memory for it + glpdpSD = (LPDPSESSIONDESC2) malloc(dwSize); + if (glpdpSD) + { + // now get the session desc + hr = IDirectPlay2_GetSessionDesc(glpDP, glpdpSD, &dwSize); + } + else + { + hr = E_OUTOFMEMORY; + } + } + } + + return hr; +} + +/* + * IsDPlay + * + * Returns TRUE if a DirectPlay interface exists, otherwise FALSE. + */ +BOOL IsDPlay(void) +{ + return (glpDP ? TRUE:FALSE); +} + +/* + * DPlayOpenSession + * + * Wrapper for DirectPlay OpenSession API. + */ +HRESULT DPlayOpenSession(LPGUID lpSessionGuid) +{ + HRESULT hr = E_FAIL; + DPSESSIONDESC2 dpDesc; + + ZeroMemory(&dpDesc, sizeof(dpDesc)); + dpDesc.dwSize = sizeof(dpDesc); + + // set the session guid + if (lpSessionGuid) + dpDesc.guidInstance = *lpSessionGuid; + // set the application guid + if (glpGuid) + dpDesc.guidApplication = *glpGuid; + + // open it + if (glpDP) + hr = IDirectPlay2_Open(glpDP, &dpDesc, DPOPEN_JOIN); + + return hr; +} + + +/* + * DPlayReceive + * + * Wrapper for DirectPlay Receive API + */ +HRESULT DPlayReceive(LPDPID lpidFrom, LPDPID lpidTo, DWORD dwFlags, LPVOID lpData, LPDWORD lpdwDataSize) +{ + HRESULT hr = E_FAIL; + + if (glpDP) + hr = IDirectPlay2_Receive(glpDP, lpidFrom, lpidTo, dwFlags, lpData, lpdwDataSize); + + return hr; +} + +/* + * DPlayRelease + * + * Wrapper for DirectPlay Release API. + */ +HRESULT DPlayRelease(void) +{ + HRESULT hr = E_FAIL; + + if (glpDP) + { + // free session desc, if any + if (glpdpSD) + { + free(glpdpSD); + glpdpSD = NULL; + } + + // free connection settings structure, if any (lobby stuff) + if (glpdplConnection) + { + free(glpdplConnection); + glpdplConnection = NULL; + } + // release dplay + hr = IDirectPlay2_Release(glpDP); + glpDP = NULL; + } + + return hr; +} + +/* + * DPlaySend + * + * Wrapper for DirectPlay Send API. + */ +HRESULT DPlaySend(DPID idFrom, DPID idTo, DWORD dwFlags, LPVOID lpData, DWORD dwDataSize) +{ + HRESULT hr = E_FAIL; + + if (glpDP) + hr = IDirectPlay2_Send(glpDP, idFrom, idTo, dwFlags, lpData, dwDataSize); + + return hr; +} + +/* + * DPlaySetPlayerData + * + * Wrapper for DirectPlay SetPlayerData API + */ +HRESULT DPlaySetPlayerData(DPID pid, LPVOID lpData, DWORD dwSize, DWORD dwFlags) +{ + HRESULT hr=E_FAIL; + + if (glpDP) + hr = IDirectPlay2_SetPlayerData(glpDP, pid, lpData, dwSize, dwFlags); + + return hr; +} + diff --git a/sdk/samples/duel/comm.h b/sdk/samples/duel/comm.h new file mode 100644 index 0000000..f743a1b --- /dev/null +++ b/sdk/samples/duel/comm.h @@ -0,0 +1,40 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: comm.h + * Content: communication routines include file + * + * + ***************************************************************************/ +#define IDIRECTPLAY2_OR_GREATER +#include <dplay.h> +#include "duel.h" + +/* + * Prototypes + */ +HRESULT DPlayClose(void); +HRESULT DPlayCreate(LPGUID lpGuid); +HRESULT DPlayCreatePlayer(LPDPID lppidID, LPTSTR lpPlayerName, HANDLE hEvent, + LPVOID lpData, DWORD dwDataSize); +HRESULT DPlayCreateSession(LPTSTR lptszSessionName); +HRESULT DPlayDestroyPlayer(DPID pid); +HRESULT DPlayEnumPlayers(LPGUID lpSessionGuid, LPDPENUMPLAYERSCALLBACK2 lpEnumCallback, + LPVOID lpContext, DWORD dwFlags); +HRESULT DPlayEnumSessions(DWORD dwTimeout, LPDPENUMSESSIONSCALLBACK2 lpEnumCallback, + LPVOID lpContext, DWORD dwFlags); +HRESULT DPlayGetPlayerData(DPID pid, LPVOID lpData, LPDWORD lpdwDataSize, DWORD dwFlags); +HRESULT DPlayGetSessionDesc(void); +BOOL IsDPlay(void); +HRESULT DPlayOpenSession(LPGUID lpSessionGuid); +HRESULT DPlayReceive(LPDPID lpidFrom, LPDPID lpidTo, DWORD dwFlags, LPVOID lpData, + LPDWORD lpdwDataSize); +HRESULT DPlayRelease(void); +HRESULT DPlaySend(DPID idFrom, DPID idTo, DWORD dwFlags, LPVOID lpData, + DWORD dwDataSize); +HRESULT DPlaySetPlayerData(DPID pid, LPVOID lpData, DWORD dwSize, DWORD dwFlags); + + + + diff --git a/sdk/samples/duel/csession.bmp b/sdk/samples/duel/csession.bmp new file mode 100644 index 0000000..aff7ee5 Binary files /dev/null and b/sdk/samples/duel/csession.bmp differ diff --git a/sdk/samples/duel/ddutil.cpp b/sdk/samples/duel/ddutil.cpp new file mode 100644 index 0000000..1c97095 --- /dev/null +++ b/sdk/samples/duel/ddutil.cpp @@ -0,0 +1,323 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: ddutil.cpp + * Content: Routines for loading bitmap and palettes from resources + * + ***************************************************************************/ +#undef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <ddraw.h> +#include "ddutil.h" + +/* + * DDLoadBitmap + * + * create a DirectDrawSurface from a bitmap resource. + * + */ +extern "C" IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCTSTR tszBitmap, int dx, int dy) +{ + HBITMAP hbm; + BITMAP bm; + DDSURFACEDESC ddsd; + IDirectDrawSurface *pdds; + + // + // try to load the bitmap as a resource, if that fails, try it as a file + // + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), tszBitmap, IMAGE_BITMAP, dx, dy, LR_CREATEDIBSECTION); + + if (hbm == NULL) + hbm = (HBITMAP)LoadImage(NULL, tszBitmap, IMAGE_BITMAP, dx, dy, LR_LOADFROMFILE|LR_CREATEDIBSECTION); + + if (hbm == NULL) + return NULL; + + // + // get size of the bitmap + // + GetObject(hbm, sizeof(bm), &bm); // get size of bitmap + + // + // create a DirectDrawSurface 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 = bm.bmWidth; + ddsd.dwHeight = bm.bmHeight; + + if (pdd->CreateSurface(&ddsd, &pdds, NULL) != DD_OK) + return NULL; + + DDCopyBitmap(pdds, hbm, 0, 0, 0, 0); + + DeleteObject(hbm); + + return pdds; +} + +/* + * DDReLoadBitmap + * + * load a bitmap from a file or resource into a directdraw surface. + * normaly used to re-load a surface after a restore. + * + */ +HRESULT DDReLoadBitmap(IDirectDrawSurface *pdds, LPCTSTR tszBitmap) +{ + HBITMAP hbm; + HRESULT hr; + + // + // try to load the bitmap as a resource, if that fails, try it as a file + // + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), tszBitmap, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); + + if (hbm == NULL) + hbm = (HBITMAP)LoadImage(NULL, tszBitmap, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION); + + if (hbm == NULL) + { + OutputDebugString(TEXT("handle is null\n")); + return E_FAIL; + } + + hr = DDCopyBitmap(pdds, hbm, 0, 0, 0, 0); + if (hr != DD_OK) + { + OutputDebugString(TEXT("ddcopybitmap failed\n")); + } + + + DeleteObject(hbm); + return hr; +} + +/* + * DDCopyBitmap + * + * draw a bitmap into a DirectDrawSurface + * + */ +extern "C" HRESULT DDCopyBitmap(IDirectDrawSurface *pdds, HBITMAP hbm, int x, int y, int dx, int dy) +{ + HDC hdcImage; + HDC hdc; + BITMAP bm; + DDSURFACEDESC ddsd; + HRESULT hr; + + if (hbm == NULL || pdds == NULL) + return E_FAIL; + + // + // make sure this surface is restored. + // + pdds->Restore(); + + // + // select bitmap into a memoryDC so we can use it. + // + hdcImage = CreateCompatibleDC(NULL); + if (!hdcImage) + OutputDebugString(TEXT("createcompatible dc failed\n")); + SelectObject(hdcImage, hbm); + + // + // get size of the bitmap + // + GetObject(hbm, sizeof(bm), &bm); // get size of bitmap + dx = dx == 0 ? bm.bmWidth : dx; // use the passed size, unless zero + dy = dy == 0 ? bm.bmHeight : dy; + + // + // get size of surface. + // + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH; + pdds->GetSurfaceDesc(&ddsd); + + if ((hr = pdds->GetDC(&hdc)) == DD_OK) + { + StretchBlt(hdc, 0, 0, ddsd.dwWidth, ddsd.dwHeight, hdcImage, x, y, dx, dy, SRCCOPY); + pdds->ReleaseDC(hdc); + } + + DeleteDC(hdcImage); + + return hr; +} + +// +// DDLoadPalette +// +// Create a DirectDraw palette object from a bitmap resoure +// +// if the resource does not exist or NULL is passed create a +// default 332 palette. +// +extern "C" IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCTSTR tszBitmap) +{ + IDirectDrawPalette* ddpal; + int i; + int n; + HANDLE fh; + HRSRC h; + LPBITMAPINFOHEADER lpbi; + PALETTEENTRY ape[256]; + RGBQUAD * prgb; + DWORD dwRead; + + // + // build a 332 palette as the default. + // + for (i=0; i<256; i++) + { + ape[i].peRed = (BYTE)(((i >> 5) & 0x07) * 255 / 7); + ape[i].peGreen = (BYTE)(((i >> 2) & 0x07) * 255 / 7); + ape[i].peBlue = (BYTE)(((i >> 0) & 0x03) * 255 / 3); + ape[i].peFlags = (BYTE)0; + } + + // + // get a pointer to the bitmap resource. + // + if (tszBitmap && (h = FindResource(NULL, tszBitmap, RT_BITMAP))) + { + lpbi = (LPBITMAPINFOHEADER)LockResource(LoadResource(NULL, h)); + if (!lpbi) + OutputDebugString(TEXT("lock resource failed\n")); + prgb = (RGBQUAD*)((BYTE*)lpbi + lpbi->biSize); + + if (lpbi == NULL || lpbi->biSize < sizeof(BITMAPINFOHEADER)) + n = 0; + else if (lpbi->biBitCount > 8) + n = 0; + else if (lpbi->biClrUsed == 0) + n = 1 << lpbi->biBitCount; + else + n = lpbi->biClrUsed; + + // + // a DIB color table has its colors stored BGR not RGB + // so flip them around. + // + for(i=0; i<n; i++ ) + { + ape[i].peRed = prgb[i].rgbRed; + ape[i].peGreen = prgb[i].rgbGreen; + ape[i].peBlue = prgb[i].rgbBlue; + ape[i].peFlags = 0; + } + } + else if (tszBitmap && (fh = CreateFile(tszBitmap, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, + NULL)) != INVALID_HANDLE_VALUE) + { + BITMAPFILEHEADER bf; + BITMAPINFOHEADER bi; + + ReadFile(fh, &bf, sizeof(bf), &dwRead, NULL); + ReadFile(fh, &bi, sizeof(bi), &dwRead, NULL); + ReadFile(fh, ape, sizeof(ape), &dwRead, NULL); + CloseHandle(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; + + // + // a DIB color table has its colors stored BGR not RGB + // so flip them around. + // + for(i=0; i<n; i++ ) + { + BYTE r = ape[i].peRed; + ape[i].peRed = ape[i].peBlue; + ape[i].peBlue = r; + } + } + + pdd->CreatePalette(DDPCAPS_8BIT, ape, &ddpal, NULL); + + return ddpal; +} + +/* + * DDColorMatch + * + * convert a RGB color to a pysical color. + * + * we do this by leting GDI SetPixel() do the color matching + * then we lock the memory and see what it got mapped to. + */ +extern "C" DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb) +{ + COLORREF rgbT; + HDC hdc; + DWORD dw = CLR_INVALID; + DDSURFACEDESC ddsd; + HRESULT hres; + + // + // use GDI SetPixel to color match for us + // + if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK) + { + rgbT = GetPixel(hdc, 0, 0); // save current pixel value + SetPixel(hdc, 0, 0, rgb); // set our value + pdds->ReleaseDC(hdc); + } + + // + // now lock the surface so we can read back the converted color + // + ddsd.dwSize = sizeof(ddsd); + while ((hres = pdds->Lock(NULL, &ddsd, 0, NULL)) == DDERR_WASSTILLDRAWING) + ; + + if (hres == DD_OK) + { + dw = *(DWORD *)ddsd.lpSurface; // get DWORD + dw &= (1 << ddsd.ddpfPixelFormat.dwRGBBitCount)-1; // mask it to bpp + pdds->Unlock(NULL); + } + + // + // now put the color that was there back. + // + if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK) + { + SetPixel(hdc, 0, 0, rgbT); + pdds->ReleaseDC(hdc); + } + + return dw; +} + +/* + * DDSetColorKey + * + * set a color key for a surface, given a RGB. + * if you pass CLR_INVALID as the color key, the pixel + * in the upper-left corner will be used. + */ +extern "C" HRESULT DDSetColorKey(IDirectDrawSurface *pdds, COLORREF rgb) +{ + DDCOLORKEY ddck; + + ddck.dwColorSpaceLowValue = DDColorMatch(pdds, rgb); + ddck.dwColorSpaceHighValue = ddck.dwColorSpaceLowValue; + return pdds->SetColorKey(DDCKEY_SRCBLT, &ddck); +} diff --git a/sdk/samples/duel/ddutil.h b/sdk/samples/duel/ddutil.h new file mode 100644 index 0000000..05adb46 --- /dev/null +++ b/sdk/samples/duel/ddutil.h @@ -0,0 +1,25 @@ +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: ddutil.cpp + * Content: Routines for loading bitmap and palettes from resources + * + ***************************************************************************/ + +#include <tchar.h> + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +extern IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCTSTR szBitmap); +extern IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCTSTR szBitmap, int dx, int dy); +extern HRESULT DDReLoadBitmap(IDirectDrawSurface *pdds, LPCTSTR szBitmap); +extern HRESULT DDCopyBitmap(IDirectDrawSurface *pdds, HBITMAP hbm, int x, int y, int dx, int dy); +extern DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb); +extern HRESULT DDSetColorKey(IDirectDrawSurface *pdds, COLORREF rgb); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ diff --git a/sdk/samples/duel/ds3dutil.c b/sdk/samples/duel/ds3dutil.c new file mode 100644 index 0000000..d1cde3e --- /dev/null +++ b/sdk/samples/duel/ds3dutil.c @@ -0,0 +1,337 @@ +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: ds3dutil.c + * Content: Routines for dealing with sounds from resources + * The last 3 functions (the wave file parsing code) + * are copied from dsutil.cpp + * + * + ***************************************************************************/ +#include <tchar.h> +#include <dsound.h> +#include "ds3dutil.h" +//*************************** FUNCTION PROTOTYPES **************************/ +BOOL DSParseWaveResource(void *pvRes, WAVEFORMATEX **ppWaveHeader, + BYTE **ppbWaveData,DWORD *pcbWaveSize); +BOOL DSGetWaveResource ( HMODULE hModule, LPCTSTR lpName, + WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, + DWORD *pcbWaveSize); +BOOL DSFillSoundBuffer( IDirectSoundBuffer *pDSB, BYTE *pbWaveData, DWORD cbWaveSize); +BOOL DSReloadSoundBuffer(IDirectSoundBuffer *pDSB, LPCTSTR lpName); + +//*************************** GLOBAL VARIABLES **************************/ + +_TCHAR gszWaveString[5] = _T("WAVE"); + +/***************************************************************************** +FUNCTION: WaveInit + +PURPOSE: Loads a WAVEDATA struct with the named WAVE resource. + +PARAMETERS: +lplpWD A pointer to a WAVEDATA struct. + +lpDS: A pointer to an IDirectSound object. This object must be, + initialized BEFORE being passed to this function, and MUST have been + initialized with the DSBCAPS_CTRL3D flag. + +lpName: A string that contains the name of the .WAV resource. +*****************************************************************************/ +BOOL WaveInit(LPWAVEDATA *lplpWD, LPDIRECTSOUND lpDS, LPCTSTR lpName) +{ +DSBUFFERDESC dsBD = {0}; +BYTE *pbWaveData=NULL; +LPWAVEDATA lpWD; + +lpWD = (*lplpWD) = (LPWAVEDATA)malloc(sizeof(WAVEDATA)); +lpWD->lpDirectSoundBuffer = NULL; +lpWD->lpName = NULL; +lpWD->lpDS = NULL; + +#ifndef UNICODE + lpWD->lpName = (LPTSTR)malloc(strlen(lpName) + 1); +#else + lpWD->lpName = (LPTSTR)malloc(2*(wcslen(lpName) + 1)); +#endif + if (lpWD->lpName != NULL) + { + _tcscpy(lpWD->lpName, lpName); + + if (DSGetWaveResource(NULL, lpName, &dsBD.lpwfxFormat, &pbWaveData, &dsBD.dwBufferBytes)) + { + dsBD.dwSize = sizeof(DSBUFFERDESC); + dsBD.dwFlags = DSBCAPS_STATIC | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRL3D; + if (DS_OK == IDirectSound_CreateSoundBuffer(lpDS, &dsBD, &lpWD->lpDirectSoundBuffer, NULL)) + { + if (DSFillSoundBuffer(lpWD->lpDirectSoundBuffer, pbWaveData, dsBD.dwBufferBytes)) + { + lpWD->lpDS = lpDS; //also copy the DirectSoundObject + return(TRUE); + } + IDirectSoundBuffer_Release(lpWD->lpDirectSoundBuffer); + lpWD->lpDirectSoundBuffer = NULL; + } + } + free(lpWD->lpName); + lpWD->lpName = NULL; + } + free(*lplpWD); + *lplpWD = NULL; + return(FALSE); +}; + + +/***************************************************************************** +FUNCTION: WaveGetBuffers + +PARAMS: lplpWD A pointer to a WAVEDATA struct. + + lplpDirectSoundBuffer: + The address of a pointer to a DirectSoundBuffer Interface. + lplpDirectSound3DBuffer: + The address of a pointer to a DirectSound3DBuffer Interface. + + Both of these must be Release()'d after their use. + +PURPOSE: Gives the caller back two interface pointers: one to a regular + DirectSoundBuffer interface and one to a 3D buffer interface. These + MUST be Released() by the caller. + +RETURNS: Should always return TRUE, unless something really catastrophic has happened. + +NOTES: BOTH of these Interfaces MUST be ->Release()'d when the object + or whatever is done using them. Otherwise the buffer they point + to will just hang around and waste memory. This wastes processing time, + since each buffer is checked by the mixer quite frequently to see if it + is playing. + + Defaults: Both Position and Velocity vectors are set to (0,0,0). + +**************************************************************************************/ +BOOL WaveGetBuffers (LPWAVEDATA lpWD, + LPDIRECTSOUNDBUFFER *lplpDirectSoundBuffer, + LPDIRECTSOUND3DBUFFER *lplpDirectSound3DBuffer) +{ + if (DS_OK==IDirectSound_DuplicateSoundBuffer(lpWD->lpDS, lpWD->lpDirectSoundBuffer, lplpDirectSoundBuffer)) + { + if (DS_OK==IDirectSoundBuffer_QueryInterface(*lplpDirectSoundBuffer, &IID_IDirectSound3DBuffer, (void **)lplpDirectSound3DBuffer)) + { + return TRUE; + } + IDirectSoundBuffer_Release(*lplpDirectSoundBuffer); + *lplpDirectSoundBuffer=NULL; + *lplpDirectSound3DBuffer = NULL; + } + return FALSE; +}; + + + +/***************************************************************************** +FUNCTION: WaveFree + +PURPOSE: When this is called, we HOPE that all the buffers + (both the normal and the 3D ones) duplicated from "lpDirectSoundBuffer" + in the function WaveGetBuffers() have been ->Release()'d. This frees + up the original buffer (lpDirectSoundBuffer) that all the other buffers + have been duplicated from. +*****************************************************************************/ +void WaveFree(LPWAVEDATA lpWD) +{ +if (lpWD!=NULL) + { + if (lpWD->lpDirectSoundBuffer != NULL) + IDirectSoundBuffer_Release(lpWD->lpDirectSoundBuffer); + if (lpWD->lpName != NULL) + free(lpWD->lpName); + free(lpWD); + } +}; + +/***************************************************************************** +FUNCTION: WaveReload + +PURPOSE: This reloads the wave's sound effect. +*****************************************************************************/ +BOOL WaveReload(LPWAVEDATA lpWD) +{ +return DSReloadSoundBuffer(lpWD->lpDirectSoundBuffer, lpWD->lpName); +}; + + + +/***************************************************************************** +FUNCTION: DSGetWaveResource + +PURPOSE: Sets the following: + a. A pointer to a WAV file header structure + b. A pointer to the WAV file data. + c. A DWORD which is the length of the data (in bytes, not samples) +*****************************************************************************/ +BOOL DSGetWaveResource(HMODULE hModule, LPCTSTR lpName, + WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, + DWORD *pcbWaveSize) +{ + HRSRC hResInfo; + HGLOBAL hResData; + void *pvRes; + + + if (((hResInfo = FindResource(hModule, lpName, gszWaveString)) != NULL) && + ((hResData = LoadResource(hModule, hResInfo)) != NULL) && + ((pvRes = LockResource(hResData)) != NULL) && + DSParseWaveResource(pvRes, ppWaveHeader, ppbWaveData, pcbWaveSize)) + { + return TRUE; + } + return FALSE; +} + + + + +/***************************************************************************** +FUNCTION: DSParseWaveResource + +PURPOSE: This does the real meat of the file parsing, and is called by + DSGetWaveResource +*****************************************************************************/ +BOOL DSParseWaveResource(void *pvRes, WAVEFORMATEX **ppWaveHeader, + BYTE **ppbWaveData,DWORD *pcbWaveSize) +{ + DWORD *pdw; + DWORD *pdwEnd; + DWORD dwRiff; + DWORD dwType; + DWORD dwLength; + + if (ppWaveHeader) + *ppWaveHeader = NULL; + + if (ppbWaveData) + *ppbWaveData = NULL; + + if (pcbWaveSize) + *pcbWaveSize = 0; + + pdw = (DWORD *)pvRes; + dwRiff = *pdw++; + dwLength = *pdw++; + dwType = *pdw++; + + if (dwRiff != mmioFOURCC('R', 'I', 'F', 'F')) + goto exit; // not even RIFF + + if (dwType != mmioFOURCC('W', 'A', 'V', 'E')) + goto exit; // not a WAV + + pdwEnd = (DWORD *)((BYTE *)pdw + dwLength-4); + + while (pdw < pdwEnd) + { + dwType = *pdw++; + dwLength = *pdw++; + + switch (dwType) + { + case mmioFOURCC('f', 'm', 't', ' '): + if (ppWaveHeader && !*ppWaveHeader) + { + if (dwLength < sizeof(WAVEFORMAT)) + goto exit; // not a WAV + + *ppWaveHeader = (WAVEFORMATEX *)pdw; + + if ((!ppbWaveData || *ppbWaveData) && + (!pcbWaveSize || *pcbWaveSize)) + { + return TRUE; + } + } + break; + + case mmioFOURCC('d', 'a', 't', 'a'): + if ((ppbWaveData && !*ppbWaveData) || + (pcbWaveSize && !*pcbWaveSize)) + { + if (ppbWaveData) + *ppbWaveData = (LPBYTE)pdw; + + if (pcbWaveSize) + *pcbWaveSize = dwLength; + + if (!ppWaveHeader || *ppWaveHeader) + return TRUE; + } + break; + } + + pdw = (DWORD *)((BYTE *)pdw + ((dwLength+1)&~1)); + } + +exit: + return FALSE; +} + + + +/***************************************************************************** +FUNCTION: DSFillSoundBuffer + +PURPOSE: Given an already-initialized DirectSoundBuffer, and pointer to + some sound data, and the sound data's size, this writes the data + to the DirectSoundBuffer. +*****************************************************************************/ +BOOL DSFillSoundBuffer(IDirectSoundBuffer *pDSB, BYTE *pbWaveData, DWORD cbWaveSize) +{ + if (pDSB && pbWaveData && cbWaveSize) + { + LPVOID pMem1, pMem2; + DWORD dwSize1, dwSize2; + + if (SUCCEEDED(IDirectSoundBuffer_Lock(pDSB, 0, cbWaveSize, + &pMem1, &dwSize1, &pMem2, &dwSize2, 0))) + { + ZeroMemory(pMem1, dwSize1); + CopyMemory(pMem1, pbWaveData, dwSize1); + + if ( 0 != dwSize2 ) + CopyMemory(pMem2, pbWaveData+dwSize1, dwSize2); + + IDirectSoundBuffer_Unlock(pDSB, pMem1, dwSize1, pMem2, dwSize2); + return TRUE; + } + } + return FALSE; +} + + +/***************************************************************************** +FUNCTION: DSReloadSoundBuffer + +PURPOSE: If an application with WRITE_PRIMARY takes the focus from our + humble window, then our secondary sound buffers become "lost" and + we must call restore and re-fill them. +*****************************************************************************/ +BOOL DSReloadSoundBuffer(IDirectSoundBuffer *pDSB, LPCTSTR lpName) +{ + BOOL result=FALSE; + BYTE *pbWaveData; + DWORD cbWaveSize; + + if (DSGetWaveResource(NULL, lpName, NULL, &pbWaveData, &cbWaveSize)) + { + if (SUCCEEDED(IDirectSoundBuffer_Restore(pDSB))) + { + if (DSFillSoundBuffer(pDSB, pbWaveData, cbWaveSize)) + { + result = TRUE; + } + } + + } + + return result; +} diff --git a/sdk/samples/duel/ds3dutil.h b/sdk/samples/duel/ds3dutil.h new file mode 100644 index 0000000..62d4346 --- /dev/null +++ b/sdk/samples/duel/ds3dutil.h @@ -0,0 +1,35 @@ +#ifndef DS3DUTIL_HEADER +#define DS3DUTIL_HEADER + +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: ds3dutil.h + * Content: Header file prototyping routines for dealing with + * sounds from resources. Much of this stuff + * (especially the wave file parsing code) is copied + * from dsutil.cpp + * + * + ***************************************************************************/ +#include <dsound.h> + +typedef struct +{ +LPDIRECTSOUNDBUFFER lpDirectSoundBuffer; +LPTSTR lpName; +LPDIRECTSOUND lpDS; +} +WAVEDATA, *LPWAVEDATA; + + +BOOL WaveInit(LPWAVEDATA *lplpWD, LPDIRECTSOUND lpDS, LPCTSTR lpName); +BOOL WaveGetBuffers (LPWAVEDATA lpWD, LPDIRECTSOUNDBUFFER *ppDirectSoundBuffer, + LPDIRECTSOUND3DBUFFER *ppDirectSound3DBuffer); +void WaveFree(LPWAVEDATA lpWD); +BOOL WaveReload(LPWAVEDATA lpWD); + + +#endif + diff --git a/sdk/samples/duel/duel.bmp b/sdk/samples/duel/duel.bmp new file mode 100644 index 0000000..a603f34 Binary files /dev/null and b/sdk/samples/duel/duel.bmp differ diff --git a/sdk/samples/duel/duel.c b/sdk/samples/duel/duel.c new file mode 100644 index 0000000..602d253 --- /dev/null +++ b/sdk/samples/duel/duel.c @@ -0,0 +1,620 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: duel.c + * Content: Multi-player duel + * + * + ***************************************************************************/ +#define INITGUID +#include "duel.h" +#include "gameproc.h" +#include "gfx.h" +#include "comm.h" +#include "input.h" +#include "lobby.h" +#include "wizard.h" +#include "util.h" +#include "sfx.h" + +// {33925241-05F8-11d0-8063-00A0C90AE891} +DEFINE_GUID(DUEL_GUID, +0x33925241, 0x5f8, 0x11d0, 0x80, 0x63, 0x0, 0xa0, 0xc9, 0xa, 0xe8, 0x91); + +/* + * Externals + */ +extern DWORD gdwFrameCount; +extern DWORD gdwFrameTime; +extern int gnProgramState; +extern SHIP gOurShip; +extern LPDPLCONNECTION glpdplConnection; +extern DPID gOurID; +extern BOOL gbNoField; + + +/* + * Globals + */ +LPGUID glpGuid; // Duel's GUID +HWND ghWndMain; // Main application window handle +HINSTANCE ghinst; // Application instance handle +BOOL gbShowFrameCount=TRUE; // Show FPS ? +BOOL gbIsActive; // Is the application active ? +BOOL gbUseEmulation; // DDHEL or DDHAL for Graphics +BOOL gbIsHost; // Are we hosting or joining a game +DWORD gdwKeys; // User keyboard input +DWORD gdwOldKeys; // Last frame's keyboard input +BOOL gbFullscreen=FALSE; // Window or FullScreen mode ? +RECT grcWindow; // client rectangle of main window +HANDLE ghThread; // handle to wizard thread +TCHAR gtszClassName[MAX_CLASSNAME]; // Duel's class name +BOOL gbReliable; // sends are reliable + +/* + * Statics + */ +static BOOL gbReinitialize; // used for switching display modes + +/* + * WinMain + */ +int WINAPI WinMain( HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, + int nCmdShow ) +{ + BOOL bHelp=FALSE; + MSG msg; + + ghinst = hinstance; + + // Parse command line + while( lpCmdLine[0] == '-' ) + { + lpCmdLine++; + + switch (*lpCmdLine++) + { + case 'e': + gbUseEmulation = TRUE; + break; + case 'd': + gbNoField = TRUE; + break; + case '?': + default: + bHelp= TRUE; + gbFullscreen= FALSE; // give help in windowed mode + break; + } + + while( isspace(*lpCmdLine) ) + { + lpCmdLine++; + } + } + + /* + * Give user help if asked for + */ + + if( bHelp ) + { + TCHAR tszHelpMsg[MAX_HELPMSG]; + TCHAR tszTitle[MAX_WINDOWTITLE]; + + LoadString(ghinst, IDS_DUEL_HELP, tszHelpMsg, MAX_HELPMSG); + LoadString(ghinst, IDS_DUEL_TITLE, tszTitle, MAX_WINDOWTITLE); + MessageBox(ghWndMain, tszHelpMsg, tszTitle, MB_OK ); + return TRUE; + } + + + if( !InitApplication(hinstance) ) + { + return FALSE; + } + + // were we launched by a lobby ? + if (LaunchedByLobby()) + { + // start game + PostMessage(ghWndMain, UM_LAUNCH, 0, 0); + gbIsActive = TRUE; + } + + gdwFrameTime = timeGetTime(); + + while( TRUE ) + { + if (gbIsActive) + { + // any windows messages ? (returns immediately) + if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + { + if( !GetMessage( &msg, NULL, 0, 0 ) ) + { + return msg.wParam; + } + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else + { + // Poll our receive queue. Polling is used in the sample only for simplicity. + // Receiving messages using an event is the recommended way. + if (gnProgramState != PS_SPLASH) + { + ReceiveMessages(); + } + + // update screen + if (!UpdateFrame()) + { + ExitGame(); + } + } + } + else + { + // any windows messages ? (blocks until a message arrives) + if( !GetMessage( &msg, NULL, 0, 0 ) ) + { + return msg.wParam; + } + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } +} /* WinMain */ + + +/* + * MainWndproc + * + * Callback for all Windows messages + */ +long WINAPI MainWndproc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + PAINTSTRUCT ps; + HDC hdc; + DWORD dwRetCode; + DWORD dwTid; + + switch( message ) + { + case WM_SIZE: + case WM_MOVE: + // get the client rectangle + if (gbFullscreen) + { + SetRect(&grcWindow, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + } + else + { + GetClientRect(hWnd, &grcWindow); + ClientToScreen(hWnd, (LPPOINT)&grcWindow); + ClientToScreen(hWnd, (LPPOINT)&grcWindow+1); + } + break; + + case WM_ACTIVATE: + // ignore this message during reinitializing graphics + if (gbReinitialize) return 0; + + // When we are deactivated, although we don't update our screen, we still need to + // to empty our receive queue periodically as messages will pile up otherwise. + // Polling the receive queue continuously even when we are deactivated causes our app + // to consume all the CPU time. To avoid hogging the CPU, we block on GetMessage() WIN API + // and setup a timer to wake ourselves up at regular intervals to process our messages. + + if (LOWORD(wParam) == WA_INACTIVE) + { + // deactivated + gbIsActive = FALSE; + if (PS_ACTIVE == gnProgramState) + { + SetTimer(hWnd, RECEIVE_TIMER_ID, RECEIVE_TIMEOUT, NULL); + } + } + else + { + // activated + gbIsActive = TRUE; + if (PS_ACTIVE == gnProgramState) + { + KillTimer(hWnd, RECEIVE_TIMER_ID); + } + } + + // set game palette, if activated in game mode + if (gbIsActive && (gnProgramState != PS_SPLASH)) + SetGamePalette(); + + ReacquireInputDevices(); + + return 0; + + case WM_CREATE: + break; + + case WM_SYSKEYUP: + switch( wParam ) + { + // handle ALT+ENTER (fullscreen/window mode) + case VK_RETURN: + // mode switch is allowed only during the game + if (gnProgramState == PS_ACTIVE) + { + gbReinitialize = TRUE; + ReleaseLocalData(); //only sound buffers have to be rels'd anyway. + CleanupSfx(); + CleanupInput(); + CleanupGraphics(); + DestroyWindow(ghWndMain); + gbFullscreen = !gbFullscreen; + InitGraphics(); + InitInput(); + InitSfx(); + InitLocalSoundData(); + gbReinitialize = FALSE; + } + break; + } + break; + + case WM_KEYDOWN: + switch( wParam ) + { + case 'r': + case 'R': + // toggle reliable status + gbReliable = !gbReliable; + UpdateTitle(); + break; + + case VK_F1: + { + TCHAR tszHelpMsg[MAX_HELPMSG]; + TCHAR tszTitle[MAX_WINDOWTITLE]; + + LoadString(ghinst, IDS_DUEL_HELP, tszHelpMsg, MAX_HELPMSG); + LoadString(ghinst, IDS_DUEL_TITLE, tszTitle, MAX_WINDOWTITLE); + MessageBox(ghWndMain, tszHelpMsg, tszTitle, MB_OK ); + } + break; + + case VK_F5: + gbShowFrameCount = !gbShowFrameCount; + if( gbShowFrameCount ) + { + gdwFrameCount = 0; + gdwFrameTime = timeGetTime(); + } + break; + + case VK_RETURN: + if( (gnProgramState == PS_SPLASH) && !gbFullscreen) + { + // get connection settings from user + ghThread = CreateThread(NULL, 0, (LPVOID)DoWizard, 0, 0, &dwTid); + } + break; + + case VK_ESCAPE: + case VK_F12: + // adios + ExitGame(); + return 0; + } + break; + + case WM_ERASEBKGND: + return 1; + + case WM_PAINT: + hdc = BeginPaint( hWnd, &ps ); + if (gnProgramState == PS_SPLASH) + { + // display the splash screen + bltSplash(NULL); + } + + EndPaint( hWnd, &ps ); + return 1; + + case UM_LAUNCH: + // cleanup the wizard thread + if (ghThread) + { + // wait for thread to exit + while (!GetExitCodeThread(ghThread, &dwRetCode)); + CloseHandle(ghThread); + } + + // start the game in rest mode + gnProgramState = PS_REST; + LaunchGame(); + return 1; + + case UM_ABORT: + // cleanup the wizard thread + if (ghThread) + { + // wait for thread to exit + while (!GetExitCodeThread(ghThread, &dwRetCode)); + CloseHandle(ghThread); + } + ExitGame(); + return 1; + + case WM_TIMER: + ReceiveMessages(); + break; + + case WM_DESTROY: + // if gbReinitialize is TRUE don't quit, we are just switching display modes + if (!gbReinitialize) + { + CleanupApplication(); + PostQuitMessage( 0 ); + } + return 0; + + default: + break; + } + return DefWindowProc(hWnd, message, wParam, lParam); + +} /* MainWndproc */ + +/* + * InitApplication + * + * Do that initialization stuff... + */ +BOOL InitApplication( HINSTANCE hinst ) +{ + WNDCLASS wc; + BOOL rc; + + glpGuid = (LPGUID) &DUEL_GUID; + + LoadString(ghinst, IDS_DUEL_CLASSNAME, gtszClassName, MAX_CLASSNAME); + + wc.style = CS_DBLCLKS; + wc.lpfnWndProc = MainWndproc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hinst; + wc.hIcon = LoadIcon( hinst, MAKEINTRESOURCE(DUEL_ICON)); + wc.hCursor = LoadCursor( NULL, IDC_ARROW ); + wc.hbrBackground = GetStockObject( BLACK_BRUSH ); + wc.lpszMenuName = NULL; + wc.lpszClassName = gtszClassName; + rc = RegisterClass( &wc ); + if( !rc ) + { + return FALSE; + } + + // Initialize all components + if ((!InitGraphics()) || (!InitInput()) || (!InitSfx())) + { + return FALSE; + } + + // start in splash mode + gnProgramState = PS_SPLASH; + + return TRUE; + +} /* initApplication */ + +/* + * CleanupApplication + * + * Calls clean up on all components + */ +void CleanupApplication( void ) +{ + CleanupComm(); + CleanupSfx(); + CleanupGraphics(); + CleanupInput(); +} + +/* + * LaunchedByLobby + * + * Determines if we were launched by a lobby. If so, gets the connection settings + * and creates our player using the information from the lobby + */ +BOOL LaunchedByLobby(void) +{ + HRESULT hr; + HWND hwndStatus; + + // create a lobby object + hr = DPLobbyCreate(); + if (FAILED(hr)) + { + ShowError(IDS_DPLOBBY_ERROR_C); + return FALSE; + } + + // get connection settings from the lobby (into glpdplConnection) + hr = DPLobbyGetConnectionSettings(); + if (FAILED(hr)) + { + if (DPERR_NOTLOBBIED == hr) + { + // we were not lobbied - start up game normally + hr = DPLobbyRelease(); + if (FAILED(hr)) + { + ShowError(IDS_DPLOBBY_ERROR_R); + goto FAIL; + } + // move on + return FALSE; + } + else + { + ShowError(IDS_DPLOBBY_ERROR_GCS); + goto FAIL; + } + } + + // are we hosting or joining ? + if (glpdplConnection->dwFlags & DPLCONNECTION_CREATESESSION) + { + gbIsHost = TRUE; + } + + // set our session flags + glpdplConnection->lpSessionDesc->dwFlags = DPSESSION_MIGRATEHOST | + DPSESSION_KEEPALIVE; + + // let lobby know our connection flags + hr = DPLobbySetConnectionSettings(); + if (FAILED(hr)) + { + ShowError(IDS_DPLOBBY_ERROR_SCS); + goto FAIL; + } + + if ( !gbIsHost ) + { + // show splash screen and + // connection status if we are joining a game + UpdateWindow(ghWndMain); + hwndStatus = ShowConnectStatus(); + } + else + { + // we are hosting, don't need connection status + hwndStatus = NULL; + } + + // connect to the lobby + hr = DPLobbyConnect(); + + if ( hwndStatus ) + { + // get rid of the connectino status window + DestroyWindow(hwndStatus); + } + + if (FAILED(hr)) + { + ShowError(IDS_DPLOBBY_ERROR_CONNECT); + goto FAIL; + } + + // create our player + hr = DPlayCreatePlayer( + &gOurID, +#ifdef UNICODE + glpdplConnection->lpPlayerName->lpszShortName, +#else + glpdplConnection->lpPlayerName->lpszShortNameA, +#endif + NULL, + NULL, + 0 + ); + + if (FAILED(hr)) + { + ShowError(IDS_DPLAY_ERROR_CP); + goto FAIL; + } + + + // cleanup + hr = DPLobbyRelease(); + if (FAILED(hr)) + { + ShowError(IDS_DPLOBBY_ERROR_R); + goto FAIL; + } + + // we were lobbied + return TRUE; + +FAIL: + // cleanup and exit + DPLobbyRelease(); + ExitGame(); + return FALSE; +} + +/* + * Displays error to the user + */ +BOOL ShowError( int iStrID ) +{ + TCHAR tszMsg[MAX_ERRORMSG]; + TCHAR tszTitle[MAX_WINDOWTITLE]; + + LoadString(ghinst, iStrID, tszMsg, MAX_ERRORMSG); + LoadString(ghinst, IDS_DUEL_ERROR_TITLE, tszTitle, MAX_WINDOWTITLE); + MessageBox( ghWndMain, tszMsg, tszTitle, MB_OK ); + return FALSE; +} + +/* + * Displays connection status to the user + */ +HWND ShowConnectStatus(void) +{ + HWND hwnd; + + hwnd = CreateDialog( ghinst, MAKEINTRESOURCE(IDD_CONNECT_STATUS), ghWndMain, NULL); + + return hwnd; + +} + +/* + * UpdateTitle + * + * Updates the window title based on application status + */ +void UpdateTitle(void) +{ + DWORD dwFeatures; + TCHAR tszTitle[MAX_WINDOWTITLE]; + UINT iStringID; + + // calculate title features + dwFeatures = 0; + if (gbReliable) + dwFeatures |= 1; + if (gbIsHost) + dwFeatures |= 2; + + switch (dwFeatures) + { + case 0: + iStringID = IDS_DUEL_TITLE; + break; + case 1: + iStringID = IDS_DUEL_RELIABLE_TITLE; + break; + case 2: + iStringID = IDS_DUEL_HOST_TITLE; + break; + case 3: + iStringID = IDS_DUEL_HOST_RELIABLE_TITLE; + break; + } + + // get appropriate window title for these features + LoadString(ghinst, iStringID, tszTitle, MAX_WINDOWTITLE); + // change window title + SetWindowText(ghWndMain, tszTitle); +} + + diff --git a/sdk/samples/duel/duel.h b/sdk/samples/duel/duel.h new file mode 100644 index 0000000..08f6532 --- /dev/null +++ b/sdk/samples/duel/duel.h @@ -0,0 +1,82 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: duel.h + * Content: main include file + * + * + ***************************************************************************/ + +#ifndef DUEL_INCLUDED +#define DUEL_INCLUDED + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include "resource.h" +#include <tchar.h> + +/* + * Application messages + */ + +#define UM_LAUNCH WM_USER +#define UM_ABORT WM_USER+1 +#define UM_RESTARTTIMER WM_USER+2 + +// program states +enum +{ + PS_SPLASH, + PS_ACTIVE, + PS_REST +}; + +#define MAX_SCREEN_X 639 +#define MAX_SCREEN_Y 479 +#define MAX_PLAYERNAME 50 +#define MAX_SESSIONNAME 50 +#define MAX_SPNAME 50 +#define MAX_CLASSNAME 50 +#define MAX_WINDOWTITLE 50 +#define MAX_ERRORMSG 256 +#define MAX_FONTNAME 50 +#define MAX_HELPMSG 512 + +#define RECEIVE_TIMER_ID 1 +#define RECEIVE_TIMEOUT 1000 // in milliseconds + +// default window size +#define MAX_DEFWIN_X 640 +#define MAX_DEFWIN_Y 480 + + +// tree view image info +#define CX_BITMAP 25 +#define CY_BITMAP 25 +#define NUM_BITMAPS 2 + +// registry info +#define DUEL_KEY (TEXT("Software\\Microsoft\\Duel")) + +// macros +#define DEBUG_OUT(s) OutputDebugString(s); + +/* + * fn prototypes + */ + +int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, + int nCmdShow ); +long WINAPI MainWndproc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +BOOL InitApplication(HINSTANCE hinst); +void CleanupApplication(void); +BOOL LaunchedByLobby(void); +BOOL ShowError( int err ); +HWND ShowConnectStatus(void); +void UpdateTitle(void); + +#endif + diff --git a/sdk/samples/duel/duel.ico b/sdk/samples/duel/duel.ico new file mode 100644 index 0000000..4f91acb Binary files /dev/null and b/sdk/samples/duel/duel.ico differ diff --git a/sdk/samples/duel/duel.mak b/sdk/samples/duel/duel.mak new file mode 100644 index 0000000..0f1f7bd --- /dev/null +++ b/sdk/samples/duel/duel.mak @@ -0,0 +1,474 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=duel - Win32 Debug +!MESSAGE No configuration specified. Defaulting to duel - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "duel - Win32 Release" && "$(CFG)" != "duel - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "duel.mak" CFG="duel - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "duel - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "duel - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "duel - Win32 Debug" +CPP=cl.exe +RSC=rc.exe +MTL=mktyplib.exe + +!IF "$(CFG)" == "duel - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\duel.exe" + +CLEAN : + -@erase "$(INTDIR)\comm.obj" + -@erase "$(INTDIR)\ddutil.obj" + -@erase "$(INTDIR)\Ds3dutil.obj" + -@erase "$(INTDIR)\duel.obj" + -@erase "$(INTDIR)\duel.res" + -@erase "$(INTDIR)\gameproc.obj" + -@erase "$(INTDIR)\gfx.obj" + -@erase "$(INTDIR)\input.obj" + -@erase "$(INTDIR)\lobby.obj" + -@erase "$(INTDIR)\Sfx.obj" + -@erase "$(INTDIR)\util.obj" + -@erase "$(INTDIR)\wizard.obj" + -@erase "$(OUTDIR)\duel.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\ + /Fp"$(INTDIR)/duel.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/duel.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/duel.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib winmm.lib dplayx.lib ddraw.lib dinput.lib dsound.lib /nologo /subsystem:windows /machine:I386 +# SUBTRACT LINK32 /nodefaultlib +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib\ + shell32.lib uuid.lib comctl32.lib winmm.lib dplayx.lib ddraw.lib dinput.lib\ + dsound.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)/duel.pdb"\ + /machine:I386 /out:"$(OUTDIR)/duel.exe" +LINK32_OBJS= \ + "$(INTDIR)\comm.obj" \ + "$(INTDIR)\ddutil.obj" \ + "$(INTDIR)\Ds3dutil.obj" \ + "$(INTDIR)\duel.obj" \ + "$(INTDIR)\duel.res" \ + "$(INTDIR)\gameproc.obj" \ + "$(INTDIR)\gfx.obj" \ + "$(INTDIR)\input.obj" \ + "$(INTDIR)\lobby.obj" \ + "$(INTDIR)\Sfx.obj" \ + "$(INTDIR)\util.obj" \ + "$(INTDIR)\wizard.obj" + +"$(OUTDIR)\duel.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "duel - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\duel.exe" + +CLEAN : + -@erase "$(INTDIR)\comm.obj" + -@erase "$(INTDIR)\ddutil.obj" + -@erase "$(INTDIR)\Ds3dutil.obj" + -@erase "$(INTDIR)\duel.obj" + -@erase "$(INTDIR)\duel.res" + -@erase "$(INTDIR)\gameproc.obj" + -@erase "$(INTDIR)\gfx.obj" + -@erase "$(INTDIR)\input.obj" + -@erase "$(INTDIR)\lobby.obj" + -@erase "$(INTDIR)\Sfx.obj" + -@erase "$(INTDIR)\util.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(INTDIR)\wizard.obj" + -@erase "$(OUTDIR)\duel.exe" + -@erase "$(OUTDIR)\duel.ilk" + -@erase "$(OUTDIR)\duel.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ + /Fp"$(INTDIR)/duel.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/duel.res" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/duel.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib winmm.lib dplayx.lib ddraw.lib dinput.lib dsound.lib /nologo /subsystem:windows /debug /machine:I386 +# SUBTRACT LINK32 /nodefaultlib +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib\ + shell32.lib uuid.lib comctl32.lib winmm.lib dplayx.lib ddraw.lib dinput.lib\ + dsound.lib /nologo /subsystem:windows /incremental:yes\ + /pdb:"$(OUTDIR)/duel.pdb" /debug /machine:I386 /out:"$(OUTDIR)/duel.exe" +LINK32_OBJS= \ + "$(INTDIR)\comm.obj" \ + "$(INTDIR)\ddutil.obj" \ + "$(INTDIR)\Ds3dutil.obj" \ + "$(INTDIR)\duel.obj" \ + "$(INTDIR)\duel.res" \ + "$(INTDIR)\gameproc.obj" \ + "$(INTDIR)\gfx.obj" \ + "$(INTDIR)\input.obj" \ + "$(INTDIR)\lobby.obj" \ + "$(INTDIR)\Sfx.obj" \ + "$(INTDIR)\util.obj" \ + "$(INTDIR)\wizard.obj" + +"$(OUTDIR)\duel.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "duel - Win32 Release" +# Name "duel - Win32 Debug" + +!IF "$(CFG)" == "duel - Win32 Release" + +!ELSEIF "$(CFG)" == "duel - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\duel.c +DEP_CPP_DUEL_=\ + ".\comm.h"\ + ".\ds3dutil.h"\ + ".\duel.h"\ + ".\gameproc.h"\ + ".\gfx.h"\ + ".\input.h"\ + ".\lobby.h"\ + ".\sfx.h"\ + ".\util.h"\ + ".\wizard.h"\ + {$(INCLUDE)}"\d3dtypes.h"\ + {$(INCLUDE)}"\ddraw.h"\ + {$(INCLUDE)}"\Dinput.h"\ + {$(INCLUDE)}"\dplay.h"\ + {$(INCLUDE)}"\dplobby.h"\ + {$(INCLUDE)}"\dsound.h"\ + +NODEP_CPP_DUEL_=\ + "..\..\debug\inc\subwtype.h"\ + + +"$(INTDIR)\duel.obj" : $(SOURCE) $(DEP_CPP_DUEL_) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\duel.rc +DEP_RSC_DUEL_R=\ + ".\csession.bmp"\ + ".\DUEL.BMP"\ + ".\duel.ico"\ + ".\osession.bmp"\ + ".\player.bmp"\ + ".\SPLASH.BMP"\ + + +"$(INTDIR)\duel.res" : $(SOURCE) $(DEP_RSC_DUEL_R) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\wizard.c +DEP_CPP_WIZAR=\ + ".\comm.h"\ + ".\ds3dutil.h"\ + ".\duel.h"\ + ".\gameproc.h"\ + ".\sfx.h"\ + ".\util.h"\ + ".\wizard.h"\ + {$(INCLUDE)}"\d3dtypes.h"\ + {$(INCLUDE)}"\ddraw.h"\ + {$(INCLUDE)}"\dplay.h"\ + {$(INCLUDE)}"\dsound.h"\ + +NODEP_CPP_WIZAR=\ + "..\..\debug\inc\subwtype.h"\ + + +"$(INTDIR)\wizard.obj" : $(SOURCE) $(DEP_CPP_WIZAR) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\gameproc.c +DEP_CPP_GAMEP=\ + ".\comm.h"\ + ".\ds3dutil.h"\ + ".\duel.h"\ + ".\gameproc.h"\ + ".\gfx.h"\ + ".\input.h"\ + ".\lobby.h"\ + ".\sfx.h"\ + ".\util.h"\ + ".\wizard.h"\ + {$(INCLUDE)}"\d3dtypes.h"\ + {$(INCLUDE)}"\ddraw.h"\ + {$(INCLUDE)}"\Dinput.h"\ + {$(INCLUDE)}"\dplay.h"\ + {$(INCLUDE)}"\dplobby.h"\ + {$(INCLUDE)}"\dsound.h"\ + +NODEP_CPP_GAMEP=\ + "..\..\debug\inc\subwtype.h"\ + + +"$(INTDIR)\gameproc.obj" : $(SOURCE) $(DEP_CPP_GAMEP) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\gfx.c +DEP_CPP_GFX_C=\ + ".\ddutil.h"\ + ".\duel.h"\ + ".\gfx.h"\ + ".\input.h"\ + {$(INCLUDE)}"\ddraw.h"\ + {$(INCLUDE)}"\Dinput.h"\ + + +"$(INTDIR)\gfx.obj" : $(SOURCE) $(DEP_CPP_GFX_C) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\util.c +DEP_CPP_UTIL_=\ + ".\util.h"\ + + +"$(INTDIR)\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\comm.c +DEP_CPP_COMM_=\ + ".\comm.h"\ + ".\duel.h"\ + ".\lobby.h"\ + {$(INCLUDE)}"\dplay.h"\ + {$(INCLUDE)}"\dplobby.h"\ + + +"$(INTDIR)\comm.obj" : $(SOURCE) $(DEP_CPP_COMM_) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ddutil.cpp +DEP_CPP_DDUTI=\ + ".\ddutil.h"\ + {$(INCLUDE)}"\ddraw.h"\ + + +"$(INTDIR)\ddutil.obj" : $(SOURCE) $(DEP_CPP_DDUTI) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\input.c +DEP_CPP_INPUT=\ + ".\ds3dutil.h"\ + ".\duel.h"\ + ".\gameproc.h"\ + ".\input.h"\ + ".\sfx.h"\ + {$(INCLUDE)}"\d3dtypes.h"\ + {$(INCLUDE)}"\ddraw.h"\ + {$(INCLUDE)}"\Dinput.h"\ + {$(INCLUDE)}"\dplay.h"\ + {$(INCLUDE)}"\dsound.h"\ + +NODEP_CPP_INPUT=\ + "..\..\debug\inc\subwtype.h"\ + + +"$(INTDIR)\input.obj" : $(SOURCE) $(DEP_CPP_INPUT) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\lobby.c +DEP_CPP_LOBBY=\ + ".\duel.h"\ + ".\lobby.h"\ + {$(INCLUDE)}"\dplay.h"\ + {$(INCLUDE)}"\dplobby.h"\ + + +"$(INTDIR)\lobby.obj" : $(SOURCE) $(DEP_CPP_LOBBY) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\Sfx.c +DEP_CPP_SFX_C=\ + ".\ds3dutil.h"\ + ".\duel.h"\ + ".\sfx.h"\ + {$(INCLUDE)}"\d3dtypes.h"\ + {$(INCLUDE)}"\ddraw.h"\ + {$(INCLUDE)}"\dsound.h"\ + +NODEP_CPP_SFX_C=\ + "..\..\debug\inc\subwtype.h"\ + + +"$(INTDIR)\Sfx.obj" : $(SOURCE) $(DEP_CPP_SFX_C) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\Ds3dutil.c +DEP_CPP_DS3DU=\ + ".\ds3dutil.h"\ + {$(INCLUDE)}"\d3dtypes.h"\ + {$(INCLUDE)}"\ddraw.h"\ + {$(INCLUDE)}"\dsound.h"\ + +NODEP_CPP_DS3DU=\ + "..\..\debug\inc\subwtype.h"\ + + +"$(INTDIR)\Ds3dutil.obj" : $(SOURCE) $(DEP_CPP_DS3DU) "$(INTDIR)" + + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/sdk/samples/duel/duel.rc b/sdk/samples/duel/duel.rc new file mode 100644 index 0000000..1c628f4 --- /dev/null +++ b/sdk/samples/duel/duel.rc @@ -0,0 +1,267 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_JOINSESSION DIALOG DISCARDABLE 0, 0, 272, 183 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Select Session" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Please select a session:",IDC_JOIN_SESSION_TITLE,49,16, + 152,11 + EDITTEXT IDC_JOIN_PLAYERNAME,49,151,169,14,ES_AUTOHSCROLL + LTEXT "Player Name",IDC_JOIN_PLAYER_TITLE,50,139,91,10 + CONTROL "Tree1",IDC_JOIN_SESSION,"SysTreeView32",TVS_HASBUTTONS | + TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | + TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,49,29,167,102 + GROUPBOX "",IDC_STATIC,4,6,266,167 +END + +IDD_HOSTSESSION DIALOG DISCARDABLE 0, 0, 272, 183 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Host Session" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Session Name",IDC_HOST_SESSION_TITLE,47,47,69,11 + LTEXT "Player Name",IDC_HOST_PLAYER_TITLE,48,104,76,12 + EDITTEXT IDC_HOST_SESSIONNAME,47,60,152,13,ES_AUTOHSCROLL + EDITTEXT IDC_HOST_PLAYERNAME,47,119,152,13,ES_AUTOHSCROLL + LTEXT "Please provide information to host game:", + IDC_HOST_TITLE,13,18,227,12 + GROUPBOX "",IDC_STATIC,1,4,266,163 +END + +IDD_GAMESETUP DIALOG DISCARDABLE 0, 0, 273, 175 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Create Game or Connect to Game?" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Host a new game",IDC_HOSTSESSION,"Button", + BS_AUTORADIOBUTTON,92,61,111,12 + CONTROL "Join a game in progress",IDC_JOINSESSION,"Button", + BS_AUTORADIOBUTTON,92,105,132,12 + LTEXT "Would you like to:",IDC_GAMESETUP_TITLE,31,34,117,12 + LTEXT "or",IDC_STATIC,92,84,26,8 + GROUPBOX "",IDC_STATIC,4,7,265,164 +END + +IDD_CHOOSEPROVIDER DIALOG DISCARDABLE 0, 0, 273, 183 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Choose Connection Mechanism" +FONT 8, "MS Sans Serif" +BEGIN + LISTBOX IDC_SERVICEPROVIDERS,43,50,192,98,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LTEXT "Please select a communication channel:",IDC_SP_TITLE,17, + 25,230,13 + GROUPBOX "",IDC_STATIC,5,6,266,164 +END + +IDD_CONNECT_STATUS DIALOG DISCARDABLE 120, 110, 162, 31 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Duel Connection Status" +FONT 8, "MS Sans Serif" +BEGIN + CTEXT "Finding game...",IDC_DUEL_STATUSTEXT,7,7,141,16 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +SPLASH BITMAP MOVEABLE PURE "SPLASH.BMP" +DUEL8 BITMAP MOVEABLE PURE "DUEL.BMP" +IDB_OPEN_SESSION BITMAP DISCARDABLE "osession.bmp" +IDB_CLOSED_SESSION BITMAP DISCARDABLE "csession.bmp" +IDB_PLAYER BITMAP DISCARDABLE "player.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +DUEL_ICON ICON DISCARDABLE "duel.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// WAVE +// + +SBOUNCE WAVE DISCARDABLE "Sbounce.wav" +LBOOM WAVE DISCARDABLE "Lboom.wav" +SBOOM WAVE DISCARDABLE "Sboom.wav" +BFIRE WAVE DISCARDABLE "Bfire.wav" +SENGINE WAVE DISCARDABLE "Sengine.wav" +SSTART WAVE DISCARDABLE "Sstart.wav" +SSTOP WAVE DISCARDABLE "Sstop.wav" + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_CONNECT_STATUS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 148 + TOPMARGIN, 7 + BOTTOMMARGIN, 24 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_DDRAW_ERROR_DDC "DirectDraw create failed" + IDS_DDRAW_ERROR_SCL "SetCooperativeLevel failed" + IDS_DDRAW_ERROR_SDM "SetDisplayMode failed" + IDS_DDRAW_ERROR_CSFB "Front buffer creation failed" + IDS_DDRAW_ERROR_GAS "Backbuffer couldn't be obtained" + IDS_DDRAW_ERROR_CC "CreateClipper failed" + IDS_DDRAW_ERROR_SH "Clipper SetHwnd failed" + IDS_DDRAW_ERROR_SC "Clipper object couldn't be attached to the front buffer" + IDS_DDRAW_ERROR_CSS0 "Ship surface 0 creation failed" + IDS_DDRAW_ERROR_CSS1 "Ship surface 1 creation failed" + IDS_DDRAW_ERROR_CSS2 "Ship surface 2 creation failed" + IDS_DDRAW_ERROR_CSS3 "Ship surface 3 creation failed" + IDS_DDRAW_ERROR_CSN "Number surface creation failed" + IDS_DDRAW_ERROR_RS "Surfaces couldn't be restored" + IDS_DINPUT_ERROR_DIC "DirectInputCreate failed" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_DINPUT_ERROR_ED "Enum keyboard devices failed" + IDS_DINPUT_ERROR_CD "Create keyboard device failed" + IDS_DINPUT_ERROR_SP "Set non-exclusive mode failed" + IDS_DINPUT_ERROR_A "Keyboard acquire failed" + IDS_DPLAY_ERROR_CP "Player create failed" + IDS_DPLAY_ERROR_JS "Session join failed" + IDS_DPLAY_ERROR_CS "Session create failed" + IDS_DDRAW_ERROR_CSBB "Back buffer create failed" + IDS_DUEL_CLASSNAME "DuelClass" + IDS_DUEL_MSG_UNKNOWN "Unknown message" + IDS_DUEL_ERROR_TITLE "Duel Message" + IDS_DUEL_TITLE "Duel" + IDS_WIZARD_FONTNAME "Times" + IDS_WIZARD_TITLE_SP "Communications Channel (1/3)" + IDS_WIZARD_TITLE_GS "Game Setup (2/3)" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WIZARD_TITLE_JS "Join Session (3/3)" + IDS_WIZARD_TITLE_HS "Host Session (3/3)" + IDS_WIZARD_TITLE "Duel Setup" + IDS_DUEL_HELP "Spacebar\t\t- Fire\nRight Arrow\t- Rotate right\nLeft Arrow\t- Rotate left\nUp Arrow\t\t- Forward\nDown Arrow\t- Backward\nNumPad 5\t- Stop\nR\t\t- Reliable Messaging\nF1\t\t- Help\nF5\t\t- FPS\nESC or F12\t- Quit\n\nCommand line parameters\n\n-e Use emulator\n\n" + IDS_DDUTIL_ERROR_LI "LoadImage failed. Handle is NULL." + IDS_DDUTIL_ERROR_DDCB "DDCopyBitmap failed" + IDS_DDUTIL_ERROR_CCDC "CreateCompatibleDC failed" + IDS_WIZARD_ERROR_GSG "Session guid couldn't be obtained from the parent item" + IDS_DINPUT_ERROR_DF "Set keyboard data format failed" + IDS_DPLAY_ERROR_IDC "DirectPlay object create failed" + IDS_DSOUND_LOADWAVES "Could not load WAVE resource." + IDS_DSOUND_DUPBUF "Could not duplicate a sound buffer for new ship" + IDS_DPLAY_ERROR_SL "You have been disconnected from the session" + IDS_DPLAY_ERROR_GPLD "Get player local data failed" + IDS_DPLAY_ERROR_SPLD "Set player local data failed" + IDS_DPLAY_ERROR_GPRD "Get player remote data failed" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_DPLAY_ERROR_SPRD "Set player remote data failed" + IDS_DPLAY_ERROR_GSD "Get session description failed" + IDS_DPLAY_ERROR_EP "Enumerate players failed" + IDS_DPLAY_ERROR_ES "Enumerate sessions failed" + IDS_DPLAY_ERROR_C "DirectPlay Close failed" + IDS_DPLAY_ERROR_R "DirectPlay Release failed" + IDS_DPLAY_ERROR_DP "Destroy player failed" + IDS_DPLOBBY_ERROR_R "DirectPlayLobby Release failed" + IDS_DPLOBBY_ERROR_GCS "DirectPlayLobby GetConnectionSettings failed" + IDS_DPLOBBY_ERROR_SCS "DirectPlayLobby SetConnectionSettings failed" + IDS_DPLOBBY_ERROR_C "DirectPlayLobby Create failed" + IDS_DPLOBBY_ERROR_CONNECT "DirectPlayLobby Connect failed" + IDS_DUEL_HOST_TITLE "Duel (Host)" + IDS_DUEL_HOST_RELIABLE_TITLE "Duel (Host, Reliable)" + IDS_DUEL_RELIABLE_TITLE "Duel (Reliable)" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sdk/samples/duel/gameproc.c b/sdk/samples/duel/gameproc.c new file mode 100644 index 0000000..c253b34 --- /dev/null +++ b/sdk/samples/duel/gameproc.c @@ -0,0 +1,1985 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: gameproc.c + * Content: Game processing code + * + * + ***************************************************************************/ +#include "gameproc.h" +#include "util.h" +#include "gfx.h" +#include "comm.h" +#include "input.h" +#include "lobby.h" +#include "wizard.h" +#include "dsound.h" +#include "sfx.h" +#include "stdio.h" + +/* + * Externals + */ +extern DWORD gdwKeys; +extern LPDIRECTDRAWSURFACE glpShip0; +extern LPDIRECTDRAWSURFACE glpShip1; +extern LPDIRECTDRAWSURFACE glpShip2; +extern LPDIRECTDRAWSURFACE glpShip3; +extern BOOL gbShowFrameCount; +extern LPDIRECTDRAWSURFACE glpNum; +extern BOOL gbIsHost; +extern BOOL gbIsActive; +extern LPDPSESSIONDESC2 glpdpSD; +extern HWND ghWndMain; +extern HINSTANCE ghinst; +extern BOOL gbReliable; + +/* + * Globals + */ +FRAG gFrags[64]; // ship framents +BLOCKS gBlocks; // field layout +LPVOID glpvReceiveBuffer = NULL; // buffer to store received messages +DWORD gdwReceiveBufferSize = 0; // size of buffer +DPID gOurID; // our player id +BOOL gbHaveHostInit; // do we need to do host initializaton +int gnProgramState; // current state of the game +DWORD gdwFrameCount; // used for fps calc +DWORD gdwFramesLast; // .. +DWORD gdwFrameTime; // .. +BOOL gbUpdate; // TRUE if player data needs to be updated +BOOL gbNoField; // display blocks ? +BOOL gbSessionLost; // did we get disconnected ? +HOSTMSG gHostMsg; // message buffer +BLOCKHITMSG gBlockHitMsg; // .. +SHIPHITMSG gShipHitMsg; // .. +ADDBLOCKMSG gAddBlockMsg; // .. +CONTROLMSG gControlMsg; // .. +SYNCMSG gSyncMsg; // .. +TCHAR gDebugBuff[MAX_ERRORMSG]; // buffer for debug output + +/* + * Statics + */ + +static double gDirx[40] = +{ + 0.000000, + 0.156434, + 0.309017, + 0.453991, + 0.587785, + 0.707107, + 0.809017, + 0.891007, + 0.951057, + 0.987688, + 1.000000, + 0.987688, + 0.951057, + 0.891007, + 0.809017, + 0.707107, + 0.587785, + 0.453990, + 0.309017, + 0.156434, + 0.000000, + -0.156435, + -0.309017, + -0.453991, + -0.587785, + -0.707107, + -0.809017, + -0.891007, + -0.951057, + -0.987688, + -1.000000, + -0.987688, + -0.951056, + -0.891006, + -0.809017, + -0.707107, + -0.587785, + -0.453990, + -0.309017, + -0.156434 +}; + +static double gDiry[40] = +{ + -1.000000, + -0.987688, + -0.951057, + -0.891007, + -0.809017, + -0.707107, + -0.587785, + -0.453990, + -0.309017, + -0.156434, + 0.000000, + 0.156434, + 0.309017, + 0.453991, + 0.587785, + 0.707107, + 0.809017, + 0.891007, + 0.951057, + 0.987688, + 1.000000, + 0.987688, + 0.951057, + 0.891006, + 0.809017, + 0.707107, + 0.587785, + 0.453990, + 0.309017, + 0.156434, + 0.000000, + -0.156435, + -0.309017, + -0.453991, + -0.587785, + -0.707107, + -0.809017, + -0.891007, + -0.951057, + -0.987688 +}; + +/* + * InitMessageBuffers + * + * Sets up buffes used for sending different types of messages + */ +void InitMessageBuffers(void) +{ + gHostMsg.byType = MSG_HOST; + gBlockHitMsg.byType = MSG_BLOCKHIT; + gShipHitMsg.byType = MSG_SHIPHIT; + gAddBlockMsg.byType = MSG_ADDBLOCK; + gControlMsg.byType = MSG_CONTROL; + gSyncMsg.byType = MSG_SYNC; +} + +/* + * LaunchGame + * + * Sets up the game layout and launches + */ +void LaunchGame(void) +{ + HRESULT hr; + + // initialize global message buffers + InitMessageBuffers(); + + // update window title + UpdateTitle(); + + // get current session description (glpdpSD is initialized in here) + hr = DPlayGetSessionDesc(); + if (FAILED(hr) || (!glpdpSD)) + { + ShowError(IDS_DPLAY_ERROR_GSD); + goto ABORT; + } + + // initialize random number seed + srand((int)GetTickCount()); + + // clear front buffer before changing palette + EraseScreen(); + FlipScreen(); + + // initialize us + hr = InitOurShip(); + if (FAILED(hr)) + { + goto ABORT; + } + + // get the field layout + if( gbIsHost ) + { + // initialize field (done only by host) + if (!gbNoField) + InitField(); + + // we have host initialization + gbHaveHostInit = TRUE; + + // start updating screen + gbIsActive = TRUE; + } + else + { + // get it from host, if we are joining + gbHaveHostInit = FALSE; + } + + // success + return; + +ABORT: + // something went wrong, terminate game + ExitGame(); +} + +/* + * ExitGame + * + * Game termination code + */ +void ExitGame(void) +{ + // shut down app + PostMessage( ghWndMain, WM_CLOSE, 0, 0 ); +} + +/* + * InitOurShip + * + * Initializes our ship's initial attributes + */ +HRESULT InitOurShip(void) +{ + int i; + SHIP ship; + HRESULT hr; + + // wipe out everything + ZeroMemory(&ship, sizeof(ship)); + + // initialize sound buffers + InitPlayerLocalSoundData(&ship); + + // calculate ship type based on the number of players in the game + // we cycle through four ships (Y,R,G,B) for now. + + ship.byType = (BYTE) ((glpdpSD->dwCurrentPlayers-1) % NUM_SHIP_TYPES); + ship.dPosX = randInt(0,MAX_SHIP_X); + ship.dPosY = randInt(0,MAX_SHIP_Y); + ship.cFrame = randInt(0, MAX_SHIP_FRAME); + ship.bEnable = TRUE; + + // set our local data + hr = DPlaySetPlayerData(gOurID, &ship, sizeof(ship), DPSET_LOCAL); + if (FAILED(hr)) + { + ShowError(IDS_DPLAY_ERROR_SPLD); + goto FAIL; + } + + // no ship fragments + for(i=0; i<64; i++) + gFrags[i].valid = FALSE; + + // success + return DP_OK; + +FAIL: + // failed + return hr; +} + +/* + *FUNCTION: InitPlayerLocalSoundData + * + * + *NOTES: Takes a ship and initializes ONLY its soundbuffers and sound flags. + * It leaves everything else alone. Good for when going to + * full-screen mode, when we need to get rid of the sound buffers + * for a bit, but don't want to change the data. + */ +void InitPlayerLocalSoundData(LPSHIP lpShip) +{ +int i; + if (gbSoundInitialized) + { + for (i=0; i<MAX_SOUNDS; i++) + { + if (FALSE == WaveGetBuffers(gSoundEffect[i],&lpShip->lpDirectSoundBuffer[i], &lpShip->lpDirectSound3DBuffer[i])) + {//if it didn't work, get rid of all the other sound buffers + ShowError(IDS_DSOUND_DUPBUF); + for (--i; i>=0; i--) + { + IDirectSoundBuffer_Release(lpShip->lpDirectSoundBuffer [i]); + IDirectSoundBuffer_Release(lpShip->lpDirectSound3DBuffer[i]); + lpShip->lpDirectSoundBuffer [i] = NULL; + lpShip->lpDirectSound3DBuffer[i] = NULL; + } + return; + } + } + + lpShip->bFiring = FALSE; + lpShip->bBounced = FALSE; + lpShip->bDeath = FALSE; + lpShip->bBlockHit = FALSE; + lpShip->bEngineRunning = FALSE; + lpShip->bMoving = FALSE; + } + else + { + //if sound initialization has already failed in InitSfx(), then we want the ships' + //sound buffers to be NULL so that we don't try to release them later. + for (i=0; i<MAX_SOUNDS; i++) + { + lpShip->lpDirectSoundBuffer [i] = NULL; + lpShip->lpDirectSound3DBuffer[i] = NULL; + } + } +}; + +/* + *FUNCTION: SetPlayerLocalSoundDataCB (CALLBACK) + * + *PURPOSE: Initializes and registers a player's local SOUND data ONLY. + */ +BOOL WINAPI SetPlayerLocalSoundDataCB(DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, + DWORD dwFlags, LPVOID lpContext) +{ + SHIP ship; + DWORD dwSize = sizeof(ship); + HRESULT hr; + + DPlayGetPlayerData(dpId, &ship, &dwSize, DPGET_LOCAL); + + // no player data yet + if (0 == dwSize) + return TRUE; + + InitPlayerLocalSoundData(&ship); + + hr = DPlaySetPlayerData(dpId, &ship, dwSize, DPSET_LOCAL); + return (DP_OK == hr); +}; + +/* + *FUNCTION: InitLocalSoundData + * + *PURPOSE: Initializes and registers all players' sound data ONLY + */ +HRESULT InitLocalSoundData(void) +{ + HRESULT hr; + hr = DPlayEnumPlayers(&(glpdpSD->guidInstance), SetPlayerLocalSoundDataCB, NULL, 0); + return hr; +} + +/* + *FUNCTION: ReleaseLocalSoundData + * + *NOTES: Releases a single ship's local sound buffers. + */ +void ReleasePlayerLocalSoundData(LPSHIP lpShip) +{ +int i; + + if (gbSoundInitialized) + { + for (i=0; i<MAX_SOUNDS; i++) + { + if (lpShip->lpDirectSoundBuffer[i] != NULL) + { + IDirectSoundBuffer_Stop (lpShip->lpDirectSoundBuffer[i]); + IDirectSoundBuffer_Release (lpShip->lpDirectSoundBuffer[i]); + lpShip->lpDirectSoundBuffer[i] = NULL; + } + + if (lpShip->lpDirectSound3DBuffer[i] != NULL) + { + IDirectSound3DBuffer_Release(lpShip->lpDirectSound3DBuffer[i]); + lpShip->lpDirectSound3DBuffer[i] = NULL; + } + } + } +}; + +/* + *FUNCTION: ReleasePlayerLocalData (CALLBACK) + * + *PURPOSE: Retrieves and releases a player's local data from dplay. + */ +BOOL WINAPI ReleasePlayerLocalDataCB(DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, + DWORD dwFlags, LPVOID lpContext) +{ + SHIP ship; + DWORD dwSize = sizeof(SHIP); + HRESULT hr; + + hr = DPlayGetPlayerData(dpId, &ship, &dwSize, DPGET_LOCAL); + if (FAILED(hr)) + { + wsprintf(gDebugBuff, TEXT("Get Player local data failed for id %d\n"), dpId); + DEBUG_OUT(gDebugBuff); + goto FAIL; + } + + // no player data yet + if (0 == dwSize) + return TRUE; + + ReleasePlayerLocalSoundData(&ship); + + hr = DPlaySetPlayerData(dpId, &ship, dwSize, DPSET_LOCAL); + if (FAILED(hr)) + { + ShowError(IDS_DPLAY_ERROR_SPLD); + goto FAIL; + } + + // success + return TRUE; +FAIL: + // we failed + return FALSE; +} + +/* + *FUNCTION: ReleaseLocalData + * + *PURPOSE: Releases local data of ALL players. + */ +void ReleaseLocalData(void) +{ + HRESULT hr; + + if (gnProgramState == PS_ACTIVE) + { + hr = DPlayEnumPlayers(&(glpdpSD->guidInstance), ReleasePlayerLocalDataCB, NULL, 0); + if (FAILED(hr)) + { + ShowError(IDS_DPLAY_ERROR_EP); + } + } +}; + +/* + * ProcessUserInput + * + * Processes any input from the user and updates our ship state + */ +void ProcessUserInput(LPSHIP lpShip) +{ + static dwOldKeys = 0; + + gbUpdate = FALSE; + + // DSOUND: check if the engine was turned off + if (!(gdwKeys & (KEY_DOWN | KEY_UP)) && + (dwOldKeys & (KEY_DOWN | KEY_UP))) + { + gdwKeys |= KEY_ENGINEOFF; + + gControlMsg.byState = (BYTE) gdwKeys; + // let everyone know that we just turned our engine off + SendGameMessage((LPGENERICMSG) &gControlMsg, DPID_ALLPLAYERS); + } + + // update our ship state + UpdateState(lpShip, gdwKeys); + + // remember current keys for next frame + dwOldKeys = gdwKeys; +} + +/* + * UpdateState + * + * Updates the current state of our ship, given user input + */ +void UpdateState(LPSHIP lpShip, DWORD dwControls) +{ + lpShip->dwKeys = dwControls; + + if( dwControls & KEY_LEFT ) + { + gbUpdate = TRUE; + lpShip->cFrame -= 1; + if( lpShip->cFrame < 0 ) + lpShip->cFrame += MAX_SHIP_FRAME; + } + if( dwControls & KEY_RIGHT ) + { + gbUpdate = TRUE; + lpShip->cFrame += 1; + if( lpShip->cFrame >= MAX_SHIP_FRAME ) + lpShip->cFrame -= MAX_SHIP_FRAME; + } + if( dwControls & KEY_UP ) + { + gbUpdate = TRUE; + lpShip->dVelX += gDirx[lpShip->cFrame] * 10.0 / 1000.0; + lpShip->dVelY += gDiry[lpShip->cFrame] * 10.0 / 1000.0; + } + if( dwControls & KEY_DOWN ) + { + gbUpdate = TRUE; + lpShip->dVelX -= gDirx[lpShip->cFrame] * 10.0 / 1000.0; + lpShip->dVelY -= gDiry[lpShip->cFrame] * 10.0 / 1000.0; + } + if( dwControls & KEY_STOP ) + { + gbUpdate = TRUE; + lpShip->dVelX = 0.0; + lpShip->dVelY = 0.0; + } + if( !lpShip->bBulletEnable && lpShip->bEnable ) + { + if( dwControls & KEY_FIRE ) + { + gbUpdate = TRUE; + // launch a new bullet + lpShip->dBulletPosX = (WORD) (gDirx[lpShip->cFrame]*6.0 + 16.0 + lpShip->dPosX); + lpShip->dBulletPosY = (WORD) (gDiry[lpShip->cFrame]*6.0 + 16.0 + lpShip->dPosY); + lpShip->dBulletVelX = gDirx[lpShip->cFrame]*500.0/1000.0; + lpShip->dBulletVelY = gDiry[lpShip->cFrame]*500.0/1000.0; + lpShip->bBulletEnable = TRUE; + lpShip->dwBulletFrame = 0; + } + } +} + +/* + * SendSync + * + * Sends a sync message with the rendevous position. We are using a synchronization technique in + * which every player informs everyone else where the player is going to be at the end of the + * next sync interval. Based on this rendezvous position, everyone tries to move their corresponding + * ghosts to the rendezvous position by the end of the interval. + */ +void SendSync(LPSHIP lpShip) +{ + gSyncMsg.byShipType = lpShip->byType; + gSyncMsg.cFrame = lpShip->cFrame; + gSyncMsg.dPosX = lpShip->dPosX + lpShip->dVelX*1000; + gSyncMsg.dPosY = lpShip->dPosY + lpShip->dVelY*1000; + + SendGameMessage((LPGENERICMSG) &gSyncMsg, DPID_ALLPLAYERS); +} + +/* + * UpdateDisplayStatus + * + * Updates the disable timeout. Enables the ship if disable timeout has elapsed. + */ +void UpdateDisplayStatus(LPSHIP lpShip) +{ + DWORD dwTickDiff; + DWORD dwTickCount; + + // current time + dwTickCount = timeGetTime(); + + // time elapsed since last update + dwTickDiff = dwTickCount - lpShip->dwLastTick; + + // timestamp + lpShip->dwLastTick = dwTickCount; + + // update time-out + lpShip->iCountDown -= dwTickDiff; + + // time-out ? + if( lpShip->iCountDown < 0 ) + { + // get new position and enable our lpShip + lpShip->dPosX = randInt(0,MAX_SHIP_X); + lpShip->dPosY = randInt(0,MAX_SHIP_Y); + lpShip->cFrame = randInt(0, MAX_SHIP_FRAME); + lpShip->bEnable = TRUE; + } +} + +/* + * UpdatePosition + * + * Updates our ship's position + */ +void UpdatePosition(DPID dpId, LPSHIP lpShip ) +{ + int x,y; + BYTE oldxCell, oldyCell, newxCell, newyCell, mask, col, row; + double thisTick, totalTick, xtick, ytick; + DWORD dwTickCount; + DWORD dwTickDiff; + + if( !lpShip->bEnable ) + return; + + // how long has it been since we last updated + dwTickCount = timeGetTime(); + dwTickDiff = dwTickCount - lpShip->dwLastTick; + + // current timestamp + lpShip->dwLastTick = dwTickCount; + + oldxCell = (int)(lpShip->dPosX+16.0) >> 4; + oldyCell = (int)(lpShip->dPosY+16.0) >> 4; + + // compute new position + lpShip->dPosX += lpShip->dVelX * dwTickDiff; + lpShip->dPosY += lpShip->dVelY * dwTickDiff; + + newxCell = (int)(lpShip->dPosX+16.0) >> 4; + newyCell = (int)(lpShip->dPosY+16.0) >> 4; + if(oldxCell != newxCell) + { + // we allow ghosts to pass through the blocks + if( (dpId == gOurID) && IsHit( newxCell, newyCell ) ) + { + if( lpShip->dVelX > 0.0 ) + lpShip->dPosX = (oldxCell << 4) + 15 - 16; + else + lpShip->dPosX = (oldxCell << 4) - 16; + lpShip->dVelX = -lpShip->dVelX*0.9; + newxCell = oldxCell; + lpShip->bBounced = TRUE; + } + } + if(oldyCell != newyCell) + { + // we allow ghosts to pass through the blocks + if( (dpId == gOurID) && IsHit( newxCell, newyCell ) ) + { + if( lpShip->dVelY > 0.0 ) + lpShip->dPosY = (oldyCell << 4) + 15 - 16; + else + lpShip->dPosY = (oldyCell << 4) - 16; + + lpShip->dVelY = -lpShip->dVelY*0.9; + lpShip->bBounced = TRUE; + } + } + + if( lpShip->dPosX > MAX_SHIP_X ) + { + lpShip->dPosX = MAX_SHIP_X; + lpShip->dVelX = -lpShip->dVelX*0.9; + lpShip->bBounced = TRUE; + } + else if ( lpShip->dPosX < 0 ) + { + lpShip->dPosX =0; + lpShip->dVelX = -lpShip->dVelX*0.9; + lpShip->bBounced = TRUE; + } + if( lpShip->dPosY > MAX_SHIP_Y ) + { + lpShip->dPosY = MAX_SHIP_Y; + lpShip->dVelY = -lpShip->dVelY*0.9; + lpShip->bBounced = TRUE; + } + else if ( lpShip->dPosY < 0 ) + { + lpShip->dPosY =0; + lpShip->dVelY = -lpShip->dVelY*0.9; + lpShip->bBounced = TRUE; + } + + if ((dpId == gOurID) && lpShip->bBounced) + { + SendSync(lpShip); + } + + if( !lpShip->bBulletEnable ) + return; + + // update the active bullet + lpShip->dwBulletFrame += dwTickDiff; + if( lpShip->dwBulletFrame >= MAX_BULLET_FRAME ) + { + lpShip->bFiring = FALSE; + lpShip->bBulletEnable = FALSE; + return; + } + + + if( lpShip->dBulletVelX != 0.0 ) + xtick = 8.0/lpShip->dBulletVelX; + else + xtick = 999999.0; + + if( lpShip->dBulletVelY != 0.0 ) + ytick = 8.0/lpShip->dBulletVelY; + else + ytick = 999999.0; + + if( xtick < 0.0 ) + xtick = -xtick; + if( ytick < 0.0 ) + ytick = -ytick; + + if( xtick < ytick ) + thisTick = xtick; + else + thisTick = ytick; + + if( thisTick > dwTickDiff ) + thisTick = dwTickDiff; + + for( totalTick = 0.0; totalTick < dwTickDiff; ) + { + totalTick += thisTick; + + lpShip->dBulletPosX += lpShip->dBulletVelX * thisTick; + lpShip->dBulletPosY += lpShip->dBulletVelY * thisTick; + + if( lpShip->dBulletPosX > MAX_BULLET_X ) + { + lpShip->dBulletPosX = MAX_BULLET_X; + lpShip->dBulletVelX = -lpShip->dBulletVelX*0.9; + } + else if ( lpShip->dBulletPosX < 0 ) + { + lpShip->dBulletPosX =0; + lpShip->dBulletVelX = -lpShip->dBulletVelX*0.9; + } + if( lpShip->dBulletPosY > MAX_BULLET_Y ) + { + lpShip->dBulletPosY = MAX_BULLET_Y; + lpShip->dBulletVelY = -lpShip->dBulletVelY*0.9; + } + else if ( lpShip->dBulletPosY < 0 ) + { + lpShip->dBulletPosY =0; + lpShip->dBulletVelY = -lpShip->dBulletVelY*0.9; + } + + // check to see if it hit anything + x = (int)(lpShip->dBulletPosX + 0.5) + 1; + y = (int)(lpShip->dBulletPosY + 0.5) + 1; + + row = y >> 4; + col = x >> 4; + mask = 1 << (col & 0x7); + col = col >> 3; + if( gBlocks.bits[row][col] & mask ) + { + // dwScored a block hit + gBlockHitMsg.byRow = row; + gBlockHitMsg.byCol = col; + gBlockHitMsg.byMask = mask; + SendGameMessage((LPGENERICMSG) &gBlockHitMsg, DPID_ALLPLAYERS); + + gBlocks.bits[row][col] &= ~mask; + lpShip->dwScore += 10; + lpShip->bBulletEnable = FALSE; + lpShip->bBlockHit = TRUE; + lpShip->bFiring = FALSE; + } + } +} + + +/* + * IsHit + * + * Tells if there is a block at (x,y) location + */ +BOOL IsHit( int x, int y ) +{ + int col, mask; + + // outside screen boundaries? + if( (x < 0) || (y < 0) || (x >= 40) || (y >= 30) ) + return TRUE; + + // look at the block bits + mask = 1 << (x & 0x7); + col = x >> 3; + if( gBlocks.bits[y][col] & mask ) + return TRUE; + else + return FALSE; +} + +/* + * InitField + * + * Initializes block positions on the field + */ +void InitField(void) +{ + int i, x, y; + + // clear all gBlocks + for(x=0; x<5; x++) + for(y=0; y<30; y++) + gBlocks.bits[y][x] = 0; + + // set random gBlocks + for(i=0; i<400; i++) + { + x = randInt(0, 40); + y = randInt(0, 30); + if( !setBlock(x, y) ) i--; + } +} + +/* + * AddBlock + * + * Adds a block to the field + */ +void AddBlock(void) +{ + int x,y; + + // maybe add a block? + if(gbIsHost && gbIsActive && ( randInt( 0, 100 ) > 98 )) + { + x = randInt( 0, 40); + y = randInt( 0, 30); + if( setBlock( x, y) ) + { + gAddBlockMsg.byX = (BYTE) x; + gAddBlockMsg.byY = (BYTE) y; + SendGameMessage((LPGENERICMSG) &gAddBlockMsg, DPID_ALLPLAYERS); + } + } +} + +/* + * setBlock + * + * Turns on a block + */ +BOOL setBlock( int x, int y ) +{ + BYTE mask, col; + + mask = 1 << (x & 0x7); + col = x >> 3; + + // is Block already set? + if( gBlocks.bits[y][col] & mask ) + return FALSE; + + // set the block and return success + gBlocks.bits[y][col] |= mask; + return TRUE; +} + +/* + * AddFrag + * + * Turns on a fragment + */ +void AddFrag(LPSHIP lpShip, int offX, int offY) +{ + int i; + for(i=0; i<64; i++) // find available fragment + { + if( !gFrags[i].valid ) + break; + } + if( i == 64 ) + return; + + + gFrags[i].dPosX = offX + lpShip->dPosX; + gFrags[i].dPosY = offY + lpShip->dPosY; + switch( lpShip->byType ) + { + case 0: gFrags[i].surf = glpShip0; break; + case 1: gFrags[i].surf = glpShip1; break; + case 2: gFrags[i].surf = glpShip2; break; + case 3: gFrags[i].surf = glpShip3; break; + default: DEBUG_OUT(TEXT("Unknown ship type\n")); return; + } + gFrags[i].src.top = 32 * ( (int)lpShip->cFrame / 10 ) + offX; + gFrags[i].src.left = 32 * ( (int)lpShip->cFrame % 10 ) + offY; + gFrags[i].src.right = gFrags[i].src.left + 8; + gFrags[i].src.bottom = gFrags[i].src.top + 8; + gFrags[i].dVelX = ((double)offX - 12.0)/24.0; + gFrags[i].dVelY = ((double)offY - 12.0)/24.0; + gFrags[i].valid = TRUE; +} + +/* + * UpdateFragment + * + * Updates the position of a fragment + */ +void UpdateFragment(int i) +{ + DWORD dwTickCount; + static DWORD dwTickDiff; + static DWORD dwLastTick; + + if( i == 0) + { + dwTickCount = timeGetTime(); + dwTickDiff = dwTickCount - dwLastTick; + dwLastTick = dwTickCount; + } + + if( !gFrags[i].valid ) + return; + + gFrags[i].dPosX += (int) (gFrags[i].dVelX * dwTickDiff); + gFrags[i].dPosY += (int) (gFrags[i].dVelY * dwTickDiff); + if( (gFrags[i].dPosX < 0.0) || (gFrags[i].dPosX >= 632.0) || + (gFrags[i].dPosY < 0.0) || (gFrags[i].dPosY >= 472.0) ) + { + gFrags[i].valid = FALSE; + } +} + +/* + * DestroyShip + * + * Renders a bunch of fragments to show that the ship is destroyed + */ +void DestroyShip( LPSHIP lpShip ) +{ + // Set flag for explosion sound + lpShip->bDeath = TRUE; + + // add ship fragments + AddFrag(lpShip, 0, 0); + AddFrag(lpShip, 8, 0); + AddFrag(lpShip, 16, 0); + AddFrag(lpShip, 24, 0); + AddFrag(lpShip, 0, 8); + AddFrag(lpShip, 8, 8); + AddFrag(lpShip, 16, 8); + AddFrag(lpShip, 24, 8); + AddFrag(lpShip, 0, 16); + AddFrag(lpShip, 8, 16); + AddFrag(lpShip, 16, 16); + AddFrag(lpShip, 24, 16); + AddFrag(lpShip, 0, 24); + AddFrag(lpShip, 8, 24); + AddFrag(lpShip, 16, 24); + AddFrag(lpShip, 24, 24); + + // Play explosion sound + ProcessSoundFlags(lpShip); +} + +/* + * UpdateFrame + * + * Refreshes the screen + */ +BOOL UpdateFrame( void ) +{ + int i; + DWORD dwTickCount; + SHIP ship; + DWORD dwSize; + HRESULT hr; + static dwSyncLastTick = 0; + static dwUpdateLastTick = 0; + + switch( gnProgramState ) + { + case PS_ACTIVE: + // DINPUT: use DirectInput to read game-play keys + DI_ReadKeys(); + + // get our local data + dwSize = sizeof(ship); + hr = DPlayGetPlayerData(gOurID, &ship, &dwSize, DPGET_LOCAL); + if (FAILED(hr)) + { + wsprintf(gDebugBuff, TEXT("Get Player local data failed for id %d\n"), gOurID); + DEBUG_OUT(gDebugBuff); + goto FAIL; + } + + if (!ship.bEnable) + { + // update disable timeout and display status + UpdateDisplayStatus(&ship); + } + else + { + // process any change in game controls + ProcessUserInput(&ship); + + dwTickCount = timeGetTime(); + + // synchronize if it's time + if (gbIsActive && ((dwTickCount - dwSyncLastTick) > SYNC_INTERVAL)) + { + SendSync(&ship); + dwSyncLastTick = dwTickCount; + } + + // if our player changed any keys, let everyone know + if (gbUpdate) + { + // control the number of packets we send + if ((dwTickCount - dwUpdateLastTick) > UPDATE_INTERVAL) + { + // let others know + gControlMsg.byState = (BYTE) gdwKeys; + SendGameMessage((LPGENERICMSG) &gControlMsg, DPID_ALLPLAYERS); + dwUpdateLastTick = dwTickCount; + } + } + } + + // save ship data as RenderPlayerCB reads stored data + hr = DPlaySetPlayerData(gOurID, &ship, sizeof(ship), DPSET_LOCAL); + if (FAILED(hr)) + { + ShowError(IDS_DPLAY_ERROR_SPLD); + goto FAIL; + } + + // update fragments + for(i=0; i<64; i++) + UpdateFragment(i); + + // add a block + if (!gbNoField) + AddBlock(); + + // render everything + if (!DrawScreen()) + { + goto FAIL; + } + break; + + case PS_REST: + if( gbHaveHostInit ) + { + SetGamePalette(); + gnProgramState = PS_ACTIVE; + } + break; + } + + // success + return TRUE; + +FAIL: + // failed + return FALSE; +} + +/* + *FUNCTION: ProcessSoundFlags + * + *PARAMETERS: + * lpShip: Points to a ship structure (originally retrieved from + * GetPlayerData) in RenderPlayer. + * + *NOTES: All y-coordinates must be made negative, because the + * 3D Sound API's use an opposite coordinate system than + * the screen. + */ +void ProcessSoundFlags(LPSHIP lpShip) +{ + int i; + BOOL bStart[MAX_SOUNDS]; //flags, used so we can + BOOL bStop [MAX_SOUNDS]; + + if (!gbSoundInitialized) + return; + + //if one is NULL, so are the other ones and we aren't initialized yet. + for (i=0; i<MAX_SOUNDS; i++) + { + if (lpShip->lpDirectSoundBuffer[i]==NULL) + return; + } + + //set all our temporary flags to FALSE. + for (i=0; i<MAX_SOUNDS; i++) + { + bStart[i] = FALSE; + bStop[i] = FALSE; + } + + if (lpShip->dwKeys & KEY_ENGINEOFF) + { + bStop[SENGINE] = TRUE; + lpShip->bEngineRunning = FALSE; + } + + if (lpShip->dwKeys & (KEY_UP | KEY_DOWN)) + { + if (!lpShip->bEngineRunning) //turn on engine + { + bStart[SENGINE] = TRUE; + if (!lpShip->bMoving) //"fire-up-engine" sound + { + bStart[SSTART] = TRUE; + IDirectSound3DBuffer_SetPosition(lpShip->lpDirectSound3DBuffer[SSTART], + P2M(lpShip->dPosX - 320), + -P2M(lpShip->dPosY - 240), + D3DVAL(0), + DS3D_DEFERRED); + bStart[SSTART] = TRUE; + lpShip->bMoving = TRUE; + } + lpShip->bEngineRunning = TRUE; + } + } + + if (lpShip->bMoving) + { + IDirectSound3DBuffer_SetPosition(lpShip->lpDirectSound3DBuffer[SENGINE], + P2M(lpShip->dPosX - 320), + -P2M(lpShip->dPosY - 240), + D3DVAL(0), + DS3D_DEFERRED); + IDirectSound3DBuffer_SetVelocity(lpShip->lpDirectSound3DBuffer[SENGINE], + D3DVAL(lpShip->dVelX * 10), //exagerater vel + D3DVAL(lpShip->dVelY * 10), + D3DVAL(0), + DS3D_DEFERRED); + } + + if (lpShip->dwKeys & KEY_STOP) + { + if (lpShip->bMoving) + { + IDirectSound3DBuffer_SetPosition(lpShip->lpDirectSound3DBuffer[SSTOP], + P2M(lpShip->dPosX - 320), + -P2M(lpShip->dPosY - 240), + D3DVAL(0), + DS3D_DEFERRED); + bStart[SSTOP] = TRUE; + bStop[SENGINE] = TRUE; + lpShip->bEngineRunning = FALSE; + lpShip->bMoving = FALSE; + } + } + + if (lpShip->dwKeys & KEY_FIRE) + { + if (!lpShip->bFiring) + { + IDirectSound3DBuffer_SetPosition(lpShip->lpDirectSound3DBuffer[BFIRE], + P2M(lpShip->dPosX - 320), + -P2M(lpShip->dPosY - 240), + D3DVAL(0), + DS3D_DEFERRED); + bStart[BFIRE] = TRUE; + lpShip->bFiring = TRUE; + } + } + + if (lpShip->bBlockHit) + { + IDirectSound3DBuffer_SetPosition(lpShip->lpDirectSound3DBuffer[LBOOM], + + P2M(lpShip->dBulletPosX - 320), + -P2M(lpShip->dBulletPosY - 240), + D3DVAL(0), + DS3D_DEFERRED); + + bStart[LBOOM] = TRUE; + lpShip->bBlockHit = FALSE; + } + + if (lpShip->bBounced) + { + IDirectSound3DBuffer_SetPosition(lpShip->lpDirectSound3DBuffer[SBOUNCE], + P2M(lpShip->dPosX - 320), + -P2M(lpShip->dPosY - 240), + D3DVAL(0), + DS3D_DEFERRED); + + bStart[SBOUNCE] = TRUE; + lpShip->bBounced = FALSE; + } + + + if (lpShip->bDeath) + { + bStop [BFIRE] = TRUE; + bStop [SBOUNCE] = TRUE; + bStop [SSTOP] = TRUE; + bStop [SSTART] = TRUE; + bStop [SENGINE] = TRUE; + bStart[SBOOM] = TRUE; + lpShip->bDeath = FALSE; //turn off sound flag. + } + + //stop, update, and start sounds. + for (i=0; i<MAX_SOUNDS; i++) + { + if (bStop[i]) + { + IDirectSoundBuffer_Stop(lpShip->lpDirectSoundBuffer[i]); + bStart[i] = FALSE; + } + } + IDirectSound3DListener_CommitDeferredSettings(glpDirectSound3DListener); + + for (i=0; i<MAX_SOUNDS; i++) + { + if (bStart[i]) + { + IDirectSoundBuffer_SetCurrentPosition(lpShip->lpDirectSoundBuffer[i], 0); + + if (DSERR_BUFFERLOST==IDirectSoundBuffer_Play(lpShip->lpDirectSoundBuffer[i], + 0, + 0, + (i==SENGINE) ? DSBPLAY_LOOPING : 0)) + { + WaveReload(gSoundEffect[i]); + } + } + } + lpShip->dwKeys = 0; +}; + + + + +/* + * RenderPlayerCB + * + * Renders a ship in its current state. Also checks if we hit the ship and informs + * the ship that it has been destroyed. + */ + +BOOL WINAPI RenderPlayerCB(DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, + DWORD dwFlags, LPVOID lpContext) +{ + SHIP ship, ourShip; + DWORD dwSize = sizeof(ship); + BOOL bHit = FALSE; + HRESULT hr; + DWORD dwTickCount; + + // get ship data + hr = DPlayGetPlayerData(dpId, &ship, &dwSize, DPGET_LOCAL); + + if (FAILED(hr)) + { + wsprintf(gDebugBuff, TEXT("Get Player local data failed for id %d\n"), dpId); + DEBUG_OUT(gDebugBuff); + goto FAIL; + } + + // no player data yet + if (0 == dwSize) + return TRUE; + + // ignore current ship ? + if (ship.bIgnore) + { + // if this ship was being ignored, update ignore time-out + // A time-out is used here to ensure that this ship doesn't get ignored + // forever on our screen in case the destroy message was dropped. + dwTickCount = timeGetTime(); + ship.iCountDown -= dwTickCount - ship.dwLastTick; + ship.dwLastTick = dwTickCount; + if( ship.iCountDown < 0 ) + { + ship.bIgnore = FALSE; + } + + // save ship data + hr = DPlaySetPlayerData(dpId, &ship, sizeof(ship), DPSET_LOCAL); + if (FAILED(hr)) + { + ShowError(IDS_DPLAY_ERROR_SPLD); + goto FAIL; + } + // we are ignoring this ship, so just bail + return TRUE; + } + + // bail, if ship is disabled + if (!ship.bEnable) return TRUE; + + // update ship's position + UpdatePosition(dpId, &ship); + + // get our player data to compare with others + dwSize = sizeof(ship); + hr = DPlayGetPlayerData(gOurID, &ourShip, &dwSize, DPGET_LOCAL); + if (FAILED(hr)) + { + wsprintf(gDebugBuff, TEXT("Get Player local data failed for id %d\n"), dpId); + DEBUG_OUT(gDebugBuff); + goto FAIL; + } + + // check if our bullet hit the current ship + if((dpId != gOurID) && ourShip.bBulletEnable && ship.bEnable) + { + if( (ourShip.dBulletPosX > ship.dPosX) && + (ourShip.dBulletPosX < (ship.dPosX + 32.0) ) && + (ourShip.dBulletPosY > ship.dPosY) && + (ourShip.dBulletPosY < (ship.dPosY + 32.0) ) ) + { + // hasta-la-vista baby + DestroyShip(&ship); + // we nailed it + bHit = TRUE; + // turn off ship locally + ship.bEnable = FALSE; + // temporarily ignore ship until we get a response + ship.bIgnore = TRUE; + // set its ignore time-out + ship.iCountDown = HIDE_TIMEOUT; + // time-stamp + ship.dwLastTick = timeGetTime(); + // turn our bullet off + ship.bBulletEnable = FALSE; + // update our score + ourShip.dwScore += 1000; + // save our score + hr = DPlaySetPlayerData(gOurID, &ourShip, sizeof(ourShip), DPSET_LOCAL); + if (FAILED(hr)) + { + ShowError(IDS_DPLAY_ERROR_SPLD); + goto FAIL; + } + } + } + + // render the ship + if (ship.bBulletEnable) DrawBullet(&ship); + if (ship.bEnable) DrawShip(&ship); + + ProcessSoundFlags(&ship); + + // save ship data + hr = DPlaySetPlayerData(dpId, &ship, sizeof(ship), DPSET_LOCAL); + if (FAILED(hr)) + { + ShowError(IDS_DPLAY_ERROR_SPLD); + goto FAIL; + } + + // inform the player + if (bHit) + { + gShipHitMsg.Id = dpId; + SendGameMessage((LPGENERICMSG) &gShipHitMsg, dpId); + } + + // success + return TRUE; + +FAIL: + // failed + return FALSE; +} + +/* + * DrawScreen + * + * Renders the current frame + */ +BOOL DrawScreen( void ) +{ + BYTE mask, col; + int x, y; + HRESULT hr; + + // clear screen + EraseScreen(); + + // render players + hr = DPlayEnumPlayers(NULL, RenderPlayerCB, NULL, 0); + if (FAILED(hr)) + { + ShowError(IDS_DPLAY_ERROR_EP); + goto FAIL; + } + + // render field + for( y=0; y<30; y++) + { + for( x=0; x<40; x++) + { + mask = 1 << (x & 0x7); + col = x >> 3; + if( gBlocks.bits[y][col] & mask ) + DrawBlock( x, y ); + } + } + + // render score + if (!DrawScore()) + { + goto FAIL; + } + + // render fragments + DrawFragments(); + + // render frame rate + if( gbShowFrameCount ) + DisplayFrameRate(); + + // show + FlipScreen(); + + // success + return TRUE; + +FAIL: + return FALSE; +} + +/* + * DisplayFrameRate + * + * Renders current frame rate + */ +void DisplayFrameRate( void ) +{ + DWORD time2; + char buff[256]; + static DWORD dwFrames; + + gdwFrameCount++; + time2 = timeGetTime() - gdwFrameTime; + if( time2 > 1000 ) + { + dwFrames = (gdwFrameCount*1000)/time2; + gdwFrameTime = timeGetTime(); + gdwFrameCount = 0; + } + if( dwFrames == 0 ) + { + return; + } + + if (dwFrames != gdwFramesLast) + { + gdwFramesLast = dwFrames; + } + + if( dwFrames > 99 ) + { + dwFrames = 99; + } + buff[0] = (char)((dwFrames / 10) + '0'); + buff[1] = (char)((dwFrames % 10) + '0'); + buff[2] = '\0'; + bltScore(buff, 295, 10); +} + +/* + * DrawScore + * + * Renders our current score + */ +BOOL DrawScore( void ) +{ + SHIP ship; + DWORD dwSize; + char dwScorebuf[11]; + int rem; + HRESULT hr; + + dwSize = sizeof(ship); + hr = DPlayGetPlayerData(gOurID, &ship, &dwSize, DPGET_LOCAL); + if (FAILED(hr)) + { + wsprintf(gDebugBuff, TEXT("Get Player local data failed for id %d\n"), gOurID); + DEBUG_OUT(gDebugBuff); + goto FAIL; + } + + // blt everything in reverse order if we are doing destination transparency + // calculate dwScore string + dwScorebuf[0] = (BYTE)ship.dwScore/100000 + '0'; + rem = ship.dwScore % 100000; + dwScorebuf[1] = rem/10000 + '0'; + rem = ship.dwScore % 10000; + dwScorebuf[2] = rem/1000 + '0'; + rem = ship.dwScore % 1000; + dwScorebuf[3] = rem/100 + '0'; + rem = ship.dwScore % 100; + dwScorebuf[4] = rem/10 + '0'; + rem = ship.dwScore % 10; + dwScorebuf[5] = rem + '0'; + dwScorebuf[6] = '\0'; + + bltScore(dwScorebuf, 8, 8); + + // save ship data + hr = DPlaySetPlayerData(gOurID, &ship, sizeof(ship), DPSET_LOCAL); + if (FAILED(hr)) + { + ShowError(IDS_DPLAY_ERROR_SPLD); + goto FAIL; + } + + return TRUE; + +FAIL: + // failed + return FALSE; +} + +/* + * DrawBlock + * + * Renders a block + */ +void DrawBlock( int x, int y ) +{ + RECT src; + + src.top = 0; + src.left = 224; + src.right = src.left + 16; + src.bottom = src.top + 16; + bltObject( x << 4, y << 4, glpNum, &src, DDBLTFAST_SRCCOLORKEY ); +} + +/* + * DrawShip + * + * Renders a ship + */ +void DrawShip( LPSHIP lpShip ) +{ + RECT src; + LPDIRECTDRAWSURFACE surf; + + src.top = 32 * (lpShip->cFrame / 10 ); + src.left = 32 * (lpShip->cFrame % 10 ); + src.right = src.left + 32; + src.bottom = src.top + 32; + switch( lpShip->byType ) + { + case 0: surf = glpShip0; break; + case 1: surf = glpShip1; break; + case 2: surf = glpShip2; break; + case 3: surf = glpShip3; break; + default: DEBUG_OUT(TEXT("Ship type not specified\n")); return; + } + bltObject((int)lpShip->dPosX, (int)lpShip->dPosY, surf, &src, DDBLTFAST_SRCCOLORKEY ); +} + +/* + * DrawBullet + * + * Renders a bullet + */ +void DrawBullet( LPSHIP lpShip ) +{ + RECT src; + + src.top = BULLET_Y; + src.left = BULLET_X + (lpShip->byType)*4; + src.right = src.left + 3; + src.bottom = src.top + 3; + bltObject((int)lpShip->dBulletPosX, (int)lpShip->dBulletPosY, glpNum, &src, DDBLTFAST_SRCCOLORKEY ); +} + +/* + * DrawFragments + * + * Renders the fragments + */ + +void DrawFragments( void ) +{ + int i; + + for(i=0; i<64; i++) + { + if( gFrags[i].valid ) + { + bltObject((int)gFrags[i].dPosX, (int)gFrags[i].dPosY, gFrags[i].surf, + &(gFrags[i].src), DDBLTFAST_SRCCOLORKEY ); + } + } +} + +/* + * ReceiveGameMessages + * + * Checks if there are any messages for us and receives them + */ +HRESULT ReceiveMessages( void ) +{ + DPID idFrom, idTo; + LPVOID lpvMsgBuffer; + DWORD dwMsgBufferSize; + HRESULT hr; + + // read all messages in queue + dwMsgBufferSize = gdwReceiveBufferSize; + lpvMsgBuffer = glpvReceiveBuffer; + + while (TRUE) + { + // see what's out there + idFrom = 0; + idTo = 0; + + hr = DPlayReceive(&idFrom, &idTo, DPRECEIVE_ALL, lpvMsgBuffer, &dwMsgBufferSize); + if (hr == DPERR_BUFFERTOOSMALL) + { + if (lpvMsgBuffer == NULL) + { + lpvMsgBuffer = GlobalAllocPtr(GHND, dwMsgBufferSize); + if (lpvMsgBuffer == NULL) + return (DPERR_NOMEMORY); + glpvReceiveBuffer = lpvMsgBuffer; + gdwReceiveBufferSize = dwMsgBufferSize; + } + else if (dwMsgBufferSize > gdwReceiveBufferSize) + { + lpvMsgBuffer = GlobalReAllocPtr(lpvMsgBuffer, dwMsgBufferSize, 0); + if (lpvMsgBuffer == NULL) + return (DPERR_NOMEMORY); + glpvReceiveBuffer = lpvMsgBuffer; + gdwReceiveBufferSize = dwMsgBufferSize; + } + } + else if ((hr == DP_OK) && + ((dwMsgBufferSize >= sizeof(GENERICMSG)) || + (dwMsgBufferSize >= sizeof(DPMSG_GENERIC)))) + { + if (idFrom == DPID_SYSMSG) + { + DoSystemMessage((LPDPMSG_GENERIC) lpvMsgBuffer, dwMsgBufferSize, idFrom, idTo); + } + else + { + DoApplicationMessage((LPGENERICMSG) lpvMsgBuffer, dwMsgBufferSize, idFrom, idTo); + } + } + else + break; + }; + + return hr; +} + +/* + * DoSystemMessage + * + * Evaluates system messages and performs appropriate actions + */ +void DoSystemMessage( LPDPMSG_GENERIC lpMsg, DWORD dwMsgSize, DPID idFrom, DPID idTo ) +{ + switch( lpMsg->dwType) + { + case DPSYS_CREATEPLAYERORGROUP: + { + LPDPMSG_CREATEPLAYERORGROUP lpAddMsg = (LPDPMSG_CREATEPLAYERORGROUP) lpMsg; + + if( gbIsHost) + { + gHostMsg.Blocks = gBlocks; + SendGameMessage((LPGENERICMSG) &gHostMsg, lpAddMsg->dpId); + } + } + break; + + case DPSYS_DESTROYPLAYERORGROUP: + { + LPSHIP lpShip; + LPDPMSG_DESTROYPLAYERORGROUP lpDestroyMsg = (LPDPMSG_DESTROYPLAYERORGROUP) lpMsg; + + if ((sizeof(SHIP) != lpDestroyMsg->dwLocalDataSize) || + (NULL == lpDestroyMsg->lpLocalData)) + break; + + lpShip = lpDestroyMsg->lpLocalData; + ReleasePlayerLocalSoundData(lpShip); + } + break; + + case DPSYS_HOST: + { + gbIsHost = TRUE; + UpdateTitle(); + } + + break; + + case DPSYS_SESSIONLOST: + // inform user that session was lost + ShowError(IDS_DPLAY_ERROR_SL); + gbSessionLost = TRUE; + break; + } +} + +/* + * DoApplicationMessage + * + * Evaluates an application message and performs appropriate actions + */ +void DoApplicationMessage( LPGENERICMSG lpMsg, DWORD dwMsgSize, DPID idFrom, DPID idTo ) +{ + HRESULT hr; + + switch( lpMsg->byType ) + { + case MSG_HOST: + { + LPHOSTMSG lpHost; + + if( !gbIsHost ) + { + lpHost = (LPHOSTMSG) lpMsg; + // receive the field layout + gBlocks = lpHost->Blocks; + + // have host initializtion at this point + gbHaveHostInit = TRUE; + + // start updating screen + gbIsActive = TRUE; + } + } + break; + + case MSG_BLOCKHIT: + { + LPBLOCKHITMSG lpBlockHit; + + lpBlockHit = (LPBLOCKHITMSG) lpMsg; + gBlocks.bits[lpBlockHit->byRow][lpBlockHit->byCol] &= ~lpBlockHit->byMask; + } + break; + + case MSG_ADDBLOCK: + { + LPADDBLOCKMSG lpAddBlock; + + lpAddBlock = (LPADDBLOCKMSG) lpMsg; + setBlock( lpAddBlock->byX, lpAddBlock->byY); + } + break; + + case MSG_SHIPHIT: + { + LPSHIPHITMSG lpShipHit = (LPSHIPHITMSG) lpMsg; + SHIP ship; + DWORD dwSize; + + dwSize = sizeof(SHIP); + // get player local data + hr = DPlayGetPlayerData(lpShipHit->Id, &ship, &dwSize, DPGET_LOCAL); + if (FAILED(hr)) + return; + + // no player data yet + if (0 == dwSize) + return; + + if (!ship.bIgnore) + { + // explode the ship on our screen + DestroyShip(&ship); + + // turn it off + ship.bEnable = FALSE; + ship.bBulletEnable = FALSE; + + // if it is us + if (lpShipHit->Id == gOurID) + { + // set our hide time-out + ship.iCountDown = HIDE_TIMEOUT; + ship.dwLastTick = timeGetTime(); + // let the world know that we are dead + gShipHitMsg.Id = gOurID; + SendGameMessage((LPGENERICMSG) &gShipHitMsg, DPID_ALLPLAYERS); + } + } + // update player local data + DPlaySetPlayerData(lpShipHit->Id, &ship, sizeof(ship), DPSET_LOCAL); + } + break; + + case MSG_CONTROL: + { + LPCONTROLMSG lpControlMsg; + SHIP ship; + DWORD dwSize; + + lpControlMsg = (LPCONTROLMSG) lpMsg; + dwSize = sizeof(SHIP); + // get player local data + hr = DPlayGetPlayerData(idFrom, &ship, &dwSize, DPGET_LOCAL); + if (FAILED(hr)) + return; + + // no player data yet + if (0 == dwSize) + return; + + // update its State + UpdateState(&ship, (DWORD)lpControlMsg->byState); + + // save it back + DPlaySetPlayerData(idFrom, &ship, dwSize, DPSET_LOCAL); + } + break; + + case MSG_SYNC: + { + LPSYNCMSG lpSyncMsg; + SHIP ship; + DWORD dwSize; + + lpSyncMsg = (LPSYNCMSG) lpMsg; + dwSize = sizeof(SHIP); + // get player local data + hr = DPlayGetPlayerData(idFrom, &ship, &dwSize, DPGET_LOCAL); + if (FAILED(hr)) + return; + + // we are seeing this player for the first time + // so do the initialization + if (0 == dwSize) + { + ZeroMemory(&ship, sizeof(ship)); + + // initialize sound buffers + InitPlayerLocalSoundData(&ship); + + ship.byType = lpSyncMsg->byShipType; + ship.dPosX = lpSyncMsg->dPosX; + ship.dPosY = lpSyncMsg->dPosY; + ship.cFrame = lpSyncMsg->cFrame; + ship.dwLastTick = timeGetTime(); + ship.bEnable = TRUE; + } + + if (ship.bEnable) + { + // head towards rendezvous location (accelerate/decelerate as necessary) + ship.dVelX = (lpSyncMsg->dPosX - ship.dPosX)/1000; + ship.dVelY = (lpSyncMsg->dPosY - ship.dPosY)/1000; + ship.cFrame = lpSyncMsg->cFrame; + } + else if (!ship.bIgnore) + // Ship is alive, but we just don't know it. + // So, display it at the rendezvous location. + { + ship.dPosX = lpSyncMsg->dPosX; + ship.dPosY = lpSyncMsg->dPosY; + ship.cFrame = lpSyncMsg->cFrame; + ship.dwLastTick = timeGetTime(); + ship.bEnable = TRUE; + } + + // save it back + DPlaySetPlayerData(idFrom, &ship, sizeof(ship), DPSET_LOCAL); + } + break; + + default: + { + wsprintf(gDebugBuff, TEXT("Unknown message type %d\n"), lpMsg->byType); + DEBUG_OUT( gDebugBuff ); + } + break; + } +} + +/* + * SendGameMessage + * + * Sends a message to specified player(s) + */ +void SendGameMessage( LPGENERICMSG lpMsg, DPID idTo ) +{ + int nBytes; + DWORD dwFlags = 0; + + if (gbSessionLost) + { + // no sends when we are not in the session + return; + } + + switch( lpMsg->byType ) + { + case MSG_HOST: + nBytes = sizeof( HOSTMSG ); + dwFlags = DPSEND_GUARANTEED; + break; + + case MSG_BLOCKHIT: + nBytes = sizeof( BLOCKHITMSG ); + break; + + case MSG_SHIPHIT: + nBytes = sizeof( SHIPHITMSG ); + break; + + case MSG_ADDBLOCK: + nBytes = sizeof( ADDBLOCKMSG ); + break; + + case MSG_CONTROL: + nBytes = sizeof( CONTROLMSG ); + break; + + case MSG_SYNC: + nBytes = sizeof( SYNCMSG ); + break; + + default: + return; + } + + if (gbReliable) + { + dwFlags = DPSEND_GUARANTEED; + } + + // Send the message to the relevant player(s) + DPlaySend(gOurID, idTo, dwFlags, (LPVOID)lpMsg, nBytes); +} + +/* + * CleanupComm + * + * Cleans up communication stuff + */ +void CleanupComm(void) +{ + HRESULT hr; + + //free up all the local sound buffers + ReleaseLocalData(); + + // free the receive buffer + if (glpvReceiveBuffer) + { + GlobalFreePtr(glpvReceiveBuffer); + glpvReceiveBuffer = NULL; + } + + // delete our player + if( gOurID ) + { + hr = DPlayDestroyPlayer(gOurID); + if (FAILED(hr)) + { + ShowError(IDS_DPLAY_ERROR_DP); + } + gOurID = 0; + } + + // cleanup directplay objects + hr = DPlayClose(); + hr = DPlayRelease(); +} + diff --git a/sdk/samples/duel/gameproc.h b/sdk/samples/duel/gameproc.h new file mode 100644 index 0000000..0867a26 --- /dev/null +++ b/sdk/samples/duel/gameproc.h @@ -0,0 +1,214 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: gameproc.h + * Content: game processing info. include file + * + * + ***************************************************************************/ +#define IDIRECTPLAY2_OR_GREATER +#include <ddraw.h> +#include <dplay.h> +#include <dsound.h> +#include "sfx.h" +#include "duel.h" + +// align on single byte boundaries +// this is a stop-gap measure until the structures can be re-arranged. +#pragma pack(1) + +#define MAX_SHIP_X (MAX_SCREEN_X - 32) +#define MAX_SHIP_Y (MAX_SCREEN_Y - 32) +#define MAX_SHIP_FRAME 40 +#define MAX_BULLET_X (MAX_SCREEN_X - 3) +#define MAX_BULLET_Y (MAX_SCREEN_Y - 3) +#define MAX_BULLET_FRAME 400 + +#define NUM_SHIP_TYPES 4 + +#define DEF_SHOW_DELAY (2000) +#define MAX_BUFFER_SIZE 256 + +#define UPDATE_INTERVAL 40 // interval between position updates in milliseconds (25 FPS) +#define SYNC_INTERVAL 1000 // synchronize once every second +#define HIDE_TIMEOUT 5000 // time for which a ship is disabled after a hit + +/* + * keyboard commands + */ + +#define KEY_STOP 0x00000001l +#define KEY_DOWN 0x00000002l +#define KEY_LEFT 0x00000004l +#define KEY_RIGHT 0x00000008l +#define KEY_UP 0x00000010l +#define KEY_FIRE 0x00000020l +#define KEY_ENGINEOFF 0x00000040l + +/* + * Offsets for the bullet bitmap + */ + +#define BULLET_X 304 +#define BULLET_Y 0 + +typedef struct _frag +{ + double dPosX; + double dPosY; + LPDIRECTDRAWSURFACE surf; + RECT src; + double dVelX; + double dVelY; + BOOL valid; +} FRAG, *LPFRAG; + +/* + * structures + */ + +typedef struct _SHIP +{ + double dPosX, dPosY; // ship x and y position + double dBulletPosX, dBulletPosY; // bullet x and y position + DWORD dwBulletFrame; // bullet frame + char cFrame; // current ship frame + BYTE byType; // ship type + BOOL bEnable; // is this ship active? + BOOL bBulletEnable; // Is there an active bullet? + + double dVelX, dVelY; // ship x and y velocity (pixels/millisecond) + double dBulletVelX, dBulletVelY; // bullet x and y velocity (pixels/millisecond) + DWORD dwScore; // current score + DWORD dwLastTick; // most recent time stamp + BOOL bIgnore; // flag used to synchronize ship explosions + int iCountDown; // enable time-out + DWORD dwFrameCount; // number of frames since beginning of time + /* DSOUND members */ + LPDIRECTSOUNDBUFFER lpDirectSoundBuffer [MAX_SOUNDS]; // SoundBuffer interface + LPDIRECTSOUND3DBUFFER lpDirectSound3DBuffer[MAX_SOUNDS]; // 3D interface (to same buffer) + DWORD dwKeys; // the keyboard state + BOOL bEngineRunning; // These BOOLs keep track of the ship's + BOOL bMoving; // last condition so we can play sounds + BOOL bBounced; // when they change + BOOL bBlockHit; + BOOL bDeath; + BOOL bFiring; + /* DSOUND members */ + +} SHIP, *LPSHIP; + +typedef struct _BLOCKS +{ + BYTE bits[30][5]; +} BLOCKS, *LPBLOCKS; + +//---------------------------------------------------------- +// communication packet structures +//---------------------------------------------------------- +#define MSG_HOST 0x11 // message containing field layout, sent by host +#define MSG_BLOCKHIT 0x22 // block hit message +#define MSG_SHIPHIT 0x33 // ship hit message +#define MSG_ADDBLOCK 0x44 // add block message +#define MSG_CONTROL 0x55 // game keys message +#define MSG_SYNC 0x66 // synchronization message containing the rendezvous location + +typedef struct _GENERICMSG +{ + BYTE byType; +} GENERICMSG, *LPGENERICMSG; + +typedef struct _HOSTMSG +{ + BYTE byType; + BLOCKS Blocks; +} HOSTMSG, *LPHOSTMSG; + +typedef struct _BLOCKHITMSG +{ + BYTE byType; + BYTE byRow; + BYTE byCol; + BYTE byMask; +} BLOCKHITMSG, *LPBLOCKHITMSG; + +typedef struct _SHIPHITMSG +{ + BYTE byType; + DPID Id; +} SHIPHITMSG, *LPSHIPHITMSG; + +typedef struct _ADDBLOCKMSG +{ + BYTE byType; + BYTE byX; + BYTE byY; +} ADDBLOCKMSG, *LPADDBLOCKMSG; + +typedef struct _CONTROLMSG +{ + BYTE byType; + BYTE byState; +} CONTROLMSG, *LPCONTROLMSG; + +typedef struct _SYNCMSG +{ + BYTE byType; + BYTE byShipType; // this is needed only when sends are unreliable + char cFrame; + double dPosX; + double dPosY; +} SYNCMSG, *LPSYNCMSG; + +/* + * Prototypes + */ +void LaunchGame(void); +void ExitGame(void); +HRESULT InitOurShip(void); + +HRESULT InitLocalSoundData(void); +void InitPlayerLocalSoundData(LPSHIP lpShip); +BOOL WINAPI SetPlayerLocalSoundDataCB(DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, + DWORD dwFlags, LPVOID lpContext); + +void ReleaseLocalData(void); +void ReleasePlayerLocalSoundData(LPSHIP lpShip); +BOOL WINAPI ReleasePlayerLocalDataCB(DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, + DWORD dwFlags, LPVOID lpContext); + +void UpdateState(LPSHIP lpShip, DWORD dwControls); +void SendSync(LPSHIP lpShip); +void UpdateDisplayStatus(LPSHIP lpShip); +void UpdatePosition( DPID dpId, LPSHIP ship ); +BOOL IsHit( int x, int y ); +void InitField(void); +BOOL setBlock( int x, int y ); +void AddFrag(LPSHIP lpShip, int offX, int offY); +void UpdateFragment(int i); +void DestroyShip( LPSHIP lpShip); +void DestroyGame( void ); +BOOL UpdateFrame( void ); + +void ProcessSoundFlags(LPSHIP lpShip); +BOOL WINAPI RenderPlayerCB(DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, + DWORD dwFlags, LPVOID lpContext); +BOOL DrawScreen( void ); +BOOL DrawScore( void ); +void DrawShip( LPSHIP lpShip ); +void DrawBlock( int x, int y ); +void DrawBullet( LPSHIP lpShip ); +void DrawFragments( void ); +void DisplayFrameRate( void ); + +void GetConnection(void); +HRESULT ReceiveMessages( void ); +void DoSystemMessage( LPDPMSG_GENERIC lpMsg, DWORD dwMsgSize, DPID idFrom, DPID idTo ); +void DoApplicationMessage( LPGENERICMSG lpMsg, DWORD dwMsgSize, DPID idFrom, DPID idTo ); +void SendGameMessage( LPGENERICMSG lpMsg, DPID idTo ); +void CleanupComm(void); + + +// restore default alignment +#pragma pack() diff --git a/sdk/samples/duel/gfx.c b/sdk/samples/duel/gfx.c new file mode 100644 index 0000000..c51b22e --- /dev/null +++ b/sdk/samples/duel/gfx.c @@ -0,0 +1,564 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: gfx.c + * Content: DirectDraw related code. + * + * + ***************************************************************************/ +#include "gfx.h" +#include "input.h" +#include "ddutil.h" + +/* + * Externals + */ +extern BOOL gbUseEmulation; // user DDHEL or DDHAL ? +extern BOOL gbFullscreen; // window or fullscreen mode ? +extern HWND ghWndMain; // main window +extern DWORD gdwKeys; +extern int gnProgramState; // current state of program (rest, splash, active, etc.) +extern RECT grcWindow; // client window rectangle +extern BOOL gbFullscreen; // fullscreen or window mode ? +extern HINSTANCE ghinst; // application instance handle +extern TCHAR gtszClassName[]; // Duel's class name + + +/* + * Globals + */ +LPDIRECTDRAWSURFACE glpFrontBuffer; // primary surface +LPDIRECTDRAWSURFACE glpBackBuffer; // back buffer for animation +LPDIRECTDRAWSURFACE glpSplash; // splash screen +LPDIRECTDRAWSURFACE glpShip0; // ship bitmaps +LPDIRECTDRAWSURFACE glpShip1; +LPDIRECTDRAWSURFACE glpShip2; +LPDIRECTDRAWSURFACE glpShip3; +LPDIRECTDRAWSURFACE glpNum; // Numbers bitmap +LPDIRECTDRAW glpDD; // DirectDraw interface +LPDIRECTDRAWPALETTE glpArtPalette=NULL; // Game screen palette +LPDIRECTDRAWPALETTE glpSplashPalette=NULL; // Splash screen palette +LPDIRECTDRAWCLIPPER glpClipper=NULL; // Clipper for front buffer +DWORD gdwFillColor; +int gnGameBPP; // primary surface bit depth +#ifdef DEBUG +BOOL gbHELBlt = FALSE; +#endif + +BOOL InitGraphics( void ) +{ + DDCAPS ddcaps; + HRESULT ddrval; + DDSURFACEDESC ddsd; + DDSCAPS ddscaps; + TCHAR tszTitle[MAX_WINDOWTITLE]; + + LoadString(ghinst, IDS_DUEL_TITLE, tszTitle, MAX_WINDOWTITLE); + + // Create a window + ghWndMain = CreateWindowEx( + WS_EX_APPWINDOW, // WS_EX_TOPMOST, + gtszClassName, + tszTitle, + // don't show the window yet + WS_POPUP | // non-app window POPUP + WS_SYSMENU, // so we get an icon in the tray + 0, + 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + NULL, + NULL, + ghinst, + NULL ); + + if( !ghWndMain ) + { + return FALSE; + } + + UpdateWindow( ghWndMain ); + SetFocus( ghWndMain ); + + // ddraw stuff begins here + if( gbUseEmulation ) + ddrval = DirectDrawCreate( (LPVOID) DDCREATE_EMULATIONONLY, &glpDD, NULL ); + else + ddrval = DirectDrawCreate( NULL, &glpDD, NULL ); + + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_DDC); + + // set access mode based on fullscreen/window + if (gbFullscreen) + { + ddrval = glpDD->lpVtbl->SetCooperativeLevel( glpDD, ghWndMain, + DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); + } + else + { + ddrval = glpDD->lpVtbl->SetCooperativeLevel( glpDD, ghWndMain, + DDSCL_NORMAL); + } + + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_SCL); + + if (gbFullscreen) + { + // set the mode to 640 by 480 by 8 + ddrval = glpDD->lpVtbl->SetDisplayMode( glpDD, 640, 480, 8 ); + + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_SDM); + } + else + { + RECT rcWork; + RECT rc; + HDC hdc; + DWORD dwStyle; + + // + // when in rome (I mean when in windows) we should use the + // current mode + // + hdc = GetDC(NULL); + gnGameBPP = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL); + ReleaseDC(NULL, hdc); + + // + // if we are still a WS_POPUP window we should convert to a + // normal app window so we look like a windows app. + // + dwStyle = GetWindowStyle(ghWndMain); + dwStyle &= ~WS_POPUP; + dwStyle |= WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX; + SetWindowLong(ghWndMain, GWL_STYLE, dwStyle); + + // set window size + SetRect(&rc, 0, 0, MAX_DEFWIN_X, MAX_DEFWIN_Y); + + AdjustWindowRectEx(&rc, + GetWindowStyle(ghWndMain), + GetMenu(ghWndMain) != NULL, + GetWindowExStyle(ghWndMain)); + + SetWindowPos(ghWndMain, NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, + SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + + SetWindowPos(ghWndMain, HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); + + // + // make sure our window does not hang outside of the work area + // this will make people who have the tray on the top or left + // happy. + // + SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWork, 0); + GetWindowRect(ghWndMain, &rc); + if (rc.left < rcWork.left) rc.left = rcWork.left; + if (rc.top < rcWork.top) rc.top = rcWork.top; + SetWindowPos(ghWndMain, NULL, rc.left, rc.top, 0, 0, + SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + } + + // check the color key hardware capabilities + ddcaps.dwSize = sizeof( ddcaps ); + + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + + if (gbFullscreen) + { + // Create surfaces + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | + DDSCAPS_COMPLEX; + ddsd.dwBackBufferCount = 1; + ddrval = glpDD->lpVtbl->CreateSurface( glpDD, &ddsd, &glpFrontBuffer, NULL ); + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_CSFB); + + // get a pointer to the back buffer + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + ddrval = glpFrontBuffer->lpVtbl->GetAttachedSurface( + glpFrontBuffer, + &ddscaps, + &glpBackBuffer ); + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_GAS); + } + else + { + // window case, create the primary surface + // and create a backbuffer in offscreen memory + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + ddrval = glpDD->lpVtbl->CreateSurface( glpDD, &ddsd, &glpFrontBuffer, NULL ); + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_CSFB); + + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + + ddsd.dwWidth = MAX_DEFWIN_X; + ddsd.dwHeight = MAX_DEFWIN_Y; + ddrval = glpDD->lpVtbl->CreateSurface( glpDD, &ddsd, &glpBackBuffer, NULL ); + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_CSBB); + + ddrval = glpDD->lpVtbl->CreateClipper(glpDD, 0, &glpClipper, NULL); + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_CC); + + ddrval = glpClipper->lpVtbl->SetHWnd(glpClipper, 0, ghWndMain); + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_SH); + + ddrval = glpFrontBuffer->lpVtbl->SetClipper(glpFrontBuffer, glpClipper); + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_SC); + } + + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; +#ifdef DEBUG + if( gbHELBlt ) + ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; +#endif + + ddsd.dwWidth = 320; + ddsd.dwHeight = 128; + ddrval = glpDD->lpVtbl->CreateSurface( glpDD, &ddsd, &glpShip0, NULL ); + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_CSS0); + + ddsd.dwWidth = 320; + ddsd.dwHeight = 128; + ddrval = glpDD->lpVtbl->CreateSurface( glpDD, &ddsd, &glpShip1, NULL ); + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_CSS1); + + ddsd.dwWidth = 320; + ddsd.dwHeight = 128; + ddrval = glpDD->lpVtbl->CreateSurface( glpDD, &ddsd, &glpShip2, NULL ); + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_CSS2); + + ddsd.dwWidth = 320; + ddsd.dwHeight = 128; + ddrval = glpDD->lpVtbl->CreateSurface( glpDD, &ddsd, &glpShip3, NULL ); + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_CSS3); + + ddsd.dwHeight = 16; + ddrval = glpDD->lpVtbl->CreateSurface( glpDD, &ddsd, &glpNum, NULL ); + if( ddrval != DD_OK ) + return ShowError(IDS_DDRAW_ERROR_CSN); + + if( !RestoreSurfaces() ) + return ShowError(IDS_DDRAW_ERROR_RS); + + gdwKeys = 0; + ShowWindow(ghWndMain, SW_SHOW); + return TRUE; +} + +void CleanupGraphics(void) +{ + if( glpShip0 != NULL ) + glpShip0->lpVtbl->Release( glpShip0 ); + + if( glpShip1 != NULL ) + glpShip1->lpVtbl->Release( glpShip1 ); + + if( glpShip2 != NULL ) + glpShip2->lpVtbl->Release( glpShip2 ); + + if( glpShip3 != NULL ) + glpShip3->lpVtbl->Release( glpShip3 ); + + if( glpNum != NULL ) + glpNum->lpVtbl->Release( glpNum ); + + if (!gbFullscreen && glpClipper) + glpClipper->lpVtbl->Release( glpClipper ); + + if( glpFrontBuffer != NULL ) + glpFrontBuffer->lpVtbl->Release( glpFrontBuffer ); + + if( glpArtPalette != NULL ) + glpArtPalette->lpVtbl->Release( glpArtPalette ); + + if( glpSplashPalette != NULL ) + glpSplashPalette->lpVtbl->Release( glpSplashPalette ); + + if( !gbFullscreen && (glpBackBuffer != NULL )) + glpBackBuffer->lpVtbl->Release( glpBackBuffer ); + + if( glpDD != NULL ) + glpDD->lpVtbl->Release( glpDD ); +} + +void bltSplash( LPRECT rc) +{ + HRESULT ddrval; + HBITMAP hbm; + + if( ( glpFrontBuffer == NULL ) || + ( glpSplashPalette == NULL ) || + ( glpBackBuffer == NULL ) ) + { + return; + } + + // set the palette before loading the splash screen + glpFrontBuffer->lpVtbl->SetPalette( glpFrontBuffer, glpSplashPalette ); + + hbm = (HBITMAP)LoadImage( GetModuleHandle( NULL ), TEXT("SPLASH"), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION ); + if ( NULL == hbm ) + return; + + // if the surface is lost, DDCopyBitmap will fail and the surface will + // be restored below. + ddrval = DDCopyBitmap( glpBackBuffer, hbm, 0, 0, 0, 0 ); + + DeleteObject( hbm ); + + while( 1 ) + { + if( NULL == rc) + { + ddrval = glpFrontBuffer->lpVtbl->Blt( glpFrontBuffer, + &grcWindow, glpBackBuffer, NULL, DDBLT_WAIT, NULL); + } + else + { + ddrval = glpFrontBuffer->lpVtbl->Blt( glpFrontBuffer, + &grcWindow, glpBackBuffer, rc, DDBLT_WAIT, NULL); + } + + if( ddrval == DD_OK ) + return; + if( ddrval == DDERR_SURFACELOST ) + if( !RestoreSurfaces() ) + return; + if( ddrval != DDERR_WASSTILLDRAWING ) + return; + } +} + +void bltScore( char *num, int x, int y ) +{ + char *c; + RECT src; + int i; + + for(c=num; *c != '\0'; c++) + { + i = *c - '0'; + src.left = i*16; + src.top = 0; + src.right = src.left + 16; + src.bottom = src.top + 16; + bltObject( x, y, glpNum, &src, DDBLTFAST_SRCCOLORKEY ); + x += 16; + } +} + +void bltObject( int x, int y, LPDIRECTDRAWSURFACE surf, LPRECT src, DWORD flags ) +{ + HRESULT ddrval; + + while( 1 ) + { + ddrval = glpBackBuffer->lpVtbl->BltFast( glpBackBuffer, x, y, surf, src, flags ); + if( ddrval == DD_OK ) + return; + if( ddrval == DDERR_SURFACELOST ) + if( !RestoreSurfaces() ) + return; + if( ddrval != DDERR_WASSTILLDRAWING ) + return; + } +} + +void EraseScreen( void ) +{ + DDBLTFX ddbltfx; + HRESULT ddrval; + + // Erase the background + ddbltfx.dwSize = sizeof( ddbltfx ); + ddbltfx.dwFillColor = gdwFillColor; + while( 1 ) + { + ddrval = glpBackBuffer->lpVtbl->Blt( glpBackBuffer, NULL, NULL, + NULL, DDBLT_COLORFILL, &ddbltfx ); + + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + if( !RestoreSurfaces() ) + return; + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + return; + } + } +} + +void FlipScreen( void ) +{ + HRESULT ddrval; + + // Flip the surfaces + if (gbFullscreen) + { + while( 1 ) + { + ddrval = glpFrontBuffer->lpVtbl->Flip( glpFrontBuffer, NULL, 0 ); + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + if( !RestoreSurfaces() ) + { + return; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + break; + } + } + } + else + { + ddrval = IDirectDrawSurface_Blt( + glpFrontBuffer, // dest surface + &grcWindow, // dest rect + glpBackBuffer, // src surface + NULL, // src rect (all of it) + DDBLT_WAIT, + NULL); + } +} + +BOOL RestoreSurfaces( void ) +{ + HRESULT ddrval; + HBITMAP hbm; + + ddrval = glpFrontBuffer->lpVtbl->Restore(glpFrontBuffer); + if( ddrval != DD_OK ) + return FALSE; + ddrval = glpBackBuffer->lpVtbl->Restore(glpBackBuffer); + if( ddrval != DD_OK ) + return FALSE; + ddrval = glpShip0->lpVtbl->Restore(glpShip0); + if( ddrval != DD_OK ) + return FALSE; + ddrval = glpShip1->lpVtbl->Restore(glpShip1); + if( ddrval != DD_OK ) + return FALSE; + ddrval = glpShip2->lpVtbl->Restore(glpShip2); + if( ddrval != DD_OK ) + return FALSE; + ddrval = glpShip3->lpVtbl->Restore(glpShip3); + if( ddrval != DD_OK ) + return FALSE; + ddrval = glpNum->lpVtbl->Restore(glpNum); + if( ddrval != DD_OK ) + return FALSE; + + // Create and set the palette for the splash bitmap + glpSplashPalette = DDLoadPalette( glpDD, TEXT("SPLASH") ); + if( NULL == glpSplashPalette ) + return FALSE; + + // Create and set the palette for the art bitmap + glpArtPalette = DDLoadPalette( glpDD, TEXT("Duel8") ); + if( NULL == glpArtPalette ) + return FALSE; + + // set the palette before loading the art + glpFrontBuffer->lpVtbl->SetPalette( glpFrontBuffer, glpArtPalette ); + + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), TEXT("Duel8"), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION ); + + if( NULL == hbm ) + return FALSE; + + ddrval = DDCopyBitmap( glpShip0, hbm, 0, 0, 320, 128 ); + if( ddrval != DD_OK ) + { + DeleteObject( hbm ); + return FALSE; + } + + ddrval = DDCopyBitmap( glpShip1, hbm, 0, 128, 320, 128 ); + if( ddrval != DD_OK ) + { + DeleteObject( hbm ); + return FALSE; + } + + ddrval = DDCopyBitmap( glpShip2, hbm, 0, 256, 320, 128 ); + if( ddrval != DD_OK ) + { + DeleteObject( hbm ); + return FALSE; + } + + ddrval = DDCopyBitmap( glpShip3, hbm, 0, 384, 320, 128 ); + if( ddrval != DD_OK ) + { + DeleteObject( hbm ); + return FALSE; + } + + ddrval = DDCopyBitmap( glpNum, hbm, 0, 512, 320, 16 ); + if( ddrval != DD_OK ) + { + DeleteObject( hbm ); + return FALSE; + } + + DeleteObject( hbm ); + + // set colorfill colors and color gdwKeys according to bitmap contents + gdwFillColor = DDColorMatch( glpShip0, CLR_INVALID ); + + DDSetColorKey( glpShip0, CLR_INVALID ); + DDSetColorKey( glpShip1, CLR_INVALID ); + DDSetColorKey( glpShip2, CLR_INVALID ); + DDSetColorKey( glpShip3, CLR_INVALID ); + DDSetColorKey( glpNum, CLR_INVALID ); + + return TRUE; +} + +void SetGamePalette(void) +{ + if (glpFrontBuffer) + glpFrontBuffer->lpVtbl->SetPalette( glpFrontBuffer, glpArtPalette ); +} + +void FlipToGDI(void) +{ + if (glpDD) + glpDD->lpVtbl->FlipToGDISurface( glpDD ); +} + + diff --git a/sdk/samples/duel/gfx.h b/sdk/samples/duel/gfx.h new file mode 100644 index 0000000..8391847 --- /dev/null +++ b/sdk/samples/duel/gfx.h @@ -0,0 +1,26 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: gfx.h + * Content: graphics routines include file + * + * + ***************************************************************************/ +#include "duel.h" +#include "ddraw.h" + +/* + * Prototypes + */ +BOOL InitGraphics( void ); +void CleanupGraphics(void); +void bltSplash( LPRECT ); +void bltScore( char *num, int x, int y ); +void bltObject( int x, int y, LPDIRECTDRAWSURFACE surf, LPRECT src, DWORD flags ); +void EraseScreen( void ); +void FlipScreen( void ); +BOOL RestoreSurfaces( void ); +void SetGamePalette(void); +void FlipToGDI(void); + diff --git a/sdk/samples/duel/input.c b/sdk/samples/duel/input.c new file mode 100644 index 0000000..c3d6b38 --- /dev/null +++ b/sdk/samples/duel/input.c @@ -0,0 +1,198 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: input.c + * Content: DirectInput functionality for Multi-player duel + * + * + ***************************************************************************/ + + +#include "input.h" +#include "gameproc.h" + +extern HINSTANCE ghinst; // program instance +extern HWND ghWndMain; // app window handle + +static LPDIRECTINPUT lpdi; // DirectInput interface +static LPDIRECTINPUTDEVICE lpdiKeyboard; // keyboard device interface +static BOOL fKeybdAcquired; // has the keyboard been acquired? + +extern DWORD gdwKeys; // gameplay keys + +/* +* +* InitInput +* +* Initialize DirectInput objects & devices +* +*/ +BOOL InitInput(void) +{ + GUID guid = GUID_SysKeyboard; + HRESULT hRes; + + // try to create di object + if(DirectInputCreate(ghinst, DIRECTINPUT_VERSION, &lpdi, NULL) != DI_OK) + { + ShowError(IDS_DINPUT_ERROR_DIC); + return FALSE; + } + + + // try to create keyboard device + if(lpdi->lpVtbl->CreateDevice(lpdi, &guid, &lpdiKeyboard, NULL) !=DI_OK) + { + ShowError(IDS_DINPUT_ERROR_CD); + return FALSE; + } + + // Tell DirectInput that we want to receive data in keyboard format + if (lpdiKeyboard->lpVtbl->SetDataFormat(lpdiKeyboard, &c_dfDIKeyboard) != DI_OK) + { + ShowError(IDS_DINPUT_ERROR_DF); + return FALSE; + } + + // set cooperative level + if(lpdiKeyboard->lpVtbl->SetCooperativeLevel(lpdiKeyboard, ghWndMain, + DISCL_NONEXCLUSIVE | DISCL_FOREGROUND) != DI_OK) + { + ShowError(IDS_DINPUT_ERROR_SP); + return FALSE; + } + + // try to acquire the keyboard + hRes = lpdiKeyboard->lpVtbl->Acquire(lpdiKeyboard); + if(SUCCEEDED(hRes)) + { + // keyboard was acquired + fKeybdAcquired = TRUE; + } + else + { + // keyboard was NOT acquired + fKeybdAcquired = FALSE; + } + + // if we get here, all objects were created successfully + return TRUE; + +} + + +/* +* +* DI_ReadKeys +* +* Use DirectInput to read game-play keys +* +*/ +void DI_ReadKeys(void) +{ + BYTE rgbKeybd[256]; + HRESULT hRes; + + hRes = lpdiKeyboard->lpVtbl->GetDeviceState(lpdiKeyboard, sizeof(rgbKeybd), rgbKeybd); + if(hRes != DI_OK) + { + if(hRes == DIERR_INPUTLOST) + { + // we lost control of the keyboard, reacquire + fKeybdAcquired = FALSE; + if(SUCCEEDED(lpdiKeyboard->lpVtbl->Acquire(lpdiKeyboard))) + { + fKeybdAcquired = TRUE; + } + } + + // failed to read the keyboard, just return + return; + } + + // reset key states + gdwKeys = gdwKeys ^ gdwKeys; + + // check & update key states + if(rgbKeybd[DIK_NUMPAD5] & 0x80) + gdwKeys |= KEY_STOP; + + if((rgbKeybd[DIK_NUMPAD2] & 0x80) || (rgbKeybd[DIK_DOWN] & 0x80)) + gdwKeys |= KEY_DOWN; + + if((rgbKeybd[DIK_NUMPAD4] & 0x80) || (rgbKeybd[DIK_LEFT] & 0x80)) + gdwKeys |= KEY_LEFT; + + if((rgbKeybd[DIK_NUMPAD6] & 0x80) || (rgbKeybd[DIK_RIGHT] & 0x80)) + gdwKeys |= KEY_RIGHT; + + if((rgbKeybd[DIK_NUMPAD8] & 0x80) || (rgbKeybd[DIK_UP] & 0x80)) + gdwKeys |= KEY_UP; + + if(rgbKeybd[DIK_SPACE] & 0x80) + gdwKeys |= KEY_FIRE; + +} + +/* +* +* CleanupInput +* +* Cleans up DirectInput objects +* +*/ +void CleanupInput(void) +{ + if(fKeybdAcquired) + { + lpdiKeyboard->lpVtbl->Unacquire(lpdiKeyboard); + fKeybdAcquired = FALSE; + } + + if(lpdiKeyboard != NULL) + lpdiKeyboard->lpVtbl->Release(lpdiKeyboard); + + if(lpdi!= NULL) + lpdi->lpVtbl->Release(lpdi); + +} + + +/* +* +* ReacquireInputDevices +* +* Reacquires DirectInput devices as needed +* +*/ +BOOL ReacquireInputDevices(void) +{ + // try to acquire the keyboard + if(lpdiKeyboard != NULL) + { + lpdiKeyboard->lpVtbl->Acquire(lpdiKeyboard); + } + else + { + // keyboard device has not been created. + fKeybdAcquired = FALSE; + return FALSE; + } + + // if we get here, we are acquired again + fKeybdAcquired = TRUE; + return TRUE; +} + + + + + + + + + + + + diff --git a/sdk/samples/duel/input.h b/sdk/samples/duel/input.h new file mode 100644 index 0000000..46692a9 --- /dev/null +++ b/sdk/samples/duel/input.h @@ -0,0 +1,27 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: input.h + * Content: input routines include file + * + * + ***************************************************************************/ + +#ifndef _INPUT_H +#define _INPUT_H + +#include <dinput.h> +#include "duel.h" + +BOOL InitInput(void); +BOOL CALLBACK DI_EnumDevProc(LPDIDEVICEINSTANCE lpdidi, LPVOID lpv); +void DI_ReadKeys(void); +void CleanupInput(void); +BOOL ReacquireInputDevices(void); + + +#endif // _INPUT_H + + + diff --git a/sdk/samples/duel/lboom.wav b/sdk/samples/duel/lboom.wav new file mode 100644 index 0000000..97cf0ca Binary files /dev/null and b/sdk/samples/duel/lboom.wav differ diff --git a/sdk/samples/duel/lobby.c b/sdk/samples/duel/lobby.c new file mode 100644 index 0000000..e533a72 --- /dev/null +++ b/sdk/samples/duel/lobby.c @@ -0,0 +1,130 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: lobby.c + * Content: DirectPlayLobby related code + * + * + ***************************************************************************/ +#include "lobby.h" + +/* + * Externals + */ +extern LPDIRECTPLAY2 glpDP; // directplay object pointer + +/* + * Globals + */ +LPDPLCONNECTION glpdplConnection; // connection settings + +/* + * Statics + */ +static LPDIRECTPLAYLOBBY glpDPL; // lobby object pointer + + + +/* + * DPLobbyCreate + * + * Wrapper for DirectPlayLobby DirectPlayLobbyCreate API. + */ +HRESULT DPLobbyCreate(void) +{ + HRESULT hr=E_FAIL; + + hr = DirectPlayLobbyCreate(NULL, &glpDPL, NULL, NULL, 0); + + return hr; +} + +/* + * DPLobbyConnect + * + * Wrapper for DirectPlayLobby Connect API. + */ +HRESULT DPLobbyConnect(void) +{ + HRESULT hr=E_FAIL; + + hr = IDirectPlayLobby_Connect(glpDPL, 0, &glpDP, NULL) ; + + return hr; +} + +/* + * DPLobbyGetConnectionSettings + * + * Wrapper for DirectPlayLobby GetConnectionSettings API + */ +HRESULT DPLobbyGetConnectionSettings(void) +{ + HRESULT hr=E_FAIL; + DWORD dwSize; + + if (glpDPL) + { + // get size for the connection settings structure + hr = IDirectPlayLobby_GetConnectionSettings(glpDPL, 0, NULL, &dwSize); + if (DPERR_BUFFERTOOSMALL == hr) + { + // if we already have one, free it + if (glpdplConnection) + { + free(glpdplConnection); + glpdplConnection = NULL; + } + + // allocate memory for the new one + glpdplConnection = (LPDPLCONNECTION) malloc(dwSize); + + // get the connection settings + if (glpdplConnection) + hr = IDirectPlayLobby_GetConnectionSettings(glpDPL, 0, glpdplConnection, &dwSize); + } + } + + return hr; +} + +/* + * DPLobbyRelease + * + * Wrapper for DirectPlayLobby Release API + */ +HRESULT DPLobbyRelease(void) +{ + HRESULT hr=E_FAIL; + + // free our connection settings + if (glpdplConnection) + { + free(glpdplConnection); + glpdplConnection = NULL; + } + + // release the lobby object + if (glpDPL) + { + hr = IDirectPlayLobby_Release(glpDPL); + glpDPL = NULL; + } + return hr; +} + +/* + * DPLobbySetConnectionSettings + * + * Wrapper for DirectPlayLobby SetConnectionSettings API + */ +HRESULT DPLobbySetConnectionSettings(void) +{ + HRESULT hr=E_FAIL; + + hr = IDirectPlayLobby_SetConnectionSettings(glpDPL, 0, 0, glpdplConnection); + + return hr; +} + diff --git a/sdk/samples/duel/lobby.h b/sdk/samples/duel/lobby.h new file mode 100644 index 0000000..50eeefc --- /dev/null +++ b/sdk/samples/duel/lobby.h @@ -0,0 +1,25 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: lobby.h + * Content: lobby related routines include file + * + * + ***************************************************************************/ +#include <dplobby.h> +#include "duel.h" + +/* + * Prototypes + */ + +HRESULT DPLobbyCreate(void); +HRESULT DPLobbyConnect(void); +HRESULT DPLobbyGetConnectionSettings(void); +HRESULT DPLobbyRelease(void); +HRESULT DPLobbySetConnectionSettings(void); + + + + diff --git a/sdk/samples/duel/makefile b/sdk/samples/duel/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/duel/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/duel/msvc.mk b/sdk/samples/duel/msvc.mk new file mode 100644 index 0000000..7d7dcb3 --- /dev/null +++ b/sdk/samples/duel/msvc.mk @@ -0,0 +1,42 @@ +NAME = duel +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib dplayx.lib\ + comdlg32.lib gdi32.lib winmm.lib libc.lib comctl32.lib dinput.lib \ + dsound.lib + +OBJS = duel.obj ddutil.obj util.obj wizard.obj gameproc.obj gfx.obj \ + comm.obj input.obj lobby.obj ds3dutil.obj sfx.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/duel/osession.bmp b/sdk/samples/duel/osession.bmp new file mode 100644 index 0000000..dfe68d0 Binary files /dev/null and b/sdk/samples/duel/osession.bmp differ diff --git a/sdk/samples/duel/player.bmp b/sdk/samples/duel/player.bmp new file mode 100644 index 0000000..babfc1a Binary files /dev/null and b/sdk/samples/duel/player.bmp differ diff --git a/sdk/samples/duel/readme.txt b/sdk/samples/duel/readme.txt new file mode 100644 index 0000000..296cf07 --- /dev/null +++ b/sdk/samples/duel/readme.txt @@ -0,0 +1,31 @@ +Duel Sample Game +------------------ + +This program requires less than 1 Meg of video ram. + +The commands which this game recognizes are listed on the opening screen. + + ESC, F12 - Quit + NUMPAD 4 - Turn left + NUMPAD 6 - Turn right + NUMPAD 5 - Stop moving + NUMPAD 8 - Accelerate forward + NUMPAD 2 - Accelerate backward + SPACEBAR - Fire + ENTER - Starts game + F5 - toggle frame rate display + + +To play multiplayer one machine hosts a game, the others join. + +To play using TCP/IP over the Internet, the people who are joining the +game must enter the IP address of the machine that hosted the game. +You can find out the IP address of your machine by running "winipcfg". +If you have a net card and a modem installed, you will need to make +sure you read the IP address of the modem connection to the Internet. +The modem will show up as a "PPP Adapter". DirectPlay will not work +through proxies or firewalls. + +Also see the DPLAUNCH example. + + diff --git a/sdk/samples/duel/resource.h b/sdk/samples/duel/resource.h new file mode 100644 index 0000000..200d821 --- /dev/null +++ b/sdk/samples/duel/resource.h @@ -0,0 +1,103 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by duel.rc +// +#define IDS_DDRAW_ERROR_DDC 1 +#define IDS_DDRAW_ERROR_SCL 2 +#define IDS_DDRAW_ERROR_SDM 3 +#define IDS_DDRAW_ERROR_CSFB 4 +#define IDS_DDRAW_ERROR_GAS 5 +#define IDS_DDRAW_ERROR_CC 6 +#define IDS_DDRAW_ERROR_SH 7 +#define IDS_DDRAW_ERROR_SC 8 +#define IDS_DDRAW_ERROR_CSS0 9 +#define IDS_DDRAW_ERROR_CSS1 10 +#define IDS_DDRAW_ERROR_CSS2 11 +#define IDS_DDRAW_ERROR_CSS3 12 +#define IDS_DDRAW_ERROR_CSN 13 +#define IDS_DDRAW_ERROR_RS 14 +#define IDS_DINPUT_ERROR_DIC 15 +#define IDS_DINPUT_ERROR_ED 16 +#define IDS_DINPUT_ERROR_CD 17 +#define IDS_DINPUT_ERROR_SP 18 +#define IDS_DINPUT_ERROR_A 19 +#define IDS_DPLAY_ERROR_CP 20 +#define IDS_DPLAY_ERROR_JS 21 +#define IDS_DPLAY_ERROR_CS 22 +#define IDS_DDRAW_ERROR_CSBB 23 +#define IDS_DUEL_CLASSNAME 24 +#define IDS_DUEL_MSG_UNKNOWN 25 +#define IDS_DUEL_ERROR_TITLE 26 +#define IDS_DUEL_TITLE 27 +#define IDS_WIZARD_FONTNAME 29 +#define IDS_WIZARD_TITLE_SP 30 +#define IDS_WIZARD_TITLE_GS 31 +#define IDS_WIZARD_TITLE_JS 32 +#define IDS_WIZARD_TITLE_HS 33 +#define IDS_WIZARD_TITLE 34 +#define IDS_DUEL_HELP 35 +#define IDS_DDUTIL_ERROR_LI 36 +#define IDS_DDUTIL_ERROR_DDCB 37 +#define IDS_DDUTIL_ERROR_CCDC 38 +#define IDS_WIZARD_ERROR_GSG 39 +#define IDS_DINPUT_ERROR_DF 40 +#define IDS_DPLAY_ERROR_IDC 41 +#define IDS_DSOUND_LOADWAVES 42 +#define IDS_DSOUND_DUPBUF 43 +#define IDS_DPLAY_ERROR_SL 44 +#define IDS_DPLAY_ERROR_GPLD 45 +#define IDS_DPLAY_ERROR_SPLD 46 +#define IDS_DPLAY_ERROR_GPRD 47 +#define IDS_DPLAY_ERROR_SPRD 48 +#define IDS_DPLAY_ERROR_GSD 49 +#define IDS_DPLAY_ERROR_EP 50 +#define IDS_DPLAY_ERROR_ES 51 +#define IDS_DUEL_ERROR_CRT 52 +#define IDS_DPLAY_ERROR_C 52 +#define IDS_DUEL_ERROR_CRE 53 +#define IDS_DPLAY_ERROR_R 53 +#define IDS_DPLAY_ERROR_DP 54 +#define IDS_DPLOBBY_ERROR_R 55 +#define IDS_DPLOBBY_ERROR_GC 56 +#define IDS_DPLOBBY_ERROR_GCS 56 +#define IDS_DPLOBBY_ERROR_SCS 57 +#define IDS_DPLOBBY_ERROR_C 58 +#define IDS_DPLOBBY_ERROR_CONNECT 59 +#define IDS_DUEL_HOST_TITLE 60 +#define IDS_DUEL_HOST_RELIABLE_TITLE 61 +#define IDS_DUEL_RELIABLE_TITLE 62 +#define IDB_OPEN_SESSION 101 +#define IDB_CLOSED_SESSION 102 +#define IDB_PLAYER 103 +#define DUEL_ICON 104 +#define IDD_GAMESETUP 108 +#define IDD_CONNECT_STATUS 114 +#define IDD_CHOOSEPROVIDER 129 +#define IDD_JOINSESSION 130 +#define IDD_HOSTSESSION 131 +#define IDC_HOST_PLAYERNAME 1001 +#define IDC_SP_TITLE 1003 +#define IDC_GAMESETUP_TITLE 1004 +#define IDC_HOST_TITLE 1005 +#define IDC_HOST_SESSION_TITLE 1006 +#define IDC_HOST_PLAYER_TITLE 1007 +#define IDC_JOIN_SESSION_TITLE 1008 +#define IDC_JOIN_PLAYER_TITLE 1009 +#define IDC_DUEL_STATUSTEXT 1010 +#define IDC_SERVICEPROVIDERS 1021 +#define IDC_JOIN_SESSION 1024 +#define IDC_HOST_SESSIONNAME 1025 +#define IDC_JOIN_PLAYERNAME 1026 +#define IDC_HOSTSESSION 1027 +#define IDC_JOINSESSION 1028 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 115 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1011 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sdk/samples/duel/sboom.wav b/sdk/samples/duel/sboom.wav new file mode 100644 index 0000000..a3e2ac4 Binary files /dev/null and b/sdk/samples/duel/sboom.wav differ diff --git a/sdk/samples/duel/sbounce.wav b/sdk/samples/duel/sbounce.wav new file mode 100644 index 0000000..8b651e0 Binary files /dev/null and b/sdk/samples/duel/sbounce.wav differ diff --git a/sdk/samples/duel/sengine.wav b/sdk/samples/duel/sengine.wav new file mode 100644 index 0000000..7e56b2a Binary files /dev/null and b/sdk/samples/duel/sengine.wav differ diff --git a/sdk/samples/duel/sfx.c b/sdk/samples/duel/sfx.c new file mode 100644 index 0000000..e0e7589 --- /dev/null +++ b/sdk/samples/duel/sfx.c @@ -0,0 +1,209 @@ +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: sfx.c + * Content: Routines + * + * + ***************************************************************************/ +#include "resource.h" +#include "duel.h" +#include "ds3dutil.h" +#include "sfx.h" + +/***************************** EXTERNALS ***************************/ +extern HWND ghWndMain; + +/******************************* GLOBAL VARIABLES ***************************/ +LPDIRECTSOUND glpDirectSound; +LPDIRECTSOUND3DLISTENER glpDirectSound3DListener; +LPDIRECTSOUNDBUFFER glpPrimaryBuffer; +LPWAVEDATA gSoundEffect[MAX_SOUNDS]; + +_TCHAR *szResourceName[MAX_SOUNDS] = +{_T("BFIRE"), //Bullet Firing + _T("SBOOM"), //Ship Exploding + _T("SENGINE"),//Ship Engine + _T("SSTART"), //Starting Engine + _T("SSTOP"), //Stopping Engine (key 5) + _T("SBOUNCE"),//Bouncing off a block or window edge + _T("LBOOM")}; //Block destruction + +BOOL gbSoundInitialized = FALSE; //did the sound engine initialize or not? + +/***************************** FUNCTION PROTOTYPES **************************/ +BOOL Init_Sounds(void); +void Free_Sounds(void); +BOOL Init_Globals(void); +void Free_Globals(void); + +/**************************************************************************** +FUNCTION: InitSfx + + +PURPOSE: Initializes global variables, then loads the gSoundEffect "objects" + with sound data. This should always return TRUE. If for some reason + sound can't be initialized, then it will note that fact and still + return TRUE. +*****************************************************************************/ +BOOL InitSfx(void) +{ +if (Init_Globals()) + { + if (Init_Sounds()) + { + gbSoundInitialized=TRUE; + return TRUE; + } + Free_Globals(); + } +gbSoundInitialized = FALSE; +return TRUE; +}; + + + +/**************************************************************************** +FUNCTION: CleanupSfx + +PURPOSE: Frees everything that was allocated by InitSfx, if it was + successfully initialized in the beginning. +*****************************************************************************/ +void CleanupSfx(void) +{ +if (gbSoundInitialized) + { + Free_Sounds(); + Free_Globals(); + } +}; + +/**************************************************************************** +FUNCTION: Init_Globals + +PURPOSE: Initializes the three main global variables. After this is done, + we should have allocated: + a. A DirectSound Object + b. A DirectSound3DListener Object + c. A Primary Buffer (16 bit, stereo, 22050khz) + + These are all global. +*****************************************************************************/ +BOOL Init_Globals(void) +{ +PCMWAVEFORMAT pcmwf; +DSBUFFERDESC dsbdesc; + +if (DS_OK == DirectSoundCreate(NULL, &glpDirectSound, NULL)) + { + memset(&pcmwf, 0, sizeof(PCMWAVEFORMAT)); + pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM; + pcmwf.wf.nChannels = 2; + pcmwf.wf.nSamplesPerSec = 22050; + pcmwf.wf.nBlockAlign = 4; + pcmwf.wf.nAvgBytesPerSec = pcmwf.wf.nSamplesPerSec * pcmwf.wf.nBlockAlign; + pcmwf.wBitsPerSample = 16; + memset(&dsbdesc, 0, sizeof(DSBUFFERDESC)); + dsbdesc.dwSize = sizeof(DSBUFFERDESC); + dsbdesc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_CTRL3D; + dsbdesc.dwBufferBytes = 0; //dwBufferBytes and lpwfxFormat must be set this way. + dsbdesc.lpwfxFormat = NULL; + + if (DS_OK== IDirectSound_SetCooperativeLevel(glpDirectSound, ghWndMain,DSSCL_NORMAL)) + { + if (DS_OK== IDirectSound_CreateSoundBuffer(glpDirectSound, &dsbdesc, &glpPrimaryBuffer, NULL)) + { + if (DS_OK==glpPrimaryBuffer->lpVtbl->QueryInterface(glpPrimaryBuffer, &IID_IDirectSound3DListener, (void **)&glpDirectSound3DListener)) + { + if (DS_OK==IDirectSound3DListener_SetPosition(glpDirectSound3DListener, 0.f, 0.f, -1.f, DS3D_DEFERRED)) + { + if (DS_OK==IDirectSound3DListener_SetDopplerFactor(glpDirectSound3DListener, 9.9f ,DS3D_DEFERRED)) + { + if (DS_OK==IDirectSound3DListener_SetRolloffFactor(glpDirectSound3DListener, 0.25f ,DS3D_DEFERRED)) + { + if (DS_OK==IDirectSound3DListener_CommitDeferredSettings(glpDirectSound3DListener)) + { + return TRUE; + } + } + } + } + IDirectSound3DListener_Release(glpDirectSound3DListener); + } + glpPrimaryBuffer->lpVtbl->Release(glpPrimaryBuffer); + } + } + IDirectSound_Release(glpDirectSound); + } +return (FALSE); +}; + + +/***************************************************************************** +FUNCTION: Free_Globals + +PURPOSE: Frees up all three of the global interfaces that were created by + Init_Globabls. + + NOTES: Free_Sounds MUST be called before this. +*****************************************************************************/ +void Free_Globals(void) +{ +if (glpPrimaryBuffer!=NULL) + glpPrimaryBuffer->lpVtbl->Release(glpPrimaryBuffer); +if (glpDirectSound3DListener!=NULL) + IDirectSound3DListener_Release(glpDirectSound3DListener); +if (glpDirectSound!=NULL) + IDirectSound_Release(glpDirectSound); +}; + + +/**************************************************************************** +FUNCTION: Init_Sounds + +PURPOSE: Loads the gSoundEffect array (of sound objects) with the correct + data from the WAVE resources, so that only a GetBuffers call needs + to be made to get access to the sound effects. + +NOTES: If this fails, all sound objects will end up uninitialized. + Init_Globals MUST be called before this function. +*****************************************************************************/ +BOOL Init_Sounds(void) +{ +int i; + +for (i=0; i<MAX_SOUNDS; i++) + { + if (FALSE==WaveInit(&gSoundEffect[i], glpDirectSound, szResourceName[i])) + { + gSoundEffect[i] = NULL; + for (--i; i>=0; i--) + { + WaveFree(gSoundEffect[i]); + gSoundEffect[i] = NULL; + } + ShowError(IDS_DSOUND_LOADWAVES); + return FALSE; + } + } +return TRUE; +}; + +/***************************************************************************** +FUNCTION: Free_Sounds + +PURPOSE: Frees up any sound objects that were loaded into memory. +*****************************************************************************/ +void Free_Sounds(void) +{int i; + +for (i=0; i<MAX_SOUNDS; i++) + { + if (gSoundEffect[i]!=NULL) + { + WaveFree(gSoundEffect[i]); + gSoundEffect[i] = NULL; + } + } +}; diff --git a/sdk/samples/duel/sfx.h b/sdk/samples/duel/sfx.h new file mode 100644 index 0000000..9cb9bb5 --- /dev/null +++ b/sdk/samples/duel/sfx.h @@ -0,0 +1,53 @@ +#ifndef SFX_HEADER +#define SFX_HEADER +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: sfx.h + * Content: Routines + * + * + ***************************************************************************/ + +#include <dsound.h> +#include "ds3dutil.h" +/******************* DEFINITIONS *************************** +These will be used to index the array of CSound3D objects. +*********************************************************/ +#define BFIRE 0 //Bullet Firing +#define SBOOM 1 //Ship Exploding +#define SENGINE 2 //Ship Engine +#define SSTART 3 //Starting Engine +#define SSTOP 4 //Stopping Engine (key 5) +#define SBOUNCE 5 //Bouncing off a block or window edge +#define LBOOM 6 //Block destruction + +#define MAX_SOUNDS 7 + +/******************* DEFINITIONS FOR SHARED INFO ************/ +#define ENGINE_STATE 0x00000001l // Set if Engine is running + + +/**************** CONVERSION MACROS ************************** +These would be faster if hard-coded, but are left like this +for readability. +**************************************************************/ +#define SCREEN_METERS D3DVAL(6) //(How many meters wide is the screen?) +#define PPM D3DVAL(640/SCREEN_METERS) //How many pixels per meter? +#define MPP D3DVAL(SCREEN_METERS/640.f) //How many meters per pixel? +#define P2M(x) D3DVAL(D3DVAL(x) * MPP) //converts pixels to meters +#define M2P(x) D3DVAL(D3DVAL(x) * PPM) //converts meters to pixels + +/****************** FUNCTION PROTOTYPES *********************/ +BOOL InitSfx(void); +void CleanupSfx(void); +/************************ VARIABLES *************************/ +extern LPWAVEDATA gSoundEffect[MAX_SOUNDS]; +extern BOOL gbSoundInitialized; +extern CHAR * gszResourceName[MAX_SOUNDS]; +extern LPDIRECTSOUND glpDirectSound; +extern LPDIRECTSOUND3DLISTENER glpDirectSound3DListener; +extern LPDIRECTSOUNDBUFFER glpPrimaryBuffer; + +#endif diff --git a/sdk/samples/duel/splash.bmp b/sdk/samples/duel/splash.bmp new file mode 100644 index 0000000..ca850ce Binary files /dev/null and b/sdk/samples/duel/splash.bmp differ diff --git a/sdk/samples/duel/sstart.wav b/sdk/samples/duel/sstart.wav new file mode 100644 index 0000000..a815627 Binary files /dev/null and b/sdk/samples/duel/sstart.wav differ diff --git a/sdk/samples/duel/sstop.wav b/sdk/samples/duel/sstop.wav new file mode 100644 index 0000000..a8a7d94 Binary files /dev/null and b/sdk/samples/duel/sstop.wav differ diff --git a/sdk/samples/duel/util.c b/sdk/samples/duel/util.c new file mode 100644 index 0000000..5017dcc --- /dev/null +++ b/sdk/samples/duel/util.c @@ -0,0 +1,236 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: util.c + * Content: miscellaneous functions + * + * + ***************************************************************************/ +#include "util.h" + +/* + * Globals + */ +static const BYTE GuidMap[] = { 3, 2, 1, 0, '-', 5, 4, '-', 7, 6, '-', + 8, 9, '-', 10, 11, 12, 13, 14, 15 }; +static const WCHAR wszDigits[] = L"0123456789ABCDEF"; + + +/* + * StringFromGUID + * + * Converts a GUID into a wide string + */ +int StringFromGUID(LPGUID lpguid, LPWSTR lpwsz) +{ + int i; + + const BYTE * pBytes = (const BYTE *) lpguid; + + *lpwsz++ = L'{'; + + for (i = 0; i < sizeof(GuidMap); i++) + { + if (GuidMap[i] == '-') + { + *lpwsz++ = L'-'; + } + else + { + *lpwsz++ = wszDigits[ (pBytes[GuidMap[i]] & 0xF0) >> 4 ]; + *lpwsz++ = wszDigits[ (pBytes[GuidMap[i]] & 0x0F) ]; + } + } + *lpwsz++ = L'}'; + *lpwsz = L'\0'; + + return GUIDSTR_MAX; +} + +/* + * IsEqualGuid + * + * Determines if two guids are equal + */ +BOOL IsEqualGuid(GUID *lpguid1, GUID *lpguid2) +{ + return ( + ((PLONG) lpguid1)[0] == ((PLONG) lpguid2)[0] && + ((PLONG) lpguid1)[1] == ((PLONG) lpguid2)[1] && + ((PLONG) lpguid1)[2] == ((PLONG) lpguid2)[2] && + ((PLONG) lpguid1)[3] == ((PLONG) lpguid2)[3]); +} + + +// convert a hex char to an int - used by str to guid conversion +// we wrote our own, since the ole one is slow, and requires ole32.dll +// we use ansi strings here, since guids won't get internationalized +int GetDigit(LPSTR lpstr) +{ + char ch = *lpstr; + + if (ch >= '0' && ch <= '9') + return(ch - '0'); + if (ch >= 'a' && ch <= 'f') + return(ch - 'a' + 10); + if (ch >= 'A' && ch <= 'F') + return(ch - 'A' + 10); + return(0); +} +// walk the string, writing pairs of bytes into the byte stream (guid) +// we need to write the bytes into the byte stream from right to left +// or left to right as indicated by fRightToLeft +void ConvertField(LPBYTE lpByte,LPSTR * ppStr,int iFieldSize,BOOL fRightToLeft) +{ + int i; + + for (i=0;i<iFieldSize ;i++ ) + { + // don't barf on the field separators + if ('-' == **ppStr) (*ppStr)++; + if (fRightToLeft == TRUE) + { + // work from right to left within the byte stream + *(lpByte + iFieldSize - (i+1)) = 16*GetDigit(*ppStr) + GetDigit((*ppStr)+1); + } + else + { + // work from left to right within the byte stream + *(lpByte + i) = 16*GetDigit(*ppStr) + GetDigit((*ppStr)+1); + } + *ppStr+=2; // get next two digit pair + } +} // ConvertField + + +// convert the passed in string to a real GUID +// walk the guid, setting each byte in the guid to the two digit hex pair in the +// passed string +HRESULT GUIDFromString(LPWSTR lpWStr, GUID * pGuid) +{ + BYTE * lpByte; // byte index into guid + int iFieldSize; // size of current field we're converting + // since its a guid, we can do a "brute force" conversion + char lpTemp[GUID_STRING_SIZE]; + char *lpStr = lpTemp; + + WideToAnsi(lpStr,lpWStr,GUID_STRING_SIZE); + + // make sure we have a {xxxx-...} type guid + if ('{' != *lpStr) return E_FAIL; + lpStr++; + + lpByte = (BYTE *)pGuid; + // data 1 + iFieldSize = sizeof(unsigned long); + ConvertField(lpByte,&lpStr,iFieldSize,TRUE); + lpByte += iFieldSize; + + // data 2 + iFieldSize = sizeof(unsigned short); + ConvertField(lpByte,&lpStr,iFieldSize,TRUE); + lpByte += iFieldSize; + + // data 3 + iFieldSize = sizeof(unsigned short); + ConvertField(lpByte,&lpStr,iFieldSize,TRUE); + lpByte += iFieldSize; + + // data 4 + iFieldSize = 8*sizeof(unsigned char); + ConvertField(lpByte,&lpStr,iFieldSize,FALSE); + lpByte += iFieldSize; + + // make sure we ended in the right place + if ('}' != *lpStr) + { + memset(pGuid,0,sizeof(GUID)); + return E_FAIL; + } + + return S_OK; +}// GUIDFromString + +/* + ** WideToAnsi + * + * CALLED BY: everywhere + * + * PARAMETERS: lpStr - destination string + * lpWStr - string to convert + * cchStr - size of dest buffer + * + * DESCRIPTION: + * converts unicode lpWStr to ansi lpStr. + * fills in unconvertable chars w/ DPLAY_DEFAULT_CHAR "-" + * + * + * RETURNS: if cchStr is 0, returns the size required to hold the string + * otherwise, returns the number of chars converted + * + */ +int WideToAnsi(LPSTR lpStr,LPWSTR lpWStr,int cchStr) +{ + + int rval; + BOOL bDefault; + + // use the default code page (CP_ACP) + // -1 indicates WStr must be null terminated + rval = WideCharToMultiByte(CP_ACP,0,lpWStr,-1,lpStr,cchStr,"-",&bDefault); + + return rval; + +} // WideToAnsi + +/* + ** AnsiToWide + * + * CALLED BY: everywhere + * + * PARAMETERS: lpWStr - dest string + * lpStr - string to convert + * cchWstr - size of dest buffer + * + * DESCRIPTION: converts Ansi lpStr to Unicode lpWstr + * + * + * RETURNS: if cchStr is 0, returns the size required to hold the string + * otherwise, returns the number of chars converted + * + */ +int AnsiToWide(LPWSTR lpWStr,LPSTR lpStr,int cchWStr) +{ + int rval; + + rval = MultiByteToWideChar(CP_ACP,0,lpStr,-1,lpWStr,cchWStr); + + return rval; +} // AnsiToWide + + +/* + * randInt + * + * returns a random integer in the specified range + */ +int randInt( int low, int high ) +{ + int range = high - low; + int num = rand() % range; + return( num + low ); +} + +/* + * randDouble + * + * returns a random double in the specified range + */ +double randDouble( double low, double high ) +{ + double range = high - low; + double num = range * (double)rand()/(double)RAND_MAX; + return( num + low ); +} + diff --git a/sdk/samples/duel/util.h b/sdk/samples/duel/util.h new file mode 100644 index 0000000..ae2e124 --- /dev/null +++ b/sdk/samples/duel/util.h @@ -0,0 +1,25 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: util.h + * Content: miscellaneous utilities include file + * + * + ***************************************************************************/ + +#include <windows.h> + +#define GUIDSTR_MAX 38 +#define GUID_STRING_SIZE 64 + +int StringFromGUID(GUID *lpguid, LPWSTR lpsz); +BOOL IsEqualGuid(GUID *lpguid1, LPGUID lpguid2); +int GetDigit(LPSTR lpstr); +void ConvertField(LPBYTE lpByte,LPSTR * ppStr,int iFieldSize,BOOL fRightToLeft); +HRESULT GUIDFromString(LPWSTR lpWStr, GUID * pGuid); +int WideToAnsi(LPSTR lpStr,LPWSTR lpWStr,int cchStr); +int AnsiToWide(LPWSTR lpWStr,LPSTR lpStr,int cchWStr); +int randInt( int low, int high ); +double randDouble( double low, double high ); + diff --git a/sdk/samples/duel/wizard.c b/sdk/samples/duel/wizard.c new file mode 100644 index 0000000..f06652a --- /dev/null +++ b/sdk/samples/duel/wizard.c @@ -0,0 +1,956 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: wizard.c + * Content: User input (setup wizard) related code + * + * + ***************************************************************************/ +#include <windows.h> +#include "prsht.h" +#include "wizard.h" +#include "util.h" +#include "comm.h" +#include "gameproc.h" + +/* + * Externals + */ +extern HINSTANCE ghinst; // program instance +extern HWND ghWndMain; // main window +extern BOOL gbIsHost; // is the user hosting/joining a game +extern DPID gOurID; // player id +extern LPGUID glpGuid; // duel's guid + +/* + * Globals to this module + */ +static HFONT ghTitleFont; // font for titles on setup wizard +static HFONT ghHeadingFont; // font for headings on setup wizard +static int gnSession,gnPlayer; // indexes for tree view images +static HKEY ghDuelKey=NULL; // duel registry key handle +static DWORD gdwDuelDisp; // key created or opened +static GUID gSPGuid; // currently selected service provider guid +static HTREEITEM ghtiSession; // points to a visible session item in tree control + // used for inserting players into tree control +static HWND ghWndSPCtl; // handle to service provider control + +/* + * SetupFonts + * + * Initializes font structures (used for wizard controls) + */ +void SetupFonts(HDC hDC) +{ + LOGFONT lf; + TCHAR tszFontName[MAX_FONTNAME]; + + LoadString(ghinst, IDS_WIZARD_FONTNAME, tszFontName, MAX_FONTNAME); + + ZeroMemory(&lf,sizeof(lf)); + lf.lfHeight = -MulDiv(11,GetDeviceCaps(hDC, LOGPIXELSY),72); + lf.lfWeight = 500; + lf.lfItalic = TRUE; + _tcscpy(lf.lfFaceName,tszFontName); + ghTitleFont = CreateFontIndirect(&lf); + + ZeroMemory(&lf,sizeof(lf)); + lf.lfHeight = -MulDiv(11,GetDeviceCaps(hDC, LOGPIXELSY),72); + lf.lfWeight = 500; + _tcscpy(lf.lfFaceName,tszFontName); + ghHeadingFont = CreateFontIndirect(&lf); +} + +/* + * CleanupFonts + * + * Cleans up font structures + */ +void CleanupFonts(void) +{ + if (ghTitleFont) DeleteObject(ghTitleFont); + if (ghHeadingFont) DeleteObject(ghHeadingFont); +} + +/* + * RegSet + * + * Stores a data value in the registry + */ +LONG RegSet(LPCTSTR lptszName, CONST BYTE * lpData, DWORD dwSize) +{ +#ifdef UNICODE + dwSize *= 2; // calc number of bytes +#endif + return RegSetValueEx(ghDuelKey, lptszName, 0, REG_SZ, lpData, dwSize); +} + +/* + * RegSetA + * + * Stores data as an ascii string in the registry + */ +LONG RegSetA(LPCTSTR lptszName, CONST BYTE * lpData, DWORD dwSize) +{ + return RegSetValueEx(ghDuelKey, lptszName, 0, REG_SZ, lpData, dwSize); +} + +/* + * RegGet + * + * Queries a value from the registry + */ +LONG RegGet(LPCTSTR lptszName, LPBYTE lpData, LPDWORD lpdwDataSize) +{ + DWORD dwType; + + return RegQueryValueEx(ghDuelKey, lptszName, NULL, &dwType, lpData, lpdwDataSize); +} + +/* + * DoWizard + * + * Creates and launches a wizard (property sheets) for user input + */ +DWORD WINAPI DoWizard(LPVOID pv) +{ + PROPSHEETPAGE psp[4]; + PROPSHEETHEADER psh; + TCHAR tszTitle1[MAX_WINDOWTITLE]; + TCHAR tszTitle2[MAX_WINDOWTITLE]; + TCHAR tszTitle3[MAX_WINDOWTITLE]; + TCHAR tszTitle4[MAX_WINDOWTITLE]; + TCHAR tszTitle5[MAX_WINDOWTITLE]; + + LoadString(ghinst, IDS_WIZARD_TITLE_SP, tszTitle1, MAX_WINDOWTITLE); + LoadString(ghinst, IDS_WIZARD_TITLE_GS, tszTitle2, MAX_WINDOWTITLE); + LoadString(ghinst, IDS_WIZARD_TITLE_JS, tszTitle3, MAX_WINDOWTITLE); + LoadString(ghinst, IDS_WIZARD_TITLE_HS, tszTitle4, MAX_WINDOWTITLE); + LoadString(ghinst, IDS_WIZARD_TITLE, tszTitle5, MAX_WINDOWTITLE); + + psp[0].dwSize = sizeof(PROPSHEETPAGE); + psp[0].dwFlags = PSP_USEICONID | PSP_USETITLE; + psp[0].hInstance = ghinst; + psp[0].pszTemplate = MAKEINTRESOURCE(IDD_CHOOSEPROVIDER); + psp[0].pszIcon = NULL; + psp[0].pfnDlgProc = DlgProcChooseProvider; + psp[0].pszTitle = tszTitle1; + psp[0].lParam = 0; + psp[0].pfnCallback = NULL; + + psp[1].dwSize = sizeof(PROPSHEETPAGE); + psp[1].dwFlags = PSP_USEICONID | PSP_USETITLE; + psp[1].hInstance = ghinst; + psp[1].pszTemplate = MAKEINTRESOURCE(IDD_GAMESETUP); + psp[1].pszIcon = NULL; + psp[1].pfnDlgProc = DlgProcGameSetup; + psp[1].pszTitle = tszTitle2; + psp[1].lParam = 0; + psp[1].pfnCallback = NULL; + + psp[2].dwSize = sizeof(PROPSHEETPAGE); + psp[2].dwFlags = PSP_USEICONID | PSP_USETITLE; + psp[2].hInstance = ghinst; + psp[2].pszTemplate = MAKEINTRESOURCE(IDD_JOINSESSION); + psp[2].pszIcon = NULL; + psp[2].pfnDlgProc = DlgProcJoinSession; + psp[2].pszTitle = tszTitle3; + psp[2].lParam = 0; + psp[2].pfnCallback = NULL; + + psp[3].dwSize = sizeof(PROPSHEETPAGE); + psp[3].dwFlags = PSP_USEICONID | PSP_USETITLE; + psp[3].hInstance = ghinst; + psp[3].pszTemplate = MAKEINTRESOURCE(IDD_HOSTSESSION); + psp[3].pszIcon = NULL; + psp[3].pfnDlgProc = DlgProcHostSession; + psp[3].pszTitle = tszTitle4; + psp[3].lParam = 0; + psp[3].pfnCallback = NULL; + + psh.dwSize = sizeof(PROPSHEETHEADER); + psh.dwFlags = PSH_USEICONID | PSH_PROPSHEETPAGE | PSH_WIZARD; + psh.hwndParent = ghWndMain; + psh.hInstance = ghinst; + psh.pszIcon = NULL; + psh.pszCaption = tszTitle5; + psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); + psh.nStartPage = 0; + psh.ppsp = (LPCPROPSHEETPAGE) &psp; + psh.pfnCallback = NULL; + + // open/create duel registry key + RegCreateKeyEx(HKEY_CURRENT_USER, + DUEL_KEY, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &ghDuelKey, + &gdwDuelDisp + ); + + // setup fonts + SetupFonts(GetDC(ghWndMain)); + + // launch the wizard + PropertySheet(&psh); + + // cleanup + CleanupFonts(); + + // was communication initialized correctly ? + if (IsDPlay()) + { + // if so, launch game + PostMessage( ghWndMain, UM_LAUNCH, 0, 0 ); + } + else + { + // otherwise, abort game + PostMessage( ghWndMain, UM_ABORT, 0, 0 ); + } + + return 0; +} + +/* + * EnumSP + * + * DirectPlayEnumerate callback. Stores the service provider information in the + * passed in list box control. + */ +BOOL WINAPI EnumSP(LPGUID lpGuid, LPTSTR lptszDesc, DWORD dwMajorVersion, + DWORD dwMinorVersion, LPVOID lpv) +{ + LONG iIndex; + HWND hWnd = (HWND) lpv; + LPGUID lpSPGuid; + + // insert service provider description in the list box item + iIndex = SendMessage(hWnd, LB_ADDSTRING, 0, (LPARAM) lptszDesc); + + // allocate memory to remember the service provider guid + lpSPGuid = (LPGUID) malloc(sizeof(GUID)); + if (!lpSPGuid) return FALSE; + + // copy guid + *lpSPGuid = *lpGuid; + + // store the service provider guid pointer as item data + if (iIndex != LB_ERR) + SendMessage(hWnd, LB_SETITEMDATA, iIndex, (LPARAM) lpSPGuid); + + return(TRUE); +} + +/* + * DlgProcChooseProvider + * + * Dialog procedure for the choose service provider dialog + */ +BOOL CALLBACK DlgProcChooseProvider(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + LPGUID lpGuid; + static LONG iIndex; + static HWND hWndCtl; + DWORD dwSize; + BYTE szSPGuid[GUIDSTR_MAX+1]; + WCHAR wszSPGuid[GUIDSTR_MAX+1]; + int i; + HRESULT hr; + + switch (msg) + { + case WM_NOTIFY: + switch (((NMHDR FAR *) lParam)->code) + { + case PSN_SETACTIVE: + PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_NEXT); + return(TRUE); + + case PSN_WIZNEXT: + // Release previously selected DPlay object, if any. + DPlayRelease(); + if (iIndex != LB_ERR) + { + lpGuid = (LPGUID) SendMessage(hWndCtl, LB_GETITEMDATA, iIndex, 0); + + if (lpGuid) + { + // remember the selection + gSPGuid = *lpGuid; + + // create directplay object + if ((hr = DPlayCreate(lpGuid)) == DP_OK) + { + return(TRUE); + } + else + { + ShowError(IDS_DPLAY_ERROR_IDC); + } + } + } + SetWindowLong(hDlg, DWL_MSGRESULT, -1); + return(TRUE); + + case PSN_QUERYCANCEL: + ReleaseSPData(); + DPlayRelease(); + return(TRUE); + } + break; + + case WM_INITDIALOG: + SendDlgItemMessage(hDlg, IDC_SP_TITLE, WM_SETFONT, (WPARAM)ghTitleFont, MAKELPARAM(TRUE,0)); + + hWndCtl = GetDlgItem(hDlg, IDC_SERVICEPROVIDERS); + if (hWndCtl == NULL) return(TRUE); + + // remember the service provider control. used later in freeing sp information. + ghWndSPCtl = hWndCtl; + DirectPlayEnumerate(EnumSP, (LPVOID)hWndCtl); + SetFocus(hWndCtl); + + // setup user's saved preferences + iIndex = 0; + dwSize = GUIDSTR_MAX+1; + if (ghDuelKey && (RegGet(TEXT("ServiceProvider"), szSPGuid, &dwSize) == ERROR_SUCCESS)) + { + AnsiToWide(wszSPGuid, szSPGuid, sizeof(szSPGuid)); + GUIDFromString(wszSPGuid, &gSPGuid); + + for (i=0; i<SendMessage(hWndCtl, LB_GETCOUNT, 0, 0); i++) + { + if (IsEqualGuid(&gSPGuid,(LPGUID)SendMessage(hWndCtl,LB_GETITEMDATA,i,0))) + { + iIndex = i; + break; + } + } + } + + SendMessage(hWndCtl, LB_SETCURSEL, iIndex, 0); + iIndex = SendMessage(hWndCtl, LB_GETCURSEL, 0, 0); + return(TRUE); + + case WM_COMMAND: + if ( HIWORD(wParam) == LBN_SELCHANGE) + { + iIndex = SendMessage(hWndCtl, LB_GETCURSEL, 0, 0); + + return(TRUE); + } + break; + } + return (FALSE); +} + +/* + * EnumSession + * + * EnumSessions callback. Inserts session description information in the passed in + * tree view control. + */ +BOOL WINAPI EnumSession(LPCDPSESSIONDESC2 lpDPSessionDesc, LPDWORD lpdwTimeOut, DWORD dwFlags, + LPVOID lpContext) +{ + HWND hWnd = (HWND) lpContext; + HTREEITEM hItem; + LPGUID lpGuid; + + if(dwFlags & DPESC_TIMEDOUT) return FALSE; // don't try again + + if (hWnd == NULL) return FALSE; + + // allocate memory to remember the guid + lpGuid = (LPGUID) malloc(sizeof(GUID)); + if (!lpGuid) return FALSE; + + *lpGuid = lpDPSessionDesc->guidInstance; +#ifdef UNICODE + hItem = AddItemToTree(hWnd, lpDPSessionDesc->lpszSessionName, (DWORD)lpGuid, 1); +#else + hItem = AddItemToTree(hWnd, lpDPSessionDesc->lpszSessionNameA, (DWORD)lpGuid, 1); +#endif + TreeView_SelectItem(hWnd, hItem); + + return(TRUE); +} + +/* + * DlgProcGameSetup + * + * Dialog procedure for the Game Setup Dialog. + */ +BOOL CALLBACK DlgProcGameSetup (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_NOTIFY: + switch (((NMHDR FAR *) lParam)->code) + { + case PSN_SETACTIVE: + PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT); + return(TRUE); + + case PSN_WIZNEXT: + if (gbIsHost) + SetWindowLong(hDlg, DWL_MSGRESULT, IDD_HOSTSESSION); + return(TRUE); + + case PSN_QUERYCANCEL: + ReleaseSPData(); + DPlayRelease(); + return(TRUE); + } + break; + + case WM_INITDIALOG: + // setup title fonts + SendDlgItemMessage(hDlg, IDC_GAMESETUP_TITLE, WM_SETFONT, (WPARAM)ghTitleFont, MAKELPARAM(TRUE,0)); + SendDlgItemMessage(hDlg, IDC_JOINSESSION, WM_SETFONT, (WPARAM)ghHeadingFont, MAKELPARAM(TRUE,0)); + SendDlgItemMessage(hDlg, IDC_HOSTSESSION, WM_SETFONT, (WPARAM)ghHeadingFont, MAKELPARAM(TRUE,0)); + // host by default + SendDlgItemMessage(hDlg, IDC_HOSTSESSION, BM_SETCHECK, 1, 0); + SendDlgItemMessage(hDlg, IDC_JOINSESSION, BM_SETCHECK, 0, 0); + gbIsHost = TRUE; + return(TRUE); + + case WM_COMMAND: + if (HIWORD(wParam) == BN_CLICKED) + switch (LOWORD(wParam)) + { + case IDC_HOSTSESSION: + if (SendDlgItemMessage(hDlg, IDC_HOSTSESSION, BM_GETCHECK, 1, 0) == 1) + { + gbIsHost = TRUE; + } + return(TRUE); + case IDC_JOINSESSION: + if (SendDlgItemMessage(hDlg, IDC_JOINSESSION, BM_GETCHECK, 1, 0) == 1) + { + gbIsHost = FALSE; + } + return(TRUE); + } + break; + } + return(FALSE); +} + +/* + * EnumPlayer + * + * EnumeratePlayer callback. Inserts player information into the passed in tree view control. + */ +BOOL WINAPI EnumPlayer(DPID pidID, DWORD dwPlayerType, LPCDPNAME lpName, + DWORD dwFlags, LPVOID lpContext) +{ + HWND hWnd = (HWND) lpContext; + HTREEITEM hItem; + +#ifdef UNICODE + hItem = AddItemToTree(hWnd, lpName->lpszShortName, 0, -1); +#else + hItem = AddItemToTree(hWnd, lpName->lpszShortNameA, 0, -1); +#endif + + return(TRUE); +} + +/* + * DlgProcJoinSession + * + * Dialog procedure for Join Session Dialog + */ +BOOL CALLBACK DlgProcJoinSession (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + static NM_TREEVIEW nmtv; + static HWND hWndCtl; + static TCHAR tszPlayerName[MAX_PLAYERNAME+1]; + static HANDLE dphEvent = NULL; + TV_ITEM tvItem; + TCHAR tszSessionName[MAX_SESSIONNAME+1]; + WCHAR wszSPGuid[GUIDSTR_MAX+1]; + BYTE szSPGuid[GUIDSTR_MAX+1]; + DWORD dwPNameSize; + HRESULT hr; + HTREEITEM htiCur, htiNext; + LPGUID lpGuid; + + switch (msg) + { + case WM_NOTIFY: + switch (((NMHDR FAR *) lParam)->code) + { + case PSN_SETACTIVE: + if (hWndCtl) TreeView_DeleteAllItems(hWndCtl); + + // enum sessions and let dplay decide the timeout + DPlayEnumSessions(0, EnumSession, (LPVOID) hWndCtl, (DWORD)NULL); + + // enumerate players for all sessions + ghtiSession = TreeView_GetFirstVisible(hWndCtl); + + while (ghtiSession) + { + // delete previous players from display + if ((htiNext = htiCur = TreeView_GetChild(hWndCtl, ghtiSession)) + != (HTREEITEM)0) + { + do + { + htiNext = TreeView_GetNextSibling(hWndCtl, htiCur); + TreeView_DeleteItem(hWndCtl, htiCur); + htiCur = htiNext; + } while (htiNext); + } + + tvItem.hItem = ghtiSession; + tvItem.pszText = tszSessionName; + tvItem.cchTextMax = MAX_SESSIONNAME; + TreeView_GetItem(hWndCtl, &tvItem); + // enumerate players for selected session + DPlayEnumPlayers((LPGUID)tvItem.lParam, EnumPlayer, (LPVOID) hWndCtl, DPENUMPLAYERS_SESSION); + ghtiSession = TreeView_GetNextItem(hWndCtl, ghtiSession, TVGN_NEXTVISIBLE); + } + + // set Finish button highlite + if (GetDlgItemText(hDlg, IDC_JOIN_PLAYERNAME, tszPlayerName, MAX_PLAYERNAME) && + (htiCur = TreeView_GetSelection(hWndCtl))) + { + PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK|PSWIZB_FINISH); + } + else + { + PropSheet_SetWizButtons(GetParent(hDlg),PSWIZB_BACK|PSWIZB_DISABLEDFINISH); + } + + SetFocus(hWndCtl); + return(TRUE); + + case PSN_WIZFINISH: + // add user selections to registry + if (ghDuelKey) + { + StringFromGUID(&gSPGuid, wszSPGuid); + WideToAnsi(szSPGuid, wszSPGuid, sizeof(wszSPGuid)); + RegSetA(TEXT("ServiceProvider"), szSPGuid, sizeof(szSPGuid)); + RegSet(TEXT("PlayerName"), (CONST BYTE *)tszPlayerName, + sizeof(tszPlayerName)); + } + + // get the session guid + if (nmtv.itemNew.lParam) + { + // user selected a session item, so just grab its lParam + lpGuid = (LPGUID)nmtv.itemNew.lParam; + } + else + { + // user selected a player item, so grab its parent's (session) lParam + htiCur = TreeView_GetParent(hWndCtl, nmtv.itemNew.hItem); + if (!htiCur) + { + // fail finish + ShowError(IDS_WIZARD_ERROR_GSG); + SetWindowLong(hDlg, DWL_MSGRESULT, -1); + return (TRUE); + } + + tvItem.hItem = htiCur; + tvItem.pszText = tszSessionName; + tvItem.cchTextMax = MAX_SESSIONNAME; + TreeView_GetItem(hWndCtl, &tvItem); + lpGuid = (LPGUID)tvItem.lParam; + } + + // open session + if ((hr = DPlayOpenSession(lpGuid)) != DP_OK) + { + // fail finish + ShowError(IDS_DPLAY_ERROR_JS); + SetWindowLong(hDlg, DWL_MSGRESULT, -1); + return (TRUE); + } + + // create player + if ((hr = DPlayCreatePlayer(&gOurID, tszPlayerName, NULL, NULL, 0)) != DP_OK) + { + // fail finish + ShowError(IDS_DPLAY_ERROR_CP); + SetWindowLong(hDlg, DWL_MSGRESULT, -1); + return (TRUE); + } + + // everything went well, release allocated memory and finish + ReleaseSessionData(hWndCtl); + ReleaseSPData(); + return(TRUE); + + case PSN_QUERYCANCEL: + ReleaseSPData(); + ReleaseSessionData(hWndCtl); + DPlayRelease(); + return(TRUE); + + case PSN_WIZBACK: + ReleaseSessionData(hWndCtl); + return(TRUE); + + case TVN_SELCHANGING: + nmtv = *((NM_TREEVIEW *) lParam); + + // set Finish button status + if (GetDlgItemText(hDlg, IDC_JOIN_PLAYERNAME, tszPlayerName, MAX_PLAYERNAME) && + (htiCur = TreeView_GetSelection(hWndCtl))) + { + PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK|PSWIZB_FINISH); + } + else + { + PropSheet_SetWizButtons(GetParent(hDlg),PSWIZB_BACK|PSWIZB_DISABLEDFINISH); + } + return(FALSE); + + case NM_CLICK: + return(FALSE); + } + break; + case WM_INITDIALOG: + // setup title fonts + SendDlgItemMessage(hDlg, IDC_JOIN_SESSION_TITLE, WM_SETFONT, (WPARAM)ghHeadingFont, MAKELPARAM(TRUE,0)); + SendDlgItemMessage(hDlg, IDC_JOIN_PLAYER_TITLE, WM_SETFONT, (WPARAM)ghHeadingFont, MAKELPARAM(TRUE,0)); + + // setup user's previous data + dwPNameSize = MAX_PLAYERNAME+1; + tszPlayerName[0]=0; + if (ghDuelKey && (RegGet(TEXT("PlayerName"),(LPBYTE)tszPlayerName,&dwPNameSize) == ERROR_SUCCESS)) + SetDlgItemText(hDlg, IDC_JOIN_PLAYERNAME, tszPlayerName); + + hWndCtl = GetDlgItem(hDlg, IDC_JOIN_SESSION); + if (hWndCtl == NULL) return(TRUE); + InitTreeViewImageLists(hWndCtl); + return(TRUE); + + case WM_COMMAND: + + switch (LOWORD(wParam)) + { + case IDC_JOIN_PLAYERNAME: + if (HIWORD(wParam) == EN_CHANGE) + { + // set Finish button status + if (GetDlgItemText(hDlg, IDC_JOIN_PLAYERNAME, tszPlayerName, MAX_PLAYERNAME) && + (htiCur = TreeView_GetSelection(hWndCtl))) + { + PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK|PSWIZB_FINISH); + } + else + { + PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK|PSWIZB_DISABLEDFINISH); + } + } + break; + } + break; + } + return (FALSE); +} + +/* + * DlgProcHostSession + * + * Dialog proc for Host Session Dialog + */ +BOOL CALLBACK DlgProcHostSession(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + static TCHAR tszSessionName[MAX_SESSIONNAME+1], tszPlayerName[MAX_PLAYERNAME+1]; + HRESULT hr; + WCHAR wszSPGuid[GUIDSTR_MAX+1]; + BYTE szSPGuid[GUIDSTR_MAX+1]; + DWORD dwPNameSize, dwSNameSize; + + switch (msg) { + case WM_NOTIFY: + switch (((NMHDR FAR *) lParam)->code) + { + case PSN_SETACTIVE: + if (GetDlgItemText(hDlg, IDC_HOST_SESSIONNAME, tszSessionName, MAX_SESSIONNAME) && + GetDlgItemText(hDlg, IDC_HOST_PLAYERNAME, tszPlayerName, MAX_PLAYERNAME)) + { + PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK|PSWIZB_FINISH); + } + else + { + PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK|PSWIZB_DISABLEDFINISH); + } + return(TRUE); + + case PSN_WIZFINISH: + // add user selections to registry + if (ghDuelKey) + { + StringFromGUID(&gSPGuid, wszSPGuid); + WideToAnsi(szSPGuid, wszSPGuid, sizeof(wszSPGuid)); + RegSetA(TEXT("ServiceProvider"), szSPGuid, sizeof(szSPGuid)); + RegSet(TEXT("PlayerName"), (CONST BYTE *)tszPlayerName, sizeof(tszPlayerName)); + RegSet(TEXT("SessionName"), (CONST BYTE *)tszSessionName, sizeof(tszSessionName)); + } + + // create session + if ((hr = DPlayCreateSession(tszSessionName)) != DP_OK) + { + // fail finish + ShowError(IDS_DPLAY_ERROR_CS); + SetWindowLong(hDlg, DWL_MSGRESULT, -1); + return (TRUE); + } + + // create player + if ((hr = DPlayCreatePlayer(&gOurID, tszPlayerName, NULL, NULL, 0)) != DP_OK) + { + ShowError(IDS_DPLAY_ERROR_CP); + SetWindowLong(hDlg, DWL_MSGRESULT, -1); + return (TRUE); + } + + // everything went well, release allocated memory and finish + ReleaseSPData(); + return(TRUE); + + case PSN_WIZBACK: + SetWindowLong(hDlg, DWL_MSGRESULT, IDD_GAMESETUP); + return(TRUE); + + case PSN_QUERYCANCEL: + // release allocated memory + ReleaseSPData(); + // release dplay + DPlayRelease(); + return(TRUE); + } + break; + case WM_INITDIALOG: + // setup title font + SendDlgItemMessage(hDlg, IDC_HOST_TITLE, WM_SETFONT, (WPARAM)ghTitleFont, MAKELPARAM(TRUE,0)); + SendDlgItemMessage(hDlg, IDC_HOST_SESSION_TITLE, WM_SETFONT, (WPARAM)ghHeadingFont, MAKELPARAM(TRUE,0)); + SendDlgItemMessage(hDlg, IDC_HOST_PLAYER_TITLE, WM_SETFONT, (WPARAM)ghHeadingFont, MAKELPARAM(TRUE,0)); + + dwPNameSize = MAX_PLAYERNAME+1; + dwSNameSize = MAX_SESSIONNAME+1; + tszPlayerName[0]=0; + tszSessionName[0]=0; + if (ghDuelKey) + { + if (RegGet(TEXT("PlayerName"), (LPBYTE)tszPlayerName, &dwPNameSize) == ERROR_SUCCESS) + SetDlgItemText(hDlg, IDC_HOST_PLAYERNAME, tszPlayerName); + if (RegGet(TEXT("SessionName"), (LPBYTE)tszSessionName, &dwSNameSize) == ERROR_SUCCESS) + SetDlgItemText(hDlg, IDC_HOST_SESSIONNAME, tszSessionName); + } + + return(TRUE); + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_HOST_SESSIONNAME: + if (HIWORD(wParam) == EN_CHANGE) + { + if (GetDlgItemText(hDlg, IDC_HOST_SESSIONNAME, tszSessionName, MAX_SESSIONNAME) && + GetDlgItemText(hDlg, IDC_HOST_PLAYERNAME, tszPlayerName, MAX_PLAYERNAME)) + { + PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK|PSWIZB_FINISH); + } + else + { + PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK|PSWIZB_DISABLEDFINISH); + } + + return TRUE; + } + break; + + case IDC_HOST_PLAYERNAME: + if (HIWORD(wParam) == EN_CHANGE) + { + if (GetDlgItemText(hDlg, IDC_HOST_SESSIONNAME, tszSessionName, MAX_SESSIONNAME) && + GetDlgItemText(hDlg, IDC_HOST_PLAYERNAME, tszPlayerName, MAX_PLAYERNAME)) + { + PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK|PSWIZB_FINISH); + } + else + { + PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK|PSWIZB_DISABLEDFINISH); + } + } + break; + } + break; + } + + return(FALSE); +} + +/* + * InitTreeViewImageLists - creates an image list, adds three bitmaps to + * it, and associates the image list with a tree-view control. + * Returns TRUE if successful or FALSE otherwise. + * hwndTV - handle of the tree-view control + * + * Global variables and constants + * gnSession, and gnPlayer - integer variables for + * indexes of the images + * CX_BITMAP and CY_BITMAP - width and height of an icon + * NUM_BITMAPS - number of bitmaps to add to the image list + */ +BOOL InitTreeViewImageLists(HWND hwndTV) +{ + HIMAGELIST himl; // handle of image list + HBITMAP hbmp; // handle of bitmap + + // Create the image list. + if ((himl = ImageList_Create(CX_BITMAP, CY_BITMAP, + FALSE, NUM_BITMAPS, 0)) == NULL) + return FALSE; + + // Add the session and player bitmaps. + hbmp = LoadBitmap(ghinst, MAKEINTRESOURCE(IDB_CLOSED_SESSION)); + gnSession = ImageList_Add(himl, hbmp, (HBITMAP) NULL); + DeleteObject(hbmp); + + hbmp = LoadBitmap(ghinst, MAKEINTRESOURCE(IDB_PLAYER)); + gnPlayer = ImageList_Add(himl, hbmp, (HBITMAP) NULL); + DeleteObject(hbmp); + + // Fail if not all of the images were added. + if (ImageList_GetImageCount(himl) < 2) + return FALSE; + + // Associate the image list with the tree-view control. + TreeView_SetImageList(hwndTV, himl, TVSIL_NORMAL); + + return TRUE; +} + + +/* + * AddItemToTree - adds items to a tree-view control. + * Returns the handle of the newly added item. + * hwndTV - handle of the tree-view control + * lpszItem - text of the item to add + * nLevel - level at which to add the item + */ +HTREEITEM AddItemToTree(HWND hwndTV, LPTSTR lptszItem, DWORD dwData, int nLevel) +{ + TV_ITEM tvi; + TV_INSERTSTRUCT tvins; + static HTREEITEM hPrev = (HTREEITEM) TVI_FIRST; + static HTREEITEM hPrevRootItem = NULL; + static HTREEITEM hPrevLev2Item = NULL; + + tvi.mask = TVIF_TEXT | TVIF_IMAGE + | TVIF_SELECTEDIMAGE | TVIF_PARAM; + + // Set the state + if (nLevel == 1) + { + tvi.mask |= TVIF_STATE; + tvi.state = TVIS_SELECTED; + } + + // Set the text of the item. + tvi.pszText = lptszItem; + + // Set the image + if (nLevel == 1) + { + tvi.iImage = gnSession; + tvi.iSelectedImage = gnSession; + } + else + { + tvi.iImage = gnPlayer; + tvi.iSelectedImage = gnPlayer; + } + + + // Save the heading level in the item's application-defined + // data area. + tvi.lParam = (LPARAM) dwData; + + tvins.item = tvi; + tvins.hInsertAfter = hPrev; + + // Set the parent item based on the specified level. + if (nLevel == -1) + tvins.hParent = ghtiSession; + else if (nLevel == 1) + tvins.hParent = TVI_ROOT; + else if (nLevel == 2) + tvins.hParent = hPrevRootItem; + else + tvins.hParent = hPrevLev2Item; + + // Add the item to the tree-view control. + hPrev = (HTREEITEM) SendMessage(hwndTV, TVM_INSERTITEM, 0, + (LPARAM) (LPTV_INSERTSTRUCT) &tvins); + + // Save the handle of the item. + if (nLevel == 1) + hPrevRootItem = hPrev; + else if (nLevel == 2) + hPrevLev2Item = hPrev; + + return hPrev; +} + +/* + * ReleaseSessionData + * + * Releases the memory allocated for session guids + */ +void ReleaseSessionData(HWND hWndCtl) +{ + HTREEITEM htiSession; + TV_ITEM tvItem; + TCHAR tszSessionName[MAX_SESSIONNAME+1]; + + + htiSession = TreeView_GetRoot(hWndCtl); + while (htiSession) + { + tvItem.hItem = htiSession; + tvItem.pszText = tszSessionName; + tvItem.cchTextMax = MAX_SESSIONNAME; + TreeView_GetItem(hWndCtl, &tvItem); + if (tvItem.lParam) free((LPVOID)tvItem.lParam); + htiSession = TreeView_GetNextSibling(hWndCtl, htiSession); + } +} + +/* + * ReleaseSPData + * + * Releases the memory allocated for service provider guids + * depends on global variable ghWndSPControl + */ +void ReleaseSPData(void) +{ + LPGUID lpGuid; + int count,index; + + if (ghWndSPCtl) + { + count = SendMessage(ghWndSPCtl, LB_GETCOUNT, 0, 0); + for (index = 0; index < count; index++) + { + lpGuid = (LPGUID) SendMessage(ghWndSPCtl, LB_GETITEMDATA, index, 0); + if (lpGuid) free(lpGuid); + } + } +} diff --git a/sdk/samples/duel/wizard.h b/sdk/samples/duel/wizard.h new file mode 100644 index 0000000..2b4a832 --- /dev/null +++ b/sdk/samples/duel/wizard.h @@ -0,0 +1,49 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: wizard.h + * Content: user input routines include file + * + * + ***************************************************************************/ +#define IDIRECTPLAY2_OR_GREATER +#include <commctrl.h> +#include <dplay.h> +#include "duel.h" + +void SetupFonts(HDC hDC); + +void CleanupFonts(void); + +LONG RegSet(LPCTSTR lptszName, CONST BYTE * lpData, DWORD dwSize); + +LONG RegSetA(LPCTSTR lptszName, CONST BYTE * lpData, DWORD dwSize); + +LONG RegGet(LPCTSTR lptszName, LPBYTE lpData, LPDWORD lpdwDataSize); + +DWORD WINAPI DoWizard(LPVOID pv); + +BOOL WINAPI EnumSP(LPGUID lpGuid, LPTSTR lpDesc, DWORD dwJamorVersion, + DWORD dwMinorVersion, LPVOID lpv); +BOOL CALLBACK DlgProcChooseProvider(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); + +BOOL WINAPI EnumSession(LPCDPSESSIONDESC2 lpDPSessionDesc, LPDWORD lpdwTimeOut, + DWORD dwFlags, LPVOID pContext); + +BOOL CALLBACK DlgProcGameSetup (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); + +BOOL WINAPI EnumPlayer(DPID pidID, DWORD dwPlayerType, LPCDPNAME lpName, + DWORD dwFlags, LPVOID lpContext); + +BOOL CALLBACK DlgProcJoinSession (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); + +BOOL CALLBACK DlgProcHostSession (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); + +BOOL InitTreeViewImageLists(HWND hwndTV); + +HTREEITEM AddItemToTree(HWND hwndTV, LPTSTR lpszItem, DWORD dwData, int nLevel); + +void ReleaseSessionData(HWND hWndCtl); + +void ReleaseSPData(void); diff --git a/sdk/samples/dxview/dxview.c b/sdk/samples/dxview/dxview.c new file mode 100644 index 0000000..cbc1ff3 --- /dev/null +++ b/sdk/samples/dxview/dxview.c @@ -0,0 +1,1855 @@ +/**************************************************************************** + + Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + + PROGRAM: dxview.c + + PURPOSE: DirectX Device Viewer + + FUNCTIONS: + + COMMENTS: + +****************************************************************************/ +//#define DX_3D +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <commctrl.h> + +#define INITGUID +#include <objbase.h> +#include <initguid.h> + +#include <ddraw.h> +//#include <mmreg.h> +#include <dsound.h> +#include <dplay.h> +#ifdef DX_3D +#include <d3d.h> +#endif +#include "dxview.h" + +/**************************************************************************** + ***************************************************************************/ + +HINSTANCE g_hInstance; +char g_szAppName[] = "DXView"; +char g_szClassName[] = "DXView"; +char g_szTitle[] = "DirectX Device Viewer"; +HWND g_hwndMain; + +HWND g_hwndLV; // List view +HWND g_hwndTV; // Tree view +HIMAGELIST g_hImageList; +HFONT g_hFont; +int g_xPaneSplit; +int g_xHalfSplitWidth; +BOOL g_bSplitMove; +DWORD g_dwViewState; +DWORD g_tmAveCharWidth; + +/**************************************************************************** + ***************************************************************************/ + +IDirectDraw *lpDD; // DirectDraw object +GUID * ddid; + +IDirectSound *lpDS; // DirectSound object +GUID * dsid; + +IDirectPlay *lpDP; // DirectPlay object +GUID * dpid; + +#ifdef DX_3D +IDirect3D *lp3D; // Direct3D object +GUID * d3did; + +IDirect3DDevice *lp3DDevice; +GUID *pid_for3D = 0; +#endif + +/**************************************************************************** + ***************************************************************************/ + +#define DDCAPDEF(name,val,flag) {name, FIELD_OFFSET(DDCAPS,val), flag} +#define DDVALDEF(name,val) {name, FIELD_OFFSET(DDCAPS,val), 0} +#define ROPDEF(name,rop) DDCAPDEF(name,dwRops[((rop>>16)&0xFF)/32],(1<<((rop>>16)&0xFF)%32)) + +#define DSCAPDEF(name,val,flag) {name, FIELD_OFFSET(DSCAPS,val), flag} +#define DSVALDEF(name,val) {name, FIELD_OFFSET(DSCAPS,val), 0} + +#define DPCAPDEF(name,val,flag) {name, FIELD_OFFSET(DPCAPS,val), flag} +#define DPVALDEF(name,val) {name, FIELD_OFFSET(DPCAPS,val), 0} + +#ifdef DX_3D +#define D3CAPDEF(name,val,flag) {name, FIELD_OFFSET(D3DDEVICEDESC,val), flag} +#define D3VALDEF(name,val) {name, FIELD_OFFSET(D3DDEVICEDESC,val), 0} +#endif + +#define SURFCAPDEF(name,val,flag) {name, FIELD_OFFSET(DDSURFACEDESC,val), flag} +#define SURFVALDEF(name,val) {name, FIELD_OFFSET(DDSURFACEDESC,val), 0} + +#define MAKEMODE(xres,yres,bpp) (((DWORD)xres << 20) | ((DWORD)yres << 8) | bpp) +#define GETXRES(mode) (int)((mode >> 20) & 0x0FFF) +#define GETYRES(mode) (int)((mode >> 8) & 0x0FFF) +#define GETCRES(mode) (int)((mode >> 0) & 0x00FF) + +/**************************************************************************** + ***************************************************************************/ +CAPDEF OtherInfoDefs[] = +{ + DDVALDEF("VidMemTotal", dwVidMemTotal), + DDVALDEF("VidMemFree", dwVidMemFree), + DDVALDEF("dwReserved1", dwReserved1), + DDVALDEF("dwReserved2", dwReserved2), + DDVALDEF("dwReserved3", dwReserved3), + DDVALDEF("AlphaBltConstBitDepths", dwAlphaBltConstBitDepths), + DDVALDEF("AlphaBltPixelBitDepths", dwAlphaBltPixelBitDepths), + DDVALDEF("AlphaBltSurfaceBitDepths", dwAlphaBltSurfaceBitDepths), + DDVALDEF("AlphaOverlayConstBitDepths", dwAlphaOverlayConstBitDepths), + DDVALDEF("AlphaOverlayPixelBitDepths", dwAlphaOverlayPixelBitDepths), + DDVALDEF("AlphaOverlaySurfaceBitDepths", dwAlphaOverlaySurfaceBitDepths), + DDVALDEF("ZBufferBitDepths", dwZBufferBitDepths), + DDVALDEF("MaxVisibleOverlays", dwMaxVisibleOverlays), + DDVALDEF("CurrVisibleOverlays", dwCurrVisibleOverlays), + DDVALDEF("NumFourCCCodes", dwNumFourCCCodes), + DDVALDEF("AlignBoundarySrc", dwAlignBoundarySrc), + DDVALDEF("AlignSizeSrc", dwAlignSizeSrc), + DDVALDEF("AlignBoundaryDest", dwAlignBoundaryDest), + DDVALDEF("AlignSizeDest", dwAlignSizeDest), + DDVALDEF("AlignStrideAlign", dwAlignStrideAlign), + DDVALDEF("MinOverlayStretch", dwMinOverlayStretch), + DDVALDEF("MaxOverlayStretch", dwMaxOverlayStretch), + DDVALDEF("MinLiveVideoStretch", dwMinLiveVideoStretch), + DDVALDEF("MaxLiveVideoStretch", dwMaxLiveVideoStretch), + DDVALDEF("MinHwCodecStretch", dwMinHwCodecStretch), + DDVALDEF("MaxHwCodecStretch", dwMaxHwCodecStretch), + { "", 0, 0 } +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF CapsDefs[] = +{ + DDCAPDEF("3D", dwCaps, DDCAPS_3D), + DDCAPDEF("ALIGNBOUNDARYDEST", dwCaps, DDCAPS_ALIGNBOUNDARYDEST), + DDCAPDEF("ALIGNSIZEDEST", dwCaps, DDCAPS_ALIGNSIZEDEST), + DDCAPDEF("ALIGNBOUNDARYSRC", dwCaps, DDCAPS_ALIGNBOUNDARYSRC), + DDCAPDEF("ALIGNSIZESRC", dwCaps, DDCAPS_ALIGNSIZESRC), + DDCAPDEF("ALIGNSTRIDE", dwCaps, DDCAPS_ALIGNSTRIDE), + DDCAPDEF("BLT", dwCaps, DDCAPS_BLT), + DDCAPDEF("BLTCOLORFILL", dwCaps, DDCAPS_BLTCOLORFILL), + DDCAPDEF("BLTDEPTHFILL", dwCaps, DDCAPS_BLTDEPTHFILL), + DDCAPDEF("BLTFOURCC", dwCaps, DDCAPS_BLTFOURCC), + DDCAPDEF("BLTSTRETCH", dwCaps, DDCAPS_BLTSTRETCH), + DDCAPDEF("BLTQUEUE", dwCaps, DDCAPS_BLTQUEUE), + DDCAPDEF("GDI", dwCaps, DDCAPS_GDI), + DDCAPDEF("OVERLAY", dwCaps, DDCAPS_OVERLAY), + DDCAPDEF("OVERLAYCANTCLIP", dwCaps, DDCAPS_OVERLAYCANTCLIP), + DDCAPDEF("OVERLAYFOURCC", dwCaps, DDCAPS_OVERLAYFOURCC), + DDCAPDEF("OVERLAYSTRETCH", dwCaps, DDCAPS_OVERLAYSTRETCH), + DDCAPDEF("PALETTE", dwCaps, DDCAPS_PALETTE), + DDCAPDEF("PALETTEVSYNC", dwCaps, DDCAPS_PALETTEVSYNC), + DDCAPDEF("READSCANLINE", dwCaps, DDCAPS_READSCANLINE), + DDCAPDEF("STEREOVIEW", dwCaps, DDCAPS_STEREOVIEW), + DDCAPDEF("VBI", dwCaps, DDCAPS_VBI), + DDCAPDEF("ZBLTS", dwCaps, DDCAPS_ZBLTS), + DDCAPDEF("ZOVERLAYS", dwCaps, DDCAPS_ZOVERLAYS), + DDCAPDEF("COLORKEY", dwCaps, DDCAPS_COLORKEY), + DDCAPDEF("ALPHA", dwCaps, DDCAPS_ALPHA), + DDCAPDEF("CKEYHWASSIST", dwCaps, DDCAPS_COLORKEYHWASSIST), + DDCAPDEF("NOHARDWARE", dwCaps, DDCAPS_NOHARDWARE), + DDCAPDEF("BANKSWITCHED", dwCaps, DDCAPS_BANKSWITCHED), + DDCAPDEF("CERTIFIED", dwCaps2,DDCAPS2_CERTIFIED), + DDCAPDEF("NO2DDURING3DSCENE", dwCaps2,DDCAPS2_NO2DDURING3DSCENE), + { "", 0, 0 } +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF CKeyCapsDefs[] = +{ + DDCAPDEF("DESTBLT", dwCKeyCaps, DDCKEYCAPS_DESTBLT), + DDCAPDEF("DESTBLTCLRSPACE", dwCKeyCaps, DDCKEYCAPS_DESTBLTCLRSPACE), + DDCAPDEF("DESTBLTCLRSPACEYUV", dwCKeyCaps, DDCKEYCAPS_DESTBLTCLRSPACEYUV), + DDCAPDEF("DESTBLTYUV", dwCKeyCaps, DDCKEYCAPS_DESTBLTYUV), + DDCAPDEF("DESTOVERLAY", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAY), + DDCAPDEF("DESTOVERLAYCLRSPACE", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYCLRSPACE), + DDCAPDEF("DESTOVERLAYCLRSPACEYUV", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV), + DDCAPDEF("DESTOVERLAYONEACTIVE", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYONEACTIVE), + DDCAPDEF("DESTOVERLAYYUV", dwCKeyCaps, DDCKEYCAPS_DESTOVERLAYYUV), + DDCAPDEF("SRCBLT", dwCKeyCaps, DDCKEYCAPS_SRCBLT), + DDCAPDEF("SRCBLTCLRSPACE", dwCKeyCaps, DDCKEYCAPS_SRCBLTCLRSPACE), + DDCAPDEF("SRCBLTCLRSPACEYUV", dwCKeyCaps, DDCKEYCAPS_SRCBLTCLRSPACEYUV), + DDCAPDEF("SRCBLTYUV", dwCKeyCaps, DDCKEYCAPS_SRCBLTYUV), + DDCAPDEF("SRCOVERLAY", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAY), + DDCAPDEF("SRCOVERLAYCLRSPACE", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYCLRSPACE), + DDCAPDEF("SRCOVERLAYCLRSPACEYUV", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV), + DDCAPDEF("SRCOVERLAYONEACTIVE", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYONEACTIVE), + DDCAPDEF("SRCOVERLAYYUV", dwCKeyCaps, DDCKEYCAPS_SRCOVERLAYYUV), + { "", 0, 0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF FXCapsDefs[] = +{ + DDCAPDEF("BLTARITHSTRETCHY", dwFXCaps, DDFXCAPS_BLTARITHSTRETCHY), + DDCAPDEF("BLTARITHSTRETCHYN", dwFXCaps, DDFXCAPS_BLTARITHSTRETCHYN), + DDCAPDEF("BLTMIRRORLEFTRIGHT", dwFXCaps, DDFXCAPS_BLTMIRRORLEFTRIGHT), + DDCAPDEF("BLTMIRRORUPDOWN", dwFXCaps, DDFXCAPS_BLTMIRRORUPDOWN), + DDCAPDEF("BLTROTATION", dwFXCaps, DDFXCAPS_BLTROTATION), + DDCAPDEF("BLTROTATION90", dwFXCaps, DDFXCAPS_BLTROTATION90), + DDCAPDEF("BLTSHRINKX", dwFXCaps, DDFXCAPS_BLTSHRINKX), + DDCAPDEF("BLTSHRINKXN", dwFXCaps, DDFXCAPS_BLTSHRINKXN), + DDCAPDEF("BLTSHRINKY", dwFXCaps, DDFXCAPS_BLTSHRINKY), + DDCAPDEF("BLTSHRINKYN", dwFXCaps, DDFXCAPS_BLTSHRINKYN), + DDCAPDEF("BLTSTRETCHX", dwFXCaps, DDFXCAPS_BLTSTRETCHX), + DDCAPDEF("BLTSTRETCHXN", dwFXCaps, DDFXCAPS_BLTSTRETCHXN), + DDCAPDEF("BLTSTRETCHY", dwFXCaps, DDFXCAPS_BLTSTRETCHY), + DDCAPDEF("BLTSTRETCHYN", dwFXCaps, DDFXCAPS_BLTSTRETCHYN), + DDCAPDEF("OVERLAYARITHSTRETCHY", dwFXCaps, DDFXCAPS_OVERLAYARITHSTRETCHY), + DDCAPDEF("OVERLAYARITHSTRETCHYN", dwFXCaps, DDFXCAPS_OVERLAYARITHSTRETCHYN), + DDCAPDEF("OVERLAYSHRINKX", dwFXCaps, DDFXCAPS_OVERLAYSHRINKX), + DDCAPDEF("OVERLAYSHRINKXN", dwFXCaps, DDFXCAPS_OVERLAYSHRINKXN), + DDCAPDEF("OVERLAYSHRINKY", dwFXCaps, DDFXCAPS_OVERLAYSHRINKY), + DDCAPDEF("OVERLAYSHRINKYN", dwFXCaps, DDFXCAPS_OVERLAYSHRINKYN), + DDCAPDEF("OVERLAYSTRETCHX", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHX), + DDCAPDEF("OVERLAYSTRETCHXN", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHXN), + DDCAPDEF("OVERLAYSTRETCHY", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHY), + DDCAPDEF("OVERLAYSTRETCHYN", dwFXCaps, DDFXCAPS_OVERLAYSTRETCHYN), + DDCAPDEF("OVERLAYMIRRORLEFTRIGHT", dwFXCaps, DDFXCAPS_OVERLAYMIRRORLEFTRIGHT), + DDCAPDEF("OVERLAYMIRRORUPDOWN", dwFXCaps, DDFXCAPS_OVERLAYMIRRORUPDOWN), + { "", 0, 0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF PalCapsDefs[] = +{ + DDCAPDEF("4BIT", dwPalCaps, DDPCAPS_4BIT), + DDCAPDEF("8BITENTRIES", dwPalCaps, DDPCAPS_8BITENTRIES), + DDCAPDEF("8BIT", dwPalCaps, DDPCAPS_8BIT), + DDCAPDEF("INITIALIZE", dwPalCaps, DDPCAPS_INITIALIZE), + DDCAPDEF("PRIMARYSURFACE", dwPalCaps, DDPCAPS_PRIMARYSURFACE), + DDCAPDEF("PRIMARYSURFACELEFT",dwPalCaps, DDPCAPS_PRIMARYSURFACELEFT), + DDCAPDEF("VSYNC", dwPalCaps, DDPCAPS_VSYNC), + { "", 0, 0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF SurfCapsDefs[] = +{ + DDCAPDEF( "3D", ddsCaps.dwCaps, DDSCAPS_3D), + DDCAPDEF( "3DDEVICE", ddsCaps.dwCaps, DDSCAPS_3DDEVICE), + DDCAPDEF( "ALPHA", ddsCaps.dwCaps, DDSCAPS_ALPHA), + DDCAPDEF( "BACKBUFFER", ddsCaps.dwCaps, DDSCAPS_BACKBUFFER), + DDCAPDEF( "COMPLEX", ddsCaps.dwCaps, DDSCAPS_COMPLEX), + DDCAPDEF( "FLIP", ddsCaps.dwCaps, DDSCAPS_FLIP), + DDCAPDEF( "FRONTBUFFER", ddsCaps.dwCaps, DDSCAPS_FRONTBUFFER), + DDCAPDEF( "MIPMAP", ddsCaps.dwCaps, DDSCAPS_MIPMAP), + DDCAPDEF( "OFFSCREENPLAIN", ddsCaps.dwCaps, DDSCAPS_OFFSCREENPLAIN), + DDCAPDEF( "OVERLAY", ddsCaps.dwCaps, DDSCAPS_OVERLAY), + DDCAPDEF( "PALETTE", ddsCaps.dwCaps, DDSCAPS_PALETTE), + DDCAPDEF( "PRIMARYSURFACE", ddsCaps.dwCaps, DDSCAPS_PRIMARYSURFACE), + DDCAPDEF( "PRIMARYSURFACELEFT", ddsCaps.dwCaps, DDSCAPS_PRIMARYSURFACELEFT), + DDCAPDEF( "SYSTEMMEMORY", ddsCaps.dwCaps, DDSCAPS_SYSTEMMEMORY), + DDCAPDEF( "TEXTURE", ddsCaps.dwCaps, DDSCAPS_TEXTURE), + DDCAPDEF( "VIDEOMEMORY", ddsCaps.dwCaps, DDSCAPS_VIDEOMEMORY), + DDCAPDEF( "VISIBLE", ddsCaps.dwCaps, DDSCAPS_VISIBLE), + DDCAPDEF( "WRITEONLY", ddsCaps.dwCaps, DDSCAPS_WRITEONLY), + DDCAPDEF( "ZBUFFER", ddsCaps.dwCaps, DDSCAPS_ZBUFFER), + DDCAPDEF( "OWNDC", ddsCaps.dwCaps, DDSCAPS_OWNDC), + DDCAPDEF( "LIVEVIDEO", ddsCaps.dwCaps, DDSCAPS_LIVEVIDEO), + DDCAPDEF( "HWCODEC", ddsCaps.dwCaps, DDSCAPS_HWCODEC), + DDCAPDEF( "MODEX", ddsCaps.dwCaps, DDSCAPS_MODEX), + { "", 0, 0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF SVisionCapsDefs[] = +{ + DDCAPDEF( "ENIGMA", dwSVCaps, DDSVCAPS_ENIGMA), + DDCAPDEF( "FLICKER", dwSVCaps, DDSVCAPS_FLICKER), + DDCAPDEF( "REDBLUE", dwSVCaps, DDSVCAPS_REDBLUE), + DDCAPDEF( "SPLIT", dwSVCaps, DDSVCAPS_SPLIT), + { "", 0, 0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF ROPCapsDefs[] = +{ + ROPDEF("SRCCOPY", SRCCOPY), + ROPDEF("SRCPAINT", SRCPAINT), + ROPDEF("SRCAND", SRCAND), + ROPDEF("SRCINVERT", SRCINVERT), + ROPDEF("SRCERASE", SRCERASE), + ROPDEF("NOTSRCCOPY", NOTSRCCOPY), + ROPDEF("NOTSRCERASE",NOTSRCERASE), + ROPDEF("MERGECOPY", MERGECOPY), + ROPDEF("MERGEPAINT", MERGEPAINT), + ROPDEF("PATCOPY", PATCOPY), + ROPDEF("PATPAINT", PATPAINT), + ROPDEF("PATINVERT", PATINVERT), + ROPDEF("DSTINVERT", DSTINVERT), + ROPDEF("BLACKNESS", BLACKNESS), + ROPDEF("WHITENESS", WHITENESS), + {"", 0, 0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEFS DDCapDefs[] = +{ + {"", DDAddCaps, (LPARAM)OtherInfoDefs}, + {"General", DDAddCaps, (LPARAM)OtherInfoDefs}, + {"General Caps", DDAddCaps, (LPARAM)CapsDefs}, + {"Color Key Caps", DDAddCaps, (LPARAM)CKeyCapsDefs}, + {"FX Caps", DDAddCaps, (LPARAM)FXCapsDefs}, + {"Palette Caps", DDAddCaps, (LPARAM)PalCapsDefs}, + {"Surface Caps", DDAddCaps, (LPARAM)SurfCapsDefs}, + {"Stereo Vision Caps", DDAddCaps, (LPARAM)SVisionCapsDefs}, + {"ROPS", DDAddCaps, (LPARAM)ROPCapsDefs}, + {"Video Modes", DDAddVideoModes, (LPARAM)0}, + {"FourCCFormat", DDFourCCFormat, (LPARAM)0}, + { NULL, 0, 0} +}; + +/**************************************************************************** + ***************************************************************************/ +#ifdef DX_3D +CAPDEF ValidFlags[] = +{ + D3CAPDEF("COLORMODEL", dwFlags, D3DDD_COLORMODEL), + D3CAPDEF("DEVCAPS", dwFlags, D3DDD_DEVCAPS), + D3CAPDEF("TRANSFORMCAPS", dwFlags, D3DDD_TRANSFORMCAPS), + D3CAPDEF("LIGHTINGCAPS", dwFlags, D3DDD_LIGHTINGCAPS), + D3CAPDEF("BCLIPPING", dwFlags, D3DDD_BCLIPPING), + D3CAPDEF("LINECAPS", dwFlags, D3DDD_LINECAPS), + D3CAPDEF("TRICAPS", dwFlags, D3DDD_TRICAPS), + D3CAPDEF("DEVICERENDERBITDEPTH", dwFlags, D3DDD_DEVICERENDERBITDEPTH), + D3CAPDEF("DEVICEZBUFFERBITDEPTH", dwFlags, D3DDD_DEVICEZBUFFERBITDEPTH), + D3CAPDEF("MAXBUFFERSIZE", dwFlags, D3DDD_MAXBUFFERSIZE), + D3CAPDEF("MAXVERTEXCOUNT", dwFlags, D3DDD_MAXVERTEXCOUNT), + {"",0,0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF ColorModel[] = +{ + D3CAPDEF("D3DCOLOR_MONO", dcmColorModel, D3DCOLOR_MONO), + D3CAPDEF("D3DCOLOR_RGB", dcmColorModel, D3DCOLOR_RGB), + {"",0,0} + }; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF DevCaps[] = +{ + D3CAPDEF("SORTINCREASINGZ", dwDevCaps, D3DDEVCAPS_SORTINCREASINGZ), + D3CAPDEF("SORTDECREASINGZ", dwDevCaps, D3DDEVCAPS_SORTDECREASINGZ), + D3CAPDEF("SORTEXACT", dwDevCaps, D3DDEVCAPS_SORTEXACT), + D3CAPDEF("EXECUTESYSTEMMEMORY", dwDevCaps, D3DDEVCAPS_EXECUTESYSTEMMEMORY), + D3CAPDEF("EXECUTEVIDEOMEMORY", dwDevCaps, D3DDEVCAPS_EXECUTEVIDEOMEMORY), + D3CAPDEF("TLVERTEXSYSTEMEMORY", dwDevCaps, D3DDEVCAPS_TLVERTEXSYSTEMMEMORY), + D3CAPDEF("TLVERTEXVIDEOMEMORY", dwDevCaps, D3DDEVCAPS_TLVERTEXVIDEOMEMORY), + D3CAPDEF("TEXTURESYSTEMMEMORY", dwDevCaps, D3DDEVCAPS_TEXTURESYSTEMMEMORY), + D3CAPDEF("TEXTUREVIDEOMEMORY", dwDevCaps, D3DDEVCAPS_TEXTUREVIDEOMEMORY), + {"",0,0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF TransformCaps[] = +{ + D3CAPDEF("CLIP", dtcTransformCaps.dwCaps, D3DTRANSFORMCAPS_CLIP), + {"",0,0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF LightingCaps[] = +{ + D3CAPDEF("D3DLIGHTINGMODEL_RGB", dlcLightingCaps.dwLightingModel, D3DLIGHTINGMODEL_RGB), + D3CAPDEF("D3DLIGHTINGMODEL_MONO", dlcLightingCaps.dwLightingModel, D3DLIGHTINGMODEL_MONO), + + D3CAPDEF("D3DLIGHTCAPS_POINT", dlcLightingCaps.dwCaps, D3DLIGHTCAPS_POINT), + D3CAPDEF("D3DLIGHTCAPS_SPOT", dlcLightingCaps.dwCaps, D3DLIGHTCAPS_SPOT), + D3CAPDEF("D3DLIGHTCAPS_DIRECTIONAL", dlcLightingCaps.dwCaps, D3DLIGHTCAPS_DIRECTIONAL), + D3CAPDEF("D3DLIGHTCAPS_PARALLELPOINT", dlcLightingCaps.dwCaps, D3DLIGHTCAPS_PARALLELPOINT), + D3CAPDEF("D3DLIGHTCAPS_GLSPOT", dlcLightingCaps.dwCaps, D3DLIGHTCAPS_GLSPOT), + D3VALDEF("dwNumLights", dlcLightingCaps.dwNumLights), + {"",0,0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF BClipping[] = +{ + D3CAPDEF("bClipping", bClipping, TRUE), + {"",0,0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF LineCaps[] = +{ + D3CAPDEF("D3DPMISCCAPS_MASKPLANES", dpcLineCaps.dwMiscCaps, D3DPMISCCAPS_MASKPLANES), + D3CAPDEF("D3DPMISCCAPS_MASKZ", dpcLineCaps.dwMiscCaps, D3DPMISCCAPS_MASKZ), + D3CAPDEF("D3DPMISCCAPS_LINEPATTERNREP", dpcLineCaps.dwMiscCaps, D3DPMISCCAPS_LINEPATTERNREP), + D3CAPDEF("D3DPMISCCAPS_CONFORMANT", dpcLineCaps.dwMiscCaps, D3DPMISCCAPS_CONFORMANT), + D3CAPDEF("D3DPMISCCAPS_CULLNONE", dpcLineCaps.dwMiscCaps, D3DPMISCCAPS_CULLNONE), + D3CAPDEF("D3DPMISCCAPS_CULLCW", dpcLineCaps.dwMiscCaps, D3DPMISCCAPS_CULLCW), + D3CAPDEF("D3DPMISCCAPS_CULLCCW", dpcLineCaps.dwMiscCaps, D3DPMISCCAPS_CULLCCW), + + D3CAPDEF("D3DPRASTERCAPS_DITHER", dpcLineCaps.dwRasterCaps, D3DPRASTERCAPS_DITHER), + D3CAPDEF("D3DPRASTERCAPS_ROP2", dpcLineCaps.dwRasterCaps, D3DPRASTERCAPS_ROP2), + D3CAPDEF("D3DPRASTERCAPS_XOR", dpcLineCaps.dwRasterCaps, D3DPRASTERCAPS_XOR), + D3CAPDEF("D3DPRASTERCAPS_PAT", dpcLineCaps.dwRasterCaps, D3DPRASTERCAPS_PAT), + D3CAPDEF("D3DPRASTERCAPS_ZTEST", dpcLineCaps.dwRasterCaps, D3DPRASTERCAPS_ZTEST), + D3CAPDEF("D3DPRASTERCAPS_SUBPIXEL", dpcLineCaps.dwRasterCaps, D3DPRASTERCAPS_SUBPIXEL), + D3CAPDEF("D3DPRASTERCAPS_SUBPIXELX", dpcLineCaps.dwRasterCaps, D3DPRASTERCAPS_SUBPIXELX), + D3CAPDEF("D3DPRASTERCAPS_FOGVERTEX", dpcLineCaps.dwRasterCaps, D3DPRASTERCAPS_FOGVERTEX), + D3CAPDEF("D3DPRASTERCAPS_FOGTABLE", dpcLineCaps.dwRasterCaps, D3DPRASTERCAPS_FOGTABLE), + + D3CAPDEF("D3DPCMPCAPS_NEVER", dpcLineCaps.dwZCmpCaps, D3DPCMPCAPS_NEVER ), + D3CAPDEF("D3DPCMPCAPS_LESS", dpcLineCaps.dwZCmpCaps, D3DPCMPCAPS_LESS ), + D3CAPDEF("D3DPCMPCAPS_EQUAL", dpcLineCaps.dwZCmpCaps, D3DPCMPCAPS_EQUAL ), + D3CAPDEF("D3DPCMPCAPS_LESSEQUAL", dpcLineCaps.dwZCmpCaps, D3DPCMPCAPS_LESSEQUAL ), + D3CAPDEF("D3DPCMPCAPS_GREATER", dpcLineCaps.dwZCmpCaps, D3DPCMPCAPS_GREATER ), + D3CAPDEF("D3DPCMPCAPS_NOTEQUAL", dpcLineCaps.dwZCmpCaps, D3DPCMPCAPS_NOTEQUAL ), + D3CAPDEF("D3DPCMPCAPS_GREATEREQUAL", dpcLineCaps.dwZCmpCaps, D3DPCMPCAPS_GREATEREQUAL ), + D3CAPDEF("D3DPCMPCAPS_ALWAYS", dpcLineCaps.dwZCmpCaps, D3DPCMPCAPS_ALWAYS ), + + D3CAPDEF("D3DPBLENDCAPS_ZERO", dpcLineCaps.dwSrcBlendCaps, D3DPBLENDCAPS_ZERO ), + D3CAPDEF("D3DPBLENDCAPS_ONE", dpcLineCaps.dwSrcBlendCaps, D3DPBLENDCAPS_ONE ), + D3CAPDEF("D3DPBLENDCAPS_SRCCOLOR", dpcLineCaps.dwSrcBlendCaps, D3DPBLENDCAPS_SRCCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_INVSRCCOLOR", dpcLineCaps.dwSrcBlendCaps, D3DPBLENDCAPS_INVSRCCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_SRCALPHA", dpcLineCaps.dwSrcBlendCaps, D3DPBLENDCAPS_SRCALPHA ), + D3CAPDEF("D3DPBLENDCAPS_INVSRCALPHA", dpcLineCaps.dwSrcBlendCaps, D3DPBLENDCAPS_INVSRCALPHA ), + D3CAPDEF("D3DPBLENDCAPS_DESTALPHA", dpcLineCaps.dwSrcBlendCaps, D3DPBLENDCAPS_DESTALPHA ), + D3CAPDEF("D3DPBLENDCAPS_INVDESTALPHA", dpcLineCaps.dwSrcBlendCaps, D3DPBLENDCAPS_INVDESTALPHA ), + D3CAPDEF("D3DPBLENDCAPS_DESTCOLOR", dpcLineCaps.dwSrcBlendCaps, D3DPBLENDCAPS_DESTCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_INVDESTCOLOR", dpcLineCaps.dwSrcBlendCaps, D3DPBLENDCAPS_INVDESTCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_SRCALPHASAT", dpcLineCaps.dwSrcBlendCaps, D3DPBLENDCAPS_SRCALPHASAT ), + D3CAPDEF("D3DPBLENDCAPS_BOTHSRCALPHA", dpcLineCaps.dwSrcBlendCaps, D3DPBLENDCAPS_BOTHSRCALPHA ), + D3CAPDEF("D3DPBLENDCAPS_BOTHINVSRCALPHA", dpcLineCaps.dwSrcBlendCaps, D3DPBLENDCAPS_BOTHINVSRCALPHA ), + + D3CAPDEF("D3DPBLENDCAPS_ZERO", dpcLineCaps.dwDestBlendCaps, D3DPBLENDCAPS_ZERO ), + D3CAPDEF("D3DPBLENDCAPS_ONE", dpcLineCaps.dwDestBlendCaps, D3DPBLENDCAPS_ONE ), + D3CAPDEF("D3DPBLENDCAPS_SRCCOLOR", dpcLineCaps.dwDestBlendCaps, D3DPBLENDCAPS_SRCCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_INVSRCCOLOR", dpcLineCaps.dwDestBlendCaps, D3DPBLENDCAPS_INVSRCCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_SRCALPHA", dpcLineCaps.dwDestBlendCaps, D3DPBLENDCAPS_SRCALPHA ), + D3CAPDEF("D3DPBLENDCAPS_INVSRCALPHA", dpcLineCaps.dwDestBlendCaps, D3DPBLENDCAPS_INVSRCALPHA ), + D3CAPDEF("D3DPBLENDCAPS_DESTALPHA", dpcLineCaps.dwDestBlendCaps, D3DPBLENDCAPS_DESTALPHA ), + D3CAPDEF("D3DPBLENDCAPS_INVDESTALPHA", dpcLineCaps.dwDestBlendCaps, D3DPBLENDCAPS_INVDESTALPHA ), + D3CAPDEF("D3DPBLENDCAPS_DESTCOLOR", dpcLineCaps.dwDestBlendCaps, D3DPBLENDCAPS_DESTCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_INVDESTCOLOR", dpcLineCaps.dwDestBlendCaps, D3DPBLENDCAPS_INVDESTCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_SRCALPHASAT", dpcLineCaps.dwDestBlendCaps, D3DPBLENDCAPS_SRCALPHASAT ), + D3CAPDEF("D3DPBLENDCAPS_BOTHSRCALPHA", dpcLineCaps.dwDestBlendCaps, D3DPBLENDCAPS_BOTHSRCALPHA ), + D3CAPDEF("D3DPBLENDCAPS_BOTHINVSRCALPHA", dpcLineCaps.dwDestBlendCaps, D3DPBLENDCAPS_BOTHINVSRCALPHA ), + + D3CAPDEF("D3DPCMPCAPS_NEVER", dpcLineCaps.dwAlphaCmpCaps, D3DPCMPCAPS_NEVER ), + D3CAPDEF("D3DPCMPCAPS_LESS", dpcLineCaps.dwAlphaCmpCaps, D3DPCMPCAPS_LESS ), + D3CAPDEF("D3DPCMPCAPS_EQUAL", dpcLineCaps.dwAlphaCmpCaps, D3DPCMPCAPS_EQUAL ), + D3CAPDEF("D3DPCMPCAPS_LESSEQUAL", dpcLineCaps.dwAlphaCmpCaps, D3DPCMPCAPS_LESSEQUAL ), + D3CAPDEF("D3DPCMPCAPS_GREATER", dpcLineCaps.dwAlphaCmpCaps, D3DPCMPCAPS_GREATER ), + D3CAPDEF("D3DPCMPCAPS_NOTEQUAL", dpcLineCaps.dwAlphaCmpCaps, D3DPCMPCAPS_NOTEQUAL ), + D3CAPDEF("D3DPCMPCAPS_GREATEREQUAL", dpcLineCaps.dwAlphaCmpCaps, D3DPCMPCAPS_GREATEREQUAL ), + D3CAPDEF("D3DPCMPCAPS_ALWAYS", dpcLineCaps.dwAlphaCmpCaps, D3DPCMPCAPS_ALWAYS ), + + D3CAPDEF("D3DPSHADECAPS_COLORFLATMONO", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_COLORFLATMONO ), + D3CAPDEF("D3DPSHADECAPS_COLORFLATRGB", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_COLORFLATRGB ), + D3CAPDEF("D3DPSHADECAPS_COLORGOURAUDMONO", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_COLORGOURAUDMONO ), + D3CAPDEF("D3DPSHADECAPS_COLORGOURAUDRGB", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_COLORGOURAUDRGB ), + D3CAPDEF("D3DPSHADECAPS_COLORPHONGMONO", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_COLORPHONGMONO ), + D3CAPDEF("D3DPSHADECAPS_COLORPHONGRGB", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_COLORPHONGRGB ), + + D3CAPDEF("D3DPSHADECAPS_SPECULARFLATMONO", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_SPECULARFLATMONO ), + D3CAPDEF("D3DPSHADECAPS_SPECULARFLATRGB", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_SPECULARFLATRGB ), + D3CAPDEF("D3DPSHADECAPS_SPECULARGOURAUDMONO", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_SPECULARGOURAUDMONO ), + D3CAPDEF("D3DPSHADECAPS_SPECULARGOURAUDRGB", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_SPECULARGOURAUDRGB ), + D3CAPDEF("D3DPSHADECAPS_SPECULARPHONGMONO", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_SPECULARPHONGMONO ), + D3CAPDEF("D3DPSHADECAPS_SPECULARPHONGRGB", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_SPECULARPHONGRGB ), + + D3CAPDEF("D3DPSHADECAPS_ALPHAFLATBLEND", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_ALPHAFLATBLEND ), + D3CAPDEF("D3DPSHADECAPS_ALPHAFLATSTIPPLED", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_ALPHAFLATSTIPPLED ), + D3CAPDEF("D3DPSHADECAPS_ALPHAGOURAUDBLEND", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_ALPHAGOURAUDBLEND ), + D3CAPDEF("D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED), + D3CAPDEF("D3DPSHADECAPS_ALPHAPHONGBLEND", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_ALPHAPHONGBLEND ), + D3CAPDEF("D3DPSHADECAPS_ALPHAPHONGSTIPPLED", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_ALPHAPHONGSTIPPLED ), + + D3CAPDEF("D3DPSHADECAPS_FOGFLAT", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_FOGFLAT ), + D3CAPDEF("D3DPSHADECAPS_FOGGOURAUD", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_FOGGOURAUD ), + D3CAPDEF("D3DPSHADECAPS_FOGPHONG", dpcLineCaps.dwShadeCaps, D3DPSHADECAPS_FOGPHONG ), + + D3CAPDEF("D3DPTEXTURECAPS_PERSPECTIVE", dpcLineCaps.dwTextureCaps, D3DPTEXTURECAPS_PERSPECTIVE ), + D3CAPDEF("D3DPTEXTURECAPS_POW2", dpcLineCaps.dwTextureCaps, D3DPTEXTURECAPS_POW2 ), + D3CAPDEF("D3DPTEXTURECAPS_ALPHA", dpcLineCaps.dwTextureCaps, D3DPTEXTURECAPS_ALPHA ), + D3CAPDEF("D3DPTEXTURECAPS_TRANSPARENCY", dpcLineCaps.dwTextureCaps, D3DPTEXTURECAPS_TRANSPARENCY ), + D3CAPDEF("D3DPTEXTURECAPS_BORDER", dpcLineCaps.dwTextureCaps, D3DPTEXTURECAPS_BORDER ), + D3CAPDEF("D3DPTEXTURECAPS_SQUAREONLY", dpcLineCaps.dwTextureCaps, D3DPTEXTURECAPS_SQUAREONLY ), + + + D3CAPDEF("D3DPTFILTERCAPS_NEAREST", dpcLineCaps.dwTextureFilterCaps, D3DPTFILTERCAPS_NEAREST ), + D3CAPDEF("D3DPTFILTERCAPS_LINEAR", dpcLineCaps.dwTextureFilterCaps, D3DPTFILTERCAPS_LINEAR ), + D3CAPDEF("D3DPTFILTERCAPS_MIPNEAREST", dpcLineCaps.dwTextureFilterCaps, D3DPTFILTERCAPS_MIPNEAREST ), + D3CAPDEF("D3DPTFILTERCAPS_MIPLINEAR", dpcLineCaps.dwTextureFilterCaps, D3DPTFILTERCAPS_MIPLINEAR ), + D3CAPDEF("D3DPTFILTERCAPS_LINEARMIPNEAREST", dpcLineCaps.dwTextureFilterCaps, D3DPTFILTERCAPS_LINEARMIPNEAREST ), + D3CAPDEF("D3DPTFILTERCAPS_LINEARMIPLINEAR", dpcLineCaps.dwTextureFilterCaps, D3DPTFILTERCAPS_LINEARMIPLINEAR ), + + + D3CAPDEF("D3DPTBLENDCAPS_DECAL", dpcLineCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_DECAL ), + D3CAPDEF("D3DPTBLENDCAPS_MODULATE", dpcLineCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_MODULATE ), + D3CAPDEF("D3DPTBLENDCAPS_DECALALPHA", dpcLineCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_DECALALPHA ), + D3CAPDEF("D3DPTBLENDCAPS_MODULATEALPHA", dpcLineCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_MODULATEALPHA ), + D3CAPDEF("D3DPTBLENDCAPS_DECALMASK", dpcLineCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_DECALMASK ), + D3CAPDEF("D3DPTBLENDCAPS_MODULATEMASK", dpcLineCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_MODULATEMASK ), + D3CAPDEF("D3DPTBLENDCAPS_COPY", dpcLineCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_COPY ), + + D3CAPDEF("D3DPTADDRESSCAPS_WRAP", dpcLineCaps.dwTextureAddressCaps, D3DPTADDRESSCAPS_WRAP ), + D3CAPDEF("D3DPTADDRESSCAPS_MIRROR", dpcLineCaps.dwTextureAddressCaps, D3DPTADDRESSCAPS_MIRROR ), + D3CAPDEF("D3DPTADDRESSCAPS_CLAMP", dpcLineCaps.dwTextureAddressCaps, D3DPTADDRESSCAPS_CLAMP ), + {"",0,0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF TriCaps[] = +{ + D3CAPDEF("D3DPMISCCAPS_MASKPLANES", dpcTriCaps.dwMiscCaps, D3DPMISCCAPS_MASKPLANES), + D3CAPDEF("D3DPMISCCAPS_MASKZ", dpcTriCaps.dwMiscCaps, D3DPMISCCAPS_MASKZ), + D3CAPDEF("D3DPMISCCAPS_LINEPATTERNREP", dpcTriCaps.dwMiscCaps, D3DPMISCCAPS_LINEPATTERNREP), + D3CAPDEF("D3DPMISCCAPS_CONFORMANT", dpcTriCaps.dwMiscCaps, D3DPMISCCAPS_CONFORMANT), + D3CAPDEF("D3DPMISCCAPS_CULLNONE", dpcTriCaps.dwMiscCaps, D3DPMISCCAPS_CULLNONE), + D3CAPDEF("D3DPMISCCAPS_CULLCW", dpcTriCaps.dwMiscCaps, D3DPMISCCAPS_CULLCW), + D3CAPDEF("D3DPMISCCAPS_CULLCCW", dpcTriCaps.dwMiscCaps, D3DPMISCCAPS_CULLCCW), + + D3CAPDEF("D3DPRASTERCAPS_DITHER", dpcTriCaps.dwRasterCaps, D3DPRASTERCAPS_DITHER), + D3CAPDEF("D3DPRASTERCAPS_ROP2", dpcTriCaps.dwRasterCaps, D3DPRASTERCAPS_ROP2), + D3CAPDEF("D3DPRASTERCAPS_XOR", dpcTriCaps.dwRasterCaps, D3DPRASTERCAPS_XOR), + D3CAPDEF("D3DPRASTERCAPS_PAT", dpcTriCaps.dwRasterCaps, D3DPRASTERCAPS_PAT), + D3CAPDEF("D3DPRASTERCAPS_ZTEST", dpcTriCaps.dwRasterCaps, D3DPRASTERCAPS_ZTEST), + D3CAPDEF("D3DPRASTERCAPS_SUBPIXEL", dpcTriCaps.dwRasterCaps, D3DPRASTERCAPS_SUBPIXEL), + D3CAPDEF("D3DPRASTERCAPS_SUBPIXELX", dpcTriCaps.dwRasterCaps, D3DPRASTERCAPS_SUBPIXELX), + D3CAPDEF("D3DPRASTERCAPS_FOGVERTEX", dpcTriCaps.dwRasterCaps, D3DPRASTERCAPS_FOGVERTEX), + D3CAPDEF("D3DPRASTERCAPS_FOGTABLE", dpcTriCaps.dwRasterCaps, D3DPRASTERCAPS_FOGTABLE), + + D3CAPDEF("D3DPCMPCAPS_NEVER", dpcTriCaps.dwZCmpCaps, D3DPCMPCAPS_NEVER ), + D3CAPDEF("D3DPCMPCAPS_LESS", dpcTriCaps.dwZCmpCaps, D3DPCMPCAPS_LESS ), + D3CAPDEF("D3DPCMPCAPS_EQUAL", dpcTriCaps.dwZCmpCaps, D3DPCMPCAPS_EQUAL ), + D3CAPDEF("D3DPCMPCAPS_LESSEQUAL", dpcTriCaps.dwZCmpCaps, D3DPCMPCAPS_LESSEQUAL ), + D3CAPDEF("D3DPCMPCAPS_GREATER", dpcTriCaps.dwZCmpCaps, D3DPCMPCAPS_GREATER ), + D3CAPDEF("D3DPCMPCAPS_NOTEQUAL", dpcTriCaps.dwZCmpCaps, D3DPCMPCAPS_NOTEQUAL ), + D3CAPDEF("D3DPCMPCAPS_GREATEREQUAL", dpcTriCaps.dwZCmpCaps, D3DPCMPCAPS_GREATEREQUAL ), + D3CAPDEF("D3DPCMPCAPS_ALWAYS", dpcTriCaps.dwZCmpCaps, D3DPCMPCAPS_ALWAYS ), + + D3CAPDEF("D3DPBLENDCAPS_ZERO", dpcTriCaps.dwSrcBlendCaps, D3DPBLENDCAPS_ZERO ), + D3CAPDEF("D3DPBLENDCAPS_ONE", dpcTriCaps.dwSrcBlendCaps, D3DPBLENDCAPS_ONE ), + D3CAPDEF("D3DPBLENDCAPS_SRCCOLOR", dpcTriCaps.dwSrcBlendCaps, D3DPBLENDCAPS_SRCCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_INVSRCCOLOR", dpcTriCaps.dwSrcBlendCaps, D3DPBLENDCAPS_INVSRCCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_SRCALPHA", dpcTriCaps.dwSrcBlendCaps, D3DPBLENDCAPS_SRCALPHA ), + D3CAPDEF("D3DPBLENDCAPS_INVSRCALPHA", dpcTriCaps.dwSrcBlendCaps, D3DPBLENDCAPS_INVSRCALPHA ), + D3CAPDEF("D3DPBLENDCAPS_DESTALPHA", dpcTriCaps.dwSrcBlendCaps, D3DPBLENDCAPS_DESTALPHA ), + D3CAPDEF("D3DPBLENDCAPS_INVDESTALPHA", dpcTriCaps.dwSrcBlendCaps, D3DPBLENDCAPS_INVDESTALPHA ), + D3CAPDEF("D3DPBLENDCAPS_DESTCOLOR", dpcTriCaps.dwSrcBlendCaps, D3DPBLENDCAPS_DESTCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_INVDESTCOLOR", dpcTriCaps.dwSrcBlendCaps, D3DPBLENDCAPS_INVDESTCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_SRCALPHASAT", dpcTriCaps.dwSrcBlendCaps, D3DPBLENDCAPS_SRCALPHASAT ), + D3CAPDEF("D3DPBLENDCAPS_BOTHSRCALPHA", dpcTriCaps.dwSrcBlendCaps, D3DPBLENDCAPS_BOTHSRCALPHA ), + D3CAPDEF("D3DPBLENDCAPS_BOTHINVSRCALPHA", dpcTriCaps.dwSrcBlendCaps, D3DPBLENDCAPS_BOTHINVSRCALPHA ), + + D3CAPDEF("D3DPBLENDCAPS_ZERO", dpcTriCaps.dwDestBlendCaps, D3DPBLENDCAPS_ZERO ), + D3CAPDEF("D3DPBLENDCAPS_ONE", dpcTriCaps.dwDestBlendCaps, D3DPBLENDCAPS_ONE ), + D3CAPDEF("D3DPBLENDCAPS_SRCCOLOR", dpcTriCaps.dwDestBlendCaps, D3DPBLENDCAPS_SRCCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_INVSRCCOLOR", dpcTriCaps.dwDestBlendCaps, D3DPBLENDCAPS_INVSRCCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_SRCALPHA", dpcTriCaps.dwDestBlendCaps, D3DPBLENDCAPS_SRCALPHA ), + D3CAPDEF("D3DPBLENDCAPS_INVSRCALPHA", dpcTriCaps.dwDestBlendCaps, D3DPBLENDCAPS_INVSRCALPHA ), + D3CAPDEF("D3DPBLENDCAPS_DESTALPHA", dpcTriCaps.dwDestBlendCaps, D3DPBLENDCAPS_DESTALPHA ), + D3CAPDEF("D3DPBLENDCAPS_INVDESTALPHA", dpcTriCaps.dwDestBlendCaps, D3DPBLENDCAPS_INVDESTALPHA ), + D3CAPDEF("D3DPBLENDCAPS_DESTCOLOR", dpcTriCaps.dwDestBlendCaps, D3DPBLENDCAPS_DESTCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_INVDESTCOLOR", dpcTriCaps.dwDestBlendCaps, D3DPBLENDCAPS_INVDESTCOLOR ), + D3CAPDEF("D3DPBLENDCAPS_SRCALPHASAT", dpcTriCaps.dwDestBlendCaps, D3DPBLENDCAPS_SRCALPHASAT ), + D3CAPDEF("D3DPBLENDCAPS_BOTHSRCALPHA", dpcTriCaps.dwDestBlendCaps, D3DPBLENDCAPS_BOTHSRCALPHA ), + D3CAPDEF("D3DPBLENDCAPS_BOTHINVSRCALPHA", dpcTriCaps.dwDestBlendCaps, D3DPBLENDCAPS_BOTHINVSRCALPHA ), + + D3CAPDEF("D3DPCMPCAPS_NEVER", dpcTriCaps.dwAlphaCmpCaps, D3DPCMPCAPS_NEVER ), + D3CAPDEF("D3DPCMPCAPS_LESS", dpcTriCaps.dwAlphaCmpCaps, D3DPCMPCAPS_LESS ), + D3CAPDEF("D3DPCMPCAPS_EQUAL", dpcTriCaps.dwAlphaCmpCaps, D3DPCMPCAPS_EQUAL ), + D3CAPDEF("D3DPCMPCAPS_LESSEQUAL", dpcTriCaps.dwAlphaCmpCaps, D3DPCMPCAPS_LESSEQUAL ), + D3CAPDEF("D3DPCMPCAPS_GREATER", dpcTriCaps.dwAlphaCmpCaps, D3DPCMPCAPS_GREATER ), + D3CAPDEF("D3DPCMPCAPS_NOTEQUAL", dpcTriCaps.dwAlphaCmpCaps, D3DPCMPCAPS_NOTEQUAL ), + D3CAPDEF("D3DPCMPCAPS_GREATEREQUAL", dpcTriCaps.dwAlphaCmpCaps, D3DPCMPCAPS_GREATEREQUAL ), + D3CAPDEF("D3DPCMPCAPS_ALWAYS", dpcTriCaps.dwAlphaCmpCaps, D3DPCMPCAPS_ALWAYS ), + + D3CAPDEF("D3DPSHADECAPS_COLORFLATMONO", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_COLORFLATMONO ), + D3CAPDEF("D3DPSHADECAPS_COLORFLATRGB", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_COLORFLATRGB ), + D3CAPDEF("D3DPSHADECAPS_COLORGOURAUDMONO", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_COLORGOURAUDMONO ), + D3CAPDEF("D3DPSHADECAPS_COLORGOURAUDRGB", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_COLORGOURAUDRGB ), + D3CAPDEF("D3DPSHADECAPS_COLORPHONGMONO", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_COLORPHONGMONO ), + D3CAPDEF("D3DPSHADECAPS_COLORPHONGRGB", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_COLORPHONGRGB ), + + D3CAPDEF("D3DPSHADECAPS_SPECULARFLATMONO", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_SPECULARFLATMONO ), + D3CAPDEF("D3DPSHADECAPS_SPECULARFLATRGB", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_SPECULARFLATRGB ), + D3CAPDEF("D3DPSHADECAPS_SPECULARGOURAUDMONO", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_SPECULARGOURAUDMONO ), + D3CAPDEF("D3DPSHADECAPS_SPECULARGOURAUDRGB", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_SPECULARGOURAUDRGB ), + D3CAPDEF("D3DPSHADECAPS_SPECULARPHONGMONO", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_SPECULARPHONGMONO ), + D3CAPDEF("D3DPSHADECAPS_SPECULARPHONGRGB", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_SPECULARPHONGRGB ), + + D3CAPDEF("D3DPSHADECAPS_ALPHAFLATBLEND", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_ALPHAFLATBLEND ), + D3CAPDEF("D3DPSHADECAPS_ALPHAFLATSTIPPLED", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_ALPHAFLATSTIPPLED ), + D3CAPDEF("D3DPSHADECAPS_ALPHAGOURAUDBLEND", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_ALPHAGOURAUDBLEND ), + D3CAPDEF("D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED), + D3CAPDEF("D3DPSHADECAPS_ALPHAPHONGBLEND", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_ALPHAPHONGBLEND ), + D3CAPDEF("D3DPSHADECAPS_ALPHAPHONGSTIPPLED", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_ALPHAPHONGSTIPPLED ), + + D3CAPDEF("D3DPSHADECAPS_FOGFLAT", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_FOGFLAT ), + D3CAPDEF("D3DPSHADECAPS_FOGGOURAUD", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_FOGGOURAUD ), + D3CAPDEF("D3DPSHADECAPS_FOGPHONG", dpcTriCaps.dwShadeCaps, D3DPSHADECAPS_FOGPHONG ), + + D3CAPDEF("D3DPTEXTURECAPS_PERSPECTIVE", dpcTriCaps.dwTextureCaps, D3DPTEXTURECAPS_PERSPECTIVE ), + D3CAPDEF("D3DPTEXTURECAPS_POW2", dpcTriCaps.dwTextureCaps, D3DPTEXTURECAPS_POW2 ), + D3CAPDEF("D3DPTEXTURECAPS_ALPHA", dpcTriCaps.dwTextureCaps, D3DPTEXTURECAPS_ALPHA ), + D3CAPDEF("D3DPTEXTURECAPS_TRANSPARENCY", dpcTriCaps.dwTextureCaps, D3DPTEXTURECAPS_TRANSPARENCY ), + D3CAPDEF("D3DPTEXTURECAPS_BORDER", dpcTriCaps.dwTextureCaps, D3DPTEXTURECAPS_BORDER ), + D3CAPDEF("D3DPTEXTURECAPS_SQUAREONLY", dpcTriCaps.dwTextureCaps, D3DPTEXTURECAPS_SQUAREONLY ), + + + D3CAPDEF("D3DPTFILTERCAPS_NEAREST", dpcTriCaps.dwTextureFilterCaps, D3DPTFILTERCAPS_NEAREST ), + D3CAPDEF("D3DPTFILTERCAPS_LINEAR", dpcTriCaps.dwTextureFilterCaps, D3DPTFILTERCAPS_LINEAR ), + D3CAPDEF("D3DPTFILTERCAPS_MIPNEAREST", dpcTriCaps.dwTextureFilterCaps, D3DPTFILTERCAPS_MIPNEAREST ), + D3CAPDEF("D3DPTFILTERCAPS_MIPLINEAR", dpcTriCaps.dwTextureFilterCaps, D3DPTFILTERCAPS_MIPLINEAR ), + D3CAPDEF("D3DPTFILTERCAPS_LINEARMIPNEAREST", dpcTriCaps.dwTextureFilterCaps, D3DPTFILTERCAPS_LINEARMIPNEAREST ), + D3CAPDEF("D3DPTFILTERCAPS_LINEARMIPLINEAR", dpcTriCaps.dwTextureFilterCaps, D3DPTFILTERCAPS_LINEARMIPLINEAR ), + + + D3CAPDEF("D3DPTBLENDCAPS_DECAL", dpcTriCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_DECAL ), + D3CAPDEF("D3DPTBLENDCAPS_MODULATE", dpcTriCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_MODULATE ), + D3CAPDEF("D3DPTBLENDCAPS_DECALALPHA", dpcTriCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_DECALALPHA ), + D3CAPDEF("D3DPTBLENDCAPS_MODULATEALPHA", dpcTriCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_MODULATEALPHA ), + D3CAPDEF("D3DPTBLENDCAPS_DECALMASK", dpcTriCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_DECALMASK ), + D3CAPDEF("D3DPTBLENDCAPS_MODULATEMASK", dpcTriCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_MODULATEMASK ), + D3CAPDEF("D3DPTBLENDCAPS_COPY", dpcTriCaps.dwTextureBlendCaps, D3DPTBLENDCAPS_COPY ), + + D3CAPDEF("D3DPTADDRESSCAPS_WRAP", dpcTriCaps.dwTextureAddressCaps, D3DPTADDRESSCAPS_WRAP ), + D3CAPDEF("D3DPTADDRESSCAPS_MIRROR", dpcTriCaps.dwTextureAddressCaps, D3DPTADDRESSCAPS_MIRROR ), + D3CAPDEF("D3DPTADDRESSCAPS_CLAMP", dpcTriCaps.dwTextureAddressCaps, D3DPTADDRESSCAPS_CLAMP ), + {"",0,0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF D3dMisc[] = +{ + D3VALDEF("MaxBufferSize", dwMaxBufferSize), + D3VALDEF("MaxVertexCount", dwMaxVertexCount), + D3VALDEF("DeviceRenderBitDepth", dwDeviceRenderBitDepth), + D3VALDEF("DeviceZBufferBitDepth", dwDeviceZBufferBitDepth), + {"",0,0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEFS D3CapDefs[] = +{ + {"", D3AddCaps, (LPARAM)ValidFlags}, + {"ColorModel", D3AddCaps, (LPARAM)ColorModel}, + {"DevCaps", D3AddCaps, (LPARAM)DevCaps}, + {"TransformCaps", D3AddCaps, (LPARAM)TransformCaps}, + {"LightingCaps", D3AddCaps, (LPARAM)LightingCaps}, + {"BClipping", D3AddCaps, (LPARAM)BClipping}, + {"LineCaps", D3AddCaps, (LPARAM)LineCaps}, + {"TriCaps", D3AddCaps, (LPARAM)TriCaps}, + {"Misc", D3AddCaps, (LPARAM)D3dMisc}, + {NULL, 0, 0} +}; +#endif + +/**************************************************************************** + ***************************************************************************/ +CAPDEF DSInfo[] = +{ + DSVALDEF("MinSecondarySampleRate", dwMinSecondarySampleRate), + DSVALDEF("MaxSecondarySampleRate", dwMaxSecondarySampleRate), + DSVALDEF("PrimaryBuffers", dwPrimaryBuffers), + DSVALDEF("MaxHwMixingAllBuffers", dwMaxHwMixingAllBuffers), + DSVALDEF("MaxHwMixingStaticBuffers", dwMaxHwMixingStaticBuffers), + DSVALDEF("MaxHwMixingStreamingBuffers", dwMaxHwMixingStreamingBuffers), + DSVALDEF("FreeHwMixingAllBuffers", dwFreeHwMixingAllBuffers), + DSVALDEF("FreeHwMixingStaticBuffers", dwFreeHwMixingStaticBuffers), + DSVALDEF("FreeHwMixingStreamingBuffers", dwFreeHwMixingStreamingBuffers), + DSVALDEF("MaxHw3DAllBuffers", dwMaxHw3DAllBuffers), + DSVALDEF("MaxHw3DStaticBuffers", dwMaxHw3DStaticBuffers), + DSVALDEF("MaxHw3DStreamingBuffers", dwMaxHw3DStreamingBuffers), + DSVALDEF("FreeHw3DAllBuffers", dwFreeHw3DAllBuffers), + DSVALDEF("FreeHw3DStaticBuffers", dwFreeHw3DStaticBuffers), + DSVALDEF("FreeHw3DStreamingBuffers", dwFreeHw3DStreamingBuffers), + DSVALDEF("TotalHwMemBytes", dwTotalHwMemBytes), + DSVALDEF("FreeHwMemBytes", dwFreeHwMemBytes), + DSVALDEF("MaxContigFreeHwMemBytes", dwMaxContigFreeHwMemBytes), + DSVALDEF("UnlockTransferRateHwBuffers", dwUnlockTransferRateHwBuffers), + DSVALDEF("PlayCpuOverheadSwBuffers", dwPlayCpuOverheadSwBuffers), + {"", 0, 0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF DSGeneralCaps[] = +{ + DSCAPDEF("PRIMARYMONO", dwFlags, DSCAPS_PRIMARYMONO), + DSCAPDEF("PRIMARYSTEREO", dwFlags, DSCAPS_PRIMARYSTEREO), + DSCAPDEF("PRIMARY8BIT", dwFlags, DSCAPS_PRIMARY8BIT), + DSCAPDEF("PRIMARY16BIT", dwFlags, DSCAPS_PRIMARY16BIT), + DSCAPDEF("CONTINUOUSRATE", dwFlags, DSCAPS_CONTINUOUSRATE), + DSCAPDEF("EMULDRIVER", dwFlags, DSCAPS_EMULDRIVER), + DSCAPDEF("SECONDARYMONO", dwFlags, DSCAPS_SECONDARYMONO), + DSCAPDEF("SECONDARYSTEREO", dwFlags, DSCAPS_SECONDARYSTEREO), + DSCAPDEF("SECONDARY8BIT", dwFlags, DSCAPS_SECONDARY8BIT), + DSCAPDEF("SECONDARY16BIT", dwFlags, DSCAPS_SECONDARY16BIT), + {"", 0, 0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEFS DSCapDefs[] = +{ + {"", DSAddCaps, (LPARAM)DSInfo}, + {"General", DSAddCaps, (LPARAM)DSInfo}, + {"General Caps", DSAddCaps, (LPARAM)DSGeneralCaps}, + {NULL, 0, 0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEF DPInfo[] = +{ + DPVALDEF("MaxBufferSize", dwMaxBufferSize), + DPVALDEF("MaxQueueSize", dwMaxQueueSize), + DPVALDEF("MaxPlayers", dwMaxPlayers), + DPVALDEF("HundredBaud", dwHundredBaud), + DPVALDEF("Latency", dwLatency), + {"", 0, 0} +}; + +/**************************************************************************** + ***************************************************************************/ +CAPDEFS DPCapDefs[] = +{ + {"", DPAddCaps, (LPARAM)DPInfo}, + {"General", DPAddCaps, (LPARAM)DPInfo}, + {"Sessions", DPAddSessions, (LPARAM)0}, + {NULL, 0, 0} +}; + +//================================================================ +// WinMain - entry point +//================================================================ +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + + g_hInstance = hInstance; // Store instance handle in our global variable + + if (InitInstance(hInstance, lpCmdLine, nCmdShow, DXView_WIDTH, DXView_HEIGHT)) + { + while(GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + return(msg.wParam); +} + +//================================================================ +// InitInstance - create main window +//================================================================ +BOOL InitInstance(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow, int iWidth, int iHeight) +{ + WNDCLASS wc; + + wc.style = CS_HREDRAW | CS_VREDRAW; // Class style(s). + wc.lpfnWndProc = (WNDPROC)WndProc; // Window Procedure + wc.cbClsExtra = 0; // No per-class extra data. + wc.cbWndExtra = 0; // No per-window extra data. + wc.hInstance = hInstance; // Owner of this class + wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DIRECTX)); // Icon name from .RC + wc.hCursor = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_SPLIT));// Cursor + wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); // Default color + wc.lpszMenuName = "Menu"; // Menu name from .RC + wc.lpszClassName = g_szClassName; // Name to register as + + if(!RegisterClass(&wc)) + { + return FALSE; + } + + // Create a main window for this application instance. + g_hwndMain = CreateWindowEx( + 0, + g_szClassName, // See RegisterClass() call. + g_szTitle, // Text for window title bar. + WS_OVERLAPPEDWINDOW,// Window style. + CW_USEDEFAULT, CW_USEDEFAULT, iWidth, iHeight, // Use default positioning + NULL, // Overlapped windows have no parent. + NULL, // Use the window class menu. + hInstance, // This instance owns this window. + NULL); + + // If window could not be created, return "failure" + if (!g_hwndMain) + { + return(FALSE); + } + + // Make the window visible; update its client area; and return "success" + ShowWindow(g_hwndMain, nCmdShow); // Show the window + + return(TRUE); // We succeeded... +} + +//================================================================ +// WndProc - main window proc +//================================================================ +LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch(message) + { + case WM_CREATE: + return DXView_OnCreate(hwnd); + + case WM_SIZE: + DXView_OnSize(hwnd); + break; + + case WM_LBUTTONDOWN: + g_bSplitMove = TRUE; + SetCapture(hwnd); + break; + + case WM_LBUTTONUP: + g_bSplitMove = FALSE; + ReleaseCapture(); + break; + + case WM_MOUSEMOVE: + if(g_bSplitMove) + { + g_xPaneSplit = (LOWORD(lParam) - g_xHalfSplitWidth); + DXView_OnSize(hwnd); + } + break; + + case WM_NOTIFY: + if (((NMHDR*)lParam)->hwndFrom == g_hwndTV) + { + if (((NMHDR*)lParam)->code == TVN_SELCHANGED) + DXView_OnTreeSelect(g_hwndTV, (NM_TREEVIEW*)lParam); + } + + if (((NMHDR*)lParam)->hwndFrom == g_hwndLV) + { + if (((NMHDR*)lParam)->code == NM_RDBLCLK) + DXView_OnListViewDblClick(g_hwndLV, (NM_LISTVIEW*)lParam); + } + + break; + + case WM_COMMAND: // message: command from application menu + DXView_OnCommand(hwnd, wParam); + break; + + case WM_CLOSE: + DestroyWindow(hwnd); + return 0; + + case WM_DESTROY: // message: window being destroyed + DXView_Cleanup(); // Free per item struct for all items + PostQuitMessage(0); + break; + } + + return(DefWindowProc(hwnd, message, wParam, lParam)); +} + +//================================================================ +//================================================================ +BOOL DXView_OnCreate(HWND hwnd) +{ + HDC hDC; + int PixelsPerInch; + TEXTMETRIC tm; + static TCHAR szBuf[MAX_PATH]; + + hDC = GetDC(hwnd); + PixelsPerInch = GetDeviceCaps(hDC, LOGPIXELSX); + g_hFont = GetStockObject(ANSI_FIXED_FONT); + SelectObject(hDC, g_hFont); + GetTextMetrics(hDC, &tm); + g_tmAveCharWidth = tm.tmAveCharWidth; + ReleaseDC(hwnd, hDC); + + // Initialize global data + g_dwViewState = IDM_VIEWAVAIL; + g_xPaneSplit = PixelsPerInch * 9 / 4; // 2.25 inches + g_xHalfSplitWidth = GetSystemMetrics(SM_CXSIZEFRAME) / 2; + + // Make sure that the common control library read to rock + InitCommonControls(); + + CheckMenuItem(GetMenu(hwnd), g_dwViewState, MF_BYCOMMAND | MF_CHECKED); + + // Create the list view window. + g_hwndLV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, "", + WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT, + 0, 0, 0, 0, hwnd, (HMENU)IDC_LV, g_hInstance, NULL); + + // create the tree view window. + g_hwndTV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, "", + WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES | + TVS_HASBUTTONS | TVS_LINESATROOT, + 0, 0, 0, 0, hwnd, (HMENU)IDC_TV, g_hInstance, NULL); + + // create our image list. + DXView_InitImageList(); + + // Initialize the tree view + DXView_FillTree(g_hwndTV); + + return(TRUE); +} + +//================================================================ +//================================================================ +IDirectDraw * DDCreate(GUID *pid) +{ + if (lpDD && pid == ddid) + return lpDD; + + if (lpDD) + { + IDirectDraw_Release(lpDD); + lpDD = NULL; + } + + // There is no need to create DirectDraw emulation-only just to get + // the HEL caps. In fact, this will fail if there is another DirectDraw + // app running and using the hardware. + if( pid == (GUID *)DDCREATE_EMULATIONONLY ) + { + pid = NULL; + } + if (DirectDrawCreate(pid, &lpDD, NULL) == DD_OK) + { + ddid = pid; + return lpDD; + } + + MessageBox(g_hwndMain, "DirectDrawCreate failed.", g_szAppName, MB_OK); + return NULL; +} + + +//================================================================ +//================================================================ +IDirectSound * DSCreate(GUID *pid) +{ + if (lpDS && pid == dsid) + return lpDS; + + if (lpDS) + IDirectSound_Release(lpDS); + + if (DirectSoundCreate(pid, &lpDS, NULL) == DD_OK) + { + dsid = pid; + return lpDS; + } + + MessageBox(g_hwndMain, "DirectSoundCreate failed.", g_szAppName, MB_OK); + return NULL; +} + +//================================================================ +//================================================================ +IDirectPlay * DPCreate(GUID *pid) +{ + if (lpDP && pid == dpid) + return lpDP; + + if (lpDP) + lpDP->lpVtbl->Release(lpDP); + + if (DirectPlayCreate(pid, &lpDP, NULL) == DD_OK) + { + dpid = pid; + return lpDP; + } + + MessageBox(g_hwndMain, "DirectPlayCreate failed.", g_szAppName, MB_OK); + return NULL; +} + +//================================================================ +//================================================================ +void AddCapsToTV(HTREEITEM hParent, CAPDEFS *pcds, LPARAM lParam1) +{ + HTREEITEM hTree; + BOOL f = TRUE; + + while (pcds->szName) + { + hTree = TVAddNode(hParent, pcds->szName, f, IDI_CAPS, + pcds->Callback, lParam1, pcds->lParam2); + + if (f) + { + hParent = hTree; + f = FALSE; + } + + pcds++; // Get next Cap bit definition + } +} + +//================================================================ +//================================================================ +char c_szYes[] = "Yes"; +char c_szNo[] = "No"; +char c_szCurrentMode[] = "Current Mode"; + +//================================================================ +//================================================================ +void AddCapsToLV(CAPDEF *pcd, LPVOID pv) +{ + DWORD dwValue; + + LVAddColumn(g_hwndLV, 0, "Name", 24); + LVAddColumn(g_hwndLV, 1, "Value", 10); + + while(pcd->szName && *pcd->szName) + { + dwValue = *(DWORD *)(((BYTE *)pv) + pcd->dwOffset); + + if (pcd->dwFlag) + { + if (pcd->dwFlag & dwValue) + { + LVAddText(g_hwndLV, 0, pcd->szName); + LVAddText(g_hwndLV, 1, c_szYes); + } + else if (g_dwViewState == IDM_VIEWALL) + { + LVAddText(g_hwndLV, 0, pcd->szName); + LVAddText(g_hwndLV, 1, c_szNo); + } + } + else + { + LVAddText(g_hwndLV, 0, pcd->szName, "test"); + LVAddText(g_hwndLV, 1, "%d", dwValue); + } + + pcd++; // Get next Cap bit definition + } +} + +//================================================================ +//================================================================ +void DDAddCaps(LPARAM lParam1, LPARAM lParam2) +{ + // lParam1 is the GUID for the driver we should open + // lParam2 is the CAPDEF table we should use + + if (DDCreate((GUID*)lParam1)) + { + DDCAPS ddcaps; + + ddcaps.dwSize = sizeof(ddcaps); + + if (lParam1 == DDCREATE_EMULATIONONLY) + IDirectDraw_GetCaps(lpDD, NULL, &ddcaps); + else + IDirectDraw_GetCaps(lpDD, &ddcaps, NULL); + + AddCapsToLV((CAPDEF *)lParam2, (LPVOID)&ddcaps); + } +} + +//================================================================ +//================================================================ +void DSAddCaps(LPARAM lParam1, LPARAM lParam2) +{ + // lParam1 is the GUID for the driver we should open + // lParam2 is the CAPDEF table we should use + + if (DSCreate((GUID*)lParam1)) + { + DSCAPS dscaps; + + dscaps.dwSize = sizeof(dscaps); + + IDirectSound_GetCaps(lpDS, &dscaps); + + AddCapsToLV((CAPDEF *)lParam2, (LPVOID)&dscaps); + } +} + +//================================================================ +//================================================================ +void DPAddCaps(LPARAM lParam1, LPARAM lParam2) +{ + // lParam1 is the GUID for the driver we should open + // lParam2 is the CAPDEF table we should use + + if (DPCreate((GUID*)lParam1)) + { + DPCAPS dpcaps; + + dpcaps.dwSize = sizeof(dpcaps); + lpDP->lpVtbl->GetCaps(lpDP, &dpcaps); + + AddCapsToLV((CAPDEF *)lParam2, (LPVOID)&dpcaps); + } +} + +//================================================================ +//================================================================ +#ifdef DX_3D +void D3AddCaps(LPARAM lParam1, LPARAM lParam2) +{ + // lParam1 is the CAP3DDEVICEDESC Struct + // lParam2 is the CAPDEF table we should use + + // Unlike other AddCaps function this info has been prethought for us + // so just print it out. + AddCapsToLV((CAPDEF *)lParam2, (LPVOID)lParam1); +} +#endif + +//================================================================ +// EnumSessionsCallback +//================================================================ +BOOL PASCAL EnumSessionsCallback +( +LPDPSESSIONDESC lpDesc, // Pointer to Session Description Struct +LPVOID lpUser, // User definable data passed in from EnumSessions() call. +LPDWORD lpdwTimeOut, // Used to extend the timeout if hosts aren't responding quickly enough. +DWORD dwFlags // Flags (used to notify us when we've timed out). +) +{ + if (dwFlags & DPESC_TIMEDOUT) + { + // We could reset lpdwTimeOut and return true to continue waiting + // NOTE: This does not tell DirectPlay to query again for hosts. + // This just gives potentially slow hosts more time to respond + // to our initial query. + return FALSE; // Stop waiting for hosts + } + + // Add session information to table + LVAddText(g_hwndLV, 0, lpDesc->szSessionName); + LVAddText(g_hwndLV, 1, "%d", lpDesc->dwSession); + LVAddText(g_hwndLV, 2, "%d", lpDesc->dwMaxPlayers); + LVAddText(g_hwndLV, 3, "%d", lpDesc->dwCurrentPlayers); + + return TRUE; +} + +//================================================================ +//================================================================ +void DPAddSessions(LPARAM lParam1, LPARAM lParam2) +{ + // lParam1 is the GUID for the driver we should open + // lParam2 is the CAPDEF table we should use + + DPSESSIONDESC dps; + HCURSOR hCur=NULL; + + dps.dwSize = sizeof(dps); + memset(&dps.guidSession, 0, sizeof(dps.guidSession)); + + hCur=SetCursor(LoadCursor(NULL, IDC_WAIT)); + if (DPCreate((GUID*)lParam1)) + { + LVAddColumn(g_hwndLV, 0, "Name", 24); + LVAddColumn(g_hwndLV, 1, "Session", 7); + LVAddColumn(g_hwndLV, 2, "MaxPlayers", 11); + LVAddColumn(g_hwndLV, 3, "CurrentPlayers", 14); + + lpDP->lpVtbl->EnumSessions(lpDP, &dps, 500, EnumSessionsCallback, NULL, DPENUMSESSIONS_ALL); + } + if (hCur) + SetCursor(hCur); + +} + +//================================================================ +//================================================================ +void DDFourCCFormat(LPARAM lParam1, LPARAM lParam2) +{ + HRESULT ddrval; + int iNumOfCodes,iCount; + DWORD *FourCC; + char szText[5]={0,0,0,0,0}; + + if(lpDD != NULL) + { + ddrval = IDirectDraw_GetFourCCCodes(lpDD,&iNumOfCodes, NULL); + LVAddColumn(g_hwndLV, 0, "Codes", 24); + LVAddColumn(g_hwndLV, 1, "", 24); + if( ddrval == DD_OK) + { + FourCC = GlobalAlloc(GPTR,(sizeof(DWORD)*iNumOfCodes)); + if(FourCC) + { + ddrval = IDirectDraw_GetFourCCCodes(lpDD,&iNumOfCodes, FourCC); + // Assume all FourCC values are ascii strings + for(iCount = 0;iCount < iNumOfCodes; iCount++) + { + memcpy(szText,&FourCC[iCount],4); + LVAddText(g_hwndLV, 0, "%s", szText); + } + } + } + } +} + +//================================================================ +//================================================================ +typedef struct LLMode +{ + DWORD x,y,bpp; + BOOL IsModeX; + struct LLMode *Next; +}LinkMode; + +static LinkMode *pModesHead = NULL; + +//================================================================ +// EnumDisplayModesCallback1 +//================================================================ +HRESULT CALLBACK EnumDisplayModesCallback1(LPDDSURFACEDESC pddsd, LPVOID Context) +{ + static LinkMode *pModesTail = NULL; + LinkMode *tmp=NULL; + + tmp = GlobalAlloc(GPTR,sizeof(LinkMode)); + if(tmp != NULL) + { + tmp->x = pddsd->dwWidth; + tmp->y = pddsd->dwHeight; + tmp->bpp = pddsd->ddpfPixelFormat.dwRGBBitCount; + tmp->IsModeX = TRUE; + tmp->Next = NULL; + if(pModesHead == NULL) + { + pModesHead = tmp; + pModesTail = tmp; + }else + { + pModesTail->Next = tmp; + pModesTail = tmp; + } + }//Hey if we out of memory silent failure + return DDENUMRET_OK; + +} /* EnumModesCallback */ + +//================================================================ +// EnumDisplayModesCallback2 +//================================================================ +HRESULT CALLBACK EnumDisplayModesCallback2(LPDDSURFACEDESC pddsd, LPVOID Context) +{ + LinkMode *tmp= NULL; + + tmp = pModesHead; + while(tmp != NULL) //cycle though all modes since unique modes don't always happen + { + if( tmp->x == pddsd->dwWidth && + tmp->y == pddsd->dwHeight && + tmp->bpp == pddsd->ddpfPixelFormat.dwRGBBitCount) + { + tmp->IsModeX = FALSE; + + } + tmp = tmp->Next; + } + + return DDENUMRET_OK; + +} /* EnumModesCallback */ + +//================================================================ +// EnumDisplayModesCallback2 +//================================================================ +void DisplayEnumModes() +{ + LinkMode *tmp= NULL; + + tmp = pModesHead; + while(tmp != NULL) //cycle though all modes since unique modes don't always happen + { + if(tmp->IsModeX) + { + LVAddText(g_hwndLV, 0, "%dx%dx%d (ModeX)", tmp->x, tmp->y, tmp->bpp); + }else + { + LVAddText(g_hwndLV, 0, "%dx%dx%d ", tmp->x, tmp->y, tmp->bpp); + } + tmp = tmp->Next; + } +} /* EnumModesCallback */ + +//================================================================ +// Should we hourglass the cursor? this takes a while +//================================================================ +void DDAddVideoModes(LPARAM lParam1, LPARAM lParam2) +{ + DWORD mode; + DDSURFACEDESC ddsd; + + LVAddColumn(g_hwndLV, 0, "Mode", 24); + LVAddColumn(g_hwndLV, 1, "", 24); + + // lParam1 is the GUID for the driver we should open + // lParam2 is not used + + if (DDCreate((GUID*)lParam1)) + { + // Get the current mode mode for this driver + ddsd.dwSize = sizeof(DDSURFACEDESC); + IDirectDraw_GetDisplayMode(lpDD, &ddsd); + + mode = MAKEMODE(ddsd.dwWidth, ddsd.dwHeight, ddsd.ddpfPixelFormat.dwRGBBitCount); + + // Find all mode for this driver and add them to the listview + //Erase previous list + { + LinkMode *tmp, *tmp1; + + tmp = pModesHead; + while(tmp != NULL) + { + tmp1 = tmp; + tmp = tmp->Next; + GlobalFree(tmp1); //Note We will exit with a list in place + } + pModesHead = NULL; + } + //Get Mode with ModeX + IDirectDraw_SetCooperativeLevel(lpDD, g_hwndMain, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWMODEX | DDSCL_NOWINDOWCHANGES); + IDirectDraw_EnumDisplayModes(lpDD, 0, NULL, (LPVOID)mode, EnumDisplayModesCallback1); + //Get Modes with out ModeX + IDirectDraw_SetCooperativeLevel(lpDD, g_hwndMain, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_NOWINDOWCHANGES); + IDirectDraw_EnumDisplayModes(lpDD, 0, NULL, (LPVOID)mode, EnumDisplayModesCallback2); + //Call Function to out stuff in listview + DisplayEnumModes(); + IDirectDraw_SetCooperativeLevel(lpDD, g_hwndMain, DDSCL_NORMAL); + } +} + +//================================================================ +//================================================================ +void DXView_OnTreeSelect(HWND hwndTV, NM_TREEVIEW *ptv) +{ + NODEINFO *pni; + + SendMessage(g_hwndLV, WM_SETREDRAW, FALSE, 0); + ListView_DeleteAllItems(g_hwndLV); + LVAddColumn(g_hwndLV, 0, "", 0); + + if (ptv == NULL) + { + TV_ITEM tvi; + // get lParam of current tree node + tvi.hItem = TreeView_GetSelection(g_hwndTV); + tvi.mask = TVIF_PARAM; + tvi.lParam = 0; + TreeView_GetItem(g_hwndTV, &tvi); + pni = (NODEINFO*)tvi.lParam; + } + else + { + pni = (NODEINFO*)ptv->itemNew.lParam; + } + + if (pni && pni->Callback) + { + pni->Callback(pni->lParam1, pni->lParam2); + } + + SendMessage(g_hwndLV, WM_SETREDRAW, TRUE, 0); + InvalidateRect(g_hwndLV, NULL, TRUE); +} + +//================================================================ +//================================================================ +void DXView_OnListViewDblClick(HWND hwndLV, NM_LISTVIEW *plv) +{ + LV_ITEM lvi; + + lvi.mask = LVIF_PARAM; + lvi.lParam = 0; + lvi.iItem = plv->iItem; + ListView_GetItem(hwndLV, &lvi); +} + + +//================================================================ +//================================================================ +void DXView_OnCommand(HWND hwnd, WPARAM wParam) +{ + HMENU hMenu; + + switch(LOWORD(wParam)) + { + case IDM_VIEWAVAIL: + case IDM_VIEWALL: + hMenu = GetMenu(hwnd); + CheckMenuItem(hMenu, g_dwViewState, MF_BYCOMMAND | MF_UNCHECKED); + g_dwViewState = LOWORD(wParam); + CheckMenuItem(hMenu, g_dwViewState, MF_BYCOMMAND | MF_CHECKED); + DXView_OnTreeSelect(g_hwndTV, NULL); + break; + + case IDM_ABOUT: + DialogBox(g_hInstance, "About", hwnd, (DLGPROC)About); + break; + + case IDM_EXIT: + PostMessage(hwnd, WM_CLOSE, 0, 0); + break; + } +} + +//================================================================ +//================================================================ +void DXView_Cleanup() +{ + if (lpDD) + IDirectDraw_Release(lpDD); + + if (lpDS) + IDirectSound_Release(lpDS); + + if (lpDP) + lpDP->lpVtbl->Release(lpDP); + + if(g_hImageList) + ImageList_Destroy(g_hImageList); +} + +//================================================================ +//================================================================ +BOOL DXView_InitImageList() +{ + int cxSmIcon; + int cySmIcon; + UINT Index; + HICON hIcon; + + if (g_hImageList) + return TRUE; + + cxSmIcon = GetSystemMetrics(SM_CXSMICON); + cySmIcon = GetSystemMetrics(SM_CYSMICON); + + // First, create the image list that is needed. + if((g_hImageList = ImageList_Create(cxSmIcon, cySmIcon, TRUE, IDI_LASTIMAGE - IDI_FIRSTIMAGE, 10)) == NULL) + return(FALSE); + + // + // Initialize the image list with all of the icons that we'll be using + // Once set, send its handle to all interested child windows. + // + for (Index = IDI_FIRSTIMAGE; Index <= IDI_LASTIMAGE; Index++) + { + hIcon = LoadImage(g_hInstance, MAKEINTRESOURCE(Index), IMAGE_ICON, cxSmIcon, cySmIcon, 0); + ImageList_AddIcon(g_hImageList, hIcon); + DestroyIcon(hIcon); + } + + TreeView_SetImageList(g_hwndTV, g_hImageList, TVSIL_NORMAL); + + return(TRUE); +} + +//================================================================ +//================================================================ +HRESULT CALLBACK DDEnumCallBack(GUID *pid, LPSTR lpDriverDesc, LPSTR lpDriverName, LPVOID lpContext) +{ + HTREEITEM hParent = (HTREEITEM)lpContext; + TCHAR szText[256]; +#ifdef DX_3D + HRESULT ddrval; +#endif + + if (HIWORD(pid) != 0) + { + GUID temp = *pid; + pid = (GUID *)LocalAlloc(LPTR, sizeof(GUID)); + *pid = temp; + } + + // Add subnode to treeview + if (lpDriverName && *lpDriverName) + wsprintf(szText, "%s (%s)", lpDriverDesc, lpDriverName); + else + lstrcpy(szText, lpDriverDesc); +#ifdef DX_3D + { + DDCAPS DDCaps; + lpDD = DDCreate(pid); + DDCaps.dwSize = sizeof(DDCAPS); + ddrval = lpDD->lpVtbl->GetCaps(lpDD, &DDCaps,NULL); + if(ddrval == DD_OK) + if(DDCaps.dwSize != 0) + if(DDCaps.ddsCaps.dwCaps & DDSCAPS_3D != 0) + pid_for3D = pid; + } +#endif + DDCapDefs[0].szName = szText; + AddCapsToTV(hParent, DDCapDefs, (LPARAM)pid); + + return(DDENUMRET_OK); +} + +//================================================================ +//================================================================ +HRESULT CALLBACK DSEnumCallBack(const GUID *lpGUID, LPSTR lpDriverDesc, LPSTR lpDriverName, LPVOID lpContext) +{ + HTREEITEM hParent = (HTREEITEM)lpContext; + TCHAR szText[256]; + LPGUID lpTemp = NULL; + + if( lpGUID != NULL ) + { + if(( lpTemp = LocalAlloc( LPTR, sizeof(GUID))) == NULL ) + return( TRUE ); + + memcpy( lpTemp, lpGUID, sizeof(GUID)); + } + + // Add subnode to treeview + if (lpDriverName && *lpDriverName) + wsprintf(szText, "%s (%s)", lpDriverDesc, lpDriverName); + else + lstrcpy(szText, lpDriverDesc); + + DSCapDefs[0].szName = szText; + AddCapsToTV(hParent, DSCapDefs, (LPARAM)lpTemp); + + return(DDENUMRET_OK); +} + +//================================================================ +//================================================================ +BOOL CALLBACK DPEnumCallback(GUID *pid, LPSTR szName, DWORD major_ver, DWORD minor_ver, LPVOID lpContext) +{ + HTREEITEM hParent = (HTREEITEM)lpContext; + TCHAR szText[256]; + + if (HIWORD(pid) != 0) + { + GUID temp = *pid; + pid = (GUID *)LocalAlloc(LPTR, sizeof(GUID)); + *pid = temp; + } + + wsprintf(szText, "%s %d.%d", szName, major_ver, minor_ver); + + DPCapDefs[0].szName = szText; + AddCapsToTV(hParent, DPCapDefs, (LPARAM)pid); + + return TRUE; +} + +//================================================================ +//================================================================ +#ifdef DX_3D +HRESULT CALLBACK D3EnumCallback( + LPGUID pid, + LPSTR lpDriverDesc, + LPSTR lpDriverName, + LPD3DDEVICEDESC lpD3DDeviceDesc1, + LPD3DDEVICEDESC lpD3DDeviceDesc2, + LPVOID lpContext) +{ + HTREEITEM hParent = (HTREEITEM)lpContext; + TCHAR szText[256]; + + //Store this info now is much easier than recreating it later. + CAP3DDEVICEDESC *temp; + if(lpD3DDeviceDesc1->dwFlags != 0) + { + temp = LocalAlloc(LPTR, sizeof(CAP3DDEVICEDESC)); + memcpy(temp,lpD3DDeviceDesc1,sizeof(CAP3DDEVICEDESC)); + }else + { + temp = LocalAlloc(LPTR, sizeof(CAP3DDEVICEDESC)); + memcpy(temp,lpD3DDeviceDesc2,sizeof(CAP3DDEVICEDESC)); + } + memcpy(&temp->guid,pid,sizeof(GUID)); + + // Add subnode to treeview + if (lpDriverName && *lpDriverName) + wsprintf(szText, "%s (%s)", lpDriverDesc, lpDriverName); + else + lstrcpy(szText, lpDriverDesc); + + D3CapDefs[0].szName = szText; + AddCapsToTV(hParent, D3CapDefs, (LPARAM)temp); + + return(DDENUMRET_OK); +} + +//================================================================ +//================================================================ +HRESULT Direct3DEnumerate(LPD3DENUMDEVICESCALLBACK lp3DEnumCallback, LPVOID lpVoid) +{ + TCHAR szText[256]; + HRESULT ddrval; + + if (lpDD) + { + IDirectDraw_Release(lpDD); + lpDD = NULL; + } + if((ddrval = DirectDrawCreate(pid_for3D, &lpDD, NULL)) != DD_OK) + { + wsprintf(szText, "Error %x",ddrval); + OutputDebugString(szText); + } + ddrval = IDirectDraw_QueryInterface(lpDD,&IID_IDirect3D,&lp3D); + if ((ddrval == DD_OK)&&(lp3D != NULL)) + { + IDirect3D_EnumDevices(lp3D, lp3DEnumCallback, lpVoid); + } + return(DDENUMRET_OK); + +} +#endif + +//================================================================ +//================================================================ +void DXView_FillTree(HWND hwndTV) +{ + HTREEITEM hTree; + + // Add direct draw devices + + hTree = TVAddNode(TVI_ROOT, "DirectDraw Devices", TRUE, + IDI_DIRECTX, NULL, 0, 0); + + // Add Display Driver node(s) and capability nodes to treeview + DirectDrawEnumerate(DDEnumCallBack, hTree); + + // Add Hardware Emulation Layer node to treeview + DDEnumCallBack((GUID *)DDCREATE_EMULATIONONLY, "Hardware Emulation Layer", NULL, (LPVOID)hTree); + + TreeView_Expand(g_hwndTV, hTree, TVE_EXPAND); + TreeView_SelectItem(g_hwndTV, hTree); + + // Add direct sound devices + + hTree = TVAddNode(TVI_ROOT, "DirectSound Devices", TRUE, + IDI_DIRECTX, NULL, 0, 0); + + DirectSoundEnumerate(DSEnumCallBack, hTree); + + TreeView_Expand(g_hwndTV, hTree, TVE_EXPAND); + + // Add direct play devices + + hTree = TVAddNode(TVI_ROOT, "DirectPlay Devices", TRUE, + IDI_DIRECTX, NULL, 0, 0); + + DirectPlayEnumerate(DPEnumCallback, hTree); + TreeView_Expand(g_hwndTV, hTree, TVE_EXPAND); + + // Add direct 3D devices +#ifdef DX_3D + hTree = TVAddNode(TVI_ROOT, "Direct3D Devices", TRUE, + IDI_DIRECTX, NULL, 0, 0); + + Direct3DEnumerate(D3EnumCallback, hTree); //This is not a real 3D function + TreeView_Expand(g_hwndTV, hTree, TVE_EXPAND); +#endif + + +} + +//================================================================ +// About - process about box +//================================================================ +LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch(message) + { + case WM_INITDIALOG: + return(TRUE); + + case WM_COMMAND: // message: received a command + if(LOWORD(wParam) == IDOK // "OK" box selected? + || LOWORD(wParam) == IDCANCEL) { // System menu close command? + EndDialog(hDlg, TRUE); // Exit the dialog + return(TRUE); + } + break; + } + return(FALSE); // Didn't process the message +} + +//================================================================ +//================================================================ +// DXView_OnSize +// +// DESCRIPTION: +// Called whenever the size of the app window has changed or the size +// of its child controls should be adjusted. +// +// PARAMETERS: +// hWnd, handle of app window. +// +//================================================================ +//================================================================ +void DXView_OnSize(HWND hWnd) +{ + HDWP hDWP; + RECT ClientRect; + int Height; + HWND hKeyTreeWnd; + HWND hValueListWnd; + int x; + int dx; + + if (IsIconic(hWnd)) + return; + + if ((hDWP = BeginDeferWindowPos(2)) != NULL) + { + // Data structure used when calling GetEffectiveClientRect (which takes into + // account space taken up by the toolbars/status bars). First half of the + // pair is zero when at the end of the list, second half is the control id. + int s_EffectiveClientRectData[] = { + 1, 0, // For the menu bar, but is unused + 0, 0 // First zero marks end of data + }; + + GetEffectiveClientRect(hWnd, &ClientRect, s_EffectiveClientRectData); + Height = ClientRect.bottom - ClientRect.top; + + hKeyTreeWnd = g_hwndTV; + + DeferWindowPos(hDWP, hKeyTreeWnd, NULL, 0, ClientRect.top, g_xPaneSplit, + Height, SWP_NOZORDER | SWP_NOACTIVATE); + + x = g_xPaneSplit + GetSystemMetrics(SM_CXSIZEFRAME); + dx = ClientRect.right - ClientRect.left - x; + + hValueListWnd = g_hwndLV; + + DeferWindowPos(hDWP, hValueListWnd, NULL, x, ClientRect.top, dx, Height, + SWP_NOZORDER | SWP_NOACTIVATE); + + EndDeferWindowPos(hDWP); + } +} +#ifdef _X86_ +#pragma optimize("", off) +#endif +/*----------------------------------------------------------------------------*\ +\*----------------------------------------------------------------------------*/ + +void LVAddColumn(HWND hwndLV, int i, char *name, int width) +{ + LV_COLUMN col; + + if (i == 0) + { + while(ListView_DeleteColumn(hwndLV, 0)) + ; + } + + col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT; + col.fmt = LVCFMT_LEFT; + col.pszText = name; + col.cchTextMax = 0; + col.cx = width * g_tmAveCharWidth; + col.iSubItem = 0; + ListView_InsertColumn(hwndLV, i, &col); +} + +/*----------------------------------------------------------------------------*\ +\*----------------------------------------------------------------------------*/ +int LVAddText(HWND hwndLV, int col, char *sz, ...) +{ + LV_ITEM lvi; + char ach[80]; + va_list vl; + + va_start(vl, sz ); + wvsprintf(ach,sz, vl); + + lvi.mask = LVIF_TEXT; + lvi.iSubItem = 0; + lvi.state = 0; + lvi.stateMask = 0; + lvi.pszText = ach; + lvi.cchTextMax = 0; + lvi.iImage = 0; + lvi.lParam = 0; + + if (col == 0) + { + lvi.iItem = 0x7FFF; + lvi.iSubItem = 0; + return ListView_InsertItem(hwndLV, &lvi); + } + else + { + lvi.iItem = ListView_GetItemCount(hwndLV)-1; + lvi.iSubItem = col; + return ListView_SetItem(hwndLV, &lvi); + } + va_end(vl); +} + +/*----------------------------------------------------------------------------*\ +\*----------------------------------------------------------------------------*/ +HTREEITEM TVAddNode(HTREEITEM hParent, LPSTR szText, BOOL fKids, int iImage, SELCALLBACK Callback, LPARAM lParam1, LPARAM lParam2) +{ + TV_INSERTSTRUCT tvi; + NODEINFO *pni; + + pni = (NODEINFO *)LocalAlloc(LPTR, sizeof(NODEINFO)); + + if (pni == NULL) + return NULL; + + pni->lParam1 = lParam1; + pni->lParam2 = lParam2; + pni->Callback = Callback; + + // Add Node to treeview + tvi.hParent = hParent; + tvi.hInsertAfter = TVI_LAST; + tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_CHILDREN; + tvi.item.iImage = iImage - IDI_FIRSTIMAGE; + tvi.item.iSelectedImage = iImage - IDI_FIRSTIMAGE; + tvi.item.lParam = (LPARAM)pni; + tvi.item.cChildren = fKids; + tvi.item.pszText = szText; + + return TreeView_InsertItem(g_hwndTV, &tvi); +} +#ifdef _X86_ +#pragma optimize("", on) +#endif + diff --git a/sdk/samples/dxview/dxview.h b/sdk/samples/dxview/dxview.h new file mode 100644 index 0000000..6371c3b --- /dev/null +++ b/sdk/samples/dxview/dxview.h @@ -0,0 +1,101 @@ +//================================================================ +// Defines +//================================================================ + +// Window Width and Height +#define DXView_WIDTH 640 +#define DXView_HEIGHT 300 + +// Child controls +#define IDC_LV 0x2000 +#define IDC_TV 0x2003 + +// Imagelist first and last icons +#define IDI_FIRSTIMAGE IDI_DIRECTX +#define IDI_LASTIMAGE IDI_CAPSOPEN + +#define IDC_SPLIT 100 + +#define IDM_EXIT 40001 +#define IDM_ABOUT 40002 +#define IDM_VIEWAVAIL 40003 +#define IDM_VIEWALL 40004 + +#define IDI_DIRECTX 100 +#define IDI_CAPS 101 +#define IDI_CAPSOPEN 102 + +//================================================================ +// Typedefs +//================================================================ + +typedef void (*SELCALLBACK)(LPARAM lParam1, LPARAM lParam2); + +typedef struct +{ + SELCALLBACK Callback; + LPARAM lParam1; + LPARAM lParam2; +} NODEINFO; + +typedef struct +{ + char * szName; // name of cap + DWORD dwOffset; // offset to cap + DWORD dwFlag; // bit flag for cal +} CAPDEF; + +typedef struct +{ + char *szName; // name of cap + SELCALLBACK Callback; + LPARAM lParam2; +} CAPDEFS; + +#ifdef DX_3D +typedef struct +{ + D3DDEVICEDESC d3dDeviceDesc; + GUID guid; +} CAP3DDEVICEDESC; +#endif + +//================================================================ +// Function prototypes +//================================================================ + +LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + +BOOL InitInstance(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow, int iWidth, int iHeight); + +BOOL DXView_OnCreate(HWND hwnd); +void DXView_OnCommand(HWND hwnd, WPARAM wParam); +void DXView_OnSize(HWND hwnd); +void DXView_OnTreeSelect(HWND hwndTV, NM_TREEVIEW *ptv); +void DXView_OnListViewDblClick(HWND hwndLV, NM_LISTVIEW *plv); +void DXView_Cleanup(void); +void DXView_FillTree(HWND hwndTV); +BOOL DXView_InitImageList(void); + +void LVAddColumn(HWND hwndLV, int i, char *name, int width); +int LVAddText(HWND hwndLV, int col, char *sz, ...); +HTREEITEM TVAddNode(HTREEITEM hParent, char *szText, BOOL fKids, int iImage, SELCALLBACK Callback, LPARAM lParam1, LPARAM lParam2); + +void DDAddCaps(LPARAM lParam1, LPARAM lParam2); +void DSAddCaps(LPARAM lParam1, LPARAM lParam2); +void DPAddCaps(LPARAM lParam1, LPARAM lParam2); +void D3AddCaps(LPARAM lParam1, LPARAM lParam2); +void DDAddVideoModes(LPARAM lParam1, LPARAM lParam2); +void DPAddSessions(LPARAM lParam1, LPARAM lParam2); +void DDFourCCFormat(LPARAM lParam1, LPARAM lParam2); + +#ifdef DX_3D +HRESULT CALLBACK D3EnumCallback( + LPGUID pid, + LPSTR lpDriverDesc, + LPSTR lpDriverName, + LPD3DDEVICEDESC lpD3DDeviceDesc1, + LPD3DDEVICEDESC lpD3DDeviceDesc2, + LPVOID lpContext); +#endif diff --git a/sdk/samples/dxview/dxview.ico b/sdk/samples/dxview/dxview.ico new file mode 100644 index 0000000..8812c61 Binary files /dev/null and b/sdk/samples/dxview/dxview.ico differ diff --git a/sdk/samples/dxview/dxview.rc b/sdk/samples/dxview/dxview.rc new file mode 100644 index 0000000..3040ada --- /dev/null +++ b/sdk/samples/dxview/dxview.rc @@ -0,0 +1,58 @@ + +#include <windows.h> +#include "dxview.h" + + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// +Menu MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&About", IDM_ABOUT + MENUITEM SEPARATOR + MENUITEM "E&xit", IDM_EXIT + END + POPUP "&View" + BEGIN + MENUITEM "A&vailable", IDM_VIEWAVAIL + MENUITEM "&All", IDM_VIEWALL + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// +IDI_DIRECTX ICON DISCARDABLE "dxview.ico" +IDI_CAPS ICON DISCARDABLE "folder.ico" +IDI_CAPSOPEN ICON DISCARDABLE "folderop.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// +About DIALOG DISCARDABLE 0, 0, 191, 103 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 10, "Times New Roman" +BEGIN + DEFPUSHBUTTON "OK",IDOK,132,58,50,14 + PUSHBUTTON "Cancel",IDCANCEL,132,74,50,14 + LTEXT "Direct Draw Device Capability Editor",-1,15,14, + 115,8 + LTEXT "Copyright Microsoft Corporation 1995-1996",-1,15,28, + 117,8 + LTEXT "Version",-1,15,41,24,8 + LTEXT "1.0",-1,40,42,66,8 + LTEXT "Written by: Vince Roggero",-1,16,54,98,8 +END + +///////////////////////////////////////////////////////////////////////////// +// +// Cursor +// +IDC_SPLIT CURSOR DISCARDABLE "Split.cur" diff --git a/sdk/samples/dxview/folder.ico b/sdk/samples/dxview/folder.ico new file mode 100644 index 0000000..f463e67 Binary files /dev/null and b/sdk/samples/dxview/folder.ico differ diff --git a/sdk/samples/dxview/folderop.ico b/sdk/samples/dxview/folderop.ico new file mode 100644 index 0000000..b2ec4fc Binary files /dev/null and b/sdk/samples/dxview/folderop.ico differ diff --git a/sdk/samples/dxview/makefile b/sdk/samples/dxview/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/dxview/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/dxview/msvc.mk b/sdk/samples/dxview/msvc.mk new file mode 100644 index 0000000..bd8e73c --- /dev/null +++ b/sdk/samples/dxview/msvc.mk @@ -0,0 +1,41 @@ +NAME = dxview +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib comctl32.lib \ + ddraw.lib dsound.lib dplayx.lib + +OBJS = dxview.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/dxview/readme.txt b/sdk/samples/dxview/readme.txt new file mode 100644 index 0000000..9469f26 --- /dev/null +++ b/sdk/samples/dxview/readme.txt @@ -0,0 +1,3 @@ +DirectX Capability Viewer + +Displays capabilities for DirectDraw, DirectSound and DirectPlay. diff --git a/sdk/samples/dxview/split.cur b/sdk/samples/dxview/split.cur new file mode 100644 index 0000000..41d65e3 Binary files /dev/null and b/sdk/samples/dxview/split.cur differ diff --git a/sdk/samples/egg/egg.c b/sdk/samples/egg/egg.c new file mode 100644 index 0000000..c9426a9 --- /dev/null +++ b/sdk/samples/egg/egg.c @@ -0,0 +1,105 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: egg.c + * + ***************************************************************************/ + +#include "rmdemo.h" + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + LPDIRECT3DRMFRAME lights = NULL; + LPDIRECT3DRMMESHBUILDER egg_builder = NULL; + LPDIRECT3DRMFRAME egg = NULL; + LPDIRECT3DRMLIGHT light1 = NULL; + LPDIRECT3DRMLIGHT light2 = NULL; + HRESULT rval; + + view = view; /* not used */ + + /* + * initialize the lights in the scene + */ + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &lights))) + goto generic_error; + if (FAILED(lights->lpVtbl->SetPosition(lights, scene, D3DVAL(5), D3DVAL(5), + -D3DVAL(1)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_DIRECTIONAL, D3DVAL(0.9), + D3DVAL(0.8), D3DVAL(0.7), &light1))) + goto generic_error; + if (FAILED(lights->lpVtbl->AddLight(lights, light1))) + goto generic_error; + if (FAILED(lights->lpVtbl->SetRotation(lights, scene, D3DVAL(0), D3DVAL(1), D3DVAL(1), + D3DVAL(-0.02)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT, D3DVAL(0.1), + D3DVAL(0.1), D3DVAL(0.1), &light2))) + goto generic_error; + if (FAILED(scene->lpVtbl->AddLight(scene, light2))) + goto generic_error; + + /* + * load mesh file + */ + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &egg_builder))) + goto generic_error; + rval = egg_builder->lpVtbl->Load(egg_builder, "egg.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load egg.x\n%s", D3DRMErrorToString(rval)); + goto ret_with_error; + } + + /* + * create an egg frame within the scene + */ + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &egg))) + goto generic_error; + + /* + * add the loaded mesh into the frame + */ + if (FAILED(egg->lpVtbl->AddVisual(egg, (LPDIRECT3DRMVISUAL)egg_builder))) + goto generic_error; + + /* + * set up the frames position, orientation and rotation + */ + if (FAILED(camera->lpVtbl->SetPosition(camera, scene, D3DVAL(0), D3DVAL(0), -D3DVAL(10)))) + goto generic_error; + if (FAILED(camera->lpVtbl->SetOrientation(camera, scene, D3DVAL(0), D3DVAL(0), D3DVAL(1), D3DVAL(0), + D3DVAL(1), D3DVAL(0)))) + goto generic_error; + if (FAILED(egg->lpVtbl->SetRotation(egg, scene, D3DVAL(0), D3DVAL(1), D3DVAL(1), + D3DVAL(0.02)))) + goto generic_error; + + RELEASE(egg); + RELEASE(lights); + RELEASE(egg_builder); + RELEASE(light1); + RELEASE(light2); + return TRUE; + +generic_error: + Msg("A failure occured while building the scene.\n"); +ret_with_error: + RELEASE(egg); + RELEASE(lights); + RELEASE(egg_builder); + RELEASE(light1); + RELEASE(light2); + return FALSE; +} + +void +OverrideDefaults(Defaults *defaults) +{ + defaults->bNoTextures = TRUE; + lstrcpy(defaults->Name, "Egg Direct3DRM Example"); +} diff --git a/sdk/samples/egg/egg.def b/sdk/samples/egg/egg.def new file mode 100644 index 0000000..3586a50 --- /dev/null +++ b/sdk/samples/egg/egg.def @@ -0,0 +1,10 @@ +NAME egg.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/egg/makefile b/sdk/samples/egg/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/egg/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/egg/msvc.mk b/sdk/samples/egg/msvc.mk new file mode 100644 index 0000000..6954664 --- /dev/null +++ b/sdk/samples/egg/msvc.mk @@ -0,0 +1,42 @@ +NAME = egg +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = egg.obj rmmain.obj rmerror.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT = -DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/egg/readme.txt b/sdk/samples/egg/readme.txt new file mode 100644 index 0000000..d7b2b3d --- /dev/null +++ b/sdk/samples/egg/readme.txt @@ -0,0 +1,5 @@ +Egg +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Loading a simple XOF of a single mesh object. diff --git a/sdk/samples/faces/faces.c b/sdk/samples/faces/faces.c new file mode 100644 index 0000000..54254ad --- /dev/null +++ b/sdk/samples/faces/faces.c @@ -0,0 +1,374 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: faces.c + * + ***************************************************************************/ + +/* + * Example program to demonstrate MeshAddFaces + */ + +#include "rmdemo.h" + +D3DVECTOR cube_vertices[] = {-D3DVAL(0.5), -D3DVAL(0.5), -D3DVAL(0.5), + -D3DVAL(0.5), -D3DVAL(0.5), D3DVAL(0.5), + -D3DVAL(0.5), D3DVAL(0.5), -D3DVAL(0.5), + -D3DVAL(0.5), D3DVAL(0.5), D3DVAL(0.5), + D3DVAL(0.5), -D3DVAL(0.5), -D3DVAL(0.5), + D3DVAL(0.5), -D3DVAL(0.5), D3DVAL(0.5), + D3DVAL(0.5), D3DVAL(0.5), -D3DVAL(0.5), + D3DVAL(0.5), D3DVAL(0.5), D3DVAL(0.5) +}; + +/* + * face_data is a vertex count followed by the vertex reference in the + * vertices list. If normal_count > 0, then pairs of vectors are + * referenced: first the vertex and secondly the normal reference. the + * list is terminated by a 0 (vertex count to a face) + */ + + +BOOL +build_face1(LPDIRECT3DRMMESHBUILDER msh) +{ + /* + * add a single face to a mesh. + */ + + /* + * Single face with all normals pointing in the same direction. + */ + + int vertex_count = 4; + D3DVECTOR vertices[4] = {D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(1.0), + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0) + }; + int normal_count = 4; + D3DVECTOR normals[4] = {D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + }; + int face_data[] = {4, 0, 0, 1, 1, 2, 2, 3, 3, 0}; + + if (FAILED(msh->lpVtbl->AddFaces(msh, vertex_count, vertices, normal_count, + normals, face_data, NULL))) + return FALSE; + return TRUE; +} + +BOOL +build_face2(LPDIRECT3DRMMESHBUILDER msh) +{ + /* + * Single face with normals pointing in different directions to + * approximate a curved surface. + */ + int vertex_count = 4; + D3DVECTOR vertices[4] = {D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(1.0), + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0) + }; + int normal_count = 4; + D3DVECTOR normals[4] = { + D3DVAL(0.5), D3DVAL(0.7), D3DVAL(0.5), + D3DVAL(0.5), D3DVAL(0.7), -D3DVAL(0.5), + -D3DVAL(0.5), D3DVAL(0.7), -D3DVAL(0.5), + -D3DVAL(0.5), D3DVAL(0.7), D3DVAL(0.5) + }; + int face_data[] = {4, 0, 0, 1, 1, 2, 2, 3, 3, 0}; + + if (FAILED(msh->lpVtbl->AddFaces(msh, vertex_count, vertices, normal_count, + normals, face_data, NULL))) + return FALSE; + return TRUE; +} + +BOOL +build_cube1(LPDIRECT3DRMMESHBUILDER msh) +{ + /* + * cube 1 has planar faces, one normal is shared by all vertices of a + * face + */ + int face1_data[] = { + 4, 1, 0, 5, 1, 7, 2, 3, 3, + 4, 2, 4, 3, 5, 7, 6, 6, 7, + 4, 5, 8, 4, 9, 6, 10, 7, 11, + 4, 0, 12, 2, 13, 6, 14, 4, 15, + 4, 0, 16, 4, 17, 5, 18, 1, 19, + 4, 0, 20, 1, 21, 3, 22, 2, 23, + 0}; + + D3DVECTOR cube1_normals[] = { + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), -D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), -D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), -D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), -D3DVAL(1.0), + D3DVAL(0.0), -D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), -D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), -D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), -D3DVAL(1.0), D3DVAL(0.0), + -D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0) + - D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0) + - D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0) + - D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0) + }; + + if (FAILED(msh->lpVtbl->AddFaces(msh, 8, cube_vertices, 6 * 4, cube1_normals, + face1_data, NULL))) + return FALSE; + return TRUE; +} + +BOOL +build_cube2(LPDIRECT3DRMMESHBUILDER msh) +{ + /* + * cube 2 has rounded faces, the normals radiate out at each vertex, + * one normal to each vertex + */ + + int face2_data[] = { + 4, 1, 1, 5, 5, 7, 7, 3, 3, + 4, 2, 2, 3, 3, 7, 7, 6, 6, + 4, 5, 5, 4, 4, 6, 6, 7, 7, + 4, 0, 0, 2, 2, 6, 6, 4, 4, + 4, 0, 0, 4, 4, 5, 5, 1, 1, + 4, 0, 0, 1, 1, 3, 3, 2, 2, + 0}; + + D3DVECTOR cube2_normals[] = { + -D3DVAL(1.0), -D3DVAL(1.0), -D3DVAL(1.0), + -D3DVAL(1.0), -D3DVAL(1.0), D3DVAL(1.0), + -D3DVAL(1.0), D3DVAL(1.0), -D3DVAL(1.0), + -D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0), + D3DVAL(1.0), -D3DVAL(1.0), -D3DVAL(1.0), + D3DVAL(1.0), -D3DVAL(1.0), D3DVAL(1.0), + D3DVAL(1.0), D3DVAL(1.0), -D3DVAL(1.0), + D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0) + }; + if (FAILED(msh->lpVtbl->AddFaces(msh, 8, cube_vertices, 8, cube2_normals, + face2_data, NULL))) + return FALSE; + return TRUE; +} + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + D3DRMRENDERQUALITY quality = D3DRMRENDER_GOURAUD; + LPDIRECT3DRMMESHBUILDER light_builder, face1_builder, face2_builder; + LPDIRECT3DRMMESHBUILDER cube1_builder, cube2_builder; + LPDIRECT3DRMMESH light_mesh, face1_mesh, face2_mesh, cube1_mesh, cube2_mesh; + LPDIRECT3DRMFRAME frame1, frame2, face_frame1, face_frame2, light_frame; + LPDIRECT3DRMFRAME lights; + LPDIRECT3DRMLIGHT light1, light2; + HRESULT rval; + + view = view; /* not used */ + light_builder = NULL; face1_builder = NULL; face2_builder = NULL; + cube1_builder = NULL; cube2_builder = NULL; + light_mesh = NULL; face1_mesh = NULL; face2_mesh = NULL; + cube1_mesh = NULL; cube2_mesh = NULL; + frame1 = NULL; frame2 = NULL; face_frame1 = NULL; face_frame2 = NULL; + light_frame = NULL; lights = NULL; light1 = NULL; light2 = NULL; + + /* + * This Demo shows the construction of planar faces\n"); with vertex + * normals for realistic modelling of\n"); flat and curved surfaces by + * polygonal approximation.\n"); + */ + + if (FAILED(dev->lpVtbl->SetQuality(dev, quality))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &face_frame1))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &face_frame2))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &frame1))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &frame2))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &light_frame))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, light_frame, &lights))) + goto generic_error; + + if (FAILED(lights->lpVtbl->SetPosition(lights, light_frame, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(2.2)))) + goto generic_error; + if (FAILED(light_frame->lpVtbl->SetPosition(light_frame, scene, D3DVAL(0.0), D3DVAL(0.4), D3DVAL(0.0)))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_POINT, D3DVAL(0.9), + D3DVAL(0.8), D3DVAL(0.7), &light1))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT, D3DVAL(0.02), + D3DVAL(0.01), D3DVAL(0.01), &light2))) + goto generic_error; + if (FAILED(lights->lpVtbl->AddLight(lights, light1))) + goto generic_error; + if (FAILED(scene->lpVtbl->AddLight(scene, light2))) + goto generic_error; + RELEASE(light1); + RELEASE(light2); + + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &face1_builder))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &face2_builder))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &cube1_builder))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &cube2_builder))) + goto generic_error; + + if (!build_face1(face1_builder)) + goto generic_error; + if (!build_face2(face2_builder)) + goto generic_error; + if (!build_cube1(cube1_builder)) + goto generic_error; + if (!build_cube2(cube2_builder)) + goto generic_error; + + if (FAILED(face1_builder->lpVtbl->CreateMesh(face1_builder, &face1_mesh))) + goto generic_error; + if (FAILED(face2_builder->lpVtbl->CreateMesh(face2_builder, &face2_mesh))) + goto generic_error; + if (FAILED(cube1_builder->lpVtbl->CreateMesh(cube1_builder, &cube1_mesh))) + goto generic_error; + if (FAILED(cube2_builder->lpVtbl->CreateMesh(cube2_builder, &cube2_mesh))) + goto generic_error; + + RELEASE(face1_builder); + RELEASE(face2_builder); + RELEASE(cube1_builder); + RELEASE(cube2_builder); + + if (FAILED(face_frame1->lpVtbl->AddVisual(face_frame1, (LPDIRECT3DRMVISUAL) face1_mesh))) + goto generic_error; + if (FAILED(face_frame2->lpVtbl->AddVisual(face_frame2, (LPDIRECT3DRMVISUAL) face2_mesh))) + goto generic_error; + if (FAILED(frame1->lpVtbl->AddVisual(frame1, (LPDIRECT3DRMVISUAL) cube1_mesh))) + goto generic_error; + if (FAILED(frame2->lpVtbl->AddVisual(frame2, (LPDIRECT3DRMVISUAL) cube2_mesh))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &light_builder))) + goto generic_error; + rval = light_builder->lpVtbl->Load(light_builder, "sphere0.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load sphere0.x\n"); + goto ret_with_error; + } + if (FAILED(light_builder->lpVtbl->SetColorRGB(light_builder, D3DVAL(1), D3DVAL(1), + D3DVAL(1)))) + goto generic_error; + if (FAILED(light_builder->lpVtbl->Scale(light_builder, D3DVAL(0.1), D3DVAL(0.1), + D3DVAL(0.1)))) + goto generic_error; + if (FAILED(light_builder->lpVtbl->SetQuality(light_builder, D3DRMRENDER_UNLITFLAT))) + goto generic_error; + if (FAILED(light_builder->lpVtbl->CreateMesh(light_builder, &light_mesh))) + goto generic_error; + RELEASE(light_builder); + + if (FAILED(lights->lpVtbl->AddVisual(lights, (LPDIRECT3DRMVISUAL) light_mesh))) + goto generic_error; + + if (FAILED(camera->lpVtbl->SetPosition(camera, scene, D3DVAL(0.0), D3DVAL(2), -D3DVAL(5)))) + goto generic_error; + if (FAILED(face_frame1->lpVtbl->SetPosition(face_frame1, scene, -D3DVAL(0.5), + D3DVAL(0.5), D3DVAL(2)))) + goto generic_error; + if (FAILED(face_frame2->lpVtbl->SetPosition(face_frame2, scene, -D3DVAL(0.5), + -D3DVAL(1.5), D3DVAL(2)))) + goto generic_error; + if (FAILED(frame1->lpVtbl->SetPosition(frame1, scene, -D3DVAL(2.0), D3DVAL(0.0), D3DVAL(2)))) + goto generic_error; + if (FAILED(frame2->lpVtbl->SetPosition(frame2, scene, D3DVAL(1.5), D3DVAL(0.0), D3DVAL(2)))) + goto generic_error; + + if (FAILED(face_frame1->lpVtbl->SetOrientation(face_frame1, scene, D3DVAL(0.0), D3DVAL(1), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), -D3DVAL(1)))) + goto generic_error; + if (FAILED(face_frame2->lpVtbl->SetOrientation(face_frame2, scene, D3DVAL(0.0), D3DVAL(1), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), -D3DVAL(1)))) + goto generic_error; + if (FAILED(camera->lpVtbl->SetOrientation(camera, scene, D3DVAL(0.0), -D3DVAL(0.2), D3DVAL(1), + D3DVAL(0.0), D3DVAL(1), D3DVAL(0.0)))) + goto generic_error; + if (FAILED(frame1->lpVtbl->SetRotation(frame1, scene, D3DVAL(1), D3DVAL(0.0), D3DVAL(1), + -D3DVAL(0.005)))) + goto generic_error; + if (FAILED(frame2->lpVtbl->SetRotation(frame2, scene, D3DVAL(0.0), D3DVAL(1), D3DVAL(1), + -D3DVAL(0.005)))) + goto generic_error; + if (FAILED(light_frame->lpVtbl->SetRotation(light_frame, scene, D3DVAL(0.0), D3DVAL(1), D3DVAL(0.0), + -D3DVAL(0.02)))) + goto generic_error; + + RELEASE(light_mesh); + RELEASE(face1_mesh); + RELEASE(face2_mesh); + RELEASE(cube1_mesh); + RELEASE(cube2_mesh); + + RELEASE(frame1); + RELEASE(frame2); + RELEASE(face_frame1); + RELEASE(face_frame2); + RELEASE(light_frame); + RELEASE(lights); + return TRUE; +generic_error: + Msg("An error has occurred while building the scene.\n"); +ret_with_error: + RELEASE(light_builder); + RELEASE(face1_builder); + RELEASE(face2_builder); + RELEASE(cube1_builder); + RELEASE(cube2_builder); + RELEASE(light_mesh); + RELEASE(face1_mesh); + RELEASE(face2_mesh); + RELEASE(cube1_mesh); + RELEASE(cube2_mesh); + RELEASE(frame1); + RELEASE(frame2); + RELEASE(face_frame1); + RELEASE(face_frame2); + RELEASE(light_frame); + RELEASE(lights); + RELEASE(light1); + RELEASE(light2); + return FALSE; +} + +void +OverrideDefaults(Defaults *defaults) +{ + defaults->bNoTextures = TRUE; + defaults->bConstRenderQuality = TRUE; + lstrcpy(defaults->Name, "Faces Direct3DRM Example"); +} diff --git a/sdk/samples/faces/faces.def b/sdk/samples/faces/faces.def new file mode 100644 index 0000000..e473765 --- /dev/null +++ b/sdk/samples/faces/faces.def @@ -0,0 +1,10 @@ +NAME faces.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/faces/makefile b/sdk/samples/faces/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/faces/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/faces/msvc.mk b/sdk/samples/faces/msvc.mk new file mode 100644 index 0000000..aacf21a --- /dev/null +++ b/sdk/samples/faces/msvc.mk @@ -0,0 +1,42 @@ +NAME = faces +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = faces.obj rmmain.obj rmerror.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT =-DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/faces/readme.txt b/sdk/samples/faces/readme.txt new file mode 100644 index 0000000..9641568 --- /dev/null +++ b/sdk/samples/faces/readme.txt @@ -0,0 +1,5 @@ +Faces +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Creation of mesh objects one face at a time. diff --git a/sdk/samples/fastfile/fastfile.c b/sdk/samples/fastfile/fastfile.c new file mode 100644 index 0000000..8d50f2c --- /dev/null +++ b/sdk/samples/fastfile/fastfile.c @@ -0,0 +1,360 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: fastfile.c + * Content: Fast file I/O for large numbers of files. + * Uses a single file built using FFCREATE.EXE; this file + * contains a directory + all the files. + * + * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + * + ***************************************************************************/ +#include <windows.h> +#include <io.h> +#include <fcntl.h> +#include <search.h> +#include <stdio.h> +#include "fastfile.h" +#include "ffent.h" + +#ifdef DEBUG +#define ODS( a ) OutputDebugString( a ) +#else +#define ODS( a ) +#endif + +#ifdef __WATCOMC__ +#define _stricmp stricmp +#endif + +typedef struct { + BOOL inuse; + LONG pos; + LONG size; + LPFILEENTRY pfe; +} FILEHANDLE, FAR *LPFILEHANDLE; + +static int LockCount; +static HANDLE hFile; +static HANDLE hFileMapping; +static LPFILEENTRY pFE; +static LPBYTE pBase; +static DWORD dwFECnt; +static LPFILEHANDLE lpFH; +static DWORD dwFHCnt; +static long lFileEnd; + +/* + * Compare + * + * bsearch comparison routine + */ +int __cdecl Compare( LPFILEENTRY p1, LPFILEENTRY p2 ) +{ + return( _stricmp( (p1)->name,(p2)->name ) ); + +} /* Compare */ + +/* + * FastFileInit + * + * Initialize for fast file access. The master file and maximum number + * of open "files" are specified. + */ +BOOL FastFileInit( LPSTR fname, int max_handles ) +{ + HRSRC h; + + LockCount = 0; + FastFileFini(); + + /* + * get a file handle array + */ + lpFH = LocalAlloc( LPTR, max_handles * sizeof( FILEHANDLE ) ); + if( lpFH == NULL ) { + return FALSE; + } + dwFHCnt = max_handles; + + /* + * try our resourse file first + */ + if (h = FindResource(NULL, fname, RT_RCDATA)) + { + pBase = LockResource(LoadResource(NULL, h)); + + if (pBase == NULL) + { + ODS( "FastFileInit: unable to lock resource\r\n" ); + FastFileFini(); + return FALSE; + } + + ODS( "FastFileInit: opened resource: "); ODS(fname); ODS("\r\n"); + } + else + { + + /* + * create a memory mapped file for the master file + */ + hFile = CreateFile( fname, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, 0 ); + + if( hFile == NULL || hFile == (HANDLE)HFILE_ERROR ) + { + ODS( "FastFileInit: CreateFile(" ); ODS( fname ); ODS( ")\r\n" ); + hFile = NULL; + FastFileFini(); + return FALSE; + } + hFileMapping = CreateFileMapping( hFile, NULL, PAGE_READONLY, 0, 0, NULL ); + if( hFileMapping == NULL ) { + ODS( "FastFileInit: CreateFileMapping Failed\r\n" ); + FastFileFini(); + return FALSE; + } + pBase = MapViewOfFile( hFileMapping, FILE_MAP_READ, 0, 0, 0 ); + if( pBase == NULL ) { + ODS( "FastFileInit: MapViewOfFile Failed\r\n" ); + FastFileFini(); + return FALSE; + } + } + + /* + * get initial data from the memory mapped file + */ + dwFECnt = *((DWORD *) pBase); + pFE = (LPFILEENTRY) (pBase + 4); + lFileEnd = pFE[dwFECnt-1].offset; + + return TRUE; + +} /* FastFileInit */ + +/* + * FastFileFini + * + * Clean up resources + */ +void FastFileFini( void ) +{ + // + // dont unmap things if we have locks out standing + // + if (LockCount != 0) + return; + + if( hFileMapping != NULL && pBase ) { + UnmapViewOfFile( pBase ); + } + if( hFileMapping != NULL ) { + CloseHandle( hFileMapping ); + hFileMapping = NULL; + } + if( hFile != NULL ) { + CloseHandle( hFile ); + hFile = NULL; + } + if( lpFH != NULL ) { + LocalFree( lpFH ); + lpFH = NULL; + } + dwFHCnt = 0; + pBase = NULL; + dwFECnt = 0; + pFE = NULL; + +} /* FastFileFini */ + +/* + * FastFileOpen + * + * Search the directory for the file, and return a file handle if found. + */ +HFASTFILE FastFileOpen( LPSTR name ) +{ + FILEENTRY fe; + LPFILEENTRY pfe; + + if( pFE == NULL ) { + ODS( "FastFileOpen: not initialized\r\n" ); + return NULL; + } + if( name == NULL || name[0] == 0 ) { + ODS( "FastFileOpen: invalid name\r\n" ); + return NULL; + } + + strcpy( fe.name, name ); + pfe = bsearch( &fe, pFE, dwFECnt, sizeof( FILEENTRY ), (LPVOID) Compare ); + if( pfe != NULL ) { + DWORD i; + for( i=0;i<dwFHCnt;i++ ) { + if( !lpFH[i].inuse ) { + lpFH[i].inuse = TRUE; + lpFH[i].pos = pfe->offset; + lpFH[i].size = (pfe+1)->offset - pfe->offset; + lpFH[i].pfe = pfe; + return &lpFH[i]; + } + } + ODS( "FastFileOpen: Out of file handles\r\n" ); + } else { + ODS( "FastFileOpen: File \"" ); ODS( name ); ODS( "\" not found\r\n" ); + } + + return NULL; + +} /* FastFileOpen */ + +/* + * FastFileClose + * + * Mark a fast file handle as closed + */ +BOOL FastFileClose( LPFILEHANDLE pfh ) +{ + if( pfh == NULL || pfh->inuse != TRUE ) { + ODS( "FastFileClose: invalid handle\r\n" ); + return FALSE; + } + pfh->inuse = FALSE; + return TRUE; + +} /* FastFileClose */ + +/* + * FastFileLock + * + * return a memory pointer into a fast file + */ +LPVOID FastFileLock( LPFILEHANDLE pfh, int pos, int size ) +{ + if( pfh == NULL || pfh->inuse != TRUE ) { + ODS( "FastFileLock: invalid handle\r\n" ); + return NULL; + } + if( size < 0 ) { + ODS( "FastFileLock: invalid size\r\n" ); + return NULL; + } + if( (pos + size) > ((pfh->pfe)+1)->offset ) { + ODS( "FastFileLock: read past end of file\r\n" ); + return NULL; + } + LockCount++; + return pBase + pfh->pos + pos; + +} /* FastFileLock */ + +/* + * FastFileUnlock + * + */ +BOOL FastFileUnlock( LPFILEHANDLE pfh, int pos, int size ) +{ + if( pfh == NULL || pfh->inuse != TRUE ) { + ODS( "FastFileUnlock: invalid handle\r\n" ); + return FALSE; + } + if( size < 0 ) { + ODS( "FastFileUnlock: invalid size\r\n" ); + return FALSE; + } + if( (pos + size) > ((pfh->pfe)+1)->offset ) { + ODS( "FastFileUnlock: read past end of file\r\n" ); + return FALSE; + } + + LockCount--; + return TRUE; + +} /* FastFileUnlock */ + +/* + * FastFileRead + * + * read from a fast file (memcpy!) + */ +BOOL FastFileRead( LPFILEHANDLE pfh, LPVOID ptr, int size ) +{ + if( pfh == NULL || pfh->inuse != TRUE ) { + ODS( "FastFileRead: invalid handle\r\n" ); + return FALSE; + } + if( size < 0 ) { + ODS( "FastFileRead: invalid size\r\n" ); + return FALSE; + } + if( (pfh->pos + size) > ((pfh->pfe)+1)->offset ) { + ODS( "FastFileRead: read past end of file\r\n" ); + return FALSE; + } + memcpy( ptr, pBase + pfh->pos, size ); + pfh->pos += size; + return TRUE; + +} /* FastFileRead */ + +/* + * FastFileSeek + * + * Set to a new position in a fast file. Uses standard SEEK_SET, SEEK_CUR, + * SEEK_END definitions. + */ +BOOL FastFileSeek( LPFILEHANDLE pfh, int off, int how ) +{ + LPFILEENTRY pfe; + + if( pfh == NULL || pfh->inuse != TRUE ) { + ODS( "FastFileSeek: invalid handle\r\n" ); + return FALSE; + } + pfe = pfh->pfe; + if( how == SEEK_SET ) { + if( off < 0 || off >= pfh->size ) { + ODS( "FastFileSeek: Invalid offset\r\n" ); + return FALSE; + } + off += pfe->offset; + } else if( how == SEEK_END ) { + if( off < 0 || off >= pfh->size ) { + ODS( "FastFileSeek: Invalid offset\r\n" ); + return FALSE; + } + off = (pfe+1)->offset - off; + } else if( how == SEEK_CUR ) { + off = pfh->pos + off; + if( off < pfe->offset || off >= (pfe+1)->offset ) { + ODS( "FastFileSeek: Invalid offset\r\n" ); + return FALSE; + } + } else { + ODS( "FastFileSeek: Invalid 'how' field\r\n" ); + return FALSE; + } + pfh->pos = off; + return TRUE; + +} /* FastFileSeek */ + +/* + * FastFileTell + * + * Get the current position in a fast file + */ +long FastFileTell( LPFILEHANDLE pfh ) +{ + if( pfh == NULL || pfh->inuse != TRUE ) { + ODS( "FastFileTell: invalid handle\r\n" ); + return -1; + } + return pfh->pos - pfh->pfe->offset; + +} /* FastFileTell */ diff --git a/sdk/samples/fastfile/fastfile.h b/sdk/samples/fastfile/fastfile.h new file mode 100644 index 0000000..84f49fe --- /dev/null +++ b/sdk/samples/fastfile/fastfile.h @@ -0,0 +1,24 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: fastfile.h + * Content: Definitions for fastfile access. + * + * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + * + ***************************************************************************/ + +typedef LPVOID HFASTFILE; + +extern BOOL FastFileInit( LPSTR fname, int max_handles ); +extern void FastFileFini( void ); +extern HFASTFILE FastFileOpen( LPSTR name ); +extern BOOL FastFileClose( HFASTFILE pfe ); +extern BOOL FastFileRead( HFASTFILE pfh, LPVOID ptr, int size ); +extern BOOL FastFileSeek( HFASTFILE pfe, int off, int how ); +extern long FastFileTell( HFASTFILE pfe ); +extern LPVOID FastFileLock( HFASTFILE pfe, int off, int len ); +extern BOOL FastFileUnlock( HFASTFILE pfe, int off, int len ); diff --git a/sdk/samples/fastfile/fastfile.vc b/sdk/samples/fastfile/fastfile.vc new file mode 100644 index 0000000..8aa4533 --- /dev/null +++ b/sdk/samples/fastfile/fastfile.vc @@ -0,0 +1,2 @@ +MAKENAME = ffmsvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/fastfile/ffcreate.c b/sdk/samples/fastfile/ffcreate.c new file mode 100644 index 0000000..101fbc5 --- /dev/null +++ b/sdk/samples/fastfile/ffcreate.c @@ -0,0 +1,249 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: ffcreate.c + * Content: Fast file I/O for large numbers of files. + * Turns all files in a directory into a single file. + * This single file contains a directory + all the files. + * + * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + * + ***************************************************************************/ +#include <windows.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <sys\types.h> +#include <sys\stat.h> +#include <fcntl.h> +#include <io.h> +#include <malloc.h> + +#ifdef __WATCOMC__ +#define _open open +#define _close close +#define _lseek lseek +#define _read read +#define _write write +#define _stricmp stricmp +#define _S_IREAD S_IREAD +#define _S_IWRITE S_IWRITE +#endif + +#include "ffent.h" + +#define BLOCK_SIZE 16*1024 + +/* + * Compare + * + * quicksort comparison routine + */ +int Compare( const LPFILEENTRY p1, const LPFILEENTRY p2 ) +{ + return( _stricmp( (p1)->name,(p2)->name ) ); +} + +/* + * main + */ +main( int argc, char *argv[] ) +{ + HANDLE dir; + WIN32_FIND_DATA fd; + int out; + int in; + unsigned long cnt; + unsigned long tmp; + LPFILEENTRY pfe; + int i; + int bytes; + int outbytes; + char *buff; + char *fname; + char *dename; + long pos; + + /* + * get i/o buffer + */ + buff = malloc( BLOCK_SIZE ); + if( buff == NULL ) { + printf( "Out of memory!\n" ); + exit( 1 ); + } + + /* + * get fastfile name, open file + */ + if( argc < 2 ) { + fname = "\\result.ff"; + } else { + fname = argv[1]; + } + printf( "Creating FastFile \"%s\"\n", fname ); + out = _open( fname, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, + _S_IREAD | _S_IWRITE ); + if( out < 0 ) { + printf( "Could not open file \"%s\"", fname ); + exit( 1 ); + } + + /* + * build a header + */ + cnt = 0; + printf( "Pass 1: building header\n" ); + dir = FindFirstFile( "*.*", &fd ); + if( dir == NULL ) { + printf( "Could not open current directory\n" ); + _close( out ); + exit( 1 ); + } + pfe = NULL; + while( 1 ) { + if( !(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) { + cnt++; + pfe = realloc( pfe, (cnt+1) * sizeof( FILEENTRY ) ); + memset( &pfe[cnt-1], 0, sizeof( FILEENTRY )*2 ); + if( pfe == NULL ) { + printf( "Out of memory!\n" ); + _close( out ); + exit( 1 ); + } + dename = fd.cAlternateFileName; + if( dename[0] == 0 ) { + dename = fd.cFileName; + } + printf( "File %d: %s \r", cnt, dename ); + pfe[cnt-1].offset = 0; + strcpy( pfe[cnt-1].name, dename ); + } + if( !FindNextFile( dir, &fd ) ) { + break; + } + } + FindClose( dir ); + + if( cnt == 0 ) { + printf( "No files found!\n" ); + exit( 0 ); + } + + /* + * sort the directory + */ + qsort( pfe, cnt, sizeof( FILEENTRY ), (LPVOID) Compare ); + + /* + * write the number of directory entries + the directory + */ + tmp = cnt+1; + bytes = _write( out, &tmp, sizeof( tmp ) ); + if( bytes != sizeof( tmp ) ) { + printf( "Error writing output file\n" ); + _close( out ); + exit( 1 ); + } + bytes = _write( out, pfe, tmp * sizeof( FILEENTRY ) ); + if( bytes != (int) (tmp * sizeof( FILEENTRY )) ) { + printf( "Error writing output file\n" ); + _close( out ); + exit( 1 ); + } + + /* + * now read all of the files one by one and add them to the fastfile + */ + printf( "Pass 2: adding data files \n" ); + for( i=0;i<(int)cnt;i++ ) { + /* + * save current file position + */ + pfe[i].offset = _lseek( out, 0, SEEK_CUR ); + if( pfe[i].offset < 0 ) { + printf( "\nSeek error on output file\n" ); + _close( out ); + exit( 1 ); + } + + /* + * open next file to add + */ + in = _open( pfe[i].name, O_RDONLY | O_BINARY, 0 ); + printf( "File %d: \"%s\", offset=%ld \r", + i+1, pfe[i].name, pfe[i].offset ); + if( in < 0 ) { + printf( "\nError opening file %s\n", pfe[i].name ); + _close( out ); + exit( 1 ); + } + + /* + * copy the data in the file + */ + while( 1 ) { + bytes = _read( in, buff, BLOCK_SIZE ); + if( bytes == 0 ) { + break; + } + if( bytes < 0 ) { + printf( "\nError reading file %s\n", pfe[i].name ); + _close( in ); + _close( out ); + exit( 1 ); + } + outbytes = _write( out, buff, bytes ); + if( bytes != outbytes ) { + printf( "\nError writing output file\n" ); + _close( in ); + _close( out ); + exit( 1 ); + } + if( bytes < BLOCK_SIZE ) { + break; + } + } + _close( in ); + } + + /* + * get position of file end + */ + pfe[i].offset = _lseek( out, 0, SEEK_CUR ); + + /* + * seek to the start of the directory (right after the # of entries) + */ + pos = _lseek( out, sizeof( tmp ), SEEK_SET ); + if( pos != sizeof( tmp ) ) { + printf( "Seek error on output file\n" ); + _close( out ); + exit( 1 ); + } + + /* + * re-write the directory with the offsets setup + */ + bytes = _write( out, pfe, tmp * sizeof( FILEENTRY ) ); + if( bytes != (int) (tmp * sizeof( FILEENTRY )) ) { + printf( "Error writing output file\n" ); + _close( out ); + exit( 1 ); + } + + /* + * all done + */ + printf( "FastFile \"%s\" created: \n", fname ); + printf( " %ld files\n", tmp ); + printf( " %ld total file size\n", pfe[i].offset ); + + _close( out ); + return 0; + +} /* main */ diff --git a/sdk/samples/fastfile/ffcreate.def b/sdk/samples/fastfile/ffcreate.def new file mode 100644 index 0000000..235abc8 --- /dev/null +++ b/sdk/samples/fastfile/ffcreate.def @@ -0,0 +1,9 @@ +NAME FFCREATE + +DESCRIPTION 'FastFile create program (C) Microsoft 1995' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE diff --git a/sdk/samples/fastfile/ffcreate.vc b/sdk/samples/fastfile/ffcreate.vc new file mode 100644 index 0000000..ec982a8 --- /dev/null +++ b/sdk/samples/fastfile/ffcreate.vc @@ -0,0 +1,2 @@ +MAKENAME = ffcrmsvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/fastfile/ffcrmsvc.mk b/sdk/samples/fastfile/ffcrmsvc.mk new file mode 100644 index 0000000..21f0e6e --- /dev/null +++ b/sdk/samples/fastfile/ffcrmsvc.mk @@ -0,0 +1,36 @@ +NAME = ffcreate +EXT = exe + +IS_32 = 1 + +GOALS = $(NAME).$(EXT) + +LIBS = libc.lib kernel32.lib + +OBJS = ffcreate.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +!else +COPT =-YX +LOPT =-debug:none +!endif +DEF = $(NAME).def + +CFLAGS =$(COPT) -Oxs -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-def:..\$(NAME).def +-machine:i386 +-subsystem:console +$(LIBS) +$(OBJS) +<< diff --git a/sdk/samples/fastfile/ffent.h b/sdk/samples/fastfile/ffent.h new file mode 100644 index 0000000..012f514 --- /dev/null +++ b/sdk/samples/fastfile/ffent.h @@ -0,0 +1,19 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: ffent.h + * Content: FastFile entry definition (internal) + * + * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, + * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED + * WARRANTIES OF MERCHANTBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + * + ***************************************************************************/ + +#pragma pack(1) +typedef struct { + long offset; + char name[13]; +} FILEENTRY, *LPFILEENTRY; +#pragma pack() diff --git a/sdk/samples/fastfile/ffmsvc.mk b/sdk/samples/fastfile/ffmsvc.mk new file mode 100644 index 0000000..f4efc17 --- /dev/null +++ b/sdk/samples/fastfile/ffmsvc.mk @@ -0,0 +1,26 @@ +NAME = fastfile +EXT = lib + +IS_32 = 1 + +GOALS = $(NAME).$(EXT) + +OBJS = fastfile.obj + +!if ("$(DEBUG)" == "debug") +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +!else +COPT =-YX +!endif +DEF = $(NAME).def + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): $(OBJS) + @$(LIBEXE) @<< +-name:$(NAME).$(EXT) +$(OBJS) +<< diff --git a/sdk/samples/fastfile/makefile b/sdk/samples/fastfile/makefile new file mode 100644 index 0000000..9f62278 --- /dev/null +++ b/sdk/samples/fastfile/makefile @@ -0,0 +1,15 @@ +all: debug + +debug : debug.mak +retail : retail.mak +clean : clean.mak + +debug.mak retail.mak clean.mak: + @echo ****************************** + @echo *** Building fastfile.lib *** + @echo ****************************** + @nmake /nologo /f fastfile.vc $(@B) + @echo ************************************ + @echo *** Building ffcreate.exe *** + @echo ************************************ + @nmake /nologo /f ffcreate.vc $(@B) diff --git a/sdk/samples/fastfile/readme.txt b/sdk/samples/fastfile/readme.txt new file mode 100644 index 0000000..6337108 --- /dev/null +++ b/sdk/samples/fastfile/readme.txt @@ -0,0 +1,54 @@ +FastFile +-------- +FastFile provides a way to create a very fast way to access large numbers +of files. + +You use FFCREATE.EXE to create a single flat file. Just run FFCREATE in +the directory that contains all of the files you wish to access. A file +will be created at the root (RESULT.FF) that is the FastFile. (you can +specify a filename on the command line to override the default of RESULT.FF; +if you do so, make sure that the result file is NOT generated in the +current directory). + +Once you have created your FastFile, you can use the FastFile routines to +access it: + +BOOL FastFileInit( LPSTR fname, int max_handles ): +Call to initialize access to a FastFile. + fname : name of FastFile + max_handles: maximum number of file handles you want to have open at the + same time. + returns TRUE if succeeds, FALSE otherwise + +void FastFileFini( void ): +Call when you are finished accessing your FastFile + +HFASTFILE FastFileOpen( LPSTR name ): +Call to open an individual file in a FastFile (read-only access is supported) + name: name if individual file + returns a handle, or NULL if fail + +BOOL FastFileClose( HFASTFILE hff ): +Call to close an individual file + hff: handle to an individual file + returns TRUE if succeeded, FALSE otherwise + +BOOL FastFileRead( HFASTFILE hff, LPVOID ptr, int size ) +Call to read from an individual file + hff: handle to an individual file + ptr: buffer to copy data + size: size of data to copy + returns TRUE if succeeded, FALSE otherwise + +BOOL FastFileSeek( HFASTFILE hff, int off, int type ) +Call to seek to an offset in an individual file + hff: handle to an individual file + off: offset to seek to + type: seek type: SEEK_SET (from start), SEEK_CUR (from current pos), + or SEEK_END (from end) + returns TRUE if succeeded, FALSE otherwise + +long FastFileTell( HFASTFILE hff ) +Call to get the current position in an individual file + hff: handle to an individual file + returns current position if succeeded, -1 otherwise diff --git a/sdk/samples/fdfilter/debug.c b/sdk/samples/fdfilter/debug.c new file mode 100644 index 0000000..9dce2f3 --- /dev/null +++ b/sdk/samples/fdfilter/debug.c @@ -0,0 +1,424 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: debug.c + * Content: debug code + * + ***************************************************************************/ + +#include <windows.h> +#include <windowsx.h> +#include <stdarg.h> +#include <dsound.h> +#include "debug.h" + +#if defined(DEBUG) || defined(_DEBUG) + + +// +// since we don't UNICODE our debugging messages, use the ASCII entry +// points regardless of how we are compiled. +// +#ifdef _WIN32 + #include <wchar.h> +#else + #define lstrcatA lstrcat + #define lstrlenA lstrlen + #define GetProfileIntA GetProfileInt + #define OutputDebugStringA OutputDebugString + #define wsprintfA wsprintf + #define MessageBoxA MessageBox +#endif + +// +// +// +BOOL __gfDbgEnabled = TRUE; // master enable +UINT __guDbgLevel = 0; // current debug level + + +//--------------------------------------------------------------------------; +// +// void DbgVPrintF +// +// Description: +// +// +// Arguments: +// LPSTR szFormat: +// +// va_list va: +// +// Return (void): +// No value is returned. +// +//--------------------------------------------------------------------------; + +void FAR CDECL DbgVPrintF +( + LPSTR szFormat, + va_list va +) +{ + char ach[DEBUG_MAX_LINE_LEN]; + BOOL fDebugBreak = FALSE; + BOOL fPrefix = TRUE; + BOOL fCRLF = TRUE; + + ach[0] = '\0'; + + for (;;) + { + switch (*szFormat) + { + case '!': + fDebugBreak = TRUE; + szFormat++; + continue; + + case '`': + fPrefix = FALSE; + szFormat++; + continue; + + case '~': + fCRLF = FALSE; + szFormat++; + continue; + } + + break; + } + + if (fDebugBreak) + { + ach[0] = '\007'; + ach[1] = '\0'; + } + + if (fPrefix) + { + lstrcatA(ach, DEBUG_MODULE_NAME ": "); + } + +#ifdef _WIN32 + wvsprintfA(ach + lstrlenA(ach), szFormat, va); +#else + wvsprintf(ach + lstrlenA(ach), szFormat, (LPSTR)va); +#endif + + if (fCRLF) + { + lstrcatA(ach, "\r\n"); + } + + OutputDebugStringA(ach); + + if (fDebugBreak) + { + DebugBreak(); + } +} // DbgVPrintF() + + +//--------------------------------------------------------------------------; +// +// void dprintf +// +// Description: +// dprintf() is called by the DPF() macro if DEBUG is defined at compile +// time. It is recommended that you only use the DPF() macro to call +// this function--so you don't have to put #ifdef DEBUG around all +// of your code. +// +// Arguments: +// UINT uDbgLevel: +// +// LPSTR szFormat: +// +// Return (void): +// No value is returned. +// +//--------------------------------------------------------------------------; + +void FAR CDECL dprintf +( + UINT uDbgLevel, + LPSTR szFormat, + ... +) +{ + va_list va; + + if (!__gfDbgEnabled || (__guDbgLevel < uDbgLevel)) + return; + + va_start(va, szFormat); + DbgVPrintF(szFormat, va); + va_end(va); +} // dprintf() + + +//--------------------------------------------------------------------------; +// +// BOOL DbgEnable +// +// Description: +// +// +// Arguments: +// BOOL fEnable: +// +// Return (BOOL): +// Returns the previous debugging state. +// +//--------------------------------------------------------------------------; + +BOOL WINAPI DbgEnable +( + BOOL fEnable +) +{ + BOOL fOldState; + + fOldState = __gfDbgEnabled; + __gfDbgEnabled = fEnable; + + return (fOldState); +} // DbgEnable() + + +//--------------------------------------------------------------------------; +// +// UINT DbgSetLevel +// +// Description: +// +// +// Arguments: +// UINT uLevel: +// +// Return (UINT): +// Returns the previous debugging level. +// +//--------------------------------------------------------------------------; + +UINT WINAPI DbgSetLevel +( + UINT uLevel +) +{ + UINT uOldLevel; + + uOldLevel = __guDbgLevel; + __guDbgLevel = uLevel; + + return (uOldLevel); +} // DbgSetLevel() + + +//--------------------------------------------------------------------------; +// +// UINT DbgGetLevel +// +// Description: +// +// +// Arguments: +// None. +// +// Return (UINT): +// Returns the current debugging level. +// +//--------------------------------------------------------------------------; + +UINT WINAPI DbgGetLevel +( + void +) +{ + return (__guDbgLevel); +} // DbgGetLevel() + + +//--------------------------------------------------------------------------; +// +// UINT DbgInitialize +// +// Description: +// +// +// Arguments: +// BOOL fEnable: +// +// Return (UINT): +// Returns the debugging level that was set. +// +//--------------------------------------------------------------------------; + +UINT WINAPI DbgInitialize +( + BOOL fEnable +) +{ + UINT uLevel; + + uLevel = GetProfileIntA(DEBUG_SECTION, DEBUG_MODULE_NAME, (UINT)-1); + if ((UINT)-1 == uLevel) + { + // + // if the debug key is not present, then force debug output to + // be disabled. this way running a debug version of a component + // on a non-debugging machine will not generate output unless + // the debug key exists. + // + uLevel = 0; + fEnable = FALSE; + } + + DbgSetLevel(uLevel); + DbgEnable(fEnable); + + return (__guDbgLevel); +} // DbgInitialize() + + +void WINAPI DbgDumpWFX( int nLevel, PWAVEFORMATEX pwfx ) + { + DPF( nLevel, "Dumping WAVEFORMATEX at 0x%08lX", pwfx ); + DPF( nLevel, "wFormatTag = %u, nChannels = %u, nSamplesPerSec = %lu", + pwfx->wFormatTag, pwfx->nChannels, pwfx->nSamplesPerSec ); + DPF( nLevel, "nAvgBytesPerSec = %lu, nBlockAlign = %u, wBitsPerSample = %lu", + pwfx->nAvgBytesPerSec, pwfx->nBlockAlign, pwfx->wBitsPerSample ); + DPF( nLevel, "cbSize = %u",pwfx->cbSize ); + } + + +//--------------------------------------------------------------------------; +// +// void _Assert +// +// Description: +// This routine is called if the ASSERT macro (defined in debug.h) +// tests and expression that evaluates to FALSE. This routine +// displays an "assertion failed" message box allowing the user to +// abort the program, enter the debugger (the "retry" button), or +// ignore the assertion and continue executing. The message box +// displays the file name and line number of the _Assert() call. +// +// Arguments: +// char * szFile: Filename where assertion occurred. +// int iLine: Line number of assertion. +// +//--------------------------------------------------------------------------; + +#ifndef _WIN32 +#pragma warning(disable:4704) +#endif + +void WINAPI _Assert +( + char * szFile, + int iLine +) +{ + static char ach[300]; // debug output (avoid stack overflow) + int id; +#ifndef _WIN32 + int iExitCode; +#endif + + wsprintfA(ach, "Assertion failed in file %s, line %d. [Press RETRY to debug.]", (LPSTR)szFile, iLine); + + id = MessageBoxA(NULL, ach, "Assertion Failed", + MB_SYSTEMMODAL | MB_ICONHAND | MB_ABORTRETRYIGNORE ); + + switch (id) + { + + case IDABORT: // Kill the application. +#ifndef _WIN32 + iExitCode = 0; + _asm + { + mov ah, 4Ch + mov al, BYTE PTR iExitCode + int 21h + } +#else + FatalAppExit(0, TEXT("Good Bye")); +#endif // WIN16 + break; + + case IDRETRY: // Break into the debugger. + DebugBreak(); + break; + + case IDIGNORE: // Ignore assertion, continue executing. + break; + } +} // _Assert + +#ifndef _WIN32 +#pragma warning(default:4704) +#endif + +#endif // #if defined(DEBUG) || defined(_DEBUG) + +// Silly little function gives meaningful error messages from HRESULT's +LPSTR TranslateDSError( HRESULT hr ) + { + switch( hr ) + { + case DSERR_ALLOCATED: + return "DSERR_ALLOCATED"; + + case DSERR_CONTROLUNAVAIL: + return "DSERR_CONTROLUNAVAIL"; + + case DSERR_INVALIDPARAM: + return "DSERR_INVALIDPARAM"; + + case DSERR_INVALIDCALL: + return "DSERR_INVALIDCALL"; + + case DSERR_GENERIC: + return "DSERR_GENERIC"; + + case DSERR_PRIOLEVELNEEDED: + return "DSERR_PRIOLEVELNEEDED"; + + case DSERR_OUTOFMEMORY: + return "DSERR_OUTOFMEMORY"; + + case DSERR_BADFORMAT: + return "DSERR_BADFORMAT"; + + case DSERR_UNSUPPORTED: + return "DSERR_UNSUPPORTED"; + + case DSERR_NODRIVER: + return "DSERR_NODRIVER"; + + case DSERR_ALREADYINITIALIZED: + return "DSERR_ALREADYINITIALIZED"; + + case DSERR_NOAGGREGATION: + return "DSERR_NOAGGREGATION"; + + case DSERR_BUFFERLOST: + return "DSERR_BUFFERLOST"; + + case DSERR_OTHERAPPHASPRIO: + return "DSERR_OTHERAPPHASPRIO"; + + case DSERR_UNINITIALIZED: + return "DSERR_UNINITIALIZED"; + + default: + return "Unknown HRESULT"; + } + } + + diff --git a/sdk/samples/fdfilter/debug.h b/sdk/samples/fdfilter/debug.h new file mode 100644 index 0000000..ccff6a7 --- /dev/null +++ b/sdk/samples/fdfilter/debug.h @@ -0,0 +1,93 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: debug.h + * Content: debug header + * + ***************************************************************************/ +#ifndef __DEBUG_INCLUDED__ +#define __DEBUG_INCLUDED__ +#ifdef __cplusplus +extern "C" +{ +#endif + +LPSTR TranslateDSError( HRESULT ); + +// +// +// +// +#if defined(DEBUG) || defined(_DEBUG) + #define DEBUG_SECTION "Debug" // section name for + #define DEBUG_MODULE_NAME "FDFILTER" // key name and prefix for output + #define DEBUG_MAX_LINE_LEN 255 // max line length (bytes!) +#endif + + +// +// based code makes since only in win 16 (to try and keep stuff out of +// [fixed] data segments, etc)... +// +#ifndef BCODE +#ifdef _WIN32 + #define BCODE +#else + #define BCODE _based(_segname("_CODE")) +#endif +#endif + + + + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +#if defined(DEBUG) || defined(_DEBUG) + BOOL WINAPI DbgEnable(BOOL fEnable); + UINT WINAPI DbgGetLevel(void); + UINT WINAPI DbgSetLevel(UINT uLevel); + UINT WINAPI DbgInitialize(BOOL fEnable); + void WINAPI _Assert( char * szFile, int iLine ); + void WINAPI DbgDumpWFX( int, PWAVEFORMATEX ); + + void FAR CDECL dprintf(UINT uDbgLevel, LPSTR szFmt, ...); + + #define D(x) {x;} + #define DPF dprintf + #define DPI(sz) {static char BCODE ach[] = sz; OutputDebugStr(ach);} + #define DPWFX DbgDumpWFX + #define ASSERT(x) if( !(x) ) _Assert( __FILE__, __LINE__) +#else + #define DbgEnable(x) FALSE + #define DbgGetLevel() 0 + #define DbgSetLevel(x) 0 + #define DbgInitialize(x) 0 + #define DbgDumpWFX(x,y) 0 + + #ifdef _MSC_VER + #pragma warning(disable:4002) + #endif + + #define D(x) + #define DPF() + #define DPI(sz) + #define DPWFX() + #define ASSERT(x) +#endif + +#if defined(DEBUG) || defined(_DEBUG) +#define ASSERT_HWND( h ) ASSERT( IsWindow((h)) ) +#else +#define ASSERT_HWND( h ) ASSERT( NULL != (h) ) +#endif + +#ifdef __cplusplus +} +#endif +#endif // __DEBUG_INCLUDED__ + diff --git a/sdk/samples/fdfilter/fdaudio.cpp b/sdk/samples/fdfilter/fdaudio.cpp new file mode 100644 index 0000000..6b12ed3 --- /dev/null +++ b/sdk/samples/fdfilter/fdaudio.cpp @@ -0,0 +1,858 @@ +////////////////////////////////////////////////////////////////////////////// +// +// File: FDAUDIO.CPP +// Contents: Audio related routines for full-duplex device usage +// +// Description: This file includes functionality for enumerating devices & +// formats, initializing devices and buffers, and the CALLBACK +// procedures for dealing with full duplex. +// + +#include "fdfilter.h" +#include "fdaudio.h" +#include "filter.h" + +static BOOL IsWaveDeviceInList( UINT, WAVEINCAPS * ); +static BOOL IsDSDeviceInList( LPGUID ); + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +BOOL InitSoundDevices( BOOL fAllowFormatCancel ) + { + if( NULL == gpwfxOutput ) + { + gpwfxOutput = new WAVEFORMATEX; + if( NULL == gpwfxOutput ) + goto ISD_Fail; + ZeroMemory( gpwfxOutput, sizeof(WAVEFORMATEX)); + gpwfxOutput->wFormatTag = WAVE_FORMAT_PCM; + DPF( 3, "Created gpwfxOutput" ); + DPWFX( 3, gpwfxOutput ); + } + + if( NULL == gpwfxInput ) + { + gpwfxInput = new WAVEFORMATEX; + if( NULL == gpwfxInput ) + goto ISD_Fail; + ZeroMemory( gpwfxInput, sizeof(WAVEFORMATEX)); + gpwfxInput->wFormatTag = WAVE_FORMAT_PCM; + DPF( 3, "Created gpwfxInput" ); + DPWFX( 3, gpwfxInput ); + } + + EnumDSDevices(); + if( NULL == gpdsddOutputDevices ) + { + MessageBox( ghMainWnd, "No DirectSound devices are available!", gszAppName, MB_OK ); + goto ISD_Fail; + } + + EnumWaveDevices(); + if( NULL == gpwddInputDevices ) + { + MessageBox( ghMainWnd, "No waveIn devices are available!", gszAppName, MB_OK ); + goto ISD_Fail; + } + + if( !DialogBox( ghInst, MAKEINTRESOURCE(IDD_DEVICES), + ghMainWnd, (DLGPROC)SelectDevicesDlgProc )) + goto ISD_Fail; + + if( !InitPrimarySoundBuffer()) + goto ISD_Fail; + + if( !DialogBoxParam( ghInst, MAKEINTRESOURCE(IDD_FORMATS), + ghMainWnd, (DLGPROC)SelectFormatsDlgProc, + (LPARAM)fAllowFormatCancel )) + goto ISD_Fail; + + return TRUE; + +ISD_Fail: + return FALSE; + } + + +BOOL ReOpenSoundDevices( BOOL fAllowFormatCancel ) + { + if( NULL == gpwfxOutput ) + { + gpwfxOutput = new WAVEFORMATEX; + if( NULL == gpwfxOutput ) + goto ROSD_Fail; + ZeroMemory( gpwfxOutput, sizeof(WAVEFORMATEX)); + gpwfxOutput->wFormatTag = WAVE_FORMAT_PCM; + DPF( 3, "Created gpwfxOutput" ); + DPWFX( 3, gpwfxOutput ); + } + + if( NULL == gpwfxInput ) + { + gpwfxInput = new WAVEFORMATEX; + if( NULL == gpwfxInput ) + goto ROSD_Fail; + ZeroMemory( gpwfxInput, sizeof(WAVEFORMATEX)); + gpwfxInput->wFormatTag = WAVE_FORMAT_PCM; + DPF( 3, "Created gpwfxInput" ); + DPWFX( 3, gpwfxInput ); + } + + EnumDSDevices(); + if( NULL == gpdsddOutputDevices ) + { + MessageBox( ghMainWnd, "No DirectSound devices are available!", gszAppName, MB_OK ); + goto ROSD_Fail; + } + + EnumWaveDevices(); + if( NULL == gpwddInputDevices ) + { + MessageBox( ghMainWnd, "No waveIn devices are available!", gszAppName, MB_OK ); + goto ROSD_Fail; + } + + if( !DialogBox( ghInst, MAKEINTRESOURCE(IDD_DEVICES), + ghMainWnd, (DLGPROC)SelectDevicesDlgProc )) + goto ROSD_Fail; + + StopBuffers(); + CloseWaveDevice(); + DestroyBuffers(); + CloseDSDevice(); + + if( !InitPrimarySoundBuffer()) + goto ROSD_Fail; + + if( !DialogBoxParam( ghInst, MAKEINTRESOURCE(IDD_FORMATS), + ghMainWnd, (DLGPROC)SelectFormatsDlgProc, + (LPARAM)fAllowFormatCancel )) + goto ROSD_Fail; + + return TRUE; + +ROSD_Fail: + return FALSE; + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +BOOL IsWaveDeviceInList( UINT iDev, WAVEINCAPS *pwic ) + { + PWAVEDEVICEDESC pwdd = gpwddInputDevices; + + while( pwdd ) + { + if( pwdd->uID == iDev && pwdd->dwFormats == pwic->dwFormats + && pwdd->nChannels == pwic->wChannels + && !lstrcmp(pwdd->szDeviceDesc, pwic->szPname)) + return TRUE; + + pwdd = pwdd->pNext; + } + return FALSE; + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +BOOL IsDSDeviceInList( LPGUID lpguDevice ) + { + PDSDEVICEDESC pdsdd = gpdsddOutputDevices; + + while( pdsdd ) + { + // This works because operator== is overloaded for GUIDS + if( NULL == lpguDevice ) + { + if( pdsdd->guDevice == GUID_NULL ) + return TRUE; + } + else if( pdsdd->guDevice == *lpguDevice ) + return TRUE; + + pdsdd = pdsdd->pNext; + } + return FALSE; + } + + +////////////////////////////////////////////////////////////////////////////// +// EnumDSDevices() +// +// Enumerates the DirectSound devices with the help of DirectSoundEnumerate +// and DSEnumProc. Adds entries to a global list about each device. +// +BOOL EnumDSDevices( void ) + { + DirectSoundEnumerate((LPDSENUMCALLBACK)DSEnumProc, NULL ); + return TRUE; + } + + +////////////////////////////////////////////////////////////////////////////// +// EnumWaveDevices() +// +// This function enumerates the waveIn devices and builds a list of them. +// +BOOL EnumWaveDevices( void ) + { + UINT nDevices, iDev; + PWAVEDEVICEDESC pwddNew; + WAVEINCAPS wiCaps; + + nDevices = waveInGetNumDevs(); + if( !nDevices ) + return FALSE; + + for( iDev = 0; iDev < nDevices; iDev++ ) + { + if( MMSYSERR_NOERROR != waveInGetDevCaps( iDev, &wiCaps, sizeof(wiCaps))) + continue; + + if( !IsWaveDeviceInList( iDev, &wiCaps )) + { + if(( pwddNew = new WAVEDEVICEDESC ) == NULL ) + continue; + pwddNew->uID = iDev; + pwddNew->dwFormats = wiCaps.dwFormats; + pwddNew->nChannels = wiCaps.wChannels; + lstrcpy( pwddNew->szDeviceDesc, wiCaps.szPname ); + + pwddNew->pNext = gpwddInputDevices; + gpwddInputDevices = pwddNew; + } + } + + if( NULL == gpwddInputDevices ) + return FALSE; + + return TRUE; + } + + +////////////////////////////////////////////////////////////////////////////// +// InitPrimarySoundBuffer() +// +// Creates and initializes the primary sound buffer for the application. +// We need the primary buffer in order to get the 3D listener interface and +// also to select output format type. +// +BOOL InitPrimarySoundBuffer( void ) + { + HRESULT dsrval; + DSBUFFERDESC dsbd; + + ZeroMemory( &dsbd, sizeof(DSBUFFERDESC)); + + dsbd.dwSize = sizeof(DSBUFFERDESC); + dsbd.dwFlags = DSBCAPS_CTRL3D | DSBCAPS_PRIMARYBUFFER; + + if( FAILED( dsrval = DirectSoundCreate( &gpdsddOut->guDevice, &gpds, NULL ))) + { + DPF( 0, "Couldn't open DirectSound device (%s)", TranslateDSError(dsrval)); + goto IPSB_ExitError; + } + + if( FAILED( dsrval = gpds->SetCooperativeLevel( ghMainWnd, DSSCL_PRIORITY ))) + { + DPF( 0, "Couldn't get PRIORITY cooperative level (%s)", TranslateDSError(dsrval)); + goto IPSB_ExitError; + } + + if( FAILED( dsrval = gpds->CreateSoundBuffer( &dsbd, &gpdsbPrimary, NULL ))) + { + DPF( 0, "Couldn't create primary buffer (%s)", TranslateDSError(dsrval)); + goto IPSB_ExitError; + } + + return TRUE; + +IPSB_ExitError: + if( NULL != gpdsbPrimary ) + { + DPF( 1, "Releasing Primary in InitPrimarySoundBuffer() error cleanup" ); + gpdsbPrimary->Release(); + gpdsbPrimary = NULL; + } + if( NULL != gpds ) + { + DPF( 1, "Releasing DSound object in InitPrimarySoundBuffer() error cleanup" ); + gpds->Release(); + gpds= NULL; + } + + return FALSE; + } + + +////////////////////////////////////////////////////////////////////////////// +// DSEnumProc() +// +// DirectSoundEnumerate() callback procedure which fills the DSDEVICEDESC list +// with data about available devices. +// +BOOL CALLBACK DSEnumProc( LPGUID lpguDevice, LPSTR lpszDesc, + LPSTR lpszDrvName, LPVOID lpContext ) + { + PDSDEVICEDESC pdsddNew; + + if( !IsDSDeviceInList( lpguDevice )) + { + if(( pdsddNew = new DSDEVICEDESC ) == NULL ) + { + return TRUE; + } + + ZeroMemory( pdsddNew, sizeof(DSDEVICEDESC)); + + if( NULL != lpguDevice ) + pdsddNew->guDevice = *lpguDevice; + else + pdsddNew->guDevice = GUID_NULL; + + if(( pdsddNew->pszDeviceDesc = new char[lstrlen(lpszDesc)+1]) == NULL ) + { + delete pdsddNew; + return TRUE; + } + lstrcpy( pdsddNew->pszDeviceDesc, lpszDesc ); + + pdsddNew->pNext = gpdsddOutputDevices; + gpdsddOutputDevices = pdsddNew; + } + + return TRUE; + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void ClearDSDeviceList( void ) + { + PDSDEVICEDESC pdsddCur, pdsddTemp; + + pdsddCur = gpdsddOutputDevices; + + while( pdsddCur ) + { + if( NULL != pdsddCur->pszDeviceDesc ) + delete[] pdsddCur->pszDeviceDesc; + + pdsddTemp = pdsddCur->pNext; + delete pdsddCur; + pdsddCur = pdsddTemp; + } + gpdsddOutputDevices = NULL; + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void ClearWaveDeviceList( void ) + { + PWAVEDEVICEDESC pwddCur, pwddTemp; + + pwddCur = gpwddInputDevices; + + while( pwddCur ) + { + pwddTemp = pwddCur->pNext; + delete pwddCur; + pwddCur = pwddTemp; + } + gpwddInputDevices = NULL; + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void FillInputDeviceCombo( HWND hCombo ) + { + PWAVEDEVICEDESC pwdd = gpwddInputDevices; + int idx; + + if( NULL == hCombo ) + return; + + while( pwdd ) + { + idx = ComboBox_InsertString( hCombo, -1, pwdd->szDeviceDesc ); + ComboBox_SetItemData( hCombo, idx, pwdd ); + pwdd = pwdd->pNext; + } + if( NULL != gpwddInputDevices ) + ComboBox_SetCurSel( hCombo, 0 ); + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void FillOutputDeviceCombo( HWND hCombo ) + { + PDSDEVICEDESC pdsdd = gpdsddOutputDevices; + int idx; + + if( NULL == hCombo ) + return; + + while( pdsdd ) + { + idx = ComboBox_InsertString( hCombo, -1, pdsdd->pszDeviceDesc ); + ComboBox_SetItemData( hCombo, idx, pdsdd ); + pdsdd = pdsdd->pNext; + } + if( NULL != gpdsddOutputDevices ) + ComboBox_SetCurSel( hCombo, 0 ); + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void ScanAvailableDSFormats( void ) + { + WAVEFORMATEX wfx; + HRESULT dsrval; + HCURSOR hCursor; + int i; + + DPF( 3, "Scanning %u DirectSound formats for availability", NUM_FORMATCODES ); + if( NULL == gpds || NULL == gpdsbPrimary ) + { + for( i = 0; i < NUM_FORMATCODES; i++ ) + aOutputFormats[i].fEnabled = FALSE; + return; + } + + // This might take a second or two, so throw up the hourglass + hCursor = GetCursor(); + SetCursor( LoadCursor( NULL, IDC_WAIT )); + + ZeroMemory( &wfx, sizeof(wfx)); + wfx.wFormatTag = WAVE_FORMAT_PCM; + + for( i = 0; i < NUM_FORMATCODES; i++ ) + { + FormatCodeToWFX( aOutputFormats[i].dwCode, &wfx ); + + if( FAILED( dsrval = gpdsbPrimary->SetFormat( &wfx ))) + { + DPF( 5, "Failed with SetFormat() for %u format", aOutputFormats[i].dwCode ); + aOutputFormats[i].fEnabled = FALSE; + } + else + { + DPF( 5, "Succeeded with SetFormat() for %u format", aOutputFormats[i].dwCode ); + aOutputFormats[i].fEnabled = TRUE; + } + } + SetCursor( hCursor ); + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void ScanAvailableWaveFormats( void ) + { + WAVEFORMATEX wfx; + HCURSOR hCursor; + MMRESULT mmrval; + int i; + + DPF( 3, "Scanning %u waveIn formats for availability", NUM_FORMATCODES ); + + // This might take a second or two, so throw up the hourglass + hCursor = GetCursor(); + SetCursor( LoadCursor( NULL, IDC_WAIT )); + + for( i = 0; i < NUM_FORMATCODES; i++ ) + aOutputFormats[i].fEnabled = FALSE; + + ZeroMemory( &wfx, sizeof(wfx)); + wfx.wFormatTag = WAVE_FORMAT_PCM; + + for( i = 0; i < NUM_FORMATCODES; i++ ) + { + FormatCodeToWFX( aInputFormats[i].dwCode, &wfx ); + + if(( mmrval = waveInOpen( &ghWaveIn, gpwddIn->uID, &wfx, + (DWORD)WaveInCallback, + 0, CALLBACK_FUNCTION )) != MMSYSERR_NOERROR ) + { + DPF( 5, "Failed with waveInOpen() for %u format", aInputFormats[i].dwCode ); + aInputFormats[i].fEnabled = FALSE; + } + else + { + DPF( 5, "Succeeded with waveInOpen() for %u format", aInputFormats[i].dwCode ); + aInputFormats[i].fEnabled = TRUE; + waveInClose( ghWaveIn ); + } + } + + SetCursor( hCursor ); + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void CloseDSDevice( void ) + { + if( NULL != gpdsbOutput ) + { + gpdsbOutput->Release(); + gpdsbOutput = NULL; + } + if( NULL != gpdsbPrimary ) + { + gpdsbPrimary->Release(); + gpdsbPrimary = NULL; + } + if( NULL != gpds ) + { + gpds->Release(); + gpds = NULL; + } + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void CloseWaveDevice( void ) + { + if( NULL == ghWaveIn ) + return; + + waveInReset( ghWaveIn ); + EnterCriticalSection( &gcsBufferData ); + if( gnBuffersOut ) + WaitForSingleObject( ghCallbackFinished, INFINITE ); + LeaveCriticalSection( &gcsBufferData ); + waveInClose( ghWaveIn ); + ghWaveIn = NULL; + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +BOOL InitBuffers( void ) + { + HRESULT dsrval; + int i; + + if( gfBuffersInitialized ) + return TRUE; + if( NULL == ghWaveIn ) + return FALSE; + + EnterCriticalSection( &gcsBufferData ); + if( NULL == gawhHeaders ) + { + if(( gawhHeaders = new WAVEHDR[NUM_BUFFERS] ) == NULL ) + goto Abort_InitBuffers; + ASSERT( NULL == gpbBufferData ); + } + if( NULL == gpbBufferData ) + { + gcbBufferSize = max( 4096, gpwfxInput->nAvgBytesPerSec / 8 ); + gcbBufferSize -= gcbBufferSize % gpwfxInput->nBlockAlign; + DPF( 1, "Set input buffer size to %lu bytes", gcbBufferSize ); + + if(( gpbBufferData = new BYTE[NUM_BUFFERS*gcbBufferSize] ) == NULL ) + goto Abort_InitBuffers; + } + + ZeroMemory( gawhHeaders, sizeof(WAVEHDR)*NUM_BUFFERS ); + for( i = 0; i < NUM_BUFFERS; i++ ) + { + gawhHeaders[i].dwBufferLength = gcbBufferSize; + gawhHeaders[i].lpData = (LPSTR)gpbBufferData + i*gcbBufferSize; + gawhHeaders[i].dwUser = i; + if( MMSYSERR_NOERROR != waveInPrepareHeader( ghWaveIn, + &gawhHeaders[i], sizeof(WAVEHDR))) + goto Abort_InitBuffers; + if( MMSYSERR_NOERROR != waveInAddBuffer( ghWaveIn, + &gawhHeaders[i], sizeof(WAVEHDR))) + goto Abort_InitBuffers; + gnBuffersOut++; + } + + ZeroMemory( &gdsbdOutput, sizeof(gdsbdOutput)); + gdsbdOutput.dwSize = sizeof(gdsbdOutput); + gdsbdOutput.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS; + gdsbdOutput.dwBufferBytes = NUM_BUFFERS * gcbBufferSize / 2; + // We want the format of this secondary to match the format of the input + // data. This lets us blindly copy the data out and DSound worries about + // matching the bits and channels to our desired primary buffer format. + gdsbdOutput.lpwfxFormat = gpwfxInput; + + if( FAILED( dsrval = gpds->CreateSoundBuffer( &gdsbdOutput, &gpdsbOutput, NULL ))) + { + DPF( 0, "Unable to create sound buffer for output (%s)", TranslateDSError(dsrval)); + goto Abort_InitBuffers; + } + + InterlockedExchange( &gfBuffersInitialized, TRUE ); + LeaveCriticalSection( &gcsBufferData ); + return TRUE; + +Abort_InitBuffers: + // TODO: If there were any buffers put out, we must Reset to get them back + ASSERT( DestroyBuffers()); + LeaveCriticalSection( &gcsBufferData ); + return FALSE; + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +BOOL StartBuffers( void ) + { + if( NULL == ghWaveIn || NULL == gpdsbOutput ) + return FALSE; + + waveInStart( ghWaveIn ); + + // Rewind the output buffer, fill it with silence, and play it + gpdsbOutput->SetCurrentPosition( 0 ); + WriteSilenceToOutput( 0, gdsbdOutput.dwBufferBytes ); + gpdsbOutput->Play( 0, 0, DSBPLAY_LOOPING ); + return TRUE; + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +BOOL StopBuffers( void ) + { + if( NULL == ghWaveIn || NULL == gpdsbOutput ) + return FALSE; + + waveInStop( ghWaveIn ); + gpdsbOutput->Stop(); + return TRUE; + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +BOOL DestroyBuffers( void ) + { + if( NULL != ghWaveIn ) + return FALSE; + + if( NULL != gawhHeaders ) + { + delete[] gawhHeaders; + gawhHeaders = NULL; + } + if( NULL != gpbBufferData ) + { + delete[] gpbBufferData; + gpbBufferData = NULL; + } + if( NULL != gpdsbOutput ) + { + gpdsbOutput->Release(); + gpdsbOutput = NULL; + } + InterlockedExchange( &gfBuffersInitialized, FALSE ); + return TRUE; + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +BOOL WriteSilenceToOutput( DWORD dwStart, DWORD cbLength ) + { + PBYTE pb1, pb2; + DWORD cb1, cb2; + + if(( !dwStart && !cbLength ) || NULL == gpdsbOutput + || NULL == gdsbdOutput.lpwfxFormat ) + return FALSE; + + if( SUCCEEDED( gpdsbOutput->Lock( dwStart, cbLength, &pb1, &cb1, &pb2, &cb2, 0 ))) + { + FillMemory( pb1, cb1, (gdsbdOutput.lpwfxFormat->wBitsPerSample == 8) ? 128 : 0 ); + if( NULL != pb2 && cb2 ) + FillMemory( pb2, cb2, (gdsbdOutput.lpwfxFormat->wBitsPerSample == 8) ? 128 : 0 ); + + gpdsbOutput->Unlock( pb1, cb1, pb2, cb2 ); + return TRUE; + } + + return FALSE; + } + + +////////////////////////////////////////////////////////////////////////////// +// +// +// +// +void CALLBACK WaveInCallback( HWAVEIN hwi, UINT uMsg, DWORD dwInstance, + DWORD dwParam1, DWORD dwParam2 ) + { + static DWORD dwWritePosition = 0xFFFFFFFF; + PWAVEHDR pwhBuffer; + HRESULT dsrval; + + switch( uMsg ) + { + case WIM_DATA: + pwhBuffer = (PWAVEHDR)dwParam1; + // If there's no data in the buffer, we must be getting it back + // so we can shutdown + EnterCriticalSection( &gcsBufferData ); + + if( pwhBuffer->dwBytesRecorded == 0 ) + { + waveInUnprepareHeader( ghWaveIn, pwhBuffer, sizeof(WAVEHDR)); + // Don't delete the buffer space or the WAVEHDR, because we + // have allocated them all in an array and will delete them + // when all buffers are returned and the device is closed + if( !--gnBuffersOut ) + { + SetEvent( ghCallbackFinished ); + dwWritePosition = 0xFFFFFFFF; + } + } + else + { + PBYTE pb1, pb2; + DWORD cb1, cb2; + BOOL fRestoredBuffer = FALSE; + + // TODO: Send the data to the filter + + // TODO: Copy the data into the DirectSound buffer + if( NULL != gpdsbOutput ) + { + DWORD dwStatus; + if( FAILED( dsrval = gpdsbOutput->GetStatus( &dwStatus ))) + { + DPF( 0, "Unable to get buffer status. (%s)", TranslateDSError(dsrval)); + goto WIC_SkipDataProcessing; + } + if( dwStatus & DSBSTATUS_BUFFERLOST ) + { + if( FAILED( dsrval = gpdsbOutput->Restore())) + { + DPF( 0, "Couldn't Restore output buffer. (%s)", TranslateDSError(dsrval)); + goto WIC_SkipDataProcessing; + } + dwWritePosition = 0; + fRestoredBuffer = TRUE; + } + else + { + if( dwWritePosition == 0xFFFFFFFF ) + { + DWORD dwPlay, dwWrite; + + gpdsbOutput->GetCurrentPosition( &dwPlay, &dwWrite ); + // For our safety, put the write position twice as far ahead as + // what DirectSound says is safe +// dwWritePosition = 3 * dwWrite - dwPlay; +// dwWritePosition = dwWrite + gcbBufferSize; + dwWritePosition = gdsbdOutput.dwBufferBytes + dwPlay - gcbBufferSize; + while( dwWritePosition >= gdsbdOutput.dwBufferBytes ) + dwWritePosition -= gdsbdOutput.dwBufferBytes; + } + } + + if( pwhBuffer->dwBytesRecorded > gcbBufferSize ) + DPF( 1, "Unexpectedly large buffer -- %lu bytes (gcbBufferSize = %lu)", + pwhBuffer->dwBytesRecorded, gcbBufferSize ); + + if( SUCCEEDED( gpdsbOutput->Lock( dwWritePosition, + pwhBuffer->dwBytesRecorded, + &pb1, &cb1, &pb2, &cb2, 0 ))) + { + if( NULL != pb1 && NULL != gpFilter ) + { + gpFilter->Transform( (PBYTE)pwhBuffer->lpData, cb1, pb1 ); + } + if( cb2 && NULL != pb2 && NULL != gpFilter ) + { + gpFilter->Transform( (PBYTE)pwhBuffer->lpData + cb1, + pwhBuffer->dwBytesRecorded - cb1, pb2 ); + } + gpdsbOutput->Unlock( pb1, cb1, pb2, + pwhBuffer->dwBytesRecorded - cb1 ); + dwWritePosition += pwhBuffer->dwBytesRecorded; + while( dwWritePosition >= gdsbdOutput.dwBufferBytes ) + dwWritePosition -= gdsbdOutput.dwBufferBytes; + } + if( fRestoredBuffer ) + { + gpdsbOutput->SetCurrentPosition( 0 ); + if( FAILED( dsrval = gpdsbOutput->Play( 0, 0, DSBPLAY_LOOPING ))) + DPF( 0, "Unable to restart restored buffer. (%s)", TranslateDSError(dsrval)); + dwWritePosition = 0xFFFFFFFF; + } + } +WIC_SkipDataProcessing: + // Spit the buffer back out + pwhBuffer->dwBytesRecorded = 0; + waveInAddBuffer( ghWaveIn, pwhBuffer, sizeof(WAVEHDR)); + } + LeaveCriticalSection( &gcsBufferData ); + + break; + } + } + + + diff --git a/sdk/samples/fdfilter/fdaudio.h b/sdk/samples/fdfilter/fdaudio.h new file mode 100644 index 0000000..7c4f5c1 --- /dev/null +++ b/sdk/samples/fdfilter/fdaudio.h @@ -0,0 +1,36 @@ +#ifndef __AUDIO_H__ +#define __AUDIO_H__ + + +BOOL InitPrimarySoundBuffer( void ); +BOOL InitSoundDevices( BOOL ); +BOOL ReOpenSoundDevices( BOOL ); +BOOL EnumDSDevices( void ); +BOOL EnumWaveDevices( void ); +BOOL FormatCodeToText( DWORD, LPSTR, int ); +BOOL FormatCodeToWFX( DWORD, PWAVEFORMATEX ); +void DisableFormatCode( PFORMATDATA, DWORD ); +BOOL WriteSilenceToOutput( DWORD, DWORD ); + +void FillInputDeviceCombo( HWND ); +void FillOutputDeviceCombo( HWND ); + +void ClearDSDeviceList( void ); +void ClearWaveDeviceList( void ); + +void ScanAvailableDSFormats( void ); +void ScanAvailableWaveFormats( void ); +void CloseWaveDevice( void ); +void CloseDSDevice( void ); + +BOOL InitBuffers( void ); +BOOL DestroyBuffers( void ); +BOOL StartBuffers( void ); +BOOL StopBuffers( void ); + +BOOL CALLBACK DSEnumProc( LPGUID, LPSTR, LPSTR, LPVOID ); +void CALLBACK WaveInCallback( HWAVEIN, UINT, DWORD, DWORD, DWORD ); + +#endif + + diff --git a/sdk/samples/fdfilter/fdfilter.cpp b/sdk/samples/fdfilter/fdfilter.cpp new file mode 100644 index 0000000..aafabb8 --- /dev/null +++ b/sdk/samples/fdfilter/fdfilter.cpp @@ -0,0 +1,671 @@ +////////////////////////////////////////////////////////////////////////////// +// +// File: FDFILTER.CPP +// Contents: General routines related to the Full-Duplex Filter Sample +// +// Description: This file includes the window procedures and initialization +// and destruction code. +// + +#define __DEFINE_GLOBAL_VARIABLES__ +#include "fdfilter.h" +#undef __DEFINE_GLOBAL_VARIABLES__ +#include "fdaudio.h" +#include "filter.h" + +#include <commctrl.h> + +static BOOL InitInstance( HINSTANCE, HINSTANCE, LPSTR, int ); + +static void DestroyInstance( void ); + + +/////////////////////////////////////////////////////////////////////////////// +// DestroyInstance() +// +// Does all of the cleanup for an instance of the application. +// +void DestroyInstance( void ) + { + if( NULL != ghWaveIn ) + { + CloseWaveDevice(); + ASSERT( NULL == ghWaveIn ); + // Deallocate the input buffers + DestroyBuffers(); + } + if( NULL != gpdsbPrimary ) + { + gpdsbPrimary->Release(); + gpdsbPrimary = NULL; + } + if( NULL != gpds ) + { + gpds->Release(); + gpds = NULL; + } + if( NULL != gpwfxOutput ) + { + delete gpwfxOutput; + gpwfxOutput = NULL; + } + if( NULL != ghCallbackFinished ) + { + CloseHandle( ghCallbackFinished ); + ghCallbackFinished = NULL; + } + if( NULL != gpFilter ) + { + delete gpFilter; + gpFilter = NULL; + } + // Get rid of the critical section object + DeleteCriticalSection( &gcsBufferData ); + } + + +////////////////////////////////////////////////////////////////////////////// +// InitInstance() +// +// This function is responsible for all initialization that must occur +// when a new instance of our application is started. +// +BOOL InitInstance( HINSTANCE hInstance, LPSTR lpszCommandLine, int cmdShow ) + { + // Used to protect buffer data from multi-threaded access + InitializeCriticalSection( &gcsBufferData ); + + if(( ghMainWnd = CreateDialog( ghInst, MAKEINTRESOURCE(IDD_MAIN), NULL, (DLGPROC)MainDlgProc )) == NULL ) + return FALSE; + + HMENU hSysMenu = GetSystemMenu( ghMainWnd, FALSE ); + EnableMenuItem( hSysMenu, SC_MAXIMIZE, MF_BYCOMMAND | MF_GRAYED ); + EnableMenuItem( hSysMenu, SC_SIZE, MF_BYCOMMAND | MF_GRAYED ); + + if(( ghCallbackFinished = CreateEvent( NULL, FALSE, FALSE, NULL )) == NULL ) + goto II_ExitError; + + /* Continue doing other initialization stuff */ + if( !InitSoundDevices( TRUE )) + { + DPF( 0, "Call to InitSoundDevices() failed." ); + goto II_ExitError; + } + + ShowWindow( ghMainWnd, cmdShow ); + UpdateWindow( ghMainWnd ); + + return TRUE; // TRUE indicates success + +II_ExitError: + if( NULL != ghMainWnd ) + { + DestroyWindow( ghMainWnd ); + ghMainWnd = NULL; + } + + return FALSE; // FALSE indicates failure on initialization + } // InitInstance() + + +////////////////////////////////////////////////////////////////////////////// +// WinMain() +// +// Main entry point for this program's execution. Everything starts here. +// +int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpszCmdLine, int cmdShow) + { + MSG msg; + + DbgInitialize( TRUE ); + + InitCommonControls(); + + // Save instance handle + ghInst = hInstance; + + if (!InitInstance(hInstance, lpszCmdLine, cmdShow)) + return 0; + + /* Polling messages from event queue */ + while (GetMessage((LPMSG)&msg, NULL, 0, 0)) + { + // Only Translate and Dispatch the message if it's not going + // to one of our many modeless dialog windows + if( !IsDialogMessage( ghMainWnd, &msg )) + { + TranslateMessage((LPMSG)&msg); + DispatchMessage((LPMSG)&msg); + } + } + + return (int)msg.wParam; + } // WinMain() + + +////////////////////////////////////////////////////////////////////////////// +// MainDlgProc() +// +// This the equivalent of a main window procedure, except our main window +// is really a dialog box. +// +BOOL CALLBACK MainDlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) + { + static HWND hInputDeviceText, hInputFormatText, hEnableCheck, hFilterCombo; + static HWND hOutputDeviceText, hPrimaryFormatText, hSecondaryFormatText; + + DWORD dwCode; + int ndx; + + switch( message ) + { + case WM_INITDIALOG: + hInputDeviceText = GetDlgItem( hDlg, IDC_MAIN_INPUTDEVICE_TEXT ); + hInputFormatText = GetDlgItem( hDlg, IDC_MAIN_INPUTFORMAT_TEXT ); + hOutputDeviceText = GetDlgItem( hDlg, IDC_MAIN_OUTPUTDEVICE_TEXT ); + hPrimaryFormatText = GetDlgItem( hDlg, IDC_MAIN_PRIMARYFORMAT_TEXT ); + hSecondaryFormatText = GetDlgItem( hDlg, IDC_MAIN_SECONDARYFORMAT_TEXT ); + hFilterCombo = GetDlgItem( hDlg, IDC_MAIN_FILTER_COMBO ); + hEnableCheck = GetDlgItem( hDlg, IDC_MAIN_ENABLEFILTER_CHECK ); + + ndx = ComboBox_AddString( hFilterCombo, "None (pass-through)" ); + ComboBox_SetItemData( hFilterCombo, ndx, 0 ); + + ComboBox_SetCurSel( hFilterCombo, ndx ); + + ndx = ComboBox_AddString( hFilterCombo, "Gargle" ); + ComboBox_SetItemData( hFilterCombo, ndx, 1 ); + + + EnterCriticalSection( &gcsBufferData ); + if( NULL != gpFilter ) + delete gpFilter; + gpFilter = new CFilter; + LeaveCriticalSection( &gcsBufferData ); + break; + + case WM_PAINT: + { + PAINTSTRUCT ps; + char szFormat[64]; + + BeginPaint( hDlg, &ps ); + if( NULL != gpwddIn ) + Static_SetText( hInputDeviceText, gpwddIn->szDeviceDesc ); + if( NULL != gpdsddOut ) + Static_SetText( hOutputDeviceText, gpdsddOut->pszDeviceDesc ); + + FormatCodeToText( gdwInputFormat, szFormat, sizeof(szFormat)); + Static_SetText( hInputFormatText, szFormat ); + + FormatCodeToText( gdwOutputFormat, szFormat, sizeof(szFormat)); + Static_SetText( hPrimaryFormatText, szFormat ); + + FormatCodeToText( gdwInputFormat, szFormat, sizeof(szFormat)); + Static_SetText( hSecondaryFormatText, szFormat ); + + EndPaint( hDlg, &ps ); + } + break; + + case WM_COMMAND: + switch( LOWORD(wParam)) + { + case IDC_MAIN_FILTER_COMBO: + if( HIWORD( wParam ) == CBN_SELCHANGE ) + { + if(( ndx = ComboBox_GetCurSel( hFilterCombo )) == -1 ) + break; + dwCode = ComboBox_GetItemData( hFilterCombo, ndx ); + if( 0 == dwCode ) + { + EnterCriticalSection( &gcsBufferData ); + if( NULL != gpFilter ) + delete gpFilter; + gpFilter = new CFilter; + LeaveCriticalSection( &gcsBufferData ); + } + if( 1 == dwCode ) + { + EnterCriticalSection( &gcsBufferData ); + if( NULL != gpFilter ) + delete gpFilter; + gpFilter = (CFilter *)new CGargle( gpwfxInput->nSamplesPerSec, + gpwfxInput->nChannels, + gpwfxInput->wBitsPerSample / 8 ); + LeaveCriticalSection( &gcsBufferData ); + } + } + break; + + case IDC_MAIN_ENABLEFILTER_CHECK: + // Don't do anything if we don't have a driver + if( NULL == ghWaveIn ) + break; + if( Button_GetCheck( hEnableCheck )) + { + // Put our hands over our eyes and hold our breaths, + // here comes the data! + if( !gfBuffersInitialized ) + InitBuffers(); + StartBuffers(); + } + else + { + StopBuffers(); + } + break; + + case ID_SETTINGS_DEVICES: + if( FAILED( ReOpenSoundDevices( FALSE ))) + break; + + Button_SetCheck( hEnableCheck, FALSE ); + + EnterCriticalSection( &gcsBufferData ); + if( gpFilter ) + gpFilter->SetFormat( gpwfxInput ); + LeaveCriticalSection( &gcsBufferData ); + InvalidateRect( hDlg, NULL, FALSE ); + UpdateWindow( hDlg ); + break; + + case ID_SETTINGS_FORMATS: + if( Button_GetCheck( hEnableCheck )) + { + Button_SetCheck( hEnableCheck, FALSE ); + StopBuffers(); + } + CloseWaveDevice(); + DestroyBuffers(); + + DialogBoxParam( ghInst, MAKEINTRESOURCE(IDD_FORMATS), + ghMainWnd, (DLGPROC)SelectFormatsDlgProc, 0L ); + InvalidateRect( hDlg, NULL, FALSE ); + UpdateWindow( hDlg ); + + EnterCriticalSection( &gcsBufferData ); + if( gpFilter ) + gpFilter->SetFormat( gpwfxInput ); + LeaveCriticalSection( &gcsBufferData ); + break; + + case ID_HELP_ABOUT: + DialogBox( ghInst, MAKEINTRESOURCE(IDD_ABOUT), + ghMainWnd, (DLGPROC)AboutDlgProc ); + break; + + case ID_FILE_EXIT: + case IDCANCEL: + // Be sure to stop the buffers when we're done + StopBuffers(); + DestroyWindow( hDlg ); + break; + + default: + return FALSE; + } + break; + + case WM_DESTROY: + DestroyInstance(); + PostQuitMessage(0); + break; + + default: + return FALSE; + } + + return TRUE; + } + + +////////////////////////////////////////////////////////////////////////////// +// AboutDlgProc() +// +// Small dialog procedure for the About Box. +// +BOOL CALLBACK AboutDlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) + { + if( message == WM_COMMAND && LOWORD(wParam) == IDOK ) + { + EndDialog( hDlg, FALSE ); + return TRUE; + } + else + return FALSE; + } + + +////////////////////////////////////////////////////////////////////////////// +// CancelWarningDlgProc() +// +// Small dialog procedure for the Formats DLG's cancel warning box. +// +BOOL CALLBACK CancelWarningDlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) + { + if( message == WM_COMMAND && LOWORD(wParam) == IDOK ) + { + EndDialog( hDlg, TRUE ); + return TRUE; + } + else if( message == WM_COMMAND && LOWORD(wParam) == IDCANCEL ) + { + EndDialog( hDlg, FALSE ); + return TRUE; + } + else + return FALSE; + } + + +////////////////////////////////////////////////////////////////////////////// +// FormatCodeToText() +// +// This function reads format codes and puts out a text string for them. +// It does not check for invalid codes. FALSE return means the buffer was +// invalid in some way, TRUE means success. +// +BOOL FormatCodeToText( DWORD dwFormat, LPSTR lpszBuf, int nBufSize ) + { + DWORD dwFreq; + + // The longest string we'll ever put in is 21 characters (including NULL) + if( NULL == lpszBuf || nBufSize < 21 ) + return FALSE; + + // Extract the sample rate + dwFreq = FC_GETFREQCODE(dwFormat); + dwFreq = ( dwFreq == 8 ? 8000 : (dwFreq / 11) * 11025); + + wsprintf( lpszBuf, "%u Hz, %u-bit %s", dwFreq, FC_GETBITS(dwFormat), + FC_GETCHANNELS(dwFormat) == 1 ? "Mono" : "Stereo" ); + + return TRUE; + } + + +////////////////////////////////////////////////////////////////////////////// +// FormatCodeToWFX() +// +// This function reads format codes and fills most of the fields of a +// WAVEFORMATEX structure based on the values read. It does not fill the +// wFormatTag or cbSize members. +// +BOOL FormatCodeToWFX( DWORD dwFormat, PWAVEFORMATEX pwfx ) + { + DWORD dwFreq; + + if( NULL == pwfx ) + return FALSE; + + // Extract the sample rate + dwFreq = FC_GETFREQCODE(dwFormat); + pwfx->nSamplesPerSec = ( dwFreq == 8 ? 8000 : (dwFreq / 11) * 11025); + + pwfx->wBitsPerSample = (WORD)FC_GETBITS(dwFormat); + pwfx->nChannels = (WORD)FC_GETCHANNELS(dwFormat); + + // The nBlockAlign calculation below only works for whole-byte samples + ASSERT( pwfx->wBitsPerSample % 8 == 0 ); + + pwfx->nBlockAlign = pwfx->nChannels * (pwfx->wBitsPerSample / 8); + pwfx->nAvgBytesPerSec = pwfx->nBlockAlign * pwfx->nSamplesPerSec; + + return TRUE; + } + + +////////////////////////////////////////////////////////////////////////////// +// DisableFormatCode() +// +// Disables the given format code +// +void DisableFormatCode( PFORMATDATA pfd, DWORD dwCode ) + { + int i; + + for( i = 0; i < NUM_FORMATCODES; i++ ) + { + if( pfd[i].dwCode == dwCode ) + { + pfd[i].fEnabled = FALSE; + break; + } + } + } + + +////////////////////////////////////////////////////////////////////////////// +// FillFormatListBox() +// +// This little helper function takes an array FORMATDATA structures and +// fills the given ListBox with text/data entries that represent all the +// formats. +// +void FillFormatListBox( PFORMATDATA pfd, HWND hList ) + { + char szFormat[64]; + + for( int i = 0; i < NUM_FORMATCODES; i++ ) + { + if( pfd[i].fEnabled ) + { + FormatCodeToText( pfd[i].dwCode, szFormat, sizeof(szFormat)); + ListBox_SetItemData( hList, ListBox_AddString( hList, szFormat), + pfd[i].dwCode ); + } + } + } + + +////////////////////////////////////////////////////////////////////////////// +// SelectDevicesDlgProc() +// +// Procedure for the dialog which queries the user for device selection. +// +BOOL CALLBACK SelectDevicesDlgProc( HWND hDlg, UINT message, + WPARAM wParam, LPARAM lParam ) + { + static HWND hWaveInCombo, hDirectSoundCombo; + + switch( message ) + { + case WM_INITDIALOG: + hWaveInCombo = GetDlgItem( hDlg, IDC_DEVICES_WAVEIN_COMBO ); + hDirectSoundCombo = GetDlgItem( hDlg, IDC_DEVICES_DIRECTSOUND_COMBO ); + + FillInputDeviceCombo( hWaveInCombo ); + FillOutputDeviceCombo( hDirectSoundCombo ); + break; + + case WM_COMMAND: + switch( LOWORD(wParam)) + { + case IDOK: + gpwddIn = (PWAVEDEVICEDESC)ComboBox_GetItemData( hWaveInCombo, + ComboBox_GetCurSel(hWaveInCombo)); + gpdsddOut = (PDSDEVICEDESC)ComboBox_GetItemData( hDirectSoundCombo, + ComboBox_GetCurSel(hDirectSoundCombo)); + EndDialog( hDlg, TRUE ); + break; + case IDCANCEL: + EndDialog( hDlg, FALSE ); + break; + default: + return FALSE; + } + break; + + default: + return FALSE; + } + return TRUE; + } + + +////////////////////////////////////////////////////////////////////////////// +// SelectFormatsDlgProc() +// +// Procedure the format selection dialog. +// +BOOL CALLBACK SelectFormatsDlgProc( HWND hDlg, UINT message, + WPARAM wParam, LPARAM lParam ) + { + static HWND hOutputList, hInputList, hOK; + static BOOL fAllowFormatCancel = FALSE; + HRESULT dsrval; + MMRESULT mmrval; + DWORD dwOutFormat, dwInFormat; + int ndx; + + switch( message ) + { + case WM_INITDIALOG: + hOutputList = GetDlgItem( hDlg, IDC_FORMATS_OUTPUT_LISTBOX ); + hInputList = GetDlgItem( hDlg, IDC_FORMATS_INPUT_LISTBOX ); + hOK = GetDlgItem( hDlg, IDOK ); + + if( NULL == gpds || NULL == gpdsbPrimary ) + { + EndDialog( hDlg, FALSE ); + return FALSE; + } + ScanAvailableDSFormats(); + FillFormatListBox( aOutputFormats, hOutputList ); + if( !ListBox_GetCount( hOutputList )) + { + MessageBox( ghMainWnd, "Warning: no output formats available", + gszAppName, MB_OK ); + EndDialog( hDlg, FALSE ); + return FALSE; + } + // lParam is a BOOL flag, which is TRUE if cancel is "allowed". If + // the app is running and the devices are selected, the user clearly + // must select a set of formats or else end the application. + fAllowFormatCancel = (BOOL)lParam; + + break; + + case WM_COMMAND: + switch( LOWORD(wParam)) + { + case IDC_FORMATS_INPUT_LISTBOX: + if( ListBox_GetCurSel( hOutputList ) != -1 && + ListBox_GetCurSel( hInputList ) != -1 ) + Button_Enable( hOK, TRUE ); + else + Button_Enable( hOK, FALSE ); + break; + + case IDC_FORMATS_OUTPUT_LISTBOX: + if( HIWORD(wParam) == LBN_SELCHANGE ) + { + dwOutFormat = ListBox_GetItemData( hOutputList, + ListBox_GetCurSel( hOutputList )); + FormatCodeToWFX( dwOutFormat, gpwfxOutput ); + DPF( 3, "Formats DLG: Setting gpwfxOutput" ); + DPWFX( 3, gpwfxOutput ); + if( FAILED( dsrval = gpdsbPrimary->SetFormat( gpwfxOutput ))) + { + DPF( 1, "Formats DLG: Failed to set DSound primary to %lu (%s)", + dwOutFormat, TranslateDSError(dsrval)); + FormatCodeToWFX( gdwOutputFormat, gpwfxOutput ); + DPF( 1, "Formats DLG: Attempting to reset gpwfxOutput" ); + DPWFX( 1, gpwfxOutput ); + if( FAILED( dsrval = gpdsbPrimary->SetFormat( gpwfxOutput ))) + { + DPF( 0, "Formats DLG: Failed to set OLD format (%lu) on primary (%s)", + gdwOutputFormat, gpwfxOutput ); + // TODO: Finish this handler + } + ndx = ListBox_FindItemData( hOutputList, -1, gdwOutputFormat ); + ListBox_SetCurSel( hOutputList, ndx ); + // TODO: Find the item corresponding to the old format + // and select it back? (without re-entering this code) + } + else + { + gdwOutputFormat = dwOutFormat; + + ScanAvailableWaveFormats(); + ListBox_ResetContent( hInputList ); + FillFormatListBox( aInputFormats, hInputList ); + } + Button_Enable( hOK, FALSE ); + } + break; + + case IDOK: + ndx = ListBox_GetCurSel( hOutputList ); + // OK button should be disabled unless there's a selection + // in both listboxes + ASSERT( ndx != -1 ); + + dwOutFormat = ListBox_GetItemData( hOutputList, ndx ); + FormatCodeToWFX( dwOutFormat, gpwfxOutput ); + // We shouldn't get to this dialog if there's no output + ASSERT( NULL != gpds && NULL != gpdsbPrimary ); + if(( dsrval = gpdsbPrimary->SetFormat( gpwfxOutput ))) + { + DPF( 0, "Can't set format %lu (%s)", + dwOutFormat, TranslateDSError(dsrval)); + goto Abort_OK; + } + else + { + gdwOutputFormat = dwOutFormat; + } + + ndx = ListBox_GetCurSel( hInputList ); + // OK button should be disabled unless there's a selection + // in both listboxes + ASSERT( ndx != -1 ); + + dwInFormat = ListBox_GetItemData( hInputList, ndx ); + FormatCodeToWFX( dwInFormat, gpwfxInput ); + + if(( mmrval = waveInOpen( &ghWaveIn, gpwddIn->uID, gpwfxInput, + (DWORD)WaveInCallback, + 0, CALLBACK_FUNCTION )) != MMSYSERR_NOERROR ) + { + DPF( 0, "Unable to open selected input device! format = %lu, mmrval = %lu", dwInFormat, mmrval ); + goto Abort_OK; + } + else + { + gdwInputFormat = dwInFormat; + } + + EndDialog( hDlg, TRUE ); + Abort_OK: + break; + case IDCANCEL: + if( fAllowFormatCancel ) + EndDialog( hDlg, FALSE ); + else + { + if( !DialogBox( ghInst, + MAKEINTRESOURCE(IDD_CANCELWARNING), + ghMainWnd, (DLGPROC)CancelWarningDlgProc )) + { + EndDialog( hDlg, FALSE ); + PostMessage( ghMainWnd, WM_DESTROY, 0, 0 ); + return FALSE; + } + } + break; + + default: + return FALSE; + } + break; + + default: + return FALSE; + } + return TRUE; + } + + diff --git a/sdk/samples/fdfilter/fdfilter.def b/sdk/samples/fdfilter/fdfilter.def new file mode 100644 index 0000000..ce14dd7 --- /dev/null +++ b/sdk/samples/fdfilter/fdfilter.def @@ -0,0 +1,14 @@ +;===========================================================================; +; +; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY +; KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +; IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR +; PURPOSE. +; +; Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved. +; +;===========================================================================; + +NAME FDFILTER +DESCRIPTION 'Microsoft Full-Duplex Filter Sample' + diff --git a/sdk/samples/fdfilter/fdfilter.h b/sdk/samples/fdfilter/fdfilter.h new file mode 100644 index 0000000..f51a1c9 --- /dev/null +++ b/sdk/samples/fdfilter/fdfilter.h @@ -0,0 +1,144 @@ +#ifndef __FDFILTER_H__ +#define __FDFILTER_H__ + + +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <dsound.h> +#include <d3dtypes.h> + +#include "debug.h" +#include "resource.h" + +class CFilter; +class CGargle; + +#define REG_SETTINGS_KEY TEXT("\\Software\\Microsoft\\DFilter") +#define REG_SETTING_INPUTDEVICE TEXT("InputDevice"); +#define REG_SETTING_OUTPUTDEVICE TEXT("OutputDevice"); +#define REG_SETTING_INFORMAT TEXT("InputFormat"); +#define REG_SETTING_OUTFORMAT TEXT("OutputFormat"); + +typedef struct tag_dsdevdesc +{ + GUID guDevice; // Device GUID + PSTR pszDeviceDesc; // Description string + struct tag_dsdevdesc *pNext; +} DSDEVICEDESC, *PDSDEVICEDESC; + + +typedef struct tag_wavedevdesc +{ + UINT uID; // Device ID + char szDeviceDesc[MAXPNAMELEN]; // Description string + DWORD dwFormats; + WORD nChannels; + struct tag_wavedevdesc *pNext; +} WAVEDEVICEDESC, *PWAVEDEVICEDESC; + +typedef struct tag_fd +{ + DWORD dwCode; + BOOL fEnabled; +} FORMATDATA, *PFORMATDATA; + +#define NUM_FORMATCODES (16) + +#define FC_GETFREQCODE(fc) ((fc) / 1000) +#define FC_GETBITS(fc) ((fc) % 100) +#define FC_GETCHANNELS(fc) (((fc) % 1000) / 100) + +#define NUM_BUFFERS (16) + + +#ifdef __DEFINE_GLOBAL_VARIABLES__ + +FORMATDATA aInputFormats[NUM_FORMATCODES] = {{ 8108, TRUE }, { 8208, TRUE }, + { 8116, TRUE }, { 8216, TRUE }, + { 11108, TRUE }, { 11208, TRUE }, + { 11116, TRUE }, { 11216, TRUE }, + { 22108, TRUE }, { 22208, TRUE }, + { 22116, TRUE }, { 22216, TRUE }, + { 44108, TRUE }, { 44208, TRUE }, + { 44116, TRUE }, { 44216, TRUE }}; + +FORMATDATA aOutputFormats[NUM_FORMATCODES] = {{ 8108, TRUE }, { 8208, TRUE }, + { 8116, TRUE }, { 8216, TRUE }, + { 11108, TRUE }, { 11208, TRUE }, + { 11116, TRUE }, { 11216, TRUE }, + { 22108, TRUE }, { 22208, TRUE }, + { 22116, TRUE }, { 22216, TRUE }, + { 44108, TRUE }, { 44208, TRUE }, + { 44116, TRUE }, { 44216, TRUE }}; + +LPDIRECTSOUND gpds; +LPDIRECTSOUNDBUFFER gpdsbPrimary; +LPWAVEFORMATEX gpwfxInput, gpwfxOutput; + + +char gszAppName[] = "FDFilter"; +char gszAppDescription[] = "Full-Duplex Filter Sample"; +HINSTANCE ghInst; +HWND ghMainWnd; +HWAVEIN ghWaveIn; +HANDLE ghCallbackFinished; + +DWORD gdwOutputFormat, gdwInputFormat, gcbBufferSize; +PWAVEDEVICEDESC gpwddInputDevices, gpwddIn; +PDSDEVICEDESC gpdsddOutputDevices, gpdsddOut; + +CRITICAL_SECTION gcsBufferData; +int gnBuffersOut; +PWAVEHDR gawhHeaders; +PBYTE gpbBufferData; +LONG gfBuffersInitialized; +LPDIRECTSOUNDBUFFER gpdsbOutput; +DSBUFFERDESC gdsbdOutput; +CFilter * gpFilter; + +#else + +extern FORMATDATA aInputFormats[], aOutputFormats[]; +extern LPDIRECTSOUND gpds; +extern LPDIRECTSOUNDBUFFER gpdsbPrimary; +extern LPWAVEFORMATEX gpwfxInput, gpwfxOutput; + + +extern char gszAppName[]; +extern char gszAppDescription[]; +extern HINSTANCE ghInst; +extern HWND ghMainWnd; +extern HWAVEIN ghWaveIn; +extern HANDLE ghCallbackFinished; + +extern DWORD gdwOutputFormat, gdwInputFormat, gcbBufferSize; +extern PWAVEDEVICEDESC gpwddInputDevices, gpwddIn; +extern PDSDEVICEDESC gpdsddOutputDevices, gpdsddOut; + +extern CRITICAL_SECTION gcsBufferData; +extern int gnBuffersOut; +extern PWAVEHDR gawhHeaders; +extern PBYTE gpbBufferData; +extern LONG gfBuffersInitialized; +extern LPDIRECTSOUNDBUFFER gpdsbOutput; +extern DSBUFFERDESC gdsbdOutput; +extern CFilter * gpFilter; + +#endif + + + +int PASCAL WinMain( HINSTANCE, HINSTANCE, LPSTR, int ); +BOOL CALLBACK MainDlgProc( HWND, UINT, WPARAM, LPARAM ); +BOOL CALLBACK AboutDlgProc( HWND, UINT, WPARAM, LPARAM ); +BOOL CALLBACK CancelWarningDlgProc( HWND, UINT, WPARAM, LPARAM ); +BOOL CALLBACK SelectDevicesDlgProc( HWND, UINT, WPARAM, LPARAM ); +BOOL CALLBACK SelectFormatsDlgProc( HWND, UINT, WPARAM, LPARAM ); + + +void FillFormatListBox( PFORMATDATA, HWND ); + +#endif // __FDFILTER_H__ + + diff --git a/sdk/samples/fdfilter/fdfilter.rc b/sdk/samples/fdfilter/fdfilter.rc new file mode 100644 index 0000000..1be1ef9 --- /dev/null +++ b/sdk/samples/fdfilter/fdfilter.rc @@ -0,0 +1,241 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "reshead.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_MAIN DIALOG DISCARDABLE 0, 0, 200, 102 +STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "Full-Duplex Filter Sample" +MENU IDM_MAIN +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Device:",IDC_STATIC,10,14,26,8 + LTEXT "Format:",IDC_STATIC,10,24,26,8 + LTEXT "",IDC_MAIN_INPUTDEVICE_TEXT,38,14,152,8 + LTEXT "",IDC_MAIN_INPUTFORMAT_TEXT,38,24,152,8 + COMBOBOX IDC_MAIN_FILTER_COMBO,44,83,112,52,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Filter Effect:",IDC_STATIC,4,85,40,8 + GROUPBOX "Input",IDC_STATIC,4,5,190,30 + LTEXT "Device:",IDC_STATIC,10,47,26,8 + LTEXT "Primary Format:",IDC_STATIC,10,57,50,8 + LTEXT "",IDC_MAIN_OUTPUTDEVICE_TEXT,38,47,152,8 + LTEXT "",IDC_MAIN_PRIMARYFORMAT_TEXT,62,57,128,8 + GROUPBOX "Output",IDC_STATIC,4,38,190,40 + CONTROL "&Enable",IDC_MAIN_ENABLEFILTER_CHECK,"Button", + BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,158,83,36,13 + LTEXT "Secondary Format:",IDC_STATIC,10,67,60,8 + LTEXT "",IDC_MAIN_SECONDARYFORMAT_TEXT,72,67,118,8 +END + +IDD_ABOUT DIALOG DISCARDABLE 0, 0, 196, 95 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About DFilter" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,75,74,50,14 + LTEXT "FDFILTER Sample Application",IDC_STATIC,50,8,107,8 + LTEXT "Illustrates full-duplex audio using waveIn",IDC_STATIC, + 50,24,137,8 + LTEXT "audio input and DirectSound output",IDC_STATIC,50,32, + 137,8 + LTEXT "Copyright (c) 1996, Microsoft Corporation.",IDC_STATIC, + 50,52,135,8 + ICON IDI_MAIN,IDC_STATIC,8,8,18,20 +END + +IDD_DEVICES DIALOG DISCARDABLE 0, 0, 178, 95 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select Devices" +FONT 8, "MS Sans Serif" +BEGIN + COMBOBOX IDC_DEVICES_WAVEIN_COMBO,6,30,166,46,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_DEVICES_DIRECTSOUND_COMBO,6,56,166,46, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,35,74,50,14 + PUSHBUTTON "Cancel",IDCANCEL,93,74,50,14 + LTEXT "Please select your preferred wave devices.",IDC_STATIC, + 6,6,140,8 + LTEXT "waveIn Devices:",IDC_STATIC,6,20,68,8 + LTEXT "DirectSound Devices:",IDC_STATIC,6,46,99,8 +END + +IDD_FORMATS DIALOG DISCARDABLE 0, 0, 258, 101 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select Formats" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,75,80,50,14,WS_DISABLED + PUSHBUTTON "Cancel",IDCANCEL,133,80,50,14 + LISTBOX IDC_FORMATS_OUTPUT_LISTBOX,6,15,90,59, + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LISTBOX IDC_FORMATS_INPUT_LISTBOX,161,15,90,59, + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LTEXT "Output Format:",IDC_STATIC,6,6,50,8 + LTEXT "Input Format:",IDC_STATIC,161,6,50,8 + CTEXT "Choose an output format, and then select from the available input formats. Click OK to accept the combination.", + IDC_STATIC,100,15,56,59 +END + +IDD_CANCELWARNING DIALOG DISCARDABLE 0, 0, 186, 89 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Unable to Cancel" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Continue",IDOK,35,68,50,14 + PUSHBUTTON "Exit",IDCANCEL,101,68,50,14 + CTEXT "In order to continue opening new devices, you must select new formats. Since the old devices have been closed, it is not possible to cancel this operation successfully. To end this application, click the Exit button.", + IDC_STATIC,6,6,173,42 + CTEXT "To continue and select new formats, click Continue.", + IDC_STATIC,6,48,173,11 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_MAIN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 193 + TOPMARGIN, 7 + BOTTOMMARGIN, 95 + END + + IDD_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 189 + TOPMARGIN, 7 + BOTTOMMARGIN, 88 + END + + IDD_DEVICES, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 171 + TOPMARGIN, 7 + BOTTOMMARGIN, 88 + END + + IDD_FORMATS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 251 + TOPMARGIN, 7 + BOTTOMMARGIN, 94 + END + + IDD_CANCELWARNING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 82 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""reshead.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDM_MAIN MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", ID_FILE_EXIT + END + POPUP "&Settings" + BEGIN + MENUITEM "&Devices...", ID_SETTINGS_DEVICES + MENUITEM "&Formats...", ID_SETTINGS_FORMATS + END + POPUP "&Help" + BEGIN + MENUITEM "&About...", ID_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_MAIN ICON DISCARDABLE "icon1.ico" +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sdk/samples/fdfilter/filter.cpp b/sdk/samples/fdfilter/filter.cpp new file mode 100644 index 0000000..11b02a3 --- /dev/null +++ b/sdk/samples/fdfilter/filter.cpp @@ -0,0 +1,26 @@ +#include "fdfilter.h" +#include "filter.h" + +HRESULT CFilter::Transform( PBYTE pbIn, int cbLength, PBYTE pbOut ) + { + if( NULL == pbIn || NULL == pbOut ) + return ResultFromScode( E_POINTER ); + if( 0 == cbLength ) + return NOERROR; + + CopyMemory( pbOut, pbIn, cbLength ); + return NOERROR; + } + + +// Merely stubbed out for this simple filter -- we have no need for the +// extra information +HRESULT CFilter::SetFormat( PWAVEFORMATEX pwfx ) + { + if( NULL == pwfx ) + return ResultFromScode( E_POINTER ); + + return NOERROR; + } + + diff --git a/sdk/samples/fdfilter/filter.h b/sdk/samples/fdfilter/filter.h new file mode 100644 index 0000000..28f3eb9 --- /dev/null +++ b/sdk/samples/fdfilter/filter.h @@ -0,0 +1,45 @@ +#ifndef __FILTER_H__ +#define __FILTER_H__ + + + +class CFilter + { + public: + virtual HRESULT Transform( PBYTE, int, PBYTE ); + virtual HRESULT SetFormat( PWAVEFORMATEX ); + }; + + +class CGargle : public CFilter + { + public: + CGargle( int nFreq = 0, int nChannels = 0, int nBytesPerSample = 0 ); + virtual HRESULT Transform( PBYTE, int, PBYTE ); + virtual HRESULT SetFormat( PWAVEFORMATEX ); + + protected: + enum Shape { SHAPE_TRIANGLE, SHAPE_SQUARE }; + + int m_nPhase, m_nGargleRate; + int m_nBytesPerSample, m_nSamplesPerSec, m_nChannels; + + Shape m_Shape; + + void MessItAbout( PBYTE, DWORD, PBYTE ); + }; + + +class C3DPosition : public CFilter + { + public: + virtual HRESULT Transform( PWAVEHDR ); + + protected: +// GetPosition( D3DVECTOR * ); + }; + + +#endif //__FILTER_H__ + + diff --git a/sdk/samples/fdfilter/gargle.cpp b/sdk/samples/fdfilter/gargle.cpp new file mode 100644 index 0000000..a3f0fb1 --- /dev/null +++ b/sdk/samples/fdfilter/gargle.cpp @@ -0,0 +1,141 @@ +#include "fdfilter.h" +#include "filter.h" + +CGargle::CGargle( int nFreq, int nChannels, int nBytesPerSample ) + { + m_nPhase = 0; + m_Shape = SHAPE_TRIANGLE; + m_nGargleRate = 10; + m_nBytesPerSample = nBytesPerSample; + m_nSamplesPerSec = nFreq; + m_nChannels = nChannels; + } + + +CGargle::~CGargle() + { + } + + +// Copy the required information about the new format for the buffer +HRESULT CGargle::SetFormat( PWAVEFORMATEX pwfx ) + { + if( NULL == pwfx ) + return ResultFromScode( E_POINTER ); + + m_nSamplesPerSec = pwfx->nSamplesPerSec; + m_nChannels = pwfx->nChannels; + m_nBytesPerSample = pwfx->wBitsPerSample / 8; + + return NOERROR; + } + + +// +// MessItAbout +// +// Mess the sound about by modulating it with a waveform. +// We know the frequency of the modulation (from the slider setting +// which we were told through our internal interface, IGargle, and +// which we stored in m_GargleRate). At the end of the call we +// record what part of the waveform we finished at in m_Phase and +// we resume at that point next time. +// Uses and updates m_Phase +// Uses m_SamplesPerSec, m_Channels, m_GargleRate, m_Shape +// +void CGargle::MessItAbout( PBYTE pbIn, DWORD cb, PBYTE pbOut ) +{ + // We know how many samples per sec and how + // many channels so we can calculate the modulation period in samples. + // + + int Period = (m_nSamplesPerSec * m_nChannels) / m_nGargleRate; + + while( cb > 0 ) { + --cb; + + // If m_Shape is 0 (triangle) then we multiply by a triangular waveform + // that runs 0..Period/2..0..Period/2..0... else by a square one that + // is either 0 or Period/2 (same maximum as the triangle) or zero. + // + { + // m_Phase is the number of samples from the start of the period. + // We keep this running from one call to the next, + // but if the period changes so as to make this more + // than Period then we reset to 0 with a bang. This may cause + // an audible click or pop (but, hey! it's only a sample!) + // + ++m_nPhase; + if( m_nPhase > Period ) + m_nPhase = 0; + + int M = m_nPhase; // m is what we modulate with + + if( m_Shape == SHAPE_TRIANGLE ) { // Triangle + if( M > Period / 2 ) + M = Period - M; // handle downslope + } else if( m_Shape == SHAPE_TRIANGLE ) { // Square wave + if( M <= Period / 2 ) + M = Period / 2; + else M = 0; + } + + if( m_nBytesPerSample == 1 ) { + // 8 bit sound uses 0..255 representing -128..127 + // Any overflow, even by 1, would sound very bad. + // so we clip paranoically after modulating. + // I think it should never clip by more than 1 + // + int i = *pbIn - 128; // sound sample, zero based + i = (i * M * 2) / Period; // modulate + if(i > 127) // clip + i = 127; + if(i < -128) + i = -128; + + *pbOut = (unsigned char)(i + 128); // reset zero offset to 128 + + } else if( m_nBytesPerSample == 2 ) { + // 16 bit sound uses 16 bits properly (0 means 0) + // We still clip paranoically + // + short int *psi = (short int *)pbOut; + int i = *((short int *)pbIn); // in a register, we might hope + i = (i*M*2)/Period; // modulate + if(i > 32767) + i = 32767; // clip + if(i < -32768) + i = -32768; + *psi = (short)i; + ++pbIn; // nudge it on another 8 bits here to get a 16 bit step + ++pbOut; + --cb; // and nudge the count too. + } else { +// DbgBreak("Too many bytes per sample"); + // just leave it alone! + } + } + ++pbIn; // move on 8 bits to next sound sample + ++pbOut; + } +} // MessItAbout + + +// +// Transform +// +// +HRESULT CGargle::Transform( PBYTE pbIn, int cbWrite, PBYTE pbOut ) +{ + // Actually transform the data + // + if( m_nSamplesPerSec && m_nChannels && m_nBytesPerSample ) + MessItAbout( pbIn, cbWrite, pbOut ); + + return NOERROR; + +} // Transform + + + + diff --git a/sdk/samples/fdfilter/icon1.ico b/sdk/samples/fdfilter/icon1.ico new file mode 100644 index 0000000..76add32 Binary files /dev/null and b/sdk/samples/fdfilter/icon1.ico differ diff --git a/sdk/samples/fdfilter/makefile b/sdk/samples/fdfilter/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/fdfilter/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/fdfilter/makefile.wat b/sdk/samples/fdfilter/makefile.wat new file mode 100644 index 0000000..b705d4b --- /dev/null +++ b/sdk/samples/fdfilter/makefile.wat @@ -0,0 +1,2 @@ +MAKENAME=watcom.mk +!include ..\watbld.mk diff --git a/sdk/samples/fdfilter/msvc.mk b/sdk/samples/fdfilter/msvc.mk new file mode 100644 index 0000000..1d97e5f --- /dev/null +++ b/sdk/samples/fdfilter/msvc.mk @@ -0,0 +1,42 @@ +NAME = FDFilter +EXT = EXE + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib dsound.lib shell32.lib \ + comdlg32.lib gdi32.lib winmm.lib msacm32.lib libc.lib uuid.lib ole32.lib comctl32.lib + +OBJS = debug.obj fdaudio.obj fdfilter.obj gargle.obj filter.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/fdfilter/reshead.h b/sdk/samples/fdfilter/reshead.h new file mode 100644 index 0000000..6820a22 --- /dev/null +++ b/sdk/samples/fdfilter/reshead.h @@ -0,0 +1,15 @@ +#ifdef APSTUDIO_INVOKED // Built from inside VC +#include "afxres.h" + +#else // Built from the command-line (some command-lines don't have MFC headers) + +#undef RC_INVOKED +#define RC_INVOKED + +#undef IDC_STATIC +#define IDC_STATIC -1 + +#include "windows.h" +#include "commctrl.h" + +#endif diff --git a/sdk/samples/fdfilter/resource.h b/sdk/samples/fdfilter/resource.h new file mode 100644 index 0000000..89d70b4 --- /dev/null +++ b/sdk/samples/fdfilter/resource.h @@ -0,0 +1,44 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by fdfilter.rc +// +#define IDD_MAIN 101 +#define IDM_MAIN 102 +#define IDD_ABOUT 103 +#define IDI_MAIN 104 +#define IDD_DEVICES 106 +#define IDD_FORMATS 107 +#define IDD_CANCELWARNING 108 +#define IDC_MAIN_INPUT_LISTBOX 1000 +#define IDC_MAIN_OUTPUT_LISTBOX 1001 +#define IDC_MAIN_WAVEOUT_RADIO 1002 +#define IDC_MAIN_DIRECTSOUND_RADIO 1003 +#define IDC_MAIN_3DPOSITION_RADIO 1004 +#define IDC_MAIN_GARGLE_RADIO 1005 +#define IDC_MAIN_ECHO_RADIO 1006 +#define IDC_DEVICES_WAVEIN_COMBO 1009 +#define IDC_DEVICES_DIRECTSOUND_COMBO 1010 +#define IDC_FORMATS_OUTPUT_LISTBOX 1010 +#define IDC_FORMATS_INPUT_LISTBOX 1011 +#define IDC_MAIN_INPUTDEVICE_TEXT 1012 +#define IDC_MAIN_INPUTFORMAT_TEXT 1013 +#define IDC_MAIN_OUTPUTDEVICE_TEXT 1014 +#define IDC_MAIN_PRIMARYFORMAT_TEXT 1015 +#define IDC_MAIN_FILTER_COMBO 1016 +#define IDC_MAIN_ENABLEFILTER_CHECK 1017 +#define IDC_MAIN_SECONDARYFORMAT_TEXT 1018 +#define ID_FILE_EXIT 40001 +#define ID_HELP_ABOUT 40002 +#define ID_SETTINGS_DEVICES 40003 +#define ID_SETTINGS_FORMATS 40004 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 109 +#define _APS_NEXT_COMMAND_VALUE 40005 +#define _APS_NEXT_CONTROL_VALUE 1018 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sdk/samples/fdfilter/watcom.mk b/sdk/samples/fdfilter/watcom.mk new file mode 100644 index 0000000..d4480bc --- /dev/null +++ b/sdk/samples/fdfilter/watcom.mk @@ -0,0 +1,43 @@ +NAME = FDFilter +EXT = EXE + +GOALS = $(NAME).$(EXT) + +LIBS =..\..\..\lib\ddraw.lib ..\..\..\lib\dsound.lib uuid.lib ole32.lib comctl32.lib + +OBJS = debug.obj fdfilter.obj fdaudio.obj gargle.obj filter.obj + +SYS = nt_win + +!ifdef DEBUG +COPT =-DDEBUG -d2 +LOPT = debug all +ROPT =-DDEBUG +!else +COPT =-oaxt -d1 +LOPT = +ROPT = +!endif + +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +!include ..\..\watsdk.mk + +$(NAME).$(EXT): $(OBJS) tmp.lib $(NAME).lnk $(RES) + $(LINK) $(LFLAGS) library tmp.lib @$(NAME).lnk + $(RC) $(RES) + +# +# need this because Watcom's libs don't have the ACM entries and the IMPORT +# statement on the linker doesn't work the way we want +# +tmp.lib : tmp.lbc + @wlib -q tmp.lib @tmp.lbc > NUL + +tmp.lbc : ..\$(MAKENAME) + @%write tmp.lbc ++_acmMetrics.'MSACM32.DLL'._acmMetrics.acmMetrics diff --git a/sdk/samples/flip2d/dumb3d.cpp b/sdk/samples/flip2d/dumb3d.cpp new file mode 100644 index 0000000..b0a35f6 --- /dev/null +++ b/sdk/samples/flip2d/dumb3d.cpp @@ -0,0 +1,301 @@ +/************************************************************************** + dumb3d.cpp - A simple linear algebra library for 3D. + + **************************************************************************/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + **************************************************************************/ + +#include<memory.h> +#include<math.h> +#include"dumb3d.h" + +/*-------------------------------------------------------------------------- + +matrix multiplication. + +*/ + +matrix_4x4 operator*( matrix_4x4 const &Multiplicand, + matrix_4x4 const &Multiplier ) +{ + matrix_4x4 ReturnMatrix; + + for(int i = 0;i < 4;i++) + { + for(int j = 0;j < 4;j++) + { + real Value = 0; + + for(int k = 0;k < 4;k++) + { + Value += Multiplicand.GetElement(i,k) * + Multiplier.GetElement(k,j); + } + + ReturnMatrix.SetElement(i,j,Value); + } + } + + return ReturnMatrix; +} + +vector_4 operator*( matrix_4x4 const &Multiplicand, + vector_4 const &Multiplier ) +{ + vector_4 ReturnPoint; + + for(int i = 0;i < 4;i++) + { + real Value = 0; + + for(int k = 0;k < 4;k++) + { + Value += Multiplicand.GetElement(i,k) * + Multiplier.GetElement(k); + } + + ReturnPoint.SetElement(i,Value); + } + + return ReturnPoint; +} + +point_4 operator*( matrix_4x4 const &Multiplicand, + point_4 const &Multiplier ) +{ + point_4 ReturnPoint; + + for(int i = 0;i < 4;i++) + { + real Value = 0; + + for(int k = 0;k < 4;k++) + { + Value += Multiplicand.GetElement(i,k) * + Multiplier.GetElement(k); + } + + ReturnPoint.SetElement(i,Value); + } + + return ReturnPoint; +} + + +/*-------------------------------------------------------------------------- + +constructor. + +*/ + +matrix_4x4::matrix_4x4( void ) +{ + for(int Counter = 0;Counter < 16;Counter++) + { + aElements[0][Counter] = 0; + } + + aElements[0][0] = aElements[1][1] = aElements[2][2] = aElements[3][3] = 1; +} + + +/*-------------------------------------------------------------------------- + +Rotations. + +*/ + +matrix_4x4 &matrix_4x4::ConcatenateXRotation( real Degrees ) +{ + real Temp01, Temp11, Temp21, Temp31; + real Temp02, Temp12, Temp22, Temp32; + + real Radians = (Degrees/360) * M_PI * 2; + + real Sin = sin(Radians), Cos = cos(Radians); + + Temp01 = aElements[0][1] * Cos + aElements[0][2] * Sin; + Temp11 = aElements[1][1] * Cos + aElements[1][2] * Sin; + Temp21 = aElements[2][1] * Cos + aElements[2][2] * Sin; + Temp31 = aElements[3][1] * Cos + aElements[3][2] * Sin; + + Temp02 = aElements[0][1] * -Sin + aElements[0][2] * Cos; + Temp12 = aElements[1][1] * -Sin + aElements[1][2] * Cos; + Temp22 = aElements[2][1] * -Sin + aElements[2][2] * Cos; + Temp32 = aElements[3][1] * -Sin + aElements[3][2] * Cos; + + aElements[0][1] = Temp01; + aElements[1][1] = Temp11; + aElements[2][1] = Temp21; + aElements[3][1] = Temp31; + aElements[0][2] = Temp02; + aElements[1][2] = Temp12; + aElements[2][2] = Temp22; + aElements[3][2] = Temp32; + + return *this; +} + +matrix_4x4 &matrix_4x4::ConcatenateYRotation( real Degrees ) +{ + real Temp00, Temp10, Temp20, Temp30; + real Temp02, Temp12, Temp22, Temp32; + + real Radians = (Degrees/360) * M_PI * 2; + + real Sin = sin(Radians), Cos = cos(Radians); + + Temp00 = aElements[0][0] * Cos + aElements[0][2] * -Sin; + Temp10 = aElements[1][0] * Cos + aElements[1][2] * -Sin; + Temp20 = aElements[2][0] * Cos + aElements[2][2] * -Sin; + Temp30 = aElements[3][0] * Cos + aElements[3][2] * -Sin; + + Temp02 = aElements[0][0] * Sin + aElements[0][2] * Cos; + Temp12 = aElements[1][0] * Sin + aElements[1][2] * Cos; + Temp22 = aElements[2][0] * Sin + aElements[2][2] * Cos; + Temp32 = aElements[3][0] * Sin + aElements[3][2] * Cos; + + aElements[0][0] = Temp00; + aElements[1][0] = Temp10; + aElements[2][0] = Temp20; + aElements[3][0] = Temp30; + aElements[0][2] = Temp02; + aElements[1][2] = Temp12; + aElements[2][2] = Temp22; + aElements[3][2] = Temp32; + + return *this; +} + +matrix_4x4 &matrix_4x4::ConcatenateZRotation( real Degrees ) +{ + real Temp00, Temp10, Temp20, Temp30; + real Temp01, Temp11, Temp21, Temp31; + + real Radians = (Degrees/360) * M_PI * 2; + + real Sin = sin(Radians), Cos = cos(Radians); + + Temp00 = aElements[0][0] * Cos + aElements[0][1] * Sin; + Temp10 = aElements[1][0] * Cos + aElements[1][1] * Sin; + Temp20 = aElements[2][0] * Cos + aElements[2][1] * Sin; + Temp30 = aElements[3][0] * Cos + aElements[3][1] * Sin; + + Temp01 = aElements[0][0] * -Sin + aElements[0][1] * Cos; + Temp11 = aElements[1][0] * -Sin + aElements[1][1] * Cos; + Temp21 = aElements[2][0] * -Sin + aElements[2][1] * Cos; + Temp31 = aElements[3][0] * -Sin + aElements[3][1] * Cos; + + aElements[0][0] = Temp00; + aElements[1][0] = Temp10; + aElements[2][0] = Temp20; + aElements[3][0] = Temp30; + aElements[0][1] = Temp01; + aElements[1][1] = Temp11; + aElements[2][1] = Temp21; + aElements[3][1] = Temp31; + + return *this; +} + +/*-------------------------------------------------------------------------- + +Translations. + +*/ + +matrix_4x4 &matrix_4x4::ConcatenateXTranslation( real Distance ) +{ + aElements[0][3] = aElements[0][0] * Distance + aElements[0][3]; + aElements[1][3] = aElements[1][0] * Distance + aElements[1][3]; + aElements[2][3] = aElements[2][0] * Distance + aElements[2][3]; + aElements[3][3] = aElements[3][0] * Distance + aElements[3][3]; + + return *this; +} + +matrix_4x4 &matrix_4x4::ConcatenateYTranslation( real Distance ) +{ + aElements[0][3] = aElements[0][1] * Distance + aElements[0][3]; + aElements[1][3] = aElements[1][1] * Distance + aElements[1][3]; + aElements[2][3] = aElements[2][1] * Distance + aElements[2][3]; + aElements[3][3] = aElements[3][1] * Distance + aElements[3][3]; + + return *this; +} + +matrix_4x4 &matrix_4x4::ConcatenateZTranslation( real Distance ) +{ + aElements[0][3] = aElements[0][2] * Distance + aElements[0][3]; + aElements[1][3] = aElements[1][2] * Distance + aElements[1][3]; + aElements[2][3] = aElements[2][2] * Distance + aElements[2][3]; + aElements[3][3] = aElements[3][2] * Distance + aElements[3][3]; + + return *this; +} + +/*-------------------------------------------------------------------------- + +vector normalize. + +*/ + +vector_4 &vector_4::Normalize( void ) +{ + real Length = sqrt(GetX()*GetX() + GetY()*GetY() + GetZ()*GetZ()); + + SetX(GetX() / Length); + SetY(GetY() / Length); + SetZ(GetZ() / Length); + + return *this; +} + +/*-------------------------------------------------------------------------- + +view transform ctor. + +*/ + +view_transform::view_transform( point_4 const &Viewpoint, + vector_4 const &ViewDirection, vector_4 const &Up ) +{ + // translate the viewpoint to the origin + + this->ConcatenateXTranslation(-Viewpoint.GetX()); + this->ConcatenateYTranslation(-Viewpoint.GetY()); + this->ConcatenateZTranslation(-Viewpoint.GetZ()); + + // get view vectors set up + + vector_4 Right = -CrossProduct(ViewDirection,Up); + vector_4 ReallyUp = CrossProduct(Right,ViewDirection); + + matrix_4x4 LookDownZ; + + for(int Counter = 0;Counter < 3;Counter++) + { + LookDownZ.SetElement(0,Counter,Right.GetElement(Counter)); + } + + for(Counter = 0;Counter < 3;Counter++) + { + LookDownZ.SetElement(1,Counter,ReallyUp.GetElement(Counter)); + } + + for(Counter = 0;Counter < 3;Counter++) + { + LookDownZ.SetElement(2,Counter,ViewDirection.GetElement(Counter)); + } + + this->matrix_4x4::operator=(LookDownZ * *this); +} diff --git a/sdk/samples/flip2d/dumb3d.h b/sdk/samples/flip2d/dumb3d.h new file mode 100644 index 0000000..e85515a --- /dev/null +++ b/sdk/samples/flip2d/dumb3d.h @@ -0,0 +1,437 @@ +/************************************************************************** + dumb3d.h - A simple linear algebra library for 3D. + + **************************************************************************/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + **************************************************************************/ + +#if !defined(DUMB3D_HPP) +#define DUMB3D_HPP + +/*---------------------------------------------------------------------------- + +This header contains the declarations for the dumb3d functions. + +*/ + + +// real type + +typedef double real; + + +#define M_PI 3.14159265358979323846 + + +// forward declarations + +class point_4; +class vector_4; +class matrix_4x4; + +/*---------------------------------------------------------------------------- + +globally useful functions. + +*/ + +inline vector_4 operator-( point_4 const &Operand1, point_4 const &Operand2 ); + +inline vector_4 operator+( vector_4 const &Operand1, + vector_4 const &Operand2 ); + +inline vector_4 operator-( vector_4 const &Operand1, + vector_4 const &Operand2 ); + +inline vector_4 operator*( vector_4 const &Multiplicand, + real const &Multiplier ); + +inline vector_4 operator*( real const &Multiplier, + vector_4 const &Multiplicand ); + +inline point_4 operator+( point_4 const &Operand1, vector_4 const &Operand2 ); +inline point_4 operator-( point_4 const &Operand1, vector_4 const &Operand2 ); +inline point_4 operator+( vector_4 const &Operand2, point_4 const &Operand1 ); + +inline vector_4 operator-( vector_4 const &Operand1 ); + +inline vector_4 CrossProduct( vector_4 const &Operand1, + vector_4 const &Operand2 ); + +inline real DotProduct( vector_4 const &Operand1, vector_4 const &Operand2 ); + +matrix_4x4 operator*( matrix_4x4 const &Multiplicand, + matrix_4x4 const &Multiplier ); + +vector_4 operator*( matrix_4x4 const &Multiplicand, + vector_4 const &Multiplier ); + +point_4 operator*( matrix_4x4 const &Multiplicand, + point_4 const &Multiplier ); + + + + +/*---------------------------------------------------------------------------- + +quadruple. Base class for homogeneous vectors and points. + +*/ + +class quadruple +{ +public: + + inline real GetElement( int Row ) const; + + inline real GetX( void ) const; + inline real GetY( void ) const; + inline real GetZ( void ) const; + inline real GetW( void ) const; + + inline void SetElement( int Row, real Value ); + + inline void SetX( real Value ); + inline void SetY( real Value ); + inline void SetZ( real Value ); + inline void SetW( real Value ); + + +protected: + + inline quadruple( void ); + inline quadruple( real X, real Y, real Z, real W ); + inline quadruple( quadruple const & ); + inline quadruple &operator=( quadruple const & ); + + real aElements[4]; +}; + + +/*---------------------------------------------------------------------------- + +point_4. This class represents a homogeneous 3D point. + +*/ + +class point_4 : + public quadruple +{ +public: + + inline point_4( void ); + inline point_4( real X, real Y, real Z ); + + inline void Homogenize( void ); +}; + +/*---------------------------------------------------------------------------- + +vector_4. This class represents a homogeneous 3D vector. + +*/ + +class vector_4 : + public quadruple +{ +public: + + inline vector_4( void ); + inline vector_4( real X, real Y, real Z ); + + vector_4 &Normalize( void ); +}; + + + +/*---------------------------------------------------------------------------- + +matrix_4x4. This class represents row major 4x4 homogeneous matrices. + +*/ + +class matrix_4x4 +{ +public: + + matrix_4x4( void ); + + matrix_4x4 &ConcatenateXRotation( real Degrees ); + matrix_4x4 &ConcatenateYRotation( real Degrees ); + matrix_4x4 &ConcatenateZRotation( real Degrees ); + + matrix_4x4 &ConcatenateXTranslation( real Distance ); + matrix_4x4 &ConcatenateYTranslation( real Distance ); + matrix_4x4 &ConcatenateZTranslation( real Distance ); + + inline real GetElement( int Row, int Column ) const; + inline matrix_4x4 &SetElement( int Row, int Column, real Value ); + inline matrix_4x4 & operator=(matrix_4x4 const & m); + +protected: + + enum do_not_initialize { DoNotInitialize }; + + inline matrix_4x4( do_not_initialize ); + + real aElements[4][4]; +}; + +/*---------------------------------------------------------------------------- + +view transform. + +*/ + +class view_transform : + public matrix_4x4 +{ +public: + + view_transform( point_4 const &Viewpoint, vector_4 const &ViewDirection, + vector_4 const &Up ); +}; + + +/*---------------------------------------------------------------------------- + +inline function definitions. + +*/ + + +inline vector_4 operator-( point_4 const &Operand1, point_4 const &Operand2 ) +{ + return vector_4(Operand1.GetX() - Operand2.GetX(), + Operand1.GetY() - Operand2.GetY(), + Operand1.GetZ() - Operand2.GetZ()); +} + +inline vector_4 operator+( vector_4 const &Operand1, + vector_4 const &Operand2 ) +{ + return vector_4(Operand1.GetX() + Operand2.GetX(), + Operand1.GetY() + Operand2.GetY(), + Operand1.GetZ() + Operand2.GetZ()); +} + +inline vector_4 operator-( vector_4 const &Operand1, + vector_4 const &Operand2 ) +{ + return vector_4(Operand1.GetX() - Operand2.GetX(), + Operand1.GetY() - Operand2.GetY(), + Operand1.GetZ() - Operand2.GetZ()); +} + +inline vector_4 operator-( vector_4 const &Operand1 ) +{ + return vector_4(-Operand1.GetX(),-Operand1.GetY(),-Operand1.GetZ()); +} + +inline vector_4 operator*( vector_4 const &Multiplicand, + real const &Multiplier ) +{ + return vector_4(Multiplicand.GetX() * Multiplier, + Multiplicand.GetY() * Multiplier, + Multiplicand.GetZ() * Multiplier); +} + +inline vector_4 operator*( real const &Multiplier, + vector_4 const &Multiplicand ) +{ + return vector_4(Multiplicand.GetX() * Multiplier, + Multiplicand.GetY() * Multiplier, + Multiplicand.GetZ() * Multiplier); +} + +inline point_4 operator+( point_4 const &Operand1, vector_4 const &Operand2 ) +{ + return point_4(Operand1.GetX() + Operand2.GetX(), + Operand1.GetY() + Operand2.GetY(), + Operand1.GetZ() + Operand2.GetZ()); +} + +inline point_4 operator-( point_4 const &Operand1, vector_4 const &Operand2 ) +{ + return point_4(Operand1.GetX() - Operand2.GetX(), + Operand1.GetY() - Operand2.GetY(), + Operand1.GetZ() - Operand2.GetZ()); +} + +inline point_4 operator+( vector_4 const &Operand1, point_4 const &Operand2 ) +{ + return Operand2 + Operand1; +} + +inline vector_4 CrossProduct( vector_4 const &Operand1, + vector_4 const &Operand2 ) +{ + real X = Operand1.GetY() * Operand2.GetZ() - + Operand1.GetZ() * Operand2.GetY(); + real Y = Operand1.GetZ() * Operand2.GetX() - + Operand1.GetX() * Operand2.GetZ(); + real Z = Operand1.GetX() * Operand2.GetY() - + Operand1.GetY() * Operand2.GetX(); + + return vector_4(X,Y,Z); +} + +inline real DotProduct( vector_4 const &Operand1, vector_4 const &Operand2 ) +{ + return Operand1.GetX() * Operand2.GetX() + + Operand1.GetY() * Operand2.GetY() + + Operand1.GetZ() * Operand2.GetZ(); +} + + +inline real quadruple::GetElement( int Row ) const +{ + return aElements[Row]; +} + +inline real quadruple::GetX( void ) const +{ + return aElements[0]; +} + +inline real quadruple::GetY( void ) const +{ + return aElements[1]; +} + +inline real quadruple::GetZ( void ) const +{ + return aElements[2]; +} + +inline real quadruple::GetW( void ) const +{ + return aElements[3]; +} + +inline void quadruple::SetElement( int Row, real Value ) +{ + aElements[Row] = Value; +} + +inline void quadruple::SetX( real Value ) +{ + aElements[0] = Value; +} + +inline void quadruple::SetY( real Value ) +{ + aElements[1] = Value; +} + +inline void quadruple::SetZ( real Value ) +{ + aElements[2] = Value; +} + +inline void quadruple::SetW( real Value ) +{ + aElements[3] = Value; +} + +inline void point_4::Homogenize( void ) +{ + aElements[0] = aElements[0] / aElements[3]; + aElements[1] = aElements[1] / aElements[3]; + aElements[2] = aElements[2] / aElements[3]; +} + +inline quadruple::quadruple( void ) +{ + aElements[0] = aElements[1] = aElements[2] = aElements[3] = 0; +} + +inline quadruple::quadruple( real X, real Y, real Z, real W ) +{ + aElements[0] = X; + aElements[1] = Y; + aElements[2] = Z; + aElements[3] = W; +} + +inline quadruple::quadruple( quadruple const &Source ) +{ + aElements[0] = Source.aElements[0]; + aElements[1] = Source.aElements[1]; + aElements[2] = Source.aElements[2]; + aElements[3] = Source.aElements[3]; +} + +inline quadruple &quadruple::operator=( quadruple const &Source ) +{ + aElements[0] = Source.aElements[0]; + aElements[1] = Source.aElements[1]; + aElements[2] = Source.aElements[2]; + aElements[3] = Source.aElements[3]; + + return *this; +} + +inline point_4::point_4( void ) : + quadruple(0,0,0,1) +{ + +} + +inline point_4::point_4( real X, real Y, real Z ) : + quadruple(X,Y,Z,1) +{ +#if 0 + char aBuffer[100]; + sprintf(aBuffer,"X: %f Y: %f Z: %f",X,Y,Z); + MessageBox(0,aBuffer,"foobar",MB_OK); + sprintf(aBuffer,"X: %f Y: %f Z: %f W:%f",aElements[0],aElements[1], + aElements[2],aElements[3]); + MessageBox(0,aBuffer,"foobar",MB_OK); +#endif +} + +inline vector_4::vector_4( void ) : + quadruple(0,0,0,0) +{ + +} + +inline vector_4::vector_4( real X, real Y, real Z ) : + quadruple(X,Y,Z,0) +{ + +} + +inline real matrix_4x4::GetElement( int Row, int Column ) const +{ + return aElements[Row][Column]; +} + +inline matrix_4x4 &matrix_4x4::SetElement( int Row, int Column, real Value ) +{ + aElements[Row][Column] = Value; + + return *this; +} + +inline matrix_4x4::matrix_4x4( do_not_initialize ) +{ + +} + +inline matrix_4x4 & matrix_4x4::operator=(matrix_4x4 const & m) +{ + memcpy((void *) aElements, (void *) m.aElements,sizeof(aElements)); + return *this; +} +#endif diff --git a/sdk/samples/flip2d/fixed.h b/sdk/samples/flip2d/fixed.h new file mode 100644 index 0000000..9d05b7b --- /dev/null +++ b/sdk/samples/flip2d/fixed.h @@ -0,0 +1,42 @@ +/************************************************************************** + + Fixed.h - 16.16 Fixed point class + + **************************************************************************/ + +inline long fixed_mul(long a, long b) {return MulDiv(a, b, 65536);} +inline long fixed_div(long a, long b) {return MulDiv(a, 65536, b);} + +class Fixed { + private: + long fx; + public: + Fixed() {} + ~Fixed() {} + + Fixed(long l) {fx = l<<16;} + Fixed(int i) {fx = (long)i<<16;} + Fixed(double d) {fx = (long)(d * 65536.0);} + + int Int() {return (int)(fx >> 16);} + int Frac() {return (int)(fx & 0xFFFF);} + + operator int() {return (int)(fx >> 16);} + operator double() {return (double)fx / 65536.0;} + + Fixed operator +(Fixed a) {Fixed c; c.fx = fx + a.fx; return c;} + Fixed operator -(Fixed a) {Fixed c; c.fx = fx - a.fx; return c;} + Fixed operator *(Fixed a) {Fixed c; c.fx = fixed_mul(fx,a.fx); return c;} + Fixed operator /(Fixed a) {Fixed c; c.fx = fixed_div(fx,a.fx); return c;} + + int operator <(Fixed a) {return fx < a.fx;} + int operator >(Fixed a) {return fx > a.fx;} + int operator ==(Fixed a) {return fx == a.fx;} + int operator !=(Fixed a) {return fx != a.fx;} + +// Fixed& operator =(Fixed a) {fx = a.fx; return *this;} + Fixed& operator +=(Fixed a) {fx += a.fx; return *this;} + Fixed& operator -=(Fixed a) {fx -= a.fx; return *this;} + Fixed& operator *=(Fixed a) {fx = fixed_mul(fx,a.fx); return *this;} + Fixed& operator /=(Fixed a) {fx = fixed_div(fx,a.fx); return *this;} +}; diff --git a/sdk/samples/flip2d/flipcube.cpp b/sdk/samples/flip2d/flipcube.cpp new file mode 100644 index 0000000..41b0850 --- /dev/null +++ b/sdk/samples/flip2d/flipcube.cpp @@ -0,0 +1,1144 @@ +/************************************************************************** + + FLIPCUBE.CPP - A spinning cube demo for DirectDraw + + basic page fliping app, just render to the back buffer and flip + that is all I do. + + **************************************************************************/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + **************************************************************************/ + +#define INITGUID + +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <ddraw.h> +#include <dinput.h> +#include <math.h> + +#include "flipcube.h" +#include "dumb3d.h" + +// code is in tri.cpp +extern void Triangle8(BYTE *p, int next_scan, POINT P0, POINT P1, POINT P2, DWORD c); + +/************************************************************************** + Global Variables + **************************************************************************/ + +static char szAppName[]="DirectDraw Spinning Cube"; + +static HINSTANCE hInstApp; +static BOOL fAppActive; +static BOOL fAppPaused; +static HWND hwndApp; +static HACCEL hAccelApp; +static HFONT AppFont; +static SIZE ScreenSize; +static BOOL fDrawWithGDI; + +/************************************************************************** + DirectDraw Globals + **************************************************************************/ + +IDirectDraw *dd; +IDirectDrawSurface *FrontBuffer; +IDirectDrawSurface *BackBuffer; +IDirectDrawPalette *Palette; + +/************************************************************************** + DirectInput Globals + **************************************************************************/ +LPDIRECTINPUT lpdi; +LPDIRECTINPUTDEVICE lpdiZoom; // Used for zooming +LPDIRECTINPUTDEVICE lpdiRot; // Use for rotation +BOOL fMouseAcquired = FALSE; // Acquired for rot'n + +/************************************************************************** + dumb 3D Globals + **************************************************************************/ + +//*** Cube vertices, normals, shades, and modeling transform +static point_4 CubeVertices[8] = +{ + point_4( -10, 10, -10 ), + point_4( -10, 10, 10 ), + point_4( 10, 10, 10 ), + point_4( 10, 10, -10 ), + point_4( 10, -10, -10 ), + point_4( 10, -10, 10 ), + point_4( -10, -10, 10 ), + point_4( -10, -10, -10 ) +}; +static vector_4 CubeSurfaceNormals[6]; +static real CubeSurfaceShades[6]; +static matrix_4x4 CubeTransform; + +//*** Cube edges - ordered indices into the vertex array +const int CubeFaces[6][4] = +{ + 0, 1, 2, 3, + 2, 1, 6, 5, + 3, 2, 5, 4, + 0, 3, 4, 7, + 1, 0, 7, 6, + 4, 5, 6, 7 +}; + +//*** Cube colors - one RGB color per surface +const unsigned char CubeColors[6][3] = +{ + 240, 20, 20, // Unsaturated Red + 20, 240, 20, // Unsaturated Green + 20, 20, 240, // Unsaturated Blue + 128, 64, 0, // Brown + 240, 20, 240, // Unsaturated Magenta + 240, 240, 20 // Unsaturated Yellow +}; + +//*** Lighting +vector_4 LightSourceDirection; +const real AmbientLight = 0.2; + +//*** Viewing and perspective +static matrix_4x4 ViewPerspective; +static point_4 Viewpoint(60, 60, 60); +static vector_4 Up(0, 1, 0); +static point_4 Origin; + +/************************************************************************** + Internal function declarations + **************************************************************************/ + +LONG CALLBACK AppWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam); +BOOL InitDInput(void); +BOOL AppIdle(void); +void RenderFrame(void); + +void TransformCube(matrix_4x4 const &Transform); +BOOL ProjectAndDrawCube(HDC hdc, int XOffset, int YOffset); +BOOL ProjectAndDrawCube(IDirectDrawSurface *pdds, int XOffset, int YOffset); + +/************************************************************************** + AppAbout + + Description: + This function handles messages belonging to the "About" dialog box. + The only message that it looks for is WM_COMMAND, indicating the user + has pressed the "OK" button. + **************************************************************************/ + +BOOL FAR PASCAL AppAbout(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +{ + switch (msg) + { + case WM_COMMAND: + if (LOWORD(wParam) == IDOK) + EndDialog(hwnd, TRUE); + break; + + case WM_INITDIALOG: + return TRUE; + } + return FALSE; +} + +/************************************************************************** + DDInit + + Description: + initialize all the DirectDraw specific stuff + **************************************************************************/ + +BOOL DDInit() +{ + HRESULT err; + + err = DirectDrawCreate(NULL, &dd, NULL); + + if (err != DD_OK) + return FALSE; + + err = dd->SetCooperativeLevel(hwndApp, + DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX); + + if (err != DD_OK) + return FALSE; + + // NEWNEW init DirectInput iff DDraw inits ok + if(!InitDInput()) + return FALSE; + + return TRUE; +} + +/************************************************************************** + CreateMouse + **************************************************************************/ + +BOOL CreateMouse(GUID &guid, LPDIRECTINPUTDEVICE& lpdiMouse, DWORD dwAccess) +{ + HRESULT err; + + err = lpdi->CreateDevice(guid, &lpdiMouse, NULL); + + if(err != DI_OK) + { + MessageBox(NULL, "Unable to Create DirectInput Mouse Device", + "DirectDraw Spinning Cube", MB_OK); + goto fail; + } + + // Tell DirectInput that we want to receive data in mouse format + err = lpdiMouse->SetDataFormat(&c_dfDIMouse); + + if(err != DI_OK) + { + MessageBox(NULL, "Unable to Access DirectInput Device as a mouse", + "DirectDraw Spinning Cube", MB_OK); + goto fail; + } + + // set desired access mode + err = lpdiMouse->SetCooperativeLevel(hwndApp, dwAccess); + if(err != DI_OK) + { + MessageBox(NULL, "Unable to set cooperativity level", + "DirectDraw Spinning Cube", MB_OK); + goto fail; + } + + return TRUE; + +fail:; + if (lpdiMouse) lpdiMouse->Release(), lpdiMouse = 0; + return FALSE; +} + +/************************************************************************** + InitDInput + **************************************************************************/ +BOOL InitDInput(void) +{ + HRESULT err; + GUID guid = GUID_SysMouse; + + err = DirectInputCreate(hInstApp, DIRECTINPUT_VERSION, &lpdi, NULL); + + if(err != DI_OK) + { + MessageBox(NULL, "Unable to Create DirectInput Object", + "DirectDraw Spinning Cube", MB_OK); + return FALSE; + } + + // Create a mouse for zooming. Zooming is done non-exclusively. + if (!CreateMouse(guid, lpdiZoom, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND)) + { + goto fail; + } + + if (fAppActive) lpdiZoom->Acquire(); + + // Create a mouse for rotation. Rotation is done exclusively. + if (!CreateMouse(guid, lpdiRot, DISCL_EXCLUSIVE | DISCL_FOREGROUND)) + { + goto fail; + } + + // if we get here, all DirectInput objects were created ok + return TRUE; + +fail: + if (lpdiZoom) lpdiZoom->Release(), lpdiZoom = NULL; + if (lpdiRot) lpdiRot ->Release(), lpdiRot = NULL; + if (lpdi) lpdi ->Release(), lpdi = NULL; + return FALSE; + +} + + +/************************************************************************** + DDSetMode + **************************************************************************/ + +BOOL DDSetMode(int width, int height, int bpp) +{ + HRESULT err; + + err = dd->SetDisplayMode(width, height, bpp); + + if (err != DD_OK) + return FALSE; + + ScreenSize.cx = width; + ScreenSize.cy = height; + + // get rid of any previous surfaces. + if (BackBuffer) BackBuffer->Release(), BackBuffer = NULL; + if (FrontBuffer) FrontBuffer->Release(), FrontBuffer = NULL; + if (Palette) Palette->Release(), Palette = NULL; + + // + // Create surfaces + // + // what we want is a tripple buffered surface in video memory + // so we try to create this first. + // + // if we cant get a triple buffered surface, we try again + // for a double buffered surface (still must be in video memory) + // + // if we cant get a double buffered surface, we try for a double + // buffered surface not being specific about video memory, we will + // get back a main-memory surface, that work use HW page flipping + // but at least we run. + // + // NOTE you need to recreate the surfaces for a new display mode + // they wont work when/if the mode is changed. + // + DDSURFACEDESC ddsd; + + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.dwBackBufferCount = 2; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | + DDSCAPS_COMPLEX | + DDSCAPS_VIDEOMEMORY; + + // try to get a triple buffered video memory surface. + err = dd->CreateSurface(&ddsd, &FrontBuffer, NULL); + + if (err != DD_OK) + { + // try to get a double buffered video memory surface. + ddsd.dwBackBufferCount = 1; + err = dd->CreateSurface(&ddsd, &FrontBuffer, NULL); + } + + if (err != DD_OK) + { + // settle for a main memory surface. + ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; + err = dd->CreateSurface(&ddsd, &FrontBuffer, NULL); + } + + if (err != DD_OK) + return FALSE; + + // get a pointer to the back buffer + DDSCAPS caps; + caps.dwCaps = DDSCAPS_BACKBUFFER; + err = FrontBuffer->GetAttachedSurface(&caps, &BackBuffer); + + if (err != DD_OK) + return FALSE; + + // create a palette if we are in a paletized display mode. + // + // NOTE because we want to be able to show dialog boxs and + // use our menu, we leave the windows reserved colors as is + // so things dont look ugly. + // + // palette is setup like so: + // + // 10 windows system colors + // 64 red wash + // 64 grn wash + // 64 blu wash + // + PALETTEENTRY ape[256]; + HDC hdc = GetDC(NULL); + if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE) + { + // get the current windows colors. + GetSystemPaletteEntries(hdc, 0, 256, ape); + + // make a red, grn, and blu wash for our cube. + for (int i=0; i<64; i++) + { + ape[10+64*0+i].peRed = i * 255/63; + ape[10+64*0+i].peGreen = 0; + ape[10+64*0+i].peBlue = 0; + + ape[10+64*1+i].peRed = 0; + ape[10+64*1+i].peGreen = i * 255/63; + ape[10+64*1+i].peBlue = 0; + + ape[10+64*2+i].peRed = 0; + ape[10+64*2+i].peGreen = 0; + ape[10+64*2+i].peBlue = i * 255/63; + } + + // create the palette. + err = dd->CreatePalette(DDPCAPS_8BIT, ape, &Palette, NULL); + + if (err == DD_OK) + { + FrontBuffer->SetPalette(Palette); + } + } + ReleaseDC(NULL, hdc); + + if (AppFont) + DeleteObject(AppFont); + + 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"); + + return TRUE; +} + + +/************************************************************************** + DDTerm + **************************************************************************/ + +void DDTerm() +{ + if (BackBuffer) BackBuffer->Release(), BackBuffer = NULL; + if (FrontBuffer) FrontBuffer->Release(), FrontBuffer = NULL; + if (Palette) Palette->Release(), Palette = NULL; + if (dd) dd->Release(), dd = NULL; + if (lpdi) lpdi->Release(), lpdi = NULL; +} + +/************************************************************************** + ModeCallback + **************************************************************************/ + +HRESULT CALLBACK ModeCallback(LPDDSURFACEDESC pdds, LPVOID lParam) +{ + HMENU hmenu = (HMENU)lParam; + char ach[80]; + int n; + int width = pdds->dwWidth; + int height = pdds->dwHeight; + int bpp = pdds->ddpfPixelFormat.dwRGBBitCount; + + n = GetMenuItemCount(hmenu); + wsprintf(ach,"%dx%dx%d",width,height,bpp); + AppendMenu(hmenu,MF_STRING,MENU_MODE+n,ach); + + MENUITEMINFO mii; + + // pack the mode info into a DWORD and set the extra item data. + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_DATA; + mii.dwItemData = width | (height << 12) | (bpp << 24); + SetMenuItemInfo(hmenu, MENU_MODE+n, MF_BYCOMMAND, &mii); + + //return S_TRUE to stop enuming modes, S_FALSE to continue + return S_FALSE; +} + +/************************************************************************** + AppInit + + Description: + This is called when the application is first loaded. It initializes + all variables, registers the window class, and creates the main app + window. + **************************************************************************/ + +BOOL AppInit(HINSTANCE hInst,HINSTANCE hPrev,int sw,LPSTR szCmdLine) +{ + WNDCLASS cls; + + /* Save instance handle for DialogBoxes */ + hInstApp = hInst; + + if (!hPrev) + { + //*** Register a class for the main application window + cls.hCursor = LoadCursor(0,IDC_ARROW); + + //*** Just for fun, we'll draw our own spinning cube icon. + cls.hIcon = LoadIcon(hInst, "AppIcon"); + cls.lpszMenuName = "AppMenu"; + cls.lpszClassName = szAppName; + cls.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + cls.hInstance = hInst; + cls.style = CS_VREDRAW | CS_HREDRAW; + cls.lpfnWndProc = (WNDPROC)AppWndProc; + cls.cbClsExtra = 0; + cls.cbWndExtra = 0; + + if (!RegisterClass(&cls)) + return FALSE; + } + + hAccelApp = LoadAccelerators(hInst, "AppAccel"); + + //*** Set and normalize the light source + LightSourceDirection = vector_4(50, 30, -15); + LightSourceDirection.Normalize(); + + //*** Distance to view plane: + ViewPerspective.SetElement(3, 2, 1/300.0); + ViewPerspective.SetElement(3, 3, 0); + + //*** Viewport scaling - some arbitrary number like 3.5 will do + ViewPerspective.SetElement(0, 0, 3.5); + ViewPerspective.SetElement(1, 1, 3.5); + + //*** Calculate the initial normals and shades + TransformCube(CubeTransform); + + //*** Then generate an interesting rotation for the spin + CubeTransform.ConcatenateYRotation(6.0); + CubeTransform.ConcatenateXRotation(3.5); + CubeTransform.ConcatenateZRotation(2.0); + + hwndApp = CreateWindowEx( + WS_EX_APPWINDOW, + szAppName, // Class name + szAppName, // Caption + WS_POPUP | + WS_SYSMENU | + WS_CAPTION, + 0, 0, // Position + 640,480, // Size + 0, // Parent window (no parent) + 0, // use class menu + hInst, // handle to window instance + 0 // no params to pass on + ); + ShowWindow(hwndApp,sw); + UpdateWindow(hwndApp); + + if (!DDInit()) + return FALSE; + + // Enumerate all posible display modes, and stick them in our menu. + // we use the extra item DWORD of a menu item to store the mode info + HMENU hmenu = CreatePopupMenu(); + dd->EnumDisplayModes(0,NULL,(LPVOID)hmenu,ModeCallback); + AppendMenu(GetMenu(hwndApp),MF_POPUP,(UINT)hmenu,"Modes"); + + if (!DDSetMode(640,480,8) && + !DDSetMode(640,480,16)) + return FALSE; + + return TRUE; +} + +/************************************************************************** + WinMain + + Description: + The main procedure for the App. After initializing, it just goes + into a message-processing loop until it gets a WM_QUIT message. + **************************************************************************/ + +int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) +{ + MSG msg; + + //*** Call initialization procedure + if (!AppInit(hInst,hPrev,sw,szCmdLine)) + return FALSE; + + //*** Polling messages from event queue until quit + for (;;) + { + if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) + { + if (msg.message == WM_QUIT) + break; + + if (!hwndApp || !TranslateAccelerator(hwndApp, hAccelApp, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + else + { + if (AppIdle()) + WaitMessage(); + } + } + + DDTerm(); + return msg.wParam; +} + +/************************************************************************** + AppPause + + **************************************************************************/ + +void AppPause(BOOL f) +{ + if (f) + { + DDSCAPS caps; + FrontBuffer->GetCaps(&caps); + + // if we are in ModeX go back to a windows mode + // so we can see the menu or dialog box. + + if (caps.dwCaps & DDSCAPS_MODEX) + { + DDSetMode(640,480,8); + } + + // turn off rotation while paused + if (lpdiRot) lpdiRot->Unacquire(); + fMouseAcquired = FALSE; + + fAppPaused = TRUE; + dd->FlipToGDISurface(); + DrawMenuBar(hwndApp); + RedrawWindow(hwndApp, NULL, NULL, RDW_FRAME); + } + else + { + fAppPaused = FALSE; + + } +} + +/************************************************************************** + MagnifyCube + + Description: + Magnify the cube the indicated number of times. A negative number + makes it smaller. + **************************************************************************/ + +void MagnifyCube(double times) +{ + matrix_4x4 m; + double factor = pow(1.5, times); + m.SetElement(0,0,factor); + m.SetElement(1,1,factor); + m.SetElement(2,2,factor); + TransformCube(m); +} + +/************************************************************************** + AppIdle + + return TRUE if the app is idle + return FALSE if the app is not idle. + + Description: + **************************************************************************/ + +BOOL AppIdle() +{ + DIMOUSESTATE dims; + + //*** Spin while the app is active, lbutton is up, and spinning is on. + + //*** Spin while the app is iconized. + if (fAppActive && !fAppPaused) + { + //*** If the app is active, spin the cube and redraw + + // See if any zooming needs to be done. + if(lpdiZoom->GetDeviceState(sizeof(DIMOUSESTATE), &dims) == DI_OK) { + // 240 units of motion in the Z-axis equals one unit of + // magnification / shrinkage. + if(dims.lZ) { + MagnifyCube(dims.lZ / 240.0); + } + } + + if(fMouseAcquired) + { + //** If we have the mouse acquired... + + // user spins cube if GetDeviceState succeeds and if the left button (button 0) is held + if(lpdiRot->GetDeviceState(sizeof(DIMOUSESTATE), &dims) == DI_OK) + { + if(dims.rgbButtons[0] & 0x80) + { + if(dims.lX || dims.lY) + { + matrix_4x4 Movement; + Movement.ConcatenateYRotation(dims.lX); + Movement.ConcatenateXRotation(dims.lY); + TransformCube(Movement); + } + + } + else + { + // unacquire the mouse + lpdiRot->Unacquire(); + fMouseAcquired = FALSE; + } + } + } + else + { + TransformCube(CubeTransform); + } + RenderFrame(); + return FALSE; + } + else + { + //*** Don't do anything when not the active app + return TRUE; + } +} + +/************************************************************************** + RenderFrame + + render the frame into the back buffer and do a page flip. + + things to NOTE: + + we use the blter to clear the backbuffer, this usualy is a big + win blters are real fast. + + we use GDI to draw the frame rate, and info text + + we either use GDI to draw the faces of the cube, or our own code + based on the fDrawWithGDI global variable. + + **************************************************************************/ + +int FrameRate; +int FrameCount; +int FrameCount0; +DWORD FrameTime; +DWORD FrameTime0; + +void RenderFrame() +{ + HDC hdc; + + //*** always need to handle DDERR_SURFACELOST, this will happen + //*** when we get switched away from. + + if (FrontBuffer->IsLost() == DDERR_SURFACELOST) + FrontBuffer->Restore(); + + //*** use the blter to do a color fill to clear the back buffer + + DDBLTFX ddbltfx; + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = 0; + BackBuffer->Blt(NULL,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&ddbltfx); + + //*** based on the fDrawWithGDI global variable, we either + //*** render the polygons ourself or let GDI do it + + BOOL fGDI = fDrawWithGDI; + + //*** render the cube with our own code. + //*** we need to do this outside of the GetDC, because we cant + //*** lock a buffer while we have a DC on it. + //*** if ProjectAndDrawCube returns FALSE it did not want to + //*** draw for some reason, so go ahead and use GDI + + if (!fGDI) + fGDI = !ProjectAndDrawCube(BackBuffer, ScreenSize.cx/2, ScreenSize.cy/2); + + if (BackBuffer->GetDC(&hdc) == DD_OK) + { + //*** use GDI to draw the cube. + if (fGDI) + ProjectAndDrawCube(hdc, ScreenSize.cx/2, ScreenSize.cy/2); + + //*** draw stats, like frame number and frame rate + + char ach[128]; + int len; + static char szHelp[] = "F10=Menu F7=Smaller F8=Larger"; + + SetBkMode(hdc, TRANSPARENT); + SelectObject(hdc, AppFont); + + len = wsprintf(ach, "FPS %02d Frame %05d", FrameRate, FrameCount); + + SetTextColor(hdc, RGB(255, 255, 0)); + TextOut(hdc, 0, 0, ach, len); + TextOut(hdc, 0, ScreenSize.cy-(ScreenSize.cx<640 ? 24:48),szHelp,sizeof(szHelp)-1); + + BackBuffer->ReleaseDC(hdc); + } + + //*** we have rendered the backbuffer, call flip so we can see it + FrontBuffer->Flip(NULL, DDFLIP_WAIT); + + FrameCount++; + FrameTime = timeGetTime(); + + if (FrameTime - FrameTime0 > 1000) + { + FrameRate = (FrameCount - FrameCount0) * 1000 / (FrameTime - FrameTime0); + FrameTime0 = FrameTime; + FrameCount0 = FrameCount; + } +} + +/************************************************************************** + AppWndProc + + Description: + Main window proc. Standard Windows fare. + **************************************************************************/ + +LONG CALLBACK AppWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +{ + RECT Rect; + + switch (msg) + { + case WM_CREATE: + break; + + case WM_ACTIVATEAPP: + //*** Keep track of whether or not the app is in the foreground + fAppActive = (BOOL)wParam; + // re-acquire the zooming controller when we are activated + if (fAppActive) { + if (lpdiZoom) lpdiZoom->Acquire(); + } else{ // unacquire everything if app is not active + if (lpdiZoom) lpdiZoom->Unacquire(); + if (lpdiRot) lpdiRot->Unacquire(); + fMouseAcquired = FALSE; + } + break; + + case WM_SETCURSOR: + if (fAppActive && !fAppPaused) + { + SetCursor(NULL); + return 1; + } + break; + + case WM_ENTERMENULOOP: + AppPause(TRUE); + break; + + case WM_EXITMENULOOP: + AppPause(FALSE); + break; + + case WM_INITMENUPOPUP: + CheckMenuItem((HMENU)wParam, MENU_GDI, fDrawWithGDI ? MF_CHECKED : MF_UNCHECKED); + break; + + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case MENU_ABOUT: + AppPause(TRUE); + DialogBox(hInstApp, "AppAbout", hwnd, (DLGPROC)AppAbout); + AppPause(FALSE); + break; + + case MENU_EXIT: + PostMessage(hwnd, WM_CLOSE, 0, 0L); + break; + + case MENU_LARGER: + MagnifyCube(+1.0); + break; + + case MENU_SMALLER: + MagnifyCube(-1.0); + break; + + case MENU_GDI: + fDrawWithGDI = !fDrawWithGDI; + break; + } + if (LOWORD(wParam) >= MENU_MODE && LOWORD(wParam) < MENU_MODE+100) + { + MENUITEMINFO mii; + + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_DATA; + GetMenuItemInfo(GetMenu(hwnd), LOWORD(wParam), MF_BYCOMMAND, &mii); + + DDSetMode( + (mii.dwItemData >> 0) & 0xFFF, + (mii.dwItemData >> 12) & 0xFFF, + (mii.dwItemData >> 24) & 0x0FF); + } + return 0L; + + case WM_DESTROY: + // clean up DirectInput objects + if (fMouseAcquired) lpdiRot->Unacquire(); + if (lpdiZoom) lpdiZoom->Release(), lpdiZoom = NULL; + if (lpdiRot) lpdiRot ->Release(), lpdiRot = NULL; + if (lpdi) lpdi ->Release(), lpdi = NULL; + + hwndApp = NULL; + PostQuitMessage(0); + break; + + case WM_PAINT: + break; + + case WM_MOVE: + case WM_SIZE: + case WM_DISPLAYCHANGE: + if (fAppActive && !IsIconic(hwnd)) + { + SetRect(&Rect, 0, GetSystemMetrics(SM_CYCAPTION), GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + AdjustWindowRectEx(&Rect, WS_POPUP | WS_CAPTION, FALSE, 0); + SetWindowPos(hwnd, NULL, Rect.left, Rect.top, Rect.right-Rect.left, Rect.bottom-Rect.top, SWP_NOACTIVATE | SWP_NOZORDER); + } + break; + + case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + case WM_MBUTTONDOWN: + if(lpdiRot->Acquire() == DI_OK) + { + fMouseAcquired = TRUE; + } + else + { + // not acquired, mouse will not do anything + } + break; + + } + + return DefWindowProc(hwnd,msg,wParam,lParam); +} + +/************************************************************************** + TransformCube + + Description: + Transforms the cube vertices by the current rotation matrix. + Recalculates normals and flat shade values for the + directional light source. + **************************************************************************/ + +void TransformCube(matrix_4x4 const &Transform) +{ + int i; + + //*** Transform the cube by the matrix + for (i = 0; i < 8; ++i) + CubeVertices[i] = Transform * CubeVertices[i]; + + //*** Recalculate normals and shades + for (i = 0; i < 6; ++i) + { + //*** Normals are perpendicular to two edges of the cube + vector_4 Edge1, Edge2; + Edge1 = CubeVertices[CubeFaces[i][1]] - CubeVertices[CubeFaces[i][0]]; + Edge2 = CubeVertices[CubeFaces[i][3]] - CubeVertices[CubeFaces[i][0]]; + CubeSurfaceNormals[i] = CrossProduct(Edge1, Edge2); + CubeSurfaceNormals[i].Normalize(); + + //*** Cosine shading based on the surface normal, clamped to [0, 1] + real Shade = DotProduct(CubeSurfaceNormals[i], LightSourceDirection); + Shade = Shade + AmbientLight; + if (Shade < 0) Shade = 0; + else if (Shade > 1.0) Shade = 1.0; + CubeSurfaceShades[i] = Shade; + } +} + +/************************************************************************** + ProjectAndDrawCube + + Description: + Projects the cube vertices for the current viewpoint then culls + in screen space and draws into the DC via GDI. + **************************************************************************/ + +BOOL ProjectAndDrawCube(HDC hdc, int XOffset, int YOffset) +{ + //*** Create a viewing transform for the current eye position + vector_4 ViewDirection = Origin - Viewpoint; + ViewDirection.Normalize(); + view_transform View(Viewpoint, ViewDirection, Up); + + //*** Transform and project the vertices into screen space + int i; + POINT aScreenVertices[8]; + for (i = 0; i < 8; ++i) + { + point_4 Temp = View * CubeVertices[i]; + Temp = ViewPerspective * Temp; + Temp.Homogenize(); + + aScreenVertices[i].x = (int)Temp.GetX() + XOffset; + aScreenVertices[i].y = (int)Temp.GetY() + YOffset; + } + + SelectPen(hdc, GetStockPen(NULL_PEN)); + + for (i = 0; i < 6; ++i) + { + //*** Standard culling operation based on the z value of the + //*** cross product of the edges: are the vertices oriented in the + //*** counterclockwise or clockwise direction? + real v1 = aScreenVertices[ CubeFaces[i][2] ].x - + aScreenVertices[ CubeFaces[i][1] ].x; + real w1 = aScreenVertices[ CubeFaces[i][0] ].x - + aScreenVertices[ CubeFaces[i][1] ].x; + real v2 = aScreenVertices[ CubeFaces[i][2] ].y - + aScreenVertices[ CubeFaces[i][1] ].y; + real w2 = aScreenVertices[ CubeFaces[i][0] ].y - + aScreenVertices[ CubeFaces[i][1] ].y; + if ((v1*w2 - v2*w1) <= 0) + continue; + + //*** Create a brush for the shaded face color using the selected dither + + HBRUSH hbr; + + //*** Get the shading colors + + int Red, Green, Blue; + + Red = (int)(CubeColors[i][0] * CubeSurfaceShades[i]); + Green = (int)(CubeColors[i][1] * CubeSurfaceShades[i]); + Blue = (int)(CubeColors[i][2] * CubeSurfaceShades[i]); + + //*** Create the dithered or PALETTERGB brush + + COLORREF cr; + + cr = RGB(Red, Green, Blue); + hbr = CreateSolidBrush(cr); + + //*** Collect the correct points in an array + POINT aQuadVertices[4]; + for (int j = 0; j < 4; ++j) + aQuadVertices[j] = aScreenVertices[ CubeFaces[i][j] ]; + + //*** Use GDI to draw the face + hbr = SelectBrush(hdc, hbr); + Polygon(hdc, aQuadVertices, 4); + hbr = SelectBrush(hdc, hbr); + DeleteObject(hbr); + } + + return TRUE; +} + +/************************************************************************** + ProjectAndDrawCube + + Description: + Projects the cube vertices for the current viewpoint then culls + in screen space and draws them into a DirectDrawSurface via custom code + **************************************************************************/ + +BOOL ProjectAndDrawCube(IDirectDrawSurface *pdds, int XOffset, int YOffset) +{ + //*** Lock the DirectDraw surface + DDSURFACEDESC ddsd; + ddsd.dwSize = sizeof(ddsd); + + if (pdds->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL) != DD_OK) + return FALSE; + + //*** This code only works for 8bpp + if (ddsd.ddpfPixelFormat.dwRGBBitCount != 8) + { + pdds->Unlock(NULL); + return FALSE; + } + + //*** Create a viewing transform for the current eye position + vector_4 ViewDirection = Origin - Viewpoint; + ViewDirection.Normalize(); + view_transform View(Viewpoint, ViewDirection, Up); + + //*** Transform and project the vertices into screen space + int i; + POINT aScreenVertices[8]; + for (i = 0; i < 8; ++i) + { + point_4 Temp = View * CubeVertices[i]; + Temp = ViewPerspective * Temp; + Temp.Homogenize(); + + aScreenVertices[i].x = (int)Temp.GetX() + XOffset; + aScreenVertices[i].y = (int)Temp.GetY() + YOffset; + + //*** !!! OUR CODE DOES NOT CLIP, SO FAIL IF WE NEED CLIPPING + if (aScreenVertices[i].x < 0 || aScreenVertices[i].x >= ScreenSize.cx || + aScreenVertices[i].y < 0 || aScreenVertices[i].y >= ScreenSize.cy) + { + pdds->Unlock(NULL); + return FALSE; + } + } + + for (i = 0; i < 6; ++i) + { + //*** Standard culling operation based on the z value of the + //*** cross product of the edges: are the vertices oriented in the + //*** counterclockwise or clockwise direction? + real v1 = aScreenVertices[ CubeFaces[i][2] ].x - + aScreenVertices[ CubeFaces[i][1] ].x; + real w1 = aScreenVertices[ CubeFaces[i][0] ].x - + aScreenVertices[ CubeFaces[i][1] ].x; + real v2 = aScreenVertices[ CubeFaces[i][2] ].y - + aScreenVertices[ CubeFaces[i][1] ].y; + real w2 = aScreenVertices[ CubeFaces[i][0] ].y - + aScreenVertices[ CubeFaces[i][1] ].y; + if ((v1*w2 - v2*w1) <= 0) + continue; + + //*** Get the shading color, palette is setup like so: + //*** 10 system, 64 red, 64 green, 64 blue + + BYTE color; + + if (CubeColors[i][0] >= 128) + color = (BYTE)(10 + 0*64 + (63 * CubeSurfaceShades[i])); + else if (CubeColors[i][1] >= 128) + color = (BYTE)(10 + 1*64 + (63 * CubeSurfaceShades[i])); + else + color = (BYTE)(10 + 2*64 + (63 * CubeSurfaceShades[i])); + + //*** Use code in tri.cpp draw the face + + Triangle8((BYTE*)ddsd.lpSurface, ddsd.lPitch, + aScreenVertices[CubeFaces[i][0]], + aScreenVertices[CubeFaces[i][1]], + aScreenVertices[CubeFaces[i][2]], + color); + + Triangle8((BYTE*)ddsd.lpSurface, ddsd.lPitch, + aScreenVertices[CubeFaces[i][2]], + aScreenVertices[CubeFaces[i][3]], + aScreenVertices[CubeFaces[i][0]], + color); + } + + //*** Never ever forget to unlock! + pdds->Unlock(NULL); + return TRUE; +} diff --git a/sdk/samples/flip2d/flipcube.h b/sdk/samples/flip2d/flipcube.h new file mode 100644 index 0000000..4ab19cb --- /dev/null +++ b/sdk/samples/flip2d/flipcube.h @@ -0,0 +1,26 @@ +/************************************************************************** + + FLIPCUBE.H - A spinning cube demo for WinG + + **************************************************************************/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + **************************************************************************/ + +/* Menu Items */ +#define MENU_ABOUT 1 +#define MENU_EXIT 2 +#define MENU_SPIN 3 +#define MENU_LARGER 4 +#define MENU_SMALLER 5 +#define MENU_GDI 6 + +#define MENU_MODE 100 diff --git a/sdk/samples/flip2d/flipcube.ico b/sdk/samples/flip2d/flipcube.ico new file mode 100644 index 0000000..e7735fd Binary files /dev/null and b/sdk/samples/flip2d/flipcube.ico differ diff --git a/sdk/samples/flip2d/flipcube.rc b/sdk/samples/flip2d/flipcube.rc new file mode 100644 index 0000000..ca265a7 --- /dev/null +++ b/sdk/samples/flip2d/flipcube.rc @@ -0,0 +1,54 @@ +/************************************************************************** + + FLIPCUBE.RC - A spinning cube demo for DirectDraw + + **************************************************************************/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + **************************************************************************/ + +#include <windows.h> +#include "flipcube.h" + +AppIcon ICON flipcube.ico + +AppAccel ACCELERATORS DISCARDABLE +BEGIN + VK_ESCAPE, MENU_EXIT, VIRTKEY,NOINVERT + VK_F12, MENU_EXIT, VIRTKEY,NOINVERT + VK_F1, MENU_ABOUT, VIRTKEY,NOINVERT + VK_F3, MENU_SPIN, VIRTKEY,NOINVERT + VK_F7, MENU_SMALLER, VIRTKEY,NOINVERT + VK_F8, MENU_LARGER, VIRTKEY,NOINVERT + VK_F9, MENU_GDI, VIRTKEY,NOINVERT +END + +AppAbout DIALOG DISCARDABLE 22, 17, 144, 75 +STYLE DS_MODALFRAME | WS_POPUP +BEGIN + CTEXT "DirectDraw Spinning Cube Demo",-1,25,6,93,8 + CTEXT "Copyright (c) 1995-1996 Microsoft Corp.",-1,5,47,132,9 + ICON "AppIcon",-1,62,20,18,20 + DEFPUSHBUTTON "OK",IDOK,55,59,32,14,WS_GROUP +END + +AppMenu menu +begin + POPUP "&Cube" + begin + MENUITEM "&Larger\tF7", MENU_LARGER + MENUITEM "&Smaller\tF8", MENU_SMALLER + MENUITEM "Draw with &GDI\tF9", MENU_GDI + MENUITEM SEPARATOR + MENUITEM "&About...\tF1", MENU_ABOUT + MENUITEM "E&xit\tF12", MENU_EXIT + end +end diff --git a/sdk/samples/flip2d/makefile b/sdk/samples/flip2d/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/flip2d/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/flip2d/msvc.mk b/sdk/samples/flip2d/msvc.mk new file mode 100644 index 0000000..dd25d6d --- /dev/null +++ b/sdk/samples/flip2d/msvc.mk @@ -0,0 +1,41 @@ +NAME = Flipcube +TARGET = Flip2D +EXT = exe + +GOALS = $(TARGET).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib dinput.lib + +OBJS = flipcube.obj dumb3d.obj tri.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(TARGET).$(EXT): \ + $(OBJS) $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(TARGET).$(EXT) +-map:$(TARGET).map +-machine:i386 +-subsystem:windows,4.0 +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/flip2d/readme.txt b/sdk/samples/flip2d/readme.txt new file mode 100644 index 0000000..fe08131 --- /dev/null +++ b/sdk/samples/flip2d/readme.txt @@ -0,0 +1,3 @@ +Basic demonstration of DirectDraw page flipping. Renders a spinning cube +to the back buffer, then flips. + diff --git a/sdk/samples/flip2d/tri.cpp b/sdk/samples/flip2d/tri.cpp new file mode 100644 index 0000000..b0fc22c --- /dev/null +++ b/sdk/samples/flip2d/tri.cpp @@ -0,0 +1,190 @@ +/************************************************************************** + + TRI.CPP - Simple triangle rasterizer + + **************************************************************************/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + **************************************************************************/ + +#include <windows.h> +#include "Fixed.h" + +#define SWAP(x,y) ((x)^=(y)^=(x)^=(y)) +//SWAP has a compiler generated problem on alpha.... do it the old fashioned way: +#define SWAPPT(a,b) {POINT p; p=a;a=b;b=p;} //(SWAP(a.y,b.y), SWAP(a.x,b.x)) + +/************************************************************************** + + FillScan8 + + fill a scan from x0 to x1 (inclusive) with color c + + does optimal DWORD writes, making sure to stay aligned so + it is safe for video memory. + + **************************************************************************/ +inline void FillScan8(BYTE *p, int x0, int x1, DWORD c) +{ + int dx; + int z; + + dx = x1-x0+1; + p += x0; + + if (dx > 4) + { + if (z = (DWORD)p & 0x03) + { + while (z++ < 4) + { + *p++ = (BYTE)c; + dx--; + } + } + + while (dx >= 4) + { + *((DWORD*)p) = c; + p += 4; + dx -= 4; + } + } + + while (dx-- > 0) + { + *p++ = (BYTE)c; + } +} + +/************************************************************************** + + Triangle8 + + rasterize a solid color triangle into a 8bpp memory buffer. + + NOTE this code does no clipping you better pass + + rasterizes a solid color triangle into a memory buffer with any pitch + also is careful to always write DWORD aligned, so it is safe to be + used on video memory (and faster too...) + + **************************************************************************/ + +void Triangle8(BYTE *p, int next_scan, POINT P0, POINT P1, POINT P2, DWORD c) +{ + Fixed d,d0; + Fixed x,x0; + int y; + + // + // expand the color to a DWORD + // + c |= c<<8; + c |= c<<16; + + // + // sort points so P0.y <= P1.y <= P2.y + // + if (P0.y > P1.y) SWAPPT(P0,P1); + if (P1.y > P2.y) SWAPPT(P1,P2); + if (P0.y > P1.y) SWAPPT(P0,P1); + + // + // check for quick out? + // + if (P2.y - P0.y == 0) + { + return; + } + + // + // compute "long" side walk from P0 to P2 + // + d = (Fixed)(P2.x - P0.x) / (Fixed)(P2.y - P0.y); + + x = P0.x; + y = P0.y; + p += P0.y * next_scan; // point p to correct scan. + + // + // do the top + // + if (P0.y < P1.y) + { + d0 = (Fixed)(P1.x - P0.x) / (Fixed)(P1.y - P0.y); + x0 = P0.x; + + // + // check for left or right fill + // + if (d < d0) + { + while (y < P1.y) + { + FillScan8(p, x, x0, c); + y++; + p += next_scan; + x += d; + x0 += d0; + } + } + else + { + while (y < P1.y) + { + FillScan8(p, x0, x, c); + y++; + p += next_scan; + x += d; + x0 += d0; + } + } + } + + // + // do the bottom. + // + + if (P2.y - P1.y == 0) + { + return; + } + + d0 = (Fixed)(P2.x - P1.x) / (Fixed)(P2.y - P1.y); + x0 = P1.x; + + // + // check for left or right fill + // + if (x < x0) + { + while (y < P2.y) + { + FillScan8(p, x, x0, c); + y++; + p += next_scan; + x += d; + x0 += d0; + } + } + else + { + while (y < P2.y) + { + FillScan8(p, x0, x, c); + y++; + p += next_scan; + x += d; + x0 += d0; + } + } +} diff --git a/sdk/samples/flipcube/flipcube.c b/sdk/samples/flipcube/flipcube.c new file mode 100644 index 0000000..3d39963 --- /dev/null +++ b/sdk/samples/flipcube/flipcube.c @@ -0,0 +1,587 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: flipcube.c + * + * Mouse controls: Left-click stops cube rotating. Holding down left mouse + * button and moving mouse moves cube. Right-click resumes rotating. + * + ***************************************************************************/ + +#include <windows.h> +#include <windowsx.h> +#include <math.h> +#include <malloc.h> +#include "d3ddemo.h" + +BOOL KeyboardHandler(UINT message, WPARAM wParam, LPARAM lParam); +BOOL MouseHandler(UINT message, WPARAM wParam, LPARAM lParam); +void ConcatenateXRotation(LPD3DMATRIX lpM, float Degrees ); +void ConcatenateYRotation(LPD3DMATRIX lpM, float Degrees ); +void ConcatenateZRotation(LPD3DMATRIX lpM, float Degrees ); + +//*** Cube colors - one RGB color per material +const D3DCOLOR MaterialColors[6][2] = +{ + RGBA_MAKE(240, 20, 20, 255), // Unsaturated Red + RGB_MAKE (240, 20, 20), // Unsaturated Red + RGBA_MAKE( 20, 240, 20, 255), // Unsaturated Green + RGB_MAKE ( 20, 240, 20), // Unsaturated Green + RGBA_MAKE( 20, 20, 240, 255), // Unsaturated Blue + RGB_MAKE ( 20, 20, 240), // Unsaturated Blue + RGBA_MAKE(128, 64, 0, 255), // Brown + RGB_MAKE (128, 64, 0), // Brown + RGBA_MAKE(240, 20, 240, 255), // Unsaturated Magenta + RGB_MAKE (240, 20, 240), // Unsaturated Magenta + RGBA_MAKE(240, 240, 20, 255), // Unsaturated Yellow + RGB_MAKE (240, 240, 20), // Unsaturated Yellow +}; + +//*** Lighting +const D3DCOLOR AmbientColor = RGBA_MAKE(20, 20, 20, 20); +LPDIRECT3DLIGHT lpD3DLight; + +//*** Viewing and perspective +D3DMATRIXHANDLE hProj, hView, hWorld; +D3DMATRIX proj = { + D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(-1.0), D3DVAL(0.0) +}; +D3DMATRIX view = { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(10.0), D3DVAL(1.0) +}; +D3DMATRIX identity = { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0) +}; +D3DMATRIX world, spin; + +//*** Execute buffer +static D3DEXECUTEDATA d3dExData; +static LPDIRECT3DEXECUTEBUFFER lpD3DExBuf; +static D3DEXECUTEBUFFERDESC debDesc; + +//*** Interaction +static POINT Move; +static POINT Last; + +/* + * A structure which holds the object's data + */ + +LPDIRECT3DMATERIAL lpBackgroundMaterial; +LPDIRECT3DMATERIAL lpD3DMaterial[6]; +D3DMATERIALHANDLE D3DMaterialHandle[6]; +/* Cube vertices, normals, shades, and modeling transform */ +int NumVertices = 24; +static D3DVERTEX CubeVertices[] = { + {D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(0.0) }, + {D3DVAL(1.0),D3DVAL(1.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(1.0) }, + {D3DVAL(1.0),D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(1.0) }, + {D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(0.0) }, + + {D3DVAL(1.0),D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(0.0) }, + {D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(1.0) }, + {D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(1.0) }, + {D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(0.0) }, + + {D3DVAL(1.0),D3DVAL(1.0),D3DVAL(1.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(0.0) }, + {D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(1.0) }, + {D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(1.0) }, + {D3DVAL(1.0),D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(0.0) }, + + {D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(1.0),D3DVAL(0.0) }, + {D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(1.0),D3DVAL(1.0) }, + {D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(1.0) }, + {D3DVAL(1.0),D3DVAL(1.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(0.0) }, + + {D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(1.0) }, + {D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(1.0) }, + {D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(0.0) }, + {D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(0.0) }, + + {D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(1.0) }, + {D3DVAL(1.0),D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(1.0) }, + {D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(1.0),D3DVAL(0.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(0.0),D3DVAL(0.0) }, + {D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(-1.0),D3DVAL(0.0),D3DVAL(1.0),D3DVAL(0.0) } +}; + +//*** Cube edges - ordered indices into the vertex array +const int NumTri = 12; +const int CubeTri[] = { + 0, 1, 2, 0, 2, 3, + 4, 5, 6, 4, 6, 7, + 8, 9, 10, 8, 10, 11, + 12, 13, 14, 12, 14, 15, + 16, 17, 18, 16, 18, 19, + 20, 21, 22, 20, 22, 23 +}; + +void +OverrideDefaults(Defaults* defaults) +{ + lstrcpy(defaults->Name, "Flipcube D3D Example"); + defaults->rs.ShadeMode = D3DSHADE_FLAT; + defaults->rs.bZBufferOn = FALSE; + defaults->bTexturesDisabled = TRUE; +} + +BOOL +TickScene() +{ + if (GetAsyncKeyState(VK_LBUTTON) < 0) { + if(Move.x || Move.y) { + D3DMATRIX Movement; + Movement = identity; + ConcatenateYRotation(&Movement, (float)Move.x); + ConcatenateXRotation(&Movement, (float)Move.y); + Move.x = Move.y = 0; + MultiplyD3DMATRIX(&world, &world, &Movement); + } + } else { + MultiplyD3DMATRIX(&world, &spin, &world); + } + return TRUE; +} + +/* + * Each frame, renders the scene and calls mod_buffer to modify the object + * for the next frame. + */ +BOOL +RenderScene(LPDIRECT3DDEVICE lpDev, LPDIRECT3DVIEWPORT lpView, + LPD3DRECT lpExtent) +{ + /* + * Execute the instruction buffer + */ + if (lpDev->lpVtbl->SetMatrix(lpDev, hWorld, &world) != D3D_OK) + return FALSE; + if (lpDev->lpVtbl->BeginScene(lpDev) != D3D_OK) + return FALSE; + if (lpDev->lpVtbl->Execute(lpDev, lpD3DExBuf, + lpView, D3DEXECUTE_CLIPPED) != D3D_OK) + return FALSE; + if (lpDev->lpVtbl->EndScene(lpDev) != D3D_OK) + return FALSE; + if (lpD3DExBuf->lpVtbl->GetExecuteData(lpD3DExBuf, &d3dExData)!= D3D_OK) + return FALSE; + *lpExtent = d3dExData.dsStatus.drExtent; + if (!(TickScene())) + return FALSE; + return TRUE; +} + +void +InitSpin(void) +{ + spin = identity; + ConcatenateYRotation(&spin, D3DVAL(6.0)); + ConcatenateXRotation(&spin, D3DVAL(3.5)); + ConcatenateZRotation(&spin, D3DVAL(2.0)); +} + +BOOL +InitScene(void) +{ + world = identity; + InitSpin(); + if (!(SetKeyboardCallback(KeyboardHandler))) + return FALSE; + if (!(SetMouseCallback(MouseHandler))) + return FALSE; + return TRUE; +} + +void +ReleaseScene(void) +{ + +} + +/* + * Release the memory allocated for the scene and all D3D objects created. + */ +void +ReleaseView(LPDIRECT3DVIEWPORT lpView) +{ + int i; + if (lpView) + lpView->lpVtbl->DeleteLight(lpView, lpD3DLight); + RELEASE(lpD3DLight); + RELEASE(lpD3DExBuf); + + RELEASE(lpBackgroundMaterial); + for (i = 0; i < 6; i++) { + RELEASE(lpD3DMaterial[i]); + } +} + +/* + * Builds the scene and initializes the execute buffer for rendering. Returns 0 on failure. + */ +BOOL +InitView(LPDIRECTDRAW lpDD, LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpDev, + LPDIRECT3DVIEWPORT lpView, int NumTextures, + LPD3DTEXTUREHANDLE TextureHandle) +{ + D3DMATERIAL MaterialDesc; + D3DMATERIALHANDLE BackgroundHandle; + D3DLIGHT LightDesc; + LPDIRECT3DEXECUTEBUFFER lpD3DExCmdBuf; + LPVOID lpBufStart, lpInsStart, lpPointer; + DWORD size; + int i; + + for (i = 0; i < 6; i++) { + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpD3DMaterial[i], NULL) != D3D_OK) + return FALSE; + memset(&MaterialDesc, 0, sizeof(D3DMATERIAL)); + MaterialDesc.dwSize = sizeof(D3DMATERIAL); + MaterialDesc.diffuse.r = (D3DVALUE)(RGBA_GETRED(MaterialColors[i][0]) / 255.0); + MaterialDesc.diffuse.g = (D3DVALUE)(RGBA_GETGREEN(MaterialColors[i][0]) / 255.0); + MaterialDesc.diffuse.b = (D3DVALUE)(RGBA_GETBLUE(MaterialColors[i][0]) / 255.0); + MaterialDesc.diffuse.a = (D3DVALUE)(RGBA_GETALPHA(MaterialColors[i][0]) / 255.0); + MaterialDesc.ambient.r = (D3DVALUE)(RGBA_GETALPHA(MaterialColors[i][1]) / 255.0); + MaterialDesc.ambient.g = (D3DVALUE)(RGBA_GETALPHA(MaterialColors[i][1]) / 255.0); + MaterialDesc.ambient.b = (D3DVALUE)(RGBA_GETALPHA(MaterialColors[i][1]) / 255.0); + MaterialDesc.ambient.a = (D3DVALUE)(RGBA_GETALPHA(MaterialColors[i][1]) / 255.0); + MaterialDesc.specular.r = (D3DVALUE)1.0; + MaterialDesc.specular.g = (D3DVALUE)1.0; + MaterialDesc.specular.b = (D3DVALUE)1.0; + MaterialDesc.power = (float)20.0; + MaterialDesc.dwRampSize = 16; + MaterialDesc.hTexture = TextureHandle[1]; + lpD3DMaterial[i]->lpVtbl->SetMaterial(lpD3DMaterial[i], &MaterialDesc); + lpD3DMaterial[i]->lpVtbl->GetHandle(lpD3DMaterial[i], lpDev, + &D3DMaterialHandle[i]); + } + /* + * Set background to black material + */ + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpBackgroundMaterial, NULL) != D3D_OK) + return FALSE; + memset(&MaterialDesc, 0, sizeof(D3DMATERIAL)); + MaterialDesc.dwSize = sizeof(D3DMATERIAL); + MaterialDesc.dwRampSize = 1; + lpBackgroundMaterial->lpVtbl->SetMaterial(lpBackgroundMaterial, &MaterialDesc); + lpBackgroundMaterial->lpVtbl->GetHandle(lpBackgroundMaterial, lpDev, + &BackgroundHandle); + lpView->lpVtbl->SetBackground(lpView, BackgroundHandle); + /* + * Add one directional light. + */ + memset(&LightDesc, 0, sizeof(D3DLIGHT)); + LightDesc.dwSize = sizeof(D3DLIGHT); + LightDesc.dltType = D3DLIGHT_POINT; + LightDesc.dcvColor.r = D3DVAL(0.9); + LightDesc.dcvColor.g = D3DVAL(0.9); + LightDesc.dcvColor.b = D3DVAL(0.9); + LightDesc.dcvColor.a = D3DVAL(1.0); + LightDesc.dvPosition.x = D3DVALP(0.0, 12); + LightDesc.dvPosition.y = D3DVALP(0.0, 12); + LightDesc.dvPosition.z = D3DVALP(-12.0, 12); + LightDesc.dvAttenuation0 = D3DVAL(1.0); + LightDesc.dvAttenuation1 = D3DVAL(0.0); + LightDesc.dvAttenuation2 = D3DVAL(0.0); + +// LightDesc.type = D3DLIGHT_DIRECTIONAL; + LightDesc.dvDirection.x = D3DVALP(0.0, 12); + LightDesc.dvDirection.y = D3DVALP(0.0, 12); + LightDesc.dvDirection.z = D3DVALP(1.0, 12); + + if (lpD3D->lpVtbl->CreateLight(lpD3D, &lpD3DLight, NULL) != D3D_OK) + return FALSE; + if (lpD3DLight->lpVtbl->SetLight(lpD3DLight, &LightDesc) != D3D_OK) + return FALSE; + if (lpView->lpVtbl->AddLight(lpView, lpD3DLight) != D3D_OK) + return FALSE; + + /* + * Set the view, world and projection matrices + * Create a buffer for matrix set commands etc. + */ + MAKE_MATRIX(lpDev, hView, view); + MAKE_MATRIX(lpDev, hProj, proj); + MAKE_MATRIX(lpDev, hWorld, world); + size = 0; + size += sizeof(D3DINSTRUCTION) * 3; + size += sizeof(D3DSTATE) * 4; + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + if (lpDev->lpVtbl->CreateExecuteBuffer(lpDev, &debDesc, &lpD3DExCmdBuf, + NULL) != D3D_OK) + return FALSE; + + /* + * lock it so it can be filled + */ + if (lpD3DExCmdBuf->lpVtbl->Lock(lpD3DExCmdBuf, &debDesc) != D3D_OK) + return FALSE; + lpBufStart = debDesc.lpData; + memset(lpBufStart, 0, size); + lpPointer = lpBufStart; + + lpInsStart = lpPointer; + OP_STATE_TRANSFORM(3, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_PROJECTION, hProj, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_VIEW, hView, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_WORLD, hWorld, lpPointer); + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_AMBIENT, AmbientColor, lpPointer); + OP_EXIT(lpPointer); + + /* + * Setup the execute data describing the buffer + */ + lpD3DExCmdBuf->lpVtbl->Unlock(lpD3DExCmdBuf); + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwInstructionOffset = (ULONG) 0; + d3dExData.dwInstructionLength = (ULONG) ((char *)lpPointer - (char*)lpInsStart); + lpD3DExCmdBuf->lpVtbl->SetExecuteData(lpD3DExCmdBuf, &d3dExData); + lpDev->lpVtbl->BeginScene(lpDev); + lpDev->lpVtbl->Execute(lpDev, lpD3DExCmdBuf, lpView, D3DEXECUTE_UNCLIPPED); + lpDev->lpVtbl->EndScene(lpDev); + + /* + * We are done with the command buffer. + */ + lpD3DExCmdBuf->lpVtbl->Release(lpD3DExCmdBuf); + /* + * Create an execute buffer + */ + // calculate the size of the buffer + size = sizeof(D3DVERTEX) * NumVertices; + size += sizeof(D3DSTATUS) * 1; + size += sizeof(D3DPROCESSVERTICES) * 6; + size += sizeof(D3DINSTRUCTION) * 17; + size += sizeof(D3DSTATE) * 9; + size += sizeof(D3DTRIANGLE) * NumTri; + // Create an execute buffer + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + if (lpDev->lpVtbl->CreateExecuteBuffer(lpDev, &debDesc, &lpD3DExBuf, NULL) + != D3D_OK) + return FALSE; + if (lpD3DExBuf->lpVtbl->Lock(lpD3DExBuf, &debDesc) != D3D_OK) + return FALSE; + lpBufStart = debDesc.lpData; + memset(lpBufStart, 0, size); + lpPointer = lpBufStart; + + VERTEX_DATA(&CubeVertices[0], NumVertices, lpPointer); + + lpInsStart = lpPointer; + OP_SET_STATUS(D3DSETSTATUS_ALL, D3DSTATUS_DEFAULT, 2048, 2048, 0, 0, lpPointer); + for (i = 0; i < 6; i++) { + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_MATERIAL, D3DMaterialHandle[i], lpPointer); + OP_PROCESS_VERTICES(1, lpPointer); + PROCESSVERTICES_DATA(D3DPROCESSVERTICES_TRANSFORMLIGHT, i * 4, 4, lpPointer); + } + OP_STATE_RENDER(3, lpPointer); + STATE_DATA(D3DRENDERSTATE_TEXTUREHANDLE, TextureHandle[1], lpPointer); + STATE_DATA(D3DRENDERSTATE_WRAPU, FALSE, lpPointer); + STATE_DATA(D3DRENDERSTATE_WRAPV, FALSE, lpPointer); + /* + * Make sure that the triangle data (not OP) will be QWORD aligned + */ + if (QWORD_ALIGNED(lpPointer)) { + OP_NOP(lpPointer); + } + OP_TRIANGLE_LIST(NumTri, lpPointer); + for (i = 0; i < NumTri; i++) { + ((LPD3DTRIANGLE)lpPointer)->v1 = CubeTri[i*3]; + ((LPD3DTRIANGLE)lpPointer)->v2 = CubeTri[i*3 + 1]; + ((LPD3DTRIANGLE)lpPointer)->v3 = CubeTri[i*3 + 2]; + ((LPD3DTRIANGLE)lpPointer)->wFlags = D3DTRIFLAG_EDGEENABLETRIANGLE; + ((LPD3DTRIANGLE)lpPointer)++; + } + OP_EXIT(lpPointer); + /* + * Setup the execute data describing the buffer + */ + lpD3DExBuf->lpVtbl->Unlock(lpD3DExBuf); + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwVertexCount = NumVertices; + d3dExData.dwInstructionOffset = (ULONG)((char*)lpInsStart - (char*)lpBufStart); + d3dExData.dwInstructionLength = (ULONG)((char*)lpPointer - (char*)lpInsStart); + lpD3DExBuf->lpVtbl->SetExecuteData(lpD3DExBuf, &d3dExData); + + return TRUE; +} + +/**************************************************************************** + Keyboard and mouse handlers + ****************************************************************************/ + +BOOL CDECL +KeyboardHandler(UINT message, WPARAM wParam, LPARAM lParam) { + D3DMATRIX m; + if (message == WM_KEYDOWN) { + if ((int)wParam == VK_F11) { + m = identity; + m._11 = D3DVAL(1.5); + m._22 = D3DVAL(1.5); + m._33 = D3DVAL(1.5); + MultiplyD3DMATRIX(&world, &world, &m); + return TRUE; + } else if ((int)wParam == VK_F12) { + m = identity; + m._11 = D3DVAL(0.9); + m._22 = D3DVAL(0.9); + m._33 = D3DVAL(0.9); + MultiplyD3DMATRIX(&world, &world, &m); + return TRUE; + } + } + return FALSE; +} + +BOOL CDECL +MouseHandler(UINT message, WPARAM wParam, LPARAM lParam) { + if (message == WM_LBUTTONDOWN) { + /* Get the start location for mouse rotations */ + spin = identity; + Last.x = LOWORD(lParam); + Last.y = HIWORD(lParam); + return TRUE; + } else if (message == WM_RBUTTONDOWN) { + /* start spinning again */ + InitSpin(); + return TRUE; + } else if (message == WM_MOUSEMOVE) { + /* While the mouse button is down, keep track of movement + * to update the eye position + */ + if(GetKeyState(VK_LBUTTON) < 0) { + Move.x = (int)LOWORD(lParam) - Last.x; + Move.y = (int)HIWORD(lParam) - Last.y; + Last.x = LOWORD(lParam); + Last.y = HIWORD(lParam); + return TRUE; + } + } + return FALSE; +} + +/************************************************************************** + TransformCube + + Description: + Multiplies the world matrix by the given transform matrix + **************************************************************************/ + +/***************************************************************************** + Rotatations + *****************************************************************************/ +#define M_PI 3.14159265358979323846 +void +ConcatenateXRotation(LPD3DMATRIX lpM, float Degrees ) +{ + float Temp01, Temp11, Temp21, Temp31; + float Temp02, Temp12, Temp22, Temp32; + float aElements[4][4]; + + float Radians = (float)((Degrees/360) * M_PI * 2.0); + + float Sin = (float)sin(Radians), Cos = (float)cos(Radians); + + memcpy(aElements, lpM, sizeof(D3DMATRIX)); + Temp01 = aElements[0][1] * Cos + aElements[0][2] * Sin; + Temp11 = aElements[1][1] * Cos + aElements[1][2] * Sin; + Temp21 = aElements[2][1] * Cos + aElements[2][2] * Sin; + Temp31 = aElements[3][1] * Cos + aElements[3][2] * Sin; + + Temp02 = aElements[0][1] * -Sin + aElements[0][2] * Cos; + Temp12 = aElements[1][1] * -Sin + aElements[1][2] * Cos; + Temp22 = aElements[2][1] * -Sin + aElements[2][2] * Cos; + Temp32 = aElements[3][1] * -Sin + aElements[3][2] * Cos; + + lpM->_12 = Temp01; + lpM->_22 = Temp11; + lpM->_32 = Temp21; + lpM->_42 = Temp31; + lpM->_13 = Temp02; + lpM->_23 = Temp12; + lpM->_33 = Temp22; + lpM->_43 = Temp32; +} + +void +ConcatenateYRotation(LPD3DMATRIX lpM, float Degrees ) +{ + float Temp00, Temp10, Temp20, Temp30; + float Temp02, Temp12, Temp22, Temp32; + float aElements[4][4]; + + float Radians = (float)((Degrees/360) * M_PI * 2); + + float Sin = (float)sin(Radians), Cos = (float)cos(Radians); + + memcpy(aElements, lpM, sizeof(D3DMATRIX)); + Temp00 = aElements[0][0] * Cos + aElements[0][2] * -Sin; + Temp10 = aElements[1][0] * Cos + aElements[1][2] * -Sin; + Temp20 = aElements[2][0] * Cos + aElements[2][2] * -Sin; + Temp30 = aElements[3][0] * Cos + aElements[3][2] * -Sin; + + Temp02 = aElements[0][0] * Sin + aElements[0][2] * Cos; + Temp12 = aElements[1][0] * Sin + aElements[1][2] * Cos; + Temp22 = aElements[2][0] * Sin + aElements[2][2] * Cos; + Temp32 = aElements[3][0] * Sin + aElements[3][2] * Cos; + + lpM->_11 = Temp00; + lpM->_21 = Temp10; + lpM->_31 = Temp20; + lpM->_41 = Temp30; + lpM->_13 = Temp02; + lpM->_23 = Temp12; + lpM->_33 = Temp22; + lpM->_43 = Temp32; +} + +void +ConcatenateZRotation(LPD3DMATRIX lpM, float Degrees ) +{ + float Temp00, Temp10, Temp20, Temp30; + float Temp01, Temp11, Temp21, Temp31; + float aElements[4][4]; + + float Radians = (float)((Degrees/360) * M_PI * 2); + + float Sin = (float)sin(Radians), Cos = (float)cos(Radians); + + memcpy(aElements, lpM, sizeof(D3DMATRIX)); + Temp00 = aElements[0][0] * Cos + aElements[0][1] * Sin; + Temp10 = aElements[1][0] * Cos + aElements[1][1] * Sin; + Temp20 = aElements[2][0] * Cos + aElements[2][1] * Sin; + Temp30 = aElements[3][0] * Cos + aElements[3][1] * Sin; + + Temp01 = aElements[0][0] * -Sin + aElements[0][1] * Cos; + Temp11 = aElements[1][0] * -Sin + aElements[1][1] * Cos; + Temp21 = aElements[2][0] * -Sin + aElements[2][1] * Cos; + Temp31 = aElements[3][0] * -Sin + aElements[3][1] * Cos; + + lpM->_11 = Temp00; + lpM->_21 = Temp10; + lpM->_31 = Temp20; + lpM->_41 = Temp30; + lpM->_12 = Temp01; + lpM->_22 = Temp11; + lpM->_32 = Temp21; + lpM->_42 = Temp31; +} diff --git a/sdk/samples/flipcube/flipcube.def b/sdk/samples/flipcube/flipcube.def new file mode 100644 index 0000000..b964ebd --- /dev/null +++ b/sdk/samples/flipcube/flipcube.def @@ -0,0 +1,10 @@ +NAME flipcube.exe + +DESCRIPTION 'Direct3D Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/flipcube/makefile b/sdk/samples/flipcube/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/flipcube/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/flipcube/msvc.mk b/sdk/samples/flipcube/msvc.mk new file mode 100644 index 0000000..f7aa2ed --- /dev/null +++ b/sdk/samples/flipcube/msvc.mk @@ -0,0 +1,42 @@ +NAME = flipcube +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = flipcube.obj d3dapp.obj ddcalls.obj d3dcalls.obj texture.obj misc.obj d3dmain.obj stats.obj d3dmath.obj lclib.obj + +!if "$(DEBUG)" == "debug" +COPT =-DDEBUG -DD3DDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DDEMO +!else +COPT =-Otyb1 -DD3DDEMO +LOPT =-debug:none +ROPT = -DD3DDEMO +!endif +DEF = $(NAME).def +RES = d3dmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/flipcube/readme.txt b/sdk/samples/flipcube/readme.txt new file mode 100644 index 0000000..def0b8d --- /dev/null +++ b/sdk/samples/flipcube/readme.txt @@ -0,0 +1,17 @@ +Flipcube +Direct3D Immediate Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +A cube is created and spun through mouse and keyboard input. The +world matrix is changed in response to mouse and keyboard input and +set before rendering each frame. Keyboard and mouse cues: + + F11 - closer + F12 - further + left-mouse drag - spin with mouse movement + right-mouse click - resume spinning + +Vertices are not shared because the normals are different for each +side. Each side is covered by a separate material. +DLIGHTSTATE_MATERIAL must be set and D3DPROCESSVERTICES_TRANSFORMLIGHT +must be called for each side of the cube. diff --git a/sdk/samples/fly/fly.c b/sdk/samples/fly/fly.c new file mode 100644 index 0000000..f865545 --- /dev/null +++ b/sdk/samples/fly/fly.c @@ -0,0 +1,374 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: fly.c + * + ***************************************************************************/ + +/* + * landscape fly by + */ + +#include <math.h> +#include <stdlib.h> +#include "rmdemo.h" + +typedef struct PATHINFO { + D3DVALUE t; + LPDIRECT3DRMFRAME chase; + LPDIRECT3DRMFRAME plane_frame; + LPDIRECT3DRMANIMATION flight_path; +} pathInfo; + +#define NUM_SMOKE 7 +int smoke_num = 0; +int done_all = 0; + +LPDIRECT3DRMFRAME smoke[NUM_SMOKE]; + +static void CDECL cleanupObjects(LPDIRECT3DRMOBJECT obj, void* arg) +{ + pathInfo *info = (pathInfo*) arg; + int i; + + for (i = 0; i < NUM_SMOKE; i++) + smoke[i]->lpVtbl->Release(smoke[i]); + info->chase->lpVtbl->Release(info->chase); + info->plane_frame->lpVtbl->Release(info->plane_frame); + info->flight_path->lpVtbl->Release(info->flight_path); +} + +static void CDECL moveCamera(LPDIRECT3DRMFRAME camera, void *arg, D3DVALUE delta) +{ + D3DVECTOR dir, up; + D3DVECTOR dirCam, upCam; + struct PATHINFO *info; + LPDIRECT3DRMFRAME scene; + D3DVALUE a_bit; + + info = (struct PATHINFO *) arg; + camera->lpVtbl->GetScene(camera, &scene); + info->t += D3DVAL(0.04); + info->flight_path->lpVtbl->SetFrame(info->flight_path, camera); + info->flight_path->lpVtbl->SetTime(info->flight_path, info->t); + + info->flight_path->lpVtbl->SetFrame(info->flight_path, info->plane_frame); + info->flight_path->lpVtbl->SetTime(info->flight_path, info->t + D3DVAL(0.5)); + + info->flight_path->lpVtbl->SetFrame(info->flight_path, info->chase); + info->flight_path->lpVtbl->SetTime(info->flight_path, info->t + D3DVAL(1.0)); + + camera->lpVtbl->LookAt(camera, info->plane_frame, scene, D3DRMCONSTRAIN_Z); + info->plane_frame->lpVtbl->LookAt(info->plane_frame, info->chase,scene, + D3DRMCONSTRAIN_Y); + camera->lpVtbl->GetOrientation(camera, scene, &dirCam, &upCam); + info->plane_frame->lpVtbl->GetOrientation(info->plane_frame, scene, + &dir, &up); + up.x = dir.x - dirCam.x; + up.y = dir.y - dirCam.y + D3DVAL(1.0); + up.z = dir.z - dirCam.z; + + info->plane_frame->lpVtbl->SetOrientation(info->plane_frame, scene, + dir.x, dir.y, dir.z, + up.x, up.y, up.z); + + if (done_all < NUM_SMOKE) { + scene->lpVtbl->AddVisual(scene, (LPDIRECT3DRMVISUAL) smoke[smoke_num]); + done_all++; + } else { + if (smoke_num == NUM_SMOKE) { + smoke_num = 0; + } + } + a_bit = D3DDivide(D3DDivide(D3DVAL(smoke_num), D3DVAL(NUM_SMOKE)), + D3DVAL(10.0)); + info->flight_path->lpVtbl->SetFrame(info->flight_path, smoke[smoke_num]); + info->flight_path->lpVtbl->SetTime(info->flight_path, + info->t + D3DVAL(0.4) - a_bit); + smoke[smoke_num]->lpVtbl->SetOrientation(smoke[smoke_num], scene, + dir.x, dir.y, dir.z, + up.x, up.y, up.z); + smoke_num++; + scene->lpVtbl->Release(scene); +} + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + LPDIRECT3DRMFRAME lights = NULL; + D3DRMBOX box; + LPDIRECT3DRMMESHBUILDER plane_builder = NULL; + LPDIRECT3DRMMESHBUILDER mesh_builder = NULL; + LPDIRECT3DRMMESHBUILDER smoke_builder = NULL; + LPDIRECT3DRMMESH plane = NULL; + LPDIRECT3DRMMESH mesh = NULL; + LPDIRECT3DRMMESH smokemesh = NULL; + LPDIRECT3DRMLIGHT ambient = NULL; + LPDIRECT3DRMLIGHT parallel = NULL; + D3DCOLOR smokec; + LPDIRECT3DRMFRAME frame = NULL; + LPDIRECT3DRMFRAME sl = NULL; + LPDIRECT3DRMFRAME sr = NULL; + HRESULT rval; + int i; + int numPts = 11; + D3DVECTOR path[] = { + -D3DVAL(8.0), D3DVAL(3.0), -D3DVAL(12.0), + -D3DVAL(4.0), D3DVAL(2.0), -D3DVAL(8.0), + -D3DVAL(2.0), D3DVAL(0.0), -D3DVAL(4.0), + D3DVAL(9.0), -D3DVAL(1.0), D3DVAL(7.0), + D3DVAL(4.0), D3DVAL(6.0), D3DVAL(10.0), + -D3DVAL(4.0), D3DVAL(5.0), D3DVAL(9.0), + D3DVAL(5.5), D3DVAL(3.5), -D3DVAL(6.5), + D3DVAL(2.0), D3DVAL(5.0), -D3DVAL(10.0), + D3DVAL(0.0), D3DVAL(4.0), -D3DVAL(15.0), + -D3DVAL(5.0), D3DVAL(4.0), -D3DVAL(15.0), + -D3DVAL(8.0), D3DVAL(3.0), -D3DVAL(12.0) + }; + D3DVALUE path_t[] = { + D3DVAL(0), D3DVAL(1), D3DVAL(2), D3DVAL(3), D3DVAL(4), D3DVAL(5), D3DVAL(6), D3DVAL(7), D3DVAL(8), D3DVAL(9), D3DVAL(10) + }; + static pathInfo info; + + if (FAILED(view->lpVtbl->SetField(view, D3DVAL(0.8)))) + goto generic_error; + if (FAILED(dev->lpVtbl->SetQuality(dev, D3DRMRENDER_GOURAUD))) + goto generic_error; +#ifdef FOG + if (FAILED(dev->lpVtbl->SetDither(dev, TRUE))) + goto generic_error; + if (FAILED(scene->lpVtbl->SetFogEnable(scene, TRUE))) + goto generic_error; + if (FAILED(scene->lpVtbl->SetFogParams(scene, 1, 30, 1))) + goto generic_error; +#endif + + /* + * This Demo flies a plane through a small landscape, followed by a + * camera. The paths are spline curves. + */ + + /* + * Initialise smoke trail + */ + smokec = D3DRMCreateColorRGBA(D3DVAL(0.6), D3DVAL(0.6), D3DVAL(0.6), + D3DVAL(0.5)); + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &smoke_builder))) + goto generic_error; + rval = smoke_builder->lpVtbl->Load(smoke_builder, "sphere0.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load sphere0.x.\n%s", D3DRMErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(smoke_builder->lpVtbl->Scale(smoke_builder, D3DVAL(0.015), D3DVAL(0.015), + D3DVAL(0.015)))) + goto generic_error; + + if (FAILED(smoke_builder->lpVtbl->CreateMesh(smoke_builder, &smokemesh))) + goto generic_error; + for (i = 0; i < NUM_SMOKE; i++) { + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &smoke[i]))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, smoke[i], &sl))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, smoke[i], &sr))) + goto generic_error; + + if (FAILED(sl->lpVtbl->AddVisual(sl, (LPDIRECT3DRMVISUAL) smokemesh))) + goto generic_error; + if (FAILED(sr->lpVtbl->AddVisual(sr, (LPDIRECT3DRMVISUAL) smokemesh))) + goto generic_error; + if (FAILED(sr->lpVtbl->SetPosition(sr, smoke[i], D3DVAL(-0.1), D3DVAL(0.0), + D3DVAL(0.0)))) + goto generic_error; + if (FAILED(smoke[i]->lpVtbl->SetMaterialMode(smoke[i], D3DRMMATERIAL_FROMFRAME))) + goto generic_error; + if (FAILED(smoke[i]->lpVtbl->SetColor(smoke[i], smokec))) + goto generic_error; + if (FAILED(sl->lpVtbl->SetMaterialMode(sl, D3DRMMATERIAL_FROMPARENT))) + goto generic_error; + if (FAILED(sr->lpVtbl->SetMaterialMode(sr, D3DRMMATERIAL_FROMPARENT))) + goto generic_error; + RELEASE(sl); + RELEASE(sr); + } + /* + * initialize the lights in the scene + */ + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &lights))) + goto generic_error; + if (FAILED(lights->lpVtbl->SetPosition(lights, scene, D3DVAL(5.0), D3DVAL(5.0), + -D3DVAL(5.0)))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_PARALLELPOINT, D3DVAL(0.8), + D3DVAL(0.6), D3DVAL(0.7), ¶llel))) + goto generic_error; + + if (FAILED(lights->lpVtbl->AddLight(lights, parallel))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT, D3DVAL(0.1), + D3DVAL(0.1), D3DVAL(0.1), &ambient))) + goto generic_error; + if (FAILED(scene->lpVtbl->AddLight(scene, ambient))) + goto generic_error; + + /* + * load mesh file + */ + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &frame))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &mesh_builder))) + goto generic_error; + if (FAILED(mesh_builder->lpVtbl->Load(mesh_builder, "land4.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL))) + goto generic_error; + if (FAILED(mesh_builder->lpVtbl->Scale(mesh_builder, D3DVAL(10.0), D3DVAL(8.0), + D3DVAL(10.0)))) + goto generic_error; + if (FAILED(mesh_builder->lpVtbl->GetBox(mesh_builder, &box))) + goto generic_error; + + /* + * Color the landscape's faces. + */ + if (mesh_builder) { + LPDIRECT3DRMFACEARRAY faces; + LPDIRECT3DRMFACE this_face; + int face_count, vertex_count; + int j; + D3DVALUE range, height; + D3DVECTOR *coords; + + if (FAILED(mesh_builder->lpVtbl->GetFaces(mesh_builder, &faces))) + goto generic_error; + face_count = faces->lpVtbl->GetSize(faces); + + range = box.max.y - box.min.y; + + /* + * color the faces according to the height + */ + for (i = 0; i < face_count; i++) { + faces->lpVtbl->GetElement(faces, i, &this_face); + vertex_count = this_face->lpVtbl->GetVertexCount(this_face); + coords = (LPD3DVECTOR) malloc(vertex_count * sizeof(D3DVECTOR)); + this_face->lpVtbl->GetVertices(this_face, &vertex_count, + coords, NULL); + if (vertex_count) { + /* + * find maximum height of the face + */ + height = coords[0].y; + for (j = 1; j < vertex_count; j++) { + if (coords[j].y > height) + height = coords[j].y; + } + height = D3DDivide((height - box.min.y), range); + + if (height < D3DVAL(0.03)) /* water */ + this_face->lpVtbl->SetColorRGB(this_face, + D3DVAL(0.2), D3DVAL(0.2), D3DVAL(0.5)); + else if (height < D3DVAL(0.3)) /* greenery */ + this_face->lpVtbl->SetColorRGB(this_face, + D3DVAL(0.1), D3DVAL(0.8), D3DVAL(0.1)); + else if (height < D3DVAL(0.5)) /* rocks */ + this_face->lpVtbl->SetColorRGB(this_face, D3DVAL(0.6), + D3DVAL(0.3),D3DVAL(0.3)); + else if (height < D3DVAL(0.7)) /* dirty snow */ + this_face->lpVtbl->SetColorRGB(this_face, D3DVAL(0.8), + D3DVAL(0.65), + D3DVAL(0.65)); + else /* snow */ + this_face->lpVtbl->SetColorRGB(this_face, D3DVAL(1.0), + D3DVAL(1.0),D3DVAL(1.0)); + } + free(coords); + RELEASE(this_face); + } + RELEASE(faces); + } + if (FAILED(mesh_builder->lpVtbl->CreateMesh(mesh_builder, &mesh))) + goto generic_error; + if (FAILED(frame->lpVtbl->AddVisual(frame, (LPDIRECT3DRMVISUAL) mesh))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &plane_builder))) + goto generic_error; + rval = plane_builder->lpVtbl->Load(plane_builder, "dropship.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load dropship.x.\n%s", D3DRMErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(plane_builder->lpVtbl->Scale(plane_builder, D3DVAL(0.015), + D3DVAL(0.008), D3DVAL(0.015)))) + goto generic_error; + if (FAILED(plane_builder->lpVtbl->CreateMesh(plane_builder, &plane))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateAnimation(lpD3DRM, &info.flight_path))) + goto generic_error; + info.flight_path->lpVtbl->SetOptions(info.flight_path, D3DRMANIMATION_CLOSED + | D3DRMANIMATION_SPLINEPOSITION + | D3DRMANIMATION_POSITION); + for (i = 0; i < numPts; i++) + info.flight_path->lpVtbl->AddPositionKey(info.flight_path, path_t[i], + path[i].x, + path[i].y, path[i].z); + + info.t = D3DVAL(0.0); + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &info.chase))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &info.plane_frame))) + goto generic_error; + if (FAILED(info.plane_frame->lpVtbl->AddVisual(info.plane_frame, + (LPDIRECT3DRMVISUAL) plane))) + goto generic_error; + + if (FAILED(camera->lpVtbl->AddMoveCallback(camera, moveCamera, (void *) &info))) + goto generic_error; + if (FAILED(camera->lpVtbl->AddDestroyCallback(camera, cleanupObjects, &info))) + goto generic_error; + + RELEASE(lights); + RELEASE(plane_builder); + RELEASE(mesh_builder); + RELEASE(smoke_builder); + RELEASE(plane); + RELEASE(mesh); + RELEASE(smokemesh); + RELEASE(ambient); + RELEASE(parallel); + RELEASE(frame); + return TRUE; + +generic_error: + Msg("A failure has occurred while building the scene.\n"); +ret_with_error: + RELEASE(lights); + RELEASE(plane_builder); + RELEASE(mesh_builder); + RELEASE(smoke_builder); + RELEASE(plane); + RELEASE(mesh); + RELEASE(smokemesh); + RELEASE(ambient); + RELEASE(parallel); + RELEASE(frame); + RELEASE(sl); + RELEASE(sr); + return FALSE; +} + +void +OverrideDefaults(Defaults* defaults) +{ + defaults->bNoTextures = TRUE; + defaults->bConstRenderQuality = TRUE; + lstrcpy(defaults->Name, "Fly Direct3DRM Example"); +} diff --git a/sdk/samples/fly/fly.def b/sdk/samples/fly/fly.def new file mode 100644 index 0000000..a98c848 --- /dev/null +++ b/sdk/samples/fly/fly.def @@ -0,0 +1,10 @@ +NAME fly.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/fly/makefile b/sdk/samples/fly/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/fly/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/fly/msvc.mk b/sdk/samples/fly/msvc.mk new file mode 100644 index 0000000..aac1beb --- /dev/null +++ b/sdk/samples/fly/msvc.mk @@ -0,0 +1,42 @@ +NAME = fly +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = fly.obj rmfull.obj rmstats.obj d3dapp.obj ddcalls.obj d3dcalls.obj texture.obj misc.obj lclib.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT =-DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmfull.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/fly/readme.txt b/sdk/samples/fly/readme.txt new file mode 100644 index 0000000..537585d --- /dev/null +++ b/sdk/samples/fly/readme.txt @@ -0,0 +1,6 @@ +Fly +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Using animations to set the position of a spaceship along a curved +path. diff --git a/sdk/samples/foxbear/backlist.dat b/sdk/samples/foxbear/backlist.dat new file mode 100644 index 0000000..0432733 --- /dev/null +++ b/sdk/samples/foxbear/backlist.dat @@ -0,0 +1,15 @@ +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 123 118 118 118 118 119 120 118 118 118 118 118 118 118 118 118 121 122 118 118 118 118 +118 118 118 118 118 121 122 118 118 118 118 118 118 118 118 118 119 120 118 118 118 118 123 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 +118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/sdk/samples/foxbear/bmp.c b/sdk/samples/foxbear/bmp.c new file mode 100644 index 0000000..e7a861f --- /dev/null +++ b/sdk/samples/foxbear/bmp.c @@ -0,0 +1,135 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: bmp.c + * Content: Bitmap reader + * + ***************************************************************************/ +#include "foxbear.h" + +/* + * gfxLoadBitmap + */ +GFX_HBM gfxLoadBitmap(LPSTR szFileName) +{ + HFASTFILE pfile; + BITMAPFILEHEADER UNALIGNED *pbf; + BITMAPINFOHEADER UNALIGNED *pbi; + GFX_HBM hbm; + BOOL trans = FALSE; + + pfile = FastFileOpen( szFileName ); + + if( pfile == NULL ) + { + return NULL; + } + + pbf = (BITMAPFILEHEADER *)FastFileLock(pfile, 0, 0); + pbi = (BITMAPINFOHEADER *)(pbf+1); + + if (pbf->bfType != 0x4d42 || + pbi->biSize != sizeof(BITMAPINFOHEADER)) + { + Msg("Failed to load"); + Msg(szFileName); + FastFileClose( pfile ); + return NULL; + } + + /* + * TOTAL HACK for FoxBear, FoxBear does not use any masks, it draws + * sprites with transparent colors, but the code still loads the masks + * if a mask exists the sprite is transparent, else it is not, so + * you cant get rid of the masks or nothing will be transparent!! + * + * if the code tries to load a mask, just return a non-zero value. + */ + + if( pbi->biBitCount == 1 ) + { + Msg("some code is still using masks, stop that!"); + FastFileClose( pfile ); + return NULL; + } + + /* + * ANOTHER TOTAL HACK for FoxBear, some of the bitmaps in FoxBear + * are a solid color, detect these and dont waste VRAM on them. + */ + if( !bTransDest && pbi->biBitCount == 8 ) + { + int x,y; + BYTE c; + BYTE UNALIGNED *pb = (LPBYTE)pbi + pbi->biSize + 256 * sizeof(COLORREF); + RGBQUAD UNALIGNED *prgb = (RGBQUAD *)((LPBYTE)pbi + pbi->biSize); + COLORREF rgb; + + c = *pb; + + for(y=0; y<(int)pbi->biHeight; y++ ) + { + for( x=0; x<(int)pbi->biWidth; x++ ) + { + if (c != *pb++) + goto not_solid; + } + pb += ((pbi->biWidth + 3) & ~3) - pbi->biWidth; + } + + rgb = RGB(prgb[c].rgbRed,prgb[c].rgbGreen,prgb[c].rgbBlue); + hbm = gfxCreateSolidColorBitmap(rgb); + + FastFileClose( pfile ); + return hbm; + } +not_solid: + + /* + * figure out iff the bitmap has the transparent color in it. + */ + if( pbi->biBitCount == 8 ) + { + int x,y; + BYTE UNALIGNED *pb = (LPBYTE)pbi + pbi->biSize + 256 * sizeof(COLORREF); + DWORD UNALIGNED *prgb = (DWORD *)((LPBYTE)pbi + pbi->biSize); + + for(y=0; y<(int)pbi->biHeight && !trans; y++ ) + { + for( x=0; x<(int)pbi->biWidth && !trans; x++ ) + { + if (prgb[*pb++] == 0x00FFFFFF) + trans=TRUE; + } + pb += ((pbi->biWidth + 3) & ~3) - pbi->biWidth; + } + } + + hbm = gfxCreateVramBitmap(pbi, trans); + + if( hbm == NULL ) + { + FastFileClose( pfile ); + return GFX_FALSE; + } + +#if 0 + { + DDSCAPS ddscaps; + + IDirectDrawSurface_GetCaps(((GFX_BITMAP *)hbm)->lpSurface, &ddscaps); + + if( !(ddscaps.dwCaps & DDSCAPS_VIDEOMEMORY) ) + { + Msg( "%s is in system memory", szFileName ); + } + } +#endif + + FastFileClose( pfile ); + + return hbm; + +} /* gfxLoadBitmap */ diff --git a/sdk/samples/foxbear/ddraw.c b/sdk/samples/foxbear/ddraw.c new file mode 100644 index 0000000..34af64e --- /dev/null +++ b/sdk/samples/foxbear/ddraw.c @@ -0,0 +1,844 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: ddraw.c + * Content: Misc. Direct Draw access routines + * + ***************************************************************************/ +#include "foxbear.h" + +BOOL bUseEmulation; +BOOL bUseSysMem; +int nBufferCount; +int CmdLineBufferCount; +BOOL bTransDest; +BOOL bColorFill; + +HRESULT CALLBACK EnumDisplayModesCallback(LPDDSURFACEDESC pddsd, LPVOID Context); + +/* + * DDEnable + */ +BOOL DDEnable( void ) +{ + LPDIRECTDRAW lpdd; + DDCAPS ddcaps; + HRESULT ddrval; + BOOL use_dest; + + nBufferCount = GetProfileInt( "FoxBear", "buffers", CmdLineBufferCount); + bUseEmulation = GetProfileInt( "FoxBear", "use_emulation", bUseEmulation); + bUseSysMem = GetProfileInt( "FoxBear", "sysmem", 0); + use_dest = GetProfileInt( "FoxBear", "use_dest", 0 ); + + if (lpDD == NULL) + { + if( bUseEmulation ) + { + ddrval = DirectDrawCreate( (LPVOID) DDCREATE_EMULATIONONLY, &lpdd, NULL ); + } + else + { + ddrval = DirectDrawCreate( NULL, &lpdd, NULL ); + } + } + else + { + lpdd = lpDD; + ddrval = DD_OK; + } + + if( ddrval != DD_OK ) + { + Msg("DirectDrawCreate failed err=%d", ddrval); + goto error; + } + + /* + * grab exclusive mode if we are going to run as fullscreen + * otherwise grab normal mode. + */ + if (lpDD == NULL) + { + NumModes = 0; + + if (bFullscreen) + { + ddrval = IDirectDraw_SetCooperativeLevel( lpdd, hWndMain, + DDSCL_ALLOWMODEX | + DDSCL_EXCLUSIVE | + DDSCL_FULLSCREEN ); + + // in fullscreen mode, enumeratte the available modes + IDirectDraw_EnumDisplayModes(lpdd, 0, NULL, 0, EnumDisplayModesCallback); + } + else + { + ddrval = IDirectDraw_SetCooperativeLevel( lpdd, hWndMain, + DDSCL_NORMAL ); + + // in normal windowed mode, just add some "stock" window + // sizes + + ModeList[NumModes].w = 320; + ModeList[NumModes].h = 200; + NumModes++; + + ModeList[NumModes].w = 320; + ModeList[NumModes].h = 240; + NumModes++; + + ModeList[NumModes].w = 512; + ModeList[NumModes].h = 384; + NumModes++; + + ModeList[NumModes].w = 640; + ModeList[NumModes].h = 400; + NumModes++; + + ModeList[NumModes].w = 640; + ModeList[NumModes].h = 480; + NumModes++; + } + + if( ddrval != DD_OK ) + { + Msg("SetCooperativeLevel failed err=%d", ddrval); + goto error; + } + } + + if (bFullscreen) + { + Msg("SetDisplayMode %d %d %d",GameMode.cx,GameMode.cy, GameBPP); + ddrval = IDirectDraw_SetDisplayMode( lpdd, + GameMode.cx, GameMode.cy, GameBPP); + + if (ddrval != DD_OK && (GameMode.cx != 640 || GameMode.cy != 480)) + { + Msg( "cant set mode trying 640x480" ); + + GameMode.cx = 640; + GameMode.cy = 480; + GameSize = GameMode; + + ddrval = IDirectDraw_SetDisplayMode( lpdd, + GameMode.cx, GameMode.cy, GameBPP); + } + + if (ddrval != DD_OK && GameBPP != 8) + { + Msg( "cant set mode trying 640x480x8" ); + + GameBPP = 8; + + ddrval = IDirectDraw_SetDisplayMode( lpdd, + GameMode.cx, GameMode.cy, GameBPP); + } + + if (ddrval != DD_OK && GameBPP != 16) + { + Msg( "cant set mode trying 640x480x16" ); + + GameBPP = 16; + + ddrval = IDirectDraw_SetDisplayMode( lpdd, + GameMode.cx, GameMode.cy, GameBPP); + } + + if( ddrval != DD_OK ) + { + Msg("SetMode failed err=%d", ddrval); + goto error; + } + } + else + { + RECT rcWork; + RECT rc; + HDC hdc; + DWORD dwStyle; + + // + // when in rome (I mean when in windows) we should use the + // current mode + // + hdc = GetDC(NULL); + GameBPP = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL); + ReleaseDC(NULL, hdc); + + // + // if we are still a WS_POPUP window we should convert to a + // normal app window so we look like a windows app. + // + dwStyle = GetWindowStyle(hWndMain); + dwStyle &= ~WS_POPUP; + dwStyle |= WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX; + SetWindowLong(hWndMain, GWL_STYLE, dwStyle); + + if (bStretch) + SetRect(&rc, 0, 0, GameMode.cx*2, GameMode.cy*2); + else + SetRect(&rc, 0, 0, GameMode.cx, GameMode.cy); + + AdjustWindowRectEx(&rc, + GetWindowStyle(hWndMain), + GetMenu(hWndMain) != NULL, + GetWindowExStyle(hWndMain)); + + SetWindowPos(hWndMain, NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, + SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + + SetWindowPos(hWndMain, HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); + + // + // make sure our window does not hang outside of the work area + // this will make people who have the tray on the top or left + // happy. + // + SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWork, 0); + GetWindowRect(hWndMain, &rc); + if (rc.left < rcWork.left) rc.left = rcWork.left; + if (rc.top < rcWork.top) rc.top = rcWork.top; + SetWindowPos(hWndMain, NULL, rc.left, rc.top, 0, 0, + SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + } + + /* + * check capabilites + */ + ddcaps.dwSize = sizeof( ddcaps ); + ddrval = IDirectDraw_GetCaps( lpdd, &ddcaps, NULL ); + + if( ddrval != DD_OK ) + { + Msg("GetCaps failed err=%d", ddrval); + goto error; + } + + if( ddcaps.dwCaps & DDCAPS_NOHARDWARE ) + { + Msg( "No hardware support at all" ); + } + + if( ddcaps.dwCaps & DDCAPS_BLTCOLORFILL ) + { + bColorFill = TRUE; + Msg( "Device supports color fill" ); + } + else + { + bColorFill = FALSE; + Msg( "Device does not support color fill" ); + } + + /* + * default to double buffered on 1mb, triple buffered + * on > 1mb + */ + if (nBufferCount == 0) + { + if( ddcaps.dwVidMemTotal <= 1024L*1024L*(GameBPP/8) || + GameMode.cx > 640 ) + { + Msg("double buffering (not enough memory)"); + nBufferCount = 2; + } + else + { + Msg("triple buffering"); + nBufferCount = 3; + } + } + + if( ddcaps.dwCaps & DDCAPS_COLORKEY ) + { + if( ddcaps.dwCKeyCaps & DDCKEYCAPS_SRCBLT ) + { + Msg( "Can do Src colorkey in hardware" ); + } + + if( ddcaps.dwCKeyCaps & DDCKEYCAPS_DESTBLT ) + { + Msg( "Can do Dest colorkey in hardware" ); + if( use_dest || !(ddcaps.dwCKeyCaps & DDCKEYCAPS_SRCBLT) ) + { + /* + * since direct draw doesn't support + * destination color key in emulation, only + * use it if there is enough vram ... + */ + if( ddcaps.dwVidMemTotal >= 2 * 1024L*1024L*(GameBPP/8) ) + { + Msg( "Using destination color key" ); + bTransDest = TRUE; + } + } + } + } + else + { + Msg( "Can't do color key in hardware!" ); + } + + lpDD = lpdd; + return TRUE; + +error: + return FALSE; + +} /* DDEnable */ + +/* + * DDDisable + */ +BOOL DDDisable( BOOL fFinal ) +{ + if( lpClipper ) + { + IDirectDrawClipper_Release(lpClipper); + lpClipper = NULL; + } + + if( lpBackBuffer ) + { + IDirectDrawSurface_Release(lpBackBuffer); + lpBackBuffer = NULL; + } + + if( lpFrontBuffer ) + { + IDirectDrawSurface_Release(lpFrontBuffer); + lpFrontBuffer = NULL; + } + + if( lpStretchBuffer ) + { + IDirectDrawSurface_Release(lpStretchBuffer); + lpStretchBuffer = NULL; + } + + // + // fFinal is TRUE when the app is exiting, FALSE if we are + // just seting a new game size.. + // + if ( fFinal ) + { + if( lpDD != NULL ) + { + IDirectDraw_Release( lpDD ); + lpDD = NULL; + } + } + + return TRUE; +} + +/* + * DDClear + * + * clear the front buffer and all backbuffers. + */ +BOOL DDClear( void ) +{ + DDBLTFX ddbltfx; + int i; + HRESULT ddrval; + + UpdateWindow(hWndMain); + + ddbltfx.dwSize = sizeof( ddbltfx ); + ddbltfx.dwFillColor = DDColorMatch(lpBackBuffer, RGB(0, 0, 200)); + + if (bFullscreen) + { + /* + * do it for all buffers, we either have 1 or 2 back buffers + * make sure we get them all, 4 is plenty! + */ + for( i=0; i<4; i++ ) + { + ddrval = IDirectDrawSurface_Blt( + lpBackBuffer, // dest surface + NULL, // dest rect + NULL, // src surface + NULL, // src rect + DDBLT_COLORFILL | DDBLT_WAIT, + &ddbltfx); + + if( ddrval != DD_OK ) + { + Msg("Fill failed ddrval =0x%08lX", ddrval); + return FALSE; + } + + ddrval = IDirectDrawSurface_Flip(lpFrontBuffer, NULL, DDFLIP_WAIT); + + if( ddrval != DD_OK ) + { + Msg("Flip failed ddrval =0x%08lX", ddrval ); + return FALSE; + } + } + } + else + { + ddrval = IDirectDrawSurface_Blt( + lpFrontBuffer, // dest surface + &rcWindow, // dest rect + NULL, // src surface + NULL, // src rect + DDBLT_COLORFILL | DDBLT_WAIT, + &ddbltfx); + + if( ddrval != DD_OK ) + { + Msg("Fill failed ddrval =0x%08lX", ddrval); + return FALSE; + } + } + + return TRUE; + +} /* DDClear */ + +/* + * DDCreateFlippingSurface + * + * create a FrontBuffer and a BackBuffer(s) + * + */ +BOOL DDCreateFlippingSurface( void ) +{ + DDPIXELFORMAT ddpf; + DDSURFACEDESC ddsd; + HRESULT ddrval; + DDSCAPS ddscaps; + DDCAPS ddcaps; + + ddcaps.dwSize = sizeof( ddcaps ); + + if( IDirectDraw_GetCaps( lpDD, &ddcaps, NULL ) != DD_OK ) + return FALSE; + + /* + * fill in surface desc: + * want a primary surface with 2 back buffers + */ + ZeroMemory( &ddsd, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + + if (bFullscreen && nBufferCount > 1) + { + // + // fullscreen case, create a primary (ie front) and + // either 1 or 2 back buffers + // + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.dwBackBufferCount = nBufferCount-1; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | DDSCAPS_COMPLEX; + + OutputDebugString("Creating multiple backbuffer primary\n\r"); + ddrval = IDirectDraw_CreateSurface( lpDD, &ddsd, &lpFrontBuffer, NULL ); + + if( ddrval != DD_OK ) + { + Msg( "CreateSurface FAILED! %08lx", ddrval ); + return FALSE; + } + + /* + * go find the back buffer + */ + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + ddrval = IDirectDrawSurface_GetAttachedSurface( + lpFrontBuffer, + &ddscaps, + &lpBackBuffer ); + + if( ddrval != DD_OK ) + { + Msg( "GetAttachedSurface failed! err=%d",ddrval ); + return FALSE; + } + + /* + * if we are stretching create a buffer to stretch into + * + * NOTE we always make this buffer in system memory because + * we render to the backbuffer (in VRAM) at half the size + * now we need to stretch into the backbuffer. we could just + * do a VRAM->VRAM stretch, but this is REAL REAL REAL slow on + * some cards (banked cards..) + */ + if( bStretch && (ddcaps.dwCaps & DDCAPS_BANKSWITCHED) ) + { + Msg( "On bank switched hardware, creating stretch buffer" ); + lpStretchBuffer = DDCreateSurface( GameSize.cx, GameSize.cy, + TRUE, FALSE ); + } + } + else if (bFullscreen && nBufferCount == 1) + { + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + OutputDebugString("Creating no backbuffer primary\n\r"); + ddrval = IDirectDraw_CreateSurface( lpDD, &ddsd, &lpFrontBuffer, NULL ); + + if( ddrval != DD_OK ) + { + Msg( "CreateSurface FAILED! %08lx", ddrval ); + return FALSE; + } + + IDirectDrawSurface_AddRef(lpFrontBuffer); + lpBackBuffer = lpFrontBuffer; + } + else + { + // + // window case, create the primary surface + // and create a backbuffer in offscreen memory. + // + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + ddrval = IDirectDraw_CreateSurface( lpDD, &ddsd, &lpFrontBuffer, NULL ); + + if( ddrval != DD_OK ) + { + Msg( "CreateSurface FAILED! %08lx", ddrval ); + return FALSE; + } + + lpBackBuffer = DDCreateSurface( GameSize.cx, GameSize.cy, FALSE, FALSE ); + + if( lpBackBuffer == NULL ) + { + Msg( "Cant create the backbuffer" ); + return FALSE; + } + + // + // now create a DirectDrawClipper object. + // + ddrval = IDirectDraw_CreateClipper(lpDD, 0, &lpClipper, NULL); + + if( ddrval != DD_OK ) + { + Msg("Cant create clipper"); + return FALSE; + } + + ddrval = IDirectDrawClipper_SetHWnd(lpClipper, 0, hWndMain); + + if( ddrval != DD_OK ) + { + Msg("Cant set clipper window handle"); + return FALSE; + } + + ddrval = IDirectDrawSurface_SetClipper(lpFrontBuffer, lpClipper); + + if( ddrval != DD_OK ) + { + Msg("Cant attach clipper to front buffer"); + return FALSE; + } + } + + /* + * init the color key + */ + ddpf.dwSize = sizeof(ddpf); + IDirectDrawSurface_GetPixelFormat(lpFrontBuffer, &ddpf); + + /* + * we use white as the color key, if we are in a 8bpp mode, we know + * what white is (because we use a 332 palette) if we are not in a + * a 8bpp mode we dont know what white is and we need to figure it + * out from the device (remember 16bpp comes in two common flavors + * 555 and 565). if we wanted to any random color as the color key + * we would call DDColorMatch (see below) to convert a RGB into a + * physical color. + */ + if (ddpf.dwRGBBitCount == 8) + dwColorKey = 0xff; + else + dwColorKey = ddpf.dwRBitMask | ddpf.dwGBitMask | ddpf.dwBBitMask; + + Msg("dwColorKey = 0x%08lX", dwColorKey); + + if( bTransDest ) + { + DDCOLORKEY ddck; + ddck.dwColorSpaceLowValue = dwColorKey; + ddck.dwColorSpaceHighValue = dwColorKey; + IDirectDrawSurface_SetColorKey( lpBackBuffer, DDCKEY_DESTBLT, &ddck); + } + + return TRUE; + +} /* DDCreateFlippingSurface */ + +/* + * DDCreateSurface + */ +LPDIRECTDRAWSURFACE DDCreateSurface( + DWORD width, + DWORD height, + BOOL sysmem, + BOOL trans ) +{ + DDSURFACEDESC ddsd; + HRESULT ddrval; + DDCOLORKEY ddck; + LPDIRECTDRAWSURFACE psurf; + + + /* + * fill in surface desc + */ + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH; + + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + if( sysmem || bUseSysMem ) + { + ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; + } + + ddsd.dwHeight = height; + ddsd.dwWidth = width; + + ddrval = IDirectDraw_CreateSurface( lpDD, &ddsd, &psurf, NULL ); + + /* + * set the color key for this bitmap + */ + if( ddrval == DD_OK ) + { + if( trans && !bTransDest ) + { + ddck.dwColorSpaceLowValue = dwColorKey; + ddck.dwColorSpaceHighValue = dwColorKey; + IDirectDrawSurface_SetColorKey( psurf, DDCKEY_SRCBLT, &ddck); + } + } + else + { + Msg( "CreateSurface FAILED, rc = %ld", (DWORD) LOWORD( ddrval ) ); + psurf = NULL; + } + + return psurf; + +} /* DDCreateSurface */ + +DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb) +{ + COLORREF rgbT; + HDC hdc; + DWORD dw = CLR_INVALID; + DDSURFACEDESC ddsd; + HRESULT hres; + + if (IDirectDrawSurface_GetDC(pdds, &hdc) == DD_OK) + { + rgbT = GetPixel(hdc, 0, 0); + SetPixel(hdc, 0, 0, rgb); + IDirectDrawSurface_ReleaseDC(pdds, hdc); + } + + ddsd.dwSize = sizeof(ddsd); + hres = IDirectDrawSurface_Lock( + pdds, NULL, &ddsd, DDLOCK_WAIT, NULL); + + if (hres == DD_OK) + { + dw = *(DWORD *)ddsd.lpSurface; + if(ddsd.ddpfPixelFormat.dwRGBBitCount != 32) + dw &= (1 << ddsd.ddpfPixelFormat.dwRGBBitCount)-1; + IDirectDrawSurface_Unlock(pdds, NULL); + } + else + { + IDirectDrawSurface_GetSurfaceDesc(pdds,&ddsd); + if(ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) + Msg("Failed to lock Primary Surface!"); + else + Msg("Failed to lock NON-PRIMARY Surface!"); + } + + if (IDirectDrawSurface_GetDC(pdds, &hdc) == DD_OK) + { + SetPixel(hdc, 0, 0, rgbT); + IDirectDrawSurface_ReleaseDC(pdds, hdc); + } + + return dw; +} + +/* + * ReadPalFile + * + * Create a DirectDrawPalette from a palette file + * + * if the palette files cant be found, make a default 332 palette + */ +LPDIRECTDRAWPALETTE ReadPalFile( char *fname ) +{ + int i; + int fh; + HRESULT ddrval; + IDirectDrawPalette *ppal; + + struct { + DWORD dwRiff; + DWORD dwFileSize; + DWORD dwPal; + DWORD dwData; + DWORD dwDataSize; + WORD palVersion; + WORD palNumEntries; + PALETTEENTRY ape[256]; + } pal; + + pal.dwRiff = 0; + + if (fname) + { + fh = _lopen( fname, OF_READ); + + if (fh != -1) + { + _lread(fh, &pal, sizeof(pal)); + _lclose(fh); + } + } + + /* + * if the file is not a palette file, or does not exist + * default to a 332 palette + */ + if (pal.dwRiff != 0x46464952 || // 'RIFF' + pal.dwPal != 0x204C4150 || // 'PAL ' + pal.dwData != 0x61746164 || // 'data' + pal.palVersion != 0x0300 || + pal.palNumEntries > 256 || + pal.palNumEntries < 1) + { + Msg("Can't open palette file, using default 332."); + + for( i=0; i<256; i++ ) + { + pal.ape[i].peRed = (BYTE)(((i >> 5) & 0x07) * 255 / 7); + pal.ape[i].peGreen = (BYTE)(((i >> 2) & 0x07) * 255 / 7); + pal.ape[i].peBlue = (BYTE)(((i >> 0) & 0x03) * 255 / 3); + pal.ape[i].peFlags = (BYTE)0; + } + } + + ddrval = IDirectDraw_CreatePalette( + lpDD, + DDPCAPS_8BIT, + pal.ape, + &ppal, + NULL ); + return ppal; + +} /* ReadPalFile */ + + +/* + * Splash + * + * Draw a splash screen during startup + * NOTE the screen has been cleared in DDCreateFlippingSurface + */ +void Splash( void ) +{ + HDC hdc; + HRESULT err; + + DDClear(); + + if ((err = IDirectDrawSurface_GetDC(lpFrontBuffer, &hdc)) == DD_OK) + { + char *szMsg = "FoxBear is loading.......please wait."; + SetTextColor(hdc, RGB(255,255,255)); + SetBkMode(hdc, TRANSPARENT); + TextOut(hdc, rcWindow.left, rcWindow.top, szMsg, lstrlen(szMsg)); + IDirectDrawSurface_ReleaseDC(lpFrontBuffer, hdc); + } + else + { + Msg("GetDC failed! 0x%x",err); + } + +} /* Splash */ + +/* + * MEMORY ALLOCATION ROUTINES... + */ + +/* + * MemAlloc + */ +LPVOID MemAlloc( UINT size ) +{ + LPVOID ptr; + + ptr = LocalAlloc( LPTR, size ); + return ptr; + +} /* MemAlloc */ + +/* + * CMemAlloc + */ +LPVOID CMemAlloc( UINT cnt, UINT isize ) +{ + DWORD size; + LPVOID ptr; + + size = cnt * isize; + ptr = LocalAlloc( LPTR, size ); + return ptr; + +} /* CMemAlloc */ + +/* + * MemFree + */ +void MemFree( LPVOID ptr ) +{ + if( ptr != NULL ) + { + LocalFree( ptr ); + } + +} /* MemFree */ + +HRESULT CALLBACK EnumDisplayModesCallback(LPDDSURFACEDESC pddsd, LPVOID Context) +{ + Msg("Mode: %dx%dx%d", pddsd->dwWidth, pddsd->dwHeight,pddsd->ddpfPixelFormat.dwRGBBitCount); + if( + (ModeList[NumModes-1].w == (int)pddsd->dwWidth)&& + (ModeList[NumModes-1].h == (int)pddsd->dwHeight)&& + (ModeList[NumModes-1].bpp == (int)pddsd->ddpfPixelFormat.dwRGBBitCount) + ) + return DDENUMRET_OK; + ModeList[NumModes].w = pddsd->dwWidth; + ModeList[NumModes].h = pddsd->dwHeight; + ModeList[NumModes].bpp = pddsd->ddpfPixelFormat.dwRGBBitCount; + NumModes++; + + return DDENUMRET_OK; +} diff --git a/sdk/samples/foxbear/fbsound.c b/sdk/samples/foxbear/fbsound.c new file mode 100644 index 0000000..5751b79 --- /dev/null +++ b/sdk/samples/foxbear/fbsound.c @@ -0,0 +1,287 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: fbsound.c + * Content: Game sound effect routines + * + ***************************************************************************/ +#include "foxbear.h" + +/* + * Array of pointers to our sound effects + */ +LPDIRECTSOUND lpDS; +LPDIRECTSOUNDBUFFER lpSoundEffects[NUM_SOUND_EFFECTS]; + +char szSoundEffects[NUM_SOUND_EFFECTS][MAX_PATH] = +{ + "STOP", + "THROW", + "JUMP", + "STUNNED", + "STRIKE02", + "MISS02" +}; + +/* + * DSEnable + * + * Figures out whether or not to use DirectSound, based on an entry + * in WIN.INI. Sets a module-level flag and goes about creating the + * DirectSound object if necessary. Returns TRUE if successful. + */ +BOOL DSEnable( HWND hwnd ) +{ + HRESULT dsrval; + BOOL bUseDSound; + + bUseDSound = GetProfileInt("FoxBear", "use_dsound", bWantSound); + + if (!bUseDSound) + { + lpDS = NULL; + return TRUE; + } + + if (lpDS != NULL) + { + Msg( "DSEnable, already enabled" ); + return TRUE; + } + + dsrval = DirectSoundCreate(NULL, &lpDS, NULL); + + if (dsrval != DS_OK) + { + Msg("DirectSoundCreate FAILED"); + return FALSE; + } + + + dsrval = IDirectSound_SetCooperativeLevel(lpDS, hwnd, DSSCL_NORMAL); + + if (dsrval != DS_OK) + { + DSDisable(); + Msg("SetCooperativeLevel FAILED"); + return FALSE; + } + + return TRUE; + +} /* DSEnable */ + + +/* + * DSDisable + * + * Turn off DirectSound + */ +BOOL DSDisable( void ) +{ + if (lpDS == NULL) + { + return TRUE; + } + + IDirectSound_Release(lpDS); + lpDS = NULL; + + return TRUE; + +} /* DSDisable */ + +/* + * InitSound + * + * Sets up the DirectSound object and loads all sounds into secondary + * DirectSound buffers. Returns FALSE on error, or TRUE if successful + */ +BOOL InitSound( HWND hwndOwner ) +{ + int idx; + DSBUFFERDESC dsBD; + IDirectSoundBuffer *lpPrimary; + + DSEnable(hwndOwner); + + if (lpDS == NULL) + return TRUE; + + /* + * Load all sounds -- any that can't load for some reason will have NULL + * pointers instead of valid SOUNDEFFECT data, and we will know not to + * play them later on. + */ + for( idx = 0; idx < NUM_SOUND_EFFECTS; idx++ ) + { + if (SoundLoadEffect((EFFECT)idx)) + { + DSBCAPS caps; + + caps.dwSize = sizeof(caps); + IDirectSoundBuffer_GetCaps(lpSoundEffects[idx], &caps); + + if (caps.dwFlags & DSBCAPS_LOCHARDWARE) + Msg( "Sound effect %s in hardware", szSoundEffects[idx]); + else + Msg( "Sound effect %s in software", szSoundEffects[idx]); + } + else + { + Msg( "cant load sound effect %s", szSoundEffects[idx]); + } + } + + /* + * get the primary buffer and start it playing + * + * by playing the primary buffer, DirectSound knows to keep the + * mixer active, even though we are not making any noise. + */ + + ZeroMemory( &dsBD, sizeof(DSBUFFERDESC) ); + dsBD.dwSize = sizeof(dsBD); + dsBD.dwFlags = DSBCAPS_PRIMARYBUFFER; + + if (SUCCEEDED(IDirectSound_CreateSoundBuffer(lpDS, &dsBD, &lpPrimary, NULL))) + { + if (!SUCCEEDED(IDirectSoundBuffer_Play(lpPrimary, 0, 0, DSBPLAY_LOOPING))) + { + Msg("Unable to play Primary sound buffer"); + } + + IDirectSoundBuffer_Release(lpPrimary); + } + else + { + Msg("Unable to create Primary sound buffer"); + } + + return TRUE; + +} /* InitSound */ + +/* + * DestroySound + * + * Undoes everything that was done in a InitSound call + */ +BOOL DestroySound( void ) +{ + DWORD idxKill; + + for( idxKill = 0; idxKill < NUM_SOUND_EFFECTS; idxKill++ ) + { + SoundDestroyEffect( (EFFECT)idxKill ); + } + + DSDisable(); + return TRUE; + +} /* DestroySound */ + +/* + * SoundDestroyEffect + * + * Frees up resources associated with a sound effect + */ +BOOL SoundDestroyEffect( EFFECT sfx ) +{ + if(lpSoundEffects[sfx]) + { + IDirectSoundBuffer_Release(lpSoundEffects[sfx]); + lpSoundEffects[sfx] = NULL; + } + return TRUE; + +} /* SoundDestryEffect */ + +/* + * SoundLoadEffect + * + * Initializes a sound effect by loading the WAV file from a resource + */ +BOOL SoundLoadEffect( EFFECT sfx ) +{ + if (lpDS && lpSoundEffects[sfx] == NULL && *szSoundEffects[sfx]) + { + // + // use DSLoadSoundBuffer (in ..\misc\dsutil.c) to load + // a sound from a resource. + // + lpSoundEffects[sfx] = DSLoadSoundBuffer(lpDS, szSoundEffects[sfx]); + } + + return lpSoundEffects[sfx] != NULL; + +} /* SoundLoadEffect */ + +/* + * SoundPlayEffect + * + * Plays the sound effect specified. + * Returns TRUE if succeeded. + */ +BOOL SoundPlayEffect( EFFECT sfx ) +{ + HRESULT dsrval; + IDirectSoundBuffer *pdsb = lpSoundEffects[sfx]; + + if( !lpDS || !pdsb ) + { + return FALSE; + } + + /* + * Rewind the play cursor to the start of the effect, and play + */ + IDirectSoundBuffer_SetCurrentPosition(pdsb, 0); + dsrval = IDirectSoundBuffer_Play(pdsb, 0, 0, 0); + + if (dsrval == DSERR_BUFFERLOST) + { + Msg("** %s needs restored", szSoundEffects[sfx]); + + dsrval = IDirectSoundBuffer_Restore(pdsb); + + if (dsrval == DS_OK) + { + if (DSReloadSoundBuffer(pdsb, szSoundEffects[sfx])) + { + Msg("** %s has been restored", szSoundEffects[sfx]); + IDirectSoundBuffer_SetCurrentPosition(pdsb, 0); + dsrval = IDirectSoundBuffer_Play(pdsb, 0, 0, 0); + } + else + { + dsrval = E_FAIL; + } + } + } + + return (dsrval == DS_OK); + +} /* SoundPlayEffect */ + +/* + * SoundStopEffect + * + * Stops the sound effect specified. + * Returns TRUE if succeeded. + */ +BOOL SoundStopEffect( EFFECT sfx ) +{ + HRESULT dsrval; + + if( !lpDS || !lpSoundEffects[sfx] ) + { + return FALSE; + } + + dsrval = IDirectSoundBuffer_Stop(lpSoundEffects[sfx]); + + return SUCCEEDED(dsrval); + +} /* SoundStopEffect */ diff --git a/sdk/samples/foxbear/fbsound.h b/sdk/samples/foxbear/fbsound.h new file mode 100644 index 0000000..ea24eec --- /dev/null +++ b/sdk/samples/foxbear/fbsound.h @@ -0,0 +1,39 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: fbsound.h + * Content: Includes for FoxBear DirectSound support + * + ***************************************************************************/ +#ifndef __FBSOUND_INCLUDED__ +#define __FBSOUND_INCLUDED__ + +/* + * types of sound effects + */ +typedef enum enum_EFFECT +{ + SOUND_STOP = 0, + SOUND_THROW, + SOUND_JUMP, + SOUND_STUNNED, + SOUND_BEARSTRIKE, + SOUND_BEARMISS, +} EFFECT; + +#define NUM_SOUND_EFFECTS 6 + +/* + * fn prototypes + */ +BOOL InitSound( HWND ); +BOOL DestroySound( void ); +BOOL DSDisable( void ); +BOOL DSEnable( HWND ); +BOOL SoundLoadEffect( EFFECT ); +BOOL SoundPlayEffect( EFFECT ); +BOOL SoundStopEffect( EFFECT ); +BOOL SoundDestroyEffect( EFFECT ); + +#endif diff --git a/sdk/samples/foxbear/forelist.dat b/sdk/samples/foxbear/forelist.dat new file mode 100644 index 0000000..e449c3e --- /dev/null +++ b/sdk/samples/foxbear/forelist.dat @@ -0,0 +1,15 @@ + 27 44 44 44 44 44 44 44 44 43 44 44 44 38 0 0 0 0 0 0 0 27 44 44 44 44 44 41 44 44 44 44 44 44 38 0 0 0 0 0 27 44 44 44 44 44 44 44 44 43 44 44 44 38 0 0 0 0 0 0 0 27 44 44 44 44 44 41 44 44 44 44 44 44 38 0 0 0 0 0 + 26 44 44 41 44 44 42 44 44 44 44 44 36 37 0 0 0 0 0 0 0 26 44 44 40 44 44 44 44 44 44 43 44 36 37 0 0 0 0 0 26 44 44 41 44 44 42 44 44 44 44 44 36 37 0 0 0 0 0 0 0 26 44 44 40 44 44 44 44 44 44 43 44 36 37 0 0 0 0 0 + 25 24 44 44 44 44 44 44 44 30 31 34 35 0 0 0 0 0 0 0 0 25 24 44 44 44 39 44 44 44 30 31 34 35 0 0 0 0 0 0 25 24 44 44 44 44 44 44 44 30 31 34 35 0 0 0 0 0 0 0 0 25 24 44 44 44 39 44 44 44 30 31 34 35 0 0 0 0 0 0 + 0 23 22 21 20 19 17 18 28 29 32 33 0 0 0 0 0 0 0 0 0 0 23 22 21 20 19 17 18 28 29 32 33 0 0 0 0 0 0 0 0 23 22 21 20 19 17 18 28 29 32 33 0 0 0 0 0 0 0 0 0 0 23 22 21 20 19 17 18 28 29 32 33 0 0 0 0 0 0 0 + 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 16 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 15 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 7 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 7 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 14 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 13 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 12 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 16 0 0 0 0 0 0 0 0 0 0 0 + 0 0 8 7 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 8 7 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 5 3 4 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 51 52 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 51 52 0 0 0 0 0 0 0 9 10 0 0 0 0 0 0 0 0 0 0 0 + 49 0 0 0 0 0 1 2 0 0 45 46 47 48 0 0 0 0 54 53 0 0 0 0 0 0 0 1 2 0 0 57 58 0 0 55 56 0 0 0 49 0 0 0 0 0 1 2 0 0 45 46 47 48 0 0 0 0 54 53 0 0 0 0 0 0 0 1 2 0 0 57 58 0 0 55 56 0 0 0 + 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 60 61 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 60 61 50 50 50 50 50 + 50 50 60 61 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 60 61 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 60 61 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 60 61 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 diff --git a/sdk/samples/foxbear/fox.ico b/sdk/samples/foxbear/fox.ico new file mode 100644 index 0000000..2e2b890 Binary files /dev/null and b/sdk/samples/foxbear/fox.ico differ diff --git a/sdk/samples/foxbear/foxbear.art b/sdk/samples/foxbear/foxbear.art new file mode 100644 index 0000000..efe82d4 Binary files /dev/null and b/sdk/samples/foxbear/foxbear.art differ diff --git a/sdk/samples/foxbear/foxbear.c b/sdk/samples/foxbear/foxbear.c new file mode 100644 index 0000000..f8cf58b --- /dev/null +++ b/sdk/samples/foxbear/foxbear.c @@ -0,0 +1,1031 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: winfox.c + * Content: Windows fox sample game + * + ***************************************************************************/ +#include "foxbear.h" +#include "rcids.h" // for FOX_ICON + +LPDIRECTDRAWSURFACE lpFrontBuffer; +LPDIRECTDRAWSURFACE lpBackBuffer; +LPDIRECTDRAWCLIPPER lpClipper; +LPDIRECTDRAWSURFACE lpStretchBuffer; +LPDIRECTDRAWSURFACE lpFrameRate; +LPDIRECTDRAWSURFACE lpInfo; +LPDIRECTDRAWPALETTE lpPalette; +LPDIRECTDRAW lpDD; +SHORT lastInput = 0; +HWND hWndMain; +RECT rcWindow; +BOOL bShowFrameCount=TRUE; +BOOL bIsActive; +BOOL bPaused; + +BOOL bStretch; +BOOL bFullscreen=TRUE; +BOOL bStress=FALSE; // just keep running if true +BOOL bHelp=FALSE; // help requested +RECT GameRect; // game rect +SIZE GameSize; // game is this size +SIZE GameMode; // display mode size +UINT GameBPP; // the bpp we want +DWORD dwColorKey; // our color key +DWORD AveFrameRate; +DWORD AveFrameRateCount; +BOOL bWantSound = TRUE; + + +#define OUR_APP_NAME "Win Fox Application" + +#define ODS OutputDebugString + +BOOL InitGame(void); +void ExitGame(void); +void initNumSurface(void); + + +/* + * PauseGame() + */ +void PauseGame() +{ + Msg("**** PAUSE"); + bPaused = TRUE; + InvalidateRect(hWndMain, NULL, TRUE); +} + +/* + * UnPauseGame() + */ +void UnPauseGame() +{ + if (GetForegroundWindow() == hWndMain) + { + Msg("**** UNPAUSE"); + bPaused = FALSE; + } +} + +/* + * RestoreGame() + */ +BOOL RestoreGame() +{ + if (lpFrontBuffer == NULL || IDirectDrawSurface_Restore(lpFrontBuffer) != DD_OK) + { + Msg("***** cant restore FrontBuffer"); + return FALSE; + } + + if (!bFullscreen) + { + if (lpBackBuffer == NULL || IDirectDrawSurface_Restore(lpBackBuffer) != DD_OK) + { + Msg("***** cant restore BackBuffer"); + return FALSE; + } + } + + if (lpStretchBuffer && IDirectDrawSurface_Restore(lpStretchBuffer) != DD_OK) + { + Msg("***** cant restore StretchBuffer"); + return FALSE; + } + + if (lpFrameRate == NULL || lpInfo == NULL || + IDirectDrawSurface_Restore(lpFrameRate) != DD_OK || + IDirectDrawSurface_Restore(lpInfo) != DD_OK) + { + Msg("***** cant restore frame rate stuff"); + return FALSE; + } + initNumSurface(); + + if (!gfxRestoreAll()) + { + Msg("***** cant restore art"); + return FALSE; + } + + return TRUE; +} + +/* + * ProcessFox + */ +BOOL ProcessFox(SHORT sInput) +{ + if ((lpFrontBuffer && IDirectDrawSurface_IsLost(lpFrontBuffer) == DDERR_SURFACELOST) || + (lpBackBuffer && IDirectDrawSurface_IsLost(lpBackBuffer) == DDERR_SURFACELOST)) + { + if (!RestoreGame()) + { + PauseGame(); + return FALSE; + } + } + + + ProcessInput(sInput); + NewGameFrame(); + return TRUE; + +} /* ProcessFox */ + +static HFONT hFont; + +DWORD dwFrameCount; +DWORD dwFrameTime; +DWORD dwFrames; +DWORD dwFramesLast; +SIZE sizeFPS; +SIZE sizeINFO; +int FrameRateX; +char szFPS[] = "FPS %02d"; +char szINFO[] = "%dx%dx%d%s F6=mode F8=x2 ALT+ENTER=Window"; +char szINFOW[] = "%dx%dx%d%s F6=mode F8=x2 ALT+ENTER=Fullscreen"; + +char szFrameRate[128]; +char szInfo[128]; + +COLORREF InfoColor = RGB(0,152,245); +COLORREF FrameRateColor = RGB(255,255,0); +COLORREF BackColor = RGB(255,255,255); + +/* + * initNumSurface + */ +void initNumSurface( void ) +{ + HDC hdc; + RECT rc; + int len; + + dwFramesLast = 0; + + len = wsprintf(szFrameRate, szFPS, 0, 0); + + if( lpFrameRate && IDirectDrawSurface_GetDC(lpFrameRate, &hdc ) == DD_OK ) + { + SelectObject(hdc, hFont); + SetTextColor(hdc, FrameRateColor); + SetBkColor(hdc, BackColor); + SetBkMode(hdc, OPAQUE); + SetRect(&rc, 0, 0, 10000, 10000); + ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, szFrameRate, len, NULL); + GetTextExtentPoint(hdc, szFrameRate, 4, &sizeFPS); + FrameRateX = sizeFPS.cx; + GetTextExtentPoint(hdc, szFrameRate, len, &sizeFPS); + + IDirectDrawSurface_ReleaseDC(lpFrameRate, hdc); + } + + if (bFullscreen) + len = wsprintf(szInfo, szINFO, + GameSize.cx, GameSize.cy, GameBPP,bStretch ? " x2" : ""); + else + len = wsprintf(szInfo, szINFOW, + GameSize.cx, GameSize.cy, GameBPP,bStretch ? " x2" : ""); + + if( lpInfo && IDirectDrawSurface_GetDC(lpInfo, &hdc ) == DD_OK ) + { + SelectObject(hdc, hFont); + SetTextColor(hdc, InfoColor); + SetBkColor(hdc, BackColor); + SetBkMode(hdc, OPAQUE); + SetRect(&rc, 0, 0, 10000, 10000); + ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, szInfo, len, NULL); + GetTextExtentPoint(hdc, szInfo, len, &sizeINFO); + + IDirectDrawSurface_ReleaseDC(lpInfo, hdc); + } + +} /* initNumSurface */ + +/* + * makeFontStuff + */ +static BOOL makeFontStuff( void ) +{ + DDCOLORKEY ddck; + HDC hdc; + + if (hFont != NULL) + { + DeleteObject(hFont); + } + + hFont = CreateFont( + GameSize.cx <= 512 ? 12 : 24, + 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, + ANSI_CHARSET, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + NONANTIALIASED_QUALITY, // DEFAULT_QUALITY, + VARIABLE_PITCH, + "Arial" ); + + /* + * make a sample string so we can measure it with the current font. + */ + initNumSurface(); + + hdc = GetDC(NULL); + SelectObject(hdc, hFont); + GetTextExtentPoint(hdc, szFrameRate, lstrlen(szFrameRate), &sizeFPS); + GetTextExtentPoint(hdc, szInfo, lstrlen(szInfo), &sizeINFO); + ReleaseDC(NULL, hdc); + + /* + * Create a surface to copy our bits to. + */ + lpFrameRate = DDCreateSurface(sizeFPS.cx, sizeFPS.cy, FALSE,TRUE); + lpInfo = DDCreateSurface(sizeINFO.cx, sizeINFO.cy, FALSE,TRUE); + + if( lpFrameRate == NULL || lpInfo == NULL ) + { + return FALSE; + } + + /* + * now set the color key, we use a totaly different color than + * the rest of the app, just to be different so drivers dont always + * get white or black as the color key... + * + * dont forget when running on a dest colorkey device, we need + * to use the same color key as the rest of the app. + */ + if( bTransDest ) + BackColor = RGB(255,255,255); + else + BackColor = RGB(128,64,255); + + ddck.dwColorSpaceLowValue = DDColorMatch(lpInfo, BackColor); + ddck.dwColorSpaceHighValue = ddck.dwColorSpaceLowValue; + + IDirectDrawSurface_SetColorKey( lpInfo, DDCKEY_SRCBLT, &ddck); + IDirectDrawSurface_SetColorKey( lpFrameRate, DDCKEY_SRCBLT, &ddck); + + /* + * now draw the text for real + */ + initNumSurface(); + + return TRUE; +} + +/* + * DisplayFrameRate + */ +void DisplayFrameRate( void ) +{ + DWORD time2; + char buff[256]; + HDC hdc; + HRESULT ddrval; + RECT rc; + DWORD dw; + + if( !bShowFrameCount ) + { + return; + } + + dwFrameCount++; + time2 = timeGetTime() - dwFrameTime; + if( time2 > 1000 ) + { + dwFrames = (dwFrameCount*1000)/time2; + dwFrameTime = timeGetTime(); + dwFrameCount = 0; + + AveFrameRate += dwFrames; + AveFrameRateCount++; + } + + if( dwFrames == 0 ) + { + return; + } + + if( dwFrames != dwFramesLast ) + { + dwFramesLast = dwFrames; + + if( IDirectDrawSurface_GetDC(lpFrameRate, &hdc ) == DD_OK ) + { + buff[0] = (char)((dwFrames / 10) + '0'); + buff[1] = (char)((dwFrames % 10) + '0'); + + SelectObject(hdc, hFont); + SetTextColor(hdc, FrameRateColor); + SetBkColor(hdc, BackColor); + TextOut(hdc, FrameRateX, 0, buff, 2); + + IDirectDrawSurface_ReleaseDC(lpFrameRate, hdc); + } + } + + /* + * put the text on the back buffer. + */ + if (bTransDest) + dw = DDBLTFAST_DESTCOLORKEY | DDBLTFAST_WAIT; + else + dw = DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT; + + SetRect(&rc, 0, 0, sizeFPS.cx, sizeFPS.cy); + ddrval = IDirectDrawSurface_BltFast(lpBackBuffer, + GameRect.left + (GameSize.cx - sizeFPS.cx)/2, GameRect.top + 20, + lpFrameRate, &rc, dw); + + SetRect(&rc, 0, 0, sizeINFO.cx, sizeINFO.cy); + ddrval = IDirectDrawSurface_BltFast(lpBackBuffer, + GameRect.left + 10, GameRect.bottom - sizeINFO.cy - 10, + lpInfo, &rc, dw); + +} /* DisplayFrameRate */ + +/* + * MainWndProc + * + * Callback for all Windows messages + */ +long FAR PASCAL MainWndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + PAINTSTRUCT ps; + HDC hdc; + int i; + + switch( message ) + { + case WM_SIZE: + case WM_MOVE: + if (IsIconic(hWnd)) + { + Msg("FoxBear is minimized, pausing"); + PauseGame(); + } + + if (bFullscreen) + { + SetRect(&rcWindow, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + } + else + { + GetClientRect(hWnd, &rcWindow); + ClientToScreen(hWnd, (LPPOINT)&rcWindow); + ClientToScreen(hWnd, (LPPOINT)&rcWindow+1); + } + Msg("WINDOW RECT: [%d,%d,%d,%d]", rcWindow.left, rcWindow.top, rcWindow.right, rcWindow.bottom); + break; + + case WM_ACTIVATEAPP: + bIsActive = (BOOL)wParam && GetForegroundWindow() == hWnd; + + if (bIsActive) + Msg("FoxBear is active"); + else + Msg("FoxBear is not active"); + + // + // while we were not-active something bad happened that caused us + // to pause, like a surface restore failing or we got a palette + // changed, now that we are active try to fix things + // + if (bPaused && bIsActive) + { + if (RestoreGame()) + { + UnPauseGame(); + } + else + { + if (GetForegroundWindow() == hWnd) + { + // + // we are unable to restore, this can happen when + // the screen resolution or bitdepth has changed + // we just reload all the art again and re-create + // the front and back buffers. this is a little + // overkill we could handle a screen res change by + // just recreating the front and back buffers we dont + // need to redo the art, but this is way easier. + // + if (InitGame()) + { + UnPauseGame(); + } + } + } + } + break; + + case WM_QUERYNEWPALETTE: + // + // we are getting the palette focus, select our palette + // + if (!bFullscreen && lpPalette && lpFrontBuffer) + { + HRESULT ddrval; + + ddrval = IDirectDrawSurface_SetPalette(lpFrontBuffer,lpPalette); + if( ddrval == DDERR_SURFACELOST ) + { + IDirectDrawSurface_Restore( lpFrontBuffer ); + + ddrval= IDirectDrawSurface_SetPalette(lpFrontBuffer,lpPalette); + if( ddrval == DDERR_SURFACELOST ) + { + Msg(" Failed to restore palette after second try"); + } + } + + // + // Restore normal title if palette is ours + // + + if( ddrval == DD_OK ) + { + SetWindowText( hWnd, OUR_APP_NAME ); + } + } + break; + + case WM_PALETTECHANGED: + // + // if another app changed the palette we dont have full control + // of the palette. NOTE this only applies for FoxBear in a window + // when we are fullscreen we get all the palette all of the time. + // + if ((HWND)wParam != hWnd) + { + if( !bFullscreen ) + { + if( !bStress ) + { + Msg("***** PALETTE CHANGED, PAUSING GAME"); + PauseGame(); + } + else + { + Msg("Lost palette but continuing"); + SetWindowText( hWnd, OUR_APP_NAME + " - palette changed COLORS PROBABLY WRONG" ); + } + } + } + break; + + case WM_DISPLAYCHANGE: + break; + + case WM_CREATE: + break; + + case WM_SETCURSOR: + if (bFullscreen && bIsActive) + { + SetCursor(NULL); + return TRUE; + } + break; + + case WM_SYSKEYUP: + switch( wParam ) + { + // handle ALT+ENTER (fullscreen) + case VK_RETURN: + bFullscreen = !bFullscreen; + ExitGame(); + DDDisable(TRUE); // destroy DirectDraw object + InitGame(); + break; + } + break; + + case WM_KEYDOWN: + switch( wParam ) + { + case VK_NUMPAD5: + lastInput=KEY_STOP; + break; + case VK_DOWN: + case VK_NUMPAD2: + lastInput=KEY_DOWN; + break; + case VK_LEFT: + case VK_NUMPAD4: + lastInput=KEY_LEFT; + break; + case VK_RIGHT: + case VK_NUMPAD6: + lastInput=KEY_RIGHT; + break; + case VK_UP: + case VK_NUMPAD8: + lastInput=KEY_UP; + break; + case VK_HOME: + case VK_NUMPAD7: + lastInput=KEY_JUMP; + break; + case VK_NUMPAD3: + lastInput=KEY_THROW; + break; + case VK_F5: + bShowFrameCount = !bShowFrameCount; + if( bShowFrameCount ) + { + dwFrameCount = 0; + dwFrameTime = timeGetTime(); + } + break; + + case VK_F6: + // + // find our current mode in the mode list + // + if(bFullscreen) + { + for (i=0; i<NumModes; i++) + { + if (ModeList[i].bpp == (int)GameBPP && + ModeList[i].w == GameSize.cx && + ModeList[i].h == GameSize.cy) + { + break; + } + } + }else + { + for (i=0; i<NumModes; i++) + { + if (ModeList[i].w == GameSize.cx && + ModeList[i].h == GameSize.cy) + { + break; + } + } + } + // + // now step to the next mode, wrapping to the first one. + // + if (++i >= NumModes) + i = 0; +Msg("ModeList %d %d",i,NumModes); + GameMode.cx = ModeList[i].w; + GameMode.cy = ModeList[i].h; + GameBPP = ModeList[i].bpp; + bStretch = FALSE; + InitGame(); + break; + + case VK_F7: + GameBPP = GameBPP == 8 ? 16 : 8; + InitGame(); + break; + + case VK_F8: + if (bFullscreen) + { + bStretch = !bStretch; + InitGame(); + } + else + { + RECT rc; + + GetClientRect(hWnd, &rc); + + bStretch = (rc.right != GameSize.cx) || + (rc.bottom != GameSize.cy); + + if (bStretch = !bStretch) + SetRect(&rc, 0, 0, GameMode.cx*2, GameMode.cy*2); + else + SetRect(&rc, 0, 0, GameMode.cx, GameMode.cy); + + AdjustWindowRectEx(&rc, + GetWindowStyle(hWnd), + GetMenu(hWnd) != NULL, + GetWindowExStyle(hWnd)); + + SetWindowPos(hWnd, NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, + SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + } + break; + + case VK_F4: + // treat F4 like ALT+ENTER (fullscreen) + PostMessage(hWnd, WM_SYSKEYUP, VK_RETURN, 0); + break; + + case VK_F3: + bPaused = !bPaused; + break; + + case VK_ESCAPE: + case VK_F12: + PostMessage(hWnd, WM_CLOSE, 0, 0); + return 0; + } + break; + + case WM_PAINT: + hdc = BeginPaint( hWnd, &ps ); + if (bPaused) + { + char *sz = "Game is paused, this is not a bug."; + TextOut(ps.hdc, 0, 0, sz, lstrlen(sz)); + } + EndPaint( hWnd, &ps ); + return 1; + + case WM_DESTROY: + hWndMain = NULL; + lastInput=0; + DestroyGame(); // end of game + DDDisable(TRUE); // destroy DirectDraw object + PostQuitMessage( 0 ); + break; + } + + return DefWindowProc(hWnd, message, wParam, lParam); + +} /* MainWndProc */ + +/* + * initApplication + * + * Do that Windows initialization stuff... + */ +static BOOL initApplication( HINSTANCE hInstance, int nCmdShow ) +{ + WNDCLASS wc; + BOOL rc; + + wc.style = CS_DBLCLKS; + wc.lpfnWndProc = MainWndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon( hInstance, MAKEINTATOM(FOX_ICON)); + wc.hCursor = LoadCursor( NULL, IDC_ARROW ); + wc.hbrBackground = GetStockObject(BLACK_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = "WinFoxClass"; + rc = RegisterClass( &wc ); + if( !rc ) + { + return FALSE; + } + + + hWndMain = CreateWindowEx( + WS_EX_APPWINDOW, + "WinFoxClass", + OUR_APP_NAME, + WS_VISIBLE | // so we dont have to call ShowWindow + WS_SYSMENU | // so we get a icon in in our tray button + WS_POPUP, + 0, + 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + NULL, + NULL, + hInstance, + NULL ); + + if( !hWndMain ) + { + return FALSE; + } + + UpdateWindow( hWndMain ); + SetFocus( hWndMain ); + + return TRUE; + +} /* initApplication */ + +/* + * ExitGame + * + * Exiting current game, clean up + */ +void ExitGame( void ) +{ + if( lpFrameRate ) + { + IDirectDrawSurface_Release(lpFrameRate); + lpFrameRate = NULL; + } + + if( lpInfo ) + { + IDirectDrawSurface_Release(lpInfo); + lpInfo = NULL; + } + + if( lpPalette ) + { + IDirectDrawSurface_Release(lpPalette); + lpPalette = NULL; + } + + DestroyGame(); + +} /* ExitGame */ + +/* + * InitGame + * + * Initializing current game + */ +BOOL InitGame( void ) +{ + ExitGame(); + + GameSize = GameMode; + + /* + * initialize sound + */ + InitSound( hWndMain ); + + /* + * init DirectDraw, set mode, ... + * NOTE GameMode might be set to 640x480 if we cant get the asked for mode. + */ + if( !PreInitializeGame() ) + { + return FALSE; + } + + if (bStretch && bFullscreen) + { + GameSize.cx = GameMode.cx / 2; + GameSize.cy = GameMode.cy / 2; + GameRect.left = GameMode.cx - GameSize.cx; + GameRect.top = GameMode.cy - GameSize.cy; + GameRect.right = GameMode.cx; + GameRect.bottom = GameMode.cy; + + if (lpStretchBuffer) + Msg("Stretching using a system-memory stretch buffer"); + else + Msg("Stretching using a VRAM->VRAM blt"); + } + else + { + GameRect.left = (GameMode.cx - GameSize.cx) / 2; + GameRect.top = (GameMode.cy - GameSize.cy) / 2; + GameRect.right = GameRect.left + GameSize.cx; + GameRect.bottom = GameRect.top + GameSize.cy; + } + + /* + * setup our palette + */ + if( GameBPP == 8 ) + { + lpPalette = ReadPalFile( NULL ); // create a 332 palette + + if( lpPalette == NULL ) + { + Msg( "Palette create failed" ); + return FALSE; + } + + IDirectDrawSurface_SetPalette( lpFrontBuffer, lpPalette ); + } + + /* + * load all the art and things. + */ + if( !InitializeGame() ) + { + return FALSE; + } + + /* + * init our code to draw the FPS + */ + makeFontStuff(); + + /* + * spew some stats + */ + { + DDCAPS ddcaps; + ddcaps.dwSize = sizeof( ddcaps ); + IDirectDraw_GetCaps( lpDD, &ddcaps, NULL ); + Msg( "Total=%ld, Free VRAM=%ld", ddcaps.dwVidMemTotal, ddcaps.dwVidMemFree ); + Msg( "Used = %ld", ddcaps.dwVidMemTotal- ddcaps.dwVidMemFree ); + } + + return TRUE; + +} /* InitGame */ + +#define IS_NUM(c) ((c) >= '0' && (c) <= '9') +#define IS_SPACE(c) ((c) == ' ' || (c) == '\r' || (c) == '\n' || (c) == '\t' || (c) == 'x') + +int getint(char**p, int def) +{ + int i=0; + + while (IS_SPACE(**p)) + (*p)++; + + if (!IS_NUM(**p)) + return def; + + while (IS_NUM(**p)) + i = i*10 + *(*p)++ - '0'; + + while (IS_SPACE(**p)) + (*p)++; + + return i; +} + +/* + * WinMain + */ +int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, + int nCmdShow ) +{ + MSG msg; + + while( lpCmdLine[0] == '-' ) + { + lpCmdLine++; + + switch (*lpCmdLine++) + { + case 'e': + bUseEmulation = TRUE; + break; + case 'w': + bFullscreen = FALSE; + break; + case 'f': + bFullscreen = TRUE; + break; + case '1': + CmdLineBufferCount = 1; + break; + case '2': + case 'd': + CmdLineBufferCount = 2; + break; + case '3': + CmdLineBufferCount = 3; + break; + case 's': + bStretch = TRUE; + break; + case 'S': + bWantSound = FALSE; + break; + case 'x': + bStress= TRUE; + break; + case '?': + bHelp= TRUE; + bFullscreen= FALSE; // give help in windowed mode + break; + } + + while( IS_SPACE(*lpCmdLine) ) + { + lpCmdLine++; + } + } + + GameMode.cx = getint(&lpCmdLine, 640); + GameMode.cy = getint(&lpCmdLine, 480); + GameBPP = getint(&lpCmdLine, 8); + + /* + * create window and other windows things + */ + if( !initApplication(hInstance, nCmdShow) ) + { + return FALSE; + } + + /* + * Give user help if asked for + * + * This is ugly for now because the whole screen is black + * except for the popup box. This could be fixed with some + * work to get the window size right when it was created instead + * of delaying that work. see ddraw.c + * + */ + + if( bHelp ) + { + MessageBox(hWndMain, + "F12 - Quit\n" + "NUMPAD 2 - crouch\n" + "NUMPAD 3 - apple\n" + "NUMPAD 4 - right\n" + "NUMPAD 5 - stop\n" + "NUMPAD 6 - left\n" + "NUMPAD 7 - jump\n" + "\n" + "Command line parameters\n" + "\n" + "-e Use emulator\n" + "-S No Sound\n" + "-1 No backbuffer\n" + "-2 One backbuffer\n" + "-4 Three backbuffers\n" + "-s Use stretch\n" + "-x Demo or stress mode\n", + OUR_APP_NAME, MB_OK ); + } + + /* + * initialize for game play + */ + if( !InitGame() ) + { + return FALSE; + } + + dwFrameTime = timeGetTime(); + + while( 1 ) + { + if (PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE)) + { + if (!GetMessage( &msg, NULL, 0, 0)) + { + break; + } + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else if (!bPaused && (bIsActive || !bFullscreen)) + { + ProcessFox(lastInput); + lastInput=0; + } + else + { + WaitMessage(); + } + } + + if (AveFrameRateCount) + { + AveFrameRate = AveFrameRate / AveFrameRateCount; + Msg("Average frame rate: %d", AveFrameRate); + } + + return msg.wParam; + +} /* WinMain */ + +#ifdef DEBUG + +/* + * Msg + */ +void __cdecl Msg( LPSTR fmt, ... ) +{ + char buff[256]; + va_list va; + + va_start(va, fmt); + + // + // format message with header + // + + lstrcpy( buff, "FOXBEAR:" ); + wvsprintf( &buff[lstrlen(buff)], fmt, va ); + lstrcat( buff, "\r\n" ); + + // + // To the debugger unless we need to be quiet + // + + if( !bStress ) + { + OutputDebugString( buff ); + } + +} /* Msg */ + +#endif diff --git a/sdk/samples/foxbear/foxbear.def b/sdk/samples/foxbear/foxbear.def new file mode 100644 index 0000000..67ea40c --- /dev/null +++ b/sdk/samples/foxbear/foxbear.def @@ -0,0 +1,3 @@ +NAME FOXBEAR + +DESCRIPTION 'Fox & Bear Sample Game' diff --git a/sdk/samples/foxbear/foxbear.h b/sdk/samples/foxbear/foxbear.h new file mode 100644 index 0000000..c2ebcef --- /dev/null +++ b/sdk/samples/foxbear/foxbear.h @@ -0,0 +1,119 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: foxbear.h + * Content: main include file + * + ***************************************************************************/ +#ifndef __FOXBEAR_INCLUDED__ +#define __FOXBEAR_INCLUDED__ + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <ddraw.h> +#include <dsound.h> +#include "gfx.h" +#include "fbsound.h" +#include "gameproc.h" +#include "fastfile.h" +#include "dsutil.h" + +int getint(char**p, int def); + +#define QUOTE(x) #x +#define QQUOTE(y) QUOTE(y) +#define REMIND(str) __FILE__ "(" QQUOTE(__LINE__) "):" str + +/* + * keyboard commands + */ +enum +{ + KEY_STOP = 1, + KEY_DOWN, + KEY_LEFT, + KEY_RIGHT, + KEY_UP, + KEY_JUMP, + KEY_THROW +}; + +/* + * global data + */ +extern LPDIRECTDRAW lpDD; +extern LPDIRECTDRAWSURFACE lpFrontBuffer; +extern LPDIRECTDRAWSURFACE lpBackBuffer; +extern LPDIRECTDRAWSURFACE lpStretchBuffer; +extern LPDIRECTDRAWCLIPPER lpClipper; +extern DWORD lastKey; +extern BOOL bModeX; // we are in a modex mode +extern BOOL bColorFill; // device supports color fill +extern BOOL bTransDest; // we should use dest color key +extern BOOL bColorFill; // device supports color fill +extern int nBufferCount; // buffer count +extern int CmdLineBufferCount; // buffer count +extern BOOL bStretch; // stretch +extern BOOL bFullscreen; // run in fullscreen mode +extern BOOL bStress; // just keep running +extern BOOL bUseEmulation; // dont use HW use SW +extern RECT GameRect; // game is here +extern SIZE GameSize; // game is this size +extern SIZE GameMode; // display mode size +extern UINT GameBPP; // the bpp we want +extern DWORD dwColorKey; // the color key +extern HWND hWndMain; // the foxbear window +extern RECT rcWindow; // where the FoxBear window is. +extern BOOL bIsActive; // we are the active app. +extern BOOL bPaused; // +extern BOOL bWantSound; // Set the default action in DSEnable + +/* + * list of display modes + */ +struct {int w, h, bpp;} ModeList[100]; +int NumModes; + +/* + * map a point that assumes 640x480 to the current game size. + */ +#define MapDX(x) (((x) * GameSize.cx) / C_SCREEN_W) +#define MapDY(y) (((y) * GameSize.cy) / C_SCREEN_H) +#define MapX(x) (GameRect.left + MapDX(x)) +#define MapY(y) (GameRect.top + MapDY(y)) +#define MapRX(x) ((GameSize.cx == C_SCREEN_W) ? x : MapDX(x)+1) +#define MapRY(y) ((GameSize.cy == C_SCREEN_H) ? y : MapDY(y)+1) + +void PauseGame(void); +void UnPauseGame(void); + + +/* + * fn prototypes + */ +/* ddraw.c */ +extern BOOL DDEnable( void ); +extern BOOL DDDisable( BOOL ); +extern LPDIRECTDRAWSURFACE DDCreateSurface( DWORD width, DWORD height, BOOL sysmem, BOOL trans ); +extern BOOL DDCreateFlippingSurface( void ); +extern BOOL DDClear( void ); +extern DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb); +extern void Splash( void ); + +extern LPVOID CMemAlloc( UINT cnt, UINT isize ); +extern LPVOID MemAlloc( UINT size ); +extern void MemFree( LPVOID ptr ); + +#ifdef DEBUG +extern void __cdecl Msg( LPSTR fmt, ... ); +#else +#define Msg ; / ## / +#endif + +LPDIRECTDRAWPALETTE ReadPalFile( char *fname ); + +#endif diff --git a/sdk/samples/foxbear/foxbear.rc b/sdk/samples/foxbear/foxbear.rc new file mode 100644 index 0000000..83c7920 --- /dev/null +++ b/sdk/samples/foxbear/foxbear.rc @@ -0,0 +1,17 @@ +#include "rcids.h" + +FOX_ICON ICON FOX.ICO + +FORELIST RCDATA FORELIST.DAT +MIDLIST RCDATA MIDLIST.DAT +SURFLIST RCDATA SURFLIST.DAT +BACKLIST RCDATA BACKLIST.DAT + +MISS01 WAV MISS01.WAV +JUMP WAV JUMP.WAV +MISS02 WAV MISS02.WAV +STOP WAV STOP.WAV +STRIKE02 WAV STRIKE02.WAV +STUNNED WAV STUNNED.WAV +THROW WAV THROW.WAV +STRIKE01 WAV STRIKE01.WAV diff --git a/sdk/samples/foxbear/gameproc.c b/sdk/samples/foxbear/gameproc.c new file mode 100644 index 0000000..5a78c2c --- /dev/null +++ b/sdk/samples/foxbear/gameproc.c @@ -0,0 +1,1370 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: gameproc.c + * Content: Game processing routines + * + ***************************************************************************/ +#include "foxbear.h" + +GFX_HBM hBuffer; +HBITMAPLIST *hBitmapList; +HBITMAPLIST *hTileList; +HPOSLIST *hForePosList; +HPOSLIST *hMidPosList; +HPOSLIST *hBackPosList; +HSURFACELIST *hSurfaceList; +HPLANE *hForeground; +HPLANE *hMidground; +HPLANE *hBackground; +HSPRITE *hFox; +HSPRITE *hBear; +HSPRITE *hApple; +USHORT chewCount; +LONG chewDif; + +/* + * ErrorMessage + */ +void ErrorMessage( CHAR *pText ) +{ + char ach[128]; + + wsprintf( ach, "FOXBEAR FATAL ERROR: %s\r\n", pText ); + OutputDebugString(ach); + gfxEnd( hBuffer ); + exit( 0 ); + +} /* ErrorMessage */ + +/* + * InitBuffer + */ +BOOL InitBuffer( GFX_HBM *hBuffer ) +{ + *hBuffer = gfxBegin(); + + if( *hBuffer == NULL ) + { + ErrorMessage( "gfxBegin failed" ); + return FALSE; + } + return TRUE; + +} /* InitBuffer */ + +/* + * DestroyBuffer + */ +void DestroyBuffer ( GFX_HBM hBuffer ) +{ + if( gfxEnd( hBuffer ) == FALSE ) + { + ErrorMessage( "gfxEnd in DestroyBuffer" ); + } + +} /* DestroyBuffer */ + +/* + * LoadBitmaps + */ +HBITMAPLIST *LoadBitmaps( void ) +{ + HBITMAPLIST *hBitmapList; + CHAR fileName[32]; + USHORT i; + USHORT n; + + if( !FastFileInit( "foxbear.art", 5 ) ) + { + Msg( "Could not load art file err=%08lX" , GetLastError()); + return NULL; + } + hBitmapList = CMemAlloc( C_TILETOTAL + C_FBT + C_BBT, sizeof (HBITMAPLIST) ); + + Msg( "Loading tiles" ); + for( i = 0; i < C_TILETOTAL; ++i ) + { + wsprintf( fileName, "%03u.BMP", i + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n = C_TILETOTAL; + + Msg( "Loading FoxWalk" ); + for( i = n; i < n + C_FOXWALK; ++i ) + { + wsprintf( fileName, "FW%02uR.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXWALK; + + Msg( "Loading FoxWalk2" ); + for( i = n; i < n + C_FOXWALK; ++i ) + { + wsprintf( fileName, "FW%02uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXWALK; + + Msg( "Loading FoxRun" ); + for( i = n; i < n + C_FOXRUN; ++i ) + { + wsprintf( fileName, "FR%02uR.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXRUN; + + Msg( "Loading FoxRun2" ); + for( i = n; i < n + C_FOXRUN; ++i ) + { + wsprintf( fileName, "FR%02uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXRUN; + + Msg( "Loading FoxStill" ); + for( i = n; i < n + C_FOXSTILL; ++i ) + { + wsprintf( fileName, "FS%1uR.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXSTILL; + + Msg( "Loading FoxStill2" ); + for( i = n; i < n + C_FOXSTILL; ++i ) + { + wsprintf( fileName, "FS%1uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXSTILL; + + Msg( "Loading FoxStunned" ); + for( i = n; i < n + C_FOXSTUNNED; ++i ) + { + wsprintf( fileName, "FK%1uR.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXSTUNNED; + + Msg( "Loading FoxStunned2" ); + for( i = n; i < n + C_FOXSTUNNED; ++i ) + { + wsprintf( fileName, "FK%1uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXSTUNNED; + + Msg( "Loading FoxCrouch" ); + for( i = n; i < n + C_FOXCROUCH; ++i ) + { + wsprintf( fileName, "FC%1uR.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXCROUCH; + + Msg( "Loading FoxCrouch2" ); + for( i = n; i < n + C_FOXCROUCH; ++i ) + { + wsprintf( fileName, "FC%1uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXCROUCH; + + Msg( "Loading FoxStop" ); + for( i = n; i < n + C_FOXSTOP; ++i ) + { + wsprintf( fileName, "FCD%1uR.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXSTOP; + + Msg( "Loading FoxStop2" ); + for( i = n; i < n + C_FOXSTOP; ++i ) + { + wsprintf( fileName, "FCD%1uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXSTOP; + + Msg( "Loading FoxThrow" ); + for( i = n; i < n + C_FOXTHROW; ++i ) + { + wsprintf( fileName, "FT%1uR.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXTHROW; + + Msg( "Loading FoxThrow2" ); + for( i = n; i < n + C_FOXTHROW; ++i ) + { + wsprintf( fileName, "FT%1uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXTHROW; + + Msg( "Loading FoxJumpThrow" ); + for( i = n; i < n + C_FOXJUMPTHROW; ++i ) + { + wsprintf( fileName, "FJT%1uR.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXJUMPTHROW; + + Msg( "Loading FoxJumpThrow2" ); + for( i = n; i < n + C_FOXJUMPTHROW; ++i ) + { + wsprintf( fileName, "FJT%1uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXJUMPTHROW; + + Msg( "Loading FoxJump" ); + for( i = n; i < n + C_FOXJUMP; ++i ) + { + wsprintf( fileName, "FJ%1uR.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXJUMP; + + Msg( "Loading FoxJump2" ); + for( i = n; i < n + C_FOXJUMP; ++i ) + { + wsprintf( fileName, "FJ%1uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXJUMP; + + Msg( "Loading FoxCrouchWalk" ); + for( i = n; i < n + C_FOXCROUCHWALK; ++i ) + { + wsprintf( fileName, "FCW%02uR.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXCROUCHWALK; + + Msg( "Loading FoxCrouchWalk2" ); + for( i = n; i < n + C_FOXCROUCHWALK; ++i ) + { + wsprintf( fileName, "FCW%02uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXCROUCHWALK; + + Msg( "Loading FoxBlurr" ); + for( i = n; i < n + C_FOXBLURR; ++i ) + { + wsprintf( fileName, "FB%02uR.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXBLURR; + + Msg( "Loading FoxBlurr2" ); + for( i = n; i < n + C_FOXBLURR; ++i ) + { + wsprintf( fileName, "FB%02uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_FOXBLURR; + + Msg( "Loading BearMiss" ); + for( i = n; i < n + C_BEARMISS; ++i ) + { + wsprintf( fileName, "BM%1uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_BEARMISS; + + Msg( "Loading BearStrike" ); + for( i = n; i < n + C_BEARSTRIKE; ++i ) + { + wsprintf( fileName, "BS%02uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_BEARSTRIKE; + + Msg( "Loading BearWalk" ); + for( i = n; i < n + C_BEARWALK; ++i ) + { + wsprintf( fileName, "BW%02uL.BMP", i - n + 1 ); + hBitmapList[i].hBM = gfxLoadBitmap( fileName ); + } + n += C_BEARWALK; + + FastFileFini(); + + return hBitmapList; + +} /* LoadBitmaps */ + +/* + * InitTiles + */ +void InitTiles( + HBITMAPLIST **hTileList, + HBITMAPLIST *hBitmapList, + USHORT tileCount ) +{ + *hTileList = CreateTiles( hBitmapList, tileCount ); + +} /* InitTiles */ + +/* + * InitPlane + */ +void InitPlane( + HPLANE **hPlane, + HPOSLIST **hPosList, + LPSTR szFileName, + USHORT width, + USHORT height, + USHORT denom ) +{ + *hPlane = CreatePlane( width, height, denom ); + *hPosList = CreatePosList( szFileName, width, height ); + +} /* InitPlane */ + +/* + * InitSurface + */ +void InitSurface( + HSURFACELIST **pphSurfaceList, + CHAR *szFileName, + USHORT width, + USHORT height ) +{ + *pphSurfaceList = CreateSurfaceList( szFileName, width, height ); + +} /* InitSurface */ + +/* + * InitFox + */ +void InitFox ( HSPRITE **pphFox, HBITMAPLIST *phBitmapList ) +{ + GFX_HBM hBM; + GFX_HBM hBM_src; + ACTION action; + DIRECTION direction; + USHORT i; + + LONG startX = C_FOX_STARTX; + LONG startY = C_FOX_STARTY; + USHORT boundW = 108; + USHORT boundH = 105; + LONG as = 6; + SHORT x[C_FBT] = { 7, 15, 18, 11, 6, 3, 7, 15, 17, 11, 6, 3, + 7, 15, 18, 11, 6, 3, 7, 15, 17, 11, 6, 3, + 10, 3, 5, 16, 9, 13, 31, 24, 9, 3, 5, 16, 10, 13, 33, 23, + 10, 3, 5, 16, 9, 13, 31, 24, 9, 3, 5, 16, 10, 13, 33, 23, + 11, 11, 31, 31, 7, 7, 27, 27, 8, 10, 8, 10, + 26, 6, 26, 6, 17, 21, 21, 24, 17, 21, 21, 24, + 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, + 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, + 2, 2, -1, 0, 2, 2, -1, 0 }; + SHORT y[C_FBT] = { 20, 24, 26, 25, 27, 19, 20, 25, 26, 25, 29, 21, + 20, 24, 26, 25, 27, 19, 20, 25, 26, 25, 29, 21, + 42, 42, 31, 19, 13, 11, 20, 33, 40, 43, 31, 19, 14, 12, 20, 33, + 42, 42, 31, 19, 13, 11, 20, 33, 40, 43, 31, 19, 14, 12, 20, 33, + 14, 14, 20, 20, 58, 58, 26, 26, 20, 24, 20, 24, + 0, 9, 0, 9, 20, 11, 10, 9, 20, 11, 10, 9, + 61, 61, 61, 61, 60, 60, 61, 61, 61, 61, 60, 60, + 61, 61, 61, 61, 60, 60, 61, 61, 61, 61, 60, 60, + 45, 45, 45, 45, 45, 45, 45, 45 }; + USHORT w[C_FBT] = { 75, 73, 73, 82, 92, 84, 74, 74, 73, 81, 91, 84, + 75, 73, 73, 82, 92, 84, 74, 74, 73, 81, 91, 84, + 88, 92, 88, 78, 80, 78, 70, 84, 88, 92, 88, 78, 79, 79, 68, 85, + 88, 92, 88, 78, 80, 78, 70, 84, 88, 92, 88, 78, 79, 79, 68, 85, + 65, 65, 61, 61, 88, 88, 72, 72, 57, 86, 57, 86, + 54, 92, 54, 92, 59, 57, 57, 52, 59, 57, 57, 52, + 98, 99, 99, 99,100,100, 98,101,100, 99,100, 98, + 98, 99, 99, 99,100,100, 98,101,100, 99,100, 98, + 94, 94, 97, 96, 94, 94, 97, 96 }; + USHORT h[C_FBT] = { 78, 74, 72, 73, 71, 79, 78, 73, 72, 73, 69, 77, + 78, 74, 72, 73, 71, 79, 78, 73, 72, 73, 69, 77, + 56, 56, 67, 79, 85, 87, 78, 65, 58, 55, 67, 79, 84, 86, 78, 65, + 56, 56, 67, 79, 85, 87, 78, 65, 58, 55, 67, 79, 84, 86, 78, 65, + 84, 84, 85, 85, 40, 40, 72, 72, 78, 74, 78, 74, + 88, 82, 88, 82, 84, 87, 86, 85, 84, 87, 86, 85, + 37, 37, 37, 37, 38, 38, 37, 37, 37, 37, 38, 38, + 37, 37, 37, 37, 38, 38, 37, 37, 37, 37, 38, 38, + 54, 53, 51, 54, 54, 53, 51, 54 }; + + *pphFox = CreateSprite( C_FBT, startX, startY, boundW, boundH, C_FORE_W * C_TILE_W, C_FORE_H * C_TILE_H, (SHORT) as, TRUE ); + + for( i = 0; i < C_FBT; ++i ) + { + hBM_src = phBitmapList[i + C_TILETOTAL].hBM; + + if( i < 12 ) + { + action = WALK; + direction = RIGHT; + } + else if( (i >= 12) && (i < 24) ) + { + action = WALK; + direction = LEFT; + } + else if( (i >= 24) && (i < 40) ) + { + action = RUN; + direction = RIGHT; + } + else if( (i >= 40) && (i < 56) ) + { + action = RUN; + direction = LEFT; + } + else if( i == 56 ) + { + action = STILL; + direction = RIGHT; + } + else if( i == 57 ) + { + action = STILL; + direction = LEFT; + } + else if( i == 58 ) + { + action = STUNNED; + direction = RIGHT; + } + else if( i == 59 ) + { + action = STUNNED; + direction = LEFT; + } + else if( i == 60 ) + { + action = CROUCH; + direction = RIGHT; + } + else if( i == 61 ) + { + action = CROUCH; + direction = LEFT; + } + else if( i == 62 ) + { + action = STOP; + direction = RIGHT; + } + else if( i == 63 ) + { + action = STOP; + direction = LEFT; + } + else if( (i >= 64) && (i < 66) ) + { + action = THROW; + direction = RIGHT; + } + else if( (i >= 66) && (i < 68) ) + { + action = THROW; + direction = LEFT; + } + else if( (i >= 68) && (i < 70) ) + { + action = JUMPTHROW; + direction = RIGHT; + } + else if( (i >= 70) && (i < 72) ) + { + action = JUMPTHROW; + direction = LEFT; + } + else if( (i >= 72) && (i < 76) ) + { + action = JUMP; + direction = RIGHT; + } + else if( (i >= 76) && (i < 80) ) + { + action = JUMP; + direction = LEFT; + } + else if( (i >= 80) && (i < 92) ) + { + action = CROUCHWALK; + direction = RIGHT; + } + else if( (i >= 92) && (i < 104) ) + { + action = CROUCHWALK; + direction = LEFT; + } + else if( (i >= 104) && (i < 108) ) + { + action = BLURR; + direction = RIGHT; + } + else if( (i >= 108) && (i < 112) ) + { + action = BLURR; + direction = LEFT; + } + + hBM = hBM_src; + + BitBltSprite( + *pphFox, + hBM, + action, + direction, + x[i], + y[i], + w[i], + h[i] ); + } + SetSpriteAction( *pphFox, STILL, RIGHT ); + +} /* InitFox */ + +/* + * InitBear + */ +void InitBear( HSPRITE **pphBear, HBITMAPLIST *phBitmapList ) +{ + GFX_HBM hBM_src; + ACTION action; + DIRECTION direction; + USHORT i; + + LONG startX = C_BEAR_STARTX; + LONG startY = C_BEAR_STARTY; + USHORT boundW = 196; + USHORT boundH = 88; + LONG as = 6; + USHORT x[C_BBT] = { 14, 10, + 8, 12, 13, 14, 10, 10, 9, 9, 9, 9, 8, 9, + 11, 6, 1, 0, 3, 13, 11, 7, 1, 1, 3, 14 }; + USHORT y[C_BBT] = { 7, 7, + 3, 8, 9, 7, 7, 3, 3, 3, 3, 3, 3, 3, + 1, 1, 2, 2, 3, 1, 0, 1, 1, 2, 3, 2 }; + USHORT w[C_BBT] = {127,129, + 127,153,183,153,129,138,146,150,152,151,143,139, + 131,136,140,141,136,125,131,135,140,140,136,126 }; + USHORT h[C_BBT] = { 80, 80, + 84, 79, 78, 80, 80, 84, 84, 84, 84, 84, 84, 84, + 86, 86, 86, 85, 84, 86, 87, 86, 87, 85, 84, 86 }; + + *pphBear = CreateSprite( C_BBT, startX, startY, boundW, boundH, C_FORE_W * C_TILE_W, C_FORE_H * C_TILE_H, (SHORT) as, TRUE ); + + for( i = 0; i < C_BBT; ++i ) + { + hBM_src = phBitmapList[i + C_TILETOTAL + C_FBT].hBM; + + if( i < 2 ) + { + action = MISS; + direction = LEFT; + } + else if( (i >= 2) && (i < 8) ) + { + action = STRIKE; + direction = LEFT; + } + else if( (i >= 8) && (i < 14) ) + { + action = CHEW; + direction = LEFT; + } + else if( (i >= 14) && (i < 26) ) + { + action = WALK; + direction = LEFT; + } + + BitBltSprite ( + *pphBear, + hBM_src, + action, + direction, + x[i], + y[i], + w[i], + h[i] ); + } + + SetSpriteAction( *pphBear, WALK, LEFT ); + SetSpriteVelX( *pphBear, -C_BEAR_WALKMOVE, P_ABSOLUTE ); + SetSpriteSwitch( *pphBear, C_BEAR_WALKSWITCH, P_ABSOLUTE ); + +} /* InitBear */ + +/* + * InitApple + */ +VOID InitApple ( HSPRITE **pphApple, HBITMAPLIST *phBitmapList ) +{ + *pphApple = CreateSprite( 1, 50 * C_UNIT, 390 * C_UNIT, 32, 32, C_FORE_W * C_TILE_W, C_FORE_H * C_TILE_H, 0, FALSE ); + + BitBltSprite( *pphApple, phBitmapList[61].hBM, NONE, RIGHT, 0, 0, 32, 32 ); + + SetSpriteAction( *pphApple, NONE, RIGHT ); + +} /* InitApple */ + + +/* + * PreInitializeGame + */ +BOOL PreInitializeGame( void ) +{ + return InitBuffer( &hBuffer); + +} /* PreInitializeGame */ + + +/* + * InitializeGame + */ +BOOL InitializeGame ( void ) +{ + Splash(); + + hBitmapList = LoadBitmaps(); + if( hBitmapList == NULL ) + { + return FALSE; + } + + InitTiles( &hTileList, hBitmapList, C_TILETOTAL ); + + InitPlane( &hForeground, &hForePosList, "FORELIST", C_FORE_W, C_FORE_H, C_FORE_DENOM ); + TilePlane( hForeground, hTileList, hForePosList ); + + InitPlane( &hMidground, &hMidPosList, "MIDLIST", C_MID_W, C_MID_H, C_MID_DENOM ); + TilePlane( hMidground, hTileList, hMidPosList ); + + InitPlane( &hBackground, &hBackPosList, "BACKLIST", C_BACK_W, C_BACK_H, C_BACK_DENOM ); + TilePlane( hBackground, hTileList, hBackPosList ); + + InitSurface( &hSurfaceList, "SURFLIST", C_FORE_W, C_FORE_H ); + SurfacePlane( hForeground, hSurfaceList ); + + InitFox( &hFox, hBitmapList ); + InitBear( &hBear, hBitmapList ); + InitApple( &hApple, hBitmapList ); + + DDClear(); // clear all the backbuffers. + + return TRUE; + +} /* InitializeGame */ + +extern void DisplayFrameRate( void ); + +/* + * NewGameFrame + */ +int NewGameFrame( void ) +{ + + SetSpriteX( hFox, 0, P_AUTOMATIC ); + SetSpriteY( hFox, 0, P_AUTOMATIC ); + + SetPlaneVelX( hBackground, GetSpriteVelX(hFox), P_ABSOLUTE ); + SetPlaneVelX( hMidground, GetSpriteVelX(hFox), P_ABSOLUTE ); + SetPlaneVelX( hForeground, GetSpriteVelX(hFox), P_ABSOLUTE ); + + SetPlaneX( hBackground, 0, P_AUTOMATIC ); + SetPlaneX( hMidground, 0, P_AUTOMATIC ); + SetPlaneX( hForeground, 0, P_AUTOMATIC ); + + SetSpriteX( hBear, 0, P_AUTOMATIC ); + SetSpriteX( hApple, 0, P_AUTOMATIC ); + SetSpriteY( hApple, 0, P_AUTOMATIC ); + + /* + * once all sprites are processed, display them + * + * If we are using destination transparency instead of source + * transparency, we need to paint the background with the color key + * and then paint our sprites and planes in reverse order. + * + * Since destination transparency will allow you to only write pixels + * on the destination if the transparent color is present, reversing + * the order (so that the topmost bitmaps are drawn first instead of + * list) causes everything to come out ok. + */ + if( bTransDest ) + { + gfxFillBack( dwColorKey ); + + DisplayFrameRate(); + + DisplaySprite( hBuffer, hApple, GetPlaneX(hForeground) ); + DisplaySprite( hBuffer, hBear, GetPlaneX(hForeground) ); + DisplaySprite( hBuffer, hFox, GetPlaneX(hForeground) ); + + DisplayPlane( hBuffer, hForeground ); + DisplayPlane( hBuffer, hMidground ); + DisplayPlane( hBuffer, hBackground ); + } + else + { + DisplayPlane( hBuffer, hBackground ); + DisplayPlane( hBuffer, hMidground ); + DisplayPlane( hBuffer, hForeground ); + + DisplaySprite( hBuffer, hFox, GetPlaneX(hForeground) ); + DisplaySprite( hBuffer, hBear, GetPlaneX(hForeground) ); + DisplaySprite( hBuffer, hApple, GetPlaneX(hForeground) ); + + DisplayFrameRate(); + } + + gfxSwapBuffers(); + + return 0; + +} /* NewGameFrame */ + +/* + * DestroyGame + */ +void DestroyGame() +{ + if (hBuffer) + { + DestroyTiles( hTileList ); + DestroyPlane( hForeground ); + DestroyPlane( hMidground ); + DestroyPlane( hBackground ); + DestroyBuffer( hBuffer ); + DestroySound(); + + hTileList = NULL; + hForeground = NULL; + hMidground = NULL; + hBackground = NULL; + hBuffer = NULL; + } + +} /* DestroyGame */ + +/* + * ProcessInput + */ +BOOL ProcessInput( SHORT input ) +{ + static BOOL fBearPlaying = FALSE; + LONG foxSpeedX; + LONG foxSpeedY; + LONG foxX; + LONG foxY; + LONG bearX; + LONG bearY; + LONG appleX; + LONG appleY; + ACTION foxAction; + DIRECTION foxDir; + BOOL cont = TRUE; + + foxSpeedX = GetSpriteVelX( hFox ); + foxAction = GetSpriteAction( hFox ); + foxDir = GetSpriteDirection( hFox ); + + if( (GetSpriteActive(hFox) == FALSE) && (input != 4209) ) + { + input = 0; + } + switch( input ) + { + case KEY_DOWN: + if( foxAction == STOP ) + { + break; + } + else if( foxAction == STILL ) + { + SetSpriteAction( hFox, CROUCH, SAME ); + } + else if( foxAction == WALK ) + { + SetSpriteAction( hFox, CROUCHWALK, SAME ); + } + break; + + case KEY_LEFT: + if( foxAction == STOP ) + { + break; + } + else if( foxSpeedX == 0 ) + { + if( foxAction == STILL ) + { + if( foxDir == RIGHT ) + { + ChangeSpriteDirection( hFox ); + SetPlaneSlideX( hForeground, -C_BOUNDDIF, P_RELATIVE ); + SetPlaneSlideX( hMidground, -C_BOUNDDIF, P_RELATIVE ); + SetPlaneSlideX( hBackground, -C_BOUNDDIF, P_RELATIVE ); + SetPlaneIncremX( hForeground, C_BOUNDINCREM, P_ABSOLUTE ); + SetPlaneIncremX( hBackground, C_BOUNDINCREM, P_ABSOLUTE ); + SetPlaneIncremX( hMidground, C_BOUNDINCREM, P_ABSOLUTE ); + } + else + { + SetSpriteAction( hFox, WALK, LEFT ); + SetSpriteSwitch( hFox, C_FOX_WALKSWITCH, P_ABSOLUTE ); + SetSpriteVelX( hFox, -C_FOX_XMOVE, P_RELATIVE ); + } + } + else if( foxAction == CROUCH ) + { + if( foxDir == RIGHT ) + { + ChangeSpriteDirection( hFox ); + SetPlaneSlideX( hForeground, -C_BOUNDDIF, P_RELATIVE ); + SetPlaneSlideX( hMidground, -C_BOUNDDIF, P_RELATIVE ); + SetPlaneSlideX( hBackground, -C_BOUNDDIF, P_RELATIVE ); + SetPlaneIncremX( hForeground, C_BOUNDINCREM, P_ABSOLUTE ); + SetPlaneIncremX( hBackground, C_BOUNDINCREM, P_ABSOLUTE ); + SetPlaneIncremX( hMidground, C_BOUNDINCREM, P_ABSOLUTE ); + } + else + { + SetSpriteAction( hFox, CROUCHWALK, LEFT ); + SetSpriteSwitch( hFox, C_FOX_WALKSWITCH, P_ABSOLUTE ); + SetSpriteVelX( hFox, -C_FOX_XMOVE, P_RELATIVE ); + } + } + else + { + SetSpriteVelX( hFox, -C_FOX_XMOVE, P_RELATIVE ); + } + } else { + SetSpriteVelX( hFox, -C_FOX_XMOVE, P_RELATIVE ); + } + break; + + case KEY_RIGHT: + if( foxAction == STOP ) + { + break; + } + else if( foxSpeedX == 0 ) + { + if( foxAction == STILL ) + { + if( foxDir == LEFT ) + { + ChangeSpriteDirection( hFox ); + SetPlaneSlideX( hForeground, C_BOUNDDIF, P_RELATIVE ); + SetPlaneSlideX( hMidground, C_BOUNDDIF, P_RELATIVE ); + SetPlaneSlideX( hBackground, C_BOUNDDIF, P_RELATIVE ); + SetPlaneIncremX( hForeground, C_BOUNDINCREM, P_ABSOLUTE ); + SetPlaneIncremX( hBackground, C_BOUNDINCREM, P_ABSOLUTE ); + SetPlaneIncremX( hMidground, C_BOUNDINCREM, P_ABSOLUTE ); + } + else + { + SetSpriteAction( hFox, WALK, RIGHT ); + SetSpriteSwitch( hFox, C_FOX_WALKSWITCH, P_ABSOLUTE ); + SetSpriteVelX( hFox, C_FOX_XMOVE, P_RELATIVE ); + } + } + else if( foxAction == CROUCH ) + { + if( foxDir == LEFT ) + { + ChangeSpriteDirection( hFox ); + SetPlaneSlideX( hForeground, C_BOUNDDIF, P_RELATIVE ); + SetPlaneSlideX( hMidground, C_BOUNDDIF, P_RELATIVE ); + SetPlaneSlideX( hBackground, C_BOUNDDIF, P_RELATIVE ); + SetPlaneIncremX( hForeground, C_BOUNDINCREM, P_ABSOLUTE ); + SetPlaneIncremX( hBackground, C_BOUNDINCREM, P_ABSOLUTE ); + SetPlaneIncremX( hMidground, C_BOUNDINCREM, P_ABSOLUTE ); + } + else + { + SetSpriteAction( hFox, CROUCHWALK, RIGHT ); + SetSpriteSwitch( hFox, C_FOX_WALKSWITCH, P_ABSOLUTE ); + SetSpriteVelX( hFox, C_FOX_XMOVE, P_RELATIVE ); + } + } + else + { + SetSpriteVelX( hFox, C_FOX_XMOVE, P_RELATIVE ); + } + } + else + { + SetSpriteVelX( hFox, C_FOX_XMOVE, P_RELATIVE ); + } + break; + + case KEY_STOP: + if( foxAction == STOP ) + { + break; + } + else if( (foxAction == RUN) || (foxAction == BLURR) ) + { + SetSpriteAction( hFox, STOP, SAME ); + SetSpriteAccX( hFox, -foxSpeedX / 25, P_ABSOLUTE ); + SoundPlayEffect( SOUND_STOP ); + } else { + SetSpriteVelX( hFox, 0, P_ABSOLUTE ); + } + break; + + case KEY_UP: + if( foxAction == STOP ) + { + break; + } + else if( foxAction == CROUCH ) + { + SetSpriteAction( hFox, STILL, SAME ); + } + else if( foxAction == CROUCHWALK ) + { + SetSpriteAction( hFox, WALK, SAME ); + } + break; + + case KEY_JUMP: + if( foxAction == STOP ) + { + break; + } + else + if( (foxAction == STILL) || (foxAction == WALK) || + (foxAction == RUN) || (foxAction == CROUCH) || + (foxAction == CROUCHWALK) ) + { + SetSpriteAction( hFox, JUMP, SAME ); + SetSpriteSwitchType( hFox, TIME ); + SetSpriteSwitch( hFox, C_FOX_JUMPSWITCH, P_ABSOLUTE ); + SetSpriteVelY( hFox, -C_FOX_JUMPMOVE, P_ABSOLUTE ); + SetSpriteAccY( hFox, C_UNIT / 2, P_ABSOLUTE ); + SoundPlayEffect( SOUND_JUMP ); + } + break; + + case KEY_THROW: + if( foxAction == STOP ) + { + break; + } + else if( (foxAction == STILL) || (foxAction == WALK) || + (foxAction == RUN) || (foxAction == CROUCH) || + (foxAction == CROUCHWALK) ) + { + SetSpriteAction( hFox, THROW, SAME ); + SetSpriteSwitch( hFox, C_FOX_THROWSWITCH, P_ABSOLUTE ); + SetSpriteVelX( hFox, 0, P_ABSOLUTE ); + SetSpriteSwitchType( hFox, TIME ); + } + else if( foxAction == JUMP ) + { + SetSpriteAccY( hFox, 0, P_ABSOLUTE ); + SetSpriteSwitch( hFox, C_FOX_THROWSWITCH, P_ABSOLUTE ); + SetSpriteAction( hFox, JUMPTHROW, SAME ); + SetSpriteVelY( hFox, 0, P_ABSOLUTE ); + SetSpriteSwitchDone( hFox, FALSE ); + SetSpriteSwitchForward( hFox, TRUE ); + } + break; + + default: + break; + } + + /* + * Fox actions follow... + */ + if( GetSpriteActive(hFox) == FALSE ) + { + goto bearActions; + } + + if( abs(GetSpriteVelX( hFox )) < C_FOX_XMOVE ) + { + SetSpriteVelX( hFox, 0, P_ABSOLUTE ); + } + + foxAction = GetSpriteAction( hFox ); + + if( GetSpriteVelY(hFox) == 0 ) + { + if( GetSurface( hForeground, hFox ) == FALSE ) + { + if( (foxAction == WALK) || (foxAction == RUN) || + (foxAction == CROUCHWALK) ) + { + SetSpriteAccY( hFox, C_UNIT / 2, P_ABSOLUTE ); + } + else if( foxAction == STOP ) + { + SetSpriteAccY( hFox, C_UNIT / 2, P_ABSOLUTE ); + SetSpriteAccX( hFox, 0, P_ABSOLUTE ); + } + } + } + else if( GetSpriteVelY(hFox) > 2 * C_UNIT ) + { + if( (foxAction == WALK) || (foxAction == RUN) || + (foxAction == CROUCHWALK) ) + { + SetSpriteSwitchForward( hFox, FALSE ); + SetSpriteAction( hFox, JUMP, SAME ); + SetSpriteSwitchType( hFox, TIME ); + SetSpriteSwitch( hFox, C_FOX_JUMPSWITCH, P_ABSOLUTE ); + } + if( foxAction == STOP ) + { + SetSpriteAction( hFox, STUNNED, SAME ); + SetSpriteAccX( hFox, -GetSpriteVelX(hFox) / 25, P_ABSOLUTE ); + SoundPlayEffect( SOUND_STUNNED ); + } + } + + foxSpeedX = GetSpriteVelX( hFox ); + foxSpeedY = GetSpriteVelY( hFox ); + foxAction = GetSpriteAction( hFox ); + foxDir = GetSpriteDirection( hFox ); + + switch( foxAction ) { + case STUNNED: + if( (GetSpriteVelY(hFox) >= 0) && + (!GetSurface( hForeground, hFox ) == FALSE) ) + { + SetSpriteAccY( hFox, 0, P_ABSOLUTE ); + SetSpriteAction( hFox, STOP, SAME ); + SetSpriteVelY( hFox, 0, P_ABSOLUTE ); + SetSpriteAccX( hFox, -foxSpeedX / 25, P_ABSOLUTE ); + // SetSurface( hForeground, hFox ); + SoundPlayEffect( SOUND_STOP ); + } + break; + + case CROUCHWALK: + if( foxSpeedX == 0 ) + { + SetSpriteAction( hFox, CROUCH, SAME ); + } + else if( foxSpeedX > C_FOX_WALKMOVE ) + { + SetSpriteVelX( hFox, C_FOX_WALKMOVE, P_ABSOLUTE ); + } + else if( foxSpeedX < -C_FOX_WALKMOVE ) + { + SetSpriteVelX( hFox, -C_FOX_WALKMOVE, P_ABSOLUTE ); + } + break; + + case STOP: + if( foxSpeedX == 0 ) + { + SetSpriteAction( hFox, STILL, SAME ); + SetSpriteAccX( hFox, 0, P_ABSOLUTE ); + } + break; + + case RUN: + if( (foxSpeedX < C_FOX_WALKTORUN ) && (foxSpeedX > 0) ) + { + SetSpriteAction( hFox, WALK, RIGHT ); + SetSpriteSwitch( hFox, C_FOX_WALKSWITCH, P_ABSOLUTE ); + } + else if( foxSpeedX > C_FOX_RUNTOBLURR ) + { + SetSpriteAction( hFox, BLURR, RIGHT ); + SetSpriteSwitch( hFox, C_FOX_BLURRSWITCH, P_ABSOLUTE ); + } + else if( (foxSpeedX > -C_FOX_WALKTORUN ) && (foxSpeedX < 0) ) + { + SetSpriteAction( hFox, WALK, LEFT ); + SetSpriteSwitch( hFox, C_FOX_WALKSWITCH, P_ABSOLUTE ); + } + else if( foxSpeedX < -C_FOX_RUNTOBLURR ) + { + SetSpriteAction( hFox, BLURR, LEFT ); + SetSpriteSwitch( hFox, C_FOX_BLURRSWITCH, P_ABSOLUTE ); + } + break; + + case WALK: + if( foxSpeedX == 0 ) + { + SetSpriteAction( hFox, STILL, SAME ); + } + else if( foxSpeedX > C_FOX_WALKTORUN ) + { + SetSpriteAction( hFox, RUN, RIGHT ); + SetSpriteSwitch( hFox, C_FOX_RUNSWITCH, P_ABSOLUTE ); + } + else if( foxSpeedX < -C_FOX_WALKTORUN ) + { + SetSpriteAction( hFox, RUN, LEFT ); + SetSpriteSwitch( hFox, C_FOX_RUNSWITCH, P_ABSOLUTE ); + } + break; + + case BLURR: + if( (foxSpeedX < C_FOX_RUNTOBLURR ) && (foxSpeedX > C_FOX_WALKTORUN) ) + { + SetSpriteAction( hFox, RUN, RIGHT ); + SetSpriteSwitch( hFox, C_FOX_RUNSWITCH, P_ABSOLUTE ); + } + else if( (foxSpeedX > -C_FOX_RUNTOBLURR ) && (foxSpeedX < -C_FOX_WALKTORUN) ) + { + SetSpriteAction( hFox, RUN, LEFT ); + SetSpriteSwitch( hFox, C_FOX_RUNSWITCH, P_ABSOLUTE ); + } + break; + + case JUMPTHROW: + if( !GetSpriteSwitchDone(hFox) == FALSE ) + { + SetSpriteSwitchForward( hFox, FALSE ); + SetSpriteAction( hFox, JUMP, SAME ); + SetSpriteSwitch( hFox, C_FOX_JUMPSWITCH, P_ABSOLUTE ); + SetSpriteSwitchDone( hFox, FALSE ); + SetSpriteAccY( hFox, C_UNIT / 2, P_ABSOLUTE ); + SoundPlayEffect( SOUND_THROW ); + } + else + if( (GetSpriteBitmap(hFox) == 1) && + (GetSpriteDirection(hFox) == RIGHT) ) + { + SetSpriteActive( hApple, TRUE ); + SetSpriteX( hApple, GetSpriteX(hFox) + 60 * C_UNIT, P_ABSOLUTE ); + SetSpriteY( hApple, GetSpriteY(hFox) + 30 * C_UNIT, P_ABSOLUTE ); + SetSpriteVelX( hApple, 8 * C_UNIT, P_ABSOLUTE ); + SetSpriteVelY( hApple, -4 * C_UNIT, P_ABSOLUTE ); + SetSpriteAccX( hApple, 0, P_ABSOLUTE ); + SetSpriteAccY( hApple, C_UNIT / 4, P_ABSOLUTE ); + } + else if( (GetSpriteBitmap(hFox) == 1) && + (GetSpriteDirection(hFox) == LEFT) ) + { + SetSpriteActive( hApple, TRUE ); + SetSpriteX( hApple, GetSpriteX(hFox) + 15 * C_UNIT, P_ABSOLUTE ); + SetSpriteY( hApple, GetSpriteY(hFox) + 30 * C_UNIT, P_ABSOLUTE ); + SetSpriteVelX( hApple, -8 * C_UNIT, P_ABSOLUTE ); + SetSpriteVelY( hApple, -4 * C_UNIT, P_ABSOLUTE ); + SetSpriteAccX( hApple, 0, P_ABSOLUTE ); + SetSpriteAccY( hApple, C_UNIT / 4, P_ABSOLUTE ); + } + break; + + case THROW: + if( !GetSpriteSwitchDone(hFox) == FALSE ) + { + SetSpriteAction( hFox, STILL, SAME ); + SetSpriteSwitchType( hFox, HOR ); + SetSpriteSwitch( hFox, 0, P_ABSOLUTE ); + SetSpriteSwitchDone( hFox, FALSE ); + SoundPlayEffect( SOUND_THROW ); + } + else if( (GetSpriteBitmap(hFox) == 1) && + (GetSpriteDirection(hFox) == RIGHT) ) + { + SetSpriteActive( hApple, TRUE ); + SetSpriteX( hApple, GetSpriteX(hFox) + 60 * C_UNIT, P_ABSOLUTE ); + SetSpriteY( hApple, GetSpriteY(hFox) + 50 * C_UNIT, P_ABSOLUTE ); + SetSpriteVelX( hApple, 8 * C_UNIT, P_ABSOLUTE ); + SetSpriteVelY( hApple, -4 * C_UNIT, P_ABSOLUTE ); + SetSpriteAccX( hApple, 0, P_ABSOLUTE ); + SetSpriteAccY( hApple, C_UNIT / 4, P_ABSOLUTE ); + } + else if( (GetSpriteBitmap(hFox) == 1) && + (GetSpriteDirection(hFox) == LEFT) ) + { + SetSpriteActive( hApple, TRUE ); + SetSpriteX( hApple, GetSpriteX(hFox) + 20 * C_UNIT, P_ABSOLUTE ); + SetSpriteY( hApple, GetSpriteY(hFox) + 50 * C_UNIT, P_ABSOLUTE ); + SetSpriteVelX( hApple, -8 * C_UNIT, P_ABSOLUTE ); + SetSpriteVelY( hApple, -4 * C_UNIT, P_ABSOLUTE ); + SetSpriteAccX( hApple, 0, P_ABSOLUTE ); + SetSpriteAccY( hApple, C_UNIT / 4, P_ABSOLUTE ); + } + break; + + case JUMP: + if( (foxSpeedY >= 0) && (!GetSpriteSwitchForward( hFox ) == FALSE) ) + { + SetSpriteSwitchForward( hFox, FALSE ); + } + else if( GetSpriteSwitchForward( hFox ) == FALSE ) + { + if( (!GetSurface( hForeground, hFox ) == FALSE) || + (!GetSurface( hForeground, hFox ) == FALSE) ) + { + if( foxSpeedX >= C_FOX_RUNMOVE ) + { + SetSpriteAction( hFox, RUN, SAME ); + SetSpriteSwitch( hFox, C_FOX_RUNSWITCH, P_ABSOLUTE ); + } + else if( foxSpeedX == 0 ) + { + SetSpriteAction( hFox, STILL, SAME ); + SetSpriteSwitch( hFox, C_FOX_WALKSWITCH, P_ABSOLUTE ); + } + else + { + SetSpriteAction( hFox, WALK, SAME ); + SetSpriteSwitch( hFox, C_FOX_WALKSWITCH, P_ABSOLUTE ); + } + + SetSpriteAccY( hFox, 0, P_ABSOLUTE ); + SetSpriteVelY( hFox, 0, P_ABSOLUTE ); + SetSpriteSwitchType( hFox, HOR ); + SetSpriteSwitchForward( hFox, TRUE ); +// SetSurface( hForeground, hFox ); + SetSpriteSwitchDone( hFox, FALSE ); + } + } + break; + + } + + /* + * Bear Actions + */ + bearActions: + + foxX = GetSpriteX( hFox ); + foxY = GetSpriteY( hFox ); + bearX = GetSpriteX( hBear ); + bearY = GetSpriteY( hBear ); + appleX = GetSpriteX( hApple ); + appleY = GetSpriteY( hApple ); + + switch( GetSpriteAction( hBear ) ) { + case STRIKE: + if( GetSpriteBitmap( hBear ) == 2 ) + { + if( (bearX > foxX - C_UNIT * 30) && (bearX < foxX + C_UNIT * 40) && + (bearY < foxY + C_UNIT * 60) ) + { + SetSpriteActive( hFox, FALSE ); + if( !fBearPlaying ) + { + SoundPlayEffect( SOUND_BEARSTRIKE ); + fBearPlaying = TRUE; + } + } + else + { + SetSpriteAction( hBear, MISS, SAME ); + SetSpriteSwitch( hBear, C_BEAR_MISSSWITCH, P_ABSOLUTE ); + SetSpriteSwitchDone( hBear, FALSE ); + } + } + else if( !GetSpriteSwitchDone( hBear ) == FALSE ) + { + SetSpriteAction( hBear, CHEW, SAME ); + SetSpriteSwitchDone( hBear, FALSE ); + chewCount = 0; + fBearPlaying = FALSE; + } + break; + + case MISS: + if( !fBearPlaying ) + { + SoundPlayEffect( SOUND_BEARMISS ); + fBearPlaying = TRUE; + } + if( !GetSpriteSwitchDone( hBear ) == FALSE ) + { + SetSpriteAction( hBear, WALK, SAME ); + SetSpriteVelX( hBear, -C_BEAR_WALKMOVE, P_ABSOLUTE ); + SetSpriteSwitch( hBear, C_BEAR_WALKSWITCH, P_ABSOLUTE ); + SetSpriteSwitchType( hBear, HOR ); + fBearPlaying = FALSE; + } + break; + + case WALK: + if( (!GetSpriteActive(hApple) == FALSE) && (appleX > bearX) && + (appleX > bearX + 80 * C_UNIT) && (appleY > bearY + 30 * C_UNIT) ) + { + SetSpriteAction( hBear, STRIKE, SAME ); + SetSpriteVelX( hBear, 0, P_ABSOLUTE ); + SetSpriteSwitchType( hBear, TIME ); + SetSpriteSwitch( hBear, C_BEAR_STRIKESWITCH, P_ABSOLUTE ); + SetSpriteSwitchDone( hBear, FALSE ); + } + else if( (bearX > foxX - C_UNIT * 30) && + (bearX < foxX + C_UNIT * 30) && + (bearY < foxY + C_UNIT * 60) ) + { + SetSpriteAction( hBear, STRIKE, SAME ); + SetSpriteVelX( hBear, 0, P_ABSOLUTE ); + SetSpriteSwitchType( hBear, TIME ); + SetSpriteSwitch( hBear, C_BEAR_STRIKESWITCH, P_ABSOLUTE ); + SetSpriteSwitchDone( hBear, FALSE ); + } + break; + + case CHEW: + ++chewCount; + if( chewCount >= 200 ) + { + SetSpriteAction( hBear, STRIKE, SAME ); + SetSpriteSwitch( hBear, C_BEAR_STRIKESWITCH, P_ABSOLUTE ); + SetSpriteVelX( hBear, 0, P_ABSOLUTE ); + SetSpriteSwitchDone( hBear, FALSE ); + + if( GetSpriteDirection(hFox) == RIGHT ) + { + SetPlaneSlideX( hForeground, -C_BOUNDDIF, P_RELATIVE ); + SetPlaneSlideX( hMidground, -C_BOUNDDIF, P_RELATIVE ); + SetPlaneSlideX( hBackground, -C_BOUNDDIF, P_RELATIVE ); + } + + chewDif = GetSpriteX(hFox); + + SetSpriteActive( hFox, TRUE ); + SetSpriteAction( hFox, STUNNED, LEFT ); + SetSpriteX( hFox, GetSpriteX(hBear), P_ABSOLUTE ); + SetSpriteY( hFox, GetSpriteY(hBear), P_ABSOLUTE ); + SetSpriteAccX( hFox, 0, P_ABSOLUTE ); + SetSpriteAccY( hFox, C_UNIT / 2, P_ABSOLUTE ); + SetSpriteVelX( hFox, -8 * C_UNIT, P_ABSOLUTE ); + SetSpriteVelY( hFox, -10 * C_UNIT, P_ABSOLUTE ); + SetSpriteSwitch( hFox, 0, P_ABSOLUTE ); + SoundPlayEffect( SOUND_STUNNED ); + + chewDif -= GetSpriteX(hFox); + + SetPlaneSlideX( hForeground, -chewDif, P_RELATIVE ); + SetPlaneSlideX( hMidground, -chewDif, P_RELATIVE ); + SetPlaneSlideX( hBackground, -chewDif, P_RELATIVE ); + SetPlaneIncremX( hForeground, C_BOUNDINCREM, P_ABSOLUTE ); + SetPlaneIncremX( hMidground, C_BOUNDINCREM, P_ABSOLUTE ); + SetPlaneIncremX( hBackground, C_BOUNDINCREM, P_ABSOLUTE ); + } + break; + } + + /* + * Apple actions... + */ + if( (GetSpriteVelY(hApple) != 0) && (GetSpriteY(hApple) >= 420 * C_UNIT) ) + { + SetSpriteX( hApple, 0, P_ABSOLUTE ); + SetSpriteY( hApple, 0, P_ABSOLUTE ); + SetSpriteAccX( hApple, 0, P_ABSOLUTE ); + SetSpriteAccY( hApple, 0, P_ABSOLUTE ); + SetSpriteVelX( hApple, 0, P_ABSOLUTE ); + SetSpriteVelY( hApple, 0, P_ABSOLUTE ); + SetSpriteActive( hApple, FALSE ); + } + + return cont; + +} /* ProcessInput */ diff --git a/sdk/samples/foxbear/gameproc.h b/sdk/samples/foxbear/gameproc.h new file mode 100644 index 0000000..78b1f1e --- /dev/null +++ b/sdk/samples/foxbear/gameproc.h @@ -0,0 +1,197 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: gameproc.h + * Content: include file for game processing info + * + ***************************************************************************/ +#ifndef __GAMEPROC_INCLUDED__ +#define __GAMEPROC_INCLUDED__ + +typedef enum enum_POSITION { + P_ABSOLUTE, + P_RELATIVE, + P_AUTOMATIC +} POSITION; + +typedef enum enum_SWITCHING { + HOR, + VER, + TIME +} SWITCHING; + +typedef enum enum_DIRECTION { + SAME, + RIGHT, + LEFT +} DIRECTION; + +typedef enum enum_ACTION { + NONE, + STILL, + WALK, + RUN, + JUMP, + THROW, + CROUCH, + STOP, + STUNNED, + JUMPTHROW, + CROUCHWALK, + BLURR, + STRIKE, + MISS, + CHEW, +} ACTION; + +typedef SHORT HPOSLIST; +typedef BOOL HSURFACELIST; + +typedef struct struct_HPLANE { + GFX_HBM *hBM; + BOOL *surface; + LONG x; + LONG y; + USHORT width; + USHORT height; + LONG xv; + LONG xslide; + LONG xincrem; + USHORT denom; +} HPLANE, FAR *LPHPLANE; + +typedef struct struct_HSPRITE_BM { + GFX_HBM hBM; + ACTION action; + DIRECTION direction; + SHORT x; + SHORT y; + USHORT width; + USHORT height; +} HSPRITE_BM; + +typedef struct struct_HSPRITE { + HSPRITE_BM *hSBM; + USHORT bitmapCount; + ACTION currentAction; + DIRECTION currentDirection; + USHORT currentBitmap; + BOOL active; + LONG x; + LONG y; + USHORT width; + USHORT height; + LONG xv; + LONG yv; + LONG xa; + LONG ya; + SHORT xmax; + SHORT ymax; + LONG absSwitch; + LONG relSwitch; + SWITCHING switchType; + BOOL switchForward; + BOOL switchDone; +} HSPRITE, FAR *LPHSPRITE, FAR * FAR *LPLPHSPRITE; + +typedef struct struct_HBITMAPLIST +{ + GFX_HBM *hBM; +} HBITMAPLIST, FAR *LPHBITMAPLIST; + + +#include "tile.h" +#include "plane.h" +#include "sprite.h" + +#define C_UNIT (LONG) 65536 + +#define C_TILE_W 32 +#define C_TILE_H 32 +#define C_SCREEN_W 640 +#define C_SCREEN_H 480 + +#define C_FORE_W 80 +#define C_FORE_H 15 +#define C_MID_W 40 +#define C_MID_H 15 +#define C_BACK_W 25 +#define C_BACK_H 15 +#define C_WORLD_W 20 +#define C_WORLD_H 15 + +#define C_BACK_DENOM 12 +#define C_MID_DENOM 3 +#define C_FORE_DENOM 1 + +#define C_TILETOTAL 123 // TILE BITMAP TOTAL +#define C_FBT 112 // FOX BITMAP TOTAL +#define C_BBT 26 // BEAR BITMAP TOTAL + +#define C_FOXSTILL 1 // NUMBER OF BITMAPS +#define C_FOXWALK 12 +#define C_FOXRUN 16 +#define C_FOXJUMP 4 +#define C_FOXTHROW 2 +#define C_FOXCROUCH 1 +#define C_FOXSTOP 1 +#define C_FOXSTUNNED 1 +#define C_FOXJUMPTHROW 2 +#define C_FOXCROUCHWALK 12 +#define C_FOXBLURR 4 + +#define C_BEARMISS 2 +#define C_BEARWALK 12 +#define C_BEARSTRIKE 12 + + +#define C_FOX_XMOVE (LONG) C_UNIT / 4 + +#define C_BOUNDINCREM (LONG) 5 * C_UNIT +#define C_BOUNDDIF (LONG) 240 * C_UNIT + +#define C_FOX_STARTX (LONG) 150 * C_UNIT +#define C_FOX_STARTY (LONG) 318 * C_UNIT + +#define C_FOX_WALKMOVE (LONG) 6 * C_UNIT +#define C_FOX_RUNMOVE (LONG) 18 * C_UNIT +#define C_FOX_JUMPMOVE (LONG) 9 * C_UNIT + +#define C_FOX_WALKSWITCH (LONG) 6 * C_UNIT +#define C_FOX_JUMPSWITCH (LONG) 9 * C_UNIT +#define C_FOX_THROWSWITCH (LONG) 15 * C_UNIT +#define C_FOX_RUNSWITCH (LONG) 18 * C_UNIT +#define C_FOX_BLURRSWITCH (LONG) 18 * C_UNIT + +#define C_FOX_WALKTORUN (LONG) 4 * C_UNIT +#define C_FOX_RUNTOBLURR (LONG) 14 * C_UNIT + +#define C_BEAR_STARTX (LONG) 600 * C_UNIT +#define C_BEAR_STARTY (LONG) 329 * C_UNIT + +#define C_BEAR_WALKMOVE (LONG) 1 * C_UNIT + +#define C_BEAR_WALKSWITCH (LONG) 6 * C_UNIT +#define C_BEAR_STRIKESWITCH (LONG) 8 * C_UNIT +#define C_BEAR_MISSSWITCH (LONG) 10 * C_UNIT + + +extern void ErrorMessage( LPSTR ); +extern BOOL InitBuffer( GFX_HBM* ); +extern void DestroyBuffer( GFX_HBM ); +extern HBITMAPLIST *LoadBitmaps( void ); +extern void InitTiles( HBITMAPLIST**, HBITMAPLIST*, USHORT ); +extern void InitPlane( HPLANE**, HPOSLIST**, CHAR*, USHORT, USHORT, USHORT ); +extern void InitSurface( HSURFACELIST**, CHAR*, USHORT, USHORT ); +extern void InitFox( HSPRITE**, HBITMAPLIST* ); +extern void InitBear( HSPRITE**, HBITMAPLIST* ); +extern void InitApple( HSPRITE**, HBITMAPLIST* ); +extern BOOL PreInitializeGame( void ); +extern BOOL InitializeGame( void ); +extern BOOL GetInput( void ); +extern BOOL ProcessInput ( SHORT input ); +extern int NewGameFrame( void ); +extern void DestroyGame( void ); +#endif diff --git a/sdk/samples/foxbear/gfx.c b/sdk/samples/foxbear/gfx.c new file mode 100644 index 0000000..7628b67 --- /dev/null +++ b/sdk/samples/foxbear/gfx.c @@ -0,0 +1,602 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: gfx.c + * Content: graphics API + * + ***************************************************************************/ +#include "foxbear.h" + +GFX_BITMAP *lpVRAM; + +static BOOL fForceRestore = FALSE; + +/* + * gfxBlt + */ +BOOL gfxBlt(RECT *dst, GFX_HBM bm, POINT *src) +{ + GFX_BITMAP* pbm = (GFX_BITMAP*)bm; + HRESULT ddrval; + DWORD bltflags; + RECT rc; + int x,y,dx,dy; + + if( GameSize.cy == C_SCREEN_H ) + { + x = dst->left; + y = dst->top; + dx = dst->right - dst->left; + dy = dst->bottom - dst->top; + rc.left = src->x; + rc.top = src->y; + rc.right = rc.left + dx; + rc.bottom = rc.top + dy; + } + else + { + x = MapX(dst->left); + y = MapY(dst->top); + dx = MapX(dst->right) - x; + dy = MapY(dst->bottom) - y; + rc.left = MapDX(src->x); + rc.top = MapDY(src->y); + rc.right = rc.left + dx; + rc.bottom = rc.top + dy; + } + + if( dx == 0 || dy == 0 ) + { + return TRUE; + } + + if (pbm->lpSurface) + { + if( pbm->bTrans ) + bltflags = bTransDest ? DDBLTFAST_DESTCOLORKEY : DDBLTFAST_SRCCOLORKEY; + else + bltflags = bTransDest ? DDBLTFAST_DESTCOLORKEY : DDBLTFAST_NOCOLORKEY; + + ddrval = IDirectDrawSurface_BltFast( + lpBackBuffer, x, y, + pbm->lpSurface, &rc, bltflags | DDBLTFAST_WAIT); + + if (ddrval != DD_OK) + { + Msg("BltFast failed err=%d", ddrval); + } + } + else + { + DDBLTFX ddbltfx; + + rc.left = x; + rc.top = y; + rc.right = rc.left + dx; + rc.bottom = rc.top + dy; + + ddbltfx.dwSize = sizeof( ddbltfx ); + ddbltfx.dwFillColor = pbm->dwColor; + + ddrval = IDirectDrawSurface_Blt( + lpBackBuffer, // dest surface + &rc, // dest rect + NULL, // src surface + NULL, // src rect + DDBLT_COLORFILL | DDBLT_WAIT, + &ddbltfx); + } + + return TRUE; + +} /* gfxBlt */ + +/* + * gfxCreateSolidColorBitmap + */ +GFX_HBM gfxCreateSolidColorBitmap(COLORREF rgb) +{ + GFX_BITMAP *pvram; + + pvram = MemAlloc( sizeof( *pvram ) ); + + if( pvram == NULL ) + { + return NULL; + } + + pvram->dwColor = DDColorMatch(lpBackBuffer, rgb); + pvram->lpSurface = NULL; + pvram->lpbi = NULL; + pvram->bTrans = FALSE; + + pvram->link = lpVRAM; + lpVRAM = pvram; + + return (GFX_HBM) pvram; + +} /* gfxCreateSolidColorBitmap */ + +/* + * gfxCreateBitmap + */ +GFX_HBM gfxCreateVramBitmap(BITMAPINFOHEADER UNALIGNED *lpbi,BOOL bTrans) +{ + GFX_BITMAP *pvram; + + pvram = MemAlloc( sizeof( *pvram ) ); + + if( pvram == NULL ) + { + return NULL; + } + pvram->lpSurface = DDCreateSurface(MapRX(lpbi->biWidth), + MapRY(lpbi->biHeight), FALSE, TRUE); + pvram->lpbi = lpbi; + pvram->dwColor = 0; + pvram->bTrans = bTrans; + + if( pvram->lpSurface == NULL ) + { + return NULL; + } + + pvram->link = lpVRAM; + lpVRAM = pvram; + gfxRestore((GFX_HBM) pvram); + + return (GFX_HBM) pvram; + +} /* gfxCreateVramBitmap */ + +/* + * gfxDestroyBitmap + */ +BOOL gfxDestroyBitmap ( GFX_HBM hbm ) +{ + GFX_BITMAP *p = (GFX_BITMAP *)hbm; + + if (hbm == NULL || hbm == GFX_TRUE) + { + return FALSE; + } + + if (p->lpSurface) + { + IDirectDrawSurface_Release(p->lpSurface); + p->lpSurface = NULL; + } + + if (p->lpbi) + { + p->lpbi = NULL; + } + + MemFree((VOID *)p); + + return TRUE; + +} /* gfxDestroyBitmap */ + +/* + * gfxStretchBackBuffer() + */ +BOOL gfxStretchBackbuffer() +{ + if (lpStretchBuffer) + { + IDirectDrawSurface_Blt( + lpStretchBuffer, // dest surface + NULL, // dest rect (all of it) + lpBackBuffer, // src surface + &GameRect, // src rect + DDBLT_WAIT, + NULL); + + IDirectDrawSurface_Blt( + lpBackBuffer, // dest surface + NULL, // dest rect (all of it) + lpStretchBuffer, // src surface + NULL, // src rect + DDBLT_WAIT, + NULL); + } + else + { + IDirectDrawSurface_Blt( + lpBackBuffer, // dest surface + NULL, // dest rect (all of it) + lpBackBuffer, // src surface + &GameRect, // src rect + DDBLT_WAIT, + NULL); + } + + return TRUE; + +} /* gfxStretchBackbuffer */ + +/* + * gfxFlip + */ +BOOL gfxFlip( void ) +{ + HRESULT ddrval; + + ddrval = IDirectDrawSurface_Flip( lpFrontBuffer, NULL, DDFLIP_WAIT ); + if( ddrval != DD_OK ) + { + Msg( "Flip FAILED, rc=%08lx", ddrval ); + return FALSE; + } + return TRUE; + +} /* gfxFlip */ + +/* + * gfxUpdateWindow + */ +BOOL gfxUpdateWindow() +{ + HRESULT ddrval; + + ddrval = IDirectDrawSurface_Blt( + lpFrontBuffer, // dest surface + &rcWindow, // dest rect + lpBackBuffer, // src surface + NULL, // src rect (all of it) + DDBLT_WAIT, + NULL); + + return ddrval == DD_OK; + +} /* gfxUpdateWindow */ + +/* + * gfxSwapBuffers + * + * this is called when the game loop has rendered a frame into + * the backbuffer, its goal is to display something for the user to see. + * + * there are four cases... + * + * Fullscreen: + * we just call IDirectDrawSurface::Flip(lpFrontBuffer) + * being careful to handle return code right. + * + * Fullscreen (stretched): + * the game loop has rendered a frame 1/2 the display + * size, we do a Blt to stretch the frame to the backbuffer + * the we just call IDirectDrawSurface::Flip(lpFrontBuffer) + * + * Window mode (foreground palette): + * in this case we call IDirectDrawSurface::Blt to copy + * the back buffer to the window. + * + * Window mode (background palette): + * in this case we are in a window, but we dont own the + * palette. all our art was loaded to a specific palette + * IDirectDrawSurface::Blt does not do color translation + * we have a few options in this case... + * + * reload or remap the art to the the current palette + * (we can do this easily with a GetDC, StetchDIBits) + * FoxBear has *alot* of art, so this would be too slow. + * + * use GDI to draw the backbuffer, GDI will handle + * the color conversion so things will look correct. + * + * pause the game (this is what we do so this function + * will never be called) + * + */ +BOOL gfxSwapBuffers( void ) +{ + if( bFullscreen ) + { + if( bStretch ) + { + gfxStretchBackbuffer(); + } + + if (nBufferCount > 1) + return gfxFlip(); + else + return TRUE; + } + else + { + return gfxUpdateWindow(); + } + +} /* gfxSwapBuffers */ + +/* + * gfxBegin + */ +GFX_HBM gfxBegin( void ) +{ + if( !DDEnable() ) + { + return NULL; + } + + if( !DDCreateFlippingSurface() ) + { + DDDisable(TRUE); + return NULL; + } + Splash(); + + return GFX_TRUE; + +} /* gfxBegin */ + +/* + * gfxEnd + */ +BOOL gfxEnd ( GFX_HBM hbm ) +{ + GFX_BITMAP *curr; + GFX_BITMAP *next; + + for( curr = lpVRAM; curr; curr=next ) + { + next = curr->link; + gfxDestroyBitmap ((GFX_HBM)curr); + } + + lpVRAM = NULL; + + return DDDisable(FALSE); + + return TRUE; + +} /* gfxEnd */ + +/* + * gfxRestore + * + * restore the art when one or more surfaces are lost + */ +BOOL gfxRestore(GFX_HBM bm) +{ + GFX_BITMAP *pbm = (GFX_BITMAP*)bm; + HRESULT ddrval; + HDC hdc; + LPVOID lpBits; + RGBQUAD *prgb; + int i,w,h; + RECT rc; + + struct { + BITMAPINFOHEADER bi; + RGBQUAD ct[256]; + } dib; + + IDirectDrawSurface *pdds = pbm->lpSurface; + BITMAPINFOHEADER UNALIGNED *pbi = pbm->lpbi; + + if (pdds == NULL) + return TRUE; + + if (IDirectDrawSurface_Restore(pdds) != DD_OK) + return FALSE; + + if (pbi == NULL) + return TRUE; + + // + // in 8bbp mode if we get switched away from while loading + // (and palette mapping) our art, the colors will not be correct + // because some app may have changed the system palette. + // + // if we are in stress mode, just keep going. It is more important + // to make progress than to get the colors right. + // + + if (!bFullscreen && + GameBPP == 8 && + GetForegroundWindow() != hWndMain && + !bStress ) + { + Msg("gfxRestore: **** foreground window changed while loading art!"); + fForceRestore = TRUE; + PauseGame(); + return FALSE; + } + + dib.bi = *pbi; + + prgb = (RGBQUAD *)((LPBYTE)pbi + pbi->biSize); + lpBits = (LPBYTE)(prgb + pbi->biClrUsed); + + if( pbi->biClrUsed == 0 && pbi->biBitCount <= 8 ) + { + lpBits = (LPBYTE)(prgb + (1<<pbi->biBitCount)); + } + + w = MapRX(pbi->biWidth); + h = MapRY(pbi->biHeight); + /* + * hack to make sure fox off-white doesn't become + * pure white (which is transparent) + */ + for( i=0; i<256; i++ ) + { + dib.ct[i] = prgb[i]; + + if( dib.ct[i].rgbRed == 0xff && + dib.ct[i].rgbGreen == 0xff && + dib.ct[i].rgbBlue == 224 ) + { + dib.ct[i].rgbBlue = 0x80; + } + else + if( dib.ct[i].rgbRed == 251 && + dib.ct[i].rgbGreen == 243 && + dib.ct[i].rgbBlue == 234 ) + { + dib.ct[i].rgbBlue = 0x80; + } + } + + /* + * if we are in 8bit mode we know the palette is 332 we can + * do the mapping our self. + * + * NOTE we can only do this in fullscreen mode + * in windowed mode, we have to share the palette with + * the window manager and we dont get all of the colors + * in the order we assume. + * + */ + if (bFullscreen && GameBPP == pbi->biBitCount && GameBPP == 8 ) + { + BYTE xlat332[256]; + DDSURFACEDESC ddsd; + int x,y,dib_pitch; + BYTE *src, *dst; + BOOL stretch; + IDirectDrawSurface *pdds1; + HDC hdc1; + + stretch = w != pbi->biWidth || h != pbi->biHeight; + + for( i=0;i<256;i++ ) + { + xlat332[i] = + ((dib.ct[i].rgbRed >> 0) & 0xE0 ) | + ((dib.ct[i].rgbGreen >> 3) & 0x1C ) | + ((dib.ct[i].rgbBlue >> 6) & 0x03 ); + } + + /* + * if we are stretching copy into the back buffer + * then use GDI to stretch later. + */ + if( stretch ) + { + pdds1 = lpBackBuffer; + } + else + { + pdds1 = pdds; + } + + ddsd.dwSize = sizeof(ddsd); + ddrval = IDirectDrawSurface_Lock( + pdds1, NULL, &ddsd, DDLOCK_WAIT, NULL); + + if( ddrval == DD_OK ) + { + dib_pitch = (pbi->biWidth+3)&~3; + src = (BYTE *)lpBits + dib_pitch * (pbi->biHeight-1); + dst = (BYTE *)ddsd.lpSurface; + for( y=0; y<(int)pbi->biHeight; y++ ) + { + for( x=0; x<(int)pbi->biWidth; x++ ) + { + dst[x] = xlat332[src[x]]; + } + dst += ddsd.lPitch; + src -= dib_pitch; + } + IDirectDrawSurface_Unlock(pdds1, NULL); + } + else + { + Msg("Lock failed err=%d", ddrval); + return FALSE; + } + + if( stretch ) + { + if( IDirectDrawSurface_GetDC(pdds,&hdc) == DD_OK ) + { + if( IDirectDrawSurface_GetDC(pdds1,&hdc1) == DD_OK ) + { + SetStretchBltMode(hdc, COLORONCOLOR); + StretchBlt(hdc, 0, 0, w, h, + hdc1, 0, 0, pbi->biWidth, pbi->biHeight, SRCCOPY); + IDirectDrawSurface_ReleaseDC(pdds1,hdc1); + } + IDirectDrawSurface_ReleaseDC(pdds,hdc); + } + } + } + else if( IDirectDrawSurface_GetDC(pdds,&hdc) == DD_OK ) + { + SetStretchBltMode(hdc, COLORONCOLOR); + StretchDIBits(hdc, 0, 0, w, h, + 0, 0, pbi->biWidth, pbi->biHeight, + lpBits, (BITMAPINFO *)&dib.bi, DIB_RGB_COLORS, SRCCOPY); + + IDirectDrawSurface_ReleaseDC(pdds,hdc); + } + + /* + * show the art while loading... + */ + rc.left = rcWindow.left, + rc.top = rcWindow.top + 20; + rc.right = rc.left + w; + rc.bottom = rc.top + h; + IDirectDrawSurface_Blt(lpFrontBuffer, &rc, pdds, NULL, DDBLT_WAIT, NULL); + + return TRUE; + +} /* gfxRestore */ + +/* + * gfxRestoreAll + * + * restore the art when one or more surfaces are lost + */ +BOOL gfxRestoreAll() +{ + GFX_BITMAP *curr; + HWND hwndF = GetForegroundWindow(); + + Splash(); + + for( curr = lpVRAM; curr != NULL; curr = curr->link) + { + if (curr->lpSurface && + (fForceRestore || IDirectDrawSurface_IsLost(curr->lpSurface) == DDERR_SURFACELOST)) + { + if( !gfxRestore(curr) ) + { + Msg( "gfxRestoreAll: ************ Restore FAILED!" ); + return FALSE; + } + } + } + + DDClear(); + fForceRestore = FALSE; + return TRUE; + +} /* gfxRestoreAll */ + +/* + * gfxFillBack + */ +void gfxFillBack( DWORD dwColor ) +{ + DDBLTFX ddbltfx; + + ddbltfx.dwSize = sizeof( ddbltfx ); + ddbltfx.dwFillColor = dwColor; + + IDirectDrawSurface_Blt( + lpBackBuffer, // dest surface + NULL, // dest rect + NULL, // src surface + NULL, // src rect + DDBLT_COLORFILL | DDBLT_WAIT, + &ddbltfx); + +} /* gfxFillBack */ diff --git a/sdk/samples/foxbear/gfx.h b/sdk/samples/foxbear/gfx.h new file mode 100644 index 0000000..95c2873 --- /dev/null +++ b/sdk/samples/foxbear/gfx.h @@ -0,0 +1,45 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: gfx.h + * Content: graphics routines include file + * + ***************************************************************************/ +#ifndef __GFX_INCLUDED__ +#define __GFX_INCLUDED__ + +#define GFX_FALSE ((GFX_HBM)0) +#define GFX_TRUE ((GFX_HBM)1) + +typedef struct _GFX_BITMAP +{ + struct _GFX_BITMAP *link; // linked in a chain for restore. + DWORD dwColor; // solid fill color + BOOL bTrans; // transparent? + LPDIRECTDRAWSURFACE lpSurface; // the DirectDrawSurface. + LPBITMAPINFOHEADER lpbi; // the DIB to restore from. + +} GFX_BITMAP; + +typedef VOID *GFX_HBM; + + +// +// Prototypes +// + +GFX_HBM gfxLoadBitmap(LPSTR); +GFX_HBM gfxCreateVramBitmap(BITMAPINFOHEADER UNALIGNED * ,BOOL); +GFX_HBM gfxCreateSolidColorBitmap(COLORREF rgb); +BOOL gfxDestroyBitmap(GFX_HBM); +BOOL gfxSwapBuffers(void); +GFX_HBM gfxBegin(VOID); +BOOL gfxEnd(GFX_HBM); +void gfxFillBack( DWORD dwColor ); +BOOL gfxBlt(RECT *dst, GFX_HBM bm, POINT *src); +BOOL gfxRestore(GFX_HBM bm); +BOOL gfxRestoreAll(void); + +#endif diff --git a/sdk/samples/foxbear/jump.wav b/sdk/samples/foxbear/jump.wav new file mode 100644 index 0000000..134cd88 Binary files /dev/null and b/sdk/samples/foxbear/jump.wav differ diff --git a/sdk/samples/foxbear/makefile b/sdk/samples/foxbear/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/foxbear/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/foxbear/midlist.dat b/sdk/samples/foxbear/midlist.dat new file mode 100644 index 0000000..e3674b6 --- /dev/null +++ b/sdk/samples/foxbear/midlist.dat @@ -0,0 +1,15 @@ + 0 110 117 117 117 117 117 114 117 117 117 117 111 0 110 117 117 117 117 117 114 117 117 117 117 111 0 110 117 117 117 117 117 114 117 117 117 117 111 0 + 0 99 117 112 117 117 117 117 117 117 117 117 109 0 99 117 112 117 117 117 117 117 117 117 117 109 0 99 117 112 117 117 117 117 117 117 117 117 109 0 + 0 98 117 117 117 117 117 117 117 115 117 108 107 0 98 117 117 117 117 117 117 117 115 117 108 107 0 98 117 117 117 117 117 117 117 115 117 108 107 0 + 0 97 117 117 117 113 117 117 117 117 117 105 106 0 97 117 117 117 113 117 117 117 117 117 105 106 0 97 117 117 117 113 117 117 117 117 117 105 106 0 + 0 96 95 117 117 117 117 117 117 117 117 104 0 0 96 95 117 117 117 117 117 117 117 117 104 0 0 96 95 117 117 117 117 117 117 117 117 104 0 0 + 0 0 94 93 92 91 89 90 100 101 102 103 0 0 0 94 93 92 91 89 90 100 101 102 103 0 0 0 94 93 92 91 89 90 100 101 102 103 0 0 + 0 0 84 83 0 0 87 88 0 0 0 0 0 0 0 84 83 0 0 87 88 0 0 0 0 0 0 0 84 83 0 0 87 88 0 0 0 0 0 0 + 0 86 85 82 81 80 78 79 0 0 0 0 0 0 86 85 82 81 80 78 79 0 0 0 0 0 0 86 85 82 81 80 78 79 0 0 0 0 0 0 + 0 0 0 0 0 0 76 77 72 73 74 75 0 0 0 0 0 0 0 76 77 72 73 74 75 0 0 0 0 0 0 0 76 77 72 73 74 75 0 0 + 0 0 0 0 0 0 69 70 71 0 0 0 0 0 0 0 0 0 0 69 70 71 0 0 0 0 0 0 0 0 0 0 69 70 71 0 0 0 0 0 + 0 0 0 0 0 0 67 68 0 0 0 0 0 0 0 0 0 0 0 67 68 0 0 0 0 0 0 0 0 0 0 0 67 68 0 0 0 0 0 0 + 0 0 0 0 0 0 65 66 0 0 0 0 0 0 0 0 0 0 0 65 66 0 0 0 0 0 0 0 0 0 0 0 65 66 0 0 0 0 0 0 + 0 0 0 0 0 0 63 64 0 0 0 0 0 0 0 0 0 0 0 63 64 0 0 0 0 0 0 0 0 0 0 0 63 64 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/sdk/samples/foxbear/miss01.wav b/sdk/samples/foxbear/miss01.wav new file mode 100644 index 0000000..8300b78 Binary files /dev/null and b/sdk/samples/foxbear/miss01.wav differ diff --git a/sdk/samples/foxbear/miss02.wav b/sdk/samples/foxbear/miss02.wav new file mode 100644 index 0000000..8e5e9da Binary files /dev/null and b/sdk/samples/foxbear/miss02.wav differ diff --git a/sdk/samples/foxbear/msvc.mk b/sdk/samples/foxbear/msvc.mk new file mode 100644 index 0000000..6fbc862 --- /dev/null +++ b/sdk/samples/foxbear/msvc.mk @@ -0,0 +1,43 @@ +NAME = foxbear +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib fastfile.lib libc.lib dsound.lib + +OBJS = foxbear.obj gameproc.obj tile.obj plane.obj sprite.obj gfx.obj \ + bmp.obj ddraw.obj fbsound.obj dsutil.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/foxbear/plane.c b/sdk/samples/foxbear/plane.c new file mode 100644 index 0000000..3488c8b --- /dev/null +++ b/sdk/samples/foxbear/plane.c @@ -0,0 +1,423 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: plane.c + * Content: plane manipulation functions + * + ***************************************************************************/ +#include "foxbear.h" + +/* + * CreatePlane + */ +HPLANE *CreatePlane ( USHORT width, USHORT height, USHORT denom ) +{ + HPLANE *hPlane; + USHORT num_elems; + USHORT elem_size; + + num_elems = width * height; + elem_size = sizeof (GFX_HBM); + + hPlane = MemAlloc( sizeof (HPLANE) ); + if( hPlane == NULL ) + { + ErrorMessage( "hPlane in CreatePlane" ); + } + + hPlane->hBM = CMemAlloc( num_elems, elem_size ); + hPlane->surface = CMemAlloc( num_elems, sizeof hPlane->surface ); + hPlane->x = 0; + hPlane->y = 0; + hPlane->width = width; + hPlane->height = height; + hPlane->denom = denom; + hPlane->xslide = 0; + hPlane->xincrem = 0; + hPlane->xv = 0; + + if( hPlane->hBM == NULL ) + { + MemFree( hPlane ); + ErrorMessage( "hPlane->hBM in CreatePlane" ); + } + + return hPlane; + +} /* CreatePlane */ + + +/* + * TilePlane + */ +BOOL TilePlane( HPLANE *hPlane, HBITMAPLIST *hTileList, HPOSLIST *posList ) +{ + USHORT i; + + for( i = 0; i < hPlane->width * hPlane->height; ++i ) + { + hPlane->surface[i] = FALSE; + + if( posList[i] >= 0 ) + { + hPlane->hBM[i] = hTileList[ posList[i] ].hBM; + } + else + { + hPlane->hBM[i] = NULL; + } + } + + return TRUE; + +} /* TilePlane */ + +/* + * SurfacePlane + */ +BOOL SurfacePlane( HPLANE *hPlane, HSURFACELIST *hSurfaceList ) +{ + USHORT i; + + for( i = 0; i < hPlane->width * hPlane->height; ++i ) + { + if( hSurfaceList[i] == FALSE ) + { + hPlane->surface[i] = FALSE; + } + else + { + hPlane->surface[i] = TRUE; + } + } + + return TRUE; + +} /* SurfacePlane */ + +/* + * SetSurface + */ +BOOL SetSurface( HPLANE *hPlane, HSPRITE *hSprite ) +{ + SHORT c; + SHORT n; + SHORT x; + SHORT y; + + c = hSprite->currentBitmap; + x = (hSprite->x >> 16) / C_TILE_W; + y = (SHORT) hSprite->y >> 16; + + y += hSprite->hSBM[c].y + hSprite->hSBM[c].height; + y /= C_TILE_H; + + n = (x % hPlane->width) + y * hPlane->width; + + if( hPlane->surface[n] == FALSE ) + { + if( !hPlane->surface[n + hPlane->width] == FALSE ) + { + y += 1; + } + if( !hPlane->surface[n - hPlane->width] == FALSE ) + { + y -= 1; + } + } + + y *= C_TILE_H; + y -= hSprite->hSBM[c].y + hSprite->hSBM[c].height; + + SetSpriteY( hSprite, y << 16, P_ABSOLUTE ); + + return TRUE; + +} /* SetSurface */ + +/* + * GetSurface + */ +BOOL GetSurface( HPLANE *hPlane, HSPRITE *hSprite ) +{ + SHORT c; + SHORT x; + SHORT y; + + c = hSprite->currentBitmap; + x = ((hSprite->x >> 16) + hSprite->width / 2) / C_TILE_H; + y = ((hSprite->y >> 16) + hSprite->hSBM[c].y + hSprite->hSBM[c].height) / C_TILE_W; + + return hPlane->surface[(x % hPlane->width) + y * hPlane->width]; + +} /* GetSurface */ + +/* + * SetPlaneX + */ +BOOL SetPlaneX( HPLANE *hPlane, LONG x, POSITION position ) +{ + LONG xincrem; + + if( position == P_ABSOLUTE ) + { + hPlane->x = x; + } + else if( position == P_RELATIVE ) + { + hPlane->x += x; + } + else if( position == P_AUTOMATIC ) + { + if( hPlane->xslide > 0 ) + { + xincrem = hPlane->xincrem; + } + else if( hPlane->xslide < 0 ) + { + xincrem = -hPlane->xincrem; + } + else + { + xincrem = 0; + } + + hPlane->x += (hPlane->xv + xincrem) / hPlane->denom; + hPlane->xslide -= xincrem; + hPlane->xv = 0; + + if( abs(hPlane->xslide) < hPlane->xincrem ) + { + hPlane->x += hPlane->xslide / hPlane->denom; + hPlane->xslide = 0; + hPlane->xincrem = 0; + } + } + + if( hPlane->x < 0 ) + { + hPlane->x += (hPlane->width * C_TILE_W) << 16; + } + else if( hPlane->x >= (hPlane->width * C_TILE_W) << 16 ) + { + hPlane->x -= (hPlane->width * C_TILE_W) << 16; + } + + return TRUE; + +} /* SetPlaneX */ + +/* + * GetPlaneX + */ +LONG GetPlaneX( HPLANE *hPlane ) +{ + return hPlane->x; + +} /* GetPlaneX */ + +/* + * SetPlaneY + */ +BOOL SetPlaneY( HPLANE *hPlane, LONG y, POSITION position ) +{ + if( position == P_ABSOLUTE ) + { + hPlane->y = y; + } + else + { + hPlane->y += y; + } + + if( hPlane->y < 0 ) + { + hPlane->y += (hPlane->height * C_TILE_H) << 16; + } + else if( hPlane->y >= (hPlane->height * C_TILE_H) << 16 ) + { + hPlane->y -= (hPlane->height * C_TILE_H) << 16; + } + + return TRUE; + +} /* SetPlaneY */ + +/* + * GetPlaneY + */ +LONG GetPlaneY( HPLANE *hPlane ) +{ + return hPlane->y; + +} /* GetPlaneY */ + +/* + * SetPlaneSlideX + */ +BOOL SetPlaneSlideX( HPLANE *hPlane, LONG xslide, POSITION position ) +{ + if( position == P_ABSOLUTE ) + { + hPlane->xslide = xslide; + } + else if( position == P_RELATIVE ) + { + hPlane->xslide += xslide; + } + return TRUE; + +} /* SetPlaneSlideX */ + +/* + * SetPlaneVelX + */ +BOOL SetPlaneVelX( HPLANE *hPlane, LONG xv, POSITION position ) +{ + if( position == P_ABSOLUTE ) + { + hPlane->xv = xv; + } + else if( position == P_RELATIVE ) + { + hPlane->xv += xv; + } + + return TRUE; +} /* SetPlaneVelX */ + +/* + * SetPlaneIncremX + */ +BOOL SetPlaneIncremX( HPLANE *hPlane, LONG xincrem, POSITION position ) +{ + if( position == P_ABSOLUTE ) + { + hPlane->xincrem = xincrem; + } + else if( position == P_RELATIVE ) + { + hPlane->xincrem += xincrem; + } + + return TRUE; + +} /* SetPlaneIncremX */ + +/* + * ScrollPlane + */ +BOOL ScrollPlane( HSPRITE *hSprite ) +{ + if( (GetSpriteX(hSprite) <= C_FOX_STARTX) && (GetSpriteVelX(hSprite) < 0) ) + { + return TRUE; + } + + if( (GetSpriteX(hSprite) >= C_FOX_STARTX) && (GetSpriteVelX(hSprite) > 0) ) + { + return TRUE; + } + return FALSE; + +} /* ScrollPlane */ + + +/* + * DisplayPlane + */ +BOOL DisplayPlane ( GFX_HBM hBuffer, HPLANE *hPlane ) +{ + USHORT n; + USHORT i; + USHORT j; + USHORT x1; + USHORT y1; + USHORT x2; + USHORT y2; + USHORT xmod; + USHORT ymod; + POINT src; + RECT dst; + + + x1 = (hPlane->x >> 16) / C_TILE_W; + y1 = (hPlane->y >> 16) / C_TILE_H; + x2 = x1 + C_SCREEN_W / C_TILE_W; + y2 = y1 + C_SCREEN_H / C_TILE_H; + xmod = (hPlane->x >> 16) % C_TILE_W; + ymod = (hPlane->y >> 16) % C_TILE_H; + + for( j = y1; j < y2; ++j ) + { + for( i = x1; i <= x2; ++i ) + { + n = (i % hPlane->width) + j * hPlane->width; + if( hPlane->hBM[n] != NULL ) + { + if( i == x1 ) + { + dst.left = 0; + dst.right = dst.left + C_TILE_W - xmod; + src.x = xmod; + } + else if( i == x2 ) + { + dst.left = (i - x1) * C_TILE_W - xmod; + dst.right = dst.left + xmod; + src.x = 0; + } else { + dst.left = (i - x1) * C_TILE_W - xmod; + dst.right = dst.left + C_TILE_W; + src.x = 0; + } + + if( j == y1 ) + { + dst.top = 0; + dst.bottom = dst.top + C_TILE_H - ymod; + src.y = ymod; + } + else if( j == y2 ) + { + dst.top = (j - y1) * C_TILE_H - ymod; + dst.bottom = dst.top + ymod; + src.y = 0; + } else { + dst.top = (j - y1) * C_TILE_H - ymod; + dst.bottom = dst.top + C_TILE_H; + src.y = 0; + } + + gfxBlt(&dst,hPlane->hBM[n],&src); + } + } + } + + return TRUE; + +} /* DisplayPlane */ + +/* + * DestroyPlane + */ +BOOL DestroyPlane ( HPLANE *hPlane ) +{ + if( hPlane == NULL ) + { + ErrorMessage( "hPlane in DestroyPlane" ); + } + + if( hPlane->hBM == NULL ) + { + ErrorMessage( "hPlane->hBM in DestroyPlane" ); + } + + MemFree( hPlane->hBM ); + MemFree( hPlane ); + + return TRUE; + +} /* DestroyPlane */ diff --git a/sdk/samples/foxbear/plane.h b/sdk/samples/foxbear/plane.h new file mode 100644 index 0000000..8448087 --- /dev/null +++ b/sdk/samples/foxbear/plane.h @@ -0,0 +1,29 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: plane.h + * Content: planes include file + * + ***************************************************************************/ +#ifndef __PLANE_INCLUDED__ +#define __PLANE_INCLUDED__ + +HPLANE *CreatePlane( USHORT, USHORT, USHORT ); +BOOL TilePlane( HPLANE*, HBITMAPLIST*, HPOSLIST* ); +BOOL SurfacePlane( HPLANE*, HSURFACELIST* ); +BOOL SetSurface( HPLANE*, HSPRITE* ); +BOOL GetSurface( HPLANE*, HSPRITE* ); +BOOL SetPlaneX( HPLANE*, LONG, POSITION ); +LONG GetPlaneX( HPLANE* ); +BOOL SetPlaneY( HPLANE*, LONG, POSITION ); +LONG GetPlaneY( HPLANE* ); +BOOL SetPlaneSlideX( HPLANE*, LONG, POSITION ); +BOOL SetPlaneVelX( HPLANE*, LONG, POSITION ); +BOOL SetPlaneIncremX( HPLANE*, LONG, POSITION ); +BOOL ScrollPlane( HSPRITE* ); +BOOL DisplayPlane( GFX_HBM, HPLANE* ); +BOOL DestroyPlane( HPLANE* ); + +#endif diff --git a/sdk/samples/foxbear/rcids.h b/sdk/samples/foxbear/rcids.h new file mode 100644 index 0000000..4adbff6 --- /dev/null +++ b/sdk/samples/foxbear/rcids.h @@ -0,0 +1 @@ +#define FOX_ICON 101 diff --git a/sdk/samples/foxbear/readme.txt b/sdk/samples/foxbear/readme.txt new file mode 100644 index 0000000..620d980 --- /dev/null +++ b/sdk/samples/foxbear/readme.txt @@ -0,0 +1,36 @@ +The Fox & The Bear Sample +------------------------- + +You need to run FOXBEAR from the FOXBEAR directory for it to find all of +its files. + + +Commands for using Foxbear: + + F12 - quit + NUMPAD 2 - crouch + NUMPAD 3 - throw an apple + NUMPAD 4 - move right (hold down to run faster) + NUMPAD 5 - stop + NUMPAD 6 - move left (hold down to run faster) + NUMPAD 7 - jump + + +Options for running foxbear: + +WIN.INI Command line + +use_emulation=0 Use hardware acceleration +use_emulation=1 -e Use emulation, not hardware +use_dsound=0 -S Do not use Direct Sound +use_dsound=1 Use Direct Sound +buffers=0 Double or trible buffer vram size dependent +buffers=1 -1 Use no back buffer +buffers=2 -2 Double buffer + -d Double buffer +buffers=4 -4 Use 3 back buffers + -s Use stretch +sysmem=1 Use system memory when creating surfaces + -x Demo or stress mode (keeps running) + +command line dash parameters may be followed by x-resolution y-resolution color-depth diff --git a/sdk/samples/foxbear/rgb332.pal b/sdk/samples/foxbear/rgb332.pal new file mode 100644 index 0000000..189199b Binary files /dev/null and b/sdk/samples/foxbear/rgb332.pal differ diff --git a/sdk/samples/foxbear/sprite.c b/sdk/samples/foxbear/sprite.c new file mode 100644 index 0000000..c753339 --- /dev/null +++ b/sdk/samples/foxbear/sprite.c @@ -0,0 +1,792 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: sprite.c + * Content: sprite manipulation functions + * + ***************************************************************************/ +#include "foxbear.h" + +/* + * CreateSprite + */ +HSPRITE *CreateSprite ( + USHORT bitmapCount, + LONG x, + LONG y, + USHORT width, + USHORT height, + USHORT xmax, + USHORT ymax, + SHORT as, + BOOL active ) +{ + HSPRITE *hSprite; + USHORT i; + + hSprite = MemAlloc( sizeof (HSPRITE) ); + if( hSprite == NULL ) + { + ErrorMessage( "hSprite in CreateSprite" ); + } + + hSprite->hSBM = CMemAlloc( bitmapCount, sizeof (HSPRITE_BM) ); + if( hSprite->hSBM == NULL ) + { + MemFree( hSprite ); + ErrorMessage( "hSprite->hSBM in CreateSprite" ); + } + + hSprite->active = active; + hSprite->bitmapCount = bitmapCount; + hSprite->x = x; + hSprite->y = y; + hSprite->width = width; + hSprite->height = height; + hSprite->xv = 0; + hSprite->yv = 0; + hSprite->xa = 0; + hSprite->ya = 0; + hSprite->xmax = xmax; + hSprite->ymax = ymax; + hSprite->absSwitch = as; + hSprite->relSwitch = 0; + hSprite->switchType = HOR; + hSprite->switchForward = TRUE; + hSprite->switchDone = FALSE; + + for( i = 0; i < bitmapCount; ++i ) + { + hSprite->hSBM[i].hBM = NULL; + } + + return hSprite; + +} /* CreateSprite */ + +/* + * BitBltSprite + */ +BOOL BitBltSprite ( + HSPRITE *hSprite, + GFX_HBM hBM, + ACTION action, + DIRECTION direction, + SHORT x, + SHORT y, + USHORT w, + USHORT h ) +{ + USHORT count; + + if( hSprite == NULL ) + { + ErrorMessage( "hSprite in BitBltSprite" ); + } + + if( hBM == NULL ) + { + ErrorMessage( "hBM in BitBltSprite" ); + } + + if( (x >= hSprite->width) || (y >= hSprite->height) ) + { + ErrorMessage( "x or y in BitBltSprite" ); + } + + count = 0; + while( hSprite->hSBM[count].hBM != NULL ) + { + count++; + if( count >= hSprite->bitmapCount ) + { + ErrorMessage( "Bitmap overflow in BitBltSprite" ); + } + } + + hSprite->hSBM[count].hBM = hBM; + hSprite->hSBM[count].action = action; + hSprite->hSBM[count].direction = direction; + hSprite->hSBM[count].x = x; + hSprite->hSBM[count].y = y; + hSprite->hSBM[count].width = w; + hSprite->hSBM[count].height = h; + + return TRUE; + +} /* BitBltSprite */ + +/* + * SetSpriteAction + */ +BOOL SetSpriteAction ( HSPRITE *hSprite, ACTION action, DIRECTION direction ) +{ + USHORT c; + + c = 0; + + if( direction == SAME ) + { + direction = hSprite->currentDirection; + } + + while( (hSprite->hSBM[c].action != action) || (hSprite->hSBM[c].direction != direction) ) + { + ++c; + } + + hSprite->currentAction = action; + hSprite->currentDirection = direction; + hSprite->currentBitmap = c; + hSprite->relSwitch = 0; + + return TRUE; + +} /* SetSpriteAction */ + +/* + * ChangeSpriteDirection + */ +BOOL ChangeSpriteDirection( HSPRITE *hSprite ) +{ + DIRECTION direction; + + if( hSprite->currentDirection == RIGHT ) + { + direction = LEFT; + } + else + { + direction = RIGHT; + } + + SetSpriteAction( hSprite, hSprite->currentAction, direction ); + + return TRUE; + +} /* ChangeSpriteDirection */ + +/* + * GetSpriteAction + */ +ACTION GetSpriteAction( HSPRITE *hSprite ) +{ + return hSprite->currentAction; + +} /* GetSpriteAction */ + + +/* + * GetSpriteDirection + */ +DIRECTION GetSpriteDirection( HSPRITE *hSprite ) +{ + return hSprite->currentDirection; + +} /* GetSpriteDirection */ + +/* + * SetSpriteActive + */ +BOOL SetSpriteActive( HSPRITE *hSprite, BOOL active ) +{ + hSprite->active = active; + + if( active == FALSE ) + { + hSprite->xv = 0; + hSprite->yv = 0; + hSprite->xa = 0; + hSprite->ya = 0; + } + + return TRUE; + +} /* SetSpriteActive */ + +/* + * GetSpriteActive + */ +BOOL GetSpriteActive( HSPRITE *hSprite ) +{ + return hSprite->active; + +} /* GetSpriteActive */ + +/* + * SetSpriteVelX + */ +BOOL SetSpriteVelX( HSPRITE *hSprite, LONG xv, POSITION position ) +{ + if( hSprite->active == FALSE ) + { + return FALSE; + } + + if( position == P_ABSOLUTE ) + { + hSprite->xv = xv; + } + else if( position == P_RELATIVE ) + { + hSprite->xv += xv; + } + + return TRUE; + +} /* SetSpriteVelX */ + +/* + * GetSpriteVelX + */ +LONG GetSpriteVelX( HSPRITE *hSprite ) +{ + return hSprite->xv; + +} /* GetSpriteVelX */ + +/* + * SetSpriteVelY + */ +BOOL SetSpriteVelY( HSPRITE *hSprite, LONG yv, POSITION position ) +{ + if( hSprite->active == FALSE ) + { + return FALSE; + } + + if( position == P_ABSOLUTE ) + { + hSprite->yv = yv; + } + else if( position == P_RELATIVE ) + { + hSprite->yv += yv; + } + + return TRUE; + +} /* SetSpriteVelY */ + +/* + * GetSpriteVelY + */ +LONG GetSpriteVelY( HSPRITE *hSprite ) +{ + return hSprite->yv; + +} /* GetSpriteVelY */ + +/* + * SetSpriteAccX + */ +BOOL SetSpriteAccX ( HSPRITE *hSprite, LONG xa, POSITION position ) +{ + if( position == P_ABSOLUTE ) + { + hSprite->xa = xa; + } + else if( position == P_RELATIVE ) + { + hSprite->xa += xa; + } + return TRUE; + +} /* SetSpriteAccX */ + +/* + * GetSpriteAccX + */ +LONG GetSpriteAccX( HSPRITE *hSprite ) +{ + return hSprite->xa; + +} /* GetSpriteAccX */ + +/* + * SetSpriteAccY + */ +BOOL SetSpriteAccY ( HSPRITE *hSprite, LONG ya, POSITION position ) +{ + if( position == P_ABSOLUTE ) + { + hSprite->ya = ya; + } + else if( position == P_RELATIVE ) + { + hSprite->ya += ya; + } + return TRUE; + +} /* SetSpriteAccY */ + +/* + * GetSpriteAccY + */ +LONG GetSpriteAccY( HSPRITE *hSprite ) +{ + return hSprite->ya; + +} /* GetSpriteAccY */ + +/* + * SetSpriteX + */ +BOOL SetSpriteX( HSPRITE *hSprite, LONG x, POSITION position ) +{ + if( hSprite->active == FALSE ) + { + return FALSE; + } + + if( position == P_AUTOMATIC ) + { + hSprite->xv += hSprite->xa; + hSprite->x += hSprite->xv; + } + else if( position == P_ABSOLUTE ) + { + hSprite->x = x; + } + else if( position == P_RELATIVE ) + { + hSprite->x += x; + } + + if( hSprite->x < 0 ) + { + hSprite->x += hSprite->xmax << 16; + } + else if( hSprite->x >= hSprite->xmax << 16 ) + { + hSprite->x -= hSprite->xmax << 16; + } + return TRUE; + +} /* SetSpriteX */ + +/* + * GetSpriteX + */ +LONG GetSpriteX( HSPRITE *hSprite ) +{ + return hSprite->x; + +} /* GetSpriteX */ + +/* + * SetSpriteY + */ +BOOL SetSpriteY ( HSPRITE *hSprite, LONG y, POSITION position ) +{ + if( hSprite->active == FALSE ) + { + return FALSE; + } + + if( position == P_AUTOMATIC ) + { + hSprite->yv += hSprite->ya; + hSprite->y += hSprite->yv; + } + else if( position == P_ABSOLUTE ) + { + hSprite->y = y; + } + else if( position == P_RELATIVE ) + { + hSprite->y += y; + } + + if( hSprite->y < 0 ) + { + hSprite->y += hSprite->ymax << 16; + } + else if( hSprite->y >= hSprite->ymax << 16 ) + { + hSprite->y -= hSprite->ymax << 16; + } + + return TRUE; + +} /* SetSpriteY */ + +/* + * GetSpriteY + */ +LONG GetSpriteY( HSPRITE *hSprite ) +{ + return hSprite->y; + +} /* GetSpriteY */ + +/* + * SetSpriteSwitch + */ +BOOL SetSpriteSwitch ( HSPRITE *hSprite, LONG absSwitch, POSITION position ) +{ + if( position == P_ABSOLUTE ) + { + hSprite->absSwitch = absSwitch; + } + else if( position == P_RELATIVE ) + { + hSprite->absSwitch += absSwitch; + } + return TRUE; + +} /* SetSpriteSwitch */ + + +/* + * IncrementSpriteSwitch + */ +BOOL IncrementSpriteSwitch ( HSPRITE *hSprite, LONG n ) +{ + hSprite->relSwitch += n; + return TRUE; + +} /* IncrementSpriteSwitch */ + +/* + * SetSpriteSwitchType + */ +BOOL SetSpriteSwitchType( HSPRITE *hSprite, SWITCHING switchType ) +{ + hSprite->switchType = switchType; + hSprite->relSwitch = 0; + return TRUE; + +} /* SetSpriteSwitchType */ + + +/* + * GetSpriteSwitchType + */ +SWITCHING GetSpriteSwitchType ( HSPRITE *hSprite ) +{ + return hSprite->switchType; + +} /* GetSpriteSwitchType */ + +/* + * SetSpriteSwitchForward + */ +BOOL SetSpriteSwitchForward( HSPRITE *hSprite, BOOL switchForward ) +{ + hSprite->switchForward = switchForward; + + return TRUE; + +} /* SetSpriteSwitchForward */ + +/* + * GetSpriteSwitchForward + */ +BOOL GetSpriteSwitchForward( HSPRITE *hSprite ) +{ + return hSprite->switchForward; + +} /* GetSpriteSwitchForward */ + +/* + * SetSpriteSwitchDone + */ +BOOL SetSpriteSwitchDone( HSPRITE *hSprite, BOOL switchDone ) +{ + hSprite->switchDone = switchDone; + return TRUE; + +} /* SetSpriteSwitchDone */ + + +/* + * GetSpriteSwitchDone + */ +BOOL GetSpriteSwitchDone( HSPRITE *hSprite ) +{ + return hSprite->switchDone; + +} /* GetSpriteSwitchDone */ + +/* + * SetSpriteBitmap + */ +BOOL SetSpriteBitmap ( HSPRITE *hSprite, USHORT currentBitmap ) +{ + USHORT c; + + c = 0; + while( (hSprite->currentAction != hSprite->hSBM[c].action) || + (hSprite->currentDirection != hSprite->hSBM[c].direction) ) + { + ++c; + } + hSprite->currentBitmap = c + currentBitmap; + return TRUE; + +} /* SetSpriteBitmap */ + +/* + * GetSpriteBitmap + */ +USHORT GetSpriteBitmap( HSPRITE *hSprite ) +{ + USHORT count; + + count = 0; + while( (hSprite->currentAction != hSprite->hSBM[count].action) || + (hSprite->currentDirection != hSprite->hSBM[count].direction) ) + { + ++count; + } + return hSprite->currentBitmap - count; + +} /* GetSpriteBitmap */ + +/* + * advanceSpriteBitmap + */ +static BOOL advanceSpriteBitmap( HSPRITE *hSprite ) +{ + SHORT c; + SHORT n; + ACTION curAct; + ACTION act; + DIRECTION curDir; + DIRECTION dir; + + curAct = hSprite->currentAction; + curDir = hSprite->currentDirection; + + // + // See if we're cycling forward or backward though the images. + // + if( hSprite->switchForward ) // Are we cycling forward? + { + c = hSprite->currentBitmap + 1; + + // Does the next image exceed the number of images we have? + if( c >= hSprite->bitmapCount ) + { + // if the next image is past the end of the list, + // we need to set it to the start of the series. + SetSpriteBitmap( hSprite, 0 ); + c = hSprite->currentBitmap; + } + else + { + act = hSprite->hSBM[c].action; + dir = hSprite->hSBM[c].direction; + + // By examining the action and direction fields we can tell + // if we've past the current series of images and entered + // another series. + if( (curAct != act) || (curDir != dir) ) + { + SetSpriteBitmap( hSprite, 0 ); + } + else // We're still in the series, use the next image. + { + hSprite->currentBitmap = c; + } + } + } + else //cycling backwards + { + c = hSprite->currentBitmap - 1; + + if( c < 0 ) // Is the next image past the beginning of the list? + { + n = 0; + + // Find the last bitmap in the series + while( (n <= hSprite->bitmapCount) && + (curAct == hSprite->hSBM[n].action) && + (curDir == hSprite->hSBM[n].direction) ) + { + ++n; + } + + hSprite->currentBitmap = n - 1; + } + + else + { + act = hSprite->hSBM[c].action; + dir = hSprite->hSBM[c].direction; + // Is the next image past the of the series + if( (curAct != act) || (curDir != dir) ) + { + n = c + 1; + while( (n <= hSprite->bitmapCount) && + (curAct == hSprite->hSBM[n].action) && + (curDir == hSprite->hSBM[n].direction) ) + { + ++n; + } + + hSprite->currentBitmap = n - 1; + } + else // The next image is fine, use it. + { + hSprite->currentBitmap = c; + } + } + } + return TRUE; + +} /* advanceSpriteBitmap */ + +/* + * DisplaySprite + */ +BOOL DisplaySprite ( GFX_HBM hBuffer, HSPRITE *hSprite, LONG xPlane ) +{ + USHORT count; + SHORT left; + SHORT right; + SHORT shortx; + SHORT shorty; + SHORT planex; + POINT src; + RECT dst; + + if( hSprite->active == FALSE ) + { + return FALSE; + } + + count = hSprite->currentBitmap; + shortx = (SHORT) (hSprite->x >> 16); + shorty = (SHORT) (hSprite->y >> 16); + planex = (SHORT) (xPlane >> 16); + src.x = 0; + src.y = 0; + + if( shortx < planex - C_SCREEN_W ) + { + shortx += hSprite->xmax; + } + else if( shortx >= planex + C_SCREEN_W ) + { + shortx -= hSprite->xmax; + } + + left = shortx - planex; + + if( hSprite->currentDirection == RIGHT ) + { + left += hSprite->hSBM[count].x; + } + else + { + left += hSprite->width - hSprite->hSBM[count].x - hSprite->hSBM[count].width; + } + + right = left + hSprite->hSBM[count].width; + + if( left > C_SCREEN_W ) + { + left = C_SCREEN_W; + } + else if( left < 0 ) + { + src.x = -left; + left = 0; + } + + if( right > C_SCREEN_W ) + { + right = C_SCREEN_W; + } + else if( right < 0 ) + { + right = 0; + } + + dst.left = left; + dst.right = right; + dst.top = shorty + hSprite->hSBM[count].y; + dst.bottom = dst.top + hSprite->hSBM[count].height; + + gfxBlt(&dst,hSprite->hSBM[count].hBM,&src); + + if( hSprite->switchType == HOR ) + { + hSprite->relSwitch += abs(hSprite->xv); + + if( hSprite->relSwitch >= hSprite->absSwitch ) + { + hSprite->relSwitch = 0; + advanceSpriteBitmap( hSprite ); + } + } + else if( hSprite->switchType == VER ) + { + hSprite->relSwitch += abs(hSprite->yv); + + if( hSprite->relSwitch >= hSprite->absSwitch ) + { + hSprite->relSwitch = 0; + advanceSpriteBitmap( hSprite ); + + if( GetSpriteBitmap( hSprite ) == 0 ) + { + SetSpriteSwitchDone( hSprite, TRUE ); + } + } + } + else if( hSprite->switchType == TIME ) + { + hSprite->relSwitch += C_UNIT; + + if( hSprite->relSwitch >= hSprite->absSwitch ) + { + hSprite->relSwitch = 0; + advanceSpriteBitmap( hSprite ); + + if( GetSpriteBitmap( hSprite ) == 0 ) + { + SetSpriteSwitchDone( hSprite, TRUE ); + } + } + } + + return TRUE; + +} /* DisplaySprite */ + +/* + * DestroySprite + */ +BOOL DestroySprite ( HSPRITE *hSprite ) +{ + USHORT i; + + if( hSprite == NULL ) + { + ErrorMessage( "hSprite in DestroySprite" ); + } + + if( hSprite->hSBM == NULL ) + { + ErrorMessage( "hSprite->hSBM in DestroySprite" ); + } + + for( i = 0; i < hSprite->bitmapCount; ++i ) + { + if( !gfxDestroyBitmap( hSprite->hSBM[i].hBM ) ) + { + ErrorMessage( "gfxDestroyBitmap (hBM) in DestroySprite" ); + } + } + + MemFree( hSprite->hSBM ); + MemFree( hSprite ); + + return TRUE; + +} /* DestroySprite */ diff --git a/sdk/samples/foxbear/sprite.h b/sdk/samples/foxbear/sprite.h new file mode 100644 index 0000000..1723f98 --- /dev/null +++ b/sdk/samples/foxbear/sprite.h @@ -0,0 +1,45 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: sprite.h + * Content: sprite include file + * + ***************************************************************************/ +#ifndef __SPRITE_INCLUDED__ +#define __SPRITE_INCLUDED__ + +HSPRITE *CreateSprite( USHORT, LONG, LONG, USHORT, USHORT, USHORT, USHORT, SHORT, BOOL ); +BOOL BitBltSprite( HSPRITE*, GFX_HBM, ACTION, DIRECTION, SHORT, SHORT, USHORT, USHORT ); +BOOL SetSpriteAction( HSPRITE*, ACTION, DIRECTION ); +ACTION GetSpriteAction( HSPRITE* ); +BOOL ChangeSpriteDirection( HSPRITE* ); +DIRECTION GetSpriteDirection( HSPRITE* ); +BOOL SetSpriteBitmap( HSPRITE*, USHORT ); +USHORT GetSpriteBitmap( HSPRITE* ); +BOOL SetSpriteActive( HSPRITE*, BOOL ); +BOOL GetSpriteActive( HSPRITE* ); +BOOL SetSpriteVelX( HSPRITE*, LONG, POSITION ); +LONG GetSpriteVelX( HSPRITE* ); +BOOL SetSpriteVelY( HSPRITE*, LONG, POSITION ); +LONG GetSpriteVelY( HSPRITE* ); +BOOL SetSpriteAccX( HSPRITE*, LONG, POSITION ); +LONG GetSpriteAccX( HSPRITE* ); +BOOL SetSpriteAccY( HSPRITE*, LONG, POSITION ); +LONG GetSpriteAccY( HSPRITE* ); +BOOL SetSpriteX( HSPRITE*, LONG, POSITION ); +LONG GetSpriteX( HSPRITE* ); +BOOL SetSpriteY( HSPRITE*, LONG, POSITION ); +LONG GetSpriteY( HSPRITE* ); +BOOL SetSpriteSwitch( HSPRITE*, LONG, POSITION ); +BOOL IncrementSpriteSwitch( HSPRITE*, LONG ); +BOOL SetSpriteSwitchType( HSPRITE*, SWITCHING ); +SWITCHING GetSpriteSwitchType( HSPRITE* ); +BOOL SetSpriteSwitchForward( HSPRITE*, BOOL ); +BOOL GetSpriteSwitchForward( HSPRITE* ); +BOOL SetSpriteSwitchDone( HSPRITE*, BOOL ); +BOOL GetSpriteSwitchDone( HSPRITE* ); +BOOL DisplaySprite( GFX_HBM, HSPRITE*, LONG ); +BOOL DestroySprite( HSPRITE* ); +#endif diff --git a/sdk/samples/foxbear/stop.wav b/sdk/samples/foxbear/stop.wav new file mode 100644 index 0000000..834b1ee Binary files /dev/null and b/sdk/samples/foxbear/stop.wav differ diff --git a/sdk/samples/foxbear/strike01.wav b/sdk/samples/foxbear/strike01.wav new file mode 100644 index 0000000..0615e4a Binary files /dev/null and b/sdk/samples/foxbear/strike01.wav differ diff --git a/sdk/samples/foxbear/strike02.wav b/sdk/samples/foxbear/strike02.wav new file mode 100644 index 0000000..513c0a8 Binary files /dev/null and b/sdk/samples/foxbear/strike02.wav differ diff --git a/sdk/samples/foxbear/stunned.wav b/sdk/samples/foxbear/stunned.wav new file mode 100644 index 0000000..3950a8c Binary files /dev/null and b/sdk/samples/foxbear/stunned.wav differ diff --git a/sdk/samples/foxbear/surflist.dat b/sdk/samples/foxbear/surflist.dat new file mode 100644 index 0000000..90c984f --- /dev/null +++ b/sdk/samples/foxbear/surflist.dat @@ -0,0 +1,15 @@ + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/sdk/samples/foxbear/throw.wav b/sdk/samples/foxbear/throw.wav new file mode 100644 index 0000000..87cd36d Binary files /dev/null and b/sdk/samples/foxbear/throw.wav differ diff --git a/sdk/samples/foxbear/tile.c b/sdk/samples/foxbear/tile.c new file mode 100644 index 0000000..3816cb8 --- /dev/null +++ b/sdk/samples/foxbear/tile.c @@ -0,0 +1,152 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: tile.c + * Content: tile loading and initialization functions + * + ***************************************************************************/ +#include "foxbear.h" + +/* + * CreateTiles + */ +HBITMAPLIST *CreateTiles( HBITMAPLIST *phBitmapList, USHORT n ) +{ + HBITMAPLIST *hTileList; + USHORT i; + + hTileList = CMemAlloc( n, sizeof (HBITMAPLIST) ); + + if( hTileList == NULL ) + { + ErrorMessage( "hTileList in CreateTiles" ); + } + + for( i = 0; i < n; ++i ) + { + hTileList[i].hBM = phBitmapList[i].hBM; + } + return hTileList; + +} /* CreateTiles */ + +/* + * DestroyTiles + */ +BOOL DestroyTiles( HBITMAPLIST *phTileList ) +{ + MemFree( phTileList ); + + return TRUE; + +} /* DestroyTiles */ + +/* + * getData + */ +LPSTR getData(LPSTR fileName) +{ + LPSTR p = NULL; + HRSRC hRes; + + hRes = FindResource(NULL, fileName, RT_RCDATA); + + if( hRes != NULL ) + { + p = LockResource(LoadResource(NULL, hRes)); + } + + return p; + +} /* getData */ + +/* + * CreatePosList + */ +HPOSLIST *CreatePosList( LPSTR fileName, USHORT width, USHORT height ) +{ + HPOSLIST *hPosList; + USHORT pos; + LPSTR p; + + p = getData( fileName ); + + if( p == NULL ) + { + ErrorMessage( "p in CreatePosList" ); + } + + hPosList = CMemAlloc( width * height, sizeof (USHORT) ); + + if( hPosList == NULL ) + { + ErrorMessage( "posList in CreatePosList" ); + } + + for( pos = 0; pos < width * height; ++pos ) + { + hPosList[pos] = (USHORT) getint(&p, 0) - 1; + } + + return hPosList; + +} /* CreatePosList */ + +/* + * CreateSurfaceList + */ +HSURFACELIST *CreateSurfaceList( LPSTR fileName, USHORT width, USHORT height ) +{ + HSURFACELIST *hSurfaceList; + USHORT pos; + USHORT value; + LPSTR p; + + p = getData( fileName ); + + if( p == NULL ) + { + ErrorMessage( "p in CreateSurfaceList" ); + } + + hSurfaceList = CMemAlloc( width * height, sizeof (HSURFACELIST) ); + + if( hSurfaceList == NULL ) + { + ErrorMessage( "posList in CreateSurfaceList" ); + } + + for( pos = 0; pos < width * height; ++pos ) + { + value = (USHORT) getint(&p, 0); + + if( value == 0 ) + { + hSurfaceList[pos] = FALSE; + } + else + { + hSurfaceList[pos] = TRUE; + } + } + + return hSurfaceList; + +} /* CreateSurfaceList */ + +/* + * DestoryPosList + */ +BOOL DestroyPosList ( HPOSLIST *posList ) +{ + if( posList == NULL ) + { + ErrorMessage( "posList in DestroyPosList" ); + } + + MemFree( posList ); + return TRUE; + +} /* DestroyPosList */ diff --git a/sdk/samples/foxbear/tile.h b/sdk/samples/foxbear/tile.h new file mode 100644 index 0000000..c89ba32 --- /dev/null +++ b/sdk/samples/foxbear/tile.h @@ -0,0 +1,20 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * Copyright (C) 1994-1995 ATI Technologies Inc. All Rights Reserved. + * + * File: tile.h + * Content: tile include file + * + ***************************************************************************/ +#ifndef TILE__H__ +#define TILE__H__ + +HBITMAPLIST *CreateTiles( HBITMAPLIST*, USHORT ); +void ReloadTiles( HBITMAPLIST*, USHORT ); +BOOL DestroyTiles( HBITMAPLIST* ); +HPOSLIST *CreatePosList( CHAR*, USHORT, USHORT ); +HSURFACELIST *CreateSurfaceList( CHAR*, USHORT, USHORT ); +BOOL DestroyPosList( HPOSLIST* ); + +#endif diff --git a/sdk/samples/foxbear/wavdata/16-22/jump.wav b/sdk/samples/foxbear/wavdata/16-22/jump.wav new file mode 100644 index 0000000..134cd88 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-22/jump.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-22/miss01.wav b/sdk/samples/foxbear/wavdata/16-22/miss01.wav new file mode 100644 index 0000000..8300b78 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-22/miss01.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-22/miss02.wav b/sdk/samples/foxbear/wavdata/16-22/miss02.wav new file mode 100644 index 0000000..8e5e9da Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-22/miss02.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-22/stop.wav b/sdk/samples/foxbear/wavdata/16-22/stop.wav new file mode 100644 index 0000000..834b1ee Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-22/stop.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-22/strike01.wav b/sdk/samples/foxbear/wavdata/16-22/strike01.wav new file mode 100644 index 0000000..0615e4a Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-22/strike01.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-22/strike02.wav b/sdk/samples/foxbear/wavdata/16-22/strike02.wav new file mode 100644 index 0000000..513c0a8 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-22/strike02.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-22/stunned.wav b/sdk/samples/foxbear/wavdata/16-22/stunned.wav new file mode 100644 index 0000000..3950a8c Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-22/stunned.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-22/throw.wav b/sdk/samples/foxbear/wavdata/16-22/throw.wav new file mode 100644 index 0000000..87cd36d Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-22/throw.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-44/jump.wav b/sdk/samples/foxbear/wavdata/16-44/jump.wav new file mode 100644 index 0000000..5c0b8bd Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-44/jump.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-44/miss01.wav b/sdk/samples/foxbear/wavdata/16-44/miss01.wav new file mode 100644 index 0000000..15b38be Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-44/miss01.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-44/miss02.wav b/sdk/samples/foxbear/wavdata/16-44/miss02.wav new file mode 100644 index 0000000..1a15f40 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-44/miss02.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-44/stop.wav b/sdk/samples/foxbear/wavdata/16-44/stop.wav new file mode 100644 index 0000000..7becea5 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-44/stop.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-44/strike01.wav b/sdk/samples/foxbear/wavdata/16-44/strike01.wav new file mode 100644 index 0000000..1654965 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-44/strike01.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-44/strike02.wav b/sdk/samples/foxbear/wavdata/16-44/strike02.wav new file mode 100644 index 0000000..5826391 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-44/strike02.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-44/stunned.wav b/sdk/samples/foxbear/wavdata/16-44/stunned.wav new file mode 100644 index 0000000..ad75538 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-44/stunned.wav differ diff --git a/sdk/samples/foxbear/wavdata/16-44/throw.wav b/sdk/samples/foxbear/wavdata/16-44/throw.wav new file mode 100644 index 0000000..a7f9e8a Binary files /dev/null and b/sdk/samples/foxbear/wavdata/16-44/throw.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-11/jump.wav b/sdk/samples/foxbear/wavdata/8-11/jump.wav new file mode 100644 index 0000000..232381b Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-11/jump.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-11/miss01.wav b/sdk/samples/foxbear/wavdata/8-11/miss01.wav new file mode 100644 index 0000000..a2d84db Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-11/miss01.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-11/miss02.wav b/sdk/samples/foxbear/wavdata/8-11/miss02.wav new file mode 100644 index 0000000..27f2373 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-11/miss02.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-11/stop.wav b/sdk/samples/foxbear/wavdata/8-11/stop.wav new file mode 100644 index 0000000..c5eeaba Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-11/stop.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-11/strike01.wav b/sdk/samples/foxbear/wavdata/8-11/strike01.wav new file mode 100644 index 0000000..300c5e0 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-11/strike01.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-11/strike02.wav b/sdk/samples/foxbear/wavdata/8-11/strike02.wav new file mode 100644 index 0000000..68e1213 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-11/strike02.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-11/stunned.wav b/sdk/samples/foxbear/wavdata/8-11/stunned.wav new file mode 100644 index 0000000..8fa5a5f Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-11/stunned.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-11/throw.wav b/sdk/samples/foxbear/wavdata/8-11/throw.wav new file mode 100644 index 0000000..c187ba6 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-11/throw.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-22/jump.wav b/sdk/samples/foxbear/wavdata/8-22/jump.wav new file mode 100644 index 0000000..dd9b2a4 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-22/jump.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-22/miss01.wav b/sdk/samples/foxbear/wavdata/8-22/miss01.wav new file mode 100644 index 0000000..9b96d94 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-22/miss01.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-22/miss02.wav b/sdk/samples/foxbear/wavdata/8-22/miss02.wav new file mode 100644 index 0000000..7ec24c1 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-22/miss02.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-22/stop.wav b/sdk/samples/foxbear/wavdata/8-22/stop.wav new file mode 100644 index 0000000..cebe334 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-22/stop.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-22/strike01.wav b/sdk/samples/foxbear/wavdata/8-22/strike01.wav new file mode 100644 index 0000000..ef2cb56 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-22/strike01.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-22/strike02.wav b/sdk/samples/foxbear/wavdata/8-22/strike02.wav new file mode 100644 index 0000000..06de180 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-22/strike02.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-22/stunned.wav b/sdk/samples/foxbear/wavdata/8-22/stunned.wav new file mode 100644 index 0000000..2a1a5d4 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-22/stunned.wav differ diff --git a/sdk/samples/foxbear/wavdata/8-22/throw.wav b/sdk/samples/foxbear/wavdata/8-22/throw.wav new file mode 100644 index 0000000..da2a301 Binary files /dev/null and b/sdk/samples/foxbear/wavdata/8-22/throw.wav differ diff --git a/sdk/samples/globe/globe.c b/sdk/samples/globe/globe.c new file mode 100644 index 0000000..bc32ade --- /dev/null +++ b/sdk/samples/globe/globe.c @@ -0,0 +1,225 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: globe.c + * + ***************************************************************************/ + +#include "rmdemo.h" + +D3DRMRENDERQUALITY quality = D3DRMRENDER_GOURAUD; + +LPDIRECT3DRMANIMATION anim; +int motion_points = 17; + +D3DVECTOR motion[17] = +{{-D3DVAL(14), D3DVAL(4), D3DVAL(45)}, +{D3DVAL(9), -D3DVAL(3), D3DVAL(36)}, +{D3DVAL(5), D3DVAL(0), D3DVAL(5)}, +{-D3DVAL(5), D3DVAL(8), D3DVAL(25)}, +{D3DVAL(0), D3DVAL(3), D3DVAL(20)}, +{-D3DVAL(3), -D3DVAL(4), D3DVAL(10)}, +{D3DVAL(8), D3DVAL(10), D3DVAL(15)}, +{D3DVAL(16), D3DVAL(0), D3DVAL(30)}, +{D3DVAL(10), -D3DVAL(4), D3DVAL(42)}, +{-D3DVAL(15), D3DVAL(0), D3DVAL(37)}, +{-D3DVAL(5), -D3DVAL(7), D3DVAL(15)}, +{D3DVAL(5), D3DVAL(5), D3DVAL(20)}, +{D3DVAL(5), D3DVAL(10), D3DVAL(30)}, +{D3DVAL(13), D3DVAL(8), D3DVAL(50)}, +{D3DVAL(0), D3DVAL(8), D3DVAL(25)}, +{D3DVAL(0), D3DVAL(0), D3DVAL(20)}, +{-D3DVAL(14), D3DVAL(4), D3DVAL(45)} +}; + +static void CDECL cleanupPath(LPDIRECT3DRMOBJECT obj, void* arg) +{ + anim->lpVtbl->Release(anim); +} + +static void CDECL moveCamera(LPDIRECT3DRMFRAME frame, void *arg, D3DVALUE delta) +{ + static D3DVALUE t = D3DVAL(0.0); + LPDIRECT3DRMFRAME world_frame = (LPDIRECT3DRMFRAME) arg; + LPDIRECT3DRMFRAME scene; + + frame->lpVtbl->GetScene(frame, &scene); + + t += D3DVAL(0.08); + anim->lpVtbl->SetFrame(anim, frame); + anim->lpVtbl->SetTime(anim, t); + + frame->lpVtbl->LookAt(frame, world_frame, scene, D3DRMCONSTRAIN_Z); + + scene->lpVtbl->Release(scene); +} + +/* + * world_scene + */ +BOOL +run_world_scene(LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + LPDIRECT3DRMFRAME light1 = NULL; + LPDIRECT3DRMFRAME world_frame = NULL; + LPDIRECT3DRMLIGHT l1 = NULL; + LPDIRECT3DRMLIGHT l2 = NULL; + LPDIRECT3DRMTEXTURE tex = NULL; + LPDIRECT3DRMWRAP wrap = NULL; + LPDIRECT3DRMMESHBUILDER sphere3_builder = NULL; + LPDIRECT3DRMMATERIAL mat = NULL; + HRESULT rval; + D3DRMBOX box; + D3DVALUE miny, maxy, height; + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &light1))) + goto generic_error; + if (FAILED(light1->lpVtbl->SetPosition(light1, scene, D3DVAL(2), D3DVAL(0.0), D3DVAL(22)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_DIRECTIONAL, D3DVAL(0.9), + D3DVAL(0.9), D3DVAL(0.9), &l1))) + goto generic_error; + if (FAILED(light1->lpVtbl->AddLight(light1, l1))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT, D3DVAL(0.1), + D3DVAL(0.1), D3DVAL(0.1), &l2))) + goto generic_error; + if (FAILED(scene->lpVtbl->AddLight(scene, l2))) + goto generic_error; + if (FAILED(camera->lpVtbl->SetPosition(camera, scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)))) + goto generic_error; + if (FAILED(camera->lpVtbl->SetOrientation(camera, scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1), D3DVAL(0.0), + D3DVAL(1), D3DVAL(0.0)))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &world_frame))) + goto generic_error; + if (FAILED(world_frame->lpVtbl->SetPosition(world_frame, scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(30)))) + goto generic_error; + if (FAILED(world_frame->lpVtbl->SetOrientation(world_frame, scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1), + D3DVAL(0.0), D3DVAL(1), D3DVAL(0.0)))) + goto generic_error; + if (FAILED(world_frame->lpVtbl->SetRotation(world_frame, scene, D3DVAL(0.03), + D3DVAL(0.1), D3DVAL(0.0), D3DVAL(0.1)))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &sphere3_builder))) + goto generic_error; + rval = sphere3_builder->lpVtbl->Load(sphere3_builder, "sphere3.x", + NULL, D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load sphere3.x.\n%s", D3DRMErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(lpD3DRM->lpVtbl->CreateMaterial(lpD3DRM, D3DVAL(20.0), &mat))) + goto generic_error; + if (FAILED(sphere3_builder->lpVtbl->SetMaterial(sphere3_builder, mat))) + goto generic_error; + mat->lpVtbl->Release(mat); mat = NULL; + if (FAILED(sphere3_builder->lpVtbl->Scale(sphere3_builder, + D3DVAL(2), D3DVAL(2), D3DVAL(2)))) + goto generic_error; + + if (FAILED(sphere3_builder->lpVtbl->SetColorRGB(sphere3_builder, D3DVAL(1), D3DVAL(1), D3DVAL(1)))) + goto generic_error; + if (FAILED(sphere3_builder->lpVtbl->GetBox(sphere3_builder, &box))) + goto generic_error; + maxy = box.max.y; + miny = box.min.y; + height = maxy - miny; + + if (FAILED(lpD3DRM->lpVtbl->CreateWrap + (lpD3DRM, D3DRMWRAP_CYLINDER, NULL, + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), + D3DVAL(0.0), D3DDivide(miny, height), + D3DVAL(1.0), D3DDivide(-D3DVAL(1.0), height), + &wrap + ))) + goto generic_error; + if (FAILED(wrap->lpVtbl->Apply(wrap, (LPDIRECT3DRMOBJECT) sphere3_builder))) + goto generic_error; + + rval = lpD3DRM->lpVtbl->LoadTexture(lpD3DRM, "tex1.ppm", &tex); + if (rval != D3DRM_OK) { + Msg("Failed to load tex1.ppm\n%s", D3DRMErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(tex->lpVtbl->SetShades(tex, 32))) + goto generic_error; + if (FAILED(sphere3_builder->lpVtbl->SetTexture(sphere3_builder, tex))) + goto generic_error; + + if (FAILED(world_frame->lpVtbl->AddVisual(world_frame, (LPDIRECT3DRMVISUAL) sphere3_builder))) + goto generic_error; + + if (FAILED(camera->lpVtbl->AddMoveCallback(camera, moveCamera, + (void *) world_frame))) + goto generic_error; + if (FAILED(camera->lpVtbl->AddDestroyCallback(camera, cleanupPath, NULL))) + goto generic_error; + + RELEASE(light1); + RELEASE(world_frame); + RELEASE(sphere3_builder); + RELEASE(l1); + RELEASE(l2); + RELEASE(tex); + RELEASE(wrap); + return TRUE; +generic_error: + Msg("An error occurred while building the scene.\n"); +ret_with_error: + RELEASE(light1); + RELEASE(world_frame); + RELEASE(l1); + RELEASE(l2); + RELEASE(tex); + RELEASE(wrap); + RELEASE(sphere3_builder); + RELEASE(mat); + return FALSE; +} + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + int i; + + view = view; /* not used */ + + /* + * This example flys a camera around a globe. The path taken is + * defined by a spline curve. + */ + + + if (FAILED(dev->lpVtbl->SetQuality(dev, quality))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateAnimation(lpD3DRM, &anim))) + goto generic_error; + if (FAILED(anim->lpVtbl->SetOptions(anim, D3DRMANIMATION_CLOSED | D3DRMANIMATION_LINEARPOSITION | D3DRMANIMATION_POSITION))) + goto generic_error; + for (i = 0; i < motion_points; i++) { + if (FAILED(anim->lpVtbl->AddPositionKey(anim, D3DVAL(i), motion[i].x, motion[i].y, + motion[i].z/2))) + goto generic_error; + } + if (!run_world_scene(scene, camera)) + goto ret_with_error; + return TRUE; +generic_error: + Msg("A failure occurred while building the scene.\n"); +ret_with_error: + return FALSE; +} + +void +OverrideDefaults(Defaults* defaults) +{ + lstrcpy(defaults->Name, "Globe Direct3DRM Example"); +} diff --git a/sdk/samples/globe/globe.def b/sdk/samples/globe/globe.def new file mode 100644 index 0000000..6866888 --- /dev/null +++ b/sdk/samples/globe/globe.def @@ -0,0 +1,10 @@ +NAME globe.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/globe/makefile b/sdk/samples/globe/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/globe/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/globe/msvc.mk b/sdk/samples/globe/msvc.mk new file mode 100644 index 0000000..1f5b5c8 --- /dev/null +++ b/sdk/samples/globe/msvc.mk @@ -0,0 +1,42 @@ +NAME = globe +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = globe.obj rmmain.obj rmerror.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT =-DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/globe/readme.txt b/sdk/samples/globe/readme.txt new file mode 100644 index 0000000..a9ad11e --- /dev/null +++ b/sdk/samples/globe/readme.txt @@ -0,0 +1,5 @@ +Globe +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Loading a simple XOF of a single mesh object with textures. diff --git a/sdk/samples/hier1/hier1.c b/sdk/samples/hier1/hier1.c new file mode 100644 index 0000000..5a4190d --- /dev/null +++ b/sdk/samples/hier1/hier1.c @@ -0,0 +1,199 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: hier1.c + * + ***************************************************************************/ + +/* + * RL Tutorial program 2 frame hierarchy + */ + +#include "rmdemo.h" + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + D3DRMRENDERQUALITY quality = D3DRMRENDER_FLAT; + LPDIRECT3DRMFRAME lights = NULL; + LPDIRECT3DRMFRAME axis = NULL; + LPDIRECT3DRMMESH torus_mesh = NULL; + LPDIRECT3DRMMESH sphere_mesh = NULL; + LPDIRECT3DRMFRAME torus = NULL; + LPDIRECT3DRMFRAME sphere = NULL; + LPDIRECT3DRMLIGHT lp = NULL; + LPDIRECT3DRMLIGHT la = NULL; + LPDIRECT3DRMMESHBUILDER builder = NULL; + HRESULT rval; + + view = view; /* not used */ + + /* + * This Demo shows a simple hierarchy of frames + */ + + if (FAILED(dev->lpVtbl->SetQuality(dev, quality))) + goto generic_error; + + /* + * initialize the lights in the scene + */ + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &lights))) + goto generic_error; + if (FAILED(lights->lpVtbl->SetPosition(lights, scene, D3DVAL(5), D3DVAL(5), + -D3DVAL(9)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_POINT, D3DVAL(0.9), + D3DVAL(0.8), D3DVAL(0.7), &lp))) + goto generic_error; + if (FAILED(lights->lpVtbl->AddLight(lights, lp))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT, D3DVAL(0.1), + D3DVAL(0.1), D3DVAL(0.1), &la))) + goto generic_error; + if (FAILED(scene->lpVtbl->AddLight(scene, la))) + goto generic_error; + + + /* + * load mesh files + */ + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &builder))) + goto generic_error; + rval = builder->lpVtbl->Load(builder, "torus.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load torus.x\n%s", D3DRMErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(builder->lpVtbl->CreateMesh(builder, &torus_mesh))) + goto generic_error; + RELEASE(builder); + + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &builder))) + goto generic_error; + rval = builder->lpVtbl->Load(builder, "sphere2.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load sphere2.x\n%s", D3DRMErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(builder->lpVtbl->CreateMesh(builder, &sphere_mesh))) + goto generic_error; + RELEASE(builder); + + if (FAILED(torus_mesh->lpVtbl->SetGroupColorRGB(torus_mesh, -1, D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0)))) + goto generic_error; + + /* + * create a torus frame within the scene create axis frame within + * frame of sphere create torus frame within frame of axis + */ + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &sphere))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, sphere, &axis))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, axis, &torus))) + goto generic_error; + + { + /* + * load a texture and wrap it onto the sphere + */ + LPDIRECT3DRMTEXTURE tex; + LPDIRECT3DRMWRAP wrap; + D3DVALUE height; + + D3DRMBOX box; + D3DVALUE miny, maxy; + if (FAILED(sphere_mesh->lpVtbl->GetBox(sphere_mesh, &box))) + goto generic_error; + maxy = box.max.y; + miny = box.min.y; + height = maxy - miny; + + if (FAILED(lpD3DRM->lpVtbl->CreateWrap(lpD3DRM, D3DRMWRAP_CYLINDER, NULL, D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DDivide(maxy, height), D3DVAL(1.0), + D3DDivide(D3DVAL(1), height), &wrap))) + goto generic_error; + if (FAILED(wrap->lpVtbl->Apply(wrap, (LPDIRECT3DRMOBJECT)sphere_mesh))) + goto generic_error; + RELEASE(wrap); + + rval = lpD3DRM->lpVtbl->LoadTexture(lpD3DRM, "tex2.ppm", &tex); + if (rval != D3DRM_OK) { + Msg("Failed to load tex2.ppm\n%s", D3DRMErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(tex->lpVtbl->SetColors(tex, 16))) + goto generic_error; + if (FAILED(tex->lpVtbl->SetShades(tex, 8))) + goto generic_error; + if (FAILED(sphere_mesh->lpVtbl->SetGroupTexture(sphere_mesh, -1, tex))) + goto generic_error; + RELEASE(tex); + } + /* + * add the loaded mesh into the frame + */ + if (FAILED(torus->lpVtbl->AddVisual(torus, (LPDIRECT3DRMVISUAL) torus_mesh))) + goto generic_error; + if (FAILED(sphere->lpVtbl->AddVisual(sphere, (LPDIRECT3DRMVISUAL) sphere_mesh))) + goto generic_error; + + /* + * set up the frames position, orientation and rotation + */ + if (FAILED(camera->lpVtbl->SetPosition(camera, scene, D3DVAL(0), D3DVAL(0), -D3DVAL(10)))) + goto generic_error; + if (FAILED(sphere->lpVtbl->SetPosition(sphere, scene, D3DVAL(0), D3DVAL(0), D3DVAL(0)))) + goto generic_error; + if (FAILED(axis->lpVtbl->SetPosition(axis, sphere, D3DVAL(2), D3DVAL(0), D3DVAL(0)))) + goto generic_error; + if (FAILED(torus->lpVtbl->SetPosition(torus, axis, D3DVAL(1.0), D3DVAL(0), D3DVAL(0)))) + goto generic_error; + + if (FAILED(sphere->lpVtbl->SetRotation(sphere, scene, D3DVAL(0), D3DVAL(1.0), D3DVAL(0.5),D3DVAL(0.05)))) + goto generic_error; + if (FAILED(axis->lpVtbl->SetRotation(axis, sphere, D3DVAL(1), D3DVAL(0), D3DVAL(0), D3DVAL(0.01)))) + goto generic_error; + if (FAILED(torus->lpVtbl->SetRotation(torus, axis, D3DVAL(0), D3DVAL(0), D3DVAL(1), -D3DVAL(0.05)))) + goto generic_error; + + RELEASE(lights); + RELEASE(axis); + RELEASE(torus_mesh); + RELEASE(sphere_mesh); + RELEASE(torus); + RELEASE(sphere); + RELEASE(lp); + RELEASE(la); + return TRUE; +generic_error: + Msg("A failure occurred while building the scene.\n"); +ret_with_error: + RELEASE(lights); + RELEASE(axis); + RELEASE(torus_mesh); + RELEASE(sphere_mesh); + RELEASE(torus); + RELEASE(sphere); + RELEASE(lp); + RELEASE(la); + RELEASE(builder); + return FALSE; +} + +void +OverrideDefaults(Defaults* defaults) +{ + defaults->bConstRenderQuality = TRUE; + lstrcpy(defaults->Name, "Frame Hierarchy D3D RM Example"); +} diff --git a/sdk/samples/hier1/hier1.def b/sdk/samples/hier1/hier1.def new file mode 100644 index 0000000..02e0970 --- /dev/null +++ b/sdk/samples/hier1/hier1.def @@ -0,0 +1,10 @@ +NAME hier1.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/hier1/makefile b/sdk/samples/hier1/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/hier1/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/hier1/msvc.mk b/sdk/samples/hier1/msvc.mk new file mode 100644 index 0000000..9379aa4 --- /dev/null +++ b/sdk/samples/hier1/msvc.mk @@ -0,0 +1,42 @@ +NAME = hier1 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = hier1.obj rmmain.obj rmerror.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT =-DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/hier1/readme.txt b/sdk/samples/hier1/readme.txt new file mode 100644 index 0000000..20ed73e --- /dev/null +++ b/sdk/samples/hier1/readme.txt @@ -0,0 +1,5 @@ +Hier1 +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +A simple hierarchy of two meshes demonstrating the concept of frames. diff --git a/sdk/samples/hier2/hier2.c b/sdk/samples/hier2/hier2.c new file mode 100644 index 0000000..577a64a --- /dev/null +++ b/sdk/samples/hier2/hier2.c @@ -0,0 +1,224 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: hier2.c + * + ***************************************************************************/ + +/* + * D3D RM Tutorial program frame hierarchy 2 + */ + +#include "rmdemo.h" + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + D3DRMRENDERQUALITY quality = D3DRMRENDER_FLAT; + LPDIRECT3DRMLIGHT l1 = NULL; + LPDIRECT3DRMLIGHT l2 = NULL; + LPDIRECT3DRMFRAME lights = NULL; + LPDIRECT3DRMMESHBUILDER torus_builder = NULL; + LPDIRECT3DRMMESHBUILDER sphere_builder = NULL; + LPDIRECT3DRMMESHBUILDER cube1_builder = NULL; + LPDIRECT3DRMMESHBUILDER cube2_builder = NULL; + LPDIRECT3DRMMESH cube1_mesh = NULL; + LPDIRECT3DRMMESH cube2_mesh = NULL; + LPDIRECT3DRMMESH torus_mesh = NULL; + LPDIRECT3DRMMESH sphere_mesh = NULL; + LPDIRECT3DRMFRAME torus = NULL; + LPDIRECT3DRMFRAME sphere = NULL; + LPDIRECT3DRMFRAME cube1 = NULL; + LPDIRECT3DRMFRAME cube2 = NULL; + HRESULT rval; + view = view; /* not used */ + + /* + * This Demo shows a more complex hierarchy of frames + */ + + if (FAILED(dev->lpVtbl->SetQuality(dev, quality))) + goto generic_error; + if (FAILED(dev->lpVtbl->SetShades(dev, 16))) + goto generic_error; + + /* + * initialize the lights in the scene + */ + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &lights))) + goto generic_error; + if (FAILED(lights->lpVtbl->SetPosition(lights, scene, D3DVAL(5), D3DVAL(5), + -D3DVAL(5)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_POINT, D3DVAL(0.9), + D3DVAL(0.8), D3DVAL(0.7), &l1))) + goto generic_error; + if (FAILED(lights->lpVtbl->AddLight(lights, l1))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT, D3DVAL(0.1), + D3DVAL(0.1), D3DVAL(0.1), &l2))) + goto generic_error; + if (FAILED(scene->lpVtbl->AddLight(scene, l2))) + goto generic_error; + /* + * load mesh files + */ + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &torus_builder))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &sphere_builder))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &cube1_builder))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &cube2_builder))) + goto generic_error; + rval = torus_builder->lpVtbl->Load(torus_builder, "torus.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load torus.x.\n"); + goto ret_with_error; + } + rval = sphere_builder->lpVtbl->Load(sphere_builder, "sphere4.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load sphere4.x.\n"); + goto ret_with_error; + } + rval = cube1_builder->lpVtbl->Load(cube1_builder, "cube.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load cube.x.\n"); + goto ret_with_error; + } + rval = cube2_builder->lpVtbl->Load(cube2_builder, "cube.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load cube.x.\n"); + goto ret_with_error; + } + + if (FAILED(cube1_builder->lpVtbl->Scale(cube1_builder, D3DVAL(0.25), D3DVAL(0.5), + D3DVAL(1.0)))) + goto generic_error; + if (FAILED(cube2_builder->lpVtbl->Scale(cube2_builder, D3DVAL(0.5), D3DVAL(1.5), + D3DVAL(1.0)))) + goto generic_error; + + if (FAILED(cube1_builder->lpVtbl->SetColorRGB(cube1_builder, D3DVAL(0.7), + D3DVAL(0.0), D3DVAL(0.8)))) + goto generic_error; + if (FAILED(cube2_builder->lpVtbl->SetColorRGB(cube2_builder, D3DVAL(0.0), + D3DVAL(1.0), D3DVAL(0.5)))) + goto generic_error; + if (FAILED(torus_builder->lpVtbl->SetColorRGB(torus_builder, D3DVAL(0.2), + D3DVAL(1.0), D3DVAL(0.8)))) + goto generic_error; + + if (FAILED(torus_builder->lpVtbl->CreateMesh(torus_builder, &torus_mesh))) + goto generic_error; + if (FAILED(sphere_builder->lpVtbl->CreateMesh(sphere_builder, &sphere_mesh))) + goto generic_error; + if (FAILED(cube1_builder->lpVtbl->CreateMesh(cube1_builder, &cube1_mesh))) + goto generic_error; + if (FAILED(cube2_builder->lpVtbl->CreateMesh(cube2_builder, &cube2_mesh))) + goto generic_error; + RELEASE(torus_builder); + RELEASE(sphere_builder); + RELEASE(cube1_builder); + RELEASE(cube2_builder); + + /* + * create a torus frame within the scene create torus frame within + * frame of sphere cube frame within frame of torus + */ + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &sphere))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, sphere, &torus))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, torus, &cube1))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, torus, &cube2))) + goto generic_error; + + /* + * add the loaded mesh into the frame + */ + + if (FAILED(torus->lpVtbl->AddVisual(torus, (LPDIRECT3DRMVISUAL) torus_mesh))) + goto generic_error; + if (FAILED(sphere->lpVtbl->AddVisual(sphere, (LPDIRECT3DRMVISUAL) sphere_mesh))) + goto generic_error; + if (FAILED(cube1->lpVtbl->AddVisual(cube1, (LPDIRECT3DRMVISUAL) cube1_mesh))) + goto generic_error; + if (FAILED(cube2->lpVtbl->AddVisual(cube2, (LPDIRECT3DRMVISUAL) cube2_mesh))) + goto generic_error; + + /* + * set up the frames position, orientation and rotations + */ + + if (FAILED(camera->lpVtbl->SetPosition(camera, scene, D3DVAL(0), D3DVAL(0), -D3DVAL(25)))) + goto generic_error; + if (FAILED(sphere->lpVtbl->SetPosition(sphere, scene, D3DVAL(0), D3DVAL(0), D3DVAL(0)))) + goto generic_error; + if (FAILED(torus->lpVtbl->SetPosition(torus, sphere, D3DVAL(6), D3DVAL(0), D3DVAL(0)))) + goto generic_error; + if (FAILED(cube1->lpVtbl->SetPosition(cube1, torus, D3DVAL(0), D3DVAL(4), D3DVAL(0)))) + goto generic_error; + if (FAILED(cube2->lpVtbl->SetPosition(cube2, torus, D3DVAL(0), -D3DVAL(4), D3DVAL(0)))) + goto generic_error; + + if (FAILED(sphere->lpVtbl->SetRotation(sphere, scene, D3DVAL(0), D3DVAL(0), D3DVAL(1),D3DVAL(0.01)))) + goto generic_error; + if (FAILED(torus->lpVtbl->SetRotation(torus, sphere, D3DVAL(1), D3DVAL(0), D3DVAL(0), D3DVAL(0.02)))) + goto generic_error; + if (FAILED(cube1->lpVtbl->SetRotation(cube1, torus, D3DVAL(0.1), D3DVAL(0.2), + D3DVAL(0.7), D3DVAL(0.03)))) + goto generic_error; + if (FAILED(cube2->lpVtbl->SetRotation(cube2, torus, D3DVAL(0.7), D3DVAL(0.1), + D3DVAL(0.2), D3DVAL(0.03)))) + goto generic_error; + + RELEASE(lights); + RELEASE(torus_mesh); + RELEASE(sphere_mesh); + RELEASE(cube1_mesh); + RELEASE(cube2_mesh); + RELEASE(torus); + RELEASE(sphere); + RELEASE(cube1); + RELEASE(cube2); + RELEASE(l1); + RELEASE(l2); + return TRUE; +generic_error: + Msg("A failure occurred while building the scene.\n"); +ret_with_error: + RELEASE(l1); + RELEASE(l2); + RELEASE(lights); + RELEASE(torus_builder); + RELEASE(sphere_builder); + RELEASE(cube1_builder); + RELEASE(cube2_builder); + RELEASE(cube1_mesh); + RELEASE(cube2_mesh); + RELEASE(torus_mesh); + RELEASE(sphere_mesh); + RELEASE(torus); + RELEASE(sphere); + RELEASE(cube1); + RELEASE(cube2); + return FALSE; +} + +void +OverrideDefaults(Defaults* defaults) +{ + defaults->bNoTextures = TRUE; + defaults->bConstRenderQuality = TRUE; + lstrcpy(defaults->Name, "Frame Hierarchy II D3D RM Example"); +} diff --git a/sdk/samples/hier2/hier2.def b/sdk/samples/hier2/hier2.def new file mode 100644 index 0000000..bf5f81b --- /dev/null +++ b/sdk/samples/hier2/hier2.def @@ -0,0 +1,10 @@ +NAME hier2.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/hier2/makefile b/sdk/samples/hier2/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/hier2/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/hier2/msvc.mk b/sdk/samples/hier2/msvc.mk new file mode 100644 index 0000000..04d88fa --- /dev/null +++ b/sdk/samples/hier2/msvc.mk @@ -0,0 +1,42 @@ +NAME = hier2 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = hier2.obj rmmain.obj rmerror.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT =-DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/hier2/readme.txt b/sdk/samples/hier2/readme.txt new file mode 100644 index 0000000..b01d61b --- /dev/null +++ b/sdk/samples/hier2/readme.txt @@ -0,0 +1,5 @@ +Hier2 +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Another simple hierarchy of four meshes. diff --git a/sdk/samples/iklowns/cgaction.cpp b/sdk/samples/iklowns/cgaction.cpp new file mode 100644 index 0000000..2cb64b7 --- /dev/null +++ b/sdk/samples/iklowns/cgaction.cpp @@ -0,0 +1,352 @@ +/*===========================================================================*\ +| +| File: cgaction.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + + +#include <ctype.h> +#include <windows.h> +#ifdef __WATCOMC__ +#include <stdlib.h> +#endif +#include "cgglobl.h" +#include "cgdebug.h" +#include "cgsprite.h" +#include "strrec.h" +#include "cgaction.h" +#include "cgimage.h" + +/*---------------------------------------------------------------------------*\ +| +| Class CGameAction +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ +CGameAction::CGameAction( + char* pFileName, + char* pActionName, + DWORD objID + ) : mpSequence( NULL ) +{ + // get the sequence info + char sequenceBuf[256]; + char fileBuf[256]; + char defSequence[] = ""; // no default sequence names + int frameRate; + + GetPrivateProfileString( + pActionName, + "SequenceName", + defSequence, + sequenceBuf, + sizeof( sequenceBuf ), + pFileName + ); + + GetPrivateProfileString( + pActionName, + "SequenceFile", + defSequence, + fileBuf, + sizeof( fileBuf ), + pFileName + ); + + frameRate = GetPrivateProfileInt( + pActionName, + "Rate", + 30, + pFileName + ); + + // should we keep a mirror? + BOOL mirrorHorz = (int) GetPrivateProfileInt( + pActionName, + "MirrorHorizontal", + FALSE, + pFileName + ); + + BOOL mirrorVert = (int) GetPrivateProfileInt( + pActionName, + "MirrorVertical", + FALSE, + pFileName + + ); + + char dirBuf[256]; + mpSequence = new CGameSpriteSequence( fileBuf, sequenceBuf, frameRate, mirrorHorz, mirrorVert ); + + // See if there is a sound associated with this action + GetPrivateProfileString ( + pActionName, + "Sound", + "", + dirBuf, + sizeof( dirBuf ), + pFileName + ); + + if (dirBuf[0] != '\0') + { + CStringRecord fields( dirBuf, "," ); + BOOL fLoop=FALSE; + + // See if the sound is to be looped when it is played + if ((fields.GetNumFields() > 2) && (toupper(*fields[2]) == 'L')) + { + fLoop = TRUE; + } + + // Create sound effect object based on WAV file + pSoundEffect = new CSoundEffect(fields[0], objID, fLoop, gSoundMode); + + // If a volume was specified and sound got created ok, + // set the defaul volume + if ((pSoundEffect != NULL) && (fields.GetNumFields() > 1)) + { + defaultVolume = atoi(fields[1]); + pSoundEffect->SetVolume(defaultVolume); + } + } else { + pSoundEffect = NULL; + } + // See if there is an ending sound associated with this action + GetPrivateProfileString ( + pActionName, + "SoundEnd", + "", + dirBuf, + sizeof( dirBuf ), + pFileName + ); + + if (dirBuf[0] != '\0') + { + CStringRecord fields( dirBuf, "," ); + + // Create sound effect object based on WAV file + pEndSoundEffect = new CSoundEffect(fields[0], objID, FALSE, gSoundMode); + + // If a volume was specified and sound got created ok, + // set the defaul volume + if ((pEndSoundEffect != NULL) && (fields.GetNumFields() > 1)) + { + defaultVolume = atoi(fields[1]); + pEndSoundEffect->SetVolume(defaultVolume); + } + } else { + pEndSoundEffect = NULL; + } +} + +CGameAction::CGameAction( + char* pFileName, + CGameCharSequenceInfo *pSequence, + DWORD objID + ) : mpSequence( NULL ) +{ + // get the sequence info + char sequenceBuf[256]; + char fileBuf[256]; + char defSequence[] = ""; // no default sequence names + int frameRate; + lstrcpy(sequenceBuf, pSequence->SequenceName); + + lstrcpy(fileBuf, pSequence->SequenceFile); + + frameRate = pSequence->Rate; + + // should we keep a mirror? + BOOL mirrorHorz = FALSE; + BOOL mirrorVert = FALSE; + + mpSequence = new CGameSpriteSequence( fileBuf, sequenceBuf, frameRate, mirrorHorz, mirrorVert ); + + if (pSequence->Sound.Sound != NULL) + { + BOOL fLoop=FALSE; + + fLoop = pSequence->Sound.Loop; + + // Create sound effect object based on WAV file + pSoundEffect = new CSoundEffect(pSequence->Sound.Sound + , objID, fLoop, gSoundMode); + + // If a volume was specified and sound got created ok, + // set the defaul volume + if ((pSoundEffect != NULL)) + { + defaultVolume = pSequence->Sound.Rate; //atoi(fields[1]); + pSoundEffect->SetVolume(defaultVolume); + } + } else { + pSoundEffect = NULL; + } + + if (pSequence->Sound.SoundEnd != NULL) + { + + // Create sound effect object based on WAV file + pEndSoundEffect = new CSoundEffect(pSequence->Sound.SoundEnd + , objID, FALSE, gSoundMode); + + // If a volume was specified and sound got created ok, + // set the defaul volume + if (pEndSoundEffect != NULL) + { + defaultVolume = pSequence->Sound.Rate; + pEndSoundEffect->SetVolume(defaultVolume); + } + } else { + pEndSoundEffect = NULL; + } +} + + +CGameAction::~CGameAction() +{ + if (pSoundEffect != NULL) + delete pSoundEffect; + if (pEndSoundEffect != NULL) + delete pEndSoundEffect; + delete mpSequence; +} + +BOOL // return TRUE if more sprites to go after this one +CGameAction::Activate() +{ + if (pSoundEffect != NULL) + pSoundEffect->Play(); + return(TRUE); +} + +BOOL // return TRUE if more sprites to go after this one +CGameAction::DeActivate() +{ + // reset the current sequence to 0 + mpSequence->SetCurSprite( 0 ); + if (pSoundEffect != NULL) + pSoundEffect->Stop(); + if (pEndSoundEffect != NULL) + pEndSoundEffect->Play(); + return TRUE; +} + +BOOL +GetStereoValues( + int screenX, + int &vol, + int &pan +) +{ + BOOL fOffScreen = FALSE; + + if (vol == 0) + return FALSE; + + // Determine if object making sound is off screen to the + // left... + if (screenX < 0) + { + fOffScreen = TRUE; + pan = 0; // place off left speaker + } + + // or to the right... + else if (screenX > SCREEN_WIDTH) + { + fOffScreen = TRUE; + pan = 127; // place off right speaker + + // or somewhere on screen + } else { + pan = (screenX * 127) / SCREEN_WIDTH; + } + + + // If it is off screen, lower the volume accordingly + if (fOffScreen) + { + int howFarX; + + // Figure out how far to the left or right the object is + // off screen. + howFarX = (screenX > 0) ? screenX-SCREEN_WIDTH : -screenX; + + // Adjust the volume proportionally so that it is full + // volume when it reaches the screen and zero volume when + // it is a full screen widths away. + vol = vol - (howFarX * vol / SCREEN_WIDTH); + + if (vol < 0) + vol = 0; + } + + // return TRUE if a sound should be made + return (vol != 0); +} + + +BOOL // return TRUE if more sprites to go after this one +CGameAction::Update(int screenX) +{ + int PanVal; + int curVolume = defaultVolume; + + if (pSoundEffect != NULL) + { + // Place sound in accordance with objects position in the world! + if (GetStereoValues(screenX, curVolume, PanVal)) + { + pSoundEffect->SetVolume(curVolume); + pSoundEffect->SetPan(PanVal); + pSoundEffect->SetMute(FALSE); // make sure it is playing + } else { + pSoundEffect->SetMute(TRUE); // make sure it is stopped + } + } + + return mpSequence->Frame(); +} + +void +CGameAction::Render( + CGameScreen* pScreen, + int x, + int y, + BOOL revX, + BOOL revY, + LPRECT pDirty + ) +{ + mpSequence->Render( pScreen, x, y, revX, revY, pDirty ); +} diff --git a/sdk/samples/iklowns/cgaction.h b/sdk/samples/iklowns/cgaction.h new file mode 100644 index 0000000..8736c45 --- /dev/null +++ b/sdk/samples/iklowns/cgaction.h @@ -0,0 +1,72 @@ +/*===========================================================================*\ +| +| File: cgaction.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef CGACTION_H +#define CGACTION_H + +#include "cgsprite.h" +#include "cgsound.h" +#include "cgchdll.h" + +class CGameScreen; + +class CGameAction +{ +public: + CGameAction(char* pFileName, char* pActionName, DWORD objID=0); + CGameAction(char* pFileName, CGameCharSequenceInfo *pSequence, DWORD objID=0); + virtual ~CGameAction(); + + virtual BOOL Activate(); + virtual BOOL DeActivate(); + virtual BOOL Update(int x); // change to next sprite in sequence + virtual void Render(CGameScreen* pScreen, int x, int y, BOOL revX, BOOL revY, LPRECT pDirty); + + virtual int GetCurWidth() + { + return(mpSequence->GetCurWidth()); + } + virtual int GetCurHeight() + { + return(mpSequence->GetCurHeight()); + } + virtual int NextSprite(int time, BOOL wrap = TRUE) + { + return(mpSequence->NextSprite(time, wrap)); + } + +protected: + CGameSpriteSequence* mpSequence; + CSoundEffect *pSoundEffect; + CSoundEffect *pEndSoundEffect; + BOOL fSoundOnlyWhenVisable; + int defaultVolume; +}; + +#endif // CGACTION_H diff --git a/sdk/samples/iklowns/cgbitbuf.cpp b/sdk/samples/iklowns/cgbitbuf.cpp new file mode 100644 index 0000000..5e895c5 --- /dev/null +++ b/sdk/samples/iklowns/cgbitbuf.cpp @@ -0,0 +1,1471 @@ +/*===========================================================================*\ +| +| File: cgbitbuf.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + + +//#ifndef __WATCOMC__ +#define WIN32_LEAN_AND_MEAN +//#endif +#include <windows.h> +#include "cgdebug.h" +#include "cgdib.h" +#include "cgbitbuf.h" +#include "cgimage.h" +#include "cgglobl.h" + +/*---------------------------------------------------------------------------*\ +| +| Class CGameBitBuffer +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ + +CGameBitBuffer::CGameBitBuffer( + CGameDIB* pDIB, + int width, + int height, + COLORREF transColor + ) : mhPalette( NULL ), + mTransColor( transColor ) +{ +} + +CGameBitBuffer::CGameBitBuffer( + int width, + int height, + HPALETTE hPal, + COLORREF transColor + ) : mhPalette( NULL ), + mTransColor( transColor ) +{ +} + +CGameBitBuffer::~CGameBitBuffer() +{ + if (mhPalette) + { + DeleteObject( mhPalette ); + } +} + +/*---------------------------------------------------------------------------*\ +| +| Class CGameDDrawBitBuffer +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ +// static members +LPDIRECTDRAW CGameDDrawBitBuffer::mpDDrawDriver = NULL; +int CGameDDrawBitBuffer::mInstanceCount = 0; // for allocating/freeing mpDDrawDriver + +// construct a buffer from existing DIB, optionally stretching to fit new size +CGameDDrawBitBuffer::CGameDDrawBitBuffer( + CGameDIB* pDIB, + int width, // 0 (default) means use DIB's width + int height, // 0 (default) means use DIB's height + COLORREF transColor + ) : CGameBitBuffer(pDIB, width, height, transColor), + mpSurface( NULL ), + mIsAttached( FALSE ), + mIsValid( FALSE ), + mpFileName( NULL ) +{ + if (width == 0) + width = pDIB->GetWidth(); + + if (height == 0) + height = pDIB->GetHeight(); + + // we need to copy the dib's filename so we can reload later if necessary + char* pFileName = (char*) pDIB->GetNamePtr(); + + if (pFileName) + { + mpFileName = new char[lstrlen(pFileName)+1]; + lstrcpy( mpFileName, pFileName ); + } + + InitDDraw(); + CreateSurface( width, height ); + + if (mIsValid) + { + SetBits( pDIB ); // copy DIB bits onto surface + + mhPalette = pDIB->CreatePalette(); + } + } + +// construct an "empty" buffer with given size +CGameDDrawBitBuffer::CGameDDrawBitBuffer( + int width, + int height, + HPALETTE hPal, + COLORREF transColor + ) : CGameBitBuffer(width, height, hPal, transColor), + mpSurface( NULL ), + mIsAttached( FALSE ), + mIsValid( FALSE ), + mpFileName( NULL ) +{ + InitDDraw(); + CreateSurface( width, height ); +} + +void +CGameDDrawBitBuffer::InitDDraw( + ) +{ + HRESULT result; + + // do we need to get the Direct Draw driver? + if (mpDDrawDriver == NULL) + { + result = DirectDrawCreate( NULL, &mpDDrawDriver, NULL ); + } + + ++mInstanceCount; // keep count so we know when to release driver +} + +void +CGameDDrawBitBuffer::CreateSurface( + int width, + int height + ) +{ + if (mpDDrawDriver) + { + DDSURFACEDESC surfDesc; + + memset( &surfDesc, 0, sizeof( surfDesc ) ); + + surfDesc.dwSize = sizeof( surfDesc ); + surfDesc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + surfDesc.dwFlags |= DDSD_HEIGHT | DDSD_WIDTH; + surfDesc.dwHeight = height; + surfDesc.dwWidth = width; + + surfDesc.dwFlags |= DDSD_CAPS; + + surfDesc.ddckCKSrcBlt.dwColorSpaceLowValue = 1; + surfDesc.ddckCKSrcBlt.dwColorSpaceHighValue = 1; + + // ask driver for the surface + HRESULT result; + if ((result = mpDDrawDriver->CreateSurface(&surfDesc, + &mpSurface, NULL )) == DD_OK) + { + // have to call SetColorKey + result = mpSurface->SetColorKey( DDCKEY_SRCBLT, &surfDesc.ddckCKSrcBlt ); + + mIsValid = TRUE; + } + } +} + +void +CGameDDrawBitBuffer::SetBits( + CGameDIB* pSource + ) +{ + HRESULT ddrawrval; + DDSURFACEDESC dsd; + LPBYTE lpdest; + DWORD y; + DWORD bytes_scanline; + LPBYTE lpdib_bits; + + /* + * get surface description + */ + mSurfD.dwSize = sizeof( mSurfD ); + ddrawrval = mpSurface->GetSurfaceDesc( &mSurfD ); + if( ddrawrval != DD_OK ) + { + DB_LOG( DB_PROBLEM, "Could not get surface description!" ); + return; + } + + if( !(mSurfD.ddpfPixelFormat.dwFlags & DDPF_RGB) ) + { + DB_LOG( DB_PROBLEM, "Can only copy to RGB surfaces for now" ); + return; + } + + bytes_scanline = pSource->BytesPerScanline(); + + /* + * access the surface + */ + dsd.dwSize = sizeof( dsd ); + do { + ddrawrval = mpSurface->Lock( NULL, &dsd, DDLOCK_SURFACEMEMORYPTR, NULL ); + if( ddrawrval != DD_OK && ddrawrval != DDERR_WASSTILLDRAWING ) + { + DB_LOG( DB_PROBLEM, "Lock failed in creating DDBitBuffer" ); + return; + } + } + while( ddrawrval == DDERR_WASSTILLDRAWING ); + + lpdest = (LPBYTE) dsd.lpSurface; + mPitch = mSurfD.lPitch; + + // NOTE: we only work with 8bpp; need different code for different bitdepths + // this code just assumes 8 bits + for( y=0;y<mSurfD.dwHeight;y++ ) + { + lpdib_bits = pSource->GetPixelAddress(0,y); + memcpy( lpdest, lpdib_bits, bytes_scanline ); + lpdest += (DWORD) mSurfD.lPitch; + } + + /* + * release the surface and go home... + */ + mpSurface->Unlock( NULL ); +} + +CGameDDrawBitBuffer::~CGameDDrawBitBuffer() +{ + if (mpSurface && !mIsAttached) + { + mpSurface->Release( ); + } + + if (--mInstanceCount == 0) + { + if (mpDDrawDriver) + { + mpDDrawDriver->Release( ); + mpDDrawDriver = NULL; + } + } + + delete mpFileName; +} + +// call this to re-create the surface if it was lost +// this can happen if we've switched modes & switch back +void +CGameDDrawBitBuffer::ReCreate( + ) +{ + int width = mSurfD.dwWidth; + int height = mSurfD.dwHeight; + + HRESULT result = mpSurface->Restore(); + + if (result == DD_OK) + mIsValid = TRUE; + + if (mIsValid && mpFileName) + { + // reload the file + CGameDIB dib( mpFileName ); + SetBits( &dib ); // copy DIB bits onto surface + } +} + + +// generic blt call to this buffer from another DDraw surface +void +CGameDDrawBitBuffer::Blt( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc, + DWORD rop + ) +{ + HRESULT result; + DDBLTFX dbf; + BOOL useFX = FALSE; + + // negative width or height means mirror the blt + RECT destRect = + { + xDest, + yDest, + xDest+((wDest<0) ? -wDest : wDest), + yDest+((hDest<0) ? -hDest : hDest) + }; + + RECT srcRect = + { + xSrc, + ySrc, + xSrc+((wDest<0) ? -wDest : wDest), + ySrc+((hDest<0) ? -hDest : hDest) + }; + + + if ((wDest < 0) || (hDest < 0)) + { + useFX = TRUE; + memset( &dbf, 0, sizeof( dbf ) ); + + dbf.dwSize = sizeof(dbf); + dbf.dwDDFX = (wDest<0) ? DDBLTFX_MIRRORLEFTRIGHT : 0; + dbf.dwDDFX |= (hDest<0) ? DDBLTFX_MIRRORUPDOWN : 0; + } + + result = mpSurface->Blt( + &destRect, // dest rect + ((CGameDDrawBitBuffer*)pSrcBuffer)->mpSurface, // src surf + &srcRect, // src rect + useFX ? DDBLT_DDFX : 0,// flags + useFX ? &dbf : NULL ); // bltfx + +} + +// generic blt call -- determine type of destination buffer +void +CGameDDrawBitBuffer::Blt( + CGameBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + ) +{ + switch (pDestBuffer->TypeID()) + { + case BB_DDraw: + Blt( + (CGameDDrawBitBuffer*)pDestBuffer, + xDest, + yDest, + wDest, + hDest, + xSrc, + ySrc, + rop + ); + break; + case BB_DS: + Blt( + (CGameDSBitBuffer*)pDestBuffer, + xDest, + yDest, + wDest, + hDest, + xSrc, + ySrc, + rop + ); + break; + default: + DB_BREAK(); + break; + } +} + +// generic transblt call -- determine type of source buffer +void +CGameDDrawBitBuffer::TransBlt( + CGameBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + ) +{ + switch (pDestBuffer->TypeID()) + { + case BB_DDraw: + TransBlt( + (CGameDDrawBitBuffer*)pDestBuffer, + xDest, + yDest, + wDest, + hDest, + xSrc, + ySrc, + transColor + ); + break; + case BB_DS: + TransBlt( + (CGameDSBitBuffer*)pDestBuffer, + xDest, + yDest, + wDest, + hDest, + xSrc, + ySrc, + transColor + ); + break; + default: + DB_BREAK(); + break; + } +} + +// specific blt call for another DDraw surface +void +CGameDDrawBitBuffer::BltDDraw( + CGameDDrawBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + ) +{ + HRESULT result; + DDBLTFX dbf; + BOOL useFX = FALSE; + + // negative width or height means mirror the blt + RECT destRect = + { + xDest, + yDest, + xDest+((wDest<0) ? -wDest : wDest), + yDest+((hDest<0) ? -hDest : hDest) + }; + + RECT srcRect = + { + xSrc, + ySrc, + xSrc+((wDest<0) ? -wDest : wDest), + ySrc+((hDest<0) ? -hDest : hDest) + }; + + if ((wDest < 0) || (hDest < 0)) + { + useFX = TRUE; + memset( &dbf, 0, sizeof( dbf ) ); + + dbf.dwSize = sizeof(dbf); + dbf.dwDDFX = (wDest<0) ? DDBLTFX_MIRRORLEFTRIGHT : 0; + dbf.dwDDFX |= (hDest<0) ? DDBLTFX_MIRRORUPDOWN : 0; + } + + // force a stop if we never succeed + int stopCount = DDRAW_RETRY; + + do + { + result = pDestBuffer->mpSurface->BltFast( + destRect.left, + destRect.top, + mpSurface, // src surf + &srcRect, // src rect + FALSE // transparent + ); + + // surface may have been lost due to mode switch + if (result == DDERR_SURFACELOST) + { + mIsValid = FALSE; + // re-create our surface + ReCreate(); + } + } + while( (result != DD_OK) && (--stopCount > 0)); +} + +// specific transblt call for another DDraw buffer +void +CGameDDrawBitBuffer::TransBltDDraw( + CGameDDrawBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + ) +{ + HRESULT result; + + RECT destRect = + { + xDest, yDest, xDest+wDest, yDest+hDest + }; + + RECT srcRect = + { + xSrc, ySrc, xSrc+wDest, ySrc+hDest + }; + + // force a stop if we never succeed + int stopCount = DDRAW_RETRY; + + do + { + result = pDestBuffer->mpSurface->BltFast( + destRect.left, + destRect.top, + mpSurface, // src surf + &srcRect, // src rect + TRUE // transparent + ); + + // surface may have been lost due to mode switch + if (result == DDERR_SURFACELOST) + { + mIsValid = FALSE; + // re-create our surface + ReCreate(); + } + } + while( (result != DD_OK) && (--stopCount > 0)); +} + +// specific blt call for a dibsection destination buffer +void +CGameDDrawBitBuffer::BltDS( + CGameDSBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + ) +{ + LPBYTE pSrc = GetLockedAddress( xSrc, ySrc ); + + if (pSrc) + { + int scanDest = -(pDestBuffer->mpDIB->BytesPerScanline()); + int scanSrc = mPitch; + + CopyDIBBits( + pDestBuffer->mpDIB->GetPixelAddress( xDest, yDest ), + pSrc, + wDest, // width pixels + hDest, + (DWORD) scanDest, + (DWORD) scanSrc + ); + + } + Unlock(); +} + +// specific transblt call for a ds buffer +void +CGameDDrawBitBuffer::TransBltDS( + CGameDSBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + ) +{ + LPBYTE pSrc = GetLockedAddress( xSrc, ySrc ); + + if (pSrc) + { + int scanDest = -(pDestBuffer->mpDIB->BytesPerScanline()); + int scanSrc = mPitch; + + TransCopyDIBBits( + pDestBuffer->mpDIB->GetPixelAddress( xDest, yDest ), + pSrc, + wDest, // width pixels + hDest, + (DWORD) scanDest, + (DWORD) scanSrc, + transColor + ); + + } + Unlock(); +} + +void +CGameDDrawBitBuffer::SetPalette( HPALETTE hPal ) +{ +} + +LPBYTE // return address to given pixel in locked surface +CGameDDrawBitBuffer::GetLockedAddress( + int x, + int y + ) +{ + HRESULT ddrawrval; + DDSURFACEDESC dsd; + /* + * access the surface + */ + dsd.dwSize = sizeof( dsd ); + + int stopCount = DDRAW_RETRY; + + do + { + ddrawrval = mpSurface->Lock( NULL, &dsd, DDLOCK_SURFACEMEMORYPTR, NULL ); + + // surface may have been lost due to mode switch + if (ddrawrval == DDERR_SURFACELOST) + { + mIsValid = FALSE; + // re-create our surface + ReCreate(); + } + } + while( (ddrawrval != DD_OK) && (--stopCount > 0) ); + + if (ddrawrval == DD_OK) + { + mPitch = dsd.lPitch; + + return (LPBYTE) dsd.lpSurface + x + (y * mPitch); + } + else + { + DB_BREAK(); + return NULL; + } +} + +void +CGameDDrawBitBuffer::Unlock() +{ + mpSurface->Unlock( NULL ); +} + +/*---------------------------------------------------------------------------*\ +| +| Class CGameDDrawScreenBuffer +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ +// construct the screen's primary surface +CGameDDrawScreenBuffer::CGameDDrawScreenBuffer( + ) : CGameDDrawBitBuffer(), + mpPalette( NULL ), + mpOldPalette( NULL ) +{ + InitDDraw(); + + // call our create surface to create the primary surface + CreateSurface( 0,0 ); +} + +// create an attached-buffer object from given primary surface +CGameDDrawScreenBuffer::CGameDDrawScreenBuffer( + CGameDDrawScreenBuffer* pFront + ) : CGameDDrawBitBuffer(), + mpPalette( NULL ), + mpOldPalette( NULL ) +{ + HRESULT result; + DDSCAPS caps; + + memset(&caps, 0, sizeof(caps)); + caps.dwCaps = DDSCAPS_BACKBUFFER; + + result = pFront->mpSurface->GetAttachedSurface( + &caps, + &mpSurface); + + mSurfD.dwSize = sizeof( mSurfD ); + pFront->mpSurface->GetSurfaceDesc( + &mSurfD + ); + + mPitch = mSurfD.lPitch; + + if (mpSurface) + mIsValid = TRUE; + + // flag this as an attached surface so we won't release it + mIsAttached = TRUE; + ++mInstanceCount; // keep count so we know when to release driver +} + +void +CGameDDrawScreenBuffer::CreateSurface( + int width, + int height + ) +{ + HRESULT result; + + result = mpDDrawDriver->SetCooperativeLevel( ghMainWnd, + DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); + if( result != DD_OK ) + { + return; + } + + // first, force display into our 640x480, 8bpp mode + result = mpDDrawDriver->SetDisplayMode( + SCREEN_WIDTH, + SCREEN_HEIGHT, + 8 + ); + if( result != DD_OK ) + { + return; + } + + memset( &mSurfD, 0, sizeof( mSurfD ) ); + + mSurfD.dwSize = sizeof( mSurfD ); + mSurfD.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; + + mSurfD.dwFlags |= DDSD_BACKBUFFERCOUNT | DDSD_CAPS; + if( gDoubleBuffer ) + { + mSurfD.dwBackBufferCount = 1; + } + else + { + mSurfD.dwBackBufferCount = 2; + } + + // ask DirectDraw for the surface + if ((result = mpDDrawDriver->CreateSurface(&mSurfD, &mpSurface, + NULL)) == DD_OK) + { + mPitch = mSurfD.lPitch; + mIsValid = TRUE; + } +} + +CGameDDrawScreenBuffer::~CGameDDrawScreenBuffer() +{ + // free up palette + DeleteDDPalette(); +} + +void +CGameDDrawScreenBuffer::SetMode( + int width, + int height, + int bits + ) +{ + mpDDrawDriver->SetDisplayMode( + width, + height, + bits + ); +} + +void +CGameDDrawScreenBuffer::RestoreMode() +{ + mpDDrawDriver->FlipToGDISurface(); + mpDDrawDriver->RestoreDisplayMode(); +} + +void +CGameDDrawScreenBuffer::ShowGDIPage() +{ + mpDDrawDriver->FlipToGDISurface(); +} + +void +CGameDDrawScreenBuffer::SetPalette( + LPPALETTEENTRY pPal + ) +{ + // grab current palette if we don't already have it + if (mpOldPalette == NULL) + { + mpSurface->GetPalette( &mpOldPalette ); + } + + // free up current palette + if (mpPalette) + { + DeleteDDPalette(); + } + + if ((mpDDrawDriver->CreatePalette( + DDPCAPS_8BIT, + pPal, + &mpPalette, + NULL + ) == DD_OK) && mpSurface) + { + mpSurface->SetPalette( mpPalette ); + } + +} + +void +CGameDDrawScreenBuffer::DeleteDDPalette() +{ + if (mpPalette) + { + // reset to old palette if we have it + if (mpOldPalette && mpSurface) + { + mpSurface->SetPalette( mpOldPalette ); + } + + if (mpPalette->Release() == DD_OK) + mpPalette = NULL; + } +} + +int +CGameDDrawScreenBuffer::GetVideoMemory() +{ + DDCAPS caps; + + caps.dwSize = sizeof(DDCAPS); + if ((mpDDrawDriver != NULL) && (mpDDrawDriver->GetCaps(&caps,NULL) == DD_OK)) + { + return caps.dwVidMemTotal; + } + + return 0; +} + +/*---------------------------------------------------------------------------*\ +| +| Class CGameDSBitBuffer +| +| DESCRIPTION: +| Use Win32's CreateDIBSection for a non-Direct Draw bitbuffer +| +| +\*---------------------------------------------------------------------------*/ +// construct a buffer from existing DIB, optionally stretching to fit new size +CGameDSBitBuffer::CGameDSBitBuffer( + CGameDIB* pDIB, + int width, // 0 (default) means use DIB's width + int height, // 0 (default) means use DIB's height + COLORREF transColor + ) : CGameBitBuffer(pDIB, width, height, transColor), + mpBitmapInfo( NULL ), + mpDIB( NULL ), + mpBits( NULL ), + mIsValid( FALSE ) +{ + if (width == 0) + width = pDIB->GetWidth(); + + if (height == 0) + height = pDIB->GetHeight(); + + mhPalette = pDIB->CreatePalette(); + + // create our empty DIBSection + mpDIB = new CGameDIB( width, height, mhPalette ); + SetBits( pDIB ); // copy DIB bits onto surface + + // cache important ptrs for blting + mpBits = mpDIB->GetBits(); + mpBitmapInfo = mpDIB->GetBitmapInfo(); + mIsValid = TRUE; +} + +// construct an "empty" buffer with given size +CGameDSBitBuffer::CGameDSBitBuffer( + int width, + int height, + HPALETTE hPal, + COLORREF transColor + ) : CGameBitBuffer(width, height, hPal, transColor), + mpBitmapInfo( NULL ), + mpDIB( NULL ), + mpBits( NULL ), + mIsValid( FALSE ) +{ + mpDIB = new CGameDIB( width, height, hPal ); + + // cache important ptrs for blting + mpBits = mpDIB->GetBits(); + mpBitmapInfo = mpDIB->GetBitmapInfo(); + mIsValid = TRUE; +} + +void +CGameDSBitBuffer::SetBits( + CGameDIB* pSource + ) +{ + LPBYTE lpdest; + DWORD bytes_scanline; + LPBYTE lpdib_bits; + + bytes_scanline = pSource->BytesPerScanline(); + + for( int y=0;y<pSource->GetHeight();y++ ) + { + lpdib_bits = pSource->GetPixelAddress(0,y); + lpdest = mpDIB->GetPixelAddress(0,y); + CopyMemory( lpdest, lpdib_bits, bytes_scanline ); + } +} + +CGameDSBitBuffer::~CGameDSBitBuffer() +{ + delete mpDIB; +} + +// specific blt call to this buffer from another DS buffer +void CGameDSBitBuffer::Blt( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc, + DWORD rop + ) +{ + int scanDest = -(mpDIB->BytesPerScanline()); + int scanSrc = -(((CGameDSBitBuffer*)pSrcBuffer)->mpDIB->BytesPerScanline()); + + CopyDIBBits( + mpDIB->GetPixelAddress( xDest, yDest ), + ((CGameDSBitBuffer*)pSrcBuffer)->mpDIB->GetPixelAddress( xSrc, ySrc ), + wDest, // width pixels + hDest, + (DWORD) scanDest, + (DWORD) scanSrc + ); +} + +// generic dest blt call -- determine type of source buffer +void +CGameDSBitBuffer::Blt( + CGameBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + ) +{ + switch (pDestBuffer->TypeID()) + { + case BB_DDraw: + Blt( + (CGameDDrawBitBuffer*)pDestBuffer, + xDest, + yDest, + wDest, + hDest, + xSrc, + ySrc, + rop + ); + break; + case BB_DS: + Blt( + (CGameDSBitBuffer*)pDestBuffer, + xDest, + yDest, + wDest, + hDest, + xSrc, + ySrc, + rop + ); + break; + default: + DB_BREAK(); + break; + } +} + +// generic transblt call -- determine type of dest buffer +void +CGameDSBitBuffer::TransBlt( + CGameBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + ) +{ + switch (pDestBuffer->TypeID()) + { + case BB_DDraw: + TransBlt( + (CGameDDrawBitBuffer*)pDestBuffer, + xDest, + yDest, + wDest, + hDest, + xSrc, + ySrc, + transColor + ); + break; + case BB_DS: + TransBlt( + (CGameDSBitBuffer*)pDestBuffer, + xDest, + yDest, + wDest, + hDest, + xSrc, + ySrc, + transColor + ); + break; + default: + DB_BREAK(); + break; + } +} + +// specific blt call for a DS buffer +void CGameDSBitBuffer::BltDS( + CGameDSBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + ) +{ + int scanDest = -(pDestBuffer->mpDIB->BytesPerScanline()); + int scanSrc = -(mpDIB->BytesPerScanline()); + + CopyDIBBits( + pDestBuffer->mpDIB->GetPixelAddress( xDest, yDest ), + mpDIB->GetPixelAddress( xSrc, ySrc ), + wDest, // width pixels + hDest, + (DWORD) scanDest, + (DWORD) scanSrc + ); +} + +// specific transblt call for a DDraw buffer +void +CGameDSBitBuffer::TransBltDS( + CGameDSBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + ) +{ + int scanDest = -(pDestBuffer->mpDIB->BytesPerScanline()); + int scanSrc = -(mpDIB->BytesPerScanline()); + + TransCopyDIBBits( + pDestBuffer->mpDIB->GetPixelAddress( xDest, yDest ), + mpDIB->GetPixelAddress( xSrc, ySrc ), + wDest, // width pixels + hDest, + (DWORD) scanDest, + (DWORD) scanSrc, + transColor + ); +} + +// specific blt call for a DDraw buffer +void CGameDSBitBuffer::BltDDraw( + CGameDDrawBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + ) +{ + LPBYTE lpdest; + + lpdest = pDestBuffer->GetLockedAddress( xDest, yDest ); + + if (lpdest) + { + int scanDest = pDestBuffer->mPitch; + int scanSrc = -(mpDIB->BytesPerScanline()); + + CopyDIBBits( + lpdest, + mpDIB->GetPixelAddress( xSrc, ySrc ), + wDest, // width pixels + hDest, + (DWORD) scanDest, + (DWORD) scanSrc + ); + + } + pDestBuffer->Unlock(); +} + +// specific transblt call for a DDraw buffer +void +CGameDSBitBuffer::TransBltDDraw( + CGameDDrawBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + ) +{ + LPBYTE lpdest = pDestBuffer->GetLockedAddress( xDest, yDest ); + + if (lpdest) + { + int scanDest = pDestBuffer->mPitch; + int scanSrc = -(mpDIB->BytesPerScanline()); + + TransCopyDIBBits( + lpdest, + mpDIB->GetPixelAddress( xSrc, ySrc ), + wDest, // width pixels + hDest, + (DWORD) scanDest, + (DWORD) scanSrc, + transColor + ); + + } + pDestBuffer->Unlock(); +} + +void +CGameDSBitBuffer::SetPalette( HPALETTE hPal ) +{ +} + +#if !(defined(__BORLANDC__) || defined(__WATCOMC__)) +void +TransCopyDIBBits( + LPBYTE pDest, // destination + LPBYTE pSource, // ; source pointer + DWORD dwWidth, // ; width pixels + DWORD dwHeight, // ; height pixels + DWORD dwScanD, // ; width bytes dest + DWORD dwScanS, // ; width bytes source + BYTE bTranClr // ; transparent color + ) +{ + _asm + { + push ds + push esi + push edi + + mov ecx, dwWidth + or ecx,ecx + jz tcdb_nomore ; test for silly case + + mov edx, dwHeight ; EDX is line counter + mov bl, bTranClr ; BL has transparency color + + mov esi, pSource ; DS:[ESI] point to source + + mov edi, pDest + + or edi, edi ; check NULL ptrs + jz tcdb_nomore + + or esi, esi ; check NULL ptrs + jz tcdb_nomore + + sub dwScanD,ecx ; bias these + sub dwScanS,ecx + + push ecx + + align 4 + +tcdb_morelines: + pop ecx + push ecx + + shr ecx,2 + jz short tcdb_nextscan + +// ; +// ; The idea here is to not branch very often so we unroll the loop by four +// ; and try to not branch when a whole run of pixels is either transparent +// ; or not transparent. +// ; +// ; There are two loops. One loop is for a run of pixels equal to the +// ; transparent color, the other is for runs of pixels we need to store. +// ; +// ; When we detect a "bad" pixel we jump to the same position in the +// ; other loop. +// ; +// ; Here is the loop we will stay in as long as we encounter a "transparent" +// ; pixel in the source. +// ; + + align 4 + +tcdb_same: + mov eax, ds:[esi] + cmp al, bl + jne short tcdb_diff0 + +tcdb_same0: + cmp ah, bl + jne short tcdb_diff1 + +tcdb_same1: + shr eax, 16 + cmp al, bl + jne short tcdb_diff2 + +tcdb_same2: + cmp ah, bl + jne short tcdb_diff3 + +tcdb_same3: + add edi,4 + add esi,4 + dec ecx + jnz short tcdb_same + jz short tcdb_nextscan + +// ; +// ; Here is the loop we will stay in as long as +// ; we encounter a "non transparent" pixel in the source. +// ; + + align 4 + +tcdb_diff: + mov eax, ds:[esi] + cmp al, bl + je short tcdb_same0 + +tcdb_diff0: + mov es:[edi],al + cmp ah, bl + je short tcdb_same1 + +tcdb_diff1: + mov es:[edi+1],ah + + shr eax, 16 + cmp al, bl + je short tcdb_same2 + +tcdb_diff2: + mov es:[edi+2],al + cmp ah, bl + je short tcdb_same3 + +tcdb_diff3: + mov es:[edi+3],ah + + add edi,4 + add esi,4 + dec ecx + jnz short tcdb_diff + jz short tcdb_nextscan + +// ; +// ; We are at the end of a scan, check for odd leftover pixels to do +// ; and go to the next scan. +// ; + + align 4 + +tcdb_nextscan: + pop ecx + push ecx + + and ecx,11b + jnz short tcdb_oddstuff + // ; move on to the start of the next line + +tcdb_nextscan1: + add esi, dwScanS + add edi, dwScanD + + dec edx // ; line counter + jnz short tcdb_morelines + jz short tcdb_nomore + +// ; +// ; If the width is not a multiple of 4 we will come here to clean up +// ; the last few pixels +// ; + +tcdb_oddstuff: + inc ecx +tcdb_oddloop: + dec ecx + jz short tcdb_nextscan1 + mov al, ds:[esi] + inc esi + inc edi + cmp al, bl + je short tcdb_oddloop + mov es:[edi-1],al + jmp short tcdb_oddloop + +tcdb_nomore: + pop ecx + + pop edi + pop esi + pop ds + } +} + +void +CopyDIBBits( + LPBYTE pDest, // ; dest pointer + LPBYTE pSource, // ; source pointer + DWORD dwWidth, // ; width pixels + DWORD dwHeight, // ; height pixels + DWORD dwScanD, // ; width bytes dest + DWORD dwScanS // ; width bytes source + ) +{ + _asm + { + push esi + push edi + + ; load scanline width into EBX, image height into EDX + mov ebx, [dwWidth] + or ebx, ebx + jz silly_case ; width is 0 + mov edx, [dwHeight] + or edx, edx + jz silly_case ; height is 0 + + ; bias offsets + sub [dwScanD], ebx + sub [dwScanS], ebx + + ; load ESI + mov esi, [pSource] + + ; load EDI and guarantee it is aligned on a DWORD boundary + mov edi, [pDest] + + or edi, edi ; check NULL ptrs + jz silly_case + + or esi, esi ; check NULL ptrs + jz silly_case + + ;; NOTE: this assumes that the scanwidth will always be a multiple + ;; of DWORDs, so that the misalignment will be the same for all + ;; scanlines. This allows us to calculate it once outside the loop + + mov ecx, edi + and ecx, 11b ; deal with non-aligned case + + mov eax, 100b + sub eax, ecx ; eax now contains aligment offset + + cmp eax, ebx ; do we really have that many to do? + jb next_scanline ; if not, we're all set to blast + + mov eax, ebx ; put actual width into offset + + + ALIGN 4 +next_scanline: + + ; adjust_alignment + mov ecx, eax ; eax == alignment offset + rep movsb ; move bytewise to make EDI aligned properly + + mov ecx, ebx ; total count per scanline + sub ecx, eax ; residue left over: misaligned amount! + + ; at this point, ECX is number of BYTES to transfer, ESI and EDI point to source and dest + push eax + + mov eax, ecx + shr ecx, 2 ; div 4 to get number of DWORDS to transfer + rep movsd ; move by DWORDS as much as possible + + and eax, 11b ; number of *bytes* to transfer (if any) + mov ecx, eax + rep movsb ; move remaining bytes (may be zero) + + pop eax + + ; now adjust ESI and EDI for next scanline and jump to it! + add esi, [dwScanS] + add edi, [dwScanD] + dec edx ; if more scanlines, process them + jnz next_scanline + +silly_case: + pop edi + pop esi + + } + +} +#endif diff --git a/sdk/samples/iklowns/cgbitbuf.h b/sdk/samples/iklowns/cgbitbuf.h new file mode 100644 index 0000000..8b17670 --- /dev/null +++ b/sdk/samples/iklowns/cgbitbuf.h @@ -0,0 +1,508 @@ +/*===========================================================================*\ +| +| File: cgbitbuf.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef CGBITBUF_H +#define CGBITBUF_H + +#include <windows.h> +#include <ddraw.h> +#include "cgdib.h" + +// We use this value to time out on waiting for Direct Draw so we don't infinite loop +// It should be very big to keep us from timing out too soon & tearing +#define DDRAW_RETRY 40000 +#if defined(__BORLANDC__) || defined(__WATCOMC__) +extern "C" { +#endif +void +#if defined(__WATCOMC__) +_cdecl +#endif +TransCopyDIBBits( + LPBYTE pDest, // destination + LPBYTE pSource, // ; source pointer + DWORD dwWidth, // ; width pixels + DWORD dwHeight, // ; height pixels + DWORD dwScanD, // ; width bytes dest + DWORD dwScanS, // ; width bytes source + BYTE bTranClr // ; transparent color + ); + +void +#if defined(__WATCOMC__) +_cdecl +#endif +CopyDIBBits( + LPBYTE pDest, // ; dest pointer + LPBYTE pSource, // ; source pointer + DWORD dwWidth, // ; width pixels + DWORD dwHeight, // ; height pixels + DWORD dwScanD, // ; width bytes dest + DWORD dwScanS // ; width bytes source + ); +#if defined(__BORLANDC__) || defined(__WATCOMC__) +} +#endif + +class CGameDSBitBuffer; +class CGameDDrawBitBuffer; +enum BB_TYPE +{ + BB_ROOT, // CGameBitBuffer -- abstract base class + BB_DDraw, // CGameDDrawBitBuffer -- Direct Draw surfaces + BB_DS // CGameDSBitBuffer -- DIBSections +}; + +class CGameBitBuffer +{ +public: + // construct a buffer from existing DIB, optionally stretching to fit new size + CGameBitBuffer(CGameDIB* pDIB, int width=0, int height=0, COLORREF trans=PALETTEINDEX(1)); + + // construct an "empty" buffer with given size + CGameBitBuffer(int width, int height, HPALETTE hPal = NULL, COLORREF trans=PALETTEINDEX(1)); + + // blt to this buffer from pSrcBuffer + virtual void Blt( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc, + DWORD rop + )=0; + + // blt to pDestBuffer from this buffer + virtual void Blt( + CGameBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + )=0; + + // transparent blt to pSrcBuffer from this buffer + virtual void TransBlt( + CGameBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + )=0; + + // specific blit for a DDraw buffer + virtual void BltDDraw( + CGameDDrawBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + )=0; + + virtual void TransBltDDraw( + CGameDDrawBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + )=0; + + // specific blit for a dibsection buffer + virtual void BltDS( + CGameDSBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + )=0; + + virtual void TransBltDS( + CGameDSBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + )=0; + + virtual ~CGameBitBuffer(); + + // returns mhPalette -- the hpalette we created + virtual HPALETTE GetHPalette() + { + return mhPalette; + } + + // destroys mhPalette & sets current palette leaving mhPalette NULL + virtual void SetPalette( HPALETTE )= 0; + + virtual COLORREF GetTransColor() + { + return mTransColor; + } + + // report whether this object is a valid bitbuffer + virtual BOOL IsValid() + { + return FALSE; // default objects are not valid + } + + // report this object's type + virtual BB_TYPE TypeID() + { + return BB_ROOT; + } + +protected: + HPALETTE mhPalette; + COLORREF mTransColor; // transparency color + CGameBitBuffer() : + mhPalette( NULL ) + { + } +}; + +class CGameDDrawBitBuffer : public CGameBitBuffer +{ +public: + // construct a buffer from existing DIB, optionally stretching to fit new size + CGameDDrawBitBuffer(CGameDIB* pDIB, int width=0, int height=0, COLORREF trans=PALETTEINDEX(1)); + + // construct an "empty" buffer with given size + CGameDDrawBitBuffer(int width, int height, HPALETTE hPal = NULL, COLORREF trans=PALETTEINDEX(1)); + + virtual ~CGameDDrawBitBuffer(); + + // blt to this buffer + virtual void Blt( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc, + DWORD rop + ); + + // generic dest blitting calls can handle any type of bitbuffer + virtual void Blt( + CGameBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + ); + + virtual void TransBlt( + CGameBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + ); + + // specific blit for another DDraw buffer + virtual void BltDDraw( + CGameDDrawBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + ); + + virtual void TransBltDDraw( + CGameDDrawBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + ); + + // specific blit for a dibsection buffer + virtual void BltDS( + CGameDSBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + ); + + virtual void TransBltDS( + CGameDSBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + ); + + virtual void SetPalette( HPALETTE ); + + // report whether this object is a valid bitbuffer + virtual BOOL IsValid() + { + return mIsValid; + } + + // report this object's type + virtual BB_TYPE TypeID() + { + return BB_DDraw; + } + +protected: + // we keep a single ptr around to access DDraw + static LPDIRECTDRAW mpDDrawDriver; + static int mInstanceCount; // for allocating/freeing mpDDrawDriver + BOOL mIsAttached; // flag whether this is backbuffer + BOOL mIsValid; + long mPitch; + + LPDIRECTDRAWSURFACE mpSurface; // ptr to our DDraw surface + DDSURFACEDESC mSurfD; // cache the surface description + + char* mpFileName; // we need to keep dib's filename around + // in case we need to reload + + friend class CGameDDrawScreen; + friend class CGameDSBitBuffer; + + friend DWORD CALLBACK EnumCallback(LPVOID lpContext, LPDDSURFACEDESC lpDDrawSurfaceInfo); + + void InitDDraw(); + + CGameDDrawBitBuffer() : + mpSurface( NULL ), + mIsAttached( FALSE ), + mIsValid( FALSE ) + { + }; + + // create this DDraw surface + virtual void CreateSurface(int width, int height); + // if surface is lost (e.g. from mode switch), call this to recreate it + virtual void ReCreate(); + + void SetBits( CGameDIB* pSource ); + + virtual LPBYTE GetLockedAddress( int x, int y ); + virtual void Unlock(); +}; + +class CGameDDrawScreenBuffer : public CGameDDrawBitBuffer +{ +public: + CGameDDrawScreenBuffer(); + + // create an attached-buffer object from given primary surface + CGameDDrawScreenBuffer( CGameDDrawScreenBuffer* pFront ); + virtual void SetMode( int width, int height, int bits ); + virtual void ShowGDIPage(); + virtual void RestoreMode(); + virtual void SetPalette( LPPALETTEENTRY ); + virtual void DeleteDDPalette(); + + int GetVideoMemory(); + + virtual ~CGameDDrawScreenBuffer(); + +protected: + // create the screen's primary surface + virtual void CreateSurface(int width, int height); + // if surface is lost (e.g. from mode switch), call this to recreate it +// virtual void ReCreate(); + LPDIRECTDRAWPALETTE mpPalette; + LPDIRECTDRAWPALETTE mpOldPalette; +}; + +class CGameDSBitBuffer : public CGameBitBuffer +{ +public: + // construct a buffer from existing DIB, optionally stretching to fit new size + CGameDSBitBuffer(CGameDIB* pDIB, int width=0, int height=0, COLORREF trans=PALETTEINDEX(1)); + + // construct an "empty" buffer with given size + CGameDSBitBuffer(int width, int height, HPALETTE hPal = NULL, COLORREF trans=PALETTEINDEX(1)); + + virtual ~CGameDSBitBuffer(); + + // blt to this buffer + virtual void Blt( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc, + DWORD rop + ); + + // generic dest blitting calls can handle any type of bitbuffer + virtual void Blt( + CGameBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + ); + + virtual void TransBlt( + CGameBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + ); + + // specific blit for a DDraw buffer + virtual void BltDDraw( + CGameDDrawBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + ); + + virtual void TransBltDDraw( + CGameDDrawBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + ); + + // specific blit for a dibsection buffer + virtual void BltDS( + CGameDSBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + DWORD rop + ); + + virtual void TransBltDS( + CGameDSBitBuffer* pDestBuffer, + int xDest, + int yDest, + int wDest, + int hDest, + int xSrc, + int ySrc, + int transColor + ); + + virtual void SetPalette( HPALETTE ); + + virtual HBITMAP GetHBitmap() + { + return mpDIB ? mpDIB->GetHBitmap() : NULL; + } + + virtual LPBYTE GetBits() + { + return mpBits; + } + + // report whether this object is a valid bitbuffer + virtual BOOL IsValid() + { + return mIsValid; + } + + // report this object's type + virtual BB_TYPE TypeID() + { + return BB_DS; + } + +protected: + friend class CGameDSScreen; + friend class CGameDDrawBitBuffer; + LPBITMAPINFO mpBitmapInfo; + LPBYTE mpBits; + CGameDIB* mpDIB; + BOOL mIsValid; + + void SetBits( CGameDIB* pSource ); +}; + +#endif // CGBITBUF_H diff --git a/sdk/samples/iklowns/cgchar.cpp b/sdk/samples/iklowns/cgchar.cpp new file mode 100644 index 0000000..55cab8b --- /dev/null +++ b/sdk/samples/iklowns/cgchar.cpp @@ -0,0 +1,352 @@ +/*===========================================================================*\ +| +| File: cgchar.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#ifdef __WATCOMC__ +#include <mem.h> +#else +#include <memory.h> +#endif +#include "cgdebug.h" +#include "cgglobl.h" +#include "cgtimer.h" +#include "cginput.h" +#include "cgchar.h" +#include "cgchdll.h" +#include "cgchrint.h" +#include "cgload.h" +#include "cgremote.h" +#include "strrec.h" + +extern void dbgprintf(char *, ...); +extern CLoadingScreen *gLoadingScreen; + +static int DefaultCharacterAction (CGameCharacter *me, CGameLevel *level) +{ + // move to next sprite sequence... + me->NextSprite(level->GetFrameTime()); + + // always stays in state 0 ... + return(0); +} + +static int DefaultCharacterCollide (CGameCharacter *me, CGameCharacter *other, CGameLevel *level) +{ + // what to do if we collided???? + return(ACTION_COMPLETED); +} + +/*---------------------------------------------------------------------------*\ +| +| Class CGameCharacter +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ +CGameCharacter::CGameCharacter( + char* pFileName, + char* pCharName, + char* pGraphicKey, + CGameLevel *pLevel, + int minz, + int maxz, + int startx, + int starty, + void *pNewObjID, + char *pRemoteName + ) : CGameGraphic( minz ), + mpActions( NULL ), + mpName( NULL ), + mNumActions( 0 ), + mpCurAction( NULL ), + mCurSubX( 0 ), + mCurSubY( 0 ), + mVelocityX( 0 ), + mVelocityY( 0 ), + mLastTime( -1 ) +{ + static DWORD gObjInstance=0; + // hook into the character DLL (or built-in) functionality, if present + // note: if nothing is found, then we'll use *default* actions! + mpLevel = pLevel; + mpName = new char[lstrlen( pCharName ) + 1]; + lstrcpy( mpName, pCharName ); + + mpCharInfo = FindCharInfo(pCharName); + if (mpCharInfo) + { + mpCharInfo->Create(this, pLevel); + pCollideFunc = mpCharInfo->Collide; + mNumActions = mpCharInfo->NumSequences; + } + else + { + pActFunc = DefaultCharacterAction; + pCollideFunc = DefaultCharacterCollide; + mNumActions = 1; + } + + // now that we know how many actions there are, allocate our array + mpActions = new CGameAction *[mNumActions]; + + char *actionBuf; + char defAction[] = ""; // no default action names + + if (mpCharInfo) + { + int ix = 0; + for ( ix = 0; ix < mNumActions ; ix++ ) + { + if (gLoadingScreen != NULL) + gLoadingScreen->Update(); + + mpActions[ix] = new CGameAction( pFileName, &(mpCharInfo->Sequences[ix]) + , (DWORD)this ); + } + } + else + { + actionBuf = new char [32 * mNumActions]; + GetPrivateProfileString( + pCharName, + NULL, // grab all the key names + defAction, + actionBuf, + 32 * mNumActions, + pFileName + ); + + int ix = 0; + for ( char *pAction = actionBuf; *pAction && ( ix < mNumActions ); pAction++, ix++ ) { + if (gLoadingScreen != NULL) + gLoadingScreen->Update(); + mpActions[ix] = new CGameAction( pFileName, pAction + , (DWORD)this ); + pAction += lstrlen( pAction ); // move beyond terminator + } + + delete [] actionBuf; + } + + // Initialize remote stuff + pObjID = (REMOTE_OBJECT *)pNewObjID; + pActionQueue = NULL; + fRemote = FALSE; + if (mpCharInfo) + { + if (pObjID != NULL) + { + fRemote = TRUE; + pActFunc = mpCharInfo->RemoteAction; + + // Create an action queue + pActionQueue = CreateRemoteObjectQueue(pObjID, (void *)this); + + } else { + if (mpCharInfo->RemoteAction != NULL) + { + if (pRemoteName == NULL) + pRemoteName = pCharName; + + pObjID = CreateRemotePeers(pRemoteName, gObjInstance++); + } + pActFunc = mpCharInfo->Action; + } + } + + mMaxZ = maxz; + mMinZ = minz; + mCurZ = (mMaxZ+mMinZ)/2; + + mpCurAction = mpActions[0]; + curState = -1; + MoveTo(startx, starty); +} + +CGameCharacter::~CGameCharacter() +{ + if (fRemote) + { + // Get rid of the action queue + DestroyRemoteObjectQueue(pObjID); + } + else + { + DestroyRemotePeer(pObjID); + } + + // delete all the action objects + for ( ; mNumActions > 0; mNumActions-- ) + { + delete mpActions[mNumActions - 1]; + } + + delete[] mpActions; + delete[] mpName; +} + +void CGameCharacter::Update( + CGameLevel* pLevel, + CGameUpdateList* pList // we add to this if we move + ) +{ + if (mpNext) + mpNext->Update(pLevel, pList); + + CGameAction* mpPrevAction = mpCurAction; + + int newState = (pActFunc)(this, pLevel); + + // set new state + if (newState != -1) + { + // don't change state if out of bounds! + if (newState >= mNumActions) + { + newState = curState; + } + + if (newState >= 0) + mpCurAction = mpActions[newState]; + } + + // See if this is a new action we've entered into. + if (newState != curState) + { + mpPrevAction->DeActivate(); + curState = newState; + if (curState != -1 && curState != -2) + { + mpCurAction->Activate(); + } + } + + //if (mpCurAction != NULL) + mpCurAction->Update(pLevel->World2ScreenX(SUB2WORLD(mCurSubX), mXParallax)); + + if (newState == -1) + { + // kill me + Destroy(this, pLevel); + pLevel->Remove(this); + } +} + +// display the character in its position on given screen with given screen offset +void +CGameCharacter::Render( + CGameLevel* pLevel, + CGameScreen* pScreen, + CGameUpdateList* pList + ) +{ + if (mpNext) + { + // recurse down the list to get background filled in + mpNext->Render(pLevel, pScreen, pList); + } + + RECT update; + + // only draw if we're in the invalid list: + if (IntersectRect( &update, pList->GetDirtyRect(), &mRect)) + { + mpCurAction->Render( + pScreen, + pLevel->World2ScreenX(SUB2WORLD(mCurSubX), mXParallax), + pLevel->World2ScreenY(SUB2WORLD(mCurSubY), mYParallax), + FALSE, // don't ever reverse the image + FALSE, + pList->GetDirtyRect() + ); + } +} + +void +CGameCharacter::MoveTo( int worldX, int worldY ) +{ + mpLevel->AddInvalidRect(&mRect); + + mCurSubX = WORLD2SUB(worldX); + mCurSubY = WORLD2SUB(worldY); + + mRect.left = mpLevel->World2ScreenX(worldX, mXParallax); + mRect.top = mpLevel->World2ScreenY(worldY, mYParallax); + mRect.right = mRect.left + GetCurWidth() - 1; + mRect.bottom = mRect.top + GetCurHeight() - 1; + + mpLevel->AddInvalidRect(&mRect); +} + +int +CGameCharacter::NextSprite( + int time, // current game time + BOOL wrap // should sequence wrap around? + ) +{ + mpLevel->AddInvalidRect(&mRect); + int result = mpCurAction->NextSprite(time, wrap); + + // need to recalculate screen position in case screen moved + mRect.left = mpLevel->World2ScreenX(SUB2WORLD(mCurSubX), mXParallax); + mRect.top = mpLevel->World2ScreenY(SUB2WORLD(mCurSubY), mYParallax); + mRect.right = mRect.left + GetCurWidth() - 1; + mRect.bottom = mRect.top + GetCurHeight() - 1; + + mpLevel->AddInvalidRect(&mRect); + + return result; +} + +int CGameCharacter::GetRemoteAction( + void *&Data, + DWORD &DataSize +) +{ + return(GetNextRemoteAction(pActionQueue, Data, DataSize)); +} + +int CGameCharacter::TransmitRemoteAction( + int action, + void *Data, + DWORD DataSize +) +{ + SendRemoteAction(pObjID, action, Data, DataSize); + return(0); +} + +void CGameCharacter::ReleaseRemoteAction( + void *Data +) +{ + ReleaseRemoteData(Data); +} diff --git a/sdk/samples/iklowns/cgchar.h b/sdk/samples/iklowns/cgchar.h new file mode 100644 index 0000000..93cb085 --- /dev/null +++ b/sdk/samples/iklowns/cgchar.h @@ -0,0 +1,201 @@ +/*===========================================================================*\ +| +| File: cgchar.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef CGCHAR_H +#define CGCHAR_H + +#include "cgupdate.h" +#include "cgaction.h" +#include "cggraph.h" +#include "cgchdll.h" +#include "cgremote.h" + +// maximum number of actions per character +#define MAX_ACTIONS 32 + +// NOTE: our internal mCurSubX values are in 256 sub-pixel units +// externally, they are pixels -- these macro convert between the 2 +#define SUB2WORLD( x ) ( x >> 8 ) +#define WORLD2SUB( x ) ( x << 8 ) + +class CGameCharacter : public CGameGraphic +{ +public: + CGameCharacter( char* pFileName, + char* pCharName, + char* pGraphicKey, + CGameLevel * pLevel, + int minz, + int maxz, + int startx=0, + int starty=0, + void *pNewObjID=NULL, + char *pRemoteName=NULL); + virtual ~CGameCharacter(); + // 'instance' data so characters can keep private data if needed + void * mpPrivateData; + + // NOTE: our internal mCurSubX values are pixels * 256! + // externally, they are pixels + virtual void MoveTo( int worldX, int worldY ); + + virtual void GetXY( int *worldX, int * worldY ) + { + *worldX = SUB2WORLD(mCurSubX); + *worldY = SUB2WORLD(mCurSubY); + } + + virtual void SetVelocity( int vX, int vY ) + { + mVelocityX = vX; + mVelocityY = vY; + } + + virtual void GetVelocity( int* pvX, int* pvY ) + { + *pvX = mVelocityX; + *pvY = mVelocityY; + } + + virtual void Update(CGameLevel* pLevel, CGameUpdateList* pUpdate); + virtual void Render(CGameLevel* pLevel, CGameScreen* pScreen, CGameUpdateList* pUpdate); + + virtual HPALETTE GetHPalette() + { + return NULL; // characters can't return palettes + } + + virtual int GetCurWidth() { return mpCurAction?mpCurAction->GetCurWidth():0; } + virtual int GetCurHeight() { return mpCurAction?mpCurAction->GetCurHeight():0; } + virtual int NextSprite(int time, BOOL wrap = TRUE); + + virtual int GetMinZ() + { + return mMinZ; + } + + virtual int GetMaxZ() + { + return mMaxZ; + } + + virtual int GetXParallax() + { + return mXParallax; + } + + virtual int GetYParallax() + { + return mYParallax; + } + + virtual void SetCurrentZ( int newZ ) + { + mCurZ = newZ; + mpLevel->ReSort(); + } + + // Remote interaction methods + virtual int GetRemoteAction(void *&Data, DWORD &DataSize); + virtual int TransmitRemoteAction(int action, void *Data, DWORD DataSize); + virtual void ReleaseRemoteAction(void *); + BOOL IsRemoteControlled() + { + return fRemote; + } + + int mLastTime; // last time (in Timer units) we updated position + + virtual int Collided (CGameCharacter *other) + { + if (pCollideFunc) + return (*pCollideFunc)( this, other, mpLevel); + else + return 0; + } + + virtual char * GetName() + { + return mpName; + } + + virtual void Destroy (CGameCharacter *me, CGameLevel *lev) + { + if (mpCharInfo) + mpCharInfo->Destroy(me,lev); + } + + // NOTE: our internal mCurSubX values are pixels * 256! + // externally, they are pixels -- this allows the DLL + // functions to get & set the actual values as well as move + virtual void SetAndMove( int subX, int subY ) + { + MoveTo( SUB2WORLD(subX), SUB2WORLD(subY) ); // this sets curworld + mCurSubX = subX; // so we reset + mCurSubY = subY; + } + + virtual void GetSubXY( int *subX, int * subY ) + { + *subX = mCurSubX; + *subY = mCurSubY; + } + + // to allow DLL's to easily override our default behavior: + CGameCharInfo * mpCharInfo; + +protected: + // for Z ordering.... + int mMinZ, mMaxZ; + + char* mpName; + + CGameAction** mpActions; // array of action ptrs + int mNumActions; + CGameAction* mpCurAction; // our current action + + int curState; + + // NOTE: our internal mCurSubX values are pixels * 256! + // externally, they are pixels + int mCurSubX; // current position in world coordinates * 256 + int mCurSubY; // current position in world coordinates * 256 + + int mVelocityX; // current velocity ((pixels/256)/ms) in X dimension (sign == direction) + int mVelocityY; // current velocity ((pixels/256)/ms) in Y dimension (sign == direction) + + pActionFunction pActFunc; + pCollideFunction pCollideFunc; + BOOL fRemote; // TRUE -> controlled remotely + REMOTE_OBJECT *pObjID; // unique object ID across all peers + CLinkedList *pActionQueue; // actions received from remotes + CGameLevel * mpLevel; +}; + +#endif // CGCHAR_H diff --git a/sdk/samples/iklowns/cgchdll.h b/sdk/samples/iklowns/cgchdll.h new file mode 100644 index 0000000..54c983e --- /dev/null +++ b/sdk/samples/iklowns/cgchdll.h @@ -0,0 +1,96 @@ +/*===========================================================================*\ +| +| File: cgchdll.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef CGCHDLL_H +#define CGCHDLL_H +// version number in CGameVersionIdent structure returned by Ident() +#define RELEASE1_0 0x00010000 +#define GAMEID 0x6b455749 // 'Game' + +struct CGameVersionIdent { + long version; + long id; // must be == GAMEID +}; + +// ordinal numbers in DLL: +#define EXPORTED_IDENT 1 +#define EXPORTED_INFO 2 + +#define ACTION_COMPLETED 0 +#define ACTION_KILLME -1 + +class CGameCharacter; +class CGameLevel; +typedef int (*pActionFunction)(CGameCharacter *mythis, CGameLevel *mylevel); +typedef int (*pCollideFunction)(CGameCharacter *mythis, CGameCharacter * otherthis, CGameLevel *mylevel); + +struct CGameCharSoundInfo { + char * Sound; + char * SoundEnd; + int Rate; + int Loop; +}; + +struct CGameCharSequenceInfo { + char * SequenceFile; + char * SequenceName; + int Rate; + CGameCharSoundInfo Sound; +}; + +struct CGameCharInfo { + char *name ; + int NumSequences; + CGameCharSequenceInfo * Sequences; + + pActionFunction Create; + pActionFunction Action; + pActionFunction Destroy; + pActionFunction RemoteAction; + pCollideFunction Collide; +}; + +struct CGameInfo { + int numcharacters; + CGameCharInfo **characters; +}; + +// functions exported by each character DLL +// exported as EXPORTED_IDENT: +#if defined(__BORLANDC__) || defined(__WATCOMC__) +extern "C" void CALLBACK Ident (CGameVersionIdent *); + +// exported as EXPORTED_INFO: +extern "C" void CALLBACK Info (CGameInfo *); +#else +void CALLBACK Ident (CGameVersionIdent *); + +// exported as EXPORTED_INFO: +void CALLBACK Info (CGameInfo *); +#endif +#endif diff --git a/sdk/samples/iklowns/cgchrint.cpp b/sdk/samples/iklowns/cgchrint.cpp new file mode 100644 index 0000000..09cc70d --- /dev/null +++ b/sdk/samples/iklowns/cgchrint.cpp @@ -0,0 +1,141 @@ +/*===========================================================================*\ +| +| File: cgchrint.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#ifdef __WATCOMC__ +#include "mem.h" +#else +#include "memory.h" +#endif +#include "cgchdll.h" +#include "cglevel.h" +#include "cgchar.h" +#include "cgchrint.h" +#include "cginput.h" + +// for now, only allow up to 9 DLLs (plus the internal list) +#define GAME_INFO_MAX 10 +static int gameInfoCount = 0; // none loaded yet +static CGameInfo gameInfo[GAME_INFO_MAX]; + +static CGameInfo gInternalCharInfo = +{ + 0, + NULL +}; + +void LoadCharInfo( CGameInfo * info ) +{ + if ( gameInfoCount == GAME_INFO_MAX ) + return; + + // scans 'info' for chars; adds them to our internal list of love + if ( info == NULL ) { + // NULL means load internal characters + info = &gInternalCharInfo; + } + // add the info ptr to our internal table + gameInfo[gameInfoCount] = *info; + ++gameInfoCount; +} + +CGameCharInfo *FindCharInfo( char *name ) +{ + static CGameCharInfo *lastFound = NULL; + + CGameCharInfo *result = NULL; + int x, + y; + int found = 0; + + // first off - is this the same as the last one? + if (lastFound && (lstrcmpi(name, lastFound->name)==0)) + { + result = lastFound; + ++found; + } + else + { + // scan to find a character in the list(s) + for ( x = 0; x < gameInfoCount; x++ ) { + for ( y = 0; y < gameInfo[x].numcharacters; y++ ) { + result = gameInfo[x].characters[y]; + if ( lstrcmpi( result->name, name ) == 0) + { + ++ found; + lastFound = result; + break; + } + } + if (found) break; + } + } + + if ( !found ) + result = NULL; + + return ( result ); +} + +void LoadMyDLL( char *path, char *name ) +{ + char *p; + char thename[260]; + CGameVersionIdent ident; + CGameInfo info; + int (CALLBACK *fpIdent ) ( CGameVersionIdent * ); + int (CALLBACK *fpInfo ) ( CGameInfo * ); + + lstrcpy( thename, path ); + p = strrchr( thename, '/' ); + if ( p == NULL ) + p = strrchr( thename, '\\' ); + if ( p == NULL ) + lstrcat( thename, "\\" ); + else + *( p + 1 ) = 0; + + lstrcat( thename, name ); + + HINSTANCE hlib = LoadLibrary( thename ); + + if ( hlib != NULL ) { + fpIdent = ( int (CALLBACK * ) ( CGameVersionIdent * ) ) GetProcAddress( hlib, MAKEINTRESOURCE( EXPORTED_IDENT ) ); + if ( fpIdent != NULL ) { + ( *fpIdent ) ( &ident ); + if ( ( ident.version == RELEASE1_0 ) && ( ident.id == GAMEID ) ) { + fpInfo = ( int ( CALLBACK * ) ( CGameInfo * ) ) GetProcAddress( hlib, MAKEINTRESOURCE( EXPORTED_INFO ) ); + if ( fpInfo != NULL ) { + ( *fpInfo ) ( &info ); + LoadCharInfo( &info ); + } + } + } + } +} diff --git a/sdk/samples/iklowns/cgchrint.h b/sdk/samples/iklowns/cgchrint.h new file mode 100644 index 0000000..94ecacf --- /dev/null +++ b/sdk/samples/iklowns/cgchrint.h @@ -0,0 +1,31 @@ +/*===========================================================================*\ +| +| File: cgchrint.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +void LoadCharInfo( CGameInfo * info ); +CGameCharInfo *FindCharInfo( char *name ); +void LoadMyDLL( char *path, char *name ); diff --git a/sdk/samples/iklowns/cgdib.cpp b/sdk/samples/iklowns/cgdib.cpp new file mode 100644 index 0000000..ac6e193 --- /dev/null +++ b/sdk/samples/iklowns/cgdib.cpp @@ -0,0 +1,901 @@ +/*===========================================================================*\ +| +| File: cgdib.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + + +#ifdef __WATCOMC__ +#include <windows.h> +#endif +#include <windowsx.h> +#include "cgglobl.h" +#include "cgrsrce.h" +#include "cgscreen.h" +#include "cgexcpt.h" +#include "cgdebug.h" +#include "cgdib.h" + +/* Macro to determine to round off the given value to the closest byte */ +#define WIDTHBYTES(i) ((i+31)/32*4) + +#define BFT_BITMAP 0x4d42 /* 'BM' */ + +/* macro to determine if resource is a DIB */ +#define ISDIB(bft) ((bft) == BFT_BITMAP) + +/* Macros to display/remove hourglass cursor for lengthy operations */ +#define StartWait() hcurSave = SetCursor(hCursor=LoadCursor(NULL,IDC_WAIT)); +#define EndWait() SetCursor(hCursor=hcurSave) + +#define PALVERSION 0x300 +#define MAXPALETTE 256 /* max. # supported palette entries */ + +WORD PaletteSize (VOID FAR * pv); +WORD DibNumColors (VOID FAR * pv); +HPALETTE CreateDibPalette (HANDLE hdib); +HPALETTE CreateBIPalette (LPBITMAPINFOHEADER lpbi); +HANDLE DibFromBitmap (HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal); +HBITMAP BitmapFromDib (HANDLE hdib, HPALETTE hpal); +BOOL DibInfo (HANDLE hdib,LPBITMAPINFOHEADER lpbi); +HANDLE ReadDibBitmapInfo (int fh); +VOID ReadBitMapFileHeaderandConvertToDwordAlign(HFILE fh, LPBITMAPFILEHEADER pbf, LPDWORD lpdwoff); + +static HCURSOR hCursor; +static HCURSOR hcurSave; + +/*---------------------------------------------------------------------------*\ +| +| Class CGameDIB +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ +CGameDIB::CGameDIB( + ) : mImageValid( FALSE ), + mpBitmapInfo( NULL ), + mpBits( NULL ), + mpFileName( NULL ), + mhBitmap( NULL ) +{ +} + +CGameDIB::CGameDIB( + LPSTR pFileName + ) : mImageValid( FALSE ), + mpBitmapInfo( NULL ), + mpBits( NULL ), + mpFileName( NULL ), + mhBitmap( NULL ) +{ + if (pFileName) + { + mpFileName = new char[lstrlen(pFileName)+1]; + lstrcpy( mpFileName, pFileName ); + + // Load the DIB into memory. + OpenDIB(pFileName); + + // Set the flag to indicate that we now have a valid image in memory. + // NOTE: OpenDIB will throw exception if there's a problem, so we can + // assume here that image is valid. + mImageValid = TRUE; + } +} + +// construct a new DIB section in memory of given size, palette +CGameDIB::CGameDIB( + int width, + int height, + HPALETTE hPal + ) : mImageValid( FALSE ), + mpBitmapInfo( NULL ), + mpBits( NULL ), + mpFileName( NULL ), + mhBitmap( NULL ) +{ + PALETTEENTRY entries[256]; + LPBITMAPINFO pBI = (LPBITMAPINFO) GlobalAllocPtr( GHND, sizeof( BITMAPINFO ) ); + + if (!pBI) + throw CGameResourceError(); + + // !!!NOTE: we're assuming 8 BPP + pBI->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + pBI->bmiHeader.biWidth = width; + pBI->bmiHeader.biHeight = height; // make it top-down + pBI->bmiHeader.biPlanes = 1; + pBI->bmiHeader.biBitCount = 8; + + pBI->bmiHeader.biCompression = BI_RGB; + pBI->bmiHeader.biXPelsPerMeter = 0; + pBI->bmiHeader.biYPelsPerMeter = 0; + pBI->bmiHeader.biClrUsed = 256; + pBI->bmiHeader.biClrImportant = 256; + + pBI->bmiHeader.biSizeImage = WIDTHBYTES(width*8) * height; + + /* Calculate the memory needed to hold the DIB */ + DWORD dwBits = pBI->bmiHeader.biSizeImage; + DWORD dwLen = pBI->bmiHeader.biSize + (DWORD)PaletteSize (pBI); + + /* Try to increase the size of the bitmap info. buffer to hold the DIB */ + pBI = (LPBITMAPINFO) GlobalReAllocPtr(pBI, dwLen, GHND); + if (!pBI) + { + throw CGameResourceError(); + } + + mpBitmapInfo = pBI; + + HDC hdc = GetDC( HWND_DESKTOP ); + + if (hdc) + { + // now create the color table from given palette + HPALETTE hOldPal = NULL; + + if (hPal == NULL) + hPal = (HPALETTE)GetCurrentObject( hdc, OBJ_PAL ); + else + { + hOldPal = SelectPalette( hdc, hPal, FALSE ); + RealizePalette( hdc ); + } + + UINT numColors = GetSystemPaletteEntries( + hdc, + 0, // start index + MAXPALETTE, // num to get + entries + ); + + + + for (UINT i=0; i<numColors; i++) + { + pBI->bmiColors[i].rgbRed = entries[i].peRed; + pBI->bmiColors[i].rgbGreen = entries[i].peGreen; + pBI->bmiColors[i].rgbBlue = entries[i].peBlue; + } + + mhBitmap = CreateDIBSection( + hdc, + mpBitmapInfo, + DIB_RGB_COLORS, + (void**) &mpBits, + NULL, + 0 + ); + + mImageValid = (mhBitmap != NULL); + + if (hOldPal) + { + SelectPalette( hdc, hOldPal, FALSE ); + RealizePalette( hdc ); + } + + ReleaseDC( HWND_DESKTOP, hdc ); + } +} + +/*---------------------------------------------------------------------------*\ +| ~CGameDIB +\*---------------------------------------------------------------------------*/ +CGameDIB::~CGameDIB() +{ + delete[] mpFileName; + + if (mhBitmap) + { + DeleteObject( mhBitmap ); + } + + if (mpBitmapInfo) + { + GlobalFreePtr( mpBitmapInfo ); + } +} + +/*---------------------------------------------------------------------------*\ +| GetWidth() +\*---------------------------------------------------------------------------*/ +int +CGameDIB::GetWidth() +{ + if (mpBitmapInfo) + return mpBitmapInfo->bmiHeader.biWidth; + + return 0; +} + +/*---------------------------------------------------------------------------*\ +| GetHeight() +\*---------------------------------------------------------------------------*/ +int +CGameDIB::GetHeight() +{ + if (mpBitmapInfo) + return mpBitmapInfo->bmiHeader.biHeight; + + return 0; +} + +/*---------------------------------------------------------------------------*\ +| CreatePalette +\*---------------------------------------------------------------------------*/ +HPALETTE +CGameDIB::CreatePalette() +{ + return CreateBIPalette( (PBITMAPINFOHEADER) mpBitmapInfo ); +} + +/*---------------------------------------------------------------------------*\ +| OpenDIB +\*---------------------------------------------------------------------------*/ +void +CGameDIB::OpenDIB (char* pFileName) +{ + HFILE fh; + BITMAPINFOHEADER bi; + LPBITMAPINFOHEADER lpbi; + DWORD dwLen = 0; + DWORD dwBits; + HANDLE hdib; + HANDLE h; + OFSTRUCT of; + + if (!pFileName) + return; + + /* Open the file and read the DIB information */ + fh = OpenFile(pFileName, &of, (UINT)OF_READ); + if (fh == -1) + { + DB_LOG(DB_PROBLEM, "DEBUG: OpenFile failed in OpenDIB"); + throw CGameException( + IDS_INVALID_FILE + ); + } + + hdib = ReadDibBitmapInfo(fh); + + DWORD offset = SetFilePointer( (HANDLE) fh, 0, NULL, FILE_CURRENT ); + + if (!hdib) + { + DB_LOG(DB_PROBLEM, "DEBUG: Invalid DIB file in OpenDIB"); + throw CGameException( + IDS_INVALID_FILE + ); + } + + DibInfo(hdib,&bi); + +#ifdef ConvertToPaletteRelative + /* Convert the DIB color table to palette relative indexes, so + * SetDIBits() and SetDIBitsToDevice() can avoid color matching. + * We can do this because the palette we realize is identical + * to the color table of the bitmap, ie the indexes match 1 to 1 + * + * Now that the DIB color table is palette indexes not RGB values + * we must use DIB_PAL_COLORS as the wUsage parameter to SetDIBits() + */ + lpbi = (VOID FAR *) GlobalLock(hbiCurrent); + if (lpbi->biBitCount != 24) { + fPalColors = TRUE; + + pw = (WORD FAR *) ((LPSTR) lpbi + lpbi->biSize); + + for (i = 0; i < (int) lpbi->biClrUsed; i++) + *pw++ = (WORD) i; + } + GlobalUnlock(hbiCurrent); +#endif + + /* Calculate the memory needed to hold the DIB */ + dwBits = bi.biSizeImage; + dwLen = bi.biSize + (DWORD)PaletteSize (&bi); + + /* Try to increase the size of the bitmap info. buffer to hold the DIB */ + h = GlobalReAlloc(hdib, dwLen, GHND); + if (!h) + { + GlobalFree(hdib); + hdib = NULL; + throw CGameResourceError(); + } + else + hdib = h; + + /* Read in the bits */ + if (hdib) + { + lpbi = (LPBITMAPINFOHEADER)GlobalLock(hdib); + mpBitmapInfo = (LPBITMAPINFO) lpbi; + + HDC hdc = GetDC( HWND_DESKTOP ); + + if (hdc) + { + mhBitmap = CreateDIBSection( + hdc, + mpBitmapInfo, + DIB_RGB_COLORS, + (void**) &mpBits, + NULL, + 0 + ); + + ReadFile( + (HANDLE)fh, + mpBits, + dwBits, + &dwLen, + NULL + ); + + ReleaseDC( HWND_DESKTOP, hdc ); + } + } + + CloseHandle((HANDLE)fh); +} + +/*---------------------------------------------------------------------------*\ +| GetPixelAddress() +\*---------------------------------------------------------------------------*/ +LPBYTE // return address of the pixel -- NULL if out of range +CGameDIB::GetPixelAddress( + int x, + int y + ) +{ + long width; + + // check params + if (( x < 0 ) || ( y < 0 ) || ( x >= GetWidth() ) || ( y >= GetHeight() )) + { + return NULL; + } + + // round up to DWORD boundary + width = (GetWidth() + 3) & ~3; + return mpBits + (long)(GetHeight()-y-1) * width + (long)x; +} + +/*---------------------------------------------------------------------------*\ +| GetPixelAddress() +\*---------------------------------------------------------------------------*/ +COLORREF +CGameDIB::GetPixelColor( + int x, + int y + ) +{ + LPBYTE pPixel = GetPixelAddress( x, y ); + + if (pPixel) + { + RGBQUAD quad = mpBitmapInfo->bmiColors[*pPixel]; + + return PALETTERGB( quad.rgbRed, quad.rgbGreen, quad.rgbBlue ); + } + + // else + return 0; // invalid params +} + +/*---------------------------------------------------------------------------*\ +| GetColorTable() +\*---------------------------------------------------------------------------*/ +UINT // return the number of entries copied +CGameDIB::GetColorTable(UINT start, UINT count, RGBQUAD* pArray) +{ + UINT result = 0; + + if (mpBitmapInfo) + { + for (int i=start; ( i < DibNumColors(mpBitmapInfo)) && (result < count); i++) + { + pArray[result] = mpBitmapInfo->bmiColors[i]; + ++result; + } + } + + return result; +} + +/**************************************************************************** + * * + * FUNCTION : DibInfo(HANDLE hbi,LPBITMAPINFOHEADER lpbi) * + * * + * PURPOSE : Retrieves the DIB info associated with a CF_DIB * + * format memory block. * + * * + * RETURNS : TRUE - if successful. * + * FALSE - otherwise * + * * + ****************************************************************************/ +BOOL DibInfo ( + HANDLE hbi, + LPBITMAPINFOHEADER lpbi) +{ + if (hbi) + { + *lpbi = *(LPBITMAPINFOHEADER)GlobalLock (hbi); + + /* fill in the default fields */ + if (lpbi->biSize != sizeof (BITMAPCOREHEADER)) + { + if (lpbi->biSizeImage == 0L) + lpbi->biSizeImage = WIDTHBYTES(lpbi->biWidth*lpbi->biBitCount) * lpbi->biHeight; + + if (lpbi->biClrUsed == 0L) + lpbi->biClrUsed = DibNumColors (lpbi); + } + GlobalUnlock (hbi); + return TRUE; + } + return FALSE; +} + +/**************************************************************************** + * * + * FUNCTION : CreateBIPalette(LPBITMAPINFOHEADER lpbi) * + * * + * PURPOSE : Given a Pointer to a BITMAPINFO struct will create a * + * a GDI palette object from the color table. * + * * + * RETURNS : A handle to the palette. * + * * + ****************************************************************************/ +HPALETTE CreateBIPalette (LPBITMAPINFOHEADER lpbi) +{ + LOGPALETTE *pPal; + HPALETTE hpal = NULL; + WORD nNumColors; + BYTE red; + BYTE green; + BYTE blue; + WORD i; + RGBQUAD FAR *pRgb; + + if (!lpbi) + return NULL; + + if (lpbi->biSize != sizeof(BITMAPINFOHEADER)) + return NULL; + + /* Get a pointer to the color table and the number of colors in it */ + pRgb = (RGBQUAD FAR *)((LPSTR)lpbi + (WORD)lpbi->biSize); + nNumColors = DibNumColors(lpbi); + + if (nNumColors) + { + /* Allocate for the logical palette structure */ + pPal = (LOGPALETTE*)LocalAlloc(LPTR,sizeof(LOGPALETTE) + nNumColors * sizeof(PALETTEENTRY)); + if (!pPal) + return NULL; + + pPal->palNumEntries = nNumColors; + pPal->palVersion = PALVERSION; + + /* Fill in the palette entries from the DIB color table and + * create a logical color palette. + */ + + // keep index 0 black, index 255 white to keep Windows happy + pPal->palPalEntry[0].peRed = 0; + pPal->palPalEntry[0].peGreen = 0; + pPal->palPalEntry[0].peBlue = 0; + pPal->palPalEntry[0].peFlags = PC_EXPLICIT; + + for (i = 1; i < (nNumColors-1); i++) + { + pPal->palPalEntry[i].peRed = pRgb[i].rgbRed; + pPal->palPalEntry[i].peGreen = pRgb[i].rgbGreen; + pPal->palPalEntry[i].peBlue = pRgb[i].rgbBlue; + pPal->palPalEntry[i].peFlags = PC_NOCOLLAPSE; + } + + if (nNumColors == 256) + { + pPal->palPalEntry[255].peRed = 255; // PC_EXPLICIT treats number as a long + pPal->palPalEntry[255].peGreen = 0; + pPal->palPalEntry[255].peBlue = 0; + pPal->palPalEntry[255].peFlags = PC_EXPLICIT; + } + + hpal = CreatePalette(pPal); + LocalFree((HANDLE)pPal); + } + else if (lpbi->biBitCount == 24) + { + /* A 24 bitcount DIB has no color table entries so, set the number of + * to the maximum value (256). + */ + nNumColors = MAXPALETTE; + pPal = (LOGPALETTE*)LocalAlloc(LPTR,sizeof(LOGPALETTE) + nNumColors * sizeof(PALETTEENTRY)); + if (!pPal) + return NULL; + + pPal->palNumEntries = nNumColors; + pPal->palVersion = PALVERSION; + + red = green = blue = 0; + + /* Generate 256 (= 8*8*4) RGB combinations to fill the palette + * entries. + */ + for (i = 0; i < pPal->palNumEntries; i++) + { + pPal->palPalEntry[i].peRed = red; + pPal->palPalEntry[i].peGreen = green; + pPal->palPalEntry[i].peBlue = blue; + pPal->palPalEntry[i].peFlags = (BYTE)0; + + if (!(red += 32)) + if (!(green += 32)) + blue += 64; + } + hpal = CreatePalette(pPal); + LocalFree((HANDLE)pPal); + } + return hpal; +} + +/**************************************************************************** + * * + * FUNCTION : CreateDibPalette(HANDLE hbi) * + * * + * PURPOSE : Given a Global HANDLE to a BITMAPINFO Struct * + * will create a GDI palette object from the color table. * + * (BITMAPINFOHEADER format DIBs only) * + * * + * RETURNS : A handle to the palette. * + * * + ****************************************************************************/ +HPALETTE CreateDibPalette (HANDLE hbi) +{ + HPALETTE hpal; + + if (!hbi) + return NULL; + hpal = CreateBIPalette((LPBITMAPINFOHEADER)GlobalLock(hbi)); + GlobalUnlock(hbi); + return hpal; +} + +/**************************************************************************** + * * + * FUNCTION : ReadDibBitmapInfo(int fh) * + * * + * PURPOSE : Will read a file in DIB format and return a global HANDLE * + * to it's BITMAPINFO. This function will work with both * + * "old" (BITMAPCOREHEADER) and "new" (BITMAPINFOHEADER) * + * bitmap formats, but will always return a "new" BITMAPINFO * + * * + * RETURNS : A handle to the BITMAPINFO of the DIB in the file. * + * * + ****************************************************************************/ +HANDLE ReadDibBitmapInfo (INT fh) +{ + DWORD off; + HANDLE hbi = NULL; + INT size; + INT i; + WORD nNumColors; + + RGBQUAD FAR *pRgb; + BITMAPINFOHEADER bi; + BITMAPCOREHEADER bc; + LPBITMAPINFOHEADER lpbi; + BITMAPFILEHEADER bf; + DWORD dwWidth = 0; + DWORD dwHeight = 0; + WORD wPlanes, wBitCount; + + if (fh == -1) + return NULL; +#ifdef FIXDWORDALIGNMENT + /* Reset file pointer and read file header */ + off = _llseek(fh, 0L, (UINT)SEEK_CUR); + if ((SIZEOF_BITMAPFILEHEADER_PACKED) != _lread(fh, (LPSTR)&bf, (UINT)sizeof (SIZEOF_BITMAPFILEHEADER_PACKED))) + return FALSE; +#else + ReadBitMapFileHeaderandConvertToDwordAlign(fh, &bf, &off); + /* at this point we have read the file into bf*/ +#endif + + /* Do we have a RC HEADER? */ + if (!ISDIB (bf.bfType)) + { + bf.bfOffBits = 0L; + SetFilePointer((HANDLE)fh, off, NULL, FILE_BEGIN); /*seek back to beginning of file*/ + } + if (!ReadFile((HANDLE)fh, (LPSTR)&bi, (UINT)sizeof(bi), &dwWidth, NULL) || + sizeof (bi) != dwWidth) + return FALSE; + + nNumColors = DibNumColors (&bi); + + /* Check the nature (BITMAPINFO or BITMAPCORE) of the info. block + * and extract the field information accordingly. If a BITMAPCOREHEADER, + * transfer it's field information to a BITMAPINFOHEADER-style block + */ + switch (size = (INT)bi.biSize) + { + case sizeof (BITMAPINFOHEADER): + break; + + case sizeof (BITMAPCOREHEADER): + bc = *(BITMAPCOREHEADER*)&bi; + + dwWidth = (DWORD)bc.bcWidth; + dwHeight = (DWORD)bc.bcHeight; + wPlanes = bc.bcPlanes; + wBitCount = bc.bcBitCount; + + bi.biSize = sizeof(BITMAPINFOHEADER); + bi.biWidth = dwWidth; + bi.biHeight = dwHeight; + bi.biPlanes = wPlanes; + bi.biBitCount = wBitCount; + + bi.biCompression = BI_RGB; + bi.biSizeImage = 0; + bi.biXPelsPerMeter = 0; + bi.biYPelsPerMeter = 0; + bi.biClrUsed = nNumColors; + bi.biClrImportant = nNumColors; + + _llseek(fh, (LONG)sizeof (BITMAPCOREHEADER) - sizeof (BITMAPINFOHEADER), (UINT)SEEK_CUR); + break; + + default: + /* Not a DIB! */ + return NULL; + } + + /* Fill in some default values if they are zero */ + if (bi.biSizeImage == 0) + { + bi.biSizeImage = WIDTHBYTES ((DWORD)bi.biWidth * bi.biBitCount) + * bi.biHeight; + } + if (bi.biClrUsed == 0) + bi.biClrUsed = DibNumColors(&bi); + + /* Allocate for the BITMAPINFO structure and the color table. */ + hbi = GlobalAlloc (GHND, (LONG)bi.biSize + nNumColors * sizeof(RGBQUAD)); + if (!hbi) + return NULL; + lpbi = (LPBITMAPINFOHEADER)GlobalLock (hbi); + *lpbi = bi; + + /* Get a pointer to the color table */ + pRgb = (RGBQUAD FAR *)((LPSTR)lpbi + bi.biSize); + if (nNumColors) + { + DWORD bytesRead; + + if (size == sizeof(BITMAPCOREHEADER)) + { + /* Convert a old color table (3 byte RGBTRIPLEs) to a new + * color table (4 byte RGBQUADs) + */ + ReadFile((HANDLE)fh, (LPSTR)pRgb, (UINT)nNumColors * sizeof(RGBTRIPLE), &bytesRead, NULL); + + for (i = nNumColors - 1; i >= 0; i--) + { + RGBQUAD rgb; + + rgb.rgbRed = ((RGBTRIPLE FAR *)pRgb)[i].rgbtRed; + rgb.rgbBlue = ((RGBTRIPLE FAR *)pRgb)[i].rgbtBlue; + rgb.rgbGreen = ((RGBTRIPLE FAR *)pRgb)[i].rgbtGreen; + rgb.rgbReserved = (BYTE)0; + + pRgb[i] = rgb; + } + } + else + ReadFile((HANDLE)fh, (LPSTR)pRgb, (UINT)nNumColors * sizeof(RGBQUAD), &bytesRead, NULL); + } + + if (bf.bfOffBits != 0L) + { + SetFilePointer((HANDLE)fh, off + bf.bfOffBits, NULL, FILE_BEGIN); + } + GlobalUnlock(hbi); + return hbi; +} + +/**************************************************************************** + * * + * FUNCTION : PaletteSize(VOID FAR * pv) * + * * + * PURPOSE : Calculates the palette size in bytes. If the info. block * + * is of the BITMAPCOREHEADER type, the number of colors is * + * multiplied by 3 to give the palette size, otherwise the * + * number of colors is multiplied by 4. * + * * + * RETURNS : Palette size in number of bytes. * + * * + ****************************************************************************/ +WORD PaletteSize (VOID FAR * pv) +{ + LPBITMAPINFOHEADER lpbi; + WORD NumColors; + + lpbi = (LPBITMAPINFOHEADER)pv; + NumColors = DibNumColors(lpbi); + + if (lpbi->biSize == sizeof(BITMAPCOREHEADER)) + return (WORD)(NumColors * sizeof(RGBTRIPLE)); + else + return (WORD)(NumColors * sizeof(RGBQUAD)); +} + +/**************************************************************************** + * * + * FUNCTION : DibNumColors(VOID FAR * pv) * + * * + * PURPOSE : Determines the number of colors in the DIB by looking at * + * the BitCount filed in the info block. * + * * + * RETURNS : The number of colors in the DIB. * + * * + ****************************************************************************/ +WORD DibNumColors (VOID FAR * pv) +{ + INT bits; + LPBITMAPINFOHEADER lpbi; + LPBITMAPCOREHEADER lpbc; + + lpbi = ((LPBITMAPINFOHEADER)pv); + lpbc = ((LPBITMAPCOREHEADER)pv); + + /* With the BITMAPINFO format headers, the size of the palette + * is in biClrUsed, whereas in the BITMAPCORE - style headers, it + * is dependent on the bits per pixel ( = 2 raised to the power of + * bits/pixel). + */ + if (lpbi->biSize != sizeof(BITMAPCOREHEADER)) + { + if (lpbi->biClrUsed != 0) + return (WORD)lpbi->biClrUsed; + bits = lpbi->biBitCount; + } + else + bits = lpbc->bcBitCount; + + switch (bits) + { + case 1: + return 2; + case 4: + return 16; + case 8: + return 256; + default: + /* A 24 bitcount DIB has no color table */ + return 0; + } +} + +/**************************************************************************** + * * + * FUNCTION : BitmapFromDib(HANDLE hdib, HPALETTE hpal) * + * * + * PURPOSE : Will create a DDB (Device Dependent Bitmap) given a global * + * handle to a memory block in CF_DIB format * + * * + * RETURNS : A handle to the DDB. * + * * + ****************************************************************************/ + +HBITMAP BitmapFromDib ( + HANDLE hdib, + HPALETTE hpal) +{ + LPBITMAPINFOHEADER lpbi; + HPALETTE hpalT; + HDC hdc; + HBITMAP hbm; + + StartWait(); + + if (!hdib) + return NULL; + + lpbi = (LPBITMAPINFOHEADER)GlobalLock(hdib); + + if (!lpbi) + return NULL; + + hdc = GetDC(NULL); + + if (hpal) + { + hpalT = SelectPalette(hdc,hpal,FALSE); + RealizePalette(hdc); // GDI Bug...???? + } + + hbm = CreateDIBitmap(hdc, + (LPBITMAPINFOHEADER)lpbi, + (LONG)CBM_INIT, + (LPBYTE)lpbi + lpbi->biSize + PaletteSize(lpbi), //cast changed for C++ + (LPBITMAPINFO)lpbi, + DIB_RGB_COLORS ); + + if (hpal) + SelectPalette(hdc,hpalT,FALSE); + + ReleaseDC(NULL,hdc); + GlobalUnlock(hdib); + + EndWait(); + + return hbm; +} + +/**************************************************************************** + * * + * FUNCTION : ReadBitMapFileHeaderandConvertToDwordAlign(HFILE fh, LPBITMAPFILEHEADER pbf) + * * + * PURPOSE : read file header (which is packed) and convert into unpacked BITMAPFILEHEADER strucutre + * * + * RETURNS : VOID + * * + ****************************************************************************/ + +VOID ReadBitMapFileHeaderandConvertToDwordAlign(HFILE fh, LPBITMAPFILEHEADER pbf, LPDWORD lpdwoff) +{ + DWORD off; + + off = SetFilePointer((HANDLE)fh, 0L, NULL, FILE_CURRENT); + *lpdwoff = off; + +/* BITMAPFILEHEADER STRUCUTURE is as follows + * BITMAPFILEHEADER + * WORD bfType + > .... < add WORD if packed here! + * DWORD bfSize + * WORD bfReserved1 + * WORD bfReserved2 + * DWORD bfOffBits + * This is the packed format, unpacked adds a WORD after bfType + */ + + /* read in bfType*/ + ReadFile((HANDLE)fh, (LPSTR) &pbf->bfType, sizeof(WORD), &off, NULL); + /* read in last 3 dwords*/ + ReadFile((HANDLE)fh, (LPSTR) &pbf->bfSize, sizeof(DWORD) * 3, &off, NULL); +} diff --git a/sdk/samples/iklowns/cgdlist.cpp b/sdk/samples/iklowns/cgdlist.cpp new file mode 100644 index 0000000..cb8a69c --- /dev/null +++ b/sdk/samples/iklowns/cgdlist.cpp @@ -0,0 +1,346 @@ +/*===========================================================================*\ +| +| File: cgdlist.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include "cgrsrce.h" +#include "cgexcpt.h" +#include "strrec.h" +#include "cgdebug.h" +#include "cgchar.h" +#include "cgimage.h" +#include "cgload.h" +#include "cgdlist.h" + +#define CGG_CHARACTER 0 +#define CGG_TILEDIMAGE 1 +#define CGG_SKYIMAGE 2 +char* graphicTypes[] = +{ + "Character", // type 0 + "TiledImage", // type 1 + "Sky", // type 2 + NULL +}; + +/*---------------------------------------------------------------------------*\ +| +| Class CGameDisplayList +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ +extern void dbgprintf(char *, ...); +extern CLoadingScreen *gLoadingScreen; + +CGameDisplayList::CGameDisplayList( + char* pFileName, + char* pLevelName, + CGameLevel* pLevel + ) : mpHead( NULL ) +{ + char nameBuf[256]; + char dataBuf[256]; + + // load the graphic objects + GetPrivateProfileString( + pLevelName, + NULL, + "", // no default + nameBuf, + sizeof( nameBuf ), + pFileName + ); + + + for (char *pChar = nameBuf; *pChar; pChar++) + { + CGameGraphic* pGraphic; + + if (gLoadingScreen != NULL) + gLoadingScreen->Update(); + + GetPrivateProfileString( + pLevelName, + pChar, + "", + dataBuf, + sizeof( dataBuf ), + pFileName + ); + + // parse the data string into fields + CStringRecord fields( dataBuf, "," ); + + for (int i=0; graphicTypes[i]; i++) + { + if (lstrcmpi(fields[0], graphicTypes[i]) == 0) + { + break; // we found it + } + } + + switch (i) + { + case CGG_CHARACTER: + + if (atoi(fields[6]) == 1) + { + char *pRemoteName=NULL; + if (fields.GetNumFields() > 7) + pRemoteName = fields[7]; + + pGraphic = new CGameCharacter( + pFileName, + pChar, + pLevelName, + pLevel, + atoi(fields[1]), + atoi(fields[2]), + atoi(fields[3]), + atoi(fields[4]), + NULL, + pRemoteName); + if (lstrcmpi(pChar, "Klown") == 0) + { + pLevel->mMainKlown = (CGameCharacter *) pGraphic; + } + + } + else { + pChar += lstrlen( pChar ); // move beyond terminator + continue; + } + + break; + + case CGG_TILEDIMAGE: + { + pGraphic = new CGameTiledImage(pChar, atoi(fields[1]), atoi(fields[2]), atoi(fields[3])); + break; + } + + + case CGG_SKYIMAGE: + pGraphic = new CGameSkyImage(pChar); + break; + + default: + pGraphic = NULL; + break; + } + + if (pGraphic) + { + Insert( pGraphic ); + } + + pChar += lstrlen( pChar ); // move beyond terminator + +#if 1 + // NOTE: if we don't grab messages, we see a white flash while we're + // loading (!?!?). We can't allow switching away until we've + // finished loading, however, because we'll lose the surfaces + // we've already created, so we just drop the messages on the floor. + MSG msg; + if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE | PM_NOYIELD ) ) { + } +#endif + } +} + +CGameDisplayList::~CGameDisplayList() +{ + CGameGraphic* pNext = NULL; + + for (CGameGraphic* pGraphic = mpHead; + pGraphic; + pGraphic = pNext + ) + { + pNext = pGraphic->GetNext(); + delete pGraphic; + pGraphic = NULL; + } +} + +void +CGameDisplayList::Update(CGameLevel* pLevel, CGameUpdateList* pUpdate) +{ + if (mpHead) + { + mpHead->Update(pLevel, pUpdate); + // see if we've collided... + int testZ; + CGameCharacter *pCur, *pNext; + pCur = (CGameCharacter *) mpHead; + pNext = (CGameCharacter *) mpHead->GetNext(); + + while (pCur && pNext) + { + RECT temprect; + LPRECT pMyRect = pCur->GetRect(); + testZ = pCur->GetCurrentZ(); + + // look at all chars in the Z order for conflicts... + + while (pNext && (testZ == pNext->GetCurrentZ())) + { + if (IntersectRect(&temprect, pMyRect, pNext->GetRect())) + { + int removeme = pCur->Collided(pNext); + int removeother = pNext->Collided(pCur); + } + + pNext = (CGameCharacter *) pNext->GetNext(); + } + + pCur = (CGameCharacter *) pCur->GetNext(); + pNext = (CGameCharacter *) pCur->GetNext(); + } + } +} + +void +CGameDisplayList::Render(CGameLevel* pLevel, CGameScreen* pScreen, CGameUpdateList* pUpdate) +{ + if (mpHead) + mpHead->Render(pLevel, pScreen, pUpdate); +} + +void +CGameDisplayList::Insert( CGameGraphic* pGraphic ) +{ + if (mpHead) + { + CGameGraphic* pNode = mpHead; + int lookZ = pGraphic->GetMinZ(); + + if (lookZ < pNode->GetMinZ()) + { + pGraphic->SetNext(pNode); + mpHead = pGraphic; + } + else + { + while (pNode->GetNext() && (pNode->GetNext()->GetMinZ() < lookZ)) + { + pNode = pNode->GetNext(); + } + + pNode->Add( pGraphic ); // put this graphic after (or in) this node + } + } + else + { + mpHead = pGraphic; + } +} + +void +CGameDisplayList::Remove( CGameGraphic* pGraphic ) +{ + + CGameGraphic* pNode = mpHead; + CGameGraphic* pNextNode; + + while (pNode) + { + pNextNode = pNode->GetNext(); + if (pNode == pGraphic) + { + // must be head of list; + mpHead = pNextNode; + break; + } + else + { + if (pNextNode == pGraphic) + { + // normal case; + pNode->SetNext( pNextNode->GetNext()); + break; + } + } + pNode = pNextNode; + } + delete pGraphic; +} + +void CGameDisplayList::ReSort() +{ + // traverse the list; resort based on Z order. + // Naively assume only one mismatch for now. + CGameGraphic* pNode = mpHead; + CGameGraphic* pLastNode = mpHead; + CGameGraphic* pNextNode; + + // find bad node (if any!) + while (pNode) + { + pNextNode = pNode->GetNext(); + if (pNextNode) + { + if (pNode->GetCurrentZ() > pNextNode->GetCurrentZ()) + { + // found a "bad" one!. Remove from list + if (pLastNode == pNode) // head of list + { + mpHead = pNextNode; + } + else + { + pLastNode->SetNext(pNextNode); + } + // this node *must* go somewhere *after* pNextNode, so start searching from there + pLastNode = pNextNode; + while (pNextNode) + { + if (pNode->GetCurrentZ() <= pNextNode->GetCurrentZ()) + { + // insert here... + pLastNode->SetNext(pNode); + pNode->SetNext(pNextNode); + return; + } + pLastNode = pNextNode; + pNextNode = pNextNode->GetNext(); + } + + // if here, pNextNode must be NULL.... + pLastNode->SetNext(pNode); + pNode->SetNext(NULL); + return; + } + } + pLastNode = pNode; + pNode = pNextNode; + } +} diff --git a/sdk/samples/iklowns/cgdlist.h b/sdk/samples/iklowns/cgdlist.h new file mode 100644 index 0000000..9c0111a --- /dev/null +++ b/sdk/samples/iklowns/cgdlist.h @@ -0,0 +1,61 @@ +/*===========================================================================*\ +| +| File: cgdlist.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef CGDLIST_H +#define CGDLIST_H + +#include "cgupdate.h" + +class CGameLevel; +class CGameGraphic; +class CGameScreen; + +class CGameDisplayList +{ +public: + CGameDisplayList(char* pFileName, char* pLevelName, CGameLevel* pLevel); + virtual ~CGameDisplayList(); + + virtual void Update(CGameLevel* pLevel, CGameUpdateList* pUpdate); + virtual void Render(CGameLevel* pLevel, CGameScreen* pScreen, CGameUpdateList* pUpdate); + + virtual void Insert( CGameGraphic* pGraphic ); + virtual void Remove( CGameGraphic* pGraphic ); + virtual void ReSort(); + + virtual CGameGraphic * First() + { + return mpHead; + } + +protected: + CGameGraphic* mpHead; // ptr to head of our linked list +}; + +#endif // CGDLIST_H diff --git a/sdk/samples/iklowns/cgexcpt.cpp b/sdk/samples/iklowns/cgexcpt.cpp new file mode 100644 index 0000000..6125fa5 --- /dev/null +++ b/sdk/samples/iklowns/cgexcpt.cpp @@ -0,0 +1,84 @@ +/*===========================================================================*\ +| +| File: cgexcpt.cpp +| +| Description: +| Exception handling code for sample games +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +#include "cgres.h" +#include "cgexcpt.h" + +/*---------------------------------------------------------------------------*\ +| +| Class CGameException +| +| DESCRIPTION: +| Container class for most exceptions. +| +| +\*---------------------------------------------------------------------------*/ + +CGameException::CGameException( + int resID // resource ID of information string; 0 == no message + ) : mResID( resID ) +{ + // !!! does nothing for now +} + +CGameException::~CGameException() +{ + +} + +/*---------------------------------------------------------------------------*\ +| +| Class CGameStartupError +| +| DESCRIPTION: +| Handles exceptions which prevent app from running +| +| +\*---------------------------------------------------------------------------*/ + +CGameStartupError::CGameStartupError( + int resID // resource ID of information string; 0 == no message + ) : CGameException(resID) +{ + // !!! does nothing for now +} + +CGameStartupError::~CGameStartupError() +{ + +} + +/*---------------------------------------------------------------------------*\ +| +| Class CGameResourceError +| +| DESCRIPTION: +| Handles general out-of-resource exceptions +| +| +\*---------------------------------------------------------------------------*/ + +CGameResourceError::CGameResourceError( + // may want to add a resource type parameter + ) : CGameException(0) +{ + // !!! may want to dump a memory ballast or some such +} + +CGameResourceError::~CGameResourceError() +{ + +} + diff --git a/sdk/samples/iklowns/cgglobl.cpp b/sdk/samples/iklowns/cgglobl.cpp new file mode 100644 index 0000000..330cb3c --- /dev/null +++ b/sdk/samples/iklowns/cgglobl.cpp @@ -0,0 +1,41 @@ +/*===========================================================================*\ +| +| File: cgglobl.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include "cgglobl.h" + +HINSTANCE ghInst = NULL; +HWND ghMainWnd = NULL; +BOOL gDoubleBuffer = 1; +BOOL gUse_DDraw = 1; +int gSoundMode=1; +BOOL gMusicOn=1; +BOOL gActive=0; +MACHINE_CAPS gMachineCaps; + +char gDataPath[MAX_PATH]; diff --git a/sdk/samples/iklowns/cgglobl.h b/sdk/samples/iklowns/cgglobl.h new file mode 100644 index 0000000..e8a61e8 --- /dev/null +++ b/sdk/samples/iklowns/cgglobl.h @@ -0,0 +1,89 @@ +/*===========================================================================*\ +| +| File: cgglobl.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef CGGLOBL_H +#define CGGLOBL_H + +#include <windows.h> + +// NOTE: these scalar values are used in iklowns.gam & cglevel.cpp +typedef enum +{ + MCP_UNKNOWN = 0, + MCP_386 = 1, + MCP_486 = 2, + MCP_PENTIUM = 3 +} MC_PROCESSOR; + +typedef enum +{ + MCB_UNKNOWN = 0, + MCB_ISA = 1, + MCB_EISA = 2, + MCB_PCI = 3 +} MC_BUSTYPE; + +typedef enum +{ + MCV_UNKNOWN = 0, + MCV_DDRAW = 1 +} MC_VIDSYS; + +typedef struct _MACHINE_CAPS +{ + MC_PROCESSOR processor; + MC_BUSTYPE bus; + DWORD sysMemory; + DWORD vidMemory; + MC_VIDSYS vidSystem; +} MACHINE_CAPS; + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern HINSTANCE ghInst; +extern HWND ghMainWnd; +extern BOOL gUse_DDraw; +extern BOOL gDoubleBuffer; + +extern int gSoundMode; +extern BOOL gMusicOn; +extern BOOL gActive; + +extern char gDataPath[]; + +extern MACHINE_CAPS gMachineCaps; + +#ifdef __cplusplus +} +#endif + +#endif // CGGLOBL_H diff --git a/sdk/samples/iklowns/cggraph.cpp b/sdk/samples/iklowns/cggraph.cpp new file mode 100644 index 0000000..ff26b5b --- /dev/null +++ b/sdk/samples/iklowns/cggraph.cpp @@ -0,0 +1,58 @@ +/*===========================================================================*\ +| +| File: cggraph.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include "cggraph.h" + +/*---------------------------------------------------------------------------*\ +| +| CGameGraphic() +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ + +CGameGraphic::CGameGraphic( + int curz + ) : mIsValid(FALSE), + mXParallax(1), + mYParallax(1), + mpNext( NULL ) +{ + mRect.top = mRect.bottom = mRect.left = mRect.right = 0; + + // set parallax factor as zposition / 16 + mXParallax = curz >> 4; + mYParallax = curz >> 4; +} + +CGameGraphic::~CGameGraphic() +{ +} diff --git a/sdk/samples/iklowns/cggraph.h b/sdk/samples/iklowns/cggraph.h new file mode 100644 index 0000000..925151d --- /dev/null +++ b/sdk/samples/iklowns/cggraph.h @@ -0,0 +1,120 @@ +/*===========================================================================*\ +| +| File: cggraph.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef CGGRAPH_H +#define CGGRAPH_H + +#include <windows.h> +#include "cglevel.h" +#include "cgscreen.h" +#include "cgupdate.h" + +class CGameGraphic +{ +public: + CGameGraphic( + int curz = 0 + ); + + virtual ~CGameGraphic(); + + virtual void Update(CGameLevel* pLevel, CGameUpdateList* pUpdate) = 0; + virtual void Render(CGameLevel* pLevel, CGameScreen* pScreen, CGameUpdateList* pUpdate) = 0; + virtual void MoveTo( int worldX, int worldY ) {}; + + virtual HPALETTE GetHPalette() = 0; + + // return this graphic's current z position + virtual int GetCurrentZ() + { + return mCurZ; + } + + virtual int GetMinZ() + { + return mCurZ; // generic graphics cannot have range + } + + virtual int GetMaxZ() + { + return mCurZ; // generic graphics cannot have range + } + + virtual int GetWidth() + { + return mWidth; + } + + virtual int GetHeight() + { + return mHeight; + } + + virtual CGameGraphic* GetNext() + { + return mpNext; + } + + virtual void SetNext( CGameGraphic * next) + { + mpNext = next; + } + + // insert given graphic into the list after us + virtual void Add( CGameGraphic* pGraphic ) + { + // simple insertion into the list + pGraphic->mpNext = mpNext; + mpNext = pGraphic; + } + + virtual RECT * GetRect() { return &mRect; }; + virtual void SetRect(RECT *rect) { + mRect.top = rect->top; + mRect.left = rect->left; + mRect.bottom = rect->bottom; + mRect.right = rect->right; + }; + +protected: + RECT mRect; + BOOL mIsValid; // flag whether this graphic object is valid + int mXpos; + int mYpos; + int mWidth; // width in pixels + int mHeight; // height in pixels + + int mCurZ; // our current Z position + int mXParallax; + int mYParallax; + + CGameGraphic* mpNext; // we're in a linked list of CGameGraphic +}; + +#endif // CGGRAPH diff --git a/sdk/samples/iklowns/cgimage.cpp b/sdk/samples/iklowns/cgimage.cpp new file mode 100644 index 0000000..aef8f50 --- /dev/null +++ b/sdk/samples/iklowns/cgimage.cpp @@ -0,0 +1,360 @@ +/*===========================================================================*\ +| +| File: cgimage.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include "cgrsrce.h" +#include "cgexcpt.h" +#include "cgdebug.h" +#include "cgglobl.h" +#include "cgscreen.h" +#include "cglevel.h" +#include "cgupdate.h" +#include "cgimage.h" + +#define LIMIT(x, low, high) (max(low, min(x, high))) + +/*---------------------------------------------------------------------------*\ +| +| Class CGameSkyImage +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ + +// in our palette, entry 13 is a good sky blue +#define SKY_COLOR ( 13 ) +// force to background +#define SKY_Z ( 32760 ) + +CGameSkyImage::CGameSkyImage( + char* pFileName + ) : CGameImage( pFileName, SKY_Z ) +{ + mCurZ = SKY_Z; +} + +CGameSkyImage::~CGameSkyImage() +{ +} + +void +CGameSkyImage::Update( + CGameLevel* pLevel, + CGameUpdateList* pUpdate + ) +{ +} + +void +CGameSkyImage::Render( + CGameLevel* pLevel, + CGameScreen* pScreen, + CGameUpdateList* pUpdate + ) +{ + pScreen->ColorFill( + pUpdate->GetDirtyRect(), + SKY_COLOR + ); +} + +/*---------------------------------------------------------------------------*\ +| +| Class CGameTiledImage +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ + +static char tleExt[] = ".tle"; + +CGameTiledImage::CGameTiledImage( + char* pFileBase, // file base name + int curz, + int curx, + int cury + ) : CGameImage( pFileBase, curz ), + mpDIBBuffer( NULL ), + mTileArray( NULL ) +{ + HANDLE hFile; + + if (!pFileBase) + return; + + char* pFileName = new char[lstrlen(pFileBase) + lstrlen(tleExt) + 1]; + + lstrcpy( pFileName, pFileBase ); + lstrcat( pFileName, tleExt ); + + // open the .tle file + hFile = CreateFile( + pFileName, + GENERIC_READ, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL + ); + + delete[] pFileName; + + if (hFile == INVALID_HANDLE_VALUE) + { + DB_LOG(DB_PROBLEM, "DEBUG: CreateFile failed in CGameTiledImage"); + throw CGameException( + IDS_INVALID_FILE + ); + } + + TileMapStamp stamp; + + DWORD bytesRead; + + // file begins with our stamp + ReadFile( + hFile, + &stamp, + sizeof( stamp ), + &bytesRead, + NULL + ); + + // verify file is valid tile map + if ((stamp.signature != TILE_MAP_SIGNATURE) || + (stamp.version != TILE_MAP_VERSION) || + (stamp.tileSize != TILE_SIZE) + ) + { + DB_LOG(DB_PROBLEM, "DEBUG: invalid file stamp in CGameTiledImage"); + throw CGameException( + IDS_INVALID_FILE + ); + } + + // allocate for dib filename (length includes terminator) + pFileName = new char[stamp.nameLength]; + + // followed by the tile DIB filename + ReadFile( + hFile, + pFileName, + stamp.nameLength, + &bytesRead, + NULL + ); + + // allocate our tile array + mNumCols = stamp.columns; + mTileArray = new WORD*[mNumCols]; + mWidth = mNumCols * stamp.tileSize; + mHeight = stamp.rows * stamp.tileSize; + + mXpos = curx; + mYpos = cury; + + // read in the tile map + for (int col = 0; col < mNumCols; col++) + { + mTileArray[col] = new WORD[stamp.rows]; + for (int row = 0; row < stamp.rows; row++) + { + ReadFile( + hFile, + &mTileArray[col][row], + sizeof(WORD), + &bytesRead, + NULL + ); + } + } + + CloseHandle( hFile ); + + // now create a bit buffer for our DIB + CGameDIB theDib( pFileName ); + + delete[] pFileName; + + if (gUse_DDraw) + { + mpDIBBuffer = new CGameDDrawBitBuffer( &theDib ); + if (!mpDIBBuffer->IsValid()) + { + // we didn't get video memory, so delete that buffer + delete mpDIBBuffer; + // & create a system memory one + mpDIBBuffer = new CGameDSBitBuffer( &theDib ); + } + } + else + { + mpDIBBuffer = new CGameDSBitBuffer( + &theDib, + theDib.GetWidth(), + theDib.GetHeight(), + theDib.GetPixelColor(0,0) + ); + } + + mCurZ = curz; +} + +CGameTiledImage::~CGameTiledImage() +{ + if (mTileArray) + { + for (; mNumCols>0; mNumCols--) + { + delete[] mTileArray[mNumCols-1]; + } + delete[] mTileArray; + } + + delete mpDIBBuffer; +} + +void +CGameTiledImage::Update( + CGameLevel* pLevel, + CGameUpdateList* pUpdate + ) +{ + if (mpNext) + mpNext->Update(pLevel, pUpdate); +} + +void +CGameTiledImage::Render( + CGameLevel* pLevel, + CGameScreen* pScreen, + CGameUpdateList* pUpdate + ) +{ + if (mpNext) + { + // recurse down the list to get background filled in + mpNext->Render(pLevel, pScreen, pUpdate); + } + + LPRECT pDirty = pUpdate->GetDirtyRect(); + + int width = pDirty->right - pDirty->left + 1; + int height = pDirty->bottom - pDirty->top + 1; + + RECT worldUpdate; + + worldUpdate.left = pLevel->Screen2WorldX( pDirty->left, mXParallax ); + worldUpdate.top = pLevel->Screen2WorldY( pDirty->top, mYParallax ); + worldUpdate.right = worldUpdate.left + width - 1; + worldUpdate.bottom = worldUpdate.top + height - 1; + + RECT image; + + image.left = mXpos; + image.top = mYpos; + image.right = mXpos + mWidth - 1; + image.bottom = mYpos + mHeight - 1; + + RECT realImage; + + if (IntersectRect( &realImage, &image, &worldUpdate )) + { + int offsetX = realImage.left>mXpos?(realImage.left-mXpos) % TILE_SIZE :0; + int tileWidth = TILE_SIZE - offsetX; + + for ( + int worldPixelX = realImage.left; + worldPixelX <= realImage.right; + worldPixelX += tileWidth, tileWidth = TILE_SIZE + ) + { + int colIndex = (worldPixelX - mXpos) / TILE_SIZE; + int screenX = pLevel->World2ScreenX( worldPixelX, mXParallax ); + + int offsetY = realImage.top>mYpos? (realImage.top-mYpos) % TILE_SIZE:0; + int tileHeight = TILE_SIZE - offsetY; + + for ( + int worldPixelY = realImage.top; + worldPixelY <= realImage.bottom; + worldPixelY += tileHeight, tileHeight = TILE_SIZE + ) + { + int rowIndex = (worldPixelY - mYpos) / TILE_SIZE; + int screenY = pLevel->World2ScreenY( worldPixelY, mYParallax ); + + WORD tileNum = mTileArray[colIndex][rowIndex]; + + if (!IS_TRANSPARENT(tileNum)) + { +// int srcX = (TILE_INDEX(tileNum) * TILE_SIZE) + offsetX; + int srcX = TILE_SRC_X(tileNum) + offsetX; +// int srcY = offsetY; + int srcY = TILE_SRC_Y(tileNum) + offsetY; + + if (HAS_TRANSPARENCY(tileNum)) + { + pScreen->TransRender( + screenX, + screenY, + min(tileWidth, realImage.right - worldPixelX + 1), + min(tileHeight, realImage.bottom - worldPixelY + 1), + mpDIBBuffer, + srcX, + srcY + ); + } + else + { + pScreen->Render( + screenX, + screenY, + min(tileWidth, realImage.right - worldPixelX + 1), + min(tileHeight, realImage.bottom - worldPixelY + 1), + mpDIBBuffer, + srcX, + srcY, + SRCCOPY + ); + } + } + + offsetY = 0; + } + + offsetX = 0; + } + } +} diff --git a/sdk/samples/iklowns/cgimage.h b/sdk/samples/iklowns/cgimage.h new file mode 100644 index 0000000..1d885c1 --- /dev/null +++ b/sdk/samples/iklowns/cgimage.h @@ -0,0 +1,151 @@ +/*===========================================================================*\ +| +| File: cgimage.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef CGIMAGE_H +#define CGIMAGE_H + +#include "cggraph.h" + +#define TRANSPARENT_TILE ((WORD)-1) +#define MARK_TRANSPARENT(tile) ((WORD) tile | 0x8000) + +// we use palette index 1 for transparency +#define TRANSPARENCY_INDEX ((BYTE)1) + +#define HAS_TRANSPARENCY( num ) ((WORD) num & 0x8000) +#define IS_TRANSPARENT( num ) (num == TRANSPARENT_TILE) + +#define TILE_INDEX( num ) ((WORD)IS_TRANSPARENT(num)?0:num & ~0x8000) + +// maximum width we can allow for our tile source bitmaps +#define MAX_TILE_SRC_WIDTH 640 +#define MAX_TILE_COLUMNS 20 + +// convert a tile number into x or y from source bitmap +#define TILE_SRC_X( num ) ((WORD) (TILE_INDEX(num) % MAX_TILE_COLUMNS) * TILE_SIZE) +#define TILE_SRC_Y( num ) ((WORD) (TILE_INDEX(num) / MAX_TILE_COLUMNS) * TILE_SIZE) + +//#define TILE_MAP_SIGNATURE 'TLMP' +#define TILE_MAP_SIGNATURE 0x544c4d50 +#define TILE_MAP_VERSION 0x0012 + +#define TILE_SIZE 32 + +#define TILE_TO_TX(tile) (tile * TILE_SIZE) +#define TILE_TO_TY(tile) (0) + +#define WX_TO_INDEX(wx) (wx % TILE_SIZE) +#define WY_TO_INDEX(wy) (wy / TILE_SIZE) + +struct TileMapStamp +{ + DWORD signature; + DWORD version; + WORD columns; + WORD rows; + WORD tileSize; + WORD nameLength; // length of following filename including terminator + + // this is followed by the DIB name, then the WORD array[col][row] of tile numbers +}; + +#define CG_DEFAULT_TILE_SIZE 16 + +// maximum number of tiles in an image +#define CG_TILE_LIMIT ((WORD)0xffff) + +typedef WORD CG_TILE_INDEX; + +class CGameImage : public CGameGraphic +{ +public: + CGameImage(char* pFileName, int curz) : CGameGraphic(curz){}; // load existing image file + virtual ~CGameImage(){}; + + virtual HPALETTE GetHPalette() = 0; +protected: +}; + +class CGameSkyImage : public CGameImage +{ +public: + CGameSkyImage(char* pFileName); // load existing image file + virtual ~CGameSkyImage(); + + virtual HPALETTE GetHPalette() + { + return NULL; + } + + virtual void Update(CGameLevel* pLevel, CGameUpdateList* pUpdate); + virtual void Render(CGameLevel* pLevel, CGameScreen* pScreen, CGameUpdateList* pUpdate); + +protected: +}; + +#define SCREEN_WIDTH 640 +#define SCREEN_HEIGHT 480 +#define SCREEN_COLS (SCREEN_WIDTH / TILE_SIZE) +#define SCREEN_ROWS (SCREEN_HEIGHT / TILE_SIZE) + +#define BUFFER_COLS (SCREEN_COLS+2) +#define BUFFER_ROWS (SCREEN_ROWS+2) + +#define BUFFER_WIDTH (BUFFER_COLS * TILE_SIZE) +#define BUFFER_HEIGHT (BUFFER_ROWS * TILE_SIZE) + +#define EXTRA_WIDTH (TILE_SIZE * 2) +#define EXTRA_HEIGHT (TILE_SIZE * 2) + +// the "read-only" tiled image (for use in games) +class CGameTiledImage : public CGameImage +{ +public: + CGameTiledImage(char* pFileName, int curz, + int curx=0, int cury=0 ); // load existing image file + + virtual ~CGameTiledImage(); + + virtual void Update(CGameLevel* pLevel, CGameUpdateList* pUpdate); + virtual void Render(CGameLevel* pLevel, CGameScreen* pScreen, CGameUpdateList* pUpdate); + + virtual HPALETTE GetHPalette() + { + return mpDIBBuffer ? mpDIBBuffer->GetHPalette() : NULL; + } + +protected: + int mNumCols; + + CG_TILE_INDEX** mTileArray; // array[row][column] of tile #s describing image + + CGameBitBuffer* mpDIBBuffer; // holds the image's DIB tiles +}; + +#endif // CGIMAGE_H diff --git a/sdk/samples/iklowns/cginput.cpp b/sdk/samples/iklowns/cginput.cpp new file mode 100644 index 0000000..b83f5fc --- /dev/null +++ b/sdk/samples/iklowns/cginput.cpp @@ -0,0 +1,184 @@ +/*===========================================================================*\ +| +| File: cginput.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include <mmsystem.h> +#ifdef __WATCOMC__ +#include <mem.h> +#else +#include <memory.h> +#endif + +#include "cginput.h" + +CGameInput::CGameInput (void) +{ + JOYINFO joypos; + memset(&caps, 0, sizeof(JOYCAPS) * 16); + memset(&joyThere, 0, sizeof(int) * 16); + + for (int x=0; x<QJoystick(); x++) + { + if (joyGetPos(JOYSTICKID1+x, &joypos) == JOYERR_NOERROR) + { + // there *is* a joystick 'x' installed! + ++joyThere[x]; + joyGetDevCaps(JOYSTICKID1+x, &(caps[x]), sizeof(JOYCAPS)); + } + } + Flush(); + UpdateJoystick(); +} + +CGameInput::~CGameInput(void) +{ +} + +void CGameInput::Flush(void) +{ + // Do things this way because, ahem... SetKeyboardState() doesn't appear + // to work on Win'95... + for (int x=0; x<256; x++) + { + GetKeyboard(x); + } +} + + +//-------------------------------------------------- + +int CGameInput::QKeyboard(void) +{ + // if there is a keyboard, returns 1 else 0 + return(GetKeyboardType(1)); +} + + +int CGameInput::QMouse(void) +{ + // if no mouse, 0 else number of buttons on mouse + return(GetSystemMetrics(SM_CMOUSEBUTTONS)); +} + + +int CGameInput::QJoystick(void) +{ + // if no joystick(s), returns 0 else number of joysticks attached. + return(joyGetNumDevs()); +} + +int CGameInput::GetKeyboard(int key) +{ + // returns 0 if the key has been depressed, else returns 1 and sets key to code recd. + return (GetAsyncKeyState(key)); +} + +int CGameInput::QKeyDepressed(int numkeys, int *keyarray) +{ + int x; + + // tells if keys in keyarray are currently depressed. Returns 0 if not, 1 if all + if (!numkeys || !keyarray) + return(0); + + for (x=0; x<numkeys ; x++) + { + // mask off top bit + if ((GetAsyncKeyState(keyarray[x])) == 0) + return(0); + } + return(1); +} + +int CGameInput::GetMouse(int& xpos, int&ypos, int& buttons) +{ + // returns 0 if no mouse action to report; else, 1 and fills in params + int button1, button2; + POINT pt; + + if (!GetCursorPos(&pt)) + return(0); + + xpos = pt.x; + ypos = pt.y; + buttons = 0; + + button1 = GetAsyncKeyState(VK_LBUTTON); + button2 = GetAsyncKeyState(VK_RBUTTON); + if (button1) + buttons |= 1; + if (button2) + buttons |= 2; + + return(1); +} + +int normalize (int val, int minval, int maxval) +{ + // error detection: + if ((maxval-minval) == 0) + { + return(0); + } + + // zero-base: + val -= minval; + + // normalize to 0..200: + val = (200L * val) / (maxval-minval); + + // shift to -100 .. 100: + val -= 100; + + return(val); +} + +void CGameInput::UpdateJoystick(void) +{ + for (int x=0; x<16; x++) + { + if (joyThere[x]) + joyGetPos(JOYSTICKID1 + x, &(cached_joyinfo[x])); + } +} + +int CGameInput::GetJoystick(int joynum, JOYINFO * joypos) +{ + if ((joynum >= 16) || (joynum <= 0) || !joyThere[joynum-1]) + return(0); + + memcpy(joypos, &(cached_joyinfo[joynum-1]), sizeof(JOYINFO)); + + // normalize the joypos to -100,0,100 scale.... + joypos->wXpos = normalize(joypos->wXpos, caps[joynum-1].wXmin, caps[joynum-1].wXmax); + joypos->wYpos = normalize(joypos->wYpos, caps[joynum-1].wYmin, caps[joynum-1].wYmax); + joypos->wZpos = normalize(joypos->wZpos, caps[joynum-1].wZmin, caps[joynum-1].wZmax); + + return(1); +} diff --git a/sdk/samples/iklowns/cginput.h b/sdk/samples/iklowns/cginput.h new file mode 100644 index 0000000..4c2c5b7 --- /dev/null +++ b/sdk/samples/iklowns/cginput.h @@ -0,0 +1,74 @@ +/*===========================================================================*\ +| +| File: cginput.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +/* + The CGameInput class serves as an abstraction layer on top of the + various input devices which may be attached to the machine. +*/ + +#define MOUSE_BUTTON_1 1 +#define MOUSE_BUTTON_2 2 + +class CGameInput { +private: + int joyThere[16]; // 1 if joystick is plugged in, 0 otherwise + JOYCAPS caps [16]; + JOYINFO cached_joyinfo[16]; + +public: + /* + Constructor/destructor. Allocate any threads or other resources + required by the object: + */ + CGameInput(void); + ~CGameInput(void); + + void Flush(void); // remove input (clean up...) + + /* + HW Query functions: determine whether or not a device exists. + Return 0 if no such device, > 0 (depending on device) if it does. + */ + int QKeyboard(void); // 0= no keyboard, 1= exists + int QMouse(void); // 0=no, otherwise num buttons on mouse + int QJoystick(void); // 0=none, else number of joysticks + + /* + Input functions: anyone wishing for input needs to call these: + */ + int GetKeyboard(int yourkey); // ret: 0=no key available + // pass number of keys to check, then array of VKEY codes for keys + // to check. If any key is *not* depressed, returns 0; else 1 + int QKeyDepressed(int numkeys, int *keyarray); + // buttons is bitmap of MOUSE_... returns 0 if no mouse input avail + int GetMouse(int &xpos, int& ypos, int& buttons); + // joystick needs number of joystick to query + int GetJoystick(int joynum, JOYINFO *joypos); + void UpdateJoystick(void); +}; diff --git a/sdk/samples/iklowns/cgkrusty.cpp b/sdk/samples/iklowns/cgkrusty.cpp new file mode 100644 index 0000000..cfea3f6 --- /dev/null +++ b/sdk/samples/iklowns/cgkrusty.cpp @@ -0,0 +1,1476 @@ +/*===========================================================================*\ +| +| File: cgkrusty.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#ifdef __WATCOMC__ +#include <mem.h> +#else +#include <memory.h> +#endif +#include "cgchdll.h" +#include "cgchar.h" +#include "cgtimer.h" +#include "cginput.h" + +char inifile [260]; +int gFastKlown; +int gFastVel; +int gDebugOut; +int gPieSpeed; +int gPieRange; +int gKlownHits; +int gAgression; +int gMobility; +int SENSITIVITY = 33; +int RUN_THRESHOLD = 66; + +static DWORD gTimeout=30000; +static DWORD gUpdateInterval=1000; + +#define MIN_MOUSE_MOVE 3 +#define BIG_MOUSE_MOVE 30 +#define CenterX 320 +#define CenterY 240 + +#define BREAK_IF(x) if (x) _asm int 3; + +#define WALK_VELOCITY 60 +#define RUN_VELOCITY 180 + +#define rand timeGetTime +// klown states: +typedef enum eKLOWN_STATES +{ + STAND_RIGHT, STAND_LEFT, //0,1 + WALK_RIGHT, WALK_LEFT, //2 + RUN_RIGHT, RUN_LEFT, //4 + R2L_TURN, L2R_TURN, //6 + THROW_RIGHT, THROW_LEFT, //8 + THROW_RIGHT_WALK, THROW_LEFT_WALK, //10 + THROW_RIGHT_RUN, THROW_LEFT_RUN, //12 + IN_RIGHT, IN_LEFT, //14 + OUT_RIGHT, OUT_LEFT, //16 + DUCK_RIGHT, DUCK_LEFT, //18 + BLOCK_RIGHT, BLOCK_LEFT, //20 + POKE_RIGHT, POKE_LEFT, //22 + HIT_FACE_L, HIT_FACE_R, //24 + HIT_BACK_L, HIT_BACK_R, //26 + POKED_L, POKED_R, //28 + IS_DEAD, //30 + GAME_OVER, //31 + // insert new states here, before next NUM_STATES: + + NUM_STATES, + +// INTERNAL USE ONLY: don't use these for things which will have sequences, +// and DONT!!! return them to the level object: + INT_THROW_RIGHT, + INT_THROW_LEFT, + INT_THROW_RIGHT_WALK, + INT_THROW_LEFT_WALK, + INT_THROW_RIGHT_RUN, + INT_THROW_LEFT_RUN, + INT_COLLIDED_ON_LEFT, + INT_COLLIDED_ON_RIGHT, + + INT_NUM_STATES +} +#ifdef __WATCOMC__ +xx1 +#endif +; + +typedef enum eKLOWN_SEQ +{ + EOS, NOTHING, DUCK, THROW, BLOCK, POKE, GO_IN, GO_OUT, + WALK_L, WALK_R, RUN_L, RUN_R, GOT_HIT_L, GOT_HIT_R, + GOT_POKED_L, GOT_POKED_R +} +#ifdef __WATCOMC__ +xx2 +#endif +; + +typedef struct +{ + int start; + int end; + int transition; +} STATE; + +// +// klown info - flag if sequence needs to run till finished or not... +#define MUST_FINISH 1 +int klown_state_flags[NUM_STATES] = +{ + 0, //STAND_RIGHT, + 0, // STAND_LEFT, + 0, // WALK_RIGHT, + 0, //WALK_LEFT, + 0, //RUN_RIGHT, + 0, //RUN_LEFT, + MUST_FINISH, //R2L_TURN, + MUST_FINISH, //L2R_TURN, + MUST_FINISH, //THROW_RIGHT, + MUST_FINISH, //THROW_LEFT, + MUST_FINISH, //THROW_RIGHT_WALK, + MUST_FINISH, //THROW_LEFT_WALK, + MUST_FINISH, //THROW_RIGHT_RUN, + MUST_FINISH, //THROW_LEFT_RUN, + 0, //IN_RIGHT, + 0, //IN_LEFT, + 0, //OUT_RIGHT, + 0, //OUT_LEFT, + MUST_FINISH, //DUCK_RIGHT, + MUST_FINISH, //DUCK_LEFT, + MUST_FINISH, //BLOCK_RIGHT, + MUST_FINISH, //BLOCK_LEFT, + MUST_FINISH, //POKE_RIGHT, + MUST_FINISH, //POKE_LEFT, + MUST_FINISH, //HIT_FACE_L, + MUST_FINISH, //HIT_FACE_R, + MUST_FINISH, //HIT_BACK_L, + MUST_FINISH, //HIT_BACK_R, + MUST_FINISH, //POKED_L, + MUST_FINISH, //POKED_R, + MUST_FINISH, //IS_DEAD + MUST_FINISH // GAME_OVER +}; + +int klown_states_index [INT_NUM_STATES]; +// klown state machine - triplets describing all possible transitions: +STATE klown_states[] = +{ + { STAND_RIGHT, WALK_RIGHT, WALK_R }, + { STAND_RIGHT, RUN_RIGHT, RUN_R }, + { STAND_RIGHT, BLOCK_RIGHT, BLOCK }, + { STAND_RIGHT, POKE_RIGHT, POKE }, + { STAND_RIGHT, DUCK_RIGHT, DUCK }, + { STAND_RIGHT, IN_RIGHT, GO_IN }, + { STAND_RIGHT, OUT_RIGHT, GO_OUT }, + { STAND_RIGHT, THROW_RIGHT, THROW }, + { STAND_RIGHT, R2L_TURN, WALK_L }, + { STAND_RIGHT, R2L_TURN, RUN_L }, + { STAND_RIGHT, HIT_FACE_R, GOT_HIT_R }, + { STAND_RIGHT, HIT_BACK_R, GOT_HIT_L }, + { STAND_RIGHT, POKED_R, GOT_POKED_R }, + + { STAND_LEFT, WALK_LEFT, WALK_L }, + { STAND_LEFT, RUN_LEFT, RUN_L }, + { STAND_LEFT, BLOCK_LEFT, BLOCK }, + { STAND_LEFT, POKE_LEFT, POKE }, + { STAND_LEFT, DUCK_LEFT, DUCK }, + { STAND_LEFT, IN_LEFT, GO_IN }, + { STAND_LEFT, OUT_LEFT, GO_OUT }, + { STAND_LEFT, THROW_LEFT, THROW }, + { STAND_LEFT, L2R_TURN, WALK_R }, + { STAND_LEFT, L2R_TURN, RUN_R }, + { STAND_LEFT, HIT_FACE_L, GOT_HIT_L }, + { STAND_LEFT, HIT_BACK_L, GOT_HIT_R }, + { STAND_LEFT, POKED_L, GOT_POKED_L }, + + { WALK_RIGHT, WALK_RIGHT, WALK_R }, + { WALK_RIGHT, RUN_RIGHT, RUN_R }, + { WALK_RIGHT, THROW_RIGHT_WALK, THROW }, + { WALK_RIGHT, R2L_TURN, RUN_L }, + { WALK_RIGHT, R2L_TURN, WALK_L }, + { WALK_RIGHT, IN_RIGHT, GO_IN }, + { WALK_RIGHT, OUT_RIGHT, GO_OUT }, + { WALK_RIGHT, STAND_RIGHT, NOTHING }, + + { WALK_LEFT, WALK_LEFT, WALK_L }, + { WALK_LEFT, RUN_LEFT, RUN_L }, + { WALK_LEFT, THROW_LEFT_WALK, THROW }, + { WALK_LEFT, L2R_TURN, RUN_R }, + { WALK_LEFT, L2R_TURN, WALK_R }, + { WALK_LEFT, IN_LEFT, GO_IN }, + { WALK_LEFT, OUT_LEFT, GO_OUT }, + { WALK_LEFT, STAND_LEFT, NOTHING }, + + { RUN_RIGHT, RUN_RIGHT, RUN_R }, + { RUN_RIGHT, WALK_RIGHT, WALK_R }, + { RUN_RIGHT, THROW_RIGHT_RUN, THROW }, + { RUN_RIGHT, R2L_TURN, RUN_L }, + { RUN_RIGHT, R2L_TURN, WALK_L }, + { RUN_RIGHT, IN_RIGHT, GO_IN }, + { RUN_RIGHT, OUT_RIGHT, GO_OUT }, + { RUN_RIGHT, STAND_RIGHT, NOTHING }, + + { RUN_LEFT, RUN_LEFT, RUN_L }, + { RUN_LEFT, WALK_LEFT, WALK_L }, + { RUN_LEFT, THROW_LEFT_RUN, THROW }, + { RUN_LEFT, L2R_TURN, RUN_R }, + { RUN_LEFT, L2R_TURN, WALK_R }, + { RUN_LEFT, IN_LEFT, GO_IN }, + { RUN_LEFT, OUT_LEFT, GO_OUT }, + { RUN_LEFT, STAND_LEFT, NOTHING }, + + { R2L_TURN, STAND_LEFT, EOS }, + + { L2R_TURN, STAND_RIGHT, EOS }, + + { DUCK_RIGHT, STAND_RIGHT, EOS }, + + { DUCK_LEFT, STAND_LEFT, EOS }, + + { BLOCK_RIGHT, STAND_RIGHT, EOS }, + + { BLOCK_LEFT, STAND_LEFT, EOS }, + + { POKE_RIGHT, STAND_RIGHT, EOS }, + + { POKE_LEFT, STAND_LEFT, EOS }, + + { IN_RIGHT, WALK_RIGHT, WALK_R }, + { IN_RIGHT, R2L_TURN, WALK_L }, + { IN_RIGHT, OUT_RIGHT, GO_OUT }, + { IN_RIGHT, STAND_RIGHT, EOS }, + { IN_RIGHT, STAND_RIGHT, NOTHING }, + + { IN_LEFT, WALK_LEFT, WALK_L }, + { IN_LEFT, L2R_TURN, WALK_R }, + { IN_LEFT, OUT_LEFT, GO_OUT }, + { IN_LEFT, STAND_LEFT, EOS }, + { IN_LEFT, STAND_LEFT, NOTHING }, + + { OUT_RIGHT, WALK_RIGHT, WALK_R }, + { OUT_RIGHT, R2L_TURN, WALK_L }, + { OUT_RIGHT, IN_RIGHT, GO_IN }, + { OUT_RIGHT, STAND_RIGHT, EOS }, + { OUT_RIGHT, STAND_RIGHT, NOTHING}, + + { OUT_LEFT, WALK_LEFT, WALK_L }, + { OUT_LEFT, L2R_TURN, WALK_R }, + { OUT_LEFT, IN_LEFT, GO_IN }, + { OUT_LEFT, STAND_LEFT, EOS }, + { OUT_LEFT, STAND_LEFT, NOTHING }, + + { HIT_FACE_L, STAND_LEFT, EOS }, + + { HIT_FACE_R, STAND_RIGHT, EOS }, + + { HIT_BACK_L, STAND_LEFT, EOS }, + + { HIT_BACK_R, STAND_RIGHT, EOS }, + + { POKED_L, STAND_LEFT, EOS }, + + { POKED_R, STAND_RIGHT, EOS }, + + { THROW_RIGHT, INT_THROW_RIGHT, EOS }, + { THROW_LEFT, INT_THROW_LEFT, EOS }, + { THROW_RIGHT_WALK, INT_THROW_RIGHT_WALK, EOS }, + { THROW_LEFT_WALK, INT_THROW_LEFT_WALK, EOS }, + { THROW_RIGHT_RUN, INT_THROW_RIGHT_RUN, EOS }, + { THROW_LEFT_RUN, INT_THROW_LEFT_RUN, EOS }, + + { IS_DEAD, GAME_OVER, EOS }, + +// HEY! PAY ATTENTION! States listed here on out MUST NOT be returned +// to the level object... they are for internal use only, and since they +// don't have sprite sequences defined for them ,the game will die horribly +// if they are returned! I warned you... + { INT_THROW_RIGHT, STAND_RIGHT, EOS }, + { INT_THROW_LEFT, STAND_LEFT, EOS }, + { INT_THROW_RIGHT_WALK, WALK_RIGHT, EOS }, + { INT_THROW_LEFT_WALK, WALK_LEFT, EOS }, + { INT_THROW_RIGHT_RUN, RUN_RIGHT, EOS }, + { INT_THROW_LEFT_RUN, RUN_LEFT, EOS }, + + { -1,-1,-1 } // end of states. don't change! +}; + +typedef signed char SCHAR; + +typedef struct +{ + LONG posx; + LONG posy; + SCHAR state; + SCHAR velx; + SCHAR vely; + SCHAR curZ; +} GENERIC_CHAR_INFO; + +typedef struct +{ + int curState; + int LastMouseX; + int LastMouseY; + DWORD timeLastUpdate; + int HitsLeft; + int pushedState; + CGameCharacter * myPie; + int type; // 0 = main; 1=computer; 2= second; + int IGotKilled; + DWORD Timeout; + DWORD UpdateInterval; +} KLOWN_DATA; + + +#define KLOWN_MOVE 1 +#define KLOWN_PIE 2 + +HINSTANCE hInst = NULL; // our library instance +// This is returned by the 'Ident' function, but isn't used internally at all +CGameVersionIdent version = +{ + RELEASE1_0, + GAMEID +}; + +// prototypes so we can fill in the action arrays +int PieCreate( CGameCharacter *, CGameLevel * ); +int PieAction( CGameCharacter *, CGameLevel * ); +int PieDestroy( CGameCharacter *, CGameLevel * ); +int PieCollide( CGameCharacter *, CGameCharacter *, CGameLevel * ); +int KlownCreate( CGameCharacter *, CGameLevel * ); +int KlownAction( CGameCharacter *, CGameLevel * ); +int KlownDestroy( CGameCharacter *, CGameLevel * ); +int KlownRemoteAction( CGameCharacter *, CGameLevel * ); +int KlownCollide( CGameCharacter *, CGameCharacter *, CGameLevel * ); + +CGameCharSequenceInfo char1seq[2] = +{ + // sequence 0: ThrownLeft + {"piefly.spr", "FlyLeft", 30, {"throw.wav", NULL, 100, 0}}, + // sequence 1: ThrownRight + {"piefly.spr", "FlyRight", 30, {"throw.wav", NULL, 100, 0}} +}; + +// NOTE: the klown sequences below are all the same. They are included +// separately to permit possible future changes in behaviour for different klowns. +CGameCharSequenceInfo klown1seq[32] = +{ + {"c1stand.spr", "StandRight", 30, {NULL, NULL, 0, 0}}, // STAND_RIGHT + {"c1stand.spr", "StandLeft", 30, {NULL, NULL, 0, 0}}, // STAND_LEFT + {"c1walk.spr", "WalkRight", 30, {"walk.wav", NULL, 40, 1}}, // WALK_RIGHT + {"c1walk.spr", "WalkLeft", 30, {"walk.wav", NULL, 40, 1}}, // WALK_LEFT + {"c1run.spr", "RunRight", 30, {"run.wav", NULL, 60, 1}}, // RUN_RIGHT + {"c1run.spr", "RunLeft", 30, {"run.wav", NULL, 60, 1}}, // RUN_LEFT + {"c1turn.spr", "Right2Left", 30, {NULL, NULL, 80, 1}}, // R2L_TURN + {"c1turn.spr", "Left2Right", 30, {NULL, NULL, 80, 1}}, // L2R_TURN + {"c1throw.spr", "ThrowRight", 30, {NULL, NULL, 80, 1}}, // THROW_RIGHT + {"c1throw.spr", "ThrowLeft", 30, {NULL, NULL, 80, 1}}, // THROW_LEFT + {"c1stand.spr", "StandRight", 30, {NULL, NULL, 80, 1}}, // THROW_RIGHT_WALK + {"c1stand.spr", "StandLeft", 30, {NULL, NULL, 80, 1}}, // THROW_LEFT_WALK + {"c1stand.spr", "StandRight", 30, {NULL, NULL, 80, 1}}, // THROW_RIGHT_RUN + {"c1stand.spr", "StandLeft", 30, {NULL, NULL, 80, 1}}, // THROW_LEFT_RUN + {"c1walk45.spr", "InRight", 30, {"walk.wav", NULL, 40, 1}}, // IN_RIGHT + {"c1walk45.spr", "InLeft", 30, {"walk.wav", NULL, 40, 1}}, // IN_LEFT + {"c1walk45.spr", "OutRight", 30, {"walk.wav", NULL, 40, 1}}, // OUT_RIGHT + {"c1walk45.spr", "OutLeft", 30, {"walk.wav", NULL, 40, 1}}, // OUT_LEFT + {"c1duck.spr", "DuckRight", 30, {NULL, NULL, 40, 1}}, // DUCK_RIGHT + {"c1duck.spr", "DuckLeft", 30, {NULL, NULL, 40, 1}}, // DUCK_LEFT + {"c1block.spr", "BlockRight", 30, {NULL, NULL, 40, 1}}, // BLOCK_RIGHT + {"c1block.spr", "BlockLeft", 30, {NULL, NULL, 40, 1}}, // BLOCK_LEFT + {"c1poke.spr", "PokeRight", 30, {"nyuk.wav", NULL, 63, 0}}, // POKE_RIGHT + {"c1poke.spr", "PokeLeft", 30, {"nyuk.wav", NULL, 63, 0}}, // POKE_LEFT + {"c1piefac.spr", "PieFaceLeft", 30, {NULL, "piehit2.wav", 100, 0}}, // HIT_FACE_L + {"c1piefac.spr", "PieFaceRight", 30, {NULL, "piehit2.wav", 100, 0}}, // HIT_FACE_R + {"c1piehed.spr", "PieHeadLeft", 30, {NULL, "piehit2.wav", 100, 0}}, // HIT_BACK_L + {"c1piehed.spr", "PieHeadRight", 30, {NULL, "piehit2.wav", 100, 0}}, // HIT_BACK_R + {"c1stand.spr", "StandLeft", 30, {"woob.wav", NULL, 63, 0}}, // POKED_L + {"c1stand.spr", "StandRight", 30, {"woob.wav", NULL, 63, 0}}, // POKED_R + {"c1sad.spr", "C1SadLeft", 10, {"sad.wav", NULL, 100, 0}}, // IS_DEAD + {"c1sad.spr", "C1SadDone", 10, {NULL, NULL, 100, 0}} // GAME_OVER +}; + +CGameCharSequenceInfo klown2seq[32] = +{ + {"c2stand.spr", "C2StandRight", 30, {NULL, NULL, 0, 0}}, // STAND_RIGHT + {"c2stand.spr", "C2StandLeft", 30, {NULL, NULL, 0, 0}}, // STAND_LEFT + {"c2walk.spr", "C2WalkRight", 30, {"walk.wav", NULL, 40, 1}}, // WALK_RIGHT + {"c2walk.spr", "C2WalkLeft", 30, {"walk.wav", NULL, 40, 1}}, // WALK_LEFT + {"c2run.spr", "C2RunRight", 30, {"run.wav", NULL, 60, 1}}, // RUN_RIGHT + {"c2run.spr", "C2RunLeft", 30, {"run.wav", NULL, 60, 1}}, // RUN_LEFT + {"c2turn.spr", "C2Right2Left", 30, {NULL, NULL, 80, 1}}, // R2L_TURN + {"c2turn.spr", "C2Left2Right", 30, {NULL, NULL, 80, 1}}, // L2R_TURN + {"c2throw.spr", "C2ThrowRight", 30, {NULL, NULL, 80, 1}}, // THROW_RIGHT + {"c2throw.spr", "C2ThrowLeft", 30, {NULL, NULL, 80, 1}}, // THROW_LEFT + {"c2stand.spr", "C2StandRight", 30, {NULL, NULL, 80, 1}}, // THROW_RIGHT_WALK + {"c2stand.spr", "C2StandLeft", 30, {NULL, NULL, 80, 1}}, // THROW_LEFT_WALK + {"c2stand.spr", "C2StandRight", 30, {NULL, NULL, 80, 1}}, // THROW_RIGHT_RUN + {"c2stand.spr", "C2StandLeft", 30, {NULL, NULL, 80, 1}}, // THROW_LEFT_RUN + {"c2walk45.spr", "C2InRight", 30, {"walk.wav", NULL, 40, 1}}, // IN_RIGHT + {"c2walk45.spr", "C2InLeft", 30, {"walk.wav", NULL, 40, 1}}, // IN_LEFT + {"c2walk45.spr", "C2OutRight", 30, {"walk.wav", NULL, 40, 1}}, // OUT_RIGHT + {"c2walk45.spr", "C2OutLeft", 30, {"walk.wav", NULL, 40, 1}}, // OUT_LEFT + {"c2duck.spr", "C2DuckRight", 30, {NULL, NULL, 40, 1}}, // DUCK_RIGHT + {"c2duck.spr", "C2DuckLeft", 30, {NULL, NULL, 40, 1}}, // DUCK_LEFT + {"c2block.spr", "C2BlockRight", 30, {NULL, NULL, 40, 1}}, // BLOCK_RIGHT + {"c2block.spr", "C2BlockLeft", 30, {NULL, NULL, 40, 1}}, // BLOCK_LEFT + {"c2poke.spr", "C2PokeRight", 30, {"nyuk.wav", NULL, 63, 0}}, // POKE_RIGHT + {"c2poke.spr", "C2PokeLeft", 30, {"nyuk.wav", NULL, 63, 0}}, // POKE_LEFT + {"c2piefac.spr", "C2PieFaceLeft", 30, {NULL, "piehit2.wav", 100, 0}}, // HIT_FACE_L + {"c2piefac.spr", "C2PieFaceRight", 30, {NULL, "piehit2.wav", 100, 0}}, // HIT_FACE_R + {"c2piehed.spr", "C2PieHeadLeft", 30, {NULL, "piehit2.wav", 100, 0}}, // HIT_BACK_L + {"c2piehed.spr", "C2PieHeadRight", 30, {NULL, "piehit2.wav", 100, 0}}, // HIT_BACK_R + {"c2stand.spr", "C2StandLeft", 30, {"woob.wav", NULL, 63, 0}}, // POKED_L + {"c2stand.spr", "C2StandRight", 30, {"woob.wav", NULL, 63, 0}}, // POKED_R + {"c2sad.spr", "c2SadLeft", 10, {"sad.wav", NULL, 100, 0}}, // IS_DEAD + {"c2sad.spr", "c2SadDone", 10, {NULL, NULL, 100, 0}} // GAME_OVER +}; + +#if 0 // !!! don't have all the bitmaps yet + +CGameCharSequenceInfo klown3seq[32] = +{ + {"C3stand.spr", "C3StandRight", 30, {NULL, NULL, 0, 0}}, // STAND_RIGHT + {"C3stand.spr", "C3StandLeft", 30, {NULL, NULL, 0, 0}}, // STAND_LEFT + {"C3walk.spr", "C3WalkRight", 30, {"walk.wav", NULL, 40, 1}}, // WALK_RIGHT + {"C3walk.spr", "C3WalkLeft", 30, {"walk.wav", NULL, 40, 1}}, // WALK_LEFT + {"C3run.spr", "C3RunRight", 30, {"run.wav", NULL, 60, 1}}, // RUN_RIGHT + {"C3run.spr", "C3RunLeft", 30, {"run.wav", NULL, 60, 1}}, // RUN_LEFT + {"C3turn.spr", "C3Right2Left", 30, {NULL, NULL, 80, 1}}, // R2L_TURN + {"C3turn.spr", "C3Left2Right", 30, {NULL, NULL, 80, 1}}, // L2R_TURN + {"C3throw.spr", "C3ThrowRight", 30, {NULL, NULL, 80, 1}}, // THROW_RIGHT + {"C3throw.spr", "C3ThrowLeft", 30, {NULL, NULL, 80, 1}}, // THROW_LEFT + {"C3stand.spr", "C3StandRight", 30, {NULL, NULL, 80, 1}}, // THROW_RIGHT_WALK + {"C3stand.spr", "C3StandLeft", 30, {NULL, NULL, 80, 1}}, // THROW_LEFT_WALK + {"C3stand.spr", "C3StandRight", 30, {NULL, NULL, 80, 1}}, // THROW_RIGHT_RUN + {"C3stand.spr", "C3StandLeft", 30, {NULL, NULL, 80, 1}}, // THROW_LEFT_RUN + {"C3walk45.spr", "C3InRight", 30, {"walk.wav", NULL, 40, 1}}, // IN_RIGHT + {"C3walk45.spr", "C3InLeft", 30, {"walk.wav", NULL, 40, 1}}, // IN_LEFT + {"C3walk45.spr", "C3OutRight", 30, {"walk.wav", NULL, 40, 1}}, // OUT_RIGHT + {"C3walk45.spr", "C3OutLeft", 30, {"walk.wav", NULL, 40, 1}}, // OUT_LEFT + {"C3duck.spr", "C3DuckRight", 30, {NULL, NULL, 40, 1}}, // DUCK_RIGHT + {"C3duck.spr", "C3DuckLeft", 30, {NULL, NULL, 40, 1}}, // DUCK_LEFT + {"C3block.spr", "C3BlockRight", 30, {NULL, NULL, 40, 1}}, // BLOCK_RIGHT + {"C3block.spr", "C3BlockLeft", 30, {NULL, NULL, 40, 1}}, // BLOCK_LEFT + {"C3poke.spr", "C3PokeRight", 30, {"nyuk.wav", NULL, 63, 0}}, // POKE_RIGHT + {"C3poke.spr", "C3PokeLeft", 30, {"nyuk.wav", NULL, 63, 0}}, // POKE_LEFT + {"C3piefac.spr", "C3PieFaceLeft", 30, {NULL, "piehit2.wav", 100, 0}}, // HIT_FACE_L + {"C3piefac.spr", "C3PieFaceRight", 30, {NULL, "piehit2.wav", 100, 0}}, // HIT_FACE_R + {"C3piehed.spr", "C3PieHeadLeft", 30, {NULL, "piehit2.wav", 100, 0}}, // HIT_BACK_L + {"C3piehed.spr", "C3PieHeadRight", 30, {NULL, "piehit2.wav", 100, 0}}, // HIT_BACK_R + {"C3stand.spr", "C3StandLeft", 30, {"woob.wav", NULL, 63, 0}}, // POKED_L + {"C3stand.spr", "C3StandRight", 30, {"woob.wav", NULL, 63, 0}}, // POKED_R + {"C3sad.spr", "C3SadLeft", 10, {"sad.wav", NULL, 100, 0}}, // IS_DEAD + {"C3sad.spr", "C3SadDone", 10, {NULL, NULL, 100, 0}} // GAME_OVER +}; +#endif + +// number of klown sequence sets above -1 for main klown +//#define NUM_AUTO_KLOWNS 2 +#define NUM_AUTO_KLOWNS 1 + +// table of sequence tables for allocating non-main klowns +CGameCharSequenceInfo* klownSeqTable[NUM_AUTO_KLOWNS] = +{ + klown2seq //, +// klown3seq +}; + +// returned by 'Info' function, and isn't used either (internally) +CGameCharInfo character1 = +{ + "Pie", + 2, + &char1seq[0], + + PieCreate, + PieAction, + PieDestroy, + NULL, + PieCollide +}; + +// returned by 'Info' function, and isn't used either (internally) +static CGameCharInfo character2 = +{ + "Klown", + 32, + &klown1seq[0], + + KlownCreate, + KlownAction, + KlownDestroy, + KlownRemoteAction, + KlownCollide +}; + +// returned by 'Info' function, and isn't used either (internally) +// Klown2 uses the klown2 - klownN sequences above, allocated 1 at a time +static CGameCharInfo character3 = +{ + "Klown2", + 32, + &klown2seq[0], // modified at create time + + KlownCreate, + KlownAction, + KlownDestroy, + KlownRemoteAction, + KlownCollide +}; + +// This array allows the caller to get our information directly +CGameCharInfo *characters[] = +{ + &character1, + &character2, + &character3 +}; + +CGameInfo dllinfo = +{ + 3, // number of characters implemented in + // this DLL + characters // array of CGameCharInfo pointers +}; + +void InitStateIndex(STATE *states, int *index, int indexsize); +// EXPORTED as ordinal #1: +#if defined(__BORLANDC__) || defined(__WATCOMC__) +extern "C" void CALLBACK Ident( CGameVersionIdent * id ) +#else +void CALLBACK Ident( CGameVersionIdent * id ) +#endif +{ + GetModuleFileName(NULL, inifile, 259); + char *p = strrchr(inifile, '.'); + if (p) + lstrcpy(p+1, "GAM"); + + gFastKlown = GetPrivateProfileInt("KRUSTY.DLL", "fastklown", 0, inifile); + gFastVel = GetPrivateProfileInt("KRUSTY.DLL", "fastvel", 20, inifile); + gDebugOut = GetPrivateProfileInt("KRUSTY.DLL", "debugout", 0, inifile); + gPieSpeed = GetPrivateProfileInt("KRUSTY.DLL", "piespeed", 5, inifile); + gPieRange = GetPrivateProfileInt("KRUSTY.DLL", "pierange", 500, inifile); + gKlownHits = GetPrivateProfileInt("KRUSTY.DLL", "hits", 10, inifile); + SENSITIVITY = GetPrivateProfileInt("KRUSTY.DLL", "JoystickSensitivity", 33, inifile); + RUN_THRESHOLD = GetPrivateProfileInt("KRUSTY.DLL", "RunThreshold", 66, inifile); + gAgression = GetPrivateProfileInt("KRUSTY.DLL", "aggression", 10, inifile); + gMobility = GetPrivateProfileInt("KRUSTY.DLL", "mobility", 3, inifile); + gTimeout = (DWORD)GetPrivateProfileInt("KRUSTY.DLL", "RemoteTimeout", 30, inifile) + * 1000; + gUpdateInterval = (DWORD)GetPrivateProfileInt("KRUSTY.DLL", "RemoteUpdateInterval", 100, inifile); + + memcpy( id, &version, sizeof( CGameVersionIdent ) ); + + InitStateIndex(klown_states, &klown_states_index[0], INT_NUM_STATES); +} + +// EXPORTED as ordinal #2: +#if defined(__BORLANDC__) || defined(__WATCOMC__) +extern "C" void CALLBACK Info( CGameInfo * info ) +#else +void CALLBACK Info( CGameInfo * info ) +#endif +{ + memcpy( info, &dllinfo, sizeof( dllinfo ) ); +} + +void InitStateIndex(STATE *states, int *index, int indexsize) +{ + int ix; + + // set index to unused + memset(index, -1, indexsize * sizeof(int)); + + // iterate through states, putting correct index into 'index' + ix = 0; + int laststate = -2; + while (states[ix].start != -1) + { + if (states[ix].start != laststate) + { + if (states[ix].start < indexsize) + index[states[ix].start] = ix; + + laststate = states[ix].start; + } + ++ix; + } +} + +int ChangeState ( STATE * states, + int *index, + int curstate, + int transition, + CGameCharacter * me, + int time) +{ + /* + The STATEs are grouped by state; they are "clumped" together, so + that once we find the 'curstate' in the array, we can look at all + the possible transitions out of 'curstate'. + + The last state in the array of allowable states is "-1". + */ + + + // first off: does this state care about any transitions? + if (klown_state_flags[curstate] & MUST_FINISH) + { + // must finish this sequence; ignore transition! + if (me->NextSprite(time, FALSE) == 0) + { + // end of sequence; + transition = EOS; + } + else + { + // not end; just return + return(curstate); + } + } + else + { + // do the next sprite + me->NextSprite(time, TRUE); + } + + int ix = index[curstate]; + while (states[ix].start == curstate) + { + if (states[ix].transition == transition) + { + return(states[ix].end); + } + ++ix; + } + // didn't find our transition, so don't change state + return(curstate); +} + +int PieCreate( CGameCharacter *me, CGameLevel *level ) +{ + // use private data as plain old integer... + me->mpPrivateData = (void *) level->GetFrameTime(); + + return ( ACTION_COMPLETED ); +} + +int PieAction( CGameCharacter *me, CGameLevel *level ) +{ + int posx, posy, velx, vely; + int time = level->GetFrameTime(); + int slices = (me->mLastTime == -1) ? 1 : time - me->mLastTime; + me->mLastTime = time; + + me->GetVelocity(&velx, &vely); + + // remember to use sub-pixels! + me->GetSubXY(&posx, &posy); + posx += SUBPIXEL_DELTA(velx, slices); + posy += SUBPIXEL_DELTA(vely, slices); + + if (time > ((int) me->mpPrivateData + gPieRange)) + { + posy = -100000; + me->mpPrivateData = (void *)-1; + me->SetAndMove(posx, posy); + me->NextSprite(level->GetTimer()->Time, FALSE); + return(-2); + } + else + { + me->SetAndMove(posx, posy); + me->NextSprite(level->GetTimer()->Time, FALSE); + + if (velx < 0) + return(0); + else + return(1); + } + +} + +int PieDestroy( CGameCharacter *me, CGameLevel *level ) +{ + me->mpPrivateData = (void *)-1; + return ( ACTION_COMPLETED ); +} + +int PieCollide( CGameCharacter *me, CGameCharacter *other, CGameLevel *level ) +{ + int posx, posy; + me->GetSubXY(&posx, &posy); + + //move off the visible world, so we "disappear" + posy = -100000; + me->SetAndMove(posx, posy); + me->mpPrivateData = (void *)-1; + return(0); +} + +static int curKlown = 0; + +static int KlownCreate( CGameCharacter *me, CGameLevel *level ) +{ + KLOWN_DATA *pKlown = new KLOWN_DATA; + int x,y,buttons; +// srand(0); + memset(pKlown, 0, sizeof(KLOWN_DATA)); + me->mpPrivateData = (void *) pKlown; + if (level->GetInput()->GetMouse(x, y, buttons)) + { + pKlown->LastMouseX = x; + pKlown->LastMouseY = y; + } + + pKlown->curState = STAND_RIGHT; + pKlown->pushedState = -1; + pKlown->HitsLeft = gKlownHits; + pKlown->timeLastUpdate = level->GetFrameTime(); + pKlown->IGotKilled = 0; + + pKlown->Timeout = gTimeout; + pKlown->UpdateInterval = gUpdateInterval; + + BOOL isMain = (lstrcmpi(me->GetName(), "klown") == 0); + + if (isMain && gFastKlown) + { + pKlown->curState = RUN_RIGHT; + me->SetVelocity(gFastVel,0); + } + else + { + pKlown->myPie = level->Add("Pie",me->GetCurrentZ(),0,-100000); + } + + if (!isMain) + { + // set sequence set for non-main klowns using counter to allocate + // NOTE: this will change our global copy, so be careful! + me->mpCharInfo->Sequences = klownSeqTable[curKlown++ % NUM_AUTO_KLOWNS]; + } + + return ( ACTION_COMPLETED ); +} + +static void FirePie ( + int posx, + int posy, + int velx, + int vely, + CGameCharacter *me, + CGameLevel *level, + BOOL fRemote +) +{ + KLOWN_DATA *pKlown = (KLOWN_DATA *) me->mpPrivateData; + char chBuffer[128]; + + if (pKlown->myPie == NULL) + { + pKlown->myPie = level->Add("Pie",me->GetCurrentZ(),0,0); + } + + PieCreate(pKlown->myPie, level); + + pKlown->myPie->SetCurrentZ(me->GetCurrentZ()); + if (velx > 0) + { + pKlown->myPie->MoveTo(posx + me->GetCurWidth(), posy); + } + else + { + pKlown->myPie->MoveTo(posx - 32, posy); + } + + pKlown->myPie->SetVelocity(velx, vely); + if (!fRemote) + { + GENERIC_CHAR_INFO ci; + + ci.state = 0; + ci.posx = posx; + ci.posy = posy; + ci.velx = (velx > 0) ? 1 : -1; + ci.vely = (vely > 0) ? 1 : -1; + wsprintf( chBuffer, "Pie %d %d %d %d\r\n", + velx, vely, ci.velx, ci.vely); + OutputDebugString(chBuffer); + ci.curZ = me->GetCurrentZ(); + me->TransmitRemoteAction(KLOWN_PIE, &ci, sizeof(ci)); + } +} + +int AddWithLimit(int base, int howmuch, int lowerlimit, int upperlimit) +{ + base += howmuch; + if (base > upperlimit) + base = upperlimit; + if (base < lowerlimit) + base = lowerlimit; + return(base); +} + +int AdjustedY(int base, int curz, int newz, int minz, int maxz) +{ + int y_shift = 0; + int old_shift = 0; + + y_shift = (newz - (maxz - minz)) << 3; + old_shift = (curz - (maxz - minz)) << 3; + base += (old_shift << 8); + base -= (y_shift << 8); + return(base); +} + +// returns the new state ("action") +static int KlownAction( CGameCharacter *me, CGameLevel *level ) +{ + int time = level->GetFrameTime(); + int slices = (me->mLastTime == -1) ? 1 : time - me->mLastTime; + me->mLastTime = time; + + int velx, vely, zchange; + int posx, posy; + KLOWN_DATA *pKlown = (KLOWN_DATA *) me->mpPrivateData; + + int oldstate = pKlown->curState; + int newstate = oldstate; + int transition = NOTHING; + + JOYINFO joy; + int x, y, buttons; + + zchange = 0; + + me->GetVelocity(&velx, &vely); + + // remember to use sub-pixels! + me->GetSubXY(&posx, &posy); + + CGameInput * Input = level->GetInput(); + if ((pKlown->type == 0) && (gFastKlown != (int) level->mFastKlown)) + { + gFastKlown = (int) level->mFastKlown; + if (gFastKlown) + { + pKlown->curState = RUN_RIGHT; + velx = gFastVel; + vely = 0; + me->SetVelocity(velx,vely); + newstate = oldstate = RUN_RIGHT; + } + else + { + pKlown->curState = STAND_RIGHT; + me->SetVelocity( 0,0 ); + newstate = oldstate = STAND_RIGHT; + } + } + + if (gFastKlown && (pKlown->type == 0)) + { + me->NextSprite(time); + newstate = oldstate; + + if (SUB2WORLD(posx) <= (-level->GetMaxX())) + { + velx = -velx; + newstate = RUN_RIGHT; + } + else if (SUB2WORLD(posx) >= (level->GetMaxX() - me->GetCurWidth() )) + { + newstate = RUN_LEFT; + velx = -velx; + } + } + else + { + // step 1: Grab input and figure out what the command is: + velx=vely=zchange=0; + + int alt, ctrl, shift; + int right, left, up, down; + + alt = ctrl = shift = right = left = up = down = 0; + + switch (pKlown->type) + { + case 0: // "normal" + alt = Input->GetKeyboard(VK_MENU); + ctrl = Input->GetKeyboard(VK_CONTROL); + shift=Input->GetKeyboard(VK_SHIFT); + right = (Input->GetKeyboard(VK_RIGHT) != 0) || + (Input->GetKeyboard(VK_NUMPAD6) != 0); + left = (Input->GetKeyboard(VK_LEFT) != 0) || + (Input->GetKeyboard(VK_NUMPAD4) != 0); + up = (Input->GetKeyboard(VK_UP) != 0) || + (Input->GetKeyboard(VK_NUMPAD8) != 0); + down = (Input->GetKeyboard(VK_DOWN) != 0) || + (Input->GetKeyboard(VK_NUMPAD2) != 0); + + if (! (up || down || left || right || shift)) + { + + if (Input->GetMouse(x, y, buttons)) + { + int deltaX = x - pKlown->LastMouseX; + int deltaY = y - pKlown->LastMouseY; + + right = (deltaX > MIN_MOUSE_MOVE); + left = (deltaX < -MIN_MOUSE_MOVE); + if ((deltaX > BIG_MOUSE_MOVE) || (deltaX < -BIG_MOUSE_MOVE)) + { + ctrl = TRUE; + } + down = (deltaY > 5*MIN_MOUSE_MOVE); + up = (deltaY < -5*MIN_MOUSE_MOVE); + + shift = shift || (buttons & 1); + alt = buttons & 2; + + x = CenterX; + y = CenterY; + + pKlown->LastMouseX = x; + pKlown->LastMouseY = y; + SetCursorPos(x, y); + } + } + + if (! (up || down || left || right || shift)) + { + + // grab joystick input... + if (Input->GetJoystick(1, &joy)) + { + // motion left ,right, up or down; button 1=fire pie. button2=flip + int vel; + vel = joy.wXpos; + if (vel >= SENSITIVITY) + { + // moved right: + right = 1; + if (vel >= RUN_THRESHOLD) + ctrl = 1; + } + else if (vel <= -SENSITIVITY) + { + // moved left: + left = 1; + if (vel <= -RUN_THRESHOLD) + ctrl = 1; + } + + vel = joy.wYpos; + if (vel >= SENSITIVITY) + down = 1; + else if (vel <= -SENSITIVITY) + up = 1; + + if (joy.wButtons & JOY_BUTTON1) + shift = 1; + if (joy.wButtons & JOY_BUTTON2) + alt = 1; + } + } + break; + + case 1: // "robo" + // where is the main klown, relative to us? + if (level->mMainKlown && (level->mMainKlown != me)) + { + // get its rectangle + PRECT pMainRect = level->mMainKlown->GetRect(); + PRECT pMyRect = me->GetRect(); + + // first: if we were walking, we should keep on walking! + if (oldstate == WALK_LEFT || oldstate == WALK_RIGHT) + { + if (rand() % 10) + { + if (oldstate == WALK_LEFT) + ++left; + else + ++right; + goto no_change; + + } + + } + + if ((int)(rand() % 100) <= gMobility) + { + if (rand() % 5) + { + if (pMainRect->left < pMyRect->left) + ++left; + else + ++right; + } + else + { + int z = level->mMainKlown->GetCurrentZ(); + if ((z > me->GetCurrentZ()) || gFastKlown) + { + // increase our z + ++up; + } + else if (z < me->GetCurrentZ()) + { + // decrease our z + ++down; + } + } + +no_change: + // nothing + ; + } + else if ((int)(rand() % 100) <= gAgression) + ++shift; + } + + break; + + case 2: // "second" always uses second joystick + if (Input->GetJoystick(2, &joy)) + { + // motion left ,right, up or down; button 1=fire pie. button2=flip + int vel; + vel = joy.wXpos; + if (vel >= SENSITIVITY) + { + // moved right: + right = 1; + if (vel >= RUN_THRESHOLD) + ctrl = 1; + } + else if (vel <= -SENSITIVITY) + { + // moved left: + left = 1; + if (vel <= -RUN_THRESHOLD) + ctrl = 1; + } + + vel = joy.wYpos; + if (vel >= SENSITIVITY) + down = 1; + else if (vel <= -SENSITIVITY) + up = 1; + + if (joy.wButtons & JOY_BUTTON1) + shift = 1; + if (joy.wButtons & JOY_BUTTON2) + alt = 1; + } + break; + } + + if (up) + transition = GO_IN; + if (down) + transition = GO_OUT; + if (left) + transition = ctrl ? RUN_L : WALK_L; + if (right) + transition = ctrl ? RUN_R : WALK_R; + if (shift) + transition = THROW; + if (alt && down) + transition = DUCK; + if (shift && down) + transition = POKE; + if (alt && shift) + transition = BLOCK; + + // got a transition; figure out the new state + if (pKlown->pushedState >= 0) + { + newstate = pKlown->pushedState; + pKlown->pushedState = -1; + } + else + { + newstate = ChangeState( klown_states, + klown_states_index, + oldstate, + transition, + me, + time); + } + + switch (newstate) + { + case INT_COLLIDED_ON_RIGHT: + if (rand() % 2) + { + posx -= WORLD2SUB(me->GetCurWidth()/4); + ++zchange; + } + newstate = STAND_RIGHT; + break; + + case INT_COLLIDED_ON_LEFT: + if (rand() % 2) + { + posx += WORLD2SUB(me->GetCurWidth()/4); + ++zchange; + } + newstate = STAND_LEFT; + break; + + case HIT_FACE_L: + case HIT_FACE_R: + case HIT_BACK_L: + case HIT_BACK_R: + if (newstate != oldstate) + { + --pKlown->HitsLeft; + if (pKlown->HitsLeft <= 0) + { + newstate = IS_DEAD; + } + } + break; + + case IS_DEAD: + velx = 0; + vely = 0; + ++zchange; + break; + + case GAME_OVER: + level->GameOver(); + pKlown->IGotKilled = 1; + + // reset scores of all Klowns... + { + KLOWN_DATA * pK = (KLOWN_DATA *) level->mMainKlown->mpPrivateData; + if (pK) + pK->HitsLeft = gKlownHits; + if (level->mSecondKlown) + { + pK = (KLOWN_DATA *) level->mSecondKlown->mpPrivateData; + if (pK) + pK->HitsLeft = gKlownHits; + } + + // need to change this for more than one computer klown... + if (level->mComputerKlowns[0]) + { + pK = (KLOWN_DATA *) level->mComputerKlowns[0]->mpPrivateData; + if (pK) + pK->HitsLeft = gKlownHits; + } + } + + break; + + case WALK_RIGHT: + velx = WALK_VELOCITY; + break; + + case RUN_RIGHT: + velx = RUN_VELOCITY; + break; + + case WALK_LEFT: + velx = -WALK_VELOCITY; + break; + + case RUN_LEFT: + velx = -RUN_VELOCITY; + break; + + case THROW_LEFT: + case THROW_RIGHT: + case THROW_LEFT_WALK: + case THROW_RIGHT_WALK: + case THROW_LEFT_RUN: + case THROW_RIGHT_RUN: + if (newstate != oldstate) + if (pKlown->myPie && (pKlown->myPie->mpPrivateData!=(void*)-1)) + newstate = oldstate; + break; + + case INT_THROW_RIGHT: + newstate = STAND_RIGHT; + FirePie(SUB2WORLD(posx), SUB2WORLD(posy), gPieSpeed, 0, me, level, FALSE); + break; + + case INT_THROW_RIGHT_WALK: + newstate = WALK_RIGHT; + FirePie(SUB2WORLD(posx), SUB2WORLD(posy), gPieSpeed, 0, me, level, FALSE); + break; + + case INT_THROW_RIGHT_RUN: + newstate = RUN_RIGHT; + FirePie(SUB2WORLD(posx), SUB2WORLD(posy), gPieSpeed, 0, me, level, FALSE); + break; + + case INT_THROW_LEFT: + newstate = STAND_LEFT; + FirePie(SUB2WORLD(posx), SUB2WORLD(posy), -gPieSpeed, 0, me, level, FALSE); + break; + + case INT_THROW_LEFT_WALK: + newstate = WALK_LEFT; + FirePie(SUB2WORLD(posx), SUB2WORLD(posy), -gPieSpeed, 0, me, level, FALSE); + break; + + case INT_THROW_LEFT_RUN: + newstate = RUN_LEFT; + FirePie(SUB2WORLD(posx), SUB2WORLD(posy), -gPieSpeed, 0, me, level, FALSE); + break; + + case IN_LEFT: + { + int curz = me->GetCurrentZ(); + velx = -32; + curz = AddWithLimit(curz, 1, me->GetMinZ(), me->GetMaxZ()); + posy = AdjustedY(posy, me->GetCurrentZ(), curz, me->GetMinZ(), me->GetMaxZ()); + me->SetCurrentZ(curz); + ++zchange; + } + break; + + case IN_RIGHT: + { + int curz = me->GetCurrentZ(); + velx = 32; + curz = AddWithLimit(curz, 1, me->GetMinZ(), me->GetMaxZ()); + posy = AdjustedY(posy, me->GetCurrentZ(), curz, me->GetMinZ(), me->GetMaxZ()); + me->SetCurrentZ(curz); + ++zchange; + } + break; + + case OUT_LEFT: + { + int curz = me->GetCurrentZ(); + velx=-32; + curz = AddWithLimit(curz, -1, me->GetMinZ(), me->GetMaxZ()); + posy = AdjustedY(posy, me->GetCurrentZ(), curz, me->GetMinZ(), me->GetMaxZ()); + me->SetCurrentZ(curz); + ++zchange; + } + break; + case OUT_RIGHT: + { + int curz = me->GetCurrentZ(); + velx=32; + curz = AddWithLimit(curz, -1, me->GetMinZ(), me->GetMaxZ()); + posy = AdjustedY(posy, me->GetCurrentZ(), curz, me->GetMinZ(), me->GetMaxZ()); + me->SetCurrentZ(curz); + ++zchange; + } + break; + } + } + + if (velx || vely || zchange) + { + posx += SUBPIXEL_DELTA(slices, velx); + posy += SUBPIXEL_DELTA(slices, vely); + int newX = SUB2WORLD(posx); + int newY = SUB2WORLD(posy); + + + if (pKlown->type == 0) + level->ForceOnScreen(&newX, &newY, me->GetCurWidth(), me->GetCurHeight()); + else + level->ForceOnScreen(&newX, &newY, me->GetCurWidth(), me->GetCurHeight(), FALSE); + me->MoveTo(newX, newY); + } + + me->SetVelocity(velx, vely); + pKlown->curState = newstate; + + + if (pKlown->type == 0) + { + if ((newstate != oldstate) || (velx || vely || zchange) + || (time - pKlown->timeLastUpdate > pKlown->UpdateInterval)) + { + GENERIC_CHAR_INFO ci; + int velx; + int vely; + + + ci.state = newstate; + me->GetSubXY((int *)&ci.posx, (int *)&ci.posy); + me->GetVelocity(&velx, &vely); + ci.velx = velx; + ci.vely = vely; + ci.curZ = me->GetCurrentZ(); + + me->TransmitRemoteAction(KLOWN_MOVE, &ci, sizeof(ci)); + pKlown->timeLastUpdate = time; + } + } + return ( newstate ); +} + +static int KlownDestroy( CGameCharacter *me, CGameLevel *level ) +{ + delete (void *) me->mpPrivateData; + return ( ACTION_COMPLETED ); +} + +static int KlownRemoteAction( CGameCharacter *me, CGameLevel *level ) +{ + KLOWN_DATA *pKlown = (KLOWN_DATA *) me->mpPrivateData; + int oldstate = pKlown->curState; + + int time = level->GetFrameTime(); + int slices = (me->mLastTime == -1) ? 1 : time - me->mLastTime; + me->mLastTime = time; + + void *Data; + int newstate = oldstate; + int action; + DWORD DataSize; + + me->NextSprite(time, FALSE); + + int nActionsProcessed = 0; + while ((action = me->GetRemoteAction(Data, DataSize)) != -1) + { + + nActionsProcessed++; + + GENERIC_CHAR_INFO *ci = (GENERIC_CHAR_INFO *)Data; + + switch (action) { + case KLOWN_MOVE: + newstate = ci->state; + pKlown->curState = newstate; + me->SetCurrentZ(ci->curZ); + me->SetVelocity(ci->velx, ci->vely); + me->SetAndMove(ci->posx, ci->posy); + break; + + case KLOWN_PIE: + FirePie(ci->posx, ci->posy, ci->velx * gPieSpeed, 0, me , level, TRUE); + break; + + } + me->ReleaseRemoteAction(Data); + } + + if (nActionsProcessed > 0) + { + pKlown->timeLastUpdate = time; + } + else if (time - pKlown->timeLastUpdate > pKlown->Timeout) + { + // need to kill 'em off + return(ACTION_KILLME); + } + else + { + int velx, vely; + int posx, posy; + + // Haven't heard from him, but keep him moving! + me->GetVelocity(&velx, &vely); + me->GetSubXY(&posx, &posy); + if (velx || vely) + { + posx += SUBPIXEL_DELTA(slices, velx); + posy += SUBPIXEL_DELTA(slices, vely); + + me->SetAndMove(posx, posy); + me->SetVelocity(velx, vely); + } + } + + return(newstate); +} + +static int boogy = 0; +int KlownCollide( CGameCharacter *me, CGameCharacter *other, CGameLevel *level ) +{ + KLOWN_DATA *pKlown = (KLOWN_DATA *) me->mpPrivateData; + RECT myRect, otherRect; + LPRECT pmyRect, potherRect; + + if ((pKlown->curState == GAME_OVER) || + (pKlown->curState == IS_DEAD)) + return(ACTION_COMPLETED); + + + pmyRect = me->GetRect(); + potherRect = other->GetRect(); + memcpy(&myRect, pmyRect, sizeof(RECT)); + memcpy(&otherRect, potherRect, sizeof(RECT)); + + if (lstrcmpi(other->GetName(), "Pie") == 0) + { + // got hit by a pie, so decrement HitsLeft + int velx, vely; + other->GetVelocity(&velx, &vely); + switch (pKlown->curState) + { + case STAND_LEFT: + case WALK_LEFT: + case RUN_LEFT: + pKlown->pushedState = (velx < 0) ? HIT_BACK_L : HIT_FACE_L; + break; + case STAND_RIGHT: + case WALK_RIGHT: + case RUN_RIGHT: + pKlown->pushedState = (velx < 0) ? HIT_FACE_R : HIT_BACK_R; + break; + } + } + else + { + // hit another solid body... need to move out of the way: + int posx, posy; + int posx2, posy2; + + if ( (myRect.right < otherRect.left) || + (myRect.left > otherRect.right) + ) + return(ACTION_COMPLETED); + + me->GetXY(&posx, &posy); + other->GetXY(&posx2, &posy2); + + // back up... + if (posx2 < posx) + pKlown->pushedState = INT_COLLIDED_ON_LEFT; + else if (posx2 > posx) + pKlown->pushedState = INT_COLLIDED_ON_RIGHT; + else + { + // coincident... how to handle this? + if (++boogy % 2) + pKlown->pushedState = IN_RIGHT; + else + pKlown->pushedState = OUT_RIGHT; + } + } + return(ACTION_COMPLETED); +} diff --git a/sdk/samples/iklowns/cgkrusty.def b/sdk/samples/iklowns/cgkrusty.def new file mode 100644 index 0000000..c82f2b1 --- /dev/null +++ b/sdk/samples/iklowns/cgkrusty.def @@ -0,0 +1,8 @@ +LIBRARY KRUSTY + +DESCRIPTION 'CGameCharacter Implementation DLL: Krusty' + +EXPORTS + Ident @1 + Info @2 + diff --git a/sdk/samples/iklowns/cgkrusty.mak b/sdk/samples/iklowns/cgkrusty.mak new file mode 100644 index 0000000..f9af8ec --- /dev/null +++ b/sdk/samples/iklowns/cgkrusty.mak @@ -0,0 +1,202 @@ +# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +!IF "$(CFG)" == "" +CFG=Win32 Debug +!MESSAGE No configuration specified. Defaulting to Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CGKRUSTY.MAK" CFG="Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "Win32 Debug" +MTL=MkTypLib.exe +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "retail" +# PROP BASE Intermediate_Dir "retail" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "retail" +# PROP Intermediate_Dir "retail" +OUTDIR=.\retail +INTDIR=.\retail + +ALL : $(OUTDIR)\krusty.dll $(OUTDIR)/CGKRUSTY.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE CPP /nologo /MT /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /MT /W3 /GX /YX /O2 /I "..\..\inc" /I ".\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /c +# SUBTRACT CPP /Fr +CPP_PROJ=/nologo /MT /W3 /GX /YX /O2 /I "..\..\inc" /I ".\include" \ + /D "WIN32" /D "STRICT" /D "NDEBUG" /D "_WINDOWS"\ + /Fp$(OUTDIR)/"CGKRUSTY.pch" /Fo$(INTDIR)/ /c +CPP_OBJS=.\retail/ +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +BSC32_SBRS= \ + +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"CGKRUSTY.bsc" + +$(OUTDIR)/CGKRUSTY.bsc : $(OUTDIR) $(BSC32_SBRS) +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /NOLOGO /SUBSYSTEM:windows,4.0 /DLL /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /NOLOGO /SUBSYSTEM:windows,4.0 /DLL /MACHINE:I386 /OUT:$(OUTDIR)\"krusty.dll" +# SUBTRACT LINK32 /INCREMENTAL:yes +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /NOLOGO\ + /SUBSYSTEM:windows,4.0 /DLL /INCREMENTAL:no /PDB:$(OUTDIR)/"CGKRUSTY.pdb"\ + /MACHINE:I386 /DEF:".\CGKRUSTY.DEF" /OUT:$(OUTDIR)\"krusty.dll"\ + /IMPLIB:$(OUTDIR)/"CGKRUSTY.lib" +DEF_FILE=.\CGKRUSTY.DEF +LINK32_OBJS= \ + $(INTDIR)/CGKRUSTY.OBJ \ + $(INTDIR)/CGINPUT.OBJ + +$(OUTDIR)\krusty.dll : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + copy $(OUTDIR)\krusty.dll krusty.dll + +!ELSEIF "$(CFG)" == "Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "debug" +# PROP BASE Intermediate_Dir "debug" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "debug" +# PROP Intermediate_Dir "debug" +OUTDIR=.\debug +INTDIR=.\debug + +ALL : $(OUTDIR)\krusty.dll $(OUTDIR)/CGKRUSTY.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE CPP /nologo /MT /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /MT /W3 /GX /Zi /YX /Od /I "..\..\inc" /I ".\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /c +# SUBTRACT CPP /Fr +CPP_PROJ=/nologo /MT /W3 /GX /Zi /YX /Od /I "..\..\inc" /I ".\include" \ + /D "WIN32" /D "STRICT" /D "_DEBUG" /D "_WINDOWS"\ + /Fp$(OUTDIR)/"CGKRUSTY.pch" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"CGKRUSTY.pdb" /c +CPP_OBJS=.\debug/ +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +BSC32_SBRS= \ + +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"CGKRUSTY.bsc" + +$(OUTDIR)/CGKRUSTY.bsc : $(OUTDIR) $(BSC32_SBRS) +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /NOLOGO /SUBSYSTEM:windows,4.0 /DLL /DEBUG /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /NOLOGO /SUBSYSTEM:windows,4.0 /DLL /INCREMENTAL:no /DEBUG /MACHINE:I386 /OUT:$(OUTDIR)\"krusty.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /NOLOGO\ + /SUBSYSTEM:windows,4.0 /DLL /INCREMENTAL:no /PDB:$(OUTDIR)/"CGKRUSTY.pdb" /DEBUG\ + /MACHINE:I386 /DEF:".\CGKRUSTY.DEF" /OUT:$(OUTDIR)\"krusty.dll"\ + /IMPLIB:$(OUTDIR)/"CGKRUSTY.lib" +DEF_FILE=.\CGKRUSTY.DEF +LINK32_OBJS= \ + $(INTDIR)/CGKRUSTY.OBJ \ + $(INTDIR)/CGINPUT.OBJ + +$(OUTDIR)\krusty.dll : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + copy $(OUTDIR)\krusty.dll krusty.dll + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Group "Source Files" + +################################################################################ +# Begin Source File + +SOURCE=.\CGKRUSTY.CPP +DEP_CGKRU=\ + .\CGCHDLL.H\ + .\CGCHAR.H\ + .\CGTIMER.H\ + .\CGINPUT.H\ + .\CGUPDATE.H\ + .\CGACTION.H\ + .\CGGRAPH.H\ + .\INCLUDE\LINKLIST.H\ + .\CGSPRITE.H\ + .\CGLEVEL.H\ + .\CGSCREEN.H\ + .\CGBITBUF.H\ + .\CGDLIST.H\ + .\INCLUDE\CGDIB.H + +$(INTDIR)/CGKRUSTY.OBJ : $(SOURCE) $(DEP_CGKRU) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGKRUSTY.DEF +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGINPUT.CPP +DEP_CGINP=\ + .\CGINPUT.H + +$(INTDIR)/CGINPUT.OBJ : $(SOURCE) $(DEP_CGINP) $(INTDIR) + +# End Source File +# End Group +# End Project +################################################################################ diff --git a/sdk/samples/iklowns/cglevel.cpp b/sdk/samples/iklowns/cglevel.cpp new file mode 100644 index 0000000..25a9bd1 --- /dev/null +++ b/sdk/samples/iklowns/cglevel.cpp @@ -0,0 +1,886 @@ +/*===========================================================================*\ +| +| File: cglevel.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include <linklist.h> + +#include "cggraph.h" +#include "cglevel.h" +#include "cgtimer.h" +#include "cgchdll.h" +#include "cgchrint.h" +#include "strrec.h" +#include "cginput.h" +#include "cgchar.h" +#include "cgimage.h" +#include "cgmidi.h" +#include "cgremote.h" +#include "cgsound.h" +#include "cgglobl.h" +#include "cgtext.h" +#include "cgrsrce.h" + +void dbgprintf(char *fmt,...); + +extern LPSTR NewStringResource( + HINSTANCE hInst, + int idString +); +extern void GetRectFromProfile(RECT &, LPSTR, LPSTR, LPSTR); + +extern CGameTimer * Timer; +static RECT WholeScreen = { 0,0,SCREEN_WIDTH,SCREEN_HEIGHT }; +HDC LoadBitmapFile ( + LPSTR pBitmapFile +); +#define BASE_HWND ghMainWnd + +/*---------------------------------------------------------------------------*\ +| +| Class CGameLevel +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ + +// this is ONLY for the Klown; it must match the corresponding entry in cgkrusty.cpp +typedef struct +{ + int curState; + int LastMouseX; + int LastMouseY; + DWORD timeLastUpdate; + int HitsLeft; + int pushedState; + CGameCharacter * myPie; + int type; // 0 = main; 1=computer; 2= second; + int IGotKilled; +} KLOWN_DATA; +extern int gGameMode; +CGameLevel::CGameLevel( + char *pFileName, + TCHAR * pLevelName, + CGameTimer* pTimer, + CGameInput* pInput, + CGameScreen* pScreen + ) : mpGraphics( NULL ), + mpTimer( pTimer ), + mpInput( pInput ), + mpScreen( pScreen ), + mOffsetX( 0 ), + mOffsetY( 0 ), + mFrameTime( 0 ), + mpGraphicsKey( NULL ), + mFastKlown( FALSE ), + mpProfile( NULL ) +{ + char DllList[256]; + + mMainKlown = NULL; + // first scan internal table of characters: + LoadCharInfo( NULL ); + // Grab info from the GAM file; look for character DLLs and load them... + lstrcpy(DllList, ""); + GetPrivateProfileString("General", "DLLS", "", DllList, 255, pFileName); + if (strlen(DllList) > 0) + { + CStringRecord crec(DllList, ","); + int x; + char dlldir[260]; + char *p; + + lstrcpy( dlldir, pFileName ); + p = strrchr( dlldir, '/' ); + if ( p == NULL ) + p = strrchr( dlldir, '\\' ); + if ( p != NULL ) + lstrcpy( p + 1, "*.dll" ); + + + for (x=0; x<crec.GetNumFields(); x++) + { + LoadMyDLL(dlldir, crec[x]); + } + } + + MatchProfile(pFileName); + + char prof[256]; + + GetPrivateProfileString( + pLevelName, + mpProfile, + pLevelName, // default to level name + prof, + sizeof(prof), + pFileName + ); + + pLevName = new char [lstrlen(prof)+1]; + lstrcpy(pLevName, prof); + + pFilName = new char [lstrlen(pFileName)+1]; + lstrcpy(pFilName, pFileName); + + // Load up any sound effects that are designated as preload. + char SoundList[255]; + GetPrivateProfileString(pLevName, "PreloadSounds", "", SoundList, sizeof(SoundList) + , pFileName); + if (strlen(SoundList) > 0) + { + CStringRecord crec(SoundList, ","); + for (int x=0; x<crec.GetNumFields(); x++) + { + new CSoundEffect(crec[x], 0, FALSE, gSoundMode); + } + } + + // init + mMaxWorldX = GetPrivateProfileInt(pLevName, "WorldX", SCREEN_HEIGHT, pFileName) / 2; + mMaxWorldY = GetPrivateProfileInt(pLevName, "WorldY", SCREEN_WIDTH, pFileName) / 2; + + mOffsetX = GetPrivateProfileInt(pLevName, "StartX", 0, pFileName); + mOffsetY = GetPrivateProfileInt(pLevName, "StartY", 0, pFileName); + + // now create the characters as needed + SetCurrentLevel(this); + + { + + // set the screen's palette + char paletteFile[256]; + GetPrivateProfileString( + pLevName, + "Palette", + "", + paletteFile, + sizeof( paletteFile ), + pFileName + ); + pScreen->SetPalette( paletteFile ); + } + + char graphicsName[256]; + GetPrivateProfileString( + pLevName, + "Graphics", + "", + graphicsName, + sizeof( graphicsName ), + pFileName + ); + + // keep a copy of the section name + mpGraphicsKey = new char[lstrlen(graphicsName)+1]; + lstrcpy( mpGraphicsKey, graphicsName ); + + mpGraphics = new CGameDisplayList(pFileName, graphicsName, this); + + // Add computer opponent(s), second klown, if needed: + mGameType = gGameMode; + mNumComputerKlowns = + mGameType == 0 ? + 1 : + 0 ; + memset(&mComputerKlowns[0], 0, sizeof(mComputerKlowns)); + GetPrivateProfileString("General", "RoboKlown", "", DllList, sizeof(DllList), pFileName); + int posx, posy; + mMainKlown->GetXY(&posx, &posy); + for (int x=0; x<mNumComputerKlowns; x++) + { + // create new klown, computer generated + mComputerKlowns[x] = new CGameCharacter(pFileName, DllList, graphicsName, this, + mMainKlown->GetMinZ(), + mMainKlown->GetMaxZ(), posx + mMainKlown->GetCurWidth() * 2, + posy, NULL); + + if (mComputerKlowns[x]) + { + mpGraphics->Insert(mComputerKlowns[x]); + KLOWN_DATA *data = (KLOWN_DATA *) mComputerKlowns[x]->mpPrivateData; + if (data) + data->type = 1; // computer opponent; + } + } + + // if playing other person on same machine, create opponent; + if (mGameType == 1) + { + // create second klown + GetPrivateProfileString("General", "SecondKlown", "", DllList, sizeof(DllList), pFileName); + mSecondKlown = new CGameCharacter(pFileName, DllList, graphicsName, this, + mMainKlown->GetMinZ(), + mMainKlown->GetMaxZ(), posx + mMainKlown->GetCurWidth() * 2 , posy, NULL); + + if (mSecondKlown) + { + mpGraphics->Insert(mSecondKlown); + KLOWN_DATA *data = (KLOWN_DATA *) mSecondKlown->mpPrivateData; + if (data) + data->type = 2; // second (human) opponent; + } + + } + else + mSecondKlown = NULL; + + mpUpdateList = new CGameUpdateList; + mpUpdateList->AddRect(WholeScreen); +} + +CGameCharacter * CGameLevel::Add ( + char *name, + int curz, + int curx, + int cury, + void *pNewObjID) +{ + CGameCharacter * newchar; + + if (mpGraphics == NULL) + return(NULL); + + newchar = new CGameCharacter(pFilName, name, mpGraphicsKey, this, curz, curz, curx, cury, pNewObjID); + if (newchar) + { + mpGraphics->Insert(newchar); + } + return(newchar); +} + +CGameLevel::~CGameLevel( ) +{ + delete[] mpProfile; + delete mpGraphics; + delete pLevName; + delete pFilName; + delete mpGraphicsKey; + delete mpUpdateList; +} + +BOOL gameover = FALSE; +BOOL quit = FALSE; +BOOL showing = FALSE; +BOOL showFrameRate = FALSE; +void CGameLevel::GameOver() +{ + gameover = TRUE; +} + +void +CGameLevel::StopAnimating() +{ + showing = FALSE; +} + +void CGameLevel::Animate( + HWND hwndParent, + CGameScreen * pScreen + ) +{ + SetCapture( hwndParent ); // so we get mouse clicks + + // turn off the cursor + HCURSOR hOldCursor = SetCursor( NULL ); + +// pScreen->SetMode( SCREEN_WIDTH, SCREEN_HEIGHT, 8 ); + + showing = TRUE; + MSG msg; + + Timer->Time = timeGetTime(); // * 60 / 1000; + + UINT lastTime = Timer->Time; + mFrameTime = lastTime; + UINT elapsed = 0; + +#define DEBOUNCE_FRAMES 12 + static int debounceF2 = 0; + static int debounceF3 = 0; + static int debounceF5 = 0; + static int debounceF9 = 0; + +#define FRAMERATE + +#define SCORE_WIDTH 64 +#define SCORE_HEIGHT 64 + + CGameDSBitBuffer* pScoreFrameBufferLeft; + CGameDSBitBuffer* pScoreFrameBufferRight; + + HDC hdcWindow = GetDC(hwndParent); + HDC hdcScoreLeft = CreateCompatibleDC(hdcWindow); + HDC hdcScoreRight = CreateCompatibleDC(hdcWindow); + ReleaseDC(hwndParent, hdcWindow); + + pScoreFrameBufferLeft = new CGameDSBitBuffer( SCORE_WIDTH, SCORE_HEIGHT); + pScoreFrameBufferRight = new CGameDSBitBuffer( SCORE_WIDTH, SCORE_HEIGHT); + SelectObject(hdcScoreLeft, pScoreFrameBufferLeft->GetHBitmap()); + SelectObject(hdcScoreRight, pScoreFrameBufferRight->GetHBitmap()); + SetBkMode(hdcScoreLeft, TRANSPARENT); + SetBkMode(hdcScoreRight, TRANSPARENT); + + // set up our cool font + LOGFONT logFont; + HANDLE hFont; + memset(&logFont, 0, sizeof(LOGFONT)); + logFont.lfHeight = SCORE_HEIGHT; //maxHeight; + logFont.lfPitchAndFamily = FF_ROMAN; + hFont = CreateFontIndirect(&logFont); + SelectObject(hdcScoreLeft, hFont); + SetTextColor(hdcScoreLeft, PALETTEINDEX(4)); + + SelectObject(hdcScoreRight, hFont); + SetTextColor(hdcScoreRight, PALETTEINDEX(4)); + + int lastScoreLeft = -1; + int lastScoreRight = -1; + +#ifdef FRAMERATE +#define FR_WIDTH 32 +#define FR_HEIGHT 32 + + UINT frames = 0; + UINT frameTime = timeGetTime(); + + // create a memory bitmap for our frame text + CGameDSBitBuffer* pFrameBuffer; + + HDC hdc = GetDC( hwndParent ); + HDC hdcFrame = CreateCompatibleDC( hdc ); + + pFrameBuffer = new CGameDSBitBuffer( FR_WIDTH, FR_HEIGHT); + SelectObject( hdcFrame, pFrameBuffer->GetHBitmap() ); + // set up our cool font + LOGFONT logFont2; + HANDLE hFont2; + memset(&logFont2, 0, sizeof(LOGFONT)); + logFont2.lfHeight = FR_HEIGHT; //maxHeight; + logFont2.lfPitchAndFamily = FF_ROMAN; + hFont2 = CreateFontIndirect(&logFont2); + SelectObject(hdcFrame, hFont2); + SetTextColor(hdcFrame, COLOR_RED); + SetBkMode(hdcFrame, TRANSPARENT); + + memset(pFrameBuffer->GetBits(), 1, FR_WIDTH * FR_HEIGHT); + TextOut( hdcFrame, 0,0, "30", 2 ); + + frames = 0; +#endif // FRAMERATE + + Timer->Resume(); + if (gMusicOn) + { + resumeMusic(); + } +#ifndef DEBUG + HANDLE hprocess; + hprocess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId()); + SetPriorityClass(hprocess, HIGH_PRIORITY_CLASS ); + CloseHandle(hprocess); +#endif + + while ( showing ) { + Timer->Time = timeGetTime(); + UINT time = Timer->Time; + + if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE | PM_NOYIELD ) ) { + TranslateMessage(&msg); + + if ((msg.message == WM_ACTIVATEAPP) && + (LOWORD(msg.wParam) == WA_INACTIVE)) + { + showing = FALSE; + DispatchMessage(&msg); + continue; + } + else + DispatchMessage(&msg); + } + + if (mpInput->GetKeyboard(VK_ESCAPE) || + mpInput->GetKeyboard(VK_F12)) + { + showing = FALSE; + if (!mpInput->GetKeyboard(VK_CONTROL)) + { + quit = TRUE; + } + continue; + } + + // toggles need to be debounced + if (mpInput->GetKeyboard(VK_F2) && (debounceF2 == 0)) + { + // mute! + gMusicOn = !gMusicOn; + if (gMusicOn) + { + resumeMusic(); + } else { + pauseMusic(); + } + debounceF2 = DEBOUNCE_FRAMES; + } + + if (debounceF2) + --debounceF2; + + if (mpInput->GetKeyboard(VK_F3) && (debounceF3 == 0)) + { + extern BOOL gbQuiet; + SetSilence(!gbQuiet); + debounceF3 = DEBOUNCE_FRAMES; + } + if (debounceF3) + --debounceF3; + + if (mpInput->GetKeyboard(VK_F9) && (debounceF9 == 0)) + { + mFastKlown = !mFastKlown; + debounceF9 = DEBOUNCE_FRAMES; + } + + if (debounceF9) + --debounceF9; + +#ifdef FRAMERATE + if (mpInput->GetKeyboard(VK_F5) && (debounceF5 == 0)) + { + showFrameRate = !showFrameRate; + debounceF5 = DEBOUNCE_FRAMES; + } + + if (debounceF5) + --debounceF5; +#endif + + lastTime = time; + + // If we are playing a network game, we + // poll here synchronously for the remote network activity + { + extern void PollForRemoteReceive( void ); + + if ( mGameType > 1 ) { + PollForRemoteReceive(); + } + } + + // !!! if we want to limit our framerate, put a check here for elapsed time + { + mFrameTime = time; + + // let each object update position, get input, etc + mpGraphics->Update(this, mpUpdateList); + + // let each object render its graphical image + mpGraphics->Render(this, pScreen, mpUpdateList); + mpUpdateList->Clear(); + + // get the correct score to show... there is always at least *one* + KLOWN_DATA * pKlown; + RECT score_rect; + char scorebuf[5]; + pKlown = (KLOWN_DATA *) mMainKlown->mpPrivateData; + + score_rect.left = 10; + score_rect.right = 10+SCORE_WIDTH; + score_rect.top = 10; + score_rect.bottom = 10+SCORE_HEIGHT; + mpUpdateList->AddRect(score_rect); + + if (pKlown->HitsLeft != lastScoreLeft) + { + lastScoreLeft = pKlown->HitsLeft; + + wsprintf(scorebuf, "%d", pKlown->HitsLeft); + + memset(pScoreFrameBufferLeft->GetBits(), 1, SCORE_WIDTH * SCORE_HEIGHT); + + TextOut(hdcScoreLeft, 0, 0, scorebuf, lstrlen(scorebuf)); + } + pScreen->TransRender(10,10,SCORE_WIDTH, SCORE_HEIGHT, + pScoreFrameBufferLeft,0,0); + + switch (mGameType) + { + case 0: // against computer + pKlown = (KLOWN_DATA *) mComputerKlowns[0]->mpPrivateData; + break; + + case 1: + pKlown = (KLOWN_DATA *) mSecondKlown->mpPrivateData; + break; + + default: + pKlown = NULL; + break; + } + if (pKlown != NULL) + { + score_rect.left = SCREEN_WIDTH -10 - SCORE_WIDTH; + score_rect.right = SCREEN_WIDTH -10; + mpUpdateList->AddRect(score_rect); + + if (pKlown->HitsLeft != lastScoreRight) + { + lastScoreRight = pKlown->HitsLeft; + wsprintf(scorebuf, "%d", pKlown->HitsLeft); + memset(pScoreFrameBufferRight->GetBits(), 1, + SCORE_WIDTH * SCORE_HEIGHT); + TextOut(hdcScoreRight, 0, 0, scorebuf, lstrlen(scorebuf)); + } + pScreen->TransRender(SCREEN_WIDTH -10-SCORE_WIDTH,10, + SCORE_WIDTH, SCORE_HEIGHT, + pScoreFrameBufferRight,0,0); + } + +#ifdef FRAMERATE + if (showFrameRate) + { + ++frames; + UINT newTime = timeGetTime(); + UINT dTime = newTime - frameTime; + if (dTime >= 1000 ) + { + char buf[4]; + + memset(pFrameBuffer->GetBits(), 1, FR_WIDTH * FR_HEIGHT); + wsprintf(buf, "%d", frames / (dTime / 1000) ); + TextOut( hdcFrame, 0,0, buf, lstrlen(buf) ); + + frames = 0; + frameTime = newTime; + } + pScreen->TransRender( + 320 - (FR_WIDTH >> 1), + 10, + FR_WIDTH, + FR_HEIGHT, + pFrameBuffer, + 0, + 0 + ); + } + else + { + // keep frametime updated + frameTime = time; + } +#endif // FRAMERATE + + // update the screen + pScreen->PageFlip(); + mpInput->UpdateJoystick(); + + if (gameover) + { + RECT rect; + char tempstring[20]; + pKlown = (KLOWN_DATA *) mMainKlown->mpPrivateData; + + Sleep(2000); + + GetPrivateProfileString( pLevName, "WinLose", "end.bmp", tempstring, 19, pFilName); + + CGameDIB * myDib = new CGameDIB(tempstring); + CGameDSBitBuffer * myBuf = new CGameDSBitBuffer(myDib); + + if (myBuf) + { + RECT rectdtop; + + HDC hdcWindow = GetDC(hwndParent); + HDC hdc = CreateCompatibleDC(hdcWindow); + ReleaseDC(hwndParent, hdcWindow); + + rectdtop.left = 0; + rectdtop.right = SCREEN_WIDTH; + rectdtop.top = 0; + rectdtop.bottom = SCREEN_HEIGHT; + mpUpdateList->AddRect(rectdtop); + + SelectObject(hdc, myBuf->GetHBitmap()); + // make the gameover bitmap fill current screen + rect = rectdtop; + + CGameText * pCtext = new CGameText (hdc, &rect, 12,1); + + if (pCtext) + { + int ix, ixend; + pKlown = (KLOWN_DATA *) mMainKlown->mpPrivateData; + pKlown->curState = 0; + + ix = pKlown->IGotKilled ? IDS_LOSE_START : IDS_WIN_START; + ixend = pKlown->IGotKilled ? IDS_LOSE_END : IDS_WIN_END; + // load strings... + while (ix <= ixend) + { + char *pChoice = NewStringResource(ghInst, ix); + pCtext->AddLine(pChoice, COLOR_YELLOW); + ++ix; + } + + // Overlay text on bitmap + pCtext->TextBlt(); + delete pCtext; + } + + // + // Display option screen! + pScreen->Render( + 0, + 0, + SCREEN_WIDTH, + SCREEN_HEIGHT, + myBuf, + 0, + 0, + SRCCOPY + ); + + pScreen->PageFlip(); + Sleep(5000); + pScreen->PageFlip(); + DeleteDC(hdc); + delete myBuf; + } + delete myDib; + + // reset igotkilled flag... + pKlown->IGotKilled = 0; + if (mComputerKlowns[0]) + { + pKlown = (KLOWN_DATA *) mComputerKlowns[0]->mpPrivateData; + if (pKlown) + { + pKlown->curState = 0; + pKlown->IGotKilled = 0; + } + + } + if (mSecondKlown) + { + pKlown = (KLOWN_DATA *) mSecondKlown->mpPrivateData; + if (pKlown) + { + pKlown->curState = 0; + pKlown->IGotKilled = 0; + } + } + + gameover = FALSE; + lastScoreLeft = lastScoreRight = -1; + } // if (gameover) + } // limit block + } // while + + Timer->Pause(); + SetCursor( hOldCursor ); + ReleaseCapture( ); + + if (gMusicOn) + { + pauseMusic(); + } +#ifndef DEBUG + hprocess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId()); + SetPriorityClass(hprocess, IDLE_PRIORITY_CLASS ); + CloseHandle(hprocess); +#endif + +#ifdef FRAMERATE + DeleteDC( hdcFrame ); + DeleteObject(hFont2); + delete pFrameBuffer; +#endif + + DeleteDC( hdcScoreLeft ); + DeleteDC( hdcScoreRight ); + + DeleteObject(hFont); + delete pScoreFrameBufferLeft; + delete pScoreFrameBufferRight; + + ReleaseDC( hwndParent, hdc ); + + if (quit) + PostQuitMessage(0); +} + +void CGameLevel::ForceOnScreen(int *x, int *y, int wide, int high, BOOL primary) +{ + // if the x or y coords are off screen: + // 1) force screen to be there - unless + // 2) the coords are impossible, then adjust them! + +#define ROUGH_WIDTH 96 + // keep main char in center of screen + static RECT center = + { + SCREEN_WIDTH / 4, + 0, + SCREEN_WIDTH - (SCREEN_WIDTH / 4) - ROUGH_WIDTH, + SCREEN_HEIGHT + + }; + + if (*x < -mMaxWorldX) + *x = -mMaxWorldX; + else + { + if (*x > (mMaxWorldX-wide)) + *x = mMaxWorldX-wide; + } + + if (*y < -mMaxWorldY) + *y = -mMaxWorldY; + else + { + if (*y > (mMaxWorldY-wide)) + *y = mMaxWorldY-wide; + } + + if (primary) + { + if ((*x < Screen2WorldX(center.left)) && (mOffsetX > -mMaxWorldX)) + { + mOffsetX = max(-mMaxWorldX, mOffsetX - (Screen2WorldX(center.left) - *x)); + mpUpdateList->AddRect(WholeScreen); + } + else + { + if ((*x > Screen2WorldX(center.right)) && (mOffsetX < (mMaxWorldX-SCREEN_WIDTH))) + { + mOffsetX = min((mMaxWorldX-SCREEN_WIDTH), mOffsetX + (*x - Screen2WorldX(center.right))); + mpUpdateList->AddRect(WholeScreen); + } + } + + if ((*y < Screen2WorldY(center.top)) && (mOffsetY > -mMaxWorldY)) + { + mOffsetY = max(-mMaxWorldY, mOffsetY - (Screen2WorldY(center.top) - *y)); + mpUpdateList->AddRect(WholeScreen); + } + else + { + if ((*y > Screen2WorldY(center.bottom)) && (mOffsetY < (mMaxWorldY-SCREEN_HEIGHT))) + { + mOffsetY = min((mMaxWorldY-SCREEN_HEIGHT), mOffsetY + (*y - Screen2WorldY(center.bottom))); + mpUpdateList->AddRect(WholeScreen); + } + } + } +} + +void +CGameLevel::MatchProfile( + char* pGamFile + ) +{ + static char* pDefault = "Default"; + char profBuf[256]; + char dataBuf[256]; + + // first check to see if we need to force a given profile + GetPrivateProfileString( + "General", + "ForceProfile", + "", // no default + profBuf, + sizeof( profBuf ), + pGamFile + ); + + if (lstrlen(profBuf) >0) + { + mpProfile = new char[lstrlen(profBuf)+1]; + lstrcpy( mpProfile, profBuf ); + } + else + { + GetPrivateProfileString( + "Profiles", + NULL, // get all + "", // no default + profBuf, + sizeof( profBuf ), + pGamFile + ); + + + for (char *pChar = profBuf; *pChar; pChar++) + { + GetPrivateProfileString( + "Profiles", + pChar, + "", + dataBuf, + sizeof( dataBuf ), + pGamFile + ); + + // parse the data string into fields + CStringRecord fields( dataBuf, "," ); + + MC_PROCESSOR processor = (MC_PROCESSOR) atoi(fields[0]); + MC_BUSTYPE bus = (MC_BUSTYPE) atoi(fields[1]); + + // memory fields are in megabytes + DWORD sysMem = atoi(fields[2]) * 1024 * 1024; + DWORD vidMem = atoi(fields[3]) * 1024 * 1024; + + MC_VIDSYS vidSys = (MC_VIDSYS) atoi(fields[4]); + + if ((gMachineCaps.processor >= processor) && + (gMachineCaps.bus >= bus) && + (gMachineCaps.sysMemory >= sysMem) && + (gMachineCaps.vidMemory >= vidMem) && + (gMachineCaps.vidSystem >= vidSys)) + { + mpProfile = new char[lstrlen(pChar)+1]; + lstrcpy( mpProfile, pChar ); + break; + } + + pChar += lstrlen( pChar ); // move beyond terminator + } + + // if we didn't find it, use default + if (mpProfile == NULL) + { + mpProfile = new char[lstrlen(pDefault)+1]; + lstrcpy( mpProfile, pDefault ); + } + } +} diff --git a/sdk/samples/iklowns/cglevel.h b/sdk/samples/iklowns/cglevel.h new file mode 100644 index 0000000..a063ff1 --- /dev/null +++ b/sdk/samples/iklowns/cglevel.h @@ -0,0 +1,228 @@ +/*===========================================================================*\ +| +| File: cglevel.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef CGLEVEL_H +#define CGLEVEL_H + +#include "cgdlist.h" + +// We use millisecond timing values; our velocity is specified in +// units of (pixels/256) per millisecond +// This macro converts a velocity and elapsed milliseconds into sub-pixels +#define SUBPIXEL_DELTA( vel, ms ) (vel * ms) + +class CGameTimer; +class CGameInput; +class CGameScreen; +class CGameGraphic; +class CGameCharacter; + +class CGameLevel +{ +public: + CGameLevel( + char* pFileName, + char* pLevelName, + CGameTimer* pTimer, + CGameInput* pInput, + CGameScreen* pScreen + ); + + virtual ~CGameLevel(); + + virtual void Animate(HWND, CGameScreen* pScreen); + + virtual int GetOffsetX() + { + return mOffsetX; + } + + virtual int GetOffsetY() + { + return mOffsetY; + } + + virtual int GetMaxX() + { + return mMaxWorldX; + } + + virtual int GetMaxY() + { + return mMaxWorldY; + } + + virtual int Screen2WorldX( int screenX ) + { + return screenX + mOffsetX; + }; + + virtual int Screen2WorldY( int screenY ) + { + return screenY + mOffsetY; + }; + + virtual int World2ScreenX( int worldX ) + { + return worldX - mOffsetX; + }; + + virtual int World2ScreenY( int worldY ) + { + return worldY - mOffsetY; + }; + + virtual int Screen2WorldX( int screenX, int parallax ) + { + return screenX + (mOffsetX >> parallax); + }; + + virtual int Screen2WorldY( int screenY, int parallax ) + { + return screenY + (mOffsetY >> parallax); + }; + + virtual int World2ScreenX( int worldX, int parallax ) + { + return worldX - (mOffsetX >> parallax); + }; + + virtual int World2ScreenY( int worldY, int parallax ) + { + return worldY - (mOffsetY >> parallax); + }; + + virtual void SetOffsetX(int newx) + { + if ((newx >= 0) && (newx <= mMaxWorldX)) + mOffsetX = newx; + } + + virtual void SetOffsetY(int newy) + { + if ((newy >= 0) && (newy <= mMaxWorldY)) + mOffsetY = newy; + } + + virtual void ForceOnScreen(int *x, int *y, int wide, int high, BOOL primary=TRUE); + + virtual CGameTimer* GetTimer() + { + return mpTimer; + } + + virtual CGameInput* GetInput() + { + return mpInput; + } + + virtual CGameScreen* GetScreen() + { + return mpScreen; + } + + virtual CGameCharacter * Add(char *name, int curz, + int curx=0, int cury=0, + void *pObjID=NULL); + + virtual void Remove(CGameGraphic * stale) + { + if (stale != NULL) + mpGraphics->Remove(stale); + } + + virtual void AddInvalidRect( LPRECT rect) + { + if (mpUpdateList) + mpUpdateList->AddRect(*rect); + } + + virtual char *GetLevelName() + { + return (pLevName); + } + + virtual char *GetProfileName() + { + return (pFilName); + } + + virtual char *GetSectionName() + { + return (pLevName); + } + + virtual int GetFrameTime() + { + return mFrameTime; + } + + virtual void GameOver(); + virtual void StopAnimating(); + virtual void ReSort() + { + mpGraphics->ReSort(); + } + + // members which let us access the game type and main characters directly + // from within the DLL + int mGameType; + int mNumComputerKlowns; + CGameCharacter *mMainKlown; // always the main player + CGameCharacter *mComputerKlowns[4]; // always the computer-generated klown(s) + CGameCharacter *mSecondKlown; // second players' klown + BOOL mFastKlown; + +protected: + // a level keeps a linked list of display objects, sorted in z-order + CGameDisplayList* mpGraphics; // our set of display objects + CGameUpdateList * mpUpdateList; + + int mMaxWorldX; // maximum x pixel value in our world + int mMaxWorldY; // maximum y pixel value in our world + + int mOffsetX; // current offset of screen within world + int mOffsetY; // current offset of screen within world + + int mFrameTime; // time at beginning of current frame + + CGameTimer* mpTimer; // ptr to the game's timer + CGameInput* mpInput; // ptr to the game's input object + CGameScreen* mpScreen; // ptr to the game's screen object + + char *pLevName; + char *pFilName; + char *mpGraphicsKey; // the .gam file section for our graphics list + + char* mpProfile; + + void MatchProfile( char* pFileName ); +}; + +#endif // CGLEVEL_H diff --git a/sdk/samples/iklowns/cgload.cpp b/sdk/samples/iklowns/cgload.cpp new file mode 100644 index 0000000..c09a527 --- /dev/null +++ b/sdk/samples/iklowns/cgload.cpp @@ -0,0 +1,187 @@ +/*===========================================================================*\ +| +| File: cgoption.cpp +| +| Description: +| Routines to display lines of text (from resource strings) overlayed on +| a bitmap. The text will be sized appropriately to fit within the +| rectangle specified in the profile. The user may hilight a particular +| line and the index of the line will be returned to the caller. +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include "cgglobl.h" +#include "strrec.h" +#include "cgdib.h" +#include "cgscreen.h" +#include "cgmidi.h" +#include "cgsound.h" +#include "cgload.h" +#include "cgimage.h" + +#define BASE_HWND ghMainWnd + +extern HDC LoadBitmapFile (LPSTR pBitmapFile); +extern LPSTR NewStringResource( HINSTANCE hInst, int idString); + +// ---------------------------------------------------------- +// CLoadingScreen - +// ---------------------------------------------------------- +CLoadingScreen::CLoadingScreen( + CGameScreen* pScreen, + LPSTR pBitmapName, // bkgrnd bitmap + int iTextId, // resource text to overlay + POINT pt, // location of circle + TXTCOLOR color, // color of overlay texxt + RECT rect, + CSoundEffect *pSoundStart, // sound effect to play + CSoundEffect *pSoundUpdate, // sound effect to play + CSoundEffect *pSoundEnd, // sound effect to play + LPSTR MidiFile +) : pText( NULL ), + mpLoadBuffer( NULL ), + mpScreen( pScreen ) +{ + HBRUSH hBrush; + + HDC hdcScreen = GetDC(BASE_HWND); + ShowCursor(FALSE); + PatBlt(hdcScreen, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, BLACKNESS); + + hdcLoading = CreateCompatibleDC(hdcScreen); + + CLoadingScreen::pSoundStart = pSoundStart; + CLoadingScreen::pSoundUpdate = pSoundUpdate; + CLoadingScreen::pSoundEnd = pSoundEnd; + + if ((MidiFile != NULL) && (gMusicOn)) + { + playMusic(MidiFile, TRUE); + } + + CGameDIB loadDIB( pBitmapName ); + mWidth = loadDIB.GetWidth(); + mHeight = loadDIB.GetHeight(); + mpLoadBuffer = new CGameDSBitBuffer( &loadDIB ); + + // Load the bitmap + if (mpLoadBuffer) + { + SelectObject(hdcLoading, mpLoadBuffer->GetHBitmap()); + + hBrush = CreateSolidBrush(COLOR_YELLOW); + SelectObject(hdcLoading, hBrush); + SetBkMode(hdcLoading, TRANSPARENT); + + if (pSoundStart != NULL) + { + pSoundStart->Play(); + } + + Origin = pt; + + // Create text to be overlayed + pText = new CGameText(hdcLoading, &rect, 1, 1); + pText->AddLine(NewStringResource(ghInst, iTextId) + , color.main, color.shadow); + +// Don't display initially, 'cause palette ain't right yet. +#if 0 + pText->TextBlt(); + mpScreen->Render(0,0, mWidth, mHeight, mpLoadBuffer, 0, 0, SRCCOPY); + mpScreen->PageFlip(); +#endif + } + + ReleaseDC(BASE_HWND, hdcScreen); + curTotal = 0; +} + +#define MIN_RADIUS 5 +// ---------------------------------------------------------- +// Update - +// ---------------------------------------------------------- +void CLoadingScreen::Update( + int Increment +) +{ + int radius; + RECT rect; + + curTotal += Increment; + radius = curTotal; + + rect.left = Origin.x - radius; + rect.top = Origin.y - radius; + rect.right = Origin.x + radius; + rect.bottom = Origin.y + radius; + + Ellipse(hdcLoading, rect.left, rect.top, rect.right, rect.bottom); + pText->TextBlt(); + mpScreen->Render(0,0, mWidth, mHeight, mpLoadBuffer, 0, 0, SRCCOPY); + mpScreen->PageFlip(); + +} + +// ---------------------------------------------------------- +// Paint +// ---------------------------------------------------------- +void CLoadingScreen::Paint() +{ + mpScreen->Render(0,0, mWidth, mHeight, mpLoadBuffer, 0, 0, SRCCOPY); + mpScreen->PageFlip(); +} + +// ---------------------------------------------------------- +// ~CLoadingScreen - +// ---------------------------------------------------------- +CLoadingScreen::~CLoadingScreen() +{ + closeMusic(); + + delete pText; + + if (pSoundStart != NULL) + { + delete pSoundStart; + } + if (pSoundUpdate != NULL) + { + delete pSoundUpdate; + } + + RECT rect = {0,0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1}; + mpScreen->ColorFill(&rect, 0); + mpScreen->PageFlip(); + + if (pSoundEnd != NULL) + { + pSoundEnd->Play(); + } + + DeleteDC( hdcLoading ); + delete mpLoadBuffer; + ShowCursor(TRUE); +} diff --git a/sdk/samples/iklowns/cgload.h b/sdk/samples/iklowns/cgload.h new file mode 100644 index 0000000..c7fb539 --- /dev/null +++ b/sdk/samples/iklowns/cgload.h @@ -0,0 +1,77 @@ +/*===========================================================================*\ +| +| File: cgload.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef _CGLOAD_H +#define _CGLOAD_H + +#include "cgsound.h" +#include "cgtext.h" + +class CGameScreen; +class CGameDSBitBuffer; + +typedef struct _TXTCOLOR { + COLORREF main; + COLORREF shadow; +} TXTCOLOR; + +class CLoadingScreen { +private: + POINT Origin; + int curTotal; +// HDC hdcScreen; + HDC hdcLoading; + CGameText *pText; + CSoundEffect *pSoundStart; + CSoundEffect *pSoundUpdate; + CSoundEffect *pSoundEnd; + CGameScreen *mpScreen; + CGameDSBitBuffer *mpLoadBuffer; + int mWidth; + int mHeight; + +public: + + CLoadingScreen( + CGameScreen* pScreen, + LPSTR pBitmapName, + int StringId, + POINT pt, + TXTCOLOR color, + RECT rect, + CSoundEffect *pSoundStart=NULL, + CSoundEffect *pSoundUpdate=NULL, + CSoundEffect *pSoundEnd=NULL, + LPSTR MidiFile=NULL + ); + ~CLoadingScreen(); + void Update(int Increment=5); + void Paint(); +}; + +#endif diff --git a/sdk/samples/iklowns/cgmidi.cpp b/sdk/samples/iklowns/cgmidi.cpp new file mode 100644 index 0000000..3f1939a --- /dev/null +++ b/sdk/samples/iklowns/cgmidi.cpp @@ -0,0 +1,783 @@ +/*===========================================================================*\ +| +| File: cgmidi.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include "cgmidi.h" +#include "MDSPlay.H" + + +#define FOURCC_MIDS mmioFOURCC('M','I','D','S') +#define FOURCC_fmt mmioFOURCC('f','m','t',' ') +#define FOURCC_data mmioFOURCC('d','a','t','a') + +// Format of structs within a MDS file +// +// 'fmt ' chunk +// +#define MDS_F_NOSTREAMID 0x00000001 +typedef struct +{ + DWORD dwTimeFormat; // Low word == time format in SMF format + DWORD cbMaxBuffer; // Guaranteed max buffer size + DWORD dwFlags; +} MIDSFMT; + +// 'data' chunk buffer header +// +typedef struct +{ + DWORD tkStart; // Absolute tick offset at start of buffer + DWORD cbBuffer; // Bytes in this buffer +} MIDSBUFFER; + +// An image handle points to this +// + +#define MDSI_F_RESET 0x00000001L +#define MDSI_F_LOOP 0x00000002L +#define MDSI_F_PAUSED 0x00000004L + +#define FOURCC_MDSI mmioFOURCC('M','D','S','I') + +#define V_HIMAGE(x) \ + if (((MDSIMAGE*)x)->fccSig != FOURCC_MDSI) \ + return MDS_ERR_INVALHANDLE; + +typedef struct +{ + FOURCC fccSig; // MDS image handle signature + MIDSFMT fmt; // MDS file format header + PBYTE pbBufferAlloc; // All MIDIHDR's/buffers + HMIDISTRM hms; // MIDI stream if open + DWORD fdwImage; // Generic flags + DWORD cBuffers; // Total buffers + DWORD cBuffersInUse; // Buffers MMSYSTEM owns right now +} MDSIMAGE; + +DWORD ParseImage(MDSIMAGE* pImage, PBYTE pbImage, DWORD cbImage); +BOOL Decompress(LPMIDIHDR lpmhSrc, LPMIDIHDR lpmhDst); + +void FAR PASCAL midiCallback(HMIDISTRM hms, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2); + +#define MDS_F_IMAGEFLAGS (MDS_F_MEMORY|MDS_F_FILENAME) + +// LoadMDSImage +// +// Allocate space for the handle structure MDSImage and get the +// image into memory if it's in a file. Call ParseImage to +// allocate buffers and parse the image into them. +// +DWORD LoadMDSImage(HANDLE *hImage, PBYTE pbImage, DWORD cbImage, DWORD fdw) +{ + DWORD dwRet = MDS_SUCCESS; + MDSIMAGE* pImage = NULL; + BOOL fIsMapped = FALSE; + HANDLE hInFile = INVALID_HANDLE_VALUE; + HANDLE hInFileMap = NULL; + + // Must have one of the two image flags + // + if ((!(fdw & MDS_F_IMAGEFLAGS)) || + ((fdw & MDS_F_IMAGEFLAGS) == MDS_F_IMAGEFLAGS)) + { + dwRet = MDS_ERR_BADFLAGS; + goto Load_Cleanup; + } + + // Allocate the handle + // + pImage = (MDSIMAGE*)LocalAlloc(LPTR, sizeof(MDSIMAGE)); + if (!pImage) + { + dwRet = MDS_ERR_NOMEM; + goto Load_Cleanup; + } + + pImage->fccSig = FOURCC_MDSI; + pImage->hms = NULL; + pImage->cBuffersInUse = 0; + + + + // Read the image if we need to + // + if (!(fdw & MDS_F_MEMORY)) + { + fIsMapped = TRUE; + + // Try to map the file as an image + // + hInFile = CreateFile( + (LPSTR)pbImage, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL); + + pbImage = NULL; + if (INVALID_HANDLE_VALUE == hInFile) + { + dwRet = MDS_ERR_NOFILE; + goto Load_Cleanup; + } + + cbImage = GetFileSize(hInFile, NULL); + + hInFileMap = CreateFileMapping( + hInFile, NULL, PAGE_READONLY, 0, 0, NULL); + if (NULL == hInFileMap) + { + dwRet = MDS_ERR_NOFILE; + goto Load_Cleanup; + } + + pbImage = (PBYTE)MapViewOfFile( + hInFileMap, FILE_MAP_READ, 0, 0, 0); + if (NULL == pbImage) + { + dwRet = MDS_ERR_NOFILE; + goto Load_Cleanup; + } + } + + // pbImage now points to the file image in memory. Attempt to parse it. + // + dwRet = ParseImage(pImage, pbImage, cbImage); + +Load_Cleanup: + if (dwRet) + { + if (pImage) LocalFree((HLOCAL)pImage); + } + else + { + *hImage = (HANDLE)pImage; + } + + if (fIsMapped) + { + if (NULL != pbImage) UnmapViewOfFile(pbImage); + if (NULL != hInFileMap) CloseHandle(hInFileMap); + if (INVALID_HANDLE_VALUE != hInFile) CloseHandle(hInFile); + } + + return dwRet; +} + +// Given the file image, allocate MIDI stream buffers and put the +// image data into them. The file image will go away when LoadMDSImage +// returns, so this routine must save all important info somewhere off +// the handle structure pImage. +// +DWORD ParseImage(MDSIMAGE* pImage, PBYTE pbImage, DWORD cbImage) +{ + DWORD dwRet = MDS_SUCCESS; + DWORD cbChk; + DWORD idx; + MIDIHDR mhSrc; + LPMIDIHDR lpmh; + MIDSBUFFER mb; + + pImage->pbBufferAlloc = NULL; + + // Parse: RIFF + cbChk (size of rest of file) + MIDS + // + if ((cbImage < 2*sizeof(FOURCC) + sizeof(DWORD)) || + (FOURCC_RIFF != *(FOURCC*)pbImage) || + (FOURCC_MIDS != *(FOURCC*)(pbImage + sizeof(FOURCC) + sizeof(DWORD)))) + { + dwRet = MDS_ERR_BADFILE; + goto Parse_Cleanup; + } + + // Note: can't subtract off size of 'fmt ' FOURCC until we check against + // cbChk size... it's included in the RIFF chunk, not the header + // + cbChk = *(((PDWORD)pbImage)+1); + pbImage += sizeof(FOURCC) + sizeof(DWORD); + cbImage -= sizeof(FOURCC) + sizeof(DWORD); + + if (cbImage < cbChk) + { + dwRet = MDS_ERR_BADFILE; + goto Parse_Cleanup; + } + + pbImage += sizeof(FOURCC); + cbImage -= sizeof(FOURCC); + + + // Should have 'fmt ' chunk first + // + if ((cbImage < sizeof(FOURCC) + sizeof(DWORD)) || + (FOURCC_fmt != *(FOURCC*)pbImage) || + ((cbChk = *(PDWORD)(pbImage + sizeof(FOURCC))) > cbImage) || + cbChk < sizeof(pImage->fmt)) + { + dwRet = MDS_ERR_BADFILE; + goto Parse_Cleanup; + } + + pbImage += sizeof(FOURCC) + sizeof(DWORD); + cbImage -= sizeof(FOURCC) + sizeof(DWORD); + + // Already validated size, copy format chunk + // + pImage->fmt = *(MIDSFMT*)pbImage; + + pbImage += cbChk; + cbImage -= cbChk; + + // Should get buffers next + // + if ((cbImage < sizeof(FOURCC) + sizeof(DWORD)) || + (FOURCC_data != *(FOURCC*)pbImage) || + ((cbChk = *(PDWORD)(pbImage + sizeof(FOURCC))) > cbImage) || + cbChk < sizeof(DWORD)) + { + dwRet = MDS_ERR_BADFILE; + goto Parse_Cleanup; + } + + pImage->cBuffers = *(PDWORD)(pbImage + sizeof(FOURCC) + sizeof(DWORD)); + + pbImage += sizeof(FOURCC) + 2*sizeof(DWORD); + cbImage -= sizeof(FOURCC) + 2*sizeof(DWORD); + + // Now copy the data out, decompressing if needed + // + + // Total decompressed size including MIDIHDR's to hold them + // + // Allocate as one big block and put them into a buffer list + // + cbChk = pImage->cBuffers * (sizeof(MIDIHDR) + pImage->fmt.cbMaxBuffer); + pImage->pbBufferAlloc = (PBYTE)GlobalAllocPtr( + GMEM_MOVEABLE|GMEM_SHARE, cbChk); + if (NULL == pImage->pbBufferAlloc) + { + dwRet = MDS_ERR_NOMEM; + goto Parse_Cleanup; + } + + lpmh = (LPMIDIHDR)(pImage->pbBufferAlloc); + for (idx = pImage->cBuffers; idx; --idx) + { + lpmh->lpData = (LPSTR)(lpmh + 1); + lpmh->dwBufferLength = pImage->fmt.cbMaxBuffer; + lpmh->dwFlags = 0; + lpmh->dwUser = (DWORD)pImage; + lpmh->lpNext = NULL; + + if (cbImage < sizeof(mb)) + { + dwRet = MDS_ERR_BADFILE; + goto Parse_Cleanup; + } + + mb = *(MIDSBUFFER*)pbImage; + cbImage -= sizeof(mb); + pbImage += sizeof(mb); + + if (mb.cbBuffer > pImage->fmt.cbMaxBuffer || + mb.cbBuffer > cbImage) + { + dwRet = MDS_ERR_BADFILE; + goto Parse_Cleanup; + } + + if (!(pImage->fmt.dwFlags & MDS_F_NOSTREAMID)) + { + lpmh->dwBytesRecorded = mb.cbBuffer; + hmemcpy(lpmh->lpData, pbImage, mb.cbBuffer); + } + else + { + mhSrc.lpData = (LPSTR)pbImage; + mhSrc.dwBufferLength = mhSrc.dwBytesRecorded = mb.cbBuffer; + if (!Decompress(&mhSrc, lpmh)) + { + dwRet = MDS_ERR_BADFILE; + goto Parse_Cleanup; + } + } + + cbImage -= mb.cbBuffer; + pbImage += mb.cbBuffer; + + lpmh = (LPMIDIHDR)(((PBYTE)lpmh) + sizeof(MIDIHDR) + pImage->fmt.cbMaxBuffer); + } + + +Parse_Cleanup: + + if (dwRet) + { + if (pImage->pbBufferAlloc) { + GlobalFreePtr(pImage->pbBufferAlloc); + } + } + + return dwRet; +} + +// Compression is simply removing the DWORD of stream ID per event since it's +// 0 most of the time unless some really funky authoring is being done. This +// will save 1 of 3 DWORD's on a MIDI short event, reducing the file size +// to 2/3 of what it was. +// +BOOL Decompress(LPMIDIHDR lpmhSrc, LPMIDIHDR lpmhDst) +{ + LPDWORD lpSrc = (LPDWORD)lpmhSrc->lpData; + LPDWORD lpDst = (LPDWORD)lpmhDst->lpData; + DWORD cbSrc = lpmhSrc->dwBytesRecorded; + DWORD cbDst = lpmhDst->dwBufferLength; + DWORD cbExtra; + + // Total buffer length must be a DWORD multiple + // + if (cbSrc & 3) + return FALSE; + + // !!! OPTIMIZE THIS LOOP !!! + // + while (cbSrc) + { + // Need at least space for delta-t, stream-id, event DWORD + // + if (cbDst < 3 * sizeof(DWORD)) + return FALSE; + + + // Event delta-time + // + *lpDst++ = *lpSrc++; + cbSrc -= sizeof(DWORD); + + // Any event left? + // + if (!cbSrc) + return FALSE; + + // Stream ID + *lpDst++ = 0; + cbDst -= 2*sizeof(DWORD); + + // Now copy the actual event data + // + cbExtra = 0; + if ((*lpSrc) & 0x80000000L) + cbExtra = (*lpSrc) & 0x00FFFFFFL; + + // Long event length is byte aligned, but data is padded to next DWORD + // in file. + // + cbExtra = (cbExtra + 3) & ~3; + + // Event DWORD itself + // + *lpDst++ = *lpSrc++; + cbSrc -= sizeof(DWORD); + cbDst -= sizeof(DWORD); + + // Long event parameter data + // + if (cbExtra) + { + if (cbExtra > cbSrc || cbExtra > cbDst) + return FALSE; + + hmemcpy(lpDst, lpSrc, cbExtra); + } + +// assert(0 == (cbExtra % sizeof(DWORD))); + + lpDst += (cbExtra / sizeof(DWORD)); + lpSrc += (cbExtra / sizeof(DWORD)); + cbSrc -= cbExtra; + cbDst -= cbExtra; + } + + lpmhDst->dwBytesRecorded = (((LPBYTE)lpDst) - (LPBYTE)(lpmhDst->lpData)); + + return TRUE; +} + +// FreeMDSImage +// +// Get rid of all resources associated with this handle. Stops playback +// if running. +// +DWORD FreeMDSImage(HANDLE hImage) +{ + MDSIMAGE* pImage; + + V_HIMAGE(hImage); + pImage = (MDSIMAGE*)hImage; + + if (NULL != pImage->hms) + StopMDS(hImage); + + if (pImage->pbBufferAlloc) GlobalFreePtr(pImage->pbBufferAlloc); + + // Toast signature in case free'ing the block doesn't; this will + // cause future V_HIMAGE's to faile + // + pImage->fccSig = FOURCC_data; + + LocalFree((HLOCAL)pImage); + + return MDS_SUCCESS; +} + +// PlayMDS +// +// Start playback. +// Open the device if needed. +// Send the ready list +// +DWORD PlayMDS(HANDLE hImage, DWORD fdw) +{ + DWORD dwRet = MDS_SUCCESS; + MDSIMAGE* pImage; + LPMIDIHDR lpmh; + UINT uDeviceID; + BOOL fCloseOnFail = FALSE; + DWORD idx; + MIDIPROPTIMEDIV mptd; + + V_HIMAGE(hImage); + + pImage = (MDSIMAGE*)hImage; + + if (pImage->hms && !(pImage->fdwImage & MDSI_F_PAUSED)) + return MDS_ERR_BADSTATE; + + if (!(pImage->hms)) + { + fCloseOnFail = TRUE; + + // Starting from scratch. Try to open the MIDI device + // + uDeviceID = MIDI_MAPPER; + if (MMSYSERR_NOERROR != midiStreamOpen( + &pImage->hms, + &uDeviceID, + 1, + (DWORD)midiCallback, + 0L, + CALLBACK_FUNCTION)) + { + dwRet = MDS_ERR_MIDIERROR; + goto Play_Cleanup; + } + + mptd.cbStruct = sizeof(mptd); + mptd.dwTimeDiv = pImage->fmt.dwTimeFormat; + + if (MMSYSERR_NOERROR !=midiStreamProperty( + pImage->hms, (LPBYTE)&mptd, MIDIPROP_SET|MIDIPROP_TIMEDIV)) + { + dwRet = MDS_ERR_MIDIERROR; + goto Play_Cleanup; + } + + // Headers are put back into the ready queue by a midiOutReset on + // stop, but are not guaranteed to be in correct order. Resend + // directly from the allocated chunk-of-all-buffers + // + +// assert(0 == pImage->cBuffersInUse); + + lpmh = (LPMIDIHDR)(pImage->pbBufferAlloc); + for (idx = pImage->cBuffers; idx; --idx) + { + if (MMSYSERR_NOERROR != midiOutPrepareHeader( + (HMIDIOUT)pImage->hms, lpmh, sizeof(*lpmh)) || + MMSYSERR_NOERROR != midiStreamOut( + pImage->hms, lpmh, sizeof(*lpmh))) + { + dwRet = MDS_ERR_MIDIERROR; + goto Play_Cleanup; + } + + ++pImage->cBuffersInUse; + + lpmh = (LPMIDIHDR)(((PBYTE)lpmh) + sizeof(MIDIHDR) + lpmh->dwBufferLength); + } + } + + // Whether we're starting or resuming from paused, just need + // to restart + + pImage->fdwImage &= ~MDSI_F_LOOP; + if (fdw & MDS_F_LOOP) + pImage->fdwImage |= MDSI_F_LOOP; + + pImage->fdwImage &= ~MDSI_F_PAUSED; + if (MMSYSERR_NOERROR != midiStreamRestart( + pImage->hms)) + { + dwRet = MDS_ERR_MIDIERROR; + goto Play_Cleanup; + } + +Play_Cleanup: + + if (dwRet) + { + if (fCloseOnFail && pImage->hms) + StopMDS(hImage); + } + + return dwRet; +} + +// PauseMDS +// +// Pause the stream if it's playing +// +DWORD PauseMDS(HANDLE hImage) +{ + MDSIMAGE* pImage; + + V_HIMAGE(hImage); + + pImage = (MDSIMAGE*)hImage; + + if (NULL == pImage->hms) + return MDS_ERR_BADSTATE; + + if (pImage->fdwImage & MDSI_F_PAUSED) + return MDS_SUCCESS; + + if (MMSYSERR_NOERROR != midiStreamPause( + pImage->hms)) + return MDS_ERR_MIDIERROR; + + pImage->fdwImage |= MDSI_F_PAUSED; + + return MDS_SUCCESS; +} + +// StopMDS +// +// Stop the stream, reset to the start, close the device +// Do NOT free stream tho +// +DWORD StopMDS(HANDLE hImage) +{ + MDSIMAGE* pImage; + DWORD idx; + LPMIDIHDR lpmh; + + V_HIMAGE(hImage); + + pImage = (MDSIMAGE*)hImage; + + if (NULL == pImage->hms) + return MDS_ERR_BADSTATE; + + // Remove all the buffers from MMSYSTEM + // + pImage->fdwImage |= MDSI_F_RESET; + if (MMSYSERR_NOERROR != midiOutReset( + (HMIDIOUT)pImage->hms)) + { + pImage->fdwImage &= ~MDSI_F_RESET; + return MDS_ERR_MIDIERROR; + } + +// assert(0 == pImage->cBuffersInUse); + + // Unprepare everyone + // + lpmh = (LPMIDIHDR)(pImage->pbBufferAlloc); + for (idx = pImage->cBuffers; idx; --idx) + { + midiOutUnprepareHeader((HMIDIOUT)pImage->hms, lpmh, sizeof(*lpmh)); + lpmh = (LPMIDIHDR)(((PBYTE)lpmh) + sizeof(MIDIHDR) + lpmh->dwBufferLength); + } + + midiStreamClose(pImage->hms); + pImage->hms = NULL; + pImage->fdwImage = 0; + + return MDS_SUCCESS; +} + + +// Callback +// +// Keep things rolling or collect the buffers back in the queue +// +void FAR PASCAL midiCallback(HMIDISTRM hms, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2) +{ + MDSIMAGE* pImage; + LPMIDIHDR lpmh = (LPMIDIHDR)dw1; + + if (uMsg != MOM_DONE) + return; + +// assert(NULL != lpmh); + pImage = (MDSIMAGE*)lpmh->dwUser; +// assert(FOURCC_MDSI == pImage->fccSig); + + pImage = (MDSIMAGE*)lpmh->dwUser; + + if ((pImage->fdwImage & MDSI_F_LOOP) && !(pImage->fdwImage & MDSI_F_RESET)) + if (MMSYSERR_NOERROR == midiStreamOut( + pImage->hms, lpmh, sizeof(*lpmh))) + return; + + --pImage->cBuffersInUse; +} + + + + + + + + + + + + +typedef struct _MIDI_INFO +{ + HANDLE hImage; + BOOL fPlaying; +} MIDI_INFO; + +static MIDI_INFO *pMidi = NULL; + +/* Plays a given MIDI file using MCI_OPEN, MCI_PLAY. Returns as soon as + * playback begins. The window procedure function for the given window + * will be notified when playback is complete. + */ +BOOL playMusic(LPSTR lpszMIDIFileName, BOOL fAutoStart) +{ + if (pMidi != NULL) { + closeMusic(); + } + + pMidi = new MIDI_INFO; + + + if( LoadMDSImage( &(pMidi->hImage), + (PBYTE)lpszMIDIFileName, + 0, + MDS_F_FILENAME ) != 0 ) { + delete pMidi; + pMidi = NULL; + return (FALSE); + } + + pMidi->fPlaying = FALSE; + if( fAutoStart ) { + if( PlayMDS(pMidi->hImage, MDS_F_LOOP) != 0 ) { + FreeMDSImage(pMidi->hImage); + delete pMidi; + pMidi = NULL; + return (FALSE); + } + pMidi->fPlaying = TRUE; + + } + + + return (TRUE); +} + + +void resumeMusic() +{ + if ( pMidi == NULL ) { + // Error + return; + } + + if( PlayMDS(pMidi->hImage, MDS_F_LOOP) != 0 ) { + // Error + return; + } + pMidi->fPlaying = TRUE; + +} + +void pauseMusic() +{ + if ( pMidi == NULL ) { + // Error + return; + } + + if( PauseMDS(pMidi->hImage) != 0 ) { + // Error + return; + } + pMidi->fPlaying = FALSE; + +} + +void restartMusic() +{ + if ( pMidi == NULL ) { + // Error + return; + } + + + if( StopMDS(pMidi->hImage) != 0 ) { + // Error + return; + } + if( PlayMDS(pMidi->hImage, MDS_F_LOOP) != 0 ) { + // Error + return; + } + pMidi->fPlaying = TRUE; + +} + +void closeMusic() +{ + if ( pMidi == NULL ) { + // Error + return; + } + + StopMDS(pMidi->hImage); + FreeMDSImage(pMidi->hImage); + + delete pMidi; + pMidi = NULL; + + +} diff --git a/sdk/samples/iklowns/cgmidi.h b/sdk/samples/iklowns/cgmidi.h new file mode 100644 index 0000000..ff59dd5 --- /dev/null +++ b/sdk/samples/iklowns/cgmidi.h @@ -0,0 +1,38 @@ +/*===========================================================================*\ +| +| File: cgmidi.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef _CGMIDI_H +#define _CGMIDI_H + +BOOL playMusic(LPSTR lpszMIDIFileName, BOOL fAutoStart=TRUE); +void pauseMusic(); +void resumeMusic(); +void restartMusic(); +void closeMusic(); + +#endif diff --git a/sdk/samples/iklowns/cgmisc.cpp b/sdk/samples/iklowns/cgmisc.cpp new file mode 100644 index 0000000..0a874fc --- /dev/null +++ b/sdk/samples/iklowns/cgmisc.cpp @@ -0,0 +1,255 @@ +/*===========================================================================*\ +| +| File: cgmisc.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#ifdef __WATCOMC__ +#include <mem.h> +#else +#include <memory.h> +#endif +#include "cgchdll.h" +#include "cgchar.h" +#include "cgtimer.h" +#include "cginput.h" +#include "cgimage.h" + +char inifile [260]; + + +HINSTANCE hInst = NULL; // our library instance +// This is returned by the 'Ident' function, but isn't used internally at all +CGameVersionIdent version = +{ + RELEASE1_0, + GAMEID +}; + +// prototypes so we can fill in the action arrays +int PlaneCreate( CGameCharacter *, CGameLevel * ); +int PlaneAction( CGameCharacter *, CGameLevel * ); +int PlaneDestroy( CGameCharacter *, CGameLevel * ); +int PlaneCollide( CGameCharacter *, CGameCharacter *, CGameLevel * ); + +int CloudCreate( CGameCharacter *, CGameLevel * ); +int CloudAction( CGameCharacter *, CGameLevel * ); +int CloudDestroy( CGameCharacter *, CGameLevel * ); +int CloudCollide( CGameCharacter *, CGameCharacter *, CGameLevel * ); + +// returned by 'Info' function, and isn't used either (internally) +CGameCharSequenceInfo char1seq[1] = +{ + {"plane.spr", "Fly", 15, {"plane.wav", NULL, 100, 1}} +}; + +CGameCharSequenceInfo char2seq[1] = +{ + {"clouds.spr", "Cloud1", 30, {NULL, NULL, 100, 1}} +}; +CGameCharSequenceInfo char3seq[1] = +{ + {"clouds.spr", "Cloud2", 30, {NULL, NULL, 100, 1}} +}; +CGameCharSequenceInfo char4seq[1] = +{ + {"clouds.spr", "Cloud3", 30, {NULL, NULL, 100, 1}} +}; + +CGameCharInfo character1 = +{ + "Plane", + 1, + &char1seq[0], + PlaneCreate, + PlaneAction, + PlaneDestroy, + NULL, + PlaneCollide +}; + +CGameCharInfo character2 = +{ + "Cloud1", + 1, + &char2seq[0], + CloudCreate, + CloudAction, + CloudDestroy, + NULL, + CloudCollide +}; + +CGameCharInfo character3 = +{ + "Cloud2", + 1, + &char3seq[0], + CloudCreate, + CloudAction, + CloudDestroy, + NULL, + CloudCollide +}; + +CGameCharInfo character4 = +{ + "Cloud3", + 1, + &char4seq[0], + CloudCreate, + CloudAction, + CloudDestroy, + NULL, + CloudCollide +}; + +// This array allows the caller to get our information directly +CGameCharInfo *characters[] = +{ + &character1, + &character2, + &character3, + &character4 +}; + +CGameInfo dllinfo = +{ + 4, // number of characters implemented in + // this DLL + characters // array of CGameCharInfo pointers +}; + +// EXPORTED as ordinal #1: +#ifdef __BORLANDC__ +extern "C" void CALLBACK Ident( CGameVersionIdent * id ) +#else +void CALLBACK Ident( CGameVersionIdent * id ) +#endif +{ + GetModuleFileName(NULL, inifile, 259); + char *p = strrchr(inifile, '.'); + if (p) + lstrcpy(p+1, "GAM"); + + memcpy( id, &version, sizeof( version ) ); +} + +// EXPORTED as ordinal #2: +#ifdef __BORLANDC__ +extern "C" void CALLBACK Info( CGameInfo * info ) +#else +void CALLBACK Info( CGameInfo * info ) +#endif +{ + memcpy( info, &dllinfo, sizeof( dllinfo ) ); +} + +int PlaneCreate( CGameCharacter *me, CGameLevel *level ) +{ + int posx,posy; + me->GetXY(&posx, &posy); + me->SetVelocity(-32,0); + me->MoveTo(level->GetMaxX(), posy); + return ( ACTION_COMPLETED ); +} + +int PlaneAction( CGameCharacter *me, CGameLevel *level ) +{ + int posx, posy, velx, vely; + int time = level->GetFrameTime(); + int slices = (me->mLastTime == -1) ? 1 : (time - me->mLastTime); + me->mLastTime = time; + + me->GetVelocity(&velx, &vely); + + // remember to use sub-pixels! + me->GetSubXY(&posx, &posy); + + + posx += SUBPIXEL_DELTA(velx, slices); + posy += SUBPIXEL_DELTA(vely, slices); + + // did we move off the screen? If so, start over at maxx... + if (SUB2WORLD(posx) < -level->GetMaxX()) + posx = WORLD2SUB(level->GetMaxX()); + + me->SetAndMove(posx, posy); + me->NextSprite(level->GetTimer()->Time, FALSE); + + return ( ACTION_COMPLETED ); +} + +int PlaneDestroy( CGameCharacter *me, CGameLevel *level ) +{ + return ( ACTION_COMPLETED ); +} + +int PlaneCollide( CGameCharacter *me, CGameCharacter *other, CGameLevel *level ) +{ + return(ACTION_COMPLETED); +} + + +int CloudCreate( CGameCharacter *me, CGameLevel *level ) +{ + me->SetVelocity(64 / (me->GetXParallax()+1),0); + return ( ACTION_COMPLETED ); +} + +int CloudAction( CGameCharacter *me, CGameLevel *level ) +{ + int posx, posy, velx, vely; + int time = level->GetFrameTime(); + int slices = (me->mLastTime == -1) ? 1 : (time - me->mLastTime); + me->mLastTime = time; + + me->GetVelocity(&velx, &vely); + + // remember to use sub-pixels! + me->GetSubXY(&posx, &posy); + + posx += SUBPIXEL_DELTA(velx, slices); + + // did we move off the screen? If so, start over at maxx... + if (posx > WORLD2SUB(SCREEN_WIDTH)) + posx = WORLD2SUB(-SCREEN_WIDTH); + + me->SetAndMove(posx, posy); + + return ( ACTION_COMPLETED ); +} + +int CloudDestroy( CGameCharacter *me, CGameLevel *level ) +{ + return ( ACTION_COMPLETED ); +} + +int CloudCollide( CGameCharacter *me, CGameCharacter *other, CGameLevel *level ) +{ + return(ACTION_COMPLETED); +} diff --git a/sdk/samples/iklowns/cgoption.cpp b/sdk/samples/iklowns/cgoption.cpp new file mode 100644 index 0000000..1d5916e --- /dev/null +++ b/sdk/samples/iklowns/cgoption.cpp @@ -0,0 +1,423 @@ +/*===========================================================================*\ +| +| File: cgoption.cpp +| +| Description: +| Routines to display lines of text (from resource strings) overlayed on +| a bitmap. The text will be sized appropriately to fit within the +| rectangle specified in the profile. The user may hilight a particular +| line and the index of the line will be returned to the caller. +| +| Also, routines to scroll text across a bitmap image (useful for +| story lines and credits). +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include "cgglobl.h" +#include "cgdib.h" +#include "strrec.h" +#include "cginput.h" +#include "cgtext.h" +#include "cgmidi.h" +#include "cgimage.h" +#include "cgrsrce.h" +#include "cgoption.h" + +#define MIN_JOY_MOVE 15 +#define MIN_MOUSE_MOVE 50 + +#define SOURCEX SCREEN_WIDTH +#define SOURCEY SCREEN_HEIGHT +#define SCREENX GetSystemMetrics(SM_CXSCREEN) +#define SCREENY GetSystemMetrics(SM_CYSCREEN) +#define CenterX (GetSystemMetrics(SM_CXSCREEN) / 2) +#define CenterY (GetSystemMetrics(SM_CXSCREEN) / 2) + +#define PIXEL_STEP 2 + +#define BASE_HWND ghMainWnd +#define NUM_ENTRIES(x) (sizeof(x)/sizeof(x[0])) + +//** external functions ** +extern void GetRectFromProfile(RECT &, LPSTR, LPSTR, LPSTR); +COLORREF GetColorFromProfile(LPSTR, LPSTR, LPSTR); + +//** external data ** +//** public data ** + +//** private data ** +static HDC hdcIntro; +static CGameDIB *pDib; +static HPALETTE hPal; + +static int iMouseMove; +static int iJoyMove; +static int iCycleRate; + +//** public functions ** +//** private functions ** + +// ---------------------------------------------------------- +// LoadBitmap - load bitmap from a file into a DC and setup +// palette. +// ---------------------------------------------------------- +HDC LoadBitmapFile ( + LPSTR pBitmapFile // Name of .BMP file +) +{ + HDC hdcBase, hdcBitmap; + + // Loadup bitmap + pDib = new CGameDIB(pBitmapFile); + + // Create a DC and copy bitmap to it + hdcBase = GetDC(BASE_HWND); + hdcBitmap = CreateCompatibleDC(hdcBase); + SelectObject(hdcBitmap, pDib->GetHBitmap()); + + // Set palette so image looks ok! + hPal = pDib->CreatePalette(); + SelectPalette(hdcBase, hPal, FALSE); + RealizePalette(hdcBase); + + ReleaseDC( BASE_HWND, hdcBase ); + + return(hdcBitmap); +} + +// ---------------------------------------------------------- +// GetUpDownDone - poll user input devices looking to see if +// there are any selection changes. +// ---------------------------------------------------------- +void GetUpDownDone(CGameInput *Input, BOOL &up, BOOL &down, BOOL &done) +{ + JOYINFO joy; + int x, y, buttons; + + up = down = done = FALSE; + + // Check for keyboard input + down = (Input->GetKeyboard(VK_DOWN) !=0) || + (Input->GetKeyboard(VK_NUMPAD2) != 0); + up = (Input->GetKeyboard(VK_UP) != 0) || + (Input->GetKeyboard(VK_NUMPAD8) != 0); + done = ((Input->GetKeyboard(VK_RETURN)) || (Input->GetKeyboard(VK_SPACE))); + + // No keyboard input? + if (!(up || down || done)) + { + + // Check for mouse input + if (Input->GetMouse(x, y, buttons)) + { + down = (y - CenterY > iMouseMove); + up = (y - CenterY < -iMouseMove); + done = (buttons & 1); + + // Keep mouse in center of screen + SetCursorPos(CenterX, CenterY); + } + + // No mouse input? + if (!(up || down || done)) + { + // Check for joystick input + Input->UpdateJoystick(); + if (Input->GetJoystick(1, &joy)) + { + down = ((int)joy.wYpos >= iJoyMove); + up = ((int)joy.wYpos <= -iJoyMove); + done = (joy.wButtons & JOY_BUTTON1); + } + } + } +} + +// ---------------------------------------------------------- +// NewStringResource - Load string from resource into memory +// ---------------------------------------------------------- +LPSTR NewStringResource( + HINSTANCE hInst, + int idString +) +{ + char TempBuf[256]; + DWORD nBytes=0; + LPSTR pStr=NULL; + + nBytes = LoadString(hInst, idString, TempBuf, sizeof(TempBuf)); + if (nBytes > 0) + { + pStr = new char [nBytes+1]; + lstrcpy(pStr, TempBuf); + } + return(pStr); +} + +// ---------------------------------------------------------- +// COptionScreen constructor - Options screen object for +// displaying option screen while allowing repaints to occur +// These routines do not take advantage of DirectDraw, unfortunately. +// ---------------------------------------------------------- +COptionScreen::COptionScreen() +{ + mHdcScreen = NULL; + mHdcIntro = NULL; + mInput = NULL; + pText = NULL; + pDib = NULL; + mnChoices = 0; +} + +// ---------------------------------------------------------- +// Init - initialises context for option screen +// NOTE: resource strings are assumed to be sequential! +// ---------------------------------------------------------- +BOOL COptionScreen::Init( + LPSTR pBitmapName, // name of .BMP file or NULL to use default + LPSTR ProfileName, // filename of game config file + CGameInput *Input, // ptr to input object or NULL if no input + int timeout // maximum time to wait or -1 forever +) +{ + return( TRUE ); +} + +// ---------------------------------------------------------- +// Init - initialises context for option screen +// NOTE: resource strings are assumed to be sequential! +// ---------------------------------------------------------- +BOOL COptionScreen::Init( + LPSTR pBitmapName, // name of .BMP file or NULL to use default + int idStringBase, // first resource id of text lines + int nChoices, // number of text lines to display + LPSTR ProfileName, // filename of game config file + CGameInput *Input, // ptr to input object or NULL if no input + int defSelect, // line to hilight first or -1 if none + int timeout, // maximum time to wait or -1 forever + int spacing, + int lines +) +{ + return( TRUE ); +} + +// ---------------------------------------------------------- +// AddText - +// ---------------------------------------------------------- +int COptionScreen::AddText( + LPSTR pNewText +) +{ + if (pText == NULL) + { + return(-1); + } + + mnChoices++; + pText->AddLine(pNewText, colorDefault, colorDefaultShadow); + return(mnChoices); +} + +// ---------------------------------------------------------- +// SelectText - +// ---------------------------------------------------------- +BOOL COptionScreen::SelectText( + int defSelect // line to hilight first or -1 if none +) +{ + if (pText == NULL) + { + return(FALSE); + } + + CurSel = defSelect; + + pText->TextBlt(); + pText->ChangeColor(CurSel+1, colorSelected, colorSelectedShadow); + return( TRUE ); +} + +// ---------------------------------------------------------- +// SetSpacing - +// ---------------------------------------------------------- +void COptionScreen::SetSpacing(int spacing) +{ + if (pText != NULL) + { + pText->SetSpacing(spacing); + } + +} + +// ---------------------------------------------------------- +// SetMaxLines - +// ---------------------------------------------------------- +void COptionScreen::SetMaxLines(int lines) +{ + if (pText != NULL) + { + pText->SetMaxLines(lines); + } + +} + +// ---------------------------------------------------------- +// Shutdown - closes down context +// ---------------------------------------------------------- +void COptionScreen::Shutdown( void ) +{ + // Cleanup + if ( mHdcIntro ) { + DeleteDC(mHdcIntro); + mHdcIntro = NULL; + } + if ( pText ) { + delete pText; // destructor will delete our strings for us! + } + if ( pDib ) { + delete pDib; + } + if ( mHdcScreen ) { + ReleaseDC(BASE_HWND, mHdcScreen); + mHdcScreen = NULL; + } +} + +// ---------------------------------------------------------- +// DlgProcOptions - main game options dialog +// ---------------------------------------------------------- +BOOL CALLBACK DlgProcOptions(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + static LONG iIndex = -1; + static HWND hWndCtl; + // char chBuffer[128]; + + switch (msg) + { + case WM_INITDIALOG: + + iIndex = -1; + + hWndCtl = GetDlgItem(hDlg, IDC_LISTOPTION); + if (hWndCtl == NULL) + { + EndDialog(hDlg, -1); + return(TRUE); + } + SendMessage(hWndCtl, LB_ADDSTRING, 0, (LPARAM) "Play Solo"); + SendMessage(hWndCtl, LB_ADDSTRING, 0, (LPARAM) "Two Player Game"); + SendMessage(hWndCtl, LB_ADDSTRING, 0, (LPARAM) "Play Remote Opponents"); + SendMessage(hWndCtl, LB_ADDSTRING, 0, (LPARAM) "Quit Game"); + SendMessage(hWndCtl, LB_SETCURSEL, 0, 0); + SetFocus(hWndCtl); + iIndex = 0; + + return(FALSE); + + case WM_COMMAND: + + switch( HIWORD(wParam)) + { + case LBN_SELCHANGE: + iIndex = SendMessage((HWND) lParam, LB_GETCURSEL, 0, 0); + hWndCtl = (HWND) lParam; + //wsprintf( chBuffer, "Index set to %d, %8x %8x %8x\r\n", + // iIndex, msg, wParam, lParam); + // OutputDebugString(chBuffer); + return(FALSE); + + case LBN_DBLCLK: + iIndex = SendMessage((HWND) lParam, LB_GETCURSEL, 0, 0); + //wsprintf( chBuffer, "Index set to %d, %8x %8x %8x\r\n", + // iIndex, msg, wParam, lParam); + // OutputDebugString(chBuffer); + EndDialog(hDlg, iIndex); + return(TRUE); + + case 0: + //wsprintf( chBuffer, "Index returned %d, %8x %8x %8x\r\n", + // iIndex, msg, wParam, lParam); + // OutputDebugString(chBuffer); + + if (LOWORD(wParam) == IDOK) + { + EndDialog(hDlg, iIndex); + return(TRUE); + } + else if (LOWORD(wParam) == IDCANCEL) + { + EndDialog(hDlg, -1); + return(TRUE); + } + break; + + } + } + //wsprintf( chBuffer, "Ret False Index set to %d, %8x %8x %8x\r\n", + // iIndex, msg, wParam, lParam); + // OutputDebugString(chBuffer); + return (FALSE); +} + +// ---------------------------------------------------------- +// DoOptionScreen - display bitmap & text and allow user to +// make a selection. +// ---------------------------------------------------------- +int COptionScreen::DoOptionScreen( void ) +{ + // Allow user to change options + BOOL done = FALSE; + BOOL switchedAway = FALSE; + DWORD startTime = timeGetTime(); + DWORD dwRet; + + pDib = new CGameDIB("instruct.bmp"); + + InvalidateRect(NULL, NULL, TRUE); + + dwRet = DialogBox (ghInst, (LPCTSTR) IDD_OPTIONS, ghMainWnd, (DLGPROC) DlgProcOptions); + return(dwRet); +} + + +// ---------------------------------------------------------- +// Paint - +// ---------------------------------------------------------- +void COptionScreen::Paint( void ) +{ + HDC hdcScreen = GetDC(BASE_HWND); + HDC hdcBitmap; + + hdcBitmap = CreateCompatibleDC(hdcScreen); + SelectObject( hdcBitmap, pDib->GetHBitmap() ); + + StretchBlt(hdcScreen, 0, 0, SCREENX, SCREENY, hdcBitmap + , 0, 0, SOURCEX, SOURCEY, SRCCOPY); + + ReleaseDC(BASE_HWND, hdcScreen); + DeleteObject(hdcBitmap); +} + diff --git a/sdk/samples/iklowns/cgoption.h b/sdk/samples/iklowns/cgoption.h new file mode 100644 index 0000000..b0e24e4 --- /dev/null +++ b/sdk/samples/iklowns/cgoption.h @@ -0,0 +1,90 @@ +/*===========================================================================*\ +| +| File: cgoption.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef _CGOPTION_H +#define _CGOPTION_H + +HDC LoadBitmapFile ( + LPSTR pBitmapFile +); + +// Class for the options screen, to allow clean repaints +// from the base window when the option screen is up + +// Forward declaration of CGameText (protected member +// needn't force include of new header file) +class CGameText; + +class COptionScreen +{ + public: + COptionScreen(); + + BOOL Init( + LPSTR pBitmapName, // name of .BMP file or NULL to use default + LPSTR ProfileName, // filename of game config file + CGameInput *Input=NULL, // ptr to input object or NULL if no input + int timeout=-1 // maximum time to wait or -1 forever + ); + + BOOL Init( + LPSTR pBitmapName, // name of .BMP file or NULL to use default + int idStringBase, // first resource id of text lines + int nChoices, // number of text lines to display + LPSTR ProfileName, // filename of game config file + CGameInput *Input=NULL, // ptr to input object or NULL if no input + int defSelect=0, // line to hilight first or -1 if none + int timeout=-1, // maximum time to wait or -1 forever + int spacing=2, + int lines=2 + ); + BOOL AddText(LPSTR); + BOOL SelectText(int); + void SetSpacing(int spacing); + void SetMaxLines(int lines); + + int DoOptionScreen( void ); + void Shutdown( void ); + void Paint( void ); + protected: + RECT rect; + HDC mHdcScreen; + HDC mHdcIntro; // DC screen is assembled in + COLORREF colorDefault; + COLORREF colorSelected; + COLORREF colorDefaultShadow; + COLORREF colorSelectedShadow; + LPSTR pChoice; + int CurSel; + CGameInput *mInput; + int mnChoices; + CGameText *pText; + int mTimeout; +}; + +#endif diff --git a/sdk/samples/iklowns/cgremote.cpp b/sdk/samples/iklowns/cgremote.cpp new file mode 100644 index 0000000..2ded9dd --- /dev/null +++ b/sdk/samples/iklowns/cgremote.cpp @@ -0,0 +1,867 @@ +/*===========================================================================*\ +| +| File: cgremote.cpp +| +| Description: +| Routines to send and receive remote actions for controlling objects +| on remote machines. Uses DirectPlay for transferring data. +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +//** include files ** +#include <stdlib.h> +#ifndef __WATCOMC__ +#define WIN32_LEAN_AND_MEAN +#endif +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include "cgglobl.h" // For ghInst for dialog box +#include "cgrsrce.h" +#include "dplay.h" +#include "dplobby.h" +#include "cglevel.h" +#include "cgremote.h" +#include "strrec.h" + +#include <stdarg.h> +#include <stdio.h> + +static void InitReceivePoll( void ); + +// [johnhall] +// hack -- get GENERIC_CHAR_INFO from cgkrusty.cpp +typedef signed char SCHAR; + +typedef struct +{ + LONG posx; + LONG posy; + SCHAR state; + SCHAR velx; + SCHAR vely; + SCHAR curZ; +} GENERIC_CHAR_INFO; + +//** local definitions ** +// structure to be used to pass remote actions across the link +typedef struct _GAMEMESSAGE { + BYTE Action; // action code + BYTE NumBytes; // size of data + REMOTE_OBJECT RemObj; // unique object id + char Data[1]; // action specific data +} GAMEMESSAGE, *PGAMEMESSAGE; + + +//** external functions ** + +//** external data ** +// KLUDGE: +CGameLevel *gCurLevel=NULL; + +//** public data ** +//** private data ** +static IDirectPlay *lpIDC=NULL; // DirectPlay Object +static DPID dcoID=0; // our DirectPlay ID +static HANDLE dphEvent = NULL; + +static BOOL fAbort = FALSE; // Abort flag for RemoteConnect() + +//** public functions ** +//** private functions ** +static DWORD RequestThreadProc(void *Dummy); +static BOOL CALLBACK AbortDlgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); + + +#define DP_BROADCAST_ID 0 + +// ---------------------------------------------------------- +// CreateRemotePeer - create a new character across all peers +// ---------------------------------------------------------- +REMOTE_OBJECT *CreateRemotePeers( + char *name, // name of object as per level->Add() + DWORD InstanceID // unique instance ID of object type +) +{ + // Gotta have a DCO object to do this! + if (lpIDC == NULL) + { + return(NULL); + } + + // Setup a message and an unique obect id + char *pBuffer = NULL; + DWORD lenBuff; + PGAMEMESSAGE pGameMsg; + REMOTE_OBJECT *pObj = new REMOTE_OBJECT; + memset(pObj, 0, sizeof(REMOTE_OBJECT)); + + // Make buffer big enough to hold game message plus + // leading non-system-char byte + lenBuff = sizeof(GAMEMESSAGE); + pBuffer = new char[lenBuff]; + pGameMsg = (PGAMEMESSAGE)&pBuffer[0]; + + // Fill in object id info so that this object is unique across + // all machines + pObj->OwnerID = (BYTE) dcoID; + pObj->InstanceID = (BYTE) InstanceID; + lstrcpyn(pObj->ObjectID, name, MAX_OBJ_NAME); + memcpy(&pGameMsg->RemObj, pObj, sizeof(REMOTE_OBJECT)); + + pGameMsg->Action = (BYTE) CREATE_OBJECT; + + // Broadcast it to everyone in the group. + lpIDC->Send( dcoID, // From + DP_BROADCAST_ID, + 0, + (LPSTR)pBuffer, + lenBuff); + + // Delete buffer, once sent + delete []pBuffer; + + return(pObj); +} + + + + + +// ---------------------------------------------------------- +// SendRemoteAction - broadcast an action to remote peers +// ---------------------------------------------------------- +BOOL SendRemoteAction( + REMOTE_OBJECT *pObj, // unique object id + ACTION Action, // action code + void *Data, // action data + DWORD nDataSize // size of action data +) +{ + PGAMEMESSAGE gameMsg; + char *pBuffer; + DWORD lenBuff; + // char chBuffer[128]; + + + + // Gotta have a valid DirectPlay object + if (lpIDC == NULL) + { + return(NULL); + } + + // Allocate the GAME buffer with room for data, + // plus room at the beginning for a non-sytem-message char + lenBuff = sizeof(GAMEMESSAGE) + nDataSize; + pBuffer = new char [lenBuff]; + // Now point gameMsg at the rest of the buffer + gameMsg = (PGAMEMESSAGE)&pBuffer[0]; + + // Copy the action code and data to message buffer + gameMsg->Action = Action; + memcpy(&gameMsg->RemObj, pObj, sizeof(REMOTE_OBJECT)); + gameMsg->NumBytes = (BYTE) nDataSize; + memcpy(gameMsg->Data, Data, nDataSize); +#if 0 + wsprintf( chBuffer, "%d (10%s) %d %d %d", + gameMsg->Action, + gameMsg->RemObj.ObjectID, + gameMsg->RemObj.InstanceID, + gameMsg->RemObj.OwnerID, + gameMsg->NumBytes); + OutputDebugString(chBuffer); + if (nDataSize == sizeof(GENERIC_CHAR_INFO)) + { + GENERIC_CHAR_INFO *pci; + pci = (GENERIC_CHAR_INFO *) Data; + wsprintf( chBuffer,"; %d %d %d %d %d %d", + pci->state, + pci->posx, + pci->posy, + pci->velx, + pci->vely, + pci->curZ); + OutputDebugString(chBuffer); + } + OutputDebugString("\r\n"); +#endif + + // Broadcast the action to all peers + lpIDC->Send(dcoID, // from + DP_BROADCAST_ID, // to + 0, + pBuffer, + lenBuff); + delete []pBuffer; + return(TRUE); +} + +// ---------------------------------------------------------- +// DestroyRemotePeer - Tell remote peers to kill an object +// ---------------------------------------------------------- +BOOL DestroyRemotePeer( + REMOTE_OBJECT *pObj // unique object id +) +{ + PGAMEMESSAGE gameMsg; + char *pBuffer = NULL; + DWORD lenBuff; + + if (pObj == NULL) + return(TRUE); + + // Allocate a buffer for the GAME buffer with roon for data, + // plus an extra character at the beginning to be the non-system + // message char. + lenBuff = sizeof(GAMEMESSAGE)+1; + pBuffer = new char [lenBuff]; + + // Point the game message pointer at the rest of the buffer + gameMsg = (PGAMEMESSAGE)&pBuffer[0]; + + // Format a destroy message + memcpy(&gameMsg->RemObj, pObj, sizeof(REMOTE_OBJECT)); + gameMsg->RemObj.OwnerID = (BYTE) dcoID; + gameMsg->NumBytes = 0; + gameMsg->Action = (BYTE) DESTROY_OBJECT; + + // Broadcast the destroy message to all peers + lpIDC->Send( dcoID, + DP_BROADCAST_ID, + 0, + pBuffer, + lenBuff); + // Delete buffer + delete []pBuffer; + + // Don't need the object id anymore + delete pObj; + return(TRUE); +} + +// ----------------------------------------------------------------- +// RemoteConnect - establish an active connection with remotes +// ----------------------------------------------------------------- + +BOOL FAR PASCAL EnumSession( + LPDPSESSIONDESC lpDPGameDesc, + LPVOID pContext, + LPDWORD pTimeOut, + DWORD dwFlags ) +{ + LONG iIndex; + HWND hWnd = (HWND) pContext; + + if( dwFlags == DPESC_TIMEDOUT ) + { + return FALSE; + } + + iIndex = SendMessage(hWnd, LB_ADDSTRING, 0, (LPARAM) lpDPGameDesc->szSessionName); + if (iIndex != LB_ERR) + SendMessage(hWnd, LB_SETITEMDATA, iIndex, (LPARAM) lpDPGameDesc->dwSession); + + SetFocus(hWnd); + SendMessage(hWnd, LB_SETCURSEL, 0, 0); + return(TRUE); + +} + +BOOL FAR PASCAL EnumSP(LPGUID lpGuid, LPSTR lpDesc, + DWORD dwMajor, DWORD dwMinor, LPVOID lpv) +{ + LONG iIndex; + HWND hWnd = (HWND) lpv; + + iIndex = SendMessage(hWnd, LB_ADDSTRING, 0, (LPARAM) lpDesc); + if (iIndex != LB_ERR) + SendMessage(hWnd, LB_SETITEMDATA, iIndex, (LPARAM) lpGuid); + + SetFocus(hWnd); + SendMessage(hWnd, LB_SETCURSEL, 0, 0); + return(TRUE); +} + + + +BOOL CALLBACK DlgProcQCreate (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_COMMAND: + switch(wParam) + { + case IDC_CREATE: + EndDialog(hDlg, 1); + return(TRUE); + + case IDC_CONNECT: + EndDialog(hDlg, 2); + return(TRUE); + + case IDCANCEL: + EndDialog(hDlg, -1); + return(TRUE); + } + break; + + } + return(FALSE); +} +BOOL CALLBACK DlgProcChooseProvider (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + LPGUID lpGuid; + static LONG iIndex; + static HWND hWndCtl; + + switch (msg) + { + case WM_INITDIALOG: + + hWndCtl = GetDlgItem(hDlg, IDC_LIST1); + if (hWndCtl == NULL) + { + EndDialog(hDlg, TRUE); + return(TRUE); + } + DirectPlayEnumerate(EnumSP, (LPVOID) hWndCtl); + SetFocus(hWndCtl); + SendMessage(hWndCtl, LB_SETCURSEL, 0, 0); + return(FALSE); + + case WM_COMMAND: + + switch( HIWORD(wParam)) + { + case LBN_SELCHANGE: + iIndex = SendMessage((HWND) lParam, LB_GETCURSEL, 0, 0); + hWndCtl = (HWND) lParam; + return(FALSE); + + case LBN_DBLCLK: + iIndex = SendMessage((HWND) lParam, LB_GETCURSEL, 0, 0); + if (iIndex != LB_ERR) + { + lpGuid = (LPGUID) SendMessage((HWND) lParam, LB_GETITEMDATA, iIndex, 0); + DirectPlayCreate(lpGuid, &lpIDC, NULL); + EndDialog(hDlg, TRUE); + return(TRUE); + } + break; + + case 0: + if (LOWORD(wParam) == IDOK) + { + if (iIndex != LB_ERR) + { + lpGuid = (LPGUID) SendMessage(hWndCtl, LB_GETITEMDATA, iIndex, 0); + if (lpGuid) + { + DirectPlayCreate(lpGuid, &lpIDC, NULL); + EndDialog(hDlg, TRUE); + } + else + EndDialog(hDlg, FALSE); + return(TRUE); + } + } + else if (LOWORD(wParam) == IDCANCEL) + { + EndDialog(hDlg, FALSE); + return(TRUE); + } + break; + + } + } + return (FALSE); +} + +LPGUID g_lpGuid; + +BOOL CALLBACK DlgProcSelSession (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + static LONG iIndex; + static HWND hWndCtl; + DPSESSIONDESC dpDesc; + HRESULT hr = DP_OK + 10; + + switch (msg) + { + case WM_INITDIALOG: + + hWndCtl = GetDlgItem(hDlg, IDC_LB_SESSION); + if (hWndCtl == NULL) + { + EndDialog(hDlg, TRUE); + return(TRUE); + } + memset(&dpDesc, 0x00, sizeof(DPSESSIONDESC)); + dpDesc.dwSize = sizeof(dpDesc); + dpDesc.guidSession = *g_lpGuid; + lpIDC->EnumSessions(&dpDesc, 5000, EnumSession, (LPVOID) hWndCtl, 0 ); + + SetFocus(hWndCtl); + return(FALSE); + + case WM_COMMAND: + + switch( HIWORD(wParam)) + { + case LBN_SELCHANGE: + iIndex = SendMessage((HWND) lParam, LB_GETCURSEL, 0, 0); + hWndCtl = (HWND) lParam; + return(FALSE); + + case 0: + if (LOWORD(wParam) == IDCANCEL) + { + lpIDC->Close(); + lpIDC->Release(); + lpIDC = NULL; + EndDialog(hDlg, FALSE); + return(TRUE); + } + // + // Fall Through. + // + case LBN_DBLCLK: + if (HIWORD(wParam) == LBN_DBLCLK) + { + hWndCtl = (HWND) lParam; + iIndex = SendMessage(hWndCtl, LB_GETCURSEL, 0, 0); + } + + if (iIndex != LB_ERR) + { + memset(&dpDesc, 0x00, sizeof(DPSESSIONDESC)); + dpDesc.dwSize = sizeof(dpDesc); + dpDesc.guidSession = *g_lpGuid; + dpDesc.dwFlags = DPOPEN_OPENSESSION; + dpDesc.dwSession = SendMessage((HWND) hWndCtl, LB_GETITEMDATA, iIndex, 0); + hr = lpIDC->Open(&dpDesc); + + if (hr != DP_OK) + { + lpIDC->Close(); + lpIDC->Release(); + lpIDC = NULL; + EndDialog(hDlg, FALSE); + } + + EndDialog(hDlg, TRUE); + return(TRUE); + + } + } + } + return (FALSE); +} + +INT GetProvider() +{ + + return(DialogBox (NULL, (LPCTSTR) IDD_CHOOSEPROVIDER, NULL, (DLGPROC) DlgProcChooseProvider)); +} + +INT CreateGame() +{ + return(DialogBox (NULL, (LPCTSTR) IDD_Q_CREATE, NULL, (DLGPROC) DlgProcQCreate)); + +} + +INT GetGame() +{ + + return(DialogBox (NULL, (LPCTSTR) IDD_SELSESSION, NULL, (DLGPROC) DlgProcSelSession)); +} + +BOOL RemoteCreateLobby(void) +{ + LPDIRECTPLAY2A lpDPlay2 = NULL; + LPDIRECTPLAYLOBBYA lpDPLobby = NULL; + HRESULT hr; + + // Be sure we aren't already initialized. + if (lpIDC != NULL) + { + return( FALSE ); + } + + // create a lobby object + hr = DirectPlayLobbyCreate(NULL, &lpDPLobby, NULL, NULL, 0); + if FAILED(hr) + return (FALSE); + + // try to connect using the lobby + hr = lpDPLobby->Connect(0, &lpDPlay2, NULL) ; + + // lobby launched us, so get a DirectPlay 1 interface + if SUCCEEDED(hr) + { + // query for a DirectPlay 1.0 interface + hr = lpDPlay2->QueryInterface(IID_IDirectPlay, (LPVOID *) &lpIDC); + + // release the ANSI DirectPlay2 interface + lpDPlay2->Release(); + } + + // release lobby interface + lpDPLobby->Release(); + + return ((BOOL)(hr == DP_OK)); +} + +BOOL RemoteCreate(REFGUID pGuid, LPSTR FullName, LPSTR NickName) +{ + HRESULT hr; + DPSESSIONDESC dpDesc; + + // lobby did not launch us, so ask user for connection settings + if (lpIDC == NULL) + { + GetProvider(); + + if (lpIDC == NULL) + return(FALSE); + + switch( CreateGame()) + { + case 1: // Create + memset(&dpDesc, 0x00, sizeof(DPSESSIONDESC)); + dpDesc.dwSize = sizeof(dpDesc); + dpDesc.dwMaxPlayers = 10; + dpDesc.dwFlags = DPOPEN_CREATESESSION; + dpDesc.guidSession = pGuid; + strcpy( dpDesc.szSessionName, FullName); + + if ((hr = lpIDC->Open(&dpDesc)) != DP_OK) + { + lpIDC->Release(); + lpIDC = NULL; + return(FALSE); + } + + break; + + case 2: // Connect + g_lpGuid = (LPGUID) &pGuid; + + GetGame(); + + if (lpIDC == NULL) + return(FALSE); + + break; + + default: + return(FALSE); + } + } + + if ((hr = lpIDC->CreatePlayer(&dcoID, NickName, + "IKlowns Player", &dphEvent)) != DP_OK) + { + lpIDC->Close(); + lpIDC->Release(); + lpIDC = NULL; + return(FALSE); + } + + + InitReceivePoll(); + return(TRUE); + +} + + +// ----------------------------------------------------------------- +// SetCurrentLevel - set pointer to current level object +// ----------------------------------------------------------------- +void SetCurrentLevel( + void *newLevel +) +{ + gCurLevel = (CGameLevel *)newLevel; +} + +// ---------------------------------------------------------- +// CreateNewCharacter - create a new game object! +// ---------------------------------------------------------- +void CreateNewCharacter( + REMOTE_OBJECT *pObj // unique object id +) +{ + char dataBuf[256]; + char graphicsBuf[256]; + + // Get specific data on object from profile + // NOTE: This means we hit the disk. For performance, + // it would be better if objects could be created based + // on an in memory object so that we don't ever have to + // hit the disk! + + + GetPrivateProfileString( + gCurLevel->GetLevelName(), + "Graphics", + "", + graphicsBuf, + sizeof( graphicsBuf ), + gCurLevel->GetProfileName() + ); + + GetPrivateProfileString( + graphicsBuf, + pObj->ObjectID, + "", + dataBuf, + sizeof( dataBuf ), + gCurLevel->GetProfileName() + ); + + // parse the data string into fields + CStringRecord fields( dataBuf, "," ); + + if (fields.GetNumFields() >= 5) + { + // Add the object to the game list! + gCurLevel->Add(pObj->ObjectID, + atoi(fields[1]), + atoi(fields[3]), + atoi(fields[4]), + (void *)pObj); + } +} + +// ---------------------------------------------------------- +// ProcessIncomingActions - Parse received messages & queue them +// ---------------------------------------------------------- +BOOL ProcessIncomingActions( + REMOTE_OBJECT *pObj, // unique object id + ACTION action, // action code + void *Data, // action data + DWORD nDataSize // sizeof action data +) +{ + CLinkedList *ActionList; + BOOL fQueuedUp = FALSE; + // char chBuffer[128]; + + // wsprintf( chBuffer, "IncomingAction %d size %d\r\n", action, nDataSize); + // OutputDebugString(chBuffer); + + // Guard against activity occurring before we are ready! + if (gCurLevel == NULL) + return(FALSE); + + // Don't do anything about our own requests + if (pObj->OwnerID == dcoID) + return(FALSE); + + // Figure out what to do with this message + switch (action) { + + // Need to create a brand new object locally + case CREATE_OBJECT: { + + // OutputDebugString("CreateObject \r\n"); + // Create a game character + if (!FindRemoteObjectEntry(pObj)) + { + // OutputDebugString("CreateNewCharacter \r\n"); + CreateNewCharacter(pObj); + } + // OutputDebugString("Leave CreateObject \r\n"); + break; + } + + // Time to destroy the object! + case DESTROY_OBJECT: { + REMOTE_DATA *pRemoteEntry = FindRemoteObjectEntry(pObj); + + // OutputDebugString("DestroyObject \r\n"); + // Need to tell level object to remove the character! + if (pRemoteEntry != NULL) + gCurLevel->Remove((CGameGraphic *)pRemoteEntry->Data); + + break; + } + + // Must be some character specific action + default:{ + + // Get action list for this object + ActionList = GetRemoteObjectQueue(pObj); + + // No action list -> a new object, so try to create it. + if (ActionList == NULL) + { + CreateNewCharacter(pObj); + ActionList = GetRemoteObjectQueue(pObj); + if (ActionList == NULL) + return(FALSE); + } + + // Place this action onto the queue + // OutputDebugString("QueueRemoteAction \r\n"); + QueueRemoteAction(ActionList, action, Data, nDataSize); + fQueuedUp = TRUE; + break; + } + } + return(fQueuedUp); +} + +// ---------------------------------------------------------- +// ReleaseRemoteData - free remote buffer +// ---------------------------------------------------------- +void ReleaseRemoteData( + LPVOID pData // ptr to app data portion +) +{ + PGAMEMESSAGE pMsg; // desired pointer + int iDiff; // difference between the two + + // Pretend we got passed in the proper ptr + pMsg = (PGAMEMESSAGE)pData; + + // Calculate the difference between what we got + // and what we need. + iDiff = (LPBYTE)(&pMsg->Data) - (LPBYTE)(pMsg); + + // Adjust accordingly and free the message! + pMsg = (PGAMEMESSAGE)((LPBYTE)pMsg - iDiff); + delete pMsg; +} + +#define MAX_BUFFER_SIZE (sizeof(GAMEMESSAGE)+512) + + + + +static char *pBuffer = NULL; +static DWORD lenBuff = MAX_BUFFER_SIZE; + +static void InitReceivePoll( void ) +{ + // We allocate a buffer to receive into first, + // which may have to cope with system messages, + // before copying the real message to the buffer to pass + // to the game + pBuffer = new char[ lenBuff ]; + +} + +void PollForRemoteReceive( void ) +{ + DPID fromID, dcoReceiveID; + DWORD nBytes; + PGAMEMESSAGE pMsg; + int i; + const int MAX_MESSAGES = 16; + BOOL fCheckForMore = TRUE; + + // Paranoia check + if ( lpIDC ) + { + // We try to receive MAX_MESSAGES at a time so that + // a backlog doesn't build up. If we run out of messages, + // we stop looking for them. + + for( i = 0; i < MAX_MESSAGES && fCheckForMore ; i++ ) + { + HRESULT status; + nBytes = lenBuff; + status = lpIDC->Receive( + &fromID, + &dcoReceiveID, + DPRECEIVE_ALL, + pBuffer, + &nBytes); + switch( status ) + { + case DP_OK: + if ( fromID == 0 ) + { + // We do not in fact utilise the system + // messages during the game. + } + else + { + // User message - we copy the buffer minus the + // user message byte to the game buffer, then + // pass it on. + + // Allocate buffer for game message + pMsg = (PGAMEMESSAGE)new char [MAX_BUFFER_SIZE]; + memcpy( pMsg, &pBuffer[0], nBytes ); + + if (!ProcessIncomingActions(&pMsg->RemObj, pMsg->Action, + pMsg->Data, nBytes)) + delete pMsg; + } + break; + + default: + // Error condition of some kind - we just stop + // checking for now + fCheckForMore = FALSE; + break; + } + } + } +} + + +BOOL CALLBACK AbortDlgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) +{ + WORD wID, wNotifyCode; + BOOL retVal = 0; + + switch( uMsg ) + { + case WM_INITDIALOG: + // We didn't set focus + retVal = 1; + break; + case WM_COMMAND: + wID = LOWORD( wParam ); + wNotifyCode = HIWORD( wParam ); + switch ( wID ) + { + case IDCANCEL: + if ( BN_CLICKED == wNotifyCode ) { + fAbort = TRUE; + retVal = 1; + } + break; + default: + break; + } + break; + } + return( retVal ); +} diff --git a/sdk/samples/iklowns/cgremote.h b/sdk/samples/iklowns/cgremote.h new file mode 100644 index 0000000..5723ecd --- /dev/null +++ b/sdk/samples/iklowns/cgremote.h @@ -0,0 +1,88 @@ +/*===========================================================================*\ +| +| File: cgremote.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef _CGREMOTE_H +#define _CGREMOTE_H +#include "linklist.h" +#include "dplay.h" + +#define MAX_OBJ_NAME 9 + +typedef int ACTION; +typedef char OBJ_ID[MAX_OBJ_NAME]; + +typedef struct +{ + BYTE InstanceID; + BYTE OwnerID; + OBJ_ID ObjectID; +} REMOTE_OBJECT; + +#include "cgremque.h" + +#define CREATE_OBJECT 0x81 +#define DESTROY_OBJECT 0x82 + +REMOTE_OBJECT *CreateRemotePeers( + char *name, + DWORD InstanceID +); + +inline ACTION PollRemoteAction( + REMOTE_OBJECT *pObj, + void *&Data, + DWORD &nDataSize +) +{ + return(GetNextRemoteAction(GetRemoteObjectQueue(pObj), Data, nDataSize)); +} + +BOOL SendRemoteAction( + REMOTE_OBJECT *pObj, + ACTION Action, + void *Data, + DWORD nDataSize +); + +void ReleaseRemoteData(void *); + +BOOL DestroyRemotePeer( + REMOTE_OBJECT *pObj +); + +BOOL RemoteCreateLobby(void); +BOOL RemoteConnect(REFGUID pGuid, LPSTR FullName, LPSTR NickName); +BOOL RemoteCreate(REFGUID pGuid, LPSTR FullName, LPSTR NickName); + +class CGameInput; + + +void SetCurrentLevel(void *); + +#endif + diff --git a/sdk/samples/iklowns/cgremque.cpp b/sdk/samples/iklowns/cgremque.cpp new file mode 100644 index 0000000..4c33e62 --- /dev/null +++ b/sdk/samples/iklowns/cgremque.cpp @@ -0,0 +1,227 @@ +/*===========================================================================*\ +| +| File: cgremque.cpp +| +| Description: +| Routines to create and manage received remote actions +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +//** include files ** +#ifndef __WATCOMC__ +#define WIN32_LEAN_AND_MEAN +#endif +#include <windows.h> +#include <windowsx.h> +#include "linklist.h" +#include "dplay.h" +#include "cgremote.h" + +//** local definitions ** + +// Entry for object action in action queue +typedef struct +{ + ACTION Action; + DWORD nBytes; + void *Data; +} ACTION_ENTRY; + +//** external functions ** + +//** external data ** + +//** public data ** +//** private data ** + +// Master list of objects controlled by remote peers +static CLinkedList RemoteObjectList; + +//** public functions ** +//** private functions ** + +// ---------------------------------------------------------- +// CreateRemoteObjectQueue - register a new object and create an +// action queue for it! +// ---------------------------------------------------------- +CLinkedList *CreateRemoteObjectQueue( + REMOTE_OBJECT *pObj, // unique object id + void *Data // game character this pointer +) +{ + if (pObj == NULL) + return(NULL); + + // Create an object entry for the master list + REMOTE_DATA *pRemoteEntry = new REMOTE_DATA; + + // Initialize the object entry and add it to the list! + memcpy(&pRemoteEntry->RemObj, pObj, sizeof(REMOTE_OBJECT)); + pRemoteEntry->Data = Data; + pRemoteEntry->ActionList = new CLinkedList; + RemoteObjectList.Add((void *)pRemoteEntry); + + return(pRemoteEntry->ActionList); +} + +// ---------------------------------------------------------- +// FindRemoteObjectEntry - search list of registered objects +// and return its data +// ---------------------------------------------------------- +REMOTE_DATA *FindRemoteObjectEntry( + REMOTE_OBJECT *pObj // unique object id +) +{ + REMOTE_DATA *pRemoteEntry=NULL; + + // Beware of wise guys! + if (pObj == NULL) + return(NULL); + + // Search master object list for desired object entry + pRemoteEntry = (REMOTE_DATA *)RemoteObjectList.GetFirst(); + while (pRemoteEntry != NULL) + { + if (memcmp(&pRemoteEntry->RemObj, pObj, sizeof(REMOTE_OBJECT)) == 0) + { + break; + } + pRemoteEntry = (REMOTE_DATA *) RemoteObjectList.GetNext(); + } + return(pRemoteEntry); +} + +// ---------------------------------------------------------- +// DestroyRemoteObjectQueue - destroy an objects action queue +// and remove it from the list of known objects. +// ---------------------------------------------------------- +void DestroyRemoteObjectQueue( + REMOTE_OBJECT *pObj // unique object id +) +{ + REMOTE_DATA *pRemoteEntry; + + // If there is an entry in the master list, remove it! + pRemoteEntry = FindRemoteObjectEntry(pObj); + if (pRemoteEntry != NULL) + { + RemoteObjectList.Remove((void *)pRemoteEntry); + delete pRemoteEntry; + } +} + +// ---------------------------------------------------------- +// GetRemoteObjectQueue - get a pointer to the action queue +// ---------------------------------------------------------- +CLinkedList *GetRemoteObjectQueue( + REMOTE_OBJECT *pObj // unique object id +) +{ + REMOTE_DATA *pRemoteEntry; + + // Look up object in master list and return a ptr to + // its action queue + pRemoteEntry = FindRemoteObjectEntry(pObj); + if (pRemoteEntry != NULL) + return(pRemoteEntry->ActionList); + else + return(NULL); + +} + +// ---------------------------------------------------------- +// GetRemoteObjectData - retrieve an objects data value +// ---------------------------------------------------------- +void *GetRemoteObjectData( + REMOTE_OBJECT *pObj // unique object id +) +{ + REMOTE_DATA *pRemoteEntry; + + // Look up object in master list and return its data value + pRemoteEntry = FindRemoteObjectEntry(pObj); + if (pRemoteEntry != NULL) + return(pRemoteEntry->Data); + else + return(NULL); + +} + +// ---------------------------------------------------------- +// QueueRemoteAction - place an action onto the objects queue +// ---------------------------------------------------------- +BOOL QueueRemoteAction( + CLinkedList *pQueue, // object's action queue + ACTION Action, // action code + void *Data, // action data + DWORD nBytes // size of action data +) +{ + // Be sure action queue is valid! + if (pQueue == NULL) + return(FALSE); + + // Place a new action entry on the queue + ACTION_ENTRY *pAction = new ACTION_ENTRY; + + pAction->Action = Action; + pAction->nBytes = nBytes; + pAction->Data = Data; + pQueue->Append((void *)pAction); + return(TRUE); +} + +// ---------------------------------------------------------- +// GetNextRemoteAction - get the next action on the objects queue +// ---------------------------------------------------------- +ACTION GetNextRemoteAction( + CLinkedList *pQueue, // object's action queue + void *&Data, // ptr to a data ptr + DWORD &nBytes // size of action data +) +{ + ACTION_ENTRY *pAction; + ACTION Action=-1; + + // Be sure action queue is valid + if (pQueue == NULL) + return(-1); + + // Take first action off queue + pAction = (ACTION_ENTRY *)pQueue->RemoveFirst(); + + // If there is an action, set information for caller + if (pAction != NULL) + { + Data = pAction->Data; + nBytes = pAction->nBytes; + Action = pAction->Action; + + // Dispose of the action entry memory, the caller should + // delete the actual data itself (using ReleaseRemoteData) + delete pAction; + } + + return(Action); +} diff --git a/sdk/samples/iklowns/cgremque.h b/sdk/samples/iklowns/cgremque.h new file mode 100644 index 0000000..e44caf7 --- /dev/null +++ b/sdk/samples/iklowns/cgremque.h @@ -0,0 +1,48 @@ +/*===========================================================================*\ +| +| File: cgremque.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef _CGREMQUE_H +#define _CGREMQUE_H + +// Entry for object in master object list +typedef struct +{ + REMOTE_OBJECT RemObj; + void *Data; + CLinkedList *ActionList; +} REMOTE_DATA; + +CLinkedList *CreateRemoteObjectQueue(REMOTE_OBJECT *, void *); +void DestroyRemoteObjectQueue(REMOTE_OBJECT *); +CLinkedList *GetRemoteObjectQueue(REMOTE_OBJECT *); + +ACTION GetNextRemoteAction(CLinkedList *, void *&, DWORD &); +BOOL QueueRemoteAction(CLinkedList *, ACTION, void *, DWORD); + +REMOTE_DATA *FindRemoteObjectEntry(REMOTE_OBJECT *); +#endif diff --git a/sdk/samples/iklowns/cgres.cpp b/sdk/samples/iklowns/cgres.cpp new file mode 100644 index 0000000..5988a2a --- /dev/null +++ b/sdk/samples/iklowns/cgres.cpp @@ -0,0 +1,52 @@ +/*===========================================================================*\ +| +| File: cgres.cpp +| +| Description: +| Class implemetation for handling string resources +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +#include "cgexcpt.h" +#include "cgres.h" + +/*---------------------------------------------------------------------------*\ +| +| Class CGameStringResource +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ + +CGameStringResource::CGameStringResource( + HINSTANCE hInst, // as passed to LoadString + UINT resId // ID of the string + ) +{ + mString[0] = '\0'; + if (!LoadString( + hInst, + resId, + mString, + MAX_STRING_LENGTH + ) + ) + { + // nasty business! we may be in an exception already, so be careful + throw CGameResourceError(); + } + +} + +CGameStringResource::~CGameStringResource() +{ + +} diff --git a/sdk/samples/iklowns/cgrsrce.h b/sdk/samples/iklowns/cgrsrce.h new file mode 100644 index 0000000..9479887 --- /dev/null +++ b/sdk/samples/iklowns/cgrsrce.h @@ -0,0 +1,105 @@ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by iklowns.rc +// +#define IDS_INFO_TITLE 1 +#define IDS_ERROR_TITLE 2 +#define IDS_INVALID_FILE 3 +#define IDS_GDI_ERROR 4 +#define IDS_STARTUP_ERROR 5 +#define IDR_GENERIC 101 +#define IDI_APP 102 +#define IDD_ABOUTBOX 103 +#define IDR_ACCELERATOR1 106 +#define IDD_REMCONNABORTDLG 106 +#define IDD_Q_CREATE 108 +#define IDD_OPTIONS 109 +#define IDD_CHOOSEPROVIDER 129 +#define IDD_SELSESSION 130 +#define IDC_FILEDESCRIPTION 1000 +#define IDC_PRODUCTVERSION 1001 +#define IDC_LEGALCOPYRIGHT 1002 +#define IDC_COMPANYNAME 1003 +#define IDC_LEGALTRADEMARKS 1004 +#define IDC_CREATE 1005 +#define IDC_CONNECT 1006 +#define IDC_LISTOPTION 1009 +#define IDC_LIST1 1021 +#define IDC_LB_SESSION 1024 +#define OPTION_PLAY_START 2001 +#define IDS_SOLO_PLAY 2001 +#define IDS_TWO_PLAYER 2002 +#define IDS_NET_PLAY 2003 +#define IDS_QUIT_GAME 2004 +#define OPTION_PLAY_END 2004 +#define IDS_INSTRUCTION_1 2005 +#define IDS_INSTRUCTION_2 2006 +#define CREDIT_START 2100 +#define IDS_LOAD_MSG 2200 +#define IDS_WIN_START 2300 +#define IDS_WIN_1 2300 +#define IDS_WIN_2 2301 +#define IDS_WIN_3 2302 +#define IDS_WIN_4 2303 +#define IDS_WIN_5 2304 +#define IDS_WIN_6 2305 +#define IDS_WIN_END IDS_WIN_6 +#define IDS_LOSE_START 2400 +#define IDS_LOSE_1 2400 +#define IDS_LOSE_2 2401 +#define IDS_LOSE_3 2402 +#define IDS_LOSE_4 2403 +#define IDS_LOSE_5 2404 +#define IDS_LOSE_6 2405 +#define IDS_LOSE_END IDS_LOSE_6 +#define NET_GAME_OPTION 2410 +#define IDM_NEW 40001 +#define IDM_OPEN 40002 +#define IDM_SAVE 40003 +#define IDM_SAVEAS 40004 +#define IDM_PRINT 40005 +#define IDM_PRINTSETUP 40006 +#define IDM_EXIT 40007 +#define IDM_UNDO 40008 +#define IDM_CUT 40009 +#define IDM_COPY 40010 +#define IDM_PASTE 40011 +#define IDM_LINK 40012 +#define IDM_LINKS 40013 +#define IDM_HELPCONTENTS 40014 +#define IDM_HELPSEARCH 40015 +#define IDM_HELPHELP 40016 +#define IDM_ABOUT 40017 +#define IDA_LEFT 40018 +#define IDA_RIGHT 40019 +#define IDA_UP 40020 +#define IDA_DOWN 40021 +#define IDA_RETURN 40022 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 110 +#define _APS_NEXT_COMMAND_VALUE 40023 +#define _APS_NEXT_CONTROL_VALUE 1010 +#define _APS_NEXT_SYMED_VALUE 104 +#endif +#endif diff --git a/sdk/samples/iklowns/cgscene.cpp b/sdk/samples/iklowns/cgscene.cpp new file mode 100644 index 0000000..6dcd2aa --- /dev/null +++ b/sdk/samples/iklowns/cgscene.cpp @@ -0,0 +1,130 @@ +/*===========================================================================*\ +| +| File: cgscene.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include "cgdebug.h" +#include "cgimage.h" +#include "cgscene.h" + +#define MAX_IMAGES 4 + +/*---------------------------------------------------------------------------*\ +| +| Class CGameScene +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ +CGameScene::CGameScene( + ) +{ +} + +CGameScene::~CGameScene() +{ +} + + +/*---------------------------------------------------------------------------*\ +| +| Class CGameGruberScene +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ +CGameGruberScene::CGameGruberScene( + char* pFileName, + char* pSceneName + ) : CGameScene(), + mpImages( NULL ) +{ + // get the image info + char nameBuf[256]; + CGameGruberImage* tempImages[MAX_IMAGES]; + + // load all images for this scene + GetPrivateProfileString( + pSceneName, + NULL, // grab all the keys + "", // no default + nameBuf, + sizeof( nameBuf ), + pFileName + ); + + for (char *pImage = nameBuf; *pImage && (mNumImages < MAX_IMAGES); pImage++, mNumImages++) + { + tempImages[mNumImages] = new CGameGruberImage( pImage ); + pImage += lstrlen( pImage ); // move beyond terminator + } + + // now that we know how many there are, allocate our array & copy the temp + mpImages = new CGameGruberImage*[ mNumImages ]; + CopyMemory( mpImages, tempImages, mNumImages * sizeof( CGameGruberImage* ) ); + + // !!! for now use 1st image for size + mMaxX = mpImages[0]->GetWidth(); + mMaxY = mpImages[0]->GetHeight(); +} + +CGameGruberScene::~CGameGruberScene() +{ + if (mpImages) + { + for (; mNumImages>0; mNumImages--) + { + delete mpImages[mNumImages-1]; + } + + delete[] mpImages; + } +} + +BOOL +CGameGruberScene::ScrollTo( + int x, + int y + ) +{ + // !!! for now, assume 1 image + return mpImages[0]->ScrollTo(x, y); +} + +void +CGameGruberScene::Render( + CGameGDIScreen* pScreen + ) +{ + // !!! for now, assume 1 image + mpImages[0]->Render( pScreen ); +} diff --git a/sdk/samples/iklowns/cgscreen.cpp b/sdk/samples/iklowns/cgscreen.cpp new file mode 100644 index 0000000..bd58dad --- /dev/null +++ b/sdk/samples/iklowns/cgscreen.cpp @@ -0,0 +1,506 @@ +/*===========================================================================*\ +| +| File: cgscreen.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include <windowsx.h> +#include "cgdebug.h" +#include "cgbitbuf.h" +#include "cgscreen.h" + +// read a .pal file & convert to PALETTEENTRY array +void +ReadPalFile( char* pFile, LPPALETTEENTRY ppe, int count ) +{ + int fh; + WORD i; + unsigned char pRgb[4]; + + fh = _lopen( pFile, OF_READ); + if( fh == -1 ) + { + DB_LOG(DB_PROBLEM, "Can't open palette file."); + return; + } + + _llseek(fh, 24, SEEK_SET); + + for( i=0; i < min(256, count); i++ ) + { + if( sizeof (pRgb) != _lread (fh, pRgb, sizeof (pRgb))) + { + _lclose( fh ); + return; + } + ppe[i].peRed = (BYTE)pRgb[0]; + ppe[i].peGreen = (BYTE)pRgb[1]; + ppe[i].peBlue = (BYTE)pRgb[2]; + } + + ppe[0].peRed = (BYTE)0; + ppe[0].peGreen = (BYTE)0; + ppe[0].peBlue = (BYTE)0; + + if (count >= 256) + { + ppe[255].peRed = (BYTE)255; + ppe[255].peGreen = (BYTE)255; + ppe[255].peBlue = (BYTE)255; + } + + _lclose( fh ); +} + +/*---------------------------------------------------------------------------*\ +| +| Class CGameScreen +| +| DESCRIPTION: +| Encapsulates access to video display in Manhattan sample game +| +| +\*---------------------------------------------------------------------------*/ +CGameScreen::CGameScreen( + HWND hwnd, // this window determines "screen" size + int logWidth, + int logHeight, + int orgX, + int orgY + ) : mxCurrent( orgX ), + myCurrent( orgY ), + mhwnd( hwnd ), + mOutWidth( 0 ), + mOutHeight( 0 ), + mOldPalette( NULL ) +{ + DB_CHECK( hwnd, "DEBUG: NULL hwnd in CGameScreen."); + + if (hwnd) + { + HDC hdc = GetDC( hwnd ); + + // save previous palette + mOldPalette = (HPALETTE)GetCurrentObject( hdc, OBJ_PAL ); + + //now tell Windows to let us set our palette +// SetSystemPaletteUse( hdc, SYSPAL_NOSTATIC ); + + // determine size of output bitmap + if (GetClientRect( hwnd, &mScreenRect )) + { + mOutWidth = mScreenRect.right; + mOutHeight = mScreenRect.bottom; + + PatBlt(hdc, 0,0,mOutWidth,mOutHeight,BLACKNESS); + } + else + { + DB_LOG( DB_PROBLEM, "DEBUG: GetClientRect failed in CGameScreen" ); + } + + ReleaseDC( hwnd, hdc ); + } +} + +CGameScreen::~CGameScreen() +{ + HDC hdc = GetDC( HWND_DESKTOP ); + + PatBlt(hdc, 0,0,mOutWidth,mOutHeight,BLACKNESS); + if (mOldPalette) + { + SelectPalette( hdc, mOldPalette, FALSE ); + } + +// SetSystemPaletteUse( hdc, SYSPAL_STATIC ); + RealizePalette( hdc ); + + ReleaseDC( HWND_DESKTOP, hdc ); +} + +void CGameScreen::SetPalette(HPALETTE hPal) +{ + HDC hdc = GetDC( HWND_DESKTOP ); + + SelectPalette( hdc, hPal, FALSE ); + + RealizePalette( hdc ); + + ReleaseDC( HWND_DESKTOP, hdc ); +} + +/*---------------------------------------------------------------------------*\ +| +| Class CGameDDrawScreen +| +| DESCRIPTION: +| provide screen access via DirectDraw +| +| +\*---------------------------------------------------------------------------*/ + +#define FRONT_BUFFER 0 +#define BACK_BUFFER 1 + +CGameDDrawScreen::CGameDDrawScreen( + HWND hwnd, // this window determines "screen" size + int logWidth, + int logHeight, + int orgX, + int orgY + ) : CGameScreen( hwnd, logWidth, orgX, orgY ), + mBackSurface( 1 ) +{ + // create the primary surfaces (front & back) + mpSurfaces[0] = new CGameDDrawScreenBuffer; + mpSurfaces[1] = new CGameDDrawScreenBuffer(mpSurfaces[0]); +} + +CGameDDrawScreen::~CGameDDrawScreen() +{ + delete mpSurfaces[1]; + delete mpSurfaces[0]; +} + +void CGameDDrawScreen::Render( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc, + DWORD rop + ) +{ + pSrcBuffer->BltDDraw( + mpSurfaces[BACK_BUFFER], + xDest, + yDest, + wDest, + hDest, + xSrc, + ySrc, + rop + ); +} + +void CGameDDrawScreen::TransRender( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc + ) +{ + pSrcBuffer->TransBltDDraw( + (CGameDDrawBitBuffer*) mpSurfaces[BACK_BUFFER], + xDest, + yDest, + wDest, + hDest, + xSrc, + ySrc, + 1 + ); +} + +void CGameDDrawScreen::PageFlip() +{ + HRESULT result; + + int stopCount = DDRAW_RETRY; + + do + { + result = mpSurfaces[FRONT_BUFFER]->mpSurface->Flip( + NULL, DDFLIP_WAIT ); + if (result == DDERR_SURFACELOST ) + { + mpSurfaces[FRONT_BUFFER]->mpSurface->Restore(); + mpSurfaces[BACK_BUFFER]->mpSurface->Restore(); + } + } + while( (result != DD_OK) && (--stopCount > 0)); +} + +void +CGameDDrawScreen::SetMode( + int width, + int height, + int bits + ) +{ + mpSurfaces[FRONT_BUFFER]->SetMode( + width, + height, + bits + ); +} + +void +CGameDDrawScreen::ShowGDIPage() +{ + mpSurfaces[FRONT_BUFFER]->ShowGDIPage(); +} + +void +CGameDDrawScreen::RestoreMode() +{ + mpSurfaces[FRONT_BUFFER]->RestoreMode(); +} + +void +CGameDDrawScreen::Refresh() +{ + mpSurfaces[FRONT_BUFFER]->mpSurface->Restore(); + mpSurfaces[BACK_BUFFER]->mpSurface->Restore(); +} + + +void +CGameDDrawScreen::ColorFill( + LPRECT pRect, + int palIndex + ) +{ + HRESULT result; + DDBLTFX dbf; + RECT tempR = *pRect; + + // rects are off by one + tempR.right++; + tempR.bottom++; + + memset( &dbf, 0, sizeof( dbf ) ); + dbf.dwSize = sizeof(dbf); + dbf.dwFillColor = palIndex; + + int stopCount = DDRAW_RETRY; + + do + { + result = mpSurfaces[BACK_BUFFER]->mpSurface->Blt( + &tempR, // dest rect + NULL, // src surf + NULL, // src rect + DDBLT_COLORFILL,// flags + &dbf ); // bltfx + + // surface may have been lost due to mode switch + if (result == DDERR_SURFACELOST) + { + mpSurfaces[FRONT_BUFFER]->mpSurface->Restore(); + mpSurfaces[BACK_BUFFER]->mpSurface->Restore(); + continue; + } + } + while( (result != DD_OK) && (--stopCount > 0)); +} + +// read in a .pal file & set our palette to it +void CGameDDrawScreen::SetPalette( char* pFile ) +{ + LPPALETTEENTRY ppe; + + ppe = new PALETTEENTRY[256]; + + ReadPalFile( pFile, ppe, 256 ); + + mpSurfaces[FRONT_BUFFER]->SetPalette( ppe ); + delete[] ppe; +} + +int +CGameDDrawScreen::GetVideoMemory() +{ + return mpSurfaces[FRONT_BUFFER]->GetVideoMemory(); +} + +/*---------------------------------------------------------------------------*\ +| +| Class CGameDSScreen +| +| DESCRIPTION: +| provide screen access via CreateDIBSection +| +| +\*---------------------------------------------------------------------------*/ + +CGameDSScreen::CGameDSScreen( + HWND hwnd, // this window determines "screen" size + int logWidth, + int logHeight, + int orgX, + int orgY + ) : CGameScreen( hwnd, logWidth, orgX, orgY ) +{ + LOGPALETTE* pPal; + HPALETTE hOurPal = NULL; + + pPal = (LOGPALETTE*) GlobalAllocPtr( LPTR, sizeof(LOGPALETTE) + 256 * sizeof(PALETTEENTRY) ); + + if (pPal) + { + pPal->palNumEntries = 256; + pPal->palVersion = 0x300; + + ReadPalFile( "iklowns.pal", pPal->palPalEntry, 256 ); + + hOurPal = CreatePalette( pPal ); + } + + GlobalFreePtr( pPal ); + + // create the primary surfaces (front & back) + mpScreenDIB = new CGameDIB( logWidth, logHeight, hOurPal ); + mpBufferDIB = new CGameDIB( logWidth, logHeight, hOurPal ); + + if (hwnd) + { + mhdcOut = GetDC( hwnd ); + + mhdcBackBuffer = CreateCompatibleDC( mhdcOut ); + + SelectPalette( mhdcOut, hOurPal, FALSE ); + RealizePalette( mhdcOut ); + + SelectPalette( mhdcBackBuffer, hOurPal, FALSE ); + RealizePalette( mhdcBackBuffer ); + + HBITMAP hbmOld = (HBITMAP)SelectObject( mhdcBackBuffer, mpBufferDIB->GetHBitmap() ); + + if (hbmOld) + DeleteObject( hbmOld ); + } + +} + +CGameDSScreen::~CGameDSScreen() +{ + if (mhdcOut) + { + // restore the old palette + if (mOldPalette) + SelectPalette( mhdcOut, mOldPalette, FALSE ); + + ReleaseDC( mhwnd, mhdcOut ); + } + + // free up the backbuffer DC + if (mhdcBackBuffer) + DeleteDC( mhdcBackBuffer ); + + delete mpBufferDIB; + delete mpScreenDIB; +} + +void CGameDSScreen::Render( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc, + DWORD rop + ) +{ + int scanDest = mpBufferDIB->BytesPerScanline(); + int scanSrc = ((CGameDSBitBuffer*)pSrcBuffer)->mpDIB->BytesPerScanline(); + + CopyDIBBits( + mpBufferDIB->GetPixelAddress( xDest, yDest ), + ((CGameDSBitBuffer*)pSrcBuffer)->mpDIB->GetPixelAddress( xSrc, ySrc ), + wDest, // width pixels + hDest, + (DWORD) -scanDest, + (DWORD) -scanSrc + ); +} + +void CGameDSScreen::TransRender( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc + ) +{ + int scanDest = mpBufferDIB->BytesPerScanline(); + int scanSrc = ((CGameDSBitBuffer*)pSrcBuffer)->mpDIB->BytesPerScanline(); + + TransCopyDIBBits( + mpBufferDIB->GetPixelAddress( xDest, yDest ), + ((CGameDSBitBuffer*)pSrcBuffer)->mpDIB->GetPixelAddress( xSrc, ySrc ), + wDest, // width pixels + hDest, + (DWORD) -scanDest, + (DWORD) -scanSrc, + 1 + ); +} + +// we emulate page flipping by simply blitting from back to front +void CGameDSScreen::PageFlip() +{ + BitBlt( mhdcOut, 0, 0, mOutWidth, mOutHeight, mhdcBackBuffer, 0, 0, SRCCOPY ); +} + +void +CGameDSScreen::ColorFill( + LPRECT pRect, + int palIndex + ) +{ + LPBYTE lpdest; + int bytes = pRect->right - pRect->left + 1; + + for (int line=pRect->top; line<=pRect->bottom; line++) + { + lpdest = mpBufferDIB->GetPixelAddress( pRect->left, line ); + memset( lpdest, palIndex, bytes ); + } +} + +void CGameDSScreen::SetPalette(HPALETTE hPal) +{ + CGameScreen::SetPalette( hPal ); + + SelectPalette( mhdcBackBuffer, hPal, FALSE ); + RealizePalette( mhdcBackBuffer ); +} + +// read in a .pal file & set our palette to it +void CGameDSScreen::SetPalette( char* pFile ) +{ +} diff --git a/sdk/samples/iklowns/cgscreen.h b/sdk/samples/iklowns/cgscreen.h new file mode 100644 index 0000000..9a49472 --- /dev/null +++ b/sdk/samples/iklowns/cgscreen.h @@ -0,0 +1,208 @@ +/*===========================================================================*\ +| +| File: cgscreen.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef CGSCREEN_H +#define CGSCREEN_H + +#include <windows.h> +#include <ddraw.h> +#include "cgbitbuf.h" + +enum ST_TYPE +{ + ST_ROOT, // CGameScreen -- abstract base class + ST_DDraw, // CGameDDrawScreen -- Direct Draw screen + ST_DS // CGameDSScreen -- DIBSections screen +}; + +class CGameScreen +{ +public: + CGameScreen(HWND hwnd, int logWidth, int logHeight, int orgX=0, int orgY=0); + virtual ~CGameScreen(); + + virtual void SetPalette(HPALETTE); + virtual void SetPalette( char* ) = 0; + + virtual void Render( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc, + DWORD rop + ){}; + + // render with transparency mask + virtual void TransRender( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc + ) = 0; + + virtual void PageFlip()=0; + virtual void SetMode( int width, int height, int bits )=0; + virtual void RestoreMode()=0; + + virtual void ColorFill( LPRECT pRect, int palIndex )=0; + + // report this object's type + virtual ST_TYPE TypeID() + { + return ST_ROOT; + } + + virtual void Refresh() + { + } + +protected: + HWND mhwnd; // parent window + int mOutWidth; // width of output screen + int mOutHeight; // height of output screen + RECT mScreenRect; // describes entire screen + + int mxCurrent; // current x scroll position + int myCurrent; // current y scroll position + + HPALETTE mOldPalette; // saved to restore when object goes away +}; + +class CGameDDrawScreen : public CGameScreen +{ +public: + CGameDDrawScreen(HWND hwnd, int logWidth, int logHeight, int orgX=0, int orgY=0); + virtual ~CGameDDrawScreen(); + + virtual void Render( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc, + DWORD rop + ); + + // render with transparency mask + virtual void TransRender( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc + ); + + virtual void PageFlip(); + virtual void SetMode( int width, int height, int bits ); + virtual void ShowGDIPage(); + virtual void RestoreMode(); + virtual void ColorFill( LPRECT pRect, int palIndex ); + + virtual void SetPalette( char* ); + + // use direct draw to determine total video memory + int GetVideoMemory(); + + // report this object's type + virtual ST_TYPE TypeID() + { + return ST_DDraw; + } + + virtual void Refresh(); + +protected: + CGameDDrawScreenBuffer* mpSurfaces[2]; // ptrs to front & back buffer + int mBackSurface; // index to current back buffer +}; + +// use CreateDIBSection for accessing bits +class CGameDSScreen : public CGameScreen +{ +public: + CGameDSScreen(HWND hwnd, int logWidth, int logHeight, int orgX=0, int orgY=0); + virtual ~CGameDSScreen(); + + virtual void Render( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc, + DWORD rop + ); + + // render with transparency mask + virtual void TransRender( + int xDest, + int yDest, + int wDest, + int hDest, + CGameBitBuffer* pSrcBuffer, + int xSrc, + int ySrc + ); + + virtual void PageFlip(); + virtual void SetMode( int width, int height, int bits ){}; + virtual void ShowGDIPage(){}; + virtual void RestoreMode(){}; + virtual void SetPalette(HPALETTE); + virtual void SetPalette( char* ); + virtual void ColorFill( LPRECT pRect, int palIndex ); + + // report this object's type + virtual ST_TYPE TypeID() + { + return ST_DS; + } + +protected: + HDC mhdcOut; // keep output hdc around (assumes window is CS_OWNDC!) + HDC mhdcBackBuffer; // for holding backbuffer + + CGameDIB* mpBufferDIB; // ptr to back buffer + CGameDIB* mpScreenDIB; // ptr to screen + + HBITMAP mhbmOld; // for restoring screen's bitmap +}; + +#endif // CGSCREEN_H diff --git a/sdk/samples/iklowns/cgsound.cpp b/sdk/samples/iklowns/cgsound.cpp new file mode 100644 index 0000000..417f0b3 --- /dev/null +++ b/sdk/samples/iklowns/cgsound.cpp @@ -0,0 +1,702 @@ +/*===========================================================================*\ +| +| File: cgsound.cpp +| +| Description: +| Sample Immortal Klowns game sound effects routines. +| +| Sound effects are implemented as an object which are +| loaded from a wave file (.WAV) and can be mixed with +| other sounds as well as being algorithmically altered +| (panned from left to right, pitch changes, and volume +| changes). +| +| For demonstration purposes, sounds may be played using a +| variety of methods. +| 1) DirectSound - the preferred method, requires +| that a supported sound board be present +| and that the DirectSound drivers be installed. +| Offers greatest flexibility and lowest latency. +| Doesn't support compressed wave files. +| 2) waveOut - standard Windows API for low-level sound +| support. Hardest to code for and not as flexible +| as DirectSound nor as low in latency. Assumes +| similar format for all waves. Only allows playing +| one sound at a time (without using WaveMix). +| 3) sndPlaySound - the simpliest interface which +| yields the least flexibility and worst latency. +| Only one sound may be played at a time! +| +| If desired, individual sounds may be played using different +| methods (there's no advantage to this, it's just for demos). +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +//** include files ** +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include "linklist.h" +#include "cgwave.h" +#include "cgsound.h" +#include "cgglobl.h" + +//** local definitions ** +// Default volume and panning values +#define MINFREQ_TB 0 +#define MAXFREQ_TB 512 +#define MINPAN_TB 0 +#define MAXPAN_TB 127 +#define MIDPAN_TB 64 +#define MINVOL_TB 0 +#define MAXVOL_TB 127 + +#define INITVOL_TB 0 +#define INITPAN_TB 0 + +//** external functions ** +//** external data ** +//** public data ** +BOOL gbQuiet = FALSE; + +//** private data ** + +// To prevent having more than one instance of the same +// sound in memory, a list of all sounds is kept. +static CLinkedList *mpWaveList = NULL; + +// In order to turn off/on sounds we need a list of actively playing +// sounds. +static CLinkedList *pNowPlayingList = NULL; + +// Pointer to DirectSound object. +static LPDIRECTSOUND gpds = NULL; +static LPDIRECTSOUNDBUFFER lpDSPrimaryBuffer=NULL; + +// Handle of WaveOut device. +static HWAVEOUT hWaveDevice = NULL; + +// ---------------------------------------------------------- +// CreatePrimarySoundBuffer - create a primary sound buffer +// for direct sound. Every DirectSound app needs to have +// one (and only one) DirectSound buffer. +// ---------------------------------------------------------- +BOOL CreatePrimarySoundBuffer() +{ + DSBUFFERDESC dsbd; // buffer description struct + MMRESULT mmResult; // result of sound calls + + // Check if we already have a primary buffer + if (gpds != NULL) + { + return(TRUE); + } + + // Create the Direct Sound Object + if (DirectSoundCreate(NULL,&gpds, NULL) != 0) + { + return(FALSE); + } + if( gpds->SetCooperativeLevel( ghMainWnd, DSSCL_NORMAL ) != DS_OK ) + { + return(FALSE); + } + + // Set up the primary direct sound buffer. + memset(&dsbd, 0, sizeof(DSBUFFERDESC)); + dsbd.dwSize = sizeof(DSBUFFERDESC); + dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER; + dsbd.dwBufferBytes = 0; + + dsbd.lpwfxFormat = NULL; + + if ((mmResult = gpds->CreateSoundBuffer(&dsbd, + &lpDSPrimaryBuffer, + NULL)) != 0) + { + return(FALSE); + } + + return(TRUE); +} + +// ---------------------------------------------------------- +// InitalizeWaveDevice - be sure wave method is ready for use. +// ---------------------------------------------------------- +BOOL InitializeWaveDevice( + int WaveMode, // sndPlaySound, waveOut, or DirectSound + LPWAVEFORMATEX pFormat // default wave format +) +{ + // If we are doing waveOut's then we need a handle to the device + // driver. + if (WaveMode == USE_WAVEOUT) + { + + // If there isn't a wave device already open, open one + // using the given format + if (hWaveDevice == NULL) + { + if (waveOutOpen((LPHWAVEOUT)&hWaveDevice + , WAVE_MAPPER, pFormat, NULL, 0L, 0)) + { + return(FALSE); + } + } + + // Must be using DirectSound, make sure we have a primary buffer + } else { + + if (pNowPlayingList == NULL) + { + pNowPlayingList = new CLinkedList; + } + + // Create a DirectSound primary buffer + return (CreatePrimarySoundBuffer()); + } + return(TRUE); +} + + +// ---------------------------------------------------------- +// LoadWaveData - read .WAV file information into appropriate +// memory buffer for playback. +// ---------------------------------------------------------- +LPWAVEHDR LoadWaveData( + CSoundEffect *pSound, // sound effect instance + LPSTR WaveName, // .WAV filename + int WaveMode // sndPlaySound, waveOut or DirectSound +) +{ + LPBYTE lpData = NULL; + LPWAVEHDR lpWaveHdr = NULL; + DWORD dwDataSize = 0; + LPDIRECTSOUNDBUFFER lpDirectSoundBuffer = NULL; + LPWAVEFORMATEX pwfxInfo = NULL; + + // Check to be sure a non-null name was given + if ((WaveName == NULL) || (*WaveName == '\0')) + { + return(NULL); + } + + // For sndPlaySound, we just read the whole file into a buffer + if (WaveMode == USE_SNDPLAY) + { + HANDLE hFile = CreateFile(WaveName, GENERIC_READ, FILE_SHARE_READ + , NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile == INVALID_HANDLE_VALUE) + { + return(NULL); + } + + dwDataSize = GetFileSize(hFile, NULL); + if ((dwDataSize == 0xFFFFFFFF) || (dwDataSize == 0)) + { + CloseHandle(hFile); + return(NULL); + } + + // Allocate and lock memory for the waveform data. The memory + // for waveform data must be globally allocated with + // GMEM_MOVEABLE and GMEM_SHARE flags. + if ((lpData = (LPBYTE) GlobalAllocPtr(GMEM_MOVEABLE | GMEM_SHARE + , dwDataSize)) == NULL) + { + CloseHandle(hFile); + return(NULL); + } + + // Read the whole wave file in + ReadFile(hFile, lpData, dwDataSize, &dwDataSize, NULL); + CloseHandle(hFile); + + // Either DirectSound or WaveOut + } else { + + HMMIO hmmioIn; + MMCKINFO ckInRiff; + MMCKINFO ckIn; + UINT cbActualRead; + UINT cbSize; + + pwfxInfo = NULL; + cbSize = 0; + + // Use routines in CGWAVE to open the sound file and + // parse the data in it. + if (WaveOpenFile(WaveName, &hmmioIn, &pwfxInfo, &ckInRiff) != 0) + { + if (pwfxInfo != NULL) + GlobalFree(pwfxInfo); + return(NULL); + } + + // Be sure we have an output device ready to play the sound + if (!InitializeWaveDevice(WaveMode, pwfxInfo)) + { + mmioClose(hmmioIn, 0); + if (pwfxInfo != NULL) + GlobalFree(pwfxInfo); + return(NULL); + } + + + // Position the wave file for reading the wave data + if (WaveStartDataRead(&hmmioIn, &ckIn, &ckInRiff) != 0) + { + mmioClose(hmmioIn, 0); + if (pwfxInfo != NULL) + GlobalFree(pwfxInfo); + return(NULL); + } + + // Ok, size of wave data is in ckIn, allocate that buffer. + dwDataSize = ckIn.cksize; + + // waveOut requires that we allocate the data + if (WaveMode == USE_WAVEOUT) + { + + if ((lpData = (LPBYTE)GlobalAlloc(GMEM_FIXED + , dwDataSize)) == NULL) + { + mmioClose(hmmioIn, 0); + if (pwfxInfo != NULL) + GlobalFree(pwfxInfo); + return(NULL); + } + // For DirectSound, we let it allocate the buffer for us. + } else { + DSBUFFERDESC dsbd; + DWORD dwBSize; + DWORD dwWrapBSize; + LPVOID lpWrapPtr; + DWORD dw; // size place holder + + // Set up the secondary direct sound buffer. + memset(&dsbd, 0, sizeof(DSBUFFERDESC)); + dsbd.dwSize = sizeof(DSBUFFERDESC); + dsbd.dwFlags = DSBCAPS_CTRLDEFAULT; + dsbd.dwBufferBytes = dwDataSize; + dw = pwfxInfo->cbSize + sizeof(WAVEFORMATEX); + + if ((dsbd.lpwfxFormat = (LPWAVEFORMATEX)GlobalAllocPtr(GPTR|GMEM_ZEROINIT, dw)) == NULL) + { + mmioClose(hmmioIn, 0); + return NULL; + } + + // Setup the format, frequency, volume, etc. + memcpy( dsbd.lpwfxFormat, pwfxInfo, dw ); + + if (gpds->CreateSoundBuffer(&dsbd, + &lpDirectSoundBuffer, + NULL) != 0) + { + GlobalFreePtr(dsbd.lpwfxFormat); + mmioClose(hmmioIn, 0); + return NULL; + } + + GlobalFreePtr(dsbd.lpwfxFormat); + + // Need to lock the buffer so that we can write to it! + if (lpDirectSoundBuffer->Lock( + 0, + dwDataSize, + (LPLPVOID)&lpData, + &dwBSize, + &lpWrapPtr, + &dwWrapBSize, + 0L) != 0) + { + mmioClose(hmmioIn, 0); + return NULL; + } else { + dwDataSize = dwBSize; + } + } + + // Now read the actual wave data into the data buffer. + if (WaveReadFile(hmmioIn, dwDataSize, lpData, &ckIn + , &cbActualRead) != 0) + { + // Data didn't get read for some reason! + if (pwfxInfo != NULL) + GlobalFree(pwfxInfo); + if (lpData != NULL) + GlobalFree(lpData); + } + + // Save info on size of data and close the wave file + cbSize = cbActualRead; + dwDataSize = cbSize; + mmioClose(hmmioIn, 0); + + // If we have a DirectSound buffer, set format & unlock it. + if (lpDirectSoundBuffer != NULL) + { + lpDirectSoundBuffer->Unlock(lpData, cbActualRead, NULL, 0 ); + } + + } + + // Allocate and lock memory for the header. This memory must + // also be globally allocated with GMEM_MOVEABLE and GMEM_SHARE flags. + if ((lpWaveHdr = (LPWAVEHDR) GlobalAllocPtr(GMEM_MOVEABLE | GMEM_SHARE + , (DWORD)sizeof(WAVEHDR))) == NULL) { + GlobalFreePtr(lpData); + return(NULL); + } + + // After allocation, set up and prepare header. This struct will be + // used to play the sounds at the appropriate time. + lpWaveHdr->lpData = (LPSTR) lpData; + lpWaveHdr->dwBufferLength = dwDataSize; + lpWaveHdr->dwFlags = DSBCAPS_CTRLDEFAULT; + lpWaveHdr->dwLoops = 0L; + + pSound->pWaveInfo->lpDirectSoundBuffer = lpDirectSoundBuffer; + pSound->pWaveInfo->pwfxInfo = pwfxInfo; + + return(lpWaveHdr); +} + +// ---------------------------------------------------------- +// CSoundEffect constructor +// ---------------------------------------------------------- +CSoundEffect::CSoundEffect( + LPSTR WaveName, // name of wave file + DWORD Id, // object id to allow one buffer per object + BOOL fLoopIt, // loop the sound when played + int WaveMode // sndPlaySound, waveOut or DirectSound +) +{ + pWaveInfo = NULL; + fLoop = fLoopIt; + fPlaying = FALSE; + + // Guard against wise-guys (we don't mind) + if ((WaveName == NULL) || (*WaveName == '\0')) + return; + + CSoundEffect::WaveMode = WaveMode; + curVolume = MAXVOL_TB; + fMuted = FALSE; + + // initialize wave list if necessary + if (!mpWaveList) + { + mpWaveList = new CLinkedList; + } else { + // Need to search wave list to see if we already have this + // wave data cached. + WAVE_ENTRY *pCurBuffer = (WAVE_ENTRY *) mpWaveList->GetFirst(); + + while (pCurBuffer && !pWaveInfo) + { + // Do the name and mode match? + if ((lstrcmpi( WaveName, pCurBuffer->mpFileName ) == 0 ) + && (pCurBuffer->hObjectId == Id) + && (pCurBuffer->WaveMode == WaveMode)) + { + pCurBuffer->mRefCount++; + pWaveInfo = pCurBuffer; + } else { + pCurBuffer = (WAVE_ENTRY *) mpWaveList->GetNext(); + } + } + } + + // if we didn't find the wave file in our cache, we need to load it + if (!pWaveInfo) + { + LPWAVEHDR pWaveHdr; + pWaveInfo = new WAVE_ENTRY; + + // Load up the wave data + if (pWaveHdr = LoadWaveData(this, WaveName, WaveMode)) + { + // Add to list of known sounds + pWaveInfo->mpFileName = new char [lstrlen(WaveName)+1]; + lstrcpy(pWaveInfo->mpFileName, WaveName); + pWaveInfo->pWaveHdr = pWaveHdr; + pWaveInfo->WaveMode = WaveMode; + pWaveInfo->hObjectId = Id; + pWaveInfo->mRefCount = 1; + mpWaveList->Append( pWaveInfo ); + lpDirectSoundBuffer = pWaveInfo->lpDirectSoundBuffer; + } else { + delete pWaveInfo; + pWaveInfo = NULL; + } + } else { + lpDirectSoundBuffer = pWaveInfo->lpDirectSoundBuffer; + } +} + +// ---------------------------------------------------------- +// CSoundEffect destructor +// ---------------------------------------------------------- +CSoundEffect::~CSoundEffect() +{ + Stop(); + + if ((pWaveInfo != NULL) && (--pWaveInfo->mRefCount == 0)) + { + mpWaveList->Remove( pWaveInfo ); + + delete pWaveInfo->mpFileName; + if (lpDirectSoundBuffer != NULL) + { + lpDirectSoundBuffer->Release(); + } else { + GlobalFreePtr(pWaveInfo->pWaveHdr->lpData); + } + GlobalFreePtr(pWaveInfo->pwfxInfo); + GlobalFreePtr(pWaveInfo->pWaveHdr); + delete pWaveInfo; // causes GP fault why? + pWaveInfo = NULL; + // !!! should we delete the list if empty? + } +} + +// ---------------------------------------------------------- +// Play - +// ---------------------------------------------------------- +void CSoundEffect::Play() +{ + if ((pWaveInfo == NULL) || (gbQuiet)) + { + return; + } + + fPlaying = TRUE; + + switch (WaveMode) + { + case USE_WAVEOUT: + if (pWaveInfo->pWaveHdr != NULL) + { + pWaveInfo->pWaveHdr->dwLoops = fLoop; + waveOutPrepareHeader(hWaveDevice, pWaveInfo->pWaveHdr, sizeof(WAVEHDR)); + waveOutWrite(hWaveDevice, pWaveInfo->pWaveHdr, sizeof(WAVEHDR)); + waveOutUnprepareHeader(hWaveDevice, pWaveInfo->pWaveHdr, sizeof(WAVEHDR)); + } + break; + + case USE_DSOUND: + if (lpDirectSoundBuffer != NULL) + { + + // Add sound to active list if it isn't already there + CSoundEffect *pTemp = (CSoundEffect *)pNowPlayingList->GetFirst(); + while (pTemp != NULL) + { + if (pTemp == this) + { + break; + } + pTemp = (CSoundEffect *)pNowPlayingList->GetNext(); + } + + if (pTemp == NULL) + { + pNowPlayingList->Add(this); + } + + if( fLoop ) + { + lpDirectSoundBuffer->SetCurrentPosition( 0 ); + lpDirectSoundBuffer->Play(0, 0, DSBPLAY_LOOPING); + } + else + { + lpDirectSoundBuffer->SetCurrentPosition( 0 ); + lpDirectSoundBuffer->Play(0, 0, 0); + } + } + break; + + case USE_SNDPLAY: + if (pWaveInfo->pWaveHdr != NULL) + { + UINT flags = SND_MEMORY | SND_ASYNC; + + if (fLoop) + flags |= SND_LOOP; + + sndPlaySound((LPSTR)(pWaveInfo->pWaveHdr->lpData), flags); + } + break; + } +} + +// ---------------------------------------------------------- +// Stop - +// ---------------------------------------------------------- +void CSoundEffect::Stop() +{ + if ((pWaveInfo == NULL) || (!fPlaying)) + { + return; + } + + fPlaying = FALSE; + + switch (WaveMode) + { + case USE_WAVEOUT: + if (pWaveInfo->pWaveHdr != NULL) + { + waveOutReset(hWaveDevice); + } + break; + case USE_DSOUND: + if (lpDirectSoundBuffer != NULL) + { + pNowPlayingList->Remove(this); + lpDirectSoundBuffer->Stop(); + } + break; + + case USE_SNDPLAY: + if (pWaveInfo->pWaveHdr != NULL) + { + sndPlaySound(NULL, SND_ASYNC); + } + break; + } +} + +// ---------------------------------------------------------- +// SetPan - +// ---------------------------------------------------------- +void CSoundEffect::SetPan(int PanFactor) +{ +// if ((pWaveInfo == NULL) || (curPan == PanFactor)) + if (pWaveInfo == NULL) + { + return; + } + + curPan = PanFactor; + + switch (WaveMode) + { + case USE_WAVEOUT: + break; + case USE_DSOUND: + if (lpDirectSoundBuffer != NULL) + { + // parameter pan is 0-127; dsound's pan is -10000 to +10000 + long absPan; + absPan = (10000 * ((curPan-64)>>2)) / 128; + lpDirectSoundBuffer->SetPan(absPan); + } + break; + case USE_SNDPLAY: + break; + } +} + + +// ---------------------------------------------------------- +// SetVolume - +// ---------------------------------------------------------- +void CSoundEffect::SetVolume(int Volume) +{ + if ((pWaveInfo == NULL) || (curVolume == Volume)) + { + return; + } + + curVolume = Volume; + switch (WaveMode) + { + case USE_WAVEOUT: + break; + case USE_DSOUND: + if (lpDirectSoundBuffer != NULL) + { + // parameter volume is 0-127; dsound's volume is -10000 to 0 + long absVolume; + absVolume = -((127-curVolume)<<4); + lpDirectSoundBuffer->SetVolume(absVolume); + } + break; + case USE_SNDPLAY: + break; + } +} + + +// ---------------------------------------------------------- +// SetMute - +// ---------------------------------------------------------- +void CSoundEffect::SetMute(BOOL fMute) +{ + + if ((pWaveInfo == NULL) || (fMuted == fMute)) + { + return; + } + + fMuted = fMute; + + if (fMuted) + { + Stop(); + } else { + Play(); + } +} + +void SetSilence(BOOL fQuiet) +{ + gbQuiet = fQuiet; + if (lpDSPrimaryBuffer != NULL) + { + CSoundEffect *lpSound = (CSoundEffect *)pNowPlayingList->GetFirst(); + while (lpSound != NULL) + { + + if (fQuiet) + { + lpSound->lpDirectSoundBuffer->Stop(); + } else { + if (lpSound->fLoop) + { + lpSound->lpDirectSoundBuffer->Play(0, 0, DSBPLAY_LOOPING); + } else { + lpSound->lpDirectSoundBuffer->Play(0, 0, 0); + } + } + + lpSound = (CSoundEffect *)pNowPlayingList->GetNext(); + } + } +} diff --git a/sdk/samples/iklowns/cgsound.h b/sdk/samples/iklowns/cgsound.h new file mode 100644 index 0000000..e955f60 --- /dev/null +++ b/sdk/samples/iklowns/cgsound.h @@ -0,0 +1,87 @@ +/*===========================================================================*\ +| +| File: cgsound.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef _CGSOUND_H +#define _CGSOUND_H + +#include <mmreg.h> +#include <msacm.h> +extern "C" { + #include "dsound.h" +}; + +#define USE_DSOUND 0 +#define USE_WAVEOUT 1 +#define USE_SNDPLAY 2 + +// Master wave information structure -- one for each unique +// sound (not each instance). +typedef struct _WAVE_ENTRY +{ + LPSTR mpFileName; + DSBUFFERDESC *dsbd; + LPDIRECTSOUNDBUFFER lpDirectSoundBuffer; + LPWAVEFORMATEX pwfxInfo; + LPWAVEHDR pWaveHdr; + DWORD hObjectId; + int WaveMode; + int mRefCount; +} WAVE_ENTRY, *LPWAVE_ENTRY; + + +class CSoundEffect +{ +private: + LPWAVE_ENTRY pWaveInfo; // ptr to master wav info + DSBUFFERDESC *dsbd; // instance DS buffer + LPDIRECTSOUNDBUFFER lpDirectSoundBuffer; + int WaveMode; // method for playing + int curVolume; // 0-127 + int curPan; // 0=left, 127=right + BOOL fLoop; + BOOL fPlaying; + BOOL fMuted; + int curChannel; + +public: + CSoundEffect(LPSTR WaveFile, DWORD UniqueId=0, BOOL fLoopIt=FALSE + , int Mode=USE_DSOUND); + ~CSoundEffect(); + + void Play(); + void Stop(); + void SetPan(int PanFactor); + void SetVolume(int Volume); + void SetMute(BOOL); + void SetFreq(); + + friend LPWAVEHDR LoadWaveData(CSoundEffect *, LPSTR, int); + friend void SetSilence(BOOL); +}; + +#endif diff --git a/sdk/samples/iklowns/cgsprite.cpp b/sdk/samples/iklowns/cgsprite.cpp new file mode 100644 index 0000000..badb38c --- /dev/null +++ b/sdk/samples/iklowns/cgsprite.cpp @@ -0,0 +1,537 @@ +/*===========================================================================*\ +| +| File: cgsprite.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include "cgdebug.h" +#include "cgglobl.h" +#include "cgtimer.h" +#include "cgscreen.h" +#include "cgsprite.h" +#include "cgupdate.h" + +extern CGameTimer* Timer; + +char seqSection[] = "Sequences"; +char seqKey[] = "Sequence"; +char spriteKey[] = "Sprite"; +char sprExtension[] = "spr"; +char bmpExtension[] = "bmp"; + +/*---------------------------------------------------------------------------*\ +| +| Class CGameSprite +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ +CGameSprite::CGameSprite( + char* pFileName, + char* pSpriteName, + CGameBitBuffer* pBits, + BOOL needHorzMirror, + BOOL needVertMirror + ) +{ + // grab this sprite's parameters from the .spr file + // and put into mInfo[0] + mInfo[SRI_NORMAL].mSrcX = (int) GetPrivateProfileInt( + pSpriteName, + "X", + 0, // default to 0 + pFileName + ); + + mInfo[SRI_NORMAL].mSrcY = (int) GetPrivateProfileInt( + pSpriteName, + "Y", + 0, // default to 0 + pFileName + ); + + mInfo[SRI_NORMAL].mpBits = pBits; + mInfo[SRI_NORMAL].mNewBits = FALSE; + + mInfo[SRI_NORMAL].mWidth = (int) GetPrivateProfileInt( + pSpriteName, + "Width", + 0, // default to 0 + pFileName + ); + + mInfo[SRI_NORMAL].mHeight = (int) GetPrivateProfileInt( + pSpriteName, + "Height", + 0, // default to 0 + pFileName + ); + + // create mirrored images if necessary + if (needHorzMirror) + { + if (gUse_DDraw) + { + mInfo[SRI_HORZMIRROR].mpBits = new CGameDDrawBitBuffer( + mInfo[SRI_NORMAL].mWidth, + mInfo[SRI_NORMAL].mHeight, + pBits->GetHPalette(), + pBits->GetTransColor() + ); + } + else + { + mInfo[SRI_HORZMIRROR].mpBits = new CGameDSBitBuffer( + mInfo[SRI_NORMAL].mWidth, + mInfo[SRI_NORMAL].mHeight, + pBits->GetHPalette(), + pBits->GetTransColor() + ); + } + + mInfo[SRI_HORZMIRROR].mNewBits = TRUE; + mInfo[SRI_HORZMIRROR].mWidth = mInfo[SRI_NORMAL].mWidth; + mInfo[SRI_HORZMIRROR].mHeight = mInfo[SRI_NORMAL].mHeight; + mInfo[SRI_HORZMIRROR].mSrcX = 0; + mInfo[SRI_HORZMIRROR].mSrcY = 0; + + mInfo[SRI_HORZMIRROR].mpBits->Blt( + mInfo[SRI_HORZMIRROR].mWidth-1, + 0, + -mInfo[SRI_HORZMIRROR].mWidth, // create mirror image + mInfo[SRI_HORZMIRROR].mHeight, + pBits, + mInfo[SRI_NORMAL].mSrcX, + mInfo[SRI_NORMAL].mSrcY, + SRCCOPY + ); + } + else + { + // just make a copy of normal image + mInfo[SRI_HORZMIRROR] = mInfo[SRI_NORMAL]; + + // negate the width to force a mirrored blt + mInfo[SRI_HORZMIRROR].mWidth = -mInfo[SRI_NORMAL].mWidth; + + // make sure we don't delete it + mInfo[SRI_HORZMIRROR].mNewBits = FALSE; + } + + if (needVertMirror) + { + if (gUse_DDraw) + { + mInfo[SRI_VERTMIRROR].mpBits = new CGameDDrawBitBuffer( + mInfo[SRI_NORMAL].mWidth, + mInfo[SRI_NORMAL].mHeight, + pBits->GetHPalette(), + pBits->GetTransColor() + ); + + } + else + { + mInfo[SRI_VERTMIRROR].mpBits = new CGameDSBitBuffer( + mInfo[SRI_NORMAL].mWidth, + mInfo[SRI_NORMAL].mHeight, + pBits->GetHPalette(), + pBits->GetTransColor() + ); + } + + mInfo[SRI_VERTMIRROR].mNewBits = TRUE; + mInfo[SRI_VERTMIRROR].mWidth = mInfo[SRI_NORMAL].mWidth; + mInfo[SRI_VERTMIRROR].mHeight = mInfo[SRI_NORMAL].mHeight; + mInfo[SRI_VERTMIRROR].mSrcX = 0; + mInfo[SRI_VERTMIRROR].mSrcY = 0; + + mInfo[SRI_VERTMIRROR].mpBits->Blt( + 0, + mInfo[SRI_VERTMIRROR].mHeight-1, + mInfo[SRI_VERTMIRROR].mWidth, + -mInfo[SRI_VERTMIRROR].mHeight, // create mirror image + pBits, + mInfo[SRI_NORMAL].mSrcX, + mInfo[SRI_NORMAL].mSrcY, + SRCCOPY + ); + } + else + { + // just make a copy of normal image + mInfo[SRI_VERTMIRROR] = mInfo[SRI_NORMAL]; + + // negate the height to force a mirrored blt + mInfo[SRI_VERTMIRROR].mHeight = -mInfo[SRI_NORMAL].mHeight; + + // make sure we don't delete it + mInfo[SRI_VERTMIRROR].mNewBits = FALSE; + } + + // do we need both horizontal and vertical? + if (needHorzMirror && needVertMirror) + { + if (gUse_DDraw) + { + mInfo[SRI_BOTHMIRROR].mpBits = new CGameDDrawBitBuffer( + mInfo[SRI_NORMAL].mWidth, + mInfo[SRI_NORMAL].mHeight, + pBits->GetHPalette(), + pBits->GetTransColor() + ); + + } + else + { + mInfo[SRI_BOTHMIRROR].mpBits = new CGameDSBitBuffer( + mInfo[SRI_NORMAL].mWidth, + mInfo[SRI_NORMAL].mHeight, + pBits->GetHPalette(), + pBits->GetTransColor() + ); + } + + mInfo[SRI_BOTHMIRROR].mNewBits = TRUE; + mInfo[SRI_BOTHMIRROR].mWidth = mInfo[SRI_NORMAL].mWidth; + mInfo[SRI_BOTHMIRROR].mHeight = mInfo[SRI_NORMAL].mHeight; + mInfo[SRI_BOTHMIRROR].mSrcX = 0; + mInfo[SRI_BOTHMIRROR].mSrcY = 0; + + + mInfo[SRI_BOTHMIRROR].mpBits->Blt( + mInfo[SRI_BOTHMIRROR].mWidth-1, + mInfo[SRI_NORMAL].mHeight-1, + -mInfo[SRI_BOTHMIRROR].mWidth, // create mirror image + -mInfo[SRI_BOTHMIRROR].mHeight, + pBits, + mInfo[SRI_NORMAL].mSrcX, + mInfo[SRI_NORMAL].mSrcY, + SRCCOPY + ); + } + else + { + // just make a copy of normal image + mInfo[SRI_BOTHMIRROR] = mInfo[SRI_NORMAL]; + + // negate the width and height to force a mirrored blt + mInfo[SRI_BOTHMIRROR].mWidth = -mInfo[SRI_NORMAL].mHeight; + mInfo[SRI_BOTHMIRROR].mHeight = -mInfo[SRI_NORMAL].mHeight; + + // make sure we don't delete it + mInfo[SRI_BOTHMIRROR].mNewBits = FALSE; + } +} + +CGameSprite::~CGameSprite() +{ + for (int i = SRI_INFOCOUNT; i>0; i--) + { + if (mInfo[i-1].mNewBits) + { + delete mInfo[i-1].mpBits; + } + } +} + +/*---------------------------------------------------------------------------*\ +| +| class CGameSpriteBuffer +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ +CGameSpriteBuffer::CGameSpriteBuffer( + char* pFileName + ) : mpFileName( NULL ), + mpBitBuffer( NULL ), + mRefCount( 0 ) +{ + mpFileName = new char[lstrlen( pFileName ) +1]; + lstrcpy( mpFileName, pFileName ); + + // open the set's DIB file + char bmpName[256]; + SprToBmp( pFileName, bmpName, 256 ); + + CGameDIB dib( bmpName ); + + if (gUse_DDraw) + { + mpBitBuffer = new CGameDDrawBitBuffer( &dib ); + if (!mpBitBuffer->IsValid()) + { + // we didn't get video memory, so delete that buffer + delete mpBitBuffer; + // & create a system memory one + mpBitBuffer = new CGameDSBitBuffer( &dib ); + } + } + else + { + mpBitBuffer = new CGameDSBitBuffer( &dib ); + } + ++mRefCount; +} + +CGameSpriteBuffer::~CGameSpriteBuffer() +{ + delete mpBitBuffer; + delete[] mpFileName; +} + +void +CGameSpriteBuffer::SprToBmp( + char* pSprName, + char* pOutBuffer, + int size + ) +{ + lstrcpyn( pOutBuffer, pSprName, size ); + + int dotPos = strcspn( pOutBuffer, "." ); + + if (dotPos < lstrlen( pOutBuffer )) + { + pOutBuffer[dotPos] = '\0'; + lstrcat( pOutBuffer, "." ); + lstrcat( pOutBuffer, bmpExtension ); + } +} + +/*---------------------------------------------------------------------------*\ +| +| Class CGameSpriteSequence +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ + +LinkedList* CGameSpriteSequence::mpBufferList = NULL; + +CGameSpriteSequence::CGameSpriteSequence( + char* pFileName, + char* pSequenceName, + int rate, + BOOL mirrorHorz, // keep mirror images of sprites? + BOOL mirrorVert + ) : mpSpriteArray( NULL ), + mNumSprites( 0 ), + mCurSprite( 0 ), + mpMyBuffer( NULL ), + mLastTime( -1 ) +{ + char sprFile[MAX_PATH]; + + lstrcpy(sprFile, gDataPath); + lstrcat(sprFile, "\\"); + lstrcat(sprFile, pFileName); + + // get a ptr to this sequence's source bitmap + mpMyBuffer = LoadSpriteBits( pFileName ); + + // get the number of sprites + mNumSprites = GetPrivateProfileInt( + "Sequences", + pSequenceName, + 0, + sprFile + ); + + mpSpriteArray = new CGameSprite*[mNumSprites]; + + // get the sprite list + char spriteBuf[256]; + char defSprite[] = ""; // no default sprite names + + GetPrivateProfileString( + pSequenceName, + NULL, // grab all the key names + defSprite, + spriteBuf, + sizeof( spriteBuf ), + sprFile + ); + + int i=0; + for (char *pSprite = spriteBuf; *pSprite && (i<mNumSprites); pSprite++) + { + mpSpriteArray[i] = new CGameSprite( sprFile, pSprite, mpMyBuffer->mpBitBuffer, mirrorHorz, mirrorVert ); + pSprite += lstrlen( pSprite ); // move beyond terminator + ++i; + } + + mPeriod = 1000 / rate; +} + +CGameSpriteSequence::~CGameSpriteSequence() +{ + // !!! assumes that mpSpriteArray is valid if mNumSprites>0 + for (; mNumSprites>0; mNumSprites--) + { + delete mpSpriteArray[mNumSprites-1]; + } + + // remove our file from list + UnloadSpriteBits(); + + delete[] mpSpriteArray; +} + +BOOL // return TRUE if the are more sprites in sequence +CGameSpriteSequence::Frame() +{ + return TRUE; +} + +int // return mCurSprite .... is Zero if no more (i.e., wrapped) +CGameSpriteSequence::NextSprite( + int time, // current game time + BOOL wrap // wrap around (i.e. loop) at end of sequence + ) +{ + if (mLastTime == -1) + mLastTime = time-mPeriod; + + int elapsed = time - mLastTime; + if (elapsed >= mPeriod) + { + mLastTime = time; + mCurSprite += elapsed / mPeriod; + if (mCurSprite >= mNumSprites) + { + mCurSprite = wrap ? (mCurSprite % mNumSprites) : 0; + } + } + return mCurSprite; +} + +void +CGameSpriteSequence::Render( + CGameScreen* pScreen, + int x, + int y, + BOOL revX, // reverse the image? + BOOL revY, // reverse the image? + LPRECT pDirty // invalid rectangle in screen coordinates + ) +{ + int which = (int) revX + ((int) revY * 2); + RECT update; + int clipX = max(x, pDirty->left); + int clipY = max(y, pDirty->top); + + int offsetX = max(pDirty->left - x, 0); + int offsetY = max(pDirty->top - y, 0); + + update.left = mpSpriteArray[mCurSprite]->mInfo[which].mSrcX + + offsetX; + + update.top = mpSpriteArray[mCurSprite]->mInfo[which].mSrcY + + offsetY; + + // we're using right & bottom for width & height + update.right = min( mpSpriteArray[mCurSprite]->mInfo[which].mWidth - + offsetX, pDirty->right-clipX+1 ); + + update.bottom = min( mpSpriteArray[mCurSprite]->mInfo[which].mHeight - + offsetY, pDirty->bottom-clipY+1 ); + + if ((update.right > 0) && (update.bottom > 0)) + pScreen->TransRender( + clipX, + clipY, + update.right, + update.bottom, + mpSpriteArray[mCurSprite]->mInfo[which].mpBits, + update.left, + update.top + ); +} + +// return a ptr to the sprite buffer corresponding to this .spr filename +// keeps track of whether file is already loaded & maintains reference count +CGameSpriteBuffer* +CGameSpriteSequence::LoadSpriteBits( char* pFileName ) +{ + CGameSpriteBuffer* pResult = NULL; + CGameSpriteBuffer* pCurBuffer = NULL; + + // initialize buffer list if necessary + if (!mpBufferList) + { + mpBufferList = new LinkedList; + } + else + { + pCurBuffer = (CGameSpriteBuffer*) mpBufferList->GetFirst(); + + while (pCurBuffer && !pResult) + { + if (lstrcmpi( pFileName, pCurBuffer->mpFileName ) == 0 ) + { + pResult = pCurBuffer; + pCurBuffer->mRefCount++; + } + else + { + pCurBuffer = (CGameSpriteBuffer*) mpBufferList->GetNext(); + } + } + } + + // if we didn't find it, we need to load it + if (!pResult) + { + pResult = new CGameSpriteBuffer(pFileName); // increments ref count + + mpBufferList->Append( pResult ); + } + + return pResult; +} + + +// decrement the ref count for the given file & remove it if 0 +void +CGameSpriteSequence::UnloadSpriteBits() +{ + if (--mpMyBuffer->mRefCount == 0) + { + mpBufferList->Remove( mpMyBuffer ); + delete mpMyBuffer; + + // !!! should we delete the list if empty? + } +} diff --git a/sdk/samples/iklowns/cgsprite.h b/sdk/samples/iklowns/cgsprite.h new file mode 100644 index 0000000..301741a --- /dev/null +++ b/sdk/samples/iklowns/cgsprite.h @@ -0,0 +1,145 @@ +/*===========================================================================*\ +| +| File: cgsprite.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef CGSPRITE_H +#define CGSPRITE_H + +#include <linklist.h> +#include "cgbitbuf.h" + +struct SpriteRenderInfo +{ + CGameBitBuffer* mpBits; // image bits + int mSrcX; + int mSrcY; + int mWidth; + int mHeight; + + BOOL mRevX; + BOOL mRevY; + + BOOL mNewBits; // flag that mpBits needs deleted +}; + +#define SRI_NORMAL 0 +#define SRI_HORZMIRROR 1 +#define SRI_VERTMIRROR 2 +#define SRI_BOTHMIRROR 3 + +#define SRI_INFOCOUNT 4 + +struct CGameSprite +{ + CGameSprite( + char* pFileName, + char* pSpriteName, + CGameBitBuffer* pBits, + BOOL needHorzMirror = FALSE, + BOOL needVertMirror = FALSE + ); + virtual ~CGameSprite(); + + SpriteRenderInfo mInfo[SRI_INFOCOUNT]; +}; + +class CGameSpriteBuffer +{ +public: + CGameSpriteBuffer( char* pFileName ); + virtual ~CGameSpriteBuffer(); + + char* mpFileName; + CGameBitBuffer* mpBitBuffer; // a single DIB containing sprites + int mRefCount; // for knowing when to remove a buffer + +private: + void SprToBmp(char* pSprName,char* pOutBuffer,int size); +}; + +class CGameScreen; +class CGameUpdateList; + +class CGameSpriteSequence +{ +public: + CGameSpriteSequence( + char* pFileName, + char* pSequenceName, + int rate, + BOOL needHorzMirror = FALSE, + BOOL needVertMirror = FALSE + ); + + virtual ~CGameSpriteSequence(); + + virtual BOOL Frame(); + virtual void Render( + CGameScreen* pScreen, + int x, + int y, + BOOL revX, + BOOL revY, + LPRECT pDirty + ); + virtual int GetCurWidth() + { + return mpSpriteArray[mCurSprite]->mInfo[0].mWidth; + } + virtual int GetCurHeight() + { + return mpSpriteArray[mCurSprite]->mInfo[0].mHeight; + } + + virtual int NextSprite(int time, BOOL wrap=TRUE); + + void SetCurSprite( int sprite ) + { + mCurSprite = sprite; + mLastTime = -1; + } + +protected: + static LinkedList* mpBufferList; // list of CGameSpriteBuffers containing all sprites + + CGameSprite** mpSpriteArray; // sprites for this sequence + int mNumSprites; // size of the array + int mCurSprite; // which sprite is in the current frame + int mPeriod; // number of time slices per frame + int mLastTime; // last time we changed frames + + CGameSpriteBuffer* mpMyBuffer; // bit buffer for this instance's sprites + + // return a ptr to the sprite buffer corresponding .spr filename + CGameSpriteBuffer* LoadSpriteBits( char* pFileName ); + + // decrement reference count & delete buffer if 0 + void UnloadSpriteBits(); +}; + +#endif // CGSPRITE_H diff --git a/sdk/samples/iklowns/cgtext.cpp b/sdk/samples/iklowns/cgtext.cpp new file mode 100644 index 0000000..c5df45a --- /dev/null +++ b/sdk/samples/iklowns/cgtext.cpp @@ -0,0 +1,278 @@ +/*===========================================================================*\ +| +| File: cgtext.cpp +| +| Description: +| Object class to manage lines of text to be displayed over a bitmap. +| The text may have an optional drop shadow and may be scrolled +| vertically. +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +//** include files ** +#include <windows.h> +#include <windowsx.h> +#include "cgtext.h" + +//** local definitions ** +typedef struct { + LPSTR text; // actual text string + int nChars; // number of characters in string + int X; // location of text in rectangle + int Y; + COLORREF color; // color of text + COLORREF dropColor; // color of shadow + int shadowX; // horizontal offset of shaadow + int shadowY; // vertical offset of shadow +} LINE_INFO; + +#define DEFAULT_SHADOWX 2 +#define DEFAULT_SHADOWY 1 + +#define MAX(x,y) (((x) > (y)) ? (x) : (y)) + +//** external functions ** +//** external data ** +//** public data ** +//** private data ** +//** public functions ** +//** private functions ** + +// ---------------------------------------------------------- +// CGameText contructor - +// ---------------------------------------------------------- +CGameText::CGameText( + HDC hdc, // hdc to blit to + LPRECT pRect, // rectangle to center text + int screenLines, // max lines on screen at once + int linespacing // 1=single, 2=double +) : hOldFont( NULL ) +{ + nLines = 0; + maxLines = screenLines; + maxWidth = 0; + maxHeight = 0; + hdcText = hdc; + spacing = linespacing; + hFont = NULL; + memcpy(&rect, pRect, sizeof(RECT)); + pLines = new CLinkedList; + + SetBkMode(hdc, TRANSPARENT); +} + +// ---------------------------------------------------------- +// CGameText destructor - +// ---------------------------------------------------------- +CGameText::~CGameText() +{ + LINE_INFO *pCur; + + // remove all the text and delete entry in list + while ((pCur = (LINE_INFO *)pLines->RemoveFirst()) != NULL) + { + delete pCur->text; // hope caller alloced these with new! + delete pCur; + } + + delete pLines; + + if (hOldFont) + SelectObject( hdcText, hOldFont ); + + if (hFont) + DeleteObject(hFont); +} + +// ---------------------------------------------------------- +// AddLine - add a new line of text to the list +// ---------------------------------------------------------- +int CGameText::AddLine(LPSTR NewLine, COLORREF Color, COLORREF DropShadow) +{ + LINE_INFO *pCur = new LINE_INFO; + + pCur->text = NewLine; + pCur->nChars = lstrlen(NewLine); + pCur->X = -1; + pCur->Y = -1; + pCur->color = Color; + pCur->shadowX = 0; + pCur->shadowY = 0; + pCur->dropColor = DropShadow; + if (DropShadow != NO_SHADOW) + { + pCur->shadowX = DEFAULT_SHADOWX; + pCur->shadowY = DEFAULT_SHADOWY; + } else { + pCur->shadowX = 0; + pCur->shadowY = 0; + } + + pLines->Append(pCur); + return (++nLines); +} + +// ---------------------------------------------------------- +// ChangeColor - change the color of a particular string in +// the display list. The text is repainted onto the DC. +// ---------------------------------------------------------- +void CGameText::ChangeColor( + int LineIndex, // index of string to recolor + COLORREF NewColor, // color to make string + COLORREF DropColor // color of drop shadow +) +{ + LINE_INFO *pCur; + + if ((LineIndex <= 0) || (LineIndex > nLines)) + { + return; + } + + // Find the line in list + pCur = (LINE_INFO *)pLines->GetFirst(); + for (int ii=1; ii < LineIndex; ii++) + { + pCur = (LINE_INFO *)pLines->GetNext(); + } + + // Change the color of the entry + pCur->color = NewColor; + pCur->dropColor = DropColor; + + // Display drop shadow if any + if (pCur->shadowX || pCur->shadowY) + { + SetTextColor(hdcText, pCur->dropColor); + TextOut(hdcText, pCur->X+pCur->shadowX, pCur->Y+pCur->shadowY + , pCur->text, pCur->nChars); + } + + // Display text + SetTextColor(hdcText, pCur->color); + TextOut(hdcText, pCur->X, pCur->Y, pCur->text, pCur->nChars); +} + +// ---------------------------------------------------------- +// GetText - retrieve text assoicated with a particular index +// ---------------------------------------------------------- +LPSTR CGameText::GetText( + int LineIndex +) +{ + LINE_INFO *pCur; + + if ((LineIndex <= 0) || (LineIndex > nLines)) + { + return(NULL); + } + + pCur = (LINE_INFO *)pLines->GetFirst(); + for (int ii=1; ii < LineIndex; ii++) + { + pCur = (LINE_INFO *)pLines->GetNext(); + } + + return(pCur->text); +} + +// ---------------------------------------------------------- +// TextBlt - draw text to DC +// ---------------------------------------------------------- +int CGameText::TextBlt( + int ScrollPos // offset using for scrolling the data +) +{ + LINE_INFO *pCur; + int TextX, TextY; + int totalLines; + int nDisplayed=0; + + // Figure out how many lines are displayed and how tall each line is + + if (maxLines <= 2) + maxLines = nLines; + +// totalLines = nLines < maxLines ? nLines : maxLines; + totalLines = maxLines; + if (totalLines < 2) + totalLines = 2; + + maxHeight = (rect.bottom - rect.top) / ((totalLines * spacing) - 1); + + // figure out starting point (may be off screen if we are scrolling) + TextY = rect.top+ScrollPos; + TextX = rect.left; + + // If we don't have a font yet -- figure out how big of a font to use + // and create it. + if (hFont == NULL) + { + LOGFONT logFont; + memset(&logFont, 0, sizeof(LOGFONT)); + logFont.lfHeight = maxHeight; + logFont.lfPitchAndFamily = FF_ROMAN; + hFont = CreateFontIndirect(&logFont); + hOldFont = (HFONT)SelectObject(hdcText, hFont); + } + + + // Go through each line of text and display it to the screen. + pCur = (LINE_INFO *)pLines->GetFirst(); + while (pCur != NULL) + { + + // Don't bother if text won't be visible + if ((TextY+maxHeight > rect.top) && (TextY <rect.bottom)) + { + + // paint shadow of text + if (pCur->shadowX || pCur->shadowY) + { + SetTextColor(hdcText, pCur->dropColor); + ExtTextOut(hdcText, TextX+pCur->shadowX + , TextY+pCur->shadowY + , ETO_CLIPPED, &rect + , pCur->text, pCur->nChars, NULL); + } + + // paint text + SetTextColor(hdcText, pCur->color); + ExtTextOut(hdcText, TextX, TextY + , ETO_CLIPPED, &rect + , pCur->text, pCur->nChars, NULL); + + nDisplayed++; + } + + // save position of text + pCur->X = TextX; + pCur->Y = TextY; + TextY += maxHeight * spacing; + + pCur = (LINE_INFO *)pLines->GetNext(); + } + + return(nDisplayed); +} diff --git a/sdk/samples/iklowns/cgtext.h b/sdk/samples/iklowns/cgtext.h new file mode 100644 index 0000000..bfec9ac --- /dev/null +++ b/sdk/samples/iklowns/cgtext.h @@ -0,0 +1,72 @@ +/*===========================================================================*\ +| +| File: cgtext.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef _CGTEXT_H +#define _CGTEXT_H +#include "linklist.h" + +//#define COLOR_RED (PALETTERGB(255,0,0)) +//#define COLOR_RED (RGB(255,0,0)) +#define COLOR_RED (PALETTEINDEX(5)) +#define COLOR_GREEN (PALETTERGB(0,255,0)) +#define COLOR_BLUE (PALETTERGB(0,0,255)) +#define COLOR_BLACK (PALETTERGB(0,0,0)) +#define COLOR_WHITE (PALETTERGB(255,255,255)) +//#define COLOR_YELLOW (PALETTERGB(255, 255, 0)) +#define COLOR_YELLOW (PALETTEINDEX(4)) +#define COLOR_GREY (PALETTERGB(149, 149, 149)) + +#define NO_SHADOW ((COLORREF)-1) + +class CGameText { +private: + int maxWidth; + int maxHeight; + RECT rect; + int nLines; + int maxLines; + int spacing; + CLinkedList *pLines; + HDC hdcText; + HFONT hFont; + HFONT hOldFont; + +public: + CGameText(HDC, LPRECT, int maxLines=2, int lineSpacing=2); + ~CGameText(); + + void SetSpacing(int lineSpacing) { spacing = lineSpacing; }; + void SetMaxLines(int lines) { maxLines = lines; }; + + int AddLine(LPSTR, COLORREF Color = COLOR_RED + , COLORREF DropColor = COLOR_GREY); + void ChangeColor(int, COLORREF, COLORREF DropColor = COLOR_GREY); + LPSTR GetText(int); + int TextBlt(int ScrollPos=0); +}; +#endif diff --git a/sdk/samples/iklowns/cgtile.h b/sdk/samples/iklowns/cgtile.h new file mode 100644 index 0000000..3e76e4e --- /dev/null +++ b/sdk/samples/iklowns/cgtile.h @@ -0,0 +1,43 @@ +/*===========================================================================*\ +| +| File: cgtile.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef CGTILE_H +#define CGTILE_H + +class CGTile +{ +public: + CGameTile(); + ~CGameTile(); + +private: + CGameGraphic mGraphic; +}; + +#endif // CGTILE_H diff --git a/sdk/samples/iklowns/cgtimer.cpp b/sdk/samples/iklowns/cgtimer.cpp new file mode 100644 index 0000000..03b3513 --- /dev/null +++ b/sdk/samples/iklowns/cgtimer.cpp @@ -0,0 +1,141 @@ +/*===========================================================================*\ +| +| File: cgtimer.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include "CGTimer.h" + +static void TimerThread(void); +extern CGameTimer * Timer; +static CRITICAL_SECTION cs; + +CGameTimer::CGameTimer(void) +{ +#if 0 + DWORD id; + // initialize our critical section dude + InitializeCriticalSection(&cs); + + EnterCriticalSection(&cs); + // create our Event item + Event = CreateEvent ( + NULL, + FALSE, // auto-reset + FALSE, // initially not-signalled + NULL + ); + + // create our timer thread + Time = 0; // start at time-slice zero + SetRate(60); // sixty Hertz + + thread = CreateThread( + NULL, + 0, + (LPTHREAD_START_ROUTINE) TimerThread, + NULL, + 0, + &id + ); +// SetThreadPriority( thread, THREAD_PRIORITY_HIGHEST ); + LeaveCriticalSection(&cs); +#endif +} + +CGameTimer::~CGameTimer(void) +{ +#if 0 + // kill the thread + TerminateThread(thread,0); + // remove the Event + CloseHandle(Event); + // and the CS + DeleteCriticalSection(&cs); +#endif +} + +static void TimerThread(void) +{ + long mylasttime = timeGetTime(); + int x; + + while (1) + { + // wait till it's time to wake up + + x = timeGetTime() - mylasttime; + while (x < Timer->rate) + { + Sleep(0); + x = timeGetTime() - mylasttime; + } + mylasttime = timeGetTime(); + + // increment our notion of time + EnterCriticalSection(&cs); + if (!Timer->paused) + { + ++Timer->Time; + SetEvent(Timer->Event); + } // let the other thread go now... + + LeaveCriticalSection(&cs); + } +} + +void CGameTimer::Pause(void) +{ +// EnterCriticalSection(&cs); + paused = TRUE; +// LeaveCriticalSection(&cs); +}; + +void CGameTimer::Resume(void) +{ +// EnterCriticalSection(&cs); + paused = FALSE; +// LeaveCriticalSection(&cs); +}; + +void CGameTimer::SetRate ( int hertz ) +{ + if (hertz) + rate = 1000 / hertz; +} + +int CGameTimer::GetRate (void) +{ + if (rate) + { + return(1000 / rate); + } + else + { + return(0); + } +} diff --git a/sdk/samples/iklowns/cgtimer.h b/sdk/samples/iklowns/cgtimer.h new file mode 100644 index 0000000..61d6b3c --- /dev/null +++ b/sdk/samples/iklowns/cgtimer.h @@ -0,0 +1,46 @@ +/*===========================================================================*\ +| +| File: cgtimer.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +class CGameTimer { + +public: + volatile int paused; + int rate; + HANDLE thread; + HANDLE Event; + volatile int Time; + + CGameTimer (void); + ~CGameTimer (void); + + void SetRate(int hertz); + int GetRate(void); + void Pause(void); + void Resume(void); +}; diff --git a/sdk/samples/iklowns/cgupdate.cpp b/sdk/samples/iklowns/cgupdate.cpp new file mode 100644 index 0000000..9d09464 --- /dev/null +++ b/sdk/samples/iklowns/cgupdate.cpp @@ -0,0 +1,99 @@ +/*===========================================================================*\ +| +| File: cgupdate.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include "cgupdate.h" +#include "cgimage.h" +#include "cgglobl.h" + +//#define FULL_SCREEN_DIRTY + +/*---------------------------------------------------------------------------*\ +| +| Class CGameUpdateList +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ +CGameUpdateList::CGameUpdateList( + ) +{ + Clear(); +} + +CGameUpdateList::~CGameUpdateList() +{ + mDirty = FALSE; +} + +// we make a copy of the rect & add the copy to the list +void +CGameUpdateList::AddRect( + RECT Rect + ) +{ + // first clip new rect to screen boundaries + RECT temp = + { + 0,0,SCREEN_WIDTH-1,SCREEN_HEIGHT-1 + }; + +//#ifndef FULL_SCREEN_DIRTY + if (!gUse_DDraw) + { + // only add if we're on the screen + if (IntersectRect( &temp, &Rect, &temp)) + { + if (mDirty) + { + // already have a rect. Let's make the union of them the new one... + UnionRect(&temp, &mRect, &temp); + } + else + { + // don't have a rect yet... use this one + mDirty = TRUE; + } + mRect = temp; + } + } + else + { + mDirty = TRUE; + mRect = temp; + } +} + +BOOL CGameUpdateList::Intersect( RECT Rect ) // find out if rectangle intersects us... +{ + RECT temp; + return(IntersectRect(&temp, &Rect, &mRect)); +} diff --git a/sdk/samples/iklowns/cgupdate.h b/sdk/samples/iklowns/cgupdate.h new file mode 100644 index 0000000..cf9ffcd --- /dev/null +++ b/sdk/samples/iklowns/cgupdate.h @@ -0,0 +1,59 @@ +/*===========================================================================*\ +| +| File: cgupdate.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef CGUPDATE_H +#define CGUPDATE_H + +#include <linklist.h> + +// NOTE: all update rectangles are inclusive; both coordinates in the +// RECT are included in the update +class CGameUpdateList +{ +public: + CGameUpdateList(); + virtual ~CGameUpdateList(); + + virtual void AddRect( RECT Rect ); // add to update list + virtual BOOL Intersect( RECT Rect ); // find out if rectangle intersects us... + virtual void Clear() { // remove all rectangles + mRect.top = mRect.bottom = mRect.left = mRect.right = 0; + mDirty = FALSE; + }; + virtual LPRECT GetDirtyRect() + { + return &mRect; + } + +protected: + RECT mRect; + BOOL mDirty; +}; + +#endif // CGUPDATE_H diff --git a/sdk/samples/iklowns/cgutil.mak b/sdk/samples/iklowns/cgutil.mak new file mode 100644 index 0000000..770884b --- /dev/null +++ b/sdk/samples/iklowns/cgutil.mak @@ -0,0 +1,186 @@ +# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +!IF "$(CFG)" == "" +CFG=Win32 Debug +!MESSAGE No configuration specified. Defaulting to Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CGUTIL.MAK" CFG="Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "Win32 Debug" +CPP=cl.exe + +!IF "$(CFG)" == "Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "retail" +# PROP BASE Intermediate_Dir "retail" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "retail" +# PROP Intermediate_Dir "retail" +OUTDIR=.\retail +INTDIR=.\retail + +ALL : $(OUTDIR)/cgutil.lib $(OUTDIR)/CGUTIL.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /G3 /W3 /WX /GX /YX /O2 /I ".\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c +CPP_PROJ=/nologo /G3 /W3 /WX /GX /YX /O2 /I ".\include" /D "WIN32" /D "STRICT" /D "NDEBUG"\ + /D "_WINDOWS" /FR$(INTDIR)/ /Fp$(OUTDIR)/"CGUTIL.pch" /Fo$(INTDIR)/ /c +CPP_OBJS=.\retail/ +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"CGUTIL.bsc" +BSC32_SBRS= \ + $(INTDIR)/CGEXCPT.SBR \ + $(INTDIR)/CGRES.SBR \ + $(INTDIR)/STRREC.SBR + +$(OUTDIR)/CGUTIL.bsc : $(OUTDIR) $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=lib.exe +# ADD BASE LIB32 /NOLOGO +# ADD LIB32 /NOLOGO /OUT:"$(OUTDIR)/cgutil.lib" +LIB32_FLAGS=/NOLOGO /OUT:"$(OUTDIR)/cgutil.lib" +DEF_FLAGS= +DEF_FILE= +LIB32_OBJS= \ + $(INTDIR)/CGEXCPT.OBJ \ + $(INTDIR)/CGRES.OBJ \ + $(INTDIR)/STRREC.OBJ + +$(OUTDIR)/cgutil.lib : $(OUTDIR) $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "debug" +# PROP BASE Intermediate_Dir "debug" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "debug" +# PROP Intermediate_Dir "debug" +OUTDIR=.\debug +INTDIR=.\debug + +ALL : $(OUTDIR)/CGUTIL.LIB $(OUTDIR)/CGUTIL.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE CPP /nologo /W3 /GX /Z7 /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /G3 /W3 /WX /GX /Z7 /YX /Od /I ".\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c +CPP_PROJ=/nologo /G3 /W3 /WX /GX /Z7 /YX /Od /I ".\include" /D "WIN32" /D\ + "_DEBUG" /D "STRICT" /D "_WINDOWS" /FR$(INTDIR)/ /Fp$(OUTDIR)/"CGUTIL.pch" /Fo$(INTDIR)/ /c\ + +CPP_OBJS=.\debug/ +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"CGUTIL.bsc" +BSC32_SBRS= \ + $(INTDIR)/CGEXCPT.SBR \ + $(INTDIR)/CGRES.SBR \ + $(INTDIR)/STRREC.SBR + +$(OUTDIR)/CGUTIL.bsc : $(OUTDIR) $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=lib.exe +# ADD BASE LIB32 /NOLOGO +# ADD LIB32 /NOLOGO /OUT:"$(OUTDIR)/cgutil.lib" +LIB32_FLAGS=/NOLOGO /OUT:"$(OUTDIR)/cgutil.lib" +DEF_FLAGS= +DEF_FILE= +LIB32_OBJS= \ + $(INTDIR)/CGEXCPT.OBJ \ + $(INTDIR)/CGRES.OBJ \ + $(INTDIR)/STRREC.OBJ + +$(OUTDIR)/CGUTIL.LIB : $(OUTDIR) $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Group "Source Files" + +################################################################################ +# Begin Source File + +SOURCE=.\CGEXCPT.CPP +DEP_CGEXC=\ + .\include\cgres.h\ + .\include\cgexcpt.h + +$(INTDIR)/CGEXCPT.OBJ : $(SOURCE) $(DEP_CGEXC) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGRES.CPP +DEP_CGRES=\ + .\include\cgexcpt.h\ + .\include\cgres.h + +$(INTDIR)/CGRES.OBJ : $(SOURCE) $(DEP_CGRES) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\STRREC.CPP +DEP_STRRE=\ + .\include\strrec.h + +$(INTDIR)/STRREC.OBJ : $(SOURCE) $(DEP_STRRE) $(INTDIR) + +# End Source File +# End Group +# End Project +################################################################################ diff --git a/sdk/samples/iklowns/cgwave.cpp b/sdk/samples/iklowns/cgwave.cpp new file mode 100644 index 0000000..d2b9dc4 --- /dev/null +++ b/sdk/samples/iklowns/cgwave.cpp @@ -0,0 +1,336 @@ +/*===========================================================================*\ +| +| File: cgwave.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +//** include files ** +#ifndef __WATCOMC__ +#define WIN32_LEAN_AND_MEAN +#endif +#include <windows.h> +#include <windowsx.h> +#include "cgwave.h" + +//** local definitions ** +//** external functions ** +//** external data ** +//** public data ** +//** private data ** +//** public functions ** +//** private functions ** + +// ---------------------------------------------------------- +// WaveOpenFile - +// This function will open a wave input file and prepare +// it for reading, so the data can be easily read with +// WaveReadFile. Returns 0 if successful, the error code +// if not. +// pszFileName - Input filename to load. +// phmmioIn - Pointer to handle which will +// be used for further mmio routines. +// ppwfxInfo - Ptr to ptr to WaveFormatEx +// structure with all info about the file. +// ---------------------------------------------------------- +int WaveOpenFile( + char *pszFileName, + HMMIO *phmmioIn, + WAVEFORMATEX **ppwfxInfo, + MMCKINFO *pckInRIFF +) +{ + + HMMIO hmmioIn; + MMCKINFO ckIn; // chunk info. for general use. + PCMWAVEFORMAT pcmWaveFormat; // Temporary PCM format structure to load in. + WORD cbExtraAlloc; // Extra bytes for waveformatex structure for weird formats. + int nError; // Return value. + + + // Initialization... + *ppwfxInfo = NULL; + nError = 0; + hmmioIn = NULL; + + if ((hmmioIn = mmioOpen(pszFileName, NULL, MMIO_ALLOCBUF | MMIO_READ)) == NULL) + { + nError = ER_CANNOTOPEN; + goto ERROR_READING_WAVE; + } + + if ((nError = (int)mmioDescend(hmmioIn, pckInRIFF, NULL, 0)) != 0) + { + goto ERROR_READING_WAVE; + } + + + if ((pckInRIFF->ckid != FOURCC_RIFF) || (pckInRIFF->fccType != mmioFOURCC('W', 'A', 'V', 'E'))) + { + nError = ER_NOTWAVEFILE; + goto ERROR_READING_WAVE; + } + + /* Search the input file for for the 'fmt ' chunk. */ + ckIn.ckid = mmioFOURCC('f', 'm', 't', ' '); + if ((nError = (int)mmioDescend(hmmioIn, &ckIn, pckInRIFF, MMIO_FINDCHUNK)) != 0) + { + goto ERROR_READING_WAVE; + } + + /* Expect the 'fmt' chunk to be at least as large as <PCMWAVEFORMAT>; + * if there are extra parameters at the end, we'll ignore them */ + + if (ckIn.cksize < (long) sizeof(PCMWAVEFORMAT)) + { + nError = ER_NOTWAVEFILE; + goto ERROR_READING_WAVE; + } + + /* Read the 'fmt ' chunk into <pcmWaveFormat>.*/ + if (mmioRead(hmmioIn, (HPSTR) &pcmWaveFormat, (long) sizeof(pcmWaveFormat)) != (long) sizeof(pcmWaveFormat)) + { + nError = ER_CANNOTREAD; + goto ERROR_READING_WAVE; + } + + + // Ok, allocate the waveformatex, but if its not pcm + // format, read the next word, and thats how many extra + // bytes to allocate. + if (pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_PCM) + cbExtraAlloc = 0; + + else + { + // Read in length of extra bytes. + if (mmioRead(hmmioIn, (LPSTR) &cbExtraAlloc, + (long) sizeof(cbExtraAlloc)) != (long) sizeof(cbExtraAlloc)) + { + nError = ER_CANNOTREAD; + goto ERROR_READING_WAVE; + } + + } + + // Ok, now allocate that waveformatex structure. + if ((*ppwfxInfo = (LPWAVEFORMATEX)GlobalAlloc(GMEM_FIXED + , sizeof(WAVEFORMATEX)+cbExtraAlloc)) == NULL) + { + nError = ER_MEM; + goto ERROR_READING_WAVE; + } + + // Copy the bytes from the pcm structure to the waveformatex structure + memcpy(*ppwfxInfo, &pcmWaveFormat, sizeof(pcmWaveFormat)); + (*ppwfxInfo)->cbSize = cbExtraAlloc; + + // Now, read those extra bytes into the structure, if cbExtraAlloc != 0. + if (cbExtraAlloc != 0) + { + if (mmioRead(hmmioIn, (LPSTR) (((BYTE*)&((*ppwfxInfo)->cbSize))+sizeof(cbExtraAlloc)), + (long) (cbExtraAlloc)) != (long) (cbExtraAlloc)) + { + nError = ER_NOTWAVEFILE; + goto ERROR_READING_WAVE; + } + } + + /* Ascend the input file out of the 'fmt ' chunk. */ + if ((nError = mmioAscend(hmmioIn, &ckIn, 0)) != 0) + { + goto ERROR_READING_WAVE; + } + + + goto TEMPCLEANUP; + +ERROR_READING_WAVE: + if (*ppwfxInfo != NULL) + { + GlobalFree(*ppwfxInfo); + *ppwfxInfo = NULL; + } + + if (hmmioIn != NULL) + { + mmioClose(hmmioIn, 0); + hmmioIn = NULL; + } + +TEMPCLEANUP: + *phmmioIn = hmmioIn; + + return(nError); + +} + + +// ---------------------------------------------------------- +// WaveStartDataRead - +// This routine has to be called before WaveReadFile as +// it searchs for the chunk to descend into for reading, +// that is, the 'data' chunk. For simplicity, this used +// to be in the open routine, but was taken out and moved +// to a separate routine so there was more control on the +// chunks that are before the data chunk, such as 'fact', +// etc... +// ---------------------------------------------------------- +int WaveStartDataRead( + HMMIO *phmmioIn, + MMCKINFO *pckIn, + MMCKINFO *pckInRIFF +) +{ + int nError; + + nError = 0; + + // Do a nice little seek... + if ((nError = mmioSeek(*phmmioIn, pckInRIFF->dwDataOffset + + sizeof(FOURCC), SEEK_SET)) == -1) + { + //Assert(FALSE); + goto ERROR_READING_WAVE; + } + + nError = 0; + // Search the input file for for the 'data' chunk. + pckIn->ckid = mmioFOURCC('d', 'a', 't', 'a'); + if ((nError = mmioDescend(*phmmioIn, pckIn, pckInRIFF, MMIO_FINDCHUNK)) != 0) + { + goto ERROR_READING_WAVE; + } + + goto CLEANUP; + +ERROR_READING_WAVE: + +CLEANUP: + return(nError); +} + + +// ---------------------------------------------------------- +// WaveReadFile - +// This will read wave data from the wave file. Make +// sure we're descended into the data chunk, else this +// will fail bigtime! +// hmmioIn - Handle to mmio. +// cbRead - # of bytes to read. +// pbDest - Destination buffer to put bytes. +// cbActualRead - # of bytes actually read. +// ---------------------------------------------------------- +int WaveReadFile( + HMMIO hmmioIn, + UINT cbRead, + BYTE *pbDest, + MMCKINFO *pckIn, + UINT *cbActualRead +) +{ + + MMIOINFO mmioinfoIn; // current status of <hmmioIn> + int nError; + UINT cT, cbDataIn; + + nError = 0; + + if (nError = mmioGetInfo(hmmioIn, &mmioinfoIn, 0) != 0) + { + goto ERROR_CANNOT_READ; + } + + cbDataIn = cbRead; + if (cbDataIn > pckIn->cksize) + cbDataIn = pckIn->cksize; + + pckIn->cksize -= cbDataIn; + + for (cT = 0; cT < cbDataIn; cT++) + { + /* Copy the bytes from the io to the buffer. */ + if (mmioinfoIn.pchNext == mmioinfoIn.pchEndRead) + { + if ((nError = mmioAdvance(hmmioIn, &mmioinfoIn, MMIO_READ)) != 0) + { + goto ERROR_CANNOT_READ; + } + if (mmioinfoIn.pchNext == mmioinfoIn.pchEndRead) + { + nError = ER_CORRUPTWAVEFILE; + goto ERROR_CANNOT_READ; + } + } + + // Actual copy. + *((BYTE*)pbDest+cT) = *((BYTE*)mmioinfoIn.pchNext++); + } + + if ((nError = mmioSetInfo(hmmioIn, &mmioinfoIn, 0)) != 0) + { + goto ERROR_CANNOT_READ; + } + + *cbActualRead = cbDataIn; + goto FINISHED_READING; + +ERROR_CANNOT_READ: + *cbActualRead = 0; + +FINISHED_READING: + return(nError); + +} + +// ---------------------------------------------------------- +// WaveCloseFile - +// This will close the wave file openned with WaveOpenFile. +// phmmioIn - Pointer to the handle to input MMIO. +// ppwfxSrc - Pointer to pointer to WaveFormatEx structure. +// +// Returns 0 if successful, non-zero if there was a warning. +// ---------------------------------------------------------- +int WaveCloseReadFile( + HMMIO *phmmio, + WAVEFORMATEX **ppwfxSrc +) +{ + + if (*ppwfxSrc != NULL) + { + GlobalFree(*ppwfxSrc); + *ppwfxSrc = NULL; + } + + if (*phmmio != NULL) + { + mmioClose(*phmmio, 0); + *phmmio = NULL; + } + + return(0); + +} diff --git a/sdk/samples/iklowns/cgwave.h b/sdk/samples/iklowns/cgwave.h new file mode 100644 index 0000000..90bf637 --- /dev/null +++ b/sdk/samples/iklowns/cgwave.h @@ -0,0 +1,80 @@ +/*===========================================================================*\ +| +| File: cgwave.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#ifndef _CGWAVE_H +#define _CGWAVE_H +#include <mmsystem.h> + +#define WAVEVERSION 1 + +#ifndef ER_MEM +#define ER_MEM 0xe000 +#endif + +#ifndef ER_CANNOTOPEN +#define ER_CANNOTOPEN 0xe100 +#endif + +#ifndef ER_NOTWAVEFILE +#define ER_NOTWAVEFILE 0xe101 +#endif + +#ifndef ER_CANNOTREAD +#define ER_CANNOTREAD 0xe102 +#endif + +#ifndef ER_CORRUPTWAVEFILE +#define ER_CORRUPTWAVEFILE 0xe103 +#endif + +#ifndef ER_CANNOTWRITE +#define ER_CANNOTWRITE 0xe104 +#endif + + +int WaveOpenFile( + char *pszFileName, + HMMIO *phmmioIn, + WAVEFORMATEX **ppwfxInfo, + MMCKINFO *pckInRIFF +); + +int WaveStartDataRead( + HMMIO *phmmioIn, + MMCKINFO *pckIn, + MMCKINFO *pckInRIFF +); + +int WaveReadFile( + HMMIO hmmioIn, + UINT cbRead, + BYTE *pbDest, + MMCKINFO *pckIn, + UINT *cbActualRead +); +#endif diff --git a/sdk/samples/iklowns/data/backdrop.bmp b/sdk/samples/iklowns/data/backdrop.bmp new file mode 100644 index 0000000..8aaa249 Binary files /dev/null and b/sdk/samples/iklowns/data/backdrop.bmp differ diff --git a/sdk/samples/iklowns/data/bang.wav b/sdk/samples/iklowns/data/bang.wav new file mode 100644 index 0000000..2d270b9 Binary files /dev/null and b/sdk/samples/iklowns/data/bang.wav differ diff --git a/sdk/samples/iklowns/data/bigtbig.bmp b/sdk/samples/iklowns/data/bigtbig.bmp new file mode 100644 index 0000000..de42d96 Binary files /dev/null and b/sdk/samples/iklowns/data/bigtbig.bmp differ diff --git a/sdk/samples/iklowns/data/bigtbig.tle b/sdk/samples/iklowns/data/bigtbig.tle new file mode 100644 index 0000000..d162de0 Binary files /dev/null and b/sdk/samples/iklowns/data/bigtbig.tle differ diff --git a/sdk/samples/iklowns/data/bigtop.bmp b/sdk/samples/iklowns/data/bigtop.bmp new file mode 100644 index 0000000..e428d8d Binary files /dev/null and b/sdk/samples/iklowns/data/bigtop.bmp differ diff --git a/sdk/samples/iklowns/data/bigtop.tle b/sdk/samples/iklowns/data/bigtop.tle new file mode 100644 index 0000000..a115364 Binary files /dev/null and b/sdk/samples/iklowns/data/bigtop.tle differ diff --git a/sdk/samples/iklowns/data/bigtsml.bmp b/sdk/samples/iklowns/data/bigtsml.bmp new file mode 100644 index 0000000..dcbafeb Binary files /dev/null and b/sdk/samples/iklowns/data/bigtsml.bmp differ diff --git a/sdk/samples/iklowns/data/bigtsml.tle b/sdk/samples/iklowns/data/bigtsml.tle new file mode 100644 index 0000000..ee91246 Binary files /dev/null and b/sdk/samples/iklowns/data/bigtsml.tle differ diff --git a/sdk/samples/iklowns/data/bkgrnd.bmp b/sdk/samples/iklowns/data/bkgrnd.bmp new file mode 100644 index 0000000..98ae0ca Binary files /dev/null and b/sdk/samples/iklowns/data/bkgrnd.bmp differ diff --git a/sdk/samples/iklowns/data/blow1.wav b/sdk/samples/iklowns/data/blow1.wav new file mode 100644 index 0000000..aae9ebc Binary files /dev/null and b/sdk/samples/iklowns/data/blow1.wav differ diff --git a/sdk/samples/iklowns/data/blow2.wav b/sdk/samples/iklowns/data/blow2.wav new file mode 100644 index 0000000..f75e99d Binary files /dev/null and b/sdk/samples/iklowns/data/blow2.wav differ diff --git a/sdk/samples/iklowns/data/c1block.bmp b/sdk/samples/iklowns/data/c1block.bmp new file mode 100644 index 0000000..d1d1e0b Binary files /dev/null and b/sdk/samples/iklowns/data/c1block.bmp differ diff --git a/sdk/samples/iklowns/data/c1block.spr b/sdk/samples/iklowns/data/c1block.spr new file mode 100644 index 0000000..e959d67 --- /dev/null +++ b/sdk/samples/iklowns/data/c1block.spr @@ -0,0 +1,77 @@ +[BlockLeft] +C1blol01.dib=1 +C1blol03.dib=1 +C1blol05.dib=1 +C1blol07.dib=1 +C1blol09.dib=1 + +[C1blol01.dib] +X=0 +Y=0 +Width=57 +Height=133 + +[C1blol03.dib] +X=57 +Y=0 +Width=57 +Height=133 + +[C1blol05.dib] +X=57 +Y=0 +Width=57 +Height=133 + +[C1blol07.dib] +X=171 +Y=0 +Width=57 +Height=133 + +[C1blol09.dib] +X=114 +Y=0 +Width=57 +Height=133 + +[Sequences] +BlockLeft=3 +BlockRight=3 + +[BlockRight] +C1blor01.dib=1 +C1blor03.dib=1 +C1blor05.dib=1 +C1blor07.dib=1 +C1blor09.dib=1 + +[C1blor01.dib] +X=0 +Y=133 +Width=58 +Height=133 + +[C1blor03.dib] +X=58 +Y=133 +Width=58 +Height=133 + +[C1blor05.dib] +X=58 +Y=133 +Width=58 +Height=133 + +[C1blor07.dib] +X=174 +Y=133 +Width=58 +Height=133 + +[C1blor09.dib] +X=116 +Y=133 +Width=58 +Height=133 diff --git a/sdk/samples/iklowns/data/c1duck.bmp b/sdk/samples/iklowns/data/c1duck.bmp new file mode 100644 index 0000000..cb71020 Binary files /dev/null and b/sdk/samples/iklowns/data/c1duck.bmp differ diff --git a/sdk/samples/iklowns/data/c1duck.spr b/sdk/samples/iklowns/data/c1duck.spr new file mode 100644 index 0000000..e0b00d2 --- /dev/null +++ b/sdk/samples/iklowns/data/c1duck.spr @@ -0,0 +1,78 @@ +[DuckLeft] +C1ducl01.dib=1 +C1ducl05.dib=1 +C1ducl09.dib=1 +C1ducl13.dib=1 +C1ducl17.dib=1 + +[C1ducl01.dib] +X=0 +Y=0 +Width=58 +Height=132 + +[C1ducl05.dib] +X=58 +Y=0 +Width=66 +Height=132 + +[C1ducl09.dib] +X=124 +Y=0 +Width=74 +Height=134 + +[C1ducl13.dib] +X=198 +Y=0 +Width=70 +Height=134 + +[C1ducl17.dib] +X=268 +Y=0 +Width=63 +Height=133 + +[Sequences] +DuckLeft=5 +DuckRight=5 + +[DuckRight] +C1ducr01.dib=1 +C1ducr05.dib=1 +C1ducr09.dib=1 +C1ducr13.dib=1 +C1ducr17.dib=1 + +[C1ducr01.dib] +X=0 +Y=134 +Width=72 +Height=132 + +[C1ducr05.dib] +X=72 +Y=134 +Width=68 +Height=131 + +[C1ducr09.dib] +X=140 +Y=134 +Width=65 +Height=131 + +[C1ducr13.dib] +X=205 +Y=134 +Width=68 +Height=131 + +[C1ducr17.dib] +X=273 +Y=134 +Width=72 +Height=132 + diff --git a/sdk/samples/iklowns/data/c1piefac.bmp b/sdk/samples/iklowns/data/c1piefac.bmp new file mode 100644 index 0000000..f4219cd Binary files /dev/null and b/sdk/samples/iklowns/data/c1piefac.bmp differ diff --git a/sdk/samples/iklowns/data/c1piefac.spr b/sdk/samples/iklowns/data/c1piefac.spr new file mode 100644 index 0000000..43125d0 --- /dev/null +++ b/sdk/samples/iklowns/data/c1piefac.spr @@ -0,0 +1,63 @@ +[PieFaceLeft] +C1pfal01.dib=1 +C1pfal03.dib=1 +C1pfal05.dib=1 +Piefacel.bmp=1 + +[C1pfal01.dib] +X=0 +Y=0 +Width=70 +Height=133 + +[C1pfal03.dib] +X=70 +Y=0 +Width=70 +Height=133 + +[C1pfal05.dib] +X=140 +Y=0 +Width=70 +Height=133 + +[Piefacel.bmp] +X=210 +Y=0 +Width=70 +Height=133 + +[Sequences] +PieFaceLeft=4 +PieFaceRight=4 + +[PieFaceRight] +C1pfar01.dib=1 +C1pfar03.dib=1 +C1pfar05.dib=1 +Piefacer.bmp=1 + +[C1pfar01.dib] +X=0 +Y=133 +Width=70 +Height=133 + +[C1pfar03.dib] +X=70 +Y=133 +Width=58 +Height=133 + +[C1pfar05.dib] +X=128 +Y=133 +Width=58 +Height=133 + +[Piefacer.bmp] +X=186 +Y=133 +Width=58 +Height=133 diff --git a/sdk/samples/iklowns/data/c1piehed.bmp b/sdk/samples/iklowns/data/c1piehed.bmp new file mode 100644 index 0000000..4764726 Binary files /dev/null and b/sdk/samples/iklowns/data/c1piehed.bmp differ diff --git a/sdk/samples/iklowns/data/c1piehed.spr b/sdk/samples/iklowns/data/c1piehed.spr new file mode 100644 index 0000000..8572f16 --- /dev/null +++ b/sdk/samples/iklowns/data/c1piehed.spr @@ -0,0 +1,63 @@ +[PieHeadLeft] +C1phel01.dib=1 +C1phel03.dib=1 +C1phel05.dib=1 +Pieheadl.bmp=1 + +[C1phel01.dib] +X=0 +Y=0 +Width=100 +Height=133 + +[C1phel03.dib] +X=100 +Y=0 +Width=76 +Height=133 + +[C1phel05.dib] +X=176 +Y=0 +Width=57 +Height=133 + +[Pieheadl.bmp] +X=233 +Y=0 +Width=57 +Height=133 + +[Sequences] +PieHeadLeft=4 +PieHeadRight=4 + +[PieHeadRight] +C1pher01.dib=1 +C1pher03.dib=1 +C1pher05.dib=1 +Pieheadr.bmp=1 + +[C1pher01.dib] +X=0 +Y=133 +Width=101 +Height=133 + +[C1pher03.dib] +X=101 +Y=133 +Width=101 +Height=133 + +[C1pher05.dib] +X=202 +Y=133 +Width=101 +Height=133 + +[Pieheadr.bmp] +X=303 +Y=133 +Width=101 +Height=133 diff --git a/sdk/samples/iklowns/data/c1poke.bmp b/sdk/samples/iklowns/data/c1poke.bmp new file mode 100644 index 0000000..e8deea4 Binary files /dev/null and b/sdk/samples/iklowns/data/c1poke.bmp differ diff --git a/sdk/samples/iklowns/data/c1poke.spr b/sdk/samples/iklowns/data/c1poke.spr new file mode 100644 index 0000000..962601b --- /dev/null +++ b/sdk/samples/iklowns/data/c1poke.spr @@ -0,0 +1,77 @@ +[PokeLeft] +C1eyel01.dib=1 +C1eyel03.dib=1 +C1eyel05.dib=1 +C1eyel07.dib=1 +C1eyel09.dib=1 + +[C1eyel01.dib] +X=0 +Y=0 +Width=61 +Height=133 + +[C1eyel03.dib] +X=61 +Y=0 +Width=61 +Height=133 + +[C1eyel05.dib] +X=61 +Y=0 +Width=61 +Height=133 + +[C1eyel07.dib] +X=183 +Y=0 +Width=61 +Height=133 + +[C1eyel09.dib] +X=122 +Y=0 +Width=61 +Height=133 + +[Sequences] +PokeLeft=3 +PokeRight=3 + +[PokeRight] +C1eyer01.dib=1 +C1eyer03.dib=1 +C1eyer05.dib=1 +C1eyer07.dib=1 +C1eyer09.dib=1 + +[C1eyer01.dib] +X=0 +Y=133 +Width=58 +Height=133 + +[C1eyer03.dib] +X=58 +Y=133 +Width=58 +Height=133 + +[C1eyer05.dib] +X=58 +Y=133 +Width=59 +Height=133 + +[C1eyer07.dib] +X=175 +Y=133 +Width=58 +Height=133 + +[C1eyer09.dib] +X=117 +Y=133 +Width=58 +Height=133 diff --git a/sdk/samples/iklowns/data/c1run.bmp b/sdk/samples/iklowns/data/c1run.bmp new file mode 100644 index 0000000..eb82040 Binary files /dev/null and b/sdk/samples/iklowns/data/c1run.bmp differ diff --git a/sdk/samples/iklowns/data/c1run.spr b/sdk/samples/iklowns/data/c1run.spr new file mode 100644 index 0000000..1293662 --- /dev/null +++ b/sdk/samples/iklowns/data/c1run.spr @@ -0,0 +1,119 @@ +[RunLeft] +C1-rul01.dib=1 +C1-rul03.dib=1 +C1-rul05.dib=1 +C1-rul07.dib=1 +C1-rul09.dib=1 +C1-rul11.dib=1 +C1-rul13.dib=1 +C1-rul15.dib=1 + +[C1-rul01.dib] +X=0 +Y=0 +Width=110 +Height=125 + +[C1-rul03.dib] +X=110 +Y=0 +Width=94 +Height=137 + +[C1-rul05.dib] +X=204 +Y=0 +Width=91 +Height=134 + +[C1-rul07.dib] +X=295 +Y=0 +Width=107 +Height=131 + +[C1-rul09.dib] +X=402 +Y=0 +Width=110 +Height=123 + +[C1-rul11.dib] +X=512 +Y=0 +Width=95 +Height=131 + +[C1-rul13.dib] +X=607 +Y=0 +Width=91 +Height=137 + +[C1-rul15.dib] +X=698 +Y=0 +Width=106 +Height=130 + +[Sequences] +RunLeft=8 +RunRight=8 + +[RunRight] +C1-rur01.dib=1 +C1-rur03.dib=1 +C1-rur05.dib=1 +C1-rur07.dib=1 +C1-rur09.dib=1 +C1-rur11.dib=1 +C1-rur13.dib=1 +C1-rur15.dib=1 + +[C1-rur01.dib] +X=0 +Y=137 +Width=105 +Height=123 + +[C1-rur03.dib] +X=105 +Y=137 +Width=87 +Height=136 + +[C1-rur05.dib] +X=192 +Y=137 +Width=90 +Height=133 + +[C1-rur07.dib] +X=282 +Y=137 +Width=110 +Height=130 + +[C1-rur09.dib] +X=392 +Y=137 +Width=106 +Height=125 + +[C1-rur11.dib] +X=498 +Y=137 +Width=87 +Height=132 + +[C1-rur13.dib] +X=585 +Y=137 +Width=95 +Height=138 + +[C1-rur15.dib] +X=680 +Y=137 +Width=109 +Height=131 diff --git a/sdk/samples/iklowns/data/c1sad.bmp b/sdk/samples/iklowns/data/c1sad.bmp new file mode 100644 index 0000000..6e0da4e Binary files /dev/null and b/sdk/samples/iklowns/data/c1sad.bmp differ diff --git a/sdk/samples/iklowns/data/c1sad.spr b/sdk/samples/iklowns/data/c1sad.spr new file mode 100644 index 0000000..f5313b2 --- /dev/null +++ b/sdk/samples/iklowns/data/c1sad.spr @@ -0,0 +1,151 @@ +[C1SadDone] +C1sadl10.dib=1 + +[C1SadLeft] +C1sadl01.dib=1 +C1sadl02.dib=1 +C1sadl03.dib=1 +C1sadl04.dib=1 +C1sadl05.dib=1 +C1sadl06.dib=1 +C1sadl07.dib=1 +C1sadl08.dib=1 +C1sadl09.dib=1 +C1sadl10.dib=1 + +[C1sadl01.dib] +X=0 +Y=0 +Width=140 +Height=140 + +[C1sadl02.dib] +X=140 +Y=0 +Width=140 +Height=140 + +[C1sadl03.dib] +X=280 +Y=0 +Width=140 +Height=140 + +[C1sadl04.dib] +X=420 +Y=0 +Width=140 +Height=140 + +[C1sadl05.dib] +X=560 +Y=0 +Width=140 +Height=140 + +[C1sadl06.dib] +X=700 +Y=0 +Width=140 +Height=140 + +[C1sadl07.dib] +X=840 +Y=0 +Width=140 +Height=140 + +[C1sadl08.dib] +X=980 +Y=0 +Width=140 +Height=140 + +[C1sadl09.dib] +X=1120 +Y=0 +Width=140 +Height=140 + +[C1sadl10.dib] +X=1260 +Y=0 +Width=140 +Height=140 + +[Sequences] +C1SadLeft=10 +C1SadRight=10 +C1SadDone=1 + +[C1SadRight] +C1sadr01.dib=1 +C1sadr02.dib=1 +C1sadr03.dib=1 +C1sadr04.dib=1 +C1sadr05.dib=1 +C1sadr06.dib=1 +C1sadr07.dib=1 +C1sadr08.dib=1 +C1sadr09.dib=1 +C1sadr10.dib=1 + +[C1sadr01.dib] +X=0 +Y=140 +Width=140 +Height=140 + +[C1sadr02.dib] +X=140 +Y=140 +Width=140 +Height=140 + +[C1sadr03.dib] +X=280 +Y=140 +Width=140 +Height=140 + +[C1sadr04.dib] +X=420 +Y=140 +Width=140 +Height=140 + +[C1sadr05.dib] +X=560 +Y=140 +Width=140 +Height=140 + +[C1sadr06.dib] +X=700 +Y=140 +Width=140 +Height=140 + +[C1sadr07.dib] +X=840 +Y=140 +Width=140 +Height=140 + +[C1sadr08.dib] +X=980 +Y=140 +Width=140 +Height=140 + +[C1sadr09.dib] +X=1120 +Y=140 +Width=140 +Height=140 + +[C1sadr10.dib] +X=1260 +Y=140 +Width=140 +Height=140 diff --git a/sdk/samples/iklowns/data/c1stand.bmp b/sdk/samples/iklowns/data/c1stand.bmp new file mode 100644 index 0000000..9cb6933 Binary files /dev/null and b/sdk/samples/iklowns/data/c1stand.bmp differ diff --git a/sdk/samples/iklowns/data/c1stand.spr b/sdk/samples/iklowns/data/c1stand.spr new file mode 100644 index 0000000..d466bd8 --- /dev/null +++ b/sdk/samples/iklowns/data/c1stand.spr @@ -0,0 +1,21 @@ +[StandLeft] +C1thrl01.dib=1 + +[C1thrl01.dib] +X=0 +Y=0 +Width=57 +Height=133 + +[Sequences] +StandLeft=1 +StandRight=1 + +[StandRight] +C1thrr01.dib=1 + +[C1thrr01.dib] +X=0 +Y=133 +Width=79 +Height=133 diff --git a/sdk/samples/iklowns/data/c1throw.bmp b/sdk/samples/iklowns/data/c1throw.bmp new file mode 100644 index 0000000..065d6bd Binary files /dev/null and b/sdk/samples/iklowns/data/c1throw.bmp differ diff --git a/sdk/samples/iklowns/data/c1throw.spr b/sdk/samples/iklowns/data/c1throw.spr new file mode 100644 index 0000000..f864750 --- /dev/null +++ b/sdk/samples/iklowns/data/c1throw.spr @@ -0,0 +1,63 @@ +[ThrowLeft] +c1thrl01.dib=1 +c1thrl05.dib=1 +c1thrl09.dib=1 +c1thrl13.dib=1 + +[c1thrl01.dib] +X=0 +Y=0 +Width=57 +Height=133 + +[c1thrl05.dib] +X=57 +Y=0 +Width=57 +Height=133 + +[c1thrl09.dib] +X=114 +Y=0 +Width=57 +Height=133 + +[c1thrl13.dib] +X=171 +Y=0 +Width=57 +Height=133 + +[Sequences] +ThrowLeft=4 +ThrowRight=4 + +[ThrowRight] +c1thrr01.dib=1 +c1thrr05.dib=1 +c1thrr09.dib=1 +c1thrr13.dib=1 + +[c1thrr01.dib] +X=0 +Y=133 +Width=80 +Height=133 + +[c1thrr05.dib] +X=80 +Y=133 +Width=79 +Height=133 + +[c1thrr09.dib] +X=159 +Y=133 +Width=79 +Height=133 + +[c1thrr13.dib] +X=238 +Y=133 +Width=73 +Height=133 diff --git a/sdk/samples/iklowns/data/c1turn.bmp b/sdk/samples/iklowns/data/c1turn.bmp new file mode 100644 index 0000000..ee61630 Binary files /dev/null and b/sdk/samples/iklowns/data/c1turn.bmp differ diff --git a/sdk/samples/iklowns/data/c1turn.spr b/sdk/samples/iklowns/data/c1turn.spr new file mode 100644 index 0000000..5900f19 --- /dev/null +++ b/sdk/samples/iklowns/data/c1turn.spr @@ -0,0 +1,64 @@ +[Left2Right] +C1turl01.dib=1 +C1turl05.dib=1 +C1turl09.dib=1 +C1turl13.dib=1 + +[C1turl01.dib] +X=0 +Y=0 +Width=76 +Height=133 + +[C1turl05.dib] +X=76 +Y=0 +Width=60 +Height=136 + +[C1turl09.dib] +X=136 +Y=0 +Width=68 +Height=138 + +[C1turl13.dib] +X=204 +Y=0 +Width=86 +Height=138 + +[Sequences] +Left2Right=4 +Right2Left=4 + +[Right2Left] +C1turr01.dib=1 +C1turr05.dib=1 +C1turr09.dib=1 +C1turr13.dib=1 + +[C1turr01.dib] +X=0 +Y=138 +Width=84 +Height=135 + +[C1turr05.dib] +X=84 +Y=138 +Width=73 +Height=131 + +[C1turr09.dib] +X=157 +Y=138 +Width=65 +Height=135 + +[C1turr13.dib] +X=222 +Y=138 +Width=67 +Height=134 + diff --git a/sdk/samples/iklowns/data/c1walk.bmp b/sdk/samples/iklowns/data/c1walk.bmp new file mode 100644 index 0000000..c8c1b83 Binary files /dev/null and b/sdk/samples/iklowns/data/c1walk.bmp differ diff --git a/sdk/samples/iklowns/data/c1walk.spr b/sdk/samples/iklowns/data/c1walk.spr new file mode 100644 index 0000000..d88d28c --- /dev/null +++ b/sdk/samples/iklowns/data/c1walk.spr @@ -0,0 +1,105 @@ +[WalkLeft] +C1wall11.dib=1 +C1wall13.dib=1 +C1wall15.dib=1 +C1wall02.dib=1 +C1wall04.dib=1 +C1wall06.dib=1 +C1wall08.dib=1 + +[C1wall11.dib] +X=0 +Y=0 +Width=64 +Height=137 + +[C1wall13.dib] +X=64 +Y=0 +Width=74 +Height=136 + +[C1wall15.dib] +X=138 +Y=0 +Width=83 +Height=135 + +[C1wall02.dib] +X=221 +Y=0 +Width=70 +Height=135 + +[C1wall04.dib] +X=291 +Y=0 +Width=68 +Height=135 + +[C1wall06.dib] +X=359 +Y=0 +Width=80 +Height=137 + +[C1wall08.dib] +X=439 +Y=0 +Width=83 +Height=136 + +[Sequences] +WalkLeft=7 +WalkRight=7 + +[WalkRight] +C1walr11.dib=1 +C1walr13.dib=1 +C1walr15.dib=1 +C1walr02.dib=1 +C1walr04.dib=1 +C1walr06.dib=1 +C1walr08.dib=1 + +[C1walr11.dib] +X=0 +Y=137 +Width=72 +Height=134 + +[C1walr13.dib] +X=72 +Y=137 +Width=79 +Height=139 + +[C1walr15.dib] +X=151 +Y=137 +Width=83 +Height=138 + +[C1walr02.dib] +X=234 +Y=137 +Width=74 +Height=138 + +[C1walr04.dib] +X=308 +Y=137 +Width=72 +Height=133 + +[C1walr06.dib] +X=380 +Y=137 +Width=83 +Height=135 + +[C1walr08.dib] +X=463 +Y=137 +Width=79 +Height=134 diff --git a/sdk/samples/iklowns/data/c1walk45.bmp b/sdk/samples/iklowns/data/c1walk45.bmp new file mode 100644 index 0000000..2fdba43 Binary files /dev/null and b/sdk/samples/iklowns/data/c1walk45.bmp differ diff --git a/sdk/samples/iklowns/data/c1walk45.spr b/sdk/samples/iklowns/data/c1walk45.spr new file mode 100644 index 0000000..36ed46d --- /dev/null +++ b/sdk/samples/iklowns/data/c1walk45.spr @@ -0,0 +1,237 @@ +[InLeft] +c1u45L01.DIB=1 +c1u45L03.DIB=1 +c1u45L05.DIB=1 +c1u45L07.DIB=1 +c1u45L09.DIB=1 +c1u45L11.DIB=1 +c1u45L13.DIB=1 +c1u45L15.DIB=1 + +[c1u45L01.DIB] +X=0 +Y=0 +Width=67 +Height=133 + +[c1u45L03.DIB] +X=67 +Y=0 +Width=54 +Height=131 + +[c1u45L05.DIB] +X=121 +Y=0 +Width=57 +Height=133 + +[c1u45L07.DIB] +X=178 +Y=0 +Width=64 +Height=136 + +[c1u45L09.DIB] +X=242 +Y=0 +Width=59 +Height=135 + +[c1u45L11.DIB] +X=301 +Y=0 +Width=54 +Height=132 + +[c1u45L13.DIB] +X=355 +Y=0 +Width=60 +Height=134 + +[c1u45L15.DIB] +X=415 +Y=0 +Width=67 +Height=135 + +[Sequences] +InLeft=8 +InRight=8 +OutLeft=8 +OutRight=8 + +[InRight] +c1u45R01.DIB=1 +c1u45R03.DIB=1 +c1u45R05.DIB=1 +c1u45R07.DIB=1 +c1u45R09.DIB=1 +c1u45R11.DIB=1 +c1u45R13.DIB=1 +c1u45R15.DIB=1 + +[c1u45R01.DIB] +X=0 +Y=136 +Width=66 +Height=135 + +[c1u45R03.DIB] +X=66 +Y=136 +Width=66 +Height=132 + +[c1u45R05.DIB] +X=132 +Y=136 +Width=66 +Height=132 + +[c1u45R07.DIB] +X=198 +Y=136 +Width=69 +Height=134 + +[c1u45R09.DIB] +X=267 +Y=136 +Width=64 +Height=134 + +[c1u45R11.DIB] +X=331 +Y=136 +Width=66 +Height=131 + +[c1u45R13.DIB] +X=397 +Y=136 +Width=66 +Height=136 + +[c1u45R15.DIB] +X=463 +Y=136 +Width=66 +Height=137 + +[OutLeft] +C1w45l01.dib=1 +C1w45l03.dib=1 +C1w45l05.dib=1 +C1w45l07.dib=1 +C1w45l09.dib=1 +C1w45l11.dib=1 +C1w45l13.dib=1 +C1w45l15.dib=1 + +[C1w45l01.dib] +X=0 +Y=273 +Width=70 +Height=138 + +[C1w45l03.dib] +X=70 +Y=273 +Width=60 +Height=138 + +[C1w45l05.dib] +X=130 +Y=273 +Width=64 +Height=137 + +[C1w45l07.dib] +X=194 +Y=273 +Width=70 +Height=136 + +[C1w45l09.dib] +X=264 +Y=273 +Width=67 +Height=136 + +[C1w45l11.dib] +X=331 +Y=273 +Width=60 +Height=139 + +[C1w45l13.dib] +X=391 +Y=273 +Width=65 +Height=137 + +[C1w45l15.dib] +X=456 +Y=273 +Width=71 +Height=135 + +[OutRight] +C1w45r01.dib=1 +C1w45r03.dib=1 +C1w45r05.dib=1 +C1w45r07.dib=1 +C1w45r09.dib=1 +C1w45r11.dib=1 +C1w45r13.dib=1 +C1w45r15.dib=1 + +[C1w45r01.dib] +X=0 +Y=412 +Width=65 +Height=136 + +[C1w45r03.dib] +X=65 +Y=412 +Width=52 +Height=139 + +[C1w45r05.dib] +X=117 +Y=412 +Width=57 +Height=136 + +[C1w45r07.dib] +X=174 +Y=412 +Width=62 +Height=135 + +[C1w45r09.dib] +X=236 +Y=412 +Width=55 +Height=138 + +[C1w45r11.dib] +X=291 +Y=412 +Width=52 +Height=138 + +[C1w45r13.dib] +X=343 +Y=412 +Width=66 +Height=139 + +[C1w45r15.dib] +X=409 +Y=412 +Width=69 +Height=137 diff --git a/sdk/samples/iklowns/data/c2block.bmp b/sdk/samples/iklowns/data/c2block.bmp new file mode 100644 index 0000000..d58f15c Binary files /dev/null and b/sdk/samples/iklowns/data/c2block.bmp differ diff --git a/sdk/samples/iklowns/data/c2block.spr b/sdk/samples/iklowns/data/c2block.spr new file mode 100644 index 0000000..1660be5 --- /dev/null +++ b/sdk/samples/iklowns/data/c2block.spr @@ -0,0 +1,49 @@ +[C2BlockLeft] +C2blol01.dib=1 +C2blol05.dib=1 +C2blol09.dib=1 + +[C2blol01.dib] +X=0 +Y=0 +Width=57 +Height=133 + +[C2blol05.dib] +X=57 +Y=0 +Width=57 +Height=133 + +[C2blol09.dib] +X=114 +Y=0 +Width=57 +Height=133 + +[Sequences] +C2BlockLeft=3 +C2BlockRight=3 + +[C2BlockRight] +C2blor01.dib=1 +C2blor05.dib=1 +C2blor09.dib=1 + +[C2blor01.dib] +X=0 +Y=133 +Width=58 +Height=133 + +[C2blor05.dib] +X=58 +Y=133 +Width=58 +Height=133 + +[C2blor09.dib] +X=116 +Y=133 +Width=58 +Height=133 diff --git a/sdk/samples/iklowns/data/c2duck.bmp b/sdk/samples/iklowns/data/c2duck.bmp new file mode 100644 index 0000000..98ab17d Binary files /dev/null and b/sdk/samples/iklowns/data/c2duck.bmp differ diff --git a/sdk/samples/iklowns/data/c2duck.spr b/sdk/samples/iklowns/data/c2duck.spr new file mode 100644 index 0000000..331c453 --- /dev/null +++ b/sdk/samples/iklowns/data/c2duck.spr @@ -0,0 +1,77 @@ +[C2DuckLeft] +C2ducl01.dib=1 +C2ducl05.dib=1 +C2ducl09.dib=1 +C2ducl13.dib=1 +C2ducl17.dib=1 + +[C2ducl01.dib] +X=0 +Y=0 +Width=58 +Height=132 + +[C2ducl05.dib] +X=58 +Y=0 +Width=66 +Height=132 + +[C2ducl09.dib] +X=124 +Y=0 +Width=74 +Height=134 + +[C2ducl13.dib] +X=198 +Y=0 +Width=70 +Height=134 + +[C2ducl17.dib] +X=268 +Y=0 +Width=63 +Height=133 + +[Sequences] +C2DuckLeft=5 +C2DuckRight=5 + +[C2DuckRight] +C2ducr01.dib=1 +C2ducr05.dib=1 +C2ducr09.dib=1 +C2ducr13.dib=1 +C2ducr17.dib=1 + +[C2ducr01.dib] +X=0 +Y=134 +Width=72 +Height=132 + +[C2ducr05.dib] +X=72 +Y=134 +Width=68 +Height=131 + +[C2ducr09.dib] +X=140 +Y=134 +Width=65 +Height=131 + +[C2ducr13.dib] +X=205 +Y=134 +Width=68 +Height=131 + +[C2ducr17.dib] +X=273 +Y=134 +Width=72 +Height=132 diff --git a/sdk/samples/iklowns/data/c2piefac.bmp b/sdk/samples/iklowns/data/c2piefac.bmp new file mode 100644 index 0000000..2aea263 Binary files /dev/null and b/sdk/samples/iklowns/data/c2piefac.bmp differ diff --git a/sdk/samples/iklowns/data/c2piefac.spr b/sdk/samples/iklowns/data/c2piefac.spr new file mode 100644 index 0000000..02d7dfc --- /dev/null +++ b/sdk/samples/iklowns/data/c2piefac.spr @@ -0,0 +1,63 @@ +[C2PieFaceLeft] +C2pfal01.dib=1 +C2pfal03.dib=1 +C2pfal05.dib=1 +C2pfacel.bmp=1 + +[C2pfal01.dib] +X=0 +Y=0 +Width=70 +Height=133 + +[C2pfal03.dib] +X=70 +Y=0 +Width=70 +Height=133 + +[C2pfal05.dib] +X=140 +Y=0 +Width=70 +Height=133 + +[C2pfacel.bmp] +X=210 +Y=0 +Width=70 +Height=133 + +[Sequences] +C2PieFaceLeft=4 +C2PieFaceRight=4 + +[C2PieFaceRight] +C2pfar01.dib=1 +C2pfar03.dib=1 +C2pfar05.dib=1 +C2pfacer.bmp=1 + +[C2pfar01.dib] +X=0 +Y=133 +Width=70 +Height=133 + +[C2pfar03.dib] +X=70 +Y=133 +Width=58 +Height=133 + +[C2pfar05.dib] +X=128 +Y=133 +Width=58 +Height=133 + +[C2pfacer.bmp] +X=186 +Y=133 +Width=58 +Height=133 diff --git a/sdk/samples/iklowns/data/c2piehed.bmp b/sdk/samples/iklowns/data/c2piehed.bmp new file mode 100644 index 0000000..f808cdb Binary files /dev/null and b/sdk/samples/iklowns/data/c2piehed.bmp differ diff --git a/sdk/samples/iklowns/data/c2piehed.spr b/sdk/samples/iklowns/data/c2piehed.spr new file mode 100644 index 0000000..0da187b --- /dev/null +++ b/sdk/samples/iklowns/data/c2piehed.spr @@ -0,0 +1,63 @@ +[C2PieHeadLeft] +C2phel01.dib=1 +C2phel03.dib=1 +C2phel05.dib=1 +C2pheadl.bmp=1 + +[C2phel01.dib] +X=0 +Y=0 +Width=100 +Height=133 + +[C2phel03.dib] +X=100 +Y=0 +Width=76 +Height=133 + +[C2phel05.dib] +X=176 +Y=0 +Width=57 +Height=133 + +[C2pheadl.bmp] +X=233 +Y=0 +Width=57 +Height=133 + +[Sequences] +C2PieHeadLeft=4 +C2PieHeadRight=4 + +[C2PieHeadRight] +C2pher01.dib=1 +C2pher03.dib=1 +C2pher05.dib=1 +C2pheadr.bmp=1 + +[C2pher01.dib] +X=0 +Y=133 +Width=101 +Height=133 + +[C2pher03.dib] +X=101 +Y=133 +Width=101 +Height=133 + +[C2pher05.dib] +X=202 +Y=133 +Width=101 +Height=133 + +[C2pheadr.bmp] +X=303 +Y=133 +Width=101 +Height=133 diff --git a/sdk/samples/iklowns/data/c2poke.bmp b/sdk/samples/iklowns/data/c2poke.bmp new file mode 100644 index 0000000..1822432 Binary files /dev/null and b/sdk/samples/iklowns/data/c2poke.bmp differ diff --git a/sdk/samples/iklowns/data/c2poke.spr b/sdk/samples/iklowns/data/c2poke.spr new file mode 100644 index 0000000..b118d17 --- /dev/null +++ b/sdk/samples/iklowns/data/c2poke.spr @@ -0,0 +1,49 @@ +[C2PokeLeft] +C2eyel01.dib=1 +C2eyel05.dib=1 +C2eyel09.dib=1 + +[C2eyel01.dib] +X=0 +Y=0 +Width=61 +Height=133 + +[C2eyel05.dib] +X=61 +Y=0 +Width=61 +Height=133 + +[C2eyel09.dib] +X=122 +Y=0 +Width=61 +Height=133 + +[Sequences] +C2PokeLeft=3 +C2PokeRight=3 + +[C2PokeRight] +C2eyer01.dib=1 +C2eyer05.dib=1 +C2eyer09.dib=1 + +[C2eyer01.dib] +X=0 +Y=133 +Width=58 +Height=133 + +[C2eyer05.dib] +X=58 +Y=133 +Width=59 +Height=133 + +[C2eyer09.dib] +X=117 +Y=133 +Width=58 +Height=133 diff --git a/sdk/samples/iklowns/data/c2run.bmp b/sdk/samples/iklowns/data/c2run.bmp new file mode 100644 index 0000000..2af321b Binary files /dev/null and b/sdk/samples/iklowns/data/c2run.bmp differ diff --git a/sdk/samples/iklowns/data/c2run.spr b/sdk/samples/iklowns/data/c2run.spr new file mode 100644 index 0000000..fe6b5d5 --- /dev/null +++ b/sdk/samples/iklowns/data/c2run.spr @@ -0,0 +1,119 @@ +[C2RunLeft] +C2-rul01.dib=1 +C2-rul03.dib=1 +C2-rul05.dib=1 +C2-rul07.dib=1 +C2-rul09.dib=1 +C2-rul11.dib=1 +C2-rul13.dib=1 +C2-rul15.dib=1 + +[C2-rul01.dib] +X=0 +Y=0 +Width=110 +Height=125 + +[C2-rul03.dib] +X=110 +Y=0 +Width=94 +Height=137 + +[C2-rul05.dib] +X=204 +Y=0 +Width=91 +Height=134 + +[C2-rul07.dib] +X=295 +Y=0 +Width=107 +Height=131 + +[C2-rul09.dib] +X=402 +Y=0 +Width=110 +Height=123 + +[C2-rul11.dib] +X=512 +Y=0 +Width=95 +Height=131 + +[C2-rul13.dib] +X=607 +Y=0 +Width=91 +Height=137 + +[C2-rul15.dib] +X=698 +Y=0 +Width=106 +Height=130 + +[Sequences] +C2RunLeft=8 +C2RunRight=8 + +[C2RunRight] +C2-rur01.dib=1 +C2-rur03.dib=1 +C2-rur05.dib=1 +C2-rur07.dib=1 +C2-rur09.dib=1 +C2-rur11.dib=1 +C2-rur13.dib=1 +C2-rur15.dib=1 + +[C2-rur01.dib] +X=0 +Y=137 +Width=105 +Height=123 + +[C2-rur03.dib] +X=105 +Y=137 +Width=87 +Height=136 + +[C2-rur05.dib] +X=192 +Y=137 +Width=90 +Height=133 + +[C2-rur07.dib] +X=282 +Y=137 +Width=110 +Height=130 + +[C2-rur09.dib] +X=392 +Y=137 +Width=106 +Height=125 + +[C2-rur11.dib] +X=498 +Y=137 +Width=87 +Height=132 + +[C2-rur13.dib] +X=585 +Y=137 +Width=95 +Height=138 + +[C2-rur15.dib] +X=680 +Y=137 +Width=109 +Height=131 diff --git a/sdk/samples/iklowns/data/c2sad.bmp b/sdk/samples/iklowns/data/c2sad.bmp new file mode 100644 index 0000000..f30fa16 Binary files /dev/null and b/sdk/samples/iklowns/data/c2sad.bmp differ diff --git a/sdk/samples/iklowns/data/c2sad.spr b/sdk/samples/iklowns/data/c2sad.spr new file mode 100644 index 0000000..9c19247 --- /dev/null +++ b/sdk/samples/iklowns/data/c2sad.spr @@ -0,0 +1,77 @@ +[C2SadLeft] +C2sadl01.dib=1 +C2sadl02.dib=1 +C2sadl03.dib=1 +C2sadl04.dib=1 +C2sadl05.dib=1 +C2sadl06.dib=1 +C2sadl07.dib=1 +C2sadl08.dib=1 +C2sadl09.dib=1 + +[C2sadl01.dib] +X=0 +Y=0 +Width=54 +Height=135 + +[C2sadl02.dib] +X=54 +Y=0 +Width=57 +Height=136 + +[C2sadl03.dib] +X=111 +Y=0 +Width=59 +Height=136 + +[C2sadl04.dib] +X=170 +Y=0 +Width=62 +Height=136 + +[C2sadl05.dib] +X=232 +Y=0 +Width=64 +Height=136 + +[C2sadl06.dib] +X=296 +Y=0 +Width=65 +Height=136 + +[C2sadl07.dib] +X=361 +Y=0 +Width=64 +Height=136 + +[C2sadl08.dib] +X=425 +Y=0 +Width=61 +Height=136 + +[C2sadl09.dib] +X=486 +Y=0 +Width=60 +Height=136 + +[Sequences] +C2SadLeft=9 +C2SadDone=1 + +[C2SadDone] +C2sadl10.dib=1 + +[C2sadl10.dib] +X=0 +Y=136 +Width=45 +Height=130 diff --git a/sdk/samples/iklowns/data/c2stand.bmp b/sdk/samples/iklowns/data/c2stand.bmp new file mode 100644 index 0000000..7728dc7 Binary files /dev/null and b/sdk/samples/iklowns/data/c2stand.bmp differ diff --git a/sdk/samples/iklowns/data/c2stand.spr b/sdk/samples/iklowns/data/c2stand.spr new file mode 100644 index 0000000..56bc79c --- /dev/null +++ b/sdk/samples/iklowns/data/c2stand.spr @@ -0,0 +1,21 @@ +[C2StandLeft] +C2thrl01.dib=1 + +[C2thrl01.dib] +X=0 +Y=0 +Width=57 +Height=133 + +[Sequences] +C2StandLeft=1 +C2StandRight=1 + +[C2StandRight] +C2thrr01.dib=1 + +[C2thrr01.dib] +X=0 +Y=133 +Width=78 +Height=133 diff --git a/sdk/samples/iklowns/data/c2throw.bmp b/sdk/samples/iklowns/data/c2throw.bmp new file mode 100644 index 0000000..cc00ac2 Binary files /dev/null and b/sdk/samples/iklowns/data/c2throw.bmp differ diff --git a/sdk/samples/iklowns/data/c2throw.spr b/sdk/samples/iklowns/data/c2throw.spr new file mode 100644 index 0000000..bae5341 --- /dev/null +++ b/sdk/samples/iklowns/data/c2throw.spr @@ -0,0 +1,63 @@ +[C2ThrowLeft] +c2thrl01.dib=1 +c2thrl05.dib=1 +c2thrl09.dib=1 +c2thrl13.dib=1 + +[c2thrl01.dib] +X=0 +Y=0 +Width=57 +Height=133 + +[c2thrl05.dib] +X=57 +Y=0 +Width=57 +Height=133 + +[c2thrl09.dib] +X=114 +Y=0 +Width=57 +Height=133 + +[c2thrl13.dib] +X=171 +Y=0 +Width=57 +Height=133 + +[Sequences] +C2ThrowLeft=4 +C2ThrowRight=4 + +[C2ThrowRight] +c2thrr01.dib=1 +c2thrr05.dib=1 +c2thrr09.dib=1 +c2thrr13.dib=1 + +[c2thrr01.dib] +X=0 +Y=133 +Width=80 +Height=133 + +[c2thrr05.dib] +X=80 +Y=133 +Width=79 +Height=133 + +[c2thrr09.dib] +X=159 +Y=133 +Width=79 +Height=133 + +[c2thrr13.dib] +X=238 +Y=133 +Width=73 +Height=133 diff --git a/sdk/samples/iklowns/data/c2turn.bmp b/sdk/samples/iklowns/data/c2turn.bmp new file mode 100644 index 0000000..7adcb7f Binary files /dev/null and b/sdk/samples/iklowns/data/c2turn.bmp differ diff --git a/sdk/samples/iklowns/data/c2turn.spr b/sdk/samples/iklowns/data/c2turn.spr new file mode 100644 index 0000000..83129df --- /dev/null +++ b/sdk/samples/iklowns/data/c2turn.spr @@ -0,0 +1,63 @@ +[C2Left2Right] +C2turr01.dib=1 +C2turr05.dib=1 +C2turr09.dib=1 +C2turr13.dib=1 + +[C2turr01.dib] +X=0 +Y=0 +Width=76 +Height=133 + +[C2turr05.dib] +X=76 +Y=0 +Width=60 +Height=136 + +[C2turr09.dib] +X=136 +Y=0 +Width=68 +Height=138 + +[C2turr13.dib] +X=204 +Y=0 +Width=86 +Height=138 + +[Sequences] +C2Left2Right=4 +C2Right2Left=4 + +[C2Right2Left] +C2turl01.dib=1 +C2turl05.dib=1 +C2turl09.dib=1 +C2turl13.dib=1 + +[C2turl01.dib] +X=0 +Y=138 +Width=84 +Height=135 + +[C2turl05.dib] +X=84 +Y=138 +Width=73 +Height=131 + +[C2turl09.dib] +X=157 +Y=138 +Width=65 +Height=135 + +[C2turl13.dib] +X=222 +Y=138 +Width=67 +Height=134 diff --git a/sdk/samples/iklowns/data/c2walk.bmp b/sdk/samples/iklowns/data/c2walk.bmp new file mode 100644 index 0000000..acd960e Binary files /dev/null and b/sdk/samples/iklowns/data/c2walk.bmp differ diff --git a/sdk/samples/iklowns/data/c2walk.spr b/sdk/samples/iklowns/data/c2walk.spr new file mode 100644 index 0000000..b3ecf04 --- /dev/null +++ b/sdk/samples/iklowns/data/c2walk.spr @@ -0,0 +1,119 @@ +[C2WalkLeft] +C2wall01.dib=1 +C2wall03.dib=1 +C2wall05.dib=1 +C2wall07.dib=1 +C2wall09.dib=1 +C2wall11.dib=1 +C2wall13.dib=1 +C2wall15.dib=1 + +[C2wall01.dib] +X=0 +Y=0 +Width=83 +Height=133 + +[C2wall03.dib] +X=83 +Y=0 +Width=64 +Height=134 + +[C2wall05.dib] +X=147 +Y=0 +Width=74 +Height=136 + +[C2wall07.dib] +X=221 +Y=0 +Width=84 +Height=137 + +[C2wall09.dib] +X=305 +Y=0 +Width=78 +Height=137 + +[C2wall11.dib] +X=383 +Y=0 +Width=64 +Height=137 + +[C2wall13.dib] +X=447 +Y=0 +Width=74 +Height=136 + +[C2wall15.dib] +X=521 +Y=0 +Width=83 +Height=135 + +[Sequences] +C2WalkLeft=8 +C2WalkRight=8 + +[C2WalkRight] +C2walr01.dib=1 +C2walr03.dib=1 +C2walr05.dib=1 +C2walr07.dib=1 +C2walr09.dib=1 +C2walr11.dib=1 +C2walr13.dib=1 +C2walr15.dib=1 + +[C2walr01.dib] +X=0 +Y=137 +Width=79 +Height=136 + +[C2walr03.dib] +X=79 +Y=137 +Width=71 +Height=137 + +[C2walr05.dib] +X=150 +Y=137 +Width=79 +Height=134 + +[C2walr07.dib] +X=229 +Y=137 +Width=84 +Height=135 + +[C2walr09.dib] +X=313 +Y=137 +Width=74 +Height=135 + +[C2walr11.dib] +X=387 +Y=137 +Width=72 +Height=134 + +[C2walr13.dib] +X=459 +Y=137 +Width=79 +Height=139 + +[C2walr15.dib] +X=538 +Y=137 +Width=83 +Height=138 diff --git a/sdk/samples/iklowns/data/c2walk45.bmp b/sdk/samples/iklowns/data/c2walk45.bmp new file mode 100644 index 0000000..9acbd41 Binary files /dev/null and b/sdk/samples/iklowns/data/c2walk45.bmp differ diff --git a/sdk/samples/iklowns/data/c2walk45.spr b/sdk/samples/iklowns/data/c2walk45.spr new file mode 100644 index 0000000..732b420 --- /dev/null +++ b/sdk/samples/iklowns/data/c2walk45.spr @@ -0,0 +1,237 @@ +[C2InLeft] +c2u45L01.DIB=1 +c2u45L03.DIB=1 +c2u45L05.DIB=1 +c2u45L07.DIB=1 +c2u45L09.DIB=1 +c2u45L11.DIB=1 +c2u45L13.DIB=1 +c2u45L15.DIB=1 + +[c2u45L01.DIB] +X=0 +Y=0 +Width=67 +Height=133 + +[c2u45L03.DIB] +X=67 +Y=0 +Width=54 +Height=131 + +[c2u45L05.DIB] +X=121 +Y=0 +Width=57 +Height=133 + +[c2u45L07.DIB] +X=178 +Y=0 +Width=64 +Height=136 + +[c2u45L09.DIB] +X=242 +Y=0 +Width=59 +Height=135 + +[c2u45L11.DIB] +X=301 +Y=0 +Width=54 +Height=132 + +[c2u45L13.DIB] +X=355 +Y=0 +Width=60 +Height=134 + +[c2u45L15.DIB] +X=415 +Y=0 +Width=67 +Height=135 + +[Sequences] +C2InLeft=8 +C2InRight=8 +C2OutLeft=8 +C2OutRight=8 + +[C2InRight] +c2u45R01.DIB=1 +c2u45R03.DIB=1 +c2u45R05.DIB=1 +c2u45R07.DIB=1 +c2u45R09.DIB=1 +c2u45R11.DIB=1 +c2u45R13.DIB=1 +c2u45R15.DIB=1 + +[c2u45R01.DIB] +X=0 +Y=136 +Width=66 +Height=135 + +[c2u45R03.DIB] +X=66 +Y=136 +Width=66 +Height=132 + +[c2u45R05.DIB] +X=132 +Y=136 +Width=66 +Height=132 + +[c2u45R07.DIB] +X=198 +Y=136 +Width=69 +Height=134 + +[c2u45R09.DIB] +X=267 +Y=136 +Width=64 +Height=134 + +[c2u45R11.DIB] +X=331 +Y=136 +Width=66 +Height=131 + +[c2u45R13.DIB] +X=397 +Y=136 +Width=66 +Height=136 + +[c2u45R15.DIB] +X=463 +Y=136 +Width=66 +Height=137 + +[C2OutLeft] +C2w45l01.dib=1 +C2w45l03.dib=1 +C2w45l05.dib=1 +C2w45l07.dib=1 +C2w45l09.dib=1 +C2w45l11.dib=1 +C2w45l13.dib=1 +C2w45l15.dib=1 + +[C2w45l01.dib] +X=0 +Y=273 +Width=70 +Height=138 + +[C2w45l03.dib] +X=70 +Y=273 +Width=60 +Height=138 + +[C2w45l05.dib] +X=130 +Y=273 +Width=64 +Height=137 + +[C2w45l07.dib] +X=194 +Y=273 +Width=70 +Height=136 + +[C2w45l09.dib] +X=264 +Y=273 +Width=67 +Height=136 + +[C2w45l11.dib] +X=331 +Y=273 +Width=60 +Height=139 + +[C2w45l13.dib] +X=391 +Y=273 +Width=65 +Height=137 + +[C2w45l15.dib] +X=456 +Y=273 +Width=71 +Height=135 + +[C2OutRight] +C2w45r01.dib=1 +C2w45r03.dib=1 +C2w45r05.dib=1 +C2w45r07.dib=1 +C2w45r09.dib=1 +C2w45r11.dib=1 +C2w45r13.dib=1 +C2w45r15.dib=1 + +[C2w45r01.dib] +X=0 +Y=412 +Width=65 +Height=136 + +[C2w45r03.dib] +X=65 +Y=412 +Width=52 +Height=139 + +[C2w45r05.dib] +X=117 +Y=412 +Width=57 +Height=136 + +[C2w45r07.dib] +X=174 +Y=412 +Width=62 +Height=135 + +[C2w45r09.dib] +X=236 +Y=412 +Width=55 +Height=138 + +[C2w45r11.dib] +X=291 +Y=412 +Width=52 +Height=138 + +[C2w45r13.dib] +X=343 +Y=412 +Width=66 +Height=139 + +[C2w45r15.dib] +X=409 +Y=412 +Width=69 +Height=137 diff --git a/sdk/samples/iklowns/data/clouds.bmp b/sdk/samples/iklowns/data/clouds.bmp new file mode 100644 index 0000000..6d66911 Binary files /dev/null and b/sdk/samples/iklowns/data/clouds.bmp differ diff --git a/sdk/samples/iklowns/data/clouds.spr b/sdk/samples/iklowns/data/clouds.spr new file mode 100644 index 0000000..6bc4976 --- /dev/null +++ b/sdk/samples/iklowns/data/clouds.spr @@ -0,0 +1,31 @@ +[Cloud1] +Cloud1-2.bmp=1 + +[Cloud1-2.bmp] +X=0 +Y=0 +Width=215 +Height=33 + +[Sequences] +Cloud1=1 +Cloud2=1 +Cloud3=1 + +[Cloud2] +Cloud2-2.bmp=1 + +[Cloud2-2.bmp] +X=0 +Y=33 +Width=136 +Height=48 + +[Cloud3] +Cloud3-2.bmp=1 + +[Cloud3-2.bmp] +X=0 +Y=81 +Width=149 +Height=43 diff --git a/sdk/samples/iklowns/data/clown0.bmp b/sdk/samples/iklowns/data/clown0.bmp new file mode 100644 index 0000000..0ea10d0 Binary files /dev/null and b/sdk/samples/iklowns/data/clown0.bmp differ diff --git a/sdk/samples/iklowns/data/clown0.spr b/sdk/samples/iklowns/data/clown0.spr new file mode 100644 index 0000000..770c757 --- /dev/null +++ b/sdk/samples/iklowns/data/clown0.spr @@ -0,0 +1,21 @@ +[Stand] +Clownl.dib=1 + +[Clownl.dib] +X=0 +Y=0 +Width=160 +Height=352 + +[Sequences] +Stand=1 +LeftStand=1 + +[LeftStand] +Clownr.dib=1 + +[Clownr.dib] +X=0 +Y=352 +Width=160 +Height=352 diff --git a/sdk/samples/iklowns/data/credit.bmp b/sdk/samples/iklowns/data/credit.bmp new file mode 100644 index 0000000..048120a Binary files /dev/null and b/sdk/samples/iklowns/data/credit.bmp differ diff --git a/sdk/samples/iklowns/data/credits.bmp b/sdk/samples/iklowns/data/credits.bmp new file mode 100644 index 0000000..e233e67 Binary files /dev/null and b/sdk/samples/iklowns/data/credits.bmp differ diff --git a/sdk/samples/iklowns/data/foreg1.bmp b/sdk/samples/iklowns/data/foreg1.bmp new file mode 100644 index 0000000..70cb855 Binary files /dev/null and b/sdk/samples/iklowns/data/foreg1.bmp differ diff --git a/sdk/samples/iklowns/data/foreg1.tle b/sdk/samples/iklowns/data/foreg1.tle new file mode 100644 index 0000000..45891f0 Binary files /dev/null and b/sdk/samples/iklowns/data/foreg1.tle differ diff --git a/sdk/samples/iklowns/data/fw0.bmp b/sdk/samples/iklowns/data/fw0.bmp new file mode 100644 index 0000000..bc2e93e Binary files /dev/null and b/sdk/samples/iklowns/data/fw0.bmp differ diff --git a/sdk/samples/iklowns/data/fw0.spr b/sdk/samples/iklowns/data/fw0.spr new file mode 100644 index 0000000..034bed6 --- /dev/null +++ b/sdk/samples/iklowns/data/fw0.spr @@ -0,0 +1,109 @@ +[Turn] +Ferris01.dib=1 +Ferris02.dib=1 +Ferris03.dib=1 +Ferris04.dib=1 +Ferris05.dib=1 +Ferris06.dib=1 +Ferris07.dib=1 +Ferris08.dib=1 +Ferris09.dib=1 +Ferris10.dib=1 +Ferris11.dib=1 +Ferris12.dib=1 +Ferris13.dib=1 +Ferris14.dib=1 +Ferris15.dib=1 + +[Ferris01.dib] +X=0 +Y=0 +Width=188 +Height=170 + +[Ferris02.dib] +X=188 +Y=0 +Width=188 +Height=170 + +[Ferris03.dib] +X=376 +Y=0 +Width=188 +Height=170 + +[Ferris04.dib] +X=564 +Y=0 +Width=188 +Height=170 + +[Ferris05.dib] +X=752 +Y=0 +Width=188 +Height=170 + +[Ferris06.dib] +X=940 +Y=0 +Width=187 +Height=170 + +[Ferris07.dib] +X=1127 +Y=0 +Width=187 +Height=170 + +[Ferris08.dib] +X=1314 +Y=0 +Width=187 +Height=170 + +[Ferris09.dib] +X=1501 +Y=0 +Width=187 +Height=170 + +[Ferris10.dib] +X=1688 +Y=0 +Width=186 +Height=170 + +[Ferris11.dib] +X=1874 +Y=0 +Width=186 +Height=170 + +[Ferris12.dib] +X=2060 +Y=0 +Width=186 +Height=170 + +[Ferris13.dib] +X=2246 +Y=0 +Width=186 +Height=170 + +[Ferris14.dib] +X=2432 +Y=0 +Width=187 +Height=170 + +[Ferris15.dib] +X=2619 +Y=0 +Width=187 +Height=170 + +[Sequences] +Turn=15 diff --git a/sdk/samples/iklowns/data/fwstatic.bmp b/sdk/samples/iklowns/data/fwstatic.bmp new file mode 100644 index 0000000..e6ae9cb Binary files /dev/null and b/sdk/samples/iklowns/data/fwstatic.bmp differ diff --git a/sdk/samples/iklowns/data/fwstatic.spr b/sdk/samples/iklowns/data/fwstatic.spr new file mode 100644 index 0000000..b22d017 --- /dev/null +++ b/sdk/samples/iklowns/data/fwstatic.spr @@ -0,0 +1,11 @@ +[DontTurn] +ferris01.dib=1 + +[ferris01.dib] +X=0 +Y=0 +Width=188 +Height=170 + +[Sequences] +DontTurn=1 diff --git a/sdk/samples/iklowns/data/ground1.bmp b/sdk/samples/iklowns/data/ground1.bmp new file mode 100644 index 0000000..c1d08cb Binary files /dev/null and b/sdk/samples/iklowns/data/ground1.bmp differ diff --git a/sdk/samples/iklowns/data/ground1.tle b/sdk/samples/iklowns/data/ground1.tle new file mode 100644 index 0000000..1d408db Binary files /dev/null and b/sdk/samples/iklowns/data/ground1.tle differ diff --git a/sdk/samples/iklowns/data/iklowns.pal b/sdk/samples/iklowns/data/iklowns.pal new file mode 100644 index 0000000..4fc3c3c Binary files /dev/null and b/sdk/samples/iklowns/data/iklowns.pal differ diff --git a/sdk/samples/iklowns/data/instruct.bmp b/sdk/samples/iklowns/data/instruct.bmp new file mode 100644 index 0000000..8b50459 Binary files /dev/null and b/sdk/samples/iklowns/data/instruct.bmp differ diff --git a/sdk/samples/iklowns/data/intro.bmp b/sdk/samples/iklowns/data/intro.bmp new file mode 100644 index 0000000..d462569 Binary files /dev/null and b/sdk/samples/iklowns/data/intro.bmp differ diff --git a/sdk/samples/iklowns/data/klown.mid b/sdk/samples/iklowns/data/klown.mid new file mode 100644 index 0000000..d22cc4c Binary files /dev/null and b/sdk/samples/iklowns/data/klown.mid differ diff --git a/sdk/samples/iklowns/data/load.bmp b/sdk/samples/iklowns/data/load.bmp new file mode 100644 index 0000000..ed52811 Binary files /dev/null and b/sdk/samples/iklowns/data/load.bmp differ diff --git a/sdk/samples/iklowns/data/nyuk.wav b/sdk/samples/iklowns/data/nyuk.wav new file mode 100644 index 0000000..9fdb5ef Binary files /dev/null and b/sdk/samples/iklowns/data/nyuk.wav differ diff --git a/sdk/samples/iklowns/data/pie.bmp b/sdk/samples/iklowns/data/pie.bmp new file mode 100644 index 0000000..e039368 Binary files /dev/null and b/sdk/samples/iklowns/data/pie.bmp differ diff --git a/sdk/samples/iklowns/data/pie.spr b/sdk/samples/iklowns/data/pie.spr new file mode 100644 index 0000000..90384f5 --- /dev/null +++ b/sdk/samples/iklowns/data/pie.spr @@ -0,0 +1,32 @@ +[Sequences] +Pie=4 + +[Pie] +pie0.bmp=1 +pie1.bmp=1 +pie2.bmp=1 +pie3.bmp=1 + +[pie0.bmp] +x=1 +y=0 +width=8 +height=13 + +[pie1.bmp] +x=12 +y=0 +width=8 +height=13 + +[pie2.bmp] +x=1 +y=15 +width=8 +height=13 + +[pie3.bmp] +x=12 +y=15 +width=8 +height=13 diff --git a/sdk/samples/iklowns/data/piefly.bmp b/sdk/samples/iklowns/data/piefly.bmp new file mode 100644 index 0000000..8df56e8 Binary files /dev/null and b/sdk/samples/iklowns/data/piefly.bmp differ diff --git a/sdk/samples/iklowns/data/piefly.spr b/sdk/samples/iklowns/data/piefly.spr new file mode 100644 index 0000000..ab4ef46 --- /dev/null +++ b/sdk/samples/iklowns/data/piefly.spr @@ -0,0 +1,77 @@ +[FlyLeft] +Piefll01.dib=1 +Piefll02.dib=1 +Piefll03.dib=1 +Piefll04.dib=1 +Piefll05.dib=1 + +[Piefll01.dib] +X=0 +Y=0 +Width=22 +Height=21 + +[Piefll02.dib] +X=22 +Y=0 +Width=22 +Height=21 + +[Piefll03.dib] +X=44 +Y=0 +Width=22 +Height=21 + +[Piefll04.dib] +X=66 +Y=0 +Width=22 +Height=21 + +[Piefll05.dib] +X=88 +Y=0 +Width=22 +Height=21 + +[Sequences] +FlyLeft=5 +FlyRight=5 + +[FlyRight] +Pieflr01.dib=1 +Pieflr02.dib=1 +Pieflr03.dib=1 +Pieflr04.dib=1 +Pieflr05.dib=1 + +[Pieflr01.dib] +X=0 +Y=21 +Width=22 +Height=21 + +[Pieflr02.dib] +X=22 +Y=21 +Width=22 +Height=21 + +[Pieflr03.dib] +X=44 +Y=21 +Width=22 +Height=21 + +[Pieflr04.dib] +X=66 +Y=21 +Width=22 +Height=21 + +[Pieflr05.dib] +X=88 +Y=21 +Width=22 +Height=21 diff --git a/sdk/samples/iklowns/data/piehit2.wav b/sdk/samples/iklowns/data/piehit2.wav new file mode 100644 index 0000000..cf181b5 Binary files /dev/null and b/sdk/samples/iklowns/data/piehit2.wav differ diff --git a/sdk/samples/iklowns/data/plane.bmp b/sdk/samples/iklowns/data/plane.bmp new file mode 100644 index 0000000..679b828 Binary files /dev/null and b/sdk/samples/iklowns/data/plane.bmp differ diff --git a/sdk/samples/iklowns/data/plane.spr b/sdk/samples/iklowns/data/plane.spr new file mode 100644 index 0000000..3e2590f --- /dev/null +++ b/sdk/samples/iklowns/data/plane.spr @@ -0,0 +1,109 @@ +[Fly] +Plane-01.dib=1 +Plane-02.dib=1 +Plane-03.dib=1 +Plane-04.dib=1 +Plane-05.dib=1 +Plane-06.dib=1 +Plane-07.dib=1 +Plane-08.dib=1 +Plane-09.dib=1 +Plane-10.dib=1 +Plane-11.dib=1 +Plane-12.dib=1 +Plane-13.dib=1 +Plane-14.dib=1 +Plane-15.dib=1 + +[Plane-01.dib] +X=0 +Y=0 +Width=285 +Height=32 + +[Plane-02.dib] +X=285 +Y=0 +Width=285 +Height=32 + +[Plane-03.dib] +X=570 +Y=0 +Width=285 +Height=32 + +[Plane-04.dib] +X=855 +Y=0 +Width=285 +Height=32 + +[Plane-05.dib] +X=1140 +Y=0 +Width=285 +Height=32 + +[Plane-06.dib] +X=1425 +Y=0 +Width=285 +Height=32 + +[Plane-07.dib] +X=1710 +Y=0 +Width=285 +Height=32 + +[Plane-08.dib] +X=1995 +Y=0 +Width=285 +Height=32 + +[Plane-09.dib] +X=2280 +Y=0 +Width=285 +Height=32 + +[Plane-10.dib] +X=2565 +Y=0 +Width=285 +Height=32 + +[Plane-11.dib] +X=2850 +Y=0 +Width=285 +Height=32 + +[Plane-12.dib] +X=3135 +Y=0 +Width=285 +Height=32 + +[Plane-13.dib] +X=3420 +Y=0 +Width=285 +Height=32 + +[Plane-14.dib] +X=3705 +Y=0 +Width=285 +Height=32 + +[Plane-15.dib] +X=3990 +Y=0 +Width=285 +Height=32 + +[Sequences] +Fly=15 diff --git a/sdk/samples/iklowns/data/plane.wav b/sdk/samples/iklowns/data/plane.wav new file mode 100644 index 0000000..2bb51ee Binary files /dev/null and b/sdk/samples/iklowns/data/plane.wav differ diff --git a/sdk/samples/iklowns/data/rollcost.bmp b/sdk/samples/iklowns/data/rollcost.bmp new file mode 100644 index 0000000..8996627 Binary files /dev/null and b/sdk/samples/iklowns/data/rollcost.bmp differ diff --git a/sdk/samples/iklowns/data/rollcost.tle b/sdk/samples/iklowns/data/rollcost.tle new file mode 100644 index 0000000..025fad2 Binary files /dev/null and b/sdk/samples/iklowns/data/rollcost.tle differ diff --git a/sdk/samples/iklowns/data/run.wav b/sdk/samples/iklowns/data/run.wav new file mode 100644 index 0000000..d3c9cf6 Binary files /dev/null and b/sdk/samples/iklowns/data/run.wav differ diff --git a/sdk/samples/iklowns/data/sideattr.bmp b/sdk/samples/iklowns/data/sideattr.bmp new file mode 100644 index 0000000..c2aa886 Binary files /dev/null and b/sdk/samples/iklowns/data/sideattr.bmp differ diff --git a/sdk/samples/iklowns/data/sideattr.tle b/sdk/samples/iklowns/data/sideattr.tle new file mode 100644 index 0000000..7f5c108 Binary files /dev/null and b/sdk/samples/iklowns/data/sideattr.tle differ diff --git a/sdk/samples/iklowns/data/sideb.bmp b/sdk/samples/iklowns/data/sideb.bmp new file mode 100644 index 0000000..b8c2bd7 Binary files /dev/null and b/sdk/samples/iklowns/data/sideb.bmp differ diff --git a/sdk/samples/iklowns/data/sideb.tle b/sdk/samples/iklowns/data/sideb.tle new file mode 100644 index 0000000..c5d5864 Binary files /dev/null and b/sdk/samples/iklowns/data/sideb.tle differ diff --git a/sdk/samples/iklowns/data/sidef.bmp b/sdk/samples/iklowns/data/sidef.bmp new file mode 100644 index 0000000..16c2899 Binary files /dev/null and b/sdk/samples/iklowns/data/sidef.bmp differ diff --git a/sdk/samples/iklowns/data/sidef.tle b/sdk/samples/iklowns/data/sidef.tle new file mode 100644 index 0000000..083fa3f Binary files /dev/null and b/sdk/samples/iklowns/data/sidef.tle differ diff --git a/sdk/samples/iklowns/data/splash.bmp b/sdk/samples/iklowns/data/splash.bmp new file mode 100644 index 0000000..d8b7a0b Binary files /dev/null and b/sdk/samples/iklowns/data/splash.bmp differ diff --git a/sdk/samples/iklowns/data/throw.wav b/sdk/samples/iklowns/data/throw.wav new file mode 100644 index 0000000..5d44698 Binary files /dev/null and b/sdk/samples/iklowns/data/throw.wav differ diff --git a/sdk/samples/iklowns/data/walk.wav b/sdk/samples/iklowns/data/walk.wav new file mode 100644 index 0000000..468fbfc Binary files /dev/null and b/sdk/samples/iklowns/data/walk.wav differ diff --git a/sdk/samples/iklowns/data/woob.wav b/sdk/samples/iklowns/data/woob.wav new file mode 100644 index 0000000..c8a4d0f Binary files /dev/null and b/sdk/samples/iklowns/data/woob.wav differ diff --git a/sdk/samples/iklowns/iklowns.cpp b/sdk/samples/iklowns/iklowns.cpp new file mode 100644 index 0000000..2f54abe --- /dev/null +++ b/sdk/samples/iklowns/iklowns.cpp @@ -0,0 +1,803 @@ +/*===========================================================================*\ +| +| File: iklowns.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#define INITGUID +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <stdio.h> +#include <stdarg.h> +#include <eh.h> +#include "strrec.h" +#include "cgglobl.h" +#include "cgrsrce.h" // Windows resource IDs +#include "cgexcpt.h" +#include "cgimage.h" +#include "cgdib.h" +#include "cgchar.h" +#include "cglevel.h" +#include "cgtimer.h" +#include "cginput.h" +#include "cgmidi.h" +#include "cgoption.h" +#include "cgload.h" +#include "iklowns.h" // specific to this program + +#define WPM_ANIMATE (WM_USER+1) + +#define CHOICE_SOLO 0 +#define CHOICE_TWO 1 +#define CHOICE_NET 2 +#define CHOICE_QUIT 3 + +#define FIVE_SECONDS 5000 + +//** local definitions ** +// ImmortalKlowns 279afa8b-4981-11ce-a521-0020af0be560 +DEFINE_GUID(IMMORTALKLOWNS_GUID,0x279AFA8B,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60); + +char szAppName[] = "IKlowns"; // The name of this application +char szTitle[] = "Immortal Klowns"; // The title bar text + +CGameScreen* pGameScreen = NULL; +CGameLevel* pRumbleLevel = NULL; + +CGameTimer* Timer = NULL; +CGameInput* Input = NULL; +CLoadingScreen* gLoadingScreen = NULL; +static COptionScreen* pOptionScreen = NULL; +int gGameMode = 0; + +void ShutDownApp(void); +void GetMachineCaps(); + +#ifdef ONLY_ONE_INSTANCE +HANDLE hMutex = 0; +#endif + +// unhandled exception handler +#if defined(__BORLANDC__) || defined(__WATCOMC__) +void _cdecl UnHandler(void); +#else +void UnHandler(void); +#endif +void dbgprintf(char *fmt,...) +{ + char out [ 256 ]; + va_list vlist; + va_start(vlist, fmt); + wvsprintf(out, fmt, vlist); + OutputDebugString(out); +} + +/**************************************************************************** + + FUNCTION: WinMain(HINSTANCE, HINSTANCE, LPSTR, int) + + PURPOSE: calls initialization function, processes message loop + + COMMENTS: + + Windows recognizes this function by name as the initial entry point + for the program. This function calls the application initialization + routine, if no other instance of the program is running, and always + calls the instance initialization routine. It then executes a message + retrieval and dispatch loop that is the top-level control structure + for the remainder of execution. The loop is terminated when a WM_QUIT + message is received, at which time this function exits the application + instance by returning the value passed by PostQuitMessage(). + + If this function must abort before entering the message loop, it + returns the conventional value NULL. + +****************************************************************************/ +int CALLBACK WinMain( + HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + HACCEL hAccelTable; + int result = NULL; + + // only allow 1 instance + if (hPrevInstance) + return NULL; + + // install default exception handler + set_terminate( UnHandler ); + + ghInst = hInstance; + + if (InitInstance(hInstance, nCmdShow)) + { + hAccelTable = LoadAccelerators (hInstance, + MAKEINTRESOURCE(IDR_ACCELERATOR1)); + + /* Acquire and dispatch messages until a WM_QUIT message is + received. + */ + + while (GetMessage(&msg, // message structure + NULL, // handle of window receiving the message + 0, // lowest message to examine + 0)) // highest message to examine + { + if (!TranslateAccelerator (msg.hwnd, hAccelTable, &msg)) + { + TranslateMessage(&msg);// Translates virtual key codes + DispatchMessage(&msg); // Dispatches message to window + } + } + + ShutDownApp(); // call de-init code + result = msg.wParam; + +#ifdef ONLY_ONE_INSTANCE + CloseHandle(hMutex); +#endif + } + return (result); +} + +// ---------------------------------------------------------- +// GetSoundFromProfile - description +// ---------------------------------------------------------- +CSoundEffect *GetSoundFromProfile( + LPSTR SectionName, + LPSTR TopicName, + LPSTR ProfileName +) +{ + char dataBuf[256]; + + // Load any sound effects to be played + GetPrivateProfileString(SectionName, TopicName, "" + , dataBuf, sizeof(dataBuf), ProfileName); + + CStringRecord fields( dataBuf, "," ); + BOOL fLoop=FALSE; + + // See if the sound is to be looped when it is played + if ((fields.GetNumFields() > 2) && (toupper(*fields[2]) == 'L')) + { + fLoop = TRUE; + } + + // Create sound effect object based on WAV file + CSoundEffect *pSound = new CSoundEffect(fields[0], 0, fLoop, gSoundMode); + + // If a volume was specified and sound got created ok, + // set the defaul volume + if (pSound != NULL) + { + if (fields.GetNumFields() > 1) + pSound->SetVolume(atoi(fields[1])); + } + + return(pSound); + +} + +// ---------------------------------------------------------- +// GetRectFromProfile - description +// ---------------------------------------------------------- +void GetRectFromProfile( + RECT &rect, + LPSTR SectionName, + LPSTR EntryName, + LPSTR ProfileName +) +{ + char dataBuf[256]; + + GetPrivateProfileString(SectionName, EntryName, "" + , dataBuf, sizeof(dataBuf), ProfileName); + { + CStringRecord fields( dataBuf, "," ); + if (fields.GetNumFields() == 4) + { + rect.left = atoi(fields[0]); + rect.top = atoi(fields[1]); + rect.right = atoi(fields[2]); + rect.bottom = atoi(fields[3]); + } + } +} + +// ---------------------------------------------------------- +// GetPointFromProfile - description +// ---------------------------------------------------------- +void GetPointFromProfile( + POINT &pt, + LPSTR SectionName, + LPSTR EntryName, + LPSTR ProfileName +) +{ + char dataBuf[256]; + + GetPrivateProfileString(SectionName, EntryName, "" + , dataBuf, sizeof(dataBuf), ProfileName); + { + CStringRecord fields( dataBuf, "," ); + if (fields.GetNumFields() == 2) + { + pt.x = atoi(fields[0]); + pt.y = atoi(fields[1]); + } + } +} + +// ---------------------------------------------------------- +// GetColorFromProfile - description +// ---------------------------------------------------------- +COLORREF GetColorFromProfile( + LPSTR SectionName, + LPSTR EntryName, + LPSTR ProfileName +) +{ + char dataBuf[256]; + COLORREF color=0; + + // Initialize text color + GetPrivateProfileString(SectionName, EntryName, "" + , dataBuf, sizeof(dataBuf), ProfileName); + { + CStringRecord fields( dataBuf, "," ); + if (fields.GetNumFields() == 3) + { + color = PALETTERGB(atoi(fields[0]) + , atoi(fields[1]), atoi(fields[2])); + } + } + + return(color); + +} + +/**************************************************************************** + + FUNCTION: InitInstance(HINSTANCE, int) + + PURPOSE: Saves instance handle and creates main window + + COMMENTS: + + This function is called at initialization time for every instance of + this application. This function performs initialization tasks that + cannot be shared by multiple instances. + + In this case, we save the instance handle in a static variable and + create and display the main program window. + +****************************************************************************/ +int loading_stuff = 0; +#ifdef ONLY_ONE_INSTANCE +const char * MutexName = "IklownsMutex"; +#endif + +BOOL InitInstance( + HINSTANCE hInstance, + int nCmdShow) +{ + WNDCLASS wc; + +#ifdef ONLY_ONE_INSTANCE + // first, check to see if we're the first instance + hMutex = OpenMutex( SYNCHRONIZE, FALSE, MutexName); + if (hMutex != 0) + { + // we are *not* the first instance! + CloseHandle(hMutex); + MessageBox(0, "Only one copy of IKLOWNS can run at a time!", "Immortal Klowns", MB_OK); + return(FALSE); + } + else + { + // doesn't exist - so create it... + hMutex = CreateMutex(NULL, TRUE, MutexName); + } +#endif + + // Fill in window class structure with parameters that describe the + // main window. + + wc.style = CS_OWNDC; // Class style(s). + wc.lpfnWndProc = (WNDPROC)WndProc; // Window Procedure + wc.cbClsExtra = 0; // No per-class extra data. + wc.cbWndExtra = 0; // No per-window extra data. + wc.hInstance = hInstance; // Owner of this class + wc.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_APP)); // Icon name from .RC + wc.hCursor = LoadCursor(NULL, IDC_ARROW);// Cursor + wc.hbrBackground = NULL; // Default color + wc.lpszMenuName = NULL; + wc.lpszClassName = szAppName; // Name to register as + + // Register the window class + if (!RegisterClass(&wc)) + throw CGameException( + IDS_STARTUP_ERROR + ); + + // Create a main window for this application instance. + int winx = 0; + int winy = 0; + int winw = GetSystemMetrics(SM_CXSCREEN); + int winh = GetSystemMetrics(SM_CYSCREEN); + + ghMainWnd = CreateWindow( + szAppName, // See RegisterClass() call. + szTitle, // Text for window title bar. + WS_POPUP, // Window style. + winx, + winy, + winw, + winh, + NULL, // Overlapped windows have no parent. + NULL, // Use the window class menu. + hInstance, // This instance owns this window. + NULL // We don't use any data in our WM_CREATE + ); + + // If window could not be created, return "failure" + if (!ghMainWnd) + throw CGameException( + IDS_STARTUP_ERROR + ); + + ShowWindow(ghMainWnd, nCmdShow); // Show the window + UpdateWindow(ghMainWnd); // Sends WM_PAINT message + + char dirBuf[MAX_PATH]; + char dirPath[MAX_PATH]; + char dataPath[MAX_PATH]; + char *p; + GetModuleFileName(NULL, dirPath, sizeof(dirPath)); + p = strrchr(dirPath, '\\'); + *p = '\0'; + + lstrcpy(dirBuf, dirPath); + lstrcat(dirBuf , "\\iklowns.gam" ); + + GetPrivateProfileString("general", "datapath", ".", dataPath + , sizeof(dataPath), dirBuf); + + lstrcpy(gDataPath, dirPath); + lstrcat(gDataPath,"\\"); + lstrcat(gDataPath, dataPath); + SetCurrentDirectory(gDataPath); + + Input = new CGameInput; + + + // see if lobby can connect us + BOOL bConnected = FALSE; + + if (RemoteCreateLobby()) + { + bConnected = RemoteCreate(IMMORTALKLOWNS_GUID, "Whomever", "KrustyX"); + + // we are connected, so start multiplayer + if (bConnected) + gGameMode = CHOICE_NET; + } + + // let user decide how to connect + if (!bConnected) + { + pOptionScreen = new COptionScreen; + if ( ! pOptionScreen ) { + delete Input; + return( FALSE ); + } + pOptionScreen->Init(NULL, OPTION_PLAY_START, CHOICE_QUIT+1, NULL + , Input, CHOICE_SOLO, FIVE_SECONDS); + { + BOOL fReturnToOptionScreen; + + do { + fReturnToOptionScreen = FALSE; + + gGameMode = pOptionScreen->DoOptionScreen(); + + if ((gGameMode == -1) || (gGameMode == CHOICE_QUIT)) + { + pOptionScreen->Shutdown(); + delete pOptionScreen; + delete Input; + PostQuitMessage(0); + return (FALSE); + } + + if (gGameMode == CHOICE_NET) + { + if ( ! RemoteCreate(IMMORTALKLOWNS_GUID, "Whomever", "KrustyX") ) + { + fReturnToOptionScreen = TRUE; + } + } + } while ( fReturnToOptionScreen ); + } + pOptionScreen->Shutdown(); + delete pOptionScreen; + pOptionScreen = NULL; + } + + Timer = new CGameTimer; + + gUse_DDraw = (GetPrivateProfileInt("general", "useddraw", 0, dirBuf) == 1); + gDoubleBuffer = (GetPrivateProfileInt("general", "doublebuffer", 1, dirBuf)); + + if (gUse_DDraw) + { + // + // temp hack - verify DirectDraw object can be created + // before we do our construction, and if it cann't we + // punt to GDI + // + LPDIRECTDRAW pdd; + HRESULT result; + result = DirectDrawCreate( NULL, &pdd, NULL ); + if( result == DD_OK ) + { + pdd->Release(); + pGameScreen = new CGameDDrawScreen(ghMainWnd, 0, 0); + } + else + { + gUse_DDraw = 0; + } + } + if (!gUse_DDraw) + { + pGameScreen = new CGameDSScreen(ghMainWnd, SCREEN_WIDTH, + SCREEN_HEIGHT); + } + + // determine machine capabilities & store in gMachineCaps + GetMachineCaps(); + + gSoundMode = GetPrivateProfileInt("general", "SoundMode", 2, dirBuf); + if( gSoundMode == 0 ) + { + LPDIRECTSOUND pds; + HRESULT result; + result = DirectSoundCreate( NULL, &pds, NULL ); + if( result == 0 ) + { + pds->Release(); + } + else + { + gSoundMode = 1; + } + } + + + { + char BitmapFile[MAX_PATH]; + char MidiFile[MAX_PATH]; + POINT origin; + TXTCOLOR color; + RECT rect; + + GetPrivateProfileString("LoadingScreens", "Bitmap", "load.bmp" + , BitmapFile, sizeof(BitmapFile), dirBuf); + + color.main = COLOR_RED; + color.shadow = GetColorFromProfile("LoadingScreens", "DefaultShadow" + , dirBuf); + GetPointFromProfile(origin, "LoadingScreens", "HotSpot", dirBuf); + GetRectFromProfile(rect, "LoadingScreens", "TextRect", dirBuf); + + CSoundEffect *pSoundStart = GetSoundFromProfile("LoadingScreens", "SoundStart", dirBuf); + CSoundEffect *pSoundUpdate = GetSoundFromProfile("LoadingScreens", "SoundUpdate", dirBuf); + CSoundEffect *pSoundEnd = GetSoundFromProfile("LoadingScreens", "SoundEnd", dirBuf); + + GetPrivateProfileString("LoadingScreens", "Music", "" + , MidiFile, sizeof(MidiFile), dirBuf); + + gLoadingScreen = new CLoadingScreen(pGameScreen, BitmapFile, IDS_LOAD_MSG, origin + , color, rect, pSoundStart, pSoundUpdate, pSoundEnd, MidiFile); + } + + pRumbleLevel = new CGameLevel( dirBuf, "Rumble", Timer, Input, pGameScreen ); + + delete gLoadingScreen; + gLoadingScreen = NULL; + + char MidiFile[255]; + GetPrivateProfileString(pRumbleLevel->GetSectionName(), "Music", "", MidiFile + , sizeof(MidiFile), dirBuf); + + if (gMusicOn) + { + playMusic(MidiFile, FALSE); + } + + // prime the animation loop + PostMessage( ghMainWnd, WPM_ANIMATE, 0, 0 ); + + return (TRUE); // We succeeded... +} + +/**************************************************************************** + + FUNCTION: ShutDownApp() + + PURPOSE: un-initialize the app as needed + + COMMENTS: + +****************************************************************************/ +void ShutDownApp() +{ + closeMusic(); + + SetSilence( TRUE ); + ((CGameDDrawScreen*) pGameScreen)->ShowGDIPage(); + + delete pRumbleLevel; + delete pGameScreen; + + delete Input; + delete Timer; + + // force redraw of entire screen + InvalidateRect( HWND_DESKTOP, NULL, TRUE ); +} + +/**************************************************************************** + + FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) + + PURPOSE: Processes messages + + MESSAGES: + + WM_COMMAND - application menu (About dialog box) + WM_DESTROY - destroy window + + COMMENTS: + + To process the IDM_ABOUT message, call MakeProcInstance() to get the + current instance address of the About() function. Then call Dialog + box which will create the box according to the information in your + generic.rc file and turn control over to the About() function. When + it returns, free the intance address. + +****************************************************************************/ + +LRESULT CALLBACK WndProc( + HWND hWnd, // window handle + UINT message, // type of message + WPARAM uParam, // additional information + LPARAM lParam) // additional information +{ + int wmId, wmEvent; + + switch (message) { + case WM_ACTIVATEAPP: + gActive = (BOOL)uParam; + + // hook here for min on leaving ... + if (Timer) + { + switch (LOWORD(uParam)) + { + case WA_INACTIVE: + if (pRumbleLevel != NULL) + { + pRumbleLevel->StopAnimating(); + } + break; + + default: + if (pGameScreen != NULL) + { + pGameScreen->Refresh(); + } + + // restart the animation + PostMessage( hWnd, WPM_ANIMATE, 0, 0 ); + break; + } + return(0); + } + break; + + case WM_COMMAND: // message: command from application menu + + wmId = LOWORD(uParam); + wmEvent = HIWORD(uParam); + + switch (wmId) { + case IDM_EXIT: + DestroyWindow (hWnd); + break; + + default: + return (DefWindowProc(hWnd, message, uParam, lParam)); + } + break; + + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc; + + hdc = BeginPaint(hWnd, &ps); + + if (gLoadingScreen) + gLoadingScreen->Paint(); + else if ( pOptionScreen ) { + pOptionScreen->Paint(); + } + EndPaint(hWnd, &ps); + return(0); + break; + } + + case WM_ERASEBKGND: + // no need for erasing + if (pOptionScreen) + return (DefWindowProc(hWnd, message, uParam, lParam)); + else + return(1); + + case WPM_ANIMATE: + // won't return til finished with animation + if (gActive && (pRumbleLevel != NULL)) + { + // flush input... + if (Input) + Input->Flush(); + pRumbleLevel->Animate( hWnd, pGameScreen ); + } + return TRUE; + break; + + case WM_DESTROY: // message: window being destroyed + closeMusic(); + PostQuitMessage(0); + break; + + default: // Passes it on if unproccessed + return (DefWindowProc(hWnd, message, uParam, lParam)); + } + return (0); +} + +/*---------------------------------------------------------------------------*\ +| +| UnHandler +| +| DESCRIPTION: +| +| +| +\*---------------------------------------------------------------------------*/ +#if defined(__BORLANDC__) || defined(__WATCOMC__) +void _cdecl UnHandler(void) +#else +void UnHandler(void) +#endif +{ + + ShutDownApp(); + MessageBox( + HWND_DESKTOP, + "Unhandled exception in Immortal Klowns.", + "Exception", + MB_ICONSTOP | MB_OK + ); + abort(); +} + + +/*---------------------------------------------------------------------------*\ +| +| GetMachineProfile +| +| DESCRIPTION: +| determine various performance parameters for current machine +| +| +\*---------------------------------------------------------------------------*/ +void +GetMachineCaps() +{ + // processor type + SYSTEM_INFO info; + + GetSystemInfo( &info ); + switch (info.dwProcessorType) + { + case PROCESSOR_INTEL_PENTIUM: + gMachineCaps.processor = MCP_PENTIUM; + break; + + case PROCESSOR_INTEL_486: + gMachineCaps.processor = MCP_486; + break; + + case PROCESSOR_INTEL_386: + gMachineCaps.processor = MCP_386; + break; + + default: + gMachineCaps.processor = MCP_UNKNOWN; + break; + } + + // bus type + HKEY hPCI; + if (RegOpenKeyEx( + HKEY_LOCAL_MACHINE, + "Enum\\PCI", + 0, // reserved + KEY_READ, + &hPCI + ) == ERROR_SUCCESS) + { + gMachineCaps.bus = MCB_PCI; + RegCloseKey( hPCI ); + } + else + { + gMachineCaps.bus = MCB_ISA; + } + + // system memory + MEMORYSTATUS memStat; + + GlobalMemoryStatus( &memStat ); + gMachineCaps.sysMemory = memStat.dwTotalPhys; + // video memory & vid system + if (pGameScreen && (pGameScreen->TypeID() == ST_DDraw)) // info only available through ddraw + { + gMachineCaps.vidMemory = ((CGameDDrawScreen*) pGameScreen)->GetVideoMemory(); + if (gMachineCaps.vidMemory != 0) + { + gMachineCaps.vidSystem = MCV_DDRAW; + } + else + { + gMachineCaps.vidSystem = MCV_UNKNOWN; + } + } + else + { + gMachineCaps.vidMemory = 0; + gMachineCaps.vidSystem = MCV_UNKNOWN; + } +} diff --git a/sdk/samples/iklowns/iklowns.gam b/sdk/samples/iklowns/iklowns.gam new file mode 100644 index 0000000..fd80090 --- /dev/null +++ b/sdk/samples/iklowns/iklowns.gam @@ -0,0 +1,548 @@ +[General] +useddraw=1 +doublebuffer=1 +; Sound Modes: 0=DirectSound, 1=waveOut, 2=sndPlaySound +soundmode=0 +dlls=krusty.dll,misc.dll +datapath=data +Sleep=-1 +; If two-players on one machine, character for second klown +SecondKlown=Klown2 +; If one-player, computer generated klown... +RoboKlown=Klown2 +; If n-players, character for remote klowns +RemoteKlown=Klown2 + +[KRUSTY.DLL] +aggression=5 +mobility=15 +fastklown=0 +fastvel=200 +debugout=0 +piespeed=80 +pierange=800 +MouseSensitivity=75 +JoystickSensitivity=33 +RunThreshold=50 +RemoteUpdateInterval=1000 +RemoteTimeout=30 + +[Levels] +Rumble=1 + +[IntroScreens] +Bitmap=credits.BMP +Delay=4 + +[OptionScreens] +Bitmap=BACKDROP.BMP +TextRect=150,100,590,380 +DefaultColor=255,0,0 +DefaultShadow=149,149,149 +SelectColor=255,255,255 +SelectShadow=0,0,0 +FontFamily=SS_TIMES +MouseSensitivity=75 +JoystickSensitivity=33 +Timeout=30 + +[CreditScreens] +Bitmap=BACKDROP.BMP +TextRect=100,5,590,475 +DefaultColor=255,255,0 +DefaultShadow=0,0,0 +FontFamily=SS_TIMES +LinesPerScreen=12 +ScrollRate=2 +Music=KLOWN.MID + +[LoadingScreens] +Bitmap=LOAD.BMP +HotSpot=327,273 +DefaultColor=255,0,0 +DefaultShadow=0,0,0 +FontFamily=SS_TIMES +TextRect=100,350,600,400 +SoundStart=blow1.wav,63,loop +SoundUpdate=blow2.wav,63,noloop +SoundEnd=bang.wav,127,noloop +Music=KLOWN.MID + +[Rumble] +WorldX=1920 +WorldY=704 +StartX=-390 +StartY=-240 +Music=KLOWN.MID +;PreloadSounds=throw.wav +Palette=iklowns.pal +Graphics=RumbleGraphics +WinLose=CREDIT.BMP + +[RumbleGraphics] +Sky=Sky +sidef=TiledImage,14,-960,-105 +foreg1=TiledImage,1,-960,115 +BigTBig=TiledImage,20,-400,-40 +RollCost=TiledImage,72,100,-5 +BigTop=TiledImage,60,200,30 +BigTSml=TiledImage,70,40,104 +sideb=TiledImage,15,-960,-40 +ground1=TiledImage,13,-960,80 +; !!! note: numbers are: zmin, zmax, xpos, ypos, numactions, preload, remote object name +; The actions MUST match the number of actions actually defined... +Ferris=Character,128,128,-60,20,1,1 +Plane=Character,129,129,700,0,1,1 +Cloud1=Character,180,180,300,0,1,1 +Cloud2=Character,260,260,350,50,1,1 +Cloud3=Character,340,340,0,40,1,1 +Klown=Character,2,12,-210,30,32,1,Klown2 +Klown2=Character,2,12,210,30,32,0 +Pie=Character,255,255,500,0,2,0 + +[Plane] +Fly=0 + +[Fly] +SequenceFile=plane.spr +SequenceName=Fly +Sound=plane.wav,100,loop +Rate=15 + +[Ferris] +Turn=0 + +[Turn] +SequenceFile=fw0.spr +SequenceName=Turn +Rate=15 + +; +; Note: The following action sequences MUST be in the same order as in the DLL +; +; +[Klown] +stand_right=0 +stand_left=1 +walk_right=2 +walk_left=3 +run_right=4 +run_left=5 +r2l_turn=6 +l2r_turn=7 +throw_right=8 +throw_left=9 +throw_right_walk=10 +throw_left_walk=11 +throw_right_run=12 +throw_left_run=13 +in_right=14 +in_left=15 +out_right=16 +out_left=17 +duck_right=18 +duck_left=19 +block_right=20 +block_left=21 +poke_right=22 +poke_left=23 +hit_face_l=24 +hit_face_r=25 +hit_back_l=26 +hit_back_r=27 +poked_l=28 +poked_r=29 +died=30 +done=31 + +[stand_right] +SequenceFile=c1stand.spr +SequenceName=StandRight + +[stand_left] +SequenceFile=c1stand.spr +SequenceName=StandLeft + +[run_right] +SequenceFile=c1run.spr +SequenceName=RunRight +Sound=run.wav,80,loop +Rate=30 + +[run_left] +SequenceFile=c1run.spr +SequenceName=RunLeft +Sound=run.wav,60,loop +Rate=30 + +[walk_right] +SequenceFile=c1walk.spr +SequenceName=WalkRight +Sound=walk.wav,40,loop +Rate=30 + +[walk_left] +SequenceFile=c1walk.spr +SequenceName=WalkLeft +Sound=walk.wav,40,loop +Rate=30 + +[throw_right] +SequenceFile=c1throw.spr +SequenceName=ThrowRight +Rate=60 + +[throw_left] +SequenceFile=c1throw.spr +SequenceName=ThrowLeft +Rate=60 + +[r2l_turn] +SequenceFile=c1turn.spr +SequenceName=Right2Left +Rate=60 + +[l2r_turn] +SequenceFile=c1turn.spr +SequenceName=Left2Right +Rate=60 + +[duck_right] +SequenceFile=c1duck.spr +SequenceName=DuckRight +Rate=60 + +[duck_left] +SequenceFile=c1duck.spr +SequenceName=DuckLeft +Rate=60 + +[block_right] +SequenceFile=c1block.spr +SequenceName=BlockRight +Rate=60 + +[block_left] +SequenceFile=c1block.spr +SequenceName=BlockLeft +Rate=60 + +[poke_right] +SequenceFile=c1poke.spr +SequenceName=PokeRight +Sound=nyuk.wav,63,noloop +Rate=60 + +[poke_left] +SequenceFile=c1poke.spr +SequenceName=PokeLeft +Sound=nyuk.wav,63,noloop +Rate=60 + +[in_right] +SequenceFile=c1walk45.spr +SequenceName=InRight +Sound=walk.wav,40,loop + +[in_left] +SequenceFile=c1walk45.spr +SequenceName=InLeft +Sound=walk.wav,40,loop + +[out_right] +SequenceFile=c1walk45.spr +SequenceName=OutRight +Sound=walk.wav,40,loop + +[out_left] +SequenceFile=c1walk45.spr +SequenceName=OutLeft +Sound=walk.wav,40,loop + +[hit_face_l] +SequenceFile=c1piefac.spr +SequenceName=PieFaceLeft +SoundEnd=piehit2.wav,100 + +[hit_face_r] +SequenceFile=c1piefac.spr +SequenceName=PieFaceRight +SoundEnd=piehit2.wav,100 + +[hit_back_l] +SequenceFile=c1piehed.spr +SequenceName=PieHeadLeft +SoundEnd=piehit2.wav,100 + +[hit_back_r] +SequenceFile=c1piehed.spr +SequenceName=PieHeadRight +SoundEnd=piehit2.wav,100 + +[poked_l] +SequenceFile=c1stand.spr +SequenceName=StandLeft +Sound=woob.wav,63,noloop + +[poked_r] +SequenceFile=c1stand.spr +SequenceName=StandRight +Sound=woob.wav,63,noloop + +[throw_right_walk] +SequenceFile=c1stand.spr +SequenceName=StandRight + +[throw_left_walk] +SequenceFile=c1stand.spr +SequenceName=StandLeft + +[throw_right_run] +SequenceFile=c1stand.spr +SequenceName=StandRight + +[throw_left_run] +SequenceFile=c1stand.spr +SequenceName=StandLeft + +[died] +SequenceFile=c1sad.spr +SequenceName=C1SadLeft +Rate=10 +Sound=sad.wav,100,noloop + +[done] +SequenceFile=c1sad.spr +SequenceName=C1SadDone + +[Pie] +ThrownLeft=0 +ThrownRight=1 + +[ThrownLeft] +SequenceFile=piefly.spr +SequenceName=FlyLeft +Sound=throw.wav,100,noloop + +[ThrownRight] +SequenceFile=piefly.spr +SequenceName=FlyRight +Sound=throw.wav,100,noloop + +[Cloud1] +Float1=0 + +[Float1] +SequenceFile=clouds.spr +SequenceName=Cloud1 + +[Cloud2] +Float2=0 + +[Float2] +SequenceFile=clouds.spr +SequenceName=Cloud2 + +[Cloud3] +Float3=0 + +[Float3] +SequenceFile=clouds.spr +SequenceName=Cloud3 + +; +; Note: The following action sequences MUST be in the same order as in the DLL +; +; +[Klown2] +C2StandRight=0 +C2StandLeft=1 +C2WalkRight=2 +C2WalkLeft=3 +C2RunRight=4 +C2RunLeft=5 +C2_r2l=6 +C2_l2r=7 +C2ThrowRight=8 +C2ThrowLeft=9 +C2ThrowRight_walk=10 +C2ThrowLeft_walk=11 +C2ThrowRight_run=12 +C2ThrowLeft_run=13 +C2InRight=14 +C2InLeft=15 +C2OutRight=16 +C2OutLeft=17 +C2DuckRight=18 +C2DuckLeft=19 +C2BlockRight=20 +C2BlockLeft=21 +C2PokeRight=22 +C2PokeLeft=23 +C2PieFaceLeft=24 +C2PieFaceRight=25 +C2PieBackLeft=26 +C2PieBackRight=27 +C2PokedLeft=28 +C2PokedRight=29 +C2Died=30 +C2Done=31 + +[C2StandRight] +SequenceFile=c2stand.spr +SequenceName=C2StandRight + +[C2StandLeft] +SequenceFile=c2stand.spr +SequenceName=C2StandLeft + +[C2RunRight] +SequenceFile=c2run.spr +SequenceName=C2RunRight +Sound=run.wav,60,loop +;Rate=30 + +[C2RunLeft] +SequenceFile=c2run.spr +SequenceName=C2RunLeft +Sound=run.wav,60,loop +;Rate=30 + +[C2WalkRight] +SequenceFile=c2walk.spr +SequenceName=C2WalkRight +Sound=walk.wav,40,loop +;Rate=30 + +[C2WalkLeft] +SequenceFile=c2walk.spr +SequenceName=C2WalkLeft +Sound=walk.wav,40,loop +;Rate=30 + +[C2ThrowRight] +SequenceFile=c2throw.spr +SequenceName=C2ThrowRight +;Rate=60 + +[C2ThrowLeft] +SequenceFile=c2throw.spr +SequenceName=C2ThrowLeft +;Rate=60 + +[C2_r2l] +SequenceFile=c2turn.spr +SequenceName=C2Right2Left +;Rate=60 + +[C2_l2r] +SequenceFile=c2turn.spr +SequenceName=C2Left2Right +;Rate=60 + +[C2DuckRight] +SequenceFile=c2duck.spr +SequenceName=C2DuckRight +;Rate=60 + +[C2DuckLeft] +SequenceFile=c2duck.spr +SequenceName=C2DuckLeft +;Rate=60 + +[C2BlockRight] +SequenceFile=c2block.spr +SequenceName=C2BlockRight +;Rate=60 + +[C2BlockLeft] +SequenceFile=c2block.spr +SequenceName=C2BlockLeft +;Rate=60 + +[C2PokeRight] +SequenceFile=c2poke.spr +SequenceName=C2PokeRight +Sound=nyuk.wav,63,noloop +;Rate=60 + +[C2PokeLeft] +SequenceFile=c2poke.spr +SequenceName=C2PokeLeft +Sound=nyuk.wav,63,noloop +;Rate=60 + +[C2InRight] +SequenceFile=c2walk45.spr +SequenceName=C2InRight +Sound=walk.wav,40,loop + +[C2InLeft] +SequenceFile=c2walk45.spr +SequenceName=C2InLeft +Sound=walk.wav,40,loop + +[C2OutRight] +SequenceFile=c2walk45.spr +SequenceName=C2OutRight +Sound=walk.wav,40,loop + +[C2OutLeft] +SequenceFile=c2walk45.spr +SequenceName=C2OutLeft +Sound=walk.wav,40,loop + +[C2PieFaceLeft] +SequenceFile=c2piefac.spr +SequenceName=C2PieFaceLeft +SoundEnd=piehit2.wav,100,noloop + +[C2PieFaceRight] +SequenceFile=c2piefac.spr +SequenceName=C2PieFaceRight +SoundEnd=piehit2.wav,100,noloop + +[C2PieBackLeft] +SequenceFile=c2piehed.spr +SequenceName=C2PieHeadLeft +SoundEnd=piehit2.wav,100,noloop + +[C2PieBackRight] +SequenceFile=c2piehed.spr +SequenceName=C2PieHeadRight +SoundEnd=piehit2.wav,100,noloop + +[C2PokedLeft] +SequenceFile=c2stand.spr +SequenceName=C2StandLeft +Sound=woob.wav,63,noloop + +[C2PokedRight] +SequenceFile=c2stand.spr +SequenceName=C2StandRight +Sound=woob.wav,63,noloop + +[C2ThrowRight_walk] +SequenceFile=c2stand.spr +SequenceName=C2StandRight + +[C2ThrowLeft_walk] +SequenceFile=c2stand.spr +SequenceName=C2StandLeft + +[C2ThrowRight_run] +SequenceFile=c2stand.spr +SequenceName=C2StandRight + +[C2ThrowLeft_run] +SequenceFile=c2stand.spr +SequenceName=C2StandLeft + +[C2Died] +SequenceFile=c2sad.spr +SequenceName=C2SadLeft +Rate=10 + +[C2Done] +SequenceFile=c2sad.spr +SequenceName=C2SadDone diff --git a/sdk/samples/iklowns/iklowns.h b/sdk/samples/iklowns/iklowns.h new file mode 100644 index 0000000..81b2a92 --- /dev/null +++ b/sdk/samples/iklowns/iklowns.h @@ -0,0 +1,32 @@ +/*===========================================================================*\ +| +| File: iklowns.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +BOOL InitApplication(HINSTANCE); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM); diff --git a/sdk/samples/iklowns/iklowns.ico b/sdk/samples/iklowns/iklowns.ico new file mode 100644 index 0000000..44fd9fd Binary files /dev/null and b/sdk/samples/iklowns/iklowns.ico differ diff --git a/sdk/samples/iklowns/iklowns.mak b/sdk/samples/iklowns/iklowns.mak new file mode 100644 index 0000000..c9bae22 --- /dev/null +++ b/sdk/samples/iklowns/iklowns.mak @@ -0,0 +1,667 @@ +# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=Win32 Debug +!MESSAGE No configuration specified. Defaulting to Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "IKLOWNS.MAK" CFG="Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "Win32 Debug" +MTL=MkTypLib.exe +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "retail" +# PROP BASE Intermediate_Dir "retail" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "retail" +# PROP Intermediate_Dir "retail" +OUTDIR=.\retail +INTDIR=.\retail + +ALL : $(OUTDIR)/IKLOWNS.ovl $(OUTDIR)/IKLOWNS.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /G4 /MT /W3 /GX /YX /O2 /I ".\include" /I "..\..\inc "/D "NDEBUG" /D "WIN32" /D "_WINDOWS" /c +# SUBTRACT CPP /Fr +CPP_PROJ=/nologo /G4 /MT /W3 /GX /YX /O2 /I ".\include" /I "..\..\inc"\ + /D "NDEBUG" /D "STRICT" /D "WIN32" /D "_WINDOWS" \ + /Fp$(OUTDIR)/"IKLOWNS.pch" /Fo$(INTDIR)/ /c +CPP_OBJS=.\retail/ +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo$(INTDIR)/"IKLOWNS.res" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_SBRS= \ + +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"IKLOWNS.bsc" + +$(OUTDIR)/IKLOWNS.bsc : $(OUTDIR) $(BSC32_SBRS) +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /NOLOGO /SUBSYSTEM:windows,4.0 /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib msacm32.lib /NOLOGO /SUBSYSTEM:windows,4.0 /DEBUG /MACHINE:I386 +# SUBTRACT LINK32 /INCREMENTAL:yes +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib msacm32.lib\ + ..\..\lib\ddraw.lib ..\..\lib\dplayx.lib ..\..\lib\dsound.lib\ + /NOLOGO /SUBSYSTEM:windows,4.0 /INCREMENTAL:no /PDB:$(OUTDIR)/"IKLOWNS.pdb" /DEBUG\ + /MACHINE:I386 /OUT:$(OUTDIR)/"IKLOWNS.ovl" +DEF_FILE= +LINK32_OBJS= \ + $(INTDIR)/CGSCREEN.OBJ \ + $(INTDIR)/CGDIB.OBJ \ + $(INTDIR)/iklowns.obj \ + $(INTDIR)/CGGLOBL.OBJ \ + $(INTDIR)/IKLOWNS.res \ + $(INTDIR)/CGBITBUF.OBJ \ + $(INTDIR)/CGIMAGE.OBJ \ + $(INTDIR)/CGCHAR.OBJ \ + $(INTDIR)/CGSPRITE.OBJ \ + $(INTDIR)/CGACTION.OBJ \ + $(INTDIR)/LINKLIST.LIB \ + $(INTDIR)/CGUPDATE.OBJ \ + $(INTDIR)/cgutil.lib \ + $(INTDIR)/CGLEVEL.OBJ \ + $(INTDIR)/CGTIMER.OBJ \ + $(INTDIR)/CGINPUT.OBJ \ + $(INTDIR)/CGGRAPH.OBJ \ + $(INTDIR)/CGDLIST.OBJ \ + $(INTDIR)/CGCHRINT.OBJ \ + $(INTDIR)/CGREMOTE.OBJ \ + $(INTDIR)/CGREMQUE.OBJ \ + $(INTDIR)/cgmidi.obj \ + $(INTDIR)/cgsound.obj \ + $(INTDIR)/CGWAVE.OBJ \ + $(INTDIR)/CGOPTION.OBJ \ + $(INTDIR)/CGTEXT.OBJ \ + $(INTDIR)/CGLOAD.OBJ + +$(OUTDIR)/IKLOWNS.ovl : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + copy $(OUTDIR)\IKLOWNS.OVL IKLOWNS.OVL + +!ELSEIF "$(CFG)" == "Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "debug" +# PROP BASE Intermediate_Dir "debug" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "debug" +# PROP Intermediate_Dir "debug" +OUTDIR=.\debug +INTDIR=.\debug + +ALL : $(OUTDIR)/IKLOWNS.ovl $(OUTDIR)/IKLOWNS.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE CPP /nologo /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /G4 /MT /W3 /GX /Zi /YX /Od /I ".\include" /D "_DEBUG" /D "DEBUG" /D "WIN32" /D "_WINDOWS" /c +# SUBTRACT CPP /Fr +CPP_PROJ=/nologo /G4 /MT /W3 /GX /Zi /YX /Od /I ".\include" /I "..\..\inc"\ + /D "_DEBUG" /D "STRICT" /D "DEBUG" /D "WIN32" /D\ + "_WINDOWS" /D "WINVER=0x0400" /Fp$(OUTDIR)/"IKLOWNS.pch" /Fo$(INTDIR)/\ + /Fd$(OUTDIR)/"IKLOWNS.pdb" /c +CPP_OBJS=.\debug/ +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo$(INTDIR)/"IKLOWNS.res" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_SBRS= \ + +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"IKLOWNS.bsc" + +$(OUTDIR)/IKLOWNS.bsc : $(OUTDIR) $(BSC32_SBRS) +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /NOLOGO /SUBSYSTEM:windows,4.0 /DEBUG /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib msacm32.lib /NOLOGO /SUBSYSTEM:windows,4.0 /INCREMENTAL:no /DEBUG /MACHINE:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib msacm32.lib\ + ..\..\lib\ddraw.lib ..\..\lib\dplayx.lib ..\..\lib\dsound.lib\ + /NOLOGO /SUBSYSTEM:windows,4.0 /INCREMENTAL:no /PDB:$(OUTDIR)/"IKLOWNS.pdb" /DEBUG\ + /MACHINE:I386 /OUT:$(OUTDIR)/"IKLOWNS.ovl" +DEF_FILE= +LINK32_OBJS= \ + $(INTDIR)/CGSCREEN.OBJ \ + $(INTDIR)/CGDIB.OBJ \ + $(INTDIR)/iklowns.obj \ + $(INTDIR)/CGGLOBL.OBJ \ + $(INTDIR)/IKLOWNS.res \ + $(INTDIR)/CGBITBUF.OBJ \ + $(INTDIR)/CGIMAGE.OBJ \ + $(INTDIR)/CGCHAR.OBJ \ + $(INTDIR)/CGSPRITE.OBJ \ + $(INTDIR)/CGACTION.OBJ \ + $(INTDIR)/LINKLIST.LIB \ + $(INTDIR)/CGUPDATE.OBJ \ + $(INTDIR)/cgutil.lib \ + $(INTDIR)/CGLEVEL.OBJ \ + $(INTDIR)/CGTIMER.OBJ \ + $(INTDIR)/CGINPUT.OBJ \ + $(INTDIR)/CGGRAPH.OBJ \ + $(INTDIR)/CGDLIST.OBJ \ + $(INTDIR)/CGCHRINT.OBJ \ + $(INTDIR)/CGREMOTE.OBJ \ + $(INTDIR)/CGREMQUE.OBJ \ + $(INTDIR)/cgmidi.obj \ + $(INTDIR)/cgsound.obj \ + $(INTDIR)/CGWAVE.OBJ \ + $(INTDIR)/CGOPTION.OBJ \ + $(INTDIR)/CGTEXT.OBJ \ + $(INTDIR)/CGLOAD.OBJ + +$(OUTDIR)/IKLOWNS.ovl : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + copy $(OUTDIR)\IKLOWNS.OVL IKLOWNS.OVL + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Group "Source Files" + +################################################################################ +# Begin Source File + +SOURCE=.\CGSCREEN.CPP +DEP_CGSCR=\ + .\INCLUDE\CGDEBUG.H\ + .\CGBITBUF.H\ + .\CGSCREEN.H\ + .\INCLUDE\CGDIB.H + +$(INTDIR)/CGSCREEN.OBJ : $(SOURCE) $(DEP_CGSCR) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGDIB.CPP +DEP_CGDIB=\ + .\CGGLOBL.H\ + .\cgrsrce.h\ + .\CGSCREEN.H\ + .\INCLUDE\CGEXCPT.H\ + .\INCLUDE\CGDEBUG.H\ + .\INCLUDE\CGDIB.H\ + .\CGBITBUF.H + +$(INTDIR)/CGDIB.OBJ : $(SOURCE) $(DEP_CGDIB) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\iklowns.cpp +DEP_IKLOW=\ + .\INCLUDE\STRREC.H\ + .\CGGLOBL.H\ + .\cgrsrce.h\ + .\INCLUDE\CGEXCPT.H\ + .\CGIMAGE.H\ + .\INCLUDE\CGDIB.H\ + .\CGCHAR.H\ + .\CGLEVEL.H\ + .\CGTIMER.H\ + .\CGINPUT.H\ + .\CGMIDI.H\ + .\CGOPTION.H\ + .\CGLOAD.H\ + .\IKLOWNS.H\ + .\CGSCREEN.H\ + .\CGBITBUF.H\ + .\CGGRAPH.H\ + .\CGUPDATE.H\ + .\CGACTION.H\ + .\CGCHDLL.H\ + .\CGREMOTE.H\ + .\CGDLIST.H\ + .\cgsound.h\ + .\CGTEXT.H\ + .\INCLUDE\LINKLIST.H\ + .\CGSPRITE.H\ + .\CGREMQUE.H + +$(INTDIR)/iklowns.obj : $(SOURCE) $(DEP_IKLOW) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGGLOBL.CPP +DEP_CGGLO=\ + .\CGGLOBL.H + +$(INTDIR)/CGGLOBL.OBJ : $(SOURCE) $(DEP_CGGLO) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\IKLOWNS.RC +DEP_IKLOWN=\ + .\IKLOWNS.ICO\ + .\cgrsrce.h + +$(INTDIR)/IKLOWNS.res : $(SOURCE) $(DEP_IKLOWN) $(INTDIR) + $(RSC) $(RSC_PROJ) $(SOURCE) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGBITBUF.CPP +DEP_CGBIT=\ + .\INCLUDE\CGDEBUG.H\ + .\INCLUDE\CGDIB.H\ + .\CGBITBUF.H + +$(INTDIR)/CGBITBUF.OBJ : $(SOURCE) $(DEP_CGBIT) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGIMAGE.CPP +DEP_CGIMA=\ + .\cgrsrce.h\ + .\INCLUDE\CGEXCPT.H\ + .\INCLUDE\CGDEBUG.H\ + .\CGGLOBL.H\ + .\CGSCREEN.H\ + .\CGLEVEL.H\ + .\CGUPDATE.H\ + .\CGIMAGE.H\ + .\CGBITBUF.H\ + .\CGDLIST.H\ + .\INCLUDE\LINKLIST.H\ + .\CGGRAPH.H\ + .\INCLUDE\CGDIB.H + +$(INTDIR)/CGIMAGE.OBJ : $(SOURCE) $(DEP_CGIMA) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGCHAR.CPP +DEP_CGCHA=\ + .\INCLUDE\CGDEBUG.H\ + .\CGTIMER.H\ + .\CGINPUT.H\ + .\CGCHAR.H\ + .\CGCHDLL.H\ + .\CGCHRINT.H\ + .\CGREMOTE.H\ + .\INCLUDE\STRREC.H\ + .\CGUPDATE.H\ + .\CGACTION.H\ + .\CGGRAPH.H\ + .\INCLUDE\LINKLIST.H\ + .\CGREMQUE.H\ + .\CGSPRITE.H\ + .\cgsound.h\ + .\CGLEVEL.H\ + .\CGSCREEN.H\ + .\CGBITBUF.H\ + .\CGDLIST.H\ + .\INCLUDE\CGDIB.H + +$(INTDIR)/CGCHAR.OBJ : $(SOURCE) $(DEP_CGCHA) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGSPRITE.CPP +DEP_CGSPR=\ + .\INCLUDE\CGDEBUG.H\ + .\CGGLOBL.H\ + .\CGTIMER.H\ + .\CGSPRITE.H\ + .\CGUPDATE.H\ + .\INCLUDE\LINKLIST.H\ + .\CGBITBUF.H\ + .\CGSCREEN.H\ + .\INCLUDE\CGDIB.H + +$(INTDIR)/CGSPRITE.OBJ : $(SOURCE) $(DEP_CGSPR) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGACTION.CPP +DEP_CGACT=\ + .\CGGLOBL.H\ + .\INCLUDE\CGDEBUG.H\ + .\CGSPRITE.H\ + .\INCLUDE\STRREC.H\ + .\CGACTION.H\ + .\INCLUDE\LINKLIST.H\ + .\CGBITBUF.H\ + .\cgsound.h\ + .\INCLUDE\CGDIB.H + +$(INTDIR)/CGACTION.OBJ : $(SOURCE) $(DEP_CGACT) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\LIB\DEBUG\LINKLIST.LIB +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGUPDATE.CPP +DEP_CGUPD=\ + .\CGUPDATE.H\ + .\CGGLOBL.H\ + .\INCLUDE\LINKLIST.H + +$(INTDIR)/CGUPDATE.OBJ : $(SOURCE) $(DEP_CGUPD) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\LIB\DEBUG\cgutil.lib +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGLEVEL.CPP +DEP_CGLEV=\ + .\INCLUDE\LINKLIST.H\ + .\CGGRAPH.H\ + .\CGLEVEL.H\ + .\CGTIMER.H\ + .\CGCHDLL.H\ + .\CGCHRINT.H\ + .\INCLUDE\STRREC.H\ + .\CGINPUT.H\ + .\CGCHAR.H\ + .\CGIMAGE.H\ + .\CGMIDI.H\ + .\CGREMOTE.H\ + .\cgsound.h\ + .\CGGLOBL.H\ + .\CGSCREEN.H\ + .\CGUPDATE.H\ + .\CGDLIST.H\ + .\CGACTION.H\ + .\CGREMQUE.H\ + .\CGBITBUF.H\ + .\CGSPRITE.H\ + .\INCLUDE\CGDIB.H + +$(INTDIR)/CGLEVEL.OBJ : $(SOURCE) $(DEP_CGLEV) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGTIMER.CPP +DEP_CGTIM=\ + .\CGTIMER.H + +$(INTDIR)/CGTIMER.OBJ : $(SOURCE) $(DEP_CGTIM) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGINPUT.CPP +DEP_CGINP=\ + .\CGINPUT.H + +$(INTDIR)/CGINPUT.OBJ : $(SOURCE) $(DEP_CGINP) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGGRAPH.CPP +DEP_CGGRA=\ + .\CGGRAPH.H\ + .\CGLEVEL.H\ + .\CGSCREEN.H\ + .\CGUPDATE.H\ + .\CGDLIST.H\ + .\CGBITBUF.H\ + .\INCLUDE\LINKLIST.H\ + .\INCLUDE\CGDIB.H + +$(INTDIR)/CGGRAPH.OBJ : $(SOURCE) $(DEP_CGGRA) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGDLIST.CPP +DEP_CGDLI=\ + .\cgrsrce.h\ + .\INCLUDE\CGEXCPT.H\ + .\INCLUDE\STRREC.H\ + .\INCLUDE\CGDEBUG.H\ + .\CGCHAR.H\ + .\CGIMAGE.H\ + .\CGLOAD.H\ + .\CGDLIST.H\ + .\CGUPDATE.H\ + .\CGACTION.H\ + .\CGGRAPH.H\ + .\CGCHDLL.H\ + .\CGREMOTE.H\ + .\cgsound.h\ + .\CGTEXT.H\ + .\INCLUDE\LINKLIST.H\ + .\CGSPRITE.H\ + .\CGLEVEL.H\ + .\CGSCREEN.H\ + .\CGREMQUE.H\ + .\CGBITBUF.H\ + .\INCLUDE\CGDIB.H + +$(INTDIR)/CGDLIST.OBJ : $(SOURCE) $(DEP_CGDLI) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGCHRINT.CPP +DEP_CGCHR=\ + .\CGCHDLL.H\ + .\CGLEVEL.H\ + .\CGCHAR.H\ + .\CGCHRINT.H\ + .\CGINPUT.H\ + .\CGDLIST.H\ + .\CGUPDATE.H\ + .\CGACTION.H\ + .\CGGRAPH.H\ + .\CGREMOTE.H\ + .\INCLUDE\LINKLIST.H\ + .\CGSPRITE.H\ + .\cgsound.h\ + .\CGSCREEN.H\ + .\CGREMQUE.H\ + .\CGBITBUF.H\ + .\INCLUDE\CGDIB.H + +$(INTDIR)/CGCHRINT.OBJ : $(SOURCE) $(DEP_CGCHR) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\.\LIB\DDRAW.LIB +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGREMOTE.CPP +DEP_CGREM=\ + .\CGLEVEL.H\ + .\CGREMOTE.H\ + .\INCLUDE\STRREC.H\ + .\CGDLIST.H\ + .\INCLUDE\LINKLIST.H\ + .\CGREMQUE.H\ + .\CGUPDATE.H + +$(INTDIR)/CGREMOTE.OBJ : $(SOURCE) $(DEP_CGREM) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGREMQUE.CPP +DEP_CGREMQ=\ + .\INCLUDE\LINKLIST.H\ + .\CGREMOTE.H\ + .\CGREMQUE.H + +$(INTDIR)/CGREMQUE.OBJ : $(SOURCE) $(DEP_CGREMQ) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\.\LIB\DPLAY.LIB +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\cgmidi.cpp +DEP_CGMID=\ + .\CGMIDI.H + +$(INTDIR)/cgmidi.obj : $(SOURCE) $(DEP_CGMID) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\cgsound.cpp +DEP_CGSOU=\ + .\INCLUDE\LINKLIST.H\ + .\CGWAVE.H\ + .\cgsound.h + +$(INTDIR)/cgsound.obj : $(SOURCE) $(DEP_CGSOU) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGWAVE.CPP +DEP_CGWAV=\ + .\CGWAVE.H + +$(INTDIR)/CGWAVE.OBJ : $(SOURCE) $(DEP_CGWAV) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\.\LIB\DSOUND.LIB +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGOPTION.CPP +DEP_CGOPT=\ + .\CGGLOBL.H\ + .\INCLUDE\CGDIB.H\ + .\INCLUDE\STRREC.H\ + .\CGINPUT.H\ + .\CGTEXT.H\ + .\INCLUDE\LINKLIST.H + +$(INTDIR)/CGOPTION.OBJ : $(SOURCE) $(DEP_CGOPT) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGTEXT.CPP +DEP_CGTEX=\ + .\CGTEXT.H\ + .\INCLUDE\LINKLIST.H + +$(INTDIR)/CGTEXT.OBJ : $(SOURCE) $(DEP_CGTEX) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGLOAD.CPP +DEP_CGLOA=\ + .\CGGLOBL.H\ + .\INCLUDE\STRREC.H\ + .\INCLUDE\CGDIB.H\ + .\cgsound.h\ + .\CGLOAD.H\ + .\CGTEXT.H\ + .\INCLUDE\LINKLIST.H + +$(INTDIR)/CGLOAD.OBJ : $(SOURCE) $(DEP_CGLOA) $(INTDIR) + +# End Source File +# End Group +# End Project +################################################################################ diff --git a/sdk/samples/iklowns/iklowns.rc b/sdk/samples/iklowns/iklowns.rc new file mode 100644 index 0000000..e408e11 --- /dev/null +++ b/sdk/samples/iklowns/iklowns.rc @@ -0,0 +1,252 @@ +//Microsoft Visual C++ generated resource script. +// +#include "cgrsrce.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "winver.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +IDI_APP ICON DISCARDABLE "IKLOWNS.ICO" + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_GENERIC ACCELERATORS MOVEABLE PURE +BEGIN + VK_F1, IDM_HELPCONTENTS, VIRTKEY + "?", IDM_ABOUT, ASCII, ALT + "/", IDM_ABOUT, ASCII, ALT +END + +IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE +BEGIN + VK_DOWN, IDA_DOWN, VIRTKEY, NOINVERT + VK_LEFT, IDA_LEFT, VIRTKEY, NOINVERT + VK_RETURN, IDA_RETURN, VIRTKEY, NOINVERT + VK_RIGHT, IDA_RIGHT, VIRTKEY, NOINVERT + VK_UP, IDA_UP, VIRTKEY, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 167, 64 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "About Generic" +BEGIN + DEFPUSHBUTTON "OK",IDOK,132,2,32,14,WS_GROUP + ICON IDI_APP,-1,3,2,18,20 + LTEXT "CompanyName",IDC_COMPANYNAME,30,2,100,8 + LTEXT "FileDescription",IDC_FILEDESCRIPTION,30,10,82,8 + LTEXT "ProductVersion",IDC_PRODUCTVERSION,114,10,16,8 + LTEXT "LegalCopyright",IDC_LEGALCOPYRIGHT,30,18,137,8 + LTEXT "LegalTrademarks",IDC_LEGALTRADEMARKS,30,34,136,27 + CONTROL "",501,"Static",SS_BLACKRECT,28,31,138,1 +END + +IDD_REMCONNABORTDLG DIALOG DISCARDABLE 0, 0, 183, 20 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Waiting for connection" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Cancel",IDCANCEL,129,2,50,14 + LTEXT "Press Cancel to abort",IDC_STATIC,28,5,75,8 +END + +IDD_CHOOSEPROVIDER DIALOG DISCARDABLE 0, 0, 199, 158 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Choose Connection Mechanism" +FONT 8, "MS Sans Serif" +BEGIN + LISTBOX IDC_LIST1,6,7,182,109,LBS_SORT | LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "OK",IDOK,31,130,47,13 + PUSHBUTTON "Cancel",IDCANCEL,120,130,47,13 +END + +IDD_SELSESSION DIALOG DISCARDABLE 0, 0, 185, 170 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Select Session" +FONT 8, "MS Sans Serif" +BEGIN + LISTBOX IDC_LB_SESSION,10,12,157,129,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "OK",IDOK,10,150,60,15 + PUSHBUTTON "Cancel",IDCANCEL,100,150,65,15 +END + +IDD_Q_CREATE DIALOG DISCARDABLE 0, 0, 142, 36 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Create Game or Connect to Game?" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Create",IDC_CREATE,3,10,50,14 + PUSHBUTTON "Connect",IDC_CONNECT,78,10,50,14 +END + +IDD_OPTIONS DIALOG DISCARDABLE 0, 0, 185, 183 +STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU +CAPTION "Iklowns Options" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,17,154,50,14 + PUSHBUTTON "Cancel",IDCANCEL,113,154,50,14 + LISTBOX IDC_LISTOPTION,21,26,136,112,LBS_NOINTEGRALHEIGHT | + WS_TABSTOP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +1 VERSIONINFO + FILEVERSION 3,3,0,0 + PRODUCTVERSION 3,3,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0xbL +#else + FILEFLAGS 0xaL +#endif + FILEOS 0x10001L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "Microsoft Corporation\0" + VALUE "FileDescription", "Generic Example Application\0" + VALUE "FileVersion", "3.3\0" + VALUE "InternalName", "Generic\0" + VALUE "LegalCopyright", "Copyright \251 Microsoft Corp. 1990 - 1996\0" + VALUE "LegalTrademarks", "Microsoft\256 is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation\0" + VALUE "OriginalFilename", "\0" + VALUE "ProductName", "Generic\0" + VALUE "ProductVersion", "3.2\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "cgrsrce.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""winver.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +///////////////////////////////////////////////////////////////////////////// +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_INFO_TITLE "Attention" + IDS_ERROR_TITLE "Error" + IDS_INVALID_FILE "Invalid file." + IDS_GDI_ERROR "GDI Error." + IDS_STARTUP_ERROR "Error starting application." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_SOLO_PLAY "Play solo" + IDS_TWO_PLAYER "Two player game" + IDS_NET_PLAY "Play network opponents" + IDS_QUIT_GAME "Quit Game" + IDS_INSTRUCTION_1 "Arrow keys move, shift fires pie, alt+down ducks, alt+shift blocks, shift+down pokes" + IDS_INSTRUCTION_2 "F2 = sound, F5 = frame rate, F9 = fastklown mode" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WIN_1 "Congratulations!" + IDS_WIN_2 " " + IDS_WIN_3 "You beat the Klown!" + IDS_WIN_4 " " +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WIN_5 "Try your luck again..." + IDS_WIN_6 "Or press ESC to quit" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LOSE_1 "Sorry!" + IDS_LOSE_2 " " + IDS_LOSE_3 "The Klown beat you!" + IDS_LOSE_4 " " + IDS_LOSE_5 "Try your luck again..." + IDS_LOSE_6 "Or press ESC to quit" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LOAD_MSG "Please Wait... Loading Data." +END + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/sdk/samples/iklowns/include/cgdebug.h b/sdk/samples/iklowns/include/cgdebug.h new file mode 100644 index 0000000..df67379 --- /dev/null +++ b/sdk/samples/iklowns/include/cgdebug.h @@ -0,0 +1,50 @@ +/*===========================================================================*\ +| +| File: cgdebug.h +| +| Description: +| debugging macros +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +#ifndef CGDEBUG_H +#define CGDEBUG_H + +// NOTE: must define DEBUG to get any debug strings! +#ifdef DEBUG +#define DB_LOG(type, string) if (DB_TYPES & type) OutputDebugString(string); +#else +#define DB_LOG(type, string) +#endif + +// DB_TYPES is a bitmap of desired debug strings +#define DB_INFO 0x01 // for non-error, non-time-critical information output +#define DB_TIMECRIT_INFO 0x02 // for non-error, time-critical (e.g. IRQ handler) info +#define DB_PROBLEM 0x04 // for non-time-critical problem report +#define DB_TIMECRIT_PROBLEM 0x08 // for time-critical (e.g. IRQ handler) problem report + +// default to no debug output if DB_TYPES not defined +#ifndef DB_TYPES +#define DB_TYPES 0 +#endif + +#ifdef DEBUG +#define DB_BREAK_IF(x) if (x) DebugBreak(); +#define DB_BREAK() DebugBreak(); + +#define DB_CHECK(x, string) if (x) DB_LOG(DB_PROBLEM, string); +#else +#define DB_BREAK_IF(x) +#define DB_BREAK() + +#define DB_CHECK(x, string) +#endif + + +#endif // CGDEBUG_H diff --git a/sdk/samples/iklowns/include/cgdib.h b/sdk/samples/iklowns/include/cgdib.h new file mode 100644 index 0000000..f96b35d --- /dev/null +++ b/sdk/samples/iklowns/include/cgdib.h @@ -0,0 +1,69 @@ +/*===========================================================================*\ +| +| File: cgdib.h +| +| Description: +| contains class definitions for handling DIBs +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +#ifndef CGDIB_H +#define CGDIB_H + +#include <windows.h> + +// CGameDIB is class for handling DIBs in Manhattan games +class CGameDIB +{ +public: + CGameDIB(); // create empty, invalid object (used by derived classes) + CGameDIB( char* pFileName ); // constructor - create image from file + + // construct a new DIB section in memory of given size, palette + CGameDIB( int width, int height, HPALETTE hPal = NULL ); + + virtual ~CGameDIB(); // destructor + + virtual LPBITMAPINFO GetBitmapInfo(){return mpBitmapInfo;} + virtual LPBYTE GetBits(){return mpBits;} + + virtual HPALETTE CreatePalette(); + virtual HBITMAP GetHBitmap(){return mhBitmap;} + + virtual LPBYTE GetPixelAddress(int x, int y); + virtual COLORREF GetPixelColor(int x, int y); + + virtual UINT GetColorTable(UINT, UINT, RGBQUAD*); + + virtual int GetWidth(); + virtual int GetHeight(); + + virtual int BytesPerScanline() + { + return (GetWidth() + 3) & ~3; + } + + virtual const char* GetNamePtr() + { + return (const char*) mpFileName; + } + +protected: + + BOOL mImageValid; // flag whether image is valid + + LPBITMAPINFO mpBitmapInfo; + LPBYTE mpBits; + HBITMAP mhBitmap; // handle to our DIB section + char* mpFileName; + + void OpenDIB(char* pFileName); +}; + +#endif // CGDIB_H diff --git a/sdk/samples/iklowns/include/cgexcpt.h b/sdk/samples/iklowns/include/cgexcpt.h new file mode 100644 index 0000000..a947f47 --- /dev/null +++ b/sdk/samples/iklowns/include/cgexcpt.h @@ -0,0 +1,47 @@ +/*===========================================================================*\ +| +| File: cgexcpt.h +| +| Description: +| Exception classes +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +#ifndef CGEXCPT_H +#define CGEXCPT_H + +#include <windows.h> + +class CGameException +{ +public: + CGameException(int resID = 0); // 0 == no message + virtual ~CGameException(); + + virtual int GetResID(){return mResID;} + +protected: + int mResID; +}; + +class CGameStartupError : public CGameException +{ +public: + CGameStartupError(int resID = 0); // 0 == no message + virtual ~CGameStartupError(); +}; + +class CGameResourceError : public CGameException +{ +public: + CGameResourceError(); + virtual ~CGameResourceError(); +}; + +#endif // CGEXCPT_H diff --git a/sdk/samples/iklowns/include/cgres.h b/sdk/samples/iklowns/include/cgres.h new file mode 100644 index 0000000..5de85e2 --- /dev/null +++ b/sdk/samples/iklowns/include/cgres.h @@ -0,0 +1,32 @@ +/*===========================================================================*\ +| +| File: cgres.h +| +| Description: +| resource loading classes +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +#ifndef CGRES_H +#define CGRES_H + +#include <windows.h> + +#define MAX_STRING_LENGTH 255 + +class CGameStringResource +{ +public: + CGameStringResource( HINSTANCE, UINT ); + virtual ~CGameStringResource(); + + char mString[MAX_STRING_LENGTH]; +}; + +#endif // CGRES_H diff --git a/sdk/samples/iklowns/include/dibfile.h b/sdk/samples/iklowns/include/dibfile.h new file mode 100644 index 0000000..fa07da6 --- /dev/null +++ b/sdk/samples/iklowns/include/dibfile.h @@ -0,0 +1,77 @@ +/*===========================================================================*\ +| +| File: dibfile.h +| +| Description: +| Classes for saving DIB files +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +#ifndef DIBFILE_H +#define DIBFILE_H + +#include <windows.h> +#include "cgdib.h" + +#if 0 +class TempBackupFile +{ +public: + // constructor makes a temporary backup copy of the file + TempBackupFile(char* pOrgFileName); + + // if Commit() never called, destructor restores the original file from the backup + virtual ~TempBackupFile(); + + void Commit(); // commit the org file by disgarding the temp backup + +private: + char* mpTempFileName; + char* mpOrgFileName; +}; +#endif + +// writes a DIB file +class DIBWriteFile : public CGameDIB +{ +public: + // constructor creates the DIB file & the DIBWriteFile object + DIBWriteFile(char* pFileName, LPBITMAPINFO pBmi); + + // destructor closes the file & deletes the DIBWriteFile object + virtual ~DIBWriteFile(); + +#if 0 + HBITMAP GetHBitmap() + { + return mhBitmap; + } + + LPVOID GetBits() + { + return mpBits; + } +#endif + + void Write(); + +// void SetColorTable( LPBITMAPINFO pBmi ); + void SetColorTable( CGameDIB* pDIB ); + void FillDIB( BYTE color ); // fill the DIB with color + +private: +// TempBackupFile* mpTempBackup; +// HBITMAP mhBitmap; +// LPBITMAPINFO mpInfo; // ptr to our BITMAPINFO +// LPVOID mpBits; // ptr to DIB bits + +// char* mpFileName; +}; + +#endif // DIBFILE_H diff --git a/sdk/samples/iklowns/include/linklist.h b/sdk/samples/iklowns/include/linklist.h new file mode 100644 index 0000000..4cb84e7 --- /dev/null +++ b/sdk/samples/iklowns/include/linklist.h @@ -0,0 +1,53 @@ +/*===========================================================================*\ +| +| File: linklist.h +| +| Description: +| link list class include file +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +#ifndef _LINKLIST_H +#define _LINKLIST_H + +typedef struct _NODE { + struct _NODE *pPrev; + struct _NODE *pNext; + void *pData; +} NODE, *LPNODE; + +class CLinkedList { +private: + LPNODE Find(void *pData); + LPNODE pHead; + LPNODE pTail; + LPNODE pCurPosition; +public: + CLinkedList(); + ~CLinkedList(); + void *GetFirst(); + void *GetLast(); + void *GetNext(); + void *GetNext(void *pData); + void *GetPrev( ); + void *GetPrev(void *pData); + void Add(void *pData); + void Insert(void *pData); + void Insert(void *pData, void *pBefore); + void Append(void *pData); + void Remove( ); + void Remove(void *pData); + void *RemoveFirst(); + void *RemoveLast(); +}; + +#define LinkedList CLinkedList + +#endif + diff --git a/sdk/samples/iklowns/include/strrec.h b/sdk/samples/iklowns/include/strrec.h new file mode 100644 index 0000000..f597cfe --- /dev/null +++ b/sdk/samples/iklowns/include/strrec.h @@ -0,0 +1,40 @@ +/*===========================================================================*\ +| +| File: strrec.h +| +| Description: +| SDF string parsing class +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +#ifndef STRREC_H +#define STRREC_H + +#define MAX_FIELDS 256 + +class CStringRecord +{ +public: + CStringRecord(char* pString, char* pDelims); + virtual ~CStringRecord(); + + char* operator[](int field); + + int GetNumFields() + { + return mNumFields; + } + +private: + char** mpFields; + int mNumFields; +}; + + +#endif // STRREC_H diff --git a/sdk/samples/iklowns/linklist.cpp b/sdk/samples/iklowns/linklist.cpp new file mode 100644 index 0000000..ea0c577 --- /dev/null +++ b/sdk/samples/iklowns/linklist.cpp @@ -0,0 +1,383 @@ +/*===========================================================================*\ +| +| File: linklist.cpp +| +| Description: +| Class to maintain a doubly linked list. +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +#include "linklist.h" + +#define NULL 0L + +// ----------------------------------------------------------------- +// CLinkedList constructor - initialize to empty +// ----------------------------------------------------------------- +CLinkedList::CLinkedList() +{ + pHead = pTail = pCurPosition = NULL; +} + +// ----------------------------------------------------------------- +// CLinkedList destructor - free each node +// Note: we do not free the app data pointed to by each node. +// ----------------------------------------------------------------- +CLinkedList::~CLinkedList() +{ + LPNODE pCur, pNext; + + pCur = pHead; + pHead = pTail = pCurPosition = NULL; + + // Go thru list and free each node + while (pCur != NULL) + { + pNext = pCur->pNext; + delete(pCur); + pCur = pNext; + } +} + +// ----------------------------------------------------------------- +// GetFirst - return app data for first entry in list and make it +// the current node. +// ----------------------------------------------------------------- +void * CLinkedList::GetFirst() +{ + pCurPosition = pHead; + if (pCurPosition == NULL) + { + return(NULL); + } + + return(pCurPosition->pData); +} + +// ----------------------------------------------------------------- +// GetLast - return app data to last entry in list and make it +// the current node. +// ----------------------------------------------------------------- +void * CLinkedList::GetLast() +{ + pCurPosition = pTail; + if (pCurPosition == NULL) + { + return(NULL); + } + + return(pCurPosition->pData); +} + +// ----------------------------------------------------------------- +// GetNext - return next app data entry in list and make it +// the current node. +// ----------------------------------------------------------------- +void * CLinkedList::GetNext() +{ + LPNODE pNext; + + // check for empty list or already at end of list. + if ((pCurPosition == NULL) || (pCurPosition->pNext == NULL)) + { + return(NULL); + } + + pNext = pCurPosition->pNext; + pCurPosition = pNext; + return(pNext->pData); +} + +// ----------------------------------------------------------------- +// GetFirst - return app data that follows a given entry and make it +// the current node. +// ----------------------------------------------------------------- +void * CLinkedList::GetNext(void *pData) +{ + pCurPosition = Find(pData); + return(GetNext()); +} + +// ----------------------------------------------------------------- +// GetPrev - return app data for previous entry in list and make it +// the current node. +// ----------------------------------------------------------------- +void * CLinkedList::GetPrev() +{ + LPNODE pPrev; + + // check for empty list or already at start + if ((pCurPosition == NULL) || (pCurPosition->pPrev == NULL)) + { + return(NULL); + } + + pPrev = pCurPosition->pPrev; + pCurPosition = pPrev; + return(pPrev->pData); + +} +// ----------------------------------------------------------------- +// GetFirst - return app data that preceeds a given entry and make it +// the current node. +// ----------------------------------------------------------------- +void * CLinkedList::GetPrev(void *pData) +{ + pCurPosition = Find(pData); + return(GetPrev()); +} + +// ----------------------------------------------------------------- +// Add - create a new node and put it at the start of the list and +// make it the current node. +// ----------------------------------------------------------------- +void CLinkedList::Add(void *pData) +{ + LPNODE pNew = new NODE; + + // setup node and prepare it for its role as the new head of the list + pNew->pData = pData; + pNew->pNext = pHead; + pNew->pPrev = NULL; + + // The old head of list (if any) should point to new node) + if (pHead != NULL) + pHead->pPrev = pNew; + + // Make new node the head and current position + pHead = pNew; + pCurPosition = pNew; + + // Check to see if new node is also the tail (ie. only list entry) + if (pTail == NULL) + pTail = pNew; +} + +// ----------------------------------------------------------------- +// Append - create a new node and put it at the end of the list. +// ----------------------------------------------------------------- +void CLinkedList::Append(void *pData) +{ + LPNODE pNew = new NODE; + + // setup node and prepare it for its role as the new tail of the list + pNew->pData = pData; + pNew->pPrev = pTail; + pNew->pNext = NULL; + + // The old tail of list (if any) should point to new node. + if (pTail != NULL) + pTail->pNext = pNew; + + // Make new node the tail + pTail = pNew; + + // Check to see if new node is also the head (ie. only list entry) + if (pHead == NULL) + { + pHead = pNew; + pCurPosition = pNew; + } +} + +// ----------------------------------------------------------------- +// Find - private method to find the node with the specified app data +// attached to it. +// ----------------------------------------------------------------- +LPNODE CLinkedList::Find(void *pData) +{ + LPNODE pCur; + + // go thru list until we reach end or we find the right node. + for (pCur=pHead; (pCur != NULL) && (pCur->pData != pData); pCur= pCur->pNext); + return(pCur); +} + + +// ----------------------------------------------------------------- +// Insert - create a new node and put it in front of the current +// position node and make it the current position. +// ----------------------------------------------------------------- +void CLinkedList::Insert(void *pData) +{ + LPNODE pNext, pPrev; + LPNODE pNew = new NODE; + + pNew->pData = pData; + + // check to be sure that there is a current node + if (pCurPosition != NULL) + { + + // get pointers of current position + pPrev = pCurPosition->pPrev; + pNext = pCurPosition->pNext; + + // set new nodes pointers for insertion into the list + pNew->pPrev = pPrev; + pNew->pNext = pCurPosition; + + // Set the node in front of new node (if any) to point to it + if (pPrev != NULL) + { + pPrev->pNext = pNew; + + // No node in front -> new node is at head + } else { + pHead = pNew; + } + + // make new node the current node + pCurPosition = pNew; + + // No current node, just Add to front + } else { + Add(pData); + } +} + +// ----------------------------------------------------------------- +// Insert - create a new node and put it in front of the specified +// node and make it the current position. +// ----------------------------------------------------------------- +void CLinkedList::Insert(void *pData, void *pBefore) +{ + // simply make the specified node current and insert the new + // node. + pCurPosition = Find(pBefore); + Insert(pData); +} + +// ----------------------------------------------------------------- +// Remove - remove a specified node from the list. +// Note: we do not delete the app data attached to the node! +// ----------------------------------------------------------------- +void CLinkedList::Remove() +{ + LPNODE pCur, pNext, pPrev; + + pCur = pCurPosition; + + if (pCur != NULL) + { + + // save a copy of the links + pPrev = pCur->pPrev; + pNext = pCur->pNext; + + // Is there a node ahead of us? + if (pPrev != NULL) + { + // yes -> update it to not point to us. + pPrev->pNext = pNext; + } else { + // no -> update head to not point to us. + pHead = pNext; + pCurPosition = pNext; + } + + // Is there a node behind us? + if (pNext != NULL) + { + // yes -> update it to not point to us. + pNext->pPrev = pPrev; + pCurPosition = pNext; + } else { + // no -> update tail to not point to us. + pTail = pPrev; + pCurPosition = pPrev; + } + + delete(pCur); + } + +} + +// ----------------------------------------------------------------- +// Remove - remove a specified node from the list. +// Note: we do not delete the app data attached to the node! +// ----------------------------------------------------------------- +void CLinkedList::Remove(void *pData) +{ + pCurPosition = Find(pData); + Remove(); +} +// ----------------------------------------------------------------- +// RemoveFirst - remove the first node in the list and return the +// app data associated with it. +// ----------------------------------------------------------------- +void * CLinkedList::RemoveFirst() +{ + LPNODE pCur, pNext; + void *pData = NULL; + + pCur = pHead; + + // is there a node at the head? + if (pCur != NULL) + { + + // take first node out of list. + pNext = pCur->pNext; + pHead = pNext; + pCurPosition = pNext; + + // are there any nodes after us? + if (pNext != NULL) + { + // yes -> make it the new head + pNext->pPrev = NULL; + } else { + // no -> the list is now empty + pTail = NULL; + } + + // get app data for node and then delete it + pData = pCur->pData; + delete(pCur); + } + + return(pData); +} + +// ----------------------------------------------------------------- +// RemoveLast - remove the last node in the list and return the +// app data associated with it. +// ----------------------------------------------------------------- +void * CLinkedList::RemoveLast() +{ + LPNODE pCur, pPrev; + void *pData = NULL; + + pCur = pTail; + + // is there a node at the tail? + if (pCur != NULL) + { + // take last node out of list. + pPrev = pCur->pPrev; + pTail = pPrev; + + // are there any nodes ahead of us? + if (pPrev != NULL) + { + // yes -> make it the new tail node + pPrev->pNext = NULL; + } else { + // no -> list is now empty + pHead = NULL; + pCurPosition = NULL; + } + + // get app data for node and then delete it + pData = pCur->pData; + delete(pCur); + } + + return(pData); +} diff --git a/sdk/samples/iklowns/linklist.mak b/sdk/samples/iklowns/linklist.mak new file mode 100644 index 0000000..b828d8b --- /dev/null +++ b/sdk/samples/iklowns/linklist.mak @@ -0,0 +1,158 @@ +# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +!IF "$(CFG)" == "" +CFG=Win32 Debug +!MESSAGE No configuration specified. Defaulting to Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "LINKLIST.mak" CFG="Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "Win32 Debug" +CPP=cl.exe + +!IF "$(CFG)" == "Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "retail" +# PROP BASE Intermediate_Dir "retail" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "retail" +# PROP Intermediate_Dir "retail" +OUTDIR=.\retail +INTDIR=.\retail + +ALL : $(OUTDIR)/LINKLIST.lib $(OUTDIR)/LINKLIST.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /W3 /GX /YX /O2 /I ".\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c +CPP_PROJ=/nologo /W3 /GX /YX /O2 /I ".\include" /D "WIN32" /D "STRICT" /D "NDEBUG" /D\ + "_WINDOWS" /FR$(INTDIR)/ /Fp$(OUTDIR)/"LINKLIST.pch" /Fo$(INTDIR)/ /c +CPP_OBJS=.\retail/ +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"LINKLIST.bsc" +BSC32_SBRS= \ + $(INTDIR)/LINKLIST.SBR + +$(OUTDIR)/LINKLIST.bsc : $(OUTDIR) $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=lib.exe +# ADD BASE LIB32 /NOLOGO +# ADD LIB32 /NOLOGO +LIB32_FLAGS=/NOLOGO /OUT:$(OUTDIR)\"LINKLIST.lib" +DEF_FLAGS= +DEF_FILE= +LIB32_OBJS= \ + $(INTDIR)/LINKLIST.OBJ + +$(OUTDIR)/LINKLIST.lib : $(OUTDIR) $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "debug" +# PROP BASE Intermediate_Dir "debug" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "debug" +# PROP Intermediate_Dir "debug" +OUTDIR=.\debug +INTDIR=.\debug + +ALL : $(OUTDIR)/LINKLIST.lib $(OUTDIR)/LINKLIST.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE CPP /nologo /W3 /GX /Z7 /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /W3 /GX /Z7 /YX /Od /I ".\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c +CPP_PROJ=/nologo /W3 /GX /Z7 /YX /Od /I ".\include" /D "STRICT" /D "WIN32" /D "_DEBUG" /D\ + "_WINDOWS" /FR$(INTDIR)/ /Fp$(OUTDIR)/"LINKLIST.pch" /Fo$(INTDIR)/ /c +CPP_OBJS=.\debug/ +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"LINKLIST.bsc" +BSC32_SBRS= \ + $(INTDIR)/LINKLIST.SBR + +$(OUTDIR)/LINKLIST.bsc : $(OUTDIR) $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=lib.exe +# ADD BASE LIB32 /NOLOGO +# ADD LIB32 /NOLOGO +LIB32_FLAGS=/NOLOGO /OUT:$(OUTDIR)\"LINKLIST.lib" +DEF_FLAGS= +DEF_FILE= +LIB32_OBJS= \ + $(INTDIR)/LINKLIST.OBJ + +$(OUTDIR)/LINKLIST.lib : $(OUTDIR) $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Group "Source Files" + +################################################################################ +# Begin Source File + +SOURCE=.\LINKLIST.CPP + +$(INTDIR)/LINKLIST.OBJ : $(SOURCE) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\INCLUDE\LINKLIST.H +# End Source File +# End Group +# End Project +################################################################################ diff --git a/sdk/samples/iklowns/makefile b/sdk/samples/iklowns/makefile new file mode 100644 index 0000000..6cdbea4 --- /dev/null +++ b/sdk/samples/iklowns/makefile @@ -0,0 +1,37 @@ +# Master make file. Creates all necessary sub-components +# of the Immortal Klowns project, while allowing those components +# to be compiled w/VC + +!IF ("$(CFG)" == "") || ("$(CFG)" == "Win32 Debug") +CFG=Win32 Debug +TARGDIR=debug +TARGET=debug +!ELSE +CFG=Win32 Release +TARGDIR=retail +TARGET=retail +!ENDIF + +default: + nmake $(MISC) /nologo /f linklist.mak CFG="$(CFG)" + nmake $(MISC) /nologo /f cgutil.mak CFG="$(CFG)" + + nmake $(MISC) /nologo /f splash.mak CFG="$(CFG)" + + nmake $(MISC) /nologo /f iklowns.mak CFG="$(CFG)" + + nmake $(MISC) /nologo /f cgkrusty.mak CFG="$(CFG)" + + nmake $(MISC) /nologo /f misc.mak CFG="$(CFG)" + +all: debug retail + +retail: + nmake CFG="Win32 Release" + +debug: + nmake CFG="Win32 Debug" + +clean: + @deltree /y retail + @deltree /y debug diff --git a/sdk/samples/iklowns/mdsplay.h b/sdk/samples/iklowns/mdsplay.h new file mode 100644 index 0000000..33b7547 --- /dev/null +++ b/sdk/samples/iklowns/mdsplay.h @@ -0,0 +1,81 @@ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +// +// Public include file for MDSPlay.DLL +// + +// Returned errors +// +#define MDS_SUCCESS (0) +#define MDS_ERR_NOMEM (1) +#define MDS_ERR_NOFILE (2) +#define MDS_ERR_BADFILE (3) +#define MDS_ERR_BADFLAGS (4) +#define MDS_ERR_MIDIERROR (5) +#define MDS_ERR_INVALHANDLE (6) +#define MDS_ERR_BADSTATE (7) + + +// +// LoadMDSImage +// +// Allocate space for and read the given image in preparation for playback. +// +// lpbImage may be freed after this call +// + +// One of these flags MUST be set +// +// lpbImage -> string containing filename +// +#define MDS_F_FILENAME 0x00000001L + +// lpbImage -> memory image of file +// +#define MDS_F_MEMORY 0x00000002L + +// NOTE: cbImage only used if MDS_F_MEMORY is set. +// +DWORD LoadMDSImage(HANDLE *hImage, PBYTE pbImage, DWORD cbImage, DWORD fdw); + +// +// FreeMDSImage +// +// Release all memory associated with the given MDS image. +// +// If the given MDS is still playing, it will be stopped and the device +// closed. +// +DWORD FreeMDSImage(HANDLE hImage); +// +// Basic operations on the MDS image +// + +// Loop until told to stop +// +#define MDS_F_LOOP 0x00000001L + +// Play from beginning or last pause state. +// +DWORD PlayMDS(HANDLE hImage, DWORD fdw); + +// Pause until next play +// +DWORD PauseMDS(HANDLE hImage); + +// Stop. Next play will start at beginning of file again +// +DWORD StopMDS(HANDLE hImage); diff --git a/sdk/samples/iklowns/misc.def b/sdk/samples/iklowns/misc.def new file mode 100644 index 0000000..a8ca9b5 --- /dev/null +++ b/sdk/samples/iklowns/misc.def @@ -0,0 +1,8 @@ +LIBRARY MISC + +DESCRIPTION 'CGameCharacter Implementation DLL: Krusty' + +EXPORTS + Ident @1 + Info @2 + diff --git a/sdk/samples/iklowns/misc.mak b/sdk/samples/iklowns/misc.mak new file mode 100644 index 0000000..338f8e3 --- /dev/null +++ b/sdk/samples/iklowns/misc.mak @@ -0,0 +1,204 @@ +# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +!IF "$(CFG)" == "" +CFG=Win32 Debug +!MESSAGE No configuration specified. Defaulting to Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "MISC.MAK" CFG="Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "Win32 Debug" +MTL=MkTypLib.exe +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "retail" +# PROP BASE Intermediate_Dir "retail" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "retail" +# PROP Intermediate_Dir "retail" +OUTDIR=.\retail +INTDIR=.\retail + +ALL : .\$(OUTDIR)\misc.dll $(OUTDIR)/MISC.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE CPP /nologo /MT /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /MT /W3 /GX /YX /O2 /I "..\..\inc" /I ".\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /c +# SUBTRACT CPP /Fr +CPP_PROJ=/nologo /MT /W3 /GX /YX /O2 /I "..\..\inc" /I ".\include" \ + /D "WIN32" /D "STRICT" /D "NDEBUG"\ + /D "_WINDOWS" /Fp$(OUTDIR)/"MISC.pch" /Fo$(INTDIR)/ /c +CPP_OBJS=.\retail/ +# ADD BASE RSC /d "NDEBUG" +# ADD RSC /d "NDEBUG" +BSC32=bscmake.exe +BSC32_SBRS= \ + +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"MISC.bsc" + +$(OUTDIR)/MISC.bsc : $(OUTDIR) $(BSC32_SBRS) +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /NOLOGO /SUBSYSTEM:windows,4.0 /DLL /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /NOLOGO /SUBSYSTEM:windows,4.0 /DLL /MACHINE:I386 /OUT:"$(OUTDIR)\"misc.dll"" +# SUBTRACT LINK32 /INCREMENTAL:yes +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /NOLOGO\ + /SUBSYSTEM:windows,4.0 /DLL /INCREMENTAL:no /PDB:$(OUTDIR)/"MISC.pdb" /MACHINE:I386\ + /DEF:".\MISC.DEF" /OUT:$(OUTDIR)\""misc.dll"" /IMPLIB:$(OUTDIR)/"MISC.lib" +DEF_FILE=.\MISC.DEF +LINK32_OBJS= \ + $(INTDIR)/CGINPUT.OBJ \ + $(INTDIR)/CGMISC.OBJ + +.\$(OUTDIR)\misc.dll : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + copy $(OUTDIR)\misc.dll misc.dll + +!ELSEIF "$(CFG)" == "Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "debug" +# PROP BASE Intermediate_Dir "debug" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "debug" +# PROP Intermediate_Dir "debug" +OUTDIR=.\debug +INTDIR=.\debug + +ALL : $(OUTDIR)\misc.dll $(OUTDIR)/MISC.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE CPP /nologo /MT /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /MT /W3 /GX /Zi /YX /Od /I "..\..\inc" /I ".\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /c +# SUBTRACT CPP /Fr +CPP_PROJ=/nologo /MT /W3 /GX /Zi /YX /Od /I "..\..\inc" /I ".\include" \ + /D "WIN32" /D "STRICT" /D "_DEBUG"\ + /D "_WINDOWS" /Fp$(OUTDIR)/"MISC.pch" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"MISC.pdb" /c +CPP_OBJS=.\debug/ +# ADD BASE RSC /d "_DEBUG" +# ADD RSC /d "_DEBUG" +BSC32=bscmake.exe +BSC32_SBRS= \ + +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"MISC.bsc" + +$(OUTDIR)/MISC.bsc : $(OUTDIR) $(BSC32_SBRS) +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /NOLOGO /SUBSYSTEM:windows,4.0 /DLL /DEBUG /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /NOLOGO /SUBSYSTEM:windows,4.0 /DLL /INCREMENTAL:no /DEBUG /MACHINE:I386 /OUT:"$(OUTDIR)\"misc.dll"" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /NOLOGO\ + /SUBSYSTEM:windows,4.0 /DLL /INCREMENTAL:no /PDB:$(OUTDIR)/"MISC.pdb" /DEBUG\ + /MACHINE:I386 /DEF:".\MISC.DEF" /OUT:$(OUTDIR)\""misc.dll""\ + /IMPLIB:$(OUTDIR)/"MISC.lib" +DEF_FILE=.\MISC.DEF +LINK32_OBJS= \ + $(INTDIR)/CGINPUT.OBJ \ + $(INTDIR)/CGMISC.OBJ + +$(OUTDIR)\misc.dll : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + copy $(OUTDIR)\misc.dll misc.dll + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Group "Source Files" + +################################################################################ +# Begin Source File + +SOURCE=.\MISC.DEF +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGINPUT.CPP +DEP_CGINP=\ + .\CGINPUT.H + +$(INTDIR)/CGINPUT.OBJ : $(SOURCE) $(DEP_CGINP) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CGMISC.CPP +DEP_CGMIS=\ + .\CGCHDLL.H\ + .\CGCHAR.H\ + .\CGTIMER.H\ + .\CGINPUT.H\ + .\CGUPDATE.H\ + .\CGACTION.H\ + .\CGGRAPH.H\ + .\cgremote.h\ + .\INCLUDE\LINKLIST.H\ + .\CGSPRITE.H\ + .\cgsound.h\ + .\CGLEVEL.H\ + .\CGSCREEN.H\ + .\cgremque.h\ + .\CGBITBUF.H\ + .\CGDLIST.H\ + .\INCLUDE\CGDIB.H + +$(INTDIR)/CGMISC.OBJ : $(SOURCE) $(DEP_CGMIS) $(INTDIR) + +# End Source File +# End Group +# End Project +################################################################################ diff --git a/sdk/samples/iklowns/readme.txt b/sdk/samples/iklowns/readme.txt new file mode 100644 index 0000000..69d1bd0 --- /dev/null +++ b/sdk/samples/iklowns/readme.txt @@ -0,0 +1,24 @@ +Immortal Klowns Sample Game +--------------------------- + +To build Immortal Klowns, do an NMAKE in this directory. + +Be sure that the proper environment variables have been set up for the +windows include files and lib files. + +When the make is done, just type IKLOWNS in the current directory. Make sure +that you DO NOT run it from the debug or retail subdirectories - if you do, +you will get an error because IKLOWNS can't find all the resources it needs +to run. + +To play using TCP/IP over the Internet, the people who are joining the +game must enter the IP address of the machine that hosted the game. +You can find out the IP address of your machine by running "winipcfg". +If you have a net card and a modem installed, you will need to make sure +you read the IP address for the modem connected to the Internet. The +modem will be listed as "PPP Adapter". DirectPlay will not work through +proxies and firewalls. + +Also see the DPLAUNCH sample. + + diff --git a/sdk/samples/iklowns/splash.cpp b/sdk/samples/iklowns/splash.cpp new file mode 100644 index 0000000..a51d7bf --- /dev/null +++ b/sdk/samples/iklowns/splash.cpp @@ -0,0 +1,559 @@ +/*===========================================================================*\ +| +| File: splash.cpp +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +#include <windows.h> +#include <windowsx.h> +#include "splashrc.h" + +char szAppName[] = "ISplash"; // The name of this application +char acModuleName[256]; + +HINSTANCE ghInst; +HWND ghMainWnd; +LPBITMAPINFOHEADER lpBitmap; +LPBYTE mpBits; +HPALETTE hPal; +HPALETTE hPalOld; +LOGPALETTE *pPal; +int nPasses = 0; +int fadeDirection = 1; +LPSTR pSoundBuffer = NULL; + +/* Macro to determine to round off the given value to the closest byte */ +#define WIDTHBYTES(i) ((i+31)/32*4) + +#define PALVERSION 0x300 +#define MAXPALETTE 256 /* max. # supported palette entries */ + +#define NUMFADESTEPS 64 +#define HOLD_TIME 500 +#define INTERVAL_TIME 30 + +/**************************************************************************** + * * + * FUNCTION : DibNumColors(VOID FAR * pv) * + * * + * PURPOSE : Determines the number of colors in the DIB by looking at * + * the BitCount filed in the info block. * + * * + * RETURNS : The number of colors in the DIB. * + * * + ****************************************************************************/ +WORD DibNumColors (VOID FAR * pv) +{ + INT bits; + LPBITMAPINFOHEADER lpbi; + LPBITMAPCOREHEADER lpbc; + + lpbi = ((LPBITMAPINFOHEADER)pv); + lpbc = ((LPBITMAPCOREHEADER)pv); + + /* With the BITMAPINFO format headers, the size of the palette + * is in biClrUsed, whereas in the BITMAPCORE - style headers, it + * is dependent on the bits per pixel ( = 2 raised to the power of + * bits/pixel). + */ + if (lpbi->biSize != sizeof(BITMAPCOREHEADER)) + { + if (lpbi->biClrUsed != 0) + return (WORD)lpbi->biClrUsed; + bits = lpbi->biBitCount; + } + else + bits = lpbc->bcBitCount; + + switch (bits) + { + case 1: + return 2; + case 4: + return 16; + case 8: + return 256; + default: + /* A 24 bitcount DIB has no color table */ + return 0; + } +} + +/**************************************************************************** + * * + * FUNCTION : PaletteSize(VOID FAR * pv) * + * * + * PURPOSE : Calculates the palette size in bytes. If the info. block * + * is of the BITMAPCOREHEADER type, the number of colors is * + * multiplied by 3 to give the palette size, otherwise the * + * number of colors is multiplied by 4. * + * * + * RETURNS : Palette size in number of bytes. * + * * + ****************************************************************************/ +WORD PaletteSize (VOID FAR * pv) +{ + LPBITMAPINFOHEADER lpbi; + WORD NumColors; + + lpbi = (LPBITMAPINFOHEADER)pv; + NumColors = DibNumColors(lpbi); + + if (lpbi->biSize == sizeof(BITMAPCOREHEADER)) + return (WORD)(NumColors * sizeof(RGBTRIPLE)); + else + return (WORD)(NumColors * sizeof(RGBQUAD)); +} + +void FadePalette( + LOGPALETTE *pPal, + LPBITMAPINFOHEADER lpbi, + int fadestep +) +{ + RGBQUAD FAR *pRgb; + + if (lpbi == NULL) + return; + + if (lpbi->biSize != sizeof(BITMAPINFOHEADER)) + return; + + pRgb = (RGBQUAD FAR *)((LPSTR)lpbi + (WORD)lpbi->biSize); + for (int i = 1; i <= pPal->palNumEntries; i++) + { + pPal->palPalEntry[i-1].peRed = (pRgb[i].rgbRed * fadestep) / NUMFADESTEPS; + pPal->palPalEntry[i-1].peGreen = (pRgb[i].rgbGreen * fadestep) / NUMFADESTEPS; + pPal->palPalEntry[i-1].peBlue = (pRgb[i].rgbBlue * fadestep) / NUMFADESTEPS; + pPal->palPalEntry[i-1].peFlags = PC_NOCOLLAPSE; + } +} + +/**************************************************************************** + * * + * FUNCTION : CreateBIPalette(LPBITMAPINFOHEADER lpbi) * + * * + * PURPOSE : Given a Pointer to a BITMAPINFO struct will create a * + * a GDI palette object from the color table. * + * * + * RETURNS : * + * * + ****************************************************************************/ +LOGPALETTE *CreateBIPalette ( + LPBITMAPINFOHEADER lpbi, + int fadestep +) +{ + + LOGPALETTE *pPal; + HPALETTE hpal = NULL; + WORD nNumColors; + BYTE red; + BYTE green; + BYTE blue; + WORD i; + RGBQUAD FAR *pRgb; + + if (lpbi == NULL) + return NULL; + + if (lpbi->biSize != sizeof(BITMAPINFOHEADER)) + return NULL; + + /* Get a pointer to the color table and the number of colors in it */ + pRgb = (RGBQUAD FAR *)((LPSTR)lpbi + (WORD)lpbi->biSize); + nNumColors = DibNumColors(lpbi); + + if (nNumColors) + { + /* Allocate for the logical palette structure */ + pPal = (LOGPALETTE*)LocalAlloc(LPTR,sizeof(LOGPALETTE) + nNumColors * sizeof(PALETTEENTRY)); + if (!pPal) + return NULL; + + pPal->palNumEntries = nNumColors - 2; + pPal->palVersion = PALVERSION; + + /* Fill in the palette entries from the DIB color table and + * create a logical color palette. + */ + + for (i = 1; i < (nNumColors-1); i++) + { + pPal->palPalEntry[i-1].peRed = (pRgb[i].rgbRed * fadestep) / NUMFADESTEPS; + pPal->palPalEntry[i-1].peGreen = (pRgb[i].rgbGreen * fadestep) / NUMFADESTEPS; + pPal->palPalEntry[i-1].peBlue = (pRgb[i].rgbBlue * fadestep) / NUMFADESTEPS; + pPal->palPalEntry[i-1].peFlags = PC_NOCOLLAPSE; + } + } + else if (lpbi->biBitCount == 24) + { + /* A 24 bitcount DIB has no color table entries so, set the number of + * to the maximum value (256). + */ + nNumColors = MAXPALETTE; + pPal = (LOGPALETTE*)LocalAlloc(LPTR,sizeof(LOGPALETTE) + nNumColors * sizeof(PALETTEENTRY)); + if (!pPal) + return NULL; + + pPal->palNumEntries = nNumColors; + pPal->palVersion = PALVERSION; + + red = green = blue = 0; + + /* Generate 256 (= 8*8*4) RGB combinations to fill the palette + * entries. + */ + for (i = 0; i < pPal->palNumEntries; i++) + { + pPal->palPalEntry[i].peRed = red; + pPal->palPalEntry[i].peGreen = green; + pPal->palPalEntry[i].peBlue = blue; + pPal->palPalEntry[i].peFlags = (BYTE)0; + + if (!(red += 32)) + if (!(green += 32)) + blue += 64; + } + } + return pPal; +} + +/**************************************************************************** + + FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) + + PURPOSE: Processes messages + + MESSAGES: + + WM_COMMAND - application menu (About dialog box) + WM_DESTROY - destroy window + + COMMENTS: + + To process the IDM_ABOUT message, call MakeProcInstance() to get the + current instance address of the About() function. Then call Dialog + box which will create the box according to the information in your + generic.rc file and turn control over to the About() function. When + it returns, free the intance address. + +****************************************************************************/ + +LRESULT CALLBACK WndProc( + HWND hWnd, // window handle + UINT message, // type of message + WPARAM uParam, // additional information + LPARAM lParam) // additional information +{ + switch (message) { + + case WM_CREATE: + { + ShowCursor(FALSE); + SetTimer(hWnd, 1, HOLD_TIME, NULL); + break; + } + + case WM_PAINT: + { + PAINTSTRUCT PS; + HDC hDC; + HPALETTE hPalTmp; + + hDC = BeginPaint( hWnd, &PS ); + + hPalTmp = SelectPalette(hDC, hPal, FALSE); + if (hPalOld == NULL) + hPalOld = hPalTmp; + RealizePalette(hDC); + + StretchDIBits( + hDC, + 0, + 0, +#if 0 + lpBitmap->biWidth, // stretch to fit + lpBitmap->biHeight, // stretch to fit +#endif + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + 0, + 0, + lpBitmap->biWidth, // stretch to fit + lpBitmap->biHeight, // stretch to fit + mpBits, + (CONST BITMAPINFO *)lpBitmap, + DIB_RGB_COLORS, + SRCCOPY + ); + + EndPaint( hWnd, &PS ); + } + break; + + case WM_TIMER: + { + KillTimer(hWnd, 1); + HDC hDC = GetDC(hWnd); + + DWORD lastTime = timeGetTime(); + + if (pSoundBuffer != NULL) + sndPlaySound(pSoundBuffer, SND_MEMORY | SND_ASYNC); + + do { +#if 1 + pPal = CreateBIPalette(lpBitmap, nPasses); + hPal = CreatePalette(pPal); +#else + FadePalette(pPal, lpBitmap, nPasses); + AnimatePalette(hPal, 1, pPal->palNumEntries, pPal->palPalEntry); +#endif + DeleteObject(SelectPalette(hDC, hPal, FALSE)); + RealizePalette(hDC); + + nPasses += fadeDirection; + if (nPasses == NUMFADESTEPS) + { + fadeDirection = -1; + } + + while (timeGetTime() - lastTime < INTERVAL_TIME) + { + //Sleep(0); + } + lastTime = timeGetTime(); + + } while(nPasses > 0); + + ReleaseDC(hWnd, hDC); + WinExec(acModuleName, SW_SHOW); + } + + case WM_DESTROY: // message: window being destroyed + { +#if 1 + HDC hDC = GetDC(hWnd); + PatBlt(hDC, 0,0, 640, 480,BLACKNESS); + SelectPalette(hDC, hPalOld, FALSE); + RealizePalette(hDC); + ReleaseDC(hWnd, hDC); +#endif + + sndPlaySound(NULL, SND_SYNC); + ShowCursor(TRUE); + KillTimer(hWnd, 1); + PostQuitMessage(0); + break; + } + + default: // Passes it on if unproccessed + return (DefWindowProc(hWnd, message, uParam, lParam)); + } + return (0); +} + +#if 0 +void dbgprintf(char *fmt,...) +{ + static HANDLE dbg = NULL; + char out [ 256 ]; + DWORD len; + va_list vlist; + + if (dbg == NULL) + { + AllocConsole(); + dbg = GetStdHandle(STD_OUTPUT_HANDLE); + if (dbg == NULL) + return; + } + + va_start(vlist, fmt); + wvsprintf(out, fmt, vlist); + WriteConsole(dbg, out, strlen(out), &len, NULL); +} +#endif +/**************************************************************************** + + FUNCTION: InitInstance(HINSTANCE, int) + + PURPOSE: Saves instance handle and creates main window + + COMMENTS: + + This function is called at initialization time for every instance of + this application. This function performs initialization tasks that + cannot be shared by multiple instances. + + In this case, we save the instance handle in a static variable and + create and display the main program window. + +****************************************************************************/ + +BOOL InitInstance( + HINSTANCE hInstance, + int nCmdShow) +{ + WNDCLASS wc; + + + // Fill in window class structure with parameters that describe the + // main window. + + wc.style = CS_OWNDC; // Class style(s). + wc.lpfnWndProc = (WNDPROC)WndProc; // Window Procedure + wc.cbClsExtra = 0; // No per-class extra data. + wc.cbWndExtra = 0; // No per-window extra data. + wc.hInstance = hInstance; // Owner of this class + wc.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_APP)); // Icon name from .RC + wc.hCursor = LoadCursor(NULL, IDC_ARROW);// Cursor + wc.hbrBackground = NULL; // Default color + wc.lpszMenuName = NULL; + wc.lpszClassName = szAppName; // Name to register as + + // Register the window class + if (!RegisterClass(&wc)) + return(FALSE); + + // Create a main window for this application instance. + + ghMainWnd = CreateWindow( + szAppName, // See RegisterClass() call. + NULL, // Text for window title bar. + WS_POPUP, // Window style. + 0, + 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + NULL, // Overlapped windows have no parent. + NULL, // Use the window class menu. + hInstance, // This instance owns this window. + NULL // We don't use any data in our WM_CREATE + ); + + // If window could not be created, return "failure" + if (!ghMainWnd) + return(FALSE); + + // Make the window visible; update its client area; and return "success" + ShowWindow(ghMainWnd, nCmdShow); // Show the window + UpdateWindow(ghMainWnd); // Sends WM_PAINT message + + return (TRUE); // We succeeded... +} + +/**************************************************************************** + + FUNCTION: ShutDownApp() + + PURPOSE: un-initialize the app as needed + + COMMENTS: + +****************************************************************************/ +void ShutDownApp() +{ +} + +/**************************************************************************** + + FUNCTION: WinMain(HINSTANCE, HINSTANCE, LPSTR, int) + + PURPOSE: calls initialization function, processes message loop + + COMMENTS: + + Windows recognizes this function by name as the initial entry point + for the program. This function calls the application initialization + routine, if no other instance of the program is running, and always + calls the instance initialization routine. It then executes a message + retrieval and dispatch loop that is the top-level control structure + for the remainder of execution. The loop is terminated when a WM_QUIT + message is received, at which time this function exits the application + instance by returning the value passed by PostQuitMessage(). + + If this function must abort before entering the message loop, it + returns the conventional value NULL. + +****************************************************************************/ + +int CALLBACK WinMain( + HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + int result = NULL; + int nNameLength; + + // only allow 1 instance + if (hPrevInstance) + return NULL; + + ghInst = hInstance; + + nNameLength = GetModuleFileName(ghInst, acModuleName, sizeof(acModuleName)); + lstrcpy(&acModuleName[nNameLength-3], "OVL"); + + + HGLOBAL hgrBitmap = LoadResource( ghInst, FindResource(ghInst, MAKEINTRESOURCE(IDB_SPLASH), RT_BITMAP)); + + lpBitmap = (LPBITMAPINFOHEADER)LockResource( hgrBitmap ); + + mpBits = (LPBYTE)lpBitmap + (WORD)lpBitmap->biSize + PaletteSize(lpBitmap); + pPal = CreateBIPalette(lpBitmap, NUMFADESTEPS); + hPal = CreatePalette(pPal); + fadeDirection = -1; + nPasses = NUMFADESTEPS; + + + HGLOBAL hgrSound = LoadResource( ghInst, FindResource(ghInst, MAKEINTRESOURCE(IDS_SPLASH), "WAVE")); + pSoundBuffer = (LPSTR)LockResource( hgrSound ); + + + if (InitInstance(hInstance, nCmdShow)) + { + /* Acquire and dispatch messages until a WM_QUIT message is + received. + */ + while (GetMessage(&msg, // message structure + NULL, // handle of window receiving the message + 0, // lowest message to examine + 0)) // highest message to examine + { + TranslateMessage(&msg);// Translates virtual key codes + DispatchMessage(&msg); // Dispatches message to window + } + + ShutDownApp(); // call de-init code + result = msg.wParam; + } + + return (result); +} diff --git a/sdk/samples/iklowns/splash.ico b/sdk/samples/iklowns/splash.ico new file mode 100644 index 0000000..76f7b5d Binary files /dev/null and b/sdk/samples/iklowns/splash.ico differ diff --git a/sdk/samples/iklowns/splash.mak b/sdk/samples/iklowns/splash.mak new file mode 100644 index 0000000..3fd69e5 --- /dev/null +++ b/sdk/samples/iklowns/splash.mak @@ -0,0 +1,189 @@ +# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=Win32 Debug +!MESSAGE No configuration specified. Defaulting to Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "SPLASH.MAK" CFG="Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "Win32 Debug" +MTL=MkTypLib.exe +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "retail" +# PROP BASE Intermediate_Dir "retail" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "retail" +# PROP Intermediate_Dir "retail" +OUTDIR=.\retail +INTDIR=.\retail + +ALL : $(OUTDIR)/iklowns.exe $(OUTDIR)/iklowns.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c +CPP_PROJ=/nologo /W3 /GX /YX /O2 /D "WIN32" /D "STRICT" /D "NDEBUG" /D "_WINDOWS"\ + /FR$(INTDIR)/ /Fp$(OUTDIR)/"SPLASH.pch" /Fo$(INTDIR)/ /c +CPP_OBJS=.\retail/ +# ADD BASE RSC /d "NDEBUG" +# ADD RSC /d "NDEBUG" +RSC_PROJ= /l 0x409 /fo$(INTDIR)/"SPLASH.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"iklowns.bsc" +BSC32_SBRS= \ + $(INTDIR)/SPLASH.SBR + +$(OUTDIR)/iklowns.bsc : $(OUTDIR) $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:windows,4.0 /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib winmm.lib /NOLOGO /SUBSYSTEM:windows,4.0 /MACHINE:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib uuid.lib winmm.lib /NOLOGO /SUBSYSTEM:windows,4.0\ + /INCREMENTAL:no /PDB:$(OUTDIR)/"SPLASH.pdb" /MACHINE:I386\ + /OUT:$(OUTDIR)/"iklowns.exe" +DEF_FILE= +LINK32_OBJS= \ + $(INTDIR)/SPLASH.OBJ \ + $(INTDIR)/SPLASH.res + +$(OUTDIR)/iklowns.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + copy $(OUTDIR)\iklowns.exe iklowns.exe + +!ELSEIF "$(CFG)" == "Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "debug" +# PROP BASE Intermediate_Dir "debug" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "debug" +# PROP Intermediate_Dir "debug" +OUTDIR=.\debug +INTDIR=.\debug + +ALL : $(OUTDIR)/iklowns.exe $(OUTDIR)/iklowns.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE CPP /nologo /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c +CPP_PROJ=/nologo /W3 /GX /Zi /YX /Od /D "WIN32" /D "STRICT" /D "_DEBUG" /D "_WINDOWS"\ + /FR$(INTDIR)/ /Fp$(OUTDIR)/"SPLASH.pch" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"SPLASH.pdb"\ + /c +CPP_OBJS=.\debug/ +# ADD BASE RSC /d "_DEBUG" +# ADD RSC /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo$(INTDIR)/"SPLASH.res" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"iklowns.bsc" +BSC32_SBRS= \ + $(INTDIR)/SPLASH.SBR + +$(OUTDIR)/iklowns.bsc : $(OUTDIR) $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:windows,4.0 /DEBUG /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib winmm.lib /NOLOGO /SUBSYSTEM:windows,4.0 /DEBUG /MACHINE:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib uuid.lib winmm.lib /NOLOGO /SUBSYSTEM:windows,4.0\ + /INCREMENTAL:yes /PDB:$(OUTDIR)/"SPLASH.pdb" /DEBUG /MACHINE:I386\ + /OUT:$(OUTDIR)/"iklowns.exe" +DEF_FILE= +LINK32_OBJS= \ + $(INTDIR)/SPLASH.OBJ \ + $(INTDIR)/SPLASH.res + +$(OUTDIR)/iklowns.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + copy $(OUTDIR)\iklowns.exe iklowns.exe + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Group "Source Files" + +################################################################################ +# Begin Source File + +SOURCE=.\SPLASH.CPP + +$(INTDIR)/SPLASH.OBJ : $(SOURCE) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\SPLASH.RC +DEP_SPLAS=\ + .\data\SPLASH.BMP \ + .\SPLASH.WAV + +$(INTDIR)/SPLASH.res : $(SOURCE) $(DEP_SPLAS) $(INTDIR) +# which $(RSC) + $(RSC) $(RSC_PROJ) $(SOURCE) + +# End Source File +# End Group +# End Project +################################################################################ diff --git a/sdk/samples/iklowns/splash.rc b/sdk/samples/iklowns/splash.rc new file mode 100644 index 0000000..362b2b2 --- /dev/null +++ b/sdk/samples/iklowns/splash.rc @@ -0,0 +1,68 @@ +//Microsoft Visual C++ generated resource script. +// +#include "splashrc.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +//#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_SPLASH BITMAP DISCARDABLE "DATA\\SPLASH.BMP" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "splashrc.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +///////////////////////////////////////////////////////////////////////////// +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +IDI_APP ICON DISCARDABLE "splash.ico" + +IDS_SPLASH WAVE DISCARDABLE "splash.wav" + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sdk/samples/iklowns/splash.wav b/sdk/samples/iklowns/splash.wav new file mode 100644 index 0000000..541e43a Binary files /dev/null and b/sdk/samples/iklowns/splash.wav differ diff --git a/sdk/samples/iklowns/splashrc.h b/sdk/samples/iklowns/splashrc.h new file mode 100644 index 0000000..a95c7a4 --- /dev/null +++ b/sdk/samples/iklowns/splashrc.h @@ -0,0 +1,46 @@ +/*===========================================================================*\ +| +| File: splashrc.h +| +| Description: +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + we do not recomend you base your game on IKlowns, start with one of + the other simpler sample apps in the GDK + + **************************************************************************/ + +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by splash.rc +// +#define IDB_SPLASH 101 +#define IDI_APP 102 +#define IDS_SPLASH 103 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 104 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sdk/samples/iklowns/strrec.cpp b/sdk/samples/iklowns/strrec.cpp new file mode 100644 index 0000000..32e1775 --- /dev/null +++ b/sdk/samples/iklowns/strrec.cpp @@ -0,0 +1,86 @@ +/*===========================================================================*\ +| +| File: strrec.cpp +| +| Description: +| string record parser class implementation +| +|----------------------------------------------------------------------------- +| +| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. +| +| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation +| +\*===========================================================================*/ + +#include <windows.h> +#include <string.h> +#include "strrec.h" + +/*---------------------------------------------------------------------------*\ +| +| Class CStringRecord +| +| DESCRIPTION: +| parses a delimited string into fields +| +| +\*---------------------------------------------------------------------------*/ +CStringRecord::CStringRecord( + char* pString, + char* pDelims + ) : mpFields( NULL ), + mNumFields( 0 ) +{ + char* tempFields[MAX_FIELDS]; + + char* pWork = new char[lstrlen(pString)+1]; + lstrcpy(pWork, pString); + + char* pLook = strtok( pWork, pDelims ); + + while (pLook && mNumFields < MAX_FIELDS) + { + tempFields[mNumFields] = new char[lstrlen(pLook)+1]; + lstrcpy(tempFields[mNumFields], pLook); + + pLook = strtok( NULL, pDelims); + ++mNumFields; + } + + // now save the fields array + mpFields = new char*[mNumFields]; + + for (int i=0; i<mNumFields; i++) + { + mpFields[i] = new char[lstrlen(tempFields[i])+1]; + lstrcpy(mpFields[i], tempFields[i]); + } +} + +CStringRecord::~CStringRecord() +{ + if (mpFields) + { + for (; mNumFields > 0; mNumFields--) + { + delete[] mpFields[mNumFields-1]; + } + + delete[] mpFields; + } +} + +char* +CStringRecord::operator[](int field) +{ + char* pResult = NULL; + + if (field < mNumFields) + { + pResult = mpFields[field]; + } + + return pResult; +} + diff --git a/sdk/samples/makeall.bat b/sdk/samples/makeall.bat new file mode 100755 index 0000000..35cd30a --- /dev/null +++ b/sdk/samples/makeall.bat @@ -0,0 +1,155 @@ +@echo * +@echo *** Batch File to build examples with Visual C++ +@echo * + +cd fdfilter +nmake %1 retail + +cd ..\scrawl +nmake %1 retail + +cd ..\rockem +nmake %1 retail + +cd ..\donuts +nmake %1 retail + +cd ..\shadow +nmake %1 retail + +cd ..\ddex1 +nmake %1 retail + +cd ..\ddex2 +nmake %1 retail + +cd ..\ddex3 +nmake %1 retail + +cd ..\ddex4 +nmake %1 retail + +cd ..\ddex5 +nmake %1 retail + +cd ..\donut +nmake %1 retail + +cd ..\fastfile +nmake %1 retail + +cd ..\palette +nmake %1 retail + +cd ..\dsshow +nmake %1 retail + +cd ..\dsshow3d +nmake %1 retail + +cd ..\dsstream +nmake %1 retail + +cd ..\mid2strm +nmake %1 retail + +cd ..\mstream +nmake %1 retail + +cd ..\dplaunch +nmake %1 retail + +cd ..\duel +nmake %1 retail + +cd ..\wormhole +nmake %1 retail + +cd ..\stretch +nmake %1 retail + +cd ..\memtime +nmake %1 retail + +cd ..\dxview +nmake %1 retail + +cd ..\ds3dview +nmake %1 retail + +cd ..\flipcube +nmake %1 retail + +cd ..\foxbear +nmake %1 retail + +cd ..\flip2d +nmake %1 retail + +cd ..\iklowns +nmake %1 retail + +cd ..\setup +nmake %1 retail + +cd ..\egg +nmake %1 retail + +cd ..\faces +nmake %1 retail + +cd ..\fly +nmake %1 retail + +cd ..\globe +nmake %1 retail + +cd ..\hier1 +nmake %1 retail + +cd ..\hier2 +nmake %1 retail + +cd ..\oct1 +nmake %1 retail + +cd ..\oct2 +nmake %1 retail + +cd ..\quat +nmake %1 retail + +cd ..\sphere +nmake %1 retail + +cd ..\tex1 +nmake %1 retail + +cd ..\tex3 +nmake %1 retail + +cd ..\tex4 +nmake %1 retail + +cd ..\tex5 +nmake %1 retail + +cd ..\trans +nmake %1 retail + +cd ..\triangle +nmake %1 retail + +cd ..\tunnel +nmake %1 retail + +cd ..\twist +nmake %1 retail + +cd ..\viewer +nmake %1 retail + +cd ..\uvis +nmake %1 retail + +cd .. diff --git a/sdk/samples/makeallw.bat b/sdk/samples/makeallw.bat new file mode 100755 index 0000000..09fa3e7 --- /dev/null +++ b/sdk/samples/makeallw.bat @@ -0,0 +1,18 @@ +@echo * +@echo ***Batch File to build examples with WATCOM C/C++ +@echo * +cd ddex1 +wmake /f makefile.wat debug retail +cd ..\ddex2 +wmake /f makefile.wat debug retail +cd ..\ddex3 +wmake /f makefile.wat debug retail +cd ..\ddex4 +wmake /f makefile.wat debug retail +cd ..\ddex5 +wmake /f makefile.wat debug retail +cd ..\donut +wmake /f makefile.wat debug retail +cd ..\stretch +wmake /f makefile.wat debug retail +cd .. diff --git a/sdk/samples/memtime/makefile b/sdk/samples/memtime/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/memtime/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/memtime/memtime.cpp b/sdk/samples/memtime/memtime.cpp new file mode 100644 index 0000000..ade6a47 --- /dev/null +++ b/sdk/samples/memtime/memtime.cpp @@ -0,0 +1,955 @@ +//--------------------------------------------------------------------------; +// +// File: memtime.cpp +// +// Description: +// This code times various things about system memory and video +// memory. It is intended to show the advantages and disadvantages +// of different drawing methoids. +// Please refer to the documented for a more detailed discriptions of +// what is going on. +// +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY +// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR +// PURPOSE. +// +//--------------------------------------------------------------------------- +// +// Copyright (c) 1994 - 1996 Microsoft Corporation. All Rights Reserved. +// +//--------------------------------------------------------------------------- + +#include<windows.h> +#include<windowsx.h> +#include<commdlg.h> +#include <ddraw.h> + +#include"memtime.h" + +/*----------------------------------------------------------------------------*\ +| | +| g l o b a l v a r i a b l e s | +| | +\*----------------------------------------------------------------------------*/ +static char szAppName[]="Direct Draw video/system memory timing tests"; + +static HINSTANCE hInstApp; +static HWND hwndApp; +static HACCEL hAccelApp; +static HPALETTE hpalApp; + +static DWORD ScreenHeight, ScreenWidth; +static PCHAR pSource, pDest; + +static LPDIRECTDRAW pDirectDrawObj; +static LPDIRECTDRAWSURFACE pOnScreenBuf; +static LPDIRECTDRAWSURFACE pOffScreenBuf; +static LPDIRECTDRAWSURFACE pSysMemBuf; + +static ULONG ModeXFrameCount; +static ULONG ModeYFrameCount; +static ULONG StretchFrameCount; + +/*---------------------------------------------------------------------------- + +Timers + +*/ + +extern "C" MemFunc DwordMemCopy_Pitch; +extern "C" MemFunc ByteMemCopy_Pitch; + +extern "C" MemFunc DwordMemFill_Pitch; +extern "C" MemFunc ByteMemFill_Pitch; + +extern "C" MemFunc VertMemSto_Pitch; + + +TIMING_RESULT SystemTests[]= +{ + {0, DwordMemCopy_Pitch, "System to System dword copy"}, + {0, ByteMemCopy_Pitch, "System to System byte copy"}, + + {0, DwordMemFill_Pitch, "System dword Fill"}, + {0, ByteMemFill_Pitch, "System byte Fill"}, + + {0, VertMemSto_Pitch, "System vertical byte fill"} +}; + + +TIMING_RESULT VideoTests[]= +{ + {0, DwordMemCopy_Pitch, "System to Video dword Copy"}, + {0, ByteMemCopy_Pitch, "System to Video byte Copy"}, + + {0, DwordMemFill_Pitch, "Video dword Fill"}, + {0, ByteMemFill_Pitch, "Video byte Fill"}, + + {0, VertMemSto_Pitch, "Video vertical byte fill"} +}; + + + + +/*---------------------------------------------------------------------------- + +defines + +*/ + +#define NUMBER_OF(aa) (sizeof(aa)/sizeof((aa)[0])) + + +/*----------------------------------------------------------------------------*\ +| +| f u n c t i o n d e f i n i t i o n s +| +\*----------------------------------------------------------------------------*/ + +LRESULT CALLBACK AppWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam); +int ErrMsg (LPSTR sz,...); +LONG AppCommand (HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam); +void PrintTimingResults( void ); + +void AppExit(void); +BOOL AppIdle(void); +BOOL DirectDrawInit(); +VOID DoSystemTest( PTIMING_RESULT pTimeObject ); +VOID DoVideoTests( PTIMING_RESULT pTimeObject ); +ULONG GetFPS( int width, int height ); +ULONG GetStretchFPS( int width, int height ); + +/*----------------------------------------------------------------------------*\ +| AppAbout( hDlg, uiMessage, wParam, lParam ) +| +| Description: +| This function handles messages belonging to the "About" dialog box. +| The only message that it looks for is WM_COMMAND, indicating the use +| has pressed the "OK" button. When this happens, it takes down +| the dialog box. +| +| Arguments: +| hDlg window handle of about dialog window +| uiMessage message number +| wParam message-dependent +| lParam message-dependent +| +| Returns: +| TRUE if message has been processed, else FALSE +| +\*----------------------------------------------------------------------------*/ +BOOL CALLBACK +AppAbout( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) +{ + switch (msg) { + case WM_COMMAND: + if (LOWORD(wParam) == IDOK) { + EndDialog(hwnd,TRUE); + } + break; + case WM_INITDIALOG: + return TRUE; + } + return FALSE; +} + +/*----------------------------------------------------------------------------*\ +| AppInit( hInst, hPrev) +| +| Description: +| This is called when the application is first loaded into +| memory. It performs all initialization that doesn't need to be done +| once per instance. +| +| Arguments: +| hInstance instance handle of current instance +| hPrev instance handle of previous instance +| +| Returns: +| TRUE if successful, FALSE if not +| +\*----------------------------------------------------------------------------*/ +BOOL +AppInit(HINSTANCE hInst, HINSTANCE hPrev, int sw, LPSTR szCmdLine ) +{ + WNDCLASS cls; + HRESULT ddrval; + DDSURFACEDESC ddsd; + BOOL returnValue = FALSE; + + /* Save instance handle for DialogBoxs */ + hInstApp = hInst; + + hAccelApp = LoadAccelerators(hInst, "AppAccel"); + + if (!hPrev) { + /* + * Register a class for the main application window + */ + cls.hCursor = LoadCursor(NULL,IDC_ARROW); + cls.hIcon = LoadIcon(hInst,"AppIcon"); + cls.lpszMenuName = "AppMenu"; + cls.lpszClassName = szAppName; + cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); + cls.hInstance = hInst; + cls.style = CS_BYTEALIGNCLIENT | CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS; + cls.lpfnWndProc = (WNDPROC)AppWndProc; + cls.cbWndExtra = 0; + cls.cbClsExtra = 0; + + if (RegisterClass(&cls)) { + hwndApp = CreateWindow ( + szAppName, // Class name + szAppName, // Caption + WS_OVERLAPPEDWINDOW, // Style bits + 50, 50, // Position + 400+20,400+75, // Size + (HWND)NULL, // Parent window (no parent) + (HMENU)NULL, // use class menu + hInst, // handle to window instance + (LPSTR)NULL); // no params to pass on + ShowWindow(hwndApp,sw); + + // init our direct draw stuff + ddrval = DirectDrawCreate( NULL, &pDirectDrawObj, NULL ); + if( DD_OK == ddrval) { + // clear out the surface desctiptions + ZeroMemory( &ddsd, sizeof( ddsd ) ); + // set the size + ddsd.dwSize = sizeof( ddsd ); + + // figure out what display mode we are in now + ddrval = pDirectDrawObj->GetDisplayMode( &ddsd ); + if( DD_OK == ddrval ) { + // make sure we're in a 8-bit mode + if( ddsd.ddpfPixelFormat.dwRGBBitCount >= 8) { + ScreenHeight = ddsd.dwHeight; + ScreenWidth = ddsd.dwWidth; + + // if we are biger than 800x600 it's to much memory + // to move around. Clip it + if(ScreenHeight > 600) ScreenHeight = 600; + if(ScreenWidth > 800) ScreenWidth = 800; + + if( (ScreenWidth < 800) || (ScreenHeight < 600) ) { + ErrMsg("Resolutions smaller than 800x600 may yeild different numbers because of L2 cache effects"); + } + + // allocate some memory we are going to play with + pSource = (PCHAR)GlobalAllocPtr(GHND, ScreenHeight * ScreenWidth); + pDest = (PCHAR)GlobalAllocPtr(GHND, ScreenHeight * ScreenWidth); + + // make sure the memory worked and it's dword alligned. + // (we're in Win32, when is not going to be dword alligned?) + if( pSource && pDest && !((DWORD)pSource & 0x3) && !((DWORD)pDest & 0x3)) { + returnValue = TRUE; + } else { + ErrMsg("Memory allocation failure"); + } + } else { + ErrMsg("You must be in a 8-bit (or better) color mode to run this app"); + } + } else { + ErrMsg("DirectDraw failure getting the display mode"); + } + } else { + ErrMsg("DirectDraw create failure"); + } + } else { + ErrMsg("Register Class failure"); + } + } + return returnValue; +} + +/*----------------------------------------------------------------------------*\ +| BandwidthTestsSetup +| +| Description: +| Setup the surfaces for the bandwidth tests +| +| Returns: +| TRUE if successful, FALSE if not +\*----------------------------------------------------------------------------*/ +BOOL +BandwidthTestsSetup( VOID ) +{ + DDSURFACEDESC ddsd; + BOOL returnValue = FALSE; + HRESULT ddrval; + + if( pOnScreenBuf ) pOnScreenBuf->Release(); + if( pOffScreenBuf ) pOffScreenBuf->Release(); + if( pSysMemBuf ) pSysMemBuf->Release(); + + // Tell the world we love it and want to share + ddrval = pDirectDrawObj->SetCooperativeLevel( hwndApp, DDSCL_NORMAL ); + if( DD_OK == ddrval ) { + // clear out out stuff + ZeroMemory( &ddsd, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + + ddsd.dwHeight = ScreenHeight; + ddsd.dwWidth = ScreenWidth; + // create our off screen video memory. + ddrval = pDirectDrawObj->CreateSurface( &ddsd, &pOffScreenBuf, NULL ); + if( DD_OK == ddrval ) { + // yay! + returnValue = TRUE; + } else { + ErrMsg("Failure creating video surface"); + } + } else { + ErrMsg("Failure setting Co-op mode"); + } + return returnValue; +} +/*----------------------------------------------------------------------------*\ +| AppExit() +| +| Description: +| app is just about to exit, cleanup +| +\*----------------------------------------------------------------------------*/ +void AppExit() +{ + if( pSource ) GlobalFreePtr(pSource); + if( pDest ) GlobalFreePtr(pDest); + if( pOffScreenBuf ) pOffScreenBuf->Release(); + if( pOnScreenBuf ) pOnScreenBuf->Release(); + if( pSysMemBuf ) pSysMemBuf->Release(); + if( pDirectDrawObj ) pDirectDrawObj->Release(); + +} + +/*----------------------------------------------------------------------------*\ +| WinMain( hInst, hPrev, lpszCmdLine, cmdShow ) | +| +| Description: +| The main procedure for the App. After initializing, it just goes +| into a message-processing loop until it gets a WM_QUIT message +| (meaning the app was closed). | +| +| Arguments: +| hInst instance handle of this instance of the app +| hPrev instance handle of previous instance, NULL if first +| szCmdLine ->null-terminated command line +| cmdShow specifies how the window is initially displayed +| +| Returns: +| The exit code as specified in the WM_QUIT message. +| +\*----------------------------------------------------------------------------*/ +int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) +{ + MSG msg; + + /* Call initialization procedure */ + if (!AppInit(hInst,hPrev,sw,szCmdLine)) + return FALSE; + + /* + * Polling messages from event queue + */ + for (;;) { + if(!GetMessage(&msg, NULL, 0, 0)) { + return msg.wParam; + } + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return msg.wParam; +} + + +/*----------------------------------------------------------------------------*\ +| AppPaint(hwnd, hdc) +| +| Description: +| The paint function. Right now this does nothing. +| +| Arguments: +| hwnd window painting into +| hdc display context to paint to +| +| Returns: +| nothing +| +\*----------------------------------------------------------------------------*/ +AppPaint (HWND hwnd, HDC hdc) +{ + TEXTMETRIC tm; + int x,y; + RECT rc; + +#define PRINT_STUFF(sz) (TextOut(hdc, x, y, sz, lstrlen(sz)), y += tm.tmHeight+1) + + SelectObject(hdc, GetStockObject(ANSI_FIXED_FONT)); + GetTextMetrics(hdc, &tm); + + GetClientRect(hwnd,&rc); + + SetTextColor(hdc,GetSysColor(COLOR_WINDOWTEXT)); + SetBkColor(hdc,GetSysColor(COLOR_WINDOW)); + + // setup start pos + x=4; + y=4; + + PRINT_STUFF("Select 'Time All' to run tests"); + y += (tm.tmHeight+1) * 2; + PRINT_STUFF("The screen will go blank during some tests"); + + return TRUE; +} + +/*----------------------------------------------------------------------------*\ +| AppWndProc( hwnd, uiMessage, wParam, lParam ) +| +| Description: +| The window proc for the app's main (tiled) window. +| This processes all of the parent window's messages. +| +\*----------------------------------------------------------------------------*/ +LRESULT CALLBACK AppWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +{ + PAINTSTRUCT ps; + HDC hdc; + + switch (msg) { + case WM_COMMAND: + return AppCommand(hwnd,msg,wParam,lParam); + break; + + case WM_PAINT: + hdc = BeginPaint(hwnd,&ps); + AppPaint( hwnd, hdc ); + break; + + case WM_DESTROY: + hAccelApp = NULL; + PostQuitMessage(0); + break; + + } + return DefWindowProc(hwnd,msg,wParam,lParam); +} + +/*----------------------------------------------------------------------------*\ +| AppCommand(hwnd, msg, wParam, lParam ) +| +| Description: +| handles WM_COMMAND messages for the main window (hwndApp) +| of the parent window's messages. +| +\*----------------------------------------------------------------------------*/ +LONG AppCommand (HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +{ + char achFileName[128] = ""; + + switch(wParam) { + case MENU_ABOUT: + DialogBox(hInstApp,"AppAbout",hwnd,(DLGPROC)AppAbout); + break; + + + // do all the timing tests + case MENU_TIMEALL: + { + HCURSOR Arror = SetCursor(LoadCursor(0,IDC_WAIT)); + + ShowCursor(FALSE); //take care of animated Plus! cursors + + DWORD PriorityClass = GetPriorityClass(GetCurrentProcess()); + int ThreadPriority = GetThreadPriority(GetCurrentThread()); + + if( NUMBER_OF(SystemTests) != NUMBER_OF(VideoTests)) + { + ErrMsg("test number mismatch"); + break; + } + + // Jack this thread up to realtime. + // NOTE: This is very bad from for the real world. The rule is + // "The Higher your ptiority, the less work your thread should do". + // We are doing a lot of work. But this is only a test app, so who cares. + SetPriorityClass(GetCurrentProcess(),REALTIME_PRIORITY_CLASS); + SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL); + + // setup the surfaces for the bandwidth tests + BandwidthTestsSetup(); + // Walk through the list of timers, and call them all + + for(int Counter = 0;Counter < NUMBER_OF(SystemTests) ;Counter++) { + + SetWindowText(hwndApp,SystemTests[Counter].pDescription); + + DoSystemTest( &SystemTests[Counter] ); + + SetWindowText(hwndApp,VideoTests[Counter].pDescription); + + DoVideoTests( &VideoTests[Counter] ); + + } + + // do 320x240 frame rate tests + ModeXFrameCount = GetFPS(320,240); + // do 640x480 frame rate tests + ModeYFrameCount = GetFPS(640,480); + // do 320x240 stretch to 640x480 frame rate tests + StretchFrameCount = GetStretchFPS(640,480); + + // return ourselves to normal + SetPriorityClass(GetCurrentProcess(),PriorityClass); + SetThreadPriority(GetCurrentThread(),ThreadPriority); + + SetCursor(Arror); + SetWindowText(hwndApp,szAppName); + + ShowCursor(TRUE); + PrintTimingResults(); + } + break; + + case MENU_EXIT: + PostMessage(hwnd,WM_CLOSE,0,0L); + break; + } + return 0L; +} + +/*----------------------------------------------------------------------------*\ +| ErrMsg - Opens a Message box with a error message in it. The user can +| select the OK button to continue +\*----------------------------------------------------------------------------*/ +int ErrMsg (LPSTR sz,...) +{ + char ach[128]; + + wvsprintf (ach,sz,(LPSTR)(&sz+1)); /* Format the string */ + MessageBox(hwndApp,ach,szAppName,MB_OK|MB_ICONEXCLAMATION|MB_TASKMODAL); + return FALSE; +} + + + + +/*----------------------------------------------------------------------------*\ +| PrintTimingResults( void ) +| +| Description: +| Print the results of the timting tests +| +\*----------------------------------------------------------------------------*/ +#include <stdio.h> + +VOID +PrintTimingResults( void ) +{ + double result; + LARGE_INTEGER perfFreq; + char OutputBuffer[2048]; + char TempOutputBuffer[2048]; +#define PRINT_DOUBLE(d) {sprintf(TempOutputBuffer,"%12.8f",d);strcat(OutputBuffer,TempOutputBuffer);} +#define PRINT_STRING(s) {sprintf(TempOutputBuffer,"%s",s);strcat(OutputBuffer,TempOutputBuffer);} + + OutputBuffer[0]=0; + TempOutputBuffer[0]=0; + + // get the frequemcy out of timer + QueryPerformanceFrequency( &perfFreq ); + + // Turn all the time resutls into MB per second + for(int Counter = 0; Counter < NUMBER_OF(SystemTests) ; Counter++) { + if(SystemTests[Counter].Time) { + result = (double)SystemTests[Counter].Iterations; + result /= (double)SystemTests[Counter].Time / (double)perfFreq.LowPart; + result /= (double)1000000.0; + PRINT_DOUBLE(result); + } else { + PRINT_STRING("N/A"); + } + PRINT_STRING(" MB/sec \t"); + PRINT_STRING(SystemTests[Counter].pDescription); + PRINT_STRING("\n"); + + if(VideoTests[Counter].Time) { + result = (double)VideoTests[Counter].Iterations; + result /= (double)VideoTests[Counter].Time / (double)perfFreq.LowPart; + result /= (double)1000000.0; + PRINT_DOUBLE(result); + } else { + PRINT_STRING("N/A"); + } + PRINT_STRING(" MB/sec \t"); + PRINT_STRING(VideoTests[Counter].pDescription); + PRINT_STRING("\n"); + + } + + if( ModeXFrameCount ) { + PRINT_DOUBLE((double)ModeXFrameCount/5.0); + } else { + PRINT_STRING("N/A"); + } + PRINT_STRING(" FPS \t\t"); + PRINT_STRING("320x240 Frame Rate"); + PRINT_STRING("\n"); + + if( ModeYFrameCount ) { + PRINT_DOUBLE((double)ModeYFrameCount/5.0); + } else { + PRINT_STRING("N/A"); + } + PRINT_STRING(" FPS \t\t"); + PRINT_STRING("640x480 Frame Rate"); + PRINT_STRING("\n"); + + if( StretchFrameCount ) { + PRINT_DOUBLE((double)StretchFrameCount/5.0); + } else { + PRINT_STRING("N/A"); + } + PRINT_STRING(" FPS \t\t"); + PRINT_STRING("320x240 stretched to 640x480"); + PRINT_STRING("\n"); + +#ifndef LOR_TESTS + // display the results + MessageBox(0, OutputBuffer ,"Timing Results",MB_OK); +#endif + +} + +VOID DoSystemTest( PTIMING_RESULT pTimeObject ) +{ + LARGE_INTEGER startTime, endTime; + + QueryPerformanceCounter( &startTime ); + + // do the memory copy + pTimeObject->Iterations = (*pTimeObject->pTimer)(pSource, pDest, ScreenHeight, ScreenWidth, ScreenWidth, 100 ); + + QueryPerformanceCounter( &endTime ); + + // if it takes more than 32bits of clock ticks + // it's not worth profiling. + pTimeObject->Time = endTime.LowPart - startTime.LowPart; +} + +VOID DoVideoTests( PTIMING_RESULT pTimeObject ) +{ + DDSURFACEDESC ddsd; + HRESULT returnValue; + LARGE_INTEGER startTime, endTime; + + ZeroMemory( &ddsd, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + + + // lock the video memory surfce + // NOTE: We are about to do a lock for a REALLY long time. + // this is really bad form in the real world. + // + returnValue = pOffScreenBuf->Lock( NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR, NULL); + if( returnValue == DD_OK ) + { + if( ddsd.lPitch && ddsd.dwWidth && ddsd.dwHeight && ddsd.lpSurface) + { + // get the time, and do the copy + QueryPerformanceCounter( &startTime ); + + pTimeObject->Iterations = (*pTimeObject->pTimer)( pSource, ddsd.lpSurface, ddsd.dwHeight, ddsd.dwWidth, ddsd.lPitch, 100 ); + + QueryPerformanceCounter( &endTime ); + + pOffScreenBuf->Unlock( ddsd.lpSurface ); + // stor the delta time + pTimeObject->Time = endTime.LowPart - startTime.LowPart; + } + else + { + pOffScreenBuf->Unlock( ddsd.lpSurface ); + ErrMsg("Lock returned bogus Session Description stuff"); + } + } + else + ErrMsg("Can't lock surface"); + + return; +} + +BOOL +InitFullScreen( + DWORD Height, + DWORD Width + ) +{ + DDSURFACEDESC ddsd; + DDSCAPS ddscaps; + HRESULT ddrval; + ULONG returnValue = FALSE; + + // Kill our current offscreen surface. + if( pOffScreenBuf ) { + ddrval = pOffScreenBuf->Release(); + if( ddrval != DD_OK ) { + ErrMsg("Can't release offscreen buf"); + } + } + + + // Get exclusive mode + ddrval = pDirectDrawObj->SetCooperativeLevel( hwndApp, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX | DDSCL_NOWINDOWCHANGES ); + + if( ddrval == DD_OK ){ + // set the display mode to the requested mode + ddrval = pDirectDrawObj->SetDisplayMode( Height, Width, 8); + if(ddrval == DD_OK){ + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | + DDSCAPS_COMPLEX; + ddsd.dwBackBufferCount = 1; + // get the primary buffer + ddrval = pDirectDrawObj->CreateSurface( &ddsd, &pOnScreenBuf, NULL ); + + if( ddrval == DD_OK ) { + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + // the back buffer might be in system memory depending + // on the card and the mode. + ddrval = pOnScreenBuf->GetAttachedSurface(&ddscaps, &pOffScreenBuf); + + if( ddrval == DD_OK ) { + returnValue = TRUE; + } + } + } else { + ErrMsg("can't set display mode %d x %d",Width,Height); + } + } + return returnValue; +} + + +BOOL +CreateSysMemSurface( VOID ) +{ + DDSURFACEDESC ddsd; + ULONG returnValue; + + // clear out out stuff + ZeroMemory( &ddsd, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + + // build a surface in system memory + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + + ddsd.dwHeight = 240; + ddsd.dwWidth = 320; + returnValue = pDirectDrawObj->CreateSurface( &ddsd, &pSysMemBuf, NULL ); + if( DD_OK == returnValue ) { + return TRUE; + } + + return FALSE; +} + +ULONG +GetStretchFPS( int width, int height ) +{ + ULONG time; + HRESULT ddrval; + DDSURFACEDESC ddsd; + DDBLTFX ddbltfx; + ULONG FrameCount; + + // set the mode (and create the surfaces) + if( InitFullScreen( width, height ) ) { + // get the system memory surface + if( CreateSysMemSurface() ) { + + // build the ROP for the blt + ZeroMemory( &ddbltfx, sizeof(ddbltfx) ); + ddbltfx.dwSize = sizeof( ddbltfx ); + ddbltfx.dwROP = SRCCOPY; + + time = timeGetTime(); + // wait for a seconds for the mode to settle out + // (I don't need to do this.. I'm just paranoid) + while( (timeGetTime() - time) < 1000); + FrameCount = 0; + time = timeGetTime(); + + // Initialize the surface description structure + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize=sizeof(ddsd); + + ddrval = 0; + // do this for 5 seconds + while( ((timeGetTime() - time) < 5000) && (DD_OK == ddrval) ) { + // simluate rendering and off screen frame (with a copy) + ddrval = pSysMemBuf->Lock( NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL); + if (FAILED(ddrval)) + { + FrameCount=0; + break; + } + + DwordMemCopy_Pitch( pSource, ddsd.lpSurface, ddsd.dwHeight, ddsd.dwWidth, ddsd.lPitch, 1); + + ddrval = pSysMemBuf->Unlock( NULL ); + if (FAILED(ddrval)) + { + FrameCount=0; + break; + } + + // blt the system buffer into the back buffer + ddrval = pOffScreenBuf->Blt( NULL, pSysMemBuf, NULL, DDBLT_ROP, &ddbltfx); + if (FAILED(ddrval)) + { + FrameCount=0; + break; + } + + // flip the back buffer on screen + ddrval = pOnScreenBuf->Flip( NULL, DDFLIP_WAIT ); + if (FAILED(ddrval)) + { + FrameCount=0; + break; + } + + FrameCount++; + } + } + pDirectDrawObj->RestoreDisplayMode(); + if( DD_OK != ddrval ) { + ErrMsg("Test failure %X",ddrval); + } + + pOffScreenBuf->Release(); + pOffScreenBuf = NULL; + pOnScreenBuf->Release(); + pOnScreenBuf = NULL; + pSysMemBuf->Release(); + pSysMemBuf = NULL; + } + return FrameCount; +} + +ULONG GetFPS( int width, int height ) +{ + ULONG time; + DDSURFACEDESC ddsd; + HRESULT ddrval; + ULONG FrameCount; + + ZeroMemory( &ddsd, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + + // set the mode (and setup the surfaces) + if( InitFullScreen( width, height ) ) + { + time = timeGetTime(); + // wait for a seconds for the mode to settle out + // (I don't need to do this, I'm just paranoid) + while( (timeGetTime() - time) < 1000); + ddrval = DD_OK; + FrameCount = 0; + time = timeGetTime(); + while( ((timeGetTime() - time) < 5000) && (ddrval == DD_OK) ) + { + // simluate a render into the back buffer with a copy + ddrval = pOffScreenBuf->Lock( NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL); + if (FAILED(ddrval)) + { + FrameCount=0; + break; + } + // Stuff some Junk into the offscreen surface + DwordMemCopy_Pitch( pSource, ddsd.lpSurface, ddsd.dwHeight, ddsd.dwWidth, ddsd.lPitch, 1 ); + + ddrval = pOffScreenBuf->Unlock( NULL ); + if (FAILED(ddrval)) + { + FrameCount=0; + break; + } + + // flip the off screen surface on screen + ddrval = pOnScreenBuf->Flip( NULL, DDFLIP_WAIT ); + if (FAILED(ddrval)) + { + FrameCount=0; + break; + } + + FrameCount++; + } + pDirectDrawObj->RestoreDisplayMode(); + if( FAILED(ddrval) ) + ErrMsg("Test failure %X",ddrval); + pOffScreenBuf->Release(); + pOffScreenBuf = NULL; + pOnScreenBuf->Release(); + pOnScreenBuf = NULL; + } + + return FrameCount; +} + +/***************************************************************************** + * + * dprintf() is called by the DPF macro if DEBUG is defined at compile time. + * + * The messages will be send to COM1: like any debug message. To + * enable debug output, add the following to WIN.INI : + * + * [debug] + * QA=1 + * + ****************************************************************************/ + +#ifdef DEBUG + +#define MODNAME "QA" + + +#define _WINDLL +#include <stdarg.h> + +void FAR CDECL dprintf(LPSTR szFormat, ...) +{ + char ach[128]; + va_list va; + + static BOOL fDebug = -1; + + if (fDebug == -1) { + fDebug = GetProfileIntA("Debug", MODNAME, TRUE); + } + + if (!fDebug) return; + + + + lstrcpyA(ach, MODNAME ": "); + va_start(va, szFormat); + wvsprintfA(ach+lstrlenA(ach),szFormat,(LPSTR)va); + va_end(va); + lstrcatA(ach, "\r\n"); + + OutputDebugStringA(ach); +} + +#endif diff --git a/sdk/samples/memtime/memtime.def b/sdk/samples/memtime/memtime.def new file mode 100644 index 0000000..d9964cb --- /dev/null +++ b/sdk/samples/memtime/memtime.def @@ -0,0 +1,11 @@ +NAME MEMTIME + +DESCRIPTION 'MemTime Timer for DirectDraw' + +EXETYPE WINDOWS + +CODE MOVEABLE +DATA MOVEABLE MULTIPLE + +HEAPSIZE 512 +STACKSIZE 4096 diff --git a/sdk/samples/memtime/memtime.h b/sdk/samples/memtime/memtime.h new file mode 100644 index 0000000..f108406 --- /dev/null +++ b/sdk/samples/memtime/memtime.h @@ -0,0 +1,35 @@ +/* Menu Items */ +#define MENU_ABOUT 2 +#define MENU_EXIT 4 +#define MENU_OPEN 5 +#define MENU_COPY 6 +#define MENU_PASTE 7 +#define MENU_CUT 8 +#define MENU_TIMEALL 9 +#define MENU_REALTIME 10 + +#define MENU_TIME 50 + + +/**************************************************************************** +****************************************************************************/ +struct _timing_result; + +typedef DWORD MemFunc(PVOID pSource, PVOID pDest, DWORD Heigh, DWORD Width, DWORD Pitch, DWORD Count); + +typedef struct _timing_result +{ + DWORD Time; + MemFunc *pTimer; + char const *pDescription; + DWORD Iterations; +} TIMING_RESULT, *PTIMING_RESULT; + + + +#ifdef DEBUG + extern void FAR CDECL dprintf(LPSTR szFormat, ...); + #define DPF dprintf +#else + #define DPF ; / ## / +#endif diff --git a/sdk/samples/memtime/memtime.ico b/sdk/samples/memtime/memtime.ico new file mode 100644 index 0000000..492557c Binary files /dev/null and b/sdk/samples/memtime/memtime.ico differ diff --git a/sdk/samples/memtime/memtime.rc b/sdk/samples/memtime/memtime.rc new file mode 100644 index 0000000..acc71b5 --- /dev/null +++ b/sdk/samples/memtime/memtime.rc @@ -0,0 +1,34 @@ +#include "windows.h" +#include "memtime.h" + +AppIcon ICON memtime.ico + +AppAccel ACCELERATORS PRELOAD +BEGIN + VK_DELETE, MENU_CUT, VIRTKEY, CONTROL + VK_INSERT, MENU_COPY, VIRTKEY, CONTROL + VK_INSERT, MENU_PASTE, VIRTKEY + "^c", MENU_COPY + "^v", MENU_PASTE + "^x", MENU_CUT +END + +AppAbout DIALOG 22, 17, 144, 75 +STYLE WS_POPUP | WS_DLGFRAME +BEGIN + CTEXT "DirectDraw Memory Bandwidth Tests" -1, 37, 5, 60, 8 + CTEXT "Version 2.00" -1, 38, 34, 64, 8 + CTEXT "Copyright ) 1996, Microsoft Corp." -1, 5, 47,132, 9 + ICON "AppIcon" -1, 9, 23, 0, 0 + DEFPUSHBUTTON "Ok" IDOK, 53, 59, 32, 14, WS_GROUP +END + +AppMenu menu +begin + POPUP "&File" + begin + MENUITEM "&About..." , MENU_ABOUT + MENUITEM "E&xit" , MENU_EXIT + end + MENUITEM "Time &All", MENU_TIMEALL +end diff --git a/sdk/samples/memtime/msvc.mk b/sdk/samples/memtime/msvc.mk new file mode 100644 index 0000000..61474ba --- /dev/null +++ b/sdk/samples/memtime/msvc.mk @@ -0,0 +1,42 @@ +NAME = memtime +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = $(NAME).obj ..\timing.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/memtime/readme.txt b/sdk/samples/memtime/readme.txt new file mode 100644 index 0000000..59bc82f --- /dev/null +++ b/sdk/samples/memtime/readme.txt @@ -0,0 +1,11 @@ +MEMTIME + +Memory bandwidth tests. Times various operations on system and video +memory. Memtime is intended to show the advantages and disadvantages of +different drawing methods. + +BUILDING WITH MICROSOFT VISUAL C++ 4.0 AND HIGHER + +From the File/Open Workspace menu, open the makefile file and reply +'Yes' when asked if you wish to create a wrapper project. + diff --git a/sdk/samples/memtime/timing.asm b/sdk/samples/memtime/timing.asm new file mode 100644 index 0000000..59c9fe0 --- /dev/null +++ b/sdk/samples/memtime/timing.asm @@ -0,0 +1,268 @@ +;;--------------------------------------------------------------------------; +;; +;; File: timing.asm +;; +;; Description: +;; This asm file is various methods of memory copies +;; that copy the same data over and over for timing +;; tests. They all assume DWORD alignment. +;; They all take: +;; Source. The source buffer to copy from +;; Dest. The dest buffer to copy to. +;; Height. The hight of both the source and dest buffers +;; Width. The width of both the source and dest buffers +;; Pitch. The pitch of the dest buffer ONLY. The source +;; buffer assumes the pitch = width. +;; Count. The number of times you want to do the copy. +;; They all return: +;; The number of bytes copied +;; +;; +;; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY +;; KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +;; IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR +;; PURPOSE. +;; +;;--------------------------------------------------------------------------- +;; +;; Copyright (c) 1994 - 1996 Microsoft Corporation. All Rights Reserved. +;; +;;--------------------------------------------------------------------------- +.386 +.MODEL FLAT + + + + +.CODE + + +;; fill a verticale byte colum of memory (either system or video) + +VertMemSto_Pitch PROC C PUBLIC Uses ESI EDI EBX EDX ECX, + pSource:DWORD, \ ;; this isn't used, but it's gotta be here so I can + pDest:DWORD, \ ;; use it in a jump table + Height:DWORD, \ + sWidth:DWORD, \ + Pitch:DWORD, \ + Count:DWORD + + mov ebx, pSource ;; this is only here so the assembler doesn't tell + ;; me about un-used parameters. (I'm to lazy to + ;; figure out how to turn the warning off) + + mov ebx, Count ;; ebx = number of times to copy the buffers + mov eax, Pitch ;; eax = the pitch of the dest + +top_o_loop: + mov edx, pDest ;; edx = pointer to the dest + mov ecx, sWidth +VerLine: + mov edi, edx ;; load the pDest + mov esi, Height +pixel: + mov byte ptr [edi], 0 ;; store the byte (0's are nice) + add edi, eax ;; skip to the next line + dec esi ;; are we done with this colum? + jnz pixel + + inc edx ;; we did the colum. increment the pDest by one + dec ecx ;; are we done with all the colums? + jnz VerLine + + dec ebx ;; did we do it the correct number of times? + jnz top_o_loop + + mov eax, Count ;; return the number of bytes we filled + imul eax, sWidth + imul eax, Height + + ret +VertMemSto_Pitch ENDP + +; Copy from system memory to Video memory and +; cope with pitch. + +DwordMemCopy_Pitch PROC C PUBLIC USES ESI EDI EBX ECX EDX, \ + pSource:DWORD, \ + pDest:DWORD, \ + Height:DWORD, \ + sWidth:DWORD, \ + Pitch:DWORD, \ + Count:DWORD + + mov ebx, Count ;; do the copy this many times + mov edx, sWidth ;; set up the number of Dwords per scanline + shr edx, 2 + +top_o_loop: ;; every screen + push ebx + mov ebx, pDest + mov esi, pSource ;; the source is linear data + mov eax, Height ;; number of lines + push ebp + mov ebp, pitch +scan_line: + mov edi, ebx ;; get a dest pointer to this scan line + mov ecx, edx ;; reset our dword count + rep movsd + add ebx, ebp ;; add in the offset to the next scan line + + dec eax + jnz scan_line + + pop ebp ;; we've done a whole screen + pop ebx + dec ebx ;; do another screen (till we're done) + jnz top_o_loop + + mov eax, edx ;; the width + shl eax, 2 ;; in bytes + imul eax, Height ;; * height + imul eax, Count ;; * number of screens we copied + + ret + +DwordMemCopy_Pitch ENDP + +; Copy from system memory to Video memory (in BYTES) +; and cope with pitch. + +ByteMemCopy_Pitch PROC C PUBLIC USES ESI EDI EBX ECX EDX, \ + pSource:DWORD, \ + pDest:DWORD, \ + Height:DWORD, \ + sWidth:DWORD, \ + Pitch:DWORD, \ + Count:DWORD + + mov ebx, Count ;; do the copy this many times + mov edx, sWidth ;; set up the number of bytes per scanline + +top_o_loop: ;; every screen + push ebx + mov ebx, pDest + mov esi, pSource ;; the source is linear data + mov eax, Height ;; number of lines + push ebp + mov ebp, pitch +scan_line: + mov edi, ebx ;; get a dest pointer to this scan line + mov ecx, edx ;; reset our dword count + rep movsb + add ebx, ebp ;; add in the offset to the next scan line + + dec eax + jnz scan_line + + pop ebp ;; we've done a whole screen + pop ebx + dec ebx ;; do another screen (till we're done) + jnz top_o_loop + + mov eax, edx ;; the width + imul eax, Height ;; * height + imul eax, Count ;; * number of screens we copied + + ret + +ByteMemCopy_Pitch ENDP + +;; fill memory (video or system) with 0s (DOWRD fill) + +DwordMemFill_Pitch PROC C PUBLIC USES ESI EDI EBX ECX EDX, \ + pSource:DWORD, \ + pDest:DWORD, \ + Height:DWORD, \ + sWidth:DWORD, \ + Pitch:DWORD, \ + Count:DWORD + + mov ebx, pSource ;; this is only here so the assembler doesn't tell + ;; me about un-used parameters. (I'm to lazy to + ;; figure out how to turn the warning off) + mov ebx, Count + xor eax, eax + mov edx, sWidth ;; we want a dword count + shr edx, 2 + +screen: + mov esi, pDest ;; re-load the dest + push ebx + mov ebx, Height ;; re-load the height + push ebp + mov ebp, Pitch ;; put this in a register + +line: + mov edi, esi ;; get the new line + mov ecx, edx ;; load the count + rep stosd ;; store the data (eax = 0) + + add esi, ebp ;; add the pitch into the pDest + + dec ebx ;; are we done with the screen? + jnz line + + pop ebp + pop ebx + dec ebx ;; did we do it the requested number of times? + jnz screen + + mov eax, Count ;; return how many bytes we filled + imul eax, sWidth + imul eax, Height + + ret +DwordMemFill_Pitch ENDP + +;; fill memory (video or system) with 0s (DOWRD fill) + +;; same thing as above, just do it in bytes. +;; only 2 lines change. Whata waste of code space. +;; good thing it's only a test app + +ByteMemFill_Pitch PROC C PUBLIC USES ESI EDI EBX ECX EDX, \ + pSource:DWORD, \ + pDest:DWORD, \ + Height:DWORD, \ + sWidth:DWORD, \ + Pitch:DWORD, \ + Count:DWORD + + mov ebx, pSource ;; this is here so masm wont choke. + + mov ebx, Count + xor eax, eax + mov edx, sWidth + +screen: + mov esi, pDest + push ebx + mov ebx, Height + push ebp + mov ebp, Pitch + +line: + mov edi, esi + mov ecx, edx + rep stosb + + add esi, ebp + + dec ebx + jnz line + + pop ebp + pop ebx + dec ebx + jnz screen + + mov eax, Count + imul eax, sWidth + imul eax, Height + + ret +ByteMemFill_Pitch ENDP +END + + diff --git a/sdk/samples/memtime/timing.obj b/sdk/samples/memtime/timing.obj new file mode 100644 index 0000000..ecd3162 Binary files /dev/null and b/sdk/samples/memtime/timing.obj differ diff --git a/sdk/samples/mid2strm/canyon.mds b/sdk/samples/mid2strm/canyon.mds new file mode 100644 index 0000000..479e104 Binary files /dev/null and b/sdk/samples/mid2strm/canyon.mds differ diff --git a/sdk/samples/mid2strm/canyon.mid b/sdk/samples/mid2strm/canyon.mid new file mode 100644 index 0000000..b7ae43f Binary files /dev/null and b/sdk/samples/mid2strm/canyon.mid differ diff --git a/sdk/samples/mid2strm/default.mk b/sdk/samples/mid2strm/default.mk new file mode 100644 index 0000000..8cae757 --- /dev/null +++ b/sdk/samples/mid2strm/default.mk @@ -0,0 +1,47 @@ +NAME = mid2strm +EXT = exe + +IS_32 = 1 + +GOALS = $(PBIN)\$(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib libc.lib \ + comdlg32.lib gdi32.lib winmm.lib + +OBJS = mid2strm.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +AOPT =-DDEBUG +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +AOPT = +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def + +!if ("$(DEBUG)" == "ntretail") || ("$(DEBUG)" == "ntdebug") +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +!else +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ -I..\..\misc +!endif +AFLAGS =$(AOPT) -Zp4 -DSTD_CALL -DBLD_COFF -coff +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +!include ..\..\..\proj.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def ..\default.mk + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:console +-def:..\$(NAME).def +$(LIBS) +$(OBJS) +<< diff --git a/sdk/samples/mid2strm/makefile b/sdk/samples/mid2strm/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/mid2strm/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/mid2strm/mid2strm.c b/sdk/samples/mid2strm/mid2strm.c new file mode 100644 index 0000000..2f8326b --- /dev/null +++ b/sdk/samples/mid2strm/mid2strm.c @@ -0,0 +1,1023 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: mid2strm.c + * Content: Converts a MIDI file into a MDS (MidiStream) File. + * + ***************************************************************************/ +#include <stdio.h> +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <assert.h> + +// MIDI file constants +// +#define MThd 0x6468544D // Start of file +#define MTrk 0x6B72544D // Start of track + +#define MIDI_SYSEX ((BYTE)0xF0) // SysEx begin +#define MIDI_SYSEXEND ((BYTE)0xF7) // SysEx begin +#define MIDI_META ((BYTE)0xFF) // Meta event begin +#define MIDI_META_TEMPO ((BYTE)0x51) +#define MIDI_META_EOT ((BYTE)0x2F) // End-of-track + +#define MIDI_NOTEOFF ((BYTE)0x80) // + note + velocity +#define MIDI_NOTEON ((BYTE)0x90) // + note + velocity +#define MIDI_POLYPRESS ((BYTE)0xA0) // + pressure (2 bytes) +#define MIDI_CTRLCHANGE ((BYTE)0xB0) // + ctrlr + value +#define MIDI_PRGMCHANGE ((BYTE)0xC0) // + new patch +#define MIDI_CHANPRESS ((BYTE)0xD0) // + pressure (1 byte) +#define MIDI_PITCHBEND ((BYTE)0xE0) // + pitch bend (2 bytes) + +#define CB_STREAMBUF (4096) // Size of each stream buffer + +#define MIDS_SHORTMSG (0x00000000) +#define MIDS_TEMPO (0x01000000) + +// Macros for swapping hi/lo-endian data +// +#define WORDSWAP(w) (((w) >> 8) | \ + (((w) << 8) & 0xFF00)) + +#define DWORDSWAP(dw) (((dw) >> 24) | \ + (((dw) >> 8) & 0x0000FF00) | \ + (((dw) << 8) & 0x00FF0000) | \ + (((dw) << 24) & 0xFF000000)) + +// In debug builds, TRACKERR will show us where the parser died +// +#ifdef _DEBUG +#define TRACKERR(p,sz) ShowTrackError(p,sz); +#else +#define TRACKERR(p,sz) +#endif + + +// These structures are stored in MIDI files; they need to be byte +// aligned. +// +#pragma pack(1) + +// Chunk header. dwTag is either MTrk or MThd. +// +typedef struct +{ + DWORD dwTag; // Type + DWORD cbChunk; // Length (hi-lo) +} MIDICHUNK; + +// Contents of MThd chunk. +typedef struct +{ + WORD wFormat; // Format (hi-lo) + WORD cTrack; // # tracks (hi-lo) + WORD wTimeDivision; // Time division (hi-lo) +} MIDIFILEHDR; + +#pragma pack() + +// One event we're reading or writing to a track +// +typedef struct +{ + DWORD tkEvent; // Absolute time of event + BYTE abEvent[4]; // Event type and parameters if channel msg + DWORD cbEvent; // Of data which follows if meta or sysex + LPBYTE pEvent; // -> Event data if applicable +} MEVENT; + +// Description of a track open for read +// +#define ITS_F_ENDOFTRK 0x00000001 + +typedef struct +{ + DWORD fdwTrack; // Track status + DWORD cbTrack; // Total bytes in track + DWORD cbLeft; // Bytes left unread in track + LPBYTE pTrack; // -> start of track data + LPBYTE pTrackPointer; // -> next byte to read + DWORD tkNextEventDue; // Absolute time of next event in track + BYTE bRunningStatus; // Running status from last channel msg +#ifdef _DEBUG + DWORD nTrack; // # of this track for debugging +#endif +} INTRACKSTATE; + +// Description of the input MIDI file +// +typedef struct +{ + DWORD cbFile; // Total bytes in file + LPBYTE pFile; // -> entire file in memory + DWORD cbLeft; // Bytes left unread + LPBYTE pFilePointer; // -> next byte to read + + DWORD dwTimeDivision; // Original time division + DWORD dwFormat; // Original format + DWORD cTrack; // Track count (specifies apIts size) + INTRACKSTATE* apIts; // -> array of tracks in this file +} INFILESTATE; + +// Description of a stream buffer on the output side +// +typedef struct STREAMBUF *PSTREAMBUF; +typedef struct STREAMBUF +{ + LPBYTE pBuffer; // -> Start of actual buffer + DWORD tkStart; // Tick time just before first event + LPBYTE pbNextEvent; // Where to write next event + DWORD cbLeft; // bytes left in buffer + DWORD cbLeftUncompressed; // bytes left when uncompressed + PSTREAMBUF pNext; // Next buffer +} STREAMBUF; + +// Description of output stream open for write +// +typedef struct +{ + DWORD tkTrack; // Current tick position in track + PSTREAMBUF pFirst; // First stream buffer + PSTREAMBUF pLast; // Last (current) stream buffer +} OUTSTREAMSTATE; + +// Format of structs within a MSD file +// +// 'fmt ' chunk +// + +#define MDS_F_NOSTREAMID 0x00000001 // Stream ID's skipped; reader inserts +typedef struct +{ + DWORD dwTimeFormat; // Low word == time format in SMF format + DWORD cbMaxBuffer; // Guaranteed max buffer size + DWORD dwFlags; // Format flags +} MIDSFMT; + +// 'data' chunk buffer header +// +typedef struct +{ + DWORD tkStart; // Absolute tick offset at start of buffer + DWORD cbBuffer; // Bytes in this buffer +} MIDSBUFFER; + +// A few globals +// +static HANDLE hInFile = INVALID_HANDLE_VALUE; +static HANDLE hOutFile = INVALID_HANDLE_VALUE; +static INFILESTATE ifs; +static OUTSTREAMSTATE ots; +static BOOL fCompress = FALSE; + +// Messages +// +static char szInitErrMem[] = "Out of memory.\n"; +static char szInitErrInFile[] = "Read error on input file or file is corrupt.\n"; + +#ifdef _DEBUG +static char gteBadRunStat[] = "Reference to missing running status."; +static char gteRunStatMsgTrunc[] = "Running status message truncated"; +static char gteChanMsgTrunc[] = "Channel message truncated"; +static char gteSysExLenTrunc[] = "SysEx event truncated (length)"; +static char gteSysExTrunc[] = "SysEx event truncated"; +static char gteMetaNoClass[] = "Meta event truncated (no class byte)"; +static char gteMetaLenTrunc[] = "Meta event truncated (length)"; +static char gteMetaTrunc[] = "Meta event truncated"; +#endif + +// Prototypes +// +static BOOL Init(LPSTR szInFile, LPSTR szOutFile); +static LPBYTE GetInFileData(DWORD cbToGet); +static void Cleanup(void); +static BOOL BuildNewTracks(void); +static BOOL WriteStreamBuffers(void); +static BOOL GetTrackVDWord(INTRACKSTATE* pTs, LPDWORD lpdw); +static BOOL GetTrackEvent(INTRACKSTATE* pTs, MEVENT *pMe); +static BOOL AddEventToStream(MEVENT *pMe); +static LPBYTE GetOutStreamBytes(DWORD tkNow, DWORD cbNeeded, DWORD cbUncompressed); +#ifdef _DEBUG +static void ShowTrackError(INTRACKSTATE* pTs, char* szErr); +#endif + +void main(int argc, char* argv[]) +{ + UINT idxFnames; + + if (argc < 3) + { + fprintf(stderr, "Format is mid2strm [-c] infile outfile\n"); + fprintf(stderr, "-c\tNo-stream-id compression\n"); + exit(1); + } + + idxFnames = 1; + if (argv[1][0] == '-') + { + ++idxFnames; + if (argv[1][1] == 'c') + fCompress = TRUE; + } + + if (!Init(argv[idxFnames], argv[idxFnames+1])) + exit(1); + + if (!BuildNewTracks()) + exit(1); + + if (!WriteStreamBuffers()) + exit(1); + + // Add cleanup code!!! + // + Cleanup(); + + exit(0); +} + +// Init +// +// Open the input and output files +// Allocate and read the entire input file into memory +// Validate the input file structure +// Allocate the input track structures and initialize them +// Initialize the output track structures +// +// Return TRUE on success +// Prints its own error message if something goes wrong +// +static BOOL Init(LPSTR szInFile, LPSTR szOutFile) +{ + BOOL fRet = FALSE; + DWORD cbRead; + LPDWORD lpdwTag; + LPDWORD lpcbHeader; + DWORD cbHeader; + MIDIFILEHDR* pHeader; + INTRACKSTATE* pTs; + UINT idx; + + // Initialize things we'll try to free later if we fail + // + ifs.cbFile = 0; + ifs.pFile = NULL; + ifs.apIts = NULL; + + // Attempt to open the input and output files + // + hInFile = CreateFile(szInFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (INVALID_HANDLE_VALUE == hInFile) + { + fprintf(stderr, "Could not open \"%s\" for read.\n", szInFile); + goto Init_Cleanup; + } + + hOutFile = CreateFile(szOutFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (INVALID_HANDLE_VALUE == hOutFile) + { + fprintf(stderr, "Could not open \"%s\" for write.\n", szOutFile); + goto Init_Cleanup; + } + + // Figure out how big the input file is and allocate a chunk of memory big enough + // to hold the whole thing. Read the whole file in at once. + // + if (((UINT)-1) == (ifs.cbFile = GetFileSize(hInFile, NULL))) + { + fprintf(stderr, "File system error on input file.\n"); + goto Init_Cleanup; + } + + if (NULL == (ifs.pFile = GlobalAllocPtr(GPTR, ifs.cbFile))) + { + fprintf(stderr, szInitErrMem); + goto Init_Cleanup; + } + + if ((!ReadFile(hInFile, ifs.pFile, ifs.cbFile, &cbRead, NULL)) || + cbRead != ifs.cbFile) + { + fprintf(stderr, szInitErrInFile); + goto Init_Cleanup; + } + + // Set up to read from the memory buffer. Read and validate + // - MThd header + // - size of file header chunk + // - file header itself + // + ifs.cbLeft = ifs.cbFile; + ifs.pFilePointer = ifs.pFile; + + if (NULL == (lpdwTag = (LPDWORD)GetInFileData(sizeof(*lpdwTag))) || + *lpdwTag != MThd || + NULL == (lpcbHeader = (LPDWORD)GetInFileData(sizeof(*lpcbHeader))) || + (cbHeader = DWORDSWAP(*lpcbHeader)) < sizeof(MIDIFILEHDR) || + NULL == (pHeader = (MIDIFILEHDR*)GetInFileData(cbHeader))) + { + fprintf(stderr, szInitErrInFile); + goto Init_Cleanup; + } + + // File header is stored in hi-lo order. Swap this into Intel order and save + // parameters in our native int size (32 bits) + // + ifs.dwFormat = (DWORD)WORDSWAP(pHeader->wFormat); + ifs.cTrack = (DWORD)WORDSWAP(pHeader->cTrack); + ifs.dwTimeDivision = (DWORD)WORDSWAP(pHeader->wTimeDivision); + + // We know how many tracks there are; allocate the structures for them and parse + // them. The parse merely looks at the MTrk signature and track chunk length + // in order to skip to the next track header. + // + ifs.apIts = (INTRACKSTATE*)GlobalAllocPtr(GPTR, ifs.cTrack*sizeof(INTRACKSTATE)); + if (NULL == ifs.apIts) + { + fprintf(stderr, szInitErrMem); + goto Init_Cleanup; + } + + for (idx = 0, pTs = ifs.apIts; idx < ifs.cTrack; ++idx, ++pTs) + { + if (NULL == (lpdwTag = (LPDWORD)GetInFileData(sizeof(*lpdwTag))) || + *lpdwTag != MTrk || + NULL == (lpcbHeader = (LPDWORD)GetInFileData(sizeof(*lpcbHeader)))) + { + fprintf(stderr, szInitErrInFile); + goto Init_Cleanup; + } + + cbHeader = DWORDSWAP(*lpcbHeader); + pTs->cbTrack = cbHeader; + pTs->cbLeft = cbHeader; + pTs->pTrack = GetInFileData(cbHeader); + if (NULL == pTs->pTrack) + { + fprintf(stderr, szInitErrInFile); + goto Init_Cleanup; + } + +#ifdef _DEBUG + pTs->nTrack = idx; +#endif + pTs->pTrackPointer = pTs->pTrack; + pTs->cbLeft = pTs->cbTrack; + pTs->fdwTrack = 0; + pTs->bRunningStatus = 0; + + // Handle bozo MIDI files which contain empty track chunks + // + if (!pTs->cbLeft) + { + pTs->fdwTrack |= ITS_F_ENDOFTRK; + continue; + } + + + // We always preread the time from each track so the mixer code can + // determine which track has the next event with a minimum of work + // + if (!GetTrackVDWord(pTs, &pTs->tkNextEventDue)) + { + fprintf(stderr, szInitErrInFile); + goto Init_Cleanup; + } + } + + ots.tkTrack = 0; + ots.pFirst = NULL; + ots.pLast = NULL; + + fRet = TRUE; + +Init_Cleanup: + if (!fRet) + Cleanup(); + + return fRet; +} + +// +// GetInFileData +// +// Gets the requested number of bytes of data from the input file and returns +// a pointer to them. +// +// Returns a pointer to the data or NULL if we'd read more than is +// there. +// +static LPBYTE GetInFileData(DWORD cbToGet) +{ + LPBYTE pRet; + + if (ifs.cbLeft < cbToGet) + return NULL; + + pRet = ifs.pFilePointer; + + ifs.cbLeft -= cbToGet; + ifs.pFilePointer += cbToGet; + + return pRet; +} + +// +// Cleanup +// +// Free anything we ever allocated +// +static void Cleanup(void) +{ + PSTREAMBUF pCurr; + PSTREAMBUF pNext; + + if (hInFile != INVALID_HANDLE_VALUE) CloseHandle(hInFile); + if (hOutFile != INVALID_HANDLE_VALUE) CloseHandle(hOutFile); + if (ifs.pFile) GlobalFreePtr(ifs.pFile); + if (ifs.apIts) GlobalFreePtr(ifs.apIts); + + + pCurr = ots.pFirst; + while (pCurr) + { + pNext = pCurr->pNext; + GlobalFreePtr(pCurr); + pCurr = pNext; + } +} + +// +// BuildNewTracks +// +// This is where the actual work gets done. +// +// Until all tracks are done, +// Scan the tracks to find the next due event +// Figure out where the event belongs in the new mapping +// Put it there +// Add end of track metas to all new tracks that now have any data +// +// Return TRUE on success +// Prints its own error message if something goes wrong +// +static BOOL BuildNewTracks(void) +{ + INTRACKSTATE* pTs; + INTRACKSTATE* pTsFound; + UINT idx; + DWORD tkNext; + MEVENT me; + + for(;;) + { + // Find nearest event due + // + pTsFound = NULL; + tkNext = 0xFFFFFFFFL; + + for (idx = 0, pTs = ifs.apIts; idx < ifs.cTrack; ++idx, ++pTs) + if ((!(pTs->fdwTrack & ITS_F_ENDOFTRK)) && (pTs->tkNextEventDue < tkNext)) + { + tkNext = pTs->tkNextEventDue; + pTsFound = pTs; + } + + // None found? We must be done + // + if (!pTsFound) + break; + + // Ok, get the event header from that track + // + + if (!GetTrackEvent(pTsFound, &me)) + { + fprintf(stderr, "MIDI file is corrupt!\n"); + return FALSE; + } + + // Don't add end of track event 'til we're done + // + if (me.abEvent[0] == MIDI_META && me.abEvent[1] == MIDI_META_EOT) + continue; + + if (!AddEventToStream(&me)) + { + fprintf(stderr, "Out of memory building tracks.\n"); + return FALSE; + } + } + + return TRUE; +} + +// +// WriteStreamBuffers +// +// Write stream buffers into an MDS file (RIFF MIDS format) +// +// Return TRUE on success +// Prints its own error message if something goes wrong +// +#define FOURCC_MIDS mmioFOURCC('M','I','D','S') +#define FOURCC_fmt mmioFOURCC('f','m','t',' ') +#define FOURCC_data mmioFOURCC('d','a','t','a') + +static BOOL WriteStreamBuffers(void) +{ + DWORD cbFmt; + DWORD cbData; + DWORD cbRiff; + PSTREAMBUF psb; + FOURCC fcc; + FOURCC fcc2; + MIDSFMT fmt; + MIDSBUFFER data; + DWORD cb; + DWORD cBuffers; + + // Walk buffer list to find entire size of data chunk + // + cbData = sizeof(cBuffers); + cBuffers = 0; + for (psb = ots.pFirst; psb; psb = psb->pNext, ++cBuffers) + cbData += sizeof(MIDSBUFFER) + (CB_STREAMBUF - psb->cbLeft); + + cbFmt = sizeof(fmt); + + // Figure size of entire RIFF chunk + // + cbRiff = + sizeof(FOURCC) + // RIFF form type ('MIDS') + sizeof(FOURCC) + // Format chunk type ('fmt ') + sizeof(DWORD) + // Format chunk size + sizeof(MIDSFMT) + // Format chunk contents + sizeof(FOURCC) + // Data chunk type ('data') + sizeof(DWORD) + // Data chunk size + cbData; // Data chunk contents + + fcc = FOURCC_RIFF; + fcc2 = FOURCC_MIDS; + if ((!WriteFile(hOutFile, &fcc, sizeof(fcc), &cb, NULL)) || + (!WriteFile(hOutFile, &cbRiff, sizeof(cbRiff), &cb, NULL)) || + (!WriteFile(hOutFile, &fcc2, sizeof(fcc2), &cb, NULL))) + return FALSE; + + + fmt.dwTimeFormat = ifs.dwTimeDivision; + fmt.cbMaxBuffer = CB_STREAMBUF; + fmt.dwFlags = 0; + if (fCompress) + fmt.dwFlags |= MDS_F_NOSTREAMID; + + fcc = FOURCC_fmt; + if ((!WriteFile(hOutFile, &fcc, sizeof(fcc), &cb, NULL)) || + (!WriteFile(hOutFile, &cbFmt, sizeof(cbFmt), &cb, NULL)) || + (!WriteFile(hOutFile, &fmt, sizeof(fmt), &cb, NULL))) + return FALSE; + + fcc = FOURCC_data; + if ((!WriteFile(hOutFile, &fcc, sizeof(fcc), &cb, NULL)) || + (!WriteFile(hOutFile, &cbData, sizeof(cbData), &cb, NULL)) || + (!WriteFile(hOutFile, &cBuffers, sizeof(cBuffers), &cb, NULL))) + return FALSE; + + for (psb = ots.pFirst; psb; psb = psb->pNext) + { + data.tkStart = psb->tkStart; + data.cbBuffer = CB_STREAMBUF - psb->cbLeft; + + if ((!WriteFile(hOutFile, &data, sizeof(data), &cb, NULL)) || + (!WriteFile(hOutFile, psb->pBuffer, data.cbBuffer, &cb, NULL))) + return FALSE; + } + + return TRUE; +} + +// +// GetTrackVDWord +// +// Attempts to parse a variable length DWORD from the given track. A VDWord +// in a MIDI file +// (a) is in lo-hi format +// (b) has the high bit set on every byte except the last +// +// Returns the DWORD in *lpdw and TRUE on success; else +// FALSE if we hit end of track first. Sets ITS_F_ENDOFTRK +// if we hit end of track. +// +static BOOL GetTrackVDWord(INTRACKSTATE* pTs, LPDWORD lpdw) +{ + BYTE b; + DWORD dw = 0; + + if (pTs->fdwTrack & ITS_F_ENDOFTRK) + return FALSE; + + do + { + if (!pTs->cbLeft) + { + pTs->fdwTrack |= ITS_F_ENDOFTRK; + return FALSE; + } + + b = *pTs->pTrackPointer++; + --pTs->cbLeft; + + dw = (dw << 7) | (b & 0x7F); + } while (b & 0x80); + + *lpdw = dw; + + return TRUE; +} + +// +// GetTrackEvent +// +// Fills in the event struct with the next event from the track +// +// pMe->tkEvent will contain the absolute tick time of the event +// pMe->abEvent[0] will contain +// MIDI_META if the event is a meta event; +// in this case pMe->abEvent[1] will contain the meta class +// MIDI_SYSEX or MIDI_SYSEXEND if the event is a SysEx event +// Otherwise, the event is a channel message and pMe->abEvent[1] +// and pMe->abEvent[2] will contain the rest of the event. +// +// pMe->cbEvent will contain +// The total length of the channel message in pMe->abEvent if +// the event is a channel message +// The total length of the paramter data pointed to by +// pMe->pEvent otherwise +// +// pMe->pEvent will point at any additional paramters if the +// event is a SysEx or meta event with non-zero length; else +// it will contain NULL +// +// Returns TRUE on success or FALSE on any kind of parse error +// Prints its own error message ONLY in the debug version +// +// Maintains the state of the input track (i.e. pTs->cbLeft, +// pTs->pTrackPointers, and pTs->bRunningStatus). +// +static BOOL GetTrackEvent(INTRACKSTATE* pTs, MEVENT *pMe) +{ + BYTE b; + UINT cbEvent; + + pMe->pEvent = NULL; + + // Already at end of track? There's nothing to read. + // + if ((pTs->fdwTrack & ITS_F_ENDOFTRK) || !pTs->cbLeft) + return FALSE; + + // Get the first byte, which determines the type of event. + // + b = *pTs->pTrackPointer++; + --pTs->cbLeft; + + // If the high bit is not set, then this is a channel message + // which uses the status byte from the last channel message + // we saw. NOTE: We do not clear running status across SysEx or + // meta events even though the spec says to because there are + // actually files out there which contain that sequence of data. + // + if (!(b & 0x80)) + { + // No previous status byte? We're hosed. + // + if (!pTs->bRunningStatus) + { + TRACKERR(pTs, gteBadRunStat); + return FALSE; + } + + pMe->abEvent[0] = pTs->bRunningStatus; + pMe->abEvent[1] = b; + + b = pMe->abEvent[0] & 0xF0; + pMe->cbEvent = 2; + + // Only program change and channel pressure events are 2 bytes long; + // the rest are 3 and need another byte + // + if (b != MIDI_PRGMCHANGE && b != MIDI_CHANPRESS) + { + if (!pTs->cbLeft) + { + TRACKERR(pTs, gteRunStatMsgTrunc); + pTs->fdwTrack |= ITS_F_ENDOFTRK; + return FALSE; + } + + pMe->abEvent[2] = *pTs->pTrackPointer++; + --pTs->cbLeft; + ++pMe->cbEvent; + } + } + else if ((b & 0xF0) != MIDI_SYSEX) + { + // Not running status, not in SysEx range - must be + // normal channel message (0x80-0xEF) + // + pMe->abEvent[0] = b; + pTs->bRunningStatus = b; + + // Strip off channel and just keep message type + // + b &= 0xF0; + + cbEvent = (b == MIDI_PRGMCHANGE || b == MIDI_CHANPRESS) ? 1 : 2; + pMe->cbEvent = cbEvent + 1; + + if (pTs->cbLeft < cbEvent) + { + TRACKERR(pTs, gteChanMsgTrunc); + pTs->fdwTrack |= ITS_F_ENDOFTRK; + return FALSE; + } + + pMe->abEvent[1] = *pTs->pTrackPointer++; + if (cbEvent == 2) + pMe->abEvent[2] = *pTs->pTrackPointer++; + + pTs->cbLeft -= cbEvent; + } + else if (b == MIDI_SYSEX || b == MIDI_SYSEXEND) + { + // One of the SysEx types. (They are the same as far as we're concerned; + // there is only a semantic difference in how the data would actually + // get sent when the file is played. We must take care to put the correct + // event type back on the output track, however.) + // + // Parse the general format of: + // BYTE bEvent (MIDI_SYSEX or MIDI_SYSEXEND) + // VDWORD cbParms + // BYTE abParms[cbParms] + // + pMe->abEvent[0] = b; + if (!GetTrackVDWord(pTs, &pMe->cbEvent)) + { + TRACKERR(pTs, gteSysExLenTrunc); + return FALSE; + } + + if (pTs->cbLeft < pMe->cbEvent) + { + TRACKERR(pTs, gteSysExTrunc); + pTs->fdwTrack |= ITS_F_ENDOFTRK; + return FALSE; + } + + pMe->pEvent = pTs->pTrackPointer; + pTs->pTrackPointer += pMe->cbEvent; + pTs->cbLeft -= pMe->cbEvent; + } + else if (b == MIDI_META) + { + // It's a meta event. Parse the general form: + // BYTE bEvent (MIDI_META) + // BYTE bClass + // VDWORD cbParms + // BYTE abParms[cbParms] + // + pMe->abEvent[0] = b; + + if (!pTs->cbLeft) + { + TRACKERR(pTs, gteMetaNoClass); + pTs->fdwTrack |= ITS_F_ENDOFTRK; + return FALSE; + } + + pMe->abEvent[1] = *pTs->pTrackPointer++; + --pTs->cbLeft; + + if (!GetTrackVDWord(pTs, &pMe->cbEvent)) + { + TRACKERR(pTs, gteMetaLenTrunc); + return FALSE; + } + + // NOTE: Perfectly valid to have a meta with no data + // In this case, cbEvent == 0 and pEvent == NULL + // + if (pMe->cbEvent) + { + if (pTs->cbLeft < pMe->cbEvent) + { + TRACKERR(pTs, gteMetaTrunc); + pTs->fdwTrack |= ITS_F_ENDOFTRK; + return FALSE; + } + + pMe->pEvent = pTs->pTrackPointer; + pTs->pTrackPointer += pMe->cbEvent; + pTs->cbLeft -= pMe->cbEvent; + } + + if (pMe->abEvent[1] == MIDI_META_EOT) + pTs->fdwTrack |= ITS_F_ENDOFTRK; + } + else + { + // Messages in this range are system messages and aren't supposed to + // be in a normal MIDI file. If they are, we've misparsed or the + // authoring software is stpuid. + // + return FALSE; + } + + // Event time was already stored as the current track time + // + pMe->tkEvent = pTs->tkNextEventDue; + + // Now update to the next event time. The code above MUST properly + // maintain the end of track flag in case the end of track meta is + // missing. + // + if (!(pTs->fdwTrack & ITS_F_ENDOFTRK)) + { + DWORD tkDelta; + + if (!GetTrackVDWord(pTs, &tkDelta)) + return FALSE; + + pTs->tkNextEventDue += tkDelta; + } + + return TRUE; +} + +// +// AddEventToStream +// +// Put the given event onto the given output track. +// pMe must point to an event filled out in accordance with the +// description given in GetTrackEvent +// +// Returns TRUE on sucess or FALSE if we're out of memory +// +static BOOL AddEventToStream(MEVENT *pMe) +{ + PDWORD pdw; + DWORD tkNow; + DWORD tkDelta; + UINT cdw; + + tkNow = ots.tkTrack; + + // Delta time is absolute event time minus absolute time + // already gone by on this track + // + tkDelta = pMe->tkEvent - ots.tkTrack; + + // Event time is now current time on this track + // + ots.tkTrack = pMe->tkEvent; + + if (pMe->abEvent[0] < MIDI_SYSEX) + { + // Channel message. We know how long it is, just copy it. Need 3 DWORD's: delta-t, + // stream-ID, event + // + // TODO: Compress with running status + // + + cdw = (fCompress ? 2 : 3); + if (NULL == (pdw = (PDWORD)GetOutStreamBytes(tkNow, cdw * sizeof(DWORD), 3 * sizeof(DWORD)))) + return FALSE; + + *pdw++ = tkDelta; + if (!fCompress) + *pdw++ = 0; + *pdw = (pMe->abEvent[0]) | + (((DWORD)pMe->abEvent[1]) << 8) | + (((DWORD)pMe->abEvent[2]) << 16) | + MIDS_SHORTMSG; + + } + else if (pMe->abEvent[0] == MIDI_SYSEX || pMe->abEvent[0] == MIDI_SYSEXEND) + { + fprintf(stderr, "NOTE: Ignoring SysEx for now.\n"); + } + else + { + // Better be a meta event. + // BYTE bEvent + // BYTE bClass + // VDWORD cbParms + // BYTE abParms[cbParms] + // + assert(pMe->abEvent[0] == MIDI_META); + + // The only meta-event we care about is change tempo + // + if (pMe->abEvent[1] != MIDI_META_TEMPO) + return TRUE; + + assert(pMe->cbEvent == 3); + + cdw = (fCompress ? 2 : 3); + pdw = (PDWORD)GetOutStreamBytes(tkNow, cdw * sizeof(DWORD), 3 * sizeof(DWORD)); + if (NULL == pdw) + return FALSE; + + *pdw++ = tkDelta; + if (!fCompress) + *pdw++ = (DWORD)-1; + *pdw = (pMe->pEvent[2]) | + (((DWORD)pMe->pEvent[1]) << 8) | + (((DWORD)pMe->pEvent[0]) << 16) | + MIDS_TEMPO; + } + + return TRUE; +} + +// +// GetOutStreamBytes +// +// This function performs the memory management and pseudo-file I/O for output +// tracks. +// +// We build a linked list of stream buffers as they would exist if they were +// about to be played. Each buffer is CB_STREAMBUF bytes long maximum. They are +// filled as full as possible; events are not allowed to cross buffers. +// +// Returns a pointer to the number of requested bytes or NULL if we're out of memory +// +static LPBYTE GetOutStreamBytes(DWORD tkNow, DWORD cbNeeded, DWORD cbUncompressed) +{ + LPBYTE pb; + + // Round request up to the next DWORD boundry. This aligns the final output buffer correctly + // and allows the above routines to deal with byte-aligned data + // + cbNeeded = (cbNeeded + 3) & ~3; + cbUncompressed = (cbUncompressed + 3) & ~3; + + assert(cbUncompressed >= cbNeeded); + + if (NULL == ots.pLast || cbUncompressed > ots.pLast->cbLeftUncompressed) + { + PSTREAMBUF pNew; + + pNew = GlobalAllocPtr(GHND, sizeof(*pNew) + CB_STREAMBUF); + if (NULL == pNew) + return NULL; + + pNew->pBuffer = (LPBYTE)(pNew + 1); + pNew->tkStart = tkNow; + pNew->pbNextEvent = pNew->pBuffer; + pNew->cbLeft = CB_STREAMBUF; + pNew->cbLeftUncompressed = CB_STREAMBUF; + pNew->pNext = NULL; + + if (!ots.pLast) + { + ots.pFirst = pNew; + ots.pLast = pNew; + } + else + { + ots.pLast->pNext = pNew; + ots.pLast = pNew; + } + } + + // If there's STILL not enough room for the requested block, then an event is bigger than + // the buffer size -- this is unacceptable. + // + if (cbNeeded > ots.pLast->cbLeft) + { + fprintf(stderr, "NOTE: An event requested %lu bytes of memory; the\n", cbNeeded); + fprintf(stderr, " maximum configured buffer size is %lu.\n", (DWORD)CB_STREAMBUF); + + return NULL; + } + + pb = ots.pLast->pbNextEvent; + + ots.pLast->pbNextEvent += cbNeeded; + ots.pLast->cbLeft -= cbNeeded; + ots.pLast->cbLeftUncompressed -= cbUncompressed; + + return pb; +} + +#ifdef _DEBUG +static void ShowTrackError(INTRACKSTATE* pTs, char* szErr) +{ + fprintf(stderr, "Track %u: %s\n", pTs->nTrack, szErr); + fprintf(stderr, "Track offset %lu\n", (DWORD)(pTs->pTrackPointer - pTs->pTrack)); + fprintf(stderr, "Track total %lu Track left %lu\n", pTs->cbTrack, pTs->cbLeft); +} +#endif diff --git a/sdk/samples/mid2strm/mid2strm.def b/sdk/samples/mid2strm/mid2strm.def new file mode 100644 index 0000000..a980c0f --- /dev/null +++ b/sdk/samples/mid2strm/mid2strm.def @@ -0,0 +1,9 @@ +NAME mid2strm.exe + +DESCRIPTION 'Midi to Stream Conversion Utility (C) Microsoft 1995' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE diff --git a/sdk/samples/mid2strm/mid2strm.mak b/sdk/samples/mid2strm/mid2strm.mak new file mode 100644 index 0000000..bc5a240 --- /dev/null +++ b/sdk/samples/mid2strm/mid2strm.mak @@ -0,0 +1,163 @@ +# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +!IF "$(CFG)" == "" +CFG=Win32 Debug +!MESSAGE No configuration specified. Defaulting to Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Mid2strm.mak" CFG="Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "Win32 Debug" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "WinRel" +# PROP BASE Intermediate_Dir "WinRel" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "WinRel" +# PROP Intermediate_Dir "WinRel" +OUTDIR=.\WinRel +INTDIR=.\WinRel + +ALL : $(OUTDIR)/Mid2strm.exe $(OUTDIR)/Mid2strm.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /c +# ADD CPP /nologo /Zp4 /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /c +CPP_PROJ=/nologo /Zp4 /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\ + /FR$(INTDIR)/ /Fp$(OUTDIR)/"Mid2strm.pch" /Fo$(INTDIR)/ /c +CPP_OBJS=.\WinRel/ +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"Mid2strm.bsc" +BSC32_SBRS= \ + $(INTDIR)/mid2strm.sbr + +$(OUTDIR)/Mid2strm.bsc : $(OUTDIR) $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /NOLOGO\ + /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"Mid2strm.pdb"\ + /MACHINE:I386 /OUT:$(OUTDIR)/"Mid2strm.exe" +DEF_FILE= +LINK32_OBJS= \ + $(INTDIR)/mid2strm.obj + +$(OUTDIR)/Mid2strm.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "WinDebug" +# PROP BASE Intermediate_Dir "WinDebug" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "WinDebug" +# PROP Intermediate_Dir "WinDebug" +OUTDIR=.\WinDebug +INTDIR=.\WinDebug + +ALL : $(OUTDIR)/Mid2strm.exe $(OUTDIR)/Mid2strm.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE CPP /nologo /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /c +# ADD CPP /nologo /Zp4 /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /c +CPP_PROJ=/nologo /Zp4 /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE"\ + /FR$(INTDIR)/ /Fp$(OUTDIR)/"Mid2strm.pch" /Fo$(INTDIR)/\ + /Fd$(OUTDIR)/"Mid2strm.pdb" /c +CPP_OBJS=.\WinDebug/ +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"Mid2strm.bsc" +BSC32_SBRS= \ + $(INTDIR)/mid2strm.sbr + +$(OUTDIR)/Mid2strm.bsc : $(OUTDIR) $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /NOLOGO /SUBSYSTEM:console /DEBUG /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /NOLOGO /SUBSYSTEM:console /DEBUG /MACHINE:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /NOLOGO\ + /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"Mid2strm.pdb" /DEBUG\ + /MACHINE:I386 /OUT:$(OUTDIR)/"Mid2strm.exe" +DEF_FILE= +LINK32_OBJS= \ + $(INTDIR)/mid2strm.obj + +$(OUTDIR)/Mid2strm.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Group "Source Files" + +################################################################################ +# Begin Source File + +SOURCE=.\mid2strm.c + +$(INTDIR)/mid2strm.obj : $(SOURCE) $(INTDIR) + +# End Source File +# End Group +# End Project +################################################################################ diff --git a/sdk/samples/mid2strm/msvc.mk b/sdk/samples/mid2strm/msvc.mk new file mode 100644 index 0000000..2dddbfb --- /dev/null +++ b/sdk/samples/mid2strm/msvc.mk @@ -0,0 +1,40 @@ +NAME = mid2strm +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = mid2strm.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:console +-def:..\$(NAME).def +$(LIBS) +$(OBJS) +<< diff --git a/sdk/samples/mid2strm/readme.txt b/sdk/samples/mid2strm/readme.txt new file mode 100644 index 0000000..5986bc3 --- /dev/null +++ b/sdk/samples/mid2strm/readme.txt @@ -0,0 +1,24 @@ +Mid2Strm Sample Readme File +=========================== + +This sample is related to the mstream sample, and contains a subset of the +functionality of mstream. + +Mid2strm converts a .mid file (standard midi file) into a format which can +be easily sent to the the midiStreamXxx APIs. It takes a .mid file as +input, and produces a .mds file as output. Note that .mds files are not +a standard Windows file format; for example, they can't be played back by +mplayer. Your application must play the file back by sending the data to +the midiStreamXxx APIs as shown in the mstream sample. + +The midiStreamXxx APIs expect a buffer containing 3 DWORDs per MIDI event: +the event, the time stamp, and the stream ID. The mid2strm sample will +create a buffer of this format and store it as a .mds file. Of course, +the file will be larger than the .mid file. To save space, you can specify +the -c option. This specifies that stream IDs should not be included in the +file, compressing the file by 1/3. This assumes that all stream IDs will be +zero; for most applications, this is sufficient. Note, however, that the +stream ID DWORD will have to be inserted into the buffer before it is sent +to the midiStreamXxx APIs. + +Please see the mstream readme file for more information. diff --git a/sdk/samples/misc/d3d.ico b/sdk/samples/misc/d3d.ico new file mode 100644 index 0000000..bb39b7d Binary files /dev/null and b/sdk/samples/misc/d3d.ico differ diff --git a/sdk/samples/misc/d3dapp.c b/sdk/samples/misc/d3dapp.c new file mode 100644 index 0000000..93f64f1 --- /dev/null +++ b/sdk/samples/misc/d3dapp.c @@ -0,0 +1,1400 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dapp.c + * + * Top level D3DApp functions and internal global variables. See + * d3dapp.h for more information. + * + * D3DApp is a collection of helper functions for Direct3D applications. + * D3DApp consists of the following files: + * d3dapp.h Main D3DApp header to be included by application + * d3dappi.h Internal header + * d3dapp.c D3DApp functions seen by application. + * ddcalls.c All calls to DirectDraw objects except textures + * d3dcalls.c All calls to Direct3D objects except textures + * texture.c Texture loading and managing texture list + * misc.c Miscellaneous calls + */ + +#include "d3dappi.h" +#include <d3drm.h> /* For D3DRM error codes only */ + +#define INITGUID + +/***************************************************************************/ +/* GLOBAL VARIABLES */ +/***************************************************************************/ +/* + * All DD and D3D objects which are also available to the application + * See d3dapp.h for typedef + */ +D3DAppInfo d3dappi; +/* + * Internal record of the render state. See d3dapp.h for typedef + */ +D3DAppRenderState d3dapprs; +/* + * Callback functions for D3D device creation and destruction + */ +BOOL(*D3DDeviceDestroyCallback)(LPVOID); +LPVOID D3DDeviceDestroyCallbackContext; +BOOL(*D3DDeviceCreateCallback)(int, int, LPDIRECT3DVIEWPORT*, LPVOID); +LPVOID D3DDeviceCreateCallbackContext; +/* + * The last error code and string + */ +HRESULT LastError; +char LastErrorString[256]; +/* + * List of dirty rectangles on back buffer and client area + */ +int NumDirtyClientRects, NumDirtyBackRects, NumDirtyZRects; +D3DRECT DirtyClient[D3DAPP_MAXCLEARRECTS]; +D3DRECT DirtyBack[D3DAPP_MAXCLEARRECTS]; +D3DRECT DirtyZ[D3DAPP_MAXCLEARRECTS]; +/* + * List of texture handles which is copied to D3DAppInfo structure when + * necessary + */ +D3DTEXTUREHANDLE MasterTextureHandle[D3DAPP_MAXTEXTURES]; + +LPDIRECTDRAWCLIPPER lpClipper; /* Clipper in windowed case */ +LPDIRECTDRAWPALETTE lpPalette; /* Front buffer's palette */ +PALETTEENTRY ppe[256]; /* Current palette entries */ +PALETTEENTRY Originalppe[256]; /* Windows palette entries at startup */ +BOOL bD3DAppInitialized; /* Is D3DApp initialized? */ +BOOL bPrimaryPalettized; /* Is the front buffer palettized? */ +BOOL bPaletteActivate; /* Is the front buffer's palette valid? */ +BOOL bIgnoreWM_SIZE; /* Ignore this WM_SIZE messages */ +SIZE szLastClient; /* Dimensions of the last window */ +SIZE szBuffers; /* Current buffer dimensions, not necessarily + the same as the client window */ +int CallbackRefCount; /* How many times DeviceCreateCallback has + been called in a row */ + +/***************************************************************************/ +/* FUNCTIONS */ +/***************************************************************************/ +/* + * D3DAppCreateFromHWND + */ +BOOL D3DAppCreateFromHWND(DWORD flags, HWND hwnd, + BOOL(*DeviceCreateCallback)(int, int, + LPDIRECT3DVIEWPORT*, + LPVOID), + LPVOID lpCreateContext, + BOOL(*DeviceDestroyCallback)(LPVOID), + LPVOID lpDestroyContext, + D3DAppInfo** D3DApp) +{ + int driver, mode, w, h; + /* + * Clean the global varaibles and check the flags + */ + D3DAppISetDefaults(); + if (flags & D3DAPP_ONLYSYSTEMMEMORY) { + d3dappi.bOnlySystemMemory = TRUE; + d3dappi.bOnlyEmulation = TRUE; + } + if (flags & D3DAPP_ONLYD3DEMULATION) + d3dappi.bOnlyEmulation = TRUE; + /* + * Create DirectDraw, remember the Windows display mode and enumerate the + * display modes + */ + ATTEMPT(D3DAppICreateDD(d3dappi.bOnlyEmulation ? + D3DAPP_ONLYDDEMULATION : 0L)); + ATTEMPT(D3DAppIRememberWindowsMode()); + ATTEMPT(D3DAppIEnumDisplayModes()); + /* + * Create Direct3D and enumerate the D3D drivers + */ + ATTEMPT(D3DAppICreateD3D()); + ATTEMPT(D3DAppIEnumDevices()); + /* + * Set the device creation and destroy callback functions + */ + D3DDeviceDestroyCallback = DeviceDestroyCallback; + D3DDeviceDestroyCallbackContext = lpDestroyContext; + D3DDeviceCreateCallback = DeviceCreateCallback; + D3DDeviceCreateCallbackContext = lpCreateContext; + *D3DApp = &d3dappi; + d3dappi.hwnd = hwnd; + /* + * Choose a driver and display mode. Using the current window is + * prefered, but a fullscreen mode may be selected. Set the cooperative + * level and create the front and back buffers for this mode. + */ + driver = D3DAPP_YOUDECIDE; + mode = D3DAPP_YOUDECIDE; + ATTEMPT(D3DAppIVerifyDriverAndMode(&driver, &mode)); + D3DAppIGetClientWin(hwnd); + if (mode == D3DAPP_USEWINDOW) { + w = d3dappi.szClient.cx; + h = d3dappi.szClient.cy; + ATTEMPT(D3DAppISetCoopLevel(hwnd, FALSE)); + ATTEMPT(D3DAppICreateBuffers(hwnd, w, h, D3DAPP_BOGUS, FALSE, + d3dappi.Driver[driver].bIsHardware)); + /* + * Change the currently selected mode if it's not compatible with + * this driver. Just to make sure that CurrMode is always a mode the + * current driver can do. + */ + if (!(d3dappi.Driver[driver].Desc.dwDeviceRenderBitDepth & + D3DAppIBPPToDDBD(d3dappi.Mode[d3dappi.CurrMode].bpp))){ + ATTEMPT(D3DAppIPickDisplayMode(&d3dappi.CurrMode, + d3dappi.Driver[driver].Desc.dwDeviceRenderBitDepth)); + } + } else { + szLastClient = d3dappi.szClient; + w = d3dappi.Mode[mode].w; + h = d3dappi.Mode[mode].h; + d3dappi.szClient.cx = w; d3dappi.szClient.cy = h; + ATTEMPT(D3DAppISetCoopLevel(hwnd, TRUE)); + ATTEMPT(D3DAppISetDisplayMode(w, h, d3dappi.Mode[mode].bpp)); + d3dappi.CurrMode = mode; + ATTEMPT(D3DAppICreateBuffers(hwnd, w, h, d3dappi.Mode[mode].bpp, TRUE, + d3dappi.Driver[driver].bIsHardware)); + } + /* + * If the front buffer is palettized, initialize its palette + */ + ATTEMPT(D3DAppICheckForPalettized()); + /* + * Create the Z-buffer + */ + ATTEMPT(D3DAppICreateZBuffer(w, h, driver)); + /* + * Create the D3D device, load the textures, call the device create + * callback and set a default render state + */ + ATTEMPT(D3DAppICreateDevice(driver)); + ATTEMPT(D3DAppILoadAllTextures()); + ATTEMPT(D3DAppIFilterDisplayModes(driver)); /* bThisDriverCanDo flags */ + ATTEMPT(D3DAppICallDeviceCreateCallback(w, h)); + ATTEMPT(D3DAppISetRenderState()); + /* + * Initialize dirty rectangle information + */ + D3DAppIValidateDirtyRects(); + /* + * Ready to render + */ + bD3DAppInitialized = TRUE; + d3dappi.bRenderingIsOK = TRUE; + return TRUE; + +exit_with_error: + D3DAppICallDeviceDestroyCallback(); + RELEASE(d3dappi.lpD3DDevice); + RELEASE(d3dappi.lpZBuffer); + RELEASE(lpPalette); + RELEASE(lpClipper); + RELEASE(d3dappi.lpBackBuffer); + RELEASE(d3dappi.lpFrontBuffer); + if (d3dappi.bFullscreen) { + D3DAppIRestoreDispMode(); + D3DAppISetCoopLevel(hwnd, FALSE); + } + RELEASE(d3dappi.lpD3D); + RELEASE(d3dappi.lpDD); + return FALSE; +} + +/* + * D3DAppFullscreen + */ +BOOL D3DAppFullscreen(int mode) +{ + int w, h, bpp; + BOOL b; /* was already in a fullscreen mode? */ + + d3dappi.bRenderingIsOK = FALSE; + /* + * Make sure this is a valid request, otherwise doctor mode so it will + * work with this driver. + */ + ATTEMPT(D3DAppIVerifyDriverAndMode(&d3dappi.CurrDriver, &mode)); + /* + * Release everything + */ + ATTEMPT(D3DAppICallDeviceDestroyCallback()); + if (d3dappi.bFullscreen) { + ATTEMPT(D3DAppIClearBuffers()); + } + D3DAppIReleaseAllTextures(); + RELEASE(d3dappi.lpD3DDevice); + RELEASE(d3dappi.lpZBuffer); + RELEASE(lpPalette); + RELEASE(lpClipper); + RELEASE(d3dappi.lpBackBuffer); + RELEASE(d3dappi.lpFrontBuffer); + /* + * Record information about the current status + */ + b = d3dappi.bFullscreen; + w = d3dappi.Mode[mode].w; + h = d3dappi.Mode[mode].h; + bpp = d3dappi.Mode[mode].bpp; + if (!b) { + /* + * If this is not a fullscreen mode, we'll need to record the window + * size for when we return to it. + */ + szLastClient = d3dappi.szClient; + } + /* + * Set the cooperative level and create front and back buffers + */ + d3dappi.szClient.cx = w; d3dappi.szClient.cy = h; + ATTEMPT(D3DAppISetCoopLevel(d3dappi.hwnd, TRUE)); + ATTEMPT(D3DAppISetDisplayMode(w, h, bpp)); + d3dappi.CurrMode = mode; + ATTEMPT(D3DAppICreateBuffers(d3dappi.hwnd, w, h, bpp, TRUE, + d3dappi.Driver[d3dappi.CurrDriver].bIsHardware)); + /* + * If the front buffer is palettized, initialize its palette + */ + ATTEMPT(D3DAppICheckForPalettized()); + /* + * Create the Z-buffer + */ + ATTEMPT(D3DAppICreateZBuffer(w, h, d3dappi.CurrDriver)); + /* + * Create the D3D device, load the textures, call the device create + * callback and set a default render state + */ + ATTEMPT(D3DAppICreateDevice(d3dappi.CurrDriver)); + ATTEMPT(D3DAppILoadAllTextures()); + ATTEMPT(D3DAppICallDeviceCreateCallback(w, h)); + ATTEMPT(D3DAppISetRenderState()); + /* + * Set current mode and clear dirty rectangle information + */ + d3dappi.CurrMode = mode; + D3DAppIValidateDirtyRects(); + d3dappi.bRenderingIsOK = TRUE; + return TRUE; + +exit_with_error: + D3DAppICallDeviceDestroyCallback(); + RELEASE(d3dappi.lpD3DDevice); + RELEASE(d3dappi.lpZBuffer); + RELEASE(lpPalette); + RELEASE(lpClipper); + RELEASE(d3dappi.lpBackBuffer); + RELEASE(d3dappi.lpFrontBuffer); + if (!b) { + D3DAppIRestoreDispMode(); + D3DAppISetCoopLevel(d3dappi.hwnd, FALSE); + } + return FALSE; +} + +/* + * D3DAppWindow + */ +BOOL +D3DAppWindow(int w, int h) +{ + BOOL b; /* changing from a fullscreen mode? */ + + if (!d3dappi.bIsPrimary) { + D3DAppISetErrorString("It is not possible to create a D3D window with a hardware DirectDraw device. Check the bIsPrimary flag before calling D3DAppWindow."); + return FALSE; + } + b = d3dappi.bFullscreen; + /* + * If asked to set the window size, return it to the last value or use + * a default value. + */ + if (w == D3DAPP_YOUDECIDE) { + w = b ? szLastClient.cx : D3DAPP_DEFAULTWINDOWDIM; + } + if (h == D3DAPP_YOUDECIDE) { + h = b ? szLastClient.cy : D3DAPP_DEFAULTWINDOWDIM; + } + /* + * Release everything + */ + d3dappi.bRenderingIsOK = FALSE; + ATTEMPT(D3DAppICallDeviceDestroyCallback()); + if (b) { + ATTEMPT(D3DAppIClearBuffers()); + } + D3DAppIReleaseAllTextures(); + RELEASE(d3dappi.lpD3DDevice); + RELEASE(d3dappi.lpZBuffer); + RELEASE(lpPalette); + RELEASE(lpClipper); + RELEASE(d3dappi.lpBackBuffer); + RELEASE(d3dappi.lpFrontBuffer); + /* + * Restore the display mode if we were in a fullscreen mode + */ + if (b) { + D3DAppIRestoreDispMode(); + } + /* + * Set the cooperative level and create front and back buffers + */ + D3DAppISetCoopLevel(d3dappi.hwnd, FALSE); + D3DAppISetClientSize(d3dappi.hwnd, w, h, b); + ATTEMPT(D3DAppICreateBuffers(d3dappi.hwnd, w, h, D3DAPP_BOGUS, FALSE, + d3dappi.Driver[d3dappi.CurrDriver].bIsHardware)); + /* + * If the front buffer is palettized, initialize its palette + */ + ATTEMPT(D3DAppICheckForPalettized()); + /* + * Create the Z-buffer + */ + ATTEMPT(D3DAppICreateZBuffer(szBuffers.cx, szBuffers.cy, + d3dappi.CurrDriver)); + /* + * Create the D3D device, load the textures, call the device create + * callback and set a default render state + */ + ATTEMPT(D3DAppICreateDevice(d3dappi.CurrDriver)); + ATTEMPT(D3DAppILoadAllTextures()); + ATTEMPT(D3DAppICallDeviceCreateCallback(szBuffers.cx, szBuffers.cy)); + ATTEMPT(D3DAppISetRenderState()); + /* + * Clear dirty rectangle information + */ + D3DAppIValidateDirtyRects(); + d3dappi.bRenderingIsOK = TRUE; + return TRUE; + +exit_with_error: + D3DAppICallDeviceDestroyCallback(); + RELEASE(d3dappi.lpD3DDevice); + RELEASE(d3dappi.lpZBuffer); + RELEASE(lpPalette); + RELEASE(lpClipper); + RELEASE(d3dappi.lpBackBuffer); + RELEASE(d3dappi.lpFrontBuffer); + return FALSE; +} + + +/* + * D3DAppChangeDriver + */ +BOOL +D3DAppChangeDriver(int driver, DWORD flags) +{ + int mode; + + /* + * Verify the compatibility of this mode with the specified driver. + * The mode may change. + */ + if (d3dappi.bFullscreen) + mode = d3dappi.CurrMode; + else + mode = D3DAPP_USEWINDOW; + ATTEMPT(D3DAppIVerifyDriverAndMode(&driver, &mode)); + if (driver == D3DAPP_BOGUS || mode == D3DAPP_BOGUS) + goto exit_with_error; + /* + * Update the current driver and set bThisDriverCanDo flags + */ + d3dappi.CurrDriver = driver; + ATTEMPT(D3DAppIFilterDisplayModes(driver)); + /* + * Either call D3DAppWindow or D3DAppFullscreen depending on mode + */ + if (mode == D3DAPP_USEWINDOW) { + if (d3dappi.bFullscreen) { + /* + * We need to switch to a window. D3DApp will either use the + * size of the last window it saw or use a default size. + */ + ATTEMPT(D3DAppWindow(D3DAPP_YOUDECIDE, D3DAPP_YOUDECIDE)); + } else { + /* + * We need to recreate the current window. Don't let D3DApp + * decide on the size. + */ + ATTEMPT(D3DAppWindow(d3dappi.szClient.cx, d3dappi.szClient.cy)); + } + /* + * Change the currently selected mode if it's not compatible with + * this driver. Just to make sure that CurrMode is always a mode the + * current driver can do. + */ + if (!(d3dappi.Driver[driver].Desc.dwDeviceRenderBitDepth & + D3DAppIBPPToDDBD(d3dappi.Mode[d3dappi.CurrMode].bpp))){ + ATTEMPT(D3DAppIPickDisplayMode(&d3dappi.CurrMode, + d3dappi.Driver[driver].Desc.dwDeviceRenderBitDepth)); + } + return TRUE; + } else { + /* + * We need to switch to fullscreen or switch fullscreen modes or stay + * in the same fullscreen mode. In any of these cases, we call the + * same function. + */ + ATTEMPT(D3DAppFullscreen(mode)); + return TRUE; + } + +exit_with_error: + /* + * The failed mode setting call would have released everything + */ + return FALSE; +} + + +/* + * D3DAppWindowProc + */ +BOOL +D3DAppWindowProc(BOOL* bStopProcessing, LRESULT* lresult, HWND hwnd, + UINT message, WPARAM wParam, LPARAM lParam) +{ + PAINTSTRUCT ps; + *bStopProcessing = FALSE; + if (!bD3DAppInitialized) + return TRUE; + /* + * Look for messages which effect rendering. In some cases, we will not + * want the app to continue processing the message, so set the flag and + * provide a return value in lresult. + */ + switch(message) { + case WM_SIZE: + if (!bIgnoreWM_SIZE) { + /* + * Too long to fit here, see ddcalls.c. Updates the buffers + * and re-creates the device. + */ + ATTEMPT(D3DAppIHandleWM_SIZE(lresult, d3dappi.hwnd, message, + wParam, lParam)); + *bStopProcessing = TRUE; + } + break; + case WM_MOVE: + /* + * Update client window position information + */ + d3dappi.pClientOnPrimary.x = d3dappi.pClientOnPrimary.y = 0; + ClientToScreen(hwnd, &d3dappi.pClientOnPrimary); + break; + case WM_ACTIVATE: + /* + * Set the front buffer's palette + */ + if (bPaletteActivate && bPrimaryPalettized && + d3dappi.lpFrontBuffer) { + d3dappi.lpFrontBuffer->lpVtbl->SetPalette(d3dappi.lpFrontBuffer, + lpPalette); + } + break; + case WM_ACTIVATEAPP: + d3dappi.bAppActive = (BOOL)wParam; + break; + case WM_SETCURSOR: + /* + * Prevent the cursor from being shown in fullscreen + */ + if (d3dappi.bFullscreen && !d3dappi.bPaused) { + SetCursor(NULL); + *lresult = 1; + *bStopProcessing = TRUE; + return TRUE; + } + break; + case WM_MOVING: + /* + * Prevent the window from moving in fullscreen + */ + if (d3dappi.bFullscreen) { + GetWindowRect(hwnd, (LPRECT)lParam); + *lresult = 1; + *bStopProcessing = TRUE; + return TRUE; + } + break; + case WM_GETMINMAXINFO: + /* + * Ensure the window won't resize in fullscreen + */ + if (d3dappi.bFullscreen) { + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x= d3dappi.ThisMode.w; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y= d3dappi.ThisMode.h; + ((LPMINMAXINFO)lParam)->ptMinTrackSize.x= d3dappi.ThisMode.w; + ((LPMINMAXINFO)lParam)->ptMinTrackSize.y= d3dappi.ThisMode.h; + *lresult = 0; + *bStopProcessing = TRUE; + return TRUE; + } else { + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = + d3dappi.WindowsDisplay.w; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = + d3dappi.WindowsDisplay.h; + *lresult = 0; + *bStopProcessing = TRUE; + return TRUE; + } + break; + case WM_PAINT: + /* + * Clear the rectangle and blt the backbuffer image + */ + BeginPaint(hwnd, &ps); + if (d3dappi.bRenderingIsOK && !d3dappi.bFullscreen) { + D3DAppShowBackBuffer(D3DAPP_SHOWALL); + } + D3DAppIValidateDirtyRects(); + EndPaint(hwnd, &ps); + *lresult = 1; + *bStopProcessing = TRUE; + return TRUE; + case WM_NCPAINT: + /* + * When in fullscreen mode, don't draw the window frame. + */ + if (d3dappi.bFullscreen && !d3dappi.bPaused) { + *lresult = 0; + *bStopProcessing = TRUE; + return TRUE; + } + break; + } + return TRUE; + +exit_with_error: + return FALSE; +} + +/* + * D3DAppAddTexture + */ +BOOL +D3DAppAddTexture(const char* imagefile) +{ + if (d3dappi.NumTextures == D3DAPP_MAXTEXTURES - 1) { + D3DAppISetErrorString("Can only load %i textures.", D3DAPP_MAXTEXTURES); + return FALSE; + } + lstrcpy(d3dappi.ImageFile[d3dappi.NumTextures], imagefile); + /* + * If this driver does texture mapping, load the texture. + * This test also tests that a device has been created. + */ + if (d3dappi.ThisDriver.bDoesTextures && d3dappi.NumUsableTextures == d3dappi.NumTextures) { + BOOL bInVideo; + ATTEMPT(D3DAppILoadTextureSurf(d3dappi.NumTextures, &bInVideo)); + if (!bInVideo && d3dappi.ThisDriver.bIsHardware) { + D3DAppIReleaseTexture(d3dappi.NumTextures); + } else { + ATTEMPT(D3DAppIGetTextureHandle(d3dappi.NumTextures)); + ++d3dappi.NumUsableTextures; + } + } + d3dappi.NumTextures++; + return TRUE; + +exit_with_error: + d3dappi.ImageFile[d3dappi.NumTextures][0] = 0; + return FALSE; +} + +/* + * D3DAppChangeTextureFormat + */ +BOOL +D3DAppChangeTextureFormat(int format) +{ + /* + * Release all the textures, change the format and load them again + */ + d3dappi.bRenderingIsOK = FALSE; + D3DAppIReleaseAllTextures(); + d3dappi.CurrTextureFormat = format; + memcpy(&d3dappi.ThisTextureFormat, &d3dappi.TextureFormat[format], + sizeof(D3DAppTextureFormat)); + ATTEMPT(D3DAppILoadAllTextures()); + d3dappi.bRenderingIsOK = TRUE; + return TRUE; + +exit_with_error: + D3DAppIReleaseAllTextures(); + return FALSE; +} + +/* + * D3DAppDisableTextures + */ +BOOL +D3DAppDisableTextures(BOOL flag) +{ + int i; + if (flag == d3dappi.bTexturesDisabled) + return TRUE; + if (flag) { + /* + * Set all the texture handles to 0 + */ + d3dappi.bTexturesDisabled = TRUE; + for (i = 0; i < d3dappi.NumTextures; i++) + d3dappi.TextureHandle[i] = 0; + } else { + /* + * Restore the texture handles from the master array + */ + d3dappi.bTexturesDisabled = FALSE; + memcpy(d3dappi.TextureHandle, MasterTextureHandle, + sizeof(D3DTEXTUREHANDLE) * D3DAPP_MAXTEXTURES); + } + return TRUE; +} + +/* + * D3DAppSwapTextures + */ +BOOL +D3DAppSwapTextures() +{ + int i; + char tempfile[30]; + LPDIRECT3DTEXTURE lptempTexture; + LPDIRECTDRAWSURFACE lptempSurface; + if (d3dappi.bTexturesDisabled || d3dappi.NumTextures == 0) { + D3DAppISetErrorString("Cannot swap textures which are disable or not loaded.\n"); + goto exit_with_error; + } + if (!d3dappi.ThisDriver.bDoesTextures) + return TRUE; + /* + * Swap texture 1 with 2, then 2 with 3, then 3 with 4, etc. + * Don't forget the image file names, texture objects and surfaces + */ + for (i = 0; i < d3dappi.NumUsableTextures - 1; i++) { + lstrcpy(tempfile, d3dappi.ImageFile[i]); + lstrcpy(d3dappi.ImageFile[i], d3dappi.ImageFile[i+1]); + lstrcpy(d3dappi.ImageFile[i+1], tempfile); + d3dappi.lpD3DDevice->lpVtbl->SwapTextureHandles(d3dappi.lpD3DDevice, + d3dappi.lpTexture[i], + d3dappi.lpTexture[i+1]); + lptempTexture = d3dappi.lpTexture[i]; + d3dappi.lpTexture[i] = d3dappi.lpTexture[i+1]; + d3dappi.lpTexture[i+1] = lptempTexture; + lptempSurface = d3dappi.lpTextureSurf[i]; + d3dappi.lpTextureSurf[i] = d3dappi.lpTextureSurf[i+1]; + d3dappi.lpTextureSurf[i+1] = lptempSurface; + } + return TRUE; +exit_with_error: + return FALSE; +} + +/* + * D3DAppSetRenderState + */ +BOOL +D3DAppSetRenderState(D3DAppRenderState* lpState) +{ + /* + * If none was provided, reset the current render state. + */ + if (!lpState) + lpState = &d3dapprs; + /* + * Record this render state and set it. + */ + if (lpState != &d3dapprs) + memcpy(&d3dapprs, lpState, sizeof(D3DAppRenderState)); + if (d3dappi.bRenderingIsOK) { + ATTEMPT(D3DAppISetRenderState()); + } + return TRUE; + +exit_with_error: + return FALSE; +} + +/* + * D3DAppGetRenderState + */ +BOOL +D3DAppGetRenderState(D3DAppRenderState* lpState) +{ + memcpy(lpState, &d3dapprs, sizeof(D3DAppRenderState)); + return TRUE; +} + +/* + * D3DAppShowBackBuffer + */ +BOOL +D3DAppShowBackBuffer(DWORD flags) +{ + if (!d3dappi.bRenderingIsOK) { + D3DAppISetErrorString("Cannot call D3DAppShowBackBuffer while bRenderingIsOK is FALSE.\n"); + return FALSE; + } + if (d3dappi.bPaused) + return TRUE; + if (d3dappi.bFullscreen) { + int numtemp; + D3DRECT temp[D3DAPP_MAXCLEARRECTS]; + /* + * Flip the back and front buffers + */ + LastError = d3dappi.lpFrontBuffer->lpVtbl->Flip(d3dappi.lpFrontBuffer, + d3dappi.lpBackBuffer, + 1); + if (LastError == DDERR_SURFACELOST) { + d3dappi.lpFrontBuffer->lpVtbl->Restore(d3dappi.lpFrontBuffer); + d3dappi.lpBackBuffer->lpVtbl->Restore(d3dappi.lpBackBuffer); + D3DAppIClearBuffers(); + } else if (LastError != DD_OK) { + D3DAppISetErrorString("Flipping complex display surface failed.\n%s", D3DAppErrorToString(LastError)); + return FALSE; + } + if (d3dappi.bBackBufferInVideo) { + /* + * This is a real flip, so the client and back buffer dirty + * rectangles also flip + */ + D3DAppICopyRectList(&numtemp, temp, NumDirtyClientRects, + DirtyClient); + D3DAppICopyRectList(&NumDirtyClientRects, DirtyClient, + NumDirtyBackRects, DirtyBack); + D3DAppICopyRectList(&NumDirtyBackRects, DirtyBack, numtemp, temp); + } else { + /* + * The flip is being emulated as a blt from a system memory back + * buffer, so the back buffer's dirty rectangles are now also the + * client's. + */ + D3DAppICopyRectList(&NumDirtyClientRects, DirtyClient, + NumDirtyBackRects, DirtyBack); + } + } else { + int NumFrontRects, NumBufferRects, i; + RECT front[D3DAPP_MAXCLEARRECTS]; + RECT buffer[D3DAPP_MAXCLEARRECTS]; + /* + * Set the rectangle to blt from the back to front bufer + */ + if (flags & D3DAPP_SHOWALL) { + /* + * Set to entire client window + */ + NumBufferRects = 1; + SetRect(&buffer[0], 0, 0, d3dappi.szClient.cx, + d3dappi.szClient.cy); + SetRect(&front[0], + d3dappi.pClientOnPrimary.x, d3dappi.pClientOnPrimary.y, + d3dappi.szClient.cx + d3dappi.pClientOnPrimary.x, + d3dappi.szClient.cy + d3dappi.pClientOnPrimary.y); + } else { + /* + * Merge the back and front buffer dirty rectangle lists to get + * a list of rectangles to blt. This will simultaneously clear + * the smallest front buffer region while blt'ing all the back + * buffer which changed. + */ + D3DAppIMergeRectLists(&NumBufferRects, (LPD3DRECT)buffer, + NumDirtyClientRects, DirtyClient, + NumDirtyBackRects, DirtyBack); + D3DAppICopyRectList(&NumFrontRects, (LPD3DRECT)front, + NumBufferRects, (LPD3DRECT)buffer); + for (i = 0; i < NumFrontRects; i++) { + front[i].top += d3dappi.pClientOnPrimary.y; + front[i].left += d3dappi.pClientOnPrimary.x; + front[i].bottom += d3dappi.pClientOnPrimary.y; + front[i].right += d3dappi.pClientOnPrimary.x; + } + } + /* + * Blt the list of rectangles from the back to front buffer + */ + for (i = 0; i < NumBufferRects; i++) { + LastError = + d3dappi.lpFrontBuffer->lpVtbl->Blt(d3dappi.lpFrontBuffer, + &front[i], d3dappi.lpBackBuffer, + &buffer[i], DDBLT_WAIT, NULL); + if (LastError == DDERR_SURFACELOST) { + d3dappi.lpFrontBuffer->lpVtbl->Restore(d3dappi.lpFrontBuffer); + d3dappi.lpBackBuffer->lpVtbl->Restore(d3dappi.lpBackBuffer); + D3DAppIClearBuffers(); + } else if (LastError != DD_OK) { + D3DAppISetErrorString("Blt of back buffer to front buffer failed.\n%s", D3DAppErrorToString(LastError)); + return FALSE; + } + } + /* + * The back buffer's dirty rectangles are now also the client's + */ + D3DAppICopyRectList(&NumDirtyClientRects, DirtyClient, + NumDirtyBackRects, DirtyBack); + } + return TRUE; +} + +/* + * D3DAppRenderExtents + */ +BOOL +D3DAppRenderExtents(DWORD dwCount, LPD3DRECT extent, DWORD flags) +{ + if (dwCount > D3DAPP_MAXCLEARRECTS) { + D3DAppISetErrorString("The number of clear rectangles exceeded D3DAPP_MAXCLEARRECTS."); + return FALSE; + } + if (flags & D3DAPP_CLEARALL) { + /* + * Set the back buffer dirty rectangle to the entire client area + */ + D3DRECT dummy; + dummy.x1 = dummy.y1 = 0; + dummy.x2 = d3dappi.szClient.cx; + dummy.y2 = d3dappi.szClient.cy; + D3DAppICopyRectList(&NumDirtyBackRects, DirtyBack, 1, &dummy); + D3DAppICopyRectList(&NumDirtyClientRects, DirtyClient, 1, &dummy); + D3DAppICopyRectList(&NumDirtyZRects, DirtyZ, 1, &dummy); + } else { + /* + * Set the back and Z buffer dirty rectangle list as specified + */ + D3DAppICopyRectList(&NumDirtyBackRects, DirtyBack, dwCount, extent); + D3DAppICopyRectList(&NumDirtyZRects, DirtyZ, dwCount, extent); + } + return TRUE; +} + +/* + * D3DAppClearBackBuffer + */ +BOOL +D3DAppClearBackBuffer(DWORD flags) +{ + if (!d3dappi.bRenderingIsOK) { + D3DAppISetErrorString("Cannot call D3DAppClearBackBuffer while bRenderingIsOK is FALSE.\n"); + return FALSE; + } + if (flags & D3DAPP_CLEARALL) { + /* + * Clear the entire back buffer + */ + int clearflags; + D3DRECT dummy; + /* + * Decided wether to clear just back buffer or also z-buffer + */ + clearflags = D3DCLEAR_TARGET; + if (d3dapprs.bZBufferOn) + clearflags |= D3DCLEAR_ZBUFFER; + dummy.x1 = dummy.y1 = 0; + dummy.x2 = d3dappi.szClient.cx; + dummy.y2 = d3dappi.szClient.cy; + LastError = + d3dappi.lpD3DViewport->lpVtbl->Clear(d3dappi.lpD3DViewport, + 1, &dummy, + clearflags); + if (LastError != D3D_OK) { + D3DAppISetErrorString("Viewport clear failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + } else { + /* + * Clear the dirty rectangles on the back buffer + */ + LastError = + d3dappi.lpD3DViewport->lpVtbl->Clear(d3dappi.lpD3DViewport, + NumDirtyBackRects, + DirtyBack, D3DCLEAR_TARGET); + if (LastError != D3D_OK) { + D3DAppISetErrorString("Viewport clear of back buffer failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + /* + * Clear the dirty rectangles on the Z buffer + */ + LastError = + d3dappi.lpD3DViewport->lpVtbl->Clear(d3dappi.lpD3DViewport, + NumDirtyZRects, + DirtyZ, D3DCLEAR_ZBUFFER); + if (LastError != D3D_OK) { + D3DAppISetErrorString("Viewport clear of Z buffer failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + + } + return TRUE; +} + +/* + * D3DAppCheckForLostSurfaces + */ +#define CHECKSURF(x) if (x) { \ + if (x->lpVtbl->IsLost(x) == DDERR_SURFACELOST) { \ + LastError = x->lpVtbl->Restore(x); \ + if (LastError != DD_OK) goto exit_with_error; \ + b = TRUE; \ + } \ + } +BOOL +D3DAppCheckForLostSurfaces(void) +{ + int i; + BOOL b = FALSE; + /* + * Check all the surfaces D3DApp owns and restore them if lost. + */ + CHECKSURF(d3dappi.lpFrontBuffer); + CHECKSURF(d3dappi.lpBackBuffer); + CHECKSURF(d3dappi.lpZBuffer); + if (b) { + /* + * If any of the surfaces were lost and restored, clear all the buffers. + * If this fails, that's fine, just move on. + */ + D3DAppIClearBuffers(); + } + for (i = 0; i < d3dappi.NumUsableTextures; i++) { + b = FALSE; + CHECKSURF(d3dappi.lpTextureSurf[i]); + if (b) { + ATTEMPT(D3DAppIReloadTextureSurf(i)); + } + } + return TRUE; + +exit_with_error: + D3DAppISetErrorString("Restoring of a lost surface failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; +} + +/* + * D3DAppPause + */ +BOOL +D3DAppPause(BOOL flag) +{ + static int pausecount; + + /* + * Keep a count of the number of times D3DAppPause has been called to + * prevent pausing more than once in a row. + */ + if (pausecount != 0) { + if (flag) { + ++pausecount; + return TRUE; + } else { + --pausecount; + if (pausecount != 0) + return TRUE; + } + } + + d3dappi.bPaused = flag; + if (!flag) { + /* + * Returning from a pause + */ + if (d3dappi.bFullscreen && bPrimaryPalettized && lpPalette) { + /* + * Set front buffer's palette back to what it was before pause + */ + LastError = lpPalette->lpVtbl->SetEntries(lpPalette, 0, 0, 256, + &ppe[0]); + if (LastError != DD_OK) { + D3DAppISetErrorString("Setting palette entries during unpause failed.\n%s", D3DAppErrorToString(LastError)); + goto exit_with_error; + } + } + /* + * Dirty rectangle info is no longer valid + */ + D3DAppIValidateDirtyRects(); + } + if (flag && d3dappi.bFullscreen) { + /* + * Pausing in a fullscreen mode + */ + if (bPrimaryPalettized && lpPalette) { + /* + * Save the front buffer's current palette and restore the + * original Windows palette. + */ + int i; + LastError = lpPalette->lpVtbl->GetEntries(lpPalette, 0, 0, 256, + &ppe[0]); + if (LastError != DD_OK) { + D3DAppISetErrorString("Getting palette entries before a pause failed.\n%s", D3DAppErrorToString(LastError)); + goto exit_with_error; + } + for (i = 10; i < 246; i++) + Originalppe[i] = ppe[i]; + LastError = lpPalette->lpVtbl->SetEntries(lpPalette, 0, 0, 256, + &Originalppe[0]); + if (LastError != DD_OK) { + D3DAppISetErrorString("Returning palette entries to defaults failed.\n%s", D3DAppErrorToString(LastError)); + goto exit_with_error; + } + } + /* + * Flip to GDI surface (either front or back buffer) + */ + if (d3dappi.bIsPrimary && d3dappi.lpDD) { + LastError = d3dappi.lpDD->lpVtbl->FlipToGDISurface(d3dappi.lpDD); + if (LastError != DD_OK) { + D3DAppISetErrorString("Flipping to GDI surface failed.\n%s", D3DAppErrorToString(LastError)); + goto exit_with_error; + } + } + /* + * Draw the menu and frame + */ + DrawMenuBar(d3dappi.hwnd); + RedrawWindow(d3dappi.hwnd, NULL, NULL, RDW_FRAME); + } + return TRUE; +exit_with_error: + return FALSE; +} + +/* + * D3DAppCreateSurface + */ +BOOL +D3DAppCreateSurface(DDSURFACEDESC *ddsd, LPDIRECTDRAWSURFACE *lplpSurf) +{ + return D3DAppICreateSurface(ddsd, lplpSurf); +} + +/* + * D3DAppLastError + */ +HRESULT +D3DAppLastError(void) +{ + return LastError; +} + +/* + * D3DAppLastD3DAppISetErrorString + */ +char* +D3DAppLastErrorString(void) +{ + return LastErrorString; +} + + +/* + * D3DAppDestroy + */ +BOOL +D3DAppDestroy(void) +{ + /* + * Destroys all objects including Direct Draw. + */ + d3dappi.bRenderingIsOK = FALSE; + d3dappi.hwnd = NULL; + ATTEMPT(D3DAppICallDeviceDestroyCallback()); + D3DAppIReleaseAllTextures(); + RELEASE(d3dappi.lpD3DDevice); + RELEASE(d3dappi.lpZBuffer); + RELEASE(lpPalette); + RELEASE(lpClipper); + RELEASE(d3dappi.lpBackBuffer); + RELEASE(d3dappi.lpFrontBuffer); + if (d3dappi.bFullscreen) { + D3DAppIRestoreDispMode(); + D3DAppISetCoopLevel(d3dappi.hwnd, FALSE); + } + D3DAppIReleasePathList(); + RELEASE(d3dappi.lpD3D); + RELEASE(d3dappi.lpDD); + return TRUE; +exit_with_error: + return FALSE; +} + + +/* + * D3DAppErrorToString + */ +char* +D3DAppErrorToString(HRESULT error) +{ + switch(error) { + case DD_OK: + return "No error.\0"; + case DDERR_ALREADYINITIALIZED: + return "This object is already initialized.\0"; + case DDERR_BLTFASTCANTCLIP: + return "Return if a clipper object is attached to the source surface passed into a BltFast call.\0"; + case DDERR_CANNOTATTACHSURFACE: + return "This surface can not be attached to the requested surface.\0"; + case DDERR_CANNOTDETACHSURFACE: + return "This surface can not be detached from the requested surface.\0"; + case DDERR_CANTCREATEDC: + return "Windows can not create any more DCs.\0"; + case DDERR_CANTDUPLICATE: + return "Can't duplicate primary & 3D surfaces, or surfaces that are implicitly created.\0"; + case DDERR_CLIPPERISUSINGHWND: + return "An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd.\0"; + case DDERR_COLORKEYNOTSET: + return "No src color key specified for this operation.\0"; + case DDERR_CURRENTLYNOTAVAIL: + return "Support is currently not available.\0"; + case DDERR_DIRECTDRAWALREADYCREATED: + return "A DirectDraw object representing this driver has already been created for this process.\0"; + case DDERR_EXCEPTION: + return "An exception was encountered while performing the requested operation.\0"; + case DDERR_EXCLUSIVEMODEALREADYSET: + return "An attempt was made to set the cooperative level when it was already set to exclusive.\0"; + case DDERR_GENERIC: + return "Generic failure.\0"; + case DDERR_HEIGHTALIGN: + return "Height of rectangle provided is not a multiple of reqd alignment.\0"; + case DDERR_HWNDALREADYSET: + return "The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or palettes created.\0"; + case DDERR_HWNDSUBCLASSED: + return "HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring state.\0"; + case DDERR_IMPLICITLYCREATED: + return "This surface can not be restored because it is an implicitly created surface.\0"; + case DDERR_INCOMPATIBLEPRIMARY: + return "Unable to match primary surface creation request with existing primary surface.\0"; + case DDERR_INVALIDCAPS: + return "One or more of the caps bits passed to the callback are incorrect.\0"; + case DDERR_INVALIDCLIPLIST: + return "DirectDraw does not support the provided cliplist.\0"; + case DDERR_INVALIDDIRECTDRAWGUID: + return "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier.\0"; + case DDERR_INVALIDMODE: + return "DirectDraw does not support the requested mode.\0"; + case DDERR_INVALIDOBJECT: + return "DirectDraw received a pointer that was an invalid DIRECTDRAW object.\0"; + case DDERR_INVALIDPARAMS: + return "One or more of the parameters passed to the function are incorrect.\0"; + case DDERR_INVALIDPIXELFORMAT: + return "The pixel format was invalid as specified.\0"; + case DDERR_INVALIDPOSITION: + return "Returned when the position of the overlay on the destination is no longer legal for that destination.\0"; + case DDERR_INVALIDRECT: + return "Rectangle provided was invalid.\0"; + case DDERR_LOCKEDSURFACES: + return "Operation could not be carried out because one or more surfaces are locked.\0"; + case DDERR_NO3D: + return "There is no 3D present.\0"; + case DDERR_NOALPHAHW: + return "Operation could not be carried out because there is no alpha accleration hardware present or available.\0"; + case DDERR_NOBLTHW: + return "No blitter hardware present.\0"; + case DDERR_NOCLIPLIST: + return "No cliplist available.\0"; + case DDERR_NOCLIPPERATTACHED: + return "No clipper object attached to surface object.\0"; + case DDERR_NOCOLORCONVHW: + return "Operation could not be carried out because there is no color conversion hardware present or available.\0"; + case DDERR_NOCOLORKEY: + return "Surface doesn't currently have a color key\0"; + case DDERR_NOCOLORKEYHW: + return "Operation could not be carried out because there is no hardware support of the destination color key.\0"; + case DDERR_NOCOOPERATIVELEVELSET: + return "Create function called without DirectDraw object method SetCooperativeLevel being called.\0"; + case DDERR_NODC: + return "No DC was ever created for this surface.\0"; + case DDERR_NODDROPSHW: + return "No DirectDraw ROP hardware.\0"; + case DDERR_NODIRECTDRAWHW: + return "A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware.\0"; + case DDERR_NOEMULATION: + return "Software emulation not available.\0"; + case DDERR_NOEXCLUSIVEMODE: + return "Operation requires the application to have exclusive mode but the application does not have exclusive mode.\0"; + case DDERR_NOFLIPHW: + return "Flipping visible surfaces is not supported.\0"; + case DDERR_NOGDI: + return "There is no GDI present.\0"; + case DDERR_NOHWND: + return "Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND.\0"; + case DDERR_NOMIRRORHW: + return "Operation could not be carried out because there is no hardware present or available.\0"; + case DDERR_NOOVERLAYDEST: + return "Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on to establish a destination.\0"; + case DDERR_NOOVERLAYHW: + return "Operation could not be carried out because there is no overlay hardware present or available.\0"; + case DDERR_NOPALETTEATTACHED: + return "No palette object attached to this surface.\0"; + case DDERR_NOPALETTEHW: + return "No hardware support for 16 or 256 color palettes.\0"; + case DDERR_NORASTEROPHW: + return "Operation could not be carried out because there is no appropriate raster op hardware present or available.\0"; + case DDERR_NOROTATIONHW: + return "Operation could not be carried out because there is no rotation hardware present or available.\0"; + case DDERR_NOSTRETCHHW: + return "Operation could not be carried out because there is no hardware support for stretching.\0"; + case DDERR_NOT4BITCOLOR: + return "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette.\0"; + case DDERR_NOT4BITCOLORINDEX: + return "DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette.\0"; + case DDERR_NOT8BITCOLOR: + return "DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color.\0"; + case DDERR_NOTAOVERLAYSURFACE: + return "Returned when an overlay member is called for a non-overlay surface.\0"; + case DDERR_NOTEXTUREHW: + return "Operation could not be carried out because there is no texture mapping hardware present or available.\0"; + case DDERR_NOTFLIPPABLE: + return "An attempt has been made to flip a surface that is not flippable.\0"; + case DDERR_NOTFOUND: + return "Requested item was not found.\0"; + case DDERR_NOTLOCKED: + return "Surface was not locked. An attempt to unlock a surface that was not locked at all, or by this process, has been attempted.\0"; + case DDERR_NOTPALETTIZED: + return "The surface being used is not a palette-based surface.\0"; + case DDERR_NOVSYNCHW: + return "Operation could not be carried out because there is no hardware support for vertical blank synchronized operations.\0"; + case DDERR_NOZBUFFERHW: + return "Operation could not be carried out because there is no hardware support for zbuffer blitting.\0"; + case DDERR_NOZOVERLAYHW: + return "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays.\0"; + case DDERR_OUTOFCAPS: + return "The hardware needed for the requested operation has already been allocated.\0"; + case DDERR_OUTOFMEMORY: + return "DirectDraw does not have enough memory to perform the operation.\0"; + case DDERR_OUTOFVIDEOMEMORY: + return "DirectDraw does not have enough memory to perform the operation.\0"; + case DDERR_OVERLAYCANTCLIP: + return "The hardware does not support clipped overlays.\0"; + case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: + return "Can only have ony color key active at one time for overlays.\0"; + case DDERR_OVERLAYNOTVISIBLE: + return "Returned when GetOverlayPosition is called on a hidden overlay.\0"; + case DDERR_PALETTEBUSY: + return "Access to this palette is being refused because the palette is already locked by another thread.\0"; + case DDERR_PRIMARYSURFACEALREADYEXISTS: + return "This process already has created a primary surface.\0"; + case DDERR_REGIONTOOSMALL: + return "Region passed to Clipper::GetClipList is too small.\0"; + case DDERR_SURFACEALREADYATTACHED: + return "This surface is already attached to the surface it is being attached to.\0"; + case DDERR_SURFACEALREADYDEPENDENT: + return "This surface is already a dependency of the surface it is being made a dependency of.\0"; + case DDERR_SURFACEBUSY: + return "Access to this surface is being refused because the surface is already locked by another thread.\0"; + case DDERR_SURFACEISOBSCURED: + return "Access to surface refused because the surface is obscured.\0"; + case DDERR_SURFACELOST: + return "Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it.\0"; + case DDERR_SURFACENOTATTACHED: + return "The requested surface is not attached.\0"; + case DDERR_TOOBIGHEIGHT: + return "Height requested by DirectDraw is too large.\0"; + case DDERR_TOOBIGSIZE: + return "Size requested by DirectDraw is too large, but the individual height and width are OK.\0"; + case DDERR_TOOBIGWIDTH: + return "Width requested by DirectDraw is too large.\0"; + case DDERR_UNSUPPORTED: + return "Action not supported.\0"; + case DDERR_UNSUPPORTEDFORMAT: + return "FOURCC format requested is unsupported by DirectDraw.\0"; + case DDERR_UNSUPPORTEDMASK: + return "Bitmask in the pixel format requested is unsupported by DirectDraw.\0"; + case DDERR_VERTICALBLANKINPROGRESS: + return "Vertical blank is in progress.\0"; + case DDERR_WASSTILLDRAWING: + return "Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete.\0"; + case DDERR_WRONGMODE: + return "This surface can not be restored because it was created in a different mode.\0"; + case DDERR_XALIGN: + return "Rectangle provided was not horizontally aligned on required boundary.\0"; + case D3DERR_BADMAJORVERSION: + return "D3DERR_BADMAJORVERSION\0"; + case D3DERR_BADMINORVERSION: + return "D3DERR_BADMINORVERSION\0"; + case D3DERR_EXECUTE_LOCKED: + return "D3DERR_EXECUTE_LOCKED\0"; + case D3DERR_EXECUTE_NOT_LOCKED: + return "D3DERR_EXECUTE_NOT_LOCKED\0"; + case D3DERR_EXECUTE_CREATE_FAILED: + return "D3DERR_EXECUTE_CREATE_FAILED\0"; + case D3DERR_EXECUTE_DESTROY_FAILED: + return "D3DERR_EXECUTE_DESTROY_FAILED\0"; + case D3DERR_EXECUTE_LOCK_FAILED: + return "D3DERR_EXECUTE_LOCK_FAILED\0"; + case D3DERR_EXECUTE_UNLOCK_FAILED: + return "D3DERR_EXECUTE_UNLOCK_FAILED\0"; + case D3DERR_EXECUTE_FAILED: + return "D3DERR_EXECUTE_FAILED\0"; + case D3DERR_EXECUTE_CLIPPED_FAILED: + return "D3DERR_EXECUTE_CLIPPED_FAILED\0"; + case D3DERR_TEXTURE_NO_SUPPORT: + return "D3DERR_TEXTURE_NO_SUPPORT\0"; + case D3DERR_TEXTURE_NOT_LOCKED: + return "D3DERR_TEXTURE_NOT_LOCKED\0"; + case D3DERR_TEXTURE_LOCKED: + return "D3DERR_TEXTURELOCKED\0"; + case D3DERR_TEXTURE_CREATE_FAILED: + return "D3DERR_TEXTURE_CREATE_FAILED\0"; + case D3DERR_TEXTURE_DESTROY_FAILED: + return "D3DERR_TEXTURE_DESTROY_FAILED\0"; + case D3DERR_TEXTURE_LOCK_FAILED: + return "D3DERR_TEXTURE_LOCK_FAILED\0"; + case D3DERR_TEXTURE_UNLOCK_FAILED: + return "D3DERR_TEXTURE_UNLOCK_FAILED\0"; + case D3DERR_TEXTURE_LOAD_FAILED: + return "D3DERR_TEXTURE_LOAD_FAILED\0"; + case D3DERR_MATRIX_CREATE_FAILED: + return "D3DERR_MATRIX_CREATE_FAILED\0"; + case D3DERR_MATRIX_DESTROY_FAILED: + return "D3DERR_MATRIX_DESTROY_FAILED\0"; + case D3DERR_MATRIX_SETDATA_FAILED: + return "D3DERR_MATRIX_SETDATA_FAILED\0"; + case D3DERR_SETVIEWPORTDATA_FAILED: + return "D3DERR_SETVIEWPORTDATA_FAILED\0"; + case D3DERR_MATERIAL_CREATE_FAILED: + return "D3DERR_MATERIAL_CREATE_FAILED\0"; + case D3DERR_MATERIAL_DESTROY_FAILED: + return "D3DERR_MATERIAL_DESTROY_FAILED\0"; + case D3DERR_MATERIAL_SETDATA_FAILED: + return "D3DERR_MATERIAL_SETDATA_FAILED\0"; + case D3DERR_LIGHT_SET_FAILED: + return "D3DERR_LIGHT_SET_FAILED\0"; + case D3DRMERR_BADOBJECT: + return "D3DRMERR_BADOBJECT\0"; + case D3DRMERR_BADTYPE: + return "D3DRMERR_BADTYPE\0"; + case D3DRMERR_BADALLOC: + return "D3DRMERR_BADALLOC\0"; + case D3DRMERR_FACEUSED: + return "D3DRMERR_FACEUSED\0"; + case D3DRMERR_NOTFOUND: + return "D3DRMERR_NOTFOUND\0"; + case D3DRMERR_NOTDONEYET: + return "D3DRMERR_NOTDONEYET\0"; + case D3DRMERR_FILENOTFOUND: + return "The file was not found.\0"; + case D3DRMERR_BADFILE: + return "D3DRMERR_BADFILE\0"; + case D3DRMERR_BADDEVICE: + return "D3DRMERR_BADDEVICE\0"; + case D3DRMERR_BADVALUE: + return "D3DRMERR_BADVALUE\0"; + case D3DRMERR_BADMAJORVERSION: + return "D3DRMERR_BADMAJORVERSION\0"; + case D3DRMERR_BADMINORVERSION: + return "D3DRMERR_BADMINORVERSION\0"; + case D3DRMERR_UNABLETOEXECUTE: + return "D3DRMERR_UNABLETOEXECUTE\0"; + default: + return "Unrecognized error value.\0"; + } +} diff --git a/sdk/samples/misc/d3dapp.h b/sdk/samples/misc/d3dapp.h new file mode 100644 index 0000000..e00f159 --- /dev/null +++ b/sdk/samples/misc/d3dapp.h @@ -0,0 +1,430 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dapp.h + * + * Header to be included in source using D3DApp. Contains D3DApp function + * prototypes and defines. + * + * D3DApp is a collection of helper functions for Direct3D applications. + * D3DApp consists of the following files: + * d3dapp.h Main D3DApp header to be included by application + * d3dappi.h Internal header + * d3dapp.c D3DApp functions seen by application. + * ddcalls.c All calls to DirectDraw objects except textures + * d3dcalls.c All calls to Direct3D objects except textures + * texture.c Texture loading and managing texture list + * misc.c Miscellaneous calls + */ + +#ifndef __D3DAPP_H__ +#define __D3DAPP_H__ + +#define INITGUID + +#include <ddraw.h> +#include <d3d.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * DEFINES + */ +#define D3DAPP_WINDOWMINIMUM 50 /* smallest buffer size allowed */ +#define D3DAPP_DEFAULTWINDOWDIM 320 /* replaces window size if invalid */ +#define D3DAPP_MINBUFFERSIZE 15360 /* minimum "maximum buffer size" for a + D3D driver to be accepted */ +#define D3DAPP_MINVERTEXCOUNT 320 /* minimum "maximum vertex count" for a + D3D driver to be accepted */ +#define D3DAPP_MAXD3DDRIVERS 5 /* maximum Direct3D drivers ever expected + to find */ +#define D3DAPP_MAXTEXTUREFORMATS 50 /* maximum texture formats */ +#define D3DAPP_MAXMODES 50 /* maximum display modes ever expected to + be reported by DirectDraw */ +#define D3DAPP_MAXTEXTURES 15 /* maximum number of textures that wil be + loaded and managed */ +#define D3DAPP_MAXCLEARRECTS 30 /* maximum num. rectangles (ie extents) + for clearing */ +#define D3DAPP_BOGUS -100 /* unused parameters accept this */ +#define D3DAPP_YOUDECIDE -25 /* Use this for certain parameters to + have D3DApp decide an appropriate + value for you */ +#define D3DAPP_USEWINDOW -24 /* Used in place of fullscreen mode */ + +/* + * DATA STRUCTURES + */ + +/* + * D3DAppD3DDriver structure + * Describes a D3D driver + */ +typedef struct tagD3DAppD3DDriver { + char Name[30]; /* short name of the driver */ + char About[50]; /* short string about the driver */ + D3DDEVICEDESC Desc; /* D3DDEVICEDESC for complete information */ + GUID Guid; /* it's GUID */ + BOOL bIsHardware; /* does this driver represent a hardware device? */ + BOOL bDoesTextures; /* does this driver do texture mapping? */ + BOOL bDoesZBuffer; /* can this driver use a z-buffer? */ + BOOL bCanDoWindow; /* can it render to Window's display depth? */ +} D3DAppD3DDriver; + +/* + * D3DAppTextureFormat stucture + * Describes a texture format + */ +typedef struct tagD3DAppTextureFormat { + DDSURFACEDESC ddsd; /* DDSURFACEDESC for complete information */ + BOOL bPalettized; /* is this format palettized */ + int RedBPP; /* number of red, */ + int BlueBPP; /* blue, */ + int GreenBPP; /* and green bits per pixel */ + int IndexBPP; /* number of bits in palette index */ +} D3DAppTextureFormat; + +/* + * D3DAppMode structure + * Describes a display mode + */ +typedef struct tagD3DAppMode { + int w; /* width */ + int h; /* height */ + int bpp; /* bits per pixel */ + BOOL bThisDriverCanDo; /*can current D3D driver render in this mode?*/ +} D3DAppMode; + +/* + * D3DAppInfo structure + * Contains all the information D3DApp makes available to the application. A + * pointer to the internal, read only copy is returned by the initializing + * function. + */ +typedef struct tagD3DAppInfo { + HWND hwnd; /*handle of window being managed*/ + /* + * Direct3D objects and information + */ + LPDIRECT3D lpD3D; /* D3D object */ + LPDIRECT3DDEVICE lpD3DDevice; /* D3D device */ + LPDIRECT3DVIEWPORT lpD3DViewport; /* D3D viewport, created by + application */ + int NumDrivers; /* number of D3D drivers avail. */ + int CurrDriver; /* number of curr. D3D driver */ + D3DAppD3DDriver Driver[D3DAPP_MAXD3DDRIVERS]; /* avail. drivers*/ + D3DAppD3DDriver ThisDriver; /* description of this driver, + identical to Driver[CurrDriver] */ + + int NumTextureFormats; /* num texture formats avail*/ + int CurrTextureFormat; /* current texture format + will only change if driver changes or when app changes it*/ + D3DAppTextureFormat TextureFormat[D3DAPP_MAXTEXTUREFORMATS]; + /* description of all avail. formats */ + D3DAppTextureFormat ThisTextureFormat; /* description of this format, + identical to TextureFormat[CurrTextureFormat] */ + + int NumTextures; /* number of textures in D3DApp's + texture list */ + char ImageFile[D3DAPP_MAXTEXTURES][50]; /* files */ + D3DTEXTUREHANDLE TextureHandle[D3DAPP_MAXTEXTURES]; /* handles */ + LPDIRECTDRAWSURFACE lpTextureSurf[D3DAPP_MAXTEXTURES]; /* surfaces */ + LPDIRECT3DTEXTURE lpTexture[D3DAPP_MAXTEXTURES]; /* texture objs */ + int NumUsableTextures; /* the number of currently usable + textures (e.g. for a hardware + device there may not be enough + video memory*/ + /* + * DirectDraw objects and information + */ + LPDIRECTDRAW lpDD; /* DirectDraw object */ + BOOL bIsPrimary; /* Is this the primary DD device? + If FALSE, we're using a hardware DD device that cannot + display a window and so only fullscreen modes are available */ + LPDIRECTDRAWSURFACE lpFrontBuffer; /* front buffer surface */ + LPDIRECTDRAWSURFACE lpBackBuffer; /* back buffer surface */ + LPDIRECTDRAWSURFACE lpZBuffer; /* z-buffer surface */ + BOOL bBackBufferInVideo; /* back buf in video mem? */ + BOOL bZBufferInVideo; /* is Z-buf in video mem? */ + + int NumModes; /* number of available display modes */ + int CurrMode; /* number of current display mode (only + when fullscreen) */ + D3DAppMode Mode[D3DAPP_MAXMODES]; /* desc avail modes */ + D3DAppMode ThisMode; /* description of this mode, identical + to Mode[CurrMode] */ + BOOL bFullscreen; /* in fullscreen exclusive mode? */ + D3DAppMode WindowsDisplay; /* current Windows disply mode */ + + SIZE szClient; /* dimensions of client win */ + POINT pClientOnPrimary; /* position of client win */ + + BOOL bPaused; /* the app is paused */ + BOOL bAppActive; /* the app is active */ + BOOL bTexturesDisabled; /* textures are disabled */ + BOOL bOnlySystemMemory; /* all surfaces forced into + system memory */ + BOOL bOnlyEmulation; /* no hardware DD or D3D + devices allowed */ + BOOL bMinimized; /* app window is minimized */ + BOOL bRenderingIsOK; /* All objects etc. necessary + for rendering are in ok */ +} D3DAppInfo; + +/* + * D3DAppRenderState structure + * The "render state" is the status of this collection of D3D options and + * variables. This structure is used to get and set the render state. The + * render state will only change during program initialization and when + * the application sets it. + */ +typedef struct tagD3DAppRenderState { + BOOL bZBufferOn; /* Z buffer is on */ + BOOL bPerspCorrect; /* perspective correction is on */ + D3DSHADEMODE ShadeMode; /* flat, gouraud, phong? */ + D3DTEXTUREFILTER TextureFilter; /* linear or bi-linear texture filter */ + D3DTEXTUREBLEND TextureBlend; /* Use shade mode or copy mode? */ + D3DFILLMODE FillMode; /* solid, lines or points? */ + BOOL bDithering; /* dithering is on */ + BOOL bSpecular; /* specular highlights are on */ + BOOL bAntialiasing; /* anti-aliasing is on */ + + BOOL bFogEnabled; /* fog is on */ + D3DCOLOR FogColor; /* fog color */ + D3DFOGMODE FogMode; /* linear, exp. etc. */ + D3DVALUE FogStart; /* begining depth */ + D3DVALUE FogEnd; /* ending depth */ +} D3DAppRenderState; + +/* + * FUNCTION PROTOTYPES + */ + +/* + * D3DAppCreateFromHWND + * + * Call this before all other D3DApp functions (except AddTexture). + * Initializes all DD and D3D objects necessary for rendering, enumerates the + * available display modes and drivers and loads textures specified by prior + * AddTexture() calls. Caller passes the handle of the window to be manged + * and callback functions to execute for device creation and destruction. + * + * DeviceCreateCallback is executed AFTER the creation of D3D device and all + * objects D3DApp created using the device. This allows an application to + * reconstruct the scene and create any additional objects. The callback + * must create and return (in the variable provided) the DIRECT3DVIEWPORT + * from the given width and height. The returned pointer is stored in the + * D3DAppInfo structure and used for clearing and setting the render state. + * A NULL pointer is fine if D3DApp is not used for either of these + * functions. The create callback will always be called before any calls to + * the destroy callback. The boolean returned indicates success or failure. + * + * DeviceDestroyCallback is executed BEFORE the D3D device and objects + * created by D3DApp using the device are released. This allows an + * application to save data regarding the scene or release any objects + * created from the device before it is destroyed. The DIRECT3DVIEWPORT + * should be released in this callback. The boolean returned indicates the + * success or failure. + * + * A pointer to the internal D3DAppInfo data structure is returned. This + * should be READ ONLY! + * + * The DirectDraw device, Direct3D driver, display mode and texture format + * will all be chosen by D3DApp. Hardware DD and D3D devices are prefered. + * Mono lighting D3D drivers are prefered. Paletted texture formats are + * prefered. If possible, the current window size will be used, otherwise + * a fullscreen mode will be selected. + * + * Call AddTexture() to add textures to be loaded upon initialization. + * + * Valid flags: + * D3DAPP_ONLYSYSTEMMEMORY Force all surfaces into system memory. Also + * disables hardware DD and D3D drivers. + * D3DAPP_ONLYD3DEMULATION Disable D3D hardware + * D3DAPP_ONLYDDEMULATION Disable DD hardware + */ +#define D3DAPP_ONLYSYSTEMMEMORY 0x00000001 +#define D3DAPP_ONLYD3DEMULATION 0x00000002 +#define D3DAPP_ONLYDDEMULATION 0x00000004 +BOOL D3DAppCreateFromHWND(DWORD flags, HWND hwnd, + BOOL(*DeviceCreateCallback)(int, int, + LPDIRECT3DVIEWPORT*, + LPVOID), + LPVOID lpCreateContext, + BOOL(*DeviceDestroyCallback)(LPVOID), + LPVOID lpDestroyContext, + D3DAppInfo** D3DApp); + +/* + * D3DAppWindowProc + * To be truly effective, D3DApp should be allowed to trap incoming window + * messages such as WM_SIZE. Call D3DAppWindowProc at the begining of the + * application's main window WindowProc with the message information. If + * bStopProcessing is set to TRUE, stop processing the message and return + * lresult. + */ +BOOL D3DAppWindowProc(BOOL* bStopProcessing, LRESULT* lresult, HWND hwnd, + UINT message, WPARAM wParam, LPARAM lParam); + +/* + * D3DAppFullscreen + * Places the app in a fullscreen mode using the current driver. + */ +BOOL D3DAppFullscreen(int mode); + +/* + * D3DAppWindow + * Places the application in windowed mode at the given client size. If w + * and h are D3DAPP_YOUDECIDE, D3DApp will decide on a suitable client size. + * If called while in fullscreen, restores the display mode and returns the + * hooked window to the size it was before a call to D3DAppFullscreen or to + * the size specified. + */ +BOOL D3DAppWindow(int w, int h); + +/* + * D3DAppChangeDriver + * Changes the driver. If the current display mode is incompatible with the + * driver, a new one will be selected and employed. A new texture format is + * selected and textures are reloaded, hence their handles may change. By + * default, paletted formats are prefered. + */ +BOOL D3DAppChangeDriver(int driver, DWORD flags); + +/* + * D3DAppAddTexture + * D3DApp has an internal list of textures which it maintains. The image + * files will be reloaded when necessary and the texture handles, objects and + * surfaces will always be up to date and available in the D3DAppInfo + * structure. D3DAppAddTextures adds the given PPM image file to this + * list. + * + * This is the only function which can be called before CreateD3DAppFromHWND. + * Use it to create a list of textures to load during this creation function. + * + * The handles and texture objects will change when the device or texture + * format changes. To react to changes in the texture objects and surfaces, + * use the callback for D3D device creation/release and make necessary + * changes whenever calling D3DAppChangeTextureFormat. + * + * Image files are searched for in the current directory, D3DPATH env var, + * and the "Software\Microsoft\Direct3D\4.0\D3D Path" registry entry. + * + */ +BOOL D3DAppAddTexture(const char* imagefile); + +/* + * D3DAppChangeTextureFormat + * Changes all textures to the given format. Texture handles and objects + * will change. + */ +BOOL D3DAppChangeTextureFormat(int format); + +/* + * D3DAppDisableTextures + * Disables the textures by turning handles to NULL. If the driver changes, + * textures are not loaded until this state is toggled by another call with a + * TRUE flag. + */ +BOOL D3DAppDisableTextures(BOOL flag); + +/* + * D3DAppSwapTextures + * Swaps first texture with the second, second with third, etc. while keeping + * the handles array the same. + */ +BOOL D3DAppSwapTextures(void); + +/* + * D3DAppSetRenderState + * Uses a D3D execute buffer to set the render state. If lpState is NULL, + * the current settings are reset. + */ +BOOL D3DAppSetRenderState(D3DAppRenderState* lpState); + +/* + * D3DAppGetRenderState + * Returns the current render state. + */ +BOOL D3DAppGetRenderState(D3DAppRenderState* lpState); + +/* + * D3DAppShowBackBuffer + * Blts or flips the back buffer to the primary surface. In the windowed + * case, only the dirty portion of the front buffer is blt'ed over. The + * dirty region of front and back buffers is maintained by calls to + * D3DAppRenderExtents(). D3DAPP_SHOWALL will force the entire front buffer + * to be updated. + */ +#define D3DAPP_SHOWALL 0x00000001 +BOOL D3DAppShowBackBuffer(DWORD flags); + +/* + * D3DAppRenderExtents + * Tells D3DApp the extents of all regions updated on the back buffer as a + * list of D3DRECTs (no more than D3DAPP_MAXCLEARRECTS). Call this before + * clearing the back buffer. If the D3DAPP_CLEARALL flag is set, the extents + * are ignored and the entire back buffer is assumed to have changed. + */ +#define D3DAPP_CLEARALL 0x00000001 +BOOL D3DAppRenderExtents(DWORD dwCount, LPD3DRECT extent, DWORD flags); + +/* + * D3DAppClearBackBuffer + * Clears the back buffer and Z-buffer (if enabled). D3DAPP_CLEARALL can be + * used to clear the entire back buffer. + */ +#define D3DAPP_CLEARALL 0x00000001 +BOOL D3DAppClearBackBuffer(DWORD flags); + +/* + * D3DAppCheckForLostSurfaces + * Checks all surfaces D3DApp has allocated and restores them if necessary. + * An error is returned on any type of failure, but it may be best to ignore + * it since restoring surface can fail for non-fatal reasons and the app may + * just want to spin. + */ +BOOL D3DAppCheckForLostSurfaces(void); + +/* + * D3DAppPause + * Use D3DAppPause(TRUE) to pause the app and D3DAppPause(FALSE) to unpause. + * When fullscreen, the menu bar is redrawn. bPaused is updated to reflect + * the current status. + */ +BOOL D3DAppPause(BOOL flag); + +/* + * D3DAppErrorToString + * Converts a DirectDraw, Direct3D or Direct3D RM error code to a string. + */ +char* D3DAppErrorToString(HRESULT error); + +/* + * D3DAppCreateSurface + * Creates a surface described by ddsd. Will force the surface into + * systemmemory if D3DApp was initialized with D3DAPP_ONLYSYSTEMMEMORY. + */ +BOOL D3DAppCreateSurface(DDSURFACEDESC *ddsd, LPDIRECTDRAWSURFACE *lplpSurf); + +/* + * D3DAppLastError + * D3DAppLastErrorString + * Returns the last D3DApp error as a string and HRESULT. + */ +HRESULT D3DAppLastError(void); +char* D3DAppLastErrorString(void); + +/* + * D3DAppDestroy + * Destroys all objects including Direct Draw. Call before program + * termination. + */ +BOOL D3DAppDestroy(void); + +#ifdef __cplusplus +}; +#endif + +#endif // __D3DAPP_H__ diff --git a/sdk/samples/misc/d3dappi.h b/sdk/samples/misc/d3dappi.h new file mode 100644 index 0000000..2165552 --- /dev/null +++ b/sdk/samples/misc/d3dappi.h @@ -0,0 +1,146 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dappi.h + * + * Internal header. Part of D3DApp. + * + * D3DApp is a collection of helper functions for Direct3D applications. + * D3DApp consists of the following files: + * d3dapp.h Main D3DApp header to be included by application + * d3dappi.h Internal header + * d3dapp.c D3DApp functions seen by application. + * ddcalls.c All calls to DirectDraw objects except textures + * d3dcalls.c All calls to Direct3D objects except textures + * texture.c Texture loading and managing texture list + * misc.c Miscellaneous calls + */ + +#ifndef __D3DAPPI_H__ +#define __D3DAPPI_H__ + +/* + * INCLUDED HEADERS + */ +#include <windows.h> +#include <windowsx.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <search.h> +#include <ddraw.h> +#include <d3d.h> +#include "d3dapp.h" +#include "d3dmacs.h" +#include "lclib.h" /* lclib is a override for standard string lib */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * MACROS + */ +#undef ATTEMPT +#define ATTEMPT(x) if (!(x)) goto exit_with_error +#undef RELEASE +#define RELEASE(x) if (x) { x->lpVtbl->Release(x); x = NULL; } +#undef MAX +#define MAX(x, y) ((x) > (y)) ? (x) : (y) +#undef MIN +#define MIN(x, y) ((x) > (y)) ? (y) : (x) +#undef ZEROMEM +#define ZEROMEM(x) memset(&x, 0, sizeof(x)) + +/* + * GLOBAL VARIABLES + * see d3dapp.c for descriptions + */ +extern D3DAppInfo d3dappi; +extern D3DAppRenderState d3dapprs; +extern BOOL bD3DAppInitialized; +extern HRESULT LastError; +extern LPDIRECTDRAWCLIPPER lpClipper; +extern LPDIRECTDRAWPALETTE lpPalette; +extern BOOL(*D3DDeviceDestroyCallback)(LPVOID); +extern LPVOID D3DDeviceDestroyCallbackContext; +extern BOOL(*D3DDeviceCreateCallback)(int, int, LPDIRECT3DVIEWPORT*, LPVOID); +extern LPVOID D3DDeviceCreateCallbackContext; +extern BOOL bPrimaryPalettized; +extern BOOL bPaletteActivate; +extern BOOL bIgnoreWM_SIZE; +extern PALETTEENTRY ppe[256]; +extern PALETTEENTRY Originalppe[256]; +extern char LastErrorString[256]; +extern SIZE szLastClient; +extern SIZE szBuffers; +extern int NumDirtyClientRects, NumDirtyBackRects, NumDirtyZRects; +extern D3DRECT DirtyClient[D3DAPP_MAXCLEARRECTS]; +extern D3DRECT DirtyBack[D3DAPP_MAXCLEARRECTS]; +extern D3DRECT DirtyZ[D3DAPP_MAXCLEARRECTS]; +extern D3DTEXTUREHANDLE MasterTextureHandle[D3DAPP_MAXTEXTURES]; +extern int CallbackRefCount; + +#ifdef __cplusplus +}; +#endif + +/* + * INTERNAL FUNCTION PROTOTYPES + */ +BOOL D3DAppISetRenderState(void); +BOOL D3DAppIEnumDevices(void); +BOOL D3DAppIPickDriver(int* driver, DWORD depths); +BOOL D3DAppICreateD3D(void); +BOOL D3DAppIEnumTextureFormats(void); +BOOL D3DAppICreateZBuffer(int w, int h, int driver); +BOOL D3DAppICreateDevice(int driver); +BOOL D3DAppILoadTextureSurf(int n, BOOL* bInVideo); +BOOL D3DAppIGetTextureHandle(int n); +BOOL D3DAppILoadAllTextures(void); +void D3DAppIReleaseTexture(int n); +void D3DAppIReleaseAllTextures(void); +BOOL D3DAppIReloadTextureSurf(int n); +BOOL D3DAppISetCoopLevel(HWND hwnd, BOOL bFullscreen); +BOOL D3DAppISetDisplayMode(int w, int h, int bpp); +BOOL D3DAppICheckForPalettized(void); +BOOL D3DAppIRestoreDispMode(void); +BOOL D3DAppIVerifyDriverAndMode(int* lpdriver, int* lpmode); +BOOL D3DAppIFilterDrivers(int mode); +DWORD D3DAppTotalVideoMemory(void); +BOOL D3DAppIEnumDisplayModes(void); +BOOL D3DAppIPickDisplayMode(int* mode, DWORD depths); +BOOL D3DAppISetDispMode(int w, int h, int bpp); +BOOL D3DAppICreateDD(DWORD flags); +BOOL D3DAppIFilterDisplayModes(int driver); +HRESULT D3DAppICreateSurface(LPDDSURFACEDESC lpDDSurfDesc, + LPDIRECTDRAWSURFACE FAR *lpDDSurface); +HRESULT D3DAppIGetSurfDesc(LPDDSURFACEDESC lpDDSurfDesc, + LPDIRECTDRAWSURFACE lpDDSurf); +BOOL D3DAppICreateBuffers(HWND hwnd, int w, int h, int bpp, BOOL bFullscreen, BOOL bIsHardware); +BOOL D3DAppIRememberWindowsMode(void); +BOOL D3DAppIClearBuffers(void); +DWORD D3DAppIBPPToDDBD(int bpp); +void D3DAppIReleasePathList(void); +LPDIRECTDRAWSURFACE D3DAppILoadSurface(LPDIRECTDRAW lpDD, LPCSTR lpName, + LPDDSURFACEDESC lpFormat, + DWORD memoryflag); +void D3DAppISetClientSize(HWND hwnd, int w,int h,BOOL bReturnFromFullscreen); +void D3DAppIGetClientWin(HWND hwnd); +void D3DAppISetDefaults(void); +BOOL D3DAppICallDeviceDestroyCallback(void); +BOOL D3DAppICallDeviceCreateCallback(int w, int h); +void D3DAppIMergeRectLists(int* dstnum, LPD3DRECT dst, int src1num, + LPD3DRECT src1, int src2num, LPD3DRECT src2); +void D3DAppICopyRectList(int* dstnum, LPD3DRECT dst, int srcnum, + LPD3DRECT src); +void D3DAppIValidateDirtyRects(void); +BOOL D3DAppIHandleWM_SIZE(LRESULT* lresult, HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam); +void D3DAppISetErrorString( LPSTR fmt, ... ); + +void __cdecl dpf( LPSTR fmt, ... ); + + +#endif // __D3DAPPI_H__ diff --git a/sdk/samples/misc/d3dcalls.c b/sdk/samples/misc/d3dcalls.c new file mode 100644 index 0000000..5678c5f --- /dev/null +++ b/sdk/samples/misc/d3dcalls.c @@ -0,0 +1,401 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dcalls.c + * + * Calls to Direct3D objects needed for rendering. Part of D3DApp. + * + * D3DApp is a collection of helper functions for Direct3D applications. + * D3DApp consists of the following files: + * d3dapp.h Main D3DApp header to be included by application + * d3dappi.h Internal header + * d3dapp.c D3DApp functions seen by application. + * ddcalls.c All calls to DirectDraw objects except textures + * d3dcalls.c All calls to Direct3D objects except textures + * texture.c Texture loading and managing texture list + * misc.c Miscellaneous calls + */ + +#define INITGUID +#include "d3dappi.h" + +/***************************************************************************/ +/* Creation of D3D */ +/***************************************************************************/ +BOOL +D3DAppICreateD3D(void) +{ + LastError = d3dappi.lpDD->lpVtbl->QueryInterface(d3dappi.lpDD, + &IID_IDirect3D, (LPVOID*)&d3dappi.lpD3D); + if (LastError != DD_OK) { + D3DAppISetErrorString("Creation of IDirect3D failed.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + return TRUE; +exit_with_error: + return FALSE; +} + +/***************************************************************************/ +/* D3D Device Enumeration */ +/***************************************************************************/ +/* + * enumDeviceFunc + * Device enumeration callback. Record information about the D3D device + * reported by D3D. + */ +static HRESULT +WINAPI enumDeviceFunc(LPGUID lpGuid, LPSTR lpDeviceDescription, + LPSTR lpDeviceName, LPD3DDEVICEDESC lpHWDesc, + LPD3DDEVICEDESC lpHELDesc, LPVOID lpContext) +{ + lpContext = lpContext; + /* + * Don't accept any hardware D3D devices if emulation only option is set + */ + if (lpHWDesc->dcmColorModel && d3dappi.bOnlyEmulation) + return D3DENUMRET_OK; + /* + * Record the D3D driver's inforamation + */ + memcpy(&d3dappi.Driver[d3dappi.NumDrivers].Guid, lpGuid, sizeof(GUID)); + lstrcpy(d3dappi.Driver[d3dappi.NumDrivers].About, lpDeviceDescription); + lstrcpy(d3dappi.Driver[d3dappi.NumDrivers].Name, lpDeviceName); + /* + * Is this a hardware device or software emulation? Checking the color + * model for a valid model works. + */ + if (lpHWDesc->dcmColorModel) { + d3dappi.Driver[d3dappi.NumDrivers].bIsHardware = TRUE; + memcpy(&d3dappi.Driver[d3dappi.NumDrivers].Desc, lpHWDesc, + sizeof(D3DDEVICEDESC)); + } else { + d3dappi.Driver[d3dappi.NumDrivers].bIsHardware = FALSE; + memcpy(&d3dappi.Driver[d3dappi.NumDrivers].Desc, lpHELDesc, + sizeof(D3DDEVICEDESC)); + } + /* + * Does this driver do texture mapping? + */ + d3dappi.Driver[d3dappi.NumDrivers].bDoesTextures = + (d3dappi.Driver[d3dappi.NumDrivers].Desc.dpcTriCaps.dwTextureCaps & + D3DPTEXTURECAPS_PERSPECTIVE) ? TRUE : FALSE; + /* + * Can this driver use a z-buffer? + */ + d3dappi.Driver[d3dappi.NumDrivers].bDoesZBuffer = + d3dappi.Driver[d3dappi.NumDrivers].Desc.dwDeviceZBufferBitDepth + ? TRUE : FALSE; + /* + * Can this driver render to the Windows display depth + */ + d3dappi.Driver[d3dappi.NumDrivers].bCanDoWindow = + (d3dappi.Driver[d3dappi.NumDrivers].Desc.dwDeviceRenderBitDepth & + D3DAppIBPPToDDBD(d3dappi.WindowsDisplay.bpp)) ? TRUE : FALSE; + if (!d3dappi.bIsPrimary) + d3dappi.Driver[d3dappi.NumDrivers].bCanDoWindow = FALSE; + + d3dappi.NumDrivers++; + if (d3dappi.NumDrivers == D3DAPP_MAXD3DDRIVERS) + return (D3DENUMRET_CANCEL); + return (D3DENUMRET_OK); +} + +/* + * D3DAppIEnumDevices + * Get the available drivers from Direct3D by enumeration. + */ +BOOL +D3DAppIEnumDevices(void) +{ + d3dappi.NumDrivers = 0; + LastError = d3dappi.lpD3D->lpVtbl->EnumDevices(d3dappi.lpD3D, + enumDeviceFunc, NULL); + if (LastError != DD_OK) { + D3DAppISetErrorString("Enumeration of drivers failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + d3dappi.CurrDriver = 0; + return TRUE; +} + +/***************************************************************************/ +/* Enumeration of texure format */ +/***************************************************************************/ +/* + * EnumTextureFormatsCallback + * Record information about each texture format the current D3D driver can + * support. Choose one as the default format (paletted formats are prefered) + * and return it through lpContext. + */ +static HRESULT +CALLBACK EnumTextureFormatsCallback(LPDDSURFACEDESC lpDDSD, LPVOID lpContext) +{ + unsigned long m; + int r, g, b; + int *lpStartFormat = (int *)lpContext; + /* + * Record the DDSURFACEDESC of this texture format + */ + memset(&d3dappi.TextureFormat[d3dappi.NumTextureFormats], 0, + sizeof(D3DAppTextureFormat)); + memcpy(&d3dappi.TextureFormat[d3dappi.NumTextureFormats].ddsd, lpDDSD, + sizeof(DDSURFACEDESC)); + /* + * Is this format palettized? How many bits? Otherwise, how many RGB + * bits? + */ + if (lpDDSD->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) { + d3dappi.TextureFormat[d3dappi.NumTextureFormats].bPalettized = TRUE; + d3dappi.TextureFormat[d3dappi.NumTextureFormats].IndexBPP = 8; + } else if (lpDDSD->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED4) { + d3dappi.TextureFormat[d3dappi.NumTextureFormats].bPalettized = TRUE; + d3dappi.TextureFormat[d3dappi.NumTextureFormats].IndexBPP = 4; + } else if (lpDDSD->ddpfPixelFormat.dwFlags & DDPF_ALPHAPIXELS) { + /* + * The sample apps don't currently understand + * the alpha bit - just filter this format + * away for now. + */ + + return DDENUMRET_OK; + } else + { + d3dappi.TextureFormat[d3dappi.NumTextureFormats].bPalettized = FALSE; + d3dappi.TextureFormat[d3dappi.NumTextureFormats].IndexBPP = 0; + for (r = 0, m = lpDDSD->ddpfPixelFormat.dwRBitMask; !(m & 1); + r++, m >>= 1); + for (r = 0; m & 1; r++, m >>= 1); + for (g = 0, m = lpDDSD->ddpfPixelFormat.dwGBitMask; !(m & 1); + g++, m >>= 1); + for (g = 0; m & 1; g++, m >>= 1); + for (b = 0, m = lpDDSD->ddpfPixelFormat.dwBBitMask; !(m & 1); + b++, m >>= 1); + for (b = 0; m & 1; b++, m >>= 1); + d3dappi.TextureFormat[d3dappi.NumTextureFormats].RedBPP = r; + d3dappi.TextureFormat[d3dappi.NumTextureFormats].GreenBPP = g; + d3dappi.TextureFormat[d3dappi.NumTextureFormats].BlueBPP = b; + } + /* + * If lpStarFormat is -1, this is the first format. Select it. + */ + if (*lpStartFormat == -1) + *lpStartFormat = d3dappi.NumTextureFormats; + /* + * If this format is paletted, select it. + */ + if (d3dappi.TextureFormat[d3dappi.NumTextureFormats].bPalettized) { + *lpStartFormat = d3dappi.NumTextureFormats; + } + d3dappi.NumTextureFormats++; + return DDENUMRET_OK; +} + +/* + * D3DAppIEnumTextureFormats + * Get a list of available texture map formats from the Direct3D driver by + * enumeration. Choose a default format (paletted is prefered). + */ +BOOL +D3DAppIEnumTextureFormats(void) +{ + int StartFormat; + /* + * Set the default format to -1 to let the callback know it's being + * called for the first time. + */ + StartFormat = -1; + d3dappi.NumTextureFormats = 0; + LastError = + d3dappi.lpD3DDevice->lpVtbl->EnumTextureFormats(d3dappi.lpD3DDevice, + EnumTextureFormatsCallback, + (LPVOID)&StartFormat); + if (LastError != DD_OK) { + D3DAppISetErrorString("Enumeration of texture formats failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + memcpy(&d3dappi.ThisTextureFormat, &d3dappi.TextureFormat[StartFormat], + sizeof(D3DAppTextureFormat)); + d3dappi.CurrTextureFormat = StartFormat; + return TRUE; +} + +/***************************************************************************/ +/* Device creation */ +/***************************************************************************/ +/* + * D3DAppICreateDevice + * Create the D3D device and enumerate the texture formats + */ +BOOL +D3DAppICreateDevice(int driver) +{ + + RELEASE(d3dappi.lpD3DDevice); + + if (d3dappi.Driver[driver].bIsHardware && !d3dappi.bBackBufferInVideo) { + D3DAppISetErrorString("Could not fit the rendering surfaces in video memory for this hardware device.\n"); + goto exit_with_error; + } + + d3dappi.CurrDriver = driver; + memcpy(&d3dappi.ThisDriver, &d3dappi.Driver[driver], sizeof(D3DAppD3DDriver)); + LastError = + d3dappi.lpBackBuffer->lpVtbl->QueryInterface(d3dappi.lpBackBuffer, + &d3dappi.Driver[driver].Guid, + (LPVOID*)&d3dappi.lpD3DDevice); + if (LastError != DD_OK) { + D3DAppISetErrorString("Create D3D device failed.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + d3dappi.CurrDriver = driver; + d3dappi.NumTextureFormats = 0; + if (d3dappi.Driver[driver].bDoesTextures) { + if (!D3DAppIEnumTextureFormats()) + goto exit_with_error; + } + + return TRUE; +exit_with_error: + RELEASE(d3dappi.lpD3DDevice); + return FALSE; +} + +/***************************************************************************/ +/* Setting the render state */ +/***************************************************************************/ +/* + * D3DAppISetRenderState + * Create and execute an execute buffer which will set the render state and + * light state for the current viewport. + */ +BOOL +D3DAppISetRenderState() +{ + D3DEXECUTEBUFFERDESC debDesc; + D3DEXECUTEDATA d3dExData; + LPDIRECT3DEXECUTEBUFFER lpD3DExCmdBuf = NULL; + LPVOID lpBuffer, lpInsStart; + size_t size; + + /* + * If there is no D3D Viewport, we must return true because it is not + * required. + */ + if (!d3dappi.lpD3DViewport) + return TRUE; + /* + * Create an execute buffer of the required size + */ + size = 0; + size += sizeof(D3DINSTRUCTION) * 3; + size += sizeof(D3DSTATE) * 17; + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + LastError = + d3dappi.lpD3DDevice->lpVtbl->CreateExecuteBuffer(d3dappi.lpD3DDevice, + &debDesc, &lpD3DExCmdBuf, NULL); + if (LastError != D3D_OK) { + D3DAppISetErrorString("CreateExecuteBuffer failed in SetRenderState.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + /* + * Lock the execute buffer so it can be filled + */ + LastError = lpD3DExCmdBuf->lpVtbl->Lock(lpD3DExCmdBuf, &debDesc); + if (LastError != D3D_OK) { + D3DAppISetErrorString("Lock failed on execute buffer in SetRenderState.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + memset(debDesc.lpData, 0, size); + + lpInsStart = debDesc.lpData; + lpBuffer = lpInsStart; + /* + * Set render state + */ + OP_STATE_RENDER(14, lpBuffer); + STATE_DATA(D3DRENDERSTATE_SHADEMODE, d3dapprs.ShadeMode, lpBuffer); + STATE_DATA(D3DRENDERSTATE_TEXTUREPERSPECTIVE, d3dapprs.bPerspCorrect, + lpBuffer); + STATE_DATA(D3DRENDERSTATE_ZENABLE, d3dapprs.bZBufferOn && + d3dappi.ThisDriver.bDoesZBuffer, lpBuffer); + STATE_DATA(D3DRENDERSTATE_ZWRITEENABLE, d3dapprs.bZBufferOn, lpBuffer); + STATE_DATA(D3DRENDERSTATE_ZFUNC, D3DCMP_LESSEQUAL, lpBuffer); + STATE_DATA(D3DRENDERSTATE_TEXTUREMAG, d3dapprs.TextureFilter,lpBuffer); + STATE_DATA(D3DRENDERSTATE_TEXTUREMIN, d3dapprs.TextureFilter,lpBuffer); + STATE_DATA(D3DRENDERSTATE_TEXTUREMAPBLEND, d3dapprs.TextureBlend, + lpBuffer); + STATE_DATA(D3DRENDERSTATE_FILLMODE, d3dapprs.FillMode, lpBuffer); + STATE_DATA(D3DRENDERSTATE_DITHERENABLE, d3dapprs.bDithering, lpBuffer); + STATE_DATA(D3DRENDERSTATE_SPECULARENABLE, d3dapprs.bSpecular,lpBuffer); + STATE_DATA(D3DRENDERSTATE_ANTIALIAS, d3dapprs.bAntialiasing, lpBuffer); + STATE_DATA(D3DRENDERSTATE_FOGENABLE, d3dapprs.bFogEnabled, lpBuffer); + STATE_DATA(D3DRENDERSTATE_FOGCOLOR, d3dapprs.FogColor, lpBuffer); + /* + * Set light state + */ + OP_STATE_LIGHT(3, lpBuffer); + STATE_DATA(D3DLIGHTSTATE_FOGMODE, d3dapprs.bFogEnabled ? + d3dapprs.FogMode : D3DFOG_NONE, lpBuffer); + STATE_DATA(D3DLIGHTSTATE_FOGSTART, *(unsigned long*)&d3dapprs.FogStart, + lpBuffer); + STATE_DATA(D3DLIGHTSTATE_FOGEND, *(unsigned long*)&d3dapprs.FogEnd, + lpBuffer); + OP_EXIT(lpBuffer); + + LastError = lpD3DExCmdBuf->lpVtbl->Unlock(lpD3DExCmdBuf); + if (LastError != D3D_OK) { + D3DAppISetErrorString("Unlock failed on execute buffer in SetRenderState.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + /* + * Set the execute data and exectue the buffer + */ + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwInstructionOffset = (ULONG) 0; + d3dExData.dwInstructionLength = (ULONG) ((char*)lpBuffer - + (char*)lpInsStart); + lpD3DExCmdBuf->lpVtbl->SetExecuteData(lpD3DExCmdBuf, &d3dExData); + LastError = d3dappi.lpD3DDevice->lpVtbl->BeginScene(d3dappi.lpD3DDevice); + if (LastError != D3D_OK) { + D3DAppISetErrorString("BeginScene failed in SetRenderState.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + LastError = d3dappi.lpD3DDevice->lpVtbl->Execute(d3dappi.lpD3DDevice, + lpD3DExCmdBuf, + d3dappi.lpD3DViewport, + D3DEXECUTE_UNCLIPPED); + if (LastError != D3D_OK) { + D3DAppISetErrorString("Execute failed in SetRenderState.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + LastError = d3dappi.lpD3DDevice->lpVtbl->EndScene(d3dappi.lpD3DDevice); + if (LastError != D3D_OK) { + D3DAppISetErrorString("EndScene failed in SetRenderState.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + /* + * We are done with the execute buffer, so release it. + */ + lpD3DExCmdBuf->lpVtbl->Release(lpD3DExCmdBuf); + return TRUE; + +exit_with_error: + RELEASE(lpD3DExCmdBuf); + return FALSE; +} + diff --git a/sdk/samples/misc/d3ddemo.h b/sdk/samples/misc/d3ddemo.h new file mode 100644 index 0000000..121f7a1 --- /dev/null +++ b/sdk/samples/misc/d3ddemo.h @@ -0,0 +1,89 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3ddemo.h + * + ***************************************************************************/ +#ifndef __D3DDEMO_H__ +#define __D3DDEMO_H__ + +#include <ddraw.h> +#include <d3d.h> +#include "d3dapp.h" +#include "d3dmath.h" +#include "d3dsphr.h" +#include "d3dmacs.h" + +#ifdef __cplusplus +extern "C" { +#endif + /* + * SetMouseCallback + * Called in an example to set a callback function for all WM messages + * dealing with the mouse. The handler should return whether or not + * it handled the message. + */ + BOOL SetMouseCallback(BOOL(*)(UINT, WPARAM, LPARAM)); + /* + * SetKeyDownCallback + * Called in an example to set a callback function for keyboard + * messages. The handler should return whether or not it handled the + * message. + */ + BOOL SetKeyboardCallback(BOOL(*)(UINT, WPARAM, LPARAM)); + +/* + * These functions are found in the source for each example. + */ + /* + * RenderScene + * Clears the viewport and viewport Z-buffer and render the scene. + * The extent of rendering is returned in the rectangle. + */ + BOOL RenderScene(LPDIRECT3DDEVICE lpDev, LPDIRECT3DVIEWPORT lpView, + LPD3DRECT lpExtent); + /* + * InitScene + * Builds the model which will be rendered. + */ + BOOL InitScene(void); + + /* + * InitView + * Builds execute buffer and all components needed to be added to viewport. + */ + BOOL InitView(LPDIRECTDRAW lpDD, + LPDIRECT3D lpD3D, + LPDIRECT3DDEVICE lpDev, + LPDIRECT3DVIEWPORT lpView, + int NumTextures, + LPD3DTEXTUREHANDLE TextureHandle); + /* + * Release all objects and free all memory allocated in InitScene + */ + void ReleaseScene(void); + + /* + * Release all objects and free all memory allocated in InitView + */ + void ReleaseView(LPDIRECT3DVIEWPORT lpView); + + typedef struct Defaultstag { + D3DAppRenderState rs; + BOOL bTexturesDisabled; + BOOL bResizingDisabled; + BOOL bClearsOn; + char Name[30]; + } Defaults; + + /* + * Allows each example to begin with different defaults + */ + void OverrideDefaults(Defaults* defaults); + +#ifdef __cplusplus +}; +#endif + +#endif // __D3DDEMO_H__ diff --git a/sdk/samples/misc/d3dmacs.h b/sdk/samples/misc/d3dmacs.h new file mode 100644 index 0000000..ce26f43 --- /dev/null +++ b/sdk/samples/misc/d3dmacs.h @@ -0,0 +1,147 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dmacs.h + * + * Useful macros for generating execute buffers. Consult the D3D sample + * code for examples of their usage. + * + * Use OP_NOP to QWORD align triangle and line instructions. + */ + +#ifndef __D3DMACS_H__ +#define __D3DMACS_H__ + +#undef RELEASE + +#ifndef __cplusplus +#define MAKE_MATRIX(lpDev, handle, data) \ + if (lpDev->lpVtbl->CreateMatrix(lpDev, &handle) != D3D_OK) \ + return FALSE; \ + if (lpDev->lpVtbl->SetMatrix(lpDev, handle, &data) != D3D_OK) \ + return FALSE +#define RELEASE(x) if (x != NULL) {x->lpVtbl->Release(x); x = NULL;} +#endif + +#ifdef __cplusplus +#define MAKE_MATRIX(lpDev, handle, data) \ + if (lpDev->CreateMatrix(&handle) != D3D_OK) \ + return FALSE; \ + if (lpDev->SetMatrix(handle, &data) != D3D_OK) \ + return FALSE +#define RELEASE(x) if (x != NULL) {x->Release(); x = NULL;} +#endif + +#define PUTD3DINSTRUCTION(op, sz, cnt, ptr) \ + ((LPD3DINSTRUCTION) ptr)->bOpcode = op; \ + ((LPD3DINSTRUCTION) ptr)->bSize = sz; \ + ((LPD3DINSTRUCTION) ptr)->wCount = cnt; \ + ptr = (void *)(((LPD3DINSTRUCTION) ptr) + 1) + +#define VERTEX_DATA(loc, cnt, ptr) \ + if ((ptr) != (loc)) memcpy((ptr), (loc), sizeof(D3DVERTEX) * (cnt)); \ + ptr = (void *)(((LPD3DVERTEX) (ptr)) + (cnt)) + +// OP_MATRIX_MULTIPLY size: 4 (sizeof D3DINSTRUCTION) +#define OP_MATRIX_MULTIPLY(cnt, ptr) \ + PUTD3DINSTRUCTION(D3DOP_MATRIXMULTIPLY, sizeof(D3DMATRIXMULTIPLY), cnt, ptr) + +// MATRIX_MULTIPLY_DATA size: 12 (sizeof MATRIXMULTIPLY) +#define MATRIX_MULTIPLY_DATA(src1, src2, dest, ptr) \ + ((LPD3DMATRIXMULTIPLY) ptr)->hSrcMatrix1 = src1; \ + ((LPD3DMATRIXMULTIPLY) ptr)->hSrcMatrix2 = src2; \ + ((LPD3DMATRIXMULTIPLY) ptr)->hDestMatrix = dest; \ + ptr = (void *)(((LPD3DMATRIXMULTIPLY) ptr) + 1) + +// OP_STATE_LIGHT size: 4 (sizeof D3DINSTRUCTION) +#define OP_STATE_LIGHT(cnt, ptr) \ + PUTD3DINSTRUCTION(D3DOP_STATELIGHT, sizeof(D3DSTATE), cnt, ptr) + +// OP_STATE_TRANSFORM size: 4 (sizeof D3DINSTRUCTION) +#define OP_STATE_TRANSFORM(cnt, ptr) \ + PUTD3DINSTRUCTION(D3DOP_STATETRANSFORM, sizeof(D3DSTATE), cnt, ptr) + +// OP_STATE_RENDER size: 4 (sizeof D3DINSTRUCTION) +#define OP_STATE_RENDER(cnt, ptr) \ + PUTD3DINSTRUCTION(D3DOP_STATERENDER, sizeof(D3DSTATE), cnt, ptr) + +// STATE_DATA size: 8 (sizeof D3DSTATE) +#define STATE_DATA(type, arg, ptr) \ + ((LPD3DSTATE) ptr)->drstRenderStateType = (D3DRENDERSTATETYPE)type; \ + ((LPD3DSTATE) ptr)->dwArg[0] = arg; \ + ptr = (void *)(((LPD3DSTATE) ptr) + 1) + +// OP_PROCESS_VERTICES size: 4 (sizeof D3DINSTRUCTION) +#define OP_PROCESS_VERTICES(cnt, ptr) \ + PUTD3DINSTRUCTION(D3DOP_PROCESSVERTICES, sizeof(D3DPROCESSVERTICES), cnt, ptr) + +// PROCESSVERTICES_DATA size: 16 (sizeof D3DPROCESSVERTICES) +#define PROCESSVERTICES_DATA(flgs, strt, cnt, ptr) \ + ((LPD3DPROCESSVERTICES) ptr)->dwFlags = flgs; \ + ((LPD3DPROCESSVERTICES) ptr)->wStart = strt; \ + ((LPD3DPROCESSVERTICES) ptr)->wDest = strt; \ + ((LPD3DPROCESSVERTICES) ptr)->dwCount = cnt; \ + ((LPD3DPROCESSVERTICES) ptr)->dwReserved = 0; \ + ptr = (void *)(((LPD3DPROCESSVERTICES) ptr) + 1) + +// OP_TRIANGLE_LIST size: 4 (sizeof D3DINSTRUCTION) +#define OP_TRIANGLE_LIST(cnt, ptr) \ + PUTD3DINSTRUCTION(D3DOP_TRIANGLE, sizeof(D3DTRIANGLE), cnt, ptr) + +#define TRIANGLE_LIST_DATA(loc, count, ptr) \ + if ((ptr) != (loc)) memcpy((ptr), (loc), sizeof(D3DTRIANGLE) * (count)); \ + ptr = (void *)(((LPD3DTRIANGLE) (ptr)) + (count)) + +// OP_LINE_LIST size: 4 (sizeof D3DINSTRUCTION) +#define OP_LINE_LIST(cnt, ptr) \ + PUTD3DINSTRUCTION(D3DOP_LINE, sizeof(D3DLINE), cnt, ptr) + +#define LINE_LIST_DATA(loc, count, ptr) \ + if ((ptr) != (loc)) memcpy((ptr), (loc), sizeof(D3DLINE) * (count)); \ + ptr = (void *)(((LPD3DLINE) (ptr)) + (count)) + +// OP_POINT_LIST size: 8 (sizeof D3DINSTRUCTION + sizeof D3DPOINT) +#define OP_POINT_LIST(first, cnt, ptr) \ + PUTD3DINSTRUCTION(D3DOP_POINT, sizeof(D3DPOINT), 1, ptr); \ + ((LPD3DPOINT)(ptr))->wCount = cnt; \ + ((LPD3DPOINT)(ptr))->wFirst = first; \ + ptr = (void*)(((LPD3DPOINT)(ptr)) + 1) + +// OP_SPAN_LIST size: 8 (sizeof D3DINSTRUCTION + sizeof D3DSPAN) +#define OP_SPAN_LIST(first, cnt, ptr) \ + PUTD3DINSTRUCTION(D3DOP_SPAN, sizeof(D3DSPAN), 1, ptr); \ + ((LPD3DSPAN)(ptr))->wCount = cnt; \ + ((LPD3DSPAN)(ptr))->wFirst = first; \ + ptr = (void*)(((LPD3DSPAN)(ptr)) + 1) + +// OP_BRANCH_FORWARD size: 18 (sizeof D3DINSTRUCTION + sizeof D3DBRANCH) +#define OP_BRANCH_FORWARD(tmask, tvalue, tnegate, toffset, ptr) \ + PUTD3DINSTRUCTION(D3DOP_BRANCHFORWARD, sizeof(D3DBRANCH), 1, ptr); \ + ((LPD3DBRANCH) ptr)->dwMask = tmask; \ + ((LPD3DBRANCH) ptr)->dwValue = tvalue; \ + ((LPD3DBRANCH) ptr)->bNegate = tnegate; \ + ((LPD3DBRANCH) ptr)->dwOffset = toffset; \ + ptr = (void *)(((LPD3DBRANCH) (ptr)) + 1) + +// OP_SET_STATUS size: 20 (sizeof D3DINSTRUCTION + sizeof D3DSTATUS) +#define OP_SET_STATUS(flags, status, _x1, _y1, _x2, _y2, ptr) \ + PUTD3DINSTRUCTION(D3DOP_SETSTATUS, sizeof(D3DSTATUS), 1, ptr); \ + ((LPD3DSTATUS)(ptr))->dwFlags = flags; \ + ((LPD3DSTATUS)(ptr))->dwStatus = status; \ + ((LPD3DSTATUS)(ptr))->drExtent.x1 = _x1; \ + ((LPD3DSTATUS)(ptr))->drExtent.y1 = _y1; \ + ((LPD3DSTATUS)(ptr))->drExtent.x2 = _x2; \ + ((LPD3DSTATUS)(ptr))->drExtent.y2 = _y2; \ + ptr = (void *)(((LPD3DSTATUS) (ptr)) + 1) + +// OP_NOP size: 4 +#define OP_NOP(ptr) \ + PUTD3DINSTRUCTION(D3DOP_TRIANGLE, sizeof(D3DTRIANGLE), 0, ptr) + +#define OP_EXIT(ptr) \ + PUTD3DINSTRUCTION(D3DOP_EXIT, 0, 0, ptr) + +#define QWORD_ALIGNED(ptr) \ + !(0x00000007L & (ULONG)(ptr)) + +#endif // __D3DMACS_H__ diff --git a/sdk/samples/misc/d3dmain.cpp b/sdk/samples/misc/d3dmain.cpp new file mode 100644 index 0000000..8db378e --- /dev/null +++ b/sdk/samples/misc/d3dmain.cpp @@ -0,0 +1,1246 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dmain.cpp + * + * Each of the Direct3D samples must be linked with this file. It contains + * the code which allows them to run in the Windows environment. + * + * A window is created using d3dmain.res which allows the user to select the + * Direct3D driver to use and change the render options. The D3DApp + * collection of functions is used to initialize DirectDraw, Direct3D and + * keep surfaces and D3D devices available for rendering. + * + * Frame rate and a screen mode information buffer is Blt'ed to the screen + * by functions in stats.cpp. + * + * Each sample is executed through the functions: InitScene, InitView, + * RenderScene, ReleaseView, ReleaseScene and OverrideDefaults, as described + * in d3ddemo.h. Samples can also read mouse and keyboard input via + * SetMouseCallback and SetKeyboardCallback. + */ + +#include "d3dmain.h" + +/* + * GLOBAL VARIABLES + */ +D3DAppInfo* d3dapp; /* Pointer to read only collection of DD and D3D + objects maintained by D3DApp */ +d3dmainglobals myglobs; /* collection of global variables */ + +BOOL(*MouseHandler)(UINT, WPARAM, LPARAM); /* sample's function which traps + mouse input */ +BOOL(*KeyboardHandler)(UINT, WPARAM, LPARAM); /* sample's functions which traps + keyboard input */ + +/* + * INTERNAL FUNCTION PROTOTYPES + */ +static BOOL AppInit(HINSTANCE hInstance, LPSTR lpCmdLine); +static BOOL CreateD3DApp(LPSTR lpCmdLine); +static BOOL BeforeDeviceDestroyed(LPVOID lpContext); +static BOOL AfterDeviceCreated(int w, int h, LPDIRECT3DVIEWPORT* lpViewport, + LPVOID lpContext); +void CleanUpAndPostQuit(void); +static void InitGlobals(void); +static BOOL AppPause(BOOL f); +void ReportD3DAppError(void); +static BOOL RenderLoop(void); +static BOOL RestoreSurfaces(); +long FAR PASCAL WindowProc(HWND hWnd, UINT message, WPARAM wParam, + LPARAM lParam ); + +/****************************************************************************/ +/* WinMain */ +/****************************************************************************/ +/* + * Initializes the application then enters a message loop which calls sample's + * RenderScene until a quit message is received. + */ +int PASCAL +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, + int nCmdShow) +{ + int failcount = 0; /* number of times RenderLoop has failed */ + MSG msg; + HACCEL hAccelApp; + + hPrevInstance; + /* + * Create the window and initialize all objects needed to begin rendering + */ + if(!AppInit(hInstance, lpCmdLine)) + return FALSE; + hAccelApp = LoadAccelerators(hInstance, "AppAccel"); + + while (!myglobs.bQuit) { + /* + * Monitor the message queue until there are no pressing + * messages + */ + if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + if (msg.message == WM_QUIT) { + CleanUpAndPostQuit(); + break; + } + if (!myglobs.hWndMain || !TranslateAccelerator(myglobs.hWndMain, + hAccelApp, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + /* + * If the app is not minimized, not about to quit, not paused, either the + * active fullscreen app or in a window and D3D has been initialized, + * we can render + */ + } else if (d3dapp->bRenderingIsOK && !d3dapp->bMinimized + && !d3dapp->bPaused && !myglobs.bQuit + && (d3dapp->bAppActive || !d3dapp->bFullscreen)) { + /* + * If were are not in single step mode or if we are and the + * bDrawAFrame flag is set, render one frame + */ + if (!(myglobs.bSingleStepMode && !myglobs.bDrawAFrame)) { + /* + * Attempt to render a frame, if it fails, take a note. If + * rendering fails more than twice, abort execution. + */ + if (!RenderLoop()) { + ++failcount; + if (failcount == 3) { + Msg("Rendering has failed too many times. Aborting execution.\n"); + CleanUpAndPostQuit(); + break; + } + } + } + /* + * Reset the bDrawAFrame flag if we are in single step mode + */ + if (myglobs.bSingleStepMode) + myglobs.bDrawAFrame = FALSE; + } else { + WaitMessage(); + } + } + + DestroyWindow(myglobs.hWndMain); + return msg.wParam; +} + +/****************************************************************************/ +/* D3DApp Initialization and callback functions */ +/****************************************************************************/ +/* + * AppInit + * Creates the window and initializes all objects necessary to begin rendering + */ +static BOOL +AppInit(HINSTANCE hInstance, LPSTR lpCmdLine) +{ + WNDCLASS wc; + + /* + * Initialize the global variables + */ + InitGlobals(); + myglobs.hInstApp = hInstance; + /* + * Register the window class + */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon( hInstance, "AppIcon"); + wc.hCursor = LoadCursor( NULL, IDC_ARROW ); + wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + wc.lpszMenuName = "AppMenu"; + wc.lpszClassName = "Example"; + if (!RegisterClass(&wc)) + return FALSE; + /* + * Create a window with some default settings that may change + */ + myglobs.hWndMain = CreateWindowEx( + WS_EX_APPWINDOW, + "Example", + "D3D Example", + WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME | WS_MINIMIZEBOX, + CW_USEDEFAULT, CW_USEDEFAULT, + START_WIN_SIZE, START_WIN_SIZE, + NULL, /* parent window */ + NULL, /* menu handle */ + hInstance, /* program handle */ + NULL); /* create parms */ + if (!myglobs.hWndMain){ + Msg("CreateWindowEx failed"); + return FALSE; + } + /* + * Display the window + */ + ShowWindow(myglobs.hWndMain, SW_SHOWNORMAL); + UpdateWindow(myglobs.hWndMain); + /* + * Have the example initialize it components which remain constant + * throughout execution + */ + if (!InitScene()) + return FALSE; + /* + * Call D3DApp to initialize all DD and D3D objects necessary to render. + * D3DApp will call the device creation callback which will initialize the + * viewport and the sample's execute buffers. + */ + if (!CreateD3DApp(lpCmdLine)) + return FALSE; + + return TRUE; +} + +/* + * CreateD3DApp + * Create all DirectDraw and Direct3D objects necessary to begin rendering. + * Add the list of D3D drivers to the file menu. + */ +static BOOL +CreateD3DApp(LPSTR lpCmdLine) +{ + HMENU hmenu; + int i; + LPSTR option; + BOOL bOnlySystemMemory, bOnlyEmulation; + DWORD flags; + Defaults defaults; + + /* + * Give D3DApp a list of textures to keep track of. + */ + D3DAppAddTexture("checker.ppm"); + D3DAppAddTexture("tex2.ppm"); + D3DAppAddTexture("tex7.ppm"); + D3DAppAddTexture("win95.ppm"); + /* + * Parse the command line in seach of one of the following options: + * systemmemory All surfaces should be created in system memory. + * Hardware DD and D3D devices are disabled, but + * debugging during the Win16 lock becomes possible. + * emulation Do not use hardware DD or D3D devices. + */ + bOnlySystemMemory = FALSE; + bOnlyEmulation = FALSE; + option = strtok(lpCmdLine, " -"); + while(option != NULL ) { + if (!lstrcmp(option, "systemmemory")) { + bOnlySystemMemory = TRUE; + } else if (!lstrcmp(option, "emulation")) { + bOnlyEmulation = TRUE; + } else { + Msg("Invalid command line options given.\nLegal options: -systemmemory, -emulation\n"); + return FALSE; + } + option = strtok(NULL, " -"); + } + /* + * Set the flags to pass to the D3DApp creation based on command line + */ + flags = ((bOnlySystemMemory) ? D3DAPP_ONLYSYSTEMMEMORY : 0) | + ((bOnlyEmulation) ? (D3DAPP_ONLYD3DEMULATION | + D3DAPP_ONLYDDEMULATION) : 0); + /* + * Create all the DirectDraw and D3D objects neccesary to render. The + * AfterDeviceCreated callback function is called by D3DApp to create the + * viewport and the example's execute buffers. + */ + if (!D3DAppCreateFromHWND(flags, myglobs.hWndMain, AfterDeviceCreated, + NULL, BeforeDeviceDestroyed, NULL, &d3dapp)) { + ReportD3DAppError(); + return FALSE; + } + /* + * Add the the list of display modes D3DApp found to the mode menu + */ + hmenu = GetSubMenu(GetMenu(myglobs.hWndMain), 4); + for (i = 0; i < d3dapp->NumModes; i++) { + char ach[80]; + wsprintf(ach,"%dx%dx%d", d3dapp->Mode[i].w, d3dapp->Mode[i].h, + d3dapp->Mode[i].bpp); + AppendMenu(hmenu, MF_STRING, MENU_FIRST_MODE+i, ach); + } + /* + * Add the list of D3D drivers D3DApp foudn to the file menu + */ + hmenu = GetSubMenu(GetMenu(myglobs.hWndMain), 0); + for (i = 0; i < d3dapp->NumDrivers; i++) { + InsertMenu(hmenu, 6 + i, MF_BYPOSITION | MF_STRING, + MENU_FIRST_DRIVER + i, d3dapp->Driver[i].Name); + } + /* + * Allow the sample to override the default render state and other + * settings + */ + if (!D3DAppGetRenderState(&defaults.rs)) { + ReportD3DAppError(); + return FALSE; + } + lstrcpy(defaults.Name, "D3D Example"); + defaults.bTexturesDisabled = FALSE; + defaults.bResizingDisabled = myglobs.bResizingDisabled; + defaults.bClearsOn = myglobs.bClearsOn; + OverrideDefaults(&defaults); + myglobs.bClearsOn = defaults.bClearsOn; + myglobs.bResizingDisabled = defaults.bResizingDisabled; + /* + * Apply any changes to the render state + */ + memcpy(&myglobs.rstate, &defaults.rs, sizeof(D3DAppRenderState)); + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + return FALSE; + } + /* + * If I should begin with textures off, disable them and re-create + * the view. + */ + if (defaults.bTexturesDisabled) { + if (!D3DAppDisableTextures(defaults.bTexturesDisabled)) { + ReportD3DAppError(); + return FALSE; + } + /* + * Release all objects (ie execute buffers) created by InitView + */ + ReleaseView(d3dapp->lpD3DViewport); + /* + * Create the sample's execute buffers via InitView + */ + if (!InitView(d3dapp->lpDD, d3dapp->lpD3D, d3dapp->lpD3DDevice, + d3dapp->lpD3DViewport, d3dapp->NumUsableTextures, + d3dapp->TextureHandle)) { + Msg("InitView failed.\n"); + CleanUpAndPostQuit(); + return FALSE; + } + } + + SetWindowText(myglobs.hWndMain, defaults.Name); + + return TRUE; +} + +/* + * AfterDeviceCreated + * D3DApp will call this function immediately after the D3D device has been + * created (or re-created). D3DApp expects the D3D viewport to be created and + * returned. The sample's execute buffers are also created (or re-created) + * here. + */ +static BOOL +AfterDeviceCreated(int w, int h, LPDIRECT3DVIEWPORT* lplpViewport, LPVOID lpContext) +{ + HMENU hmenu; + int i; + char ach[20]; + LPDIRECT3DVIEWPORT lpD3DViewport; + HRESULT rval; + + /* + * Create the D3D viewport object + */ + rval = d3dapp->lpD3D->CreateViewport(&lpD3DViewport, NULL); + if (rval != D3D_OK) { + Msg("Create D3D viewport failed.\n%s", D3DAppErrorToString(rval)); + CleanUpAndPostQuit(); + return FALSE; + } + /* + * Add the viewport to the D3D device + */ + rval = d3dapp->lpD3DDevice->AddViewport(lpD3DViewport); + if (rval != D3D_OK) { + Msg("Add D3D viewport failed.\n%s", D3DAppErrorToString(rval)); + CleanUpAndPostQuit(); + return FALSE; + } + /* + * Setup the viewport for a reasonable viewing area + */ + D3DVIEWPORT viewData; + memset(&viewData, 0, sizeof(D3DVIEWPORT)); + viewData.dwSize = sizeof(D3DVIEWPORT); + viewData.dwX = viewData.dwY = 0; + viewData.dwWidth = w; + viewData.dwHeight = h; + viewData.dvScaleX = viewData.dwWidth / (float)2.0; + viewData.dvScaleY = viewData.dwHeight / (float)2.0; + viewData.dvMaxX = (float)D3DDivide(D3DVAL(viewData.dwWidth), + D3DVAL(2 * viewData.dvScaleX)); + viewData.dvMaxY = (float)D3DDivide(D3DVAL(viewData.dwHeight), + D3DVAL(2 * viewData.dvScaleY)); + rval = lpD3DViewport->SetViewport(&viewData); + if (rval != D3D_OK) { + Msg("SetViewport failed.\n%s", D3DAppErrorToString(rval)); + CleanUpAndPostQuit(); + return FALSE; + } + /* + * Return the viewport to D3DApp so it can use it + */ + *lplpViewport = lpD3DViewport; + /* + * Create the sample's execute buffers via InitView + */ + if (!InitView(d3dapp->lpDD, d3dapp->lpD3D, d3dapp->lpD3DDevice, + lpD3DViewport, d3dapp->NumUsableTextures, + d3dapp->TextureHandle)) { + Msg("InitView failed.\n"); + CleanUpAndPostQuit(); + return FALSE; + } + /* + * Add the list of texture formats found by D3DApp to the texture menu + */ + hmenu = GetSubMenu(GetMenu(myglobs.hWndMain), 3); + for (i = 0; i < d3dapp->NumTextureFormats; i++) { + if (d3dapp->TextureFormat[i].bPalettized) { + wsprintf(ach, "%d-bit Palettized", + d3dapp->TextureFormat[i].IndexBPP); + } else { + wsprintf(ach, "%d%d%d RGB", d3dapp->TextureFormat[i].RedBPP, + d3dapp->TextureFormat[i].GreenBPP, + d3dapp->TextureFormat[i].BlueBPP); + } + AppendMenu(hmenu, MF_STRING, MENU_FIRST_FORMAT + i, ach); + } + /* + * Create and initialize the surfaces containing the frame rate and + * window information + */ + InitFontAndTextBuffers(); + + return TRUE; +} + +/* + * BeforeDeviceDestroyed + * D3DApp will call this function before the current D3D device is destroyed + * to give the app the opportunity to destroy objects it has created with the + * DD or D3D objects. + */ +static BOOL +BeforeDeviceDestroyed(LPVOID lpContext) +{ + HMENU hmenu; + int i; + /* + * Release the font object and buffers containing stats + */ + ReleaseFontAndTextBuffers(); + /* + * Release all objects (ie execute buffers) created by InitView + */ + ReleaseView(d3dapp->lpD3DViewport); + /* + * Since we created the viewport it is our responsibility to release + * it. Use D3DApp's pointer to it since we didn't save one. + */ + d3dapp->lpD3DViewport->Release(); + /* + * Delete the list of texture formats from the texture menu because + * they are likely to change + */ + if (myglobs.hWndMain) { + hmenu = GetSubMenu(GetMenu(myglobs.hWndMain), 3); + if (hmenu) { + for (i = 0; i < d3dapp->NumTextureFormats; i++) { + DeleteMenu(hmenu, MENU_FIRST_FORMAT + i, MF_BYCOMMAND); + } + } + } + return TRUE; +} + +/****************************************************************************/ +/* Rendering loop */ +/****************************************************************************/ +/* + * RenderLoop + * Render the next frame and update the window + */ +static BOOL +RenderLoop() +{ + D3DRECT extents[D3DAPP_MAXCLEARRECTS]; + int count; + /* + * If all the DD and D3D objects have been initialized we can render + */ + if (d3dapp->bRenderingIsOK) { + /* + * Restore any lost surfaces + */ + if (!RestoreSurfaces()) { + /* + * Restoring surfaces sometimes fails because the surfaces cannot + * yet be restored. If this is the case, the error will show up + * somewhere else and we should return success here to prevent + * unnecessary error's being reported. + */ + return TRUE; + } + /* + * Calculate the frame rate + */ + if (!CalculateFrameRate()) + return FALSE; + + /* + * Clear the back buffer and Z buffer if enabled. If bResized is set, + * clear the entire window. + */ + if (myglobs.bClearsOn) { + if (!D3DAppClearBackBuffer(myglobs.bResized ? + D3DAPP_CLEARALL : NULL)) { + ReportD3DAppError(); + return FALSE; + } + } + /* + * Call the sample's RenderScene to render this frame + */ + { + if (!RenderScene(d3dapp->lpD3DDevice, d3dapp->lpD3DViewport, + &extents[0])) { + Msg("RenderScene failed.\n"); + return FALSE; + } + count = 1; + } + /* + * Blt the frame rate and window stat text to the back buffer + */ + if (!DisplayFrameRate(&count, &extents[1])) + return FALSE; + /* + * Give D3DApp the extents so it can keep track of dirty sections of + * the back and front buffers + */ + if (!D3DAppRenderExtents(count, extents, myglobs.bResized ? + D3DAPP_CLEARALL : NULL)) { + ReportD3DAppError(); + return FALSE; + } + /* + * Blt or flip the back buffer to the front buffer. Don't report an + * error if this fails. + */ + D3DAppShowBackBuffer(myglobs.bResized ? D3DAPP_SHOWALL : NULL); + + /* + * Reset the resize flag + */ + myglobs.bResized = FALSE; + } + return TRUE; +} + +/* + * AppPause + * Pause and unpause the application + */ +static BOOL +AppPause(BOOL f) +{ + /* + * Flip to the GDI surface and halt rendering + */ + if (!D3DAppPause(f)) + return FALSE; + /* + * When returning from a pause, reset the frame rate count + */ + if (!f) { + ResetFrameRate(); + } + return TRUE; +} + +/* + * RestoreSurfaces + * Restores any lost surfaces. Returns TRUE if all surfaces are not lost and + * FALSE if one or more surfaces is lost and can not be restored at the + * moment. + */ +static BOOL +RestoreSurfaces() +{ + HRESULT d3drval; + + /* + * Have D3DApp check all the surfaces it's in charge of + */ + if (!D3DAppCheckForLostSurfaces()) { + return FALSE; + } + /* + * Check frame rate and info surfaces and re-write them if they + * were lost. + */ + if (myglobs.lpFrameRateBuffer->IsLost() == DDERR_SURFACELOST) { + d3drval = myglobs.lpFrameRateBuffer->Restore(); + if (d3drval != DD_OK) { + return FALSE; + } + if (!WriteFrameRateBuffer(0.0f, 0)) + return FALSE; + } + if (myglobs.lpInfoBuffer->IsLost() == DDERR_SURFACELOST) { + d3drval = myglobs.lpInfoBuffer->Restore(); + if (d3drval != DD_OK) { + return FALSE; + } + if (!WriteInfoBuffer()) + return FALSE; + } + return TRUE; +} + + +/************************************************************************* + Windows message handlers + *************************************************************************/ +/* + * AppAbout + * About box message handler + */ +BOOL +FAR PASCAL AppAbout(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_COMMAND: + if (LOWORD(wParam) == IDOK) + EndDialog(hwnd, TRUE); + break; + + case WM_INITDIALOG: + return TRUE; + } + return FALSE; +} + +/* + * WindowProc + * Main window message handler. + */ +long +FAR PASCAL WindowProc(HWND hWnd, UINT message, WPARAM wParam, + LPARAM lParam ) +{ + int i; + BOOL bStop; + LRESULT lresult; + + /* + * Give D3DApp an opportunity to process any messages it MUST see in order + * to perform it's function. + */ + if (!D3DAppWindowProc(&bStop, &lresult, hWnd, message, wParam, lParam)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + return 0; + } + + /* + * Prevent resizing through this message + */ + if (message == WM_GETMINMAXINFO && myglobs.bResizingDisabled && !d3dapp->bFullscreen && !d3dapp->bMinimized) { + RECT rc; + GetWindowRect(hWnd, &rc); + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = START_WIN_SIZE; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = START_WIN_SIZE; + ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = START_WIN_SIZE; + ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = START_WIN_SIZE; + return 0; + } + + /* + * If bStop is set by D3DApp, the app should not process the message but + * return lresult. + */ + if (bStop) + return lresult; + + switch( message ) { + case WM_MOUSEMOVE: + case WM_LBUTTONDOWN: + case WM_LBUTTONUP: + case WM_RBUTTONDOWN: + case WM_RBUTTONUP: + case WM_MBUTTONDOWN: + case WM_MBUTTONUP: + /* + * Call the sample's MouseHandler if available + */ + if (!MouseHandler) + break; + if ((MouseHandler)(message, wParam, lParam)) + return 1; + break; + case WM_KEYDOWN: + /* + * Call the sample's keyboard handler if available + */ + if (!KeyboardHandler) + break; + if ((KeyboardHandler)(message, wParam, lParam)) + return 1; + break; + /* + * Pause and unpause the app when entering/leaving the menu + */ + case WM_ENTERMENULOOP: + AppPause(TRUE); + break; + case WM_EXITMENULOOP: + AppPause(FALSE); + break; + case WM_DESTROY: + myglobs.hWndMain = NULL; + CleanUpAndPostQuit(); + break; + case WM_INITMENUPOPUP: + /* + * Check and enable the appropriate menu items + */ + if (d3dapp->ThisDriver.bDoesZBuffer) { + EnableMenuItem((HMENU)wParam, MENU_ZBUFFER, MF_ENABLED); + CheckMenuItem((HMENU)wParam, MENU_ZBUFFER, myglobs.rstate.bZBufferOn ? MF_CHECKED : MF_UNCHECKED); + } else { + EnableMenuItem((HMENU)wParam, MENU_ZBUFFER, MF_GRAYED); + CheckMenuItem((HMENU)wParam, MENU_ZBUFFER, MF_UNCHECKED); + } + CheckMenuItem((HMENU)wParam, MENU_STEP, (myglobs.bSingleStepMode) ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_GO, (myglobs.bSingleStepMode) ? MF_ENABLED : MF_GRAYED); + CheckMenuItem((HMENU)wParam, MENU_FLAT, (myglobs.rstate.ShadeMode == D3DSHADE_FLAT) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_GOURAUD, (myglobs.rstate.ShadeMode == D3DSHADE_GOURAUD) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_PHONG, (myglobs.rstate.ShadeMode == D3DSHADE_PHONG) ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_PHONG, MF_GRAYED); + CheckMenuItem((HMENU)wParam, MENU_CLEARS, myglobs.bClearsOn ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_POINT, (myglobs.rstate.FillMode == D3DFILL_POINT) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_WIREFRAME, (myglobs.rstate.FillMode == D3DFILL_WIREFRAME) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_SOLID, (myglobs.rstate.FillMode == D3DFILL_SOLID) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_DITHERING, myglobs.rstate.bDithering ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_SPECULAR, myglobs.rstate.bSpecular ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_SPECULAR, MF_ENABLED); + CheckMenuItem((HMENU)wParam, MENU_FOG, myglobs.rstate.bFogEnabled ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_ANTIALIAS, myglobs.rstate.bAntialiasing ? MF_CHECKED : MF_UNCHECKED); + if (d3dapp->ThisDriver.bDoesTextures) { + CheckMenuItem((HMENU)wParam, MENU_TEXTURE_TOGGLE, (!d3dapp->bTexturesDisabled) ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_TEXTURE_TOGGLE, MF_ENABLED); + EnableMenuItem((HMENU)wParam, MENU_TEXTURE_SWAP, (d3dapp->bTexturesDisabled) ? MF_GRAYED : MF_ENABLED); + CheckMenuItem((HMENU)wParam, MENU_PERSPCORRECT, myglobs.rstate.bPerspCorrect ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_PERSPCORRECT, (d3dapp->bTexturesDisabled) ? MF_GRAYED : MF_ENABLED); + CheckMenuItem((HMENU)wParam, MENU_POINT_FILTER, (myglobs.rstate.TextureFilter == D3DFILTER_NEAREST) ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_POINT_FILTER, (d3dapp->bTexturesDisabled) ? MF_GRAYED : MF_ENABLED); + CheckMenuItem((HMENU)wParam, MENU_LINEAR_FILTER, (myglobs.rstate.TextureFilter == D3DFILTER_LINEAR) ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_LINEAR_FILTER, (d3dapp->bTexturesDisabled) ? MF_GRAYED : MF_ENABLED); + for (i = 0; i < d3dapp->NumTextureFormats; i++) { + CheckMenuItem((HMENU)wParam, MENU_FIRST_FORMAT + i, (i == d3dapp->CurrTextureFormat) ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_FIRST_FORMAT + i, (d3dapp->bTexturesDisabled) ? MF_GRAYED : MF_ENABLED); + } + } else { + EnableMenuItem((HMENU)wParam, MENU_TEXTURE_SWAP, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_TEXTURE_TOGGLE, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_POINT_FILTER, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_LINEAR_FILTER, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_PERSPCORRECT, MF_GRAYED); + } + if (d3dapp->bIsPrimary) { + CheckMenuItem((HMENU)wParam, MENU_FULLSCREEN, d3dapp->bFullscreen ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_FULLSCREEN, d3dapp->bFullscreen && !d3dapp->ThisDriver.bCanDoWindow ? MF_GRAYED : MF_ENABLED); + EnableMenuItem((HMENU)wParam, MENU_NEXT_MODE, (!d3dapp->bFullscreen) ? MF_GRAYED : MF_ENABLED); + EnableMenuItem((HMENU)wParam, MENU_PREVIOUS_MODE, (!d3dapp->bFullscreen) ? MF_GRAYED : MF_ENABLED); + } else { + EnableMenuItem((HMENU)wParam, MENU_FULLSCREEN, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_NEXT_MODE, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_PREVIOUS_MODE, MF_GRAYED); + } + for (i = 0; i < d3dapp->NumModes; i++) { + CheckMenuItem((HMENU)wParam, MENU_FIRST_MODE + i, (i == d3dapp->CurrMode) ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_FIRST_MODE + i, (d3dapp->Mode[i].bThisDriverCanDo) ? MF_ENABLED : MF_GRAYED); + } + for (i = 0; i < d3dapp->NumDrivers; i++) { + CheckMenuItem((HMENU)wParam, MENU_FIRST_DRIVER + i, (i == d3dapp->CurrDriver) ? MF_CHECKED : MF_UNCHECKED); + } + break; + case WM_GETMINMAXINFO: + /* + * Some samples don't like being resized, such as those which use + * screen coordinates (TLVERTEXs). + */ + if (myglobs.bResizingDisabled) { + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = START_WIN_SIZE; + ((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = START_WIN_SIZE; + ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = START_WIN_SIZE; + ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = START_WIN_SIZE; + return 0; + } + break; + case WM_COMMAND: + switch(LOWORD(wParam)) { + case MENU_ABOUT: + AppPause(TRUE); + DialogBox(myglobs.hInstApp, "AppAbout", myglobs.hWndMain, (DLGPROC)AppAbout); + AppPause(FALSE); + break; + case MENU_EXIT: + CleanUpAndPostQuit(); + break; + case MENU_STEP: + /* + * Begin single step more or draw a frame if in single + * step mode + */ + if (!myglobs.bSingleStepMode) { + myglobs.bSingleStepMode = TRUE; + myglobs.bDrawAFrame = TRUE; + } else if (!myglobs.bDrawAFrame) { + myglobs.bDrawAFrame = TRUE; + } + break; + case MENU_GO: + /* + * Exit single step mode + */ + if (myglobs.bSingleStepMode) { + myglobs.bSingleStepMode = FALSE; + ResetFrameRate(); + } + break; + case MENU_STATS: + /* + * Toggle output of frame rate and window info + */ + if ((myglobs.bShowFrameRate) && (myglobs.bShowInfo)) { + myglobs.bShowFrameRate = FALSE; + myglobs.bShowInfo = FALSE; + break; + } + if ((!myglobs.bShowFrameRate) && (!myglobs.bShowInfo)) { + myglobs.bShowFrameRate = TRUE; + break; + } + myglobs.bShowInfo = TRUE; + break; + case MENU_FULLSCREEN: + if (d3dapp->bFullscreen) { + /* + * Return to a windowed mode. Let D3DApp decide which + * D3D driver to use in case this one cannot render to + * the Windows display depth + */ + if (!D3DAppWindow(D3DAPP_YOUDECIDE, D3DAPP_YOUDECIDE)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + break; + } + } else { + /* + * Enter the current fullscreen mode. D3DApp may + * resort to another mode if this driver cannot do + * the currently selected mode. + */ + if (!D3DAppFullscreen(d3dapp->CurrMode)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + break; + } + } + break; + /* + * Texture filter method selection + */ + case MENU_POINT_FILTER: + if (myglobs.rstate.TextureFilter == D3DFILTER_NEAREST) + break; + myglobs.rstate.TextureFilter = D3DFILTER_NEAREST; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + case MENU_LINEAR_FILTER: + if (myglobs.rstate.TextureFilter == D3DFILTER_LINEAR) + break; + myglobs.rstate.TextureFilter = D3DFILTER_LINEAR; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + /* + * Shading selection + */ + case MENU_FLAT: + if (myglobs.rstate.ShadeMode == D3DSHADE_FLAT) + break; + myglobs.rstate.ShadeMode = D3DSHADE_FLAT; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + case MENU_GOURAUD: + if (myglobs.rstate.ShadeMode == D3DSHADE_GOURAUD) + break; + myglobs.rstate.ShadeMode = D3DSHADE_GOURAUD; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + case MENU_PHONG: + if (myglobs.rstate.ShadeMode == D3DSHADE_PHONG) + break; + myglobs.rstate.ShadeMode = D3DSHADE_PHONG; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + /* + * Fill mode selection + */ + case MENU_POINT: + if (myglobs.rstate.FillMode == D3DFILL_POINT) + break; + myglobs.rstate.FillMode = D3DFILL_POINT; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + case MENU_WIREFRAME: + if (myglobs.rstate.FillMode == D3DFILL_WIREFRAME) + break; + myglobs.rstate.FillMode = D3DFILL_WIREFRAME; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + case MENU_SOLID: + if (myglobs.rstate.FillMode == D3DFILL_SOLID) + break; + myglobs.rstate.FillMode = D3DFILL_SOLID; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + case MENU_PERSPCORRECT: + /* + * Toggle perspective correction + */ + myglobs.rstate.bPerspCorrect = + !myglobs.rstate.bPerspCorrect; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + case MENU_CLEARS: + /* + * Toggle the clearing the the back buffer and Z-buffer + * and set the resized flag to clear the entire window + */ + myglobs.bClearsOn = !myglobs.bClearsOn; + if (myglobs.bClearsOn) + myglobs.bResized = TRUE; + break; + case MENU_ZBUFFER: + /* + * Toggle the use of a Z-buffer + */ + myglobs.rstate.bZBufferOn = !myglobs.rstate.bZBufferOn; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + case MENU_DITHERING: + /* + * Toggle dithering + */ + myglobs.rstate.bDithering = !myglobs.rstate.bDithering; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + case MENU_SPECULAR: + /* + * Toggle specular highlights + */ + myglobs.rstate.bSpecular = !myglobs.rstate.bSpecular; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + case MENU_FOG: + /* + * Toggle fog + */ + myglobs.rstate.bFogEnabled = !myglobs.rstate.bFogEnabled; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + case MENU_ANTIALIAS: + /* + * Toggle anti-aliasing + */ + myglobs.rstate.bAntialiasing = + !myglobs.rstate.bAntialiasing; + if (!D3DAppSetRenderState(&myglobs.rstate)) { + ReportD3DAppError(); + break; + } + break; + case MENU_TEXTURE_TOGGLE: + /* + * Release the sample's execute buffers, toggle the + * texture disabled state and recreate them. + */ + ReleaseView(d3dapp->lpD3DViewport); + D3DAppDisableTextures(!d3dapp->bTexturesDisabled); + { + if (!InitView(d3dapp->lpDD, d3dapp->lpD3D, + d3dapp->lpD3DDevice, + d3dapp->lpD3DViewport, + d3dapp->NumUsableTextures, + d3dapp->TextureHandle)) { + Msg("InitView failed.\n"); + CleanUpAndPostQuit(); + break; + } + } + myglobs.bResized = TRUE; + break; + case MENU_TEXTURE_SWAP: + /* + * Swap textures using the load command + */ + if (!D3DAppSwapTextures()) { + ReportD3DAppError(); + break; + } + /* + * Just in case we have a texture background + */ + myglobs.bResized = TRUE; + break; + case MENU_NEXT_MODE: + /* + * Enter the next usable fullscreen mode + */ + i = d3dapp->CurrMode; + do { + ++i; + if (i >= d3dapp->NumModes) + i = 0; + if (!d3dapp->Mode[i].bThisDriverCanDo) + continue; + else { + if (!D3DAppFullscreen(i)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + } + break; + } + } while(i != d3dapp->CurrMode); + break; + case MENU_PREVIOUS_MODE: + /* + * Enter the previous usable fullscreen mode + */ + i = d3dapp->CurrMode; + do { + --i; + if (i < 0) + i = d3dapp->NumModes - 1; + if (!d3dapp->Mode[i].bThisDriverCanDo) + continue; + else { + if (!D3DAppFullscreen(i)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + } + break; + } + } while(i != d3dapp->CurrMode); + break; + } + if ( LOWORD(wParam) >= MENU_FIRST_FORMAT + && LOWORD(wParam) < MENU_FIRST_FORMAT + + D3DAPP_MAXTEXTUREFORMATS + && d3dapp->CurrTextureFormat != + LOWORD(wParam) - MENU_FIRST_FORMAT) { + /* + * Release the sample's execute buffers, change the texture + * format and recreate the view. + */ + ReleaseView(d3dapp->lpD3DViewport); + if (!D3DAppChangeTextureFormat(LOWORD(wParam) - + MENU_FIRST_FORMAT)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + } + { + if (!InitView(d3dapp->lpDD, d3dapp->lpD3D, + d3dapp->lpD3DDevice, d3dapp->lpD3DViewport, + d3dapp->NumUsableTextures, + d3dapp->TextureHandle)) { + Msg("InitView failed.\n"); + CleanUpAndPostQuit(); + break; + } + } + ResetFrameRate(); + } + if ( LOWORD(wParam) >= MENU_FIRST_DRIVER + && LOWORD(wParam) < MENU_FIRST_DRIVER + D3DAPP_MAXD3DDRIVERS + && d3dapp->CurrDriver != LOWORD(wParam) - MENU_FIRST_DRIVER) { + /* + * Change the D3D driver + */ + if (!D3DAppChangeDriver(LOWORD(wParam) - MENU_FIRST_DRIVER, + NULL)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + } + } + if ( LOWORD(wParam) >= MENU_FIRST_MODE + && LOWORD(wParam) < MENU_FIRST_MODE+100) { + /* + * Switch to the selected fullscreen mode + */ + if (!D3DAppFullscreen(LOWORD(wParam) - MENU_FIRST_MODE)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + } + } + /* + * Whenever we receive a command in single step mode, draw a frame + */ + if (myglobs.bSingleStepMode) + myglobs.bDrawAFrame = TRUE; + return 0L; + } + return DefWindowProc(hWnd, message, wParam, lParam); +} + + +/****************************************************************************/ +/* Setting up callbacks for examples */ +/****************************************************************************/ + /* + * SetMouseCallback + * Called in an example to set a callback function for all WM messages + * dealing with the mouse. The handler should return whether or not + * it handled the message. + */ +BOOL +SetMouseCallback(BOOL(*Handler)(UINT, WPARAM, LPARAM)) +{ + MouseHandler = Handler; + return TRUE; +} + +/* + * SetKeyboardCallback + * Called in an example to set a callback function for all WM messages + * dealing with the keyboard. The handler should return whether or not it + * handled the message. + */ +BOOL +SetKeyboardCallback(BOOL(*Handler)(UINT, WPARAM, LPARAM)) { + + KeyboardHandler = Handler; + return TRUE; +} + +/****************************************************************************/ +/* Initialization, error reporting and release functions. */ +/****************************************************************************/ +/* + * InitGlobals + * Called once at program initialization to initialize global variables. + */ +static void +InitGlobals(void) +{ + d3dapp = NULL; + memset(&myglobs.rstate, 0, sizeof(myglobs.rstate)); + memset(&myglobs, 0, sizeof(myglobs)); + myglobs.bClearsOn = TRUE; + myglobs.bShowFrameRate = TRUE; + myglobs.bShowInfo = TRUE; + MouseHandler = NULL; + KeyboardHandler = NULL; +} + +/* + * CleanUpAndPostQuit + * Release all D3D objects, post a quit message and set the bQuit flag + */ +void +CleanUpAndPostQuit(void) +{ + if (myglobs.bQuit) + return; + if (!D3DAppDestroy()) + ReportD3DAppError(); + ReleaseScene(); + myglobs.bQuit = TRUE; + PostQuitMessage( 0 ); +} + +/* + * ReportD3DAppError + * Reports an error during a d3d app call. + */ +void +ReportD3DAppError(void) +{ + Msg("%s", D3DAppLastErrorString()); +} + +/* Msg + * Message output for error notification. + */ +void __cdecl +Msg( LPSTR fmt, ... ) +{ + char buff[256]; + + wvsprintf(buff, fmt, (char *)(&fmt+1)); + lstrcat(buff, "\r\n"); + AppPause(TRUE); + if (d3dapp && d3dapp->bFullscreen) + SetWindowPos(myglobs.hWndMain, HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOSIZE | SWP_NOMOVE); + MessageBox( NULL, buff, "D3D Example Message", MB_OK ); + if (d3dapp && d3dapp->bFullscreen) + SetWindowPos(myglobs.hWndMain, HWND_TOPMOST, 0, 0, 0, 0, + SWP_NOSIZE | SWP_NOMOVE); + AppPause(FALSE); +} + diff --git a/sdk/samples/misc/d3dmain.h b/sdk/samples/misc/d3dmain.h new file mode 100644 index 0000000..6e78bbf --- /dev/null +++ b/sdk/samples/misc/d3dmain.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dmain.h + * + */ +#ifndef __D3DMAIN_H__ +#define __D3DMAIN_H__ + +#include <windows.h> +#include <windowsx.h> +#include <stdio.h> +#include <string.h> +#include <time.h> +#include <search.h> +#include <ddraw.h> +#include <d3d.h> +#include "d3dapp.h" /* prototypes for D3D helper functions */ +#include "d3dres.h" /* defines constants used in d3dmain.rc */ +#include "d3ddemo.h" /* prototypes for functions to communicate with + each sample */ +#define START_WIN_SIZE 320 /* initial size of the window */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct tagd3dmainglobals { + HWND hWndMain; /* application window handle */ + HINSTANCE hInstApp; /* application instance for dialog boxes */ + + D3DAppRenderState rstate; /* struct describing the current render state */ + + BOOL bSingleStepMode; /* render one frame at a time */ + BOOL bDrawAFrame; /* render on this pass of the main loop */ + BOOL bClearsOn; /* clear the back and z-buffer each frame */ + BOOL bShowFrameRate; /* show the frame rate at the top */ + BOOL bShowInfo; /* show window information at the bottom */ + BOOL bResizingDisabled; /* do not allow resizing */ + + BOOL bResized; /* the window has resized or some other drastic change, the + entire client area should be cleared */ + BOOL bQuit; /* program is about to terminate */ + + LPDIRECTDRAWSURFACE lpFrameRateBuffer; /* frame rate surface */ + LPDIRECTDRAWSURFACE lpInfoBuffer; /* window info surface */ +} d3dmainglobals; + +void __cdecl Msg( LPSTR fmt, ... ); +/* + * STATS.CPP FUNCTION PROTOTYPES + */ +BOOL InitFontAndTextBuffers(void); +void ReleaseFontAndTextBuffers(void); +BOOL WriteInfoBuffer(void); +BOOL WriteFrameRateBuffer(float fps, long tps); +void ResetFrameRate(void); +BOOL CalculateFrameRate(void); +BOOL DisplayFrameRate(int* count, LPD3DRECT lpExtents ); + +#ifdef __cplusplus +}; +#endif + +#endif // __D3DMAIN_H__ diff --git a/sdk/samples/misc/d3dmain.rc b/sdk/samples/misc/d3dmain.rc new file mode 100644 index 0000000..806c091 --- /dev/null +++ b/sdk/samples/misc/d3dmain.rc @@ -0,0 +1,103 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dmain.rc + * + */ +#include "d3dres.h" +#include "windows.h" + +AppIcon ICON DISCARDABLE "d3d.ico" + +AppMenu MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&About..\tF1", MENU_ABOUT + MENUITEM SEPARATOR + MENUITEM "&Single Step\tSpc", MENU_STEP + MENUITEM "&Go\tEnter", MENU_GO + MENUITEM "&Toggle Stats\tTab", MENU_STATS + MENUITEM SEPARATOR + MENUITEM SEPARATOR + MENUITEM "E&xit\tESC", MENU_EXIT + END + POPUP "&Render" + BEGIN + MENUITEM "&Flat\tF2", MENU_FLAT + MENUITEM "&Gouraud\tF3", MENU_GOURAUD + MENUITEM "P&hong\tF4", MENU_PHONG + MENUITEM SEPARATOR + MENUITEM "&Point\tCtrl+P", MENU_POINT + MENUITEM "&Wireframe\tCtrl+W", MENU_WIREFRAME + MENUITEM "&Solid\tCtrl+S", MENU_SOLID + MENUITEM SEPARATOR + MENUITEM "&Dithering\tCtrl+D", MENU_DITHERING + MENUITEM "&Anti-aliasing\tCtrl+A", MENU_ANTIALIAS + MENUITEM SEPARATOR + MENUITEM "&Z Buffer\tF5", MENU_ZBUFFER + MENUITEM "&Clears\tF6", MENU_CLEARS + END + POPUP "&Lighting" + BEGIN + MENUITEM "&Specular Highlights\tF7", MENU_SPECULAR + MENUITEM "&Fog\tCtrl+F", MENU_FOG + END + POPUP "&Textures" + BEGIN + MENUITEM "&Textures On\tF8", MENU_TEXTURE_TOGGLE + MENUITEM "&Swap Textures\tF9", MENU_TEXTURE_SWAP + MENUITEM "Perspective &Correct\tF10", MENU_PERSPCORRECT + MENUITEM SEPARATOR + MENUITEM "P&oint Filtering\tCtrl+O", MENU_POINT_FILTER + MENUITEM "Bi-&Linear Filtering\tCtrl+L",MENU_LINEAR_FILTER + MENUITEM SEPARATOR + END + POPUP "&Modes" + BEGIN + MENUITEM "&Fullscreen\tAlt+Enter", MENU_FULLSCREEN + MENUITEM "&Previous Mode\tAlt+PgUp", MENU_PREVIOUS_MODE + MENUITEM "&Next Mode\tAlt+PgDown", MENU_NEXT_MODE + MENUITEM SEPARATOR + END +END + + +AppAccel ACCELERATORS DISCARDABLE +BEGIN + VK_F1, MENU_ABOUT, VIRTKEY, NOINVERT + VK_F2, MENU_FLAT, VIRTKEY, NOINVERT + VK_F3, MENU_GOURAUD, VIRTKEY, NOINVERT + VK_F4, MENU_PHONG, VIRTKEY, NOINVERT + VK_F5, MENU_ZBUFFER, VIRTKEY, NOINVERT + VK_F6, MENU_CLEARS, VIRTKEY, NOINVERT + VK_F7, MENU_SPECULAR, VIRTKEY, NOINVERT + VK_F8, MENU_TEXTURE_TOGGLE,VIRTKEY, NOINVERT + VK_F9, MENU_TEXTURE_SWAP, VIRTKEY, NOINVERT + VK_F10, MENU_PERSPCORRECT, VIRTKEY, NOINVERT + "P", MENU_POINT, VIRTKEY, CONTROL, NOINVERT + "W", MENU_WIREFRAME, VIRTKEY, CONTROL, NOINVERT + "S", MENU_SOLID, VIRTKEY, CONTROL, NOINVERT + "D", MENU_DITHERING, VIRTKEY, CONTROL, NOINVERT + "A", MENU_ANTIALIAS, VIRTKEY, CONTROL, NOINVERT + "F", MENU_FOG, VIRTKEY, CONTROL, NOINVERT + "O", MENU_POINT_FILTER, VIRTKEY, CONTROL, NOINVERT + "L", MENU_LINEAR_FILTER, VIRTKEY, CONTROL, NOINVERT + VK_ESCAPE, MENU_EXIT, VIRTKEY, NOINVERT + VK_SPACE, MENU_STEP, VIRTKEY, NOINVERT + VK_RETURN, MENU_GO, VIRTKEY, NOINVERT + VK_RETURN, MENU_FULLSCREEN, VIRTKEY, ALT, NOINVERT + VK_TAB, MENU_STATS, VIRTKEY, NOINVERT + VK_NEXT, MENU_NEXT_MODE, VIRTKEY, ALT, NOINVERT + VK_PRIOR, MENU_PREVIOUS_MODE, VIRTKEY, ALT, NOINVERT +END + +AppAbout DIALOG DISCARDABLE 0, 0, 188, 96 +STYLE DS_MODALFRAME | WS_POPUP +BEGIN + DEFPUSHBUTTON "OK",IDOK,76,75,35,14 + CTEXT "Direct3D Example",IDC_STATIC,61,5,65,15 + CTEXT "Copyright (c) 1995, 1996 Microsoft Corp.",IDC_STATIC,21,55, + 145,12 + ICON "AppIcon",IDC_STATIC,86,25,16,16 +END diff --git a/sdk/samples/misc/d3dmath.c b/sdk/samples/misc/d3dmath.c new file mode 100644 index 0000000..0ffebc8 --- /dev/null +++ b/sdk/samples/misc/d3dmath.c @@ -0,0 +1,179 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dmath.c + * + ***************************************************************************/ + +#include <d3d.h> +#include <math.h> + +/* + * Normalises the vector v + */ +LPD3DVECTOR +D3DVECTORNormalise(LPD3DVECTOR v) +{ + float vx, vy, vz, inv_mod; + vx = v->x; + vy = v->y; + vz = v->z; + if ((vx == 0) && (vy == 0) && (vz == 0)) + return v; + inv_mod = (float)(1.0 / sqrt(vx * vx + vy * vy + vz * vz)); + v->x = vx * inv_mod; + v->y = vy * inv_mod; + v->z = vz * inv_mod; + return v; +} + + +/* + * Calculates cross product of a and b. + */ +LPD3DVECTOR +D3DVECTORCrossProduct(LPD3DVECTOR lpd, LPD3DVECTOR lpa, LPD3DVECTOR lpb) +{ + + lpd->x = lpa->y * lpb->z - lpa->z * lpb->y; + lpd->y = lpa->z * lpb->x - lpa->x * lpb->z; + lpd->z = lpa->x * lpb->y - lpa->y * lpb->x; + return lpd; +} + + +/* + * lpDst = lpSrc1 * lpSrc2 + * lpDst can be equal to lpSrc1 or lpSrc2 + */ +LPD3DMATRIX MultiplyD3DMATRIX(LPD3DMATRIX lpDst, LPD3DMATRIX lpSrc1, + LPD3DMATRIX lpSrc2) +{ + D3DVALUE M1[4][4], M2[4][4], D[4][4]; + int i, r, c; + + memcpy(&M1[0][0], lpSrc1, sizeof(D3DMATRIX)); + memcpy(&M2[0][0], lpSrc2, sizeof(D3DMATRIX)); + for (r = 0; r < 4; r++) { + for (c = 0; c < 4; c++) { + D[r][c] = (float)0.0; + for (i = 0; i < 4; i++) + D[r][c] += M1[r][i] * M2[i][c]; + } + } + memcpy(lpDst, &D[0][0], sizeof(D3DMATRIX)); + return lpDst; +} + + + +/* + * -1 d = a + */ +LPD3DMATRIX +D3DMATRIXInvert(LPD3DMATRIX d, LPD3DMATRIX a) +{ + d->_11 = a->_11; + d->_12 = a->_21; + d->_13 = a->_31; + d->_14 = a->_14; + + d->_21 = a->_12; + d->_22 = a->_22; + d->_23 = a->_32; + d->_24 = a->_24; + + d->_31 = a->_13; + d->_32 = a->_23; + d->_33 = a->_33; + d->_34 = a->_34; + + d->_41 = a->_14; + d->_42 = a->_24; + d->_43 = a->_34; + d->_44 = a->_44; + + return d; +} + + +/* + * Set the rotation part of a matrix such that the vector lpD is the new + * z-axis and lpU is the new y-axis. + */ +LPD3DMATRIX +D3DMATRIXSetRotation(LPD3DMATRIX lpM, LPD3DVECTOR lpD, LPD3DVECTOR lpU) +{ + float t; + D3DVECTOR d, u, r; + + /* + * Normalise the direction vector. + */ + d.x = lpD->x; + d.y = lpD->y; + d.z = lpD->z; + D3DVECTORNormalise(&d); + + u.x = lpU->x; + u.y = lpU->y; + u.z = lpU->z; + /* + * Project u into the plane defined by d and normalise. + */ + t = u.x * d.x + u.y * d.y + u.z * d.z; + u.x -= d.x * t; + u.y -= d.y * t; + u.z -= d.z * t; + D3DVECTORNormalise(&u); + + /* + * Calculate the vector pointing along the matrix x axis (in a right + * handed coordinate system) using cross product. + */ + D3DVECTORCrossProduct(&r, &u, &d); + + lpM->_11 = r.x; + lpM->_12 = r.y, lpM->_13 = r.z; + lpM->_21 = u.x; + lpM->_22 = u.y, lpM->_23 = u.z; + lpM->_31 = d.x; + lpM->_32 = d.y; + lpM->_33 = d.z; + + return lpM; +} + +/* + * Calculates a point along a B-Spline curve defined by four points. p + * n output, contain the point. t Position + * along the curve between p2 and p3. This position is a float between 0 + * and 1. p1, p2, p3, p4 Points defining spline curve. p, at parameter + * t along the spline curve + */ +void +spline(LPD3DVECTOR p, float t, LPD3DVECTOR p1, LPD3DVECTOR p2, + LPD3DVECTOR p3, LPD3DVECTOR p4) +{ + double t2, t3; + float m1, m2, m3, m4; + + t2 = (double)(t * t); + t3 = t2 * (double)t; + + m1 = (float)((-1.0 * t3) + (2.0 * t2) + (-1.0 * (double)t)); + m2 = (float)((3.0 * t3) + (-5.0 * t2) + (0.0 * (double)t) + 2.0); + m3 = (float)((-3.0 * t3) + (4.0 * t2) + (1.0 * (double)t)); + m4 = (float)((1.0 * t3) + (-1.0 * t2) + (0.0 * (double)t)); + + m1 /= (float)2.0; + m2 /= (float)2.0; + m3 /= (float)2.0; + m4 /= (float)2.0; + + p->x = p1->x * m1 + p2->x * m2 + p3->x * m3 + p4->x * m4; + p->y = p1->y * m1 + p2->y * m2 + p3->y * m3 + p4->y * m4; + p->z = p1->z * m1 + p2->z * m2 + p3->z * m3 + p4->z * m4; +} + diff --git a/sdk/samples/misc/d3dmath.h b/sdk/samples/misc/d3dmath.h new file mode 100644 index 0000000..e295cd2 --- /dev/null +++ b/sdk/samples/misc/d3dmath.h @@ -0,0 +1,58 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dmath.h + * + ***************************************************************************/ +#ifndef __D3DMATH_H__ +#define __D3DMATH_H__ + +#include <math.h> + +#ifdef __cplusplus +extern "C" { +#endif +/* + * Normalises the vector v + */ +LPD3DVECTOR D3DVECTORNormalise(LPD3DVECTOR v); + +/* + * Calculates cross product of a and b. + */ +LPD3DVECTOR D3DVECTORCrossProduct(LPD3DVECTOR lpd, LPD3DVECTOR lpa, LPD3DVECTOR lpb); + +/* + * lpDst = lpSrc1 * lpSrc2 + * lpDst can be equal to lpSrc1 or lpSrc2 + */ +LPD3DMATRIX MultiplyD3DMATRIX(LPD3DMATRIX lpDst, LPD3DMATRIX lpSrc1, + LPD3DMATRIX lpSrc2); +/* + * -1 d = a + */ +LPD3DMATRIX D3DMATRIXInvert(LPD3DMATRIX d, LPD3DMATRIX a); + +/* + * Set the rotation part of a matrix such that the vector lpD is the new + * z-axis and lpU is the new y-axis. + */ +LPD3DMATRIX D3DMATRIXSetRotation(LPD3DMATRIX lpM, LPD3DVECTOR lpD, LPD3DVECTOR lpU); + +/* + * Calculates a point along a B-Spline curve defined by four points. p + * n output, contain the point. t Position + * along the curve between p2 and p3. This position is a float between 0 + * and 1. p1, p2, p3, p4 Points defining spline curve. p, at parameter + * t along the spline curve + */ +void spline(LPD3DVECTOR p, float t, LPD3DVECTOR p1, LPD3DVECTOR p2, + LPD3DVECTOR p3, LPD3DVECTOR p4); + +#ifdef __cplusplus +}; +#endif + +#endif // __D3DMATH_H__ + diff --git a/sdk/samples/misc/d3dres.h b/sdk/samples/misc/d3dres.h new file mode 100644 index 0000000..7ccde74 --- /dev/null +++ b/sdk/samples/misc/d3dres.h @@ -0,0 +1,38 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: ddres.h + * + ***************************************************************************/ + +#define MENU_ABOUT 1 +#define MENU_EXIT 2 +#define MENU_TEXTURE_TOGGLE 3 +#define MENU_TEXTURE_SWAP 4 +#define MENU_FULLSCREEN 7 +#define MENU_NEXT_MODE 8 +#define MENU_PREVIOUS_MODE 9 +#define MENU_STATS 10 +#define MENU_FLAT 12 +#define MENU_GOURAUD 13 +#define MENU_PHONG 14 +#define MENU_ZBUFFER 15 +#define MENU_PERSPCORRECT 16 +#define MENU_POINT_FILTER 17 +#define MENU_LINEAR_FILTER 18 +#define MENU_CLEARS 19 +#define MENU_POINT 20 +#define MENU_WIREFRAME 21 +#define MENU_SOLID 22 +#define MENU_SPECULAR 23 +#define MENU_DITHERING 24 +#define MENU_FOG 25 +#define MENU_ANTIALIAS 26 +#define MENU_STEP 27 +#define MENU_GO 28 +#define MENU_FIRST_FORMAT 40 +#define MENU_FIRST_DRIVER 100 +#define MENU_FIRST_MODE 200 + +#define IDC_STATIC -1 diff --git a/sdk/samples/misc/d3dsphr.c b/sdk/samples/misc/d3dsphr.c new file mode 100644 index 0000000..cdeb113 --- /dev/null +++ b/sdk/samples/misc/d3dsphr.c @@ -0,0 +1,211 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dsphr.c + * + ***************************************************************************/ + +#include <math.h> +#include <d3d.h> + +#define PI 3.1415 + +/* + * Generates a sphere around the y-axis centered at the origin including + * normals and texture coordiantes. Returns TRUE on success and FALSE on + * failure. + * sphere_r Radius of the sphere. + * num_rings Number of full rings not including the top and bottom + * caps. + * num_sections Number of sections each ring is divided into. Each + * section contains two triangles on full rings and one + * on top and bottom caps. + * sx, sy, sz Scaling along each axis. Set each to 1.0 for a + * perfect sphere. + * plpv On exit points to the vertices of the sphere. The + * function allocates this space. Not allocated if + * function fails. + * plptri On exit points to the triangles of the sphere which + * reference vertices in the vertex list. The function + * allocates this space. Not allocated if function fails. + * pnum_v On exit contains the number of vertices. + * pnum_tri On exit contains the number of triangles. + */ +BOOL +GenerateSphere(float sphere_r, int num_rings, int num_sections, float sx, + float sy, float sz, LPD3DVERTEX* plpv, + LPD3DTRIANGLE* plptri, int* pnum_v, int* pnum_tri) +{ + + float theta, phi; /* Angles used to sweep around sphere */ + float dtheta, dphi; /* Angle between each section and ring */ + float x, y, z, v, rsintheta; /* Temporary variables */ + int i, j, n, m; /* counters */ + int num_v, num_tri; /* Internal vertex and triangle count */ + LPD3DVERTEX lpv; /* Internal pointer for vertices */ + LPD3DTRIANGLE lptri; /* Internal pointer for trianlges */ + + /* + * Check the parameters to make sure they are valid. + */ + if ((sphere_r <= 0) || (num_rings < 1) || (num_sections < 3) || + (sx <= 0) || (sy <= 0) || (sz <= 0)) + return FALSE; + /* + * Generate space for the required triangles and vertices. + */ + num_tri = (num_rings + 1) * num_sections * 2; + num_v = (num_rings + 1) * num_sections + 2; + *plpv = (LPD3DVERTEX) malloc(sizeof(D3DVERTEX) * num_v); + *plptri = (LPD3DTRIANGLE) malloc(sizeof(D3DTRIANGLE) * num_tri); + lpv = *plpv; + lptri = *plptri; + *pnum_v = num_v; + *pnum_tri = num_tri; + + /* + * Generate vertices at the top and bottom points. + */ + lpv[0].x = D3DVAL(0.0); + lpv[0].y = D3DVAL(sy * sphere_r); + lpv[0].z = D3DVAL(0.0); + lpv[0].nx = D3DVAL(0.0); + lpv[0].ny = D3DVAL(1.0); + lpv[0].nz = D3DVAL(0.0); + lpv[0].tu = D3DVAL(0.0); + lpv[0].tv = D3DVAL(0.0); + lpv[num_v - 1].x = D3DVAL(0.0); + lpv[num_v - 1].y = D3DVAL(sy * -sphere_r); + lpv[num_v - 1].z = D3DVAL(0.0); + lpv[num_v - 1].nx = D3DVAL(0.0); + lpv[num_v - 1].ny = D3DVAL(-1.0); + lpv[num_v - 1].nz = D3DVAL(0.0); + lpv[num_v - 1].tu = D3DVAL(0.0); + lpv[num_v - 1].tv = D3DVAL(1.0); + + + /* + * Generate vertex points for rings + */ + dtheta = (float)(PI / (double)(num_rings + 2)); + dphi = (float)(2.0 * PI / (double) num_sections); + n = 1; /* vertex being generated, begins at 1 to skip top point */ + theta = dtheta; + for (i = 0; i <= num_rings; i++) { + y = sphere_r * (float)cos(theta); /* y is the same for each ring */ + v = theta / (float)PI; /* v is the same for each ring */ + rsintheta = sphere_r * (float)sin(theta); + phi = (float)0.0; + for (j = 0; j < num_sections; j++) { + x = rsintheta * (float)sin(phi); + z = rsintheta * (float)cos(phi); + lpv[n].x = D3DVAL(sx * x); + lpv[n].z = D3DVAL(sz * z); + lpv[n].y = D3DVAL(sy * y); + lpv[n].nx = D3DVAL(x / sphere_r); + lpv[n].ny = D3DVAL(y / sphere_r); + lpv[n].nz = D3DVAL(z / sphere_r); + lpv[n].tv = D3DVAL(v); + lpv[n].tu = D3DVAL((float)(1.0 - phi / (2.0 * PI))); + phi += dphi; + ++n; + } + theta += dtheta; + } + + /* + * Generate triangles for top and bottom caps. + */ + if (num_sections < 30) { + /* + * we can put the whole cap in a tri fan. + */ + for (i = 0; i < num_sections; i++) { + lptri[i].v1 = 0; + lptri[i].v2 = i + 1; + lptri[i].v3 = 1 + ((i + 1) % num_sections); + + lptri[num_tri - num_sections + i].v1 = num_v - 1; + lptri[num_tri - num_sections + i].v2 = num_v - 2 - i; + lptri[num_tri - num_sections + i].v3 = num_v - 2 - + ((1 + i) % num_sections); + + + /* + * Enable correct edges. + */ + lptri[i].wFlags = D3DTRIFLAG_EDGEENABLE1 | + D3DTRIFLAG_EDGEENABLE2; + + lptri[num_tri - num_sections + i].wFlags= D3DTRIFLAG_EDGEENABLE1 | + D3DTRIFLAG_EDGEENABLE2; + /* + * build fans. + */ + if (i == 0) { + lptri[i].wFlags |= D3DTRIFLAG_START; + lptri[num_tri - num_sections + i].wFlags |= D3DTRIFLAG_START; + } else { + lptri[i].wFlags |= D3DTRIFLAG_EVEN; + lptri[num_tri - num_sections + i].wFlags |= D3DTRIFLAG_EVEN; + } + + } + } else { + for (i = 0; i < num_sections; i++) { + lptri[i].v1 = 0; + lptri[i].v2 = i + 1; + lptri[i].v3 = 1 + ((i + 1) % num_sections); + lptri[i].wFlags = D3DTRIFLAG_EDGEENABLE1; + D3DTRIFLAG_EDGEENABLE2; + lptri[num_tri - num_sections + i].v1 = num_v - 1; + lptri[num_tri - num_sections + i].v2 = num_v - 2 - i; + lptri[num_tri - num_sections + i].v3 = num_v - 2 - + ((1 + i) % num_sections); + lptri[num_tri - num_sections + i].wFlags= D3DTRIFLAG_EDGEENABLE1 | + D3DTRIFLAG_EDGEENABLE2; + } + } + + /* + * Generate triangles for the rings + */ + m = 1; /* first vertex in current ring,begins at 1 to skip top point*/ + n = num_sections; /* triangle being generated, skip the top cap */ + for (i = 0; i < num_rings; i++) { + for (j = 0; j < num_sections; j++) { + lptri[n].v1 = m + j; + lptri[n].v2 = m + num_sections + j; + lptri[n].v3 = m + num_sections + ((j + 1) % num_sections); + lptri[n].wFlags = D3DTRIFLAG_EDGEENABLETRIANGLE; + + /* + * Start a two triangle flat fan for each face. + */ + + lptri[n].wFlags = D3DTRIFLAG_STARTFLAT(1); + + /* + * only need two edges for wireframe. + */ + lptri[n].wFlags |= D3DTRIFLAG_EDGEENABLE1 | + D3DTRIFLAG_EDGEENABLE2; + + + lptri[n + 1].v1 = lptri[n].v1; + lptri[n + 1].v2 = lptri[n].v3; + lptri[n + 1].v3 = m + ((j + 1) % num_sections); + + lptri[n + 1].wFlags = D3DTRIFLAG_EVEN; + /* + * only need two edges for wireframe. + */ + lptri[n + 1].wFlags |= D3DTRIFLAG_EDGEENABLE2 | + D3DTRIFLAG_EDGEENABLE3; + n += 2; + } + m += num_sections; + } + return TRUE; +} diff --git a/sdk/samples/misc/d3dsphr.h b/sdk/samples/misc/d3dsphr.h new file mode 100644 index 0000000..236a1a2 --- /dev/null +++ b/sdk/samples/misc/d3dsphr.h @@ -0,0 +1,45 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: d3dsphr.h + * + ***************************************************************************/ +#ifndef __D3DSPHR_H__ +#define __D3DSPHR_H__ + +#ifdef __cplusplus +extern "C" { +#endif +/* + * Generates a sphere around the y-axis centered at the origin including + * normals and texture coordiantes. Returns TRUE on success and FALSE on + * failure. + * sphere_r Radius of the sphere. + * num_rings Number of full rings not including the top and bottom + * caps. + * num_sections Number of sections each ring is divided into. Each + * section contains two triangles on full rings and one + * on top and bottom caps. + * sx, sy, sz Scaling along each axis. Set each to 1.0 for a + * perfect sphere. + * plpv On exit points to the vertices of the sphere. The + * function allocates this space. Not allocated if + * function fails. + * plptri On exit points to the triangles of the sphere which + * reference vertices in the vertex list. The function + * allocates this space. Not allocated if function fails. + * pnum_v On exit contains the number of vertices. + * pnum_tri On exit contains the number of triangles. + */ +BOOL +GenerateSphere(float sphere_r, int num_rings, int num_sections, float sx, + float sy, float sz, LPD3DVERTEX* plpv, + LPD3DTRIANGLE* plptri, int* pnum_v, int* pnum_tri); + +#ifdef __cplusplus +}; +#endif + +#endif // __D3DSPHR_H__ + diff --git a/sdk/samples/misc/ddcalls.c b/sdk/samples/misc/ddcalls.c new file mode 100644 index 0000000..e539bce --- /dev/null +++ b/sdk/samples/misc/ddcalls.c @@ -0,0 +1,974 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: ddcalls.c + * + * Manages DirectDraw objects needed for rendering. Part of D3DApp. + * + * D3DApp is a collection of helper functions for Direct3D applications. + * D3DApp consists of the following files: + * d3dapp.h Main D3DApp header to be included by application + * d3dappi.h Internal header + * d3dapp.c D3DApp functions seen by application. + * ddcalls.c All calls to DirectDraw objects except textures + * d3dcalls.c All calls to Direct3D objects except textures + * texture.c Texture loading and managing texture list + * misc.c Miscellaneous calls + */ + +#include "d3dappi.h" + +/***************************************************************************/ +/* Direct Draw Creation */ +/***************************************************************************/ +/* + * D3DAppIDDEnumCallback + * Callback function used during enumeration of DirectDraw drivers. + * During enumeration, if a 3D capable hardware device is found, it is + * created and *(LPDIRECTDRAW*)lpContext is set to it. Otherwise, does + * nothing. + */ +BOOL FAR PASCAL D3DAppIDDEnumCallback(GUID FAR* lpGUID, LPSTR lpDriverDesc, + LPSTR lpDriverName, LPVOID lpContext) +{ + LPDIRECTDRAW lpDD; + DDCAPS DriverCaps, HELCaps; + + /* + * A NULL GUID* indicates the DirectDraw HEL which we are not interested + * in at the moment. + */ + if (lpGUID) { + /* + * Create the DirectDraw device using this driver. If it fails, + * just move on to the next driver. + */ + if (FAILED(DirectDrawCreate(lpGUID, &lpDD, NULL))) { + return DDENUMRET_OK; + } + /* + * Get the capabilities of this DirectDraw driver. If it fails, + * just move on to the next driver. + */ + memset(&DriverCaps, 0, sizeof(DDCAPS)); + DriverCaps.dwSize = sizeof(DDCAPS); + memset(&HELCaps, 0, sizeof(DDCAPS)); + HELCaps.dwSize = sizeof(DDCAPS); + if (FAILED(lpDD->lpVtbl->GetCaps(lpDD, &DriverCaps, &HELCaps))) { + lpDD->lpVtbl->Release(lpDD); + return DDENUMRET_OK; + } + if (DriverCaps.dwCaps & DDCAPS_3D) { + /* + * We have found a 3d hardware device. Return the DD object + * and stop enumeration. + */ + d3dappi.bIsPrimary = FALSE; + *(LPDIRECTDRAW*)lpContext = lpDD; + return DDENUMRET_CANCEL; + } + lpDD->lpVtbl->Release(lpDD); + } + return DDENUMRET_OK; +} + +/* + * D3DAppICreateDD + * Creates the DirectDraw device and saves the current palette. If a 3D + * capable DD driver is available, use it as the DD device, otherwise, use + * the HEL. It is assumed that a 3D capable DD hardware driver is not the + * primary device and hence cannot operate in a window (ie it's a fullscreen + * only device displaying on a second monitor). Valid flags: + * D3DAPP_ONLYDDEMULATION Always use the DirectDraw HEL + */ +BOOL +D3DAppICreateDD(DWORD flags) +{ + HDC hdc; + int i; + LPDIRECTDRAW lpDD = NULL; + + /* + * If we aren't forced to use the DirectDraw HEL, search for a 3D capable + * DirectDraw hardware driver and create it. + */ + if (!(flags & D3DAPP_ONLYDDEMULATION)) { + LastError = DirectDrawEnumerate(D3DAppIDDEnumCallback, &lpDD); + if (LastError != DD_OK) { + D3DAppISetErrorString("DirectDrawEnumerate failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + } + if (!lpDD) { + /* + * If we haven't created a hardware DD device by now, resort to HEL + */ + d3dappi.bIsPrimary = TRUE; + LastError = DirectDrawCreate(NULL, &d3dappi.lpDD, NULL); + if (LastError != DD_OK) { + D3DAppISetErrorString("DirectDrawCreate failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + } else { + d3dappi.lpDD = lpDD; + } + /* + * Save the original palette for when we are paused. Just in case we + * start in a fullscreen mode, put them in ppe. + */ + hdc = GetDC(NULL); + GetSystemPaletteEntries(hdc, 0, (1 << 8), + (LPPALETTEENTRY)(&Originalppe[0])); + for (i = 0; i < 256; i++) + ppe[i] = Originalppe[i]; + ReleaseDC(NULL, hdc); + return TRUE; +} + +/***************************************************************************/ +/* Enumerating the display modes */ +/***************************************************************************/ +/* + * EnumDisplayModesCallback + * Callback to save the display mode information. + */ +static HRESULT +CALLBACK EnumDisplayModesCallback(LPDDSURFACEDESC pddsd, LPVOID lpContext) +{ + /* + * Very large resolutions cause problems on some hardware. They are also + * not very useful for real-time rendering. We have chosen to disable + * them by not reporting them as available. + */ + if (pddsd->dwWidth > 1024 || pddsd->dwHeight > 768) + return DDENUMRET_OK; + /* + * Save this mode at the end of the mode array and increment mode count + */ + d3dappi.Mode[d3dappi.NumModes].w = pddsd->dwWidth; + d3dappi.Mode[d3dappi.NumModes].h = pddsd->dwHeight; + d3dappi.Mode[d3dappi.NumModes].bpp = pddsd->ddpfPixelFormat.dwRGBBitCount; + d3dappi.Mode[d3dappi.NumModes].bThisDriverCanDo = FALSE; + d3dappi.NumModes++; + if (d3dappi.NumModes == D3DAPP_MAXMODES) + return DDENUMRET_CANCEL; + else + return DDENUMRET_OK; +} + +/* + * CompareModes + * Compare two display modes during sorting. Modes are sorted by depth and + * then resolution. + */ +static int +_cdecl CompareModes(const void* element1, const void* element2) { + D3DAppMode *lpMode1, *lpMode2; + + lpMode1 = (D3DAppMode*)element1; + lpMode2 = (D3DAppMode*)element2; + + if (lpMode1->bpp > lpMode2->bpp) + return -1; + else if (lpMode2->bpp > lpMode1->bpp) + return 1; + else if (lpMode1->w > lpMode2->w) + return -1; + else if (lpMode2->w > lpMode1->w) + return 1; + else if (lpMode1->h > lpMode2->h) + return -1; + else if (lpMode2->h > lpMode1->h) + return 1; + else + return 0; +} + +/* + * EnumerateDisplayModes + * Generates the list of available display modes. + */ +BOOL +D3DAppIEnumDisplayModes(void) +{ + int i; + /* + * Get a list of available display modes from DirectDraw + */ + d3dappi.NumModes = 0; + LastError = d3dappi.lpDD->lpVtbl->EnumDisplayModes(d3dappi.lpDD, 0, NULL, + 0, EnumDisplayModesCallback); + if(LastError != DD_OK ) { + D3DAppISetErrorString("EnumDisplayModes failed.\n%s", + D3DAppErrorToString(LastError)); + d3dappi.NumModes = 0; + return FALSE; + } + /* + * Sort the list of display modes + */ + qsort((void *)&d3dappi.Mode[0], (size_t)d3dappi.NumModes, sizeof(D3DAppMode), + CompareModes); + /* + * Pick a default display mode. 640x480x16 is a very good mode for + * rendering, so choose it over all others. Otherwise, just take the + * first one. This selection may be overriden later if a driver is + * created which cannot render in this mode. + */ + d3dappi.CurrMode = 0; + for (i = 0; i < d3dappi.NumModes; i++) { + if (d3dappi.Mode[i].w == 640 && d3dappi.Mode[i].h == 480 && + d3dappi.Mode[i].bpp == 16) + d3dappi.CurrMode = i; + } + memcpy(&d3dappi.ThisMode, &d3dappi.Mode[d3dappi.CurrMode], + sizeof(D3DAppMode)); + return TRUE; +} + +/***************************************************************************/ +/* Creating Front and Back Buffers (and misc surf funcs) */ +/***************************************************************************/ +/* + * D3DAppICreateSurface + * Create a DirectDraw Surface of the given description. Using this function + * ensures that all surfaces end up in system memory if that option was set. + * Returns the result of the CreateSurface call. + */ +HRESULT +D3DAppICreateSurface(LPDDSURFACEDESC lpDDSurfDesc, + LPDIRECTDRAWSURFACE FAR *lpDDSurface) { + HRESULT result; + if (d3dappi.bOnlySystemMemory) + lpDDSurfDesc->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; + result = d3dappi.lpDD->lpVtbl->CreateSurface(d3dappi.lpDD, lpDDSurfDesc, + lpDDSurface, NULL); + return result; +} + +/* + * D3DAppIGetSurfDesc + * Get the description of the given surface. Returns the result of the + * GetSurfaceDesc call. + */ +HRESULT +D3DAppIGetSurfDesc(LPDDSURFACEDESC lpDDSurfDesc,LPDIRECTDRAWSURFACE lpDDSurf) +{ + HRESULT result; + memset(lpDDSurfDesc, 0, sizeof(DDSURFACEDESC)); + lpDDSurfDesc->dwSize = sizeof(DDSURFACEDESC); + result = lpDDSurf->lpVtbl->GetSurfaceDesc(lpDDSurf, lpDDSurfDesc); + return result; +} + +/* + * D3DAppICreateBuffers + * Creates the front and back buffers for the window or fullscreen case + * depending on the bFullscreen flag. In the window case, bpp is ignored. + */ +BOOL +D3DAppICreateBuffers(HWND hwnd, int w, int h, int bpp, BOOL bFullscreen, BOOL bIsHardware) +{ + DDSURFACEDESC ddsd; + DDSCAPS ddscaps; + + /* + * Release any old objects that might be lying around. This should have + * already been taken care of, but just in case... + */ + RELEASE(lpClipper); + RELEASE(d3dappi.lpBackBuffer); + RELEASE(d3dappi.lpFrontBuffer); + /* + * The size of the buffers is going to be w x h, so record it now + */ + if (w < D3DAPP_WINDOWMINIMUM) + w = D3DAPP_WINDOWMINIMUM; + if (h < D3DAPP_WINDOWMINIMUM) + h = D3DAPP_WINDOWMINIMUM; + szBuffers.cx = w; + szBuffers.cy = h; + + if (bFullscreen) { + /* + * Create a complex flipping surface for fullscreen mode with one + * back buffer. + */ + memset(&ddsd,0,sizeof(DDSURFACEDESC)); + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | + DDSCAPS_3DDEVICE | DDSCAPS_COMPLEX; + ddsd.dwBackBufferCount = 1; + if (bIsHardware) + ddsd.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY; + LastError = D3DAppICreateSurface(&ddsd, &d3dappi.lpFrontBuffer); + if(LastError != DD_OK) { + if (LastError == DDERR_OUTOFMEMORY || LastError == DDERR_OUTOFVIDEOMEMORY) { + D3DAppISetErrorString("There was not enough video memory to create the rendering surface.\nPlease restart the program and try another fullscreen mode with less resolution or lower bit depth."); + } else { + D3DAppISetErrorString("CreateSurface for fullscreen flipping surface failed.\n%s", + D3DAppErrorToString(LastError)); + } + goto exit_with_error; + } + /* + * Obtain a pointer to the back buffer surface created above so we + * can use it later. For now, just check to see if it ended up in + * video memory (FYI). + */ + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + LastError = d3dappi.lpFrontBuffer->lpVtbl->GetAttachedSurface(d3dappi.lpFrontBuffer, &ddscaps, &d3dappi.lpBackBuffer); + if(LastError != DD_OK) { + D3DAppISetErrorString("GetAttachedSurface failed to get back buffer.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + LastError = D3DAppIGetSurfDesc(&ddsd, d3dappi.lpBackBuffer); + if (LastError != DD_OK) { + D3DAppISetErrorString("Failed to get surface description of back buffer.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + d3dappi.bBackBufferInVideo = + (ddsd.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ? TRUE : FALSE; + } + else { + /* + * In the window case, create a front buffer which is the primary + * surface and a back buffer which is an offscreen plane surface. + */ + memset(&ddsd,0,sizeof(DDSURFACEDESC)); + ddsd.dwSize = sizeof(DDSURFACEDESC); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + /* + * If we specify system memory when creating a primary surface, we + * won't get the actual primary surface in video memory. So, don't + * use D3DAppICreateSurface(). + */ + LastError = d3dappi.lpDD->lpVtbl->CreateSurface(d3dappi.lpDD, + &ddsd, &d3dappi.lpFrontBuffer, NULL); + if(LastError != DD_OK ) { + if (LastError == DDERR_OUTOFMEMORY || LastError == DDERR_OUTOFVIDEOMEMORY) { + D3DAppISetErrorString("There was not enough video memory to create the rendering surface.\nTo run this program in a window of this size, please adjust your display settings for a smaller desktop area or a lower palette size and restart the program."); + } else { + D3DAppISetErrorString("CreateSurface for window front buffer failed.\n%s", + D3DAppErrorToString(LastError)); + } + goto exit_with_error; + } + ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; + ddsd.dwWidth = w; + ddsd.dwHeight = h; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; + if (bIsHardware) + ddsd.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY; + else + ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; + LastError = D3DAppICreateSurface(&ddsd, &d3dappi.lpBackBuffer); + if (LastError != DD_OK) { + if (LastError == DDERR_OUTOFMEMORY || LastError == DDERR_OUTOFVIDEOMEMORY) { + D3DAppISetErrorString("There was not enough video memory to create the rendering surface.\nTo run this program in a window of this size, please adjust your display settings for a smaller desktop area or a lower palette size and restart the program."); + } else { + D3DAppISetErrorString("CreateSurface for window back buffer failed.\n%s", + D3DAppErrorToString(LastError)); + } + goto exit_with_error; + } + /* + * Check to see if the back buffer is in video memory (FYI). + */ + LastError = D3DAppIGetSurfDesc(&ddsd, d3dappi.lpBackBuffer); + if (LastError != DD_OK) { + D3DAppISetErrorString("Failed to get surface description for back buffer.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + d3dappi.bBackBufferInVideo = + (ddsd.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ? TRUE : FALSE; + /* + * Create the DirectDraw Clipper object and attach it to the window + * and front buffer. + */ + LastError = d3dappi.lpDD->lpVtbl->CreateClipper(d3dappi.lpDD, 0, + &lpClipper, NULL); + if(LastError != DD_OK ) { + D3DAppISetErrorString("CreateClipper failed.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + LastError = lpClipper->lpVtbl->SetHWnd(lpClipper, 0, hwnd); + if(LastError != DD_OK ) { + D3DAppISetErrorString("Attaching clipper to window failed.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + LastError = + d3dappi.lpFrontBuffer->lpVtbl->SetClipper(d3dappi.lpFrontBuffer, + lpClipper); + if(LastError != DD_OK ) { + D3DAppISetErrorString("Attaching clipper to front buffer failed.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + } + + D3DAppIClearBuffers(); + return TRUE; + +exit_with_error: + RELEASE(d3dappi.lpFrontBuffer); + RELEASE(d3dappi.lpBackBuffer); + RELEASE(lpClipper); + return FALSE; +} + +/* + * D3DAppICheckForPalettized + * If the front/back buffer is palettized, we need to create a palette. + */ +BOOL +D3DAppICheckForPalettized(void) +{ + DDSURFACEDESC ddsd; + /* + * Get the back buffer surface description and check to see if it's + * palettized + */ + LastError = D3DAppIGetSurfDesc(&ddsd, d3dappi.lpBackBuffer); + if (LastError != DD_OK) { + D3DAppISetErrorString("Failed to get surface description for back buffer for palettizing.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + bPrimaryPalettized = + (ddsd.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) ? TRUE : FALSE; + + if (bPrimaryPalettized) { + int i; + /* + * Get the current palette. + */ + HDC hdc = GetDC(NULL); + GetSystemPaletteEntries(hdc, 0, (1 << 8), ppe); + ReleaseDC(NULL, hdc); + /* + * Change the flags on the palette entries to allow D3D to change + * some of them. In the window case, we must not change the top and + * bottom ten (system colors), but in a fullscreen mode we can have + * all but the first and last. + */ + if (!d3dappi.bFullscreen) { + for (i = 0; i < 10; i++) ppe[i].peFlags = D3DPAL_READONLY; + for (i = 10; i < 256 - 10; i++) ppe[i].peFlags = D3DPAL_FREE | PC_RESERVED; + for (i = 256 - 10; i < 256; i++) ppe[i].peFlags = D3DPAL_READONLY; + } else { + ppe[0].peFlags = D3DPAL_READONLY; + for (i = 1; i < 255; i++) ppe[i].peFlags = D3DPAL_FREE | PC_RESERVED; + ppe[255].peFlags = D3DPAL_READONLY; + } + /* + * Create a palette using the old colors and new flags + */ + LastError = d3dappi.lpDD->lpVtbl->CreatePalette(d3dappi.lpDD, + DDPCAPS_8BIT | DDPCAPS_INITIALIZE, + ppe, &lpPalette, NULL); + if (LastError != DD_OK) { + D3DAppISetErrorString("CreatePalette failed.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + /* + * Set this as the front and back buffers' palette + */ + LastError = + d3dappi.lpBackBuffer->lpVtbl->SetPalette(d3dappi.lpBackBuffer, + lpPalette); + if(LastError != DD_OK ) { + D3DAppISetErrorString("SetPalette failed on back buffer.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + LastError = + d3dappi.lpFrontBuffer->lpVtbl->SetPalette(d3dappi.lpFrontBuffer, + lpPalette); + if(LastError != DD_OK ) { + D3DAppISetErrorString("SetPalette failed on front buffer.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + /* + * The palette is now valid, so set it again on anyt WM_ACTIVATE + */ + bPaletteActivate = TRUE; + } + return TRUE; +exit_with_error: + RELEASE(lpPalette); + return FALSE; +} + +/***************************************************************************/ +/* Creation of Z-Buffer */ +/***************************************************************************/ +/* + * D3DAppICreateZBuffer + * Create a Z-Buffer of the appropriate depth and attach it to the back + * buffer. + */ +BOOL +D3DAppICreateZBuffer(int w, int h, int driver) +{ + DDSURFACEDESC ddsd; + DWORD devDepth; + /* + * Release any Z-Buffer that might be around just in case. + */ + RELEASE(d3dappi.lpZBuffer); + + /* + * If this driver does not do z-buffering, don't create a z-buffer + */ + if (!d3dappi.Driver[driver].bDoesZBuffer) + return TRUE; + + memset(&ddsd, 0 ,sizeof(DDSURFACEDESC)); + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | + DDSD_ZBUFFERBITDEPTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; + ddsd.dwHeight = h; + ddsd.dwWidth = w; + /* + * If this is a hardware D3D driver, the Z-Buffer MUST end up in video + * memory. Otherwise, it MUST end up in system memory. + */ + if (d3dappi.Driver[driver].bIsHardware) + ddsd.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY; + else + ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; + /* + * Get the Z buffer bit depth from this driver's D3D device description + */ + devDepth = d3dappi.Driver[driver].Desc.dwDeviceZBufferBitDepth; + if (devDepth & DDBD_32) + ddsd.dwZBufferBitDepth = 32; + else if (devDepth & DDBD_24) + ddsd.dwZBufferBitDepth = 24; + else if (devDepth & DDBD_16) + ddsd.dwZBufferBitDepth = 16; + else if (devDepth & DDBD_8) + ddsd.dwZBufferBitDepth = 8; + else { + D3DAppISetErrorString("Unsupported Z-buffer depth requested by device.\n"); + return FALSE; + } + LastError = d3dappi.lpDD->lpVtbl->CreateSurface(d3dappi.lpDD, &ddsd, + &d3dappi.lpZBuffer, + NULL); + if(LastError != DD_OK) { + if (LastError == DDERR_OUTOFMEMORY || LastError == DDERR_OUTOFVIDEOMEMORY) { + if (d3dappi.bFullscreen) { + D3DAppISetErrorString("There was not enough video memory to create the Z-buffer surface.\nPlease restart the program and try another fullscreen mode with less resolution or lower bit depth."); + } else { + D3DAppISetErrorString("There was not enough video memory to create the Z-buffer surface.\nTo run this program in a window of this size, please adjust your display settings for a smaller desktop area or a lower palette size and restart the program."); + } + } else { + D3DAppISetErrorString("CreateSurface for Z-buffer failed.\n%s", + D3DAppErrorToString(LastError)); + } + goto exit_with_error; + } + /* + * Attach the Z-buffer to the back buffer so D3D will find it + */ + LastError = + d3dappi.lpBackBuffer->lpVtbl->AddAttachedSurface(d3dappi.lpBackBuffer, + d3dappi.lpZBuffer); + if(LastError != DD_OK) { + D3DAppISetErrorString("AddAttachedBuffer failed for Z-Buffer.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + /* + * Find out if it ended up in video memory. + */ + LastError = D3DAppIGetSurfDesc(&ddsd, d3dappi.lpZBuffer); + if (LastError != DD_OK) { + D3DAppISetErrorString("Failed to get surface description of Z buffer.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + d3dappi.bZBufferInVideo = + (ddsd.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ? TRUE : FALSE; + if (d3dappi.Driver[driver].bIsHardware && !d3dappi.bZBufferInVideo) { + D3DAppISetErrorString("Could not fit the Z-buffer in video memory for this hardware device.\n"); + goto exit_with_error; + } + + return TRUE; + +exit_with_error: + RELEASE(d3dappi.lpZBuffer); + return FALSE; +} + +/***************************************************************************/ +/* WM_SIZE Handler */ +/***************************************************************************/ +/* + * D3DAppIHandleWM_SIZE + * Processes the WM_SIZE message. Resizes all the buffers and re-creates + * device if necessary. + */ +BOOL +D3DAppIHandleWM_SIZE(LRESULT* lresult, HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam) +{ + int w, h, i; + /* + * If we have minimzied, take note and call the default window proc + */ + if (wParam == SIZE_MINIMIZED) { + d3dappi.bMinimized = TRUE; + *lresult = DefWindowProc(hwnd, message, wParam, lParam); + return TRUE; + } + /* + * In fullscreen mode, restore our surfaces and let DDraw take + * care of the rest. + */ + if (d3dappi.bFullscreen) { + D3DAppIValidateDirtyRects(); + D3DAppCheckForLostSurfaces(); + d3dappi.bMinimized = FALSE; + *lresult = DefWindowProc(hwnd, message, wParam, lParam); + return TRUE; + } + /* + * If we are minimized, this is the un-minimized size message. + */ + if (d3dappi.bMinimized) { + /* + * Restore our surfaces and update the dirty rectangle info + */ + D3DAppIValidateDirtyRects(); + D3DAppCheckForLostSurfaces(); + d3dappi.bMinimized = FALSE; + *lresult = DefWindowProc(hwnd, message, wParam, lParam); + return TRUE; + } + /* + * Since we are still here, this must be a regular, window resize + * message. A new viewport will definitely be needed, but the + * device and buffers will only be re-created if they have gotten bigger + * or change size by a very large amount. + */ + D3DAppIGetClientWin(hwnd); + w = LOWORD(lParam); + h = HIWORD(lParam); + /* + * If w and h are under the minimum, create buffers of the minimum size + */ + if (w < D3DAPP_WINDOWMINIMUM) + w = D3DAPP_WINDOWMINIMUM; + if (h < D3DAPP_WINDOWMINIMUM) + h = D3DAPP_WINDOWMINIMUM; + /* + * Destroy the viewport and all execute buffers + */ + d3dappi.bRenderingIsOK = FALSE; + ATTEMPT(D3DAppICallDeviceDestroyCallback()); + /* + * Only create a new device and buffers if they changed significantly, + * otherwise just make sure the old buffers aren't lost. + */ + if ((w > szBuffers.cx || h > szBuffers.cy) || + (w < szBuffers.cx / 2 || h < szBuffers.cy / 2)) { + /* + * Release the device + */ + RELEASE(d3dappi.lpD3DDevice); + /* + * Release the old buffers + */ + RELEASE(d3dappi.lpZBuffer); + RELEASE(lpPalette); + RELEASE(lpClipper); + RELEASE(d3dappi.lpBackBuffer); + RELEASE(d3dappi.lpFrontBuffer); + /* + * Create new ones + */ + ATTEMPT(D3DAppICreateBuffers(hwnd, w, h, D3DAPP_BOGUS, FALSE, d3dappi.ThisDriver.bIsHardware)); + ATTEMPT(D3DAppICheckForPalettized()); + ATTEMPT(D3DAppICreateZBuffer(w, h, d3dappi.CurrDriver)); + /* + * Create the driver + */ + ATTEMPT(D3DAppICreateDevice(d3dappi.CurrDriver)); + /* + * Since the driver did not change, the texture surfaces are still valid. + * We just need to get new handles. + */ + if (d3dappi.ThisDriver.bDoesTextures) { + for (i = 0; i < d3dappi.NumUsableTextures; i++) { + D3DAppIGetTextureHandle(i); + } + } + } else { + D3DAppCheckForLostSurfaces(); + } + /* + * Call the device create callback to create the viewport, set the render + * state and clear the dirty rectangle info + */ + ATTEMPT(D3DAppICallDeviceCreateCallback(w, h)); + ATTEMPT(D3DAppISetRenderState()); + D3DAppIValidateDirtyRects(); + d3dappi.bRenderingIsOK = TRUE; + /* + * Call the default window proc + */ + *lresult = DefWindowProc(hwnd, message, wParam, lParam); + return TRUE; +exit_with_error: + D3DAppICallDeviceDestroyCallback(); + RELEASE(d3dappi.lpD3DDevice); + RELEASE(d3dappi.lpZBuffer); + RELEASE(lpPalette); + RELEASE(lpClipper); + RELEASE(d3dappi.lpBackBuffer); + RELEASE(d3dappi.lpFrontBuffer); + return FALSE; +} + +/***************************************************************************/ +/* Setting the display mode and cooperative level */ +/***************************************************************************/ +/* + * D3DAppISetCoopLevel + * Set the cooperative level to exclusive mode for fullscreen and normal for + * a window. Set the bIgnoreWM_SIZE flag because SetCooperativeLevel + * generates a WM_SIZE message you do not have to resize the buffers on. + */ +BOOL +D3DAppISetCoopLevel(HWND hwnd, BOOL bFullscreen) +{ + if (bFullscreen) { + bIgnoreWM_SIZE = TRUE; + LastError = d3dappi.lpDD->lpVtbl->SetCooperativeLevel(d3dappi.lpDD, + hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + bIgnoreWM_SIZE = FALSE; + if(LastError != DD_OK ) { + D3DAppISetErrorString("SetCooperativeLevel to fullscreen failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + d3dappi.bFullscreen = TRUE; + } else { + bIgnoreWM_SIZE = TRUE; + LastError = d3dappi.lpDD->lpVtbl->SetCooperativeLevel(d3dappi.lpDD, + hwnd, DDSCL_NORMAL); + bIgnoreWM_SIZE = FALSE; + if(LastError != DD_OK ) { + D3DAppISetErrorString("SetCooperativeLevel to normal failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + d3dappi.bFullscreen = FALSE; + } + return TRUE; +} + +/* + * D3DAppISetDisplayMode + * Set the display mode to the given dimensions and bits per pixel. The + * bIgnoreWM_SIZE message is set because the display change generates a + * WM_SIZE message which we don't want to resize the buffers on. + */ +BOOL +D3DAppISetDisplayMode(int w, int h, int bpp) +{ + d3dappi.ThisMode.w = w; d3dappi.ThisMode.h = h; + d3dappi.ThisMode.bpp = bpp; + bIgnoreWM_SIZE = TRUE; + LastError = d3dappi.lpDD->lpVtbl->SetDisplayMode(d3dappi.lpDD, w, h, + bpp); + bIgnoreWM_SIZE = FALSE; + if(LastError != DD_OK ) { + D3DAppISetErrorString("SetDisplayMode to %dx%dx%d failed\n%s", + w, h, bpp, D3DAppErrorToString(LastError)); + return FALSE; + } + return TRUE; +} + +/* + * D3DAppIRestoreDispMode + * Restores the display mode to the current windows display mode. The + * bIgnoreWM_SIZE message is set because the display change generates a + * WM_SIZE message which we don't want to resize the buffers on. + */ +BOOL +D3DAppIRestoreDispMode(void) +{ + bIgnoreWM_SIZE = TRUE; + LastError = d3dappi.lpDD->lpVtbl->RestoreDisplayMode(d3dappi.lpDD); + if (LastError != DD_OK) { + D3DAppISetErrorString("RestoreDisplayMode failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + bIgnoreWM_SIZE = FALSE; + return TRUE; +} + +/* + * D3DAppRememberWindowsMode + * Record the current display mode in d3dappi.WindowsDisplay + */ +BOOL +D3DAppIRememberWindowsMode(void) +{ + DDSURFACEDESC ddsd; + + memset(&ddsd, 0, sizeof(DDSURFACEDESC)); + ddsd.dwSize = sizeof(DDSURFACEDESC); + LastError = d3dappi.lpDD->lpVtbl->GetDisplayMode(d3dappi.lpDD, &ddsd); + if (LastError != DD_OK) { + D3DAppISetErrorString("Getting the current display mode failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + d3dappi.WindowsDisplay.w = ddsd.dwWidth; + d3dappi.WindowsDisplay.h = ddsd.dwHeight; + d3dappi.WindowsDisplay.bpp = ddsd.ddpfPixelFormat.dwRGBBitCount; + return TRUE; +} + +/***************************************************************************/ +/* Misc DD Utilities */ +/***************************************************************************/ + +/* + * D3DAppIClearBuffers + * Clear the front and back buffers to black + */ +BOOL +D3DAppIClearBuffers(void) +{ + DDSURFACEDESC ddsd; + RECT dst; + DDBLTFX ddbltfx; + /* + * Find the width and height of the front buffer by getting its + * DDSURFACEDESC + */ + if (d3dappi.lpFrontBuffer) { + LastError = D3DAppIGetSurfDesc(&ddsd, d3dappi.lpFrontBuffer); + if (LastError != DD_OK) { + D3DAppISetErrorString("Failure getting the surface description of the front buffer before clearing.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + /* + * Clear the front buffer to black + */ + memset(&ddbltfx, 0, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(DDBLTFX); + SetRect(&dst, 0, 0, ddsd.dwWidth, ddsd.dwHeight); + LastError = d3dappi.lpFrontBuffer->lpVtbl->Blt(d3dappi.lpFrontBuffer, + &dst, NULL, NULL, + DDBLT_COLORFILL | DDBLT_WAIT, + &ddbltfx); + if (LastError != DD_OK) { + D3DAppISetErrorString("Clearing the front buffer failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + } + if (d3dappi.lpBackBuffer) { + /* + * Find the width and height of the back buffer by getting its + * DDSURFACEDESC + */ + LastError = D3DAppIGetSurfDesc(&ddsd, d3dappi.lpBackBuffer); + if (LastError != DD_OK) { + D3DAppISetErrorString("Failure while getting the surface description of the back buffer before clearing.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + /* + * Clear the back buffer to black + */ + memset(&ddbltfx, 0, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(DDBLTFX); + SetRect(&dst, 0, 0, ddsd.dwWidth, ddsd.dwHeight); + LastError = d3dappi.lpBackBuffer->lpVtbl->Blt(d3dappi.lpBackBuffer, &dst, + NULL, NULL, + DDBLT_COLORFILL | DDBLT_WAIT, + &ddbltfx); + if (LastError != DD_OK) { + D3DAppISetErrorString("Clearing the front buffer failed.\n%s", + D3DAppErrorToString(LastError)); + return FALSE; + } + } + return TRUE; +} + +/* + * D3DAppIBPPToDDBD + * Convert an integer bit per pixel number to a DirectDraw bit depth flag + */ +DWORD +D3DAppIBPPToDDBD(int bpp) +{ + switch(bpp) { + case 1: + return DDBD_1; + case 2: + return DDBD_2; + case 4: + return DDBD_4; + case 8: + return DDBD_8; + case 16: + return DDBD_16; + case 24: + return DDBD_24; + case 32: + return DDBD_32; + default: + return (DWORD)D3DAPP_BOGUS; + } +} + +/* + * D3DAppTotalVideoMemory + * Returns the amount of total video memory supported (not free) + */ +DWORD +D3DAppTotalVideoMemory(void) +{ + DDCAPS DriverCaps, HELCaps; + memset (&DriverCaps, 0, sizeof(DDCAPS)); + DriverCaps.dwSize = sizeof(DDCAPS); + memset (&HELCaps, 0, sizeof(DDCAPS)); + HELCaps.dwSize = sizeof(DDCAPS); + LastError = d3dappi.lpDD->lpVtbl->GetCaps(d3dappi.lpDD, &DriverCaps, + &HELCaps); + if (LastError != DD_OK) { + D3DAppISetErrorString("Getting DD capabilities failed while checking total video memory.\n%s", + D3DAppErrorToString(LastError)); + return 0L; + } + if (DriverCaps.dwVidMemTotal) + return DriverCaps.dwVidMemTotal; + else + return HELCaps.dwVidMemTotal; +} diff --git a/sdk/samples/misc/ddutil.cpp b/sdk/samples/misc/ddutil.cpp new file mode 100644 index 0000000..361b08b --- /dev/null +++ b/sdk/samples/misc/ddutil.cpp @@ -0,0 +1,320 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: ddutil.cpp + * Content: Routines for loading bitmap and palettes from resources + * + ***************************************************************************/ +#undef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <ddraw.h> +#include "ddutil.h" + +/* + * DDLoadBitmap + * + * create a DirectDrawSurface from a bitmap resource. + * + */ +extern "C" IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy) +{ + HBITMAP hbm; + BITMAP bm; + DDSURFACEDESC ddsd; + IDirectDrawSurface *pdds; + + // + // try to load the bitmap as a resource, if that fails, try it as a file + // + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, dx, dy, LR_CREATEDIBSECTION); + + if (hbm == NULL) + hbm = (HBITMAP)LoadImage(NULL, szBitmap, IMAGE_BITMAP, dx, dy, LR_LOADFROMFILE|LR_CREATEDIBSECTION); + + if (hbm == NULL) + return NULL; + + // + // get size of the bitmap + // + GetObject(hbm, sizeof(bm), &bm); // get size of bitmap + + // + // create a DirectDrawSurface 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 = bm.bmWidth; + ddsd.dwHeight = bm.bmHeight; + + if (pdd->CreateSurface(&ddsd, &pdds, NULL) != DD_OK) + return NULL; + + DDCopyBitmap(pdds, hbm, 0, 0, 0, 0); + + DeleteObject(hbm); + + return pdds; +} + +/* + * DDReLoadBitmap + * + * load a bitmap from a file or resource into a directdraw surface. + * normaly used to re-load a surface after a restore. + * + */ +HRESULT DDReLoadBitmap(IDirectDrawSurface *pdds, LPCSTR szBitmap) +{ + HBITMAP hbm; + HRESULT hr; + + // + // try to load the bitmap as a resource, if that fails, try it as a file + // + hbm = (HBITMAP)LoadImage(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); + + if (hbm == NULL) + hbm = (HBITMAP)LoadImage(NULL, szBitmap, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION); + + if (hbm == NULL) + { + OutputDebugString("handle is null\n"); + return E_FAIL; + } + + hr = DDCopyBitmap(pdds, hbm, 0, 0, 0, 0); + if (hr != DD_OK) + { + OutputDebugString("ddcopybitmap failed\n"); + } + + + DeleteObject(hbm); + return hr; +} + +/* + * DDCopyBitmap + * + * draw a bitmap into a DirectDrawSurface + * + */ +extern "C" HRESULT DDCopyBitmap(IDirectDrawSurface *pdds, HBITMAP hbm, int x, int y, int dx, int dy) +{ + HDC hdcImage; + HDC hdc; + BITMAP bm; + DDSURFACEDESC ddsd; + HRESULT hr; + + if (hbm == NULL || pdds == NULL) + return E_FAIL; + + // + // make sure this surface is restored. + // + pdds->Restore(); + + // + // select bitmap into a memoryDC so we can use it. + // + hdcImage = CreateCompatibleDC(NULL); + if (!hdcImage) + OutputDebugString("createcompatible dc failed\n"); + SelectObject(hdcImage, hbm); + + // + // get size of the bitmap + // + GetObject(hbm, sizeof(bm), &bm); // get size of bitmap + dx = dx == 0 ? bm.bmWidth : dx; // use the passed size, unless zero + dy = dy == 0 ? bm.bmHeight : dy; + + // + // get size of surface. + // + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH; + pdds->GetSurfaceDesc(&ddsd); + + if ((hr = pdds->GetDC(&hdc)) == DD_OK) + { + StretchBlt(hdc, 0, 0, ddsd.dwWidth, ddsd.dwHeight, hdcImage, x, y, dx, dy, SRCCOPY); + pdds->ReleaseDC(hdc); + } + + DeleteDC(hdcImage); + + return hr; +} + +// +// DDLoadPalette +// +// Create a DirectDraw palette object from a bitmap resoure +// +// if the resource does not exist or NULL is passed create a +// default 332 palette. +// +extern "C" IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap) +{ + IDirectDrawPalette* ddpal; + int i; + int n; + int fh; + HRSRC h; + LPBITMAPINFOHEADER lpbi; + PALETTEENTRY ape[256]; + RGBQUAD * prgb; + + // + // build a 332 palette as the default. + // + for (i=0; i<256; i++) + { + ape[i].peRed = (BYTE)(((i >> 5) & 0x07) * 255 / 7); + ape[i].peGreen = (BYTE)(((i >> 2) & 0x07) * 255 / 7); + ape[i].peBlue = (BYTE)(((i >> 0) & 0x03) * 255 / 3); + ape[i].peFlags = (BYTE)0; + } + + // + // get a pointer to the bitmap resource. + // + if (szBitmap && (h = FindResource(NULL, szBitmap, RT_BITMAP))) + { + lpbi = (LPBITMAPINFOHEADER)LockResource(LoadResource(NULL, h)); + if (!lpbi) + OutputDebugString("lock resource failed\n"); + prgb = (RGBQUAD*)((BYTE*)lpbi + lpbi->biSize); + + if (lpbi == NULL || lpbi->biSize < sizeof(BITMAPINFOHEADER)) + n = 0; + else if (lpbi->biBitCount > 8) + n = 0; + else if (lpbi->biClrUsed == 0) + n = 1 << lpbi->biBitCount; + else + n = lpbi->biClrUsed; + + // + // a DIB color table has its colors stored BGR not RGB + // so flip them around. + // + for(i=0; i<n; i++ ) + { + ape[i].peRed = prgb[i].rgbRed; + ape[i].peGreen = prgb[i].rgbGreen; + ape[i].peBlue = prgb[i].rgbBlue; + ape[i].peFlags = 0; + } + } + else 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; + + // + // a DIB color table has its colors stored BGR not RGB + // so flip them around. + // + for(i=0; i<n; i++ ) + { + BYTE r = ape[i].peRed; + ape[i].peRed = ape[i].peBlue; + ape[i].peBlue = r; + } + } + + pdd->CreatePalette(DDPCAPS_8BIT, ape, &ddpal, NULL); + + return ddpal; +} + +/* + * DDColorMatch + * + * convert a RGB color to a pysical color. + * + * we do this by leting GDI SetPixel() do the color matching + * then we lock the memory and see what it got mapped to. + */ +extern "C" DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb) +{ + COLORREF rgbT; + HDC hdc; + DWORD dw = CLR_INVALID; + DDSURFACEDESC ddsd; + HRESULT hres; + + // + // use GDI SetPixel to color match for us + // + if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK) + { + rgbT = GetPixel(hdc, 0, 0); // save current pixel value + SetPixel(hdc, 0, 0, rgb); // set our value + pdds->ReleaseDC(hdc); + } + + // + // now lock the surface so we can read back the converted color + // + ddsd.dwSize = sizeof(ddsd); + while ((hres = pdds->Lock(NULL, &ddsd, 0, NULL)) == DDERR_WASSTILLDRAWING) + ; + + if (hres == DD_OK) + { + dw = *(DWORD *)ddsd.lpSurface; // get DWORD + dw &= (1 << ddsd.ddpfPixelFormat.dwRGBBitCount)-1; // mask it to bpp + pdds->Unlock(NULL); + } + + // + // now put the color that was there back. + // + if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK) + { + SetPixel(hdc, 0, 0, rgbT); + pdds->ReleaseDC(hdc); + } + + return dw; +} + +/* + * DDSetColorKey + * + * set a color key for a surface, given a RGB. + * if you pass CLR_INVALID as the color key, the pixel + * in the upper-left corner will be used. + */ +extern "C" HRESULT DDSetColorKey(IDirectDrawSurface *pdds, COLORREF rgb) +{ + DDCOLORKEY ddck; + + ddck.dwColorSpaceLowValue = DDColorMatch(pdds, rgb); + ddck.dwColorSpaceHighValue = ddck.dwColorSpaceLowValue; + return pdds->SetColorKey(DDCKEY_SRCBLT, &ddck); +} diff --git a/sdk/samples/misc/ddutil.h b/sdk/samples/misc/ddutil.h new file mode 100644 index 0000000..e1f782b --- /dev/null +++ b/sdk/samples/misc/ddutil.h @@ -0,0 +1,23 @@ +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: ddutil.cpp + * Content: Routines for loading bitmap and palettes from resources + * + ***************************************************************************/ + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +extern IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap); +extern IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy); +extern HRESULT DDReLoadBitmap(IDirectDrawSurface *pdds, LPCSTR szBitmap); +extern HRESULT DDCopyBitmap(IDirectDrawSurface *pdds, HBITMAP hbm, int x, int y, int dx, int dy); +extern DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb); +extern HRESULT DDSetColorKey(IDirectDrawSurface *pdds, COLORREF rgb); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ diff --git a/sdk/samples/misc/dsutil.c b/sdk/samples/misc/dsutil.c new file mode 100644 index 0000000..d9871fb --- /dev/null +++ b/sdk/samples/misc/dsutil.c @@ -0,0 +1,378 @@ +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: dsutil.cpp + * Content: Routines for dealing with sounds from resources + * + * + ***************************************************************************/ + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#include <dsound.h> + +typedef struct +{ + BYTE *pbWaveData; // pointer into wave resource (for restore) + DWORD cbWaveSize; // size of wave data (for restore) + int iAlloc; // number of buffers. + int iCurrent; // current buffer + IDirectSoundBuffer* Buffers[1]; // list of buffers + +} SNDOBJ, *HSNDOBJ; + +#define _HSNDOBJ_DEFINED +#include "dsutil.h" + +static const char c_szWAV[] = "WAV"; + +/////////////////////////////////////////////////////////////////////////////// +// +// DSLoadSoundBuffer +// +/////////////////////////////////////////////////////////////////////////////// + +IDirectSoundBuffer *DSLoadSoundBuffer(IDirectSound *pDS, LPCTSTR lpName) +{ + IDirectSoundBuffer *pDSB = NULL; + DSBUFFERDESC dsBD = {0}; + BYTE *pbWaveData; + + if (DSGetWaveResource(NULL, lpName, &dsBD.lpwfxFormat, &pbWaveData, &dsBD.dwBufferBytes)) + { + dsBD.dwSize = sizeof(dsBD); + dsBD.dwFlags = DSBCAPS_STATIC | DSBCAPS_CTRLDEFAULT | DSBCAPS_GETCURRENTPOSITION2; + + if (SUCCEEDED(IDirectSound_CreateSoundBuffer(pDS, &dsBD, &pDSB, NULL))) + { + if (!DSFillSoundBuffer(pDSB, pbWaveData, dsBD.dwBufferBytes)) + { + IDirectSoundBuffer_Release(pDSB); + pDSB = NULL; + } + } + else + { + pDSB = NULL; + } + } + + return pDSB; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// DSReloadSoundBuffer +// +/////////////////////////////////////////////////////////////////////////////// + +BOOL DSReloadSoundBuffer(IDirectSoundBuffer *pDSB, LPCTSTR lpName) +{ + BOOL result=FALSE; + BYTE *pbWaveData; + DWORD cbWaveSize; + + if (DSGetWaveResource(NULL, lpName, NULL, &pbWaveData, &cbWaveSize)) + { + if (SUCCEEDED(IDirectSoundBuffer_Restore(pDSB)) && + DSFillSoundBuffer(pDSB, pbWaveData, cbWaveSize)) + { + result = TRUE; + } + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// DSGetWaveResource +// +/////////////////////////////////////////////////////////////////////////////// + +BOOL DSGetWaveResource(HMODULE hModule, LPCTSTR lpName, + WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pcbWaveSize) +{ + HRSRC hResInfo; + HGLOBAL hResData; + void *pvRes; + + if (((hResInfo = FindResource(hModule, lpName, c_szWAV)) != NULL) && + ((hResData = LoadResource(hModule, hResInfo)) != NULL) && + ((pvRes = LockResource(hResData)) != NULL) && + DSParseWaveResource(pvRes, ppWaveHeader, ppbWaveData, pcbWaveSize)) + { + return TRUE; + } + + return FALSE; +} + +/////////////////////////////////////////////////////////////////////////////// +// SndObj fns +/////////////////////////////////////////////////////////////////////////////// + +SNDOBJ *SndObjCreate(IDirectSound *pDS, LPCTSTR lpName, int iConcurrent) +{ + SNDOBJ *pSO = NULL; + LPWAVEFORMATEX pWaveHeader; + BYTE *pbData; + UINT cbData; + + if (DSGetWaveResource(NULL, lpName, &pWaveHeader, &pbData, &cbData)) + { + if (iConcurrent < 1) + iConcurrent = 1; + + if ((pSO = (SNDOBJ *)LocalAlloc(LPTR, sizeof(SNDOBJ) + + (iConcurrent-1) * sizeof(IDirectSoundBuffer *))) != NULL) + { + int i; + + pSO->iAlloc = iConcurrent; + pSO->pbWaveData = pbData; + pSO->cbWaveSize = cbData; + pSO->Buffers[0] = DSLoadSoundBuffer(pDS, lpName); + + for (i=1; i<pSO->iAlloc; i++) + { + if (FAILED(IDirectSound_DuplicateSoundBuffer(pDS, + pSO->Buffers[0], &pSO->Buffers[i]))) + { + pSO->Buffers[i] = DSLoadSoundBuffer(pDS, lpName); + if (!pSO->Buffers[i]) { + SndObjDestroy(pSO); + pSO = NULL; + break; + } + } + } + } + } + + return pSO; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +void SndObjDestroy(SNDOBJ *pSO) +{ + if (pSO) + { + int i; + + for (i=0; i<pSO->iAlloc; i++) + { + if (pSO->Buffers[i]) + { + IDirectSoundBuffer_Release(pSO->Buffers[i]); + pSO->Buffers[i] = NULL; + } + } + LocalFree((HANDLE)pSO); + } +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +IDirectSoundBuffer *SndObjGetFreeBuffer(SNDOBJ *pSO) +{ + IDirectSoundBuffer *pDSB; + + if (pSO == NULL) + return NULL; + + if (pDSB = pSO->Buffers[pSO->iCurrent]) + { + HRESULT hres; + DWORD dwStatus; + + hres = IDirectSoundBuffer_GetStatus(pDSB, &dwStatus); + + if (FAILED(hres)) + dwStatus = 0; + + if ((dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING) + { + if (pSO->iAlloc > 1) + { + if (++pSO->iCurrent >= pSO->iAlloc) + pSO->iCurrent = 0; + + pDSB = pSO->Buffers[pSO->iCurrent]; + hres = IDirectSoundBuffer_GetStatus(pDSB, &dwStatus); + + if (SUCCEEDED(hres) && (dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING) + { + IDirectSoundBuffer_Stop(pDSB); + IDirectSoundBuffer_SetCurrentPosition(pDSB, 0); + } + } + else + { + pDSB = NULL; + } + } + + if (pDSB && (dwStatus & DSBSTATUS_BUFFERLOST)) + { + if (FAILED(IDirectSoundBuffer_Restore(pDSB)) || + !DSFillSoundBuffer(pDSB, pSO->pbWaveData, pSO->cbWaveSize)) + { + pDSB = NULL; + } + } + } + + return pDSB; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +BOOL SndObjPlay(SNDOBJ *pSO, DWORD dwPlayFlags) +{ + BOOL result = FALSE; + + if (pSO == NULL) + return FALSE; + + if ((!(dwPlayFlags & DSBPLAY_LOOPING) || (pSO->iAlloc == 1))) + { + IDirectSoundBuffer *pDSB = SndObjGetFreeBuffer(pSO); + if (pDSB != NULL) { + result = SUCCEEDED(IDirectSoundBuffer_Play(pDSB, 0, 0, dwPlayFlags)); + } + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +BOOL SndObjStop(SNDOBJ *pSO) +{ + int i; + + if (pSO == NULL) + return FALSE; + + for (i=0; i<pSO->iAlloc; i++) + { + IDirectSoundBuffer_Stop(pSO->Buffers[i]); + IDirectSoundBuffer_SetCurrentPosition(pSO->Buffers[i], 0); + } + + return TRUE; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +BOOL DSFillSoundBuffer(IDirectSoundBuffer *pDSB, BYTE *pbWaveData, DWORD cbWaveSize) +{ + if (pDSB && pbWaveData && cbWaveSize) + { + LPVOID pMem1, pMem2; + DWORD dwSize1, dwSize2; + + if (SUCCEEDED(IDirectSoundBuffer_Lock(pDSB, 0, cbWaveSize, + &pMem1, &dwSize1, &pMem2, &dwSize2, 0))) + { + CopyMemory(pMem1, pbWaveData, dwSize1); + + if ( 0 != dwSize2 ) + CopyMemory(pMem2, pbWaveData+dwSize1, dwSize2); + + IDirectSoundBuffer_Unlock(pDSB, pMem1, dwSize1, pMem2, dwSize2); + return TRUE; + } + } + + return FALSE; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +BOOL DSParseWaveResource(void *pvRes, WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData,DWORD *pcbWaveSize) +{ + DWORD *pdw; + DWORD *pdwEnd; + DWORD dwRiff; + DWORD dwType; + DWORD dwLength; + + if (ppWaveHeader) + *ppWaveHeader = NULL; + + if (ppbWaveData) + *ppbWaveData = NULL; + + if (pcbWaveSize) + *pcbWaveSize = 0; + + pdw = (DWORD *)pvRes; + dwRiff = *pdw++; + dwLength = *pdw++; + dwType = *pdw++; + + if (dwRiff != mmioFOURCC('R', 'I', 'F', 'F')) + goto exit; // not even RIFF + + if (dwType != mmioFOURCC('W', 'A', 'V', 'E')) + goto exit; // not a WAV + + pdwEnd = (DWORD *)((BYTE *)pdw + dwLength-4); + + while (pdw < pdwEnd) + { + dwType = *pdw++; + dwLength = *pdw++; + + switch (dwType) + { + case mmioFOURCC('f', 'm', 't', ' '): + if (ppWaveHeader && !*ppWaveHeader) + { + if (dwLength < sizeof(WAVEFORMAT)) + goto exit; // not a WAV + + *ppWaveHeader = (WAVEFORMATEX *)pdw; + + if ((!ppbWaveData || *ppbWaveData) && + (!pcbWaveSize || *pcbWaveSize)) + { + return TRUE; + } + } + break; + + case mmioFOURCC('d', 'a', 't', 'a'): + if ((ppbWaveData && !*ppbWaveData) || + (pcbWaveSize && !*pcbWaveSize)) + { + if (ppbWaveData) + *ppbWaveData = (LPBYTE)pdw; + + if (pcbWaveSize) + *pcbWaveSize = dwLength; + + if (!ppWaveHeader || *ppWaveHeader) + return TRUE; + } + break; + } + + pdw = (DWORD *)((BYTE *)pdw + ((dwLength+1)&~1)); + } + +exit: + return FALSE; +} diff --git a/sdk/samples/misc/dsutil.h b/sdk/samples/misc/dsutil.h new file mode 100644 index 0000000..fa2d90f --- /dev/null +++ b/sdk/samples/misc/dsutil.h @@ -0,0 +1,215 @@ +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: dsutil.cpp + * Content: Routines for dealing with sounds from resources + * + * + ***************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// DSLoadSoundBuffer Loads an IDirectSoundBuffer from a Win32 resource in +// the current application. +// +// Params: +// pDS -- Pointer to an IDirectSound that will be used to create +// the buffer. +// +// lpName -- Name of WAV resource to load the data from. Can be a +// resource id specified using the MAKEINTRESOURCE macro. +// +// Returns an IDirectSoundBuffer containing the wave data or NULL on error. +// +// example: +// in the application's resource script (.RC file) +// Turtle WAV turtle.wav +// +// some code in the application: +// IDirectSoundBuffer *pDSB = DSLoadSoundBuffer(pDS, "Turtle"); +// +// if (pDSB) +// { +// IDirectSoundBuffer_Play(pDSB, 0, 0, DSBPLAY_TOEND); +// /* ... */ +// +/////////////////////////////////////////////////////////////////////////////// +IDirectSoundBuffer *DSLoadSoundBuffer(IDirectSound *pDS, LPCTSTR lpName); + +/////////////////////////////////////////////////////////////////////////////// +// +// DSReloadSoundBuffer Reloads an IDirectSoundBuffer from a Win32 resource in +// the current application. normally used to handle +// a DSERR_BUFFERLOST error. +// Params: +// pDSB -- Pointer to an IDirectSoundBuffer to be reloaded. +// +// lpName -- Name of WAV resource to load the data from. Can be a +// resource id specified using the MAKEINTRESOURCE macro. +// +// Returns a BOOL indicating whether the buffer was successfully reloaded. +// +// example: +// in the application's resource script (.RC file) +// Turtle WAV turtle.wav +// +// some code in the application: +// TryAgain: +// HRESULT hres = IDirectSoundBuffer_Play(pDSB, 0, 0, DSBPLAY_TOEND); +// +// if (FAILED(hres)) +// { +// if ((hres == DSERR_BUFFERLOST) && +// DSReloadSoundBuffer(pDSB, "Turtle")) +// { +// goto TryAgain; +// } +// /* deal with other errors... */ +// } +// +/////////////////////////////////////////////////////////////////////////////// +BOOL DSReloadSoundBuffer(IDirectSoundBuffer *pDSB, LPCTSTR lpName); + +/////////////////////////////////////////////////////////////////////////////// +// +// DSGetWaveResource Finds a WAV resource in a Win32 module. +// +// Params: +// hModule -- Win32 module handle of module containing WAV resource. +// Pass NULL to indicate current application. +// +// lpName -- Name of WAV resource to load the data from. Can be a +// resource id specified using the MAKEINTRESOURCE macro. +// +// ppWaveHeader-- Optional pointer to WAVEFORMATEX * to receive a pointer to +// the WAVEFORMATEX header in the specified WAV resource. +// Pass NULL if not required. +// +// ppbWaveData -- Optional pointer to BYTE * to receive a pointer to the +// waveform data in the specified WAV resource. Pass NULL if +// not required. +// +// pdwWaveSize -- Optional pointer to DWORD to receive the size of the +// waveform data in the specified WAV resource. Pass NULL if +// not required. +// +// Returns a BOOL indicating whether a valid WAV resource was found. +// +/////////////////////////////////////////////////////////////////////////////// +BOOL DSGetWaveResource(HMODULE hModule, LPCTSTR lpName, + WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pdwWaveSize); + +/////////////////////////////////////////////////////////////////////////////// +// +// HSNDOBJ Handle to a SNDOBJ object. +// +// SNDOBJs are implemented in dsutil as an example layer built on top +// of DirectSound. +// +// A SNDOBJ is generally used to manage individual +// sounds which need to be played multiple times concurrently. A +// SNDOBJ represents a queue of IDirectSoundBuffer objects which +// all refer to the same buffer memory. +// +// A SNDOBJ also automatically reloads the sound resource when +// DirectSound returns a DSERR_BUFFERLOST +// +/////////////////////////////////////////////////////////////////////////////// +#ifndef _HSNDOBJ_DEFINED +DECLARE_HANDLE32(HSNDOBJ); +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// SndObjCreate Loads a SNDOBJ from a Win32 resource in +// the current application. +// +// Params: +// pDS -- Pointer to an IDirectSound that will be used to create +// the SNDOBJ. +// +// lpName -- Name of WAV resource to load the data from. Can be a +// resource id specified using the MAKEINTRESOURCE macro. +// +// iConcurrent -- Integer representing the number of concurrent playbacks of +// to plan for. Attempts to play more than this number will +// succeed but will restart the least recently played buffer +// even if it is not finished playing yet. +// +// Returns an HSNDOBJ or NULL on error. +// +// NOTES: +// SNDOBJs automatically restore and reload themselves as required. +// +/////////////////////////////////////////////////////////////////////////////// +HSNDOBJ SndObjCreate(IDirectSound *pDS, LPCTSTR lpName, int iConcurrent); + +/////////////////////////////////////////////////////////////////////////////// +// +// SndObjDestroy Frees a SNDOBJ and releases all of its buffers. +// +// Params: +// hSO -- Handle to a SNDOBJ to free. +// +/////////////////////////////////////////////////////////////////////////////// +void SndObjDestroy(HSNDOBJ hSO); + +/////////////////////////////////////////////////////////////////////////////// +// +// SndObjPlay Plays a buffer in a SNDOBJ. +// +// Params: +// hSO -- Handle to a SNDOBJ to play a buffer from. +// +// dwPlayFlags -- Flags to pass to IDirectSoundBuffer::Play. It is not +// legal to play an SndObj which has more than one buffer +// with the DSBPLAY_LOOPING flag. Pass 0 to stop playback. +// +/////////////////////////////////////////////////////////////////////////////// +BOOL SndObjPlay(HSNDOBJ hSO, DWORD dwPlayFlags); + +/////////////////////////////////////////////////////////////////////////////// +// +// SndObjStop Stops one or more buffers in a SNDOBJ. +// +// Params: +// hSO -- Handle to a SNDOBJ to play a buffer from. +// +/////////////////////////////////////////////////////////////////////////////// +BOOL SndObjStop(HSNDOBJ hSO); + +/////////////////////////////////////////////////////////////////////////////// +// +// SndObjGetFreeBuffer returns one of the cloned buffers that is +// not currently playing +// +// Params: +// hSO -- Handle to a SNDOBJ +// +// NOTES: +// This function is provided so that callers can set things like pan etc +// before playing the buffer. +// +// EXAMPLE: +// ... +// +/////////////////////////////////////////////////////////////////////////////// +IDirectSoundBuffer *SndObjGetFreeBuffer(HSNDOBJ hSO); + +/////////////////////////////////////////////////////////////////////////////// +// +// helper routines +// +/////////////////////////////////////////////////////////////////////////////// + +BOOL DSFillSoundBuffer(IDirectSoundBuffer *pDSB, BYTE *pbWaveData, DWORD dwWaveSize); +BOOL DSParseWaveResource(void *pvRes, WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pdwWaveSize); + +#ifdef __cplusplus +} +#endif diff --git a/sdk/samples/misc/lbprintf.c b/sdk/samples/misc/lbprintf.c new file mode 100644 index 0000000..efad4f8 --- /dev/null +++ b/sdk/samples/misc/lbprintf.c @@ -0,0 +1,226 @@ +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: lbprintf.c + * Content: Routines to display text in a listbox + * + ***************************************************************************/ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <ddraw.h> +#include "lbprintf.h" + +static HWND hWndListBox; +static DWORD dwPos; + +/* + * LBCreate + * + * Create a list box on a given parent window + */ +void LBCreate( HWND hWnd, DWORD pos ) +{ + hWndListBox = CreateWindow( + "listbox", // class + NULL, // caption + WS_BORDER | WS_CHILDWINDOW | WS_VSCROLL | LBS_NOINTEGRALHEIGHT, // style + 0, // x pos + 0, // y pos + 0, // width + 0, // height + hWnd, // parent window + NULL, // menu + GetWindowInstance( hWnd ), // instance + NULL // parms + ); + + ShowWindow( hWndListBox, SW_NORMAL ); + UpdateWindow( hWndListBox ); + + dwPos = pos; + if( dwPos > 100 ) + { + dwPos = 100; + } + +} /* LBCreate */ + +/* + * LBSize + * + * New size for the listbox. Should be called whenever the parent window + * is resized + */ +void LBSize( DWORD width, DWORD height ) +{ + DWORD y; + + y = (height*(100-dwPos))/100; + MoveWindow( hWndListBox, 0, y, width-1, height-y-1, TRUE ); + +} /* LBSize */ + +/* + * LBClear + * + * Clear the listbox + */ +void LBClear( void ) +{ + SendMessage( hWndListBox, LB_RESETCONTENT, 0, 0L ); + +} /* LBClear */ + +/* + * LBPrintf + */ +void __cdecl LBPrintf( LPSTR fmt, ... ) +{ + char buff[512]; + UINT sel; + + wvsprintf( buff, fmt, (LPVOID)(&fmt+1) ); + SendMessage( hWndListBox, LB_ADDSTRING, 0, (LONG) (LPSTR) buff ); + sel = (UINT) SendMessage( hWndListBox, LB_GETCOUNT, 0, 0L ); + if( sel != LB_ERR ) + { + SendMessage( hWndListBox, LB_SETCURSEL, sel-1, 0L ); + } + +} /* LBPrintf */ + +typedef struct +{ + HRESULT rval; + LPSTR str; +} ERRLIST; + +static ERRLIST elErrors[] = +{ + { DD_OK, "DD_OK" }, + { DDERR_ALREADYINITIALIZED, "DDERR_ALREADYINITIALIZED" }, + { DDERR_CANNOTATTACHSURFACE, "DDERR_CANNOTATTACHSURFACE" }, + { DDERR_CANNOTDETACHSURFACE, "DDERR_CANNOTDETACHSURFACE" }, + { DDERR_CURRENTLYNOTAVAIL, "DDERR_CURRENTLYNOTAVAIL" }, + { DDERR_EXCEPTION, "DDERR_EXCEPTION" }, + { DDERR_GENERIC, "DDERR_GENERIC" }, + { DDERR_HEIGHTALIGN, "DDERR_HEIGHTALIGN" }, + { DDERR_INCOMPATIBLEPRIMARY, "DDERR_INCOMPATIBLEPRIMARY" }, + { DDERR_INVALIDCAPS, "DDERR_INVALIDCAPS" }, + { DDERR_INVALIDCLIPLIST, "DDERR_INVALIDCLIPLIST" }, + { DDERR_INVALIDMODE, "DDERR_INVALIDMODE" }, + { DDERR_INVALIDOBJECT, "DDERR_INVALIDOBJECT" }, + { DDERR_INVALIDPARAMS, "DDERR_INVALIDPARAMS" }, + { DDERR_INVALIDPIXELFORMAT, "DDERR_INVALIDPIXELFORMAT" }, + { DDERR_INVALIDRECT, "DDERR_INVALIDRECT" }, + { DDERR_LOCKEDSURFACES, "DDERR_LOCKEDSURFACES" }, + { DDERR_NO3D, "DDERR_NO3D" }, + { DDERR_NOALPHAHW, "DDERR_NOALPHAHW" }, + { DDERR_NOCLIPLIST, "DDERR_NOCLIPLIST" }, + { DDERR_NOCOLORCONVHW, "DDERR_NOCOLORCONVHW" }, + { DDERR_NOCOOPERATIVELEVELSET, "DDERR_NOCOOPERATIVELEVELSET" }, + { DDERR_NOCOLORKEY, "DDERR_NOCOLORKEY" }, + { DDERR_NOCOLORKEYHW, "DDERR_NOCOLORKEYHW" }, + { DDERR_NOEXCLUSIVEMODE, "DDERR_NOEXCLUSIVEMODE" }, + { DDERR_NOFLIPHW, "DDERR_NOFLIPHW" }, + { DDERR_NOGDI, "DDERR_NOGDI" }, + { DDERR_NOMIRRORHW, "DDERR_NOMIRRORHW" }, + { DDERR_NOTFOUND, "DDERR_NOTFOUND" }, + { DDERR_NOOVERLAYHW, "DDERR_NOOVERLAYHW" }, + { DDERR_NORASTEROPHW, "DDERR_NORASTEROPHW" }, + { DDERR_NOROTATIONHW, "DDERR_NOROTATIONHW" }, + { DDERR_NOSTRETCHHW, "DDERR_NOSTRETCHHW" }, + { DDERR_NOT4BITCOLOR, "DDERR_NOT4BITCOLOR" }, + { DDERR_NOT4BITCOLORINDEX, "DDERR_NOT4BITCOLORINDEX" }, + { DDERR_NOT8BITCOLOR, "DDERR_NOT8BITCOLOR" }, + { DDERR_NOTEXTUREHW, "DDERR_NOTEXTUREHW" }, + { DDERR_NOVSYNCHW, "DDERR_NOVSYNCHW" }, + { DDERR_NOZBUFFERHW, "DDERR_NOZBUFFERHW" }, + { DDERR_NOZOVERLAYHW, "DDERR_NOZOVERLAYHW" }, + { DDERR_OUTOFCAPS, "DDERR_OUTOFCAPS" }, + { DDERR_OUTOFMEMORY, "DDERR_OUTOFMEMORY" }, + { DDERR_OUTOFVIDEOMEMORY, "DDERR_OUTOFVIDEOMEMORY" }, + { DDERR_OVERLAYCANTCLIP, "DDERR_OVERLAYCANTCLIP" }, + { DDERR_OVERLAYCOLORKEYONLYONEACTIVE, "DDERR_OVERLAYCOLORKEYONLYONEACTIVE" }, + { DDERR_PALETTEBUSY, "DDERR_PALETTEBUSY" }, + { DDERR_COLORKEYNOTSET, "DDERR_COLORKEYNOTSET" }, + { DDERR_SURFACEALREADYATTACHED, "DDERR_SURFACEALREADYATTACHED" }, + { DDERR_SURFACEALREADYDEPENDENT, "DDERR_SURFACEALREADYDEPENDENT" }, + { DDERR_SURFACEBUSY, "DDERR_SURFACEBUSY" }, + { DDERR_SURFACEISOBSCURED, "DDERR_SURFACEISOBSCURED" }, + { DDERR_SURFACELOST, "DDERR_SURFACELOST" }, + { DDERR_SURFACENOTATTACHED, "DDERR_SURFACENOTATTACHED" }, + { DDERR_TOOBIGHEIGHT, "DDERR_TOOBIGHEIGHT" }, + { DDERR_TOOBIGSIZE, "DDERR_TOOBIGSIZE" }, + { DDERR_TOOBIGWIDTH, "DDERR_TOOBIGWIDTH" }, + { DDERR_UNSUPPORTED, "DDERR_UNSUPPORTED" }, + { DDERR_UNSUPPORTEDFORMAT, "DDERR_UNSUPPORTEDFORMAT" }, + { DDERR_UNSUPPORTEDMASK, "DDERR_UNSUPPORTEDMASK" }, + { DDERR_VERTICALBLANKINPROGRESS, "DDERR_VERTICALBLANKINPROGRESS" }, + { DDERR_WASSTILLDRAWING, "DDERR_WASSTILLDRAWING" }, + { DDERR_XALIGN, "DDERR_XALIGN" }, + { DDERR_INVALIDDIRECTDRAWGUID, "DDERR_INVALIDDIRECTDRAWGUID" }, + { DDERR_DIRECTDRAWALREADYCREATED, "DDERR_DIRECTDRAWALREADYCREATED" }, + { DDERR_NODIRECTDRAWHW, "DDERR_NODIRECTDRAWHW" }, + { DDERR_PRIMARYSURFACEALREADYEXISTS, "DDERR_PRIMARYSURFACEALREADYEXISTS" }, + { DDERR_NOEMULATION, "DDERR_NOEMULATION" }, + { DDERR_REGIONTOOSMALL, "DDERR_REGIONTOOSMALL" }, + { DDERR_CLIPPERISUSINGHWND, "DDERR_CLIPPERISUSINGHWND" }, + { DDERR_NOCLIPPERATTACHED, "DDERR_NOCLIPPERATTACHED" }, + { DDERR_NOHWND, "DDERR_NOHWND" }, + { DDERR_HWNDSUBCLASSED, "DDERR_HWNDSUBCLASSED" }, + { DDERR_HWNDALREADYSET, "DDERR_HWNDALREADYSET" }, + { DDERR_NOPALETTEATTACHED, "DDERR_NOPALETTEATTACHED" }, + { DDERR_NOPALETTEHW, "DDERR_NOPALETTEHW" }, + { DDERR_BLTFASTCANTCLIP, "DDERR_BLTFASTCANTCLIP" }, + { DDERR_NOBLTHW, "DDERR_NOBLTHW" }, + { DDERR_NODDROPSHW, "DDERR_NODDROPSHW" }, + { DDERR_OVERLAYNOTVISIBLE, "DDERR_OVERLAYNOTVISIBLE" }, + { DDERR_NOOVERLAYDEST, "DDERR_NOOVERLAYDEST" }, + { DDERR_INVALIDPOSITION, "DDERR_INVALIDPOSITION" }, + { DDERR_NOTAOVERLAYSURFACE, "DDERR_NOTAOVERLAYSURFACE" }, + { DDERR_EXCLUSIVEMODEALREADYSET, "DDERR_EXCLUSIVEMODEALREADYSET" }, + { DDERR_NOTFLIPPABLE, "DDERR_NOTFLIPPABLE" }, + { DDERR_CANTDUPLICATE, "DDERR_CANTDUPLICATE" }, + { DDERR_NOTLOCKED, "DDERR_NOTLOCKED" }, + { DDERR_CANTCREATEDC, "DDERR_CANTCREATEDC" }, + { DDERR_NODC, "DDERR_NODC" }, + { DDERR_WRONGMODE, "DDERR_WRONGMODE" }, + { DDERR_IMPLICITLYCREATED, "DDERR_IMPLICITLYCREATED" }, +}; + +/* + * getErrorString + */ +static LPSTR getErrorString( HRESULT ddrval ) +{ + int i; + + for( i=0;i<sizeof( elErrors )/sizeof( elErrors[0] );i++ ) + { + if( ddrval == elErrors[i].rval ) + { + return elErrors[i].str; + } + } + return "Unknown Error Code"; + + +} /* getErrorString */ + +/* + * LBPrintfDDRC + * + * Display a DirectDraw error code in human readable form + */ +void __cdecl LBPrintfDDRC( HRESULT ddrval, LPSTR fmt, ... ) +{ + char buff[512]; + + wvsprintf( buff, fmt, (LPVOID)(&fmt+1) ); + LBPrintf( "%s, rc=%ld (0x%08lx:%s)", buff, LOWORD( ddrval ), + ddrval, getErrorString( ddrval ) ); + +} /* LBPrintfDDRC */ diff --git a/sdk/samples/misc/lbprintf.h b/sdk/samples/misc/lbprintf.h new file mode 100644 index 0000000..fae972b --- /dev/null +++ b/sdk/samples/misc/lbprintf.h @@ -0,0 +1,25 @@ +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: lbprintf.h + * Content: list box printf header file + * + ***************************************************************************/ +#ifndef __LBPRINTF_INCLUDED__ + +#define __LBPRINTF_INCLUDED__ +#ifdef __cplusplus +extern "C" { +#endif +extern void LBCreate( HWND hWnd, DWORD pos ); +extern void LBSize( DWORD dwWidth, DWORD dwHeight ); +extern void LBClear( void ); +extern void __cdecl LBPrintf( LPSTR fmt, ... ); +extern void __cdecl LBPrintfDDRC( HRESULT rc, LPSTR fmt, ... ); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/samples/misc/lclib.c b/sdk/samples/misc/lclib.c new file mode 100644 index 0000000..32c3f51 --- /dev/null +++ b/sdk/samples/misc/lclib.c @@ -0,0 +1,61 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: lclib.h + * + */ + +#include <windows.h> +#include "lclib.h" + + +char* LSTRCHR( const char* lpString, int bChar ) +{ + if( lpString != NULL ) + { + while( *lpString != 0 ) + { + if( *lpString == bChar ) + { + return (char*)lpString; + } + + lpString++; + } + } + return NULL; + +} /* LSTRCHR */ + +char* LSTRRCHR( const char* lpString, int bChar ) +{ + if( lpString != NULL ) + { + const char* lpBegin; + + lpBegin = lpString; + + while( *lpString != 0 ) + { + lpString++; + } + + while( 1 ) + { + if( *lpString == bChar ) + { + return (char*)lpString; + } + + if( lpString == lpBegin ) + { + break; + } + + lpString--; + } + } + + return NULL; +} /* LSTRRCHR */ + diff --git a/sdk/samples/misc/lclib.h b/sdk/samples/misc/lclib.h new file mode 100644 index 0000000..263fda0 --- /dev/null +++ b/sdk/samples/misc/lclib.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: lclib.h + * + */ + +#ifndef __LCLIB_H__ +#define __LCLIB_H__ + +char* LSTRRCHR( const char*, int ); +char* LSTRCHR( const char*, int ); + +#endif + diff --git a/sdk/samples/misc/misc.c b/sdk/samples/misc/misc.c new file mode 100644 index 0000000..e1874b0 --- /dev/null +++ b/sdk/samples/misc/misc.c @@ -0,0 +1,586 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: misc.c + * + * Miscellaneous functions not involving DD and D3D. Part of D3DApp. + * + * D3DApp is a collection of helper functions for Direct3D applications. + * D3DApp consists of the following files: + * d3dapp.h Main D3DApp header to be included by application + * d3dappi.h Internal header + * d3dapp.c D3DApp functions seen by application. + * ddcalls.c All calls to DirectDraw objects except textures + * d3dcalls.c All calls to Direct3D objects except textures + * texture.c Texture loading and managing texture list + * misc.c Miscellaneous calls + */ + +#include "d3dappi.h" + +/***************************************************************************/ +/* Setting Defaults */ +/***************************************************************************/ +/* + * D3DAppISetDefaults + * Set all the global variables to their default values. Do not reset the + * image files. + */ +void +D3DAppISetDefaults(void) +{ + int n; + char backup[D3DAPP_MAXTEXTURES][50]; + + n = d3dappi.NumTextures; + memcpy(&backup[0][0], &d3dappi.ImageFile[0][0], 50 * D3DAPP_MAXTEXTURES); + ZEROMEM(d3dappi); + memcpy(&d3dappi.ImageFile[0][0], &backup[0][0], 50 * D3DAPP_MAXTEXTURES); + d3dappi.NumTextures = n; + d3dappi.bAppActive = TRUE; + ZEROMEM(d3dapprs); + d3dapprs.bZBufferOn = TRUE; + d3dapprs.bPerspCorrect = FALSE; + d3dapprs.ShadeMode = D3DSHADE_GOURAUD; + d3dapprs.TextureFilter = D3DFILTER_NEAREST; + d3dapprs.TextureBlend = D3DTBLEND_MODULATE; + d3dapprs.FillMode = D3DFILL_SOLID; + d3dapprs.bDithering = FALSE; + d3dapprs.bSpecular = TRUE; + d3dapprs.bAntialiasing = FALSE; + d3dapprs.bFogEnabled = FALSE; + d3dapprs.FogColor = RGB_MAKE(0, 0, 0); + d3dapprs.FogMode = D3DFOG_LINEAR; + d3dapprs.FogStart = D3DVAL(6.0); + d3dapprs.FogEnd = D3DVAL(11.0); + + lpClipper = NULL; + lpPalette = NULL; + bPrimaryPalettized = FALSE; + bPaletteActivate = FALSE; + bIgnoreWM_SIZE = FALSE; + ZEROMEM(ppe); + ZEROMEM(Originalppe); + LastError = DD_OK; + ZEROMEM(LastErrorString); + D3DDeviceDestroyCallback = NULL; + D3DDeviceDestroyCallbackContext = NULL; + D3DDeviceCreateCallback = NULL; + D3DDeviceCreateCallbackContext = NULL; +} + +/***************************************************************************/ +/* Calling Device Create And Destroy Callbacks */ +/***************************************************************************/ +BOOL +D3DAppICallDeviceDestroyCallback(void) +{ + if (D3DDeviceDestroyCallback) { + if (CallbackRefCount) { + --CallbackRefCount; + return (D3DDeviceDestroyCallback)(D3DDeviceDestroyCallbackContext); + } + } + return TRUE; +} + +BOOL +D3DAppICallDeviceCreateCallback(int w, int h) +{ + if (D3DDeviceCreateCallback) { + ++CallbackRefCount; + return (D3DDeviceCreateCallback)(w, h, &d3dappi.lpD3DViewport, + D3DDeviceCreateCallbackContext); + } + return TRUE; +} + +/***************************************************************************/ +/* Choosing and verifying the driver and display mode */ +/***************************************************************************/ +/* + * D3DAppIPickDriver + * Choose a driver from the list of available drivers which can render to one + * of the given depths. Hardware is prefered. Mono-lighting drivers are + * prefered over RGB. + */ +BOOL +D3DAppIPickDriver(int* driver, DWORD depths) +{ + int i, j; + j = 0; + for (i = 0; i < d3dappi.NumDrivers; i++) + if (d3dappi.Driver[i].Desc.dwDeviceRenderBitDepth & depths) + break; + if (i >= d3dappi.NumDrivers) { + *driver = D3DAPP_BOGUS; + return TRUE; + } + j = i; + for (i = 0; i < d3dappi.NumDrivers; i++) { + if (d3dappi.Driver[i].Desc.dwDeviceRenderBitDepth & depths) { + if (d3dappi.Driver[i].bIsHardware && + !d3dappi.Driver[j].bIsHardware) + j = i; + else if (d3dappi.Driver[i].bIsHardware == + d3dappi.Driver[j].bIsHardware) { + if (d3dappi.Driver[i].Desc.dcmColorModel & D3DCOLOR_MONO && + !(d3dappi.Driver[j].Desc.dcmColorModel & D3DCOLOR_MONO)) + j = i; + } + } + } + if (j >= d3dappi.NumDrivers) + *driver = D3DAPP_BOGUS; + else + *driver = j; + return TRUE; +} + +/* + * D3DAppIFilterDisplayModes + * Set the bThisDriverCanDo flag for each display mode if the given driver + * can render in that depth. Also checks to make sure there is enough + * total video memory for front/back/z-buffer in video memory if it's a + * hardware device. + */ +BOOL +D3DAppIFilterDisplayModes(int driver) +{ + int i; + DWORD depths = d3dappi.Driver[driver].Desc.dwDeviceRenderBitDepth; + + for (i = 0; i < d3dappi.NumModes; i++) { + d3dappi.Mode[i].bThisDriverCanDo = FALSE; + if (!(D3DAppIBPPToDDBD(d3dappi.Mode[i].bpp) & depths)) + continue; + d3dappi.Mode[i].bThisDriverCanDo = TRUE; + + } + d3dappi.ThisMode.bThisDriverCanDo = + d3dappi.Mode[d3dappi.CurrMode].bThisDriverCanDo; + return TRUE; +} + +/* + * D3DAppIPickDisplayMode + * Pick a display mode of one of the given depths. 640x480x16 is prefered. + */ +BOOL +D3DAppIPickDisplayMode(int *mode, DWORD depths) +{ + int i, j; + for (i = 0; i < d3dappi.NumModes; i++) + if (D3DAppIBPPToDDBD(d3dappi.Mode[i].bpp) & depths) + break; + j = i; + for (; i < d3dappi.NumModes; i++) { + if (!(D3DAppIBPPToDDBD(d3dappi.Mode[i].bpp) & depths)) + continue; + if (d3dappi.Mode[i].w == 640 && d3dappi.Mode[i].h == 480 && + d3dappi.Mode[i].bpp == 16) { + j = i; + break; + } + } + if (j >= d3dappi.NumModes) + *mode = D3DAPP_BOGUS; + else + *mode = j; + return TRUE; +} + +/* + * D3DAppIVerifyDriverAndMode + * Verifies the selected driver and mode combination. If the driver is + * specified, the mode will be changed to accomodate the driver if it's not + * compatible. If the driver is not specified, one will be selected which is + * compatible with the specified mode. If neither are specified, a suitable + * pair will be returned. + */ +BOOL +D3DAppIVerifyDriverAndMode(int* lpdriver, int* lpmode) +{ + DWORD depths; + int driver, mode, i; + driver = *lpdriver; mode = *lpmode; + + if (mode == D3DAPP_USEWINDOW && !d3dappi.bIsPrimary) { + D3DAppISetErrorString("Cannot render to a window when the DirectDraw device is not the primary.\n"); + goto exit_with_error; + } + + /* + * If I've been ask to choose a driver, choose one which is compatible + * with the specified mode. + */ + if (driver == D3DAPP_YOUDECIDE) { + if (mode == D3DAPP_USEWINDOW) { + /* + * I must find a driver for this display depth + */ + depths = D3DAppIBPPToDDBD(d3dappi.WindowsDisplay.bpp); + ATTEMPT(D3DAppIPickDriver(&driver, depths)); + if (driver == D3DAPP_BOGUS) { + D3DAppISetErrorString("Cannot find a D3D device driver which is compatible with the current display depth.\n"); + goto exit_with_error; + } + /* + * I don't need to go through the mode selection since I've + * verified it here + */ + goto ret_ok; + } else if (mode == D3DAPP_YOUDECIDE) { + /* + * I'm free to choose any driver which can use even one + * supported depth + */ + if (d3dappi.bIsPrimary) + depths = D3DAppIBPPToDDBD(d3dappi.WindowsDisplay.bpp); + else + depths = 0; + for (i = 0; i < d3dappi.NumModes; i++) + depths |= D3DAppIBPPToDDBD(d3dappi.Mode[i].bpp); + ATTEMPT(D3DAppIPickDriver(&driver, depths)); + if (driver == D3DAPP_BOGUS) { + D3DAppISetErrorString("Cannot find a D3D device driver which is compatible with the current display depth or any supported fullscreen mode.\n"); + goto exit_with_error; + } + /* + * The mode will be chosen in the next section + */ + } else { + /* + * Must pick a driver which uses the given mode depth + */ + ATTEMPT(D3DAppIPickDriver(&driver, + D3DAppIBPPToDDBD(d3dappi.Mode[mode].bpp))); + if (driver == D3DAPP_BOGUS) { + D3DAppISetErrorString("Cannot find a D3D device driver which is compatible with the specified fullscreen mode.\n"); + goto exit_with_error; + } + /* + * I don't need to go through the mode selection since I've + * verified it here + */ + goto ret_ok; + } + } + + /* + * At this stage, I have a driver I want to match the mode to. + */ + if (mode == D3DAPP_YOUDECIDE) { + /* + * If it's my choice, I prefer windowed over fullscreen + */ + if (d3dappi.bIsPrimary) { + if (D3DAppIBPPToDDBD(d3dappi.WindowsDisplay.bpp) & + d3dappi.Driver[driver].Desc.dwDeviceRenderBitDepth) { + mode = D3DAPP_USEWINDOW; + goto ret_ok; + } + } + /* + * Either this is not a primary DD device or the driver cannot use + * the Windows display depth + */ + ATTEMPT(D3DAppIPickDisplayMode(&mode, + d3dappi.Driver[driver].Desc.dwDeviceRenderBitDepth)); + if (mode == D3DAPP_BOGUS) { + D3DAppISetErrorString("The selected D3D device driver is not compatible with the current display depth or any supported fullscreen modes.\n"); + goto exit_with_error; + } + goto ret_ok; + } else if (mode == D3DAPP_USEWINDOW) { + /* + * Check to see if this driver can use the Windows display depth + */ + if (D3DAppIBPPToDDBD(d3dappi.WindowsDisplay.bpp) & + d3dappi.Driver[driver].Desc.dwDeviceRenderBitDepth) { + goto ret_ok; + } else { + /* + * Since it cannot, call this function again to choose any + * display mode which is compatible + */ + mode = D3DAPP_YOUDECIDE; + ATTEMPT(D3DAppIVerifyDriverAndMode(&driver, &mode)); + if (driver == D3DAPP_BOGUS) + goto exit_with_error; + goto ret_ok; + } + } else { + /* + * Check to see if this driver can use the specified fullscreen mode + */ + if (D3DAppIBPPToDDBD(d3dappi.Mode[mode].bpp) & + d3dappi.Driver[driver].Desc.dwDeviceRenderBitDepth) { + goto ret_ok; + } else { + /* + * Since it cannot, call this function again to choose any + * display mode which is compatible + */ + mode = D3DAPP_YOUDECIDE; + ATTEMPT(D3DAppIVerifyDriverAndMode(&driver, &mode)); + if (driver == D3DAPP_BOGUS) + goto exit_with_error; + goto ret_ok; + } + } + +ret_ok: + *lpdriver = driver; *lpmode = mode; + return TRUE; +exit_with_error: + return FALSE; +} + +/***************************************************************************/ +/* Dirty Rectangle Functions */ +/***************************************************************************/ +/* + * D3DAppIValidateDirtyRects + * Set the dirty rectangles for the front and back buffers to the entire + * client size. + */ +void +D3DAppIValidateDirtyRects(void) +{ + NumDirtyClientRects = 1; NumDirtyBackRects = 1; NumDirtyZRects = 1; + SetRect((LPRECT)&DirtyClient[0], 0, 0, d3dappi.szClient.cx, + d3dappi.szClient.cy); + SetRect((LPRECT)&DirtyBack[0], 0, 0, d3dappi.szClient.cx, + d3dappi.szClient.cy); + SetRect((LPRECT)&DirtyZ[0], 0, 0, d3dappi.szClient.cx, + d3dappi.szClient.cy); +} + +/* + * D3DAppICopyRectList + * Copy a list of rectangles to another + */ +void +D3DAppICopyRectList(int* dstnum, LPD3DRECT dst, int srcnum, LPD3DRECT src) +{ + int i; + for (i = 0; i < srcnum; i++) + dst[i] = src[i]; + *dstnum = srcnum; +} + +/* + * MERGE macro + * Set first rectangle to be the smallest rectangle containing both rects + */ +#undef MERGE +#define MERGE(rc1, rc2) \ + do { \ + if (rc2.x1 < rc1.x1) rc1.x1 = rc2.x1; \ + if (rc2.y1 < rc1.y1) rc1.y1 = rc2.y1; \ + if (rc2.x2 > rc1.x2) rc1.x2 = rc2.x2; \ + if (rc2.y2 > rc1.y2) rc1.y2 = rc2.y2; \ + } while(0) + +/* + * D3DAppIMergeRectLists + * Merge two lists of rectangles to create another list of rectangles. The + * merged list of rectangles covers all the area of the original two with NO + * OVERLAPPING amongst it's rectangles. + */ +void +D3DAppIMergeRectLists(int* dstnum, LPD3DRECT dst, int src1num, LPD3DRECT src1, + int src2num, LPD3DRECT src2) +{ + LPD3DRECT rc; + int* isvalid; + int num, i, j, intersect; + rc = (LPD3DRECT)malloc(sizeof(D3DRECT) * D3DAPP_MAXCLEARRECTS * 2); + memset(rc, 0, sizeof(D3DRECT) * D3DAPP_MAXCLEARRECTS * 2); + isvalid = (int*)malloc(sizeof(int) * D3DAPP_MAXCLEARRECTS * 2); + memset(isvalid, 0, sizeof(int) * D3DAPP_MAXCLEARRECTS * 2); + for (i = 0; i < src1num; i++) { + memcpy(&rc[i], &src1[i], sizeof(D3DRECT)); + if ((rc[i].x1 == 0 && rc[i].x2 == 0) || + (rc[i].y1 == 0 && rc[i].y2 == 0)) + isvalid[i] = 0; + else if (rc[i].x1 <= rc[i].x2 && rc[i].y1 <= rc[i].y2) + isvalid[i] = 1; + else + isvalid[i] = 0; + } + for (i = 0; i < src2num; i++) { + memcpy(&rc[i + src1num], &src2[i], sizeof(D3DRECT)); + if (rc[i + src1num].x1 <= rc[i + src1num].x2 && + rc[i + src1num].y1 <= rc[i + src1num].y2) + isvalid[i + src1num] = 1; + else + isvalid[i + src1num] = 0; + + } + num = src1num + src2num; + for (i = 0; i < num - 1; i++) { + if (!isvalid[i]) continue; + j = i + 1; + do { + intersect = 0; + for (; j < num; j++) { + if (j != i && isvalid[j]) { + if (rc[i].x1 < rc[j].x1) { + if (rc[i].x2 < rc[j].x1) + continue; + } else { + if (rc[j].x2 < rc[i].x1) + continue; + } + if (rc[i].y1 < rc[j].y1) { + if (rc[i].y2 < rc[j].y1) + continue; + } else { + if (rc[j].y2 < rc[i].y1) + continue; + } + MERGE(rc[i], rc[j]); + isvalid[j] = 0; + j = 0; intersect = 1; + break; + } + } + } while(intersect); + } + + for (i = 0, j = 0; i < num; i++) + if (isvalid[i]) ++j; + if (j > D3DAPP_MAXCLEARRECTS) { + for (i = 0; i < num; i++) + if (isvalid[i]) break; + if (i < num) { + *dstnum = 1; + dst[0] = rc[i]; + for (; i < num; i++) { + if (isvalid[i]) { + MERGE(dst[0], rc[i]); + } + } + } else { + *dstnum = 0; + } + } else { + for (i = 0, j = 0; i < num; i++) { + if (isvalid[i]) { + memcpy(&dst[j], &rc[i], sizeof(D3DRECT)); + ++j; + } + } + *dstnum = j; + } + free(rc); + free(isvalid); +} + +/***************************************************************************/ +/* Getting and Setting Window Attribs */ +/***************************************************************************/ +/* + * D3DAppISetClientSize + * Set the client size of the given window. A WM_SIZE message is generated, + * but ignored. + */ +void +D3DAppISetClientSize(HWND hwnd, int w, int h, BOOL bReturnFromFullscreen) +{ + RECT rc; + + bIgnoreWM_SIZE = TRUE; + if (bReturnFromFullscreen) { + SetRect(&rc, 0, 0, w, h); + AdjustWindowRectEx(&rc, GetWindowLong(hwnd, GWL_STYLE), + GetMenu(hwnd) != NULL, + GetWindowLong(hwnd, GWL_EXSTYLE)); + SetWindowPos(hwnd, NULL, 0, 0, rc.right-rc.left, + rc.bottom-rc.top, + SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); + + } else { + /* + * This is the only way to set the client size correctly if the menu + * is stacked, so do it unless we are returning from a fullscreen + * mode. + */ + SendMessage(hwnd, WM_SIZE, SIZE_RESTORED, w + h << 16); + GetWindowRect(hwnd, &rc); + SetWindowPos(hwnd, NULL, 0, 0, rc.right-rc.left, + rc.bottom-rc.top, + SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); + } + bIgnoreWM_SIZE = FALSE; + d3dappi.pClientOnPrimary.x = d3dappi.pClientOnPrimary.y = 0; + ClientToScreen(hwnd, &d3dappi.pClientOnPrimary); + d3dappi.szClient.cx = w; d3dappi.szClient.cy = h; +} + +/* + * D3DAppIGetClientWin + * Gets the client window size and sets it in the D3DAppInfo structure + */ +void +D3DAppIGetClientWin(HWND hwnd) +{ + RECT rc; + if (!d3dappi.bFullscreen) { + d3dappi.pClientOnPrimary.x = d3dappi.pClientOnPrimary.y = 0; + ClientToScreen(hwnd, &d3dappi.pClientOnPrimary); + GetClientRect(hwnd, &rc); + d3dappi.szClient.cx = rc.right; + d3dappi.szClient.cy = rc.bottom; + } else { + /* + * In the fullscreen case, we must be careful because if the window + * frame has been drawn, the client size has shrunk and this can + * cause problems, so it's best to report the entire screen. + */ + d3dappi.pClientOnPrimary.x = d3dappi.pClientOnPrimary.y = 0; + d3dappi.szClient.cx = d3dappi.ThisMode.w; + d3dappi.szClient.cy = d3dappi.ThisMode.h; + } +} + + +/***************************************************************************/ +/* Error reporting */ +/***************************************************************************/ + +/* + * D3DAppISetErrorString + * Set the global variable which records the last error string. + */ +void +D3DAppISetErrorString( LPSTR fmt, ... ) +{ + char buff[256]; + + buff[0] = 0; + wvsprintf(&buff[0], fmt, (char *)(&fmt+1)); + lstrcat(buff, "\r\n"); + lstrcpy(LastErrorString, buff); +} + +/* dpf + * Debug printf. Very useful for fullscreen exclusive mode or when surfaces + * are in video memory. + */ +void __cdecl +dpf( LPSTR fmt, ... ) +{ + char buff[256]; + + lstrcpy(buff, "D3DApp: "); + wvsprintf(&buff[lstrlen(buff)], fmt, (char *)(&fmt+1)); + lstrcat(buff, "\r\n"); + OutputDebugString(buff); +} diff --git a/sdk/samples/misc/readme.txt b/sdk/samples/misc/readme.txt new file mode 100644 index 0000000..d52f2bb --- /dev/null +++ b/sdk/samples/misc/readme.txt @@ -0,0 +1,8 @@ +This directory contains a number of miscellaneous files used by the other +sample programs. Many of them code that you may find useful in your +application. + +Rather than browse through these files directly, we suggest that you start +with the sample that is doing something close to what you want to do. Then +when you find references to functions which are not in the files in that +sample directory, you should look for them here. diff --git a/sdk/samples/misc/rmdemo.h b/sdk/samples/misc/rmdemo.h new file mode 100644 index 0000000..6eebd07 --- /dev/null +++ b/sdk/samples/misc/rmdemo.h @@ -0,0 +1,51 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rmdemo.h + * + ***************************************************************************/ +#ifndef __RMDEMO_H__ +#define __RMDEMO_H__ + +#include <d3drmwin.h> +#include <d3drm.h> +#include "rmerror.h" + +#undef RELEASE +#ifdef __cplusplus +#define RELEASE(x) if (x != NULL) {x->Release(); x = NULL;} +#else +#define RELEASE(x) if (x != NULL) {x->lpVtbl->Release(x); x = NULL;} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + /* + * A copy of LPDIRECT3DRM for use by the examples. + */ + extern LPDIRECT3DRM lpD3DRM; + /* + * Builds the scene. + */ + BOOL BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, LPDIRECT3DRMFRAME scene, + LPDIRECT3DRMFRAME camera); + + /* + * Allows each example to begin with different defaults + */ + typedef struct Defaultstag { + BOOL bNoTextures; + BOOL bResizingDisabled; + BOOL bConstRenderQuality; + char Name[50]; + } Defaults; + void OverrideDefaults(Defaults* defaults); + +#ifdef __cplusplus +}; +#endif + +#endif //__RMDEMO_H__ + diff --git a/sdk/samples/misc/rmerror.c b/sdk/samples/misc/rmerror.c new file mode 100644 index 0000000..4a9e3bf --- /dev/null +++ b/sdk/samples/misc/rmerror.c @@ -0,0 +1,297 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rmerror.cpp + * + * Error reporting code for D3DRM examples. + * + */ + +#include "rmerror.h" + +/* Msg + * Displays a message box containing the given formatted string. + */ +void __cdecl +Msg( LPSTR fmt, ... ) +{ + char buff[256]; + + wvsprintf(buff, fmt, (char *)(&fmt+1)); + lstrcat(buff, "\r\n"); + MessageBox( NULL, buff, "D3DRM Example Message", MB_OK ); +} + +/* + * D3DRMErrorToString + * Returns a pointer to a string describing the given DD, D3D or D3DRM error code. + */ +char* +D3DRMErrorToString(HRESULT error) +{ + switch(error) { + case DD_OK: + /* Also includes D3D_OK and D3DRM_OK */ + return "No error.\0"; + case DDERR_ALREADYINITIALIZED: + return "This object is already initialized.\0"; + case DDERR_BLTFASTCANTCLIP: + return "Return if a clipper object is attached to the source surface passed into a BltFast call.\0"; + case DDERR_CANNOTATTACHSURFACE: + return "This surface can not be attached to the requested surface.\0"; + case DDERR_CANNOTDETACHSURFACE: + return "This surface can not be detached from the requested surface.\0"; + case DDERR_CANTCREATEDC: + return "Windows can not create any more DCs.\0"; + case DDERR_CANTDUPLICATE: + return "Can't duplicate primary & 3D surfaces, or surfaces that are implicitly created.\0"; + case DDERR_CLIPPERISUSINGHWND: + return "An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd.\0"; + case DDERR_COLORKEYNOTSET: + return "No src color key specified for this operation.\0"; + case DDERR_CURRENTLYNOTAVAIL: + return "Support is currently not available.\0"; + case DDERR_DIRECTDRAWALREADYCREATED: + return "A DirectDraw object representing this driver has already been created for this process.\0"; + case DDERR_EXCEPTION: + return "An exception was encountered while performing the requested operation.\0"; + case DDERR_EXCLUSIVEMODEALREADYSET: + return "An attempt was made to set the cooperative level when it was already set to exclusive.\0"; + case DDERR_GENERIC: + return "Generic failure.\0"; + case DDERR_HEIGHTALIGN: + return "Height of rectangle provided is not a multiple of reqd alignment.\0"; + case DDERR_HWNDALREADYSET: + return "The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or palettes created.\0"; + case DDERR_HWNDSUBCLASSED: + return "HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring state.\0"; + case DDERR_IMPLICITLYCREATED: + return "This surface can not be restored because it is an implicitly created surface.\0"; + case DDERR_INCOMPATIBLEPRIMARY: + return "Unable to match primary surface creation request with existing primary surface.\0"; + case DDERR_INVALIDCAPS: + return "One or more of the caps bits passed to the callback are incorrect.\0"; + case DDERR_INVALIDCLIPLIST: + return "DirectDraw does not support the provided cliplist.\0"; + case DDERR_INVALIDDIRECTDRAWGUID: + return "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier.\0"; + case DDERR_INVALIDMODE: + return "DirectDraw does not support the requested mode.\0"; + case DDERR_INVALIDOBJECT: + return "DirectDraw received a pointer that was an invalid DIRECTDRAW object.\0"; + case DDERR_INVALIDPARAMS: + return "One or more of the parameters passed to the function are incorrect.\0"; + case DDERR_INVALIDPIXELFORMAT: + return "The pixel format was invalid as specified.\0"; + case DDERR_INVALIDPOSITION: + return "Returned when the position of the overlay on the destination is no longer legal for that destination.\0"; + case DDERR_INVALIDRECT: + return "Rectangle provided was invalid.\0"; + case DDERR_LOCKEDSURFACES: + return "Operation could not be carried out because one or more surfaces are locked.\0"; + case DDERR_NO3D: + return "There is no 3D present.\0"; + case DDERR_NOALPHAHW: + return "Operation could not be carried out because there is no alpha accleration hardware present or available.\0"; + case DDERR_NOBLTHW: + return "No blitter hardware present.\0"; + case DDERR_NOCLIPLIST: + return "No cliplist available.\0"; + case DDERR_NOCLIPPERATTACHED: + return "No clipper object attached to surface object.\0"; + case DDERR_NOCOLORCONVHW: + return "Operation could not be carried out because there is no color conversion hardware present or available.\0"; + case DDERR_NOCOLORKEY: + return "Surface doesn't currently have a color key\0"; + case DDERR_NOCOLORKEYHW: + return "Operation could not be carried out because there is no hardware support of the destination color key.\0"; + case DDERR_NOCOOPERATIVELEVELSET: + return "Create function called without DirectDraw object method SetCooperativeLevel being called.\0"; + case DDERR_NODC: + return "No DC was ever created for this surface.\0"; + case DDERR_NODDROPSHW: + return "No DirectDraw ROP hardware.\0"; + case DDERR_NODIRECTDRAWHW: + return "A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware.\0"; + case DDERR_NOEMULATION: + return "Software emulation not available.\0"; + case DDERR_NOEXCLUSIVEMODE: + return "Operation requires the application to have exclusive mode but the application does not have exclusive mode.\0"; + case DDERR_NOFLIPHW: + return "Flipping visible surfaces is not supported.\0"; + case DDERR_NOGDI: + return "There is no GDI present.\0"; + case DDERR_NOHWND: + return "Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND.\0"; + case DDERR_NOMIRRORHW: + return "Operation could not be carried out because there is no hardware present or available.\0"; + case DDERR_NOOVERLAYDEST: + return "Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on to establish a destination.\0"; + case DDERR_NOOVERLAYHW: + return "Operation could not be carried out because there is no overlay hardware present or available.\0"; + case DDERR_NOPALETTEATTACHED: + return "No palette object attached to this surface.\0"; + case DDERR_NOPALETTEHW: + return "No hardware support for 16 or 256 color palettes.\0"; + case DDERR_NORASTEROPHW: + return "Operation could not be carried out because there is no appropriate raster op hardware present or available.\0"; + case DDERR_NOROTATIONHW: + return "Operation could not be carried out because there is no rotation hardware present or available.\0"; + case DDERR_NOSTRETCHHW: + return "Operation could not be carried out because there is no hardware support for stretching.\0"; + case DDERR_NOT4BITCOLOR: + return "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette.\0"; + case DDERR_NOT4BITCOLORINDEX: + return "DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette.\0"; + case DDERR_NOT8BITCOLOR: + return "DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color.\0"; + case DDERR_NOTAOVERLAYSURFACE: + return "Returned when an overlay member is called for a non-overlay surface.\0"; + case DDERR_NOTEXTUREHW: + return "Operation could not be carried out because there is no texture mapping hardware present or available.\0"; + case DDERR_NOTFLIPPABLE: + return "An attempt has been made to flip a surface that is not flippable.\0"; + case DDERR_NOTFOUND: + return "Requested item was not found.\0"; + case DDERR_NOTLOCKED: + return "Surface was not locked. An attempt to unlock a surface that was not locked at all, or by this process, has been attempted.\0"; + case DDERR_NOTPALETTIZED: + return "The surface being used is not a palette-based surface.\0"; + case DDERR_NOVSYNCHW: + return "Operation could not be carried out because there is no hardware support for vertical blank synchronized operations.\0"; + case DDERR_NOZBUFFERHW: + return "Operation could not be carried out because there is no hardware support for zbuffer blitting.\0"; + case DDERR_NOZOVERLAYHW: + return "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays.\0"; + case DDERR_OUTOFCAPS: + return "The hardware needed for the requested operation has already been allocated.\0"; + case DDERR_OUTOFMEMORY: + return "DirectDraw does not have enough memory to perform the operation.\0"; + case DDERR_OUTOFVIDEOMEMORY: + return "DirectDraw does not have enough memory to perform the operation.\0"; + case DDERR_OVERLAYCANTCLIP: + return "The hardware does not support clipped overlays.\0"; + case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: + return "Can only have ony color key active at one time for overlays.\0"; + case DDERR_OVERLAYNOTVISIBLE: + return "Returned when GetOverlayPosition is called on a hidden overlay.\0"; + case DDERR_PALETTEBUSY: + return "Access to this palette is being refused because the palette is already locked by another thread.\0"; + case DDERR_PRIMARYSURFACEALREADYEXISTS: + return "This process already has created a primary surface.\0"; + case DDERR_REGIONTOOSMALL: + return "Region passed to Clipper::GetClipList is too small.\0"; + case DDERR_SURFACEALREADYATTACHED: + return "This surface is already attached to the surface it is being attached to.\0"; + case DDERR_SURFACEALREADYDEPENDENT: + return "This surface is already a dependency of the surface it is being made a dependency of.\0"; + case DDERR_SURFACEBUSY: + return "Access to this surface is being refused because the surface is already locked by another thread.\0"; + case DDERR_SURFACEISOBSCURED: + return "Access to surface refused because the surface is obscured.\0"; + case DDERR_SURFACELOST: + return "Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it.\0"; + case DDERR_SURFACENOTATTACHED: + return "The requested surface is not attached.\0"; + case DDERR_TOOBIGHEIGHT: + return "Height requested by DirectDraw is too large.\0"; + case DDERR_TOOBIGSIZE: + return "Size requested by DirectDraw is too large, but the individual height and width are OK.\0"; + case DDERR_TOOBIGWIDTH: + return "Width requested by DirectDraw is too large.\0"; + case DDERR_UNSUPPORTED: + return "Action not supported.\0"; + case DDERR_UNSUPPORTEDFORMAT: + return "FOURCC format requested is unsupported by DirectDraw.\0"; + case DDERR_UNSUPPORTEDMASK: + return "Bitmask in the pixel format requested is unsupported by DirectDraw.\0"; + case DDERR_VERTICALBLANKINPROGRESS: + return "Vertical blank is in progress.\0"; + case DDERR_WASSTILLDRAWING: + return "Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete.\0"; + case DDERR_WRONGMODE: + return "This surface can not be restored because it was created in a different mode.\0"; + case DDERR_XALIGN: + return "Rectangle provided was not horizontally aligned on required boundary.\0"; + case D3DERR_BADMAJORVERSION: + return "D3DERR_BADMAJORVERSION\0"; + case D3DERR_BADMINORVERSION: + return "D3DERR_BADMINORVERSION\0"; + case D3DERR_EXECUTE_LOCKED: + return "D3DERR_EXECUTE_LOCKED\0"; + case D3DERR_EXECUTE_NOT_LOCKED: + return "D3DERR_EXECUTE_NOT_LOCKED\0"; + case D3DERR_EXECUTE_CREATE_FAILED: + return "D3DERR_EXECUTE_CREATE_FAILED\0"; + case D3DERR_EXECUTE_DESTROY_FAILED: + return "D3DERR_EXECUTE_DESTROY_FAILED\0"; + case D3DERR_EXECUTE_LOCK_FAILED: + return "D3DERR_EXECUTE_LOCK_FAILED\0"; + case D3DERR_EXECUTE_UNLOCK_FAILED: + return "D3DERR_EXECUTE_UNLOCK_FAILED\0"; + case D3DERR_EXECUTE_FAILED: + return "D3DERR_EXECUTE_FAILED\0"; + case D3DERR_EXECUTE_CLIPPED_FAILED: + return "D3DERR_EXECUTE_CLIPPED_FAILED\0"; + case D3DERR_TEXTURE_NO_SUPPORT: + return "D3DERR_TEXTURE_NO_SUPPORT\0"; + case D3DERR_TEXTURE_NOT_LOCKED: + return "D3DERR_TEXTURE_NOT_LOCKED\0"; + case D3DERR_TEXTURE_LOCKED: + return "D3DERR_TEXTURELOCKED\0"; + case D3DERR_TEXTURE_CREATE_FAILED: + return "D3DERR_TEXTURE_CREATE_FAILED\0"; + case D3DERR_TEXTURE_DESTROY_FAILED: + return "D3DERR_TEXTURE_DESTROY_FAILED\0"; + case D3DERR_TEXTURE_LOCK_FAILED: + return "D3DERR_TEXTURE_LOCK_FAILED\0"; + case D3DERR_TEXTURE_UNLOCK_FAILED: + return "D3DERR_TEXTURE_UNLOCK_FAILED\0"; + case D3DERR_TEXTURE_LOAD_FAILED: + return "D3DERR_TEXTURE_LOAD_FAILED\0"; + case D3DERR_MATRIX_CREATE_FAILED: + return "D3DERR_MATRIX_CREATE_FAILED\0"; + case D3DERR_MATRIX_DESTROY_FAILED: + return "D3DERR_MATRIX_DESTROY_FAILED\0"; + case D3DERR_MATRIX_SETDATA_FAILED: + return "D3DERR_MATRIX_SETDATA_FAILED\0"; + case D3DERR_SETVIEWPORTDATA_FAILED: + return "D3DERR_SETVIEWPORTDATA_FAILED\0"; + case D3DERR_MATERIAL_CREATE_FAILED: + return "D3DERR_MATERIAL_CREATE_FAILED\0"; + case D3DERR_MATERIAL_DESTROY_FAILED: + return "D3DERR_MATERIAL_DESTROY_FAILED\0"; + case D3DERR_MATERIAL_SETDATA_FAILED: + return "D3DERR_MATERIAL_SETDATA_FAILED\0"; + case D3DERR_LIGHT_SET_FAILED: + return "D3DERR_LIGHT_SET_FAILED\0"; + case D3DRMERR_BADOBJECT: + return "D3DRMERR_BADOBJECT\0"; + case D3DRMERR_BADTYPE: + return "D3DRMERR_BADTYPE\0"; + case D3DRMERR_BADALLOC: + return "D3DRMERR_BADALLOC\0"; + case D3DRMERR_FACEUSED: + return "D3DRMERR_FACEUSED\0"; + case D3DRMERR_NOTFOUND: + return "D3DRMERR_NOTFOUND\0"; + case D3DRMERR_NOTDONEYET: + return "D3DRMERR_NOTDONEYET\0"; + case D3DRMERR_FILENOTFOUND: + return "The file was not found.\0"; + case D3DRMERR_BADFILE: + return "D3DRMERR_BADFILE\0"; + case D3DRMERR_BADDEVICE: + return "D3DRMERR_BADDEVICE\0"; + case D3DRMERR_BADVALUE: + return "D3DRMERR_BADVALUE\0"; + case D3DRMERR_BADMAJORVERSION: + return "D3DRMERR_BADMAJORVERSION\0"; + case D3DRMERR_BADMINORVERSION: + return "D3DRMERR_BADMINORVERSION\0"; + case D3DRMERR_UNABLETOEXECUTE: + return "D3DRMERR_UNABLETOEXECUTE\0"; + default: + return "Unrecognized error value.\0"; + } +} diff --git a/sdk/samples/misc/rmerror.h b/sdk/samples/misc/rmerror.h new file mode 100644 index 0000000..80cf3b7 --- /dev/null +++ b/sdk/samples/misc/rmerror.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rmerror.h + * + * Error reporting code for D3DRM examples. + * + */ + +#ifndef __ERROR_H__ +#define __ERROR_H__ + +#include <ddraw.h> +#include <d3d.h> +#include <d3drmwin.h> +#include <d3drm.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Msg + * Displays a message box containing the given formatted string. + */ +void __cdecl +Msg( LPSTR fmt, ... ); + +/* + * D3DRMErrorToString + * Returns a pointer to a string describing the given DD, D3D or D3DRM error code. + */ +char* +D3DRMErrorToString(HRESULT error); + +#ifdef __cplusplus +}; +#endif +#endif // __ERROR_H__ + diff --git a/sdk/samples/misc/rmfull.cpp b/sdk/samples/misc/rmfull.cpp new file mode 100644 index 0000000..15837f4 --- /dev/null +++ b/sdk/samples/misc/rmfull.cpp @@ -0,0 +1,1088 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rmfull.cpp + * + * Each of the Direct3D retained mode (D3DRM) samples may be linked with + * this file. It contains the code which allows them to run in the Windows + * environment as a window or fullscreen. It is a modified version of + * d3dmain.cpp. Comparing these two files is instructive. + * + * A window is created using rmfull.res which allows the user to select the + * Direct3D driver to use and change the render options. The D3DApp + * collection of functions is used to initialize DirectDraw, Direct3D and + * keep surfaces and D3D devices available for rendering. + * + * Frame rate and a screen mode information buffer is Blt'ed to the screen + * by functions in rmstats.cpp. + * + * Individual samples are executed through two functions, BuildScene and + * OverrideDefaults, as described in rmdemo.h. Samples can also read + * mouse input via ReadMouse. + */ + +#include "rmfull.h" + +/* + * GLOBAL VARIABLES + */ +D3DAppInfo* d3dapp; /* Pointer to read only collection of DD and D3D + objects maintained by D3DApp */ +rmfullglobals myglobs; /* collection of global variables */ +LPDIRECT3DRM lpD3DRM; /* Direct3DRM object */ + +/* + * INTERNAL FUNCTION PROTOTYPES + */ +static BOOL AppInit(HINSTANCE hInstance, LPSTR lpCmdLine); +static BOOL CreateD3DApp(LPSTR lpCmdLine); +static BOOL BeforeDeviceDestroyed(LPVOID lpContext); +static BOOL AfterDeviceCreated(int w, int h, LPDIRECT3DVIEWPORT* lpViewport, + LPVOID lpContext); +void CleanUpAndPostQuit(void); +static void InitGlobals(void); +static BOOL AppPause(BOOL f); +void ReportD3DAppError(void); +static BOOL RenderLoop(void); +static BOOL RestoreSurfaces(); +long FAR PASCAL WindowProc(HWND hWnd, UINT message, WPARAM wParam, + LPARAM lParam ); +extern "C" void ReadMouse(int*, int*, int*); +extern "C" char* D3DRMErrorToString(HRESULT error); +BOOL CreateD3DRM(HWND win); +BOOL SetRenderState(void); + +/****************************************************************************/ +/* WinMain */ +/****************************************************************************/ +/* + * Initializes the application then enters a message loop which calls sample's + * RenderScene until a quit message is received. + */ +int PASCAL +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, + int nCmdShow) +{ + int failcount = 0; /* number of times RenderLoop has failed */ + MSG msg; + HACCEL hAccelApp; + + hPrevInstance; + /* + * Create the window and initialize all objects needed to begin rendering + */ + if(!AppInit(hInstance, lpCmdLine)) + return FALSE; + hAccelApp = LoadAccelerators(hInstance, "AppAccel"); + + while (!myglobs.bQuit) { + /* + * Monitor the message queue until there are no pressing + * messages + */ + if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + if (msg.message == WM_QUIT) { + CleanUpAndPostQuit(); + break; + } + if (!myglobs.hWndMain || !TranslateAccelerator(myglobs.hWndMain, + hAccelApp, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + /* + * If the app is not minimized, not about to quit, not paused, either the + * active fullscreen app or in a window and D3D has been initialized, + * we can render + */ + } else if (d3dapp->bRenderingIsOK && !d3dapp->bMinimized + && !d3dapp->bPaused && !myglobs.bQuit + && (d3dapp->bAppActive || !d3dapp->bFullscreen)) { + /* + * If were are not in single step mode or if we are and the + * bDrawAFrame flag is set, render one frame + */ + if (!(myglobs.bSingleStepMode && !myglobs.bDrawAFrame)) { + /* + * Attempt to render a frame, if it fails, take a note. If + * rendering fails more than twice, abort execution. + */ + if (!RenderLoop()) { + ++failcount; + if (failcount == 3) { + Msg("Rendering has failed too many times. Aborting execution.\n"); + CleanUpAndPostQuit(); + break; + } + } + } + /* + * Reset the bDrawAFrame flag if we are in single step mode + */ + if (myglobs.bSingleStepMode) + myglobs.bDrawAFrame = FALSE; + } else { + WaitMessage(); + } + } + DestroyWindow(myglobs.hWndMain); + return msg.wParam; +} + +/****************************************************************************/ +/* D3DApp Initialization and callback functions */ +/****************************************************************************/ +/* + * AppInit + * Creates the window and initializes all objects necessary to begin rendering + */ +static BOOL +AppInit(HINSTANCE hInstance, LPSTR lpCmdLine) +{ + WNDCLASS wc; + DWORD flags; + Defaults defaults; + + /* + * Register the window class + */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon( hInstance, "AppIcon"); + wc.hCursor = LoadCursor( NULL, IDC_ARROW ); + wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + wc.lpszMenuName = "AppMenu"; + wc.lpszClassName = "Example"; + if (!RegisterClass(&wc)) + return FALSE; + /* + * Initialize the global variables and allow the sample code to override + * some of these default settings. + */ + InitGlobals(); + myglobs.hInstApp = hInstance; + defaults.bNoTextures = myglobs.bNoTextures; + defaults.bConstRenderQuality = myglobs.bConstRenderQuality; + defaults.bResizingDisabled = FALSE; + lstrcpy(defaults.Name, "D3DRM Example"); + OverrideDefaults(&defaults); + myglobs.bNoTextures = defaults.bNoTextures; + myglobs.bConstRenderQuality = defaults.bConstRenderQuality; + /* + * Create the window + */ + if (defaults.bResizingDisabled) + flags = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | + WS_MINIMIZEBOX | WS_MAXIMIZEBOX; + else + flags = WS_OVERLAPPEDWINDOW; + /* + * Create a window with some default settings that may change + */ + myglobs.hWndMain = CreateWindowEx( + WS_EX_APPWINDOW, + "Example", + defaults.Name, + flags, + CW_USEDEFAULT, CW_USEDEFAULT, + START_WIN_SIZE, START_WIN_SIZE, + NULL, /* parent window */ + NULL, /* menu handle */ + hInstance, /* program handle */ + NULL); /* create parms */ + if (!myglobs.hWndMain){ + Msg("CreateWindowEx failed"); + return FALSE; + } + /* + * Display the window + */ + ShowWindow(myglobs.hWndMain, SW_SHOWNORMAL); + UpdateWindow(myglobs.hWndMain); + /* + * Create the D3DRM object which are initialized only when the program + * starts + */ + if (!CreateD3DRM(myglobs.hWndMain)) + return FALSE; + /* + * Call D3DApp to initialize all DD and D3D objects necessary to render. + * D3DApp will call the device creation callback which will initialize the + * viewport and the sample's execute buffers. + */ + if (!CreateD3DApp(lpCmdLine)) + return FALSE; + /* + * Create the scene to be rendered by calling this sample's BuildScene + */ + if (!BuildScene(myglobs.dev, myglobs.view, myglobs.scene, myglobs.camera)) + return FALSE; + + return TRUE; +} + +/* + * CreateD3DRM + * Create main D3DRM objects which are only initialized once. + */ +BOOL +CreateD3DRM(HWND win) +{ + HRESULT rval; + + /* + * Create the D3DRM object + */ + rval = Direct3DRMCreate(&lpD3DRM); + if (rval != D3DRM_OK) { + Msg("Failed to create Direct3DRM.\n%s", D3DAppErrorToString(rval)); + return FALSE; + } + /* + * Create the master scene frame and camera frame + */ + rval = lpD3DRM->CreateFrame(NULL, &myglobs.scene); + if (rval != D3DRM_OK) { + Msg("Failed to create the master scene frame.\n%s", D3DAppErrorToString(rval)); + return FALSE; + } + rval = lpD3DRM->CreateFrame(myglobs.scene, &myglobs.camera); + if (rval != D3DRM_OK) { + Msg("Failed to create the camera's frame.\n%s", D3DAppErrorToString(rval)); + return FALSE; + } + rval = myglobs.camera->SetPosition(myglobs.scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)); + if (rval != D3DRM_OK) { + Msg("Failed to position the camera in the frame.\n%s", D3DAppErrorToString(rval)); + return FALSE; + } + return TRUE; +} + +/* + * CreateD3DApp + * Create all DirectDraw and Direct3D objects necessary to begin rendering. + * Add the list of D3D drivers to the file menu. + */ +static BOOL +CreateD3DApp(LPSTR lpCmdLine) +{ + HMENU hmenu; + int i; + LPSTR option; + BOOL bOnlySystemMemory, bOnlyEmulation; + DWORD flags; + + /* + * Parse the command line in seach of one of the following options: + * systemmemory All surfaces should be created in system memory. + * Hardware DD and D3D devices are disabled, but + * debugging during the Win16 lock becomes possible. + * emulation Do not use hardware DD or D3D devices. + */ + bOnlySystemMemory = FALSE; + bOnlyEmulation = FALSE; + option = strtok(lpCmdLine, " -"); + while(option != NULL ) { + if (!lstrcmp(option, "systemmemory")) { + bOnlySystemMemory = TRUE; + } else if (!lstrcmp(option, "emulation")) { + bOnlyEmulation = TRUE; + } else { + Msg("Invalid command line options given.\nLegal options: -systemmemory, -emulation\n"); + return FALSE; + } + option = strtok(NULL, " -"); + } + /* + * Set the flags to pass to the D3DApp creation based on command line + */ + flags = ((bOnlySystemMemory) ? D3DAPP_ONLYSYSTEMMEMORY : 0) | + ((bOnlyEmulation) ? (D3DAPP_ONLYD3DEMULATION | + D3DAPP_ONLYDDEMULATION) : 0); + /* + * Create all the DirectDraw and D3D objects neccesary to render. The + * AfterDeviceCreated callback function is called by D3DApp to create the + * viewport and the example's execute buffers. + */ + if (!D3DAppCreateFromHWND(flags, myglobs.hWndMain, AfterDeviceCreated, + NULL, BeforeDeviceDestroyed, NULL, &d3dapp)) { + ReportD3DAppError(); + return FALSE; + } + /* + * Add the the list of display modes D3DApp found to the mode menu + */ + hmenu = GetSubMenu(GetMenu(myglobs.hWndMain), 2); + for (i = 0; i < d3dapp->NumModes; i++) { + char ach[80]; + wsprintf(ach,"%dx%dx%d", d3dapp->Mode[i].w, d3dapp->Mode[i].h, + d3dapp->Mode[i].bpp); + AppendMenu(hmenu, MF_STRING, MENU_FIRST_MODE+i, ach); + } + /* + * Add the list of D3D drivers D3DApp foudn to the file menu + */ + hmenu = GetSubMenu(GetMenu(myglobs.hWndMain), 0); + for (i = 0; i < d3dapp->NumDrivers; i++) { + InsertMenu(hmenu, 6 + i, MF_BYPOSITION | MF_STRING, + MENU_FIRST_DRIVER + i, d3dapp->Driver[i].Name); + } + + return TRUE; +} + +/* + * AfterDeviceCreated + * D3DApp will call this function immediately after the D3D device has been + * created (or re-created). D3DApp expects the D3D viewport to be created and + * returned. In this case, we will return NULL because we only have a D3DRM + * viewport. This is fine as long as we don't use any of the D3D viewport + * functionality of D3DApp. + */ +static BOOL +AfterDeviceCreated(int w, int h, LPDIRECT3DVIEWPORT* lplpViewport, LPVOID lpContext) +{ + HRESULT rval; + + rval = lpD3DRM->CreateDeviceFromD3D(d3dapp->lpD3D, d3dapp->lpD3DDevice, + &myglobs.dev); + if (rval != D3DRM_OK) { + Msg("Creation of D3DRM device failed.\n%s", D3DAppErrorToString(rval)); + return FALSE; + } + /* + * Create the D3DRM viewport using the camera frame. Set the background + * depth to a large number. The width and height may be slightly + * adjusted, so get them from the device to be sure. + */ + w = myglobs.dev->GetWidth(); + h = myglobs.dev->GetHeight(); + rval = lpD3DRM->CreateViewport(myglobs.dev, myglobs.camera, 0, 0, w, + h, &myglobs.view); + if (rval != D3DRM_OK) { + Msg("Failed to create the D3DRM viewport.\n%s", + D3DAppErrorToString(rval)); + RELEASE(myglobs.dev); + return FALSE; + } + rval = myglobs.view->SetBack(D3DVAL(5000.0)); + if (rval != D3DRM_OK) { + Msg("Failed to set the background depth of the D3DRM viewport.\n%s", + D3DAppErrorToString(rval)); + RELEASE(myglobs.dev); + RELEASE(myglobs.view); + return FALSE; + } + /* + * Set the render quality, fill mode, lighting state and color shade info + */ + if (!SetRenderState()) + return FALSE; + + /* + * Return NULL for the viewport + */ + *lplpViewport = NULL; + /* + * Create and initialize the surfaces containing the frame rate and + * window information + */ + InitFontAndTextBuffers(); + + return TRUE; +} + +/* + * BeforeDeviceDestroyed + * D3DApp will call this function before the current D3D device is destroyed + * to give the app the opportunity to destroy objects it has created with the + * DD or D3D objects. + */ +static BOOL +BeforeDeviceDestroyed(LPVOID lpContext) +{ + RELEASE(myglobs.view); + RELEASE(myglobs.dev); + return TRUE; +} + +/****************************************************************************/ +/* Rendering loop */ +/****************************************************************************/ +/* + * RenderLoop + * Render the next frame and update the window + */ +static BOOL +RenderLoop() +{ + D3DRECT extents[D3DAPP_MAXCLEARRECTS]; + int count; + HRESULT rval; + static BOOL b = FALSE; // Clear the second buffer on also + + /* + * If all the DD and D3D objects have been initialized we can render + */ + if (d3dapp->bRenderingIsOK) { + /* + * Restore any lost surfaces + */ + if (!RestoreSurfaces()) { + /* + * Restoring surfaces sometimes fails because the surfaces cannot + * yet be restored. If this is the case, the error will show up + * somewhere else and we should return success here to prevent + * unnecessary error's being reported. + */ + return TRUE; + } + /* + * Force an update of the entire client window if the resized flag is set + */ + if (myglobs.bResized || b) + myglobs.view->ForceUpdate(0, 0, d3dapp->szClient.cx, d3dapp->szClient.cy); + /* + * Use b to makesure the second buffer is cleared also + */ + if (b) + b = FALSE; + if (myglobs.bResized) + b = TRUE; + + /* + * Calculate the frame rate + */ + if (!CalculateFrameRate()) + return FALSE; + + /* + * Tick the scene + */ + rval = myglobs.scene->Move(D3DVAL(1.0)); + if (rval != D3DRM_OK) { + Msg("Moving scene failed.\n%s", D3DAppErrorToString(rval)); + return FALSE; + } + /* + * Clear the viewport + */ + rval = myglobs.view->Clear(); + if (rval != D3DRM_OK) { + Msg("Clearing viewport failed.\n%s", D3DAppErrorToString(rval)); + return FALSE; + } + /* + * Render the scene to the viewport + */ + rval = myglobs.view->Render(myglobs.scene); + if (rval != D3DRM_OK) { + Msg("Rendering scene failed.\n%s", D3DAppErrorToString(rval)); + return FALSE; + } + /* + * Blt the frame rate and window stat text to the back buffer + */ + count = 0; + if (!DisplayFrameRate(&count, &extents[0])) + return FALSE; + for (;count;--count) + myglobs.view->ForceUpdate(extents[count-1].x1, extents[count-1].y1, + extents[count-1].x2, extents[count-1].y2); + /* + * Update the window + */ + rval = myglobs.dev->Update(); + if (rval != D3DRM_OK) { + Msg("Updating device failed.\n%s", D3DAppErrorToString(rval)); + return FALSE; + } + /* + * Blt or flip the back buffer to the front buffer. If this fails, + * don't report an error. + */ + D3DAppShowBackBuffer(myglobs.bResized ? D3DAPP_SHOWALL : NULL); + + /* + * Reset the resize flag + */ + myglobs.bResized = FALSE; + } + return TRUE; +} + +/* + * AppPause + * Pause and unpause the application + */ +static BOOL +AppPause(BOOL f) +{ + /* + * Flip to the GDI surface and halt rendering + */ + if (!D3DAppPause(f)) + return FALSE; + /* + * When returning from a pause, reset the frame rate count + */ + if (!f) { + ResetFrameRate(); + myglobs.bResized = TRUE; + } + return TRUE; +} + +/* + * RestoreSurfaces + * Restores any lost surfaces. Returns TRUE if all surfaces are not lost and + * FALSE if one or more surfaces is lost and can not be restored at the + * moment. + */ +static BOOL +RestoreSurfaces() +{ + HRESULT d3drval; + + /* + * Have D3DApp check all the surfaces it's in charge of + */ + if (!D3DAppCheckForLostSurfaces()) { + return FALSE; + } + /* + * Check frame rate and info surfaces and re-write them if they + * were lost. + */ + if (myglobs.lpFrameRateBuffer->IsLost() == DDERR_SURFACELOST) { + d3drval = myglobs.lpFrameRateBuffer->Restore(); + if (d3drval != DD_OK) { + return FALSE; + } + if (!WriteFrameRateBuffer(0.0f, 0)) + return FALSE; + } + if (myglobs.lpInfoBuffer->IsLost() == DDERR_SURFACELOST) { + d3drval = myglobs.lpInfoBuffer->Restore(); + if (d3drval != DD_OK) { + return FALSE; + } + if (!WriteInfoBuffer()) + return FALSE; + } + return TRUE; +} + + +/************************************************************************* + Windows message handlers + *************************************************************************/ +/* + * AppAbout + * About box message handler + */ +BOOL +FAR PASCAL AppAbout(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_COMMAND: + if (LOWORD(wParam) == IDOK) + EndDialog(hwnd, TRUE); + break; + + case WM_INITDIALOG: + return TRUE; + } + return FALSE; +} + +/* + * WindowProc + * Main window message handler. + */ +long +FAR PASCAL WindowProc(HWND hWnd, UINT message, WPARAM wParam, + LPARAM lParam ) +{ + int i; + BOOL bStop; + LRESULT lresult; + + /* + * Give D3DApp an opportunity to process any messages it MUST see in order + * to perform it's function. + */ + if (!D3DAppWindowProc(&bStop, &lresult, hWnd, message, wParam, lParam)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + return 0; + } + /* + * If bStop is set by D3DApp, the app should not process the message but + * return lresult. + */ + if (bStop) + return lresult; + + switch( message ) { + case WM_LBUTTONDOWN: + case WM_LBUTTONUP: + case WM_RBUTTONDOWN: + case WM_RBUTTONUP: + case WM_MOUSEMOVE: + /* + * Record the mouse state for ReadMouse + */ + myglobs.mouse_buttons = wParam; + myglobs.mouse_x = LOWORD(lParam); + myglobs.mouse_y = HIWORD(lParam); + break; + case WM_ENTERMENULOOP: + AppPause(TRUE); + break; + case WM_EXITMENULOOP: + AppPause(FALSE); + break; + case WM_DESTROY: + myglobs.hWndMain = NULL; + CleanUpAndPostQuit(); + break; + case WM_INITMENUPOPUP: + /* + * Check and enable the appropriate menu items + */ + CheckMenuItem((HMENU)wParam, MENU_STEP, (myglobs.bSingleStepMode) ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_GO, (myglobs.bSingleStepMode) ? MF_ENABLED : MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_PHONG, MF_GRAYED); + if (!myglobs.bConstRenderQuality) { + CheckMenuItem((HMENU)wParam, MENU_LIGHTING, (myglobs.RenderQuality & D3DRMLIGHT_MASK) == D3DRMLIGHT_ON ? MF_CHECKED : MF_GRAYED); + CheckMenuItem((HMENU)wParam, MENU_FLAT, (myglobs.RenderQuality & D3DRMSHADE_MASK) == D3DRMSHADE_FLAT ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_GOURAUD, (myglobs.RenderQuality & D3DRMSHADE_MASK) == D3DRMSHADE_GOURAUD ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_PHONG, (myglobs.RenderQuality & D3DRMSHADE_MASK) == D3DRMSHADE_PHONG ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_PHONG, MF_GRAYED); + CheckMenuItem((HMENU)wParam, MENU_POINT, (myglobs.RenderQuality & D3DRMFILL_MASK) == D3DRMFILL_POINTS ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_WIREFRAME, (myglobs.RenderQuality & D3DRMFILL_MASK) == D3DRMFILL_WIREFRAME ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_SOLID, (myglobs.RenderQuality & D3DRMFILL_MASK) == D3DRMFILL_SOLID ? MF_CHECKED : MF_UNCHECKED); + } else { + EnableMenuItem((HMENU)wParam, MENU_LIGHTING, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_FLAT, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_GOURAUD, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_PHONG, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_POINT, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_WIREFRAME, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_SOLID, MF_GRAYED); + } + if (!myglobs.bNoTextures && d3dapp->ThisDriver.bDoesTextures) { + CheckMenuItem((HMENU)wParam, MENU_POINT_FILTER, (myglobs.TextureQuality == D3DRMTEXTURE_NEAREST) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_LINEAR_FILTER, (myglobs.TextureQuality == D3DRMTEXTURE_LINEAR) ? MF_CHECKED : MF_UNCHECKED); + } else { + EnableMenuItem((HMENU)wParam, MENU_POINT_FILTER, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_LINEAR_FILTER, MF_GRAYED); + } + CheckMenuItem((HMENU)wParam, MENU_DITHERING, (myglobs.bDithering) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wParam, MENU_ANTIALIAS, (myglobs.bAntialiasing) ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_ANTIALIAS, MF_GRAYED); + if (d3dapp->bIsPrimary) { + CheckMenuItem((HMENU)wParam, MENU_FULLSCREEN, d3dapp->bFullscreen ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_FULLSCREEN, d3dapp->bFullscreen && !d3dapp->ThisDriver.bCanDoWindow ? MF_GRAYED : MF_ENABLED); + EnableMenuItem((HMENU)wParam, MENU_NEXT_MODE, (!d3dapp->bFullscreen) ? MF_GRAYED : MF_ENABLED); + EnableMenuItem((HMENU)wParam, MENU_PREVIOUS_MODE, (!d3dapp->bFullscreen) ? MF_GRAYED : MF_ENABLED); + } else { + EnableMenuItem((HMENU)wParam, MENU_FULLSCREEN, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_NEXT_MODE, MF_GRAYED); + EnableMenuItem((HMENU)wParam, MENU_PREVIOUS_MODE, MF_GRAYED); + } + for (i = 0; i < d3dapp->NumModes; i++) { + CheckMenuItem((HMENU)wParam, MENU_FIRST_MODE + i, (i == d3dapp->CurrMode) ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wParam, MENU_FIRST_MODE + i, (d3dapp->Mode[i].bThisDriverCanDo) ? MF_ENABLED : MF_GRAYED); + } + for (i = 0; i < d3dapp->NumDrivers; i++) { + CheckMenuItem((HMENU)wParam, MENU_FIRST_DRIVER + i, (i == d3dapp->CurrDriver) ? MF_CHECKED : MF_UNCHECKED); + } + break; + case WM_COMMAND: + switch(LOWORD(wParam)) { + case MENU_ABOUT: + AppPause(TRUE); + DialogBox(myglobs.hInstApp, "AppAbout", myglobs.hWndMain, (DLGPROC)AppAbout); + AppPause(FALSE); + break; + case MENU_EXIT: + CleanUpAndPostQuit(); + break; + case MENU_STEP: + /* + * Begin single step more or draw a frame if in single + * step mode + */ + if (!myglobs.bSingleStepMode) { + myglobs.bSingleStepMode = TRUE; + myglobs.bDrawAFrame = TRUE; + } else if (!myglobs.bDrawAFrame) { + myglobs.bDrawAFrame = TRUE; + } + break; + case MENU_GO: + /* + * Exit single step mode + */ + if (myglobs.bSingleStepMode) { + myglobs.bSingleStepMode = FALSE; + ResetFrameRate(); + } + break; + case MENU_STATS: + /* + * Toggle output of frame rate and window info + */ + if ((myglobs.bShowFrameRate) && (myglobs.bShowInfo)) { + myglobs.bShowFrameRate = FALSE; + myglobs.bShowInfo = FALSE; + break; + } + if ((!myglobs.bShowFrameRate) && (!myglobs.bShowInfo)) { + myglobs.bShowFrameRate = TRUE; + break; + } + myglobs.bShowInfo = TRUE; + break; + case MENU_FULLSCREEN: + if (d3dapp->bFullscreen) { + /* + * Return to a windowed mode. Let D3DApp decide which + * D3D driver to use in case this one cannot render to + * the Windows display depth + */ + if (!D3DAppWindow(D3DAPP_YOUDECIDE, D3DAPP_YOUDECIDE)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + break; + } + } else { + /* + * Enter the current fullscreen mode. D3DApp may + * resort to another mode if this driver cannot do + * the currently selected mode. + */ + if (!D3DAppFullscreen(d3dapp->CurrMode)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + break; + } + } + break; + /* + * Lighting toggle + */ + case MENU_LIGHTING: + myglobs.RenderQuality ^= D3DRMLIGHT_ON; + SetRenderState(); + break; + /* + * Fill mode selection + */ + case MENU_POINT: + myglobs.RenderQuality = (myglobs.RenderQuality & ~D3DRMFILL_MASK) | D3DRMFILL_POINTS; + SetRenderState(); + break; + case MENU_WIREFRAME: + myglobs.RenderQuality = (myglobs.RenderQuality & ~D3DRMFILL_MASK) | D3DRMFILL_WIREFRAME; + SetRenderState(); + break; + case MENU_SOLID: + myglobs.RenderQuality = (myglobs.RenderQuality & ~D3DRMFILL_MASK) | D3DRMFILL_SOLID; + SetRenderState(); + break; + /* + * Shade mode selection + */ + case MENU_FLAT: + myglobs.RenderQuality = (myglobs.RenderQuality & ~D3DRMSHADE_MASK) | D3DRMSHADE_FLAT; + SetRenderState(); + break; + case MENU_GOURAUD: + myglobs.RenderQuality = (myglobs.RenderQuality & ~D3DRMSHADE_MASK) | D3DRMSHADE_GOURAUD; + SetRenderState(); + break; + case MENU_PHONG: + myglobs.RenderQuality = (myglobs.RenderQuality & ~D3DRMSHADE_MASK) | D3DRMSHADE_PHONG; + SetRenderState(); + break; + + case MENU_DITHERING: + myglobs.bDithering = !myglobs.bDithering; + SetRenderState(); + break; + case MENU_ANTIALIAS: + myglobs.bAntialiasing = !myglobs.bAntialiasing; + SetRenderState(); + break; + /* + * Texture filter selection + */ + case MENU_POINT_FILTER: + if (myglobs.TextureQuality == D3DRMTEXTURE_NEAREST) + break; + myglobs.TextureQuality = D3DRMTEXTURE_NEAREST; + SetRenderState(); + break; + case MENU_LINEAR_FILTER: + if (myglobs.TextureQuality == D3DRMTEXTURE_LINEAR) + break; + myglobs.TextureQuality = D3DRMTEXTURE_LINEAR; + SetRenderState(); + break; + case MENU_NEXT_MODE: + /* + * Enter the next usable fullscreen mode + */ + i = d3dapp->CurrMode; + do { + ++i; + if (i >= d3dapp->NumModes) + i = 0; + if (!d3dapp->Mode[i].bThisDriverCanDo) + continue; + else { + if (!D3DAppFullscreen(i)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + } + break; + } + } while(i != d3dapp->CurrMode); + break; + case MENU_PREVIOUS_MODE: + /* + * Enter the previous usable fullscreen mode + */ + i = d3dapp->CurrMode; + do { + --i; + if (i < 0) + i = d3dapp->NumModes - 1; + if (!d3dapp->Mode[i].bThisDriverCanDo) + continue; + else { + if (!D3DAppFullscreen(i)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + } + break; + } + } while(i != d3dapp->CurrMode); + break; + } + if ( LOWORD(wParam) >= MENU_FIRST_DRIVER + && LOWORD(wParam) < MENU_FIRST_DRIVER + D3DAPP_MAXD3DDRIVERS + && d3dapp->CurrDriver != LOWORD(wParam) - MENU_FIRST_DRIVER) { + /* + * Change the D3D driver + */ + if (!D3DAppChangeDriver(LOWORD(wParam) - MENU_FIRST_DRIVER, + NULL)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + } + } + if ( LOWORD(wParam) >= MENU_FIRST_MODE + && LOWORD(wParam) < MENU_FIRST_MODE+100) { + /* + * Switch to the selected fullscreen mode + */ + if (!D3DAppFullscreen(LOWORD(wParam) - MENU_FIRST_MODE)) { + ReportD3DAppError(); + CleanUpAndPostQuit(); + } + } + /* + * Whenever we receive a command in single step mode, draw a frame + */ + if (myglobs.bSingleStepMode) + myglobs.bDrawAFrame = TRUE; + return 0L; + } + return DefWindowProc(hWnd, message, wParam, lParam); +} + +/****************************************************************************/ +/* Additional Functions */ +/****************************************************************************/ +/* + * ReadMouse + * Returns the mouse status for interaction with sample code + */ +void +ReadMouse(int* b, int* x, int* y) +{ + *b = myglobs.mouse_buttons; + *x = myglobs.mouse_x; + *y = myglobs.mouse_y; +} + +/* + * SetRenderState + * Set the render quality, dither toggle and shade info if any of them has + * changed + */ +BOOL +SetRenderState(void) +{ + HRESULT rval; + /* + * Set the number of buffers so D3DRM can keep track of extents properly + */ + rval = myglobs.dev->SetBufferCount(d3dapp->bFullscreen && + d3dapp->bBackBufferInVideo ? 2 : 1); + if (rval != D3DRM_OK) { + Msg("Setting the buffer count failed.\n%s", D3DAppErrorToString(rval)); + return FALSE; + } + /* + * Set the render quality (light toggle, fill mode, shade mode) + */ + if (myglobs.dev->GetQuality() != myglobs.RenderQuality) { + rval = myglobs.dev->SetQuality(myglobs.RenderQuality); + if (rval != D3DRM_OK) { + Msg("Setting the render quality failed.\n%s", + D3DAppErrorToString(rval)); + return FALSE; + } + } + /* + * Set dithering toggle + */ + if (myglobs.dev->GetDither() != myglobs.bDithering) { + rval = myglobs.dev->SetDither(myglobs.bDithering); + if (rval != D3DRM_OK) { + Msg("Setting dither mode failed.\n%s", D3DAppErrorToString(rval)); + return FALSE; + } + } + /* + * Set the texture quality (point or linear filtering) + */ + if (myglobs.dev->GetTextureQuality() != myglobs.TextureQuality) { + rval = myglobs.dev->SetTextureQuality(myglobs.TextureQuality); + if (rval != D3DRM_OK) { + Msg("Setting texture quality failed.\n%s", + D3DAppErrorToString(rval)); + return FALSE; + } + } + /* + * Set shade info based on current bits per pixel + */ + switch (d3dapp->ThisMode.bpp) { + case 1: + if (FAILED(myglobs.dev->SetShades(4))) + goto shades_error; + if (FAILED(lpD3DRM->SetDefaultTextureShades(4))) + goto shades_error; + break; + case 16: + if (FAILED(myglobs.dev->SetShades(32))) + goto shades_error; + if (FAILED(lpD3DRM->SetDefaultTextureColors(64))) + goto shades_error; + if (FAILED(lpD3DRM->SetDefaultTextureShades(32))) + goto shades_error; + break; + case 24: + case 32: + if (FAILED(myglobs.dev->SetShades(256))) + goto shades_error; + if (FAILED(lpD3DRM->SetDefaultTextureColors(64))) + goto shades_error; + if (FAILED(lpD3DRM->SetDefaultTextureShades(256))) + goto shades_error; + break; + } + return TRUE; +shades_error: + Msg("A failure occurred while setting color shade information.\n"); + return FALSE; +} + +/****************************************************************************/ +/* Initialization, error reporting and release functions. */ +/****************************************************************************/ +/* + * InitGlobals + * Called once at program initialization to initialize global variables. + */ +static void +InitGlobals(void) +{ + d3dapp = NULL; + memset(&myglobs, 0, sizeof(myglobs)); + myglobs.bShowFrameRate = TRUE; + myglobs.bShowInfo = TRUE; + myglobs.RenderQuality = D3DRMLIGHT_ON | D3DRMFILL_SOLID | + D3DRMSHADE_GOURAUD; + myglobs.TextureQuality = D3DRMTEXTURE_NEAREST; +} + +/* + * CleanUpAndPostQuit + * Release all D3D objects, post a quit message and set the bQuit flag + */ +void +CleanUpAndPostQuit(void) +{ + if (myglobs.bQuit) + return; + if (!D3DAppDestroy()) + ReportD3DAppError(); + RELEASE(myglobs.scene); + RELEASE(myglobs.camera); + RELEASE(lpD3DRM); + myglobs.bQuit = TRUE; + PostQuitMessage( 0 ); +} + +/* + * ReportD3DAppError + * Reports an error during a d3d app call. + */ +void +ReportD3DAppError(void) +{ + Msg("%s", D3DAppLastErrorString()); +} + +/* Msg + * Message output for error notification. + */ +void __cdecl +Msg( LPSTR fmt, ... ) +{ + char buff[256]; + + wvsprintf(buff, fmt, (char *)(&fmt+1)); + lstrcat(buff, "\r\n"); + AppPause(TRUE); + if (d3dapp && d3dapp->bFullscreen) + SetWindowPos(myglobs.hWndMain, HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOSIZE | SWP_NOMOVE); + MessageBox( NULL, buff, "D3D Example Message", MB_OK ); + if (d3dapp && d3dapp->bFullscreen) + SetWindowPos(myglobs.hWndMain, HWND_TOPMOST, 0, 0, 0, 0, + SWP_NOSIZE | SWP_NOMOVE); + AppPause(FALSE); +} + +/* + * D3DRMErrorToString + * Allows the samples to return error strings. + */ +char* +D3DRMErrorToString(HRESULT error) +{ + return D3DAppErrorToString(error); +} diff --git a/sdk/samples/misc/rmfull.h b/sdk/samples/misc/rmfull.h new file mode 100644 index 0000000..737c2b4 --- /dev/null +++ b/sdk/samples/misc/rmfull.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rmfull.h + * + */ +#ifndef __RMFULL_H__ +#define __RMFULL_H__ + +#include <windows.h> +#include <windowsx.h> +#include <stdio.h> +#include <string.h> +#include <time.h> +#include <search.h> +#include <ddraw.h> +#include <d3d.h> +#include <direct.h> +#include <d3drmwin.h> +#include "d3dapp.h" /* prototypes for D3D helper functions */ +#include "rmdemo.h" /* prototypes for functions to commumicate + with each sample */ +#include "rmfullrc.h" /* defines constants used in rmfull.rc */ +#define START_WIN_SIZE 320 /* initial size of the window */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct tagrmfullglobals { + HWND hWndMain; /* application window handle */ + HINSTANCE hInstApp; /* application instance for dialog boxes */ + + LPDIRECT3DRMDEVICE dev; /* Direct3DRM device */ + LPDIRECT3DRMVIEWPORT view; /* Direct3DRM viewport through which we view + the scene */ + LPDIRECT3DRMFRAME scene; /* Master frame in which others are placed */ + LPDIRECT3DRMFRAME camera; /* Frame describing the users POV */ + + BOOL bSingleStepMode; /* render one frame at a time */ + BOOL bDrawAFrame; /* render on this pass of the main loop */ + BOOL bShowFrameRate; /* show the frame rate at the top */ + BOOL bShowInfo; /* show window information at the bottom */ + + BOOL bResized; /* the window has resized or some other drastic change, the + entire client area should be cleared */ + BOOL bQuit; /* program is about to terminate */ + + BOOL bNoTextures; /* this sample doesn't use any textures */ + BOOL bConstRenderQuality; /* this sample is not constructed with + MeshBuilders and so the RenderQuality + cannot be changed */ + D3DRMRENDERQUALITY RenderQuality; /* current shade mode, fill mode and + lighting state */ + D3DRMTEXTUREQUALITY TextureQuality; /* current texture interpolation */ + BOOL bDithering; /* is dithering on? */ + BOOL bAntialiasing; /* is antialiasing on? */ + + int mouse_buttons; /* mouse button state */ + int mouse_x; /* mouse cursor x position */ + int mouse_y; /* mouse cursor y position */ + + LPDIRECTDRAWSURFACE lpFrameRateBuffer; /* frame rate surface */ + LPDIRECTDRAWSURFACE lpInfoBuffer; /* window info surface */ +} rmfullglobals; + +void __cdecl Msg( LPSTR fmt, ... ); +/* + * STATS.CPP FUNCTION PROTOTYPES + */ +BOOL InitFontAndTextBuffers(void); +BOOL WriteInfoBuffer(void); +BOOL WriteFrameRateBuffer(float fps, long tps); +void ResetFrameRate(void); +BOOL CalculateFrameRate(); +BOOL DisplayFrameRate(int* count, LPD3DRECT lpExtents ); + +#ifdef __cplusplus +}; +#endif + +#endif // __RMFULL_H__ diff --git a/sdk/samples/misc/rmfull.rc b/sdk/samples/misc/rmfull.rc new file mode 100644 index 0000000..524c4f4 --- /dev/null +++ b/sdk/samples/misc/rmfull.rc @@ -0,0 +1,85 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rmfull.rc + * + */ + +#include "rmfullrc.h" +#include "windows.h" + +AppIcon ICON DISCARDABLE "d3d.ico" + +AppMenu MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&About..\tF1", MENU_ABOUT + MENUITEM SEPARATOR + MENUITEM "&Single Step\tSpc", MENU_STEP + MENUITEM "&Go\tEnter", MENU_GO + MENUITEM "&Toggle Stats\tTab", MENU_STATS + MENUITEM SEPARATOR + MENUITEM SEPARATOR + MENUITEM "E&xit\tESC", MENU_EXIT + END + POPUP "&Render" + BEGIN + MENUITEM "&Flat\tF2", MENU_FLAT + MENUITEM "&Gouraud\tF3", MENU_GOURAUD + MENUITEM "P&hong\tF4", MENU_PHONG + MENUITEM SEPARATOR + MENUITEM "L&ighting\tF5", MENU_LIGHTING + MENUITEM SEPARATOR + MENUITEM "&Point\tCtrl+P", MENU_POINT + MENUITEM "&Wireframe\tCtrl+W", MENU_WIREFRAME + MENUITEM "&Solid\tCtrl+S", MENU_SOLID + MENUITEM SEPARATOR + MENUITEM "&Dithering\tCtrl+D", MENU_DITHERING + MENUITEM "&Anti-aliasing\tCtrl+A", MENU_ANTIALIAS + MENUITEM SEPARATOR + MENUITEM "P&oint Filtering\tCtrl+O", MENU_POINT_FILTER + MENUITEM "Bi-&Linear Filtering\tCtrl+L",MENU_LINEAR_FILTER + END + POPUP "&Modes" + BEGIN + MENUITEM "&Fullscreen\tAlt+Enter", MENU_FULLSCREEN + MENUITEM "&Previous Mode\tAlt+PgUp", MENU_PREVIOUS_MODE + MENUITEM "&Next Mode\tAlt+PgDown", MENU_NEXT_MODE + MENUITEM SEPARATOR + END +END + + +AppAccel ACCELERATORS DISCARDABLE +BEGIN + VK_F1, MENU_ABOUT, VIRTKEY, NOINVERT + VK_F2, MENU_FLAT, VIRTKEY, NOINVERT + VK_F3, MENU_GOURAUD, VIRTKEY, NOINVERT + VK_F4, MENU_PHONG, VIRTKEY, NOINVERT + VK_F5, MENU_LIGHTING, VIRTKEY, NOINVERT + "P", MENU_POINT, VIRTKEY, CONTROL, NOINVERT + "W", MENU_WIREFRAME, VIRTKEY, CONTROL, NOINVERT + "S", MENU_SOLID, VIRTKEY, CONTROL, NOINVERT + "D", MENU_DITHERING, VIRTKEY, CONTROL, NOINVERT + "A", MENU_ANTIALIAS, VIRTKEY, CONTROL, NOINVERT + "O", MENU_POINT_FILTER, VIRTKEY, CONTROL, NOINVERT + "L", MENU_LINEAR_FILTER, VIRTKEY, CONTROL, NOINVERT + VK_ESCAPE, MENU_EXIT, VIRTKEY, NOINVERT + VK_SPACE, MENU_STEP, VIRTKEY, NOINVERT + VK_RETURN, MENU_GO, VIRTKEY, NOINVERT + VK_RETURN, MENU_FULLSCREEN, VIRTKEY, ALT, NOINVERT + VK_TAB, MENU_STATS, VIRTKEY, NOINVERT + VK_NEXT, MENU_NEXT_MODE, VIRTKEY, ALT, NOINVERT + VK_PRIOR, MENU_PREVIOUS_MODE, VIRTKEY, ALT, NOINVERT +END + +AppAbout DIALOG DISCARDABLE 0, 0, 188, 96 +STYLE DS_MODALFRAME | WS_POPUP +BEGIN + DEFPUSHBUTTON "OK",IDOK,76,75,35,14 + CTEXT "Direct3DRM Example",IDC_STATIC,61,5,65,15 + CTEXT "Copyright (c)1995, 1996 Microsoft Corp.",IDC_STATIC,21,55, + 145,12 + ICON "AppIcon",IDC_STATIC,86,25,16,16 +END diff --git a/sdk/samples/misc/rmfullrc.h b/sdk/samples/misc/rmfullrc.h new file mode 100644 index 0000000..1a48ee1 --- /dev/null +++ b/sdk/samples/misc/rmfullrc.h @@ -0,0 +1,31 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rmfullrc.h + * + ***************************************************************************/ + +#define MENU_ABOUT 1 +#define MENU_EXIT 2 +#define MENU_FULLSCREEN 7 +#define MENU_NEXT_MODE 8 +#define MENU_PREVIOUS_MODE 9 +#define MENU_STATS 10 +#define MENU_FLAT 12 +#define MENU_GOURAUD 13 +#define MENU_PHONG 14 +#define MENU_POINT_FILTER 17 +#define MENU_LINEAR_FILTER 18 +#define MENU_POINT 20 +#define MENU_WIREFRAME 21 +#define MENU_SOLID 22 +#define MENU_DITHERING 24 +#define MENU_ANTIALIAS 26 +#define MENU_STEP 27 +#define MENU_GO 28 +#define MENU_LIGHTING 29 +#define MENU_FIRST_DRIVER 80 +#define MENU_FIRST_MODE 100 + +#define IDC_STATIC -1 diff --git a/sdk/samples/misc/rmmain.cpp b/sdk/samples/misc/rmmain.cpp new file mode 100644 index 0000000..8393741 --- /dev/null +++ b/sdk/samples/misc/rmmain.cpp @@ -0,0 +1,999 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rmmain.cpp + * + * Each of the Direct3D retained mode (D3DRM) samples must be linked with + * this file. It contains the code which allows them to run in the Windows + * environment. + * + * A window is created using the rmmain.res which allows the user to select + * the Direct3D driver to use and change the render options. + * + * Individual samples are executed through two functions, BuildScene and + * OverrideDefaults, as described in rmdemo.h. Samples can also read + * mouse input via ReadMouse. + */ + +#define INITGUID + +#include <windows.h> +#include <stdio.h> +#include <string.h> +#include <malloc.h> +#include <math.h> +#include <direct.h> +#include <d3drmwin.h> +#include "rmdemo.h" /* prototypes for functions to commumicate + with each sample */ +#include "rmmain.h" /* defines constants used in rmmain.rc */ +#include "rmerror.h" /* prototypes for error reporting: error.c */ + +#define MAX_DRIVERS 5 /* maximum D3D drivers we ever expect to find */ + +/* + * GLOBAL VARIABLES + */ +LPDIRECT3DRM lpD3DRM; /* Direct3DRM object */ +LPDIRECTDRAWCLIPPER lpDDClipper;/* DirectDrawClipper object */ + +struct _myglobs { + LPDIRECT3DRMDEVICE dev; /* Direct3DRM device */ + LPDIRECT3DRMVIEWPORT view; /* Direct3DRM viewport through which we view + the scene */ + LPDIRECT3DRMFRAME scene; /* Master frame in which others are placed */ + LPDIRECT3DRMFRAME camera; /* Frame describing the users POV */ + + GUID DriverGUID[MAX_DRIVERS]; /* GUIDs of the available D3D drivers */ + char DriverName[MAX_DRIVERS][50]; /* names of the available D3D drivers */ + int NumDrivers; /* number of available D3D drivers */ + int CurrDriver; /* number of D3D driver currently + being used */ + + D3DRMRENDERQUALITY RenderQuality; /* current shade mode, fill mode and + lighting state */ + D3DRMTEXTUREQUALITY TextureQuality; /* current texture interpolation */ + BOOL bDithering; /* is dithering on? */ + BOOL bAntialiasing; /* is antialiasing on? */ + + BOOL bQuit; /* program is about to terminate */ + BOOL bInitialized; /* all D3DRM objects have been initialized */ + BOOL bMinimized; /* window is minimized */ + BOOL bSingleStepMode; /* render one frame at a time */ + BOOL bDrawAFrame; /* render on this pass of the main loop */ + BOOL bNoTextures; /* this sample doesn't use any textures */ + BOOL bConstRenderQuality; /* this sample is not constructed with + MeshBuilders and so the RenderQuality + cannot be changed */ + + int BPP; /* bit depth of the current display mode */ + + int mouse_buttons; /* mouse button state */ + int mouse_x; /* mouse cursor x position */ + int mouse_y; /* mouse cursor y position */ +} myglobs; + +/* + * PROTOTYPES + */ +static HWND InitApp(HINSTANCE, int); +static void InitGlobals(void); +long FAR PASCAL WindowProc(HWND, UINT, WPARAM, LPARAM); +static BOOL CreateDevAndView(LPDIRECTDRAWCLIPPER lpDDClipper, int driver, int width, int height); +static BOOL RenderLoop(void); +static void CleanUpAndPostQuit(void); +static BOOL SetRenderState(void); +static BOOL EnumDevices(HWND win); +extern "C" void ReadMouse(int*, int*, int*); + +/****************************************************************************/ +/* WinMain */ +/****************************************************************************/ +/* + * Initializes the application then enters a message loop which renders the + * scene until a quit message is received. + */ +int PASCAL +WinMain (HINSTANCE this_inst, HINSTANCE prev_inst, LPSTR cmdline, int cmdshow) +{ + HWND hwnd; + MSG msg; + HACCEL accel; + int failcount = 0; /* number of times RenderLoop has failed */ + + prev_inst; + cmdline; + + /* + * Create the window and initialize all objects needed to begin rendering + */ + if (!(hwnd = InitApp(this_inst, cmdshow))) + return 1; + + accel = LoadAccelerators(this_inst, "AppAccel"); + + while (!myglobs.bQuit) { + /* + * Monitor the message queue until there are no pressing + * messages + */ + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + if (msg.message == WM_QUIT) { + CleanUpAndPostQuit(); + break; + } + if (!TranslateAccelerator(msg.hwnd, accel, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + if (myglobs.bQuit) + break; + /* + * If the app is not minimized, not about to quit and D3DRM has + * been initialized, we can render + */ + if (!myglobs.bMinimized && !myglobs.bQuit && myglobs.bInitialized) { + /* + * If were are not in single step mode or if we are and the + * bDrawAFrame flag is set, render one frame + */ + if (!(myglobs.bSingleStepMode && !myglobs.bDrawAFrame)) { + /* + * Attempt to render a frame, if it fails, take a note. If + * rendering fails more than twice, abort execution. + */ + if (!RenderLoop()) + ++failcount; + if (failcount > 2) { + Msg("Rendering has failed too many times. Aborting execution.\n"); + CleanUpAndPostQuit(); + break; + } + } + /* + * Reset the bDrawAFrame flag if we are in single step mode + */ + if (myglobs.bSingleStepMode) + myglobs.bDrawAFrame = FALSE; + } else { + WaitMessage(); + } + } + DestroyWindow(hwnd); + return msg.wParam; +} + +/****************************************************************************/ +/* Initialization and object creation */ +/****************************************************************************/ +/* + * InitApp + * Creates window and initializes all objects neccessary to begin rendering + */ +static HWND +InitApp(HINSTANCE this_inst, int cmdshow) +{ + HWND win; + HDC hdc; + DWORD flags; + WNDCLASS wc; + Defaults defaults; + HRESULT rval; + RECT rc; + + /* + * set up and registers the window class + */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = sizeof(DWORD); + wc.hInstance = this_inst; + wc.hIcon = LoadIcon(this_inst, "AppIcon"); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + wc.lpszMenuName = "AppMenu"; + wc.lpszClassName = "D3DRM Example"; + if (!RegisterClass(&wc)) + return FALSE; + /* + * Initialize the global variables and allow the sample code to override + * some of these default settings. + */ + InitGlobals(); + defaults.bNoTextures = myglobs.bNoTextures; + defaults.bConstRenderQuality = myglobs.bConstRenderQuality; + defaults.bResizingDisabled = FALSE; + lstrcpy(defaults.Name, "D3DRM Example"); + OverrideDefaults(&defaults); + myglobs.bNoTextures = defaults.bNoTextures; + myglobs.bConstRenderQuality = defaults.bConstRenderQuality; + /* + * Create the window + */ + if (defaults.bResizingDisabled) + flags = WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | + WS_MINIMIZEBOX | WS_MAXIMIZEBOX; + else + flags = WS_OVERLAPPEDWINDOW; + win = + CreateWindow + ( "D3DRM Example", /* class */ + defaults.Name, /* caption */ + flags, /* style */ + CW_USEDEFAULT, /* init. x pos */ + CW_USEDEFAULT, /* init. y pos */ + 300, /* init. x size */ + 300, /* init. y size */ + NULL, /* parent window */ + NULL, /* menu handle */ + this_inst, /* program handle */ + NULL /* create parms */ + ); + if (!win) + return FALSE; + /* + * Record the current display BPP + */ + hdc = GetDC(win); + myglobs.BPP = GetDeviceCaps(hdc, BITSPIXEL); + ReleaseDC(win, hdc); + /* + * Enumerate the D3D drivers and select one + */ + if (!EnumDevices(win)) + return FALSE; + /* + * Create the D3DRM object and the D3DRM window object + */ + rval = Direct3DRMCreate(&lpD3DRM); + if (rval != D3DRM_OK) { + Msg("Failed to create Direct3DRM.\n%s", D3DRMErrorToString(rval)); + return FALSE; + } + /* + * Create the master scene frame and camera frame + */ + rval = lpD3DRM->CreateFrame(NULL, &myglobs.scene); + if (rval != D3DRM_OK) { + Msg("Failed to create the master scene frame.\n%s", D3DRMErrorToString(rval)); + return FALSE; + } + rval = lpD3DRM->CreateFrame(myglobs.scene, &myglobs.camera); + if (rval != D3DRM_OK) { + Msg("Failed to create the camera's frame.\n%s", D3DRMErrorToString(rval)); + return FALSE; + } + rval = myglobs.camera->SetPosition(myglobs.scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)); + if (rval != D3DRM_OK) { + Msg("Failed to position the camera in the frame.\n%s", D3DRMErrorToString(rval)); + return FALSE; + } + /* + * Create a clipper and associate the window with it + */ + rval = DirectDrawCreateClipper(0, &lpDDClipper, NULL); + if (rval != DD_OK) { + Msg("Failed to create DirectDrawClipper"); + return FALSE; + } + rval = lpDDClipper->SetHWnd(0, win); + if (rval != DD_OK) { + Msg("Failed to set hwnd on the clipper"); + return FALSE; + } + /* + * Created the D3DRM device with the selected D3D driver + */ + GetClientRect(win, &rc); + if (!CreateDevAndView(lpDDClipper, myglobs.CurrDriver, rc.right, rc.bottom)) { + return FALSE; + } + /* + * Create the scene to be rendered by calling this sample's BuildScene + */ + if (!BuildScene(myglobs.dev, myglobs.view, myglobs.scene, myglobs.camera)) + return FALSE; + /* + * Now we are ready to render + */ + myglobs.bInitialized = TRUE; + /* + * Display the window + */ + ShowWindow(win, cmdshow); + UpdateWindow(win); + + return win; +} + +/* + * CreateDevAndView + * Create the D3DRM device and viewport with the given D3D driver and of the + * specified size. + */ +static BOOL +CreateDevAndView(LPDIRECTDRAWCLIPPER lpDDClipper, int driver, int width, int height) +{ + HRESULT rval; + + if (!width || !height) { + Msg("Cannot create a D3DRM device with invalid window dimensions."); + return FALSE; + } + /* + * Create the D3DRM device from this window and using the specified D3D + * driver. + */ + rval = lpD3DRM->CreateDeviceFromClipper(lpDDClipper, &myglobs.DriverGUID[driver], + width, height, &myglobs.dev); + if (rval != D3DRM_OK) { + Msg("Failed to create the D3DRM device from the clipper.\n%s", + D3DRMErrorToString(rval)); + return FALSE; + } + /* + * Create the D3DRM viewport using the camera frame. Set the background + * depth to a large number. The width and height may be slightly + * adjusted, so get them from the device to be sure. + */ + width = myglobs.dev->GetWidth(); + height = myglobs.dev->GetHeight(); + rval = lpD3DRM->CreateViewport(myglobs.dev, myglobs.camera, 0, 0, width, + height, &myglobs.view); + if (rval != D3DRM_OK) { + Msg("Failed to create the D3DRM viewport.\n%s", + D3DRMErrorToString(rval)); + RELEASE(myglobs.dev); + return FALSE; + } + rval = myglobs.view->SetBack(D3DVAL(5000.0)); + if (rval != D3DRM_OK) { + Msg("Failed to set the background depth of the D3DRM viewport.\n%s", + D3DRMErrorToString(rval)); + RELEASE(myglobs.dev); + RELEASE(myglobs.view); + return FALSE; + } + /* + * Set the render quality, fill mode, lighting state and color shade info + */ + if (!SetRenderState()) + return FALSE; + return TRUE; +} + +/****************************************************************************/ +/* D3D Device Enumeration */ +/****************************************************************************/ +/* + * BPPToDDBD + * Converts bits per pixel to a DirectDraw bit depth flag + */ +static DWORD +BPPToDDBD(int bpp) +{ + switch(bpp) { + case 1: + return DDBD_1; + case 2: + return DDBD_2; + case 4: + return DDBD_4; + case 8: + return DDBD_8; + case 16: + return DDBD_16; + case 24: + return DDBD_24; + case 32: + return DDBD_32; + default: + return 0; + } +} + +/* + * enumDeviceFunc + * Callback function which records each usable D3D driver's name and GUID + * Chooses a driver to begin with and sets *lpContext to this starting driver + */ +static HRESULT +WINAPI enumDeviceFunc(LPGUID lpGuid, LPSTR lpDeviceDescription, LPSTR lpDeviceName, + LPD3DDEVICEDESC lpHWDesc, LPD3DDEVICEDESC lpHELDesc, LPVOID lpContext) +{ + static BOOL hardware = FALSE; /* current start driver is hardware */ + static BOOL mono = FALSE; /* current start driver is mono light */ + LPD3DDEVICEDESC lpDesc; + int *lpStartDriver = (int *)lpContext; + /* + * Decide which device description we should consult + */ + lpDesc = lpHWDesc->dcmColorModel ? lpHWDesc : lpHELDesc; + /* + * If this driver cannot render in the current display bit depth skip + * it and continue with the enumeration. + */ + if (!(lpDesc->dwDeviceRenderBitDepth & BPPToDDBD(myglobs.BPP))) + return D3DENUMRET_OK; + /* + * Record this driver's info + */ + memcpy(&myglobs.DriverGUID[myglobs.NumDrivers], lpGuid, sizeof(GUID)); + lstrcpy(&myglobs.DriverName[myglobs.NumDrivers][0], lpDeviceName); + /* + * Choose hardware over software, RGB lights over mono lights + */ + if (*lpStartDriver == -1) { + /* + * this is the first valid driver + */ + *lpStartDriver = myglobs.NumDrivers; + hardware = lpDesc == lpHWDesc ? TRUE : FALSE; + mono = lpDesc->dcmColorModel & D3DCOLOR_MONO ? TRUE : FALSE; + } else if (lpDesc == lpHWDesc && !hardware) { + /* + * this driver is hardware and start driver is not + */ + *lpStartDriver = myglobs.NumDrivers; + hardware = lpDesc == lpHWDesc ? TRUE : FALSE; + mono = lpDesc->dcmColorModel & D3DCOLOR_MONO ? TRUE : FALSE; + } else if ((lpDesc == lpHWDesc && hardware ) || (lpDesc == lpHELDesc + && !hardware)) { + if (lpDesc->dcmColorModel == D3DCOLOR_MONO && !mono) { + /* + * this driver and start driver are the same type and this + * driver is mono while start driver is not + */ + *lpStartDriver = myglobs.NumDrivers; + hardware = lpDesc == lpHWDesc ? TRUE : FALSE; + mono = lpDesc->dcmColorModel & D3DCOLOR_MONO ? TRUE : FALSE; + } + } + myglobs.NumDrivers++; + if (myglobs.NumDrivers == MAX_DRIVERS) + return (D3DENUMRET_CANCEL); + return (D3DENUMRET_OK); +} + +/* + * EnumDevices + * Enumerate the available D3D drivers, add them to the file menu, and choose + * one to use. + */ +static BOOL +EnumDevices(HWND win) +{ + LPDIRECTDRAW lpDD; + LPDIRECT3D lpD3D; + HRESULT rval; + HMENU hmenu; + int i; + + /* + * Create a DirectDraw object and query for the Direct3D interface to use + * to enumerate the drivers. + */ + rval = DirectDrawCreate(NULL, &lpDD, NULL); + if (rval != DD_OK) { + Msg("Creation of DirectDraw HEL failed.\n%s", D3DRMErrorToString(rval)); + return FALSE; + } + rval = lpDD->QueryInterface(IID_IDirect3D, (void**) &lpD3D); + if (rval != DD_OK) { + Msg("Creation of Direct3D interface failed.\n%s", D3DRMErrorToString(rval)); + lpDD->Release(); + return FALSE; + } + /* + * Enumerate the drivers, setting CurrDriver to -1 to initialize the + * driver selection code in enumDeviceFunc + */ + myglobs.CurrDriver = -1; + rval = lpD3D->EnumDevices(enumDeviceFunc, &myglobs.CurrDriver); + if (rval != DD_OK) { + Msg("Enumeration of drivers failed.\n%s", D3DRMErrorToString(rval)); + return FALSE; + } + /* + * Make sure we found at least one valid driver + */ + if (myglobs.NumDrivers == 0) { + Msg("Could not find a D3D driver which is compatible with this display depth"); + return FALSE; + } + lpD3D->Release(); + lpDD->Release(); + /* + * Add the driver names to the File menu + */ + hmenu = GetSubMenu(GetMenu(win), 0); + for (i = 0; i < myglobs.NumDrivers; i++) { + InsertMenu(hmenu, 5 + i, MF_BYPOSITION | MF_STRING, MENU_FIRST_DRIVER + i, + myglobs.DriverName[i]); + } + return TRUE; +} + +/****************************************************************************/ +/* Render Loop */ +/****************************************************************************/ +/* + * Clear the viewport, render the next frame and update the window + */ +static BOOL +RenderLoop() +{ + HRESULT rval; + /* + * Tick the scene + */ + rval = myglobs.scene->Move(D3DVAL(1.0)); + if (rval != D3DRM_OK) { + Msg("Moving scene failed.\n%s", D3DRMErrorToString(rval)); + return FALSE; + } + /* + * Clear the viewport + */ + rval = myglobs.view->Clear(); + if (rval != D3DRM_OK) { + Msg("Clearing viewport failed.\n%s", D3DRMErrorToString(rval)); + return FALSE; + } + /* + * Render the scene to the viewport + */ + rval = myglobs.view->Render(myglobs.scene); + if (rval != D3DRM_OK) { + Msg("Rendering scene failed.\n%s", D3DRMErrorToString(rval)); + return FALSE; + } + /* + * Update the window + */ + rval = myglobs.dev->Update(); + if (rval != D3DRM_OK) { + Msg("Updating device failed.\n%s", D3DRMErrorToString(rval)); + return FALSE; + } + return TRUE; +} + + +/****************************************************************************/ +/* Windows Message Handlers */ +/****************************************************************************/ +/* + * AppAbout + * About box message handler + */ +BOOL +FAR PASCAL AppAbout(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lParam) +{ + switch (msg) + { + case WM_COMMAND: + if (LOWORD(wparam) == IDOK) + EndDialog(hwnd, TRUE); + break; + + case WM_INITDIALOG: + return TRUE; + } + return FALSE; +} + +/* + * WindowProc + * Main window message handler + */ +LONG FAR PASCAL WindowProc(HWND win, UINT msg, WPARAM wparam, LPARAM lparam) +{ + int i; + HRESULT rval; + RECT rc; + + switch (msg) { + case WM_LBUTTONDOWN: + case WM_LBUTTONUP: + case WM_RBUTTONDOWN: + case WM_RBUTTONUP: + case WM_MOUSEMOVE: + /* + * Record the mouse state for ReadMouse + */ + myglobs.mouse_buttons = wparam; + myglobs.mouse_x = LOWORD(lparam); + myglobs.mouse_y = HIWORD(lparam); + break; + case WM_INITMENUPOPUP: + /* + * Check and enable the appropriate menu items + */ + CheckMenuItem((HMENU)wparam, MENU_STEP,(myglobs.bSingleStepMode) ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wparam, MENU_GO,(myglobs.bSingleStepMode) ? MF_ENABLED : MF_GRAYED); + if (!myglobs.bConstRenderQuality) { + CheckMenuItem((HMENU)wparam, MENU_LIGHTING, (myglobs.RenderQuality & D3DRMLIGHT_MASK) == D3DRMLIGHT_ON ? MF_CHECKED : MF_GRAYED); + CheckMenuItem((HMENU)wparam, MENU_FLAT, (myglobs.RenderQuality & D3DRMSHADE_MASK) == D3DRMSHADE_FLAT ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wparam, MENU_GOURAUD, (myglobs.RenderQuality & D3DRMSHADE_MASK) == D3DRMSHADE_GOURAUD ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wparam, MENU_PHONG, (myglobs.RenderQuality & D3DRMSHADE_MASK) == D3DRMSHADE_PHONG ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wparam, MENU_PHONG, MF_GRAYED); + CheckMenuItem((HMENU)wparam, MENU_POINT, (myglobs.RenderQuality & D3DRMFILL_MASK) == D3DRMFILL_POINTS ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wparam, MENU_WIREFRAME, (myglobs.RenderQuality & D3DRMFILL_MASK) == D3DRMFILL_WIREFRAME ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wparam, MENU_SOLID, (myglobs.RenderQuality & D3DRMFILL_MASK) == D3DRMFILL_SOLID ? MF_CHECKED : MF_UNCHECKED); + } else { + EnableMenuItem((HMENU)wparam, MENU_LIGHTING, MF_GRAYED); + EnableMenuItem((HMENU)wparam, MENU_FLAT, MF_GRAYED); + EnableMenuItem((HMENU)wparam, MENU_GOURAUD, MF_GRAYED); + EnableMenuItem((HMENU)wparam, MENU_PHONG, MF_GRAYED); + EnableMenuItem((HMENU)wparam, MENU_POINT, MF_GRAYED); + EnableMenuItem((HMENU)wparam, MENU_WIREFRAME, MF_GRAYED); + EnableMenuItem((HMENU)wparam, MENU_SOLID, MF_GRAYED); + } + if (!myglobs.bNoTextures) { + CheckMenuItem((HMENU)wparam, MENU_POINT_FILTER, (myglobs.TextureQuality == D3DRMTEXTURE_NEAREST) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wparam, MENU_LINEAR_FILTER, (myglobs.TextureQuality == D3DRMTEXTURE_LINEAR) ? MF_CHECKED : MF_UNCHECKED); + } else { + EnableMenuItem((HMENU)wparam, MENU_POINT_FILTER, MF_GRAYED); + EnableMenuItem((HMENU)wparam, MENU_LINEAR_FILTER, MF_GRAYED); + } + CheckMenuItem((HMENU)wparam, MENU_DITHERING, (myglobs.bDithering) ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem((HMENU)wparam, MENU_ANTIALIAS, (myglobs.bAntialiasing) ? MF_CHECKED : MF_UNCHECKED); + EnableMenuItem((HMENU)wparam, MENU_ANTIALIAS, MF_GRAYED); + for (i = 0; i < myglobs.NumDrivers; i++) { + CheckMenuItem((HMENU)wparam, MENU_FIRST_DRIVER + i, + (i == myglobs.CurrDriver) ? MF_CHECKED : MF_UNCHECKED); + } + break; + case WM_COMMAND: + switch(LOWORD(wparam)) { + case MENU_ABOUT: + DialogBox((HINSTANCE)GetWindowLong(win, GWL_HINSTANCE), + "AppAbout", win, (DLGPROC)AppAbout); + break; + case MENU_EXIT: + CleanUpAndPostQuit(); + break; + case MENU_STEP: + /* + * Begin single step more or draw a frame if in single + * step mode + */ + if (!myglobs.bSingleStepMode) { + myglobs.bSingleStepMode = TRUE; + myglobs.bDrawAFrame = TRUE; + } else if (!myglobs.bDrawAFrame) { + myglobs.bDrawAFrame = TRUE; + } + break; + case MENU_GO: + /* + * Exit single step mode + */ + myglobs.bSingleStepMode = FALSE; + break; + /* + * Lighting toggle + */ + case MENU_LIGHTING: + myglobs.RenderQuality ^= D3DRMLIGHT_ON; + SetRenderState(); + break; + /* + * Fill mode selection + */ + case MENU_POINT: + myglobs.RenderQuality = (myglobs.RenderQuality & ~D3DRMFILL_MASK) | D3DRMFILL_POINTS; + SetRenderState(); + break; + case MENU_WIREFRAME: + myglobs.RenderQuality = (myglobs.RenderQuality & ~D3DRMFILL_MASK) | D3DRMFILL_WIREFRAME; + SetRenderState(); + break; + case MENU_SOLID: + myglobs.RenderQuality = (myglobs.RenderQuality & ~D3DRMFILL_MASK) | D3DRMFILL_SOLID; + SetRenderState(); + break; + /* + * Shade mode selection + */ + case MENU_FLAT: + myglobs.RenderQuality = (myglobs.RenderQuality & ~D3DRMSHADE_MASK) | D3DRMSHADE_FLAT; + SetRenderState(); + break; + case MENU_GOURAUD: + myglobs.RenderQuality = (myglobs.RenderQuality & ~D3DRMSHADE_MASK) | D3DRMSHADE_GOURAUD; + SetRenderState(); + break; + case MENU_PHONG: + myglobs.RenderQuality = (myglobs.RenderQuality & ~D3DRMSHADE_MASK) | D3DRMSHADE_PHONG; + SetRenderState(); + break; + + case MENU_DITHERING: + myglobs.bDithering = !myglobs.bDithering; + SetRenderState(); + break; + case MENU_ANTIALIAS: + myglobs.bAntialiasing = !myglobs.bAntialiasing; + break; + /* + * Texture filter selection + */ + case MENU_POINT_FILTER: + if (myglobs.TextureQuality == D3DRMTEXTURE_NEAREST) + break; + myglobs.TextureQuality = D3DRMTEXTURE_NEAREST; + SetRenderState(); + break; + case MENU_LINEAR_FILTER: + if (myglobs.TextureQuality == D3DRMTEXTURE_LINEAR) + break; + myglobs.TextureQuality = D3DRMTEXTURE_LINEAR; + SetRenderState(); + break; + } + /* + * Changing the D3D Driver + */ + if (LOWORD(wparam) >= MENU_FIRST_DRIVER && + LOWORD(wparam) < MENU_FIRST_DRIVER + MAX_DRIVERS && + myglobs.CurrDriver != LOWORD(wparam) - MENU_FIRST_DRIVER){ + /* + * Release the current viewport and device and create + * the new one + */ + RELEASE(myglobs.view); + RELEASE(myglobs.dev); + myglobs.CurrDriver = LOWORD(wparam)-MENU_FIRST_DRIVER; + GetClientRect(win, &rc); + if (!CreateDevAndView(lpDDClipper, myglobs.CurrDriver, + rc.right, rc.bottom)) { + CleanUpAndPostQuit(); + } + } + /* + * Draw a frame in single step mode after ever command + */ + myglobs.bDrawAFrame = TRUE; + break; + case WM_DESTROY: + CleanUpAndPostQuit(); + break; + case WM_SIZE: + /* + * Handle resizing of the window + */ + { + int width = LOWORD(lparam); + int height = HIWORD(lparam); + if (width && height) { + int view_width = myglobs.view->GetWidth(); + int view_height = myglobs.view->GetHeight(); + int dev_width = myglobs.dev->GetWidth(); + int dev_height = myglobs.dev->GetHeight(); + /* + * If the window hasn't changed size and we aren't returning from + * a minimize, there is nothing to do + */ + if (view_width == width && view_height == height && + !myglobs.bMinimized) + break; + if (width <= dev_width && height <= dev_height) { + /* + * If the window has shrunk, we can use the same device with a + * new viewport + */ + RELEASE(myglobs.view); + rval = lpD3DRM->CreateViewport(myglobs.dev, myglobs.camera, + 0, 0, width, height, + &myglobs.view); + if (rval != D3DRM_OK) { + Msg("Failed to resize the viewport.\n%s", + D3DRMErrorToString(rval)); + CleanUpAndPostQuit(); + break; + } + rval = myglobs.view->SetBack(D3DVAL(5000.0)); + if (rval != D3DRM_OK) { + Msg("Failed to set background depth after viewport resize.\n%s", + D3DRMErrorToString(rval)); + CleanUpAndPostQuit(); + break; + } + } else { + /* + * If the window got larger than the current device, create a + * new device. + */ + RELEASE(myglobs.view); + RELEASE(myglobs.dev); + if (!CreateDevAndView(lpDDClipper, myglobs.CurrDriver, width, + height)) { + CleanUpAndPostQuit(); + break; + } + } + /* + * We must not longer be minimized + */ + myglobs.bMinimized = FALSE; + } else { + /* + * This is a minimize message + */ + myglobs.bMinimized = TRUE; + } + } + break; + case WM_ACTIVATE: + { + /* + * Create a Windows specific D3DRM window device to handle this + * message + */ + LPDIRECT3DRMWINDEVICE windev; + if (!myglobs.dev) + break; + if (SUCCEEDED(myglobs.dev->QueryInterface(IID_IDirect3DRMWinDevice, + (void **) &windev))) { + if (FAILED(windev->HandleActivate(wparam))) + Msg("Failed to handle WM_ACTIVATE.\n"); + windev->Release(); + } else { + Msg("Failed to create Windows device to handle WM_ACTIVATE.\n"); + } + } + break; + case WM_PAINT: + if (!myglobs.bInitialized || !myglobs.dev) + return DefWindowProc(win, msg, wparam, lparam); + /* + * Create a Windows specific D3DRM window device to handle this + * message + */ + RECT r; + PAINTSTRUCT ps; + LPDIRECT3DRMWINDEVICE windev; + + if (GetUpdateRect(win, &r, FALSE)) { + BeginPaint(win, &ps); + if (SUCCEEDED(myglobs.dev->QueryInterface(IID_IDirect3DRMWinDevice, + (void **) &windev))) { + if (FAILED(windev->HandlePaint(ps.hdc))) + Msg("Failed to handle WM_PAINT.\n"); + windev->Release(); + } else { + Msg("Failed to create Windows device to handle WM_PAINT.\n"); + } + EndPaint(win, &ps); + } + break; + default: + return DefWindowProc(win, msg, wparam, lparam); + } + return 0L; +} + +/* + * SetRenderState + * Set the render quality, dither toggle and shade info if any of them has + * changed + */ +BOOL +SetRenderState(void) +{ + HRESULT rval; + /* + * Set the render quality (light toggle, fill mode, shade mode) + */ + if (myglobs.dev->GetQuality() != myglobs.RenderQuality) { + rval = myglobs.dev->SetQuality(myglobs.RenderQuality); + if (rval != D3DRM_OK) { + Msg("Setting the render quality failed.\n%s", + D3DRMErrorToString(rval)); + return FALSE; + } + } + /* + * Set dithering toggle + */ + if (myglobs.dev->GetDither() != myglobs.bDithering) { + rval = myglobs.dev->SetDither(myglobs.bDithering); + if (rval != D3DRM_OK) { + Msg("Setting dither mode failed.\n%s", D3DRMErrorToString(rval)); + return FALSE; + } + } + /* + * Set the texture quality (point or linear filtering) + */ + if (myglobs.dev->GetTextureQuality() != myglobs.TextureQuality) { + rval = myglobs.dev->SetTextureQuality(myglobs.TextureQuality); + if (rval != D3DRM_OK) { + Msg("Setting texture quality failed.\n%s", + D3DRMErrorToString(rval)); + return FALSE; + } + } + /* + * Set shade info based on current bits per pixel + */ + switch (myglobs.BPP) { + case 1: + if (FAILED(myglobs.dev->SetShades(4))) + goto shades_error; + if (FAILED(lpD3DRM->SetDefaultTextureShades(4))) + goto shades_error; + break; + case 16: + if (FAILED(myglobs.dev->SetShades(32))) + goto shades_error; + if (FAILED(lpD3DRM->SetDefaultTextureColors(64))) + goto shades_error; + if (FAILED(lpD3DRM->SetDefaultTextureShades(32))) + goto shades_error; + break; + case 24: + case 32: + if (FAILED(myglobs.dev->SetShades(256))) + goto shades_error; + if (FAILED(lpD3DRM->SetDefaultTextureColors(64))) + goto shades_error; + if (FAILED(lpD3DRM->SetDefaultTextureShades(256))) + goto shades_error; + break; + } + return TRUE; +shades_error: + Msg("A failure occurred while setting color shade information.\n"); + return FALSE; +} + +/****************************************************************************/ +/* Additional Functions */ +/****************************************************************************/ +/* + * ReadMouse + * Returns the mouse status for interaction with sample code + */ +void +ReadMouse(int* b, int* x, int* y) +{ + *b = myglobs.mouse_buttons; + *x = myglobs.mouse_x; + *y = myglobs.mouse_y; +} + +/* + * InitGlobals + * Initialize the global variables + */ +void +InitGlobals(void) +{ + lpD3DRM = NULL; + memset(&myglobs, 0, sizeof(myglobs)); + myglobs.RenderQuality = D3DRMLIGHT_ON | D3DRMFILL_SOLID | + D3DRMSHADE_GOURAUD; + myglobs.TextureQuality = D3DRMTEXTURE_NEAREST; +} + +/* + * CleanUpAndPostQuit + * Release all D3DRM objects, post a quit message and set the bQuit flag + */ +void +CleanUpAndPostQuit(void) +{ + myglobs.bInitialized = FALSE; + RELEASE(myglobs.scene); + RELEASE(myglobs.camera); + RELEASE(myglobs.view); + RELEASE(myglobs.dev); + RELEASE(lpD3DRM); + RELEASE(lpDDClipper); + myglobs.bQuit = TRUE; +} diff --git a/sdk/samples/misc/rmmain.h b/sdk/samples/misc/rmmain.h new file mode 100644 index 0000000..9d90999 --- /dev/null +++ b/sdk/samples/misc/rmmain.h @@ -0,0 +1,26 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: resource.h + * + ***************************************************************************/ + +#define MENU_ABOUT 1 +#define MENU_EXIT 2 +#define MENU_STEP 27 +#define MENU_GO 28 +#define MENU_FLAT 12 +#define MENU_GOURAUD 13 +#define MENU_PHONG 14 +#define MENU_POINT_FILTER 17 +#define MENU_LINEAR_FILTER 18 +#define MENU_POINT 20 +#define MENU_WIREFRAME 21 +#define MENU_SOLID 22 +#define MENU_DITHERING 24 +#define MENU_ANTIALIAS 26 +#define MENU_LIGHTING 29 +#define MENU_FIRST_DRIVER 80 + +#define IDC_STATIC -1 diff --git a/sdk/samples/misc/rmmain.rc b/sdk/samples/misc/rmmain.rc new file mode 100644 index 0000000..fafa1be --- /dev/null +++ b/sdk/samples/misc/rmmain.rc @@ -0,0 +1,74 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rmmain.rc + * + */ + +#include "rmmain.h" +#include "windows.h" + +AppIcon ICON DISCARDABLE "d3d.ico" + +AppMenu MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&About..\tF1", MENU_ABOUT + MENUITEM SEPARATOR + MENUITEM "&Single Step\tSpc", MENU_STEP + MENUITEM "&Go\tEnter", MENU_GO + MENUITEM SEPARATOR + MENUITEM SEPARATOR + MENUITEM "E&xit\tESC", MENU_EXIT + END + POPUP "&Render" + BEGIN + MENUITEM "&Flat\tF2", MENU_FLAT + MENUITEM "&Gouraud\tF3", MENU_GOURAUD + MENUITEM "P&hong\tF4", MENU_PHONG + MENUITEM SEPARATOR + MENUITEM "L&ighting\tF5", MENU_LIGHTING + MENUITEM SEPARATOR + MENUITEM "&Point\tCtrl+P", MENU_POINT + MENUITEM "&Wireframe\tCtrl+W", MENU_WIREFRAME + MENUITEM "&Solid\tCtrl+S", MENU_SOLID + MENUITEM SEPARATOR + MENUITEM "&Dithering\tCtrl+D", MENU_DITHERING + MENUITEM "&Anti-aliasing\tCtrl+A", MENU_ANTIALIAS + MENUITEM SEPARATOR + MENUITEM "P&oint Filtering\tCtrl+O", MENU_POINT_FILTER + MENUITEM "Bi-&Linear Filtering\tCtrl+L",MENU_LINEAR_FILTER + END +END + + +AppAccel ACCELERATORS DISCARDABLE +BEGIN + VK_F1, MENU_ABOUT, VIRTKEY, NOINVERT + VK_F2, MENU_FLAT, VIRTKEY, NOINVERT + VK_F3, MENU_GOURAUD, VIRTKEY, NOINVERT + VK_F4, MENU_PHONG, VIRTKEY, NOINVERT + VK_F5, MENU_LIGHTING, VIRTKEY, NOINVERT + "P", MENU_POINT, VIRTKEY, CONTROL, NOINVERT + "W", MENU_WIREFRAME, VIRTKEY, CONTROL, NOINVERT + "S", MENU_SOLID, VIRTKEY, CONTROL, NOINVERT + "D", MENU_DITHERING, VIRTKEY, CONTROL, NOINVERT + "A", MENU_ANTIALIAS, VIRTKEY, CONTROL, NOINVERT + "O", MENU_POINT_FILTER, VIRTKEY, CONTROL, NOINVERT + "L", MENU_LINEAR_FILTER, VIRTKEY, CONTROL, NOINVERT + VK_ESCAPE, MENU_EXIT, VIRTKEY, NOINVERT + VK_SPACE, MENU_STEP, VIRTKEY, NOINVERT + VK_RETURN, MENU_GO, VIRTKEY, NOINVERT +END + +APPABOUT DIALOG DISCARDABLE 0, 0, 188, 96 +STYLE DS_MODALFRAME | WS_POPUP +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,76,75,35,14 + CTEXT "Direct3D RM Example",IDC_STATIC,61,5,65,15 + CTEXT "Copyright (c) 1995, 1996 Microsoft Corp.",IDC_STATIC,21,55, + 145,12 + ICON "AppIcon",IDC_STATIC,86,25,18,20 +END diff --git a/sdk/samples/misc/rmstats.cpp b/sdk/samples/misc/rmstats.cpp new file mode 100644 index 0000000..a5be07a --- /dev/null +++ b/sdk/samples/misc/rmstats.cpp @@ -0,0 +1,306 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rmstats.cpp + * + ***************************************************************************/ +#include "rmfull.h" + +/* + * GLOBAL VARIABLES + */ +extern D3DAppInfo* d3dapp; /* Pointer to read only collection of DD and D3D + objects maintained by D3DApp */ +extern rmfullglobals myglobs; /* collection of global variables */ + +static struct { + HFONT hFont; + SIZE szFrameRate; + SIZE szInfo; +} statglobs; + + /************************************************************************ + Frame rate and info text + ************************************************************************/ + +BOOL +WriteFrameRateBuffer(float fps, long tps) +{ + HRESULT LastError; + HDC hdc; + RECT rc; + char buf1[30], buf2[30], buf[60]; + int len; + + if (!myglobs.lpFrameRateBuffer) + return TRUE; + if (fps > 0.0f) + wsprintf(buf1, "%d.%02d fps ", + (int)( fps * 100 ) / 100, + (int)( fps * 100 ) % 100); + else + buf1[0] = 0; + if (tps > 0) + wsprintf(buf2, "%ld tps ", tps); + else + buf2[0] = 0; + len = wsprintf(buf, "%s%s", buf1, buf2); + if (!myglobs.lpFrameRateBuffer) + return FALSE; + LastError = myglobs.lpFrameRateBuffer->GetDC(&hdc); + if (LastError != DD_OK) { + /* + * This is not vital, don't report an error. + */ + return TRUE; + } + SelectObject(hdc, statglobs.hFont); + SetTextColor(hdc, RGB(255,255,0)); + SetBkColor(hdc, RGB(0,0,0)); + SetBkMode(hdc, OPAQUE); + GetTextExtentPoint32(hdc, buf, len, &statglobs.szFrameRate); + SetRect(&rc, 0, 0, statglobs.szFrameRate.cx, statglobs.szFrameRate.cy); + ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, buf, len, NULL); + myglobs.lpFrameRateBuffer->ReleaseDC(hdc); + return TRUE; +} + +BOOL +WriteInfoBuffer(void) +{ + HRESULT LastError; + HDC hdc; + RECT rc; + char buf[40]; + int len; + + if (!myglobs.lpInfoBuffer) + return TRUE; + if (d3dapp->bFullscreen) + len = wsprintf(buf, "%dx%dx%d (%s)", d3dapp->ThisMode.w, d3dapp->ThisMode.h, d3dapp->ThisMode.bpp, + (d3dapp->ThisDriver.Desc.dcmColorModel == D3DCOLOR_MONO) ? "MONO" : "RGB"); + else + len = wsprintf(buf, "%dx%d (%s)", d3dapp->szClient.cx, d3dapp->szClient.cy, + (d3dapp->ThisDriver.Desc.dcmColorModel == D3DCOLOR_MONO) ? "MONO" : "RGB"); + if (!myglobs.lpInfoBuffer) + return FALSE; + LastError = myglobs.lpInfoBuffer->GetDC(&hdc); + if (LastError != DD_OK) { + /* + * This is not vital, don't report an error. + */ + return TRUE; + } + + SelectObject(hdc, statglobs.hFont); + SetTextColor(hdc, RGB(255,255,0)); + SetBkColor(hdc, RGB(0,0,0)); + SetBkMode(hdc, OPAQUE); + GetTextExtentPoint32(hdc, buf, len, &statglobs.szInfo); + SetRect(&rc, 0, 0, statglobs.szInfo.cx, statglobs.szInfo.cy); + ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, buf, len, NULL); + myglobs.lpInfoBuffer->ReleaseDC(hdc); + return TRUE; +} + + +BOOL +InitFontAndTextBuffers(void) +{ + DDCOLORKEY ddck; + DDSURFACEDESC ddsd; + HDC hdc; + HRESULT ddrval; + char dummyinfo[] = "000x000x00 (MONO) 0000"; + char dummyfps[] = "000.00 fps 00000000.00 tps 0000.00 mppps"; + + /* + * Create the font. + */ + RELEASE(myglobs.lpInfoBuffer); + RELEASE(myglobs.lpFrameRateBuffer); + if (statglobs.hFont != NULL) { + DeleteObject(statglobs.hFont); + } + statglobs.hFont = CreateFont( + d3dapp->szClient.cx <= 600 ? 12 : 24, + 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, + ANSI_CHARSET, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, + VARIABLE_PITCH, + "Arial" ); + + hdc = GetDC(NULL); + SelectObject(hdc, statglobs.hFont); + GetTextExtentPoint(hdc, dummyfps, strlen(dummyfps), &statglobs.szFrameRate); + GetTextExtentPoint(hdc, dummyinfo, strlen(dummyinfo), &statglobs.szInfo); + ReleaseDC(NULL, hdc); + + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.dwHeight = statglobs.szFrameRate.cy; + ddsd.dwWidth = statglobs.szFrameRate.cx; + ddrval = D3DAppCreateSurface(&ddsd, &myglobs.lpFrameRateBuffer); + if (ddrval != DD_OK) { + Msg("Could not create frame rate buffer.\n%s", D3DAppErrorToString(ddrval)); + goto exit_with_error; + } + memset(&ddck, 0, sizeof(ddck)); + myglobs.lpFrameRateBuffer->SetColorKey(DDCKEY_SRCBLT, &ddck); + if (!WriteFrameRateBuffer(0.0f, 0)) { + goto exit_with_error; + } + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.dwHeight = statglobs.szInfo.cy; + ddsd.dwWidth = statglobs.szInfo.cx; + ddrval = D3DAppCreateSurface(&ddsd, &myglobs.lpInfoBuffer); + if (ddrval != DD_OK) { + Msg("Could not create info buffer.\n%s", D3DAppErrorToString(ddrval)); + goto exit_with_error; + } + memset(&ddck, 0, sizeof(ddck)); + myglobs.lpInfoBuffer->SetColorKey(DDCKEY_SRCBLT, &ddck); + if (!WriteInfoBuffer()) + goto exit_with_error; + return TRUE; +exit_with_error: + RELEASE(myglobs.lpInfoBuffer); + RELEASE(myglobs.lpFrameRateBuffer); + if (statglobs.hFont != NULL) { + DeleteObject(statglobs.hFont); + } + return FALSE; +} + +/************************************************************************* + Frame rate output. + *************************************************************************/ + +#define INTERVAL 100 + +char StatTxt[100]; +int StatTxtLen; +int count = 0; +int last_polygons = 0; +int this_frames = 0; +time_t last_time; +float fps; +long tps; + +/* + * ResetFrameRate + * Initializes the frame rate counter. + */ +void +ResetFrameRate(void) +{ + last_time = clock(); + count = 0; + last_polygons = 0; + this_frames = 0; + fps = 0.0f; tps = 0; + StatTxt[0] = 0; + StatTxtLen = 0; +} + +BOOL +CalculateFrameRate() +{ + /* + * Calculate the frame rate and get other stats. + */ + count++; + this_frames++; + if (count == INTERVAL) { + double t; + int p, f; + time_t this_time; + + count = 0; + this_time = clock(); + t = (this_time - last_time) / (double)CLOCKS_PER_SEC; + last_time = this_time; + + p = myglobs.dev->GetTrianglesDrawn() - last_polygons; + last_polygons = myglobs.dev->GetTrianglesDrawn(); + + f = this_frames; + this_frames = 0; + + fps = (float)(f / t); + tps = (long)(p / t); + + if (myglobs.bShowFrameRate) { + if (!WriteFrameRateBuffer(fps, tps)) + return FALSE; + } + } + return TRUE; +} + +/* + * DisplayFrameRate + * Outputs frame rate info and screen mode to back buffer when appropriate. + */ +BOOL +DisplayFrameRate(int* count, LPD3DRECT lpExtents ) +{ + RECT rc; + int x, y; + HRESULT ddrval = DD_OK; + if (myglobs.bShowFrameRate && !myglobs.bSingleStepMode && statglobs.szFrameRate.cx > 0 && statglobs.szFrameRate.cy > 0 && + statglobs.szFrameRate.cx < d3dapp->szClient.cx && statglobs.szFrameRate.cy < d3dapp->szClient.cy) { + SetRect(&rc, 0, 0, statglobs.szFrameRate.cx, statglobs.szFrameRate.cy); + x = (int)(0.5 * (d3dapp->szClient.cx - statglobs.szFrameRate.cx) + 0.5); + y = 0; + if (myglobs.lpFrameRateBuffer) + ddrval = d3dapp->lpBackBuffer->BltFast(x, y, myglobs.lpFrameRateBuffer, &rc, + DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + if (ddrval != DD_OK) { + /* + * Blting the frame rate has failed. Since it is not vital, we + * aren't going to report an error. Check to see if the surfaces + * have been lost and then return. + */ + if (ddrval == DDERR_SURFACELOST) { + d3dapp->lpBackBuffer->Restore(); + myglobs.lpFrameRateBuffer->Restore(); + } + return TRUE; + } + SetRect((LPRECT)(lpExtents), x, y, statglobs.szFrameRate.cx + x, statglobs.szFrameRate.cy); + ++(*count); + ++lpExtents; + } + if (myglobs.bShowInfo && statglobs.szInfo.cx < d3dapp->szClient.cx && statglobs.szInfo.cy < d3dapp->szClient.cy) { + SetRect(&rc, 0, 0, statglobs.szInfo.cx, statglobs.szInfo.cy); + x = (int)(0.5 * (d3dapp->szClient.cx - statglobs.szInfo.cx) + 0.5); + y = d3dapp->szClient.cy - statglobs.szInfo.cy; + if (myglobs.lpInfoBuffer) + ddrval = d3dapp->lpBackBuffer->BltFast(x,y, myglobs.lpInfoBuffer, &rc, + DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + if (ddrval != DD_OK) { + /* + * Blting the info has failed. Since it is not vital, we + * aren't going to report an error. Check to see if the surfaces + * have been lost and then return. + */ + if (ddrval == DDERR_SURFACELOST) { + d3dapp->lpBackBuffer->Restore(); + myglobs.lpInfoBuffer->Restore(); + } + return TRUE; + } + SetRect((LPRECT)(lpExtents), x, y, x + statglobs.szInfo.cx, y + statglobs.szInfo.cy); + ++(*count); + } + return TRUE; +} diff --git a/sdk/samples/misc/stats.cpp b/sdk/samples/misc/stats.cpp new file mode 100644 index 0000000..45d17cd --- /dev/null +++ b/sdk/samples/misc/stats.cpp @@ -0,0 +1,311 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: stats.cpp + * + ***************************************************************************/ +#include "d3dmain.h" + +/* + * GLOBAL VARIABLES + */ +extern D3DAppInfo* d3dapp; /* Pointer to read only collection of DD and D3D + objects maintained by D3DApp */ +extern d3dmainglobals myglobs; /* collection of global variables */ + +static struct { + HFONT hFont; + SIZE szFrameRate; + SIZE szInfo; +} statglobs; + + /************************************************************************ + Frame rate and info text + ************************************************************************/ + +BOOL +WriteFrameRateBuffer(float fps, long tps) +{ + HRESULT LastError; + HDC hdc; + RECT rc; + char buf1[30], buf2[30], buf[60]; + int len; + + if (!myglobs.lpFrameRateBuffer) + return TRUE; + if (fps > 0.0f) + wsprintf(buf1, "%d.%02d fps ", + (int)( fps * 100 ) / 100, + (int)( fps * 100 ) % 100); + else + buf1[0] = 0; + if (tps > 0) + wsprintf(buf2, "%ld tps ", tps); + else + buf2[0] = 0; + len = wsprintf(buf, "%s%s", buf1, buf2); + if (!myglobs.lpFrameRateBuffer) + return FALSE; + LastError = myglobs.lpFrameRateBuffer->GetDC(&hdc); + if (LastError != DD_OK) { + /* + * If this fails, it's not vital, so don't report an error. + */ + return TRUE; + } + SelectObject(hdc, statglobs.hFont); + SetTextColor(hdc, RGB(255,255,0)); + SetBkColor(hdc, RGB(0,0,0)); + SetBkMode(hdc, OPAQUE); + GetTextExtentPoint32(hdc, buf, len, &statglobs.szFrameRate); + SetRect(&rc, 0, 0, statglobs.szFrameRate.cx, statglobs.szFrameRate.cy); + ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, buf, len, NULL); + myglobs.lpFrameRateBuffer->ReleaseDC(hdc); + return TRUE; +} + +BOOL +WriteInfoBuffer(void) +{ + HRESULT LastError; + HDC hdc; + RECT rc; + char buf[40]; + int len; + + if (!myglobs.lpInfoBuffer) + return TRUE; + if (d3dapp->bFullscreen) + len = wsprintf(buf, "%dx%dx%d (%s)", d3dapp->ThisMode.w, d3dapp->ThisMode.h, d3dapp->ThisMode.bpp, + (d3dapp->ThisDriver.Desc.dcmColorModel == D3DCOLOR_MONO) ? "MONO" : "RGB"); + else + len = wsprintf(buf, "%dx%d (%s)", d3dapp->szClient.cx, d3dapp->szClient.cy, + (d3dapp->ThisDriver.Desc.dcmColorModel == D3DCOLOR_MONO) ? "MONO" : "RGB"); + if (!myglobs.lpInfoBuffer) + return FALSE; + LastError = myglobs.lpInfoBuffer->GetDC(&hdc); + if (LastError != DD_OK) { + /* + * If this fails, it's not vital, so don't report an error. + */ + return TRUE; + } + + SelectObject(hdc, statglobs.hFont); + SetTextColor(hdc, RGB(255,255,0)); + SetBkColor(hdc, RGB(0,0,0)); + SetBkMode(hdc, OPAQUE); + GetTextExtentPoint32(hdc, buf, len, &statglobs.szInfo); + SetRect(&rc, 0, 0, statglobs.szInfo.cx, statglobs.szInfo.cy); + ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, buf, len, NULL); + myglobs.lpInfoBuffer->ReleaseDC(hdc); + return TRUE; +} + +void +ReleaseFontAndTextBuffers(void) +{ + RELEASE(myglobs.lpInfoBuffer); + RELEASE(myglobs.lpFrameRateBuffer); + if (statglobs.hFont != NULL) { + DeleteObject(statglobs.hFont); + statglobs.hFont = NULL; + } +} + +BOOL +InitFontAndTextBuffers(void) +{ + DDCOLORKEY ddck; + DDSURFACEDESC ddsd; + HDC hdc; + HRESULT ddrval; + char dummyinfo[] = "000x000x00 (MONO) 0000"; + char dummyfps[] = "000.00 fps 00000000.00 tps 0000.00 mppps"; + + /* + * Create the font. + */ + RELEASE(myglobs.lpInfoBuffer); + RELEASE(myglobs.lpFrameRateBuffer); + if (statglobs.hFont != NULL) { + DeleteObject(statglobs.hFont); + statglobs.hFont = NULL; + } + statglobs.hFont = CreateFont( + d3dapp->szClient.cx <= 600 ? 12 : 24, + 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, + ANSI_CHARSET, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, + VARIABLE_PITCH, + "Arial" ); + + hdc = GetDC(NULL); + SelectObject(hdc, statglobs.hFont); + GetTextExtentPoint(hdc, dummyfps, strlen(dummyfps), &statglobs.szFrameRate); + GetTextExtentPoint(hdc, dummyinfo, strlen(dummyinfo), &statglobs.szInfo); + ReleaseDC(NULL, hdc); + + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.dwHeight = statglobs.szFrameRate.cy; + ddsd.dwWidth = statglobs.szFrameRate.cx; + ddrval = D3DAppCreateSurface(&ddsd, &myglobs.lpFrameRateBuffer); + if (ddrval != DD_OK) { + Msg("Could not create frame rate buffer.\n%s", D3DAppErrorToString(ddrval)); + goto exit_with_error; + } + memset(&ddck, 0, sizeof(ddck)); + myglobs.lpFrameRateBuffer->SetColorKey(DDCKEY_SRCBLT, &ddck); + if (!WriteFrameRateBuffer(0.0f, 0)) { + goto exit_with_error; + } + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.dwHeight = statglobs.szInfo.cy; + ddsd.dwWidth = statglobs.szInfo.cx; + ddrval = D3DAppCreateSurface(&ddsd, &myglobs.lpInfoBuffer); + if (ddrval != DD_OK) { + Msg("Could not create info buffer.\n%s", D3DAppErrorToString(ddrval)); + goto exit_with_error; + } + memset(&ddck, 0, sizeof(ddck)); + myglobs.lpInfoBuffer->SetColorKey(DDCKEY_SRCBLT, &ddck); + if (!WriteInfoBuffer()) + goto exit_with_error; + return TRUE; +exit_with_error: + RELEASE(myglobs.lpInfoBuffer); + RELEASE(myglobs.lpFrameRateBuffer); + if (statglobs.hFont != NULL) { + DeleteObject(statglobs.hFont); + } + return FALSE; +} + +/************************************************************************* + Frame rate output. + *************************************************************************/ + +#define INTERVAL 100 + +char StatTxt[100]; +int StatTxtLen; +int count = 0; +int last_polygons = 0; +int this_frames = 0; +time_t last_time; +float fps; +long tps; + +/* + * ResetFrameRate + * Initializes the frame rate counter. + */ +void +ResetFrameRate(void) +{ + last_time = clock(); + count = 0; + last_polygons = 0; + this_frames = 0; + fps = 0.0f; tps = 0; + StatTxt[0] = 0; + StatTxtLen = 0; +} + +BOOL +CalculateFrameRate(void) +{ + /* + * Calculate the frame rate and get other stats. + */ + count++; + this_frames++; + if (count == INTERVAL) { + double t; + int p, f; + D3DSTATS stats; + time_t this_time; + + count = 0; + this_time = clock(); + t = (this_time - last_time) / (double)CLOCKS_PER_SEC; + last_time = this_time; + + memset(&stats, 0, sizeof(D3DSTATS)); + stats.dwSize = sizeof(D3DSTATS); + d3dapp->lpD3DDevice->GetStats(&stats); + p = stats.dwTrianglesDrawn - last_polygons; + last_polygons = stats.dwTrianglesDrawn; + + f = this_frames; + this_frames = 0; + + fps = (float)(f / t); + tps = (long)(p / t); + + if (myglobs.bShowFrameRate) { + if (!WriteFrameRateBuffer(fps, tps)) + return FALSE; + } + } + return TRUE; +} + +/* + * DisplayFrameRate + * Outputs frame rate info and screen mode to back buffer when appropriate. + */ +BOOL +DisplayFrameRate(int* count, LPD3DRECT lpExtents ) +{ + RECT rc; + int x, y; + HRESULT ddrval = DD_OK; + if (myglobs.bShowFrameRate && !myglobs.bSingleStepMode && statglobs.szFrameRate.cx > 0 && statglobs.szFrameRate.cy > 0 && + statglobs.szFrameRate.cx < d3dapp->szClient.cx && statglobs.szFrameRate.cy < d3dapp->szClient.cy) { + SetRect(&rc, 0, 0, statglobs.szFrameRate.cx, statglobs.szFrameRate.cy); + x = (int)(0.5 * (d3dapp->szClient.cx - statglobs.szFrameRate.cx) + 0.5); + y = 0; + if (myglobs.lpFrameRateBuffer) + ddrval = d3dapp->lpBackBuffer->BltFast(x, y, myglobs.lpFrameRateBuffer, &rc, + DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + if (ddrval != DD_OK) { + /* + * Blting the frame rate has failed. Since it is not vital, we + * aren't going to report an error. + */ + return TRUE; + } + SetRect((LPRECT)(lpExtents), x, y, statglobs.szFrameRate.cx + x, statglobs.szFrameRate.cy); + ++(*count); + ++lpExtents; + } + if (myglobs.bShowInfo && statglobs.szInfo.cx < d3dapp->szClient.cx && statglobs.szInfo.cy < d3dapp->szClient.cy) { + SetRect(&rc, 0, 0, statglobs.szInfo.cx, statglobs.szInfo.cy); + x = (int)(0.5 * (d3dapp->szClient.cx - statglobs.szInfo.cx) + 0.5); + y = d3dapp->szClient.cy - statglobs.szInfo.cy; + if (myglobs.lpInfoBuffer) + ddrval = d3dapp->lpBackBuffer->BltFast(x,y, myglobs.lpInfoBuffer, &rc, + DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + if (ddrval != DD_OK) { + /* + * Blting the info has failed. Since it is not vital, we + * aren't going to report an error. + */ + return TRUE; + } + SetRect((LPRECT)(lpExtents), x, y, x + statglobs.szInfo.cx, y + statglobs.szInfo.cy); + ++(*count); + } + return TRUE; +} diff --git a/sdk/samples/misc/texture.c b/sdk/samples/misc/texture.c new file mode 100644 index 0000000..b8783d1 --- /dev/null +++ b/sdk/samples/misc/texture.c @@ -0,0 +1,854 @@ +/* + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: texture.c + * + * Loads and manages textures. Part of D3DApp. + * + * D3DApp is a collection of helper functions for Direct3D applications. + * D3DApp consists of the following files: + * d3dapp.h Main D3DApp header to be included by application + * d3dappi.h Internal header + * d3dapp.c D3DApp functions seen by application. + * ddcalls.c All calls to DirectDraw objects except textures + * d3dcalls.c All calls to Direct3D objects except textures + * texture.c Texture loading and managing texture list + * misc.c Miscellaneous calls + */ + +#include "d3dappi.h" + +#define MAGICBYTES 2 + +/* + * STATIC FUNCTION DECLARATIONS + */ +static void D3DAppIAddPathList(const char *path); +static void D3DAppIInitialisePathList(); +static FILE * D3DAppIFindFile(const char *name, const char *mode); +static BOOL loadPPMHeader(FILE *fp, DWORD *width, DWORD *height, int *maxgrey); + + +/***************************************************************************/ +/* Managing the texture list */ +/***************************************************************************/ +/* + * D3DAppILoadTextureSurf + * Creates a texture map surface and texture object from the numbered PPM + * file. This is done in a two step process. A source texture surface and + * object are created in system memory. A second, initially empty, texture + * surface is created (in video memory if hardware is present). The source + * texture is loaded into the destination texture surface and then discarded. + * This process allows a device to compress or reformat a texture map as it + * enters video memory during the Load call. + */ +BOOL +D3DAppILoadTextureSurf(int n, BOOL* bInVideo) +{ + DDSURFACEDESC ddsd; + LPDIRECTDRAWSURFACE lpSrcTextureSurf = NULL; + LPDIRECT3DTEXTURE lpSrcTexture = NULL; + LPDIRECTDRAWPALETTE lpDstPalette = NULL; + PALETTEENTRY ppe[256]; + DWORD pcaps; + /* + * Release the surface if it is hanging around + */ + RELEASE(d3dappi.lpTextureSurf[n]); + /* + * Create a surface in system memory and load the PPM file into it. + * Query for the texture interface. + */ + lpSrcTextureSurf = D3DAppILoadSurface(d3dappi.lpDD, d3dappi.ImageFile[n], + &d3dappi.ThisTextureFormat.ddsd, + DDSCAPS_SYSTEMMEMORY); + if (!lpSrcTextureSurf) + goto exit_with_error; + LastError = lpSrcTextureSurf->lpVtbl->QueryInterface(lpSrcTextureSurf, + &IID_IDirect3DTexture, + (LPVOID*)&lpSrcTexture); + if (LastError != DD_OK) { + D3DAppISetErrorString("Failed to obtain D3D texture interface for a source texture.\n%s", D3DAppErrorToString(LastError)); + goto exit_with_error; + } + /* + * Create an empty texture surface to load the source texture into. + * The DDSCAPS_ALLOCONLOAD flag allows the DD driver to wait until the + * load call to allocate the texture in memory because at this point, + * we may not know how much memory the texture will take up (e.g. it + * could be compressed to an unknown size in video memory). + * Make sure SW renderers get textures in system memory + */ + LastError = D3DAppIGetSurfDesc(&ddsd, lpSrcTextureSurf); + if (LastError != DD_OK) { + D3DAppISetErrorString("Could not get the surface description of the source texture.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; + ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_ALLOCONLOAD; + if (!d3dappi.ThisDriver.bIsHardware) + ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; + LastError = D3DAppICreateSurface(&ddsd, &d3dappi.lpTextureSurf[n]); + if (LastError != DD_OK) { + D3DAppISetErrorString("Could not create the destination texture surface.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + if (ddsd.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) { + pcaps = DDPCAPS_8BIT | DDPCAPS_ALLOW256; + } else if (ddsd.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED4) { + pcaps = DDPCAPS_4BIT; + } else { + pcaps = 0; + } + if (pcaps) { + memset(ppe, 0, sizeof(PALETTEENTRY) * 256); + LastError = d3dappi.lpDD->lpVtbl->CreatePalette(d3dappi.lpDD, pcaps, + ppe, &lpDstPalette, NULL); + if (LastError != DD_OK) { + D3DAppISetErrorString("Failed to create a palette for the destination texture.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + LastError = d3dappi.lpTextureSurf[n]->lpVtbl->SetPalette(d3dappi.lpTextureSurf[n], + lpDstPalette); + if (LastError != DD_OK) { + D3DAppISetErrorString("Failed to set the destination texture's palette.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } +// lpDstPalette->lpVtbl->Release(lpDstPalette); + } + /* + * Query our destination surface for a texture interface + */ + LastError = d3dappi.lpTextureSurf[n]->lpVtbl->QueryInterface(d3dappi.lpTextureSurf[n], + &IID_IDirect3DTexture, + (LPVOID*)&d3dappi.lpTexture[n]); + if (LastError != DD_OK) { + D3DAppISetErrorString("Failed to obtain D3D texture interface for a destination texture.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + /* + * Load the source texture into the destination. During this call, a + * driver could compress or reformat the texture surface and put it in + * video memory. + */ + LastError = d3dappi.lpTexture[n]->lpVtbl->Load(d3dappi.lpTexture[n], lpSrcTexture); + if (LastError != DD_OK) { + D3DAppISetErrorString("Could not load a source texture into a destination texture.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + + /* + * Now we are done with the source texture + */ + RELEASE(lpSrcTexture); + RELEASE(lpSrcTextureSurf); + + /* + * Did the texture end up in video memory? + */ + LastError = D3DAppIGetSurfDesc(&ddsd, d3dappi.lpTextureSurf[n]); + if (LastError != DD_OK) { + D3DAppISetErrorString("Could not get the surface description of the loaded texture surface.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + if (ddsd.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) + *bInVideo = TRUE; + else + *bInVideo = FALSE; + + + return TRUE; + +exit_with_error: + RELEASE(lpSrcTexture); + RELEASE(lpSrcTextureSurf); + RELEASE(lpDstPalette); + RELEASE(d3dappi.lpTexture[n]); + RELEASE(d3dappi.lpTextureSurf[n]); + return FALSE; +} + +/* + * D3DAppIReloadTextureSurf + * Reloads a lost and restored texture surface + */ +BOOL +D3DAppIReloadTextureSurf(int n) +{ + LPDIRECTDRAWSURFACE lpSrcTextureSurf = NULL; + LPDIRECT3DTEXTURE lpSrcTexture = NULL; + + /* + * Create a surface in system memory and load the PPM file into it. + * Query for the texture interface. + */ + lpSrcTextureSurf = D3DAppILoadSurface(d3dappi.lpDD, d3dappi.ImageFile[n], + &d3dappi.ThisTextureFormat.ddsd, + DDSCAPS_SYSTEMMEMORY); + if (!lpSrcTextureSurf) + goto exit_with_error; + LastError = lpSrcTextureSurf->lpVtbl->QueryInterface(lpSrcTextureSurf, + &IID_IDirect3DTexture, + (LPVOID*)&lpSrcTexture); + if (LastError != DD_OK) { + D3DAppISetErrorString("Failed to obtain D3D texture interface for a source texture.\n%s", D3DAppErrorToString(LastError)); + goto exit_with_error; + } + /* + * Load the source texture into the destination. During this call, a + * driver could compress or reformat the texture surface and put it in + * video memory. + */ + LastError = d3dappi.lpTexture[n]->lpVtbl->Load(d3dappi.lpTexture[n], lpSrcTexture); + if (LastError != DD_OK) { + D3DAppISetErrorString("Could not load a source texture into a destination texture.\n%s", + D3DAppErrorToString(LastError)); + goto exit_with_error; + } + /* + * Now we are done with the source texture + */ + RELEASE(lpSrcTexture); + RELEASE(lpSrcTextureSurf); + + return TRUE; + +exit_with_error: + RELEASE(lpSrcTexture); + RELEASE(lpSrcTextureSurf); + return FALSE; +} + + +/* + * D3DAppIGetTextureHandle + * Get a texture handle from the current D3D device for this texture and save + * it in the MasterTextureHandle list and public texture handle list. + */ +BOOL +D3DAppIGetTextureHandle(int n) +{ + LastError = d3dappi.lpTexture[n]->lpVtbl->GetHandle(d3dappi.lpTexture[n], + d3dappi.lpD3DDevice, &MasterTextureHandle[n]); + if (LastError != DD_OK) { + D3DAppISetErrorString("Could not get a handle to loaded texture %i.\n%s", + n, D3DAppErrorToString(LastError)); + goto exit_with_error; + } + /* + * If textures are enabled, put the handle in the public texture list, + * otherwise, keep it as zero. + */ + if (!d3dappi.bTexturesDisabled) { + d3dappi.TextureHandle[n] = MasterTextureHandle[n]; + } else { + d3dappi.TextureHandle[n] = 0; + } + return TRUE; +exit_with_error: + MasterTextureHandle[n] = 0; + d3dappi.TextureHandle[n] = 0; + return FALSE; +} + +/* + * D3DAppIReleaseTexture + * Release this texture surface and texture interface. Remember, a texture + * handle is NOT and object and does not need to be released or destroyed. + * The handle is no longer valid after the device is destroyed, so set it to + * zero here. + */ +void +D3DAppIReleaseTexture(int n) +{ + RELEASE(d3dappi.lpTexture[n]); + RELEASE(d3dappi.lpTextureSurf[n]); + MasterTextureHandle[n] = 0; + d3dappi.TextureHandle[n] = 0; +} + +/* + * D3DAppIReleaseAllTextures + * Release all texture surfaces and texture interfaces + */ +void +D3DAppIReleaseAllTextures(void) +{ + int i; + for (i = 0; i < d3dappi.NumTextures; i++) { + D3DAppIReleaseTexture(i); + } +} + +/* + * D3DAppILoadAllTextures + * Load all texture surfaces, qeury them for texture interfaces and get + * handles for them from the current D3D driver. + */ +BOOL +D3DAppILoadAllTextures(void) +{ + int i; + if (d3dappi.ThisDriver.bDoesTextures) { + d3dappi.NumUsableTextures = 0; + for (i = 0; i < d3dappi.NumTextures; i++) { + BOOL bInVideo; + ATTEMPT(D3DAppILoadTextureSurf(i, &bInVideo)); + if (!bInVideo && d3dappi.ThisDriver.bIsHardware) { + /* + * If a texture fails to load into video memory for a hardware + * device, stop the NumUsableTextures count here. + */ + D3DAppIReleaseTexture(i); + break; + } else { + ++d3dappi.NumUsableTextures; + } + } + for (i = 0; i < d3dappi.NumUsableTextures; i++) { + ATTEMPT(D3DAppIGetTextureHandle(i)); + } + } else { + d3dappi.NumUsableTextures = 0; + } + return TRUE; + +exit_with_error: + for (i = 0; i < d3dappi.NumTextures; i++) { + D3DAppIReleaseTexture(i); + } + return FALSE; +} + +/***************************************************************************/ +/* Loading a PPM file into a surface */ +/***************************************************************************/ +/* + * LoadSurface + * Loads a ppm file into a texture map DD surface of the given format. The + * memory flag specifies DDSCAPS_SYSTEMMEMORY or DDSCAPS_VIDEOMEMORY. + */ +LPDIRECTDRAWSURFACE +D3DAppILoadSurface(LPDIRECTDRAW lpDD, LPCSTR lpName, + LPDDSURFACEDESC lpFormat, DWORD memoryflag) +{ + LPDIRECTDRAWSURFACE lpDDS; + DDSURFACEDESC ddsd, format; + D3DCOLOR colors[256]; + D3DCOLOR c; + DWORD dwWidth, dwHeight; + int i, j; + FILE *fp; + char *lpC; + LPDIRECTDRAWPALETTE lpDDPal; + PALETTEENTRY ppe[256]; + int psize; + DWORD pcaps; + int color_count; + BOOL bQuant = FALSE; + HRESULT ddrval; + + /* + * Find the image file and open it + */ + fp = D3DAppIFindFile(lpName, "rb"); + if (fp == NULL) { + D3DAppISetErrorString("Cannot find %s.\n", lpName); + return NULL; + } + /* + * Parse the PPM header + */ + if (!loadPPMHeader(fp, &dwWidth, &dwHeight, &i)) { + fclose(fp); + D3DAppISetErrorString("Could not load or parse PPM header in %s.\n", lpName); + return NULL; + } + /* + * Create a surface of the given format using the dimensions of the PPM + * file. + */ + memcpy(&format, lpFormat, sizeof(DDSURFACEDESC)); + if (format.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) { + bQuant = TRUE; + psize = 256; + pcaps = DDPCAPS_8BIT | DDPCAPS_ALLOW256; + } else if (format.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED4) { + bQuant = TRUE; + psize = 16; + pcaps = DDPCAPS_4BIT; + } + memcpy(&ddsd, &format, sizeof(DDSURFACEDESC)); + ddsd.dwSize = sizeof(DDSURFACEDESC); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; + ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | memoryflag; + ddsd.dwHeight = dwHeight; + ddsd.dwWidth = dwWidth; + + ddrval = lpDD->lpVtbl->CreateSurface(lpDD, &ddsd, &lpDDS, NULL); + if (ddrval != DD_OK) { + D3DAppISetErrorString("CreateSurface for texture failed (loadtex).\n%s", + D3DAppErrorToString(ddrval)); + return NULL; + } + /* + * Lock the surface so it can be filled with the PPM file + */ + memset(&ddsd, 0, sizeof(DDSURFACEDESC)); + ddsd.dwSize = sizeof(DDSURFACEDESC); + ddrval = lpDDS->lpVtbl->Lock(lpDDS, NULL, &ddsd, 0, NULL); + if (ddrval != DD_OK) { + lpDDS->lpVtbl->Release(lpDDS); + D3DAppISetErrorString("Lock failed while loading surface (loadtex).\n%s", + D3DAppErrorToString(ddrval)); + return NULL; + } + /* + * The method of loading depends on the pixel format of the dest surface + */ + if (!bQuant) { + /* + * The texture surface is not palettized + */ + unsigned long* lpLP; + unsigned short* lpSP; + unsigned char* lpCP; + unsigned long m; + int s; + int red_shift, red_scale; + int green_shift, green_scale; + int blue_shift, blue_scale; + /* + * Determine the red, green and blue masks' shift and scale. + */ + for (s = 0, m = format.ddpfPixelFormat.dwRBitMask; !(m & 1); + s++, m >>= 1); + red_shift = s; + red_scale = 255 / (format.ddpfPixelFormat.dwRBitMask >> s); + for (s = 0, m = format.ddpfPixelFormat.dwGBitMask; !(m & 1); + s++, m >>= 1); + green_shift = s; + green_scale = 255 / (format.ddpfPixelFormat.dwGBitMask >> s); + for (s = 0, m = format.ddpfPixelFormat.dwBBitMask; !(m & 1); + s++, m >>= 1); + blue_shift = s; + blue_scale = 255 / (format.ddpfPixelFormat.dwBBitMask >> s); + /* + * Each RGB bit count requires different pointers + */ + switch (format.ddpfPixelFormat.dwRGBBitCount) { + case 32 : + for (j = 0; j < (int)dwHeight; j++) { + /* + * Point to next row in texture surface + */ + lpLP = (unsigned long*)(((char*)ddsd.lpSurface) + + ddsd.lPitch * j); + for (i = 0; i < (int)dwWidth; i++) { + int r, g, b; + /* + * Read each value, scale it and shift it into position + */ + r = getc(fp) / red_scale; + g = getc(fp) / green_scale; + b = getc(fp) / blue_scale; + *lpLP = (r << red_shift) | (g << green_shift) | + (b << blue_shift); + lpLP++; + } + } + break; + case 16 : + for (j = 0; j < (int)dwHeight; j++) { + lpSP = (unsigned short*)(((char*)ddsd.lpSurface) + + ddsd.lPitch * j); + for (i = 0; i < (int)dwWidth; i++) { + int r, g, b; + r = getc(fp) / red_scale; + g = getc(fp) / green_scale; + b = getc(fp) / blue_scale; + *lpSP = (r << red_shift) | (g << green_shift) | + (b << blue_shift); + lpSP++; + } + } + break; + case 8: + for (j = 0; j < (int)dwHeight; j++) { + lpCP = (unsigned char*)(((char*)ddsd.lpSurface) + + ddsd.lPitch * j); + for (i = 0; i < (int)dwWidth; i++) { + int r, g, b; + r = getc(fp) / red_scale; + g = getc(fp) / green_scale; + b = getc(fp) / blue_scale; + *lpCP = (r << red_shift) | (g << green_shift) | + (b << blue_shift); + lpCP++; + } + } + break; + default: + /* + * This wasn't a format I recognize + */ + lpDDS->lpVtbl->Unlock(lpDDS, NULL); + fclose(fp); + lpDDS->lpVtbl->Release(lpDDS); + D3DAppISetErrorString("Unknown pixel format (loadtex)."); + return NULL; + } + /* + * Unlock the texture and return the surface pointer + */ + lpDDS->lpVtbl->Unlock(lpDDS, NULL); + fclose(fp); + return (lpDDS); + } + + /* + * We assume the 8-bit palettized case + */ + color_count = 0; /* number of colors in the texture */ + for (j = 0; j < (int)dwHeight; j++) { + /* + * Point to next row in surface + */ + lpC = ((char*)ddsd.lpSurface) + ddsd.lPitch * j; + for (i = 0; i < (int)dwWidth; i++) { + int r, g, b, k; + /* + * Get the next red, green and blue values and turn them into a + * D3DCOLOR + */ + r = getc(fp); + g = getc(fp); + b = getc(fp); + c = RGB_MAKE(r, g, b); + /* + * Search for this color in a table of colors in this texture + */ + for (k = 0; k < color_count; k++) + if (c == colors[k]) break; + if (k == color_count) { + /* + * This is a new color, so add it to the list + */ + color_count++; + /* + * More than 256 and we fail (8-bit) + */ + if (color_count > psize) { + color_count--; + k = color_count - 1; + //goto burst_colors; + } + colors[k] = c; + } + /* + * Set the "pixel" value on the surface to be the index into the + * color table + */ + if (psize == 16) { + if ((i & 1) == 0) + *lpC = k & 0xf; + else { + *lpC |= (k & 0xf) << 4; + lpC++; + } + } else { + *lpC = (char)k; + lpC++; + } + } + } + /* + * Close the file and unlock the surface + */ + fclose(fp); + lpDDS->lpVtbl->Unlock(lpDDS, NULL); + +//burst_colors: + if (color_count > psize) { + /* + * If there are more than 256 colors, we overran our palette + */ + lpDDS->lpVtbl->Unlock(lpDDS, NULL); + lpDDS->lpVtbl->Release(lpDDS); + D3DAppISetErrorString("Palette burst. (loadtex).\n"); + return (NULL); + } + + /* + * Create a palette with the colors in our color table + */ + memset(ppe, 0, sizeof(PALETTEENTRY) * 256); + for (i = 0; i < color_count; i++) { + ppe[i].peRed = (unsigned char)RGB_GETRED(colors[i]); + ppe[i].peGreen = (unsigned char)RGB_GETGREEN(colors[i]); + ppe[i].peBlue = (unsigned char)RGB_GETBLUE(colors[i]); + } + /* + * Set all remaining entry flags to D3DPAL_RESERVED, which are ignored by + * the renderer. + */ + for (; i < 256; i++) + ppe[i].peFlags = D3DPAL_RESERVED; + /* + * Create the palette with the DDPCAPS_ALLOW256 flag because we want to + * have access to all entries. + */ + ddrval = lpDD->lpVtbl->CreatePalette(lpDD, + DDPCAPS_INITIALIZE | pcaps, + ppe, &lpDDPal, NULL); + if (ddrval != DD_OK) { + lpDDS->lpVtbl->Release(lpDDS); + D3DAppISetErrorString("Create palette failed while loading surface (loadtex).\n%s", + D3DAppErrorToString(ddrval)); + return (NULL); + } + /* + * Finally, bind the palette to the surface + */ + ddrval = lpDDS->lpVtbl->SetPalette(lpDDS, lpDDPal); + if (ddrval != DD_OK) { + lpDDS->lpVtbl->Release(lpDDS); + lpDDPal->lpVtbl->Release(lpDDPal); + D3DAppISetErrorString("SetPalette failed while loading surface (loadtex).\n%s", + D3DAppErrorToString(ddrval)); + return (NULL); + } + + lpDDPal->lpVtbl->Release(lpDDPal); + + return lpDDS; +} + +static BOOL +ppm_getbyte(FILE *fp, char *newByte) +{ + char cchar; + int cc; + + /* Get a byte, and dump comments */ + cchar = cc = getc(fp); + if (cc == EOF) { + return FALSE; + } + + if (cchar == '#') { + /* Read until next end of line */ + do { + cchar = cc = getc(fp); + if (cc == EOF) + return FALSE; + } while (cchar != '\n' && cchar != '\r'); + } + + *newByte = cchar; + + return TRUE; +} + +static BOOL +ppm_getint(FILE *fp, int *newInt) +{ + int cint; + char cchar; + + do { + if (!ppm_getbyte(fp, &cchar)) return FALSE; + } while (isspace(cchar)); + + if (!isdigit(cchar)) { + return FALSE; + } + + cint = 0; + + do { + cint = (cint * 10) + (cchar - '0'); + if (!ppm_getbyte(fp, &cchar)) return FALSE; + } while(isdigit(cchar)); + + *newInt = cint; + + return TRUE; +} + +static BOOL +loadPPMHeader(FILE *fp, DWORD *width, DWORD *height, int *maxgrey) +{ + char magic[MAGICBYTES], cchar; + + /* Slurp up ppm header until we get width, height and maxgrey values */ + + /* Read and check the magic bytes */ + if (fread(magic, MAGICBYTES, 1, fp) != 1) + return FALSE; + if (magic[0] != 'P' || magic[1] != '6') + return FALSE; + + /* Now we can actually read some numbers */ + if (!ppm_getint(fp, width)) + return FALSE; + if (!ppm_getint(fp, height)) + return FALSE; + if (!ppm_getint(fp, maxgrey)) + return FALSE; + + /* Slurp up rest of white space so we get to actual data */ + do { + if (!ppm_getbyte(fp, &cchar)) + return FALSE; + } while (cchar == ' ' || cchar == '\t' || cchar == '\n' || cchar == '\r'); + + fseek(fp, -1, SEEK_CUR); + + return TRUE; +} + + +/***************************************************************************/ +/* Finding Textures */ +/***************************************************************************/ + +#define MAXPATH 256 +#define PATHSEP ';' +#define FILESEP '\\' +#define MAXCONTENTS 25 +#define RESPATH "Software\\Microsoft\\Direct3D" + +static int PathListInitialised = FALSE; + +/* + * PathList structure + * A list of directories in which to search for the texture. + */ +static struct { + int count; + char *contents[MAXCONTENTS]; +} PathList; + +/* + * D3DAppIAddPathList + * Add this string to the search path list + */ +static void +D3DAppIAddPathList(const char *path) +{ + char *p; + char *elt; + int len; + + while (path) { + p = LSTRCHR(path, PATHSEP); + if (p) + len = p - path; + else + len = lstrlen(path); + elt = (char *) malloc(len + 1); + if (elt == NULL) + return; + lstrcpyn(elt, path, len + 1); + elt[len] = '\0'; + PathList.contents[PathList.count] = elt; + PathList.count++; + if (p) + path = p + 1; + else + path = NULL; + if (PathList.count == MAXCONTENTS) + return; + } + return; +} + +/* + * D3DAppIInitialisePathList + * Create a search path with the D3DPATH env. var and D3D Path registry entry + */ +static void +D3DAppIInitialisePathList() +{ + long result; + HKEY key; + DWORD type, size; + static char buf[512]; + char* path; + + if (PathListInitialised) + return; + PathListInitialised = TRUE; + + PathList.count = 0; + path = getenv("D3DPATH"); + D3DAppIAddPathList("."); + if (path != NULL) { + D3DAppIAddPathList(path); + return; + } + result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, RESPATH, 0, KEY_READ, &key); + if (result == ERROR_SUCCESS) { + size = sizeof(buf); + result = RegQueryValueEx(key, "D3D Path", NULL, &type, (LPBYTE) buf, + &size); + RegCloseKey(key); + if (result == ERROR_SUCCESS && type == REG_SZ) + D3DAppIAddPathList(buf); + } +} + + +/* + * D3DAppIFindFile + * Find and open a file using the current search path. + */ +static FILE* +D3DAppIFindFile(const char *name, const char *mode) +{ + FILE *fp; + char buf[MAXPATH]; + static char filesep[] = {FILESEP, 0}; + int i; + + D3DAppIInitialisePathList(); + + fp = fopen(name, mode); + if (fp != NULL) + return fp; + + for (i = 0; i < PathList.count; i++) { + lstrcpy(buf, PathList.contents[i]); + lstrcat(buf, filesep); + lstrcat(buf, name); + fp = fopen(buf, mode); + if (fp) + return fp; + } + return NULL; +} + +/* + * D3DAppIReleasePathList + * Release the path list for program termination + */ +void +D3DAppIReleasePathList(void) +{ + int i; + for (i = 0; i < PathList.count; i++) { + free(PathList.contents[i]); + PathList.contents[i] = NULL; + } + PathList.count = 0; + PathListInitialised = FALSE; +} + diff --git a/sdk/samples/msbld.mk b/sdk/samples/msbld.mk new file mode 100644 index 0000000..84f94ec --- /dev/null +++ b/sdk/samples/msbld.mk @@ -0,0 +1,33 @@ +############################################################################ +# +# Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. +# +# File: msbld.mk +# Content: Master makefile for Microsoft Visual C++ 2.0 or higher +# For controlling what gets built (debug, retail, clean) +# +############################################################################ + +goal: debug.mak + +all : debug.mak retail.mak + +debug retail: $@.mak + +!ifndef MAKENAME +MAKENAME = default.mk +!endif + +debug.mak retail.mak: + @if not exist $(@B)\nul md $(@B) + @cd $(@B) + @nmake -nologo -f ..\$(MAKENAME) DEBUG="$(@B)" + @cd .. + @echo *** Done making $(@B) *** + +clean: debug.cln retail.cln + +debug.cln retail.cln: + @if exist $(@B)\nul del $(@B) < ..\yes >nul + @if exist $(@B)\nul rd $(@B) >nul + @echo *** $(@B) is clean *** diff --git a/sdk/samples/mssdk.mk b/sdk/samples/mssdk.mk new file mode 100644 index 0000000..79f14ad --- /dev/null +++ b/sdk/samples/mssdk.mk @@ -0,0 +1,111 @@ +############################################################################ +# +# Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. +# +# File: mssdk.mk +# Content: Rules for building the components of the SDK. +# For use with MSVC 2.0 or higher +# +############################################################################ + +!if "$(GSDKROOT)" == "" +GSDKROOT=..\..\.. +!endif + +############################################################################# +# +# Set up include & lib path +# +############################################################################# +INCLUDE=$(GSDKROOT)\inc;$(INCLUDE) +LIB=$(GSDKROOT)\lib;$(LIB) + +############################################################################# +# +# new suffixes +# +############################################################################# +.SUFFIXES: +.SUFFIXES: .asm .c .cpp .exe .dll .h .inc .lib .sym .rc .res + +############################################################################# +# +# C compiler definitions +# +############################################################################# +CC =cl +CFLAGS = $(CFLAGS) -W3 -WX -c -Zp +CFLAGS =$(CFLAGS) -Gf4ys -DIS_32 -DWIN32 +!ifndef LOGO +CFLAGS =$(CFLAGS) -nologo +!endif + +############################################################################# +# +# Linker definitions +# +############################################################################# +LINK =link -link +LFLAGS =$(LFLAGS) -nodefaultlib -align:0x1000 +!ifndef LOGO +LFLAGS =$(LFLAGS) -nologo +!endif + +############################################################################# +# +# resource compiler definitions +# +############################################################################# +RCFLAGS =$(RCFLAGS) -I.. +RCFLAGS =$(RCFLAGS) -DWIN32 -DIS_32 +RC = rc + +############################################################################# +# +# assembler definitions +# +############################################################################# +ASM = ml +AFLAGS =$(AFLAGS) -DIS_32 -DWIN32 +AFLAGS =$(AFLAGS) -W3 -WX -Zd -c -Cx -DMASM6 + +############################################################################# +# +# librarian definitions +# +############################################################################# +LIBEXE = lib + +############################################################################# +# +# targets +# +############################################################################# + +goal: $(GOALS) + +{..}.c{}.obj: + @$(CC) @<< +$(CFLAGS) -Fo$(@B).obj ..\$(@B).c +<< + +{..\..\misc}.c{}.obj: + @$(CC) @<< +$(CFLAGS) -Fo$(@B).obj ..\..\misc\$(@B).c +<< + +{..}.cpp{}.obj: + @$(CC) @<< +$(CFLAGS) -Fo$(@B).obj ..\$(@B).cpp +<< + +{..\..\misc}.cpp{}.obj: + @$(CC) @<< +$(CFLAGS) -Fo$(@B).obj ..\..\misc\$(@B).cpp +<< + +{..}.asm{}.obj: + $(ASM) $(AFLAGS) -Fo$(@B).obj ..\$(@B).asm + +{..}.rc{}.res: + $(RC) $(RCFLAGS) -r -Fo$(@B).res ..\$(@B).rc diff --git a/sdk/samples/mstream/debug.c b/sdk/samples/mstream/debug.c new file mode 100644 index 0000000..16668aa --- /dev/null +++ b/sdk/samples/mstream/debug.c @@ -0,0 +1,356 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: debug.c + * Content: debug code + * + ***************************************************************************/ + +#ifdef DEBUG + +#include <windows.h> +#include <windowsx.h> +#include <stdarg.h> +#include "debug.h" + + +// +// since we don't UNICODE our debugging messages, use the ASCII entry +// points regardless of how we are compiled. +// +#ifdef _WIN32 + #include <wchar.h> +#else + #define lstrcatA lstrcat + #define lstrlenA lstrlen + #define GetProfileIntA GetProfileInt + #define OutputDebugStringA OutputDebugString + #define wsprintfA wsprintf + #define MessageBoxA MessageBox +#endif + +// +// +// +BOOL __gfDbgEnabled = TRUE; // master enable +UINT __guDbgLevel = 0; // current debug level + + +//--------------------------------------------------------------------------; +// +// void DbgVPrintF +// +// Description: +// +// +// Arguments: +// LPSTR szFormat: +// +// va_list va: +// +// Return (void): +// No value is returned. +// +//--------------------------------------------------------------------------; + +void FAR CDECL DbgVPrintF +( + LPSTR szFormat, + va_list va +) +{ + char ach[DEBUG_MAX_LINE_LEN]; + BOOL fDebugBreak = FALSE; + BOOL fPrefix = TRUE; + BOOL fCRLF = TRUE; + + ach[0] = '\0'; + + for (;;) + { + switch (*szFormat) + { + case '!': + fDebugBreak = TRUE; + szFormat++; + continue; + + case '`': + fPrefix = FALSE; + szFormat++; + continue; + + case '~': + fCRLF = FALSE; + szFormat++; + continue; + } + + break; + } + + if (fDebugBreak) + { + ach[0] = '\007'; + ach[1] = '\0'; + } + + if (fPrefix) + { + lstrcatA(ach, DEBUG_MODULE_NAME ": "); + } + +#ifdef _WIN32 + wvsprintfA(ach + lstrlenA(ach), szFormat, va); +#else + wvsprintf(ach + lstrlenA(ach), szFormat, (LPSTR)va); +#endif + + if (fCRLF) + { + lstrcatA(ach, "\r\n"); + } + + OutputDebugStringA(ach); + + if (fDebugBreak) + { + DebugBreak(); + } +} // DbgVPrintF() + + +//--------------------------------------------------------------------------; +// +// void dprintf +// +// Description: +// dprintf() is called by the DPF() macro if DEBUG is defined at compile +// time. It is recommended that you only use the DPF() macro to call +// this function--so you don't have to put #ifdef DEBUG around all +// of your code. +// +// Arguments: +// UINT uDbgLevel: +// +// LPSTR szFormat: +// +// Return (void): +// No value is returned. +// +//--------------------------------------------------------------------------; + +void FAR CDECL dprintf +( + UINT uDbgLevel, + LPSTR szFormat, + ... +) +{ + va_list va; + + if (!__gfDbgEnabled || (__guDbgLevel < uDbgLevel)) + return; + + va_start(va, szFormat); + DbgVPrintF(szFormat, va); + va_end(va); +} // dprintf() + + +//--------------------------------------------------------------------------; +// +// BOOL DbgEnable +// +// Description: +// +// +// Arguments: +// BOOL fEnable: +// +// Return (BOOL): +// Returns the previous debugging state. +// +//--------------------------------------------------------------------------; + +BOOL WINAPI DbgEnable +( + BOOL fEnable +) +{ + BOOL fOldState; + + fOldState = __gfDbgEnabled; + __gfDbgEnabled = fEnable; + + return (fOldState); +} // DbgEnable() + + +//--------------------------------------------------------------------------; +// +// UINT DbgSetLevel +// +// Description: +// +// +// Arguments: +// UINT uLevel: +// +// Return (UINT): +// Returns the previous debugging level. +// +//--------------------------------------------------------------------------; + +UINT WINAPI DbgSetLevel +( + UINT uLevel +) +{ + UINT uOldLevel; + + uOldLevel = __guDbgLevel; + __guDbgLevel = uLevel; + + return (uOldLevel); +} // DbgSetLevel() + + +//--------------------------------------------------------------------------; +// +// UINT DbgGetLevel +// +// Description: +// +// +// Arguments: +// None. +// +// Return (UINT): +// Returns the current debugging level. +// +//--------------------------------------------------------------------------; + +UINT WINAPI DbgGetLevel +( + void +) +{ + return (__guDbgLevel); +} // DbgGetLevel() + + +//--------------------------------------------------------------------------; +// +// UINT DbgInitialize +// +// Description: +// +// +// Arguments: +// BOOL fEnable: +// +// Return (UINT): +// Returns the debugging level that was set. +// +//--------------------------------------------------------------------------; + +UINT WINAPI DbgInitialize +( + BOOL fEnable +) +{ + UINT uLevel; + + uLevel = GetProfileIntA(DEBUG_SECTION, DEBUG_MODULE_NAME, (UINT)-1); + if ((UINT)-1 == uLevel) + { + // + // if the debug key is not present, then force debug output to + // be disabled. this way running a debug version of a component + // on a non-debugging machine will not generate output unless + // the debug key exists. + // + uLevel = 0; + fEnable = FALSE; + } + + DbgSetLevel(uLevel); + DbgEnable(fEnable); + + return (__guDbgLevel); +} // DbgInitialize() + + +//--------------------------------------------------------------------------; +// +// void _Assert +// +// Description: +// This routine is called if the ASSERT macro (defined in debug.h) +// tests and expression that evaluates to FALSE. This routine +// displays an "assertion failed" message box allowing the user to +// abort the program, enter the debugger (the "retry" button), or +// ignore the assertion and continue executing. The message box +// displays the file name and line number of the _Assert() call. +// +// Arguments: +// char * szFile: Filename where assertion occurred. +// int iLine: Line number of assertion. +// +//--------------------------------------------------------------------------; + +#ifndef _WIN32 +#pragma warning(disable:4704) +#endif + +void WINAPI _Assert +( + char * szFile, + int iLine +) +{ + static char ach[300]; // debug output (avoid stack overflow) + int id; +#ifndef _WIN32 + int iExitCode; +#endif + + wsprintfA(ach, "Assertion failed in file %s, line %d. [Press RETRY to debug.]", (LPSTR)szFile, iLine); + + id = MessageBoxA(NULL, ach, "Assertion Failed", + MB_SYSTEMMODAL | MB_ICONHAND | MB_ABORTRETRYIGNORE ); + + switch (id) + { + + case IDABORT: // Kill the application. +#ifndef _WIN32 + iExitCode = 0; + _asm + { + mov ah, 4Ch + mov al, BYTE PTR iExitCode + int 21h + } +#else + FatalAppExit(0, TEXT("Good Bye")); +#endif // WIN16 + break; + + case IDRETRY: // Break into the debugger. + DebugBreak(); + break; + + case IDIGNORE: // Ignore assertion, continue executing. + break; + } +} // _Assert + +#ifndef _WIN32 +#pragma warning(default:4704) +#endif + +#endif // #ifdef DEBUG + diff --git a/sdk/samples/mstream/debug.h b/sdk/samples/mstream/debug.h new file mode 100644 index 0000000..db520ab --- /dev/null +++ b/sdk/samples/mstream/debug.h @@ -0,0 +1,80 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: debug.h + * Content: debug header + * + ***************************************************************************/ +#ifndef __DEBUG_INCLUDED__ +#define __DEBUG_INCLUDED__ +#ifdef __cplusplus +extern "C" +{ +#endif + +// +// +// +// +#ifdef DEBUG + #define DEBUG_SECTION "Debug" // section name for + #define DEBUG_MODULE_NAME "MSTREAM" // key name and prefix for output + #define DEBUG_MAX_LINE_LEN 255 // max line length (bytes!) +#endif + + +// +// based code makes since only in win 16 (to try and keep stuff out of +// [fixed] data segments, etc)... +// +#ifndef BCODE +#ifdef _WIN32 + #define BCODE +#else + #define BCODE _based(_segname("_CODE")) +#endif +#endif + + + + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +#ifdef DEBUG + BOOL WINAPI DbgEnable(BOOL fEnable); + UINT WINAPI DbgGetLevel(void); + UINT WINAPI DbgSetLevel(UINT uLevel); + UINT WINAPI DbgInitialize(BOOL fEnable); + void WINAPI _Assert( char * szFile, int iLine ); + + void FAR CDECL dprintf(UINT uDbgLevel, LPSTR szFmt, ...); + + #define D(x) {x;} + #define DPF dprintf + #define DPI(sz) {static char BCODE ach[] = sz; OutputDebugStr(ach);} + #define ASSERT(x) if( !(x) ) _Assert( __FILE__, __LINE__) +#else + #define DbgEnable(x) FALSE + #define DbgGetLevel() 0 + #define DbgSetLevel(x) 0 + #define DbgInitialize(x) 0 + + #ifdef _MSC_VER + #pragma warning(disable:4002) + #endif + + #define D(x) + #define DPF() + #define DPI(sz) + #define ASSERT(x) +#endif + +#ifdef __cplusplus +} +#endif +#endif // __DEBUG_INCLUDED__ diff --git a/sdk/samples/mstream/default.mk b/sdk/samples/mstream/default.mk new file mode 100644 index 0000000..0945568 --- /dev/null +++ b/sdk/samples/mstream/default.mk @@ -0,0 +1,47 @@ +NAME = mstream +EXT = exe +GLOBAL_RECOMPILE = $(MANROOT)\recompdd.log + +IS_32 = 1 + +GOALS = $(PBIN)\$(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib crtdll.lib comctl32.lib comdlg32.lib \ + gdi32.lib winmm.lib + +OBJS = mstream.obj debug.obj mstrconv.obj mstrhelp.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +AOPT =-DDEBUG +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +AOPT = +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\..\proj.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/mstream/ico00001.ico b/sdk/samples/mstream/ico00001.ico new file mode 100644 index 0000000..a047dfb Binary files /dev/null and b/sdk/samples/mstream/ico00001.ico differ diff --git a/sdk/samples/mstream/makefile b/sdk/samples/mstream/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/mstream/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/mstream/midstuff.h b/sdk/samples/mstream/midstuff.h new file mode 100644 index 0000000..d16de6e --- /dev/null +++ b/sdk/samples/mstream/midstuff.h @@ -0,0 +1,138 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: midstuff.h + * Content: MIDI structures and definitions used by the MSTREAM sample + * application in converting a MID file to a MIDI stream for + * playback using the midiStream API. + * + ***************************************************************************/ +#ifndef __MIDSTUFF_H__ +#define __MIDSTUFF_H__ + +// MIDI file constants +// +#define MThd 0x6468544D // Start of file +#define MTrk 0x6B72544D // Start of track + +#define MIDI_SYSEX ((BYTE)0xF0) // SysEx begin +#define MIDI_SYSEXEND ((BYTE)0xF7) // SysEx begin +#define MIDI_META ((BYTE)0xFF) // Meta event begin +#define MIDI_META_TEMPO ((BYTE)0x51) // Tempo change +#define MIDI_META_EOT ((BYTE)0x2F) // End-of-track + +#define MIDI_NOTEOFF ((BYTE)0x80) // + note + velocity +#define MIDI_NOTEON ((BYTE)0x90) // + note + velocity +#define MIDI_POLYPRESS ((BYTE)0xA0) // + pressure (2 bytes) +#define MIDI_CTRLCHANGE ((BYTE)0xB0) // + ctrlr + value +#define MIDI_PRGMCHANGE ((BYTE)0xC0) // + new patch +#define MIDI_CHANPRESS ((BYTE)0xD0) // + pressure (1 byte) +#define MIDI_PITCHBEND ((BYTE)0xE0) // + pitch bend (2 bytes) + +#define NUM_CHANNELS 16 + +#define MIDICTRL_VOLUME ((BYTE)0x07) +#define MIDICTRL_VOLUME_LSB ((BYTE)0x27) +#define MIDICTRL_PAN ((BYTE)0x0A) + +#define MIDIEVENT_CHANNEL(dw) (dw & 0x0000000F) +#define MIDIEVENT_TYPE(dw) (dw & 0x000000F0) +#define MIDIEVENT_DATA1(dw) ((dw & 0x0000FF00) >> 8) +#define MIDIEVENT_VOLUME(dw) ((dw & 0x007F0000) >> 16) + +// Macros for swapping hi/lo-endian data +// +#define WORDSWAP(w) (((w) >> 8) | \ + (((w) << 8) & 0xFF00)) + +#define DWORDSWAP(dw) (((dw) >> 24) | \ + (((dw) >> 8) & 0x0000FF00) | \ + (((dw) << 8) & 0x00FF0000) | \ + (((dw) << 24) & 0xFF000000)) + +// In debug builds, TRACKERR will show us where the parser died +// +#ifdef DEBUG +#define TRACKERR(p,sz) ShowTrackError(p,sz); +#else +#define TRACKERR(p,sz) +#endif + + +// Make a little distinction here so the various structure members are a bit +// more clearly labelled -- we have offsets and byte counts to keep track of +// that deal with both in-memory buffers and the file on disk + +#define FILEOFF DWORD + + +// These structures are stored in MIDI files; they need to be byte aligned. +// +#pragma pack(1) + +// Chunk header. dwTag is either MTrk or MThd. +// +typedef struct +{ + DWORD dwTag; // Type + DWORD dwChunkLength; // Length (hi-lo) +} MIDICHUNK; + +// Contents of MThd chunk. +typedef struct +{ + WORD wFormat; // Format (hi-lo) + WORD wTrackCount; // # tracks (hi-lo) + WORD wTimeDivision; // Time division (hi-lo) +} MIDIFILEHDR; + +#pragma pack() // End of need for byte-aligned structures + + +// Temporary event structure which stores event data until we're ready to +// dump it into a stream buffer +// +typedef struct +{ + DWORD tkEvent; // Absolute time of event + BYTE byShortData[4]; // Event type and parameters if channel msg + DWORD dwEventLength; // Length of data which follows if meta or sysex + LPBYTE pLongData; // -> Event data if applicable +} TEMPEVENT, *PTEMPEVENT; + +#define ITS_F_ENDOFTRK 0x00000001 + +// Description of a track open for read +// +typedef struct +{ + DWORD fdwTrack; // Track status + DWORD dwTrackLength; // Total bytes in track + DWORD dwLeftInBuffer; // Bytes left unread in track buffer + LPBYTE pTrackStart; // -> start of track data buffer + LPBYTE pTrackCurrent; // -> next byte to read in buffer + DWORD tkNextEventDue; // Absolute time of next event in track + BYTE byRunningStatus;// Running status from last channel msg + + FILEOFF foTrackStart; // Start of track -- used for walking the file + FILEOFF foNextReadStart;// File offset of next read from disk + DWORD dwLeftOnDisk; // Bytes left unread on disk +#ifdef DEBUG + DWORD nTrack; // # of this track for debugging +#endif +} INTRACKSTATE, *PINTRACKSTATE; + +// Description of the input MIDI file +// +typedef struct +{ + DWORD cbFileLength; // Total bytes in file + DWORD dwTimeDivision; // Original time division + DWORD dwFormat; // Original format + DWORD dwTrackCount; // Track count (specifies pitsTracks size) + INTRACKSTATE *pitsTracks; // -> array of tracks in this file +} INFILESTATE, *PINFILESTATE; + +#endif + diff --git a/sdk/samples/mstream/mstrconv.c b/sdk/samples/mstream/mstrconv.c new file mode 100644 index 0000000..d602abe --- /dev/null +++ b/sdk/samples/mstream/mstrconv.c @@ -0,0 +1,1117 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: mstrconv.c + * Content: Converts a MIDI file into a midiStream, placing the results + * in a buffer that the MSTREAM sample application can use for + * playback with the midiStream* API under Win95. + * + ***************************************************************************/ +#include <windows.h> +#include <windowsx.h> + +#include <mmsystem.h> +#include <assert.h> +#include <stdio.h> + +#include "debug.h" +#include "mstream.h" +#include "midstuff.h" + +// Global stuff which is defined in the main module +// +extern char szTemp[256]; +extern char szDebug[256]; +extern char szAppTitle[64]; + +BOOL bInsertTempo = FALSE; + +// A few global variables used by this module only +// +static HANDLE hInFile = INVALID_HANDLE_VALUE; +INFILESTATE ifs; +static DWORD tkCurrentTime; + +// Tracks how many malloc blocks exist. If there are any and we decide to shut +// down, we must scan for them and free them. Malloc blocks are only created as +// temporary storgae blocks for extra parameter data associated with MIDI_SYSEX, +// MIDI_SYSEXEND, and MIDI_META events. +static DWORD dwMallocBlocks = 0; + +extern DWORD dwBufferTickLength, dwTempoMultiplier, dwCurrentTempo; +extern DWORD dwProgressBytes, dwVolumePercent; +extern BOOL bLooped; + +// Messages +// +static char szInitErrMem[] = "Out of memory.\n"; +static char szInitErrInFile[] = "Read error on input file or file is corrupt.\n"; +static char szNoTrackBuffMem[] = "Insufficient memory for track buffer allocation\n"; + +#ifdef DEBUG +static char gteBadRunStat[] = "Reference to missing running status."; +static char gteRunStatMsgTrunc[]= "Running status message truncated"; +static char gteChanMsgTrunc[] = "Channel message truncated"; +static char gteSysExLenTrunc[] = "SysEx event truncated (length)"; +static char gteSysExTrunc[] = "SysEx event truncated"; +static char gteMetaNoClass[] = "Meta event truncated (no class byte)"; +static char gteMetaLenTrunc[] = "Meta event truncated (length)"; +static char gteMetaTrunc[] = "Meta event truncated"; +static char gteNoMem[] = "Out of memory during malloc call"; +#endif + +// Prototypes +// +static int AddEventToStreamBuffer( PTEMPEVENT pteTemp, LPCONVERTINFO ); +static BOOL GetInFileData( LPVOID lpDest, DWORD cbToGet ); +static BOOL GetTrackByte( PINTRACKSTATE ptsTrack, LPBYTE lpbyByte ); +static BOOL GetTrackEvent( PINTRACKSTATE ptsTrack, PTEMPEVENT pteTemp ); +static BOOL GetTrackVDWord( PINTRACKSTATE ptsTrack, LPDWORD lpdw ); +static BOOL RefillTrackBuffer( PINTRACKSTATE ptsTrack ); +static BOOL RewindConverter( void ); + +#ifdef DEBUG +static void ShowTrackError( PINTRACKSTATE ptsTrack, char* szErr ); +#endif + +// ConverterInit +// +// Open the input file +// Allocate and read the entire input file into memory +// Validate the input file structure +// Allocate the input track structures and initialize them +// Initialize the output track structures +// +// Return TRUE on success +// Prints its own error message if something goes wrong +// +BOOL ConverterInit( LPSTR szInFile ) + { + BOOL fRet = TRUE; + DWORD cbRead, dwTag, cbHeader, dwToRead; + MIDIFILEHDR Header; + PINTRACKSTATE ptsTrack; + UINT idx; + + tkCurrentTime = 0; + + // Initialize things we'll try to free later if we fail + // + memset( &ifs, 0, sizeof(INFILESTATE)); + ifs.cbFileLength = 0; + ifs.pitsTracks = NULL; + + // Attempt to open the input and output files + // + hInFile = CreateFile( szInFile, GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL); + if( hInFile == INVALID_HANDLE_VALUE ) + { + wsprintf( szTemp, "Could not open \"%s\" for read.\n", szInFile ); + MessageBox( GetActiveWindow(), szTemp, + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + goto Init_Cleanup; + } + +// Figure out how big the input file is. + if((( ifs.cbFileLength = GetFileSize( hInFile, NULL )) == (UINT)-1 )) + { + MessageBox( GetActiveWindow(), "File system error on input file.\n", + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + goto Init_Cleanup; + } + +// Set up to read from the memory buffer. Read and validate +// - MThd header +// - size of file header chunk +// - file header itself +// + if( GetInFileData( &dwTag, sizeof(DWORD)) + || ( dwTag != MThd ) + || GetInFileData( &cbHeader, sizeof(DWORD)) + || (( cbHeader = DWORDSWAP( cbHeader )) < sizeof(MIDIFILEHDR)) + || GetInFileData( &Header, cbHeader ) ) + { + MessageBox( GetActiveWindow(), szInitErrInFile, + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + goto Init_Cleanup; + } + +// File header is stored in hi-lo order. Swap this into Intel order and save +// parameters in our native int size (32 bits) +// + ifs.dwFormat = (DWORD)WORDSWAP( Header.wFormat ); + ifs.dwTrackCount = (DWORD)WORDSWAP( Header.wTrackCount ); + ifs.dwTimeDivision = (DWORD)WORDSWAP( Header.wTimeDivision ); + +// We know how many tracks there are; allocate the structures for them and parse +// them. The parse merely looks at the MTrk signature and track chunk length +// in order to skip to the next track header. +// + ifs.pitsTracks = (PINTRACKSTATE)GlobalAllocPtr( GPTR, + ifs.dwTrackCount * sizeof(INTRACKSTATE)); + if( ifs.pitsTracks == NULL ) + { + MessageBox( GetActiveWindow(), szInitErrMem, + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + goto Init_Cleanup; + } + + for( idx = 0, ptsTrack = ifs.pitsTracks; idx < ifs.dwTrackCount; + ++idx, ++ptsTrack ) + { + if(( ptsTrack->pTrackStart + = GlobalAllocPtr( GHND, TRACK_BUFFER_SIZE )) == NULL ) + { + MessageBox( GetActiveWindow(), szNoTrackBuffMem, + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + goto Init_Cleanup; + } + + if( GetInFileData( &dwTag, sizeof(dwTag)) || ( dwTag != MTrk ) + || GetInFileData( &cbHeader, sizeof(cbHeader))) + { + MessageBox( GetActiveWindow(), szInitErrInFile, + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + goto Init_Cleanup; + } + + cbHeader = DWORDSWAP( cbHeader ); + ptsTrack->dwTrackLength = cbHeader; // Total track length +/////////////////////////////////////////////////////////////////////////////// +// Here we need to determine if all track data will fit into a single one of +// our track buffers. If not, we need to read in a buffer full and come back +// for more later, saving the file offset to continue from and the amount left +// to read in the track structure. + + // Save the file offset of the beginning of this track + ptsTrack->foTrackStart = SetFilePointer( hInFile, 0, NULL, + FILE_CURRENT ); + + if( ptsTrack->dwTrackLength > TRACK_BUFFER_SIZE ) + dwToRead = TRACK_BUFFER_SIZE; + else + dwToRead = ptsTrack->dwTrackLength; + if( !ReadFile( hInFile, ptsTrack->pTrackStart, dwToRead, &cbRead, NULL ) + || ( cbRead != dwToRead )) + { + MessageBox( GetActiveWindow(), szInitErrInFile, + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + goto Init_Cleanup; + } + // Save the number of bytes that didn't make it into the buffer + ptsTrack->dwLeftOnDisk = ptsTrack->dwTrackLength - cbRead; + ptsTrack->dwLeftInBuffer = cbRead; + // Save the current file offset so we can seek to it later + ptsTrack->foNextReadStart = SetFilePointer( hInFile, 0, + NULL, FILE_CURRENT ); + + // Setup pointer to the current position in the track + ptsTrack->pTrackCurrent = ptsTrack->pTrackStart; + ptsTrack->fdwTrack = 0; + ptsTrack->byRunningStatus = 0; + ptsTrack->tkNextEventDue = 0; + + // Handle bozo MIDI files which contain empty track chunks + // + if( !ptsTrack->dwLeftInBuffer && !ptsTrack->dwLeftOnDisk ) + { + ptsTrack->fdwTrack |= ITS_F_ENDOFTRK; + continue; + } + + // We always preread the time from each track so the mixer code can + // determine which track has the next event with a minimum of work + // + if( GetTrackVDWord( ptsTrack, &ptsTrack->tkNextEventDue )) + { + MessageBox( GetActiveWindow(), szInitErrInFile, + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + goto Init_Cleanup; + } + // Step over any unread data, advancing to the beginning of the next + // track's data + SetFilePointer( hInFile, ptsTrack->foTrackStart + ptsTrack->dwTrackLength, + NULL, FILE_BEGIN ); + } // End of track initialization code + + fRet = FALSE; + + Init_Cleanup: + if( fRet ) + ConverterCleanup(); + + return( fRet ); + } + +// +// GetInFileData +// +// Gets the requested number of bytes of data from the input file and returns +// a pointer to them. +// +// Returns a pointer to the data or NULL if we'd read more than is +// there. +// +static BOOL GetInFileData( LPVOID lpDest, DWORD cbToGet ) + { + DWORD cbRead; + + if( !ReadFile( hInFile, lpDest, cbToGet, &cbRead, NULL ) + || ( cbRead != cbToGet )) + { + return( TRUE ); + } + + return( FALSE ); + } + + +// +// ConverterCleanup +// +// Free anything we ever allocated +// +void ConverterCleanup( void ) + { + DWORD idx; + + if( hInFile != INVALID_HANDLE_VALUE ) + { + CloseHandle( hInFile ); + hInFile = INVALID_HANDLE_VALUE; + } + + if( ifs.pitsTracks ) + { + // De-allocate all our track buffers + for( idx = 0; idx < ifs.dwTrackCount; idx++ ) + if( ifs.pitsTracks[idx].pTrackStart ) + GlobalFreePtr( ifs.pitsTracks[idx].pTrackStart ); + + GlobalFreePtr( ifs.pitsTracks ); + ifs.pitsTracks = NULL; + } + } + + +/*****************************************************************************/ +/* RewindConverter() */ +/* */ +/* This little function is an adaptation of the ConverterInit() code which */ +/* resets the tracks without closing and opening the file, thus reducing the */ +/* time it takes to loop back to the beginning when looping. */ +/*****************************************************************************/ +static BOOL RewindConverter( void ) + { + DWORD dwToRead, cbRead, idx; + BOOL fRet; + + PINTRACKSTATE ptsTrack; + + tkCurrentTime = 0; + + for( idx = 0, ptsTrack = ifs.pitsTracks; idx < ifs.dwTrackCount; + ++idx, ++ptsTrack ) + { +/////////////////////////////////////////////////////////////////////////////// +// Here we need to determine if all track data will fit into a single one of +// our track buffers. If not, we need to read in a buffer full and come back +// for more later, saving the file offset to continue from and the amount left +// to read in the track structure. + + SetFilePointer( hInFile, ptsTrack->foTrackStart, NULL, FILE_BEGIN ); + + if( ptsTrack->dwTrackLength > TRACK_BUFFER_SIZE ) + dwToRead = TRACK_BUFFER_SIZE; + else + dwToRead = ptsTrack->dwTrackLength; + if( !ReadFile( hInFile, ptsTrack->pTrackStart, dwToRead, &cbRead, NULL ) + || ( cbRead != dwToRead )) + { + MessageBox( GetActiveWindow(), szInitErrInFile, + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + goto Rewind_Cleanup; + } + // Save the number of bytes that didn't make it into the buffer + ptsTrack->dwLeftOnDisk = ptsTrack->dwTrackLength - cbRead; + ptsTrack->dwLeftInBuffer = cbRead; + // Save the current file offset so we can seek to it later + ptsTrack->foNextReadStart = SetFilePointer( hInFile, 0, + NULL, FILE_CURRENT ); + + // Setup pointer to the current position in the track + ptsTrack->pTrackCurrent = ptsTrack->pTrackStart; + ptsTrack->fdwTrack = 0; + ptsTrack->byRunningStatus = 0; + ptsTrack->tkNextEventDue = 0; + + + // Handle bozo MIDI files which contain empty track chunks + // + if( !ptsTrack->dwLeftInBuffer && !ptsTrack->dwLeftOnDisk ) + { + ptsTrack->fdwTrack |= ITS_F_ENDOFTRK; + continue; + } + + // We always preread the time from each track so the mixer code can + // determine which track has the next event with a minimum of work + // + if( GetTrackVDWord( ptsTrack, &ptsTrack->tkNextEventDue )) + { + MessageBox( GetActiveWindow(), szInitErrInFile, + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + goto Rewind_Cleanup; + } + // Step over any unread data, advancing to the beginning of the next + // track's data + SetFilePointer( hInFile, ptsTrack->foTrackStart + ptsTrack->dwTrackLength, + NULL, FILE_BEGIN ); + } // End of track initialization code + + fRet = FALSE; + + Rewind_Cleanup: + + if( fRet ) + return( TRUE ); + + return( FALSE ); + } + + +/*****************************************************************************/ +/* ConvertToBuffer() */ +/* */ +/* This function converts MIDI data from the track buffers setup by a */ +/* previous call to ConverterInit(). It will convert data until an error is */ +/* encountered or the output buffer has been filled with as much event data */ +/* as possible, not to exceed dwMaxLength. This function can take a couple */ +/* bit flags, passed through dwFlags. Information about the success/failure */ +/* of this operation and the number of output bytes actually converted will */ +/* be returned in the CONVERTINFO structure pointed at by lpciInfo. */ +/* */ +/*****************************************************************************/ +int ConvertToBuffer( DWORD dwFlags, LPCONVERTINFO lpciInfo ) + { + static INTRACKSTATE *ptsTrack, *ptsFound; + static DWORD dwStatus; + static DWORD tkNext; + static TEMPEVENT teTemp; + + int nChkErr; + DWORD idx; + + lpciInfo->dwBytesRecorded = 0; + + if( dwFlags & CONVERTF_RESET ) + { + dwProgressBytes = 0; + dwStatus = 0; + memset( &teTemp, 0, sizeof(TEMPEVENT)); + ptsTrack = ptsFound = NULL; + } + // If we were already done, then return with a warning... + if( dwStatus & CONVERTF_STATUS_DONE ) + { + if( bLooped ) + { + RewindConverter(); + dwProgressBytes = 0; + dwStatus = 0; + } + else + return( CONVERTERR_DONE ); + } + // The caller is asking us to continue, but we're already hosed because we + // previously identified something as corrupt, so complain louder this time. + else if( dwStatus & CONVERTF_STATUS_STUCK ) + { + return( CONVERTERR_STUCK ); + } + else if( dwStatus & CONVERTF_STATUS_GOTEVENT ) + { + // Turn off this bit flag + dwStatus ^= CONVERTF_STATUS_GOTEVENT; + + /* + * The following code for this case is duplicated from below, and is + * designed to handle a "straggler" event, should we have one left over + * from previous processing the last time this function was called. + */ + + // Don't add end of track event 'til we're done + // + if( teTemp.byShortData[0] == MIDI_META + && teTemp.byShortData[1] == MIDI_META_EOT ) + { + if( dwMallocBlocks ) + { + free( teTemp.pLongData ); + dwMallocBlocks--; + } + } + + else if(( nChkErr = AddEventToStreamBuffer( &teTemp, lpciInfo )) + != CONVERTERR_NOERROR ) + { + if( nChkErr == CONVERTERR_BUFFERFULL ) + { + // Do some processing and tell caller that this buffer's full + dwStatus |= CONVERTF_STATUS_GOTEVENT; + return( CONVERTERR_NOERROR ); + } + else if( nChkErr == CONVERTERR_METASKIP ) + { + // We skip by all meta events that aren't tempo changes... + } + else + { + DebugPrint( "Unable to add event to stream buffer." ); + if( dwMallocBlocks ) + { + free( teTemp.pLongData ); + dwMallocBlocks--; + } + return( TRUE ); + } + } + } + + for( ; ; ) + { + ptsFound = NULL; + tkNext = 0xFFFFFFFFL; + // Find nearest event due + // + for( idx = 0, ptsTrack = ifs.pitsTracks; idx < ifs.dwTrackCount; + ++idx, ++ptsTrack ) + { + if(( !( ptsTrack->fdwTrack & ITS_F_ENDOFTRK )) + && ( ptsTrack->tkNextEventDue < tkNext )) + { + tkNext = ptsTrack->tkNextEventDue; + ptsFound = ptsTrack; + } + } + + // None found? We must be done, so return to the caller with a smile. + // + if( !ptsFound ) + { + dwStatus |= CONVERTF_STATUS_DONE; + // Need to set return buffer members properly + return( CONVERTERR_NOERROR ); + } + + // Ok, get the event header from that track + // + if( GetTrackEvent( ptsFound, &teTemp )) + { + // Warn future calls that this converter is stuck at a corrupt spot + // and can't continue + dwStatus |= CONVERTF_STATUS_STUCK; + return( CONVERTERR_CORRUPT ); + } + + // Don't add end of track event 'til we're done + // + if( teTemp.byShortData[0] == MIDI_META + && teTemp.byShortData[1] == MIDI_META_EOT ) + { + if( dwMallocBlocks ) + { + free( teTemp.pLongData ); + dwMallocBlocks--; + } + continue; + } + + if(( nChkErr = AddEventToStreamBuffer( &teTemp, lpciInfo )) + != CONVERTERR_NOERROR ) + { + if( nChkErr == CONVERTERR_BUFFERFULL ) + { + // Do some processing and tell somebody this buffer is full... + dwStatus |= CONVERTF_STATUS_GOTEVENT; + return( CONVERTERR_NOERROR ); + } + else if( nChkErr == CONVERTERR_METASKIP ) + { + // We skip by all meta events that aren't tempo changes... + } + else + { + DebugPrint( "Unable to add event to stream buffer." ); + if( dwMallocBlocks ) + { + free( teTemp.pLongData ); + dwMallocBlocks--; + } + return( TRUE ); + } + } + } + + return( CONVERTERR_NOERROR ); + } + + +// +// GetTrackVDWord +// +// Attempts to parse a variable length DWORD from the given track. A VDWord +// in a MIDI file +// (a) is in lo-hi format +// (b) has the high bit set on every byte except the last +// +// Returns the DWORD in *lpdw and TRUE on success; else +// FALSE if we hit end of track first. Sets ITS_F_ENDOFTRK +// if we hit end of track. +// +static BOOL GetTrackVDWord( PINTRACKSTATE ptsTrack, LPDWORD lpdw ) + { + BYTE byByte; + DWORD dw = 0; + + if( ptsTrack->fdwTrack & ITS_F_ENDOFTRK ) + return( TRUE ); + + do + { + if( !ptsTrack->dwLeftInBuffer && !ptsTrack->dwLeftOnDisk ) + { + ptsTrack->fdwTrack |= ITS_F_ENDOFTRK; + return( TRUE ); + } + + if( GetTrackByte( ptsTrack, &byByte )) + return( TRUE ); + + dw = ( dw << 7 ) | ( byByte & 0x7F ); + } while( byByte & 0x80 ); + + *lpdw = dw; + + return( FALSE ); + } + + +// +// GetTrackEvent +// +// Fills in the event struct with the next event from the track +// +// pteTemp->tkEvent will contain the absolute tick time of the event +// pteTemp->byShortData[0] will contain +// MIDI_META if the event is a meta event; +// in this case pteTemp->byShortData[1] will contain the meta class +// MIDI_SYSEX or MIDI_SYSEXEND if the event is a SysEx event +// Otherwise, the event is a channel message and pteTemp->byShortData[1] +// and pteTemp->byShortData[2] will contain the rest of the event. +// +// pteTemp->dwEventLength will contain +// The total length of the channel message in pteTemp->byShortData if +// the event is a channel message +// The total length of the paramter data pointed to by +// pteTemp->pLongData otherwise +// +// pteTemp->pLongData will point at any additional paramters if the +// event is a SysEx or meta event with non-zero length; else +// it will contain NULL +// +// Returns FALSE on success or TRUE on any kind of parse error +// Prints its own error message ONLY in the debug version +// +// Maintains the state of the input track (i.e. ptsTrack->dwLeftInBuffer, +// ptsTrack->pTrackPointers, and ptsTrack->byRunningStatus). +// +static BOOL GetTrackEvent( INTRACKSTATE *ptsTrack, PTEMPEVENT pteTemp ) + { + DWORD idx; + BYTE byByte; + UINT dwEventLength; + + // Clear out the temporary event structure to get rid of old data... + memset( pteTemp, 0, sizeof(TEMPEVENT)); + + // Already at end of track? There's nothing to read. + // + if(( ptsTrack->fdwTrack & ITS_F_ENDOFTRK ) + || ( !ptsTrack->dwLeftInBuffer && !ptsTrack->dwLeftOnDisk )) + return( TRUE ); + + // Get the first byte, which determines the type of event. + // + if( GetTrackByte( ptsTrack, &byByte )) + return( TRUE ); + + // If the high bit is not set, then this is a channel message + // which uses the status byte from the last channel message + // we saw. NOTE: We do not clear running status across SysEx or + // meta events even though the spec says to because there are + // actually files out there which contain that sequence of data. + // + if( !( byByte & 0x80 )) + { + // No previous status byte? We're hosed. + if( !ptsTrack->byRunningStatus ) + { + TRACKERR(ptsTrack, gteBadRunStat); + return( TRUE ); + } + + pteTemp->byShortData[0] = ptsTrack->byRunningStatus; + pteTemp->byShortData[1] = byByte; + + byByte = pteTemp->byShortData[0] & 0xF0; + pteTemp->dwEventLength = 2; + + // Only program change and channel pressure events are 2 bytes long; + // the rest are 3 and need another byte + // + if(( byByte != MIDI_PRGMCHANGE ) && ( byByte != MIDI_CHANPRESS )) + { + if( !ptsTrack->dwLeftInBuffer && !ptsTrack->dwLeftOnDisk ) + { + TRACKERR( ptsTrack, gteRunStatMsgTrunc ); + ptsTrack->fdwTrack |= ITS_F_ENDOFTRK; + return( TRUE ); + } + + if( GetTrackByte( ptsTrack, &pteTemp->byShortData[2] )) + return( TRUE ); + ++pteTemp->dwEventLength; + } + } + else if(( byByte & 0xF0 ) != MIDI_SYSEX ) + { + // Not running status, not in SysEx range - must be + // normal channel message (0x80-0xEF) + // + pteTemp->byShortData[0] = byByte; + ptsTrack->byRunningStatus = byByte; + + // Strip off channel and just keep message type + // + byByte &= 0xF0; + + dwEventLength = ( byByte == MIDI_PRGMCHANGE || byByte == MIDI_CHANPRESS ) ? 1 : 2; + pteTemp->dwEventLength = dwEventLength + 1; + + if(( ptsTrack->dwLeftInBuffer + ptsTrack->dwLeftOnDisk ) < dwEventLength ) + { + TRACKERR( ptsTrack, gteChanMsgTrunc ); + ptsTrack->fdwTrack |= ITS_F_ENDOFTRK; + return( TRUE ); + } + + if( GetTrackByte( ptsTrack, &pteTemp->byShortData[1] )) + return( TRUE ); + if( dwEventLength == 2 ) + if( GetTrackByte( ptsTrack, &pteTemp->byShortData[2] )) + return( TRUE ); + } + else if(( byByte == MIDI_SYSEX ) || ( byByte == MIDI_SYSEXEND )) + { + // One of the SysEx types. (They are the same as far as we're concerned; + // there is only a semantic difference in how the data would actually + // get sent when the file is played. We must take care to put the proper + // event type back on the output track, however.) + // + // Parse the general format of: + // BYTE bEvent (MIDI_SYSEX or MIDI_SYSEXEND) + // VDWORD cbParms + // BYTE abParms[cbParms] + // + pteTemp->byShortData[0] = byByte; + if( GetTrackVDWord( ptsTrack, &pteTemp->dwEventLength )) + { + TRACKERR( ptsTrack, gteSysExLenTrunc ); + return( TRUE ); + } + + if(( ptsTrack->dwLeftInBuffer + ptsTrack->dwLeftOnDisk ) + < pteTemp->dwEventLength ) + { + TRACKERR( ptsTrack, gteSysExTrunc ); + ptsTrack->fdwTrack |= ITS_F_ENDOFTRK; + return( TRUE ); + } + + // Malloc a temporary memory block to hold the parameter data + if(( pteTemp->pLongData = malloc( pteTemp->dwEventLength )) == NULL ) + { + TRACKERR( ptsTrack, gteNoMem ); + return( TRUE ); + } + // Copy from the input buffer to the parameter data buffer + for( idx = 0; idx < pteTemp->dwEventLength; idx++ ) + if( GetTrackByte( ptsTrack, pteTemp->pLongData + idx )) + { + TRACKERR( ptsTrack, gteSysExTrunc ); + return( TRUE ); + } + // Increment our counter, which tells the program to look around for + // a malloc block to free, should it need to exit or reset before the + // block would normally be freed + dwMallocBlocks++; + } + else if( byByte == MIDI_META ) + { + // It's a meta event. Parse the general form: + // BYTE bEvent (MIDI_META) + // BYTE bClass + // VDWORD cbParms + // BYTE abParms[cbParms] + // + pteTemp->byShortData[0] = byByte; + + if( !ptsTrack->dwLeftInBuffer && !ptsTrack->dwLeftOnDisk ) + { + TRACKERR(ptsTrack, gteMetaNoClass ); + ptsTrack->fdwTrack |= ITS_F_ENDOFTRK; + return( TRUE ); + } + + if( GetTrackByte( ptsTrack, &pteTemp->byShortData[1] )) + return( TRUE ); + + if( GetTrackVDWord( ptsTrack, &pteTemp->dwEventLength )) + { + TRACKERR( ptsTrack, gteMetaLenTrunc ); + return( TRUE ); + } + + // NOTE: It's perfectly valid to have a meta with no data + // In this case, dwEventLength == 0 and pLongData == NULL + // + if( pteTemp->dwEventLength ) + { + if(( ptsTrack->dwLeftInBuffer + ptsTrack->dwLeftOnDisk ) + < pteTemp->dwEventLength ) + { + TRACKERR( ptsTrack, gteMetaTrunc ); + ptsTrack->fdwTrack |= ITS_F_ENDOFTRK; + return( TRUE ); + } + + // Malloc a temporary memory block to hold the parameter data + if(( pteTemp->pLongData = malloc( pteTemp->dwEventLength )) + == NULL ) + { + TRACKERR( ptsTrack, gteNoMem ); + return( TRUE ); + } + // Copy from the input buffer to the parameter data buffer + for( idx = 0; idx < pteTemp->dwEventLength; idx++ ) + if( GetTrackByte( ptsTrack, pteTemp->pLongData + idx )) + { + TRACKERR( ptsTrack, gteMetaTrunc ); + return( TRUE ); + } + // Increment our counter, which tells the program to look around for + // a malloc block to free, should it need to exit or reset before the + // block would normally be freed + dwMallocBlocks++; + } + + if( pteTemp->byShortData[1] == MIDI_META_EOT ) + ptsTrack->fdwTrack |= ITS_F_ENDOFTRK; + } + else + { + // Messages in this range are system messages and aren't supposed to + // be in a normal MIDI file. If they are, we've either misparsed or the + // authoring software is stupid. + // + return( TRUE ); + } + + // Event time was already stored as the current track time + // + pteTemp->tkEvent = ptsTrack->tkNextEventDue; + + // Now update to the next event time. The code above MUST properly + // maintain the end of track flag in case the end of track meta is + // missing. NOTE: This code is a continuation of the track event + // time pre-read which is done at the end of track initialization. + // + if( !( ptsTrack->fdwTrack & ITS_F_ENDOFTRK )) + { + DWORD tkDelta; + + if( GetTrackVDWord( ptsTrack, &tkDelta )) + return( TRUE ); + + ptsTrack->tkNextEventDue += tkDelta; + } + + return( FALSE ); + } + + +// +// GetTrackByte +// +// Retrieve the next byte from the track buffer, refilling the buffer from +// disk if necessary. +// +static BOOL GetTrackByte( PINTRACKSTATE ptsTrack, LPBYTE lpbyByte ) + { + if( !ptsTrack->dwLeftInBuffer ) + { + if( RefillTrackBuffer( ptsTrack )) + return( TRUE ); + } + + *lpbyByte = *ptsTrack->pTrackCurrent++; + ptsTrack->dwLeftInBuffer--; + return( FALSE ); + } + + +// +// RefillTrackBuffer() +// +// This function attempts to read in a buffer-full of data for a MIDI track. +// +BOOL RefillTrackBuffer( PINTRACKSTATE ptsTrack ) + { + DWORD dwBytesRead, dwResult; + BOOL bResult; + + if( ptsTrack->dwLeftOnDisk ) + { + ptsTrack->pTrackCurrent = ptsTrack->pTrackStart; + + // Seek to the proper place in the file, indicated by + // ptsTrack->foNextReadStart and read in the remaining data, + // up to a maximum of the buffer size. + + if(( dwResult = SetFilePointer( hInFile, + (long)ptsTrack->foNextReadStart, + 0L, FILE_BEGIN )) == 0xFFFFFFFF ) + { + MessageBox( GetActiveWindow(), + "Unable to seek to track buffer location in RefillTrackBuffer()!!", + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + return( TRUE ); + } + if( ptsTrack->dwLeftOnDisk > TRACK_BUFFER_SIZE ) + ptsTrack->dwLeftInBuffer = TRACK_BUFFER_SIZE; + else + ptsTrack->dwLeftInBuffer = ptsTrack->dwLeftOnDisk; + bResult = ReadFile( hInFile, ptsTrack->pTrackStart, + ptsTrack->dwLeftInBuffer, + &dwBytesRead, NULL ); + + ptsTrack->dwLeftOnDisk -= dwBytesRead; + ptsTrack->foNextReadStart = dwResult + dwBytesRead; + ptsTrack->dwLeftInBuffer = dwBytesRead; + + if( !bResult || ( bResult && !dwBytesRead ) + || ( bResult && dwBytesRead != ptsTrack->dwLeftInBuffer )) + { + MessageBox( GetActiveWindow(), + "Read operation failed prematurely!!", + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + ptsTrack->dwLeftInBuffer = dwBytesRead; + return( TRUE ); + } + else + return( FALSE ); + } + + return( TRUE ); + } + + +// +// AddEventToStreamBuffer +// +// Put the given event into the given stream buffer at the given location +// pteTemp must point to an event filled out in accordance with the +// description given in GetTrackEvent +// +// Returns FALSE on sucess or TRUE on an error condition +// Handles its own error notification by displaying to the appropriate +// output device (either our debugging window, or the screen). +// +static int AddEventToStreamBuffer( PTEMPEVENT pteTemp, CONVERTINFO *lpciInfo ) + { + DWORD tkNow, tkDelta; + MIDIEVENT *pmeEvent; + + pmeEvent = (MIDIEVENT *)( lpciInfo->mhBuffer.lpData + + lpciInfo->dwStartOffset + + lpciInfo->dwBytesRecorded ); + + // When we see a new, empty buffer, set the start time on it... + if( !lpciInfo->dwBytesRecorded ) + lpciInfo->tkStart = tkCurrentTime; + + // Use the above set start time to figure out how much longer we should fill + // this buffer before officially declaring it as "full" + if( tkCurrentTime - lpciInfo->tkStart > dwBufferTickLength ) + if( lpciInfo->bTimesUp ) + { + lpciInfo->bTimesUp = FALSE; + return( CONVERTERR_BUFFERFULL ); + } + else + lpciInfo->bTimesUp = TRUE; + + tkNow = tkCurrentTime; + + // Delta time is absolute event time minus absolute time + // already gone by on this track + tkDelta = pteTemp->tkEvent - tkCurrentTime; + + // Event time is now current time on this track + tkCurrentTime = pteTemp->tkEvent; + + if( bInsertTempo ) + { + bInsertTempo = FALSE; + + if( lpciInfo->dwMaxLength-lpciInfo->dwBytesRecorded < 3*sizeof(DWORD)) + { + // Cleanup from our write operation + return( CONVERTERR_BUFFERFULL ); + } + if( dwCurrentTempo ) + { + pmeEvent->dwDeltaTime = 0; + pmeEvent->dwStreamID = 0; + pmeEvent->dwEvent = ( dwCurrentTempo * 100 ) / dwTempoMultiplier; + pmeEvent->dwEvent |= (((DWORD)MEVT_TEMPO ) << 24 ) | MEVT_F_SHORT; + + lpciInfo->dwBytesRecorded += 3 * sizeof(DWORD); + pmeEvent += 3 * sizeof(DWORD); + } + } + + if( pteTemp->byShortData[0] < MIDI_SYSEX ) + { + // Channel message. We know how long it is, just copy it. + // Need 3 DWORD's: delta-t, stream-ID, event + if( lpciInfo->dwMaxLength-lpciInfo->dwBytesRecorded < 3*sizeof(DWORD)) + { + // Cleanup from our write operation + return( CONVERTERR_BUFFERFULL ); + } + + pmeEvent->dwDeltaTime = tkDelta; + pmeEvent->dwStreamID = 0; + pmeEvent->dwEvent = ( pteTemp->byShortData[0] ) + | (((DWORD)pteTemp->byShortData[1] ) << 8 ) + | (((DWORD)pteTemp->byShortData[2] ) << 16 ) + | MEVT_F_SHORT; + + if((( pteTemp->byShortData[0] & 0xF0) == MIDI_CTRLCHANGE ) + && ( pteTemp->byShortData[1] == MIDICTRL_VOLUME )) + { + // If this is a volume change, generate a callback so we can grab + // the new volume for our cache + pmeEvent->dwEvent |= MEVT_F_CALLBACK; + } + lpciInfo->dwBytesRecorded += 3 *sizeof(DWORD); + } + else if(( pteTemp->byShortData[0] == MIDI_SYSEX ) + || ( pteTemp->byShortData[0] == MIDI_SYSEXEND )) + { + DebugPrint( "AddEventToStreamBuffer: Ignoring SysEx event." ); + if( dwMallocBlocks ) + { + free( pteTemp->pLongData ); + dwMallocBlocks--; + } + } + else + { + // Better be a meta event. + // BYTE byEvent + // BYTE byEventType + // VDWORD dwEventLength + // BYTE pLongEventData[dwEventLength] + // + assert( pteTemp->byShortData[0] == MIDI_META ); + + // The only meta-event we care about is change tempo + // + if( pteTemp->byShortData[1] != MIDI_META_TEMPO ) + { + if( dwMallocBlocks ) + { + free( pteTemp->pLongData ); + dwMallocBlocks--; + } + return( CONVERTERR_METASKIP ); + } + + // We should have three bytes of parameter data... + assert( pteTemp->dwEventLength == 3 ); + + // Need 3 DWORD's: delta-t, stream-ID, event data + if( lpciInfo->dwMaxLength - lpciInfo->dwBytesRecorded < 3 *sizeof(DWORD)) + { + // Cleanup the temporary event if necessary and return + if( dwMallocBlocks ) + { + free( pteTemp->pLongData ); + dwMallocBlocks--; + } + return( CONVERTERR_BUFFERFULL ); + } + + pmeEvent->dwDeltaTime = tkDelta; + pmeEvent->dwStreamID = 0; + // Note: this is backwards from above because we're converting a single + // data value from hi-lo to lo-hi format... + pmeEvent->dwEvent = ( pteTemp->pLongData[2] ) + | (((DWORD)pteTemp->pLongData[1] ) << 8 ) + | (((DWORD)pteTemp->pLongData[0] ) << 16 ); + + /* This next step has absolutely nothing to do with the conversion of a + * MIDI file to a stream, it's simply put here to add the functionality + * of the tempo slider. If you don't need this, be sure to remove the + * next two lines. + */ + dwCurrentTempo = pmeEvent->dwEvent; + pmeEvent->dwEvent = (pmeEvent->dwEvent * 100 ) / dwTempoMultiplier; + + pmeEvent->dwEvent |= (((DWORD)MEVT_TEMPO ) << 24 ) | MEVT_F_SHORT; + + dwBufferTickLength = ( ifs.dwTimeDivision * 1000 * BUFFER_TIME_LENGTH ) / dwCurrentTempo; + wsprintf( szTemp, "dwBufferTickLength = %lu", dwBufferTickLength ); + DebugPrint( szTemp ); + + if( dwMallocBlocks ) + { + free( pteTemp->pLongData ); + dwMallocBlocks--; + } + lpciInfo->dwBytesRecorded += 3 *sizeof(DWORD); + } + + return( FALSE ); + } + + +#ifdef DEBUG +static void ShowTrackError( PINTRACKSTATE ptsTrack, LPSTR lpszErr ) + { + wsprintf( szTemp, "Track buffer offset %lu", + (DWORD)(ptsTrack->pTrackCurrent - ptsTrack->pTrackStart)); + DebugPrint( szTemp ); + wsprintf( szTemp, "Track total %lu Track left %lu", + ptsTrack->dwTrackLength, ptsTrack->dwLeftInBuffer ); + DebugPrint( szTemp ); + } + +#endif + diff --git a/sdk/samples/mstream/mstream.c b/sdk/samples/mstream/mstream.c new file mode 100644 index 0000000..ab5daa1 --- /dev/null +++ b/sdk/samples/mstream/mstream.c @@ -0,0 +1,925 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: mstream.c + * Content: Illustrates streaming data from a disk MIDI file to a + * MIDI stream buffer for playback. + * + ***************************************************************************/ +#include <windows.h> +#include <windowsx.h> +#include <commctrl.h> +#include <memory.h> +#include <mmreg.h> + +#include "resource.h" +#include "debug.h" +#include "midstuff.h" +#include "mstream.h" + +////////////////////////////////////////////////////////////////////////////// +// Lots of global variables + +char szAppClass[] = "MStreamWndClass"; +char szAppName[] = "MStream"; + +char szAppTitle[64]; +char szAppCaption[64]; +char szOpenFilter[128]; +char szOpenDLGTitle[64]; +char szProgress[64]; +char szTempo[64]; +char szVolume[64]; + +char szTemp[256]; +char szDebug[256]; +char szFileBuffer[MAX_PATH]; +char szFileTitle[MAX_PATH]; + +HWND hWndMain, hWndProgText, hWndProg, hWndVolText, hWndVol, hWndTempoText; +HWND hWndTempo, hWndLoopCheck, hWndPlay, hWndPause, hWndStop; + +HINSTANCE hInst; + +BOOL bFileOpen = FALSE, bPlaying = FALSE, bBuffersPrepared = FALSE; +BOOL bPaused = FALSE, bLooped = FALSE; +UINT uMIDIDeviceID = MIDI_MAPPER, uCallbackStatus; +int nTextControlHeight, nCurrentBuffer, nEmptyBuffers; +DWORD dwBufferTickLength, dwTempoMultiplier, dwCurrentTempo, dwProgressBytes; +DWORD dwVolumePercent, dwVolCache[NUM_CHANNELS]; + +HMIDISTRM hStream; +CONVERTINFO ciStreamBuffers[NUM_STREAM_BUFFERS]; + +// Private to this module... +static HANDLE hBufferReturnEvent; + +// From another module... +extern INFILESTATE ifs; + +/////////////////////////////////////////////////////////////////////////////// +// Module-scope function declarations + +static BOOL InitApp( HINSTANCE ); +static BOOL InitInstance( HINSTANCE, int ); +static void FreeBuffers( void ); + +/****************************************************************************** + * WinMain() + * + * Entry point for all Windows programs - performs initialization, message loop + */ +int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow ) + { + MSG msg; + + hInst = hInstance; + + /* Make sure the common controls are loaded for our use */ + InitCommonControls(); + +// Turn debugging output on or off +#ifdef DEBUG + DbgInitialize( TRUE ); +#else + DbgInitialize( FALSE ); +#endif + + if( !hPrevInstance ) + if( !InitApp( hInstance )) + { + ErrorMessageBox( IDS_ERROR_APPINIT, MB_ICONSTOP ); + return( FALSE ); + } + + if( !InitInstance( hInstance, nCmdShow )) + { + ErrorMessageBox( IDS_ERROR_INSTANCEINIT, MB_ICONSTOP ); + return( FALSE ); + } + + while( GetMessage((LPMSG)&msg, NULL, 0, 0 )) + { + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } + + UnregisterClass( szAppClass, hInstance ); + return( msg.wParam ); + } /* End of WinMain() */ + + +/*****************************************************************************/ +/* InitApp() */ +/* */ +/* Inits things that only need to be created once for the this application */ +/* (like creating the window class). */ +/*****************************************************************************/ +static BOOL InitApp( HINSTANCE hInstance ) + { + WNDCLASS wc; + + /* Set up and register a window class */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpszClassName = szAppClass; + wc.lpfnWndProc = (WNDPROC)MainWindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = sizeof( DWORD ); + wc.hInstance = hInstance; + wc.hIcon = LoadIcon( hInstance, MAKEINTRESOURCE( IDI_ICON3 )); + wc.hCursor = LoadCursor( NULL, IDC_ARROW ); + wc.hbrBackground = (HBRUSH)( COLOR_WINDOW ); + wc.lpszMenuName = MAKEINTRESOURCE( IDR_MAINMENU ); + + if( !RegisterClass( &wc )) + { + ErrorMessageBox( IDS_ERROR_REGISTERCLASS, MB_ICONSTOP ); + return( FALSE ); + } + return( TRUE ); + } /* End of InitApp() */ + + +/*****************************************************************************/ +/* InitInstance() */ +/* */ +/* Performs initialization that must be done for each application instance. */ +/* */ +/*****************************************************************************/ +static BOOL InitInstance( HINSTANCE hInstance, int nCmdShow ) + { + HWND hWnd; + RECT crect; + UINT uCharsRead; + MMRESULT mmrRetVal; + + LoadString( hInstance, IDS_APP_TITLE, szAppTitle, sizeof(szAppTitle)); + LoadString( hInstance, IDS_APP_CAPTION, szAppCaption, sizeof(szAppCaption)); + LoadString( hInstance, IDS_TBTITLE_VOLUME, szVolume, sizeof(szVolume)); + LoadString( hInstance, IDS_TBTITLE_TEMPO, szTempo, sizeof(szTempo)); + LoadString( hInstance, IDS_TBTITLE_PROGRESS, + szProgress, sizeof(szProgress)); + LoadString( hInstance, IDS_OPEN_DLGTITLE, + szOpenDLGTitle, sizeof(szOpenDLGTitle)); +/* This is a little trick designed to allow us to load a common dialog box + * filter string, which is really a concatentation of several NULL-terminated + * strings. Note that while is is possible to enter something else into the + * resource as placeholders for the NULL characters, this has the undesireable + * effect of forcing us to search-and-replace byte-by-byte and doesn't make it + * as easy to internationalize our strings... + */ + memset( szOpenFilter, 0, sizeof(szOpenFilter)); + uCharsRead = LoadString( hInstance, IDS_OPEN_FILTER1, + szOpenFilter, sizeof(szOpenFilter)) + 1; + uCharsRead += LoadString( hInstance, IDS_OPEN_FILTER2, + &szOpenFilter[uCharsRead], + sizeof(szOpenFilter) - uCharsRead ) + 1; + uCharsRead += LoadString( hInstance, IDS_OPEN_FILTER3, + &szOpenFilter[uCharsRead], + sizeof(szOpenFilter) - uCharsRead ) + 1; + LoadString( hInstance, IDS_OPEN_FILTER4, + &szOpenFilter[uCharsRead], + sizeof(szOpenFilter) - uCharsRead ); + + /* Create an application window */ + hWnd = CreateWindow( szAppClass, /* class name */ + szAppCaption, /* caption for window */ + WS_OVERLAPPEDWINDOW, /* style */ + CW_USEDEFAULT, /* x position */ + CW_USEDEFAULT, /* y position */ + CW_USEDEFAULT, /* width */ + CW_USEDEFAULT, /* height */ + NULL, /* parent window */ + NULL, /* menu */ + hInstance, /* instance */ + NULL ); /* parms */ + + if( !hWnd ) + { + ErrorMessageBox( IDS_ERROR_MAINWNDCREATE, MB_ICONSTOP ); + return( FALSE ); + } + + hWndMain = hWnd; + GetClientRect( hWndMain, &crect ); + + /* Create some controls for things like volume, tempo, progress, etc. */ + if( CreateChildren( crect )) + return( FALSE ); + + // Resize window, now that we know the height of the static text controls + SetWindowPos( hWnd, NULL, 0, 0, + 2 * BORDER_SPACE_CX + TEMPO_TB_CX + 2 * CONTROL_SPACE_CX + + VOL_TB_CX + CHECK_CX, + 2 * BORDER_SPACE_CY + nTextControlHeight + TEXT_SPACE_CY + + CONTROL_SPACE_CY + BUTTON_CY + TEMPO_TB_CY, + SWP_NOMOVE | SWP_NOZORDER ); + + ShowWindow( hWnd, nCmdShow ); + UpdateWindow( hWnd ); + + if(( mmrRetVal = midiStreamOpen( &hStream, + &uMIDIDeviceID, + (DWORD)1, (DWORD)MidiProc, + (DWORD)0, + CALLBACK_FUNCTION )) != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + return( FALSE ); + } + + return( TRUE ); + } /* End of InitInstance() */ + + +/****************************************************************************/ +/* MainWindowProc() */ +/* */ +/* Messages for our main window are handled here */ +/* */ +/****************************************************************************/ +LRESULT CALLBACK MainWindowProc( HWND hWnd, unsigned uMsg, + WPARAM wParam, LPARAM lParam ) + { + LPMINMAXINFO lpMinMax; + DWORD dwCDErr = 0; + BOOL bResult = FALSE; + MMRESULT mmrRetVal; + + switch( uMsg ) + { + case WM_CREATE: + hBufferReturnEvent = CreateEvent( NULL, FALSE, + FALSE, "Wait For Buffer Return" ); + break; + + case WM_MSTREAM_UPDATEVOLUME: + SetChannelVolume( wParam, dwVolumePercent ); + break; + + case WM_MSTREAM_PROGRESS: + /* Set the Progress text */ + wsprintf( szTemp, "%s: %lu bytes", szProgress, dwProgressBytes ); + Static_SetText( hWndProgText, szTemp ); + break; + + case WM_COMMAND: + switch( LOWORD( wParam )) + { + case IDM_FILE_OPEN: + { + OPENFILENAME ofn; + /* + * Clear out and fill in an OPENFILENAME structure in preparation + * for creating a common dialog box to open a file. + */ + memset( &ofn, 0, sizeof(OPENFILENAME)); + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hWnd; + ofn.hInstance = hInst; + ofn.lpstrFilter = szOpenFilter; + ofn.nFilterIndex = 1; + szFileBuffer[0] = '\0'; + ofn.lpstrFile = szFileBuffer; + ofn.nMaxFile = sizeof(szFileBuffer); + ofn.lpstrFileTitle = szFileTitle; + ofn.nMaxFileTitle = sizeof(szFileTitle); + ofn.lpstrDefExt = "MID"; + ofn.lpstrTitle = szOpenDLGTitle; + ofn.Flags = OFN_FILEMUSTEXIST; + + bResult = GetOpenFileName( &ofn ); /* Do the dialog box */ + + /* + * A return of TRUE indicates that the user did not select a filename. + * The possible reasons are: Cancel was clicked, or an error occured. + * If Cancel was clicked, the CommDlgExtendedError() function will not + * return a valid code. For anything else, an error code will come back. + */ + if( bResult == FALSE ) + { + dwCDErr = CommDlgExtendedError(); + if( dwCDErr ) + { + /* Handle a common dialog box error */ + HandleCommDlgError( dwCDErr ); + } + else /* Clicked Cancel, so finish msg processing */ + return( 0 ); + } + else + { + if( bFileOpen ) + { +// Need to close the previous file before we open a new one. The best way to +// do this is by faking a menu command, so that we only have the actual code in +// one place and it can easily be changed. + SendMessage( hWnd, WM_COMMAND, + MAKEWPARAM( IDM_FILE_CLOSE, 0 ), 0L ); + } + + if( StreamBufferSetup()) + { + // Error opening the MIDI file so abort + // The function already took care of notification + break; + } + else + { + bFileOpen = TRUE; + EnableWindow( hWndPlay, TRUE ); + BuildTitleBarText(); + } + } + } + break; + + case IDM_FILE_CLOSE: + SendMessage( hWnd, WM_COMMAND, + MAKEWPARAM( IDC_STOP, + MSTREAM_STOPF_NOREOPEN ), 0L ); + BuildTitleBarText(); + break; + + case IDM_HELP_ABOUT: + DialogBox( hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWndMain, + (DLGPROC)DLG_About ); + break; + + case IDM_ACTIONS_PAUSE: + case IDC_PAUSE: + if( bPaused ) + midiStreamRestart( hStream ); + else + midiStreamPause( hStream ); + bPaused = !bPaused; + // If we're paused, the title bar will show (Paused) + BuildTitleBarText(); + break; + + case IDM_ACTIONS_LOOPED: + case IDC_LOOPCHECK: + Button_SetCheck( hWndLoopCheck, !bLooped ); + bLooped = !bLooped; + break; + + case IDM_ACTIONS_PLAY: + case IDC_PLAY: + // Clicking play while playback is paused will un-pause it + if( bPaused ) + { + SendMessage( hWnd, WM_COMMAND, + MAKEWPARAM( IDC_PAUSE, 0 ), 0L ); + break; + } + // Clicking play while playing will restart from scratch + if( bPlaying ) + { + // Stop the file, allowing it to bve reset so that we + // can start it over again from the beginning + SendMessage( hWnd, WM_COMMAND, + MAKEWPARAM( IDC_STOP, 0 ), 0L ); + } + + if( bFileOpen ) + { + // Clear the status of our callback so it will handle + // MOM_DONE callbacks once more + uCallbackStatus = 0; + if(( mmrRetVal = midiStreamRestart( hStream )) + != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + break; + } + } + else + { + bPlaying = FALSE; + break; + } + + bPlaying = TRUE; + EnableWindow( hWndPause, TRUE ); + EnableWindow( hWndStop, TRUE ); + break; + + case IDM_ACTIONS_STOP: + case IDC_STOP: + if( bFileOpen || bPlaying + || ( uCallbackStatus != STATUS_CALLBACKDEAD )) + { + EnableWindow( hWndStop, FALSE ); + EnableWindow( hWndPause, FALSE ); + bPlaying = bPaused = FALSE; + if( uCallbackStatus != STATUS_CALLBACKDEAD && uCallbackStatus != STATUS_WAITINGFOREND ) + uCallbackStatus = STATUS_KILLCALLBACK; + + if(( mmrRetVal = midiStreamStop( hStream )) + != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + break; + } + if(( mmrRetVal = midiOutReset( (HMIDIOUT)hStream )) + != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + break; + } +// Wait for the callback thread to release this thread, which it will do by +// calling SetEvent() once all buffers are returned to it + if( WaitForSingleObject( hBufferReturnEvent, + DEBUG_CALLBACK_TIMEOUT ) + == WAIT_TIMEOUT ) + { +// Note, this is a risky move because the callback may be genuinely busy, but +// when we're debugging, it's safer and faster than freezing the application, +// which leaves the MIDI device locked up and forces a system reset... + DebugPrint( "Timed out waiting for MIDI callback" ); + uCallbackStatus = STATUS_CALLBACKDEAD; + } + } + + if( uCallbackStatus == STATUS_CALLBACKDEAD ) + { + uCallbackStatus = 0; + if( bFileOpen ) + { + ConverterCleanup(); + FreeBuffers(); + if( hStream ) + { + if(( mmrRetVal = midiStreamClose( hStream )) + != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + } + hStream = NULL; + } + + EnableWindow( hWndPlay, FALSE ); + bFileOpen = FALSE; + } + + if(!( HIWORD(wParam) & MSTREAM_STOPF_NOREOPEN )) + { + if( StreamBufferSetup()) + { + // Error setting up for MIDI file + // Notification is already taken care of... + break; + } + else + { + bFileOpen = TRUE; + EnableWindow( hWndPlay, TRUE ); + } + } + BuildTitleBarText(); // Update the title bar + } + break; + + case IDM_FILE_EXIT: + DestroyWindow( hWnd ); + break; + } + break; + + case WM_INITMENU: + if( bFileOpen ) + { + EnableMenuItem( GetMenu( hWnd ), IDM_ACTIONS_PLAY, + MF_BYCOMMAND | MF_ENABLED ); + EnableMenuItem( GetMenu( hWnd ), IDM_FILE_CLOSE, + MF_BYCOMMAND | MF_ENABLED ); + } + else + { + EnableMenuItem( GetMenu( hWnd ), IDM_ACTIONS_PLAY, + MF_BYCOMMAND | MF_GRAYED ); + EnableMenuItem( GetMenu( hWnd ), IDM_FILE_CLOSE, + MF_BYCOMMAND | MF_GRAYED ); + } + if( bLooped ) + EnableMenuItem( GetMenu( hWnd ), IDM_ACTIONS_LOOPED, + MF_BYCOMMAND | MF_ENABLED ); + else + EnableMenuItem( GetMenu( hWnd ), IDM_ACTIONS_LOOPED, + MF_BYCOMMAND | MF_GRAYED ); + if( bPlaying ) + { + EnableMenuItem( GetMenu( hWnd ), IDM_ACTIONS_PAUSE, + MF_BYCOMMAND | MF_ENABLED ); + EnableMenuItem( GetMenu( hWnd ), IDM_ACTIONS_STOP, + MF_BYCOMMAND | MF_ENABLED ); + } + else + { + EnableMenuItem( GetMenu( hWnd ), IDM_ACTIONS_PAUSE, + MF_BYCOMMAND | MF_GRAYED ); + EnableMenuItem( GetMenu( hWnd ), IDM_ACTIONS_STOP, + MF_BYCOMMAND | MF_GRAYED ); + } + break; + + case WM_GETMINMAXINFO: + /* + * We know exactly how big this window should be, and it's sort of a + * little pop-up control panel, so we can disable window sizing by + * forcing all the minimum and maximum sizes to be the calculated size. + */ + lpMinMax = (LPMINMAXINFO)lParam; + + lpMinMax->ptMaxSize.x = 2*CONTROL_SPACE_CX + 2*BORDER_SPACE_CX + + CHECK_CX + TEMPO_TB_CX + VOL_TB_CX + + 2*GetSystemMetrics( SM_CXBORDER ); + lpMinMax->ptMaxSize.y = 2*(BORDER_SPACE_CY + + GetSystemMetrics( SM_CYBORDER )) + + TEXT_SPACE_CY + nTextControlHeight + + TEMPO_TB_CY + BUTTON_CY + + CONTROL_SPACE_CY + + GetSystemMetrics( SM_CYMENU ) + + GetSystemMetrics( SM_CYCAPTION ); + + lpMinMax->ptMinTrackSize.x = lpMinMax->ptMaxTrackSize.x + = lpMinMax->ptMaxSize.x; + + lpMinMax->ptMinTrackSize.y = lpMinMax->ptMaxTrackSize.y + = lpMinMax->ptMaxSize.y; + break; + + case WM_HSCROLL: + if(((HWND)lParam == hWndTempo) && bFileOpen ) + { + HandleTempoScroll( (int)LOWORD(wParam), (int)HIWORD(wParam)); + } + else if(((HWND)lParam == hWndVol) && bFileOpen ) + { + HandleVolScroll( (int)LOWORD(wParam), (int)HIWORD(wParam)); + } + break; + + case WM_ENDSESSION: + // If the sesson is ending, we need to do our WM_DESTROY processing + if (!wParam) break; + // NOTE!!! we are falling through to the WM_CLOSE processing. + case WM_DESTROY: + // Stop anything that might be playing and send a flag which will + // tell the code not to automatically reload the file for replay. + if( hStream ) + SendMessage( hWnd, WM_COMMAND, + MAKEWPARAM( IDC_STOP, MSTREAM_STOPF_NOREOPEN ), 0 ); + + FreeBuffers(); + + if( hStream ) + { + if(( mmrRetVal = midiStreamClose( hStream )) + != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + } + hStream = NULL; + } + + CloseHandle( hBufferReturnEvent ); + + PostQuitMessage( 0 ); + break; + + default: + return DefWindowProc( hWnd, uMsg, wParam, lParam ); + } + return 0L; + } /* MainWindowProc */ + + +/*****************************************************************************/ +/* DLG_About() */ +/* */ +/* Dialog procedure for the Help...About... box which simply pops up a */ +/* little copyright message and brief program description. */ +/* */ +/*****************************************************************************/ +BOOL CALLBACK DLG_About( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) + { + switch( msg ) + { + case WM_INITDIALOG: + break; + + case WM_COMMAND: + switch( LOWORD(wParam)) + { + case IDOK: + EndDialog( hDlg, FALSE ); + return( TRUE ); + + default: + break; + } + break; + + default: + return( FALSE ); + } + + return( FALSE ); + } + + +/*****************************************************************************/ +/* FreeBuffers() */ +/* */ +/* This function unprepares and frees all our buffers -- something we must */ +/* do to work around a bug in MMYSYSTEM that prevents a device from playing */ +/* back properly unless it is closed and reopened after each stop. */ +/*****************************************************************************/ +void FreeBuffers( void ) + { + DWORD idx; + MMRESULT mmrRetVal; + + if( bBuffersPrepared ) + { + for( idx = 0; idx < NUM_STREAM_BUFFERS; idx++ ) + if(( mmrRetVal = midiOutUnprepareHeader( (HMIDIOUT)hStream, + &ciStreamBuffers[idx].mhBuffer, + sizeof(MIDIHDR))) + != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + } + bBuffersPrepared = FALSE; + } + // Free our stream buffers... + for( idx = 0; idx < NUM_STREAM_BUFFERS; idx++ ) + if( ciStreamBuffers[idx].mhBuffer.lpData ) + { + GlobalFreePtr( ciStreamBuffers[idx].mhBuffer.lpData ); + ciStreamBuffers[idx].mhBuffer.lpData = NULL; + } + } + + +/*****************************************************************************/ +/* StreamBufferSetup() */ +/* */ +/* This function uses the filename stored in the global character array to*/ +/* open a MIDI file. Then it goes about converting at least the first part of*/ +/* that file into a midiStream buffer for playback. */ +/*****************************************************************************/ +BOOL StreamBufferSetup( void ) + { + int nChkErr; + BOOL bFoundEnd = FALSE; + DWORD dwConvertFlag, idx; + + MMRESULT mmrRetVal; + MIDIPROPTIMEDIV mptd; + + if( !hStream ) + if(( mmrRetVal = midiStreamOpen( &hStream, + &uMIDIDeviceID, + (DWORD)1, (DWORD)MidiProc, + (DWORD)0, + CALLBACK_FUNCTION )) != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + return( TRUE ); + } + + for( idx = 0; idx < NUM_STREAM_BUFFERS; idx++ ) + { + ciStreamBuffers[idx].mhBuffer.dwBufferLength = OUT_BUFFER_SIZE; + if(( ciStreamBuffers[idx].mhBuffer.lpData + = GlobalAllocPtr( GHND, OUT_BUFFER_SIZE )) == NULL ) + { + // Buffers we already allocated will be killed by WM_DESTROY + // after we fail on the create by returning with -1 + return( -1 ); + } + } + if( ConverterInit( szFileBuffer )) + return( TRUE ); + + // Initialize the volume cache array to some pre-defined value + for( idx = 0; idx < NUM_CHANNELS; idx++ ) + dwVolCache[idx] = VOL_CACHE_INIT; + + mptd.cbStruct = sizeof(mptd); + mptd.dwTimeDiv = ifs.dwTimeDivision; + if(( mmrRetVal = midiStreamProperty( hStream, (LPBYTE)&mptd, + MIDIPROP_SET | MIDIPROP_TIMEDIV )) + != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + ConverterCleanup(); + return( TRUE ); + } + + nEmptyBuffers = 0; + dwConvertFlag = CONVERTF_RESET; + + for( nCurrentBuffer = 0; nCurrentBuffer < NUM_STREAM_BUFFERS; + nCurrentBuffer++ ) + { + // Tell the converter to convert up to one entire buffer's length of output + // data. Also, set a flag so it knows to reset any saved state variables it + // may keep from call to call. + ciStreamBuffers[nCurrentBuffer].dwStartOffset = 0; + ciStreamBuffers[nCurrentBuffer].dwMaxLength = OUT_BUFFER_SIZE; + ciStreamBuffers[nCurrentBuffer].tkStart = 0; + ciStreamBuffers[nCurrentBuffer].bTimesUp = FALSE; + + if(( nChkErr = ConvertToBuffer( dwConvertFlag, + &ciStreamBuffers[nCurrentBuffer] )) + != CONVERTERR_NOERROR ) + { + if( nChkErr == CONVERTERR_DONE ) + { + bFoundEnd = TRUE; + } + else + { + DebugPrint( "Initial conversion pass failed" ); + ConverterCleanup(); + return( TRUE ); + } + } + ciStreamBuffers[nCurrentBuffer].mhBuffer.dwBytesRecorded + = ciStreamBuffers[nCurrentBuffer].dwBytesRecorded; + + if( !bBuffersPrepared ) + if(( mmrRetVal = midiOutPrepareHeader( (HMIDIOUT)hStream, + &ciStreamBuffers[nCurrentBuffer].mhBuffer, + sizeof(MIDIHDR))) != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + ConverterCleanup(); + return( TRUE ); + } + if(( mmrRetVal = midiStreamOut( hStream, + &ciStreamBuffers[nCurrentBuffer].mhBuffer, + sizeof(MIDIHDR))) != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + break; + } + dwConvertFlag = 0; + + if( bFoundEnd ) + break; + } + + bBuffersPrepared = TRUE; + nCurrentBuffer = 0; + UpdateFromControls(); + return( FALSE ); + } + + +/*****************************************************************************/ +/* MidiProc() */ +/* */ +/* This is the callback handler which continually refills MIDI data buffers*/ +/* as they're returned to us from the audio subsystem. */ +/*****************************************************************************/ +void CALLBACK MidiProc( HMIDIIN hMidi, UINT uMsg, DWORD dwInstance, + DWORD dwParam1, DWORD dwParam2 ) + { + static int nWaitingBuffers = 0; + MIDIEVENT *pme; + MIDIHDR *pmh; + + MMRESULT mmrRetVal; + int nChkErr; + + + switch( uMsg ) + { + case MOM_DONE: + if( uCallbackStatus == STATUS_CALLBACKDEAD ) + return; + + nEmptyBuffers++; + + if( uCallbackStatus == STATUS_WAITINGFOREND ) + { + if( nEmptyBuffers < NUM_STREAM_BUFFERS ) + { + return; + } + else + { + uCallbackStatus = STATUS_CALLBACKDEAD; + PostMessage( hWndMain, WM_COMMAND, + MAKEWPARAM( IDC_STOP, 0 ), 0L ); + SetEvent( hBufferReturnEvent ); + return; + } + } + + // This flag is set whenever the callback is waiting for all buffers to + // come back. + if( uCallbackStatus == STATUS_KILLCALLBACK ) + { + // Count NUM_STREAM_BUFFERS-1 being returned for the last time + if( nEmptyBuffers < NUM_STREAM_BUFFERS ) + { + return; + } + // Then send a stop message when we get the last buffer back... + else + { + // Change the status to callback dead + uCallbackStatus = STATUS_CALLBACKDEAD; + SetEvent( hBufferReturnEvent ); + return; + } + } + + dwProgressBytes + += ciStreamBuffers[nCurrentBuffer].mhBuffer.dwBytesRecorded; + PostMessage( hWndMain, WM_MSTREAM_PROGRESS, 0L, 0L ); + +/////////////////////////////////////////////////////////////////////////////// +// Fill an available buffer with audio data again... + + if( bPlaying && nEmptyBuffers ) + { + ciStreamBuffers[nCurrentBuffer].dwStartOffset = 0; + ciStreamBuffers[nCurrentBuffer].dwMaxLength = OUT_BUFFER_SIZE; + ciStreamBuffers[nCurrentBuffer].tkStart = 0; + ciStreamBuffers[nCurrentBuffer].dwBytesRecorded = 0; + ciStreamBuffers[nCurrentBuffer].bTimesUp = FALSE; + + if(( nChkErr = ConvertToBuffer( 0, + &ciStreamBuffers[nCurrentBuffer] )) + != CONVERTERR_NOERROR ) + { + if( nChkErr == CONVERTERR_DONE ) + { + // Don't include this one in the count + nWaitingBuffers = NUM_STREAM_BUFFERS - 1; + uCallbackStatus = STATUS_WAITINGFOREND; + return; + } + else + { + DebugPrint( "MidiProc() conversion pass failed!" ); + ConverterCleanup(); + return; + } + } + + ciStreamBuffers[nCurrentBuffer].mhBuffer.dwBytesRecorded + = ciStreamBuffers[nCurrentBuffer].dwBytesRecorded; + + if(( mmrRetVal = midiStreamOut( hStream, + &ciStreamBuffers[nCurrentBuffer].mhBuffer, + sizeof(MIDIHDR))) != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + ConverterCleanup(); + return; + } + nCurrentBuffer = ( nCurrentBuffer + 1 ) % NUM_STREAM_BUFFERS; + nEmptyBuffers--; + } + + break; + + case MOM_POSITIONCB: + pmh = (MIDIHDR *)dwParam1; + pme = (MIDIEVENT *)(pmh->lpData + pmh->dwOffset); + if( MIDIEVENT_TYPE( pme->dwEvent ) == MIDI_CTRLCHANGE ) + { + if( MIDIEVENT_DATA1( pme->dwEvent ) == MIDICTRL_VOLUME_LSB ) + { + DebugPrint( "Got an LSB volume event" ); + break; + } + if( MIDIEVENT_DATA1( pme->dwEvent ) != MIDICTRL_VOLUME ) + break; + + // Mask off the channel number and cache the volume data byte + dwVolCache[ MIDIEVENT_CHANNEL( pme->dwEvent )] + = MIDIEVENT_VOLUME( pme->dwEvent ); + // Post a message so that the main program knows to counteract + // the effects of the volume event in the stream with its own + // generated event which reflects the proper trackbar position. + PostMessage( hWndMain, WM_MSTREAM_UPDATEVOLUME, + MIDIEVENT_CHANNEL( pme->dwEvent ), 0L ); + } + break; + + default: + break; + } + + return; + } diff --git a/sdk/samples/mstream/mstream.def b/sdk/samples/mstream/mstream.def new file mode 100644 index 0000000..64c3af9 --- /dev/null +++ b/sdk/samples/mstream/mstream.def @@ -0,0 +1,8 @@ +NAME MSTREAM + +DESCRIPTION 'midiStream Conversion/Playback Example' + +EXPORTS + DLG_About + MainWindowProc + MidiProc diff --git a/sdk/samples/mstream/mstream.h b/sdk/samples/mstream/mstream.h new file mode 100644 index 0000000..b21134a --- /dev/null +++ b/sdk/samples/mstream/mstream.h @@ -0,0 +1,145 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: MStream.h + * Content: Main header file for the MSTREAM sample application + * + ***************************************************************************/ +#ifndef __MSTREAM_INCLUDED__ +#define __MSTREAM_INCLUDED__ + +/*****************************************************************************/ +/* Controls for buffer size, etc. */ + +#define TRACK_BUFFER_SIZE 1024 +#define OUT_BUFFER_SIZE 1024 // Max stream buffer size in bytes +#define BUFFER_TIME_LENGTH 60 // Amount to fill in milliseconds +#define NUM_STREAM_BUFFERS 2 + +#define DEBUG_CALLBACK_TIMEOUT 2000 // Wait 2 seconds for callback + +/*****************************************************************************/ +/* A bunch of constants used for calculating position */ +/* and size of child controls for the main window. */ + +#define BORDER_SPACE_CX 10 +#define BORDER_SPACE_CY 10 +#define CONTROL_SPACE_CX 4 +#define CONTROL_SPACE_CY 4 +#define TEXT_SPACE_CY 3 +#define TEXT_SPACE_CX 2 + +#define BUTTON_CX 68 +#define BUTTON_CY 26 +#define CHECK_CX 68 +#define CHECK_CY 26 +#define BUTTON_SPACE_CX 4 +#define BUTTON_SPACE_CY 4 +#define CHECK_SPACE_CY 4 + +#define TEMPO_TB_CX 150 +#define TEMPO_TB_CY 32 +#define VOL_TB_CX 150 +#define VOL_TB_CY 32 + +#define TEMPO_TEXT_CX TEMPO_TB_CX +#define VOL_TEXT_CX VOL_TB_CX + +#define VOL_TB_MIN 0 +#define VOL_TB_MAX 1000 +#define VOL_PAGESIZE 10 +#define VOL_MIN 0 +#define VOL_MAX 127 +#define VOL_CACHE_INIT 100 +#define TEMPO_MIN 1 +#define TEMPO_MAX 500 +#define TEMPO_PAGESIZE 10 + + +#define WM_MSTREAM_PROGRESS (WM_USER + 100) +#define WM_MSTREAM_UPDATEVOLUME (WM_USER + 101) + +/*****************************************************************************/ +/* All sorts of bit flags and error codes for */ +/* communicating between various subsystems. */ + +#define MSTREAM_STOPF_NOREOPEN 0x0001 + +#define STREAMF_BUFFER_WARNING 0x00000002 + +#define CONVERTF_RESET 0x00000001 + +#define CONVERTF_STATUS_DONE 0x00000001 +#define CONVERTF_STATUS_STUCK 0x00000002 +#define CONVERTF_STATUS_GOTEVENT 0x00000004 + +#define CONVERTERR_NOERROR 0 // No error occured +#define CONVERTERR_CORRUPT -101 // The input file is corrupt +// The converter has already encountered a corrupt file and cannot convert any +// more of this file -- you must reset the converter +#define CONVERTERR_STUCK -102 +#define CONVERTERR_DONE -103 // Converter is done +#define CONVERTERR_BUFFERFULL -104 // The buffer is full +#define CONVERTERR_METASKIP -105 // Skipping unknown meta event + +#define STATUS_KILLCALLBACK 100 // Signals that the callback should die +#define STATUS_CALLBACKDEAD 200 // Signals callback is done processing +#define STATUS_WAITINGFOREND 300 // Callback's waiting for buffers to play + +#define VOLUME_BUFFER 3567 // Random value which acts as a buffer id + + +#ifdef DEBUG +#define DebugPrint( sz ) DPF( 3, sz ) +#else +#define DebugPrint( sz ) +#endif + + + +/* + * This structure is used to pass information to the ConvertToBuffer() + * system and then internally by that function to send information about the + * target stream buffer and current state of the conversion process to lower + * level conversion routines internal to the MSTRCONV module. See that source + * file for specific details. + */ +typedef struct _ConvertInfo +{ + MIDIHDR mhBuffer; // Standard Windows stream buffer header + DWORD dwStartOffset; // Start offset from mhStreamBuffer.lpStart + DWORD dwMaxLength; // Max length to convert on this pass + + DWORD dwBytesRecorded; // Used internally by the MSTRCONV module + DWORD tkStart; // Used internally by the MSTRCONV module + BOOL bTimesUp; // Used internally by the MSTRCONV module +} CONVERTINFO, *LPCONVERTINFO; + + +/*****************************************************************************/ +/* Function declarations */ + +LRESULT CALLBACK MainWindowProc( HWND, unsigned, WPARAM, LPARAM ); +BOOL CALLBACK DLG_About( HWND, UINT, WPARAM, LPARAM ); +void CALLBACK MidiProc( HMIDIIN, UINT, DWORD, DWORD, DWORD ); + +void BuildTitleBarText( void ); +void ErrorMessageBox( UINT, DWORD ); +void HandleTempoScroll( int, int ); +void HandleVolScroll( int, int ); +void MidiErrorMessageBox( MMRESULT ); +void SetAllChannelVolumes( DWORD dwVolumePercent ); +void SetChannelVolume( DWORD dwChannel, DWORD dwVolumePercent ); +void UpdateFromControls( void ); + +int CreateChildren( RECT ); +int HandleCommDlgError( DWORD ); +BOOL StreamBufferSetup( void ); + +BOOL ConverterInit( LPSTR szInFile ); +void ConverterCleanup( void ); +int ConvertToBuffer( DWORD, LPCONVERTINFO ); + +#endif /* __MSTREAM_INCLUDED__ */ + diff --git a/sdk/samples/mstream/mstream.mak b/sdk/samples/mstream/mstream.mak new file mode 100644 index 0000000..2ab6c58 --- /dev/null +++ b/sdk/samples/mstream/mstream.mak @@ -0,0 +1,242 @@ +# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=Win32 Debug +!MESSAGE No configuration specified. Defaulting to Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "MSTREAM.MAK" CFG="Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "Win32 Debug" +MTL=MkTypLib.exe +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "WinRel" +# PROP BASE Intermediate_Dir "WinRel" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "retail" +# PROP Intermediate_Dir "retail" +OUTDIR=.\retail +INTDIR=.\retail + +ALL : $(OUTDIR)/MSTREAM.exe $(OUTDIR)/MSTREAM.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c +CPP_PROJ=/nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\ + /FR$(INTDIR)/ /Fp$(OUTDIR)/"MSTREAM.pch" /Fo$(INTDIR)/ /c +CPP_OBJS=.\retail/ +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo$(INTDIR)/"MSTREAM.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"MSTREAM.bsc" +BSC32_SBRS= \ + $(INTDIR)/MSTRCONV.SBR \ + $(INTDIR)/MSTREAM.SBR \ + $(INTDIR)/DEBUG.SBR \ + $(INTDIR)/MSTRHELP.SBR + +$(OUTDIR)/MSTREAM.bsc : $(OUTDIR) $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:windows /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib uuid.lib comctl32.lib winmm.lib /NOLOGO /SUBSYSTEM:windows /MACHINE:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib\ + uuid.lib comctl32.lib winmm.lib /NOLOGO /SUBSYSTEM:windows /INCREMENTAL:no\ + /PDB:$(OUTDIR)/"MSTREAM.pdb" /MACHINE:I386 /DEF:".\MSTREAM.DEF"\ + /OUT:$(OUTDIR)/"MSTREAM.exe" +DEF_FILE=.\MSTREAM.DEF +LINK32_OBJS= \ + $(INTDIR)/MSTRCONV.OBJ \ + $(INTDIR)/MSTREAM.OBJ \ + $(INTDIR)/DEBUG.OBJ \ + $(INTDIR)/MSTREAM.res \ + $(INTDIR)/MSTRHELP.OBJ + +$(OUTDIR)/MSTREAM.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "WinDebug" +# PROP BASE Intermediate_Dir "WinDebug" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "debug" +# PROP Intermediate_Dir "debug" +OUTDIR=.\debug +INTDIR=.\debug + +ALL : $(OUTDIR)/MSTREAM.exe $(OUTDIR)/MSTREAM.bsc + +$(OUTDIR) : + if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /D "DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /D "DEBUG" /win32 +# ADD BASE CPP /nologo /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c +# ADD CPP /nologo /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "DEBUG" /FR /c +CPP_PROJ=/nologo /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D\ + "DEBUG" /FR$(INTDIR)/ /Fp$(OUTDIR)/"MSTREAM.pch" /Fo$(INTDIR)/\ + /Fd$(OUTDIR)/"MSTREAM.pdb" /c +CPP_OBJS=.\debug/ +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" /d "DEBUG" +RSC_PROJ=/l 0x409 /fo$(INTDIR)/"MSTREAM.res" /d "_DEBUG" /d "DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o$(OUTDIR)/"MSTREAM.bsc" +BSC32_SBRS= \ + $(INTDIR)/MSTRCONV.SBR \ + $(INTDIR)/MSTREAM.SBR \ + $(INTDIR)/DEBUG.SBR \ + $(INTDIR)/MSTRHELP.SBR + +$(OUTDIR)/MSTREAM.bsc : $(OUTDIR) $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:windows /DEBUG /MACHINE:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib uuid.lib comctl32.lib winmm.lib /NOLOGO /SUBSYSTEM:windows /INCREMENTAL:no /DEBUG /MACHINE:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib\ + uuid.lib comctl32.lib winmm.lib /NOLOGO /SUBSYSTEM:windows /INCREMENTAL:no\ + /PDB:$(OUTDIR)/"MSTREAM.pdb" /DEBUG /MACHINE:I386 /DEF:".\MSTREAM.DEF"\ + /OUT:$(OUTDIR)/"MSTREAM.exe" +DEF_FILE=.\MSTREAM.DEF +LINK32_OBJS= \ + $(INTDIR)/MSTRCONV.OBJ \ + $(INTDIR)/MSTREAM.OBJ \ + $(INTDIR)/DEBUG.OBJ \ + $(INTDIR)/MSTREAM.res \ + $(INTDIR)/MSTRHELP.OBJ + +$(OUTDIR)/MSTREAM.exe : $(OUTDIR) $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Group "Source Files" + +################################################################################ +# Begin Source File + +SOURCE=.\MSTRCONV.C +DEP_MSTRC=\ + .\DEBUG.H\ + .\MSTREAM.H\ + .\MIDSTUFF.H + +$(INTDIR)/MSTRCONV.OBJ : $(SOURCE) $(DEP_MSTRC) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\MSTREAM.C +DEP_MSTRE=\ + \dev\inc\mmreg.h\ + .\DEBUG.H\ + .\MIDSTUFF.H\ + .\MSTREAM.H + +$(INTDIR)/MSTREAM.OBJ : $(SOURCE) $(DEP_MSTRE) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\MSTREAM.DEF +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\DEBUG.C +DEP_DEBUG=\ + .\DEBUG.H + +$(INTDIR)/DEBUG.OBJ : $(SOURCE) $(DEP_DEBUG) $(INTDIR) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\MSTREAM.RC +DEP_MSTREA=\ + .\ico00001.ico + +$(INTDIR)/MSTREAM.res : $(SOURCE) $(DEP_MSTREA) $(INTDIR) + $(RSC) $(RSC_PROJ) $(SOURCE) + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\MSTRHELP.C +DEP_MSTRH=\ + \dev\inc\mmreg.h\ + .\DEBUG.H\ + .\MIDSTUFF.H\ + .\MSTREAM.H + +$(INTDIR)/MSTRHELP.OBJ : $(SOURCE) $(DEP_MSTRH) $(INTDIR) + +# End Source File +# End Group +# End Project +################################################################################ diff --git a/sdk/samples/mstream/mstream.rc b/sdk/samples/mstream/mstream.rc new file mode 100644 index 0000000..a7016e1 --- /dev/null +++ b/sdk/samples/mstream/mstream.rc @@ -0,0 +1,253 @@ +//Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "winver.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINMENU MENU PRELOAD DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Open...", IDM_FILE_OPEN + MENUITEM "&Close", IDM_FILE_CLOSE, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit", IDM_FILE_EXIT + END + POPUP "&Actions" + BEGIN + MENUITEM "&Play", IDM_ACTIONS_PLAY + MENUITEM "P&ause", IDM_ACTIONS_PAUSE + MENUITEM "&Stop", IDM_ACTIONS_STOP + MENUITEM SEPARATOR + MENUITEM "&Looped", IDM_ACTIONS_LOOPED + END + POPUP "&Help" + BEGIN + MENUITEM "&About...", IDM_HELP_ABOUT + END +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +///////////////////////////////////////////////////////////////////////////// +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 196, 93 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "About DSStream" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,73,73,50,14 + LTEXT "MidiStream Sample Application",IDC_STATIC,44,8,128,8 + ICON IDI_ICON3,IDC_STATIC,8,8,18,20 + LTEXT "Copyright \251 1995-1996 Microsoft Corporation",IDC_STATIC, + 44,18,128,8 + LTEXT "Illustrates real-time conversion of MIDI file data to MIDI stream data for playback using the midiStream API.", + IDC_STATIC,44,40,144,24 + CONTROL "",IDC_STATIC,"Static",SS_BLACKRECT,44,32,144,1 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +IDI_ICON3 ICON DISCARDABLE "ico00001.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Microsoft Corporation\0" + VALUE "FileDescription", "dsstream\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "dsstream\0" + VALUE "LegalCopyright", "Copyright \251 1995\0" + VALUE "OriginalFilename", "dsstream.exe\0" + VALUE "ProductName", "DirectSound Stream Playback Sample Application\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CDERR_GENERAL_BASE "Common Dialog Subsystem Error" + IDS_CDERR_FINDRESFAILURE "Could not find a required resource." + IDS_CDERR_INITIALIZATION + "Initialization failed: Memory resources may be running low." + IDS_CDERR_LOADRESFAILURE "Could not load a required resource." + IDS_CDERR_LOCKRESFAILURE "Could not lock a required resource." + IDS_CDERR_LOADSTRFAILURE "Could not load a required string resource" + IDS_CDERR_MEMALLOCFAILURE + "Unable to allocate sufficient memory for internal data structures: memory resources may be running low." + IDS_CDERR_MEMLOCKFAILURE "Could not lock a memory resource." + IDS_CDERR_NOHINSTANCE "The caller attempted to use a dialog template with specifiying an instance handle" + IDS_CDERR_NOHOOK "The caller requested use of a hook procedure, but failed to provide one." + IDS_CDERR_NOTEMPLATE "The caller requested use of a dialog template, but failed to provide one." + IDS_CDERR_REGISTERMSGFAIL + "The common dialog subsystem was unable to register a private message using RegisterWindowMessage()." + IDS_CDERR_STRUCTSIZE "The common dialog subsystem received a structure with an improper size member." + IDS_CDERR_DIALOGFAILURE "Unable to create dialog box." + IDS_CDERR_TITLESTRING "Common Dialog Error!" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "MidiStream" + IDS_APP_CAPTION "MidiStream Sample Application" + IDS_APP_NAME "MStream" + IDS_OPEN_DLGTITLE "Open MIDI File for Playback" + IDS_OPEN_FILTER1 "MIDI Music Files (*.MID)" + IDS_OPEN_FILTER2 "*.MID" + IDS_OPEN_FILTER3 "All Files (*.*)" + IDS_OPEN_FILTER4 "*.*" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ERROR_APPINIT "Could not initialize application" + IDS_ERROR_INSTANCEINIT "Could not initialize an instance of this application" + IDS_ERROR_REGISTERCLASS "RegisterClass() failed while attempting to register the main application window class" + IDS_ERROR_MAINWNDCREATE "Could not create the main application window: CreateWindow() failed." + IDS_ERROR_NOMIDIMAPPER "The Microsoft MIDI Mapper device, which is required for MSTREAM playback, could not be opened. It is either in use or improperly configured." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ERROR_CHILDTEMPLATE "Unable to create the %s %s control -- CreateWindow() failed in CreateChildren(). Resources may be running low." + IDS_ERROR_TRACKBAR "Trackbar" + IDS_ERROR_BUTTON "Button" + IDS_ERROR_STATICTEXT "Static Text" + IDS_ERROR_GETTEXTEXTENT "Unable to determine text size while creating child controls: GetTextExtentPoint32() failed." + IDS_ERROR_CHECK "Checkbox" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_TBTITLE_PAN "Pan" + IDS_TBTITLE_VOLUME "Volume" + IDS_TBTITLE_FREQUENCY "Frequency" + IDS_TBTITLE_PROGRESS "Progress" + IDS_BUTTON_PLAY "Play" + IDS_BUTTON_STOP "Stop" + IDS_CHECK_LOOPED "Looped" + IDS_TBTITLE_TEMPO "Tempo" + IDS_BUTTON_PAUSE "Pause" +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""winver.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +///////////////////////////////////////////////////////////////////////////// +#endif // APSTUDIO_INVOKED + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sdk/samples/mstream/mstrhelp.c b/sdk/samples/mstream/mstrhelp.c new file mode 100644 index 0000000..1b068fa --- /dev/null +++ b/sdk/samples/mstream/mstrhelp.c @@ -0,0 +1,502 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: mstream.c + * Content: Illustrates streaming data from a disk MIDI file to a + * midiStream buffer for playback. + * + ***************************************************************************/ +#include <windows.h> +#include <windowsx.h> +#include <commctrl.h> +#include <memory.h> +#include <mmreg.h> + +#include "debug.h" +#include "resource.h" +#include "midstuff.h" +#include "mstream.h" + +extern char szAppTitle[64]; +extern char szAppCaption[64]; +extern char szFileBuffer[64]; +extern char szFileTitle[64]; +extern char szTempo[64]; +extern char szVolume[64]; +extern char szProgress[64]; +extern char szTemp[256]; +extern char szDebug[256]; + +extern HWND hWndMain, hWndTempo, hWndVol, hWndProg, hWndPlay, hWndPause; +extern HWND hWndStop, hWndTempoText, hWndVolText, hWndLoopCheck, hWndProgText; +extern HINSTANCE hInst; +extern HMIDISTRM hStream; + +extern BOOL bFileOpen, bPlaying, bPaused, bInsertTempo; +extern int nTextControlHeight; +extern DWORD dwBufferTickLength, dwTempoMultiplier, dwCurrentTempo; +extern DWORD dwProgressBytes, dwVolumePercent, dwVolCache[NUM_CHANNELS]; + +#ifdef DEBUG +extern HWND hWndList; +#endif + +/*****************************************************************************/ +/* CreateChildren() */ +/* */ +/* This function creates a bunch of child controls for the main window. */ +/* Most of them are used for controling various things about a playing sound */ +/* file, like volume and panning. Returns FALSE if no errors, TRUE otherwise.*/ +/* */ +/*****************************************************************************/ +int CreateChildren( RECT crect ) + { + SIZE Size; + HDC hDC; + int x, y; + UINT uType; + char szTemplate[128], szType[32]; + LPSTR lpszControl; + + LoadString( hInst, IDS_ERROR_CHILDTEMPLATE, szTemplate, sizeof(szTemplate)); + + /* Don't handle failure for this one, because the app will still run fine */ + CreateWindow( "static", NULL, WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, + 0, 0, crect.right, 2, hWndMain, (HMENU)0, hInst, NULL ); + + hDC = GetDC( hWndMain ); + if( !GetTextExtentPoint32( hDC, szProgress, strlen(szProgress), &Size )) + { + ErrorMessageBox( IDS_ERROR_GETTEXTEXTENT, MB_ICONEXCLAMATION ); + ReleaseDC( hWndMain, hDC ); + return( TRUE ); + } + ReleaseDC( hWndMain, hDC ); + nTextControlHeight = Size.cy; + + y = BORDER_SPACE_CY; + + /* STATIC control -- text label for the TEMPO trackbar */ + if(( hWndTempoText = CreateWindow( "static", szTempo, + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + BORDER_SPACE_CX, + y, + TEMPO_TEXT_CX, nTextControlHeight, + hWndMain, (HMENU)0, hInst, NULL)) == NULL ) + { + lpszControl = szTempo; + uType = IDS_ERROR_STATICTEXT; + goto DISPLAY_CREATE_FAILURE; + } + + /* Create the TEMPO trackbar */ + if(( hWndTempo = CreateWindow( TRACKBAR_CLASS, NULL, + WS_CHILD | WS_VISIBLE | TBS_HORZ | TBS_BOTTOM, + BORDER_SPACE_CX, + y + nTextControlHeight + TEXT_SPACE_CY, + TEMPO_TB_CX, TEMPO_TB_CY, + hWndMain, (HMENU)0, hInst, NULL)) == NULL ) + { + lpszControl = szTempo; + uType = IDS_ERROR_TRACKBAR; + goto DISPLAY_CREATE_FAILURE; + } + + dwTempoMultiplier = 100; + SendMessage( hWndTempo, TBM_SETRANGE, FALSE, + MAKELONG( TEMPO_MIN, TEMPO_MAX )); + SendMessage( hWndTempo, TBM_SETPOS, TRUE, dwTempoMultiplier ); + + /* STATIC control -- text label for the VOLUME trackbar */ + if(( hWndVolText = CreateWindow( "static", szVolume, + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + BORDER_SPACE_CX + TEMPO_TB_CX + + CONTROL_SPACE_CX, + y, + VOL_TEXT_CX, nTextControlHeight, + hWndMain, (HMENU)0, hInst, NULL)) == NULL ) + { + lpszControl = szVolume; + uType = IDS_ERROR_STATICTEXT; + goto DISPLAY_CREATE_FAILURE; + } + y += nTextControlHeight + TEXT_SPACE_CY; + + /* Create the VOLUME trackbar */ + if(( hWndVol = CreateWindow( TRACKBAR_CLASS, NULL, + WS_CHILD | WS_VISIBLE | TBS_HORZ | TBS_BOTTOM, + BORDER_SPACE_CX + TEMPO_TB_CX + + CONTROL_SPACE_CX, + y, VOL_TB_CX, VOL_TB_CY, + hWndMain, (HMENU)0, hInst, NULL)) == NULL ) + { + lpszControl = szVolume; + uType = IDS_ERROR_TRACKBAR; + goto DISPLAY_CREATE_FAILURE; + } + + SendMessage( hWndVol, TBM_SETRANGE, FALSE, + MAKELONG( VOL_TB_MIN, VOL_TB_MAX )); + SendMessage( hWndVol, TBM_SETPOS, TRUE, VOL_TB_MAX ); + SendMessage( hWndVol, TBM_SETPAGESIZE, 0L, VOL_PAGESIZE ); + + x = BORDER_SPACE_CX + TEMPO_TB_CX + 2 * CONTROL_SPACE_CX + VOL_TB_CX; + y = BORDER_SPACE_CY; + + /* Create the LOOPED CHECKBOX */ + LoadString( hInst, IDS_CHECK_LOOPED, szTemp, sizeof(szTemp)); + if(( hWndLoopCheck = CreateWindow( "button", szTemp, + WS_CHILD | WS_VISIBLE | BS_CHECKBOX, + x, y, CHECK_CX, CHECK_CY, hWndMain, + (HMENU)IDC_LOOPCHECK, hInst, NULL )) == NULL ) + { + lpszControl = szTemp; + uType = IDS_ERROR_CHECK; + goto DISPLAY_CREATE_FAILURE; + } + + x = BORDER_SPACE_CX + TEMPO_TB_CX + VOL_TB_CX + 2 * CONTROL_SPACE_CX + CHECK_CX + - 3 * BUTTON_CX - 2 * BUTTON_SPACE_CX; + y = BORDER_SPACE_CY + nTextControlHeight + TEXT_SPACE_CY + TEMPO_TB_CY + + CONTROL_SPACE_CY; + + /* STATIC control -- text label for the progress trackbar. */ + if(( hWndProgText = CreateWindow( "static", szProgress, + WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP, + BORDER_SPACE_CX, + y, + x - BORDER_SPACE_CX, nTextControlHeight, + hWndMain, (HMENU)0, hInst, NULL)) == NULL ) + { + lpszControl = szProgress; + uType = IDS_ERROR_STATICTEXT; + goto DISPLAY_CREATE_FAILURE; + } + + /* Create the PLAY BUTTON */ + LoadString( hInst, IDS_BUTTON_PLAY, szTemp, sizeof(szTemp)); + if(( hWndPlay = CreateWindow( "button", szTemp, + WS_CHILD | WS_VISIBLE | WS_DISABLED, + x, y, BUTTON_CX, BUTTON_CY, hWndMain, + (HMENU)IDC_PLAY, hInst, NULL )) == NULL ) + { + lpszControl = szTemp; + uType = IDS_ERROR_BUTTON; + goto DISPLAY_CREATE_FAILURE; + } + x += BUTTON_CX + BUTTON_SPACE_CX; + + /* Create the PAUSE BUTTON */ + LoadString( hInst, IDS_BUTTON_PAUSE, szTemp, sizeof(szTemp)); + if(( hWndPause = CreateWindow( "button", szTemp, + WS_CHILD | WS_VISIBLE | WS_DISABLED, + x, y, BUTTON_CX, BUTTON_CY, hWndMain, + (HMENU)IDC_PAUSE, hInst, NULL )) == NULL ) + { + lpszControl = szTemp; + uType = IDS_ERROR_BUTTON; + goto DISPLAY_CREATE_FAILURE; + } + x += BUTTON_CX + BUTTON_SPACE_CX; + + /* Create the STOP BUTTON */ + LoadString( hInst, IDS_BUTTON_STOP, szTemp, sizeof(szTemp)); + if(( hWndStop = CreateWindow( "button", szTemp, + WS_CHILD | WS_VISIBLE | WS_DISABLED, + x, y, BUTTON_CX, BUTTON_CY, hWndMain, + (HMENU)IDC_STOP, hInst, NULL )) == NULL ) + { + lpszControl = szTemp; + uType = IDS_ERROR_BUTTON; + goto DISPLAY_CREATE_FAILURE; + } + + UpdateFromControls(); + goto RETURN_NORMAL; + +DISPLAY_CREATE_FAILURE: + LoadString( hInst, uType, szType, sizeof(szType)); + wsprintf( szTemp, szTemplate, lpszControl, szType ); + MessageBox( GetActiveWindow(), szTemp, + szAppTitle, MB_OK | MB_ICONEXCLAMATION ); + return( TRUE ); + +RETURN_NORMAL: + return( FALSE ); + } + + +/********************************************************************************/ +/* HandleTempoScroll() */ +/* */ +/* Handles the tempo trackbar scroll when a WM_HSCROLL is received. */ +/* */ +/********************************************************************************/ +void HandleTempoScroll( int nCode, int nPos ) + { + long lTempo, lDelta; + + lTempo = (LONG)SendMessage( hWndTempo, TBM_GETPOS, (WPARAM)0, (LPARAM)0 ); + + switch( nCode ) + { + case TB_LINEUP: + if( lTempo >= TEMPO_MIN-1 ) + lDelta = -1; + break; + case TB_LINEDOWN: + if( lTempo <= TEMPO_MAX+1 ) + lDelta = 1; + break; + case TB_PAGEUP: + if( lTempo >= TEMPO_MIN - TEMPO_PAGESIZE ) + lDelta = -TEMPO_PAGESIZE; + break; + case TB_PAGEDOWN: + if( lTempo <= TEMPO_MAX + TEMPO_PAGESIZE ) + lDelta = TEMPO_PAGESIZE; + break; + case TB_ENDTRACK: + return; + default: + lDelta = 0; + } + + if( lDelta ) + { + SendMessage( hWndTempo, TBM_SETPOS, TRUE, lTempo + lDelta ); + dwTempoMultiplier = (DWORD)( lTempo + lDelta ); + } + else + { + SendMessage( hWndTempo, TBM_SETPOS, TRUE, (long)nPos ); + dwTempoMultiplier = (DWORD)nPos; + } + + UpdateFromControls(); + } + + +/********************************************************************************/ +/* HandleVolScroll() */ +/* */ +/* Handles the volume trackbar scrolling when a WM_HSCROLL is received. */ +/* */ +/********************************************************************************/ +void HandleVolScroll( int nCode, int nPos ) + { + long lVol, lDelta; + + lVol = (LONG)SendMessage( hWndVol, TBM_GETPOS, (WPARAM)0, (LPARAM)0 ); + + switch( nCode ) + { + case TB_LINEDOWN: + if( lVol <= VOL_TB_MAX - 1 ) + lDelta = 1; + break; + case TB_LINEUP: + if( lVol >= VOL_TB_MIN + 1 ) + lDelta = -1; + break; + case TB_PAGEDOWN: + if( lVol <= VOL_TB_MAX - VOL_PAGESIZE ) + lDelta = VOL_PAGESIZE; + break; + case TB_PAGEUP: + if( lVol >= VOL_TB_MIN + VOL_PAGESIZE ) + lDelta = -VOL_PAGESIZE; + break; + case TB_ENDTRACK: + return; + default: + lDelta = 0; + } + + if( lDelta ) + SendMessage( hWndVol, TBM_SETPOS, TRUE, (lVol + lDelta)); + else + SendMessage( hWndVol, TBM_SETPOS, TRUE, (long)nPos ); + + UpdateFromControls(); + } + + +/********************************************************************************/ +/* UpdateFromControls() */ +/* */ +/* This function gets all the required values from the DirectSoundBuffer and */ +/* updates the screen interface controls. */ +/* */ +/********************************************************************************/ +void UpdateFromControls( void ) + { + long lTempo; + + lTempo = (LONG)SendMessage( hWndTempo, TBM_GETPOS, (WPARAM)0, (LPARAM)0 ); + dwVolumePercent = (WORD)SendMessage( hWndVol, TBM_GETPOS, + (WPARAM)0, (LPARAM)0 ); + + /* Set the Volume text */ + wsprintf( szTemp, "%s: %lu%%", szVolume, dwVolumePercent / 10 ); + Static_SetText( hWndVolText, szTemp ); + if( hStream ) + SetAllChannelVolumes( dwVolumePercent ); + + /* Set the Tempo text */ + wsprintf( szTemp, "%s: %li%%", szTempo, lTempo ); + Static_SetText( hWndTempoText, szTemp ); + bInsertTempo = TRUE; + + /* Set the Progress text */ + wsprintf( szTemp, "%s: %lu bytes", szProgress, dwProgressBytes ); + Static_SetText( hWndProgText, szTemp ); + + return; + } + + +/****************************************************************************/ +/* ErrorMessageBox() */ +/* */ +/* A little routine to load error messages from the string resource table */ +/* and pop them up in a MessageBox() for the world to see. The dwMBFlags */ +/* parameter allows the caller to specify the type of icon to use. */ +/* */ +/****************************************************************************/ +void ErrorMessageBox( UINT uID, DWORD dwMBFlags ) + { + LoadString( hInst, uID, szTemp, sizeof(szTemp)); + MessageBox( GetActiveWindow(), szTemp, szAppTitle, MB_OK | dwMBFlags ); +#ifdef DEBUG + wsprintf( szDebug, "General error: %s", szTemp ); + DebugPrint( szDebug ); +#endif + } + + +/****************************************************************************/ +/* MidiErrorMessageBox() */ +/* */ +/* Calls the midiOutGetErrorText() function and displays the text which */ +/* corresponds to a midi subsystem error code. */ +/* */ +/****************************************************************************/ +void MidiErrorMessageBox( MMRESULT mmr ) + { + midiOutGetErrorText( mmr, szTemp, sizeof(szTemp)); + MessageBox( GetActiveWindow(), szTemp, szAppTitle, + MB_OK | MB_ICONSTOP ); +#ifdef DEBUG + wsprintf( szDebug, "Midi subsystem error: %s", szTemp ); + DebugPrint( szDebug ); +#endif + } + + +/*****************************************************************************/ +/* HandleCommDlgError() */ +/* */ +/* The function translates extended common dialog error codes into a */ +/* string resource ID, loads that string from our module, and displays it in */ +/* a message box. This implementation only covers the general CD error codes.*/ +/* */ +/*****************************************************************************/ +int HandleCommDlgError( DWORD dwError ) + { + char szTitle[128]; + UINT uMsgID; + + if( dwError == CDERR_DIALOGFAILURE ) + uMsgID = IDS_CDERR_DIALOGFAILURE; + else + uMsgID = (UINT)dwError + IDS_CDERR_GENERAL_BASE; + + LoadString( hInst, uMsgID, szTemp, sizeof(szTemp)); + LoadString( hInst, IDS_CDERR_TITLESTRING, szTitle, sizeof(szTitle)); + MessageBox( GetActiveWindow(), szTemp, szTitle, + MB_OK | MB_ICONEXCLAMATION ); + + return( 0 ); + } + + +/****************************************************************************/ +/* BuildTitleBarText() */ +/* */ +/* Helper function designed to updated the title bar text of the main */ +/* window to reflect the currently loaded file (if there is one). */ +/* */ +/****************************************************************************/ +void BuildTitleBarText( void ) + { + char szTitle[sizeof(szAppCaption) + MAX_PATH + sizeof( " - (Paused)")]; + + lstrcpy( szTitle, szAppCaption ); + if( bFileOpen ) + { + lstrcat( szTitle, " - " ); + lstrcat( szTitle, szFileTitle ); + } + if( bPaused ) + lstrcat( szTitle, " (Paused)" ); + SetWindowText( hWndMain, szTitle ); + } + + +/****************************************************************************/ +/* SetAllChannelVolumes() */ +/* */ +/* Given a percent in tenths of a percent, sets volume on all channels to */ +/* reflect the new value. */ +/****************************************************************************/ +void SetAllChannelVolumes( DWORD dwVolumePercent ) + { + DWORD dwEvent, dwStatus, dwVol, idx; + MMRESULT mmrRetVal; + + if( !bPlaying ) + return; + + + for( idx = 0, dwStatus = MIDI_CTRLCHANGE; idx < NUM_CHANNELS; idx++, + dwStatus++ ) + { + dwVol = ( dwVolCache[idx] * dwVolumePercent ) / 1000; + dwEvent = dwStatus | ((DWORD)MIDICTRL_VOLUME << 8) + | ((DWORD)dwVol << 16); + if(( mmrRetVal = midiOutShortMsg( (HMIDIOUT)hStream, dwEvent )) + != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + return; + } + } + } + + +/****************************************************************************/ +/* SetChannelVolume() */ +/* */ +/* Given a percent in tenths of a percent, sets volume on a specified */ +/* channel to reflect the new value. */ +/****************************************************************************/ +void SetChannelVolume( DWORD dwChannel, DWORD dwVolumePercent ) + { + DWORD dwEvent, dwVol; + MMRESULT mmrRetVal; + + if( !bPlaying ) + return; + + dwVol = ( dwVolCache[dwChannel] * dwVolumePercent ) / 1000; + dwEvent = MIDI_CTRLCHANGE | dwChannel | ((DWORD)MIDICTRL_VOLUME << 8) + | ((DWORD)dwVol << 16); + if(( mmrRetVal = midiOutShortMsg( (HMIDIOUT)hStream, dwEvent )) + != MMSYSERR_NOERROR ) + { + MidiErrorMessageBox( mmrRetVal ); + return; + } + } diff --git a/sdk/samples/mstream/msvc.mk b/sdk/samples/mstream/msvc.mk new file mode 100644 index 0000000..52bd1aa --- /dev/null +++ b/sdk/samples/mstream/msvc.mk @@ -0,0 +1,42 @@ +NAME = mstream +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib comdlg32.lib gdi32.lib winmm.lib \ + comctl32.lib libc.lib + +OBJS = mstream.obj mstrconv.obj mstrhelp.obj debug.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/mstream/readme.txt b/sdk/samples/mstream/readme.txt new file mode 100644 index 0000000..f1c1aad --- /dev/null +++ b/sdk/samples/mstream/readme.txt @@ -0,0 +1,154 @@ + + MSTREAM + + Design Description and Notes + + The MSTREAM sample application is an example of how you can use the new +midiStream API that's built into Windows 95 to play MIDI data with low +latency and low processor overhead. + + The basic idea behind the implementation is to start the application and +initialize the user interface. After that's done, the following events occur. + +When a user selects and opens a file +------------------------------------ +Open a MIDI output device (the Microsoft MIDI Mapper in this case) +Open the file using buffered I/O and fill our buffers with data in MIDI stream + format +Prepare and queue the buffers using midiOutPrepareHeader and midiStreamOut +Wait until the user decides to do something else + +When PLAY is selected +--------------------- +Call midiStreamRestart to un-pause the device and begin playback +As buffers are returned, the callback function fills them with more data and +sends them back to be played by calling midiStreamOut() again. IT IS +IMPORTANT THAT YOU NOTE THAT IT IS NOT NECESSARY FOR YOU TO UNPREPARE AND +PREPARE BUFFERS EVERY TIME THEY ARE RETURNED. This is only a waste of time. +All you have to do is send them back into the subsystem with midiStreamOut(). +The API documentation is a bit confusing on this point. + +When PAUSE is selected +---------------------- +Call midiStreamPause() and wait for a PLAY or PAUSE to call midiStreamRestart(). +Note that pausing may make your audio sound kind of funny, since all notes are +turned off and some note on events may be lost when playback is restarted. + +When STOP is selected +--------------------- +Call midiStreamStop(). Since the callback function is in another thread, we +use a Win32 synchronization object, an event to block the main thread until +the callback thread has received all buffers. When this happens, we know it's +okay to go ahead and call midiStreamReset() and then to go ahead and free all +our buffers. Currently, the device is also closed using midiStreamClose(). +Then, if we are resetting the file to playback starting at its beginning point +the next time PLAY is hit, reopen the file by calling StreamBufferSetup(), +which is the workhorse function for opening a file and initializing the +the converter and the buffers. + +Note that the reason we must close and reopen the device is due to an apparent +bug in the Multimedia System which causes undesireable playback once a device +has been stopped. If you disable the code for closing the device, then the rest +of the code will automatically know it does not have to reopen the device. +However, the following may occur: After the first instance of playback followed +by a midiStreamStop() and a midiStreamReset(), there will be a pause equal in +length to the first playback period before playback begins once more with a call +to midiStreamRestart(). + +If Looped is selected +--------------------- +Notice that the converter has a little function in it called RewindConverter() +which is called by ConvertToBuffer() if the bLooped variable is TRUE. This +function resets the track state structures and performs most of the steps +originally executed in ConvertInit() with the notable exception of opening the +file and reading in file and track header data. It simply resets the tracks +to their initial state. + + +More on the buffering scheme +---------------------------- +Note that there is an OUT_BUFFER_SIZE and a BUFFER_TIME_LENGTH. The idea is +that the converter counts ticks and calculates when it has put at least +BUFFER_TIME_LENGTH milliseconds worth of events in the buffer. At this point, +it returns to the caller with a "full" buffer. At the very worst, there will +be as many events as can fit into OUT_BUFFER_SIZE bytes. Imagine that you have +to MIDI files loaded into memory somehow and you want to switch between them in +a hurry to correspond to some action the player performed like switching rooms. +All you have to do is start filling the next buffer with new data (assuming +they streams use similar patch sets, time division settings, etc.) and after +(NUM_STREAM_BUFFERS-1)*BUFFER_TIME_LENGTH milliseconds, the music will switch +over automatically. This theory is sort of illustrated by the tempo trackbar +control in this sample. This control sets a flag which forces the converter +code to start a new buffer, with the first event being a new tempo setting. +The tempo setting is calculated as a relative increase with respect to the +last real tempo event from the file. Of course, to implement the scheme +mentioned above requires some modification to the converter code so that it +will work with multiple MIDI files. + +Since the buffering scheme uses very small buffers, it is currently rather +sensitive to heavy activity which may prevent it from completing processing +in time. This can be solved by increasing the NUM_STREAM_BUFFERS constant, +but you must make a trade-off between latency and playback stability. + + +Known problems and possible improvements: +----------------------------------------- +It is more desireable to enumerate all possible MIDI output devices and then + either allow the user to use a specific device, or choose one which has + desireable capabilities. It is not recommended that you ship a product + which is hard-coded to use the MIDI Mapper only. For more on enumerating + MIDI output devices, see the MIDIPLYR sample application which is part of + the Win32 SDK. + +Instead of using the BUFFER_TIME_LENGTH, it would be possible to handle the + time signature META event in MIDI files and calculate the length of a + measure of music. Then you could change buffers at the end of each measure, + which would probably yield a smoother sounding transition. It may even be + possible to define system-exclusive events or other such extensions to the + MIDI converter code designed to provide your application with extra data + about when to switch between buffers or do other processing, though it is + not necessarily recommended that you modify the MIDI file format spec. For + more information on that spec, contact the International MIDI Association. + +You may wish to modify the way a change in tempo is handled, or remove this + code entirely. Right now, there is a chunk of code in the convert function + AddEventToStreamBuffer() which detects tempo events and stores the new tempo. + There is also code which will react to the tempo slider by calculating a new + tempo, truncating the current buffer, and starting the next buffer with a + tempo event reflecting the new desired tempo. It may be more desireable to + force any tempo changes which are not encoded in the file originally to take + effect only on buffer boundaries, instead of always creating a buffer + boundary. Proceeding under the above context of buffers equal in length to + measures of music, it may make more sense to only change tempo between each + measure. You can also send tempo change messages using the midiOutShortMsg() + function, similar to the way SetAllChannelVolumes() behaves. + +The volume control is a channel-wide, percentage-based control which relies on + a cache of volumes for each channel. As the converter encounters a volume + change message, it flags it for a callback. This causes the MidiProc() to + receive notification when that event is reached. MidiProc() then grabs a + copy of the new volume event and sends a MIDI short message to the proper + channel which reflects the current slider position. In other words, the + code saves the "full" or "raw" value and then modifies it so the volume + trackbar represents a percentage of that volume. Though it is not shown + here, this scheme could be broken down to allow for individual volume + control also. This idea could also be expanded to include the LSB volume + controller(39), which is not handled here. + +Further, by duplicating the volume code described above and making slight + modifications to the converter (to detect other events), it is possible to + handle pan, balance, or other controller messages using the exact same idea. + +Having said the above, it should be noted that attaching the volume change code + to a trackbar is for illustration purposes only. The implementation shown + and described works best for isolated volume events, like when your player + moves away from the sound source and you need to update volume. It should + not really be used for real-time scrolling because the method tends to flood + the MIDI output device with short messages, which interferes severly with + playback. + +BUG: If you are using an internal MIDI device which uses the OPL chipset, you + should be aware of a bug which seems to occur in most of these drivers. If + a volume channel message is sent to these drivers, they will not reflect the + change until a note on/off event occurs. This means long sustaining notes + will not reduce in volume. diff --git a/sdk/samples/mstream/resource.h b/sdk/samples/mstream/resource.h new file mode 100644 index 0000000..8e71fe7 --- /dev/null +++ b/sdk/samples/mstream/resource.h @@ -0,0 +1,81 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by mstream.rc +// +#define IDR_MAINMENU 101 +#define IDC_PLAY 101 +#define IDD_ABOUTBOX 102 +#define IDC_STOP 102 +#define IDC_PAUSE 103 +#define IDI_ICON1 107 +#define IDI_ICON2 108 +#define IDI_ICON3 111 +#define IDS_TBTITLE_PAN 8192 +#define IDS_TBTITLE_VOLUME 8193 +#define IDS_TBTITLE_FREQUENCY 8194 +#define IDS_TBTITLE_PROGRESS 8195 +#define IDS_BUTTON_PLAY 8196 +#define IDS_BUTTON_STOP 8197 +#define IDS_CHECK_LOOPED 8198 +#define IDS_TBTITLE_TEMPO 8199 +#define IDS_BUTTON_PAUSE 8200 +#define IDS_APP_TITLE 8208 +#define IDS_APP_CAPTION 8209 +#define IDS_APP_NAME 8210 +#define IDS_OPEN_DLGTITLE 8211 +#define IDS_OPEN_FILTER1 8212 +#define IDS_OPEN_FILTER2 8213 +#define IDS_OPEN_FILTER3 8214 +#define IDS_OPEN_FILTER4 8215 +#define IDS_ERROR_APPINIT 8224 +#define IDS_ERROR_INSTANCEINIT 8225 +#define IDS_ERROR_REGISTERCLASS 8226 +#define IDS_ERROR_MAINWNDCREATE 8227 +#define IDS_ERROR_NOMIDIMAPPER 8228 +#define IDS_ERROR_CHILDTEMPLATE 8244 +#define IDS_ERROR_TRACKBAR 8245 +#define IDS_ERROR_BUTTON 8246 +#define IDS_ERROR_STATICTEXT 8247 +#define IDS_ERROR_GETTEXTEXTENT 8248 +#define IDS_ERROR_CHECK 8249 +#define IDS_CDERR_GENERAL_BASE 16384 +#define IDS_CDERR_FINDRESFAILURE 16385 +#define IDS_CDERR_INITIALIZATION 16386 +#define IDS_CDERR_LOADRESFAILURE 16387 +#define IDS_CDERR_LOCKRESFAILURE 16388 +#define IDS_CDERR_LOADSTRFAILURE 16389 +#define IDS_CDERR_MEMALLOCFAILURE 16390 +#define IDS_CDERR_MEMLOCKFAILURE 16391 +#define IDS_CDERR_NOHINSTANCE 16392 +#define IDS_CDERR_NOHOOK 16393 +#define IDS_CDERR_NOTEMPLATE 16394 +#define IDS_CDERR_REGISTERMSGFAIL 16395 +#define IDS_CDERR_STRUCTSIZE 16396 +#define IDS_CDERR_DIALOGFAILURE 16397 +#define IDS_CDERR_TITLESTRING 16398 +#define IDC_LOOPCHECK 40001 +#define IDM_FILE_EXIT 40002 +#define IDM_HELP_ABOUT 40003 +#define IDM_FILE_OPEN 40004 +#define IDM_FILE_CLOSE 40005 +#define IDM_PLAY 40006 +#define IDM_STOP 40007 +#define IDC_OPTIONS_LOOPED 40008 +#define IDM_ACTIONS_LOOPED 40008 +#define IDC_OPTIONS_MIDIOUTDEVICE 40009 +#define IDM_ACTIONS_PLAY 40010 +#define IDM_ACTIONS_PAUSE 40011 +#define IDM_ACTIONS_STOP 40012 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 113 +#define _APS_NEXT_COMMAND_VALUE 40013 +#define _APS_NEXT_CONTROL_VALUE 1004 +#define _APS_NEXT_SYMED_VALUE 104 +#endif +#endif diff --git a/sdk/samples/oct1/makefile b/sdk/samples/oct1/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/oct1/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/oct1/msvc.mk b/sdk/samples/oct1/msvc.mk new file mode 100644 index 0000000..c33dba3 --- /dev/null +++ b/sdk/samples/oct1/msvc.mk @@ -0,0 +1,42 @@ +NAME = oct1 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = oct1.obj d3dapp.obj ddcalls.obj d3dcalls.obj texture.obj misc.obj d3dmain.obj stats.obj d3dmath.obj lclib.obj + +!if "$(DEBUG)" == "debug" +COPT =-DDEBUG -DD3DDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DDEMO +!else +COPT =-Otyb1 -DD3DDEMO +LOPT =-debug:none +ROPT = -DD3DDEMO +!endif +DEF = $(NAME).def +RES = d3dmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/oct1/oct1.c b/sdk/samples/oct1/oct1.c new file mode 100644 index 0000000..358b889 --- /dev/null +++ b/sdk/samples/oct1/oct1.c @@ -0,0 +1,470 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: oct1.c + * + ***************************************************************************/ + +#include <d3d.h> +#include <math.h> +#include "d3ddemo.h" + +static D3DEXECUTEDATA d3dExData; +static LPDIRECT3DEXECUTEBUFFER lpD3DExBuf; +static D3DEXECUTEBUFFERDESC debDesc; +LPDIRECT3DLIGHT lpD3DLight; +LPDIRECT3DMATERIAL lpBmat, lpMat1, lpMat2; + +extern LPD3DVECTOR D3DVECTORNormalise(LPD3DVECTOR); + +/* + * Global projection, view, world and identity matricies + */ +D3DMATRIXHANDLE hProj; +D3DMATRIXHANDLE hView; +D3DMATRIXHANDLE hViewRot, hDViewRot; +D3DMATRIXHANDLE hViewPos; +D3DMATRIXHANDLE hWorld, hDWorld; + +D3DMATRIX proj = { + D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(-1.0), D3DVAL(0.0) +}; + +D3DMATRIX viewpos = { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(10.0), D3DVAL(1.0) +}; +D3DMATRIX viewrot, view, dviewrot, dworld; +D3DMATRIX identity = { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0) +}; + +void +OverrideDefaults(Defaults* defaults) +{ + lstrcpy(defaults->Name, "Octagon D3D Example"); +} + +BOOL +TickScene(LPDIRECT3DDEVICE lpDev, LPDIRECT3DVIEWPORT lpView) +{ + static int dir = 1; + + if (viewpos._43 < D3DVAL(4.0)) + dir = 0; + if (viewpos._43 > D3DVAL(12.0)) + dir = 1; + if (dir) + viewpos._43 -= D3DVAL(0.4); + else + viewpos._43 += D3DVAL(0.4); + if (lpDev->lpVtbl->SetMatrix(lpDev, hViewPos, &viewpos) != D3D_OK) + return FALSE; + return TRUE; +} + +BOOL +RenderScene(LPDIRECT3DDEVICE lpDev, LPDIRECT3DVIEWPORT lpView, + LPD3DRECT lpExtent) +{ + /* + * Execute the instruction buffer + */ + if (lpDev->lpVtbl->BeginScene(lpDev) != D3D_OK) + return FALSE; + if (lpDev->lpVtbl->Execute(lpDev, lpD3DExBuf, lpView, D3DEXECUTE_CLIPPED) != D3D_OK) + return FALSE; + if (lpDev->lpVtbl->EndScene(lpDev) != D3D_OK) + return FALSE; + if (lpD3DExBuf->lpVtbl->GetExecuteData(lpD3DExBuf, &d3dExData) != D3D_OK) + return FALSE; + *lpExtent = d3dExData.dsStatus.drExtent; + if (!(TickScene(lpDev, lpView))) + return FALSE; + return TRUE; +} + +void +ReleaseScene(void) +{ + return; +} + +void +ReleaseView(LPDIRECT3DVIEWPORT lpView) +{ + if (lpView && lpD3DLight) + lpView->lpVtbl->DeleteLight(lpView, lpD3DLight); + RELEASE(lpD3DLight); + RELEASE(lpD3DExBuf); + RELEASE(lpMat2); + RELEASE(lpBmat); +} + +BOOL +InitScene(void) +{ + return TRUE; +} + +#define NUM_VERTICES 6 +#define NUM_TRIANGLES 8 + +BOOL +InitView(LPDIRECTDRAW lpDD, LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpDev, + LPDIRECT3DVIEWPORT lpView, int NumTextures, + LPD3DTEXTUREHANDLE TextureHandle) +{ + D3DVERTEX v[NUM_VERTICES]; + D3DLIGHT light; + LPVOID lpBufStart, lpInsStart, lpPointer; + LPD3DTRIANGLE lpTri; + LPDIRECT3DEXECUTEBUFFER lpD3DExCmdBuf; + size_t size; + int t[8][3] = { + 0, 1, 2, + 0, 2, 3, + 0, 3, 4, + 0, 4, 1, + 5, 2, 1, + 5, 3, 2, + 5, 4, 3, + 5, 1, 4 + }; + D3DMATERIAL bmat, mat1, mat2; + D3DMATERIALHANDLE hBmat, hMat1, hMat2; + D3DTEXTUREHANDLE bTex; + D3DTEXTUREHANDLE fooTex; + int i; + D3DVALUE ct, st; + + bTex = TextureHandle[1]; + fooTex = TextureHandle[0]; + memset(&bmat, 0, sizeof(D3DMATERIAL)); + bmat.dwSize = sizeof(D3DMATERIAL); + bmat.diffuse.r = (D3DVALUE)1.0; + bmat.diffuse.g = (D3DVALUE)1.0; + bmat.diffuse.b = (D3DVALUE)1.0; + bmat.ambient.r = (D3DVALUE)1.0; + bmat.ambient.g = (D3DVALUE)1.0; + bmat.ambient.b = (D3DVALUE)1.0; + bmat.hTexture = fooTex; + bmat.dwRampSize = 1; + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpBmat, NULL) != D3D_OK) { + return FALSE; + } + if (lpBmat->lpVtbl->SetMaterial(lpBmat, &bmat) != D3D_OK) { + return FALSE; + } + if (lpBmat->lpVtbl->GetHandle(lpBmat, lpDev, &hBmat) != D3D_OK) { + return FALSE; + } + if (lpView->lpVtbl->SetBackground(lpView, hBmat) != D3D_OK) { + return FALSE; + } + + /* + * Set the view, world and projection matrices + * Create a buffer for matrix set commands etc. + */ + MAKE_MATRIX(lpDev, hViewRot, identity); + MAKE_MATRIX(lpDev, hViewPos, viewpos); + MAKE_MATRIX(lpDev, hView, identity); + MAKE_MATRIX(lpDev, hProj, proj); + MAKE_MATRIX(lpDev, hWorld, identity); + ct = D3DVAL(cos(0.1)); + st = D3DVAL(sin(0.1)); + dviewrot = identity; + dviewrot._22 = ct; + dviewrot._23 = -st; + dviewrot._32 = st; + dviewrot._33 = ct; + MAKE_MATRIX(lpDev, hDViewRot, dviewrot); + dworld = identity; + dworld._11 = ct; + dworld._13 = -st; + dworld._31 = st; + dworld._33 = ct; + MAKE_MATRIX(lpDev, hDWorld, dworld); + size = 0; + size += sizeof(D3DINSTRUCTION) * 3; + size += sizeof(D3DSTATE) * 4; + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + if (lpDev->lpVtbl->CreateExecuteBuffer(lpDev, &debDesc, &lpD3DExCmdBuf, + NULL) != D3D_OK) + return FALSE; + /* + * lock it so it can be filled + */ + if (lpD3DExCmdBuf->lpVtbl->Lock(lpD3DExCmdBuf, &debDesc) != D3D_OK) + return FALSE; + lpBufStart = debDesc.lpData; + memset(lpBufStart, 0, size); + lpPointer = lpBufStart; + + lpInsStart = lpPointer; + OP_STATE_TRANSFORM(3, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_VIEW, hView, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_WORLD, hWorld, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_PROJECTION, hProj, lpPointer); + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_AMBIENT, RGBA_MAKE(64, 64, 64, 64), lpPointer); + OP_EXIT(lpPointer); + /* + * Setup the execute data describing the buffer + */ + lpD3DExCmdBuf->lpVtbl->Unlock(lpD3DExCmdBuf); + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwInstructionOffset = (ULONG) 0; + d3dExData.dwInstructionLength = (ULONG) ((char *)lpPointer - (char*)lpInsStart); + lpD3DExCmdBuf->lpVtbl->SetExecuteData(lpD3DExCmdBuf, &d3dExData); + lpDev->lpVtbl->BeginScene(lpDev); + lpDev->lpVtbl->Execute(lpDev, lpD3DExCmdBuf, lpView, D3DEXECUTE_UNCLIPPED); + lpDev->lpVtbl->EndScene(lpDev); + /* + * We are done with the command buffer. + */ + lpD3DExCmdBuf->lpVtbl->Release(lpD3DExCmdBuf); + /* + * Setup a material + */ + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpMat1, NULL) != D3D_OK) { + return FALSE; + } + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpMat2, NULL) != D3D_OK) { + return FALSE; + } + memset(&mat1, 0, sizeof(D3DMATERIAL)); + mat1.dwSize = sizeof(D3DMATERIAL); + + mat1.diffuse.r = (D3DVALUE)1.0; + mat1.diffuse.g = (D3DVALUE)0.0; + mat1.diffuse.b = (D3DVALUE)0.0; + mat1.diffuse.a = (D3DVALUE)1.0; + mat1.ambient.r = (D3DVALUE)1.0; + mat1.ambient.g = (D3DVALUE)0.0; + mat1.ambient.b = (D3DVALUE)0.0; + mat1.specular.r = (D3DVALUE)1.0; + mat1.specular.g = (D3DVALUE)1.0; + mat1.specular.b = (D3DVALUE)1.0; + mat1.power = (float)20.0; + mat1.dwRampSize = 16; + mat1.hTexture = bTex; + lpMat1->lpVtbl->SetMaterial(lpMat1, &mat1); + lpMat1->lpVtbl->GetHandle(lpMat1, lpDev, &hMat1); + memset(&mat2, 0, sizeof(D3DMATERIAL)); + mat2.dwSize = sizeof(D3DMATERIAL); + mat2.diffuse.r = (D3DVALUE)1.0; + mat2.diffuse.g = (D3DVALUE)1.0; + mat2.diffuse.b = (D3DVALUE)1.0; + mat2.diffuse.a = (D3DVALUE)1.0; + mat2.ambient.r = (D3DVALUE)1.0; + mat2.ambient.g = (D3DVALUE)1.0; + mat2.ambient.b = (D3DVALUE)1.0; + mat2.specular.r = (D3DVALUE)1.0; + mat2.specular.g = (D3DVALUE)1.0; + mat2.specular.b = (D3DVALUE)1.0; + mat2.power = (float)20.0; + mat2.dwRampSize = 16; + mat2.hTexture = bTex; + lpMat2->lpVtbl->SetMaterial(lpMat2, &mat2); + lpMat2->lpVtbl->GetHandle(lpMat2, lpDev, &hMat2); + /* + * Setup vertices + */ + memset(&v[0], 0, sizeof(D3DVERTEX) * NUM_VERTICES); + /* V 0 */ + v[0].x = D3DVALP(0.0, 12); + v[0].y = D3DVALP(1.0, 12); + v[0].z = D3DVALP(1.0, 12); + + v[0].nx = D3DVALP(0.0, 12); + v[0].ny = D3DVALP(1.0, 12); + v[0].nz = D3DVALP(0.0, 12); + + v[0].tu = D3DVAL(0.0); + v[0].tv = D3DVAL(0.0); + + /* V 1 */ + v[1].x = D3DVALP(1.0, 12); + v[1].y = D3DVALP(0.0, 12); + v[1].z = D3DVALP(0.0, 12); + + v[1].nx = D3DVALP(1.0, 12); + v[1].ny = D3DVALP(0.0, 12); + v[1].nz = D3DVALP(-1.0, 12); + + v[1].tu = D3DVAL(1.0); + v[1].tv = D3DVAL(1.0); + + D3DVECTORNormalise((LPD3DVECTOR) & v[1].nx); + + /* V 2 */ + v[2].x = D3DVALP(-1.0, 12); + v[2].y = D3DVALP(0.0, 12); + v[2].z = D3DVALP(0.0, 12); + + v[2].nx = D3DVALP(-1.0, 12); + v[2].ny = D3DVALP(0.0, 12); + v[2].nz = D3DVALP(-1.0, 12); + + v[2].tu = D3DVAL(0.0); + v[2].tv = D3DVAL(1.0); + + D3DVECTORNormalise((LPD3DVECTOR) & v[2].nx); + + /* V 3 */ + v[3].x = D3DVALP(-1.0, 12); + v[3].y = D3DVALP(0.0, 12); + v[3].z = D3DVALP(2.0, 12); + + v[3].nx = D3DVALP(-1.0, 12); + v[3].ny = D3DVALP(0.0, 12); + v[3].nz = D3DVALP(1.0, 12); + + v[3].tu = D3DVAL(1.0); + v[3].tv = D3DVAL(1.0); + + D3DVECTORNormalise((LPD3DVECTOR) & v[3].nx); + + /* V 4 */ + v[4].x = D3DVALP(1.0, 12); + v[4].y = D3DVALP(0.0, 12); + v[4].z = D3DVALP(2.0, 12); + + v[4].nx = D3DVALP(1.0, 12); + v[4].ny = D3DVALP(0.0, 12); + v[4].nz = D3DVALP(1.0, 12); + + v[4].tu = D3DVAL(0.0); + v[4].tv = D3DVAL(1.0); + + D3DVECTORNormalise((LPD3DVECTOR) & v[4].nx); + + /* V 5 */ + v[5].x = D3DVALP(0.0, 12); + v[5].y = D3DVALP(-1.0, 12); + v[5].z = D3DVALP(1.0, 12); + + v[5].nx = D3DVALP(0.0, 12); + v[5].ny = D3DVALP(-1.0, 12); + v[5].nz = D3DVALP(0.0, 12); + + v[5].tu = D3DVAL(0.0); + v[5].tv = D3DVAL(0.0); + + D3DVECTORNormalise((LPD3DVECTOR) & v[5].nx); + + /* + * Create an execute buffer + */ + size = sizeof(D3DVERTEX) * NUM_VERTICES; + size += sizeof(D3DSTATUS) * 1; + size += sizeof(D3DPROCESSVERTICES) * 2; + size += sizeof(D3DINSTRUCTION) * 10; + size += sizeof(D3DMATRIXMULTIPLY) * 3; + size += sizeof(D3DSTATE) * 5; + size += sizeof(D3DTRIANGLE) * NUM_TRIANGLES; + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + if (lpDev->lpVtbl->CreateExecuteBuffer(lpDev, &debDesc, &lpD3DExBuf, + NULL) != D3D_OK) { + return FALSE; + } + if (lpD3DExBuf->lpVtbl->Lock(lpD3DExBuf, &debDesc) != D3D_OK) { + return FALSE; + } + lpBufStart = debDesc.lpData; + memset(lpBufStart, 0, size); + lpPointer = lpBufStart; + /* + * Copy vertices to execute buffer + */ + VERTEX_DATA(&v[0], NUM_VERTICES, lpPointer); + /* + * Setup instructions in execute buffer + */ + lpInsStart = lpPointer; + OP_MATRIX_MULTIPLY(3, lpPointer); + MATRIX_MULTIPLY_DATA(hViewRot, hDViewRot, hViewRot, lpPointer); + MATRIX_MULTIPLY_DATA(hViewRot, hViewPos, hView, lpPointer); + MATRIX_MULTIPLY_DATA(hWorld, hDWorld, hWorld, lpPointer); + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_MATERIAL, hMat1, lpPointer); + OP_SET_STATUS(D3DSETSTATUS_ALL, D3DSTATUS_DEFAULT, 2048, 2048, 0, 0, lpPointer); + OP_PROCESS_VERTICES(1, lpPointer); + PROCESSVERTICES_DATA(D3DPROCESSVERTICES_TRANSFORMLIGHT, 0, 5, lpPointer); + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_MATERIAL, hMat2, lpPointer); + OP_PROCESS_VERTICES(1, lpPointer); + PROCESSVERTICES_DATA(D3DPROCESSVERTICES_TRANSFORMLIGHT, 5, 1, lpPointer); + OP_STATE_RENDER(3, lpPointer); + STATE_DATA(D3DRENDERSTATE_TEXTUREHANDLE, bTex, lpPointer); + STATE_DATA(D3DRENDERSTATE_WRAPU, FALSE, lpPointer); + STATE_DATA(D3DRENDERSTATE_WRAPV, FALSE, lpPointer); + /* + * Make sure that the triangle data (not OP) will be QWORD aligned + */ + if (QWORD_ALIGNED(lpPointer)) { + OP_NOP(lpPointer); + } + OP_TRIANGLE_LIST(NUM_TRIANGLES, lpPointer); + lpTri = (LPD3DTRIANGLE)lpPointer; + for (i = 0; i < NUM_TRIANGLES; i++) { + lpTri->v1 = t[i][0]; + lpTri->v2 = t[i][1]; + lpTri->v3 = t[i][2]; + lpTri->wFlags = D3DTRIFLAG_EDGEENABLETRIANGLE; + lpTri++; + } + lpPointer = (void*)lpTri; + OP_EXIT(lpPointer); + /* + * Setup the execute data + */ + lpD3DExBuf->lpVtbl->Unlock(lpD3DExBuf); + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwVertexCount = NUM_VERTICES; + d3dExData.dwInstructionOffset = (ULONG) ((char *)lpInsStart - (char *)lpBufStart); + d3dExData.dwInstructionLength = (ULONG) ((char *)lpPointer - (char*)lpInsStart); + lpD3DExBuf->lpVtbl->SetExecuteData(lpD3DExBuf, &d3dExData); + /* + * Setup lights + */ + memset(&light, 0, sizeof(D3DLIGHT)); + light.dwSize = sizeof(D3DLIGHT); + light.dltType = D3DLIGHT_DIRECTIONAL; + light.dcvColor.r = D3DVAL(1.0); + light.dcvColor.g = D3DVAL(1.0); + light.dcvColor.b = D3DVAL(1.0); + light.dcvColor.a = D3DVAL(1.0); + light.dvDirection.x = D3DVALP(0.0, 12); + light.dvDirection.y = D3DVALP(0.0, 12); + light.dvDirection.z = D3DVALP(1.0, 12); + if (lpD3D->lpVtbl->CreateLight(lpD3D, &lpD3DLight, NULL) != D3D_OK) { + return FALSE; + } + if (lpD3DLight->lpVtbl->SetLight(lpD3DLight, &light) != D3D_OK) { + return FALSE; + } + if (lpView->lpVtbl->AddLight(lpView, lpD3DLight) != D3D_OK) { + return FALSE; + } + return TRUE; +} diff --git a/sdk/samples/oct1/oct1.def b/sdk/samples/oct1/oct1.def new file mode 100644 index 0000000..d50033e --- /dev/null +++ b/sdk/samples/oct1/oct1.def @@ -0,0 +1,10 @@ +NAME oct1.exe + +DESCRIPTION 'Direct3D Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/oct1/readme.txt b/sdk/samples/oct1/readme.txt new file mode 100644 index 0000000..c401e85 --- /dev/null +++ b/sdk/samples/oct1/readme.txt @@ -0,0 +1,8 @@ +Oct1 +Direct3D Immediate Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Simple spinning shape constructed from vertex and triangle data within +the source. Two materials are used. The second material is only used +on one vertex. Spinning is done by updating and setting the matrix +each frame. The background material contains a texture. diff --git a/sdk/samples/oct2/makefile b/sdk/samples/oct2/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/oct2/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/oct2/msvc.mk b/sdk/samples/oct2/msvc.mk new file mode 100644 index 0000000..7090253 --- /dev/null +++ b/sdk/samples/oct2/msvc.mk @@ -0,0 +1,42 @@ +NAME = oct2 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = oct2.obj d3dapp.obj ddcalls.obj d3dcalls.obj texture.obj misc.obj d3dmain.obj stats.obj d3dmath.obj lclib.obj + +!if "$(DEBUG)" == "debug" +COPT =-DDEBUG -DD3DDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DDEMO +!else +COPT =-Otyb1 -DD3DDEMO +LOPT =-debug:none +ROPT = -DD3DDEMO +!endif +DEF = $(NAME).def +RES = d3dmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/oct2/oct2.c b/sdk/samples/oct2/oct2.c new file mode 100644 index 0000000..b448611 --- /dev/null +++ b/sdk/samples/oct2/oct2.c @@ -0,0 +1,447 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: oct2.c + * + ***************************************************************************/ + +#include <d3d.h> +#include <math.h> +#include "d3ddemo.h" + +static D3DEXECUTEDATA d3dExData; +static LPDIRECT3DEXECUTEBUFFER lpD3DExBuf; +static D3DEXECUTEBUFFERDESC debDesc; +LPDIRECT3DLIGHT lpD3DLight; +LPDIRECT3DMATERIAL lpBmat, lpMat2; + +extern LPD3DVECTOR D3DVECTORNormalise(LPD3DVECTOR); + +/* + * Global projection, view, world and identity matricies + */ +D3DMATRIXHANDLE hProj; +D3DMATRIXHANDLE hView; +D3DMATRIXHANDLE hViewRot, hDViewRot; +D3DMATRIXHANDLE hViewPos; +D3DMATRIXHANDLE hWorld, hDWorld; + +D3DMATRIX proj = { + D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(-1.0), D3DVAL(0.0) +}; + +D3DMATRIX viewpos = { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(10.0), D3DVAL(1.0) +}; +D3DMATRIX viewrot, view, dviewrot, dworld; +D3DMATRIX identity = { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0) +}; + +void +OverrideDefaults(Defaults* defaults) +{ + lstrcpy(defaults->Name, "Octagon II D3D Example"); +} + +BOOL +TickScene(LPDIRECT3DDEVICE lpDev, LPDIRECT3DVIEWPORT lpView) +{ + static int dir = 1; + + if (viewpos._43 < D3DVAL(4.0)) + dir = 0; + if (viewpos._43 > D3DVAL(12.0)) + dir = 1; + if (dir) + viewpos._43 -= D3DVAL(0.4); + else + viewpos._43 += D3DVAL(0.4); + if (lpDev->lpVtbl->SetMatrix(lpDev, hViewPos, &viewpos) != D3D_OK) + return FALSE; + return TRUE; +} + + + +BOOL +RenderScene(LPDIRECT3DDEVICE lpDev, LPDIRECT3DVIEWPORT lpView, + LPD3DRECT lpExtent) +{ + /* + * Execute the instruction buffer + */ + if (lpDev->lpVtbl->BeginScene(lpDev) != D3D_OK) + return FALSE; + if (lpDev->lpVtbl->Execute(lpDev, lpD3DExBuf, lpView, D3DEXECUTE_CLIPPED) != D3D_OK) + return FALSE; + if (lpDev->lpVtbl->EndScene(lpDev) != D3D_OK) + return FALSE; + if (lpD3DExBuf->lpVtbl->GetExecuteData(lpD3DExBuf, &d3dExData) != D3D_OK) + return FALSE; + *lpExtent = d3dExData.dsStatus.drExtent; + if (!(TickScene(lpDev, lpView))) + return FALSE; + return TRUE; +} + +void +ReleaseScene(void) +{ + return; +} + +void +ReleaseView(LPDIRECT3DVIEWPORT lpView) +{ + if (lpView) + lpView->lpVtbl->DeleteLight(lpView, lpD3DLight); + RELEASE(lpD3DLight); + RELEASE(lpD3DExBuf); + RELEASE(lpMat2); + RELEASE(lpBmat); +} + +BOOL +InitScene(void) +{ + return TRUE; +} + +#define NUM_VERTICES 6 +#define NUM_TRIANGLES 8 + +BOOL +InitView(LPDIRECTDRAW lpDD, LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpDev, + LPDIRECT3DVIEWPORT lpView, int NumTextures, + LPD3DTEXTUREHANDLE TextureHandle) +{ + D3DVERTEX v[NUM_VERTICES]; + D3DLIGHT light; + LPVOID lpBufStart, lpInsStart, lpPointer; + LPD3DTRIANGLE lpTri; + LPDIRECT3DEXECUTEBUFFER lpD3DExCmdBuf; + size_t size; + int t[8][3] = { + 0, 1, 2, + 0, 2, 3, + 0, 3, 4, + 0, 4, 1, + 5, 2, 1, + 5, 3, 2, + 5, 4, 3, + 5, 1, 4 + }; + D3DMATERIAL bmat, mat2; + D3DMATERIALHANDLE hBmat, hMat2; + D3DTEXTUREHANDLE bTex; + int i; + D3DVALUE ct, st; + + memset(&bmat, 0, sizeof(D3DMATERIAL)); + bmat.dwSize = sizeof(D3DMATERIAL); + bmat.dwRampSize = 1; + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpBmat, NULL) != D3D_OK) { + return FALSE; + } + if (lpBmat->lpVtbl->SetMaterial(lpBmat, &bmat) != D3D_OK) { + return FALSE; + } + if (lpBmat->lpVtbl->GetHandle(lpBmat, lpDev, &hBmat) != D3D_OK) { + return FALSE; + } + if (lpView->lpVtbl->SetBackground(lpView, hBmat) != D3D_OK) { + return FALSE; + } + + /* + * Set the view, world and projection matrices + * Create a buffer for matrix set commands etc. + */ + MAKE_MATRIX(lpDev, hViewRot, identity); + MAKE_MATRIX(lpDev, hViewPos, viewpos); + MAKE_MATRIX(lpDev, hView, identity); + MAKE_MATRIX(lpDev, hProj, proj); + MAKE_MATRIX(lpDev, hWorld, identity); + ct = D3DVAL(cos(0.1)); + st = D3DVAL(sin(0.1)); + dviewrot = identity; + dviewrot._22 = ct; + dviewrot._23 = -st; + dviewrot._32 = st; + dviewrot._33 = ct; + MAKE_MATRIX(lpDev, hDViewRot, dviewrot); + dworld = identity; + dworld._11 = ct; + dworld._13 = -st; + dworld._31 = st; + dworld._33 = ct; + MAKE_MATRIX(lpDev, hDWorld, dworld); + size = 0; + size += sizeof(D3DINSTRUCTION) * 3; + size += sizeof(D3DSTATE) * 4; + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + if (lpDev->lpVtbl->CreateExecuteBuffer(lpDev, &debDesc, &lpD3DExCmdBuf, + NULL) != D3D_OK) + return FALSE; + /* + * lock it so it can be filled + */ + if (lpD3DExCmdBuf->lpVtbl->Lock(lpD3DExCmdBuf, &debDesc) != D3D_OK) + return FALSE; + lpBufStart = debDesc.lpData; + memset(lpBufStart, 0, size); + lpPointer = lpBufStart; + + lpInsStart = lpPointer; + OP_STATE_TRANSFORM(3, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_PROJECTION, hProj, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_VIEW, hView, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_WORLD, hWorld, lpPointer); + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_AMBIENT, RGBA_MAKE(64, 64, 64, 64), lpPointer); + OP_EXIT(lpPointer); + /* + * Setup the execute data describing the buffer + */ + lpD3DExCmdBuf->lpVtbl->Unlock(lpD3DExCmdBuf); + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwInstructionOffset = (ULONG) 0; + d3dExData.dwInstructionLength = (ULONG) ((char *)lpPointer - (char*)lpInsStart); + lpD3DExCmdBuf->lpVtbl->SetExecuteData(lpD3DExCmdBuf, &d3dExData); + lpDev->lpVtbl->BeginScene(lpDev); + lpDev->lpVtbl->Execute(lpDev, lpD3DExCmdBuf, lpView, D3DEXECUTE_UNCLIPPED); + lpDev->lpVtbl->EndScene(lpDev); + /* + * We are done with the command buffer. + */ + lpD3DExCmdBuf->lpVtbl->Release(lpD3DExCmdBuf); + /* + * Setup a material + */ + bTex = TextureHandle[1]; + memset(&mat2, 0, sizeof(D3DMATERIAL)); + mat2.dwSize = sizeof(D3DMATERIAL); + + mat2.diffuse.r = (D3DVALUE)0.5; + mat2.diffuse.g = (D3DVALUE)0.5; + mat2.diffuse.b = (D3DVALUE)0.5; + mat2.diffuse.a = (D3DVALUE)0.5; + mat2.ambient.r = (D3DVALUE)0.8; + mat2.ambient.g = (D3DVALUE)0.8; + mat2.ambient.b = (D3DVALUE)0.8; + mat2.specular.r = (D3DVALUE)1.0; + mat2.specular.g = (D3DVALUE)1.0; + mat2.specular.b = (D3DVALUE)1.0; + mat2.power = (float)20.0; + mat2.dwRampSize = 32; + mat2.hTexture = bTex; + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpMat2, NULL) != D3D_OK) { + return FALSE; + } + if (lpMat2->lpVtbl->SetMaterial(lpMat2, &mat2) != D3D_OK) { + return FALSE; + } + if (lpMat2->lpVtbl->GetHandle(lpMat2, lpDev, &hMat2) != D3D_OK) { + return FALSE; + } + /* + * Setup vertices + */ + memset(&v[0], 0, sizeof(D3DVERTEX) * NUM_VERTICES); + /* V 0 */ + v[0].x = D3DVALP(0.0, 12); + v[0].y = D3DVALP(1.0, 12); + v[0].z = D3DVALP(1.0, 12); + + v[0].nx = D3DVALP(0.0, 12); + v[0].ny = D3DVALP(1.0, 12); + v[0].nz = D3DVALP(0.0, 12); + + v[0].tu = D3DVAL(0.0); + v[0].tv = D3DVAL(0.0); + + /* V 1 */ + v[1].x = D3DVALP(1.0, 12); + v[1].y = D3DVALP(0.0, 12); + v[1].z = D3DVALP(0.0, 12); + + v[1].nx = D3DVALP(1.0, 12); + v[1].ny = D3DVALP(0.0, 12); + v[1].nz = D3DVALP(-1.0, 12); + + v[1].tu = D3DVAL(1.0); + v[1].tv = D3DVAL(1.0); + + D3DVECTORNormalise((LPD3DVECTOR) & v[1].nx); + + /* V 2 */ + v[2].x = D3DVALP(-1.0, 12); + v[2].y = D3DVALP(0.0, 12); + v[2].z = D3DVALP(0.0, 12); + + v[2].nx = D3DVALP(-1.0, 12); + v[2].ny = D3DVALP(0.0, 12); + v[2].nz = D3DVALP(-1.0, 12); + + v[2].tu = D3DVAL(0.0); + v[2].tv = D3DVAL(1.0); + + D3DVECTORNormalise((LPD3DVECTOR) & v[2].nx); + + /* V 3 */ + v[3].x = D3DVALP(-1.0, 12); + v[3].y = D3DVALP(0.0, 12); + v[3].z = D3DVALP(2.0, 12); + + v[3].nx = D3DVALP(-1.0, 12); + v[3].ny = D3DVALP(0.0, 12); + v[3].nz = D3DVALP(1.0, 12); + + v[3].tu = D3DVAL(1.0); + v[3].tv = D3DVAL(1.0); + + D3DVECTORNormalise((LPD3DVECTOR) & v[3].nx); + + /* V 4 */ + v[4].x = D3DVALP(1.0, 12); + v[4].y = D3DVALP(0.0, 12); + v[4].z = D3DVALP(2.0, 12); + + v[4].nx = D3DVALP(1.0, 12); + v[4].ny = D3DVALP(0.0, 12); + v[4].nz = D3DVALP(1.0, 12); + + v[4].tu = D3DVAL(0.0); + v[4].tv = D3DVAL(1.0); + + D3DVECTORNormalise((LPD3DVECTOR) & v[4].nx); + + /* V 5 */ + v[5].x = D3DVALP(0.0, 12); + v[5].y = D3DVALP(-1.0, 12); + v[5].z = D3DVALP(1.0, 12); + + v[5].nx = D3DVALP(0.0, 12); + v[5].ny = D3DVALP(-1.0, 12); + v[5].nz = D3DVALP(0.0, 12); + + v[5].tu = D3DVAL(0.0); + v[5].tv = D3DVAL(0.0); + + D3DVECTORNormalise((LPD3DVECTOR) & v[5].nx); + + /* + * Create an execute buffer + */ + size = sizeof(D3DVERTEX) * NUM_VERTICES; + size += sizeof(D3DPROCESSVERTICES) * 2; + size += sizeof(D3DSTATUS) * 1; + size += sizeof(D3DINSTRUCTION) * 10; + size += sizeof(D3DMATRIXMULTIPLY) * 3; + size += sizeof(D3DSTATE) * 5; + size += sizeof(D3DTRIANGLE) * NUM_TRIANGLES; + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + if (lpDev->lpVtbl->CreateExecuteBuffer(lpDev, &debDesc, &lpD3DExBuf, + NULL) != D3D_OK) { + return FALSE; + } + if (lpD3DExBuf->lpVtbl->Lock(lpD3DExBuf, &debDesc) != D3D_OK) { + return FALSE; + } + lpBufStart = debDesc.lpData; + memset(lpBufStart, 0, size); + lpPointer = lpBufStart; + /* + * Copy vertices to execute buffer + */ + VERTEX_DATA(&v[0], NUM_VERTICES, lpPointer); + /* + * Setup instructions in execute buffer + */ + lpInsStart = lpPointer; + OP_MATRIX_MULTIPLY(3, lpPointer); + MATRIX_MULTIPLY_DATA(hViewRot, hDViewRot, hViewRot, lpPointer); + MATRIX_MULTIPLY_DATA(hViewRot, hViewPos, hView, lpPointer); + MATRIX_MULTIPLY_DATA(hWorld, hDWorld, hWorld, lpPointer); + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_MATERIAL, hMat2, lpPointer); + OP_SET_STATUS(D3DSETSTATUS_ALL, D3DSTATUS_DEFAULT, 2048, 2048, 0, 0, lpPointer); + OP_PROCESS_VERTICES(1, lpPointer); + PROCESSVERTICES_DATA(D3DPROCESSVERTICES_TRANSFORMLIGHT, 0, 5, lpPointer); + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_MATERIAL, hMat2, lpPointer); + OP_PROCESS_VERTICES(1, lpPointer); + PROCESSVERTICES_DATA(D3DPROCESSVERTICES_TRANSFORMLIGHT, 5, 1, lpPointer); + OP_STATE_RENDER(3, lpPointer); + STATE_DATA(D3DRENDERSTATE_TEXTUREHANDLE, bTex, lpPointer); + STATE_DATA(D3DRENDERSTATE_WRAPU, FALSE, lpPointer); + STATE_DATA(D3DRENDERSTATE_WRAPV, FALSE, lpPointer); + /* + * Make sure that the triangle data (not OP) will be QWORD aligned + */ + if (QWORD_ALIGNED(lpPointer)) { + OP_NOP(lpPointer); + } + OP_TRIANGLE_LIST(NUM_TRIANGLES, lpPointer); + lpTri = (LPD3DTRIANGLE)lpPointer; + for (i = 0; i < NUM_TRIANGLES; i++) { + lpTri->v1 = t[i][0]; + lpTri->v2 = t[i][1]; + lpTri->v3 = t[i][2]; + lpTri->wFlags = D3DTRIFLAG_EDGEENABLETRIANGLE; + lpTri++; + } + lpPointer = (void*)lpTri; + OP_EXIT(lpPointer); + /* + * Setup the execute data + */ + lpD3DExBuf->lpVtbl->Unlock(lpD3DExBuf); + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwVertexCount = NUM_VERTICES; + d3dExData.dwInstructionOffset = (ULONG) ((char *)lpInsStart - (char *)lpBufStart); + d3dExData.dwInstructionLength = (ULONG) ((char *)lpPointer - (char*)lpInsStart); + lpD3DExBuf->lpVtbl->SetExecuteData(lpD3DExBuf, &d3dExData); + /* + * Setup lights + */ + memset(&light, 0, sizeof(D3DLIGHT)); + light.dwSize = sizeof(D3DLIGHT); + light.dltType = D3DLIGHT_DIRECTIONAL; + light.dcvColor.r = D3DVAL(1.0); + light.dcvColor.g = D3DVAL(1.0); + light.dcvColor.b = D3DVAL(1.0); + light.dcvColor.a = D3DVAL(1.0); + light.dvDirection.x = D3DVALP(0.0, 12); + light.dvDirection.y = D3DVALP(0.0, 12); + light.dvDirection.z = D3DVALP(1.0, 12); + if (lpD3D->lpVtbl->CreateLight(lpD3D, &lpD3DLight, NULL) != D3D_OK) { + return FALSE; + } + if (lpD3DLight->lpVtbl->SetLight(lpD3DLight, &light) != D3D_OK) { + return FALSE; + } + if (lpView->lpVtbl->AddLight(lpView, lpD3DLight) != D3D_OK) { + return FALSE; + } + return TRUE; +} diff --git a/sdk/samples/oct2/oct2.def b/sdk/samples/oct2/oct2.def new file mode 100644 index 0000000..40011d0 --- /dev/null +++ b/sdk/samples/oct2/oct2.def @@ -0,0 +1,10 @@ +NAME oct2.exe + +DESCRIPTION 'Direct3D Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/oct2/readme.txt b/sdk/samples/oct2/readme.txt new file mode 100644 index 0000000..0fb86a7 --- /dev/null +++ b/sdk/samples/oct2/readme.txt @@ -0,0 +1,11 @@ +Oct2 +Direct3D Immediate Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Simple spinning shape constructed from vertex and triangle data within +the source. Two materials are used. The second material is only used +on one vertex. Spinning is done by updating and setting the matrix +each frame. + +Identical to oct1 except that the background does not contain a +texture. diff --git a/sdk/samples/palette/makefile b/sdk/samples/palette/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/palette/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/palette/msvc.mk b/sdk/samples/palette/msvc.mk new file mode 100644 index 0000000..fae8360 --- /dev/null +++ b/sdk/samples/palette/msvc.mk @@ -0,0 +1,40 @@ +NAME = palette +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + gdi32.lib libc.lib + +OBJS = palette.obj lbprintf.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/palette/palette.cpp b/sdk/samples/palette/palette.cpp new file mode 100644 index 0000000..c449677 --- /dev/null +++ b/sdk/samples/palette/palette.cpp @@ -0,0 +1,477 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: palette.cpp + * Content: Does some basic palette manipulation + * + ***************************************************************************/ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <ddraw.h> +#include "resource.h" +#include "lbprintf.h" + +static char szClass[32]="DDTest1Class"; +static char szCaption[32]="DirectDraw Palette Test"; + +/* + * DirectDraw objects we will use + */ +#define MAX_PALETTES 4 +LPDIRECTDRAW lpDD; +LPDIRECTDRAWSURFACE lpDDPSurf; +LPDIRECTDRAWPALETTE lpDDPal[MAX_PALETTES]; +LPDIRECTDRAWPALETTE lpDDPalCurr; + +HWND hWndMain; + +BOOL bIsExclusive = TRUE; +BOOL bActive; + + +/* + * doAttach + * + * attach palette to the primary surface + */ +static void doAttach( int index ) +{ + HRESULT ddrval; + + ddrval = lpDDPSurf->SetPalette( lpDDPal[index] ); + if( ddrval == DDERR_SURFACELOST ) + { + lpDDPSurf->Restore(); + ddrval = lpDDPSurf->SetPalette( lpDDPal[index] ); + } + if (!FAILED(ddrval)) + { + LBPrintfDDRC( ddrval, "doAttach1: SetPalette" ); + lpDDPalCurr = lpDDPal[index]; + } + else + { + LBPrintf( "Could not attach palette" ); + lpDDPalCurr = NULL; + } + +} /* doAttach */ + +/* + * doDetach + * + * detach the current palette from the primary surface + */ +static void doDetach( void ) +{ + HRESULT ddrval; + + ddrval = lpDDPSurf->SetPalette( NULL ); + if( ddrval == DDERR_SURFACELOST ) + { + lpDDPSurf->Restore(); + ddrval = lpDDPSurf->SetPalette( NULL ); + } + LBPrintfDDRC( ddrval, "doDetach: SetPalette" ); + lpDDPalCurr = NULL; + +} /* doDetach */ + +/* + * doCycle + * + * cycle the current palette's red entries by 10 + */ +static void doCycle( void ) +{ + if( lpDDPalCurr != NULL ) + { + #define ENTRIES 10 + #define BASE 0 + PALETTEENTRY pe[ENTRIES]; + HRESULT ddrval; + int i; + + /* + * display the original entries + */ + ddrval = lpDDPalCurr->GetEntries( 0, BASE, ENTRIES, pe ); + if( ddrval == DDERR_SURFACELOST ) + { + lpDDPSurf->Restore(); + ddrval = lpDDPalCurr->GetEntries( 0, BASE, ENTRIES, pe ); + } + LBPrintfDDRC( ddrval, "GetEntries" ); + LBPrintf( "Old Entries" ); + for( i=0;i<ENTRIES;i++ ) + { + LBPrintf( " pe[%d] (r,g,b) = (%d,%d,%d)", i, pe[i].peRed, + pe[i].peGreen, pe[i].peBlue ); + } + + /* + * cycle the red values + */ + for( i=0;i<ENTRIES;i++ ) + { + pe[i].peRed = (BYTE) (((int)pe[i].peRed + 50) % 256); + } + ddrval = lpDDPalCurr->SetEntries( 0, BASE, ENTRIES, pe ); + if( ddrval == DDERR_SURFACELOST ) + { + lpDDPSurf->Restore(); + ddrval = lpDDPalCurr->SetEntries( 0, BASE, ENTRIES, pe ); + } + LBPrintfDDRC( ddrval, "SetEntries" ); + + /* + * display the new values + */ + ddrval = lpDDPalCurr->GetEntries( 0, BASE, ENTRIES, pe ); + if( ddrval == DDERR_SURFACELOST ) + { + lpDDPSurf->Restore(); + ddrval = lpDDPalCurr->GetEntries( 0, BASE, ENTRIES, pe ); + } + LBPrintfDDRC( ddrval, "GetEntries" ); + LBPrintf( "New Entries" ); + for( i=0;i<ENTRIES;i++ ) + { + LBPrintf( " pe[%d] (r,g,b) = (%d,%d,%d)", i, pe[i].peRed, + pe[i].peGreen, pe[i].peBlue ); + } + } + else + { + LBPrintf( "No palette attached" ); + } + +} /* doCycle */ + +/* + * resetExclusiveAndPalettes + * + * Sets exclusive mode to the desired value, and the rebuilds + * the palettes. + * + * Palettes in exclusive mode bypass GDI and go directly to the display + * driver, so the performance is much higher. + */ +static BOOL resetExclusiveAndPalettes( BOOL excl ) +{ + LPPALETTEENTRY ppe; + int i; + HRESULT ddrval; + + /* + * create palette entries + */ + ppe = (LPPALETTEENTRY) LocalAlloc( LPTR, sizeof( PALETTEENTRY ) * 256 ); + if( ppe == NULL ) + { + return FALSE; + } + + /* + * release existing palettes + */ + for( i=0;i<MAX_PALETTES;i++ ) + { + if( lpDDPal[i] != NULL ) + { + ddrval = lpDDPal[i]->Release(); + LBPrintfDDRC( ddrval, "Release" ); + lpDDPal[i] = NULL; + } + } + + /* + * No current palette any more. + */ + lpDDPalCurr = NULL; + + if( excl ) + { + ddrval = lpDD->SetCooperativeLevel( hWndMain, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); + } + else + { + ddrval = lpDD->SetCooperativeLevel( hWndMain, DDSCL_NORMAL ); + } + + LBPrintfDDRC( ddrval, "SetCooperativeLevel" ); + + /* + * set up 4 palettes + */ + ppe[0].peRed = 0; + ppe[0].peGreen = 0; + ppe[0].peBlue = 0; + ppe[255].peRed = 255; + ppe[255].peGreen = 255; + ppe[255].peBlue = 255; + + for( i=1;i<255;i++ ) + { + ppe[i].peRed = 0; + ppe[i].peGreen = 0; + ppe[i].peBlue = 0; + } + ddrval = lpDD->CreatePalette( DDPCAPS_8BIT, ppe, &lpDDPal[0], NULL ); + LBPrintfDDRC( ddrval, "CreatePalette" ); + + for( i=1;i<255;i++ ) + { + ppe[i].peRed = 0; + ppe[i].peGreen = 255; + ppe[i].peBlue = 255; + } + ddrval = lpDD->CreatePalette( DDPCAPS_8BIT, ppe, &lpDDPal[1], NULL ); + LBPrintfDDRC( ddrval, "CreatePalette" ); + + for( i=1;i<255;i++ ) + { + ppe[i].peRed = 255; + ppe[i].peGreen = 255; + ppe[i].peBlue = 0; + } + ddrval = lpDD->CreatePalette( DDPCAPS_8BIT, ppe, &lpDDPal[2], NULL ); + LBPrintfDDRC( ddrval, "CreatePalette" ); + + for( i=1;i<255;i++ ) + { + ppe[i].peRed = 255; + ppe[i].peGreen = 0; + ppe[i].peBlue = 255; + } + ddrval = lpDD->CreatePalette( DDPCAPS_8BIT, ppe, &lpDDPal[3], NULL ); + LBPrintfDDRC( ddrval, "CreatePalette" ); + LocalFree( ppe ); + + for( i=0;i<MAX_PALETTES;i++ ) + { + LBPrintf( "lpDDPal %d = %08lx", i+1, lpDDPal[i] ); + } + return TRUE; + +} /* resetExclusiveAndPalettes */ + +/* + * WindowProc + * + * Messages for our window are handled here + */ +LRESULT CALLBACK WindowProc( HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam ) +{ + + switch( uMsg ) + { + case WM_COMMAND: + switch( LOWORD( wParam ) ) + { + case IDM_EXCLUSIVE: + bIsExclusive = !bIsExclusive; + resetExclusiveAndPalettes( bIsExclusive ); + break; + case IDM_ATTACH1: + case IDM_ATTACH2: + case IDM_ATTACH3: + case IDM_ATTACH4: + doAttach( LOWORD( wParam ) - IDM_ATTACH1 ); + break; + case IDM_DETACH: + doDetach(); + break; + case IDM_CYCLE: + doCycle(); + break; + case IDM_CLEAR: + LBClear(); + break; + case IDM_EXIT: + DestroyWindow( hWnd ); + break; + } + break; + + case WM_PAINT: + { + PAINTSTRUCT ps; + + BeginPaint( hWnd, &ps ); + EndPaint( hWnd, &ps ); + break; + } + + case WM_INITMENU: + CheckMenuItem( (HMENU) wParam, IDM_EXCLUSIVE, MF_BYCOMMAND | + (bIsExclusive ? MF_CHECKED:MF_UNCHECKED) ); + break; + + case WM_SIZE: + /* + * resize our message listbox + */ + LBSize( LOWORD( lParam ), HIWORD( lParam ) ); + break; + + case WM_DESTROY: + /* + * free all DirectDraw objects + */ + if( lpDD != NULL ) + { + int i; + + for( i=0;i<MAX_PALETTES;i++ ) + { + if( lpDDPal[i] != NULL ) + { + lpDDPal[i]->Release(); + lpDDPal[i] = NULL; + } + } + + if( lpDDPSurf != NULL ) + { + lpDDPSurf->Release(); + lpDDPSurf = NULL; + } + lpDD->Release(); + lpDD = NULL; + } + PostQuitMessage( 0 ); + break; + + default: + return DefWindowProc( hWnd, uMsg, wParam, lParam ); + } + return 0L; + +} /* WindowProc */ + +/* + * doInit - do work required for every instance of the application: + * create the window, initialize data + */ +static BOOL doInit( HINSTANCE hInstance, int nCmdShow ) +{ + WNDCLASS wc; + HRESULT ddrval; + DDSURFACEDESC ddsd; + + /* + * set up and register window class + */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = (WNDPROC) WindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = sizeof( DWORD ); + wc.hInstance = hInstance; + wc.hIcon = LoadIcon( hInstance, IDI_APPLICATION ); + wc.hCursor = LoadCursor( NULL, IDC_ARROW ); + wc.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH ); + wc.lpszMenuName = MAKEINTRESOURCE( IDR_MENU ); + wc.lpszClassName = szClass; + if( !RegisterClass( &wc ) ) + { + return FALSE; + } + + /* + * create a window + */ + hWndMain = CreateWindow( + szClass, // class + szCaption, // caption + WS_OVERLAPPEDWINDOW, // style + CW_USEDEFAULT, // x pos + CW_USEDEFAULT, // y pos + CW_USEDEFAULT, // width + CW_USEDEFAULT, // height + NULL, // parent window + NULL, // menu + hInstance, // instance + NULL // parms + ); + + if( !hWndMain ) + { + return FALSE; + } + + LBCreate( hWndMain, 100 ); + + ShowWindow( hWndMain, nCmdShow ); + UpdateWindow( hWndMain ); + + /* + * create the main DirectDraw object + */ + ddrval = DirectDrawCreate( NULL, &lpDD, NULL ); + LBPrintfDDRC( ddrval, "DirectDrawCreate" ); + if( ddrval != DD_OK ) + { + DestroyWindow( hWndMain ); + return FALSE; + } + + ddrval = lpDD->SetCooperativeLevel( hWndMain, DDSCL_NORMAL ); + + /* + * create the primary surface + */ + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + ddrval = lpDD->CreateSurface( &ddsd, &lpDDPSurf, NULL ); + LBPrintfDDRC( ddrval, "CreateSurface" ); + if( ddrval != DD_OK ) + { + lpDD->Release(); + DestroyWindow( hWndMain ); + return FALSE; + } + + /* + * set up palettes + */ + if( !resetExclusiveAndPalettes( bIsExclusive ) ) + { + lpDDPSurf->Release(); + lpDD->Release(); + DestroyWindow( hWndMain ); + return FALSE; + } + + return TRUE; + +} /* doInit */ + +/* + * WinMain - initialization, message loop + */ +int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + + hPrevInstance = hPrevInstance; + lpCmdLine = lpCmdLine; + + if( !doInit( hInstance, nCmdShow ) ) + { + return FALSE; + } + + while( GetMessage( &msg, NULL, NULL, NULL ) ) + { + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } + + return( msg.wParam ); + +} /* WinMain */ diff --git a/sdk/samples/palette/palette.def b/sdk/samples/palette/palette.def new file mode 100644 index 0000000..ab1bedd --- /dev/null +++ b/sdk/samples/palette/palette.def @@ -0,0 +1,10 @@ +NAME PALETTE + +DESCRIPTION 'Palette Test program (C) Microsoft 1995' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/palette/palette.rc b/sdk/samples/palette/palette.rc new file mode 100644 index 0000000..56886dc --- /dev/null +++ b/sdk/samples/palette/palette.rc @@ -0,0 +1,19 @@ +#include "resource.h" + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Exclusive", IDM_EXCLUSIVE + MENUITEM "&Attach Palette 1", IDM_ATTACH1 + MENUITEM "A&ttach Palette 2", IDM_ATTACH2 + MENUITEM "Attac&h Palette 3", IDM_ATTACH3 + MENUITEM "Attach &Palette 4", IDM_ATTACH4 + MENUITEM "&Detach Palette", IDM_DETACH + MENUITEM "&Cycle Palette", IDM_CYCLE + MENUITEM SEPARATOR + MENUITEM "C&lear", IDM_CLEAR + MENUITEM SEPARATOR + MENUITEM "E&xit", IDM_EXIT + END +END diff --git a/sdk/samples/palette/readme.txt b/sdk/samples/palette/readme.txt new file mode 100644 index 0000000..843ea94 --- /dev/null +++ b/sdk/samples/palette/readme.txt @@ -0,0 +1,6 @@ +This is a basic example to show how to use DirectDraw palettes. + +4 separate DirectDrawPalette objects are created, and they can be attached +to the primary surface just by selecting a menu item. Any given palette +can be cycled through its red values. The palettes can be created in +exclusive mode or not. diff --git a/sdk/samples/palette/resource.h b/sdk/samples/palette/resource.h new file mode 100644 index 0000000..41aeea1 --- /dev/null +++ b/sdk/samples/palette/resource.h @@ -0,0 +1,10 @@ +#define IDR_MENU 102 +#define IDM_EXIT 40001 +#define IDM_ATTACH1 40002 +#define IDM_ATTACH2 40003 +#define IDM_ATTACH3 40004 +#define IDM_ATTACH4 40005 +#define IDM_DETACH 40006 +#define IDM_CYCLE 40007 +#define IDM_CLEAR 40008 +#define IDM_EXCLUSIVE 40009 diff --git a/sdk/samples/quat/makefile b/sdk/samples/quat/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/quat/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/quat/msvc.mk b/sdk/samples/quat/msvc.mk new file mode 100644 index 0000000..824c368 --- /dev/null +++ b/sdk/samples/quat/msvc.mk @@ -0,0 +1,42 @@ +NAME = quat +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = quat.obj rmmain.obj rmerror.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT = -DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/quat/quat.c b/sdk/samples/quat/quat.c new file mode 100644 index 0000000..44a2c9e --- /dev/null +++ b/sdk/samples/quat/quat.c @@ -0,0 +1,193 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: quat.c + * + ***************************************************************************/ + +/* + * demonstration of representation of orientation using quaternions + */ + +#include "rmdemo.h" + +#define PI2 6.28318 +#define XPOS 2.0 +#define INTERPOLATE_STEP 0.05 + +static D3DRMQUATERNION q; + +static int view_width, view_height; + +void ReadMouse(int* buttons, int* x, int* y); + +void CDECL +UserControl(LPDIRECT3DRMFRAME frame, void* arg, D3DVALUE delta) +{ + int mx, my, mb; + LPDIRECT3DRMFRAME scene; + D3DVALUE angle; + D3DVECTOR vx = {D3DVAL(1), D3DVAL(0), D3DVAL(0)}, + vy = {D3DVAL(0), D3DVAL(1), D3DVAL(0)}; + D3DRMQUATERNION qx, qy; + D3DRMMATRIX4D mat; + + arg = arg; + + ReadMouse(&mb, &mx, &my); + angle = D3DMultiply((-D3DVAL(0.5) + D3DDivide(D3DVAL(my), + D3DVAL(view_height))), D3DVAL(PI2)); + D3DRMQuaternionFromRotation(&qx, &vx, angle); + angle = D3DMultiply((-D3DVAL(0.5) + D3DDivide(D3DVAL(mx), + D3DVAL(view_width))), D3DVAL(PI2)); + D3DRMQuaternionFromRotation(&qy, &vy, angle); + D3DRMQuaternionMultiply(&q, &qx, &qy); + D3DRMMatrixFromQuaternion(mat, &q); + frame->lpVtbl->AddTransform(frame, D3DRMCOMBINE_REPLACE, mat); + frame->lpVtbl->GetScene(frame, &scene); + frame->lpVtbl->SetPosition(frame, scene, D3DVAL(-XPOS), D3DVAL(0), + D3DVAL(0)); + + RELEASE(scene); +} + +void CDECL +Follow(LPDIRECT3DRMFRAME frame, void* arg, D3DVALUE delta) +{ + LPDIRECT3DRMFRAME scene; + int mx, my, mb; + static D3DRMQUATERNION qstart = {D3DVAL(1), {D3DVAL(0), D3DVAL(0),D3DVAL(0)}}, + qend; + static D3DVALUE alpha = D3DVAL(0); + + arg = arg; + + ReadMouse(&mb, &mx, &my); + if (mb && alpha == D3DVAL(0)) { + qend = q; + alpha = D3DVAL(INTERPOLATE_STEP); + } + if (alpha > D3DVAL(0)) { + D3DRMQUATERNION interp; + D3DRMMATRIX4D mat; + + D3DRMQuaternionSlerp(&interp, &qstart, &qend, alpha); + D3DRMMatrixFromQuaternion(mat, &interp); + + if (alpha >= D3DVAL(1)) { + D3DRMMatrixFromQuaternion(mat, &qend); + alpha = D3DVAL(0); + qstart = qend; + } else + alpha += D3DVAL(INTERPOLATE_STEP); + + frame->lpVtbl->AddTransform(frame, D3DRMCOMBINE_REPLACE, mat); + frame->lpVtbl->GetScene(frame, &scene); + frame->lpVtbl->SetPosition(frame, scene, D3DVAL(XPOS), D3DVAL(0), D3DVAL(0)); + RELEASE(scene); + } +} + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + D3DRMRENDERQUALITY quality = D3DRMRENDER_FLAT; + LPDIRECT3DRMFRAME lights = NULL; + LPDIRECT3DRMFRAME user = NULL; + LPDIRECT3DRMFRAME follower = NULL; + LPDIRECT3DRMMESHBUILDER builder = NULL; + LPDIRECT3DRMMESH mesh = NULL; + LPDIRECT3DRMLIGHT l1 = NULL; + LPDIRECT3DRMLIGHT l2 = NULL; + HRESULT rval; + + if (FAILED(dev->lpVtbl->SetQuality(dev, quality))) + goto generic_error; + + view_width = view->lpVtbl->GetWidth(view); + view_height = view->lpVtbl->GetHeight(view); + + /* + * initialize the lights in the scene + */ + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &lights))) + goto generic_error; + if (FAILED(lights->lpVtbl->SetOrientation(lights, scene, + D3DVAL(-1), D3DVAL(-1), D3DVAL(0), D3DVAL(0), D3DVAL(1), D3DVAL(0)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_DIRECTIONAL, D3DVAL(0.8), + D3DVAL(0.6), D3DVAL(0.7), &l1))) + goto generic_error; + if (FAILED(lights->lpVtbl->AddLight(lights, l1))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT, D3DVAL(0.1), + D3DVAL(0.1), D3DVAL(0.1), &l2))) + goto generic_error; + if (FAILED(scene->lpVtbl->AddLight(scene, l2))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &builder))) + goto generic_error; + rval = builder->lpVtbl->Load(builder, "dropship.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load dropship.x.\n%s", D3DRMErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(builder->lpVtbl->Scale(builder, D3DVAL(0.1), + D3DVAL(0.08), D3DVAL(0.1)))) + goto generic_error; + if (FAILED(builder->lpVtbl->CreateMesh(builder, &mesh))) + goto generic_error; + RELEASE(builder); + + if (FAILED(camera->lpVtbl->SetPosition(camera, scene, D3DVAL(0), D3DVAL(0), + D3DVAL(-12)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &user))) + goto generic_error; + if (FAILED(user->lpVtbl->AddVisual(user, (LPDIRECT3DRMVISUAL) mesh))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &follower))) + goto generic_error; + if (FAILED(follower->lpVtbl->AddVisual(follower, (LPDIRECT3DRMVISUAL) mesh))) + goto generic_error; + + if (FAILED(follower->lpVtbl->SetPosition(follower, scene, D3DVAL(XPOS), D3DVAL(0), + D3DVAL(0)))) + goto generic_error; + + if (FAILED(user->lpVtbl->AddMoveCallback(user, UserControl, NULL))) + goto generic_error; + if (FAILED(follower->lpVtbl->AddMoveCallback(follower, Follow, NULL))) + goto generic_error; + + RELEASE(lights); + RELEASE(user); + RELEASE(follower); + RELEASE(mesh); + RELEASE(l1); + RELEASE(l2); + return TRUE; +generic_error: + Msg("A failure occurred while building the scene.\n"); +ret_with_error: + RELEASE(lights); + RELEASE(user); + RELEASE(follower); + RELEASE(builder); + RELEASE(mesh); + RELEASE(l1); + RELEASE(l2); + return FALSE; +} + +void +OverrideDefaults(Defaults* defaults) +{ + defaults->bNoTextures = TRUE; + defaults->bConstRenderQuality = TRUE; + lstrcpy(defaults->Name, "Quaternion Direct3DRM Example"); +} diff --git a/sdk/samples/quat/quat.def b/sdk/samples/quat/quat.def new file mode 100644 index 0000000..4790760 --- /dev/null +++ b/sdk/samples/quat/quat.def @@ -0,0 +1,10 @@ +NAME quat.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/quat/readme.txt b/sdk/samples/quat/readme.txt new file mode 100644 index 0000000..4ba8e32 --- /dev/null +++ b/sdk/samples/quat/readme.txt @@ -0,0 +1,5 @@ +Quat +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Using quaternions to interpolate between two vectors in space. diff --git a/sdk/samples/readme.txt b/sdk/samples/readme.txt new file mode 100644 index 0000000..5a64963 --- /dev/null +++ b/sdk/samples/readme.txt @@ -0,0 +1,65 @@ +SDK Samples +----------- + +All SDK samples are designed to be built in the directory they are in. +Just ensure that your Win32 development environment is set up, and you +can go to any sample directory and do a make. + +There is a main make files each sample directory: +MAKEFILE - for use with Microsoft VC++ 2.0 or higher (NMAKE) + +There are 2 ways to build each sample, debug or retail. To build a +sample as retail with VC++, just type: + +nmake retail + +From the SAMPLES directory, you may also run the following batch files: + +MAKEALL.BAT - makes all examples with Microsoft VC++ + +Setup +----- +We have included the source code to a sample setup program for a game +and DirectX. This is found under the SETUP directory. Note that to build +your own custom setup program, all you need to do is edit the copy_list +at the start of DINSTALL.C to be your list of files, and then search for +"fox", and then for "bear", and change things appropriately. + +Once you are done this, create a game directory that includes your files, +the setup program you have built, and then xcopy /s the REDIST directory to +the root of your game directory, ie: + +XCOPY /S GAMESDKCDROMDRIVE:\REDIST\*.* D:\FUNGAME + +If you are building an autorun CD title, you can copy our AUTORUN.INF at +the root of the Game SDK CD to the root of your game directory +is called SETUP.EXE, you will not have to make any changes to this file. +If it is something else, then you can edit AUTORUN.INF appropriately. + + +Notes for users of Visual C++ 4.2 +--------------------------------- +Visual C++ 4.2 includes the DX2 header files and libraries. If you are +getting errors compiling the samples, make sure that the DX3 include +and lib paths come before the MSVC++ 4.2 include and libs. + + +Notes for users of Watcom C/C++ +------------------------------- +Watcom C/C++ v10.6 is required to compile the DXSDK samples. +v10.0 is not sufficient. The Microsoft Win32 SDK is also required +and is expected to be in \MSTOOLS on the same drive as your DXSDK +sample files. If the Win32 SDK is elsewhere, you can set the MSTOOLS +environment variable to point to its root directory (e.g. set +MSTOOLS=\MSTOOLS). + +The Watcom makefiles expect the WATCOM environment variable +to be set, as it should have been by the Watcom installation procedure. + +Only a subset of the samples have Watcom makefiles. These are: +ddex1 through ddex5, donut and stretch. +CD into the appropriate directory and type 'wmake /f makefile.wat'. +There is also a makeallw.bat file in the sdk\samples directory which +you can run to automatically build all these samples under Watcom. + +Watcom and Watcom C/C++ are trademarks of Powersoft, Watcom Division. diff --git a/sdk/samples/rockem/arena.x b/sdk/samples/rockem/arena.x new file mode 100644 index 0000000..fad6f8e --- /dev/null +++ b/sdk/samples/rockem/arena.x @@ -0,0 +1,1450 @@ +xof 0302txt 0064 +template Header { + <3D82AB43-62DA-11cf-AB39-0020AF71E433> + WORD major; + WORD minor; + DWORD flags; +} + +template Vector { + <3D82AB5E-62DA-11cf-AB39-0020AF71E433> + FLOAT x; + FLOAT y; + FLOAT z; +} + +template Coords2d { + <F6F23F44-7686-11cf-8F52-0040333594A3> + FLOAT u; + FLOAT v; +} + +template Matrix4x4 { + <F6F23F45-7686-11cf-8F52-0040333594A3> + array FLOAT matrix[16]; +} + +template ColorRGBA { + <35FF44E0-6C7C-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; + FLOAT alpha; +} + +template ColorRGB { + <D3E16E81-7835-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; +} + +template IndexedColor { + <1630B820-7842-11cf-8F52-0040333594A3> + DWORD index; + ColorRGBA indexColor; +} + +template Boolean { + <4885AE61-78E8-11cf-8F52-0040333594A3> + WORD truefalse; +} + +template Boolean2d { + <4885AE63-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template MaterialWrap { + <4885AE60-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template TextureFilename { + <A42790E1-7810-11cf-8F52-0040333594A3> + STRING filename; +} + +template Material { + <3D82AB4D-62DA-11cf-AB39-0020AF71E433> + ColorRGBA faceColor; + FLOAT power; + ColorRGB specularColor; + ColorRGB emissiveColor; + [...] +} + +template MeshFace { + <3D82AB5F-62DA-11cf-AB39-0020AF71E433> + DWORD nFaceVertexIndices; + array DWORD faceVertexIndices[nFaceVertexIndices]; +} + +template MeshFaceWraps { + <4885AE62-78E8-11cf-8F52-0040333594A3> + DWORD nFaceWrapValues; + Boolean2d faceWrapValues; +} + +template MeshTextureCoords { + <F6F23F40-7686-11cf-8F52-0040333594A3> + DWORD nTextureCoords; + array Coords2d textureCoords[nTextureCoords]; +} + +template MeshMaterialList { + <F6F23F42-7686-11cf-8F52-0040333594A3> + DWORD nMaterials; + DWORD nFaceIndexes; + array DWORD faceIndexes[nFaceIndexes]; + [Material] +} + +template MeshNormals { + <F6F23F43-7686-11cf-8F52-0040333594A3> + DWORD nNormals; + array Vector normals[nNormals]; + DWORD nFaceNormals; + array MeshFace faceNormals[nFaceNormals]; +} + +template MeshVertexColors { + <1630B821-7842-11cf-8F52-0040333594A3> + DWORD nVertexColors; + array IndexedColor vertexColors[nVertexColors]; +} + +template Mesh { + <3D82AB44-62DA-11cf-AB39-0020AF71E433> + DWORD nVertices; + array Vector vertices[nVertices]; + DWORD nFaces; + array MeshFace faces[nFaces]; + [...] +} + +Header { + 1; + 0; + 1; +} + +Mesh { + 164; + -509.760864;-418.136444;-863.679443;, + -466.708588;-418.137299;890.074646;, + -605.528442;-95.125122;678.490051;, + -998.383423;-418.136810;-48.462238;, + -880.561401;-418.136627;-474.215302;, + -738.448608;-418.136505;-676.000427;, + -139.410217;-418.136322;-996.193115;, + 205.181686;-418.136322;-987.733948;, + 483.728363;-418.136444;-888.068176;, + 818.229065;-418.136566;-599.525757;, + 986.405762;-418.136749;-243.946945;, + 1005.706177;-418.136932;148.922470;, + 818.229065;-418.137115;601.532104;, + 439.531586;-418.137299;912.321655;, + 156.429657;-418.137360;998.199402;, + -284.128326;-418.137299;965.702087;, + -801.209717;-418.137115;601.532104;, + -988.686340;-418.136932;148.922470;, + 997.246643;-188.884811;197.675293;, + 895.455627;-95.124893;223.171524;, + 742.920349;-95.125015;545.679260;, + 846.720764;-188.885056;561.077759;, + 648.046570;-188.885162;780.280945;, + 553.185669;-95.125153;735.414001;, + 348.130768;-188.885239;950.181030;, + 230.678268;-95.125198;887.949036;, + 57.975639;-188.885315;1007.896545;, + -125.652954;-95.125076;905.454468;, + -139.410217;-188.885284;998.199585;, + -331.111328;-188.885239;950.181030;, + -382.424255;-95.125160;827.563660;, + -631.026794;-188.885162;780.280945;, + -880.561401;-188.885025;476.221832;, + -836.237000;-95.124939;350.908905;, + -980.227173;-188.884811;197.675293;, + -895.941040;-95.124672;135.165833;, + -895.941040;-95.124680;-133.159500;, + -980.227173;-188.884689;-195.668777;, + -922.860046;-188.884583;-384.782928;, + -818.050415;-95.124565;-389.930847;, + -801.209717;-188.884430;-599.525757;, + -638.031372;-95.124420;-645.538086;, + -592.019043;-188.884384;-808.716370;, + -341.395660;-95.124344;-843.743652;, + -284.128326;-188.884277;-963.695496;, + -90.301964;-188.884277;-1002.249756;, + -36.355202;-95.124306;-912.242737;, + 253.460159;-188.884277;-976.892639;, + 273.930817;-95.124313;-873.972717;, + 609.038818;-188.884384;-808.716370;, + 622.547852;-95.124420;-676.483704;, + 721.349487;-188.884430;-711.836487;, + 853.256714;-95.124603;-348.902466;, + 939.879883;-188.884583;-384.782928;, + 1015.403198;-188.884735;-48.462208;, + 921.756226;-95.124718;-43.862041;, + -412.364868;-95.124382;-658.926392;, + -524.849854;-95.124451;-546.426147;, + -636.946472;-95.124504;-441.080963;, + -686.756287;-95.124550;-351.057495;, + -725.945435;-95.124588;-268.492096;, + 426.350616;-95.124367;-660.925049;, + 404.913300;-95.124359;-674.393066;, + -268.926666;-95.124496;-424.244751;, + -774.182434;-95.124657;-4.997503;, + -744.480225;-95.124634;-155.931580;, + -499.258789;-95.124687;-4.997503;, + -141.506195;-95.124588;-215.769913;, + -180.116196;-95.124619;-172.606064;, + -230.511444;-95.124680;-109.106934;, + 262.796906;-95.124489;-439.001526;, + -255.041565;-95.124763;-4.997503;, + -240.241516;-95.124725;-60.986412;, + 527.804749;-95.124420;-573.076050;, + -121.273987;-95.124832;75.974876;, + -141.310745;-95.124779;1.196889;, + -121.274124;-95.124725;-73.581116;, + -66.532890;-95.124695;-128.322464;, + 8.245086;-95.124680;-148.359268;, + 136.553513;-95.124634;-229.900833;, + 83.023079;-95.124702;-128.322647;, + -339.386353;-95.125191;702.153198;, + -239.844910;-95.125069;478.473114;, + -127.782547;-95.124924;226.657135;, + -63.752640;-95.124924;244.517105;, + 189.934555;-95.124672;-177.455978;, + 237.352859;-95.124695;-130.869339;, + 157.801254;-95.124771;1.196710;, + 83.023346;-95.124847;130.716019;, + 8.245354;-95.124870;150.752762;, + -66.532639;-95.124870;130.716110;, + 137.764450;-95.124733;-73.581451;, + -194.079697;-95.125153;743.516235;, + -87.321465;-95.125099;777.463013;, + 8.329406;-95.124916;264.622955;, + 72.383354;-95.124886;246.850861;, + 144.492859;-95.124840;226.843842;, + 272.529541;-95.124718;5.989942;, + 255.981567;-95.124702;-58.392082;, + 137.764587;-95.124802;75.974716;, + -36.737411;-95.125107;779.131714;, + 75.287613;-95.125145;779.404297;, + 246.068604;-95.125175;737.264404;, + 262.455902;-95.124985;440.721069;, + 372.871857;-95.125175;693.328247;, + 395.254669;-95.125168;681.496704;, + 546.636292;-95.124756;-22.868746;, + 753.291687;-95.124664;-195.022186;, + 729.310852;-95.124596;-304.452942;, + 705.464294;-95.124565;-349.093567;, + 649.686829;-95.124504;-446.248199;, + 790.122864;-95.124741;-48.503696;, + 8.329406;-92.201492;264.622955;, + 125.697510;-92.201477;774.895813;, + -112.442253;-92.201477;774.316345;, + 144.492859;-92.201309;226.843719;, + 395.254669;-92.201469;681.496643;, + -339.386353;-92.201485;702.153015;, + -127.782547;-92.201309;226.657028;, + -141.506195;-92.201347;-215.769928;, + -223.580521;-92.201324;-124.015350;, + -651.477112;-92.201118;-419.781830;, + -734.782532;-92.201363;-244.270538;, + -774.182434;-92.201332;-4.997512;, + -255.041565;-92.201332;-4.997512;, + -412.364868;-92.201378;-658.926453;, + 237.352859;-92.201401;-130.869324;, + 620.578003;-92.201149;-487.649506;, + 739.146057;-92.201248;-281.124725;, + 136.553482;-92.201172;-229.900818;, + 404.913361;-92.201088;-674.393250;, + 790.122986;-92.201355;-48.503719;, + 272.529480;-92.201271;5.989976;, + 157.801254;-92.277321;1.196713;, + 137.764587;-92.277328;75.974716;, + 8.245265;-92.277321;1.196759;, + 83.023346;-92.277336;130.716019;, + 8.245354;-92.277344;150.752762;, + -66.532639;-92.277336;130.716110;, + -121.273987;-92.277328;75.974876;, + -141.310745;-92.277321;1.196893;, + -121.274124;-92.277290;-73.581116;, + -66.532890;-92.277283;-128.322464;, + 8.245086;-92.277275;-148.359268;, + 83.023079;-92.277283;-128.322647;, + 137.764450;-92.277290;-73.581451;, + -605.528442;-95.125153;678.490051;, + 895.455627;-95.124893;223.171524;, + 742.920349;-95.125015;545.679260;, + 553.185669;-95.125153;735.414001;, + 230.678268;-95.125198;887.949036;, + -125.652954;-95.125076;905.454468;, + -382.424255;-95.125191;827.563660;, + -836.237000;-95.124939;350.908905;, + -895.941040;-95.124672;135.165833;, + -895.941040;-95.124680;-133.159500;, + -818.050415;-95.124565;-389.930847;, + -638.031372;-95.124420;-645.538086;, + -341.395660;-95.124374;-843.743652;, + -36.355202;-95.124306;-912.242737;, + 273.930817;-95.124313;-873.972717;, + 622.547852;-95.124420;-676.483704;, + 853.256714;-95.124603;-348.902466;, + 921.756226;-95.124718;-43.862041;; + + 222; + 3;37,4,3;, + 3;38,4,37;, + 3;40,4,38;, + 3;40,5,4;, + 3;42,5,40;, + 3;42,0,5;, + 3;44,0,42;, + 3;44,6,0;, + 3;45,6,44;, + 3;45,7,6;, + 3;47,7,45;, + 3;47,8,7;, + 3;49,8,47;, + 3;49,9,8;, + 3;51,9,49;, + 3;53,9,51;, + 3;53,10,9;, + 3;54,10,53;, + 3;54,11,10;, + 3;18,11,54;, + 3;18,12,11;, + 3;21,12,18;, + 3;22,12,21;, + 3;22,13,12;, + 3;24,13,22;, + 3;24,14,13;, + 3;26,14,24;, + 3;26,15,14;, + 3;28,15,26;, + 3;29,15,28;, + 3;31,1,29;, + 3;29,1,15;, + 3;31,16,1;, + 3;32,16,31;, + 3;32,17,16;, + 3;34,17,32;, + 3;37,3,34;, + 3;34,3,17;, + 3;54,19,18;, + 3;19,20,18;, + 3;18,20,21;, + 3;20,23,21;, + 3;21,23,22;, + 3;24,22,23;, + 3;23,25,24;, + 3;26,24,25;, + 3;27,26,25;, + 3;28,26,27;, + 3;27,30,28;, + 3;28,30,29;, + 3;31,29,30;, + 3;2,31,30;, + 3;32,31,2;, + 3;2,33,32;, + 3;34,32,33;, + 3;35,34,33;, + 3;35,36,34;, + 3;37,34,36;, + 3;38,37,36;, + 3;39,38,36;, + 3;38,39,40;, + 3;41,40,39;, + 3;42,40,41;, + 3;41,43,42;, + 3;44,42,43;, + 3;43,46,44;, + 3;44,46,45;, + 3;45,46,47;, + 3;46,48,47;, + 3;49,47,48;, + 3;50,49,48;, + 3;51,49,50;, + 3;50,52,51;, + 3;53,51,52;, + 3;54,53,55;, + 3;55,53,52;, + 3;19,54,55;, + 3;83,82,81;, + 3;84,83,81;, + 3;81,92,94;, + 3;94,84,81;, + 3;92,93,95;, + 3;95,94,92;, + 3;96,95,93;, + 3;93,100,103;, + 3;103,96,93;, + 3;100,101,103;, + 3;102,104,105;, + 3;101,102,103;, + 3;105,103,102;, + 3;112,114,113;, + 3;112,113,115;, + 3;115,113,116;, + 3;114,112,117;, + 3;117,112,118;, + 3;119,121,120;, + 3;120,121,122;, + 3;120,122,123;, + 3;120,123,124;, + 3;121,119,125;, + 3;126,128,127;, + 3;126,127,129;, + 3;129,127,130;, + 3;128,126,131;, + 3;131,126,132;, + 3;133,135,134;, + 3;134,135,136;, + 3;136,135,137;, + 3;137,135,138;, + 3;138,135,139;, + 3;139,135,140;, + 3;140,135,141;, + 3;141,135,142;, + 3;142,135,143;, + 3;143,135,144;, + 3;144,135,145;, + 3;145,135,133;, + 3;121,125,57;, + 3;56,57,125;, + 3;121,57,58;, + 3;58,59,121;, + 3;59,122,121;, + 3;59,60,122;, + 3;125,63,56;, + 3;60,123,122;, + 3;60,65,123;, + 3;119,63,125;, + 3;127,73,130;, + 3;130,73,61;, + 3;130,61,62;, + 3;123,64,66;, + 3;65,64,123;, + 3;119,67,63;, + 3;66,124,123;, + 3;71,124,66;, + 3;119,120,67;, + 3;68,67,120;, + 3;69,68,120;, + 3;120,72,69;, + 3;70,130,62;, + 3;70,129,130;, + 3;79,129,70;, + 3;71,120,124;, + 3;120,71,72;, + 3;127,110,73;, + 3;129,79,85;, + 3;139,74,90;, + 3;90,138,139;, + 3;139,140,74;, + 3;140,141,75;, + 3;74,140,75;, + 3;76,75,141;, + 3;141,142,76;, + 3;77,76,142;, + 3;142,143,77;, + 3;143,144,78;, + 3;77,143,78;, + 3;144,145,80;, + 3;78,144,80;, + 3;117,81,92;, + 3;117,118,81;, + 3;118,83,82;, + 3;118,112,83;, + 3;81,118,82;, + 3;83,112,84;, + 3;84,112,94;, + 3;98,126,86;, + 3;126,129,86;, + 3;85,86,129;, + 3;134,99,133;, + 3;133,99,87;, + 3;136,137,88;, + 3;137,138,89;, + 3;88,137,89;, + 3;89,138,90;, + 3;145,133,91;, + 3;145,91,80;, + 3;133,87,91;, + 3;92,114,117;, + 3;114,92,93;, + 3;100,114,93;, + 3;112,115,94;, + 3;115,95,94;, + 3;115,116,96;, + 3;95,115,96;, + 3;116,103,96;, + 3;132,126,97;, + 3;97,126,98;, + 3;134,136,99;, + 3;99,136,88;, + 3;100,113,114;, + 3;113,100,101;, + 3;113,101,102;, + 3;102,116,113;, + 3;104,116,102;, + 3;103,116,105;, + 3;106,132,97;, + 3;116,104,105;, + 3;106,131,132;, + 3;131,111,107;, + 3;107,128,131;, + 3;107,108,128;, + 3;128,108,109;, + 3;109,127,128;, + 3;127,109,110;, + 3;111,131,106;, + 3;156,155,157;, + 3;157,155,158;, + 3;158,155,159;, + 3;159,155,160;, + 3;160,155,161;, + 3;161,155,154;, + 3;161,154,153;, + 3;161,153,146;, + 3;161,146,152;, + 3;161,152,151;, + 3;161,151,150;, + 3;161,150,149;, + 3;161,149,162;, + 3;162,149,148;, + 3;162,148,147;, + 3;162,147,163;; + + MeshMaterialList { + 3; + 222; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2; + Material { + 1.000000;1.000000;0.000000;1.000000;; + 29.000000; + 0.768627;0.768627;0.768627;; + 0.000000;0.000000;0.000000;; + TextureFilename { + "gdk_fill.ppm"; + } + } + Material { + 0.066667;0.066667;0.066667;1.000000;; + 25.000000; + 1.000000;1.000000;1.000000;; + 0.000000;0.000000;0.000000;; + } + Material { + 1.000000;1.000000;1.000000;1.000000;; + 15.000000; + 0.000000;0.000000;0.000000;; + 0.000000;0.000000;0.000000;; + TextureFilename { + "gdk_fill.ppm"; + } + } + } + MeshNormals { + 281; + -0.478434;-0.023088;-0.877820;, + -0.513663;-0.019389;0.857773;, + -0.501055;0.722024;0.477100;, + -0.997321;0.003663;-0.073064;, + -0.910930;-0.039890;-0.410627;, + -0.724168;-0.010650;-0.689541;, + -0.170866;-0.031963;-0.984776;, + 0.146440;-0.008894;-0.989180;, + 0.478056;-0.014197;-0.878215;, + 0.807875;-0.032077;-0.588481;, + 0.971451;-0.033798;-0.234820;, + 0.989704;-0.037440;0.138148;, + 0.782155;-0.051683;0.620936;, + 0.477863;-0.040690;0.877491;, + 0.139034;-0.024856;0.989976;, + -0.188979;-0.046382;0.980885;, + -0.797178;-0.046338;0.601964;, + -0.965095;-0.040664;0.258724;, + 0.972871;-0.013218;0.230969;, + 0.669600;0.711620;0.212679;, + 0.697325;0.701086;0.149052;, + 0.617521;0.692520;0.372939;, + 0.844771;-0.010578;0.535024;, + 0.557100;0.717609;0.417943;, + 0.628008;-0.017369;0.778013;, + 0.437782;0.708062;0.554071;, + 0.422888;0.712077;0.560457;, + 0.328933;0.017757;0.944186;, + 0.265524;0.701979;0.660850;, + 0.154368;0.733160;0.662304;, + 0.024493;-0.047537;0.998569;, + 0.047594;0.715499;0.696991;, + -0.070257;0.728736;0.681181;, + -0.146855;-0.047353;0.988024;, + -0.134349;0.722061;0.678659;, + -0.374975;0.021236;0.926792;, + -0.268212;0.707827;0.653485;, + -0.282169;0.713143;0.641723;, + -0.646881;0.012618;0.762486;, + -0.446610;0.688458;0.571458;, + -0.889469;-0.022954;0.456419;, + -0.608299;0.702579;0.369262;, + -0.638423;0.719843;0.272475;, + -0.991217;0.023119;0.130210;, + -0.708505;0.690417;0.146100;, + -0.708948;0.699138;0.092735;, + -0.705655;0.701385;-0.100544;, + -0.981950;-0.026561;-0.187267;, + -0.705655;0.701385;-0.100544;, + -0.918966;-0.015847;-0.394019;, + -0.647672;0.708630;-0.279935;, + -0.612996;0.724978;-0.314074;, + -0.803183;0.014182;-0.595564;, + -0.569734;0.703672;-0.424557;, + -0.479766;0.730301;-0.486298;, + -0.602316;0.017757;-0.798060;, + -0.412756;0.697934;-0.585253;, + -0.284138;0.725851;-0.626423;, + -0.329137;-0.003467;-0.944276;, + -0.207799;0.712127;-0.670593;, + -0.032572;0.005332;-0.999455;, + -0.040220;0.703908;-0.709152;, + -0.035844;0.722861;-0.690063;, + 0.282509;0.028433;-0.958843;, + 0.153227;0.696015;-0.701487;, + 0.243429;0.723633;-0.645831;, + 0.545231;-0.007880;-0.838249;, + 0.371191;0.710825;-0.597449;, + 0.452377;0.734999;-0.505105;, + 0.749174;-0.007881;-0.662326;, + 0.541288;0.713241;-0.445302;, + 0.619892;0.717664;-0.317320;, + 0.913974;0.021393;-0.405209;, + 0.649879;0.707079;-0.278741;, + 0.997868;0.000082;-0.065269;, + 0.699072;0.714950;-0.012055;, + 0.705797;0.707079;-0.043472;, + -0.707155;-0.000015;-0.707059;, + 0.853247;-0.000011;-0.521507;, + -0.599156;0.517366;-0.611018;, + -0.796240;0.200626;-0.570746;, + -0.889629;0.000009;-0.456685;, + -0.932439;-0.167941;-0.319927;, + 0.519032;0.445579;-0.729428;, + 0.531977;-0.000064;-0.846759;, + -0.856075;-0.000014;-0.516851;, + 0.853247;-0.000011;-0.521507;, + 0.000000;0.000003;1.000000;, + -0.981182;-0.000000;-0.193086;, + -0.857495;-0.489219;-0.159271;, + 0.000000;0.000003;1.000000;, + 0.853247;-0.000003;-0.521507;, + 0.745330;0.000003;0.666696;, + 0.680916;0.444080;0.582362;, + 0.906795;0.000010;0.421571;, + -0.856075;-0.000014;-0.516851;, + 0.000000;0.000003;1.000000;, + 0.966793;0.000001;0.255561;, + 0.871114;-0.444071;0.209672;, + 0.672864;-0.142847;-0.725843;, + -0.707106;-0.000000;0.707108;, + -0.965926;-0.000000;0.258820;, + -0.965926;0.000000;-0.258818;, + -0.965926;-0.000001;0.258820;, + -0.965926;0.000000;-0.258818;, + -0.707108;0.000000;-0.707106;, + -0.707108;0.000000;-0.707106;, + -0.258820;0.000000;-0.965926;, + 0.258818;0.000000;-0.965926;, + -0.258820;0.000000;-0.965926;, + -0.856075;-0.000006;-0.516851;, + -0.700824;-0.000011;0.713334;, + 0.707106;0.000000;-0.707108;, + 0.258818;0.000000;-0.965926;, + -0.907564;0.114928;-0.403881;, + -0.273784;0.000060;0.961791;, + -0.913617;-0.000025;-0.406575;, + -0.208608;-0.973583;-0.092835;, + -0.913617;-0.000015;-0.406575;, + -0.907564;0.114928;-0.403881;, + -0.913617;-0.000015;-0.406575;, + 0.268675;-0.000035;-0.963231;, + -0.000000;1.000000;0.000001;, + 0.268676;-0.000038;-0.963231;, + -0.700824;-0.000011;0.713334;, + -0.866368;-0.000003;0.499407;, + 0.965926;-0.000000;0.258819;, + 0.965926;0.000000;-0.258820;, + 0.258820;-0.000000;0.965926;, + 0.707107;0.000001;0.707106;, + -0.258818;-0.000000;0.965926;, + 0.258820;-0.000001;0.965926;, + -0.707106;-0.000000;0.707108;, + -0.258818;-0.000000;0.965926;, + 0.965926;0.000000;-0.258820;, + 0.707106;0.000000;-0.707108;, + -0.000000;1.000000;0.000000;, + -0.248834;-0.482049;0.840066;, + -0.000001;1.000000;0.000000;, + -0.141809;-0.168636;0.975424;, + -0.000000;1.000000;0.000000;, + 0.000685;-0.000000;-1.000000;, + -0.000001;1.000000;0.000000;, + -0.267355;0.000003;-0.963598;, + -0.000001;1.000000;0.000000;, + 0.875644;-0.000020;-0.482957;, + -0.267354;-0.000040;-0.963598;, + -0.968520;-0.000023;0.248936;, + 0.104704;-0.000009;0.994503;, + -0.968520;-0.000001;0.248937;, + 0.965926;-0.000000;0.258819;, + 0.707107;-0.000000;0.707106;, + 0.000000;1.000000;0.000000;, + -0.013766;0.743938;0.668107;, + 0.000000;1.000000;0.000001;, + 0.094418;-0.100648;0.990432;, + 0.000001;1.000000;0.000002;, + 0.292164;-0.142842;0.945641;, + 0.000000;1.000000;0.000000;, + 0.875644;-0.000009;-0.482958;, + 0.000001;1.000000;0.000002;, + 0.372181;0.445604;0.814198;, + 0.000001;1.000000;0.000002;, + 0.875644;-0.000009;-0.482958;, + 0.467327;0.000018;0.884085;, + 0.104704;-0.000009;0.994503;, + 0.851901;-0.482114;-0.204529;, + 0.915645;-0.168639;-0.364904;, + 0.585462;0.743957;-0.322121;, + 0.810531;-0.100646;-0.576983;, + 0.969828;-0.000042;-0.243791;, + 0.104704;0.000003;0.994503;, + 0.000000;1.000000;-0.000000;, + 0.000685;-0.000018;-1.000000;, + 0.000000;1.000000;-0.000000;, + 0.172030;0.431894;0.885366;, + 0.000000;1.000000;-0.000000;, + -0.097626;0.320694;0.942138;, + -0.000001;1.000000;0.000000;, + -0.267355;0.000000;-0.963598;, + 0.875644;-0.000020;-0.482957;, + 0.000000;1.000000;0.000000;, + 0.875644;-0.000020;-0.482957;, + 0.372181;0.445601;0.814200;, + -0.000000;1.000000;-0.000000;, + -0.248834;-0.482049;0.840066;, + -0.913617;-0.000025;-0.406575;, + 0.000001;1.000000;0.000001;, + -0.913617;-0.000025;-0.406575;, + 0.268675;-0.000035;-0.963231;, + 0.000000;1.000000;0.000000;, + 0.853247;0.000001;-0.521507;, + 0.745330;0.000003;0.666696;, + 0.000000;1.000000;0.000000;, + 0.890720;0.000005;0.454553;, + 0.000000;1.000000;0.000000;, + -0.774106;0.285676;-0.564934;, + -0.000000;1.000000;0.000001;, + -0.932438;-0.167945;-0.319927;, + -0.000000;1.000000;-0.000000;, + -0.857489;-0.489230;-0.159269;, + 0.000000;0.000003;1.000000;, + -0.000000;1.000000;0.000000;, + -0.000000;0.000003;1.000000;, + 0.966793;0.000001;0.255561;, + 0.000001;1.000000;-0.000000;, + -0.707155;-0.000023;-0.707059;, + 0.853247;-0.000011;-0.521507;, + -0.000000;1.000000;0.000001;, + -0.866368;-0.000003;0.499407;, + -0.000000;1.000000;0.000001;, + 0.680725;0.431920;-0.591657;, + -0.000000;1.000000;0.000001;, + 0.864722;0.320713;-0.386522;, + 0.000001;1.000000;0.000002;, + -0.856075;0.000000;-0.516851;, + -0.700824;-0.000011;0.713334;, + 0.000000;1.000000;0.000000;, + 0.519033;0.445576;-0.729429;, + -0.856075;-0.000014;-0.516851;, + -0.000000;1.000000;0.000000;, + 0.104704;0.000004;0.994503;, + 0.851901;-0.482114;-0.204529;, + 0.000000;1.000000;-0.000001;, + -0.968520;-0.000023;0.248936;, + 0.104704;-0.000009;0.994503;, + 0.000000;1.000000;0.000000;, + 0.965926;-0.000000;0.258819;, + 0.965926;0.000000;-0.258820;, + 0.000000;1.000000;0.000000;, + 0.965926;-0.000000;0.258819;, + 0.707107;-0.000000;0.707106;, + 0.000000;1.000000;0.000000;, + -0.000000;1.000000;0.000000;, + 0.258820;-0.000000;0.965926;, + 0.707107;-0.000000;0.707106;, + -0.000000;1.000000;0.000000;, + 0.258820;-0.000000;0.965926;, + -0.258818;-0.000000;0.965926;, + 0.000000;1.000000;0.000000;, + -0.707106;-0.000000;0.707108;, + -0.258818;-0.000000;0.965926;, + 0.000000;1.000000;0.000000;, + -0.707106;-0.000000;0.707108;, + -0.965926;-0.000000;0.258820;, + 0.000000;1.000000;0.000000;, + -0.965926;-0.000000;0.258820;, + -0.965926;0.000000;-0.258818;, + 0.000000;1.000000;0.000000;, + -0.965926;0.000000;-0.258818;, + -0.707108;0.000000;-0.707106;, + 0.000000;1.000000;0.000000;, + -0.707108;0.000000;-0.707106;, + -0.258820;0.000000;-0.965926;, + -0.000000;1.000000;0.000000;, + -0.258820;0.000000;-0.965926;, + 0.258818;0.000000;-0.965926;, + 0.000000;1.000000;0.000000;, + 0.258818;0.000000;-0.965926;, + 0.707106;0.000000;-0.707108;, + -0.000000;1.000000;0.000000;, + 0.707106;0.000000;-0.707108;, + 0.965926;0.000000;-0.258820;, + 0.000000;1.000000;0.000001;, + 0.000000;1.000000;0.000000;, + -0.000000;1.000000;0.000000;, + 0.000000;1.000000;0.000001;, + 0.000000;1.000000;0.000001;, + -0.000001;1.000000;0.000000;, + -0.000000;1.000000;0.000000;, + 0.000000;1.000000;0.000001;, + -0.000000;1.000000;-0.000000;, + -0.000000;1.000000;0.000000;, + -0.000000;1.000000;0.000000;, + -0.000000;1.000000;0.000000;, + 0.000000;1.000000;0.000001;, + -0.000000;1.000000;0.000000;, + -0.000000;1.000000;0.000000;, + 0.000000;1.000000;0.000001;, + 0.000000;1.000000;0.000001;, + -0.000001;1.000000;0.000001;; + + 222; + 3;47,4,3;, + 3;49,4,47;, + 3;52,4,49;, + 3;52,5,4;, + 3;55,5,52;, + 3;55,0,5;, + 3;58,0,55;, + 3;58,6,0;, + 3;60,6,58;, + 3;60,7,6;, + 3;63,7,60;, + 3;63,8,7;, + 3;66,8,63;, + 3;66,9,8;, + 3;69,9,66;, + 3;72,9,69;, + 3;72,10,9;, + 3;74,10,72;, + 3;74,11,10;, + 3;18,11,74;, + 3;18,12,11;, + 3;22,12,18;, + 3;24,12,22;, + 3;24,13,12;, + 3;27,13,24;, + 3;27,14,13;, + 3;30,14,27;, + 3;30,15,14;, + 3;33,15,30;, + 3;35,15,33;, + 3;38,1,35;, + 3;35,1,15;, + 3;38,16,1;, + 3;40,16,38;, + 3;40,17,16;, + 3;43,17,40;, + 3;47,3,43;, + 3;43,3,17;, + 3;75,20,19;, + 3;20,21,19;, + 3;19,21,23;, + 3;21,26,23;, + 3;23,26,25;, + 3;28,25,26;, + 3;26,29,28;, + 3;31,28,29;, + 3;32,31,29;, + 3;34,31,32;, + 3;32,37,34;, + 3;34,37,36;, + 3;39,36,37;, + 3;2,39,37;, + 3;41,39,2;, + 3;2,42,41;, + 3;44,41,42;, + 3;45,44,42;, + 3;45,46,44;, + 3;48,44,46;, + 3;50,48,46;, + 3;51,50,46;, + 3;50,51,53;, + 3;54,53,51;, + 3;56,53,54;, + 3;54,57,56;, + 3;59,56,57;, + 3;57,62,59;, + 3;59,62,61;, + 3;61,62,64;, + 3;62,65,64;, + 3;67,64,65;, + 3;68,67,65;, + 3;70,67,68;, + 3;68,71,70;, + 3;73,70,71;, + 3;75,73,76;, + 3;76,73,71;, + 3;20,75,76;, + 3;119,117,114;, + 3;122,119,114;, + 3;114,136,140;, + 3;140,122,114;, + 3;136,138,142;, + 3;142,140,136;, + 3;144,142,138;, + 3;138,152,158;, + 3;158,144,138;, + 3;152,154,158;, + 3;156,160,162;, + 3;154,156,158;, + 3;162,158,156;, + 3;172,176,174;, + 3;172,174,178;, + 3;178,174,181;, + 3;176,172,184;, + 3;184,172,187;, + 3;190,195,193;, + 3;193,195,197;, + 3;193,197,199;, + 3;193,199,202;, + 3;195,190,205;, + 3;208,212,210;, + 3;208,210,214;, + 3;214,210,217;, + 3;212,208,220;, + 3;220,208,223;, + 3;226,232,229;, + 3;229,232,233;, + 3;233,232,236;, + 3;236,232,239;, + 3;239,232,242;, + 3;242,232,245;, + 3;245,232,248;, + 3;248,232,251;, + 3;251,232,254;, + 3;254,232,257;, + 3;257,232,260;, + 3;260,232,226;, + 3;196,206,79;, + 3;77,79,206;, + 3;196,79,80;, + 3;80,81,196;, + 3;81,198,196;, + 3;81,82,198;, + 3;207,86,78;, + 3;82,200,198;, + 3;82,89,200;, + 3;191,86,207;, + 3;211,99,218;, + 3;218,99,83;, + 3;218,83,84;, + 3;201,87,90;, + 3;89,88,200;, + 3;191,91,86;, + 3;90,203,201;, + 3;96,203,90;, + 3;192,194,92;, + 3;93,92,194;, + 3;94,93,194;, + 3;194,98,94;, + 3;95,219,85;, + 3;95,215,219;, + 3;110,215,95;, + 3;97,194,204;, + 3;194,97,98;, + 3;211,169,99;, + 3;216,111,124;, + 3;243,100,132;, + 3;132,240,243;, + 3;244,246,101;, + 3;247,249,102;, + 3;101,246,103;, + 3;104,102,249;, + 3;250,252,105;, + 3;106,105,252;, + 3;253,255,107;, + 3;256,258,108;, + 3;107,255,109;, + 3;259,261,112;, + 3;108,258,113;, + 3;185,115,137;, + 3;186,188,116;, + 3;188,120,118;, + 3;189,173,121;, + 3;116,188,118;, + 3;121,173,123;, + 3;123,173,141;, + 3;149,209,125;, + 3;209,216,125;, + 3;124,125,216;, + 3;230,150,227;, + 3;227,150,126;, + 3;234,237,128;, + 3;238,241,130;, + 3;128,237,131;, + 3;130,241,133;, + 3;262,228,134;, + 3;261,135,112;, + 3;228,127,134;, + 3;137,177,185;, + 3;177,137,139;, + 3;153,177,139;, + 3;173,179,141;, + 3;179,143,141;, + 3;180,182,145;, + 3;143,179,146;, + 3;182,159,145;, + 3;224,209,147;, + 3;147,209,149;, + 3;231,235,151;, + 3;151,235,129;, + 3;153,175,177;, + 3;175,153,155;, + 3;175,155,157;, + 3;157,183,175;, + 3;161,183,157;, + 3;159,182,163;, + 3;165,225,148;, + 3;183,161,164;, + 3;165,221,225;, + 3;222,170,166;, + 3;166,213,222;, + 3;166,167,213;, + 3;213,167,168;, + 3;168,211,213;, + 3;211,168,169;, + 3;171,221,165;, + 3;273,272,274;, + 3;274,272,275;, + 3;275,272,276;, + 3;276,272,277;, + 3;277,272,278;, + 3;278,272,271;, + 3;278,271,270;, + 3;278,270,263;, + 3;278,263,269;, + 3;278,269,268;, + 3;278,268,267;, + 3;278,267,266;, + 3;278,266,279;, + 3;279,266,265;, + 3;279,265,264;, + 3;279,264,280;; + } + MeshTextureCoords { + 164; + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.268884;0.856707;, + 0.207531;0.795346;, + 0.146390;0.737888;, + 0.119222;0.688786;, + 0.097847;0.643752;, + 0.726345;0.857798;, + 0.714652;0.865143;, + 0.347119;0.728705;, + 0.071537;0.500034;, + 0.087737;0.582358;, + 0.221489;0.500034;, + 0.416618;0.614996;, + 0.395559;0.591453;, + 0.368072;0.556819;, + 0.637138;0.736753;, + 0.354693;0.500034;, + 0.362765;0.530572;, + 0.781681;0.809882;, + 0.427654;0.455869;, + 0.416725;0.496656;, + 0.427653;0.537442;, + 0.457511;0.567299;, + 0.498297;0.578228;, + 0.568281;0.622703;, + 0.539083;0.567300;, + 0.308688;0.114332;, + 0.362981;0.236334;, + 0.424104;0.373683;, + 0.459027;0.363941;, + 0.597396;0.594098;, + 0.623260;0.568689;, + 0.579870;0.496656;, + 0.539084;0.426012;, + 0.498297;0.415083;, + 0.457511;0.426012;, + 0.568941;0.537442;, + 0.387943;0.091771;, + 0.446172;0.073256;, + 0.498343;0.352975;, + 0.533280;0.362668;, + 0.572611;0.373581;, + 0.642446;0.494041;, + 0.633420;0.529157;, + 0.568941;0.455869;, + 0.473762;0.072346;, + 0.534864;0.072197;, + 0.628014;0.095181;, + 0.636952;0.256925;, + 0.697176;0.119146;, + 0.709384;0.125599;, + 0.791953;0.509782;, + 0.904669;0.603680;, + 0.891589;0.663366;, + 0.878582;0.687715;, + 0.848160;0.740706;, + 0.924758;0.523764;, + 0.498343;0.352975;, + 0.562359;0.074656;, + 0.432471;0.074972;, + 0.572611;0.373581;, + 0.709384;0.125599;, + 0.308688;0.114332;, + 0.424104;0.373683;, + 0.416618;0.614996;, + 0.371852;0.564950;, + 0.138464;0.726270;, + 0.093027;0.630541;, + 0.071537;0.500034;, + 0.354693;0.500034;, + 0.268884;0.856707;, + 0.623260;0.568689;, + 0.832283;0.763288;, + 0.896953;0.650643;, + 0.568281;0.622703;, + 0.714652;0.865143;, + 0.924758;0.523764;, + 0.642446;0.494041;, + 0.579870;0.496656;, + 0.568941;0.455869;, + 0.498297;0.496656;, + 0.539084;0.426012;, + 0.498297;0.415083;, + 0.457511;0.426012;, + 0.427654;0.455869;, + 0.416725;0.496656;, + 0.427653;0.537442;, + 0.457511;0.567299;, + 0.498297;0.578228;, + 0.539083;0.567300;, + 0.568941;0.537442;, + 0.163232;0.126306;, + 0.985206;0.375649;, + 0.901675;0.199037;, + 0.797771;0.095133;, + 0.621159;0.011602;, + 0.426023;0.002015;, + 0.285410;0.044670;, + 0.036891;0.305697;, + 0.004196;0.423843;, + 0.004196;0.570785;, + 0.046850;0.711399;, + 0.145433;0.851375;, + 0.307878;0.959917;, + 0.474925;0.997429;, + 0.644845;0.976471;, + 0.835756;0.868322;, + 0.962097;0.688931;, + 0.999609;0.521883;; + } +} diff --git a/sdk/samples/rockem/block1.wav b/sdk/samples/rockem/block1.wav new file mode 100644 index 0000000..40e874b Binary files /dev/null and b/sdk/samples/rockem/block1.wav differ diff --git a/sdk/samples/rockem/block2.wav b/sdk/samples/rockem/block2.wav new file mode 100644 index 0000000..cbb0452 Binary files /dev/null and b/sdk/samples/rockem/block2.wav differ diff --git a/sdk/samples/rockem/block3.wav b/sdk/samples/rockem/block3.wav new file mode 100644 index 0000000..a61bcc1 Binary files /dev/null and b/sdk/samples/rockem/block3.wav differ diff --git a/sdk/samples/rockem/cboo.wav b/sdk/samples/rockem/cboo.wav new file mode 100644 index 0000000..d358e7a Binary files /dev/null and b/sdk/samples/rockem/cboo.wav differ diff --git a/sdk/samples/rockem/cloop.wav b/sdk/samples/rockem/cloop.wav new file mode 100644 index 0000000..4bf936c Binary files /dev/null and b/sdk/samples/rockem/cloop.wav differ diff --git a/sdk/samples/rockem/control.cpp b/sdk/samples/rockem/control.cpp new file mode 100644 index 0000000..562c06b --- /dev/null +++ b/sdk/samples/rockem/control.cpp @@ -0,0 +1,1215 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: control.cpp + * + ***************************************************************************/ + +// Includes.... +#include "rm.h" +#include "control.h" +#include "directx.h" + +// Defines.... +#define MOVE_NORMAL D3DVAL(10) +#define MOVE_FAST D3DVAL(20) + +#define MIN_DIST_TO_OPPONENT D3DVAL(100) + +#define PLAYER_MOVE_FORWARD VK_UP +#define PLAYER_MOVE_BACKWARD VK_DOWN +#define PLAYER_BLOCK VK_CONTROL +#define PLAYER_ATTACK VK_SPACE + +#define CAM_BOTH_IN_VIEW VK_F1 +#define CAM_OVER_THE_SHOULDER VK_F2 +#define CAM_PILOT VK_F3 + +#define NUM_BOB_FRAMES D3DVAL(30) +#define NUM_DEAD_FRAMES D3DVAL(66) +#define NUM_PUNCH_FRAMES D3DVAL(29) +#define NUM_BEEN_HIT_FRAMES D3DVAL(14) +#define NUM_BLOCKING_FRAMES D3DVAL(16) +#define NUM_VICTORY_FRAMES D3DVAL(55) + +#define BOB_START D3DVAL(1) +#define DEAD_START D3DVAL(94) +#define DEAD_HIT_GROUND D3DVAL(115) +#define PUNCH_START D3DVAL(31) +#define PUNCH_ARM_COCKED D3DVAL(50) +#define BLOCK_START D3DVAL(77) +#define BEEN_HIT_START D3DVAL(62) +#define HEAD_RETURNING D3DVAL(68) +#define VICTORY_START D3DVAL(161) + +#define EDGE_LEFT D3DVAL(-600) +#define EDGE_RIGHT D3DVAL(600) + +// Globals.... + +// States +AppState g_appState = DOING_INTRO; +PlayerState g_oppState = CAUTIOUS; +CameraState g_camState = BOTH_IN_VIEW; + +PlayerActionState g_player1State = BOBBING; +PlayerActionState g_player2State = BOBBING; + +AnimArgs g_player1AnimArgs; +AnimArgs g_player2AnimArgs; + +BOOL g_bPlayer1Attacking = FALSE; +BOOL g_bPlayer1Blocking = FALSE; + +DWORD g_player1health = 100; +DWORD g_player2health = 100; + +// Timed lengths for each animation in milliseconds +#define BOB_TIME_MS D3DVAL(500) +#define PUNCH_TIME_MS D3DVAL(600) +#define BLOCK_TIME_MS D3DVAL(500) +#define HIT_TIME_MS D3DVAL(500) +#define DEAD_TIME_MS D3DVAL(4000) +#define VICTORY_TIME_MS D3DVAL(3000) + +// Timing deltas, used for scaling animation to frame rate +D3DVALUE g_bobDelta = NUM_BOB_FRAMES / BOB_TIME_MS; +D3DVALUE g_attackDelta = NUM_PUNCH_FRAMES / PUNCH_TIME_MS; +D3DVALUE g_blockDelta = NUM_BLOCKING_FRAMES / BLOCK_TIME_MS; +D3DVALUE g_hitDelta = NUM_BEEN_HIT_FRAMES / HIT_TIME_MS; +D3DVALUE g_deadDelta = NUM_DEAD_FRAMES / DEAD_TIME_MS; +D3DVALUE g_victoryDelta = NUM_DEAD_FRAMES / DEAD_TIME_MS; + +// Externals.... +extern LPDIRECT3DRM g_lpD3DRM; +extern LPDIRECT3DRMFRAME g_lpScene; +extern LPDIRECT3DRMFRAME g_lpCamera; +extern LPDIRECT3DRMFRAME g_lpPlayer1; +extern LPDIRECT3DRMFRAME g_lpPlayer1HeadFrame; +extern LPDIRECT3DRMFRAME g_lpPlayer2; +extern LPDIRECT3DRMFRAME g_lpPlayer2HeadFrame; +extern LPDIRECT3DRMFRAME g_lpTmp; +extern LPDIRECT3DRMANIMATION g_lpAnim; +extern LPDIRECT3DRMMESHBUILDER g_lpRedDebris; +extern LPDIRECT3DRMMESHBUILDER g_lpBlueDebris; +extern Debris g_debris[NUM_DEBRIS]; +extern LPDIRECTSOUND3DLISTENER g_lpDs3dListener; // Defined in DIRECTX.CPP + + +//---------------------------------------------------------------------- +// +// Function : IsKeyDown() +// +// Purpose : Returns TRUE if specified key is being pressed +// +//---------------------------------------------------------------------- + +BOOL IsKeyDown(int virtKeyCode) +{ + if (GetAsyncKeyState(virtKeyCode) & 0x8000) return TRUE; + + return FALSE; +} + +//---------------------------------------------------------------------- +// +// Function : Player1AnimationCallback() +// +// Purpose : Animation call back for player 1 +// +//---------------------------------------------------------------------- + +void CDECL Player1AnimationCallback(LPDIRECT3DRMFRAME obj, void* arg, D3DVALUE delta) +{ + D3DVALUE time = g_player1AnimArgs.time; + D3DVECTOR player1pos; + D3DVECTOR player2pos; + + // Booleans to help with sound playing + static BOOL bHitGround = FALSE; + static BOOL bPlayedWhoosh = FALSE; + + // Get the players positions + g_lpPlayer1->GetPosition(g_lpScene, &player1pos); + g_lpPlayer2->GetPosition(g_lpScene, &player2pos); + + // Compute distance between players + D3DVALUE curDist = player2pos.z - player1pos.z; + + // Do something based upon the state of player 1 + switch (g_player1State) + { + case BOBBING : + { + // Forward the bobbing animation time + g_player1AnimArgs.lpAnimSet->SetTime(time); + time += (g_bobDelta * delta); + + // Reset if animation has ended + if (time > BOB_START + NUM_BOB_FRAMES) time = BOB_START; + + // Record the new time + g_player1AnimArgs.time = time; + } + break; + + case PUNCHING : + { + // Forward the punching animation time + g_player1AnimArgs.lpAnimSet->SetTime(time); + time += (g_attackDelta * delta); + + // Play a whoosh sound if player 1's arm has gone back and is about to punch + if ((time > PUNCH_ARM_COCKED) && (!bPlayedWhoosh)) + { + // Play the whoosh + PlaySoundDS(rand() % 2 == 0 ? WHOOSH1 : WHOOSH2,player1pos); + bPlayedWhoosh = TRUE; + } + + // If the punch has played, see if we hit the opponent + if (time > PUNCH_START + NUM_PUNCH_FRAMES) + { + // Reset player 1's state to BOBBING + time = BOB_START; + g_player1State = BOBBING; + bPlayedWhoosh = FALSE; + + // Play a servo sound + PlaySoundDS(SERVO_DOWN_1,player1pos); + + // Now, decide whether we have hit the other player + if (curDist < MIN_DIST_TO_OPPONENT + D3DVAL(20)) + { + // The opponent may be blocking + if ((g_player2State == BLOCKING) && + (g_player2AnimArgs.time > BLOCK_START + (NUM_BLOCKING_FRAMES / D3DVAL(2)))) + { + // The opponent blocked the punch, so play the block sound + PlaySoundDS(BLOCK1 + (rand() % 3),player2pos); + break; + } + + // We're within the striking distance + if (g_player2health == 0) return; + + // Add some debris into the scene to register a hit and play a sound + D3DVECTOR debrisOrg = player1pos; + D3DVECTOR debrisVel = { D3DVAL(0), D3DVAL(0), D3DVAL(-10) }; + + debrisOrg.x += D3DVAL(40); + debrisOrg.y += D3DVAL(40); + debrisOrg.z += D3DVAL(90); + + // Add some debris + AddDebris(debrisOrg, debrisVel, g_lpRedDebris); + + // Decrease the opponents health + if (g_player2health > 0) g_player2health -= 10; + + if (g_player2health == 0) + { + // The opponent has died! + g_player2State = DEAD; + g_player2AnimArgs.time = DEAD_START; + g_player2AnimArgs.lpAnimSet->SetTime(DEAD_START); + PlaySoundDS(HEAD_SPRING,player2pos); + + // And the player has victory! + g_player1State = VICTORY; + g_player1AnimArgs.time = VICTORY_START; + g_player1AnimArgs.lpAnimSet->SetTime(VICTORY_START); + + PlaySoundDS(VICTORY_YEAH,player1pos); + + return; + } + + // Play a punch sound + PlaySoundDS(rand() % 2 == 0 ? PLAYER1_PUNCH1 : PLAYER1_PUNCH2,player2pos); + + // Recalculate the power bars + RecalcPowerBars(g_player1health, g_player2health); + + // Make sure we force the camera to the correct place + PositionCamera(); + + // Setup the opponents animation and state + g_player2State = BEEN_HIT; + g_player2AnimArgs.time = BEEN_HIT_START; + g_player2AnimArgs.lpAnimSet->SetTime(BEEN_HIT_START); + + // What should the opponent do? + if (rand() % 10 < 2) + { + // Make the opponent defensive + g_oppState = DEFENSIVE; + } + + // Play the ouch sound + PlaySoundDS(PLAYER2_OUCH,player1pos); + } + } + + // Record the new animation time + g_player1AnimArgs.time = time; + } + break; + + case BLOCKING : + { + // Forward the blocking animation time + g_player1AnimArgs.lpAnimSet->SetTime(time); + + // Hold the block up if CTRL is held down + if (GetAsyncKeyState(PLAYER_BLOCK) & 0x8000) + { + if (time < BLOCK_START + (NUM_BLOCKING_FRAMES / 2)) time += (g_blockDelta * delta); + } + else + { + time += (g_blockDelta * delta); + } + + // Reset player 1's state to BOBBING if the animation has ended + if (time > BLOCK_START + NUM_BLOCKING_FRAMES) + { + time = BOB_START; + g_player1State = BOBBING; + } + + // Record the new animation time + g_player1AnimArgs.time = time; + } + break; + + case BEEN_HIT : + { + // Forward the been hit animation time + g_player1AnimArgs.lpAnimSet->SetTime(time); + time += (g_hitDelta * delta); + + if (player1pos.z > EDGE_LEFT) g_lpPlayer1->SetPosition(g_lpScene, player1pos.x, player1pos.y, player1pos.z - D3DVAL(5)); + PositionCamera(); + + // Reset player 1's state to BOBBING if the animation has ended + if (time > BEEN_HIT_START + NUM_BEEN_HIT_FRAMES) + { + time = BOB_START; + g_player1State = BOBBING; + } + + // Record the new animation time + g_player1AnimArgs.time = time; + } + break; + + case DEAD : + { + // Forward the death animation time + g_player1AnimArgs.lpAnimSet->SetTime(time); + time += (g_deadDelta * delta); + + // Play a crash sound if the animation has passes the DEAD_HIT_GROUND frame + if ((time > DEAD_HIT_GROUND) && (!bHitGround)) + { + bHitGround = TRUE; + PlaySoundDS(BLOCK3,player1pos); + } + + // Reset player 1's state to BOBBING if the animation has ended + if (time > DEAD_START + NUM_DEAD_FRAMES) + { + time = BOB_START; + g_player1State = BOBBING; + g_player1health = 100; + bHitGround = FALSE; + + RecalcPowerBars(g_player1health, g_player2health); + } + + // Record the new animation time + g_player1AnimArgs.time = time; + + // Position the camera correctly + PositionCamera(); + } + break; + + case VICTORY : + { + // Forward the victory animation time + g_player1AnimArgs.lpAnimSet->SetTime(time); + time += (g_victoryDelta * delta); + + if (time > VICTORY_START + NUM_VICTORY_FRAMES) + { + time = BOB_START; + g_player1State = BOBBING; + } + g_player1AnimArgs.time = time; + + PositionCamera(); + } + break; + } +} + +//---------------------------------------------------------------------- +// +// Function : Player2AnimationCallback() +// +// Purpose : Animation call back for player 2 +// +//---------------------------------------------------------------------- + +void CDECL Player2AnimationCallback(LPDIRECT3DRMFRAME obj, void* arg, D3DVALUE delta) +{ + D3DVALUE time = g_player2AnimArgs.time; + D3DVECTOR player1pos; + D3DVECTOR player2pos; + + // Booleans to help with sound playing + static BOOL bHitGround = FALSE; + static BOOL bPlayedWhoosh = FALSE; + + // Get the players positions + g_lpPlayer1->GetPosition(g_lpScene, &player1pos); + g_lpPlayer2->GetPosition(g_lpScene, &player2pos); + + // Compute distance between players + D3DVALUE curDist = player2pos.z - player1pos.z; + + // Do something based upon the state of player 1 + switch (g_player2State) + { + case BOBBING : + { + // Forward the bobbing animation time + g_player2AnimArgs.lpAnimSet->SetTime(time); + time += (g_bobDelta * delta); + + // Reset if animation has ended + if (time > BOB_START + NUM_BOB_FRAMES) time = BOB_START; + + // Record the new time + g_player2AnimArgs.time = time; + } + break; + + case PUNCHING : + { + // Forward the punching animation time + g_player2AnimArgs.lpAnimSet->SetTime(time); + time += (g_attackDelta * delta); + + // Play a whoosh sound if player 2's arm has gone back and is about to punch + if ((time > PUNCH_ARM_COCKED) && (!bPlayedWhoosh)) + { + // Play the whoosh + PlaySoundDS(rand() % 2 == 0 ? WHOOSH1 : WHOOSH2,player2pos); + bPlayedWhoosh = TRUE; + } + + // If the punch has played, see if we hit the opponent + if (time > PUNCH_START + NUM_PUNCH_FRAMES) + { + time = BOB_START; + g_player2State = BOBBING; + bPlayedWhoosh = FALSE; + + // Play a servo sound + PlaySoundDS(SERVO_DOWN_2,player2pos); + + // Now, decide whether we have hit the other player + if (curDist < MIN_DIST_TO_OPPONENT + D3DVAL(20)) + { + // The opponent may be blocking + if ((g_player1State == BLOCKING) && + (g_player1AnimArgs.time > BLOCK_START + (NUM_BLOCKING_FRAMES / D3DVAL(2)))) + { + // The opponent blocked the punch, so play the block sound + PlaySoundDS(BLOCK1 + (rand() % 3),player1pos); + break; + } + + // We're within the striking distance + if (g_player1health <= 0) return; + + // We're within the striking distance + // Add some debris into the scene to register a hit and play a sound + D3DVECTOR debrisOrg = player1pos; + D3DVECTOR debrisVel = { D3DVAL(0), D3DVAL(0), D3DVAL(10) }; + + debrisOrg.x += D3DVAL(-40); + debrisOrg.y += D3DVAL(40); + debrisOrg.z += D3DVAL(-10); + + // Add some debris + AddDebris(debrisOrg, debrisVel, g_lpBlueDebris); + + // Play a punch sound + PlaySoundDS(rand() % 2 == 0 ? PLAYER2_PUNCH1 : PLAYER2_PUNCH2,player1pos); + + // Decrease the opponents health + if (g_player1health > 0) g_player1health -= 10; + + if (g_player1health == 0) + { + // The player has died! + g_player1State = DEAD; + g_player1AnimArgs.time = DEAD_START; + g_player1AnimArgs.lpAnimSet->SetTime(DEAD_START); + PlaySoundDS(HEAD_SPRING,player1pos); + + // And the opponent has victory! + g_player2State = VICTORY; + g_player2AnimArgs.time = VICTORY_START; + g_player2AnimArgs.lpAnimSet->SetTime(VICTORY_START); + + // The crowd is not happy.... + PlaySoundDS(VICTORY_BOO,player2pos); + + return; + } + + // Recalculate the power bars + RecalcPowerBars(g_player1health, g_player2health); + + // Force a camera positional update + PositionCamera(); + + if (g_player1State != BEEN_HIT) + { + // Change player 1's state to BEEN_HIT, + g_player1State = BEEN_HIT; + + // And set the animation time + g_player1AnimArgs.time = BEEN_HIT_START; + g_player1AnimArgs.lpAnimSet->SetTime(BEEN_HIT_START); + } + + // Play the ouch sound + PlaySoundDS(PLAYER1_OUCH,player1pos); + } + } + + // Record the new animation time + g_player2AnimArgs.time = time; + } + break; + + case BEEN_HIT : + { + // Forward the been hit animation time + g_player2AnimArgs.lpAnimSet->SetTime(time); + time += (g_hitDelta * delta); + + // Move the player + if (player2pos.z < EDGE_RIGHT) g_lpPlayer2->SetPosition(g_lpScene, player2pos.x, player2pos.y, player2pos.z + D3DVAL(5)); + + // Force a camera position update + PositionCamera(); + + // Reset to BOBBING if animation has ended + if (time > BEEN_HIT_START + NUM_BEEN_HIT_FRAMES) + { + time = BOB_START; + g_player2State = BOBBING; + } + + // Record the new animation time + g_player2AnimArgs.time = time; + } + break; + + case BLOCKING : + { + // Forward the blocking animation time + g_player2AnimArgs.lpAnimSet->SetTime(time); + time += (g_blockDelta * delta); + + // Reset to BOBBING if animation has ended + if (time > BLOCK_START + NUM_BLOCKING_FRAMES) + { + time = BOB_START; + g_player2State = BOBBING; + g_oppState = AGGRESSIVE; + } + + // Record the new animation time + g_player2AnimArgs.time = time; + } + break; + + case DEAD : + { + // Forward the death animation time + g_player2AnimArgs.lpAnimSet->SetTime(time); + time += (g_deadDelta * delta); + + // Play the BLOCK3 sound when the opponent hits the ground + if ((time > DEAD_HIT_GROUND) && (!bHitGround)) + { + bHitGround = TRUE; + PlaySoundDS(BLOCK3,player2pos); + } + + // Reset to BOBBING if the animation has ended + if (time > DEAD_START + NUM_DEAD_FRAMES) + { + time = BOB_START; + g_player2State = BOBBING; + g_player2health = 100; + bHitGround = FALSE; + + // Recalculate the power bars + RecalcPowerBars(g_player1health, g_player2health); + } + // Record the new animation time + g_player2AnimArgs.time = time; + + // Force a camera position update + PositionCamera(); + } + break; + + case VICTORY : + { + // Forward the victory animation time + g_player2AnimArgs.lpAnimSet->SetTime(time); + time += (g_victoryDelta * delta); + + if (time > VICTORY_START + NUM_VICTORY_FRAMES) + { + time = BOB_START; + g_player2State = BOBBING; + } + + // Record the new animation time + g_player2AnimArgs.time = time; + + // Force a camera position update + PositionCamera(); + } + break; + } +} + +//---------------------------------------------------------------------- +// +// Function : CheckInputAndUpdate() +// +// Purpose : Checks input, updates scene, moves player(s) +// +//---------------------------------------------------------------------- + +void CheckInputAndUpdate() +{ + D3DVECTOR player1pos; + D3DVECTOR player2pos; + D3DVECTOR camPos; + + // Run intro + if (g_appState == DOING_INTRO) + { + RunIntro(); + return; + } + + // Transition camera + if (g_appState == BETWEEN_CAM_VIEWS) + { + TransitionCamera(); + return; + } + + // Get the players positions + g_lpPlayer1->GetPosition(g_lpScene, &player1pos); + g_lpPlayer2->GetPosition(g_lpScene, &player2pos); + + // Get the camera's position + g_lpCamera->GetPosition(g_lpScene, &camPos); + + // Calculate distance between players + D3DVALUE curDist = player2pos.z - player1pos.z; + + // Move player forward + if ((IsKeyDown(PLAYER_MOVE_FORWARD)) && (g_player1State != VICTORY) && (g_player1State != DEAD)) + { + // Make sure the player can only move so close to the opponent + if (curDist > MIN_DIST_TO_OPPONENT) + { + // Move the player + g_lpPlayer1->SetPosition(g_lpScene, player1pos.x, player1pos.y, player1pos.z + MOVE_NORMAL); + + // Force a camera position update + PositionCamera(); + + // Play a servo sound + PlaySoundDS(SERVO_UP_3,player1pos); + + // Play a walk sound + PlaySoundDS(PLAYER1_WALK,player1pos); + } + } + + // Move player backward + if ((IsKeyDown(PLAYER_MOVE_BACKWARD)) && (g_player1State != VICTORY) && (g_player1State != DEAD)) + { + // Make sure the player can't run off the arena + if (player1pos.z > EDGE_LEFT) + { + // Move the player + g_lpPlayer1->SetPosition(g_lpScene, player1pos.x, player1pos.y, player1pos.z - MOVE_NORMAL); + + // Force a camera position update + PositionCamera(); + + // Play a servo sound + PlaySoundDS(SERVO_UP_3,player1pos); + + // Play a walk sound + PlaySoundDS(PLAYER1_WALK,player1pos); + } + } + + // Initiate a player attack + if ((!g_bPlayer1Attacking) && (!g_bPlayer1Blocking) && (IsKeyDown(PLAYER_ATTACK))) + { + if ((g_player1State != PUNCHING) && (g_player1State != DEAD) && (g_player1State != VICTORY)) + { + // Set the player state to punching + g_player1State = PUNCHING; + + // Set up the correct time for the animation + g_player1AnimArgs.time = D3DVAL(PUNCH_START); + g_player1AnimArgs.lpAnimSet->SetTime(D3DVAL(PUNCH_START)); + + g_bPlayer1Attacking = TRUE; + + // Play a servo sound + PlaySoundDS(SERVO_UP_1,player1pos); + } + } + + // Reset the attacking flag if the PLAYER_ATTACK key is not pressed anymore + if ((g_bPlayer1Attacking) && (!IsKeyDown(PLAYER_ATTACK))) + { + g_bPlayer1Attacking = FALSE; + } + + // Initiate a player block + if ((!g_bPlayer1Blocking) && (!g_bPlayer1Attacking) && (IsKeyDown(PLAYER_BLOCK))) + { + if ((g_player1State != BLOCKING) && (g_player1State != DEAD) && (g_player1State != VICTORY)) + { + // Set the player state to blocking + g_player1State = BLOCKING; + + // Set up the correct time for the animation + g_player1AnimArgs.time = D3DVAL(BLOCK_START); + g_player1AnimArgs.lpAnimSet->SetTime(D3DVAL(BLOCK_START)); + + // Don't allow any more blocking + g_bPlayer1Blocking = TRUE; + + // Play a servo sound + PlaySoundDS(SERVO_UP_1,player1pos); + } + } + + // Reset the blocking flag if the PLAYER_BLOCK key is no longer held down + if ((g_bPlayer1Blocking) && (!IsKeyDown(PLAYER_BLOCK))) + { + g_bPlayer1Blocking = FALSE; + } + + // Transition to the BOTH_IN_VIEW camera view + if ((IsKeyDown(CAM_BOTH_IN_VIEW)) && (g_camState != BOTH_IN_VIEW)) + { + // Create transition animation + if (!FAILED(g_lpD3DRM->CreateAnimation(&g_lpAnim))) + { + // Setup the animation options + g_lpAnim->SetOptions(D3DRMANIMATION_OPEN | + D3DRMANIMATION_LINEARPOSITION | + D3DRMANIMATION_POSITION); + + // Make midway vector between both players, this is what the camera will focus on + D3DVECTOR vMidPoint; + vMidPoint.x = 0.0f; + vMidPoint.y = 0.0f; + vMidPoint.z = (player1pos.z + player2pos.z) / D3DVAL(2); + + // Calculate vector that will keep both players in sight + D3DVECTOR vNewCam; + vNewCam.x = (float)abs((int)player2pos.z - (int)player1pos.z) + D3DVAL(300); + vNewCam.y = camPos.y; + vNewCam.z = vMidPoint.z; + + // Add the keyframes to the animation + g_lpAnim->AddPositionKey(D3DVAL(0), camPos.x, camPos.y, camPos.z); + g_lpAnim->AddPositionKey(D3DVAL(1), vNewCam.x, vNewCam.y, vNewCam.z); + + // Setup the initial position + g_lpTmp->SetPosition(g_lpScene, vMidPoint.x, vMidPoint.y, vMidPoint.z); + + // And attach the camera to the animation + g_lpAnim->SetFrame(g_lpCamera); + + g_appState = BETWEEN_CAM_VIEWS; + } + else + { + // Create animation failed so just set the camera position + g_lpCamera->SetPosition(g_lpScene, D3DVAL(200), D3DVAL(100), player1pos.z + MOVE_NORMAL - D3DVAL(400)); + g_lpCamera->LookAt(g_lpPlayer2, g_lpScene, D3DRMCONSTRAIN_Z); + PositionCamera(); + } + + g_camState = BOTH_IN_VIEW; + } + + // Transition to the OVER_SHOULDER camera view + if ((IsKeyDown(CAM_OVER_THE_SHOULDER)) && (g_camState != OVER_SHOULDER)) + { + if (!FAILED(g_lpD3DRM->CreateAnimation(&g_lpAnim))) + { + // Setup the animation options + g_lpAnim->SetOptions(D3DRMANIMATION_OPEN | + D3DRMANIMATION_LINEARPOSITION | + D3DRMANIMATION_POSITION); + + // Add the keyframes to the animation + g_lpAnim->AddPositionKey(D3DVAL(0), camPos.x, camPos.y, camPos.z); + g_lpAnim->AddPositionKey(D3DVAL(1), D3DVAL(200), D3DVAL(100), player1pos.z - D3DVAL(300)); + + // Setup the initial position + g_lpTmp->SetPosition(g_lpScene, player2pos.x, player2pos.y, player2pos.z); + + // And attach the camera to the animation + g_lpAnim->SetFrame(g_lpCamera); + + g_appState = BETWEEN_CAM_VIEWS; + } + else + { + // Create animation failed so just set the camera position + PositionCamera(); + } + + g_camState = OVER_SHOULDER; + } + + // Transition to the PILOT_VIEW camera view + if ((IsKeyDown(CAM_PILOT)) && (g_camState != PILOT_VIEW)) + { + PositionCamera(); + g_camState = PILOT_VIEW; + } + + // Update the opponent + UpdateOpponent(); + + // Update any debris in the world + UpdateDebris(); +} + +//---------------------------------------------------------------------- +// +// Function : UpdateOpponent() +// +// Purpose : Updates opponent +// +//---------------------------------------------------------------------- + +void UpdateOpponent() +{ + D3DVECTOR player1pos; + D3DVECTOR player2pos; + + if (g_player2State != BOBBING) return; + + // Random value to determine what the opponent should do based upon its state + int r = rand() % 100; + + // Get the players positions + g_lpPlayer1->GetPosition(g_lpScene, &player1pos); + g_lpPlayer2->GetPosition(g_lpScene, &player2pos); + + // Calculate distance betweens players + D3DVALUE curDist = player2pos.z - player1pos.z; + + // There is always a chance to block the player + if ((r < 15) && (g_player1State == PUNCHING) && (g_player2State == BOBBING)) + { + // Set the opponents state to BLOCKING ans start the animation + g_player2State = BLOCKING; + g_player2AnimArgs.time = BLOCK_START; + g_player2AnimArgs.lpAnimSet->SetTime(BLOCK_START); + + // Play a servo sound + PlaySoundDS(SERVO_UP_2,player2pos); + return; + } + + switch (g_oppState) + { + case DEFENSIVE: + { + // Decide whether to move opponent backwards + if (r < 25) + { + // Move the opponent backwards + g_lpPlayer2->SetPosition(g_lpScene, player2pos.x, player2pos.y, player2pos.z + MOVE_NORMAL); + + // Play a walk sound + PlaySoundDS(PLAYER2_WALK,player2pos); + + // Play a servo sound + PlaySoundDS(SERVO_DOWN_3,player2pos); + } + PositionCamera(); + + // Decide whether to go from DEFENSIVE to cautious + if (r < 10) g_oppState = CAUTIOUS; + } + break; + + case CAUTIOUS: + { + // Decide whether to go from CAUTIOUS to AGGRESSIVE + if (r < 5) + { + // Make the opponent become aggresive + g_oppState = AGGRESSIVE; + } + } + break; + + case AGGRESSIVE: + { + // Decide whether to move the opponent towards the player + if (r < 50) + { + // Move the opponent towards the player + if (curDist > MIN_DIST_TO_OPPONENT) + { + g_lpPlayer2->SetPosition(g_lpScene, player2pos.x, player2pos.y, player2pos.z - MOVE_NORMAL); + PositionCamera(); + + // Play a walk sound + PlaySoundDS(PLAYER2_WALK,player2pos); + + // Play a servo sound + PlaySoundDS(SERVO_DOWN_3,player2pos); + } + } + + // Decide whether or not to attack the player + if ((r < 15) && (g_player2State == BOBBING) && + (g_player1State != DEAD) && (curDist < MIN_DIST_TO_OPPONENT + D3DVAL(50))) + { + // Set the opponent's state to PUNCHING + g_player2State = PUNCHING; + g_player2AnimArgs.time = PUNCH_START; + g_player2AnimArgs.lpAnimSet->SetTime(PUNCH_START); + + // Play a servo sound + PlaySoundDS(SERVO_UP_2,player2pos); + } + + // Decide whether or not to move the opponent backwards out of the way if the player + // is punching + if ((g_player1State == PUNCHING) && (r > 50) && (g_player2State == BOBBING) && (curDist < MIN_DIST_TO_OPPONENT + 50)) + { + // Move the opponent out of the way, making sure its still in the arena + if (player2pos.z < EDGE_RIGHT) + { + g_lpPlayer2->SetPosition(g_lpScene, player2pos.x, player2pos.y, player2pos.z + D3DVAL(5)); + + // Play a servo sound + PlaySoundDS(SERVO_DOWN_3,player1pos); + } + } + } + break; + } +} + +//---------------------------------------------------------------------- +// +// Function : RunIntro() +// +// Purpose : Moves camera along path +// +//---------------------------------------------------------------------- + +void RunIntro() +{ + static D3DVALUE time = D3DVAL(0.0f); + D3DVECTOR d3dvPos; // D3DVECTOR used for 3D position of sound + d3dvPos.x = D3DVAL(0); // set the sound at (0,0,0).. + d3dvPos.y = D3DVAL(0); + d3dvPos.z = D3DVAL(0); + + // Play the intro sound + if (time == D3DVAL(0.0f)) + { + PlaySoundDS(INTRO,d3dvPos); + PlaySoundDS(CROWD_LOOP,d3dvPos, DSBPLAY_LOOPING); + SetTimer(NULL,NULL,10000,PlayRandomWave); + } + + // Foward the intro animation + time += D3DVAL(0.04); + + // Set the animation time + g_lpAnim->SetTime(time); + + // Always look at the origin of the g_lpScene frame + g_lpCamera->LookAt(g_lpTmp, g_lpScene, D3DRMCONSTRAIN_Z); + + // If time has exceeded 1.0 the intro is done, and we can start the demo + if (time >= D3DVAL(1.0f)) + { + g_appState = PLAYING_DEMO; + g_lpAnim->Release(); + g_lpAnim = NULL; + PositionCamera(); + } +} + +//---------------------------------------------------------------------- +// +// Function : PostionCamera() +// +// Purpose : Positions camera based upon camera state +// +//---------------------------------------------------------------------- + +void PositionCamera() +{ + D3DVECTOR player1pos; + D3DVECTOR player2pos; + D3DVECTOR camPos; + + // Don't position the camera if we are transitioning between camera views + if (g_appState == BETWEEN_CAM_VIEWS) return; + + // Get the players positions + g_lpPlayer1->GetPosition(g_lpScene, &player1pos); + g_lpPlayer2->GetPosition(g_lpScene, &player2pos); + + // Get the camera's position + g_lpCamera->GetPosition(g_lpScene, &camPos); + + switch (g_camState) + { + case OVER_SHOULDER: + { + // Position the camera such that it looks over the shoulder of the player and + // keeps the opponent in view + g_lpCamera->SetPosition(g_lpScene, camPos.x, camPos.y, D3DVAL(player1pos.z) + MOVE_NORMAL - 300); + g_lpCamera->LookAt(g_lpPlayer2, g_lpScene, D3DRMCONSTRAIN_Z); + if (g_lpDs3dListener) + { + // Set the listener position to where the camera is + g_lpDs3dListener->SetPosition(camPos.x, camPos.y, D3DVAL(player1pos.z) + MOVE_NORMAL - 300,DS3D_DEFERRED); + // Change listener's orientation vector + g_lpDs3dListener->SetOrientation(D3DVAL(0),D3DVAL(0),D3DVAL(1),D3DVAL(0),D3DVAL(1),D3DVAL(0),DS3D_DEFERRED); + } + } + break; + + case BOTH_IN_VIEW: + { + // Position the camera such that it looks at both players all the time + + // Make midway point, this is what the camera will focus on + D3DVECTOR vMidPoint; + vMidPoint.x = 0.0f; + vMidPoint.y = 0.0f; + vMidPoint.z = (player1pos.z + player2pos.z) / D3DVAL(2); + + // Calculate vector that will keep both players in sight + D3DVECTOR vNewCam; + vNewCam.x = (float)abs((int)player2pos.z - (int)player1pos.z) + D3DVAL(300); + vNewCam.y = camPos.y; + vNewCam.z = vMidPoint.z; + + g_lpCamera->SetPosition(g_lpScene, vNewCam.x, vNewCam.y, vNewCam.z); + + g_lpTmp->SetPosition(g_lpScene, vMidPoint.x, vMidPoint.y, vMidPoint.z); + g_lpCamera->LookAt(g_lpTmp, g_lpScene, D3DRMCONSTRAIN_Z); + if (g_lpDs3dListener) + { + // Set the listener position to where the camera is + g_lpDs3dListener->SetPosition(vNewCam.x, vNewCam.y, vNewCam.z,DS3D_DEFERRED); + // Change listener's orientation vector + g_lpDs3dListener->SetOrientation(-D3DVAL(1),D3DVAL(0),D3DVAL(0),D3DVAL(0),D3DVAL(1),D3DVAL(0),DS3D_DEFERRED); + } + } + break; + + case PILOT_VIEW: + { + // Position the camera such that it looks through the eyes of the player + // and fixes on the origin of the head frame of the opponent + + g_lpCamera->SetPosition(g_lpPlayer1HeadFrame, D3DVAL(0), D3DVAL(-10), D3DVAL(0)); + g_lpTmp->SetPosition(g_lpPlayer2HeadFrame, D3DVAL(0), D3DVAL(-10), D3DVAL(0)); + g_lpCamera->LookAt(g_lpTmp, g_lpScene, D3DRMCONSTRAIN_Z); + if (g_lpDs3dListener) + { + // Set the listener position to where the camera is + g_lpDs3dListener->SetPosition(player1pos.x, D3DVAL(0), player1pos.z,DS3D_DEFERRED); + // Change listener's orientation vector + g_lpDs3dListener->SetOrientation(D3DVAL(0),D3DVAL(0),D3DVAL(1),D3DVAL(0),D3DVAL(1),D3DVAL(0),DS3D_DEFERRED); + } + } + break; + } + // Commit the changes to the listener's orientation and position.. + if (g_lpDs3dListener) + g_lpDs3dListener->CommitDeferredSettings(); +} + +//---------------------------------------------------------------------- +// +// Function : TransitionCamera() +// +// Purpose : Positions camera based upon camera state +// +//---------------------------------------------------------------------- + +void TransitionCamera() +{ + static D3DVALUE time = D3DVAL(0.0f); + + // Forward the transition animation time + time += D3DVAL(0.04); + + // Set the time for the transitional animation + g_lpAnim->SetTime(time); + + // Look at the g_lpScene frame + g_lpCamera->LookAt(g_lpTmp, g_lpScene, D3DRMCONSTRAIN_Z); + + // If the animation has ended, run the demo + if (time >= D3DVAL(1.0f)) + { + g_appState = PLAYING_DEMO; + g_lpAnim->Release(); + g_lpAnim = NULL; + time = D3DVAL(0); + PositionCamera(); + } + + // Update debris so any debris in the scene doesn't just sit there doing nothing + UpdateDebris(); +} + +//---------------------------------------------------------------------- +// +// Function : AddDebris() +// +// Purpose : Adds some debris to the scene +// +//---------------------------------------------------------------------- + +void AddDebris(D3DVECTOR vOrg, D3DVECTOR vVel, LPDIRECT3DRMMESHBUILDER pDebris) +{ + // vOrg is the origin of the debris, find first open spot and add 5 bits of debris + int count = 0; + + for (int i = 0; i < NUM_DEBRIS; i ++) + { + // Find some debris that is not in use yet + if (!g_debris[i].m_bInUse) + { + // Add some debris + g_debris[i].m_pFrame->AddVisual(pDebris); + g_debris[i].m_pFrame->SetPosition(g_lpScene, vOrg.x, vOrg.y, vOrg.z); + g_debris[i].m_pFrame->SetRotation(g_lpScene, D3DVAL(0.5), D3DVAL(0.5), D3DVAL(0.5), D3DVAL(0.5)); + g_debris[i].m_life = 0; + + // Setup velocity and acceleration + g_debris[i].m_vel.x = D3DVAL(-10 + (rand() % 20)) + vVel.x; + g_debris[i].m_vel.y = D3DVAL(8) + D3DVAL(rand() % 10) + vVel.y; + g_debris[i].m_vel.z = D3DVAL(-10 + (rand() % 20)) + vVel.z; + + g_debris[i].m_acc.x = D3DVAL(0); + g_debris[i].m_acc.y = D3DVAL(-2); + g_debris[i].m_acc.z = D3DVAL(0); + + // This piece of debris is now in use + g_debris[i].m_bInUse = TRUE; + g_debris[i].m_pMeshBuilder = pDebris; + + count ++; + } + + // Return if we've added NUM_HIT_DEBRIS bits of debris + if (count == NUM_HIT_DEBRIS) return; + } +} + +//---------------------------------------------------------------------- +// +// Function : UpdateDebris() +// +// Purpose : Updates debris +// +//---------------------------------------------------------------------- + +void UpdateDebris() +{ + D3DVECTOR vPos; + + // Go through the array of debris and update any debris that is in use + + for (int i = 0; i < NUM_DEBRIS; i ++) + { + if (g_debris[i].m_bInUse) + { + // If the debris's life has not yet expired + if (g_debris[i].m_life < DEBRIS_LIFE) + { + // Move the debris + g_debris[i].m_pFrame->GetPosition(g_lpScene, &vPos); + + g_debris[i].m_vel.x += g_debris[i].m_acc.x; + g_debris[i].m_vel.y += g_debris[i].m_acc.y; + g_debris[i].m_vel.z += g_debris[i].m_acc.z; + + vPos.x += g_debris[i].m_vel.x; + vPos.y += g_debris[i].m_vel.y; + vPos.z += g_debris[i].m_vel.z; + + // Check to see whether the debris is below the floor + if (vPos.y < D3DVAL(-60)) + { + // Bounce the debris + vPos.y = D3DVAL(-60); + g_debris[i].m_vel.y = -g_debris[i].m_vel.y / D3DVAL(1.5); + } + + // Update the position of the debris + g_debris[i].m_pFrame->SetPosition(g_lpScene, vPos.x, vPos.y, vPos.z); + } + else + { + // Remove the debris from the world + g_debris[i].m_pFrame->DeleteVisual(g_debris[i].m_pMeshBuilder); + g_debris[i].m_bInUse = FALSE; + } + + // Age the debris + g_debris[i].m_life ++; + } + } +} + diff --git a/sdk/samples/rockem/control.h b/sdk/samples/rockem/control.h new file mode 100644 index 0000000..0fab8d2 --- /dev/null +++ b/sdk/samples/rockem/control.h @@ -0,0 +1,72 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: control.h + * + ***************************************************************************/ + +#ifndef __CONTROL_H_ +#define __CONTROL_H_ + +// Type to define what app is currently doing +typedef enum +{ + DOING_INTRO, + PLAYING_DEMO, + BETWEEN_CAM_VIEWS, +} +AppState; + +// Type to define what state the opponent is in +typedef enum +{ + DEFENSIVE, + CAUTIOUS, + AGGRESSIVE, +} +PlayerState; + +// Type to define what kind of camera angles were using +typedef enum +{ + OVER_SHOULDER, + BOTH_IN_VIEW, + PILOT_VIEW, +} +CameraState; + +// Type to define what action the player is doing +typedef enum +{ + BOBBING, + WALKING, + PUNCHING, + BLOCKING, + BEEN_HIT, + DEAD, + VICTORY, + DISABLED, +} +PlayerActionState; + +// Structures +struct AnimArgs +{ + LPDIRECT3DRMANIMATIONSET lpAnimSet; + D3DVALUE time; +}; + +void Player1AnimationCallback(LPDIRECT3DRMFRAME obj, void* arg, D3DVALUE delta); +void Player2AnimationCallback(LPDIRECT3DRMFRAME obj, void* arg, D3DVALUE delta); + +void CheckInputAndUpdate(); +void UpdateOpponent(); +void UpdateDebris(); +void RunIntro(); +void PositionCamera(); +void TransitionCamera(); +void AddDebris(D3DVECTOR vOrg, D3DVECTOR vVel, LPDIRECT3DRMMESHBUILDER pDebris); + +#endif + diff --git a/sdk/samples/rockem/cyeah.wav b/sdk/samples/rockem/cyeah.wav new file mode 100644 index 0000000..eb73ff4 Binary files /dev/null and b/sdk/samples/rockem/cyeah.wav differ diff --git a/sdk/samples/rockem/d3dbld.mk b/sdk/samples/rockem/d3dbld.mk new file mode 100644 index 0000000..b7fd310 --- /dev/null +++ b/sdk/samples/rockem/d3dbld.mk @@ -0,0 +1,33 @@ +############################################################################ +# +# Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. +# +# File: d3dbld.mk +# Content: Master makefile for Microsoft Visual C++ 2.0 +# For controlling what gets built (debug, retail, clean) +# +############################################################################ + +goal: debug.mak + +all : debug.mak retail.mak + +debug retail: $@.mak + +!ifndef MAKENAME +MAKENAME = default.mk +!endif + +debug.mak retail.mak: + @if not exist $(@B)\nul md $(@B) + @cd $(@B) + @nmake -nologo -f ..\$(MAKENAME) DEBUG="$(@B)" + @cd .. + @echo *** Done making $(@B) *** + +clean: debug.cln retail.cln + +debug.cln retail.cln: + @if exist $(@B)\nul del $(@B) < yes >nul + @if exist $(@B)\nul rd $(@B) >nul + @echo *** $(@B) is clean *** diff --git a/sdk/samples/rockem/d3dsdk.mk b/sdk/samples/rockem/d3dsdk.mk new file mode 100644 index 0000000..d20ed6b --- /dev/null +++ b/sdk/samples/rockem/d3dsdk.mk @@ -0,0 +1,115 @@ +############################################################################ +# +# Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. +# +# File: d3dsdk.mk +# Content: Rules for building the components of the SDK. +# For use with MSVC 2.0 or higher +# +############################################################################ + +!if "$(GSDKROOT)" == "" +GSDKROOT=\dxsdk\sdk +!endif + +############################################################################# +# +# Set up include & lib path +# +############################################################################# +INCLUDE=$(GSDKROOT)\inc;..\..\misc;$(INCLUDE) +LIB=$(GSDKROOT)\lib;$(LIB) + +############################################################################# +# +# new suffixes +# +############################################################################# +.SUFFIXES: +.SUFFIXES: .asm .c .cpp .exe .dll .h .inc .lib .sym .rc .res + +############################################################################# +# +# C compiler definitions +# +############################################################################# +CC =cl +CFLAGS = $(CFLAGS) -W1 -WX -c -Zp +CFLAGS =$(CFLAGS) -G5 -DIS_32 -DWIN32 +!ifndef LOGO +CFLAGS =$(CFLAGS) -nologo +!endif + +############################################################################# +# +# Linker definitions +# +############################################################################# +LINK =link -link +LFLAGS =$(LFLAGS) -nodefaultlib -align:0x1000 +!ifndef LOGO +LFLAGS =$(LFLAGS) -nologo +!endif + +############################################################################# +# +# resource compiler definitions +# +############################################################################# +RCFLAGS =$(RCFLAGS) -I.. +RCFLAGS =$(RCFLAGS) -DWIN32 -DIS_32 +RC = rc + +############################################################################# +# +# assembler definitions +# +############################################################################# +ASM = ml +AFLAGS =$(AFLAGS) -DIS_32 -DWIN32 +AFLAGS =$(AFLAGS) -W3 -WX -Zd -c -Cx -DMASM6 + +############################################################################# +# +# librarian definitions +# +############################################################################# +LIBEXE = lib + +############################################################################# +# +# targets +# +############################################################################# + +goal: $(GOALS) + +{..}.c{}.obj: + @$(CC) @<< +$(CFLAGS) -Fo$(@B).obj ..\$(@B).c +<< + +{..\..\misc}.c{}.obj: + @$(CC) @<< +$(CFLAGS) -Fo$(@B).obj ..\..\misc\$(@B).c +<< + +{..}.cpp{}.obj: + @$(CC) @<< +$(CFLAGS) -Fo$(@B).obj ..\$(@B).cpp +<< + +{..\..\misc}.cpp{}.obj: + @$(CC) @<< +$(CFLAGS) -Fo$(@B).obj ..\..\misc\$(@B).cpp +<< + +{..}.asm{}.obj: + $(ASM) $(AFLAGS) -Fo$(@B).obj ..\$(@B).asm + +{..}.rc{}.res: + $(RC) $(RCFLAGS) -r -Fo$(@B).res ..\$(@B).rc + +{..\..\misc}.rc{}.res: + $(RC) $(RCFLAGS) -r -Fo$(@B).res ..\..\misc\$(@B).rc + diff --git a/sdk/samples/rockem/debris_b.x b/sdk/samples/rockem/debris_b.x new file mode 100644 index 0000000..c4a3159 --- /dev/null +++ b/sdk/samples/rockem/debris_b.x @@ -0,0 +1,236 @@ +xof 0302txt 0064 +template Header { + <3D82AB43-62DA-11cf-AB39-0020AF71E433> + WORD major; + WORD minor; + DWORD flags; +} + +template Vector { + <3D82AB5E-62DA-11cf-AB39-0020AF71E433> + FLOAT x; + FLOAT y; + FLOAT z; +} + +template Coords2d { + <F6F23F44-7686-11cf-8F52-0040333594A3> + FLOAT u; + FLOAT v; +} + +template Matrix4x4 { + <F6F23F45-7686-11cf-8F52-0040333594A3> + array FLOAT matrix[16]; +} + +template ColorRGBA { + <35FF44E0-6C7C-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; + FLOAT alpha; +} + +template ColorRGB { + <D3E16E81-7835-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; +} + +template IndexedColor { + <1630B820-7842-11cf-8F52-0040333594A3> + DWORD index; + ColorRGBA indexColor; +} + +template Boolean { + <4885AE61-78E8-11cf-8F52-0040333594A3> + WORD truefalse; +} + +template Boolean2d { + <4885AE63-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template MaterialWrap { + <4885AE60-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template TextureFilename { + <A42790E1-7810-11cf-8F52-0040333594A3> + STRING filename; +} + +template Material { + <3D82AB4D-62DA-11cf-AB39-0020AF71E433> + ColorRGBA faceColor; + FLOAT power; + ColorRGB specularColor; + ColorRGB emissiveColor; + [...] +} + +template MeshFace { + <3D82AB5F-62DA-11cf-AB39-0020AF71E433> + DWORD nFaceVertexIndices; + array DWORD faceVertexIndices[nFaceVertexIndices]; +} + +template MeshFaceWraps { + <4885AE62-78E8-11cf-8F52-0040333594A3> + DWORD nFaceWrapValues; + Boolean2d faceWrapValues; +} + +template MeshTextureCoords { + <F6F23F40-7686-11cf-8F52-0040333594A3> + DWORD nTextureCoords; + array Coords2d textureCoords[nTextureCoords]; +} + +template MeshMaterialList { + <F6F23F42-7686-11cf-8F52-0040333594A3> + DWORD nMaterials; + DWORD nFaceIndexes; + array DWORD faceIndexes[nFaceIndexes]; + [Material] +} + +template MeshNormals { + <F6F23F43-7686-11cf-8F52-0040333594A3> + DWORD nNormals; + array Vector normals[nNormals]; + DWORD nFaceNormals; + array MeshFace faceNormals[nFaceNormals]; +} + +template MeshVertexColors { + <1630B821-7842-11cf-8F52-0040333594A3> + DWORD nVertexColors; + array IndexedColor vertexColors[nVertexColors]; +} + +template Mesh { + <3D82AB44-62DA-11cf-AB39-0020AF71E433> + DWORD nVertices; + array Vector vertices[nVertices]; + DWORD nFaces; + array MeshFace faces[nFaces]; + [...] +} + +Header { + 1; + 0; + 1; +} + +Mesh { + 10; + 0.082451;-0.082450;-6.700000;, + 0.082451;0.082451;-6.700000;, + -0.082451;0.082451;-6.700000;, + -0.082451;-0.082450;-6.700000;, + 3.349999;-3.350001;-0.000000;, + 3.350000;3.350000;0.000000;, + -3.349999;3.350001;0.000000;, + -3.350002;-3.349998;-0.000000;, + 0.000000;0.000000;-6.700000;, + 0.000000;-0.000000;-0.000000;; + + 16; + 3;0,8,1;, + 3;1,8,2;, + 3;2,8,3;, + 3;3,8,0;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,5,9;, + 3;5,6,9;, + 3;6,7,9;, + 3;7,4,9;; + + MeshMaterialList { + 1; + 1; + 0;; + Material { + 0.274510;0.325490;0.905882;1.000000;; + 30.000000; + 0.768627;0.768627;0.768627;; + 0.000000;0.000000;0.000000;; + } + } + MeshNormals { + 26; + 0.000000;0.000000;-1.000000;, + 0.898808;-0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.000000;0.000000;-1.000000;, + 0.898808;-0.000000;-0.438343;, + 0.000000;0.898808;-0.438343;, + 0.000000;0.000000;-1.000000;, + 0.000000;0.898808;-0.438343;, + -0.898808;0.000000;-0.438343;, + 0.000000;0.000000;-1.000000;, + -0.898808;0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.898808;-0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.000000;-0.000000;1.000000;, + 0.898808;-0.000000;-0.438343;, + 0.000000;0.898808;-0.438343;, + 0.000000;-0.000000;1.000000;, + 0.000000;0.898808;-0.438343;, + -0.898808;0.000000;-0.438343;, + 0.000000;-0.000000;1.000000;, + -0.898808;0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.000000;-0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + 0.000000;-0.000000;1.000000;; + + 16; + 3;0,24,3;, + 3;3,24,6;, + 3;6,24,9;, + 3;9,24,0;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,17,25;, + 3;17,20,25;, + 3;20,23,25;, + 3;23,14,25;; + } + MeshTextureCoords { + 10; + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;; + } +} diff --git a/sdk/samples/rockem/debris_r.x b/sdk/samples/rockem/debris_r.x new file mode 100644 index 0000000..8e1fad2 --- /dev/null +++ b/sdk/samples/rockem/debris_r.x @@ -0,0 +1,236 @@ +xof 0302txt 0064 +template Header { + <3D82AB43-62DA-11cf-AB39-0020AF71E433> + WORD major; + WORD minor; + DWORD flags; +} + +template Vector { + <3D82AB5E-62DA-11cf-AB39-0020AF71E433> + FLOAT x; + FLOAT y; + FLOAT z; +} + +template Coords2d { + <F6F23F44-7686-11cf-8F52-0040333594A3> + FLOAT u; + FLOAT v; +} + +template Matrix4x4 { + <F6F23F45-7686-11cf-8F52-0040333594A3> + array FLOAT matrix[16]; +} + +template ColorRGBA { + <35FF44E0-6C7C-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; + FLOAT alpha; +} + +template ColorRGB { + <D3E16E81-7835-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; +} + +template IndexedColor { + <1630B820-7842-11cf-8F52-0040333594A3> + DWORD index; + ColorRGBA indexColor; +} + +template Boolean { + <4885AE61-78E8-11cf-8F52-0040333594A3> + WORD truefalse; +} + +template Boolean2d { + <4885AE63-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template MaterialWrap { + <4885AE60-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template TextureFilename { + <A42790E1-7810-11cf-8F52-0040333594A3> + STRING filename; +} + +template Material { + <3D82AB4D-62DA-11cf-AB39-0020AF71E433> + ColorRGBA faceColor; + FLOAT power; + ColorRGB specularColor; + ColorRGB emissiveColor; + [...] +} + +template MeshFace { + <3D82AB5F-62DA-11cf-AB39-0020AF71E433> + DWORD nFaceVertexIndices; + array DWORD faceVertexIndices[nFaceVertexIndices]; +} + +template MeshFaceWraps { + <4885AE62-78E8-11cf-8F52-0040333594A3> + DWORD nFaceWrapValues; + Boolean2d faceWrapValues; +} + +template MeshTextureCoords { + <F6F23F40-7686-11cf-8F52-0040333594A3> + DWORD nTextureCoords; + array Coords2d textureCoords[nTextureCoords]; +} + +template MeshMaterialList { + <F6F23F42-7686-11cf-8F52-0040333594A3> + DWORD nMaterials; + DWORD nFaceIndexes; + array DWORD faceIndexes[nFaceIndexes]; + [Material] +} + +template MeshNormals { + <F6F23F43-7686-11cf-8F52-0040333594A3> + DWORD nNormals; + array Vector normals[nNormals]; + DWORD nFaceNormals; + array MeshFace faceNormals[nFaceNormals]; +} + +template MeshVertexColors { + <1630B821-7842-11cf-8F52-0040333594A3> + DWORD nVertexColors; + array IndexedColor vertexColors[nVertexColors]; +} + +template Mesh { + <3D82AB44-62DA-11cf-AB39-0020AF71E433> + DWORD nVertices; + array Vector vertices[nVertices]; + DWORD nFaces; + array MeshFace faces[nFaces]; + [...] +} + +Header { + 1; + 0; + 1; +} + +Mesh { + 10; + 0.082451;-0.082450;-6.700000;, + 0.082451;0.082451;-6.700000;, + -0.082451;0.082451;-6.700000;, + -0.082451;-0.082450;-6.700000;, + 3.349999;-3.350001;-0.000000;, + 3.350000;3.350000;0.000000;, + -3.349999;3.350001;0.000000;, + -3.350002;-3.349998;-0.000000;, + 0.000000;0.000000;-6.700000;, + 0.000000;-0.000000;-0.000000;; + + 16; + 3;0,8,1;, + 3;1,8,2;, + 3;2,8,3;, + 3;3,8,0;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,5,9;, + 3;5,6,9;, + 3;6,7,9;, + 3;7,4,9;; + + MeshMaterialList { + 1; + 1; + 0;; + Material { + 0.905882;0.274510;0.274510;1.000000;; + 29.000000; + 0.768627;0.768627;0.768627;; + 0.000000;0.000000;0.000000;; + } + } + MeshNormals { + 26; + 0.000000;0.000000;-1.000000;, + 0.898808;-0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.000000;0.000000;-1.000000;, + 0.898808;-0.000000;-0.438343;, + 0.000000;0.898808;-0.438343;, + 0.000000;0.000000;-1.000000;, + 0.000000;0.898808;-0.438343;, + -0.898808;0.000000;-0.438343;, + 0.000000;0.000000;-1.000000;, + -0.898808;0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.898808;-0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.000000;-0.000000;1.000000;, + 0.898808;-0.000000;-0.438343;, + 0.000000;0.898808;-0.438343;, + 0.000000;-0.000000;1.000000;, + 0.000000;0.898808;-0.438343;, + -0.898808;0.000000;-0.438343;, + 0.000000;-0.000000;1.000000;, + -0.898808;0.000000;-0.438343;, + -0.000000;-0.898808;-0.438343;, + 0.000000;-0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + 0.000000;-0.000000;1.000000;; + + 16; + 3;0,24,3;, + 3;3,24,6;, + 3;6,24,9;, + 3;9,24,0;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,17,25;, + 3;17,20,25;, + 3;20,23,25;, + 3;23,14,25;; + } + MeshTextureCoords { + 10; + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;, + 0.000000;0.000000;; + } +} diff --git a/sdk/samples/rockem/defend1.wav b/sdk/samples/rockem/defend1.wav new file mode 100644 index 0000000..ff34787 Binary files /dev/null and b/sdk/samples/rockem/defend1.wav differ diff --git a/sdk/samples/rockem/defend2.wav b/sdk/samples/rockem/defend2.wav new file mode 100644 index 0000000..a83ac59 Binary files /dev/null and b/sdk/samples/rockem/defend2.wav differ diff --git a/sdk/samples/rockem/demech.x b/sdk/samples/rockem/demech.x new file mode 100644 index 0000000..1e7dcd3 --- /dev/null +++ b/sdk/samples/rockem/demech.x @@ -0,0 +1,3819 @@ +xof 0302txt 0064 +template Header { + <3D82AB43-62DA-11cf-AB39-0020AF71E433> + WORD major; + WORD minor; + DWORD flags; +} + +template Vector { + <3D82AB5E-62DA-11cf-AB39-0020AF71E433> + FLOAT x; + FLOAT y; + FLOAT z; +} + +template Coords2d { + <F6F23F44-7686-11cf-8F52-0040333594A3> + FLOAT u; + FLOAT v; +} + +template Matrix4x4 { + <F6F23F45-7686-11cf-8F52-0040333594A3> + array FLOAT matrix[16]; +} + +template ColorRGBA { + <35FF44E0-6C7C-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; + FLOAT alpha; +} + +template ColorRGB { + <D3E16E81-7835-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; +} + +template IndexedColor { + <1630B820-7842-11cf-8F52-0040333594A3> + DWORD index; + ColorRGBA indexColor; +} + +template Boolean { + <4885AE61-78E8-11cf-8F52-0040333594A3> + WORD truefalse; +} + +template Boolean2d { + <4885AE63-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template MaterialWrap { + <4885AE60-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template TextureFilename { + <A42790E1-7810-11cf-8F52-0040333594A3> + STRING filename; +} + +template Material { + <3D82AB4D-62DA-11cf-AB39-0020AF71E433> + ColorRGBA faceColor; + FLOAT power; + ColorRGB specularColor; + ColorRGB emissiveColor; + [...] +} + +template MeshFace { + <3D82AB5F-62DA-11cf-AB39-0020AF71E433> + DWORD nFaceVertexIndices; + array DWORD faceVertexIndices[nFaceVertexIndices]; +} + +template MeshFaceWraps { + <4885AE62-78E8-11cf-8F52-0040333594A3> + DWORD nFaceWrapValues; + Boolean2d faceWrapValues; +} + +template MeshTextureCoords { + <F6F23F40-7686-11cf-8F52-0040333594A3> + DWORD nTextureCoords; + array Coords2d textureCoords[nTextureCoords]; +} + +template MeshMaterialList { + <F6F23F42-7686-11cf-8F52-0040333594A3> + DWORD nMaterials; + DWORD nFaceIndexes; + array DWORD faceIndexes[nFaceIndexes]; + [Material] +} + +template MeshNormals { + <F6F23F43-7686-11cf-8F52-0040333594A3> + DWORD nNormals; + array Vector normals[nNormals]; + DWORD nFaceNormals; + array MeshFace faceNormals[nFaceNormals]; +} + +template MeshVertexColors { + <1630B821-7842-11cf-8F52-0040333594A3> + DWORD nVertexColors; + array IndexedColor vertexColors[nVertexColors]; +} + +template Mesh { + <3D82AB44-62DA-11cf-AB39-0020AF71E433> + DWORD nVertices; + array Vector vertices[nVertices]; + DWORD nFaces; + array MeshFace faces[nFaces]; + [...] +} + +template FrameTransformMatrix { + <F6F23F41-7686-11cf-8F52-0040333594A3> + Matrix4x4 frameMatrix; +} + +template Frame { + <3D82AB46-62DA-11cf-AB39-0020AF71E433> + [...] +} + +template FloatKeys { + <10DD46A9-775B-11cf-8F52-0040333594A3> + DWORD nValues; + array FLOAT values[nValues]; +} + +template TimedFloatKeys { + <F406B180-7B3B-11cf-8F52-0040333594A3> + DWORD time; + FloatKeys tfkeys; +} + +template AnimationKey { + <10DD46A8-775B-11cf-8F52-0040333594A3> + DWORD keyType; + DWORD nKeys; + array TimedFloatKeys keys[nKeys]; +} + +template AnimationOptions { + <E2BF56C0-840F-11cf-8F52-0040333594A3> + DWORD openclosed; + DWORD positionquality; +} + +template Animation { + <3D82AB4F-62DA-11cf-AB39-0020AF71E433> + [...] +} + +template AnimationSet { + <3D82AB50-62DA-11cf-AB39-0020AF71E433> + [Animation] +} + +Header { + 1; + 0; + 1; +} + +Material x3ds_mat_01MECHHAND { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHHN.GIF"; + } +} +Material x3ds_mat_02MECHARM { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHLA.GIF"; + } +} +Material x3ds_mat_01GROIN { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHGR.GIF"; + } +} +Material x3ds_mat_02MECHLEG { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHLL.GIF"; + } +} +Material x3ds_mat_01MECHLEG { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHUL.GIF"; + } +} +Material x3ds_mat_01HEAD { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHHD.GIF"; + } +} +Material x3ds_mat_REDPLASTIC { + 1.000000, 0.368627, 0.368627, 1.000000;; + 30.800001; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; +} +Material x3ds_mat_01BACK { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.400000; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHBK.GIF"; + } +} +Material x3ds_mat_01MECHARM { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHUA.GIF"; + } +} +Material x3ds_mat_01CHEST { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.400000; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "DEMECHCH.GIF"; + } +} + +Frame x3ds_xGroin { + FrameTransformMatrix { + -1.000000, 0.000000, 0.000000, 0.000000, + 0.000000, 0.000000, 1.000000, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + 0.000000, 35.534382, 1.024473, 1.000000;; + } + Mesh xGroin { + + 31; + -2.000033; -0.000005; -10.091250;, + -0.555553; -0.000005; -10.091250;, + 1.666685; -0.000005; -10.091250;, + -1.192545; -7.018511; -6.581248;, + -3.066506; -0.638034; -6.581249;, + -2.555453; 5.104383; -6.581252;, + -0.851815; 7.018551; -6.581251;, + 0.851807; 7.018506; -6.581251;, + 1.192535; -7.018467; -6.581248;, + -2.333362; -11.356153; 3.071271;, + -6.000067; -1.032373; 3.071292;, + -5.000066; 8.258989; 3.071267;, + -1.666681; 11.356154; 3.071267;, + 1.666685; 11.356243; 3.071267;, + 5.000067; 8.259121; 3.071267;, + 6.000000; -1.032373; 3.071269;, + 2.333369; -11.356200; 3.071271;, + -7.000063; -10.455877; 5.703794;, + -17.999998; -1.012086; 5.703773;, + -15.000134; 7.487371; 5.703790;, + -5.000066; 10.320596; 5.703789;, + 15.000134; 7.487412; 5.703790;, + 17.999998; -1.012087; 5.703768;, + 7.000071; -10.455922; 5.703794;, + -5.833399; -8.955485; 10.091297;, + -15.000132; -0.814138; 10.091291;, + -12.499999; 6.513076; 10.091294;, + -4.166667; 8.955388; 10.091293;, + 12.500134; 6.513030; 10.091294;, + 15.000134; -0.814141; 10.091295;, + 5.833402; -8.955529; 10.091297;; + + 53; + 3;1,4,0;, + 3;1,3,4;, + 3;0,5,1;, + 3;0,4,5;, + 3;1,5,6;, + 3;1,7,2;, + 3;1,6,7;, + 3;2,3,1;, + 3;2,8,3;, + 3;3,10,4;, + 3;3,9,10;, + 3;4,11,5;, + 3;4,10,11;, + 3;5,12,6;, + 3;5,11,12;, + 3;6,13,7;, + 3;6,12,13;, + 3;7,13,14;, + 3;7,15,2;, + 3;7,14,15;, + 3;2,16,8;, + 3;2,15,16;, + 3;8,9,3;, + 3;8,16,9;, + 3;9,18,10;, + 3;9,17,18;, + 3;10,19,11;, + 3;10,18,19;, + 3;11,20,12;, + 3;11,19,20;, + 3;12,20,13;, + 3;13,21,14;, + 3;14,22,15;, + 3;14,21,22;, + 3;15,23,16;, + 3;15,22,23;, + 3;16,17,9;, + 3;16,23,17;, + 3;17,25,18;, + 3;17,24,25;, + 3;18,26,19;, + 3;18,25,26;, + 3;19,27,20;, + 3;19,26,27;, + 3;20,27,13;, + 3;13,28,21;, + 3;13,27,28;, + 3;21,29,22;, + 3;21,28,29;, + 3;22,30,23;, + 3;22,29,30;, + 3;23,24,17;, + 3;23,30,24;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01GROIN} + } + MeshNormals { + 64; + -0.000000;-0.983877;-0.178844;, + -0.599572;0.408149;-0.688424;, + -0.560307;-0.381698;-0.735094;, + 0.000000;0.508170;-0.861257;, + -0.000000;-0.447290;-0.894389;, + 0.559687;0.421739;-0.713363;, + -0.000000;-0.447290;-0.894389;, + 0.937160;-0.239286;-0.253915;, + -0.880351;-0.277520;-0.384663;, + 0.000009;-0.721590;-0.692320;, + -0.680092;-0.595592;-0.427487;, + -0.956486;0.091041;-0.277212;, + -0.776351;0.298631;-0.555067;, + -0.612329;0.585593;-0.531164;, + -0.595762;0.530237;-0.603255;, + 0.000019;0.721585;-0.692326;, + 0.573074;0.533170;-0.622347;, + 0.634858;0.683287;-0.360658;, + 0.000013;-0.721591;-0.692319;, + 0.969727;-0.158439;-0.185813;, + -0.603915;-0.361812;-0.710196;, + 0.000004;-0.998923;-0.046402;, + -0.776502;-0.254344;-0.576501;, + -0.537039;0.077572;-0.839983;, + -0.815733;0.081072;-0.572719;, + -0.490500;0.710156;-0.505063;, + -0.643035;0.648313;-0.407671;, + -0.000027;0.999717;-0.023791;, + -0.010253;0.995713;0.091928;, + 0.398539;0.900274;-0.175139;, + 0.488511;0.525776;-0.696359;, + 0.507328;0.077991;-0.858217;, + 0.768552;0.139116;-0.624480;, + 0.584865;-0.268944;-0.765246;, + 0.845605;-0.234038;-0.479769;, + -0.000010;-0.998923;-0.046406;, + -0.654640;-0.753300;0.063125;, + -0.000009;-0.946205;0.323569;, + -0.582828;-0.600451;-0.547512;, + -0.943651;0.328188;0.042606;, + -0.654989;0.198844;-0.729006;, + -0.275500;0.960845;0.029596;, + -0.400693;0.869473;-0.288898;, + -0.014416;0.942381;0.334230;, + 0.328385;0.846238;-0.419578;, + 0.943441;0.328186;0.047052;, + 0.657040;0.204764;-0.725514;, + 0.655845;-0.753077;-0.052365;, + 0.593011;-0.504799;-0.627309;, + -0.000003;-0.946198;0.323589;, + -0.609542;-0.686312;0.396779;, + -0.000003;-0.946203;0.323573;, + -0.598574;-0.685369;0.414704;, + -0.799848;0.272917;0.534565;, + -0.802248;0.278457;0.528072;, + -0.263482;0.899018;0.349777;, + -0.132000;0.918501;0.372736;, + -0.028788;0.952884;0.301966;, + 0.168538;0.913545;0.370176;, + 0.807613;0.275554;0.521374;, + 0.802809;0.278603;0.527141;, + 0.596840;-0.672007;0.438393;, + 0.597512;-0.684374;0.417866;, + -0.000004;-0.946204;0.323572;; + 53; + 3;2,10,0;, + 3;2,8,10;, + 3;1,12,3;, + 3;1,11,12;, + 3;2,13,14;, + 3;3,16,5;, + 3;3,15,16;, + 3;6,9,4;, + 3;6,18,9;, + 3;8,22,10;, + 3;8,20,22;, + 3;11,24,12;, + 3;11,23,24;, + 3;13,26,14;, + 3;13,25,26;, + 3;15,28,16;, + 3;15,27,28;, + 3;17,29,30;, + 3;16,32,5;, + 3;16,31,32;, + 3;7,34,19;, + 3;7,33,34;, + 3;18,21,9;, + 3;18,35,21;, + 3;20,38,22;, + 3;20,36,38;, + 3;23,40,24;, + 3;23,39,40;, + 3;25,42,26;, + 3;25,41,42;, + 3;27,43,28;, + 3;29,44,30;, + 3;31,46,32;, + 3;31,45,46;, + 3;33,48,34;, + 3;33,47,48;, + 3;35,37,21;, + 3;35,49,37;, + 3;36,52,38;, + 3;36,50,52;, + 3;39,54,40;, + 3;39,53,54;, + 3;41,56,42;, + 3;41,55,56;, + 3;43,57,28;, + 3;29,58,44;, + 3;29,56,58;, + 3;45,60,46;, + 3;45,59,60;, + 3;47,62,48;, + 3;47,61,62;, + 3;49,51,37;, + 3;49,63,51;; + } + MeshTextureCoords { + 31; + 0.546412;0.933469;, + 0.511654;0.933469;, + 0.458180;0.933469;, + 0.526982;0.782985;, + 0.572075;0.782985;, + 0.559777;0.782985;, + 0.518783;0.782985;, + 0.477788;0.782985;, + 0.469589;0.782985;, + 0.554433;0.369152;, + 0.642665;0.369151;, + 0.618602;0.369152;, + 0.538391;0.369152;, + 0.458180;0.369152;, + 0.377969;0.369152;, + 0.353907;0.369152;, + 0.442138;0.369152;, + 0.666728;0.256288;, + 0.931421;0.256289;, + 0.859233;0.256288;, + 0.618602;0.256288;, + 0.137338;0.256288;, + 0.065150;0.256289;, + 0.329843;0.256288;, + 0.638654;0.068183;, + 0.859233;0.068183;, + 0.799074;0.068183;, + 0.598548;0.068183;, + 0.197495;0.068183;, + 0.137338;0.068183;, + 0.357917;0.068183;; + } + } + + Frame x3ds_xChest { + FrameTransformMatrix { + -1.000000, 0.000000, 0.000000, 0.000000, + -0.000000, -1.000000, 0.000000, 0.000000, + 0.000000, 0.000000, 1.000000, 0.000000, + 0.426950, -1.024468, 11.366159, 1.000000;; + } + Mesh xChest { + + 40; + -5.406384; -9.499996; -0.774913;, + -14.573050; -1.772723; -0.774910;, + -12.073050; 5.181822; -0.774907;, + -3.739717; 7.500004; -0.774907;, + 4.593616; 7.500004; -0.774907;, + 12.926949; 5.181822; -0.774910;, + 15.426949; -1.772723; -0.774914;, + 6.260283; -9.499996; -0.774913;, + -8.859015; -15.499998; 25.225092;, + -23.451246; -1.491749; 25.225090;, + -19.471548; 11.115673; 25.225096;, + -6.205883; 15.318148; 25.225096;, + 7.059781; 15.318148; 25.225096;, + 20.325445; 11.115673; 25.225096;, + 24.305143; -1.491749; 25.225090;, + 9.712914; -15.499998; 25.225092;, + -10.054240; -15.499997; 34.225082;, + -33.573051; -1.863631; 34.225082;, + -22.032743; 10.409095; 34.225082;, + -7.059614; 14.500003; 34.225082;, + 7.913515; 14.500003; 34.225082;, + 22.886644; 10.409095; 34.225082;, + 34.426949; -1.863631; 34.225082;, + 10.908140; -15.499997; 34.225082;, + -10.850827; -11.500252; 40.225082;, + -39.573051; -2.106037; 47.225090;, + -23.739717; 8.348755; 42.225098;, + -7.628605; 9.167019; 40.225098;, + 8.482507; 9.167019; 40.225098;, + 24.593618; 8.348755; 42.225090;, + 40.426949; -2.106037; 47.225090;, + 11.704728; -11.500252; 40.225082;, + -8.517495; -9.499994; 43.225082;, + -18.573050; -2.227266; 43.225090;, + -14.573050; 4.318189; 43.225098;, + -5.961939; 6.500007; 43.225098;, + 6.815839; 6.500007; 43.225090;, + 15.426950; 4.318189; 43.225090;, + 19.426950; -2.227266; 43.225090;, + 9.371394; -9.499994; 43.225082;; + + 70; + 3;0,9,1;, + 3;1,9,2;, + 3;0,8,9;, + 3;9,10,2;, + 3;2,11,3;, + 3;2,10,11;, + 3;3,12,4;, + 3;3,11,12;, + 3;4,13,5;, + 3;4,12,13;, + 3;5,14,6;, + 3;5,13,14;, + 3;6,15,7;, + 3;6,14,15;, + 3;7,8,0;, + 3;7,15,8;, + 3;8,17,9;, + 3;8,16,17;, + 3;9,18,10;, + 3;9,17,18;, + 3;10,19,11;, + 3;10,18,19;, + 3;11,20,12;, + 3;11,19,20;, + 3;12,21,13;, + 3;12,20,21;, + 3;13,22,14;, + 3;13,21,22;, + 3;14,23,15;, + 3;14,22,23;, + 3;15,16,8;, + 3;15,23,16;, + 3;16,25,17;, + 3;16,24,25;, + 3;17,26,18;, + 3;17,25,26;, + 3;18,27,19;, + 3;18,26,27;, + 3;19,28,20;, + 3;19,27,28;, + 3;20,29,21;, + 3;20,28,29;, + 3;21,30,22;, + 3;21,29,30;, + 3;22,31,23;, + 3;22,30,31;, + 3;23,24,16;, + 3;23,31,24;, + 3;24,33,25;, + 3;24,32,33;, + 3;25,34,26;, + 3;25,33,34;, + 3;26,35,27;, + 3;26,34,35;, + 3;27,36,28;, + 3;27,35,36;, + 3;28,37,29;, + 3;28,36,37;, + 3;29,38,30;, + 3;29,37,38;, + 3;30,39,31;, + 3;30,38,39;, + 3;31,32,24;, + 3;31,39,32;, + 3;37,39,38;, + 3;36,39,37;, + 3;36,32,39;, + 3;35,32,36;, + 3;35,33,32;, + 3;34,33,35;; + MeshMaterialList { + 2; + 70; + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_01BACK} + {x3ds_mat_01CHEST} + } + MeshNormals { + 88; + -0.650995;-0.723751;-0.228890;, + 0.000000;-0.974391;-0.224860;, + -0.630534;-0.747987;-0.207225;, + -0.894967;0.321720;-0.309080;, + -0.899082;0.303417;-0.315579;, + -0.272342;0.915691;-0.295533;, + -0.255614;0.918875;-0.300549;, + 0.000000;0.957642;-0.287961;, + 0.000000;0.957642;-0.287961;, + 0.272548;0.916640;-0.292383;, + 0.256974;0.923763;-0.283949;, + 0.899082;0.303417;-0.315579;, + 0.894967;0.321720;-0.309080;, + 0.649687;-0.721872;-0.238346;, + 0.623476;-0.739614;-0.253474;, + 0.000000;-0.974391;-0.224860;, + -0.592597;-0.735803;-0.327753;, + 0.000000;-0.993577;-0.113156;, + -0.627516;-0.684776;-0.370547;, + -0.846659;0.369049;-0.383368;, + -0.915063;0.288852;-0.281468;, + -0.288159;0.954384;-0.078204;, + -0.286130;0.941081;-0.180268;, + -0.000000;0.994932;-0.100550;, + 0.000000;0.994932;-0.100550;, + 0.288029;0.953917;-0.084156;, + 0.284948;0.937354;-0.200430;, + 0.805421;0.413325;-0.424806;, + 0.840105;0.278624;-0.465394;, + 0.612424;-0.738201;-0.282836;, + 0.664713;-0.722563;-0.189894;, + 0.000000;-0.993577;-0.113156;, + -0.405419;-0.910419;0.082297;, + 0.000000;-0.957096;0.289770;, + -0.528719;-0.784443;-0.324201;, + -0.656992;0.692463;-0.298087;, + -0.789210;0.537054;-0.297861;, + -0.169555;0.935537;0.309874;, + -0.269038;0.931504;0.244784;, + -0.000000;0.917665;0.397355;, + 0.000000;0.917665;0.397355;, + 0.167433;0.931814;0.322007;, + 0.275612;0.957904;0.080362;, + 0.660560;0.741019;-0.120626;, + 0.729124;0.541464;-0.418562;, + 0.446769;-0.890468;-0.086398;, + 0.573798;-0.817112;-0.055524;, + -0.000000;-0.957096;0.289770;, + -0.136334;-0.572759;0.808307;, + 0.000000;-0.832067;0.554676;, + -0.195803;-0.806978;0.557179;, + -0.175779;0.515191;0.838856;, + -0.544400;0.783128;0.300564;, + -0.005950;0.707002;0.707186;, + -0.061460;0.847479;0.527259;, + -0.000000;0.747432;0.664339;, + 0.000000;0.747432;0.664339;, + 0.013296;0.633065;0.773985;, + 0.045031;0.769592;0.636946;, + 0.179371;0.455292;0.872087;, + 0.488614;0.794147;0.361368;, + 0.133669;-0.718562;0.682496;, + 0.323520;-0.890918;0.318748;, + 0.000000;-0.832067;0.554676;, + -0.415209;-0.574084;0.705712;, + 0.000000;-0.832017;0.554750;, + 0.000000;-0.000000;1.000000;, + -0.125496;-0.398449;0.908565;, + 0.185278;-0.113227;0.976141;, + 0.000000;-0.000001;1.000000;, + 0.124763;0.127164;0.984004;, + -0.039366;0.155367;0.987072;, + 0.000000;-0.000001;1.000000;, + 0.001540;0.487185;0.873297;, + 0.000000;0.747367;0.664412;, + 0.000001;-0.000001;1.000000;, + 0.000000;0.747366;0.664413;, + 0.173828;0.686055;0.706479;, + -0.000000;-0.000000;1.000000;, + 0.042888;0.569361;0.820968;, + 0.085553;0.052282;0.994961;, + -0.000001;-0.000000;1.000000;, + -0.050303;0.118343;0.991698;, + -0.182465;0.252282;0.950295;, + -0.000001;-0.000000;1.000000;, + -0.044699;-0.323568;0.945148;, + 0.000000;-0.832017;0.554750;, + -0.000001;-0.000000;1.000000;; + 70; + 3;0,18,2;, + 3;3,19,4;, + 3;0,16,18;, + 3;19,20,4;, + 3;5,22,6;, + 3;5,21,22;, + 3;7,24,8;, + 3;7,23,24;, + 3;9,26,10;, + 3;9,25,26;, + 3;11,28,12;, + 3;11,27,28;, + 3;13,30,14;, + 3;13,29,30;, + 3;15,17,1;, + 3;15,31,17;, + 3;16,34,18;, + 3;16,32,34;, + 3;19,36,20;, + 3;19,35,36;, + 3;21,38,22;, + 3;21,37,38;, + 3;23,40,24;, + 3;23,39,40;, + 3;25,42,26;, + 3;25,41,42;, + 3;27,44,28;, + 3;27,43,44;, + 3;29,46,30;, + 3;29,45,46;, + 3;31,33,17;, + 3;31,47,33;, + 3;32,50,34;, + 3;32,48,50;, + 3;35,52,36;, + 3;35,51,52;, + 3;37,54,38;, + 3;37,53,54;, + 3;39,56,40;, + 3;39,55,56;, + 3;41,58,42;, + 3;41,57,58;, + 3;43,60,44;, + 3;43,59,60;, + 3;45,62,46;, + 3;45,61,62;, + 3;47,49,33;, + 3;47,63,49;, + 3;48,67,50;, + 3;48,64,67;, + 3;51,70,52;, + 3;51,68,70;, + 3;53,73,54;, + 3;53,71,73;, + 3;55,76,56;, + 3;55,74,76;, + 3;57,79,58;, + 3;57,77,79;, + 3;59,82,60;, + 3;59,80,82;, + 3;61,85,62;, + 3;61,83,85;, + 3;63,65,49;, + 3;63,86,65;, + 3;81,87,84;, + 3;78,87,81;, + 3;78,66,87;, + 3;75,66,78;, + 3;75,69,66;, + 3;72,69,75;; + } + MeshTextureCoords { + 40; + 0.427128;1.000148;, + 0.312615;1.000148;, + 0.343846;1.000148;, + 0.447949;1.000148;, + 0.552051;1.000148;, + 0.656154;1.000148;, + 0.687385;1.000148;, + 0.572872;1.000148;, + 0.383997;0.458321;, + 0.201706;0.458321;, + 0.251421;0.458321;, + 0.417140;0.458321;, + 0.582860;0.458321;, + 0.748579;0.458321;, + 0.798294;0.458321;, + 0.616003;0.458321;, + 0.369065;0.270766;, + 0.075261;0.270766;, + 0.219426;0.270766;, + 0.406475;0.270766;, + 0.593525;0.270766;, + 0.780574;0.270766;, + 0.924739;0.270766;, + 0.630935;0.270766;, + 0.359114;0.145729;, + 0.000307;-0.000148;, + 0.198102;0.104050;, + 0.399367;0.145729;, + 0.600633;0.145729;, + 0.801898;0.104050;, + 0.999693;-0.000148;, + 0.640886;0.145729;, + 0.388263;0.083210;, + 0.262646;0.083210;, + 0.312615;0.083210;, + 0.420188;0.083210;, + 0.579812;0.083210;, + 0.687385;0.083210;, + 0.737354;0.083210;, + 0.611737;0.083210;; + } + } + + Frame x3ds_xRU_Arm { + FrameTransformMatrix { + -0.965926, -0.000000, -0.258819, 0.000000, + 0.000000, -1.000000, -0.000000, 0.000000, + -0.258819, -0.000000, 0.965926, 0.000000, + -22.158115, 0.000006, 34.682274, 1.000000;; + } + Mesh xRU_Arm { + + 12; + -5.501477; 0.000004; -2.449525;, + -2.458304; 6.273185; -0.692550;, + 3.628045; 6.273181; 2.821392;, + 6.671256; -0.000001; 4.578400;, + 3.628039; -6.273170; 2.821389;, + -2.458306; -6.273180; -0.692544;, + 8.608694; 0.000001; -22.981846;, + 10.805939; 4.394533; -21.713266;, + 15.200456; 4.394531; -19.176115;, + 17.397690; -0.000002; -17.907520;, + 15.200446; -4.394547; -19.176085;, + 10.805936; -4.394485; -21.713276;; + + 20; + 3;7,0,1;, + 3;6,0,7;, + 3;8,1,2;, + 3;7,1,8;, + 3;9,2,3;, + 3;8,2,9;, + 3;10,3,4;, + 3;9,3,10;, + 3;11,4,5;, + 3;10,4,11;, + 3;6,5,0;, + 3;11,5,6;, + 3;0,2,1;, + 3;0,3,2;, + 3;0,4,3;, + 3;0,5,4;, + 3;7,8,9;, + 3;7,9,10;, + 3;7,10,11;, + 3;7,11,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHARM} + } + MeshNormals { + 36; + -0.716210;0.493166;-0.493793;, + -0.719557;-0.487560;-0.494492;, + -0.499999;-0.000001;0.866026;, + -0.718101;0.487469;-0.496693;, + 0.037713;0.997151;-0.065320;, + -0.499999;-0.000001;0.866026;, + 0.037713;0.997151;-0.065320;, + 0.785986;0.493148;0.372868;, + -0.499999;-0.000001;0.866026;, + 0.788019;0.487565;0.375908;, + 0.785740;-0.493168;0.373360;, + -0.500000;0.000001;0.866026;, + 0.789195;-0.487476;0.373548;, + 0.037714;-0.997151;-0.065321;, + -0.500000;-0.000001;0.866026;, + 0.037714;-0.997151;-0.065321;, + -0.715906;-0.493147;-0.494252;, + -0.499998;0.000002;0.866027;, + -0.714286;0.498840;-0.490870;, + -0.715906;-0.493147;-0.494252;, + 0.499999;0.000001;-0.866026;, + -0.716210;0.493166;-0.493793;, + 0.037713;0.997151;-0.065320;, + 0.499996;-0.000007;-0.866027;, + 0.037713;0.997151;-0.065320;, + 0.783919;0.498709;0.369811;, + 0.499996;-0.000007;-0.866027;, + 0.785986;0.493148;0.372868;, + 0.782250;-0.498838;0.373156;, + 0.499996;-0.000007;-0.866027;, + 0.785740;-0.493168;0.373360;, + 0.037701;-0.997152;-0.065325;, + 0.499999;-0.000002;-0.866026;, + 0.037714;-0.997151;-0.065321;, + -0.712222;-0.498712;-0.493989;, + 0.500003;0.000001;-0.866024;; + 20; + 3;21,0,3;, + 3;18,0,21;, + 3;24,4,6;, + 3;22,4,24;, + 3;27,7,9;, + 3;25,7,27;, + 3;30,10,12;, + 3;28,10,30;, + 3;33,13,15;, + 3;31,13,33;, + 3;19,16,1;, + 3;34,16,19;, + 3;2,8,5;, + 3;2,11,8;, + 3;2,14,11;, + 3;2,17,14;, + 3;23,26,29;, + 3;23,29,32;, + 3;23,32,35;, + 3;23,35,20;; + } + MeshTextureCoords { + 12; + 0.250000;-0.011257;, + 0.081267;-0.011257;, + 0.918734;-0.011257;, + 0.750000;-0.011257;, + 0.581266;-0.011257;, + 0.418733;-0.011257;, + 0.250000;1.011257;, + 0.083334;1.011257;, + 0.916666;1.011257;, + 0.750000;1.011257;, + 0.583334;1.011257;, + 0.416666;1.011257;; + } + } + + Frame x3ds_xRL_Arm { + FrameTransformMatrix { + 1.000000, -0.000000, -0.000000, 0.000000, + -0.000000, 1.000000, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + 13.822151, 0.000003, -20.565968, 1.000000;; + } + Mesh xRL_Arm { + + 24; + 8.013477; 0.000005; -35.874058;, + 12.494552; 9.237302; -33.286903;, + 21.456678; 9.237297; -28.112616;, + 25.937769; -0.000003; -25.525463;, + 21.456680; -9.237155; -28.112616;, + 12.494545; -9.237296; -33.286919;, + -4.837206; 0.000002; -3.067563;, + -2.639963; 4.394546; -1.798980;, + 1.754547; 4.394532; 0.738177;, + 3.951795; -0.000002; 2.006753;, + 1.754554; -4.394534; 0.738174;, + -2.639967; -4.394532; -1.798978;, + 5.120436; -0.663049; -1.830179;, + 10.395203; -0.663048; -7.844885;, + 9.816457; -0.663051; 4.948281;, + 5.120435; 0.336947; -1.830175;, + 10.395203; 0.336951; -7.844885;, + 9.816456; 0.336949; 4.948285;, + 15.652800; -0.663047; -15.309710;, + 20.927570; -0.663046; -21.324427;, + 20.348825; -0.663049; -8.531265;, + 15.652801; 0.336953; -15.309710;, + 20.927568; 0.336950; -21.324423;, + 20.348825; 0.336947; -8.531264;; + + 32; + 3;0,7,1;, + 3;0,6,7;, + 3;1,8,2;, + 3;1,7,8;, + 3;2,9,3;, + 3;2,8,9;, + 3;3,10,4;, + 3;3,9,10;, + 3;4,11,5;, + 3;4,10,11;, + 3;5,6,0;, + 3;5,11,6;, + 3;2,0,1;, + 3;3,0,2;, + 3;4,0,3;, + 3;5,0,4;, + 3;8,7,9;, + 3;9,7,10;, + 3;10,7,11;, + 3;11,7,6;, + 3;12,13,14;, + 3;13,17,14;, + 3;13,16,17;, + 3;14,15,12;, + 3;14,17,15;, + 3;16,15,17;, + 3;18,19,20;, + 3;19,23,20;, + 3;19,22,23;, + 3;20,21,18;, + 3;20,23,21;, + 3;22,21,23;; + MeshMaterialList { + 2; + 32; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHARM} + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 64; + -0.811971;0.490075;-0.317063;, + -0.814533;-0.484496;-0.319062;, + 0.500000;0.000000;-0.866025;, + -0.815268;0.484377;-0.317359;, + -0.068845;0.990475;0.119243;, + 0.500000;0.000000;-0.866025;, + -0.068845;0.990475;0.119243;, + 0.679969;0.490008;0.545467;, + 0.500000;0.000000;-0.866025;, + 0.683580;0.484497;0.545876;, + 0.680568;-0.490079;0.544656;, + 0.500000;0.000001;-0.866025;, + 0.682472;-0.484384;0.547362;, + -0.068833;-0.990476;0.119249;, + 0.500000;-0.000000;-0.866025;, + -0.068833;-0.990476;0.119249;, + -0.812373;-0.490007;-0.316139;, + 0.500001;0.000001;-0.866025;, + -0.808639;0.495752;-0.316753;, + -0.812373;-0.490007;-0.316139;, + -0.500002;0.000000;0.866024;, + -0.811971;0.490075;-0.317063;, + -0.068842;0.990475;0.119244;, + -0.499998;0.000000;0.866027;, + -0.068845;0.990475;0.119243;, + 0.676328;0.495497;0.545035;, + -0.499998;0.000000;0.866027;, + 0.679969;0.490008;0.545467;, + 0.678635;-0.495752;0.541927;, + -0.499998;0.000000;0.866027;, + 0.680568;-0.490079;0.544656;, + -0.068843;-0.990476;0.119239;, + -0.499999;-0.000001;0.866026;, + -0.068833;-0.990476;0.119249;, + -0.810178;-0.495497;-0.313201;, + -0.499996;0.000000;0.866028;, + -0.000000;-1.000000;-0.000000;, + -0.822008;-0.000003;0.569476;, + -0.000000;-1.000000;-0.000000;, + 0.998978;0.000001;0.045192;, + -0.000000;-1.000000;-0.000000;, + 0.998978;0.000001;0.045192;, + -0.822008;-0.000003;0.569476;, + -0.822008;-0.000003;0.569476;, + -0.000001;1.000000;0.000000;, + 0.998978;-0.000000;0.045193;, + -0.000001;1.000000;0.000000;, + 0.998978;0.000001;0.045192;, + -0.822008;-0.000003;0.569476;, + -0.000001;1.000000;0.000000;, + -0.000000;-1.000000;-0.000000;, + -0.822007;0.000001;0.569477;, + -0.000000;-1.000000;-0.000000;, + 0.998978;-0.000000;0.045192;, + -0.000000;-1.000000;-0.000000;, + 0.998978;-0.000000;0.045192;, + -0.822007;0.000001;0.569477;, + -0.822007;0.000001;0.569477;, + 0.000001;1.000000;0.000000;, + 0.998978;0.000002;0.045192;, + 0.000001;1.000000;0.000000;, + 0.998978;-0.000000;0.045192;, + -0.822007;-0.000001;0.569477;, + 0.000001;1.000000;0.000000;; + 32; + 3;0,21,3;, + 3;0,18,21;, + 3;4,24,6;, + 3;4,22,24;, + 3;7,27,9;, + 3;7,25,27;, + 3;10,30,12;, + 3;10,28,30;, + 3;13,33,15;, + 3;13,31,33;, + 3;16,19,1;, + 3;16,34,19;, + 3;8,2,5;, + 3;11,2,8;, + 3;14,2,11;, + 3;17,2,14;, + 3;26,23,29;, + 3;29,23,32;, + 3;32,23,35;, + 3;35,23,20;, + 3;36,38,40;, + 3;39,47,41;, + 3;39,45,47;, + 3;42,43,37;, + 3;42,48,43;, + 3;46,44,49;, + 3;50,52,54;, + 3;53,61,55;, + 3;53,59,61;, + 3;56,57,51;, + 3;56,62,57;, + 3;60,58,63;; + } + MeshTextureCoords { + 24; + 0.250000;2.476449;, + 0.081266;2.476449;, + 0.918734;2.476449;, + 0.750000;2.476449;, + 0.581266;2.476449;, + 0.418734;2.476449;, + 0.250000;1.042238;, + 0.083334;1.042238;, + 0.916666;1.042238;, + 0.750000;1.042238;, + 0.583334;1.042238;, + 0.416666;1.042238;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_xR_Hand { + FrameTransformMatrix { + -0.965926, 0.000000, -0.258819, 0.000000, + -0.258819, -0.000000, 0.965925, 0.000000, + 0.000000, 1.000000, 0.000000, 0.000000, + 17.201626, -0.532497, -26.974564, 1.000000;; + } + Mesh xR_Hand { + + 8; + -6.156250; -13.356396; -4.582500;, + 6.843750; -13.356392; -4.582499;, + 3.756248; -0.356396; -2.650548;, + -3.068748; -0.356396; -2.650548;, + -6.156250; -13.356396; 4.582500;, + 6.843750; -13.356392; 4.582499;, + 3.756248; -0.356396; 2.650487;, + -3.068748; -0.356396; 2.650487;; + + 10; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHHAND} + } + MeshNormals { + 20; + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;-0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.972937;0.231073;-0.000000;, + 0.000000;0.146997;-0.989137;, + -0.972937;0.231073;-0.000000;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;, + 0.000000;-1.000000;0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.147002;0.989136;, + 0.972937;0.231073;0.000000;, + 0.000000;0.147002;0.989136;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;; + 10; + 3;0,6,3;, + 3;0,8,6;, + 3;1,13,10;, + 3;1,4,13;, + 3;5,16,14;, + 3;5,7,16;, + 3;9,11,18;, + 3;9,2,11;, + 3;12,17,19;, + 3;12,15,17;; + } + MeshTextureCoords { + 8; + 0.032627;0.773816;, + 0.032627;0.773815;, + 0.231505;-0.195808;, + 0.231505;-0.195808;, + 0.976087;0.773816;, + 0.976087;0.773815;, + 0.777202;-0.195808;, + 0.777202;-0.195808;; + } + } + } + } + } + + Frame x3ds_xLU_Arm { + FrameTransformMatrix { + -0.965926, -0.000000, -0.258819, 0.000000, + 0.000000, -1.000000, -0.000000, 0.000000, + -0.258819, -0.000000, 0.965926, 0.000000, + 22.800379, 0.000008, 34.682274, 1.000000;; + } + Mesh xLU_Arm { + + 12; + 5.988962; 0.000003; 0.629320;, + 2.475010; 6.273185; 0.629320;, + -4.552896; 6.273124; 0.629312;, + -8.066902; 0.000002; 0.629321;, + -4.552895; -6.273167; 0.629311;, + 2.475007; -6.273119; 0.629326;, + 4.035431; 0.000003; -24.207542;, + 1.498257; 4.394476; -24.207481;, + -3.576344; 4.394535; -24.207447;, + -6.113496; 0.000003; -24.207460;, + -3.576342; -4.394542; -24.207460;, + 1.498262; -4.394542; -24.207493;; + + 20; + 3;0,7,1;, + 3;0,6,7;, + 3;1,8,2;, + 3;1,7,8;, + 3;2,9,3;, + 3;2,8,9;, + 3;3,10,4;, + 3;3,9,10;, + 3;4,11,5;, + 3;4,10,11;, + 3;5,6,0;, + 3;5,11,6;, + 3;2,0,1;, + 3;3,0,2;, + 3;4,0,3;, + 3;5,0,4;, + 3;8,7,9;, + 3;9,7,10;, + 3;10,7,11;, + 3;11,7,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHARM} + } + MeshNormals { + 36; + 0.867150;0.493170;-0.069530;, + 0.870399;-0.487563;-0.068461;, + -0.000001;-0.000001;1.000000;, + 0.870241;0.487469;-0.071097;, + -0.000009;0.997152;-0.075422;, + -0.000001;-0.000001;1.000000;, + -0.000009;0.997152;-0.075422;, + -0.867118;0.493150;-0.070072;, + -0.000001;-0.000001;1.000000;, + -0.870397;0.487569;-0.068456;, + -0.867151;-0.493168;-0.069524;, + 0.000000;0.000001;1.000000;, + -0.870238;-0.487476;-0.071089;, + 0.000007;-0.997152;-0.075422;, + 0.000000;-0.000001;1.000000;, + 0.000007;-0.997152;-0.075422;, + 0.867118;-0.493148;-0.070077;, + -0.000002;0.000002;1.000000;, + 0.864021;0.498848;-0.067959;, + 0.867118;-0.493148;-0.070077;, + -0.000022;0.000001;-1.000000;, + 0.867150;0.493170;-0.069530;, + 0.000011;0.997151;-0.075427;, + -0.000007;0.000007;-1.000000;, + -0.000009;0.997152;-0.075422;, + -0.863800;0.498709;-0.071685;, + -0.000007;0.000007;-1.000000;, + -0.867118;0.493150;-0.070072;, + -0.864027;-0.498838;-0.067955;, + -0.000007;0.000007;-1.000000;, + -0.867151;-0.493168;-0.069524;, + -0.000001;-0.997152;-0.075423;, + -0.000002;-0.000001;-1.000000;, + 0.000007;-0.997152;-0.075422;, + 0.863799;-0.498711;-0.071691;, + -0.000006;0.000001;-1.000000;; + 20; + 3;0,21,3;, + 3;0,18,21;, + 3;4,24,6;, + 3;4,22,24;, + 3;7,27,9;, + 3;7,25,27;, + 3;10,30,12;, + 3;10,28,30;, + 3;13,33,15;, + 3;13,31,33;, + 3;16,19,1;, + 3;16,34,19;, + 3;8,2,5;, + 3;11,2,8;, + 3;14,2,11;, + 3;17,2,14;, + 3;26,23,29;, + 3;29,23,32;, + 3;32,23,35;, + 3;35,23,20;; + } + MeshTextureCoords { + 12; + 0.250000;-0.011257;, + 0.081267;-0.011257;, + 0.918734;-0.011257;, + 0.750000;-0.011257;, + 0.581266;-0.011257;, + 0.418733;-0.011257;, + 0.250000;1.011257;, + 0.083334;1.011257;, + 0.916666;1.011257;, + 0.750000;1.011257;, + 0.583334;1.011257;, + 0.416666;1.011257;; + } + } + + Frame x3ds_xLL_Arm { + FrameTransformMatrix { + 1.000000, -0.000000, -0.000000, 0.000000, + -0.000000, 1.000000, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + -0.446584, 0.000005, -24.389263, 1.000000;; + } + Mesh xLL_Arm { + + 24; + 9.756407; 0.000006; -35.407063;, + 4.582108; 9.237305; -35.407040;, + -5.766471; 9.237184; -35.407040;, + -10.940788; 0.000005; -35.407043;, + -5.766469; -9.237268; -35.407063;, + 4.582115; -9.237293; -35.407051;, + 4.482169; 0.000002; -0.570457;, + 1.945006; 4.394486; -0.570453;, + -3.129325; 4.394474; -0.570462;, + -5.666486; 0.000001; -0.570473;, + -3.129334; -4.394471; -0.570465;, + 1.945009; -4.394471; -0.570457;, + -4.525237; -0.663046; -4.414725;, + -6.085963; -0.663051; -12.261003;, + -11.981339; -0.663046; -0.892426;, + -4.525237; 0.336950; -4.414725;, + -6.085961; 0.336952; -12.261005;, + -11.981338; 0.336954; -0.892433;, + -6.906761; -0.663049; -21.354527;, + -8.467486; -0.663040; -29.200804;, + -14.362860; -0.663049; -17.832241;, + -6.906761; 0.336958; -21.354527;, + -8.467486; 0.336956; -29.200804;, + -14.362861; 0.336954; -17.832237;; + + 32; + 3;7,0,1;, + 3;6,0,7;, + 3;8,1,2;, + 3;7,1,8;, + 3;9,2,3;, + 3;8,2,9;, + 3;10,3,4;, + 3;9,3,10;, + 3;11,4,5;, + 3;10,4,11;, + 3;6,5,0;, + 3;11,5,6;, + 3;0,2,1;, + 3;0,3,2;, + 3;0,4,3;, + 3;0,5,4;, + 3;7,8,9;, + 3;7,9,10;, + 3;7,10,11;, + 3;7,11,6;, + 3;13,12,14;, + 3;17,13,14;, + 3;16,13,17;, + 3;15,14,12;, + 3;17,14,15;, + 3;15,16,17;, + 3;19,18,20;, + 3;23,19,20;, + 3;22,19,23;, + 3;21,20,18;, + 3;23,20,21;, + 3;21,22,23;; + MeshMaterialList { + 2; + 32; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHARM} + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 64; + 0.861718;0.490078;0.131402;, + 0.864937;-0.484496;0.130951;, + -0.000000;0.000002;-1.000000;, + 0.864723;0.484376;0.132795;, + -0.000012;0.990475;0.137689;, + -0.000000;0.000002;-1.000000;, + -0.000012;0.990475;0.137689;, + -0.861601;0.490013;0.132404;, + -0.000000;0.000002;-1.000000;, + -0.864933;0.484503;0.130952;, + -0.861717;-0.490079;0.131403;, + -0.000001;0.000001;-1.000000;, + -0.864721;-0.484379;0.132795;, + -0.000003;-0.990475;0.137691;, + -0.000001;0.000002;-1.000000;, + -0.000003;-0.990475;0.137691;, + 0.861603;-0.490010;0.132403;, + 0.000001;-0.000002;-1.000000;, + 0.858676;0.495758;0.130003;, + 0.861603;-0.490010;0.132403;, + 0.000001;-0.000000;1.000000;, + 0.861718;0.490078;0.131402;, + -0.000003;0.990475;0.137691;, + -0.000002;-0.000002;1.000000;, + -0.000012;0.990475;0.137689;, + -0.858232;0.495502;0.133849;, + -0.000002;-0.000002;1.000000;, + -0.861601;0.490013;0.132404;, + -0.858676;-0.495757;0.130005;, + -0.000002;-0.000002;1.000000;, + -0.861717;-0.490079;0.131403;, + -0.000000;-0.990475;0.137691;, + -0.000003;0.000000;1.000000;, + -0.000003;-0.990475;0.137691;, + 0.858232;-0.495502;0.133850;, + -0.000002;-0.000000;1.000000;, + 0.000000;-1.000000;0.000001;, + 0.427141;0.000000;0.904185;, + 0.000000;-1.000000;0.000001;, + -0.887737;-0.000002;-0.460352;, + 0.000000;-1.000000;0.000001;, + -0.887737;-0.000002;-0.460352;, + 0.427141;0.000000;0.904185;, + 0.427141;0.000000;0.904185;, + 0.000001;1.000000;0.000000;, + -0.887737;-0.000000;-0.460352;, + 0.000001;1.000000;0.000000;, + -0.887737;-0.000002;-0.460352;, + 0.427141;0.000006;0.904185;, + 0.000001;1.000000;0.000000;, + -0.000001;-1.000000;-0.000001;, + 0.427140;-0.000000;0.904185;, + -0.000001;-1.000000;-0.000001;, + -0.887737;0.000001;-0.460352;, + -0.000001;-1.000000;-0.000001;, + -0.887737;0.000001;-0.460352;, + 0.427140;-0.000000;0.904185;, + 0.427140;-0.000000;0.904185;, + -0.000001;1.000000;-0.000000;, + -0.887737;0.000000;-0.460352;, + -0.000001;1.000000;-0.000000;, + -0.887737;0.000001;-0.460352;, + 0.427140;-0.000003;0.904185;, + -0.000001;1.000000;-0.000000;; + 32; + 3;21,0,3;, + 3;18,0,21;, + 3;24,4,6;, + 3;22,4,24;, + 3;27,7,9;, + 3;25,7,27;, + 3;30,10,12;, + 3;28,10,30;, + 3;33,13,15;, + 3;31,13,33;, + 3;19,16,1;, + 3;34,16,19;, + 3;2,8,5;, + 3;2,11,8;, + 3;2,14,11;, + 3;2,17,14;, + 3;23,26,29;, + 3;23,29,32;, + 3;23,32,35;, + 3;23,35,20;, + 3;38,36,40;, + 3;47,39,41;, + 3;45,39,47;, + 3;43,42,37;, + 3;48,42,43;, + 3;44,46,49;, + 3;52,50,54;, + 3;61,53,55;, + 3;59,53,61;, + 3;57,56,51;, + 3;62,56,57;, + 3;58,60,63;; + } + MeshTextureCoords { + 24; + 0.250000;2.476449;, + 0.081266;2.476449;, + 0.918734;2.476449;, + 0.750000;2.476449;, + 0.581266;2.476449;, + 0.418734;2.476449;, + 0.250000;1.042238;, + 0.083334;1.042238;, + 0.916666;1.042238;, + 0.750000;1.042238;, + 0.583334;1.042238;, + 0.416666;1.042238;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_xL_Hand { + FrameTransformMatrix { + -0.965926, 0.000000, -0.258819, 0.000000, + -0.258819, -0.000000, 0.965925, 0.000000, + 0.000000, 1.000000, 0.000000, 0.000000, + -1.719950, -0.532492, -32.044582, 1.000000;; + } + Mesh xL_Hand { + + 8; + -6.357616; -13.356400; -4.582500;, + 6.642384; -13.356396; -4.582499;, + 3.554882; -0.356400; -2.650548;, + -3.270115; -0.356400; -2.650548;, + -6.357616; -13.356400; 4.582500;, + 6.642384; -13.356396; 4.582499;, + 3.554882; -0.356399; 2.650487;, + -3.270115; -0.356399; 2.650487;; + + 10; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHHAND} + } + MeshNormals { + 20; + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;-0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.972937;0.231073;-0.000000;, + 0.000000;0.146997;-0.989137;, + -0.972937;0.231073;-0.000000;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;, + 0.000000;-1.000000;0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.147002;0.989136;, + 0.972937;0.231073;0.000000;, + 0.000000;0.147002;0.989136;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;; + 10; + 3;0,6,3;, + 3;0,8,6;, + 3;1,13,10;, + 3;1,4,13;, + 3;5,16,14;, + 3;5,7,16;, + 3;9,11,18;, + 3;9,2,11;, + 3;12,17,19;, + 3;12,15,17;; + } + MeshTextureCoords { + 8; + 0.032628;0.773816;, + 0.032628;0.773815;, + 0.231506;-0.195808;, + 0.231506;-0.195808;, + 0.976087;0.773816;, + 0.976087;0.773815;, + 0.777203;-0.195808;, + 0.777203;-0.195808;; + } + } + } + } + } + + Frame x3ds_xHead { + FrameTransformMatrix { + 0.996195, -0.087156, 0.000000, 0.000000, + -0.087156, -0.996195, -0.000000, 0.000000, + 0.000000, 0.000000, -1.000000, 0.000000, + 0.000000, 0.320932, 43.031708, 1.000000;; + } + Mesh xHead { + + 14; + 0.425325; 1.962787; -19.572998;, + 8.670237; -5.947898; -18.382002;, + 11.100914; 4.408364; -18.855011;, + 1.451953; 10.441894; -18.855013;, + -9.223644; 5.996317; -18.855013;, + -8.846230; -4.605626; -18.382004;, + -0.560038; -8.044583; -15.549453;, + 8.843442; -3.382582; -2.678222;, + 11.100921; 4.408369; -3.122056;, + 1.451952; 10.441850; -3.122057;, + -9.223644; 5.996321; -3.121079;, + -8.571328; -2.049199; -2.677742;, + -0.522815; -9.619122; -0.089201;, + 0.425325; -0.037214; 3.679871;; + + 24; + 3;0,2,1;, + 3;0,3,2;, + 3;0,4,3;, + 3;0,5,4;, + 3;0,6,5;, + 3;0,1,6;, + 3;1,8,7;, + 3;1,2,8;, + 3;2,9,8;, + 3;2,3,9;, + 3;3,10,9;, + 3;3,4,10;, + 3;4,11,10;, + 3;4,5,11;, + 3;5,12,11;, + 3;5,6,12;, + 3;6,7,12;, + 3;6,1,7;, + 3;13,11,12;, + 3;13,10,11;, + 3;13,9,10;, + 3;13,8,9;, + 3;13,7,8;, + 3;13,12,7;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01HEAD} + } + MeshNormals { + 60; + 0.081687;-0.064598;-0.994562;, + 0.049012;0.078380;-0.995718;, + -0.036962;0.088760;-0.995367;, + -0.093941;-0.047711;-0.994434;, + 0.153237;-0.381582;-0.911545;, + -0.201835;-0.348186;-0.915439;, + 0.081687;-0.064598;-0.994562;, + -0.201835;-0.348186;-0.915439;, + 0.967436;-0.252527;0.017281;, + 0.263240;-0.952568;0.152705;, + 0.081687;-0.064598;-0.994562;, + 0.049012;0.078380;-0.995718;, + 0.973545;-0.228497;-0.000000;, + 0.530181;0.847885;-0.000000;, + 0.049012;0.078380;-0.995718;, + -0.036962;0.088760;-0.995367;, + 0.530184;0.847883;0.000002;, + -0.384421;0.923158;0.000003;, + -0.036962;0.088760;-0.995367;, + -0.093941;-0.047711;-0.994434;, + -0.384425;0.923156;-0.000000;, + -0.998267;-0.057694;0.011560;, + -0.093941;-0.047711;-0.994434;, + 0.153237;-0.381582;-0.911545;, + -0.999136;-0.034537;0.023112;, + -0.542700;-0.839759;0.016782;, + 0.153237;-0.381582;-0.911545;, + -0.201835;-0.348186;-0.915439;, + -0.354072;-0.930491;-0.093913;, + 0.406709;-0.912942;0.033536;, + 0.960443;-0.276327;0.034547;, + 0.406709;-0.912942;0.033536;, + 0.568127;-0.118223;0.814405;, + 0.465161;-0.363520;0.807142;, + 0.967436;-0.252527;0.017281;, + 0.530181;0.847885;-0.000000;, + 0.310171;0.496038;0.811012;, + 0.568127;-0.118223;0.814405;, + 0.530181;0.847885;-0.000000;, + -0.384421;0.923158;0.000003;, + -0.227200;0.545780;0.806538;, + 0.310171;0.496038;0.811012;, + -0.384421;0.923158;0.000003;, + -0.996729;-0.080813;0.000000;, + -0.576846;-0.001758;0.816851;, + -0.227200;0.545780;0.806538;, + -0.998267;-0.057694;0.011560;, + -0.700901;-0.701945;0.126536;, + -0.514933;-0.269185;0.813870;, + -0.576846;-0.001758;0.816851;, + -0.542700;-0.839759;0.016782;, + 0.535392;-0.840126;-0.086851;, + -0.514933;-0.269185;0.813870;, + 0.465161;-0.363520;0.807142;, + -0.514933;-0.269185;0.813870;, + -0.576846;-0.001758;0.816851;, + -0.227200;0.545780;0.806538;, + 0.310171;0.496038;0.811012;, + 0.568127;-0.118223;0.814405;, + 0.465161;-0.363520;0.807142;; + 24; + 3;0,10,6;, + 3;1,14,11;, + 3;2,18,15;, + 3;3,22,19;, + 3;4,26,23;, + 3;5,7,27;, + 3;8,34,30;, + 3;8,12,34;, + 3;13,38,35;, + 3;13,16,38;, + 3;17,42,39;, + 3;17,20,42;, + 3;21,46,43;, + 3;21,24,46;, + 3;25,50,47;, + 3;25,28,50;, + 3;29,31,51;, + 3;29,9,31;, + 3;54,48,52;, + 3;55,44,49;, + 3;56,40,45;, + 3;57,36,41;, + 3;58,32,37;, + 3;59,53,33;; + } + MeshTextureCoords { + 14; + 0.023465;0.004861;, + 0.658502;0.065512;, + 0.821431;0.041424;, + 0.999136;0.041424;, + 0.180988;0.041424;, + 0.342098;0.065512;, + 0.493676;0.209760;, + 0.695904;0.865226;, + 0.821431;0.842624;, + 0.999136;0.842624;, + 0.180988;0.842657;, + 0.305883;0.865234;, + 0.497409;0.997055;, + 0.480761;1.188995;; + } + } + + Frame x3ds_xSpike01 { + FrameTransformMatrix { + 0.996195, -0.087156, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + -0.087156, -0.996195, -0.000000, 0.000000, + 23.054602, 0.275466, -15.502022, 1.000000;; + } + Mesh xSpike01 { + + 11; + 20.302296; 3.477874; -0.000000;, + 20.272556; 3.517951; -0.047165;, + 20.272556; 3.517951; 0.047166;, + 12.276608; -2.642800; 0.000000;, + 11.329418; -1.366189; -1.502582;, + 11.329418; -1.366188; 1.502582;, + -22.691582; -3.647179; -0.000001;, + -22.691582; -0.615793; -2.957998;, + -22.691582; -0.615791; 2.957999;, + 20.282467; 3.504585; 0.000000;, + -22.691582; -1.626259; 0.000000;; + + 18; + 3;0,9,1;, + 3;1,9,2;, + 3;2,9,0;, + 3;0,4,3;, + 3;0,1,4;, + 3;1,5,4;, + 3;1,2,5;, + 3;2,3,5;, + 3;2,0,3;, + 3;3,7,6;, + 3;3,4,7;, + 3;4,8,7;, + 3;4,5,8;, + 3;5,6,8;, + 3;5,3,6;, + 3;6,7,10;, + 3;7,8,10;, + 3;8,6,10;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 26; + -0.802935;-0.596066;-0.000210;, + -0.416581;0.546239;0.726693;, + -0.416545;0.546192;-0.726749;, + -0.802935;-0.596066;-0.000210;, + -0.416558;0.546177;0.726753;, + 0.479311;-0.877645;0.000000;, + -0.803289;-0.595589;0.000000;, + 0.479311;-0.877645;0.000000;, + -0.416582;0.546239;-0.726693;, + -0.152721;0.683170;0.714112;, + -0.224967;0.667993;-0.709348;, + -0.219854;0.670684;0.708411;, + 0.236642;-0.971597;0.000000;, + 0.236642;-0.971597;0.000000;, + -0.154600;0.681720;-0.715092;, + -0.020056;0.698250;0.715573;, + -0.018467;0.727343;-0.686026;, + 1.000000;0.000000;0.000000;, + -0.015613;0.729119;0.684209;, + -0.022052;-0.999757;0.000000;, + 1.000000;0.000000;0.000000;, + -0.022052;-0.999757;0.000000;, + -0.015212;0.698309;-0.715635;, + 1.000000;0.000000;0.000000;, + -0.802935;-0.596066;-0.000210;, + 1.000000;0.000000;0.000000;; + 18; + 3;0,24,3;, + 3;3,24,6;, + 3;6,24,0;, + 3;1,11,9;, + 3;1,4,11;, + 3;5,13,12;, + 3;5,7,13;, + 3;8,10,14;, + 3;8,2,10;, + 3;9,18,15;, + 3;9,11,18;, + 3;12,21,19;, + 3;12,13,21;, + 3;14,16,22;, + 3;14,10,16;, + 3;17,20,25;, + 3;20,23,25;, + 3;23,17,25;; + } + } + } + + Frame x3ds_Spike02 { + FrameTransformMatrix { + 0.996195, -0.087156, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + -0.087156, -0.996195, -0.000000, 0.000000, + -22.163496, 4.231537, -15.502023, 1.000000;; + } + Mesh Spike02 { + + 11; + -20.302298; 3.477874; -0.000000;, + -20.272558; 3.517951; -0.047165;, + -20.272558; 3.517951; 0.047166;, + -12.276606; -2.642800; 0.000000;, + -11.329420; -1.366189; -1.502582;, + -11.329420; -1.366188; 1.502582;, + 22.691582; -3.647179; -0.000001;, + 22.691582; -0.615793; -2.957998;, + 22.691582; -0.615791; 2.957999;, + -20.282469; 3.504585; 0.000000;, + 22.691582; -1.626259; 0.000000;; + + 18; + 3;9,0,1;, + 3;9,1,2;, + 3;9,2,0;, + 3;4,0,3;, + 3;1,0,4;, + 3;5,1,4;, + 3;2,1,5;, + 3;3,2,5;, + 3;0,2,3;, + 3;7,3,6;, + 3;4,3,7;, + 3;8,4,7;, + 3;5,4,8;, + 3;6,5,8;, + 3;3,5,6;, + 3;7,6,10;, + 3;8,7,10;, + 3;6,8,10;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 26; + 0.802935;-0.596066;-0.000210;, + 0.416581;0.546239;0.726693;, + 0.416545;0.546192;-0.726749;, + 0.802935;-0.596066;-0.000210;, + 0.416558;0.546177;0.726753;, + -0.479311;-0.877645;0.000000;, + 0.803289;-0.595589;-0.000000;, + -0.479311;-0.877645;0.000000;, + 0.416582;0.546239;-0.726693;, + 0.152721;0.683170;0.714111;, + 0.224967;0.667994;-0.709348;, + 0.219854;0.670684;0.708411;, + -0.236642;-0.971597;0.000000;, + -0.236642;-0.971597;0.000000;, + 0.154600;0.681720;-0.715092;, + 0.020056;0.698250;0.715573;, + 0.018467;0.727343;-0.686026;, + -1.000000;0.000000;0.000000;, + 0.015613;0.729119;0.684209;, + 0.022052;-0.999757;0.000000;, + -1.000000;0.000000;0.000000;, + 0.022052;-0.999757;0.000000;, + 0.015212;0.698309;-0.715635;, + -1.000000;0.000000;0.000000;, + 0.802935;-0.596066;-0.000210;, + -1.000000;0.000000;0.000000;; + 18; + 3;24,0,3;, + 3;24,3,6;, + 3;24,6,0;, + 3;11,1,9;, + 3;4,1,11;, + 3;13,5,12;, + 3;7,5,13;, + 3;10,8,14;, + 3;2,8,10;, + 3;18,9,15;, + 3;11,9,18;, + 3;21,12,19;, + 3;13,12,21;, + 3;16,14,22;, + 3;10,14,16;, + 3;20,17,25;, + 3;23,20,25;, + 3;17,23,25;; + } + } + } + } + } + + Frame x3ds_xRU_Leg { + FrameTransformMatrix { + -0.996195, 0.000000, -0.087156, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + 0.087156, -0.000000, -0.996195, 0.000000, + 6.849589, 0.163909, 2.374461, 1.000000;; + } + Mesh xRU_Leg { + + 8; + -11.013890; -7.083223; -1.154131;, + 3.719292; -7.083223; -1.154224;, + 3.719293; 7.083232; -1.154223;, + -11.013890; 7.083232; -1.154134;, + -10.314070; -5.595806; 40.157955;, + 3.019466; -5.595746; 40.157955;, + 3.019406; 5.595754; 40.157948;, + -10.314070; 5.595694; 40.157944;; + + 12; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHLEG} + } + MeshNormals { + 24; + -0.000006;0.000000;-1.000000;, + 0.000005;-0.999352;0.035981;, + -0.999857;0.000000;0.016937;, + -0.000006;0.000000;-1.000000;, + 0.000000;-0.999352;0.035982;, + 0.999857;0.000005;0.016937;, + -0.000006;0.000000;-1.000000;, + 0.999857;-0.000000;0.016939;, + -0.000005;0.999352;0.035982;, + -0.000006;-0.000000;-1.000000;, + 0.000000;0.999352;0.035984;, + -0.999857;0.000000;0.016937;, + 0.000005;-0.999352;0.035981;, + -0.999857;0.000000;0.016937;, + -0.000000;0.000001;1.000000;, + 0.000005;-0.999352;0.035981;, + 0.999857;0.000005;0.016937;, + -0.000000;0.000001;1.000000;, + 0.999857;0.000005;0.016937;, + -0.000005;0.999352;0.035982;, + -0.000000;0.000001;1.000000;, + -0.000005;0.999352;0.035982;, + -0.999857;0.000000;0.016937;, + -0.000000;0.000001;1.000000;; + 12; + 3;0,6,3;, + 3;0,9,6;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,20,23;, + 3;14,17,20;; + } + MeshTextureCoords { + 8; + 0.384951;0.041750;, + 0.616604;0.041750;, + 0.856692;0.041750;, + 0.141781;0.041750;, + 0.384951;0.914882;, + 0.616604;0.914882;, + 0.856692;0.914882;, + 0.141781;0.914882;; + } + } + + Frame x3ds_xRL_Leg { + FrameTransformMatrix { + 0.996195, -0.000000, -0.087156, 0.000000, + -0.087156, -0.000000, -0.996195, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + -3.359494, 0.259708, 38.976967, 1.000000;; + } + Mesh xRL_Leg { + + 26; + 9.229027; -71.518196; -17.699999;, + -10.562513; -71.518204; -17.699999;, + -8.726734; 0.601814; -5.908439;, + 7.393265; 0.601810; -5.908437;, + 11.931103; -75.798187; 11.700004;, + -13.264593; -75.798187; 11.699999;, + -8.726734; 0.601814; 5.908560;, + 7.393263; 0.601810; 5.908562;, + -9.401619; -8.003811; 0.055164;, + -9.401621; -19.983799; 0.055164;, + -21.381618; -5.008812; 0.055162;, + -9.401619; -8.003811; 1.552658;, + -9.401621; -19.983799; 1.552658;, + -21.381618; -5.008812; 1.552657;, + -9.406624; -28.501522; 0.062683;, + -9.406624; -40.501522; 0.062684;, + -21.406624; -25.501520; 0.062688;, + -9.406624; -28.501522; 1.562678;, + -9.406624; -40.501522; 1.562678;, + -21.406624; -25.501520; 1.562676;, + -9.411629; -50.486736; 0.070203;, + -9.411633; -62.506737; 0.070203;, + -21.431629; -47.481735; 0.070202;, + -9.411629; -50.486736; 1.572698;, + -9.411633; -62.506737; 1.572698;, + -21.431629; -47.481735; 1.572697;; + + 30; + 3;2,0,1;, + 3;3,0,2;, + 3;5,0,4;, + 3;1,0,5;, + 3;6,1,5;, + 3;2,1,6;, + 3;7,2,6;, + 3;3,2,7;, + 3;4,3,7;, + 3;0,3,4;, + 3;6,4,7;, + 3;5,4,6;, + 3;8,9,10;, + 3;9,13,10;, + 3;9,12,13;, + 3;10,11,8;, + 3;10,13,11;, + 3;12,11,13;, + 3;14,15,16;, + 3;15,19,16;, + 3;15,18,19;, + 3;16,17,14;, + 3;16,19,17;, + 3;18,17,19;, + 3;20,21,22;, + 3;21,25,22;, + 3;21,24,25;, + 3;22,23,20;, + 3;22,25,23;, + 3;24,23,25;; + MeshMaterialList { + 2; + 30; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHLEG} + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 66; + -0.000000;0.161357;-0.986896;, + 0.000000;-0.989569;-0.144059;, + 0.995537;0.039363;-0.085767;, + -0.000000;0.161357;-0.986896;, + 0.000000;-0.989569;-0.144059;, + -0.998354;0.039138;-0.041929;, + -0.000000;0.161357;-0.986896;, + -0.999676;0.025446;0.000000;, + 0.000000;1.000000;0.000000;, + 0.000000;0.161357;-0.986896;, + 0.000000;1.000000;0.000000;, + 0.997858;0.049375;-0.042925;, + 0.000000;-0.989569;-0.144059;, + 0.997858;0.049375;-0.042925;, + -0.000000;0.075587;0.997139;, + 0.000000;-0.989569;-0.144059;, + -0.995087;0.052754;-0.083776;, + -0.000000;0.075587;0.997139;, + -0.998354;0.039138;-0.041929;, + 0.000000;1.000000;0.000000;, + -0.000000;0.075587;0.997139;, + 0.000000;1.000000;0.000000;, + 0.998241;0.059291;0.000000;, + -0.000000;0.075587;0.997139;, + 0.000000;0.000000;-1.000000;, + 0.242536;0.970143;-0.000000;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970143;-0.000000;, + 0.242536;0.970143;-0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970143;0.000000;, + -0.000000;0.000000;1.000000;, + -0.000000;-0.000000;-1.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;-0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + -0.000000;-0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970142;0.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;, + -0.780869;-0.624695;0.000000;, + -0.000000;-0.000000;1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + 0.242536;0.970142;0.000000;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000001;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000001;, + 0.242536;0.970142;0.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;-0.000001;, + 0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;; + 30; + 3;6,0,3;, + 3;9,0,6;, + 3;15,1,12;, + 3;4,1,15;, + 3;18,5,16;, + 3;7,5,18;, + 3;21,8,19;, + 3;10,8,21;, + 3;13,11,22;, + 3;2,11,13;, + 3;20,14,23;, + 3;17,14,20;, + 3;24,26,28;, + 3;27,35,29;, + 3;27,33,35;, + 3;30,31,25;, + 3;30,36,31;, + 3;34,32,37;, + 3;38,40,42;, + 3;41,49,43;, + 3;41,47,49;, + 3;44,45,39;, + 3;44,50,45;, + 3;48,46,51;, + 3;52,54,56;, + 3;55,63,57;, + 3;55,61,63;, + 3;58,59,53;, + 3;58,64,59;, + 3;62,60,65;; + } + MeshTextureCoords { + 26; + 0.424682;0.899973;, + 0.582679;0.899974;, + 0.647431;0.013392;, + 0.363113;0.013392;, + 0.131246;0.952588;, + 0.861902;0.952588;, + 0.838511;0.013392;, + 0.151531;0.013392;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_xR_Foot { + FrameTransformMatrix { + -0.000000, 0.000000, 1.000000, 0.000000, + -0.000000, 1.000000, -0.000000, 0.000000, + -1.000000, -0.000000, -0.000000, 0.000000, + -0.849463, -62.299637, -2.502151, 1.000000;; + } + Mesh xR_Foot { + + 8; + -37.191723; -17.003931; 4.286171;, + 7.580331; -17.003948; 6.445354;, + 5.179023; -0.329530; 4.340307;, + -27.147438; -7.877935; 1.341817;, + -37.191738; -17.003931; -4.286145;, + 7.580253; -17.003933; -6.445303;, + 5.179095; -0.329522; -4.340269;, + -27.147472; -7.877943; -1.341796;; + + 10; + 3;2,0,1;, + 3;3,0,2;, + 3;5,0,4;, + 3;1,0,5;, + 3;7,2,6;, + 3;3,2,7;, + 3;4,3,7;, + 3;0,3,4;, + 3;6,4,7;, + 3;5,4,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 20; + -0.123025;0.309552;0.942890;, + -0.000000;-1.000000;0.000000;, + -0.672464;0.740130;0.000001;, + -0.047832;0.118323;0.991822;, + -0.000000;-1.000000;-0.000001;, + -0.123025;0.309552;0.942890;, + -0.227388;0.973804;-0.000001;, + -0.192728;0.486970;0.851890;, + -0.227389;0.973804;0.000000;, + -0.672466;0.740128;0.000006;, + -0.000000;-1.000000;0.000000;, + -0.672466;0.740128;0.000006;, + -0.123024;0.309551;-0.942891;, + -0.000000;-1.000000;0.000000;, + -0.047831;0.118323;-0.991822;, + -0.227388;0.973804;-0.000001;, + -0.123024;0.309551;-0.942891;, + -0.227388;0.973804;-0.000001;, + -0.672466;0.740128;0.000006;, + -0.192727;0.486968;-0.851891;; + 10; + 3;5,0,3;, + 3;7,0,5;, + 3;13,1,10;, + 3;4,1,13;, + 3;17,6,15;, + 3;8,6,17;, + 3;11,9,18;, + 3;2,9,11;, + 3;16,12,19;, + 3;14,12,16;; + } + } + } + } + } + + Frame x3ds_xLU_Leg { + FrameTransformMatrix { + -0.996195, 0.000000, 0.087156, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + -0.087156, -0.000000, -0.996195, 0.000000, + -5.995696, 0.163911, 2.695590, 1.000000;; + } + Mesh xLU_Leg { + + 8; + -2.905127; -7.083223; -0.791073;, + 11.828092; -7.083163; -0.790935;, + 11.828092; 7.083232; -0.790933;, + -2.905124; 7.083232; -0.791067;, + -2.205291; -5.595747; 40.521160;, + 11.128267; -5.595746; 40.521164;, + 11.128268; 5.595754; 40.521152;, + -2.205273; 5.595753; 40.521152;; + + 12; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHLEG} + } + MeshNormals { + 24; + 0.000009;0.000000;-1.000000;, + 0.000000;-0.999352;0.035982;, + -0.999857;0.000000;0.016938;, + 0.000009;0.000000;-1.000000;, + 0.000004;-0.999352;0.035981;, + 0.999857;-0.000000;0.016938;, + 0.000009;0.000000;-1.000000;, + 0.999857;-0.000000;0.016937;, + -0.000000;0.999352;0.035983;, + 0.000009;0.000000;-1.000000;, + -0.000000;0.999352;0.035982;, + -0.999857;0.000002;0.016938;, + 0.000000;-0.999352;0.035982;, + -0.999857;0.000002;0.016938;, + -0.000000;0.000001;1.000000;, + 0.000000;-0.999352;0.035982;, + 0.999857;-0.000000;0.016938;, + -0.000000;0.000001;1.000000;, + 0.999857;-0.000000;0.016938;, + -0.000000;0.999352;0.035983;, + -0.000000;0.000001;1.000000;, + -0.000000;0.999352;0.035983;, + -0.999857;0.000002;0.016938;, + -0.000000;0.000001;1.000000;; + 12; + 3;0,6,3;, + 3;0,9,6;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,20,23;, + 3;14,17,20;; + } + MeshTextureCoords { + 8; + 0.384951;0.041750;, + 0.616604;0.041750;, + 0.856692;0.041750;, + 0.141781;0.041750;, + 0.384951;0.914882;, + 0.616604;0.914882;, + 0.856692;0.914882;, + 0.141781;0.914882;; + } + } + + Frame x3ds_xLL_Leg { + FrameTransformMatrix { + 0.996195, 0.000000, 0.087156, 0.000000, + 0.087156, -0.000000, -0.996195, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + 3.943336, 0.259716, 39.672768, 1.000000;; + } + Mesh xLL_Leg { + + 26; + -9.017391; -71.197044; -17.699999;, + 10.774149; -71.197052; -17.699999;, + 8.938375; 0.922958; -5.908498;, + -7.181622; 0.922955; -5.908498;, + -11.719472; -75.477051; 11.700000;, + 13.476221; -75.477051; 11.700000;, + 8.938375; 0.922958; 5.908501;, + -7.181622; 0.922955; 5.908501;, + 9.618265; -7.680378; 0.062687;, + 9.618269; -19.680382; 0.062687;, + 21.618265; -4.680378; 0.062687;, + 9.618265; -7.680378; 1.562681;, + 9.618269; -19.680382; 1.562681;, + 21.618265; -4.680378; 1.562681;, + 9.618265; -28.180374; 0.062689;, + 9.618265; -40.180374; 0.062689;, + 21.618265; -25.180378; 0.062694;, + 9.618265; -28.180374; 1.562683;, + 9.618265; -40.180374; 1.562683;, + 21.618265; -25.180378; 1.562684;, + 9.618269; -50.180374; 0.062691;, + 9.618265; -62.180374; 0.062691;, + 21.618269; -47.180374; 0.062691;, + 9.618269; -50.180374; 1.562685;, + 9.618265; -62.180374; 1.562685;, + 21.618269; -47.180374; 1.562685;; + + 30; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;, + 3;9,8,10;, + 3;13,9,10;, + 3;12,9,13;, + 3;11,10,8;, + 3;13,10,11;, + 3;11,12,13;, + 3;15,14,16;, + 3;19,15,16;, + 3;18,15,19;, + 3;17,16,14;, + 3;19,16,17;, + 3;17,18,19;, + 3;21,20,22;, + 3;25,21,22;, + 3;24,21,25;, + 3;23,22,20;, + 3;25,22,23;, + 3;23,24,25;; + MeshMaterialList { + 2; + 30; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHLEG} + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 66; + 0.000000;0.161356;-0.986896;, + -0.000000;-0.989569;-0.144060;, + -0.995537;0.039364;-0.085767;, + 0.000000;0.161356;-0.986896;, + -0.000000;-0.989569;-0.144060;, + 0.998354;0.039138;-0.041929;, + 0.000000;0.161356;-0.986896;, + 0.999676;0.025446;0.000000;, + -0.000000;1.000000;0.000000;, + -0.000000;0.161356;-0.986896;, + -0.000000;1.000000;0.000000;, + -0.997857;0.049375;-0.042925;, + -0.000000;-0.989569;-0.144060;, + -0.997857;0.049375;-0.042925;, + -0.000000;0.075588;0.997139;, + -0.000000;-0.989569;-0.144060;, + 0.995087;0.052753;-0.083776;, + 0.000000;0.075588;0.997139;, + 0.998354;0.039138;-0.041929;, + -0.000000;1.000000;0.000000;, + -0.000000;0.075588;0.997139;, + -0.000000;1.000000;0.000000;, + -0.998241;0.059291;0.000000;, + -0.000000;0.075588;0.997139;, + 0.000000;0.000000;-1.000000;, + -0.242536;0.970142;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + -0.242535;0.970143;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242535;0.970143;0.000000;, + -0.242535;0.970143;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242535;0.970143;0.000000;, + -0.000000;0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + -0.242536;0.970142;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.000000;-0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;; + 30; + 3;0,6,3;, + 3;0,9,6;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,20,23;, + 3;14,17,20;, + 3;26,24,28;, + 3;35,27,29;, + 3;33,27,35;, + 3;31,30,25;, + 3;36,30,31;, + 3;32,34,37;, + 3;40,38,42;, + 3;49,41,43;, + 3;47,41,49;, + 3;45,44,39;, + 3;50,44,45;, + 3;46,48,51;, + 3;54,52,56;, + 3;63,55,57;, + 3;61,55,63;, + 3;59,58,53;, + 3;64,58,59;, + 3;60,62,65;; + } + MeshTextureCoords { + 26; + 0.424682;0.899973;, + 0.582679;0.899974;, + 0.647431;0.013392;, + 0.363113;0.013392;, + 0.131246;0.952588;, + 0.861902;0.952588;, + 0.838511;0.013392;, + 0.151531;0.013392;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_xL_Foot { + FrameTransformMatrix { + -0.000000, 0.000000, 1.000000, 0.000000, + -0.000000, 1.000000, -0.000000, 0.000000, + -1.000000, -0.000000, -0.000000, 0.000000, + 1.061086, -63.263023, -2.697744, 1.000000;; + } + Mesh xL_Foot { + + 8; + -36.996124; -15.719404; -4.210043;, + 7.775687; -15.719419; -6.330903;, + 5.374388; 0.954521; -4.263234;, + -26.951843; -6.593406; -1.317977;, + -36.995773; -15.719404; 4.210084;, + 7.775620; -15.719404; 6.330931;, + 5.374463; 0.954529; 4.263263;, + -26.951632; -6.593413; 1.317985;; + + 10; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_REDPLASTIC} + } + MeshNormals { + 20; + -0.121241;0.305074;-0.944580;, + 0.000000;-1.000000;0.000000;, + -0.672469;0.740125;0.000028;, + -0.046996;0.116259;-0.992106;, + -0.000000;-1.000000;0.000001;, + -0.121241;0.305074;-0.944580;, + -0.227378;0.973807;0.000001;, + -0.190220;0.480642;-0.856037;, + -0.227375;0.973807;0.000021;, + -0.672460;0.740133;0.000056;, + 0.000000;-1.000000;0.000000;, + -0.672460;0.740133;0.000056;, + -0.121242;0.305075;0.944579;, + 0.000000;-1.000000;0.000000;, + -0.046997;0.116259;0.992106;, + -0.227378;0.973807;0.000001;, + -0.121242;0.305075;0.944579;, + -0.227378;0.973807;0.000001;, + -0.672460;0.740133;0.000056;, + -0.190222;0.480644;0.856035;; + 10; + 3;0,5,3;, + 3;0,7,5;, + 3;1,13,10;, + 3;1,4,13;, + 3;6,17,15;, + 3;6,8,17;, + 3;9,11,18;, + 3;9,2,11;, + 3;12,16,19;, + 3;12,14,16;; + } + } + } + } + } +} +AnimationSet x3ds_animset_0 { + Animation x3ds_anim_0 { + {x3ds_xGroin} + AnimationKey { + 0; + 9; + 0; 4; -0.000000, -0.000000, -0.707107, -0.707107;;, + 77; 4; -0.000000, -0.000000, -0.707107, -0.707107;;, + 85; 4; -0.000000, -0.000000, -0.675590, -0.737277;;, + 93; 4; -0.000000, -0.000000, -0.707107, -0.707107;;, + 115; 4; 0.000000, -0.000000, 0.000000, -1.000000;;, + 135; 4; 0.000000, -0.000000, 0.000000, -1.000000;;, + 160; 4; -0.000000, -0.000000, -0.707107, -0.707107;;, + 161; 4; -0.000000, -0.000000, -0.707107, -0.707107;;, + 216; 4; -0.000000, -0.000000, -0.707107, -0.707107;;; + } + AnimationKey { + 1; + 5; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 93; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 29; + 0; 3; 0.000000, 35.534382, 1.024473;;, + 1; 3; 0.000000, 23.889210, 1.024473;;, + 15; 3; 0.000000, 18.884680, 2.903347;;, + 30; 3; 0.000000, 23.889210, 1.024473;;, + 33; 3; 0.000000, 23.889210, 1.024473;;, + 43; 3; 0.000000, 20.962900, 1.024473;;, + 52; 3; 0.000000, 25.059750, 1.024473;;, + 61; 3; 0.000000, 23.518040, 5.044694;;, + 68; 3; 0.000000, 18.818790, 12.939010;;, + 76; 3; 0.000000, 23.518040, 5.044694;;, + 77; 3; 0.000000, 23.518040, 5.044694;;, + 93; 3; 0.000000, 23.518040, 5.044694;;, + 100; 3; 0.000000, 29.812460, 75.539871;;, + 104; 3; 0.000000, 19.677170, 97.369331;;, + 115; 3; 0.000000, -67.336800, 139.859100;;, + 135; 3; 0.000000, -67.336998, 139.859100;;, + 145; 3; 0.000000, -13.702706, 104.629173;;, + 146; 3; 0.000000, -12.018229, 99.536301;;, + 160; 3; 0.000000, 23.518040, 5.044694;;, + 161; 3; 0.000000, 23.518040, 5.044694;;, + 175; 3; 0.000000, 33.713287, -37.066116;;, + 178; 3; 0.000000, 24.016308, -39.583458;;, + 181; 3; 0.000000, 33.713287, -37.066116;;, + 184; 3; 0.000000, 24.016308, -39.583458;;, + 187; 3; 0.000000, 33.713287, -37.066116;;, + 190; 3; 0.000000, 24.016308, -39.583458;;, + 193; 3; 0.000000, 33.713287, -37.066116;;, + 207; 3; 0.000000, 33.713287, -37.066116;;, + 216; 3; 0.000000, 23.518040, 5.044694;;; + } + } + + Animation x3ds_anim_1 { + {x3ds_xChest} + AnimationKey { + 0; + 23; + 0; 4; 0.000000, -0.000000, -0.000000, -1.000000;;, + 1; 4; 0.258819, 0.000000, -0.000000, -0.965926;;, + 15; 4; 0.317305, 0.000000, -0.000000, -0.948324;;, + 30; 4; 0.258819, 0.000000, -0.000000, -0.965926;;, + 31; 4; 0.258819, 0.000000, -0.000000, -0.965926;;, + 43; 4; -0.095846, -0.000000, -0.000000, -0.995396;;, + 52; 4; 0.442381, 0.058240, 0.116812, -0.887278;;, + 61; 4; 0.258819, -0.000000, -0.000000, -0.965926;;, + 68; 4; 0.332019, -0.072538, -0.264839, -0.902420;;, + 76; 4; 0.258819, -0.000000, -0.000001, -0.965926;;, + 77; 4; 0.258819, -0.000000, -0.000001, -0.965926;;, + 85; 4; 0.535255, 0.003802, -0.087074, -0.840182;;, + 93; 4; 0.258819, -0.000000, -0.000001, -0.965926;;, + 95; 4; 0.221903, -0.017679, -0.071612, -0.972275;;, + 102; 4; 0.122182, -0.024167, -0.140528, -0.982212;;, + 115; 4; -0.000001, 0.000000, -0.000000, -1.000000;;, + 135; 4; -0.000001, -0.000000, 0.529919, -0.848048;;, + 139; 4; 0.030693, 0.002685, 0.581681, -0.812834;;, + 160; 4; 0.258820, -0.000000, -0.000000, -0.965926;;, + 161; 4; 0.258820, -0.000000, -0.000001, -0.965926;;, + 175; 4; -0.017452, -0.000000, -0.000000, -0.999848;;, + 207; 4; -0.017452, -0.000000, -0.000000, -0.999848;;, + 216; 4; 0.258820, -0.000000, -0.000001, -0.965926;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 0.426950, -1.024470, 11.366163;;, + 77; 3; 0.426950, -1.024470, 11.366163;;, + 115; 3; 0.426950, -1.024470, 11.366163;;, + 135; 3; 0.426950, -1.024470, 11.366163;;; + } + } + + Animation x3ds_anim_2 { + {x3ds_xRU_Arm} + AnimationKey { + 0; + 30; + 0; 4; -0.000000, 0.130526, 0.000000, -0.991445;;, + 1; 4; -0.065263, 0.113039, 0.495722, -0.858616;;, + 15; 4; -0.056193, 0.117811, 0.426828, -0.894864;;, + 30; 4; -0.065263, 0.113039, 0.495723, -0.858616;;, + 31; 4; -0.065263, 0.113039, 0.495723, -0.858616;;, + 43; 4; 0.053090, 0.119242, -0.403256, -0.905730;;, + 52; 4; -0.220806, -0.041267, 0.855768, -0.466049;;, + 61; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 68; 4; -0.025312, 0.111794, -0.475054, -0.872459;;, + 76; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 77; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 85; 4; 0.133832, 0.353720, 0.308203, -0.872916;;, + 93; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 96; 4; -0.200990, -0.200282, 0.412420, -0.865679;;, + 97; 4; -0.132674, -0.082403, 0.416033, -0.895837;;, + 98; 4; -0.201870, -0.265437, 0.361052, -0.870881;;, + 99; 4; -0.134623, -0.131057, 0.365286, -0.911739;;, + 100; 4; -0.228976, -0.420777, 0.283694, -0.830683;;, + 115; 4; -0.000001, -0.398748, 0.000001, -0.917061;;, + 135; 4; -0.078327, -0.125349, -0.524098, -0.838734;;, + 139; 4; -0.071913, -0.092789, -0.291009, -0.949491;;, + 160; 4; -0.065263, 0.113040, 0.495724, -0.858616;;, + 161; 4; -0.065263, 0.113040, 0.495724, -0.858616;;, + 175; 4; -0.165429, -0.450070, 0.634668, -0.606026;;, + 178; 4; -0.307408, -0.362634, 0.387903, -0.789638;;, + 182; 4; -0.174187, -0.394643, 0.618206, -0.657068;;, + 185; 4; -0.280338, -0.279007, 0.343836, -0.851671;;, + 188; 4; -0.185051, -0.307103, 0.545153, -0.757794;;, + 192; 4; -0.218786, -0.219812, 0.386801, -0.868447;;, + 216; 4; -0.065264, 0.113036, 0.495726, -0.858615;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -22.158115, 0.000001, 34.682266;;, + 77; 3; -22.158115, 0.000001, 34.682266;;, + 115; 3; -22.158115, 0.000001, 34.682266;;, + 135; 3; -22.158115, 0.000001, 34.682266;;; + } + } + + Animation x3ds_anim_3 { + {x3ds_xRL_Arm} + AnimationKey { + 0; + 26; + 0; 4; 1.000000, 0.000000, -0.000000, -0.000000;;, + 1; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 15; 4; 0.909961, 0.414693, -0.000000, -0.000000;;, + 30; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 31; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 43; 4; 0.622515, 0.782608, 0.000000, -0.000000;;, + 52; 4; 0.998630, 0.052336, -0.000000, -0.000000;;, + 61; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 68; 4; 0.987688, 0.156435, -0.000000, -0.000000;;, + 76; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 77; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 85; 4; 0.673714, 0.675106, -0.106243, 0.281164;;, + 93; 4; 0.866025, 0.500000, 0.000000, -0.000000;;, + 96; 4; 0.846469, 0.531913, 0.010984, -0.020921;;, + 115; 4; 1.000000, -0.000001, -0.000000, 0.000000;;, + 135; 4; 0.913546, 0.406736, -0.000000, 0.000000;;, + 139; 4; 0.981076, 0.193621, -0.000000, -0.000000;;, + 160; 4; 0.866026, 0.499999, -0.000000, 0.000000;;, + 161; 4; 0.866026, 0.499999, -0.000000, 0.000000;;, + 175; 4; 0.898794, 0.438370, -0.000000, 0.000000;;, + 178; 4; 0.668687, 0.743544, -0.000000, 0.000000;;, + 182; 4; 0.826796, 0.562503, -0.000000, 0.000000;;, + 185; 4; 0.651408, 0.758727, -0.000000, 0.000000;;, + 188; 4; 0.705617, 0.708593, -0.000000, 0.000000;;, + 192; 4; 0.616021, 0.787730, -0.000000, 0.000000;;, + 216; 4; 0.866010, 0.500027, -0.000000, 0.000000;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 13.822151, 0.000000, -20.565975;;, + 77; 3; 13.822151, 0.000000, -20.565975;;, + 115; 3; 13.822151, 0.000000, -20.565975;;, + 135; 3; 13.822151, 0.000000, -20.565975;;; + } + } + + Animation x3ds_anim_4 { + {x3ds_xR_Hand} + AnimationKey { + 0; + 11; + 0; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 52; 4; 0.085633, 0.098509, -0.650446, -0.748253;;, + 68; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 77; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 85; 4; 0.095461, 0.089019, -0.725097, -0.676164;;, + 93; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 115; 4; 0.092296, 0.092296, -0.701057, -0.701058;;, + 135; 4; 0.092296, 0.092296, -0.701057, -0.701058;;, + 160; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 161; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 216; 4; 0.083025, 0.100717, -0.630637, -0.765023;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 17.201632, -0.532498, -26.974579;;, + 77; 3; 17.201632, -0.532498, -26.974579;;, + 115; 3; 17.201632, -0.532498, -26.974579;;, + 135; 3; 17.201632, -0.532498, -26.974579;;; + } + } + + Animation x3ds_anim_5 { + {x3ds_xLU_Arm} + AnimationKey { + 0; + 31; + 0; 4; -0.000000, 0.130526, 0.000000, -0.991445;;, + 1; 4; -0.017037, 0.129409, 0.129410, -0.982963;;, + 15; 4; -0.027138, 0.127674, 0.206133, -0.969779;;, + 30; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 31; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 43; 4; -0.326088, 0.265924, 0.458283, -0.782897;;, + 52; 4; 0.023797, -0.004380, -0.508650, -0.860633;;, + 61; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 68; 4; 0.039250, 0.124485, -0.298134, -0.945558;;, + 76; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 77; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 85; 4; 0.014321, -0.216242, 0.302516, -0.928180;;, + 93; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 96; 4; 0.012473, 0.472295, 0.098587, -0.875821;;, + 97; 4; -0.005733, 0.314325, 0.091301, -0.944897;;, + 98; 4; 0.002467, 0.403792, 0.085230, -0.910869;;, + 99; 4; -0.005563, 0.316457, 0.079674, -0.945239;;, + 100; 4; 0.010565, 0.509467, 0.073742, -0.857260;;, + 115; 4; -0.000001, 0.566409, -0.000008, -0.824124;;, + 135; 4; 0.176893, 0.283087, -0.499530, -0.799400;;, + 139; 4; 0.283098, 0.024951, -0.406064, -0.868531;;, + 160; 4; -0.017038, 0.129412, 0.129402, -0.982964;;, + 161; 4; -0.017038, 0.129412, 0.129403, -0.982964;;, + 175; 4; 0.405692, 0.534219, 0.553941, -0.493126;;, + 178; 4; 0.585778, 0.368487, 0.379184, -0.614249;;, + 182; 4; 0.448058, 0.532485, 0.549044, -0.462877;;, + 185; 4; 0.592036, 0.367183, 0.377829, -0.609849;;, + 188; 4; 0.502752, 0.483163, 0.496528, -0.516967;;, + 192; 4; 0.598794, 0.362383, 0.372267, -0.609543;;, + 207; 4; 0.476089, 0.472560, 0.479925, -0.565420;;, + 216; 4; -0.017039, 0.129409, 0.129408, -0.982964;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 22.800381, -0.000005, 34.682266;;, + 77; 3; 22.800381, -0.000005, 34.682266;;, + 115; 3; 22.800381, -0.000005, 34.682266;;, + 135; 3; 22.800381, -0.000005, 34.682266;;; + } + } + + Animation x3ds_anim_6 { + {x3ds_xLL_Arm} + AnimationKey { + 0; + 26; + 0; 4; 1.000000, 0.000000, -0.000000, -0.000000;;, + 1; 4; 0.819152, 0.573576, -0.000000, -0.000000;;, + 15; 4; 0.848048, 0.529919, -0.000000, -0.000000;;, + 30; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 31; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 43; 4; 0.737277, 0.675591, -0.000000, -0.000000;;, + 52; 4; 0.642787, 0.766045, 0.000000, -0.000000;;, + 61; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 68; 4; 0.939693, 0.342020, -0.000000, -0.000000;;, + 76; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 77; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 85; 4; 0.441186, 0.831001, 0.214867, -0.261961;;, + 93; 4; 0.819152, 0.573576, -0.000000, 0.000000;;, + 96; 4; 0.932169, 0.360972, -0.014558, 0.023425;;, + 115; 4; 1.000000, -0.000000, -0.000000, -0.000000;;, + 135; 4; 0.874620, 0.484809, -0.000000, -0.000000;;, + 139; 4; 0.980002, 0.198988, -0.000000, -0.000000;;, + 160; 4; 0.819152, 0.573576, -0.000000, 0.000000;;, + 161; 4; 0.819152, 0.573577, -0.000000, 0.000000;;, + 175; 4; 0.902585, 0.430511, -0.000000, 0.000000;;, + 178; 4; 0.674571, 0.738210, -0.000000, 0.000000;;, + 182; 4; 0.836374, 0.548160, -0.000000, 0.000000;;, + 185; 4; 0.666576, 0.745437, -0.000000, 0.000000;;, + 188; 4; 0.756143, 0.654407, -0.000000, 0.000000;;, + 192; 4; 0.686772, 0.726874, -0.000000, 0.000000;;, + 216; 4; 0.819140, 0.573595, -0.000000, 0.000000;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -0.446586, 0.000001, -24.389267;;, + 77; 3; -0.446586, 0.000001, -24.389267;;, + 115; 3; -0.446586, 0.000001, -24.389267;;, + 135; 3; -0.446586, 0.000001, -24.389267;;; + } + } + + Animation x3ds_anim_7 { + {x3ds_xL_Hand} + AnimationKey { + 0; + 10; + 0; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 68; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 77; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 85; 4; 0.099989, 0.083901, -0.759491, -0.637289;;, + 93; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 115; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 135; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 160; 4; 0.088182, 0.096234, -0.669811, -0.730970;;, + 161; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 216; 4; 0.088182, 0.096234, -0.669810, -0.730970;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -1.719951, -0.532492, -32.044598;;, + 77; 3; -1.719951, -0.532492, -32.044598;;, + 115; 3; -1.719951, -0.532492, -32.044598;;, + 135; 3; -1.719951, -0.532492, -32.044598;;; + } + } + + Animation x3ds_anim_8 { + {x3ds_xHead} + AnimationKey { + 0; + 26; + 0; 4; -0.000000, -0.999048, 0.043619, -0.000000;;, + 6; 4; -0.000000, -0.997564, -0.069756, -0.000000;;, + 15; 4; -0.000000, -0.999657, -0.026177, -0.000000;;, + 26; 4; -0.000000, -0.999391, 0.034899, -0.000000;;, + 52; 4; 0.057153, -0.973623, -0.220877, -0.002109;;, + 61; 4; -0.000000, -0.999391, 0.034900, -0.000000;;, + 68; 4; -0.328848, -0.929469, 0.165640, 0.022582;;, + 76; 4; -0.000000, -0.999391, 0.034900, -0.000000;;, + 77; 4; -0.000000, -0.999391, 0.034900, -0.000000;;, + 85; 4; 0.130447, -0.990841, 0.034601, 0.004555;;, + 93; 4; 0.000000, -0.999391, 0.034900, -0.000000;;, + 115; 4; -0.000000, -0.999048, 0.043621, -0.000000;;, + 135; 4; -0.000000, -0.999048, 0.043621, -0.000000;;, + 175; 4; -0.000000, -0.999048, 0.043621, -0.000000;;, + 177; 4; 0.121753, -0.991602, 0.043296, 0.005316;;, + 179; 4; -0.017436, -0.998896, 0.043614, -0.000761;;, + 181; 4; 0.139040, -0.989326, 0.043196, 0.006071;;, + 183; 4; -0.034867, -0.998440, 0.043594, -0.001522;;, + 185; 4; 0.121752, -0.991602, 0.043296, 0.005316;;, + 187; 4; -0.026153, -0.998706, 0.043606, -0.001142;;, + 189; 4; 0.142432, -0.972455, -0.180232, 0.039500;;, + 191; 4; -0.109249, -0.975409, -0.173314, -0.081269;;, + 193; 4; 0.130401, -0.990501, 0.043248, 0.005694;;, + 195; 4; -0.043578, -0.998097, 0.043579, -0.001903;;, + 197; 4; 0.173153, -0.983648, 0.043642, 0.023447;;, + 199; 4; -0.065922, -0.988029, 0.137452, 0.023655;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 8; + 0; 3; 0.000000, 0.320922, 43.031700;;, + 93; 3; 0.000000, 0.320922, 43.031700;;, + 115; 3; 0.000000, 0.320922, 43.031700;;, + 135; 3; 0.000000, 0.320922, 43.031700;;, + 160; 3; 0.000000, 0.320922, 43.031700;;, + 161; 3; 0.000000, 0.320922, 43.031700;;, + 175; 3; 0.000000, 0.320922, 43.031700;;, + 216; 3; 0.000000, 0.320922, 43.031700;;; + } + } + + Animation x3ds_anim_9 { + {x3ds_xSpike01} + AnimationKey { + 0; + 6; + 0; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 77; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 93; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 115; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 135; 4; 0.706433, -0.706434, 0.030844, 0.030844;;, + 175; 4; 0.706433, -0.706434, 0.030844, 0.030844;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 23.054602, 0.275461, -15.502029;;, + 77; 3; 23.054602, 0.275461, -15.502029;;, + 115; 3; 23.054602, 0.275461, -15.502029;;, + 135; 3; 23.054602, 0.275461, -15.502029;;; + } + } + + Animation x3ds_anim_10 { + {x3ds_Spike02} + AnimationKey { + 0; + 6; + 0; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 77; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 93; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 115; 4; 0.706434, -0.706434, 0.030844, 0.030844;;, + 135; 4; 0.706433, -0.706434, 0.030844, 0.030844;;, + 175; 4; 0.706433, -0.706434, 0.030844, 0.030844;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -22.163496, 4.231531, -15.502030;;, + 77; 3; -22.163496, 4.231531, -15.502030;;, + 115; 3; -22.163496, 4.231531, -15.502030;;, + 135; 3; -22.163496, 4.231531, -15.502030;;; + } + } + + Animation x3ds_anim_11 { + {x3ds_xRU_Leg} + AnimationKey { + 0; + 30; + 0; 4; 0.043619, -0.000000, -0.999048, 0.000000;;, + 1; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 21; 4; 0.124791, -0.009789, -0.874977, 0.467703;;, + 30; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 37; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 43; 4; 0.125169, 0.001125, -0.912411, 0.389664;;, + 52; 4; 0.125097, 0.004401, -0.922298, 0.365647;;, + 61; 4; 0.124939, 0.007674, -0.931554, 0.341379;;, + 68; 4; 0.125154, 0.002217, -0.915776, 0.381687;;, + 76; 4; 0.124939, 0.007674, -0.931554, 0.341379;;, + 77; 4; 0.124939, 0.007674, -0.931554, 0.341379;;, + 85; 4; 0.124485, 0.013117, -0.945558, 0.300420;;, + 93; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 100; 4; 0.240075, 0.038409, -0.943098, 0.226838;;, + 115; 4; 0.250380, -0.000000, -0.968148, -0.000000;;, + 135; 4; 0.250380, -0.000000, -0.968148, -0.000000;;, + 139; 4; 0.230082, -0.060758, -0.927524, 0.288220;;, + 146; 4; 0.215704, -0.060817, -0.923441, 0.311497;;, + 150; 4; 0.209892, -0.016602, -0.963089, 0.167717;;, + 160; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 161; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 175; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 178; 4; 0.124460, 0.013347, -0.946112, 0.298672;;, + 181; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 184; 4; 0.124460, 0.013347, -0.946112, 0.298672;;, + 187; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 190; 4; 0.124460, 0.013347, -0.946112, 0.298672;;, + 193; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 207; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 216; 4; 0.124939, 0.007674, -0.931554, 0.341378;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 6.849594, 0.163909, 2.374462;;, + 77; 3; 6.849594, 0.163909, 2.374462;;, + 115; 3; 6.849594, 0.163909, 2.374462;;, + 135; 3; 6.849594, 0.163909, 2.374462;;; + } + } + + Animation x3ds_anim_12 { + {x3ds_xRL_Leg} + AnimationKey { + 0; + 30; + 0; 4; 0.706434, 0.706434, -0.030844, -0.030844;;, + 1; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 11; 4; 0.438280, 0.897779, -0.019136, -0.039198;;, + 21; 4; 0.422215, 0.905446, -0.018434, -0.039533;;, + 26; 4; 0.439586, 0.897141, -0.019193, -0.039170;;, + 30; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 37; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 43; 4; 0.484348, 0.873787, -0.021147, -0.038150;;, + 52; 4; 0.499524, 0.865201, -0.021810, -0.037775;;, + 61; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 68; 4; 0.573030, 0.818373, -0.025019, -0.035731;;, + 76; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 77; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 93; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 115; 4; 0.706434, 0.706434, -0.030844, -0.030844;;, + 135; 4; 0.706434, 0.706434, -0.030844, -0.030844;;, + 139; 4; 0.319106, 0.946715, -0.013933, -0.041334;;, + 146; 4; 0.007542, 0.999020, -0.000329, -0.043618;;, + 150; 4; -0.025078, 0.998734, 0.001095, -0.043606;;, + 160; 4; 0.536789, 0.842588, -0.023437, -0.036788;;, + 161; 4; 0.536789, 0.842588, -0.023437, -0.036788;;, + 175; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 178; 4; 0.267123, 0.962675, -0.011663, -0.042031;;, + 181; 4; 0.655435, 0.753991, -0.028617, -0.032920;;, + 184; 4; 0.267123, 0.962675, -0.011663, -0.042031;;, + 187; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 190; 4; 0.267123, 0.962675, -0.011663, -0.042031;;, + 193; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 207; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 216; 4; 0.536789, 0.842588, -0.023437, -0.036788;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -3.359494, 0.259702, 38.976971;;, + 77; 3; -3.359494, 0.259702, 38.976971;;, + 115; 3; -3.359494, 0.259702, 38.976971;;, + 135; 3; -3.359494, 0.259702, 38.976971;;; + } + } + + Animation x3ds_anim_13 { + {x3ds_xR_Foot} + AnimationKey { + 0; + 29; + 0; 4; 0.707107, 0.000000, 0.707107, -0.000000;;, + 1; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 11; 4; 0.693619, 0.137449, 0.693620, -0.137448;;, + 21; 4; 0.703851, 0.067776, 0.703851, -0.067776;;, + 26; 4; 0.702932, 0.076726, 0.702932, -0.076726;;, + 30; 4; 0.701057, 0.092296, 0.701058, -0.092296;;, + 37; 4; 0.701057, 0.092296, 0.701058, -0.092296;;, + 52; 4; 0.700211, 0.098511, 0.700211, -0.098511;;, + 61; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 68; 4; 0.690345, 0.153046, 0.690346, -0.153046;;, + 76; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 77; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 93; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 115; 4; 0.707107, -0.000000, 0.707107, 0.000000;;, + 135; 4; 0.707107, -0.000000, 0.707107, 0.000000;;, + 139; 4; 0.636494, 0.308019, 0.636494, -0.308019;;, + 146; 4; 0.705581, -0.046427, 0.705581, 0.046427;;, + 150; 4; 0.682577, -0.184629, 0.682578, 0.184629;;, + 160; 4; 0.701057, 0.092298, 0.701057, -0.092298;;, + 161; 4; 0.701057, 0.092298, 0.701057, -0.092298;;, + 175; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 178; 4; 0.691481, -0.147833, 0.691481, 0.147833;;, + 181; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 184; 4; 0.691481, -0.147833, 0.691481, 0.147833;;, + 187; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 190; 4; 0.691481, -0.147833, 0.691481, 0.147833;;, + 193; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 207; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 216; 4; 0.701057, 0.092298, 0.701057, -0.092298;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 3; + 0; 3; -0.849455, -62.299629, -3.801312;;, + 115; 3; -0.849455, -62.299629, -3.801312;;, + 135; 3; -0.849455, -62.299629, -3.801312;;; + } + } + + Animation x3ds_anim_14 { + {x3ds_xLU_Leg} + AnimationKey { + 0; + 30; + 0; 4; -0.043619, -0.000000, -0.999048, 0.000000;;, + 1; 4; -0.128543, 0.007574, -0.976382, -0.173483;;, + 11; 4; -0.134779, 0.015787, -0.981832, -0.132631;;, + 21; 4; -0.128729, 0.003084, -0.969733, -0.207452;;, + 30; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 37; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 43; 4; -0.128201, 0.012056, -0.981842, -0.139302;;, + 52; 4; -0.128201, 0.012056, -0.981842, -0.139302;;, + 61; 4; -0.128543, 0.007574, -0.976383, -0.173482;;, + 68; 4; -0.128751, 0.001960, -0.967886, -0.215906;;, + 76; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 77; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 85; 4; -0.128751, 0.001960, -0.967886, -0.215907;;, + 93; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 100; 4; -0.098715, 0.012488, -0.994248, -0.039635;;, + 115; 4; -0.199368, -0.000000, -0.979925, -0.000000;;, + 135; 4; -0.180689, 0.084257, -0.888113, 0.414134;;, + 139; 4; -0.148626, 0.124737, -0.776470, 0.599538;;, + 160; 4; -0.128542, 0.007574, -0.976383, -0.173482;;, + 161; 4; -0.128542, 0.007574, -0.976383, -0.173482;;, + 175; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 178; 4; -0.112759, 0.062175, -0.955955, 0.263761;;, + 181; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 184; 4; -0.112759, 0.062175, -0.955955, 0.263761;;, + 187; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 190; 4; -0.112759, 0.062175, -0.955955, 0.263761;;, + 193; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 207; 4; -0.124735, 0.031962, -0.991546, 0.016007;;, + 212; 4; -0.128488, 0.008447, -0.977538, -0.166852;;, + 216; 4; -0.128542, 0.007575, -0.976383, -0.173479;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -5.995693, 0.163913, 2.695592;;, + 77; 3; -5.995690, 0.163913, 2.695592;;, + 115; 3; -5.995690, 0.163913, 2.695592;;, + 135; 3; -5.995690, 0.163913, 2.695592;;; + } + } + + Animation x3ds_anim_15 { + {x3ds_xLL_Leg} + AnimationKey { + 0; + 34; + 0; 4; 0.706434, 0.706434, 0.030844, 0.030844;;, + 1; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 6; 4; 0.551866, 0.832791, 0.024095, 0.036360;;, + 11; 4; 0.510806, 0.858589, 0.022302, 0.037487;;, + 21; 4; 0.521998, 0.851831, 0.022791, 0.037192;;, + 26; 4; 0.541375, 0.839649, 0.023637, 0.036660;;, + 30; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 37; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 43; 4; 0.522001, 0.851829, 0.022791, 0.037192;;, + 52; 4; 0.544120, 0.837873, 0.023757, 0.036582;;, + 61; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 68; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 76; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 77; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 93; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 104; 4; 0.564968, 0.823959, 0.024667, 0.035975;;, + 115; 4; 0.706434, 0.706434, 0.030844, 0.030844;;, + 135; 4; 0.087073, 0.995247, 0.003802, 0.043453;;, + 139; 4; -0.244382, 0.968698, -0.010670, 0.042294;;, + 155; 4; 0.218585, 0.974843, 0.009544, 0.042563;;, + 160; 4; 0.580151, 0.813340, 0.025330, 0.035511;;, + 161; 4; 0.580151, 0.813340, 0.025330, 0.035511;;, + 168; 4; 0.350698, 0.935472, 0.015312, 0.040844;;, + 172; 4; 0.439930, 0.896972, 0.019208, 0.039163;;, + 175; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 178; 4; 0.300421, 0.952809, 0.013117, 0.041600;;, + 181; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 184; 4; 0.300421, 0.952809, 0.013117, 0.041600;;, + 187; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 190; 4; 0.300421, 0.952809, 0.013117, 0.041600;;, + 193; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 207; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 212; 4; 0.495151, 0.867712, 0.021619, 0.037885;;, + 216; 4; 0.580152, 0.813340, 0.025330, 0.035511;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 3.943333, 0.259710, 39.672764;;, + 77; 3; 3.943333, 0.259710, 39.672764;;, + 115; 3; 3.943333, 0.259710, 39.672764;;, + 135; 3; 3.943333, 0.259710, 39.672764;;; + } + } + + Animation x3ds_anim_16 { + {x3ds_xL_Foot} + AnimationKey { + 0; + 34; + 0; 4; 0.707107, 0.000000, 0.707107, -0.000000;;, + 1; 4; 0.687569, -0.165071, 0.687569, 0.165071;;, + 6; 4; 0.680588, -0.191834, 0.680588, 0.191834;;, + 11; 4; 0.677475, -0.202553, 0.677475, 0.202553;;, + 21; 4; 0.676210, -0.206736, 0.676210, 0.206736;;, + 26; 4; 0.677620, -0.202065, 0.677621, 0.202065;;, + 30; 4; 0.687569, -0.165071, 0.687569, 0.165071;;, + 37; 4; 0.687569, -0.165071, 0.687569, 0.165071;;, + 43; 4; 0.681390, -0.188966, 0.681390, 0.188966;;, + 52; 4; 0.690346, -0.153046, 0.690346, 0.153046;;, + 61; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 68; 4; 0.679364, -0.196123, 0.679364, 0.196123;;, + 76; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 77; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 93; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 100; 4; 0.705872, 0.041770, 0.705872, -0.041770;;, + 104; 4; 0.698511, 0.109917, 0.698512, -0.109917;;, + 115; 4; 0.707107, -0.000002, 0.707107, 0.000002;;, + 135; 4; 0.612373, 0.353552, 0.612373, -0.353552;;, + 139; 4; 0.672346, 0.218976, 0.672346, -0.218976;;, + 155; 4; 0.659223, -0.255782, 0.659223, 0.255782;;, + 160; 4; 0.687569, -0.165072, 0.687569, 0.165072;;, + 161; 4; 0.687569, -0.165072, 0.687569, 0.165072;;, + 168; 4; 0.705347, 0.049859, 0.705347, -0.049859;;, + 172; 4; 0.706854, -0.018889, 0.706854, 0.018889;;, + 175; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 178; 4; 0.690338, -0.153079, 0.690338, 0.153079;;, + 181; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 184; 4; 0.690338, -0.153079, 0.690338, 0.153079;;, + 187; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 190; 4; 0.690338, -0.153079, 0.690338, 0.153079;;, + 193; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 207; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 216; 4; 0.687562, -0.165103, 0.687562, 0.165103;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 3; + 0; 3; 1.061092, -63.263000, -4.043970;;, + 115; 3; 1.061092, -63.263000, -4.043970;;, + 135; 3; 1.061092, -63.263000, -4.043970;;; + } + } + +} + diff --git a/sdk/samples/rockem/demechbk.ppm b/sdk/samples/rockem/demechbk.ppm new file mode 100644 index 0000000..eb79012 Binary files /dev/null and b/sdk/samples/rockem/demechbk.ppm differ diff --git a/sdk/samples/rockem/demechbt.ppm b/sdk/samples/rockem/demechbt.ppm new file mode 100644 index 0000000..175a1a3 Binary files /dev/null and b/sdk/samples/rockem/demechbt.ppm differ diff --git a/sdk/samples/rockem/demechch.ppm b/sdk/samples/rockem/demechch.ppm new file mode 100644 index 0000000..c71d873 Binary files /dev/null and b/sdk/samples/rockem/demechch.ppm differ diff --git a/sdk/samples/rockem/demechgr.ppm b/sdk/samples/rockem/demechgr.ppm new file mode 100644 index 0000000..ed3ebeb Binary files /dev/null and b/sdk/samples/rockem/demechgr.ppm differ diff --git a/sdk/samples/rockem/demechh1.ppm b/sdk/samples/rockem/demechh1.ppm new file mode 100644 index 0000000..043967e Binary files /dev/null and b/sdk/samples/rockem/demechh1.ppm differ diff --git a/sdk/samples/rockem/demechh2.ppm b/sdk/samples/rockem/demechh2.ppm new file mode 100644 index 0000000..1c0c79a Binary files /dev/null and b/sdk/samples/rockem/demechh2.ppm differ diff --git a/sdk/samples/rockem/demechhd.ppm b/sdk/samples/rockem/demechhd.ppm new file mode 100644 index 0000000..95cbfd4 --- /dev/null +++ b/sdk/samples/rockem/demechhd.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 32 +255 +��������������������L$$L$$L$$L,,L$$L,,L$$L$$L,,L$$L$$L$$L$$L$$L$$L$$L$$L$$L,,L$$L$$L$$L$$L$$L,,��������������������������������������T,,L,,������$$�����$$�<<�44�$$��������T$$L$$�������������������������������������L,,L$$L$$L$$L$$L$$L$$L,,L,,L$$L$$L,,L,,L$$L$$L,,L$$L$$L,,L,,L$$L,,L$$L$$L$$L$$L,,L$$L,,�����������������������������������L$$L$$L$$L,,L,,L$$L,,L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L$$L,,L,,L$$L,,L$$�����������������������������������L,,���L$$�������������������L$$���L$$�����������������������������������L$$��<<�44L$$�����$$�����<<�44�$$�������L$$��$$�44L,,�����������������������������������L$$��44�<<L$$���������$$�DD�<<��������L,,���<<L$$�����������������������������������L$$��<<�<<L,,������$$����<<�44���$$�$$����L$$���<<L$$�����������������������������������L$$L,,L,,L$$L$$L$$L$$L,,L,,T$$�����44�<<��$$�L$$L$$L$$L,,L$$L,,L,,L$$L,,L,,�����������������������������������L$$L$$L$$L$$L$$L,,L,,L$$L$$L,,T$$���$$�<<�<<��T$$L,,L$$L$$L$$L,,L$$L$$L,,L$$L$$�����������������������������������L$$��������L$$L$$L,,���<<�<<��$$L$$L$$��������L$$�����������������������������������L$$�����������L$$L$$L$$L,,L$$L,,����������L,,�����������������������������������T$$��������$$���L$$L$$L$$L$$L$$����$$�������L$$�����������������������������������T�L$$L,,L,,L$$L$$T$$������$$�������T$$L$$L$$L$$L$$L,,�L$$�����������������������������������\���$|$�T$$L$$L$$L$$L,,����<<�<<��L$$L$$L$$L$$L$$$|$|���L$$�����������������������������������\���$|$|$|$|L,,L$$L$$L,,T$$��<<�<<�$$L,,L$$L,,L$$$�$|$|,����L$$�����������������������������������L$$���4�$|$|$|$|,�L$$L$$L,,L$$L,,L$$L$$L$$L$$$|$|$|$|4�4����L,,�����������������������������������L$$�$$��<�<�4�4�������������4�4�4�4�4����L,,�����������������������������������L$$���������������������������L$$�����������������������������������L$$\$$�����������$$��<<�44���$$��������L,,L,,�����������������������������������L,,L$$���������$$�L,,L$$L$$L$$L,,L$$��������L$$L$$�������������������������������������L,,L$$��������L,,L$$L$$L$$L,,L$$L,,L$$������\$$L,,���������������������������������������L,,L$$�������L$$�t�t��t���tL,,L$$�����L$$L$$L,,�����������������������������������������L,,L,,L,,L,,L$$\$$�L$$�|�t��t���tL,,L$$�\$$L,,L$$L,,L$$��������������������������������������������������L,,�t�t��t���tL$$L,,��������������������������������������������������������L,,�|�t��|���tL$$L,,��������������������������������������������������������L,,�t�t��t���tL$$L,,��������������������������������������������������������L$$��t��t���tL,,L,,��������������������������������������������������������L,,�t�t��t���tL$$L$$��������������������������������������������������������L,,�t�t��t���tL$$L$$��������������������������������������������������������L$$L$$L$$L$$L,,L$$L$$L,,���������������������������������������������������������L,,L$$L,,L$$L,,L,,���������������������������� \ No newline at end of file diff --git a/sdk/samples/rockem/demechhn.ppm b/sdk/samples/rockem/demechhn.ppm new file mode 100644 index 0000000..2f54801 Binary files /dev/null and b/sdk/samples/rockem/demechhn.ppm differ diff --git a/sdk/samples/rockem/demechla.ppm b/sdk/samples/rockem/demechla.ppm new file mode 100644 index 0000000..adcfef1 --- /dev/null +++ b/sdk/samples/rockem/demechla.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 64 +255 +���������������������������������������������������������������������������LLLLLLT$$T\TTTTTTTTTTTTTTTTTTTTTTTLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTTTTTTTTTTTTTTTTTTTTTTLTTLLLLL���������������������������������������������������������������������������������������������������LLLLLL\TT����������TT$$����������LLTLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������TT����������LTLLLL���������������������������������������������������������������������������������������������������TTTLLL\TT����������TT����������LTLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������T$$T����������LLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT����������TT����������LTLLLL���������������������������������������������������������������������������������������������������LLLLLLT\L����������TT����������TLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT����������T$$T����������LTLLLL�������||������������������������������������������������������������������������������������������LLLTLLTTT����������TT����������TLTTTT������������������������TLLLLLTTTLLLTTTTTTLLLTTTLLLLLLLLLTLLLLLLLLTLLLLLTLLLLLTTTLLLLLLLLLLLLTTTLLLLLLLLLTTT����������T$$T����������TLTLLLTLLLLLLLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLTTTLLL\TT����������TT����������LTLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������������������������������������������������������������������������LLLTLLTTT����������T$$T����������LTLLLL���������������������������������������������������������������������������������������������������LLLLLL\TT����������TT����������TLTLLL���������������������������������������������������������������������������������������������������TTTLLLTTT����������T$$T����������LTLLLL���������������������������������������������������������������������������������������������������LLLTLLT$$\T����������TT����������TLTLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������TT����������TLLLLL����||���������������������������������������������������������������������������������������������LLLTTTT\T����������T\����������TLTLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������TT����������TLLLLL���������������������������������������������������������������������������������������������������LLLTLLTTT�\TTTTTTT\TTTTTTTTTT��TLTLLL���������������������������������������������������������������������������������������������������LLLLLLT\T�TTTTTTTTTTTTTTLTTTT��TLTLLL���������������������������������������������������������������������������������������������������TTTTLLTTT�TTT$$TTTLTTTLLLLLLLLT��TLLLLL���������������������������������������������������������������������������������������������������LLLLLL\TT�T$$TTTTTTT$$TTT$$TT$$TTTT$$TT��TLTLLL���������������������������������������������������������������������������������������������������TTTLLLTTT�TTT$$TTT$$TTTTTTTTTT$$TTT��TLLLLL���������������������������������������������������������������������������������������������������LLLTLLTTT�T$$T����������������T��TLTLLL���������������������������������������������������������������������������������������������������TTTLLLTTT�T$$T����������������T$$��TLLLLL���������������������������������������������������������������������������������������������������LLLLLL\TT�TT$$����������������T��TTLLLL���������������������������������������������������������������������������������������������������TTTLLLTTT�TT�<<�44�<<�<<�<<�<<�44�<<�<<�<<�<<�44�<<�<<�<<�44T��TLLLLL���������������������������������������������������������������������������������������������������TLLLLL\TT�T$$T�<<�<<�<<�<<�44�<<�<<�<<�<<�44�<<�<<�<<�44�<<�<<T��TLTLLL���������������������������������������������������������������������������������������������������LLLLLLTTT�TT�44�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�44T��\LLLLL���������������������������������������������������������������������������������������������������LLLTTTTTT�TL����������������L��\LLLLL���������������������������������������������������������������������������������������������������LLLLLL\TT�T$$T����������������T��TLLLLL���������������������������������������������������������������������������������������������������LLLTLLTTT�TT����������������T��TLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT�TT$$����������������T��TLLLLL���������������������������������������������������������������������������������������������������LLLLLL\$$TT�TTTT$$TTT$$TTTTTT$$TTTT$$TT��TLLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT�T$$TT$$TT$$TTTT$$TT$$TTTTTTTT��TLLLLL���������������������������������������������������������������������������������������������������TTTTLLTTT�TT����������������T��TTLLLL���������������������������������������������������������������������������������������������������LLLLLLT\T�T$$T����������������T��TLTLLL���������������������������������������������������������������������������������������������������LLLLLLT\T�TT����������������T��TLTTTT���������������������������������������������������������������������������������������������������TTTTLLT$$TT�TT$$�44�44�<<�<<�<<�44�<<�<<�<<�<<�<<�44�<<�44�<<�44T��TLL$$LLL���������������������������������������������������������������������������������������������������LLLLLLT\T�TT�<<�<<�<<�44�<<�<<�44�44�<<�44�<<�<<�44�<<�<<�<<T��TLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT�TT�44�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�44T��TLLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT�TT����������������T��TLTLLL���������������������������������������������������������������������������������������������������LLLTTT\T\�TT����������������T��TLLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT�TT����������������T��TLTLLL���������������������������������������������������������������������������������������������������LLLTTTT\T�TT����������������T��LTLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT�TTTTTTTTTTTTTTTTTTT��TLTLLL���������������������������������������������������������������������������������������������������TTTTLLT\T�TTTTTTTTTTTTTTTTTTT��TLTLLL���������������������������������������������������������������������������������������������������LLLLLLTTT�TTTTTTTTTTTTTTTTTTT��TLLLLL���������������������������������������������������������������������������������������������������LLLLLL\TT�TTTTTTTTLTLTTTTTLTT��TLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT�TTTTTTTTTTTTTTTTTTT��TLLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������TT����������LLTLLL���������������������������������������������������������������������������������������������������LLLTTT\TT����������TT����������TTLLLL���������������������������������������������������������������������������������������������������LLLTLLTTT����������TT����������LLLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������TT����������TLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT����������TT����������TLTLLL���������������������������������������������������������������������������������������������������LLLLLL\TT����������TT����������TTLLLL���������������������������������������������������������������������������������������������������LLLLLLTTT����������TT����������LLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT����������TT����������TTLLLL���������������������������������������������������������������������������������������������������LLLLLLT\T����������TT����������TLTLLL���������������������������������������������������������������������������������������������������LLLTTTTTT����������TT����������TTLLLL���������������������������������������������������������������������������������������������������LLLLLLT\TTTTT\T\TTTTTTTTTTTTTT\TLLTTT���������������������������������������������������������������������������������������������������LLLTLLT$$TTT\TTTTTTTTTTTTTTTTTTTTTTLLLL���������������������������������������������������������������������������������������������������TTTLLL\$$T\\TTTTTTT$$TTTTTTTTTT$$TTTT\$$LTTTT������������������������ \ No newline at end of file diff --git a/sdk/samples/rockem/demechll.ppm b/sdk/samples/rockem/demechll.ppm new file mode 100644 index 0000000..584ec95 --- /dev/null +++ b/sdk/samples/rockem/demechll.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 128 +255 +�������������������������������������������������������������������$$���������$$���$$�������������������������������������������������������������������������������������������������������������������������������������������TTT$$TTT$$TTT$$TTTTTTTT�������������������������������������������������������������������������������������������������������������������������������������\TTTTTTTTTTTT$$TT$$TL$$������������������������������������������������������������������������������������������������������������������������������������$$�T$$���������������T�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T$$�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T$$�������������������������������������������������������������������������������������������������������������������������������������T$$�44�44�<<�<<�<<�<<�44�<<�<<�<<�<<�<<�<<�<<�44T�������������������������������������������������������������������������������������������������������������������������������������T�<<�<<�44�44�<<�44�<<�44�<<�<<�44�<<�<<�<<�<<T$$�������������������������������������������������������������������������������������������������������������������������������������T$$�44�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�44T�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T�������������������������������������������������������������������������������������������������������������������������������������T���������������T$$�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T�������������������������������������������������������������������������������������������������������������������������������������TTTTTT$$TTTT$$TTTTT$$T\�������������������������������������������������������������������������������������������������������������������������������������T$$TT$$TTTTT$$TTTT$$TTTTT�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T�������������������������������������������������������������������������������������������������������������������������������������T���������������T�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T�������������������������������������������������������������������������������������������������������������������������������������T�44�44�<<�<<�<<�<<�<<�<<�<<�<<�44�<<�<<�<<�44T$$�������������������������������������������������������������������������������������������������������������������������������������T�<<�<<�44�<<�44�<<�44�<<�<<�<<�<<�44�44�<<�<<T�������������������������������������������������������������������������������������������������������������������������������������T$$�44�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�44T�������������������������������������������������������������������������������������������������������������������������������������T���������������T�������������������������������������������������������������������������������������������������������������������������������������T$$���������������T$$�������������������������������������������������������������������������������������������������������������������������������������T���������������T������������������������������������������������������������������������������������������������������������������������������������,,�TTTTTTTTTTTTTTTT\$$�������������������������������������������������������������������������������������������������������������������������������������TTTTTTTTTTTTTTTTT$$��������������������������������������������������������������������������������������������������������������������������������������\�������������\�$$��������������������������������������������������������������������������������������������������������������������������������������T�������������T���������������������������������������������������������������������������������������������������������������������������������������T�������������T���������������������������������������������������������������������������������������������������������������������������������������T�������������T������������������������������������������������������������������LLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLT$$T$$TTT$$TTT$$TTT$$TTTL$$TT$$TT$$TT$$LLLTTTLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTT$$TTTTTLT$$T$$TTT$$TTTTTTTT$$LLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL������������������������������������������������������������������TT$$��������44�<<�<<�������\T���������������������������������������������������������������������������������������������������������������������������������T$$T��������<<�<<�<<�������T$$\���������������������������������������������������������������������������������������������������������������������������������TT$$��������<<�44�<<�������TT���������������������������������������������������������������������������������������������������������������������������������TT��������<<�44�<<�������TT���������������������������������������������������������������������������������������������������������������������������������T$$T��������<<�<<�44�������T$$T���������������������������������������������������������������������������������������������������������������������������������TT��������44�<<�<<�������TT���������������������������������������������������������������������LLLLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLLLLTTTLLLLLLLLLLLLLLL���T$$T��������<<�<<�<<�������T$$T���TTTLLLLLLLLLTTTLLLTTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLTTTLLLLLLLLLTTTLLLTTTLLLLLLTTTTTTLLLLLLTTTLLLTTTLLLTTT���TT��������44�<<�44�������TT���LLLLLLLLLLLLLLLTTTLLLTTTLLLLLLLLLTTTLLLTTTTTTLLLLLLTTTLLL���������LLLLLLT$$TT$$T$$TTT$$TTTT$$TTTTLLLLLL���T$$T��������<<�<<�<<�������T$$T���TTTLLLTT$$TTTTTT$$TTTTTTT$$LLLLLL���������LLLLLLd�������������TLLLLLL���TT��������<<�<<�<<�������T$$T���LLLLLLd�������������TLLLLLL���������LLLLLLT�������������TLLLTTT���T\$$��������44�<<�<<�������TT���LLLTTTT$$�������������TLLLLLL���������TTTLLLT�������������T$$TTTLLL���T$$T��������<<�44�<<�������T$$T���LLLLLLT$$�������������TLLLTTT���������LLLLLLT$$�������������TLLLLLL���TT��������<<�<<�<<�������TT���LLLTTTT�������������T$$TTTLLL���������LLLLLLT�44�<<�44�<<�<<�<<�44�<<�<<�<<�<<�44�<<T$$LLLTTT���TT$$��������44�<<�44�������T$$T���LLLLLLT$$�44�<<�44�<<�<<�<<�<<�44�<<�<<�<<�<<�44T$$LLLLLL���������LLLLLLT$$�<<�44�<<�<<�44�44�<<�<<�<<�44�<<�<<�<<TLLLLLL���T$$T��������<<�<<�<<�������TT���LLLTTTT$$�44�<<�<<�<<�44�<<�44�<<�44�<<�44�<<�<<TLLLLLL���������LLLLLLT�������������TLLLLLL���TT$$��������<<�<<�<<�������TT���LLLTTTT�������������T$$LLLLLL���������TTTLLLT�������������TLLLLLL���TT��������<<�<<�44�������TT$$���LLLLLLT�������������TTTTLLL���������LLLLLLT$$�������������TLLLTTT���T$$T��������44�<<�<<�������TT$$���LLLTTTT$$�������������T$$LLLLLL���������LLLTTTT�������������TTLLLLL���T\$$��������<<�<<�44�������T$$T���LLLLLLT�������������TLLLLLL���������LLLLLLT$$TTTT$$TTT$$TTT$$TTT$$TLLLLLL���TT��������<<�<<�<<�������TT$$���LLLTTTT$$TTTT$$TTT$$TTTT$$T$$TT$$LLLLLL���������LLLTTTTT$$TTTTTTTTTTTTTLLLLLL���\$$T��������44�<<�<<�������TT���LLLLLLTT$$TTTTTTT$$T$$TTTTTLLLLLL���������LLLTTTT�������������TLLLLLL���T$$T��������44�<<�<<�������T$$T���LLLLLLT�������������TLLLLLL���������LLLLLLT$$�������������TTTTLLL���TT$$��������<<�<<�44�������TT���LLLTTTT�������������TLLLTTT���������TTTLLLT�������������T$$LLLLLL���TT��������44�<<�<<�������T$$T���LLLLLLT$$�������������T$$LLLLLL���������LLLLLLT�<<�44�<<�<<�<<�<<�<<�<<�<<�<<�44�<<�<<TLLLTTT���TT$$��������<<�<<�44�������TT$$���LLLLLLT�<<�<<�<<�44�<<�<<�<<�<<�44�<<�<<�<<�<<TLLLTTT���������TTTLLLT$$�44�<<�44�<<�44�44�<<�44�44�<<�<<�<<�44T$$LLLLLL���T$$T��������<<�<<�<<�������T$$T���TTTLLLT�<<�44�44�<<�<<�<<�<<�44�<<�44�<<�<<�44T$$LLLLLL���������LLLLLLT�<<�<<�<<�<<�<<�<<�<<�<<�<<�<<�44�<<�<<TLLLLLL���TT$$��������<<�44�<<�������TT���LLLLLLT�<<�<<�<<�<<�44�<<�<<�<<�<<�<<�<<�<<�<<TTTTLLL���������LLLTTTT�������������TLLLLLL���TT��������<<�44�<<�������TT$$���LLLTTTT�������������TTTTLLL���������LLLLLLT�������������TLLLLLL���T$$T��������<<�<<�<<�������T$$T���LLLLLLT�������������T$$LLLLLL���������TTTLLL\$$�������������T$$LLLLLL���TT$$��������44�<<�44�������TT$$���LLLTTT\$$�������������TTTTLLL���������LLLLLLTTTTTT\$$TTTTTTTTTTTLLL���T$$T��������<<�<<�<<�������T$$T���LLLLLLTTTTTTTTTTTTTTTLLLLLL���������LLLTTTTTTTTTTTTTTTTTT$$LLLLLL���TT$$��������44�<<�<<�������TT$$���LLLLLLTTTTTTTTTTTTTTT$$TTTLLL���������LLLLLLLLLTTTLLLTTTLLLLLLLLLLLLTTTTTTLLLTTTLLLTTTLLLLLLLLL���TT��������<<�<<�<<�������T$$T���LLLTTTTTTLLLTTTTTTLLLLLLLLLTTTLLLLLLTTTLLLLLLLLLTTTLLLLLL���������LLLLLL���������������������������������������������LLLLLL���T$$\��������<<�<<�<<�������T$$T���LLLLLL���������������������������������������������LLLLLL���������LLLTTT���������������������������������������������LLLLLL���TT$$��������<<�<<�44�������T$$T���LLLTTT���������������������������������������������TTTLLL���������LLLLLL���������������������������������������������TTTLLL���TT��������44�<<�<<�������TT$$���LLLLLL���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������LLLLLL���TT$$��������<<�<<�44�������TT���LLLLLL���������������������������������������������TTTLLL���������TTTLLL���������������������������������������������TTTLLL���TT$$��������44�<<�<<�������T$$T���LLLTTT���������������������������������������������LLLLLL���������LLLTTT���������������������������������������������LLLLLL���TT$$��������44�<<�<<�������TT$$���LLLLLL���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������TTTLLL���TT\TT\\T\TTT\T\\T\\T$$T���LLLLLL���������������������������������������������LLLTTT���������LLLTTT���������������������������������������������LLLLLL���T$$\TT\TTTT\\TTTT\TTTTT$$���LLLTTT���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������TTTLLL���TT�\�\�d�\�\�\�d�d�\�d�d�\�d�d�\�d�TT$$T���LLLLLL���������������������������������������������LLLTTT���������LLLLLL���������������������������������������������LLLLLL���TT$$�\�d�\�d�d�d�d�d�\�d�d�\�d�d�d�\�\LT$$���LLLTTT���������������������������������������������LLLLLL���������LLLTTT���������������������������������������������TTTLLL���TT�\����������������\T$$T���LLLLLL���������������������������������������������LLLTTT���������LLLLLL���������������������������������������������TTTLLL���TT�\�������������������������������\T$$T���LLLLLL���������������������������������������������LLLLLL���������TTTLLL���������������������������������������������LLLLLL���TT$$�\�������������������������������\TL$$���TTTLLL���������������������������������������������TTTLLL���������LLLLLL���������������������������������������������TTTLLL���TT�\�������������������������������\T$$T���LLLLLL���������������������������������������������LLLLLL���������LLLTTT���������������������������������������������LLLLLL���TT$$�\�������������������������������\TL$$���LLLTTT���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������TTTLLL���TT�\�������������������������������\T$$T���LLLLLL���������������������������������������������TTTLLL���������LLLTTT���������������������������������������������LLLLLL���TT$$�\�������������������������������\LT$$���LLLTTT���������������������������������������������LLLTTT���������TTTLLLlllllllllTTTlllllllllllllllllllllllllllllllllLLLLLL���TT$$�\����������������\TL$$���TTTLLLllllllllllllllllllllllllllllllTTTlllTTTllllllTTTLLL���������LLLLLLllllllTTTlllllllllTTTllllllllllllTTTlllllllllLLLTTT���TT�\����������������\T$$T���LLLLLLllllllTTTlllTTTllllllTTTlllllllllllllllllllllLLLLLL���������TTTLLLlllllllllllllllTTTllllllllllllllllllTTTllllllLLLLLL���\T$$�\�\�d�\�\�d�\�\�d�d�d�\�d�\�d�\�TTL$$���LLLLLLlllllllllllllllllllllllllllllllllTTTlllTTTlllLLLLLL���������LLLLLLlllTTTlllTTTlllllllllTTTlllTTTlllllllllllllllLLLLLL���TT�d�d�\�d�d�\�d�\�\�\�\�d�\�\�d�\�TT$$T���TTTLLLlllTTTlllTTTllllllTTTllllllllllllllllllllllllLLLLLL���������TTTLLLllllllllllllllllllllllllllllllllllllTTTllllllLLLLLL���TT$$�\�\�d�\�d�\�d�d�d�d�\�d�d�d�d�\�\TL$$���LLLLLLlllllllllllllllTTTllllllTTTlllTTTlllTTTllllllLLLLLL���������LLLLLLllllllllllllllllllllllllTTTlllTTTllllllllllllLLLTTT���TT�\����������������\TT$$���LLLLLLllllllTTTllllllllllllllllllllllllllllllllllllLLLTTT���������LLLTTTllllllTTTllllllllllllllllllllllllTTTlllllllllLLLLLL���LT$$�\�������������������������������\T$$L$$���LLLLLLlllTTTllllllllllllllllllTTTllllllllllllTTTlllTTTLLL���������LLLLLLlllllllllllllllTTTlllTTTlllllllllllllllllllllLLLTTT���TT$$�\�������������������������������\TL$$���LLLLLLlllllllllTTTlllllllllllllllllllllTTTlllllllllLLLLLL���������LLLLLLlllTTTlllllllllllllllllllllTTTllllllllllllTTTLLLLLL���LT$$�\�������������������������������\TT$$���LLLTTTlllllllllllllllllllllTTTllllllllllllTTTllllllLLLTTT���������TTTLLLlllllllllTTTllllllllllllTTTllllllllllllllllllTTTLLL���TT$$�\�������������������������������\T$$L$$���LLLLLLTTTllllllllllllTTTllllllllllllTTTllllllllllllLLLLLL���������LLLLLLllllllllllllllllllllllllllllllTTTlllTTTllllllLLLLLL���T$$L�\�������������������������������\TT$$���LLLLLLllllllllllllllllllTTTlllllllllllllllTTTllllllLLLLLL���������LLLLLLllllllTTTlllTTTlllTTTllllllllllllllllllllllllTTTLLL���T$$T�\�������������������������������TT$$L���TTTLLLllllllTTTlllTTTllllllllllllllllllTTTlllllllllTTTLLL���������LLLLLLTTTllllllllllllTTTlllTTTlllTTTllllllTTTllllllLLLLLL���TT$$�\����������������\LT$$���LLLLLLlllllllllTTTlllllllllllllllTTTlllllllllllllllLLLTTT���������LLLLLLlllllllllllllllllllllllllllllllllllllllllllllLLLTTT���T$$L�\����������������\T$$L���TTTLLLllllllTTTllllllTTTlllllllllllllllllllllllllllLLLLLL���������TTTLLLlllllllllTTTlllllllllTTTlllTTTlllTTTlllTTTlllLLLLLL���TT$$�d�\�d�\�\�\�\�\�d�\�\�\�\�\�d�\�TT$$T���LLLLLLllllllllllllllllllTTTlllTTTlllTTTllllllTTTlllTTTLLL���������LLLLLLllllllTTTllllllllllllllllllllllllllllllllllllLLLLLL���LT$$�\�d�\�d�d�d�d�\�d�\�d�d�d�\�d�d�\T$$L���LLLLLLllllllTTTlllTTTllllllllllllllllllllllllllllllLLLLLL���������LLLLLLlllllllllllllllllllllllllllllllllllllllllllllTTTLLL���TT$$�\����������������\TT$$���LLLTTTlllllllllllllllllllllllllllllllllllllllllllllTTTLLL���������LLLLLLLLLLLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���TT$$�\�������������������������������TT$$L���LLLLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLTTTTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���L$$T�\�������������������������������\T$$T���LLLLLLLLLLLLTTTTTTLLLTTTTTTLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTT���T\�\�������������������������������TT$$L���TTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLTTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\�������������������������������\T$$T���LLLLLLLLLLLLTTTTTTLLLTTTTTTLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLTTTLLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���TT�\�������������������������������TT$$L���LLLLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLTTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\�������������������������������\T$$T���LLLLLLLLLLLLTTTTTTLLLTTTLLLLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLTTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���T\�\����������������\T$$T���LLLLLLLLLLLLTTTTTTLLLTTTTTTLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLTTTLLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���T\�\����������������TT$$L���LLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLTTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���T\�d�\�d�\�\�\�\�\�\�d�d�\�\�\�d�\�\T$$T���LLLLLLLLLLLLTTTTTTLLLTTTTTTLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTT���T\�\�d�\�d�d�d�d�d�d�d�\�d�d�\�d�d�TT$$L���TTTLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\��������������܄�\T$$T$$���LLLLLLLLLLLLTTTTTTLLLTTTLLLLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLLLLTTTLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���TT�\����������������\LT$$���LLLLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTLLL���������TTTLLLLLLTTTLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���T\�\�������������������������������\TL$$���LLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLLLLLLLLLLTTTTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\�������������������������������\T$$T$$���LLLLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLLLLTTTLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���T\�\�������������������������������\TL$$���LLLTTTTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\�������������������������������\T$$T���LLLLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLTTTLLLTTTLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���T\�\�������������������������������\T$$L���LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\�������������������������������\L$$T���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTLLLLLLLLLTTTLLLTTTLLLLLL���������LLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���T\�\����������������\T$$T���LLLLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������TTTLLLLLLLLLLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���TT$$�\�d�\�d�d�\�d�d�\�d�d�d�d�\�d�\�\TL���TTTLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLLLLTTTLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT�\�d�\�d�d�\�d�d�\�\�\�\�\�d�\�d�\T$$T$$���LLLLLLLLLTTTLLLLLLTTTLLLTTTLLLLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLTTTLLLLLLTTTTTTLLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���TT$$TTT$$LTL$$TLT$$LTT$$LT$$LT$$L$$T$$L���TTTLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLLLLTTTLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LT$$L$$LT$$T$$T$$T$$L$$L$$T$$T$$T$$T$$L$$LT$$L$$\$$LT$$���LLLLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLLTTTLLLLLL���������LLLTTTLLLLLLLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTT���T$$T�����������������TT���TTTLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLL���������LLLTTTLLLLLLTTTTTTLLLTTTLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���T$$L�����������������L$$T���TTTLLLTTTLLLLLLTTTLLLLLLLLLLLLTTTTTTLLLTTTLLLLLLLLLTTTLLL���������LLLLLLTTTLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���TT$$�����������������TL$$���LLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������������������������������������������������������������������LT$$�����������������T$$T���������������������������������������������������������������������������������������������������������������������������������TT$$�����������������T$$L���������������������������������������������������������������TLT$$LLT$$LLT$$LLLT$$T$$LT$$T$$LT$$T$$LT$$T$$LTTTTTT$$TLTTT$$LT$$T$$LT$$TL$$TLL$$TL$$LL$$L$$L$$L$$T$$L$$T$$L$$L$$L$$L$$L$$L$$L$$LL$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$TT$$T$$T$$TT$$T$$T$$T$$TT$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$T$$ \ No newline at end of file diff --git a/sdk/samples/rockem/demechua.ppm b/sdk/samples/rockem/demechua.ppm new file mode 100644 index 0000000..e81b0d5 --- /dev/null +++ b/sdk/samples/rockem/demechua.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +32 32 +255 +���������������d�d�d�d�d�d�d�d�d�d�d�d����������������\�d�����������������d�����������d܌���������������d�d�����������������d�����������d��������������܌�d�d�����������������d�������������������d����������������d�d�����������������d�������������������d����������������d�d�����������������d�������������������d����������������d�d�����������������d�������������������d����������������d�\�����������������d��������������������d����������������d�d�����������������d�������t��|��t��������d���������������d�d�d�����������������d��������t��t��t��������d���������������d�d�d�����������������d�������t��t��t���������d��������������d�d�d�����������������d��������t��t��t��������d������������܌�d�d�d�����������������d�������t��t��|��������d���������܌��d�d�d�d�����������������d�������|��t��t���������d������������d�d�d�d�����������������d�������t��t��|��������d�����������d��d�d�����������������d�������|��t��t���������d��������܌�\�d��d�d�����������������d�������t��t��|���������d��������\�d���d�d�����������������d�������t��t��t��������d�����܌��d�d���d�d�����������������d�������t��|��|��������d��������d�d���d�d�����������������d�������t��t��t��������d�������d�d���d�d�����������������d�������t��t��t��������d������d�����d�d�����������������d�������t��t��t��������d������d�����d�d�����������������d�������t��t��t��������d������d������d�d�����������������d���������t��t��������d������d������d�d�����������������d�������������������d������d������d�d�����������������d�������������������d������d�������d�d�����������������d�������������������d������d�������d�d�����������������d�������������������d������d�������d�d�����������������d�����������d������d�������d�d�����������������d�����������d������d�������d�d�����������������d�d�d�d�d�d�d�d�d�d�d�d������\�������d�d�����������������d�d�d�d�d�d�d�d�d�d�d�d������\�������d�d�� \ No newline at end of file diff --git a/sdk/samples/rockem/demechul.ppm b/sdk/samples/rockem/demechul.ppm new file mode 100644 index 0000000..e86e8b9 --- /dev/null +++ b/sdk/samples/rockem/demechul.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 64 +255 +�����������T�L�|��������������������|�|�T�T�������������������\�\�\�������������������L�T�t���������������������|�L�T�������������������T�T�|�|�����������������|�|�L�T���������������������\�T�\��������������������\�L�|������������������|܄�T�T�������������������T�T�|�|���������������|�|�T�T�T���������������������\�T�\���������������������T�T�L�|�����������������|�T�T�������������������L�T��|���������������t�|�T�T�����������������������T�T�\�����������������������T�T�|����������������|�|�T�T�������������������T�T�|�|�������������|�|�T�T�������������������������T�T�\�������������������������L�T�|���������������|�T�T�������������������T�T�|��������������|�|�T�T�������������������������T�T�\�������������������������T�T�|��������������|�|�T�T�������������������L�T܄�|�������������|�|�T�T������������������������T�T�\������������������������L�T܄�|�������������܄�L�T�������������������T�T�|�������������|�\�T�������������������������T�T�\�������������������������L�T��������������|�T�T�������������������T�L�|�������������|�\�\�����������������T�\�����T�T�\�����T�d�����������������T�L��|������������|�T�T�������������������T�T�|�����������|�\�T�t����������������\�T�����\�T�\�����T�T������������������T�T�|����������|��T�L�������������������T�T�|�|����������|�T�\������������������\�T�����\�T�d�����T�T������������������T�L��|��������܄�|�T�T�������������������T�T�|����������|��T�T�������������������T�T�����\�T�\�����T�T�������������������T�T�|܄���������|�|�T�T�������������������T�T�|܄���������|�d�T�t������������������T�T�����d�T�\�����T�T������������������L�T�T�|���������|܄�T�T�������������������T�\�|�|��������|�T�\��������������������T�\�����\�T�T�����T�T������������������T�L�T�|��������|��L�T�������������������T�L�|�|�������|�|�T�T�����|��������������T�T�����T�T�\�����\�T�����������܌��T�����T�T�|��������|��L�T�������������������T�T�|�|������|�t�T�L���d�|܄��������������\�T�����\�\�\�����T�T���������������T�����T�L�\�|�������|�T�T�������������������L�L�t�t�����܄�L�T�����T�|���������������T�T�����\�T�\�����\�T���������������\�\���T�T�L܄�|�����|��L�T�������������������T�T�t�|�|�|��|�T�T�����T�|��������������T�T�����\�T�\�����T�\��������������\�T�����T�L��|�|�|��|�L�T�������������������T�L�|��|�|�|�d�T�T�����T���������������T�T�����\�\�\�����T�T��������������\�\�T���T�L�|܄�|��|�|�T�T�������������������T�\�|�t�|��|�T�T�D���T�T���������������T�T�����\�\�\�����T�T���������������\�T���T�L�L�|��|�|��L�T�������������������T�\�|��|��|�T�L�T���T�T��������������T�T�T�����T�\�T�����T�T�T��������������T�\���D�T�L�|���|�|�L�T�������������������T�\�|܄�|�|�|�T�T�����T�T��������������T�T�L�����T�\�\�����T�T�T��������������\�T�����T�T�|�|�|��|�T�T�������������������\�T�|܄�|�|�|�T�L�����T�T�������������T�T�L�����T�\�\�����T�T�T�������������\�T�����T�L�|�|�|�|��T�\�������������������\�L�\�|�|�\�T�L�T�����\�T�������������L�T�T�����\�T�\�����T�T�T�������������\�\�����T�L�T�T�|��T�T�\�������������L�T����T�T��|�T�L�T�������T�T܌������܌���|�L�T�������\�\�T�������T�T�|��܌������܌�\�\�������L�T�L��|�L�T���|�T�T�������T�T�|���T�L�T�T�T�L�T�������\�T�����������T�L�T�������T�\�\�������T�T�T�����������\�\�L�����T�L�T�T�T�T�T����T�L�������T�T�|���T�T�T�T�T�T�������\�T�\܌����������T�T�������\�\�\�T�\������L�T�����������\�T�T�����T�L�T�T�T�T�T���|�T�T�������L�T�|�����T�T�T�\�T�������\�T�����܌���T�L�T�������\�T�\�\�\�������T�L�T��܌�����T�\�L�������T�T�T�T�T�����|�T�T�������D�T�|�������T�L�T�\�������T�\�|���܄���T�L�T�����T�\�T�����\�T�����T�T�T܄������\�\�T�������T�T�T�L�������|�T�L�������\�T�|������T�T�\�T�������\�T�|�܄��܄�T�L�T�������\�T�\�����d�\�������T�T�T�܌����|�\�T�������T�T�T���������|�T�T�������\�\�|�t�������T�T�\�������T�\���|����L�T�������\�\�\���������\�\����ܔ�T�\����|���T�\�������T�T�T���������T�T�������T�\�t�|�������T�T�\�������T�T�|�����L�T�L�������T�\�T���������T�\�������T�T�t�܌�|���T�\�������T�L�T��������t�T�T���������\�T�|������t�T�\�������T�T��|�܌��L�T�L�������\�T�����������\�\�\������T�T�܌��|܄�\�\�T�����T�T�T�����|��T�T�����������\�T�|�|�����|�T�\�����T�L�\�|�����L�T�������\�T�\�����������|�\�T�������T�T����|��d�T�T�����T�\�T�����|��T�T�����������l�\�T�|��|�|�T�\�����T�T�d�|����T�L�T�����d�T�\�������������\�T�\�����T�T�\�܄�|��|�L�T�����T�T�T���|��T�T�l�������������T�\�t�|�|�|�T�\�����T�L�|܄�|���T�T�������T�\�T�������������|�\�T������T�T����|��T�L�����T�T�T���|�l�T�T�����������������T�\�t�|��\�T�����T�L܄����T�T�T�����d�\�\�|��������������T�\�T�����T�T�T�܌���T�L�����\�T�T���T�T�������������������T�T�t�|�|�T�\�����T�T�|����\�T�������\�\�T�|�������������|�\�\�\�������T�\����|�L�T�����\�T�T��l�T�T�������������������t�T�T�|��\�\�����T�L���܄�T�T�������T�\�\��������������|�\�\�T�������T�T܄��܄�T�L�����T�T�T��T�T�l���������������������l�\�L�\�\�\�����T�T���t�\�T�T�����\�T�T�\���������������\�\�T�T�����T�T�\�t�܄�T�T�����T�T�T�L�T�t�������������������������T�\�\�T�\�����L�T�|��T�T�T�������\�T�\�\܌��������������\�\�\�T�\�����T�T�T��|�L�T�����T�T�T�L�T�����������������������������L�T�\�\�����T�L�T�T�T�T�T�����T�\�T�T�\܌��������������\�\��T�T�T��ܜ�T�T�T�T�L�T�����\�T�T�T�������������������������������T�T�T�\�����T�T�T�T�T�T�������T�T�T�\�\���������������\�\��\�T�T�����T�T�T�T�T�T�����T�T�T�T���������������������������������L�\�T�����T�T�T�T�T�T�����d�T�T܄�\�\�܌�������������\�\���T�T����ܜ�T�T�T�L�T�����T�T�T�������������������������������������T�\�����T�T�T�T�T�������T�T���\�\���������������\�\܌����T�T�����T�T�T�T�T�����T�T���������������������������������������\�\�����T�T�T�T���������T�T�܌�\�\���������������\�\�����T�T�������T�\�T�L�����T�T�����������������������������������������������T�L�T�T�������T�T��܌��\�\���������������\�\�������T�T�����T�T�T�T�������������������������������������������������������T�T�T�������T�T�\�����\�\�܌����������܌��\�\�������T�T�������\�T�T�������������������������������������������������������T�L�T�������T�T����܌��\�\���������������\�\�������T�T�T�����T�T�T�������������������������������������������������������T�T�T�����T�T�T����܌��\�\�܌�������������\�\��������T�T�����T�T�\�������������������������������������������������������T�T�T�����T�\��������\�\������������܌��\�\��|������T�T�����T�T�T�������������������������������������������������������T�\�T�����T�T������\�\����������\�\������T�\�����\�T�T�������������������������������������������������������T�\�T�����T�T�\�T�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�T�����T�T�T�������������������������������������������������������T�\�T�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�����\�T�T�������������������������������������������������������T�\�T�����T�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�\�����T�\�T�������������������������������������������������������T�T�\�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�����\�T�T�������������������������������������������������������T�T�\�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�\�����\�T�T�������������������������������������������������������T�T�\�����T�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�����T�T�T�������������������������������������������������������T�\�T�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�����\�T�T�������������������������������������������������������T�\�T�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�����T�\�T�������������������������������������������������������T�T�\�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�T�����\�\�T�������������������������������������������������������\�T�\�����\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�����\�T�\�����������������������������������������������������������������\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�\�\�\�\�\�T�\���������������������������������������������������������������������������d�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�\�\������������������������������������ \ No newline at end of file diff --git a/sdk/samples/rockem/directx.cpp b/sdk/samples/rockem/directx.cpp new file mode 100644 index 0000000..c01125c --- /dev/null +++ b/sdk/samples/rockem/directx.cpp @@ -0,0 +1,1944 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: directx.cpp + * + ***************************************************************************/ + +// N.B. The use of RM denotes the Direct3D retained mode objects + +// The Macros TRY_DD, TRY_DS, TRY_D3D, TRY_D3DRM are defined in DirectX.h and are for +// error checking. + +#define INITGUID + +// Includes.... +#include "directx.h" +#include "mmsystem.h" +#include "winmain.h" +#include "conio.h" + +// Globals.... +LPDIRECTDRAW g_lpDD = NULL; // DirectDraw object +LPDIRECT3D g_lpD3D = NULL; // Direct3D object +LPDIRECTSOUND g_lpDS = NULL; // DirectSound object +LPDIRECT3DRM g_lpD3DRM = NULL; // Direct3D RM object +DWORD g_dwGDIMem = 0; // Memory in available from GDI's surface + +D3DDeviceInfo g_deviceInfo; // 3D device info +LPGUID g_lpD3DDeviceGuid = NULL; // Guid to 3D device + +VideoMode g_vidModes[NUM_VID_MODES];// Array of available video modes +DWORD g_dwCurrMode = 0; +DWORD g_dwNumModes = 0; + +BOOL g_bSoundPresent = FALSE; // Do we have sound capabilites? + +LPDIRECTDRAWSURFACE g_lpPrimary = NULL; // Primary surface +LPDIRECTDRAWSURFACE g_lpBackBuffer = NULL; // BackBuffer surface +LPDIRECTDRAWSURFACE g_lpZBuffer = NULL; // ZBuffer +LPDIRECTDRAWPALETTE g_lpPalette = NULL; // Palette +PALETTEENTRY g_rPal[768]; // Rockem3D palette + +LPDIRECTDRAW g_lpSplashDD = NULL; // DirectDraw object used for splash screen +LPDIRECTDRAWSURFACE g_lpSplashPrimary = NULL; // Primary surface +LPDIRECTDRAWPALETTE g_lpSplashPalette = NULL; // Palette + +LPDIRECT3DDEVICE g_lpD3DDevice = NULL; // Direct3D device +LPDIRECT3DRMDEVICE g_lpD3DRMDevice = NULL; // Direct3D RM Device +LPDIRECT3DRMVIEWPORT g_lpD3DRMViewport = NULL; // Direct3D RM Viewport + +DDCAPS g_driverCaps; // Driver capabilities +DDCAPS g_HELcaps; // HEL capabilities + +DWORD g_dwZBufferBitDepth = 16;// ZBuffer bit depth +DWORD g_dwZBufferMemType = DDSCAPS_SYSTEMMEMORY;// Type of ZBuffer + +LPDIRECTSOUNDBUFFER g_lpSounds[NUM_SOUNDS]; // Sound buffers +LPDIRECTSOUND3DLISTENER g_lpDs3dListener; // Listener object for Direct 3D Sound +LPDIRECTSOUNDBUFFER g_3DSoundBuffer; // Direct Sound buffer for the Listener object +LPDIRECTSOUND3DBUFFER g_lp3dSounds[NUM_SOUNDS];//3D Sound Buffers + + +// State booleans +BOOL g_bHardware3D = FALSE; // Do we have hardware? + +float g_xratio = 0.0f; // X ratio used for computing power bars +float g_yratio = 0.0f; // Y ratio used for computing power bars + +// Power bar x,y and width values +DWORD g_vidModeX; // Current X video resolution +DWORD g_vidModeY; // Current Y video resolution +DWORD g_vidModeBIT; // Current video bit depth +DWORD g_dwFontHeight = 0; +DWORD g_dwAveCharWidth = 0; +DWORD g_lbar1 = 0; +DWORD g_wbar1 = 0; +DWORD g_lbar2 = 0; +DWORD g_wbar2 = 0; +DWORD g_hbar1 = 0; +DWORD g_hbar2 = 0; + +// Externals.... +extern HWND g_hWnd; // Defined in WINMAIN.CPP +extern BOOL g_bSoundPaused; // Defined in WINMAIN.CPP +extern LPDIRECT3DRMFRAME g_lpCamera; // Defined in RM.CPP +extern LPDIRECT3DRMFRAME g_lpScene; // Defined in RM.CPP +extern LPDIRECT3DRMFRAME g_lpPlayers; // Defined in RM.CPP +extern LPDIRECT3DRMLIGHT g_lpDir; // Defined in RM.CPP + +//---------------------------------------------------------------------- +// +// Function : TraceErrorDD() +// +// Purpose : Traces an error (DirectDraw) +// +//---------------------------------------------------------------------- + +void TraceErrorDD(HRESULT hErr, char *sFile, int nLine) +{ + char dderr[256]; + char err[1024]; + + switch (hErr) + { + case DDERR_ALREADYINITIALIZED : sprintf(dderr, "DDERR_ALREADYINITIALIZED"); break; + case DDERR_CANNOTATTACHSURFACE : sprintf(dderr, "DDERR_CANNOTATTACHSURFACE"); break; + case DDERR_CANNOTDETACHSURFACE : sprintf(dderr, "DDERR_CANNOTDETACHSURFACE"); break; + case DDERR_CURRENTLYNOTAVAIL : sprintf(dderr, "DDERR_CURRENTLYNOTAVAIL"); break; + case DDERR_EXCEPTION : sprintf(dderr, "DDERR_EXCEPTION"); break; + case DDERR_GENERIC : sprintf(dderr, "DDERR_GENERIC"); break; + case DDERR_HEIGHTALIGN : sprintf(dderr, "DDERR_HEIGHTALIGN"); break; + case DDERR_INCOMPATIBLEPRIMARY : sprintf(dderr, "DDERR_INCOMPATIBLEPRIMARY"); break; + case DDERR_INVALIDCAPS : sprintf(dderr, "DDERR_INVALIDCAPS"); break; + case DDERR_INVALIDCLIPLIST : sprintf(dderr, "DDERR_INVALIDCLIPLIST"); break; + case DDERR_INVALIDMODE : sprintf(dderr, "DDERR_INVALIDMODE"); break; + case DDERR_INVALIDOBJECT : sprintf(dderr, "DDERR_INVALIDOBJECT"); break; + case DDERR_INVALIDPARAMS : sprintf(dderr, "DDERR_INVALIDPARAMS"); break; + case DDERR_INVALIDPIXELFORMAT : sprintf(dderr, "DDERR_INVALIDPIXELFORMAT"); break; + case DDERR_INVALIDRECT : sprintf(dderr, "DDERR_INVALIDRECT"); break; + case DDERR_LOCKEDSURFACES : sprintf(dderr, "DDERR_LOCKEDSURFACES"); break; + case DDERR_NO3D : sprintf(dderr, "DDERR_NO3D"); break; + case DDERR_NOALPHAHW : sprintf(dderr, "DDERR_NOALPHAHW"); break; + case DDERR_NOCLIPLIST : sprintf(dderr, "DDERR_NOCLIPLIST"); break; + case DDERR_NOCOLORCONVHW : sprintf(dderr, "DDERR_NOCOLORCONVHW"); break; + case DDERR_NOCOOPERATIVELEVELSET : sprintf(dderr, "DDERR_NOCOOPERATIVELEVELSET"); break; + case DDERR_NOCOLORKEY : sprintf(dderr, "DDERR_NOCOLORKEY"); break; + case DDERR_NOCOLORKEYHW : sprintf(dderr, "DDERR_NOCOLORKEYHW"); break; + case DDERR_NODIRECTDRAWSUPPORT : sprintf(dderr, "DDERR_NODIRECTDRAWSUPPORT"); break; + case DDERR_NOEXCLUSIVEMODE : sprintf(dderr, "DDERR_NOEXCLUSIVEMODE"); break; + case DDERR_NOFLIPHW : sprintf(dderr, "DDERR_NOFLIPHW"); break; + case DDERR_NOGDI : sprintf(dderr, "DDERR_NOGDI"); break; + case DDERR_NOMIRRORHW : sprintf(dderr, "DDERR_NOMIRRORHW"); break; + case DDERR_NOTFOUND : sprintf(dderr, "DDERR_NOTFOUND"); break; + case DDERR_NOOVERLAYHW : sprintf(dderr, "DDERR_NOOVERLAYHW"); break; + case DDERR_NORASTEROPHW : sprintf(dderr, "DDERR_NORASTEROPHW"); break; + case DDERR_NOROTATIONHW : sprintf(dderr, "DDERR_NOROTATIONHW"); break; + case DDERR_NOSTRETCHHW : sprintf(dderr, "DDERR_NOSTRETCHHW"); break; + case DDERR_NOT4BITCOLOR : sprintf(dderr, "DDERR_NOT4BITCOLOR"); break; + case DDERR_NOT4BITCOLORINDEX : sprintf(dderr, "DDERR_NOT4BITCOLORINDEX"); break; + case DDERR_NOT8BITCOLOR : sprintf(dderr, "DDERR_NOT8BITCOLOR"); break; + case DDERR_NOTEXTUREHW : sprintf(dderr, "DDERR_NOTEXTUREHW"); break; + case DDERR_NOVSYNCHW : sprintf(dderr, "DDERR_NOVSYNCHW"); break; + case DDERR_NOZBUFFERHW : sprintf(dderr, "DDERR_NOZBUFFERHW"); break; + case DDERR_NOZOVERLAYHW : sprintf(dderr, "DDERR_NOZOVERLAYHW"); break; + case DDERR_OUTOFCAPS : sprintf(dderr, "DDERR_OUTOFCAPS"); break; + case DDERR_OUTOFMEMORY : sprintf(dderr, "DDERR_OUTOFMEMORY"); break; + case DDERR_OUTOFVIDEOMEMORY : sprintf(dderr, "DDERR_OUTOFVIDEOMEMORY"); break; + case DDERR_OVERLAYCANTCLIP : sprintf(dderr, "DDERR_OVERLAYCANTCLIP"); break; + case DDERR_OVERLAYCOLORKEYONLYONEACTIVE : sprintf(dderr, "DDERR_OVERLAYCOLORKEYONLYONEACTIVE"); break; + case DDERR_PALETTEBUSY : sprintf(dderr, "DDERR_PALETTEBUSY"); break; + case DDERR_COLORKEYNOTSET : sprintf(dderr, "DDERR_COLORKEYNOTSET"); break; + case DDERR_SURFACEALREADYATTACHED : sprintf(dderr, "DDERR_SURFACEALREADYATTACHED"); break; + case DDERR_SURFACEALREADYDEPENDENT : sprintf(dderr, "DDERR_SURFACEALREADYDEPENDENT"); break; + case DDERR_SURFACEBUSY : sprintf(dderr, "DDERR_SURFACEBUSY"); break; + case DDERR_CANTLOCKSURFACE : sprintf(dderr, "DDERR_CANTLOCKSURFACE"); break; + case DDERR_SURFACEISOBSCURED : sprintf(dderr, "DDERR_SURFACEISOBSCURED"); break; + case DDERR_SURFACELOST : sprintf(dderr, "DDERR_SURFACELOST"); break; + case DDERR_SURFACENOTATTACHED : sprintf(dderr, "DDERR_SURFACENOTATTACHED"); break; + case DDERR_TOOBIGHEIGHT : sprintf(dderr, "DDERR_TOOBIGHEIGHT"); break; + case DDERR_TOOBIGSIZE : sprintf(dderr, "DDERR_TOOBIGSIZE"); break; + case DDERR_TOOBIGWIDTH : sprintf(dderr, "DDERR_TOOBIGWIDTH"); break; + case DDERR_UNSUPPORTED : sprintf(dderr, "DDERR_UNSUPPORTED"); break; + case DDERR_UNSUPPORTEDFORMAT : sprintf(dderr, "DDERR_UNSUPPORTEDFORMAT"); break; + case DDERR_UNSUPPORTEDMASK : sprintf(dderr, "DDERR_UNSUPPORTEDMASK"); break; + case DDERR_VERTICALBLANKINPROGRESS : sprintf(dderr, "DDERR_VERTICALBLANKINPROGRESS"); break; + case DDERR_WASSTILLDRAWING : sprintf(dderr, "DDERR_WASSTILLDRAWING"); break; + case DDERR_XALIGN : sprintf(dderr, "DDERR_XALIGN"); break; + case DDERR_INVALIDDIRECTDRAWGUID : sprintf(dderr, "DDERR_INVALIDDIRECTDRAWGUID"); break; + case DDERR_DIRECTDRAWALREADYCREATED : sprintf(dderr, "DDERR_DIRECTDRAWALREADYCREATED"); break; + case DDERR_NODIRECTDRAWHW : sprintf(dderr, "DDERR_NODIRECTDRAWHW"); break; + case DDERR_PRIMARYSURFACEALREADYEXISTS : sprintf(dderr, "DDERR_PRIMARYSURFACEALREADYEXISTS"); break; + case DDERR_NOEMULATION : sprintf(dderr, "DDERR_NOEMULATION"); break; + case DDERR_REGIONTOOSMALL : sprintf(dderr, "DDERR_REGIONTOOSMALL"); break; + case DDERR_CLIPPERISUSINGHWND : sprintf(dderr, "DDERR_CLIPPERISUSINGHWND"); break; + case DDERR_NOCLIPPERATTACHED : sprintf(dderr, "DDERR_NOCLIPPERATTACHED"); break; + case DDERR_NOHWND : sprintf(dderr, "DDERR_NOHWND"); break; + case DDERR_HWNDSUBCLASSED : sprintf(dderr, "DDERR_HWNDSUBCLASSED"); break; + case DDERR_HWNDALREADYSET : sprintf(dderr, "DDERR_HWNDALREADYSET"); break; + case DDERR_NOPALETTEATTACHED : sprintf(dderr, "DDERR_NOPALETTEATTACHED"); break; + case DDERR_NOPALETTEHW : sprintf(dderr, "DDERR_NOPALETTEHW"); break; + case DDERR_BLTFASTCANTCLIP : sprintf(dderr, "DDERR_BLTFASTCANTCLIP"); break; + case DDERR_NOBLTHW : sprintf(dderr, "DDERR_NOBLTHW"); break; + case DDERR_NODDROPSHW : sprintf(dderr, "DDERR_NODDROPSHW"); break; + case DDERR_OVERLAYNOTVISIBLE : sprintf(dderr, "DDERR_OVERLAYNOTVISIBLE"); break; + case DDERR_NOOVERLAYDEST : sprintf(dderr, "DDERR_NOOVERLAYDEST"); break; + case DDERR_INVALIDPOSITION : sprintf(dderr, "DDERR_INVALIDPOSITION"); break; + case DDERR_NOTAOVERLAYSURFACE : sprintf(dderr, "DDERR_NOTAOVERLAYSURFACE"); break; + case DDERR_EXCLUSIVEMODEALREADYSET : sprintf(dderr, "DDERR_EXCLUSIVEMODEALREADYSET"); break; + case DDERR_NOTFLIPPABLE : sprintf(dderr, "DDERR_NOTFLIPPABLE"); break; + case DDERR_CANTDUPLICATE : sprintf(dderr, "DDERR_CANTDUPLICATE"); break; + case DDERR_NOTLOCKED : sprintf(dderr, "DDERR_NOTLOCKED"); break; + case DDERR_CANTCREATEDC : sprintf(dderr, "DDERR_CANTCREATEDC"); break; + case DDERR_NODC : sprintf(dderr, "DDERR_NODC"); break; + case DDERR_WRONGMODE : sprintf(dderr, "DDERR_WRONGMODE"); break; + case DDERR_IMPLICITLYCREATED : sprintf(dderr, "DDERR_IMPLICITLYCREATED"); break; + case DDERR_NOTPALETTIZED : sprintf(dderr, "DDERR_NOTPALETTIZED"); break; + case DDERR_UNSUPPORTEDMODE : sprintf(dderr, "DDERR_UNSUPPORTEDMODE"); break; + case DDERR_NOMIPMAPHW : sprintf(dderr, "DDERR_NOMIPMAPHW"); break; + case DDERR_INVALIDSURFACETYPE : sprintf(dderr, "DDERR_INVALIDSURFACETYPE"); break; + case DDERR_DCALREADYCREATED : sprintf(dderr, "DDERR_DCALREADYCREATED"); break; + case DDERR_CANTPAGELOCK : sprintf(dderr, "DDERR_CANTPAGELOCK"); break; + case DDERR_CANTPAGEUNLOCK : sprintf(dderr, "DDERR_CANTPAGEUNLOCK"); break; + case DDERR_NOTPAGELOCKED : sprintf(dderr, "DDERR_NOTPAGELOCKED"); break; + case DDERR_NOTINITIALIZED : sprintf(dderr, "DDERR_NOTINITIALIZED"); break; + + default : sprintf(dderr, "Unknown Error"); break; + } + sprintf(err, "DirectDraw Error %s\nin file %s at line %d", dderr, sFile, nLine); + RegError(err); +} + +//---------------------------------------------------------------------- +// +// Function : TraceErrorDS() +// +// Purpose : Traces an error (DirectSound) +// +//---------------------------------------------------------------------- + +void TraceErrorDS(HRESULT hErr, char *sFile, int nLine) +{ + char dserr[256]; + char err[1024]; + + switch (hErr) + { + case DSERR_ALLOCATED : sprintf(dserr, "DSERR_ALLOCATED"); break; + case DSERR_CONTROLUNAVAIL : sprintf(dserr, "DSERR_CONTROLUNAVAIL"); break; + case DSERR_INVALIDPARAM : sprintf(dserr, "DSERR_INVALIDPARAM"); break; + case DSERR_INVALIDCALL : sprintf(dserr, "DSERR_INVALIDCALL"); break; + case DSERR_GENERIC : sprintf(dserr, "DSERR_GENERIC"); break; + case DSERR_PRIOLEVELNEEDED : sprintf(dserr, "DSERR_PRIOLEVELNEEDED"); break; + case DSERR_OUTOFMEMORY : sprintf(dserr, "DSERR_OUTOFMEMORY"); break; + case DSERR_BADFORMAT : sprintf(dserr, "DSERR_BADFORMAT"); break; + case DSERR_UNSUPPORTED : sprintf(dserr, "DSERR_UNSUPPORTED"); break; + case DSERR_NODRIVER : sprintf(dserr, "DSERR_NODRIVER"); break; + case DSERR_ALREADYINITIALIZED : sprintf(dserr, "DSERR_ALREADYINITIALIZED"); break; + case DSERR_NOAGGREGATION : sprintf(dserr, "DSERR_NOAGGREGATION"); break; + case DSERR_BUFFERLOST : sprintf(dserr, "DSERR_BUFFERLOST"); break; + case DSERR_OTHERAPPHASPRIO : sprintf(dserr, "DSERR_OTHERAPPHASPRIO"); break; + case DSERR_UNINITIALIZED : sprintf(dserr, "DSERR_UNINITIALIZED"); break; + + default : sprintf(dserr, "Unknown Error"); break; + } + sprintf(err, "DirectSound Error %s\nin file %s at line %d", dserr, sFile, nLine); + RegError(err); +} + +//---------------------------------------------------------------------- +// +// Function : TraceErrorD3D() +// +// Purpose : Traces an error (Direct3D) +// +//---------------------------------------------------------------------- + +void TraceErrorD3D(HRESULT hErr, char *sFile, int nLine) +{ + char d3derr[256]; + char err[1024]; + + switch (hErr) + { + case D3DERR_BADMAJORVERSION : sprintf(d3derr, "D3DERR_BADMAJORVERSION"); break; + case D3DERR_BADMINORVERSION : sprintf(d3derr, "D3DERR_BADMINORVERSION"); break; + case D3DERR_EXECUTE_CREATE_FAILED : sprintf(d3derr, "D3DERR_EXECUTE_CREATE_FAILED"); break; + case D3DERR_EXECUTE_DESTROY_FAILED : sprintf(d3derr, "D3DERR_EXECUTE_DESTROY_FAILED"); break; + case D3DERR_EXECUTE_LOCK_FAILED : sprintf(d3derr, "D3DERR_EXECUTE_LOCK_FAILED"); break; + case D3DERR_EXECUTE_UNLOCK_FAILED : sprintf(d3derr, "D3DERR_EXECUTE_UNLOCK_FAILED"); break; + case D3DERR_EXECUTE_LOCKED : sprintf(d3derr, "D3DERR_EXECUTE_LOCKED"); break; + case D3DERR_EXECUTE_NOT_LOCKED : sprintf(d3derr, "D3DERR_EXECUTE_NOT_LOCKED"); break; + case D3DERR_EXECUTE_FAILED : sprintf(d3derr, "D3DERR_EXECUTE_FAILED"); break; + case D3DERR_EXECUTE_CLIPPED_FAILED : sprintf(d3derr, "D3DERR_EXECUTE_CLIPPED_FAILED"); break; + case D3DERR_TEXTURE_NO_SUPPORT : sprintf(d3derr, "D3DERR_TEXTURE_NO_SUPPORT"); break; + case D3DERR_TEXTURE_CREATE_FAILED : sprintf(d3derr, "D3DERR_TEXTURE_CREATE_FAILED"); break; + case D3DERR_TEXTURE_DESTROY_FAILED : sprintf(d3derr, "D3DERR_TEXTURE_DESTROY_FAILED"); break; + case D3DERR_TEXTURE_LOCK_FAILED : sprintf(d3derr, "D3DERR_TEXTURE_LOCK_FAILED"); break; + case D3DERR_TEXTURE_UNLOCK_FAILED : sprintf(d3derr, "D3DERR_TEXTURE_UNLOCK_FAILED"); break; + case D3DERR_TEXTURE_LOAD_FAILED : sprintf(d3derr, "D3DERR_TEXTURE_LOAD_FAILED"); break; + case D3DERR_TEXTURE_SWAP_FAILED : sprintf(d3derr, "D3DERR_TEXTURE_SWAP_FAILED"); break; + case D3DERR_TEXTURE_LOCKED : sprintf(d3derr, "D3DERR_TEXTURE_LOCKED"); break; + case D3DERR_TEXTURE_NOT_LOCKED : sprintf(d3derr, "D3DERR_TEXTURE_NOT_LOCKED"); break; + case D3DERR_TEXTURE_GETSURF_FAILED : sprintf(d3derr, "D3DERR_TEXTURE_GETSURF_FAILED"); break; + case D3DERR_MATRIX_CREATE_FAILED : sprintf(d3derr, "D3DERR_MATRIX_CREATE_FAILED"); break; + case D3DERR_MATRIX_DESTROY_FAILED : sprintf(d3derr, "D3DERR_MATRIX_DESTROY_FAILED"); break; + case D3DERR_MATRIX_SETDATA_FAILED : sprintf(d3derr, "D3DERR_MATRIX_SETDATA_FAILED"); break; + case D3DERR_MATRIX_GETDATA_FAILED : sprintf(d3derr, "D3DERR_MATRIX_GETDATA_FAILED"); break; + case D3DERR_SETVIEWPORTDATA_FAILED : sprintf(d3derr, "D3DERR_SETVIEWPORTDATA_FAILED"); break; + case D3DERR_MATERIAL_CREATE_FAILED : sprintf(d3derr, "D3DERR_MATERIAL_CREATE_FAILED"); break; + case D3DERR_MATERIAL_DESTROY_FAILED : sprintf(d3derr, "D3DERR_MATERIAL_DESTROY_FAILED"); break; + case D3DERR_MATERIAL_SETDATA_FAILED : sprintf(d3derr, "D3DERR_MATERIAL_SETDATA_FAILED"); break; + case D3DERR_MATERIAL_GETDATA_FAILED : sprintf(d3derr, "D3DERR_MATERIAL_GETDATA_FAILED"); break; + case D3DERR_LIGHT_SET_FAILED : sprintf(d3derr, "D3DERR_LIGHT_SET_FAILED"); break; + case D3DERR_SCENE_IN_SCENE : sprintf(d3derr, "D3DERR_SCENE_IN_SCENE"); break; + case D3DERR_SCENE_NOT_IN_SCENE : sprintf(d3derr, "D3DERR_SCENE_NOT_IN_SCENE"); break; + case D3DERR_SCENE_BEGIN_FAILED : sprintf(d3derr, "D3DERR_SCENE_BEGIN_FAILED"); break; + case D3DERR_SCENE_END_FAILED : sprintf(d3derr, "D3DERR_SCENE_END_FAILED"); break; + + default : sprintf(d3derr, "Unknown Error"); break; + } + sprintf(err, "Direct3D Error %s\nin file %s at line %d", d3derr, sFile, nLine); + RegError(err); +} + +//---------------------------------------------------------------------- +// +// Function : TraceErrorD3DRM() +// +// Purpose : Traces an error (Direct3D retained mode) +// +//---------------------------------------------------------------------- + +void TraceErrorD3DRM(HRESULT hErr, char *sFile, int nLine) +{ + char d3drmerr[256]; + char err[1024]; + + switch (hErr) + { + case D3DRMERR_BADOBJECT : sprintf(d3drmerr, "D3DRMERR_BADOBJECT"); break; + case D3DRMERR_BADTYPE : sprintf(d3drmerr, "D3DRMERR_BADTYPE"); break; + case D3DRMERR_BADALLOC : sprintf(d3drmerr, "D3DRMERR_BADALLOC"); break; + case D3DRMERR_FACEUSED : sprintf(d3drmerr, "D3DRMERR_FACEUSED"); break; + case D3DRMERR_NOTFOUND : sprintf(d3drmerr, "D3DRMERR_NOTFOUND"); break; + case D3DRMERR_NOTDONEYET : sprintf(d3drmerr, "D3DRMERR_NOTDONEYET"); break; + case D3DRMERR_FILENOTFOUND : sprintf(d3drmerr, "D3DRMERR_FILENOTFOUND"); break; + case D3DRMERR_BADFILE : sprintf(d3drmerr, "D3DRMERR_BADFILE"); break; + case D3DRMERR_BADDEVICE : sprintf(d3drmerr, "D3DRMERR_BADDEVICE"); break; + case D3DRMERR_BADVALUE : sprintf(d3drmerr, "D3DRMERR_BADVALUE"); break; + case D3DRMERR_BADMAJORVERSION : sprintf(d3drmerr, "D3DRMERR_BADMAJORVERSION"); break; + case D3DRMERR_BADMINORVERSION : sprintf(d3drmerr, "D3DRMERR_BADMINORVERSION"); break; + case D3DRMERR_UNABLETOEXECUTE : sprintf(d3drmerr, "D3DRMERR_UNABLETOEXECUTE"); break; + + default : sprintf(d3drmerr, "Unknown Error"); break; + } + sprintf(err, "Direct3D-RM Error : %s\nin file %s at line %d", d3drmerr, sFile, nLine); + RegError(err); +} + +//---------------------------------------------------------------------- +// +// Function : SortDisplayModes() +// +// Purpose : Sorts the list of display modes +// +//---------------------------------------------------------------------- + +void SortDisplayModes() +{ + // Sort by width * height + for (DWORD i = 0; i < g_dwNumModes; i ++) + { + for (DWORD k = 0; k < g_dwNumModes - 1; k ++) + { + int c1 = g_vidModes[k].width * g_vidModes[k].height; + int c2 = g_vidModes[k + 1].width * g_vidModes[k + 1].height; + + if (c1 > c2) + { + VideoMode tmp; + + // Swap the two video modes + tmp = g_vidModes[k]; + g_vidModes[k] = g_vidModes[k + 1]; + g_vidModes[k + 1] = tmp; + + // Keep g_dwCurrMode up to date + if (g_dwCurrMode == k) + { + g_dwCurrMode = k + 1; + } + else if (g_dwCurrMode == k + 1) + { + g_dwCurrMode = k; + } + } + } + } +} + +//---------------------------------------------------------------------- +// +// Function : DDEnumCallBack() +// +// Purpose : Call back to enumerate installed DirectDraw devices +// +//---------------------------------------------------------------------- + +BOOL FAR PASCAL DDEnumCallback(GUID FAR* lpGUID, LPSTR lpDriverDesc, LPSTR lpDriverName, LPVOID lpContext) +{ + LPDIRECTDRAW lpDD; + DDCAPS DriverCaps, HELCaps; + + // Make sure the guid is valid + if (lpGUID) + { + // Try to create a DirectDraw object + TRY_DD(DirectDrawCreate(lpGUID, &lpDD, NULL)) + + // Get the DirectDraw capabilities + memset(&DriverCaps, 0, sizeof(DDCAPS)); + DriverCaps.dwSize = sizeof(DDCAPS); + + memset(&HELCaps, 0, sizeof(DDCAPS)); + HELCaps.dwSize = sizeof(DDCAPS); + + TRY_DD(lpDD->GetCaps(&DriverCaps, &HELCaps)) + + // Does this driver have 3D hardware capabilites? + if (DriverCaps.dwCaps & DDCAPS_3D) + { + *(LPDIRECTDRAW*)lpContext = lpDD; + return DDENUMRET_CANCEL; + } + + *(LPDIRECTDRAW*)lpContext = NULL; + lpDD->Release(); + } + + // Yahoo! + return DDENUMRET_OK; +} + +//---------------------------------------------------------------------- +// +// Function : DDEnumDisplayModesCallBack() +// +// Purpose : Call back function to receive display mode information +// +//---------------------------------------------------------------------- + +HRESULT CALLBACK DDEnumDisplayModesCallback(LPDDSURFACEDESC pddsd, LPVOID Context) +{ + // While each mode gets enumerated we have to decide whether + // the 3D device and mode are compatible + if (g_deviceInfo.lpHWGuid) + { + // Make sure there is enough video ram to support this mode + //if hardware is in use + DWORD dwBitDepthMultiplier; + + switch(pddsd->ddpfPixelFormat.dwRGBBitCount) + { + case 8 : dwBitDepthMultiplier = 1; break; + case 16 : dwBitDepthMultiplier = 2; break; + case 24 : dwBitDepthMultiplier = 3; break; + case 32 : dwBitDepthMultiplier = 4; break; + } + + DWORD dwVidRamNeeded = ((pddsd->dwWidth * pddsd->dwHeight) * dwBitDepthMultiplier) * 3; + + if (dwVidRamNeeded > (g_driverCaps.dwVidMemFree + g_dwGDIMem)) + return DDENUMRET_OK; + + // Make sure the Direct3D device can render at a given bit depth + switch (pddsd->ddpfPixelFormat.dwRGBBitCount) + { + case 8 : + { + if (!(g_deviceInfo.HWDeviceDesc.dwDeviceRenderBitDepth & DDBD_8)) return DDENUMRET_OK; + } + break; + + case 16 : + { + if (!(g_deviceInfo.HWDeviceDesc.dwDeviceRenderBitDepth & DDBD_16)) return DDENUMRET_OK; + } + break; + + case 24 : + { + if (!(g_deviceInfo.HWDeviceDesc.dwDeviceRenderBitDepth & DDBD_24)) return DDENUMRET_OK; + } + break; + + case 32 : + { + if (!(g_deviceInfo.HWDeviceDesc.dwDeviceRenderBitDepth & DDBD_32)) return DDENUMRET_OK; + } + break; + } + + // If we have hardware, start up in 640x480x16 if possible + if ((pddsd->dwWidth == 640) && (pddsd->dwHeight == 480) && (pddsd->ddpfPixelFormat.dwRGBBitCount == 16)) + { + g_dwCurrMode = g_dwNumModes; + } + } + + // Record the video mode information + g_vidModes[g_dwNumModes].width = pddsd->dwWidth; + g_vidModes[g_dwNumModes].height = pddsd->dwHeight; + g_vidModes[g_dwNumModes].bpp = pddsd->ddpfPixelFormat.dwRGBBitCount; + + g_dwNumModes ++; + + return DDENUMRET_OK; +} + +//------------------------------------------------------------------ +// +// Function : D3DEnumDriverCallBack() +// +// Purpose : Enumeration Function +// +//------------------------------------------------------------------ + +HRESULT WINAPI D3DEnumDeviceCallBack(LPGUID lpGuid, + LPSTR lpDeviceDescription, + LPSTR lpDeviceName, + LPD3DDEVICEDESC lpHWDesc, + LPD3DDEVICEDESC lpHELDesc, + LPVOID lpContext) +{ + static BOOL bFoundHardwareDevice = FALSE; + + // No need to enumerate if we already found the device that supports + if (bFoundHardwareDevice) return D3DENUMRET_OK; + + D3DDeviceInfo* pInfo = (D3DDeviceInfo *)lpContext; + + // Is this a hardware device? + if (lpHWDesc->dcmColorModel & pInfo->cm) + { + // Driver needs to pass some tests.... + + // Make sure the driver has ZBuffering capabilities + if ((lpHWDesc->dwDeviceZBufferBitDepth & DDBD_16) || + (lpHWDesc->dwDeviceZBufferBitDepth & DDBD_24) || + (lpHWDesc->dwDeviceZBufferBitDepth & DDBD_32)) + { + // Record the HAL description for later use + memcpy(&pInfo->HWDeviceDesc, lpHWDesc, sizeof(D3DDEVICEDESC)); + + // Record the guid for later use + pInfo->lpHWGuid = lpGuid; + + // No need to keep looking for any more devices + bFoundHardwareDevice = TRUE; + } + + // Yahoo! + return D3DENUMRET_OK; + } + + // Is this a software device? + if (lpHELDesc->dcmColorModel & pInfo->cm) + { + // Record the HEL description for later use + memcpy(&pInfo->SWDeviceDesc, lpHELDesc, sizeof(D3DDEVICEDESC)); + + // Record the guid for later use + pInfo->lpSWGuid = lpGuid; + + g_lpD3DDeviceGuid = lpGuid; + } + + return D3DENUMRET_OK; +} + +//---------------------------------------------------------------------- +// +// Function : InitD3DDevice() +// +// Purpose : Performs initialisation for correct Direct3D device +// RGB, MONO, HAL etc +// +//---------------------------------------------------------------------- + +BOOL InitD3DDevice() +{ + memset(&g_deviceInfo, 0, sizeof(D3DDeviceInfo)); + + // Use RGB colour if in hardware, RAMP if in software + + // Record the colour model that we wish to search for in the structure passed + // to the enumeration call back + g_deviceInfo.cm = g_bHardware3D ? D3DCOLOR_RGB : D3DCOLOR_MONO;; + + // Enumerate the drivers + TRY_D3D(g_lpD3D->EnumDevices(D3DEnumDeviceCallBack, &g_deviceInfo)) + + // Test to see whether we have hardware or software + if (g_deviceInfo.lpHWGuid) + { + // We have a hardware driver! + + // Use a video memory based ZBuffer + g_dwZBufferMemType = DDSCAPS_VIDEOMEMORY; + + // Use 16 bit ZBuffering if possible, higher if not + if (g_deviceInfo.HWDeviceDesc.dwDeviceZBufferBitDepth & DDBD_16) + { + g_dwZBufferBitDepth = 16; + } + else if (g_deviceInfo.HWDeviceDesc.dwDeviceZBufferBitDepth & DDBD_24) + { + g_dwZBufferBitDepth = 24; + } + else if (g_deviceInfo.HWDeviceDesc.dwDeviceZBufferBitDepth & DDBD_32) + { + g_dwZBufferBitDepth = 32; + } + else + { + g_dwZBufferBitDepth = 0; + } + + // Use Hardware device + g_lpD3DDeviceGuid = g_deviceInfo.lpHWGuid; + } + else + { + // We have a software driver! + + // Use a system memory based ZBuffer + g_dwZBufferMemType = DDSCAPS_SYSTEMMEMORY; + + // And force the bit depth to 16 + g_dwZBufferBitDepth = 16; + + // Default to the software device + g_lpD3DDeviceGuid = g_deviceInfo.lpSWGuid; + } + + // Yahoo! + return TRUE; +} + +//---------------------------------------------------------------------- +// +// Function : InitDirectX() +// +// Purpose : Initialises DirectX (DirectDraw, Direct3D, Direct3DRM, DirectSound) +// +//---------------------------------------------------------------------- + +BOOL InitDirectX() +{ + FILE *fp; + BYTE pal[768]; + HRESULT rval; + DDSURFACEDESC ddsd; + + // Enumerate DirectDraw drivers to see what is installed, preferring one with + // Hardware 3D capabilities + TRY_DD(DirectDrawEnumerate(DDEnumCallback, &g_lpDD)) + + // If g_lpDD is NULL, there isn't a DirectDraw device with hardware 3D capabilities, + // so create a device using the HEL + if (!g_lpDD) + { + TRY_DD(DirectDrawCreate(NULL, &g_lpDD, NULL)) + } + + // NOTE : Exclusive mode would normally be set here but because of the splash + // screen being displayed it isn't. The reason is that the splash screen uses + // 640x480x8 and that mode may not be available if we are using a hardware 3D + // DirectDraw device. + + // Zero out caps structures + memset(&g_driverCaps, 0, sizeof(DDCAPS)); + g_driverCaps.dwSize = sizeof(DDCAPS); + + memset(&g_HELcaps, 0, sizeof(DDCAPS)); + g_HELcaps.dwSize = sizeof(DDCAPS); + + // Get the current display mode as we can use that memory when full + // screen exclusive + memset(&ddsd, 0, sizeof ddsd); + ddsd.dwSize = sizeof ddsd; + TRY_DD(g_lpDD->GetDisplayMode(&ddsd)); + g_dwGDIMem = ddsd.lPitch * ddsd.dwHeight * + (ddsd.ddpfPixelFormat.dwRGBBitCount / 8); + + // Get hardware capabilities + TRY_DD(g_lpDD->GetCaps(&g_driverCaps, &g_HELcaps)) + + // Global to determine whether we have hardware 3D capabilities or not + g_bHardware3D = g_driverCaps.dwCaps & DDCAPS_3D; + + // Create Direct3D object + TRY_D3D(g_lpDD->QueryInterface(IID_IDirect3D, (LPVOID *)&g_lpD3D)) + + // Enumerate Direct3D devices, preferring hardware rendering over software + if (!InitD3DDevice()) + { + RegError("Error locating suitable Direct3D driver!"); + return FALSE; + } + + // Enumerate all the display modes, this is done after locating the 3D device so + // that any mode that is not compatible with the 3D device does not get added to + // the list of valid modes. + TRY_DD(g_lpDD->EnumDisplayModes(0, NULL, NULL, DDEnumDisplayModesCallback)) + + // Sort display modes into lowest width * height first + SortDisplayModes(); + + // Create Direct3D RM object + TRY_D3DRM(Direct3DRMCreate(&g_lpD3DRM)) + + // Set default amount of texture colours + g_lpD3DRM->SetDefaultTextureColors(16); + + // Set default amount of texture shades + g_lpD3DRM->SetDefaultTextureShades(16); + + // Create DirectSound object + rval = DirectSoundCreate(NULL, &g_lpDS, NULL); + + // Determine whether sound is present + g_bSoundPresent = rval == DS_OK ? TRUE : FALSE; + + if (g_bSoundPresent) + { + // Set the DirectSound cooperative level + TRY_DS(g_lpDS->SetCooperativeLevel(g_hWnd, DSSCL_NORMAL)) + + // Create the Direct 3D Sound Buffer + g_3DSoundBuffer = CreateSoundBuffer3D(); + if(g_3DSoundBuffer == NULL) + { + RegError("Not able to create Direct 3D Sound Buffer"); + return FALSE; + } + // Query interface for Direct 3D Sound Listener object + if(DS_OK != g_3DSoundBuffer->QueryInterface(IID_IDirectSound3DListener, (void**)&g_lpDs3dListener)) + { + RegError("Not able to create Direct 3D Sound Listener object"); + return FALSE; + } + // Set the Direct 3D Sound Rolloff Factor + g_lpDs3dListener->SetRolloffFactor(.01,DS3D_DEFERRED); + // Change listener's orientation + g_lpDs3dListener->SetOrientation(-D3DVAL(1), D3DVAL(0), D3DVAL(0), D3DVAL(0), D3DVAL(1), D3DVAL(0),DS3D_DEFERRED); + // Commit the changes to Rolloff Factor and orientation + g_lpDs3dListener->CommitDeferredSettings(); + + // Null out all the sound pointers + for (int i = 0; i < NUM_SOUNDS; i ++) + { + g_lpSounds[i] = NULL; + } + + // Load the sounds + if (!CreateBufferFromWaveFile("INTRO.WAV", INTRO)) + { + RegError("Couldn't load INTRO.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("PUNCH1.WAV", PLAYER1_PUNCH1)) + { + RegError("Couldn't load PUNCH1.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("PUNCH3.WAV", PLAYER1_PUNCH2)) + { + RegError("Couldn't load PUNCH3.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("PUNCH2.WAV", PLAYER2_PUNCH1)) + { + RegError("Couldn't load PUNCH2.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("PUNCH4.WAV", PLAYER2_PUNCH2)) + { + RegError("Couldn't load PUNCH4.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("WALK0.WAV", PLAYER1_WALK)) + { + RegError("Couldn't load WALK0.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("WALK1.WAV", PLAYER2_WALK)) + { + RegError("Couldn't load WALK1.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("WHOOSH1.WAV", WHOOSH1)) + { + RegError("Couldn't load WHOOSH1.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("WHOOSH2.WAV", WHOOSH2)) + { + RegError("Couldn't load WHOOSH2.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("DEFEND1.WAV", PLAYER1_OUCH)) + { + RegError("Couldn't load DEFEND1.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("DEFEND2.WAV", PLAYER2_OUCH)) + { + RegError("Couldn't load DEFEND2.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("HEAD.WAV", HEAD_SPRING)) + { + RegError("Couldn't load HEAD.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("BLOCK1.WAV", BLOCK1)) + { + RegError("Couldn't load BLOCK1.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("BLOCK2.WAV", BLOCK2)) + { + RegError("Couldn't load BLOCK2.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("BLOCK3.WAV", BLOCK3)) + { + RegError("Couldn't load BLOCK3.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("CLOOP.WAV", CROWD_LOOP)) + { + RegError("Couldn't load CLOOP.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("CBOO.WAV", VICTORY_BOO)) + { + RegError("Couldn't load CBOO.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("CYEAH.WAV", VICTORY_YEAH)) + { + RegError("Couldn't load CYEAH.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("REVUP1.WAV", SERVO_UP_1)) + { + RegError("Couldn't load REVUP1.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("REVUP2.WAV", SERVO_UP_2)) + { + RegError("Couldn't load REVUP2.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("REVUP3.WAV", SERVO_UP_3)) + { + RegError("Couldn't load REVUP3.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("REVDN1.WAV", SERVO_DOWN_1)) + { + RegError("Couldn't load REVDOWN1.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("REVDN2.WAV", SERVO_DOWN_2)) + { + RegError("Couldn't load REVDOWN2.WAV!"); + return FALSE; + } + + if (!CreateBufferFromWaveFile("REVDN3.WAV", SERVO_DOWN_3)) + { + RegError("Couldn't load REVDOWN3.WAV!"); + return FALSE; + } + if (!CreateBufferFromWaveFile("RANDOM1.WAV", RANDOM1)) + { + RegError("Couldn't load RANDOM1.WAV!"); + return FALSE; + } + if (!CreateBufferFromWaveFile("RANDOM2.WAV", RANDOM2)) + { + RegError("Couldn't load RANDOM2.WAV!"); + return FALSE; + } + if (!CreateBufferFromWaveFile("RANDOM3.WAV", RANDOM3)) + { + RegError("Couldn't load RANDOM3.WAV!"); + return FALSE; + } + if (!CreateBufferFromWaveFile("RANDOM4.WAV", RANDOM4)) + { + RegError("Couldn't load RANDOM4.WAV!"); + return FALSE; + } + if (!CreateBufferFromWaveFile("RANDOM5.WAV", RANDOM5)) + { + RegError("Couldn't load RANDOM5.WAV!"); + return FALSE; + } + if (!CreateBufferFromWaveFile("RANDOM6.WAV", RANDOM6)) + { + RegError("Couldn't load RANDOM6.WAV!"); + return FALSE; + } + } + + // Load Rockem3D's palette + fp = fopen("ROCKEM3D.PAL", "rb"); + if (!fp) + { + RegError("Couldn't load ROCKEM3D.PAL!"); + return FALSE; + } + + // Read in the raw rgb's + fread(pal, 768, 1, fp); + + // Close the file + fclose(fp); + + // Set up palette + g_rPal[0].peFlags = D3DPAL_READONLY; + g_rPal[253].peFlags = D3DPAL_READONLY; + g_rPal[254].peFlags = D3DPAL_READONLY; + g_rPal[255].peFlags = D3DPAL_READONLY; + + for (int i = 1; i < 253; i++) + { + g_rPal[i].peRed = pal[i * 3]; + g_rPal[i].peGreen = pal[(i * 3) + 1]; + g_rPal[i].peBlue = pal[(i * 3) + 2]; + g_rPal[i].peFlags = D3DPAL_READONLY; + } + + // Set the entries 253 and 254 to a colour for the power bars + g_rPal[253].peRed = 0; + g_rPal[253].peGreen = 0; + g_rPal[253].peBlue = 255; + + g_rPal[254].peRed = 255; + g_rPal[254].peGreen = 0; + g_rPal[254].peBlue = 0; + + // Yahoo! + return TRUE; +} + +//---------------------------------------------------------------------- +// +// Function : SetDirectDrawExclusiveMode() +// +// Purpose : Sets exclusive mode for DirectDraw +// +//---------------------------------------------------------------------- + +BOOL SetDirectDrawExclusiveMode() +{ + TRY_DD(g_lpDD->SetCooperativeLevel(g_hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX)) + + // Yahoo! + return TRUE; +} + + +//---------------------------------------------------------------------- +// +// Function : TermDirectX() +// +// Purpose : Destroys all the DirectX objects +// +//---------------------------------------------------------------------- + +void TermDirectX() +{ + // Destroy everything in the reverse order in which they were created + int i; + + // Destroy rendering device + if (g_lpD3DDevice) + { + g_lpD3DDevice->Release(); + g_lpD3DDevice = NULL; + } + + // Destroy all surfaces + if (g_lpZBuffer) + { + g_lpZBuffer->Release(); + g_lpZBuffer = NULL; + } + + if (g_lpBackBuffer) + { + g_lpBackBuffer->Release(); + g_lpBackBuffer = NULL; + } + + if (g_lpPrimary) + { + g_lpPrimary->Release(); + g_lpPrimary = NULL; + } + + // Restore the original video mode + if(g_lpDD) + g_lpDD->RestoreDisplayMode(); + + // Destroy sounds + for (i = 0; i < NUM_SOUNDS; i ++) + { + if (g_lpSounds[i]) + { + g_lpSounds[i]->Release(); + g_lpSounds[i] = NULL; + } + } + + // Destroy DirectSound3D buffers + for (i = 0; i < NUM_SOUNDS; i ++) + { + if (g_lp3dSounds[i]) + { + g_lp3dSounds[i]->Release(); + g_lp3dSounds[i] = NULL; + } + } + + // Destroy DirectSound3D Listener object + if (g_lpDs3dListener) + { + g_lpDs3dListener->Release(); + g_lpDs3dListener = NULL; + } + // Destroy DirectSound3D Primary buffer + if (g_3DSoundBuffer) + { + g_3DSoundBuffer->Release(); + g_3DSoundBuffer = NULL; + } + + // Destroy DirectSound object + if (g_lpDS) + { + g_lpDS->Release(); + g_lpDS = NULL; + } + + // Destroy Direct3D RM object + if (g_lpD3DRM) + { + g_lpD3DRM->Release(); + g_lpD3DRM = NULL; + } + + // Destroy Direct3D object + if (g_lpD3D) + { + g_lpD3D->Release(); + g_lpD3D = NULL; + } + + // Destroy DirectDraw object + if (g_lpDD) + { + g_lpDD->Release(); + g_lpDD = NULL; + } +} + +//---------------------------------------------------------------------- +// +// Function : EnterVideoMode() +// +// Purpose : Calls EnterVideoModeWHBD with mode information +// +//---------------------------------------------------------------------- + +BOOL EnterVideoMode(int mode) +{ + int width = g_vidModes[mode].width; + int height = g_vidModes[mode].height; + int bitdepth = g_vidModes[mode].bpp; + g_dwCurrMode = mode; + + // Try to enter video mode described by width, height and bitdepth + return EnterVideoModeWHBD(width, height, bitdepth); +} + +//---------------------------------------------------------------------- +// +// Function : EnterVideoModeWHBD() +// +// Purpose : Switches video mode and creates all neccessary structures +// required for rendering +// +//---------------------------------------------------------------------- + +BOOL EnterVideoModeWHBD(int width, int height, int bitdepth) +{ + DDSURFACEDESC ddsd; + DDSCAPS ddscaps; + + // Destroy all existing viewports, devices and surfaces + + // Destroy Direct3D RM viewport + if (g_lpD3DRMViewport) + { + g_lpD3DRMViewport->Release(); + g_lpD3DRMViewport = NULL; + } + + // Destroy Direct3D RM device + if (g_lpD3DRMDevice) + { + g_lpD3DRMDevice->Release(); + g_lpD3DRMDevice = NULL; + } + + // Destroy Direct3D device + if (g_lpD3DDevice) + { + g_lpD3DDevice->Release(); + g_lpD3DDevice = NULL; + } + + // Destroy ZBuffer + if (g_lpZBuffer) + { + g_lpZBuffer->Release(); + g_lpZBuffer = NULL; + } + + // Destroy Primary surface + if (g_lpPrimary) + { + g_lpPrimary->Release(); + g_lpPrimary = NULL; + } + + // Switch video mode + TRY_DD(g_lpDD->SetDisplayMode(width, height, bitdepth)) + + // First, create complex flipping primary surface + + // Fill out surface description + memset(&ddsd, sizeof(DDSURFACEDESC), 0); + ddsd.dwSize = sizeof(DDSURFACEDESC); + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX | DDSCAPS_3DDEVICE; + ddsd.dwBackBufferCount = 1; + + // Create the primary surface with 1 back buffer + TRY_DD(g_lpDD->CreateSurface(&ddsd, &g_lpPrimary, NULL)) + + // Get pointer to back buffer + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + TRY_DD(g_lpPrimary->GetAttachedSurface(&ddscaps, &g_lpBackBuffer)) + + // Only create a ZBuffer if g_dwZBufferBitDepth > 0 + if (g_dwZBufferBitDepth) + { + // Then, create Z-Buffer. The g_dwZBufferMemType and g_dwZBufferBitDepth variables + // are set up when the Direct3D device enumeration is done at runtime + memset(&ddsd, sizeof(DDSURFACEDESC), 0); + ddsd.dwSize = sizeof(DDSURFACEDESC); + ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_ZBUFFERBITDEPTH;; + ddsd.dwWidth = width; + ddsd.dwHeight = height; + ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | g_dwZBufferMemType; + ddsd.dwZBufferBitDepth = g_dwZBufferBitDepth; + + // Create the ZBuffer + TRY_DD(g_lpDD->CreateSurface(&ddsd, &g_lpZBuffer, NULL)) + + // Attach ZBuffer to the back buffer + TRY_DD(g_lpBackBuffer->AddAttachedSurface(g_lpZBuffer)) + } + + // Retrieve the caps of the primary surface + TRY_DD(g_lpPrimary->GetCaps(&ddscaps)) + + // Create and attach palette (only if we in 8-bit palettized colour modes) + if ((bitdepth == 8) && (ddscaps.dwCaps & DDCAPS_PALETTE)) + { + // Create the palette + TRY_DD(g_lpDD->CreatePalette(DDPCAPS_8BIT | DDPCAPS_INITIALIZE, g_rPal, &g_lpPalette, NULL)) + + // Set the back buffer's palette + TRY_DD(g_lpBackBuffer->SetPalette(g_lpPalette)) + + // Set the primary surface's palette + TRY_DD(g_lpPrimary->SetPalette(g_lpPalette)) + } + + // Create Direct3D device + TRY_D3D(g_lpBackBuffer->QueryInterface(*g_lpD3DDeviceGuid, (LPVOID *)&g_lpD3DDevice)) + + // Create Direct3D RM Device from Direct3D Device + TRY_D3DRM(g_lpD3DRM->CreateDeviceFromD3D(g_lpD3D, g_lpD3DDevice, &g_lpD3DRMDevice)) + + // Set the buffer count to 2 so D3DRM can keep track of extents for fullscreen flipping surface + TRY_D3DRM(g_lpD3DRMDevice->SetBufferCount(2)) + + // Render using gouraud shading + g_lpD3DRMDevice->SetQuality(D3DRMRENDER_GOURAUD); + + // And no dithering please (NOTE : dithering is for looks not speed!) + g_lpD3DRMDevice->SetDither(FALSE); + + // Set texture quality + g_lpD3DRMDevice->SetTextureQuality(D3DRMTEXTURE_NEAREST); + + // Set the number of shades for lighting + g_lpD3DRMDevice->SetShades(8); + + // Create RM viewport from device and camera (camera has already been initialised + // by InitScene() in RM.CPP) + TRY_D3DRM(g_lpD3DRM->CreateViewport(g_lpD3DRMDevice, + g_lpCamera, + 0, + 0, + width, + height, + &g_lpD3DRMViewport)) + + // Set the back clipping plane to be something fairly large + g_lpD3DRMViewport->SetBack(D3DVAL(30000.0f)); + + // Diddle with the lights depending on what driver we are using + switch (g_deviceInfo.cm) + { + case D3DCOLOR_MONO : + { + // Enable the directional light only to hit the players, not the arena + g_lpDir->SetEnableFrame(g_lpPlayers); + } + break; + + case D3DCOLOR_RGB : + { + // Enable the directional light to hit all objects + g_lpDir->SetEnableFrame(g_lpScene); + } + break; + } + + // Record video mode information + g_vidModeX = width; + g_vidModeY = height; + g_vidModeBIT = bitdepth; + + // And calculate values for the power bars + g_xratio = (float)width / 1000.0f; + g_yratio = (float)height / 1000.0f; + + g_lbar1 = (DWORD)(float)(50.0f * g_xratio); + g_wbar1 = (DWORD)(float)(400.0f * g_xratio); + g_lbar2 = (DWORD)(float)(550.0f * g_xratio); + g_wbar2 = g_wbar1; + g_hbar1 = (DWORD)(float)(30.0f * g_yratio); + g_hbar2 = (DWORD)(float)(20.0f * g_yratio); + + // Finally, calculate the height of the current font + HDC hDC; + hDC = ::GetDC(g_hWnd); + + TEXTMETRIC txtMetric; + GetTextMetrics(hDC, &txtMetric); + + ::ReleaseDC(g_hWnd, hDC); + + g_dwFontHeight = txtMetric.tmHeight; + g_dwAveCharWidth = txtMetric.tmAveCharWidth; + + // Yahoo! + return TRUE; +} + +//---------------------------------------------------------------------- +// +// Function : EnterPrevVideoMode() +// +// Purpose : Enters previous mode in vidModes[] +// +//---------------------------------------------------------------------- + +BOOL EnterPrevVideoMode() +{ + if (g_dwCurrMode > 0) + { + return EnterVideoMode(-- g_dwCurrMode); + } + + return TRUE; +} + +//---------------------------------------------------------------------- +// +// Function : EnterNextVideoMode() +// +// Purpose : Enters nextmode in vidModes[] +// +//---------------------------------------------------------------------- + +BOOL EnterNextVideoMode() +{ + if (g_dwCurrMode < g_dwNumModes - 1) + { + return EnterVideoMode(++ g_dwCurrMode); + } + + return TRUE; +} + +//---------------------------------------------------------------------- +// +// Function : EnterLowestVideoMode() +// +// Purpose : Enters lowest mode in vidModes[] +// +//---------------------------------------------------------------------- + +BOOL EnterLowestVideoMode() +{ + return EnterVideoMode(0); +} + +//---------------------------------------------------------------------- +// +// Function : EnterHighestVideoMode() +// +// Purpose : Enters highest mode in vidModes[] +// +//---------------------------------------------------------------------- + +BOOL EnterHighestVideoMode() +{ + return EnterVideoMode(g_dwNumModes - 1); +} + +//---------------------------------------------------------------------- +// +// Function : ReenterVideoMode() +// +// Purpose : Re-enters current video mode +// +//---------------------------------------------------------------------- + +BOOL ReenterCurrentVideoMode() +{ + return EnterVideoMode(g_dwCurrMode); +} + +//---------------------------------------------------------------------- +// +// Function : CleanUp() +// +// Purpose : Destroys all surfaces and rendering devices +// +//---------------------------------------------------------------------- + +void CleanUp() +{ + // Destroy everything in the reverse order that they were created + + // Destroy viewport + if (g_lpD3DRMViewport) + { + g_lpD3DRMViewport->Release(); + g_lpD3DRMViewport = NULL; + } + + // Destroy rendering devices + if (g_lpD3DRMDevice) + { + g_lpD3DRMDevice->Release(); + g_lpD3DRMDevice = NULL; + } + + if (g_lpD3DDevice) + { + g_lpD3DDevice->Release(); + g_lpD3DDevice = NULL; + } + + // Destroy all surfaces + if (g_lpZBuffer) + { + g_lpZBuffer->Release(); + g_lpZBuffer = NULL; + } + + if (g_lpBackBuffer) + { + g_lpBackBuffer->Release(); + g_lpBackBuffer = NULL; + } + + if (g_lpPrimary) + { + g_lpPrimary->Release(); + g_lpPrimary = NULL; + } + + // Destroy palette + if (g_lpPalette) + { + g_lpPalette->Release(); + g_lpPalette = NULL; + } + + // Restore the original video mode + g_lpDD->RestoreDisplayMode(); +} + +//---------------------------------------------------------------------- +// +// Function : DoSplashScreen() +// +// Purpose : Draws splash screen (if possible) +// +//---------------------------------------------------------------------- + +BOOL DoSplashScreen(DWORD delay) +{ + LPDIRECTDRAWSURFACE backbuffer = NULL; + DDSURFACEDESC ddsd; + DDSCAPS ddscaps; + HRESULT rval; + DWORD dwStart; + int i; + FILE *fp; + BYTE rgbs[768], scanbuf[640]; + void *lpSurf; + BYTE *pSurf; + DWORD dummy; + + delay; + + // Create a DirectDraw device + rval = DirectDrawCreate(NULL, &g_lpSplashDD, NULL); + if (rval != DD_OK) goto fail; + + // Set cooperative level + rval = g_lpSplashDD->SetCooperativeLevel(g_hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + if (rval != DD_OK) goto fail; + + // Attempt to enter 640x480x8 + // Switch video mode + rval = g_lpSplashDD->SetDisplayMode(640, 480, 8); + if (rval != DD_OK) goto fail; + + // Create complex flipping primary surface + + // Clear surface caps structure + memset(&ddscaps, 0, sizeof(DDSCAPS)); + + // Fill out surface description + memset(&ddsd, sizeof(DDSURFACEDESC), 0); + ddsd.dwSize = sizeof(DDSURFACEDESC); + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; + ddsd.dwBackBufferCount = 1; + + // Create the primary surface with 1 back buffer + rval = g_lpSplashDD->CreateSurface(&ddsd, &g_lpSplashPrimary, NULL); + if (rval != DD_OK) goto fail; + + // Get pointer to back buffer + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + rval = g_lpSplashPrimary->GetAttachedSurface(&ddscaps, &backbuffer); + if (rval != DD_OK) goto fail; + + // Open the splash screen file + fp = fopen("ROCKEM3D.BIN", "rb"); + if (!fp) goto fail; + + memset(&ddsd, 0, sizeof(DDSURFACEDESC)); + ddsd.dwSize = sizeof(DDSURFACEDESC); + + // Lock the backbuffer to get a pointer to it + rval = backbuffer->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR, NULL); + if (rval != DD_OK) goto fail; + + // Read the image into the backbuffer + lpSurf = ddsd.lpSurface; + + // Read in lines of image, accounting for pitch + pSurf = (BYTE *)lpSurf; + + // Read first dword from .BIN file, that corresponds to WIDTH and HEIGHT (two words) + fread(&dummy, 4, 1, fp); + + for (i = 0; i < 480; i ++) + { + fread(scanbuf, 640, 1, fp); + memcpy(pSurf, scanbuf, 640); + pSurf += ddsd.lPitch; + } + + // Close the file + fclose(fp); + + // Unlock the surface + rval = backbuffer->Unlock(lpSurf); + if (rval != DD_OK) goto fail; + + // Set up the palette + fp = fopen("SPLASH.PAL", "rb"); + if (!fp) goto fail; + + fread(rgbs, 768, 1, fp); + fclose(fp); + + // Set up the PALETTEENTRY's from the 768 byte RGB array + PALETTEENTRY ppe[256]; + for (i = 0; i < 256; i ++) + { + ppe[i].peRed = rgbs[i * 3]; + ppe[i].peGreen = rgbs[(i * 3) + 1]; + ppe[i].peBlue = rgbs[(i * 3) + 2]; + ppe[i].peFlags = PC_NOCOLLAPSE; + } + + // Create the palette + //rval = g_lpDD->CreatePalette(DDPCAPS_8BIT | DDPCAPS_INITIALIZE, ppe, &g_lpPalette, NULL); + rval = g_lpSplashDD->CreatePalette(DDPCAPS_8BIT | DDPCAPS_INITIALIZE, ppe, &g_lpSplashPalette, NULL); + if (rval != DD_OK) goto fail; + + // Set the backbuffer's palette + rval = g_lpSplashPrimary->SetPalette(g_lpSplashPalette); + if (rval != DD_OK) goto fail; + + // And flip the splash screen into view + rval = g_lpSplashPrimary->Flip(NULL, DDFLIP_WAIT); + if (rval != DD_OK) goto fail; + + // Wait for delay milliseconds or a specific keypress + dwStart = timeGetTime(); + + while (timeGetTime() - dwStart < delay) + { + if (GetAsyncKeyState(VK_SPACE) & 0x8000) break; + if (GetAsyncKeyState(VK_RETURN) & 0x8000) break; + if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) break; + if ((GetAsyncKeyState(VK_MENU) & 0x8000) && (GetAsyncKeyState(VK_F4) & 0x8000)) break; + } + + backbuffer->Release(); + + // Yahoo! + return TRUE; + + fail: + + // Close file + if (fp) + { + fclose(fp); + } + + // Release palette + if (g_lpSplashPalette) + { + g_lpSplashPalette->Release(); + g_lpSplashPalette = NULL; + } + + // Release primary surface + if (g_lpSplashPrimary) + { + g_lpSplashPrimary->Release(); + g_lpSplashPrimary = NULL; + } + + if (g_lpSplashDD) + { + g_lpSplashDD->Release(); + g_lpSplashDD = NULL; + } + + // Yahoo! + return FALSE; +} + + +//---------------------------------------------------------------------- +// +// Function : ReleaseSplashScreen() +// +// Purpose : Releases the splash screen +// +//---------------------------------------------------------------------- + +void ReleaseSplashScreen() +{ + // Release palette + if (g_lpSplashPalette) + { + g_lpSplashPalette->Release(); + g_lpSplashPalette = NULL; + } + + // Release primary surface + if (g_lpSplashPrimary) + { + g_lpSplashPrimary->Release(); + g_lpSplashPrimary = NULL; + } + + if (g_lpSplashDD) + { + g_lpSplashDD->Release(); + g_lpSplashDD = NULL; + } +} + + +//---------------------------------------------------------------------- +// +// Function : RestoreSurfaces() +// +// Purpose : Restores all surfaces if they somehow got lost (Alt-Tab) +// +//---------------------------------------------------------------------- + +BOOL RestoreSurfaces() +{ + // Attempt to restore primary surface + if (g_lpPrimary) + { + if (g_lpPrimary->IsLost()) TRY_DD(g_lpPrimary->Restore()) + } + + // Attempt to restore zbuffer + if (g_lpZBuffer) + { + if (g_lpZBuffer->IsLost()) TRY_DD(g_lpZBuffer->Restore()) + } + + // Yahoo! + return TRUE; +} + +//---------------------------------------------------------------------- +// +// Function : CreateSoundBuffer() +// +// Purpose : Creates a DirectSound buffer +// +//---------------------------------------------------------------------- + +BOOL CreateSoundBuffer(DWORD dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo) +{ + PCMWAVEFORMAT pcmwf; + DSBUFFERDESC dsbdesc; + + // Set up wave format structure. + memset( &pcmwf, 0, sizeof(PCMWAVEFORMAT) ); + pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM; + pcmwf.wf.nChannels = bStereo ? 2 : 1; + pcmwf.wf.nSamplesPerSec = dwFreq; + pcmwf.wf.nBlockAlign = (WORD)dwBlkAlign; + pcmwf.wf.nAvgBytesPerSec = pcmwf.wf.nSamplesPerSec * pcmwf.wf.nBlockAlign; + pcmwf.wBitsPerSample = (WORD)dwBitsPerSample; + + // Set up DSBUFFERDESC structure. + memset(&dsbdesc, 0, sizeof(DSBUFFERDESC)); // Zero it out. + dsbdesc.dwSize = sizeof(DSBUFFERDESC); + dsbdesc.dwFlags = DSBCAPS_CTRL3D; // Needed creation flag for Direct 3D Sound + dsbdesc.dwBufferBytes = dwBufSize; + dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf; + + TRY_DS(g_lpDS->CreateSoundBuffer(&dsbdesc, &g_lpSounds[dwBuf], NULL)) + + // Query for the 3D Sound Buffer interface. + TRY_DS(g_lpSounds[dwBuf]->QueryInterface(IID_IDirectSound3DBuffer, (void**) &g_lp3dSounds[dwBuf])); + + // Yahoo! + return TRUE; +} + +//---------------------------------------------------------------------- +// +// Function : ReadData() +// +// Purpose : Reads in data from a wave file +// +//---------------------------------------------------------------------- + +BOOL ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos) +{ + // Seek to correct position in file (if necessary) + if (dwPos != 0xffffffff) + { + if (fseek(pFile, dwPos, SEEK_SET) != 0) + { + return FALSE; + } + } + + // Lock data in buffer for writing + LPVOID pData1; + DWORD dwData1Size; + LPVOID pData2; + DWORD dwData2Size; + HRESULT rval; + + rval = lpDSB->Lock(0, dwSize, &pData1, &dwData1Size, &pData2, &dwData2Size, DSBLOCK_FROMWRITECURSOR); + if (rval != DS_OK) + { + return FALSE; + } + + // Read in first chunk of data + if (dwData1Size > 0) + { + if (fread(pData1, dwData1Size, 1, pFile) != 1) + { + char holder[256]; + wsprintf(holder,"Data1 : %d, dwdata: %d, pFile: %d",pData1,dwData1Size,pFile); + OutputDebugString(holder); + return FALSE; + } + } + + // read in second chunk if necessary + if (dwData2Size > 0) + { + if (fread(pData2, dwData2Size, 1, pFile) != 1) + { + return FALSE; + } + } + + // Unlock data in buffer + rval = lpDSB->Unlock(pData1, dwData1Size, pData2, dwData2Size); + if (rval != DS_OK) + { + return FALSE; + } + + // Yahoo! + return TRUE; +} + +//---------------------------------------------------------------------- +// +// Function : CreateSoundBufferFromWaveFile() +// +// Purpose : Creates a DirectSound buffer from a wave file +// +//---------------------------------------------------------------------- + +BOOL CreateBufferFromWaveFile(char* FileName, DWORD dwBuf) +{ + // Open the wave file + FILE* pFile = fopen(FileName,"rb"); + if (pFile == NULL) return FALSE; + + // Read in the wave header + WaveHeader wavHdr; + if (fread(&wavHdr, sizeof(wavHdr), 1, pFile) != 1) + { + fclose(pFile); + return NULL; + } + + // Figure out the size of the data region + DWORD dwSize = wavHdr.dwDSize; + + // Is this a stereo or mono file? + BOOL bStereo = wavHdr.wChnls > 1 ? TRUE : FALSE; + + // Create the sound buffer for the wave file + if (!CreateSoundBuffer(dwBuf, dwSize, wavHdr.dwSRate, wavHdr.BitsPerSample, wavHdr.wBlkAlign, bStereo)) + { + // Close the file + fclose(pFile); + + return FALSE; + } + + // Read the data for the wave file into the sound buffer + if (!ReadData(g_lpSounds[dwBuf], pFile, dwSize, sizeof(wavHdr))) + { + fclose(pFile); + return FALSE; + } + + // Close out the wave file + fclose(pFile); + + // Yahoo! + return TRUE; +} + +//---------------------------------------------------------------------- +// +// Function : StopAllSounds() +// +// Purpose : Stops all sounds +// +//---------------------------------------------------------------------- + +BOOL StopAllSounds() +{ + // Make sure we have a valid sound buffer + for (int i = 0; i < NUM_SOUNDS; i ++) + { + if (g_lpSounds[i]) + { + DWORD dwStatus; + TRY_DS(g_lpSounds[i]->GetStatus(&dwStatus)); + + if ((dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING) + { + // Play the sound + TRY_DS(g_lpSounds[i]->Stop()) + } + } + } + + // Yahoo! + return TRUE; +} + +//---------------------------------------------------------------------- +// +// Function : PlaySoundDS() +// +// Purpose : Plays a sound using direct sound +// +// D3DVECTOR +//---------------------------------------------------------------------- + +BOOL PlaySoundDS(DWORD dwSound,D3DVECTOR d3dvPos, DWORD dwFlags) +{ + + if (g_bSoundPaused) return TRUE; + + if (!g_bSoundPresent) return TRUE; + + // Make sure the sound is valid + if (dwSound >= NUM_SOUNDS) return FALSE; + + // Make sure we have a valid sound buffer + if (g_lpSounds[dwSound]) + { + DWORD dwStatus; + TRY_DS(g_lpSounds[dwSound]->GetStatus(&dwStatus)); + + if ((dwStatus & DSBSTATUS_PLAYING) != DSBSTATUS_PLAYING) + { + // Set the 3D position of the sound, using supplied position vector. + TRY_DS(g_lp3dSounds[dwSound]->SetPosition(d3dvPos.x, d3dvPos.y, d3dvPos.z, DS3D_IMMEDIATE)); + // Play the sound + TRY_DS(g_lpSounds[dwSound]->Play(0, 0, dwFlags)); + } + } + + // Yahoo! + return TRUE; +} + +//---------------------------------------------------------------------- +// +// Function : RecalcPowerBars() +// +// Purpose : Calculates width of power bars based upon current +// screen resolution +// +//---------------------------------------------------------------------- + +void RecalcPowerBars(DWORD player1health, DWORD player2health) +{ + g_wbar1 = (DWORD)(float)((400.0f * ((float)player1health / 100.0f)) * g_xratio); + g_wbar2 = (DWORD)(float)((400.0f * ((float)player2health / 100.0f)) * g_xratio); +} + + + +//---------------------------------------------------------------------- +// +// Function : CreateSoundBuffer3D() +// +// Purpose : Creates a 3D sound buffer and returns the sound buffer +// +//---------------------------------------------------------------------- + +IDirectSoundBuffer *CreateSoundBuffer3D() +{ + IDirectSoundBuffer *pDSB = NULL; + DSBUFFERDESC dsBD = {0}; + + ZeroMemory( &dsBD, sizeof(DSBUFFERDESC)); + dsBD.dwSize = sizeof(dsBD); + dsBD.dwFlags = DSBCAPS_CTRL3D | DSBCAPS_PRIMARYBUFFER; + dsBD.dwBufferBytes = 0; //must be zero for primary buffer.. + + if (g_lpDS->CreateSoundBuffer(&dsBD, &pDSB, NULL) != DS_OK) + pDSB = NULL; + + return pDSB; +} + +//---------------------------------------------------------------------- +// +// Function : PlayRandomWave() +// +// Purpose : Creates a random wave at a random spot +// +//---------------------------------------------------------------------- + +int CALLBACK PlayRandomWave() +{ + D3DVECTOR d3dPosition; // DSVECTOR used for the positon of the wave... + + int RandomWave[]={RANDOM1,RANDOM2,RANDOM3,RANDOM4,RANDOM5,RANDOM6}; + + g_lpCamera->GetPosition(g_lpScene, &d3dPosition); + // fill in the position generated for the wave file. + d3dPosition.x += (rand() % 2 == 0 ? (rand() % 250) : -(rand() % 250)); + d3dPosition.z += (rand() % 2 == 0 ? (rand() % 250) : -(rand() % 250)); + + PlaySoundDS(RandomWave[rand() % (sizeof(RandomWave) / sizeof(RandomWave[0]))],d3dPosition); + return TRUE; +} diff --git a/sdk/samples/rockem/directx.h b/sdk/samples/rockem/directx.h new file mode 100644 index 0000000..73ba9fb --- /dev/null +++ b/sdk/samples/rockem/directx.h @@ -0,0 +1,148 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: directx.h + * + ***************************************************************************/ + +#ifndef __DIRECTX_H_ +#define __DIRECTX_H_ + +// Includes.... +#include "d3drmwin.h" +#include "dsound.h" +#include "stdio.h" + +// Defines.... +#define NUM_SOUNDS 30 + +#define INTRO 0 +#define PLAYER1_PUNCH1 1 +#define PLAYER1_PUNCH2 2 +#define PLAYER2_PUNCH1 3 +#define PLAYER2_PUNCH2 4 +#define PLAYER1_WALK 5 +#define PLAYER2_WALK 6 +#define WHOOSH1 7 +#define WHOOSH2 8 +#define PLAYER1_OUCH 9 +#define PLAYER2_OUCH 10 +#define HEAD_SPRING 11 +#define BLOCK1 12 +#define BLOCK2 13 +#define BLOCK3 14 +#define VICTORY_BOO 15 +#define VICTORY_YEAH 16 +#define CROWD_LOOP 17 +#define SERVO_DOWN_1 18 +#define SERVO_DOWN_2 19 +#define SERVO_DOWN_3 20 +#define SERVO_UP_1 21 +#define SERVO_UP_2 22 +#define SERVO_UP_3 23 +#define RANDOM1 24 +#define RANDOM2 25 +#define RANDOM3 26 +#define RANDOM4 27 +#define RANDOM5 28 +#define RANDOM6 29 + +#define NUM_VID_MODES 50 + +// Macros + +// The following macros are used for proper error handling for DirectDraw, +// DirectSound, Direct3D and Direct3D retained mode +#define TRY_DD(exp) { { HRESULT rval = exp; if (rval != DD_OK) { TraceErrorDD(rval, __FILE__, __LINE__); return FALSE; } } } +#define TRY_DS(exp) { { HRESULT rval = exp; if (rval != DS_OK) { TraceErrorDS(rval, __FILE__, __LINE__); return FALSE; } } } +#define TRY_D3D(exp) { { HRESULT rval = exp; if (rval != D3D_OK) { TraceErrorD3D(rval, __FILE__, __LINE__); return FALSE; } } } +#define TRY_D3DRM(exp) { { HRESULT rval = exp; if (rval != D3DRM_OK) { TraceErrorD3DRM(rval, __FILE__, __LINE__); return FALSE; } } } + +// Structures.... +typedef struct _D3DDeviceInfo +{ + D3DCOLORMODEL cm; + LPGUID lpHWGuid; + D3DDEVICEDESC HWDeviceDesc; + LPGUID lpSWGuid; + D3DDEVICEDESC SWDeviceDesc; +} D3DDeviceInfo; + +#pragma pack(1) +struct WaveHeader +{ + BYTE RIFF[4]; // "RIFF" + DWORD dwSize; // Size of data to follow + BYTE WAVE[4]; // "WAVE" + BYTE fmt_[4]; // "fmt " + DWORD dw16; // 16 + WORD wOne_0; // 1 + WORD wChnls; // Number of Channels + DWORD dwSRate; // Sample Rate + DWORD BytesPerSec; // Sample Rate + WORD wBlkAlign; // 1 + WORD BitsPerSample; // Sample size + BYTE DATA[4]; // "DATA" + DWORD dwDSize; // Number of Samples +}; +#pragma pack() + +struct VideoMode +{ + int width; + int height; + int bpp; + BOOL bUsable; +}; + +// Prototypes.... + +// Error handling +void TraceErrorDD(HRESULT hErr, char *sFile, int nLine); +void TraceErrorDS(HRESULT hErr, char *sFile, int nLine); +void TraceErrorD3D(HRESULT hErr, char *sFile, int nLine); +void TraceErrorD3DRM(HRESULT hErr, char *sFile, int nLine); + +// Callbacks +BOOL FAR PASCAL DDEnumCallback(GUID FAR* lpGUID, LPSTR lpDriverDesc, LPSTR lpDriverName, LPVOID lpContext); +HRESULT CALLBACK DDEnumDisplayModesCallback(LPDDSURFACEDESC pddsd, LPVOID Context); +HRESULT WINAPI D3DEnumDeviceCallBack(LPGUID lpGuid, LPSTR lpDeviceDescription, LPSTR lpDeviceName, + LPD3DDEVICEDESC lpHWDesc, LPD3DDEVICEDESC lpHELDesc, LPVOID lpContext); + +// Initialisation +BOOL InitD3DDevice(); + +BOOL InitDirectX(); +BOOL SetDirectDrawExclusiveMode(); + +// Termination +void TermDirectX(); + +void SortDisplayModes(); + +BOOL EnterVideoMode(int mode); +BOOL EnterVideoModeWHBD(int width, int height, int bitdepth); +BOOL EnterNextVideoMode(); +BOOL EnterPrevVideoMode(); +BOOL EnterLowestVideoMode(); +BOOL EnterHighestVideoMode(); +BOOL ReenterCurrentVideoMode(); +void CleanUp(); + +BOOL DoSplashScreen(DWORD delay); +void ReleaseSplashScreen(); + +BOOL RestoreSurfaces(); + +BOOL CreateSoundBuffer(DWORD dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo, BOOL bStaticBuf); +BOOL ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos); +BOOL CreateBufferFromWaveFile(char* FileName, DWORD dwBuf); +BOOL StopAllSounds(); +BOOL PlaySoundDS(DWORD dwSound, D3DVECTOR d3dvPos, DWORD dwFlags = 0); +IDirectSoundBuffer *CreateSoundBuffer3D(void); +int CALLBACK PlayRandomWave(void); +void RecalcPowerBars(DWORD player1health, DWORD player2health); + +#endif + diff --git a/sdk/samples/rockem/gdk_fill.ppm b/sdk/samples/rockem/gdk_fill.ppm new file mode 100644 index 0000000..ddaa32a --- /dev/null +++ b/sdk/samples/rockem/gdk_fill.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 64 +255 +�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������|���|���|���|���|���|���|���|���|���|���|���|���|���|���|���|���|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�|�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�t�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�l�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�l�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�\�d�\�d�\�d�\�d�\�d�\�d�\�d�\�d�\�d�\�d�\�d�\�d�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�\�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�\�T�\�T�\�T�\�T�\�T�\�T�\�T�\�T�\�T�\�T�\�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�T�L�T�L�T�L�T�L�T�L�T�L�T�L�T�L�T�L�T�L�T�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�L�D�L�D�L�D�L�D�L�D�L�D�L�D�L�D�L�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�<�D�<�D�<�D�<�D�<�D�<�D�<�D�<�D�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�<�4�<�4�<�4�<�4�<�4�<�4�<�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�4�,�4�,�4�,�4�,�4�,�4�,�4�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�,�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�,�$�,�$�,�$�,�$�,�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$��$��$��$��$�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� \ No newline at end of file diff --git a/sdk/samples/rockem/head.wav b/sdk/samples/rockem/head.wav new file mode 100644 index 0000000..711c9eb Binary files /dev/null and b/sdk/samples/rockem/head.wav differ diff --git a/sdk/samples/rockem/intro.wav b/sdk/samples/rockem/intro.wav new file mode 100644 index 0000000..f1c05e7 Binary files /dev/null and b/sdk/samples/rockem/intro.wav differ diff --git a/sdk/samples/rockem/makefile b/sdk/samples/rockem/makefile new file mode 100644 index 0000000..fda903f --- /dev/null +++ b/sdk/samples/rockem/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include d3dbld.mk diff --git a/sdk/samples/rockem/midi.cpp b/sdk/samples/rockem/midi.cpp new file mode 100644 index 0000000..8d0b8c7 --- /dev/null +++ b/sdk/samples/rockem/midi.cpp @@ -0,0 +1,129 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: midi.cpp + * + ***************************************************************************/ + +// Includes.... +#include "windows.h" +#include "midi.h" +#include "stdio.h" + +// Externals.... +extern HWND g_hWnd; + +//------------------------------------------------------------------ +// +// Function : PlayMidi() +// +// Purpose : Plays a midi file +// +//------------------------------------------------------------------ + +BOOL PlayMidi(char *sFileName) +{ + char buf[256]; + + sprintf(buf, "open %s type sequencer alias MUSIC", sFileName); + + if (mciSendString("close all", NULL, 0, NULL) != 0) + { + return(FALSE); + } + + if (mciSendString(buf, NULL, 0, NULL) != 0) + { + return(FALSE); + } + + if (mciSendString("play MUSIC from 0", NULL, 0, g_hWnd) != 0) + { + return(FALSE); + } + + // Yahoo! + return TRUE; +} + +//------------------------------------------------------------------ +// +// Function : PauseMidi() +// +// Purpose : Pauses midi file +// +//------------------------------------------------------------------ + +BOOL PauseMidi() +{ + // Pause if we're not already paused... + if (mciSendString("stop MUSIC", NULL, 0, NULL) != 0) + { + return(FALSE); + } + + + // Yahoo! + return TRUE; +} + +//------------------------------------------------------------------ +// +// Function : ResumeMidi() +// +// Purpose : Resumes playing of a midi file +// +//------------------------------------------------------------------ + +BOOL ResumeMidi() +{ + // Resume midi + if (mciSendString("play MUSIC notify", NULL, 0, g_hWnd) != 0) + { + return(FALSE); + } + + // Yahoo! + return TRUE; +} + +//------------------------------------------------------------------ +// +// Function : StopMidi +// +// Purpose : Stops a midi file playing +// +//------------------------------------------------------------------ + +BOOL StopMidi() +{ + if (mciSendString("close all", NULL, 0, NULL) != 0) + { + return(FALSE); + } + + // Yahoo! + return TRUE; +} + +//------------------------------------------------------------------ +// +// Function : ReplayMidi() +// +// Purpose : Replays a midi file +// +//------------------------------------------------------------------ + +BOOL ReplayMidi() +{ + // Replay midi + if (mciSendString("play MUSIC from 0 notify", NULL, 0, g_hWnd) != 0) + { + return(FALSE); + } + + // Yahoo! + return TRUE; +} + diff --git a/sdk/samples/rockem/midi.h b/sdk/samples/rockem/midi.h new file mode 100644 index 0000000..523fb41 --- /dev/null +++ b/sdk/samples/rockem/midi.h @@ -0,0 +1,19 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: midi.h + * + ***************************************************************************/ + +#ifndef __MIDI_H +#define __MIDI_H + +BOOL PlayMidi(char *sFileName); +BOOL PauseMidi(); +BOOL ResumeMidi(); +BOOL StopMidi(); +BOOL ReplayMidi(); + +#endif + diff --git a/sdk/samples/rockem/msvc.mk b/sdk/samples/rockem/msvc.mk new file mode 100644 index 0000000..c2f03d6 --- /dev/null +++ b/sdk/samples/rockem/msvc.mk @@ -0,0 +1,40 @@ +NAME = rockem3d +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + dsound.lib comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = control.obj directx.obj midi.obj rm.obj winmain.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX -Ox +LOPT =-debug:none +ROPT = +!endif +RES = rockem3d.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/rockem/punch.wav b/sdk/samples/rockem/punch.wav new file mode 100644 index 0000000..cf99981 Binary files /dev/null and b/sdk/samples/rockem/punch.wav differ diff --git a/sdk/samples/rockem/punch1.wav b/sdk/samples/rockem/punch1.wav new file mode 100644 index 0000000..f0ff8ad Binary files /dev/null and b/sdk/samples/rockem/punch1.wav differ diff --git a/sdk/samples/rockem/punch2.wav b/sdk/samples/rockem/punch2.wav new file mode 100644 index 0000000..eaa2690 Binary files /dev/null and b/sdk/samples/rockem/punch2.wav differ diff --git a/sdk/samples/rockem/punch3.wav b/sdk/samples/rockem/punch3.wav new file mode 100644 index 0000000..c4cedfc Binary files /dev/null and b/sdk/samples/rockem/punch3.wav differ diff --git a/sdk/samples/rockem/punch4.wav b/sdk/samples/rockem/punch4.wav new file mode 100644 index 0000000..7db7faf Binary files /dev/null and b/sdk/samples/rockem/punch4.wav differ diff --git a/sdk/samples/rockem/random1.wav b/sdk/samples/rockem/random1.wav new file mode 100644 index 0000000..0b808e5 Binary files /dev/null and b/sdk/samples/rockem/random1.wav differ diff --git a/sdk/samples/rockem/random2.wav b/sdk/samples/rockem/random2.wav new file mode 100644 index 0000000..4f7b4aa Binary files /dev/null and b/sdk/samples/rockem/random2.wav differ diff --git a/sdk/samples/rockem/random3.wav b/sdk/samples/rockem/random3.wav new file mode 100644 index 0000000..8bb4a65 Binary files /dev/null and b/sdk/samples/rockem/random3.wav differ diff --git a/sdk/samples/rockem/random4.wav b/sdk/samples/rockem/random4.wav new file mode 100644 index 0000000..2a3a0fb Binary files /dev/null and b/sdk/samples/rockem/random4.wav differ diff --git a/sdk/samples/rockem/random5.wav b/sdk/samples/rockem/random5.wav new file mode 100644 index 0000000..0317639 Binary files /dev/null and b/sdk/samples/rockem/random5.wav differ diff --git a/sdk/samples/rockem/random6.wav b/sdk/samples/rockem/random6.wav new file mode 100644 index 0000000..4cd138d Binary files /dev/null and b/sdk/samples/rockem/random6.wav differ diff --git a/sdk/samples/rockem/readme.txt b/sdk/samples/rockem/readme.txt new file mode 100644 index 0000000..361c5b6 --- /dev/null +++ b/sdk/samples/rockem/readme.txt @@ -0,0 +1,32 @@ +Rockem 3D Sample Game +--------------------- + +This game demonstrates many of the features of Direct X, including DirectDraw, +Direct 3D & DirectSound. It also demonstrates DirectSound3D. +It is important to note that this game is not optimised for raw speed. It +is meant to give a clear demonstration of how the DirectX technologies can +be used. + +When you build this sample, it will create a rockem3d.exe file in either +the retail or debug subdirectories, depending on which version you built. +However, you must then copy the .exe up one directory to the Rockem sample +root (i.e. c:\dxsdk\sdk\samples\rockem). This is because rockem also needs +to find its .wav files and other resources from that dir. + +The commands which this game recognizes are listed on the opening screen. + + ESC - Quit + F1 - Camera side view + F2 - Camera behind view + F3 - Camera head view + F5 - Toggle stats + F6 - Go up a video mode + F7 - Go down a video mode + END - Highest video mode + HOME - Lowest video mode + Control - M - Toggle music + Control - S - Toggle sound + Control - Block + SpaceBar - Attack + Up Arrow - Move forward + Down Arrow - Move backwards diff --git a/sdk/samples/rockem/resource.h b/sdk/samples/rockem/resource.h new file mode 100644 index 0000000..f3e43d3 --- /dev/null +++ b/sdk/samples/rockem/resource.h @@ -0,0 +1,30 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: resource.h + * + ***************************************************************************/ + +#define IDR_ACCEL 104 +#define IDR_MENU 105 +#define IDI_ICON1 106 +#define IDI_ICON2 108 +#define ID_FILE_EXIT 40001 +#define ID_VIEW_640X480 40002 +#define ID_VIEW_640X400 40003 +#define ID_VIEW_320X240 40004 +#define ID_VIEW_320X200 40005 +#define ID_VIEW_FULLSCREEN 40006 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 111 +#define _APS_NEXT_COMMAND_VALUE 40007 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif + diff --git a/sdk/samples/rockem/revdn1.wav b/sdk/samples/rockem/revdn1.wav new file mode 100644 index 0000000..b58f1a3 Binary files /dev/null and b/sdk/samples/rockem/revdn1.wav differ diff --git a/sdk/samples/rockem/revdn2.wav b/sdk/samples/rockem/revdn2.wav new file mode 100644 index 0000000..ec19555 Binary files /dev/null and b/sdk/samples/rockem/revdn2.wav differ diff --git a/sdk/samples/rockem/revdn3.wav b/sdk/samples/rockem/revdn3.wav new file mode 100644 index 0000000..2840af1 Binary files /dev/null and b/sdk/samples/rockem/revdn3.wav differ diff --git a/sdk/samples/rockem/revup1.wav b/sdk/samples/rockem/revup1.wav new file mode 100644 index 0000000..6058df1 Binary files /dev/null and b/sdk/samples/rockem/revup1.wav differ diff --git a/sdk/samples/rockem/revup2.wav b/sdk/samples/rockem/revup2.wav new file mode 100644 index 0000000..c33e3cf Binary files /dev/null and b/sdk/samples/rockem/revup2.wav differ diff --git a/sdk/samples/rockem/revup3.wav b/sdk/samples/rockem/revup3.wav new file mode 100644 index 0000000..384aa59 Binary files /dev/null and b/sdk/samples/rockem/revup3.wav differ diff --git a/sdk/samples/rockem/rm.cpp b/sdk/samples/rockem/rm.cpp new file mode 100644 index 0000000..1bbcfd2 --- /dev/null +++ b/sdk/samples/rockem/rm.cpp @@ -0,0 +1,426 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rm.cpp + * + ***************************************************************************/ + +// Includes.... +#include "rm.h" +#include "directx.h" +#include "mmsystem.h" +#include "stdio.h" +#include "control.h" + +// Globals.... +LPDIRECT3DRMFRAME g_lpScene = NULL; // Scene frame +LPDIRECT3DRMFRAME g_lpCamera = NULL; // Camera frame +LPDIRECT3DRMFRAME g_lpArena = NULL; // Arena frame +LPDIRECT3DRMFRAME g_lpBackground = NULL; // Background frame + +LPDIRECT3DRMFRAME g_lpPlayers = NULL; // Encapsulating frame +LPDIRECT3DRMFRAME g_lpPlayer1 = NULL; // Human player +LPDIRECT3DRMFRAME g_lpPlayer1HeadFrame = NULL;// Human player head frame +LPDIRECT3DRMANIMATIONSET g_lpPlayer1AnimSet = NULL;// Human player animation set +LPDIRECT3DRMFRAME g_lpPlayer2 = NULL; // Computer player +LPDIRECT3DRMFRAME g_lpPlayer2HeadFrame = NULL;// Computer player head frame +LPDIRECT3DRMANIMATIONSET g_lpPlayer2AnimSet = NULL;// Computer player animation set + +LPDIRECT3DRMFRAME g_lpTmp = NULL; // Temporary frame + +LPDIRECT3DRMLIGHT g_lpDir; // Global light frame + +LPDIRECT3DRMMESHBUILDER g_lpRedDebris = NULL; // Red debris model +LPDIRECT3DRMMESHBUILDER g_lpBlueDebris = NULL; // Blue debris model +Debris g_debris[NUM_DEBRIS]; // Debris + +LPDIRECT3DRMANIMATION g_lpAnim = NULL; // Intro anim + +// Timing stuff +D3DVALUE g_timingDelta = D3DVAL(0.0f); + +// Frame rate stuff +DWORD g_dwLastTime = 0; +DWORD g_dwCurTime = 0; +DWORD g_dwFpsTime = 0; +DWORD g_dwDeltaTime = 0; +DWORD g_dwFramesRendered = 0; +DWORD g_dwFps = 0; + +// Externals.... +extern BOOL g_bShowStats; // Defined in WINMAIN.CPP +extern BOOL g_bHardware3D; // Defined in DIRECTX.CPP +extern LPDIRECT3DRM g_lpD3DRM; // Defined in DIRECTX.CPP +extern LPDIRECT3DRMVIEWPORT g_lpD3DRMViewport; // Defined in DIRECTX.CPP +extern LPDIRECT3DRMDEVICE g_lpD3DRMDevice; // Defined in DIRECTX.CPP +extern LPDIRECTDRAWSURFACE g_lpPrimary; // Defined in DIRECTX.CPP +extern LPDIRECTDRAWSURFACE g_lpBackBuffer; // Defined in DIRECTX.CPP +extern LPDIRECTDRAWSURFACE g_lpZBuffer; // Defined in DIRECTX.CPP +extern DWORD g_vidModeX; // Defined in DIRECTX.CPP +extern DWORD g_vidModeY; // Defined in DIRECTX.CPP +extern DWORD g_vidModeBIT; // Defined in DIRECTX.CPP +extern DWORD g_dwFontHeight; // Defined in DIRECTX.CPP +extern DWORD g_dwAveCharWidth; // Defined in DIRECTX.CPP + +extern DWORD g_player1health; // Defined in CONTROL.CPP +extern DWORD g_player2health; // Defined in CONTROL.CPP + +extern DWORD g_lbar1; // Defined in DIRECTX.CPP +extern DWORD g_wbar1; // Defined in DIRECTX.CPP +extern DWORD g_lbar2; // Defined in DIRECTX.CPP +extern DWORD g_wbar2; // Defined in DIRECTX.CPP +extern DWORD g_hbar1; // Defined in DIRECTX.CPP +extern DWORD g_hbar2; // Defined in DIRECTX.CPP + +extern AnimArgs g_player1AnimArgs; +extern AnimArgs g_player2AnimArgs; + +//---------------------------------------------------------------------- +// +// Function : InitScene +// +// Purpose : Initialises Direct3D RM objects and loads scene for demo +// +//---------------------------------------------------------------------- + +BOOL InitScene() +{ + LPDIRECT3DRMLIGHT pAmb; + LPDIRECT3DRMFRAME pLight; + LPDIRECT3DRMMESHBUILDER pMeshBuilder; + + // Create the scene (parent) frame + TRY_D3DRM(g_lpD3DRM->CreateFrame(NULL, &g_lpScene)) + + // Create the camera (child of g_lpScene) + TRY_D3DRM(g_lpD3DRM->CreateFrame(g_lpScene, &g_lpCamera)) + + // Create the arena frame + TRY_D3DRM(g_lpD3DRM->CreateFrame(g_lpScene, &g_lpArena)) + + // Create the frame that encapsulates both players + TRY_D3DRM(g_lpD3DRM->CreateFrame(g_lpScene, &g_lpPlayers)) + + // Create player frames + TRY_D3DRM(g_lpD3DRM->CreateFrame(g_lpPlayers, &g_lpPlayer1)) + + TRY_D3DRM(g_lpD3DRM->CreateFrame(g_lpPlayers, &g_lpPlayer2)) + + // Create temporary frame + TRY_D3DRM(g_lpD3DRM->CreateFrame(g_lpScene, &g_lpTmp)) + + // Create lights and position in world + TRY_D3DRM(g_lpD3DRM->CreateLightRGB(D3DRMLIGHT_AMBIENT, D3DVAL(0.2), D3DVAL(0.2), D3DVAL(0.2), &pAmb)) + + TRY_D3DRM(g_lpD3DRM->CreateLightRGB(D3DRMLIGHT_DIRECTIONAL, D3DVAL(0.7), D3DVAL(0.7), D3DVAL(0.7), &g_lpDir)) + + // Create ambient light frame + TRY_D3DRM(g_lpD3DRM->CreateFrame(g_lpScene, &pLight)) + + // Add the light to the frame + TRY_D3DRM(pLight->AddLight(pAmb)) + + // Release the light frame + pLight->Release(); + + // Create directional light frame + TRY_D3DRM(g_lpD3DRM->CreateFrame(g_lpScene, &pLight)) + + // Set position and orientation of directional light + pLight->SetPosition(g_lpScene, D3DVAL(1000), D3DVAL(1000), D3DVAL(1000)); + pLight->SetOrientation(g_lpScene, D3DVAL(-1.0), D3DVAL(-1.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0)); + + // Add the light to the frame + TRY_D3DRM(pLight->AddLight(g_lpDir)) + + // Enable lights only for any object that is a child of g_lpPlayers + TRY_D3DRM(g_lpDir->SetEnableFrame(g_lpPlayers)) + + // Release the light frame + pLight->Release(); + + // Create mesh builder for arena + TRY_D3DRM(g_lpD3DRM->CreateMeshBuilder(&pMeshBuilder)) + + // Load the arena + TRY_D3DRM(pMeshBuilder->Load("ARENA.X", NULL, D3DRMLOAD_FROMFILE, LoadTextures, NULL)) + + // Make sure we use perspective correct! + pMeshBuilder->SetPerspective(TRUE); + + // Add the mesh to the scene + TRY_D3DRM(g_lpArena->AddVisual(pMeshBuilder)) + + g_lpArena->SetZbufferMode(D3DRMZBUFFER_DISABLE); + + // Release the mesh builder + pMeshBuilder->Release(); + + // Load player 1's model + TRY_D3DRM(g_lpD3DRM->CreateAnimationSet(&g_lpPlayer1AnimSet)) + + // Load the model and animation + TRY_D3DRM(g_lpPlayer1AnimSet->Load("SKMECH.X", NULL, D3DRMLOAD_FROMFILE, LoadTextures, NULL, g_lpPlayer1)) + + // Add animation callback for player 1 + g_player1AnimArgs.lpAnimSet = g_lpPlayer1AnimSet; + g_player1AnimArgs.time = D3DVAL(0); + TRY_D3DRM(g_lpPlayer1->AddMoveCallback(Player1AnimationCallback, NULL)) + + // Setup the initial position of player 1 + g_lpPlayer1->SetPosition(g_lpScene, D3DVAL(0), D3DVAL(0), D3DVAL(-200)); + + // Load player 2's model + TRY_D3DRM(g_lpD3DRM->CreateAnimationSet(&g_lpPlayer2AnimSet)) + + // Load the model and animation + TRY_D3DRM(g_lpPlayer2AnimSet->Load("DEMECH.X", NULL, D3DRMLOAD_FROMFILE, LoadTextures, NULL, g_lpPlayer2)) + + // Add animation callback for player 2 + g_player2AnimArgs.lpAnimSet = g_lpPlayer2AnimSet; + g_player2AnimArgs.time = D3DVAL(0); + TRY_D3DRM(g_lpPlayer2->AddMoveCallback(Player2AnimationCallback, NULL)) + + for (int i = 0; i < NUM_DEBRIS; i ++) + { + TRY_D3DRM(g_lpD3DRM->CreateFrame(g_lpPlayers, &g_debris[i].m_pFrame)) + + g_debris[i].m_bInUse = FALSE; + } + + // Load the red debris + TRY_D3DRM(g_lpD3DRM->CreateMeshBuilder(&g_lpRedDebris)) + + TRY_D3DRM(g_lpRedDebris->Load("debris_r.x", NULL, D3DRMLOAD_FROMFILE, NULL, NULL)) + + // Load the blue debris + TRY_D3DRM(g_lpD3DRM->CreateMeshBuilder(&g_lpBlueDebris)) + + TRY_D3DRM(g_lpBlueDebris->Load("debris_b.x", NULL, D3DRMLOAD_FROMFILE, NULL, NULL)) + + // Setup the initial position of player 2 + g_lpPlayer2->SetPosition(g_lpScene, D3DVAL(0), D3DVAL(0), D3DVAL(200)); + + // Create the intro path + TRY_D3DRM(g_lpD3DRM->CreateAnimation(&g_lpAnim)) + + // Setup the animation options + g_lpAnim->SetOptions(D3DRMANIMATION_OPEN | + D3DRMANIMATION_LINEARPOSITION | + D3DRMANIMATION_POSITION); + + // Add the starting position (as a keyframe) + g_lpAnim->AddPositionKey(D3DVAL(0), D3DVAL(200), D3DVAL(2000), D3DVAL(0)); + + // Add the ending position (as a keyframe) + g_lpAnim->AddPositionKey(D3DVAL(1), D3DVAL(700), D3DVAL(100), D3DVAL(0)); + + // Make the camera follow this animation + g_lpAnim->SetFrame(g_lpCamera); + + // Retrieve player 1 and player 2's head frames + LPDIRECT3DRMOBJECT tmp; + + TRY_D3DRM(g_lpD3DRM->GetNamedObject("x3ds_Head", &tmp)) + g_lpPlayer1HeadFrame = (LPDIRECT3DRMFRAME)tmp; + + TRY_D3DRM(g_lpD3DRM->GetNamedObject("x3ds_xHead", &tmp)) + g_lpPlayer2HeadFrame = (LPDIRECT3DRMFRAME)tmp; + + // Yahoo! + return TRUE; +} + +//---------------------------------------------------------------------- +// +// Function : TermScene +// +// Purpose : Destroys scene +// +//---------------------------------------------------------------------- + +void TermScene() +{ + // Destroy the scene frame + if (g_lpScene) + { + g_lpScene->Release(); + g_lpScene = NULL; + } + + // Destroy the animation sets + if (g_lpPlayer1AnimSet) + { + g_lpPlayer1AnimSet->Release(); + g_lpPlayer1AnimSet = NULL; + } + + if (g_lpPlayer2AnimSet) + { + g_lpPlayer2AnimSet->Release(); + g_lpPlayer2AnimSet = NULL; + } +} + +//---------------------------------------------------------------------- +// +// Function : RenderScene +// +// Purpose : Renders scene +// +//---------------------------------------------------------------------- + +BOOL RenderScene() +{ + static BOOL b = FALSE; + + // Verify both surfaces + if (!g_lpPrimary) return FALSE; + + if (!g_lpZBuffer) return FALSE; + + // Perform some timing stuff + g_dwCurTime = timeGetTime(); + g_dwDeltaTime = g_dwCurTime - g_dwLastTime; + g_dwLastTime = g_dwCurTime; + g_dwFpsTime += g_dwDeltaTime; + + // Move the scene + g_lpScene->Move(D3DVAL(g_dwDeltaTime)); + + if (b) { + b = FALSE; + TRY_D3DRM(g_lpD3DRMViewport->ForceUpdate(0, 0, g_vidModeX, g_vidModeY)) + } + + // Restore the primary surface if it has been lost + if (g_lpPrimary->IsLost()) + { + HRESULT rval = g_lpPrimary->Restore(); + if (rval != DD_OK) return TRUE; + TRY_D3DRM(g_lpD3DRMViewport->ForceUpdate(0, 0, g_vidModeX, g_vidModeY)) + b = TRUE; + } + + // Restore the ZBuffer if it has been lost + if (g_lpZBuffer->IsLost()) + { + HRESULT rval = g_lpZBuffer->Restore(); + if (rval != DD_OK) return TRUE; + TRY_D3DRM(g_lpD3DRMViewport->ForceUpdate(0, 0, g_vidModeX, g_vidModeY)) + } + + // Clear the viewport ready for rendering + TRY_D3DRM(g_lpD3DRMViewport->Clear()) + + // Render the scene + TRY_D3DRM(g_lpD3DRMViewport->Render(g_lpScene)) + + g_dwFramesRendered ++; + + // Show stats if necessary + if (g_bShowStats) + { + // String to hold stats + char sStats[256]; + + // If 2 seconds have elapsed, calculate the frame rate + if (g_dwFpsTime > 2000) + { + g_dwFps = g_dwFramesRendered / 2; + g_dwFramesRendered = 0; + g_dwFpsTime = 0; + } + + // Copy info into stat string + sprintf(sStats, "SX:%d, SY:%d, SBD:%d FPS:%d, %s", g_vidModeX, g_vidModeY, g_vidModeBIT, g_dwFps, g_bHardware3D ? "(H)" : "(S)"); + + // Get a DC to the backbuffer (very useful!) + HDC hDC; + g_lpBackBuffer->GetDC(&hDC); + if (!hDC) return FALSE; + + // Use TextOut to draw the text onto the surface + DWORD dwStringPixelWidth = strlen(sStats) * g_dwAveCharWidth; + + SetBkMode( hDC, TRANSPARENT ); + SetTextColor( hDC, RGB(255,255,255) ); + TextOut(hDC, (g_vidModeX >> 1) - (dwStringPixelWidth >> 1), g_vidModeY - g_dwFontHeight, sStats, strlen(sStats)); + + // Must release DC before calling Flip() + g_lpBackBuffer->ReleaseDC(hDC); + } + + // Draw the power bars + DDBLTFX ddBltFx; + memset(&ddBltFx, 0, sizeof(DDBLTFX)); + ddBltFx.dwSize = sizeof(DDBLTFX); + + RECT rcBar1 = { g_lbar1, g_hbar1, g_lbar1 + g_wbar1, g_hbar1 + g_hbar2 }; + RECT rcBar2 = { g_lbar2, g_hbar1, g_lbar2 + g_wbar2, g_hbar1 + g_hbar2 }; + + switch (g_vidModeBIT) + { + case 8 : ddBltFx.dwFillColor = 253; break; + case 16 : ddBltFx.dwFillColor = 1 << 4; break; + case 24 : ddBltFx.dwFillColor = 1 << 7; break; + } + if (g_player1health > 0) { + TRY_DD(g_lpBackBuffer->Blt(&rcBar1, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddBltFx)) + TRY_D3DRM(g_lpD3DRMViewport->ForceUpdate(rcBar1.left, rcBar1.top, rcBar1.right, rcBar1.bottom)) + } + + switch (g_vidModeBIT) + { + case 8 : ddBltFx.dwFillColor = 254; break; + case 16 : ddBltFx.dwFillColor = 1 << 5 << 5 << 4; break; + case 24 : ddBltFx.dwFillColor = 1 << 8 << 8 << 7; break; + } + if (g_player2health > 0) { + TRY_DD(g_lpBackBuffer->Blt(&rcBar2, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddBltFx)) + TRY_D3DRM(g_lpD3DRMViewport->ForceUpdate(rcBar2.left, rcBar2.top, rcBar2.right, rcBar2.bottom)) + } + + // And update the device + TRY_D3DRM(g_lpD3DRMDevice->Update()) + + // Finally, flip the back buffer onto the primary surface, displaying + // the last rendered frame + TRY_DD(g_lpPrimary->Flip(NULL, DDFLIP_WAIT)) + + // Yahoo! + return TRUE; +} + +//------------------------------------------------------------------ +// +// Function : LoadTextures +// +// Purpose : Loads an individual texture +// +// NOTE : Textures must have a size divisible by 2 (e.g. 128x64, 256x256) +// +//------------------------------------------------------------------ + +HRESULT LoadTextures(char *sName, void *pArg, LPDIRECT3DRMTEXTURE *hTexture) +{ + char *sTmpName = sName; + + // Find the extension + while(sTmpName[0] != '.') sTmpName ++; + + // Add .ppm to the picture file used by 3D Studio (.TGA, .GIF, .CEL etc) + strcpy(sTmpName, ".ppm"); + + // Load the texture + if (FAILED(g_lpD3DRM->LoadTexture(sName, hTexture))) return -1; + + if (!strcmp(sName, "gdk_fill.ppm")) + { + (*hTexture)->SetShades(1); + } + + return 0; +} + diff --git a/sdk/samples/rockem/rm.h b/sdk/samples/rockem/rm.h new file mode 100644 index 0000000..81499b5 --- /dev/null +++ b/sdk/samples/rockem/rm.h @@ -0,0 +1,40 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rm.h + * + ***************************************************************************/ + +#ifndef __RM_H_ +#define __RM_H_ + +// Includes.... +#include "d3drmwin.h" + +// Defines.... +#define NUM_DEBRIS 25 +#define DEBRIS_LIFE 75 +#define NUM_HIT_DEBRIS 4 + +// Structures +struct Debris +{ + LPDIRECT3DRMFRAME m_pFrame; + LPDIRECT3DRMMESHBUILDER m_pMeshBuilder; + BOOL m_bInUse; + D3DVECTOR m_vel; + D3DVECTOR m_acc; + int m_life; +}; + +// Prototypes.... +BOOL InitScene(); +void TermScene(); + +BOOL RenderScene(); + +HRESULT LoadTextures(char *sName, void *pArg, LPDIRECT3DRMTEXTURE *hTexture); + +#endif + diff --git a/sdk/samples/rockem/rockem3d.bin b/sdk/samples/rockem/rockem3d.bin new file mode 100644 index 0000000..a2f52af Binary files /dev/null and b/sdk/samples/rockem/rockem3d.bin differ diff --git a/sdk/samples/rockem/rockem3d.ico b/sdk/samples/rockem/rockem3d.ico new file mode 100644 index 0000000..69c67aa Binary files /dev/null and b/sdk/samples/rockem/rockem3d.ico differ diff --git a/sdk/samples/rockem/rockem3d.mid b/sdk/samples/rockem/rockem3d.mid new file mode 100644 index 0000000..b111a02 Binary files /dev/null and b/sdk/samples/rockem/rockem3d.mid differ diff --git a/sdk/samples/rockem/rockem3d.pal b/sdk/samples/rockem/rockem3d.pal new file mode 100644 index 0000000..0da6e81 Binary files /dev/null and b/sdk/samples/rockem/rockem3d.pal differ diff --git a/sdk/samples/rockem/rockem3d.rc b/sdk/samples/rockem/rockem3d.rc new file mode 100644 index 0000000..0e1599d --- /dev/null +++ b/sdk/samples/rockem/rockem3d.rc @@ -0,0 +1,34 @@ +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Microsoft Inc.\0" + VALUE "FileDescription", "RockEm3D\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "RockEm3D\0" + VALUE "LegalCopyright", "Copyright � 1996\0" + VALUE "OriginalFilename", "RockEm3D.exe\0" + VALUE "ProductName", "Microsoft RockEm '3D\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +ROCKEM3D ICON DISCARDABLE "rockem3d.ico" diff --git a/sdk/samples/rockem/skmech.x b/sdk/samples/rockem/skmech.x new file mode 100644 index 0000000..1d7aa99 --- /dev/null +++ b/sdk/samples/rockem/skmech.x @@ -0,0 +1,3565 @@ +xof 0302txt 0064 +template Header { + <3D82AB43-62DA-11cf-AB39-0020AF71E433> + WORD major; + WORD minor; + DWORD flags; +} + +template Vector { + <3D82AB5E-62DA-11cf-AB39-0020AF71E433> + FLOAT x; + FLOAT y; + FLOAT z; +} + +template Coords2d { + <F6F23F44-7686-11cf-8F52-0040333594A3> + FLOAT u; + FLOAT v; +} + +template Matrix4x4 { + <F6F23F45-7686-11cf-8F52-0040333594A3> + array FLOAT matrix[16]; +} + +template ColorRGBA { + <35FF44E0-6C7C-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; + FLOAT alpha; +} + +template ColorRGB { + <D3E16E81-7835-11cf-8F52-0040333594A3> + FLOAT red; + FLOAT green; + FLOAT blue; +} + +template IndexedColor { + <1630B820-7842-11cf-8F52-0040333594A3> + DWORD index; + ColorRGBA indexColor; +} + +template Boolean { + <4885AE61-78E8-11cf-8F52-0040333594A3> + WORD truefalse; +} + +template Boolean2d { + <4885AE63-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template MaterialWrap { + <4885AE60-78E8-11cf-8F52-0040333594A3> + Boolean u; + Boolean v; +} + +template TextureFilename { + <A42790E1-7810-11cf-8F52-0040333594A3> + STRING filename; +} + +template Material { + <3D82AB4D-62DA-11cf-AB39-0020AF71E433> + ColorRGBA faceColor; + FLOAT power; + ColorRGB specularColor; + ColorRGB emissiveColor; + [...] +} + +template MeshFace { + <3D82AB5F-62DA-11cf-AB39-0020AF71E433> + DWORD nFaceVertexIndices; + array DWORD faceVertexIndices[nFaceVertexIndices]; +} + +template MeshFaceWraps { + <4885AE62-78E8-11cf-8F52-0040333594A3> + DWORD nFaceWrapValues; + Boolean2d faceWrapValues; +} + +template MeshTextureCoords { + <F6F23F40-7686-11cf-8F52-0040333594A3> + DWORD nTextureCoords; + array Coords2d textureCoords[nTextureCoords]; +} + +template MeshMaterialList { + <F6F23F42-7686-11cf-8F52-0040333594A3> + DWORD nMaterials; + DWORD nFaceIndexes; + array DWORD faceIndexes[nFaceIndexes]; + [Material] +} + +template MeshNormals { + <F6F23F43-7686-11cf-8F52-0040333594A3> + DWORD nNormals; + array Vector normals[nNormals]; + DWORD nFaceNormals; + array MeshFace faceNormals[nFaceNormals]; +} + +template MeshVertexColors { + <1630B821-7842-11cf-8F52-0040333594A3> + DWORD nVertexColors; + array IndexedColor vertexColors[nVertexColors]; +} + +template Mesh { + <3D82AB44-62DA-11cf-AB39-0020AF71E433> + DWORD nVertices; + array Vector vertices[nVertices]; + DWORD nFaces; + array MeshFace faces[nFaces]; + [...] +} + +template FrameTransformMatrix { + <F6F23F41-7686-11cf-8F52-0040333594A3> + Matrix4x4 frameMatrix; +} + +template Frame { + <3D82AB46-62DA-11cf-AB39-0020AF71E433> + [...] +} + +template FloatKeys { + <10DD46A9-775B-11cf-8F52-0040333594A3> + DWORD nValues; + array FLOAT values[nValues]; +} + +template TimedFloatKeys { + <F406B180-7B3B-11cf-8F52-0040333594A3> + DWORD time; + FloatKeys tfkeys; +} + +template AnimationKey { + <10DD46A8-775B-11cf-8F52-0040333594A3> + DWORD keyType; + DWORD nKeys; + array TimedFloatKeys keys[nKeys]; +} + +template AnimationOptions { + <E2BF56C0-840F-11cf-8F52-0040333594A3> + DWORD openclosed; + DWORD positionquality; +} + +template Animation { + <3D82AB4F-62DA-11cf-AB39-0020AF71E433> + [...] +} + +template AnimationSet { + <3D82AB50-62DA-11cf-AB39-0020AF71E433> + [Animation] +} + +Header { + 1; + 0; + 1; +} + +Material x3ds_mat_BLUEPLASTIC { + 0.043137, 0.152941, 0.650980, 1.000000;; + 23.600000; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; +} +Material x3ds_mat_01MECHHAND { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHHN.GIF"; + } +} +Material x3ds_mat_02MECHARM { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHLA.GIF"; + } +} +Material x3ds_mat_01GROIN { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHGR.GIF"; + } +} +Material x3ds_mat_02MECHLEG { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHLL.GIF"; + } +} +Material x3ds_mat_01MECHLEG { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHUL.GIF"; + } +} +Material x3ds_mat_01HEAD { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHJD.GIF"; + } +} +Material x3ds_mat_01BACK { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.400000; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHBK.GIF"; + } +} +Material x3ds_mat_01MECHARM { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.599998; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHUA.GIF"; + } +} +Material x3ds_mat_01CHEST { + 1.000000, 1.000000, 1.000000, 1.000000;; + 30.400000; + 1.00, 1.00, 1.00;; + 0.00, 0.00, 0.00;; + TextureFilename { + "SKMECHCH.GIF"; + } +} + +Frame x3ds_Groin { + FrameTransformMatrix { + 1.000000, -0.000000, 0.000000, 0.000000, + 0.000000, 0.000000, -1.000000, 0.000000, + 0.000000, 1.000000, 0.000000, 0.000000, + 0.000000, 35.534382, 1.024473, 1.000000;; + } + Mesh Groin { + + 31; + -2.000034; -0.000005; -10.091249;, + -0.555553; -0.000005; -10.091249;, + 1.666685; -0.000005; -10.091249;, + -1.192545; -7.018517; -6.581245;, + -3.066506; -0.638034; -6.581247;, + -2.555454; 5.104384; -6.581249;, + -0.851815; 7.018556; -6.581249;, + 0.851807; 7.018508; -6.581249;, + 1.192535; -7.018472; -6.581245;, + -2.333362; -11.356157; 3.071276;, + -6.000068; -1.032373; 3.071294;, + -5.000067; 8.258990; 3.071271;, + -1.666681; 11.356154; 3.071271;, + 1.666685; 11.356246; 3.071271;, + 5.000068; 8.259124; 3.071271;, + 6.000000; -1.032373; 3.071272;, + 2.333369; -11.356207; 3.071276;, + -7.000064; -10.455878; 5.703798;, + -17.999998; -1.012086; 5.703774;, + -15.000135; 7.487373; 5.703794;, + -5.000067; 10.320599; 5.703794;, + 15.000135; 7.487417; 5.703794;, + 17.999998; -1.012087; 5.703772;, + 7.000072; -10.455922; 5.703798;, + -5.833400; -8.955488; 10.091302;, + -15.000134; -0.814139; 10.091294;, + -12.499999; 6.513080; 10.091298;, + -4.166667; 8.955393; 10.091298;, + 12.500135; 6.513032; 10.091298;, + 15.000135; -0.814141; 10.091298;, + 5.833403; -8.955536; 10.091299;; + + 53; + 3;1,4,0;, + 3;1,3,4;, + 3;0,5,1;, + 3;0,4,5;, + 3;1,5,6;, + 3;1,7,2;, + 3;1,6,7;, + 3;2,3,1;, + 3;2,8,3;, + 3;3,10,4;, + 3;3,9,10;, + 3;4,11,5;, + 3;4,10,11;, + 3;5,12,6;, + 3;5,11,12;, + 3;6,13,7;, + 3;6,12,13;, + 3;7,13,14;, + 3;7,15,2;, + 3;7,14,15;, + 3;2,16,8;, + 3;2,15,16;, + 3;8,9,3;, + 3;8,16,9;, + 3;9,18,10;, + 3;9,17,18;, + 3;10,19,11;, + 3;10,18,19;, + 3;11,20,12;, + 3;11,19,20;, + 3;12,20,13;, + 3;13,21,14;, + 3;14,22,15;, + 3;14,21,22;, + 3;15,23,16;, + 3;15,22,23;, + 3;16,17,9;, + 3;16,23,17;, + 3;17,25,18;, + 3;17,24,25;, + 3;18,26,19;, + 3;18,25,26;, + 3;19,27,20;, + 3;19,26,27;, + 3;20,27,13;, + 3;13,28,21;, + 3;13,27,28;, + 3;21,29,22;, + 3;21,28,29;, + 3;22,30,23;, + 3;22,29,30;, + 3;23,24,17;, + 3;23,30,24;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01GROIN} + } + MeshNormals { + 64; + -0.000000;-0.983877;-0.178844;, + -0.599572;0.408149;-0.688424;, + -0.560307;-0.381698;-0.735093;, + 0.000000;0.508170;-0.861257;, + -0.000000;-0.447290;-0.894389;, + 0.559687;0.421739;-0.713363;, + -0.000000;-0.447290;-0.894389;, + 0.937160;-0.239286;-0.253915;, + -0.880351;-0.277520;-0.384663;, + 0.000009;-0.721590;-0.692320;, + -0.680092;-0.595592;-0.427487;, + -0.956486;0.091041;-0.277212;, + -0.776351;0.298631;-0.555067;, + -0.612329;0.585592;-0.531163;, + -0.595763;0.530237;-0.603254;, + 0.000020;0.721585;-0.692326;, + 0.573074;0.533170;-0.622347;, + 0.634858;0.683287;-0.360657;, + 0.000014;-0.721592;-0.692319;, + 0.969727;-0.158439;-0.185813;, + -0.603915;-0.361813;-0.710196;, + 0.000004;-0.998923;-0.046402;, + -0.776502;-0.254344;-0.576501;, + -0.537039;0.077572;-0.839983;, + -0.815733;0.081073;-0.572719;, + -0.490500;0.710156;-0.505063;, + -0.643035;0.648313;-0.407671;, + -0.000027;0.999717;-0.023792;, + -0.010253;0.995713;0.091927;, + 0.398539;0.900274;-0.175139;, + 0.488511;0.525776;-0.696359;, + 0.507328;0.077991;-0.858217;, + 0.768552;0.139116;-0.624480;, + 0.584865;-0.268944;-0.765246;, + 0.845605;-0.234038;-0.479769;, + -0.000011;-0.998923;-0.046406;, + -0.654640;-0.753300;0.063125;, + -0.000010;-0.946205;0.323569;, + -0.582828;-0.600451;-0.547512;, + -0.943651;0.328187;0.042606;, + -0.654989;0.198844;-0.729006;, + -0.275500;0.960845;0.029596;, + -0.400693;0.869473;-0.288898;, + -0.014416;0.942382;0.334229;, + 0.328384;0.846238;-0.419578;, + 0.943441;0.328185;0.047052;, + 0.657040;0.204764;-0.725514;, + 0.655845;-0.753077;-0.052365;, + 0.593011;-0.504799;-0.627309;, + -0.000003;-0.946197;0.323591;, + -0.609542;-0.686312;0.396779;, + -0.000003;-0.946203;0.323573;, + -0.598574;-0.685369;0.414704;, + -0.799848;0.272917;0.534565;, + -0.802248;0.278457;0.528072;, + -0.263482;0.899018;0.349777;, + -0.132000;0.918501;0.372736;, + -0.028788;0.952884;0.301965;, + 0.168538;0.913545;0.370176;, + 0.807613;0.275554;0.521374;, + 0.802809;0.278602;0.527141;, + 0.596840;-0.672007;0.438393;, + 0.597512;-0.684374;0.417866;, + -0.000004;-0.946204;0.323571;; + 53; + 3;2,10,0;, + 3;2,8,10;, + 3;1,12,3;, + 3;1,11,12;, + 3;2,13,14;, + 3;3,16,5;, + 3;3,15,16;, + 3;6,9,4;, + 3;6,18,9;, + 3;8,22,10;, + 3;8,20,22;, + 3;11,24,12;, + 3;11,23,24;, + 3;13,26,14;, + 3;13,25,26;, + 3;15,28,16;, + 3;15,27,28;, + 3;17,29,30;, + 3;16,32,5;, + 3;16,31,32;, + 3;7,34,19;, + 3;7,33,34;, + 3;18,21,9;, + 3;18,35,21;, + 3;20,38,22;, + 3;20,36,38;, + 3;23,40,24;, + 3;23,39,40;, + 3;25,42,26;, + 3;25,41,42;, + 3;27,43,28;, + 3;29,44,30;, + 3;31,46,32;, + 3;31,45,46;, + 3;33,48,34;, + 3;33,47,48;, + 3;35,37,21;, + 3;35,49,37;, + 3;36,52,38;, + 3;36,50,52;, + 3;39,54,40;, + 3;39,53,54;, + 3;41,56,42;, + 3;41,55,56;, + 3;43,57,28;, + 3;29,58,44;, + 3;29,56,58;, + 3;45,60,46;, + 3;45,59,60;, + 3;47,62,48;, + 3;47,61,62;, + 3;49,51,37;, + 3;49,63,51;; + } + MeshTextureCoords { + 31; + 0.546412;0.933469;, + 0.511654;0.933469;, + 0.458180;0.933469;, + 0.526982;0.782985;, + 0.572075;0.782985;, + 0.559777;0.782985;, + 0.518783;0.782985;, + 0.477788;0.782985;, + 0.469589;0.782985;, + 0.554433;0.369152;, + 0.642665;0.369151;, + 0.618602;0.369152;, + 0.538391;0.369152;, + 0.458180;0.369152;, + 0.377969;0.369152;, + 0.353907;0.369152;, + 0.442138;0.369152;, + 0.666728;0.256288;, + 0.931421;0.256289;, + 0.859233;0.256288;, + 0.618602;0.256288;, + 0.137338;0.256288;, + 0.065150;0.256289;, + 0.329843;0.256288;, + 0.638654;0.068183;, + 0.859233;0.068183;, + 0.799074;0.068183;, + 0.598548;0.068183;, + 0.197495;0.068183;, + 0.137338;0.068183;, + 0.357917;0.068183;; + } + } + + Frame x3ds_Chest { + FrameTransformMatrix { + 1.000000, 0.000000, 0.000000, 0.000000, + -0.000000, 1.000000, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + -0.426950, 1.024469, 11.366162, 1.000000;; + } + Mesh Chest { + + 40; + -5.406384; -9.499996; -0.774913;, + -14.573050; -1.772723; -0.774910;, + -12.073050; 5.181822; -0.774907;, + -3.739717; 7.500004; -0.774907;, + 4.593616; 7.500004; -0.774907;, + 12.926949; 5.181822; -0.774910;, + 15.426949; -1.772723; -0.774914;, + 6.260283; -9.499996; -0.774913;, + -8.859015; -15.499998; 25.225092;, + -23.451246; -1.491749; 25.225090;, + -19.471548; 11.115673; 25.225096;, + -6.205883; 15.318148; 25.225096;, + 7.059781; 15.318148; 25.225096;, + 20.325445; 11.115673; 25.225096;, + 24.305143; -1.491749; 25.225090;, + 9.712914; -15.499998; 25.225092;, + -10.054240; -15.499997; 34.225082;, + -33.573051; -1.863631; 34.225082;, + -22.032743; 10.409095; 34.225082;, + -7.059614; 14.500003; 34.225082;, + 7.913515; 14.500003; 34.225082;, + 22.886644; 10.409095; 34.225082;, + 34.426949; -1.863631; 34.225082;, + 10.908140; -15.499997; 34.225082;, + -10.850827; -11.500252; 40.225082;, + -31.573050; -2.106038; 41.225090;, + -23.739717; 8.348755; 42.225098;, + -7.628605; 9.167019; 40.225098;, + 8.482507; 9.167019; 40.225098;, + 24.593618; 8.348755; 42.225090;, + 32.426949; -2.106038; 41.225090;, + 11.704728; -11.500252; 40.225082;, + -8.517495; -9.499994; 43.225082;, + -18.573050; -2.227266; 43.225090;, + -14.573050; 4.318189; 43.225098;, + -5.961939; 6.500007; 43.225098;, + 6.815839; 6.500007; 43.225090;, + 15.426950; 4.318189; 43.225090;, + 19.426950; -2.227266; 43.225090;, + 9.371394; -9.499994; 43.225082;; + + 70; + 3;0,9,1;, + 3;1,9,2;, + 3;0,8,9;, + 3;9,10,2;, + 3;2,11,3;, + 3;2,10,11;, + 3;3,12,4;, + 3;3,11,12;, + 3;4,13,5;, + 3;4,12,13;, + 3;5,14,6;, + 3;5,13,14;, + 3;6,15,7;, + 3;6,14,15;, + 3;7,8,0;, + 3;7,15,8;, + 3;8,17,9;, + 3;8,16,17;, + 3;9,18,10;, + 3;9,17,18;, + 3;10,19,11;, + 3;10,18,19;, + 3;11,20,12;, + 3;11,19,20;, + 3;12,21,13;, + 3;12,20,21;, + 3;13,22,14;, + 3;13,21,22;, + 3;14,23,15;, + 3;14,22,23;, + 3;15,16,8;, + 3;15,23,16;, + 3;16,25,17;, + 3;16,24,25;, + 3;17,26,18;, + 3;17,25,26;, + 3;18,27,19;, + 3;18,26,27;, + 3;19,28,20;, + 3;19,27,28;, + 3;20,29,21;, + 3;20,28,29;, + 3;21,30,22;, + 3;21,29,30;, + 3;22,31,23;, + 3;22,30,31;, + 3;23,24,16;, + 3;23,31,24;, + 3;24,33,25;, + 3;24,32,33;, + 3;25,34,26;, + 3;25,33,34;, + 3;26,35,27;, + 3;26,34,35;, + 3;27,36,28;, + 3;27,35,36;, + 3;28,37,29;, + 3;28,36,37;, + 3;29,38,30;, + 3;29,37,38;, + 3;30,39,31;, + 3;30,38,39;, + 3;31,32,24;, + 3;31,39,32;, + 3;37,39,38;, + 3;36,39,37;, + 3;36,32,39;, + 3;35,32,36;, + 3;35,33,32;, + 3;34,33,35;; + MeshMaterialList { + 2; + 70; + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_01BACK} + {x3ds_mat_01CHEST} + } + MeshNormals { + 88; + -0.650995;-0.723751;-0.228890;, + 0.000000;-0.974391;-0.224860;, + -0.630534;-0.747987;-0.207225;, + -0.894967;0.321720;-0.309080;, + -0.899082;0.303417;-0.315579;, + -0.272342;0.915691;-0.295533;, + -0.255614;0.918875;-0.300549;, + 0.000000;0.957642;-0.287961;, + 0.000000;0.957642;-0.287961;, + 0.272548;0.916640;-0.292383;, + 0.256974;0.923763;-0.283949;, + 0.899082;0.303417;-0.315579;, + 0.894967;0.321720;-0.309080;, + 0.649687;-0.721872;-0.238346;, + 0.623476;-0.739614;-0.253474;, + 0.000000;-0.974391;-0.224860;, + -0.592597;-0.735803;-0.327753;, + 0.000000;-0.993577;-0.113156;, + -0.627516;-0.684776;-0.370547;, + -0.846659;0.369049;-0.383368;, + -0.915063;0.288852;-0.281468;, + -0.288159;0.954384;-0.078204;, + -0.286130;0.941081;-0.180268;, + -0.000000;0.994932;-0.100550;, + 0.000000;0.994932;-0.100550;, + 0.288029;0.953917;-0.084156;, + 0.284948;0.937354;-0.200430;, + 0.805421;0.413325;-0.424806;, + 0.840105;0.278624;-0.465394;, + 0.612424;-0.738201;-0.282836;, + 0.664713;-0.722563;-0.189894;, + 0.000000;-0.993577;-0.113156;, + -0.460440;-0.868344;0.184319;, + 0.000000;-0.957096;0.289770;, + -0.546338;-0.811570;-0.207047;, + -0.753038;0.645392;-0.128076;, + -0.789210;0.537054;-0.297861;, + -0.169555;0.935537;0.309874;, + -0.269038;0.931504;0.244784;, + -0.000000;0.917665;0.397355;, + 0.000000;0.917665;0.397355;, + 0.167433;0.931814;0.322007;, + 0.275612;0.957904;0.080362;, + 0.753370;0.657303;0.019667;, + 0.778010;0.578988;-0.243874;, + 0.468713;-0.883303;0.009149;, + 0.573798;-0.817112;-0.055524;, + -0.000000;-0.957096;0.289770;, + -0.309902;-0.616721;0.723613;, + 0.000000;-0.832067;0.554676;, + -0.357822;-0.755836;0.548339;, + -0.413278;0.254886;0.874205;, + -0.677530;0.516275;0.523844;, + -0.005950;0.707002;0.707186;, + -0.061460;0.847479;0.527259;, + -0.000000;0.747432;0.664339;, + 0.000000;0.747432;0.664339;, + 0.013296;0.633065;0.773985;, + 0.045031;0.769592;0.636946;, + 0.446324;0.289292;0.846821;, + 0.686668;0.532100;0.495334;, + 0.318002;-0.685018;0.655458;, + 0.392151;-0.818553;0.419747;, + 0.000000;-0.832067;0.554676;, + -0.415209;-0.574084;0.705712;, + 0.000000;-0.832017;0.554750;, + 0.000000;-0.000000;1.000000;, + -0.283804;-0.500875;0.817667;, + -0.150574;0.092016;0.984307;, + 0.000000;-0.000001;1.000000;, + -0.131964;0.040870;0.990412;, + -0.039366;0.155367;0.987072;, + 0.000000;-0.000001;1.000000;, + 0.001540;0.487185;0.873297;, + 0.000000;0.747367;0.664412;, + 0.000001;-0.000001;1.000000;, + 0.000000;0.747366;0.664413;, + 0.173828;0.686055;0.706479;, + -0.000000;-0.000000;1.000000;, + 0.042888;0.569361;0.820968;, + 0.085553;0.052282;0.994961;, + -0.000001;-0.000000;1.000000;, + 0.118785;0.035793;0.992275;, + 0.150620;-0.208254;0.966408;, + -0.000001;-0.000000;1.000000;, + 0.223800;-0.466352;0.855821;, + 0.000000;-0.832017;0.554750;, + -0.000001;-0.000000;1.000000;; + 70; + 3;0,18,2;, + 3;3,19,4;, + 3;0,16,18;, + 3;19,20,4;, + 3;5,22,6;, + 3;5,21,22;, + 3;7,24,8;, + 3;7,23,24;, + 3;9,26,10;, + 3;9,25,26;, + 3;11,28,12;, + 3;11,27,28;, + 3;13,30,14;, + 3;13,29,30;, + 3;15,17,1;, + 3;15,31,17;, + 3;16,34,18;, + 3;16,32,34;, + 3;19,36,20;, + 3;19,35,36;, + 3;21,38,22;, + 3;21,37,38;, + 3;23,40,24;, + 3;23,39,40;, + 3;25,42,26;, + 3;25,41,42;, + 3;27,44,28;, + 3;27,43,44;, + 3;29,46,30;, + 3;29,45,46;, + 3;31,33,17;, + 3;31,47,33;, + 3;32,50,34;, + 3;32,48,50;, + 3;35,52,36;, + 3;35,51,52;, + 3;37,54,38;, + 3;37,53,54;, + 3;39,56,40;, + 3;39,55,56;, + 3;41,58,42;, + 3;41,57,58;, + 3;43,60,44;, + 3;43,59,60;, + 3;45,62,46;, + 3;45,61,62;, + 3;47,49,33;, + 3;47,63,49;, + 3;48,67,50;, + 3;48,64,67;, + 3;51,70,52;, + 3;51,68,70;, + 3;53,73,54;, + 3;53,71,73;, + 3;55,76,56;, + 3;55,74,76;, + 3;57,79,58;, + 3;57,77,79;, + 3;59,82,60;, + 3;59,80,82;, + 3;61,85,62;, + 3;61,83,85;, + 3;63,65,49;, + 3;63,86,65;, + 3;81,87,84;, + 3;78,87,81;, + 3;78,66,87;, + 3;75,66,78;, + 3;75,69,66;, + 3;72,69,75;; + } + MeshTextureCoords { + 40; + 0.427128;1.000148;, + 0.312615;1.000148;, + 0.343846;1.000148;, + 0.447949;1.000148;, + 0.552051;1.000148;, + 0.656154;1.000148;, + 0.687385;1.000148;, + 0.572872;1.000148;, + 0.383997;0.458321;, + 0.201706;0.458321;, + 0.251421;0.458321;, + 0.417140;0.458321;, + 0.582860;0.458321;, + 0.748579;0.458321;, + 0.798294;0.458321;, + 0.616003;0.458321;, + 0.369065;0.270766;, + 0.075261;0.270766;, + 0.219426;0.270766;, + 0.406475;0.270766;, + 0.593525;0.270766;, + 0.780574;0.270766;, + 0.924739;0.270766;, + 0.630935;0.270766;, + 0.359114;0.145729;, + 0.000307;-0.000148;, + 0.198102;0.104050;, + 0.399367;0.145729;, + 0.600633;0.145729;, + 0.801898;0.104050;, + 0.999693;-0.000148;, + 0.640886;0.145729;, + 0.388263;0.083210;, + 0.262646;0.083210;, + 0.312615;0.083210;, + 0.420188;0.083210;, + 0.579812;0.083210;, + 0.687385;0.083210;, + 0.737354;0.083210;, + 0.611737;0.083210;; + } + } + + Frame x3ds_RU_Arm { + FrameTransformMatrix { + -0.965926, -0.000000, -0.258819, 0.000000, + 0.000000, -1.000000, -0.000000, 0.000000, + -0.258819, -0.000000, 0.965926, 0.000000, + -22.158115, 0.000006, 34.682274, 1.000000;; + } + Mesh RU_Arm { + + 12; + -5.501477; 0.000004; -2.449525;, + -2.458304; 6.273188; -0.692550;, + 3.628045; 6.273185; 2.821392;, + 6.671256; -0.000001; 4.578400;, + 3.628039; -6.273173; 2.821389;, + -2.458306; -6.273183; -0.692544;, + 8.608694; 0.000001; -22.981846;, + 10.805939; 4.394536; -21.713266;, + 15.200456; 4.394535; -19.176115;, + 17.397690; -0.000002; -17.907520;, + 15.200446; -4.394550; -19.176085;, + 10.805936; -4.394485; -21.713276;; + + 20; + 3;7,0,1;, + 3;6,0,7;, + 3;8,1,2;, + 3;7,1,8;, + 3;9,2,3;, + 3;8,2,9;, + 3;10,3,4;, + 3;9,3,10;, + 3;11,4,5;, + 3;10,4,11;, + 3;6,5,0;, + 3;11,5,6;, + 3;0,2,1;, + 3;0,3,2;, + 3;0,4,3;, + 3;0,5,4;, + 3;7,8,9;, + 3;7,9,10;, + 3;7,10,11;, + 3;7,11,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHARM} + } + MeshNormals { + 36; + -0.716210;0.493166;-0.493793;, + -0.719558;-0.487559;-0.494492;, + -0.499999;-0.000001;0.866026;, + -0.718101;0.487469;-0.496693;, + 0.037713;0.997151;-0.065320;, + -0.499999;-0.000001;0.866026;, + 0.037713;0.997151;-0.065320;, + 0.785987;0.493148;0.372868;, + -0.499999;-0.000001;0.866026;, + 0.788019;0.487564;0.375908;, + 0.785740;-0.493168;0.373360;, + -0.500000;0.000002;0.866026;, + 0.789195;-0.487476;0.373548;, + 0.037714;-0.997151;-0.065321;, + -0.500000;-0.000002;0.866026;, + 0.037714;-0.997151;-0.065321;, + -0.715906;-0.493147;-0.494252;, + -0.499998;0.000002;0.866027;, + -0.714286;0.498840;-0.490870;, + -0.715906;-0.493147;-0.494252;, + 0.499999;0.000001;-0.866026;, + -0.716210;0.493166;-0.493793;, + 0.037713;0.997151;-0.065320;, + 0.499996;-0.000007;-0.866027;, + 0.037713;0.997151;-0.065320;, + 0.783919;0.498709;0.369812;, + 0.499996;-0.000007;-0.866027;, + 0.785987;0.493148;0.372868;, + 0.782250;-0.498838;0.373156;, + 0.499996;-0.000007;-0.866027;, + 0.785740;-0.493168;0.373360;, + 0.037701;-0.997152;-0.065325;, + 0.499999;-0.000002;-0.866026;, + 0.037714;-0.997151;-0.065321;, + -0.712222;-0.498712;-0.493989;, + 0.500003;0.000001;-0.866024;; + 20; + 3;21,0,3;, + 3;18,0,21;, + 3;24,4,6;, + 3;22,4,24;, + 3;27,7,9;, + 3;25,7,27;, + 3;30,10,12;, + 3;28,10,30;, + 3;33,13,15;, + 3;31,13,33;, + 3;19,16,1;, + 3;34,16,19;, + 3;2,8,5;, + 3;2,11,8;, + 3;2,14,11;, + 3;2,17,14;, + 3;23,26,29;, + 3;23,29,32;, + 3;23,32,35;, + 3;23,35,20;; + } + MeshTextureCoords { + 12; + 0.250000;-0.011257;, + 0.081267;-0.011257;, + 0.918734;-0.011257;, + 0.750000;-0.011257;, + 0.581266;-0.011257;, + 0.418733;-0.011257;, + 0.250000;1.011257;, + 0.083334;1.011257;, + 0.916666;1.011257;, + 0.750000;1.011257;, + 0.583334;1.011257;, + 0.416666;1.011257;; + } + } + + Frame x3ds_RL_Arm { + FrameTransformMatrix { + 1.000000, -0.000000, -0.000000, 0.000000, + -0.000000, 1.000000, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + 13.822151, 0.000003, -20.565968, 1.000000;; + } + Mesh RL_Arm { + + 24; + 8.013477; 0.000005; -35.874058;, + 12.494552; 9.237309; -33.286903;, + 21.456678; 9.237304; -28.112616;, + 25.937769; -0.000003; -25.525463;, + 21.456680; -9.237155; -28.112616;, + 12.494545; -9.237303; -33.286919;, + -4.837206; 0.000002; -3.067563;, + -2.639963; 4.394549; -1.798980;, + 1.754547; 4.394535; 0.738177;, + 3.951795; -0.000002; 2.006753;, + 1.754554; -4.394537; 0.738174;, + -2.639967; -4.394535; -1.798978;, + 5.120436; -0.663049; -1.830179;, + 10.395203; -0.663048; -7.844885;, + 9.816457; -0.663051; 4.948281;, + 5.120435; 0.336947; -1.830175;, + 10.395203; 0.336952; -7.844885;, + 9.816456; 0.336949; 4.948285;, + 15.652800; -0.663047; -15.309710;, + 20.927570; -0.663046; -21.324427;, + 20.348825; -0.663049; -8.531265;, + 15.652801; 0.336953; -15.309710;, + 20.927568; 0.336950; -21.324423;, + 20.348825; 0.336947; -8.531264;; + + 32; + 3;0,7,1;, + 3;0,6,7;, + 3;1,8,2;, + 3;1,7,8;, + 3;2,9,3;, + 3;2,8,9;, + 3;3,10,4;, + 3;3,9,10;, + 3;4,11,5;, + 3;4,10,11;, + 3;5,6,0;, + 3;5,11,6;, + 3;2,0,1;, + 3;3,0,2;, + 3;4,0,3;, + 3;5,0,4;, + 3;8,7,9;, + 3;9,7,10;, + 3;10,7,11;, + 3;11,7,6;, + 3;12,13,14;, + 3;13,17,14;, + 3;13,16,17;, + 3;14,15,12;, + 3;14,17,15;, + 3;16,15,17;, + 3;18,19,20;, + 3;19,23,20;, + 3;19,22,23;, + 3;20,21,18;, + 3;20,23,21;, + 3;22,21,23;; + MeshMaterialList { + 2; + 32; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHARM} + {x3ds_mat_BLUEPLASTIC} + } + MeshNormals { + 64; + -0.811971;0.490075;-0.317063;, + -0.814533;-0.484496;-0.319062;, + 0.500000;0.000000;-0.866025;, + -0.815268;0.484377;-0.317359;, + -0.068845;0.990475;0.119243;, + 0.500000;0.000000;-0.866025;, + -0.068845;0.990475;0.119243;, + 0.679969;0.490008;0.545467;, + 0.500000;0.000000;-0.866025;, + 0.683580;0.484497;0.545876;, + 0.680568;-0.490079;0.544656;, + 0.500000;0.000001;-0.866025;, + 0.682472;-0.484384;0.547362;, + -0.068832;-0.990476;0.119249;, + 0.500000;-0.000000;-0.866025;, + -0.068832;-0.990476;0.119249;, + -0.812373;-0.490007;-0.316139;, + 0.500001;0.000001;-0.866025;, + -0.808639;0.495752;-0.316753;, + -0.812373;-0.490007;-0.316139;, + -0.500002;0.000000;0.866024;, + -0.811971;0.490075;-0.317063;, + -0.068842;0.990475;0.119244;, + -0.499998;0.000000;0.866027;, + -0.068845;0.990475;0.119243;, + 0.676328;0.495497;0.545035;, + -0.499998;0.000000;0.866027;, + 0.679969;0.490008;0.545467;, + 0.678635;-0.495752;0.541927;, + -0.499998;0.000000;0.866027;, + 0.680568;-0.490079;0.544656;, + -0.068843;-0.990476;0.119239;, + -0.499999;-0.000001;0.866026;, + -0.068832;-0.990476;0.119249;, + -0.810178;-0.495496;-0.313202;, + -0.499996;0.000000;0.866028;, + -0.000000;-1.000000;-0.000000;, + -0.822008;-0.000003;0.569476;, + -0.000000;-1.000000;-0.000000;, + 0.998978;0.000001;0.045192;, + -0.000000;-1.000000;-0.000000;, + 0.998978;0.000001;0.045192;, + -0.822008;-0.000003;0.569476;, + -0.822008;-0.000003;0.569476;, + -0.000001;1.000000;0.000000;, + 0.998978;-0.000000;0.045193;, + -0.000001;1.000000;0.000000;, + 0.998978;0.000001;0.045192;, + -0.822008;-0.000003;0.569476;, + -0.000001;1.000000;0.000000;, + -0.000000;-1.000000;-0.000000;, + -0.822007;0.000001;0.569477;, + -0.000000;-1.000000;-0.000000;, + 0.998978;-0.000000;0.045192;, + -0.000000;-1.000000;-0.000000;, + 0.998978;-0.000000;0.045192;, + -0.822007;0.000001;0.569477;, + -0.822007;0.000001;0.569477;, + 0.000001;1.000000;0.000000;, + 0.998978;0.000002;0.045192;, + 0.000001;1.000000;0.000000;, + 0.998978;-0.000000;0.045192;, + -0.822007;-0.000001;0.569477;, + 0.000001;1.000000;0.000000;; + 32; + 3;0,21,3;, + 3;0,18,21;, + 3;4,24,6;, + 3;4,22,24;, + 3;7,27,9;, + 3;7,25,27;, + 3;10,30,12;, + 3;10,28,30;, + 3;13,33,15;, + 3;13,31,33;, + 3;16,19,1;, + 3;16,34,19;, + 3;8,2,5;, + 3;11,2,8;, + 3;14,2,11;, + 3;17,2,14;, + 3;26,23,29;, + 3;29,23,32;, + 3;32,23,35;, + 3;35,23,20;, + 3;36,38,40;, + 3;39,47,41;, + 3;39,45,47;, + 3;42,43,37;, + 3;42,48,43;, + 3;46,44,49;, + 3;50,52,54;, + 3;53,61,55;, + 3;53,59,61;, + 3;56,57,51;, + 3;56,62,57;, + 3;60,58,63;; + } + MeshTextureCoords { + 24; + 0.250000;2.476449;, + 0.081266;2.476449;, + 0.918734;2.476449;, + 0.750000;2.476449;, + 0.581266;2.476449;, + 0.418734;2.476449;, + 0.250000;1.042238;, + 0.083334;1.042238;, + 0.916666;1.042238;, + 0.750000;1.042238;, + 0.583334;1.042238;, + 0.416666;1.042238;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_R_Hand { + FrameTransformMatrix { + -0.965926, 0.000000, -0.258819, 0.000000, + -0.258819, -0.000000, 0.965925, 0.000000, + 0.000000, 1.000000, 0.000000, 0.000000, + 17.201626, -0.532497, -26.974564, 1.000000;; + } + Mesh R_Hand { + + 8; + -6.156250; -13.356396; -4.582500;, + 6.843750; -13.356392; -4.582499;, + 3.756248; -0.356396; -2.650550;, + -3.068748; -0.356396; -2.650550;, + -6.156250; -13.356396; 4.582500;, + 6.843750; -13.356392; 4.582499;, + 3.756248; -0.356396; 2.650486;, + -3.068748; -0.356396; 2.650486;; + + 10; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHHAND} + } + MeshNormals { + 20; + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;-0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.972937;0.231073;-0.000000;, + 0.000000;0.146997;-0.989137;, + -0.972937;0.231073;-0.000000;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;, + 0.000000;-1.000000;0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.147002;0.989136;, + 0.972937;0.231073;0.000000;, + 0.000000;0.147002;0.989136;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;; + 10; + 3;0,6,3;, + 3;0,8,6;, + 3;1,13,10;, + 3;1,4,13;, + 3;5,16,14;, + 3;5,7,16;, + 3;9,11,18;, + 3;9,2,11;, + 3;12,17,19;, + 3;12,15,17;; + } + MeshTextureCoords { + 8; + 0.032627;0.773816;, + 0.032627;0.773815;, + 0.231505;-0.195808;, + 0.231505;-0.195808;, + 0.976087;0.773816;, + 0.976087;0.773815;, + 0.777202;-0.195808;, + 0.777202;-0.195808;; + } + } + } + } + } + + Frame x3ds_LU_Arm { + FrameTransformMatrix { + -0.965926, -0.000000, -0.258819, 0.000000, + 0.000000, -1.000000, -0.000000, 0.000000, + -0.258819, -0.000000, 0.965926, 0.000000, + 22.800379, 0.000008, 34.682274, 1.000000;; + } + Mesh LU_Arm { + + 12; + 5.988949; 0.000003; 0.629316;, + 2.474997; 6.273188; 0.629317;, + -4.552909; 6.273124; 0.629308;, + -8.066915; 0.000002; 0.629317;, + -4.552907; -6.273170; 0.629307;, + 2.474994; -6.273119; 0.629322;, + 4.035422; 0.000003; -24.207560;, + 1.498248; 4.394476; -24.207499;, + -3.576368; 4.394538; -24.207462;, + -6.113520; 0.000003; -24.207476;, + -3.576366; -4.394546; -24.207474;, + 1.498253; -4.394546; -24.207510;; + + 20; + 3;0,7,1;, + 3;0,6,7;, + 3;1,8,2;, + 3;1,7,8;, + 3;2,9,3;, + 3;2,8,9;, + 3;3,10,4;, + 3;3,9,10;, + 3;4,11,5;, + 3;4,10,11;, + 3;5,6,0;, + 3;5,11,6;, + 3;2,0,1;, + 3;3,0,2;, + 3;4,0,3;, + 3;5,0,4;, + 3;8,7,9;, + 3;9,7,10;, + 3;10,7,11;, + 3;11,7,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHARM} + } + MeshNormals { + 36; + 0.867150;0.493170;-0.069529;, + 0.870399;-0.487563;-0.068461;, + -0.000001;-0.000001;1.000000;, + 0.870241;0.487469;-0.071097;, + -0.000009;0.997152;-0.075422;, + -0.000001;-0.000001;1.000000;, + -0.000009;0.997152;-0.075422;, + -0.867118;0.493150;-0.070072;, + -0.000001;-0.000001;1.000000;, + -0.870397;0.487569;-0.068456;, + -0.867152;-0.493168;-0.069523;, + 0.000000;0.000001;1.000000;, + -0.870238;-0.487476;-0.071088;, + 0.000007;-0.997152;-0.075421;, + 0.000000;-0.000001;1.000000;, + 0.000007;-0.997152;-0.075421;, + 0.867118;-0.493148;-0.070077;, + -0.000002;0.000002;1.000000;, + 0.864021;0.498848;-0.067959;, + 0.867118;-0.493148;-0.070077;, + -0.000022;0.000001;-1.000000;, + 0.867150;0.493170;-0.069529;, + 0.000012;0.997151;-0.075427;, + -0.000007;0.000007;-1.000000;, + -0.000009;0.997152;-0.075422;, + -0.863800;0.498709;-0.071684;, + -0.000007;0.000007;-1.000000;, + -0.867118;0.493150;-0.070072;, + -0.864027;-0.498838;-0.067955;, + -0.000007;0.000007;-1.000000;, + -0.867152;-0.493168;-0.069523;, + -0.000001;-0.997152;-0.075423;, + -0.000002;-0.000002;-1.000000;, + 0.000007;-0.997152;-0.075421;, + 0.863799;-0.498710;-0.071691;, + -0.000007;0.000001;-1.000000;; + 20; + 3;0,21,3;, + 3;0,18,21;, + 3;4,24,6;, + 3;4,22,24;, + 3;7,27,9;, + 3;7,25,27;, + 3;10,30,12;, + 3;10,28,30;, + 3;13,33,15;, + 3;13,31,33;, + 3;16,19,1;, + 3;16,34,19;, + 3;8,2,5;, + 3;11,2,8;, + 3;14,2,11;, + 3;17,2,14;, + 3;26,23,29;, + 3;29,23,32;, + 3;32,23,35;, + 3;35,23,20;; + } + MeshTextureCoords { + 12; + 0.250000;-0.011257;, + 0.081267;-0.011257;, + 0.918734;-0.011257;, + 0.750000;-0.011257;, + 0.581266;-0.011257;, + 0.418733;-0.011257;, + 0.250000;1.011257;, + 0.083334;1.011257;, + 0.916666;1.011257;, + 0.750000;1.011257;, + 0.583334;1.011257;, + 0.416666;1.011257;; + } + } + + Frame x3ds_LL_Arm { + FrameTransformMatrix { + 1.000000, -0.000000, -0.000000, 0.000000, + -0.000000, 1.000000, 0.000000, 0.000000, + -0.000000, -0.000000, 1.000000, 0.000000, + -0.446584, 0.000005, -24.389263, 1.000000;; + } + Mesh LL_Arm { + + 24; + 9.756407; 0.000006; -35.407063;, + 4.582108; 9.237311; -35.407040;, + -5.766471; 9.237184; -35.407040;, + -10.940788; 0.000005; -35.407043;, + -5.766469; -9.237275; -35.407063;, + 4.582115; -9.237300; -35.407051;, + 4.482169; 0.000002; -0.570457;, + 1.945006; 4.394486; -0.570453;, + -3.129325; 4.394474; -0.570462;, + -5.666486; 0.000001; -0.570473;, + -3.129334; -4.394471; -0.570465;, + 1.945009; -4.394471; -0.570457;, + -4.525237; -0.663046; -4.414725;, + -6.085963; -0.663051; -12.261003;, + -11.981339; -0.663046; -0.892426;, + -4.525237; 0.336950; -4.414725;, + -6.085961; 0.336952; -12.261005;, + -11.981338; 0.336954; -0.892433;, + -6.906761; -0.663049; -21.354527;, + -8.467486; -0.663040; -29.200804;, + -14.362860; -0.663049; -17.832241;, + -6.906761; 0.336958; -21.354527;, + -8.467486; 0.336956; -29.200804;, + -14.362861; 0.336954; -17.832237;; + + 32; + 3;7,0,1;, + 3;6,0,7;, + 3;8,1,2;, + 3;7,1,8;, + 3;9,2,3;, + 3;8,2,9;, + 3;10,3,4;, + 3;9,3,10;, + 3;11,4,5;, + 3;10,4,11;, + 3;6,5,0;, + 3;11,5,6;, + 3;0,2,1;, + 3;0,3,2;, + 3;0,4,3;, + 3;0,5,4;, + 3;7,8,9;, + 3;7,9,10;, + 3;7,10,11;, + 3;7,11,6;, + 3;13,12,14;, + 3;17,13,14;, + 3;16,13,17;, + 3;15,14,12;, + 3;17,14,15;, + 3;15,16,17;, + 3;19,18,20;, + 3;23,19,20;, + 3;22,19,23;, + 3;21,20,18;, + 3;23,20,21;, + 3;21,22,23;; + MeshMaterialList { + 2; + 32; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHARM} + {x3ds_mat_BLUEPLASTIC} + } + MeshNormals { + 64; + 0.861718;0.490078;0.131402;, + 0.864937;-0.484496;0.130951;, + -0.000000;0.000002;-1.000000;, + 0.864723;0.484376;0.132795;, + -0.000012;0.990475;0.137689;, + -0.000000;0.000002;-1.000000;, + -0.000012;0.990475;0.137689;, + -0.861601;0.490013;0.132404;, + -0.000000;0.000002;-1.000000;, + -0.864933;0.484503;0.130952;, + -0.861717;-0.490079;0.131403;, + -0.000001;0.000001;-1.000000;, + -0.864721;-0.484379;0.132795;, + -0.000003;-0.990475;0.137691;, + -0.000001;0.000002;-1.000000;, + -0.000003;-0.990475;0.137691;, + 0.861603;-0.490010;0.132403;, + 0.000001;-0.000002;-1.000000;, + 0.858676;0.495758;0.130003;, + 0.861603;-0.490010;0.132403;, + 0.000001;-0.000000;1.000000;, + 0.861718;0.490078;0.131402;, + -0.000003;0.990475;0.137691;, + -0.000002;-0.000002;1.000000;, + -0.000012;0.990475;0.137689;, + -0.858232;0.495502;0.133849;, + -0.000002;-0.000002;1.000000;, + -0.861601;0.490013;0.132404;, + -0.858676;-0.495757;0.130005;, + -0.000002;-0.000002;1.000000;, + -0.861717;-0.490079;0.131403;, + -0.000000;-0.990475;0.137691;, + -0.000003;0.000000;1.000000;, + -0.000003;-0.990475;0.137691;, + 0.858232;-0.495502;0.133850;, + -0.000002;-0.000000;1.000000;, + 0.000000;-1.000000;0.000001;, + 0.427141;0.000000;0.904185;, + 0.000000;-1.000000;0.000001;, + -0.887737;-0.000002;-0.460352;, + 0.000000;-1.000000;0.000001;, + -0.887737;-0.000002;-0.460352;, + 0.427141;0.000000;0.904185;, + 0.427141;0.000000;0.904185;, + 0.000001;1.000000;0.000000;, + -0.887737;-0.000000;-0.460352;, + 0.000001;1.000000;0.000000;, + -0.887737;-0.000002;-0.460352;, + 0.427141;0.000006;0.904185;, + 0.000001;1.000000;0.000000;, + -0.000001;-1.000000;-0.000001;, + 0.427140;-0.000000;0.904185;, + -0.000001;-1.000000;-0.000001;, + -0.887737;0.000001;-0.460352;, + -0.000001;-1.000000;-0.000001;, + -0.887737;0.000001;-0.460352;, + 0.427140;-0.000000;0.904185;, + 0.427140;-0.000000;0.904185;, + -0.000001;1.000000;-0.000000;, + -0.887737;0.000000;-0.460352;, + -0.000001;1.000000;-0.000000;, + -0.887737;0.000001;-0.460352;, + 0.427140;-0.000003;0.904185;, + -0.000001;1.000000;-0.000000;; + 32; + 3;21,0,3;, + 3;18,0,21;, + 3;24,4,6;, + 3;22,4,24;, + 3;27,7,9;, + 3;25,7,27;, + 3;30,10,12;, + 3;28,10,30;, + 3;33,13,15;, + 3;31,13,33;, + 3;19,16,1;, + 3;34,16,19;, + 3;2,8,5;, + 3;2,11,8;, + 3;2,14,11;, + 3;2,17,14;, + 3;23,26,29;, + 3;23,29,32;, + 3;23,32,35;, + 3;23,35,20;, + 3;38,36,40;, + 3;47,39,41;, + 3;45,39,47;, + 3;43,42,37;, + 3;48,42,43;, + 3;44,46,49;, + 3;52,50,54;, + 3;61,53,55;, + 3;59,53,61;, + 3;57,56,51;, + 3;62,56,57;, + 3;58,60,63;; + } + MeshTextureCoords { + 24; + 0.250000;2.476449;, + 0.081266;2.476449;, + 0.918734;2.476449;, + 0.750000;2.476449;, + 0.581266;2.476449;, + 0.418734;2.476449;, + 0.250000;1.042238;, + 0.083334;1.042238;, + 0.916666;1.042238;, + 0.750000;1.042238;, + 0.583334;1.042238;, + 0.416666;1.042238;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_L_Hand { + FrameTransformMatrix { + -0.965926, 0.000000, -0.258819, 0.000000, + -0.258819, -0.000000, 0.965925, 0.000000, + 0.000000, 1.000000, 0.000000, 0.000000, + -1.719950, -0.532492, -32.044582, 1.000000;; + } + Mesh L_Hand { + + 8; + -6.357616; -13.356400; -4.582500;, + 6.642384; -13.356396; -4.582499;, + 3.554882; -0.356400; -2.650550;, + -3.270115; -0.356400; -2.650550;, + -6.357616; -13.356400; 4.582500;, + 6.642384; -13.356396; 4.582499;, + 3.554882; -0.356399; 2.650486;, + -3.270115; -0.356399; 2.650486;; + + 10; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHHAND} + } + MeshNormals { + 20; + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.000000;-1.000000;-0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.146997;-0.989137;, + 0.972937;0.231073;-0.000000;, + 0.000000;0.146997;-0.989137;, + -0.972937;0.231073;-0.000000;, + 0.000000;-1.000000;0.000000;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;, + 0.000000;-1.000000;0.000000;, + 0.972937;0.231073;0.000000;, + -0.000000;0.147002;0.989136;, + 0.972937;0.231073;0.000000;, + 0.000000;0.147002;0.989136;, + -0.972937;0.231073;-0.000000;, + 0.000000;0.147002;0.989136;; + 10; + 3;0,6,3;, + 3;0,8,6;, + 3;1,13,10;, + 3;1,4,13;, + 3;5,16,14;, + 3;5,7,16;, + 3;9,11,18;, + 3;9,2,11;, + 3;12,17,19;, + 3;12,15,17;; + } + MeshTextureCoords { + 8; + 0.032628;0.773816;, + 0.032628;0.773815;, + 0.231506;-0.195808;, + 0.231506;-0.195808;, + 0.976087;0.773816;, + 0.976087;0.773815;, + 0.777203;-0.195808;, + 0.777203;-0.195808;; + } + } + } + } + } + + Frame x3ds_Head { + FrameTransformMatrix { + 0.996195, -0.087156, 0.000000, 0.000000, + -0.087156, -0.996195, -0.000000, 0.000000, + 0.000000, 0.000000, -1.000000, 0.000000, + 0.000000, 0.320932, 43.031708, 1.000000;; + } + Mesh Head { + + 14; + 0.425325; 1.962787; -19.572998;, + 8.670237; -5.947898; -18.382002;, + 11.100914; 4.408364; -18.855011;, + 1.451953; 10.441894; -18.855013;, + -9.223644; 5.996317; -18.855013;, + -8.846230; -4.605626; -18.382004;, + -0.560038; -8.044583; -15.549453;, + 8.843442; -3.382582; -2.678222;, + 11.100921; 4.408369; -3.122056;, + 1.451952; 10.441850; -3.122057;, + -9.223644; 5.996321; -3.121026;, + -8.571328; -2.049199; -2.677688;, + -0.522815; -9.619122; -0.089148;, + 0.425325; -0.037214; 3.679924;; + + 24; + 3;0,2,1;, + 3;0,3,2;, + 3;0,4,3;, + 3;0,5,4;, + 3;0,6,5;, + 3;0,1,6;, + 3;1,8,7;, + 3;1,2,8;, + 3;2,9,8;, + 3;2,3,9;, + 3;3,10,9;, + 3;3,4,10;, + 3;4,11,10;, + 3;4,5,11;, + 3;5,12,11;, + 3;5,6,12;, + 3;6,7,12;, + 3;6,1,7;, + 3;13,11,12;, + 3;13,10,11;, + 3;13,9,10;, + 3;13,8,9;, + 3;13,7,8;, + 3;13,12,7;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01HEAD} + } + MeshNormals { + 60; + 0.081687;-0.064598;-0.994562;, + 0.049012;0.078380;-0.995718;, + -0.036962;0.088760;-0.995367;, + -0.093941;-0.047711;-0.994434;, + 0.153237;-0.381582;-0.911545;, + -0.201835;-0.348186;-0.915439;, + 0.081687;-0.064598;-0.994562;, + -0.201835;-0.348186;-0.915439;, + 0.967436;-0.252527;0.017281;, + 0.263240;-0.952568;0.152705;, + 0.081687;-0.064598;-0.994562;, + 0.049012;0.078380;-0.995718;, + 0.973545;-0.228497;-0.000000;, + 0.530181;0.847885;-0.000000;, + 0.049012;0.078380;-0.995718;, + -0.036962;0.088760;-0.995367;, + 0.530184;0.847883;0.000002;, + -0.384421;0.923158;0.000003;, + -0.036962;0.088760;-0.995367;, + -0.093941;-0.047711;-0.994434;, + -0.384425;0.923156;-0.000000;, + -0.998267;-0.057694;0.011560;, + -0.093941;-0.047711;-0.994434;, + 0.153237;-0.381582;-0.911545;, + -0.999136;-0.034537;0.023112;, + -0.542700;-0.839759;0.016782;, + 0.153237;-0.381582;-0.911545;, + -0.201835;-0.348186;-0.915439;, + -0.354072;-0.930491;-0.093912;, + 0.406709;-0.912942;0.033537;, + 0.960443;-0.276327;0.034547;, + 0.406709;-0.912942;0.033537;, + 0.568130;-0.118225;0.814402;, + 0.465164;-0.363520;0.807140;, + 0.967436;-0.252527;0.017281;, + 0.530181;0.847885;-0.000000;, + 0.310173;0.496041;0.811010;, + 0.568130;-0.118225;0.814402;, + 0.530181;0.847885;-0.000000;, + -0.384421;0.923158;0.000003;, + -0.227197;0.545783;0.806537;, + 0.310173;0.496041;0.811010;, + -0.384421;0.923158;0.000003;, + -0.996729;-0.080813;0.000000;, + -0.576846;-0.001758;0.816851;, + -0.227197;0.545783;0.806537;, + -0.998267;-0.057694;0.011560;, + -0.700901;-0.701945;0.126535;, + -0.514933;-0.269185;0.813870;, + -0.576846;-0.001758;0.816851;, + -0.542700;-0.839759;0.016782;, + 0.535392;-0.840126;-0.086851;, + -0.514933;-0.269185;0.813870;, + 0.465164;-0.363520;0.807140;, + -0.514933;-0.269185;0.813870;, + -0.576846;-0.001758;0.816851;, + -0.227197;0.545783;0.806537;, + 0.310173;0.496041;0.811010;, + 0.568130;-0.118225;0.814402;, + 0.465164;-0.363520;0.807140;; + 24; + 3;0,10,6;, + 3;1,14,11;, + 3;2,18,15;, + 3;3,22,19;, + 3;4,26,23;, + 3;5,7,27;, + 3;8,34,30;, + 3;8,12,34;, + 3;13,38,35;, + 3;13,16,38;, + 3;17,42,39;, + 3;17,20,42;, + 3;21,46,43;, + 3;21,24,46;, + 3;25,50,47;, + 3;25,28,50;, + 3;29,31,51;, + 3;29,9,31;, + 3;54,48,52;, + 3;55,44,49;, + 3;56,40,45;, + 3;57,36,41;, + 3;58,32,37;, + 3;59,53,33;; + } + MeshTextureCoords { + 14; + 0.023465;0.004861;, + 0.658502;0.065512;, + 0.821431;0.041424;, + 0.999136;0.041424;, + 0.180988;0.041424;, + 0.342098;0.065512;, + 0.493676;0.209760;, + 0.695904;0.865226;, + 0.821431;0.842624;, + 0.999136;0.842624;, + 0.180988;0.842657;, + 0.305883;0.865234;, + 0.497409;0.997055;, + 0.480761;1.188995;; + } + } + } + } + + Frame x3ds_RU_Leg { + FrameTransformMatrix { + 0.996195, 0.000000, -0.087156, 0.000000, + -0.000000, -1.000000, -0.000000, 0.000000, + -0.087156, 0.000000, -0.996195, 0.000000, + -6.849588, -0.163910, 2.374464, 1.000000;; + } + Mesh RU_Leg { + + 8; + -11.013890; -7.083223; -1.154131;, + 3.719295; -7.083223; -1.154224;, + 3.719296; 7.083232; -1.154223;, + -11.013890; 7.083232; -1.154134;, + -10.314070; -5.595809; 40.157955;, + 3.019470; -5.595746; 40.157955;, + 3.019406; 5.595754; 40.157948;, + -10.314070; 5.595690; 40.157944;; + + 12; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHLEG} + } + MeshNormals { + 24; + -0.000006;0.000000;-1.000000;, + 0.000005;-0.999352;0.035981;, + -0.999857;0.000000;0.016937;, + -0.000006;0.000000;-1.000000;, + 0.000000;-0.999352;0.035982;, + 0.999857;0.000006;0.016937;, + -0.000006;0.000000;-1.000000;, + 0.999857;-0.000000;0.016939;, + -0.000005;0.999352;0.035982;, + -0.000006;-0.000000;-1.000000;, + 0.000000;0.999352;0.035984;, + -0.999857;0.000000;0.016937;, + 0.000005;-0.999352;0.035981;, + -0.999857;0.000000;0.016937;, + -0.000000;0.000001;1.000000;, + 0.000005;-0.999352;0.035981;, + 0.999857;0.000006;0.016937;, + -0.000000;0.000001;1.000000;, + 0.999857;0.000006;0.016937;, + -0.000005;0.999352;0.035982;, + -0.000000;0.000001;1.000000;, + -0.000005;0.999352;0.035982;, + -0.999857;0.000000;0.016937;, + -0.000000;0.000001;1.000000;; + 12; + 3;0,6,3;, + 3;0,9,6;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,20,23;, + 3;14,17,20;; + } + MeshTextureCoords { + 8; + 0.384951;0.041750;, + 0.616604;0.041750;, + 0.856692;0.041750;, + 0.141781;0.041750;, + 0.384951;0.914882;, + 0.616604;0.914882;, + 0.856692;0.914882;, + 0.141781;0.914882;; + } + } + + Frame x3ds_RL_Leg { + FrameTransformMatrix { + 0.996195, -0.000000, -0.087156, 0.000000, + -0.087156, -0.000000, -0.996195, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + -3.359494, 0.259708, 38.976967, 1.000000;; + } + Mesh RL_Leg { + + 26; + 9.229027; -71.518196; -17.699999;, + -10.562513; -71.518204; -17.699999;, + -8.726734; 0.601814; -5.908435;, + 7.393265; 0.601810; -5.908433;, + 11.931103; -75.798187; 11.700004;, + -13.264593; -75.798187; 11.699999;, + -8.726734; 0.601814; 5.908564;, + 7.393263; 0.601810; 5.908566;, + -9.401619; -8.003811; 0.055164;, + -9.401621; -19.983799; 0.055164;, + -21.381618; -5.008812; 0.055162;, + -9.401619; -8.003811; 1.552658;, + -9.401621; -19.983799; 1.552658;, + -21.381618; -5.008812; 1.552657;, + -9.406624; -28.501522; 0.062683;, + -9.406624; -40.501522; 0.062684;, + -21.406624; -25.501520; 0.062688;, + -9.406624; -28.501522; 1.562678;, + -9.406624; -40.501522; 1.562678;, + -21.406624; -25.501520; 1.562676;, + -9.411629; -50.486736; 0.070203;, + -9.411633; -62.506737; 0.070203;, + -21.431629; -47.481735; 0.070202;, + -9.411629; -50.486736; 1.572698;, + -9.411633; -62.506737; 1.572698;, + -21.431629; -47.481735; 1.572697;; + + 30; + 3;2,0,1;, + 3;3,0,2;, + 3;5,0,4;, + 3;1,0,5;, + 3;6,1,5;, + 3;2,1,6;, + 3;7,2,6;, + 3;3,2,7;, + 3;4,3,7;, + 3;0,3,4;, + 3;6,4,7;, + 3;5,4,6;, + 3;8,9,10;, + 3;9,13,10;, + 3;9,12,13;, + 3;10,11,8;, + 3;10,13,11;, + 3;12,11,13;, + 3;14,15,16;, + 3;15,19,16;, + 3;15,18,19;, + 3;16,17,14;, + 3;16,19,17;, + 3;18,17,19;, + 3;20,21,22;, + 3;21,25,22;, + 3;21,24,25;, + 3;22,23,20;, + 3;22,25,23;, + 3;24,23,25;; + MeshMaterialList { + 2; + 30; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHLEG} + {x3ds_mat_BLUEPLASTIC} + } + MeshNormals { + 66; + -0.000000;0.161357;-0.986896;, + 0.000000;-0.989569;-0.144059;, + 0.995537;0.039363;-0.085767;, + -0.000000;0.161357;-0.986896;, + 0.000000;-0.989569;-0.144059;, + -0.998354;0.039138;-0.041929;, + -0.000000;0.161357;-0.986896;, + -0.999676;0.025446;0.000000;, + 0.000000;1.000000;0.000000;, + 0.000000;0.161357;-0.986896;, + 0.000000;1.000000;0.000000;, + 0.997858;0.049375;-0.042925;, + 0.000000;-0.989569;-0.144059;, + 0.997858;0.049375;-0.042925;, + -0.000000;0.075587;0.997139;, + 0.000000;-0.989569;-0.144059;, + -0.995087;0.052754;-0.083776;, + -0.000000;0.075587;0.997139;, + -0.998354;0.039138;-0.041929;, + 0.000000;1.000000;0.000000;, + -0.000000;0.075587;0.997139;, + 0.000000;1.000000;0.000000;, + 0.998241;0.059291;0.000000;, + -0.000000;0.075587;0.997139;, + 0.000000;0.000000;-1.000000;, + 0.242536;0.970143;-0.000000;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970143;-0.000000;, + 0.242536;0.970143;-0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970143;0.000000;, + -0.000000;0.000000;1.000000;, + -0.000000;-0.000000;-1.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;-0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + -0.000000;-0.000000;-1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970142;0.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;, + -0.780869;-0.624695;0.000000;, + -0.000000;-0.000000;1.000000;, + -0.780869;-0.624695;-0.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + 0.242536;0.970142;0.000000;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000001;, + 0.000000;0.000000;-1.000000;, + -0.780869;-0.624695;-0.000001;, + 0.242536;0.970142;0.000000;, + 0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + -0.780869;-0.624695;-0.000001;, + 0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;; + 30; + 3;6,0,3;, + 3;9,0,6;, + 3;15,1,12;, + 3;4,1,15;, + 3;18,5,16;, + 3;7,5,18;, + 3;21,8,19;, + 3;10,8,21;, + 3;13,11,22;, + 3;2,11,13;, + 3;20,14,23;, + 3;17,14,20;, + 3;24,26,28;, + 3;27,35,29;, + 3;27,33,35;, + 3;30,31,25;, + 3;30,36,31;, + 3;34,32,37;, + 3;38,40,42;, + 3;41,49,43;, + 3;41,47,49;, + 3;44,45,39;, + 3;44,50,45;, + 3;48,46,51;, + 3;52,54,56;, + 3;55,63,57;, + 3;55,61,63;, + 3;58,59,53;, + 3;58,64,59;, + 3;62,60,65;; + } + MeshTextureCoords { + 26; + 0.424682;0.899973;, + 0.582679;0.899974;, + 0.647431;0.013392;, + 0.363113;0.013392;, + 0.131246;0.952588;, + 0.861902;0.952588;, + 0.838511;0.013392;, + 0.151531;0.013392;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_R_Foot { + FrameTransformMatrix { + -0.000000, 0.000000, 1.000000, 0.000000, + -0.000000, 1.000000, -0.000000, 0.000000, + -1.000000, -0.000000, -0.000000, 0.000000, + -0.849463, -62.299637, -2.502151, 1.000000;; + } + Mesh R_Foot { + + 8; + -37.191723; -17.003931; 4.286171;, + 7.580331; -17.003948; 6.445354;, + 5.179023; -0.329503; 4.340307;, + -27.147438; -7.877935; 1.341817;, + -37.191738; -17.003931; -4.286145;, + 7.580253; -17.003933; -6.445300;, + 5.179095; -0.329495; -4.340262;, + -27.147472; -7.877943; -1.341796;; + + 10; + 3;2,0,1;, + 3;3,0,2;, + 3;5,0,4;, + 3;1,0,5;, + 3;7,2,6;, + 3;3,2,7;, + 3;4,3,7;, + 3;0,3,4;, + 3;6,4,7;, + 3;5,4,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_BLUEPLASTIC} + } + MeshNormals { + 20; + -0.123025;0.309552;0.942890;, + -0.000000;-1.000000;0.000000;, + -0.672464;0.740130;0.000001;, + -0.047832;0.118323;0.991822;, + -0.000000;-1.000000;-0.000001;, + -0.123025;0.309552;0.942890;, + -0.227389;0.973804;-0.000001;, + -0.192729;0.486970;0.851889;, + -0.227389;0.973804;0.000000;, + -0.672466;0.740128;0.000006;, + -0.000000;-1.000000;0.000000;, + -0.672466;0.740128;0.000006;, + -0.123024;0.309552;-0.942891;, + -0.000000;-1.000000;0.000000;, + -0.047831;0.118323;-0.991822;, + -0.227389;0.973804;-0.000001;, + -0.123024;0.309552;-0.942891;, + -0.227389;0.973804;-0.000001;, + -0.672466;0.740128;0.000006;, + -0.192728;0.486969;-0.851891;; + 10; + 3;5,0,3;, + 3;7,0,5;, + 3;13,1,10;, + 3;4,1,13;, + 3;17,6,15;, + 3;8,6,17;, + 3;11,9,18;, + 3;2,9,11;, + 3;16,12,19;, + 3;14,12,16;; + } + } + } + } + } + + Frame x3ds_LU_Leg { + FrameTransformMatrix { + 0.996195, 0.000000, 0.087156, 0.000000, + 0.000000, -1.000000, -0.000000, 0.000000, + 0.087156, 0.000000, -0.996195, 0.000000, + 5.995695, -0.163910, 2.695593, 1.000000;; + } + Mesh LU_Leg { + + 8; + -2.905133; -7.083223; -0.791073;, + 11.828092; -7.083160; -0.790935;, + 11.828092; 7.083232; -0.790933;, + -2.905131; 7.083232; -0.791068;, + -2.205294; -5.595747; 40.521160;, + 11.128267; -5.595746; 40.521164;, + 11.128268; 5.595754; 40.521152;, + -2.205276; 5.595753; 40.521152;; + + 12; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_01MECHLEG} + } + MeshNormals { + 24; + 0.000009;0.000000;-1.000000;, + 0.000000;-0.999352;0.035982;, + -0.999857;0.000000;0.016938;, + 0.000009;0.000000;-1.000000;, + 0.000004;-0.999352;0.035981;, + 0.999857;-0.000000;0.016938;, + 0.000009;0.000000;-1.000000;, + 0.999857;-0.000000;0.016937;, + -0.000000;0.999352;0.035983;, + 0.000009;0.000000;-1.000000;, + -0.000000;0.999352;0.035982;, + -0.999857;0.000002;0.016938;, + 0.000000;-0.999352;0.035982;, + -0.999857;0.000002;0.016938;, + -0.000000;0.000001;1.000000;, + 0.000000;-0.999352;0.035982;, + 0.999857;-0.000000;0.016938;, + -0.000000;0.000001;1.000000;, + 0.999857;-0.000000;0.016938;, + -0.000000;0.999352;0.035983;, + -0.000000;0.000001;1.000000;, + -0.000000;0.999352;0.035983;, + -0.999857;0.000002;0.016938;, + -0.000000;0.000001;1.000000;; + 12; + 3;0,6,3;, + 3;0,9,6;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,20,23;, + 3;14,17,20;; + } + MeshTextureCoords { + 8; + 0.384951;0.041750;, + 0.616604;0.041750;, + 0.856692;0.041750;, + 0.141781;0.041750;, + 0.384951;0.914882;, + 0.616604;0.914882;, + 0.856692;0.914882;, + 0.141781;0.914882;; + } + } + + Frame x3ds_LL_Leg { + FrameTransformMatrix { + 0.996195, 0.000000, 0.087156, 0.000000, + 0.087156, -0.000000, -0.996195, 0.000000, + 0.000000, 1.000000, -0.000000, 0.000000, + 3.943336, 0.259716, 39.672768, 1.000000;; + } + Mesh LL_Leg { + + 26; + -9.017391; -71.197044; -17.699999;, + 10.774149; -71.197052; -17.699999;, + 8.938375; 0.922958; -5.908498;, + -7.181622; 0.922955; -5.908498;, + -11.719472; -75.477051; 11.700000;, + 13.476221; -75.477051; 11.700000;, + 8.938375; 0.922958; 5.908501;, + -7.181622; 0.922955; 5.908501;, + 9.618265; -7.680378; 0.062687;, + 9.618269; -19.680382; 0.062687;, + 21.618265; -4.680378; 0.062687;, + 9.618265; -7.680378; 1.562681;, + 9.618269; -19.680382; 1.562681;, + 21.618265; -4.680378; 1.562681;, + 9.618265; -28.180374; 0.062689;, + 9.618265; -40.180374; 0.062689;, + 21.618265; -25.180378; 0.062694;, + 9.618265; -28.180374; 1.562683;, + 9.618265; -40.180374; 1.562683;, + 21.618265; -25.180378; 1.562684;, + 9.618269; -50.180374; 0.062691;, + 9.618265; -62.180374; 0.062691;, + 21.618269; -47.180374; 0.062691;, + 9.618269; -50.180374; 1.562685;, + 9.618265; -62.180374; 1.562685;, + 21.618269; -47.180374; 1.562685;; + + 30; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;1,6,5;, + 3;1,2,6;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;, + 3;9,8,10;, + 3;13,9,10;, + 3;12,9,13;, + 3;11,10,8;, + 3;13,10,11;, + 3;11,12,13;, + 3;15,14,16;, + 3;19,15,16;, + 3;18,15,19;, + 3;17,16,14;, + 3;19,16,17;, + 3;17,18,19;, + 3;21,20,22;, + 3;25,21,22;, + 3;24,21,25;, + 3;23,22,20;, + 3;25,22,23;, + 3;23,24,25;; + MeshMaterialList { + 2; + 30; + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1; + {x3ds_mat_02MECHLEG} + {x3ds_mat_BLUEPLASTIC} + } + MeshNormals { + 66; + 0.000000;0.161356;-0.986896;, + -0.000000;-0.989569;-0.144060;, + -0.995537;0.039364;-0.085767;, + 0.000000;0.161356;-0.986896;, + -0.000000;-0.989569;-0.144060;, + 0.998354;0.039138;-0.041929;, + 0.000000;0.161356;-0.986896;, + 0.999676;0.025446;0.000000;, + -0.000000;1.000000;0.000000;, + -0.000000;0.161356;-0.986896;, + -0.000000;1.000000;0.000000;, + -0.997857;0.049375;-0.042925;, + -0.000000;-0.989569;-0.144060;, + -0.997857;0.049375;-0.042925;, + -0.000000;0.075588;0.997139;, + -0.000000;-0.989569;-0.144060;, + 0.995087;0.052753;-0.083776;, + 0.000000;0.075588;0.997139;, + 0.998354;0.039138;-0.041929;, + -0.000000;1.000000;0.000000;, + -0.000000;0.075588;0.997139;, + -0.000000;1.000000;0.000000;, + -0.998241;0.059291;0.000000;, + -0.000000;0.075588;0.997139;, + 0.000000;0.000000;-1.000000;, + -0.242536;0.970142;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + -0.242535;0.970143;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242535;0.970143;0.000000;, + -0.242535;0.970143;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.000000;0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242535;0.970143;0.000000;, + -0.000000;0.000000;1.000000;, + 0.000000;0.000000;-1.000000;, + -0.242536;0.970142;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + 0.000000;0.000000;-1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.000000;-0.000000;1.000000;, + 0.780869;-0.624695;0.000000;, + -0.242536;0.970142;0.000000;, + -0.000000;-0.000000;1.000000;; + 30; + 3;0,6,3;, + 3;0,9,6;, + 3;1,15,12;, + 3;1,4,15;, + 3;5,18,16;, + 3;5,7,18;, + 3;8,21,19;, + 3;8,10,21;, + 3;11,13,22;, + 3;11,2,13;, + 3;14,20,23;, + 3;14,17,20;, + 3;26,24,28;, + 3;35,27,29;, + 3;33,27,35;, + 3;31,30,25;, + 3;36,30,31;, + 3;32,34,37;, + 3;40,38,42;, + 3;49,41,43;, + 3;47,41,49;, + 3;45,44,39;, + 3;50,44,45;, + 3;46,48,51;, + 3;54,52,56;, + 3;63,55,57;, + 3;61,55,63;, + 3;59,58,53;, + 3;64,58,59;, + 3;60,62,65;; + } + MeshTextureCoords { + 26; + 0.424682;0.899973;, + 0.582679;0.899974;, + 0.647431;0.013392;, + 0.363113;0.013392;, + 0.131246;0.952588;, + 0.861902;0.952588;, + 0.838511;0.013392;, + 0.151531;0.013392;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;, + 0.000000;1.000000;; + } + } + + Frame x3ds_L_Foot { + FrameTransformMatrix { + -0.000000, 0.000000, 1.000000, 0.000000, + -0.000000, 1.000000, -0.000000, 0.000000, + -1.000000, -0.000000, -0.000000, 0.000000, + 1.061086, -63.263023, -2.697744, 1.000000;; + } + Mesh L_Foot { + + 8; + -36.996124; -15.719404; -4.210043;, + 7.775673; -15.719419; -6.330903;, + 5.374375; 0.954521; -4.263234;, + -26.951843; -6.593406; -1.317977;, + -36.995773; -15.719404; 4.210084;, + 7.775607; -15.719404; 6.330931;, + 5.374449; 0.954529; 4.263263;, + -26.951618; -6.593413; 1.317985;; + + 10; + 3;0,2,1;, + 3;0,3,2;, + 3;0,5,4;, + 3;0,1,5;, + 3;2,7,6;, + 3;2,3,7;, + 3;3,4,7;, + 3;3,0,4;, + 3;4,6,7;, + 3;4,5,6;; + MeshMaterialList { + 1; + 1; + 0;; + {x3ds_mat_BLUEPLASTIC} + } + MeshNormals { + 20; + -0.121241;0.305074;-0.944580;, + 0.000000;-1.000000;0.000000;, + -0.672469;0.740125;0.000028;, + -0.046996;0.116259;-0.992106;, + -0.000000;-1.000000;0.000001;, + -0.121241;0.305074;-0.944580;, + -0.227378;0.973807;0.000001;, + -0.190220;0.480642;-0.856037;, + -0.227375;0.973807;0.000022;, + -0.672459;0.740134;0.000060;, + 0.000000;-1.000000;0.000000;, + -0.672459;0.740134;0.000060;, + -0.121242;0.305076;0.944579;, + 0.000000;-1.000000;0.000000;, + -0.046997;0.116259;0.992106;, + -0.227378;0.973807;0.000001;, + -0.121242;0.305076;0.944579;, + -0.227378;0.973807;0.000001;, + -0.672459;0.740134;0.000060;, + -0.190222;0.480645;0.856035;; + 10; + 3;0,5,3;, + 3;0,7,5;, + 3;1,13,10;, + 3;1,4,13;, + 3;6,17,15;, + 3;6,8,17;, + 3;9,11,18;, + 3;9,2,11;, + 3;12,16,19;, + 3;12,14,16;; + } + } + } + } + } +} +AnimationSet x3ds_animset_0 { + Animation x3ds_anim_0 { + {x3ds_Groin} + AnimationKey { + 0; + 11; + 0; 4; 0.707107, 0.707107, 0.000000, 0.000000;;, + 77; 4; 0.707107, 0.707107, 0.000000, 0.000000;;, + 85; 4; 0.707107, 0.707107, 0.000000, 0.000000;;, + 93; 4; 0.707107, 0.707107, 0.000000, 0.000000;;, + 115; 4; 0.000000, 1.000000, 0.000000, -0.000000;;, + 135; 4; 0.000000, 1.000000, 0.000000, -0.000000;;, + 160; 4; 0.707107, 0.707106, -0.000000, -0.000000;;, + 161; 4; -0.707107, -0.707106, 0.000000, 0.000000;;, + 175; 4; -0.705815, -0.705815, -0.042718, -0.042718;;, + 193; 4; -0.706998, -0.706997, -0.012419, -0.012419;;, + 216; 4; -0.707107, -0.707106, 0.000001, 0.000001;;; + } + AnimationKey { + 1; + 5; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 93; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 29; + 0; 3; 0.000000, 35.534382, 1.024473;;, + 1; 3; 0.000000, 23.889210, 1.024473;;, + 15; 3; 0.000000, 18.884680, 2.903347;;, + 30; 3; 0.000000, 23.889210, 1.024473;;, + 33; 3; 0.000000, 23.889210, 1.024473;;, + 43; 3; 0.000000, 20.962900, 1.024473;;, + 52; 3; 0.000000, 25.059750, 1.024473;;, + 61; 3; 0.000000, 23.518040, 5.044694;;, + 68; 3; 0.000000, 18.818790, 12.939010;;, + 76; 3; 0.000000, 23.518040, 5.044694;;, + 77; 3; 0.000000, 23.518040, 5.044694;;, + 93; 3; 0.000000, 23.518040, 5.044694;;, + 100; 3; 0.000000, 29.812460, -75.539803;;, + 104; 3; 0.000000, 19.677170, -97.369301;;, + 115; 3; 0.000000, -67.336800, -156.016006;;, + 135; 3; 0.000000, -67.336800, -139.858002;;, + 145; 3; 0.000000, -13.702700, -104.629097;;, + 146; 3; 0.000000, -12.018200, -99.536301;;, + 160; 3; 0.000000, 23.518040, -5.044694;;, + 161; 3; 0.000000, 23.518040, -5.044694;;, + 175; 3; 0.000000, 33.713280, 22.388664;;, + 178; 3; 0.000000, 24.016300, 24.758060;;, + 181; 3; 0.000000, 33.713280, 26.460903;;, + 184; 3; 0.000000, 24.016300, 25.572514;;, + 187; 3; 0.000000, 33.713280, 26.460907;;, + 190; 3; 0.000000, 24.016300, 26.386951;;, + 193; 3; 0.000000, 33.713280, 26.460903;;, + 207; 3; 0.000000, 33.713280, 26.460907;;, + 216; 3; 0.000000, 23.518040, -5.044694;;; + } + } + + Animation x3ds_anim_1 { + {x3ds_Chest} + AnimationKey { + 0; + 23; + 0; 4; 0.000000, -0.000000, -0.000000, -1.000000;;, + 1; 4; 0.258819, 0.000000, -0.000000, -0.965926;;, + 15; 4; 0.317305, 0.000000, -0.000000, -0.948324;;, + 30; 4; 0.258819, 0.000000, -0.000000, -0.965926;;, + 31; 4; 0.258819, 0.000000, -0.000000, -0.965926;;, + 43; 4; -0.095846, -0.000000, -0.000000, -0.995396;;, + 52; 4; 0.442381, 0.058240, 0.116812, -0.887278;;, + 61; 4; 0.258819, -0.000000, -0.000000, -0.965926;;, + 68; 4; 0.332019, -0.072538, -0.264839, -0.902420;;, + 76; 4; 0.258819, -0.000000, -0.000001, -0.965926;;, + 77; 4; 0.258819, -0.000000, -0.000001, -0.965926;;, + 85; 4; 0.535255, 0.003802, -0.087074, -0.840182;;, + 93; 4; 0.258819, -0.000000, -0.000001, -0.965926;;, + 95; 4; 0.221903, -0.017679, -0.071612, -0.972275;;, + 102; 4; 0.122182, -0.024167, -0.140528, -0.982212;;, + 115; 4; -0.000001, 0.000000, -0.000000, -1.000000;;, + 135; 4; -0.000001, -0.000000, 0.529919, -0.848048;;, + 139; 4; 0.030693, 0.002685, 0.581681, -0.812834;;, + 160; 4; 0.258820, -0.000000, -0.000000, -0.965926;;, + 161; 4; 0.258820, -0.000000, -0.000001, -0.965926;;, + 175; 4; -0.017452, -0.000000, -0.000000, -0.999848;;, + 207; 4; -0.017452, -0.000000, -0.000000, -0.999848;;, + 216; 4; 0.258820, -0.000000, -0.000001, -0.965926;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 0.426950, -1.024470, 11.366163;;, + 77; 3; 0.426950, -1.024470, 11.366163;;, + 115; 3; 0.426950, -1.024470, 11.366163;;, + 135; 3; 0.426950, -1.024470, 11.366163;;; + } + } + + Animation x3ds_anim_2 { + {x3ds_RU_Arm} + AnimationKey { + 0; + 30; + 0; 4; -0.000000, 0.130526, 0.000000, -0.991445;;, + 1; 4; -0.065263, 0.113039, 0.495722, -0.858616;;, + 15; 4; -0.056193, 0.117811, 0.426828, -0.894864;;, + 30; 4; -0.065263, 0.113039, 0.495723, -0.858616;;, + 31; 4; -0.065263, 0.113039, 0.495723, -0.858616;;, + 43; 4; 0.053090, 0.119242, -0.403256, -0.905730;;, + 52; 4; -0.220806, -0.041267, 0.855768, -0.466049;;, + 61; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 68; 4; -0.025312, 0.111794, -0.475054, -0.872459;;, + 76; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 77; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 85; 4; 0.133832, 0.353720, 0.308203, -0.872916;;, + 93; 4; -0.065263, 0.113039, 0.495722, -0.858617;;, + 96; 4; -0.200990, -0.200282, 0.412420, -0.865679;;, + 97; 4; -0.132674, -0.082403, 0.416033, -0.895837;;, + 98; 4; -0.201870, -0.265437, 0.361052, -0.870881;;, + 99; 4; -0.134623, -0.131057, 0.365286, -0.911739;;, + 100; 4; -0.228976, -0.420777, 0.283694, -0.830683;;, + 115; 4; -0.000001, -0.398748, 0.000001, -0.917061;;, + 135; 4; -0.078327, -0.125349, -0.524098, -0.838734;;, + 139; 4; -0.071913, -0.092789, -0.291009, -0.949491;;, + 160; 4; -0.065263, 0.113040, 0.495724, -0.858616;;, + 161; 4; -0.065263, 0.113040, 0.495724, -0.858616;;, + 175; 4; -0.165429, -0.450070, 0.634668, -0.606026;;, + 178; 4; -0.307408, -0.362634, 0.387903, -0.789638;;, + 182; 4; -0.174187, -0.394643, 0.618206, -0.657068;;, + 185; 4; -0.280338, -0.279007, 0.343836, -0.851671;;, + 188; 4; -0.185051, -0.307103, 0.545153, -0.757794;;, + 192; 4; -0.218786, -0.219812, 0.386801, -0.868447;;, + 216; 4; -0.065263, 0.113040, 0.495724, -0.858616;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -22.158115, 0.000001, 34.682266;;, + 77; 3; -22.158115, 0.000001, 34.682266;;, + 115; 3; -22.158115, 0.000001, 34.682266;;, + 135; 3; -22.158115, 0.000001, 34.682266;;; + } + } + + Animation x3ds_anim_3 { + {x3ds_RL_Arm} + AnimationKey { + 0; + 26; + 0; 4; 1.000000, 0.000000, -0.000000, -0.000000;;, + 1; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 15; 4; 0.909961, 0.414693, -0.000000, -0.000000;;, + 30; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 31; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 43; 4; 0.622515, 0.782608, 0.000000, -0.000000;;, + 52; 4; 0.998630, 0.052336, -0.000000, -0.000000;;, + 61; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 68; 4; 0.987688, 0.156435, -0.000000, -0.000000;;, + 76; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 77; 4; 0.866025, 0.500000, -0.000000, -0.000000;;, + 85; 4; 0.673714, 0.675106, -0.106243, 0.281164;;, + 93; 4; 0.866025, 0.500000, 0.000000, -0.000000;;, + 96; 4; 0.846469, 0.531913, 0.010984, -0.020921;;, + 115; 4; 1.000000, -0.000001, -0.000000, 0.000000;;, + 135; 4; 0.913546, 0.406736, -0.000000, 0.000000;;, + 139; 4; 0.981076, 0.193621, -0.000000, -0.000000;;, + 160; 4; 0.866026, 0.499999, -0.000000, 0.000000;;, + 161; 4; 0.866026, 0.499999, -0.000000, 0.000000;;, + 175; 4; 0.898794, 0.438370, -0.000000, 0.000000;;, + 178; 4; 0.668687, 0.743544, -0.000000, 0.000000;;, + 182; 4; 0.826796, 0.562503, -0.000000, 0.000000;;, + 185; 4; 0.651408, 0.758727, -0.000000, 0.000000;;, + 188; 4; 0.705617, 0.708593, -0.000000, 0.000000;;, + 192; 4; 0.616021, 0.787730, -0.000000, 0.000000;;, + 216; 4; 0.866026, 0.499999, -0.000000, 0.000000;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 13.822151, 0.000000, -20.565975;;, + 77; 3; 13.822151, 0.000000, -20.565975;;, + 115; 3; 13.822151, 0.000000, -20.565975;;, + 135; 3; 13.822151, 0.000000, -20.565975;;; + } + } + + Animation x3ds_anim_4 { + {x3ds_R_Hand} + AnimationKey { + 0; + 11; + 0; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 52; 4; 0.085633, 0.098509, -0.650446, -0.748253;;, + 68; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 77; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 85; 4; 0.095461, 0.089019, -0.725097, -0.676164;;, + 93; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 115; 4; 0.092296, 0.092296, -0.701057, -0.701058;;, + 135; 4; 0.092296, 0.092296, -0.701057, -0.701058;;, + 160; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 161; 4; 0.083025, 0.100717, -0.630637, -0.765023;;, + 216; 4; 0.083025, 0.100717, -0.630637, -0.765023;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 17.201632, -0.532498, -26.974579;;, + 77; 3; 17.201632, -0.532498, -26.974579;;, + 115; 3; 17.201632, -0.532498, -26.974579;;, + 135; 3; 17.201632, -0.532498, -26.974579;;; + } + } + + Animation x3ds_anim_5 { + {x3ds_LU_Arm} + AnimationKey { + 0; + 31; + 0; 4; -0.000000, 0.130526, 0.000000, -0.991445;;, + 1; 4; -0.017037, 0.129409, 0.129410, -0.982963;;, + 15; 4; -0.027138, 0.127674, 0.206133, -0.969779;;, + 30; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 31; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 43; 4; -0.326088, 0.265924, 0.458283, -0.782897;;, + 52; 4; 0.023797, -0.004380, -0.508650, -0.860633;;, + 61; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 68; 4; 0.039250, 0.124485, -0.298134, -0.945558;;, + 76; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 77; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 85; 4; 0.014321, -0.216242, 0.302516, -0.928180;;, + 93; 4; -0.017037, 0.129409, 0.129409, -0.982963;;, + 96; 4; 0.012473, 0.472295, 0.098587, -0.875821;;, + 97; 4; -0.005733, 0.314325, 0.091301, -0.944897;;, + 98; 4; 0.002467, 0.403792, 0.085230, -0.910869;;, + 99; 4; -0.005563, 0.316457, 0.079674, -0.945239;;, + 100; 4; 0.010565, 0.509467, 0.073742, -0.857260;;, + 115; 4; -0.000001, 0.566409, -0.000008, -0.824124;;, + 135; 4; 0.176893, 0.283087, -0.499530, -0.799400;;, + 139; 4; 0.283098, 0.024951, -0.406064, -0.868531;;, + 160; 4; -0.017038, 0.129412, 0.129402, -0.982964;;, + 161; 4; -0.017038, 0.129412, 0.129403, -0.982964;;, + 175; 4; 0.405692, 0.534219, 0.553941, -0.493126;;, + 178; 4; 0.585778, 0.368487, 0.379184, -0.614249;;, + 182; 4; 0.448058, 0.532485, 0.549044, -0.462877;;, + 185; 4; 0.592036, 0.367183, 0.377829, -0.609849;;, + 188; 4; 0.502752, 0.483163, 0.496528, -0.516967;;, + 192; 4; 0.598794, 0.362383, 0.372267, -0.609543;;, + 207; 4; 0.476089, 0.472560, 0.479925, -0.565420;;, + 216; 4; -0.017038, 0.129412, 0.129402, -0.982964;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 22.800381, -0.000005, 34.682266;;, + 77; 3; 22.800381, -0.000005, 34.682266;;, + 115; 3; 22.800381, -0.000005, 34.682266;;, + 135; 3; 22.800381, -0.000005, 34.682266;;; + } + } + + Animation x3ds_anim_6 { + {x3ds_LL_Arm} + AnimationKey { + 0; + 26; + 0; 4; 1.000000, 0.000000, -0.000000, -0.000000;;, + 1; 4; 0.819152, 0.573576, -0.000000, -0.000000;;, + 15; 4; 0.848048, 0.529919, -0.000000, -0.000000;;, + 30; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 31; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 43; 4; 0.737277, 0.675591, -0.000000, -0.000000;;, + 52; 4; 0.642787, 0.766045, 0.000000, -0.000000;;, + 61; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 68; 4; 0.939693, 0.342020, -0.000000, -0.000000;;, + 76; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 77; 4; 0.819152, 0.573577, -0.000000, -0.000000;;, + 85; 4; 0.441186, 0.831001, 0.214867, -0.261961;;, + 93; 4; 0.819152, 0.573576, -0.000000, 0.000000;;, + 96; 4; 0.932169, 0.360972, -0.014558, 0.023425;;, + 115; 4; 1.000000, -0.000000, -0.000000, -0.000000;;, + 135; 4; 0.874620, 0.484809, -0.000000, -0.000000;;, + 139; 4; 0.980002, 0.198988, -0.000000, -0.000000;;, + 160; 4; 0.819152, 0.573576, -0.000000, 0.000000;;, + 161; 4; 0.819152, 0.573577, -0.000000, 0.000000;;, + 175; 4; 0.902585, 0.430511, -0.000000, 0.000000;;, + 178; 4; 0.674571, 0.738210, -0.000000, 0.000000;;, + 182; 4; 0.836374, 0.548160, -0.000000, 0.000000;;, + 185; 4; 0.666576, 0.745437, -0.000000, 0.000000;;, + 188; 4; 0.756143, 0.654407, -0.000000, 0.000000;;, + 192; 4; 0.686772, 0.726874, -0.000000, 0.000000;;, + 216; 4; 0.819152, 0.573576, -0.000000, 0.000000;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -0.446586, 0.000001, -24.389267;;, + 77; 3; -0.446586, 0.000001, -24.389267;;, + 115; 3; -0.446586, 0.000001, -24.389267;;, + 135; 3; -0.446586, 0.000001, -24.389267;;; + } + } + + Animation x3ds_anim_7 { + {x3ds_L_Hand} + AnimationKey { + 0; + 10; + 0; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 68; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 77; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 85; 4; 0.099989, 0.083901, -0.759491, -0.637289;;, + 93; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 115; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 135; 4; 0.092296, 0.092296, -0.701057, -0.701057;;, + 160; 4; 0.088182, 0.096234, -0.669811, -0.730970;;, + 161; 4; 0.088182, 0.096234, -0.669810, -0.730970;;, + 216; 4; 0.088182, 0.096234, -0.669810, -0.730970;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -1.719951, -0.532492, -32.044598;;, + 77; 3; -1.719951, -0.532492, -32.044598;;, + 115; 3; -1.719951, -0.532492, -32.044598;;, + 135; 3; -1.719951, -0.532492, -32.044598;;; + } + } + + Animation x3ds_anim_8 { + {x3ds_Head} + AnimationKey { + 0; + 26; + 0; 4; -0.000000, -0.999048, 0.043619, -0.000000;;, + 6; 4; -0.000000, -0.997564, -0.069756, -0.000000;;, + 15; 4; -0.000000, -0.999657, -0.026177, -0.000000;;, + 26; 4; -0.000000, -0.999391, 0.034899, -0.000000;;, + 52; 4; 0.057153, -0.973623, -0.220877, -0.002109;;, + 61; 4; -0.000000, -0.999391, 0.034900, -0.000000;;, + 68; 4; -0.328848, -0.929469, 0.165640, 0.022582;;, + 76; 4; -0.000000, -0.999391, 0.034900, -0.000000;;, + 77; 4; -0.000000, -0.999391, 0.034900, -0.000000;;, + 85; 4; 0.130447, -0.990841, 0.034601, 0.004555;;, + 93; 4; 0.000000, -0.999391, 0.034900, -0.000000;;, + 115; 4; -0.000000, -0.999048, 0.043621, -0.000000;;, + 135; 4; -0.000000, -0.999048, 0.043621, -0.000000;;, + 175; 4; -0.000000, -0.999048, 0.043621, -0.000000;;, + 177; 4; 0.121753, -0.991602, 0.043296, 0.005316;;, + 179; 4; -0.017436, -0.998896, 0.043614, -0.000761;;, + 181; 4; 0.139040, -0.989326, 0.043196, 0.006071;;, + 183; 4; -0.034867, -0.998440, 0.043594, -0.001522;;, + 185; 4; 0.121752, -0.991602, 0.043296, 0.005316;;, + 187; 4; -0.026153, -0.998706, 0.043606, -0.001142;;, + 189; 4; 0.142432, -0.972455, -0.180232, 0.039500;;, + 191; 4; -0.109249, -0.975409, -0.173314, -0.081269;;, + 193; 4; 0.130401, -0.990501, 0.043248, 0.005694;;, + 195; 4; -0.043578, -0.998097, 0.043579, -0.001903;;, + 197; 4; 0.173153, -0.983648, 0.043642, 0.023447;;, + 199; 4; -0.065922, -0.988029, 0.137452, 0.023655;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 8; + 0; 3; 0.000000, 0.320922, 43.031700;;, + 93; 3; 0.000000, 0.320922, 43.031700;;, + 115; 3; 0.000000, 0.320922, 43.031700;;, + 135; 3; 0.000000, 0.320922, 43.031700;;, + 160; 3; 0.000000, 0.320922, 43.031700;;, + 161; 3; 0.000000, 0.320922, 43.031700;;, + 175; 3; 0.000000, 0.320922, 43.031700;;, + 216; 3; 0.000000, 0.320922, 43.031700;;; + } + } + + Animation x3ds_anim_9 { + {x3ds_RU_Leg} + AnimationKey { + 0; + 30; + 0; 4; 0.043619, -0.000000, -0.999048, 0.000000;;, + 1; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 21; 4; 0.124791, -0.009789, -0.874977, 0.467703;;, + 30; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 37; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 43; 4; 0.125169, 0.001125, -0.912411, 0.389664;;, + 52; 4; 0.125097, 0.004401, -0.922298, 0.365647;;, + 61; 4; 0.124939, 0.007674, -0.931554, 0.341379;;, + 68; 4; 0.125154, 0.002217, -0.915776, 0.381687;;, + 76; 4; 0.124939, 0.007674, -0.931554, 0.341379;;, + 77; 4; 0.124939, 0.007674, -0.931554, 0.341379;;, + 85; 4; 0.124485, 0.013117, -0.945558, 0.300420;;, + 93; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 100; 4; 0.240075, 0.038409, -0.943098, 0.226838;;, + 115; 4; 0.250380, -0.000000, -0.968148, -0.000000;;, + 135; 4; 0.250380, -0.000000, -0.968148, -0.000000;;, + 139; 4; 0.230082, -0.060758, -0.927524, 0.288220;;, + 146; 4; 0.215704, -0.060817, -0.923441, 0.311497;;, + 150; 4; 0.209892, -0.016602, -0.963089, 0.167717;;, + 160; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 161; 4; 0.124939, 0.007674, -0.931554, 0.341378;;, + 175; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 178; 4; 0.124460, 0.013347, -0.946112, 0.298672;;, + 181; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 184; 4; 0.124460, 0.013347, -0.946112, 0.298672;;, + 187; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 190; 4; 0.124460, 0.013347, -0.946112, 0.298672;;, + 193; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 207; 4; 0.116047, 0.046921, -0.991735, 0.028151;;, + 216; 4; 0.124939, 0.007674, -0.931554, 0.341378;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 6.849594, 0.163909, 2.374462;;, + 77; 3; 6.849594, 0.163909, 2.374462;;, + 115; 3; 6.849594, 0.163909, 2.374462;;, + 135; 3; 6.849594, 0.163909, 2.374462;;; + } + } + + Animation x3ds_anim_10 { + {x3ds_RL_Leg} + AnimationKey { + 0; + 30; + 0; 4; 0.706434, 0.706434, -0.030844, -0.030844;;, + 1; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 11; 4; 0.438280, 0.897779, -0.019136, -0.039198;;, + 21; 4; 0.422215, 0.905446, -0.018434, -0.039533;;, + 26; 4; 0.439586, 0.897141, -0.019193, -0.039170;;, + 30; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 37; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 43; 4; 0.484348, 0.873787, -0.021147, -0.038150;;, + 52; 4; 0.499524, 0.865201, -0.021810, -0.037775;;, + 61; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 68; 4; 0.573030, 0.818373, -0.025019, -0.035731;;, + 76; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 77; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 93; 4; 0.536788, 0.842589, -0.023437, -0.036788;;, + 115; 4; 0.706434, 0.706434, -0.030844, -0.030844;;, + 135; 4; 0.706434, 0.706434, -0.030844, -0.030844;;, + 139; 4; 0.319106, 0.946715, -0.013933, -0.041334;;, + 146; 4; 0.007542, 0.999020, -0.000329, -0.043618;;, + 150; 4; -0.025078, 0.998734, 0.001095, -0.043606;;, + 160; 4; 0.536789, 0.842588, -0.023437, -0.036788;;, + 161; 4; 0.536789, 0.842588, -0.023437, -0.036788;;, + 175; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 178; 4; 0.267123, 0.962675, -0.011663, -0.042031;;, + 181; 4; 0.655435, 0.753991, -0.028617, -0.032920;;, + 184; 4; 0.267123, 0.962675, -0.011663, -0.042031;;, + 187; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 190; 4; 0.267123, 0.962675, -0.011663, -0.042031;;, + 193; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 207; 4; 0.655436, 0.753991, -0.028617, -0.032920;;, + 216; 4; 0.536789, 0.842588, -0.023437, -0.036788;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -3.359494, 0.259702, 38.976971;;, + 77; 3; -3.359494, 0.259702, 38.976971;;, + 115; 3; -3.359494, 0.259702, 38.976971;;, + 135; 3; -3.359494, 0.259702, 38.976971;;; + } + } + + Animation x3ds_anim_11 { + {x3ds_R_Foot} + AnimationKey { + 0; + 29; + 0; 4; 0.707107, 0.000000, 0.707107, -0.000000;;, + 1; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 11; 4; 0.693619, 0.137449, 0.693620, -0.137448;;, + 21; 4; 0.703851, 0.067776, 0.703851, -0.067776;;, + 26; 4; 0.702932, 0.076726, 0.702932, -0.076726;;, + 30; 4; 0.701057, 0.092296, 0.701058, -0.092296;;, + 37; 4; 0.701057, 0.092296, 0.701058, -0.092296;;, + 52; 4; 0.700211, 0.098511, 0.700211, -0.098511;;, + 61; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 68; 4; 0.690345, 0.153046, 0.690346, -0.153046;;, + 76; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 77; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 93; 4; 0.701057, 0.092296, 0.701057, -0.092296;;, + 115; 4; 0.707107, -0.000000, 0.707107, 0.000000;;, + 135; 4; 0.707107, -0.000000, 0.707107, 0.000000;;, + 139; 4; 0.636494, 0.308019, 0.636494, -0.308019;;, + 146; 4; 0.705581, -0.046427, 0.705581, 0.046427;;, + 150; 4; 0.682577, -0.184629, 0.682578, 0.184629;;, + 160; 4; 0.701057, 0.092298, 0.701057, -0.092298;;, + 161; 4; 0.701057, 0.092298, 0.701057, -0.092298;;, + 175; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 178; 4; 0.691481, -0.147833, 0.691481, 0.147833;;, + 181; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 184; 4; 0.691481, -0.147833, 0.691481, 0.147833;;, + 187; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 190; 4; 0.691481, -0.147833, 0.691481, 0.147833;;, + 193; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 207; 4; 0.706676, -0.024676, 0.706676, 0.024676;;, + 216; 4; 0.701057, 0.092298, 0.701057, -0.092298;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 3; + 0; 3; -0.849455, -62.299629, -3.801312;;, + 115; 3; -0.849455, -62.299629, -3.801312;;, + 135; 3; -0.849455, -62.299629, -3.801312;;; + } + } + + Animation x3ds_anim_12 { + {x3ds_LU_Leg} + AnimationKey { + 0; + 30; + 0; 4; -0.043619, -0.000000, -0.999048, 0.000000;;, + 1; 4; -0.128543, 0.007574, -0.976382, -0.173483;;, + 11; 4; -0.134779, 0.015787, -0.981832, -0.132631;;, + 21; 4; -0.128729, 0.003084, -0.969733, -0.207452;;, + 30; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 37; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 43; 4; -0.128201, 0.012056, -0.981842, -0.139302;;, + 52; 4; -0.128201, 0.012056, -0.981842, -0.139302;;, + 61; 4; -0.128543, 0.007574, -0.976383, -0.173482;;, + 68; 4; -0.128751, 0.001960, -0.967886, -0.215906;;, + 76; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 77; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 85; 4; -0.128751, 0.001960, -0.967886, -0.215907;;, + 93; 4; -0.128543, 0.007574, -0.976383, -0.173483;;, + 100; 4; -0.098715, 0.012488, -0.994248, -0.039635;;, + 115; 4; -0.199368, -0.000000, -0.979925, -0.000000;;, + 135; 4; -0.180689, 0.084257, -0.888113, 0.414134;;, + 139; 4; -0.148626, 0.124737, -0.776470, 0.599538;;, + 160; 4; -0.128542, 0.007574, -0.976383, -0.173482;;, + 161; 4; -0.128542, 0.007574, -0.976383, -0.173482;;, + 175; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 178; 4; -0.112759, 0.062175, -0.955955, 0.263761;;, + 181; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 184; 4; -0.112759, 0.062175, -0.955955, 0.263761;;, + 187; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 190; 4; -0.112759, 0.062175, -0.955955, 0.263761;;, + 193; 4; -0.124735, 0.031962, -0.991546, 0.016008;;, + 207; 4; -0.124735, 0.031962, -0.991546, 0.016007;;, + 212; 4; -0.128488, 0.008447, -0.977538, -0.166852;;, + 216; 4; -0.128542, 0.007575, -0.976383, -0.173479;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; -5.995693, 0.163913, 2.695592;;, + 77; 3; -5.995690, 0.163913, 2.695592;;, + 115; 3; -5.995690, 0.163913, 2.695592;;, + 135; 3; -5.995690, 0.163913, 2.695592;;; + } + } + + Animation x3ds_anim_13 { + {x3ds_LL_Leg} + AnimationKey { + 0; + 34; + 0; 4; 0.706434, 0.706434, 0.030844, 0.030844;;, + 1; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 6; 4; 0.551866, 0.832791, 0.024095, 0.036360;;, + 11; 4; 0.510806, 0.858589, 0.022302, 0.037487;;, + 21; 4; 0.521998, 0.851831, 0.022791, 0.037192;;, + 26; 4; 0.541375, 0.839649, 0.023637, 0.036660;;, + 30; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 37; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 43; 4; 0.522001, 0.851829, 0.022791, 0.037192;;, + 52; 4; 0.544120, 0.837873, 0.023757, 0.036582;;, + 61; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 68; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 76; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 77; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 93; 4; 0.580150, 0.813341, 0.025330, 0.035511;;, + 104; 4; 0.564968, 0.823959, 0.024667, 0.035975;;, + 115; 4; 0.706434, 0.706434, 0.030844, 0.030844;;, + 135; 4; 0.087073, 0.995247, 0.003802, 0.043453;;, + 139; 4; -0.244382, 0.968698, -0.010670, 0.042294;;, + 155; 4; 0.218585, 0.974843, 0.009544, 0.042563;;, + 160; 4; 0.580151, 0.813340, 0.025330, 0.035511;;, + 161; 4; 0.580151, 0.813340, 0.025330, 0.035511;;, + 168; 4; 0.350698, 0.935472, 0.015312, 0.040844;;, + 172; 4; 0.439930, 0.896972, 0.019208, 0.039163;;, + 175; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 178; 4; 0.300421, 0.952809, 0.013117, 0.041600;;, + 181; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 184; 4; 0.300421, 0.952809, 0.013117, 0.041600;;, + 187; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 190; 4; 0.300421, 0.952809, 0.013117, 0.041600;;, + 193; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 207; 4; 0.674949, 0.736575, 0.029469, 0.032160;;, + 212; 4; 0.495151, 0.867712, 0.021619, 0.037885;;, + 216; 4; 0.580152, 0.813340, 0.025330, 0.035511;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 4; + 0; 3; 3.943333, 0.259710, 39.672764;;, + 77; 3; 3.943333, 0.259710, 39.672764;;, + 115; 3; 3.943333, 0.259710, 39.672764;;, + 135; 3; 3.943333, 0.259710, 39.672764;;; + } + } + + Animation x3ds_anim_14 { + {x3ds_L_Foot} + AnimationKey { + 0; + 34; + 0; 4; 0.707107, 0.000000, 0.707107, -0.000000;;, + 1; 4; 0.687569, -0.165071, 0.687569, 0.165071;;, + 6; 4; 0.680588, -0.191834, 0.680588, 0.191834;;, + 11; 4; 0.677475, -0.202553, 0.677475, 0.202553;;, + 21; 4; 0.676210, -0.206736, 0.676210, 0.206736;;, + 26; 4; 0.677620, -0.202065, 0.677621, 0.202065;;, + 30; 4; 0.687569, -0.165071, 0.687569, 0.165071;;, + 37; 4; 0.687569, -0.165071, 0.687569, 0.165071;;, + 43; 4; 0.681390, -0.188966, 0.681390, 0.188966;;, + 52; 4; 0.690346, -0.153046, 0.690346, 0.153046;;, + 61; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 68; 4; 0.679364, -0.196123, 0.679364, 0.196123;;, + 76; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 77; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 93; 4; 0.687569, -0.165070, 0.687570, 0.165070;;, + 100; 4; 0.705872, 0.041770, 0.705872, -0.041770;;, + 104; 4; 0.698511, 0.109917, 0.698512, -0.109917;;, + 115; 4; 0.707107, -0.000002, 0.707107, 0.000002;;, + 135; 4; 0.612373, 0.353552, 0.612373, -0.353552;;, + 139; 4; 0.672346, 0.218976, 0.672346, -0.218976;;, + 155; 4; 0.659223, -0.255782, 0.659223, 0.255782;;, + 160; 4; 0.687569, -0.165072, 0.687569, 0.165072;;, + 161; 4; 0.687569, -0.165072, 0.687569, 0.165072;;, + 168; 4; 0.705347, 0.049859, 0.705347, -0.049859;;, + 172; 4; 0.706854, -0.018889, 0.706854, 0.018889;;, + 175; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 178; 4; 0.690338, -0.153079, 0.690338, 0.153079;;, + 181; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 184; 4; 0.690338, -0.153079, 0.690338, 0.153079;;, + 187; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 190; 4; 0.690338, -0.153079, 0.690338, 0.153079;;, + 193; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 207; 4; 0.706864, -0.018543, 0.706864, 0.018543;;, + 216; 4; 0.687569, -0.165072, 0.687569, 0.165072;;; + } + AnimationKey { + 1; + 4; + 0; 3; 1.000000, 1.000000, 1.000000;;, + 77; 3; 1.000000, 1.000000, 1.000000;;, + 115; 3; 1.000000, 1.000000, 1.000000;;, + 135; 3; 1.000000, 1.000000, 1.000000;;; + } + AnimationKey { + 2; + 3; + 0; 3; 1.061092, -63.263000, -4.043970;;, + 115; 3; 1.061092, -63.263000, -4.043970;;, + 135; 3; 1.061092, -63.263000, -4.043970;;; + } + } + +} + diff --git a/sdk/samples/rockem/skmechbk.ppm b/sdk/samples/rockem/skmechbk.ppm new file mode 100644 index 0000000..3bc590d --- /dev/null +++ b/sdk/samples/rockem/skmechbk.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 128 +255 +,<DDDLDLDLDLDDDDDDLDLLDDLLDDDDL$$TDDLL$$LLDLDLDLDLDD$<DLDDDDDDDDDDDDDLDDDLDLDLDLDLDLDLDLDLD$DDDDLDLDLLDDDDDDLDLDLDLDLDLDLLLLLDLLLLLLLL$<LD�������������������������������������������������������������������������DDL�������������������������������������������������������������������������DLD��TT�TT�TT�TT�TT�TT�\\�\\�TT�TT�\\�\\�TT�\\�\\�TT�TT�TT������������������������������������������������������LDL��TT�TT�\\�\\�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT������������������������������������������������������DLD��TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT���������������������������������������������������������LLD��TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT���������������������������������������������������������LDL��TT�TT�\\�TT��������������������������������������������������������������������DLL��TT�TT�TT���������������������������������������������������������������������LDL��TT�TT�TT���������������������������������������������������������������������DLL��TT�TT����������������������������������������������������������������������DDL��TT�TT����������������������������������������������������������������������DLL��TT�TT����������������������������������������������������������������������DLL��TT�TT������������������������������������������������������������������L���DLL��TT�TT������������������������������������������������������������������L���DLD��TT�������������������������������������������������������������������L���DLL��TT�������������������������������������������������������������������L���DLL��TT�������������������������������������������������������������������L���DDL���������������������������������������������������������������������D���DLD���������������������������������������������������������������������L���$<LL���������������������������������������������������������������������L���$<LD���������������������������������������������������������������������L���DLD���������������������������������������������������������������������L���DDL��������������������������������������������������������������������DL���DLD��������������������������������������������������������������������LL���DLD��������������������������������������������������������������������DL���LLD��������������������������������������������������������������������LL���DLL��������������������������������������������������������������������DL���DLD��������������������������������������������������������������������LL���DDL��������������������������������������������������������������������DL���DDL��������������������������������������������������������������������DL���DLD���T����������������������������������������������������������������LD���DDL���\����������������������������������������������������������������DL���DLD���D���������������������������������������������������������������LDL���LDL���L���������������������������������������������������������������LLL���DLD���D�������������������LDLLL��������������������������������������DLLD���DLL���L�����������������DLDDLDL��������������������������������������DLDL���DLD���L����������������DLLDLDLD������������������������������������LDLDLL���DLD���L����������������DLLDLDLD������������������������������������LDLDLL���DLL���DL���������������DLDLDLLD�����������������������������LDLLLLLDLDLLD���LLL���LL�������������LLLDLDLLLL������������������L��������LLLLDDLDLLDLDDL���DDL���LD������������LDLDLDLLDLD������������������DD������LDLDLDLDDLDLDLLD���DLL���LLL����������DLLLLDLDDLLL������������������DLLL��LLLLDLDLDLDLLLLDDL���LDL���DLLD�������LDLDLDDLDLDLDL������������������LLDLDDLLDDLDLLLDLDLDDLLD���DLL���LLLLL����LDLDDLDLDLLDLDLD������������������LDLLDLDDLDLLDLDLLLLDLDDL���DLD���LDLDLDDLLLLDLLLLDLDLLLDDL������������������LLLLLDLLLLLLLDDLDLDLDLLL���DLD���LDLDLDDLLLLDLLLLDLDLLLDDL������������������LLLLLDLLLLLLLDDLDLDLDLLL���DLL���LDDLDLDLDLDLLDLDLLLLDLDLD������������������DDLDLLLLDDLDLLLLLDLDLDLD���LLD���LDLDDLLLLDLDLLDLDLDDLDLDL������������������LLLLDLDLDLDLDLLDDLDLDLLL���LLL���LDDLDLDLDLLLDDLLDDLLDDLLL������������������LDLDLDLLLLL�������LLLDDL���DLD���LLLLLLLDLDLDLLDLDLDDLDLDL������������������DDLLLLDLD����������DLLLL���DLL���LDDLDLDLLDDLDDLLLLLLDLDLD������������������DLLLDL��������������LDLD���LDL����LLDDLLL�����LDLDLDLDDLDL������������������LLD�����������������LLDL���DLD����LLLLLD�������LDLDLLLDLLD������������������L�������������������DLL����DLD����LLLLLD�������LDLDLLLDLLD������������������L�������������������DLL����DLL����DLDDL���������LLLDDLLLLL��������������������������������������LDL����DLD�����LLLL����������DDLLDDLDL��������������������������������������LDD����DLL�����LDLD�����������LLDLLDDL��������������������������������������LDL����LLD�����DLDL���������������������������������������������������������LLL����DLD�����LDDL���������������������������������������������������������LDL������������LLDL���������������������������������������������������������DLL������������DLLL���������������������������������������������������������LDL������������DLLL���������������������������������������������������������LDL������������LDDL��������������������������������������������������������LLDD������������LLLD��������������������������������������������������������DDLL������������LDLL��������������������������������������������������������LDL�������������DLLD�������������������������������������������������������LDDL��������������LDLL������������������������������������������������������LDLD��������������LLLL������������������������������������������������������DLDL���������������DLLD����������������������������������������������������LLDLL���������������DLLD����������������������������������������������������LLDLL���������������LDDLD������LDLDLDDLDL������������������LDLDLLDLL��������LLLL����������������LLLDLD���LDLDDLLLLDLD������������������DLDLDLLLDLD�����LLLDL����������������LDDLLDLDLDLDLDLDLLLLL������������������LLDDLLDDLDLD��LDLDLD������������������LLDLDDLDLDLDLDLDLDDL������������������DLLLLLLLLLLLLLLLLLLL�������������������DLDLDLLLLLDDLLDDLLD������������������LDDDDDDDDDDDLDLDDLDL�������������������LLLDLDLDLLLLLLLLLLL������������������LLLLLLLLLLLLLDDLDLLL��������������������DDLDLDL�������������������������������������������LDDLL���������������������DDLDLDL�������������������������������������������LDDLL���������������������LDLLLL��������������������������������������������DDLD�����������������������LDL����DDLDDLLDDLDLDLDLDDDDLLDDLLD����LDL�����������������������TL����LDLDLLDLDDDLDLDLDLDLLDDLDLLLLD���LL����������������������������LDLLLDLDLDLDDDDDDDDDDDDLDLDDDDLD�������������������������L�����DDL������������������������������������������������������DLDD����L�������������������LD���DLLD������������������������������������������������������������DDDL���LL��������������������\���LL������������������������������������������������������������������$<LLT�\DL��������������������\���LL������������������������������������������������������������������$<LLT�\DL���������������������DLLDD�����������������������������������������ܤ�������������������������DDLDL\����������������������LDDL�������������������������������������������ܤ���������������������������DLL\������������������������\\<d������Dd���<��������������������������������ܜ���������������������������DL�������������������������������Ĝ���<\���L��������������������������������ܜ����������������������������������������������������������������<d�����<������������������������������������������������������������������������������������������<dD\�����L��<����������������������������������������������������������������������������������������LdD\�����<��<������������������������������ܤ��������������������������������������������������������������LdD\�����<��<������������������������������ܤ��������������������������������������������������������������Dd<\�����<��L������������������������������ܤ��������������������������������������������������������������LdD\�����L��<������������������������������ܜ�����������������������D\D\�����������������������������������<\Dd�����D��<������������������������������Ԥ�����������������������D\<\�����������������������������������<\D\�����D��D������������������������������ܤ�����������������������<\Ld�����������������������������������<\Ld�����<��D������������������������������ܤ�����������������������D\<d�����������������������������������DdD\�����D��D������������������������������ܜ�����������������������D\Dd�����������������������������������<\Dd�����D��D��D�����������������������������������������������D\<\�����������������������������������<\Dd�����D��D��D�����������������������������������������������D\<\�����������������������������������LdD\�����D��<��D��D���������������������������������������������<\Ld�����������������������������������<\Dd�����<��L��D��<��������������������������ܤ�����������������������D\<d�����������������������������������LdD\�����D��<��<��D��������������������������ܜ�����������������������<\Ld�����������������������������������<\Dd���������<��D��D��D����������������������Ԥ�����������������������D\Dd�����������������������������������<\Ld�����������T��<��D��D��������������������ܜ�����������������������<\Ld�����������������������������������<\Dd���������������D��D��<������������������ܤ�����������������������D\Dd�����������������������������������Dd<\�������������������<������������������ܤ�����������������������<\Ld�����������������������������������Dd<\�������������������<������������������ܤ�����������������������<\Ld�����������������������������������<\Dd��������������������������������������������������������Dd<\�����������������������������������<\Ld�����������������������������������������������������Dd<\Ld�����������������������������������<\Dd������������������������������������������������������������D\Ld<\�����������������������������������<\Ld������������������������������������������������������������Dd<\Ld�����������������������������������<dD\������������������������������������������������������������Ld<\Dd�����������������������������������Ld<\D\��������������������������������������������������������D\D\<dLd�����������������������������������D\<d<dD\���������������������$������$�������������������Ld<\<\DdD\�����������������������������������D\<d<dD\���������������������$������$�������������������Ld<\<\DdD\�����������������������������������<\LdLd<\D\LdLd����������������������������������������D\DdLd<\Ld�����������������������������������D\<d<dD\D\<d<\D\D\�������$�������������������������D\Dd<dD\<\Dd<\�����������������������������������D\DdLd<\<\LdLd<d<dLdLd������������������������������DdD\<\LdLdD\D\<dLd����������������������������������D\DdDdD\D\D\D\D\D\D\D\<d������������������DdLd<\<\Dd<\LdLd<\D\DdLd<\D\���������������D\LdD\LdDd<dLdLd<dDdLdLdDd<dLdLd<\LdLd<\<\LdLd<d<dLdLd<d<\Ld������������������D\<\DdDdD\LdD\D\DdLd<\D\<dLdLd<dDdLdLdDd<dLdLd<dDdLdLdD\DdD\D\D\D\D\D\D\D\D\D\D\D\D\D\D\DdD\D\DdDdD\D\D\D\D\D\D\DdD\<\D\D\<\Dd<\DdD\DdD\DdD\DdDdD\D\DdD\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\DdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdD\DdD\DdD\DdD\DdD\D\DdD\DdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdD\DdD\DdD\DdD\DdD\D\DdD\DdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDd \ No newline at end of file diff --git a/sdk/samples/rockem/skmechbt.ppm b/sdk/samples/rockem/skmechbt.ppm new file mode 100644 index 0000000..3f6819d Binary files /dev/null and b/sdk/samples/rockem/skmechbt.ppm differ diff --git a/sdk/samples/rockem/skmechch.ppm b/sdk/samples/rockem/skmechch.ppm new file mode 100644 index 0000000..4c6c0dc --- /dev/null +++ b/sdk/samples/rockem/skmechch.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 128 +255 +LLLLLLLLLLLLLLLLLLLLLLLLLLLLLD���������������LLLLLLLLLLLLLLLLLLLLLLLLLLLLDLDLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTT�TT�\\�TT�\\�\\�TT�TT�\\�TT�TT�\\�\\�TT�TT�\\�\\�TT�TT�\\�TT�TT�\\�\\�TT�TT�\\�TT����������������\\�\\�TT�\\�TT�TT�\\�\\�TT�\\�\\�TT�TT�\\�\\�TT�TT�\\�\\�TT�\\�\\�TT�TT�\\�\\�TT�TT�LLL\\�TT�\\�\\�TT�TT�\\�\\�TT�\\�\\�TT�TT�\\�\\�TT�TT�\\�\\�TT�\\�\\�TT�TT�\\�\\�TT�\\����������������TT�TT�\\�TT�\\�\\�TT�TT�\\�TT�TT�\\�\\�TT�TT�\\�\\�TT�TT�\\�TT�TT�\\�\\�TT�TT�\\�\\�LLDTT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�\\�TT�TT����������������\\�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�LLDTT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�\\�TT�TT����������������\\�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�LLL\\�TT������������������������TT�TT�\\����������������TT�\\�TT������������������������TT�TT�DLDTT�\\�������������������������TT�TT����������������\\�TT��������������������������TT�LLLTT�TT��������������������������\\����������������TT���������������������������TT�L��������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������������������������Դ�������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������������������Դ�������������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܴ�����DL\\�����������������������������������������������������������������������LLLTT�����������������������������������������������������������������������LDLTT�����������������������������������������������������������������������LLL\\�����������������������������������������������������������������������LLL\\�����������������������������������������������������������������������LDLTT�����������������������������������������������������������������������DLL\\�����������������������������������������������������������������������LDLTT�����������������������������������������������������������������������L�����������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������Ԕ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������Ԕ����������������������������������������������������������������������������������������������Դ����������������������������������������������������������������������������������������������ܜ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܜ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܔ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܜ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܔ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܔ����������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������������ܜ�����LDL���������������������������������������������������������������������LDLLD���������������������������������������������������������������������LLLDL���������������������������������������������������������������������LDLDL���������������������������������������������������������������������LDLLL���������������������������������������������������������������������LLLDL���������������������������������������������������������������������LDLLL���������������������������������������������������������������������DLLLL���������������������������������������������������������������������DD�����������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������Ԝ����������������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������Ԝ����������������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������������ܔ����������������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������������ܜ�������������������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������ܜ����������������������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������������Ԕ����������������������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������ܜ�������������������������������������������������������������������������������������������������������������ܴ�������������������������������������������������������������������������������ܜ�������������������������������������������������������������������������������������������������������������ܴ����������������������������������������������������������������������������ܔ�������������������������LLDL���������������������������������������������������������������DLLLL��LLLLD�������������������������������������������������������������LDDLD���LDLDLD�����������������������������������������������������������LLLDLL���LDLDLD�����������������������������������������������������������LLLDLL���LLLLLLLL�������������������������������������������������������LLLLLLL����LLDLLLLLDL�����������������D���������������D�����������������DLLLLLDDL����LDLDLLLLLLL��������������LDL���������������LLL�������������DLLLDLDDLLL����DLLLLDLLDLDLLLLLLLLLLLLLLLLDLDLDLDDLLLLLLLLLLLLLLLLDLLLLLLDL�����DLLLLLLLLLLLLLLLLLLLLLLLLLL$$L$$T$$L$$TLLLLLLLLLLLLLLLLLLLLLLLDDLLL�����DLLLLLLLLLLLLLLLLLLLLLLLLLL$$L$$T$$L$$TLLLLLLLLLLLLLLLLLLLLLLLDDLLL�����LLDLLL�����������������������������������������������������������LLDL�����DLLLL������������������������������������������������������������LLLL�����LLDL�������������������������������������������������������������DLLL�����LDLL�������������������������������������������������������������LLLL�����LDLL�������������������������������������������������������������LLLL�����$<LDLL\\������������������������������������������������������������DLLL�������LDLTT������������������������������������������������������������L����������LLLTT�TT�����������������������������������������������������������D������������LLTT����������������������������������������������������������LL������������LDTT�TT���������������������������������������������������������L�������������LDTT�TT���������������������������������������������������������L��������������LTT�\\�TT�������������������������������������������������������TT�L���������������LTT�\\�����TT�\\�\\�TT�TT�\\�TT�\\�TT�TT�\\�\\�TT�TT����������������TT�TT�\\�\\�TT�TT�TT�TT�\\�TT�\\�TT�TT�\\�������\\�DL���������������LTT�\\�TT���TT�TT�TT�TT�\\�TT�TT�\\�TT�\\�TT�TT�TT�TT�TT����������������TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�\\����TT�TT�LL���������������LLTT�\\�TT�TT�TT�TT�\\�TT�TT�DLDDDDDDLDLLDLLDDLLLLLLDLDDLTT�TT�TT�\\��TT�\\�TT�L����������������LLTT�\\�TT�TT�TT�TT�\\�TT�TT�DLDDDDDDLDLLDLLDDLLLLLLDLDDLTT�TT�TT�\\��TT�\\�TT�L����������������DLDTT�\\�\\�TT�\\�TT�DLLLDLLLLLDDLDLLLDDLDLDLLLDLLLLTT�TT�TT�TT�TT�TT�TT�D�����������������LDTT�TT�TT�TT�TT�$DLD���������������������������DLLLTT�\\�TT�TT�L������������������DLTT�\\�\\�TT�DL�������������������������������LDTT�TT�TT�LL�������������������LLTT�TT�TT�LL�<dD\DdD\D\DdLdD\<\LdDd<\D\DdD\<d<\D\D\Dd<\D\Ld<\LdD\LdD\��DLLTT�LDL��������������������LDLLL�D\LdLdLdDdDdLdDdLdLdDdD\LdDdD\DdD\LdLdLdLdLdLdDdDdLdD\D\DdLd��LLLLLL��������������������LDLLL�D\LdLdLdDdDdLdDdLdLdDdD\LdDdD\DdD\LdLdLdLdLdLdDdDdLdD\D\DdLd��LLLLLL��������������������DLLL��DdLd�����������������������������������������������������������D\<d��LDLL����������������������DLD�<\LT�������������������������������������������������������������LdDdLd��LD��������������������������DdLd�����������������������������������������������������������������D\<\Ld�����������������������������D\L\�������������������������������������������������������������������L\Ld����������������������������LdDd���������������������������������������������������������������������D\<d����������������������������LdDd���������������������������������������������������������������������D\<d���������������������������<dLd���������<��D��D��D��<��D��<��D��<��D���������������ܴD��<��L��D��<��<��D��D��<��D��D��D��D�����D\���������������������������LdD\�������<��<��D��<��<��D��<��D��D��<��<���������������ܬ<��<��D��D��D��D��D��D��<��D��<��D��D��D���Ld���������������������������DdLd�����<��L��D��<��D��<��D��D��D��D��D��D���������������ܬD��D��D��D��<��<��D��<��D��D��D��D��<��D���D\���������������������������LdD\�����<��D�D\Dd<\D\DdLdD\<\LdDd<\D\<dLdLdDd<dLdLdD\Dd<\D\<\LdLdD\�D��<���Ld���������������������������LdD\�����<��D�D\Dd<\D\DdLdD\<\LdDd<\D\<dLdLdDd<dLdLdD\Dd<\D\<\LdLdD\�D��<���Ld���������������������������Ld<d���D��<�DdLdDdLdDdLdDdLdDdLdD\LdD\D\D\D\D\D\LdD\LdLdLdDdLdDdD\LdLd�D��<�D\���������������������������<\Ld���D�DdD\�����������������������������������������������������������DdD\�D�Dd���������������������������Ld<d���D�D\Ld�����������������������������������������������������������L\Ld�<�Dd����������������������������Ld��LdDd���������������������������������������������������������������L\D\<d����������������������������LdLdD\�������������������������������������������������������������������Ld<\����������������������������LdLdD\�������������������������������������������������������������������Ld<\�����������������������������D\Ld�������������������������������������������������������������������DdLd�����������������������������Ld<d�����D��<��D��D��<��D��<��D��D��D���������������ܬ<��<��D��<��D��D��<��<��D��<��D��<�������Dd�����������������������������D\Ld�����<��D��<��D��<��<��D��D��<��<���������������ܬD��D��D��D��<��D��<��<��D��D��D��<�������Ld�����������������������������Ld<d���<��<�DdD\D\DdLdDdLdD\Ld<\<\Ld<\DdD\<\LdDdD\<\DdD\Ld<\D\�<��<�����Dd�����������������������������Ld<d���<��<�DdD\D\DdLdDdLdD\Ld<\<\Ld<\DdD\<\LdDdD\<\DdD\Ld<\D\�<��<�����Dd�����������������������������D\Dd���D�LdD\DdDdLdLdD\DdLdDd<\D\DdD\D\DdLdDdLdDdLdDdLdDdLdLdDd�<��D���Ld�����������������������������DdLd���D�D\Dd���������������������������������������������������L\Ld�D��<���Dd�����������������������������LdD\�<��D�Ld�������������������������������������������������������L\D\�<��<�<d�����������������������������<dLd�D�D\������������������������������������$����������������������LdDd�D�D\�����������������������������LdL\�D�Ld�����������������������������������������������������������D\Dd�<�Ld�����������������������������LdL\�D�Ld�����������������������������������������������������������D\Dd�<�Ld�����������������������������Ld<d�D�Ld�������������������������������������������������������������Ld�D�D\������������������������������Dd�<�<\�������������������������������������������������������������<\D\<d������������������������������LdD\Ld�����<��<��D��<��D��D��D��D���������������ܴD��D��D��D��D��<��D��D��<��L��L��<���LdDdLd�������������������������������<dLd���<��D��D��D��D��<��<��D��<���������������ܴD��D��<��D��<��D��D��D��D��<��<��D�����<d��������������������������������<dLd���<��D��D��D��D��<��<��D��<���������������ܴD��D��<��D��<��D��D��D��D��<��<��D�����<d��������������������������������DdD\���<��D��<��D��<��D��D��<��<���������������ܬ<��<��D��D��<��<��D��<��D��D��D��<��<���Ld��������������������������������<\Ld�<��L��<�Ld<\D\DdLd<\D\DdLd<\LdDdD\Dd<\D\DdDd<\DdD\LdDd�D��D��<�Ld��������������������������������Ld<d�<��<�LdLdDdDdLdDdLdD\DdDdD\D\DdDdLdLdLdD\D\LdLdDdLdLdD\�D��D�D\��������������������������������D\Ld�L��<�D\�������������������������������������������������D\Dd�D��D�<d��������������������������������<dLd�<��D�D\�������������������������������������������������Ld<\�<��D�Ld��������������������������������<dLd�<��D�D\�������������������������������������������������Ld<\�<��D�Ld��������������������������������LdD\�<��D�Dd�������������������������������������������������<dLd�<��D�Dd��������������DdD\Dd<\Dd<\Dd<\Dd<\DdLdDdLdDdLdDdLdDdLdDdLd<\�������������������������������������������������DdD\<\DdLd<\D\LdDdD\LdDdD\<\DdLd<\D\LdDdLdD\D\LdLdD\D\LdLdD\LdLdD\D\LdLdD\D\LdLdD\LdLdD\D\LdLdD\D\D\D\D\D\D\DdLdD\D\LdLdD\D\LdD\D\LdLdD\D\LdLdD\D\LdD\D\LdLdD\D\LdLdD\LdDdDdDdDdDdDdDdDdDdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdDdDdDdDdDdDdDdDdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDdLdDd \ No newline at end of file diff --git a/sdk/samples/rockem/skmechgr.ppm b/sdk/samples/rockem/skmechgr.ppm new file mode 100644 index 0000000..b6d1cf6 Binary files /dev/null and b/sdk/samples/rockem/skmechgr.ppm differ diff --git a/sdk/samples/rockem/skmechhn.ppm b/sdk/samples/rockem/skmechhn.ppm new file mode 100644 index 0000000..ce1be9c Binary files /dev/null and b/sdk/samples/rockem/skmechhn.ppm differ diff --git a/sdk/samples/rockem/skmechjd.ppm b/sdk/samples/rockem/skmechjd.ppm new file mode 100644 index 0000000..dd47891 Binary files /dev/null and b/sdk/samples/rockem/skmechjd.ppm differ diff --git a/sdk/samples/rockem/skmechla.ppm b/sdk/samples/rockem/skmechla.ppm new file mode 100644 index 0000000..a77499a Binary files /dev/null and b/sdk/samples/rockem/skmechla.ppm differ diff --git a/sdk/samples/rockem/skmechll.ppm b/sdk/samples/rockem/skmechll.ppm new file mode 100644 index 0000000..2873eb8 --- /dev/null +++ b/sdk/samples/rockem/skmechll.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 128 +255 +��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������LLLLLLLLLLLLLLLLL�������������������������������������������������������������������������������������������������������������������������������������LLLLLLLLLLLLLLLLL�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������LTT�TT�\\�\\�TT�TT�TT�TT�TT�TT�TT�TT�\\�TT�\\�L�������������������������������������������������������������������������������������������������������������������������������������L\\�\\�TT�TT�\\�\\�\\�\\�\\�\\�\\�\\�\\�\\�TT�L�������������������������������������������������������������������������������������������������������������������������������������LTT�TT�\\�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�TT�L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������LLLLLLLLLLLLLLLLL�������������������������������������������������������������������������������������������������������������������������������������LLLLLLLLLLLLLLLLL�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L\\�TT�\\�TT�TT�TT�TT�\\�TT�TT�\\�TT�TT�\\�TT�L�������������������������������������������������������������������������������������������������������������������������������������LTT�\\�\\�\\�\\�\\�\\�TT�\\�\\�TT�\\�TT�\\�TT�L�������������������������������������������������������������������������������������������������������������������������������������LTT�TT�TT�TT�TT�TT�\T�TT�\T�TT�\T�TT�TT�\\�TT�L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������L���������������L�������������������������������������������������������������������������������������������������������������������������������������LLLLLLLL$<$<$<$<$<LDLL�������������������������������������������������������������������������������������������������������������������������������������LLLLLLLLLLLLLLLL$D��������������������������������������������������������������������������������������������������������������������������������������L�������������L���������������������������������������������������������������������������������������������������������������������������������������L�������������L���������������������������������������������������������������������������������������������������������������������������������������D�������������L���������������������������������������������������������������������������������������������������������������������������������������L�������������L������������������������������������������������������������������LLLLLLTTTLLLLLLTTTLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLLLLTLLLLLLLLLLLLLLLLLLLLLLLLLLTTTTTTLLLTTTLLLTTTLLLTTTLLLTTTTTTLLLTTTTTTLLLLLLLLLLLLTTTTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL\LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL������������������������������������������������������������������LL�������TT�\\�\\��������DL���������������������������������������������������������������������������������������������������������������������������������LL�������\\�TT�\\��������LD���������������������������������������������������������������������������������������������������������������������������������DL�������\\�\\�TT��������LL���������������������������������������������������������������������������������������������������������������������������������LL�������TT�\\�\\��������LL���������������������������������������������������������������������������������������������������������������������������������LL�������\\�TT�\\��������LL���������������������������������������������������������������������������������������������������������������������������������LL�������\\�\\�TT��������LL���������������������������������������������������������������������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLLLLLLLTTTLLLLLLTTTLLLLLLTTT���LL�������\\�TT�\\��������LL���LLLLLLTTTLLLTTTTTTLLLTTTLLLLLLTTTLLLTTTLLLLLLTTTLLLLLLTTT���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLTTTLLL���LL�������TT�\\�\\��������DL���TTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLL���������LLLLLLLLLLLLLLLLLLLDTLLLLLL���DL�������\\�TT�\\��������TL���LLLLLLLDLLLLLLLLLLLLLLLLLLL���������LLLLLLL������������LLLLLLLL���LL�������\\�TT�\\��������LT���LLLLLLLL������������LLLLTTT���������LLLLLLL������������LLTTTLLL���LL�������TT�\\�\\��������DL���LLLTTTLL������������LLLLLLL���������LLLLLLL������������LLLLLLLL���LL�������\\�TT�\\��������LD���LLLLLLLL������������LLLLTTT���������LLLTTTL������������LLLLLTTT���LL�������\\�\\�TT��������DL���LLLTTTLL������������LLLLLLL���������LLLLLLLTT�\\�\\�TT�\\�\\�TT�\\�\\�TT�TT�TT�LLTTTLLL���LL�������\\�TT�\\��������LL���LLLLLLLLTT�\\�\\�TT�TT�TT�TT�TT�\\�TT�TT�TT�LLLLTTT���������TTTLLLL\\�TT�\\�TT�\\�\\�\\�TT�TT�\\�\\�TT�LLLLLLLL���LL�������TT�\\�\\��������LL���LLLTTTLLTT�TT�TT�\\�\\�\\�\\�TT�\\�TT�\\�TT�LLLLLLL���������LLLLLLL������������LTLLLLLL���LL�������\\�\\�TT��������DL���LLLTTTLL������������LTTTLLL���������LLLTTTL������������L\TTTLLL���LL�������\\�TT�\\��������LL���LLLLLLLD������������LLLLLLL���������LLLLLLL������������DTLLLLLL���LL�������TT�\\�\\��������LL���LLLLLLLL������������DLLLLLL���������LLLTTTT������������LLTTTLLL���LD�������\\�TT�\\��������LD���LLLTTTLD������������LTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLL���LD�������\\�\\�TT��������LL���LLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLLLLLLLLLLLLLLLLTTTLLL���LD�������\\�TT�\\��������LL���LLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLL������������LLTTTLLL���LL�������\\�TT�\\��������LD���LLLTTTLD������������LLLLTTT���������LLLLLLL������������LTLLLLLL���LL�������\\�\\�TT��������LL���LLLLLLLL������������LLLLLLL���������LLLTTTL������������LLTTTLLL���LL�������\\�TT�\\��������LD���LLLTTTLL������������LLLLLLL���������LLLLLLL\\�TT�TT�TT�\\�\\�TT�\\�\\�TT�\\�TT�LLLLLLLL���LD�������TT�\\�\\��������TL���LLLLLLLL\\�TT�TT�TT�\\�TT�\\�\\�TT�\\�TT�TT�LLLLLLL���������LLLLLLLTT�\\�\\�\\�TT�TT�\\�TT�TT�\\�TT�TT�LLLLLLLL���LL�������\\�TT�\\��������DL���LLLLLLLLTT�\\�\\�\\�TT�\\�TT�TT�\\�\\�\\�TT�LTTTLLL���������TTTLLLLTT�TT�TT�TT�TT�\T�TT�\T�\T�TT�\\�TT�LLTTTLLL���LL�������\\�\\�TT��������LL���LLLTTTLL\\�TT�TT�TT�TT�\T�TT�TT�TT�TT�TT�TT�LLLLLLL���������LLLTTTL������������LLLLLLLL���LL�������TT�\\�\\��������LL���TTTLLLLL������������LTTTLLL���������LLLLLLL������������LLLLLLLL���LD�������\\�TT�\\��������LL���LLLLLLLL������������DLLLLLL���������TTTLLLL������������LLTTTLLL���LL�������\\�\\�TT��������DL���LLLTTTLD������������LLLLLLL���������LLLLLLLDLLLLDD$<$<$<DDLLLLLLLL���LL�������\\�TT�\\��������LL���LLLLLLLLLLL$<$<$<$<D$<DDLLTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLL���LL�������TT�\\�\\��������DL���LLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLLLLTTTLLLTTTLLLLLLTTTLLLTTTTTTLLLLLLLLLLLLLLLLLLLLL���LL�������\\�TT�\\��������LL���TTTLLLLLLTTTLLLLLLLLLTTTLLLLLLLLLTTTLLLLLLLLLLLLTTTLLLLLL���������LLLLLL���������������������������������������������LLLLLL���LT�������\\�TT�\\��������LL���LLLTTT���������������������������������������������LLLTTT���������LLLTTT���������������������������������������������LLLLLL���DL�������TT�\\�\\��������DL���LLLLLL���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������LLLTTT���LD�������\\�TT�\\��������LL���LLLTTT���������������������������������������������LLLTTT���������TTTLLL���������������������������������������������TTTLLL���DL�������\\�\\�TT��������DL���LLLLLL���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������LLLLLL���LD�������\\�TT�\\��������DL���LLLTTT���������������������������������������������LLLTTT���������LLLTTT���������������������������������������������LLLLLL���LL�������\\�TT�TT��������LL���LLLTTT���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������LLLLLL���LDLLLLLLLLLLLLLLLLLLL���LLLLLL���������������������������������������������TTTLLL���������LLLTTT���������������������������������������������TTTLLL���LLLLLLLLLLLLLLLLLLDLL���LLLTTT���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������LLLLLL���LTLdDdLdLdLdDdLdLdDdLdLdLdLdLdLdLdDdLL���LLLLLL���������������������������������������������TTTLLL���������LLLTTT���������������������������������������������TTTLLL���LDDdLdLdLdLdLdLdLdLdLdLdLdLdLdLdDdDdLL���LLLTTT���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������LLLLLL���DLLd�ČČ̌̌̌̔ČԌ̌̌̌̌̌̌�LdLL���LLLLLL���������������������������������������������TTTLLL���������LLLLLL���������������������������������������������LLLLLL���DLLd������������������������������DdLL���LLLLLL���������������������������������������������TTTLLL���������LLLLLL���������������������������������������������LLLLLL���LDDd������������������������������LdLL���LLLTTT���������������������������������������������LLLLLL���������TTTLLL���������������������������������������������LLLTTT���LLLd�L��<��D��<��D��D��D��<��D��D��<��D��D��<��L�DdDL���LLLLLL���������������������������������������������LLLLLL���������LLLTTT���������������������������������������������LLLLLL���LLDd�<��D��<��<��D��<��D��D��D��D��D��D��D��D��<�L\LL���LLLTTT���������������������������������������������TTTLLL���������TTTLLL���������������������������������������������LLLLLL���LLLd�L��<��D��D��<��L��D��<��D��D��<��D��D��<��D�LdLD���LLLLLL���������������������������������������������LLLLLL���������LLLLLL���������������������������������������������TTTLLL���LLDd������������������������������LdLL���LLLTTT���������������������������������������������LLLLLL���������LLLLLLllllllTTTllllllllllllllllllllllllllllllTTTlllTTTLLL���LLLd�Č̌̌Č̌̌̌̌̔Č̌̌̌Č�DdLL���LLLTTTlllTTTlllTTTlllllllllllllllllllllllllllllllllLLLLLL���������LLLLLLlllllllllllllllTTTTTTllllllllllllTTTlllllllllLLLLLL���LLLd�̌ČČ̌ČČČČČČČČČ̌�LdLL���LLLLLLllllllllllllllllllllllllllllllTTTllllllllllllLLLLLL���������LLLLLLlllTTTlllTTTllllllllllllllllllllllllTTTllllllLLLLLL���DDDdLdDdLdLdLdLdLdLdLdLdLdLdLdL\LdLdLL���LLLTTTllllllTTTlllTTTlllllllllTTTllllllllllllTTTlllLLLTTT���������LLLLLLllllllllllllllllllTTTllllllllllllTTTlllllllllLLLLLL���LLLdLdLdLdLdDdLdLdDdLdLdDdLdLdDdLdDdLL���LLLLLLllllllllllllllllllTTTllllllllllllllllllllllllLLLLLL���������LLLTTTllllllTTTlllllllllllllllTTTTTTlllllllllllllllLLLLLL���LLLdLdLdLdLdLdLdLdLdLdLdLdLdLdLdLdL\LL���LLLLLLlllTTTlllllllllTTTlllllllllTTTlllTTTlllllllllLLLTTT���������LLLLLLlllllllllllllllTTTlllllllllllllllllllllTTTlllLLLTTT���LLLd�ČČ̌̌̌̔ČԌ̌̌̌̌̌̌�DdLL���TTTLLLllllllllllllllllllllllllTTTlllllllllTTTllllllLLLLLL���������LLLLLLllllllllllllllllllllllllTTTTTTlllllllllllllllLLLLLL���LLLd������������������������������DdLL���LLLLLLllllllTTTllllllllllllllllllllllllllllllTTTlllLLLLLL���������LLLLLLlllllllllllllllTTTlllllllllllllllllllllTTTlllTTTLLL���LLD\������������������������������LdLL���LLLLLLllllllllllllTTTlllTTTllllllllllllTTTlllllllllLLLTTT���������TTTLLLlllTTTllllllllllllTTTlllllllllTTTllllllllllllLLLLLL���LLLd�L��D��<��D��<��D��D��D��<��<��D��D��<��D��D�LdLL���LLLLLLlllllllllllllllllllllllllllllllllllllllllllllLLLLLL���������LLLLLLlllllllllTTTlllllllllllllllllllllllllllllllllLLLTTT���LLDd�<��<��L��D��D��<��<��D��D��D��D��<��D��<��D�D\LL���LLLTTTlllTTTlllllllllTTTllllllTTTlllTTTlllTTTllllllLLLTTT���������LLLLLLllllllTTTlllllllllTTTllllllllllllllllllllllllLLLLLL���LLLd�L��<��D��D��D��<��D��<��D��<��D��D��D��<��D�LdLL���LLLLLLlllllllllTTTllllllTTTllllllllllllllllllllllllLLLLLL���������LLLTTTllllllllllllTTTllllllllllllllllllTTTlllTTTlllLLLLLL���LLLd������������������������������DdLL���LLLLLLlllllllllllllllllllllllllllllllllTTTlllTTTlllLLLLLL���������LLLLLLlllllllllTTTlllllllllllllllTTTlllllllllllllllLLLLLL���LLLd�̌̌Č̌Č̌̌̌ČČ̌̌̌̔�DdLL���LLLLLLlllllllllllllllllllllllllllTTTlllllllllllllllLLLLLL���������LLLTTTllllllTTTlllllllllllllllTTTllllllllllllllllllLLLLLL���LDLd�ČČ̌̌Č̌Č̌ČČČČČČ�DdDL���TTTLLLllllllllllllllllllllllllTTTllllllllllllllllllLLLLLL���������LLLLLLllllllllllllTTTlllllllllllllllTTTllllllTTTlllTTTLLL���LDLdLdDdLdLdDdLdLdDdLdLdLdLdLdLdDdLdLL���LLLLLLlllTTTllllllTTTlllllllllllllllTTTllllllTTTlllTTTLLL���������LLLLLLlllllllllllllllllllllllllllllllllllllllllllllLLLLLL���L$<LdLdLdLdLdLdLdLdLdLdLdLdLdLdLdLdD\LL���TTTLLLlllllllllllllllllllllllllllllllllllllllllllllLLLLLL���������LLLTTTlllllllllllllllllllllllllllllllllllllllllllllLLLLLL���LDL\�ČČ̌̔Č̔Č̔Č̌̌Ԍ̌̌�LdLL���LLLLLLlllllllllllllllllllllllllllllllllllllllllllllLLLLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLDd������������������������������LdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LDLd������������������������������DdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLLd�D��<��D��D��<��D��D��D��<��D��<��D��D��<��L�DdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LDLd�L��<��D��D��D��D��D��D��D��<��L��<��<��D��<�LdLL���LLLLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLLd�D��<��L��D��<��D��D��<��D��D��<��D��D��<��L�LdLL���LLLTTTTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������TTTLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LLLd������������������������������DdLL���LLLLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTT���������TTTLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LLLd�̌̌Č̌Č̌Č̌ČČ̌̌̌Č�DdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLDd�ČČ̌̌Č̌̌Č̔ČČČČ̌�LdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LLLdDdLdDdDdLdLdDdLdLdDdLdLdDdLdLdDdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLDdLdLdLdLdLdLdLdLdLdLdLdLdLdLdLdLdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LDLd�ČČ̌̌̌̌̔Č̌̌̌̌̌̌�DdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLLd�Č̌̌̔ĔČԔĔĔĔĔĔĔĔ�LdDL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLDd������������������������������LdLD���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LLLd�D��D��<��D��D��D��<��D��<��D��<��D��D��<��L�LdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLDd�<��<��L��D��<��D��D��D��D��<��D��D��<��D��<�LdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LLLd�L��<��D��D��D��D��D��<��D��D��D��<��<��L��<�LdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���LLDd������������������������������LdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������TTTLLLLLLTTTLLLLLLTTTLLLLLLLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���LLLd������������������������������DdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLLLLTTTLLLTTTTTTLLLTTTTTTLLL���LLDd�̌ČČ̌ČČĄČČĄČČČ̌�DdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLLLLLLLLLL���LLLdLdLdLdLdLdDdLdLdLdDdLdLdLdDdLdLdLL���LLLTTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������TTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLTTTLLLLLLLLLTTTTTTLLL���LLDdLdDdDdDdDdLdDdDdDdLdDdDdDdLdDdDdLL���LLLLLLTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLL���L\DTLLLLLLLLLLLLLLLLL���LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTLLLLLLTTTTTTLLLLLLTTTLLL���DLLLLLLLLLLLLLLLLLLLL���LLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLLTTTTTTLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLTTTLLLLLL���LD�����������������LL���LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLLLLLLLLTTT���LL�����������������LL���LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTLLLLLLLLL���LL�����������������LL���LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL���������������������������������������������������������������������LL�����������������LL���������������������������������������������������������������������������������������������������������������������������������LL�����������������LL���������������������������������������������������������������LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL \ No newline at end of file diff --git a/sdk/samples/rockem/skmechua.ppm b/sdk/samples/rockem/skmechua.ppm new file mode 100644 index 0000000..f25a6af --- /dev/null +++ b/sdk/samples/rockem/skmechua.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +32 32 +255 +�������������̌�LdDdD\LdLdLdLdLdLdDdD\Dd�Ĥ������������̄�D\<d���������������Č�Dd�Č̌ČĔČČČČČ�Ld�Ĥ������������Ą�LdLd���������������̌�Dd�ČČČČ̌̌̌̌Č�Dd�Ĥ������������̄�D\Dd���������������̌�Ld�̤�����������������Ld�Ĭ������������Ą�LdLd���������������Č�Ld�̬�����������������Ld�Ĥ������������Ą�D\Ld���������������Č�Dd�̤�����������������Dd�Ĥ������������̄�LdLd���������������Č�Ld�̤�����������������Ld�Ĭ������������Ą�LdLd���������������Ĕ�Ld�Ĥ�����������������Ld�Ĭ������������̄�LdDd���������������Č�Dd�̬����D��D��D���������Dd�Ĭ�������������D\LdLd���������������Č�Ld�̤����D��D��D���������Ld�Ĥ�������������<dLdLd���������������̔�D\�Ĭ����D��D��D���������Dd�Ĭ����������̌�D\LdDd������������������Ld�̤����D��D��D���������Dd�Ĥ����������̄�LdD\Ld���������������Č�Ld�̤����D��D��D���������Ld�Ĭ��������Ą�DdDdLdLd���������������Č�Ld�Ĥ����D��D��D���������Dd�Ĥ��������Č�<\D\LdLd���������������Č�Ld�̤����D��D��D���������Ld�Ĥ������ČĄ�Ld��LdLd���������������Ĕ�Ld�Ĥ����D��D��D���������Dd�Ĭ������̄�L\Ld��LdLd������������������Dd�Ĥ����D��D��D���������D\�̤����̄�LdDd�Ą�D\Dd������������������Dd�̬����D��D��D���������Ld�Ĥ����Č�DdLd�Ą�LdLd���������������Č�Ld�Ĥ����D��D��D���������D\�̬����̄�LdD\�̌�LdLd���������������̄�Ld�̬����<��D��D���������Ld�Ĥ��̌Ą�DdLd�Ą�DdLd���������������Č�Ld�̤����D��L��D���������Ld�Ĥ��̌�D\�ĄĄĄ�LdLd���������������̌�Dd�Ĭ����D��D��D���������Dd�Ĥ��̌�Ld�Č̌̄�D\<d���������������Ą�Ld�̤����D��D��L���������Ld�Ĥ��̄�D\�̌ĴD��LdLd���������������̌�<\�Ĥ������<��<���������Dd�Ĭ��̄�<d�̌ĴD���LdLd���������������̌�Dd�̤�����������������Ld�Ĥ��̄�D\�Č̴D��LdLd���������������Č�Ld�Ĥ�����������������Ld�Ĭ��̄�Ld�̴D��D���LdLd���������������̌�Ld�̤�����������������D\�̤��̄�Dd�ĴD��<���LdLd���������������̌�Dd�Ĭ�����������������Ld�Ĥ��Ą�D\�̴D��D��LdLd���������������Č�Dd�ČČČČČČ̌̌Č�Ld�Ĥ��̄�Ld�̴D��D��LdLd���������������Č�Ld�Č̌̄ĄĄČĄČĄ�Ld�Ĥ��̌�Dd�Ĭ<��D���LdLd������������������D\LdD\<\LdLdLdLdLdLdLdLd�Ĭ��̌�Ld�ļL��D��DdLd���������������̔�DdDdLdLdDdLdDdLdLdLdLdLd�Ĥ��̌�L\�̼L��L���LdLd�� \ No newline at end of file diff --git a/sdk/samples/rockem/skmechul.ppm b/sdk/samples/rockem/skmechul.ppm new file mode 100644 index 0000000..07ed06e --- /dev/null +++ b/sdk/samples/rockem/skmechul.ppm @@ -0,0 +1,5 @@ +P6 +# Created by Paint Shop Pro +64 64 +255 +����������DdLd�Č̜������������������Ą�<\Ld������������������LdD\Ld������������������Ld<\Ld�Č̤����������������̄�LdD\������������������LdDd�ČĜ����������������Ą�<\<\Dd������������������LdDdLd��������������������LdDd�ĄĤ����������������̌�D\<d������������������LdDd�ĄĤ��������������Ą�D\Dd����������������������LdD\Ld��������������������LdLdDd�ĄĤ��������������̌�Dd<\������������������D\Ld�Ą̤��������������̄�D\<d����������������������LdDdLd����������������������DdLd�Ą̬��������������Č�<\Ld������������������LdDd�Ą̬������������Ą�<\Ld������������������������LdD\Ld������������������������LdLd�Č̤������������Č�D\<d������������������LdLd�ĄĬ������������̄�DdD\������������������������LdDdLd������������������������LdDd�ĄĬ������������̌�D\Ld������������������DdLd�ČĤ������������Ą�D\Dd�����Ĥ�����������������Ld<dLd�������������������Ĝ���DdLd�Č̤������������Č�D\Dd������������������LdDd�Ą̤����������Č�<\Ld�����ČĤ�����������������LdDdLd�������������������̤�����D\Ld�Č̤����������Č�D\Ld������������������LdLd�ČĤ����������̄�D\<d�����̌Ĥ���������L\L\����LdDdLd����D\LT�����������̌Ĥ���D\Dd�ČĬ����������̌�DdD\������������������LdDd�ČĤ��������̄�Dd<\�����̄ČĜ���������Dd<\����D\LdLT����<d<\�����������̌ČĤ���LdDd�ČĬ��������̌�LdD\������������������DdLd�Ą̤��������Č�<\Ld�����Č̄Ĥ���������<\Ld����LdDdLd����D\<d�����������ĄČ̤���DdLd�Č̤��������Č�<\Dd������������������Ld<\�ČĤ��������Ą�DdD\�����̌Ĭ�����������Ld<d����LdLdDd����<d<\�����������̄Č̤���LdLd�Č̬��������̌�Ld<\������������������LdLd�ČĤ��������Ą�<dD\�����Č̤�����������Dd<\����LdDdLd����DdD\�������������̄Ĥ���LdDdLd�Ĭ��������̌�Ld<\������������������D\Ld�ČĤ������Č�<\Ld�����Č̄Ĭ�����������LdLd����Ld<dLd����<\D\�̤����������ČĤ�����D\Ld�Č̤������Č�<\Ld������������������<\Ld�ĄĤ������Č�D\Dd�����ĄČĤ�����������LdLd����LdDdLd����D\<\�̬����������Č�Dl����DdLd�Č̤������Č�<\Ld������������������LdDd�ČĬ����̌�D\D\Ld��L\�Č̤�������������D\Dd����Ld<dLd����<\<\�Ĭ�������������<\D\��LdDdLd�Č̬����̌�Ld<\������������������<\Ld�Ą̤����Č�D\Dd����Dd�Č̬�������������<\Ld����LdD\Ld����<\<\�̤�������������D\<d��DdLdD\�Č̤����Č�<\Ld������������������LdD\�̌Č̌Č̌�<dDd����Ld�Č̤����������Č�<\Ld����LdDdLd����D\<\�Ą̤�����������D\<\����DdLd�Č̌ĄČČ�<\Ld������������������LdDd�ČČČ̌�D\Ld<\��LdLd�Č̬����������̌�LdDd����LdD\Ld����<d<\�̄Ĭ�����������L\<\D\��LdD\�Č̄ČČ̌�Ld<\������������������LdLd�ČČ̌Ą�D\<\Dd��Ld<d�Ĥ����������̌Č�<dLd����LdDdLd����<d<\�ČČĤ�����������<\D\��Ld<\D\�̌ČČ̌�Ld<\������������������DdLd�Č̌ČĄ�LdDdL\��LdLd�̤����������̌�Ld<\Ld����LdD\Ld����<\D\D\�Ą̤�����������D\<d��LdLdDd�ĄČ̌Č�<\Ld������������������LdDd�ČČ̄Ą�DdD\����LdD\�Ĥ����������̌�LdDdLd����LdDdLd����Dd<\<\�̌Ĥ�����������<\<\����Ld<\�Č̌ČČ�D\<d������������������LdLd�ČČ̄Č�D\<d����LdLd�Ĭ��������̌Č�LdD\Ld����Ld<\Ld����Dd<\<\�̌ĄĬ���������<\D\����LdDdD\�Č̌Č�DdD\������������������DdLdD\�̌�D\LdD\Ld����LdL\�̤��������Č̌�LdDdLd����D\LdLd����D\<\D\�Č̄Ĥ���������D\<d����D\LdLdDd�Č�Ld<\Ld������������<\Ld�Ĥ�DdLd�Č�LdLdLd������LdLd�̬������ČČ̄�LdD\������LdD\Ld������<\<\�Č̌Ą̤�������D\<\������LdLdD\�̄�D\Ld����<\Ld������Ld<\�̤�LdDdLd<\DdD\Ld������LdL\�Ĥ������̌Č�Ld<dLd������LdDdLd������D\D\<\�̌ČĬ�������<\Ld<\����LdDd<\LdDdLdDd����LdLd������DdD\�̤�LdD\LdLdLdDd������D\LdD\�̬������Č̌�LdLd������L\LdD\DdLd������LT<\�ČČĤ�������Ld<\<d����DdLdD\LdD\LdLd����D\Ld������DdD\�̤���DdLdDd<\Ld������D\Ld�̌Č̤��̌̄�LdDdLd������D\DdLdD\Ld������D\<\<\�̌Č̤��Č�D\DdLd������LdDd<\LdLd������DdLd������Ld<\�̤�����LdLdLdDd������LdLd�ČČ̌ČČČ�LdDdL\����L\DdLd����LdDd����DT<\Dd�Č̄ČČ̌�LdDd<\������LdLdLdDd��������LdD\������Dd<\�̤�����LdDdLdDd������LdDd�Č̌Č̌Č�D\LdLd������LdDdL\����LdLd�����L\<\Ld�ČČČ̌Č�LdDd������LdDdLd�������̌�LdDd������LdD\�̤�������LdD\Ld������<dLd�ČČ̌ČČ�<dLd������L\DdLd��������DdLd������Dd<\�̌Č̌Č̌�<\Ld������LdD\Ld�������Č�DdLd������DdD\�ČĤ�����LdDdLd������LdLd�Č̌Č̌�LdDdLd������LdDdLd��������LdDd������Ld<\�ČČČ̌Č�Ld<\������LdDdLd�����̄Č�DdLd��������Ld<d�Ĥ�������LdDd������LdDd�ČČ̌Č�D\DdLd������LdLd����������L\LdDd������LdLd�̌Č̌Č�<\D\<\����LdD\Ld�����Č�Ld<\Dd��������D\Dd�Č̜�����D\Ld����LdD\Ld�̌ČČ̄�LdLd������D\D\Ld������������DdLd������DdLd�̌ČČ̌Ą�Dd<\����LdDdLd���Č̌�D\<d����������D\D\Ld�Ą̔��LdLd����LdD\Ld�ČČ̌�D\LdLd����LTLdLd�̤�����������L\DdLd����D\<\���̌ČČ̌�Ld<d����LdDdLd���Č�D\<\Dd������������Dd<\�ĄČČ�LdD\����LdDd�Č̌ČČ�LdD\������LdDdD\�Ĭ����������̄�LdDd������Ld�ĄČČ̌Č�Ld<\����Ld<\Ld�Č�D\<dLd����������������DdD\�Ą̌�LdDd����LdLd�Č̌Č�Ld<dDd����LdD\Ld�ĄĬ����������̄�DdLdDd������D\DT�Č̌Č�Ld<\����Dd<\Ld�Č�DdD\������������������DdD\���Č�DdLd����DdLd�̌Č̌�D\Ld������LdDdLd�Ą̬����������Ą�LdD\Ld������<dD\�̌ČČ�Dd<\����<\LdLd��Ld<dLd������������������L\DdLd�Ą�DdLd����LdD\�ČČČ�LdD\������Ld<\Dd�ĄĬ����������̌�DdLdDd������<\<\�Č̌Č�Ld<\����LdDdD\��Ld<\Dd��������������������LdDdD\<dD\Ld����LdLd�ČĄ�LdLdDd����LdDdD\Ld�Ą̬����������̌�DdLdDdD\����LdDd<\�̌Č�Dd<\����LdLdD\Ld<dD\������������������������<\LdD\DdLd����D\Ld�̌�D\DdLd������LdDdLdDd�ĄĤ����������Ą�LdD\LdLdDd����Ld<\DT�̄�Ld<\����D\<dLd<\Ld����������������������������<\Dd<dD\����DdLdLd<dLdDdLd����DdLdDdLdDd�ĄĬ����������̄�D\Dd��LdDdLd����Dd<\D\<\LdLd����D\<dDdLd������������������������������LdD\LdDT����Ld<dD\LdD\Ld������LdDdLdDdLd�Ą̤����������̄�DdLd�Č�D\Ld����LdDd<\DdD\Ld����LdD\LdDd��������������������������������Dd<\Ld����D\LdLdDdLdLd����D\DdLd��LdDd�ĄĬ����������Ą�LdD\�̄�LdDd������D\LdLdDdLd����<\DdLd������������������������������������<\Dd����LdDdLdD\Ld������D\Dd�Ą�D\Ld�ČĤ����������̄�LdDd�ĄĤ�<dL\����LdLd<dLdLd����<\Ld��������������������������������������LdDd����LdD\Ld<d��������DdLd�Č�LdDd�Ą̬����������Č�DdLd�ĄĤ�LdD\������LdD\LdDd����DdLd����������������������������������������������LdDdD\Ld������LdLd���Ą�LdDd�Ą̬����������Ą�DdD\�ĄĤ���D\Ld����LdDdD\Ld������������������������������������������������������DdLdDd������<dLdLd���Ą�DdLd�ĄĬ����������̄�LdDd�Č̜���<dLd������Ld<dLd������������������������������������������������������LdD\Ld������LdDd�����̄�LdDd�Ą̬����������Č�DdLd�Ą̤���LdLdDT����LdD\D\������������������������������������������������������LdDdLd����LdDdLd�����̌�LdDd�Č̤����������Ą�DdLd�ĄĤ�����LdLd����LdDdD\������������������������������������������������������LdD\Ld����DdLd�Ĥ����Ą�D\Dd�ĄĤ����������̄�LdDd�̄Ĥ�����DdLd����Ld<\Ld������������������������������������������������������Ld<dLd����D\Ld�̄ĄĄĄ�D\Dd�̄ĄČ̄ĄĄĄĄ�DdLd�̄ĄĄĄ�D\Ld����Dd<\Ld������������������������������������������������������LdD\Ld����LdDdD\D\LdDdLdLdD\LdD\Ld<dD\LdDdLd<dLd<\DdD\LdDdD\LdDd����Ld<dD\������������������������������������������������������LdDdLd����<dLdLdLd<dLdD\<dLdDdLdDdLdDdLd<\LdD\LdLdLdDdLd<\LdDdLd����Ld<\Ld������������������������������������������������������LdD\Ld����D\LdLdDdLdD\<dLdDdLdDdLdDdLdDdLdD\Dd<\LdDdLdDdLd<dLdLd����Ld<dLd������������������������������������������������������LdDdLd����Ld<dD\DdLdLdD\LdD\Ld<\LdD\LdD\Ld<dLdLdLdD\Ld<\LdLdD\Ld����LdD\<d������������������������������������������������������LdD\Ld����LdD\LdLdDdLdD\Ld<\LdD\LdD\LdD\LdDdLdLdLdDdD\Ld<\DdLdDd����LdDd<\������������������������������������������������������LdDdLd����DdLdDdD\LdD\DdLdDdLdDdLd<dLdDdLd<\LdD\Dd<\LdLdLdLdD\Ld����LdDdLd������������������������������������������������������LdDdLd����LdD\LdLdDdLdLd<\LdD\LdD\LdD\LdDdLdDdLdLdLdDdD\LdLdDdLd����LdD\Ld������������������������������������������������������LdDdLd����LdDdLdLdLdLdLdDdD\LdD\LdD\Ld<dLdDdLdDdLdLdLdDdD\D\LdDd����Ld<\Ld������������������������������������������������������Ld<dLd����DdLd<\<\Dd<\Dd<\LdLd<dLdDdLdD\Ld<\Ld<\Dd<\Dd<\LdLdDdLd����LdDdLd������������������������������������������������������L\LdLd����LdD\DdDdD\DdD\Dd<\LdLdDdLd<\LdD\DdD\DdD\DdD\DdD\LdDdLd����LdLdDd����������������������������������������������������������������LdLdLdLdLdLdLdLdLdDdD\LdDdLdLdLdLdLdLdLdLdLdLdLdD\L\Ld��������������������������������������������������������������������������T\LdDdLdDdLdLdDdLdLdDdLdLdLdDdLdLdDdLdLdDdLdLdDdLdDdT\������������������������������������ \ No newline at end of file diff --git a/sdk/samples/rockem/splash.pal b/sdk/samples/rockem/splash.pal new file mode 100644 index 0000000..3464b70 Binary files /dev/null and b/sdk/samples/rockem/splash.pal differ diff --git a/sdk/samples/rockem/walk0.wav b/sdk/samples/rockem/walk0.wav new file mode 100644 index 0000000..f7589f6 Binary files /dev/null and b/sdk/samples/rockem/walk0.wav differ diff --git a/sdk/samples/rockem/walk1.wav b/sdk/samples/rockem/walk1.wav new file mode 100644 index 0000000..ec0883d Binary files /dev/null and b/sdk/samples/rockem/walk1.wav differ diff --git a/sdk/samples/rockem/whoosh1.wav b/sdk/samples/rockem/whoosh1.wav new file mode 100644 index 0000000..af2f5f3 Binary files /dev/null and b/sdk/samples/rockem/whoosh1.wav differ diff --git a/sdk/samples/rockem/whoosh2.wav b/sdk/samples/rockem/whoosh2.wav new file mode 100644 index 0000000..abdd32b Binary files /dev/null and b/sdk/samples/rockem/whoosh2.wav differ diff --git a/sdk/samples/rockem/winmain.cpp b/sdk/samples/rockem/winmain.cpp new file mode 100644 index 0000000..82be9a7 --- /dev/null +++ b/sdk/samples/rockem/winmain.cpp @@ -0,0 +1,408 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: winmain.cpp + * + ***************************************************************************/ + +// Defines.... +#define CLASS_NAME "RockEm3D_Class" + +// Includes.... +#include "windows.h" +#include "resource.h" +#include "winmain.h" + +#include "directx.h" +#include "rm.h" + +#include "control.h" + +#include "midi.h" + +// Globals.... +HINSTANCE g_hInst = NULL; +HWND g_hWnd = NULL; + +BOOL g_bActive = FALSE; +BOOL g_bFirstActive = TRUE; +BOOL g_bErrorOccured = FALSE; +char g_sError[2048]; +BOOL g_bShowStats = FALSE; +BOOL g_bMusicPaused = FALSE; +BOOL g_bSoundPaused = FALSE; + +// Externals.... +extern DWORD g_dwCurrMode; // Defined in DIRECTX.CPP + +//------------------------------------------------------------------ +// +// Function : RegError() +// +// Purpose : Registers an error +// +//------------------------------------------------------------------ + +void RegError(char *sErr) +{ + sprintf(g_sError, "%s\n", sErr); + g_bErrorOccured = TRUE; +} + + +//------------------------------------------------------------------ +// +// Function : InitClass() +// +// Purpose : Initialises and registers window class +// +//------------------------------------------------------------------ + +BOOL InitClass(HINSTANCE hInst) +{ + WNDCLASS wndClass; + + // Fill out WNDCLASS info + wndClass.style = CS_HREDRAW | CS_VREDRAW; + wndClass.lpfnWndProc = WndProc; + wndClass.cbClsExtra = 0; + wndClass.cbWndExtra = 0; + wndClass.hInstance = hInst; + wndClass.hIcon = LoadIcon(hInst, "ROCKEM3D"); + wndClass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndClass.hbrBackground = GetStockObject(BLACK_BRUSH); + wndClass.lpszMenuName = NULL; + wndClass.lpszClassName = CLASS_NAME; + + if (!RegisterClass(&wndClass)) return FALSE; + + // Everything's perfect + return TRUE; +} + +//------------------------------------------------------------------ +// +// Function : InitWindow() +// +// Purpose : Initialises and creates the main window +// +//------------------------------------------------------------------ + +BOOL InitWindow(HINSTANCE hInst, int nCmdShow) +{ + // Create a window + g_hWnd = CreateWindowEx(WS_EX_APPWINDOW, + CLASS_NAME, + "RockEm3D Demo", + WS_POPUP | WS_SYSMENU, + 0, 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + NULL, + NULL, + hInst, + NULL); + + // Return false if window creation failed + if (!g_hWnd) return FALSE; + + // Show the window + ShowWindow(g_hWnd, SW_SHOWNORMAL); + + // Update the window + UpdateWindow(g_hWnd); + + // Everything's perfect + return TRUE; +} + +//------------------------------------------------------------------ +// +// Function : WndProc() +// +// Purpose : Windows procedure to handle messages +// +//------------------------------------------------------------------ + +long FAR PASCAL WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + // D3DVECTOR used for 3D position of sound + static D3DVECTOR d3dvPos= {D3DVAL(0), D3DVAL(0), D3DVAL(0)}; + + // Handle messages + switch (message) + { + case WM_KEYDOWN: + { + switch (wParam) + { + case VK_ESCAPE: + { + // Time to quit.... + PostMessage(g_hWnd, WM_CLOSE ,0 ,0); + } + break; + + case VK_F5: + { + // Toggle stats + g_bShowStats = !g_bShowStats; + } + break; + + case 'M': + { + // Toggle music + if (GetAsyncKeyState(VK_CONTROL) & 0x8000) + { + if (!g_bMusicPaused) + { + PauseMidi(); + } + else + { + ResumeMidi(); + } + g_bMusicPaused = !g_bMusicPaused; + } + } + break; + + case 'S': + { + // Toggle sound + if (GetAsyncKeyState(VK_CONTROL) & 0x8000) + { + g_bSoundPaused = !g_bSoundPaused; + + if (g_bSoundPaused) + { + // Kill all the sound effects + StopAllSounds(); + } + else + { + // Start the crowd noise looping + PlaySoundDS(CROWD_LOOP,d3dvPos, DSBPLAY_LOOPING); + } + } + } + break; + + case VK_F6 : + { + // Go up a video mode + if(!EnterNextVideoMode()) + PostMessage(g_hWnd, WM_CLOSE ,0 ,0); + } + break; + + case VK_F7 : + { + // Go down a video mode + if(!EnterPrevVideoMode()) + PostMessage(g_hWnd, WM_CLOSE ,0 ,0); + } + break; + + case VK_END : + { + // Go to highest video mode + if(!EnterLowestVideoMode()) + PostMessage(g_hWnd, WM_CLOSE ,0 ,0); + } + break; + + case VK_HOME : + { + // Go to lowest video mode + if(!EnterHighestVideoMode()) + PostMessage(g_hWnd, WM_CLOSE ,0 ,0); + } + break; + } + } + break; + + case WM_SYSCOMMAND: + { + switch (wParam) + { + // Trap ALT so it doesn't pause the app + case SC_KEYMENU : + { + return 0; + } + break; + } + } + + case WM_ACTIVATEAPP: + { + // Determine whether app is being activated or not + g_bActive = (BOOL)wParam ? TRUE : FALSE; + + if (g_bActive) + { + while (ShowCursor(FALSE) > 0) { }; + if (!g_bMusicPaused) ResumeMidi(); + } + else + { + ShowCursor(TRUE); + PauseMidi(); + } + } + break; + + case WM_CLOSE: + { + DestroyWindow(g_hWnd); + } + break; + + case WM_DESTROY: + { + // Stop midi music + StopMidi(); + + // Destroy scene + TermScene(); + + // Terminate all the DirectX objects, surfaces devices etc + TermDirectX(); + + // Show the mouse + ShowCursor(TRUE); + + // If an error occured, show it + if (g_bErrorOccured) + { + MessageBeep(0); + MessageBox(NULL, g_sError, "Error!", MB_OK); + } + + // Time to leave this mortal coil + PostQuitMessage(0); + } + break; + + case MCI_NOTIFY: + { + if (wParam == MCI_NOTIFY_SUCCESSFUL) + { + ReplayMidi(); + } + } + break; + } + + return DefWindowProc(hWnd, message, wParam, lParam); +} + +//------------------------------------------------------------------ +// +// Function : WinMain() +// +// Purpose : Entry point to application +// +//------------------------------------------------------------------ + +int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + + // Set global handle + g_hInst = hInst; + + // Initialise window class + if (!InitClass(hInst)) return 1; + + // Initialise window + if (!InitWindow(hInst, nCmdShow)) return 1; + + // Initialise DirectX objects (Termination is handled in WM_DESTROY) + if (!InitDirectX()) + { + DestroyWindow(g_hWnd); + return 1; + } + + // Show the splash screen + DoSplashScreen(2000); + + // Load the scene + if (!InitScene()) + { + DestroyWindow(g_hWnd); + return 1; + } + + // Release the splash screen + ReleaseSplashScreen(); + + // Set DirectDraw exclusive mode here so that the splash could stay + // up during initialisation if we are using a different DirectDraw device + // that could not support 640x480x8 for hardware rendering. + if (!SetDirectDrawExclusiveMode()) + { + RegError("Could not set exclusive mode!"); + return FALSE; + } + + // Hide the mouse + ShowCursor(FALSE); + + // Enter video mode set in g_dwCurMode + if (!EnterVideoMode(g_dwCurrMode)) + { + DestroyWindow(g_hWnd); + return 1; + } + + // Load accelerators + HACCEL hAccel = LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_ACCEL)); + + // Start the music! + PlayMidi("RockEm3D.mid"); + + // Pump messages via a PeekMessage loop + while (TRUE) + { + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + if (msg.message == WM_QUIT) + { + PostQuitMessage(msg.wParam); + return 1; + } + + if (hAccel && (msg.hwnd == g_hWnd)) + { + TranslateAccelerator(g_hWnd, hAccel, &msg); + } + + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + // Perform any neccessary updating during idle time + if (g_bActive) + { + // Update everything + CheckInputAndUpdate(); + + // Render the current scene + if (!RenderScene()) + { + DestroyWindow(g_hWnd); + return 1; + } + } + } + + // Exit WinMain and terminate the app.... + return msg.wParam; +} + diff --git a/sdk/samples/rockem/winmain.h b/sdk/samples/rockem/winmain.h new file mode 100644 index 0000000..4e7131e --- /dev/null +++ b/sdk/samples/rockem/winmain.h @@ -0,0 +1,20 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: winmain.h + * + ***************************************************************************/ + +#ifndef __WINMAIN_H +#define __WINMAIN_H + +void RegError(char *sErr); + +BOOL InitClass(HINSTANCE hInst); +BOOL InitWindow(HINSTANCE hInst, int nCmdShow); +long FAR PASCAL WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow); + +#endif + diff --git a/sdk/samples/rockem/yes b/sdk/samples/rockem/yes new file mode 100644 index 0000000..975fbec --- /dev/null +++ b/sdk/samples/rockem/yes @@ -0,0 +1 @@ +y diff --git a/sdk/samples/scrawl/makefile b/sdk/samples/scrawl/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/scrawl/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/scrawl/msvc.mk b/sdk/samples/scrawl/msvc.mk new file mode 100644 index 0000000..4e2d2b5 --- /dev/null +++ b/sdk/samples/scrawl/msvc.mk @@ -0,0 +1,41 @@ +NAME = scrawl +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib comctl32.lib \ + dinput.lib dxguid.lib + +OBJS = scrawl.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/scrawl/readme.txt b/sdk/samples/scrawl/readme.txt new file mode 100644 index 0000000..07f309d --- /dev/null +++ b/sdk/samples/scrawl/readme.txt @@ -0,0 +1,20 @@ +Basic demonstration of DirectInput mouse usage. Lets you draw on the +screen with the mouse. Note that this is not entirely well-suited +to DirectInput because the app acts pretty much like a normal Windows +application, but at least you can see how the calls are made. + +This sample program demonstrates the following: + +* Creating interfaces to DirectInputDevice objects. + +* Acquiring and unacquiring devices. + +* Reading buffered device data. + +* Event notifications for device activity. + +* Restricting the mouse to an arbitrary region. + +* Scaling raw mouse coordinates before using them. + +* Use of relative axis mode. diff --git a/sdk/samples/scrawl/scrawl.cpp b/sdk/samples/scrawl/scrawl.cpp new file mode 100644 index 0000000..286c4e0 --- /dev/null +++ b/sdk/samples/scrawl/scrawl.cpp @@ -0,0 +1,1061 @@ +/************************************************************************** + + SCRAWL.CPP - A dumb drawing app demo for DirectInput + + Collects mouse data in various modes to demonstrate how it's done. + + **************************************************************************/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + **************************************************************************/ + +#include <windows.h> +#include <windowsx.h> +#include <stdarg.h> +#include <dinput.h> + +#include "scrawl.h" + +/**************************************************************************** + * + * This is an incredibly dump app. It just lets you "draw" on + * a monochrome bitmap via DirectInput. The purpose is not to + * dazzle you with mind-altering brilliance. It's just to show + * how to use the DirectInput mouse interface. + * + ****************************************************************************/ + +/**************************************************************************** + * + * Manifest constants + * + ****************************************************************************/ + +#define DINPUT_BUFFERSIZE 16 + +#define DINPUT_CXBITMAP 512 +#define DINPUT_CYBITMAP 300 + +/**************************************************************************** + * + * Global variables + * + ****************************************************************************/ + +const char c_szAppName[] = "Scrawl"; /* My name */ + +HINSTANCE g_hinst; /* My instance handle */ +BOOL g_fActive; /* Am I the active window? */ + +int g_x = DINPUT_CXBITMAP / 2; /* Virtual x-coordinate */ +int g_y = DINPUT_CYBITMAP / 2; /* Virtual y-coordinate */ + +int g_dxFuzz; /* Leftover x-fuzz from scaling */ +int g_dyFuzz; /* Leftover y-fuzz from scaling */ +int g_iSensitivity; /* Mouse sensitivity */ + +HDC g_hdc; /* Memory DC our picture lives in */ +HBITMAP g_hbm; /* Our picture */ +HBITMAP g_hbmDeselect; /* Stock bitmap for deselecting */ + +HCURSOR g_hcurCross; /* Crosshairs */ +int g_cxCross; /* Width of crosshairs cursor */ +int g_cyCross; /* Height of crosshairs cursor */ +int g_dxCrossHot; /* Hotspot location of crosshairs */ +int g_dyCrossHot; /* Hotspot location of crosshairs */ +int g_fShowCursor = 1; /* Should the cursor be shown? */ + +/**************************************************************************** + * + * DirectInput globals + * + ****************************************************************************/ + +LPDIRECTINPUT g_pdi; +LPDIRECTINPUTDEVICE g_pMouse; + +HANDLE g_hevtMouse; + +/**************************************************************************** + * + * Complain + * + * Whine and moan. + * + ****************************************************************************/ + +void CDECL +Complain(HWND hwndOwner, HRESULT hr, LPCSTR pszFormat, ...) +{ + va_list ap; + char szBuf[1024]; + char *pszBuf; + + va_start(ap, pszFormat); + + pszBuf = szBuf + wsprintf(szBuf, pszFormat, ap); + + va_end(ap); + + wsprintf(pszBuf, "\n\nError = %08x", hr); + + MessageBox(hwndOwner, szBuf, c_szAppName, MB_OK); +} + +/**************************************************************************** + * + * DIInit + * + * Initialize the DirectInput variables. + * + ****************************************************************************/ + +BOOL DIInit(HWND hwnd) +{ + HRESULT hr; + + /* + * Register with DirectInput and get an IDirectInput to play with. + */ + hr = DirectInputCreate(g_hinst, DIRECTINPUT_VERSION, &g_pdi, NULL); + + if (FAILED(hr)) { + Complain(hwnd, hr, "DirectInputCreate"); + return FALSE; + } + + /* + * Obtain an interface to the system mouse device. + */ + hr = g_pdi->CreateDevice(GUID_SysMouse, &g_pMouse, NULL); + + if (FAILED(hr)) { + Complain(hwnd, hr, "CreateDevice(SysMouse)"); + return FALSE; + } + + /* + * Set the data format to "mouse format". + */ + hr = g_pMouse->SetDataFormat(&c_dfDIMouse); + + if (FAILED(hr)) { + Complain(hwnd, hr, "SetDataFormat(SysMouse, dfDIMouse)"); + return FALSE; + } + + + /* + * Set the cooperativity level. + */ + hr = g_pMouse->SetCooperativeLevel(hwnd, + DISCL_EXCLUSIVE | DISCL_FOREGROUND); + + if (FAILED(hr)) { + Complain(hwnd, hr, "SetCooperativeLevel(SysMouse)"); + return FALSE; + } + + + /* + * Create the handle that tells us new data is available. + */ + g_hevtMouse = CreateEvent(0, 0, 0, 0); + + if (g_hevtMouse == NULL) { + Complain(hwnd, GetLastError(), "CreateEvent"); + return FALSE; + } + + /* + * Associate the event with the device. + */ + hr = g_pMouse->SetEventNotification(g_hevtMouse); + + if (FAILED(hr)) { + Complain(hwnd, hr, "SetEventNotification(SysMouse)"); + return FALSE; + } + + /* + * Set the buffer size to DINPUT_BUFFERSIZE elements. + * The buffer size is a DWORD property associated with the device. + */ + DIPROPDWORD dipdw = + { + { + sizeof(DIPROPDWORD), // diph.dwSize + sizeof(DIPROPHEADER), // diph.dwHeaderSize + 0, // diph.dwObj + DIPH_DEVICE, // diph.dwHow + }, + DINPUT_BUFFERSIZE, // dwData + }; + + hr = g_pMouse->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph); + + if (FAILED(hr)) { + Complain(hwnd, hr, "Set buffer size(SysMouse)"); + return FALSE; + } + + return TRUE; + +} + +/**************************************************************************** + * + * DITerm + * + * Terminate our usage of DirectInput. + * + ****************************************************************************/ + +void DITerm(void) +{ + if (g_pdi) g_pdi ->Release(), g_pdi = NULL; + if (g_pMouse) g_pMouse->Release(), g_pMouse = NULL; + + if (g_hevtMouse) CloseHandle(g_hevtMouse), g_hevtMouse = NULL; +} + +/**************************************************************************** + * + * InvalidateCursorRect + * + * Invalidate the rectangle that contains the cursor. + * + * The coordinates are in client coordinates. + * + ****************************************************************************/ + +void InvalidateCursorRect(HWND hwnd) +{ + RECT rc = { g_x - g_dxCrossHot, g_y - g_dyCrossHot, + g_x - g_dxCrossHot + g_cxCross, g_y - g_dyCrossHot + g_cyCross }; + + InvalidateRect(hwnd, &rc, 0); +} + +/**************************************************************************** + * + * UpdateCursorPosition + * + * Move our private cursor in the requested direction, subject + * to clipping, scaling, and all that other stuff. + * + * This does not redraw the cursor. You need to do that yourself. + * + ****************************************************************************/ + +void UpdateCursorPosition(int dx, int dy) +{ + + /* + * Pick up any leftover fuzz from last time. This is important + * when scaling down mouse motions. Otherwise, the user can + * drag to the right extremely slow for the length of the table + * and not get anywhere. + */ + dx += g_dxFuzz; g_dxFuzz = 0; + dy += g_dyFuzz; g_dyFuzz = 0; + + switch (g_iSensitivity) { + + case 1: /* High sensitivity: Magnify! */ + dx *= 2; + dy *= 2; + break; + + case -1: /* Low sensitivity: Scale down */ + g_dxFuzz = dx % 2; /* remember the fuzz for next time */ + g_dyFuzz = dy % 2; + dx /= 2; + dy /= 2; + break; + + default: + case 0: /* No sensitivity */ + ; /* No adjustments needed */ + } + + g_x += dx; + g_y += dy; + + /* Clip the cursor to our client area */ + if (g_x < 0) g_x = 0; + if (g_x >= DINPUT_CXBITMAP) g_x = DINPUT_CXBITMAP - 1; + + if (g_y < 0) g_y = 0; + if (g_y >= DINPUT_CYBITMAP) g_y = DINPUT_CYBITMAP - 1; + +} + +/**************************************************************************** + * + * Scrawl_SyncAcquire + * + * Acquire or unacquire the devices, depending on the the g_fActive + * flag. This synchronizes the devices with our internal view of + * the world. + * + * Also repaint the cursor so that it hides/shows in sync with + * acquisition. + * + ****************************************************************************/ + +void +Scrawl_SyncAcquire(HWND hwnd) +{ + if (g_fActive) { + if (g_pMouse) g_pMouse->Acquire(); + } else { + if (g_pMouse) g_pMouse->Unacquire(); + } + + InvalidateCursorRect(hwnd); +} + +/**************************************************************************** + * + * Private messages + * + * WM_SYNCACQUIRE forces us to re-synchronize our acquisition + * with the world. + * + ****************************************************************************/ + +#define WM_SYNCACQUIRE (WM_USER + 0) + +/**************************************************************************** + * + * Scrawl_OnClear + * + * Wipe out the bitmap. + * + ****************************************************************************/ + +void Scrawl_OnClear(HWND hwnd) +{ + /* + * Start out all black. + */ + PatBlt(g_hdc, 0, 0, DINPUT_CXBITMAP, DINPUT_CYBITMAP, BLACKNESS); + + if (hwnd) { + InvalidateRect(hwnd, 0, 0); + } +} + +/**************************************************************************** + * + * Scrawl_OnCreate + * + * Set up the window by appending our custom commands to the System + * menu. + * + ****************************************************************************/ + +BOOL Scrawl_OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct) +{ + HMENU hmenu = GetSystemMenu(hwnd, FALSE); + + AppendMenu(hmenu, MF_ENABLED | MF_STRING, IDC_CLEAR, "C&lear\tDel"); + AppendMenu(hmenu, MF_ENABLED | MF_STRING, IDC_ABOUT, "&About\tF1"); + + AppendMenu(hmenu, MF_ENABLED | MF_STRING | MF_POPUP, + (UINT)LoadMenu(g_hinst, + MAKEINTRESOURCE(IDM_SENSITIVITY)), + "Sensitivit&y"); + + return 1; +} + +/**************************************************************************** + * + * Scrawl_OnInitMenuPopup + * + * Initialize the sensitivity item accordingly. + * + ****************************************************************************/ + +void +Scrawl_OnInitMenuPopup(HWND hwnd, HMENU hmenu, UINT item, BOOL fSystemMenu) +{ + int iSensitivity; + for (iSensitivity = -1; iSensitivity <= 1; iSensitivity++) { + if (g_iSensitivity == iSensitivity) { + CheckMenuItem(hmenu, IDC_SENSITIVITY_NORMAL + iSensitivity, + MF_BYCOMMAND | MF_CHECKED); + } else { + CheckMenuItem(hmenu, IDC_SENSITIVITY_NORMAL + iSensitivity, + MF_BYCOMMAND | MF_UNCHECKED); + } + } + +} + +/**************************************************************************** + * + * Scrawl_OnKeyDown + * + * See if it's one of our accelerators. + * + ****************************************************************************/ + +void Scrawl_OnKeyDown(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags) +{ + switch (vk) { + case '1': + case '2': + case '3': + PostMessage(hwnd, WM_SYSCOMMAND, IDC_SENSITIVITY_NORMAL + + vk - '2', 0); + break; + + case VK_DELETE: + PostMessage(hwnd, WM_SYSCOMMAND, IDC_CLEAR, 0); + break; + + case VK_F1: + PostMessage(hwnd, WM_SYSCOMMAND, IDC_ABOUT, 0); + break; + + } +} + +/**************************************************************************** + * + * Scrawl_OnPaint + * + * Blt out our bitmap and draw our cursor on top of it. + * + ****************************************************************************/ + +void +Scrawl_OnPaint(HWND hwnd) +{ + PAINTSTRUCT ps; + HDC hdc = BeginPaint(hwnd, &ps); + + if (hdc) { + + BitBlt(hdc, + ps.rcPaint.left, + ps.rcPaint.top, + ps.rcPaint.right - ps.rcPaint.left, + ps.rcPaint.bottom - ps.rcPaint.top, + g_hdc, + ps.rcPaint.left, + ps.rcPaint.top, + SRCCOPY); + + if (g_fActive && g_fShowCursor) { + DrawIcon(hdc, g_x - g_dxCrossHot, + g_y - g_dyCrossHot, g_hcurCross); + } + + EndPaint(hwnd, &ps); + } +} + +/**************************************************************************** + * + * Scrawl_OnButton0Down_FlushMotion + * + * Flush out any motion that we are holding. + * + ****************************************************************************/ + +typedef struct BUTTON0INFO { + + HDC hdcWindow; + BOOL fMoved; + DWORD dwSeqLastSeen; + +} BUTTON0INFO, *PBUTTON0INFO; + +void Scrawl_OnButton0Down_FlushMotion(PBUTTON0INFO pb0i) +{ + if (pb0i->fMoved) { + pb0i->fMoved = 0; + pb0i->dwSeqLastSeen = 0; + LineTo(pb0i->hdcWindow, g_x, g_y); + LineTo(g_hdc, g_x, g_y); + } + +} + +/**************************************************************************** + * + * Scrawl_OnButton0Down + * + * Enter draw mode. + * + * If we are drawing a curve, then read buffered data and draw + * lines from point to point. By reading buffered data, we can + * track the motion of the mouse accurately without coalescing. + * + * This function illustrates how a non-message-based program can + * process buffered data directly from a device, processing + * messages only occasionally (as required by Windows). + * + * This function also illustrates how an application can piece + * together buffered data elements based on the sequence number. + * A single mouse action (e.g., moving diagonally) is reported + * as a series of events, all with the same sequence number. + * Zero is never a valid DirectInput sequence number, so it is + * safe to use it as a sentinel value. + * + ****************************************************************************/ + +void Scrawl_OnButton0Down(HWND hwnd) +{ + BUTTON0INFO b0i; + + /* Hide the cursor while scrawling */ + g_fShowCursor = FALSE; + InvalidateCursorRect(hwnd); + UpdateWindow(hwnd); + + /* + * For performance, draw directly onto the window's DC instead of + * invalidating and waiting for the WM_PAINT message. Of course, + * we always draw onto our bitmap, too, since that's what really + * counts. + */ + + /* BUGBUG -- select a decent pen, too */ + b0i.hdcWindow = GetDC(hwnd); + MoveToEx(b0i.hdcWindow, g_x, g_y, 0); + MoveToEx(g_hdc, g_x, g_y, 0); + + /* BUGBUG -- save old pen */ + SelectObject(b0i.hdcWindow, GetStockObject(WHITE_PEN)); + SelectObject(g_hdc, GetStockObject(WHITE_PEN)); + + b0i.fMoved = 0; + b0i.dwSeqLastSeen = 0; + + /* + * Keep reading data elements until we see a "mouse button up" event. + */ + BOOL fDone = 0; + while (!fDone) { + DIDEVICEOBJECTDATA od; + + DWORD dwElements = 1; + + HRESULT hr = g_pMouse->GetDeviceData( + sizeof(DIDEVICEOBJECTDATA), &od, + &dwElements, 0); + + /* Unable to read data */ + if (FAILED(hr)) { + break; + } + + /* + * If no data available, finish the element we had been + * collecting, and then process our message queue so + * the system don't think we're hung. + */ + if (dwElements == 0) { + + /* If there is a partial motion, flush it out */ + Scrawl_OnButton0Down_FlushMotion(&b0i); + + MSG msg; + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + /* If it's a quit message, we're outta here */ + if (msg.message == WM_QUIT) { + fDone = TRUE; + /* + * Re-post the quit message so the + * outer loop will see it and exit. + */ + PostQuitMessage(msg.wParam); + break; + } else { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + continue; + } + + /* If this is the start of a new event, flush out the old one */ + if (od.dwSequence != b0i.dwSeqLastSeen) { + Scrawl_OnButton0Down_FlushMotion(&b0i); + b0i.dwSeqLastSeen = od.dwSequence; + } + + /* Look at the element to see what happened */ + + switch (od.dwOfs) { + + /* DIMOFS_X: Mouse horizontal motion */ + case DIMOFS_X: + UpdateCursorPosition(od.dwData, 0); + b0i.fMoved = 1; + break; + + + /* DIMOFS_Y: Mouse vertical motion */ + case DIMOFS_Y: + UpdateCursorPosition(0, od.dwData); + b0i.fMoved = 1; + break; + + /* DIMOFS_BUTTON0: Button 0 pressed or released */ + case DIMOFS_BUTTON0: + + if (!(od.dwData & 0x80)) { /* Button released */ + fDone = 1; + Scrawl_OnButton0Down_FlushMotion(&b0i); /* Flush out dregs */ + } + break; + + } + } + + ReleaseDC(hwnd, b0i.hdcWindow); + + /* Re-show the cursor now that scrawling is finished */ + g_fShowCursor = TRUE; + InvalidateCursorRect(hwnd); +} + + +/**************************************************************************** + * + * Scrawl_OnButton1Up + * + * Pop up a context menu. + * + ****************************************************************************/ + +void Scrawl_OnButton1Up(HWND hwnd) +{ + POINT pt = { g_x, g_y }; + ClientToScreen(hwnd, &pt); + + /* + * Unacquire the devices so the user can interact with the menu. + * + * Put the Windows cursor at the same location as our virtual cursor. + * + * Hide the cursor while moving it so you don't get annoying flicker. + */ + + ShowCursor(FALSE); + g_fActive = FALSE; + Scrawl_SyncAcquire(hwnd); + SetCursorPos(pt.x, pt.y); + ShowCursor(TRUE); + + HMENU hmenuPopup = GetSystemMenu(hwnd, FALSE); + + UINT idc = TrackPopupMenuEx(hmenuPopup, + TPM_RIGHTBUTTON | TPM_RETURNCMD, + pt.x, pt.y, hwnd, 0); + + PostMessage(hwnd, WM_SYSCOMMAND, idc, 0L); + +} + +/**************************************************************************** + * + * Scrawl_OnMouseInput + * + * The mouse moved while nothing was happening. Walk the event list + * and update the mouse position for each event. If we see a button + * event, then stop pulling events and leave the elements in the + * input buffer for the drawing handler to pull. + * + * + ****************************************************************************/ + +void +Scrawl_OnMouseInput(HWND hwnd) +{ + /* Invalidate the old cursor so it will be erased */ + InvalidateCursorRect(hwnd); + + /* + * Attempt to read one data element. Continue as long as + * device data is available. + */ + BOOL fDone = 0; + while (!fDone) { + DIDEVICEOBJECTDATA od; + + DWORD dwElements = 1; + + HRESULT hr = g_pMouse->GetDeviceData( + sizeof(DIDEVICEOBJECTDATA), &od, + &dwElements, 0); + + if (hr == DIERR_INPUTLOST) { + /* + * We had acquisition, but lost it. Try to reacquire it. + * + * WARNING! DO NOT ATTEMPT TO REACQUIRE IF YOU GET + * DIERR_NOTACQUIRED! Otherwise, you're extremely likely + * to get caught in an infinite loop: The acquire will fail, + * and you'll get another DIERR_NOTACQUIRED so you'll + * try to aquire again, and that'll fail, etc. + */ + PostMessage(hwnd, WM_SYNCACQUIRE, 0, 0L); + break; + } + + /* Unable to read data or no data available */ + if (FAILED(hr) || dwElements == 0) { + break; + } + + /* Look at the element to see what happened */ + + switch (od.dwOfs) { + + /* DIMOFS_X: Mouse horizontal motion */ + case DIMOFS_X: UpdateCursorPosition(od.dwData, 0); break; + + + /* DIMOFS_Y: Mouse vertical motion */ + case DIMOFS_Y: UpdateCursorPosition(0, od.dwData); break; + + /* DIMOFS_BUTTON0: Button 0 pressed or released */ + case DIMOFS_BUTTON0: + + if (od.dwData & 0x80) { /* Button pressed */ + fDone = 1; + Scrawl_OnButton0Down(hwnd); /* Go into button-down mode */ + } + break; + + /* DIMOFS_BUTTON1: Button 1 pressed or released */ + case DIMOFS_BUTTON1: + + if (!(od.dwData & 0x80)) { /* Button released */ + fDone = 1; + Scrawl_OnButton1Up(hwnd); /* Context menu time */ + } + } + + } + + /* Invalidate the new cursor so it will be drawn */ + InvalidateCursorRect(hwnd); + +} + +/**************************************************************************** + * + * ScrawlWndProc + * + * Application window procedure. + * + ****************************************************************************/ + +LONG CALLBACK ScrawlWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +{ + + switch (msg) { + + HANDLE_MSG(hwnd, WM_CREATE, Scrawl_OnCreate); + + HANDLE_MSG(hwnd, WM_PAINT, Scrawl_OnPaint); + + HANDLE_MSG(hwnd, WM_INITMENUPOPUP, Scrawl_OnInitMenuPopup); + + HANDLE_MSG(hwnd, WM_KEYDOWN, Scrawl_OnKeyDown); + + /* + * Reacquire the mouse and keyboard when we are the active window. + * Unacquire them when we stop being the active window. + */ + case WM_ACTIVATE: + g_fActive = wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE; + Scrawl_SyncAcquire(hwnd); + break; + + /* + * Unacquire the devices if a menu appears, so that the user can + * interact with the menu in the normal manner. + * + * From Windows' point of view, we are still the active window + * when a menu appears, but we want to act like the menu deactivated + * us. + */ + case WM_ENTERMENULOOP: + case WM_ENTERSIZEMOVE: + g_fActive = FALSE; + Scrawl_SyncAcquire(hwnd); + break; + + /* + * Reacquire the devices when the menu goes away. + * + * SUBTLETY 1: Windows actually sends the WM_EXITMENULOOP message + * before all the menu-related stuff is finished, so post ourselves + * a private message to reacquire after the menu has been torn + * down for real. + * + * SUBTLETY 2: Don't assume that just because the menu is going + * away that you are still the active window. You might not be. + */ + case WM_EXITMENULOOP: + case WM_EXITSIZEMOVE: + g_fActive = GetActiveWindow() == hwnd; + PostMessage(hwnd, WM_SYNCACQUIRE, 0, 0L); + break; + + case WM_SYNCACQUIRE: + Scrawl_SyncAcquire(hwnd); + break; + + case WM_SYSCOMMAND: + + LRESULT lRc; + switch (GET_WM_COMMAND_ID(wParam, lParam)) { + case IDC_CLEAR: + Scrawl_OnClear(hwnd); + lRc = 0; + break; + + case IDC_ABOUT: + MessageBox(hwnd, "Scrawl DirectInput Sample v1.0", + c_szAppName, MB_OK); + lRc = 0; + break; + + /* + * Eat the screen-saver notification. + */ + case SC_SCREENSAVE: + lRc = 0; + break; + + case IDC_SENSITIVITY_LOW: + case IDC_SENSITIVITY_NORMAL: + case IDC_SENSITIVITY_HIGH: + g_iSensitivity = (signed short)GET_WM_COMMAND_ID(wParam, lParam) + - IDC_SENSITIVITY_NORMAL; + lRc = 0; + break; + + default: + lRc = DefWindowProc(hwnd, msg, wParam, lParam); + break; + } + + /* + * The WM_SYSCOMMAND might've been a WM_CLOSE, in which case + * our window no longer exists. So be careful. + */ + if (IsWindow(hwnd)) { + Scrawl_SyncAcquire(hwnd); + } + return lRc; + + + case WM_DESTROY: + PostQuitMessage(0); + break; + + } + + return DefWindowProc(hwnd, msg, wParam, lParam); +} + +/**************************************************************************** + * + * AppInit + * + * Set up everything the application needs to get started. + * + ****************************************************************************/ + +HWND AppInit(HINSTANCE hinst, int nCmdShow) +{ + + /* Save instance handle for people who care */ + g_hinst = hinst; + + /* + * Get our crosshairs cursor and extract the the width and + * hotspot location so we can draw it manually. + */ + g_hcurCross = LoadCursor(NULL, IDC_CROSS); + + ICONINFO ii; + + GetIconInfo(g_hcurCross, &ii); + + BITMAP bm; + + GetObject(ii.hbmMask, sizeof(BITMAP), &bm); + + if (ii.hbmMask) DeleteObject(ii.hbmMask); + if (ii.hbmColor) DeleteObject(ii.hbmColor); + + g_dxCrossHot = ii.xHotspot; + g_dyCrossHot = ii.yHotspot; + + g_cxCross = bm.bmWidth; + g_cyCross = bm.bmHeight; + + /* + * Create our scrawl bitmap and set it up. + */ + HDC hdc = GetDC(0); + g_hdc = CreateCompatibleDC(hdc); + ReleaseDC(0, hdc); + + if (!g_hdc) return NULL; + + g_hbm = CreateBitmap(DINPUT_CXBITMAP, DINPUT_CYBITMAP, 1, 1, 0); + + if (!g_hbm) return NULL; + + g_hbmDeselect = SelectObject(g_hdc, g_hbm); + + Scrawl_OnClear(0); + + /* + * Set up the window class. + */ + WNDCLASS wc; + + wc.hCursor = LoadCursor(0, IDC_ARROW); + wc.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_MAIN)); + wc.lpszMenuName = NULL; + wc.lpszClassName = c_szAppName; + wc.hbrBackground = 0; + wc.hInstance = hinst; + wc.style = 0; + wc.lpfnWndProc = ScrawlWndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + + if (!RegisterClass(&wc)) { + return NULL; + } + + DWORD dwStyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; + DWORD dwExStyle = WS_EX_APPWINDOW; + + RECT rc = { 0, 0, DINPUT_CXBITMAP, DINPUT_CYBITMAP }; + + AdjustWindowRectEx(&rc, dwStyle, FALSE, dwExStyle); + + HWND hwnd = CreateWindowEx( + dwExStyle, // ExStyle + c_szAppName, // Class name + c_szAppName, // Caption + dwStyle, // Style + CW_USEDEFAULT, CW_USEDEFAULT, // Position + rc.right - rc.left, // cx + rc.bottom - rc.top, // cy + 0, // Parent window (no parent) + 0, // use class menu + g_hinst, // handle to module instance + 0 // no params to pass on + ); + + if (!DIInit(hwnd)) { + DestroyWindow(hwnd); + return NULL; + } + + ShowWindow(hwnd, nCmdShow); + + return hwnd; +} + +/**************************************************************************** + * + * WinMain + * + * Application entry point. + * + * The main message loop illustrates how a message-driven program + * can use event notifications to be signalled when new data is + * available from a device. + * + ****************************************************************************/ + +int PASCAL +WinMain(HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR szCmdLine, int nCmdShow) +{ + MSG msg; + msg.wParam = 0; /* In case something goes horribly wrong */ + + HWND hwnd = AppInit(hinst, nCmdShow); + + if (hwnd) { + + /* + * Since we use notification handles, we need to use + * MsgWaitForMultipleObjects to wait for the event or + * a message, whichever comes first. + */ + + BOOL fDone = FALSE; + + while (!fDone) { + + DWORD dw = MsgWaitForMultipleObjects(1, &g_hevtMouse, 0, INFINITE, + QS_ALLINPUT); + + switch (dw) { + + /* WAIT_OBJECT_0 + 0 means that g_hevtMouse was signalled */ + case WAIT_OBJECT_0 + 0: + Scrawl_OnMouseInput(hwnd); + break; + + /* WAIT_OBJECT_0 + 1 means that we have messages to process */ + case WAIT_OBJECT_0 + 1: + + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + + /* If it's a quit message, we're outta here */ + if (msg.message == WM_QUIT) { + fDone = TRUE; + } else { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + break; + } + } + } + + DITerm(); + + if (g_hdc) { + if (g_hbmDeselect) { + SelectObject(g_hdc, g_hbmDeselect); + } + DeleteDC(g_hdc); + } + + if (g_hbm) { + DeleteObject(g_hbm); + } + + return msg.wParam; + +} diff --git a/sdk/samples/scrawl/scrawl.h b/sdk/samples/scrawl/scrawl.h new file mode 100644 index 0000000..e3b895d --- /dev/null +++ b/sdk/samples/scrawl/scrawl.h @@ -0,0 +1,31 @@ +/************************************************************************** + + SCRAWL.H - A dumb drawing app demo for DirectInput + + **************************************************************************/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + **************************************************************************/ + + + +#include <windows.h> + +#define IDI_MAIN 1 + +#define IDM_SENSITIVITY 1 + +#define IDC_CLEAR 64 +#define IDC_ABOUT 65 + +#define IDC_SENSITIVITY_LOW 96 +#define IDC_SENSITIVITY_NORMAL 97 +#define IDC_SENSITIVITY_HIGH 98 diff --git a/sdk/samples/scrawl/scrawl.ico b/sdk/samples/scrawl/scrawl.ico new file mode 100644 index 0000000..f5eb65e Binary files /dev/null and b/sdk/samples/scrawl/scrawl.ico differ diff --git a/sdk/samples/scrawl/scrawl.rc b/sdk/samples/scrawl/scrawl.rc new file mode 100644 index 0000000..cd85d2d --- /dev/null +++ b/sdk/samples/scrawl/scrawl.rc @@ -0,0 +1,27 @@ +/************************************************************************** + + SCRAWL.RC - A dumb drawing app demo for DirectInput + + **************************************************************************/ +/************************************************************************** + + (C) Copyright 1995-1996 Microsoft Corp. All rights reserved. + + You have a royalty-free right to use, modify, reproduce and + distribute the Sample Files (and/or any modified version) in + any way you find useful, provided that you agree that + Microsoft has no warranty obligations or liability for any + Sample Application Files which are modified. + + **************************************************************************/ + +#include "scrawl.h" + +IDI_MAIN ICON SCRAWL.ICO + +IDM_SENSITIVITY MENU +BEGIN + MENUITEM "&Low\t1", IDC_SENSITIVITY_LOW + MENUITEM "&Normal\t2", IDC_SENSITIVITY_NORMAL + MENUITEM "&High\t3", IDC_SENSITIVITY_HIGH +END diff --git a/sdk/samples/setup/dinstall.c b/sdk/samples/setup/dinstall.c new file mode 100644 index 0000000..66b55a3 --- /dev/null +++ b/sdk/samples/setup/dinstall.c @@ -0,0 +1,587 @@ +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: dinstall.c + * Content: Game SDK sample setup program + ***************************************************************************/ + +#include <windows.h> +#include <shellapi.h> // for SHFileOperation +#include <shlobj.h> // for SHBroweForFolder +#include "dsetup.h" +#include "dinstall.h" + +/* + * global constants and macros + */ +#define BUFFER_SIZE 512 + +#define LoadStrFromRes(uID,lpBuffer) \ +LoadString (GetModuleHandle(NULL),\ + (uID),\ + (lpBuffer),\ + sizeof((lpBuffer))); + + +/* + * list of files that will be copied from the source directory to + * to the directory the game is created in + */ +static char* copy_list [] = +{ + "ROCKEM3D.EXE", + "ARENA.X", + "BLOCK1.WAV", + "BLOCK2.WAV", + "BLOCK3.WAV", + "CBOO.WAV", + "CLOOP.WAV", + "CYEAH.WAV", + "DEBRIS_B.X", + "DEBRIS_R.X", + "DEFEND1.WAV", + "DEFEND2.WAV", + "DEMECH.X", + "DEMECHBK.PPM", + "DEMECHBT.PPM", + "DEMECHCH.PPM", + "DEMECHGR.PPM", + "DEMECHH1.PPM", + "DEMECHH2.PPM", + "DEMECHHD.PPM", + "DEMECHHN.PPM", + "DEMECHLA.PPM", + "DEMECHLL.PPM", + "DEMECHUA.PPM", + "DEMECHUL.PPM", + "GDK_FILL.PPM", + "HEAD.WAV", + "INTRO.WAV", + "PUNCH.WAV", + "PUNCH1.WAV", + "PUNCH2.WAV", + "PUNCH3.WAV", + "PUNCH4.WAV", + "REVDN1.WAV", + "REVDN2.WAV", + "REVDN3.WAV", + "REVUP1.WAV", + "REVUP2.WAV", + "REVUP3.WAV", + "RANDOM1.WAV", + "RANDOM2.WAV", + "RANDOM3.WAV", + "RANDOM4.WAV", + "RANDOM5.WAV", + "RANDOM6.WAV", + "ROCKEM3D.BIN", + "ROCKEM3D.MID", + "ROCKEM3D.PAL", + "SKMECH.X", + "SKMECHBK.PPM", + "SKMECHBT.PPM", + "SKMECHCH.PPM", + "SKMECHGR.PPM", + "SKMECHHN.PPM", + "SKMECHJD.PPM", + "SKMECHLA.PPM", + "SKMECHLL.PPM", + "SKMECHUA.PPM", + "SKMECHUL.PPM", + "SPLASH.PAL", + "WALK0.WAV", + "WALK1.WAV", + "WHOOSH1.WAV", + "WHOOSH2.WAV", +}; + +static char szTitle[BUFFER_SIZE]; + +/* + * prototypes + */ +BOOL FAR PASCAL masterDlgProc( HWND hdlg,DWORD message,DWORD wparam,DWORD lparam ); + +/* + * globals + */ +static HANDLE hinst; +static char GameDirectory[MAX_PATH]; // where the user wants the game +static char SetupDirectory[MAX_PATH]; // where the user ran setup from + +/* + * support functions + */ +void catpath(char *dst, char *src) +{ + int len = lstrlen(dst); + if (len > 0 && (dst[len-1] != '\\' && dst[len-1] != '/')) + lstrcat(dst,"\\"); + lstrcat(dst,src); + + // SHFileOperation needs a double null string. + len = lstrlen(dst); + dst[len+1] = 0; +} + +/* + * set a bitmap into a static control + */ +void SetBitmap(HWND hDlg, int id, char *szBitmap, int w, int h) +{ + HBITMAP hbm; + HWND hwnd; + + hwnd = GetDlgItem(hDlg, id); + + if (hwnd == NULL) + return; + + hbm = (HBITMAP)LoadImage(hinst, szBitmap, IMAGE_BITMAP, w, h, + LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS | LR_CREATEDIBSECTION); + + if (hbm) + hbm = (HBITMAP)SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbm); + + if (hbm) + DeleteObject(hbm); +} + +void SetInfoText(HWND hDlg, char *sz, ...) +{ + char ach[128]; + wvsprintf(ach, sz, (void*)(&sz+1)); + SetDlgItemText(hDlg, IDC_INFO, ach); +} + +void _SHFree(void *p) +{ + IMalloc *pm; + SHGetMalloc(&pm); + if (pm) + { + pm->lpVtbl->Free(pm,p); + pm->lpVtbl->Release(pm); + } +} + +/* + * build a shortcut in the start menu + */ +void MakeShortcut() +{ + char buf[512]; + char szSetupIni[MAX_PATH]; + char szExeFile[MAX_PATH]; + int len; + int fh; + char szGroupName[BUFFER_SIZE]; + char szLinkName[BUFFER_SIZE]; + + static char setup_ini[] = + "[progman.groups]\r\n" + "groupX=%s\r\n" + "[groupX]\r\n" + "\"%s\",\"%s\",,,,\"%s\"\r\n"; + + GetWindowsDirectory(szSetupIni, sizeof(szSetupIni)); + catpath(szSetupIni, "SETUP.INI"); + + lstrcpy(buf, GameDirectory); + catpath(buf, copy_list[0]); + GetShortPathName(buf, szExeFile, sizeof(szExeFile)); + +// lstrcpy(buf, GameDirectory); +// GetShortPathName(buf, szWork, sizeof(szWork)); + + LoadStrFromRes( IDS_GROUP_NAME, szGroupName ); + LoadStrFromRes( IDS_LINK_NAME, szLinkName ); + len = wsprintf(buf, setup_ini, szGroupName, szLinkName, + szExeFile, GameDirectory); + + fh = _lcreat(szSetupIni, 0); + + if (fh != -1) + { + _lwrite(fh, buf, len); + _lclose(fh); + WinExec("grpconv -o", SW_HIDE); + } +} + +/* + * dlg proc for wizard dialog box, the setup is controlled from here. + */ +BOOL FAR PASCAL masterDlgProc(HWND hDlg,DWORD dwMessage,DWORD wParam,DWORD lParam) +{ + int result; + static int system_restart; + static int current_dialog; + static int busy; + + char src[MAX_PATH]; + char dst[MAX_PATH]; + SHFILEOPSTRUCT fileop; + + char szBuffer[BUFFER_SIZE]; + + switch(dwMessage) + { + case WM_INITDIALOG: + busy = 0; + current_dialog = 0; + + LoadStrFromRes( IDS_TITLE, szTitle ); + SetWindowText( hDlg, szTitle ); + EnableWindow( GetDlgItem(hDlg, IDC_B), FALSE ); + EnableWindow( GetDlgItem(hDlg, IDC_H), FALSE ); + + /* + * set the signon bitmap into our static control + */ + LoadStrFromRes( IDS_SIGNON_BITMAP_NAME, szBuffer ); + SetBitmap( hDlg, IDC_STATIC, szBuffer, 175, 195 ); + + /* + * limit the size of the input of this text field to the length of a path + * put the default directory to install the game into in it + * select the whole thing to make it easy for people to replace it + * set the focus to it + */ + SendDlgItemMessage( hDlg, IDC_EDIT, EM_LIMITTEXT, MAX_PATH, 0L); + LoadStrFromRes( IDS_DEFAULT_GAME_DIR, szBuffer ); + SetDlgItemText( hDlg, IDC_EDIT, szBuffer ); + SendDlgItemMessage( hDlg, IDC_EDIT, EM_SETSEL, 0, MAKELONG(256, 256) ); + SetFocus( GetDlgItem(hDlg, IDC_EDIT) ); + /* + * return 0 here indicating we have set the focus for the dialog box + * and it doesn't need to help us + */ + return 0; + + case WM_SETCURSOR: + if (busy) + { + SetCursor(LoadCursor(NULL, IDC_WAIT)); + return TRUE; + } + break; + + case WM_COMMAND: + switch(wParam) + { + case IDOK: + if( busy > 0 ) + { + /* + * busy bit keeps us from taking input while we are off doing + * things that can create other dialog boxes and end up causing + * us to be reentered. + */ + break; + } + else if( current_dialog == 0 ) + { + int i; + + busy++; + EnableWindow(GetDlgItem(hDlg,IDOK), FALSE); + EnableWindow(GetDlgItem(hDlg,IDCANCEL), FALSE); + SetCursor(LoadCursor(NULL, IDC_WAIT)); + + /* + * get the directory the user typed + */ + GetWindowText( GetDlgItem( hDlg,IDC_EDIT ), GameDirectory, sizeof(GameDirectory)); + + /* + * verify that the typed in directory is valid + * by having the SHELL copy WIN.INI to this directory + * it will also create the directory for us. + */ + LoadStrFromRes( IDS_CREATE_MSG, szBuffer ); + SetInfoText(hDlg, szBuffer); + + GetWindowsDirectory(src, sizeof(src)); + catpath(src,"WIN.INI"); + + lstrcpy(dst,GameDirectory); + catpath(dst,"SMAG.INI"); + + fileop.hwnd = hDlg; + fileop.wFunc = FO_COPY; + fileop.pFrom = src; + fileop.pTo = dst; + fileop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION; + + if (SHFileOperation(&fileop) != 0) + { + // failed, the shell gave the user a error. + SetInfoText(hDlg, ""); + EnableWindow(GetDlgItem(hDlg,IDOK), TRUE); + EnableWindow(GetDlgItem(hDlg,IDCANCEL), TRUE); + busy--; + break; + } + + /* + * the directory is valid now delete the bogus file + */ + fileop.hwnd = hDlg; + fileop.wFunc = FO_DELETE; + fileop.pFrom = dst; + fileop.pTo = NULL; + fileop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION; + + SHFileOperation(&fileop); + SetInfoText(hDlg, ""); + + /* + * check if there is enough space to install the game + * NOTE: there is always enough space at the moment :-) + */ + LoadStrFromRes( IDS_DISK_MSG, szBuffer ); + SetInfoText(hDlg, szBuffer); + if( 0 ) + { + /* your code goes here */ + } + SetInfoText(hDlg, ""); + + /* + * now setup DirectX + */ + LoadStrFromRes( IDS_INSTALL_MSG, szBuffer ); + SetInfoText(hDlg, szBuffer); + + result = DirectXSetup( hDlg, NULL, DSETUP_DIRECTX ); + + SetInfoText(hDlg, ""); + + if( result < 0 ) + { + if (result == DSETUPERR_NOTPREINSTALLEDONNT) + { + // + // DirectX comes preinstalled on NT, and can only + // be installed in an NT release or Service Pack. + // If this error code is returned, then the required + // version of DirectX is not preinstalled on this + // NT machine. The user will have to go get + // the NT version or Service Pack required, or this + // game will not run. Note that any application + // can redistribute an NT Service Pack as long as + // it is distributed in its entirety. Check out + // ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes + // + LoadStrFromRes( IDS_NTFAILED_MSG, szBuffer ); + MessageBox( hDlg, szBuffer, szTitle, 0 ); + } + else + { + LoadStrFromRes( IDS_FAILED_MSG, szBuffer ); + MessageBox( hDlg, szBuffer, szTitle, 0 ); + } + EndDialog(hDlg, result); + break; + } + + /* + * check if there is enough space to install the game + * NOTE: there is always enough space at the moment :-) + */ + LoadStrFromRes( IDS_DISK_MSG, szBuffer ); + SetInfoText(hDlg, szBuffer); + if( 0 ) + { + /* your code goes here */ + } + SetInfoText(hDlg, ""); + + /* + * now copy the files. + */ + system_restart = result; + + LoadStrFromRes( IDS_COPYING_MSG, szBuffer ); + SetInfoText(hDlg, szBuffer); + for( i = 0; i < sizeof( copy_list )/sizeof( copy_list[0] ); i++ ) + { + lstrcpy( src, SetupDirectory ); + catpath( src, copy_list[i] ); + + lstrcpy( dst, GameDirectory ); + catpath( dst, copy_list[i] ); + + LoadStrFromRes( IDS_CURRENT_FILE_MSG, szBuffer ); + SetInfoText(hDlg, szBuffer, copy_list[i]); + + fileop.hwnd = hDlg; + fileop.wFunc = FO_COPY; + fileop.pFrom = src; + fileop.pTo = dst; + fileop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION; + + while (result = SHFileOperation(&fileop)) + { + char errorText[MAX_PATH+BUFFER_SIZE]; + + LoadStrFromRes( IDS_SETUP_FAILURE_MSG, szBuffer ); + wsprintf(errorText, szBuffer, copy_list[i] ); + result = MessageBox( hDlg, errorText, szTitle, MB_RETRYCANCEL ); + + if( result == IDCANCEL ) + { + result = -1; + break; + } + } + + if( result == 0 ) + { + SetFileAttributes( dst, FILE_ATTRIBUTE_NORMAL ); + } + } + SetInfoText(hDlg, ""); + + LoadStrFromRes( IDS_STARTUP_MSG, szBuffer ); + SetInfoText(hDlg, szBuffer); + MakeShortcut(); + SetInfoText(hDlg, ""); + + if( result >= 0 ) + { + /* + * hide current controls + */ + ShowWindow( GetDlgItem(hDlg, IDC_EDIT), SW_HIDE ); + ShowWindow( GetDlgItem(hDlg, IDC_DIRECTIONS1), SW_HIDE ); + ShowWindow( GetDlgItem(hDlg, IDC_DIRECTIONS2), SW_HIDE ); + ShowWindow( GetDlgItem(hDlg, IDC_EDITTEXT), SW_HIDE ); + ShowWindow( GetDlgItem(hDlg, IDC_INFO), SW_HIDE ); + ShowWindow( GetDlgItem(hDlg, IDC_BROWSE), SW_HIDE ); + + if( system_restart ) + { + /* + * show new dialogs + */ + ShowWindow( GetDlgItem(hDlg, IDC_REBOOT1), SW_SHOW ); + ShowWindow( GetDlgItem(hDlg, IDC_REBOOT2), SW_SHOW ); + LoadStrFromRes( IDS_REBOOT_BUTTON, szBuffer ); + SetWindowText( GetDlgItem(hDlg, IDOK), szBuffer ); + + /* + * set the reboot bitmap into our static control + */ + LoadStrFromRes( IDS_REBOOT_BITMAP_NAME, szBuffer ); + SetBitmap(hDlg, IDC_STATIC, szBuffer, 270, 195); + current_dialog++; + } + else + { + ShowWindow( GetDlgItem(hDlg, IDC_SUCCESS), SW_SHOW ); + LoadStrFromRes( IDS_FINISH_BUTTON, szBuffer ); + SetWindowText( GetDlgItem(hDlg, IDOK), szBuffer ); + current_dialog++; + EnableWindow(GetDlgItem(hDlg,IDOK), TRUE); + busy--; + break; + } + } + + EnableWindow(GetDlgItem(hDlg,IDOK), TRUE); + EnableWindow(GetDlgItem(hDlg,IDCANCEL), TRUE); + busy--; + + if( result < 0 ) + { + EndDialog( hDlg, result ); + } + } + else if (current_dialog == 1) + { + /* + * restart windows, kill apps that aren't responding, reboot + */ + if( system_restart ) + { + ExitWindowsEx( EWX_REBOOT, 0 ); + } + else + { + EndDialog( hDlg, 0 ); + } + } + break; + + case IDCANCEL: + if( !busy ) + { + /* + * only allow cancel if we aren't doing anything else + */ + EndDialog( hDlg, -1 ); + } + break; + + case IDC_BROWSE: + if( current_dialog == 0 ) + { + BROWSEINFO bi; + LPITEMIDLIST pidl; + char ach[MAX_PATH]; + + bi.hwndOwner = hDlg; + bi.pidlRoot = NULL; + bi.pszDisplayName = ach; + bi.lpszTitle = NULL; + bi.ulFlags = BIF_RETURNONLYFSDIRS; + bi.lpfn = NULL; + bi.lParam = 0; + bi.iImage = 0; + + pidl = SHBrowseForFolder(&bi); + + if (pidl) + { + SHGetPathFromIDList(pidl, ach); + SetDlgItemText(hDlg, IDC_EDIT, ach); + _SHFree(pidl); + } + } + break; + } + } + return 0; +} + +/* **************************************************************** */ +int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdShow) +{ + TCHAR * p; + TCHAR * x; + hinst = hInstance; + + /* + * get our fullpath name and strip the file name + */ + GetModuleFileName(hInstance, SetupDirectory, sizeof(SetupDirectory)); + + for (x=p=SetupDirectory; *p; p=AnsiNext(p)) + { + if (*p == '\\' || *p == '/') + x = p; + } + *x = 0; + + /* + * do the setup thing, it is all one big dialog box that you show + * and hide things from depending on the screen + * we just sign on, ask where to install, and install + */ + DialogBox( hInstance, "DLG_MASTER", NULL, (DLGPROC)masterDlgProc ); + + return 0; +} /* WinMain */ diff --git a/sdk/samples/setup/dinstall.def b/sdk/samples/setup/dinstall.def new file mode 100644 index 0000000..da9102d --- /dev/null +++ b/sdk/samples/setup/dinstall.def @@ -0,0 +1,12 @@ +NAME DINSTALL + +DESCRIPTION 'Windows 95 DirectX(tm) Setup' + +CODE LOADONCALL DISCARDABLE +DATA PRELOAD SINGLE FIXED + +HEAPSIZE 1024 +STACKSIZE 8192 + +EXPORTS + diff --git a/sdk/samples/setup/dinstall.h b/sdk/samples/setup/dinstall.h new file mode 100644 index 0000000..247247d --- /dev/null +++ b/sdk/samples/setup/dinstall.h @@ -0,0 +1,45 @@ +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: dinstall.h + * Content: Game SDK sample setup program + ***************************************************************************/ + + +#ifndef __DINSTALL_H__ +#define __DINSTALL_H__ + +#define IDC_EDIT 1000 +#define IDC_EDITTEXT 1001 +#define IDC_STATIC 1002 +#define IDC_REBOOT1 1003 +#define IDC_REBOOT2 1004 +#define IDC_DIRECTIONS1 1005 +#define IDC_DIRECTIONS2 1006 +#define IDC_H 1007 +#define IDC_B 1008 +#define IDC_INFO 1009 +#define IDC_SUCCESS 1010 +#define IDC_BROWSE 1011 + +/* angusm */ +#define IDS_DEFAULT_GAME_DIR 100 +#define IDS_TITLE 101 +#define IDS_GROUP_NAME 102 +#define IDS_LINK_NAME 103 + +#define IDS_FINISH_BUTTON 116 +#define IDS_REBOOT_BUTTON 117 +#define IDS_SIGNON_BITMAP_NAME 118 +#define IDS_REBOOT_BITMAP_NAME 119 +#define IDS_CREATE_MSG 120 +#define IDS_DISK_MSG 121 +#define IDS_INSTALL_MSG 122 +#define IDS_FAILED_MSG 123 +#define IDS_COPYING_MSG 124 +#define IDS_CURRENT_FILE_MSG 125 +#define IDS_SETUP_FAILURE_MSG 126 +#define IDS_STARTUP_MSG 127 +#define IDS_NTFAILED_MSG 128 +#endif diff --git a/sdk/samples/setup/dinstall.rc b/sdk/samples/setup/dinstall.rc new file mode 100644 index 0000000..dd2e057 --- /dev/null +++ b/sdk/samples/setup/dinstall.rc @@ -0,0 +1,102 @@ +/*========================================================================== + * + * Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. + * + * File: dinstall.h + * Content: Game SDK sample setup program + ***************************************************************************/ + +#include "windows.h" +#include "dinstall.h" + +SETUP_ICON ICON DISCARDABLE "..\\setup.ico" +reboot BITMAP MOVEABLE PURE "..\\reboot.bmp" +signon BITMAP MOVEABLE PURE "..\\signon.bmp" + +DLG_MASTER DIALOG DISCARDABLE 5,50,405,150 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Microsoft Windows 95 Game SDK" +FONT 8, "Helv" +BEGIN + CONTROL "",IDC_STATIC,"Static",SS_BITMAP,15,4,120,120 + CONTROL "",-1,"Static",SS_BLACKFRAME,15,125,370,1 + PUSHBUTTON "Next >",IDOK,270,130,50,14,WS_GROUP | WS_VISIBLE + PUSHBUTTON "Cancel",IDCANCEL,335,130,50,14,WS_VISIBLE + PUSHBUTTON "&Help",IDC_H,155,130,50,14,WS_VISIBLE + PUSHBUTTON "< &Back",IDC_B,220,130,50,14,WS_VISIBLE + + ; TELL USER WHAT WE ARE DOING AND ASK FOR GAME PATH + LTEXT "Setup will install Microsoft DirectX(tm) and 'Rockem 3D.'", + IDC_DIRECTIONS1,155,6,203,15,WS_VISIBLE + LTEXT "You may enter the directory that you would like 'Rockem 3D' installed in.", + IDC_DIRECTIONS2,155,31,203,15,WS_VISIBLE + LTEXT "Game Directory:",IDC_EDITTEXT,155,56,55,8,WS_VISIBLE + EDITTEXT IDC_EDIT,215,55,130,12,ES_AUTOHSCROLL | + ES_OEMCONVERT | WS_VISIBLE + + PUSHBUTTON "Browse...",IDC_BROWSE,350,54,40,14,WS_VISIBLE + + LTEXT "",IDC_INFO,155,80,200,16,WS_VISIBLE + + ; ASK PERMISSION TO REBOOT + LTEXT "In order to complete the installation of the game it will be necessary to restart your system. Press the Reboot button to restart Windows 95 now.", + IDC_REBOOT1,195, 6,175,38,NOT WS_VISIBLE + LTEXT "If you do not restart Windows 95 now, the drivers required to make DirectX(tm) work will not be available until the next restart.", + IDC_REBOOT2,195,40,175,30,NOT WS_VISIBLE + + ; SETUP WAS SUCCESSFULL + LTEXT "Setup has completed successfuly.", + IDC_SUCCESS,195, 6,175,38,NOT WS_VISIBLE + +END + +/* angusm */ +STRINGTABLE MOVEABLE DISCARDABLE +LANGUAGE LANG_ENGLISH,SUBLANG_NEUTRAL +BEGIN + IDS_DEFAULT_GAME_DIR, "C:\\DirectX Games\\Rockem" + IDS_TITLE, "Rockem 3D Setup" + IDS_GROUP_NAME, "DirectX Games" + IDS_LINK_NAME, "Rockem" + IDS_FINISH_BUTTON, "&Finish" + IDS_REBOOT_BUTTON, "&Reboot" + IDS_SIGNON_BITMAP_NAME, "signon" + IDS_REBOOT_BITMAP_NAME, "reboot" + IDS_CREATE_MSG, "Creating directory.." + IDS_DISK_MSG, "Checking disk space." + IDS_INSTALL_MSG, "Installing DirectX." + IDS_FAILED_MSG, "DirectX failed to install. The game was not installed." + IDS_NTFAILED_MSG, "Install failed. The DirectX version which is preinstalled with your copy of Windows NT is lower than the version required by this game. To get updated DirectX Windows NT components, check out: ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes" + IDS_COPYING_MSG, "Copying files." + IDS_CURRENT_FILE_MSG, "Copying %s" + IDS_SETUP_FAILURE_MSG, "Setup Failure: %s could not be copied." + IDS_STARTUP_MSG, "Creating StartMenu shortcut" +END + +STRINGTABLE MOVEABLE DISCARDABLE +LANGUAGE LANG_JAPANESE,SUBLANG_NEUTRAL +BEGIN + IDS_DEFAULT_GAME_DIR, "C:\\DirectX Games\\Rockem" + IDS_TITLE, "Rockem 3D Setup" + IDS_GROUP_NAME, "DirectX Games" + IDS_LINK_NAME, "Rockem" + IDS_FINISH_BUTTON, "&Finish" + IDS_REBOOT_BUTTON, "&Reboot" + IDS_SIGNON_BITMAP_NAME, "signon" + IDS_REBOOT_BITMAP_NAME, "reboot" + IDS_CREATE_MSG, "Creating directory.." + IDS_DISK_MSG, "Checking disk space." + IDS_INSTALL_MSG, "Installing DirectX." + IDS_FAILED_MSG, "DirectX failed to install. The game was not installed." + IDS_NTFAILED_MSG, "Install failed. The DirectX version which is preinstalled with your copy of Windows NT is lower than the version required by this game. To get updated DirectX Windows NT components, check out: ftp://ftp.microsoft.com/bussys/winnt/winnt-public/fixes" + IDS_COPYING_MSG, "Copying files." + IDS_CURRENT_FILE_MSG, "Copying %s" + IDS_SETUP_FAILURE_MSG, "Setup Failure: %s could not be copied." + IDS_STARTUP_MSG, "Creating StartMenu shortcut" +END + + + + + + diff --git a/sdk/samples/setup/makefile b/sdk/samples/setup/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/setup/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/setup/msvc.mk b/sdk/samples/setup/msvc.mk new file mode 100644 index 0000000..4877007 --- /dev/null +++ b/sdk/samples/setup/msvc.mk @@ -0,0 +1,42 @@ +NAME = dinstall +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib shell32.lib \ + comdlg32.lib gdi32.lib winmm.lib dsetup.lib libc.lib + +OBJS = dinstall.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/setup/readme.txt b/sdk/samples/setup/readme.txt new file mode 100644 index 0000000..6ebdf45 --- /dev/null +++ b/sdk/samples/setup/readme.txt @@ -0,0 +1,9 @@ +Setup + +This sample is an example of how to use DirectXSetup API's to install +DirectX subsystem and DirectX drivers. It also serves as a working template +for ISV's to install a game. + +Note that this program will not run until the redist directory (on the CD) +is copied into the same directory as setup.exe. The whole tree must be +copied in order to setup correctly. diff --git a/sdk/samples/setup/reboot.bmp b/sdk/samples/setup/reboot.bmp new file mode 100644 index 0000000..ca41886 Binary files /dev/null and b/sdk/samples/setup/reboot.bmp differ diff --git a/sdk/samples/setup/setup.ico b/sdk/samples/setup/setup.ico new file mode 100644 index 0000000..69c67aa Binary files /dev/null and b/sdk/samples/setup/setup.ico differ diff --git a/sdk/samples/setup/signon.bmp b/sdk/samples/setup/signon.bmp new file mode 100644 index 0000000..30dfc5c Binary files /dev/null and b/sdk/samples/setup/signon.bmp differ diff --git a/sdk/samples/shadow/makefile b/sdk/samples/shadow/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/shadow/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/shadow/msvc.mk b/sdk/samples/shadow/msvc.mk new file mode 100644 index 0000000..51f250e --- /dev/null +++ b/sdk/samples/shadow/msvc.mk @@ -0,0 +1,42 @@ +NAME = shadow +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = shadow.obj rmmain.obj rmerror.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT =-DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/shadow/readme.txt b/sdk/samples/shadow/readme.txt new file mode 100644 index 0000000..a45659c --- /dev/null +++ b/sdk/samples/shadow/readme.txt @@ -0,0 +1,5 @@ +Shadow +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Creating a shadow of a mesh object. diff --git a/sdk/samples/shadow/shadow.c b/sdk/samples/shadow/shadow.c new file mode 100644 index 0000000..4bb0427 --- /dev/null +++ b/sdk/samples/shadow/shadow.c @@ -0,0 +1,125 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: shadow.c + * + ***************************************************************************/ + +#include "rmdemo.h" + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + D3DRMRENDERQUALITY quality = D3DRMRENDER_FLAT; + LPDIRECT3DRMFRAME lights = NULL; + LPDIRECT3DRMMESHBUILDER teapot_builder = NULL; + LPDIRECT3DRMMESH teapot_mesh = NULL; + LPDIRECT3DRMVISUAL teapot_shadow = NULL; + LPDIRECT3DRMFRAME teapot = NULL; + LPDIRECT3DRMLIGHT shadow_light = NULL; + LPDIRECT3DRMLIGHT l2 = NULL; + HRESULT rval; + + view = view; /* not used */ + + if (FAILED(dev->lpVtbl->SetQuality(dev, quality))) + goto generic_error; + if (FAILED(scene->lpVtbl->SetSceneBackgroundRGB(scene, D3DVAL(1), D3DVAL(1), + D3DVAL(1)))) + goto generic_error; + + /* + * initialize the lights in the scene + */ + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &lights))) + goto generic_error; + if (FAILED(lights->lpVtbl->SetPosition(lights, scene, D3DVAL(2), D3DVAL(5), + -D3DVAL(10)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_POINT, D3DVAL(0.9), + D3DVAL(0.8), D3DVAL(0.7), &shadow_light))) + goto generic_error; + if (FAILED(lights->lpVtbl->AddLight(lights, shadow_light))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT, D3DVAL(0.1), + D3DVAL(0.1), D3DVAL(0.1), &l2))) + goto generic_error; + if (FAILED(scene->lpVtbl->AddLight(scene, l2))) + goto generic_error; + + /* + * load mesh file + */ + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &teapot_builder))) + goto generic_error; + rval = teapot_builder->lpVtbl->Load(teapot_builder, "teapot.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load teapot.x.\n"); + goto ret_with_error; + } + if (FAILED(teapot_builder->lpVtbl->CreateMesh(teapot_builder, &teapot_mesh))) + goto generic_error; + RELEASE(teapot_builder); + + /* + * create a teapot frame within the scene + */ + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &teapot))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateShadow(lpD3DRM, (LPDIRECT3DRMVISUAL) teapot_mesh, + shadow_light, D3DVAL(0), D3DVAL(-3), D3DVAL(0), D3DVAL(0), D3DVAL(1), + D3DVAL(0), &teapot_shadow))) + goto generic_error; + + /* + * add the loaded mesh into the frame + */ + if (FAILED(teapot->lpVtbl->AddVisual(teapot, (LPDIRECT3DRMVISUAL) teapot_mesh))) + goto generic_error; + if (FAILED(teapot->lpVtbl->AddVisual(teapot, teapot_shadow))) + goto generic_error; + + /* + * set up the frames position, orientation and rotation + */ + + if (FAILED(camera->lpVtbl->SetPosition(camera, scene, D3DVAL(0), D3DVAL(0), -D3DVAL(10)))) + goto generic_error; + if (FAILED(camera->lpVtbl->SetOrientation(camera, scene, D3DVAL(0), D3DVAL(0), D3DVAL(1), D3DVAL(0), + D3DVAL(1), D3DVAL(0)))) + goto generic_error; + if (FAILED(teapot->lpVtbl->SetRotation(teapot, scene, D3DVAL(0), D3DVAL(1), D3DVAL(1), + D3DVAL(0.02)))) + goto generic_error; + + RELEASE(lights); + RELEASE(teapot_mesh); + RELEASE(teapot_shadow); + RELEASE(teapot); + RELEASE(shadow_light); + RELEASE(l2); + return TRUE; +generic_error: + Msg("A failure occurred while building the scene.\n"); +ret_with_error: + RELEASE(lights); + RELEASE(teapot_builder); + RELEASE(teapot_mesh); + RELEASE(teapot_shadow); + RELEASE(teapot); + RELEASE(shadow_light); + RELEASE(l2); + return FALSE; +} + +void +OverrideDefaults(Defaults* defaults) +{ + defaults->bNoTextures = TRUE; + defaults->bConstRenderQuality = TRUE; + lstrcpy(defaults->Name, "Shadow Direct3DRM Example"); +} diff --git a/sdk/samples/shadow/shadow.def b/sdk/samples/shadow/shadow.def new file mode 100644 index 0000000..f81e343 --- /dev/null +++ b/sdk/samples/shadow/shadow.def @@ -0,0 +1,10 @@ +NAME shadow.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/sphere/makefile b/sdk/samples/sphere/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/sphere/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/sphere/msvc.mk b/sdk/samples/sphere/msvc.mk new file mode 100644 index 0000000..d3b2478 --- /dev/null +++ b/sdk/samples/sphere/msvc.mk @@ -0,0 +1,42 @@ +NAME = sphere +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = d3dapp.obj ddcalls.obj d3dcalls.obj texture.obj misc.obj lclib.obj d3dmain.obj stats.obj sphere.obj d3dmath.obj d3dsphr.obj + +!if "$(DEBUG)" == "debug" +COPT =-DDEBUG -DD3DDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DDEMO +!else +COPT =-Otyb1 -DD3DDEMO +LOPT =-debug:none +ROPT =-DD3DDEMO +!endif +DEF = $(NAME).def +RES = d3dmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/sphere/readme.txt b/sdk/samples/sphere/readme.txt new file mode 100644 index 0000000..1e25d63 --- /dev/null +++ b/sdk/samples/sphere/readme.txt @@ -0,0 +1,6 @@ +Sphere +Direct3D Immediate Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +A simple spinning sphere with one material. The spinning is done +through a matrix multiply within the execute buffer. diff --git a/sdk/samples/sphere/sphere.c b/sdk/samples/sphere/sphere.c new file mode 100644 index 0000000..ef640b5 --- /dev/null +++ b/sdk/samples/sphere/sphere.c @@ -0,0 +1,345 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: sphere.c + * + ***************************************************************************/ + +#include <math.h> +#include <malloc.h> +#include <d3d.h> +#include "d3ddemo.h" + +/* + * Globals to keep track of execute buffer + */ +static D3DEXECUTEDATA d3dExData; +static LPDIRECT3DEXECUTEBUFFER lpD3DExBuf; +static D3DEXECUTEBUFFERDESC debDesc; +/* + * Gobals for materials and lights + */ +LPDIRECT3DMATERIAL lpbmat; +LPDIRECT3DMATERIAL lpmat; +LPDIRECT3DLIGHT lpD3DLight; +/* + * Global projection, view, world and identity matricies + */ +D3DMATRIXHANDLE hProj; +D3DMATRIXHANDLE hView; +D3DMATRIXHANDLE hWorld; +D3DMATRIXHANDLE hDWorld; + +D3DMATRIX proj = { + D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(-1.0), D3DVAL(0.0) +}; +D3DMATRIX view = { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(7.0), D3DVAL(1.0) +}; +D3DMATRIX world= { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0) +}; +D3DMATRIX identity = { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0) +}; + +/* + * A structure which holds the object's data + */ +struct { + D3DMATERIALHANDLE hmat; /* material handle */ + D3DTEXTUREHANDLE hTex; /* texture map handles */ + LPD3DVERTEX lpV; /* object's vertices */ + LPD3DTRIANGLE lpTri; /* object's triangles */ + int num_vertices, num_faces; +} objData; + +#define PI 3.14159265359 +#define DS 0.08 /* amount to spin world each time */ + +void +OverrideDefaults(Defaults* defaults) +{ + lstrcpy(defaults->Name, "Sphere D3D Example"); +} + +/* + * Each frame, renders the scene and calls mod_buffer to modify the object + * for the next frame. + */ +BOOL +RenderScene(LPDIRECT3DDEVICE lpDev, LPDIRECT3DVIEWPORT lpView, + LPD3DRECT lpExtent) +{ + /* + * Execute the instruction buffer + */ + if (lpDev->lpVtbl->BeginScene(lpDev) != D3D_OK) + return FALSE; + if (lpDev->lpVtbl->Execute(lpDev, lpD3DExBuf, + lpView, D3DEXECUTE_UNCLIPPED) != D3D_OK) + return FALSE; + if (lpDev->lpVtbl->EndScene(lpDev) != D3D_OK) + return FALSE; + if (lpD3DExBuf->lpVtbl->GetExecuteData(lpD3DExBuf, &d3dExData)!= D3D_OK) + return FALSE; + *lpExtent = d3dExData.dsStatus.drExtent; + + return TRUE; +} + +BOOL +InitScene(void) +{ + /* + * Generate the sphere. + */ + if (!(GenerateSphere((float)2.2, 18, 20, (float)1.0, (float)1.0, + (float)1.0, &objData.lpV, &objData.lpTri, + &objData.num_vertices, &objData.num_faces))) + return FALSE; + return TRUE; +} + +void +ReleaseScene(void) +{ + if (objData.lpV) + free(objData.lpV); + if (objData.lpTri) + free(objData.lpTri); +} + +/* + * Release the memory allocated for the scene and all D3D objects created. + */ +void +ReleaseView(LPDIRECT3DVIEWPORT lpView) +{ + if (lpView) + lpView->lpVtbl->DeleteLight(lpView, lpD3DLight); + RELEASE(lpD3DLight); + RELEASE(lpD3DExBuf); + RELEASE(lpmat); + RELEASE(lpbmat); +} + +/* + * Builds the scene and initializes the execute buffer for rendering. Returns 0 on failure. + */ +BOOL +InitView(LPDIRECTDRAW lpDD, LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpDev, + LPDIRECT3DVIEWPORT lpView, int NumTextures, + LPD3DTEXTUREHANDLE TextureHandle) +{ + /* Pointers into the exectue buffer. */ + LPVOID lpBufStart, lpInsStart, lpPointer; + LPDIRECT3DEXECUTEBUFFER lpD3DExCmdBuf; + size_t size; + + /* Light and materials */ + D3DLIGHT light; + D3DMATERIAL bmat; + D3DMATERIALHANDLE hbmat; + D3DMATERIAL mat; + + D3DMATRIX dworld; + float ct, st; + + /* + * Set the view, world and projection matrices + */ + MAKE_MATRIX(lpDev, hView, view); + MAKE_MATRIX(lpDev, hProj, proj); + MAKE_MATRIX(lpDev, hWorld, world); + /* + * Create a buffer for matrix set commands etc. + */ + size = 0; + size += sizeof(D3DINSTRUCTION) * 3; + size += sizeof(D3DSTATE) * 4; + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + if (lpDev->lpVtbl->CreateExecuteBuffer(lpDev, &debDesc, &lpD3DExCmdBuf, + NULL) != D3D_OK) + return FALSE; + if (lpD3DExCmdBuf->lpVtbl->Lock(lpD3DExCmdBuf, &debDesc) != D3D_OK) + return FALSE; + lpBufStart = debDesc.lpData; + memset(lpBufStart, 0, size); + lpPointer = lpBufStart; + + lpInsStart = lpPointer; + OP_STATE_TRANSFORM(3, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_WORLD, hWorld, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_VIEW, hView, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_PROJECTION, hProj, lpPointer); + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_AMBIENT, RGBA_MAKE(10, 10, 10, 10), lpPointer); + OP_EXIT(lpPointer); + /* + * Setup the execute data describing the buffer + */ + lpD3DExCmdBuf->lpVtbl->Unlock(lpD3DExCmdBuf); + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwInstructionOffset = (ULONG) 0; + d3dExData.dwInstructionLength = (ULONG) ((char*)lpPointer - (char*)lpInsStart); + lpD3DExCmdBuf->lpVtbl->SetExecuteData(lpD3DExCmdBuf, &d3dExData); + lpDev->lpVtbl->BeginScene(lpDev); + lpDev->lpVtbl->Execute(lpDev, lpD3DExCmdBuf, lpView, D3DEXECUTE_UNCLIPPED); + lpDev->lpVtbl->EndScene(lpDev); + /* + * We are done with the command buffer. + */ + lpD3DExCmdBuf->lpVtbl->Release(lpD3DExCmdBuf); + /* + * Set background to black material + */ + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpbmat, NULL) != D3D_OK) + return FALSE; + memset(&bmat, 0, sizeof(D3DMATERIAL)); + bmat.dwSize = sizeof(D3DMATERIAL); + bmat.dwRampSize = 1; + lpbmat->lpVtbl->SetMaterial(lpbmat, &bmat); + lpbmat->lpVtbl->GetHandle(lpbmat, lpDev, &hbmat); + lpView->lpVtbl->SetBackground(lpView, hbmat); + /* + * Create a material, set its description and obtain a handle to it. + */ + objData.hTex = TextureHandle[1]; + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpmat, NULL) != D3D_OK) + return FALSE; + memset(&mat, 0, sizeof(D3DMATERIAL)); + mat.dwSize = sizeof(D3DMATERIAL); + mat.diffuse.r = (D3DVALUE)1.0; + mat.diffuse.g = (D3DVALUE)1.0; + mat.diffuse.b = (D3DVALUE)1.0; + mat.diffuse.a = (D3DVALUE)1.0; + mat.ambient.r = (D3DVALUE)0.0; + mat.ambient.g = (D3DVALUE)0.0; + mat.ambient.b = (D3DVALUE)1.0; + mat.specular.r = (D3DVALUE)1.0; + mat.specular.g = (D3DVALUE)1.0; + mat.specular.b = (D3DVALUE)1.0; + mat.power = (float)40.0; + mat.dwRampSize = 32; + mat.hTexture = objData.hTex; + lpmat->lpVtbl->SetMaterial(lpmat, &mat); + lpmat->lpVtbl->GetHandle(lpmat, lpDev, &objData.hmat); + /* + * Create the matrix which spins the sphere + */ + ct = D3DVAL(cos(DS)); + st = D3DVAL(sin(DS)); + dworld = identity; + dworld._11 = ct; + dworld._13 = -st; + dworld._31 = st; + dworld._33 = ct; + MAKE_MATRIX(lpDev, hDWorld, dworld); + /* + * Create the main execute buffer + */ + size = sizeof(D3DVERTEX) * objData.num_vertices; + size += sizeof(D3DPROCESSVERTICES) * 1; + size += sizeof(D3DSTATUS) * 1; + size += sizeof(D3DINSTRUCTION) * 8; + size += sizeof(D3DSTATE) * 5; + size += sizeof(D3DMATRIXMULTIPLY) * 1; + size += sizeof(D3DTRIANGLE) * objData.num_faces; + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + if (lpDev->lpVtbl->CreateExecuteBuffer(lpDev, &debDesc, &lpD3DExBuf, + NULL) != D3D_OK) + return FALSE; + /* + * lock it so it can be filled + */ + if (lpD3DExBuf->lpVtbl->Lock(lpD3DExBuf, &debDesc) != D3D_OK) + return FALSE; + lpBufStart = debDesc.lpData; + memset(lpBufStart, 0, size); + lpPointer = lpBufStart; + + VERTEX_DATA(objData.lpV, objData.num_vertices, lpPointer); + /* + * Save the location of the first instruction and add instructions to + * execute buffer. + */ + lpInsStart = lpPointer; + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_MATERIAL, objData.hmat, lpPointer); + OP_MATRIX_MULTIPLY(1, lpPointer); + MATRIX_MULTIPLY_DATA(hDWorld, hWorld, hWorld, lpPointer); + + OP_SET_STATUS(D3DSETSTATUS_ALL, D3DSTATUS_DEFAULT, 2048, 2048, 0, 0, lpPointer); + + OP_PROCESS_VERTICES(1, lpPointer); + PROCESSVERTICES_DATA(D3DPROCESSVERTICES_TRANSFORMLIGHT, 0, objData.num_vertices, lpPointer); + OP_STATE_RENDER(2, lpPointer); + STATE_DATA(D3DRENDERSTATE_TEXTUREHANDLE, objData.hTex, lpPointer); + STATE_DATA(D3DRENDERSTATE_WRAPU, TRUE, lpPointer); + /* + * Make sure that the triangle data (not OP) will be QWORD aligned + */ + if (QWORD_ALIGNED(lpPointer)) { + OP_NOP(lpPointer); + } + OP_TRIANGLE_LIST(objData.num_faces, lpPointer); + TRIANGLE_LIST_DATA(objData.lpTri, objData.num_faces, lpPointer); + OP_EXIT(lpPointer); + /* + * Setup the execute data describing the buffer + */ + lpD3DExBuf->lpVtbl->Unlock(lpD3DExBuf); + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwVertexCount = objData.num_vertices; + d3dExData.dwInstructionOffset = (ULONG)((char*)lpInsStart - (char*)lpBufStart); + d3dExData.dwInstructionLength = (ULONG)((char*)lpPointer - (char*)lpInsStart); + lpD3DExBuf->lpVtbl->SetExecuteData(lpD3DExBuf, &d3dExData); + /* + * Create the light + */ + memset(&light, 0, sizeof(D3DLIGHT)); + light.dwSize = sizeof(D3DLIGHT); + light.dltType = D3DLIGHT_DIRECTIONAL; + light.dcvColor.r = D3DVAL(0.9); + light.dcvColor.g = D3DVAL(0.9); + light.dcvColor.b = D3DVAL(0.9); + light.dcvColor.a = D3DVAL(1.0); + light.dvDirection.x = D3DVALP(0.0, 12); + light.dvDirection.y = D3DVALP(0.0, 12); + light.dvDirection.z = D3DVALP(1.0, 12); + light.dvAttenuation0 = (float)1.0; + light.dvAttenuation1 = (float)0.0; + light.dvAttenuation2 = (float)0.0; + if (lpD3D->lpVtbl->CreateLight(lpD3D, &lpD3DLight, NULL) != D3D_OK) + return FALSE; + if (lpD3DLight->lpVtbl->SetLight(lpD3DLight, &light) != D3D_OK) + return FALSE; + if (lpView->lpVtbl->AddLight(lpView, lpD3DLight) != D3D_OK) + return FALSE; + + return TRUE; +} + + diff --git a/sdk/samples/sphere/sphere.def b/sdk/samples/sphere/sphere.def new file mode 100644 index 0000000..1975472 --- /dev/null +++ b/sdk/samples/sphere/sphere.def @@ -0,0 +1,10 @@ +NAME sphere.exe + +DESCRIPTION 'Direct3D Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/stretch/donut.bmp b/sdk/samples/stretch/donut.bmp new file mode 100644 index 0000000..2b9595b Binary files /dev/null and b/sdk/samples/stretch/donut.bmp differ diff --git a/sdk/samples/stretch/makefile b/sdk/samples/stretch/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/stretch/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/stretch/makefile.wat b/sdk/samples/stretch/makefile.wat new file mode 100644 index 0000000..b705d4b --- /dev/null +++ b/sdk/samples/stretch/makefile.wat @@ -0,0 +1,2 @@ +MAKENAME=watcom.mk +!include ..\watbld.mk diff --git a/sdk/samples/stretch/msvc.mk b/sdk/samples/stretch/msvc.mk new file mode 100644 index 0000000..dfe6eff --- /dev/null +++ b/sdk/samples/stretch/msvc.mk @@ -0,0 +1,42 @@ +NAME = stretch +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = stretch.obj ddutil.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/stretch/readme.txt b/sdk/samples/stretch/readme.txt new file mode 100644 index 0000000..fd3c988 --- /dev/null +++ b/sdk/samples/stretch/readme.txt @@ -0,0 +1,17 @@ +This program demonstrated clipped blting and stretched clipped blting. It +is a non-exclusive mode application that displays a rotating donut in a +window. Clipped blting can be demonstrated by moving another window partially +or completely in front of the stretch window. The rotating donut does not +overwrite the clipping window. + +The size of the rotating donut can be changed with menu selections. Any +other size than 1x1 demonstrates stretch blting. The window can also be +resized by grabbing any one of the corners with the mouse. + +Another menu option can be used to change the rate of rotation of the donut. + +This is not an exclusive mode application and so it is incapable of setting +the display mode. Therefore, it must be executed on an 8 bit per pixel +display. It will not work correctly with other pixel depths. + + diff --git a/sdk/samples/stretch/resource.h b/sdk/samples/stretch/resource.h new file mode 100644 index 0000000..53f8e85 --- /dev/null +++ b/sdk/samples/stretch/resource.h @@ -0,0 +1,29 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by STRETCH.RC +// +#define IDR_MENU 1 +#define ID_FILE_EXIT 10001 +#define ID_ROTATION_STOP 40001 +#define ID_ROTATION_SLOW 40011 +#define ID_ROTATION_FAST 40012 +#define ID_SIZE_1X1 40002 +#define ID_SIZE_2X1 40003 +#define ID_SIZE_3X1 40004 +#define ID_SIZE_1X2 40005 +#define ID_SIZE_2X2 40006 +#define ID_SIZE_3X2 40007 +#define ID_SIZE_1X3 40008 +#define ID_SIZE_2X3 40009 +#define ID_SIZE_3X3 40010 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40011 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sdk/samples/stretch/stretch.cpp b/sdk/samples/stretch/stretch.cpp new file mode 100644 index 0000000..231587b --- /dev/null +++ b/sdk/samples/stretch/stretch.cpp @@ -0,0 +1,386 @@ +/*========================================================================== + * + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + * + * File: donut.cpp + * + ***************************************************************************/ + +#define NAME "Stretch" +#define TITLE "Stretch" + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <ddraw.h> +#include "resource.h" +#include "ddutil.h" + +#define SIZEX 64 +#define SIZEY 64 +char *szBitmap = "DONUT"; + +HWND hwnd; +DWORD UpdateDelay = 13; +HPALETTE HPal = NULL; + +LPDIRECTDRAW lpDD; // DirectDraw object +LPDIRECTDRAWSURFACE lpDDSPrimary; // DirectDraw primary surface +LPDIRECTDRAWSURFACE lpDDSOne; // Offscreen surface 1 +LPDIRECTDRAWCLIPPER lpClipper; // clipper for primary +LPDIRECTDRAWPALETTE lpDDPal; // DirectDraw palette +BOOL bActive; // is application active? + +/* + * restoreAll + * + * restore all lost objects + */ +BOOL restoreAll( void ) +{ + return lpDDSPrimary->Restore() == DD_OK && + lpDDSOne->Restore() == DD_OK && + DDReLoadBitmap(lpDDSOne, szBitmap) == DD_OK; + +} /* restoreAll */ + +/* + * updateFrame + * + * Decide what needs to be blitted next, wait for flip to complete, + * then flip the buffers. + */ +void updateFrame( void ) +{ + static DWORD lastTickCount = 0; + static int currentFrame = 0; + static BOOL haveBackground = FALSE; + DWORD thisTickCount; + RECT rcRect; + RECT destRect; + HRESULT ddrval; + POINT pt; + + thisTickCount = GetTickCount(); + if((thisTickCount - lastTickCount) <= UpdateDelay) + { + return; + } + + // Move to next frame; + lastTickCount = thisTickCount; + currentFrame++; + if(currentFrame > 59) + { + currentFrame = 0; + } + + // Blit the stuff for the next frame + rcRect.left = currentFrame%10*64; + rcRect.top = currentFrame/10*64; + rcRect.right = currentFrame%10*64 + 64; + rcRect.bottom = currentFrame/10*64 + 64; + + GetClientRect( hwnd, &destRect ); + if (destRect.right < 128) destRect.right = 64; + if (destRect.bottom < 64) destRect.bottom = 64; + + pt.x = pt.y = 0; + ClientToScreen( hwnd, &pt ); + OffsetRect(&destRect, pt.x, pt.y); + + while( 1 ) + { + ddrval = lpDDSPrimary->Blt( &destRect, lpDDSOne, &rcRect, 0, NULL ); + + if( ddrval == DD_OK ) + { + break; + } + if( ddrval == DDERR_SURFACELOST ) + { + if(!restoreAll()) + { + return; + } + } + if( ddrval != DDERR_WASSTILLDRAWING ) + { + return; + } + } + if(ddrval != DD_OK) + { + return; + } +} /* updateFrame */ + + +/* + * finiObjects + * + * finished with all objects we use; release them + */ +static void finiObjects( void ) +{ + if( lpDD != NULL ) + { + if( lpDDSPrimary != NULL ) + { + lpDDSPrimary->Release(); + lpDDSPrimary = NULL; + } + if( lpDDSOne != NULL ) + { + lpDDSOne->Release(); + lpDDSOne = NULL; + } + if( lpDDPal != NULL ) + { + lpDDPal->Release(); + lpDDPal = NULL; + } + lpDD->Release(); + lpDD = NULL; + } +} /* finiObjects */ + +long FAR PASCAL WindowProc( HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam ) +{ + RECT rc; + + switch( message ) + { + case WM_ACTIVATEAPP: + bActive = wParam; + break; + + case WM_PALETTECHANGED: + if ((HWND)wParam == hWnd) + break; + // fall through to WM_QUERYNEWPALETTE + case WM_QUERYNEWPALETTE: + // install our palette here + if (lpDDPal) + { + lpDDSPrimary->SetPalette(lpDDPal); + } + // reload the bitmap into the surface because the palette + // has changed.. + DDReLoadBitmap(lpDDSOne, szBitmap); + break; + + + case WM_CREATE: + break; + + case WM_GETMINMAXINFO: + ((MINMAXINFO*)lParam)->ptMinTrackSize.x = SIZEX; + ((MINMAXINFO*)lParam)->ptMinTrackSize.y = SIZEY; + return 0; + + case WM_KEYDOWN: + switch( wParam ) + { + case VK_ESCAPE: + case VK_F12: + PostMessage(hWnd, WM_CLOSE, 0, 0); + break; + } + break; + + case WM_DESTROY: + finiObjects(); + PostQuitMessage( 0 ); + break; + + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case ID_ROTATION_STOP: + UpdateDelay = 0x7fffffff; + break; + case ID_ROTATION_SLOW: + UpdateDelay = 200; + break; + case ID_ROTATION_FAST: + UpdateDelay = 13; + break; + case ID_FILE_EXIT: + PostMessage( hWnd, WM_CLOSE, 0, 0L ); + break; + + case ID_SIZE_1X1: SetRect(&rc, 0, 0, SIZEX*1, SIZEY*1); goto size_me; + case ID_SIZE_2X1: SetRect(&rc, 0, 0, SIZEX*2, SIZEY*1); goto size_me; + case ID_SIZE_3X1: SetRect(&rc, 0, 0, SIZEX*3, SIZEY*1); goto size_me; + case ID_SIZE_1X2: SetRect(&rc, 0, 0, SIZEX*1, SIZEY*2); goto size_me; + case ID_SIZE_2X2: SetRect(&rc, 0, 0, SIZEX*2, SIZEY*2); goto size_me; + case ID_SIZE_3X2: SetRect(&rc, 0, 0, SIZEX*3, SIZEY*2); goto size_me; + case ID_SIZE_1X3: SetRect(&rc, 0, 0, SIZEX*1, SIZEY*3); goto size_me; + case ID_SIZE_2X3: SetRect(&rc, 0, 0, SIZEX*2, SIZEY*3); goto size_me; + case ID_SIZE_3X3: SetRect(&rc, 0, 0, SIZEX*3, SIZEY*3); goto size_me; +size_me: + AdjustWindowRectEx(&rc, GetWindowLong(hWnd, GWL_STYLE), + GetMenu(hWnd) != NULL, GetWindowLong(hWnd, GWL_EXSTYLE)); + SetWindowPos(hWnd, NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, + SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE); + break; + } + break; + } + + return DefWindowProc(hWnd, message, wParam, lParam); + +} /* WindowProc */ + +/* + * This function is called if the initialization function fails + */ +BOOL initFail( HWND hwnd ) +{ + finiObjects(); + MessageBox( hwnd, "DirectDraw Init FAILED", TITLE, MB_OK ); + DestroyWindow( hwnd ); + return FALSE; + +} /* initFail */ + +/* + * doInit - do work required for every instance of the application: + * create the window, initialize data + */ +static BOOL doInit( HINSTANCE hInstance, int nCmdShow ) +{ + WNDCLASS wc; + DDSURFACEDESC ddsd; + HRESULT ddrval; + + /* + * 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, IDI_APPLICATION ); + wc.hCursor = LoadCursor( NULL, IDC_ARROW ); + wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU); + wc.lpszClassName = NAME; + RegisterClass( &wc ); + + /* + * create a window + */ + hwnd = CreateWindowEx( + 0, + NAME, + TITLE, + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, + CW_USEDEFAULT, + 128, + 128, + NULL, + NULL, + hInstance, + NULL ); + + if( !hwnd ) + { + return FALSE; + } + + PostMessage(hwnd, WM_COMMAND, ID_SIZE_1X1, 0); + + ShowWindow( hwnd, nCmdShow ); + UpdateWindow( hwnd ); + + /* + * create the main DirectDraw object + */ + ddrval = DirectDrawCreate( NULL, &lpDD, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + ddrval = lpDD->SetCooperativeLevel( hwnd, DDSCL_NORMAL ); + + // Create the primary surface + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // create a clipper for the primary surface + ddrval = lpDD->CreateClipper( 0, &lpClipper, NULL ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + ddrval = lpClipper->SetHWnd( 0, hwnd ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + ddrval = lpDDSPrimary->SetClipper( lpClipper ); + if( ddrval != DD_OK ) + { + return initFail(hwnd); + } + + // load our palette + lpDDPal = DDLoadPalette(lpDD, szBitmap); + + // make sure to set the palette before loading bitmaps. + if (lpDDPal) + lpDDSPrimary->SetPalette(lpDDPal); + + // load our bitmap + lpDDSOne = DDLoadBitmap(lpDD, szBitmap, 0, 0); + + if( lpDDSOne == NULL ) + { + return initFail(hwnd); + } + + return TRUE; +} /* doInit */ + +/* + * WinMain - initialization, message loop + */ +int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg; + + if( !doInit( hInstance, nCmdShow ) ) + { + return FALSE; + } + + while( 1 ) + { + if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + { + if( !GetMessage( &msg, NULL, 0, 0 ) ) + return msg.wParam; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else + { + updateFrame(); + } + } +} /* WinMain */ diff --git a/sdk/samples/stretch/stretch.def b/sdk/samples/stretch/stretch.def new file mode 100644 index 0000000..a95935a --- /dev/null +++ b/sdk/samples/stretch/stretch.def @@ -0,0 +1,10 @@ +NAME stretch.exe + +DESCRIPTION 'Stretch and clipped blt test (C) Microsoft 1995' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/stretch/stretch.rc b/sdk/samples/stretch/stretch.rc new file mode 100644 index 0000000..5d57fb8 --- /dev/null +++ b/sdk/samples/stretch/stretch.rc @@ -0,0 +1,82 @@ +//Microsoft Visual C++ generated resource script. +// + +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmaps +// +DONUT BITMAP DONUT.BMP + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MENU MENU DISCARDABLE +BEGIN +// POPUP "&File" +// BEGIN +// MENUITEM "E&xit", ID_FILE_EXIT +// END + POPUP "&Size" + BEGIN + MENUITEM "1x1", ID_SIZE_1X1 + MENUITEM "2x1", ID_SIZE_2X1 + MENUITEM "3x1", ID_SIZE_3X1 + MENUITEM "1x2", ID_SIZE_1X2 + MENUITEM "2x2", ID_SIZE_2X2 + MENUITEM "3x2", ID_SIZE_3X2 + MENUITEM "1x3", ID_SIZE_1X3 + MENUITEM "2x3", ID_SIZE_2X3 + MENUITEM "3x3", ID_SIZE_3X3 + END + POPUP "&Rotation" + BEGIN + MENUITEM "&Stop", ID_ROTATION_STOP + MENUITEM "Slo&w", ID_ROTATION_SLOW + MENUITEM "&Fast", ID_ROTATION_FAST + END +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resrc1.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +///////////////////////////////////////////////////////////////////////////// +#endif // APSTUDIO_INVOKED + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/sdk/samples/stretch/watcom.mk b/sdk/samples/stretch/watcom.mk new file mode 100644 index 0000000..3e4c552 --- /dev/null +++ b/sdk/samples/stretch/watcom.mk @@ -0,0 +1,33 @@ +NAME = stretch +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =..\..\..\lib\ddraw.lib + +OBJS = stretch.obj ddutil.obj + +SYS = nt_win + +!ifdef DEBUG +COPT =-DDEBUG -d2 +LOPT = debug all +ROPT =-DDEBUG +!else +COPT =-oaxt -d1 +LOPT = +ROPT = +!endif + +DEF = $(NAME).def +RES = $(NAME).res + +CFLAGS =$(COPT) -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +!include ..\..\watsdk.mk + +$(NAME).$(EXT): $(OBJS) $(NAME).lnk $(RES) + $(LINK) $(LFLAGS) @$(NAME).lnk + $(RC) $(RES) diff --git a/sdk/samples/tex1/makefile b/sdk/samples/tex1/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/tex1/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/tex1/msvc.mk b/sdk/samples/tex1/msvc.mk new file mode 100644 index 0000000..3491841 --- /dev/null +++ b/sdk/samples/tex1/msvc.mk @@ -0,0 +1,42 @@ +NAME = tex1 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = tex1.obj rmmain.obj rmerror.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT =-DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/tex1/readme.txt b/sdk/samples/tex1/readme.txt new file mode 100644 index 0000000..6698314 --- /dev/null +++ b/sdk/samples/tex1/readme.txt @@ -0,0 +1,5 @@ +Tex1 +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Loading a simple texture mapped mesh object. diff --git a/sdk/samples/tex1/tex1.c b/sdk/samples/tex1/tex1.c new file mode 100644 index 0000000..5fa5a9a --- /dev/null +++ b/sdk/samples/tex1/tex1.c @@ -0,0 +1,135 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: tex1.c + * + ***************************************************************************/ + +/* + * A texture mapping example using a cylindrical mapping. + */ + +#include "rmdemo.h" + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + LPDIRECT3DRMMESH mesh = NULL; + LPDIRECT3DRMMESHBUILDER builder = NULL; + LPDIRECT3DRMFRAME frame = NULL; + LPDIRECT3DRMTEXTURE tex = NULL; + LPDIRECT3DRMMATERIAL mat = NULL; + LPDIRECT3DRMWRAP wrap = NULL; + LPDIRECT3DRMLIGHT l1 = NULL; + LPDIRECT3DRMLIGHT l2 = NULL; + D3DRMBOX box; + D3DVALUE miny, maxy; + D3DVALUE height; + HRESULT rval; + + dev; + view; + camera; + + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT, D3DVAL(0.2), + D3DVAL(0.2), D3DVAL(0.2), &l1))) + goto generic_error; + if (FAILED(scene->lpVtbl->AddLight(scene, l1))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &frame))) + goto generic_error; + if (FAILED(frame->lpVtbl->SetOrientation(frame, scene, -D3DVAL(1), -D3DVAL(1), + D3DVAL(1), D3DVAL(0), D3DVAL(1), D3DVAL(0)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_DIRECTIONAL, D3DVAL(1), + D3DVAL(1), D3DVAL(1), &l2))) + goto generic_error; + if (FAILED(frame->lpVtbl->AddLight(frame, l2))) + goto generic_error; + RELEASE(frame); + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &frame))) + goto generic_error; + if (FAILED(frame->lpVtbl->SetPosition(frame, scene, D3DVAL(0), D3DVAL(0), D3DVAL(15)))) + goto generic_error; + if (FAILED(frame->lpVtbl->SetRotation(frame, scene, D3DVAL(1.1), D3DVAL(0.3), + D3DVAL(0.0), D3DVAL(0.04)))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &builder))) + goto generic_error; + rval = builder->lpVtbl->Load(builder, "sphere4.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load sphere4.x.\n%s", D3DRMErrorToString(rval)); + goto ret_with_error; + } + + rval = lpD3DRM->lpVtbl->LoadTexture(lpD3DRM, "tex7.ppm", &tex); + if (rval != D3DRM_OK) { + Msg("Failed to load tex7.ppm.\n%s", D3DRMErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(lpD3DRM->lpVtbl->CreateMaterial(lpD3DRM, D3DVAL(10.0), &mat))) + goto generic_error; + + if (FAILED(builder->lpVtbl->SetTexture(builder, tex))) + goto generic_error; + if (FAILED(builder->lpVtbl->SetMaterial(builder, mat))) + goto generic_error; + if (FAILED(builder->lpVtbl->SetColorRGB(builder, D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0)))) + goto generic_error; + + if (FAILED(builder->lpVtbl->CreateMesh(builder, &mesh))) + goto generic_error; + RELEASE(builder); + + if (FAILED(mesh->lpVtbl->GetBox(mesh, &box))) + goto generic_error; + maxy = box.max.y; + miny = box.min.y; + height = maxy - miny; + + if (FAILED(lpD3DRM->lpVtbl->CreateWrap(lpD3DRM, D3DRMWRAP_CYLINDER, NULL, D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DDivide(miny, height), D3DVAL(1.0), + D3DDivide(-D3DVAL(1.0), height), &wrap))) + goto generic_error; + + if (FAILED(wrap->lpVtbl->Apply(wrap, (LPDIRECT3DRMOBJECT)mesh))) + goto generic_error; + if (FAILED(frame->lpVtbl->AddVisual(frame, (LPDIRECT3DRMVISUAL) mesh))) + goto generic_error; + + RELEASE(frame); + RELEASE(wrap); + RELEASE(mesh); + RELEASE(tex); + RELEASE(mat); + RELEASE(l1); + RELEASE(l2); + return TRUE; +generic_error: + Msg("A failure occurred while building the scene.\n"); +ret_with_error: + RELEASE(mesh); + RELEASE(builder); + RELEASE(frame); + RELEASE(tex); + RELEASE(mat); + RELEASE(wrap); + RELEASE(l1); + RELEASE(l2); + return FALSE; +} + +void +OverrideDefaults(Defaults* defaults) +{ + defaults->bConstRenderQuality = TRUE; + lstrcpy(defaults->Name, "Texture Mapping Direct3DRM Example"); +} diff --git a/sdk/samples/tex1/tex1.def b/sdk/samples/tex1/tex1.def new file mode 100644 index 0000000..9e2cc85 --- /dev/null +++ b/sdk/samples/tex1/tex1.def @@ -0,0 +1,10 @@ +NAME tex1.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/tex3/makefile b/sdk/samples/tex3/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/tex3/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/tex3/msvc.mk b/sdk/samples/tex3/msvc.mk new file mode 100644 index 0000000..7d9583e --- /dev/null +++ b/sdk/samples/tex3/msvc.mk @@ -0,0 +1,42 @@ +NAME = tex3 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = tex3.obj rmmain.obj rmerror.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT = -DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/tex3/readme.txt b/sdk/samples/tex3/readme.txt new file mode 100644 index 0000000..db1d2e1 --- /dev/null +++ b/sdk/samples/tex3/readme.txt @@ -0,0 +1,5 @@ +Tex3 +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Using texture wraps for special effects. diff --git a/sdk/samples/tex3/tex3.c b/sdk/samples/tex3/tex3.c new file mode 100644 index 0000000..87091eb --- /dev/null +++ b/sdk/samples/tex3/tex3.c @@ -0,0 +1,192 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: tex3.c + * + ***************************************************************************/ + +/* + * A texture mapping example using a spherical mapping, relative to a + * frame. + */ + +#include "rmdemo.h" + +void CDECL +applyWrap(LPDIRECT3DRMFRAME frame, void* arg, D3DVALUE delta) +{ + LPDIRECT3DRMWRAP wrap = (LPDIRECT3DRMWRAP) arg; + LPDIRECT3DRMVISUALARRAY visuals; + LPDIRECT3DRMVISUAL v; + int count, i; + LPDIRECT3DRMMESH mesh; + + frame->lpVtbl->GetVisuals(frame, &visuals); + count = visuals->lpVtbl->GetSize(visuals); + + for (i = 0; i < count; i++) { + visuals->lpVtbl->GetElement(visuals, i, &v); + + if (SUCCEEDED(v->lpVtbl->QueryInterface(v, &IID_IDirect3DRMMesh, &mesh))) { + wrap->lpVtbl->ApplyRelative(wrap, frame, (LPDIRECT3DRMOBJECT)mesh); + mesh->lpVtbl->Release(mesh); + } + v->lpVtbl->Release(v); + } + + visuals->lpVtbl->Release(visuals); +} + +void CDECL +cleanupWrap(LPDIRECT3DRMOBJECT obj, void* arg) +{ + LPDIRECT3DRMWRAP wrap = (LPDIRECT3DRMWRAP) arg; + obj; + + wrap->lpVtbl->Release(wrap); +} + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + LPDIRECT3DRMMESH mesh = NULL; + LPDIRECT3DRMMESHBUILDER builder = NULL; + LPDIRECT3DRMFRAME frame = NULL; + LPDIRECT3DRMFRAME axis = NULL; + LPDIRECT3DRMFRAME child = NULL; + LPDIRECT3DRMTEXTURE tex = NULL; + LPDIRECT3DRMWRAP wrap = NULL; + LPDIRECT3DRMLIGHT l1 = NULL; + LPDIRECT3DRMLIGHT l2 = NULL; + HRESULT rval; + + dev; + view; + camera; + + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT, D3DVAL(0.2), + D3DVAL(0.2), D3DVAL(0.2), &l1))) + goto generic_error; + if (FAILED(scene->lpVtbl->AddLight(scene, l1))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &frame))) + goto generic_error; + if (FAILED(frame->lpVtbl->SetOrientation(frame, scene, -D3DVAL(1), -D3DVAL(1), + D3DVAL(1), D3DVAL(0), D3DVAL(1), D3DVAL(0)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_DIRECTIONAL, D3DVAL(1), + D3DVAL(1), D3DVAL(1), &l2))) + goto generic_error; + if (FAILED(frame->lpVtbl->AddLight(frame, l2))) + goto generic_error; + RELEASE(frame); + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &frame))) + goto generic_error; + if (FAILED(frame->lpVtbl->SetPosition(frame, scene, D3DVAL(0), D3DVAL(0), D3DVAL(15)))) + goto generic_error; + if (FAILED(frame->lpVtbl->SetRotation(frame, scene, D3DVAL(1.1), D3DVAL(0.3), + D3DVAL(0.0), D3DVAL(0.04)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &builder))) + goto generic_error; + rval = builder->lpVtbl->Load(builder, "sphere3.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load sphere3.x.\n%s", D3DRMErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(builder->lpVtbl->Scale(builder, D3DVAL(0.2), D3DVAL(0.2), D3DVAL(0.2)))) + goto generic_error; + if (FAILED(builder->lpVtbl->CreateMesh(builder, &mesh))) + goto generic_error; + RELEASE(builder); + if (FAILED(frame->lpVtbl->AddVisual(frame, (LPDIRECT3DRMVISUAL) mesh))) + goto generic_error; + RELEASE(mesh); + + if (FAILED(lpD3DRM->lpVtbl->CreateWrap(lpD3DRM, D3DRMWRAP_SPHERE, frame, + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), + D3DVAL(1.0), &wrap))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, frame, &axis))) + goto generic_error; + if (FAILED(axis->lpVtbl->SetRotation(axis, frame, D3DVAL(0), D3DVAL(1), D3DVAL(0), D3DVAL(0.04)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, axis, &child))) + goto generic_error; + if (FAILED(child->lpVtbl->SetPosition(child, axis, D3DVAL(3), D3DVAL(0), D3DVAL(0)))) + goto generic_error; + if (FAILED(child->lpVtbl->SetRotation(child, axis, D3DVAL(1), D3DVAL(1), D3DVAL(0), + D3DVAL(0.04)))) + goto generic_error; + + rval = lpD3DRM->lpVtbl->LoadTexture(lpD3DRM, "checker.ppm", &tex); + if (rval != D3DRM_OK) { + Msg("Failed to load checker.ppm.\n%s", D3DRMErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(tex->lpVtbl->SetColors(tex, 2))) + goto generic_error; + if (FAILED(tex->lpVtbl->SetDecalScale(tex, TRUE))) + goto generic_error; + if (FAILED(tex->lpVtbl->SetDecalOrigin(tex, 128, 128))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &builder))) + goto generic_error; + if (FAILED(builder->lpVtbl->Load(builder, "tpot2.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL))) + goto generic_error; + if (FAILED(builder->lpVtbl->Scale(builder, D3DVAL(2), D3DVAL(2), D3DVAL(2)))) + goto generic_error; + if (FAILED(builder->lpVtbl->SetTexture(builder, tex))) + goto generic_error; + if (FAILED(builder->lpVtbl->SetQuality(builder, D3DRMRENDER_GOURAUD))) + goto generic_error; + if (FAILED(builder->lpVtbl->CreateMesh(builder, &mesh))) + goto generic_error; + RELEASE(builder); + + if (FAILED(child->lpVtbl->AddVisual(child, (LPDIRECT3DRMVISUAL) mesh))) + goto generic_error; + if (FAILED(child->lpVtbl->AddMoveCallback(child, applyWrap, (void *) wrap))) + goto generic_error; + if (FAILED(child->lpVtbl->AddDestroyCallback(child, cleanupWrap, wrap))) + goto generic_error; + + RELEASE(mesh); + RELEASE(frame); + RELEASE(axis); + RELEASE(child); + RELEASE(tex); + RELEASE(l1); + RELEASE(l2); + return TRUE; +generic_error: + Msg("A failure occurred while building the scene.\n"); +ret_with_error: + RELEASE(mesh); + RELEASE(builder); + RELEASE(frame); + RELEASE(axis); + RELEASE(child); + RELEASE(tex); + RELEASE(wrap); + RELEASE(l1); + RELEASE(l2); + return FALSE; +} + +void +OverrideDefaults(Defaults *defaults) +{ + defaults->bConstRenderQuality = TRUE; + lstrcpy(defaults->Name, "Texture Mapping III Direct3DRM Example"); +} diff --git a/sdk/samples/tex3/tex3.def b/sdk/samples/tex3/tex3.def new file mode 100644 index 0000000..402e206 --- /dev/null +++ b/sdk/samples/tex3/tex3.def @@ -0,0 +1,10 @@ +NAME tex3.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/tex4/makefile b/sdk/samples/tex4/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/tex4/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/tex4/msvc.mk b/sdk/samples/tex4/msvc.mk new file mode 100644 index 0000000..79ccd15 --- /dev/null +++ b/sdk/samples/tex4/msvc.mk @@ -0,0 +1,42 @@ +NAME = tex4 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = tex4.obj rmmain.obj rmerror.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT =-DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/tex4/readme.txt b/sdk/samples/tex4/readme.txt new file mode 100644 index 0000000..1b22792 --- /dev/null +++ b/sdk/samples/tex4/readme.txt @@ -0,0 +1,5 @@ +Tex4 +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Another example of using texture wraps for special effects. diff --git a/sdk/samples/tex4/tex4.c b/sdk/samples/tex4/tex4.c new file mode 100644 index 0000000..aee7f0c --- /dev/null +++ b/sdk/samples/tex4/tex4.c @@ -0,0 +1,198 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: tex4.c + * + ***************************************************************************/ + +/* + * A texture mapping example using a spherical mapping relative to the + * camera. The texture is also used as a background for the scene. + */ + +#include "rmdemo.h" + +void CDECL +applyWrap(LPDIRECT3DRMFRAME frame, void* arg, D3DVALUE delta) +{ + LPDIRECT3DRMWRAP wrap = (LPDIRECT3DRMWRAP) arg; + LPDIRECT3DRMVISUALARRAY visuals; + LPDIRECT3DRMVISUAL v; + int count, i; + LPDIRECT3DRMMESH mesh; + + frame->lpVtbl->GetVisuals(frame, &visuals); + count = visuals->lpVtbl->GetSize(visuals); + + for (i = 0; i < count; i++) { + visuals->lpVtbl->GetElement(visuals, i, &v); + + if (SUCCEEDED(v->lpVtbl->QueryInterface(v, &IID_IDirect3DRMMesh, &mesh))) { + wrap->lpVtbl->ApplyRelative(wrap, frame, (LPDIRECT3DRMOBJECT)mesh); + mesh->lpVtbl->Release(mesh); + } + v->lpVtbl->Release(v); + } + + visuals->lpVtbl->Release(visuals); +} + +void CDECL +cleanupWrap(LPDIRECT3DRMOBJECT obj, void *arg) +{ + LPDIRECT3DRMWRAP wrap = (LPDIRECT3DRMWRAP) arg; + obj; + + wrap->lpVtbl->Release(wrap); +} + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + LPDIRECT3DRMMESH mesh = NULL; + LPDIRECT3DRMFRAME frame = NULL; + LPDIRECT3DRMFRAME axis = NULL; + LPDIRECT3DRMFRAME child = NULL; + LPDIRECT3DRMTEXTURE tex = NULL; + LPDIRECT3DRMWRAP wrap = NULL; + LPDIRECT3DRMLIGHT light1 = NULL; + LPDIRECT3DRMLIGHT light2 = NULL; + LPDIRECT3DRMMESHBUILDER builder = NULL; + HRESULT rval; + dev; + view; + camera; + + + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT, D3DVAL(0.2), + D3DVAL(0.2), D3DVAL(0.2), &light1))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_DIRECTIONAL, D3DVAL(1), + D3DVAL(1), D3DVAL(1), &light2))) + goto generic_error; + if (FAILED(scene->lpVtbl->AddLight(scene, light1))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &frame))) + goto generic_error; + if (FAILED(frame->lpVtbl->SetOrientation(frame, scene, -D3DVAL(1), -D3DVAL(1), + D3DVAL(1), D3DVAL(0), D3DVAL(1), D3DVAL(0)))) + goto generic_error; + if (FAILED(frame->lpVtbl->AddLight(frame, light2))) + goto generic_error; + RELEASE(frame); + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &frame))) + goto generic_error; + if (FAILED(frame->lpVtbl->SetPosition(frame, scene, D3DVAL(0), D3DVAL(0), D3DVAL(15)))) + goto generic_error; + if (FAILED(frame->lpVtbl->SetRotation(frame, scene, D3DVAL(1.1), D3DVAL(0.3), + D3DVAL(0.0), D3DVAL(0.04)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &builder))) + goto generic_error; + rval = builder->lpVtbl->Load(builder, "sphere3.x", NULL, D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load sphere3.x.\n"); + goto ret_with_error; + } + if (FAILED(builder->lpVtbl->Scale(builder, D3DVAL(0.2), D3DVAL(0.2), D3DVAL(0.2)))) + goto generic_error; + if (FAILED(builder->lpVtbl->CreateMesh(builder, &mesh))) + goto generic_error; + RELEASE(builder); + if (FAILED(frame->lpVtbl->AddVisual(frame, (LPDIRECT3DRMVISUAL) mesh))) + goto generic_error; + RELEASE(mesh); + + if (FAILED(lpD3DRM->lpVtbl->CreateWrap(lpD3DRM, D3DRMWRAP_SPHERE, camera, + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), -D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(5.0), D3DVAL(5.0), + &wrap))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, frame, &axis))) + goto generic_error; + if (FAILED(axis->lpVtbl->SetRotation(axis, frame, D3DVAL(0), D3DVAL(1), D3DVAL(0), D3DVAL(0.04)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, axis, &child))) + goto generic_error; + if (FAILED(child->lpVtbl->SetPosition(child, axis, D3DVAL(3), D3DVAL(0), D3DVAL(0)))) + goto generic_error; + if (FAILED(child->lpVtbl->SetRotation(child, axis, D3DVAL(1), D3DVAL(1), D3DVAL(0), + D3DVAL(0.04)))) + goto generic_error; + + rval = lpD3DRM->lpVtbl->LoadTexture(lpD3DRM, "lake.ppm", &tex); + if (rval != D3DRM_OK) { + Msg("Failed to load lake.ppm.\n"); + goto ret_with_error; + } + if (FAILED(tex->lpVtbl->SetColors(tex, 32))) + goto generic_error; + if (FAILED(tex->lpVtbl->SetDecalScale(tex, TRUE))) + goto generic_error; + if (FAILED(tex->lpVtbl->SetDecalOrigin(tex, 128, 128))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &builder))) + goto generic_error; + rval = builder->lpVtbl->Load(builder, "tpot2.x", NULL, D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load tpot2.x.\n"); + goto ret_with_error; + } + + if (FAILED(builder->lpVtbl->Scale(builder, D3DVAL(2), D3DVAL(2), D3DVAL(2)))) + goto generic_error; + if (FAILED(builder->lpVtbl->SetTexture(builder, tex))) + goto generic_error; + if (FAILED(builder->lpVtbl->SetQuality(builder, D3DRMRENDER_GOURAUD))) + goto generic_error; + if (FAILED(builder->lpVtbl->CreateMesh(builder, &mesh))) + goto generic_error; + RELEASE(builder); + + if (FAILED(child->lpVtbl->AddVisual(child, (LPDIRECT3DRMVISUAL) mesh))) + goto generic_error; + if (FAILED(child->lpVtbl->AddMoveCallback(child, applyWrap, (void *) wrap))) + goto generic_error; + if (FAILED(child->lpVtbl->AddDestroyCallback(child, cleanupWrap, wrap))) + goto generic_error; + if (FAILED(scene->lpVtbl->SetSceneBackgroundImage(scene, tex))) + goto generic_error; + + RELEASE(mesh); + RELEASE(frame); + RELEASE(axis); + RELEASE(child); + RELEASE(tex); + RELEASE(light1); + RELEASE(light2); + + /* don't release the wrap */ + return TRUE; +generic_error: + Msg("A failure occurred while building the scene.\n"); +ret_with_error: + RELEASE(mesh); + RELEASE(frame); + RELEASE(axis); + RELEASE(child); + RELEASE(tex); + RELEASE(wrap); + RELEASE(light1); + RELEASE(light2); + RELEASE(builder); + return FALSE; +} + +void +OverrideDefaults(Defaults* defaults) +{ + defaults->bConstRenderQuality = TRUE; + lstrcpy(defaults->Name, "Texture Mapping IV Direct3DRM Example"); +} diff --git a/sdk/samples/tex4/tex4.def b/sdk/samples/tex4/tex4.def new file mode 100644 index 0000000..8c03274 --- /dev/null +++ b/sdk/samples/tex4/tex4.def @@ -0,0 +1,10 @@ +NAME tex4.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/tex5/makefile b/sdk/samples/tex5/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/tex5/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/tex5/msvc.mk b/sdk/samples/tex5/msvc.mk new file mode 100644 index 0000000..a733249 --- /dev/null +++ b/sdk/samples/tex5/msvc.mk @@ -0,0 +1,42 @@ +NAME = tex5 +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = tex5.obj rmmain.obj rmerror.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT =-DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/tex5/readme.txt b/sdk/samples/tex5/readme.txt new file mode 100644 index 0000000..8834b72 --- /dev/null +++ b/sdk/samples/tex5/readme.txt @@ -0,0 +1,5 @@ +Tex5 +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Using a Wrap for Chrome mapping and a Texture map as decal. diff --git a/sdk/samples/tex5/tex5.c b/sdk/samples/tex5/tex5.c new file mode 100644 index 0000000..ba43129 --- /dev/null +++ b/sdk/samples/tex5/tex5.c @@ -0,0 +1,206 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: tex5.c + * + ***************************************************************************/ + +/* + * A texture mapping example showing the use of chrome mapping and decals. + */ + +#include "rmdemo.h" + +void CDECL +applyWrap(LPDIRECT3DRMFRAME frame, void* arg, D3DVALUE delta) +{ + LPDIRECT3DRMWRAP wrap = (LPDIRECT3DRMWRAP) arg; + LPDIRECT3DRMVISUALARRAY visuals; + LPDIRECT3DRMVISUAL v; + int count, i; + + frame->lpVtbl->GetVisuals(frame, &visuals); + if (visuals) { + count = visuals->lpVtbl->GetSize(visuals); + + for (i = 0; i < count; i++) { + visuals->lpVtbl->GetElement(visuals, i, &v); + wrap->lpVtbl->ApplyRelative(wrap, frame, (LPDIRECT3DRMOBJECT) v); + v->lpVtbl->Release(v); + } + + visuals->lpVtbl->Release(visuals); + } +} + +void CDECL +toggleDecalScale(LPDIRECT3DRMFRAME frame, void* arg, D3DVALUE delta) +{ + LPDIRECT3DRMTEXTURE decal = (LPDIRECT3DRMTEXTURE) arg; + static int i = 0; + + i++; + if (i == 20) { + int scale; + + i = 0; + + scale = decal->lpVtbl->GetDecalScale(decal); + decal->lpVtbl->SetDecalScale(decal, !scale); + } +} + +void CDECL +cleanupWrap(LPDIRECT3DRMOBJECT obj, void* arg) +{ + LPDIRECT3DRMWRAP wrap = (LPDIRECT3DRMWRAP) arg; + obj; + + wrap->lpVtbl->Release(wrap); +} + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + LPDIRECT3DRMMESH mesh = NULL; + LPDIRECT3DRMFRAME frame = NULL; + LPDIRECT3DRMFRAME axis = NULL; + LPDIRECT3DRMFRAME orbit = NULL; + LPDIRECT3DRMTEXTURE tex = NULL; + LPDIRECT3DRMWRAP wrap = NULL; + LPDIRECT3DRMLIGHT light1 = NULL; + LPDIRECT3DRMLIGHT light2 = NULL; + LPDIRECT3DRMMESHBUILDER builder = NULL; + HRESULT rval; + + dev; + view; + camera; + + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT, D3DVAL(0.2), + D3DVAL(0.2), D3DVAL(0.2), &light1))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_DIRECTIONAL, D3DVAL(1), + D3DVAL(1), D3DVAL(1), &light2))) + goto generic_error; + if (FAILED(scene->lpVtbl->AddLight(scene, light1))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &frame))) + goto generic_error; + if (FAILED(frame->lpVtbl->SetOrientation(frame, scene, -D3DVAL(1), -D3DVAL(1), + D3DVAL(1), D3DVAL(0), D3DVAL(1), D3DVAL(0)))) + goto generic_error; + if (FAILED(frame->lpVtbl->AddLight(frame, light2))) + goto generic_error; + RELEASE(frame); + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &frame))) + goto generic_error; + if (FAILED(frame->lpVtbl->SetPosition(frame, scene, D3DVAL(0), D3DVAL(0), D3DVAL(15)))) + goto generic_error; + if (FAILED(frame->lpVtbl->SetOrientation(frame, scene, D3DVAL(0), D3DVAL(1.0), D3DVAL(0), + D3DVAL(0), D3DVAL(0), D3DVAL(1)))) + goto generic_error; + if (FAILED(frame->lpVtbl->SetRotation(frame, scene, D3DVAL(0), D3DVAL(0.9), D3DVAL(1.0), + D3DVAL(0.04)))) + goto generic_error; + + rval = lpD3DRM->lpVtbl->LoadTexture(lpD3DRM, "lake.ppm", &tex); + if (rval != D3DRM_OK) { + Msg("Failed to load lake.ppm.\n"); + goto ret_with_error; + } + if (FAILED(tex->lpVtbl->SetColors(tex, 256))) + goto generic_error; + if (FAILED(tex->lpVtbl->SetShades(tex, 1))) + goto generic_error; + if (FAILED(tex->lpVtbl->SetDecalScale(tex, TRUE))) + goto generic_error; + if (FAILED(tex->lpVtbl->SetDecalOrigin(tex, 128, 128))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &builder))) + goto generic_error; + rval = builder->lpVtbl->Load(builder, "torus.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load torus.x.\n"); + goto ret_with_error; + } + if (FAILED(builder->lpVtbl->SetTexture(builder, tex))) + goto generic_error; + if (FAILED(builder->lpVtbl->SetQuality(builder, D3DRMRENDER_GOURAUD))) + goto generic_error; + if (FAILED(builder->lpVtbl->CreateMesh(builder, &mesh))) + goto generic_error; + RELEASE(builder); + + + if (FAILED(mesh->lpVtbl->SetGroupColorRGB(mesh, 0, D3DVAL(0.7), D3DVAL(0.3), D3DVAL(0.3)))) + goto generic_error; + if (FAILED(mesh->lpVtbl->SetGroupColorRGB(mesh, 1, D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0)))) + goto generic_error; + + if (FAILED(frame->lpVtbl->AddVisual(frame, (LPDIRECT3DRMVISUAL) mesh))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateWrap + (lpD3DRM, D3DRMWRAP_CHROME, camera, + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), -D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), + -D3DVAL(1.0), &wrap))) + goto generic_error; + + if (FAILED(frame->lpVtbl->AddMoveCallback(frame, applyWrap, (void *) wrap))) + goto generic_error; + if (FAILED(frame->lpVtbl->AddDestroyCallback(frame, cleanupWrap, wrap))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, frame, &axis))) + goto generic_error; + if (FAILED(axis->lpVtbl->SetRotation(axis, frame, D3DVAL(0), D3DVAL(1), D3DVAL(0), D3DVAL(0.04)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, axis, &orbit))) + goto generic_error; + if (FAILED(orbit->lpVtbl->SetPosition(orbit, axis, D3DVAL(2.6), D3DVAL(0), D3DVAL(0)))) + goto generic_error; + if (FAILED(orbit->lpVtbl->AddVisual(orbit, (LPDIRECT3DRMVISUAL) tex))) + goto generic_error; + //orbit->lpVtbl->AddMoveCallback(orbit, toggleDecalScale, (void*) tex); + if (FAILED(scene->lpVtbl->SetSceneBackgroundImage(scene, tex))) + goto generic_error; + + RELEASE(mesh); + RELEASE(frame); + RELEASE(axis); + RELEASE(orbit); + RELEASE(tex); + RELEASE(light1); + RELEASE(light2); + /* don't release the wrap */ + return TRUE; +generic_error: + Msg("A failure occurred while building the scene.\n"); +ret_with_error: + RELEASE(mesh); + RELEASE(frame); + RELEASE(axis); + RELEASE(orbit); + RELEASE(tex); + RELEASE(wrap); + RELEASE(light1); + RELEASE(light2); + RELEASE(builder); + return FALSE; +} + +void +OverrideDefaults(Defaults* defaults) +{ + defaults->bConstRenderQuality = TRUE; + lstrcpy(defaults->Name, "Texture Mapping V Direct3DRM Example"); +} diff --git a/sdk/samples/tex5/tex5.def b/sdk/samples/tex5/tex5.def new file mode 100644 index 0000000..55bbe32 --- /dev/null +++ b/sdk/samples/tex5/tex5.def @@ -0,0 +1,10 @@ +NAME tex5.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/trans/makefile b/sdk/samples/trans/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/trans/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/trans/msvc.mk b/sdk/samples/trans/msvc.mk new file mode 100644 index 0000000..4470f30 --- /dev/null +++ b/sdk/samples/trans/msvc.mk @@ -0,0 +1,42 @@ +NAME = trans +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = trans.obj rmmain.obj rmerror.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT =-DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/trans/readme.txt b/sdk/samples/trans/readme.txt new file mode 100644 index 0000000..65b3cb4 --- /dev/null +++ b/sdk/samples/trans/readme.txt @@ -0,0 +1,5 @@ +Trans +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Using transparent texture maps in various ways. diff --git a/sdk/samples/trans/trans.c b/sdk/samples/trans/trans.c new file mode 100644 index 0000000..3970bd0 --- /dev/null +++ b/sdk/samples/trans/trans.c @@ -0,0 +1,334 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: trans.c + * + ***************************************************************************/ + +#include "rmdemo.h" + +unsigned char check[] = { + 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, + 1, 1, 1, 1, 2, 2, 2, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, + 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, + 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, + 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, + 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, + 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 3, 3, 2, 1, 0, 0, 1, + 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, + 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, + 2, 3, 3, 2, 1, 0, 0, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, + 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, + 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, + 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, + 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, + 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 1, 1, 1, 2, 2, 2, 2, + 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, + 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, + 2, 2, 2, 2, 1, 1, 1, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, + 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, + 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, + 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, + 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, + 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 0, 0, 1, 2, 3, 3, 2, + 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, + 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, + 1, 0, 0, 1, 2, 3, 3, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, + 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, + 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, + 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, + 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, + 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 2, 2, 2, 1, 1, 1, 1, + 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, + 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, + 1, 1, 1, 1, 2, 2, 2, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, + 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, + 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, + 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, + 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, + 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 3, 3, 2, 1, 0, 0, 1, + 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, + 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2, 1, 0, 0, 1, + 2, 3, 3, 2, 1, 0, 0, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, + 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, +}; + +D3DRMPALETTEENTRY checkPal[] = { + {0, 0, 0, D3DRMPALETTE_READONLY}, + {127, 255, 127, D3DRMPALETTE_READONLY}, + {0, 0, 255, D3DRMPALETTE_READONLY}, + {255, 255, 127, D3DRMPALETTE_READONLY}, + {255, 255, 255, D3DRMPALETTE_READONLY}, +}; + +D3DRMIMAGE checkImage = { + 32, 32, + 1, 1, + 8, FALSE, + 32, + check, NULL, + 0xff, 0xff, 0xff, 0xff, + 5, checkPal, +}; + +static void CDECL mutateTexture(LPDIRECT3DRMFRAME frame, void* arg, D3DVALUE delta) +{ + LPDIRECT3DRMTEXTURE tex = (LPDIRECT3DRMTEXTURE) arg; + static int col = -1; + static int delay = 10; + static int count = 0; + int i; + + if (--delay) + return; + delay = 10; + + if (col >= 0) + for (i = 0; i < sizeof(check); i++) + if (check[i] == 4) + check[i] = col; + + count++; + col = count & 3; + + for (i = 0; i < sizeof(check); i++) + if (check[i] == col) + check[i] = 4; + + tex->lpVtbl->Changed(tex, TRUE, FALSE); +} + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + LPDIRECT3DRMFRAME box1 = NULL; + LPDIRECT3DRMFRAME box2 = NULL; + LPDIRECT3DRMFRAME sphere = NULL; + LPDIRECT3DRMFRAME decal = NULL; + LPDIRECT3DRMFRAME light = NULL; + LPDIRECT3DRMMESH obj = NULL; + LPDIRECT3DRMLIGHT dlight = NULL; + LPDIRECT3DRMLIGHT alight = NULL; + LPDIRECT3DRMTEXTURE tex = NULL; + LPDIRECT3DRMMESHBUILDER builder = NULL; + LPDIRECT3DRMWRAP wrap = NULL; + LPDIRECT3DRMTEXTURE sphereTex = NULL; + LPDIRECT3DRMTEXTURE decalTex = NULL; + LPDIRECT3DRMMATERIAL mat = NULL; + D3DRMBOX box; + D3DVALUE miny, maxy; + D3DVALUE height; + HRESULT rval; + + view = view; + dev = dev; + camera = camera; /* unused */ + + if (FAILED(scene->lpVtbl->SetSceneBackground(scene, D3DRGB(D3DVAL(0.2), D3DVAL(0.2), + D3DVAL(0.2))))) + goto generic_error; + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &light))) + goto generic_error; + if (FAILED(light->lpVtbl->SetPosition(light, scene, D3DVAL(2.0), D3DVAL(3.0), + D3DVAL(8.0)))) + goto generic_error; + if (FAILED(light->lpVtbl->SetOrientation(light, scene, D3DVAL(-1.0), D3DVAL(-1.0), + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_DIRECTIONAL, D3DVAL(1), + D3DVAL(1), D3DVAL(1), &dlight))) + goto generic_error; + if (FAILED(light->lpVtbl->AddLight(light, dlight))) + goto generic_error; + RELEASE(dlight); + RELEASE(light); + + if (FAILED(lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT, D3DVAL(0.1), + D3DVAL(0.1), D3DVAL(0.1), &alight))) + goto generic_error; + if (FAILED(scene->lpVtbl->AddLight(scene, alight))) + goto generic_error; + RELEASE(alight); + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &box1))) + goto generic_error; + if (FAILED(box1->lpVtbl->SetRotation(box1, scene, D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(-0.02)))) + goto generic_error; + if (FAILED(box1->lpVtbl->SetPosition(box1, scene, D3DVAL(2.0), D3DVAL(0.0), D3DVAL(7.0)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &builder))) + goto generic_error; + rval = builder->lpVtbl->Load(builder, "ncube.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load ncube.x.\n"); + goto ret_with_error; + } + if (FAILED(builder->lpVtbl->SetPerspective(builder, TRUE))) + goto generic_error; + if (FAILED(builder->lpVtbl->CreateMesh(builder, &obj))) + goto generic_error; + RELEASE(builder); + if (FAILED(lpD3DRM->lpVtbl->CreateTexture(lpD3DRM, &checkImage, &tex))) + goto generic_error; + if (FAILED(obj->lpVtbl->SetGroupTexture(obj, D3DRMGROUP_ALLGROUPS, tex))) + goto generic_error; + if (FAILED(obj->lpVtbl->SetGroupMapping(obj, D3DRMGROUP_ALLGROUPS, D3DRMMAP_PERSPCORRECT))) + goto generic_error; + if (FAILED(box1->lpVtbl->AddVisual(box1, (LPDIRECT3DRMVISUAL) obj))) + goto generic_error; + if (FAILED(box1->lpVtbl->AddMoveCallback(box1, mutateTexture, tex))) + goto generic_error; + RELEASE(obj); + RELEASE(tex); + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &box2))) + goto generic_error; + if (FAILED(box2->lpVtbl->SetRotation(box2, scene, D3DVAL(0.1), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.1)))) + goto generic_error; + if (FAILED(box2->lpVtbl->SetPosition(box2, box1, D3DVAL(-4.0), D3DVAL(0.0), D3DVAL(0.0)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &builder))) + goto generic_error; + rval = builder->lpVtbl->Load(builder, "ncube.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load ncube.x.\n"); + goto ret_with_error; + } + //builder->lpVtbl->Scale(builder, D3DVAL(2.0), D3DVAL(2.0), D3DVAL(2.0)); + if (FAILED(builder->lpVtbl->SetPerspective(builder, TRUE))) + goto generic_error; + if (FAILED(builder->lpVtbl->CreateMesh(builder, &obj))) + goto generic_error; + RELEASE(builder); + rval = lpD3DRM->lpVtbl->LoadTexture(lpD3DRM, "checker.ppm", &tex); + if (rval != D3DRM_OK) { + Msg("Failed to load checker.ppm.\n"); + goto ret_with_error; + } + if (FAILED(tex->lpVtbl->SetDecalTransparency(tex, TRUE))) + goto generic_error; + + if (FAILED(obj->lpVtbl->SetGroupTexture(obj, D3DRMGROUP_ALLGROUPS, tex))) + goto generic_error; + if (FAILED(obj->lpVtbl->SetGroupMapping(obj, D3DRMGROUP_ALLGROUPS, D3DRMMAP_PERSPCORRECT))) + goto generic_error; + if (FAILED(box2->lpVtbl->AddVisual(box2, (LPDIRECT3DRMVISUAL) obj))) + goto generic_error; + RELEASE(obj); + RELEASE(tex); + RELEASE(box2); + + if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &builder))) + goto generic_error; + rval = builder->lpVtbl->Load(builder, "sphere3.x", NULL, + D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load sphere3.x.\n"); + goto ret_with_error; + } + if (FAILED(builder->lpVtbl->CreateMesh(builder, &obj))) + goto generic_error; + RELEASE(builder); + if (FAILED(obj->lpVtbl->GetBox(obj, &box))) + goto generic_error; + maxy = box.max.y; + miny = box.min.y; + height = maxy - miny; + + if (FAILED(lpD3DRM->lpVtbl->CreateWrap(lpD3DRM, D3DRMWRAP_CYLINDER, NULL, + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), + D3DVAL(0.0), D3DDivide(miny, height), + D3DVAL(1.0), D3DDivide(D3DVAL(-1.0),height), + &wrap))) + goto generic_error; + if (FAILED(wrap->lpVtbl->Apply(wrap, (LPDIRECT3DRMOBJECT) obj))) + goto generic_error; + RELEASE(wrap); + + rval = lpD3DRM->lpVtbl->LoadTexture(lpD3DRM, "tex3.ppm", &sphereTex); + if (rval != D3DRM_OK) { + Msg("Failed to load tex3.ppm.\n"); + goto ret_with_error; + } + if (FAILED(sphereTex->lpVtbl->SetColors(sphereTex, 16))) + goto generic_error; + if (FAILED(obj->lpVtbl->SetGroupTexture(obj, D3DRMGROUP_ALLGROUPS, sphereTex))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateMaterial(lpD3DRM, D3DVAL(16.0), &mat))) + goto generic_error; + if (FAILED(obj->lpVtbl->SetGroupMaterial(obj, D3DRMGROUP_ALLGROUPS, mat))) + goto generic_error; + RELEASE(sphereTex); + RELEASE(mat); + + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &sphere))) + goto generic_error; + if (FAILED(sphere->lpVtbl->AddVisual(sphere, (LPDIRECT3DRMVISUAL) obj))) + goto generic_error; + RELEASE(obj); + if (FAILED(sphere->lpVtbl->SetPosition(sphere, scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(8.0)))) + goto generic_error; + if (FAILED(sphere->lpVtbl->SetRotation(sphere, scene, D3DVAL(-0.1), D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.02)))) + goto generic_error; + if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, sphere, &decal))) + goto generic_error; + + rval = lpD3DRM->lpVtbl->LoadTexture(lpD3DRM, "checker.ppm", &decalTex); + if (rval != D3DRM_OK) { + Msg("Failed to load checker.ppm.\n"); + goto ret_with_error; + } + if (FAILED(decalTex->lpVtbl->SetDecalScale(decalTex, TRUE))) + goto generic_error; + if (FAILED(decalTex->lpVtbl->SetDecalSize(decalTex, D3DVAL(2.0), D3DVAL(2.0)))) + goto generic_error; + if (FAILED(decalTex->lpVtbl->SetDecalOrigin(decalTex, 4, 4))) + goto generic_error; + if (FAILED(decalTex->lpVtbl->SetDecalTransparency(decalTex, TRUE))) + goto generic_error; + if (FAILED(decal->lpVtbl->SetPosition(decal, sphere, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(2.0)))) + goto generic_error; + if (FAILED(decal->lpVtbl->AddVisual(decal, (LPDIRECT3DRMVISUAL) decalTex))) + goto generic_error; + RELEASE(decalTex); + + RELEASE(box1); + RELEASE(decal); + RELEASE(sphere); + return TRUE; +generic_error: + Msg("A failure occurred while building the scene.\n"); +ret_with_error: + RELEASE(box1); + RELEASE(box2); + RELEASE(sphere); + RELEASE(decal); + RELEASE(light); + RELEASE(obj); + RELEASE(dlight); + RELEASE(alight); + RELEASE(tex); + RELEASE(builder); + RELEASE(wrap); + RELEASE(sphereTex); + RELEASE(decalTex); + RELEASE(mat); + return FALSE; +} + +void +OverrideDefaults(Defaults* defaults) +{ + defaults->bConstRenderQuality = TRUE; + lstrcpy(defaults->Name, "Transparency Direct3DRM Example"); +} diff --git a/sdk/samples/trans/trans.def b/sdk/samples/trans/trans.def new file mode 100644 index 0000000..d40c6d6 --- /dev/null +++ b/sdk/samples/trans/trans.def @@ -0,0 +1,10 @@ +NAME trans.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/triangle/makefile b/sdk/samples/triangle/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/triangle/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/triangle/msvc.mk b/sdk/samples/triangle/msvc.mk new file mode 100644 index 0000000..ef79e50 --- /dev/null +++ b/sdk/samples/triangle/msvc.mk @@ -0,0 +1,42 @@ +NAME = triangle +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = triangle.obj d3dapp.obj ddcalls.obj d3dcalls.obj texture.obj misc.obj d3dmain.obj stats.obj lclib.obj + +!if "$(DEBUG)" == "debug" +COPT =-DDEBUG -DD3DDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DDEMO +!else +COPT =-Otyb1 -DD3DDEMO +LOPT =-debug:none +ROPT =-DD3DEMO +!endif +DEF = $(NAME).def +RES = d3dmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/triangle/readme.txt b/sdk/samples/triangle/readme.txt new file mode 100644 index 0000000..bc45222 --- /dev/null +++ b/sdk/samples/triangle/readme.txt @@ -0,0 +1,19 @@ +Triangle +Direct3D Immediate Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +One triangle on a textured background. The triangle is created by +specifying the screen coordinates for the vertices using TLVERTEXs. + +The top left vertex, the first vertex in the triangle data, has a +diffuse color of blue. Switching between flat and gouraud shading +changes the effect this vertex has on the lighting across the +triangle. When flat shading, the first vertex specifies the lighting +for the entire triangle. When gouraud shading, the lighting is +interpolated across the triangle. Lighting is different in the two +software renderers. The RAMP driver does not modulate the texture's +color with the material color. + +The rhw value of the top right vertex is larger than the other +two; it is closer to the eye. Turning perspective correction on and +off changes the interpolation of the texture across the triangle. diff --git a/sdk/samples/triangle/triangle.c b/sdk/samples/triangle/triangle.c new file mode 100644 index 0000000..566fc26 --- /dev/null +++ b/sdk/samples/triangle/triangle.c @@ -0,0 +1,222 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: triangle.c + * + ***************************************************************************/ + +#include <math.h> +#include <d3d.h> +#include "d3ddemo.h" + +static D3DEXECUTEDATA d3dExData; +static LPDIRECT3DEXECUTEBUFFER lpD3DExBuf; +LPDIRECT3DMATERIAL lpBmat, lpMat1; +#define NUM_VERTICES 3 +#define NUM_TRIANGLES 1 + +void +OverrideDefaults(Defaults* defaults) +{ + lstrcpy(defaults->Name, "Triangle D3D Example"); + defaults->rs.bPerspCorrect = FALSE; + defaults->bResizingDisabled = TRUE; +} + +BOOL +RenderScene(LPDIRECT3DDEVICE lpDev, LPDIRECT3DVIEWPORT lpView, + LPD3DRECT lpExtent) +{ + /* + * Execute the instruction buffer + */ + if (lpDev->lpVtbl->BeginScene(lpDev) != D3D_OK) + return FALSE; + if (lpDev->lpVtbl->Execute(lpDev, lpD3DExBuf, + lpView, D3DEXECUTE_UNCLIPPED) != D3D_OK) + return FALSE; + if (lpDev->lpVtbl->EndScene(lpDev) != D3D_OK) + return FALSE; + if (lpD3DExBuf->lpVtbl->GetExecuteData(lpD3DExBuf, &d3dExData) != D3D_OK) + return FALSE; + *lpExtent = d3dExData.dsStatus.drExtent; + return TRUE; +} + +void +ReleaseScene(void) +{ + return; +} + +void +ReleaseView(LPDIRECT3DVIEWPORT lpView) +{ + lpView; + RELEASE(lpD3DExBuf); + RELEASE(lpMat1); + RELEASE(lpBmat); +} + +BOOL +InitScene(void) +{ + return TRUE; +} + +BOOL +InitView(LPDIRECTDRAW lpDD, LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpDev, + LPDIRECT3DVIEWPORT lpView, int NumTextures, + LPD3DTEXTUREHANDLE TextureHandle) +{ + LPVOID lpBufStart, lpInsStart, lpPointer; + D3DEXECUTEBUFFERDESC debDesc; + size_t size; + D3DTLVERTEX src_v[NUM_VERTICES]; + int t[8][3] = { + 0, 1, 2, + }; + D3DMATERIAL bmat, mat; + D3DMATERIALHANDLE hBmat, hMat1; + + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpBmat, NULL) != D3D_OK) { + return FALSE; + } + memset(&bmat, 0, sizeof(D3DMATERIAL)); + bmat.dwSize = sizeof(D3DMATERIAL); + bmat.diffuse.r = (D3DVALUE)1.0; + bmat.diffuse.g = (D3DVALUE)1.0; + bmat.diffuse.b = (D3DVALUE)1.0; + bmat.ambient.r = (D3DVALUE)1.0; + bmat.ambient.g = (D3DVALUE)1.0; + bmat.ambient.b = (D3DVALUE)1.0; + bmat.hTexture = TextureHandle[0]; + bmat.dwRampSize = 1; + lpBmat->lpVtbl->SetMaterial(lpBmat, &bmat); + lpBmat->lpVtbl->GetHandle(lpBmat, lpDev, &hBmat); + lpView->lpVtbl->SetBackground(lpView, hBmat); + + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpMat1, NULL) != D3D_OK) { + return FALSE; + } + memset(&mat, 0, sizeof(D3DMATERIAL)); + mat.dwSize = sizeof(D3DMATERIAL); + mat.diffuse.r = (D3DVALUE)1.0; + mat.diffuse.g = (D3DVALUE)1.0; + mat.diffuse.b = (D3DVALUE)1.0; + mat.ambient.r = (D3DVALUE)1.0; + mat.ambient.g = (D3DVALUE)1.0; + mat.ambient.b = (D3DVALUE)1.0; +#define SPECULAR +#ifdef SPECULAR + mat.specular.r = (D3DVALUE)1.0; + mat.specular.g = (D3DVALUE)1.0; + mat.specular.b = (D3DVALUE)1.0; + mat.power = (float)40.0; +#else + mat.specular.r = (D3DVALUE)0.0; + mat.specular.g = (D3DVALUE)0.0; + mat.specular.b = (D3DVALUE)0.0; + mat.power = (float)0.0; +#endif + mat.hTexture = TextureHandle[1]; + mat.dwRampSize = 16; + lpMat1->lpVtbl->SetMaterial(lpMat1, &mat); + lpMat1->lpVtbl->GetHandle(lpMat1, lpDev, &hMat1); + /* + * Setup vertices + */ + memset(&src_v[0], 0, sizeof(D3DVERTEX) * NUM_VERTICES); + /* V 0 */ + src_v[0].sx = D3DVAL(10.0); + src_v[0].sy = D3DVAL(10.0); + src_v[0].sz = D3DVAL(0.1); + src_v[0].rhw = D3DVAL(1.0); + src_v[0].color = RGBA_MAKE(255, 0, 255, 255); + src_v[0].specular = RGB_MAKE(0, 0, 255); + src_v[0].tu = D3DVAL(0.0); + src_v[0].tv = D3DVAL(0.0); + /* V 1 */ + src_v[1].sx = D3DVAL(300.0); + src_v[1].sy = D3DVAL(50.0); + src_v[1].sz = D3DVAL(0.9); + src_v[1].rhw = D3DVAL(2.0); + src_v[1].color = RGBA_MAKE(255, 255, 255, 255); + src_v[1].specular = RGB_MAKE(0, 0, 0); + src_v[1].tu = D3DVAL(1.0); + src_v[1].tv = D3DVAL(1.0); + /* V 2 */ + src_v[2].sx = D3DVAL(150.0); + src_v[2].sy = D3DVAL(180.0); + src_v[2].sz = D3DVAL(0.6); + src_v[2].rhw = D3DVAL(1.0); + src_v[2].color = RGBA_MAKE(255, 255, 0, 255); + src_v[2].specular = RGB_MAKE(0, 0, 0); + src_v[2].tu = D3DVAL(0.0); + src_v[2].tv = D3DVAL(1.0); + /* + * Create an execute buffer + */ + size = sizeof(D3DVERTEX) * NUM_VERTICES; + size += sizeof(D3DINSTRUCTION) * 6; + size += sizeof(D3DSTATE) * 2; + size += sizeof(D3DPROCESSVERTICES); + size += sizeof(D3DTRIANGLE) * 1; + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + if (lpDev->lpVtbl->CreateExecuteBuffer(lpDev, &debDesc, &lpD3DExBuf, + NULL) != D3D_OK) { + return FALSE; + } + if (lpD3DExBuf->lpVtbl->Lock(lpD3DExBuf, &debDesc) != D3D_OK) { + return FALSE; + } + lpBufStart = debDesc.lpData; + memset(lpBufStart, 0, size); + lpPointer = lpBufStart; + + /* + * Copy vertices to execute buffer + */ + VERTEX_DATA(&src_v[0], NUM_VERTICES, lpPointer); + /* + * Setup instructions in execute buffer + */ + lpInsStart = lpPointer; + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_MATERIAL, hMat1, lpPointer); + OP_PROCESS_VERTICES(1, lpPointer); + PROCESSVERTICES_DATA(D3DPROCESSVERTICES_COPY | + D3DPROCESSVERTICES_UPDATEEXTENTS, 0, NUM_VERTICES, lpPointer); + OP_STATE_RENDER(1, lpPointer); + STATE_DATA(D3DRENDERSTATE_TEXTUREHANDLE, TextureHandle[1], lpPointer); + /* + * Make sure that the triangle data (not OP) will be QWORD aligned + */ + if (QWORD_ALIGNED(lpPointer)) { + OP_NOP(lpPointer); + } + OP_TRIANGLE_LIST(1, lpPointer); + ((LPD3DTRIANGLE)lpPointer)->v1 = 0; + ((LPD3DTRIANGLE)lpPointer)->v2 = 1; + ((LPD3DTRIANGLE)lpPointer)->v3 = 2; + ((LPD3DTRIANGLE)lpPointer)->wFlags = D3DTRIFLAG_EDGEENABLETRIANGLE; + lpPointer = ((char*)lpPointer) + sizeof(D3DTRIANGLE); + OP_EXIT(lpPointer); + /* + * Setup the execute data + */ + lpD3DExBuf->lpVtbl->Unlock(lpD3DExBuf); + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwVertexCount = NUM_VERTICES; + d3dExData.dwInstructionOffset = (ULONG) ((char *)lpInsStart - (char *)lpBufStart); + d3dExData.dwInstructionLength = (ULONG) ((char *)lpPointer - (char *)lpInsStart); + lpD3DExBuf->lpVtbl->SetExecuteData(lpD3DExBuf, &d3dExData); + + return TRUE; +} + diff --git a/sdk/samples/triangle/triangle.def b/sdk/samples/triangle/triangle.def new file mode 100644 index 0000000..c1f314f --- /dev/null +++ b/sdk/samples/triangle/triangle.def @@ -0,0 +1,10 @@ +NAME triangle.exe + +DESCRIPTION 'Direct3D Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/tunnel/makefile b/sdk/samples/tunnel/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/tunnel/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/tunnel/msvc.mk b/sdk/samples/tunnel/msvc.mk new file mode 100644 index 0000000..42c2091 --- /dev/null +++ b/sdk/samples/tunnel/msvc.mk @@ -0,0 +1,42 @@ +NAME = tunnel +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = d3dapp.obj ddcalls.obj d3dcalls.obj texture.obj misc.obj lclib.obj d3dmain.obj stats.obj tunnel.obj d3dmath.obj + +!if "$(DEBUG)" == "debug" +COPT =-DDEBUG -DD3DDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DDEMO +!else +COPT =-Otyb1 -DD3DDEMO +LOPT =-debug:none +ROPT =-DD3DDEMO +!endif +DEF = $(NAME).def +RES = d3dmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/tunnel/readme.txt b/sdk/samples/tunnel/readme.txt new file mode 100644 index 0000000..ab0f4c5 --- /dev/null +++ b/sdk/samples/tunnel/readme.txt @@ -0,0 +1,11 @@ +Tunnel +Direct3D Immediate Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Camera moves through a tunnel generated around a spline. Only a small +section of the tunnel is placed in the execute buffer at a time. +After each frame, the buffer is locked and the tunnel vertices updated +to include the next section. + +Triflags are set so the segments of the tunnel are drawn as quads +rather than triangles when rendered in wireframe. diff --git a/sdk/samples/tunnel/tunnel.c b/sdk/samples/tunnel/tunnel.c new file mode 100644 index 0000000..7dcd8d1 --- /dev/null +++ b/sdk/samples/tunnel/tunnel.c @@ -0,0 +1,717 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: tunnel.c + * + ***************************************************************************/ + +#include <math.h> +#include <malloc.h> +#include <d3d.h> +#include "d3ddemo.h" + +/* + * External funtions which perform much of the math. + */ +extern LPD3DVECTOR D3DVECTORNormalise(LPD3DVECTOR v); +extern LPD3DVECTOR D3DVECTORCrossProduct(LPD3DVECTOR lpd, LPD3DVECTOR lpa, + LPD3DVECTOR lpb); +extern LPD3DMATRIX D3DMATRIXInvert(LPD3DMATRIX d, LPD3DMATRIX a); +extern LPD3DMATRIX D3DMATRIXSetRotation(LPD3DMATRIX lpM, LPD3DVECTOR lpD, + LPD3DVECTOR lpU); +extern void spline(LPD3DVECTOR p, float t, LPD3DVECTOR p1, LPD3DVECTOR p2, + LPD3DVECTOR p3, LPD3DVECTOR p4); + +/* + * Globals to keep track of execute buffer + */ +static D3DEXECUTEDATA d3dExData; +static LPDIRECT3DEXECUTEBUFFER lpD3DExBuf; +static D3DEXECUTEBUFFERDESC debDesc; + +/* + * More globals + */ +LPDIRECT3DMATERIAL lpbmat; +LPDIRECT3DMATERIAL lpmat; /* Material object */ + +/* + * Global projection, view, world and identity matricies + */ +D3DMATRIXHANDLE hProj; +D3DMATRIX proj = { + D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(-1.0), D3DVAL(0.0) +}; +D3DMATRIXHANDLE hView; +D3DMATRIX view = { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(10.0), D3DVAL(1.0) +}; +D3DMATRIXHANDLE hWorld; +D3DMATRIX world = { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0) +}; +D3DMATRIX identity = { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0) +}; + +#define PI 3.14159265359 + +/* + * These defines describe the section of the tube in the execute buffer at + * one time. (Note, tube and tunnel are used interchangeably). + */ +#define SEGMENTS 20 /* Number of segments in memory at one time. Each + * segment is made up oftriangles spanning between + * two rings. + */ +#define SIDES 8 /* Number of sides on each ring. */ +#define TEX_RINGS 5 /* Number of rings to stretch the texture over. */ +#define NUM_V (SIDES*(SEGMENTS+1)) // Number of vertices in memory at once +#define NUM_TRI (SIDES*SEGMENTS*2) // Number of triangles in memory +#define TUBE_R 1.0 /* Radius of the tube. */ +#define SPLINE_POINTS 50 /* Number of spline points to initially + * calculate. The section in memory represents + * only a fraction of this. + */ +/* + * Movement and track scalars given in terms of position along the spline + * curve. + */ +#define SEGMENT_LENGTH 0.05 /* Length of each segment along curve. */ +#define SPEED 0.02 /* Amount to increment camera position along + * curve for each frame. + */ +#define DEPTH 0.8 /* How close the camera can get to the end of + * track before new segments are added. + */ +#define PATH_LENGTH (SPLINE_POINTS - 1) /*Total length of the tunnel.*/ + +/* + * A global structure holding the tube data. + */ +static struct { + LPD3DVERTEX lpV; /* Points to the vertices. */ + LPD3DTRIANGLE lpTri; /* Points to the triangles which make up the + * segments. + */ + int TriOffset; /* Offset into the execute buffer were the + * triangle list is found. + */ + LPD3DVECTOR lpPoints; /* Points to the points defining the spline + * curve. + */ + D3DMATERIALHANDLE hMat; /* Handle for the material on the tube. */ + D3DTEXTUREHANDLE hTex; /* Handle for the texture on the material.*/ + D3DLIGHT light; /* Structure defining the light. */ + LPDIRECT3DLIGHT lpD3DLight; /* Object pointer for the light. */ + D3DVECTOR cameraP, cameraD, cameraN; /* Vectors defining the camera + * position, direction and up. + */ + float cameraPos; /* Camera position along the + * spline curve. + */ + D3DVECTOR endP, endD, endN; /* Vectors defining the position, + * direction and up at the foremost end of + * the section in memory. + */ + float endPos; /* Position along the spline curve of the end. */ + int currentRing, currentSegment; /* Numbers of the ring and tube at + * the back end of the section. + */ +} tube; + + +/* + * Creates a matrix which is equivalent to having the camera at a + * specified position. This matrix can be used to convert vertices to + * camera coordinates. lpP Position of the camera. lpD Direction of + * view. lpN Up vector. lpM Matrix to update. + */ +void +PositionCamera(LPD3DVECTOR lpP, LPD3DVECTOR lpD, LPD3DVECTOR lpN, + LPD3DMATRIX lpM) +{ + D3DMATRIX tmp; + + /* + * Set the rotation part of the matrix and invert it. Vertices must be + * inverse rotated to achieve the same result of a corresponding + * camera rotation. + */ + tmp._14 = tmp._24 = tmp._34 = tmp._41 = tmp._42 = tmp._43 = (float)0.0; + tmp._44 = (float)1.0; + D3DMATRIXSetRotation(&tmp, lpD, lpN); + D3DMATRIXInvert(lpM, &tmp); + /* + * Multiply the rotation matrix by a translation transform. The + * translation matrix must be applied first (left of rotation). + */ + lpM->_41=-(lpM->_11 * lpP->x + lpM->_21 * lpP->y + lpM->_31 * lpP->z); + lpM->_42=-(lpM->_12 * lpP->x + lpM->_22 * lpP->y + lpM->_32 * lpP->z); + lpM->_43=-(lpM->_13 * lpP->x + lpM->_23 * lpP->y + lpM->_33 * lpP->z); +} + +/* + * Updates the given position, direction and normal vectors to a given + * position on the spline curve. The given up vector is used to determine + * the new up vector. + */ +void +MoveToPosition(float position, LPD3DVECTOR lpP, LPD3DVECTOR lpD, + LPD3DVECTOR lpN) +{ + LPD3DVECTOR lpSplinePoint[4]; + D3DVECTOR pp, x; + int i, j; + float t; + + /* + * Find the four points along the curve which are around the position. + */ + i = 0; + t = position; + while (t > 1.0) { + i++; + if (i == SPLINE_POINTS) + i = 0; + t -= (float)1.0; + } + for (j = 0; j < 4; j++) { + lpSplinePoint[j] = &tube.lpPoints[i]; + i++; + if (i == SPLINE_POINTS) + i = 0; + } + /* + * Get the point at the given position and one just before it. + */ + spline(lpP, t, lpSplinePoint[0], lpSplinePoint[1], lpSplinePoint[2], + lpSplinePoint[3]); + spline(&pp, t - (float)0.01, lpSplinePoint[0], lpSplinePoint[1], + lpSplinePoint[2], lpSplinePoint[3]); + /* + * Calculate the direction. + */ + lpD->x = lpP->x - pp.x; + lpD->y = lpP->y - pp.y; + lpD->z = lpP->z - pp.z; + D3DVECTORNormalise(lpD); + /* + * Find the new normal. This method will work provided the change in + * the normal is not very large. + */ + D3DVECTORNormalise(lpN); + D3DVECTORCrossProduct(&x, lpN, lpD); + D3DVECTORCrossProduct(lpN, &x, lpD); + lpN->x = -lpN->x; + lpN->y = -lpN->y; + lpN->z = -lpN->z; + D3DVECTORNormalise(lpN); +} + + +/* + * Generates a ring of vertices in a plane defined by n and the cross + * product of n and p. On exit, joint contains the vertices. Join must + * be pre-allocated. Normals are generated pointing in. Texture + * coordinates are generated along tu axis and are given along tv. + */ +static void +MakeRing(LPD3DVECTOR p, LPD3DVECTOR d, LPD3DVECTOR n, float tv, + LPD3DVERTEX joint) +{ + int spoke; + float theta, u, v, x, y, z; + D3DVECTOR nxd; + + D3DVECTORCrossProduct(&nxd, n, d); + for (spoke = 0; spoke < SIDES; spoke++) { + theta = (float)(2.0 * PI) * spoke / SIDES; + /* + * v, u defines a unit vector in the plane define by vectors nxd + * and n. + */ + v = (float)sin(theta); + u = (float)cos(theta); + /* + * x, y, z define a unit vector in standard coordiante space + */ + x = u * nxd.x + v * n->x; + y = u * nxd.y + v * n->y; + z = u * nxd.z + v * n->z; + /* + * Position, normals and texture coordiantes. + */ + joint[spoke].x = (float)TUBE_R * x + p->x; + joint[spoke].y = (float)TUBE_R * y + p->y; + joint[spoke].z = (float)TUBE_R * z + p->z; + joint[spoke].nx = -x; + joint[spoke].ny = -y; + joint[spoke].nz = -z; + joint[spoke].tu = (float)1.0 - theta / (float)(2.0 * PI); + joint[spoke].tv = tv; + + } +} + + +/* + * Defines the triangles which form a segment between ring1 and ring2 and + * stores them at lpTri. lpTri must be pre-allocated. + */ +void +MakeSegment(int ring1, int ring2, LPD3DTRIANGLE lpTri) +{ + int side, triangle = 0; + + for (side = 0; side < SIDES; side++) { + /* + * Each side consists of two triangles. + */ + lpTri[triangle].v1 = ring1 * SIDES + side; + lpTri[triangle].v2 = ring2 * SIDES + side; + lpTri[triangle].v3 = ring2 * SIDES + ((side + 1) % SIDES); + + /* + * for wireframe only need first two edges. + * Start a two triangle flat fan for each tunnel face. + */ + + lpTri[triangle].wFlags = D3DTRIFLAG_STARTFLAT(1); + lpTri[triangle].wFlags |= D3DTRIFLAG_EDGEENABLE1 | + D3DTRIFLAG_EDGEENABLE2; + + triangle++; + lpTri[triangle].v2 = ring2 * SIDES + ((side + 1) % SIDES); + lpTri[triangle].v3 = ring1 * SIDES + ((side + 1) % SIDES); + lpTri[triangle].v1 = ring1 * SIDES + side; + + /* + * Dont need any edges for wireframe. + */ + lpTri[triangle].wFlags = D3DTRIFLAG_EVEN; + + triangle++; + } +} + + +/* + * Creates a new segment of the tunnel at the current end position. + * Creates a new ring and segment. + */ +void +UpdateTubeInMemory(void) +{ + static int texRing = 0; /* Static counter defining the position of + * this ring on the texture. + */ + int endRing; /* The ring at the end of the tube in memory. */ + int RingOffset, SegmentOffset; /* Offsets into the vertex and triangle + * lists for the new data. + */ + /* + * Replace the back ring with a new ring at the front of the tube + * in memory. + */ + memcpy(&tube.lpV[SIDES], &tube.lpV[0], sizeof(tube.lpV[0]) * (NUM_V - SIDES)); + MakeRing(&tube.endP, &tube.endD, &tube.endN, texRing/(float)TEX_RINGS, + &tube.lpV[0]); + /* + * Replace the back segment with a new segment at the front of the + * tube in memory. Update the current end position of the tube in + * memory. + */ + endRing = (tube.currentRing + SEGMENTS) % (SEGMENTS + 1); + MoveToPosition(tube.endPos, &tube.endP, &tube.endD, &tube.endN); + /* + * Update the execute buffer with the new vertices and triangles. + */ + RingOffset = sizeof(D3DVERTEX) * tube.currentRing * SIDES; + SegmentOffset = sizeof(D3DTRIANGLE) * tube.currentSegment * SIDES * 2; + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + if (lpD3DExBuf->lpVtbl->Lock(lpD3DExBuf, &debDesc) != D3D_OK) + return; + memcpy((char *) debDesc.lpData, + &tube.lpV[0], sizeof(D3DVERTEX) * NUM_V); + lpD3DExBuf->lpVtbl->Unlock(lpD3DExBuf); + /* + * Update the position of the back of the tube in memory and texture + * counter. + */ + tube.currentRing = (tube.currentRing + 1) % (SEGMENTS + 1); + tube.currentSegment = (tube.currentSegment + 1) % SEGMENTS; + texRing = (texRing + 1) % TEX_RINGS; +} + + +/* + * Move the camera through the tunnel. Create new segments of the tunnel + * when the camera gets close to the end of the section in memory. + */ +void +MoveCamera(LPDIRECT3DDEVICE lpDev, LPDIRECT3DVIEWPORT lpView) +{ + /* + * Update the position on curve and camera vectors. + */ + tube.cameraPos += (float)SPEED; + if (tube.cameraPos > PATH_LENGTH) + tube.cameraPos -= PATH_LENGTH; + MoveToPosition(tube.cameraPos, &tube.cameraP, &tube.cameraD, + &tube.cameraN); + /* + * If the camera is close to the end, add a new segment. + */ + if (tube.endPos - tube.cameraPos < DEPTH) { + tube.endPos = tube.endPos + (float)SEGMENT_LENGTH; + if (tube.endPos > PATH_LENGTH) + tube.endPos -= PATH_LENGTH; + UpdateTubeInMemory(); + } +} + + +/* + * Modify the buffer between rendering frames + */ +static void +TickScene(LPDIRECT3DDEVICE lpDev, LPDIRECT3DVIEWPORT lpView) +{ + MoveCamera(lpDev, lpView); +} + + +/* + * Each frame, renders the scene and calls TickScene to modify the object + * for the next frame. + */ +BOOL +RenderScene(LPDIRECT3DDEVICE lpDev, LPDIRECT3DVIEWPORT lpView, + LPD3DRECT lpExtent) +{ + HRESULT ddrval; + + /* + * Move the camera by updating the view matrix and move the light. + */ + PositionCamera(&tube.cameraP, &tube.cameraD, &tube.cameraN, &view); + ddrval = lpDev->lpVtbl->SetMatrix(lpDev, hView, &view); + if (ddrval != D3D_OK) + return FALSE; + + tube.light.dvPosition.x = tube.cameraP.x; + tube.light.dvPosition.y = tube.cameraP.y; + tube.light.dvPosition.z = tube.cameraP.z; + ddrval = tube.lpD3DLight->lpVtbl->SetLight(tube.lpD3DLight, &tube.light); + if (ddrval != D3D_OK) + return FALSE; + /* + * Execute the instruction buffer and update the view + */ + ddrval = lpDev->lpVtbl->BeginScene(lpDev); + if (ddrval != D3D_OK) + return FALSE; + ddrval = lpDev->lpVtbl->Execute(lpDev, lpD3DExBuf, lpView, D3DEXECUTE_CLIPPED); + if (ddrval != D3D_OK) + return FALSE; + ddrval = lpDev->lpVtbl->EndScene(lpDev); + if (ddrval != D3D_OK) + return FALSE; + ddrval = lpD3DExBuf->lpVtbl->GetExecuteData(lpD3DExBuf, &d3dExData); + if (ddrval != D3D_OK) + return FALSE; + *lpExtent = d3dExData.dsStatus.drExtent; + /* + * Modify for the next time around + */ + TickScene(lpDev, lpView); + return TRUE; +} + +void +OverrideDefaults(Defaults* defaults) +{ + defaults->rs.bZBufferOn = FALSE; + defaults->rs.bPerspCorrect = TRUE; + defaults->bClearsOn = FALSE; + lstrcpy(defaults->Name, "Tunnel D3D Example"); +} + +BOOL +InitScene(void) +{ + float position; /* Curve position counter. */ + int i; /* counter */ + + /* + * Reserved memory for vertices, triangles and spline points. + */ + tube.lpV = (LPD3DVERTEX) malloc(sizeof(D3DVERTEX) * NUM_V); + tube.lpTri = (LPD3DTRIANGLE) malloc(sizeof(D3DTRIANGLE) * NUM_TRI); + tube.lpPoints = (LPD3DVECTOR) malloc(sizeof(D3DVECTOR)*SPLINE_POINTS); + /* + * Generate spline points + */ + for (i = 0; i < SPLINE_POINTS; i++) { +#if 1 + tube.lpPoints[i].x = (float)(cos(i * 4.0) * 20.0); + tube.lpPoints[i].y = (float)(sin(i * 4.0) * 20.0); + tube.lpPoints[i].z = i * (float)20.0; +#else + tube.lpPoints[i].x = (float)0.0; + tube.lpPoints[i].y = (float)0.0; + tube.lpPoints[i].z = i * (float)20.0; +#endif + } + /* + * Create the initial tube section in memory. + */ + tube.endN.x = (float)0.0; + tube.endN.y = (float)1.0; + tube.endN.z = (float)0.0; + position = (float)0.0; + for (i = 0; i < SEGMENTS + 1; i++) { + MoveToPosition(position, &tube.endP, &tube.endD, &tube.endN); + position += (float)SEGMENT_LENGTH; + MakeRing(&tube.endP, &tube.endD, &tube.endN, + (float)(i % TEX_RINGS) / TEX_RINGS, + &tube.lpV[(SEGMENTS - i) * SIDES]); + } + for (i = 0; i < SEGMENTS; i++) + MakeSegment(i + 1, i, &tube.lpTri[i * SIDES * 2]); + /* + * Move the camera to the begining and set some globals + */ + tube.cameraN.x = (float)0.0; + tube.cameraN.y = (float)1.0; + tube.cameraN.z = (float)0.0; + MoveToPosition((float)0.0, &tube.cameraP, &tube.cameraD, &tube.cameraN); + tube.currentRing = 0; + tube.currentSegment = 0; + tube.cameraPos = (float)0.0; + tube.endPos = position; + return TRUE; +} + +void +ReleaseScene(void) +{ + if (tube.lpPoints) + free(tube.lpPoints); + if (tube.lpTri) + free(tube.lpTri); + if (tube.lpV) + free(tube.lpV); +} + +void +ReleaseView(LPDIRECT3DVIEWPORT lpView) +{ + if (lpView) + lpView->lpVtbl->DeleteLight(lpView, tube.lpD3DLight); + RELEASE(lpD3DExBuf); + RELEASE(tube.lpD3DLight); + RELEASE(lpmat); + RELEASE(lpbmat); +} + + +/* + * Builds the scene and initializes the execute buffer for rendering. + * Returns 0 on failure. + */ +BOOL +InitView(LPDIRECTDRAW lpDD, LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpDev, + LPDIRECT3DVIEWPORT lpView, int NumTextures, + LPD3DTEXTUREHANDLE TextureHandle) +{ + /* Variables for exectue buffer generation */ + LPVOID lpBufStart, lpInsStart, lpPointer; + LPDIRECT3DEXECUTEBUFFER lpD3DExCmdBuf; + DWORD size; + + /* Background material variables */ + D3DMATERIAL bmat; + D3DMATERIALHANDLE hbmat; + D3DMATERIAL mat; + + /* + * Set background to black material + */ + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpbmat, NULL) != D3D_OK) + return FALSE; + memset(&bmat, 0, sizeof(D3DMATERIAL)); + bmat.dwSize = sizeof(D3DMATERIAL); + bmat.dwRampSize = 1; + lpbmat->lpVtbl->SetMaterial(lpbmat, &bmat); + lpbmat->lpVtbl->GetHandle(lpbmat, lpDev, &hbmat); + lpView->lpVtbl->SetBackground(lpView, hbmat); + /* + * Set the view, projection and world matricies in an execute buffer + */ + MAKE_MATRIX(lpDev, hView, view); + MAKE_MATRIX(lpDev, hProj, proj); + MAKE_MATRIX(lpDev, hWorld, world); + /* + * Create an execute buffer + */ + size = 0; + size += sizeof(D3DINSTRUCTION) * 3; + size += sizeof(D3DSTATE) * 4; + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + if (lpDev->lpVtbl->CreateExecuteBuffer(lpDev, &debDesc, &lpD3DExCmdBuf, + NULL) != D3D_OK) + return FALSE; + if (lpD3DExCmdBuf->lpVtbl->Lock(lpD3DExCmdBuf, &debDesc) != D3D_OK) + return FALSE; + lpBufStart = debDesc.lpData; + memset(lpBufStart, 0, size); + lpPointer = lpBufStart; + /* + * Fill the execute buffer with instructions + */ + lpInsStart = lpPointer; + OP_STATE_TRANSFORM(3, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_WORLD, hWorld, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_VIEW, hView, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_PROJECTION, hProj, lpPointer); + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_AMBIENT, RGBA_MAKE(40, 40, 40, 40), lpPointer); + OP_EXIT(lpPointer); + /* + * Setup the execute data describing the buffer + */ + lpD3DExCmdBuf->lpVtbl->Unlock(lpD3DExCmdBuf); + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwInstructionOffset = (ULONG) 0; + d3dExData.dwInstructionLength = (ULONG) ((char *)lpPointer - (char*)lpInsStart); + lpD3DExCmdBuf->lpVtbl->SetExecuteData(lpD3DExCmdBuf, &d3dExData); + lpDev->lpVtbl->BeginScene(lpDev); + lpDev->lpVtbl->Execute(lpDev, lpD3DExCmdBuf, lpView, D3DEXECUTE_UNCLIPPED); + lpDev->lpVtbl->EndScene(lpDev); + /* + * We are done with the command buffer. + */ + lpD3DExCmdBuf->lpVtbl->Release(lpD3DExCmdBuf); + /* + * Setup materials and lights + */ + tube.hTex = TextureHandle[1]; + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpmat, NULL) != D3D_OK) + return FALSE; + memset(&mat, 0, sizeof(D3DMATERIAL)); + mat.dwSize = sizeof(D3DMATERIAL); + mat.diffuse.r = (D3DVALUE)1.0; + mat.diffuse.g = (D3DVALUE)1.0; + mat.diffuse.b = (D3DVALUE)1.0; + mat.diffuse.a = (D3DVALUE)1.0; + mat.ambient.r = (D3DVALUE)1.0; + mat.ambient.g = (D3DVALUE)1.0; + mat.ambient.b = (D3DVALUE)1.0; + mat.specular.r = (D3DVALUE)1.0; + mat.specular.g = (D3DVALUE)1.0; + mat.specular.b = (D3DVALUE)1.0; + mat.power = (float)20.0; + mat.dwRampSize = 16; + mat.hTexture = tube.hTex; + lpmat->lpVtbl->SetMaterial(lpmat, &mat); + lpmat->lpVtbl->GetHandle(lpmat, lpDev, &tube.hMat); + memset(&tube.light, 0, sizeof(D3DLIGHT)); + tube.light.dwSize = sizeof(D3DLIGHT); + tube.light.dltType = D3DLIGHT_POINT; + tube.light.dvPosition.x = tube.cameraP.x; + tube.light.dvPosition.y = tube.cameraP.y; + tube.light.dvPosition.z = tube.cameraP.z; + tube.light.dcvColor.r = D3DVAL(0.9); + tube.light.dcvColor.g = D3DVAL(0.9); + tube.light.dcvColor.b = D3DVAL(0.9); + tube.light.dvAttenuation0 = (float)0.0; + tube.light.dvAttenuation1 = (float)0.0; + tube.light.dvAttenuation2 = (float)0.05; + if (lpD3D->lpVtbl->CreateLight(lpD3D, &tube.lpD3DLight, NULL)!=D3D_OK) + return FALSE; + if (tube.lpD3DLight->lpVtbl->SetLight(tube.lpD3DLight, &tube.light) + !=D3D_OK) + return FALSE; + if (lpView->lpVtbl->AddLight(lpView, tube.lpD3DLight) != D3D_OK) + return FALSE; + + /* + * Create an execute buffer + */ + size = sizeof(D3DVERTEX) * NUM_V; + size += sizeof(D3DPROCESSVERTICES); + size += sizeof(D3DINSTRUCTION) * 6; + size += sizeof(D3DSTATE) * 4; + size += sizeof(D3DTRIANGLE) * NUM_TRI; + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + if (lpDev->lpVtbl->CreateExecuteBuffer(lpDev, &debDesc, &lpD3DExBuf, + NULL) != D3D_OK) + return FALSE; + /* + * lock it so it can be filled + */ + if (lpD3DExBuf->lpVtbl->Lock(lpD3DExBuf, &debDesc) != D3D_OK) + return FALSE; + lpBufStart = debDesc.lpData; + memset(lpBufStart, 0, size); + lpPointer = lpBufStart; + VERTEX_DATA(tube.lpV, NUM_V, lpPointer); + /* + * Save the location of the first instruction and add instructions to + * execute buffer. + */ + lpInsStart = lpPointer; + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_MATERIAL, tube.hMat, lpPointer); + OP_PROCESS_VERTICES(1, lpPointer); + PROCESSVERTICES_DATA(D3DPROCESSVERTICES_TRANSFORMLIGHT, 0, NUM_V, lpPointer); + OP_STATE_RENDER(3, lpPointer); + STATE_DATA(D3DRENDERSTATE_TEXTUREHANDLE, tube.hTex, lpPointer); + STATE_DATA(D3DRENDERSTATE_WRAPU, TRUE, lpPointer); + STATE_DATA(D3DRENDERSTATE_WRAPV, TRUE, lpPointer); + /* + * Make sure that the triangle data (not OP) will be QWORD aligned + */ + if (QWORD_ALIGNED(lpPointer)) { + OP_NOP(lpPointer); + } + OP_TRIANGLE_LIST(NUM_TRI, lpPointer); + tube.TriOffset = (char *)lpPointer - (char *)lpBufStart; + TRIANGLE_LIST_DATA(tube.lpTri, NUM_TRI, lpPointer); + OP_EXIT(lpPointer); + /* + * Setup the execute data describing the buffer + */ + lpD3DExBuf->lpVtbl->Unlock(lpD3DExBuf); + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwVertexCount = NUM_V; + d3dExData.dwInstructionOffset = (ULONG) ((char *)lpInsStart - (char *)lpBufStart); + d3dExData.dwInstructionLength = (ULONG) ((char *)lpPointer - (char *)lpInsStart); + lpD3DExBuf->lpVtbl->SetExecuteData(lpD3DExBuf, &d3dExData); + + return TRUE; +} diff --git a/sdk/samples/tunnel/tunnel.def b/sdk/samples/tunnel/tunnel.def new file mode 100644 index 0000000..f5b1670 --- /dev/null +++ b/sdk/samples/tunnel/tunnel.def @@ -0,0 +1,10 @@ +NAME tunnel.exe + +DESCRIPTION 'Direct3D Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/twist/makefile b/sdk/samples/twist/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/twist/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/twist/msvc.mk b/sdk/samples/twist/msvc.mk new file mode 100644 index 0000000..9a285ef --- /dev/null +++ b/sdk/samples/twist/msvc.mk @@ -0,0 +1,42 @@ +NAME = twist +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = twist.obj d3dapp.obj ddcalls.obj d3dcalls.obj texture.obj misc.obj d3dmain.obj stats.obj d3dmath.obj d3dsphr.obj lclib.obj + +!if "$(DEBUG)" == "debug" +COPT =-DDEBUG -DD3DDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DDEMO +!else +COPT =-Otyb1 -DD3DDEMO +LOPT =-debug:none +ROPT =-DD3DDEMO +!endif +DEF = $(NAME).def +RES = d3dmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/twist/readme.txt b/sdk/samples/twist/readme.txt new file mode 100644 index 0000000..4323ea5 --- /dev/null +++ b/sdk/samples/twist/readme.txt @@ -0,0 +1,7 @@ +Twist +Direct3D Immediate Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +Two ends of a flattened sphere are twisted in opposite directions. +All motion and twisting in done in the execute buffer by a series of +matrix multiplies. diff --git a/sdk/samples/twist/twist.c b/sdk/samples/twist/twist.c new file mode 100644 index 0000000..df66d6c --- /dev/null +++ b/sdk/samples/twist/twist.c @@ -0,0 +1,477 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: twist.c + * + ***************************************************************************/ + +#include <d3d.h> +#include <math.h> +#include <malloc.h> +#include "d3dmacs.h" +#include "d3ddemo.h" + +/* + * Globals to keep track of execute buffer + */ +static D3DEXECUTEDATA d3dExData; +static LPDIRECT3DEXECUTEBUFFER lpD3DExBuf; +static D3DEXECUTEBUFFERDESC debDesc; +LPDIRECT3DMATERIAL lpbmat; /* Object for background material */ +LPDIRECT3DLIGHT lpD3DLight; /* object for light */ +LPDIRECT3DMATERIAL lpred_mat, lpblue_mat; /* Objects for materials */ + +/* + * Global projection, view, world and identity matricies + */ +D3DMATRIXHANDLE hProj; +D3DMATRIXHANDLE hView; +D3DMATRIXHANDLE hSpin; +D3DMATRIXHANDLE hDSpin; +D3DMATRIXHANDLE hWorld; +D3DMATRIXHANDLE hWorld1; +D3DMATRIXHANDLE hWorld2; +D3DMATRIXHANDLE hDWorld1; +D3DMATRIXHANDLE hDWorld2; + +D3DMATRIX proj = { + D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(2.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(1.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(-1.0), D3DVAL(0.0) +}; +D3DMATRIX view = { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(10.0), D3DVAL(1.0) +}; +D3DMATRIX spin; +D3DMATRIX dspin; +D3DMATRIX world; +D3DMATRIX world1; +D3DMATRIX dworld1; +D3DMATRIX world2; +D3DMATRIX dworld2; +D3DMATRIX identity = { + D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), + D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), D3DVAL(1.0) +}; + +/* + * A structure which holds the object's data + */ +struct { + D3DMATERIALHANDLE hred_mat, hblue_mat; /* two material handles */ + D3DTEXTUREHANDLE hTex; /* texture map handles */ + LPD3DVERTEX lpV; /* object's vertices */ + LPD3DTRIANGLE lpTri; /* object's triangles */ + int num_vertices, num_faces; +} objData; + +#define PI 3.14159265359 + +void +OverrideDefaults(Defaults* defaults) +{ + lstrcpy(defaults->Name, "Twist D3D Example"); +} + +/* + * A function to rotate a number of D3DVERTEX points around the X axis. + */ +void +XRotateD3DVERTEX(float theta, int count, LPD3DVERTEX lpV) +{ + float st, ct; + int i; + + st = (float)sin(theta); ct = (float)cos(theta); + for (i = 0; i < count; i++) { + float y, z; + y = lpV[i].y; z = lpV[i].z; + lpV[i].y = ct * y + st * z; + lpV[i].z = -st * y + ct * z; + y = lpV[i].ny; z = lpV[i].nz; + lpV[i].ny = ct * y + st * z; + lpV[i].nz = -st * y + ct * z; + } +} + + +/* + * Renders the scene + */ +BOOL +RenderScene(LPDIRECT3DDEVICE lpDev, LPDIRECT3DVIEWPORT lpView, + LPD3DRECT lpExtent) +{ + HRESULT ddrval; + + /* + * Execute the instruction buffer and blt + */ + ddrval = lpDev->lpVtbl->BeginScene(lpDev); + if (ddrval != D3D_OK) + return FALSE; + ddrval = lpDev->lpVtbl->Execute(lpDev, lpD3DExBuf, lpView, D3DEXECUTE_CLIPPED); + if (ddrval != D3D_OK) + return FALSE; + ddrval = lpDev->lpVtbl->EndScene(lpDev); + if (ddrval != D3D_OK) + return FALSE; + ddrval = lpD3DExBuf->lpVtbl->GetExecuteData(lpD3DExBuf, &d3dExData); + if (ddrval != D3D_OK) + return FALSE; + /* + * Return the extent + */ + *lpExtent = d3dExData.dsStatus.drExtent; + return TRUE; +} + + +void +ReleaseScene(void) +{ + if (objData.lpTri) + free(objData.lpTri); + if (objData.lpV) + free(objData.lpV); +} + +void +ReleaseView(LPDIRECT3DVIEWPORT lpView) +{ + if (lpView) + lpView->lpVtbl->DeleteLight(lpView, lpD3DLight); + RELEASE(lpbmat); + RELEASE(lpred_mat); + RELEASE(lpblue_mat); + RELEASE(lpD3DExBuf); + RELEASE(lpD3DLight); +} + +/* + * Builds the scene + */ +BOOL +InitScene(void) +{ + int i; + /* + * Generate the sphere which will be used as the twisted object. Scale + * one axis long. Rotate the sphere around the x axis so the end caps + * are around the z axis (for effect). Stretch one end of the sphere + * out to allow an easier view of the twisting. + */ + if (!(GenerateSphere((float)1.7, 9, 15, (float)1.0, (float)2.0, + (float)1.0, &objData.lpV, &objData.lpTri, + &objData.num_vertices, &objData.num_faces))) + return FALSE; + + /* + * As we are going to twist the sphere the quads in the sphere will + * no longer stay flat. We need to change all start flat setting to just + * start. + */ + for (i = 0; i < objData.num_faces; i++) { + if (((objData.lpTri[i].wFlags & 0x1f) < 30) && + ((objData.lpTri[i].wFlags & 0x1f) > 0)) { + objData.lpTri[i].wFlags &= ~0x1f; + } + } + + XRotateD3DVERTEX((float)(PI / 2.0), objData.num_vertices, objData.lpV); + for (i = 0; i < objData.num_vertices; i++) + if (objData.lpV[i].z > 0) objData.lpV[i].z += (float)2.0; + return TRUE; +} + +/* + * Initializes the execute buffer for rendering. + */ +#define DT 0.05 /* amount to twist, different from spin for effect */ +#define DS 0.08 /* amount to spin world each time */ +BOOL +InitView(LPDIRECTDRAW lpDD, LPDIRECT3D lpD3D, LPDIRECT3DDEVICE lpDev, + LPDIRECT3DVIEWPORT lpView, int NumTextures, + LPD3DTEXTUREHANDLE TextureHandle) +{ + /* Variables for execute buffer generation */ + LPDIRECT3DEXECUTEBUFFER lpD3DExCmdBuf; + LPD3DTRIANGLE lpTri; + LPVOID lpBufStart, lpInsStart, lpPointer; + size_t size; + + /* Materials and lights */ + D3DLIGHT light; + D3DMATERIAL bmat; + D3DMATERIALHANDLE hbmat; + D3DMATERIAL red_mat, blue_mat; + + int i; + float ct, st; + + HRESULT ddrval; + + /* + * Set background to black material + */ + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpbmat, NULL) != D3D_OK) + return FALSE; + memset(&bmat, 0, sizeof(D3DMATERIAL)); + bmat.dwSize = sizeof(D3DMATERIAL); + bmat.dwRampSize = 1; + ddrval = lpbmat->lpVtbl->SetMaterial(lpbmat, &bmat); + ddrval = lpbmat->lpVtbl->GetHandle(lpbmat, lpDev, &hbmat); + ddrval = lpView->lpVtbl->SetBackground(lpView, hbmat); + + /* + * Set the view, world and projection matrices + */ + MAKE_MATRIX(lpDev, hView, view); + MAKE_MATRIX(lpDev, hProj, proj); + MAKE_MATRIX(lpDev, hWorld, identity); + MAKE_MATRIX(lpDev, hSpin, identity); + MAKE_MATRIX(lpDev, hWorld1, identity); + MAKE_MATRIX(lpDev, hWorld2, identity); + + /* + * Setup the matrices which spin the buffer + */ + ct = D3DVAL(cos(DS)); + st = D3DVAL(sin(DS)); + dspin = identity; + dspin._11 = ct; + dspin._13 = -st; + dspin._31 = st; + dspin._33 = ct; + MAKE_MATRIX(lpDev, hDSpin, dspin); + + ct = D3DVAL(cos(DT)); + st = D3DVAL(sin(DT)); + dworld1 = identity; + dworld1._11 = ct; + dworld1._21 = -st; + dworld1._12 = st; + dworld1._22 = ct; + MAKE_MATRIX(lpDev, hDWorld1, dworld1); + + ct = D3DVAL(cos(-DT)); + st = D3DVAL(sin(-DT)); + dworld2 = identity; + dworld2._11 = ct; + dworld2._21 = -st; + dworld2._12 = st; + dworld2._22 = ct; + MAKE_MATRIX(lpDev, hDWorld2, dworld2); + + /* + * Use an execute buffer to set some transform state + */ + size = 0; + size += sizeof(D3DINSTRUCTION) * 3; + size += sizeof(D3DSTATE) * 3; + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + if (lpDev->lpVtbl->CreateExecuteBuffer(lpDev, &debDesc, &lpD3DExCmdBuf, + NULL) != D3D_OK) + return FALSE; + if (lpD3DExCmdBuf->lpVtbl->Lock(lpD3DExCmdBuf, &debDesc) != D3D_OK) + return FALSE; + lpBufStart = debDesc.lpData; + memset(lpBufStart, 0, size); + lpPointer = lpBufStart; + + lpInsStart = lpPointer; + OP_STATE_TRANSFORM(2, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_PROJECTION, hProj, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_VIEW, hView, lpPointer); + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_AMBIENT, RGBA_MAKE(20, 20, 20, 20), lpPointer); + OP_EXIT(lpPointer); + + lpD3DExCmdBuf->lpVtbl->Unlock(lpD3DExCmdBuf); + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwInstructionOffset = (ULONG) 0; + d3dExData.dwInstructionLength = (ULONG) ((char *)lpPointer - (char *)lpInsStart); + lpD3DExCmdBuf->lpVtbl->SetExecuteData(lpD3DExCmdBuf, &d3dExData); + ddrval = lpDev->lpVtbl->BeginScene(lpDev); + if (ddrval != D3D_OK) + return FALSE; + lpDev->lpVtbl->Execute(lpDev, lpD3DExCmdBuf, lpView, D3DEXECUTE_UNCLIPPED); + ddrval = lpDev->lpVtbl->EndScene(lpDev); + if (ddrval != D3D_OK) + return FALSE; + lpD3DExCmdBuf->lpVtbl->Release(lpD3DExCmdBuf); + + /* + * Create each material, set its description and obtain a handle to it. + */ + objData.hTex = TextureHandle[1]; + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpred_mat, NULL) != D3D_OK) + return FALSE; + memset(&red_mat, 0, sizeof(D3DMATERIAL)); + red_mat.dwSize = sizeof(D3DMATERIAL); + red_mat.diffuse.r = (D3DVALUE)1.0; + red_mat.diffuse.g = (D3DVALUE)0.8; + red_mat.diffuse.b = (D3DVALUE)0.8; + red_mat.diffuse.a = (D3DVALUE)1.0; + red_mat.ambient.r = (D3DVALUE)1.0; + red_mat.ambient.g = (D3DVALUE)0.0; + red_mat.ambient.b = (D3DVALUE)0.0; + red_mat.specular.r = (D3DVALUE)1.0; + red_mat.specular.g = (D3DVALUE)1.0; + red_mat.specular.b = (D3DVALUE)1.0; + red_mat.power = (float)20.0; + red_mat.dwRampSize = 16; + red_mat.hTexture = objData.hTex; + lpred_mat->lpVtbl->SetMaterial(lpred_mat, &red_mat); + lpred_mat->lpVtbl->GetHandle(lpred_mat, lpDev, &objData.hred_mat); + if (lpD3D->lpVtbl->CreateMaterial(lpD3D, &lpblue_mat, NULL) != D3D_OK) + return FALSE; + memset(&blue_mat, 0, sizeof(D3DMATERIAL)); + blue_mat.dwSize = sizeof(D3DMATERIAL); + blue_mat.diffuse.r = (D3DVALUE)0.5; + blue_mat.diffuse.g = (D3DVALUE)0.5; + blue_mat.diffuse.b = (D3DVALUE)1.0; + blue_mat.diffuse.a = (D3DVALUE)1.0; + blue_mat.ambient.r = (D3DVALUE)0.0; + blue_mat.ambient.g = (D3DVALUE)0.0; + blue_mat.ambient.b = (D3DVALUE)1.0; + blue_mat.specular.r = (D3DVALUE)1.0; + blue_mat.specular.g = (D3DVALUE)1.0; + blue_mat.specular.b = (D3DVALUE)1.0; + blue_mat.power = (float)20.0; + blue_mat.dwRampSize = 16; + blue_mat.hTexture = objData.hTex; + lpblue_mat->lpVtbl->SetMaterial(lpblue_mat, &blue_mat); + lpblue_mat->lpVtbl->GetHandle(lpblue_mat, lpDev, &objData.hblue_mat); + + /* + * Create the main execute buffer + */ + size = sizeof(D3DVERTEX) * objData.num_vertices * 2; /* two copies */ + size += sizeof(D3DPROCESSVERTICES) * 2; + size += sizeof(D3DSTATUS) * 1; + size += sizeof(D3DINSTRUCTION) * 16; + size += sizeof(D3DSTATE) * 6; + size += sizeof(D3DMATRIXMULTIPLY) * 5; + size += sizeof(D3DTRIANGLE) * objData.num_faces; + + memset(&debDesc, 0, sizeof(D3DEXECUTEBUFFERDESC)); + debDesc.dwSize = sizeof(D3DEXECUTEBUFFERDESC); + debDesc.dwFlags = D3DDEB_BUFSIZE; + debDesc.dwBufferSize = size; + if (lpDev->lpVtbl->CreateExecuteBuffer(lpDev, &debDesc, &lpD3DExBuf, + NULL) != D3D_OK) + return FALSE; + if (lpD3DExBuf->lpVtbl->Lock(lpD3DExBuf, &debDesc) != D3D_OK) + return FALSE; + lpBufStart = debDesc.lpData; + memset(lpBufStart, 0, size); + lpPointer = lpBufStart; + /* + * Copy two sets of the vertices into the buffer for the first render. + */ + VERTEX_DATA(objData.lpV, objData.num_vertices, lpPointer); + VERTEX_DATA(objData.lpV, objData.num_vertices, lpPointer); + + lpInsStart = lpPointer; + OP_SET_STATUS(D3DSETSTATUS_ALL, D3DSTATUS_DEFAULT, 2048, 2048, 0, 0, lpPointer); + OP_MATRIX_MULTIPLY(1, lpPointer); + MATRIX_MULTIPLY_DATA(hDSpin, hSpin, hSpin, lpPointer); + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_MATERIAL, objData.hblue_mat, lpPointer); + OP_MATRIX_MULTIPLY(1, lpPointer); + MATRIX_MULTIPLY_DATA(hWorld1, hDWorld1, hWorld1, lpPointer); + OP_MATRIX_MULTIPLY(1, lpPointer); + MATRIX_MULTIPLY_DATA(hWorld1, hSpin, hWorld, lpPointer); + OP_STATE_TRANSFORM(1, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_WORLD, hWorld, lpPointer); + OP_PROCESS_VERTICES(1, lpPointer); + PROCESSVERTICES_DATA(D3DPROCESSVERTICES_TRANSFORMLIGHT, 0, objData.num_vertices, lpPointer); + + OP_STATE_LIGHT(1, lpPointer); + STATE_DATA(D3DLIGHTSTATE_MATERIAL, objData.hred_mat, lpPointer); + OP_MATRIX_MULTIPLY(1, lpPointer); + MATRIX_MULTIPLY_DATA(hWorld2, hDWorld2, hWorld2, lpPointer); + OP_MATRIX_MULTIPLY(1, lpPointer); + MATRIX_MULTIPLY_DATA(hWorld2, hSpin, hWorld, lpPointer); + OP_STATE_TRANSFORM(1, lpPointer); + STATE_DATA(D3DTRANSFORMSTATE_WORLD, hWorld, lpPointer); + OP_PROCESS_VERTICES(1, lpPointer); + PROCESSVERTICES_DATA(D3DPROCESSVERTICES_TRANSFORMLIGHT, objData.num_vertices, objData.num_vertices, lpPointer); + OP_STATE_RENDER(2, lpPointer); + STATE_DATA(D3DRENDERSTATE_TEXTUREHANDLE, objData.hTex, lpPointer); + STATE_DATA(D3DRENDERSTATE_WRAPU, TRUE, lpPointer); + /* + * Make sure that the triangle data (not OP) will be QWORD aligned + */ + if (QWORD_ALIGNED(lpPointer)) { + OP_NOP(lpPointer); + } + OP_TRIANGLE_LIST(objData.num_faces, lpPointer); + lpTri = lpPointer; + TRIANGLE_LIST_DATA(objData.lpTri, objData.num_faces, lpPointer); + /* + * If the z coordinate of a vertex referenced by a triangle is > 0, + * make the triangle reference the same vertex in the second copy of + * the vetices. + */ + for (i = 0; i < objData.num_faces; i++) { + if (objData.lpV[lpTri->v1].z > 0) + lpTri->v1 += objData.num_vertices; + if (objData.lpV[lpTri->v2].z > 0) + lpTri->v2 += objData.num_vertices; + if (objData.lpV[lpTri->v3].z > 0) + lpTri->v3 += objData.num_vertices; + lpTri++; + } + OP_EXIT(lpPointer); + + lpD3DExBuf->lpVtbl->Unlock(lpD3DExBuf); + /* + * Setup the execute data describing the buffer + */ + memset(&d3dExData, 0, sizeof(D3DEXECUTEDATA)); + d3dExData.dwSize = sizeof(D3DEXECUTEDATA); + d3dExData.dwVertexCount = objData.num_vertices * 2; + d3dExData.dwInstructionOffset = (ULONG)((char *)lpInsStart - (char *)lpBufStart); + d3dExData.dwInstructionLength = (ULONG)((char*)lpPointer - (char *)lpInsStart); + lpD3DExBuf->lpVtbl->SetExecuteData(lpD3DExBuf, &d3dExData); + + /* + * Add one light. + */ + memset(&light, 0, sizeof(D3DLIGHT)); + light.dwSize = sizeof(D3DLIGHT); + light.dltType = D3DLIGHT_DIRECTIONAL; + light.dcvColor.r = D3DVAL(0.9); + light.dcvColor.g = D3DVAL(0.9); + light.dcvColor.b = D3DVAL(0.9); + light.dcvColor.a = D3DVAL(1.0); + light.dvDirection.x = D3DVALP(0.0, 12); + light.dvDirection.y = D3DVALP(0.0, 12); + light.dvDirection.z = D3DVALP(1.0, 12); + light.dvAttenuation0 = (float)1.0; + light.dvAttenuation1 = (float)0.0; + light.dvAttenuation2 = (float)0.0; + if (lpD3D->lpVtbl->CreateLight(lpD3D, &lpD3DLight, NULL) != D3D_OK) + return FALSE; + if (lpD3DLight->lpVtbl->SetLight(lpD3DLight, &light) != D3D_OK) + return FALSE; + if (lpView->lpVtbl->AddLight(lpView, lpD3DLight) != D3D_OK) + return FALSE; + + return TRUE; +} + + diff --git a/sdk/samples/twist/twist.def b/sdk/samples/twist/twist.def new file mode 100644 index 0000000..4016568 --- /dev/null +++ b/sdk/samples/twist/twist.def @@ -0,0 +1,10 @@ +NAME twist.exe + +DESCRIPTION 'Direct3D Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/uvis/makefile b/sdk/samples/uvis/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/uvis/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/uvis/msvc.mk b/sdk/samples/uvis/msvc.mk new file mode 100644 index 0000000..179ee54 --- /dev/null +++ b/sdk/samples/uvis/msvc.mk @@ -0,0 +1,42 @@ +NAME = uvis +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = uvis.obj rmmain.obj rmerror.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -DD3DRMDEMO -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG -DD3DRMDEMO +!else +COPT =-YX -Otyb1 -DD3DRMDEMO +LOPT =-debug:none +ROPT =-DD3DRMDEMO +!endif +DEF = $(NAME).def +RES = rmmain.res + +CFLAGS =$(COPT) -D_X86_ $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/uvis/readme.txt b/sdk/samples/uvis/readme.txt new file mode 100644 index 0000000..f10b5ed --- /dev/null +++ b/sdk/samples/uvis/readme.txt @@ -0,0 +1,7 @@ +Uvis +Direct3D Retained Mode Sample +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +This is an important example demonstrating how D3D can be used with +D3DRM. It demonstrates how a D3D immediate mode execute buffer can be +used as a visual in a D3D retained mode scene. diff --git a/sdk/samples/uvis/uvis.cpp b/sdk/samples/uvis/uvis.cpp new file mode 100644 index 0000000..95ab752 --- /dev/null +++ b/sdk/samples/uvis/uvis.cpp @@ -0,0 +1,533 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: uvis.cpp + * + ***************************************************************************/ + +#include <math.h> +#include <stdlib.h> +#include <d3d.h> +#include "d3dmacs.h" +#include "rmdemo.h" + +typedef struct _Flame { + int valid; + D3DVECTOR velocity; /* direction the flame is going */ + D3DVECTOR orientation; /* random vector normal to velocity */ + D3DVECTOR position; /* current position */ + int time; /* current time */ + int lifetime; /* time to die */ +} Flame; + +/* + * A flame is a diamond shape oriented along its direction vector. + * This updates the four vertices of the flame, given its current time. + */ +void UpdateFlame(Flame* flame, D3DVERTEX v[]) +{ + D3DVECTOR dir = flame->velocity; + D3DVECTOR off = flame->orientation; + D3DVECTOR norm; + D3DVECTOR start, end, left, right; + double size; + int i; + + D3DRMVectorNormalise(&dir); + + /* + * Calculate a normal vector to the flame + */ + D3DRMVectorCrossProduct(&norm, &dir, &off); + D3DRMVectorNormalise(&norm); + + /* + * The size starts off small, gets bigger towards the middle + * and smaller towards the end. + */ + if (flame->time < flame->lifetime / 2) + size = (double) flame->time / (double)(flame->lifetime / 2); + else + size = ((double) (flame->lifetime - flame->time) + / (double)(flame->lifetime / 2)); + + /* + * Calculate the four corners of the diamond. + */ + D3DRMVectorScale(&dir, &dir, D3DVAL(size)); + D3DRMVectorScale(&off, &off, D3DVAL(size / 4)); + start = flame->position; + D3DRMVectorAdd(&end, &start, &dir); + D3DRMVectorScale(&dir, &dir, D3DVAL(0.5)); + D3DRMVectorAdd(&left, &start, &dir); + right = left; + D3DRMVectorAdd(&left, &left, &off); + D3DRMVectorSubtract(&right, &right, &off); + + + /* + * Update the flame's position. + */ + D3DRMVectorAdd(&flame->position, &flame->position, &flame->velocity); + flame->time++; + if (flame->time == flame->lifetime) + flame->valid = 0; + + /* + * And fill in the vertices. There are eight, four for each side of + * the flame. + */ + i = 0; + v[i].x = start.x; v[i].y = start.y; v[i].z = start.z; + v[i].nx = -norm.x; v[i].ny = -norm.y; v[i].nz = -norm.z; + v[i].tu = D3DVAL(0); v[i].tv = D3DVAL(0); + i++; + + v[i].x = left.x; v[i].y = left.y; v[i].z = left.z; + v[i].nx = -norm.x; v[i].ny = -norm.y; v[i].nz = -norm.z; + v[i].tu = D3DVAL(1); v[i].tv = D3DVAL(0); + i++; + + v[i].x = end.x; v[i].y = end.y; v[i].z = end.z; + v[i].nx = -norm.x; v[i].ny = -norm.y; v[i].nz = -norm.z; + v[i].tu = D3DVAL(1); v[i].tv = D3DVAL(1); + i++; + + v[i].x = right.x; v[i].y = right.y; v[i].z = right.z; + v[i].nx = -norm.x; v[i].ny = -norm.y; v[i].nz = -norm.z; + v[i].tu = D3DVAL(0); v[i].tv = D3DVAL(1); + i++; + + v[i].x = start.x; v[i].y = start.y; v[i].z = start.z; + v[i].nx = norm.x; v[i].ny = norm.y; v[i].nz = norm.z; + v[i].tu = D3DVAL(0); v[i].tv = D3DVAL(0); + i++; + + v[i].x = right.x; v[i].y = right.y; v[i].z = right.z; + v[i].nx = norm.x; v[i].ny = norm.y; v[i].nz = norm.z; + v[i].tu = D3DVAL(0); v[i].tv = D3DVAL(1); + i++; + + v[i].x = end.x; v[i].y = end.y; v[i].z = end.z; + v[i].nx = norm.x; v[i].ny = norm.y; v[i].nz = norm.z; + v[i].tu = D3DVAL(1); v[i].tv = D3DVAL(1); + i++; + + v[i].x = left.x; v[i].y = left.y; v[i].z = left.z; + v[i].nx = norm.x; v[i].ny = norm.y; v[i].nz = norm.z; + v[i].tu = D3DVAL(1); v[i].tv = D3DVAL(0); + i++; + +} + +void InitFlame(Flame* flame) +{ + D3DVECTOR d, u; + + flame->valid = TRUE; + + do { + D3DRMVectorRandom(&d); + d.y = d.y * d.y; + d.y = d.y * d.y; + } while (d.y < D3DVAL(0.3)); + + /* + * Pick a vector normal to d + */ + if (d.y != D3DVAL(0.0) || d.z != D3DVAL(0.0)) + { + u.x = D3DVAL(0.0); + if (d.y == D3DVAL(0.0)) + { + u.y = D3DVAL(1.0); + u.z = D3DVAL(0.0); + } else { + D3DVALUE n_fix = + D3DVAL(1.0) + + D3DDivide(D3DMultiply(d.z, d.z), D3DMultiply(d.y, d.y)); + u.z = D3DVAL(sqrt(D3DDivide(D3DVAL(1.0), D3DVAL(n_fix)))); + u.y = -D3DMultiply(u.z, D3DDivide(d.z, d.y)); + } + } else { + u.x = D3DVAL(0.0); + u.y = D3DVAL(0.0); + u.z = D3DVAL(1.0); + } + + /* + * Randomize it. + */ + D3DRMVectorRotate(&u, &u, &d, D3DDivide(D3DVAL(6.28 * (rand() % 100)), + D3DVAL(100.0))); + + D3DRMVectorScale(&d, &d, D3DVAL(0.1)); + flame->velocity = d; + flame->orientation = u; + flame->position.x = D3DVAL(0); + flame->position.y = D3DVAL(0); + flame->position.z = D3DVAL(0); + flame->time = 0; + do { + flame->lifetime = rand() % 30; + } while (flame->lifetime < 5); +} + +#define MAX_FLAMES 100 + +typedef struct _Fire { + Flame flames[MAX_FLAMES]; + LPDIRECT3DRMDEVICE dev; + LPDIRECT3DEXECUTEBUFFER eb; + LPDIRECT3DMATERIAL mat; +} Fire; + +void CDECL CleanupFireObjects(LPDIRECT3DRMOBJECT dev, void* arg) +{ + Fire* fire = (Fire*) arg; + + if (fire->eb) { + fire->eb->Release(); + fire->mat->Release(); + fire->eb = NULL; + fire->dev = NULL; + } +} + +typedef struct _FireExecuteBuffer { + D3DVERTEX v[8 * MAX_FLAMES]; + D3DINSTRUCTION op_state_light1; + D3DSTATE state1; + D3DINSTRUCTION op_set_status; + D3DSTATUS setstatus1; + D3DINSTRUCTION op_process_vertices1; + D3DPROCESSVERTICES processvertices1; + D3DINSTRUCTION op_state_render; + D3DSTATE state2; + D3DINSTRUCTION op_triangle_list; + D3DTRIANGLE tri[4 * MAX_FLAMES]; + D3DINSTRUCTION exit1; +} FireExecuteBuffer; + +BOOL CreateFireObjects(Fire* fire, LPDIRECT3DRMDEVICE dev) +{ + D3DEXECUTEBUFFERDESC desc; + D3DEXECUTEDATA data; + LPDIRECT3D lpD3D = NULL; + LPDIRECT3DDEVICE lpD3DDev = NULL; + LPDIRECT3DMATERIAL mat = NULL; + LPDIRECT3DEXECUTEBUFFER eb = NULL; + D3DMATERIALHANDLE hMat; + D3DMATERIAL orange; + void* p; + int i; + + RELEASE(fire->eb); + + dev->GetDirect3DDevice(&lpD3DDev); + if (!lpD3DDev) + goto generic_error; + if (FAILED(lpD3DDev->GetDirect3D(&lpD3D))) + goto generic_error; + + desc.dwSize = sizeof(desc); + desc.dwFlags = D3DDEB_BUFSIZE; + desc.dwBufferSize = sizeof(FireExecuteBuffer); + + if (FAILED(lpD3DDev->CreateExecuteBuffer(&desc, &eb, NULL))) + goto generic_error; + + if (FAILED(lpD3D->CreateMaterial(&mat, NULL))) + goto generic_error; + if (FAILED(mat->GetHandle(lpD3DDev, &hMat))) + goto generic_error; + + memset(&orange, 0, sizeof(orange)); + orange.dwSize = sizeof(orange); + orange.diffuse.r = D3DVAL(1.0); + orange.diffuse.g = D3DVAL(0.5); + orange.diffuse.b = D3DVAL(0.0); + orange.ambient.r = D3DVAL(1.0); + orange.ambient.g = D3DVAL(0.5); + orange.ambient.b = D3DVAL(0.0); + orange.dwRampSize = 32; + if (FAILED(mat->SetMaterial(&orange))) + goto generic_error; + + if (FAILED(eb->Lock(&desc))) + goto generic_error; + p = (void*) ((char*) desc.lpData + 8 * MAX_FLAMES * sizeof(D3DVERTEX)); + + OP_STATE_LIGHT(1, p); + STATE_DATA(D3DLIGHTSTATE_MATERIAL, hMat, p); + + OP_SET_STATUS(D3DSETSTATUS_ALL, D3DSTATUS_DEFAULT, 2048, 2048, 0, 0, p); + + OP_PROCESS_VERTICES(1, p); + PROCESSVERTICES_DATA(D3DPROCESSVERTICES_TRANSFORMLIGHT, + 0, 8 * MAX_FLAMES, p); + OP_STATE_RENDER(1, p); + STATE_DATA(D3DRENDERSTATE_SHADEMODE, D3DSHADE_FLAT, p); + OP_TRIANGLE_LIST(4 * MAX_FLAMES, p); + for (i = 0; i < MAX_FLAMES; i++) { + D3DTRIANGLE* t; + int base; + + t = (D3DTRIANGLE*) p; + base = 4 * i; + + t->v1 = base + 0; + t->v2 = base + 1; + t->v3 = base + 3; + t->wFlags = D3DTRIFLAG_EDGEENABLETRIANGLE; + t++; + + t->v1 = base + 1; + t->v2 = base + 2; + t->v3 = base + 3; + t->wFlags = D3DTRIFLAG_EDGEENABLETRIANGLE; + t++; + + t->v1 = base + 0; + t->v2 = base + 1; + t->v3 = base + 3; + t->wFlags = D3DTRIFLAG_EDGEENABLETRIANGLE; + t++; + + t->v1 = base + 1; + t->v2 = base + 2; + t->v3 = base + 3; + t->wFlags = D3DTRIFLAG_EDGEENABLETRIANGLE; + t++; + + p = (char*) t; + } + OP_EXIT(p); + + if (FAILED(eb->Unlock())) + goto generic_error; + + data.dwSize = sizeof(data); + data.dwVertexOffset = 0; + data.dwVertexCount = 8 * MAX_FLAMES; + data.dwInstructionOffset = 8 * MAX_FLAMES * sizeof(D3DVERTEX); + data.dwInstructionLength = sizeof(FireExecuteBuffer) - data.dwInstructionOffset; + data.dwHVertexOffset = 0; + if (FAILED(eb->SetExecuteData(&data))) + goto generic_error; + + fire->eb = eb; + fire->mat = mat; + fire->dev = dev; + if (FAILED(dev->AddDestroyCallback(CleanupFireObjects, fire))) + goto generic_error; + + RELEASE(lpD3DDev); + RELEASE(lpD3D); + return TRUE; +generic_error: + RELEASE(lpD3D); + RELEASE(lpD3DDev); + RELEASE(mat); + RELEASE(eb); + return FALSE; +} + +BOOL RenderFire(Fire* fire, LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view) +{ + D3DVERTEX* v; + D3DEXECUTEBUFFERDESC desc; + D3DEXECUTEDATA data; + LPDIRECT3DDEVICE lpD3DDev = NULL; + LPDIRECT3DVIEWPORT lpD3DView = NULL; + int i; + + if (fire->dev != dev) { + if (!CreateFireObjects(fire, dev)) + return FALSE; + } + + dev->GetDirect3DDevice(&lpD3DDev); + view->GetDirect3DViewport(&lpD3DView); + if (!lpD3DDev || !lpD3DView) + goto ret_with_error; + + for (i = 0; i < MAX_FLAMES; i++) + if (!fire->flames[i].valid) + InitFlame(&fire->flames[i]); + + desc.dwSize = sizeof(desc); + desc.dwFlags = 0; + + if (FAILED(fire->eb->Lock(&desc))) + goto ret_with_error; + v = (D3DVERTEX*) desc.lpData; + + for (i = 0; i < MAX_FLAMES; i++) + UpdateFlame(&fire->flames[i], &v[8 * i]); + + if (FAILED(fire->eb->Unlock())) + goto ret_with_error; + + if (FAILED(lpD3DDev->Execute(fire->eb, lpD3DView, D3DEXECUTE_CLIPPED))) + goto ret_with_error; + + data.dwSize = sizeof data; + if (FAILED(fire->eb->GetExecuteData(&data))) + goto ret_with_error; + if (FAILED(view->ForceUpdate(data.dsStatus.drExtent.x1, + data.dsStatus.drExtent.y1, + data.dsStatus.drExtent.x2, + data.dsStatus.drExtent.y2))) + goto ret_with_error; + + RELEASE(lpD3DDev); + RELEASE(lpD3DView); + return TRUE; +ret_with_error: + RELEASE(lpD3DDev); + RELEASE(lpD3DView); + return FALSE; +} + +int CDECL FireCallback(LPDIRECT3DRMUSERVISUAL uvis, + void* arg, + D3DRMUSERVISUALREASON reason, + LPDIRECT3DRMDEVICE dev, + LPDIRECT3DRMVIEWPORT view) +{ + Fire* fire = (Fire*) arg; + + if (reason == D3DRMUSERVISUAL_CANSEE) + return TRUE; + + if (reason == D3DRMUSERVISUAL_RENDER) { + if (!RenderFire(fire, dev, view)) + return DDERR_GENERIC; + else + return D3D_OK; + } + + return 0; +} + +void CDECL DestroyFire(LPDIRECT3DRMOBJECT obj, void* arg) +{ + Fire* fire = (Fire*) arg; + + if (fire->dev) + fire->dev->DeleteDestroyCallback(CleanupFireObjects, arg); + CleanupFireObjects((LPDIRECT3DRMOBJECT)fire->dev, (void*) fire); + free(fire); +} + +LPDIRECT3DRMUSERVISUAL CreateFire() +{ + Fire* fire; + LPDIRECT3DRMUSERVISUAL uvis = NULL; + + fire = (Fire*)malloc(sizeof(Fire)); + if (!fire) + goto ret_with_error; + memset(fire, 0, sizeof(Fire)); + + if (FAILED(lpD3DRM->CreateUserVisual(FireCallback, (void*) fire, &uvis))) + goto ret_with_error; + if (FAILED(uvis->AddDestroyCallback(DestroyFire, (void*) fire))) + goto ret_with_error; + return uvis; +ret_with_error: + if (fire) + free(fire); + RELEASE(uvis); + return NULL; +} + +BOOL +BuildScene(LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMVIEWPORT view, + LPDIRECT3DRMFRAME scene, LPDIRECT3DRMFRAME camera) +{ + D3DRMRENDERQUALITY quality = D3DRMRENDER_GOURAUD; + LPDIRECT3DRMFRAME lights = NULL; + LPDIRECT3DRMFRAME frame = NULL; + LPDIRECT3DRMLIGHT light1 = NULL; + LPDIRECT3DRMLIGHT light2 = NULL; + LPDIRECT3DRMUSERVISUAL uvis = NULL; + + view = view; /* not used */ + + if (FAILED(dev->SetQuality(quality))) + goto generic_error; + + /* + * initialize the lights in the scene + */ + if (FAILED(lpD3DRM->CreateFrame(scene, &lights))) + goto generic_error; + if (FAILED(lights->SetPosition(scene, D3DVAL(5), D3DVAL(5), -D3DVAL(1)))) + goto generic_error; + if(FAILED(lights->SetOrientation(scene, D3DVAL(0), D3DVAL(0), D3DVAL(1), + D3DVAL(0), D3DVAL(1), D3DVAL(1)))) + goto generic_error; + if(FAILED(lpD3DRM->CreateLightRGB(D3DRMLIGHT_DIRECTIONAL, D3DVAL(0.9), + D3DVAL(0.8), D3DVAL(0.7), &light1))) + goto generic_error; + if (FAILED(lights->AddLight(light1))) + goto generic_error; + if(FAILED(lpD3DRM->CreateLightRGB(D3DRMLIGHT_AMBIENT, D3DVAL(0.1), + D3DVAL(0.1), D3DVAL(0.1), &light2))) + goto generic_error; + if (FAILED(scene->AddLight(light2))) + goto generic_error; + + /* + * create a frame within the scene + */ + if (FAILED(lpD3DRM->CreateFrame(scene, &frame))) + goto generic_error; + + /* + * add the fire into the frame + */ + uvis = CreateFire(); + if (!uvis) + goto generic_error; + if (FAILED(frame->AddVisual(uvis))) + goto generic_error; + + /* + * set up the frames position, orientation and rotation + */ + if (FAILED(camera->SetPosition(scene, D3DVAL(0), D3DVAL(0.5), -D3DVAL(10)))) + goto generic_error; + if(FAILED(camera->SetOrientation(scene, D3DVAL(0), D3DVAL(0), D3DVAL(1), D3DVAL(0), + D3DVAL(1), D3DVAL(0)))) + goto generic_error; + if(FAILED(frame->SetRotation(scene, D3DVAL(0), D3DVAL(1), D3DVAL(0), + D3DVAL(0.02)))) + goto generic_error; + + RELEASE(uvis); + RELEASE(frame); + RELEASE(lights); + RELEASE(light1); + RELEASE(light2); + return TRUE; +generic_error: + Msg("A failure occurred while building the scene.\n"); + RELEASE(lights); + RELEASE(frame); + RELEASE(light1); + RELEASE(light2); + RELEASE(uvis); + return FALSE; +} + +void +OverrideDefaults(Defaults *defaults) +{ + defaults->bConstRenderQuality = TRUE; + defaults->bNoTextures = TRUE; + lstrcpy(defaults->Name, "User Visual Direct3DRM Example"); +} diff --git a/sdk/samples/uvis/uvis.def b/sdk/samples/uvis/uvis.def new file mode 100644 index 0000000..a32736b --- /dev/null +++ b/sdk/samples/uvis/uvis.def @@ -0,0 +1,10 @@ +NAME uvis.exe + +DESCRIPTION 'Direct3DRM Example Program (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/viewer/color.cpp b/sdk/samples/viewer/color.cpp new file mode 100644 index 0000000..55b3ee3 --- /dev/null +++ b/sdk/samples/viewer/color.cpp @@ -0,0 +1,49 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: color.cpp + * + ***************************************************************************/ + +#include <d3drmwin.h> +#include "viewer.h" +#include <windows.h> +#include <string.h> +#include <d3drm.h> + +int ChooseNewColor(HWND win, D3DCOLOR* current) +{ + CHOOSECOLOR cc; + COLORREF clr; + COLORREF aclrCust[16]; + int i; + + for (i = 0; i < 16; i++) + aclrCust[i] = RGB(255, 255, 255); + + clr = + RGB + ( (int) (255 * D3DRMColorGetRed(*current)), + (int) (255 * D3DRMColorGetGreen(*current)), + (int) (255 * D3DRMColorGetBlue(*current)) + ); + + memset(&cc, 0, sizeof(CHOOSECOLOR)); + cc.lStructSize = sizeof(CHOOSECOLOR); + cc.hwndOwner = win; + cc.rgbResult = clr; + cc.lpCustColors = aclrCust; + cc.Flags = CC_RGBINIT|CC_FULLOPEN; + + if (ChooseColor(&cc)) + { *current = + D3DRMCreateColorRGB + ( D3DVAL(GetRValue(cc.rgbResult) / D3DVAL(255.0)), + D3DVAL(GetGValue(cc.rgbResult) / D3DVAL(255.0)), + D3DVAL(GetBValue(cc.rgbResult) / D3DVAL(255.0)) + ); + return TRUE; + } + else return FALSE; +} diff --git a/sdk/samples/viewer/file.cpp b/sdk/samples/viewer/file.cpp new file mode 100644 index 0000000..3b9089d --- /dev/null +++ b/sdk/samples/viewer/file.cpp @@ -0,0 +1,54 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: file.cpp + * + ***************************************************************************/ + +#include <d3drmwin.h> +#include "viewer.h" +#include <windows.h> +#include <stdio.h> +#include <string.h> + +char* OpenNewFile( HWND hwnd, const char *wndTitle ) +{ + static char file[256]; + static char fileTitle[256]; + static char filter[] = "X files (*.x)\0*.x\0" + "All Files (*.*)\0*.*\0"; + OPENFILENAME ofn; + + lstrcpy( file, ""); + lstrcpy( fileTitle, ""); + + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwnd; +#ifdef WIN32 + ofn.hInstance = (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE); +#else + ofn.hInstance = (HINSTANCE) GetWindowWord(hwnd, GWW_HINSTANCE); +#endif + ofn.lpstrFilter = filter; + ofn.lpstrCustomFilter = (LPSTR) NULL; + ofn.nMaxCustFilter = 0L; + ofn.nFilterIndex = 1L; + ofn.lpstrFile = file; + ofn.nMaxFile = sizeof(file); + ofn.lpstrFileTitle = fileTitle; + ofn.nMaxFileTitle = sizeof(fileTitle); + ofn.lpstrInitialDir = NULL; + ofn.lpstrTitle = wndTitle; + ofn.nFileOffset = 0; + ofn.nFileExtension = 0; + ofn.lpstrDefExt = "*.x"; + ofn.lCustData = 0; + + ofn.Flags = OFN_SHOWHELP | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; + + if (GetOpenFileName(&ofn)) + return (char*)ofn.lpstrFile; + else + return NULL; +} diff --git a/sdk/samples/viewer/makefile b/sdk/samples/viewer/makefile new file mode 100644 index 0000000..8d3d892 --- /dev/null +++ b/sdk/samples/viewer/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\d3dbld.mk diff --git a/sdk/samples/viewer/msvc.mk b/sdk/samples/viewer/msvc.mk new file mode 100644 index 0000000..190aa08 --- /dev/null +++ b/sdk/samples/viewer/msvc.mk @@ -0,0 +1,48 @@ +NAME = viewer +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib d3drm.lib ddraw.lib\ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = viewer.obj sel.obj file.obj color.obj rodcone.obj + +!if "$(DEBUG)" == "debug" +COPT =-DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-Otyb1 +LOPT =-debug:none +ROPT = +!endif +DEF = $(NAME).def +RES = viewer.res + +CFLAGS =$(COPT) -D_X86_ -DSTRICT $(CDEBUG) -DUSE_FLOAT -Fo$@ +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\d3dsdk.mk + +xaf.obj: ..\xaf.cpp + @$(CC) @<< +$(CFLAGS) -W1 -c -Foxaf.obj ..\xaf.cpp +<< + + +$(NAME).$(EXT): \ + $(OBJS) ..\$(NAME).def $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +-def:..\$(NAME).def +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/viewer/readme.txt b/sdk/samples/viewer/readme.txt new file mode 100644 index 0000000..bbfa5b7 --- /dev/null +++ b/sdk/samples/viewer/readme.txt @@ -0,0 +1,32 @@ +Direct3DRM Object Viewer +Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + +This is a stand alone D3DRM app that allows you to load and view 3d +objects. + +The initial scene has a light source in the top right. To see this the +view can be moved backwards and forwards using the T and R +keys. Additional objects can be loaded from the file menu, and new +light sources can be added from the lights menu. Objects can be +rotated with the left mouse button and dragged with the right. + +The last object that was rotated or dragged remains the current +selection. + +The device quality can be altered using the Renderer menu. Using this +menu the type of device used can also be switched from ramp to +RGB. When using the RGB device the color of lights in the scene can be +changed in the same way as you change the color of objects. In 256 +color mode it is advisable to dither an RGB device for best results. + +Additional keyboard controls + +T Forwards +R Back +Z Move current selection forwards +X Move current selection back. +Ctrl+G Gouraud shade +Ctrl+F Flat Shade +Ctrl+D Dither toggle. +Arrow Keys Move left/right/up/down +Delete Delete the current selection. diff --git a/sdk/samples/viewer/rodcone.cpp b/sdk/samples/viewer/rodcone.cpp new file mode 100644 index 0000000..3332cac --- /dev/null +++ b/sdk/samples/viewer/rodcone.cpp @@ -0,0 +1,270 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rodcone.cpp + * + ***************************************************************************/ + +/* + * Sample code for building objects out of rods and cones. + */ + +#include <d3drmwin.h> +#include "viewer.h" +#include "rodcone.h" +#include <math.h> + +static unsigned long rod_faces[] = +{ 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, /* end 1 */ + 4, 0, 0, 1, 1, 9, 1, 8, 0, /* side 0 */ + 4, 1, 1, 2, 2, 10, 2, 9, 1, /* side 1 */ + 4, 2, 2, 3, 3, 11, 3, 10, 2, /* side 2 */ + 4, 3, 3, 4, 4, 12, 4, 11, 3, /* side 3 */ + 4, 4, 4, 5, 5, 13, 5, 12, 4, /* side 4 */ + 4, 5, 5, 6, 6, 14, 6, 13, 5, /* side 5 */ + 4, 6, 6, 7, 7, 15, 7, 14, 6, /* side 6 */ + 4, 7, 7, 0, 0, 8, 0, 15, 7, /* side 7 */ + 8, 8, 0, 9, 1, 10, 2, 11, 3, 12, 4, 13, 5, 14, 6, 15, 7, /* end 2 */ + 0, +}; + +void AddRod(LPDIRECT3DRMMESHBUILDER mesh, D3DVALUE radius, D3DVECTOR a, D3DVECTOR b) +{ + D3DVECTOR d, u, r; + D3DVECTOR v[16]; + D3DVECTOR n[8]; + D3DVALUE f; + int i; + + /* + * Find the unit vector along the rod. + */ + d.x = b.x - a.x; + d.y = b.y - a.y; + d.z = b.z - a.z; + D3DRMVectorNormalise(&d); + + /* + * Pick a vector normal to d + */ + if (d.y != D3DVAL(0.0) || d.z != D3DVAL(0.0)) + { u.x = D3DVAL(0.0); + if (d.y == D3DVAL(0.0)) + { u.y = D3DVAL(1.0); + u.z = D3DVAL(0.0); + } else + { D3DVALUE n_fix = + D3DVAL(1.0) + + D3DDivide(D3DMultiply(d.z, d.z), D3DMultiply(d.y, d.y)); +#ifdef FIXED_POINT_API + double un_val = (double)n_fix / (double)(1<<16); + u.z = D3DVAL(sqrt(1/un_val)); +#else + u.z = D3DVAL(sqrt(D3DDivide(D3DVAL(1.0), D3DVAL(n_fix)))); +#endif + u.y = -D3DMultiply(u.z, D3DDivide(d.z, d.y)); + } + } else + { u.x = D3DVAL(0.0); + u.y = D3DVAL(0.0); + u.z = D3DVAL(1.0); + } + + /* + * Now find a vector normal to them both, to give us a coordinate + * system in the plane normal to the rod. + */ + D3DRMVectorCrossProduct(&r, &d, &u); + + /* + * Scale down the coordinates to the radius of the rod. + */ + u.x = D3DMultiply(u.x, radius); + u.y = D3DMultiply(u.y, radius); + u.z = D3DMultiply(u.z, radius); + r.x = D3DMultiply(r.x, radius); + r.y = D3DMultiply(r.y, radius); + r.z = D3DMultiply(r.z, radius); + + /* + * Calculate the corners of an octagon. + */ + f = D3DVAL((float)sqrt(2.0) / (2 * (1 + (float)sqrt(2.0) / 2))); + v[0].x = u.x + D3DMultiply(r.x, f); + v[0].y = u.y + D3DMultiply(r.y, f); + v[0].z = u.z + D3DMultiply(r.z, f); + + v[1].x = D3DMultiply(u.x, f) + r.x; + v[1].y = D3DMultiply(u.y, f) + r.y; + v[1].z = D3DMultiply(u.z, f) + r.z; + + v[2].x = D3DMultiply(-u.x, f) + r.x; + v[2].y = D3DMultiply(-u.y, f) + r.y; + v[2].z = D3DMultiply(-u.z, f) + r.z; + + v[3].x = -u.x + D3DMultiply(r.x, f); + v[3].y = -u.y + D3DMultiply(r.y, f); + v[3].z = -u.z + D3DMultiply(r.z, f); + + v[4].x = -u.x - D3DMultiply(r.x, f); + v[4].y = -u.y - D3DMultiply(r.y, f); + v[4].z = -u.z - D3DMultiply(r.z, f); + + v[5].x = D3DMultiply(-u.x, f) - r.x; + v[5].y = D3DMultiply(-u.y, f) - r.y; + v[5].z = D3DMultiply(-u.z, f) - r.z; + + v[6].x = D3DMultiply(u.x, f) - r.x; + v[6].y = D3DMultiply(u.y, f) - r.y; + v[6].z = D3DMultiply(u.z, f) - r.z; + + v[7].x = u.x - D3DMultiply(r.x, f); + v[7].y = u.y - D3DMultiply(r.y, f); + v[7].z = u.z - D3DMultiply(r.z, f); + + /* + * Add the rod endpoints and calculate the vertex normals. + */ + for (i = 0; i < 8; i++) + { n[i] = v[i]; + D3DRMVectorNormalise(&n[i]); + v[i + 8].x = v[i].x + b.x; + v[i + 8].y = v[i].y + b.y; + v[i + 8].z = v[i].z + b.z; + v[i].x += a.x; + v[i].y += a.y; + v[i].z += a.z; + } + + /* + * Now add the faces. + */ + mesh->AddFaces(16, v, 8, n, rod_faces, NULL); +} + +static unsigned long cone_faces[] = +{ 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, /* end 1 */ + 3, 0, 0, 1, 1, 8, 1, /* side 0 */ + 3, 1, 1, 2, 2, 8, 1, /* side 1 */ + 3, 2, 2, 3, 3, 8, 1, /* side 2 */ + 3, 3, 3, 4, 4, 8, 1, /* side 3 */ + 3, 4, 4, 5, 5, 8, 1, /* side 4 */ + 3, 5, 5, 6, 6, 8, 1, /* side 5 */ + 3, 6, 6, 7, 7, 8, 1, /* side 6 */ + 3, 7, 7, 0, 0, 8, 1, /* side 7 */ + 0, +}; + +void AddCone(LPDIRECT3DRMMESHBUILDER mesh, D3DVALUE radius, D3DVECTOR a, D3DVECTOR b) +{ + D3DVECTOR d, u, r; + D3DVECTOR v[16]; + D3DVECTOR n[8]; + D3DVALUE f; + int i; + + /* + * Find the unit vector along the rod. + */ + d.x = b.x - a.x; + d.y = b.y - a.y; + d.z = b.z - a.z; + D3DRMVectorNormalise(&d); + + /* + * Pick a vector normal to d + */ + if (d.y != D3DVAL(0.0) || d.z != D3DVAL(0.0)) + { u.x = D3DVAL(0.0); + if (d.y == D3DVAL(0.0)) + { u.y = D3DVAL(1.0); + u.z = D3DVAL(0.0); + } else + { D3DVALUE n_fix = + D3DVAL(1.0) + + D3DDivide(D3DMultiply(d.z, d.z), D3DMultiply(d.y, d.y)); +#ifdef FIXED_POINT_API + double un_val = (double)n_fix / (double)(1<<16); + u.z = D3DVAL(sqrt(1 / un_val)); +#else + u.z = D3DVAL(sqrt(D3DVAL(1.0) / D3DVAL(n_fix))); +#endif + u.y = - D3DDivide(D3DMultiply(u.z, d.z), d.y); + } + } else + { u.x = D3DVAL(0.0); + u.y = D3DVAL(0.0); + u.z = D3DVAL(1.0); + } + + /* + * Now find a vector normal to them both, to give us a coordinate + * system in the plane normal to the rod. + */ + D3DRMVectorCrossProduct(&r, &d, &u); + + /* + * Scale down the coordinates to the radius of the rod. + */ + u.x = D3DMultiply(u.x, radius); + u.y = D3DMultiply(u.y, radius); + u.z = D3DMultiply(u.z, radius); + r.x = D3DMultiply(r.x, radius); + r.y = D3DMultiply(r.y, radius); + r.z = D3DMultiply(r.z, radius); + + /* + * Calculate the corners of an octagon. + */ + f = D3DVAL((float)sqrt(2.0) / (2 * (1 + (float)sqrt(2.0) / 2))); + v[0].x = u.x + D3DMultiply(r.x, f); + v[0].y = u.y + D3DMultiply(r.y, f); + v[0].z = u.z + D3DMultiply(r.z, f); + + v[1].x = D3DMultiply(u.x, f) + r.x; + v[1].y = D3DMultiply(u.y, f) + r.y; + v[1].z = D3DMultiply(u.z, f) + r.z; + + v[2].x = D3DMultiply(-u.x, f) + r.x; + v[2].y = D3DMultiply(-u.y, f) + r.y; + v[2].z = D3DMultiply(-u.z, f) + r.z; + + v[3].x = -u.x + D3DMultiply(r.x, f); + v[3].y = -u.y + D3DMultiply(r.y, f); + v[3].z = -u.z + D3DMultiply(r.z, f); + + v[4].x = -u.x - D3DMultiply(r.x, f); + v[4].y = -u.y - D3DMultiply(r.y, f); + v[4].z = -u.z - D3DMultiply(r.z, f); + + v[5].x = D3DMultiply(-u.x, f) - r.x; + v[5].y = D3DMultiply(-u.y, f) - r.y; + v[5].z = D3DMultiply(-u.z, f) - r.z; + + v[6].x = D3DMultiply(u.x, f) - r.x; + v[6].y = D3DMultiply(u.y, f) - r.y; + v[6].z = D3DMultiply(u.z, f) - r.z; + + v[7].x = u.x - D3DMultiply(r.x, f); + v[7].y = u.y - D3DMultiply(r.y, f); + v[7].z = u.z - D3DMultiply(r.z, f); + + v[8] = b; + + /* + * Calculate the vertex normals. + */ + for (i = 0; i < 8; i++) + { n[i] = v[i]; + D3DRMVectorNormalise(&n[0]); + v[i].x += a.x; + v[i].y += a.y; + v[i].z += a.z; + } + + /* + * Now add the faces. + */ + mesh->AddFaces(9, v, 8, n, cone_faces, NULL); +} diff --git a/sdk/samples/viewer/rodcone.h b/sdk/samples/viewer/rodcone.h new file mode 100644 index 0000000..528792a --- /dev/null +++ b/sdk/samples/viewer/rodcone.h @@ -0,0 +1,10 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: rodcone.h + * + ***************************************************************************/ + +void AddRod(LPDIRECT3DRMMESHBUILDER mesh, D3DVALUE radius, D3DVECTOR a, D3DVECTOR b); +void AddCone(LPDIRECT3DRMMESHBUILDER mesh, D3DVALUE radius, D3DVECTOR a, D3DVECTOR b); diff --git a/sdk/samples/viewer/sel.cpp b/sdk/samples/viewer/sel.cpp new file mode 100644 index 0000000..af1da11 --- /dev/null +++ b/sdk/samples/viewer/sel.cpp @@ -0,0 +1,250 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: sel.cpp + * + ***************************************************************************/ + +#include <math.h> +#include <d3drmwin.h> +#include "sel.h" +#include "rodcone.h" +#include "viewer.h" + +static int showBoxes = FALSE; +static LPDIRECT3DRMFRAME sFrame = NULL; +static LPDIRECT3DRMMESHBUILDER sVisual = NULL; +static LPDIRECT3DRMLIGHT sLight = NULL; +static LPDIRECT3DRMMESH selectionBox = NULL; +static LPDIRECT3DRMMESHBUILDER makeBox(D3DRMBOX*); + +LPDIRECT3DRMFRAME clipboardFrame = NULL; +LPDIRECT3DRMVISUAL clipboardVisual = NULL; + +void ShowBoxes(int show) +{ + showBoxes = show; + SelectVisual(sVisual, sFrame); +} + +int ToggleBoxes() +{ + ShowBoxes(!showBoxes); + return showBoxes; +} + +LPDIRECT3DRMFRAME SelectedFrame() +{ + return sFrame; +} + +LPDIRECT3DRMMESHBUILDER SelectedVisual() +{ + return sVisual; +} + +LPDIRECT3DRMLIGHT SelectedLight() +{ + return sLight; +} + +void DeselectVisual() +{ + if (sFrame && selectionBox) + sFrame->DeleteVisual(selectionBox); + sFrame = NULL; + sVisual = NULL; + selectionBox = NULL; +} + +void SelectVisual(LPDIRECT3DRMMESHBUILDER visual, LPDIRECT3DRMFRAME frame) +{ + DeselectVisual(); + sVisual = visual; + sFrame = frame; + + if (sVisual) + { LPDIRECT3DRMLIGHTARRAY lights; + + sLight = 0; + sFrame->GetLights(&lights); + if (lights) + { if (lights->GetSize()) + { lights->GetElement(0, &sLight); + sLight->Release(); /* reinstate reference count */ + } + lights->Release(); + } + + if (showBoxes && visual) + { D3DRMBOX box; + LPDIRECT3DRMMESHBUILDER builder; + + sVisual->GetBox(&box); + builder = makeBox(&box); + builder->CreateMesh(&selectionBox); + sFrame->AddVisual(selectionBox); + selectionBox->Release(); + } + } +} + +void FindAndSelectVisual(LPDIRECT3DRMVIEWPORT view, int x, int y) +{ + LPDIRECT3DRMVISUAL visual; + LPDIRECT3DRMFRAME frame; + LPDIRECT3DRMPICKEDARRAY picked; + LPDIRECT3DRMFRAMEARRAY frames; + LPDIRECT3DRMMESHBUILDER mesh; + + /* + * Make sure we don't try to select the selection box of the current + * selection. + */ + DeselectVisual(); + + view->Pick(x, y, &picked); + if (picked) + { if (picked->GetSize()) + { + picked->GetPick(0, &visual, &frames, 0); + frames->GetElement(frames->GetSize() - 1, &frame); + + if (SUCCEEDED(visual->QueryInterface(IID_IDirect3DRMMeshBuilder, (void **) &mesh))) + { SelectVisual(mesh, frame); + mesh->Release(); + } + + frame->Release(); + frames->Release(); + visual->Release(); + } + picked->Release(); + } +} + +void CutVisual() +{ + LPDIRECT3DRMFRAME frame; + + if (clipboardFrame) + clipboardFrame->Release(); + + if (sFrame) { + clipboardFrame = sFrame; + clipboardVisual = sVisual; + + DeselectVisual(); + + clipboardFrame->AddRef(); + clipboardFrame->GetParent(&frame); + if (frame) { + frame->DeleteChild(clipboardFrame); + frame->Release(); + } + } +} + +void CopyVisual() +{ + LPDIRECT3DRMFRAME frame; + + if (clipboardFrame) + clipboardFrame->Release(); + + if (sFrame) { + sFrame->Clone(0, IID_IDirect3DRMFrame, (void **) &clipboardFrame); + sVisual->Clone(0, IID_IDirect3DRMVisual, (void **) &clipboardVisual); + + clipboardFrame->AddVisual(clipboardVisual); + clipboardVisual->Release(); + + clipboardFrame->GetParent(&frame); + if (frame) { + frame->DeleteChild(clipboardFrame); + frame->Release(); + } + } +} + +void PasteVisual(LPDIRECT3DRMFRAME scene) +{ + if (clipboardFrame) + { + LPDIRECT3DRMFRAME frame; + LPDIRECT3DRMVISUAL visual; + + clipboardFrame->Clone(0, IID_IDirect3DRMFrame, (void **) &frame); + clipboardVisual->Clone(0, IID_IDirect3DRMVisual, (void **) &visual); + + frame->AddVisual(visual); + scene->AddChild(frame); + visual->Release(); + frame->Release(); + } +} + +void DeleteVisual() +{ + if (sFrame) + { + LPDIRECT3DRMFRAME parent, frame = sFrame; + + DeselectVisual(); + frame->GetParent(&parent); + parent->DeleteChild(frame); + parent->Release(); + } +} + +void ClearClipboard() +{ + if (clipboardFrame) + clipboardFrame->Release(); +} + +static LPDIRECT3DRMMESHBUILDER makeBox(D3DRMBOX* box) +{ + LPDIRECT3DRMMESHBUILDER mesh; + static D3DVECTOR zero = {D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)}; + static D3DVECTOR dir = {D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)}; + D3DVECTOR a, b; + + lpD3DRM->CreateMeshBuilder(&mesh); + + dir.z = box->max.z + D3DVAL(1.0); + AddRod(mesh, D3DVAL(0.05), zero, dir); + a = dir; + a.z += D3DVAL(0.6); + AddCone(mesh, D3DVAL(0.2), dir, a); + a = box->min; + b = a; + b.y = box->max.y; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.x = box->max.x; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.y = box->min.y; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.x = box->min.x; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.z = box->max.z; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.x = box->max.x; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.y = box->max.y; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.x = box->min.x; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b; b.y = box->min.y; + AddRod(mesh, D3DVAL(0.05), a, b); + b.y = box->max.y; a = b; b.z = box->min.z; + AddRod(mesh, D3DVAL(0.05), a, b); + a = b = box->max; b.z = box->min.z; + AddRod(mesh, D3DVAL(0.05), a, b); + a.y = box->min.y; b = a; b.z = box->min.z; + AddRod(mesh, D3DVAL(0.05), a, b); + + mesh->SetColor(D3DRMCreateColorRGB(D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0))); + return mesh; +} diff --git a/sdk/samples/viewer/sel.h b/sdk/samples/viewer/sel.h new file mode 100644 index 0000000..be90cd7 --- /dev/null +++ b/sdk/samples/viewer/sel.h @@ -0,0 +1,21 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: sel.h + * + ***************************************************************************/ + +void ShowBoxes(int); +int ToggleBoxes(void); +LPDIRECT3DRMFRAME SelectedFrame(void); +LPDIRECT3DRMMESHBUILDER SelectedVisual(void); +LPDIRECT3DRMLIGHT SelectedLight(void); +void DeselectVisual(void); +void SelectVisual(LPDIRECT3DRMMESHBUILDER visual, LPDIRECT3DRMFRAME frame); +void FindAndSelectVisual(LPDIRECT3DRMVIEWPORT view, int x, int y); +void CutVisual(void); +void CopyVisual(void); +void PasteVisual(LPDIRECT3DRMFRAME scene); +void DeleteVisual(void); +void ClearClipboard(void); diff --git a/sdk/samples/viewer/viewer.cpp b/sdk/samples/viewer/viewer.cpp new file mode 100644 index 0000000..26a5228 --- /dev/null +++ b/sdk/samples/viewer/viewer.cpp @@ -0,0 +1,1703 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: viewer.cpp + * + ***************************************************************************/ + +#define INITGUID +#include <d3drmwin.h> +#include "viewer.h" + +#include <windows.h> +#include <stdio.h> +#include <string.h> +#include <malloc.h> +#include <math.h> +#include <direct.h> +#include "sel.h" + +static char ViewerClass[32] = "ViewerClass"; +static BOOL Render(void); +HRESULT loadTextures(char *name, void *arg, LPDIRECT3DRMTEXTURE *tex); + +typedef struct _AppInfo +{ + LPDIRECT3DRMFRAME scene, camera; + LPDIRECT3DRMDEVICE dev; + LPDIRECT3DRMVIEWPORT view; + D3DRMCOLORMODEL model; + BOOL bMinimized; +} AppInfo; + +AppInfo *active_window = NULL; + +LPDIRECT3DRM lpD3DRM = 0; +LPDIRECTDRAWCLIPPER lpDDClipper = 0; +BOOL bQuit = FALSE; + +static BOOL FirstInstance(HINSTANCE); +static HWND AnyInstance(HINSTANCE this_inst, int cmdshow); +long FAR PASCAL WindowProc(HWND, UINT, WPARAM, LPARAM); +static BOOL CreateDevice(HWND, AppInfo*); +static void Idle(); +char* MyErrorToString(HRESULT error); + +/* Msg + * Message output for error notification. + */ +void __cdecl +Msg( LPSTR fmt, ... ) +{ + char buff[256]; + + wvsprintf(buff, fmt, (char *)(&fmt+1)); + lstrcat(buff, "\r\n"); + MessageBox( NULL, buff, "Viewer Message", MB_OK ); +} + + +char* LSTRRCHR( const char* lpString, int bChar ) +{ + if( lpString != NULL ) + { + const char* lpBegin; + + lpBegin = lpString; + + while( *lpString != 0 ) + { + lpString++; + } + + while( 1 ) + { + if( *lpString == bChar ) + { + return (char*)lpString; + } + + if( lpString == lpBegin ) + { + break; + } + + lpString--; + } + } + + return NULL; +} /* LSTRRCHR */ + +/* + * Initialization, message loop + */ +int PASCAL WinMain + (HINSTANCE this_inst, HINSTANCE prev_inst, LPSTR cmdline, int cmdshow) +{ + MSG msg; + int idle; + int done = FALSE; + HACCEL accel; + HRESULT rval; + HWND hwnd; + + prev_inst = prev_inst; + cmdline = cmdline; + + rval = Direct3DRMCreate(&lpD3DRM); + if (rval != D3DRM_OK) { + Msg("Failed to create Direct3DRM.\n%s", MyErrorToString(rval)); + return 1; + } + if (!prev_inst) + if (!FirstInstance(this_inst)) + return 1; + + if (!(hwnd = AnyInstance(this_inst, cmdshow))) + return 1; + accel = LoadAccelerators(this_inst, "ViewerAccel"); + + while (!done) { + idle = TRUE; + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + idle = FALSE; + if (msg.message == WM_QUIT || bQuit) { + done = TRUE; + break; + } + if (!TranslateAccelerator(msg.hwnd, accel, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + if (done) { + break; + } else if (!active_window->bMinimized && !bQuit) { + if (idle) Idle(); + if (!Render()) { + Msg("Rendering failed.\n"); + done = TRUE; + break; + } + } else { + WaitMessage(); + } + } + RELEASE(active_window->scene); + RELEASE(active_window->camera); + RELEASE(active_window->view); + RELEASE(active_window->dev); + ClearClipboard(); + RELEASE(lpD3DRM); + RELEASE(lpDDClipper); + DestroyWindow(hwnd); + return msg.wParam; +} + +/* + * Register window class for the application, and do any other + * application initialization + */ +static BOOL FirstInstance(HINSTANCE this_inst) +{ + WNDCLASS wc; + BOOL rc; + + /* + * set up and register window class + */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = sizeof(DWORD); + wc.hInstance = this_inst; + wc.hIcon = LoadIcon(this_inst, "ViewerIcon"); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = "ViewerMenu"; + wc.lpszClassName = ViewerClass; + rc = RegisterClass(&wc); + + return rc; +} + +/* + * Do work required for every instance of the application: + * create the window, initialize data + */ +static HWND AnyInstance(HINSTANCE this_inst, int cmdshow) +{ + HWND win; + AppInfo *info; + + /* + * create main window + */ + win = + CreateWindow + ( ViewerClass, /* class */ + "Direct3D Object Viewer",/* caption */ + WS_OVERLAPPEDWINDOW, /* style */ + CW_USEDEFAULT, /* init. x pos */ + CW_USEDEFAULT, /* init. y pos */ + 400, /* init. x size */ + 400, /* init. y size */ + NULL, /* parent window */ + NULL, /* menu handle */ + this_inst, /* program handle */ + NULL /* create parms */ + ); + + + if (!win) return FALSE; + + /* + * Create a clipper for this window + */ + if (FAILED(DirectDrawCreateClipper(0, &lpDDClipper, NULL))) { + return FALSE; + } + if (FAILED(lpDDClipper->SetHWnd(0, win))) { + RELEASE(lpDDClipper); + return FALSE; + } + /* + * set up data associated with this window + */ + info = (AppInfo*) malloc(sizeof(AppInfo)); + SetWindowLong(win, 0, (long) info); + info->model = D3DCOLOR_MONO; + if (!CreateDevice(win, info)) { + return FALSE; + } + + /* + * display window + */ + ShowWindow(win, cmdshow); + UpdateWindow(win); + + return win; +} + +/* + * Processes messages for the about dialog. + */ +BOOL FAR PASCAL AboutDlgProc + (HWND win, unsigned msg, WORD wparam, LONG lparam) +{ + lparam = lparam; + + switch (msg) + { + case WM_INITDIALOG: + return TRUE; + + case WM_COMMAND: + if (wparam == IDOK) + { EndDialog(win, TRUE); + return TRUE; + } + break; + } + return FALSE; +} + +/* + * Create a simple scene. + */ +static BOOL CreateScene(AppInfo* info) +{ + LPDIRECT3DRMFRAME frame = NULL; + LPDIRECT3DRMFRAME light = NULL; + LPDIRECT3DRMMESHBUILDER builder = NULL; + LPDIRECT3DRMLIGHT light1 = NULL; + LPDIRECT3DRMLIGHT light2 = NULL; + LPDIRECT3DRMMATERIAL mat = NULL; + HRESULT rval; + + if (FAILED(lpD3DRM->CreateFrame(NULL, &info->scene))) + goto generic_error; + if (FAILED(lpD3DRM->CreateLightRGB(D3DRMLIGHT_DIRECTIONAL, D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0), &light1))) + goto generic_error; + if (FAILED(lpD3DRM->CreateLightRGB(D3DRMLIGHT_AMBIENT, D3DVAL(0.1), D3DVAL(0.1), D3DVAL(0.1), &light2))) + goto generic_error; + + if (FAILED(lpD3DRM->CreateFrame(info->scene, &light))) + goto generic_error; + if (FAILED(light->SetPosition(info->scene, D3DVAL(2.0), D3DVAL(2.0), D3DVAL(5.0)))) + goto generic_error; + if (FAILED(light->SetOrientation(info->scene, D3DVAL(-1.0), D3DVAL(-1.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0)))) + goto generic_error; + if (FAILED(light->AddLight(light1))) + goto generic_error; + RELEASE(light1); + if (FAILED(info->scene->AddLight(light2))) + goto generic_error; + RELEASE(light2); + if (FAILED(lpD3DRM->CreateMeshBuilder(&builder))) + goto generic_error; + rval = builder->Load("camera.x", NULL, D3DRMLOAD_FROMFILE, NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load camera.x.\n%s", MyErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(builder->SetQuality(D3DRMRENDER_UNLITFLAT))) + goto generic_error; + if (FAILED(light->AddVisual(builder))) + goto generic_error; + RELEASE(builder); + RELEASE(light); + + if (FAILED(lpD3DRM->CreateFrame(info->scene, &frame))) + goto generic_error; + if (FAILED(frame->SetRotation(info->scene, D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(-0.02)))) + goto generic_error; + if (FAILED(frame->SetPosition(info->scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(10.0)))) + goto generic_error; + if (FAILED(lpD3DRM->CreateMeshBuilder(&builder))) + goto generic_error; + rval = builder->Load("mslogo.x", NULL, D3DRMLOAD_FROMFILE, + loadTextures, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load mslogo.x.\n%s", MyErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(builder->SetColorRGB(D3DVAL(0.8), D3DVAL(0.8), D3DVAL(0.8)))) + goto generic_error; + if (FAILED(lpD3DRM->CreateMaterial(D3DVAL(10.0), &mat))) + goto generic_error; + if (FAILED(builder->SetMaterial(mat))) + goto generic_error; + + RELEASE(mat); + if (FAILED(frame->AddVisual(builder))) + goto generic_error; + RELEASE(builder); + RELEASE(frame); + + if (FAILED(lpD3DRM->CreateFrame(info->scene, &info->camera))) + goto generic_error; + if (FAILED(info->camera->SetPosition(info->scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)))) + goto generic_error; + return TRUE; +generic_error: + Msg("A failure occurred while creating the scene.\n"); +ret_with_error: + RELEASE(frame); + RELEASE(light); + RELEASE(builder); + RELEASE(light1); + RELEASE(light2); + RELEASE(mat); + return FALSE; +} + +static DWORD bppToddbd(int bpp) +{ + switch(bpp) { + case 1: + return DDBD_1; + case 2: + return DDBD_2; + case 4: + return DDBD_4; + case 8: + return DDBD_8; + case 16: + return DDBD_16; + case 24: + return DDBD_24; + case 32: + return DDBD_32; + } + return 0; +} + + +/* + * Find a device, preferably hardware, for a particular color model. + */ +LPGUID +FindDevice(D3DCOLORMODEL cm) +{ + LPDIRECTDRAW lpDD; + LPDIRECT3D lpD3D; + D3DFINDDEVICESEARCH search; + static D3DFINDDEVICERESULT result; + HRESULT error; + HDC hdc; + int bpp; + + hdc = GetDC(NULL); + bpp = GetDeviceCaps(hdc, BITSPIXEL); + ReleaseDC(NULL, hdc); + + if (DirectDrawCreate(NULL, &lpDD, NULL)) + return NULL; + + if (lpDD->QueryInterface(IID_IDirect3D, (void**) &lpD3D)) { + lpDD->Release(); + return NULL; + } + + memset(&search, 0, sizeof search); + search.dwSize = sizeof search; + search.dwFlags = D3DFDS_COLORMODEL; + search.dcmColorModel = (cm == D3DCOLOR_MONO) ? D3DCOLOR_MONO : D3DCOLOR_RGB; + + memset(&result, 0, sizeof result); + result.dwSize = sizeof result; + + error = lpD3D->FindDevice(&search, &result); + + if (error == DD_OK) { + /* + * If the device found is hardware but cannot support the current + * bit depth, then fall back to software rendering. + */ + if (result.ddHwDesc.dwFlags + && !(result.ddHwDesc.dwDeviceRenderBitDepth & bppToddbd(bpp))) { + + search.dwFlags |= D3DFDS_HARDWARE; + search.bHardware = FALSE; + memset(&result, 0, sizeof result); + result.dwSize = sizeof result; + error = lpD3D->FindDevice(&search, &result); + } + } + + lpD3D->Release(); + lpDD->Release(); + + if (error) + return NULL; + else + return &result.guid; +} + +/* + * Create the device and viewport. + */ +static BOOL CreateDevice(HWND win, AppInfo* info) +{ + RECT r; + int bpp; + HDC hdc; + + GetClientRect(win, &r); + if (FAILED(lpD3DRM->CreateDeviceFromClipper(lpDDClipper, FindDevice(info->model), + r.right, r.bottom, &info->dev))) + goto generic_error; + hdc = GetDC(win); + bpp = GetDeviceCaps(hdc, BITSPIXEL); + ReleaseDC(win, hdc); + switch (bpp) + { + case 1: + if (FAILED(info->dev->SetShades(4))) + goto generic_error; + if (FAILED(lpD3DRM->SetDefaultTextureShades(4))) + goto generic_error; + break; + case 16: + if (FAILED(info->dev->SetShades(32))) + goto generic_error; + if (FAILED(lpD3DRM->SetDefaultTextureColors(64))) + goto generic_error; + if (FAILED(lpD3DRM->SetDefaultTextureShades(32))) + goto generic_error; + if (FAILED(info->dev->SetDither(FALSE))) + goto generic_error; + break; + case 24: + case 32: + if (FAILED(info->dev->SetShades(256))) + goto generic_error; + if (FAILED(lpD3DRM->SetDefaultTextureColors(64))) + goto generic_error; + if (FAILED(lpD3DRM->SetDefaultTextureShades(256))) + goto generic_error; + if (FAILED(info->dev->SetDither(FALSE))) + goto generic_error; + break; + default: + if (FAILED(info->dev->SetDither(FALSE))) + goto generic_error; + } + if (!CreateScene(info)) + goto ret_with_error; + if (FAILED(lpD3DRM->CreateViewport(info->dev, info->camera, 0, 0, + info->dev->GetWidth(), + info->dev->GetHeight(), &info->view))) + goto generic_error; + if (FAILED(info->view->SetBack(D3DVAL(5000.0)))) + goto generic_error; + + return TRUE; +generic_error: + Msg("An error occurred while creating the device.\n"); +ret_with_error: + return FALSE; +} + +/* + * Regenerate the device if the color model changes or the window size + * changes. + */ +static BOOL RebuildDevice(HWND win, AppInfo* info, int width, int height) +{ + HRESULT rval; + int old_dither = info->dev->GetDither(); + D3DRMRENDERQUALITY old_quality = info->dev->GetQuality(); + int old_shades = info->dev->GetShades(); + + RELEASE(info->view); + RELEASE(info->dev); + rval = lpD3DRM->CreateDeviceFromClipper(lpDDClipper, FindDevice(info->model), + width, height, &info->dev); + if (rval != D3DRM_OK) { + Msg("Creating a device from HWND failed while rebuilding device.\n%s", MyErrorToString(rval)); + return FALSE; + } + + if (FAILED(info->dev->SetDither(old_dither))) + goto generic_error; + if (FAILED(info->dev->SetQuality(old_quality))) + goto generic_error; + if (FAILED(info->dev->SetShades(old_shades))) + goto generic_error; + width = info->dev->GetWidth(); + height = info->dev->GetHeight(); + if (FAILED(lpD3DRM->CreateViewport(info->dev, info->camera, + 0, 0, width, height, &info->view))) + goto generic_error; + if (FAILED(info->view->SetBack(D3DVAL(400.0)))) + goto generic_error; + return TRUE; +generic_error: + Msg("A failure occurred while rebuilding the device.\n"); + return FALSE; +} + +/* + * Resize the viewport and device when the window size changes. + */ +static BOOL ResizeViewport(HWND win, AppInfo* info, int width, int height) +{ + int view_width = info->view->GetWidth(); + int view_height = info->view->GetHeight(); + int dev_width = info->dev->GetWidth(); + int dev_height = info->dev->GetHeight(); + + if (view_width == width && view_height == height) + return TRUE; + + if (width <= dev_width && height <= dev_height) { + RELEASE(info->view); + if (FAILED(lpD3DRM->CreateViewport(info->dev, info->camera, 0, 0, width, height, &info->view))) + goto generic_error; + if (FAILED(info->view->SetBack(D3DVAL(400.0)))) + goto generic_error; + } + + if (!RebuildDevice(win, info, width, height)) + return FALSE; + return TRUE; +generic_error: + Msg("A failure occurred while resizing the viewport.\n"); + return FALSE; +} + +/* + * Place an object in front of the camera. + */ +static BOOL PlaceMesh(LPDIRECT3DRMMESHBUILDER mesh, AppInfo *info) +{ + LPDIRECT3DRMFRAME frame; + + if (FAILED(lpD3DRM->CreateFrame(info->scene, &frame))) + return FALSE; + if (FAILED(frame->AddVisual(mesh))) + return FALSE; + if (FAILED(frame->SetPosition(info->camera, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(15.0)))) + return FALSE; + frame->Release(); + return TRUE; +} + +static BOOL ScaleScene(LPDIRECT3DRMFRAME frame, AppInfo *info) +{ + /* Some trickery form the RL2 viewer to scale a scene down to + managable proportions */ + LPDIRECT3DRMMESHBUILDER mbuilder; + D3DRMBOX box; + D3DVALUE maxDim; + + lpD3DRM->CreateMeshBuilder(&mbuilder); + mbuilder->AddFrame(frame); + mbuilder->GetBox(&box); + mbuilder->Release(); + + maxDim = box.max.x - box.min.x; + if (box.max.y - box.min.y > maxDim) + maxDim = box.max.y - box.min.y; + if (box.max.z - box.min.z > maxDim) + maxDim = box.max.z - box.min.z; + + frame->AddScale(D3DRMCOMBINE_BEFORE, D3DDivide(D3DVAL(8.0), maxDim), + D3DDivide(D3DVAL(8.0), maxDim), + D3DDivide(D3DVAL(8.0), maxDim)); + + frame->SetPosition(info->scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(15.0)); + + return TRUE; +} + + +typedef struct { + LPDIRECT3DRMANIMATIONSET animset; + D3DVALUE time; +} animationCallbackArgs; + +static void CDECL animationCallback(LPDIRECT3DRMFRAME obj, void* arg, D3DVALUE delta) +{ + animationCallbackArgs* cb = (animationCallbackArgs *) arg; + + obj = obj; + cb->animset->SetTime(cb->time); + cb->time += delta; +} + +static BOOL setAnimationCallback(LPDIRECT3DRMFRAME frame, + LPDIRECT3DRMANIMATIONSET animset) +{ + animationCallbackArgs *cb; + + cb = (animationCallbackArgs*)malloc(sizeof(animationCallbackArgs)); + if (!cb) + return FALSE; + + cb->animset = animset; + cb->time = D3DVAL(0); + if (FAILED(frame->AddMoveCallback(animationCallback, (void *) cb))) + return FALSE; + return TRUE; +} + +static BOOL LoadAnimationSet(const char *filename, AppInfo *info) +{ + LPDIRECT3DRMANIMATIONSET lpAnimSet; + LPDIRECT3DRMFRAME lpFrame; + + /* Create a new parent frame for the animation, load it, and set up the + callback */ + + if (FAILED(lpD3DRM->CreateFrame(info->scene, &lpFrame))) + return FALSE; + + if (FAILED(lpD3DRM->CreateAnimationSet(&lpAnimSet))) + return FALSE; + + if (FAILED(lpAnimSet->Load((LPVOID)filename, NULL, + D3DRMLOAD_FROMFILE, loadTextures, + NULL, lpFrame))) + return FALSE; + + ScaleScene(lpFrame, info); + + setAnimationCallback(lpFrame, lpAnimSet); + + return TRUE; +} + +static BOOL LoadFrameHierarchy(const char *filename, AppInfo *info) +{ + LPDIRECT3DRMFRAME lpFrame; + + if (FAILED(lpD3DRM->CreateFrame(info->scene, &lpFrame))) + return FALSE; + + if (FAILED(lpFrame->Load((LPVOID)filename, NULL, D3DRMLOAD_FROMFILE, + loadTextures, NULL))) + return FALSE; + + ScaleScene(lpFrame, info); + + return TRUE; +} + + +static int + left_drag = FALSE, right_drag = FALSE, + last_x, last_y; + +/* + * Render the scene into the viewport. + */ +static BOOL Render() { + if (FAILED(active_window->scene->Move(D3DVAL(1.0)))) + return FALSE; + if (FAILED(active_window->view->Clear())) + return FALSE; + if (FAILED(active_window->view->Render(active_window->scene))) + return FALSE; + if (FAILED(active_window->dev->Update())) + return FALSE; + return TRUE; +} + +static void Idle() +{ + LPDIRECT3DRMFRAME selected = SelectedFrame(); + + if (active_window == NULL) return; + if (left_drag && selected) + selected->SetRotation(active_window->scene, D3DVAL(0.0), D3DVAL(1.0), D3DVAL(0.0), D3DVAL(0.0)); + if (right_drag && selected) + selected->SetVelocity(active_window->scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), FALSE); +} + +static int FillModeToMenuItem(D3DRMFILLMODE fm) +{ + switch (fm) { + case D3DRMFILL_POINTS: + return 2; + + case D3DRMFILL_WIREFRAME: + return 3; + + case D3DRMFILL_SOLID: + return 4; + } + return -1; +} + +static int ShadeModeToMenuItem(D3DRMSHADEMODE sm) +{ + switch (sm) { + case D3DRMSHADE_FLAT: + return 6; + + case D3DRMSHADE_GOURAUD: + return 7; + + case D3DRMSHADE_PHONG: + return 8; + } + return -1; +} + +static BOOL ToggleLighting(HWND win, AppInfo* info) +{ + HMENU menu; + D3DRMRENDERQUALITY quality = info->dev->GetQuality(); + D3DRMLIGHTMODE mode = (D3DRMLIGHTMODE)(quality & D3DRMLIGHT_MASK); + HRESULT rval; + + if (mode == D3DRMLIGHT_ON) + mode = D3DRMLIGHT_OFF; + else + mode = D3DRMLIGHT_ON; + + menu = GetMenu(win); + menu = GetSubMenu(menu, 2); + CheckMenuItem(menu, 0, (MF_BYPOSITION + | (mode == D3DRMLIGHT_ON + ? MF_CHECKED + : MF_UNCHECKED))); + + quality = (quality & ~D3DRMLIGHT_MASK) | mode; + rval = info->dev->SetQuality(quality); + if (rval != D3DRM_OK) { + Msg("Setting the render quality while toggling lighting failed.\n%s", MyErrorToString(rval)); + return FALSE; + } + return TRUE; +} + +static BOOL SetFillMode(HWND win, AppInfo* info, D3DRMFILLMODE fm) +{ + HMENU menu; + D3DRMRENDERQUALITY quality = info->dev->GetQuality(); + D3DRMFILLMODE oldfm = (D3DRMFILLMODE)(quality & D3DRMFILL_MASK); + HRESULT rval; + + menu = GetMenu(win); + menu = GetSubMenu(menu, 2); + CheckMenuItem(menu, FillModeToMenuItem(oldfm), + MF_BYPOSITION|MF_UNCHECKED); + CheckMenuItem(menu, FillModeToMenuItem(fm), + MF_BYPOSITION|MF_CHECKED); + + quality = (quality & ~D3DRMFILL_MASK) | fm; + rval = info->dev->SetQuality(quality); + if (rval != D3DRM_OK) { + Msg("Setting the render quality while changing the fill mode failed.\n%s", MyErrorToString(rval)); + return FALSE; + } + return TRUE; +} + +static BOOL SetShadeMode(HWND win, AppInfo* info, D3DRMSHADEMODE sm) +{ + HMENU menu; + D3DRMRENDERQUALITY quality = info->dev->GetQuality(); + D3DRMSHADEMODE oldsm = (D3DRMSHADEMODE)(quality & D3DRMSHADE_MASK); + HRESULT rval; + + menu = GetMenu(win); + menu = GetSubMenu(menu, 2); + CheckMenuItem(menu, ShadeModeToMenuItem(oldsm), + MF_BYPOSITION|MF_UNCHECKED); + CheckMenuItem(menu, ShadeModeToMenuItem(sm), + MF_BYPOSITION|MF_CHECKED); + + quality = (quality & ~D3DRMSHADE_MASK) | sm; + rval = info->dev->SetQuality(quality); + if (rval != D3DRM_OK) { + Msg("Setting the render quality while changing the shade mode failed.\n%s", MyErrorToString(rval)); + return FALSE; + } + return TRUE; +} + +static BOOL SetModel(HWND win, AppInfo* info, D3DRMCOLORMODEL model) +{ + HMENU menu; + D3DRMCOLORMODEL oldModel = info->model; + + if (oldModel == model) return TRUE; + + info->model = model; + if (!RebuildDevice(win, info, info->dev->GetWidth(), info->dev->GetHeight())) + return FALSE; + + menu = GetMenu(win); + menu = GetSubMenu(menu, 2); + CheckMenuItem(menu, 9 + (int) oldModel, MF_BYPOSITION|MF_UNCHECKED); + CheckMenuItem(menu, 9 + (int) model, MF_BYPOSITION|MF_CHECKED); + return TRUE; +} + +static BOOL ToggleDither(HWND win, AppInfo *info) +{ + HMENU menu; + int dither = info->dev->GetDither(); + int checked; + dither = !dither; + if (FAILED(info->dev->SetDither(dither))) { + Msg("Toggling dithering failed.\n"); + return FALSE; + } + menu = GetMenu(win); + menu = GetSubMenu(menu, 2); + + if (dither) checked = MF_CHECKED; + else checked = MF_UNCHECKED; + + //CheckMenuItem(menu, MENU_DITHER, MF_BYCOMMAND|checked); + CheckMenuItem(menu, 13, MF_BYPOSITION|checked); + return TRUE; +} + +static BOOL ToggleTextureFiltering(HWND win, AppInfo *info) +{ + HMENU menu; + D3DRMTEXTUREQUALITY tq = info->dev->GetTextureQuality(); + int checked; + if (tq == D3DRMTEXTURE_NEAREST) + tq = D3DRMTEXTURE_LINEAR; + else + tq = D3DRMTEXTURE_NEAREST; + + if (FAILED(info->dev->SetTextureQuality(tq))) { + Msg("Setting texture quality failed.\n"); + return FALSE; + } + menu = GetMenu(win); + menu = GetSubMenu(menu, 2); + + if (tq == D3DRMTEXTURE_LINEAR) checked = MF_CHECKED; + else checked = MF_UNCHECKED; + + CheckMenuItem(menu, 14, MF_BYPOSITION|checked); + return TRUE; +} + +static BOOL +CreateLight(WPARAM wparam, AppInfo* info) +{ + LPDIRECT3DRMMESHBUILDER builder = NULL; + LPDIRECT3DRMLIGHT light = NULL; + LPDIRECT3DRMFRAME frame = NULL; + HRESULT rval; + + if (FAILED(lpD3DRM->CreateMeshBuilder(&builder))) + goto generic_error; + + if (wparam == MENU_LIGHT_DIRECTIONAL) { + rval = builder->Load("camera.x", NULL, D3DRMLOAD_FROMFILE, + NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load camera.x.\n%s", MyErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(builder->SetQuality(D3DRMRENDER_UNLITFLAT))) + goto generic_error; + if (FAILED(lpD3DRM->CreateLightRGB + (D3DRMLIGHT_DIRECTIONAL, D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0), &light))) + goto generic_error; + } else if (wparam == MENU_LIGHT_PARALLEL_POINT) { + rval = builder->Load("sphere2.x", NULL, D3DRMLOAD_FROMFILE, + NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load sphere2.x.\n%s", MyErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(builder->SetQuality(D3DRMRENDER_UNLITFLAT))) + goto generic_error; + if (FAILED(builder->Scale(D3DVAL(0.2), D3DVAL(0.2), D3DVAL(0.2)))) + goto generic_error; + if (FAILED(lpD3DRM->CreateLightRGB + (D3DRMLIGHT_PARALLELPOINT, D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0), &light))) + goto generic_error; + } else if (wparam == MENU_LIGHT_POINT) { + rval = builder->Load("sphere2.x", NULL, D3DRMLOAD_FROMFILE, + NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load sphere2.x.\n%s", MyErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(builder->SetQuality(D3DRMRENDER_UNLITFLAT))) + goto generic_error; + if (FAILED(builder->Scale(D3DVAL(0.2), D3DVAL(0.2), D3DVAL(0.2)))) + goto generic_error; + if (FAILED(lpD3DRM->CreateLightRGB + (D3DRMLIGHT_POINT, D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0), &light))) + goto generic_error; + } else if (wparam == MENU_LIGHT_SPOT) { + rval = builder->Load("camera.x", NULL, D3DRMLOAD_FROMFILE, + NULL, NULL); + if (rval != D3DRM_OK) { + Msg("Failed to load camera.x.\n%s", MyErrorToString(rval)); + goto ret_with_error; + } + if (FAILED(builder->SetQuality(D3DRMRENDER_UNLITFLAT))) + goto generic_error; + if (FAILED(lpD3DRM->CreateLightRGB(D3DRMLIGHT_SPOT, D3DVAL(1.0), D3DVAL(1.0), D3DVAL(1.0), &light))) + goto generic_error; + } + if (FAILED(lpD3DRM->CreateFrame(info->scene, &frame))) + goto generic_error; + if (FAILED(frame->SetPosition(info->camera, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(10.0)))) + goto generic_error; + if (FAILED(frame->AddVisual(builder))) + goto generic_error; + if (FAILED(frame->AddLight(light))) + goto generic_error; + + builder->Release(), frame->Release(), light->Release(); + return TRUE; +generic_error: + Msg("A failure occurred while creating a new light.\n"); +ret_with_error: + RELEASE(builder); + RELEASE(light); + RELEASE(frame); + return FALSE; +} + +HRESULT loadTextures(char *name, void *arg, LPDIRECT3DRMTEXTURE *tex) +{ + /* IDirect3DRM::LoadTexture checks whether the texture is a PPM or + BMP which it knows how to load. If you want to load other formats + you could add code to the callback to load the code into an D3DRMIMAGE + structure and call IDirect3DRM::CreateTexture */ + + return lpD3DRM->LoadTexture(name, tex); +} + +#define SIGN_EXTEND(w) ((((int)(w)) << 16) >> 16) + +/* + * Handle messages for the main application window + */ +LONG FAR PASCAL WindowProc(HWND win, UINT msg, WPARAM wparam, LPARAM lparam) +{ + static HCURSOR oldCursor = NULL; + AppInfo *info; + LPDIRECT3DRMFRAME sFrame = SelectedFrame(); + LPDIRECT3DRMMESHBUILDER sVisual = SelectedVisual(); + + info = (AppInfo *) GetWindowLong(win, 0); + active_window = info; + + switch (msg) + { + case WM_KEYDOWN: + { D3DVECTOR dir, up, right; + + info->camera->GetOrientation(info->scene, &dir, &up); + D3DRMVectorCrossProduct(&right, &up, &dir); + up.x /= D3DVAL(4.0); + up.y /= D3DVAL(4.0); + up.z /= D3DVAL(4.0); + right.x /= D3DVAL(4.0); + right.y /= D3DVAL(4.0); + right.z /= D3DVAL(4.0); + + switch (wparam) + { + case 'T': + info->camera->SetVelocity(info->scene, dir.x, dir.y, dir.z, FALSE); + break; + + case 'Y': + info->camera->SetVelocity(info->scene, D3DVAL(-100.0) * dir.x, + D3DVAL(-100.0) * dir.y, + D3DVAL(-100.0) * dir.z, FALSE); + + case 'R': + info->camera->SetVelocity(info->scene, -dir.x, -dir.y, -dir.z, FALSE); + break; + + case 'E': + info->camera->SetVelocity(info->scene, D3DVAL(100.0) * dir.x, + D3DVAL(100.0) * dir.y, + D3DVAL(100.0) * dir.z, FALSE); + case VK_UP: + info->camera->SetVelocity(info->scene, up.x, up.y, up.z, FALSE); + break; + + case VK_DOWN: + info->camera->SetVelocity(info->scene, -up.x, -up.y, -up.z, FALSE); + break; + + case VK_RIGHT: + info->camera->SetVelocity(info->scene, right.x, right.y, right.z, FALSE); + break; + + case VK_LEFT: + info->camera->SetVelocity(info->scene, -right.x, -right.y, -right.z, FALSE); + break; + + case 'X': + if (sFrame) + sFrame->SetVelocity(info->scene, dir.x, dir.y, dir.z, FALSE); + break; + + case 'Z': + if (sFrame) + sFrame->SetVelocity(info->scene, -dir.x, -dir.y, -dir.z, FALSE); + break; + + case VK_SUBTRACT: + if (sFrame) + { sVisual->Scale(D3DVAL(0.9), D3DVAL(0.9), D3DVAL(0.9)); + SelectVisual(sVisual, sFrame); + } + break; + + case VK_ADD: + if (sFrame) + { sVisual->Scale(D3DVAL(1.1), D3DVAL(1.1), D3DVAL(1.1)); + SelectVisual(sVisual, sFrame); + } + break; + } + } + break; + + case WM_KEYUP: + switch (wparam) + { + case 'T': + case 'R': + case VK_UP: + case VK_DOWN: + case VK_LEFT: + case VK_RIGHT: + info->camera->SetVelocity(info->scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), FALSE); + break; + + case 'Z': + case 'X': + if (sFrame) + sFrame->SetVelocity(info->scene, D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0), FALSE); + break; + } + break; + + case WM_LBUTTONDOWN: + { HCURSOR hCur; + int x = LOWORD(lparam); + int y = HIWORD(lparam); + last_x = x; + last_y = y; + FindAndSelectVisual(info->view, x, y); + left_drag = TRUE; + SetCapture(win); + /* change to a groovy cursor */ + hCur = LoadCursor(NULL, IDC_ARROW); + if (hCur) oldCursor = SetCursor(hCur); + else oldCursor = NULL; + } + break; + + case WM_LBUTTONUP: + ReleaseCapture(); + left_drag = FALSE; + if (oldCursor) SetCursor(oldCursor); + break; + + case WM_RBUTTONDOWN: + { + HCURSOR hCur; + int x = LOWORD(lparam); + int y = HIWORD(lparam); + last_x = x; + last_y = y; + FindAndSelectVisual(info->view, x, y); + right_drag = TRUE; + SetCapture(win); + /* change to a groovy cursor */ + hCur = LoadCursor(NULL, IDC_ARROW); + if (hCur) oldCursor = SetCursor(hCur); + else oldCursor = NULL; + } + break; + + case WM_RBUTTONUP: + right_drag = FALSE; + ReleaseCapture(); + if (oldCursor) SetCursor(oldCursor); + break; + + case WM_MOUSEMOVE: + if ((wparam & MK_LBUTTON) && sFrame && left_drag) + { double delta_x, delta_y; + delta_x = SIGN_EXTEND(LOWORD(lparam)) - last_x; + delta_y = -SIGN_EXTEND((HIWORD(lparam)) - last_y); + last_x = SIGN_EXTEND(LOWORD(lparam)); + last_y = SIGN_EXTEND(HIWORD(lparam)); + { + double delta_r = sqrt(delta_x * delta_x + delta_y * delta_y); + double radius = 50; + double denom; + + denom = sqrt(radius * radius + delta_r * delta_r); + + if (delta_r == 0 || denom == 0) break; + sFrame->SetRotation + ( info->camera, + D3DDivide(D3DVAL((float) delta_y), D3DVAL((float) delta_r)), + D3DDivide(D3DVAL((float) -delta_x), D3DVAL((float) delta_r)), + D3DVAL(0.0), + D3DDivide(D3DVAL((float) delta_r), D3DVAL((float) denom)) + ); + } + } + else if ((wparam & MK_RBUTTON) && sFrame && right_drag) + { double delta_x, delta_y; + D3DVECTOR p1; + D3DRMVECTOR4D p2; + + delta_x = SIGN_EXTEND(LOWORD(lparam)) - last_x; + delta_y = SIGN_EXTEND(HIWORD(lparam)) - last_y; + last_x = SIGN_EXTEND(LOWORD(lparam)); + last_y = SIGN_EXTEND(HIWORD(lparam)); + sFrame->GetPosition(info->scene, &p1); + info->view->Transform(&p2, &p1); + p2.x += D3DMultiply(D3DVAL((float)delta_x), p2.w); + p2.y += D3DMultiply(D3DVAL((float)delta_y), p2.w); + info->view->InverseTransform(&p1, &p2); + sFrame->SetPosition(info->scene, p1.x, p1.y, p1.z); + } + break; + + case WM_COMMAND: + switch( wparam & 0xffff ) + { + case MENU_FILE_ABOUT: + DialogBox((HINSTANCE) GetWindowLong(win, GWL_HINSTANCE),"AboutBox", win, (DLGPROC)AboutDlgProc); + break; + + case MENU_FILE_OPEN: + { LPDIRECT3DRMMESHBUILDER builder; + HRESULT rval; + char *file = OpenNewFile(win, "Open a Mesh file"); + if (file) + { + if (FAILED(lpD3DRM->CreateMeshBuilder(&builder))) { + Msg("Failed the create a builder for the new mesh.\n"); + break; + } + rval = builder->Load(file, NULL, D3DRMLOAD_FROMFILE, + loadTextures, NULL); + if (rval != D3DRM_OK) { + Msg("Loading %s failed.\n%s", file, MyErrorToString(rval)); + builder->Release(); + break; + } + if (!PlaceMesh(builder, info)) { + Msg("Placing the mesh in the scene failed.\n"); + builder->Release(); + break; + } + builder->Release(); + } + + /*LoadAnimationSet(file, info);*/ + break; + } + + case MENU_FILE_OPEN_ANIMSET: + { + char *file = OpenNewFile(win, "Open Animation ..."); + if (file) { + if (LoadAnimationSet(file, info) == FALSE) { + Msg("Loading and placing of %s failed.\n", file); + } + } + break; + } + + case MENU_FILE_OPEN_FRAME: + { + char *file = OpenNewFile(win, "Open Frame ..."); + if (file) { + if (LoadFrameHierarchy(file, info) == FALSE) { + Msg("Loading and placing of %s failed.\n", file); + } + } + break; + } + + case MENU_FILE_EXIT: + PostQuitMessage(0); + break; + + case MENU_EDIT_CUT: + CutVisual(); + break; + + case MENU_EDIT_COPY: + CopyVisual(); + break; + + case MENU_EDIT_PASTE: + PasteVisual(info->scene); + break; + + case MENU_EDIT_DELETE: + DeleteVisual(); + break; + + case MENU_EDIT_COLOR: + if (sFrame) + { + LPDIRECT3DRMMESHBUILDER mesh; + HRESULT rval; + + if (FAILED(sVisual->QueryInterface(IID_IDirect3DRMMeshBuilder, + (void**) &mesh))) + break; + + if (SelectedLight()) + { + D3DCOLOR c = SelectedLight()->GetColor(); + + if (ChooseNewColor(win, &c)) { + mesh->SetColor(c); + SelectedLight()->SetColor(c); + } + } else { + D3DCOLOR c; + + if (mesh->GetFaceCount()) { + LPDIRECT3DRMFACEARRAY faces; + LPDIRECT3DRMFACE face; + mesh->GetFaces(&faces); + faces->GetElement(0, &face); + c = face->GetColor(); + RELEASE(face); + RELEASE(faces); + } else + c = D3DRMCreateColorRGB(D3DVAL(0.0), D3DVAL(0.0), D3DVAL(0.0)); + + if (ChooseNewColor(win, &c)) { + rval = mesh->SetColor(c); + if (rval != D3DRM_OK) + Msg("Failed to set the mesh's color.\n%s", MyErrorToString(rval)); + } + } + + RELEASE(mesh); + } + break; + + case MENU_EDIT_BOXES: + { + HMENU menu; + int checked = ToggleBoxes() ? MF_CHECKED : MF_UNCHECKED; + menu = GetMenu(win); + menu = GetSubMenu(menu, 1); + CheckMenuItem(menu, MENU_EDIT_BOXES, MF_BYCOMMAND|checked); + } + break; + + case MENU_QUALITY_LIGHTING: + ToggleLighting(win, info); + break; + + case MENU_QUALITY_POINTS: + SetFillMode(win, info, D3DRMFILL_POINTS); + break; + + case MENU_QUALITY_WIREFRAME: + SetFillMode(win, info, D3DRMFILL_WIREFRAME); + break; + + case MENU_QUALITY_SOLID: + SetFillMode(win, info, D3DRMFILL_SOLID); + break; + + case MENU_QUALITY_FLAT: + SetShadeMode(win, info, D3DRMSHADE_FLAT); + break; + + case MENU_QUALITY_GOURAUD: + SetShadeMode(win, info, D3DRMSHADE_GOURAUD); + break; + + case MENU_QUALITY_PHONG: + SetShadeMode(win, info, D3DRMSHADE_PHONG); + break; + + case MENU_MODEL_MONO: + if (!SetModel(win, info, D3DCOLOR_MONO)) + bQuit = TRUE; + break; + + case MENU_MODEL_RGB: + if (!SetModel(win, info, D3DCOLOR_RGB)) + bQuit = TRUE; + break; + + case MENU_DITHER: + ToggleDither(win, info); + break; + + case MENU_TEXTURE_FILTERING: + ToggleTextureFiltering(win, info); + break; + + case MENU_LIGHT_DIRECTIONAL: + case MENU_LIGHT_PARALLEL_POINT: + case MENU_LIGHT_POINT: + case MENU_LIGHT_SPOT: + { + CreateLight(wparam, info); + } + break; + } + break; + + case WM_DESTROY: + PostQuitMessage( 0 ); + bQuit = TRUE; + break; + + case WM_SIZE: + { + int width = LOWORD(lparam); + int height = HIWORD(lparam); + if (width && height) { + if (!ResizeViewport(win, info, width, height)) { + bQuit = TRUE; + break; + } + active_window->bMinimized = FALSE; + } else { + active_window->bMinimized = TRUE; + } + } + break; + + case WM_ACTIVATE: + { LPDIRECT3DRMWINDEVICE windev; + if (!info || !info->dev) break; + if (SUCCEEDED(info->dev->QueryInterface(IID_IDirect3DRMWinDevice, (void **) &windev))) + { if (FAILED(windev->HandleActivate(wparam))) + Msg("Failed to handle WM_ACTIVATE.\n"); + windev->Release(); + } else { + Msg("Failed to create Windows device to handle WM_ACTIVATE.\n"); + } + } + break; + + case WM_PAINT: + if (info) + { RECT r; + PAINTSTRUCT ps; + LPDIRECT3DRMWINDEVICE windev; + + if (!info || !info->dev) break; + if (GetUpdateRect(win, &r, FALSE)) + { BeginPaint(win, &ps); + if (SUCCEEDED(info->dev->QueryInterface(IID_IDirect3DRMWinDevice, (void **) &windev))) + { if (FAILED(windev->HandlePaint(ps.hdc))) + Msg("Failed to handle WM_PAINT.\n"); + windev->Release(); + } else { + Msg("Failed to create Windows device to handle WM_PAINT.\n"); + } + EndPaint(win, &ps); + } + } + + else return DefWindowProc(win, msg, wparam, lparam); + + default: + return DefWindowProc(win, msg, wparam, lparam); + } + return 0L; +} + +/* + * MyErrorToString + * Returns a pointer to a string describing the given error code. + */ +char* +MyErrorToString(HRESULT error) +{ + switch(error) { + case DD_OK: + /* Also includes D3D_OK and D3DRM_OK */ + return "No error.\0"; + case DDERR_ALREADYINITIALIZED: + return "This object is already initialized.\0"; + case DDERR_BLTFASTCANTCLIP: + return "Return if a clipper object is attached to the source surface passed into a BltFast call.\0"; + case DDERR_CANNOTATTACHSURFACE: + return "This surface can not be attached to the requested surface.\0"; + case DDERR_CANNOTDETACHSURFACE: + return "This surface can not be detached from the requested surface.\0"; + case DDERR_CANTCREATEDC: + return "Windows can not create any more DCs.\0"; + case DDERR_CANTDUPLICATE: + return "Can't duplicate primary & 3D surfaces, or surfaces that are implicitly created.\0"; + case DDERR_CLIPPERISUSINGHWND: + return "An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd.\0"; + case DDERR_COLORKEYNOTSET: + return "No src color key specified for this operation.\0"; + case DDERR_CURRENTLYNOTAVAIL: + return "Support is currently not available.\0"; + case DDERR_DIRECTDRAWALREADYCREATED: + return "A DirectDraw object representing this driver has already been created for this process.\0"; + case DDERR_EXCEPTION: + return "An exception was encountered while performing the requested operation.\0"; + case DDERR_EXCLUSIVEMODEALREADYSET: + return "An attempt was made to set the cooperative level when it was already set to exclusive.\0"; + case DDERR_GENERIC: + return "Generic failure.\0"; + case DDERR_HEIGHTALIGN: + return "Height of rectangle provided is not a multiple of reqd alignment.\0"; + case DDERR_HWNDALREADYSET: + return "The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or palettes created.\0"; + case DDERR_HWNDSUBCLASSED: + return "HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring state.\0"; + case DDERR_IMPLICITLYCREATED: + return "This surface can not be restored because it is an implicitly created surface.\0"; + case DDERR_INCOMPATIBLEPRIMARY: + return "Unable to match primary surface creation request with existing primary surface.\0"; + case DDERR_INVALIDCAPS: + return "One or more of the caps bits passed to the callback are incorrect.\0"; + case DDERR_INVALIDCLIPLIST: + return "DirectDraw does not support the provided cliplist.\0"; + case DDERR_INVALIDDIRECTDRAWGUID: + return "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier.\0"; + case DDERR_INVALIDMODE: + return "DirectDraw does not support the requested mode.\0"; + case DDERR_INVALIDOBJECT: + return "DirectDraw received a pointer that was an invalid DIRECTDRAW object.\0"; + case DDERR_INVALIDPARAMS: + return "One or more of the parameters passed to the function are incorrect.\0"; + case DDERR_INVALIDPIXELFORMAT: + return "The pixel format was invalid as specified.\0"; + case DDERR_INVALIDPOSITION: + return "Returned when the position of the overlay on the destination is no longer legal for that destination.\0"; + case DDERR_INVALIDRECT: + return "Rectangle provided was invalid.\0"; + case DDERR_LOCKEDSURFACES: + return "Operation could not be carried out because one or more surfaces are locked.\0"; + case DDERR_NO3D: + return "There is no 3D present.\0"; + case DDERR_NOALPHAHW: + return "Operation could not be carried out because there is no alpha accleration hardware present or available.\0"; + case DDERR_NOBLTHW: + return "No blitter hardware present.\0"; + case DDERR_NOCLIPLIST: + return "No cliplist available.\0"; + case DDERR_NOCLIPPERATTACHED: + return "No clipper object attached to surface object.\0"; + case DDERR_NOCOLORCONVHW: + return "Operation could not be carried out because there is no color conversion hardware present or available.\0"; + case DDERR_NOCOLORKEY: + return "Surface doesn't currently have a color key\0"; + case DDERR_NOCOLORKEYHW: + return "Operation could not be carried out because there is no hardware support of the destination color key.\0"; + case DDERR_NOCOOPERATIVELEVELSET: + return "Create function called without DirectDraw object method SetCooperativeLevel being called.\0"; + case DDERR_NODC: + return "No DC was ever created for this surface.\0"; + case DDERR_NODDROPSHW: + return "No DirectDraw ROP hardware.\0"; + case DDERR_NODIRECTDRAWHW: + return "A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware.\0"; + case DDERR_NOEMULATION: + return "Software emulation not available.\0"; + case DDERR_NOEXCLUSIVEMODE: + return "Operation requires the application to have exclusive mode but the application does not have exclusive mode.\0"; + case DDERR_NOFLIPHW: + return "Flipping visible surfaces is not supported.\0"; + case DDERR_NOGDI: + return "There is no GDI present.\0"; + case DDERR_NOHWND: + return "Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND.\0"; + case DDERR_NOMIRRORHW: + return "Operation could not be carried out because there is no hardware present or available.\0"; + case DDERR_NOOVERLAYDEST: + return "Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on to establish a destination.\0"; + case DDERR_NOOVERLAYHW: + return "Operation could not be carried out because there is no overlay hardware present or available.\0"; + case DDERR_NOPALETTEATTACHED: + return "No palette object attached to this surface.\0"; + case DDERR_NOPALETTEHW: + return "No hardware support for 16 or 256 color palettes.\0"; + case DDERR_NORASTEROPHW: + return "Operation could not be carried out because there is no appropriate raster op hardware present or available.\0"; + case DDERR_NOROTATIONHW: + return "Operation could not be carried out because there is no rotation hardware present or available.\0"; + case DDERR_NOSTRETCHHW: + return "Operation could not be carried out because there is no hardware support for stretching.\0"; + case DDERR_NOT4BITCOLOR: + return "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette.\0"; + case DDERR_NOT4BITCOLORINDEX: + return "DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette.\0"; + case DDERR_NOT8BITCOLOR: + return "DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color.\0"; + case DDERR_NOTAOVERLAYSURFACE: + return "Returned when an overlay member is called for a non-overlay surface.\0"; + case DDERR_NOTEXTUREHW: + return "Operation could not be carried out because there is no texture mapping hardware present or available.\0"; + case DDERR_NOTFLIPPABLE: + return "An attempt has been made to flip a surface that is not flippable.\0"; + case DDERR_NOTFOUND: + return "Requested item was not found.\0"; + case DDERR_NOTLOCKED: + return "Surface was not locked. An attempt to unlock a surface that was not locked at all, or by this process, has been attempted.\0"; + case DDERR_NOTPALETTIZED: + return "The surface being used is not a palette-based surface.\0"; + case DDERR_NOVSYNCHW: + return "Operation could not be carried out because there is no hardware support for vertical blank synchronized operations.\0"; + case DDERR_NOZBUFFERHW: + return "Operation could not be carried out because there is no hardware support for zbuffer blitting.\0"; + case DDERR_NOZOVERLAYHW: + return "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays.\0"; + case DDERR_OUTOFCAPS: + return "The hardware needed for the requested operation has already been allocated.\0"; + case DDERR_OUTOFMEMORY: + return "DirectDraw does not have enough memory to perform the operation.\0"; + case DDERR_OUTOFVIDEOMEMORY: + return "DirectDraw does not have enough memory to perform the operation.\0"; + case DDERR_OVERLAYCANTCLIP: + return "The hardware does not support clipped overlays.\0"; + case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: + return "Can only have ony color key active at one time for overlays.\0"; + case DDERR_OVERLAYNOTVISIBLE: + return "Returned when GetOverlayPosition is called on a hidden overlay.\0"; + case DDERR_PALETTEBUSY: + return "Access to this palette is being refused because the palette is already locked by another thread.\0"; + case DDERR_PRIMARYSURFACEALREADYEXISTS: + return "This process already has created a primary surface.\0"; + case DDERR_REGIONTOOSMALL: + return "Region passed to Clipper::GetClipList is too small.\0"; + case DDERR_SURFACEALREADYATTACHED: + return "This surface is already attached to the surface it is being attached to.\0"; + case DDERR_SURFACEALREADYDEPENDENT: + return "This surface is already a dependency of the surface it is being made a dependency of.\0"; + case DDERR_SURFACEBUSY: + return "Access to this surface is being refused because the surface is already locked by another thread.\0"; + case DDERR_SURFACEISOBSCURED: + return "Access to surface refused because the surface is obscured.\0"; + case DDERR_SURFACELOST: + return "Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it.\0"; + case DDERR_SURFACENOTATTACHED: + return "The requested surface is not attached.\0"; + case DDERR_TOOBIGHEIGHT: + return "Height requested by DirectDraw is too large.\0"; + case DDERR_TOOBIGSIZE: + return "Size requested by DirectDraw is too large, but the individual height and width are OK.\0"; + case DDERR_TOOBIGWIDTH: + return "Width requested by DirectDraw is too large.\0"; + case DDERR_UNSUPPORTED: + return "Action not supported.\0"; + case DDERR_UNSUPPORTEDFORMAT: + return "FOURCC format requested is unsupported by DirectDraw.\0"; + case DDERR_UNSUPPORTEDMASK: + return "Bitmask in the pixel format requested is unsupported by DirectDraw.\0"; + case DDERR_VERTICALBLANKINPROGRESS: + return "Vertical blank is in progress.\0"; + case DDERR_WASSTILLDRAWING: + return "Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete.\0"; + case DDERR_WRONGMODE: + return "This surface can not be restored because it was created in a different mode.\0"; + case DDERR_XALIGN: + return "Rectangle provided was not horizontally aligned on required boundary.\0"; + case D3DERR_BADMAJORVERSION: + return "D3DERR_BADMAJORVERSION\0"; + case D3DERR_BADMINORVERSION: + return "D3DERR_BADMINORVERSION\0"; + case D3DERR_EXECUTE_LOCKED: + return "D3DERR_EXECUTE_LOCKED\0"; + case D3DERR_EXECUTE_NOT_LOCKED: + return "D3DERR_EXECUTE_NOT_LOCKED\0"; + case D3DERR_EXECUTE_CREATE_FAILED: + return "D3DERR_EXECUTE_CREATE_FAILED\0"; + case D3DERR_EXECUTE_DESTROY_FAILED: + return "D3DERR_EXECUTE_DESTROY_FAILED\0"; + case D3DERR_EXECUTE_LOCK_FAILED: + return "D3DERR_EXECUTE_LOCK_FAILED\0"; + case D3DERR_EXECUTE_UNLOCK_FAILED: + return "D3DERR_EXECUTE_UNLOCK_FAILED\0"; + case D3DERR_EXECUTE_FAILED: + return "D3DERR_EXECUTE_FAILED\0"; + case D3DERR_EXECUTE_CLIPPED_FAILED: + return "D3DERR_EXECUTE_CLIPPED_FAILED\0"; + case D3DERR_TEXTURE_NO_SUPPORT: + return "D3DERR_TEXTURE_NO_SUPPORT\0"; + case D3DERR_TEXTURE_NOT_LOCKED: + return "D3DERR_TEXTURE_NOT_LOCKED\0"; + case D3DERR_TEXTURE_LOCKED: + return "D3DERR_TEXTURELOCKED\0"; + case D3DERR_TEXTURE_CREATE_FAILED: + return "D3DERR_TEXTURE_CREATE_FAILED\0"; + case D3DERR_TEXTURE_DESTROY_FAILED: + return "D3DERR_TEXTURE_DESTROY_FAILED\0"; + case D3DERR_TEXTURE_LOCK_FAILED: + return "D3DERR_TEXTURE_LOCK_FAILED\0"; + case D3DERR_TEXTURE_UNLOCK_FAILED: + return "D3DERR_TEXTURE_UNLOCK_FAILED\0"; + case D3DERR_TEXTURE_LOAD_FAILED: + return "D3DERR_TEXTURE_LOAD_FAILED\0"; + case D3DERR_MATRIX_CREATE_FAILED: + return "D3DERR_MATRIX_CREATE_FAILED\0"; + case D3DERR_MATRIX_DESTROY_FAILED: + return "D3DERR_MATRIX_DESTROY_FAILED\0"; + case D3DERR_MATRIX_SETDATA_FAILED: + return "D3DERR_MATRIX_SETDATA_FAILED\0"; + case D3DERR_SETVIEWPORTDATA_FAILED: + return "D3DERR_SETVIEWPORTDATA_FAILED\0"; + case D3DERR_MATERIAL_CREATE_FAILED: + return "D3DERR_MATERIAL_CREATE_FAILED\0"; + case D3DERR_MATERIAL_DESTROY_FAILED: + return "D3DERR_MATERIAL_DESTROY_FAILED\0"; + case D3DERR_MATERIAL_SETDATA_FAILED: + return "D3DERR_MATERIAL_SETDATA_FAILED\0"; + case D3DERR_LIGHT_SET_FAILED: + return "D3DERR_LIGHT_SET_FAILED\0"; + case D3DRMERR_BADOBJECT: + return "D3DRMERR_BADOBJECT\0"; + case D3DRMERR_BADTYPE: + return "D3DRMERR_BADTYPE\0"; + case D3DRMERR_BADALLOC: + return "D3DRMERR_BADALLOC\0"; + case D3DRMERR_FACEUSED: + return "D3DRMERR_FACEUSED\0"; + case D3DRMERR_NOTFOUND: + return "D3DRMERR_NOTFOUND\0"; + case D3DRMERR_NOTDONEYET: + return "D3DRMERR_NOTDONEYET\0"; + case D3DRMERR_FILENOTFOUND: + return "The file was not found.\0"; + case D3DRMERR_BADFILE: + return "D3DRMERR_BADFILE\0"; + case D3DRMERR_BADDEVICE: + return "D3DRMERR_BADDEVICE\0"; + case D3DRMERR_BADVALUE: + return "D3DRMERR_BADVALUE\0"; + case D3DRMERR_BADMAJORVERSION: + return "D3DRMERR_BADMAJORVERSION\0"; + case D3DRMERR_BADMINORVERSION: + return "D3DRMERR_BADMINORVERSION\0"; + case D3DRMERR_UNABLETOEXECUTE: + return "D3DRMERR_UNABLETOEXECUTE\0"; + default: + return "Unrecognized error value.\0"; + } +} diff --git a/sdk/samples/viewer/viewer.def b/sdk/samples/viewer/viewer.def new file mode 100644 index 0000000..d86f2b6 --- /dev/null +++ b/sdk/samples/viewer/viewer.def @@ -0,0 +1,10 @@ +NAME viewer.exe + +DESCRIPTION 'Direct3DRM Object Viewer (C) Microsoft 1995, 1996' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/sdk/samples/viewer/viewer.h b/sdk/samples/viewer/viewer.h new file mode 100644 index 0000000..54baf52 --- /dev/null +++ b/sdk/samples/viewer/viewer.h @@ -0,0 +1,63 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: viewer.h + * + ***************************************************************************/ + +#define MENU_FILE_ABOUT 1 +#define MENU_FILE_OPEN 2 +#define MENU_FILE_OPEN_ANIMSET 3 +#define MENU_FILE_OPEN_FRAME 4 +#define MENU_FILE_EXIT 5 +#define MENU_FILE_NEW_WINDOW 6 + +#define MENU_EDIT_CUT 100 +#define MENU_EDIT_COPY 101 +#define MENU_EDIT_PASTE 102 +#define MENU_EDIT_DELETE 103 +#define MENU_EDIT_COLOR 104 +#define MENU_EDIT_BOXES 105 + +#define MENU_QUALITY_LIGHTING 200 +#define MENU_QUALITY_POINTS 201 +#define MENU_QUALITY_WIREFRAME 202 +#define MENU_QUALITY_SOLID 203 +#define MENU_QUALITY_FLAT 204 +#define MENU_QUALITY_GOURAUD 205 +#define MENU_QUALITY_PHONG 206 + +#define MENU_MODEL_MONO 207 +#define MENU_MODEL_RGB 208 + +#define MENU_DITHER 209 + +#define MENU_TEXTURE_FILTERING 210 + +#define MENU_LIGHT_DIRECTIONAL 301 +#define MENU_LIGHT_PARALLEL_POINT 302 +#define MENU_LIGHT_POINT 303 +#define MENU_LIGHT_SPOT 304 + +#undef RELEASE +#ifdef __cplusplus +#define RELEASE(x) if (x != NULL) {x->Release(); x = NULL;} +#else +#define RELEASE(x) if (x != NULL) {x->lpVtbl->Release(x); x = NULL;} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern LPDIRECT3DRM lpD3DRM; + +char* OpenNewFile(HWND, const char *); +int ChooseNewColor(HWND, D3DCOLOR*); +LPDIRECT3DRMFRAME D3DRMLoadXAFAsFrame(const char* s); +HRESULT D3DRMLoadXAFAsList(const char* s, size_t*, LPDIRECT3DRMOBJECT**); + +#ifdef __cplusplus +} +#endif diff --git a/sdk/samples/viewer/viewer.ico b/sdk/samples/viewer/viewer.ico new file mode 100644 index 0000000..bb39b7d Binary files /dev/null and b/sdk/samples/viewer/viewer.ico differ diff --git a/sdk/samples/viewer/viewer.rc b/sdk/samples/viewer/viewer.rc new file mode 100644 index 0000000..a012398 --- /dev/null +++ b/sdk/samples/viewer/viewer.rc @@ -0,0 +1,85 @@ +/*========================================================================== + * + * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved. + * + * File: viewer.rc + * + ***************************************************************************/ + +#include "windows.h" +#include "viewer.h" + +ViewerIcon ICON viewer.ico +ViewerMenu MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&About...", MENU_FILE_ABOUT + MENUITEM "&Open Mesh...", MENU_FILE_OPEN + MENUITEM "Open Ani&mation...", MENU_FILE_OPEN_ANIMSET + MENUITEM "Open &Frame...", MENU_FILE_OPEN_FRAME + MENUITEM SEPARATOR + MENUITEM "E&xit", MENU_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Cu&t", MENU_EDIT_CUT + MENUITEM "&Copy", MENU_EDIT_COPY + MENUITEM "&Paste", MENU_EDIT_PASTE + MENUITEM "&Delete", MENU_EDIT_DELETE + MENUITEM SEPARATOR + MENUITEM "C&hange Color...", MENU_EDIT_COLOR + MENUITEM SEPARATOR + MENUITEM "&Bounding Boxes", MENU_EDIT_BOXES + END + POPUP "&Renderer" + BEGIN + MENUITEM "&Lighting\tCtrl+L", MENU_QUALITY_LIGHTING, CHECKED + MENUITEM SEPARATOR + MENUITEM "&Points\tCtrl+P", MENU_QUALITY_POINTS + MENUITEM "&Wireframe\tCtrl+W", MENU_QUALITY_WIREFRAME + MENUITEM "&Solid\tCtrl+S", MENU_QUALITY_SOLID, CHECKED + MENUITEM SEPARATOR + MENUITEM "&Flat\tCtrl+F", MENU_QUALITY_FLAT, CHECKED + MENUITEM "&Gouraud\tCtrl+G", MENU_QUALITY_GOURAUD + MENUITEM "Ph&ong\tCtrl+O", MENU_QUALITY_PHONG + MENUITEM SEPARATOR + MENUITEM "&Mono Model", MENU_MODEL_MONO, CHECKED + MENUITEM "&RGB Model", MENU_MODEL_RGB + MENUITEM SEPARATOR + MENUITEM "&Dithered\tCtrl+D", MENU_DITHER + MENUITEM "&Texture Filtering", MENU_TEXTURE_FILTERING + END + POPUP "&Lights" + BEGIN + MENUITEM "&Directional", MENU_LIGHT_DIRECTIONAL + MENUITEM "&Parallel Point", MENU_LIGHT_PARALLEL_POINT + MENUITEM "P&oint", MENU_LIGHT_POINT + MENUITEM "&Spot", MENU_LIGHT_SPOT + END +END + +ViewerAccel ACCELERATORS +BEGIN + VK_DELETE, MENU_EDIT_CUT, VIRTKEY, SHIFT + VK_INSERT, MENU_EDIT_COPY, VIRTKEY, CONTROL + VK_INSERT, MENU_EDIT_PASTE, VIRTKEY, SHIFT + VK_DELETE, MENU_EDIT_DELETE, VIRTKEY + "L", MENU_QUALITY_LIGHTING, VIRTKEY, CONTROL + "P", MENU_QUALITY_POINTS, VIRTKEY, CONTROL + "W", MENU_QUALITY_WIREFRAME, VIRTKEY, CONTROL + "S", MENU_QUALITY_SOLID, VIRTKEY, CONTROL + "F", MENU_QUALITY_FLAT, VIRTKEY, CONTROL + "G", MENU_QUALITY_GOURAUD, VIRTKEY, CONTROL + "O", MENU_QUALITY_PHONG, VIRTKEY, CONTROL + "D", MENU_DITHER, VIRTKEY, CONTROL +END + +AboutBox DIALOG 22, 17, 144, 75 + STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU + CAPTION "About Direct3D Object Viewer" + BEGIN + CTEXT "Copyright \251 1995,1996 Microsoft Corporation", -1, 0, 40, 144, 8 + DEFPUSHBUTTON "OK", IDOK, 53, 59, 32, 14, WS_GROUP + ICON "ViewerIcon", -1, 59,15,40,40 + END diff --git a/sdk/samples/watbld.mk b/sdk/samples/watbld.mk new file mode 100644 index 0000000..ca1a4dc --- /dev/null +++ b/sdk/samples/watbld.mk @@ -0,0 +1,53 @@ +############################################################################ +# +# Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. +# +# File: watbld.mk +# Content: Master makefile for WATCOM C 10.0 +# For controlling what gets built (debug, retail, clean) +# +############################################################################ + +.before + @set include=..\..\..\inc;..\..\watinc;$(%include) + +goal: debug.mak + +all : debug.mak retail.mak + +debug : debug.mak .SYMBOLIC + @%null + +retail : retail.mak .SYMBOLIC + @%null + +!ifndef MAKENAME +MAKENAME = default.mk +!endif + +debug.mak: .SYMBOLIC + @if not exist debug\nul md debug + @cd debug + @wmake -f ..\$(MAKENAME) DEBUG=1 MAKENAME=$(MAKENAME) + @cd .. + @echo *** Done making debug *** + +retail.mak: .SYMBOLIC + @if not exist retail\nul md retail + @cd retail + @wmake -f ..\$(MAKENAME) MAKENAME=$(MAKENAME) + @cd .. + @echo *** Done making retail *** + +clean: debug.cln retail.cln .SYMBOLIC + @%NULL + +debug.cln: .SYMBOLIC + @if exist debug\nul del debug < ..\yes >nul + @if exist debug\nul rd debug >nul + @echo *** debug is clean *** + +retail.cln: .SYMBOLIC + @if exist retail\nul del retail < ..\yes >nul + @if exist retail\nul rd retail >nul + @echo *** retail is clean *** diff --git a/sdk/samples/watsdk.mk b/sdk/samples/watsdk.mk new file mode 100644 index 0000000..42712c3 --- /dev/null +++ b/sdk/samples/watsdk.mk @@ -0,0 +1,137 @@ +############################################################################ +# +# Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. +# +# File: watsdk.mk +# Content: Rules for building the components of the SDK. +# For use with WATCOM C/C++ +# +############################################################################ + +!ifndef MSTOOLS +MSTOOLS=\mstools +!endif + +!ifndef GSDKROOT +GSDKROOT=..\..\.. +!endif + +############################################################################# +# +# Set up include & lib path +# +############################################################################# +INCLUDE=$(GSDKROOT)\inc;$(GSDKROOT)\SAMPLES\WATINC;$(%WATCOM)\h\nt;$(MSTOOLS)\include;..\..\misc;$(%WATCOM)\h;$(%WATCOM)\h\win +LIB=$(GSDKROOT)\lib;$(MSTOOLS)\LIB;$(WATCOM)\LIB386\NT;$(LIB) + +############################################################################# +# +# new suffixes +# +############################################################################# +.EXTENSIONS: +.EXTENSIONS:.exe .dll +.EXTENSIONS:.obj .res +.EXTENSIONS:.c .cpp .asm .h .rc + +############################################################################# +# +# C compiler definitions +# +############################################################################# +#CC =wcl386 +CC =wcc386 +CPPC =wpp386 +CFLAGS += -W3 #-c +!ifndef LOGO +CFLAGS += -zq -i$(INCLUDE) +!endif + +############################################################################# +# +# Linker definitions +# +############################################################################# +LINK =wlink +!ifndef LOGO +LFLAGS += option quiet +!endif + +############################################################################# +# +# resource compiler definitions +# +############################################################################# +RCFLAGS += -I..;$(%WATCOM)\h\nt;$(%WATCOM)\h +RCFLAGS += -DWIN32 -DIS_32 -D__WATCOMC__=1050 +RC = wrc + +############################################################################# +# +# assembler definitions +# +############################################################################# +ASM = ml +AFLAGS +=-DIS_32 -DWIN32 +AFLAGS +=-W3 -WX -Zd -c -Cx -DMASM6 + +############################################################################# +# +# librarian definitions +# +############################################################################# +LIBEXE = wlib + +############################################################################# +# +# targets +# +############################################################################# + +goal: $(GOALS) .SYMBOLIC + @%null + +.c: ..;..\..\misc + +.c.obj: + @%write $(NAME).cpt -D_WIN32 $(CFLAGS) -bt=NT $[* -fh +!ifdef MONKEY +# $(CC) @$(NAME).cpt $[* -fh -i..\..\misc -c -zz -DDEBUG + $(CC) @$(NAME).cpt -zz -DDEBUG +!else +# $(CC) @$(NAME).cpt $[* -fh -i..\..\misc -c -DDEBUG $[* -fh -c + $(CC) @$(NAME).cpt +!endif +# $(CC) -D_WIN32 -D_WINDOWS -DNDEBUG $(CFLAGS) -bt=NT $[* -fh + +.cpp : ..;..\..\misc + +.cpp.obj: + @%write $(NAME).cpt -D_WIN32 $(CFLAGS) -bt=NT $[* -fh +!ifdef MONKEY +# $(CPPC) @$(NAME).cpt $[* -fh -i..\..\misc -c -zz -DDEBUG + $(CPPC) @$(NAME).cpt -zz -DDEBUG +!else +# $(CPPC) @$(NAME).cpt $[* -fh -i..\..\misc -c + $(CPPC) @$(NAME).cpt +!endif +# $(CC) -D_WIN32 $(CFLAGS) -bt=NT $[* -fh + +.asm : .. + +.asm.obj: + $(ASM) $(AFLAGS) $[*.asm + +.rc : .. + +.rc.res: + $(RC) $(RCFLAGS) -bt=NT -r -fo=$^. $[*.rc + +$(NAME).lnk : ..\$(MAKENAME) ..\..\watsdk.mk ..\..\watbld.mk + @%write $(NAME).lnk debug all + @%append $(NAME).lnk system $(SYS) + @%append $(NAME).lnk op map + @%append $(NAME).lnk op st=64k + @%append $(NAME).lnk name $(NAME).exe + @for %i in ($(OBJS)) do @%append $(NAME).lnk file %i + @for %i in ($(LIBS)) do @%append $(NAME).lnk lib %i diff --git a/sdk/samples/wormhole/makefile b/sdk/samples/wormhole/makefile new file mode 100644 index 0000000..ade5839 --- /dev/null +++ b/sdk/samples/wormhole/makefile @@ -0,0 +1,2 @@ +MAKENAME=msvc.mk +!include ..\msbld.mk diff --git a/sdk/samples/wormhole/msvc.mk b/sdk/samples/wormhole/msvc.mk new file mode 100644 index 0000000..6a47d48 --- /dev/null +++ b/sdk/samples/wormhole/msvc.mk @@ -0,0 +1,40 @@ +NAME = wormhole +EXT = exe + +GOALS = $(NAME).$(EXT) + +LIBS =kernel32.lib user32.lib advapi32.lib ddraw.lib \ + comdlg32.lib gdi32.lib winmm.lib libc.lib + +OBJS = wormhole.obj + +!if "$(DEBUG)" == "debug" +COPT =-YX -DDEBUG -Zi -Fd$(NAME).PDB +LOPT =-debug:full -debugtype:cv -pdb:$(NAME).pdb +ROPT =-DDEBUG +!else +COPT =-YX +LOPT =-debug:none +ROPT = +!endif +RES = $(NAME).res + +CFLAGS =$(COPT) -Oxa -D_X86_ $(CDEBUG) -Fo$@ -I..\..\misc +LFLAGS =$(LOPT) +RCFLAGS =$(ROPT) + +NOLOGO = 1 + +!include ..\..\mssdk.mk + +$(NAME).$(EXT): \ + $(OBJS) $(RES) + @$(LINK) $(LFLAGS) @<< +-out:$(NAME).$(EXT) +-map:$(NAME).map +-machine:i386 +-subsystem:windows,4.0 +$(LIBS) +$(RES) +$(OBJS) +<< diff --git a/sdk/samples/wormhole/readme.txt b/sdk/samples/wormhole/readme.txt new file mode 100644 index 0000000..30b6f73 --- /dev/null +++ b/sdk/samples/wormhole/readme.txt @@ -0,0 +1,116 @@ +(NOTE: this file contains extended ASCII and may not appear + correctly if your font does not support extended ASCII + characters. This file will appear correctly in the + MS-DOS Editor.) + +This effect uses palette animation. + +Here is how it works: + +Imagine a 4x4 display using 4 colors. We could set the colors +up to look something like this: + + 1 2 3 4 + 1 2 3 4 + 1 2 3 4 + 1 2 3 4 + +Now we can cycle all of the colors in each row to the right. (The +one on the right will wrap-around to the left.) + + 4 1 2 3 + 4 1 2 3 + 4 1 2 3 + 4 1 2 3 + +If we continue this cycling we would get animated lines moving +to the right. The same can be done to animate the lines going +down. i.e. + + 1 1 1 1 4 4 4 4 + 2 2 2 2 -> 1 1 1 1 + 3 3 3 3 -> 2 2 2 2 + 4 4 4 4 3 3 3 3 + +Now if we expand our palette to 16 color we can combine moving +down and right at the same time. + + Move right: + + 1 2 3 4 4 1 2 3 + 5 6 7 8 -> 8 5 6 7 + 9 10 11 12 -> 12 9 10 11 + 13 14 15 16 16 13 14 15 + + Move down: + + 1 2 3 4 13 14 15 16 + 5 6 7 8 -> 1 2 3 4 + 9 10 11 12 -> 5 6 7 8 + 13 14 15 16 9 10 11 12 + + Move right and down: + + 1 2 3 4 4 1 2 3 16 13 14 15 + 5 6 7 8 -> 8 5 6 7 -> 4 1 2 3 + 9 10 11 12 -> 12 9 10 11 -> 8 5 6 7 + 13 14 15 16 16 13 14 15 12 9 10 11 + +Now if you tile these 4x4 blocks end to end and cycle the colors +as above, you get a moving checkerboard. + + + ��� ��� ��� ��� � ��� ��� ��� �� ��� ��� ��� ��� + �� ��� ��� ��� � ��� ��� ��� ��� �� ��� ��� ��� � + � ��� ��� ��� �� ��� ��� ��� ��� � ��� ��� ��� �� + ��� ��� ��� ��� -> �� ��� ��� ��� � -> ��� ��� ��� ��� + ��� ��� ��� ��� -> � ��� ��� ��� �� -> ��� ��� ��� ��� + �� ��� ��� ��� � ��� ��� ��� ��� �� ��� ��� ��� � + � ��� ��� ��� �� ��� ��� ��� ��� � ��� ��� ��� �� + ��� ��� ��� ��� �� ��� ��� ��� � ��� ��� ��� ��� + + +Wormhole does the same thing, except it uses 15x15 blocks (225 +colors) and instead of tiling the blocks end to end on a flat +plane, it tiles them in 3D converging at the center of the +wormhole. + +The following code will generate the 3D wormhole using the +aforementioned 15x15 grids. + +//Do all the work! +//convert r,theta,z to x,y,x to screen x,y +//plot the point +//z=-1.0+(log(2.0*j/DIVS) is the line that sets the math eqn for plot +//Feel free to try other functions! +//Cylindrical coordinates, i.e. z=f(r,theta) + +#define STRETCH 25 +#define PI 3.14159265358979323846 +#define XCENTER 160 +#define YCENTER 50 +#define DIVS 1200 +#define SPOKES 2400 + +void transarray(void) + { + float x,y,z; + int i,j,color; + for(j=1;j<DIVS+1;j++) + for(i=0;i<SPOKES;i++) + { + z=-1.0+(log(2.0*j/DIVS)); + x=(320.0*j/DIVS*cos(2*PI*i/SPOKES)); + y=(240.0*j/DIVS*sin(2*PI*i/SPOKES)); + y=y-STRETCH*z; + x+=XCENTER; + y+=YCENTER; + color=((i/8)%15)+15*((j/6)%15)+1; + if ((x>=0)&&(x<=320)&&(y>=0)&&(y<=200)) + plot((int) x,(int) y,color); + } + } + +After loading the bitmap to a direct draw surface, all that is +left to do is rotate the colors and you have a wormhole! + diff --git a/sdk/samples/wormhole/wormhole.bmp b/sdk/samples/wormhole/wormhole.bmp new file mode 100644 index 0000000..b0781c0 Binary files /dev/null and b/sdk/samples/wormhole/wormhole.bmp differ diff --git a/sdk/samples/wormhole/wormhole.cpp b/sdk/samples/wormhole/wormhole.cpp new file mode 100644 index 0000000..420b8e7 --- /dev/null +++ b/sdk/samples/wormhole/wormhole.cpp @@ -0,0 +1,436 @@ +/*************************************************************************** + * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. + ***************************************************************************/ +#include <windows.h> +#include <ddraw.h> + +HWND hWnd; +PALETTEENTRY pe[256]; +BOOL bActive; +BOOL bIsInitialized=FALSE; + +LPDIRECTDRAW lpDD; +LPDIRECTDRAWSURFACE lpDDSPrimary; +LPDIRECTDRAWSURFACE lpDDSOne; +LPDIRECTDRAWCLIPPER lpClipper; +LPDIRECTDRAWPALETTE lpDDPal; + +BOOL restoreAll(); +void updateFrame(); +static void finiObjects(); +long FAR PASCAL WindowProc(HWND,UINT,WPARAM,LPARAM); +BOOL initFail(HWND); +static BOOL doInit(HINSTANCE, int); +void CyclePalette(); +BOOL readBMPIntoSurfaces(); +int PASCAL WinMain(HINSTANCE,HINSTANCE,LPSTR,int); + +BOOL restoreAll() +{ + BOOL bResult; + + bResult=lpDDSPrimary->Restore() == DD_OK && + lpDDSOne->Restore() == DD_OK; + + readBMPIntoSurfaces(); + + return(bResult); +} + +void updateFrame() +{ + RECT rcRect; + RECT destRect; + HRESULT ddrval; + POINT pt; + + rcRect.left=0; + rcRect.top=0; + rcRect.right=640; + rcRect.bottom=480; + + GetClientRect(hWnd,&destRect); + + pt.x=pt.y=0; + ClientToScreen(hWnd,&pt); + OffsetRect(&destRect,pt.x,pt.y); + + while(1) + { + ddrval=lpDDSPrimary->Blt(&destRect,lpDDSOne,&rcRect,0,NULL); + + if(ddrval==DD_OK) + { + break; + } + if(ddrval==DDERR_SURFACELOST) + { + if(!restoreAll()) + { + return; + } + continue; + } + if(ddrval!=DDERR_WASSTILLDRAWING) + { + return; + } + } +} + +static void finiObjects() +{ + if(lpDD!=NULL) + { + if(lpDDSPrimary!=NULL) + { + lpDDSPrimary->Release(); + lpDDSPrimary=NULL; + } + if(lpDDSOne!=NULL) + { + lpDDSOne->Release(); + lpDDSOne=NULL; + } + if(lpDDPal!=NULL) + { + lpDDPal->Release(); + lpDDPal=NULL; + } + lpDD->Release(); + lpDD=NULL; + } +} + +long FAR PASCAL WindowProc(HWND hWnd,UINT message, + WPARAM wParam,LPARAM lParam ) +{ + switch(message) + { + case WM_ACTIVATE: + bActive = wParam; + break; + + case WM_CREATE: + + break; + + case WM_SETCURSOR: + + SetCursor(NULL); + if( bIsInitialized ) + { + updateFrame(); + lpDDPal->GetEntries(0,0,256,pe); + } + break; + + case WM_KEYDOWN: + + switch(wParam) + { + case VK_ESCAPE: + + case VK_F12: + + PostMessage(hWnd,WM_CLOSE,0,0); + break; + } + break; + + case WM_DESTROY: + + finiObjects(); + PostQuitMessage(0); + break; + } + return DefWindowProc(hWnd,message,wParam,lParam); +} + +BOOL initFail(HWND hWnd) +{ + finiObjects(); + MessageBox(hWnd,"DirectDraw Init FAILED","WormHole",MB_OK); + DestroyWindow(hWnd); + return FALSE; +} + +static BOOL doInit(HINSTANCE hInstance,int nCmdShow) +{ + WNDCLASS wc; + DDSURFACEDESC ddsd; + HRESULT ddrval; + + wc.style= CS_HREDRAW|CS_VREDRAW; + wc.lpfnWndProc= WindowProc; + wc.cbClsExtra= 0; + wc.cbWndExtra= 0; + wc.hInstance= hInstance; + wc.hIcon= LoadIcon(hInstance,IDI_APPLICATION); + wc.hCursor= LoadCursor(NULL,IDC_ARROW); + wc.hbrBackground= NULL; + wc.lpszMenuName= NULL; + wc.lpszClassName= "WormHole"; + RegisterClass(&wc); + + hWnd=CreateWindowEx( + 0, + "WormHole", + "WormHole", + WS_POPUP, + 0, + 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + NULL, + NULL, + hInstance, + NULL ); + + if(!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd,nCmdShow); + UpdateWindow(hWnd); + + ddrval=DirectDrawCreate(NULL,&lpDD,NULL); + + if(ddrval!=DD_OK) + { + return initFail(hWnd); + } + + ddrval=lpDD->SetCooperativeLevel(hWnd,DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN); + ddrval=lpDD->SetDisplayMode(640,480,8); + + if(ddrval!=DD_OK) + { + return initFail(hWnd); + } + + ddsd.dwSize=sizeof(ddsd); + ddsd.dwFlags=DDSD_CAPS; + ddsd.ddsCaps.dwCaps=DDSCAPS_PRIMARYSURFACE; + + ddrval=lpDD->CreateSurface(&ddsd,&lpDDSPrimary,NULL); + + if(ddrval!=DD_OK) + { + return initFail(hWnd); + } + + ddsd.dwSize=sizeof(ddsd); + ddsd.dwFlags=DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH; + ddsd.ddsCaps.dwCaps=DDSCAPS_OFFSCREENPLAIN; + ddsd.dwWidth=640; + ddsd.dwHeight=480; + + lpDD->CreateSurface(&ddsd,&lpDDSOne,NULL); + if(lpDDSOne==NULL) + { + return initFail(hWnd); + } + + bIsInitialized = TRUE; + return TRUE; +} + +void CyclePalette() +{ + int reg[15]; + int k; + + for(k=0;k<15;k++) + { + reg[k]=pe[k+30].peRed; + } + for(k=45;k<255;k++) + { + pe[k-15].peRed=pe[k].peRed; + } + for(k=0;k<15;k++) + { + pe[k+240].peRed=reg[k]; + } + for(k=0;k<15;k++) + { + reg[k]=pe[k+30].peGreen; + } + for(k=45;k<255;k++) + { + pe[k-15].peGreen=pe[k].peGreen; + } + for(k=0;k<15;k++) + { + pe[k+240].peGreen=reg[k]; + } + for(k=0;k<15;k++) + { + reg[k]=pe[k+30].peBlue; + } + for(k=45;k<255;k++) + { + pe[k-15].peBlue=pe[k].peBlue; + } + for(k=0;k<15;k++) + { + pe[k+240].peBlue=reg[k]; + } + + for(k=2;k<17;k++) + { + reg[k-2]=pe[15*k+14].peRed; + pe[15*k+14].peRed=pe[15*k+13].peRed; + pe[15*k+13].peRed=pe[15*k+12].peRed; + pe[15*k+12].peRed=pe[15*k+11].peRed; + pe[15*k+11].peRed=pe[15*k+10].peRed; + pe[15*k+10].peRed=pe[15*k+9].peRed; + pe[15*k+9].peRed=pe[15*k+8].peRed; + pe[15*k+8].peRed=pe[15*k+7].peRed; + pe[15*k+7].peRed=pe[15*k+6].peRed; + pe[15*k+6].peRed=pe[15*k+5].peRed; + pe[15*k+5].peRed=pe[15*k+4].peRed; + pe[15*k+4].peRed=pe[15*k+3].peRed; + pe[15*k+3].peRed=pe[15*k+2].peRed; + pe[15*k+2].peRed=pe[15*k+1].peRed; + pe[15*k+1].peRed=pe[15*k].peRed; + pe[15*k].peRed=reg[k-2]; + reg[k-2]=pe[15*k+14].peGreen; + pe[15*k+14].peGreen=pe[15*k+13].peGreen; + pe[15*k+13].peGreen=pe[15*k+12].peGreen; + pe[15*k+12].peGreen=pe[15*k+11].peGreen; + pe[15*k+11].peGreen=pe[15*k+10].peGreen; + pe[15*k+10].peGreen=pe[15*k+9].peGreen; + pe[15*k+9].peGreen=pe[15*k+8].peGreen; + pe[15*k+8].peGreen=pe[15*k+7].peGreen; + pe[15*k+7].peGreen=pe[15*k+6].peGreen; + pe[15*k+6].peGreen=pe[15*k+5].peGreen; + pe[15*k+5].peGreen=pe[15*k+4].peGreen; + pe[15*k+4].peGreen=pe[15*k+3].peGreen; + pe[15*k+3].peGreen=pe[15*k+2].peGreen; + pe[15*k+2].peGreen=pe[15*k+1].peGreen; + pe[15*k+1].peGreen=pe[15*k].peGreen; + pe[15*k].peGreen=reg[k-2]; + reg[k-2]=pe[15*k+14].peBlue; + pe[15*k+14].peBlue=pe[15*k+13].peBlue; + pe[15*k+13].peBlue=pe[15*k+12].peBlue; + pe[15*k+12].peBlue=pe[15*k+11].peBlue; + pe[15*k+11].peBlue=pe[15*k+10].peBlue; + pe[15*k+10].peBlue=pe[15*k+9].peBlue; + pe[15*k+9].peBlue=pe[15*k+8].peBlue; + pe[15*k+8].peBlue=pe[15*k+7].peBlue; + pe[15*k+7].peBlue=pe[15*k+6].peBlue; + pe[15*k+6].peBlue=pe[15*k+5].peBlue; + pe[15*k+5].peBlue=pe[15*k+4].peBlue; + pe[15*k+4].peBlue=pe[15*k+3].peBlue; + pe[15*k+3].peBlue=pe[15*k+2].peBlue; + pe[15*k+2].peBlue=pe[15*k+1].peBlue; + pe[15*k+1].peBlue=pe[15*k].peBlue; + pe[15*k].peBlue=reg[k-2]; + } + + lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN,NULL); + + if(lpDDPal->SetEntries(0,0,256,pe)!=DD_OK) + { + return; + } +} + +BOOL readBMPIntoSurfaces() +{ + HRESULT ddrval; + HRSRC hBMP; + RGBQUAD Palette[256]; + PALETTEENTRY pe[256]; + DDSURFACEDESC DDSDesc; + LPSTR lpBits; + LPSTR lpSrc; + BYTE *lpBMP; + int i; + + hBMP=FindResource(NULL,"wormhole.bmp",RT_BITMAP); + if( hBMP == NULL ) + { + return FALSE; + } + + lpBMP=(BYTE *)LockResource(LoadResource(NULL, hBMP)); + + memcpy(Palette,&lpBMP[sizeof(BITMAPINFOHEADER)],sizeof(Palette)); + + FreeResource(hBMP); + + for(i=0;i<256;i++) + { + pe[i].peRed=Palette[i].rgbRed; + pe[i].peGreen=Palette[i].rgbGreen; + pe[i].peBlue=Palette[i].rgbBlue; + } + + ddrval=lpDD->CreatePalette(DDPCAPS_8BIT,pe,&lpDDPal,NULL); + + if(ddrval!=DD_OK) + { + return FALSE; + } + + lpDDSPrimary->SetPalette(lpDDPal); + + DDSDesc.dwSize=sizeof(DDSDesc); + ddrval=lpDDSOne->Lock(NULL,&DDSDesc,0,NULL); + if(ddrval!=DD_OK) + { + return FALSE; + } + + lpBits=(LPSTR)DDSDesc.lpSurface; + lpSrc=(LPSTR) + (&lpBMP[sizeof(BITMAPINFOHEADER)+sizeof(Palette)+(640*480)]); + for(i=0;i<480;i++) + { + memcpy(lpBits,lpSrc,640); + lpBits+=DDSDesc.lPitch; + lpSrc-=640; + } + lpDDSOne->Unlock(NULL); + + return TRUE; +} + +int PASCAL WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, + LPSTR lpCmdLine,int nCmdShow) +{ + MSG msg; + + if(!doInit(hInstance,nCmdShow)) + { + return FALSE; + } + + readBMPIntoSurfaces(); + updateFrame(); + + while(1) + { + if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE)) + { + if(!GetMessage(&msg,NULL,0,0)) + { + return msg.wParam; + } + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else if(bActive) + { + CyclePalette(); + } + else + { + WaitMessage(); + } + } +} diff --git a/sdk/samples/wormhole/wormhole.rc b/sdk/samples/wormhole/wormhole.rc new file mode 100644 index 0000000..5581cff --- /dev/null +++ b/sdk/samples/wormhole/wormhole.rc @@ -0,0 +1 @@ +wormhole.bmp BITMAP MOVEABLE PURE "wormhole.bmp" diff --git a/sdk/samples/yes b/sdk/samples/yes new file mode 100644 index 0000000..975fbec --- /dev/null +++ b/sdk/samples/yes @@ -0,0 +1 @@ +y