Пример #1
0
//--------- Begin of function Unit::disp_main_menu ---------//
//
void Unit::disp_main_menu(int refreshFlag)
{
	disp_basic_info(INFO_Y1, refreshFlag);
	disp_unit_profile( INFO_Y1+52, refreshFlag );

	if( !should_show_info() )
		return;

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

	int y=INFO_Y1+98;

	if( race_id )
	{
		disp_unit_info( y, refreshFlag );
		y += 89;
	}

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

	if( is_own_spy() )
	{
		disp_spy_menu(y, refreshFlag);
		y+=spy_menu_height()+3;
	}

	if( is_own() )
	{
		if( refreshFlag == INFO_REPAINT )
			disp_button(y);

		y+=BUTTON_ACTION_HEIGHT;
	}

	#ifdef DEBUG
		if( sys.debug_session || sys.testing_session )
			disp_debug_info(this, INFO_Y2-68, refreshFlag);
	#endif
}
Пример #2
0
//--------- Begin of function Firm::detect_spy_menu ---------//
//
void Firm::detect_spy_menu()
{
	firm_ptr = this;

	if( spy_filter()==0 )
		return;

	browse_spy.detect();

	Spy* spyPtr = spy_array[ spy_filter( browse_spy.recno() ) ];

	//--------- detect buttons --------//

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

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

		if( button_spy_mobilize.detect() )
		{
			if( !remote.is_enable() )
			{
				if( spyPtr->mobilize_firm_spy() )
				{
					spyPtr->notify_cloaked_nation_flag = 0;		// reset it so the player can control it
					info.disp();
					return;
				}
			}
			else
			{
				// packet structure <spy recno>
				short *shortPtr = (short *)remote.new_send_queue_msg(MSG_SPY_LEAVE_FIRM, sizeof(short) );
				*shortPtr = spyPtr->spy_recno;
			}
		}

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

		else if( button_spy_reward.detect() )
		{
			spyPtr->reward(COMMAND_PLAYER);
		}

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

		else if( button_spy_action.detect() )		// set action mode
		{
			if( !remote.is_enable() )
			{
				spyPtr->set_next_action_mode();
				disp_spy_menu( INFO_UPDATE );
			}
			else
			{
				// packet structure <spy recno>
				short *shortPtr = (short *)remote.new_send_queue_msg(MSG_SPY_CYCLE_ACTION, sizeof(short) );
				*shortPtr = spyPtr->spy_recno;
			}
		}

		//------ capture firm ---------//

		else if( button_capture.detect() )
		{
			int spyRecno = can_player_spy_capture();

			if( spyRecno )
			{
				Spy* capturerSpy = spy_array[spyRecno];

				if( !remote.is_enable() )
				{
					capturerSpy->capture_firm();
				}
				else
				{
					// packet structure <spy recno>
					short *shortPtr = (short *)remote.new_send_queue_msg(MSG_SPY_CAPTURE_FIRM, sizeof(short) );
					*shortPtr = capturerSpy->spy_recno;
				}
			}
		}

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

		else if( button_view_secret.detect() )
		{
			action_spy_recno = spyPtr->spy_recno;
			firm_menu_mode   = FIRM_MENU_VIEW_SECRET;
			info.disp();
		}

		//-------- assassinate ------//

		else if( button_assassinate.detect() )
		{
			spyPtr->assassinate( overseer_recno, COMMAND_PLAYER );
		}
	}

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

	else if( firm_menu_mode == FIRM_MENU_SELECT_BRIBER )
	{
		if( button_bribe.detect() )
		{
			action_spy_recno = spyPtr->spy_recno;
			firm_menu_mode   = FIRM_MENU_SET_BRIBE_AMOUNT;
			info.disp();
		}
	}
	else
	{
		err_here();
	}

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

	if( button_cancel.detect() )
	{
		firm_menu_mode = FIRM_MENU_MAIN;
		info.disp();
	}
}
Пример #3
0
//--------- Begin of function FirmCamp::put_info ---------//
//
void FirmCamp::put_info(int refreshFlag)
{
	// ##### begin Gilbert 21/9 ######//
	if( refreshFlag == INFO_REPAINT )
	{
		last_menu_mode = firm_menu_mode = FIRM_MENU_MAIN;
		disp_combat_or_skill = 0;		// display combat
	}
	// ##### end Gilbert 21/9 ######//
	else
	{
		if( last_menu_mode != firm_menu_mode )		// if changing menu mode pass repaint to sub-menu
		{
			refreshFlag = INFO_REPAINT;
			last_menu_mode = firm_menu_mode;
		}
	}

	Firm::put_info(refreshFlag);

	switch( firm_menu_mode )
	{
	case FIRM_MENU_MAIN:
		if( should_show_info() )
		{
			vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("FORTBASE") );

			disp_camp_info(INFO_Y1, refreshFlag);
			Firm *firmPtr = firm_array[firm_recno];

			if( firm_id == FIRM_CAMP )
				disp_camp_upgrade(INFO_Y1, refreshFlag);

			disp_soldier_list(INFO_Y1, refreshFlag, 0);
			disp_soldier_info(INFO_Y1+178, refreshFlag);
			// disp_debug_info(this, refreshFlag);
		}
		break;

	case FIRM_MENU_TRAIN:
		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("FORTBASE") );
		disp_train_menu(refreshFlag);
		break;

	case FIRM_MENU_SPY:
	case FIRM_MENU_SELECT_BRIBER:
		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("FORTBASE") );
		disp_spy_menu(refreshFlag);
		break;

	case FIRM_MENU_SET_BRIBE_AMOUNT:
