diff --git a/src/shared/decals.c b/src/shared/decals.c index e1de8b1f..49ba8fab 100644 --- a/src/shared/decals.c +++ b/src/shared/decals.c @@ -16,8 +16,6 @@ var int autocvar_cl_decals = TRUE; -#include "decals.h" - #define DECALS_MAX 30 #ifdef SSQC @@ -168,17 +166,7 @@ const string g_decal_shader = \ "{\n" \ "clampmap %s\n" \ "rgbgen vertex\n" \ - "blendfunc GL_ZERO GL_SRC_COLOR\n" \ - "}\n" \ - "}"; - -const string g_decal_shader_add = \ - "{\n" \ - "polygonOffset\n" \ - "{\n" \ - "clampmap %s\n" \ - "rgbgen vertex\n" \ - "blendfunc add\n" \ + "blendfunc blend\n" \ "}\n" \ "}"; @@ -198,36 +186,7 @@ void Decal_MakeShader(decal target) { string shader_buff; target.m_strShader = sprintf("decal_%s", target.m_strTexture); - - if (target.style & DFLAG_INVERT) { - int i; - int *buff; - vector res; - int w, h; - - res = drawgetimagesize(target.m_strTexture); - w = (int)res[0]; - h = (int)res[1]; - buff = r_readimage(target.m_strTexture, w, h); - - /* we can only upload this under a new name */ - target.m_strTexture = sprintf("%s_inv", target.m_strTexture); - - if (buff != __NULL__) { - for (i = 0; i < ( w * h ); i++) { - //buff[i] = ~buff[i]; - } - - r_uploadimage(target.m_strTexture, w, h, (void*)buff); - memfree(buff); - } - } - - if (target.style & DFLAG_ADDITIVE) { - shader_buff = sprintf(g_decal_shader_add, target.m_strTexture); - } else { - shader_buff = sprintf(g_decal_shader, target.m_strTexture); - } + shader_buff = sprintf(g_decal_shader, target.m_strTexture); shaderforname(target.m_strShader, shader_buff); } @@ -257,16 +216,6 @@ void Decal_Parse(void) new.color = [1,1,1]; - for (int i = 0; i < g_decalwad.length; i++) { - if (new.m_strTexture == g_decalwad[i].name) { - new.color[0] = (g_decalwad[i].color[0] / 255); - new.color[1] = (g_decalwad[i].color[1] / 255); - new.color[2] = (g_decalwad[i].color[2] / 255); - new.style = g_decalwad[i].flags; - break; - } - } - new.size = drawgetimagesize(new.m_strTexture); if (serverkeyfloat("*bspversion") == 30) { diff --git a/src/shared/decals.h b/src/shared/decals.h deleted file mode 100644 index 5228922e..00000000 --- a/src/shared/decals.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2016-2019 Marco Hladik - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -typedef struct -{ - string name; - vector color; - int flags; -} decal_t; - -enumflags -{ - DFLAG_ADDITIVE, - DFLAG_INVERT -}; - -#define COLOR_REDBLOOD [114,25,7] -#define COLOR_YELLOWBLOOD [248,224,122] - -decal_t g_decalwad[] = -{ - { "{bigblood1", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{bigblood2", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{bproof1", [255,255,255], DFLAG_ADDITIVE }, - { "{break1", [255,255,255], DFLAG_ADDITIVE }, - { "{break2", [255,255,255], DFLAG_ADDITIVE }, - { "{break3", [255,255,255], DFLAG_ADDITIVE }, - { "{blood1", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{blood2", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{blood3", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{blood4", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{blood5", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{blood6", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{blood7", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{blood8", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{bloodhand1", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{bloodhand2", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{bloodhand3", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{bloodhand4", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{bloodhand5", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{bloodhand6", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{hand1", COLOR_REDBLOOD, DFLAG_INVERT }, - { "{shot1", [255,255,255], 0 }, - { "{shot2", [255,255,255], 0 }, - { "{shot3", [255,255,255], 0 }, - { "{shot4", [255,255,255], 0 }, - { "{shot5", [255,255,255], 0 }, - { "{bigshot1", [255,255,255], 0 }, - { "{bigshot2", [255,255,255], 0 }, - { "{bigshot3", [255,255,255], 0 }, - { "{bigshot4", [255,255,255], 0 }, - { "{bigshot5", [255,255,255], 0 }, - { "{bigshot6", [255,255,255], 0 }, - { "{scorch1", [255,255,255], 0 }, - { "{scorch2", [255,255,255], 0 }, - { "{scorch3", [255,255,255], 0 }, - { "{yblood1", COLOR_YELLOWBLOOD, DFLAG_INVERT }, - { "{yblood2", COLOR_YELLOWBLOOD, DFLAG_INVERT }, - { "{yblood3", COLOR_YELLOWBLOOD, DFLAG_INVERT }, - { "{yblood4", COLOR_YELLOWBLOOD, DFLAG_INVERT }, - { "{yblood5", COLOR_YELLOWBLOOD, DFLAG_INVERT }, - { "{yblood6", COLOR_YELLOWBLOOD, DFLAG_INVERT }, - { "{yblood7", COLOR_YELLOWBLOOD, DFLAG_INVERT }, - { "{yblood8", COLOR_YELLOWBLOOD, DFLAG_INVERT } -};