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

Function CreatureFloat

TombEngine/Game/control/box.cpp:1197–1235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1195}
1196
1197void CreatureFloat(short itemNumber)
1198{
1199 auto* item = &g_Level.Items[itemNumber];
1200
1201 auto pointColl = GetPointCollision(*item);
1202
1203 item->HitPoints = NOT_TARGETABLE;
1204 item->Pose.Orientation.x = 0;
1205
1206 int y = item->Pose.Position.y;
1207 int waterLevel = GetPointCollision(*item).GetWaterTopHeight();
1208 if (waterLevel == NO_HEIGHT)
1209 return;
1210
1211 if (y > waterLevel)
1212 item->Pose.Position.y = y - 32;
1213
1214 if (item->Pose.Position.y < waterLevel)
1215 item->Pose.Position.y = waterLevel;
1216
1217 AnimateItem(item);
1218
1219 item->Floor = pointColl.GetFloorHeight();
1220 if (pointColl.GetRoomNumber() != item->RoomNumber)
1221 ItemNewRoom(itemNumber, pointColl.GetRoomNumber());
1222
1223 if (item->Pose.Position.y <= waterLevel)
1224 {
1225 if (item->Animation.FrameNumber == 0)
1226 {
1227 item->Pose.Position.y = waterLevel;
1228 item->Collidable = false;
1229 item->Status = ITEM_DEACTIVATED;
1230 DisableEntityAI(itemNumber);
1231 RemoveActiveItem(itemNumber);
1232 item->AfterDeath = 1;
1233 }
1234 }
1235}
1236
1237void CreatureJoint(ItemInfo* item, short joint, short required, short maxAngle)
1238{

Callers 5

BarracudaControlFunction · 0.85
SharkControlFunction · 0.85
ScubaControlFunction · 0.85
CrocodileControlFunction · 0.85
HammerheadControlFunction · 0.85

Calls 8

GetPointCollisionFunction · 0.85
AnimateItemFunction · 0.85
ItemNewRoomFunction · 0.85
DisableEntityAIFunction · 0.85
RemoveActiveItemFunction · 0.85
GetWaterTopHeightMethod · 0.80
GetFloorHeightMethod · 0.45
GetRoomNumberMethod · 0.45

Tested by

no test coverage detected