mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- Replaced sprite sorting with a stable sort. Performance at the start of
nuts.wad seems the same. SVN r2028 (trunk)
This commit is contained in:
parent
1c5103c9b1
commit
f6428e1cbb
2 changed files with 9 additions and 8 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
December 17, 2009
|
||||||
|
- Replaced sprite sorting with a stable sort. Performance at the start of
|
||||||
|
nuts.wad seems the same.
|
||||||
|
|
||||||
December 16, 2009 (Changes by Graf Zahl)
|
December 16, 2009 (Changes by Graf Zahl)
|
||||||
- Fixed: Morphed players tried endlessly to switch to a weapon they picked up.
|
- Fixed: Morphed players tried endlessly to switch to a weapon they picked up.
|
||||||
- fixed: P_DamageMobj just set an ice corpse's velocity to 0 to make it shatter.
|
- fixed: P_DamageMobj just set an ice corpse's velocity to 0 to make it shatter.
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
|
@ -1883,13 +1884,9 @@ void R_DrawRemainingPlayerSprites()
|
||||||
// gain compared to the old function.
|
// gain compared to the old function.
|
||||||
//
|
//
|
||||||
// Sort vissprites by depth, far to near
|
// Sort vissprites by depth, far to near
|
||||||
static int STACK_ARGS sv_compare (const void *arg1, const void *arg2)
|
static bool sv_compare(vissprite_t *a, vissprite_t *b)
|
||||||
{
|
{
|
||||||
int diff = (*(vissprite_t **)arg2)->idepth - (*(vissprite_t **)arg1)->idepth;
|
return a->idepth > b->idepth;
|
||||||
// If two sprites are the same distance, then the higher one gets precedence
|
|
||||||
if (diff == 0)
|
|
||||||
return (*(vissprite_t **)arg2)->gzt - (*(vissprite_t **)arg1)->gzt;
|
|
||||||
return diff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -2023,7 +2020,7 @@ void R_SplitVisSprites ()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void R_SortVisSprites (int (STACK_ARGS *compare)(const void *, const void *), size_t first)
|
void R_SortVisSprites (bool (*compare)(vissprite_t *, vissprite_t *), size_t first)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
vissprite_t **spr;
|
vissprite_t **spr;
|
||||||
|
@ -2046,7 +2043,7 @@ void R_SortVisSprites (int (STACK_ARGS *compare)(const void *, const void *), si
|
||||||
spritesorter[i] = *spr;
|
spritesorter[i] = *spr;
|
||||||
}
|
}
|
||||||
|
|
||||||
qsort (spritesorter, vsprcount, sizeof (vissprite_t *), compare);
|
std::stable_sort(&spritesorter[0], &spritesorter[vsprcount], compare);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue