Skip to content

Commit

Permalink
Added GL_SetColor2()
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 9, 2003
1 parent 9370b03 commit dfd6ecc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions doomsday/Include/doomsday.h
Expand Up @@ -175,6 +175,7 @@ int GL_ChangeResolution(int w, int h, int bits);
byte * GL_GrabScreen(void);
void GL_TextureFilterMode(int target, int parm);
void GL_SetColor(int palidx);
void GL_SetColor2(int palidx, float alpha);
void GL_SetColorAndAlpha(float r, float g, float b, float a);
void GL_SetNoTexture(void);
void GL_SetPatch(int lump);
Expand Down
1 change: 1 addition & 0 deletions doomsday/Include/gl_draw.h
Expand Up @@ -24,6 +24,7 @@ void GL_DrawRectTiled(int x, int y, int w, int h, int tw, int th);
void GL_DrawCutRectTiled(int x, int y, int w, int h, int tw, int th,
int cx, int cy, int cw, int ch);
void GL_SetColor(int palidx);
void GL_SetColor2(int palidx, float alpha);
void GL_SetColorAndAlpha(float r, float g, float b, float a);
void GL_DrawPSprite(float x, float y, float scale, int flip, int lump);

Expand Down
14 changes: 12 additions & 2 deletions doomsday/Src/gl_draw.c
Expand Up @@ -318,14 +318,24 @@ void GL_DrawLine(float x1, float y1, float x2, float y2,

void GL_SetColor(int palidx)
{
byte rgb[3];
GL_SetColor2(palidx, 1);
}

void GL_SetColor2(int palidx, float alpha)
{
byte rgb[4];

if(palidx == -1) // Invisible?
{
gl.Color4f(0, 0, 0, 0);
}
else
{
PalIdxToRGB(W_CacheLumpNum(pallump, PU_CACHE), palidx, rgb);
gl.Color3ubv(rgb);
if(alpha < 0) alpha = 0;
if(alpha > 1) alpha = 1;
rgb[3] = alpha * 255;
gl.Color4ubv(rgb);
}
}

Expand Down

0 comments on commit dfd6ecc

Please sign in to comment.