mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
Base draw distances on viewx/viewy coordinates, NOT the player object's coordinates (this can cause problems with things like skyboxes for instance). Splitscreen's player 2 should not affect what sprites player 1 can see, and vice versa! Especially not for precipitation, that just looks ridiculous.
git-svn-id: https://code.orospakr.ca/svn/srb2/trunk@9041 6de4a73c-47e2-0310-b8c1-93d6ecd3f8cd
This commit is contained in:
parent
2d9d028bea
commit
6cff0bba70
2 changed files with 7 additions and 51 deletions
|
@ -4457,23 +4457,12 @@ static void HWR_AddSprites(sector_t *sec)
|
||||||
// If a limit exists, handle things a tiny bit different.
|
// If a limit exists, handle things a tiny bit different.
|
||||||
if ((limit_dist = (fixed_t)((maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : cv_drawdist.value) << FRACBITS))
|
if ((limit_dist = (fixed_t)((maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : cv_drawdist.value) << FRACBITS))
|
||||||
{
|
{
|
||||||
if (!players[displayplayer].mo)
|
|
||||||
return; // Draw nothing if no player.
|
|
||||||
// todo: is this really the best option for this situation?
|
|
||||||
|
|
||||||
for (thing = sec->thinglist; thing; thing = thing->snext)
|
for (thing = sec->thinglist; thing; thing = thing->snext)
|
||||||
{
|
{
|
||||||
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
|
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
approx_dist = P_AproxDistance(
|
approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
|
||||||
players[displayplayer].mo->x - thing->x,
|
|
||||||
players[displayplayer].mo->y - thing->y);
|
|
||||||
|
|
||||||
if (splitscreen && approx_dist > limit_dist && players[secondarydisplayplayer].mo)
|
|
||||||
approx_dist = P_AproxDistance(
|
|
||||||
players[secondarydisplayplayer].mo->x - thing->x,
|
|
||||||
players[secondarydisplayplayer].mo->y - thing->y);
|
|
||||||
|
|
||||||
if (approx_dist <= limit_dist)
|
if (approx_dist <= limit_dist)
|
||||||
HWR_ProjectSprite(thing);
|
HWR_ProjectSprite(thing);
|
||||||
|
@ -4491,23 +4480,12 @@ static void HWR_AddSprites(sector_t *sec)
|
||||||
// Someone seriously wants infinite draw distance for precipitation?
|
// Someone seriously wants infinite draw distance for precipitation?
|
||||||
if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS))
|
if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS))
|
||||||
{
|
{
|
||||||
if (!players[displayplayer].mo)
|
|
||||||
return; // Draw nothing if no player.
|
|
||||||
// todo: is this really the best option for this situation?
|
|
||||||
|
|
||||||
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
|
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
|
||||||
{
|
{
|
||||||
if (precipthing->invisible)
|
if (precipthing->precipflags & PCF_INVISIBLE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
approx_dist = P_AproxDistance(
|
approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y);
|
||||||
players[displayplayer].mo->x - precipthing->x,
|
|
||||||
players[displayplayer].mo->y - precipthing->y);
|
|
||||||
|
|
||||||
if (splitscreen && approx_dist > limit_dist && players[secondarydisplayplayer].mo)
|
|
||||||
approx_dist = P_AproxDistance(
|
|
||||||
players[secondarydisplayplayer].mo->x - precipthing->x,
|
|
||||||
players[secondarydisplayplayer].mo->y - precipthing->y);
|
|
||||||
|
|
||||||
if (approx_dist <= limit_dist)
|
if (approx_dist <= limit_dist)
|
||||||
HWR_ProjectPrecipitationSprite(precipthing);
|
HWR_ProjectPrecipitationSprite(precipthing);
|
||||||
|
@ -4517,7 +4495,7 @@ static void HWR_AddSprites(sector_t *sec)
|
||||||
{
|
{
|
||||||
// Draw everything in sector, no checks
|
// Draw everything in sector, no checks
|
||||||
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
|
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
|
||||||
if (!precipthing->invisible)
|
if (!(precipthing->precipflags & PCF_INVISIBLE))
|
||||||
HWR_ProjectPrecipitationSprite(precipthing);
|
HWR_ProjectPrecipitationSprite(precipthing);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -4578,7 +4556,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
|
|
||||||
if (rot >= sprdef->numframes)
|
if (rot >= sprdef->numframes)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, M_GetText("R_ProjectSprite: invalid sprite frame %s/%s for %s\n"),
|
CONS_Alert(CONS_ERROR, M_GetText("HWR_ProjectSprite: invalid sprite frame %s/%s for %s\n"),
|
||||||
sizeu1(rot), sizeu2(sprdef->numframes), sprnames[thing->sprite]);
|
sizeu1(rot), sizeu2(sprdef->numframes), sprnames[thing->sprite]);
|
||||||
thing->sprite = states[S_UNKNOWN].sprite;
|
thing->sprite = states[S_UNKNOWN].sprite;
|
||||||
thing->frame = states[S_UNKNOWN].frame;
|
thing->frame = states[S_UNKNOWN].frame;
|
||||||
|
|
|
@ -1546,23 +1546,12 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
|
||||||
// If a limit exists, handle things a tiny bit different.
|
// If a limit exists, handle things a tiny bit different.
|
||||||
if ((limit_dist = (fixed_t)((maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : cv_drawdist.value) << FRACBITS))
|
if ((limit_dist = (fixed_t)((maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : cv_drawdist.value) << FRACBITS))
|
||||||
{
|
{
|
||||||
if (!players[displayplayer].mo)
|
|
||||||
return; // Draw nothing if no player.
|
|
||||||
// todo: is this really the best option for this situation?
|
|
||||||
|
|
||||||
for (thing = sec->thinglist; thing; thing = thing->snext)
|
for (thing = sec->thinglist; thing; thing = thing->snext)
|
||||||
{
|
{
|
||||||
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
|
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
approx_dist = P_AproxDistance(
|
approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
|
||||||
players[displayplayer].mo->x - thing->x,
|
|
||||||
players[displayplayer].mo->y - thing->y);
|
|
||||||
|
|
||||||
if (splitscreen && approx_dist > limit_dist && players[secondarydisplayplayer].mo)
|
|
||||||
approx_dist = P_AproxDistance(
|
|
||||||
players[secondarydisplayplayer].mo->x - thing->x,
|
|
||||||
players[secondarydisplayplayer].mo->y - thing->y);
|
|
||||||
|
|
||||||
if (approx_dist <= limit_dist)
|
if (approx_dist <= limit_dist)
|
||||||
R_ProjectSprite(thing);
|
R_ProjectSprite(thing);
|
||||||
|
@ -1579,23 +1568,12 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
|
||||||
// Someone seriously wants infinite draw distance for precipitation?
|
// Someone seriously wants infinite draw distance for precipitation?
|
||||||
if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS))
|
if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS))
|
||||||
{
|
{
|
||||||
if (!players[displayplayer].mo)
|
|
||||||
return; // Draw nothing if no player.
|
|
||||||
// todo: is this really the best option for this situation?
|
|
||||||
|
|
||||||
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
|
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
|
||||||
{
|
{
|
||||||
if (precipthing->precipflags & PCF_INVISIBLE)
|
if (precipthing->precipflags & PCF_INVISIBLE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
approx_dist = P_AproxDistance(
|
approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y);
|
||||||
players[displayplayer].mo->x - precipthing->x,
|
|
||||||
players[displayplayer].mo->y - precipthing->y);
|
|
||||||
|
|
||||||
if (splitscreen && approx_dist > limit_dist && players[secondarydisplayplayer].mo)
|
|
||||||
approx_dist = P_AproxDistance(
|
|
||||||
players[secondarydisplayplayer].mo->x - precipthing->x,
|
|
||||||
players[secondarydisplayplayer].mo->y - precipthing->y);
|
|
||||||
|
|
||||||
if (approx_dist <= limit_dist)
|
if (approx_dist <= limit_dist)
|
||||||
R_ProjectPrecipitationSprite(precipthing);
|
R_ProjectPrecipitationSprite(precipthing);
|
||||||
|
|
Loading…
Reference in a new issue