diff --git a/sfall/FalloutEngine/Structs.h b/sfall/FalloutEngine/Structs.h index 86f1ed2ed..76a808198 100644 --- a/sfall/FalloutEngine/Structs.h +++ b/sfall/FalloutEngine/Structs.h @@ -461,6 +461,8 @@ struct FrmFrameHeader { // sizeof 12 byte // structures for holding frms loaded with fallout2 functions struct FrmFrameData : FrmFrameHeader { // sizeof 12 + 1 byte BYTE data[1]; // begin frame image data + + BYTE* dataPtr() const { return (BYTE*)data; } }; // for one frame diff --git a/sfall/Modules/HeroAppearance.cpp b/sfall/Modules/HeroAppearance.cpp index 66ef7fe54..e382649d6 100644 --- a/sfall/Modules/HeroAppearance.cpp +++ b/sfall/Modules/HeroAppearance.cpp @@ -586,9 +586,12 @@ static void DrawCharNote(bool style, int winRef, DWORD xPosWin, DWORD yPosWin, B BYTE *PadSurface = new BYTE [280 * 168]; surface_draw(280, 168, widthBG, xPosBG, yPosBG, BGSurface, 280, 0, 0, PadSurface); - fo::FrmFile *frm = LoadUnlistedFrmCached((style) ? "AppStyle.frm" : "AppRace.frm", fo::OBJ_TYPE_SKILLDEX); - if (frm != nullptr) { - fo::util::DrawToSurface(frm->frameData[0].width, frm->frameData[0].height, 0, 0, frm->frameData[0].width, frm->frameData[0].data, 136, 37, 280, 168, PadSurface, 0); // cover buttons pics bottom + { + TempFrmHandle frmHandle{ LoadUnlistedFrm((style) ? "AppStyle.frm" : "AppRace.frm", fo::ArtType::OBJ_TYPE_SKILLDEX) }; + if (frmHandle.IsValid()) { + const fo::FrmFile& frm = frmHandle.Frm(); + fo::util::DrawToSurface(frm.frameData[0].width, frm.frameData[0].height, 0, 0, frm.frameData[0].width, frm.frameData[0].dataPtr(), 136, 37, 280, 168, PadSurface, 0); // cover buttons pics bottom + } } int oldFont = GetFont(); // store current font diff --git a/sfall/Modules/Interface.cpp b/sfall/Modules/Interface.cpp index b2f9ff90b..8a7e9e88d 100644 --- a/sfall/Modules/Interface.cpp +++ b/sfall/Modules/Interface.cpp @@ -141,7 +141,7 @@ static void DrawExtendedApBar() { constexpr int destOffsetTop = 10; const fo::FrmFrameData& srcFrame = frmHandle.Frm().frameData[0]; BYTE* dest = fo::var::interfaceBuffer + (win->width * (destOffsetTop + 1)) - destOffsetRight; - fo::func::buf_to_buf((BYTE*)srcFrame.data, srcFrame.width, srcFrame.height, srcFrame.width, dest, win->width); + fo::func::buf_to_buf(srcFrame.dataPtr(), srcFrame.width, srcFrame.height, srcFrame.width, dest, win->width); } static __declspec(naked) void intface_init_hook_unlock_iface_frm() {