Skip to content

Commit

Permalink
Added dynamic skyfix
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed May 30, 2003
1 parent 7601f3c commit 9374177
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
23 changes: 22 additions & 1 deletion doomsday/Src/r_things.c
Expand Up @@ -788,15 +788,36 @@ void R_ProjectSprite (mobj_t *thing)

void R_AddSprites (sector_t *sec)
{
mobj_t *thing;
mobj_t *thing;
spriteinfo_t spriteInfo;
fixed_t visibleTop;

if (sec->validcount == validcount)
return; // already added

sec->validcount = validcount;

for (thing = sec->thinglist ; thing ; thing = thing->snext)
{
R_ProjectSprite (thing);

// Hack: Sprites have a tendency to extend into the ceiling in
// sky sectors. Here we will raise the skyfix dynamically, at
// runtime, to make sure that no sprites get clipped by the sky.
R_GetSpriteInfo(thing->sprite, thing->frame, &spriteInfo);
visibleTop = thing->z + (spriteInfo.height << FRACBITS);

if(sec->ceilingpic == skyflatnum
&& visibleTop > sec->ceilingheight + (sec->skyfix << FRACBITS))
{
// Raise sector skyfix.
sec->skyfix = ((visibleTop - sec->ceilingheight)
>> FRACBITS) + 16; // Add some leeway.

// This'll adjust all adjacent sectors.
R_SkyFix();
}
}
}

/*
Expand Down
2 changes: 1 addition & 1 deletion doomsday/Src/r_world.c
Expand Up @@ -438,7 +438,7 @@ void R_CreateFloorsAndCeilings(int bspnode, int numdivlines, divline_t *divlines
// ceiling is lifted to match the upper sky. The raising only affects
// rendering, it has no bearing on gameplay.
//==========================================================================
void R_SkyFix()
void R_SkyFix(void)
{
boolean adjusted;
int i, f, b;
Expand Down

0 comments on commit 9374177

Please sign in to comment.