]> icculus.org git repositories - btb/d2x.git/blob - main/desw.h
use the orientation parameter of g3_draw_bitmap
[btb/d2x.git] / main / desw.h
1 /*
2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13
14 /*
15  *
16  * Stuff for Windows
17  *
18  */
19
20 #ifndef _DESW_H
21 #define _DESW_H
22
23
24 #define DESCENT_VIEWPORT_WIDTH  640
25 #define DESCENT_VIEWPORT_HEIGHT 480
26 #define DESCENT_RENDER_WIDTH    320
27 #define DESCENT_RENDER_HEIGHT   200
28
29
30 #define WIN95
31 #define _WIN32
32 #define WIN32_LEAN_AND_MEAN
33 #include <windows.h>
34
35 #include "win/dd.h"
36 #include "win/winapp.h"
37 #include "pstypes.h"
38 #include "fix.h"
39 #include "gr.h"
40
41 #undef D2_DEFAULT_PALETTE
42
43
44 #define WINAPP_NAME "Descent II"
45
46 typedef struct GAME_CONTEXT {
47         BOOL paused;
48         BOOL active;
49 };
50
51 typedef struct SCREEN_CONTEXT {
52         char *bkg_filename;
53 } SCREEN_CONTEXT;
54
55
56 typedef struct PALETTE {
57         WORD version;
58         WORD num_entries;
59         PALETTEENTRY entries[256];
60 } PALETTE;
61
62 typedef struct RGBBITMAPINFO {
63         BITMAPINFOHEADER    bmiHeader;
64         RGBQUAD             rgb[256];
65 } RGBBITMAPINFO;
66
67
68
69 // Other Structures
70
71 #define MSG_QUIT        0
72 #define MSG_SHUTDOWN    1
73 #define MSG_NORMAL      2
74
75
76 typedef struct WinJoystickDesc {
77         char title[32];
78         char cal_ztitle[16];
79         char cal_rtitle[16];
80         char cal_utitle[16];
81         char cal_vtitle[16];
82         char cal_zmsg[6][16];
83         char cal_rmsg[6][16];
84         char cal_umsg[6][16];
85         char cal_vmsg[6][16];
86 } WinJoystickDesc;
87
88
89 // Globals
90
91 extern HWND             _hAppWnd;           // Descent Window
92 extern HINSTANCE        _hAppInstance;
93 extern int              _DDraw;             // Direct X Implementation
94 extern BOOL             _AppActive;
95 extern BOOL             SOS_DLLInit;
96 extern BOOL             _RedrawScreen;
97 extern SCREEN_CONTEXT   _SCRContext;
98
99
100 extern dd_grs_canvas *dd_VR_offscreen_buffer;
101 extern dd_grs_canvas dd_VR_screen_pages[2];
102 extern dd_grs_canvas dd_VR_render_buffer[2];
103 extern dd_grs_canvas dd_VR_render_sub_buffer[2];
104
105
106
107 // WinG Stuff
108
109 extern HPALETTE _hAppPalette;               // Application Palette
110
111
112 // Other Globals
113
114 extern RECT     ViewportRect;               // Viewport rect for window
115 extern char     *_OffscreenCanvasBits;      // Pointer to DIB Bits.
116 extern fix      WinFrameTime;               // Time per frame
117 extern int      Platform_system;            // Tells us the platform
118
119
120 // Functions
121
122 extern void WinDelay(int msecs);
123
124 // misc functions
125 extern void WErrorPrint(char *msg);
126 extern dd_grs_canvas *get_current_game_screen();
127 extern BOOL SOSInit();
128 extern void SOSUnInit();
129
130
131 #define MOUSE_DEFAULT_CURSOR 1
132 #define MOUSE_WAIT_CURSOR 2
133
134 extern void LoadCursorWin(int cursor);
135 extern void ShowCursorW();
136 extern void HideCursorW();
137
138
139 // Macros
140 #define CanvasWidth(C)  ((C).bmiHeader.biWidth)
141 #define CanvasHeight(C) (((C).bmiHeader.biHeight > 0) ? \
142                          (C).bmiHeader.biHeight : -(C).bmiHeader.biHeight)
143
144 #define DebugMessageBox(c) (MessageBox(NULL,c,"Message",MB_OK))
145
146 #define DEFINE_SCREEN(fn) (_SCRContext.bkg_filename = fn)
147
148 #define WINNT_PLATFORM 1
149 #define WIN95_PLATFORM 0
150
151 #endif /* _DESW_H */