Repository navigation
Clear a sprite's image when its bitmap is cleared (runtime 20261113.1) - #83
Open
Xehanort88 wants to merge 1 commit into
Open
Xehanort88 wants to merge 1 commit into
Xehanort88 wants to merge 1 commit into
Conversation
Under Pixi v8, Sprite._onBitmapChange blanked a sprite by assigning texture.frame, which updates neither the UVs nor the source, so the sprite kept drawing its old bitmap. An actor sprite whose battler left battleMembers() mid-battle (a captured or banished party member) therefore stayed on the field in its last pose while the status window, target lists and turn order had already dropped it. The v8 path now returns the sprite to an empty texture of its own, as initialize() starts with, and destroys the sprite-owned texture it replaces. A texture whose frame is already 0x0 is kept, so construction does not allocate twice. The v5-v7 path is unchanged. editor/tests/sprite-null-bitmap.test.cjs vm-loads the real Sprite on Pixi v8; its clearing test fails on the previous runtime. Verified in a native NW.js battle: captured and banished actors vanish, a released actor reappears, a KO'd one lies in its slot. npm test failing names match a HEAD worktree apart from one concurrency flake in each direction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A party member who leaves the battle line mid-fight keeps standing on the battlefield in their last pose. "Leaving the battle line" means a state that hides them, a capture or banish mechanic, anything that drops them from
battleMembers(). The status window, target lists and turn order all drop them correctly; only the field sprite stays.Spriteset_Battle.updateActorsrebinds actor sprites by index, so the slot that falls off the end getssetBattler(undefined).Sprite_Actor.setBattlerthen sets_mainSprite.bitmap = null, andSprite.prototype._onBitmapChangeblanks the sprite withthis.texture.frame = new Rectangle(). Under Pixi v8, assigningtexture.frameupdates neither the UVs nor the source. The texture still samples the old bitmap with UVx1 = 1, so the old frame keeps rendering. The v5-v7 path relied on the frame setter refreshing the texture, which v8 no longer does.Change
runtime/reactor_core_display.js,Sprite.prototype._onBitmapChange, v8 path only:PIXICreateTexture(Sprite._emptyBaseTexture, new Rectangle()), flagged__rrSpriteOwned), which is howinitialize()starts. The sprite-owned texture it replaces is destroyed, as_refreshalready does; the bitmap's source is not touched.initialize(), which calls this with a fresh empty texture, does not allocate twice.template/Demo/js/reactor_core_display.jsgets the same change. The runtime revision goes to20261113.1in bothreactor_main.jscopies, with aneditor/CHANGELOG.mdentry.Verification
editor/tests/sprite-null-bitmap.test.cjsvm-loads the realSprite(withpixi_compat.jsandRectangle) on Pixi v8. It checks that clearing leaves the sprite on its own empty texture with zero UVs and that the replaced owned texture is destroyed, and that reassigning a bitmap draws it again. It also checks that a bitmap-less sprite builds exactly one texture. The clearing test fails onmainbefore this change and passes after.npm test:HEADwithout it, apart from one concurrency flake in each direction. Run alone, the flaky file failed identically in both trees.upstream/mainplus this commit, the 58 test files that loadreactor_core_display.jsor the runtime revision fail only the same 7 environment-dependent names they fail without the change.Limits
Spriteis changed.TilingSprite._onBitmapChangehas the sametexture.frame = new Rectangle()pattern for a cleared bitmap and was not touched or tested here.initialize()already does per sprite.🤖 Generated with Claude Code