positionX = pPosition.x;
positionY = pPosition.y;
positionZ = pPosition.z;
positionZ = fDistanceToCamera * 0.0475f + positionZ + 0.2f;
-- Трансформация координат в экранные координаты
screenX, screenY = convert3DCoordsToScreen(positionX, positionY, positionZ)
if (isPointOnScreen(positionX, positionY, positionZ, 1.0) and fHealth >= 0.0) then
screenX = math.ceil(screenX);
transformedScreenY = math.ceil(screenY);
-- Установка цвета для полосы здоровья
dword_healthColor1 = -4644312;
dword_healthColor2 = -4644312;
dword_healthColor3 = -4644312;
dword_healthColor4 = -4644312;
dword_backgroundColor1 = -11859180;
dword_backgroundColor2 = -11859180;
dword_backgroundColor3 = -11859180;
dword_backgroundColor4 = -11859180;
-- Вычисление позиций для полосы здоровья
healthBarStartX = screenX - 20.0;
healthBarStartY = screenY + 18.0;
healthBarEndX = healthBarStartX;
healthBarHeight = screenY + 24.0;
healthBarWidth = screenX + 21.0;
healthBarBottomHeight = healthBarHeight;
healthBackgroundWidth = healthBarWidth;
healthBarTopY = healthBarStartY;
healthOutlineStartX = screenX - 19.0;
healthOutlineEndX = healthOutlineStartX;
healthOutlineStartY = screenY + 19.0;
--dword_outlineStartY = LODWORD(healthOutlineStartY);
healthOutlineBottomX = healthOutlineStartX;
healthOutlineTopX = healthOutlineStartX;
healthOutlineHeight = screenY + 23.0;
--dword_outlineHeight = LODWORD(healthOutlineHeight);
healthOutlineWidth = screenX + 19.0;
healthOutlineFillHeight = healthOutlineHeight;
--dword_outlineFillHeight = LODWORD(healthOutlineHeight);
healthOutlineBottomWidth = healthOutlineWidth;
healthOutlineTopHeight = healthOutlineStartY;
--dword_outlineTopHeight = LODWORD(healthOutlineStartY);
if (fHealth > 100.0) then
fHealth = 100.0;
healthFillWidth = fHealth * 0.38461539 - 19.0 + screenX;
healthFillMaxWidth = healthFillWidth;
end
if (fArmour > 0.0) then
-- Корректировка координат для брони
healthBarStartY += 8.0;
*(float *)&dword_outlineStartY = healthOutlineStartY + 8.0;
healthOutlineStartY += 8.0;
healthBarHeight += 8.0;
*(float *)&dword_outlineHeight = healthOutlineHeight + 8.0;
healthOutlineHeight += 8.0;
healthBarBottomHeight += 8.0;
*(float *)&dword_outlineFillHeight = healthOutlineFillHeight + 8.0;
healthOutlineFillHeight += 8.0;
healthBarTopY += 8.0;
*(float *)&dword_outlineTopHeight = healthOutlineTopHeight + 8.0;
healthOutlineTopHeight += 8.0;
end
-- Отрисовка полосы здоровья
pDirect3DDevice->lpVtbl->SetFVF(pDirect3DDevice, 68);
pDirect3DDevice->lpVtbl->DrawPrimitiveUP(pDirect3DDevice, D3DPT_TRIANGLEFAN, 2, &healthBarStartX, 20);
pDirect3DDevice->lpVtbl->DrawPrimitiveUP(pDirect3DDevice, D3DPT_TRIANGLEFAN, 2, &healthOutlineEndX, 20);
pDirect3DDevice->lpVtbl->DrawPrimitiveUP(pDirect3DDevice, D3DPT_TRIANGLEFAN, 2, &healthOutlineStartX, 20);
if (fArmour > 0.0) then
-- Корректировка цвета и позиций для брони
dword_healthColor1 = -3618616;
dword_healthColor2 = -3618616;
dword_healthColor3 = -3618616;
healthBarStartY -= 8.0;
dword_healthColor4 = -3618616;
dword_backgroundColor1 = -14145496;
dword_backgroundColor2 = -14145496;
dword_backgroundColor3 = -14145496;
*(float *)&dword_outlineStartY -= 8.0;
dword_backgroundColor4 = -14145496;
healthOutlineStartY -= 8.0;
healthBarHeight -= 8.0;
*(float *)&dword_outlineHeight -= 8.0;
healthOutlineHeight -= 8.0;
healthBarBottomHeight -= 8.0;
*(float *)&dword_outlineFillHeight -= 8.0;
healthOutlineFillHeight -= 8.0;
healthBarTopY -= 8.0;
*(float *)&dword_outlineTopHeight -= 8.0;
healthOutlineTopHeight -= 8.0;
if (fArmour > 100.0)
fArmour = 100.0;
healthFillWidth = fArmour * 0.38461539f - 19.0 + screenX;
healthFillMaxWidth = healthFillWidth;
-- Отрисовка полосы брони
pDirect3DDevice->lpVtbl->SetFVF(pDirect3DDevice, 68);
pDirect3DDevice->lpVtbl->DrawPrimitiveUP(pDirect3DDevice, D3DPT_TRIANGLEFAN, 2, &healthBarStartX, 20);
pDirect3DDevice->lpVtbl->DrawPrimitiveUP(pDirect3DDevice, D3DPT_TRIANGLEFAN, 2, &healthOutlineEndX, 20);
pDirect3DDevice->lpVtbl->DrawPrimitiveUP(pDirect3DDevice, D3DPT_TRIANGLEFAN, 2, &healthOutlineStartX, 20);
end
end
тут еще много С синтаксиса.. перепиши в луа для использования с
renderDrawBox
renderDrawBox(float posX, float posY, float sizeX, float sizeY, uint color)
Описание
Рисует прямоугольник в указанных координатах с определённым размером
Пример использования
renderDrawBox(10, 15, 200, 80, 0xAA00CC00)