Skip to content

Commit

Permalink
Merge pull request #2134 from momoko-h/AnimatedProgressBar
Browse files Browse the repository at this point in the history
Remove SetProgressBarTextDisplayFlag
  • Loading branch information
lynxlynxlynx authored Dec 15, 2024
2 parents a906155 + f412b0d commit df32818
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 59 deletions.
10 changes: 5 additions & 5 deletions src/game/SaveLoadGame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,27 +163,27 @@ BOOLEAN HasSaveGameExtension(const ST::string &fileName) {

ST::string GetAutoSaveName(uint32_t index) {
return ST::format("{}{02}", g_autosave_prefix, index);
};
}

BOOLEAN IsAutoSaveName(const ST::string &saveName) {
return std::regex_match(saveName.c_str(), g_autosave_regex);
}

ST::string GetQuickSaveName() {
return g_quicksave_name;
};
}

BOOLEAN IsQuickSaveName(const ST::string &saveName) {
return saveName.compare(g_quicksave_name, ST::case_insensitive) == 0;
};
}

BOOLEAN IsErrorSaveName(const ST::string &saveName) {
return saveName.compare(g_error_save_name, ST::case_insensitive) == 0;
};
}

ST::string GetErrorSaveName() {
return g_error_save_name;
};
}


static void ExtractGameOptions(DataReader& d, GAME_OPTIONS& g)
Expand Down
48 changes: 1 addition & 47 deletions src/game/Utils/Animated_ProgressBar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
#include "VObject.h"
#include "VSurface.h"
#include "Video.h"
#include "Render_Dirty.h"
#include "Music_Control.h"
#include "Timer_Control.h"
#include "SysUtil.h"
#include "UILayout.h"

#include <string_theory/string>
Expand All @@ -22,8 +20,6 @@ enum ProgressBarFlags
{
PROGRESS_NONE = 0,
PROGRESS_PANEL = 1 << 0,
PROGRESS_DISPLAY_TEXT = 1 << 1,
PROGRESS_USE_SAVEBUFFER = 1 << 2, // use the save buffer when display the text
PROGRESS_LOAD_BAR = 1 << 3
};
ENUM_BITSET(ProgressBarFlags)
Expand Down Expand Up @@ -162,7 +158,7 @@ void RemoveProgressBar( UINT8 ubID )
* the 100% mark within UpdateProgressBar. At that time, you would go onto the
* next step, resetting the relative start and end percentage from 30 to
* whatever, until your done. */
void SetRelativeStartAndEndPercentage(UINT8 id, UINT32 uiRelStartPerc, UINT32 uiRelEndPerc, const ST::string& str)
void SetRelativeStartAndEndPercentage(UINT8 id, UINT32 uiRelStartPerc, UINT32 uiRelEndPerc, ST::string const&)
{
Assert(id < MAX_PROGRESSBARS);
PROGRESSBAR* const bar = pBar[id];
Expand Down Expand Up @@ -190,21 +186,6 @@ void SetRelativeStartAndEndPercentage(UINT8 id, UINT32 uiRelStartPerc, UINT32 ui
MPrint(x, t + 3, bar->title);
}
}

if (bar->flags & PROGRESS_DISPLAY_TEXT && !str.empty())
{ // Draw message
INT32 const x = bar->pos.x;
INT32 const y = bar->pos.y + bar->pos.h;
SGPFont const font = bar->usMsgFont;
if (bar->flags & PROGRESS_USE_SAVEBUFFER)
{
UINT16 const h = GetFontHeight(font);
RestoreExternBackgroundRect(x, y, bar->pos.w, h + 3);
}

SetFontAttributes(font, bar->ubMsgFontForeColor, bar->ubMsgFontShadowColor);
MPrint(x, y + 3, str);
}
}


Expand Down Expand Up @@ -282,30 +263,3 @@ void SetProgressBarColor( UINT8 ubID, UINT8 ubColorFillRed, UINT8 ubColorFillGre

pCurr->fill_colour = FROMRGB(ubColorFillRed, ubColorFillGreen, ubColorFillBlue);
}


void SetProgressBarTextDisplayFlag( UINT8 ubID, BOOLEAN fDisplayText, BOOLEAN fUseSaveBuffer, BOOLEAN fSaveScreenToFrameBuffer )
{
PROGRESSBAR *pCurr=NULL;


Assert( ubID < MAX_PROGRESSBARS );

pCurr = pBar[ubID];
if( pCurr == NULL )
return;

ProgressBarFlags flags = pCurr->flags & ~(PROGRESS_DISPLAY_TEXT | PROGRESS_USE_SAVEBUFFER);
if (fDisplayText) flags |= PROGRESS_DISPLAY_TEXT;
if (fUseSaveBuffer) flags |= PROGRESS_USE_SAVEBUFFER;
pCurr->flags = flags;

//if we are to use the save buffer, blit the portion of the screen to the save buffer
if( fSaveScreenToFrameBuffer )
{
UINT16 usFontHeight = GetFontHeight( pCurr->usMsgFont )+3;

//blit everything to the save buffer ( cause the save buffer can bleed through )
BlitBufferToBuffer(FRAME_BUFFER, guiSAVEBUFFER, pCurr->pos.x, pCurr->pos.y + pCurr->pos.h, pCurr->pos.w, usFontHeight);
}
}
8 changes: 1 addition & 7 deletions src/game/Utils/Animated_ProgressBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

#include "Types.h"

#include <string_theory/string>


void CreateLoadingScreenProgressBar(void);
void RemoveLoadingScreenProgressBar(void);

Expand Down Expand Up @@ -39,7 +36,7 @@ void RemoveProgressBar( UINT8 ubID );
//As the process animates using UpdateProgressBar( 0 to 100 ), the total progress bar will only reach 30%
//at the 100% mark within UpdateProgressBar. At that time, you would go onto the next step, resetting the
//relative start and end percentage from 30 to whatever, until your done.
void SetRelativeStartAndEndPercentage(UINT8 id, UINT32 uiRelStartPerc, UINT32 uiRelEndPerc, const ST::string& str);
void SetRelativeStartAndEndPercentage(UINT8 id, UINT32 uiRelStartPerc, UINT32 uiRelEndPerc, ST::string const& unused);

//This part renders the progress bar at the percentage level that you specify. If you have set relative
//percentage values in the above function, then the uiPercentage will be reflected based off of the relative
Expand All @@ -50,7 +47,4 @@ void RenderProgressBar( UINT8 ubID, UINT32 uiPercentage );
//Sets the color of the progress bars main color.
void SetProgressBarColor( UINT8 ubID, UINT8 ubColorFillRed, UINT8 ubColorFillGreen, UINT8 ubColorFillBlue );

//Pass in TRUE to display the strings.
void SetProgressBarTextDisplayFlag( UINT8 ubID, BOOLEAN fDisplayText, BOOLEAN fUseSaveBuffer, BOOLEAN fSaveScreenToFrameBuffer );

#endif

0 comments on commit df32818

Please sign in to comment.