diff --git a/src/game/level.c b/src/game/level.c index 5a8353f9..ba53f4b7 100644 --- a/src/game/level.c +++ b/src/game/level.c @@ -21,6 +21,7 @@ static void __cdecl M_LoadMeshBase(VFILE *file); static void __cdecl M_LoadMeshes(VFILE *file); static int32_t __cdecl M_LoadAnims(VFILE *file, int32_t **frame_pointers); static void __cdecl M_LoadAnimChanges(VFILE *file); +static void __cdecl M_LoadAnimRanges(VFILE *file); static void __cdecl M_LoadAnimCommands(VFILE *file); static void __cdecl M_LoadAnimBones(VFILE *file); static void __cdecl M_LoadAnimFrames(VFILE *file); @@ -288,7 +289,7 @@ static void __cdecl M_LoadAnimChanges(VFILE *const file) Benchmark_End(benchmark, NULL); } -static void __cdecl Level_LoadAnimRanges(VFILE *const file) +static void __cdecl M_LoadAnimRanges(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); const int32_t num_anim_ranges = VFile_ReadS32(file); @@ -880,7 +881,7 @@ bool __cdecl Level_Load(const char *const file_name, const int32_t level_num) int32_t *frame_pointers = NULL; const int32_t num_anims = M_LoadAnims(file, &frame_pointers); M_LoadAnimChanges(file); - Level_LoadAnimRanges(file); + M_LoadAnimRanges(file); M_LoadAnimCommands(file); M_LoadAnimBones(file); M_LoadAnimFrames(file); diff --git a/src/game/output.c b/src/game/output.c index 3d6238be..e4026ac3 100644 --- a/src/game/output.c +++ b/src/game/output.c @@ -17,29 +17,29 @@ #define MAKE_Q_ID(g) ((g >> 16) & 0xFF) #define MAKE_ZSORT(z) ((uint32_t)(z)) -static D3DCOLOR Output_ShadeLight(uint32_t shade); -static D3DCOLOR Output_ShadeColor( +static D3DCOLOR M_ShadeLight(uint32_t shade); +static D3DCOLOR M_ShadeColor( uint32_t red, uint32_t green, uint32_t blue, uint8_t alpha); -static D3DCOLOR Output_ShadeLightColor( +static D3DCOLOR M_ShadeLightColor( uint32_t shade, uint32_t red, uint32_t green, uint32_t blue, uint8_t alpha); -static double Output_CalculatePolyZ( +static double M_CalculatePolyZ( SORT_TYPE sort_type, double z0, double z1, double z2, double z3); -static void __fastcall Output_FlatA(int32_t y1, int32_t y2, uint8_t color_idx); -static void __fastcall Output_TransA(int32_t y1, int32_t y2, uint8_t depth_q); -static void __fastcall Output_GourA(int32_t y1, int32_t y2, uint8_t color_idx); -static void __fastcall Output_GTMapA( +static void __fastcall M_FlatA(int32_t y1, int32_t y2, uint8_t color_idx); +static void __fastcall M_TransA(int32_t y1, int32_t y2, uint8_t depth_q); +static void __fastcall M_GourA(int32_t y1, int32_t y2, uint8_t color_idx); +static void __fastcall M_GTMapA( int32_t y1, int32_t y2, const uint8_t *tex_page); -static void __fastcall Output_WGTMapA( +static void __fastcall M_WGTMapA( int32_t y1, int32_t y2, const uint8_t *tex_page); -static inline void Output_ClipG( +static inline void M_ClipG( VERTEX_INFO *const buf, const VERTEX_INFO *const vtx1, const VERTEX_INFO *const vtx2, const float clip); -static inline void Output_ClipGUV( +static inline void M_ClipGUV( VERTEX_INFO *const buf, const VERTEX_INFO *const vtx1, const VERTEX_INFO *const vtx2, const float clip); -static D3DCOLOR Output_ShadeColor( +static D3DCOLOR M_ShadeColor( uint32_t red, uint32_t green, uint32_t blue, uint8_t alpha) { if (g_IsShadeEffect) { @@ -49,14 +49,14 @@ static D3DCOLOR Output_ShadeColor( return RGBA_MAKE(red, green, blue, alpha); } -static D3DCOLOR Output_ShadeLight(uint32_t shade) +static D3DCOLOR M_ShadeLight(uint32_t shade) { uint32_t value = (uint32_t)(0x1FFF - shade) >> 4; CLAMPG(value, 0xFF); - return Output_ShadeColor(value, value, value, 0xFF); + return M_ShadeColor(value, value, value, 0xFF); } -static D3DCOLOR Output_ShadeLightColor( +static D3DCOLOR M_ShadeLightColor( uint32_t shade, uint32_t red, uint32_t green, uint32_t blue, uint8_t alpha) { CLAMPG(shade, 0x1FFF); @@ -67,10 +67,10 @@ static D3DCOLOR Output_ShadeLightColor( CLAMPG(red, 0xFF); CLAMPG(green, 0xFF); CLAMPG(blue, 0xFF); - return Output_ShadeColor(red, green, blue, alpha); + return M_ShadeColor(red, green, blue, alpha); } -static double Output_CalculatePolyZ( +static double M_CalculatePolyZ( SORT_TYPE sort_type, double z0, double z1, double z2, double z3) { double zv = 0.0; @@ -96,7 +96,7 @@ static double Output_CalculatePolyZ( return zv; } -static void __fastcall Output_FlatA(int32_t y1, int32_t y2, uint8_t color_idx) +static void __fastcall M_FlatA(int32_t y1, int32_t y2, uint8_t color_idx) { int32_t y_size = y2 - y1; if (y_size <= 0) { @@ -119,7 +119,7 @@ static void __fastcall Output_FlatA(int32_t y1, int32_t y2, uint8_t color_idx) } } -static void __fastcall Output_TransA(int32_t y1, int32_t y2, uint8_t depth_q) +static void __fastcall M_TransA(int32_t y1, int32_t y2, uint8_t depth_q) { int32_t y_size = y2 - y1; // TODO: depth_q should be at most 32 here @@ -153,7 +153,7 @@ static void __fastcall Output_TransA(int32_t y1, int32_t y2, uint8_t depth_q) } } -static void __fastcall Output_GourA(int32_t y1, int32_t y2, uint8_t color_idx) +static void __fastcall M_GourA(int32_t y1, int32_t y2, uint8_t color_idx) { int32_t y_size = y2 - y1; if (y_size <= 0) { @@ -190,8 +190,7 @@ static void __fastcall Output_GourA(int32_t y1, int32_t y2, uint8_t color_idx) } } -static void __fastcall Output_GTMapA( - int32_t y1, int32_t y2, const uint8_t *tex_page) +static void __fastcall M_GTMapA(int32_t y1, int32_t y2, const uint8_t *tex_page) { int32_t y_size = y2 - y1; if (y_size <= 0) { @@ -234,7 +233,7 @@ static void __fastcall Output_GTMapA( } } -static void __fastcall Output_WGTMapA( +static void __fastcall M_WGTMapA( int32_t y1, int32_t y2, const uint8_t *tex_page) { int32_t y_size = y2 - y1; @@ -280,7 +279,7 @@ static void __fastcall Output_WGTMapA( } } -static inline void Output_ClipG( +static inline void M_ClipG( VERTEX_INFO *const buf, const VERTEX_INFO *const vtx1, const VERTEX_INFO *const vtx2, const float clip) { @@ -288,7 +287,7 @@ static inline void Output_ClipG( buf->g = vtx2->g + (vtx1->g - vtx2->g) * clip; } -static inline void Output_ClipGUV( +static inline void M_ClipGUV( VERTEX_INFO *const buf, const VERTEX_INFO *const vtx1, const VERTEX_INFO *const vtx2, const float clip) { @@ -930,35 +929,35 @@ void __cdecl Output_DrawPolyLine(const int16_t *obj_ptr) void __cdecl Output_DrawPolyFlat(const int16_t *obj_ptr) { if (Output_XGenX(obj_ptr + 1)) { - Output_FlatA(g_XGenY1, g_XGenY2, *obj_ptr); + M_FlatA(g_XGenY1, g_XGenY2, *obj_ptr); } } void __cdecl Output_DrawPolyTrans(const int16_t *obj_ptr) { if (Output_XGenX(obj_ptr + 1)) { - Output_TransA(g_XGenY1, g_XGenY2, *obj_ptr); + M_TransA(g_XGenY1, g_XGenY2, *obj_ptr); } } void __cdecl Output_DrawPolyGouraud(const int16_t *obj_ptr) { if (Output_XGenXG(obj_ptr + 1)) { - Output_GourA(g_XGenY1, g_XGenY2, *obj_ptr); + M_GourA(g_XGenY1, g_XGenY2, *obj_ptr); } } void __cdecl Output_DrawPolyGTMap(const int16_t *obj_ptr) { if (Output_XGenXGUV(obj_ptr + 1)) { - Output_GTMapA(g_XGenY1, g_XGenY2, g_TexturePageBuffer8[*obj_ptr]); + M_GTMapA(g_XGenY1, g_XGenY2, g_TexturePageBuffer8[*obj_ptr]); } } void __cdecl Output_DrawPolyWGTMap(const int16_t *obj_ptr) { if (Output_XGenXGUV(obj_ptr + 1)) { - Output_WGTMapA(g_XGenY1, g_XGenY2, g_TexturePageBuffer8[*obj_ptr]); + M_WGTMapA(g_XGenY1, g_XGenY2, g_TexturePageBuffer8[*obj_ptr]); } } @@ -1763,7 +1762,7 @@ int32_t __cdecl Output_XYGClipper(int32_t vtx_count, VERTEX_INFO *vtx) const float clip = (g_FltWinLeft - vtx2->x) / (vtx1->x - vtx2->x); vtx_buf[j].x = g_FltWinLeft; vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip; - Output_ClipG(&vtx_buf[j++], vtx1, vtx2, clip); + M_ClipG(&vtx_buf[j++], vtx1, vtx2, clip); } else if (vtx1->x > g_FltWinRight) { if (vtx2->x > g_FltWinRight) { continue; @@ -1771,19 +1770,19 @@ int32_t __cdecl Output_XYGClipper(int32_t vtx_count, VERTEX_INFO *vtx) const float clip = (g_FltWinRight - vtx2->x) / (vtx1->x - vtx2->x); vtx_buf[j].x = g_FltWinRight; vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip; - Output_ClipG(&vtx_buf[j++], vtx1, vtx2, clip); + M_ClipG(&vtx_buf[j++], vtx1, vtx2, clip); } if (vtx2->x < g_FltWinLeft) { const float clip = (g_FltWinLeft - vtx2->x) / (vtx1->x - vtx2->x); vtx_buf[j].x = g_FltWinLeft; vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip; - Output_ClipG(&vtx_buf[j++], vtx1, vtx2, clip); + M_ClipG(&vtx_buf[j++], vtx1, vtx2, clip); } else if (vtx2->x > g_FltWinRight) { const float clip = (g_FltWinRight - vtx2->x) / (vtx1->x - vtx2->x); vtx_buf[j].x = g_FltWinRight; vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip; - Output_ClipG(&vtx_buf[j++], vtx1, vtx2, clip); + M_ClipG(&vtx_buf[j++], vtx1, vtx2, clip); } else { vtx_buf[j++] = *vtx2; } @@ -1808,7 +1807,7 @@ int32_t __cdecl Output_XYGClipper(int32_t vtx_count, VERTEX_INFO *vtx) const float clip = (g_FltWinTop - vtx2->y) / (vtx1->y - vtx2->y); vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip; vtx[j].y = g_FltWinTop; - Output_ClipG(&vtx[j++], vtx1, vtx2, clip); + M_ClipG(&vtx[j++], vtx1, vtx2, clip); } else if (vtx1->y > g_FltWinBottom) { if (vtx2->y > g_FltWinBottom) { continue; @@ -1816,19 +1815,19 @@ int32_t __cdecl Output_XYGClipper(int32_t vtx_count, VERTEX_INFO *vtx) const float clip = (g_FltWinBottom - vtx2->y) / (vtx1->y - vtx2->y); vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip; vtx[j].y = g_FltWinBottom; - Output_ClipG(&vtx[j++], vtx1, vtx2, clip); + M_ClipG(&vtx[j++], vtx1, vtx2, clip); } if (vtx2->y < g_FltWinTop) { const float clip = (g_FltWinTop - vtx2->y) / (vtx1->y - vtx2->y); vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip; vtx[j].y = g_FltWinTop; - Output_ClipG(&vtx[j++], vtx1, vtx2, clip); + M_ClipG(&vtx[j++], vtx1, vtx2, clip); } else if (vtx2->y > g_FltWinBottom) { const float clip = (g_FltWinBottom - vtx2->y) / (vtx1->y - vtx2->y); vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip; vtx[j].y = g_FltWinBottom; - Output_ClipG(&vtx[j++], vtx1, vtx2, clip); + M_ClipG(&vtx[j++], vtx1, vtx2, clip); } else { vtx[j++] = *vtx2; } @@ -1862,7 +1861,7 @@ int32_t __cdecl Output_XYGUVClipper(int32_t vtx_count, VERTEX_INFO *const vtx) float clip = (g_FltWinLeft - vtx2->x) / (vtx1->x - vtx2->x); vtx_buf[j].x = g_FltWinLeft; vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip; - Output_ClipGUV(&vtx_buf[j++], vtx1, vtx2, clip); + M_ClipGUV(&vtx_buf[j++], vtx1, vtx2, clip); } else if (vtx1->x > g_FltWinRight) { if (vtx2->x > g_FltWinRight) { continue; @@ -1870,19 +1869,19 @@ int32_t __cdecl Output_XYGUVClipper(int32_t vtx_count, VERTEX_INFO *const vtx) float clip = (g_FltWinRight - vtx2->x) / (vtx1->x - vtx2->x); vtx_buf[j].x = g_FltWinRight; vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip; - Output_ClipGUV(&vtx_buf[j++], vtx1, vtx2, clip); + M_ClipGUV(&vtx_buf[j++], vtx1, vtx2, clip); } if (vtx2->x < g_FltWinLeft) { float clip = (g_FltWinLeft - vtx2->x) / (vtx1->x - vtx2->x); vtx_buf[j].x = g_FltWinLeft; vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip; - Output_ClipGUV(&vtx_buf[j++], vtx1, vtx2, clip); + M_ClipGUV(&vtx_buf[j++], vtx1, vtx2, clip); } else if (vtx2->x > g_FltWinRight) { float clip = (g_FltWinRight - vtx2->x) / (vtx1->x - vtx2->x); vtx_buf[j].x = g_FltWinRight; vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip; - Output_ClipGUV(&vtx_buf[j++], vtx1, vtx2, clip); + M_ClipGUV(&vtx_buf[j++], vtx1, vtx2, clip); } else { vtx_buf[j++] = *vtx2; } @@ -1907,7 +1906,7 @@ int32_t __cdecl Output_XYGUVClipper(int32_t vtx_count, VERTEX_INFO *const vtx) const float clip = (g_FltWinTop - vtx2->y) / (vtx1->y - vtx2->y); vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip; vtx[j].y = g_FltWinTop; - Output_ClipGUV(&vtx[j++], vtx1, vtx2, clip); + M_ClipGUV(&vtx[j++], vtx1, vtx2, clip); } else if (vtx1->y > g_FltWinBottom) { if (vtx2->y > g_FltWinBottom) { continue; @@ -1915,19 +1914,19 @@ int32_t __cdecl Output_XYGUVClipper(int32_t vtx_count, VERTEX_INFO *const vtx) const float clip = (g_FltWinBottom - vtx2->y) / (vtx1->y - vtx2->y); vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip; vtx[j].y = g_FltWinBottom; - Output_ClipGUV(&vtx[j++], vtx1, vtx2, clip); + M_ClipGUV(&vtx[j++], vtx1, vtx2, clip); } if (vtx2->y < g_FltWinTop) { const float clip = (g_FltWinTop - vtx2->y) / (vtx1->y - vtx2->y); vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip; vtx[j].y = g_FltWinTop; - Output_ClipGUV(&vtx[j++], vtx1, vtx2, clip); + M_ClipGUV(&vtx[j++], vtx1, vtx2, clip); } else if (vtx2->y > g_FltWinBottom) { const float clip = (g_FltWinBottom - vtx2->y) / (vtx1->y - vtx2->y); vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip; vtx[j].y = g_FltWinBottom; - Output_ClipGUV(&vtx[j++], vtx1, vtx2, clip); + M_ClipGUV(&vtx[j++], vtx1, vtx2, clip); } else { vtx[j++] = *vtx2; } @@ -2020,7 +2019,7 @@ const int16_t *__cdecl Output_InsertObjectG3( continue; } - const float zv = Output_CalculatePolyZ( + const float zv = M_CalculatePolyZ( sort_type, vtx[0]->zv, vtx[1]->zv, vtx[2]->zv, -1.0); g_Sort3DPtr->_0 = (int32_t)g_Info3DPtr; g_Sort3DPtr->_1 = MAKE_ZSORT(zv); @@ -2068,7 +2067,7 @@ const int16_t *__cdecl Output_InsertObjectGT3( } if (clip_or == 0) { - const float zv = Output_CalculatePolyZ( + const float zv = M_CalculatePolyZ( sort_type, vtx[0]->zv, vtx[1]->zv, vtx[2]->zv, -1.0); g_Sort3DPtr->_0 = (int32_t)g_Info3DPtr; g_Sort3DPtr->_1 = MAKE_ZSORT(zv); @@ -2211,7 +2210,7 @@ const int16_t *__cdecl Output_InsertObjectGT3( continue; } - const float zv = Output_CalculatePolyZ( + const float zv = M_CalculatePolyZ( sort_type, vtx[0]->zv, vtx[1]->zv, vtx[2]->zv, -1.0); g_Sort3DPtr->_0 = (int32_t)g_Info3DPtr; g_Sort3DPtr->_1 = MAKE_ZSORT(zv); @@ -2356,7 +2355,7 @@ const int16_t *__cdecl Output_InsertObjectG4( continue; } - const float zv = Output_CalculatePolyZ( + const float zv = M_CalculatePolyZ( sort_type, vtx[0]->zv, vtx[1]->zv, vtx[2]->zv, vtx[3]->zv); g_Sort3DPtr->_0 = (int32_t)g_Info3DPtr; g_Sort3DPtr->_1 = MAKE_ZSORT(zv); @@ -2407,7 +2406,7 @@ const int16_t *__cdecl Output_InsertObjectGT4( } if (clip_or == 0) { - const float zv = Output_CalculatePolyZ( + const float zv = M_CalculatePolyZ( sort_type, vtx[0]->zv, vtx[1]->zv, vtx[2]->zv, vtx[3]->zv); g_Sort3DPtr->_0 = (int32_t)g_Info3DPtr; g_Sort3DPtr->_1 = MAKE_ZSORT(zv); @@ -2584,7 +2583,7 @@ const int16_t *__cdecl Output_InsertObjectGT4( continue; } - const float zv = Output_CalculatePolyZ( + const float zv = M_CalculatePolyZ( sort_type, vtx[0]->zv, vtx[1]->zv, vtx[2]->zv, vtx[3]->zv); g_Sort3DPtr->_0 = (int32_t)g_Info3DPtr; g_Sort3DPtr->_1 = MAKE_ZSORT(zv); @@ -3035,7 +3034,7 @@ void __cdecl Output_InsertGT3_ZBuffered( g_VBufferD3D[0].sy = vtx0->ys; g_VBufferD3D[0].sz = g_FltResZBuf - g_FltResZORhw * vtx0->rhw; g_VBufferD3D[0].rhw = vtx0->rhw; - g_VBufferD3D[0].color = Output_ShadeLight(vtx0->g); + g_VBufferD3D[0].color = M_ShadeLight(vtx0->g); g_VBufferD3D[0].tu = (double)uv0->u / (double)PHD_ONE; g_VBufferD3D[0].tv = (double)uv0->v / (double)PHD_ONE; @@ -3043,7 +3042,7 @@ void __cdecl Output_InsertGT3_ZBuffered( g_VBufferD3D[1].sy = vtx1->ys; g_VBufferD3D[1].sz = g_FltResZBuf - g_FltResZORhw * vtx1->rhw; g_VBufferD3D[1].rhw = vtx1->rhw; - g_VBufferD3D[1].color = Output_ShadeLight(vtx1->g); + g_VBufferD3D[1].color = M_ShadeLight(vtx1->g); g_VBufferD3D[1].tu = (double)uv1->u / (double)PHD_ONE; g_VBufferD3D[1].tv = (double)uv1->v / (double)PHD_ONE; @@ -3051,7 +3050,7 @@ void __cdecl Output_InsertGT3_ZBuffered( g_VBufferD3D[2].sy = vtx2->ys; g_VBufferD3D[2].sz = g_FltResZBuf - g_FltResZORhw * vtx2->rhw; g_VBufferD3D[2].rhw = vtx2->rhw; - g_VBufferD3D[2].color = Output_ShadeLight(vtx2->g); + g_VBufferD3D[2].color = M_ShadeLight(vtx2->g); g_VBufferD3D[2].tu = (double)uv2->u / (double)PHD_ONE; g_VBufferD3D[2].tv = (double)uv2->v / (double)PHD_ONE; @@ -3177,7 +3176,7 @@ void __cdecl Output_InsertGT4_ZBuffered( g_VBufferD3D[0].sy = vtx0->ys; g_VBufferD3D[0].sz = g_FltResZBuf - g_FltResZORhw * vtx0->rhw; g_VBufferD3D[0].rhw = vtx0->rhw; - g_VBufferD3D[0].color = Output_ShadeLight(vtx0->g); + g_VBufferD3D[0].color = M_ShadeLight(vtx0->g); g_VBufferD3D[0].tu = (double)texture->uv[0].u / (double)PHD_ONE; g_VBufferD3D[0].tv = (double)texture->uv[0].v / (double)PHD_ONE; @@ -3185,7 +3184,7 @@ void __cdecl Output_InsertGT4_ZBuffered( g_VBufferD3D[1].sy = vtx1->ys; g_VBufferD3D[1].sz = g_FltResZBuf - g_FltResZORhw * vtx1->rhw; g_VBufferD3D[1].rhw = vtx1->rhw; - g_VBufferD3D[1].color = Output_ShadeLight(vtx1->g); + g_VBufferD3D[1].color = M_ShadeLight(vtx1->g); g_VBufferD3D[1].tu = (double)texture->uv[1].u / (double)PHD_ONE; g_VBufferD3D[1].tv = (double)texture->uv[1].v / (double)PHD_ONE; @@ -3193,7 +3192,7 @@ void __cdecl Output_InsertGT4_ZBuffered( g_VBufferD3D[2].sy = vtx2->ys; g_VBufferD3D[2].sz = g_FltResZBuf - g_FltResZORhw * vtx2->rhw; g_VBufferD3D[2].rhw = vtx2->rhw; - g_VBufferD3D[2].color = Output_ShadeLight(vtx2->g); + g_VBufferD3D[2].color = M_ShadeLight(vtx2->g); g_VBufferD3D[2].tu = (double)texture->uv[2].u / (double)PHD_ONE; g_VBufferD3D[2].tv = (double)texture->uv[2].v / (double)PHD_ONE; @@ -3201,7 +3200,7 @@ void __cdecl Output_InsertGT4_ZBuffered( g_VBufferD3D[3].sy = vtx3->ys; g_VBufferD3D[3].sz = g_FltResZBuf - g_FltResZORhw * vtx3->rhw; g_VBufferD3D[3].rhw = vtx3->rhw; - g_VBufferD3D[3].color = Output_ShadeLight(vtx3->g); + g_VBufferD3D[3].color = M_ShadeLight(vtx3->g); g_VBufferD3D[3].tu = (double)texture->uv[3].u / (double)PHD_ONE; g_VBufferD3D[3].tv = (double)texture->uv[3].v / (double)PHD_ONE; @@ -3229,7 +3228,7 @@ void __cdecl Output_InsertFlatRect_ZBuffered( const RGB_888 *const color = &g_GamePalette8[color_idx]; const D3DCOLOR d3d_color = - Output_ShadeColor(color->red, color->green, color->blue, 0xFF); + M_ShadeColor(color->red, color->green, color->blue, 0xFF); g_VBufferD3D[0].sx = (float)x1; g_VBufferD3D[0].sy = (float)y1; @@ -3264,7 +3263,7 @@ void __cdecl Output_InsertLine_ZBuffered( const RGB_888 *const color = &g_GamePalette8[color_idx]; const D3DCOLOR d3d_color = - Output_ShadeColor(color->red, color->green, color->blue, 0xFF); + M_ShadeColor(color->red, color->green, color->blue, 0xFF); g_VBufferD3D[0].sx = (float)(g_PhdWinMinX + x1); g_VBufferD3D[0].sy = (float)(g_PhdWinMinY + y1); @@ -3378,7 +3377,7 @@ const int16_t *__cdecl Output_InsertObjectG3_Sorted( } const PALETTEENTRY *const color = &g_GamePalette16[color_idx >> 8]; - const double zv = Output_CalculatePolyZ( + const double zv = M_CalculatePolyZ( sort_type, vtx[0]->zv, vtx[1]->zv, vtx[2]->zv, -1.0); Output_InsertPoly_Gouraud( num_points, zv, color->peRed, color->peGreen, color->peBlue, @@ -3502,7 +3501,7 @@ const int16_t *__cdecl Output_InsertObjectG4_Sorted( } const PALETTEENTRY *const color = &g_GamePalette16[color_idx >> 8]; - const double zv = Output_CalculatePolyZ( + const double zv = M_CalculatePolyZ( sort_type, vtx[0]->zv, vtx[1]->zv, vtx[2]->zv, vtx[3]->zv); Output_InsertPoly_Gouraud( num_points, zv, color->peRed, color->peGreen, color->peBlue, @@ -3575,7 +3574,7 @@ void __cdecl Output_InsertGT3_Sorted( } const double zv = - Output_CalculatePolyZ(sort_type, vtx0->zv, vtx1->zv, vtx2->zv, -1.0); + M_CalculatePolyZ(sort_type, vtx0->zv, vtx1->zv, vtx2->zv, -1.0); const POLY_TYPE poly_type = texture->draw_type == DRAW_OPAQUE ? POLY_HWR_GTMAP : POLY_HWR_WGTMAP; @@ -3599,21 +3598,21 @@ void __cdecl Output_InsertGT3_Sorted( g_HWR_VertexPtr[0].sx = vtx0->xs; g_HWR_VertexPtr[0].sy = vtx0->ys; g_HWR_VertexPtr[0].rhw = vtx0->rhw; - g_HWR_VertexPtr[0].color = Output_ShadeLight(vtx0->g); + g_HWR_VertexPtr[0].color = M_ShadeLight(vtx0->g); g_HWR_VertexPtr[0].tu = (double)uv0->u / (double)PHD_ONE; g_HWR_VertexPtr[0].tv = (double)uv0->v / (double)PHD_ONE; g_HWR_VertexPtr[1].sx = vtx1->xs; g_HWR_VertexPtr[1].sy = vtx1->ys; g_HWR_VertexPtr[1].rhw = vtx1->rhw; - g_HWR_VertexPtr[1].color = Output_ShadeLight(vtx1->g); + g_HWR_VertexPtr[1].color = M_ShadeLight(vtx1->g); g_HWR_VertexPtr[1].tu = (double)uv1->u / (double)PHD_ONE; g_HWR_VertexPtr[1].tv = (double)uv1->v / (double)PHD_ONE; g_HWR_VertexPtr[2].sx = vtx2->xs; g_HWR_VertexPtr[2].sy = vtx2->ys; g_HWR_VertexPtr[2].rhw = vtx2->rhw; - g_HWR_VertexPtr[2].color = Output_ShadeLight(vtx2->g); + g_HWR_VertexPtr[2].color = M_ShadeLight(vtx2->g); g_HWR_VertexPtr[2].tu = (double)uv2->u / (double)PHD_ONE; g_HWR_VertexPtr[2].tv = (double)uv2->v / (double)PHD_ONE; @@ -3720,8 +3719,8 @@ void __cdecl Output_InsertGT4_Sorted( return; } - const double zv = Output_CalculatePolyZ( - sort_type, vtx0->zv, vtx1->zv, vtx2->zv, vtx3->zv); + const double zv = + M_CalculatePolyZ(sort_type, vtx0->zv, vtx1->zv, vtx2->zv, vtx3->zv); const POLY_TYPE poly_type = texture->draw_type == DRAW_OPAQUE ? POLY_HWR_GTMAP : POLY_HWR_WGTMAP; @@ -3745,28 +3744,28 @@ void __cdecl Output_InsertGT4_Sorted( g_HWR_VertexPtr[0].sx = vtx0->xs; g_HWR_VertexPtr[0].sy = vtx0->ys; g_HWR_VertexPtr[0].rhw = vtx0->rhw; - g_HWR_VertexPtr[0].color = Output_ShadeLight(vtx0->g); + g_HWR_VertexPtr[0].color = M_ShadeLight(vtx0->g); g_HWR_VertexPtr[0].tu = (double)texture->uv[0].u / (double)PHD_ONE; g_HWR_VertexPtr[0].tv = (double)texture->uv[0].v / (double)PHD_ONE; g_HWR_VertexPtr[1].sx = vtx1->xs; g_HWR_VertexPtr[1].sy = vtx1->ys; g_HWR_VertexPtr[1].rhw = vtx1->rhw; - g_HWR_VertexPtr[1].color = Output_ShadeLight(vtx1->g); + g_HWR_VertexPtr[1].color = M_ShadeLight(vtx1->g); g_HWR_VertexPtr[1].tu = (double)texture->uv[1].u / (double)PHD_ONE; g_HWR_VertexPtr[1].tv = (double)texture->uv[1].v / (double)PHD_ONE; g_HWR_VertexPtr[2].sx = vtx2->xs; g_HWR_VertexPtr[2].sy = vtx2->ys; g_HWR_VertexPtr[2].rhw = vtx2->rhw; - g_HWR_VertexPtr[2].color = Output_ShadeLight(vtx2->g); + g_HWR_VertexPtr[2].color = M_ShadeLight(vtx2->g); g_HWR_VertexPtr[2].tu = (double)texture->uv[2].u / (double)PHD_ONE; g_HWR_VertexPtr[2].tv = (double)texture->uv[2].v / (double)PHD_ONE; g_HWR_VertexPtr[3].sx = vtx3->xs; g_HWR_VertexPtr[3].sy = vtx3->ys; g_HWR_VertexPtr[3].rhw = vtx3->rhw; - g_HWR_VertexPtr[3].color = Output_ShadeLight(vtx3->g); + g_HWR_VertexPtr[3].color = M_ShadeLight(vtx3->g); g_HWR_VertexPtr[3].tu = (double)texture->uv[3].u / (double)PHD_ONE; g_HWR_VertexPtr[3].tv = (double)texture->uv[3].v / (double)PHD_ONE; @@ -3830,7 +3829,7 @@ void __cdecl Output_InsertFlatRect_Sorted( const RGB_888 *const color = &g_GamePalette8[color_idx]; const D3DCOLOR d3d_color = - Output_ShadeColor(color->red, color->green, color->blue, 0xFF); + M_ShadeColor(color->red, color->green, color->blue, 0xFF); g_HWR_VertexPtr[0].sx = (float)x1; g_HWR_VertexPtr[0].sy = (float)y1; @@ -3856,7 +3855,7 @@ void __cdecl Output_InsertLine_Sorted( { const RGB_888 *const color = &g_GamePalette8[color_idx]; const D3DCOLOR d3d_color = - Output_ShadeColor(color->red, color->green, color->blue, 0xFF); + M_ShadeColor(color->red, color->green, color->blue, 0xFF); g_Sort3DPtr->_0 = (int32_t)g_Info3DPtr; g_Sort3DPtr->_1 = MAKE_ZSORT(z); @@ -4119,7 +4118,7 @@ void __cdecl Output_InsertClippedPoly_Textured( g_FltResZBuf - g_FltResZORhw * g_VBuffer[i].rhw; } g_HWR_VertexPtr[i].rhw = g_VBuffer[i].rhw; - g_HWR_VertexPtr[i].color = Output_ShadeLight(g_VBuffer[i].g); + g_HWR_VertexPtr[i].color = M_ShadeLight(g_VBuffer[i].g); g_HWR_VertexPtr[i].tu = tu; g_HWR_VertexPtr[i].tv = tv; } @@ -4149,7 +4148,7 @@ void __cdecl Output_InsertPoly_Gouraud( g_FltResZBuf - g_FltResZORhw * g_VBuffer[i].rhw; } g_HWR_VertexPtr[i].rhw = g_VBuffer[i].rhw; - g_HWR_VertexPtr[i].color = Output_ShadeLightColor( + g_HWR_VertexPtr[i].color = M_ShadeLightColor( g_VBuffer[i].g, red, green, blue, poly_type == POLY_HWR_TRANS ? 0x80 : 0xFF); } @@ -4167,7 +4166,7 @@ void __cdecl Output_DrawClippedPoly_Textured(const int32_t vtx_count) vbuf_d3d->sy = vbuf->y; vbuf_d3d->sz = g_FltResZBuf - g_FltResZORhw * vbuf->rhw; vbuf_d3d->rhw = vbuf->rhw; - vbuf_d3d->color = Output_ShadeLight(vbuf->g); + vbuf_d3d->color = M_ShadeLight(vbuf->g); double tu = vbuf->u / (double)PHD_ONE / vbuf->rhw; double tv = vbuf->v / (double)PHD_ONE / vbuf->rhw; @@ -4192,8 +4191,7 @@ void __cdecl Output_DrawPoly_Gouraud( vbuf_d3d->sy = vbuf->y; vbuf_d3d->sz = g_FltResZBuf - g_FltResZORhw * vbuf->rhw; vbuf_d3d->rhw = vbuf->rhw; - vbuf_d3d->color = - Output_ShadeLightColor(vbuf->g, red, green, blue, 0xFF); + vbuf_d3d->color = M_ShadeLightColor(vbuf->g, red, green, blue, 0xFF); } HWR_DrawPrimitive(D3DPT_TRIANGLEFAN, g_VBufferD3D, vtx_count, true); diff --git a/src/game/requester.c b/src/game/requester.c index 098740dc..9959b892 100644 --- a/src/game/requester.c +++ b/src/game/requester.c @@ -7,9 +7,9 @@ #include -static void Requester_ClearTextStrings(REQUEST_INFO *req); +static void M_ClearTextStrings(REQUEST_INFO *req); -static void Requester_ClearTextStrings(REQUEST_INFO *const req) +static void M_ClearTextStrings(REQUEST_INFO *const req) { Text_Remove(req->heading_text1); req->heading_text1 = NULL; @@ -65,7 +65,7 @@ void __cdecl Requester_Init(REQUEST_INFO *const req) void __cdecl Requester_Shutdown(REQUEST_INFO *const req) { - Requester_ClearTextStrings(req); + M_ClearTextStrings(req); req->ready = 0; } diff --git a/src/game/ui/controllers/controls.c b/src/game/ui/controllers/controls.c index 6ddbed07..f2cf7aec 100644 --- a/src/game/ui/controllers/controls.c +++ b/src/game/ui/controllers/controls.c @@ -19,24 +19,19 @@ static const INPUT_ROLE m_RightRoles[] = { INPUT_ROLE_OPTION, INPUT_ROLE_CONSOLE, (INPUT_ROLE)-1, }; -static const INPUT_ROLE *UI_ControlsController_GetInputRoles(int32_t col); -static bool UI_ControlsController_NavigateLayout( - UI_CONTROLS_CONTROLLER *controller); -static bool UI_ControlsController_NavigateInputs( - UI_CONTROLS_CONTROLLER *controller); -static bool UI_ControlsController_ListenDebounce( - UI_CONTROLS_CONTROLLER *controller); -static bool UI_ControlsController_Listen(UI_CONTROLS_CONTROLLER *controller); -static bool UI_ControlsController_NavigateInputsDebounce( - UI_CONTROLS_CONTROLLER *controller); - -static const INPUT_ROLE *UI_ControlsController_GetInputRoles(const int32_t col) +static const INPUT_ROLE *M_GetInputRoles(int32_t col); +static bool M_NavigateLayout(UI_CONTROLS_CONTROLLER *controller); +static bool M_NavigateInputs(UI_CONTROLS_CONTROLLER *controller); +static bool M_ListenDebounce(UI_CONTROLS_CONTROLLER *controller); +static bool M_Listen(UI_CONTROLS_CONTROLLER *controller); +static bool M_NavigateInputsDebounce(UI_CONTROLS_CONTROLLER *controller); + +static const INPUT_ROLE *M_GetInputRoles(const int32_t col) { return col == 0 ? m_LeftRoles : m_RightRoles; } -static bool UI_ControlsController_NavigateLayout( - UI_CONTROLS_CONTROLLER *const controller) +static bool M_NavigateLayout(UI_CONTROLS_CONTROLLER *const controller) { if ((g_InputDB & IN_DESELECT) || (g_InputDB & IN_SELECT)) { controller->state = UI_CONTROLS_STATE_EXIT; @@ -60,13 +55,12 @@ static bool UI_ControlsController_NavigateLayout( } else { return false; } - controller->active_role = UI_ControlsController_GetInputRoles( - controller->active_col)[controller->active_row]; + controller->active_role = + M_GetInputRoles(controller->active_col)[controller->active_row]; return true; } -static bool UI_ControlsController_NavigateInputs( - UI_CONTROLS_CONTROLLER *const controller) +static bool M_NavigateInputs(UI_CONTROLS_CONTROLLER *const controller) { if (g_InputDB & IN_DESELECT) { controller->state = UI_CONTROLS_STATE_EXIT; @@ -103,13 +97,12 @@ static bool UI_ControlsController_NavigateInputs( } else { return false; } - controller->active_role = UI_ControlsController_GetInputRoles( - controller->active_col)[controller->active_row]; + controller->active_role = + M_GetInputRoles(controller->active_col)[controller->active_row]; return true; } -static bool UI_ControlsController_ListenDebounce( - UI_CONTROLS_CONTROLLER *const controller) +static bool M_ListenDebounce(UI_CONTROLS_CONTROLLER *const controller) { if (Input_IsAnythingPressed()) { return false; @@ -119,8 +112,7 @@ static bool UI_ControlsController_ListenDebounce( return true; } -static bool UI_ControlsController_Listen( - UI_CONTROLS_CONTROLLER *const controller) +static bool M_Listen(UI_CONTROLS_CONTROLLER *const controller) { int32_t pressed = 0; @@ -171,8 +163,7 @@ static bool UI_ControlsController_Listen( return true; } -static bool UI_ControlsController_NavigateInputsDebounce( - UI_CONTROLS_CONTROLLER *const controller) +static bool M_NavigateInputsDebounce(UI_CONTROLS_CONTROLLER *const controller) { if (Input_IsAnythingPressed()) { return false; @@ -187,15 +178,15 @@ bool UI_ControlsController_Control(UI_CONTROLS_CONTROLLER *const controller) { switch (controller->state) { case UI_CONTROLS_STATE_NAVIGATE_LAYOUT: - return UI_ControlsController_NavigateLayout(controller); + return M_NavigateLayout(controller); case UI_CONTROLS_STATE_NAVIGATE_INPUTS: - return UI_ControlsController_NavigateInputs(controller); + return M_NavigateInputs(controller); case UI_CONTROLS_STATE_LISTEN_DEBOUNCE: - return UI_ControlsController_ListenDebounce(controller); + return M_ListenDebounce(controller); case UI_CONTROLS_STATE_LISTEN: - return UI_ControlsController_Listen(controller); + return M_Listen(controller); case UI_CONTROLS_STATE_NAVIGATE_INPUTS_DEBOUNCE: - return UI_ControlsController_NavigateInputsDebounce(controller); + return M_NavigateInputsDebounce(controller); default: return false; } @@ -205,13 +196,13 @@ bool UI_ControlsController_Control(UI_CONTROLS_CONTROLLER *const controller) INPUT_ROLE UI_ControlsController_GetInputRole( const int32_t col, const int32_t row) { - return UI_ControlsController_GetInputRoles(col)[row]; + return M_GetInputRoles(col)[row]; } int32_t UI_ControlsController_GetInputRoleCount(const int32_t col) { int32_t result = 0; - const INPUT_ROLE *const roles = UI_ControlsController_GetInputRoles(col); + const INPUT_ROLE *const roles = M_GetInputRoles(col); while (roles[result] != (INPUT_ROLE)-1) { result++; } diff --git a/src/game/ui/controls_column.c b/src/game/ui/controls_column.c index 33671e23..d51638ff 100644 --- a/src/game/ui/controls_column.c +++ b/src/game/ui/controls_column.c @@ -12,35 +12,34 @@ typedef struct { UI_WIDGET **selectors; } UI_CONTROLS_COLUMN; -static int32_t UI_ControlsColumn_GetWidth(const UI_CONTROLS_COLUMN *self); -static int32_t UI_ControlsColumn_GetHeight(const UI_CONTROLS_COLUMN *self); -static void UI_ControlsColumn_SetPosition( - UI_CONTROLS_COLUMN *self, int32_t x, int32_t y); -static void UI_ControlsColumn_Control(UI_CONTROLS_COLUMN *self); -static void UI_ControlsColumn_Free(UI_CONTROLS_COLUMN *self); +static int32_t M_GetWidth(const UI_CONTROLS_COLUMN *self); +static int32_t M_GetHeight(const UI_CONTROLS_COLUMN *self); +static void M_SetPosition(UI_CONTROLS_COLUMN *self, int32_t x, int32_t y); +static void M_Control(UI_CONTROLS_COLUMN *self); +static void M_Free(UI_CONTROLS_COLUMN *self); -static int32_t UI_ControlsColumn_GetWidth(const UI_CONTROLS_COLUMN *const self) +static int32_t M_GetWidth(const UI_CONTROLS_COLUMN *const self) { return self->container->get_width(self->container); } -static int32_t UI_ControlsColumn_GetHeight(const UI_CONTROLS_COLUMN *const self) +static int32_t M_GetHeight(const UI_CONTROLS_COLUMN *const self) { return self->container->get_height(self->container); } -static void UI_ControlsColumn_SetPosition( +static void M_SetPosition( UI_CONTROLS_COLUMN *const self, const int32_t x, const int32_t y) { return self->container->set_position(self->container, x, y); } -static void UI_ControlsColumn_Control(UI_CONTROLS_COLUMN *const self) +static void M_Control(UI_CONTROLS_COLUMN *const self) { self->container->control(self->container); } -static void UI_ControlsColumn_Free(UI_CONTROLS_COLUMN *const self) +static void M_Free(UI_CONTROLS_COLUMN *const self) { for (int32_t i = 0; i < self->selector_count; i++) { self->selectors[i]->free(self->selectors[i]); @@ -55,11 +54,11 @@ UI_WIDGET *UI_ControlsColumn_Create( { UI_CONTROLS_COLUMN *const self = Memory_Alloc(sizeof(UI_CONTROLS_COLUMN)); self->vtable = (UI_WIDGET_VTABLE) { - .control = (UI_WIDGET_CONTROL)UI_ControlsColumn_Control, - .get_width = (UI_WIDGET_GET_WIDTH)UI_ControlsColumn_GetWidth, - .get_height = (UI_WIDGET_GET_HEIGHT)UI_ControlsColumn_GetHeight, - .set_position = (UI_WIDGET_SET_POSITION)UI_ControlsColumn_SetPosition, - .free = (UI_WIDGET_FREE)UI_ControlsColumn_Free, + .control = (UI_WIDGET_CONTROL)M_Control, + .get_width = (UI_WIDGET_GET_WIDTH)M_GetWidth, + .get_height = (UI_WIDGET_GET_HEIGHT)M_GetHeight, + .set_position = (UI_WIDGET_SET_POSITION)M_SetPosition, + .free = (UI_WIDGET_FREE)M_Free, }; self->selector_count = UI_ControlsController_GetInputRoleCount(column); diff --git a/src/game/ui/controls_input_selector.c b/src/game/ui/controls_input_selector.c index 7e48d642..73a99840 100644 --- a/src/game/ui/controls_input_selector.c +++ b/src/game/ui/controls_input_selector.c @@ -14,19 +14,15 @@ typedef struct { UI_CONTROLS_CONTROLLER *controller; } UI_CONTROLS_INPUT_SELECTOR; -static void UI_ControlsInputSelector_UpdateText( - UI_CONTROLS_INPUT_SELECTOR *self); -static int32_t UI_ControlsInputSelector_GetWidth( - const UI_CONTROLS_INPUT_SELECTOR *self); -static int32_t UI_ControlsInputSelector_GetHeight( - const UI_CONTROLS_INPUT_SELECTOR *self); -static void UI_ControlsInputSelector_SetPosition( +static void M_UpdateText(UI_CONTROLS_INPUT_SELECTOR *self); +static int32_t M_GetWidth(const UI_CONTROLS_INPUT_SELECTOR *self); +static int32_t M_GetHeight(const UI_CONTROLS_INPUT_SELECTOR *self); +static void M_SetPosition( UI_CONTROLS_INPUT_SELECTOR *self, int32_t x, int32_t y); -static void UI_ControlsInputSelector_Control(UI_CONTROLS_INPUT_SELECTOR *self); -static void UI_ControlsInputSelector_Free(UI_CONTROLS_INPUT_SELECTOR *self); +static void M_Control(UI_CONTROLS_INPUT_SELECTOR *self); +static void M_Free(UI_CONTROLS_INPUT_SELECTOR *self); -static void UI_ControlsInputSelector_UpdateText( - UI_CONTROLS_INPUT_SELECTOR *const self) +static void M_UpdateText(UI_CONTROLS_INPUT_SELECTOR *const self) { const uint16_t key = Input_GetAssignedKey(self->controller->active_layout, self->input_role); @@ -38,26 +34,23 @@ static void UI_ControlsInputSelector_UpdateText( UI_Label_ChangeText(self->label, Input_GetRoleName(self->input_role)); } -static int32_t UI_ControlsInputSelector_GetWidth( - const UI_CONTROLS_INPUT_SELECTOR *const self) +static int32_t M_GetWidth(const UI_CONTROLS_INPUT_SELECTOR *const self) { return self->container->get_width(self->container); } -static int32_t UI_ControlsInputSelector_GetHeight( - const UI_CONTROLS_INPUT_SELECTOR *const self) +static int32_t M_GetHeight(const UI_CONTROLS_INPUT_SELECTOR *const self) { return self->container->get_height(self->container); } -static void UI_ControlsInputSelector_SetPosition( +static void M_SetPosition( UI_CONTROLS_INPUT_SELECTOR *const self, const int32_t x, const int32_t y) { return self->container->set_position(self->container, x, y); } -static void UI_ControlsInputSelector_Control( - UI_CONTROLS_INPUT_SELECTOR *const self) +static void M_Control(UI_CONTROLS_INPUT_SELECTOR *const self) { // Sync outlines UI_Label_RemoveFrame(self->label); @@ -74,7 +67,7 @@ static void UI_ControlsInputSelector_Control( } } - UI_ControlsInputSelector_UpdateText(self); + M_UpdateText(self); // Flash conflicts UI_Label_Flash(self->choice, false, 0); @@ -89,8 +82,7 @@ static void UI_ControlsInputSelector_Control( } } -static void UI_ControlsInputSelector_Free( - UI_CONTROLS_INPUT_SELECTOR *const self) +static void M_Free(UI_CONTROLS_INPUT_SELECTOR *const self) { self->label->free(self->label); self->choice->free(self->choice); @@ -104,12 +96,11 @@ UI_WIDGET *UI_ControlsInputSelector_Create( UI_CONTROLS_INPUT_SELECTOR *const self = Memory_Alloc(sizeof(UI_CONTROLS_INPUT_SELECTOR)); self->vtable = (UI_WIDGET_VTABLE) { - .control = (UI_WIDGET_CONTROL)UI_ControlsInputSelector_Control, - .get_width = (UI_WIDGET_GET_WIDTH)UI_ControlsInputSelector_GetWidth, - .get_height = (UI_WIDGET_GET_HEIGHT)UI_ControlsInputSelector_GetHeight, - .set_position = - (UI_WIDGET_SET_POSITION)UI_ControlsInputSelector_SetPosition, - .free = (UI_WIDGET_FREE)UI_ControlsInputSelector_Free, + .control = (UI_WIDGET_CONTROL)M_Control, + .get_width = (UI_WIDGET_GET_WIDTH)M_GetWidth, + .get_height = (UI_WIDGET_GET_HEIGHT)M_GetHeight, + .set_position = (UI_WIDGET_SET_POSITION)M_SetPosition, + .free = (UI_WIDGET_FREE)M_Free, }; self->controller = controller; @@ -122,7 +113,7 @@ UI_WIDGET *UI_ControlsInputSelector_Create( UI_Stack_AddChild(self->container, self->label); // update the text on init - UI_ControlsInputSelector_UpdateText(self); + M_UpdateText(self); return (UI_WIDGET *)self; } diff --git a/src/game/ui/controls_layout_selector.c b/src/game/ui/controls_layout_selector.c index 514539a6..3b333adb 100644 --- a/src/game/ui/controls_layout_selector.c +++ b/src/game/ui/controls_layout_selector.c @@ -10,36 +10,30 @@ typedef struct { UI_CONTROLS_CONTROLLER *controller; } UI_CONTROLS_LAYOUT_SELECTOR; -static int32_t UI_ControlsLayoutSelector_GetWidth( - const UI_CONTROLS_LAYOUT_SELECTOR *self); -static int32_t UI_ControlsLayoutSelector_GetHeight( - const UI_CONTROLS_LAYOUT_SELECTOR *self); -static void UI_ControlsLayoutSelector_SetPosition( +static int32_t M_GetWidth(const UI_CONTROLS_LAYOUT_SELECTOR *self); +static int32_t M_GetHeight(const UI_CONTROLS_LAYOUT_SELECTOR *self); +static void M_SetPosition( UI_CONTROLS_LAYOUT_SELECTOR *self, int32_t x, int32_t y); -static void UI_ControlsLayoutSelector_Free(UI_CONTROLS_LAYOUT_SELECTOR *self); -static void UI_ControlsLayoutSelector_Control( - UI_CONTROLS_LAYOUT_SELECTOR *self); +static void M_Free(UI_CONTROLS_LAYOUT_SELECTOR *self); +static void M_Control(UI_CONTROLS_LAYOUT_SELECTOR *self); -static int32_t UI_ControlsLayoutSelector_GetWidth( - const UI_CONTROLS_LAYOUT_SELECTOR *const self) +static int32_t M_GetWidth(const UI_CONTROLS_LAYOUT_SELECTOR *const self) { return self->label->get_width(self->label); } -static int32_t UI_ControlsLayoutSelector_GetHeight( - const UI_CONTROLS_LAYOUT_SELECTOR *const self) +static int32_t M_GetHeight(const UI_CONTROLS_LAYOUT_SELECTOR *const self) { return self->label->get_height(self->label); } -static void UI_ControlsLayoutSelector_SetPosition( +static void M_SetPosition( UI_CONTROLS_LAYOUT_SELECTOR *const self, const int32_t x, const int32_t y) { self->label->set_position(self->label, x, y); } -static void UI_ControlsLayoutSelector_Control( - UI_CONTROLS_LAYOUT_SELECTOR *const self) +static void M_Control(UI_CONTROLS_LAYOUT_SELECTOR *const self) { if (self->controller->state == UI_CONTROLS_STATE_NAVIGATE_LAYOUT) { UI_Label_AddFrame(self->label); @@ -50,8 +44,7 @@ static void UI_ControlsLayoutSelector_Control( } } -static void UI_ControlsLayoutSelector_Free( - UI_CONTROLS_LAYOUT_SELECTOR *const self) +static void M_Free(UI_CONTROLS_LAYOUT_SELECTOR *const self) { self->label->free(self->label); Memory_Free(self); @@ -63,12 +56,11 @@ UI_WIDGET *UI_ControlsLayoutSelector_Create( UI_CONTROLS_LAYOUT_SELECTOR *self = Memory_Alloc(sizeof(UI_CONTROLS_LAYOUT_SELECTOR)); self->vtable = (UI_WIDGET_VTABLE) { - .control = (UI_WIDGET_CONTROL)UI_ControlsLayoutSelector_Control, - .get_width = (UI_WIDGET_GET_WIDTH)UI_ControlsLayoutSelector_GetWidth, - .get_height = (UI_WIDGET_GET_HEIGHT)UI_ControlsLayoutSelector_GetHeight, - .set_position = - (UI_WIDGET_SET_POSITION)UI_ControlsLayoutSelector_SetPosition, - .free = (UI_WIDGET_FREE)UI_ControlsLayoutSelector_Free, + .control = (UI_WIDGET_CONTROL)M_Control, + .get_width = (UI_WIDGET_GET_WIDTH)M_GetWidth, + .get_height = (UI_WIDGET_GET_HEIGHT)M_GetHeight, + .set_position = (UI_WIDGET_SET_POSITION)M_SetPosition, + .free = (UI_WIDGET_FREE)M_Free, }; self->controller = controller; diff --git a/src/game/ui/label.c b/src/game/ui/label.c index 4ea38732..fdced485 100644 --- a/src/game/ui/label.c +++ b/src/game/ui/label.c @@ -12,12 +12,12 @@ typedef struct { bool has_frame; } UI_LABEL; -static int32_t UI_Label_GetWidth(const UI_LABEL *self); -static int32_t UI_Label_GetHeight(const UI_LABEL *self); -static void UI_Label_SetPosition(UI_LABEL *self, int32_t x, int32_t y); -static void UI_Label_Free(UI_LABEL *self); +static int32_t M_GetWidth(const UI_LABEL *self); +static int32_t M_GetHeight(const UI_LABEL *self); +static void M_SetPosition(UI_LABEL *self, int32_t x, int32_t y); +static void M_Free(UI_LABEL *self); -static int32_t UI_Label_GetWidth(const UI_LABEL *const self) +static int32_t M_GetWidth(const UI_LABEL *const self) { if (self->width < 0) { return Text_GetWidth(self->text) * PHD_ONE / Text_GetScaleH(PHD_ONE); @@ -25,18 +25,18 @@ static int32_t UI_Label_GetWidth(const UI_LABEL *const self) return self->width; } -static int32_t UI_Label_GetHeight(const UI_LABEL *const self) +static int32_t M_GetHeight(const UI_LABEL *const self) { return self->height; } -static void UI_Label_SetPosition( +static void M_SetPosition( UI_LABEL *const self, const int32_t x, const int32_t y) { Text_SetPos(self->text, x, y); } -static void UI_Label_Free(UI_LABEL *const self) +static void M_Free(UI_LABEL *const self) { Text_Remove(self->text); Memory_Free(self); @@ -48,10 +48,10 @@ UI_WIDGET *UI_Label_Create( UI_LABEL *self = Memory_Alloc(sizeof(UI_LABEL)); self->vtable = (UI_WIDGET_VTABLE) { .control = NULL, - .get_width = (UI_WIDGET_GET_WIDTH)UI_Label_GetWidth, - .get_height = (UI_WIDGET_GET_HEIGHT)UI_Label_GetHeight, - .set_position = (UI_WIDGET_SET_POSITION)UI_Label_SetPosition, - .free = (UI_WIDGET_FREE)UI_Label_Free, + .get_width = (UI_WIDGET_GET_WIDTH)M_GetWidth, + .get_height = (UI_WIDGET_GET_HEIGHT)M_GetHeight, + .set_position = (UI_WIDGET_SET_POSITION)M_SetPosition, + .free = (UI_WIDGET_FREE)M_Free, }; self->text = Text_Create(0, 0, 0, text); diff --git a/src/game/ui/stack.c b/src/game/ui/stack.c index 439e6f89..3a88b20d 100644 --- a/src/game/ui/stack.c +++ b/src/game/ui/stack.c @@ -14,13 +14,13 @@ typedef struct { } UI_STACK; -static int32_t UI_Stack_GetHeight(const UI_STACK *self); -static int32_t UI_Stack_GetWidth(const UI_STACK *self); -static void UI_Stack_SetPosition(UI_STACK *self, int32_t x, int32_t y); -static void UI_Stack_Control(UI_STACK *self); -static void UI_Stack_Free(UI_STACK *self); +static int32_t M_GetHeight(const UI_STACK *self); +static int32_t M_GetWidth(const UI_STACK *self); +static void M_SetPosition(UI_STACK *self, int32_t x, int32_t y); +static void M_Control(UI_STACK *self); +static void M_Free(UI_STACK *self); -static int32_t UI_Stack_GetWidth(const UI_STACK *const self) +static int32_t M_GetWidth(const UI_STACK *const self) { int32_t result = 0; for (int32_t i = 0; i < self->children->count; i++) { @@ -35,7 +35,7 @@ static int32_t UI_Stack_GetWidth(const UI_STACK *const self) return result; } -static int32_t UI_Stack_GetHeight(const UI_STACK *const self) +static int32_t M_GetHeight(const UI_STACK *const self) { int32_t result = 0; for (int32_t i = 0; i < self->children->count; i++) { @@ -50,7 +50,7 @@ static int32_t UI_Stack_GetHeight(const UI_STACK *const self) return result; } -static void UI_Stack_SetPosition( +static void M_SetPosition( UI_STACK *const self, const int32_t x, const int32_t y) { self->x = x; @@ -58,7 +58,7 @@ static void UI_Stack_SetPosition( UI_Stack_DoLayout((UI_WIDGET *)self); } -static void UI_Stack_Control(UI_STACK *const self) +static void M_Control(UI_STACK *const self) { for (int32_t i = 0; i < self->children->count; i++) { UI_WIDGET *const child = *(UI_WIDGET **)Vector_Get(self->children, i); @@ -68,7 +68,7 @@ static void UI_Stack_Control(UI_STACK *const self) } } -static void UI_Stack_Free(UI_STACK *const self) +static void M_Free(UI_STACK *const self) { Vector_Free(self->children); Memory_Free(self); @@ -84,11 +84,11 @@ UI_WIDGET *UI_Stack_Create(const UI_STACK_LAYOUT layout) { UI_STACK *const self = Memory_Alloc(sizeof(UI_STACK)); self->vtable = (UI_WIDGET_VTABLE) { - .control = (UI_WIDGET_CONTROL)UI_Stack_Control, - .get_width = (UI_WIDGET_GET_WIDTH)UI_Stack_GetWidth, - .get_height = (UI_WIDGET_GET_HEIGHT)UI_Stack_GetHeight, - .set_position = (UI_WIDGET_SET_POSITION)UI_Stack_SetPosition, - .free = (UI_WIDGET_FREE)UI_Stack_Free, + .control = (UI_WIDGET_CONTROL)M_Control, + .get_width = (UI_WIDGET_GET_WIDTH)M_GetWidth, + .get_height = (UI_WIDGET_GET_HEIGHT)M_GetHeight, + .set_position = (UI_WIDGET_SET_POSITION)M_SetPosition, + .free = (UI_WIDGET_FREE)M_Free, }; self->layout = layout; @@ -99,8 +99,8 @@ UI_WIDGET *UI_Stack_Create(const UI_STACK_LAYOUT layout) void UI_Stack_DoLayout(UI_WIDGET *const widget) { UI_STACK *const self = (UI_STACK *)widget; - const int32_t self_width = UI_Stack_GetWidth(self); - const int32_t self_height = UI_Stack_GetHeight(self); + const int32_t self_width = M_GetWidth(self); + const int32_t self_height = M_GetHeight(self); const int32_t start_x = self->x; const int32_t start_y = self->y; int32_t x = start_x; diff --git a/src/game/ui/window.c b/src/game/ui/window.c index 519f92a1..295f2b51 100644 --- a/src/game/ui/window.c +++ b/src/game/ui/window.c @@ -16,25 +16,25 @@ typedef struct { } border; } UI_WINDOW; -static int32_t UI_Window_GetWidth(const UI_WINDOW *self); -static int32_t UI_Window_GetHeight(const UI_WINDOW *self); -static void UI_Window_SetPosition(UI_WINDOW *self, int32_t x, int32_t y); -static void UI_Window_Control(UI_WINDOW *self); -static void UI_Window_Free(UI_WINDOW *self); +static int32_t M_GetWidth(const UI_WINDOW *self); +static int32_t M_GetHeight(const UI_WINDOW *self); +static void M_SetPosition(UI_WINDOW *self, int32_t x, int32_t y); +static void M_Control(UI_WINDOW *self); +static void M_Free(UI_WINDOW *self); -static int32_t UI_Window_GetWidth(const UI_WINDOW *const self) +static int32_t M_GetWidth(const UI_WINDOW *const self) { return self->root->get_width(self->root) + self->border.left + self->border.right; } -static int32_t UI_Window_GetHeight(const UI_WINDOW *const self) +static int32_t M_GetHeight(const UI_WINDOW *const self) { return self->root->get_height(self->root) + self->border.top + self->border.bottom; } -static void UI_Window_SetPosition( +static void M_SetPosition( UI_WINDOW *const self, const int32_t x, const int32_t y) { self->root->set_position( @@ -42,20 +42,20 @@ static void UI_Window_SetPosition( Text_SetPos(self->text, x, y); - const int32_t w = UI_Window_GetWidth(self); - const int32_t h = UI_Window_GetHeight(self); + const int32_t w = M_GetWidth(self); + const int32_t h = M_GetHeight(self); Text_AddBackground(self->text, w, h, w / 2, 0, 0, INV_COLOR_BLACK, NULL, 0); Text_AddOutline(self->text, true, INV_COLOR_BLUE, NULL, 0); } -static void UI_Window_Control(UI_WINDOW *const self) +static void M_Control(UI_WINDOW *const self) { if (self->root->control != NULL) { self->root->control(self->root); } } -static void UI_Window_Free(UI_WINDOW *const self) +static void M_Free(UI_WINDOW *const self) { Text_Remove(self->text); Memory_Free(self); @@ -67,11 +67,11 @@ UI_WIDGET *UI_Window_Create( { UI_WINDOW *const self = Memory_Alloc(sizeof(UI_WINDOW)); self->vtable = (UI_WIDGET_VTABLE) { - .control = (UI_WIDGET_CONTROL)UI_Window_Control, - .get_width = (UI_WIDGET_GET_WIDTH)UI_Window_GetWidth, - .get_height = (UI_WIDGET_GET_HEIGHT)UI_Window_GetHeight, - .set_position = (UI_WIDGET_SET_POSITION)UI_Window_SetPosition, - .free = (UI_WIDGET_FREE)UI_Window_Free, + .control = (UI_WIDGET_CONTROL)M_Control, + .get_width = (UI_WIDGET_GET_WIDTH)M_GetWidth, + .get_height = (UI_WIDGET_GET_HEIGHT)M_GetHeight, + .set_position = (UI_WIDGET_SET_POSITION)M_SetPosition, + .free = (UI_WIDGET_FREE)M_Free, }; self->root = root;