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

Function UpdateGunShells

TombEngine/Game/effects/tomb4fx.cpp:988–1084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

986}
987
988void UpdateGunShells()
989{
990 for (int i = 0; i < MAX_GUNSHELL; i++)
991 {
992 auto* gunshell = &Gunshells[i];
993
994 if (gunshell->counter)
995 {
996 gunshell->StoreInterpolationData();
997
998 auto prevPos = gunshell->pos.Position;
999
1000 gunshell->counter--;
1001
1002 short prevRoomNumber = gunshell->roomNumber;
1003
1004 if (TestEnvironment(ENV_FLAG_WATER, gunshell->roomNumber))
1005 {
1006 gunshell->fallspeed++;
1007
1008 if (gunshell->fallspeed <= 8)
1009 {
1010 if (gunshell->fallspeed < 0)
1011 gunshell->fallspeed >>= 1;
1012 }
1013 else
1014 gunshell->fallspeed = 8;
1015
1016 gunshell->speed -= gunshell->speed >> 1;
1017 }
1018 else
1019 gunshell->fallspeed += g_GameFlow->GetSettings()->Physics.Gravity;
1020
1021 gunshell->pos.Orientation.x += ((gunshell->speed / 2) + 7) * ANGLE(1.0f);
1022 gunshell->pos.Orientation.y += gunshell->speed * ANGLE(1.0f);
1023 gunshell->pos.Orientation.z += ANGLE(23.0f);
1024
1025 gunshell->pos.Position.x += gunshell->speed * phd_sin(gunshell->dirXrot);
1026 gunshell->pos.Position.y += gunshell->fallspeed;
1027 gunshell->pos.Position.z += gunshell->speed * phd_cos(gunshell->dirXrot);
1028
1029 FloorInfo* floor = GetFloor(gunshell->pos.Position.x, gunshell->pos.Position.y, gunshell->pos.Position.z, &gunshell->roomNumber);
1030 if (TestEnvironment(ENV_FLAG_WATER, gunshell->roomNumber) &&
1031 !TestEnvironment(ENV_FLAG_WATER, prevRoomNumber))
1032 {
1033
1034 SpawnSplashDrips(Vector3(gunshell->pos.Position.x, g_Level.Rooms[gunshell->roomNumber].TopHeight, gunshell->pos.Position.z), gunshell->roomNumber, 3, true);
1035 //AddWaterSparks(gs->pos.Position.x, g_Level.Rooms[gs->roomNumber].maxceiling, gs->pos.Position.z, 8);
1036 SpawnRipple(
1037 Vector3(gunshell->pos.Position.x, g_Level.Rooms[gunshell->roomNumber].TopHeight, gunshell->pos.Position.z),
1038 gunshell->roomNumber,
1039 Random::GenerateFloat(8.0f, 12.0f),
1040 (int)RippleFlags::SlowFade);
1041
1042 gunshell->fallspeed >>= 5;
1043 continue;
1044 }
1045

Callers 1

GamePhaseFunction · 0.85

Calls 14

TestEnvironmentFunction · 0.85
ANGLEFunction · 0.85
phd_sinFunction · 0.85
phd_cosFunction · 0.85
GetFloorFunction · 0.85
SpawnSplashDripsFunction · 0.85
SpawnRippleFunction · 0.85
GenerateFloatFunction · 0.85
GetCeilingFunction · 0.85
SoundEffectFunction · 0.85
GetFloorHeightFunction · 0.85
GetSettingsMethod · 0.80

Tested by

no test coverage detected