Convince the compiler that I know what I'm doing, I think

This commit is contained in:
Hannu Hanhi 2020-08-18 23:21:26 +03:00
parent 0e5631fe66
commit bda1d1e725
2 changed files with 6 additions and 2 deletions

View file

@ -1410,7 +1410,9 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
// If so, uvs need to be readjusted.
// Comparing floats with the != operator here should be okay because they
// are just copies of glpatches' max_s and max_t values.
if (gpatch->max_s != md2->model->max_s || gpatch->max_t != md2->model->max_t)
// Instead of the != operator, memcmp is used to avoid a compiler warning.
if (memcmp(&(gpatch->max_s), &(md2->model->max_s), sizeof(md2->model->max_s)) != 0 ||
memcmp(&(gpatch->max_t), &(md2->model->max_t), sizeof(md2->model->max_t)) != 0)
adjustTextureCoords(md2->model, gpatch);
HWR_GetMappedPatch(gpatch, spr->colormap);
}

View file

@ -2772,7 +2772,9 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
// (Can happen when model uses a sprite as a texture and the sprite changes)
// Comparing floats with the != operator here should be okay because they
// are just copies of glpatches' max_s and max_t values.
if (model->vbo_max_s != model->max_s || model->vbo_max_t != model->max_t)
// Instead of the != operator, memcmp is used to avoid a compiler warning.
if (memcmp(&(model->vbo_max_s), &(model->max_s), sizeof(model->max_s)) != 0 ||
memcmp(&(model->vbo_max_t), &(model->max_t), sizeof(model->max_t)) != 0)
useVBO = false;
pglEnableClientState(GL_NORMAL_ARRAY);