Collision List - Recursive -Clock#351
Merged
Merged
Conversation
Rework collision structs and prototypes to restore attack and body boxes to fixed-slot collections backed by arrays and active masks. This commit does not compile yet. Implementations still need to be updated to match the new collection API.
…tance model. Collision boxes now use fixed array containers instead of linked lists, with each collection capped at 64 entries. Attack, body, and space collision boxes are represented through the shared `s_collision_instance` structure, while the previous attack/body-specific collection types have been replaced by `s_collision_collection`. Legacy entity collision functions and properties were removed as part of the cleanup, with in-progress space boxes intended to replace their functionality. Collision debug display options were also expanded in `savedata.h`, including a new projected mode that draws perspective wireframe boxes for depth debugging.
…ordinate entry shortcut.
…ed box instead of projecting Z front and bakc distances from parent entity.
…y. Minor cleanup in load_cached_model().
Adds script-accessible system time support with Unix timestamps in seconds and milliseconds, plus local and UTC time standards. Adds numeric datetime component accessors for gameplay logic, including year, month, day, hour, minute, and second. Also adds datetime_format() for strftime-style custom date/time output. Component accessors and atetime_format() accept optional custom timestamps or default to the current system time. They also support local or UTC output.
…ted linked list and the fixed array of 16 elements. The entity structure has been restored to storing only a pointer, though it no longer points to a linked-list head node. Instead, a full collection of recursive-effect structures is lazy-allocated when an entity first receives a recursive effect. The maximum number of simultaneously active effects on a single entity is now 64, allowing the collection to use a 64-bit active mask.
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.
Summary
This pull request refactors collision handling around a unified, fixed-slot collection model and includes supporting updates to collision commands, debug rendering, recursive effects, and script-accessible system time.
Collision boxes now use indexed array collections instead of linked lists. Each collection supports up to 64 entries and uses a 64-bit active mask, providing predictable lookup and iteration while still allowing creators to use sparse indexes.
Collision system
Replace linked-list collision storage with fixed array collections backed by active masks.
Support up to 64 collision instances in each collection.
Represent attack, body, and space collisions through the shared s_collision_instance structure.
Replace the previous attack- and body-specific collection types with s_collision_collection.
Remove legacy entity collision functions and properties as part of the transition toward space boxes.
Preserve indexed collision access for easier organization and sparse-index use.
Collision commands
Add coordinate-entry shortcuts for defining complete collision boxes on one line:
attack.coordinates x y width height depth_background depth_foreground
bbox.coordinates x y width height depth_background depth_foreground
These commands populate the full coordinate structure without requiring each coordinate property to be entered separately.
Collision debug display
Add a projected collision-debug display mode.
Draw collision depth as perspective wireframe boxes instead of filled shapes.
Correct Z projection so background and foreground depth are projected outward from the parent entity rather than centering the completed box around an already adjusted position.
Recursive effects
Recursive effects now use a middle ground between the previous unlimited linked list and the fixed array of 16 elements.
The entity structure has been restored to storing only a pointer, though it no longer points to a linked-list head node. Instead, a full collection of recursive-effect structures is lazy-allocated when an entity first receives a recursive effect.
The maximum number of simultaneously active effects on a single entity is now 64, allowing the collection to use a 64-bit active mask without increasing the resident size of every entity.
System datetime API
Add script-accessible system time support, including:
Unix timestamps in seconds and milliseconds.
Local and UTC time standards.
Numeric accessors for year, month, day, hour, minute, and second.
datetime_format() support for custom date and time formatting.
Optional caller-provided timestamps, with the current system time used by default.