@@ -1139,22 +1139,16 @@ function renderTextLabels()
11391139 end
11401140
11411141 local screenX , screenY = getScreenFromWorldPosition (textlabel .X , textlabel .Y , textlabel .Z , textlabel .dist , false )
1142- local pX , pY , pZ = getElementPosition (localPlayer )
1142+ local pX , pY , pZ , _ , _ , _ = getCameraMatrix () -- getElementPosition(localPlayer)
11431143 local dist = getDistanceBetweenPoints3D (pX , pY , pZ , textlabel .X , textlabel .Y , textlabel .Z )
11441144 local vw = getElementDimension (localPlayer )
1145- --[[ if textlabel.attached then
1146- local LOS = isLineOfSightClear(pX, pY, pZ, textlabel.X, textlabel.Y, textlabel.Z, true, true, true, true, true, false, false, textlabel.attachedTo)
1147- else]] -- Ãåðà áîòà åò, ïîõîæå ôóÃêöèÿ isLineOfSightClearÃÃ¥ ðà áîòà åò ñ à ðãóìåÃòîì ignoredElement.
1148- local LOS = isLineOfSightClear (pX , pY , pZ , textlabel .X , textlabel .Y , textlabel .Z , true , false , false )-- ïîêà òà ê, ïîòîì ðà çáåðóòñÿ ñ ôóÃêöèåé ñäåëà åêà ê ÃóæÃî :)
1149- -- end
1150- local len = string.len (textlabel .text )
1151- if screenX and dist <= textlabel .dist and vw == textlabel .vw then
1145+ local LOS = isLineOfSightClear (pX , pY , pZ , textlabel .X , textlabel .Y , textlabel .Z , true , false , false )
1146+
1147+ if screenX and dist <= textlabel .dist and (vw == textlabel .vw or textlabel .vw == - 1 ) then -- Because player textlabels don't have VW's, since we're processing both here
11521148 if not textlabel .los then
1153- -- dxDrawText(textlabel.text, screenX, screenY, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1, "default")--, "center", "center")--, true, false)
1154- dxDrawText (textlabel .text , screenX , screenY , screenWidth , screenHeight , tocolor (textlabel .color .r , textlabel .color .g , textlabel .color .b , textlabel .color .a ), 1 , " default-bold" )-- , "center", "center", true, false)
1149+ dxDrawText (textlabel .text , screenX , screenY , screenX , screenY , tocolor (textlabel .color .r , textlabel .color .g , textlabel .color .b , textlabel .color .a ), 1.0 , " default-bold" , " center" , " top" , false , false , false , true )
11551150 elseif LOS then
1156- -- dxDrawText(textlabel.text, screenX, screenY, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1, "default")--, "center", "center")--, true, false)
1157- dxDrawText (textlabel .text , screenX - (len ), screenY , screenWidth , screenHeight , tocolor (textlabel .color .r , textlabel .color .g , textlabel .color .b , textlabel .color .a ), 1 , " default-bold" )-- , "center", "center", true, false)
1151+ dxDrawText (textlabel .text , screenX , screenY , screenX , screenY , tocolor (textlabel .color .r , textlabel .color .g , textlabel .color .b , textlabel .color .a ), 1.0 , " default-bold" , " center" , " top" , false , false , false , true )
11581152 end
11591153 end
11601154 end
@@ -1182,6 +1176,7 @@ function Create3DTextLabel(id, textlabel)
11821176 textlabel .id = id
11831177 textlabel .enabled = false
11841178 g_TextLabels [id ] = textlabel
1179+ outputConsole (' Created text label with id ' .. textlabel .id )
11851180end
11861181
11871182function Delete3DTextLabel (id )
@@ -1190,7 +1185,9 @@ function Delete3DTextLabel(id)
11901185end
11911186
11921187function Attach3DTextLabel (textlabel )
1188+ outputConsole (' Attaching text label with id ' .. textlabel .id )
11931189 local id = textlabel .id
1190+ textlabel .enabled = true
11941191 g_TextLabels [id ] = textlabel
11951192end
11961193
0 commit comments