From c0f8811e01672cb11902c9b10bb183cb9640448e Mon Sep 17 00:00:00 2001 From: Pawel Kolodziejski Date: Thu, 13 Jan 2005 00:15:15 +0000 Subject: [PATCH] fixed more warnings --- lua.cpp | 2 +- lua/lapi.cpp | 2 +- lua/llex.cpp | 2 +- lua/lvm.cpp | 8 ++++---- tinygl/api.cpp | 14 +++++++------- tinygl/clip.cpp | 2 +- tinygl/init.cpp | 6 +++--- tinygl/light.cpp | 4 ++-- tinygl/matrix.cpp | 8 ++++---- tinygl/vertex.cpp | 12 ++++++------ tinygl/zgl.h | 2 +- tinygl/ztriangle.cpp | 4 ++-- tinygl/ztriangle.h | 34 +++++++++++++++++----------------- 13 files changed, 50 insertions(+), 50 deletions(-) diff --git a/lua.cpp b/lua.cpp index fbc745d59c9..7d500de2ece 100644 --- a/lua.cpp +++ b/lua.cpp @@ -1422,7 +1422,7 @@ static void SetAmbientLight() { } static void EngineDisplay() { - /*bool mode = */check_int(1) != 0; + /*bool mode = check_int(1) != 0;*/ // it enable/disable updating display } diff --git a/lua/lapi.cpp b/lua/lapi.cpp index 719ff4f30da..286d31326c5 100644 --- a/lua/lapi.cpp +++ b/lua/lapi.cpp @@ -325,7 +325,7 @@ void lua_pushnil (void) void lua_pushnumber (double n) { ttype(L->stack.top) = LUA_T_NUMBER; - nvalue(L->stack.top) = n; + nvalue(L->stack.top) = (real)n; incr_top; } diff --git a/lua/llex.cpp b/lua/llex.cpp index 6a94fa5bfd1..80b7562fd6d 100644 --- a/lua/llex.cpp +++ b/lua/llex.cpp @@ -428,7 +428,7 @@ int luaX_lex (LexState *LS) { ea *= ea; } } - LS->seminfo.r = a; + LS->seminfo.r = (real)a; return NUMBER; } diff --git a/lua/lvm.cpp b/lua/lvm.cpp index 094d7ea9720..029032a2353 100644 --- a/lua/lvm.cpp +++ b/lua/lvm.cpp @@ -284,7 +284,7 @@ void luaV_pack (StkId firstel, int nvararg, TObject *tab) for (i=0; itop) = LUA_T_NUMBER; - nvalue(S->top) = aux; + nvalue(S->top) = (real)aux; S->top++; break; @@ -475,7 +475,7 @@ StkId luaV_execute (struct CallInfo *ci) TObject *arr = S->top-n-1; for (; n; n--) { ttype(S->top) = LUA_T_NUMBER; - nvalue(S->top) = n+aux; + nvalue(S->top) = (real)(n+aux); *(luaH_set(avalue(arr), S->top)) = *(S->top-1); S->top--; } diff --git a/tinygl/api.cpp b/tinygl/api.cpp index c4d8f7116e3..1df1b7225db 100644 --- a/tinygl/api.cpp +++ b/tinygl/api.cpp @@ -357,12 +357,12 @@ void tglFrustum(double left,double right,double bottom,double top, TGLParam p[7]; p[0].op=OP_Frustum; - p[1].f=left; - p[2].f=right; - p[3].f=bottom; - p[4].f=top; - p[5].f=near; - p[6].f=farv; + p[1].f=(float)left; + p[2].f=(float)right; + p[3].f=(float)bottom; + p[4].f=(float)top; + p[5].f=(float)near; + p[6].f=(float)farv; gl_add_op(p); } @@ -496,7 +496,7 @@ void tglClearDepth(double depth) TGLParam p[2]; p[0].op=OP_ClearDepth; - p[1].f=depth; + p[1].f=(float)depth; gl_add_op(p); } diff --git a/tinygl/clip.cpp b/tinygl/clip.cpp index c98848487f8..e931b431019 100644 --- a/tinygl/clip.cpp +++ b/tinygl/clip.cpp @@ -15,7 +15,7 @@ void gl_transform_to_viewport(GLContext *c,GLVertex *v) float winv; /* coordinates */ - winv=1.0/v->pc.W; + winv=(float)(1.0/v->pc.W); v->zp.x= (int) ( v->pc.X * winv * c->viewport.scale.X + c->viewport.trans.X ); v->zp.y= (int) ( v->pc.Y * winv * c->viewport.scale.Y diff --git a/tinygl/init.cpp b/tinygl/init.cpp index 04efc45ba47..17c0a8a7b9a 100644 --- a/tinygl/init.cpp +++ b/tinygl/init.cpp @@ -80,7 +80,7 @@ void tglInit(void *zbuffer1) l->enabled=0; } c->first_light=NULL; - c->ambient_light_model=gl_V4_New(0.2,0.2,0.2,1); + c->ambient_light_model=gl_V4_New(0.2f,0.2f,0.2f,1); c->local_light_model=0; c->lighting_enabled=0; c->light_model_two_side = 0; @@ -89,8 +89,8 @@ void tglInit(void *zbuffer1) for(i=0;i<2;i++) { GLMaterial *m=&c->materials[i]; m->emission=gl_V4_New(0,0,0,1); - m->ambient=gl_V4_New(0.2,0.2,0.2,1); - m->diffuse=gl_V4_New(0.8,0.8,0.8,1); + m->ambient=gl_V4_New(0.2f,0.2f,0.2f,1); + m->diffuse=(gl_V4_New(0.8f,0.8f,0.8f,1)); m->specular=gl_V4_New(0,0,0,1); m->shininess=0; } diff --git a/tinygl/light.cpp b/tinygl/light.cpp index 9ff2a25f5fc..e12d3b9d97f 100644 --- a/tinygl/light.cpp +++ b/tinygl/light.cpp @@ -113,7 +113,7 @@ void glopLight(GLContext *c,TGLParam *p) float a=v.v[0]; assert(a == 180 || (a>=0 && a<=90)); l->spot_cutoff=a; - if (a != 180) l->cos_spot_cutoff=cos(a * PI / 180.0); + if (a != 180) l->cos_spot_cutoff=(float)(cos(a * PI / 180.0)); } break; case TGL_CONSTANT_ATTENUATION: @@ -268,7 +268,7 @@ void gl_shade_vertex(GLContext *c,GLVertex *v) } else { s.X=d.X; s.Y=d.Y; - s.Z=d.Z+1.0; + s.Z=(float)(d.Z+1.0); } dot_spec=n.X*s.X+n.Y*s.Y+n.Z*s.Z; if (twoside && dot_spec < 0) dot_spec = -dot_spec; diff --git a/tinygl/matrix.cpp b/tinygl/matrix.cpp index c3c7ce071e3..49770b72543 100644 --- a/tinygl/matrix.cpp +++ b/tinygl/matrix.cpp @@ -116,7 +116,7 @@ void glopRotate(GLContext *c,TGLParam *p) float angle; int dir_code; - angle = p[1].f * PI / 180.0; + angle = (float)(p[1].f * PI / 180.0); u[0]=p[2].f; u[1]=p[3].f; u[2]=p[4].f; @@ -221,12 +221,12 @@ void glopFrustum(GLContext *c,TGLParam *p) float farp=p[6].f; float x,y,A,B,C,D; - x = (2.0*near) / (right-left); - y = (2.0*near) / (top-bottom); + x = (float)((2.0*near) / (right-left)); + y = (float)((2.0*near) / (top-bottom)); A = (right+left) / (right-left); B = (top+bottom) / (top-bottom); C = -(farp+near) / ( farp-near); - D = -(2.0*farp*near) / (farp-near); + D = (float)(-(2.0*farp*near) / (farp-near)); r=&m.m[0][0]; r[0]= x; r[1]=0; r[2]=A; r[3]=0; diff --git a/tinygl/vertex.cpp b/tinygl/vertex.cpp index 0c62b80810c..c096278dd9f 100644 --- a/tinygl/vertex.cpp +++ b/tinygl/vertex.cpp @@ -60,13 +60,13 @@ void gl_eval_viewport(GLContext * c) v = &c->viewport; - v->trans.X = ((v->xsize - 0.5) / 2.0) + v->xmin; - v->trans.Y = ((v->ysize - 0.5) / 2.0) + v->ymin; - v->trans.Z = ((zsize - 0.5) / 2.0) + ((1 << ZB_POINT_Z_FRAC_BITS)) / 2; + v->trans.X = (float)(((v->xsize - 0.5) / 2.0) + v->xmin); + v->trans.Y = (float)(((v->ysize - 0.5) / 2.0) + v->ymin); + v->trans.Z = (float)(((zsize - 0.5) / 2.0) + ((1 << ZB_POINT_Z_FRAC_BITS)) / 2); - v->scale.X = (v->xsize - 0.5) / 2.0; - v->scale.Y = -(v->ysize - 0.5) / 2.0; - v->scale.Z = -((zsize - 0.5) / 2.0); + v->scale.X = (float)((v->xsize - 0.5) / 2.0); + v->scale.Y = (float)(-(v->ysize - 0.5) / 2.0); + v->scale.Z = (float)(-((zsize - 0.5) / 2.0)); } void glopBegin(GLContext * c, TGLParam * p) diff --git a/tinygl/zgl.h b/tinygl/zgl.h index d22b29265eb..74ccec26c76 100644 --- a/tinygl/zgl.h +++ b/tinygl/zgl.h @@ -356,7 +356,7 @@ static inline int gl_clipcode(float x,float y,float z,float w1) { float w; - w=w1 * (1.0 + CLIP_EPSILON); + w=(float)(w1 * (1.0 + CLIP_EPSILON)); return (x<-w) | ((x>w)<<1) | ((y<-w)<<2) | diff --git a/tinygl/ztriangle.cpp b/tinygl/ztriangle.cpp index d6a01f884f9..2f076c29aef 100644 --- a/tinygl/ztriangle.cpp +++ b/tinygl/ztriangle.cpp @@ -298,7 +298,7 @@ void ZB_fillTriangleMappingPerspective(ZBuffer *zb, float sz,tz,fz,zinv; \ n=(x2>>16)-x1; \ fz=(float)z1;\ - zinv=1.0 / fz;\ + zinv=(float)(1.0 / fz);\ pp=(PIXEL *)((char *)pp1 + x1 * PSZB); \ pz=pz1+x1; \ z=z1; \ @@ -314,7 +314,7 @@ void ZB_fillTriangleMappingPerspective(ZBuffer *zb, dsdx= (int)( (dszdx - ss*fdzdx)*zinv );\ dtdx= (int)( (dtzdx - tt*fdzdx)*zinv );\ fz+=fndzdx;\ - zinv=1.0 / fz;\ + zinv=(float)(1.0 / fz);\ }\ PUT_PIXEL(0); \ PUT_PIXEL(1); \ diff --git a/tinygl/ztriangle.h b/tinygl/ztriangle.h index b61426420ce..f23ea934afa 100644 --- a/tinygl/ztriangle.h +++ b/tinygl/ztriangle.h @@ -52,16 +52,16 @@ /* we compute dXdx and dXdy for all interpolated values */ - fdx1 = p1->x - p0->x; - fdy1 = p1->y - p0->y; + fdx1 = (float)(p1->x - p0->x); + fdy1 = (float)(p1->y - p0->y); - fdx2 = p2->x - p0->x; - fdy2 = p2->y - p0->y; + fdx2 = (float)(p2->x - p0->x); + fdy2 = (float)(p2->y - p0->y); fz = fdx1 * fdy2 - fdx2 * fdy1; if (fz == 0) return; - fz = 1.0 / fz; + fz = (float)(1.0 / fz); fdx1 *= fz; fdy1 *= fz; @@ -69,38 +69,38 @@ fdy2 *= fz; #ifdef INTERP_Z - d1 = p1->z - p0->z; - d2 = p2->z - p0->z; + d1 = (float)(p1->z - p0->z); + d2 = (float)(p2->z - p0->z); dzdx = (int) (fdy2 * d1 - fdy1 * d2); dzdy = (int) (fdx1 * d2 - fdx2 * d1); #endif #ifdef INTERP_RGB - d1 = p1->r - p0->r; - d2 = p2->r - p0->r; + d1 = (float)(p1->r - p0->r); + d2 = (float)(p2->r - p0->r); drdx = (int) (fdy2 * d1 - fdy1 * d2); drdy = (int) (fdx1 * d2 - fdx2 * d1); - d1 = p1->g - p0->g; - d2 = p2->g - p0->g; + d1 = (float)(p1->g - p0->g); + d2 = (float)(p2->g - p0->g); dgdx = (int) (fdy2 * d1 - fdy1 * d2); dgdy = (int) (fdx1 * d2 - fdx2 * d1); - d1 = p1->b - p0->b; - d2 = p2->b - p0->b; + d1 = (float)(p1->b - p0->b); + d2 = (float)(p2->b - p0->b); dbdx = (int) (fdy2 * d1 - fdy1 * d2); dbdy = (int) (fdx1 * d2 - fdx2 * d1); #endif #ifdef INTERP_ST - d1 = p1->s - p0->s; - d2 = p2->s - p0->s; + d1 = (float)(p1->s - p0->s); + d2 = (float)(p2->s - p0->s); dsdx = (int) (fdy2 * d1 - fdy1 * d2); dsdy = (int) (fdx1 * d2 - fdx2 * d1); - d1 = p1->t - p0->t; - d2 = p2->t - p0->t; + d1 = (float)(p1->t - p0->t); + d2 = (float)(p2->t - p0->t); dtdx = (int) (fdy2 * d1 - fdy1 * d2); dtdy = (int) (fdx1 * d2 - fdx2 * d1); #endif