Game Development Community

dev|Pro Game Development Curriculum

fxSquareFoliageReplicator

by Jon Jorajuria · 08/17/2006 (12:11 pm) · 7 comments

Download Code File

There are different ways to create square foliage replication and this resource could be combined with the current fxFoliageReplicator tool. Due to the interest of time we created a seperate fxSquareFoliageReplicator. This code enhancement created by Shawn Simas and myself, builds on the original foliage replication code developed by Melvyn May.

This enhancement allows the user to create a square area for foliage replication. It has been tested on both TGE 1.4 and TLK 1.4. Just add the fxSquareFoliageReplicator.cc and fxSquareFoliageReplicator.h files to your sdk/engine/game/fx directory and make the following changes:

In simBase.h under namespace sim, just below DeclareNamedSet(fxReplicatorSet) add:

DeclareNamedSet(fxSquareFoliageSet)

In simBase.cc under namespace sim, just below ImplementNamedSet(fxFoliageSet) add:

ImplementNamedSet(fxSquareFoliageSet)

In simManager.cc under function void init(), just below InstantiateNamedSet(fxFoliageSet); add:

InstantiateNamedSet(fxSquareFoliageSet);

In guiTreeViewCtrl.cc find
else if (!dStrcmp(iconString, "fxFoliageReplicator"))
      icon = fxFoliageReplicator;

and just below it add:

else if (!dStrcmp(iconString, "fxSquareFoliageReplicator"))
      icon = fxFoliageReplicator;

In guiTreeViewCtrl.h under enum Icons, just below fxFoliageReplicator, add:

fxSquareFoliageReplicator,

Compile and you are done with the source.

On to scripting:

Open example/creator/editor/objectBuilderGui.gui, below function ObjectBuilderGui::buildfxFoliageReplicator(%this) add:

function ObjectBuilderGui::buildfxSquareFoliageReplicator(%this)
{
	%this.className = "fxSquareFoliageReplicator";
	%this.process();
}

Open example/creator/editor/EditorGui.cs, below %Environment_Item[10] = "fxFoliageReplicator"; add:

%Environment_Item[11] = "fxSquareFoliageReplicator";
**note you will have to change the numerical order of the items.

Open example/common/client/missionDownload.cs, below StartFoliageReplication(); add:

StartSquareFoliageReplication();

Make sure to delete you *.dso files and then launch the game. You will now have a square foliage replicator.

#1
10/08/2006 (1:10 am)
awesome job! thanks! I see this appeared in the FPS Kit, works great for corn fields! :D
#2
10/31/2006 (10:05 pm)
Nice, very simple to implement went into TGA 1.5 only had to change
%Environment_Item[11] = "fxSquareFoliageReplicator";
to
%Environment_Item[16] = "fxSquareFoliageReplicator";
because of the lighting pack.
#3
10/26/2007 (5:07 am)
Anybody ported this to TGEA already?
#4
10/26/2007 (5:38 am)
newbie here, followed instructions above and tried to get this working in TGE 1.52

it shows on the menu and will ask for the object name and then nothing ... any ideas ?
#5
11/10/2007 (12:16 pm)
hello - anyone a little help here ?????
#6
12/07/2007 (4:38 am)
Hi Kevin,

Make sure that you add the fxSquareFoliageReplicator.cc & fxSquareFoliageReplicator.h files to your visual studio project under game/fx. Right click on fx and choose "add existing item"

Skitz
#7
12/10/2007 (2:09 pm)
thank you very much for responding, i wiped out torque and started over and FINALLY got it working - have no idea what it was but had to be me

thanks again for the direction

kevin