Detecting freeslots

Status
Not open for further replies.

742mph

My work is never done yet
I'm in need of a way to tell whether the object info at a given position in mobjinfo is a freeslot. I tried assuming that an object type was a freeslot if it has a spawnstate of S_NULL, making exceptions for MT_NULL and MT_OVERLAY. To test the method, I used it to calculate where the first available freeslot was, and in an unmodified game, that method successfully found it at position 417. If any custom objects were added, however, it became convinced that the first available freeslot was at 426, regardless of how many objects were actually added. I have no idea how to explain this, but I figure if I could replicate whatever foolproof system is used by SRB2 itself, that weird behavior would probably disappear. Can someone who knows about object/freeslot management lend me some help?
 
There is no method to find freeslots manually, and allowing people to override SRB2's handling of it would be disastrous. What are you trying to do by searching for freeslots? There's probably a much better way to handle it.
 
I need a way to modify the mobj type info of any object that gets added into the game, regardless of whether it was added before, after, or within my Lua script. These modifications involve adding hooks and extra parameters that depend on the properties of the mobj type, so I can't just apply a single set of changes globally. I'm currently trying to accomplish this by iterating through the mobjinfo list and making the required changes whenever my script detects that the first available freeslot has been filled, which means that at least one new mobj type has been added. If you can think of a better way to initiate the scan upon the addition of new mobj types that doesn't involve iterating through all of mobjinfo every single tic, I'm all ears.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top