Ejemplo n.º 1
0
//--------- Begin of function Firm::disp_spy_button --------//
//
void Firm::disp_spy_button(int x, int y, int refreshFlag)
{
	if( !own_firm() )		// if not own firm, there is not other button other than the spy button, so always display it left-aligned
		x = INFO_X1;		// if own firm, the x passed will be space position on the interface already, taking into account of the other buttons on interface

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

	if( player_spy_count > 0 )
	{
		//------------ spy menu -----------//

		if( refreshFlag == INFO_REPAINT )
			button_spy_menu.paint( x, y, 'A', "SPYMENU" );

		x += BUTTON_ACTION_WIDTH;

		//---------- bribe button -----------//

		if( nation_recno != nation_array.player_recno ) 	// only display the bribe button for non-player owned towns
		{
			int canBribe=0;

			if( selected_worker_id )
				canBribe = can_spy_bribe(selected_worker_id, nation_array.player_recno );

			else if( overseer_recno )
				canBribe = can_spy_bribe(0, nation_array.player_recno );

			//-------- display the bribe button -------//

			if( refreshFlag == INFO_REPAINT )
				button_bribe.paint( x, y, 'A', "SELBRIBE" );

			if( canBribe )
				button_bribe.enable();
			else
				button_bribe.disable();

			x += BUTTON_ACTION_WIDTH;
		}
	}

	//--------- capture button ----------//

	int canCapture = can_worker_capture(nation_array.player_recno);

	if( canCapture )
	{
		if( !button_capture.enable_flag || refreshFlag==INFO_REPAINT )
			button_capture.paint( x, y, 'A', "CAPTURE" );
	}
	else
	{
		if( refreshFlag==INFO_REPAINT )
			button_capture.reset();

		else if( button_capture.enable_flag )
			button_capture.hide();
	}
}
Ejemplo n.º 2
0
//--------- Begin of function FirmHarbor::disp_main_menu ---------//
//
void FirmHarbor::disp_main_menu(int refreshFlag)
{
	firm_harbor_ptr = this;

	disp_basic_info(INFO_Y1, refreshFlag);

	if( !should_show_harbor_info() )
		return;

	//-------- display browser -----------//

	if( refreshFlag == INFO_REPAINT )
	{
		browse_ship.init( SHIP_BROWSE_X1, SHIP_BROWSE_Y1, SHIP_BROWSE_X2, SHIP_BROWSE_Y2,
								0, 25, ship_count, put_ship_rec );

		browse_ship.open(1);

		put_det(INFO_REPAINT);
	}
	else
	{
		if( last_ship_count != ship_count )
		{
			last_ship_count = ship_count;
			info.disp();
		}
		else
			browse_ship.update();          // update only
	}

	last_ship_count = ship_count;

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

	if( !own_firm() )
		return;

	//-------- display buttons ---------//

	if( refreshFlag == INFO_REPAINT )
	{
		button_build.paint( SHIP_DET_X1, SHIP_DET_Y2+4, 'A', "MAKESHIP" );
		button_sail.paint ( SHIP_DET_X1+BUTTON_ACTION_WIDTH, SHIP_DET_Y2+4, 'A', "SAILOUT" );
	}

	if( ship_count > 0 )
		button_sail.enable();
	else
		button_sail.disable();

	//------ display the info of the ship under construction ------//

	disp_build_info(refreshFlag);
}
Ejemplo n.º 3
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.º 4
0
Archivo: ospya.cpp Proyecto: mecirt/7k2
//--------- Begin of function SpyArray::disp_view_secret_menu ---------//
//
void SpyArray::disp_view_secret_menu(int spyRecno, int refreshFlag)
{
//	vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") );
	vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("MISSBASE") );
	//------------------------------------//

