home *** CD-ROM | disk | FTP | other *** search
/ Instant Doom Levels / Instant.Doom.Levels.-.Level.Master.II.iso / EDITORS / ZIPPED / WSCDEU52.ZIP / INCLUDE / BMP256CT.H < prev    next >
C/C++ Source or Header  |  1995-03-05  |  5KB  |  174 lines

  1. /*----------------------------------------------------------------------------*
  2.  | This file is part of WinDEU, the port of DEU to Windows.                   |
  3.  | WinDEU was created by the DEU team:                                        |
  4.  |  Renaud Paquay, Raphael Quinet, Brendon Wyber and others...                |
  5.  |                                                                            |
  6.  | DEU is an open project: if you think that you can contribute, please join  |
  7.  | the DEU team.  You will be credited for any code (or ideas) included in    |
  8.  | the next version of the program.                                           |
  9.  |                                                                            |
  10.  | If you want to make any modifications and re-distribute them on your own,  |
  11.  | you must follow the conditions of the WinDEU license. Read the file        |
  12.  | LICENSE or README.TXT in the top directory.  If do not  have a copy of     |
  13.  | these files, you can request them from any member of the DEU team, or by   |
  14.  | mail: Raphael Quinet, Rue des Martyrs 9, B-4550 Nandrin (Belgium).         |
  15.  |                                                                            |
  16.  | This program comes with absolutely no warranty.  Use it at your own risks! |
  17.  *----------------------------------------------------------------------------*
  18.  
  19.     Project WinDEU
  20.     DEU team
  21.     Jul-Dec 1994, Jan-Mar 1995
  22.  
  23.     FILE:         bmp256ct.h
  24.  
  25.     OVERVIEW
  26.     ========
  27.     Class definition for TBitmap256Control (TControl).
  28. */
  29. #if !defined(__bmp256ct_h)              // Sentry, use file only if it's not already included.
  30. #define __bmp256ct_h
  31.  
  32. #ifndef __common_h
  33.     #include "common.h"
  34. #endif
  35.  
  36. #ifndef __OWL_CONTROL_H
  37.     #include <owl\control.h>
  38. #endif
  39.  
  40. #ifndef __OWL_DC_H
  41.     class _OWLCLASS TDC;
  42. #endif
  43.  
  44.  
  45. //{{TControl = TBitmap256Control}}
  46. class TBitmap256Control : public TControl
  47. {
  48. private:
  49.     TPalette     *pBitmapPalette;
  50.     PALETTEENTRY *pDoomPaletteEntries;
  51.     int           NumDoomPalette;
  52.     int           MaxWidth ;
  53.     int           MaxHeight;
  54.  
  55. protected:
  56.     USHORT     BitmapXSize;
  57.     USHORT     BitmapYSize;
  58.     BYTE HUGE *pBitmapData;        // huge on Win16
  59.     BOOL      *pUsedColors;
  60.     BYTE      *pEntryMapping;
  61.     BYTE       NbEntries;
  62.     UINT       ZoomFactor;
  63.     UINT       GammaLevel;
  64.     char       BitmapName[10];
  65.  
  66.     // DIB info
  67.     LPBITMAPINFO pDIBInfo;
  68.     BYTE HUGE   *pDIBits;
  69.  
  70. protected:
  71.     // pure Virtual function redefined for things, walls, floors/celings
  72.     virtual void BuildBitmapData (const char *name, SHORT remapPlayer = 0) = 0;
  73.  
  74.     void DisplayBitmap (TDC &dc, TRect &rect);
  75.     void BuildBitmapPalette (BOOL CreateNewPal = TRUE);
  76.     void BuildBitmap ();
  77.     void ConvertBitmapToDib();
  78.     void LoadDoomPalette (int playpalnum);
  79.     void AdjustWindowSize ();
  80.     void AdjustScroller ();
  81.     ULONG DataOfs(short x, short y)
  82.     {
  83.         assert (x >= 0);
  84.         assert (x < BitmapXSize);
  85.         assert (y >= 0);
  86.         assert (y < BitmapYSize);
  87.         return (ULONG)y * BitmapXSize + x;
  88.     }
  89.     void GammaAdjustEntry (PALETTEENTRY &entry)
  90.     {
  91.         entry.peRed   = (BYTE)min (entry.peRed   + GammaLevel, 255);
  92.         entry.peGreen = (BYTE)min (entry.peGreen + GammaLevel, 255);
  93.         entry.peBlue  = (BYTE)min (entry.peBlue  + GammaLevel, 255);
  94.     }
  95.  
  96. public:
  97.     TBitmap256Control (TWindow* parent, int id, const char far* title,
  98.                        int x, int y, int w, int h, TModule* module = 0);
  99.     virtual ~TBitmap256Control ();
  100.  
  101.     void SelectBitmap (const char *name, SHORT remap = 0, int palnum = 0);
  102.     void SetZoomFactor (UINT factor);
  103.     UINT GetZoomFactor()     { return ZoomFactor; }
  104.     void SetGammaLevel (BYTE level);
  105.     UINT GetGammaLevel ()    { return GammaLevel; }
  106.  
  107. //{{TBitmap256ControlVIRTUAL_BEGIN}}
  108. public:
  109.     virtual void Paint (TDC& dc, BOOL erase, TRect& rect);
  110.     virtual char far*GetClassName ();
  111.     virtual void GetWindowClass (WNDCLASS& wndClass);
  112.     virtual void SetupWindow ();
  113. //{{TBitmap256ControlVIRTUAL_END}}
  114.  
  115.  
  116. //{{TBitmap256ControlRSP_TBL_BEGIN}}
  117. protected:
  118.     BOOL EvEraseBkgnd (HDC dc);
  119. //{{TBitmap256ControlRSP_TBL_END}}
  120. DECLARE_RESPONSE_TABLE(TBitmap256Control);
  121. };    //{{TBitmap256Control}}
  122.  
  123.  
  124. //
  125. //
  126. // Class to display a sprite
  127. //
  128. //
  129. class TSprite256Control : public TBitmap256Control
  130. {
  131. protected:
  132.     void LoadPictureData (const char *picname, BYTE HUGE **ppData,
  133.                           USHORT *pxsize, USHORT *pysize, SHORT remapPlayer = 0);
  134.     virtual void BuildBitmapData (const char *name, SHORT remapPlayer = 0);
  135.  
  136. public:
  137.     TSprite256Control (TWindow* parent, int id, const char far* title,
  138.                        int x, int y, int w, int h, TModule* module = 0);
  139. };
  140.  
  141.  
  142. //
  143. //
  144. // Class to display a wall texture
  145. //
  146. //
  147. class TWallTextureControl : public TSprite256Control
  148. {
  149. protected:
  150.     virtual void BuildBitmapData (const char *name, SHORT remapPlayer = 0);
  151.  
  152. public:
  153.     TWallTextureControl (TWindow* parent, int id, const char far* title,
  154.                          int x, int y, int w, int h, TModule* module = 0);
  155. };
  156.  
  157. //
  158. //
  159. // Class to display a Floor/Ceiling texture
  160. //
  161. //
  162. class TFloorTextureControl : public TSprite256Control
  163. {
  164. protected:
  165.     virtual void BuildBitmapData (const char *name, SHORT remapPlayer = 0);
  166.  
  167. public:
  168.     TFloorTextureControl (TWindow* parent, int id, const char far* title,
  169.                           int x, int y, int w, int h, TModule* module = 0);
  170. };
  171.  
  172. #endif                                      // __bmp256ct_h sentry.
  173.  
  174.