Game Development Community

Breaking Max Damage out of the shapebase datablock

by Vince Gee · 02/03/2006 (8:37 pm) · 2 comments

Hey all,

I haven't figured out yet how to add a resource... I swear they took it away.. but anyhow, for anyone interested in how to remove max damage and max energy out of the datablock for 1.4 this is it.

Special thanks to Dreamer for the 1.3 changes :)



go to ShapeBase.h and add around line 541 which should be

public:
put after it:
void ShapeBase::setMaxDamage(F32 maxdamage);
		F32 ShapeBase::getMaxDamage();
		void ShapeBase::setMaxEnergy(F32 maxEnergy);
		F32 ShapeBase::getMaxEnergy();
		F32 mMaxDamage;
		F32 mMaxEnergy;

Then open ShapeBase.cc and add tot he end
void ShapeBase::setMaxDamage(F32 maxdamage){
	mMaxDamage = maxdamage;
	updateDamageLevel();
	}

F32 ShapeBase::getMaxDamage(){
	return(mMaxDamage);
	}

void ShapeBase::setMaxEnergy(F32 maxEnergy){
	mMaxEnergy = maxEnergy;
	//updateDamageLevel();
	}

F32 ShapeBase::getMaxEnergy(){
	return(mMaxEnergy);
	}

ConsoleMethod( ShapeBase, setMaxDamage, void, 3, 3, "(F32 Max Damage)")
	{
	object->setMaxDamage(dAtof(argv[2]));
	}

ConsoleMethod(ShapeBase, getMaxDamage, F32,2,2,"(no params returns F32)"){
	return object->getMaxDamage();
	}

ConsoleMethod( ShapeBase, setMaxEnergy, void, 3, 3, "(F32 MaxEnergy)")
	{
	object->setMaxEnergy(dAtof(argv[2]));
	}

ConsoleMethod(ShapeBase, getMaxEnergy, F32,2,2,"(no params returns F32)"){
	return object->getMaxEnergy();
	}

then go to around line 606 where it says


ShapeBase::ShapeBase()
	{
	mTypeMask |= ShapeBaseObjectType;
add right after it
mMaxDamage = 100; //<--- Add this initialization
	mMaxEnergy = 100;//<-- Add this initialization

Then if your using visual studio, do a global find and replace on mDatablock->maxDamage with mMaxDamage and mDatablock->maxEnergy with mMaxEnergy.

and she will compile and run ok on 1.4, btw, if you don't call the function to set max damage, the default max damage becomes 100... or whatever you set it to in the constructor... guess you could over ride them in the init persists..

Vince

#1
02/03/2006 (9:00 pm)
Right at the bottom of this post is one way to submit a resource. The link that says GO Submit your own resources!
#2
02/03/2006 (10:45 pm)
LOL! uh Vince I don't think you're supposed to be posting source code in the open forums.