Backported UseScrollingQuestsList imporvements from 4.1.

Added sound effect to ExtraSaveSlots page buttons (from Mr.Stalin)
This commit is contained in:
NovaRain
2018-10-06 23:18:07 +08:00
parent 0aad511e3e
commit d9b748c261
10 changed files with 604 additions and 539 deletions
+7 -1
View File
@@ -141,7 +141,7 @@ WindowScrollKey=0
ToggleItemHighlightsKey=42
;Set to 1 to also highlight containers
HighlightContainers=0
HighlightContainers=1
;Set the color of outlines, available colors:
;0x01 - glowing red
@@ -397,8 +397,14 @@ Repair=293
RemoveWindowRounding=0
;Set to 1 to add scroll buttons to the pipboy quest list, and remove the quests per area limit
;Set to 2 to use a different set of scroll buttons
UseScrollingQuestsList=1
;To change the location of quest list scroll buttons, uncomment the next two lines
;Defaults are 140 for the X-axis and 334 for the Y-axis
;QuestsScrollButtonsX=140
;QuestsScrollButtonsY=334
;Uncomment these lines to control the premade characters offered when starting a new game
;Multiple options should be separated by commas, and there must be the same number of entries in both lines
;PremadePaths=combat,diplomat,stealth
+3 -3
View File
@@ -1,6 +1,6 @@
#pragma once
extern void ResetBodyState();
extern void GameInitialization();
void BugsInit();
void ResetBodyState();
void GameInitialization();
+40 -1
View File
@@ -133,6 +133,12 @@ TGameObj** ptr_obj_dude = reinterpret_cast<TGameObj**>(_obj_dude);
DWORD* ptr_objectTable = reinterpret_cast<DWORD*>(_objectTable);
DWORD* ptr_objItemOutlineState = reinterpret_cast<DWORD*>(_objItemOutlineState);
DWORD* ptr_optionRect = reinterpret_cast<DWORD*>(_optionRect);
DWORD* ptr_optionsButtonDown = reinterpret_cast<DWORD*>(_optionsButtonDown);
DWORD* ptr_optionsButtonDown1 = reinterpret_cast<DWORD*>(_optionsButtonDown1);
DWORD* ptr_optionsButtonDownKey = reinterpret_cast<DWORD*>(_optionsButtonDownKey);
DWORD* ptr_optionsButtonUp = reinterpret_cast<DWORD*>(_optionsButtonUp);
DWORD* ptr_optionsButtonUp1 = reinterpret_cast<DWORD*>(_optionsButtonUp1);
DWORD* ptr_optionsButtonUpKey = reinterpret_cast<DWORD*>(_optionsButtonUpKey);
DWORD* ptr_outlined_object = reinterpret_cast<DWORD*>(_outlined_object);
DWORD* ptr_partyMemberAIOptions = reinterpret_cast<DWORD*>(_partyMemberAIOptions);
DWORD* ptr_partyMemberCount = reinterpret_cast<DWORD*>(_partyMemberCount);
@@ -326,6 +332,7 @@ const DWORD elevator_end_ = 0x43F6D0;
const DWORD elevator_start_ = 0x43F324;
const DWORD endgame_slideshow_ = 0x43F788;
const DWORD EndLoad_ = 0x47F4C8;
const DWORD EndPipboy_ = 0x497828;
const DWORD exec_script_proc_ = 0x4A4810;
const DWORD executeProcedure_ = 0x46DD2C;
const DWORD findCurrentProc_ = 0x467160;
@@ -342,6 +349,7 @@ const DWORD gdialog_barter_cleanup_tables_ = 0x448660;
const DWORD gdialog_barter_pressed_ = 0x44A52C;
const DWORD gdialogDisplayMsg_ = 0x445448;
const DWORD gdProcess_ = 0x4465C0;
const DWORD GetSlotList_ = 0x47E5D0;
const DWORD get_input_ = 0x4C8B78;
const DWORD get_time_ = 0x4C9370;
const DWORD getmsg_ = 0x48504C; // eax - msg file addr, ebx - message ID, edx - int[4] - loads string from MSG file preloaded in memory
@@ -354,6 +362,8 @@ const DWORD gsound_background_pause_ = 0x450B50;
const DWORD gsound_background_stop_ = 0x450AB4;
const DWORD gsound_background_unpause_ = 0x450B64;
const DWORD gsound_play_sfx_file_ = 0x4519A8;
const DWORD gsound_red_butt_press_ = 0x451970;
const DWORD gsound_red_butt_release_ = 0x451978;
const DWORD handle_inventory_ = 0x46E7B0;
const DWORD inc_game_time_ = 0x4A34CC;
const DWORD inc_stat_ = 0x4AF5D4;
@@ -612,6 +622,7 @@ const DWORD win_line_ = 0x4D6B24;
const DWORD win_print_ = 0x4D684C;
const DWORD win_register_button_ = 0x4D8260;
const DWORD win_register_button_disable_ = 0x4D8674;
const DWORD win_register_button_sound_func_ = 0x4D87F8;
const DWORD win_show_ = 0x4D6DAC;
const DWORD wmInterfaceScrollTabsStart_ = 0x4C219C;
const DWORD wmPartyWalkingStep_ = 0x4C1F90;
@@ -850,7 +861,7 @@ TGameObj* __stdcall InvenRightHand(TGameObj* critter) {
}
}
int __stdcall CreateWindowFunc(const char* winName, DWORD x, DWORD y, DWORD width, DWORD height, DWORD bgColorIndex, DWORD flags) {
long __stdcall CreateWindowFunc(const char* winName, long x, long y, long width, long height, long bgColorIndex, long flags) {
__asm {
push flags
push bgColorIndex
@@ -862,3 +873,31 @@ int __stdcall CreateWindowFunc(const char* winName, DWORD x, DWORD y, DWORD widt
call createWindow_
}
}
long __stdcall WinRegisterButton(DWORD winRef, long xPos, long yPos, long width, long height, long hoverOn, long hoverOff, long buttonDown, long buttonUp, BYTE* pictureUp, BYTE* pictureDown, long arg12, long buttonType) {
__asm {
push buttonType
push arg12
push pictureDown
push pictureUp
push buttonUp
push buttonDown
push hoverOff
push hoverOn
push height
mov ecx, width
mov ebx, yPos
mov edx, xPos
mov eax, winRef
call win_register_button_
}
}
long __fastcall WordWrap(const char* text, int maxWidth, DWORD* buf, BYTE* count) {
__asm {
mov eax, ecx
mov ecx, count
mov ebx, buf
call _word_wrap_
}
}
+23 -1
View File
@@ -147,6 +147,12 @@
#define _objectTable 0x639DA0
#define _objItemOutlineState 0x519798
#define _optionRect 0x58ECC0
#define _optionsButtonDown 0x59D400
#define _optionsButtonDown1 0x570518
#define _optionsButtonDownKey 0x518F2C
#define _optionsButtonUp 0x59D3FC
#define _optionsButtonUp1 0x570514
#define _optionsButtonUpKey 0x518F28
#define _outlined_object 0x518D94
#define _partyMemberAIOptions 0x519DB8
#define _partyMemberCount 0x519DAC
@@ -336,6 +342,12 @@ extern TGameObj** ptr_obj_dude;
extern DWORD* ptr_objectTable;
extern DWORD* ptr_objItemOutlineState;
extern DWORD* ptr_optionRect;
extern DWORD* ptr_optionsButtonDown;
extern DWORD* ptr_optionsButtonDown1;
extern DWORD* ptr_optionsButtonDownKey;
extern DWORD* ptr_optionsButtonUp;
extern DWORD* ptr_optionsButtonUp1;
extern DWORD* ptr_optionsButtonUpKey;
extern DWORD* ptr_outlined_object;
extern DWORD* ptr_partyMemberAIOptions;
extern DWORD* ptr_partyMemberCount;
@@ -511,6 +523,7 @@ extern const DWORD elevator_end_;
extern const DWORD elevator_start_;
extern const DWORD endgame_slideshow_;
extern const DWORD EndLoad_;
extern const DWORD EndPipboy_;
extern const DWORD exec_script_proc_; // unsigned int aScriptID<eax>, int aProcId<edx>
extern const DWORD executeProcedure_; // <eax> - programPtr, <edx> - procNumber
extern const DWORD fadeSystemPalette_;
@@ -526,6 +539,7 @@ extern const DWORD gdialog_barter_cleanup_tables_;
extern const DWORD gdialog_barter_pressed_;
extern const DWORD gdialogDisplayMsg_;
extern const DWORD gdProcess_;
extern const DWORD GetSlotList_;
extern const DWORD get_input_;
extern const DWORD get_time_;
extern const DWORD getmsg_;
@@ -538,6 +552,8 @@ extern const DWORD gsound_background_pause_;
extern const DWORD gsound_background_stop_;
extern const DWORD gsound_background_unpause_;
extern const DWORD gsound_play_sfx_file_;
extern const DWORD gsound_red_butt_press_;
extern const DWORD gsound_red_butt_release_;
extern const DWORD handle_inventory_;
extern const DWORD inc_game_time_;
extern const DWORD inc_stat_;
@@ -799,6 +815,7 @@ extern const DWORD win_line_;
extern const DWORD win_print_;
extern const DWORD win_register_button_;
extern const DWORD win_register_button_disable_;
extern const DWORD win_register_button_sound_func_;
extern const DWORD win_show_;
extern const DWORD wmInterfaceScrollTabsStart_;
extern const DWORD wmPartyWalkingStep_;
@@ -944,4 +961,9 @@ void __declspec() DebugPrintf(const char* fmt, ...);
const char* __stdcall FindCurrentProc(TProgram* program);
// creates a window with the name and flags
int __stdcall CreateWindowFunc(const char* winName, DWORD x, DWORD y, DWORD width, DWORD height, DWORD bgColorIndex, DWORD flags);
long __stdcall CreateWindowFunc(const char* winName, long x, long y, long width, long height, long bgColorIndex, long flags);
// creates a button
long __stdcall WinRegisterButton(DWORD winRef, long xPos, long yPos, long width, long height, long hoverOn, long hoverOff, long buttonDown, long buttonUp, BYTE* pictureUp, BYTE* pictureDown, long arg12, long buttonType);
long __fastcall WordWrap(const char* text, int maxWidth, DWORD* buf, BYTE* count);
+11 -35
View File
@@ -514,7 +514,7 @@ UNLSTDfrm *LoadUnlistedFrm(char *FrmName, unsigned int folderRef) {
/////////////////////////////////////////////////////////////////WINDOW FUNCTIONS////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------------------------
int CreateWin(DWORD x, DWORD y, DWORD width, DWORD height, DWORD BGColourIndex, DWORD flags) {
int AddWin(DWORD x, DWORD y, DWORD width, DWORD height, DWORD BGColourIndex, DWORD flags) {
int WinRef;
__asm {
push flags
@@ -587,30 +587,6 @@ void RedrawWin(int WinRef) {
/////////////////////////////////////////////////////////////////BUTTON FUNCTIONS////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------
int CreateButton(int WinRef, DWORD Xpos, DWORD Ypos, DWORD Width, DWORD Height, DWORD HovOn, DWORD HovOff,
DWORD ButtDown, DWORD ButtUp, BYTE *PicUp, BYTE *PicDown, DWORD ButType) {
int ret_val;
__asm {
push ButType //button type: 0x10 = move window pos, 0x20 or 0x0 = regular click, 0x23 = toggle click
push 0x0 //? always 0
push PicDown //0//button down pic index
push PicUp //0//button up pic index
push ButtUp
push ButtDown
push HovOff
push HovOn
push Height
mov ecx, Width
mov edx, Xpos
mov ebx, Ypos
mov eax, WinRef
call win_register_button_
mov ret_val, eax
}
return ret_val;
}
//-----------------------------
int check_buttons(void) {
int key_code;
@@ -1490,7 +1466,7 @@ void _stdcall HeroSelectWindow(int RaceStyleFlag) {
DWORD ResWidth = *(DWORD*)0x4CAD6B;
DWORD ResHeight = *(DWORD*)0x4CAD66;
int WinRef = CreateWin(ResWidth/2 - 242, (ResHeight - 100)/2 - 65, 484, 230, 100, 0x4);
int WinRef = AddWin(ResWidth/2 - 242, (ResHeight - 100)/2 - 65, 484, 230, 100, 0x4);
if (WinRef == -1) return;
int mouseWasHidden = IsMouseHidden();
@@ -1539,17 +1515,17 @@ void _stdcall HeroSelectWindow(int RaceStyleFlag) {
DWORD MenuUObj, MenuDObj;
BYTE *MenuUSurface = GetFrmSurface(LoadFrm(6, 299), 0, 0, &MenuUObj); //MENUUP Frm
BYTE *MenuDSurface = GetFrmSurface(LoadFrm(6, 300), 0, 0, &MenuDObj); //MENUDOWN Frm
CreateButton(WinRef, 116, 181, 26, 26, -1, -1, -1, 0x0D, MenuUSurface, MenuDSurface, 0x20);
WinRegisterButton(WinRef, 116, 181, 26, 26, -1, -1, -1, 0x0D, MenuUSurface, MenuDSurface, 0, 0x20);
DWORD DidownUObj, DidownDObj;
BYTE *DidownUSurface = GetFrmSurface(LoadFrm(6, 93), 0, 0, &DidownUObj); //MENUUP Frm
BYTE *DidownDSurface = GetFrmSurface(LoadFrm(6, 94), 0, 0, &DidownDObj); //MENUDOWN Frm
CreateButton(WinRef, 28, 84, 24, 25, -1, -1, -1, 0x150, DidownUSurface, DidownDSurface, 0x20);
WinRegisterButton(WinRef, 28, 84, 24, 25, -1, -1, -1, 0x150, DidownUSurface, DidownDSurface, 0, 0x20);
DWORD DiupUObj, DiupDObj;
BYTE *DiupUSurface = GetFrmSurface(LoadFrm(6, 100), 0, 0, &DiupUObj); //MENUUP Frm
BYTE *DiupDSurface = GetFrmSurface(LoadFrm(6, 101), 0, 0, &DiupDObj); //MENUDOWN Frm
CreateButton(WinRef, 28, 59, 23, 24, -1, -1, -1, 0x148, DiupUSurface, DiupDSurface, 0x20);
WinRegisterButton(WinRef, 28, 59, 23, 24, -1, -1, -1, 0x148, DiupUSurface, DiupDSurface, 0, 0x20);
int oldFont;
oldFont = GetFont();
@@ -1990,8 +1966,8 @@ static void __declspec(naked) AddCharScrnButtons(void) {
WinRef = *(DWORD*)_edit_win; //char screen window ref
//race and style buttons
CreateButton(WinRef, 332, 0, 82, 32, -1, -1, 0x501, -1, 0, 0, 0);
CreateButton(WinRef, 332, 226, 82, 32, -1, -1, 0x502, -1, 0, 0, 0);
WinRegisterButton(WinRef, 332, 0, 82, 32, -1, -1, 0x501, -1, 0, 0, 0, 0);
WinRegisterButton(WinRef, 332, 226, 82, 32, -1, -1, 0x502, -1, 0, 0, 0, 0);
if (*(DWORD*)_glblmode == 1) { //equals 1 if new char screen - equals 0 if ingame char screen
if (NewButt01Surface == NULL) {
@@ -2019,12 +1995,12 @@ static void __declspec(naked) AddCharScrnButtons(void) {
if (GetFileAttributes("Appearance\\hmR01S00\0") != INVALID_FILE_ATTRIBUTES || GetFileAttributes("Appearance\\hfR01S00\0") != INVALID_FILE_ATTRIBUTES ||
GetFileAttributes("Appearance\\hmR01S00.dat\0") != INVALID_FILE_ATTRIBUTES || GetFileAttributes("Appearance\\hfR01S00.dat\0") != INVALID_FILE_ATTRIBUTES) {
//race selection buttons
CreateButton(WinRef, 348, 37, 20, 18, -1, -1, -1, 0x511, NewButt01Surface, NewButt01Surface + (20*18), 0x20);
CreateButton(WinRef, 373, 37, 20, 18, -1, -1, -1, 0x513, NewButt01Surface + (20*18*2), NewButt01Surface + (20*18*3), 0x20);
WinRegisterButton(WinRef, 348, 37, 20, 18, -1, -1, -1, 0x511, NewButt01Surface, NewButt01Surface + (20*18), 0, 0x20);
WinRegisterButton(WinRef, 373, 37, 20, 18, -1, -1, -1, 0x513, NewButt01Surface + (20*18*2), NewButt01Surface + (20*18*3), 0, 0x20);
}
//style selection buttons
CreateButton(WinRef, 348, 199, 20, 18, -1, -1, -1, 0x512, NewButt01Surface, NewButt01Surface+(20*18), 0x20);
CreateButton(WinRef, 373, 199, 20, 18, -1, -1, -1, 0x514, NewButt01Surface + (20*18*2), NewButt01Surface + (20*18*3), 0x20);
WinRegisterButton(WinRef, 348, 199, 20, 18, -1, -1, -1, 0x512, NewButt01Surface, NewButt01Surface+(20*18), 0, 0x20);
WinRegisterButton(WinRef, 373, 199, 20, 18, -1, -1, -1, 0x514, NewButt01Surface + (20*18*2), NewButt01Surface + (20*18*3), 0, 0x20);
}
__asm {
+407 -264
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -16,4 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
void QuestListInit();
+3 -3
View File
@@ -371,11 +371,11 @@ static OpcodeHandler opHandler;
If you don't include opcode in this array, you should take care of all argument validation inside handler itself.
*/
static const SfallOpcodeMetadata opcodeMetaArray[] = {
{sf_test, "validate_test", {DATATYPE_MASK_INT, DATATYPE_MASK_INT | DATATYPE_MASK_FLOAT, DATATYPE_MASK_STR, DATATYPE_NONE}},
{sf_spatial_radius, "spatial_radius", {DATATYPE_MASK_VALID_OBJ}},
{sf_create_win, "create_win", {DATATYPE_MASK_STR, DATATYPE_MASK_INT, DATATYPE_MASK_INT, DATATYPE_MASK_INT, DATATYPE_MASK_INT, DATATYPE_MASK_INT}},
{sf_critter_inven_obj2, "critter_inven_obj2", {DATATYPE_MASK_VALID_OBJ, DATATYPE_MASK_INT}},
{sf_set_ini_setting, "set_ini_setting", {DATATYPE_MASK_STR, DATATYPE_MASK_INT | DATATYPE_MASK_STR}},
{sf_create_win, "create_win", {DATATYPE_MASK_STR, DATATYPE_MASK_INT, DATATYPE_MASK_INT, DATATYPE_MASK_INT, DATATYPE_MASK_INT, DATATYPE_MASK_INT}},
{sf_spatial_radius, "spatial_radius", {DATATYPE_MASK_VALID_OBJ}},
{sf_test, "validate_test", {DATATYPE_MASK_INT, DATATYPE_MASK_INT | DATATYPE_MASK_FLOAT, DATATYPE_MASK_STR, DATATYPE_NONE}},
//{op_message_str_game, {}}
};
+66 -156
View File
@@ -89,93 +89,32 @@ static void __declspec(naked) load_page_offsets(void) {
}
//------------------------------------------
static void CreateButtons() {
DWORD winRef = *(DWORD*)_lsgwin;
// left button -10 | X | Y | W | H |HOn |HOff |BDown |BUp |PicUp |PicDown |? |ButType
WinRegisterButton(winRef, 100, 56, 24, 20, -1, 0x500, 0x54B, 0x14B, 0, 0, 0, 32);
// left button -100
WinRegisterButton(winRef, 68, 56, 24, 20, -1, 0x500, 0x549, 0x149, 0, 0, 0, 32);
// right button +10
WinRegisterButton(winRef, 216, 56, 24, 20, -1, 0x500, 0x54D, 0x14D, 0, 0, 0, 32);
// right button +100
WinRegisterButton(winRef, 248, 56, 24, 20, -1, 0x500, 0x551, 0x151, 0, 0, 0, 32);
// Set Number button
WinRegisterButton(winRef, 140, 56, 60, 20, -1, -1, 'p', -1, 0, 0, 0, 32);
}
static void __declspec(naked) create_page_buttons(void) {
__asm {
// left button -10
push 32 // ButType
push 0 // ? always 0
push 0 // PicDown
push 0 // PicUp
push 0x14B // ButtUp left button
push 0x54B // ButtDown
push 0x500 // HovOff
push -1 // HovOn
push 20 // Height
mov ecx, 24 // Width
mov edx, 100 // Xpos
mov ebx, 56 // Ypos
mov eax, dword ptr ds:[_lsgwin] // WinRef
call win_register_button_
// left button -100
push 32 // ButType
push 0 // ? always 0
push 0 // PicDown
push 0 // PicUp
push 0x149 // ButtUp PGUP button
push 0x549 // ButtDown
push 0x500 // HovOff
push -1 // HovOn
push 20 // Height
mov ecx, 24 // Width
mov edx, 68 // Xpos
mov ebx, 56 // Ypos
mov eax, dword ptr ds:[_lsgwin] // WinRef
call win_register_button_ // create button function
// right button +10
push 32 // ButType
push 0 // ? always 0
push 0 // PicDown
push 0 // PicUp
push 0x14D // ButtUp right button
push 0x54D // ButtDown
push 0x500 // HovOff
push -1 // HovOn
push 20 // Height
mov ecx, 24 // Width
mov edx, 216 // Xpos
mov ebx, 56 // Ypos
mov eax, dword ptr ds:[_lsgwin] // WinRef
call win_register_button_ // create button function
// right button +100
push 32 // ButType
push 0 // ? always 0
push 0 // PicDown
push 0 // PicUp
push 0x151 // ButtUp PGDN button
push 0x551 // ButtDown
push 0x500 // HovOff
push -1 // HovOn
push 20 // Height
mov ecx, 24 // Width
mov edx, 248 // Xpos
mov ebx, 56 // Ypos
mov eax, dword ptr ds:[_lsgwin] // WinRef
call win_register_button_ // create button function
// Set Number button
push 32 // ButType
push 0 // ? always 0
push 0 // PicDown
push 0 // PicUp
push -1 // ButtUp
push 'p' // ButtDown
push -1 // HovOff
push -1 // HovOn
push 20 // Height
mov ecx, 60 // Width
mov edx, 140 // Xpos
mov ebx, 56 // Ypos
mov eax, dword ptr ds:[_lsgwin] // WinRef
call win_register_button_ // create button function
call CreateButtons;
// restore original code
mov eax, 0x65
ret
mov eax, 0x65;
ret;
}
}
//------------------------------------------------------
void SetPageNum() {
int WinRef = *(DWORD*)_lsgwin; // load/save winref
DWORD WinRef = *(DWORD*)_lsgwin; // load/save winref
if (WinRef == NULL) {
return;
}
@@ -270,87 +209,58 @@ void SetPageNum() {
}
//------------------------------------------
static void __declspec(naked) check_page_buttons(void) {
/*
0047BD49 |> 3D 48010000 |CMP EAX,148
0047BD4E |. 75 2E |JNZ SHORT fallout2.0047BD7E
0047BD50 |. 8B15 B8935100 |MOV EDX,DWORD PTR DS:[5193B8]
0047BD56 |. 4A |DEC EDX
0047BD57 |. 8915 B8935100 |MOV DWORD PTR DS:[5193B8],EDX
0047BD5D |. 85D2 |TEST EDX,EDX
0047BD5F |. 7D 07 |JGE SHORT fallout2.0047BD68
0047BD61 |. 31C0 |XOR EAX,EAX
0047BD63 |. A3 B8935100 |MOV DWORD PTR DS:[5193B8],EAX
0047BD68 |> B9 FFFFFFFF |MOV ECX,-1 // button pressed exit check
0047BD6D |. BA 01000000 |MOV EDX,1
0047BD72 |. 898C24 28020000 |MOV DWORD PTR SS:[ESP+228],ECX
0047BD79 |. E9 7B010000 |JMP fallout2.0047BEF9
*/
static long __fastcall CheckPage(long button) {
switch (button) {
case 0x14B: // left button
if (LSPageOffset >= 10) LSPageOffset -= 10;
__asm call gsound_red_butt_press_;
break;
case 0x149: // fast left PGUP button
if (LSPageOffset < 100) {
LSPageOffset = 0; // First Page
} else {
LSPageOffset -= 100;
}
__asm call gsound_red_butt_press_;
break;
case 0x14D: // right button
if (LSPageOffset <= 9980) LSPageOffset += 10;
__asm call gsound_red_butt_press_;
break;
case 0x151: // fast right PGDN button
if (LSPageOffset > 9890) {
LSPageOffset = 9990; // Last Page
} else {
LSPageOffset += 100;
}
__asm call gsound_red_butt_press_;
break;
case 'p': // p/P button pressed - start SetPageNum func
case 'P':
SetPageNum();
break;
default:
if (button < 0x500) return 1; // button in down state
}
LSButtDN = button;
return 0;
}
static void __declspec(naked) check_page_buttons(void) {
__asm {
cmp eax, 0x14B // left button
jnz CheckFastLeft
cmp LSPageOffset, 10
jl SetRet
sub LSPageOffset, 10
jmp SetRet
CheckFastLeft:
cmp eax, 0x149 // fast left PGUP button
jnz CheckRight
cmp LSPageOffset, 100
jl FirstPage
sub LSPageOffset, 100
jmp SetRet
FirstPage:
mov LSPageOffset, 0
jmp SetRet
CheckRight:
cmp eax, 0x14D // right button
jnz CheckFastRight
cmp LSPageOffset, 9980
jg SetRet
add LSPageOffset, 10
jmp SetRet
CheckFastRight:
cmp eax, 0x151 // fast right PGDN button
jnz CheckSetNumber
cmp LSPageOffset, 9890
jg LastPage
add LSPageOffset, 100
jmp SetRet
LastPage:
mov LSPageOffset, 9990
jmp SetRet
CheckSetNumber:
cmp eax, 'p' // p button pressed - start SetPageNum func
jnz CheckSetNumber2
pushad
call SetPageNum
popad
jmp SetRet
CheckSetNumber2:
cmp eax, 'P' // P button pressed - start SetPageNum func
jnz CheckButtonDown
pushad
call SetPageNum
popad
jmp SetRet
CheckButtonDown:
cmp eax, 0x500 // button in down state
jl CheckUp
SetRet:
mov LSButtDN, eax
push esi
mov esi, 0x47E5D0 // reset page save list func
call esi
pop esi
add dword ptr ds:[esp], 26 // set return to button pressed code
jmp EndFunc
pushad;
mov ecx, eax;
call CheckPage;
test eax, eax;
popad;
jnz CheckUp;
add dword ptr ds:[esp], 26; // set return to button pressed code
jmp GetSlotList_; // reset page save list func
CheckUp:
// restore original code
cmp eax, 0x148 // up button
EndFunc:
ret
cmp eax, 0x148; // up button
ret;
}
}
+1 -34
View File
@@ -538,34 +538,6 @@ end:
}
}
// Fix crash when the quest list is too long
static bool outRangeFlag = false;
static void __declspec(naked) PipStatus_hook_printfix() {
__asm {
test outRangeFlag, 0xFF;
jnz force;
call _word_wrap_;
push eax;
movzx eax, word ptr [esp + 0x49C + 8];
dec eax;
shl eax, 1;
add eax, dword ptr ds:[_cursor_line];
cmp eax, dword ptr ds:[_bottom_line]; // check max
jb skip;
mov eax, dword ptr ds:[_quest_count];
sub eax, 2;
mov dword ptr [esp + 0x4BC - 0x24 + 8], eax; // set last counter
mov outRangeFlag, 1;
skip:
pop eax;
retn;
force:
or eax, -1; // force log error "out of range"
mov outRangeFlag, 0;
retn;
}
}
static void __declspec(naked) intface_rotate_numbers_hack() {
__asm {
push edi
@@ -1277,13 +1249,8 @@ static void DllMain2() {
dlogr("Running CreditsInit().", DL_INIT);
CreditsInit();
if (GetPrivateProfileIntA("Misc", "UseScrollingQuestsList", 0, ini)) {
dlog("Applying quests list patch.", DL_INIT);
dlogr("Running QuestListInit().", DL_INIT);
QuestListInit();
dlogr(" Done", DL_INIT);
} else {
HookCall(0x498186, PipStatus_hook_printfix); // fix "out of range" bug when printing a list of quests
}
dlog("Applying premade characters patch.", DL_INIT);
PremadeInit();