Macro-ify access to pauseCtx->playerSegment regions#2693
Open
Thar0 wants to merge 2 commits intozeldaret:mainfrom
Open
Macro-ify access to pauseCtx->playerSegment regions#2693Thar0 wants to merge 2 commits intozeldaret:mainfrom
Thar0 wants to merge 2 commits intozeldaret:mainfrom
Conversation
Using macros to indicate which region in the player segment is being accessed makes the memory layout more obvious and indicates the intended level of memory ownership, particularly in the case of the texture image at the start of the segment.
AngheloAlf
approved these changes
Jan 28, 2026
mzxrules
reviewed
Jan 28, 2026
src/code/z_player_lib.c
Outdated
|
|
||
| size = gObjectTable[OBJECT_GAMEPLAY_KEEP].vromEnd - gObjectTable[OBJECT_GAMEPLAY_KEEP].vromStart; | ||
| ptr = segment + PAUSE_EQUIP_BUFFER_SIZE; | ||
| ptr = PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP(segment); |
Contributor
There was a problem hiding this comment.
With all this abstraction, it is no longer clear to the reader that GAMEPLAY_KEEP is being truncated.
Also, another notable thing here is that because OBJECT_GAMEPLAY_KEEP is compressed, the full segment needs to be loaded in first, then overwritten.
Dragorn421
reviewed
Feb 14, 2026
|
|
||
| #define PAUSE_EQUIP_BUFFER_SIZE sizeof(u16[PAUSE_EQUIP_PLAYER_HEIGHT][PAUSE_EQUIP_PLAYER_WIDTH]) | ||
| // The pause player segment consists of: | ||
| // PAUSE_PLAYER_RENDER_TEX_SIZE RGBA16 texture / framebuffer for rendering the player into |
Collaborator
There was a problem hiding this comment.
Suggested change
| // PAUSE_PLAYER_RENDER_TEX_SIZE RGBA16 texture / framebuffer for rendering the player into | |
| // PAUSE_PLAYER_SEGMENT_TEX_SIZE RGBA16 texture / framebuffer for rendering the player into |
not sure which name you preferred, either sounds fine
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.
Using macros to indicate which region in the player segment is being accessed makes the memory layout more obvious and indicates the intended level of memory ownership, particularly in the case of the texture image at the start of the segment.