From 2da3c048ed669c2221c61fb12c108c9588104af9 Mon Sep 17 00:00:00 2001 From: eihrul Date: Fri, 4 Feb 2011 22:22:31 +0000 Subject: [PATCH] use short indices when available instead of int (fixes xonotic console weirdness) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10801 d7cf8633-e32d-0410-b094-e92efae38249 --- dpsoftrast.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/dpsoftrast.c b/dpsoftrast.c index d756c8ee..aff3befe 100644 --- a/dpsoftrast.c +++ b/dpsoftrast.c @@ -4289,18 +4289,18 @@ static void DPSOFTRAST_Interpret_Draw(DPSOFTRAST_State_Thread *thread, DPSOFTRAS // generate the 3 edges of this triangle // generate spans for the triangle - switch based on left split or right split classification of triangle - if (element3i) - { - e[0] = element3i[i*3+0] - firstvertex; - e[1] = element3i[i*3+1] - firstvertex; - e[2] = element3i[i*3+2] - firstvertex; - } - else if (element3s) + if (element3s) { e[0] = element3s[i*3+0] - firstvertex; e[1] = element3s[i*3+1] - firstvertex; e[2] = element3s[i*3+2] - firstvertex; } + else if (element3i) + { + e[0] = element3i[i*3+0] - firstvertex; + e[1] = element3i[i*3+1] - firstvertex; + e[2] = element3i[i*3+2] - firstvertex; + } else { e[0] = i*3+0; @@ -4652,10 +4652,10 @@ static DPSOFTRAST_Command_Draw *DPSOFTRAST_Draw_AllocateDrawCommand(int firstver break; datasize += numvertices*sizeof(float[4]); } - if (element3i) - datasize += numtriangles*sizeof(int[3]); - else if (element3s) + if (element3s) datasize += numtriangles*sizeof(unsigned short[3]); + else if (element3i) + datasize += numtriangles*sizeof(int[3]); datasize = DPSOFTRAST_ALIGNCOMMAND(datasize); if (commandsize + datasize > DPSOFTRAST_DRAW_MAXCOMMANDSIZE) { @@ -4688,16 +4688,16 @@ static DPSOFTRAST_Command_Draw *DPSOFTRAST_Draw_AllocateDrawCommand(int firstver } command->element3i = NULL; command->element3s = NULL; - if (element3i) - { - command->element3i = (int *)data; - memcpy(command->element3i, element3i, numtriangles*sizeof(int[3])); - } - else if (element3s) + if (element3s) { command->element3s = (unsigned short *)data; memcpy(command->element3s, element3s, numtriangles*sizeof(unsigned short[3])); } + else if (element3i) + { + command->element3i = (int *)data; + memcpy(command->element3i, element3i, numtriangles*sizeof(int[3])); + } return command; } -- 2.39.2