Improved the page control for ExtraSaveSlots

Minor edits to ddraw.ini.
This commit is contained in:
NovaRain
2021-08-11 14:09:39 +08:00
parent a34aa64ced
commit 34ae106fa5
3 changed files with 51 additions and 54 deletions
+3 -3
View File
@@ -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 also increase the loading time of the game
;This will slightly increase the startup time of the game
AutoSearchSFX=1
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@@ -268,7 +268,7 @@ WorldMapSlots=0
;To use a config file other than fallout2.cfg, uncomment the next line and add the name of your new file
;ConfigFile=
;Set to 1 to enable functions relating to overriding the file system
;Set to 1 to enable script functions relating to overriding the file system
UseFileSystemOverride=0
;To use a patch file other than patch000.dat, uncomment the next line and add your new file name
@@ -654,7 +654,7 @@ ExplosionsEmitLight=0
;Set to 1 to enable the new arrays behavior (default behavior)
;Set to 0 for backward compatibility with pre-3.4 scripts
arraysBehavior=1
ArraysBehavior=1
;Set to 1 to add proper checks to see if there is enough ammo to attack with weapons that use multiple ammo per shot
CheckWeaponAmmoCost=0
+47 -50
View File
@@ -28,18 +28,19 @@ namespace sfall
DWORD LSPageOffset = 0;
int LSButtDN = 0;
BYTE* SaveLoadSurface = nullptr;
static long LSButtDN = 0;
static BYTE* SaveLoadSurface = nullptr;
static const char* filename = "%s\\savegame\\slotdat.ini";
void SavePageOffsets() {
static void SavePageOffsets() {
char SavePath[MAX_PATH], buffer[6];
sprintf_s(SavePath, MAX_PATH, filename, fo::var::patches);
_itoa_s(fo::var::slot_cursor, buffer, 10);
WritePrivateProfileStringA("POSITION", "ListNum", buffer, SavePath);
_itoa_s(LSPageOffset, buffer, 10);
WritePrivateProfileStringA("POSITION", "PageOffset", buffer, SavePath);
}
@@ -54,7 +55,7 @@ static void __declspec(naked) save_page_offsets(void) {
}
}
void LoadPageOffsets() {
static void LoadPageOffsets() {
char LoadPath[MAX_PATH];
sprintf_s(LoadPath, MAX_PATH, filename, fo::var::patches);
@@ -102,7 +103,7 @@ static void __declspec(naked) create_page_buttons(void) {
}
}
void SetPageNum() {
static void SetPageNum() {
DWORD winRef = fo::var::lsgwin; // load/save winref
if (winRef == 0) {
return;
@@ -114,8 +115,8 @@ 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);
char tempText[32];
unsigned int TxtMaxWidth = fo::GetMaxCharWidth() * 8; // GetTextWidth(tempText);
unsigned int HalfMaxWidth = TxtMaxWidth / 2;
unsigned int TxtWidth = 0;
@@ -139,16 +140,16 @@ void SetPageNum() {
blip = (blip == '_') ? ' ' : '_';
if (tempPageOffset == -1) {
sprintf_s(TempText, 32, "[ %c ]", '_');
sprintf_s(tempText, 32, "[ %c ]", '_');
} else {
sprintf_s(TempText, 32, "[ %d%c ]", tempPageOffset / 10 + 1, '_');
sprintf_s(tempText, 32, "[ %d%c ]", tempPageOffset / 10 + 1, '_');
}
TxtWidth = fo::GetTextWidth(TempText);
TxtWidth = fo::GetTextWidth(tempText);
if (tempPageOffset == -1) {
sprintf_s(TempText, 32, "[ %c", blip);
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 + 1, blip);
}
int z = 0;
@@ -159,7 +160,7 @@ void SetPageNum() {
int HalfTxtWidth = TxtWidth / 2;
fo::PrintText(TempText, ConsoleGold, 170 - HalfTxtWidth, 64, TxtWidth, SaveLoadWin->width, SaveLoadWin->surface);
fo::PrintText(tempText, ConsoleGold, 170 - HalfTxtWidth, 64, TxtWidth, SaveLoadWin->width, SaveLoadWin->surface);
fo::PrintText(EndBracket, ConsoleGold, (170 - HalfTxtWidth) + TxtWidth - width, 64, width, SaveLoadWin->width, SaveLoadWin->surface);
fo::func::win_draw(winRef);
}
@@ -202,36 +203,32 @@ void SetPageNum() {
static long __fastcall CheckPage(long button) {
switch (button) {
case 0x14B: // left button
if (LSPageOffset >= 10) LSPageOffset -= 10;
case 0x14B: // left button
LSPageOffset -= 10;
if (LSPageOffset < 0) LSPageOffset += 10000; // to the last page
__asm call fo::funcoffs::gsound_red_butt_press_;
break;
case 0x149: // fast left PGUP button
if (LSPageOffset < 100) {
LSPageOffset = 0; // First Page
} else {
LSPageOffset -= 100;
}
case 0x149: // fast left PGUP button
LSPageOffset -= 100;
if (LSPageOffset < 0) LSPageOffset += 10000;
__asm call fo::funcoffs::gsound_red_butt_press_;
break;
case 0x14D: // right button
if (LSPageOffset <= 9980) LSPageOffset += 10;
case 0x14D: // right button
LSPageOffset += 10;
if (LSPageOffset > 9990) LSPageOffset -= 10000; // to the first page
__asm call fo::funcoffs::gsound_red_butt_press_;
break;
case 0x151: // fast right PGDN button
if (LSPageOffset > 9890) {
LSPageOffset = 9990; // Last Page
} else {
LSPageOffset += 100;
}
case 0x151: // fast right PGDN button
LSPageOffset += 100;
if (LSPageOffset > 9990) LSPageOffset -= 10000;
__asm call fo::funcoffs::gsound_red_butt_press_;
break;
case 'p': // p/P button pressed - start SetPageNum func
case 'p': // p/P button pressed - start SetPageNum func
case 'P':
SetPageNum();
break;
default:
if (button < 0x500) return 1; // button in down state
if (button < 0x500) return 1; // button in down state
}
LSButtDN = button;
@@ -255,7 +252,7 @@ CheckUp:
}
}
void DrawPageText() {
static void DrawPageText() {
if (fo::var::lsgwin == 0) {
return;
}
@@ -282,47 +279,47 @@ void DrawPageText() {
BYTE ConsoleGold = fo::var::YellowColor; // palette offset stored in mem - text colour
BYTE Colour = ConsoleGreen;
char TempText[32];
sprintf_s(TempText, 32, "[ %d ]", LSPageOffset / 10 + 1);
char tempText[32];
sprintf_s(tempText, 32, "[ %d ]", LSPageOffset / 10 + 1);
unsigned int TxtWidth = fo::GetTextWidth(TempText);
fo::PrintText(TempText, Colour, 170 - TxtWidth / 2, 64, TxtWidth, SaveLoadWin->width, SaveLoadWin->surface);
unsigned int TxtWidth = fo::GetTextWidth(tempText);
fo::PrintText(tempText, Colour, 170 - TxtWidth / 2, 64, TxtWidth, SaveLoadWin->width, SaveLoadWin->surface);
if (LSButtDN == 0x549) {
Colour = ConsoleGold;
} else {
Colour = ConsoleGreen;
}
strcpy_s(TempText, 12, "<<");
TxtWidth = fo::GetTextWidth(TempText);
fo::PrintText(TempText, Colour, 80 - TxtWidth / 2, 64, TxtWidth, SaveLoadWin->width, SaveLoadWin->surface);
std::strcpy(tempText, "<<");
TxtWidth = fo::GetTextWidth(tempText);
fo::PrintText(tempText, Colour, 80 - TxtWidth / 2, 64, TxtWidth, SaveLoadWin->width, SaveLoadWin->surface);
if (LSButtDN == 0x54B) {
Colour = ConsoleGold;
} else {
Colour = ConsoleGreen;
}
strcpy_s(TempText, 12, "<");
TxtWidth = fo::GetTextWidth(TempText);
fo::PrintText(TempText, Colour, 112 - TxtWidth / 2, 64, TxtWidth, SaveLoadWin->width, SaveLoadWin->surface);
std::strcpy(tempText, "<");
TxtWidth = fo::GetTextWidth(tempText);
fo::PrintText(tempText, Colour, 112 - TxtWidth / 2, 64, TxtWidth, SaveLoadWin->width, SaveLoadWin->surface);
if (LSButtDN == 0x551) {
Colour = ConsoleGold;
} else {
Colour = ConsoleGreen;
}
strcpy_s(TempText, 12, ">>");
TxtWidth = fo::GetTextWidth(TempText);
fo::PrintText(TempText, Colour, 260 - TxtWidth / 2, 64, TxtWidth, SaveLoadWin->width, SaveLoadWin->surface);
std::strcpy(tempText, ">>");
TxtWidth = fo::GetTextWidth(tempText);
fo::PrintText(tempText, Colour, 260 - TxtWidth / 2, 64, TxtWidth, SaveLoadWin->width, SaveLoadWin->surface);
if (LSButtDN == 0x54D) {
Colour = ConsoleGold;
} else {
Colour = ConsoleGreen;
}
strcpy_s(TempText, 12, ">");
TxtWidth = fo::GetTextWidth(TempText);
fo::PrintText(TempText, Colour, 228 - TxtWidth / 2, 64, TxtWidth, SaveLoadWin->width, SaveLoadWin->surface);
std::strcpy(tempText, ">");
TxtWidth = fo::GetTextWidth(tempText);
fo::PrintText(tempText, Colour, 228 - TxtWidth / 2, 64, TxtWidth, SaveLoadWin->width, SaveLoadWin->surface);
SaveLoadWin = nullptr;
}
@@ -361,13 +358,13 @@ static void __declspec(naked) AddPageOffset02(void) {
static void __declspec(naked) AddPageOffset03(void) {
__asm {
inc eax;
add eax, LSPageOffset; // add page num offset
add eax, LSPageOffset; // add page num offset
mov bl, byte ptr ss:[esp + 0x10]; // add 4 bytes - func ret addr
retn;
}
}
void EnableSuperSaving() {
static void EnableSuperSaving() {
// save/load button setup func
MakeCalls(create_page_buttons, {0x47D80D});
+1 -1
View File
@@ -942,7 +942,7 @@ void ScriptExtender::init() {
idle = IniReader::GetConfigInt("Misc", "ProcessorIdle", -1);
if (idle > -1 && idle > 30) idle = 30;
arraysBehavior = IniReader::GetConfigInt("Misc", "arraysBehavior", 1);
arraysBehavior = IniReader::GetConfigInt("Misc", "ArraysBehavior", 1);
if (arraysBehavior > 0) {
arraysBehavior = 1; // only 1 and 0 allowed at this time
dlogr("New arrays behavior enabled.", DL_SCRIPT);