| 199 | } |
| 200 | |
| 201 | void CRenderTools::GetRenderTeeOffsetToRenderedTee(const CAnimState *pAnim, const CTeeRenderInfo *pInfo, vec2 &TeeOffsetToMid) |
| 202 | { |
| 203 | if(pInfo->m_aSixup[g_Config.m_ClDummy].PartTexture(protocol7::SKINPART_BODY).IsValid()) |
| 204 | { |
| 205 | TeeOffsetToMid = vec2(0.0f, pInfo->m_Size * 0.12f); |
| 206 | return; |
| 207 | } |
| 208 | |
| 209 | float AnimScale, BaseSize; |
| 210 | GetRenderTeeAnimScaleAndBaseSize(pInfo, AnimScale, BaseSize); |
| 211 | vec2 BodyPos = vec2(pAnim->GetBody()->m_X, pAnim->GetBody()->m_Y) * AnimScale; |
| 212 | |
| 213 | float AssumedScale = BaseSize / 64.0f; |
| 214 | |
| 215 | // just use the lowest feet |
| 216 | vec2 FeetPos; |
| 217 | const CAnimKeyframe *pFoot = pAnim->GetFrontFoot(); |
| 218 | FeetPos = vec2(pFoot->m_X * AnimScale, pFoot->m_Y * AnimScale); |
| 219 | pFoot = pAnim->GetBackFoot(); |
| 220 | FeetPos = vec2(FeetPos.x, maximum(FeetPos.y, pFoot->m_Y * AnimScale)); |
| 221 | |
| 222 | vec2 BodyOffset; |
| 223 | float BodyWidth, BodyHeight; |
| 224 | GetRenderTeeBodySize(pAnim, pInfo, BodyOffset, BodyWidth, BodyHeight); |
| 225 | |
| 226 | // -32 is the assumed min relative position for the quad |
| 227 | float MinY = -32.0f * AssumedScale; |
| 228 | // the body pos shifts the body away from center |
| 229 | MinY += BodyPos.y; |
| 230 | // the actual body is smaller though, because it doesn't use the full skin image in most cases |
| 231 | MinY += BodyOffset.y; |
| 232 | |
| 233 | vec2 FeetOffset; |
| 234 | float FeetWidth, FeetHeight; |
| 235 | GetRenderTeeFeetSize(pAnim, pInfo, FeetOffset, FeetWidth, FeetHeight); |
| 236 | |
| 237 | // MaxY builds up from the MinY |
| 238 | float MaxY = MinY + BodyHeight; |
| 239 | // if the body is smaller than the total feet offset, use feet |
| 240 | // since feet are smaller in height, respect the assumed relative position |
| 241 | MaxY = maximum(MaxY, (-16.0f * AssumedScale + FeetPos.y) + FeetOffset.y + FeetHeight); |
| 242 | |
| 243 | // now we got the full rendered size |
| 244 | float FullHeight = (MaxY - MinY); |
| 245 | |
| 246 | // next step is to calculate the offset that was created compared to the assumed relative position |
| 247 | float MidOfRendered = MinY + FullHeight / 2.0f; |
| 248 | |
| 249 | // TODO: x coordinate is ignored for now, bcs it's not really used yet anyway |
| 250 | TeeOffsetToMid.x = 0; |
| 251 | // negative value, because the calculation that uses this offset should work with addition. |
| 252 | TeeOffsetToMid.y = -MidOfRendered; |
| 253 | } |
| 254 | |
| 255 | void CRenderTools::RenderTee(const CAnimState *pAnim, const CTeeRenderInfo *pInfo, int Emote, vec2 Dir, vec2 Pos, float Alpha) const |
| 256 | { |
nothing calls this directly
no test coverage detected