Decompile fn_12087 (UIWindow::DrawRobeSprite)
Batch #6654 by kyoshi: 0 byte-identical, 1 confirmed by peer review. - fn_12087 UIWindow::DrawRobeSprite: logic confirmed by peer review Peer-reviewed-by: superintelligence, SapitoSucio, Bielhp Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
f1c816107c
commit
6afe994a42
2 changed files with 64 additions and 0 deletions
|
|
@ -1,11 +1,22 @@
|
|||
#include "Client/Session.h"
|
||||
#include "Contents/Configuration/ServiceConfiguration.h"
|
||||
#include "Contents/Skills/ClientSkills.h"
|
||||
#include "Render/DeviceContext/DeviceContext.h"
|
||||
#include "Render/Renderer.h"
|
||||
#include "Render/Textures/SpriteAtlas.h"
|
||||
#include "Render/Textures/SpritePixels.h"
|
||||
#include "Render/Textures/Texture.h"
|
||||
#include "Resource/Bitmap/BitmapResource.h"
|
||||
#include "Resource/ResourceMgr.h"
|
||||
#include "Resource/SkinPalette.h"
|
||||
#include "Resource/Sprites/ActionResource.h"
|
||||
#include "Resource/Sprites/SpriteResource.h"
|
||||
#include "Resource/TextureNames.h"
|
||||
#include "UI/Window/UIWindow.h"
|
||||
#include "UI/Window/WindowBorder.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <windows.h>
|
||||
|
||||
// OFFSET: 0x008D03E0
|
||||
|
|
@ -62,3 +73,55 @@ void UIWindow::DrawPanelBackgroundAt(int x, int y, int width, const char* bitmap
|
|||
this->FillRegion(x + 1, y, width - 2, height - y - 2, RGB(red, green, blue));
|
||||
this->FillRegion(x + 2, height - 2, width - 4, 1, RGB(red, green, blue));
|
||||
}
|
||||
|
||||
// OFFSET: 0x008D0680
|
||||
// FUNCTION: fn_12087
|
||||
void UIWindow::DrawRobeSprite(int job, int sex, int robe, int x, int y, bool overlay, int animation, int frame) {
|
||||
if (robe <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string sprName = g_session.GetRobeSprName(job, job, sex, robe, false, job);
|
||||
if (!ResourceMgr::Instance().Exists(sprName.c_str())) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string actName = g_session.GetRobeActName(job, job, sex, robe, false, job);
|
||||
if (!ResourceMgr::Instance().Exists(actName.c_str())) {
|
||||
return;
|
||||
}
|
||||
|
||||
CActRes* action = static_cast<CActRes*>(ResourceMgr::Instance().Load(actName.c_str()));
|
||||
CSprRes* sprite = static_cast<CSprRes*>(ResourceMgr::Instance().Load(sprName.c_str()));
|
||||
const SpriteFrameCell& cell = action->Frame(animation, frame).Cell(0);
|
||||
if (cell.image == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
SpriteAtlasRecord record{};
|
||||
record.u0 = 0.0f;
|
||||
record.v0 = 0.0f;
|
||||
const SpriteRleImage* image = sprite->images[cell.imageType][cell.image];
|
||||
CTexture* texture;
|
||||
if (cell.imageType == 0) {
|
||||
texture = g_renderer->atlas.Find(image, sprite->palette, record);
|
||||
if (!texture) {
|
||||
texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, sprite->palette, record, g_serviceType, g_resourceReuseDelay);
|
||||
}
|
||||
} else {
|
||||
texture = static_cast<CTexture*>(const_cast<void*>(image->unknown_0008));
|
||||
}
|
||||
|
||||
if (overlay) {
|
||||
const std::uint32_t color = this->Color();
|
||||
this->AddSpriteCellOverlay(
|
||||
x, y, reinterpret_cast<int>(action), reinterpret_cast<int>(sprite), image, &cell, GetSkillFactor(job), 0.0f, color, sprite->palette, 1.0f
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
this->geometry.surface->DrawSurface(
|
||||
x + cell.x, y + cell.y, texture, static_cast<int>(record.u0 * 256.0f), static_cast<int>(record.v0 * 256.0f), image->width, image->height,
|
||||
cell.mirrored != 0, static_cast<short>(image->unknown_0004) + 1, static_cast<short>(image->unknown_0006) + 1, 0, 0
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue