MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / CreateThingEffect

Function CreateThingEffect

engine/Poseidon/World/Scene/Thing.cpp:718–770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

716}
717
718Entity* CreateThingEffect(ThingEffectKind kind, // kind
719 Matrix4Val pos, Vector3Val vel // position and velocity
720)
721{
722 const ThingEffectItem* list = nullptr;
723 switch (kind)
724 {
725 default:
726 Fail("Bad effect kind");
727 // fall through
728 case TEGround:
729 list = GetTEGroundList();
730 break;
731 case TEArmor:
732 list = GetTEArmorList();
733 break;
734 case TECartridge:
735 list = GetTECartridgeList();
736 break;
737 }
738 const ThingEffectItem* item = SelectThingEffect(list, GRandGen.RandomValue());
739 if (!item)
740 {
741 return nullptr;
742 }
743#if 0
744 Ref<EntityAI> veh = NewVehicle(item->_type,RString());
745 if (!veh) return veh;
746 veh->SetTransform(pos);
747 veh->SetSpeed(vel);
748 veh->IsMoved();
749 Thing *thing = dyn_cast<Thing,EntityAI>(veh);
750#else
751 Ref<Entity> veh = NewNonAIVehicle(item->_type, RString());
752 if (!veh)
753 {
754 return veh;
755 }
756 veh->SetTransform(pos);
757 veh->SetSpeed(vel);
758 ThingEffectLight* thing = dyn_cast<ThingEffectLight, Entity>(veh);
759#endif
760 if (thing)
761 {
762 thing->SetCloudlet(true);
763 GWorld->AddCloudlet(thing);
764 }
765 else if (veh)
766 {
767 GWorld->AddAnimal(veh);
768 }
769 return veh;
770}
771
772Entity* CreateThing(VehicleType* type, // kind
773 Matrix4Val pos, Vector3Val vel // position and velocity

Callers 1

Calls 14

GetTEGroundListFunction · 0.85
GetTEArmorListFunction · 0.85
GetTECartridgeListFunction · 0.85
SelectThingEffectFunction · 0.85
NewVehicleFunction · 0.85
NewNonAIVehicleFunction · 0.85
IsMovedMethod · 0.80
SetCloudletMethod · 0.80
AddCloudletMethod · 0.80
AddAnimalMethod · 0.80
RStringClass · 0.50
RandomValueMethod · 0.45

Tested by

no test coverage detected