Well, I fixed the crash by reworking my depth scale and depth parameters while rendering. Mod sent me a response that outlined the details for handling sprite depth and their sprite depth scale attribute! He allowed me to post his response for the benefit of all, so enjoy
Quote: "
About the depth. I easily understand that the documentation I wrote was not really the clearest possible.
The depth scale allows you to set a number of usable layers for sprite renders. For example, if you need 3 layers, set the depth scale to 2 (zero based "index"), and use a depth of 0, 1 or 2 with any of the DXS DRAW command to determine what is rendered first. The use of any other depth than those 3 numbers won't display the sprite (a behavior that can be exploited in many ways).
The way to determine what is rendered first is quite easy : juste divide the depth by the scale. Zero is rendered first, one is rendered last. This is why two sprites with a same render depth but a different depth scale won't be rendered at the same time . Example : my first sprite has a depth scale of 5, the second one of 10. If I render the two sprites with the same depth of 1, the second sprite will be rendered first, 1 / 10 < 1 / 5.
In my opinion, the best way to deal with depth scale is to use constants (whose cpu cost is near zero), then work in a relative way.
Let's say you need for an RPG type game 3 layers for the map display (floor, objects under characters (bottom of walls, flowers...) and objects above characters (top of trees, houses, birds...), you can define something like this :
#constant LAYER_TOP 0
#constant LAYER_MIDDLE 1
#constant LAYER_BOTTOM 2
Use a constant to set the depth scale for all sprites :
#constant LAYERS 2
Then use these constants for renders :
dxs draw sprite spr, x, y, LAYER_XXX
If you realize you're needing more layers for interface, no problem, just change the constants and add one, you won't have to refactor the code :
#constant LAYER_INTERFACE 0
#constant LAYER_TOP 1
#constant LAYER_MIDDLE 2
#constant LAYER_BOTTOM 3
#constant LAYERS 3
Then, if you want to do something like a rotating menu, just adjust a bit the vales:
#constant LAYER_INTERFACE 0
// no use of layers 1 and 2
#constant LAYER_TOP 3
#constant LAYER_MIDDLE 4
#constant LAYER_BOTTOM 5
#constant LAYERS 5
And work relatively to draw your interface :
dxs draw sprite spr, x, y, LAYER_INTERFACE // layer 0 of interface
dxs draw sprite spr, x, y, LAYER_INTERFACE + 1 // layer 1 of interface
dxs draw sprite spr, x, y, LAYER_INTERFACE + 2 // layer 2 of interface
That way, you can add countless number of layers without needing to refactor your code.
"
Also, the current build of my engine is attached. There are a few bugs yet, but its coming along well I think... Everything is just a placeholder sprite more or less, but demonstrates some (really) basic ai and attack routines. Everything is experimental but I'm hopeful this will become an epic action rpg... Think Dark Souls/Legend of Zelda/Final Fantasy 7/X/Suikoden/32bit RPG style...
W,S,D,Shift,Ctrl,Space, and DKeys all do fun things!
RAWWWR