示例#1
0
//--------- Begin of function FirmResearch::disp_research_info ---------//
//
void FirmResearch::disp_research_info(int dispY1, int refreshFlag)
{
	static short lastTechId=0;

	if( refreshFlag==INFO_UPDATE && lastTechId != tech_id )
	{
		lastTechId = tech_id;
		info.disp();
	}

	//---------------- paint the panel --------------//

	if( refreshFlag == INFO_REPAINT )
		vga.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+50 );

	if( !tech_id )
		return;

	int x=INFO_X1+4, y=dispY1+4;

	//-------- display the icon of the researching item ---------//

	TechInfo* techInfo = tech_res[tech_id];

	if( refreshFlag == INFO_REPAINT )
	{
		vga.d3_panel_down( x, y, x+TECH_LARGE_ICON_WIDTH+3, y+TECH_LARGE_ICON_HEIGHT+3, 2 );
		vga_front.put_bitmap( x+2, y+2, techInfo->tech_large_icon() );

		//----------- display text ------------//

		x += TECH_LARGE_ICON_WIDTH+10;

		String str;

		str  = techInfo->tech_des();

		int researchVersion = techInfo->get_nation_tech_level(nation_recno)+1;		// research the next non-researched version

		if( researchVersion > 1 )
		{
			str += " ";
			str += m.roman_number(researchVersion);
		}

		font_san.put( x, y+4, str);
	}
	else
	{
		x += TECH_LARGE_ICON_WIDTH+10;
	}

	vga_front.indicator( 0, x-2, y+21, techInfo->get_progress(nation_recno), (float)100, VGA_GRAY );
}
示例#2
0
文件: of_resei.cpp 项目: mecirt/7k2
//-------- Begin of static function i_disp_research_button --------//
//
void i_disp_research_button(ButtonCustom *button, int repaintBody)
{
	int techId = button->custom_para.value;
	String str;
	TechInfo* techInfo = tech_res[techId];
	str = techInfo->tech_des();
	Firm *firmPtr = (Firm *) button->custom_para.ptr;
	int researchVersion = techInfo->get_nation_tech_level(firmPtr->nation_recno)+1;		// research the next non-researched version

	if( researchVersion > 1 )
	{
		str += " ";
		str += m.roman_number(researchVersion);
	}

	// ####### begin Gilbert 22/1 #######//
	short fontHeight = font_cara.font_height;		// backup font_height
	font_cara.use_max_height();

	if ( !button->enable_flag )
	{
		vga.active_buf->put_bitmap(  button->x1, button->y1, image_icon.read("BUILDUP2") );
		font_cara.center_put(button->x1, button->y1, button->x2, button->y2, str );
		vga.active_buf->bar_alpha(button->x1, button->y1, button->x2, button->y2, 1, 0);
	}
	else
	if ( button->pushed_flag )
	{
		vga.active_buf->put_bitmap(  button->x1, button->y1, image_icon.read("BUILDDW2") );
		font_cara.center_put(button->x1+1, button->y1+1, button->x2+1, button->y2+1, str );
	}
	else
	if (mouse.in_area(button->x1, button->y1, button->x2, button->y2))
	{
		vga.active_buf->put_bitmap(  button->x1, button->y1, image_icon.read("BUILDSE2") );
		font_cara.center_put(button->x1, button->y1, button->x2, button->y2, str );
	}
	else
	{
		vga.active_buf->put_bitmap(  button->x1, button->y1, image_icon.read("BUILDUP2") );
		font_cara.center_put(button->x1, button->y1, button->x2, button->y2, str );
	}
	font_cara.font_height = fontHeight;		// restore font height
	// ####### end Gilbert 22/1 #######//
}
示例#3
0
//-------- Begin of static function i_disp_research_button --------//
//
void i_disp_research_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 )
	{
		vga.d3_panel2_down(x1, y1, x2, y2);
		x1++;
		y1++;
	}
	else
	{
		vga.d3_panel2_up(x1, y1, x2, y2);
		x2--;
		y2--;
	}

	//--------------------------------------------//

	TechInfo* techInfo = tech_res[button->custom_para.value];

	// Vga::active_buf->d3_panel_down(x1+2, y1+2, x1+TECH_LARGE_ICON_WIDTH+7, y1+TECH_LARGE_ICON_HEIGHT+7, 2, 0 );
	Vga::active_buf->put_bitmap(x1+4, y1+4, techInfo->tech_large_icon() );

	//------ display research description -------//

	String str;

	str = techInfo->tech_des();

	Firm *firmPtr = (Firm *) button->custom_para.ptr;
	int researchVersion = techInfo->get_nation_tech_level(firmPtr->nation_recno)+1;		// research the next non-researched version

	if( researchVersion > 1 )
	{
		str += " ";
		str += m.roman_number(researchVersion);
	}

	font_bible.put( x1+TECH_LARGE_ICON_WIDTH+12, y1+14, str );
}
示例#4
0
文件: of_resei.cpp 项目: mecirt/7k2
// --------- begin of function FirmRese::disp_edit_mode -------//
//
void FirmResearch::disp_edit_mode(int& refreshFlag, int& y, int dispBG)
{
	// if display background here, set dispBG to 0

	FirmWork::disp_edit_mode( refreshFlag, y, dispBG);

	int x;
	int x1 = INFO_X1 + 12;
	int x2 = INFO_X2 - 5;

	// edit production progress

	edit_progress_enable = nation_recno && nation_array[nation_recno]->research_tech_id != 0;
	if( edit_progress_enable )
	{
		TechInfo *techInfo = tech_res[nation_array[nation_recno]->research_tech_id];
		String str;
		str  = techInfo->tech_des();
		int researchVersion = techInfo->get_nation_tech_level(nation_recno)+1;		// research the next non-researched version
		if( researchVersion > 1 )
		{
			str += " ";
			str += m.roman_number(researchVersion);
		}
		x = font_whbl.put( x1, y, str, 0, x2 );

		y += 15;		// str may be long, line feed here
		x = x1;

		x = edit_progress_x2 = font_blue.put( (edit_progress_x1=x), (edit_progress_y1=y), 
			m.format((int)nation_array[nation_recno]->research_progress(), 3), 0, x2 );
		edit_progress_y2 = edit_progress_y1+font_blue.max_font_height;

		y += 18;
	}
	else
	{
		y += 33;
	}
}
示例#5
0
文件: otalkres.cpp 项目: mecirt/7k2
//---- Begin of function TalkRes::add_exchange_tech_choices ------//
//
// talk_para1 - id. of the tech you offer
// talk_para2 - id. of the tech you request
// talk_para3 - level of the tech you offer
// talk_para4 - level of the tech you request
//
int TalkRes::add_exchange_tech_choices()
{
	int i, j;
	int fromNationRecno = cur_talk_msg.from_nation_recno;
	int toNationRecno   = cur_talk_msg.to_nation_recno;
	TechInfo* techInfo;
	String str;

	if( cur_talk_msg.talk_para1 && cur_talk_msg.talk_para2 )
		return 0;

	if( !cur_talk_msg.talk_para1 )
		choice_question = text_talk.str_ask_offer_tech(); // "Technology you offer?";
	else
		choice_question = text_talk.str_ask_request_tech(); //"Technology you request?";

	for( i=1 ; i<=tech_res.tech_count && talk_choice_count<MAX_TALK_CHOICE-1 ; i++ )	// -1 reserve one free space for "Cancel"
	{
		techInfo = tech_res[i];

		// ---- cannot transfer mega weapon, must kill opponent king to get -----//

		// ###### begin Gilbert 6/5 ######//
		if( techInfo->class_id == TECH_CLASS_MEGA_WEAPON
			|| techInfo->class_id == TECH_CLASS_OFFENSIVE_STRUCTURE )
		{
			continue;
		}
		// ###### end Gilbert 6/5 ######//


		// ###### begin Gilbert 24/12 #######//
		int maxTechLevel = max( techInfo->max_tech_level(fromNationRecno), techInfo->max_tech_level(toNationRecno) );
//		for( j=1 ; j<=techInfo->max_tech_level ; j++ )
		for( j=1 ; j<=maxTechLevel ; j++ )
		// ###### end Gilbert 24/12 #######//
		{
			int rc;

			if( !cur_talk_msg.talk_para1 )			// tech you offer
			{
				rc = techInfo->get_nation_tech_level(fromNationRecno) >= j &&
					  techInfo->get_nation_tech_level(toNationRecno)   <  j;
			}
			else									// tech you request
			{
				rc = techInfo->get_nation_tech_level(fromNationRecno) <  j &&
					  techInfo->get_nation_tech_level(toNationRecno)   >= j;
			}

			if( rc )
			{
				str = techInfo->tech_des();

				if( techInfo->max_tech_level(0)>1 )
				{
					str += " ";
					str += m.roman_number(j);
				}

				add_talk_choice( str, i, j );		// i-techId, j-version id.
				break;
			}
		}
	}

	return 1;
}
示例#6
0
文件: of_resei.cpp 项目: mecirt/7k2
// -------- begin of function FirmResearch::disp_firm_info --------//
//
void FirmResearch::disp_firm_info(int dispY1, int refreshFlag)
{
	String str;
	
	int techId = nation_array[nation_recno]->research_tech_id;

	// ###### begin Gilbert 5/10 ######//

	//---------------- paint the panel --------------//
//	techId =1;
	if( !techId )
	{
//		str = "No Technology is";
//		font_snds.center_put( INFO_X1+7, INFO_Y1+31, INFO_X2, INFO_Y1+48, str );
//		str = "currently being";
//		font_snds.center_put( INFO_X1+7, INFO_Y1+60, INFO_X2, INFO_Y1+77, str );
//		str = "researched.";
//		font_snds.center_put( INFO_X1+7, INFO_Y1+89, INFO_X2, INFO_Y1+106, str );

		font_snds.center_put_paragraph( INFO_X1+45, INFO_Y1+31, INFO_X2-40, INFO_Y1+106,
			text_firm.str_no_research(), 16, 0, 0 );
	}
	else
	{
		//-------- display the icon of the researching item ---------//

		int x = INFO_X1;
		int y = INFO_Y1;

		TechInfo* techInfo = tech_res[techId];
		
		//----------- display text ------------//

		// str = "Research Progress";
		font_snds.center_put( INFO_X1+7, INFO_Y1+11, INFO_X2, INFO_Y1+28, 
			text_firm.str_research_progress() );

		// <tech> <version>
		str  = techInfo->tech_des();
		int researchVersion = techInfo->get_nation_tech_level(nation_recno)+1;		// research the next non-researched version
		if( researchVersion > 1 )
		{
			str += " ";
			str += m.roman_number(researchVersion);
		}
		font_snds.center_put( INFO_X1+7, INFO_Y1+28, INFO_X2, INFO_Y1+45, str );

		// str = "Completion Percent";
		font_snds.center_put( INFO_X1+7, INFO_Y1+97, INFO_X2, INFO_Y1+114,
			text_firm.str_completion_percent() );

		// <completion> %
		int researchProgress = (int) nation_array[nation_recno]->research_progress();
		str = (int) researchProgress;
		str += " %";
		font_snds.center_put( INFO_X1+7, INFO_Y1+97+18, INFO_X2, INFO_Y1+114+18, str );

		short*	hitPointBitmap =NULL;

		int ratio = researchProgress * 40 / 100;
		int size  = researchProgress * 76 / 100;

		//106 x 35 --- 15 to 90 ie. 0 to 40
//		hitPointBitmap = (short *)mem_add( BitmapW::size(15 +size, 35) );
//		if (ratio <11)
//			vga.active_buf->put_bitmap_trans( INFO_X1 +62, INFO_Y1 +59, image_spict.read("MTR_10"));
//		else
//		if (ratio <40)
//			vga.active_buf->put_bitmap_trans( INFO_X1 +62, INFO_Y1 +59, image_spict.read("MTR_39"));
//		else
//			vga.active_buf->put_bitmap_trans( INFO_X1 +62, INFO_Y1 +59, image_spict.read("MTR_40"));
				
//		vga.active_buf->read_bitmapW( INFO_X1 +62, INFO_Y1 +59, INFO_X1 +75 +size, INFO_Y1 +90, hitPointBitmap );
//		vga.active_buf->put_bitmap_trans( INFO_X1 +62, INFO_Y1 +59, image_spict.read("MTR_00"));
//		vga.active_buf->put_bitmapW( INFO_X1 +62, INFO_Y1 +59, hitPointBitmap );
//		mem_del( hitPointBitmap );

		// ----- put empty bar ------//

		vga.active_buf->put_bitmap_trans( INFO_X1 +62, INFO_Y1 +59, image_spict.read("MTR_00"));

		// ----- put bar content -----//

		if( size > 0 )
		{
			char *barBitmap;
			if (ratio <11)
				barBitmap = image_spict.read("MTR_10");
			else if (ratio <40)
				barBitmap = image_spict.read("MTR_39");
			else
				barBitmap = image_spict.read("MTR_40");
			vga.active_buf->put_bitmap_area_trans( INFO_X1+62, INFO_Y1+59, barBitmap,
				0, 0, 13+size, ((Bitmap *)barBitmap)->get_height()-1 );
		}
	}

	//	int x1 = INFO_X1 +13;
	//	int y1 = INFO_Y1 +235;
	// int x2 = INFO_X1 +13;
	// int y2 = INFO_Y1 +281;
	if( is_own() )
	{
		if (!is_monster())
			button_select_research.create( INFO_X1 +13, INFO_Y1 +281, 'A', "RESEARCH" );
		else
			button_select_research.create( INFO_X1 +13, INFO_Y1 +281, 'A', "F_RESE" );
		button_select_research.paint();
	}	
	// ###### end Gilbert 5/10 ######//
}