Skip to content

Commit

Permalink
Don't use cache for loading HeroApp skilldex art (closes #555)
Browse files Browse the repository at this point in the history
- It uses the same path every time but swaps dat files...
  • Loading branch information
phobos2077 committed Jul 6, 2024
1 parent 2daf5b8 commit 92aab86
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions sfall/FalloutEngine/Structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions sfall/Modules/HeroAppearance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sfall/Modules/Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 92aab86

Please sign in to comment.