From 18a25de75f6509691c9d80eb6fb85e683cc90b9d Mon Sep 17 00:00:00 2001 From: flowtron Date: Sat, 12 Jun 2010 16:13:57 +0000 Subject: [PATCH] equiptransparency 0||1 - enables transparent items.png - code adapted from SKB git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5187 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/renderhud.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index 22e2adc7..3cbd08c8 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -7,15 +7,22 @@ void drawicon(Texture *tex, float x, float y, float s, int col, int row, float t if(tex && tex->xs == tex->ys) quad(tex->id, x, y, s, ts*col, ts*row, ts); } +VARP(equiptransparency, 0, 0, 1); + void drawequipicon(float x, float y, int col, int row, float blend) { static Texture *tex = NULL; if(!tex) tex = textureload("packages/misc/items.png", 4); if(tex) { - if(blend) glEnable(GL_BLEND); + if(blend||equiptransparency) glEnable(GL_BLEND); + if(equiptransparency) + { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4ub(255, 255, 255, 255); + } drawicon(tex, x, y, 120, col, row, 1/4.0f); - if(blend) glDisable(GL_BLEND); + if(blend||equiptransparency) glDisable(GL_BLEND); } }