| 120 | } |
| 121 | |
| 122 | void CStaticMap::DrawRectangle(Vector3Val position, float a, float b, float angle, PackedColor color) |
| 123 | { |
| 124 | DrawCoord posMap = WorldToScreen(position); |
| 125 | float cx = posMap.x * _wScreen; |
| 126 | float cy = posMap.y * _hScreen; |
| 127 | |
| 128 | const float invSizeLand = InvLandSize; |
| 129 | float aMap = a * invSizeLand * _invScaleX * _wScreen; |
| 130 | float bMap = b * invSizeLand * _invScaleY * _hScreen; |
| 131 | |
| 132 | float r = sqrt(Square(aMap) + Square(bMap)); |
| 133 | if (cx + r < _clipRect.x) |
| 134 | { |
| 135 | return; |
| 136 | } |
| 137 | if (cy + r < _clipRect.y) |
| 138 | { |
| 139 | return; |
| 140 | } |
| 141 | if (cx - r > _clipRect.x + _clipRect.w) |
| 142 | { |
| 143 | return; |
| 144 | } |
| 145 | if (cy - r > _clipRect.y + _clipRect.h) |
| 146 | { |
| 147 | return; |
| 148 | } |
| 149 | |
| 150 | float angleRad = HDegree(angle); |
| 151 | float s = sin(angleRad); |
| 152 | float c = cos(angleRad); |
| 153 | |
| 154 | float x1 = cx + c * aMap + s * bMap; |
| 155 | float y1 = cy + s * aMap - c * bMap; |
| 156 | float x2 = cx + c * aMap + s * (-bMap); |
| 157 | float y2 = cy + s * aMap - c * (-bMap); |
| 158 | float x3 = cx + c * (-aMap) + s * (-bMap); |
| 159 | float y3 = cy + s * (-aMap) - c * (-bMap); |
| 160 | float x4 = cx + c * (-aMap) + s * bMap; |
| 161 | float y4 = cy + s * (-aMap) - c * bMap; |
| 162 | |
| 163 | GLOB_ENGINE->DrawLine(Line2DPixel(x1, y1, x2, y2), color, color, _clipRect); |
| 164 | GLOB_ENGINE->DrawLine(Line2DPixel(x2, y2, x3, y3), color, color, _clipRect); |
| 165 | GLOB_ENGINE->DrawLine(Line2DPixel(x3, y3, x4, y4), color, color, _clipRect); |
| 166 | GLOB_ENGINE->DrawLine(Line2DPixel(x4, y4, x1, y1), color, color, _clipRect); |
| 167 | } |
| 168 | |
| 169 | inline PackedColor ModAlpha(PackedColor color, float alpha) |
| 170 | { |
nothing calls this directly
no test coverage detected