Skip to content

DM: Replace raw thing-data casts with typed struct arrays#7594

Merged
sev- merged 1 commit into
scummvm:masterfrom
mohitbankar:DM
Jul 8, 2026
Merged

DM: Replace raw thing-data casts with typed struct arrays#7594
sev- merged 1 commit into
scummvm:masterfrom
mohitbankar:DM

Conversation

@mohitbankar

@mohitbankar mohitbankar commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Thing data (doors, weapons, armour, etc.) was previously stored as raw uint16 arrays and accessed via pointer casts (e.g. (Weapon *)getThingData(thing)), relying on assumptions about struct layout that don't hold on all platforms.

Each thing type is now parsed into its own Common::Array at load time, and accessed via typed accessors (getWeapon(), getDoor(), etc.) replacing the old casts.

@sev- sev- marked this pull request as draft June 22, 2026 10:38
@mohitbankar mohitbankar force-pushed the DM branch 2 times, most recently from 3d24a12 to de25dc3 Compare June 22, 2026 14:45
@mohitbankar mohitbankar marked this pull request as ready for review June 22, 2026 14:45
@mohitbankar mohitbankar marked this pull request as draft June 30, 2026 12:43
@mohitbankar mohitbankar changed the title DM: Replace struct loading with portable byte-offset macros DM: Replace raw thing-data casts with typed struct arrays Jul 2, 2026
@mohitbankar mohitbankar force-pushed the DM branch 2 times, most recently from 6e12f50 to 0df0152 Compare July 2, 2026 19:15
Thing data was previously accessed via pointer casts on raw uint16 arrays. Each type is now parsed into its own typed Common::Array<T> at load time.
@mohitbankar mohitbankar marked this pull request as ready for review July 2, 2026 20:04
@sev-

sev- commented Jul 8, 2026

Copy link
Copy Markdown
Member

Thank you!

@sev- sev- merged commit 99a402e into scummvm:master Jul 8, 2026
1 check passed
@mohitbankar mohitbankar deleted the DM branch July 8, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants