Skip to content

Commit

Permalink
Added decorations
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jun 10, 2003
1 parent c235fd4 commit 2a9f9d7
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 2 deletions.
52 changes: 52 additions & 0 deletions doomsday/Src/r_data.c
Expand Up @@ -691,6 +691,58 @@ char* R_TextureNameForNum(int num)
return textures[num]->name;
}

//===========================================================================
// R_IsCustomTexture
// Returns true if the texture is probably not from the original game.
//===========================================================================
boolean R_IsCustomTexture(int texture)
{
int i, lump;

// First check the texture definitions.
lump = W_CheckNumForName("TEXTURE1");
if(lump >= 0 && !W_IsFromIWAD(lump)) return true;

lump = W_CheckNumForName("TEXTURE2");
if(lump >= 0 && !W_IsFromIWAD(lump)) return true;

// Go through the patches.
for(i = 0; i < textures[texture]->patchcount; i++)
{
if(!W_IsFromIWAD(textures[texture]->patches[i].patch))
return true;
}

// This is most likely from the original game data.
return false;
}

//===========================================================================
// R_IsAllowedDecoration
// Returns true if the given decorations works under the specified
// circumstances.
//===========================================================================
boolean R_IsAllowedDecoration
(ded_decor_t *def, int index, boolean hasExternal)
{
if(hasExternal)
return (def->flags & DCRF_EXTERNAL) != 0;

if(def->is_texture)
{
// Is it probably an original texture?
if(!R_IsCustomTexture(index))
return !(def->flags & DCRF_NO_IWAD);
}
else
{
if(W_IsFromIWAD(index))
return !(def->flags & DCRF_NO_IWAD);
}

return (def->flags & DCRF_PWAD) != 0;
}

//===========================================================================
// R_PrecacheFlat
// Prepares the specified flat and all the other flats in the same
Expand Down
21 changes: 19 additions & 2 deletions doomsday/Src/rend_main.c
Expand Up @@ -97,6 +97,15 @@ float Rend_SignedPointDist2D(float c[2])
return (vz-c[VY])*viewsidex - (vx-c[VX])*viewsidey;
}

//===========================================================================
// Rend_PointDist3D
// Approximated! The Z axis aspect ratio is corrected.
//===========================================================================
float Rend_PointDist3D(float c[3])
{
return M_ApproxDistance3f(vx - c[VX], vz - c[VY], 1.2f * (vy - c[VZ]));
}

//===========================================================================
// Rend_Init
//===========================================================================
Expand Down Expand Up @@ -1031,14 +1040,19 @@ void Rend_RenderMap(void)
R_ClearSectorFlags();
DL_ClearForFrame(); // Zeroes the links.

// Generate surface decorations for the frame.
Rend_InitDecorationsForFrame();

// Maintain luminous objects.
if(useDynLights || haloMode || litSprites) DL_InitForNewFrame();
if(useDynLights || haloMode || litSprites || useDecorations)
{
DL_InitForNewFrame();
}

// Add the backside clipping range (if vpitch allows).
if(vpitch <= 90-yfov/2 && vpitch >= -90+yfov/2)
{
float a = fabs(vpitch) / (90-yfov/2);
//binangle_t startAngle = (binangle_t) BANG_45*(1+a);
binangle_t startAngle = (binangle_t) (BANG_45*fieldOfView/90)*(1+a);
binangle_t angLen = BANG_180 - startAngle;
viewside = (viewangle>>(32-BAMS_BITS)) + startAngle;
Expand All @@ -1054,6 +1068,9 @@ void Rend_RenderMap(void)

Rend_RenderNode(numnodes-1);

// Make vissprites of all the visible decorations.
Rend_ProjectDecorations();

Rend_RenderShadows();
}
RL_RenderAllLists();
Expand Down

0 comments on commit 2a9f9d7

Please sign in to comment.