-
Notifications
You must be signed in to change notification settings - Fork 428
DSDA Lua script #4464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
DSDA Lua script #4464
Conversation
Misc domain may have to wait until I gather feedback from Doom people. |
96725d2
to
5cc4472
Compare
cleanup
7a7f2aa
to
56267ec
Compare
I think center zoom is done. Not 100% perfect but combined with mouse drag feels sufficient. |
Assets/Lua/Doom/dsda-data.lua
Outdated
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
They're still available through `line.padded_size` etc.
|
||
if Init then init_mobj_bounds() end | ||
|
||
-- re-init cache after state load, rewind, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
event.onloadstate
There was a problem hiding this comment.
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
Assets/Lua/Doom/dsda-data.lua
Outdated
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)") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Assets/Lua/Doom/dsda-data.lua
Outdated
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 |
There was a problem hiding this comment.
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.
Should the script pause during TAStudio seek? |
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. |
(continued from #4458)
TODO:
Ideally you can write code like
for mobj in pairs(dsda.mobjs) do print(mobj.type) end
and all the memory reading is abstracted awayObjects
cache inthings-lines.lua
(doesn't work with spawned objects)Seems to be a big performance cost on fancy Hexen maps
If time permits:
gui.text
worksCheck if completed: