Project Explorer (Babylon 5) Deep Space Vessel

Status
Not open for further replies.
Well, in a frustrating turn of events, the T42 that I have been using to develop this project is on the verge of giving up the ghost. The wireless radio decided to fail as well over the weekend. Luckily the hard drive is still intact and she still boots. I will need to spend the next day or so getting the files off this machine and onto another. I still plan to get the animations done this week prior to my travel next week, but the release may need to be pushed a bit. I would rather not rush it out the door with minimal testing just for the sake of saving time.

---------- Post added at 01:45 PM ---------- Previous post was at 08:15 AM ----------

Ok, I have to admit, my limited C++ skill is finally stopping me in my tracks. I'm having trouble wrapping my head around the rest of the code needed for animation.

I still have only this part finished.
Code:
static UINT groups[2] = {34, 35};
    static MGROUP_ROTATE gravwheel (0,groups, 2,_V(0,-20,0),_V(0,0,1),(float)(360*RAD));
    anim_grav = CreateAnimation(0.0);
    AddAnimationComponent (anim_grav, 0, 1, &gravwheel);


Here is my constructor:
Code:
//constructor
Explorer::Explorer(OBJHANDLE hVessel, int flightmodel)
    :VESSEL3(hVessel, flightmodel)
{
    gravwheel_status = WHEEL_STOPPED;
    gravwheel_proc = 0.0;
    DefineAnimations();
}

I also have the following variables defined:
Code:
enum gravwheel_status {WHEEL_STOPPED, WHEEL_STARTED};

double gravwheel_proc;

UINT anim_grav;

I just need a good example of the animation code needed in order to get this down (not wanting it all written for me, just something clear to go by) . I've looked at the Deltaglider sample project code, but I'm just having trouble "getting it." Maybe it's because I'm a little under the weather & can't focus as well as normally, but I'm stumped. Any advice?

Thanks,
n122vu
 
I just need a good example of the animation code needed in order to get this down (not wanting it all written for me, just something clear to go by) .

I could look into my source folder if there is anything simple around there. But I only remember the ASAT code now... it was similar to your code since it had the spinning MKV implemented as normal vessel with rotating mesh, making guidance simpler than by using a rotating vessel.
 
Make sure you have spacecraft3 installed along with the 2006P1 patch. Then just change the ship definition in the scenario from agamemnon:Spacecraft\Spacecraft to agamemnon:Spacecraft\Spacecraft3 and Bob's your uncle.
Oh I say, that worked splendidly! Thanks ol' chap! :tiphat:
 
Finally feeling better. Been fighting a nasty cold all week. Was able to get some more of the animation code written last night. Hope to have it finished in the next night or two to upload for testing, for those that are interested.

Still chasing the disappearing mesh bug. Haven't been able to consistently reproduce it. Any thoughts welcome.

Regards,
n122vu
 
**Update** Back from my business travel. Between getting caught up from work, and things going on at home, hope to have some time soon to get back at this, but it may be a while. If anyone is interested in helping, I can pass you the C++ code if you want to have a look.

Regards,
n122vu
 
**Update** Back from my business travel. Between getting caught up from work, and things going on at home, hope to have some time soon to get back at this, but it may be a while. If anyone is interested in helping, I can pass you the C++ code if you want to have a look.

What about uploading it on lets say, github and turn it into a Babylon 5 add-on project?

https://github.com/
http://git-scm.com/
 
Last edited:
Could i have a pic of it maybe?
 
Apologies for the delay in updates on the status of Explorer. I've created the project at sourceforge.net. When i get home this evening I'll work on getting the code into the Subversion repository there. If you are interested in helping with the project, let me know. You'll need to sign up at sourceforge if you haven't already done so, then get me your SF userid so I can give you write access to the project.

Please bear with me on getting things set up over there as this is my first collaborative effort and I'm basically working on this in what little spare time I do have these days.

Thanks,
n122vu

**EDIT** @ Axel - A good shot of her here with Babylon 5 Station, courtesy JonnyBGoode: http://www.orbiter-forum.com/showpost.php?p=217032&postcount=1631
 
Last edited:
Finally taking another crack at the grav wheel animation code on this boat. I'm still lost. Trying to set the following:
Code:
gravwheel_status = WHEEL_STOPPED;
in the constructor. IntelliSense is crying that it expected an identifier.

I have the following declared earlier:
Code:
enum gravwheel_status {WHEEL_STOPPED, WHEEL_SPINNING} ;

Any ideas what I'm missing?

Thanks,
n122vu
 
Finally taking another crack at the grav wheel animation code on this boat. I'm still lost. Trying to set the following:
Code:
gravwheel_status = WHEEL_STOPPED;
in the constructor. IntelliSense is crying that it expected an identifier.

I have the following declared earlier:
Code:
enum gravwheel_status {WHEEL_STOPPED, WHEEL_SPINNING} ;
Any ideas what I'm missing?

Thanks,
n122vu

Its a syntax issue.

You have essentially defined now a datatype gravwheel_status. The variable name would go between the "}" and the ";".

By your definition of gravwheel_status, the line in the constructor is interpreted as half-finished local variable definition.

Note that C++ acts a bit different as C in that context, many statements that required "typedef" in C, had been made redundant in C++.
 
Thanks. That was driving me batty. Changed to

Code:
enum Wheel_Status {WHEEL_STOPPED, WHEEL_SPINNING} gravwheel_status;

...

gravwheel_status = WHEEL_STOPPED;

**EDIT**
Gravity Wheel animation has now been implemented. Press K to activate/deactivate the grav wheel, same as in the SC3 version.

Additionally, I believe I may have solved the invisible mesh bug. I have attached the latest build to this post. Those interested may test this version and continue to post any comments/issues to this thread. If no major issues are discovered, development focus will turn to remaining items on the features list. I have decided not to upload to OH until the remaining features have been implemented.

Still to do:
UCGO Support
UMMu 2.0 Support
Add mesh and textures to rear of hangar bays
 

Attachments

Last edited:
Ok, working on adding UMMu first. Have all the code in place but getting the following gripe from Intellisense:
Code:
	1	IntelliSense: argument of type "char *" is incompatible with parameter of type "LPCWSTR"

It's referring to the clbckDrawHUD, below, specifically pointing to cUmmuHudDisplay
Code:
void Explorer::clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, HDC hDC)
{
	// draw the default HUD
	VESSEL2::clbkDrawHUD (mode, hps, hDC);
	// UMmu display messages
	if(dHudMessageDelay>0)
	{
		TextOut (hDC,5,hps->H/60*15,cUmmuHudDisplay,strlen(cUmmuHudDisplay));
		dHudMessageDelay-=oapiGetSimStep();
		if(dHudMessageDelay<0)
		dHudMessageDelay=0;
	}
}
This is the code copied and pasted from the Ummu SDK doc. Any thoughts what would cause the incompatibility mentioned?

Thanks,
n122vu
 
Your project has Unicode selected as default, you should use Multibyte. That is why it expects all system calls to be based on wchar_t instead of char.
 
Your project has Unicode selected as default, you should use Multibyte. That is why it expects all system calls to be based on wchar_t instead of char.

That did it. Thanks.

I'm able to compile now, but I don't see any of the UMMu-related HUD messages, and I am now unable to switch the HUD using the H key.

I am able to pull up the dialog to add new UMMu members, but no other functions are available.

---------- Post added at 12:30 PM ---------- Previous post was at 11:49 AM ----------

Time acceleration keys also do not function while the Explorer is the focused vessel. Pressing F pulls up the framerate, but I am still unable to change hud using H, and no other UMMu functions seem to be working. Thinking either something wrong in clbkConsumeBufferedKey and/or clbkDrawHud. Still digging.
 
Do you call the default handler for the HUD painting in your DrawHUD function?
 
Do you call the default handler for the HUD painting in your DrawHUD function?
Yes. Here's the code for the callback:
Code:
void Explorer::clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, HDC hDC)
{
	// draw the default HUD
	VESSEL2::clbkDrawHUD (mode, hps, hDC);
		// UMmu display messages
		if(dHudMessageDelay>0)
		{
			TextOut (hDC,5,hps->H/60*15,cUmmuHudDisplay,strlen(cUmmuHudDisplay));
			dHudMessageDelay-=oapiGetSimStep();
			if(dHudMessageDelay<0)
			dHudMessageDelay=0;
		}
}

The HUD does display in the Explorer on scenario load, but I am unable to change it using H, deactivate it using CTRL-H, or use time accel function. I can activate gravwheel animation using K, and display framerate using F, as well as add UMMu using M.
 
Then do you maybe give back the wrong return value in clbkConsumeBufferedKey?
 
Possible. However all was working fine until I pasted in the code from the clbkConsumeBufferKey from the UMMU SDK. Going to comment out that code and try again.

---------- Post added at 01:38 PM ---------- Previous post was at 01:14 PM ----------

No luck with commenting out the UMMU-related code in clbckConsumeBufferedKey. Still no hud control with H key. Here is the entire callback:
Code:
int Explorer::clbkConsumeBufferedKey (DWORD key, bool down, char *kstate)
{
	if (!down) return 0; // only process keydown events	

	if(key==OAPI_KEY_M&&!KEYMOD_SHIFT(kstate)&&!KEYMOD_CONTROL (kstate))
		{
			AddUMmuToVessel(TRUE);
		}

	
	
		// Ummu Key "E" perform the EVA of the selected member
		//
		if(key==OAPI_KEY_E&&!KEYMOD_SHIFT(kstate)&&!KEYMOD_CONTROL (kstate))
		{
			// PERFORM THE EVA
			int Returned=Crew.EvaCrewMember(Crew.GetCrewNameBySlotNumber(iSelectedUmmuMember));
			// we provide feedback to user (You can display a message on panel or wathewer)
			// here below all the return code possible:
			switch(Returned)
			{
			case TRANSFER_TO_DOCKED_SHIP_OK:
				sprintf(SendHudMessage(),"Transfer to docked ship Ok - %s transfered",
				Crew.GetLastEvaedCrewName());iSelectedUmmuMember=0;
			break;
			case EVA_OK:
				sprintf(SendHudMessage(),"EVA OK - %s left the ship",
				Crew.GetLastEvaedCrewName());iSelectedUmmuMember=0;
			break;
			case ERROR_NO_ONE_ON_BOARD:
				strcpy(SendHudMessage(),"Error, no one on board, unable to EVA");
			break;
			case ERROR_AIRLOCK_CLOSED:
				strcpy(SendHudMessage(),"Error, airlock is closed, unable to EVA");
			break;
			case ERROR_DOCKED_SHIP_HAVE_AIRLOCK_CLOSED:
				strcpy(SendHudMessage(),"Error, docked ship's airlock is closed, unable to transfer");
			break;
			case ERROR_DOCKED_SHIP_IS_FULL:
				strcpy(SendHudMessage(),"Error, docked ship is already full transfer failed");
			break;
			case ERROR_CREW_MEMBER_NOT_FOUND:
				strcpy(SendHudMessage(),"Error, no crew by this name in ship");
			break;
			case ERROR_DOCKEDSHIP_DONOT_USE_UMMU:
				strcpy(SendHudMessage(),"Error, docked ship do not use UMmu 2.0, ask author to add it");
			break;
			case ERROR_MISC_ERROR_EVAFAILED:
				strcpy(SendHudMessage(),"Misc error with UMMU install it again");
			break;
			}	
		return TRUE;
		}
		//---------------------------------------------------------------------------
		// Ummu	Key "1" Select next member This is just internal to the demo
		// you may do your own selection system by panel button, name etc etc
		if(key==OAPI_KEY_1&&!KEYMOD_SHIFT(kstate)&&!KEYMOD_CONTROL (kstate))
		{
		// we test there is someone aboard
			if(Crew.GetCrewTotalNumber()==0)
			{
				strcpy(SendHudMessage(),"Sorry no one aboard unable to select");
				return 1;
			}
		// we test that we select existing member
		if(iSelectedUmmuMember<Crew.GetCrewTotalNumber()-1)
			iSelectedUmmuMember++;
			char * Name=Crew.GetCrewNameBySlotNumber(iSelectedUmmuMember);
			sprintf(SendHudMessage(),"Slot %i %s \"%s\" aged %i Selected for EVA or Transfer, please press \"E\" to EVA",
			iSelectedUmmuMember,Crew.GetCrewMiscIdBySlotNumber(iSelectedUmmuMember),
			Name,Crew.GetCrewAgeBySlotNumber(iSelectedUmmuMember));
			return 1;
		}
		//---------------------------------------------------------------------------
		// Ummu Key "2" Select previous member This is just internal to the demo
		// you may do your own selection system by panel button
		if(key==OAPI_KEY_2&&!KEYMOD_SHIFT(kstate)&&!KEYMOD_CONTROL (kstate))
		{
			// we test there is someone aboard
			if(Crew.GetCrewTotalNumber()==0)
			{
				strcpy(SendHudMessage(),"Sorry no one aboard unable to select");
				return 1;
			}
			if(iSelectedUmmuMember>0)
				iSelectedUmmuMember--;
				char * Name=Crew.GetCrewNameBySlotNumber(iSelectedUmmuMember);
				sprintf(SendHudMessage(),"Slot %i %s \"%s\" aged %i Selected for EVA or Transfer"
				", please press \"E\" to EVA",iSelectedUmmuMember,
				Crew.GetCrewMiscIdBySlotNumber(iSelectedUmmuMember),Name,
				Crew.GetCrewAgeBySlotNumber(iSelectedUmmuMember));
				return 1;
		}
		//---------------------------------------------------------------------------
		// Ummu Key "A" Switch the virtual UMMU airlock door on/off
		if(key==OAPI_KEY_A&&!KEYMOD_SHIFT(kstate)&&!KEYMOD_CONTROL (kstate))
		{
			// switch state
			Crew.SetAirlockDoorState(!Crew.GetAirlockDoorState());
			// display state
			if(Crew.GetAirlockDoorState()==TRUE)
				strcpy(SendHudMessage(),"Airlock is now open");
			else
				strcpy(SendHudMessage(),"Airlock is now closed");
			return 1;
		}
		//---------------------------------------------------------------------------
		// Get some infos Name of ship and total soul aboard
		if(key==OAPI_KEY_S)
		{		
			sprintf(SendHudMessage(),"%i souls aboard ship %s",
			Crew.GetCrewTotalNumber(),GetName());
			return 1;
		}  

	switch (key) {
	case OAPI_KEY_K: //Wheel
		if (gravwheel_run == 0) // check to see if wheel is stopped
		{
			gravwheel_run = 1; //set run variable to 1 if wheel is stopped
		
			return 1; 
		}
		if (gravwheel_run == 1) // check to see if wheel is running
		{
			gravwheel_run = 0;

			return 1; 
		}


	return 0;
}
}

Anything stand out?

---------- Post added at 03:13 PM ---------- Previous post was at 01:38 PM ----------

I changed it to a VESSEL2 class ship. All UMMU functions now work properly. However, time acceleration and HUD control via keyboard keys still do not work.

I had assumed these were standard Orbiter API functions. Do I need to now capture these keys in clbkConsumeBufferedKeys and code the changes in time and hud status myself?
 
Status
Not open for further replies.
Back
Top