MCPcopy Create free account
hub / github.com/TurningWheel/Barony / createParticleSpellPinpointTarget

Function createParticleSpellPinpointTarget

src/magic/actmagic.cpp:15665–15725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15663}
15664
15665Entity* createParticleSpellPinpointTarget(Entity* parent, Uint32 casterUid, int sprite, int duration, int spellID)
15666{
15667 if ( !parent )
15668 {
15669 return nullptr;
15670 }
15671 Entity* entity = newEntity(sprite, 1, map.entities, nullptr); //Particle entity.
15672 entity->parent = parent->getUID();
15673 entity->x = parent->x;
15674 entity->y = parent->y;
15675 entity->z = 7.5;
15676 static ConsoleVariable<float> cvar_pinpoint_z("/pinpoint_z", 0.0);
15677 entity->fskill[0] = parent->z + *cvar_pinpoint_z;
15678 if ( parent->behavior == &actBoulderTrapHole )
15679 {
15680 entity->fskill[0] += 15.0;
15681 }
15682 entity->vel_z = -0.8;
15683 entity->scalex = 0.1;
15684 entity->scaley = 0.1;
15685 entity->scalez = 0.1;
15686 entity->yaw = (local_rng.rand() % 360) * PI / 180.0;
15687 entity->skill[0] = duration;
15688 entity->skill[1] = 0;
15689 entity->skill[2] = static_cast<Sint32>(casterUid);
15690 entity->skill[3] = 0;
15691 entity->skill[4] = spellID;
15692 entity->skill[5] = sprite;// +(PINPOINT_PARTICLE_END - PINPOINT_PARTICLE_START); // start/end particle drops
15693 entity->behavior = &actParticlePinpointTarget;
15694 entity->ditheringOverride = 6;
15695 entity->flags[PASSABLE] = true;
15696 entity->flags[NOUPDATE] = true;
15697 entity->flags[UNCLICKABLE] = true;
15698 entity->flags[ENTITY_SKIP_CULLING] = true;
15699 entity->lightBonus = vec4(*cvar_magic_fx_light_bonus, *cvar_magic_fx_light_bonus,
15700 *cvar_magic_fx_light_bonus, 0.f);
15701 TileEntityList.addEntity(*entity);
15702 if ( multiplayer != CLIENT )
15703 {
15704 entity_uids--;
15705 }
15706 entity->setUID(-3);
15707
15708 for ( auto node = map.entities->first; node; node = node->next )
15709 {
15710 if ( Entity* entity2 = (Entity*)node->element )
15711 {
15712 if ( entity2->behavior == &actParticlePinpointTarget
15713 && entity2 != entity
15714 && entity2->parent == entity->parent )
15715 {
15716 //if ( entity2->skill[4] == spellID )
15717 {
15718 entity2->skill[0] = -1; // kill off existing particle
15719 }
15720 }
15721 }
15722 }

Callers 2

net.cppFile · 0.85
castSpellFunction · 0.85

Calls 6

newEntityFunction · 0.85
vec4Class · 0.85
getUIDMethod · 0.80
randMethod · 0.80
addEntityMethod · 0.80
setUIDMethod · 0.80

Tested by

no test coverage detected