mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Code edits to ExtraSaveSlots.cpp
* the page numbering is now 0-indexed, to better align with the macros. Re-numbered save slot control metarules.
This commit is contained in:
+6
-5
@@ -145,7 +145,7 @@ OverrideMusicDir=1
|
||||
|
||||
;Set to 1 to automatically search for new SFX sound files at game startup
|
||||
;Note: With this option enabled, you will no longer need to use the utility regsnd.exe to register new SFX sounds
|
||||
;This will slightly increase the startup time of the game
|
||||
;This will slightly increase the startup time of the game on older computers
|
||||
AutoSearchSFX=1
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
@@ -231,7 +231,7 @@ DebugEditorKey=0
|
||||
Fallout1Behavior=0
|
||||
|
||||
;Time limit in years. Must be between -3 and 13
|
||||
;Set to 0 if you want to die the instant you leave arroyo
|
||||
;Set to 0 if you want to die the instant you leave Arroyo
|
||||
;Set to -1 to remove the time limit, and automatically reset the date back to 2241 each time you would have reached it
|
||||
;Set to -2 or -3 to remove the time limit, automatically reset the date, but override Fallout's GetDate function to return the correct year
|
||||
TimeLimit=13
|
||||
@@ -500,11 +500,12 @@ UseScrollingQuestsList=1
|
||||
ExtraSaveSlots=0
|
||||
|
||||
;To use more than one save slot for quick saving (F6 key) without picking a slot beforehand, set the next two lines
|
||||
;Quick save will cyclically overwrite saves from the first slot on the specified page to the last slot on the n-th page
|
||||
;AutoQuickSave sets how many pages you want to use for quick saving (valid range: 1..10)
|
||||
;AutoQuickSavePage is the page number to start at (valid range: 1..1000, if ExtraSaveSlots is enabled)
|
||||
;The quick saves will be rotated from the first slot on the page to the last slot on the n-th page
|
||||
;Set to 0 to disable. AutoQuickSave will use the current selected page if AutoQuickSavePage is disabled
|
||||
;Set to 0 to disable
|
||||
AutoQuickSave=0
|
||||
;AutoQuickSavePage is the page number to start at if ExtraSaveSlots is enabled (valid range: 0..999)
|
||||
;Set to -1 to use the current selected page (not recommended)
|
||||
AutoQuickSavePage=1
|
||||
|
||||
;Set to 1 to speed up the HP/AC counter animations
|
||||
|
||||
@@ -409,11 +409,11 @@
|
||||
#define clear_keyboard_buffer metarule3(201, 0, 0, 0)
|
||||
|
||||
// functions to control the save slot
|
||||
// Note: page and slot here are 0-indexed instead of 1-indexed displayed in game
|
||||
#define get_current_save_slot metarule3(1000, 0, 0, 0) // returns the amount: page + slot
|
||||
#define set_current_save_slot(page, slot) metarule3(1001, page, slot, 0)
|
||||
#define get_current_quick_save_page metarule3(1002, 0, 0, 0)
|
||||
#define get_current_quick_save_slot metarule3(1003, 0, 0, 0)
|
||||
#define set_current_quick_save_slot(page, slot, check) metarule3(1004, page, slot, check) // check: 1 - don't check slot when saving
|
||||
// Note: slot value here is 0-indexed instead of 1-indexed displayed in game and used for folder names
|
||||
#define get_current_save_slot metarule3(210, 0, 0, 0) // returns the amount: page + slot
|
||||
#define set_current_save_slot(page, slot) metarule3(211, page, slot, 0)
|
||||
#define get_current_quick_save_page metarule3(212, 0, 0, 0)
|
||||
#define get_current_quick_save_slot metarule3(213, 0, 0, 0)
|
||||
#define set_current_quick_save_slot(page, slot, check) metarule3(214, page, slot, check) // check: 1 - don't check slot when saving
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,7 @@ long ExtraSaveSlots::GetSaveSlot() {
|
||||
}
|
||||
|
||||
void ExtraSaveSlots::SetSaveSlot(long page, long slot) {
|
||||
if (GetQuickSavePage() >= 0 && page >= 0 && page <= 9990) LSPageOffset = page - (page % 10);;
|
||||
if (page >= 0 && page <= 9990) LSPageOffset = page - (page % 10);
|
||||
if (slot >= 0 && slot < 10) fo::var::slot_cursor = slot;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ static long save_page_offsets() {
|
||||
return fo::var::lsgwin; // restore original code
|
||||
}
|
||||
|
||||
// load last slot position values from file
|
||||
static void LoadPageOffsets() {
|
||||
char LoadPath[MAX_PATH];
|
||||
|
||||
@@ -73,7 +74,6 @@ static void LoadPageOffsets() {
|
||||
|
||||
static void __declspec(naked) load_page_offsets(void) {
|
||||
__asm {
|
||||
// load last slot position values from file
|
||||
call LoadPageOffsets;
|
||||
mov edx, 0x50A480; // ASCII "SAV" (restore original code)
|
||||
retn;
|
||||
@@ -110,13 +110,13 @@ static void SetPageNum() {
|
||||
BYTE ConsoleGold = fo::var::YellowColor; // palette offset stored in mem - text colour
|
||||
|
||||
char tempText[32];
|
||||
unsigned int TxtMaxWidth = fo::GetMaxCharWidth() * 8; // GetTextWidth(tempText);
|
||||
unsigned int TxtMaxWidth = fo::GetMaxCharWidth() * 6; // GetTextWidth(tempText);
|
||||
unsigned int HalfMaxWidth = TxtMaxWidth / 2;
|
||||
unsigned int TxtWidth = 0;
|
||||
|
||||
DWORD NewTick = 0, OldTick = 0;
|
||||
int button = 0, exitFlag = 0, numpos = 0;
|
||||
char Number[5], blip = '_';
|
||||
char Number[4], blip = '_';
|
||||
|
||||
DWORD tempPageOffset = -1;
|
||||
|
||||
@@ -136,14 +136,14 @@ static void SetPageNum() {
|
||||
if (tempPageOffset == -1) {
|
||||
sprintf_s(tempText, 32, "[ %c ]", '_');
|
||||
} else {
|
||||
sprintf_s(tempText, 32, "[ %d%c ]", tempPageOffset / 10 + 1, '_');
|
||||
sprintf_s(tempText, 32, "[ %d%c ]", tempPageOffset / 10, '_');
|
||||
}
|
||||
TxtWidth = fo::GetTextWidth(tempText);
|
||||
|
||||
if (tempPageOffset == -1) {
|
||||
sprintf_s(tempText, 32, "[ %c", blip);
|
||||
} else {
|
||||
sprintf_s(tempText, 32, "[ %d%c", tempPageOffset / 10 + 1, blip);
|
||||
sprintf_s(tempText, 32, "[ %d%c", tempPageOffset / 10, blip);
|
||||
}
|
||||
|
||||
int z = 0;
|
||||
@@ -161,15 +161,15 @@ static void SetPageNum() {
|
||||
|
||||
button = fo::func::get_input();
|
||||
if (button >= '0' && button <= '9') {
|
||||
if (numpos < 4) {
|
||||
if (numpos < 3) {
|
||||
Number[numpos] = button;
|
||||
Number[numpos + 1] = '\0';
|
||||
numpos++;
|
||||
if (Number[0] == '0') {
|
||||
numpos = 0;
|
||||
tempPageOffset = -1;
|
||||
tempPageOffset = 0;
|
||||
} else {
|
||||
tempPageOffset = (atoi(Number) - 1) * 10;
|
||||
tempPageOffset = (atoi(Number)) * 10;
|
||||
}
|
||||
}
|
||||
//else exitFlag=-1;
|
||||
@@ -179,7 +179,7 @@ static void SetPageNum() {
|
||||
if (!numpos) {
|
||||
tempPageOffset = -1;
|
||||
} else {
|
||||
tempPageOffset = (atoi(Number) - 1) * 10;
|
||||
tempPageOffset = (atoi(Number)) * 10;
|
||||
}
|
||||
} else if (button == 0x0D || button == 0x20 || button == 'p' || button == 'P') {
|
||||
exitFlag = -1; // Enter, Space or P Keys
|
||||
@@ -276,7 +276,7 @@ static void DrawPageText() {
|
||||
BYTE Colour = ConsoleGreen;
|
||||
|
||||
char tempText[32];
|
||||
sprintf_s(tempText, 32, "[ %d ]", LSPageOffset / 10 + 1);
|
||||
sprintf_s(tempText, 32, "[ %d ]", LSPageOffset / 10);
|
||||
|
||||
unsigned int TxtWidth = fo::GetTextWidth(tempText);
|
||||
fo::PrintText(tempText, Colour, 170 - TxtWidth / 2, 64, TxtWidth, SaveLoadWin->width, SaveLoadWin->surface);
|
||||
@@ -457,9 +457,9 @@ static DWORD __stdcall QuickSaveGame(fo::DbFile* file, char* filename) {
|
||||
return 0x47B929; // check next slot
|
||||
}
|
||||
currSlot = 0; // set if currSlot >= 9
|
||||
qFirst = false;
|
||||
}
|
||||
}
|
||||
qFirst = false;
|
||||
// next save slot
|
||||
if (++quickSaveSlot >= 10) {
|
||||
quickSaveSlot = 0;
|
||||
@@ -498,10 +498,17 @@ static void __declspec(naked) SaveGame_hack0() {
|
||||
|
||||
static void __declspec(naked) SaveGame_hack1() {
|
||||
__asm {
|
||||
mov eax, quickSaveSlot;
|
||||
mov ds:[FO_VAR_slot_cursor], eax;
|
||||
mov eax, quickSavePage;
|
||||
mov LSPageOffset, eax;
|
||||
mov eax, quickSavePage;
|
||||
test eax, eax;
|
||||
js skip;
|
||||
mov LSPageOffset, eax;
|
||||
mov eax, quickSaveSlot;
|
||||
mov ds:[FO_VAR_slot_cursor], eax;
|
||||
retn;
|
||||
skip: // if AutoQuickSavePage is disabled (set to less than 0)
|
||||
xor eax, eax;
|
||||
mov quickSaveSlot, eax;
|
||||
mov ds:[FO_VAR_slot_cursor], eax;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -515,7 +522,11 @@ long ExtraSaveSlots::GetQuickSaveSlot() {
|
||||
}
|
||||
|
||||
void ExtraSaveSlots::SetQuickSaveSlot(long page, long slot, long check) {
|
||||
if (quickSavePage >= 0 && page >= 0 && page <= 9990) quickSavePage = page - (page % 10);
|
||||
if (page < 0) {
|
||||
quickSavePage = -1;
|
||||
} else if (page <= 9990) {
|
||||
quickSavePage = page - (page % 10);
|
||||
}
|
||||
if (slot >= 0 && slot < 10) quickSaveSlot = slot;
|
||||
dontCheckSlot = check;
|
||||
}
|
||||
@@ -534,17 +545,14 @@ void ExtraSaveSlots::init() {
|
||||
if (quickSavePageCount > 10) quickSavePageCount = 10;
|
||||
|
||||
quickSavePage = IniReader::GetConfigInt("Misc", "AutoQuickSavePage", 1);
|
||||
if (quickSavePage > 1000) quickSavePage = 1000;
|
||||
if (quickSavePage > 999) quickSavePage = 999;
|
||||
|
||||
if (extraSaveSlots && quickSavePage > 0) {
|
||||
quickSavePage = (quickSavePage - 1) * 10;
|
||||
if (extraSaveSlots && quickSavePage >= 0) {
|
||||
quickSavePage *= 10;
|
||||
quickSavePageInit = quickSavePage;
|
||||
MakeCall(0x47B923, SaveGame_hack1, 1);
|
||||
} else { // for quickSavePage == 0
|
||||
SafeWrite8(0x47B923, 0x89);
|
||||
SafeWrite32(0x47B924, 0x5193B83D); // mov [slot_cursor], edi = 0
|
||||
}
|
||||
MakeJump(0x47B984, SaveGame_hack0);
|
||||
MakeCall(0x47B923, SaveGame_hack1, 1);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,14 +37,14 @@ static bool HorriganEncounterDisabled = false;
|
||||
enum class MetaruleFunction : long {
|
||||
SET_HORRIGAN_ENCOUNTER = 200, // sets the number of days for the Frank Horrigan encounter or disable encounter
|
||||
CLEAR_KEYBOARD_BUFFER = 201, // clears the keyboard input buffer, should be used in the HOOK_KEYPRESS hook to clear keyboard events in some cases
|
||||
PARTY_ORDER_ATTACK = 999,
|
||||
|
||||
// save slot controls
|
||||
GET_CURRENT_SAVE_SLOT = 1000,
|
||||
SET_CURRENT_SAVE_SLOT = 1001,
|
||||
GET_CURRENT_QSAVE_PAGE = 1002,
|
||||
GET_CURRENT_QSAVE_SLOT = 1003,
|
||||
SET_CURRENT_QSAVE_SLOT = 1004,
|
||||
GET_CURRENT_SAVE_SLOT = 210,
|
||||
SET_CURRENT_SAVE_SLOT = 211,
|
||||
GET_CURRENT_QSAVE_PAGE = 212,
|
||||
GET_CURRENT_QSAVE_SLOT = 213,
|
||||
SET_CURRENT_QSAVE_SLOT = 214,
|
||||
|
||||
PARTY_ORDER_ATTACK = 999,
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user