Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-2-2013-Decompilation
Path: blob/main/RSDKv4/Drawing.hpp
817 views
1
#ifndef DRAWING_H
2
#define DRAWING_H
3
4
#define SURFACE_COUNT (24)
5
#define GFXDATA_SIZE (0x800 * 0x800)
6
7
#if RETRO_REV03
8
#define DRAWLAYER_COUNT (8)
9
#else
10
#define DRAWLAYER_COUNT (7)
11
#endif
12
13
enum FlipFlags { FLIP_NONE, FLIP_X, FLIP_Y, FLIP_XY };
14
enum InkFlags { INK_NONE, INK_BLEND, INK_ALPHA, INK_ADD, INK_SUB };
15
enum DrawFXFlags { FX_SCALE, FX_ROTATE, FX_ROTOZOOM, FX_INK, FX_TINT, FX_FLIP };
16
17
struct DrawListEntry {
18
int entityRefs[ENTITY_COUNT];
19
int listSize;
20
};
21
22
struct GFXSurface {
23
char fileName[0x40];
24
int height;
25
int width;
26
#if RETRO_SOFTWARE_RENDER
27
int widthShift;
28
#endif
29
int depth;
30
int dataPosition;
31
};
32
33
struct DisplaySettings {
34
int offsetX;
35
int width;
36
int height;
37
int unknown1;
38
int maxWidth;
39
byte unknown2;
40
};
41
42
extern ushort blendLookupTable[0x20 * 0x100];
43
extern ushort subtractLookupTable[0x20 * 0x100];
44
extern ushort tintLookupTable[0x10000];
45
46
extern int SCREEN_XSIZE_CONFIG;
47
extern int SCREEN_XSIZE;
48
extern int SCREEN_CENTERX;
49
50
extern float SCREEN_XSIZE_F;
51
extern float SCREEN_CENTERX_F;
52
53
extern float SCREEN_YSIZE_F;
54
extern float SCREEN_CENTERY_F;
55
56
extern int touchWidth;
57
extern int touchHeight;
58
extern float touchWidthF;
59
extern float touchHeightF;
60
61
extern DrawListEntry drawListEntries[DRAWLAYER_COUNT];
62
63
extern int gfxDataPosition;
64
extern GFXSurface gfxSurface[SURFACE_COUNT];
65
extern byte graphicData[GFXDATA_SIZE];
66
67
extern DisplaySettings displaySettings;
68
extern bool convertTo32Bit;
69
extern bool mixFiltersOnJekyll;
70
71
#if RETRO_USING_OPENGL
72
extern GLint defaultFramebuffer;
73
extern GLuint framebufferHiRes;
74
extern GLuint renderbufferHiRes;
75
#endif
76
77
int InitRenderDevice();
78
void FlipScreen();
79
void ReleaseRenderDevice(bool refresh = false);
80
81
void GenerateBlendLookupTable();
82
83
inline void ClearGraphicsData()
84
{
85
for (int i = 0; i < SURFACE_COUNT; ++i) MEM_ZERO(gfxSurface[i]);
86
gfxDataPosition = 0;
87
}
88
void ClearScreen(byte index);
89
void SetScreenDimensions(int width, int height);
90
void SetScreenSize(int width, int lineSize);
91
92
#if RETRO_SOFTWARE_RENDER
93
void CopyFrameOverlay2x();
94
#endif
95
96
void SetupViewport();
97
void SetFullScreen(bool fs);
98
99
// Layer Drawing
100
void DrawObjectList(int layer);
101
void DrawStageGFX();
102
#if !RETRO_USE_ORIGINAL_CODE
103
void DrawDebugOverlays();
104
#endif
105
106
// TileLayer Drawing
107
void DrawHLineScrollLayer(int layerID);
108
void DrawVLineScrollLayer(int layerID);
109
void Draw3DFloorLayer(int layerID);
110
void Draw3DSkyLayer(int layerID);
111
112
// Shape Drawing
113
void DrawRectangle(int XPos, int YPos, int width, int height, int R, int G, int B, int A);
114
void SetFadeHQ(int R, int G, int B, int A);
115
void DrawTintRectangle(int XPos, int YPos, int width, int height);
116
void DrawScaledTintMask(int direction, int XPos, int YPos, int pivotX, int pivotY, int scaleX, int scaleY, int width, int height, int sprX, int sprY,
117
int sheetID);
118
119
// Sprite Drawing
120
void DrawSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int sheetID);
121
#if RETRO_REV00
122
void DrawSpriteClipped(int XPos, int YPos, int width, int height, int sprX, int sprY, int sheetID, int clipY);
123
#endif
124
void DrawSpriteFlipped(int XPos, int YPos, int width, int height, int sprX, int sprY, int direction, int sheetID);
125
void DrawSpriteScaled(int direction, int XPos, int YPos, int pivotX, int pivotY, int scaleX, int scaleY, int width, int height, int sprX, int sprY,
126
int sheetID);
127
#if !RETRO_REV02
128
void DrawScaledChar(int direction, int XPos, int YPos, int pivotX, int pivotY, int scaleX, int scaleY, int width, int height, int sprX, int sprY,
129
int sheetID);
130
#endif
131
void DrawSpriteRotated(int direction, int XPos, int YPos, int pivotX, int pivotY, int sprX, int sprY, int width, int height, int rotation,
132
int sheetID);
133
void DrawSpriteRotozoom(int direction, int XPos, int YPos, int pivotX, int pivotY, int sprX, int sprY, int width, int height, int rotation, int scale,
134
int sheetID);
135
136
void DrawBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int sheetID);
137
void DrawAlphaBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int alpha, int sheetID);
138
void DrawAdditiveBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int alpha, int sheetID);
139
void DrawSubtractiveBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int alpha, int sheetID);
140
141
void DrawObjectAnimation(void *objScr, void *ent, int XPos, int YPos);
142
143
void DrawFace(void *v, uint color);
144
void DrawFadedFace(void *v, uint color, uint fogColor, int alpha);
145
void DrawTexturedFace(void *v, byte sheetID);
146
void DrawTexturedFaceBlended(void *v, byte sheetID);
147
148
#if !RETRO_REV02
149
void DrawBitmapText(void *menu, int XPos, int YPos, int scale, int spacing, int rowStart, int rowCount);
150
#endif
151
152
void DrawTextMenu(void *menu, int XPos, int YPos);
153
void DrawTextMenuEntry(void *menu, int rowID, int XPos, int YPos, int textHighlight);
154
void DrawStageTextEntry(void *menu, int rowID, int XPos, int YPos, int textHighlight);
155
void DrawBlendedTextMenuEntry(void *menu, int rowID, int XPos, int YPos, int textHighlight);
156
157
#endif // !DRAWING_H
158
159