//--------- Begin of function FirmResearch::disp_research_menu ---------// // void FirmResearch::disp_research_menu(int refreshFlag) { if( refreshFlag != INFO_REPAINT ) return; int techId, y=INFO_Y1; added_count=0; for( techId=1 ; techId<=tech_res.tech_count ; techId++ ) { if( !tech_res[techId]->can_research(nation_recno) ) continue; if( added_count < MAX_RESEARCH_OPTION ) { button_research_array[added_count].paint(INFO_X1, y, INFO_X2, y+RESEARCH_OPTION_HEIGHT-2, i_disp_research_button, ButtonCustomPara(this, techId) ); added_count++; y += RESEARCH_OPTION_HEIGHT; } } // ###### begin Gilbert 16/8 ######// // button_cancel.paint(INFO_X1, y, "CANCEL1", "CANCEL1D" ); button_cancel.paint(INFO_X1, y, INFO_X2, y+RESEARCH_OPTION_HEIGHT*3/4, ButtonCustom::disp_text_button_func, ButtonCustomPara((void*)"Cancel",0) ); // ###### end Gilbert 16/8 ######// }
//-------- Begin of function i_disp_build_button --------// // static void i_disp_build_button(ButtonCustom *button, int repaintBody) { int x1 = button->x1; int y1 = button->y1; int x2 = button->x2; int y2 = button->y2; if( !button->pushed_flag ) { if( repaintBody ) { vga_util.blt_buf(x1, y1, x2, y2, 0); vga_util.d3_panel2_up( x1, y1, x2, y2, 1 ); } x2--; y2--; } else { if( repaintBody ) { vga_util.blt_buf(x1, y1, x2, y2, 0); vga_util.d3_panel2_down( x1, y1, x2, y2, 1 ); } x1++; y1++; } ButtonCustom *queueButton = (ButtonCustom *)button->custom_para.ptr; if( repaintBody) { // display unit large icon short unitId = button->custom_para.value; UnitInfo* unitInfo = unit_res[unitId]; vga_front.put_bitmap(x1+6, y1+4, unitInfo->get_large_icon_ptr(0)); err_when( button->custom_para.value != queueButton->custom_para.value); //-------- display unit name --------// String str; str = unitInfo->name; if( unitInfo->unit_class == UNIT_CLASS_WEAPON ) // add version no. { FirmHarbor *harbor = (FirmHarbor *)queueButton->custom_para.ptr; int techLevel = unitInfo->get_nation_tech_level(harbor->nation_recno); if( techLevel > 1 ) { str += " "; str += misc.roman_number(techLevel); } } font_bible.put( x1+60, y1+13, str ); } // display small button queueButton->paint(-1, repaintBody); }
//-------- Begin of function i_disp_build_button --------// // static void i_disp_build_button(ButtonCustom *button, int repaintBody) { int x1 = button->x1; int y1 = button->y1; int x2 = button->x2; int y2 = button->y2; short unitId = button->custom_para.value; UnitInfo* unitInfo = unit_res[unitId]; short nationRecno = firm_array[firm_array.selected_recno]->nation_recno; info.draw_unit_icon( x1+34, y1+46, unitId, nationRecno, INFO_X1, INFO_Y1, INFO_X2, INFO_Y2, button->pushed_flag ? 4 : 1 ) ; ButtonCustom *queueButton = (ButtonCustom *)button->custom_para.ptr; err_when( button->custom_para.value != queueButton->custom_para.value); //-------- display unit name --------// String str; str = unitInfo->name; FirmIncubator *incubator = (FirmIncubator *)queueButton->custom_para.ptr; int techLevel = unitInfo->get_nation_tech_level(incubator->nation_recno); if( techLevel > 1 ) // no space for version { str += " "; str += misc.roman_number(techLevel); } // font_whbl.center_put( x1, y1, x1 +67, y1+20, str, 0, 1 ); font_whbl.center_put( x1, y1, x1 +67, y1+20, str, 0, 0 ); font_whbl.center_put( x1-3, y2-22, x1 +67+3, y2-2, misc.format(unit_res[unitId]->build_cost, 2)); // display small button queueButton->paint(-1, repaintBody); }
//-------- Begin of function i_disp_build_button --------// // static void i_disp_build_button(ButtonCustom *button, int repaintBody) { int x1 = button->x1; int y1 = button->y1; int x2 = button->x2; int y2 = button->y2; short unitId = button->custom_para.value; UnitInfo* unitInfo = unit_res[unitId]; short nationRecno = firm_array[firm_array.selected_recno]->nation_recno; info.draw_unit_icon( x1+34, y1+46, unitId, nationRecno, INFO_X1, INFO_Y1, INFO_X2, INFO_Y2, button->pushed_flag ? 4 : 1 ); ButtonCustom *queueButton = (ButtonCustom *)button->custom_para.ptr; err_when( button->custom_para.value != queueButton->custom_para.value); //-------- display unit name --------// String str; str = unitInfo->name; // ##### begin Gilbert 24/3 #########// // if( unitInfo->unit_class == UNIT_CLASS_WEAPON ) // add version no. if( unitInfo->class_info.has_weapon_version ) // add version no. // ##### end Gilbert 24/3 #########// { FirmWar *warFactory = (FirmWar *)queueButton->custom_para.ptr; int techLevel = unitInfo->get_nation_tech_level(warFactory->nation_recno); if( techLevel > 1 ) // no space for version { str += " "; str += misc.roman_number(techLevel); } } // font_whbl.center_put( x1-3, y1, x1 +67+3, y1+20, str, 0, 1 ); font_whbl.center_put( x1-3, y1, x1 +67+3, y1+20, str, 0, 0 ); font_whbl.center_put( x1-3, y2-22, x1 +67+3, y2-2, misc.format(unit_res[unitId]->build_cost, 2)); // display small button queueButton->paint(-1, repaintBody); }
//--------- Begin of function FirmHarbor::disp_build_menu ---------// // void FirmHarbor::disp_build_menu(int refreshFlag) { // ###### begin Gilbert 20/9 ######// if( refreshFlag == INFO_UPDATE ) { for( int b=0; b<added_count; ++b ) { button_ship[b].paint(-1, 0); // button_queue_ship[b] is called by button_ship[b].paint(); } } else if( refreshFlag == INFO_REPAINT ) { added_count=0; int unitId, x=INFO_X1, y=INFO_Y1; for( unitId=1; unitId<=MAX_UNIT_TYPE ; unitId++ ) { if( unit_res[unitId]->unit_class == UNIT_CLASS_SHIP ) { if( unit_res[unitId]->get_nation_tech_level(nation_recno) > 0 ) { // disp_build_button( y, unitId, 1); button_queue_ship[added_count].create(x+COUNT_BUTTON_OFFSET_X, y+COUNT_BUTTON_OFFSET_Y, x+COUNT_BUTTON_OFFSET_X+COUNT_BUTTON_WIDTH-1, y+COUNT_BUTTON_OFFSET_Y+COUNT_BUTTON_HEIGHT-1, i_disp_queue_button, ButtonCustomPara(this, unitId) ); button_ship[added_count].paint(x, y, x+BUILD_BUTTON_WIDTH-1, y+BUILD_BUTTON_HEIGHT-1, i_disp_build_button, ButtonCustomPara(&button_queue_ship[added_count], unitId) ); err_when(added_count >= MAX_SHIP_TYPE); // button_unit_id[added_count++] = unitId; added_count++; y += BUILD_BUTTON_HEIGHT; } } } button_cancel.paint(x, y, x+BUILD_BUTTON_WIDTH-1, y+BUILD_BUTTON_HEIGHT*3/4, ButtonCustom::disp_text_button_func, ButtonCustomPara((void*)"Done",0) ); } // ###### end Gilbert 20/9 ######// }
//--------- Begin of function FirmCamp::disp_camp_info ---------// // void FirmFort::disp_camp_info(int dispY1, int refreshFlag) { FirmCamp::disp_camp_info(dispY1, refreshFlag); // ----- display train button -------// int x2 = INFO_X1 +13; int y2 = INFO_Y1 +281; if (!is_monster()) button_train.create( INFO_X1+13, INFO_Y1+281, 'A', "TRAIN" ); else button_train.create( INFO_X1+13, INFO_Y1+281, 'A', "F_TRAIN" ); // scan any available population to train // ##### begin Gilbert 23/12 #######// if( (button_train.visible_flag = is_own()) ) { button_train.enable_flag = can_recruit(active_link_town_recno); button_train.paint(); } // ##### end Gilbert 23/12 #######// // ------- display tower count -----// button_tower_count.create( INFO_X1+13+3*BUTTON_DISTANCE+6, INFO_Y1+235+6, INFO_X1+13+3*BUTTON_DISTANCE+6+TOWER_COUNT_BUTTON_WIDTH-1, INFO_Y1+235+6+TOWER_COUNT_BUTTON_HEIGHT-1, disp_tower_count, ButtonCustomPara( NULL, 0 ) ); //#ifdef DEBUG // BUGHERE : ARM_TOWERS is longer than 8 characters // button_tower_count.set_help_code("ARM_TOWERS"); button_tower_count.set_help_code("ARM_TOWE"); //#endif button_tower_count.enable_flag = is_own(); button_tower_count.custom_para = ButtonCustomPara( NULL, target_archer_count ); button_tower_count.paint(); // ------- display towers ----------// err_when( !image_spict.read_all ); // must read_all char *towerFull = image_spict.read("TOWER-F"); char *towerEmpty = image_spict.read("TOWER-E"); char *towerBuilding = image_spict.read("TOWER-D"); int towerHeight = ((Bitmap *)towerFull)->get_height(); err_when( ((Bitmap *)towerEmpty)->get_height() != towerHeight ); err_when( ((Bitmap *)towerBuilding)->get_height() != towerHeight ); int towerWidth = ((Bitmap *)towerFull)->get_width(); // static int towerXTable[MAX_FORT_ARCHER] = { 180, 202, 191, 180, 202 }; // static int towerYTable[MAX_FORT_ARCHER] = { 280, 280, 292, 304, 304 }; static int towerXTable[MAX_FORT_ARCHER] = { 180, 202, 191, 180, 202 }; static int towerYTable[MAX_FORT_ARCHER] = { 304, 304, 292, 280, 280 }; for( int i = 0; i < MAX_FORT_ARCHER; ++i ) { int towerX = INFO_X1 + towerXTable[i]; int towerY = INFO_Y1 + towerYTable[i]; if( i < current_archer_count ) { // display full tower vga.active_buf->put_bitmap( towerX, towerY, towerFull ); } else if( i == current_archer_count ) { // display building tower vga.active_buf->put_bitmap( towerX, towerY, towerEmpty ); // display portion of towerFull at bottom int subTowerHeight = train_archer_progress * towerHeight / MAX_TRAIN_ARCHER_PROGRESS; if( subTowerHeight > 0 ) { vga.active_buf->put_bitmap_area( towerX, towerY, towerBuilding, 0, towerHeight-subTowerHeight, towerWidth-1, towerHeight-1 ); } } else { // display disabled tower vga.active_buf->put_bitmap( towerX, towerY, towerEmpty ); } } help.set_help( INFO_X1+176, INFO_Y1+278, INFO_X1+176+39, INFO_Y1+278+48, "TOWERS" ); }
//--------- Begin of function FirmInn::put_info ---------// // void FirmInn::put_info(int refreshFlag) { if( selected_unit_id < 0 ) selected_unit_id = 0; if( selected_unit_id > inn_unit_count ) selected_unit_id = inn_unit_count; Firm::put_info(refreshFlag); button_hire.create(INFO_X1+13, INFO_Y1+235, 'A', "HIREUNIT" ); button_hire.enable_flag = 0; button_spy_mobilize.create(INFO_X1+13, INFO_Y1+235, 'A', "MOBILSPY" ); button_spy_mobilize.enable_flag = 0; button_buy_item.create( INFO_X1+13+BUTTON_DISTANCE, INFO_Y1+235, INFO_X1+13+BUTTON_DISTANCE+ITEM_ICON_WIDTH, INFO_Y1+235+ITEM_ICON_HEIGHT, disp_item_button, ButtonCustomPara(NULL, 0) ); button_buy_item.visible_flag = 0; button_hire_visible = button_spy_mobilize_visible = 0; if( !should_show_info() ) return; vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("INN_BASE") ); disp_unit_list( INFO_Y1, refreshFlag ); disp_unit_info( INFO_Y1 + 165, refreshFlag ); // ------ main interface --------// // ------ display hire button -------// button_hire.enable_flag = 0; button_spy_mobilize.enable_flag = 0; if( selected_unit_id > 0 && selected_unit_id <= inn_unit_count ) { InnUnit *innUnit = inn_unit_array + selected_unit_id - 1; if( innUnit->is_own_spy() ) { button_spy_mobilize.enable_flag = 1; button_spy_mobilize.paint(); button_spy_mobilize_visible = 1; } else if( is_own() ) { button_hire.enable_flag = (~nation_array)->cash >= innUnit->hire_cost; button_hire.paint(); button_hire_visible = 1; } else { button_spy_mobilize.paint(); button_spy_mobilize_visible = 1; } if( (button_buy_item.visible_flag = innUnit->item.id != 0) ) { button_buy_item.enable_flag = is_own() && buy_item( selected_unit_id, 1 ); // checking only button_buy_item.custom_para.value = innUnit->item.id; button_buy_item.paint(); } } else { if( is_own() ) { button_hire.paint(); button_hire_visible = 1; } else { button_spy_mobilize.paint(); button_spy_mobilize_visible = 0; } button_buy_item.visible_flag = 0; } }