mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-18 23:21:41 +00:00
- completed scriptification of LoadSaveMenu.
This commit is contained in:
parent
e46d378fb2
commit
6a65f02257
2 changed files with 94 additions and 134 deletions
|
@ -72,6 +72,7 @@ FSavegameManager::~FSavegameManager()
|
||||||
{
|
{
|
||||||
ClearSaveGames();
|
ClearSaveGames();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//
|
//
|
||||||
// Save data maintenance
|
// Save data maintenance
|
||||||
|
@ -313,6 +314,14 @@ void FSavegameManager::ReadSaveStrings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(FSavegameManager, ReadSaveStrings)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(FSavegameManager);
|
||||||
|
self->ReadSaveStrings();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -579,6 +588,12 @@ void FSavegameManager::ClearSaveStuff()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(FSavegameManager, ClearSaveStuff)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(FSavegameManager);
|
||||||
|
self->ClearSaveStuff();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//
|
//
|
||||||
|
@ -751,94 +766,12 @@ DEFINE_ACTION_FUNCTION(FSavegameManager, RemoveNewSaveNode)
|
||||||
|
|
||||||
FSavegameManager savegameManager;
|
FSavegameManager savegameManager;
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(FSavegameManager, GetManager)
|
||||||
|
|
||||||
|
|
||||||
class DLoadSaveMenu : public DListMenu
|
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(DLoadSaveMenu, DListMenu)
|
PARAM_PROLOGUE;
|
||||||
|
ACTION_RETURN_POINTER(&savegameManager);
|
||||||
public:
|
|
||||||
|
|
||||||
FSavegameManager *manager;
|
|
||||||
|
|
||||||
int Selected;
|
|
||||||
int TopItem;
|
|
||||||
|
|
||||||
|
|
||||||
int savepicLeft;
|
|
||||||
int savepicTop;
|
|
||||||
int savepicWidth;
|
|
||||||
int savepicHeight;
|
|
||||||
int rowHeight;
|
|
||||||
int listboxLeft;
|
|
||||||
int listboxTop;
|
|
||||||
int listboxWidth;
|
|
||||||
|
|
||||||
int listboxRows;
|
|
||||||
int listboxHeight;
|
|
||||||
int listboxRight;
|
|
||||||
int listboxBottom;
|
|
||||||
|
|
||||||
int commentLeft;
|
|
||||||
int commentTop;
|
|
||||||
int commentWidth;
|
|
||||||
int commentHeight;
|
|
||||||
int commentRight;
|
|
||||||
int commentBottom;
|
|
||||||
|
|
||||||
bool mEntering;
|
|
||||||
DTextEnterMenu *mInput = nullptr;
|
|
||||||
|
|
||||||
DLoadSaveMenu(DMenu *parent = nullptr, DListMenuDescriptor *desc = nullptr);
|
|
||||||
void OnDestroy() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS(DLoadSaveMenu, false, false)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//
|
|
||||||
// End of static savegame maintenance code
|
|
||||||
//
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
DLoadSaveMenu::DLoadSaveMenu(DMenu *parent, DListMenuDescriptor *desc)
|
|
||||||
: DListMenu(parent, desc)
|
|
||||||
{
|
|
||||||
manager = &savegameManager;
|
|
||||||
manager->ReadSaveStrings();
|
|
||||||
|
|
||||||
savepicLeft = 10;
|
|
||||||
savepicTop = 54*CleanYfac;
|
|
||||||
savepicWidth = 216*screen->GetWidth()/640;
|
|
||||||
savepicHeight = 135*screen->GetHeight()/400;
|
|
||||||
manager->WindowSize = savepicWidth / CleanXfac;
|
|
||||||
|
|
||||||
rowHeight = (SmallFont->GetHeight() + 1) * CleanYfac;
|
|
||||||
listboxLeft = savepicLeft + savepicWidth + 14;
|
|
||||||
listboxTop = savepicTop;
|
|
||||||
listboxWidth = screen->GetWidth() - listboxLeft - 10;
|
|
||||||
int listboxHeight1 = screen->GetHeight() - listboxTop - 10;
|
|
||||||
listboxRows = (listboxHeight1 - 1) / rowHeight;
|
|
||||||
listboxHeight = listboxRows * rowHeight + 1;
|
|
||||||
listboxRight = listboxLeft + listboxWidth;
|
|
||||||
listboxBottom = listboxTop + listboxHeight;
|
|
||||||
|
|
||||||
commentLeft = savepicLeft;
|
|
||||||
commentTop = savepicTop + savepicHeight + 16;
|
|
||||||
commentWidth = savepicWidth;
|
|
||||||
commentHeight = (51+(screen->GetHeight()>200?10:0))*CleanYfac;
|
|
||||||
commentRight = commentLeft + commentWidth;
|
|
||||||
commentBottom = commentTop + commentHeight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DLoadSaveMenu::OnDestroy()
|
|
||||||
{
|
|
||||||
manager->ClearSaveStuff ();
|
|
||||||
Super::OnDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DEFINE_FIELD(FSaveGameNode, SaveTitle);
|
DEFINE_FIELD(FSaveGameNode, SaveTitle);
|
||||||
|
@ -850,26 +783,3 @@ DEFINE_FIELD(FSaveGameNode, bNoDelete);
|
||||||
DEFINE_FIELD(FSavegameManager, WindowSize);
|
DEFINE_FIELD(FSavegameManager, WindowSize);
|
||||||
DEFINE_FIELD(FSavegameManager, quickSaveSlot);
|
DEFINE_FIELD(FSavegameManager, quickSaveSlot);
|
||||||
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, manager);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, Selected);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, TopItem);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, savepicLeft);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, savepicTop);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, savepicWidth);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, savepicHeight);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, rowHeight);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, listboxLeft);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, listboxTop);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, listboxWidth);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, listboxRows);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, listboxHeight);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, listboxRight);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, listboxBottom);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, commentLeft);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, commentTop);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, commentWidth);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, commentHeight);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, commentRight);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, commentBottom);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, mEntering);
|
|
||||||
DEFINE_FIELD(DLoadSaveMenu, mInput);
|
|
||||||
|
|
|
@ -48,14 +48,15 @@ struct SavegameManager native
|
||||||
native int WindowSize;
|
native int WindowSize;
|
||||||
native SaveGameNode quickSaveSlot;
|
native SaveGameNode quickSaveSlot;
|
||||||
|
|
||||||
//void ReadSaveStrings();
|
native static SavegameManager GetManager();
|
||||||
|
native void ReadSaveStrings();
|
||||||
native void UnloadSaveData();
|
native void UnloadSaveData();
|
||||||
|
|
||||||
native int RemoveSaveSlot(int index);
|
native int RemoveSaveSlot(int index);
|
||||||
native void LoadSavegame(int Selected);
|
native void LoadSavegame(int Selected);
|
||||||
native void DoSave(int Selected, String savegamestring);
|
native void DoSave(int Selected, String savegamestring);
|
||||||
native int ExtractSaveData(int index);
|
native int ExtractSaveData(int index);
|
||||||
//void ClearSaveStuff();
|
native void ClearSaveStuff();
|
||||||
native bool DrawSavePic(int x, int y, int w, int h);
|
native bool DrawSavePic(int x, int y, int w, int h);
|
||||||
native void DrawSaveComment(Font font, int cr, int x, int y, int scalefactor);
|
native void DrawSaveComment(Font font, int cr, int x, int y, int scalefactor);
|
||||||
native void SetFileInfo(int Selected);
|
native void SetFileInfo(int Selected);
|
||||||
|
@ -68,37 +69,86 @@ struct SavegameManager native
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class LoadSaveMenu : ListMenu native
|
class LoadSaveMenu : ListMenu
|
||||||
{
|
{
|
||||||
native SavegameManager manager;
|
SavegameManager manager;
|
||||||
native int TopItem;
|
int TopItem;
|
||||||
native int Selected;
|
int Selected;
|
||||||
|
|
||||||
native int savepicLeft;
|
int savepicLeft;
|
||||||
native int savepicTop;
|
int savepicTop;
|
||||||
native int savepicWidth;
|
int savepicWidth;
|
||||||
native int savepicHeight;
|
int savepicHeight;
|
||||||
native int rowHeight;
|
int rowHeight;
|
||||||
native int listboxLeft;
|
int listboxLeft;
|
||||||
native int listboxTop;
|
int listboxTop;
|
||||||
native int listboxWidth;
|
int listboxWidth;
|
||||||
|
|
||||||
native int listboxRows;
|
int listboxRows;
|
||||||
native int listboxHeight;
|
int listboxHeight;
|
||||||
native int listboxRight;
|
int listboxRight;
|
||||||
native int listboxBottom;
|
int listboxBottom;
|
||||||
|
|
||||||
native int commentLeft;
|
int commentLeft;
|
||||||
native int commentTop;
|
int commentTop;
|
||||||
native int commentWidth;
|
int commentWidth;
|
||||||
native int commentHeight;
|
int commentHeight;
|
||||||
native int commentRight;
|
int commentRight;
|
||||||
native int commentBottom;
|
int commentBottom;
|
||||||
|
|
||||||
native bool mEntering;
|
bool mEntering;
|
||||||
native TextEnterMenu mInput;
|
TextEnterMenu mInput;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
override void Init(Menu parent, ListMenuDescriptor desc)
|
||||||
|
{
|
||||||
|
Super.Init(parent, desc);
|
||||||
|
manager = SavegameManager.GetManager();
|
||||||
|
manager.ReadSaveStrings();
|
||||||
|
|
||||||
|
savepicLeft = 10;
|
||||||
|
savepicTop = 54*CleanYfac;
|
||||||
|
savepicWidth = 216*screen.GetWidth()/640;
|
||||||
|
savepicHeight = 135*screen.GetHeight()/400;
|
||||||
|
manager.WindowSize = savepicWidth / CleanXfac;
|
||||||
|
|
||||||
|
rowHeight = (SmallFont.GetHeight() + 1) * CleanYfac;
|
||||||
|
listboxLeft = savepicLeft + savepicWidth + 14;
|
||||||
|
listboxTop = savepicTop;
|
||||||
|
listboxWidth = screen.GetWidth() - listboxLeft - 10;
|
||||||
|
int listboxHeight1 = screen.GetHeight() - listboxTop - 10;
|
||||||
|
listboxRows = (listboxHeight1 - 1) / rowHeight;
|
||||||
|
listboxHeight = listboxRows * rowHeight + 1;
|
||||||
|
listboxRight = listboxLeft + listboxWidth;
|
||||||
|
listboxBottom = listboxTop + listboxHeight;
|
||||||
|
|
||||||
|
commentLeft = savepicLeft;
|
||||||
|
commentTop = savepicTop + savepicHeight + 16;
|
||||||
|
commentWidth = savepicWidth;
|
||||||
|
commentHeight = (51+(screen.GetHeight()>200?10:0))*CleanYfac;
|
||||||
|
commentRight = commentLeft + commentWidth;
|
||||||
|
commentBottom = commentTop + commentHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
override void OnDestroy()
|
||||||
|
{
|
||||||
|
manager.ClearSaveStuff ();
|
||||||
|
Super.OnDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue