made darkplaces able to compile as C++ again, and fixed all conversion warnings when...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 8 Apr 2006 18:56:35 +0000 (18:56 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 8 Apr 2006 18:56:35 +0000 (18:56 +0000)
changed several malloc and free calls to Z_Malloc and Z_Free

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6260 d7cf8633-e32d-0410-b094-e92efae38249

50 files changed:
cd_linux.c
cl_input.c
cl_main.c
cl_parse.c
cl_particles.c
cl_screen.c
cl_video.c
client.h
clvm_cmds.c
console.c
csprogs.c
gl_backend.c
gl_draw.c
gl_rmain.c
gl_rsurf.c
host.c
host_cmd.c
image.c
image_png.c
jpeg.c
keys.c
menu.c
model_alias.c
model_brush.c
model_shared.c
model_sprite.c
mvm_cmds.c
netconn.c
protocol.c
prvm_cmds.c
r_light.c
r_shadow.c
render.h
sbar.c
snd_main.c
snd_mem.c
snd_mix.c
snd_ogg.c
snd_wav.c
sv_main.c
sv_move.c
sv_user.c
svvm_cmds.c
sys_sdl.c
sys_win.c
todo
vid_shared.c
view.c
world.c
world_cs.c

index b0e4fb0..2db702c 100644 (file)
@@ -105,7 +105,7 @@ void CDAudio_SysSetVolume (float volume)
        if (cdfile == -1)
                return;
 
-       vol.channel0 = vol.channel1 = volume * 255;
+       vol.channel0 = vol.channel1 = (__u8)(volume * 255);
        vol.channel2 = vol.channel3 = 0;
 
        if (ioctl (cdfile, CDROMVOLCTRL, &vol) == -1)
index 4755d98..86a2aec 100644 (file)
@@ -1192,8 +1192,8 @@ void CL_SendMove(void)
                                MSG_WriteByte (&buf, impulse);
                                // PRYDON_CLIENTCURSOR
                                // 30 bytes
-                               MSG_WriteShort (&buf, cl.cmd.cursor_screen[0] * 32767.0f);
-                               MSG_WriteShort (&buf, cl.cmd.cursor_screen[1] * 32767.0f);
+                               MSG_WriteShort (&buf, (short)(cl.cmd.cursor_screen[0] * 32767.0f));
+                               MSG_WriteShort (&buf, (short)(cl.cmd.cursor_screen[1] * 32767.0f));
                                MSG_WriteFloat (&buf, cl.cmd.cursor_start[0]);
                                MSG_WriteFloat (&buf, cl.cmd.cursor_start[1]);
                                MSG_WriteFloat (&buf, cl.cmd.cursor_start[2]);
index b78ec29..e4f59f6 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -239,7 +239,7 @@ void CL_ExpandCSQCEntities(int num)
                oldmaxentities = cl.max_csqcentities;
                oldentities = cl.csqcentities;
                cl.max_csqcentities = (num & ~255) + 256;
-               cl.csqcentities = Mem_Alloc(cls.levelmempool, cl.max_csqcentities * sizeof(entity_t));
+               cl.csqcentities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_csqcentities * sizeof(entity_t));
                memcpy(cl.csqcentities, oldentities, oldmaxentities * sizeof(entity_t));
                Mem_Free(oldentities);
                for (i = oldmaxentities;i < cl.max_csqcentities;i++)
@@ -664,7 +664,7 @@ void CL_UpdateLights(void)
                l = (i-1) % cl.lightstyle[j].length;
                k = cl.lightstyle[j].map[k] - 'a';
                l = cl.lightstyle[j].map[l] - 'a';
-               r_refdef.lightstylevalue[j] = ((k*frac)+(l*(1-frac)))*22;
+               r_refdef.lightstylevalue[j] = (unsigned short)(((k*frac)+(l*(1-frac)))*22);
        }
 }
 
@@ -1287,7 +1287,7 @@ static void CL_RelinkEffects(void)
                if (e->active)
                {
                        frame = (cl.time - e->starttime) * e->framerate + e->startframe;
-                       intframe = frame;
+                       intframe = (int)frame;
                        if (intframe < 0 || intframe >= e->endframe)
                        {
                                memset(e, 0, sizeof(*e));
index d7301fc..2534097 100644 (file)
@@ -586,7 +586,7 @@ static void QW_CL_ParseDownload(void)
                while (cls.qw_downloadmemorymaxsize < cls.qw_downloadmemorycursize + size)
                        cls.qw_downloadmemorymaxsize *= 2;
                old = cls.qw_downloadmemory;
-               cls.qw_downloadmemory = Mem_Alloc(cls.permanentmempool, cls.qw_downloadmemorymaxsize);
+               cls.qw_downloadmemory = (unsigned char *)Mem_Alloc(cls.permanentmempool, cls.qw_downloadmemorymaxsize);
                if (old)
                {
                        memcpy(cls.qw_downloadmemory, old, cls.qw_downloadmemorycursize);
@@ -748,7 +748,7 @@ void QW_CL_StartUpload(unsigned char *data, int size)
 
        Con_DPrintf("Starting upload of %d bytes...\n", size);
 
-       cls.qw_uploaddata = Mem_Alloc(cls.permanentmempool, size);
+       cls.qw_uploaddata = (unsigned char *)Mem_Alloc(cls.permanentmempool, size);
        memcpy(cls.qw_uploaddata, data, size);
        cls.qw_uploadsize = size;
        cls.qw_uploadpos = 0;
@@ -1843,7 +1843,7 @@ void CL_ParseTempEntity(void)
                        colorStart = MSG_ReadByte(); // color
                        colorLength = MSG_ReadByte(); // gravity (1 or 0)
                        velspeed = MSG_ReadCoord(cls.protocol); // randomvel
-                       CL_ParticleCube(pos, pos2, dir, count, colorStart, colorLength, velspeed);
+                       CL_ParticleCube(pos, pos2, dir, count, colorStart, colorLength != 0, velspeed);
                        break;
 
                case TE_PARTICLERAIN:
index 85a965b..72d4d8c 100644 (file)
@@ -102,8 +102,8 @@ typedef struct particleeffectinfo_s
        float lightradiusfade;
        float lighttime;
        float lightcolor[3];
-       float lightshadow;
-       float lightcubemapnum;
+       qboolean lightshadow;
+       int lightcubemapnum;
 }
 particleeffectinfo_t;
 
@@ -1321,16 +1321,16 @@ static void CL_Sparks(const vec3_t originmins, const vec3_t originmaxs, const ve
        }
 }
 
-void CL_ParticleCube (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, int gravity, int randomvel)
+void CL_ParticleCube (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, vec_t gravity, vec_t randomvel)
 {
        int k;
        if (!cl_particles.integer) return;
 
-       count *= cl_particles_quality.value;
+       count = (int)(count * cl_particles_quality.value);
        while (count--)
        {
                k = particlepalette[colorbase + (rand()&3)];
-               particle(particletype + pt_alphastatic, k, k, tex_particle, 2, 255, 128, gravity ? 1 : 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(mins[2], maxs[2]), dir[0], dir[1], dir[2], 0, 0, randomvel);
+               particle(particletype + pt_alphastatic, k, k, tex_particle, 2, 255, 128, gravity, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(mins[2], maxs[2]), dir[0], dir[1], dir[2], 0, 0, randomvel);
        }
 }
 
@@ -1350,7 +1350,7 @@ void CL_ParticleRain (const vec3_t mins, const vec3_t maxs, const vec3_t dir, in
        minz = bound(mins[2], minz, maxs[2]);
        maxz = bound(mins[2], maxz, maxs[2]);
 
-       count *= cl_particles_quality.value;
+       count = (int)(count * cl_particles_quality.value);
 
        switch(type)
        {
@@ -1481,7 +1481,7 @@ void CL_MoveParticles (void)
                                                VectorCopy(trace.plane.normal, p->vel);
                                                VectorAdd(p->org, p->vel, p->org);
                                                if (cl_stainmaps.integer)
-                                                       R_Stain(p->org, 32, 32, 16, 16, p->alpha * p->size * (1.0f / 40.0f), 192, 48, 48, p->alpha * p->size * (1.0f / 40.0f));
+                                                       R_Stain(p->org, 32, 32, 16, 16, (int)(p->alpha * p->size * (1.0f / 40.0f)), 192, 48, 48, (int)(p->alpha * p->size * (1.0f / 40.0f)));
 
                                                p->type = particletype + pt_decal;
                                                p->texnum = tex_blooddecal[rand()&7];
@@ -1588,7 +1588,7 @@ void CL_MoveParticles (void)
                                        p->type = NULL;
                                break;
                        case pt_raindecal:
-                               a = max(0, (cl.time - p->time2) * 40);
+                               a = (int)max(0, (cl.time - p->time2) * 40);
                                if (a < 16)
                                        p->texnum = tex_rainsplash[a];
                                else
@@ -1686,9 +1686,9 @@ void particletextureblotch(unsigned char *data, float radius, float red, float g
                        if (f > 0)
                        {
                                d = data + (y * PARTICLETEXTURESIZE + x) * 4;
-                               d[0] += f * (red   - d[0]);
-                               d[1] += f * (green - d[1]);
-                               d[2] += f * (blue  - d[2]);
+                               d[0] += (int)(f * (red   - d[0]));
+                               d[1] += (int)(f * (green - d[1]));
+                               d[2] += (int)(f * (blue  - d[2]));
                        }
                }
        }
@@ -1787,7 +1787,7 @@ static void R_InitParticleTexture (void)
                                        dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1);
                                        d = (noise2[y][x] - 128) * 3 + 192;
                                        if (d > 0)
-                                               d = d * (1-(dx*dx+dy*dy));
+                                               d = (int)(d * (1-(dx*dx+dy*dy)));
                                        d = (d * noise1[y][x]) >> 7;
                                        d = bound(0, d, 255);
                                        data[y][x][3] = (unsigned char) d;
@@ -1827,7 +1827,7 @@ static void R_InitParticleTexture (void)
                for (x = 0;x < PARTICLETEXTURESIZE;x++)
                {
                        dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1);
-                       d = 256 * (1 - (dx*dx+dy*dy));
+                       d = (int)(256 * (1 - (dx*dx+dy*dy)));
                        d = bound(0, d, 255);
                        data[y][x][3] = (unsigned char) d;
                }
@@ -1907,7 +1907,7 @@ static void R_InitParticleTexture (void)
                for (x = 0;x < 16;x++)
                {
                        dx = (x - 0.5f*16) / (16*0.5f-2);
-                       d = (1 - sqrt(fabs(dx))) * noise3[y][x];
+                       d = (int)((1 - sqrt(fabs(dx))) * noise3[y][x]);
                        data2[y][x][0] = data2[y][x][1] = data2[y][x][2] = (unsigned char) bound(0, d, 255);
                        data2[y][x][3] = 255;
                }
index da94d59..63b8e94 100644 (file)
@@ -108,7 +108,7 @@ void SCR_DrawCenterString (void)
 
 // the finale prints the characters one at a time
        if (cl.intermission)
-               remaining = scr_printspeed.value * (cl.time - scr_centertime_start);
+               remaining = (int)(scr_printspeed.value * (cl.time - scr_centertime_start));
        else
                remaining = 9999;
 
@@ -119,7 +119,7 @@ void SCR_DrawCenterString (void)
                return;
 
        if (scr_center_lines <= 4)
-               y = vid_conheight.integer*0.35;
+               y = (int)(vid_conheight.integer*0.35);
        else
                y = 48;
 
@@ -385,7 +385,7 @@ void SCR_DrawConsole (void)
                Con_DrawConsole (vid_conheight.integer);
        }
        else if (scr_con_current)
-               Con_DrawConsole (scr_con_current);
+               Con_DrawConsole ((int)scr_con_current);
        else
        {
                con_vislines = 0;
@@ -891,7 +891,7 @@ void SCR_CaptureVideo(void)
                if (cls.capturevideo_soundfile)
                {
                        // preserve sound sync by duplicating frames when running slow
-                       newframenum = (Sys_DoubleTime() - cls.capturevideo_starttime) * cls.capturevideo_framerate;
+                       newframenum = (int)((Sys_DoubleTime() - cls.capturevideo_starttime) * cls.capturevideo_framerate);
                }
                else
                        newframenum = cls.capturevideo_frame + 1;
@@ -1183,19 +1183,19 @@ void SCR_DrawScreen (void)
 
                if (r_stereo_sidebyside.integer)
                {
-                       r_refdef.width = vid.width * size / 2.5;
-                       r_refdef.height = vid.height * size / 2.5 * (1 - bound(0, r_letterbox.value, 100) / 100);
-                       r_refdef.x = (vid.width - r_refdef.width * 2.5) * 0.5;
-                       r_refdef.y = (vid.height - r_refdef.height)/2;
+                       r_refdef.width = (int)(vid.width * size / 2.5);
+                       r_refdef.height = (int)(vid.height * size / 2.5 * (1 - bound(0, r_letterbox.value, 100) / 100));
+                       r_refdef.x = (int)((vid.width - r_refdef.width * 2.5) * 0.5);
+                       r_refdef.y = (int)((vid.height - r_refdef.height)/2);
                        if (r_stereo_side)
-                               r_refdef.x += r_refdef.width * 1.5;
+                               r_refdef.x += (int)(r_refdef.width * 1.5);
                }
                else
                {
-                       r_refdef.width = vid.width * size;
-                       r_refdef.height = vid.height * size * (1 - bound(0, r_letterbox.value, 100) / 100);
-                       r_refdef.x = (vid.width - r_refdef.width)/2;
-                       r_refdef.y = (vid.height - r_refdef.height)/2;
+                       r_refdef.width = (int)(vid.width * size);
+                       r_refdef.height = (int)(vid.height * size * (1 - bound(0, r_letterbox.value, 100) / 100));
+                       r_refdef.x = (int)((vid.width - r_refdef.width)/2);
+                       r_refdef.y = (int)((vid.height - r_refdef.height)/2);
                }
 
                // LordHavoc: viewzoom (zoom in for sniper rifles, etc)
@@ -1219,9 +1219,9 @@ void SCR_DrawScreen (void)
                {
                        float sizex = bound(10, scr_zoomwindow_viewsizex.value, 100) / 100.0;
                        float sizey = bound(10, scr_zoomwindow_viewsizey.value, 100) / 100.0;
-                       r_refdef.width = vid.width * sizex;
-                       r_refdef.height = vid.height * sizey;
-                       r_refdef.x = (vid.width - r_refdef.width)/2;
+                       r_refdef.width = (int)(vid.width * sizex);
+                       r_refdef.height = (int)(vid.height * sizey);
+                       r_refdef.x = (int)((vid.width - r_refdef.width)/2);
                        r_refdef.y = 0;
 
                        r_refdef.frustum_y = tan(scr_zoomwindow_fov.value * cl.viewzoom * M_PI / 360.0) * (3.0/4.0);
index fabce36..bc226e4 100644 (file)
@@ -189,7 +189,7 @@ static void VideoFrame( clvideo_t *video )
        if( video->state == CLVIDEO_FIRSTFRAME )
                destframe = 0;
        else
-               destframe = (realtime - video->starttime) * video->framerate;
+               destframe = (int)((realtime - video->starttime) * video->framerate);
        if( destframe < 0 )
                destframe = 0;
        if( video->framenum < destframe ) {
index 1b96980..6c12f5e 100644 (file)
--- a/client.h
+++ b/client.h
@@ -699,7 +699,7 @@ typedef struct client_state_s
        // don't change view angle, full screen, etc
        int intermission;
        // latched at intermission start
-       int completed_time;
+       double completed_time;
 
        // the timestamp of the last two messages
        double mtime[2];
@@ -1104,7 +1104,7 @@ int CL_ParticleEffectIndexForName(const char *name);
 const char *CL_ParticleEffectNameForIndex(int i);
 void CL_ParticleEffect(int effectindex, float pcount, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, entity_t *ent, int palettecolor);
 void CL_ParseParticleEffect (void);
-void CL_ParticleCube (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, int gravity, int randomvel);
+void CL_ParticleCube (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, vec_t gravity, vec_t randomvel);
 void CL_ParticleRain (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, int type);
 void CL_EntityParticles (const entity_t *ent);
 void CL_ParticleExplosion (const vec3_t org);
index 7a2613b..72833de 100644 (file)
@@ -219,9 +219,9 @@ void VM_CL_sound (void)
        VM_SAFEPARMCOUNT(5, VM_CL_sound);
 
        entity = PRVM_G_EDICT(OFS_PARM0);
-       channel = PRVM_G_FLOAT(OFS_PARM1);
+       channel = (int)PRVM_G_FLOAT(OFS_PARM1);
        sample = PRVM_G_STRING(OFS_PARM2);
-       volume = PRVM_G_FLOAT(OFS_PARM3)*255;
+       volume = (int)(PRVM_G_FLOAT(OFS_PARM3)*255.0f);
        attenuation = PRVM_G_FLOAT(OFS_PARM4);
 
        if (volume < 0 || volume > 255)
@@ -439,7 +439,7 @@ void VM_CL_lightstyle (void)
 
        VM_SAFEPARMCOUNT(2, VM_CL_lightstyle);
 
-       i = PRVM_G_FLOAT(OFS_PARM0);
+       i = (int)PRVM_G_FLOAT(OFS_PARM0);
        c = PRVM_G_STRING(OFS_PARM1);
        if (i >= cl.max_lightstyle)
                PF_WARNING("VM_CL_lightstyle >= MAX_LIGHTSTYLES\n");
@@ -536,8 +536,8 @@ void VM_CL_particle (void)
 
        org = PRVM_G_VECTOR(OFS_PARM0);
        dir = PRVM_G_VECTOR(OFS_PARM1);
-       color = PRVM_G_FLOAT(OFS_PARM2);
-       count = PRVM_G_FLOAT(OFS_PARM3);
+       color = (int)PRVM_G_FLOAT(OFS_PARM2);
+       count = (int)PRVM_G_FLOAT(OFS_PARM3);
        CL_ParticleEffect(EFFECT_SVC_PARTICLE, count, org, org, dir, dir, NULL, color);
 }
 
@@ -749,7 +749,7 @@ void VM_R_ClearScene (void)
 void VM_R_AddEntities (void)
 {
        VM_SAFEPARMCOUNT(1, VM_R_AddEntities);
-       csqc_drawmask = PRVM_G_FLOAT(OFS_PARM0);
+       csqc_drawmask = (int)PRVM_G_FLOAT(OFS_PARM0);
 }
 
 //#302 void(entity ent) addentity (EXT_CSQC)
@@ -769,31 +769,31 @@ void VM_R_SetView (void)
        if(prog->argc < 2)
                VM_SAFEPARMCOUNT(2, VM_R_SetView);
 
-       c = PRVM_G_FLOAT(OFS_PARM0);
+       c = (int)PRVM_G_FLOAT(OFS_PARM0);
        f = PRVM_G_VECTOR(OFS_PARM1);
        k = PRVM_G_FLOAT(OFS_PARM1);
 
        switch(c)
        {
-       case VF_MIN:                    r_refdef.x = f[0];
-                                                       r_refdef.y = f[1];
+       case VF_MIN:                    r_refdef.x = (int)f[0];
+                                                       r_refdef.y = (int)f[1];
                                                        break;
-       case VF_MIN_X:                  r_refdef.x = k;
+       case VF_MIN_X:                  r_refdef.x = (int)k;
                                                        break;
-       case VF_MIN_Y:                  r_refdef.y = k;
+       case VF_MIN_Y:                  r_refdef.y = (int)k;
                                                        break;
-       case VF_SIZE:                   r_refdef.width = f[0];
-                                                       r_refdef.height = f[1];
+       case VF_SIZE:                   r_refdef.width = (int)f[0];
+                                                       r_refdef.height = (int)f[1];
                                                        break;
-       case VF_SIZE_Y:                 r_refdef.width = k;
+       case VF_SIZE_Y:                 r_refdef.width = (int)k;
                                                        break;
-       case VF_SIZE_X:                 r_refdef.height = k;
+       case VF_SIZE_X:                 r_refdef.height = (int)k;
                                                        break;
-       case VF_VIEWPORT:               r_refdef.x = f[0];
-                                                       r_refdef.y = f[1];
+       case VF_VIEWPORT:               r_refdef.x = (int)f[0];
+                                                       r_refdef.y = (int)f[1];
                                                        f = PRVM_G_VECTOR(OFS_PARM2);
-                                                       r_refdef.width = f[0];
-                                                       r_refdef.height = f[1];
+                                                       r_refdef.width = (int)f[0];
+                                                       r_refdef.height = (int)f[1];
                                                        break;
        case VF_FOV:                    //r_refdef.fov_x = f[0]; // FIXME!
                                                        //r_refdef.fov_y = f[1]; // FIXME!
@@ -915,7 +915,7 @@ void VM_CL_getstatf (void)
                int l;
        }dat;
        VM_SAFEPARMCOUNT(1, VM_CL_getstatf);
-       i = PRVM_G_FLOAT(OFS_PARM0);
+       i = (int)PRVM_G_FLOAT(OFS_PARM0);
        if(i < 0 || i >= MAX_CL_STATS)
        {
                Con_Printf("VM_CL_getstatf: index>=MAX_CL_STATS or index<0\n");
@@ -930,7 +930,7 @@ void VM_CL_getstati (void)
 {
        int i, index;
        VM_SAFEPARMCOUNT(1, VM_CL_getstati);
-       index = PRVM_G_FLOAT(OFS_PARM0);
+       index = (int)PRVM_G_FLOAT(OFS_PARM0);
 
        if(index < 0 || index >= MAX_CL_STATS)
        {
@@ -947,7 +947,7 @@ void VM_CL_getstats (void)
        int i;
        char *t;
        VM_SAFEPARMCOUNT(1, VM_CL_getstats);
-       i = PRVM_G_FLOAT(OFS_PARM0);
+       i = (int)PRVM_G_FLOAT(OFS_PARM0);
        if(i < 0 || i > MAX_CL_STATS-4)
        {
                Con_Printf("VM_CL_getstats: index>MAX_CL_STATS-4 or index<0\n");
@@ -1001,7 +1001,7 @@ void VM_CL_modelnameforindex (void)
        VM_SAFEPARMCOUNT(1, VM_CL_modelnameforindex);
 
        PRVM_G_INT(OFS_RETURN) = 0;
-       i = PRVM_G_FLOAT(OFS_PARM0);
+       i = (int)PRVM_G_FLOAT(OFS_PARM0);
        if(i<0)
        {
                i = -(i+1);
@@ -1079,7 +1079,7 @@ void VM_CL_trailparticles (void)
 
        t = PRVM_G_EDICT(OFS_PARM0);
        entnum  = PRVM_NUM_FOR_EDICT(t);
-       i               = PRVM_G_FLOAT(OFS_PARM1);
+       i               = (int)PRVM_G_FLOAT(OFS_PARM1);
        start   = PRVM_G_VECTOR(OFS_PARM2);
        end             = PRVM_G_VECTOR(OFS_PARM3);
 
@@ -1091,7 +1091,7 @@ void VM_CL_trailparticles (void)
        if (entnum >= cl.max_csqcentities)
                CL_ExpandCSQCEntities(entnum);
 
-       CL_ParticleEffect(i, VectorDistance(start, end), start, end, t->fields.client->velocity, t->fields.client->velocity, &cl.csqcentities[entnum], PRVM_G_FLOAT(OFS_PARM4));
+       CL_ParticleEffect(i, VectorDistance(start, end), start, end, t->fields.client->velocity, t->fields.client->velocity, &cl.csqcentities[entnum], (int)PRVM_G_FLOAT(OFS_PARM4));
 }
 
 //#337 void(float effectnum, vector origin, vector dir, float count) pointparticles (EXT_CSQC)
@@ -1100,10 +1100,10 @@ void VM_CL_pointparticles (void)
        int                     i, n;
        float           *f, *v;
        VM_SAFEPARMCOUNT(4, VM_CL_pointparticles);
-       i = PRVM_G_FLOAT(OFS_PARM0);
+       i = (int)PRVM_G_FLOAT(OFS_PARM0);
        f = PRVM_G_VECTOR(OFS_PARM1);
        v = PRVM_G_VECTOR(OFS_PARM2);
-       n = PRVM_G_FLOAT(OFS_PARM3);
+       n = (int)PRVM_G_FLOAT(OFS_PARM3);
        CL_ParticleEffect(i, n, f, f, v, v, NULL, 0);
 }
 
@@ -1123,7 +1123,7 @@ void VM_CL_getkeybind (void)
        int i;
 
        VM_SAFEPARMCOUNT(1, VM_CL_getkeybind);
-       i = PRVM_G_FLOAT(OFS_PARM0);
+       i = (int)PRVM_G_FLOAT(OFS_PARM0);
        PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(Key_GetBind(i));
 }
 
@@ -1140,7 +1140,7 @@ void VM_CL_getinputstate (void)
 {
        int i, frame;
        VM_SAFEPARMCOUNT(1, VM_CL_getinputstate);
-       frame = PRVM_G_FLOAT(OFS_PARM0);
+       frame = (int)PRVM_G_FLOAT(OFS_PARM0);
        for (i = 0;i < cl.movement_numqueue;i++)
                if (cl.movement_queue[i].sequence == frame)
                {
@@ -1183,7 +1183,7 @@ void VM_CL_getplayerkey (void)
 
        VM_SAFEPARMCOUNT(2, VM_CL_getplayerkey);
 
-       i = PRVM_G_FLOAT(OFS_PARM0);
+       i = (int)PRVM_G_FLOAT(OFS_PARM0);
        c = PRVM_G_STRING(OFS_PARM1);
        PRVM_G_INT(OFS_RETURN) = OFS_NULL;
        Sbar_SortFrags();
@@ -1245,7 +1245,7 @@ void VM_CL_registercmd (void)
        VM_SAFEPARMCOUNT(1, VM_CL_registercmd);
        if(!Cmd_Exists(PRVM_G_STRING(OFS_PARM0)))
        {
-               t = Z_Malloc(strlen(PRVM_G_STRING(OFS_PARM0))+1);
+               t = (char *)Z_Malloc(strlen(PRVM_G_STRING(OFS_PARM0))+1);
                strcpy(t, PRVM_G_STRING(OFS_PARM0));
                Cmd_AddCommand(t, NULL, "console command created by QuakeC");
        }
@@ -1335,7 +1335,7 @@ void VM_CL_ReadFloat (void)
 void VM_CL_effect (void)
 {
        VM_SAFEPARMCOUNT(5, VM_CL_effect);
-       CL_Effect(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_FLOAT(OFS_PARM1), PRVM_G_FLOAT(OFS_PARM2), PRVM_G_FLOAT(OFS_PARM3), PRVM_G_FLOAT(OFS_PARM4));
+       CL_Effect(PRVM_G_VECTOR(OFS_PARM0), (int)PRVM_G_FLOAT(OFS_PARM1), (int)PRVM_G_FLOAT(OFS_PARM2), (int)PRVM_G_FLOAT(OFS_PARM3), PRVM_G_FLOAT(OFS_PARM4));
 }
 
 // #405 void(vector org, vector velocity, float howmany) te_blood (DP_TE_BLOOD)
@@ -1387,21 +1387,21 @@ void VM_CL_te_explosionrgb (void)
 void VM_CL_te_particlecube (void)
 {
        VM_SAFEPARMCOUNT(7, VM_CL_te_particlecube);
-       CL_ParticleCube(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_VECTOR(OFS_PARM1), PRVM_G_VECTOR(OFS_PARM2), PRVM_G_FLOAT(OFS_PARM3), PRVM_G_FLOAT(OFS_PARM4), PRVM_G_FLOAT(OFS_PARM5), PRVM_G_FLOAT(OFS_PARM6));
+       CL_ParticleCube(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_VECTOR(OFS_PARM1), PRVM_G_VECTOR(OFS_PARM2), (int)PRVM_G_FLOAT(OFS_PARM3), (int)PRVM_G_FLOAT(OFS_PARM4), PRVM_G_FLOAT(OFS_PARM5), PRVM_G_FLOAT(OFS_PARM6));
 }
 
 // #409 void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain (DP_TE_PARTICLERAIN)
 void VM_CL_te_particlerain (void)
 {
        VM_SAFEPARMCOUNT(5, VM_CL_te_particlerain);
-       CL_ParticleRain(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_VECTOR(OFS_PARM1), PRVM_G_VECTOR(OFS_PARM2), PRVM_G_FLOAT(OFS_PARM3), PRVM_G_FLOAT(OFS_PARM4), 0);
+       CL_ParticleRain(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_VECTOR(OFS_PARM1), PRVM_G_VECTOR(OFS_PARM2), (int)PRVM_G_FLOAT(OFS_PARM3), (int)PRVM_G_FLOAT(OFS_PARM4), 0);
 }
 
 // #410 void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow (DP_TE_PARTICLESNOW)
 void VM_CL_te_particlesnow (void)
 {
        VM_SAFEPARMCOUNT(5, VM_CL_te_particlesnow);
-       CL_ParticleRain(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_VECTOR(OFS_PARM1), PRVM_G_VECTOR(OFS_PARM2), PRVM_G_FLOAT(OFS_PARM3), PRVM_G_FLOAT(OFS_PARM4), 1);
+       CL_ParticleRain(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_VECTOR(OFS_PARM1), PRVM_G_VECTOR(OFS_PARM2), (int)PRVM_G_FLOAT(OFS_PARM3), (int)PRVM_G_FLOAT(OFS_PARM4), 1);
 }
 
 // #411 void(vector org, vector vel, float howmany) te_spark
@@ -1640,8 +1640,8 @@ void VM_CL_te_explosion2 (void)
        VM_SAFEPARMCOUNT(3, VM_CL_te_explosion2);
 
        pos = PRVM_G_VECTOR(OFS_PARM0);
-       colorStart = PRVM_G_FLOAT(OFS_PARM1);
-       colorLength = PRVM_G_FLOAT(OFS_PARM2);
+       colorStart = (int)PRVM_G_FLOAT(OFS_PARM1);
+       colorLength = (int)PRVM_G_FLOAT(OFS_PARM2);
        CL_FindNonSolidLocation(pos, pos2, 10);
        CL_ParticleExplosion2(pos2, colorStart, colorLength);
        tempcolor = (unsigned char *)&palette_complete[(rand()%colorLength) + colorStart];
@@ -1740,14 +1740,14 @@ void VM_CL_te_plasmaburn (void)
 //====================================================================
 //DP_QC_GETSURFACE
 
-void clippointtosurface(msurface_t *surface, vec3_t p, vec3_t out);
+extern void clippointtosurface(model_t *model, msurface_t *surface, vec3_t p, vec3_t out);
 static model_t *cl_getmodel(prvm_edict_t *ed)
 {
        int modelindex;
        model_t *model = NULL;
        if (!ed || ed->priv.server->free)
                return NULL;
-       modelindex = ed->fields.client->modelindex;
+       modelindex = (int)ed->fields.client->modelindex;
        if(!modelindex)
                return NULL;
        if(modelindex<0)
@@ -1777,7 +1777,7 @@ void VM_CL_getsurfacenumpoints(void)
        model_t *model = cl_getmodel(PRVM_G_EDICT(OFS_PARM0));
        msurface_t *surface;
        // return 0 if no such surface
-       if (!model || !(surface = cl_getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+       if (!model || !(surface = cl_getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
        {
                PRVM_G_FLOAT(OFS_RETURN) = 0;
                return;
@@ -1796,10 +1796,10 @@ void VM_CL_getsurfacepoint(void)
        int pointnum;
        VectorClear(PRVM_G_VECTOR(OFS_RETURN));
        ed = PRVM_G_EDICT(OFS_PARM0);
-       if (!(model = cl_getmodel(ed)) || !(surface = cl_getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+       if (!(model = cl_getmodel(ed)) || !(surface = cl_getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
                return;
        // note: this (incorrectly) assumes it is a simple polygon
-       pointnum = PRVM_G_FLOAT(OFS_PARM2);
+       pointnum = (int)PRVM_G_FLOAT(OFS_PARM2);
        if (pointnum < 0 || pointnum >= surface->num_vertices)
                return;
        // FIXME: implement rotation/scaling
@@ -1813,7 +1813,7 @@ void VM_CL_getsurfacenormal(void)
        msurface_t *surface;
        vec3_t normal;
        VectorClear(PRVM_G_VECTOR(OFS_RETURN));
-       if (!(model = cl_getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = cl_getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+       if (!(model = cl_getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = cl_getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
                return;
        // FIXME: implement rotation/scaling
        // note: this (incorrectly) assumes it is a simple polygon
@@ -1830,7 +1830,7 @@ void VM_CL_getsurfacetexture(void)
        model_t *model;
        msurface_t *surface;
        PRVM_G_INT(OFS_RETURN) = 0;
-       if (!(model = cl_getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = cl_getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+       if (!(model = cl_getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = cl_getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
                return;
        PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(surface->texture->name);
 }
@@ -1866,7 +1866,7 @@ void VM_CL_getsurfacenearpoint(void)
                if (dist < bestdist)
                {
                        // it is, check the nearest point on the actual geometry
-                       clippointtosurface(surface, p, clipped);
+                       clippointtosurface(model, surface, p, clipped);
                        VectorSubtract(clipped, p, clipped);
                        dist += VectorLength2(clipped);
                        if (dist < bestdist)
@@ -1889,11 +1889,11 @@ void VM_CL_getsurfaceclippedpoint(void)
        vec3_t p, out;
        VectorClear(PRVM_G_VECTOR(OFS_RETURN));
        ed = PRVM_G_EDICT(OFS_PARM0);
-       if (!(model = cl_getmodel(ed)) || !(surface = cl_getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+       if (!(model = cl_getmodel(ed)) || !(surface = cl_getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
                return;
        // FIXME: implement rotation/scaling
        VectorSubtract(PRVM_G_VECTOR(OFS_PARM2), ed->fields.client->origin, p);
-       clippointtosurface(surface, p, out);
+       clippointtosurface(model, surface, p, out);
        // FIXME: implement rotation/scaling
        VectorAdd(out, ed->fields.client->origin, PRVM_G_VECTOR(OFS_RETURN));
 }
@@ -1943,7 +1943,7 @@ void VM_CL_setattachment (void)
 
                if (model)
                {
-                       v->_float = Mod_Alias_GetTagIndexForName(model, tagentity->fields.client->skin, tagname);
+                       v->_float = Mod_Alias_GetTagIndexForName(model, (int)tagentity->fields.client->skin, tagname);
                        if (v->_float == 0)
                                Con_DPrintf("setattachment(edict %i, edict %i, string \"%s\"): tried to find tag named \"%s\" on entity %i (model \"%s\") but could not find it\n", PRVM_NUM_FOR_EDICT(e), PRVM_NUM_FOR_EDICT(tagentity), tagname, tagname, PRVM_NUM_FOR_EDICT(tagentity), model->name);
                }
@@ -1960,7 +1960,7 @@ int CL_GetTagIndex (prvm_edict_t *e, const char *tagname)
        int i;
        model_t *m;
 
-       i = e->fields.client->modelindex;
+       i = (int)e->fields.client->modelindex;
 
        if(!i)
                return -1;
@@ -1977,7 +1977,7 @@ int CL_GetTagIndex (prvm_edict_t *e, const char *tagname)
                else
                        m = cl.model_precache[i];
 
-       return Mod_Alias_GetTagIndexForName(m, e->fields.client->skin, tagname);
+       return Mod_Alias_GetTagIndexForName(m, (int)e->fields.client->skin, tagname);
 };
 
 // Warnings/errors code:
@@ -2046,7 +2046,7 @@ int CL_GetTagMatrix (matrix4x4_t *out, prvm_edict_t *ent, int tagindex)
                        val = PRVM_GETEDICTFIELDVALUE(ent, csqc_fieldoff_tag_index);
 
                        model = NULL;
-                       i = attachent->fields.client->modelindex;
+                       i = (int)attachent->fields.client->modelindex;
                        if(i<0)
                        {
                                i = -(i+1);
@@ -2058,7 +2058,7 @@ int CL_GetTagMatrix (matrix4x4_t *out, prvm_edict_t *ent, int tagindex)
                                        model = cl.model_precache[i];
 
                        if (model && val->_float >= 1 && model->animscenes && attachent->fields.client->frame >= 0 && attachent->fields.client->frame < model->numframes)
-                               Mod_Alias_GetTagMatrix(model, model->animscenes[(int)attachent->fields.client->frame].firstframe, val->_float - 1, &attachmatrix);
+                               Mod_Alias_GetTagMatrix(model, model->animscenes[(int)attachent->fields.client->frame].firstframe, (int)val->_float - 1, &attachmatrix);
                        else
                                attachmatrix = identitymatrix;
 
@@ -2347,8 +2347,8 @@ void VM_CL_selecttraceline (void)
 
        v1 = PRVM_G_VECTOR(OFS_PARM0);
        v2 = PRVM_G_VECTOR(OFS_PARM1);
-       ignore = PRVM_G_FLOAT(OFS_PARM2);
-       csqcents = PRVM_G_FLOAT(OFS_PARM3);
+       ignore = (int)PRVM_G_FLOAT(OFS_PARM2);
+       csqcents = (int)PRVM_G_FLOAT(OFS_PARM3);
        ent = 0;
 
        if((csqcents && ignore > cl.num_csqcentities) || (!csqcents && ignore > cl.num_entities))
index a54d46d..80e1446 100644 (file)
--- a/console.c
+++ b/console.c
@@ -888,7 +888,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer
                return false;
        if (t->numfilenames > 1)
                Con_Printf("^1 %i maps found :\n", t->numfilenames);
-       len = Z_Malloc(t->numfilenames);
+       len = (unsigned char *)Z_Malloc(t->numfilenames);
        min = 666;
        for(max=i=0;i<t->numfilenames;i++)
        {
@@ -956,7 +956,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer
                        if (!entities && lumplen >= 10)
                        {
                                FS_Seek(f, lumpofs, SEEK_SET);
-                               entities = Z_Malloc(lumplen + 1);
+                               entities = (char *)Z_Malloc(lumplen + 1);
                                FS_Read(f, entities, lumplen);
                        }
                        if (entities)
index 2a63907..c32db94 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -92,7 +92,7 @@ static void CL_VM_FindEdictFieldOffsets (void)
 
        if(CSQC_Parse_Print)
        {
-               csqc_printtextbuf = Mem_Alloc(csqc_mempool, CSQC_PRINTBUFFERLEN);
+               csqc_printtextbuf = (char *)Mem_Alloc(csqc_mempool, CSQC_PRINTBUFFERLEN);
                csqc_printtextbuf[0] = 0;
        }
 }
@@ -172,7 +172,7 @@ static qboolean CSQC_EdictToEntity (prvm_edict_t *ed, entity_t *e)
        int i;
        prvm_eval_t *val;
 
-       i = ed->fields.client->modelindex;
+       i = (int)ed->fields.client->modelindex;
        e->state_current.modelindex = 0;
        if(i >= MAX_MODELS || i <= -MAX_MODELS) //[515]: make work as error ?
        {
@@ -189,7 +189,7 @@ static qboolean CSQC_EdictToEntity (prvm_edict_t *ed, entity_t *e)
        i = 0;
        if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_renderflags)) && val->_float)
        {
-               i = val->_float;
+               i = (int)val->_float;
                if(i & RF_VIEWMODEL)    e->state_current.flags |= RENDER_VIEWMODEL;
                if(i & RF_EXTERNALMODEL)e->state_current.flags |= RENDER_EXTERIORMODEL;
                if(i & RF_DEPTHHACK)    e->state_current.effects |= EF_NODEPTHTEST;
@@ -203,20 +203,20 @@ static qboolean CSQC_EdictToEntity (prvm_edict_t *ed, entity_t *e)
 
        VectorCopy(ed->fields.client->origin, e->persistent.neworigin);
        VectorCopy(ed->fields.client->origin, e->state_current.origin);
-       e->state_current.colormap = ed->fields.client->colormap;
-       e->state_current.effects = ed->fields.client->effects;
-       e->state_current.frame = ed->fields.client->frame;
-       e->state_current.skin = ed->fields.client->skin;
-
-       if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_alpha)) && val->_float)             e->state_current.alpha = val->_float*255;
-       if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_scale)) && val->_float)             e->state_current.scale = val->_float*16;
-       if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_colormod)) && VectorLength2(val->vector))   VectorScale(val->vector, 32, e->state_current.colormod);
-       if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_effects)) && val->_float)   e->state_current.effects = val->_float;
+       e->state_current.colormap = (int)ed->fields.client->colormap;
+       e->state_current.effects = (int)ed->fields.client->effects;
+       e->state_current.frame = (int)ed->fields.client->frame;
+       e->state_current.skin = (int)ed->fields.client->skin;
+
+       if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_alpha)) && val->_float)             e->state_current.alpha = (int)(val->_float*255);
+       if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_scale)) && val->_float)             e->state_current.scale = (int)(val->_float*16);
+       if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_colormod)) && VectorLength2(val->vector))   {int j;for (j = 0;j < 3;j++) e->state_current.colormod[j] = (unsigned char)bound(0, val->vector[j] * 32.0f, 255);}
+       if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_effects)) && val->_float)   e->state_current.effects = (int)val->_float;
        if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_tag_entity)) && val->edict)
        {
                e->state_current.tagentity = val->edict;
                if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_tag_index)) && val->_float)
-                       e->state_current.tagindex = val->_float;
+                       e->state_current.tagindex = (int)val->_float;
        }
 
        return true;
@@ -575,7 +575,7 @@ void CL_VM_Init (void)
        PRVM_End;
        csqc_loaded = true;
 
-       csqc_sv2csqcents = Mem_Alloc(csqc_mempool, MAX_EDICTS*sizeof(unsigned short));
+       csqc_sv2csqcents = (unsigned short *)Mem_Alloc(csqc_mempool, MAX_EDICTS*sizeof(unsigned short));
        memset(csqc_sv2csqcents, 0, MAX_EDICTS*sizeof(unsigned short));
 
        cl.csqc_vidvars.drawcrosshair = false;
index c32162a..aa1f23c 100644 (file)
@@ -379,7 +379,7 @@ typedef struct gltextureunit_s
        int arrayenabled;
        unsigned int arraycomponents;
        const void *pointer_texcoord;
-       float rgbscale, alphascale;
+       int rgbscale, alphascale;
        int combinergb, combinealpha;
        // FIXME: add more combine stuff
        // texmatrixenabled exists only to avoid unnecessary texmatrix compares
index a4d4425..d4339ca 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -908,7 +908,7 @@ void DrawQ_SetClipArea(float x, float y, float width, float height)
 
        // We have to convert the con coords into real coords
        // OGL uses top to bottom
-       GL_Scissor(x * ((float)vid.width / vid_conwidth.integer), y * ((float) vid.height / vid_conheight.integer), width * ((float)vid.width / vid_conwidth.integer), height * ((float)vid.height / vid_conheight.integer));
+       GL_Scissor((int)(x * ((float)vid.width / vid_conwidth.integer)), (int)(y * ((float) vid.height / vid_conheight.integer)), (int)(width * ((float)vid.width / vid_conwidth.integer)), (int)(height * ((float)vid.height / vid_conheight.integer)));
 
        GL_ScissorTest(true);
 }
index c9f1f0a..e6cd203 100644 (file)
@@ -370,9 +370,9 @@ static void R_BuildNormalizationCube(void)
                                        break;
                                }
                                intensity = 127.0f / sqrt(DotProduct(v, v));
-                               data[side][y][x][0] = 128.0f + intensity * v[0];
-                               data[side][y][x][1] = 128.0f + intensity * v[1];
-                               data[side][y][x][2] = 128.0f + intensity * v[2];
+                               data[side][y][x][0] = (unsigned char)(128.0f + intensity * v[0]);
+                               data[side][y][x][1] = (unsigned char)(128.0f + intensity * v[1]);
+                               data[side][y][x][2] = (unsigned char)(128.0f + intensity * v[2]);
                                data[side][y][x][3] = 255;
                        }
                }
@@ -2443,7 +2443,7 @@ void R_Mesh_ResizeArrays(int newvertices)
        if (rsurface_array_vertex3f)
                Mem_Free(rsurface_array_vertex3f);
        rsurface_array_size = (newvertices + 1023) & ~1023;
-       rsurface_array_vertex3f = Mem_Alloc(r_main_mempool, rsurface_array_size * sizeof(float[19]));
+       rsurface_array_vertex3f = (float *)Mem_Alloc(r_main_mempool, rsurface_array_size * sizeof(float[19]));
        rsurface_array_svector3f = rsurface_array_vertex3f + rsurface_array_size * 3;
        rsurface_array_tvector3f = rsurface_array_vertex3f + rsurface_array_size * 6;
        rsurface_array_normal3f = rsurface_array_vertex3f + rsurface_array_size * 9;
index fd81071..e90680c 100644 (file)
@@ -218,12 +218,12 @@ loc0:
                        smax = (surface->lightmapinfo->extents[0] >> 4) + 1;
                        tmax = (surface->lightmapinfo->extents[1] >> 4) + 1;
 
-                       impacts = DotProduct (impact, surface->lightmapinfo->texinfo->vecs[0]) + surface->lightmapinfo->texinfo->vecs[0][3] - surface->lightmapinfo->texturemins[0];
-                       impactt = DotProduct (impact, surface->lightmapinfo->texinfo->vecs[1]) + surface->lightmapinfo->texinfo->vecs[1][3] - surface->lightmapinfo->texturemins[1];
+                       impacts = (int)(DotProduct (impact, surface->lightmapinfo->texinfo->vecs[0]) + surface->lightmapinfo->texinfo->vecs[0][3] - surface->lightmapinfo->texturemins[0]);
+                       impactt = (int)(DotProduct (impact, surface->lightmapinfo->texinfo->vecs[1]) + surface->lightmapinfo->texinfo->vecs[1][3] - surface->lightmapinfo->texturemins[1]);
 
                        s = bound(0, impacts, smax * 16) - impacts;
                        t = bound(0, impactt, tmax * 16) - impactt;
-                       i = s * s + t * t + dist2;
+                       i = (int)(s * s + t * t + dist2);
                        if (i > maxdist)
                                continue;
 
diff --git a/host.c b/host.c
index 7e281db..9d7c558 100644 (file)
--- a/host.c
+++ b/host.c
@@ -802,10 +802,10 @@ void _Host_Frame (float time)
 
        if (host_speeds.integer)
        {
-               pass1 = (time1 - time3)*1000000;
+               pass1 = (int)((time1 - time3)*1000000);
                time3 = Sys_DoubleTime();
-               pass2 = (time2 - time1)*1000000;
-               pass3 = (time3 - time2)*1000000;
+               pass2 = (int)((time2 - time1)*1000000);
+               pass3 = (int)((time3 - time2)*1000000);
                Con_Printf("%6ius total %6ius server %6ius gfx %6ius snd\n",
                                        pass1+pass2+pass3, pass1, pass2, pass3);
        }
@@ -836,7 +836,7 @@ void Host_Frame (float time)
        if (timecount < 1000)
                return;
 
-       m = timetotal*1000/timecount;
+       m = (int)(timetotal*1000/timecount);
        timecount = 0;
        timetotal = 0;
        c = 0;
index 01ab257..458ad9d 100644 (file)
@@ -1424,19 +1424,19 @@ void Host_Spawn_f (void)
        // send some stats
        MSG_WriteByte (&host_client->netconnection->message, svc_updatestat);
        MSG_WriteByte (&host_client->netconnection->message, STAT_TOTALSECRETS);
-       MSG_WriteLong (&host_client->netconnection->message, prog->globals.server->total_secrets);
+       MSG_WriteLong (&host_client->netconnection->message, (int)prog->globals.server->total_secrets);
 
        MSG_WriteByte (&host_client->netconnection->message, svc_updatestat);
        MSG_WriteByte (&host_client->netconnection->message, STAT_TOTALMONSTERS);
-       MSG_WriteLong (&host_client->netconnection->message, prog->globals.server->total_monsters);
+       MSG_WriteLong (&host_client->netconnection->message, (int)prog->globals.server->total_monsters);
 
        MSG_WriteByte (&host_client->netconnection->message, svc_updatestat);
        MSG_WriteByte (&host_client->netconnection->message, STAT_SECRETS);
-       MSG_WriteLong (&host_client->netconnection->message, prog->globals.server->found_secrets);
+       MSG_WriteLong (&host_client->netconnection->message, (int)prog->globals.server->found_secrets);
 
        MSG_WriteByte (&host_client->netconnection->message, svc_updatestat);
        MSG_WriteByte (&host_client->netconnection->message, STAT_MONSTERS);
-       MSG_WriteLong (&host_client->netconnection->message, prog->globals.server->killed_monsters);
+       MSG_WriteLong (&host_client->netconnection->message, (int)prog->globals.server->killed_monsters);
 
        // send a fixangle
        // Never send a roll angle, because savegames can catch the server
@@ -1507,7 +1507,7 @@ void Host_Kick_f (void)
 
        if (Cmd_Argc() > 2 && strcmp(Cmd_Argv(1), "#") == 0)
        {
-               i = atof(Cmd_Argv(2)) - 1;
+               i = (int)(atof(Cmd_Argv(2)) - 1);
                if (i < 0 || i >= svs.maxclients || !(host_client = svs.clients + i)->active)
                        return;
                byNumber = true;
@@ -1835,7 +1835,7 @@ void Host_Viewnext_f (void)
        if (e->fields.server->frame >= m->numframes)
                e->fields.server->frame = m->numframes - 1;
 
-       PrintFrameName (m, e->fields.server->frame);
+       PrintFrameName (m, (int)e->fields.server->frame);
 }
 
 /*
@@ -1863,7 +1863,7 @@ void Host_Viewprev_f (void)
        if (e->fields.server->frame < 0)
                e->fields.server->frame = 0;
 
-       PrintFrameName (m, e->fields.server->frame);
+       PrintFrameName (m, (int)e->fields.server->frame);
 }
 
 /*
diff --git a/image.c b/image.c
index 3fa3f3b..fbfe91d 100644 (file)
--- a/image.c
+++ b/image.c
@@ -1403,9 +1403,9 @@ void Image_HeightmapToNormalmap(const unsigned char *inpixels, unsigned char *ou
                        n[2] = ibumpscale;
                        VectorNormalize(n);
                        */
-                       out[0] = 128.0f + n[0] * 127.0f;
-                       out[1] = 128.0f + n[1] * 127.0f;
-                       out[2] = 128.0f + n[2] * 127.0f;
+                       out[0] = (int)(128.0f + n[0] * 127.0f);
+                       out[1] = (int)(128.0f + n[1] * 127.0f);
+                       out[2] = (int)(128.0f + n[2] * 127.0f);
                        out[3] = (p0[0] + p0[1] + p0[2]) / 3;
                        out += 4;
                }
index 2adb961..94a2bd8 100644 (file)
@@ -170,7 +170,7 @@ void PNG_CloseLibrary (void)
 #define PNG_INFO_tRNS 0x0010
 
 // this struct is only used for status information during loading
-struct
+static struct
 {
        const unsigned char     *tmpBuf;
        int             tmpBuflength;
@@ -243,13 +243,17 @@ unsigned char *PNG_LoadImage (const unsigned char *raw, int filesize, int matchw
 
        if(qpng_sig_cmp(raw, 0, filesize))
                return NULL;
-       png = qpng_create_read_struct(PNG_LIBPNG_VER_STRING, 0, PNG_error_fn, PNG_warning_fn);
+       png = (void *)qpng_create_read_struct(PNG_LIBPNG_VER_STRING, 0, (void *)PNG_error_fn, (void *)PNG_warning_fn);
        if(!png)
                return NULL;
 
        // NOTE: this relies on jmp_buf being the first thing in the png structure
        // created by libpng! (this is correct for libpng 1.2.x)
+#ifdef __cplusplus
+       if (setjmp((__jmp_buf_tag *)png))
+#else
        if (setjmp(png))
+#endif
        {
                qpng_destroy_read_struct(&png, &pnginfo, 0);
                return NULL;
@@ -276,7 +280,7 @@ unsigned char *PNG_LoadImage (const unsigned char *raw, int filesize, int matchw
        //my_png.Interlace      = 0;
        //my_png.Compression    = 0;
        //my_png.Filter         = 0;
-       qpng_set_read_fn(png, ioBuffer, PNG_fReadData);
+       qpng_set_read_fn(png, ioBuffer, (void *)PNG_fReadData);
        qpng_read_info(png, pnginfo);
        qpng_get_IHDR(png, pnginfo, &my_png.Width, &my_png.Height,&my_png.BitDepth, &my_png.ColorType, &my_png.Interlace, &my_png.Compression, &my_png.Filter);
        if ((matchwidth && my_png.Width != (unsigned int)matchwidth) || (matchheight && my_png.Height != (unsigned int)matchheight))
@@ -307,10 +311,10 @@ unsigned char *PNG_LoadImage (const unsigned char *raw, int filesize, int matchw
        my_png.FRowBytes = qpng_get_rowbytes(png, pnginfo);
        my_png.BytesPerPixel = qpng_get_channels(png, pnginfo);
 
-       my_png.FRowPtrs = Mem_Alloc(tempmempool, my_png.Height * sizeof(*my_png.FRowPtrs));
+       my_png.FRowPtrs = (unsigned char **)Mem_Alloc(tempmempool, my_png.Height * sizeof(*my_png.FRowPtrs));
        if (my_png.FRowPtrs)
        {
-               my_png.Data = Mem_Alloc(tempmempool, my_png.Height * my_png.FRowBytes);
+               my_png.Data = (unsigned char *)Mem_Alloc(tempmempool, my_png.Height * my_png.FRowBytes);
                if(my_png.Data)
                {
                        for(y = 0;y < my_png.Height;y++)
diff --git a/jpeg.c b/jpeg.c
index ebdab17..c85c90a 100644 (file)
--- a/jpeg.c
+++ b/jpeg.c
@@ -692,7 +692,7 @@ qboolean JPEG_SaveImage_preflipped (const char *filename, int width, int height,
        cinfo.in_color_space = JCS_RGB;
        cinfo.input_components = 3;
        qjpeg_set_defaults (&cinfo);
-       qjpeg_set_quality (&cinfo, scr_screenshot_jpeg_quality.value * 100, TRUE);
+       qjpeg_set_quality (&cinfo, (int)(scr_screenshot_jpeg_quality.value * 100), TRUE);
        qjpeg_start_compress (&cinfo, true);
 
        // Compress each scanline
diff --git a/keys.c b/keys.c
index bec44c4..340a3c3 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -283,7 +283,7 @@ Key_Console (int key, char ascii)
                                strcat(key_lines[edit_line], cbd);
                                key_linepos += i;
                        }
-                       free(cbd);
+                       Z_Free(cbd);
                }
                return;
        }
diff --git a/menu.c b/menu.c
index 4467e66..46ca530 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -1686,7 +1686,7 @@ static void M_Options_Draw (void)
 
        optnum = 0;
        optcursor = options_cursor;
-       visible = (menu_height - 32) / 8;
+       visible = (int)((menu_height - 32) / 8);
        opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_ITEMS - visible)) * 8;
 
        M_Options_PrintCommand( "Customize controls", true);
@@ -1881,7 +1881,7 @@ static void M_Options_Effects_Draw (void)
 
        optcursor = options_effects_cursor;
        optnum = 0;
-       visible = (menu_height - 32) / 8;
+       visible = (int)((menu_height - 32) / 8);
        opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_EFFECTS_ITEMS - visible)) * 8;
 
        M_Options_PrintSlider(  "      Corona Intensity", true, r_coronas.value, 0, 4);
@@ -2021,7 +2021,7 @@ static void M_Options_Graphics_Draw (void)
 
        optcursor = options_graphics_cursor;
        optnum = 0;
-       visible = (menu_height - 32) / 8;
+       visible = (int)((menu_height - 32) / 8);
        opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_GRAPHICS_ITEMS - visible)) * 8;
 
        M_Options_PrintSlider(  "             Gloss Mode", true, r_shadow_gloss.integer, 0, 2);
@@ -2208,7 +2208,7 @@ static void M_Options_ColorControl_Draw (void)
 
        optcursor = options_colorcontrol_cursor;
        optnum = 0;
-       visible = (menu_height - 32) / 8;
+       visible = (int)((menu_height - 32) / 8);
        opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_COLORCONTROL_ITEMS - visible)) * 8;
 
        M_Options_PrintCommand( "     Reset to defaults", true);
@@ -4335,7 +4335,7 @@ static void M_ServerList_Draw (void)
        if (*m_return_reason)
                M_Print(16, menu_height - 8, m_return_reason);
        y = 48;
-       visible = (menu_height - 16 - y) / 8 / 2;
+       visible = (int)((menu_height - 16 - y) / 8 / 2);
        start = bound(0, slist_cursor - (visible >> 1), serverlist_viewcount - visible);
        end = min(start + visible, serverlist_viewcount);
 
