Curation round 12: basement enemies, projectiles, tear flags, lighting and blend modes, actives, boss deaths, familiars, shops and secret rooms
This commit is contained in:
1 parent
698eeb74e9
commit
f8ce24fc6c
146 files changed
+16389
-3104
No files matched your search
+15
-8
@@ -31,8 +31,6 @@ constexpr float DEGREES_TURN = 360;
|
||||
constexpr float RADIANS_PER_DEGREE = 0.017453292f;
|
||||
constexpr float GLITCH_TURN = 90;
|
||||
constexpr int SHIMMER_STEPS = 256;
|
||||
constexpr uint32_t GRAPHICS_PREMULTIPLIED_ALPHA = 4;
|
||||
constexpr char LIGHT_LAYER_PREFIX = '*';
|
||||
constexpr std::string_view SHADOW_LAYER_NAME = "shadow";
|
||||
constexpr std::string_view APPEAR_ANIMATION = "Appear";
|
||||
constexpr std::string_view IDLE_ANIMATION = "Idle";
|
||||
@@ -969,7 +967,7 @@ LayerState::LayerState()
|
||||
// 00408310 Points a layer at its layer data and resets its spritesheet, transform, colour, blending and render flags.
|
||||
void LayerState::Init(const LayerData* data)
|
||||
{
|
||||
bool isPremultiplied = g_graphicsManager_flags & GRAPHICS_PREMULTIPLIED_ALPHA;
|
||||
bool isPremultiplied = KAGE::Graphics::manager.isPremultipliedAlpha;
|
||||
|
||||
layerData = data;
|
||||
spriteSheetPath = data ? data->spriteSheetPath : "";
|
||||
@@ -1200,6 +1198,15 @@ static void procedural_item_turn(SourceQuad& source, const AnimationFrame& frame
|
||||
if (rng.RandomInt(2) != 0) quad_columns_swap(source);
|
||||
}
|
||||
|
||||
// A layer's blend mode as KAGE draws with it.
|
||||
static KAGE::Graphics::BlendMode layer_blend_get(const LayerState& layer)
|
||||
{
|
||||
using Factor = KAGE::Graphics::BlendFactor;
|
||||
const std::array<int, BLEND_PART_COUNT>& mode = layer.blendMode;
|
||||
return {(KAGE::Graphics::BlendEquation)mode[BLEND_EQUATION], (Factor)mode[BLEND_RGB_SOURCE],
|
||||
(Factor)mode[BLEND_RGB_DEST], (Factor)mode[BLEND_ALPHA_SOURCE], (Factor)mode[BLEND_ALPHA_DEST]};
|
||||
}
|
||||
|
||||
// 00409120 Draws one keyframe of a layer track with the layer's spritesheet, colour, blending and shader.
|
||||
// The original reads past the sprite's layers for a track keying a missing layer. Here it draws nothing.
|
||||
void AnimationLayer::RenderFrame(const SpriteDraw& draw, int frameIndex, const ANM2& animation) const
|
||||
@@ -1213,9 +1220,9 @@ void AnimationLayer::RenderFrame(const SpriteDraw& draw, int frameIndex, const A
|
||||
unsigned int flags = animation.bitflags | layer.bitflags;
|
||||
if (!layer.isVisible || !layer.spriteSheet || ((flags & ANIM_RENDER_LIGHT_PASS_ONLY) && !is_light_pass())) return;
|
||||
|
||||
std::array<int, BLEND_PART_COUNT> savedBlendMode;
|
||||
std::copy_n(g_graphicsManager_blendMode, BLEND_PART_COUNT, savedBlendMode.begin());
|
||||
std::copy(layer.blendMode.begin(), layer.blendMode.end(), g_graphicsManager_blendMode);
|
||||
KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager;
|
||||
KAGE::Graphics::BlendMode savedBlend = graphics.blendMode;
|
||||
graphics.blendMode = layer_blend_get(layer);
|
||||
|
||||
ColorMod color = layer_color_get(frame, layer, animation, flags);
|
||||
SourceQuad source = GetSourceQuad(frame, layer, draw, animation);
|
||||
@@ -1244,8 +1251,8 @@ void AnimationLayer::RenderFrame(const SpriteDraw& draw, int frameIndex, const A
|
||||
&animation.championColor);
|
||||
layer.spriteSheet->Render(source, KAGE::Graphics::ColorQuad(dest, tint), tint);
|
||||
|
||||
std::copy(savedBlendMode.begin(), savedBlendMode.end(), g_graphicsManager_blendMode);
|
||||
KAGE::Graphics::manager.shader_default_set();
|
||||
graphics.blendMode = savedBlend;
|
||||
graphics.shader_default_set();
|
||||
}
|
||||
|
||||
// 00407690 Copies a sprite, sharing its file and spritesheets. The copy starts with no offset and no render flags.
|
||||
|
||||
Reference in new issue
Block a user