void destroyFXDroid(DROID *psDroid, unsigned impactTime) { for (int i = 0; i < 5; ++i) { iIMDShape *psImd = nullptr; int maxHorizontalScatter = TILE_UNITS / 4; int heightScatter = TILE_UNITS / 5; Vector2i horizontalScatter = iSinCosR(rand(), rand() % maxHorizontalScatter); Vector3i pos = (psDroid->pos + Vector3i(horizontalScatter, 16 + heightScatter)).xzy; switch (i) { case 0: switch (psDroid->droidType) { case DROID_DEFAULT: case DROID_CYBORG: case DROID_CYBORG_SUPER: case DROID_CYBORG_CONSTRUCT: case DROID_CYBORG_REPAIR: case DROID_WEAPON: case DROID_COMMAND: if (psDroid->numWeaps > 0) { if (psDroid->asWeaps[0].nStat > 0) { psImd = WEAPON_MOUNT_IMD(psDroid, 0); } } break; default: break; } break; case 1: switch (psDroid->droidType) { case DROID_DEFAULT: case DROID_CYBORG: case DROID_CYBORG_SUPER: case DROID_CYBORG_CONSTRUCT: case DROID_CYBORG_REPAIR: case DROID_WEAPON: case DROID_COMMAND: if (psDroid->numWeaps) { // get main weapon psImd = WEAPON_IMD(psDroid, 0); } break; default: break; } break; } if (psImd == nullptr) { psImd = getRandomDebrisImd(); } // Tell the effect system that it needs to use this player's color for the next effect SetEffectForPlayer(psDroid->player); addEffect(&pos, EFFECT_GRAVITON, GRAVITON_TYPE_EMITTING_DR, true, psImd, getPlayerColour(psDroid->player), impactTime); } }
void destroyFXDroid(DROID *psDroid) { UDWORD i; iIMDShape *psImd = NULL; SDWORD widthScatter, breadthScatter, heightScatter; Vector3i pos; widthScatter = TILE_UNITS/4; breadthScatter = TILE_UNITS/4; heightScatter = TILE_UNITS/5; for(i=0; i<5; i++) { pos.x = psDroid->pos.x + widthScatter - rand()%(2*widthScatter); pos.z = psDroid->pos.y + breadthScatter - rand()%(2*breadthScatter); pos.y = psDroid->pos.z + 16 +heightScatter; switch(i) { case 0: switch(psDroid->droidType) { case DROID_DEFAULT: case DROID_CYBORG: case DROID_CYBORG_SUPER: case DROID_CYBORG_CONSTRUCT: case DROID_CYBORG_REPAIR: case DROID_WEAPON: case DROID_COMMAND: if (psDroid->numWeaps > 0) { if(psDroid->asWeaps[0].nStat > 0) { // Tell the effect system that it needs to use this player's color for the next effect SetEffectForPlayer(psDroid->player); psImd = WEAPON_MOUNT_IMD(psDroid, 0); } } else { psImd = getRandomDebrisImd(); } break; default: psImd = getRandomDebrisImd(); break; } break; case 1: switch(psDroid->droidType) { case DROID_DEFAULT: case DROID_CYBORG: case DROID_CYBORG_SUPER: case DROID_CYBORG_CONSTRUCT: case DROID_CYBORG_REPAIR: case DROID_WEAPON: case DROID_COMMAND: if(psDroid->numWeaps) { // get main weapon psImd = WEAPON_IMD(psDroid, 0); } else { psImd = getRandomDebrisImd(); } break; default: psImd = getRandomDebrisImd(); break; } break; case 2: case 3: case 4: psImd = getRandomDebrisImd(); break; } if(psImd) { addEffect(&pos,EFFECT_GRAVITON,GRAVITON_TYPE_EMITTING_DR,true,psImd,getPlayerColour(psDroid->player)); } else { addEffect(&pos,EFFECT_GRAVITON,GRAVITON_TYPE_EMITTING_DR,true,getRandomDebrisImd(),0); } } }