Decompile fn_10103 (SpriteDrawingPolicy::OffsetLayerDepth)
Batch #1871 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_10103 SpriteDrawingPolicy::OffsetLayerDepth: logic confirmed by peer review Reviewed-by: ragnarok-clanker Adds to the build: Source/Contents/SpriteLayerDepth.cpp
This commit is contained in:
parent
5c0eb3d28b
commit
3950b1196e
4 changed files with 45 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ struct SpriteDrawingPolicy {
|
|||
int unused, int layer, float scale, const SpriteFrameCell& cell, float x, float y, const float* position, float shift, float& bottomDepth,
|
||||
float& topDepth, const SpriteRleImage& image, SpriteCellQuad& quad, tagRECT& bounds, SpriteColor& color, int offsetX, int offsetY, int flags
|
||||
) const;
|
||||
void OffsetLayerDepth(int layer, SpriteCellQuad& quad, float bottomDepth, float topDepth) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
struct WorldScene;
|
||||
|
||||
extern float g_cameraDistance;
|
||||
|
||||
class CView {
|
||||
public:
|
||||
/* 0000 */ void* vtable;
|
||||
|
|
|
|||
41
Source/Contents/SpriteLayerDepth.cpp
Normal file
41
Source/Contents/SpriteLayerDepth.cpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#include "Contents/Actors/SpriteDrawingPolicy.h"
|
||||
#include "Contents/Camera/Camera.h"
|
||||
#include "Render/SpriteGeometry.h"
|
||||
|
||||
constexpr float robeTopLayerThreshold = 320.0f;
|
||||
|
||||
// GLOBAL: gl_24739
|
||||
float g_cameraDistance = 300.0f;
|
||||
|
||||
// OFFSET: 0x0080DAA0
|
||||
// FUNCTION: fn_10103
|
||||
void SpriteDrawingPolicy::OffsetLayerDepth(int layer, SpriteCellQuad& quad, float bottomDepth, float topDepth) const {
|
||||
switch (layer) {
|
||||
case 2:
|
||||
if (g_cameraDistance < robeTopLayerThreshold) {
|
||||
quad.bottomDepth = bottomDepth + 0.000027f;
|
||||
quad.topDepth = topDepth + 0.000027f;
|
||||
} else {
|
||||
quad.bottomDepth = bottomDepth;
|
||||
quad.topDepth = topDepth;
|
||||
}
|
||||
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 (g_cameraDistance < robeTopLayerThreshold) {
|
||||
bottomDepth += 0.00003f;
|
||||
topDepth += 0.00003f;
|
||||
}
|
||||
quad.bottomDepth = bottomDepth;
|
||||
quad.topDepth = topDepth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -428,6 +428,7 @@
|
|||
"Source/Contents/Sound/SoundMgr.cpp": 4,
|
||||
"Source/Contents/SpriteFrameSynchronization.cpp": 4,
|
||||
"Source/Contents/SpriteJob.cpp": 4,
|
||||
"Source/Contents/SpriteLayerDepth.cpp": 4,
|
||||
"Source/Contents/SpriteLayerOrder.cpp": 4,
|
||||
"Source/Contents/SpriteRidingPolicy.cpp": 4,
|
||||
"Source/Contents/Store/MCStoreInfoBackup.cpp": 4,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue