From 498bdcc406448aceef980a9957bd9c3769a4a80e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 10 Nov 2002 02:50:42 +0000 Subject: [PATCH] compile fixes for alpha linux --- libs/gib/.gitignore | 7 + libs/gib/gib_builtin.c | 2 +- libs/video/renderer/sw/d_polyse.c | 306 +++++++++++++++--------------- tools/qfbsp/source/qfbsp.c | 4 +- tools/qfcc/source/qfodump.c | 4 +- tools/qfcc/source/strpool.c | 6 +- tools/qfdefs/source/gendefs.c | 12 +- tools/qflight/source/threads.c | 5 +- tools/qfvis/source/qfvis.c | 6 +- 9 files changed, 180 insertions(+), 172 deletions(-) create mode 100644 libs/gib/.gitignore diff --git a/libs/gib/.gitignore b/libs/gib/.gitignore new file mode 100644 index 000000000..f4a8d5fec --- /dev/null +++ b/libs/gib/.gitignore @@ -0,0 +1,7 @@ +*.la +*.lo +.deps +.libs +.vimrc +Makefile +Makefile.in diff --git a/libs/gib/gib_builtin.c b/libs/gib/gib_builtin.c index 134f58c2e..0cc8fdd6e 100644 --- a/libs/gib/gib_builtin.c +++ b/libs/gib/gib_builtin.c @@ -458,7 +458,7 @@ GIB_String_Length_f (void) "string.length: invalid syntax\n" "usage: string.length string"); else - GIB_Return (va("%i", strlen(GIB_Argv(1)))); + GIB_Return (va("%i", (int) strlen(GIB_Argv(1)))); } void diff --git a/libs/video/renderer/sw/d_polyse.c b/libs/video/renderer/sw/d_polyse.c index 8b72d9fd0..71c8c795d 100644 --- a/libs/video/renderer/sw/d_polyse.c +++ b/libs/video/renderer/sw/d_polyse.c @@ -122,50 +122,131 @@ byte *skinstart; #undef USE_INTEL_ASM //XXX asm pic hack #endif + +void +D_PolysetSetEdgeTable (void) +{ + int edgetableindex; + + // assume the vertices are already in top to bottom order + edgetableindex = 0; + + // determine which edges are right & left, and the order in which + // to rasterize them + if (r_p0[1] >= r_p1[1]) { + if (r_p0[1] == r_p1[1]) { + if (r_p0[1] < r_p2[1]) + pedgetable = &edgetables[2]; + else + pedgetable = &edgetables[5]; + + return; + } else { + edgetableindex = 1; + } + } + + if (r_p0[1] == r_p2[1]) { + if (edgetableindex) + pedgetable = &edgetables[8]; + else + pedgetable = &edgetables[9]; + + return; + } else if (r_p1[1] == r_p2[1]) { + if (edgetableindex) + pedgetable = &edgetables[10]; + else + pedgetable = &edgetables[11]; + + return; + } + + if (r_p0[1] > r_p2[1]) + edgetableindex += 2; + + if (r_p1[1] > r_p2[1]) + edgetableindex += 4; + + pedgetable = &edgetables[edgetableindex]; +} + #ifndef USE_INTEL_ASM void -D_PolysetDraw (void) +D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3) { - spanpackage_t spans[DPS_MAXSPANS + 1 + - ((CACHE_SIZE - 1) / sizeof (spanpackage_t)) + 1]; - - // one extra because of cache line pretouching - - a_spans = (spanpackage_t *) - (((long) &spans[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1)); - - if (r_affinetridesc.drawtype) { - D_DrawSubdiv (); - } else { - D_DrawNonSubdiv (); - } -} - - -void -D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts) -{ - int i, z; + int *temp; + int d; + int new[6]; + int z; short *zbuf; - for (i = 0; i < numverts; i++, fv++) { - // valid triangle coordinates for filling can include the bottom and - // right clip edges, due to the fill rule; these shouldn't be drawn - if ((fv->v[0] < r_refdef.vrectright) && - (fv->v[1] < r_refdef.vrectbottom)) { - z = fv->v[5] >> 16; - zbuf = zspantable[fv->v[1]] + fv->v[0]; - if (z >= *zbuf) { - int pix; + d = lp2[0] - lp1[0]; + if (d < -1 || d > 1) + goto split; + d = lp2[1] - lp1[1]; + if (d < -1 || d > 1) + goto split; - *zbuf = z; - pix = skintable[fv->v[3] >> 16][fv->v[2] >> 16]; - pix = ((byte *) acolormap)[pix + (fv->v[4] & 0xFF00)]; - d_viewbuffer[d_scantable[fv->v[1]] + fv->v[0]] = pix; - } - } + d = lp3[0] - lp2[0]; + if (d < -1 || d > 1) + goto split2; + d = lp3[1] - lp2[1]; + if (d < -1 || d > 1) + goto split2; + + d = lp1[0] - lp3[0]; + if (d < -1 || d > 1) + goto split3; + d = lp1[1] - lp3[1]; + if (d < -1 || d > 1) { + split3: + temp = lp1; + lp1 = lp3; + lp3 = lp2; + lp2 = temp; + + goto split; } + + return; // entire tri is filled + + split2: + temp = lp1; + lp1 = lp2; + lp2 = lp3; + lp3 = temp; + + split: + // split this edge + new[0] = (lp1[0] + lp2[0]) >> 1; + new[1] = (lp1[1] + lp2[1]) >> 1; + new[2] = (lp1[2] + lp2[2]) >> 1; + new[3] = (lp1[3] + lp2[3]) >> 1; + new[5] = (lp1[5] + lp2[5]) >> 1; + + // draw the point if splitting a leading edge + if (lp2[1] > lp1[1]) + goto nodraw; + if ((lp2[1] == lp1[1]) && (lp2[0] < lp1[0])) + goto nodraw; + + + z = new[5] >> 16; + zbuf = zspantable[new[1]] + new[0]; + if (z >= *zbuf) { + int pix; + + *zbuf = z; + pix = d_pcolormap[skintable[new[3] >> 16][new[2] >> 16]]; + d_viewbuffer[d_scantable[new[1]] + new[0]] = pix; + } + + nodraw: + // recursively continue + D_PolysetRecursiveTriangle (lp3, lp1, new); + D_PolysetRecursiveTriangle (lp3, new, lp2); } @@ -282,79 +363,47 @@ D_DrawNonSubdiv (void) void -D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3) +D_PolysetDraw (void) { - int *temp; - int d; - int new[6]; - int z; + spanpackage_t spans[DPS_MAXSPANS + 1 + + ((CACHE_SIZE - 1) / sizeof (spanpackage_t)) + 1]; + + // one extra because of cache line pretouching + + a_spans = (spanpackage_t *) + (((long) &spans[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1)); + + if (r_affinetridesc.drawtype) { + D_DrawSubdiv (); + } else { + D_DrawNonSubdiv (); + } +} + + +void +D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts) +{ + int i, z; short *zbuf; - d = lp2[0] - lp1[0]; - if (d < -1 || d > 1) - goto split; - d = lp2[1] - lp1[1]; - if (d < -1 || d > 1) - goto split; + for (i = 0; i < numverts; i++, fv++) { + // valid triangle coordinates for filling can include the bottom and + // right clip edges, due to the fill rule; these shouldn't be drawn + if ((fv->v[0] < r_refdef.vrectright) && + (fv->v[1] < r_refdef.vrectbottom)) { + z = fv->v[5] >> 16; + zbuf = zspantable[fv->v[1]] + fv->v[0]; + if (z >= *zbuf) { + int pix; - d = lp3[0] - lp2[0]; - if (d < -1 || d > 1) - goto split2; - d = lp3[1] - lp2[1]; - if (d < -1 || d > 1) - goto split2; - - d = lp1[0] - lp3[0]; - if (d < -1 || d > 1) - goto split3; - d = lp1[1] - lp3[1]; - if (d < -1 || d > 1) { - split3: - temp = lp1; - lp1 = lp3; - lp3 = lp2; - lp2 = temp; - - goto split; + *zbuf = z; + pix = skintable[fv->v[3] >> 16][fv->v[2] >> 16]; + pix = ((byte *) acolormap)[pix + (fv->v[4] & 0xFF00)]; + d_viewbuffer[d_scantable[fv->v[1]] + fv->v[0]] = pix; + } + } } - - return; // entire tri is filled - - split2: - temp = lp1; - lp1 = lp2; - lp2 = lp3; - lp3 = temp; - - split: - // split this edge - new[0] = (lp1[0] + lp2[0]) >> 1; - new[1] = (lp1[1] + lp2[1]) >> 1; - new[2] = (lp1[2] + lp2[2]) >> 1; - new[3] = (lp1[3] + lp2[3]) >> 1; - new[5] = (lp1[5] + lp2[5]) >> 1; - - // draw the point if splitting a leading edge - if (lp2[1] > lp1[1]) - goto nodraw; - if ((lp2[1] == lp1[1]) && (lp2[0] < lp1[0])) - goto nodraw; - - - z = new[5] >> 16; - zbuf = zspantable[new[1]] + new[0]; - if (z >= *zbuf) { - int pix; - - *zbuf = z; - pix = d_pcolormap[skintable[new[3] >> 16][new[2] >> 16]]; - d_viewbuffer[d_scantable[new[1]] + new[0]] = pix; - } - - nodraw: - // recursively continue - D_PolysetRecursiveTriangle (lp3, lp1, new); - D_PolysetRecursiveTriangle (lp3, new, lp2); } #endif // !USE_INTEL_ASM @@ -836,55 +885,6 @@ D_RasterizeAliasPolySmooth (void) } -void -D_PolysetSetEdgeTable (void) -{ - int edgetableindex; - - // assume the vertices are already in top to bottom order - edgetableindex = 0; - - // determine which edges are right & left, and the order in which - // to rasterize them - if (r_p0[1] >= r_p1[1]) { - if (r_p0[1] == r_p1[1]) { - if (r_p0[1] < r_p2[1]) - pedgetable = &edgetables[2]; - else - pedgetable = &edgetables[5]; - - return; - } else { - edgetableindex = 1; - } - } - - if (r_p0[1] == r_p2[1]) { - if (edgetableindex) - pedgetable = &edgetables[8]; - else - pedgetable = &edgetables[9]; - - return; - } else if (r_p1[1] == r_p2[1]) { - if (edgetableindex) - pedgetable = &edgetables[10]; - else - pedgetable = &edgetables[11]; - - return; - } - - if (r_p0[1] > r_p2[1]) - edgetableindex += 2; - - if (r_p1[1] > r_p2[1]) - edgetableindex += 4; - - pedgetable = &edgetables[edgetableindex]; -} - - #if 0 void diff --git a/tools/qfbsp/source/qfbsp.c b/tools/qfbsp/source/qfbsp.c index 7be5e96e3..4af1dc7f2 100644 --- a/tools/qfbsp/source/qfbsp.c +++ b/tools/qfbsp/source/qfbsp.c @@ -755,12 +755,12 @@ CreateHulls (void) if (!fork ()) { hullnum = 1; options.verbosity = 0; - drawflag = false; + options.drawflag = false; sprintf (argv0, "HUL%i", hullnum); } else if (!fork ()) { hullnum = 2; options.verbosity = 0; - drawflag = false; + options.drawflag = false; sprintf (argv0, "HUL%i", hullnum); } CreateSingleHull (); diff --git a/tools/qfcc/source/qfodump.c b/tools/qfcc/source/qfodump.c index e5adcd496..33201ef84 100644 --- a/tools/qfcc/source/qfodump.c +++ b/tools/qfcc/source/qfodump.c @@ -81,8 +81,8 @@ dump_defs (qfo_t *qfo) qfo_func_t *func; for (def = qfo->defs; def - qfo->defs < qfo->num_defs; def++) { - printf ("%5d %4d %4x %d %s %s %d %d %s:%d\n", - def - qfo->defs, + printf ("%5ld %4d %4x %d %s %s %d %d %s:%d\n", + (long) (def - qfo->defs), def->ofs, def->flags, def->basic_type, diff --git a/tools/qfcc/source/strpool.c b/tools/qfcc/source/strpool.c index 10ba4cf0c..28f6c2eee 100644 --- a/tools/qfcc/source/strpool.c +++ b/tools/qfcc/source/strpool.c @@ -48,7 +48,7 @@ static const char rcsid[] = static const char * strpool_get_key (void *_str, void *_strpool) { - int str = (long) _str; + long str = (long) _str; strpool_t *strpool = (strpool_t *) _strpool; return strpool->strings + str; @@ -70,7 +70,7 @@ strpool_new (void) strpool_t * strpool_build (const char *strings, int size) { - int s; + long s; strpool_t *strpool = malloc (sizeof (strpool_t)); strpool->str_tab = Hash_NewTable (16381, strpool_get_key, 0, strpool); @@ -96,7 +96,7 @@ strpool_delete (strpool_t *strpool) int strpool_addstr (strpool_t *strpool, const char *str) { - int s; + long s; int len; if (!str || !*str) diff --git a/tools/qfdefs/source/gendefs.c b/tools/qfdefs/source/gendefs.c index 09c5d1bc4..961015149 100644 --- a/tools/qfdefs/source/gendefs.c +++ b/tools/qfdefs/source/gendefs.c @@ -53,26 +53,26 @@ output_def (FILE *out, const char *line) ; if (strncmp ("int", type, type_e - type) == 0) { fprintf (out, "\t{ev_entity | DEF_SAVEGLOBAL,\t%d,\t\"%.*s\"},\n", - offset, name_e - name, name); + offset, (int) (name_e - name), name); offset += 1; } else if (strncmp ("float", type, type_e - type) == 0) { fprintf (out, "\t{ev_float | DEF_SAVEGLOBAL,\t%d,\t\"%.*s\"},\n", - offset, name_e - name, name); + offset, (int) (name_e - name), name); offset += 1; } else if (strncmp ("string_t", type, type_e - type) == 0) { fprintf (out, "\t{ev_string | DEF_SAVEGLOBAL,\t%d,\t\"%.*s\"},\n", - offset, name_e - name, name); + offset, (int) (name_e - name), name); offset += 1; } else if (strncmp ("vec3_t", type, type_e - type) == 0) { fprintf (out, "\t{ev_vector | DEF_SAVEGLOBAL,\t%d,\t\"%.*s\"},\n", - offset, name_e - name, name); + offset, (int) (name_e - name), name); offset += 3; } else if (strncmp ("func_t", type, type_e - type) == 0) { fprintf (out, "\t{ev_func,\t%d,\t\"%.*s\"},\n", - offset, name_e - name, name); + offset, (int) (name_e - name), name); offset += 1; } else { - fprintf (stderr, "unknown type %.*s\n", type_e - type, type); + fprintf (stderr, "unknown type %.*s\n", (int) (type_e - type), type); exit (1); } } diff --git a/tools/qflight/source/threads.c b/tools/qflight/source/threads.c index ce4fa7a43..0f60b9ac8 100644 --- a/tools/qflight/source/threads.c +++ b/tools/qflight/source/threads.c @@ -81,7 +81,7 @@ RunThreadsOn (threadfunc_t *func) pthread_t work_threads[256]; void *status; pthread_attr_t attrib; - int i; + long i; if (pthread_attr_init (&attrib) == -1) fprintf (stderr, "pthread_attr_init failed"); @@ -89,7 +89,8 @@ RunThreadsOn (threadfunc_t *func) fprintf (stderr, "pthread_attr_setstacksize failed"); for (i = 0; i < options.threads; i++) { - if (pthread_create (&work_threads[i], &attrib, func, (void *) i) == -1) + if (pthread_create (&work_threads[i], &attrib, func, + (void *) i) == -1) fprintf (stderr, "pthread_create failed"); } diff --git a/tools/qfvis/source/qfvis.c b/tools/qfvis/source/qfvis.c index 4f15bb6aa..ea8725787 100644 --- a/tools/qfvis/source/qfvis.c +++ b/tools/qfvis/source/qfvis.c @@ -114,7 +114,7 @@ NewWinding (int points) if (points > MAX_POINTS_ON_WINDING) Sys_Error ("NewWinding: %i points", points); - size = (int) ((winding_t *) 0)->points[points]; + size = (long) ((winding_t *) 0)->points[points]; winding = calloc (1, size); return winding; @@ -133,7 +133,7 @@ CopyWinding (winding_t *winding) int size; winding_t *copy; - size = (int) ((winding_t *) 0)->points[winding->numpoints]; + size = (long) ((winding_t *) 0)->points[winding->numpoints]; copy = malloc (size); memcpy (copy, winding, size); copy->original = false; @@ -373,7 +373,7 @@ LeafFlow (int leafnum) void CalcPortalVis (void) { - int i; + long i; // fastvis just uses mightsee for a very loose bound if (options.minimal) {