diff --git a/Source/Contents/SpriteLayerDepth.cpp b/Source/Contents/SpriteLayerDepth.cpp index 0ada80786..d12becf2e 100644 --- a/Source/Contents/SpriteLayerDepth.cpp +++ b/Source/Contents/SpriteLayerDepth.cpp @@ -45,22 +45,90 @@ void CCharacterRender::OffsetLayerDepth(int layer, SpriteCellQuad& quad, float b // OFFSET: 0x0080E4D0 // FUNCTION: fn_10107 void CCharacterRender::OffsetAccessoryLayerDepth(int layer, SpriteCellQuad& quad, float bottomDepth, float topDepth) const { - float bottom = bottomDepth; - float top = topDepth; - switch (layer) { case 1: - if (this->upperHeadgear == 1095) { - if (g_cameraDistance < 32.0f) { - bottom = bottomDepth - 0.000008f; - top = topDepth - 0.000008f; + if (this->upperHeadgear != 1095) { + if (g_cameraDistance < robeTopLayerThreshold) { + quad.bottomDepth = bottomDepth + 0.000025f; + quad.topDepth = topDepth + 0.000025f; } else { - bottom = bottomDepth - 0.0000005f; - top = topDepth - 0.0000005f; + quad.bottomDepth = bottomDepth; + quad.topDepth = topDepth; + } + } else if (g_cameraDistance < 32.0f) { + quad.bottomDepth = bottomDepth - 0.000008f; + quad.topDepth = topDepth - 0.000008f; + } else { + quad.bottomDepth = bottomDepth - 0.0000005f; + quad.topDepth = topDepth - 0.0000005f; + } + break; + case 3: + if (g_cameraDistance < robeTopLayerThreshold) { + quad.bottomDepth = bottomDepth + 0.00004f; + quad.topDepth = 0.0001f + topDepth; + } else { + quad.bottomDepth = bottomDepth; + quad.topDepth = 0.000045f + topDepth; + } + break; + case 4: + if (this->upperHeadgear == 1485) { + if (g_cameraDistance < robeTopLayerThreshold) { + quad.bottomDepth = 0.00035f + bottomDepth; + quad.topDepth = 0.0006f + topDepth; + } else { + quad.bottomDepth = 0.00001f + bottomDepth; + quad.topDepth = 0.00015f + topDepth; + } + } else { + switch (this->middleHeadgear) { + case 1318: + if (g_cameraDistance < robeTopLayerThreshold) { + quad.bottomDepth = 0.00025f + bottomDepth; + quad.topDepth = 0.0001f + topDepth; + } else { + quad.bottomDepth = 0.00005f + bottomDepth; + quad.topDepth = 0.00005f + topDepth; + } + break; + case 1354: + if (g_cameraDistance < robeTopLayerThreshold) { + quad.bottomDepth = bottomDepth + 0.00009f; + quad.topDepth = topDepth - 0.00005f; + } else { + quad.bottomDepth = bottomDepth; + quad.topDepth = topDepth; + } + break; + case 1363: + if (g_cameraDistance < robeTopLayerThreshold) { + quad.bottomDepth = bottomDepth + 0.000027f + 0.0004f; + quad.topDepth = topDepth + 0.000027f + 0.0007f; + } else { + quad.bottomDepth = bottomDepth + 0.00007f; + quad.topDepth = topDepth + 0.00017f; + } + break; + case 1582: + if (g_cameraDistance < robeTopLayerThreshold) { + quad.bottomDepth = bottomDepth + 0.0002f; + quad.topDepth = topDepth + 0.0002f; + } else { + quad.bottomDepth = bottomDepth + 0.00004f; + quad.topDepth = topDepth + 0.00006f; + } + break; + default: + if (g_cameraDistance < robeTopLayerThreshold) { + quad.bottomDepth = bottomDepth + 0.00003f; + quad.topDepth = topDepth + 0.00003f; + } else { + quad.bottomDepth = bottomDepth; + quad.topDepth = topDepth; + } + break; } - } else if (g_cameraDistance < robeTopLayerThreshold) { - bottom = bottomDepth + 0.000025f; - top = topDepth + 0.000025f; } break; case 2: @@ -70,105 +138,48 @@ void CCharacterRender::OffsetAccessoryLayerDepth(int layer, SpriteCellQuad& quad case 1478: case 1499: if (g_cameraDistance < robeTopLayerThreshold) { - bottom = 0.0008f + bottomDepth; - top = 0.0008f + topDepth; + quad.bottomDepth = 0.0008f + bottomDepth; + quad.topDepth = 0.0008f + topDepth; } else { - bottom = 0.00019f + bottomDepth; - top = 0.00019f + topDepth; + quad.bottomDepth = 0.00019f + bottomDepth; + quad.topDepth = 0.00019f + topDepth; } break; case 1235: if (g_cameraDistance < robeTopLayerThreshold) { - bottom = 0.0008f + bottomDepth; - top = 0.0008f + topDepth; + quad.bottomDepth = 0.0008f + bottomDepth; + quad.topDepth = 0.0008f + topDepth; } else { - bottom = 0.00013f + bottomDepth; - top = 0.00013f + topDepth; + quad.bottomDepth = 0.00013f + bottomDepth; + quad.topDepth = 0.00013f + topDepth; } break; case 1488: if (g_cameraDistance < robeTopLayerThreshold) { - bottom = bottomDepth + 0.0008f; - top = topDepth + 0.0008f; + quad.bottomDepth = bottomDepth + 0.0008f; + quad.topDepth = topDepth + 0.0008f; } else { - bottom = bottomDepth + 0.00019f; - top = topDepth + 0.00019f; + quad.bottomDepth = bottomDepth + 0.00019f; + quad.topDepth = topDepth + 0.00019f; } break; default: if (g_cameraDistance < robeTopLayerThreshold) { - bottom = bottomDepth + 0.000027f; - top = topDepth + 0.000027f; + quad.bottomDepth = bottomDepth + 0.000027f; + quad.topDepth = topDepth + 0.000027f; + } else { + quad.bottomDepth = bottomDepth; + quad.topDepth = topDepth; } break; } break; - case 3: - if (g_cameraDistance < robeTopLayerThreshold) { - bottom = bottomDepth + 0.00004f; - top = 0.0001f + topDepth; - } else { - top = 0.000045f + topDepth; - } - break; - case 4: - if (this->upperHeadgear == 1485) { - if (g_cameraDistance < robeTopLayerThreshold) { - bottom = 0.00035f + bottomDepth; - top = 0.0006f + topDepth; - } else { - bottom = 0.00001f + bottomDepth; - top = 0.00015f + topDepth; - } - } else { - switch (this->middleHeadgear) { - case 1318: - if (g_cameraDistance < robeTopLayerThreshold) { - bottom = 0.00025f + bottomDepth; - top = 0.0001f + topDepth; - } else { - bottom = 0.00005f + bottomDepth; - top = 0.00005f + topDepth; - } - break; - case 1354: - if (g_cameraDistance < robeTopLayerThreshold) { - bottom = bottomDepth + 0.00009f; - top = topDepth - 0.00005f; - } - break; - case 1363: - if (g_cameraDistance < robeTopLayerThreshold) { - bottom = bottomDepth + 0.000027f + 0.0004f; - top = topDepth + 0.000027f + 0.0007f; - } else { - bottom = bottomDepth + 0.00007f; - top = topDepth + 0.00017f; - } - break; - case 1582: - if (g_cameraDistance < robeTopLayerThreshold) { - bottom = bottomDepth + 0.0002f; - top = topDepth + 0.0002f; - } else { - bottom = bottomDepth + 0.00004f; - top = topDepth + 0.00006f; - } - break; - default: - if (g_cameraDistance < robeTopLayerThreshold) { - bottom = bottomDepth + 0.00003f; - top = topDepth + 0.00003f; - } - break; - } - } + default: + quad.bottomDepth = bottomDepth; + quad.topDepth = topDepth; break; } - quad.bottomDepth = bottom; - quad.topDepth = top; - bool enabled = false; double nearOffset = 0.0; double farOffset = 0.0;