index b5d2919..663b19f 100644 (file)
@@ -218,7 +218,7 @@ static void Mod_MDLMD2MD3_TraceBox(model_t *model, int frame, trace_t *trace, co
                if (vertex3f)
                        Z_Free(vertex3f);
                maxvertices = (model->surfmesh.num_vertices + 255) & ~255;
-               vertex3f = Z_Malloc(maxvertices * sizeof(float[3]));
+               vertex3f = (float *)Z_Malloc(maxvertices * sizeof(float[3]));
        }
        if (VectorLength2(boxmins) + VectorLength2(boxmaxs) == 0)
        {
@@ -259,7 +259,7 @@ static void Mod_MDLMD2MD3_TraceBox(model_t *model, int frame, trace_t *trace, co
                                if (vertex3f)
                                        Z_Free(vertex3f);
                                maxvertices = (model->surfmesh.num_vertices + 255) & ~255;
-                               vertex3f = Z_Malloc(maxvertices * sizeof(float[3]));
+                               vertex3f = (float *)Z_Malloc(maxvertices * sizeof(float[3]));
                        }
                        Mod_Alias_GetMesh_Vertex3f(model, frameblend, vertex3f);
                        Collision_TraceBrushTriangleMeshFloat(trace, thisbrush_start, thisbrush_end, model->surfmesh.num_triangles, model->surfmesh.data_element3i, vertex3f, SUPERCONTENTS_SOLID, 0, surface->texture, segmentmins, segmentmaxs);
index bc788a3..440c412 100644 (file)
@@ -971,9 +971,9 @@ void Collision_ClipTrace_Box(trace_t *trace, const vec3_t cmins, const vec3_t cm
 
 static int Mod_Q1BSP_LightPoint_RecursiveBSPNode(model_t *model, vec3_t ambientcolor, vec3_t diffusecolor, vec3_t diffusenormal, const mnode_t *node, float x, float y, float startz, float endz)
 {
-       int side, distz = endz - startz;
+       int side;
        float front, back;
-       float mid;
+       float mid, distz = endz - startz;
 
 loc0:
        if (!node->plane)
@@ -4996,12 +4996,12 @@ static void Mod_Q3BSP_LoadLightGrid(lump_t *l)
        loadmodel->brushq3.num_lightgrid_scale[0] = 1.0f / loadmodel->brushq3.num_lightgrid_cellsize[0];
        loadmodel->brushq3.num_lightgrid_scale[1] = 1.0f / loadmodel->brushq3.num_lightgrid_cellsize[1];
        loadmodel->brushq3.num_lightgrid_scale[2] = 1.0f / loadmodel->brushq3.num_lightgrid_cellsize[2];
-       loadmodel->brushq3.num_lightgrid_imins[0] = ceil(loadmodel->brushq3.data_models->mins[0] * loadmodel->brushq3.num_lightgrid_scale[0]);
-       loadmodel->brushq3.num_lightgrid_imins[1] = ceil(loadmodel->brushq3.data_models->mins[1] * loadmodel->brushq3.num_lightgrid_scale[1]);
-       loadmodel->brushq3.num_lightgrid_imins[2] = ceil(loadmodel->brushq3.data_models->mins[2] * loadmodel->brushq3.num_lightgrid_scale[2]);
-       loadmodel->brushq3.num_lightgrid_imaxs[0] = floor(loadmodel->brushq3.data_models->maxs[0] * loadmodel->brushq3.num_lightgrid_scale[0]);
-       loadmodel->brushq3.num_lightgrid_imaxs[1] = floor(loadmodel->brushq3.data_models->maxs[1] * loadmodel->brushq3.num_lightgrid_scale[1]);
-       loadmodel->brushq3.num_lightgrid_imaxs[2] = floor(loadmodel->brushq3.data_models->maxs[2] * loadmodel->brushq3.num_lightgrid_scale[2]);
+       loadmodel->brushq3.num_lightgrid_imins[0] = (int)ceil(loadmodel->brushq3.data_models->mins[0] * loadmodel->brushq3.num_lightgrid_scale[0]);
+       loadmodel->brushq3.num_lightgrid_imins[1] = (int)ceil(loadmodel->brushq3.data_models->mins[1] * loadmodel->brushq3.num_lightgrid_scale[1]);
+       loadmodel->brushq3.num_lightgrid_imins[2] = (int)ceil(loadmodel->brushq3.data_models->mins[2] * loadmodel->brushq3.num_lightgrid_scale[2]);
+       loadmodel->brushq3.num_lightgrid_imaxs[0] = (int)floor(loadmodel->brushq3.data_models->maxs[0] * loadmodel->brushq3.num_lightgrid_scale[0]);
+       loadmodel->brushq3.num_lightgrid_imaxs[1] = (int)floor(loadmodel->brushq3.data_models->maxs[1] * loadmodel->brushq3.num_lightgrid_scale[1]);
+       loadmodel->brushq3.num_lightgrid_imaxs[2] = (int)floor(loadmodel->brushq3.data_models->maxs[2] * loadmodel->brushq3.num_lightgrid_scale[2]);
        loadmodel->brushq3.num_lightgrid_isize[0] = loadmodel->brushq3.num_lightgrid_imaxs[0] - loadmodel->brushq3.num_lightgrid_imins[0] + 1;
        loadmodel->brushq3.num_lightgrid_isize[1] = loadmodel->brushq3.num_lightgrid_imaxs[1] - loadmodel->brushq3.num_lightgrid_imins[1] + 1;
        loadmodel->brushq3.num_lightgrid_isize[2] = loadmodel->brushq3.num_lightgrid_imaxs[2] - loadmodel->brushq3.num_lightgrid_imins[2] + 1;
index 841346b..92f7ea5 100644 (file)
@@ -1044,7 +1044,7 @@ int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, const char *basename, int
                                        break;
                        if (i < width * height * 4)
                        {
-                               unsigned char *fogpixels = Mem_Alloc(loadmodel->mempool, width * height * 4);
+                               unsigned char *fogpixels = (unsigned char *)Mem_Alloc(loadmodel->mempool, width * height * 4);
                                memcpy(fogpixels, skindata, width * height * 4);
                                for (i = 0;i < width * height * 4;i += 4)
                                        fogpixels[i] = fogpixels[i+1] = fogpixels[i+2] = 255;
index 13b0798..e833271 100644 (file)
@@ -146,8 +146,8 @@ static void Mod_Sprite_SharedSetup(const unsigned char *datapointer, int version
                        loadmodel->sprite.sprdata_frames[realframes].up = origin[1];
                        loadmodel->sprite.sprdata_frames[realframes].down = origin[1] - height;
 
-                       x = max(loadmodel->sprite.sprdata_frames[realframes].left * loadmodel->sprite.sprdata_frames[realframes].left, loadmodel->sprite.sprdata_frames[realframes].right * loadmodel->sprite.sprdata_frames[realframes].right);
-                       y = max(loadmodel->sprite.sprdata_frames[realframes].up * loadmodel->sprite.sprdata_frames[realframes].up, loadmodel->sprite.sprdata_frames[realframes].down * loadmodel->sprite.sprdata_frames[realframes].down);
+                       x = (int)max(loadmodel->sprite.sprdata_frames[realframes].left * loadmodel->sprite.sprdata_frames[realframes].left, loadmodel->sprite.sprdata_frames[realframes].right * loadmodel->sprite.sprdata_frames[realframes].right);
+                       y = (int)max(loadmodel->sprite.sprdata_frames[realframes].up * loadmodel->sprite.sprdata_frames[realframes].up, loadmodel->sprite.sprdata_frames[realframes].down * loadmodel->sprite.sprdata_frames[realframes].down);
                        if (modelradius < x + y)
                                modelradius = x + y;
 
@@ -374,8 +374,8 @@ void Mod_IDS2_Load(model_t *mod, void *buffer, void *bufferend)
                sprframe->up = origin[1];
                sprframe->down = origin[1] - height;
 
-               x = max(sprframe->left * sprframe->left, sprframe->right * sprframe->right);
-               y = max(sprframe->up * sprframe->up, sprframe->down * sprframe->down);
+               x = (int)max(sprframe->left * sprframe->left, sprframe->right * sprframe->right);
+               y = (int)max(sprframe->up * sprframe->up, sprframe->down * sprframe->down);
                if (modelradius < x + y)
                        modelradius = x + y;
 
index 939127e..0cd14d7 100644 (file)
@@ -246,7 +246,7 @@ void VM_M_writetofile(void)
 
        VM_SAFEPARMCOUNT(2, VM_M_writetofile);
 
-       file = VM_GetFileHandle( PRVM_G_FLOAT(OFS_PARM0) );
+       file = VM_GetFileHandle( (int)PRVM_G_FLOAT(OFS_PARM0) );
        if( !file ) {
                return;
        }
@@ -274,7 +274,7 @@ void VM_M_getresolution(void)
        int nr;
        VM_SAFEPARMCOUNT(1, VM_getresolution);
 
-       nr = PRVM_G_FLOAT(OFS_PARM0);
+       nr = (int)PRVM_G_FLOAT(OFS_PARM0);
 
 
        PRVM_G_VECTOR(OFS_RETURN)[0] = video_resolutions[nr][0];
@@ -342,7 +342,7 @@ void VM_M_getserverliststat( void )
 
        PRVM_G_FLOAT( OFS_RETURN ) = 0;
 
-       type = PRVM_G_FLOAT( OFS_PARM0 );
+       type = (int)PRVM_G_FLOAT( OFS_PARM0 );
        switch(type)
        {
        case 0:
@@ -407,7 +407,7 @@ void VM_M_setserverlistmaskstring( void )
        if( !str )
                PRVM_ERROR( "VM_M_setserverlistmaskstring: null string passed!" );
 
-       masknr = PRVM_G_FLOAT( OFS_PARM0 );
+       masknr = (int)PRVM_G_FLOAT( OFS_PARM0 );
        if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
                mask = &serverlist_andmasks[masknr];
        else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
@@ -462,7 +462,7 @@ void VM_M_setserverlistmasknumber( void )
        int field;
        VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmasknumber );
 
-       masknr = PRVM_G_FLOAT( OFS_PARM0 );
+       masknr = (int)PRVM_G_FLOAT( OFS_PARM0 );
        if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
                mask = &serverlist_andmasks[masknr];
        else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
@@ -472,7 +472,7 @@ void VM_M_setserverlistmasknumber( void )
                return;
        }
 
-       number = PRVM_G_FLOAT( OFS_PARM2 );
+       number = (int)PRVM_G_FLOAT( OFS_PARM2 );
        field = (int) PRVM_G_FLOAT( OFS_PARM1 );
 
        switch( field ) {
@@ -526,7 +526,7 @@ void VM_M_getserverliststring(void)
 
        PRVM_G_INT(OFS_RETURN) = 0;
 
-       hostnr = PRVM_G_FLOAT(OFS_PARM1);
+       hostnr = (int)PRVM_G_FLOAT(OFS_PARM1);
 
        if(hostnr < 0 || hostnr >= serverlist_viewcount)
        {
@@ -578,7 +578,7 @@ void VM_M_getserverlistnumber(void)
 
        PRVM_G_INT(OFS_RETURN) = 0;
 
-       hostnr = PRVM_G_FLOAT(OFS_PARM1);
+       hostnr = (int)PRVM_G_FLOAT(OFS_PARM1);
 
        if(hostnr < 0 || hostnr >= serverlist_viewcount)
        {
@@ -706,7 +706,7 @@ sizebuf_t *VM_WriteDest (void)
        if(!sv.active)
                PRVM_ERROR("VM_WriteDest: game is not server (%s)", PRVM_NAME);
 
-       dest = PRVM_G_FLOAT(OFS_PARM1);
+       dest = (int)PRVM_G_FLOAT(OFS_PARM1);
        switch (dest)
        {
        case MSG_BROADCAST:
@@ -735,22 +735,22 @@ sizebuf_t *VM_WriteDest (void)
 
 void VM_M_WriteByte (void)
 {
-       MSG_WriteByte (VM_WriteDest(), PRVM_G_FLOAT(OFS_PARM0));
+       MSG_WriteByte (VM_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
 }
 
 void VM_M_WriteChar (void)
 {
-       MSG_WriteChar (VM_WriteDest(), PRVM_G_FLOAT(OFS_PARM0));
+       MSG_WriteChar (VM_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
 }
 
 void VM_M_WriteShort (void)
 {
-       MSG_WriteShort (VM_WriteDest(), PRVM_G_FLOAT(OFS_PARM0));
+       MSG_WriteShort (VM_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
 }
 
 void VM_M_WriteLong (void)
 {
-       MSG_WriteLong (VM_WriteDest(), PRVM_G_FLOAT(OFS_PARM0));
+       MSG_WriteLong (VM_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
 }
 
 void VM_M_WriteAngle (void)
index 1e82393..6567d89 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -1194,7 +1194,7 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                        pingtime = (int)((Sys_DoubleTime() - serverlist_cache[n].querytime) * 1000.0 + 0.5);
                        pingtime = bound(0, pingtime, 9999);
                        // update the ping
-                       info->ping = pingtime;
+                       info->ping = (int)pingtime;
 
                        // legacy/old stuff move it to the menu ASAP
 
@@ -1411,7 +1411,7 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                        pingtime = (int)((Sys_DoubleTime() - serverlist_cache[n].querytime) * 1000.0 + 0.5);
                        pingtime = bound(0, pingtime, 9999);
                        // update the ping
-                       info->ping = pingtime;
+                       info->ping = (int)pingtime;
 
                        // legacy/old stuff move it to the menu ASAP
 
index ad54439..3be8a6b 100644 (file)
@@ -194,11 +194,11 @@ void EntityFrameQuake_ReadEntity(int bits)
        if (cls.protocol == PROTOCOL_NEHAHRAMOVIE && (bits & U_EXTEND1))
        {
                // LordHavoc: evil format
-               int i = MSG_ReadFloat();
-               int j = MSG_ReadFloat() * 255.0f;
+               int i = (int)MSG_ReadFloat();
+               int j = (int)(MSG_ReadFloat() * 255.0f);
                if (i == 2)
                {
-                       i = MSG_ReadFloat();
+                       i = (int)MSG_ReadFloat();
                        if (i)
                                s.effects |= EF_FULLBRIGHT;
                }
@@ -268,7 +268,7 @@ void EntityFrameCSQC_InitClientVersions (int client, qboolean clear)
                Mem_Free(sv2csqcents_version[client]);
                sv2csqcents_version[client] = NULL;
        }
-       sv2csqcents_version[client] = Mem_Alloc(sv2csqc, MAX_EDICTS);
+       sv2csqcents_version[client] = (unsigned char *)Mem_Alloc(sv2csqc, MAX_EDICTS);
        memset(sv2csqcents_version[client], 0, MAX_EDICTS);
 }
 
index f5c13fd..b2ae259 100644 (file)
@@ -212,7 +212,7 @@ void VM_sprint (void)
        char string[VM_STRINGTEMP_LENGTH];
 
        //find client for this entity
-       clientnum = PRVM_G_FLOAT(OFS_PARM0);
+       clientnum = (int)PRVM_G_FLOAT(OFS_PARM0);
        if (!sv.active  || clientnum < 0 || clientnum >= svs.maxclients || !svs.clients[clientnum].active)
        {
                Con_Printf("VM_sprint: %s: invalid client or server is not active !\n", PRVM_NAME);
@@ -710,7 +710,7 @@ void VM_ftoi(void)
        int ent;
        VM_SAFEPARMCOUNT(1, VM_ftoi);
 
-       ent = PRVM_G_FLOAT(OFS_PARM0);
+       ent = (int)PRVM_G_FLOAT(OFS_PARM0);
        if(PRVM_PROG_TO_EDICT(ent)->priv.required->free)
                PRVM_ERROR ("VM_ftoe: %s tried to access a freed entity (entity %i)!", PRVM_NAME, ent);
 
@@ -1320,7 +1320,7 @@ void VM_registercvar (void)
 
        name = PRVM_G_STRING(OFS_PARM0);
        value = PRVM_G_STRING(OFS_PARM1);
-       flags = PRVM_G_FLOAT(OFS_PARM2);
+       flags = (int)PRVM_G_FLOAT(OFS_PARM2);
        PRVM_G_FLOAT(OFS_RETURN) = 0;
 
        if(flags > CVAR_MAXFLAGSVAL)
@@ -1538,7 +1538,7 @@ void VM_fopen(void)
                PRVM_G_FLOAT(OFS_RETURN) = -2;
                return;
        }
-       mode = PRVM_G_FLOAT(OFS_PARM1);
+       mode = (int)PRVM_G_FLOAT(OFS_PARM1);
        switch(mode)
        {
        case 0: // FILE_READ
@@ -1589,7 +1589,7 @@ void VM_fclose(void)
 
        VM_SAFEPARMCOUNT(1,VM_fclose);
 
-       filenum = PRVM_G_FLOAT(OFS_PARM0);
+       filenum = (int)PRVM_G_FLOAT(OFS_PARM0);
        if (filenum < 0 || filenum >= MAX_VMFILES)
        {
                Con_Printf("VM_fclose: invalid file handle %i used in %s\n", filenum, PRVM_NAME);
@@ -1622,7 +1622,7 @@ void VM_fgets(void)
 
        VM_SAFEPARMCOUNT(1,VM_fgets);
 
-       filenum = PRVM_G_FLOAT(OFS_PARM0);
+       filenum = (int)PRVM_G_FLOAT(OFS_PARM0);
        if (filenum < 0 || filenum >= MAX_VMFILES)
        {
                Con_Printf("VM_fgets: invalid file handle %i used in %s\n", filenum, PRVM_NAME);
@@ -1674,7 +1674,7 @@ void VM_fputs(void)
 
        VM_SAFEPARMCOUNT(2,VM_fputs);
 
-       filenum = PRVM_G_FLOAT(OFS_PARM0);
+       filenum = (int)PRVM_G_FLOAT(OFS_PARM0);
        if (filenum < 0 || filenum >= MAX_VMFILES)
        {
                Con_Printf("VM_fputs: invalid file handle %i used in %s\n", filenum, PRVM_NAME);
@@ -1754,8 +1754,8 @@ void VM_substring(void)
 
        string = VM_GetTempString();
        s = PRVM_G_STRING(OFS_PARM0);
-       start = PRVM_G_FLOAT(OFS_PARM1);
-       length = PRVM_G_FLOAT(OFS_PARM2);
+       start = (int)PRVM_G_FLOAT(OFS_PARM1);
+       length = (int)PRVM_G_FLOAT(OFS_PARM2);
        if (!s)
                s = "";
        for (i = 0;i < start && *s;i++, s++);
@@ -1833,7 +1833,7 @@ void VM_clcommand (void)
 
        VM_SAFEPARMCOUNT(2,VM_clcommand);
 
-       i = PRVM_G_FLOAT(OFS_PARM0);
+       i = (int)PRVM_G_FLOAT(OFS_PARM0);
        if (!sv.active  || i < 0 || i >= svs.maxclients || !svs.clients[i].active)
        {
                Con_Printf("VM_clientcommand: %s: invalid client/server is not active !\n", PRVM_NAME);
@@ -1892,7 +1892,7 @@ void VM_argv (void)
 
        VM_SAFEPARMCOUNT(1,VM_argv);
 
-       token_num = PRVM_G_FLOAT(OFS_PARM0);
+       token_num = (int)PRVM_G_FLOAT(OFS_PARM0);
 
        if (token_num >= 0 && token_num < num_tokens)
                PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(tokens[token_num]);
@@ -2175,8 +2175,8 @@ void VM_search_begin(void)
 
        VM_CheckEmptyString(pattern);
 
-       caseinsens = PRVM_G_FLOAT(OFS_PARM1);
-       quiet = PRVM_G_FLOAT(OFS_PARM2);
+       caseinsens = (int)PRVM_G_FLOAT(OFS_PARM1);
+       quiet = (int)PRVM_G_FLOAT(OFS_PARM2);
 
        for(handle = 0; handle < MAX_VMSEARCHES; handle++)
                if(!VM_SEARCHLIST[handle])
@@ -2207,7 +2207,7 @@ void VM_search_end(void)
        int handle;
        VM_SAFEPARMCOUNT(1, VM_search_end);
 
-       handle = PRVM_G_FLOAT(OFS_PARM0);
+       handle = (int)PRVM_G_FLOAT(OFS_PARM0);
 
        if(handle < 0 || handle >= MAX_VMSEARCHES)
        {
@@ -2236,7 +2236,7 @@ void VM_search_getsize(void)
        int handle;
        VM_SAFEPARMCOUNT(1, VM_M_search_getsize);
 
-       handle = PRVM_G_FLOAT(OFS_PARM0);
+       handle = (int)PRVM_G_FLOAT(OFS_PARM0);
 
        if(handle < 0 || handle >= MAX_VMSEARCHES)
        {
@@ -2265,8 +2265,8 @@ void VM_search_getfilename(void)
        char *tmp;
        VM_SAFEPARMCOUNT(2, VM_search_getfilename);
 
-       handle = PRVM_G_FLOAT(OFS_PARM0);
-       filenum = PRVM_G_FLOAT(OFS_PARM1);
+       handle = (int)PRVM_G_FLOAT(OFS_PARM0);
+       filenum = (int)PRVM_G_FLOAT(OFS_PARM1);
 
        if(handle < 0 || handle >= MAX_VMSEARCHES)
        {
@@ -2635,7 +2635,7 @@ void VM_keynumtostring (void)
        char *tmp;
        VM_SAFEPARMCOUNT(1, VM_keynumtostring);
 
-       keynum = PRVM_G_FLOAT(OFS_PARM0);
+       keynum = (int)PRVM_G_FLOAT(OFS_PARM0);
 
        tmp = VM_GetTempString();
 
@@ -2811,7 +2811,7 @@ void VM_drawline (void)
        c2              = PRVM_G_VECTOR(OFS_PARM2);
        rgb             = PRVM_G_VECTOR(OFS_PARM3);
        alpha   = PRVM_G_FLOAT(OFS_PARM4);
-       flags   = PRVM_G_FLOAT(OFS_PARM5);
+       flags   = (int)PRVM_G_FLOAT(OFS_PARM5);
        DrawQ_Line(width, c1[0], c1[1], c2[0], c2[1], rgb[0], rgb[1], rgb[2], alpha, flags);
 }
 
@@ -2843,10 +2843,11 @@ static qboolean                 vm_polygonbegin = false;        //[515]: for "no-crap-on-the-screen"
 void VM_InitPolygons (void)
 {
        vm_polygons_pool = Mem_AllocPool("VMPOLY", 0, NULL);
-       vm_polygons = Mem_Alloc(vm_polygons_pool, VM_DEFPOLYNUM*sizeof(vm_polygon_t));
+       vm_polygons = (vm_polygon_t *)Mem_Alloc(vm_polygons_pool, VM_DEFPOLYNUM*sizeof(vm_polygon_t));
        memset(vm_polygons, 0, VM_DEFPOLYNUM*sizeof(vm_polygon_t));
        vm_polygons_num = VM_DEFPOLYNUM;
-       vm_polygonbegin = vm_drawpolygons_num = 0;
+       vm_drawpolygons_num = 0;
+       vm_polygonbegin = false;
        vm_polygons_initialized = true;
 }
 
@@ -2962,7 +2963,7 @@ void VM_R_PolygonBegin (void)
        }
        if(vm_drawpolygons_num >= vm_polygons_num)
        {
-               p = Mem_Alloc(vm_polygons_pool, 2 * vm_polygons_num * sizeof(vm_polygon_t));
+               p = (vm_polygon_t *)Mem_Alloc(vm_polygons_pool, 2 * vm_polygons_num * sizeof(vm_polygon_t));
                memset(p, 0, 2 * vm_polygons_num * sizeof(vm_polygon_t));
                memcpy(p, vm_polygons, vm_polygons_num * sizeof(vm_polygon_t));
                Mem_Free(vm_polygons);
@@ -3169,7 +3170,7 @@ void VM_altstr_get( void )
        altstr = PRVM_G_STRING( OFS_PARM0 );
        //VM_CheckEmptyString( altstr );
 
-       count = PRVM_G_FLOAT( OFS_PARM1 );
+       count = (int)PRVM_G_FLOAT( OFS_PARM1 );
        count = count * 2 + 1;
 
        for( pos = altstr ; *pos && count ; pos++ )
@@ -3219,7 +3220,7 @@ void VM_altstr_set( void )
        altstr = PRVM_G_STRING( OFS_PARM0 );
        //VM_CheckEmptyString( altstr );
 
-       num = PRVM_G_FLOAT( OFS_PARM1 );
+       num = (int)PRVM_G_FLOAT( OFS_PARM1 );
 
        str = PRVM_G_STRING( OFS_PARM2 );
        //VM_CheckEmptyString( str );
@@ -3272,7 +3273,7 @@ void VM_altstr_ins(void)
        char *out;
 
        in = instr = PRVM_G_STRING( OFS_PARM0 );
-       num = PRVM_G_FLOAT( OFS_PARM1 );
+       num = (int)PRVM_G_FLOAT( OFS_PARM1 );
        set = setstr = PRVM_G_STRING( OFS_PARM2 );
 
        out = outstr = VM_GetTempString();
@@ -3322,7 +3323,7 @@ static int BufStr_FindFreeBuffer (void)
        for(i=0;i<MAX_QCSTR_BUFFERS;i++)
                if(!qcstringbuffers[i])
                {
-                       qcstringbuffers[i] = malloc(sizeof(qcstrbuffer_t));
+                       qcstringbuffers[i] = (qcstrbuffer_t *)Z_Malloc(sizeof(qcstrbuffer_t));
                        memset(qcstringbuffers[i], 0, sizeof(qcstrbuffer_t));
                        return i;
                }
@@ -3340,10 +3341,10 @@ static void BufStr_ClearBuffer (int index)
                {
                        for(i=0;i<b->num_strings;i++)
                                if(b->strings[i])
-                                       free(b->strings[i]);
+                                       Z_Free(b->strings[i]);
                        num_qcstringbuffers--;
                }
-               free(qcstringbuffers[index]);
+               Z_Free(qcstringbuffers[index]);
                qcstringbuffers[index] = NULL;
        }
 }
@@ -3473,7 +3474,7 @@ void VM_buf_copy (void)
                Con_Printf("VM_buf_copy: invalid source buffer %i used in %s\n", (int)PRVM_G_FLOAT(OFS_PARM0), PRVM_NAME);
                return;
        }
-       i = PRVM_G_FLOAT(OFS_PARM1);
+       i = (int)PRVM_G_FLOAT(OFS_PARM1);
        if(i == (int)PRVM_G_FLOAT(OFS_PARM0))
        {
                Con_Printf("VM_buf_copy: source == destination (%i) in %s\n", i, PRVM_NAME);
@@ -3487,14 +3488,14 @@ void VM_buf_copy (void)
        }
 
        BufStr_ClearBuffer(i);
-       qcstringbuffers[i] = malloc(sizeof(qcstrbuffer_t));
+       qcstringbuffers[i] = (qcstrbuffer_t *)Z_Malloc(sizeof(qcstrbuffer_t));
        memset(qcstringbuffers[i], 0, sizeof(qcstrbuffer_t));
        b2->num_strings = b1->num_strings;
 
        for(i=0;i<b1->num_strings;i++)
                if(b1->strings[i] && b1->strings[i][0])
                {
-                       b2->strings[i] = malloc(strlen(b1->strings[i])+1);
+                       b2->strings[i] = (char *)Z_Malloc(strlen(b1->strings[i])+1);
                        if(!b2->strings[i])
                        {
                                Con_Printf("VM_buf_copy: not enough memory for buffer %i used in %s\n", (int)PRVM_G_FLOAT(OFS_PARM1), PRVM_NAME);
@@ -3529,7 +3530,7 @@ void VM_buf_sort (void)
                Con_Printf("VM_buf_sort: tried to sort empty buffer %i in %s\n", (int)PRVM_G_FLOAT(OFS_PARM0), PRVM_NAME);
                return;
        }
-       buf_sortpower = PRVM_G_FLOAT(OFS_PARM1);
+       buf_sortpower = (int)PRVM_G_FLOAT(OFS_PARM1);
        if(buf_sortpower <= 0)
                buf_sortpower = 99999999;
 
@@ -3545,7 +3546,7 @@ void VM_buf_sort (void)
                                break;
                        else
                        {
-                               free(b->strings[i]);
+                               Z_Free(b->strings[i]);
                                --b->num_strings;
                                b->strings[i] = NULL;
                        }
@@ -3651,14 +3652,14 @@ void VM_bufstr_set (void)
 
        VM_SAFEPARMCOUNT(3, VM_bufstr_set);
 
-       bufindex = PRVM_G_FLOAT(OFS_PARM0);
+       bufindex = (int)PRVM_G_FLOAT(OFS_PARM0);
        b = BUFSTR_BUFFER(bufindex);
        if(!b)
        {
                Con_Printf("VM_bufstr_set: invalid buffer %i used in %s\n", bufindex, PRVM_NAME);
                return;
        }
-       strindex = PRVM_G_FLOAT(OFS_PARM1);
+       strindex = (int)PRVM_G_FLOAT(OFS_PARM1);
        if(strindex < 0 || strindex > MAX_QCSTR_STRINGS)
        {
                Con_Printf("VM_bufstr_set: invalid string index %i used in %s\n", strindex, PRVM_NAME);
@@ -3671,8 +3672,8 @@ void VM_bufstr_set (void)
                return;
        }
        if(b->strings[strindex])
-               free(b->strings[strindex]);
-       b->strings[strindex] = malloc(strlen(news)+1);
+               Z_Free(b->strings[strindex]);
+       b->strings[strindex] = (char *)Z_Malloc(strlen(news)+1);
        strcpy(b->strings[strindex], news);
 }
 
@@ -3692,7 +3693,7 @@ void VM_bufstr_add (void)
 
        VM_SAFEPARMCOUNT(3, VM_bufstr_add);
 
-       bufindex = PRVM_G_FLOAT(OFS_PARM0);
+       bufindex = (int)PRVM_G_FLOAT(OFS_PARM0);
        b = BUFSTR_BUFFER(bufindex);
        PRVM_G_FLOAT(OFS_RETURN) = -1;
        if(!b)
@@ -3707,7 +3708,7 @@ void VM_bufstr_add (void)
                return;
        }
 
-       order = PRVM_G_FLOAT(OFS_PARM2);
+       order = (int)PRVM_G_FLOAT(OFS_PARM2);
        if(order)
                strindex = b->num_strings;
        else
@@ -3731,8 +3732,8 @@ void VM_bufstr_add (void)
                b->num_strings++;
        }
        if(b->strings[strindex])
-               free(b->strings[strindex]);
-       b->strings[strindex] = malloc(strlen(string)+1);
+               Z_Free(b->strings[strindex]);
+       b->strings[strindex] = (char *)Z_Malloc(strlen(string)+1);
        strcpy(b->strings[strindex], string);
        PRVM_G_FLOAT(OFS_RETURN) = strindex;
 }
@@ -3756,14 +3757,14 @@ void VM_bufstr_free (void)
                Con_Printf("VM_bufstr_free: invalid buffer %i used in %s\n", (int)PRVM_G_FLOAT(OFS_PARM0), PRVM_NAME);
                return;
        }
-       i = PRVM_G_FLOAT(OFS_PARM1);
+       i = (int)PRVM_G_FLOAT(OFS_PARM1);
        if(i < 0 || i > MAX_QCSTR_STRINGS)
        {
                Con_Printf("VM_bufstr_free: invalid string index %i used in %s\n", i, PRVM_NAME);
                return;
        }
        if(b->strings[i])
-               free(b->strings[i]);
+               Z_Free(b->strings[i]);
        b->strings[i] = NULL;
        if(i+1 == b->num_strings)
                --b->num_strings;
index 343ac74..ecab72a 100644 (file)
--- a/r_light.c
+++ b/r_light.c
@@ -41,7 +41,7 @@ void r_light_start(void)
                for (x = 0;x < 32;x++)
                {
                        dx = (x - 15.5f) * (1.0f / 16.0f);
-                       a = ((1.0f / (dx * dx + dy * dy + 0.2f)) - (1.0f / (1.0f + 0.2))) * 32.0f / (1.0f / (1.0f + 0.2));
+                       a = (int)(((1.0f / (dx * dx + dy * dy + 0.2f)) - (1.0f / (1.0f + 0.2))) * 32.0f / (1.0f / (1.0f + 0.2)));
                        a = bound(0, a, 255);
                        pixels[y][x][0] = a;
                        pixels[y][x][1] = a;
index 6383a67..dcfdef5 100644 (file)
@@ -750,7 +750,7 @@ static void R_Shadow_MakeTextures(void)
                        intensity = 1.0f - sqrt(DotProduct(v, v));
                        if (intensity > 0)
                                intensity = pow(intensity, r_shadow_attenpower) * r_shadow_attenscale * 256.0f;
-                       d = bound(0, intensity, 255);
+                       d = (int)bound(0, intensity, 255);
                        data[(y*ATTEN2DSIZE+x)*4+0] = d;
                        data[(y*ATTEN2DSIZE+x)*4+1] = d;
                        data[(y*ATTEN2DSIZE+x)*4+2] = d;
@@ -772,7 +772,7 @@ static void R_Shadow_MakeTextures(void)
                                        intensity = 1.0f - sqrt(DotProduct(v, v));
                                        if (intensity > 0)
                                                intensity = pow(intensity, r_shadow_attenpower) * r_shadow_attenscale * 256.0f;
-                                       d = bound(0, intensity, 255);
+                                       d = (int)bound(0, intensity, 255);
                                        data[((z*ATTEN3DSIZE+y)*ATTEN3DSIZE+x)*4+0] = d;
                                        data[((z*ATTEN3DSIZE+y)*ATTEN3DSIZE+x)*4+1] = d;
                                        data[((z*ATTEN3DSIZE+y)*ATTEN3DSIZE+x)*4+2] = d;
@@ -1075,10 +1075,10 @@ qboolean R_Shadow_ScissorForBBox(const float *mins, const float *maxs)
        }
 
        // now convert the scissor rectangle to integer screen coordinates
-       ix1 = x1 - 1.0f;
-       iy1 = y1 - 1.0f;
-       ix2 = x2 + 1.0f;
-       iy2 = y2 + 1.0f;
+       ix1 = (int)(x1 - 1.0f);
+       iy1 = (int)(y1 - 1.0f);
+       ix2 = (int)(x2 + 1.0f);
+       iy2 = (int)(y2 + 1.0f);
        //Con_Printf("%f %f %f %f\n", x1, y1, x2, y2);
 
        // clamp it to the screen
index 9fc52ba..0fe33bc 100644 (file)
--- a/render.h
+++ b/render.h
@@ -350,7 +350,7 @@ r_glsl_permutation_t;
 // information about each possible shader permutation
 extern r_glsl_permutation_t r_glsl_permutations[SHADERPERMUTATION_COUNT];
 // currently selected permutation
-r_glsl_permutation_t *r_glsl_permutation;
+extern r_glsl_permutation_t *r_glsl_permutation;
 
 void R_GLSL_CompilePermutation(int permutation);
 void R_SetupSurfaceShader(const entity_render_t *ent, const texture_t *texture, const vec3_t modelorg, const vec3_t lightcolorbase, qboolean modellighting);
diff --git a/sbar.c b/sbar.c
index b95f6fb..7d1d280 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -595,8 +595,8 @@ void Sbar_SoloScoreboard (void)
        }
 
 // time
-       minutes = cl.time / 60;
-       seconds = cl.time - 60*minutes;
+       minutes = (int)(cl.time / 60);
+       seconds = (int)(cl.time - 60*minutes);
        tens = seconds / 10;
        units = seconds - 10*tens;
        sprintf (str,"Time :%3i:%i%i", minutes, tens, units);
@@ -1181,8 +1181,8 @@ void Sbar_Draw (void)
                                kickoffset[0] = (v_dmg_time/v_kicktime.value*v_dmg_roll) * 10 * scale;
                                kickoffset[1] = (v_dmg_time/v_kicktime.value*v_dmg_pitch) * 10 * scale;
                        }
-                       sbar_x = (vid_conwidth.integer - 256 * scale)/2 + kickoffset[0];
-                       sbar_y = (vid_conheight.integer - 256 * scale)/2 + kickoffset[1];
+                       sbar_x = (int)((vid_conwidth.integer - 256 * scale)/2 + kickoffset[0]);
+                       sbar_y = (int)((vid_conheight.integer - 256 * scale)/2 + kickoffset[1]);
                        // left1 16, 48 : 126 -66
                        // left2 16, 128 : 196 -66
                        // right 176, 48 : 196 -136
@@ -1431,12 +1431,12 @@ void Sbar_DeathmatchOverlay (void)
        {
                // show team scores first
                for (i = 0;i < teamlines && y < vid_conheight.integer;i++)
-                       y += Sbar_PrintScoreboardItem((teams + teamsort[i]), x, y);
+                       y += (int)Sbar_PrintScoreboardItem((teams + teamsort[i]), x, y);
                y += 5;
        }
 
        for (i = 0;i < scoreboardlines && y < vid_conheight.integer;i++)
-               y += Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
+               y += (int)Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
 }
 
 /*
@@ -1475,12 +1475,12 @@ void Sbar_MiniDeathmatchOverlay (int x, int y)
        if (gamemode == GAME_TRANSFUSION)
        {
                for (;i < scoreboardlines && x < vid_conwidth.integer;i++)
-                       x += 128 + Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
+                       x += 128 + (int)Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
        }
        else
        {
                for (;i < scoreboardlines && y < vid_conheight.integer;i++)
-                       y += Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
+                       y += (int)Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
        }
 }
 
@@ -1508,9 +1508,9 @@ void Sbar_IntermissionOverlay (void)
        DrawQ_Pic (sbar_x + 0, sbar_y + 56, Draw_CachePic("gfx/inter", true), 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
 
 // time
-       dig = cl.completed_time/60;
+       dig = (int)(cl.completed_time/60);
        Sbar_DrawNum (160, 64, dig, 3, 0);
-       num = cl.completed_time - dig*60;
+       num = (int)(cl.completed_time - dig*60);
        if (gamemode != GAME_NEXUIZ)
                Sbar_DrawPic (234,64,sb_colon);
        Sbar_DrawPic (246,64,sb_nums[0][num/10]);
index a6db955..76c08a4 100644 (file)
@@ -569,7 +569,7 @@ void SND_Spatialize(channel_t *ch, qboolean isstatic)
                for (i = 0;i < SND_LISTENERS;i++)
                {
                        vol = mastervol * snd_speakerlayout.listeners[i].ambientvolume;
-                       ch->listener_volume[i] = bound(0, vol, 255);
+                       ch->listener_volume[i] = (int)bound(0, vol, 255);
                }
        }
        else
@@ -585,7 +585,7 @@ void SND_Spatialize(channel_t *ch, qboolean isstatic)
                                Matrix4x4_Transform(&listener_matrix[i], ch->origin, source_vec);
                                VectorNormalize(source_vec);
                                vol = intensity * max(0, source_vec[0] * snd_speakerlayout.listeners[i].dotscale + snd_speakerlayout.listeners[i].dotbias);
-                               ch->listener_volume[i] = bound(0, vol, 255);
+                               ch->listener_volume[i] = (int)bound(0, vol, 255);
                        }
                }
                else
@@ -604,7 +604,7 @@ void S_PlaySfxOnChannel (sfx_t *sfx, channel_t *target_chan, unsigned int flags,
        // Initialize the channel
        memset (target_chan, 0, sizeof (*target_chan));
        VectorCopy (origin, target_chan->origin);
-       target_chan->master_vol = fvol * 255;
+       target_chan->master_vol = (int)(fvol * 255);
        target_chan->sfx = sfx;
        target_chan->end = paintedtime + sfx->total_length;
        target_chan->lastptime = paintedtime;
@@ -662,7 +662,7 @@ int S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f
                        continue;
                if (check->sfx == sfx && !check->pos)
                {
-                       skip = 0.1 * sfx->format.speed;
+                       skip = (int)(0.1 * sfx->format.speed);
                        if (skip > (int)sfx->total_length)
                                skip = (int)sfx->total_length;
                        if (skip > 0)
@@ -783,7 +783,7 @@ void S_PauseGameSounds (qboolean toggle)
 
 void S_SetChannelVolume (unsigned int ch_ind, float fvol)
 {
-       channels[ch_ind].master_vol = fvol * 255;
+       channels[ch_ind].master_vol = (int)(fvol * 255);
 }
 
 
@@ -828,7 +828,7 @@ S_UpdateAmbientSounds
 void S_UpdateAmbientSounds (void)
 {
        int                     i;
-       float           vol;
+       int                     vol;
        int                     ambient_channel;
        channel_t       *chan;
        unsigned char           ambientlevels[NUM_AMBIENTS];
@@ -844,20 +844,21 @@ void S_UpdateAmbientSounds (void)
                if (chan->sfx == NULL || chan->sfx->fetcher == NULL)
                        continue;
 
-               vol = ambientlevels[ambient_channel];
+               vol = (int)ambientlevels[ambient_channel];
                if (vol < 8)
                        vol = 0;
 
                // Don't adjust volume too fast
+               // FIXME: this rounds off to an int each frame, meaning there is little to no fade at extremely high framerates!
                if (chan->master_vol < vol)
                {
-                       chan->master_vol += host_realframetime * ambient_fade.value;
+                       chan->master_vol += (int)(host_realframetime * ambient_fade.value);
                        if (chan->master_vol > vol)
                                chan->master_vol = vol;
                }
                else if (chan->master_vol > vol)
                {
-                       chan->master_vol -= host_realframetime * ambient_fade.value;
+                       chan->master_vol -= (int)(host_realframetime * ambient_fade.value);
                        if (chan->master_vol < vol)
                                chan->master_vol = vol;
                }
@@ -1110,7 +1111,7 @@ void S_Update_(void)
                paintedtime = soundtime;
 
        // mix ahead of current position
-       endtime = soundtime + _snd_mixahead.value * shm->format.speed;
+       endtime = (int)(soundtime + _snd_mixahead.value * shm->format.speed);
        endtime = min(endtime, (unsigned int)(soundtime + shm->sampleframes));
 
        S_PaintChannels (endtime);
index 16b6e17..37781bf 100644 (file)
--- a/snd_mem.c
+++ b/snd_mem.c
@@ -36,7 +36,7 @@ size_t ResampleSfx (const unsigned char *in_data, size_t in_length, const snd_fo
        size_t srclength, outcount;
 
        srclength = in_length * in_format->channels;
-       outcount = (double)in_length * shm->format.speed / in_format->speed;
+       outcount = (int)((double)in_length * shm->format.speed / in_format->speed);
 
        //Con_DPrintf("ResampleSfx(%s): %d samples @ %dHz -> %d samples @ %dHz\n",
        //                      sfxname, in_length, in_format->speed, outcount, shm->format.speed);
@@ -63,7 +63,7 @@ size_t ResampleSfx (const unsigned char *in_data, size_t in_length, const snd_fo
 #      define INTEGER_BITS (sizeof(samplefrac)*8 - FRACTIONAL_BITS)
        else
        {
-               const unsigned int fracstep = (double)in_format->speed / shm->format.speed * (1 << FRACTIONAL_BITS);
+               const unsigned int fracstep = (unsigned int)((double)in_format->speed / shm->format.speed * (1 << FRACTIONAL_BITS));
                size_t remain_in = srclength, total_out = 0;
                unsigned int samplefrac;
                const unsigned char *in_ptr = in_data;
@@ -96,7 +96,7 @@ size_t ResampleSfx (const unsigned char *in_data, size_t in_length, const snd_fo
                        else
                        {
                                tmpcount = outcount - total_out;
-                               interpolation_limit = ceil((double)(((remain_in / in_format->channels) - 1) << FRACTIONAL_BITS) / fracstep);
+                               interpolation_limit = (int)ceil((double)(((remain_in / in_format->channels) - 1) << FRACTIONAL_BITS) / fracstep);
                                if (interpolation_limit > tmpcount)
                                        interpolation_limit = tmpcount;
                        }
index 8133314..03ba042 100644 (file)
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -457,7 +457,7 @@ qboolean SND_PaintChannel (channel_t *ch, int count)
        if (ch->flags & CHANNELFLAG_FULLVOLUME)
                snd_vol = 256;
        else
-               snd_vol = volume.value * 256;
+               snd_vol = (int)(volume.value * 256);
 
        for (i = 0;i < SND_LISTENERS;i++)
                vol[i] = ch->listener_volume[i] * snd_vol;
index e1f8d93..b0073d2 100644 (file)
--- a/snd_ogg.c
+++ b/snd_ogg.c
@@ -372,7 +372,7 @@ void OGG_CloseLibrary (void)
 */
 
 #define STREAM_BUFFER_DURATION 1.5f    // 1.5 sec
-#define STREAM_BUFFER_SIZE(format_ptr) (ceil (STREAM_BUFFER_DURATION * ((format_ptr)->speed * (format_ptr)->width * (format_ptr)->channels)))
+#define STREAM_BUFFER_SIZE(format_ptr) ((int)(ceil (STREAM_BUFFER_DURATION * ((format_ptr)->speed * (format_ptr)->width * (format_ptr)->channels))))
 
 // We work with 1 sec sequences, so this buffer must be able to contain
 // 1 sec of sound of the highest quality (48 KHz, 16 bit samples, stereo)
@@ -618,7 +618,7 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s)
        len = qov_pcm_total (&vf, -1) * vi->channels * 2;  // 16 bits => "* 2"
 
        // Decide if we go for a stream or a simple PCM cache
-       buff_len = ceil (STREAM_BUFFER_DURATION * (shm->format.speed * 2 * vi->channels));
+       buff_len = (int)ceil (STREAM_BUFFER_DURATION * (shm->format.speed * 2 * vi->channels));
        if (snd_streaming.integer && len > (ogg_int64_t)filesize + 3 * buff_len)
        {
                ogg_stream_persfx_t* per_sfx;
@@ -641,7 +641,7 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s)
                s->fetcher = &ogg_fetcher;
                s->loopstart = -1;
                s->flags |= SFXFLAG_STREAMED;
-               s->total_length = (size_t)len / per_sfx->format.channels / 2 * ((float)s->format.speed / per_sfx->format.speed);
+               s->total_length = (int)((size_t)len / per_sfx->format.channels / 2 * ((float)s->format.speed / per_sfx->format.speed));
        }
        else
        {
@@ -667,7 +667,8 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s)
                        done += ret;
 
                // Calculate resampled length
-               len = (double)done * (double)shm->format.speed / (double)vi->rate;
+               // FIXME: is this using the correct rounding direction?  ceil may be better
+               len = (int)((double)done * (double)shm->format.speed / (double)vi->rate);
 
                // Resample it
                memsize = (size_t)len + sizeof (*sb) - sizeof (sb->data);
index b6cfe26..89bd6c6 100644 (file)
--- a/snd_wav.c
+++ b/snd_wav.c
@@ -313,7 +313,7 @@ qboolean S_LoadWavFile (const char *filename, sfx_t *s)
        if (info.loopstart < 0)
                s->loopstart = -1;
        else
-               s->loopstart = (double)info.loopstart * (double)shm->format.speed / (double)s->format.speed;
+               s->loopstart = (int)((double)info.loopstart * (double)shm->format.speed / (double)s->format.speed);
        s->flags &= ~SFXFLAG_STREAMED;
 
 #if BYTE_ORDER != LITTLE_ENDIAN
index be7adfe..764c51b 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -136,7 +136,7 @@ Make sure the event gets sent to all clients
 */
 void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count)
 {
-       int             i, v;
+       int i;
 
        if (sv.datagram.cursize > MAX_PACKETFRAGMENT-18)
                return;
@@ -145,14 +145,7 @@ void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count)
        MSG_WriteCoord (&sv.datagram, org[1], sv.protocol);
        MSG_WriteCoord (&sv.datagram, org[2], sv.protocol);
        for (i=0 ; i<3 ; i++)
-       {
-               v = dir[i]*16;
-               if (v > 127)
-                       v = 127;
-               else if (v < -128)
-                       v = -128;
-               MSG_WriteChar (&sv.datagram, v);
-       }
+               MSG_WriteChar (&sv.datagram, (int)bound(-128, dir[i]*16, 127));
        MSG_WriteByte (&sv.datagram, count);
        MSG_WriteByte (&sv.datagram, color);
 }
@@ -257,7 +250,7 @@ void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int v
        if (field_mask & SND_VOLUME)
                MSG_WriteByte (&sv.datagram, volume);
        if (field_mask & SND_ATTENUATION)
-               MSG_WriteByte (&sv.datagram, attenuation*64);
+               MSG_WriteByte (&sv.datagram, (int)(attenuation*64));
        if (field_mask & SND_LARGEENTITY)
        {
                MSG_WriteShort (&sv.datagram, ent);
@@ -362,8 +355,8 @@ void SV_SendServerinfo (client_t *client)
 
 // send music
        MSG_WriteByte (&client->netconnection->message, svc_cdtrack);
-       MSG_WriteByte (&client->netconnection->message, prog->edicts->fields.server->sounds);
-       MSG_WriteByte (&client->netconnection->message, prog->edicts->fields.server->sounds);
+       MSG_WriteByte (&client->netconnection->message, (int)prog->edicts->fields.server->sounds);
+       MSG_WriteByte (&client->netconnection->message, (int)prog->edicts->fields.server->sounds);
 
 // set view
        MSG_WriteByte (&client->netconnection->message, svc_setview);
@@ -526,9 +519,9 @@ qboolean SV_PrepareEntityForSending (prvm_edict_t *ent, entity_state_t *cs, int
                if (effects & 32)
                {
                        effects &= ~32;
-                       light[0] = 0.2;
-                       light[1] = 1;
-                       light[2] = 0.2;
+                       light[0] = (int)(0.2*256);
+                       light[1] = (int)(1.0*256);
+                       light[2] = (int)(0.2*256);
                        light[3] = 200;
                        lightpflags |= PFLAGS_FULLDYNAMIC;
                }
@@ -600,9 +593,9 @@ qboolean SV_PrepareEntityForSending (prvm_edict_t *ent, entity_state_t *cs, int
        val = PRVM_GETEDICTFIELDVALUE(ent, eval_colormod);
        if (val->vector[0] || val->vector[1] || val->vector[2])
        {
-               i = val->vector[0] * 32.0f;cs->colormod[0] = bound(0, i, 255);
-               i = val->vector[1] * 32.0f;cs->colormod[1] = bound(0, i, 255);
-               i = val->vector[2] * 32.0f;cs->colormod[2] = bound(0, i, 255);
+               i = (int)(val->vector[0] * 32.0f);cs->colormod[0] = bound(0, i, 255);
+               i = (int)(val->vector[1] * 32.0f);cs->colormod[1] = bound(0, i, 255);
+               i = (int)(val->vector[2] * 32.0f);cs->colormod[2] = bound(0, i, 255);
        }
 
        cs->modelindex = modelindex;
@@ -961,7 +954,7 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
        int             items;
        prvm_eval_t     *val;
        vec3_t  punchvector;
-       unsigned char   viewzoom;
+       int             viewzoom;
        const char *s;
 
 //
@@ -971,8 +964,8 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
        {
                other = PRVM_PROG_TO_EDICT(ent->fields.server->dmg_inflictor);
                MSG_WriteByte (msg, svc_damage);
-               MSG_WriteByte (msg, ent->fields.server->dmg_save);
-               MSG_WriteByte (msg, ent->fields.server->dmg_take);
+               MSG_WriteByte (msg, (int)ent->fields.server->dmg_save);
+               MSG_WriteByte (msg, (int)ent->fields.server->dmg_take);
                for (i=0 ; i<3 ; i++)
                        MSG_WriteCoord (msg, other->fields.server->origin[i] + 0.5*(other->fields.server->mins[i] + other->fields.server->maxs[i]), sv.protocol);
 
@@ -1017,7 +1010,7 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
 
        viewzoom = 255;
        if ((val = PRVM_GETEDICTFIELDVALUE(ent, eval_viewzoom)))
-               viewzoom = val->_float * 255.0f;
+               viewzoom = (int)(val->_float * 255.0f);
        if (viewzoom == 0)
                viewzoom = 255;
 
@@ -1042,18 +1035,18 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
        }
 
        memset(stats, 0, sizeof(int[MAX_CL_STATS]));
-       stats[STAT_VIEWHEIGHT] = ent->fields.server->view_ofs[2];
+       stats[STAT_VIEWHEIGHT] = (int)ent->fields.server->view_ofs[2];
        stats[STAT_ITEMS] = items;
-       stats[STAT_WEAPONFRAME] = ent->fields.server->weaponframe;
-       stats[STAT_ARMOR] = ent->fields.server->armorvalue;
+       stats[STAT_WEAPONFRAME] = (int)ent->fields.server->weaponframe;
+       stats[STAT_ARMOR] = (int)ent->fields.server->armorvalue;
        stats[STAT_WEAPON] = client->weaponmodelindex;
-       stats[STAT_HEALTH] = ent->fields.server->health;
-       stats[STAT_AMMO] = ent->fields.server->currentammo;
-       stats[STAT_SHELLS] = ent->fields.server->ammo_shells;
-       stats[STAT_NAILS] = ent->fields.server->ammo_nails;
-       stats[STAT_ROCKETS] = ent->fields.server->ammo_rockets;
-       stats[STAT_CELLS] = ent->fields.server->ammo_cells;
-       stats[STAT_ACTIVEWEAPON] = ent->fields.server->weapon;
+       stats[STAT_HEALTH] = (int)ent->fields.server->health;
+       stats[STAT_AMMO] = (int)ent->fields.server->currentammo;
+       stats[STAT_SHELLS] = (int)ent->fields.server->ammo_shells;
+       stats[STAT_NAILS] = (int)ent->fields.server->ammo_nails;
+       stats[STAT_ROCKETS] = (int)ent->fields.server->ammo_rockets;
+       stats[STAT_CELLS] = (int)ent->fields.server->ammo_cells;
+       stats[STAT_ACTIVEWEAPON] = (int)ent->fields.server->weapon;
        stats[STAT_VIEWZOOM] = viewzoom;
        // the QC bumps these itself by sending svc_'s, so we have to keep them
        // zero or they'll be corrected by the engine
@@ -1092,14 +1085,14 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
                MSG_WriteChar (msg, stats[STAT_VIEWHEIGHT]);
 
        if (bits & SU_IDEALPITCH)
-               MSG_WriteChar (msg, ent->fields.server->idealpitch);
+               MSG_WriteChar (msg, (int)ent->fields.server->idealpitch);
 
        for (i=0 ; i<3 ; i++)
        {
                if (bits & (SU_PUNCH1<<i))
                {
                        if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE)
-                               MSG_WriteChar(msg, ent->fields.server->punchangle[i]);
+                               MSG_WriteChar(msg, (int)ent->fields.server->punchangle[i]);
                        else
                                MSG_WriteAngle16i(msg, ent->fields.server->punchangle[i]);
                }
@@ -1113,7 +1106,7 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
                if (bits & (SU_VELOCITY1<<i))
                {
                        if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_DARKPLACES1 || sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4)
-                               MSG_WriteChar(msg, ent->fields.server->velocity[i] * (1.0f / 16.0f));
+                               MSG_WriteChar(msg, (int)(ent->fields.server->velocity[i] * (1.0f / 16.0f)));
                        else
                                MSG_WriteCoord32f(msg, ent->fields.server->velocity[i]);
                }
@@ -1138,7 +1131,7 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
                MSG_WriteShort (msg, stats[STAT_CELLS]);
                MSG_WriteShort (msg, stats[STAT_ACTIVEWEAPON]);
                if (bits & SU_VIEWZOOM)
-                       MSG_WriteShort (msg, min(stats[STAT_VIEWZOOM], 65535));
+                       MSG_WriteShort (msg, bound(0, stats[STAT_VIEWZOOM], 65535));
        }
        else if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE || sv.protocol == PROTOCOL_DARKPLACES1 || sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4)
        {
@@ -1166,9 +1159,9 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
                if (bits & SU_VIEWZOOM)
                {
                        if (sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4)
-                               MSG_WriteByte (msg, min(stats[STAT_VIEWZOOM], 255));
+                               MSG_WriteByte (msg, bound(0, stats[STAT_VIEWZOOM], 255));
                        else
-                               MSG_WriteShort (msg, min(stats[STAT_VIEWZOOM], 65535));
+                               MSG_WriteShort (msg, bound(0, stats[STAT_VIEWZOOM], 65535));
                }
        }
 }
@@ -1516,8 +1509,8 @@ void SV_CreateBaseline (void)
                // create entity baseline
                VectorCopy (svent->fields.server->origin, svent->priv.server->baseline.origin);
                VectorCopy (svent->fields.server->angles, svent->priv.server->baseline.angles);
-               svent->priv.server->baseline.frame = svent->fields.server->frame;
-               svent->priv.server->baseline.skin = svent->fields.server->skin;
+               svent->priv.server->baseline.frame = (int)svent->fields.server->frame;
+               svent->priv.server->baseline.skin = (int)svent->fields.server->skin;
                if (entnum > 0 && entnum <= svs.maxclients)
                {
                        svent->priv.server->baseline.colormap = entnum;
@@ -1526,7 +1519,7 @@ void SV_CreateBaseline (void)
                else
                {
                        svent->priv.server->baseline.colormap = 0;
-                       svent->priv.server->baseline.modelindex = svent->fields.server->modelindex;
+                       svent->priv.server->baseline.modelindex = (int)svent->fields.server->modelindex;
                }
 
                large = false;
@@ -1573,7 +1566,7 @@ void SV_SaveSpawnparms (void)
 {
        int             i, j;
 
-       svs.serverflags = prog->globals.server->serverflags;
+       svs.serverflags = (int)prog->globals.server->serverflags;
 
        for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
        {
index 8c8f9b8..99e1f60 100644 (file)
--- a/sv_move.c
+++ b/sv_move.c
@@ -309,7 +309,7 @@ void SV_NewChaseDir (prvm_edict_t *actor, prvm_edict_t *enemy, float dist)
        }
 
 // try other directions
-       if ( ((rand()&3) & 1) ||  abs(deltay)>abs(deltax))
+       if ( ((rand()&3) & 1) ||  fabs(deltay)>fabs(deltax))
        {
                tdir=d[1];
                d[1]=d[2];
index 2b88821..23a9896 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -38,12 +38,12 @@ SV_SetIdealPitch
 #define        MAX_FORWARD     6
 void SV_SetIdealPitch (void)
 {
-       float   angleval, sinval, cosval;
+       float   angleval, sinval, cosval, step, dir;
        trace_t tr;
        vec3_t  top, bottom;
        float   z[MAX_FORWARD];
        int             i, j;
-       int             step, dir, steps;
+       int             steps;
 
        if (!((int)host_client->edict->fields.server->flags & FL_ONGROUND))
                return;
index de42971..da749e3 100644 (file)
@@ -324,7 +324,7 @@ void PF_particle (void)
        dir = PRVM_G_VECTOR(OFS_PARM1);
        color = PRVM_G_FLOAT(OFS_PARM2);
        count = PRVM_G_FLOAT(OFS_PARM3);
-       SV_StartParticle (org, dir, color, count);
+       SV_StartParticle (org, dir, (int)color, (int)count);
 }
 
 
@@ -369,8 +369,8 @@ void PF_ambientsound (void)
        else
                MSG_WriteByte (&sv.signon, soundnum);
 
-       MSG_WriteByte (&sv.signon, vol*255);
-       MSG_WriteByte (&sv.signon, attenuation*64);
+       MSG_WriteByte (&sv.signon, (int)(vol*255));
+       MSG_WriteByte (&sv.signon, (int)(attenuation*64));
 
 }
 
@@ -398,9 +398,9 @@ void PF_sound (void)
        float attenuation;
 
        entity = PRVM_G_EDICT(OFS_PARM0);
-       channel = PRVM_G_FLOAT(OFS_PARM1);
+       channel = (int)PRVM_G_FLOAT(OFS_PARM1);
        sample = PRVM_G_STRING(OFS_PARM2);
-       volume = PRVM_G_FLOAT(OFS_PARM3) * 255;
+       volume = (int)(PRVM_G_FLOAT(OFS_PARM3) * 255);
        attenuation = PRVM_G_FLOAT(OFS_PARM4);
 
        if (volume < 0 || volume > 255)
@@ -438,7 +438,7 @@ void PF_traceline (void)
 
        v1 = PRVM_G_VECTOR(OFS_PARM0);
        v2 = PRVM_G_VECTOR(OFS_PARM1);
-       move = PRVM_G_FLOAT(OFS_PARM2);
+       move = (int)PRVM_G_FLOAT(OFS_PARM2);
        ent = PRVM_G_EDICT(OFS_PARM3);
 
        if (IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) || IS_NAN(v2[0]) || IS_NAN(v1[2]) || IS_NAN(v2[2]))
@@ -504,7 +504,7 @@ void PF_tracebox (void)
        m1 = PRVM_G_VECTOR(OFS_PARM1);
        m2 = PRVM_G_VECTOR(OFS_PARM2);
        v2 = PRVM_G_VECTOR(OFS_PARM3);
-       move = PRVM_G_FLOAT(OFS_PARM4);
+       move = (int)PRVM_G_FLOAT(OFS_PARM4);
        ent = PRVM_G_EDICT(OFS_PARM5);
 
        if (IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) || IS_NAN(v2[0]) || IS_NAN(v1[2]) || IS_NAN(v2[2]))
@@ -919,7 +919,7 @@ void PF_lightstyle (void)
        client_t        *client;
        int                     j;
 
-       style = PRVM_G_FLOAT(OFS_PARM0);
+       style = (int)PRVM_G_FLOAT(OFS_PARM0);
        val = PRVM_G_STRING(OFS_PARM1);
 
        if( (unsigned) style >= MAX_LIGHTSTYLES ) {
@@ -1183,7 +1183,7 @@ sizebuf_t *WriteDest (void)
        prvm_edict_t    *ent;
        extern sizebuf_t *sv2csqcbuf;
 
-       dest = PRVM_G_FLOAT(OFS_PARM0);
+       dest = (int)PRVM_G_FLOAT(OFS_PARM0);
        switch (dest)
        {
        case MSG_BROADCAST:
@@ -1217,22 +1217,22 @@ sizebuf_t *WriteDest (void)
 
 void PF_WriteByte (void)
 {
-       MSG_WriteByte (WriteDest(), PRVM_G_FLOAT(OFS_PARM1));
+       MSG_WriteByte (WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM1));
 }
 
 void PF_WriteChar (void)
 {
-       MSG_WriteChar (WriteDest(), PRVM_G_FLOAT(OFS_PARM1));
+       MSG_WriteChar (WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM1));
 }
 
 void PF_WriteShort (void)
 {
-       MSG_WriteShort (WriteDest(), PRVM_G_FLOAT(OFS_PARM1));
+       MSG_WriteShort (WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM1));
 }
 
 void PF_WriteLong (void)
 {
-       MSG_WriteLong (WriteDest(), PRVM_G_FLOAT(OFS_PARM1));
+       MSG_WriteLong (WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM1));
 }
 
 void PF_WriteAngle (void)
@@ -1281,18 +1281,18 @@ void PF_makestatic (void)
        if (large)
        {
                MSG_WriteByte (&sv.signon,svc_spawnstatic2);
-               MSG_WriteShort (&sv.signon, ent->fields.server->modelindex);
-               MSG_WriteShort (&sv.signon, ent->fields.server->frame);
+               MSG_WriteShort (&sv.signon, (int)ent->fields.server->modelindex);
+               MSG_WriteShort (&sv.signon, (int)ent->fields.server->frame);
        }
        else
        {
                MSG_WriteByte (&sv.signon,svc_spawnstatic);
-               MSG_WriteByte (&sv.signon, ent->fields.server->modelindex);
-               MSG_WriteByte (&sv.signon, ent->fields.server->frame);
+               MSG_WriteByte (&sv.signon, (int)ent->fields.server->modelindex);
+               MSG_WriteByte (&sv.signon, (int)ent->fields.server->frame);
        }
 
-       MSG_WriteByte (&sv.signon, ent->fields.server->colormap);
-       MSG_WriteByte (&sv.signon, ent->fields.server->skin);
+       MSG_WriteByte (&sv.signon, (int)ent->fields.server->colormap);
+       MSG_WriteByte (&sv.signon, (int)ent->fields.server->skin);
        for (i=0 ; i<3 ; i++)
        {
                MSG_WriteCoord(&sv.signon, ent->fields.server->origin[i], sv.protocol);
@@ -1391,7 +1391,7 @@ void VM_AutoSentStats_Clear (void)
 {
        if(vm_autosentstats)
        {
-               free(vm_autosentstats);
+               Z_Free(vm_autosentstats);
                vm_autosentstats = NULL;
                vm_autosentstats_last = -1;
        }
@@ -1473,7 +1473,7 @@ void VM_SV_WriteAutoSentStats (client_t *client, prvm_edict_t *ent, sizebuf_t *m
                        break;
                //integer
                case 8:
-                       v = PRVM_E_FLOAT(ent, vm_autosentstats[i].fieldoffset); //[515]: use PRVM_E_INT ?
+                       v = (int)PRVM_E_FLOAT(ent, vm_autosentstats[i].fieldoffset);    //[515]: use PRVM_E_INT ?
                        if (!send)
                                stats[i+32] = v;
                        else
@@ -1499,15 +1499,15 @@ void PF_SV_AddStat (void)
 
        if(!vm_autosentstats)
        {
-               vm_autosentstats = malloc((MAX_CL_STATS-32) * sizeof(autosentstat_t));
+               vm_autosentstats = (autosentstat_t *)Z_Malloc((MAX_CL_STATS-32) * sizeof(autosentstat_t));
                if(!vm_autosentstats)
                {
                        Con_Printf("PF_SV_AddStat: not enough memory\n");
                        return;
                }
        }
-       i               = PRVM_G_FLOAT(OFS_PARM0);
-       type    = PRVM_G_FLOAT(OFS_PARM1);
+       i               = (int)PRVM_G_FLOAT(OFS_PARM0);
+       type    = (int)PRVM_G_FLOAT(OFS_PARM1);
        off             = PRVM_G_INT  (OFS_PARM2);
        i -= 32;
 
@@ -1574,7 +1574,7 @@ void PF_setcolor (void)
        prvm_eval_t *val;
 
        entnum = PRVM_G_EDICTNUM(OFS_PARM0);
-       i = PRVM_G_FLOAT(OFS_PARM1);
+       i = (int)PRVM_G_FLOAT(OFS_PARM1);
 
        if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active)
        {
@@ -1618,7 +1618,7 @@ void PF_effect (void)
        i = SV_ModelIndex(s, 1);
        if (!i)
                PF_WARNING("effect: model not precached\n");
-       SV_StartEffect(PRVM_G_VECTOR(OFS_PARM0), i, PRVM_G_FLOAT(OFS_PARM2), PRVM_G_FLOAT(OFS_PARM3), PRVM_G_FLOAT(OFS_PARM4));
+       SV_StartEffect(PRVM_G_VECTOR(OFS_PARM0), i, (int)PRVM_G_FLOAT(OFS_PARM2), (int)PRVM_G_FLOAT(OFS_PARM3), (int)PRVM_G_FLOAT(OFS_PARM4));
 }
 
 void PF_te_blood (void)
@@ -1656,7 +1656,7 @@ void PF_te_bloodshower (void)
        // speed
        MSG_WriteCoord(&sv.datagram, PRVM_G_FLOAT(OFS_PARM2), sv.protocol);
        // count
-       MSG_WriteShort(&sv.datagram, bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
+       MSG_WriteShort(&sv.datagram, (int)bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
 }
 
 void PF_te_explosionrgb (void)
@@ -1692,9 +1692,9 @@ void PF_te_particlecube (void)
        MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2)[1], sv.protocol);
        MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2)[2], sv.protocol);
        // count
