Skip to content

Commit 0c0834b

Browse files
tamlin-mikeXottab-DUTY
authored andcommitted
More cleaning/decoupling. Some 'override' added. Fixed up stricmp -> _stricmp & co.
Replace _stricmp & co. to instead use xr_-prepended function names in the code, and select impl. from a header depending on compiler used. Tagged up CKinematics with 'override' where appropriate. Removed a bunch of compiler warnings (unused function arguments, re-defining variable name in function (sometimes with different type even)). Moved a few Lock instances in a class to be Lock* (compile-time complexity reduction). Xottab_DUTY: removed some include guards
1 parent d7578ee commit 0c0834b

File tree

194 files changed

+662
-586
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+662
-586
lines changed

src/Common/Compiler.inl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,21 @@
3131
#define XR_NOEXCEPT noexcept
3232
#define XR_NOEXCEPT_OP(x) noexcept(x)
3333
#endif
34+
35+
#ifdef _MSC_VER
36+
// We use xr_* instead of defining e.g. strupr => _strupr, since the macro definition could
37+
// come before the std. header file declaring it, and thereby renaming that one too.
38+
#define xr_strupr _strupr
39+
#define xr_strlwr _strlwr
40+
#define xr_stricmp _stricmp
41+
#define xr_strcmpi _strcmpi
42+
#define xr_unlink _unlink
43+
#define xr_itoa _itoa
44+
#else
45+
#define xr_strupr strupr
46+
#define xr_strlwr strlwr
47+
#define xr_stricmp stricmp
48+
#define xr_strcmpi strcmpi
49+
#define xr_unlink unlink
50+
#define xr_itoa itoa
51+
#endif

