Avoided variable array initializations which some compilers do not like; Also made sure declarations happen first inside (sub)functions; Fixed set but unused variables
This commit is contained in:
parent
80bf0580e4
commit
52f3f87359
14
3d/interp.c
14
3d/interp.c
|
@ -1,4 +1,3 @@
|
|||
/* $Id: interp.c,v 1.1.1.1 2006/03/17 19:52:13 zicodxx Exp $ */
|
||||
/*
|
||||
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||
|
@ -18,10 +17,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef RCS
|
||||
static char rcsid[] = "$Id: interp.c,v 1.1.1.1 2006/03/17 19:52:13 zicodxx Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "error.h"
|
||||
|
||||
|
@ -453,8 +448,9 @@ bool g3_draw_polygon_model(void *model_ptr,grs_bitmap **model_bitmaps,vms_angvec
|
|||
Assert( nv < MAX_POINTS_PER_POLY );
|
||||
if (g3_check_normal_facing(vp(p+4),vp(p+16)) > 0) {
|
||||
int i;
|
||||
g3s_lrgb light, lrgb_list[nv];
|
||||
g3s_lrgb light, *lrgb_list;
|
||||
|
||||
MALLOC(lrgb_list, g3s_lrgb, nv);
|
||||
//calculate light from surface normal
|
||||
if (glow_num < 0) //no glow
|
||||
{
|
||||
|
@ -487,6 +483,7 @@ bool g3_draw_polygon_model(void *model_ptr,grs_bitmap **model_bitmaps,vms_angvec
|
|||
point_list[i] = Interp_point_list + wp(p+30)[i];
|
||||
|
||||
g3_draw_tmap(nv,point_list,uvl_list,lrgb_list,model_bitmaps[w(p+28)]);
|
||||
d_free(lrgb_list);
|
||||
}
|
||||
|
||||
p += 30 + ((nv&~1)+1)*2 + nv*12;
|
||||
|
@ -623,10 +620,12 @@ bool g3_draw_morphing_model(void *model_ptr,grs_bitmap **model_bitmaps,vms_angve
|
|||
case OP_TMAPPOLY: {
|
||||
int nv = w(p+2);
|
||||
g3s_uvl *uvl_list;
|
||||
g3s_lrgb light, lrgb_list[nv];
|
||||
g3s_lrgb light, *lrgb_list;
|
||||
g3s_uvl morph_uvls[3];
|
||||
int i,ntris;
|
||||
|
||||
MALLOC(lrgb_list, g3s_lrgb, nv);
|
||||
|
||||
//calculate light from surface normal
|
||||
if (glow_num < 0) //no glow
|
||||
{
|
||||
|
@ -680,6 +679,7 @@ bool g3_draw_morphing_model(void *model_ptr,grs_bitmap **model_bitmaps,vms_angve
|
|||
}
|
||||
|
||||
p += 30 + ((nv&~1)+1)*2 + nv*12;
|
||||
d_free(lrgb_list);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ D2X-Rebirth Changelog
|
|||
main/collide.c, main/escort.c, main/laser.c, main/fireball.c, main/lighting.c: Code consistency checks by _Tyr_; Fixed set but unused variables
|
||||
d2x-rebirth.desktop, SConstruct, misc/physfsx.c: Patches by Hans de Goede: Made the .desktop file follow the official specifications; Added explicit link to libmath for newer versions of binutils; Fixed crash using PhysFS 1.x in PHYSFSX_addArchiveContent()
|
||||
main/kconfig.c, main/menu.c, main/playsave.c, main/playsave.h: Gave throttle it's own sensitivity and deadzone settings; Added patch by Hans de Goede to let Slide-On and Bank-On settings use invert settings from Slide- and Bank-axes
|
||||
3d/interp.c, arch/ogl/ogl.c, main/bm.c, main/endlevel.c: Avoided variable array initializations which some compilers do not like; Also made sure declarations happen first inside (sub)functions; Fixed set but unused variables
|
||||
|
||||
20110925
|
||||
--------
|
||||
|
|
|
@ -818,10 +818,12 @@ bool g3_draw_poly(int nv,g3s_point **pointlist)
|
|||
{
|
||||
int c, index3, index4;
|
||||
float color_r, color_g, color_b, color_a;
|
||||
r_polyc++;
|
||||
GLfloat vertex_array[nv*3];
|
||||
GLfloat color_array[nv*4];
|
||||
GLfloat *vertex_array, *color_array;
|
||||
|
||||
MALLOC(vertex_array, GLfloat, nv*3);
|
||||
MALLOC(color_array, GLfloat, nv*4);
|
||||
|
||||
r_polyc++;
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
c = grd_curcanv->cv_color;
|
||||
|
@ -852,7 +854,10 @@ bool g3_draw_poly(int nv,g3s_point **pointlist)
|
|||
glDrawArrays(GL_TRIANGLE_FAN, 0, nv);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
|
||||
d_free(vertex_array);
|
||||
d_free(color_array);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -872,11 +877,8 @@ extern void (*tmap_drawer_ptr)(grs_bitmap *bm,int nv,g3s_point **vertlist);
|
|||
bool g3_draw_tmap(int nv,g3s_point **pointlist,g3s_uvl *uvl_list,g3s_lrgb *light_rgb,grs_bitmap *bm)
|
||||
{
|
||||
int c, index2, index3, index4;
|
||||
GLfloat vertex_array[nv*3];
|
||||
GLfloat color_array[nv*4];
|
||||
GLfloat texcoord_array[nv*2];
|
||||
GLfloat color_alpha = 1.0;
|
||||
|
||||
GLfloat *vertex_array, *color_array, *texcoord_array, color_alpha = 1.0;
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
|
@ -895,7 +897,11 @@ bool g3_draw_tmap(int nv,g3s_point **pointlist,g3s_uvl *uvl_list,g3s_lrgb *light
|
|||
glmprintf((0,"g3_draw_tmap: unhandled tmap_drawer %p\n",tmap_drawer_ptr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
MALLOC(vertex_array, GLfloat, nv*3);
|
||||
MALLOC(color_array, GLfloat, nv*4);
|
||||
MALLOC(texcoord_array, GLfloat, nv*2);
|
||||
|
||||
for (c=0; c<nv; c++) {
|
||||
index2 = c * 2;
|
||||
index3 = c * 3;
|
||||
|
@ -931,7 +937,11 @@ bool g3_draw_tmap(int nv,g3s_point **pointlist,g3s_uvl *uvl_list,g3s_lrgb *light
|
|||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
|
||||
d_free(vertex_array);
|
||||
d_free(color_array);
|
||||
d_free(texcoord_array);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -940,9 +950,13 @@ bool g3_draw_tmap(int nv,g3s_point **pointlist,g3s_uvl *uvl_list,g3s_lrgb *light
|
|||
*/
|
||||
bool g3_draw_tmap_2(int nv, g3s_point **pointlist, g3s_uvl *uvl_list, g3s_lrgb *light_rgb, grs_bitmap *bmbot, grs_bitmap *bm, int orient)
|
||||
{
|
||||
int c, index2, index3, index4;;
|
||||
GLfloat vertex_array[nv*3], color_array[nv*4], texcoord_array[nv*2];
|
||||
|
||||
int c, index2, index3, index4;
|
||||
GLfloat *vertex_array, *color_array, *texcoord_array;
|
||||
|
||||
MALLOC(vertex_array, GLfloat, nv*3);
|
||||
MALLOC(color_array, GLfloat, nv*4);
|
||||
MALLOC(texcoord_array, GLfloat, nv*2);
|
||||
|
||||
g3_draw_tmap(nv,pointlist,uvl_list,light_rgb,bmbot);//draw the bottom texture first.. could be optimized with multitexturing..
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
|
@ -995,7 +1009,11 @@ bool g3_draw_tmap_2(int nv, g3s_point **pointlist, g3s_uvl *uvl_list, g3s_lrgb *
|
|||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
|
||||
d_free(vertex_array);
|
||||
d_free(color_array);
|
||||
d_free(texcoord_array);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1728,7 +1746,7 @@ void ogl_freebmtexture(grs_bitmap *bm){
|
|||
*/
|
||||
bool ogl_ubitmapm_cs(int x, int y,int dw, int dh, grs_bitmap *bm,int c, int scale) // to scale bitmaps
|
||||
{
|
||||
GLfloat xo,yo,xf,yf,u1,u2,v1,v2,color_r,color_g,color_b,h,a;
|
||||
GLfloat xo,yo,xf,yf,u1,u2,v1,v2,color_r,color_g,color_b,h;
|
||||
GLfloat color_array[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
||||
GLfloat texcoord_array[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
||||
GLfloat vertex_array[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
||||
|
@ -1753,7 +1771,6 @@ bool ogl_ubitmapm_cs(int x, int y,int dw, int dh, grs_bitmap *bm,int c, int scal
|
|||
else if (dh == 0)
|
||||
dh = bm->bm_h;
|
||||
|
||||
a = (double) grd_curscreen->sc_w / (double) grd_curscreen->sc_h;
|
||||
h = (double) scale / (double) F1_0;
|
||||
|
||||
xo = x / ((double) last_width * h);
|
||||
|
|
12
main/bm.c
12
main/bm.c
|
@ -276,8 +276,7 @@ void bm_free_extra_models()
|
|||
void bm_read_extra_robots(char *fname,int type)
|
||||
{
|
||||
PHYSFS_file *fp;
|
||||
int t,i;
|
||||
int version;
|
||||
int t,i,version;
|
||||
|
||||
fp = PHYSFSX_openReadBuffered(fname);
|
||||
|
||||
|
@ -291,6 +290,7 @@ void bm_read_extra_robots(char *fname,int type)
|
|||
}
|
||||
else
|
||||
version = 0;
|
||||
(void)version; // NOTE: we do not need it, but keep it for possible further use
|
||||
|
||||
bm_free_extra_models();
|
||||
bm_free_extra_objbitmaps();
|
||||
|
@ -586,7 +586,7 @@ int load_exit_models()
|
|||
|
||||
void compute_average_rgb(grs_bitmap *bm, fix *rgb)
|
||||
{
|
||||
ubyte buf[bm->bm_w*bm->bm_h];
|
||||
ubyte *buf;
|
||||
int i, x, y, color, count;
|
||||
fix t_rgb[3] = { 0, 0, 0 };
|
||||
|
||||
|
@ -595,7 +595,8 @@ void compute_average_rgb(grs_bitmap *bm, fix *rgb)
|
|||
if (!bm->bm_data)
|
||||
return;
|
||||
|
||||
memset(&buf,0,bm->bm_w*bm->bm_h);
|
||||
MALLOC(buf, ubyte, bm->bm_w*bm->bm_h);
|
||||
memset(buf,0,bm->bm_w*bm->bm_h);
|
||||
|
||||
if (bm->bm_flags & BM_FLAG_RLE){
|
||||
unsigned char * dbits;
|
||||
|
@ -620,7 +621,7 @@ void compute_average_rgb(grs_bitmap *bm, fix *rgb)
|
|||
}
|
||||
else
|
||||
{
|
||||
memcpy(&buf, bm->bm_data, sizeof(unsigned char)*(bm->bm_w*bm->bm_h));
|
||||
memcpy(buf, bm->bm_data, sizeof(unsigned char)*(bm->bm_w*bm->bm_h));
|
||||
}
|
||||
|
||||
i = 0;
|
||||
|
@ -641,4 +642,5 @@ void compute_average_rgb(grs_bitmap *bm, fix *rgb)
|
|||
}
|
||||
}
|
||||
}
|
||||
d_free(buf);
|
||||
}
|
||||
|
|
|
@ -970,9 +970,10 @@ void render_external_scene(fix eye_offset)
|
|||
#ifdef OGL
|
||||
int orig_Render_depth = Render_depth;
|
||||
#endif
|
||||
Viewer_eye = Viewer->pos;
|
||||
g3s_lrgb lrgb = { f1_0, f1_0, f1_0 };
|
||||
|
||||
Viewer_eye = Viewer->pos;
|
||||
|
||||
if (eye_offset)
|
||||
vm_vec_scale_add2(&Viewer_eye,&Viewer->orient.rvec,eye_offset);
|
||||
|
||||
|
|
Loading…
Reference in a new issue