Ejemplo n.º 1
0
void FirmIncubator::disp_war_info(int dispY1, int refreshFlag)
{
	static short lastUnitId=0;
	String str;

	if( refreshFlag==INFO_UPDATE && lastUnitId != build_unit_id )
	{
		lastUnitId = build_unit_id;
		info.disp();
	}

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

	if( refreshFlag == INFO_REPAINT )
	{
		button_cancel_build.create(INFO_X1 +182, INFO_Y1 +5, "WRFC_X-U", "WRFC_X-D");
		button_cancel_build.set_help_code( "CANCELWP" );
	}

	if( !build_unit_id )
	{
//		str = "No Weapon";
//		font_snds.put( INFO_X1+25, INFO_Y1+13, str );
//		str = "is under construction !";
//		font_snds.put( INFO_X1+25, INFO_Y1+31, str );
		font_snds.put_paragraph( INFO_X1+25, INFO_Y1+13, INFO_X1+140, INFO_Y1+46,
			text_firm.str_no_build_weapon() );

		button_cancel_build.enable_flag = 0;
	}
	else
	{

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

		UnitInfo* unitInfo = unit_res[build_unit_id];
		
		info.draw_unit_icon( INFO_X1 +53, INFO_Y1 +110, build_unit_id,
				nation_recno, INFO_X1+12, INFO_Y1+55, INFO_X2, INFO_Y2, 1);

		str = unitInfo->name;
		int techLevel = unitInfo->get_nation_tech_level(nation_recno);
		if( techLevel > 1 )
		{
			str += " ";
			str += misc.roman_number(techLevel);
		}
		font_snds.put( INFO_X1+25, INFO_Y1+13, str, 0, -1, 1 );

		//-- unitInfo->build_days is the no. of days take to build the firm when productivity is 100, the actually no. of days will be longer if productivity is less than 100 --//
		float buildProgressDays = build_progress_days;

		int x = font_snds.put( INFO_X1+25, INFO_Y1+31, (int) buildProgressDays );
		x = font_snds.put( x, INFO_Y1+31, " / " );
		font_snds.put( x, INFO_Y1+31, (int) unitInfo->build_days );

		button_cancel_build.enable_flag = 1;
		button_cancel_build.paint();
	}
}
Ejemplo n.º 2
0
//--------- Begin of function FirmCamp::disp_camp_upgrade ---------//
//
void FirmCamp::disp_camp_upgrade(int dispY1, int refreshFlag)
{
	if( is_own() )
	{
		int x2 = INFO_X1 +13;
		int y2 = INFO_Y1 +281;
		char iconName[]="CTOF-00";
	
		if( refreshFlag==INFO_REPAINT )
		{
			button_camp_upgrade.create( x2 + 162, y2, 'A', iconName );
			button_camp_upgrade.set_help_code( "CAMPTOFORT" );
		}
		button_camp_upgrade.enable_flag = 1;

		if ( upgrading_firm_id )
		{
			iconName[5] = '0' + upgrade_completion_percent/40;
			iconName[6] = '0' + upgrade_completion_percent/4 % 10;
			vga.active_buf->put_bitmap( x2 +162, y2, image_spict.read(iconName) );
		}
		else
			button_camp_upgrade.paint();
	}
}
Ejemplo n.º 3
0
//-------- Begin of function Sys::disp_button --------//
//
void Sys::disp_button()
{
	vga.use_back();

	button_menu.paint( 720, 6, "MENU-U", "MENU-D" );
	button_menu.set_help_code( "GAMEMENU" );

	vga.use_front();
}
Ejemplo n.º 4
0
//--------- Begin of function FirmBase::put_info ---------//
//
void FirmBase::put_info(int refreshFlag)
{
	disp_basic_info(INFO_Y1, refreshFlag);

	if( !should_show_info() )
		return;

	disp_base_info(INFO_Y1+54, refreshFlag);
	disp_worker_list(INFO_Y1+104, refreshFlag);
	disp_worker_info(INFO_Y1+168, refreshFlag);
	disp_god_info(INFO_Y1+226, refreshFlag);

	//------ display button -------//

	int x, y=INFO_Y1+279;

	if( own_firm() )
	{
		if( refreshFlag==INFO_REPAINT )
		{
			button_invoke.paint( INFO_X1, y, 'A', "INVOKE" );
			button_reward.paint( INFO_X1 + BUTTON_ACTION_WIDTH, y, 'A', "REWARDSP" );
			button_vacate_firm.paint(INFO_X1 + BUTTON_ACTION_WIDTH * 2, y, 'A', "RECRUIT");
			button_vacate_firm.set_help_code("MOBILIZE");
		}

		if( can_invoke() )
			button_invoke.enable();
		else
			button_invoke.disable();

		if( nation_array[nation_recno]->cash >= REWARD_COST &&
			 ( (overseer_recno && unit_array[overseer_recno]->rank_id != RANK_KING)
			  || selected_worker_id ) )
		{
			button_reward.enable();
		}
		else
		{
			button_reward.disable();
		}

		if( have_own_workers() )
			button_vacate_firm.enable();
		else
			button_vacate_firm.disable();

		x=INFO_X1+BUTTON_ACTION_WIDTH * 3;
	}
	else
		x=INFO_X1;

	disp_spy_button(x, y, refreshFlag);
}
Ejemplo n.º 5
0
//--------- Begin of function Unit::disp_basic_info ---------//
//
void Unit::disp_basic_info(int dispY1, int refreshFlag)
{
	//------- display the name of the unit --------//

	if( refreshFlag == INFO_REPAINT )
	{
		int dispName = unit_id == UNIT_CARAVAN || unit_res[unit_id]->unit_class == UNIT_CLASS_SHIP;		// only display names for caravans and ships as their names are not displayed in the other part of the interface

		vga_util.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+21 );

		if( nation_recno )
		{
			int dispTitle = is_own() || nation_recno==0;		// only display title for own units or independent units (which is for rebel leader only)

			if( dispName )
				font_san.center_put( INFO_X1+21, dispY1, INFO_X2-2, dispY1+21, unit_name(dispTitle) );

			vga_util.d3_panel_down( INFO_X1+3, dispY1+3, INFO_X1+20, dispY1+18 );

			//------- display the nation color box -------//

			char *nationPict = image_button.get_ptr("V_COLCOD");

			vga_front.put_bitmap_remap(INFO_X1+3, dispY1+2, nationPict, game.get_color_remap_table(nation_recno, 0) );
		}
		else
		{
			if( dispName )
				font_san.center_put( INFO_X1, dispY1, INFO_X2-2, dispY1+21, unit_name() );
		}
	}

	dispY1+=23;

	//-------- display the hit points bar --------//

	if( refreshFlag == INFO_REPAINT )
	{
		vga_util.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+27 );

		if( nation_recno == nation_array.player_recno &&
			 can_resign())
		{
			button_resign.paint( INFO_X1+4, dispY1+1, "V_X-U", "V_X-D" );
			button_resign.set_help_code( "RESIGN" );
		}
	}

	//-------- display hit points in numbers --------//

	disp_hit_point(dispY1);
}
Ejemplo n.º 6
0
//---------- Begin of function MapMatrix::init_para ------------//
void MapMatrix::init_para()
{
	last_map_mode = MAP_MODE_POWER;

	map_mode   = MAP_MODE_POWER;
	power_mode = 0;

	zoom_map_building_disappear = 0;

	filter_object_flag = 0;
	filter_object_type = 0;
	filter_object_para = 0;
	filter_object_locked = 0;

	filter_nation_flag = 0;
	filter_nation_locked = 0;

	button_filter_object.create(MAP_MODE_BUTTON_X1+56+6, MAP_MODE_BUTTON_Y1+8+19,
		"O-UP", "O-DN", 0 );
	button_filter_object.set_help_code( "OBJECT" );
	button_filter_nation.create(MAP_MODE_BUTTON_X1+30+17, MAP_MODE_BUTTON_Y1+9,
		"N-UP", "N-DN", 0 );
	button_filter_nation.set_help_code( "NATION" );
}
Ejemplo n.º 7
0
//--------- Begin of function FirmFactory::put_info ---------//
//
void FirmFactory::put_info(int refreshFlag)
{
	//---------- display info ------------//

	disp_basic_info(INFO_Y1, refreshFlag);

	if( !should_show_info() )
		return;

	disp_factory_info(INFO_Y1+54, refreshFlag);
	disp_worker_list(INFO_Y1+126, refreshFlag);
	disp_worker_info(INFO_Y1+190, refreshFlag);

	//------ display mobilize button -------//

	int x = INFO_X1;

	if(own_firm())
	{
		if (refreshFlag == INFO_REPAINT)
		{
			button_change_production.paint(INFO_X1, INFO_Y1 + 248, 'A', "CHGPROD");
			button_vacate_firm.paint(INFO_X1 + BUTTON_ACTION_WIDTH, INFO_Y1 + 248, 'A', "RECRUIT");
			button_vacate_firm.set_help_code("MOBILIZE");
		}

		if (worker_count)
			button_vacate_firm.enable();
		else
			button_vacate_firm.disable();

		x += (BUTTON_ACTION_WIDTH * 2);
	}

	//---------- display spy button ----------//

	disp_spy_button(x, INFO_Y1+248, refreshFlag);
}
Ejemplo n.º 8
0
//--------- Begin of function FirmHarbor::disp_build_info ---------//
//
void FirmHarbor::disp_build_info(int refreshFlag)
{
	if( !build_unit_id || nation_recno!=nation_array.player_recno )
		return;

	int dispY1 = INFO_Y1+26;
	int x=MSG_X1+3, y=MSG_Y1+3;

	if( refreshFlag == INFO_REPAINT )
	{
		vga_util.d3_panel_up( MSG_X1, MSG_Y1, MSG_X2, MSG_Y2 );

		vga_util.d3_panel_down(x, y, x+UNIT_SMALL_ICON_WIDTH+3, y+UNIT_SMALL_ICON_HEIGHT+3 );
		vga_front.put_bitmap(x+2, y+2, unit_res[build_unit_id]->get_small_icon_ptr(RANK_SOLDIER) );
	}

	vga_front.indicator( 0, x+UNIT_SMALL_ICON_WIDTH+6, y,
		(float)(sys.frame_count-start_build_frame_no),
		(float)unit_res[build_unit_id]->build_days * FRAMES_PER_DAY, VGA_GRAY );

	button_cancel_build.paint(MSG_X2-27, MSG_Y1+2, "V_X-U", "V_X-D");
	button_cancel_build.set_help_code( "CANCELSHP" );
}
Ejemplo n.º 9
0
//--------- Begin of function Firm::disp_basic_info ---------//
//
void Firm::disp_basic_info(int dispY1, int refreshFlag)
{
	//------- display the name of the firm --------//

	if( refreshFlag == INFO_REPAINT )
	{
		vga_util.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+21 );

		if( nation_recno )
		{
			font_san.center_put( INFO_X1+21, dispY1, INFO_X2-2, dispY1+21, firm_name() );

			char *nationPict = image_button.get_ptr("V_COLCOD");

			vga_front.put_bitmap_remap(INFO_X1+3, dispY1+2, nationPict, game.get_color_remap_table(nation_recno, 0) );
		}
		else
		{
			font_san.center_put( INFO_X1, dispY1, INFO_X2-2, dispY1+21, firm_name() );
		}
	}

	dispY1+=23;

	//------- display hit points and buttons -------//

	int sliderX1, sliderX2;

	if( under_construction )
		sliderX1 = INFO_X1+34;		// there is only one button in the contruction mode, so the slider is longer
	else
		sliderX1 = INFO_X1+64;

	sliderX2 = INFO_X2-64;

	int showRepairIcon = builder_recno && !under_construction && should_show_info();

	if( refreshFlag == INFO_REPAINT )
	{
		button_sell.reset();
		button_destruct.reset();

		vga_util.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+26 );

		if( nation_array.player_recno &&
			 nation_recno == nation_array.player_recno )
		{
			if( under_construction || !can_sell() )
			{
				button_destruct.paint( INFO_X1+4, dispY1+1, "V_DEM-U", "V_DEM-D" );	// Destruct

				if( under_construction )
					button_destruct.set_help_code( "CANCELBLD" );
				else
					button_destruct.set_help_code( "DESTFIRM" );
			}

			if( !under_construction && can_sell() )
			{
				button_sell.paint( INFO_X1+4, dispY1+1, "V_SEL-U", "V_SEL-D" );	// Sell
				button_sell.set_help_code( "SELLFIRM" );
			}
		}

		if( showRepairIcon )
		{
			button_builder.paint( INFO_X1+30, dispY1+1, "REPAIRU", "REPAIRD" );	// Builder
			button_builder.set_help_code( "REPAIR" );
		}
	}
	else	//--------- INFO_UPDATE --------//
	{
		if( showRepairIcon != button_builder.enable_flag )
		{
			if( showRepairIcon )
			{
				button_builder.paint( INFO_X1+30, dispY1+1, "REPAIRU", "REPAIRD" );	// Builder
				button_builder.set_help_code( "REPAIR" );
			}
			else
				button_builder.hide();
		}
	}

	disp_hit_point(dispY1);
}
Ejemplo n.º 10
0
//--------- Begin of function FirmWar::disp_war_info ---------//
//
void FirmWar::disp_war_info(int dispY1, int refreshFlag)
{
	static short lastUnitId=0;
	String str;

	if( refreshFlag==INFO_UPDATE && lastUnitId != build_unit_id )
	{
		lastUnitId = build_unit_id;
		info.disp();
	}

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

	// #### begin Gilbert 5/10 ######//
	if( refreshFlag == INFO_REPAINT )
	{
		button_cancel_build.create(INFO_X1 +182, INFO_Y1 +5, "WRFC_X-U", "WRFC_X-D");
		button_cancel_build.set_help_code( "CANCELWP" );
	}
	// #### end Gilbert 5/10 ######//

	if( !build_unit_id )
	{
//		str = "No Weapon";
//		font_snds.put( INFO_X1+25, INFO_Y1+13, str );
//		str = "is under construction !";
//		font_snds.put( INFO_X1+25, INFO_Y1+31, str );
		font_snds.put_paragraph( INFO_X1+25, INFO_Y1+13, INFO_X1+140, INFO_Y1+46,
			text_firm.str_no_build_weapon() );

		// ##### begin Gilbert 5/10 #######//
		button_cancel_build.enable_flag = 0;
		// ##### end Gilbert 5/10 #######//
	}
	else
	{
		//-------- display the icon of the researching item ---------//

		UnitInfo* unitInfo = unit_res[build_unit_id];
		
	//	info.draw_unit_icon( INFO_X1 +53, INFO_Y1 +110, build_unit_id,
	//			nation_recno, INFO_X1+12, INFO_Y1+55, INFO_X2, INFO_Y2, 1);


		Bitmap *bitmapPtr = (Bitmap *) unitInfo->soldier_icon_ptr;
	//	int x1 = INFO_X1 +53 + unitInfo->unit_icon_offsetx;
	//	int y1 = INFO_Y1 +110 + unitInfo->unit_icon_offsety;
	//	int x2 = x1 + bitmapPtr->get_width() -1;
	//	int y2 = y1 + bitmapPtr->get_height() -1;
		
		int x1 = INFO_X1 + 51 - bitmapPtr->get_width()/2;
		int y1 = INFO_Y1 + 139 - bitmapPtr->get_height();
		int x2 = x1 + bitmapPtr->get_width() -1;
		int y2 = y1 + bitmapPtr->get_height() -1;
		
		int srcX1 = MAX(x1, INFO_X1+13)-x1;
		int srcY1 = 0;
		int srcX2 = MIN(x2, INFO_X2)-x1;
		int srcY2 = MIN(y2, INFO_Y2)-y1;
	
		short *colorRemapTable = game.get_color_remap_table(nation_recno, 1);
		vga.active_buf->put_bitmap_area_trans_remap_decompress(x1, y1, (char *) bitmapPtr, srcX1, srcY1, srcX2, srcY2, colorRemapTable);

		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 #####//
		{
			int techLevel = unitInfo->get_nation_tech_level(nation_recno);
			if( techLevel > 1 )
			{
				str += " ";
				str += misc.roman_number(techLevel);
			}
		}
		font_snds.center_put( INFO_X1+18, INFO_Y1+13, INFO_X2, INFO_Y1+25, str, 0, 1 );

		//-- unitInfo->build_days is the no. of days take to build the firm when productivity is 100, the actually no. of days will be longer if productivity is less than 100 --//
		// ##### begin Gilbert 30/12 #####//
		float buildProgressDays = build_progress_days;
//										  + (float) (sys.frame_count-last_process_build_frame_no) / FRAMES_PER_DAY
//										  * (float) (worker_count*6+productivity/2) / 100;
		// ##### end Gilbert 30/12 #####//

	//	str = (int) buildProgressDays;
	//	str += " / ";
	//	str += (int) unitInfo->build_days; 
	//	font_snds.put( INFO_X1+25, INFO_Y1+31, str );
		int x = font_snds.put( INFO_X1+100, INFO_Y1+31, (int) buildProgressDays );
		x = font_snds.put( x, INFO_Y1+31, " / " );
		font_snds.put( x, INFO_Y1+31, (int) unitInfo->build_days );

		// ##### begin Gilbert 5/10 #######//
		button_cancel_build.enable_flag = 1;
		button_cancel_build.paint();
		// ##### end Gilbert 5/10 #######//
	}
}
Ejemplo n.º 11
0
int MapMatrix::detect()
{
	int x=MAP_MODE_BUTTON_X1 + 4;
	int y=MAP_MODE_BUTTON_Y1 + 5;

	//#define MAP_MODE_BUTTON_WIDTH 24
	//#define MAP_MODE_BUTTON_HEIGHT 24

	for( int i=0 ; i<MAP_MODE_COUNT ; i++, x+=MAP_MODE_BUTTON_WIDTH, y+=MAP_MODE_BUTTON_HEIGHT )
	{
		if( mouse.single_click(	x, y, x+MAP_MODE_BUTTON_WIDTH-1, y+MAP_MODE_BUTTON_HEIGHT-1 ) )
		{
			toggle_map_mode(i);
			return 1;
		}
	}
	
	if( mouse.single_click(	MAP_MODE_BUTTON_X1-97, MAP_MODE_BUTTON_Y1+10, 
		MAP_MODE_BUTTON_X1-97+34-1, MAP_MODE_BUTTON_Y1+10+34-1 ) )
	{
		if (zoom_map_building_disappear)
			zoom_map_building_disappear = 0;
		else
			zoom_map_building_disappear = 1;
		
		disp_mode_button(1);		// 1-display the buttons on the front buffer.
	#ifdef USE_FLIP
		disp_mode_button(0);		// 0-display the buttons on the back buffer.
	#endif
		refresh();
		return 1;
	}
	
	int rc;

	if( (rc=button_filter_object.detect(0, 0, 1)) > 0 )		// 1-detect right button
	{
		if( rc==2 )		// right button - locked filter
		{
			filter_object_flag = 1;
			button_filter_object.pushed_flag = 1;
			button_filter_object.update_bitmap("O-DN");
			filter_object_locked = 1;
			set_filter_para();
		}
		else
		{
			filter_object_flag = button_filter_object.pushed_flag;
			button_filter_object.update_bitmap("O-DN2");
			filter_object_locked = 0;

			if( !filter_object_flag ) 
				filter_object_para = 0;
		}

		disp_mode_button(1);
#ifdef USE_FLIP
		disp_mode_button(0);	
#endif
		refresh();
	}
	else
		button_filter_object.set_help_code( "OBJECT" );

	if( (rc=button_filter_nation.detect(0, 0, 1)) > 0 )		// 1-detect right button
	{
		if( rc==2 )		// right button - locked filter
		{
			filter_nation_flag = 1;
			button_filter_nation.pushed_flag = 1;
			button_filter_nation.update_bitmap("N-DN");
			filter_nation_locked = 1;
			set_filter_para();
		}
		else
		{
			filter_nation_flag = button_filter_nation.pushed_flag;
			button_filter_nation.update_bitmap("N-DN2");
			filter_nation_locked = 0;
		}

		disp_mode_button(1);
#ifdef USE_FLIP
		disp_mode_button(0);		
#endif
		refresh();
	}
	else
		button_filter_nation.set_help_code( "NATION" );

	//----- detect clicking on the map -------//

	return detect_area();
}
Ejemplo n.º 12
0
// -------- begin of function FirmBase::disp_firm_info --------//
//
void FirmBase::disp_firm_info(int dispY1, int refreshFlag)
{
   disp_god_info(INFO_Y1+226, refreshFlag);

	//------ display button -------//

	int x2 = INFO_X1 +13;
	int y2 = INFO_Y1 +281;

	if( refreshFlag == INFO_REPAINT )
	{
		button_clear_text.create( INFO_X1+13+3*BUTTON_DISTANCE, INFO_Y1+281, 'A', "PREVMENU" );
	}
			
	if( !is_own() )
		return;

	x2 += BUTTON_DISTANCE;

	char fileName[] = "GB-AX";
	char i = (char) (sys.frame_count % 9);
	if (i > 4)
		i = 8 - i;
	fileName[4] = '1' + i;
	
	if( (!can_invoke()) && (god_unit_recno == 0) )
	{
		button_invoke.paint( x2, y2, 'A', "INVOKE" );
		button_invoke.set_help_code("GDINVOKE");
		button_invoke.disable();
	}
	else
	{
		if( !god_unit_recno )
		{
			button_invoke.paint( x2, y2-12, 'A', "GB-A1" );
			button_invoke.set_help_code("GDINVOKE");
		}
		else
		{
			button_invoke.paint( x2, y2-12, 'A', fileName );
			button_invoke.set_help_code("GDINVOKE");
		}
		button_invoke.enable();
	}		

	x2 += BUTTON_DISTANCE;
	
	i = (char) (sys.frame_count % 9);
	if (i > 4)
		i = 8 - i;
	fileName[4] = '1' + i;
	
	fileName[3] = 'B';
	fileName[4] = '1' + i;

	if( (!can_make_wish()) && (invoked_effect_id == 0) )
	{
		button_unknown_effect.paint( x2, y2, 'A', "INVOKE" );
		button_unknown_effect.set_help_code("BLESS");
		button_unknown_effect.disable();
	}
	else
	{
		if ( !invoked_effect_id )
		{
			button_unknown_effect.paint( x2, y2-15, 'A', "GB-B1" );
			button_unknown_effect.set_help_code("BLESS");
			button_unknown_effect.enable();
		}
		else
		{ 
			button_unknown_effect.paint( x2, y2-15, 'A', fileName );
			button_unknown_effect.set_help_code("BLESS");
			button_unknown_effect.enable();
		}
	}

	// ----- display clear invoked_effect_text button -----//

	button_clear_text.visible_flag = invoked_effect_text[0];	// displaying invoked effect text
	button_clear_text.paint();
}