now compiles on x86_64 successfully (still a crash regarding progs strings to fix...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 5 Oct 2004 17:44:16 +0000 (17:44 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 5 Oct 2004 17:44:16 +0000 (17:44 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4597 d7cf8633-e32d-0410-b094-e92efae38249

gl_rsurf.c
makefile
makefile.bsd
makefile.inc
progs.h
progsvm.h
r_shadow.c
sys_sdl.c
vid_sdl.c

index 4fbf788..a456e57 100644 (file)
@@ -1901,7 +1901,7 @@ void R_DrawCollisionBrush(colbrushf_t *brush)
        memset(&m, 0, sizeof(m));
        m.pointer_vertex = brush->points->v;
        R_Mesh_State(&m);
-       i = ((int)brush) / sizeof(colbrushf_t);
+       i = (int)(((size_t)brush) / sizeof(colbrushf_t));
        GL_Color((i & 31) * (1.0f / 32.0f), ((i >> 5) & 31) * (1.0f / 32.0f), ((i >> 10) & 31) * (1.0f / 32.0f), 0.2f);
        GL_LockArrays(0, brush->numpoints);
        R_Mesh_Draw(brush->numpoints, brush->numtriangles, brush->elements);
@@ -1917,7 +1917,7 @@ void R_Q3BSP_DrawCollisionFace(entity_render_t *ent, q3msurface_t *face)
        memset(&m, 0, sizeof(m));
        m.pointer_vertex = face->data_collisionvertex3f;
        R_Mesh_State(&m);
-       i = ((int)face) / sizeof(q3msurface_t);
+       i = (int)(((size_t)face) / sizeof(q3msurface_t));
        GL_Color((i & 31) * (1.0f / 32.0f), ((i >> 5) & 31) * (1.0f / 32.0f), ((i >> 10) & 31) * (1.0f / 32.0f), 0.2f);
        GL_LockArrays(0, face->num_collisionvertices);
        R_Mesh_Draw(face->num_collisionvertices, face->num_collisiontriangles, face->data_collisionelement3i);
index 87de662..bba5e01 100644 (file)
--- a/makefile
+++ b/makefile
@@ -28,6 +28,14 @@ else
 endif
 
 
+DP_MACHINE:=$(shell uname -m)
+ifeq ($(DP_MACHINE),x86_64)
+       UNIX_X11LIBPATH:=-L/usr/X11R6/lib64
+else
+       UNIX_X11LIBPATH:=-L/usr/X11R6/lib
+endif
+
+
 # Linux configuration
 ifeq ($(DP_MAKE_TARGET), linux)
        OBJ_SOUND=$(OBJ_LINUXSOUND)
index f593d83..04821dd 100644 (file)
@@ -10,6 +10,8 @@ DP_MAKE_TARGET=bsd
 # Command used to delete files
 CMD_RM=$(CMD_UNIXRM)
 
+# FIXME: should support lib64 based on uname -m output
+UNIX_X11LIBPATH=-L/usr/X11R6/lib
 
 # BSD configuration
 .if $(DP_MAKE_TARGET) == "bsd"
index d0cf6b4..4443fd0 100644 (file)
@@ -133,7 +133,8 @@ LDFLAGS_RELEASE=
 OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
 
 LDFLAGS_UNIXCOMMON=-lm
-LDFLAGS_UNIXCL=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
+#LDFLAGS_UNIXCL=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
+LDFLAGS_UNIXCL=$(UNIX_X11LIBPATH) -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
 LDFLAGS_UNIXSDL=`sdl-config --libs`
 EXE_UNIXCL=darkplaces-glx
 EXE_UNIXSV=darkplaces-dedicated
diff --git a/progs.h b/progs.h
index 6992e5c..99cf61f 100644 (file)
--- a/progs.h
+++ b/progs.h
@@ -227,7 +227,7 @@ void ED_PrintEdicts (void);
 void ED_PrintNum (int ent);
 
 #define PR_GetString(num) (pr_strings + num) 
-#define PR_SetString(s)   ((int) (s) ? (s - pr_strings) : 0)
+#define PR_SetString(s)   ((s) != NULL ? (int) (s - pr_strings) : 0)
 
 #endif
 
index d461da3..3e64d43 100644 (file)
--- a/progsvm.h
+++ b/progsvm.h
@@ -388,7 +388,7 @@ prvm_edict_t *PRVM_EDICT_NUM_ERROR(int n, char *filename, int fileline);
 #define        PRVM_EDICT_NUM(n) (((n) >= 0 && (n) < prog->max_edicts) ? prog->edicts + (n) : PRVM_EDICT_NUM_ERROR(n, __FILE__, __LINE__))
 
 //int NUM_FOR_EDICT_ERROR(edict_t *e);
-#define PRVM_NUM_FOR_EDICT(e) ((prvm_edict_t *)(e) - prog->edicts)
+#define PRVM_NUM_FOR_EDICT(e) ((int)((prvm_edict_t *)(e) - prog->edicts))
 //int NUM_FOR_EDICT(edict_t *e);
 
 #define        PRVM_NEXT_EDICT(e) ((e) + 1)
@@ -423,7 +423,7 @@ void PRVM_ED_PrintEdicts_f (void);
 void PRVM_ED_PrintNum (int ent);
 
 #define PRVM_GetString(num) (prog->strings + num)
-#define PRVM_SetString(s)   ((int) (s) ? (s - prog->strings) : 0)
+#define PRVM_SetString(s)   ((s) != NULL ? (int) (s - prog->strings) : 0)
 
 //============================================================================
 
index 1c03ec2..ad071ac 100644 (file)
@@ -2487,8 +2487,8 @@ void R_Shadow_DrawLightSprites(void)
                        lighttextures[i] = pic->tex;
        }
 
-       for (light = r_shadow_worldlightchain;light;light = light->next)
-               R_MeshQueue_AddTransparent(light->origin, R_Shadow_DrawLightSpriteCallback, light, ((int) light) % 5);
+       for (i = 0, light = r_shadow_worldlightchain;light;i++, light = light->next)
+               R_MeshQueue_AddTransparent(light->origin, R_Shadow_DrawLightSpriteCallback, light, i % 5);
        R_MeshQueue_AddTransparent(r_editlights_cursorlocation, R_Shadow_DrawCursorCallback, NULL, 0);
 }
 
index 3bdbc7e..97c2cec 100644 (file)
--- a/sys_sdl.c
+++ b/sys_sdl.c
@@ -209,7 +209,7 @@ char *Sys_GetClipboardData (void)
 #endif
 }
 
-int SDL_main (int argc, char *argv[])
+int main (int argc, const char *argv[])
 {
        double frameoldtime, framenewtime;
 
index b3dcd0c..86af512 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -281,10 +281,12 @@ void Sys_SendKeyEvents( void )
                                break;
                        case SDL_ACTIVEEVENT:
                                if( event.active.state == SDL_APPACTIVE ) 
+                               {
                                        if( event.active.gain )
                                                vid_hidden = false;
                                        else
                                                vid_hidden = true;
+                               }
                                break;
                        case SDL_MOUSEBUTTONDOWN:
                                if( event.button.button == SDL_BUTTON_MIDDLE )