My own DOS Game Library

Discuss popular GCS tools like ZZT, Megazeux and Adventure Game Studio, as well as programming and other topics related to game design.
Post Reply
Crunchy
Newbie
Newbie
Posts: 4
Joined: Fri Mar 21, 2008 5:56 am

My own DOS Game Library

Post by Crunchy »

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
User avatar
MiniMax
Expert
Expert
Posts: 149
Joined: Thu Jan 25, 2007 8:03 am
Location: Stockholm, Sweden

Post by MiniMax »

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?
DOSBox ReadMe | DOSBox Wiki | DOSBox 60 seconds guide | How to ask questions
_________________
Shuttle SN41G2 | Athlon XP 2600+ | IGP@128 MB | NEC 3520A DVD | Win XP Home/SP2
Crunchy
Newbie
Newbie
Posts: 4
Joined: Fri Mar 21, 2008 5:56 am

Post by Crunchy »

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
User avatar
MiniMax
Expert
Expert
Posts: 149
Joined: Thu Jan 25, 2007 8:03 am
Location: Stockholm, Sweden

Post by MiniMax »

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.
DOSBox ReadMe | DOSBox Wiki | DOSBox 60 seconds guide | How to ask questions
_________________
Shuttle SN41G2 | Athlon XP 2600+ | IGP@128 MB | NEC 3520A DVD | Win XP Home/SP2
Crunchy
Newbie
Newbie
Posts: 4
Joined: Fri Mar 21, 2008 5:56 am

Post by Crunchy »

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?
User avatar
MiniMax
Expert
Expert
Posts: 149
Joined: Thu Jan 25, 2007 8:03 am
Location: Stockholm, Sweden

Post by MiniMax »

I think the answer to that is evident: The one that gives you the fewest errors. Do you compile with -Wall ?
DOSBox ReadMe | DOSBox Wiki | DOSBox 60 seconds guide | How to ask questions
_________________
Shuttle SN41G2 | Athlon XP 2600+ | IGP@128 MB | NEC 3520A DVD | Win XP Home/SP2
Post Reply