[Super-tux-devel] Patch with Leveleditor improvements
Brought to you by:
wkendrick
From: Ricardo C. <ri...@ae...> - 2004-02-04 14:30:33
|
Hey there, I've finally managed to put all those level editor menus working. Now you can (using the menu): - Add new levels (it will look for existing levels and add after the last. The level number is displayed in the screen); - Load an existing level (in future, it will just display a list of existing levels); - Test a level (press Esc to come back to the level editor); - Edit level header settings and change stuff like the width (doing a realloc of the level). The menu code of this is huge! There are two ways to short it: 1. just make lesser options (aka hack)... 2. improve menu. The menu should have a funcs that would get the entries and would display them correctly and return the selected one... as i explained in a mail sometime ago. It also asks the user to Save, when a modification has been made, and the user wants to Exit, Load/Add another level or test the level. This patch also modifies the following: - gameloop now receives the level number and if the game is in test mode or not (for the level editor testing); - leveleditor also receives the level number to edit as an argument (not sure if it is usefull, but...); - now, the loadlevel() func doesn't exit if a level file could not be red or is corrupt. It just returns 1 or -1. Currently, all the calls of loadlevel() end with an exit(), but in the future we should just come back to the main menu; - make use of atexit(), as someone already suggested here. atexit() will call st_shutdown when any exit() is called or the end of main is reached, so we don't have to care about quiting SDL and audio; - Title.c had a duplication of the HighScore display code. This could be fixed by making the menu_change variable has NO, in the menu_init(). Cheers, Ricardo (meet you at the meeting ;) ) -- All God's children are not beautiful. Most of God's children are, in fact, barely presentable. -- Fran Lebowitz, "Metropolitan Life" |