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

Method createParticleCallout

src/interface/interface.cpp:30073–30194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30071static ConsoleVariable<int> cvar_callout_sfx_vol("/callout_sfx_vol", 128);
30072
30073bool CalloutRadialMenu::createParticleCallout(Entity* entity, CalloutRadialMenu::CalloutCommand _cmd, Uint32 overrideUID)
30074{
30075 if ( !entity ) { return false; }
30076 if ( _cmd == CALLOUT_CMD_CANCEL ) { return false; }
30077
30078 Uint32 existingMessageSent = 0;
30079 for ( int i = 0; i < MAXPLAYERS; ++i )
30080 {
30081 if ( CalloutMenu[i].callouts.find(entity->getUID()) != CalloutMenu[i].callouts.end() )
30082 {
30083 auto& existingCallout = CalloutMenu[i].callouts[entity->getUID()];
30084 if ( i == getPlayer() && existingCallout.cmd == _cmd )
30085 {
30086 existingMessageSent = existingCallout.messageSentTick;
30087 }
30088 CalloutMenu[i].callouts.erase(entity->getUID()); // delete other players pings on this object
30089 }
30090 }
30091
30092 auto& callout = callouts[entity->getUID()];
30093 real_t x = entity->x;
30094 real_t y = entity->y;
30095 if ( TimerExperiments::bUseTimerInterpolation && entity->bUseRenderInterpolation )
30096 {
30097 x = entity->lerpRenderState.x.position * 16.0;
30098 y = entity->lerpRenderState.y.position * 16.0;
30099 }
30100 callout = CalloutRadialMenu::CalloutParticle_t(getPlayer(), x, y, entity->z, entity->getUID(), _cmd);
30101 if ( existingMessageSent > 0 && multiplayer != CLIENT )
30102 {
30103 if ( (callout.messageSentTick - existingMessageSent) < (TICKS_PER_SECOND * 3.5) )
30104 {
30105 callout.doMessage = false;
30106 callout.messageSentTick = existingMessageSent;
30107 }
30108 }
30109
30110 for ( int i = 0; i < MAXPLAYERS; ++i )
30111 {
30112 while ( CalloutMenu[i].callouts.size() > 3 )
30113 {
30114 Uint32 earliestTick = ::ticks;
30115 auto itToDelete = CalloutMenu[i].callouts.end();
30116 for ( auto it = CalloutMenu[i].callouts.begin(); it != CalloutMenu[i].callouts.end(); ++it )
30117 {
30118 if ( it->second.creationTick < earliestTick )
30119 {
30120 earliestTick = it->second.creationTick;
30121 itToDelete = it;
30122 }
30123 }
30124 if ( itToDelete == CalloutMenu[i].callouts.end() )
30125 {
30126 break;
30127 }
30128 else
30129 {
30130 CalloutMenu[i].callouts.erase(itToDelete);

Callers 4

handleActionsMethod · 0.80
actPlayerFunction · 0.80
net.cppFile · 0.80
createAssistShrineMethod · 0.80

Calls 11

CalloutParticle_tClass · 0.85
playSoundFunction · 0.85
sendPacketSafeFunction · 0.85
getUIDMethod · 0.80
c_strMethod · 0.80
isLocalPlayerMethod · 0.80
createBounceAnimateMethod · 0.80
endMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
isActiveMethod · 0.45

Tested by

no test coverage detected