src/Layers/xrRender/AnimationKeyCalculate.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ IC void Dequantize(CKey& K, const CBlend& BD, const CMotion& M)
8989
// rotation
9090
if (M.test_flag(flRKeyAbsent))
9191
{
92-
const CKeyQR* K = &M._keysR[0];
93-
QR2Quat(*K, D->Q);
92+
const CKeyQR* K2 = &M._keysR[0];
93+
QR2Quat(*K2, D->Q);
9494
}
9595
else
9696
{
@@ -394,7 +394,7 @@ IC void MixAdd(CKey& Result, const CKey* R, const float* BA, int b_count)
394394
MixinAdd(Result, R, BA, b_count);
395395
}
396396
IC void process_single_channel(
397-
CKey& Result, const animation::channel_def& ch, const CKey* R, const CBlend* const BA[MAX_BLENDED], int b_count)
397+
CKey& Result, const animation::channel_def& /*ch*/, const CKey* R, const CBlend* const BA[MAX_BLENDED], int b_count)
398398
{
399399
MixInterlerp(Result, R, BA, b_count);
400400
VERIFY(_valid(Result.T));

src/Layers/xrRender/Blender_Recorder_R2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void CBlender_Compile::r_Pass(LPCSTR _vs, LPCSTR _ps, bool bFog, BOOL bZtest, BO
4040
ctable.merge(&vs->constants);
4141

4242
// Last Stage - disable
43-
if (0 == _stricmp(_ps, "null"))
43+
if (0 == xr_stricmp(_ps, "null"))
4444
{
4545
RS.SetTSS(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
4646
RS.SetTSS(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);

src/Layers/xrRender/D3DUtils.cpp

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -396,17 +396,19 @@ void CDrawUtilities::DrawEntity(u32 clr, ref_shader s)
396396
// fill VB
397397
_VertexStream* Stream = &RCache.Vertex;
398398
u32 vBase;
399-
FVF::L* pv = (FVF::L*)Stream->Lock(5, vs_L->vb_stride, vBase);
400-
pv->set(0.f, 0.f, 0.f, clr);
401-
pv++;
402-
pv->set(0.f, 1.f, 0.f, clr);
403-
pv++;
404-
pv->set(0.f, 1.f, .5f, clr);
405-
pv++;
406-
pv->set(0.f, .5f, .5f, clr);
407-
pv++;
408-
pv->set(0.f, .5f, 0.f, clr);
409-
pv++;
399+
{
400+
FVF::L* pv = (FVF::L*)Stream->Lock(5, vs_L->vb_stride, vBase);
401+
pv->set(0.f, 0.f, 0.f, clr);
402+
pv++;
403+
pv->set(0.f, 1.f, 0.f, clr);
404+
pv++;
405+
pv->set(0.f, 1.f, .5f, clr);
406+
pv++;
407+
pv->set(0.f, .5f, .5f, clr);
408+
pv++;
409+
pv->set(0.f, .5f, 0.f, clr);
410+
pv++;
411+
}
410412
Stream->Unlock(5, vs_L->vb_stride);
411413
// render flagshtok
412414
DU_DRAW_SH(RImplementation.m_WireShader);
@@ -441,11 +443,13 @@ void CDrawUtilities::DrawFlag(
441443
// fill VB
442444
_VertexStream* Stream = &RCache.Vertex;
443445
u32 vBase;
444-
FVF::L* pv = (FVF::L*)Stream->Lock(2, vs_L->vb_stride, vBase);
445-
pv->set(p, clr);
446-
pv++;
447-
pv->set(p.x, p.y + height, p.z, clr);
448-
pv++;
446+
{
447+
FVF::L* pv = (FVF::L*)Stream->Lock(2, vs_L->vb_stride, vBase);
448+
pv->set(p, clr);
449+
pv++;
450+
pv->set(p.x, p.y + height, p.z, clr);
451+
pv++;
452+
}
449453
Stream->Unlock(2, vs_L->vb_stride);
450454
// and Render it as triangle list
451455
DU_DRAW_DP(D3DPT_LINELIST, vs_L, vBase, 1);

src/Layers/xrRender/DetailManager_VS.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ void CDetailManager::hw_Render()
232232
hw_Render_dump(&*hwc_s_array, 0, 1, c_hdr);
233233
}
234234

235-
void CDetailManager::hw_Render_dump(ref_constant x_array, u32 var_id, u32 lod_id, u32 c_offset)
235+
void CDetailManager::hw_Render_dump(ref_constant x_array, u32 var_id, u32 lod_id, u32 /*c_offset*/)
236236
{
237237
RImplementation.BasicStats.DetailCount = 0;
238238

src/Layers/xrRender/FHierrarhyVisual.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void FHierrarhyVisual::Load(const char* N, IReader* data, u32 dwFlags)
7171
xr_strcpy(short_name, N);
7272
if (strext(short_name))
7373
*strext(short_name) = 0;
74-
strconcat(sizeof(name_load), name_load, short_name, ":", _itoa(count, num, 10));
74+
strconcat(sizeof(name_load), name_load, short_name, ":", xr_itoa(count, num, 10));
7575
children.push_back((dxRender_Visual*)GEnv.Render->model_CreateChild(name_load, O));
7676
O->close();
7777
O = OBJ->open_chunk(count);

src/Layers/xrRender/HOM.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ void CHOM::Render_DB(CFrustum& base)
217217
stats.VisibleTriangleCount++;
218218
u32 pixels = 0;
219219
int limit = int(P->size()) - 1;
220-
for (int v = 1; v < limit; v++)
220+
for (int v2 = 1; v2 < limit; v2++)
221221
{
222222
m_xform.transform(T.raster[0], (*P)[0]);
223-
m_xform.transform(T.raster[1], (*P)[v + 0]);
224-
m_xform.transform(T.raster[2], (*P)[v + 1]);
223+
m_xform.transform(T.raster[1], (*P)[v2 + 0]);
224+
m_xform.transform(T.raster[2], (*P)[v2 + 1]);
225225
pixels += Raster.rasterize(&T);
226226
}
227227
if (0 == pixels)

src/Layers/xrRender/HW.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ struct _uniq_mode
579579
{
580580
_uniq_mode(LPCSTR v) : _val(v) {}
581581
LPCSTR _val;
582-
bool operator()(LPCSTR _other) { return !_stricmp(_val, _other); }
582+
bool operator()(LPCSTR _other) { return !xr_stricmp(_val, _other); }
583583
};
584584

585585
#ifndef _EDITOR

src/Layers/xrRender/ModelPool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ dxRender_Visual* CModelPool::Create(const char* name, IReader* data)
220220
string_path low_name;
221221
VERIFY(xr_strlen(name) < sizeof(low_name));
222222
xr_strcpy(low_name, name);
223-
_strlwr(low_name);
223+
xd_strlwr(low_name);
224224
if (strext(low_name))
225225
*strext(low_name) = 0;
226226
// Msg ("-CREATE %s",low_name);
@@ -266,7 +266,7 @@ dxRender_Visual* CModelPool::CreateChild(LPCSTR name, IReader* data)
266266
string256 low_name;
267267
VERIFY(xr_strlen(name) < 256);
268268
xr_strcpy(low_name, name);
269-
_strlwr(low_name);
269+
xd_strlwr(low_name);
270270
if (strext(low_name))
271271
*strext(low_name) = 0;
272272

src/Layers/xrRender/NvTriStrip.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ void GenerateStrips(const u16* in_indices, const s32 in_numIndices, xr_vector<Pr
6565
// put data in format that the stripifier likes
6666
WordVec tempIndices;
6767
tempIndices.resize(in_numIndices);
68-
int i;
69-
for (i = 0; i < in_numIndices; i++)
68+
for (int i = 0; i < in_numIndices; i++)
7069
tempIndices[i] = in_indices[i];
7170
NvStripInfoVec tempStrips;
7271
NvFaceInfoVec tempFaces;

0 commit comments

Comments
 (0)