forked from KS-Presto/Wolf4SDL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
id_vl.h
109 lines (84 loc) · 3.53 KB
/
id_vl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// ID_VL.H
// wolf compatability
#ifndef ID_VL_H
#define ID_VL_H
#include "wl_def.h"
void Quit(const char* error, ...);
//===========================================================================
#define CHARWIDTH 2
#define TILEWIDTH 4
//===========================================================================
extern SDL_Surface* screen, * screenBuffer, * curSurface;
extern SDL_Window* window;
extern SDL_Renderer* renderer;
extern boolean fullscreen, usedoublebuffering;
extern unsigned screenWidth, screenHeight, screenBits, screenPitch, bufferPitch, curPitch;
extern unsigned scaleFactor;
extern boolean screenfaded;
extern unsigned bordercolor;
extern SDL_Color gamepal[256];
//===========================================================================
//
// VGA hardware routines
//
#define VL_WaitVBL(a) SDL_Delay((a)*8)
void VL_SetVGAPlaneMode(void);
void VL_SetTextMode(void);
void VL_Shutdown(void);
void VL_ConvertPalette(byte* srcpal, SDL_Color* destpal, int numColors);
void VL_FillPalette(int red, int green, int blue);
void VL_SetColor(int color, int red, int green, int blue);
void VL_GetColor(int color, int* red, int* green, int* blue);
void VL_SetPalette(SDL_Color* palette, bool forceupdate);
void VL_GetPalette(SDL_Color* palette);
void VL_FadeOut(int start, int end, int red, int green, int blue, int steps);
void VL_FadeIn(int start, int end, SDL_Color* palette, int steps);
byte* VL_LockSurface(SDL_Surface* surface);
void VL_UnlockSurface(SDL_Surface* surface);
#define LOCK() VL_LockSurface(curSurface)
#define UNLOCK() VL_UnlockSurface(curSurface)
byte VL_GetPixel(int x, int y);
void VL_Plot(int x, int y, int color);
void VL_Hlin(unsigned x, unsigned y, unsigned width, int color);
void VL_Vlin(int x, int y, int height, int color);
void VL_BarScaledCoord(int scx, int scy, int scwidth, int scheight, int color);
void inline VL_Bar(int x, int y, int width, int height, int color)
{
VL_BarScaledCoord(scaleFactor * x, scaleFactor * y,
scaleFactor * width, scaleFactor * height, color);
}
void inline VL_ClearScreen(int color)
{
SDL_FillRect(curSurface, NULL, color);
}
void VL_MungePic(byte* source, unsigned width, unsigned height);
void VL_DrawPicBare(int x, int y, byte* pic, int width, int height);
void VL_MemToLatch(byte* source, int width, int height,
SDL_Surface* destSurface, int x, int y);
void VL_ScreenToScreen(SDL_Surface* source, SDL_Surface* dest);
void VL_MemToScreenScaledCoord(byte* source, int width, int height, int scx, int scy);
void VL_MemToScreenScaledCoord(byte* source, int origwidth, int origheight, int srcx, int srcy,
int destx, int desty, int width, int height);
void inline VL_MemToScreen(byte* source, int width, int height, int x, int y)
{
VL_MemToScreenScaledCoord(source, width, height, scaleFactor * x, scaleFactor * y);
}
void VL_MaskedToScreen(byte* source, int width, int height, int x, int y);
void VL_LatchToScreenScaledCoord(SDL_Surface* source, int xsrc, int ysrc,
int width, int height, int scxdest, int scydest);
void inline VL_LatchToScreen(SDL_Surface* source, int xsrc, int ysrc,
int width, int height, int xdest, int ydest)
{
VL_LatchToScreenScaledCoord(source, xsrc, ysrc, width, height,
scaleFactor * xdest, scaleFactor * ydest);
}
void inline VL_LatchToScreenScaledCoord(SDL_Surface* source, int scx, int scy)
{
VL_LatchToScreenScaledCoord(source, 0, 0, source->w, source->h, scx, scy);
}
void inline VL_LatchToScreen(SDL_Surface* source, int x, int y)
{
VL_LatchToScreenScaledCoord(source, 0, 0, source->w, source->h,
scaleFactor * x, scaleFactor * y);
}
#endif