From cc3473e216fce052672ec4600896124584866e52 Mon Sep 17 00:00:00 2001 From: divverent Date: Sun, 1 Jun 2008 13:14:54 +0000 Subject: [PATCH] some const fixes and type fixes found by gcc -combine git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8321 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_screen.c | 2 +- csprogs.c | 4 ++-- gl_rsurf.c | 4 ++-- glquake.h | 8 +++++--- host_cmd.c | 3 +++ model_shared.h | 4 ++-- progsvm.h | 1 + r_shadow.c | 2 +- r_shadow.h | 2 +- render.h | 2 +- screen.h | 2 +- 11 files changed, 20 insertions(+), 14 deletions(-) diff --git a/cl_screen.c b/cl_screen.c index dad5df85..52d93d45 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -90,7 +90,7 @@ Called for important messages that should stay in the center of the screen for a few moments ============== */ -void SCR_CenterPrint(char *str) +void SCR_CenterPrint(const char *str) { strlcpy (scr_centerstring, str, sizeof (scr_centerstring)); scr_centertime_off = scr_centertime.value; diff --git a/csprogs.c b/csprogs.c index cfc47d6e..39dbc6ff 100644 --- a/csprogs.c +++ b/csprogs.c @@ -415,7 +415,7 @@ void CL_VM_Parse_CenterPrint (const char *msg) int restorevm_tempstringsbuf_cursize; if(!cl.csqc_loaded) { - SCR_CenterPrint((char*)msg); + SCR_CenterPrint(msg); return; } CSQC_BEGIN @@ -429,7 +429,7 @@ void CL_VM_Parse_CenterPrint (const char *msg) vm_tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize; } else - SCR_CenterPrint((char*)msg); + SCR_CenterPrint(msg); CSQC_END } diff --git a/gl_rsurf.c b/gl_rsurf.c index 223e15cd..586219e5 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -977,7 +977,7 @@ void R_Q1BSP_CompileShadowVolume(entity_render_t *ent, vec3_t relativelightorigi extern cvar_t r_polygonoffset_submodel_factor; extern cvar_t r_polygonoffset_submodel_offset; -void R_Q1BSP_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int modelnumsurfaces, const int *modelsurfacelist, const vec3_t lightmins, const vec3_t lightmaxs) +void R_Q1BSP_DrawShadowVolume(entity_render_t *ent, const vec3_t relativelightorigin, const vec3_t relativelightdirection, float lightradius, int modelnumsurfaces, const int *modelsurfacelist, const vec3_t lightmins, const vec3_t lightmaxs) { dp_model_t *model = ent->model; msurface_t *surface; @@ -1030,7 +1030,7 @@ static void R_Q1BSP_DrawLight_TransparentCallback(const entity_render_t *ent, co msurface_t *surface; // note: in practice this never actually receives batches), oh well R_Shadow_RenderMode_Begin(); - R_Shadow_RenderMode_ActiveLight((rtlight_t *)rtlight); + R_Shadow_RenderMode_ActiveLight(rtlight); R_Shadow_RenderMode_Lighting(false, true); R_Shadow_SetupEntityLight(ent); for (i = 0;i < numsurfaces;i = j) diff --git a/glquake.h b/glquake.h index 5cd68abf..5acbc446 100644 --- a/glquake.h +++ b/glquake.h @@ -42,6 +42,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #ifndef GL_PROJECTION +#include + typedef unsigned int GLenum; typedef unsigned char GLboolean; typedef unsigned int GLbitfield; @@ -69,9 +71,9 @@ typedef double GLdouble; // double precision float in [0,1] typedef double GLclampd; // int whose size is the same as a pointer (?) -typedef size_t GLintptrARB; +typedef ptrdiff_t GLintptrARB; // int whose size is the same as a pointer (?) -typedef size_t GLsizeiptrARB; +typedef ptrdiff_t GLsizeiptrARB; #define GL_MODELVIEW 0x1700 #define GL_PROJECTION 0x1701 @@ -609,7 +611,7 @@ extern int gl_support_shader_objects; // 1-byte character string typedef char GLcharARB; // 4-byte integer handle to a shader object or program object -typedef int GLhandleARB; +typedef unsigned int GLhandleARB; #endif extern void (GLAPIENTRY *qglDeleteObjectARB)(GLhandleARB obj); extern GLhandleARB (GLAPIENTRY *qglGetHandleARB)(GLenum pname); diff --git a/host_cmd.c b/host_cmd.c index 1768dbc4..fc3db1b9 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -525,7 +525,10 @@ void Host_Savegame_f (void) PRVM_ED_WriteGlobals (f); for (i=0 ; inum_edicts ; i++) + { + Con_Printf("edict %d...\n", i); PRVM_ED_Write (f, PRVM_EDICT_NUM(i)); + } SV_VM_End(); diff --git a/model_shared.h b/model_shared.h index 1f171ca3..035cfe4b 100644 --- a/model_shared.h +++ b/model_shared.h @@ -860,7 +860,7 @@ typedef struct model_s // compile a shadow volume for the model based on light source void(*CompileShadowVolume)(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist); // draw a shadow volume for the model based on light source - void(*DrawShadowVolume)(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs); + void(*DrawShadowVolume)(struct entity_render_s *ent, const vec3_t relativelightorigin, const vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs); // draw the lighting on a model (through stencil) void(*DrawLight)(struct entity_render_s *ent, int numsurfaces, const int *surfacelist, const unsigned char *trispvs); // trace a box against this model @@ -966,7 +966,7 @@ void R_Q1BSP_DrawDepth(struct entity_render_s *ent); void R_Q1BSP_DrawDebug(struct entity_render_s *ent); void R_Q1BSP_GetLightInfo(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, unsigned char *outleafpvs, int *outnumleafspointer, int *outsurfacelist, unsigned char *outsurfacepvs, int *outnumsurfacespointer, unsigned char *outshadowtrispvs, unsigned char *outlighttrispvs); void R_Q1BSP_CompileShadowVolume(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist); -void R_Q1BSP_DrawShadowVolume(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs); +void R_Q1BSP_DrawShadowVolume(struct entity_render_s *ent, const vec3_t relativelightorigin, const vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs); void R_Q1BSP_DrawLight(struct entity_render_s *ent, int numsurfaces, const int *surfacelist, const unsigned char *trispvs); // alias models diff --git a/progsvm.h b/progsvm.h index e88fb092..cf200b19 100644 --- a/progsvm.h +++ b/progsvm.h @@ -250,6 +250,7 @@ typedef struct prvm_prog_globaloffsets_s int dmg_origin; // csqc int sb_showscores; // csqc int drawfont; // csqc / menu + int require_spawnfunc_prefix; // ssqc } prvm_prog_globaloffsets_t; diff --git a/r_shadow.c b/r_shadow.c index 576e4b0e..0091ada6 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -1051,7 +1051,7 @@ void R_Shadow_RenderMode_Begin(void) r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_VERTEX; } -void R_Shadow_RenderMode_ActiveLight(rtlight_t *rtlight) +void R_Shadow_RenderMode_ActiveLight(const rtlight_t *rtlight) { rsurface.rtlight = rtlight; } diff --git a/r_shadow.h b/r_shadow.h index 2a33e8c7..592521e1 100644 --- a/r_shadow.h +++ b/r_shadow.h @@ -41,7 +41,7 @@ void R_Shadow_VolumeFromList(int numverts, int numtris, const float *invertex3f, void R_Shadow_MarkVolumeFromBox(int firsttriangle, int numtris, const float *invertex3f, const int *elements, const vec3_t projectorigin, const vec3_t projectdirection, const vec3_t lightmins, const vec3_t lightmaxs, const vec3_t surfacemins, const vec3_t surfacemaxs); void R_Shadow_RenderLighting(int firstvertex, int numvertices, int firsttriangle, int numtriangles, const int *element3i, const unsigned short *element3s, int element3i_bufferobject, int element3s_bufferobject); void R_Shadow_RenderMode_Begin(void); -void R_Shadow_RenderMode_ActiveLight(rtlight_t *rtlight); +void R_Shadow_RenderMode_ActiveLight(const rtlight_t *rtlight); void R_Shadow_RenderMode_Reset(void); void R_Shadow_RenderMode_StencilShadowVolumes(qboolean clearstencil); void R_Shadow_RenderMode_Lighting(qboolean stenciltest, qboolean transparent); diff --git a/render.h b/render.h index c267399d..bc430376 100644 --- a/render.h +++ b/render.h @@ -316,7 +316,7 @@ typedef struct rsurfacestate_s // rtlight rendering // light currently being rendered - rtlight_t *rtlight; + const rtlight_t *rtlight; // current light's cull box (copied out of an rtlight or calculated by GetLightInfo) vec3_t rtlight_cullmins; vec3_t rtlight_cullmaxs; diff --git a/screen.h b/screen.h index 3ee9d0de..5feeed44 100644 --- a/screen.h +++ b/screen.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void CL_Screen_Init (void); void CL_UpdateScreen (void); -void SCR_CenterPrint(char *str); +void SCR_CenterPrint(const char *str); void SCR_BeginLoadingPlaque (void); -- 2.39.2