Exemple #1
0
static void ST_DrawJMessage(int pic)
{
	int lump = st_jmessages[pic];

	GL_BindGfxTexture(lumpinfo[lump].name, true);
	GL_SetState(GLSTATE_BLEND, 1);

	dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, DGL_CLAMP);
	dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, DGL_CLAMP);
	dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

	GL_SetupAndDraw2DQuad(20,
			      20,
			      gfxwidth[lump - g_start],
			      gfxheight[lump - g_start],
			      0,
			      1,
			      0,
			      1,
			      ST_MSGCOLOR(automapactive ? 0xff : st_msgalpha),
			      false);

	GL_SetState(GLSTATE_BLEND, 0);
}
Exemple #2
0
void ST_DrawCrosshair(int x, int y, int slot, byte scalefactor, rcolor color)
{
	float u;
	int index;
	int scale;

	if (slot <= 0)
		return;

	if (slot > st_crosshairs)
		return;

	index = slot - 1;

	GL_BindGfxTexture("CRSHAIRS", true);
	GL_SetState(GLSTATE_BLEND, 1);

	dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, DGL_CLAMP);
	dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, DGL_CLAMP);

	u = 1.0f / st_crosshairs;
	scale =
	    scalefactor ==
	    0 ? ST_CROSSHAIRSIZE : (ST_CROSSHAIRSIZE / (1 << scalefactor));

	GL_SetupAndDraw2DQuad((float)x, (float)y, scale, scale,
			      u * index, u + (u * index), 0, 1, color, 0);

	GL_SetState(GLSTATE_BLEND, 0);
}
Exemple #3
0
void Draw_GfxImage(int x, int y, const char* name, rcolor color, dboolean alpha) {
    int gfxIdx = GL_BindGfxTexture(name, alpha);

    dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, DGL_CLAMP);
    dglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, DGL_CLAMP);

    GL_SetState(GLSTATE_BLEND, 1);
    GL_SetupAndDraw2DQuad((float)x, (float)y,
                          gfxwidth[gfxIdx], gfxheight[gfxIdx], 0, 1.0f, 0, 1.0f, color, 0);

    GL_SetState(GLSTATE_BLEND, 0);
}
Exemple #4
0
void Draw_Sprite2D(int type, int rot, int frame, int x, int y,
                   float scale, int pal, rcolor c) {
    spritedef_t    *sprdef;
    spriteframe_t *sprframe;
    float flip = 0.0f;
    int w;
    int h;
    int offsetx = 0;
    int offsety = 0;

    GL_SetState(GLSTATE_BLEND, 1);

    sprdef=&spriteinfo[type];
    sprframe = &sprdef->spriteframes[frame];

    GL_BindSpriteTexture(sprframe->lump[rot], pal);

    w = spritewidth[sprframe->lump[rot]];
    h = spriteheight[sprframe->lump[rot]];

    if(scale <= 1.0f) {
        if(sprframe->flip[rot]) {
            flip = 1.0f;
        }
        else {
            flip = 0.0f;
        }

        offsetx = (int)spriteoffset[sprframe->lump[rot]];
        offsety = (int)spritetopoffset[sprframe->lump[rot]];
    }

    GL_SetOrthoScale(scale);

    GL_SetupAndDraw2DQuad(flip ? (float)(x + offsetx) - w :
                          (float)x - offsetx, (float)y - offsety, w, h,
                          flip, 1.0f - flip, 0, 1.0f, c, 0);

    GL_SetOrthoScale(1.0f);

    cursprite = -1;
    curgfx = -1;

    GL_SetState(GLSTATE_BLEND, 0);
}