Skip to content

Commit

Permalink
Adapting enemy counter properly
Browse files Browse the repository at this point in the history
  • Loading branch information
vitor251093 committed Feb 5, 2025
1 parent fe549c9 commit 9392639
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/plugins/PluginKingdomHeartsReCoded_GPU_OpenGL_shaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,64 @@ ivec4 getTopScreenColor(float xpos, float ypos, int index)
}
}
}
// enemies counter
float bottomEnemiesWidth = 148.0;
float bottomEnemiesHeight = 15.0;
float bottomEnemiesXMargin = 24.0;
float increaseEnemiesSize = 1.4;
float enemiesBottomMargin = 12.0;
float enemiesWidth = (bottomEnemiesWidth/increaseEnemiesSize)*heightScale;
float enemiesHeight = (bottomEnemiesHeight/increaseEnemiesSize);
float enemiesXMargin = (bottomEnemiesXMargin/increaseEnemiesSize)*heightScale;
float enemiesLeftMargin = (256.0*iuTexScale - enemiesWidth)/2;
// enemies counter (part 1)
if (texPosition3d.x >= enemiesLeftMargin &&
texPosition3d.x < enemiesLeftMargin + bottomEnemiesXMargin &&
texPosition3d.y >= (192.0*iuTexScale - enemiesHeight - enemiesBottomMargin) &&
texPosition3d.y < (192.0*iuTexScale - enemiesBottomMargin)) {
if (index == 0)
{
if (color.b != color.r && color.b > color.r) {
color = ivec4(0, 0, 0, 31);
}
}
if (index == 2)
{
ivec4 colorZero = ivec4(texelFetch(ScreenTex, textureBeginning, 0));
if (colorZero.b != colorZero.r && colorZero.b > colorZero.r) {
color = ivec4(color.r, 48, 16, 0x01);
}
}
}
// enemies counter (part 2)
if (texPosition3d.x >= enemiesLeftMargin + enemiesWidth - bottomEnemiesXMargin/1.5 &&
texPosition3d.x < enemiesLeftMargin + enemiesWidth &&
texPosition3d.y >= (192.0*iuTexScale - enemiesHeight - enemiesBottomMargin) &&
texPosition3d.y < (192.0*iuTexScale - enemiesBottomMargin)) {
if (index == 0)
{
bool isShadeOfGray = (abs(color.r - color.g) < 5) && (abs(color.r - color.b) < 5) && (abs(color.g - color.b) < 5);
if (isShadeOfGray) {
color = ivec4(0, 0, 0, color.a);
}
if (color.b != color.r && color.b > color.r) {
color = ivec4(0, 0, 0, 31);
}
}
if (index == 2)
{
ivec4 colorZero = ivec4(texelFetch(ScreenTex, textureBeginning, 0));
if (colorZero.b != colorZero.r && colorZero.b > colorZero.r) {
color = ivec4(color.r, 48, 16, 0x01);
}
}
}
}
}
}
Expand Down

0 comments on commit 9392639

Please sign in to comment.