//		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("FORTBASE") );
		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") );
		disp_bribe_menu(refreshFlag);
		break;

	case FIRM_MENU_BRIBE_RESULT:
//		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("FORTBASE") );
		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") );
		disp_bribe_result(refreshFlag);
		break;

	case FIRM_MENU_VIEW_SECRET:
		spy_array.disp_view_secret_menu(action_spy_recno, refreshFlag);
		break;

	case FIRM_MENU_ASSASSINATE_CONFIRM:
		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") );
		disp_assassinate_confirm(refreshFlag);
		break;

	case FIRM_MENU_ASSASSINATE_RESULT:
		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") );
		disp_assassinate_result(refreshFlag);
		break;

	case FIRM_MENU_STEAL_TECH_CONFIRM:
		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") );
		disp_steal_tech_confirm(refreshFlag);
		break;

	case FIRM_MENU_STEAL_TECH_RESULT:
		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") );
		disp_steal_tech_result(refreshFlag);
		break;

	case FIRM_MENU_INCIDENT_NATION:
		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") );
		disp_incident_nation(refreshFlag);
		break;

	case FIRM_MENU_INCIDENT_CONFIRM:
		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") );
		disp_incident_confirm(refreshFlag);
		break;

	case FIRM_MENU_INCIDENT_RESULT:
		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") );
		disp_incident_result(refreshFlag);
		break;

	default:
		err_when( firm_menu_mode < FIRM_MENU_CAMP_LAST );
		// if firm_menu_mode >= FIRM_MENU_CAMP_LAST, handled by sub-class
	}
}
Пример #4
0
//--------- Begin of function Unit::detect_spy_menu ---------//
//
void Unit::detect_spy_menu(int dispY1)
{
	Nation* nationPtr = nation_array[true_nation_recno()];

	int x=INFO_X1+80, y=dispY1+4, nationRecno, changeFlag=0;

	char canChangeAnyCloak = can_spy_change_nation();
	char canChangeOwnCloak = canChangeAnyCloak;		// change back to its own cloak

	if( true_nation_recno() != nation_recno )
		canChangeOwnCloak = 1;

	if( !canChangeOwnCloak )
		return;

	int i;
	for( i=1 ; i<=nation_array.size()+1 ; i++ )
	{
		if( i > nation_array.size() )
		{
			nationRecno = 0;
		}
		else
		{
			if( canChangeAnyCloak )
			{
				if( nation_array.is_deleted(i) || !nationPtr->get_relation(i)->has_contact )
					continue;
			}
			else
			{
				if( i!=nation_recno && i!=true_nation_recno() )	// only display the current cloaked nation and its true nation
					continue;
			}

			nationRecno = i;
		}

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

		if( mouse.single_click(x, y, x+SPY_CLOAK_WIDTH-1, y+22) )
		{
			changeFlag=1;
			break;
		}

		x+=SPY_CLOAK_WIDTH+4;

		if( x+SPY_CLOAK_WIDTH > INFO_X2 )
		{
			x  = INFO_X1+80;
			y += 22;
		}
	}

	if( !changeFlag )
		return;

	//--- group changing the cloaks of all of your spies currently selected ---//

	Unit* unitPtr;

	for( i=unit_array.size() ; i>0 ; i-- )
	{
		if( unit_array.is_deleted(i) )
			continue;

		unitPtr = unit_array[i];

		if( unitPtr->is_own_spy() && unitPtr->selected_flag )
			unitPtr->spy_change_nation(nationRecno, COMMAND_PLAYER);
	}

	disp_spy_menu(dispY1, INFO_UPDATE);
}
Пример #5
0
//--------- Begin of function Firm::disp_info_both ---------//
//
void Firm::disp_info_both(int refreshFlag)
{
	static char  lastUnderConstruction;
	static short lastFirmRecno;
	static char  lastShouldShowInfo;
	static short lastPlayerSpyCount;

	//------ check if under_construction has been changed -----//

	if( lastUnderConstruction != under_construction )
	{
		lastUnderConstruction = under_construction;

		if( refreshFlag == INFO_UPDATE )
			info.disp();							// refresh the display
	}

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

	if( under_construction )
	{
		disp_basic_info(INFO_Y1, refreshFlag);

		if( refreshFlag == INFO_REPAINT )
			font_san.d3_put( INFO_X1, INFO_Y1+54, INFO_X2, INFO_Y1+74, _("Under Construction") );
	}
	else
	{
		//------ check if should_show_info() has been changed -----//

		int shouldShowInfo = should_show_info();

		if( shouldShowInfo   != lastShouldShowInfo ||
			 player_spy_count != lastPlayerSpyCount )
		{
			lastShouldShowInfo = shouldShowInfo;
			lastPlayerSpyCount = player_spy_count;

			if( refreshFlag == INFO_UPDATE )
			{
				info.disp();
				return;
			}
		}

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

		if( lastFirmRecno != firm_recno ||
			 (firm_menu_mode != FIRM_MENU_ASSASSINATE_RESULT &&
			  player_spy_count==0 && bribe_result==BRIBE_NONE) )		// don't refresh mode if the player spy in the firm has just failed the bribing and executed, and we now need to display the failure message
		{
			firm_menu_mode = FIRM_MENU_MAIN;
			lastFirmRecno = firm_recno;
			bribe_result  = BRIBE_NONE;
		}

		switch( firm_menu_mode )
		{
			case FIRM_MENU_MAIN:
				put_info(refreshFlag);
				break;

			case FIRM_MENU_SPY:
			case FIRM_MENU_SELECT_BRIBER:
				disp_spy_menu(refreshFlag);
				break;

			case FIRM_MENU_SET_BRIBE_AMOUNT:
				disp_bribe_menu(refreshFlag);
				break;

			case FIRM_MENU_VIEW_SECRET:
				spy_array.disp_view_secret_menu(action_spy_recno, refreshFlag);
				break;

			case FIRM_MENU_ASSASSINATE_RESULT:
				disp_assassinate_result(refreshFlag);
				break;
		}

		#ifdef DEBUG
		if(debug2_enable_flag)
		{
			font_san.d3_put( INFO_X1, INFO_Y2-30, INFO_X2, INFO_Y2, "" );
			font_san.field( INFO_X1+10, INFO_Y2-20, " ", INFO_X1+20, firm_recno, 1, INFO_X2-10, refreshFlag);
			font_san.field( INFO_X1+40, INFO_Y2-20, " ", INFO_X1+50, loc_x1, 1, INFO_X2-10, refreshFlag);
			font_san.field( INFO_X1+70, INFO_Y2-20, " ", INFO_X1+80, loc_y1, 1, INFO_X2-10, refreshFlag);
			font_san.field( INFO_X1+100, INFO_Y2-20, " ", INFO_X1+110, ai_link_checked, 1, INFO_X2-10, refreshFlag);
		}
		#endif
	}
}