//	vga.d3_panel_up( INFO_X1, INFO_Y1, INFO_X2, INFO_Y1+42 );
//	font_san.put_paragraph( INFO_X1+7, INFO_Y1+5, INFO_X2-7, INFO_Y2-5,
//									"Steal which type of secrets?" );
	font_whbl.put_paragraph( INFO_X1+18, INFO_Y1+12, INFO_X2-14, INFO_Y1+72, 
		text_firm.str_spy_steal_info() ); // "Which category of information do you wish to view?" );

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

	int  y=INFO_Y1+45;

	err_when( spy_array.is_deleted(spyRecno) );

	Spy* spyPtr = spy_array[spyRecno];

	int i;
	for( i=0 ; i<SECRET_REPORT_COUNT ; i++ )
	{
//		button_secret_report_array[i].create( INFO_X1+18, y, INFO_X2-10, y+21, 
//			disp_text_button, ButtonCustomPara( secret_report_str_array[i], i), 0 );
		button_secret_report_array[i].create( INFO_X1+18, y, INFO_X2-10, y+21, 
			disp_text_button, ButtonCustomPara( text_reports.str_report_mode(i+1), i), 0 );

		button_secret_report_array[i].enable_flag = 
			tech_res[TECH_INFO_THEFT]->get_nation_tech_level(spyPtr->true_nation_recno) 
			&& spyPtr->spy_skill >= secret_view_skill_array[i];

		y+=23;
	}

	// push the first enabled button
	for( i = 0; i < SECRET_REPORT_COUNT; i++ )
	{
		if( button_secret_report_array[i].enable_flag )
		{
			button_secret_report_array.push(i, 0);
			break;
		}
	}
	button_secret_report_array.paint();

	button_view_secret.create( INFO_X1+13, INFO_Y1+281, 'A', "VSECRET" );
	button_secret_report_cancel.create( INFO_X1+13+3*BUTTON_DISTANCE, INFO_Y1+281, 'A', "PREVMENU" );
	button_view_secret.enable_flag = button_secret_report_array[button_secret_report_array()].enable_flag;
	button_view_secret.paint();
	button_secret_report_cancel.paint();
}
Ejemplo n.º 5
0
//--------- Begin of function FirmCamp::put_info ---------//
//
void FirmCamp::put_info(int refreshFlag)
{
	disp_basic_info(INFO_Y1, refreshFlag);

	if( !should_show_info() )
		return;

	disp_camp_info(INFO_Y1+54, refreshFlag);
	disp_worker_list(INFO_Y1+104, refreshFlag);
	disp_worker_info(INFO_Y1+168, refreshFlag);

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

	int x;

	if( own_firm() )
	{
		if( refreshFlag==INFO_REPAINT )
		{
			button_patrol.paint( INFO_X1, INFO_Y1+242, 'A', "PATROL" );
			button_reward.paint( INFO_X1+BUTTON_ACTION_WIDTH, INFO_Y1+242, 'A', "REWARDCB" );
			button_defense.paint( INFO_X2-BUTTON_ACTION_WIDTH, INFO_Y1+242, 'A', defense_flag ? (char*)"DEFENSE1" : (char*)"DEFENSE0" );
		}

		if( overseer_recno || worker_count )
			button_patrol.enable();
		else
			button_patrol.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();
		}

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

	disp_spy_button(x, INFO_Y1+242, refreshFlag);

	#ifdef DEBUG
		if( sys.testing_session || sys.debug_session )
			disp_debug_info(this, refreshFlag);
	#endif
}
Ejemplo n.º 6
0
void FirmIncubator::disp_firm_info(int dispY1, int refreshFlag)
{
	String str;

	if( refreshFlag == INFO_REPAINT )
	{
		button_select_build.create( INFO_X1 +13, INFO_Y1 +281, 'A', "MAKEWEAP" );

		// ###### begin Gilbert 11/3 ########//
		button_go_rally.create( INFO_X1+13+BUTTON_DISTANCE*2, INFO_Y1+235, 'A', "RALLY-GO" );
		button_clear_rally.create( INFO_X1+13+BUTTON_DISTANCE*3, INFO_Y1+235, 'A', "RALLY-NO" );
		// ###### end Gilbert 11/3 ########//
	}

	disp_war_info(INFO_Y1+54, refreshFlag);

	if ( build_unit_id )
	{
		int limit = 2;
		
		if ( animate_seqno >=(limit*3) )
			animate_seqno = 1;
		
		char animate[] = "GEARW-0";
		animate[6] = '3' - animate_seqno / limit;
		
		animate_seqno ++;

		vga.active_buf->put_bitmap( INFO_X1+140, INFO_Y1+61, image_icon.read( animate ) );	
	}

	int x2 = INFO_X1 +13;
	int y2 = INFO_Y1 +281;
	button_select_build.enable_flag = 0;
	if( is_own() )
	{
		button_select_build.enable_flag = 1;
		button_select_build.paint();

		// ------- display rally points button ------//

		if( (button_go_rally.visible_flag = rally_enable_flag != 0) )
			button_go_rally.paint();

		if( (button_clear_rally.visible_flag = rally_enable_flag != 0) )
			button_clear_rally.paint();
	}	

}
Ejemplo n.º 7
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.º 8
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.º 9
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.º 10
0
//--------- Begin of function Firm::disp_assassinate_result ---------//
//
void Firm::disp_assassinate_result(int refreshFlag)
{
	if( refreshFlag != INFO_REPAINT )
		return;

	int x=INFO_X1+4, y=INFO_Y1+4, y2=y+font_san.height()-1;

	if( assassinate_result == ASSASSINATE_SUCCEED_AT_LARGE )
	{
		vga_util.d3_panel_up( INFO_X1, INFO_Y1, INFO_X2, INFO_Y1+43 );

		font_san.center_put( INFO_X1, y, INFO_X2, y2, _("Assassination Succeeded.") );
		font_san.center_put( INFO_X1, y+=18, INFO_X2, y2+=18, _("Your Spy Escaped.") );
	}
	else if( assassinate_result == ASSASSINATE_SUCCEED_KILLED )
	{
		#ifdef GERMAN
			vga_util.d3_panel_up( INFO_X1, INFO_Y1, INFO_X2, INFO_Y1+80 );

			font_san.center_put( INFO_X1, y, INFO_X2, y2, "Assassination Succeeded." );
			font_san.center_put( INFO_X1, y+=18, INFO_X2, y2+=18, "Your Spy" );				// German text is longer
			font_san.center_put( INFO_X1, y+=18, INFO_X2, y2+=18, "Was Caught" );
			font_san.center_put( INFO_X1, y+=18, INFO_X2, y2+=18, "And Executed." );
		#else
			vga_util.d3_panel_up( INFO_X1, INFO_Y1, INFO_X2, INFO_Y1+62 );

			font_san.center_put( INFO_X1, y, INFO_X2, y2, _("Assassination Succeeded.") );
			// TRANSLATORS: Part of "Your Spy Was Caught And Executed."
			font_san.center_put( INFO_X1, y+=18, INFO_X2, y2+=18, _("Your Spy Was Caught") );
			// TRANSLATORS: Part of "Your Spy Was Caught And Executed."
			font_san.center_put( INFO_X1, y+=18, INFO_X2, y2+=18, _("And Executed.") );
		#endif
	}
	else
	{
		#ifdef GERMAN
			vga_util.d3_panel_up( INFO_X1, INFO_Y1, INFO_X2, INFO_Y1+80 );

			font_san.center_put( INFO_X1, y	  , INFO_X2, y2, "Assassination Failed." );
			font_san.center_put( INFO_X1, y+=18, INFO_X2, y2+=18, "Your Spy" );
			font_san.center_put( INFO_X1, y+=18, INFO_X2, y2+=18, "Was Caught" );
			font_san.center_put( INFO_X1, y+=18, INFO_X2, y2+=18, "And Executed." );
		#else
			vga_util.d3_panel_up( INFO_X1, INFO_Y1, INFO_X2, INFO_Y1+62 );

			font_san.center_put( INFO_X1, y	  , INFO_X2, y2, _("Assassination Failed.") );
			// TRANSLATORS: Part of "Your Spy Was Caught And Executed."
			font_san.center_put( INFO_X1, y+=18, INFO_X2, y2+=18, _("Your Spy Was Caught") );
			// TRANSLATORS: Part of "Your Spy Was Caught And Executed."
			font_san.center_put( INFO_X1, y+=18, INFO_X2, y2+=18, _("And Executed.") );
		#endif
	}

	y+=26;
	button_cancel.paint( INFO_X1, y, 'A', "CONTINUE" );
}
Ejemplo n.º 11
0
//--------- Begin of function FirmMonsterFortress::disp_camp_info ---------//
//
void FirmMonsterFortress::disp_camp_info(int dispY1, int refreshFlag)
{
	if( is_own() )
	{
		int x1 = INFO_X1 +13;
		int y1 = INFO_Y1 +235;
		int x2 = INFO_X1 +13;
		int y2 = INFO_Y1 +281;
		if( refreshFlag==INFO_REPAINT )
		{
			button_patrol.create( x2, y2, 'A', "PATROL" );
			button_transform_grokken.create( x1+BUTTON_DISTANCE, y1, 'A', "FORTRS-2" );
			button_reward.create( x1, y1, 'A', "F_REWARD" );
		}
		button_patrol.enable_flag = archer_count > 0;
		button_patrol.paint();

		button_transform_grokken.enable_flag = 1;
		button_transform_grokken.paint();

		if( nation_array[nation_recno]->cash >= REWARD_COST 
			&& selected_archer_id > 0 && selected_archer_id <= archer_count
			&& unit_array[archer_unit_recno[selected_archer_id-1]]->rank_id != RANK_KING )
			button_reward.enable_flag = 1;			// call paint
		else
			button_reward.enable_flag = 0;		// call paint
		button_reward.paint();


		// display number of supporter

		info.draw_unit_icon( INFO_X1+40, INFO_Y1+52,
			support_unit_id, nation_recno,
			INFO_X1+15, INFO_Y1+5, INFO_X1+68, INFO_Y1+84, 1 );

		String str;
		str = unit_res[support_unit_id]->name;
		str += " x ";
		str += extra_builder_count;
		font_snds.center_put( INFO_X1+88, INFO_Y1+15, INFO_X1+217, INFO_Y1+74, str, 0, 0 );
	}
}
Ejemplo n.º 12
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.º 13
0
void FirmIncubator::disp_build_menu(int refreshFlag)
{
	int x1 = INFO_X1+13;
	int y1 = INFO_Y1+5;

	vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGWEAP") );

	added_count = 0;
	int unitId, x=INFO_X1+2, y=INFO_Y1;
	UnitInfo* unitInfo;

	for( int i = 0; i < MAX_INCUBATE_TYPE; ++i )
	{
		unitId = incubate_unit_id[i];
		unitInfo = unit_res[unitId];

		if( refreshFlag == INFO_REPAINT )
		{
			button_queue_weapon[added_count].create(x1+20, y1+5, x1+49, y1+34, 
				i_disp_queue_button, ButtonCustomPara(this, unitId) );
			button_weapon[added_count].create(x1, y1+35, x1+67, y1+114,
				i_disp_build_button, ButtonCustomPara(&button_queue_weapon[added_count], unitId) );
		}

		button_weapon[added_count].visible_flag 
			= button_queue_weapon[added_count].visible_flag 
			= unitInfo->get_nation_tech_level(nation_recno) > 0;

		button_weapon[added_count].paint();
		button_queue_weapon[added_count].paint();

		added_count++;

		x1 += 68;
		if (added_count == 3)
		{
			x1 = INFO_X1+13;
			y1 = INFO_Y1+121;
		}
	}

	if( refreshFlag==INFO_REPAINT )
	{
		// ##### begin Gilbert 8/2 ######//
		int x1 = INFO_X1 +13 +BUTTON_DISTANCE*3;
		int y1 = INFO_Y1 +281;
		// button_cancel.create( x1+7, y1+9, "OK-U", "OK-D" );
		button_cancel.create( x1, y1, 'A', "CANCEL" );
		// ##### end Gilbert 8/2 ######//
	}
	button_cancel.paint();
}
Ejemplo n.º 14
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.º 15
0
void FirmOffensive::disp_main_menu(int refreshFlag)
{
	Firm::put_info(refreshFlag);

	button_cast.create( INFO_X1 +13, INFO_Y1 +259, 'A', "GBA-1" );
	
	if( !should_show_info() )
		return;

	vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") );

	// display delay

	if( cast_delay > 0 )
	{
		short*	hitPointBitmap =NULL;
		int ratio = cast_delay *40 / cast_delay_max;
		int size = cast_delay *76 / cast_delay_max;
		
		//106 x 35 --- 15 to 90 ie. 0 to 40
		int offsetX = -35;
		int offsetY = -40;
		hitPointBitmap = (short *)mem_add( BitmapW::size(15 +size, 35) );	
		if (ratio <11)
			vga.active_buf->put_bitmap_trans( INFO_X1 +80 +20 +offsetX, INFO_Y1 +49 +offsetY, image_spict.read("MTR_10"));
		else
		if (ratio <40)
			vga.active_buf->put_bitmap_trans( INFO_X1 +80 +20 +offsetX, INFO_Y1 +49 +offsetY, image_spict.read("MTR_39"));
		else
			vga.active_buf->put_bitmap_trans( INFO_X1 +80 +20 +offsetX, INFO_Y1 +49 +offsetY, image_spict.read("MTR_40"));
		
		vga.active_buf->read_bitmapW( INFO_X1 +80 +20 +offsetX, INFO_Y1 +49 +offsetY, INFO_X1 +94 +20 +size +offsetX, INFO_Y1 +80 +offsetY, hitPointBitmap );
		vga.active_buf->put_bitmap_trans( INFO_X1 +80 +20 +offsetX, INFO_Y1 +49 +offsetY, image_spict.read("MTR_00"));
		vga.active_buf->put_bitmapW( INFO_X1 +80 +20 +offsetX, INFO_Y1 +49 +offsetY, hitPointBitmap );
		mem_del( hitPointBitmap );				
	}

	if( !is_own() )
		return;

	char fileName[] = "GBA-1";
	
	if (button_cast.enable_flag)
		fileName[4] = '1' + (char) (sys.frame_count%3);

	button_cast.update_bitmap( fileName );
	button_cast.enable_flag = can_cast(magic_id_upper_limit);
	button_cast.paint();
}
Ejemplo n.º 16
0
//--------- Begin of function Unit::disp_build_menu ---------//
//
void Unit::disp_build_menu(int refreshFlag)
{
	//---------- paint buttons ------------//

	if( refreshFlag == INFO_REPAINT )
	{
		// ####### begin Gilbert 3/10 ########//
		int firmId, x=INFO_X1, y=INFO_Y1, addedCount=0;
		String str;

		for( int i = 0; i < MAX_FIRM_TYPE; ++i )
		{
			firmId = build_firm_button_order[i];

			//---- check if the unit is the right race to build this firm ----//

			button_build_flag[i] = 0;

			if( firm_res[firmId]->can_build(sprite_recno) )
			{
				// button_build_array[firmId-1].paint( x, y, str, "F-DOWN");

				button_build_array[i].paint( x, y, x+99-1, y+60-1,
					disp_firm_button, ButtonCustomPara( game.get_color_remap_table(nation_recno,0) ,
					(unit_id << 16) + (race_id << 8) + firmId) );

				button_build_flag[i] = 1;
				addedCount++;

				if( addedCount & 1)
				{
					// old number, increase in x
					x += 102;
				}
				else
				{
					// even number, increase in y, reset x
					x -= 102;
					y += 63;
				}
			}
		}
		// ####### end Gilbert 3/10 ########//

		button_cancel.paint( x, y, 'A', "CANCEL" );
	}
}
Ejemplo n.º 17
0
//--------- Begin of function FirmMarket::put_info ---------//
//
void FirmMarket::put_info(int refreshFlag)
{
	Firm::put_info(refreshFlag);

	vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("MARKBASE") );
	disp_market_info( INFO_Y1, refreshFlag );

	//--- only display market info if the player is allowed to trade with this market ---//

	if( config.show_ai_info || is_own() )
	{
		disp_income(INFO_Y1+209, refreshFlag );	  // 1-display income figure
	}

	button_hire_caravan.create( INFO_X1+13, INFO_Y1+281, 'A', "HIRECARA" );
	button_hire_caravan.enable_flag = 0;

	if( is_own() )
	{
		button_hire_caravan.enable_flag = can_hire_caravan();
		button_hire_caravan.paint();
	}

