Advanced Question Drawing on a texture in VC

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,638
Reaction score
2,353
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
The x coordinate of the end point of the rectangle is 114 + level * (346 - 114). Read API Docs, the third parameter is not the width of the rectangle but the end x-coordinate.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Thanks. works now.:thumbup:

on the nav lights. what I meant was these. right now we have them like the button mesh. but on the shuttle A they are part of the background. So when the horizon level is pressed then the horizon level lights up. Sames for switching rcs,....
 

Attachments

  • endurancenovc.jpg
    endurancenovc.jpg
    87.2 KB · Views: 13

marcogavazzeni

Addon Developer
Addon Developer
Joined
Jan 5, 2009
Messages
219
Reaction score
0
Points
16
Location
Near Verona
Website
orbiteritalia.forumotion.com
You want to draw a bitmap as in the DG? Is complicated to explain, I recommend you look and study the codes of the DG and Shuttle A, alternatively you can use the mesh that is much more simple.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
You want to draw a bitmap as in the DG? Is complicated to explain, I recommend you look and study the codes of the DG and Shuttle A, alternatively you can use the mesh that is much more simple.
Thanks. What do you mean use the mesh.

Right now we have the nav mode button as seperate meshes like the buttons on a mfd. So we have hor-levl, hold alt,.....

But what we want is when that is clicked then the texture changes? to a lit one.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,638
Reaction score
2,353
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Thanks. What do you mean use the mesh.

Right now we have the nav mode button as seperate meshes like the buttons on a mfd. So we have hor-levl, hold alt,.....

But what we want is when that is clicked then the texture changes? to a lit one.

You can for example edit the texture coordinates of a vertex. Which means essentially, you have a texture with both states, and show only one state at a time.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Interesting. So looking at the DG. They have a texture for all those button. The texture has a lit state and non lit state. So if hold alt is selected change the texture from unlit to lit.

I am going to look at the code for that.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,638
Reaction score
2,353
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
About your performance issues - you use ALWAYS for drawing the fuel bar, which means in every frame of Orbiter, even if it did not change. You could improve the performance for example by redrawing only in 2% steps by checking the propellant level against the currently displayed propellant level and triggering a manual redraw in your poststep code then.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Thanks. The fps issue actually occurred before this. Right now I am trying to get the bar to draw on the Endurance. The thrust is applied but no bar.

greenbars_zpsqk8pblgm.jpg.html


Code:
void ENDURANCE::RedrawPanel_Fuelstatus(SURFHANDLE surf, int part)

{
	char cbuf[20];
	HDC hDC = oapiGetDC(surf);




	double level = GetThrusterLevel(th_main[0]);
	//double m = GetPropellantMass(tank);

	SelectObject(hDC, g_Param.hBrush[0]);//green box
	Rectangle(hDC, 114, 34, (int)(114 + level * (346 - 114)), 75);



	//Rectangle(hDC, 110, 110, (int)((110.0 - m / FUELMASS)*3.2), 160);



	oapiReleaseDC(surf, hDC);

}
 

marcogavazzeni

Addon Developer
Addon Developer
Joined
Jan 5, 2009
Messages
219
Reaction score
0
Points
16
Location
Near Verona
Website
orbiteritalia.forumotion.com
Thanks. The fps issue actually occurred before this. Right now I am trying to get the bar to draw on the Endurance. The thrust is applied but no bar.

greenbars_zpsqk8pblgm.jpg.html


Code:
void ENDURANCE::RedrawPanel_Fuelstatus(SURFHANDLE surf, int part)

{
	char cbuf[20];
	HDC hDC = oapiGetDC(surf);




	double level = GetThrusterLevel(th_main[0]);
	//double m = GetPropellantMass(tank);

	SelectObject(hDC, g_Param.hBrush[0]);//green box
	Rectangle(hDC, 114, 34, (int)(114 + level * (346 - 114)), 75);



	//Rectangle(hDC, 110, 110, (int)((110.0 - m / FUELMASS)*3.2), 160);



	oapiReleaseDC(surf, hDC);

}

"FUELMASS" are not declared.

In my code bars are drawn

Code:
void Eagle::RedrawPanel_Fuelstatus(SURFHANDLE surf, int part)

{	
	HDC hDC = oapiGetDC(surf);
	double level = GetThrusterLevel(th_main[0]);
	double m = GetPropellantMass(tank);

	SelectObject(hDC, g_Param.hBrush[0]);//green box
	Rectangle(hDC, 114, 34, (int)(114 + level * (232)), 75);
	Rectangle(hDC, 114, 110, (int)((114.0 + [COLOR="Red"](m/39)[/COLOR] )), 160);

	oapiReleaseDC(surf, hDC);

}

aPqn549.jpg


Rectangle(hDC, A, B, (int)(A + (value)), C); //MAIN PROP
Rectangle(hDC, A, D, (int)(A + (value)), E); //MAIN ENG

L1 and L2 is in pixel,in this case 232 pixel, (346 - 114)=232.

If you have 1000 kg of fuel mass ---> 1000/232 = 4.3 ----> 1 pixel = 4.3 kg of fuel mass ----> (m/4.3)

My vessel have 9000 kg of fuel mass,9000/232 =38.79 (m/39)

GetThrusterLevel value is 0.0 to 1.0 (level * 232)
I think.....
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Success Thanks. But another issue is the Frame rate. Using the same meshes in a sc3 we get high frame rate but is a dll version we get low fps. I get 45 in sc3 and in the dll 12.

Well every once in a while I get a soft ctd
 
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
Not sure about the soft exit. In D3d9 I get 54 fps. I regular graphics client 12. But the sc3 is 45.

All it has is the stuff to run 4 mfds and virtual view stuff.

Code:
void ENDURANCE::RedrawPanel_Fuelstatus(SURFHANDLE surf, int part)

{
	char cbuf[20];
	HDC hDC = oapiGetDC(surf);




	double level = GetThrusterLevel(th_main[0]);
	double level2 = GetPropellantMass(tank);

	SelectObject(hDC, g_Param.hBrush[0]);//green box
	Rectangle(hDC, 114, 111, (int)(114 + level * (346 - 114)), 160);//thrust



	Rectangle(hDC, 110, 34, (int)((110.0 - level2		/ FUELMASS)*3.2), 75);  //fuel



	oapiReleaseDC(surf, hDC);

}
bool ENDURANCE::clbkLoadGenericCockpit() {
	viewController->HandleLoadGC();
	return true;
}

bool ENDURANCE::clbkLoadVC(int id) { // ID is the Preset Camera Position
	//LAPTOPTerminalScreen->HandleLoadVC(id);
	//HABLAPTOPTerminalScreen->HandleLoadVC(id);
	SURFHANDLE tex3 = oapiGetTextureHandle(meshhg_VC, 3);

	mfdController->HandleLoadVC(id);	
	
	viewController->HandleLoadVC(id);
	oapiVCRegisterArea(AID_FUELSTATUS, _R(0, 0, 486, 302), PANEL_REDRAW_ALWAYS, PANEL_MOUSE_IGNORE, PANEL_MAP_BACKGROUND, tex3);

	return HandleLoadVC(id);
}

bool ENDURANCE::HandleLoadVC(UINT const id)
{
	
	return true;
}

bool ENDURANCE::clbkVCMouseEvent(int id, int event, VECTOR3 &p)
{
	bool result = false;
	result = result || mfdController->HandleMouseEvent(id, event, p);
	result = result || VCMouseEvent(id, event, p);
	
	return result;
}

bool ENDURANCE::VCMouseEvent(int const id, int const event, VECTOR3& const p)
{
	

	return false; // We must return false, as we didn't processed the event!
}



bool ENDURANCE::clbkVCRedrawEvent(int id, int event, SURFHANDLE surf) {
	bool result = false;
	result = result || mfdController->HandleRedrawEvent(id, event, surf);


	result = result || VCRedrawEvent(id, event, surf);


	{

		switch (id) {
		case AID_FUELSTATUS:
			RedrawPanel_Fuelstatus(surf, id - AID_FUELSTATUS);
			return true;
		}
		//	return false;



	}
	return result;
}

bool ENDURANCE::VCRedrawEvent(int const id, int const event, SURFHANDLE const surf) {
	return false;
}

void ENDURANCE::clbkMFDMode (int mfd, int mode)
{
	mfdController->HandleMFDMode(mfd, mode);
}
 
Last edited:

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,638
Reaction score
2,353
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
How many polygons does the VC have? And what are you doing in Post/Prestep
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
NOT D3D9 external 27 fps no vc 22 vc 9



on the main mesh: 68103 vertices, 51981 triangles.
on the vc 38 vertices 198 triangles.

now we have to load the main mesh twice as it is also loaded as vc.
Code:
// visual specs
	SetMeshVisibilityMode(meshi_Vessel	= AddMesh(meshhg_Vessel	= oapiLoadMeshGlobal(FILENAME_ENDURANCE12)), MESHVIS_ALWAYS | MESHVIS_EXTPASS);
	SetMeshVisibilityMode(meshi_VC1 = AddMesh(meshhg_Vessel), MESHVIS_VC);
	SetMeshVisibilityMode(meshi_VC = AddMesh(meshhg_VC = oapiLoadMeshGlobal(FILENAME_ENDURANCE22VC)), MESHVIS_VC);

The reason was because of a clipping because the main mesh is set at MESHVIS_EXTPASS

prestep:
Code:
void ENDURANCE::clbkPreStep(double simtt, double simdt, double mjd)
{
	VECTOR3 cog;
	if (hpbeOn && GetSuperstructureCG(cog))
	{
		VECTOR3 thrust;
		if (GetThrustVector(thrust))
		{
			VECTOR3 c = crossp(cog, thrust);
			double lc = length(c);
			if (lc>0)
			{
				// Calculation of the counter force needed:
				// |cog x thrust|=|cog|*|thrust|*sin(phi) => component of force perpendicular to line between 0|0|0 and CoG is
				// F = |cog x thrust| / |cog| => moment around cog is this force times length of cog vector
				// M = F * |cog| => M = |cog x thrust| / |cog| * |cog| => M = |cog x thrust|
				// Given a counter moment supported by 2 forces counter-acting with a distance of 1 from CoG each, just divide this by 2 to get the compensate force
				VECTOR3 compensate = crossp(cog, c);
				normalise(compensate);
				compensate *= lc / 2;

				// Calculation of the position of the 2 forces:
				// get the direction vector from the line between 0|0|0 and CoG
				VECTOR3 offset = cog;
				normalise(offset);

				// Add the compensation forces for this time step:
				// negative force 1 unit "outside" of the CoG line around CoG
				// positive force 1 unit "inside" of the CoG line around CoG
				AddForce(-compensate, cog + offset);
				AddForce(compensate, cog - offset);
			}
		}
	}
}


