From 88b8393cfe7d324bb05cfdbe0948a98112e88ab6 Mon Sep 17 00:00:00 2001 From: shweet Date: Fri, 30 Oct 2026 17:43:06 -0400 Subject: [PATCH] Player parts: how Entity_Player::Update 0x782af0 transforms the head and body layer groups separately (UpdateCostumes 0x75bf00 marks layers 1, 2, 3, 11 as body; head layers take HeadTransform, _headScale, the head lift * 8; render_build_sprite_quad 0x409cb0 scales a layer about its frame pivot), Jelly Belly's wobble constants (0x787178), and the other part effects (Adrenaline, Tainted Magdalene's hug, Reverse Chariot shake, Berserk, Mars, CACHE_SIZE head scale in EvaluateItems 0x763570) Co-Authored-By: Claude Opus 5.5 --- db/fields.tsv | 2 +- notes/items/parity_player_parts.md | 47 ++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 notes/items/parity_player_parts.md diff --git a/db/fields.tsv b/db/fields.tsv index 5b2de38..9243982 100644 --- a/db/fields.tsv +++ b/db/fields.tsv @@ -787,7 +787,7 @@ Entity_Player 0x1fb0 std_map_int_int _roomTemporaryCollectibles ctor builds a tr Entity 0x330 EntityConfig_Entity* _config Entity::LoadEntityConfig 006a98b0 stores the EntityConfig_Entity* here; Entity_Player::Update 00782af0 resets _mass (0x37c) from config+0x44 (mass); NPC AIs spawn_gibs(config+0x60 gibFlags) Entity_Player 0x110c ANM2 _statusEffectSprite ctor 00753da0 ANM2 ctor; Update 00782af0 loads "gfx/StatusEffects.anm2" into it and plays "Charm"...; Render 0078ca00 draws it above the head (-35 * spriteScale.y) PlayerCostumeMap 0x0 int _index ClearCollectibleAnim 007ad5a0: -1 = none, else index into Entity_Player::_costumeSpriteDescs (stride 0x130) -PlayerCostumeMap 0xc bool _isBodyLayer Update 00782af0 layer loop over Entity_Player+0x1238 stride 0x10: 0 -> head-style scale/offset (0x1500), else body scale only +PlayerCostumeMap 0xc bool _isBodyLayer Update 00782af0 layer loop over Entity_Player+0x1238 stride 0x10: 0 -> head-style scale/offset (0x1500), else body scale only; UpdateCostumes 0075bf00 sets it for layers 1, 2, 3, 11 (body, body0, body1, top0) only Entity_Player 0x137e short _deadCatLives GetExtraLives 007bf670 adds it to the 1up/... counts; TriggerDeath 007a1090 decrements it and removes Dead Cat (81) copies above lives*9-8; TriggerCollectibleRemoved 0078ff90 clamps it to 9*GetCollectibleNum(81) Entity_Player 0x1384 short _numLeprosy AddLeprosy 00759b90: ++ while <3, cache 0x200; EvaluateItems CheckFamiliar(0x79 Leprosy, it) Entity_Player 0x138c int _bleedOutHealth TakeDamage 007729d0 sets 600 with Shard of Glass (448) under FLAG_BLEED_OUT self-bleed; Update 00782af0 subtracts GetHitPointsLost, at <1 deals damage and resets 600, tints <150, clears the flag+0 when healed; AddHearts/AddRottenHearts zero it diff --git a/notes/items/parity_player_parts.md b/notes/items/parity_player_parts.md new file mode 100644 index 0000000..c81662d --- /dev/null +++ b/notes/items/parity_player_parts.md @@ -0,0 +1,47 @@ +# Player parts: head and body as separately transformed layer groups (parity sweep, player_parts) + +## How Repentance+ draws Isaac +- One player sprite (Entity_Player +0x48, gfx/001.000_player.anm2) with 15 layers: 0 glow, 1 body, 2 body0, 3 body1, + 4 head, 5-10 head0-head5, 11 top0, 12 extra, 13 ghost, 14 back. Costumes are separate sprites (_costumeSpriteDescs, + stride 0x130) mapped onto those layers by _playerCostumeMap[15] (+0x122c, stride 0x10: _index, _layerID, _priority, + _isBodyLayer +0xc). +- _isBodyLayer is set by Entity_Player::UpdateCostumes 0x75bf00 (at 0x75c37x): layers 1, 2, 3 and 11 (body, body0, + body1, top0) are body layers; every other layer is a "head" layer (glow and back included). +- Entity_Player::Update 0x782af0, near the end (0x786a7a..0x787b70), builds two scale pairs and a head lift, then sets + every player layer's LayerState _color (+0x48), _size (+0x34) and _pos (+0x40): + - starts: body scale [EBP-0x144]/[EBP-0x124] = (1,1), head scale [EBP-0x184]/[EBP-0x188] = (1,1), head lift + [EBP-0x150] = 0, x offset [EBP-0x12c] = 0 (0x78745a). + - body layers (0x7879a4): colour local_98, size = _bodyScale (+0x14f8) * body scale pair; pos.x = x offset. + - head layers (0x787a5a): colour local_f0, pos = HeadTransform null pos (from the costume on map entry 1, the body + layer: +0x123c) * _bodyScale, size = HeadTransform scale * _headScale (+0x1500) * the head costume's own head-layer + frame scale (local_16c: map entry 4, +0x126c, skipped for Pluto 598 / Inner Child 688 costumes) * head scale pair; + pos.y += (_headScale.y - _bodyScale.y) * 2.5 (0xbaa6bc) + head lift * 8 (0xbaa7e8); then pos.x = x offset + (0x787b47: the HeadTransform x is overwritten). + - a second loop (0x787b81..) copies each player layer's _size and _pos (and colour) onto the matching layer of the + costume sprite that owns it, so costumes follow their layer group. +- render_build_sprite_quad 0x409cb0: a frame draws at frame pos + layer _pos + anm2 offset, its scale frame scale * + layer _size about that point (the frame's pivot), then the sprite's scale about the sprite origin. Rotation adds + layer _rotation. +- _headScale/_bodyScale: Entity_Player::EvaluateItems 0x763570 (CACHE_SIZE 0x800) sets _headScale to + 2^(0.152 * (Odd Mushroom Large 121 - Odd Mushroom Thin 120 counts and effects) + 1.585 in timed set 0x23 - 1 in 0x24) + (linear past 2) and _bodyScale to (1,1); saved in GameStatePlayer (0x3d..0x40). + +## Effects that shape the parts in Update 0x782af0 +- Adrenaline (493, 0x1ed), 0x786a9f: pulsing head and body scales and head lift from missing hearts. +- Tainted Magdalene's hug (_hugCountdown +0x1ef8), 0x7870a0: f = table DAT_00b6bc98[clamp(8 - t, 0, 6)]; body and + head x * (2 - f), y * f; head lift + (f - 1) * 4. +- Jelly Belly (690, _jellyBellyBounceTimer +0x1efc), 0x787178..0x7872da: t = max(t - speedMultiplier, 0); + s(x) = 1 - (x / 20) * sin(2 pi x / 10) * 0.4 (0xbaa87c 20, 0xbaa708 pi, 0xbaa81c 10, 0xbaa280 0.4); + body x * (2 - s(t)), y * s(t); head x * (2 - s(t + 1)), y * s(t + 1); head lift + (s(t + 1) - 1) * 3 (0xbaa6fc). + TakeDamage 0x7729d0 sets the timer 14 (shot) or 20 (enemy). +- Reverse Chariot (_reverseChariotMoveCooldown +0x1ed0 > 1), 0x787444: x offset = {0, -0.5, -1, 0.5, 2, 1, 0}[min(6, ..)] + (both groups' pos.x). +- Berserk effect (704, 0x2c0), 0x7874a9: head HeadTransform x + sin(updateClock * pi/2) (but see pos.x overwrite above; + read the asm before porting) and a colour pulse on both groups. +- Mars (593, 0x251): head colour (local_f0) flash every 30 frames while the dash is ready. +- Player type 0x23 (+0x1f88) and challenge 0x2a: head offsets / HeadAnim null. +- Many colour effects multiply local_f0 (head) and local_98 (body) together. + +## Port (isaac-classic, items/player_parts) +- PlayerPart {scale, offset, colour} for head and body on PlayerAnimation, reset every animation step + (player_parts_step), applied by anm2_look_draws's walk to the layers of each group, about each frame's pivot.