![]() |
|
rest() + save_bitmap() clashes? |
Dark Nation
Member #1,642
November 2001
![]() |
My game calls the rest command to reduce CPU usage. However, after calling save_bitmap (called by a specific keypress to take snapshots), trouble begins. About 10 seconds after making the call to save_bitmap, my palette goes all wonky. I haven't studied it very closely, but I think it may be reverting to the system palette. Any ideas why? If I don't call save_bitmap (just return from the snapshot code) or remove the call to rest, everything is fine. |
Billybob
Member #3,136
January 2003
|
Sounds like memory problems. Accessing memory haven't allocated, broken pointers, dangling pointers, etc.
|
Dark Nation
Member #1,642
November 2001
![]() |
I've whittled down the code to about 100 lines (including several blank lines) and am still getting the error. Can anyone take a look and see if they get the same problem?
I compiled it with: g++ -o test.exe test.cpp -lalleg When you run it, hit the Z key on the keyboard. After about 5 to 10 seconds, the mouse will change colors. I have a strange feeling that it's because I have a rest command inside of a dialog procedure. Is that the problem? Is there a way to make it work? I've even tried replacing the nbmenu_proc with rest_proc, which I defined as: This still gives me the same bug. |
Kauhiz
Member #4,798
July 2004
|
Dark Nation
Member #1,642
November 2001
![]() |
It finds the first unused testXXX.bmp filename. I even tried taking that part out and just using a static filename. Same bug. I even copied the update_dialog function into my code and whittled it down as much as possible while still keeping the bug. I even took out the keyboard_proc and replaced it with specific functions. After doing that and a little more whittling, here is the current incarnation:
Thoughts? The bug seems to have something to do with MSG_IDLE messages. When I take out this line from update_dialog2: player->res |= dialog_message(player->dialog, MSG_IDLE, 0, &player->obj); ...the bug goes away. Edit: I just ran my original code and put a graphical display of the current palette on the screen. All of the colors change to what seems to be the default palette. What's worse, when I do a set_palette from a master palette I set up, the last 10 palette entries won't change. Odder still is the fact that if I output (through al_trace) the palette entries before and after the odd palette change, the values are the same. But, for some reason, the wrong colors are being displayed on the screen. |
|