Fix a lot of bugs in the PC editor
- Alchemy dialog had black text on dark background - Buttons didn't depress when clicked - Edit XP button just said "Edit" - Two menuitems in Special Edit menu had been left with default names - Callbacks in Special Edit and Free Extras menu weren't correctly assigned - Edit XP dialog put the XP to next level in the wrong place - Fixed alchemy dialog LED naming Supporting changes in the dialog engine: - Getting or setting control text as a number now uses the long long type to allow maximal precision - When adding a label to a button, the dialog's default text colour is used instead of the button's text colour if the dialog's background is dark
This commit is contained in:
@@ -74,8 +74,7 @@ bool handle_action(sf::Event event,short mode)
|
||||
(univ.party[i].main_status > 0)) {
|
||||
do_button_action(0,i);
|
||||
current_active_pc = i;
|
||||
display_party(6,1);
|
||||
draw_items(1);
|
||||
redraw_screen();
|
||||
}
|
||||
for (i = 0; i < 5; i++)
|
||||
if((the_point.in(edit_rect[i][0])) &&
|
||||
@@ -105,14 +104,12 @@ bool handle_action(sf::Event event,short mode)
|
||||
(univ.party[current_active_pc].items[i].variety > 0)) { // variety = 0 no item in slot/ non 0 item exists
|
||||
flash_rect(item_string_rects[i][1]);
|
||||
take_item(current_active_pc,i);
|
||||
draw_items(1);
|
||||
}
|
||||
for (i = 0; i < 24; i++)
|
||||
if((the_point.in(item_string_rects[i][2])) && // identify item
|
||||
(univ.party[current_active_pc].items[i].variety > 0)) {
|
||||
flash_rect(item_string_rects[i][2]);
|
||||
univ.party[current_active_pc].items[i].ident = true;
|
||||
draw_items(1);
|
||||
}
|
||||
|
||||
return to_return;
|
||||
@@ -131,7 +128,7 @@ void flash_rect(RECT to_flash)
|
||||
static bool get_num_event_filter(cDialog& me, std::string item_hit, eKeyMod mods)
|
||||
{
|
||||
me.toast();
|
||||
me.setResult(me["number"].getTextAsNum());
|
||||
me.setResult<long long>(me["number"].getTextAsNum());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -154,7 +151,7 @@ void edit_gold_or_food(short which_to_edit)
|
||||
dlog["number"].setTextToNum((which_to_edit == 0) ? univ.party.gold : univ.party.food);
|
||||
|
||||
dlog.run();
|
||||
int dialog_answer = minmax(0,25000,dlog.getResult<int>());
|
||||
int dialog_answer = minmax(0,25000,dlog.getResult<long long>());
|
||||
if (which_to_edit == 0)
|
||||
univ.party.gold = dialog_answer;
|
||||
else
|
||||
@@ -301,7 +298,7 @@ void edit_xp(cPlayer *pc)
|
||||
|
||||
dlog.run();
|
||||
|
||||
int dialog_answer = minmax(0,10000,abs(dlog.getResult<int>()));
|
||||
int dialog_answer = minmax(0,10000,abs(dlog.getResult<long long>()));
|
||||
|
||||
pc->experience = dialog_answer;
|
||||
}
|
||||
|
@@ -245,12 +245,16 @@ void Set_up_win ()
|
||||
pc_gworld.loadFromImage(*ResMgr::get<ImageRsrc>("pcs"));
|
||||
}
|
||||
|
||||
static void draw_main_screen();
|
||||
static void display_party();
|
||||
static void draw_items();
|
||||
|
||||
|
||||
void redraw_screen()
|
||||
{
|
||||
draw_main_screen();
|
||||
display_party(6,1);
|
||||
draw_items(1);
|
||||
display_party();
|
||||
draw_items();
|
||||
mainPtr.display();
|
||||
}
|
||||
|
||||
@@ -335,16 +339,16 @@ void do_button_action(short which_pc,short which_button)
|
||||
unsigned long dummy;
|
||||
|
||||
current_pressed_button = which_button;
|
||||
display_party(6,0);
|
||||
redraw_screen();
|
||||
play_sound(34);
|
||||
sf::sleep(time_in_ticks(10));
|
||||
current_pressed_button = -1;
|
||||
display_party(6,0);
|
||||
redraw_screen();
|
||||
}
|
||||
|
||||
//extern RECT pc_area_buttons[6][6] ; // 0 - whole 1 - pic 2 - name 3 - stat strs 4,5 - later
|
||||
//extern RECT item_string_rects[24][4]; // 0 - name 1 - drop 2 - id 3 -
|
||||
void draw_items(short clear_first)
|
||||
void draw_items()
|
||||
//short clear_first; // 0 - redraw over, 1 - don't redraw over
|
||||
{
|
||||
short i;
|
||||
@@ -357,13 +361,6 @@ void draw_items(short clear_first)
|
||||
dest_rect = item_string_rects[0][0];
|
||||
dest_rect.bottom += 3;
|
||||
dest_rect.offset(0,-14);
|
||||
|
||||
// First erase crap there already by painting background texture over it
|
||||
if (clear_first == 1) {
|
||||
for (i = 0; i < 24; i++)
|
||||
tileImage(mainPtr,item_string_rects[i][0],bg_gworld,bg[12]);
|
||||
tileImage(mainPtr,dest_rect,bg_gworld,bg[12]);
|
||||
}
|
||||
|
||||
// First, draw "Fred's Items:"
|
||||
//sprintf((char *)to_draw,"%s items:",univ.party[current_active_pc].name);
|
||||
@@ -408,30 +405,14 @@ void draw_items(short clear_first)
|
||||
|
||||
}
|
||||
|
||||
void display_party(short mode,short clear_first)
|
||||
void display_party()
|
||||
//short mode; // 0 - 5 this pc, 6 - all
|
||||
//short clear_first; // 1 - redraw over what's already there, 0 - don't redraw over
|
||||
{
|
||||
short i,k,string_num, cur_rect=0;
|
||||
const char* to_draw;
|
||||
const char* skill_value;
|
||||
char to_draw[256], skill_value[256];
|
||||
RECT from_base = {0,0,36,28},from_rect,no_party_rect,temp_rect;
|
||||
|
||||
// TODO: Is this needed?
|
||||
#if 0
|
||||
// lots of stuff is global. Like ...
|
||||
// bool file_in_mem
|
||||
// short current_active_pc
|
||||
if (clear_first == 1) { // first erase what's already there
|
||||
for (i = 0; i < 6; i++)
|
||||
tileImage(mainPtr,pc_area_buttons[i][0],bg_gworld,bg[12]);
|
||||
tileImage(mainPtr,name_rect,bg_gworld,bg[12]);
|
||||
tileImage(mainPtr,pc_race_rect,bg_gworld,bg[12]);
|
||||
tileImage(mainPtr,info_area_rect,bg_gworld,bg[12]);
|
||||
frame_dlog_rect(mainPtr,pc_info_rect); // re-draw the frame
|
||||
}
|
||||
#endif
|
||||
|
||||
if(file_in_mem.empty()) { // what if no party loaded?
|
||||
no_party_rect=pc_info_rect;
|
||||
no_party_rect.top+=5;
|
||||
@@ -453,7 +434,6 @@ void display_party(short mode,short clear_first)
|
||||
|
||||
from_rect = (current_pressed_button == i) ? ed_buttons_from[1] : ed_buttons_from[0];
|
||||
|
||||
if ((current_pressed_button < 0) || (current_pressed_button == i))
|
||||
rect_draw_some_item(buttons_gworld,from_rect,mainPtr,pc_area_buttons[i][0]);
|
||||
TEXT.colour = sf::Color::Black;
|
||||
|
||||
@@ -491,7 +471,6 @@ void display_party(short mode,short clear_first)
|
||||
TEXT.pointSize = 10;
|
||||
|
||||
}
|
||||
if ((current_pressed_button < 0) || (current_pressed_button == i))
|
||||
switch (univ.party[i].main_status) {
|
||||
// draw statistics
|
||||
case 1:
|
||||
@@ -781,11 +760,7 @@ void display_party(short mode,short clear_first)
|
||||
|
||||
|
||||
|
||||
for(i = 0; i < 5; i++)
|
||||
if ((current_pressed_button < 0) || (current_pressed_button == i + 10)) {
|
||||
if (clear_first == 1) { // first erase what's already there
|
||||
tileImage(mainPtr,edit_rect[i][0],bg_gworld,bg[12]);
|
||||
}
|
||||
for(i = 0; i < 5; i++) {
|
||||
//frame_dlog_rect(GetWindowPort(mainPtr),edit_rect[i][0],0);
|
||||
//frame_dlog_rect(GetWindowPort(mainPtr),edit_rect[i][1],0);
|
||||
from_rect = (current_pressed_button == i + 10) ? ed_buttons_from[1] : ed_buttons_from[0];
|
||||
@@ -793,19 +768,19 @@ void display_party(short mode,short clear_first)
|
||||
TEXT.colour = sf::Color::White;
|
||||
switch(i) {
|
||||
case 0:
|
||||
win_draw_string(mainPtr,edit_rect[0][1]," Add Mage Spells ",0,10);
|
||||
win_draw_string(mainPtr,edit_rect[0][1]," Add|Mage|Spells",0,10);
|
||||
break;
|
||||
case 1:
|
||||
win_draw_string(mainPtr,edit_rect[1][1]," Add Priest Spells ",0,10);
|
||||
win_draw_string(mainPtr,edit_rect[1][1]," Add|Priest|Spells",0,10);
|
||||
break;
|
||||
case 2:
|
||||
win_draw_string(mainPtr,edit_rect[2][1]," Edit Traits",0,10);
|
||||
win_draw_string(mainPtr,edit_rect[2][1]," Edit|Traits",0,10);
|
||||
break;
|
||||
case 3:
|
||||
win_draw_string(mainPtr,edit_rect[3][1]," Edit Skills",0,10);
|
||||
win_draw_string(mainPtr,edit_rect[3][1]," Edit|Skills",0,10);
|
||||
break;
|
||||
case 4:
|
||||
win_draw_string(mainPtr,edit_rect[4][1]," Edit XP",0,10);
|
||||
win_draw_string(mainPtr,edit_rect[4][1]," Edit| XP",0,10);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@@ -1,16 +1,6 @@
|
||||
|
||||
void init_main_buttons();
|
||||
void Set_up_win ();
|
||||
void redraw_screen();
|
||||
void draw_main_screen();
|
||||
void do_button_action(short which_pc,short which_button);
|
||||
void draw_items(short clear_first);
|
||||
void display_party(short mode,short clear_first);
|
||||
void undo_clip();
|
||||
void add_string_to_buf(char *str) ;
|
||||
//void display_strings_event_filter (short item_hit);
|
||||
//void display_strings(short str1a,short str1b,short str2a,short str2b, char *title,short sound_num,short graphic_num,short graphic_type,short parent_num);
|
||||
//void get_str(const char* str,short i, short j);
|
||||
short string_length(char *str);
|
||||
void make_cursor_sword();
|
||||
void init_dialogs();
|
||||
void record_display_strings();
|
||||
void make_cursor_sword();
|
@@ -470,7 +470,6 @@ void handle_item_menu(int item_hit)
|
||||
store_i = item_list[item_hit];
|
||||
store_i.ident = true;
|
||||
give_to_pc(current_active_pc,store_i,false);
|
||||
draw_items(1);
|
||||
}
|
||||
|
||||
//void set_cursor(CursHandle which_curs)
|
||||
|
@@ -372,7 +372,7 @@
|
||||
<array class="NSMutableArray" key="NSMenuItems">
|
||||
<object class="NSMenuItem" id="35616607">
|
||||
<reference key="NSMenu" ref="779223651"/>
|
||||
<string key="NSTitle">Item 1</string>
|
||||
<string key="NSTitle">Add Alchemy</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="229763992"/>
|
||||
@@ -380,7 +380,7 @@
|
||||
</object>
|
||||
<object class="NSMenuItem" id="807827245">
|
||||
<reference key="NSMenu" ref="779223651"/>
|
||||
<string key="NSTitle">Item 2</string>
|
||||
<string key="NSTitle">Own All Boats/Horses</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="229763992"/>
|
||||
|
@@ -71,9 +71,9 @@ void init_menubar() {
|
||||
setMenuCallback([file_menu itemWithTitle: @"Open…"], handler, @selector(fileMenu:), 3);
|
||||
|
||||
for(int i = 0; i < [reg_menu numberOfItems]; i++)
|
||||
setMenuCallback([reg_menu itemAtIndex: i], handler, @selector(freeMenu:), i);
|
||||
setMenuCallback([reg_menu itemAtIndex: i], handler, @selector(freeMenu:), i + 1);
|
||||
for(int i = 0; i < [extra_menu numberOfItems]; i++)
|
||||
setMenuCallback([extra_menu itemAtIndex: i], handler, @selector(specMenu:), i);
|
||||
setMenuCallback([extra_menu itemAtIndex: i], handler, @selector(specMenu:), i + 1);
|
||||
|
||||
menu_activate();
|
||||
}
|
||||
|
Reference in New Issue
Block a user