-       MSG_WriteShort(&sv.datagram, bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
+       MSG_WriteShort(&sv.datagram, (int)bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
        // color
-       MSG_WriteByte(&sv.datagram, PRVM_G_FLOAT(OFS_PARM4));
+       MSG_WriteByte(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM4));
        // gravity true/false
        MSG_WriteByte(&sv.datagram, ((int) PRVM_G_FLOAT(OFS_PARM5)) != 0);
        // randomvel
@@ -1720,9 +1720,9 @@ void PF_te_particlerain (void)
        MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2)[1], sv.protocol);
        MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2)[2], sv.protocol);
        // count
-       MSG_WriteShort(&sv.datagram, bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
+       MSG_WriteShort(&sv.datagram, (int)bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
        // color
-       MSG_WriteByte(&sv.datagram, PRVM_G_FLOAT(OFS_PARM4));
+       MSG_WriteByte(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM4));
 }
 
 void PF_te_particlesnow (void)
@@ -1744,9 +1744,9 @@ void PF_te_particlesnow (void)
        MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2)[1], sv.protocol);
        MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2)[2], sv.protocol);
        // count
-       MSG_WriteShort(&sv.datagram, bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
+       MSG_WriteShort(&sv.datagram, (int)bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
        // color
-       MSG_WriteByte(&sv.datagram, PRVM_G_FLOAT(OFS_PARM4));
+       MSG_WriteByte(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM4));
 }
 
 void PF_te_spark (void)