/*
	disp_basic_info(INFO_Y1, refreshFlag);

	//--- only display market info if the player is allowed to trade with this market ---//

	put_market_info(INFO_Y1+50, refreshFlag);

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

	if( !config.show_ai_info && nation_recno!=nation_array.player_recno )
		return;

	disp_income(INFO_Y1+209, refreshFlag );	  // 1-display income figure

	button_hire_caravan.paint( INFO_X1, INFO_Y1+236, 'A', "HIRECARA" );

	if( can_hire_caravan() )
		button_hire_caravan.enable();
	else
		button_hire_caravan.disable();
*/
}
Ejemplo n.º 18
0
//--------- Begin of function FirmResearch::disp_main_menu ---------//
//
void FirmResearch::disp_main_menu(int refreshFlag)
{
	disp_basic_info(INFO_Y1, refreshFlag);

	if( !should_show_info() )
		return;

	disp_research_info(INFO_Y1+54, refreshFlag);

	disp_worker_list(INFO_Y1+107, refreshFlag);

	disp_worker_info(INFO_Y1+171, refreshFlag);

	if( own_firm() )
	{
		if( refreshFlag==INFO_REPAINT )
			button_select_research.paint( INFO_X1, INFO_Y1+235, 'A', "RESEARCH" );
	}

	disp_spy_button( INFO_X1+BUTTON_ACTION_WIDTH, INFO_Y1+235, refreshFlag );
}
Ejemplo n.º 19
0
//--------- Begin of function FirmResearch::disp_research_class_menu ---------//
//
void FirmResearch::disp_research_class_menu(int refreshFlag)
{
	int classTechId;
	int x=INFO_X1+23, y=INFO_Y1+13;
	int x2 = INFO_X1 +13;
	int y2 = INFO_Y1 +281;
	// String str;

	vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") );

	// ##### patch begin Gilbert 28/9 ########//
	//str = "Select a technology class to research";
	// font_snds.center_put( INFO_X1+7, INFO_Y1+13, INFO_X2, INFO_Y1+28, str );
	// font_snds.center_put( INFO_X1+7, INFO_Y1+13, INFO_X2, INFO_Y1+28, 
	//		text_firm.str_select_tech_class() );
	font_snds.put_paragraph( x, y, INFO_X2-6, INFO_Y1+52,
		text_firm.str_select_tech_class() );
	y = font_snds.next_text_y + 2;

	for( classTechId=FIRST_TECH_CLASS_RESEARCH ; classTechId<=LAST_TECH_CLASS_RESEARCH ; classTechId++ )
	{
		int b = classTechId-FIRST_TECH_CLASS_RESEARCH;
		if( tech_res.tech_class(classTechId)->researchable_tech_count(nation_array.player_recno) ==0 )
			continue;

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

//		button_research_class_array[b].create( x, y+(b+1)*20, x +187, y+(b+1)*20+17,
//			i_disp_research_class_button, ButtonCustomPara( this, classTechId) );
		button_research_class_array[b].create( x, y+b*20, x +187, y+b*20+17,
			i_disp_research_class_button, ButtonCustomPara( this, classTechId) );

		button_research_class_array[classTechId-1].paint();
	}
	// ##### patch end Gilbert 28/9 ########//
	
	x2 +=  3 * BUTTON_DISTANCE;
	button_cancel.create( x2, y2, 'A', "CANCEL" );
	button_cancel.paint();
}
Ejemplo n.º 20
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.º 21
0
//--------- Begin of function UnitCaravan::disp_info ---------//
//
void UnitCaravan::disp_info(int refreshFlag)
{
	char *nationPict = image_spict.get_ptr("V_COLCOD");
	vga.active_buf->put_bitmap_trans_remap_decompress(INFO_X1+16, INFO_Y1-28, nationPict, game.get_color_remap_table(nation_recno, 0) );

	vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("CARABASE") );

//	disp_basic_info(INFO_Y1, refreshFlag);
	disp_unit_profile(10, refreshFlag);

	if( !config.show_ai_info && !is_own() )
		return;

	disp_stop(INFO_Y1+54, refreshFlag);

	// display auto/manual button

	button_duplicate_caravan.create( INFO_X1+13, INFO_Y1+281, 'A', "CARACOPY" );

	// manual button
	button_auto_trade_group[0].create( INFO_X1+BUTTON_DISTANCE+13, INFO_Y1+235,
		INFO_X1+BUTTON_DISTANCE+56-1, INFO_Y1+280,
		i_disp_auto_trade_button, ButtonCustomPara(this, 0), 0 );

	// auto button
	button_auto_trade_group[1].create( INFO_X1+13, INFO_Y1+235,
		INFO_X1+56-1, INFO_Y1+280,
		i_disp_auto_trade_button, ButtonCustomPara(this, 1), 0 );
	button_auto_trade_group[1].set_help_code( "AUTOPICK" );
	button_auto_trade_group.paint( default_market_trade_mode );
	
	button_duplicate_caravan.enable_flag = can_duplicate_caravan();
	button_duplicate_caravan.paint();

	disp_goods(INFO_Y1+235, refreshFlag);
}
Ejemplo n.º 22
0
//--------- Begin of function FirmInn::put_det ---------//
//
void FirmInn::put_det(int refreshFlag)
{
	if( browse_hire.none_record )
	{
		button_hire.reset();
		return;
	}

	//--------- display details ----------//

	InnUnit* innUnit = inn_unit_array+browse_hire.recno()-1;

	disp_unit_info(HIRE_DET_Y1, innUnit, refreshFlag );

	//------- paint buttons --------//

	if( own_firm() )
	{
		if( refreshFlag == INFO_REPAINT )
		{
			button_hire.paint( HIRE_DET_X1, HIRE_DET_Y2+4, 'A', "HIREUNIT" );
		}
		else
		{
			if( inn_unit_count > 0 &&
				 (~nation_array)->cash >= inn_unit_array[browse_hire.recno()-1].hire_cost )
			{
				button_hire.enable();
			}
			else
			{
				button_hire.disable();
			}
		}
	}
}
Ejemplo n.º 23
0
void FirmOffensive::disp_magic_menu(int refreshFlag)
{
	// ----- create cancel button -------//

	button_cancel.create( INFO_X1 +13, INFO_Y1 +235, 'A', "CANCEL" );
	if( !should_show_info() )
		return;

	vga.active_buf->put_bitmap(INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") );

	if( !is_own() )
		return;

	// display instruction
//	String str;

	switch( menu_mode )
	{
	case FIRM_MAGIC_MENU_CAST:
		font_snds.center_put_paragraph( INFO_X1 +20 , INFO_Y1 +20, INFO_X2 -10, INFO_Y1 +60, 
			text_firm.str_cast_magic_instruct(menu_mode_para), 2, 0, 0);
		break;

	case FIRM_MAGIC_MENU_UNIT:
		// str = "Select a Unit to Teleport";
		font_snds.center_put_paragraph( INFO_X1 +20 , INFO_Y1 +20, INFO_X2 -10, INFO_Y1 +60, 
			text_firm.str_cast_teleport_source(), 2, 0, 0);
		break;

	default:
		err_here();
	}

	// display magic name

//	font_snds.center_put_paragraph( INFO_X1 +20 , INFO_Y1 +60, INFO_X2 -10, INFO_Y1 +80,
//		tech_res[magic_info_array[menu_mode_para-1].tech_id]->tech_des(), 2, 0, 0);

	// display cost

	if( menu_mode == FIRM_MAGIC_MENU_CAST )
	{
		char mobileType;
		int pointedXLoc;
		int pointedYLoc;

		if( world.zoom_matrix->get_detect_location(mouse.cur_x, mouse.cur_y, &pointedXLoc, &pointedYLoc, &mobileType) )
		{
			//	int x2 = font_snds.put( INFO_X1+20, INFO_Y1+70, "Life Point Cost : ");
			//	font_snds.put( x2, INFO_Y1+70, calc_live_point_cost( menu_mode_para, pointedXLoc, pointedYLoc, teleport_unit_recno) );
			switch( menu_mode_para )
			{
			case MAGIC_DESTROY_BUILDING:
			case MAGIC_FREEZE_UNIT:
			case MAGIC_DAMAGE_AREA:
			case MAGIC_GOD_POWER:
				font_snds.center_put_paragraph( INFO_X1 +20 , INFO_Y1 +80, INFO_X2 -10, INFO_Y1 +120, 
					text_firm.str_cast_cost_cash(calc_cash_cost( menu_mode_para, pointedXLoc, pointedYLoc, 0)),
					2, 0, 0);
				break;

			case MAGIC_TELEPORT:
				font_snds.center_put_paragraph( INFO_X1 +20 , INFO_Y1 +80, INFO_X2 -10, INFO_Y1 +120,
					text_firm.str_teleport_cost_cash(calc_cash_cost( menu_mode_para, pointedXLoc, pointedYLoc, teleport_unit_recno)),
					2, 0, 0);
				break;
			}
		}
	}

	// display cancel button

	button_cancel.paint();
}
Ejemplo n.º 24
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.º 25
0
//--------- 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" );
}
Ejemplo n.º 26
0
//--------- Begin of function FirmCamp::disp_camp_info ---------//
//
void FirmCamp::disp_camp_info(int dispY1, int refreshFlag)
{
	if( is_own() )
	{
		int x1 = INFO_X1 +13;
		int y1 = INFO_Y1 +235;
		int x2 = INFO_X1 +13;
		int y2 = INFO_Y1 +281;
		if( refreshFlag==INFO_REPAINT )
		{
			// ##### begin Gilbert 31/12 #######//
			// button_patrol.create( INFO_X1+13, INFO_Y1+235, 'A', "PATROL" );
			// button_reward.create( INFO_X1+13+BUTTON_DISTANCE, INFO_Y1+235, 'A', "REWARDCB" );
			// button_defense.create( INFO_X1+13+2*BUTTON_DISTANCE, INFO_Y1+235, 'A', defense_flag ? "DEFENSE1" : "DEFENSE0" );

			if (!is_monster())
				button_patrol.create( INFO_X1+13+BUTTON_DISTANCE, INFO_Y1+281, 'A', "PATROL" );
			else
				button_patrol.create( INFO_X1+13+BUTTON_DISTANCE, INFO_Y1+281, 'A', "F_PATROL" );

			if (!is_monster())
				button_reward.create( INFO_X1+13, INFO_Y1+235, 'A', "REWARD" );				
			else
				button_reward.create( INFO_X1+13, INFO_Y1+235, 'A', "F_REWARD" );				
							
			if (!is_monster())
				button_defense.create( INFO_X1+13+2*BUTTON_DISTANCE, INFO_Y1+281, 'A', defense_flag ? "DEFENSE1" : "DEFENSE0" );
			else
				button_defense.create( INFO_X1+13+2*BUTTON_DISTANCE, INFO_Y1+281, 'A', defense_flag ? "F_DEFEN1" : "F_DEFEN0" );
				
			if (!is_monster())
				button_promote.create( INFO_X1+13+2*BUTTON_DISTANCE , INFO_Y1+235, 'A', "PROMOTE" );
			else
				button_promote.create( INFO_X1+13+2*BUTTON_DISTANCE , INFO_Y1+235, 'A', "F_PROMOT" );
			// ##### end Gilbert 31/12 #######//
		}
		if( overseer_recno )
		{
			button_patrol.enable_flag = 1;
		}
		else
		{
			for( int i = 0; i < soldier_count && soldier_array[i].is_under_training(); ++i );
			button_patrol.enable_flag = i < soldier_count;
		}
		
		String str;
		switch(patrol_state)
		{
			case PATROL_ALL:
			//	str = "Sortie All";
				str = "";
				break;
			case PATROL_NO_GENERAL:
				str = "Sortie No Leader";
				break;
			case PATROL_NO_INJURED_SOILDER:
				str = "Sortie No Injured";
				break;
			default:
				break;
		}

		button_patrol.paint();
	//	vga.active_buf->bar_alpha( button_patrol.x1, button_patrol.y1+15, button_patrol.x1+BUTTON_ACTION_WIDTH-1, button_patrol.y1+BUTTON_ACTION_HEIGHT-16, 1, 0 );
		font_whbl.center_put_paragraph( button_patrol.x1, button_patrol.y1, button_patrol.x1+BUTTON_ACTION_WIDTH-1, button_patrol.y1+BUTTON_ACTION_HEIGHT-1, str );

		// ###### begin Gilbert 15/4 ########//
		if( nation_array[nation_recno]->cash >= REWARD_COST &&
			 ( (overseer_recno && unit_array[overseer_recno]->rank_id != RANK_KING && unit_res[unit_array[overseer_recno]->unit_id]->class_info.has_loyalty)
			  || (selected_soldier_id && selected_soldier_id <= soldier_count && unit_res[soldier_array[selected_soldier_id-1].unit_id]->class_info.has_loyalty)) )
			button_reward.enable_flag = 1;			// call paint
		// ###### end Gilbert 15/4 ########//
		else
			button_reward.enable_flag = 0;		// call paint
		button_reward.paint();

		if (!is_monster())
			button_defense.update_bitmap( defense_flag ? "DEFENSE1" : "DEFENSE0" );		// call paint
		else
			button_defense.update_bitmap( defense_flag ? "F_DEFEN1" : "F_DEFEN0" );

		if( (button_promote.visible_flag = !overseer_recno) )
		{
			button_promote.enable_flag = 0;
			if( selected_soldier_id > 0 && selected_soldier_id <= soldier_count )
			{
				Soldier *soldierPtr = soldier_array + selected_soldier_id - 1;
				// ##### begin Gilbert 24/3 ######//
				err_when( soldierPtr->unit_id == UNIT_WAGON );

				if( soldierPtr->race_id != 0
					&& soldierPtr->rank_id == RANK_SOLDIER 
					&& !soldierPtr->is_under_training()
					&& soldierPtr->skill_level() > 0 )
				// ##### end Gilbert 24/3 ######//
				{
					button_promote.enable_flag = 1;
				}
			}

			button_promote.paint();
		}
	}
	disp_spy_button( INFO_X1+13+BUTTON_DISTANCE, INFO_Y1+281, refreshFlag);
}
Ejemplo n.º 27
0
//--------- Begin of function Firm::disp_spy_menu ---------//
//
void Firm::disp_spy_menu(int refreshFlag)
{
	static int lastSpyCount;

	firm_ptr = this;

	disp_basic_info(INFO_Y1, refreshFlag);

	//---------- paint controls -----------//

	if( refreshFlag == INFO_REPAINT )
	{
		//------ display browser field description -------//

		int x=SPY_BROWSE_X1+2;
		int y=SPY_BROWSE_Y1-23;

		vga.d3_panel_up( SPY_BROWSE_X1, y, SPY_BROWSE_X2, SPY_BROWSE_Y1-3 );

		font_san.put( x+4  , y+4, "Spy Skill" );
		font_san.put( x+70 , y+4, "Loyalty" );
		font_san.put( x+130, y+4, "Action" );

		//------------ create browser ------------//

		browse_spy.init( SPY_BROWSE_X1, SPY_BROWSE_Y1, SPY_BROWSE_X2, SPY_BROWSE_Y2,
							  0, 25, player_spy_count, put_spy_rec );

		browse_spy.open(1);

		lastSpyCount = player_spy_count;

		err_when( player_spy_count != spy_filter() );
	}
	else
	{
		//---------- update controls -----------//

		if( player_spy_count != lastSpyCount )
		{
			lastSpyCount = player_spy_count;
			info.disp();
			return;
		}
		else
			browse_spy.update();
	}

	if( spy_filter()==0 )
		return;

	//----------- create the paint button ----------//

	if( refreshFlag == INFO_REPAINT )
	{
		int x=BUTTON_X1;
		int y=SPY_BROWSE_Y2+5;

		//--------- spy menu mode -----------//

		if( firm_menu_mode == FIRM_MENU_SPY )
		{
			//--------- mobilize spy button --------//

			button_spy_mobilize.paint( x, y, 'A', "MOBILSPY" );
			x+=BUTTON_ACTION_WIDTH;

			//--------- reward spy button --------//

			button_spy_reward.paint( x, y, 'A', "REWARD" );
			x+=BUTTON_ACTION_WIDTH;

			//------ change spy action button ------//

			if( firm_id != FIRM_INN && nation_recno != nation_array.player_recno )		// cannot change action in inns
			{
				button_spy_action.paint( x, y, 'A', "SPYCHACT" );
				x+=BUTTON_ACTION_WIDTH;
			}
			else
				button_spy_action.reset();

			//---------- capture button -----------//

			if( can_player_spy_capture() )
			{
				button_capture.paint( x, y, 'A', "SPYCAPT" );
				x+=BUTTON_ACTION_WIDTH;

				if( x+BUTTON_ACTION_WIDTH-5 > INFO_X2 )
				{
					x  = BUTTON_X1;
					y += BUTTON_ACTION_HEIGHT;
				}
			}
			else
				button_capture.reset();

			//---------- view secret button -----------//

			if( nation_recno && nation_recno != nation_array.player_recno )
			{
				button_view_secret.paint( x, y, 'A', "VSECRET" );
				x+=BUTTON_ACTION_WIDTH;

				if( x+BUTTON_ACTION_WIDTH-5 > INFO_X2 )
				{
					x  = BUTTON_X1;
					y += BUTTON_ACTION_HEIGHT;
				}
			}
			else
				button_view_secret.reset();

			//---------- assassination button -----------//

			if( nation_recno && nation_recno != nation_array.player_recno &&
				 firm_res[firm_id]->need_overseer )
			{
				button_assassinate.paint( x, y, 'A', "ASSASSIN" );
				x+=BUTTON_ACTION_WIDTH;

				if( x+BUTTON_ACTION_WIDTH-5 > INFO_X2 )
				{
					x  = BUTTON_X1;
					y += BUTTON_ACTION_HEIGHT;
				}
			}
			else
				button_assassinate.reset();
		}

		//--------- select briber mode --------//

		else if( firm_menu_mode == FIRM_MENU_SELECT_BRIBER )
		{
			button_bribe.paint( x, y, 'A', "BRIBE" );
			x+=BUTTON_ACTION_WIDTH;
		}
		else
			err_here();

		//----------- cancel button -----------//

		button_cancel.paint( x, y, 'A', "PREVMENU" );
	}

	//---- enable/disable view secret button ----//

	//### begin alex 20/3 ###//
	if( button_view_secret.init_flag && firm_menu_mode==FIRM_MENU_SPY)
	//#### end alex 20/3 ####//
	{
		Spy* spyPtr = spy_array[ spy_filter( browse_spy.recno() ) ];

		if( spyPtr->spy_skill >= MIN_VIEW_SECRET_SPYING_SKILL )
			button_view_secret.enable();
		else
			button_view_secret.disable();
	}

	//---- enable/disable assassinate button ----//

	if( button_assassinate.init_flag )
	{
		if( overseer_recno &&
			 unit_array[overseer_recno]->true_nation_recno() != nation_array.player_recno )		// don't assassinate your own spy
		{
			button_assassinate.enable();
		}
		else
		{
			button_assassinate.disable();
		}
	}
}
Ejemplo n.º 28
0
// ------- begin of function FirmMonsterTrain::disp_firm_info -------//
//
void FirmMonsterTrain::disp_firm_info(int dispY1, int refreshFlag )
{
	int i;

	if( refreshFlag == INFO_REPAINT )
	{
		button_mobilize.create( INFO_X1+13, INFO_Y1+235, 'A', "MOBILIZE" );
		button_mobilize.enable_flag = 0;
		if ((train_type_count == 1) && (train_unit_id[0] == UNIT_BEE))
			button_patrol.create( INFO_X1+13+BUTTON_DISTANCE, INFO_Y1+235, 'A', "PATROL-B" );
		else
		if ((train_type_count == 1) && (train_unit_id[0] == UNIT_TERMITE))
			button_patrol.create( INFO_X1+13+BUTTON_DISTANCE, INFO_Y1+235, 'A', "PATROL-T" );
		else
			button_patrol.create( INFO_X1+13+BUTTON_DISTANCE, INFO_Y1+235, 'A', "PATROL" );

		button_patrol.enable_flag = 0;
		for( i = 0; i < train_type_count; ++i )
		{
			if( i < 4 )		// 4 buttons at bottom line
			{
				if ((train_type_count == 1) && (train_unit_id[0] == UNIT_BEE))
					button_train[i].create( INFO_X1+13+i*BUTTON_DISTANCE, INFO_Y1+281, 'A', "TRAIN-B" );
				else
				if ((train_type_count == 1) && (train_unit_id[0] == UNIT_TERMITE))
					button_train[i].create( INFO_X1+13+i*BUTTON_DISTANCE, INFO_Y1+281, 'A', "TRAIN-T" );
				else
					button_train[i].create( INFO_X1+13+i*BUTTON_DISTANCE, INFO_Y1+281, 'A', "F_TRAIN" );
			}
			else
			{
				if ((train_type_count == 1) && (train_unit_id[0] == UNIT_BEE))
					button_train[i].create( INFO_X1+13+(7-i)*BUTTON_DISTANCE, INFO_Y1+235, 'A', "TRAIN-B" );
				else
				if ((train_type_count == 1) && (train_unit_id[0] == UNIT_TERMITE))
					button_train[i].create( INFO_X1+13+(7-i)*BUTTON_DISTANCE, INFO_Y1+235, 'A', "TRAIN-T" );
				else
					button_train[i].create( INFO_X1+13+(7-i)*BUTTON_DISTANCE, INFO_Y1+235, 'A', "F_TRAIN" );
			}
			button_train[i].enable_flag = 0;
		}

		// ###### begin Gilbert 11/3 ########//
		button_go_rally.create( INFO_X1+13+BUTTON_DISTANCE*2, INFO_Y1+235, 'A', "RALLY-GO" );
		button_clear_rally.create( INFO_X1+13+BUTTON_DISTANCE*3, INFO_Y1+235, 'A', "RALLY-NO" );
		// ###### end Gilbert 11/3 ########//
	}

	if( !should_show_info() )
		return;

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

	button_mobilize.enable_flag = 0;

	if( is_own() )
	{
		if( selected_trainee_id > 0 && selected_trainee_id <= trainee_count )
		{
			MonsterTrainee *traineePtr = trainee_array + selected_trainee_id - 1;
			button_mobilize.enable_flag = !traineePtr->is_under_training();
		}

		button_mobilize.paint();

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

		for( i = 0; i < trainee_count && trainee_array[i].is_under_training(); ++i );
		button_patrol.enable_flag = i < trainee_count;
		button_patrol.paint();

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

		for( i = 0; i < train_type_count; ++i )
		{
			button_train[i].enable_flag = can_recruit(train_unit_id[i]);
			button_train[i].paint();
		}

		// ------- display rally points button ------//

		if( (button_go_rally.visible_flag = rally_enable_flag != 0) )
			button_go_rally.paint();

		if( (button_clear_rally.visible_flag = rally_enable_flag != 0) )
			button_clear_rally.paint();
	}
}
Ejemplo n.º 29
0
//--------- Begin of function Firm::disp_bribe_menu ---------//
//
void Firm::disp_bribe_menu(int refreshFlag)
{
	//---- if the briber or bribe target is no longer valid -----//

	if( bribe_result == BRIBE_NONE )
	{
		if( !validate_cur_bribe() )
		{
			firm_menu_mode = FIRM_MENU_MAIN;
			bribe_result   = BRIBE_NONE;
			info.disp();
			return;
		}
	}

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

	if( refreshFlag != INFO_REPAINT )
		return;

	//------ display the bribe menu ------//

	if( bribe_result == BRIBE_NONE )
	{
		int y=INFO_Y1;

		font_san.d3_put( INFO_X1, y, INFO_X2, y+19, _("Bribe") );
		y+=22;

		disp_bribe_unit( y );
		y+=49;

		for( int i=0 ; i<BRIBE_AMOUNT_COUNT ; i++ )
		{
			disp_bribe_button( y, bribe_amount_array[i], 1);

			err_when( bribe_amount_array[i] > MAX_BRIBE_AMOUNT );

			y += BRIBE_OPTION_HEIGHT+2;
		}

		disp_bribe_button( y, 0, 1);
	}

	//------ display the bribe result -----//

	else
	{
		int x=INFO_X1+4, y=INFO_Y1+4, y2=y+font_san.height()-1;

		if( bribe_result == BRIBE_SUCCEED )
		{
			vga_util.d3_panel_up( INFO_X1, INFO_Y1, INFO_X2, INFO_Y1+24 );

			font_san.center_put( INFO_X1, y, INFO_X2, y2, _("Bribing Succeeded.") );
		}
		else
		{
			vga_util.d3_panel_up( INFO_X1, INFO_Y1, INFO_X2, INFO_Y1+62 );

			font_san.center_put( INFO_X1, y	  , INFO_X2, y2, _("Bribing Failed.") );
			font_san.center_put( INFO_X1, y+=18, INFO_X2, y2+=18, _("Your Spy Was Caught") );
			font_san.center_put( INFO_X1, y+=18, INFO_X2, y2+=18, _("And Executed.") );
		}

		y+=26;
		button_cancel.paint( INFO_X1, y, 'A', "CONTINUE" );
	}
}
Ejemplo n.º 30
0
//--------- Begin of function Unit::disp_button ---------//
//
void Unit::disp_button(int dispY1)
{
	int x=INFO_X1;

	//---- if currently in the mode of selecting a unit to succeed the king ----//

	if( nation_array.player_recno &&
		 nation_recno == nation_array.player_recno &&
		 (~nation_array)->king_unit_recno == 0 )
	{
		if( race_id )
			button_succeed_king.paint( x, dispY1, 'A', "SUCCEED" );

		return;
	}

	//------- display aggressive mode button ------//

	button_aggressive_mode.paint( x, dispY1, 'A', aggressive_mode ? (char*)"AGGRESS1" : (char*)"AGGRESS0" );
	x += BUTTON_ACTION_WIDTH;

	//---------- only for human units ---------//

	// Reset all buttons, and activate them as-needed
	button_build.reset();
	button_settle.reset();
	button_promote.reset();
	button_demote.reset();
	button_reward.reset();
	button_return_camp.reset();
	// button_burn.reset();
	// button_assign.reset();

	if( unit_res[unit_id]->unit_class == UNIT_CLASS_HUMAN && race_id )
	{
		int firmId;
		for( firmId=1; firmId<=MAX_FIRM_TYPE ; firmId++ )
		{
			if( firm_res[firmId]->can_build(sprite_recno) )
				break;
		}

		if( firmId<=MAX_FIRM_TYPE &&
			 nation_recno == nation_array.player_recno ) 	// a spy cannot build structure for another nation
		{
			button_build.paint( x, dispY1, 'A', "BUILD" );
			x += BUTTON_ACTION_WIDTH;
		}

		//-------- settle button ----------//

		if( mobile_type==UNIT_LAND && rank_id != RANK_KING )
		{
			button_settle.paint( x, dispY1, 'A', "SETTLE" );
			x += BUTTON_ACTION_WIDTH;
		}

		//-------- promote/demote button --------//


		if( nation_recno == nation_array.player_recno )		// you can't promote your spy in other nation
		{
			if( rank_id==RANK_SOLDIER && skill.skill_id==SKILL_LEADING )
			{
				if(unit_array.selected_count==1)
				{
					button_promote.paint( x, dispY1, 'A', "PROMOTE" );
					x += BUTTON_ACTION_WIDTH;
				}
			}
			else if( rank_id == RANK_GENERAL )
			{
				if( unit_array.selected_count==1 )
				{
					button_demote.paint( x, dispY1, 'A', "DEMOTE"  );
					x += BUTTON_ACTION_WIDTH;
				}
			}
		}

		if( x+BUTTON_ACTION_WIDTH-5 > INFO_X2 )
		{
			x  = INFO_X1;
			dispY1 += BUTTON_ACTION_HEIGHT;
		}

		//------------ "reward" button ---------//

		if( nation_array.player_recno && is_own() &&	// Can only reward if the player is still alive. Can reward own spies (even when cloaked).
			 rank_id != RANK_KING )
		{
			button_reward.paint( x, dispY1, 'A', "REWARD" );
			x += BUTTON_ACTION_WIDTH;

			if( x+BUTTON_ACTION_WIDTH-5 > INFO_X2 )
			{
				x  = INFO_X1;
				dispY1 += BUTTON_ACTION_HEIGHT;
			}
		}

		/*
		//-------- burn button ----------//

		if( skill.combat_level > BURN_COMBAT_LEVEL && mobile_type==UNIT_LAND  )
		{
			button_burn.paint_text( x, dispY1, "Burn" );
			x += 60;
		}

		//-------- assign to firm button --------//

		if( mobile_type==UNIT_LAND )
		{
			button_assign.paint_text( x, dispY1, "Assign" );
			x+=60;
		}
		*/
	}

	//------ "Return Camp" button -------//

	if( home_camp_firm_recno &&
		 (unit_res[unit_id]->unit_class == UNIT_CLASS_HUMAN || unit_res[unit_id]->unit_class == UNIT_CLASS_WEAPON) &&
		 firm_array[home_camp_firm_recno]->region_id == region_id() )
	{
		button_return_camp.paint( x, dispY1, 'A', "RETCAMP" );
		x += BUTTON_ACTION_WIDTH;

		if( x+BUTTON_ACTION_WIDTH-5 > INFO_X2 )
		{
			x  = INFO_X1;
			dispY1 += BUTTON_ACTION_HEIGHT;
		}
	}

	//------- spy notify button ------//

	if( spy_recno && true_nation_recno() == nation_array.player_recno )
	{
		int notifyFlag = spy_array[spy_recno]->notify_cloaked_nation_flag;

		button_spy_notify.paint( x, dispY1, 'A', notifyFlag ? (char*)"SPYNOTI1" : (char*)"SPYNOTI0" );
		x += BUTTON_ACTION_WIDTH;

		if( x+BUTTON_ACTION_WIDTH-5 > INFO_X2 )
		{
			x  = INFO_X1;
			dispY1 += BUTTON_ACTION_HEIGHT;
		}

		button_spy_drop_identity.paint( x, dispY1, 'A', "NOSPY" );
	}
	else
	{
		button_spy_notify.reset();
		button_spy_drop_identity.reset();
	}

	//---- display button for changing nation color scheme ----//

	if( sys.debug_session )
		button_change_color.paint_text( INFO_X1, INFO_Y2-20, "Change Nation Color" );
}