MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / TriggerExplosionBubbles

Function TriggerExplosionBubbles

TombEngine/Game/effects/effects.cpp:897–963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

895}
896
897void TriggerExplosionBubbles(int x, int y, int z, short roomNumber, const Vector3& mainColor, const Vector3& secondColor)
898{
899 int dx = LaraItem->Pose.Position.x - x;
900 int dz = LaraItem->Pose.Position.z - z;
901
902 if (dx >= -BLOCK(16) && dx <= BLOCK(16) &&
903 dz >= -BLOCK(16) && dz <= BLOCK(16))
904 {
905 auto* spark = GetFreeParticle();
906
907 if (mainColor == Vector3::Zero)
908 {
909 spark->sR = 128;
910 spark->sG = 64;
911 spark->sB = 0;
912 spark->dR = 128;
913 spark->dG = 128;
914 spark->dB = 128;
915 }
916 else
917 {
918 auto [colorS, colorD] = GenerateColorShift(mainColor, secondColor);
919
920 spark->sR = colorS[0];
921 spark->sG = colorS[1];
922 spark->sB = colorS[2];
923 spark->dR = colorD[0];
924 spark->dG = colorD[1];
925 spark->dB = colorD[2];
926 spark->flags = SP_UNDERWEXP | SP_COLOR;
927 }
928
929 spark->on = 1;
930 spark->life = 24;
931 spark->sLife = 24;
932 spark->colFadeSpeed = 8;
933 spark->fadeToBlack = 12;
934 spark->blendMode = BlendMode::Additive;
935 spark->x = x;
936 spark->y = y;
937 spark->z = z;
938 spark->xVel = 0;
939 spark->yVel = 0;
940 spark->zVel = 0;
941 spark->friction = 0;
942 spark->flags = SP_UNDERWEXP | SP_DEF | SP_SCALE;
943 spark->SpriteSeqID = ID_DEFAULT_SPRITES;
944 spark->SpriteID = SPR_BUBBLES;
945 spark->scalar = 3;
946 spark->gravity = 0;
947 spark->maxYvel = 0;
948
949 int size = (GetRandomControl() & 7) + 63;
950 spark->sSize = size >> 1;
951 spark->size = size >> 1;
952 spark->dSize = 2 * size;
953
954 for (int i = 0; i < 8; i++)

Callers 1

Calls 5

GetFreeParticleFunction · 0.85
GenerateColorShiftFunction · 0.85
GetRandomControlFunction · 0.85
SpawnBubbleFunction · 0.85
Vector3Function · 0.50

Tested by

no test coverage detected