@@ -1828,13 +1828,13 @@ void PF_te_customflash (void)
        MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[1], sv.protocol);
        MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[2], sv.protocol);
        // radius
-       MSG_WriteByte(&sv.datagram, bound(0, PRVM_G_FLOAT(OFS_PARM1) / 8 - 1, 255));
+       MSG_WriteByte(&sv.datagram, (int)bound(0, PRVM_G_FLOAT(OFS_PARM1) / 8 - 1, 255));
        // lifetime
-       MSG_WriteByte(&sv.datagram, bound(0, PRVM_G_FLOAT(OFS_PARM2) * 256 - 1, 255));
+       MSG_WriteByte(&sv.datagram, (int)bound(0, PRVM_G_FLOAT(OFS_PARM2) * 256 - 1, 255));
        // color
-       MSG_WriteByte(&sv.datagram, bound(0, PRVM_G_VECTOR(OFS_PARM3)[0] * 255, 255));
-       MSG_WriteByte(&sv.datagram, bound(0, PRVM_G_VECTOR(OFS_PARM3)[1] * 255, 255));
-       MSG_WriteByte(&sv.datagram, bound(0, PRVM_G_VECTOR(OFS_PARM3)[2] * 255, 255));
+       MSG_WriteByte(&sv.datagram, (int)bound(0, PRVM_G_VECTOR(OFS_PARM3)[0] * 255, 255));
+       MSG_WriteByte(&sv.datagram, (int)bound(0, PRVM_G_VECTOR(OFS_PARM3)[1] * 255, 255));
+       MSG_WriteByte(&sv.datagram, (int)bound(0, PRVM_G_VECTOR(OFS_PARM3)[2] * 255, 255));
 }
 
 void PF_te_gunshot (void)
@@ -1936,8 +1936,8 @@ void PF_te_explosion2 (void)
        MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[1], sv.protocol);
        MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[2], sv.protocol);
        // color
-       MSG_WriteByte(&sv.datagram, PRVM_G_FLOAT(OFS_PARM1));
-       MSG_WriteByte(&sv.datagram, PRVM_G_FLOAT(OFS_PARM2));
+       MSG_WriteByte(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM1));
+       MSG_WriteByte(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM2));
 }
 
 void PF_te_lightning1 (void)
@@ -2026,7 +2026,7 @@ void PF_te_flamejet (void)
        MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM1)[1], sv.protocol);
        MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM1)[2], sv.protocol);
        // count
-       MSG_WriteByte(&sv.datagram, PRVM_G_FLOAT(OFS_PARM2));
+       MSG_WriteByte(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM2));
 }
 
 void clippointtosurface(model_t *model, msurface_t *surface, vec3_t p, vec3_t out)
@@ -2070,7 +2070,7 @@ static model_t *getmodel(prvm_edict_t *ed)
        int modelindex;
        if (!ed || ed->priv.server->free)
                return NULL;
-       modelindex = ed->fields.server->modelindex;
+       modelindex = (int)ed->fields.server->modelindex;
        if (modelindex < 1 || modelindex >= MAX_MODELS)
                return NULL;
        return sv.models[modelindex];
@@ -2090,7 +2090,7 @@ void PF_getsurfacenumpoints(void)
        model_t *model;
        msurface_t *surface;
        // return 0 if no such surface
-       if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+       if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
        {
                PRVM_G_FLOAT(OFS_RETURN) = 0;
                return;
@@ -2108,10 +2108,10 @@ void PF_getsurfacepoint(void)
        int pointnum;
        VectorClear(PRVM_G_VECTOR(OFS_RETURN));
        ed = PRVM_G_EDICT(OFS_PARM0);
-       if (!(model = getmodel(ed)) || !(surface = getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+       if (!(model = getmodel(ed)) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
                return;
        // note: this (incorrectly) assumes it is a simple polygon
-       pointnum = PRVM_G_FLOAT(OFS_PARM2);
+       pointnum = (int)PRVM_G_FLOAT(OFS_PARM2);
        if (pointnum < 0 || pointnum >= surface->num_vertices)
                return;
        // FIXME: implement rotation/scaling
@@ -2124,7 +2124,7 @@ void PF_getsurfacenormal(void)
        msurface_t *surface;
        vec3_t normal;
        VectorClear(PRVM_G_VECTOR(OFS_RETURN));
-       if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+       if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
                return;
        // FIXME: implement rotation/scaling
        // note: this (incorrectly) assumes it is a simple polygon
@@ -2140,7 +2140,7 @@ void PF_getsurfacetexture(void)
        model_t *model;
        msurface_t *surface;
        PRVM_G_INT(OFS_RETURN) = 0;
-       if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+       if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
                return;
        PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(surface->texture->name);
 }
@@ -2201,7 +2201,7 @@ void PF_getsurfaceclippedpoint(void)
        vec3_t p, out;
        VectorClear(PRVM_G_VECTOR(OFS_RETURN));
        ed = PRVM_G_EDICT(OFS_PARM0);
-       if (!(model = getmodel(ed)) || !(surface = getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+       if (!(model = getmodel(ed)) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
                return;
        // FIXME: implement rotation/scaling
        VectorSubtract(PRVM_G_VECTOR(OFS_PARM2), ed->fields.server->origin, p);
@@ -2261,7 +2261,7 @@ void PF_setattachment (void)
                modelindex = (int)tagentity->fields.server->modelindex;
                if (modelindex >= 0 && modelindex < MAX_MODELS && (model = sv.models[modelindex]))
                {
-                       v->_float = Mod_Alias_GetTagIndexForName(model, tagentity->fields.server->skin, tagname);
+                       v->_float = Mod_Alias_GetTagIndexForName(model, (int)tagentity->fields.server->skin, tagname);
                        if (v->_float == 0)
                                Con_DPrintf("setattachment(edict %i, edict %i, string \"%s\"): tried to find tag named \"%s\" on entity %i (model \"%s\") but could not find it\n", PRVM_NUM_FOR_EDICT(e), PRVM_NUM_FOR_EDICT(tagentity), tagname, tagname, PRVM_NUM_FOR_EDICT(tagentity), model->name);
                }
@@ -2278,12 +2278,12 @@ int SV_GetTagIndex (prvm_edict_t *e, const char *tagname)
        int i;
        model_t *model;
 
-       i = e->fields.server->modelindex;
+       i = (int)e->fields.server->modelindex;
        if (i < 1 || i >= MAX_MODELS)
                return -1;
        model = sv.models[i];
 
-       return Mod_Alias_GetTagIndexForName(model, e->fields.server->skin, tagname);
+       return Mod_Alias_GetTagIndexForName(model, (int)e->fields.server->skin, tagname);
 };
 
 void SV_GetEntityMatrix (prvm_edict_t *ent, matrix4x4_t *out, qboolean viewmatrix)
@@ -2303,7 +2303,7 @@ int SV_GetEntityLocalTagMatrix(prvm_edict_t *ent, int tagindex, matrix4x4_t *out
        int frame;
        model_t *model;
        if (tagindex >= 0
-        && (modelindex = ent->fields.server->modelindex) >= 1 && modelindex < MAX_MODELS
+        && (modelindex = (int)ent->fields.server->modelindex) >= 1 && modelindex < MAX_MODELS
         && (model = sv.models[(int)ent->fields.server->modelindex])
         && model->animscenes)
        {
@@ -2366,7 +2366,7 @@ int SV_GetTagMatrix (matrix4x4_t *out, prvm_edict_t *ent, int tagindex)
                // next iteration we process the parent entity
                if ((val = PRVM_GETEDICTFIELDVALUE(ent, eval_tag_entity)) && val->edict)
                {
-                       tagindex = PRVM_GETEDICTFIELDVALUE(ent, eval_tag_index)->_float;
+                       tagindex = (int)PRVM_GETEDICTFIELDVALUE(ent, eval_tag_index)->_float;
                        ent = PRVM_EDICT_NUM(val->edict);
                }
                else
index be0f67d..6bbbe38 100644 (file)
--- a/sys_sdl.c
+++ b/sys_sdl.c
@@ -176,7 +176,7 @@ char *Sys_GetClipboardData (void)
                {
                        if ((cliptext = GlobalLock (hClipboardData)) != 0)
                        {
-                               data = malloc (GlobalSize(hClipboardData)+1);
+                               data = Z_Malloc (GlobalSize(hClipboardData)+1);
                                strcpy (data, cliptext);
                                GlobalUnlock (hClipboardData);
                        }
index c5fdb0c..69387dc 100644 (file)
--- a/sys_win.c
+++ b/sys_win.c
@@ -287,7 +287,7 @@ char *Sys_GetClipboardData (void)
                {
                        if ((cliptext = GlobalLock (hClipboardData)) != 0)
                        {
-                               data = malloc (GlobalSize(hClipboardData)+1);
+                               data = Z_Malloc (GlobalSize(hClipboardData)+1);
                                strcpy (data, cliptext);
                                GlobalUnlock (hClipboardData);
                        }
diff --git a/todo b/todo
index 3b908f2..b36fb97 100644 (file)
--- a/todo
+++ b/todo
@@ -35,6 +35,8 @@
 -d (yummyluv) feature darkplaces protocol: add buttons 9-16 (yummyluv)
 -f (James D) bug darkplaces server: losing runes on episode completion, completing episode 1 then 2 then 3 causes it to forget 1, then 4 causes it to forget 2 and 3, making it impossible to open the boss gate (James D)
 -f (Wazat) bug darkplaces: client's slowmo detection (measuring packet times and comparing to game time changes) may be making the game unpleasant (Wazat)
+0 bug dpmod: go through http://www.inside3d.com/qip/q1/bugsmap.htm and fix map bugs by using replacement .ent files (Lardarse)
+0 bug dpmod: the id1 map e2m4 has a bug where 4 scrags don't spawn in normal/hard skills because of a mislinked trigger, the Quake Done Quick team figured this out and a trigger_relay with target "t58" should be changed to target "t66" (Lardarse)
 0 bug darkplaces client/server: viewzoom values above 1 are not working properly
 0 bug darkplaces client: GAME_NEHAHRA: make sure cutscenes and movies work, got a report of seeing a black screen (NightFright)
 0 bug darkplaces client: fix cl_bobmodel bug which momentarily jolts the gun when you pass through a trigger, pick up an item, etc, Sajt thinks this is related to console prints as well as centerprint (Sajt)
index 39368f7..d5f9299 100644 (file)
@@ -743,7 +743,7 @@ void VID_UpdateGamma(qboolean force, int rampsize)
                                vid_gammarampsize = rampsize;
                                if (vid_gammaramps)
                                        Z_Free(vid_gammaramps);
-                               vid_gammaramps = Z_Malloc(6 * vid_gammarampsize * sizeof(unsigned short));
+                               vid_gammaramps = (unsigned short *)Z_Malloc(6 * vid_gammarampsize * sizeof(unsigned short));
                                vid_systemgammaramps = vid_gammaramps + 3 * vid_gammarampsize;
                        }
                        Cvar_SetValueQuick(&vid_hardwaregammasupported, VID_GetGamma(vid_systemgammaramps, vid_gammarampsize));
@@ -815,7 +815,7 @@ void VID_UpdateGamma(qboolean force, int rampsize)
 
                        for (x = 0, ramp = vid_gammaramps;x < 3;x++)
                                for (y = 0, t = n[x] - 0.75f;y < vid_gammarampsize;y++, t += 0.75f * (2.0f / vid_gammarampsize))
-                                       *ramp++ = cos(t*(M_PI*2.0)) * 32767.0f + 32767.0f;
+                                       *ramp++ = (unsigned short)(cos(t*(M_PI*2.0)) * 32767.0f + 32767.0f);
                }
 
                Cvar_SetValueQuick(&vid_hardwaregammasupported, VID_SetGamma(vid_gammaramps, vid_gammarampsize));
diff --git a/view.c b/view.c
index 73acc74..72806f5 100644 (file)
--- a/view.c
+++ b/view.c
@@ -230,7 +230,7 @@ void V_ParseDamage (void)
 
        cl.faceanimtime = cl.time + 0.2;                // put sbar face into pain frame
 
-       cl.cshifts[CSHIFT_DAMAGE].percent += 3*count;
+       cl.cshifts[CSHIFT_DAMAGE].percent += (int)(3*count);
        if (cl.cshifts[CSHIFT_DAMAGE].percent < 0)
                cl.cshifts[CSHIFT_DAMAGE].percent = 0;
        if (cl.cshifts[CSHIFT_DAMAGE].percent > 150)
@@ -511,11 +511,11 @@ void V_CalcRefdef (void)
 void V_FadeViewFlashs(void)
 {
        // drop the damage value
-       cl.cshifts[CSHIFT_DAMAGE].percent -= (cl.time - cl.oldtime)*150;
+       cl.cshifts[CSHIFT_DAMAGE].percent -= (int)((cl.time - cl.oldtime)*150);
        if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)
                cl.cshifts[CSHIFT_DAMAGE].percent = 0;
        // drop the bonus value
-       cl.cshifts[CSHIFT_BONUS].percent -= (cl.time - cl.oldtime)*100;
+       cl.cshifts[CSHIFT_BONUS].percent -= (int)((cl.time - cl.oldtime)*100);
        if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
                cl.cshifts[CSHIFT_BONUS].percent = 0;
 }
diff --git a/world.c b/world.c
index a435447..b9ef9ba 100644 (file)
--- a/world.c
+++ b/world.c
@@ -338,7 +338,7 @@ void SV_LinkEdict (prvm_edict_t *ent, qboolean touch_triggers)
 
        if (ent->fields.server->solid == SOLID_BSP)
        {
-               int modelindex = ent->fields.server->modelindex;
+               int modelindex = (int)ent->fields.server->modelindex;
                if (modelindex < 0 || modelindex > MAX_MODELS)
                {
                        Con_Printf("edict %i: SOLID_BSP with invalid modelindex!\n", PRVM_NUM_FOR_EDICT(ent));
@@ -442,7 +442,7 @@ trace_t SV_ClipMoveToEntity(prvm_edict_t *ent, const vec3_t start, const vec3_t
 
        if ((int) ent->fields.server->solid == SOLID_BSP || movetype == MOVE_HITMODEL)
        {
-               unsigned int modelindex = ent->fields.server->modelindex;
+               unsigned int modelindex = (unsigned int)ent->fields.server->modelindex;
                // if the modelindex is 0, it shouldn't be SOLID_BSP!
                if (modelindex == 0)
                {
index f6e6e13..c71d2e8 100644 (file)
@@ -322,7 +322,7 @@ void CSSV_LinkEdict (prvm_edict_t *ent, qboolean touch_triggers)
 
        if (ent->fields.client->solid == SOLID_BSP)
        {
-               int modelindex = ent->fields.client->modelindex;
+               int modelindex = (int)ent->fields.client->modelindex;
                if (modelindex < 0 || modelindex > MAX_MODELS)
                {
                        Con_Printf("edict %i: SOLID_BSP with invalid modelindex!\n", PRVM_NUM_FOR_EDICT(ent));
@@ -450,7 +450,7 @@ trace_t CSSV_ClipMoveToEntity(prvm_edict_t *ent, const vec3_t start, const vec3_
 
        if ((int) ent->fields.client->solid == SOLID_BSP || movetype == MOVE_HITMODEL)
        {
-               unsigned int modelindex = ent->fields.client->modelindex;
+               unsigned int modelindex = (unsigned int)ent->fields.client->modelindex;
                // if the modelindex is 0, it shouldn't be SOLID_BSP!
                if (modelindex == 0)
                {