Game Development Community

Crash on defining cellCount

by Jason McIntosh · in Torque Game Builder · 03/01/2005 (8:44 pm) · 7 replies

If you define an fxAnimationDataBlock2D with a cellCount that exceeds the actual texture it will crash. I had a bitmap whose cellCount was 4x2 but I had 4x4 in the datablock, and it crashed all over the place. :) Hard to track down, too.

#1
03/02/2005 (12:38 am)
@Jason: Woah! I'll check that one out soon. Sorry about that one. (I presume you mean fxImageMapDatablock2D?)

- Melv.
#2
03/02/2005 (4:33 pm)
Yeah, I meant ImageMapDataBlock, sorry.
#3
03/02/2005 (11:14 pm)
Lol, well at least you know you wont put inacurrate cell counts :)
#4
03/03/2005 (12:19 am)
Fixed that problem, expect it in the next update guys. :)

- Melv.
#5
03/07/2005 (3:50 am)
@Jason: Coming back to this. I think we may be talking about something seperate. It's been nagging me a little as I think I fixed something other than what you meant.

Were you saying that when you tried a cellCountX and cellWidth or cellCountY and cellHeight that it crashed?

If so, that's not the problem I fixed. I tried this on several images and I cannot duplicate this problem.

Perhaps you can duplicate this problem on a specific image with a specific imagemap?

If so, would you mind posting me the details/image?

Many thanks,

- Melv.
#6
03/07/2005 (10:34 pm)
Ok, here's the relevant log output:
Loading compiled script tut1/client/datablocks.cs.
fxImageMapDatablock2D::calculateCellImageMap() - Invalid Cell CountX/Width of 5x64=320 [only 256 width] (33)
Loading compiled script tut1/client/mainScreenGui.gui.
initPlayer( 1 )
In the initPlayer() function, it references the ImageMap in question, and that's when it crashes. So it seems like even though it issues a warning, if you use the ImageMap anyway, it will try to address memory outside the allocated range.

Here's the datablock:
datablock fxImageMapDataBlock2D( JackPaddleImageMap )
{
	textureName = "~/client/resource/characters/Jack/images/paddle";
	mode = cell;
	cellWidth = 64;
	cellHeight = 128;
	cellCountX = 5;
	cellCountY = 2;
};
The cellCountX should actually be 4. I set it to 5 for testing and it crashed.

If you need more, please just let me know.
#7
03/07/2005 (11:07 pm)
@Jason: Ah, okay. Well in that case, it's been fixed. All datablocks now have a validation flag which must be set before they can be used anywhere.

Thanks for helping out. :)

- Melv.