Skip to content

Commit

Permalink
Fix rocket lock wedges on JK2 SP
Browse files Browse the repository at this point in the history
JK2 shader has a different hash
  • Loading branch information
ensiform committed May 20, 2023
1 parent 90e8005 commit 995d0dd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions code/rd-vanilla/tr_shader.cpp
Expand Up @@ -39,12 +39,18 @@ static shader_t shader;
static texModInfo_t texMods[MAX_SHADER_STAGES][TR_MAX_TEXMODS];

// Hash value (generated using the generateHashValueForText function) for the original
// retail JKA shader for gfx/2d/wedge.
// retail JK2/JKA shader for gfx/2d/wedge.
#ifdef JK2_MODE
#define RETAIL_ROCKET_WEDGE_SHADER_HASH (1193966)
#else
#define RETAIL_ROCKET_WEDGE_SHADER_HASH (1217042)
#endif

#ifndef JK2_MODE
// Hash value (generated using the generateHashValueForText function) for the original
// retail JKA shader for gfx/menus/radar/arrow_w.
#define RETAIL_ARROW_W_SHADER_HASH (1650186)
#endif


#define FILE_HASH_SIZE 1024
Expand Down Expand Up @@ -2449,7 +2455,7 @@ Ghoul2 Insert End

shader.explicitlyDefined = true;

// The basejka rocket lock wedge shader uses the incorrect blending mode.
// The basejk2/basejka rocket lock wedge shader uses the incorrect blending mode.
// It only worked because the shader state was not being set, and relied
// on previous state to be multiplied by alpha. Since fixing RB_RotatePic,
// the shader needs to be fixed here to render correctly.
Expand All @@ -2465,6 +2471,7 @@ Ghoul2 Insert End
stages[0].stateBits |= GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA;
}

#ifndef JK2_MODE
// The basejka radar arrow contains an incorrect rgbGen of identity
// It only worked because the original code didn't check shaders at all,
// thus setcolor worked fine but with fixing RB_RotatePic it no longer
Expand All @@ -2479,6 +2486,7 @@ Ghoul2 Insert End
stages[0].rgbGen = CGEN_VERTEX;
stages[0].alphaGen = AGEN_VERTEX;
}
#endif

COM_EndParseSession();
return qtrue;
Expand Down

0 comments on commit 995d0dd

Please sign in to comment.