ref: 64598dc2a57256eb079b96348dea8aa024abbb90
parent: 940034dc22971b5f6cd76e63aa332c9ce2629aa1
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Aug 21 12:18:55 EDT 2019
Rename Surface_Ids to SurfaceID For code style consistency (this isn't a vanilla enum name - I don't think there even was an enum for this in the original source code)
--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -166,7 +166,7 @@
memset(&surface_metadata[s], 0, sizeof(surface_metadata[0]));
}
-BOOL MakeSurface_Generic(int bxsize, int bysize, Surface_Ids surf_no, BOOL bSystem)
+BOOL MakeSurface_Generic(int bxsize, int bysize, SurfaceID surf_no, BOOL bSystem)
{
BOOL success = FALSE;
@@ -209,7 +209,7 @@
return success;
}
-static BOOL LoadBitmap(SDL_RWops *fp, Surface_Ids surf_no, BOOL create_surface, const char *name, SurfaceType type)
+static BOOL LoadBitmap(SDL_RWops *fp, SurfaceID surf_no, BOOL create_surface, const char *name, SurfaceType type)
{
BOOL success = FALSE;
@@ -315,7 +315,7 @@
return success;
}
-static BOOL LoadBitmap_File(const char *name, Surface_Ids surf_no, BOOL create_surface)
+static BOOL LoadBitmap_File(const char *name, SurfaceID surf_no, BOOL create_surface)
{
char path[PATH_LENGTH];
SDL_RWops *fp;
@@ -350,7 +350,7 @@
return FALSE;
}
-static BOOL LoadBitmap_Resource(const char *res, Surface_Ids surf_no, BOOL create_surface)
+static BOOL LoadBitmap_Resource(const char *res, SurfaceID surf_no, BOOL create_surface)
{
size_t size;
const unsigned char *data = FindResource(res, "BITMAP", &size);
@@ -370,22 +370,22 @@
return FALSE;
}
-BOOL MakeSurface_File(const char *name, Surface_Ids surf_no)
+BOOL MakeSurface_File(const char *name, SurfaceID surf_no)
{
return LoadBitmap_File(name, surf_no, TRUE);
}
-BOOL MakeSurface_Resource(const char *res, Surface_Ids surf_no)
+BOOL MakeSurface_Resource(const char *res, SurfaceID surf_no)
{
return LoadBitmap_Resource(res, surf_no, TRUE);
}
-BOOL ReloadBitmap_File(const char *name, Surface_Ids surf_no)
+BOOL ReloadBitmap_File(const char *name, SurfaceID surf_no)
{
return LoadBitmap_File(name, surf_no, FALSE);
}
-BOOL ReloadBitmap_Resource(const char *res, Surface_Ids surf_no)
+BOOL ReloadBitmap_Resource(const char *res, SurfaceID surf_no)
{
return LoadBitmap_Resource(res, surf_no, FALSE);
}
@@ -398,7 +398,7 @@
destination_rect->bottom = source_rect->bottom * magnification;
}
-void BackupSurface(Surface_Ids surf_no, const RECT *rect)
+void BackupSurface(SurfaceID surf_no, const RECT *rect)
{
RECT frameRect;
ScaleRect(rect, &frameRect);
@@ -406,7 +406,7 @@
Backend_Blit(framebuffer, &frameRect, surf[surf_no], frameRect.left, frameRect.top, FALSE);
}
-static void DrawBitmap(const RECT *rcView, int x, int y, const RECT *rect, Surface_Ids surf_no, BOOL transparent)
+static void DrawBitmap(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no, BOOL transparent)
{
RECT frameRect;
@@ -446,12 +446,12 @@
Backend_Blit(surf[surf_no], &frameRect, framebuffer, x * magnification, y * magnification, transparent);
}
-void PutBitmap3(const RECT *rcView, int x, int y, const RECT *rect, Surface_Ids surf_no) // Transparency
+void PutBitmap3(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no) // Transparency
{
DrawBitmap(rcView, x, y, rect, surf_no, TRUE);
}
-void PutBitmap4(const RECT *rcView, int x, int y, const RECT *rect, Surface_Ids surf_no) // No Transparency
+void PutBitmap4(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no) // No Transparency
{
DrawBitmap(rcView, x, y, rect, surf_no, FALSE);
}
@@ -486,7 +486,7 @@
Backend_ColourFill(framebuffer, &destRect, col_red, col_green, col_blue);
}
-void CortBox2(const RECT *rect, unsigned long col, Surface_Ids surf_no)
+void CortBox2(const RECT *rect, unsigned long col, SurfaceID surf_no)
{
// Get rect
RECT destRect;
@@ -517,15 +517,15 @@
rect.top = 0;
rect.right = surface_metadata[i].width;
rect.bottom = surface_metadata[i].height;
- CortBox2(&rect, 0, (Surface_Ids)i);
+ CortBox2(&rect, 0, (SurfaceID)i);
break;
case SURFACE_SOURCE_RESOURCE:
- ReloadBitmap_Resource(surface_metadata[i].name, (Surface_Ids)i);
+ ReloadBitmap_Resource(surface_metadata[i].name, (SurfaceID)i);
break;
case SURFACE_SOURCE_FILE:
- ReloadBitmap_File(surface_metadata[i].name, (Surface_Ids)i);
+ ReloadBitmap_File(surface_metadata[i].name, (SurfaceID)i);
break;
}
}
@@ -636,7 +636,7 @@
DrawText(gFont, framebuffer, x * magnification, y * magnification, color, text, strlen(text));
}
-void PutText2(int x, int y, const char *text, unsigned long color, Surface_Ids surf_no)
+void PutText2(int x, int y, const char *text, unsigned long color, SurfaceID surf_no)
{
DrawText(gFont, surf[surf_no], x * magnification, y * magnification, color, text, strlen(text));
}
--- a/src/Draw.h
+++ b/src/Draw.h
@@ -14,7 +14,7 @@
extern int magnification;
extern BOOL fullscreen;
-typedef enum Surface_Ids
+typedef enum SurfaceID
{
SURFACE_ID_TITLE = 0,
SURFACE_ID_PIXEL = 1,
@@ -48,7 +48,7 @@
SURFACE_ID_CREDITS_IMAGE = 36,
SURFACE_ID_CASTS = 37,
SURFACE_ID_MAX = 40
-} Surface_Ids;
+} SurfaceID;
BOOL Flip_SystemTask(HWND hWnd);
SDL_Window* CreateWindow(const char *title, int width, int height);
@@ -55,22 +55,22 @@
BOOL StartDirectDraw(int lMagnification, int lColourDepth);
void EndDirectDraw();
void ReleaseSurface(int s);
-BOOL MakeSurface_File(const char *name, Surface_Ids surf_no);
-BOOL MakeSurface_Resource(const char *res, Surface_Ids surf_no);
-BOOL ReloadBitmap_File(const char *name, Surface_Ids surf_no);
-BOOL ReloadBitmap_Resource(const char *res, Surface_Ids surf_no);
-BOOL MakeSurface_Generic(int bxsize, int bysize, Surface_Ids surf_no, BOOL bSystem);
-void BackupSurface(Surface_Ids surf_no, const RECT *rect);
-void PutBitmap3(const RECT *rcView, int x, int y, const RECT *rect, Surface_Ids surf_no);
-void PutBitmap4(const RECT *rcView, int x, int y, const RECT *rect, Surface_Ids surf_no);
+BOOL MakeSurface_File(const char *name, SurfaceID surf_no);
+BOOL MakeSurface_Resource(const char *res, SurfaceID surf_no);
+BOOL ReloadBitmap_File(const char *name, SurfaceID surf_no);
+BOOL ReloadBitmap_Resource(const char *res, SurfaceID surf_no);
+BOOL MakeSurface_Generic(int bxsize, int bysize, SurfaceID surf_no, BOOL bSystem);
+void BackupSurface(SurfaceID surf_no, const RECT *rect);
+void PutBitmap3(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no);
+void PutBitmap4(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no);
void Surface2Surface(int x, int y, const RECT *rect, int to, int from);
unsigned long GetCortBoxColor(unsigned long col);
void CortBox(const RECT *rect, unsigned long col);
-void CortBox2(const RECT *rect, unsigned long col, Surface_Ids surf_no);
+void CortBox2(const RECT *rect, unsigned long col, SurfaceID surf_no);
void RestoreSurfaces();
void InitTextObject(const char *font_name);
void PutText(int x, int y, const char *text, unsigned long color);
-void PutText2(int x, int y, const char *text, unsigned long color, Surface_Ids surf_no);
+void PutText2(int x, int y, const char *text, unsigned long color, SurfaceID surf_no);
void EndTextObject();
void HandleDeviceLoss();
void HandleWindowResize();
--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -279,7 +279,7 @@
int char_type;
int time_counter;
int char_y;
- Surface_Ids char_surf;
+ SurfaceID char_surf;
unsigned long back_color;
// Reset everything
--- a/src/NpChar.cpp
+++ b/src/NpChar.cpp
@@ -36,7 +36,7 @@
void SetUniqueParameter(NPCHAR *npc)
{
int code = npc->code_char;
- npc->surf = (Surface_Ids)gNpcTable[code].surf;
+ npc->surf = (SurfaceID)gNpcTable[code].surf;
npc->hit_voice = gNpcTable[code].hit_voice;
npc->destroy_voice = gNpcTable[code].destroy_voice;
npc->damage = gNpcTable[code].damage;
@@ -364,7 +364,7 @@
(gNPC[n].x - side) / 0x200 - fx / 0x200 + a,
(gNPC[n].y - gNPC[n].view.top) / 0x200 - fy / 0x200,
&gNPC[n].rect,
- (Surface_Ids)gNPC[n].surf);
+ (SurfaceID)gNPC[n].surf);
}
}
}
--- a/src/NpChar.h
+++ b/src/NpChar.h
@@ -40,7 +40,7 @@
int code_char;
int code_flag;
int code_event;
- Surface_Ids surf;
+ SurfaceID surf;
int hit_voice;
int destroy_voice;
int life;
--- a/src/TextScr.cpp
+++ b/src/TextScr.cpp
@@ -65,7 +65,7 @@
//Create line surfaces
for (int i = 0; i < 4; i++)
- MakeSurface_Generic(gRect_line.right, gRect_line.bottom, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1), FALSE);
+ MakeSurface_Generic(gRect_line.right, gRect_line.bottom, (SurfaceID)(i + SURFACE_ID_TEXT_LINE1), FALSE);
//Clear text
memset(text, 0, sizeof(text));
@@ -230,7 +230,7 @@
for (int i = 0; i < 4; i++)
{
gTS.ypos_line[i] = 16 * i;
- CortBox2(&gRect_line, 0x000000, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1));
+ CortBox2(&gRect_line, 0x000000, (SurfaceID)(i + SURFACE_ID_TEXT_LINE1));
memset(&text[i * 0x40], 0, 0x40);
}*/
@@ -279,7 +279,7 @@
for (int i = 0; i < 4; i++)
{
gTS.ypos_line[i] = 16 * i;
- CortBox2(&gRect_line, 0x000000, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1));
+ CortBox2(&gRect_line, 0x000000, (SurfaceID)(i + SURFACE_ID_TEXT_LINE1));
memset(&text[i * 0x40], 0, 0x40);
}
@@ -331,7 +331,7 @@
{
gTS.mode = 3;
g_GameFlags |= 4;
- CortBox2(&gRect_line, 0, (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1));
+ CortBox2(&gRect_line, 0, (SurfaceID)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1));
memset(&text[gTS.line % 4 * 0x40], 0, 0x40);
}
}
@@ -376,7 +376,7 @@
str[offset + 1] = 0;
//Append number to line
- PutText2(6 * gTS.p_write, 0, str, RGB(0xFF, 0xFF, 0xFE), (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1));
+ PutText2(6 * gTS.p_write, 0, str, RGB(0xFF, 0xFF, 0xFE), (SurfaceID)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1));
strcat(&text[gTS.line % 4 * 0x40], str);
//Play sound and reset blinking cursor
@@ -404,7 +404,7 @@
for (int i = 0; i < 4; i++)
{
gTS.ypos_line[i] = 16 * i;
- CortBox2(&gRect_line, 0x000000, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1));
+ CortBox2(&gRect_line, 0x000000, (SurfaceID)(i + SURFACE_ID_TEXT_LINE1));
memset(&text[i * 0x40], 0, 0x40);
}
}
@@ -480,7 +480,7 @@
text_offset = 0;
for (i = 0; i < 4; i++)
- PutBitmap3(&gTS.rcText, text_offset + TEXT_LEFT, gTS.offsetY + gTS.ypos_line[i] + gTS.rcText.top, &gRect_line, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1));
+ PutBitmap3(&gTS.rcText, text_offset + TEXT_LEFT, gTS.offsetY + gTS.ypos_line[i] + gTS.rcText.top, &gRect_line, (SurfaceID)(i + SURFACE_ID_TEXT_LINE1));
//Draw NOD cursor
if ((gTS.wait_beam++ % 20 > 12) && gTS.mode == 2)
@@ -1327,7 +1327,7 @@
gTS.p_write = x;
//Print text
- PutText2(0, 0, str, RGB(0xFF, 0xFF, 0xFE), (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1));
+ PutText2(0, 0, str, RGB(0xFF, 0xFF, 0xFE), (SurfaceID)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1));
#ifdef FIX_BUGS
strcpy(&text[gTS.line % 4 * 0x40], str);
#else
@@ -1360,11 +1360,11 @@
//Print text
if (c[0] == '=')
{
- Surface2Surface(6 * gTS.p_write, 2, &rcSymbol, (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1), SURFACE_ID_TEXT_BOX);
+ Surface2Surface(6 * gTS.p_write, 2, &rcSymbol, (SurfaceID)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1), SURFACE_ID_TEXT_BOX);
}
else
{
- PutText2(6 * gTS.p_write, 0, c, RGB(0xFF, 0xFF, 0xFE), (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1));
+ PutText2(6 * gTS.p_write, 0, c, RGB(0xFF, 0xFF, 0xFE), (SurfaceID)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1));
}
strcat(&text[gTS.line % 4 * 0x40], c);
@@ -1492,7 +1492,7 @@
{
for (int i = 0; i < 4; ++i)
{
- CortBox2(&gRect_line, 0x000000, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1));
- PutText2(0, 0, &text[i * 0x40], RGB(0xFF, 0xFF, 0xFE), (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1));
+ CortBox2(&gRect_line, 0x000000, (SurfaceID)(i + SURFACE_ID_TEXT_LINE1));
+ PutText2(0, 0, &text[i * 0x40], RGB(0xFF, 0xFF, 0xFE), (SurfaceID)(i + SURFACE_ID_TEXT_LINE1));
}
}