S30s and Explosion Events, part 2.

S30s and Explosion Events, part 2.

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

S30s and Explosion Events, part 2.

Post by Argh »

From CobInstance.cpp:

#include "Rendering/UnitModels/3DOParser.h"

I don't see an #include for s3oparser.h. Odd.

Later on, I can see why S3Os don't explode. There isn't the equivalent code section to this:

Code: Select all

S3DO* dl = unit->localmodel->pieces[unit->localmodel->scritoa[piece]].original3do;
	if(dl){
		if (flags & 1) {		//Shatter
			ENTER_MIXED;
			float pieceChance=1-(ph->currentParticles-(ph->maxParticles-2000))/2000;
	//		info->AddLine("Shattering %i %f",dl->prims.size(),pieceChance);

			for(std::vector<S3DOPrimitive>::iterator pi=dl->prims.begin();pi!=dl->prims.end();++pi){
				if(gu->usRandFloat()>pieceChance || pi->numVertex!=4)
					continue;

				ph->AddFlyingPiece(pos,speed+gu->usRandVector()*2,dl,&*pi);
			}
			ENTER_SYNCED;
		}
		else {
			//info->AddLine("Exploding %s as %d", script.pieceNames[piece].c_str(), dl);
			new CPieceProjectile(pos, speed, dl, newflags,unit,0.5);
		}
	}
#endif
}
Sooo... is it just that simple, or is the s3oparser so very different that we can't just change 3DO to S3O, have the explosion handler filter whether the model is 3DO or S3O and then do the explosion?

Just curious... I want explosions for NanoBlobs, and I think that Spring may be hitting a lot've "I can't find what I'm looking for" errors whenever S3Os explode, based on what I'm seeing here- the explosion code really expects 3DOs, and doesn't mention S3O anywhere.

Now I just have to go find the code (or lack of code) to have the events called during Create() run before the unit is drawn for the first time.
SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ »

Yes S3Os look a bit different internally so a direct translation wouldnt work although it probably wouldnt take that long for someone interested to fix it for S3Os.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

If you do fix ti for s30's at the same time try adding an explosion event for the Ai interface, it'd come in very useful......
Post Reply

Return to “Engine”