diff --git a/Quake/gl_draw.c b/Quake/gl_draw.c index 470c75a6..0f679044 100644 --- a/Quake/gl_draw.c +++ b/Quake/gl_draw.c @@ -376,8 +376,9 @@ void Draw_NewGame (void) int i; // empty scrap and reallocate gltextures - memset(&scrap_allocated, 0, sizeof(scrap_allocated)); - memset(&scrap_texels, 255, sizeof(scrap_texels)); + memset(scrap_allocated, 0, sizeof(scrap_allocated)); + memset(scrap_texels, 255, sizeof(scrap_texels)); + Scrap_Upload (); //creates 2 empty gltextures // reload wad pics @@ -402,8 +403,9 @@ void Draw_Init (void) Cvar_RegisterVariable (&scr_conalpha); // clear scrap and allocate gltextures - memset(&scrap_allocated, 0, sizeof(scrap_allocated)); - memset(&scrap_texels, 255, sizeof(scrap_texels)); + memset(scrap_allocated, 0, sizeof(scrap_allocated)); + memset(scrap_texels, 255, sizeof(scrap_texels)); + Scrap_Upload (); //creates 2 empty textures // create internal pics @@ -687,7 +689,7 @@ void GL_SetCanvas (canvastype newcanvas) currentcanvas = newcanvas; glMatrixMode(GL_PROJECTION); - glLoadIdentity (); + glLoadIdentity (); switch(newcanvas) { @@ -749,7 +751,7 @@ void GL_SetCanvas (canvastype newcanvas) } glMatrixMode(GL_MODELVIEW); - glLoadIdentity (); + glLoadIdentity (); } /* diff --git a/Quake/image.c b/Quake/image.c index a82bb1ac..399b6eb2 100644 --- a/Quake/image.c +++ b/Quake/image.c @@ -156,7 +156,7 @@ qboolean Image_WriteTGA (const char *name, byte *data, int width, int height, in if (handle == -1) return false; - Q_memset (&header, 0, TARGAHEADERSIZE); + Q_memset (header, 0, TARGAHEADERSIZE); header[2] = 2; // uncompressed type header[12] = width&255; header[13] = width>>8; @@ -176,7 +176,7 @@ qboolean Image_WriteTGA (const char *name, byte *data, int width, int height, in data[i+2] = temp; } - Sys_FileWrite (handle, &header, TARGAHEADERSIZE); + Sys_FileWrite (handle, header, TARGAHEADERSIZE); Sys_FileWrite (handle, data, size); Sys_FileClose (handle); diff --git a/Quake/r_alias.c b/Quake/r_alias.c index fbad0812..604ee85b 100644 --- a/Quake/r_alias.c +++ b/Quake/r_alias.c @@ -96,8 +96,7 @@ model and pose. */ static void *GLARB_GetXYZOffset (aliashdr_t *hdr, int pose) { - meshxyz_t dummy; - int xyzoffs = ((char*)&dummy.xyz - (char*)&dummy); + const int xyzoffs = offsetof (meshxyz_t, xyz); return (void *) (currententity->model->vboxyzofs + (hdr->numverts_vbo * pose * sizeof (meshxyz_t)) + xyzoffs); } @@ -111,8 +110,7 @@ given model and pose. */ static void *GLARB_GetNormalOffset (aliashdr_t *hdr, int pose) { - meshxyz_t dummy; - int normaloffs = ((char*)&dummy.normal - (char*)&dummy); + const int normaloffs = offsetof (meshxyz_t, normal); return (void *)(currententity->model->vboxyzofs + (hdr->numverts_vbo * pose * sizeof (meshxyz_t)) + normaloffs); }