To illustrate the massive difference in how I handle the assignment of effects to "House" objects (those contained in static.ini), I reproduce below the stock HouseExplode() method in Explosions.class, followed by my version. (You'll note the numerous comments I've peppered throughout, so that I can quickly catch up when revisiting at a later date.)
One notable thing I've done is to eliminate the consideration of a bounding box, as calculated from the object's mesh dimensions, to rescale certain effect particles, whiuch formerly resulted in the situation of a bunch of absurdly tiny fire or smoke particles for some exploding objects. And there's a LOT more variability and variety.
STOCK
public static void HouseExplode(int i, Loc loc, float af[])
{
if(!Config.isUSE_RENDER())
return;
String s = "";
byte byte0 = 0;
float f = 1.0F;
switch(i)
{
case 0: // '\0'
f = 0.75F;
// fall through
case 1: // '\001'
s = "Wood";
byte0 = 4;
break;
case 2: // '\002'
f = 0.75F;
// fall through
case 3: // '\003'
case 4: // '\004'
s = "Rock";
byte0 = 3;
break;
case 5: // '\005'
f = 0.75F;
// fall through
case 6: // '\006'
s = "Fuel";
byte0 = 5;
break;
default:
System.out.println("WARNING: HouseExplode(): unknown type");
return;
}
String s1 = "effects/Explodes/Objects/House/" + s + "/Boiling.eff";
String s2 = "effects/Explodes/Objects/House/" + s + "/Boiling2.eff";
String s3 = "effects/Explodes/Objects/House/" + s + "/Pieces.eff";
Eff3D.initSetBoundBox(af[0], af[1], af[2], af[3], af[4], af[5]);
Eff3DActor.New(loc, 1.0F, s1, 3F);
Eff3D.initSetBoundBox(af[0] + (af[3] - af[0]) * 0.25F, af[1] + (af[4] - af[1]) * 0.25F, af[2], af[3] - (af[3] - af[0]) * 0.25F, af[4] - (af[4] - af[1]) * 0.25F, af[2] + (af[5] - af[2]) * 0.5F);
Eff3DActor.New(loc, 1.0F, s3, 3F);
if(i != 0)
{
String s4 = "effects/Explodes/Objects/House/" + s + "/Fire_Smoke.eff";
RangeRandom rangerandom = World.rndPos(loc.getX(), loc.getY());
float f2 = rangerandom.nextFloat();
if((double)f2 > 0.5D)
{
float f3 = rangerandom.nextFloat(300F, 600F);
Eff3DActor.New(loc, f, s4, f3);
Eff3DActor.New(loc, f, s2, f3);
} else
{
Eff3DActor.New(loc, f, s4, 5F);
Eff3DActor.New(loc, f, s2, 5F);
}
} else
{
Eff3DActor.New(loc, f, s2, 3F);
}
SfxExplosion.building(loc.getPoint(), byte0, af);
}
MINE:
public static void HouseExplode(int i, Loc loc, float fs[]) //called in House.class; i = prop.EXPL_TYPE (was 0 to 6, then 0 to 7, now 0 to 8)
{
if (Config.isUSE_RENDER())
{
Point3d point3d = new Point3d();
Point3d point3d1 = loc.getPoint(); //New by WxTech
o.set(0.0F, 90.0F, 0.0F); //New by WxTech
l.set(point3d1, o); //New by WxTech
String string = "";
boolean bool = false; //becomes true if "FuelSmall" or "Fuel", i.e., the fuel type
boolean bool_2 = false; //becomes true if "WoodMiddle", "RockBig", "RockHuge" or "FuelBig", i.e., the larger sizes of all types
float f = 1.0F; //basic scale factor
scaleFire = MiscEffects.cvt(World.Sun().ToSun.z, -0.3F, -0.05F, 2.0F, 1.0F); //for other than Fuel
scaleFireFuel = MiscEffects.cvt(World.Sun().ToSun.z, -0.3F, -0.05F, 1.7F, 1.0F); //for FuelBig and FuelSmall; Not as aggressive
float scaleLight = MiscEffects.cvt(World.Sun().ToSun.z, -0.25F, 0.05F, 1.0F, 0.5F);
int i_18_; //related to explosion sound (SfxExplosion.building)
switch (i)
// Allowed body types are: WoodSmall, WoodMiddle, RockMiddle, RockBig, RockHuge, FuelSmall, FuelBig, Flesh, Vehicle
{
case 0: //WOOD_SMALL (and FLESH, originally)
if (TrueRandom.nextInt(0, 99) < 33) //1/3 will not generate effects
return;
if (TrueRandom.nextInt(0, 99) < 33)
string = "Flesh";
else
string = "WoodSmall";
i_18_ = 4;
break;
case 1: //WOOD_MIDDLE
if (TrueRandom.nextInt(0, 99) < 33)
string = "WoodSmall";
else
{
string = "Wood";
bool_2 = true; //is larger
}
i_18_ = 4;
break;
case 2: //ROCK_MIDDLE
if (TrueRandom.nextInt(0, 99) < 33) //1/3 will not generate effects
return;
if (TrueRandom.nextInt(0, 99) < 33)
string = "Wood";
else
string = "RockMiddle";
i_18_ = 3;
break;
case 3: //ROCK_BIG
if (TrueRandom.nextInt(0, 99) < 33)
string = "Wood";
else
string = "RockBig";
i_18_ = 3;
break;
case 4: //ROCK_HUGE
if (TrueRandom.nextInt(0, 99) < 33)
string = "RockBig";
else
{
string = "Rock";
bool_2 = true; //is larger
}
i_18_ = 3;
break;
case 5: //FUEL_SMALL
if (TrueRandom.nextInt(0, 99) < 33) //1/3 will not generate effects
return;
if (TrueRandom.nextInt(0, 99) < 33)
string = "Vehicle";
else
{
string = "FuelSmall";
bool = true;
}
i_18_ = 5;
break;
case 6: //FUEL_BIG
if (TrueRandom.nextInt(0, 99) < 33)
{
string = "FuelSmall";
bool = true; //is fuel
}
else
{
string = "Fuel";
bool = true; //is fuel
bool_2 = true; //is larger
}
i_18_ = 5;
break;
case 7: //FLESH -- NEW!!!
if (TrueRandom.nextInt(0, 99) < 66) //2/3 will not generate effects
return;
string = "Flesh";
i_18_ = 4;
break;
case 8: //VEHICLE -- NEW!!!
if (TrueRandom.nextInt(0, 99) < 33) //1/3 will not generate effects
return;
if (TrueRandom.nextInt(0, 99) < 33)
string = "Flesh";
else
string = "Vehicle";
i_18_ = 4; //had at 5 (like Fuel), but might cause to use FuelSmall effect!!! Therefore set to 4 like Flesh
break;
default:
System.out.println("WARNING: HouseExplode(): unknown type");
return;
}
// Eff3D.initSetBoundBox(fs[0], fs[1], fs[2], fs[3], fs[4], fs[5]); //this screws up the scaling of Boiling.eff !!!!!!! OMIT !!!!!!!
// Eff3D.initSetBoundBox(fs[0] + (fs[3] - fs[0]) * 0.25F, fs[1] + (fs[4] - fs[1]) * 0.25F, fs[2], fs[3] - (fs[3] - fs[0]) * 0.25F, fs[4] - (fs[4] - fs[1]) * 0.25F, fs[2] + (fs[5] - fs[2]) * 0.5F);
String string_19_ = "Effects/Explodes/Objects/House/" + string + "/Boiling.eff"; //exploded bits (flaming fuel drops for Fuel)
String string_20_ = "Effects/Explodes/Objects/House/" + string + "/Pieces.eff"; //ground-level blast smoke/dust
String string_21_ = "Effects/Explodes/Objects/House/" + string + "/Boiling2.eff"; //long-lasting fire
String string_22_ = "Effects/Explodes/Objects/House/" + string + "/Fire_Smoke_core.eff"; //NEW!!! core smoke for FUEL main smoke only (made invisible for FuelSmall)
String string_23_ = "Effects/Explodes/Objects/House/" + string + "/Fire_Smoke.eff"; //main long-lasting smoke
// Eff3DActor.New(l, f, string_19_, -1F); //Boiling.eff; exploded bits; keep unity scale for all; had 10, make -1?
Eff3DActor.New(l, f, string_20_, -1F); //Pieces.eff; ground-level blast smoke; keep unity scale for all; had 10 (longest LiveTime is 7s), make -1?
// if (i != 0) //if not WoodSmall (or Flesh, originally)
if (i != 0 && i != 7) //if not WoodSmall AND not Flesh -- NEW!!!!!!!
{
RangeRandom rangerandom = World.rndPos(l.getX(), l.getY());
if (bool_2) //if of the larger sizes
{
float f_25_ = rangerandom.nextFloat(450.0F, 600.0F); //originally 300 to 600 sec duration (5 to 10 min)
Eff3DActor.New(l, f, string_23_, f_25_); //Fire_Smoke.eff, 450-600 sec
if (bool) //if "Fuel" (big, in this case)
{
Eff3DActor.New(l, f, string_22_, f_25_); //Fire_Smoke_core.eff, 450-600 sec; NEWLY ADDED HERE!
Eff3DActor.New(l, f, string_19_, -1F); //flaming fuel drops
Eff3DActor eff3dactor = Eff3DActor.New(l, scaleFireFuel, string_21_, f_25_ * 0.85F); //Boiling2.eff; fire; 450-600 sec * 0.85
if (World.Sun().ToSun.z < 0.05F)
{
// float scaleLight_1 = MiscEffects.cvt(World.Sun().ToSun.z, -0.25F, 0.05F, 1.0F, 0.5F);
LightPointActor lightpointactor = new LightPointActor(new LightPointWorld(), new Point3d(0.0D, 0.0D, 5.0D));
lightpointactor.light.setColor(1.0F, 0.5F, 0.0F);
lightpointactor.light.setEmit(1.0F * scaleLight, 200F * scaleLight); //was 1, 150
eff3dactor.draw.lightMap().put("light", lightpointactor);
}
}else //if not "Fuel"
{
if (TrueRandom.nextInt(0, 99) < 70)
{
Eff3DActor.New(l, f, string_19_, -1F); //exploded bits
Eff3DActor eff3dactor = Eff3DActor.New(l, scaleFire, string_21_, f_25_ * 0.85F); //Boiling2.eff; fire
if (World.Sun().ToSun.z < 0.05F && TrueRandom.nextInt(0, 99) < 20) //NEW! add light source to bigger house object fire; potentially unwise, as can hit limits !
{
LightPointActor lightpointactor = new LightPointActor(new LightPointWorld(), new Point3d(0.0D, 0.0D, 5.0D));
lightpointactor.light.setColor(1.0F, 0.5F, 0.0F);
lightpointactor.light.setEmit(1.0F * scaleLight, 175F * scaleLight);
eff3dactor.draw.lightMap().put("light", lightpointactor);
}
}
}
} else //if of the small size
{
float f_251_ = rangerandom.nextFloat(280.0F, 450.0F); //originally 100 to 200 sec duration
Eff3DActor.New(l, f, string_23_, f_251_); //Fire_Smoke.eff, was 5 sec
if (bool) //if "Fuel" (small, in this case)
{
// Eff3DActor.New(l, f, string_22_, f_251_); //Fire_Smoke_core.eff; redundant, as effect made invisible for small fuel fire anyway
Eff3DActor.New(l, f, string_19_, -1F); //flaming fuel drops
Eff3DActor eff3dactor = Eff3DActor.New(l, scaleFireFuel, string_21_, f_251_ * 0.85F); //Boiling2.eff; fire; 280-450 sec * 0.85
if (World.Sun().ToSun.z < 0.05F)
{
// float scaleLight_2 = MiscEffects.cvt(World.Sun().ToSun.z, -0.25F, 0.05F, 1.0F, 0.5F);
LightPointActor lightpointactor = new LightPointActor(new LightPointWorld(), new Point3d(0.0D, 0.0D, 2.0D));
lightpointactor.light.setColor(1.0F, 0.5F, 0.0F);
lightpointactor.light.setEmit(1.0F * scaleLight, 100F * scaleLight);
eff3dactor.draw.lightMap().put("light", lightpointactor);
}
}else //if not "Fuel"
{
if (TrueRandom.nextInt(0, 99) < 70)
Eff3DActor.New(l, scaleFire, string_21_, f_251_ * 0.85F); //Boiling2.eff; fire; 70% chance
Eff3DActor.New(l, f, string_19_, -1F); //exploded bits; always
}
}
} else //if i = 0 or 7, i.e., WoodSmall or Flesh
{
RangeRandom rangerandom = World.rndPos(l.getX(), l.getY());
float f_252_ = rangerandom.nextFloat(180.0F, 360.0F); //3 - 6 min; originally 30 to 60 sec duration
if (i == 7) //if Flesh
{
f_252_ *= 0.33F; //make live time last 1/3 as long, or 1.5 - 3 min
if (TrueRandom.nextInt(0, 99) < 33) //make smoke effect occur in 1/3 of instances (in addition to the already 1/3 probability)
Eff3DActor.New(l, f, string_23_, f_252_); //Fire_Smoke.eff ONLY, no fire; added NEW
} else //if WoodSmall
{
if (TrueRandom.nextInt(0, 99) < 70)
{
Eff3DActor.New(l, f, string_23_, f_252_); //Fire_Smoke.eff; smoke; 70% chance
if (TrueRandom.nextInt(0, 99) < 70)
Eff3DActor.New(l, scaleFire, string_21_, f_252_ * 0.85F); //Boiling2.eff; fire; 50% chance; 180-360 sec * 0.85
}
Eff3DActor.New(l, f, string_19_, -1F); //exploded bits; always
}
}
SfxExplosion.building(loc.getPoint(), i_18_, fs);
}
}