Code:
void ENDURANCE::clbkPostStep(double simt, double simdt, double mjd)
{
	//---------------------------------------------------------------------------
	// ProcessUniversalMMu
	// Here the routine that detect if someone entered the ship (eva or transfer)
	// No need to manage anything here all is automatic, crew is added to your ship, ship's weight is updated,
	// and UMmu vessel is automatically deleted from Orbiter. You may just look the return
	// code to see if someone entered and display wathewer message on panel or other.
	// notice it's FPS friendly, function process only 4 time per second not each frame 
	// and return immediately if airlock closed or no Ummu is detected in vincinity. 
	int ReturnCode = Crew.ProcessUniversalMMu();
	switch (ReturnCode)
	{
	case UMMU_TRANSFERED_TO_OUR_SHIP:
		SendHudMessage("%s \"%s\" aged %i was transfered to our ship",
			Crew.GetCrewMiscIdByName(Crew.GetLastEnteredCrewName()), Crew.GetLastEnteredCrewName()
			, Crew.GetCrewAgeByName(Crew.GetLastEnteredCrewName()));
		break;
	case UMMU_RETURNED_TO_OUR_SHIP:
		SendHudMessage("%s \"%s\" aged %i entered into our ship",
			Crew.GetCrewMiscIdByName(Crew.GetLastEnteredCrewName()),
			Crew.GetLastEnteredCrewName(), Crew.GetCrewAgeByName(Crew.GetLastEnteredCrewName()));

		break;
	}
	if ( GroundContact() )
	{
		// we check vertical speed
		//int I;
		VECTOR3 vHorizonAirspeedVector = { 0 };
		GetHorizonAirspeedVector(vHorizonAirspeedVector);
		double VertSpeed = vHorizonAirspeedVector.y;
		if (VertSpeed < -3)
		{
			// we touched ground with more than -3 m/s, sorry dude, time to kill you all :(
			//for(I=0;I<Crew.GetCrewTotalNumber();I++)
			//{
			//		Crew.SetCrewMemberPulseBySlotNumber(I,0);	// set cardiac pulse to zero
			//	}
			//	strcpy(SendHudMessage(),"Oooh no ! Crash - All crew aboard killed");
		}

		// TIPS: the vertical speed is often reset to zero when there is ground contact
		// this may bug somewhat the death of your crew.
		// to have an accurate VertSpeed at touchdown I recommand to record it at very END 
		// of timestep and use this "old" value. The next frame you'll have the vertspeed value 
		// of *last frame* just before the crash (GroundContact). This ensure an accurate 
		// verticalspeed value. (keep this value in your vessel class and don't forget to 
		// initialize it at zero in setclasscap)
	}

	//sprintf(oapiDebugString(),"anim %2.2f",GEAR_proc);

	//---------------------------------------------------------------------------
	// WarnUserUMMUNotInstalled - IMPORTANT helper
	// Put here this function and users will be automatically warned if they don't have
	// UMMU installed or if it's outdated. Warning text duration is 20 seconds and text is:
	// [AddonName] require "Universal MMU" ver 2.0 or higher. Download at www.orbiter.dansteph.com (message countdown in seconds)
	// an additonal "your version of UMMU is outdated" is displayed the last 5 seconds if they have version lower than 2.0
	Crew.WarnUserUMMUNotInstalled("ENDURANCE");

	// THIS IS FOR ADDING CREW SEE PDF doc "Allow user to add crew to your ship 
	// without scenery editor"
	AddUMmuToVessel();

	if (this->viewController->IsFocused())
		sprintf_s(oapiDebugString(), 255, "%s : %s", viewController->station()->name.c_str(), viewController->view()->name.c_str());

	for (int i = 1; i < 17; i++) {
		APbeacon[i].active = false;
	}
	for (int i = 1; i < 17; i++) {
		Cbeacon[i].active = false;
	}

	if (0 < PODSel && PODSel < 17) APbeacon[PODSel].active = true;//turns on selected bay

	if (PODSel == 1){
		SendHudMessage("Rack 1 Selected");
		if (CARGO1_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO1_status == RACK_RAISING) {
				if (CARGO1_proc > 0.0) CARGO1_proc = max(0.0, CARGO1_proc - da);
				else                CARGO1_status = RACK_UP;
			}
			else {
				if (CARGO1_proc < 1.0) CARGO1_proc = min(1.0, CARGO1_proc + da);
				else                CARGO1_status = RACK_DOWN;
			}
			if (CARGO1_status == RACK_UP)SendHudMessage("Rack 1 Extended");
			if (CARGO1_status == RACK_DOWN)SendHudMessage("Rack 1 Retracted");
		}
	
}
	Cbeacon[PODSel].active = true;
	CARGO1_pos.z = CARGO1_INT_POS - (CARGO1_proc * 5);
	SetAttachmentParams(CARGO1, CARGO1_pos, _V(0, 1, 0), _V(0, 0, -1));
	Cbeaconpos[1].x = CARGO1_pos.x;
	Cbeaconpos[1].y = CARGO1_pos.y;
	Cbeaconpos[1].z = CARGO1_pos.z;
	//cargo2
	if (PODSel == 2){
		SendHudMessage("Rack 2 Selected");
		if (CARGO2_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO2_status == RACK_RAISING) {
				if (CARGO2_proc > 0.0) CARGO2_proc = max(0.0, CARGO2_proc - da);
				else                CARGO2_status = RACK_UP;
			}
			else {
				if (CARGO2_proc < 1.0) CARGO2_proc = min(1.0, CARGO2_proc + da);
				else                CARGO2_status = RACK_DOWN;
			}
			if (CARGO2_status == RACK_UP)SendHudMessage("Rack 2 Extended");
			if (CARGO2_status == RACK_DOWN)SendHudMessage("Rack 2 Retracted");
		}

	}
	

	CARGO2_pos.z = CARGO2_INT_POS - (CARGO2_proc * 5);
	SetAttachmentParams(CARGO2, CARGO2_pos, _V(0, 1, 0), _V(0, 0, -1));
	Cbeaconpos[2].x = CARGO2_pos.x;
	Cbeaconpos[2].y = CARGO2_pos.y;
	Cbeaconpos[2].z = CARGO2_pos.z;
	//cargo3
	
	if (PODSel == 3){
		SendHudMessage("Rack 3 Selected");
		if (CARGO3_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO3_status == RACK_RAISING) {
				if (CARGO3_proc > 0.0) CARGO3_proc = max(0.0, CARGO3_proc - da);
				else                CARGO3_status = RACK_UP;
			}
			else {
				if (CARGO3_proc < 1.0) CARGO3_proc = min(1.0, CARGO3_proc + da);
				else                CARGO3_status = RACK_DOWN;
			}
			if (CARGO3_status == RACK_UP)SendHudMessage("Rack 3 Extended");
			if (CARGO3_status == RACK_DOWN)SendHudMessage("Rack 3 Retracted");
		}

	}
	CARGO3_pos.z = CARGO3_INT_POS - (CARGO3_proc * 5);
	SetAttachmentParams(CARGO3, CARGO3_pos, _V(-.866, -.5, 0), _V(0, 0, -1));
	Cbeaconpos[3].x = CARGO3_pos.x;
	Cbeaconpos[3].y = CARGO3_pos.y;
	Cbeaconpos[3].z = CARGO3_pos.z;
