In the map XML file, also <Level ...> attribs of the same name.
Some old maps had those, but either the maps were unused,
or the respective graphics never visible.
Long/thin rectangular nodes were not handled correctly,
because it would only check the nearest waterbubble node
for overlap, not all on the map.
+ Lua func: isUnderWater(x, y, radius)
- fix typo that broke repeat-scale loading
- fix broken tile effects loading
- fix randomly shuffled world map tiles (as textures were loaded in a random order)
- reload tileset on editor reload (because we want to edit textures duh)
Apparently this was planned, but never worked.
Also removed watch() canQuit parameter because during watch(),
input is disabled.
Moved the quitting logic to DSQ::run() and added the canQuit param there.
Game still didn't get the ACTION_ESC for some reason so an extra check for
a raw Esc keypress seems like a good solution.
Game scripts calling watch() and watchForVoice() never used the canQuit
parameter (presumably because it was broken?) so i've felt it's an ok
thing to take it out completely.
Textures used to be unloaded as soon as they were unreferenced.
The TextureMgr cache keeps an active reference to prevent load-unload-load
cycles so it only unloads things when explicitly asked.
This does require some more peak VRAM during map/tileset transitions
especially, since old textures are unloaded only after the next map
has been loaded, but the shortened load times should be worth it.
Major code/logic cleanups + it has a multithreaded batch mode now.
The VFS code doesn't like multiple threads at all,
so for now there's a big lock in front of where it matters.
Changed precacher, map/tileset, and worldmap loading to batched mode.
Still TODO:
- fix broken mod preview images
- reloading resources on debug key
- make mod recache entirely unnecessary
- actually drop resources when no longer needed
Bugfix: Actually call postInit() for entities spawned via "se" node.
Bugfix: Don't call postInit() twice for the active pet
Previously, f55a70b459 changed entity ID handling so that
script-spawned entities have negative IDs and entities placed
on the map have positive IDs.
Turns out that positive IDs were still flaky due to frequent renumbering
upon map load. Typically entity IDs are assigned sequentially, and if,
upon loading, an entity with an already existing ID was to be spawned,
that new entity would be assigned a new unique ID (often its ID+1).
That in turn would often cascade into a long string of IDs falsely
considered conflicting because one bad entity started the entire thing.
During lots of map editing I've noticed that sometimes after adding an
entity to an older map, saving, and loading, many entities could be shuffled
around on the map. I'm not 100% sure this bug is related (and it may or
may not be fixed, i don't know yet, time will tell)
but at least entity numbering should be fine now.
This change properly and permanently renumbers entities so that upon map save,
the problem will no longer occur on subsequent loads and entity IDs
will be stable from then on.
Duplicate entity IDs should also no longer happen.
Also kill Entity::entityTypeIdx because there's no need to store it.
And yes i do feel bad for nuking that funny comment block :<
A map element ("tile") can now be tagged with an int.
In the editor:
Ctrl+Numpad to quickly set tag 0-9
Ctrl+T to input tag number for selection
This tag can be used by scripts for more advanced tile
manipulation compared to the old node_setElementsInLayerActive().
This function now takes a 4th parameter, the tag.
If 0 or omitted, the behavior is unchanged.
Otherwise, only affect tiles with that tag.
Add Lua func refreshElementsWithTagCallback(tag, callback):
Call callback(templateIdx:int, texture:str, active:bool, layer:int, tag:int),
and the tile is set to active when the return value is true.
refreshElementsOnLayerCallback(tag, callback) is also changed to use
the same callback.
Also fix UB (dangling pointer)in Element::render()
that never even caused a single problem.
- does no longer depend on collision mask
- remove global Game::lastCollideMaskIndex
- remove the horribly convoluted and now unused RenderObject::getInvRotPosition()
+ Lua func entity_getBoneLockDelay()
+ Lua func entity_setBoneLockDelay()