-raffie- wrote:
...how you check for Invisibility being true or false? That way it would be possible to apply to other weapons (I'm thinking of Helicopter, ...)
Well you really don't need invisibility checking, just put your drawing routines in the RenderWorm() event. It won't be called on remote machines when a worm is invisible.
The only problem(if you use custom graphics) are the semi-transparent sprites. Here you need invisibility checking, to determine if your sprites must be semi transparent.
Here is an example of how to do that(taken from my revised glider):
Code:
override void CDDQueue::AddSprite(fixed z,fixed x,fixed y,int unk,int sprite,fixed frame) {
if(GS->Tick < 1) {super; return;}
CWorm *w = GetCurrentWorm();
if(w != NullObj && w->Glider->Deployed)
{
// Replace normal Parachute sprites with Glider sprites
if(sprite >= 287 && sprite <= 288) {
w->AddSpriteEx(z, x, y, wormGliderSprite->Index, w->Glider->GliderAnimCycle, -w->Glider->GliderAng, 1);
return;
}
// Replace mirrored Parachute sprites with mirrored Glider sprites
if(sprite >= 287+262144 && sprite <= 288+262144) {
w->AddSpriteEx(z, x, y, wormGliderSprite->Index+262144, w->Glider->GliderAnimCycle, w->Glider->GliderAng, 1);
return;
}
// Replace semitransparent(invisibilized) Parachute sprites with semitransparent Glider sprites
if(sprite >= 287+2097152 && sprite <= 288+2097152) {
w->AddSpriteEx(z, x, y, wormGliderSprite->Index+2097152, w->Glider->GliderAnimCycle, -w->Glider->GliderAng, 1);
return;
}
// Replace transparent and mirrored Parachute sprites with transparent mirrored Glider sprites
if(sprite >= 287+262144+2097152 && sprite <= 288+262144+2097152) {
w->AddSpriteEx(z, x, y, wormGliderSprite->Index+262144+2097152, w->Glider->GliderAnimCycle, w->Glider->GliderAng, 1);
return;
}
}
super;
}
Edit: Updated Hang-Glider!.