Project Shuttle PB Mk2 developpement thread

SolarLiner

It's necessary, TARS.
Addon Developer
Joined
Jun 14, 2010
Messages
1,847
Reaction score
2
Points
0
Location
404 ROAD NOT FOUND
Hi, welcome to my first add-on development thread ! :hello:
aopasses.png


Here is my Shuttle PB Mk2 Developpement thread, about a new version of my Shuttle PB Mk2 Spacecraft 3 vessel.Here is a non-exhaustive TODO list:
  • Custom UMmu adding in the vessel
  • Dynamic Airlocks: When landed, the airlock shape is as a different place than while in flight.
  • Action Areas repairs: If you land too hard, you should need to go out and repair the Hovers.
  • Hard-landing (more than 15 m/s) kills the crew.
  • Redo the animation code
  • Depressurisation system
  • 2D Panel
  • New 2048 textures, including normal maps for external graphics clients
  • Environnement Map ready (for D3D9)

You can download the semi-stable 1.02 beta : https://sourceforge.net/projects/shuttlepbmk2/files/latest/download

The Blog: http://www.orbiter-forum.com/blog.php?u=4605

Using SVN, export this link to have the lastest alpha version of it : https://svn.code.sf.net/p/shuttlepbmk2/code/tags/releases/latest

See the code: https://sourceforge.net/projects/shuttlepbmk2/
 
Last edited:
Would need to know which library your linker failed to discover, stands a bit earlier in the log.
 
Here is the apprently problem:
Code:
1>ShuttlePBMk2.obj : error LNK2001: symbole externe non résolu "public: static double ShuttlePBMk2::lvl" (?lvl@ShuttlePBMk2@@2NA)
 
You haven't defined `double ShuttlePBMk2::lvl` static variable in your code.
 
You haven't defined `double ShuttlePBMk2::lvl` in your code.

Of course I have:
PHP:
PSTREAM_HANDLE pSmoke;
static double lvl;

But should I declare a simple "double lvl" variable ? I is used for my Particle Stream declared above.
 
Of course I have:
PHP:
PSTREAM_HANDLE pSmoke;
static double lvl;
Of course you haven't. That's declaration of `static double lvl` not definition of `double ShuttlePBMk2::lvl`.
 
Of course you haven't. That's declaration of `static double lvl` not definition of `double ShuttlePBMk2::lvl`.
I have declared all in my Header file (ShuttlePBMk2.h), inside the
"class ShuttlePBMk2:public VESSEL3 {
public:" part. It taht not equal to ShuttlePBMk2::lvl ?
 
yes - you need to define this static variable in a cpp file - outside the class definition.
 
Please put in your ShuttlePBMk2.cpp (on the global scope):
Code:
double ShuttlePBMk2::lvl;
 
Exactly. In the class { ... }, you only declare what an object of the class will be able to see and how it can be accessed. Outside the class declaration, you define them. In which code object and how should a static variable exist in memory? How should it be initialized on start up?
 
Please put in your ShuttlePBMk2.cpp (on the global scope):
Code:
double ShuttlePBMk2::lvl;
:cheers::tiphat::thumbup::bananadance:
Thanks orb ! Here is a screenshot of the actual state:
dev0001.jpg

dev0002.jpg
 
Last edited:
Now, the problem is just, that all of your vessels will share the same variable with the resulting terrible effects for the particle stream. ;)

You would better have it defined as object variable. ;)
 
OK, now, When I type "Q", tht "lvl" variable pass to 1.0, but the particle stream does not seems to emit something ...
Here is the part of the SetClassCaps containing the declarations:
PARTICLESTREAMSPEC smoke = {
0, 0.01, 100, 10.0, 0.01, 3, 10, 1.0, PARTICLESTREAMSPEC::EMISSIVE,
PARTICLESTREAMSPEC::LVL_PSQRT, 0, 2,
PARTICLESTREAMSPEC::ATM_PLIN, 1e-4, 1};
pSmoke = AddParticleStream (&smoke, _V(0.00317, -1.3027, -4.5340), _V(0, -1, 0), &lvl);
:help:
And thanks again !
 
Okay !
Update: I finally got all the things, and added some other features.
One of these is a integer identifying the ShPB, called "iRandomID". I give a value in the clbkSetClassCaps this way:
Code:
iRandomID = rand()
But (there is always a "but" :lol: ), iRandomID always takes the value 41.

Also, I want to put this value into a scn file, but after having a look on what's already there, it looked weird:
Code:
[COLOR="Blue"]for[/COLOR](i=0;i<ANIM_COUNT;i++){
	sprintf(cbuf,[COLOR="Red"]"%d %0.4f"[/COLOR],ani[i].status,ani[i].proc);
	sprintf(nbuf,[COLOR="red"]"ANIM_%d"[/COLOR],i);
	oapiWriteScenario_string(scn,nbuf,cbuf);
}[COLOR="Green"]// Huh? I'm used of .NET code style ...[/COLOR]

Finally, I've decided to put the code in a repository, so if you want to have a look, here it is: https://code.google.com/p/shuttlepb-mk2/source/browse/?name=101
 
Code:
iRandomID = rand()
But (there is always a "but" :lol: ), iRandomID always takes the value 41.
Try to initialize the pseudo-random number generator with `srand` first, with giving for example current time (with milliseconds precision).
 
But (there is always a "but" :lol: ), iRandomID always takes the value 41.
If I understand your "but" correct, the reason for rand() always returning the same number is, that you didn't seed it with a preudo-random seed before.
Use srand() to seed the random number generator.
Code:
srand ( time(NULL) );
Further details on srand() and rand() here:
http://www.cplusplus.com/reference/clibrary/cstdlib/srand/
http://www.cplusplus.com/reference/clibrary/cstdlib/rand/

/Kuddel
 
Okay, thanks orb and kuddel, it works now.
What works too, is the saving of the RID in the scenario:
Code:
(...)
  [COLOR="Red"]THLEVEL[/COLOR] 0:1.000000
  [COLOR="red"]NAVFREQ [/COLOR]0 0 0 0
  [COLOR="red"]XPDR[/COLOR] 0
  [COLOR="red"]RID[/COLOR] 12317
(...)

But now what blocks me is the LoadStateEx:
Code:
sscanf(line+5,"%d",&i);
[COLOR="Blue"]if[/COLOR]((i>=0)&&(i<ANIM_COUNT)){
	n=0;
	[COLOR="blue"]if[/COLOR](i>=10)n=1;
	[COLOR="blue"]if[/COLOR](i>=100)n=2;
	[COLOR="blue"]if[/COLOR](i>=1000)n=3;
	sscanf(line+6+n,[COLOR="DarkRed"]"%d"[/COLOR],&ani[i].status);
	sscanf(line+6+n+3,[COLOR="DarkRed"]"%lf"[/COLOR],&ani[i].proc);
	SetAnimation(ani[i].id,ani[i].proc);
}[COLOR="Green"]// This looks weirder than the SaveState ... Help ![/COLOR]
EDIT: Okay, I found "opaiReadItem_int" ... But, now when I load a scenario, the vessel is at 0E, 0N without any propellant resources ...
The code is updated, if you want to have a look ...
 
Last edited:
Anyone ? Doh ... I'll pass this save/load func, not very important ...
Next step: UCGO !
 
Back
Top