Added:
-dust particles and material fragment particles for walljump and hangling (in texture colour)
-3 sound effects: Crumble1.ogg, Crumble2.ogg and Crumble3.ogg
-existing sound effects Rustle?.ogg for both walljump and hangling
-existing sound effects StepHard?.ogg for walljump
Some materials are excluded from the particle creation, because it doesn't look good in my opinion. Those are: Gold, Firestone, Ruby, Amethyst, Granite, Ore, and for corner cases: Lava, DuroLava, Acid, Sky, Water.
What I'm unsure about is the implementation of that exclusion. This is what I came up with:
Feel free to optimize!
EDIT:
Old patch deleted, see this post for the updated file.
-dust particles and material fragment particles for walljump and hangling (in texture colour)
-3 sound effects: Crumble1.ogg, Crumble2.ogg and Crumble3.ogg
-existing sound effects Rustle?.ogg for both walljump and hangling
-existing sound effects StepHard?.ogg for walljump
Some materials are excluded from the particle creation, because it doesn't look good in my opinion. Those are: Gold, Firestone, Ruby, Amethyst, Granite, Ore, and for corner cases: Lava, DuroLava, Acid, Sky, Water.
What I'm unsure about is the implementation of that exclusion. This is what I came up with:
// certain materials won't crumble (because it doesn't look good), also rule out liquids and sky
var exception_mats = [Material("Gold"), Material("Amethyst"), Material("Ruby"), Material("Firestone"), Material("Ore"), Material("Granite"), Material("Water"), Material("Lava"), Material("DuroLava"), Material("Acid"), Material("Sky")];
var material = GetMaterial(get_tex_x, 9);
for(element in exception_mats)
if(element == material)
{ // they'll still do the sounds
Sound("StepHard?");
Sound("Rustle?");
return;
}
Feel free to optimize!
EDIT:
Old patch deleted, see this post for the updated file.
You can make the array a lot shorter by:
if (Material(element) == material)
>Feel free to optimize!
// do sounds...
// ...
if (GetMaterialVal("DigFree", "Material", material) != 0)
{
// do particles
}
Ok, I agree with you and Sven on the upwards compatibility, but I'd still need to add exceptions for Firestone (diggable but not wanted), Rock and Brick + BrickSoft:
Is this better?
// These two sounds are always played
Sound("StepHard?");
Sound("Rustle?");
// certain materials shouldn't crumble (because it doesn't look good)
var material = GetMaterial(get_tex_x, 9);
// firestone is an exception from the rule below
if(material == Material("Firestone"))
return;
// only diggable materials, except for Rock, Brick and BrickSoft
if ((GetMaterialVal("DigFree", "Material", material) != 1) && ((material != Material("Rock")) && (material != Material("Brick")) && (material != Material("BrickSoft"))))
return;
// particles ...
Is this better?
>Is this better?
I am still not too happy with the exceptions (see Sven), but in your example, I think it should be:
if (not diggable OR material == A OR material == B OR ...) return;
instead of AND
s.PS: also, Rock and Brick are not diggable, right?
No, his logic is correct.
He wants no particles if it's not diggable, except if it's rock or brick. Then he wants particles.
He wants no particles if it's not diggable, except if it's rock or brick. Then he wants particles.
I don't understand the pattern. Why wouldn't you want the effect on firestone? Why do you want it on brick and rock, but not on granite?
I'd also say that the dust effect should be played on all materials that have a dust effect when dug out or when rolled on or when walked over. So, basically all diggable materials.
It can't look that horrendous, can it? :)
It can't look that horrendous, can it? :)
The "pattern" is merely my subjective opinion on where the effect fits and where not. I think it looks good on brick and rock, while granite is much harder and therefore, no fragments will brake loose. (Although granite is arguably the least critical exception).
I will of course add the effect for firestone and granite if you all insist on it, but you should at least try out for yourselves how it looks.
I will of course add the effect for firestone and granite if you all insist on it, but you should at least try out for yourselves how it looks.
I won't insist on it.
I am not sure what happens when the materials are not loaded, though
I am not sure what happens when the materials are not loaded, though
If it really depends on the material so much, I think a new property like DustParticle should be introduced to the .ocm file.
If you implement something like this in the near future, I'll adapt my code. Otherwise I think that my initial solution + Maikel's optimization are easier than that huge if:
vs
// These two sounds are always played
Sound("StepHard?");
Sound("Rustle?");
// certain materials shouldn't crumble (because it doesn't look good)
var material = GetMaterial(get_tex_x, 9);
// firestone is an exception from the rule below
if(material == Material("Firestone"))
return;
// only diggable materials should crumble, except for Rock, Brick and BrickSoft
if((GetMaterialVal("DigFree", "Material", material) == 0) && ((material != Material("Rock")) && (material != Material("Brick")) && (material != Material("BrickSoft"))))
return;
// effects ...
vs
// These two sounds are always played
Sound("StepHard?");
Sound("Rustle?");
// certain materials shouldn't crumble (because it doesn't look good)
var exception_mats = ["Gold", "Firestone", "Ore", "Granite", "Amethyst", "Ruby"];
var material = GetMaterial(get_tex_x, 9);
for(element in exception_mats)
if(material == Material(element)) return;
// effects ...
Okay, so here is the updated patch with the changes from above.
I hereby license the file 0001-Added-gfx-sfx-for-walljump-and-hang.patch under the CC-BY license
I hereby license the file 0001-Added-gfx-sfx-for-walljump-and-hang.patch under the CC-BY license
Attachment: 0001-Added-gfx-sfx-for-walljump-and-hang.patch (37k)
I agree with Zapper that you should rather use a generic material property rather than a list because this would give some better upwards compatibility.
We could add new material properties to the .ocm files for that. Another cool idea would be if the engine automatically created a static proplist from all loaded .ocm files that would look like this:
Then you could just write stuff like:
or
We could add new material properties to the .ocm files for that. Another cool idea would be if the engine automatically created a static proplist from all loaded .ocm files that would look like this:
static const Materials = {
Earth = {
DigFree=1,
DustParticle="dust",
...
},
...
};
Then you could just write stuff like:
if (Materials[MaterialName(material)].DustParticle) ...
or
if (Materials.Earth.DigFree) ...
> Another cool idea would be if the engine automatically created a static proplist from all loaded .ocm files
We could even replace the ocm files with a system.ocg script that defined that proplist and have the material part of the engine read that. (In the far future, the StdCompiler will be reduced to reading network packages and savegames, having lost everything else to the script parser...)
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill