mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
compile fixes for alpha linux
This commit is contained in:
parent
77288fe90b
commit
498bdcc406
9 changed files with 180 additions and 172 deletions
7
libs/gib/.gitignore
vendored
Normal file
7
libs/gib/.gitignore
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
*.la
|
||||
*.lo
|
||||
.deps
|
||||
.libs
|
||||
.vimrc
|
||||
Makefile
|
||||
Makefile.in
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue