This commit is contained in:
TheBrokenRail 2022-07-15 23:20:31 -04:00
parent b190851d36
commit 279b101e46
2 changed files with 13 additions and 0 deletions

View File

@ -40,6 +40,8 @@ extern "C" {
#define GL_FOG_MODE 0xb65
#define GL_FOG_COLOR 0xb66
#define GL_BLEND 0xbe2
#define GL_ONE 1
#define GL_ZERO 0
#include <stdio.h>
#include <stdint.h>

View File

@ -116,6 +116,14 @@ static void Inventory_selectSlot_injection(unsigned char *inventory, int32_t slo
}
// Translucent Toolbar
static GLenum blend_sfactor = GL_ONE;
static GLenum blend_dfactor = GL_ZERO;
HOOK(glBlendFunc, void, (GLenum sfactor, GLenum dfactor)) {
blend_sfactor = sfactor;
blend_dfactor = dfactor;
ensure_glBlendFunc();
(*real_glBlendFunc)(sfactor, dfactor);
}
static GLfloat reset_red;
static GLfloat reset_green;
static GLfloat reset_blue;
@ -126,9 +134,12 @@ static void Gui_renderToolBar_injection(unsigned char *gui, float param_1, int32
if (!was_blend_enabled) {
glEnable(GL_BLEND);
}
GLenum old_sfactor = blend_sfactor;
GLenum old_dfactor = blend_dfactor;
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
(*Gui_renderToolBar)(gui, param_1, param_2, param_3);
glColor4f(reset_red, reset_green, reset_blue, reset_alpha);
glBlendFunc(old_sfactor, old_dfactor);
if (!was_blend_enabled) {
glDisable(GL_BLEND);
}