Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS

Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
This commit is contained in:
Cyd
2026-06-24 21:28:16 -05:00
commit 2b8ca921cb
66341 changed files with 7923174 additions and 0 deletions
@@ -0,0 +1,88 @@
========================================================================
MICROSOFT FOUNDATION CLASS LIBRARY : mapquery
========================================================================
AppWizard has created this mapquery application for you. This application
not only demonstrates the basics of using the Microsoft Foundation classes
but is also a starting point for writing your application.
This file contains a summary of what you will find in each of the files that
make up your mapquery application.
mapquery.dsp
This file (the project file) contains information at the project level and
is used to build a single project or subproject. Other users can share the
project (.dsp) file, but they should export the makefiles locally.
mapquery.h
This is the main header file for the application. It includes other
project specific headers (including Resource.h) and declares the
CMapqueryApp application class.
mapquery.cpp
This is the main application source file that contains the application
class CMapqueryApp.
mapquery.rc
This is a listing of all of the Microsoft Windows resources that the
program uses. It includes the icons, bitmaps, and cursors that are stored
in the RES subdirectory. This file can be directly edited in Microsoft
Visual C++.
mapquery.clw
This file contains information used by ClassWizard to edit existing
classes or add new classes. ClassWizard also uses this file to store
information needed to create and edit message maps and dialog data
maps and to create prototype member functions.
res\mapquery.ico
This is an icon file, which is used as the application's icon. This
icon is included by the main resource file mapquery.rc.
res\mapquery.rc2
This file contains resources that are not edited by Microsoft
Visual C++. You should place all resources not editable by
the resource editor in this file.
/////////////////////////////////////////////////////////////////////////////
AppWizard creates one dialog class:
mapqueryDlg.h, mapqueryDlg.cpp - the dialog
These files contain your CMapqueryDlg class. This class defines
the behavior of your application's main dialog. The dialog's
template is in mapquery.rc, which can be edited in Microsoft
Visual C++.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named mapquery.pch and a precompiled types file named StdAfx.obj.
Resource.h
This is the standard header file, which defines new resource IDs.
Microsoft Visual C++ reads and updates this file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
If your application uses MFC in a shared DLL, and your application is
in a language other than the operating system's current language, you
will need to copy the corresponding localized resources MFC42XXX.DLL
from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
For example, MFC42DEU.DLL contains resources translated to German.) If you
don't do this, some of the UI elements of your application will remain in the
language of the operating system.
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// mapquery.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
+27
View File
@@ -0,0 +1,27 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__6BA0764A_C47F_4706_BF8C_F75348BAA2CF__INCLUDED_)
#define AFX_STDAFX_H__6BA0764A_C47F_4706_BF8C_F75348BAA2CF__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__6BA0764A_C47F_4706_BF8C_F75348BAA2CF__INCLUDED_)
@@ -0,0 +1,6 @@
#ifndef __DIBSECTIONHPP__
#define __DIBSECTIONHPP__
#include "dibsurf.hpp"
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,676 @@
#ifndef __DIBSURFHPP__
#define __DIBSURFHPP__
//*******************************************************************
//
// DESCRIPTION: Header file for CDIBSurface class
//
// AUTHOR: Andrew Farrier
//
// SourceSafe Version: $Revision: 68 $
//
// HISTORY: Created 11/15/95
//
//*******************************************************************
#include <map>
#include <vector>
#include <stack>
#pragma warning (disable : 4786)
struct DCData
{
HDC thedc;
HBITMAP oldbits;
DCData (void)
{
thedc = NULL;
oldbits = NULL;
}
DCData (HDC p1,HBITMAP p2)
{
thedc = p1;
oldbits = p2;
}
~DCData (void)
{
thedc = NULL;
oldbits = NULL;
}
DCData (const DCData& p1)
{
thedc = p1.thedc;
oldbits = p1.oldbits;
}
DCData& operator= (const DCData& p1)
{
thedc = p1.thedc;
oldbits = p1.oldbits;
return *this;
}
};
//****************************************************************
//
// Function Name: clamp
//
// Description: Will clamp x to be between min and max exclusive
//
// Returns: clamped value of x
//
//****************************************************************
template<typename type>
inline type clamp (const type& min,const type& x,const type& max)
{
if (x < min)
return min;
if (x>max)
return max;
return x;
}
//****************************************************************
//
// Function Name: RGBQUADtoCOLORREF
//
// Description: Will convert from an RGBQUAD to a COLORREF
//
// Returns: the COLORREF equal to the RGBQUAD
//
//****************************************************************
inline COLORREF RGBQUADtoCOLORREF (RGBQUAD value)
{
int red,green,blue;
COLORREF toret;
red = value.rgbRed;
green = value.rgbGreen;
blue = value.rgbBlue;
toret = RGB (red,green,blue);
return toret;
}
//****************************************************************
//
// Function Name: RGBtoCOLORREF
//
// Description: Will convert from an RGB packed int to a COLORREF
// int is in the form 0x00RRGGBB
//
// Returns: the COLORREF equal to the packed value
//
//****************************************************************
inline COLORREF RGBtoCOLORREF (int value)
{
int red,green,blue;
COLORREF toret;
red = (value>>16) & 0xff;
green = (value>>8) & 0xff;
blue = value&0xff;
toret = RGB (red,green,blue);
return toret;
}
//****************************************************************
//
// Function Name: COLORREFtoRGBQUAD
//
// Description: Will convert from a COLORREF value to an RGBQUAD
//
// Returns: the RGBQUAD equal to the COLORREF
//
//****************************************************************
inline RGBQUAD COLORREFtoRGBQUAD (COLORREF value)
{
RGBQUAD toret;
toret.rgbRed = (value >> 16) & 0xff;
toret.rgbGreen = (value >> 8) & 0xff;
toret.rgbBlue = value & 0xff;
return toret;
}
class CDIBSurface
{
private:
static std::vector<HDC> *m_FreeDC;
static std::vector<DCData> *m_AllDCs;
static int m_DCStackRefCount;
struct FloodData
{
unsigned char *mem;
CPoint where;
FloodData (unsigned char *p1,CPoint p2)
{mem = p1;where = p2;}
};
bool Create1BitMask (COLORREF colorref);
bool Create4BitMask (COLORREF colorref);
bool Create8BitMask (COLORREF colorref);
bool Create16BitMask (COLORREF colorref);
bool Create24BitMask (COLORREF colorref);
int FloodFill24 (const CPoint& start,const COLORREF color);
bool AlphaBlt16 (const int x,const int y,const int width,const int height,const CDIBSurface *src,const CDIBSurface *alpha,const int srcx,const int srcy,const int alphasrcx,const int alphasrcy);
bool AlphaBlt24 (const int x,const int y,const int width,const int height,const CDIBSurface *src,const CDIBSurface *alpha,const int srcx,const int srcy,const int alphasrcx,const int alphasrcy);
bool ColorBlt16 (const int x,const int y,const int width,const int height,const CDIBSurface* src,const int srcx,const int srcy,const COLORREF color,bool addred=true,bool addgreen=true,bool addblue=true,CDIBSurface *altmask=NULL);
bool ColorBlt24 (const int x,const int y,const int width,const int height,const CDIBSurface* src,const int srcx,const int srcy,const COLORREF color,bool addred=true,bool addgreen=true,bool addblue=true,CDIBSurface *altmask=NULL);
bool GrayBlt16 (const int x,const int y,const int width,const int height,const CDIBSurface* srcdib,const int srcx,const int srcy,CDIBSurface *altmask=NULL);
bool GrayBlt24 (const int x,const int y,const int width,const int height,const CDIBSurface* srcdib,const int srcx,const int srcy,CDIBSurface *altmask=NULL);
bool MultBlt16 (const int x,const int y,const int width,const int height,const CDIBSurface* src,const int srcx,const int srcy,const float red,const float green,const float blue,CDIBSurface *altmask=NULL);
bool MultBlt24 (const int x,const int y,const int width,const int height,const CDIBSurface* src,const int srcx,const int srcy,const float red,const float green,const float blue,CDIBSurface *altmask=NULL);
bool Convert24to16 (void);
bool SetupLoadedBitmap (HBITMAP hbm);
BITMAPINFO *AllocBitmapInfo (void) const; // delete when done with it
void ClearData (void);
struct DIBData
{
CDIBSurface *m_Mask;
HDC m_SelectedDC;
int m_SelectedDCRefCount;
bool m_AllocedDC;
HBITMAP m_OldBitmap;
HBITMAP m_BackBits; // may be NULL, call GetBitmap() if you need to create it
// HBITMAP m_OldBits;
unsigned char *m_Data;
unsigned char *m_UpperLeft;
UINT m_Width,m_Height;
UINT m_BitDepth;
int m_Pitch;
bool m_OwnPalette;
bool m_UseMask;
};
protected:
UINT *m_RefCount;
DIBData *m_DIBData;
public:
CDIBSurface (void);
CDIBSurface (UINT Width,UINT Height,UINT BitDepth);
CDIBSurface (const CDIBSurface&);
CDIBSurface& operator= (const CDIBSurface&);
~CDIBSurface (void);
bool Create (UINT Width,UINT Height,UINT BitDepth=0);
void Destroy (void);
bool operator== (const CDIBSurface& param)
{
if(!param.IsValid ())
return false;
if(!IsValid ())
return false;
ASSERT (m_DIBData);
ASSERT (param.m_DIBData);
return param.m_DIBData->m_Data == m_DIBData->m_Data;
}
HDC GetDC (void);
HDC GetDC (void) const;
void ReleaseDC (HDC) const;
void UseDC (HDC);
// These are not really consts, but behave like that (the state of the object
// is not the same on return, but it has the same functionality). This was needed
// to keep GetDC() const happy.
HBITMAP GetBitmap (void) const; // actually creates the DIB section (if needed)
void ReleaseBitmap (void) const; // call to free up GDI resources
unsigned char *CDIBSurface::GetMem (void)
{
ASSERT (m_DIBData);
if(!m_DIBData->m_Data)
return NULL;
if(!GdiFlush ())
return NULL;
return m_DIBData->m_UpperLeft;
}
unsigned char *GetMem( int x, int y );
unsigned char *GetData( void )
{
ASSERT( m_DIBData );
if( !(m_DIBData->m_Data && GdiFlush()) )
return( NULL );
return( m_DIBData->m_Data );
}
const unsigned char *GetData( void ) const
{
ASSERT( m_DIBData );
if( !(m_DIBData->m_Data && GdiFlush()) )
return( NULL );
return( m_DIBData->m_Data );
}
bool ReleaseMem (unsigned char *)
{ return (GdiFlush ()==TRUE);}
const unsigned char *CDIBSurface::GetMem (void) const
{
ASSERT (m_DIBData);
if(!m_DIBData->m_Data)
return NULL;
if(!GdiFlush ())
return NULL;
return m_DIBData->m_UpperLeft;
}
void ReleaseMem (const unsigned char *) const
{}
int GetPitch (void) const
{
ASSERT (m_DIBData);
return m_DIBData->m_Pitch;
}
int GetLocation (UINT x,UINT y) const
{
int tx,ty;
ASSERT (m_DIBData);
ASSERT (((UINT) x) < m_DIBData->m_Width);
ASSERT (((UINT) y) < m_DIBData->m_Height);
switch(m_DIBData->m_BitDepth)
{
case 1:
x>>=3;
break;
case 4:
x>>=1;
break;
case 8:
break;
case 16:
x<<=1;
break;
case 24:
x *= 3;
break;
default:
ASSERT (false);
break;
}
tx = (int) x;
ty = (int) y;
return((ty*m_DIBData->m_Pitch)+tx);
}
DWORD GetValue (UINT x,UINT y) const
{
const unsigned char *mem;
DWORD toret;
ASSERT (m_DIBData);
ASSERT (((UINT) x) < m_DIBData->m_Width);
ASSERT (((UINT) y) < m_DIBData->m_Height);
mem = GetMem ();
mem += GetLocation (x,y);
toret = 0;
switch(m_DIBData->m_BitDepth)
{
case 1:
toret = (*mem >> ((~x)&0x07)) & 0x01; //lint !e504
break;
case 4:
if(x & 0x01)
toret = *mem & 0x0f;
else
toret = *mem>>4;
break;
case 8:
toret = *mem;
break;
case 16:
toret = (*(mem+1)<<8) + *(mem);
break;
case 24:
toret = ((*mem)<<16)+ ((*(mem+1))<<8) + (*(mem+2));
break;
default:
ASSERT (false);
break;
}
ReleaseMem (mem);
return toret;
}
void SetValue (UINT x,UINT y,DWORD value)
{
unsigned char *mem;
DWORD toret;
ASSERT (m_DIBData);
ASSERT (((UINT) x) < m_DIBData->m_Width);
ASSERT (((UINT) y) < m_DIBData->m_Height);
mem = GetMem ();
mem += GetLocation (x,y);
toret = 0;
switch(m_DIBData->m_BitDepth)
{
case 1:
if (value & 0x01)
*mem |= (0x01 << ((~x)&0x07));
else
*mem &= ~(0x01 << ((~x)&0x07));
break;
case 4:
value &= 0x0f;
if(x & 0x01)
{
*mem &= 0xf0;
*mem |= value;
}
else
{
value <<= 4;
*mem &= 0x0f;
*mem |= value;
}
break;
case 8:
value &= 0xff;
*mem = value;
break;
case 16:
value &= 0xffff;
*(mem+1) = value&0xff;
*(mem) = ((value>>8) & 0xff);
break;
case 24:
value &= 0xffffff;
*(mem+2) = value&0xff;
*(mem+1) = ((value>>8) & 0xff);
*(mem) = ((value>>16) & 0xff);
break;
default:
ASSERT (false);
break;
}
ReleaseMem (mem);
}
COLORREF GetColor (UINT x,UINT y) const;
void SetColor (UINT x,UINT y,COLORREF color);
void SetColor( COLORREF color );
bool Fill (const CRect *therect,const COLORREF colorref=0);
bool Fill (const int left,const int top,const int right,const int bottom,const COLORREF colorref=0)
{return Fill (&CRect(left,top,right,bottom),colorref);} //lint !e50
bool Fill (const CPoint& topleft,const CPoint& botright,const COLORREF colorref=0)
{return Fill (&CRect (topleft,botright),colorref);} //lint !e50
bool Fill (const CRect& therect,const COLORREF colorref=0)
{return Fill (&therect,colorref);}
bool FillHatchBrush (const CRect *therect,
int stockHatchBrushStyle,const COLORREF colorref=0);
bool FillHatchBrush (const int left,const int top,const int right,
const int bottom,int stockHatchBrushStyle,const COLORREF colorref=0)
{return FillHatchBrush (&CRect(left,top,right,bottom),
stockHatchBrushStyle, colorref);} //lint !e50
bool HighlightFrame (const CRect& therect,bool up); // light is from upper left
void HLine( int x1, int x2, int y, COLORREF crColor );
bool Blt (int x,int y,int width,int height,const CDIBSurface *src,int srcx,int srcy,DWORD rop=SRCCOPY);
bool Blt (const CPoint& loc,const CSize& size,const CDIBSurface *src,const CPoint& srcloc,DWORD rop=SRCCOPY)
{return Blt (loc.x,loc.y,size.cx,size.cy,src,srcloc.x,srcloc.y,rop);}
bool Blt (const CRect& loc,const CDIBSurface *src,const CPoint& srcloc,DWORD rop=SRCCOPY)
{return Blt (loc.left,loc.top,loc.Width(),loc.Height(),src,srcloc.x,srcloc.y,rop);}
bool Blt (int x,int y,int width,int height,const CDIBSurface& src,int srcx,int srcy,DWORD rop=SRCCOPY)
{return Blt (x,y,width,height,&src,srcx,srcy,rop);}
bool Blt (const CPoint& loc,const CSize& size,const CDIBSurface& src,const CPoint& srcloc,DWORD rop=SRCCOPY)
{return Blt (loc.x,loc.y,size.cx,size.cy,&src,srcloc.x,srcloc.y,rop);}
bool Blt (const CRect& loc,const CDIBSurface& src,const CPoint& srcloc,DWORD rop=SRCCOPY)
{return Blt (loc.left,loc.top,loc.Width(),loc.Height(),&src,srcloc.x,srcloc.y,rop);}
bool Blt (int x,int y,int width,int height,HDC src,int srcx,int srcy,DWORD rop)
{
ASSERT (m_DIBData);
ASSERT (src);
ASSERT (IsValid ());
if((!src) || (!IsValid()))
return false;
HDC dc;
bool toret;
dc = GetDC ();
toret = (::BitBlt (dc,x,y,width,height,src,srcx,srcy,rop)==TRUE);
ReleaseDC (dc);
return toret;
}
// these two are functionally equivalent to their normal versions but do not
// perform format or palette conversions and do not use any GDI resources
bool BltNonGDI (int x,int y,int width,int height,const CDIBSurface& src,int srcx,int srcy);
bool MaskBltNonGDI (int x,int y,int width,int height,const CDIBSurface& src,int srcx,int srcy);
bool MaskBlt (const int x,const int y,const int width,const int height,const HDC src,const HDC mask,const int srcx,const int srcy);
bool MaskBlt (const int x,const int y,const int width,const int height,const CDIBSurface *src,const int srcx,const int srcy);
bool AlphaBlt (const int x,const int y,const int width,const int height,const CDIBSurface *src,const CDIBSurface *alpha,const int srcx,const int srcy,const int alphasrcx=-1,const int alphasrcy=-1);
bool AlphaBlt (const CRect& loc,const CDIBSurface *src,const CDIBSurface *alpha,const CPoint& srcloc)
{ return AlphaBlt (loc.left,loc.top,loc.Width (),loc.Height(),src,alpha,srcloc.x,srcloc.y); }
bool AlphaBlt (const CRect& loc,const CDIBSurface *src,const CDIBSurface *alpha,const CPoint& srcloc,const CPoint& alphaloc)
{ return AlphaBlt (loc.left,loc.top,loc.Width (),loc.Height(),src,alpha,srcloc.x,srcloc.y,alphaloc.x,alphaloc.y); }
bool AlphaBlt (const int x,const int y,const int width,const int height,const CDIBSurface& src,const CDIBSurface& alpha,const int srcx,const int srcy,const int alphasrcx=-1,const int alphasrcy=-1)
{ return AlphaBlt (x,y,width,height,&src,&alpha,srcx,srcy,alphasrcx,alphasrcy); }
bool AlphaBlt (const CRect& loc,const CDIBSurface& src,const CDIBSurface& alpha,const CPoint& srcloc)
{ return AlphaBlt (loc.left,loc.top,loc.Width (),loc.Height(),&src,&alpha,srcloc.x,srcloc.y); }
bool AlphaBlt (const CRect& loc,const CDIBSurface& src,const CDIBSurface& alpha,const CPoint& srcloc,const CPoint& alphaloc)
{ return AlphaBlt (loc.left,loc.top,loc.Width (),loc.Height(),&src,&alpha,srcloc.x,srcloc.y,alphaloc.x,alphaloc.y); }
bool RotateBlt( int left, int top, int right, int bottom, const CDIBSurface& src, int x, int y, int ang );
bool RotateBlt( const CRect& loc, const CDIBSurface& src, const CPoint& srcloc, int ang )
{ return( RotateBlt( loc.left, loc.top, loc.right, loc.bottom, src, srcloc.x, srcloc.y, ang ) ); }
bool TransparentBlt( int left, int top, int right, int bottom, const CDIBSurface& src, int x, int y, const COLORREF bgClr );
bool TransparentBlt( const CRect& loc, const CDIBSurface& src, const CPoint& srcloc, const COLORREF bgClr )
{ return( TransparentBlt( loc.left, loc.top, loc.right, loc.bottom, src, srcloc.x, srcloc.y, bgClr ) ); }
bool ColorBlt (const int x,const int y,const int width,const int height,const CDIBSurface* src,const int srcx,const int srcy,const COLORREF color,bool addred=true,bool addgreen=true,bool addblue=true,CDIBSurface *altmask=NULL);
bool ColorBlt (const CRect& loc,const CDIBSurface* src,const CPoint& srcloc,const COLORREF color,bool addred=true,bool addgreen=true,bool addblue=true,CDIBSurface *altmask=NULL)
{ return ColorBlt (loc.left,loc.top,loc.Width (),loc.Height (),src,srcloc.x,srcloc.y,color,addred,addgreen,addblue,altmask); }
bool GrayBlt (const int x,const int y,const int width,const int height,const CDIBSurface* src,const int srcx,const int srcy, CDIBSurface *altmask=NULL);
bool MultBlt (const int x,const int y,const int width,const int height,const CDIBSurface* src,const int srcx,const int srcy,const float red,const float green,const float blue,CDIBSurface *altmask=NULL);
bool MultBlt (const CRect& loc,const CDIBSurface* src,const CPoint& srcloc,const float red,const float green,const float blue,CDIBSurface *altmask=NULL)
{ return MultBlt (loc.left,loc.top,loc.Width (),loc.Height (),src,srcloc.x,srcloc.y,red,green,blue,altmask); }
bool SetClipArea (HRGN newcliparea)
{ return false; /* ASSERT (m_DIBData);if(SelectClipRgn (m_DIBData->m_BackDC,newcliparea) == ERROR) return false;return true;*/}
bool StretchBlt (const CRect& loc,const CDIBSurface *src,const CRect& srcloc,DWORD rop=SRCCOPY)
{return StretchBlt (loc.left,loc.top,loc.Width(),loc.Height(),src,srcloc.left,srcloc.top,srcloc.Width(),srcloc.Height(),rop);}
bool StretchBlt (const CRect& loc,const CDIBSurface& src,const CRect& srcloc,DWORD rop=SRCCOPY)
{return StretchBlt (loc.left,loc.top,loc.Width(),loc.Height(),&src,srcloc.left,srcloc.top,srcloc.Width(),srcloc.Height(),rop);}
bool StretchBlt (int x,int y,int width,int height,const CDIBSurface *src,int srcx,int srcy,int srcwidth,int srcheight,DWORD rop)
{
ASSERT (m_DIBData);
ASSERT (src);
ASSERT (IsValid ());
if((!src) || (!IsValid()))
return false;
HDC dc1,dc2;
bool toret;
dc1 = GetDC ();
dc2 = src->GetDC ();
ASSERT (dc1 && dc2);
toret = (::StretchBlt (dc1,x,y,width,height,dc2,srcx,srcy,srcwidth,srcheight,rop)==TRUE);
ReleaseDC (dc1);
src->ReleaseDC (dc2);
return toret;
}
bool StretchBlt (int x,int y,int width,int height,HDC src,int srcx,int srcy,int srcwidth,int srcheight,DWORD rop)
{
ASSERT (m_DIBData);
ASSERT (src);
ASSERT (IsValid ());
if((!src) || (!IsValid()))
return false;
HDC dc;
bool toret;
dc = GetDC ();
toret = (::StretchBlt (dc,x,y,width,height,src,srcx,srcy,srcwidth,srcheight,rop)==TRUE);
ReleaseDC (dc);
return toret;
}
int FloodFill (const CPoint& start,const COLORREF color);
bool SetSize (UINT cx,UINT cy,UINT BitDepth)
{ ASSERT (m_DIBData);Destroy (); return Create (cx,cy,BitDepth);}
UINT GetWidth (void) const
{ ASSERT (m_DIBData);return m_DIBData->m_Width;}
UINT GetHeight (void) const
{ ASSERT (m_DIBData);return m_DIBData->m_Height;}
UINT GetBitDepth (void) const
{ ASSERT (m_DIBData);return m_DIBData->m_BitDepth;}
CSize GetSize( void ) const
{ ASSERT (m_DIBData); return CSize( m_DIBData->m_Width, m_DIBData->m_Height ); }
CDIBSurface* Mask (void)
{ ASSERT (m_DIBData);return m_DIBData->m_Mask;}
const CDIBSurface* Mask (void) const
{ ASSERT (m_DIBData);return m_DIBData->m_Mask;}
bool UseMask (void) const
{ ASSERT (m_DIBData);return m_DIBData->m_UseMask;}
void UseMask (bool newflag)
{ ASSERT (m_DIBData);if((!newflag) || ((m_DIBData->m_Mask) && (m_DIBData->m_Mask->IsValid ()))) m_DIBData->m_UseMask = newflag;}
bool IsValid (void) const
{ ASSERT (m_DIBData);return m_DIBData->m_Data != NULL;}
bool CopyBitmap(HBITMAP hbm,int x,int y,int dx,int dy);
bool CalcMask (COLORREF colorref);
bool CalcMask (const std::vector<COLORREF>& colors);
bool CalcMask (void);
bool DestroyMask (void);
bool ConvertBitDepth (int newdepth);
bool ConvertToGray (void); // converts contents to 8-bit with gray palette
//white is transparent
WORD ConvertColorToWord( COLORREF crColor )
{ return( WORD( ((0xf80000 & crColor) >> 19) | ((0xf800 & crColor) >> 6) | ((0xf8 & crColor) << 7) ) ); }
RGBTRIPLE ConvertColorToTriple( COLORREF crColor )
{ RGBTRIPLE rgb = { (0xff & crColor) >> 16, 0xff & (crColor >> 8), 0xff & crColor }; return( rgb ); }
DWORD ConvertColorToLong( COLORREF crColor )
{ return( DWORD( 0x00ffffff & crColor ) ); }
COLORREF ConvertWordToColor( WORD wColor )
{ return( RGB( (0x7c00 & wColor) >> 7, (0x03e0 & wColor) >> 2, (0x1f & wColor) << 3 ) ); }
COLORREF ConvertTripleToColor( RGBTRIPLE rgbColor )
{ return( RGB( rgbColor.rgbtRed, rgbColor.rgbtGreen, rgbColor.rgbtBlue ) ); }
COLORREF ConvertLongToColor( DWORD dwColor )
{ return( RGB( 0xff & dwColor, (0xff00 & dwColor) >> 8, (0xff0000 & dwColor) >> 16 ) ); }
void ClearOutsideMask (void) // clears any part of the bitmap that is in the transparent part of the mask
{ if (Mask())
Blt (0, 0, GetWidth(), GetHeight(), Mask(), 0, 0, 0x00220326); // DSna
}
bool SplitRef (void);
void AddRef (void)
{
ASSERT (m_RefCount);
(*m_RefCount)++;
if(!m_DCStackRefCount)
{
m_AllDCs = new std::vector<DCData>;
m_FreeDC = new std::vector<HDC>;
}
m_DCStackRefCount++;
}
bool Release (void)
{
ASSERT (m_RefCount);
ASSERT (*m_RefCount);
ASSERT (m_DIBData);
m_DCStackRefCount--;
if(!m_DCStackRefCount)
{
std::vector<DCData>::iterator iter;
ASSERT (m_FreeDC->size () == m_AllDCs->size ());
iter = m_AllDCs->begin ();
while(iter != m_AllDCs->end ())
{
DeleteDC (iter->thedc);
iter++;
}
delete m_FreeDC;
delete m_AllDCs;
m_FreeDC = NULL;
m_AllDCs = NULL;
}
(*m_RefCount)--;
if (!(*m_RefCount))
{
Destroy ();
delete m_RefCount;
delete m_DIBData;
m_RefCount = NULL;
m_DIBData = NULL;
return false;
}
return true;
}
#if 0
static void *operator new (size_t size)
{
void *temp;
temp = new BYTE[size];
if(!temp)
{
return NULL;
}
memset (temp,0,size);
((CDIBSurface *) temp)->m_RefCount = 1;
((CDIBSurface *) temp)->m_Alloced = true;
return temp;
}
static void operator delete (void *,size_t)
{ }
#endif
};
bool MaskBlt (HDC dest,const int x,const int y,const int width,const int height,const HDC src,const HDC mask,const int srcx,const int srcy);
bool MaskBlt (HDC dest,const int x,const int y,const int width,const int height,const HDC src,const HDC mask,const int srcx,const int srcy,const int maskx,const int masky);
bool MaskBlt (HDC dest,const int x,const int y,const int width,const int height,const CDIBSurface *src,const int srcx,const int srcy);
inline bool MaskBlt (HDC dest,const CPoint& loc,const CSize& size,const CDIBSurface *src,const CPoint& srcloc)
{return MaskBlt (dest,loc.x,loc.y,size.cx,size.cy,src,srcloc.x,srcloc.y);}
inline bool MaskBlt (HDC dest,const CRect& loc,const CDIBSurface *src,const CPoint& srcloc)
{return MaskBlt (dest,loc.left,loc.top,loc.Width(),loc.Height(),src,srcloc.x,srcloc.y);}
#endif
@@ -0,0 +1,74 @@
// mapquery.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "mapquery.h"
#include "mapqueryDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMapqueryApp
BEGIN_MESSAGE_MAP(CMapqueryApp, CWinApp)
//{{AFX_MSG_MAP(CMapqueryApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMapqueryApp construction
CMapqueryApp::CMapqueryApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CMapqueryApp object
CMapqueryApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CMapqueryApp initialization
BOOL CMapqueryApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CMapqueryDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
@@ -0,0 +1,160 @@
# Microsoft Developer Studio Project File - Name="mapquery" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=mapquery - 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 "mapquery.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 "mapquery.mak" CFG="mapquery - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mapquery - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "mapquery - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "mapquery - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../rel.bin"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "mapquery - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../../../dbg.bin"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "mapquery - Win32 Release"
# Name "mapquery - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\dibspec.cpp
# End Source File
# Begin Source File
SOURCE=.\dibsurf.cpp
# End Source File
# Begin Source File
SOURCE=.\mapquery.cpp
# End Source File
# Begin Source File
SOURCE=.\mapquery.rc
# End Source File
# Begin Source File
SOURCE=.\mapqueryDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\dibsection.hpp
# End Source File
# Begin Source File
SOURCE=.\dibsurf.hpp
# End Source File
# Begin Source File
SOURCE=.\mapquery.h
# End Source File
# Begin Source File
SOURCE=.\mapqueryDlg.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.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"
# Begin Source File
SOURCE=.\res\mapquery.ico
# End Source File
# Begin Source File
SOURCE=.\res\mapquery.rc2
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project
@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "mapquery"=.\mapquery.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
@@ -0,0 +1,49 @@
// mapquery.h : main header file for the MAPQUERY application
//
#if !defined(AFX_MAPQUERY_H__05DC9880_608F_4392_BEB3_8E78F0782095__INCLUDED_)
#define AFX_MAPQUERY_H__05DC9880_608F_4392_BEB3_8E78F0782095__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CMapqueryApp:
// See mapquery.cpp for the implementation of this class
//
class CMapqueryApp : public CWinApp
{
public:
CMapqueryApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMapqueryApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CMapqueryApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAPQUERY_H__05DC9880_608F_4392_BEB3_8E78F0782095__INCLUDED_)
@@ -0,0 +1,222 @@
//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
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\mapquery.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\mapquery.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About mapquery"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "mapquery Version 1.0",IDC_STATIC,40,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2000",IDC_STATIC,40,25,119,8
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
END
IDD_MAPQUERY_DIALOG DIALOGEX 0, 0, 442, 335
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "mapquery"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Quit",IDOK,26,158,50,14
PUSHBUTTON "Query",IDC_QUERY,26,102,50,14
EDITTEXT IDC_EDITXVALUE,46,36,40,14,ES_AUTOHSCROLL
EDITTEXT IDC_EDITYVALUE,46,62,40,14,ES_AUTOHSCROLL
LTEXT "X-Value",IDC_STATIC,14,39,26,8
LTEXT "Y-Value",IDC_STATIC,14,65,26,8
LTEXT "Map Value",IDC_STATIC,17,84,35,8
LTEXT "Static",IDC_MAPVALUE,59,84,19,8
PUSHBUTTON "Open",IDC_FILEOPEN,26,130,50,14
CONTROL "Leg",IDC_LEG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
BS_FLAT | WS_TABSTOP,26,185,42,10
CONTROL "Track",IDC_TRACK,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
BS_FLAT | WS_TABSTOP,26,206,42,10
CONTROL "Wheel",IDC_WHEEL,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
BS_FLAT | WS_TABSTOP,26,230,42,10
CONTROL "Hover",IDC_HOVER,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
BS_FLAT | WS_TABSTOP,26,251,42,10
CONTROL "Blocked",IDC_BLOCK,"Button",BS_AUTOCHECKBOX |
BS_PUSHLIKE | BS_FLAT | WS_TABSTOP,26,274,42,10
END
#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", "\0"
VALUE "FileDescription", "mapquery MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "mapquery\0"
VALUE "LegalCopyright", "Copyright (C) 2000\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "mapquery.EXE\0"
VALUE "ProductName", "mapquery Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
IDD_MAPQUERY_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 435
TOPMARGIN, 7
BOTTOMMARGIN, 328
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ABOUTBOX "&About mapquery..."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\mapquery.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
@@ -0,0 +1,485 @@
// mapqueryDlg.cpp : implementation file
//
#include "stdafx.h"
#include "mapquery.h"
#include "mapqueryDlg.h"
#include <stdio.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define MAPLEFT 135
#define MAPTOP 10
#define MAPWIDTH 512
#define MAPHEIGHT 512
const unsigned short LEGPASS_FLAG = 0x0001; // true if legged units cannot use
const unsigned short HOVERPASS_FLAG = 0x0002; // true if hover units cannot use
const unsigned short TRACKPASS_FLAG = 0x0004; // true if track units cannot use
const unsigned short WHEELPASS_FLAG = 0x0008; // true if wheel units cannot use
const unsigned short WATERPASS_FLAG = 0x0010; // true if water units cannot use
const unsigned short JUMPPASS_FLAG = 0x0020; // true if cannot jump through
const unsigned short MOVEPASSNOW_FLAG = 0x0040; // if a vehicle has this cell blocked now
const unsigned short BRIDGE_FLAG = 0x0080; // true if this cell is a bridge cell
const unsigned short WATER1_FLAG = 0x0100; // with water 2 for four levels of water
const unsigned short WATER2_FLAG = 0x0200; // no, shallow, medium, deep
const unsigned short STEEP1_FLAG = 0x0400; // with steep 2 for steepness of slope for descending, going up uses blocked flags
const unsigned short STEEP2_FLAG = 0x0800; // mech down, track down, wheel down, hover down
const unsigned short SLOPEDIR1_FLAG = 0x1000; // quanta of slope direction
const unsigned short SLOPEDIR2_FLAG = 0x2000;
const unsigned short SLOPEDIR3_FLAG = 0x4000;
const int HOVERDOWN_SLOPE = 0;
const int WHEELDOWN_SLOPE = 1;
const int TRACKDOWN_SLOPE = 2;
const int LEGDOWN_SLOPE = 3;
const int STEEP_MASK = 0x0c00;
const int STEEP_SHIFT = 10;
const int NO_WATER = 0;
const int SHALLOW_WATER = 1;
const int MEDIUM_WATER = 2;
const int DEEP_WATER = 3;
const int WATER_MASK = 0x0300;
const int WATER_SHIFT = 8;
const int SLOPEDIR_MASK = 0x7000;
const int SLOPEDIR_SHIFT = 12;
const float LEGUP_SLOPE_THRESHOLD = 0.707f; //cos (45 deg)
const float LEGDOWN_SLOPE_THRESHOLD = 0.5f; //cos (60 deg)
const float TRACKUP_SLOPE_THRESHOLD = 0.819f; //cos (35 deg)
const float TRACKDOWN_SLOPE_THRESHOLD = 0.707f; //cos (45 deg)
const float WHEELUP_SLOPE_THRESHOLD = 0.906f; //cos (25 deg)
const float WHEELDOWN_SLOPE_THRESHOLD = 0.819f; //cos (35 deg)
const float HOVERUP_SLOPE_THRESHOLD = 0.965f; //cos (15 deg)
const float HOVERDOWN_SLOPE_THRESHOLD = 0.906f; //cos (25 deg)
const unsigned short BLOCKED_FLAGS = 0x003f; // for all blocked flags
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMapqueryDlg dialog
CMapqueryDlg::CMapqueryDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMapqueryDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMapqueryDlg)
m_YValue = 0;
m_XValue = 0;
m_Value = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_Width = 1;
m_Height = 1;
}
void CMapqueryDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMapqueryDlg)
DDX_Control(pDX, IDC_WHEEL, m_Wheel);
DDX_Control(pDX, IDC_TRACK, m_Track);
DDX_Control(pDX, IDC_LEG, m_Leg);
DDX_Control(pDX, IDC_HOVER, m_Hover);
DDX_Control(pDX, IDC_BLOCK, m_Block);
DDX_Text(pDX, IDC_EDITYVALUE, m_YValue);
DDV_MinMaxInt(pDX, m_YValue, 0, m_Height);
DDX_Text(pDX, IDC_EDITXVALUE, m_XValue);
DDV_MinMaxInt(pDX, m_XValue, 0, m_Width);
DDX_Text(pDX, IDC_MAPVALUE, m_Value);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMapqueryDlg, CDialog)
//{{AFX_MSG_MAP(CMapqueryDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_QUERY, OnQuery)
ON_BN_CLICKED(IDC_FILEOPEN, OnFileopen)
ON_WM_MOUSEMOVE()
ON_BN_CLICKED(IDC_BLOCK, OnBlock)
ON_BN_CLICKED(IDC_HOVER, OnHover)
ON_BN_CLICKED(IDC_LEG, OnLeg)
ON_BN_CLICKED(IDC_TRACK, OnTrack)
ON_BN_CLICKED(IDC_WHEEL, OnWheel)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMapqueryDlg message handlers
BOOL CMapqueryDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_MapSurf.Create (10,10,24);
m_MapSurf.SetColor (RGB (0,0,0));
m_Data = NULL;
return TRUE; // return TRUE unless you set the focus to a control
}
void CMapqueryDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CMapqueryDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CPaintDC dc(this);
HDC surfdc;
surfdc = m_MapSurf.GetDC ();
CDC surface;
surface.Attach (surfdc);
dc.StretchBlt (MAPLEFT,MAPTOP,MAPWIDTH,MAPHEIGHT,&surface,0,0,m_MapSurf.GetWidth (),m_MapSurf.GetHeight (),SRCCOPY);
surface.Detach ();
m_MapSurf.ReleaseDC (surfdc);
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMapqueryDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CMapqueryDlg::OnQuery()
{
// TODO: Add your control notification handler code here
UpdateData (TRUE);
int value;
value = m_Data[m_YValue][m_XValue];
m_Value.Format ("%x",value);
UpdateData (FALSE);
}
void CMapqueryDlg::OnFileopen()
{
// TODO: Add your control notification handler code here
CFileDialog dlg(TRUE);
dlg.m_ofn.lpstrInitialDir = "content\\missions";
if (dlg.DoModal ()== IDOK)
{
CString filename;
FILE *file;
int datasize,size,chunksize;
m_Wheel.SetCheck (1);
m_Track.SetCheck (1);
m_Leg.SetCheck (1);
m_Hover.SetCheck (1);
m_Block.SetCheck (1);
filename = dlg.GetPathName ();
file = fopen ((LPCTSTR) filename,"rb");
m_Data = NULL;
m_AllocWidth = 0;
m_AllocHeight = 0;
fread (&m_Width,sizeof (m_Width),1,file);
m_Width *= -1;
fread (&m_Height,sizeof (m_Height),1,file);
m_Height *= -1;
fread (&datasize,sizeof (datasize),1,file);
m_Width /= 10;
m_Height /= 10;
m_Data = new unsigned short *[m_Height];
m_AllocHeight = m_Height;
m_AllocWidth = m_Width;
for (int i=0;i<m_Height;i++)
{
m_Data[i] = new unsigned short[m_Width];
}
size = m_Height;
chunksize = m_Width;
chunksize <<= 1;
for (i=0;i<size;i++)
{
fread (m_Data[size - i - 1],chunksize,1,file);
datasize -= chunksize;
}
int x,y;
for (y=0;y<m_Height;y++)
{
for (x=0;x<(m_Width>>1);x++)
{
unsigned short temp;
temp = m_Data[y][x];
m_Data[y][x] = m_Data[y][m_Width-x];
m_Data[y][m_Width-x] = temp;
}
}
fclose (file);
BuildSurface ();
}
}
void CMapqueryDlg::BuildSurface(void)
{
int x,y;
if (m_Data)
{
m_MapSurf.Create (m_Width,m_Height,24);
for (y=0;y<m_Height;y++)
{
for (x=0;x<m_Width;x++)
{
m_MapSurf.SetColor (x,y,RGB (255,255,255));
if (m_Data[y][x] & WATER_MASK)
{
switch ((m_Data[y][x] & WATER_MASK) >> WATER_SHIFT)
{
case SHALLOW_WATER:
m_MapSurf.SetColor (x,y,RGB (0,0,255));
break;
case MEDIUM_WATER:
m_MapSurf.SetColor (x,y,RGB (0,0,128));
break;
case DEEP_WATER:
m_MapSurf.SetColor (x,y,RGB (0,0,64));
break;
}
continue;
}
else if ((m_Leg.GetCheck ()) && (m_Data[y][x] & (LEGPASS_FLAG)))
{
m_MapSurf.SetColor (x,y,RGB (255,0,0));
}
else if ((m_Track.GetCheck ()) && (m_Data[y][x] & (TRACKPASS_FLAG)))
{
m_MapSurf.SetColor (x,y,RGB (196,0,0));
}
else if ((m_Wheel.GetCheck ()) && (m_Data[y][x] & (WHEELPASS_FLAG)))
{
m_MapSurf.SetColor (x,y,RGB (128,0,0));
}
else if ((m_Hover.GetCheck ()) && (m_Data[y][x] & (HOVERPASS_FLAG)))
{
m_MapSurf.SetColor (x,y,RGB (64,0,0));
}
else if (m_Data[y][x] & BRIDGE_FLAG)
{
m_MapSurf.SetColor (x,y,RGB (0,255,0));
}
}
}
}
InvalidateRect (NULL,FALSE);
}
BOOL CMapqueryDlg::DestroyWindow()
{
int i,size;
if (m_Data)
{
size = m_Height;
for (i=0;i<size;i++)
{
delete[] m_Data[i];
}
delete[] m_Data;
m_Data = NULL;
}
return CDialog::DestroyWindow();
}
void CMapqueryDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
int mapx,mapy;
if (!m_Data)
{
CDialog::OnMouseMove(nFlags, point);
return;
}
mapx = point.x - MAPLEFT;
mapy = point.y - MAPTOP;
if ((mapx < 0) || (mapy < 0))
CDialog::OnMouseMove(nFlags, point);
else if ((mapx>=MAPWIDTH) || (mapy >= MAPHEIGHT))
CDialog::OnMouseMove(nFlags, point);
else
{
float dx,dy;
dx = ((float) MAPWIDTH) / ((float) m_MapSurf.GetWidth ());
dy = ((float) MAPHEIGHT) / ((float) m_MapSurf.GetHeight ());
mapx /= dx;
mapy /= dy;
int value;
value = m_Data[m_YValue][m_XValue];
m_Value.Format ("%x",value);
m_XValue = mapx;
m_YValue = mapy;
UpdateData (FALSE);
}
}
void CMapqueryDlg::OnBlock()
{
// TODO: Add your control notification handler code here
BuildSurface ();
InvalidateRect (NULL,FALSE);
}
void CMapqueryDlg::OnHover()
{
// TODO: Add your control notification handler code here
BuildSurface ();
InvalidateRect (NULL,FALSE);
}
void CMapqueryDlg::OnLeg()
{
// TODO: Add your control notification handler code here
BuildSurface ();
InvalidateRect (NULL,FALSE);
}
void CMapqueryDlg::OnTrack()
{
// TODO: Add your control notification handler code here
BuildSurface ();
InvalidateRect (NULL,FALSE);
}
void CMapqueryDlg::OnWheel()
{
// TODO: Add your control notification handler code here
BuildSurface ();
InvalidateRect (NULL,FALSE);
}
@@ -0,0 +1,76 @@
// mapqueryDlg.h : header file
//
#include "dibsurf.hpp"
#if !defined(AFX_MAPQUERYDLG_H__8526FD5F_2A3F_469E_8D50_8A4727526128__INCLUDED_)
#define AFX_MAPQUERYDLG_H__8526FD5F_2A3F_469E_8D50_8A4727526128__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CMapqueryDlg dialog
class CMapqueryDlg : public CDialog
{
// Construction
public:
CMapqueryDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CMapqueryDlg)
enum { IDD = IDD_MAPQUERY_DIALOG };
CButton m_Wheel;
CButton m_Track;
CButton m_Leg;
CButton m_Hover;
CButton m_Block;
int m_YValue;
int m_XValue;
CString m_Value;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMapqueryDlg)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
int m_Width,m_Height; // in meters
unsigned short **m_Data; // two dimensional array for width and height. PASS_FLAG flags at top
CDIBSurface m_MapSurf;
int m_AllocWidth,m_AllocHeight;
void BuildSurface(void);
// Generated message map functions
//{{AFX_MSG(CMapqueryDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnQuery();
afx_msg void OnFileopen();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnBlock();
afx_msg void OnHover();
afx_msg void OnLeg();
afx_msg void OnTrack();
afx_msg void OnWheel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAPQUERYDLG_H__8526FD5F_2A3F_469E_8D50_8A4727526128__INCLUDED_)
Binary file not shown.
@@ -0,0 +1,13 @@
//
// MAPQUERY.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,30 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by mapquery.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_MAPQUERY_DIALOG 102
#define IDR_MAINFRAME 128
#define IDC_QUERY 1000
#define IDC_EDITXVALUE 1001
#define IDC_EDITYVALUE 1002
#define IDC_MAPVALUE 1003
#define IDC_FILEOPEN 1004
#define IDC_LEG 1008
#define IDC_TRACK 1009
#define IDC_WHEEL 1010
#define IDC_HOVER 1011
#define IDC_BLOCK 1012
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1013
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif