// ---------------------------------------------------------------------------- void CViewRadar::draw () { CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewRenderer &rVR = pIM->getViewRenderer(); CEntityCL *user = EntitiesMngr.entity(0); if (user == NULL) return; CVectorD xyzRef = user->pos(); const CVector dir = user->front(); float angle = (float)(atan2(dir.y, dir.x) - (Pi / 2.0)); CMatrix mat; mat.identity(); // Scale to transform from world to interface screen mat.scale( CVector((float)(_WReal / _WorldSize), (float)(_HReal / _WorldSize), 1) ); // local to user mat.rotateZ(-angle); xyzRef.z = 0; mat.translate(-xyzRef); float maxSqrRadius= (float)sqr(_WorldSize/2); for (sint32 i = 1; i < 256; ++i) { CEntityCL *entity = EntitiesMngr.entity(i); if (entity == NULL) continue; // if the entity must not be shown in radar if(!entity->getDisplayInRadar()) continue; // get entity pos CVectorD xyz = entity->pos(); xyz.z = 0; // if the distance is too big so do not display the entity if ((sqr(xyz.x - xyzRef.x)+sqr(xyz.y - xyzRef.y)) > maxSqrRadius) continue; // Transform the dot xyz = mat * xyz; // Convert to screen sint32 x = OptFastFloor((float)xyz.x); sint32 y = OptFastFloor((float)xyz.y); CRGBA col = entity->getColor(); if(getModulateGlobalColor()) col.modulateFromColor (col, pIM->getGlobalColorForContent()); else col.A = (uint8)(((sint32)col.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8); // Select the icon to display and draw it uint spotId = CNPCIconCache::getInstance().getNPCIcon(entity).getSpotId(); CRadarSpotDesc spotDesc = _SpotDescriptions[spotId]; if (!_MissionIconsObs._displayMissionSpots) spotDesc = _SpotDescriptions[0]; if (spotDesc.isMissionSpot) col = CRGBA(255, 255, 255, 255); if (entity->isTarget()) spotId = 4; // to make it over other spots // Draw it (and make sure mission icons are drawn over regular dot; caution: don't exceed the render layer range) if (spotDesc.isMissionSpot && _MiniMissionSpotsObs._displayMiniMissionSpots) rVR.drawRotFlipBitmap (_RenderLayer+spotId, _XReal+x-(spotDesc.MTxW/2)+(_WReal/2), _YReal+y-(spotDesc.MTxH/2)+(_HReal/2), spotDesc.MTxW, spotDesc.MTxH, 0, false, spotDesc.MiniTextureId, col ); else rVR.drawRotFlipBitmap (_RenderLayer+spotId, _XReal+x-(spotDesc.TxW/2)+(_WReal/2), _YReal+y-(spotDesc.TxH/2)+(_HReal/2), spotDesc.TxW, spotDesc.TxH, 0, false, spotDesc.TextureId, col ); } }
void addWebIGParams (string &url, bool trustedDomain) { if(!UserEntity || !NetMngr.getLoginCookie().isValid()) return; uint32 cid = NetMngr.getLoginCookie().getUserId() * 16 + PlayerSelectedSlot; url += ((url.find('?') != string::npos) ? "&" : "?") + string("shardid=") + toString(CharacterHomeSessionId) + string("&name=") + UserEntity->getLoginName().toUtf8() + string("&lang=") + CI18N::getCurrentLanguageCode() + string("&datasetid=") + toString(UserEntity->dataSetId()) + string("&ig=1"); if (trustedDomain) { url += string("&cid=") + toString(cid) + string("&authkey=") + getWebAuthKey(); if (url.find('$') != string::npos) { strFindReplace(url, "$gender$", GSGENDER::toString(UserEntity->getGender())); strFindReplace(url, "$displayName$", UserEntity->getDisplayName().toString()); strFindReplace(url, "$posx$", toString(UserEntity->pos().x)); strFindReplace(url, "$posy$", toString(UserEntity->pos().y)); strFindReplace(url, "$posz$", toString(UserEntity->pos().z)); strFindReplace(url, "$post$", toString(atan2(UserEntity->front().y, UserEntity->front().x))); // Target fields const char *dbPath = "UI:VARIABLES:TARGET:SLOT"; CInterfaceManager *im = CInterfaceManager::getInstance(); CCDBNodeLeaf *node = im->getDbProp(dbPath, false); if (node && (uint8)node->getValue32() != (uint8) CLFECOMMON::INVALID_SLOT) { CEntityCL *target = EntitiesMngr.entity((uint) node->getValue32()); if (target) { strFindReplace(url, "$tdatasetid$", toString(target->dataSetId())); strFindReplace(url, "$tdisplayName$", target->getDisplayName().toString()); strFindReplace(url, "$tposx$", toString(target->pos().x)); strFindReplace(url, "$tposy$", toString(target->pos().y)); strFindReplace(url, "$tposz$", toString(target->pos().z)); strFindReplace(url, "$tpost$", toString(atan2(target->front().y, target->front().x))); strFindReplace(url, "$tsheet$", target->sheetId().toString()); string type; if (target->isFauna()) type = "fauna"; else if (target->isNPC()) type = "npc"; else if (target->isPlayer()) type = "player"; else if (target->isUser()) type = "user"; strFindReplace(url, "$ttype$", target->sheetId().toString()); } else { strFindReplace(url, "$tdatasetid$", ""); strFindReplace(url, "$tdisplayName$", ""); strFindReplace(url, "$tposx$", ""); strFindReplace(url, "$tposy$", ""); strFindReplace(url, "$tposz$", ""); strFindReplace(url, "$tpost$", ""); strFindReplace(url, "$tsheet$", ""); strFindReplace(url, "$ttype$", ""); } } } } }