//	//cargo4
	if (PODSel == 4){
		SendHudMessage("Rack 4 Selected");
		if (CARGO4_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO4_status == RACK_RAISING) {
				if (CARGO4_proc > 0.0) CARGO4_proc = max(0.0, CARGO4_proc - da);
				else                CARGO4_status = RACK_UP;
			}
			else {
				if (CARGO4_proc < 1.0) CARGO4_proc = min(1.0, CARGO4_proc + da);
				else                CARGO4_status = RACK_DOWN;
			}
			if (CARGO4_status == RACK_UP)SendHudMessage("Rack 4 Extended");
			if (CARGO4_status == RACK_DOWN)SendHudMessage("Rack 4 Retracted");
		}

	}


	CARGO4_pos.z = CARGO4_INT_POS - (CARGO4_proc * 5);
	SetAttachmentParams(CARGO4, CARGO4_pos, _V(-.866, -.5, 0), _V(0, 0, -1));

	Cbeaconpos[4].x = CARGO4_pos.x;
	Cbeaconpos[4].y = CARGO4_pos.y;
	Cbeaconpos[4].z = CARGO4_pos.z;


	//cargo4
	if (PODSel == 5){
		SendHudMessage("Rack 5 Selected");
		if (CARGO5_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO5_status == RACK_RAISING) {
				if (CARGO5_proc > 0.0) CARGO5_proc = max(0.0, CARGO5_proc - da);
				else                CARGO5_status = RACK_UP;
			}
			else {
				if (CARGO5_proc < 1.0) CARGO5_proc = min(1.0, CARGO5_proc + da);
				else                CARGO5_status = RACK_DOWN;
			}
			if (CARGO5_status == RACK_UP)SendHudMessage("Rack 5 Extended");
			if (CARGO5_status == RACK_DOWN)SendHudMessage("Rack 5 Retracted");
		}

	}


	CARGO5_pos.z = CARGO5_INT_POS - (CARGO5_proc * 5);
	SetAttachmentParams(CARGO5, CARGO5_pos, _V(-1, 0, 0), _V(0, 0, -1));

	Cbeaconpos[5].x = CARGO5_pos.x;
	Cbeaconpos[5].y = CARGO5_pos.y;
	Cbeaconpos[5].z = CARGO5_pos.z;


	//cargo6

	if (PODSel == 6){
		SendHudMessage("Rack 6 Selected");
		if (CARGO6_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO6_status == RACK_RAISING) {
				if (CARGO6_proc > 0.0) CARGO6_proc = max(0.0, CARGO6_proc - da);
				else                CARGO6_status = RACK_UP;
			}
			else {
				if (CARGO6_proc < 1.0) CARGO6_proc = min(1.0, CARGO6_proc + da);
				else                CARGO6_status = RACK_DOWN;
			}
			if (CARGO6_status == RACK_UP)SendHudMessage("Rack 6 Extended");
			if (CARGO6_status == RACK_DOWN)SendHudMessage("Rack 6 Retracted");
		}

	}


	CARGO6_pos.z = CARGO6_INT_POS - (CARGO6_proc * 5);
	SetAttachmentParams(CARGO6, CARGO6_pos, _V(-1, 0, 0), _V(0, 0, -1));

	Cbeaconpos[6].x = CARGO6_pos.x;
	Cbeaconpos[6].y = CARGO6_pos.y;
	Cbeaconpos[6].z = CARGO6_pos.z;

	//cargo6

	if (PODSel == 7){
		SendHudMessage("Rack 7 Selected");
		if (CARGO7_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO7_status == RACK_RAISING) {
				if (CARGO7_proc > 0.0) CARGO7_proc = max(0.0, CARGO7_proc - da);
				else                CARGO7_status = RACK_UP;
			}
			else {
				if (CARGO7_proc < 1.0) CARGO7_proc = min(1.0, CARGO7_proc + da);
				else                CARGO7_status = RACK_DOWN;
			}
			if (CARGO7_status == RACK_UP)SendHudMessage("Rack 7 Extended");
			if (CARGO7_status == RACK_DOWN)SendHudMessage("Rack 7 Retracted");
		}

	}


	CARGO7_pos.z = CARGO7_INT_POS - (CARGO7_proc * 5);
	SetAttachmentParams(CARGO7, CARGO7_pos, _V(-.866, .5, 0), _V(0, 0, -1));

	Cbeaconpos[7].x = CARGO7_pos.x;
	Cbeaconpos[7].y = CARGO7_pos.y;
	Cbeaconpos[7].z = CARGO7_pos.z;

	//cargo8

	if (PODSel == 8){
		SendHudMessage("Rack 8 Selected");
		if (CARGO8_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO8_status == RACK_RAISING) {
				if (CARGO8_proc > 0.0) CARGO8_proc = max(0.0, CARGO8_proc - da);
				else                CARGO8_status = RACK_UP;
			}
			else {
				if (CARGO8_proc < 1.0) CARGO8_proc = min(1.0, CARGO8_proc + da);
				else                CARGO8_status = RACK_DOWN;
			}
			if (CARGO8_status == RACK_UP)SendHudMessage("Rack 8 Extended");
			if (CARGO8_status == RACK_DOWN)SendHudMessage("Rack 8 Retracted");
		}

	}


	CARGO8_pos.z = CARGO8_INT_POS - (CARGO8_proc * 5);
	SetAttachmentParams(CARGO8, CARGO8_pos, _V(-.866, .5, 0), _V(0, 0, -1));

	Cbeaconpos[8].x = CARGO8_pos.x;
	Cbeaconpos[8].y = CARGO8_pos.y;
	Cbeaconpos[8].z = CARGO8_pos.z;


	//cargo9

	if (PODSel == 9){
		SendHudMessage("Rack 9 Selected");
		if (CARGO9_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO9_status == RACK_RAISING) {
				if (CARGO9_proc > 0.0) CARGO9_proc = max(0.0, CARGO9_proc - da);
				else                CARGO9_status = RACK_UP;
			}
			else {
				if (CARGO9_proc < 1.0) CARGO9_proc = min(1.0, CARGO9_proc + da);
				else                CARGO9_status = RACK_DOWN;
			}
			if (CARGO9_status == RACK_UP)SendHudMessage("Rack 9 Extended");
			if (CARGO9_status == RACK_DOWN)SendHudMessage("Rack 9 Retracted");
		}

	}


	CARGO9_pos.z = CARGO9_INT_POS - (CARGO9_proc * 5);
	SetAttachmentParams(CARGO9, CARGO9_pos, _V(0, 1, 0), _V(0, 0, -1));

	Cbeaconpos[9].x = CARGO9_pos.x;
	Cbeaconpos[9].y = CARGO9_pos.y;
	Cbeaconpos[9].z = CARGO9_pos.z;

	//cargo10

	if (PODSel == 10){
		SendHudMessage("Rack 10 Selected");
		if (CARGO10_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO10_status == RACK_RAISING) {
				if (CARGO10_proc > 0.0) CARGO10_proc = max(0.0, CARGO10_proc - da);
				else                CARGO10_status = RACK_UP;
			}
			else {
				if (CARGO10_proc < 1.0) CARGO10_proc = min(1.0, CARGO10_proc + da);
				else                CARGO10_status = RACK_DOWN;
			}
			if (CARGO10_status == RACK_UP)SendHudMessage("Rack 10 Extended");
			if (CARGO10_status == RACK_DOWN)SendHudMessage("Rack 10 Retracted");
		}

	}


	CARGO10_pos.z = CARGO10_INT_POS - (CARGO10_proc * 5);
	SetAttachmentParams(CARGO10, CARGO10_pos, _V(0, 1, 0), _V(0, 0, -1));

	Cbeaconpos[10].x = CARGO10_pos.x;
	Cbeaconpos[10].y = CARGO10_pos.y;
	Cbeaconpos[10].z = CARGO10_pos.z;


	//cargo11

	if (PODSel == 11){
		SendHudMessage("Rack 11 Selected");
		if (CARGO11_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO11_status == RACK_RAISING) {
				if (CARGO11_proc > 0.0) CARGO11_proc = max(0.0, CARGO11_proc - da);
				else                CARGO11_status = RACK_UP;
			}
			else {
				if (CARGO11_proc < 1.0) CARGO11_proc = min(1.0, CARGO11_proc + da);
				else                CARGO11_status = RACK_DOWN;
			}
			if (CARGO11_status == RACK_UP)SendHudMessage("Rack 11 Extended");
			if (CARGO11_status == RACK_DOWN)SendHudMessage("Rack 11 Retracted");
		}

	}


	CARGO11_pos.z = CARGO11_INT_POS - (CARGO11_proc * 5);
	SetAttachmentParams(CARGO11, CARGO11_pos, _V(.866, .5, 0), _V(0, 0, -1));

	Cbeaconpos[11].x = CARGO11_pos.x;
	Cbeaconpos[11].y = CARGO11_pos.y;
	Cbeaconpos[11].z = CARGO11_pos.z;


	//cargo12

	if (PODSel == 12){
		SendHudMessage("Rack 12 Selected");
		if (CARGO12_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO12_status == RACK_RAISING) {
				if (CARGO12_proc > 0.0) CARGO12_proc = max(0.0, CARGO12_proc - da);
				else                CARGO12_status = RACK_UP;
			}
			else {
				if (CARGO12_proc < 1.0) CARGO12_proc = min(1.0, CARGO12_proc + da);
				else                CARGO12_status = RACK_DOWN;
			}
			if (CARGO12_status == RACK_UP)SendHudMessage("Rack 12 Extended");
			if (CARGO12_status == RACK_DOWN)SendHudMessage("Rack 12 Retracted");
		}

	}


	CARGO12_pos.z = CARGO12_INT_POS - (CARGO12_proc * 5);
	SetAttachmentParams(CARGO12, CARGO12_pos, _V(.866, .5, 0), _V(0, 0, -1));

	Cbeaconpos[12].x = CARGO12_pos.x;
	Cbeaconpos[12].y = CARGO12_pos.y;
	Cbeaconpos[12].z = CARGO12_pos.z;

	//cargo13

	if (PODSel == 13){
		SendHudMessage("Rack 13 Selected");
		if (CARGO13_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO13_status == RACK_RAISING) {
				if (CARGO13_proc > 0.0) CARGO13_proc = max(0.0, CARGO13_proc - da);
				else                CARGO13_status = RACK_UP;
			}
			else {
				if (CARGO13_proc < 1.0) CARGO13_proc = min(1.0, CARGO13_proc + da);
				else                CARGO13_status = RACK_DOWN;
			}
			if (CARGO13_status == RACK_UP)SendHudMessage("Rack 13 Extended");
			if (CARGO13_status == RACK_DOWN)SendHudMessage("Rack 13 Retracted");
		}

	}


	CARGO13_pos.z = CARGO13_INT_POS - (CARGO13_proc * 5);
	SetAttachmentParams(CARGO13, CARGO13_pos, _V(1, 0, 0), _V(0, 0, -1));

	Cbeaconpos[13].x = CARGO13_pos.x;
	Cbeaconpos[13].y = CARGO13_pos.y;
	Cbeaconpos[13].z = CARGO13_pos.z;

	//cargo14

	if (PODSel == 14){
		SendHudMessage("Rack 14 Selected");
		if (CARGO14_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO14_status == RACK_RAISING) {
				if (CARGO14_proc > 0.0) CARGO14_proc = max(0.0, CARGO14_proc - da);
				else                CARGO14_status = RACK_UP;
			}
			else {
				if (CARGO14_proc < 1.0) CARGO14_proc = min(1.0, CARGO14_proc + da);
				else                CARGO14_status = RACK_DOWN;
			}
			if (CARGO14_status == RACK_UP)SendHudMessage("Rack 14 Extended");
			if (CARGO14_status == RACK_DOWN)SendHudMessage("Rack 14 Retracted");
		}

	}


	CARGO14_pos.z = CARGO14_INT_POS - (CARGO14_proc * 5);
	SetAttachmentParams(CARGO14, CARGO14_pos, _V(1, 0, 0), _V(0, 0, -1));

	Cbeaconpos[14].x = CARGO14_pos.x;
	Cbeaconpos[14].y = CARGO14_pos.y;
	Cbeaconpos[14].z = CARGO14_pos.z;


	//cargo15

	if (PODSel == 15){
		SendHudMessage("Rack 15 Selected");
		if (CARGO15_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO15_status == RACK_RAISING) {
				if (CARGO15_proc > 0.0) CARGO15_proc = max(0.0, CARGO15_proc - da);
				else                CARGO15_status = RACK_UP;
			}
			else {
				if (CARGO15_proc < 1.0) CARGO15_proc = min(1.0, CARGO15_proc + da);
				else                CARGO15_status = RACK_DOWN;
			}
			if (CARGO15_status == RACK_UP)SendHudMessage("Rack 15 Extended");
			if (CARGO15_status == RACK_DOWN)SendHudMessage("Rack 15 Retracted");
		}

	}


	CARGO15_pos.z = CARGO15_INT_POS - (CARGO15_proc * 5);
	SetAttachmentParams(CARGO15, CARGO15_pos, _V(.866, -.5, 0), _V(0, 0, -1));

	Cbeaconpos[15].x = CARGO15_pos.x;
	Cbeaconpos[15].y = CARGO15_pos.y;
	Cbeaconpos[15].z = CARGO15_pos.z;

	//cargo6

	if (PODSel == 16){
		SendHudMessage("Rack 16 Selected");
		if (CARGO16_status >= RACK_RAISING) {

			double da = simdt * .1;
			if (CARGO16_status == RACK_RAISING) {
				if (CARGO16_proc > 0.0) CARGO16_proc = max(0.0, CARGO16_proc - da);
				else                CARGO16_status = RACK_UP;
			}
			else {
				if (CARGO16_proc < 1.0) CARGO16_proc = min(1.0, CARGO16_proc + da);
				else                CARGO16_status = RACK_DOWN;
			}
			if (CARGO16_status == RACK_UP)SendHudMessage("Rack 16 Extended");
			if (CARGO16_status == RACK_DOWN)SendHudMessage("Rack 16 Retracted");
		}

	}


	CARGO16_pos.z = CARGO16_INT_POS - (CARGO16_proc * 5);
	SetAttachmentParams(CARGO16, CARGO16_pos, _V(.866, -.5, 0), _V(0, 0, -1));

	Cbeaconpos[16].x = CARGO16_pos.x;
	Cbeaconpos[16].y = CARGO16_pos.y;
	Cbeaconpos[16].z = CARGO16_pos.z;






	


}
 
Last edited:

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,638
Reaction score
2,353
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
What does SendHudMessage(const char *) do?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,736
Reaction score
2,707
Points
203
Location
Dallas, TX
That function writes to the hud UMMU status,.... In the vc mode we were drawing that info on a laptop screen. But I took that out.

WE HAD THIS:

Code:
void ENDURANCE::SendHudMessage(char const * const msg, ...)
{
    va_list args;
	
	va_start(args, msg);
	vsprintf(cUmmuHudDisplay, msg, args);
	va_end(args);

	LAPTOPTerminalScreen->SetHeader(cUmmuHudDisplay);
	//HABLAPTOPTerminalScreen->SetHeader(cUmmuHudDisplay);

	UmmuHudDisplayTime = 10.0; // Seconds to keep the mesg on the HUD
}


---------- Post added at 05:46 AM ---------- Previous post was at 05:13 AM ----------

I went back to the "standard" way the hud messages were written. And no change in fps.
 
Last edited:

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,638
Reaction score
2,353
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Looks more like a SendHudMessage(const char *, ...).

You are right, I had only seen the simple version there.
 
Top