| Author |
Message |
Crunchy Newbie

 Joined: 21 Mar 2008 Posts: 4
|
Posted: Fri Mar 21, 2008 6:00 am
Post subject: My own DOS Game Library |
|
|
Hi everybody,
at the moment, i'm developing my own DOS Game Programming Library using GCC from DJGPP. I've just implemented a sprite system and it works fine. But now I want to create an array of sprites and it just crashes. The problem's described better here : http://djdamy.speed-codings.de/problem.rtf
thanks in advance!
Crunch |
|
| Back to top |
|
 |
MiniMax Expert

 Joined: 25 Jan 2007 Posts: 166 Location: Stockholm, Sweden
|
Posted: Mon Mar 24, 2008 6:41 am
Post subject: |
|
|
Crunchy -can't you try to isolate the part that is causing the error? Like uncommenting most of the body in CreateSpriteSet() and see if it still crashes? Then re-enabling the initialization part, but leave the for-loop de-activated? After a while you should be able to tell which part of the code that is causing the problem.
You could also try to run the code outside of DOSBox. Maybe the error message will be different, telling you something new? |
|
| Back to top |
|
 |
Crunchy Newbie

 Joined: 21 Mar 2008 Posts: 4
|
Posted: Mon Mar 24, 2008 7:37 am
Post subject: |
|
|
Well, i already isolated it. It's the part in which I access the bitmap memory of the sprite with DrawBitmap. This error is so confusing because it works with this -> "Sprite MySpr;" but not with "Sprite Sprites[ x ];" - Where's the difference between when i hand over "MySpr" and "Sprites[ 0 ]" to the function? They're both Sprite-structs right?
And without the DOSBox it doesn't work on my computer.
If anyone has a older computer and would test it for me - that would be great
http://djdamy.speed-codings.de/mode13.rar
Thanks in advance!
Crunchy |
|
| Back to top |
|
 |
MiniMax Expert

 Joined: 25 Jan 2007 Posts: 166 Location: Stockholm, Sweden
|
Posted: Mon Mar 24, 2008 8:25 am
Post subject: |
|
|
Ahh - the joy of C and pointers, always giving the programmer enough rope to hang himself
I don't know how good/recent this DJGPP compiler is. I would try to compile, not run, just compile the code using some other compiler, with all the warning flags and strict compliance flags you can throw at it. Maybe that will throw up enough warnings to tell you what the difference is. |
|
| Back to top |
|
 |
Crunchy Newbie

 Joined: 21 Mar 2008 Posts: 4
|
Posted: Mon Mar 24, 2008 12:04 pm
Post subject: |
|
|
well actually its a c++ compiler...it's a little confusing, i thought it was C at first. In the DJGPP package, there are 2 compiler. A C and a C++ Compiler. At first i used the C compiler but i just got a lot of errors i didn't understand. So i just decided to try the other one and it worked ^^
Do you know which one i should try? |
|
| Back to top |
|
 |
MiniMax Expert

 Joined: 25 Jan 2007 Posts: 166 Location: Stockholm, Sweden
|
Posted: Mon Mar 24, 2008 1:29 pm
Post subject: |
|
|
| I think the answer to that is evident: The one that gives you the fewest errors. Do you compile with -Wall ? |
|
| Back to top |
|
 |
|