Skip to content

Commit

Permalink
Voice icon edge fading (broken)
Browse files Browse the repository at this point in the history
  • Loading branch information
PringlesGang committed Sep 29, 2024
1 parent 83e1493 commit ca0ed32
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/renderer/dx9/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,13 +558,15 @@ void Renderer::DrawMaskedSpriteOverlay(Sprite const& sprite, Sprite const& mask,
RectF const& dest, glm::vec4 tint,
int alpha, int fadeRange,
bool isInverted, float angle,
bool useMaskAlpha) {
bool useMaskAlpha, bool isScreencap) {
if (!Drawing) {
ImpLog(LL_Error, LC_Render,
"Renderer->DrawMaskedSpriteOverlay() called before BeginFrame()\n");
return;
}

if (isScreencap) Flush();

if (alpha < 0) alpha = 0;
if (alpha > fadeRange + 256) alpha = fadeRange + 256;

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/dx9/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Renderer : public BaseRenderer {
void DrawMaskedSpriteOverlay(Sprite const& sprite, Sprite const& mask,
RectF const& dest, glm::vec4 tint, int alpha,
int fadeRange, bool isInverted, float angle,
bool useMaskAlpha) override;
bool useMaskAlpha, bool isScreencap) override;

void DrawCHLCCMenuBackground(const Sprite& sprite, const Sprite& mask,
const RectF& dest, float alpha) override;
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/opengl/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,13 +515,15 @@ void Renderer::DrawMaskedSpriteOverlay(Sprite const& sprite, Sprite const& mask,
RectF const& dest, glm::vec4 tint,
int alpha, int fadeRange,
bool isInverted, float angle,
bool useMaskAlpha) {
bool useMaskAlpha, bool isScreencap) {
if (!Drawing) {
ImpLog(LL_Error, LC_Render,
"Renderer->DrawMaskedSpriteOverlay() called before BeginFrame()\n");
return;
}

if (isScreencap) Flush();

if (alpha < 0) alpha = 0;
if (alpha > fadeRange + 256) alpha = fadeRange + 256;

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/opengl/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Renderer : public BaseRenderer {
void DrawMaskedSpriteOverlay(Sprite const& sprite, Sprite const& mask,

Check warning on line 84 in src/renderer/opengl/renderer.h

View workflow job for this annotation

GitHub Actions / macos-arm64

'DrawMaskedSpriteOverlay' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]

Check warning on line 84 in src/renderer/opengl/renderer.h

View workflow job for this annotation

GitHub Actions / macos-x64

'DrawMaskedSpriteOverlay' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
RectF const& dest, glm::vec4 tint, int alpha,
int fadeRange, bool isInverted, float angle,
bool useMaskAlpha);
bool useMaskAlpha, bool isScreencap);

void DrawCHLCCMenuBackground(const Sprite& sprite, const Sprite& mask,
const RectF& dest, float alpha) override;
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ class BaseRenderer {
int alpha, int fadeRange,
bool isInverted = false,
float angle = 0.0f,
bool useMaskAlpha = true) = 0;
bool useMaskAlpha = true,
bool isScreencap = false) = 0;

virtual void DrawSprite3DRotated(Sprite const& sprite, RectF const& dest,
float depth, glm::vec2 vanishingPoint,
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/vulkan/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1439,13 +1439,15 @@ void Renderer::DrawMaskedSpriteOverlay(Sprite const& sprite, Sprite const& mask,
RectF const& dest, glm::vec4 tint,
int alpha, int fadeRange,
bool isInverted, float angle,
bool useMaskAlpha) {
bool useMaskAlpha, bool isScreencap) {
if (!Drawing) {
ImpLog(LL_Error, LC_Render,
"Renderer->DrawMaskedSpriteOverlay() called before BeginFrame()\n");
return;
}

if (isScreencap) Flush();

if (Textures.count(sprite.Sheet.Texture) == 0 ||
Textures.count(mask.Sheet.Texture) == 0)
return;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/vulkan/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class Renderer : public BaseRenderer {
void DrawMaskedSpriteOverlay(Sprite const& sprite, Sprite const& mask,

Check warning on line 144 in src/renderer/vulkan/renderer.h

View workflow job for this annotation

GitHub Actions / macos-arm64

'DrawMaskedSpriteOverlay' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]

Check warning on line 144 in src/renderer/vulkan/renderer.h

View workflow job for this annotation

GitHub Actions / macos-x64

'DrawMaskedSpriteOverlay' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
RectF const& dest, glm::vec4 tint, int alpha,
int fadeRange, bool isInverted, float angle,
bool useMaskAlpha);
bool useMaskAlpha, bool isScreencap);

void DrawCHLCCMenuBackground(const Sprite& sprite, const Sprite& mask,
const RectF& dest, float alpha) override;
Expand Down
15 changes: 9 additions & 6 deletions src/ui/widgets/cc/backlogentry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ BacklogEntry::BacklogEntry(int id, uint8_t* str, int audioId, glm::vec2 pos,

void BacklogEntry::Render() {
if (AudioId != -1) {
// TODO: Use transparency mask
Renderer->DrawSprite(
VoiceIcon,
glm::vec2(Bounds.X - VoiceIcon.ScaledWidth(), Bounds.Y) +
VoiceIconOffset,
Tint);
RectF bounds = RectF(Bounds.X - VoiceIcon.ScaledWidth() + VoiceIconOffset.x,
Bounds.Y + VoiceIconOffset.y, VoiceIcon.ScaledWidth(),
VoiceIcon.ScaledHeight());
Sprite mask;
mask.Sheet = BacklogMaskSheet;
mask.Bounds = bounds;

Renderer->DrawMaskedSpriteOverlay(VoiceIcon, mask, bounds, Tint,
Tint.a * 256, 20, false, 0, false, true);
}

if (BacklogPage->HasName) {
Expand Down

0 comments on commit ca0ed32

Please sign in to comment.