Skip to content

Conversation

kalimag
Copy link
Contributor

@kalimag kalimag commented Sep 24, 2025

(continued from #4458)

  • Split definitions out into reusable module
  • Add sector and line definitions

TODO:

  • Complete player and mobj structs
  • Heretic and Hexen enums
  • Misc domain?
  • Make structs more convenient to use
    Ideally you can write code like for mobj in pairs(dsda.mobjs) do print(mobj.type) end and all the memory reading is abstracted away
    • Better array handling
  • Remove Objects cache in things-lines.lua (doesn't work with spawned objects)
  • Cache lines instead?
    Seems to be a big performance cost on fancy Hexen maps

If time permits:

  • Center zoom
  • Filter more mobj types (blood, smoke, decorations, etc.)
  • Stop shooting while clicking the map buttons
    • Annoyingly, moving the map while paused isn't possible because of the way gui.text works

Check if completed:

@vadosnaprimer
Copy link
Contributor

Misc domain may have to wait until I gather feedback from Doom people.

@YoshiRulz YoshiRulz added Request: Feature/Enhancement For feature requests or possible improvements re: Lua API/scripting Relating to EmuHawk's Lua API (not the Lua Console) Core: DSDA-Doom DOOM engine core labels Sep 26, 2025
@kalimag kalimag force-pushed the pr/dsda-lua-module branch from 7a7f2aa to 56267ec Compare October 6, 2025 17:00
@vadosnaprimer
Copy link
Contributor

I think center zoom is done. Not 100% perfect but combined with mouse drag feels sufficient.

dsda.LINE_SIZE = 256 -- sizeof(line_t) is 232, but we padded it for niceness
dsda.MOBJ_SIZE = 512 -- sizeof(mobj_t) is 464, but we padded it for niceness
dsda.PLAYER_SIZE = 1024 -- sizeof(player_t) is 729, but we padded it for niceness
dsda.SECTOR_SIZE = 512 -- sizeof(sector_t) is 344, but we padded it for niceness
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a Sizes table for these too?

local read_u8 = memory.read_u8
local read_u24 = memory.read_u24_le
local read_u32 = memory.read_u32_le
local readfloat = memory.readfloat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar shortcuts exist in the main script, looks like it makes sense to declare them once and then use everywhere?


if Init then init_mobj_bounds() end

-- re-init cache after state load, rewind, etc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event.onloadstate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That isn't raised on rewind

Although I guess it's possible to load a state with the same framecount as the current state, so doing both might be good

assert(dsda.line.size == 232, "line.size does not match sizeof(line_t)")
assert(dsda.mobj.size == 464, "mobj.size does not match sizeof(mobj_t)")
assert(dsda.player.size == 792, "player.size does not match sizeof(player_t)")
assert(dsda.sector.size == 344, "sector.size does not match sizeof(sector_t)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having these as consts at the top is better because we can be descriptive with their names and reuse them if needed. Especially sensible since we have 2 types of sizes: padded and internal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of them can be accessed like dsda.line.size and dsda.line.padded_size, which seems descriptive enough. The asserts are just there to make sure the script calculated them correctly

But sure, I'll put them them back into tables

dsda.LINE_SIZE = 256 -- sizeof(line_t) is 232, but we padded it for niceness
dsda.MOBJ_SIZE = 512 -- sizeof(mobj_t) is 464, but we padded it for niceness
dsda.PLAYER_SIZE = 1024 -- sizeof(player_t) is 729, but we padded it for niceness
dsda.SECTOR_SIZE = 512 -- sizeof(sector_t) is 344, but we padded it for niceness
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having these as consts at the top is better because we can be descriptive with their names and reuse them if needed. Especially sensible since we have 2 types of sizes: padded and internal.

@kalimag
Copy link
Contributor Author

kalimag commented Oct 8, 2025

Should the script pause during TAStudio seek?

@vadosnaprimer
Copy link
Contributor

Scripts only pause by default if you seek with turbo, and there's an option to not pause them even during turbo. Outside of turbo we don't normally make them pause, because sometimes it's needed to keep running, and switching that on and off in the script itself would be annoying. Turbo-seek checkbox is faster to use and more organized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core: DSDA-Doom DOOM engine core re: Lua API/scripting Relating to EmuHawk's Lua API (not the Lua Console) Request: Feature/Enhancement For feature requests or possible improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants