http://www.mattkemp.co.uk/Stuff/Arcade.zip
Mit/New resident C monkey:
Arcade code above doesn't seem to like me. Whenever I try and run it (and select the new game) it gives no error for crash and just dumps to desktop with an obscure memory error. Personally, I'm not a master on assembly so I have no idea what the hell the disassembly of it means - any ideas?
Coding Problem-ness
- Magicfinger
- Staff
- Posts: 1078
- Joined: Tue Sep 30, 2003 10:38 am
- Location: here,there and everywhere
its the two ZeroMemory(...) lines you got in the TLInitGraphics Procedure, im not too sure what you achieving with them there anyway but as far as i can see it has no operational implications when i comment them out 
ok... comes back for an edit on this one...
spot the difference
int Blocks[8][150];
ZeroMemory( Blocks, sizeof( Blocks[0]) * 1200 );
anyway putting ....
ZeroMemory( Blocks, sizeof( Blocks[0][0] ) * 1200 );
stops the crash to desktop... but its memory like i got any idea what im talking about

ok... comes back for an edit on this one...

spot the difference

int Blocks[8][150];
ZeroMemory( Blocks, sizeof( Blocks[0]) * 1200 );
anyway putting ....
ZeroMemory( Blocks, sizeof( Blocks[0][0] ) * 1200 );
stops the crash to desktop... but its memory like i got any idea what im talking about

thanks, I though it may be something to do with the ZeroMemory-thingies, I think Mit put them in the original invaders and I've been copying them since not understanding properly what they did.; Tho thinking about it, there I have probably been zeroing 1200 times 150 integers, which I'm guessing isn't a small number :]
jus a note :
Often the cause of weird intermittent bugs that seem to disappear when u try to debug em, so its always good practice to explicitly clear your memory before using it.
not zeroing regions of memory often does seem to have no effect in debug (because most compilers clear all memory by default in debug mode), but then you'll find when you compile in release mode suddenly the memory you thought was empty is now full of random shite. (if you're lucky.. if youre unlucky the memory occupied in release mode will just happen to be full of 0s too, and then there'll seem to be no problems until your code is run some other time, or on someone elses machine, when the memory used happens not to be full of 0s)but as far as i can see it has no operational implications when i comment them out
Often the cause of weird intermittent bugs that seem to disappear when u try to debug em, so its always good practice to explicitly clear your memory before using it.
- Magicfinger
- Staff
- Posts: 1078
- Joined: Tue Sep 30, 2003 10:38 am
- Location: here,there and everywhere