mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed the screen not returning to the player when moving a controlled critter to another elevation of the map.
Refactored some code in Bugs.cpp.
This commit is contained in:
+3
-4
@@ -175,7 +175,6 @@ DebugEditorKey=0
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Misc]
|
||||
|
||||
;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 -1 to remove the time limit, and automatically reset the date back to 2241 each time you would have reached it
|
||||
@@ -480,13 +479,13 @@ NPCStage6Fix=0
|
||||
;2 - Restoring the -1 AP bonus for HtH attacks (i.e. Fallout 1 behaviour)
|
||||
FastShotFix=1
|
||||
|
||||
;Set to 1 to boost the maximum number of script names from 1450 to 10000
|
||||
BoostScriptDialogLimit=0
|
||||
|
||||
;Allows you to edit the skill tables
|
||||
;Point the next line at an ini file containing the replacement skill data
|
||||
;SkillsFile=Skills.ini
|
||||
|
||||
;Set to 1 to boost the maximum number of script names from 1450 to 10000
|
||||
BoostScriptDialogLimit=0
|
||||
|
||||
;To change the relationship between SPECIAL stats and derived stats, uncomment the next line
|
||||
;See the Stats.ini in the modders pack for an example file
|
||||
;DerivedStats=Stats.ini
|
||||
|
||||
+2
-2
@@ -91,11 +91,11 @@ void BooksInit() {
|
||||
bool includeVanilla = (GetPrivateProfileIntA("main", "overrideVanilla", 0, iniBooks) == 0);
|
||||
if (includeVanilla) BooksCount = 5;
|
||||
|
||||
int count = max(0, GetPrivateProfileIntA("main", "count", 0, iniBooks));
|
||||
if (count > BooksMax) count = BooksMax;
|
||||
int count = GetPrivateProfileIntA("main", "count", 0, iniBooks);
|
||||
|
||||
int n = 0;
|
||||
if (count > 0) {
|
||||
if (count > BooksMax) count = BooksMax;
|
||||
books = new sBook[BooksCount + count];
|
||||
|
||||
if (includeVanilla) LoadVanillaBooks();
|
||||
|
||||
+72
-71
@@ -195,97 +195,95 @@ skip:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) item_d_check_addict_hack() {
|
||||
static void __declspec(naked) item_d_check_addict_hack() { // replace engine function
|
||||
__asm {
|
||||
mov edx, 2 // type = addiction
|
||||
cmp eax, -1 // Has drug_pid?
|
||||
je skip // No
|
||||
mov ebx, eax // ebx = drug_pid
|
||||
mov eax, esi // eax = who
|
||||
call queue_find_first_
|
||||
loopQueue:
|
||||
test eax, eax // Has something in the list?
|
||||
jz end // No
|
||||
cmp ebx, dword ptr [eax+0x4] // drug_pid == queue_addict.drug_pid?
|
||||
je end // Has specific addiction
|
||||
mov eax, esi // eax = who
|
||||
mov edx, 2 // type = addiction
|
||||
call queue_find_next_
|
||||
jmp loopQueue
|
||||
push 0x47A6A1; // return addr
|
||||
mov edx, 2; // type = addiction
|
||||
cmp eax, -1; // Has drug_pid?
|
||||
jne skip; // No
|
||||
mov eax, dword ptr ds:[_obj_dude];
|
||||
jmp queue_find_first_; // return player addiction
|
||||
skip:
|
||||
mov eax, dword ptr ds:[_obj_dude]
|
||||
call queue_find_first_
|
||||
mov ebx, eax; // ebx = drug_pid
|
||||
mov eax, esi; // eax = who
|
||||
call queue_find_first_;
|
||||
loopQueue:
|
||||
test eax, eax; // Has something in the list?
|
||||
jz end; // No
|
||||
cmp ebx, dword ptr [eax + 0x4]; // drug_pid == queue_addict.drug_pid?
|
||||
je end; // Has specific addiction
|
||||
mov eax, esi; // eax = who
|
||||
mov edx, 2; // type = addiction
|
||||
call queue_find_next_;
|
||||
jmp loopQueue;
|
||||
end:
|
||||
push 0x47A6A1
|
||||
retn
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) remove_jet_addict() {
|
||||
static void __declspec(naked) RemoveJetAddictFunc() {
|
||||
__asm {
|
||||
cmp eax, dword ptr ds:[_wd_obj]
|
||||
jne end
|
||||
cmp dword ptr [edx+0x4], PID_JET // queue_addict.drug_pid == PID_JET?
|
||||
jne end
|
||||
xor eax, eax
|
||||
inc eax // Delete from queue
|
||||
retn
|
||||
cmp eax, dword ptr ds:[_wd_obj];
|
||||
jne end;
|
||||
cmp dword ptr [edx + 0x4], PID_JET; // queue_addict.drug_pid == PID_JET?
|
||||
end:
|
||||
xor eax, eax // Don't touch
|
||||
retn
|
||||
sete al; // 1 = Delete from queue, 0 = Don't touch
|
||||
and eax, 0xFF;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) item_d_take_drug_hack() {
|
||||
__asm {
|
||||
cmp dword ptr [eax], 0 // queue_addict.init
|
||||
jne skip // Addiction is not active yet
|
||||
mov edx, PERK_add_jet
|
||||
mov eax, esi
|
||||
call perform_withdrawal_end_
|
||||
cmp dword ptr [eax], 0; // queue_addict.init
|
||||
jne skip; // Addiction is not active yet
|
||||
mov edx, PERK_add_jet;
|
||||
mov eax, esi;
|
||||
call perform_withdrawal_end_;
|
||||
skip:
|
||||
mov dword ptr ds:[_wd_obj], esi
|
||||
mov eax, 2 // type = addiction
|
||||
mov edx, offset remove_jet_addict
|
||||
call queue_clear_type_
|
||||
push 0x479FD1
|
||||
retn
|
||||
mov dword ptr ds:[_wd_obj], esi;
|
||||
mov eax, 2; // type = addiction
|
||||
mov edx, offset RemoveJetAddictFunc;
|
||||
call queue_clear_type_;
|
||||
push 0x479FD1;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) item_d_load_hack() {
|
||||
__asm {
|
||||
sub esp, 4
|
||||
mov [ebp], edi // edi->queue_drug
|
||||
mov ecx, 7
|
||||
mov esi, _drugInfoList+12
|
||||
sub esp, 4; // proto buf
|
||||
mov [ebp], edi; // edi->queue_drug
|
||||
mov ecx, 7;
|
||||
mov esi, _drugInfoList + 12;
|
||||
loopDrug:
|
||||
cmp dword ptr [esi+8], 0 // drugInfoList.numeffects
|
||||
je nextDrug
|
||||
mov edx, esp
|
||||
mov eax, [esi] // drugInfoList.pid
|
||||
call proto_ptr_
|
||||
mov edx, [esp]
|
||||
mov eax, [edx+0x24] // drug.stat0
|
||||
cmp eax, [edi+0x4] // drug.stat0 == queue_drug.stat0?
|
||||
jne nextDrug // No
|
||||
mov eax, [edx+0x28] // drug.stat1
|
||||
cmp eax, [edi+0x8] // drug.stat1 == queue_drug.stat1?
|
||||
jne nextDrug // No
|
||||
mov eax, [edx+0x2C] // drug.stat2
|
||||
cmp eax, [edi+0xC] // drug.stat2 == queue_drug.stat2?
|
||||
je foundPid // Yes
|
||||
cmp dword ptr [esi + 8], 0; // drugInfoList.numeffects
|
||||
je nextDrug;
|
||||
mov edx, esp;
|
||||
mov eax, [esi]; // drugInfoList.pid
|
||||
call proto_ptr_;
|
||||
mov edx, [esp];
|
||||
mov eax, [edx + 0x24]; // drug.stat0
|
||||
cmp eax, [edi + 0x4]; // drug.stat0 == queue_drug.stat0?
|
||||
jne nextDrug; // No
|
||||
mov eax, [edx + 0x28]; // drug.stat1
|
||||
cmp eax, [edi + 0x8]; // drug.stat1 == queue_drug.stat1?
|
||||
jne nextDrug; // No
|
||||
mov eax, [edx + 0x2C]; // drug.stat2
|
||||
cmp eax, [edi + 0xC]; // drug.stat2 == queue_drug.stat2?
|
||||
je foundPid; // Yes
|
||||
nextDrug:
|
||||
add esi, 12
|
||||
loop loopDrug
|
||||
add esi, 12;
|
||||
dec ecx;
|
||||
jnz loopDrug;
|
||||
jz end;
|
||||
foundPid:
|
||||
jecxz end
|
||||
mov eax, [esi] // drugInfoList.pid
|
||||
mov [edi], eax // queue_drug.drug_pid
|
||||
mov eax, [esi]; // drugInfoList.pid
|
||||
mov [edi], eax; // queue_drug.drug_pid
|
||||
end:
|
||||
xor eax, eax
|
||||
add esp, 4
|
||||
retn
|
||||
xor eax, eax;
|
||||
add esp, 4;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -655,7 +653,8 @@ found:
|
||||
add edx, [esp+0x40] // inventory_offset
|
||||
mov eax, ds:[_pud]
|
||||
mov ecx, [eax] // itemsCount
|
||||
jecxz skip
|
||||
test ecx, ecx
|
||||
jz skip
|
||||
dec ecx
|
||||
cmp edx, ecx
|
||||
ja skip
|
||||
@@ -679,13 +678,15 @@ static void __declspec(naked) drop_ammo_into_weapon_hook() {
|
||||
jge skip // Yes
|
||||
lea edx, [eax+0x2C] // Inventory
|
||||
mov ecx, [edx] // itemsCount
|
||||
jcxz skip // inventory is empty (another excess check, but leave it)
|
||||
test ecx, ecx
|
||||
jz skip // inventory is empty (another excess check, but leave it)
|
||||
mov edx, [edx+8] // FirstItem
|
||||
nextItem:
|
||||
cmp ebp, [edx] // Our weapon?
|
||||
je foundItem // Yes
|
||||
add edx, 8 // Go to the next
|
||||
loop nextItem
|
||||
dec ecx
|
||||
jnz nextItem
|
||||
jmp skip // Our weapon is not in inventory
|
||||
foundItem:
|
||||
cmp dword ptr [edx+4], 1 // Only one weapon?
|
||||
|
||||
@@ -100,7 +100,6 @@ static void SaveRealDudeState() {
|
||||
real_Experience = *ptr_Experience_;
|
||||
real_free_perk = *ptr_free_perk;
|
||||
real_unspent_skill_points = ptr_curr_pc_stat[0];
|
||||
//real_map_elevation = *ptr_map_elevation;
|
||||
real_sneak_working = *ptr_sneak_working;
|
||||
SkillGetTags(real_tag_skill, 4);
|
||||
|
||||
@@ -169,6 +168,8 @@ static void TakeControlOfNPC(TGameObj* npc) {
|
||||
|
||||
// restores the real dude state
|
||||
static void RestoreRealDudeState() {
|
||||
*ptr_map_elevation = real_dude->elevation;
|
||||
|
||||
*ptr_obj_dude = real_dude;
|
||||
*ptr_inven_dude = real_dude;
|
||||
|
||||
@@ -182,7 +183,6 @@ static void RestoreRealDudeState() {
|
||||
*ptr_Experience_ = real_Experience;
|
||||
*ptr_free_perk = real_free_perk;
|
||||
ptr_curr_pc_stat[0] = real_unspent_skill_points;
|
||||
//real_map_elevation = *ptr_map_elevation; -- why save elevation?
|
||||
*ptr_sneak_working = real_sneak_working;
|
||||
SkillSetTags(real_tag_skill, 4);
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ static void __declspec(naked) funcGetShaderTexture() {
|
||||
mov ebx, [esp];
|
||||
cmp bx, VAR_TYPE_INT;
|
||||
jnz fail;
|
||||
mov ebx, [esp+4];
|
||||
mov ebx, [esp + 4];
|
||||
cmp bx, VAR_TYPE_INT;
|
||||
jnz fail;
|
||||
//set the new value
|
||||
@@ -181,7 +181,7 @@ static void __declspec(naked) funcGetShaderTexture() {
|
||||
pop ecx;
|
||||
jmp end;
|
||||
fail:
|
||||
mov edx, -1
|
||||
mov edx, -1;
|
||||
end:
|
||||
//Pass back the result
|
||||
mov eax, ecx;
|
||||
@@ -213,7 +213,7 @@ static void __declspec(naked) funcSetShaderInt() {
|
||||
mov edi, eax;
|
||||
mov eax, ecx;
|
||||
call interpretPopLong_;
|
||||
mov [esp+8], eax;
|
||||
mov [esp + 8], eax;
|
||||
mov eax, ecx;
|
||||
call interpretPopShort_;
|
||||
mov edx, eax;
|
||||
@@ -239,7 +239,7 @@ next:
|
||||
mov eax, ecx;
|
||||
mov ebx, ebp;
|
||||
call interpretGetString_;
|
||||
mov [esp+4], eax;
|
||||
mov [esp + 4], eax;
|
||||
call SetShaderInt;
|
||||
jmp end;
|
||||
fail:
|
||||
@@ -269,7 +269,7 @@ static void __declspec(naked) funcSetShaderTexture() {
|
||||
mov edi, eax;
|
||||
mov eax, ecx;
|
||||
call interpretPopLong_;
|
||||
mov [esp+8], eax;
|
||||
mov [esp + 8], eax;
|
||||
mov eax, ecx;
|
||||
call interpretPopShort_;
|
||||
mov edx, eax;
|
||||
@@ -295,7 +295,7 @@ next:
|
||||
mov eax, ecx;
|
||||
mov ebx, ebp;
|
||||
call interpretGetString_;
|
||||
mov [esp+4], eax;
|
||||
mov [esp + 4], eax;
|
||||
call SetShaderTexture;
|
||||
jmp end;
|
||||
fail:
|
||||
@@ -325,7 +325,7 @@ static void __declspec(naked) funcSetShaderFloat() {
|
||||
mov edi, eax;
|
||||
mov eax, ecx;
|
||||
call interpretPopLong_;
|
||||
mov [esp+8], eax;
|
||||
mov [esp + 8], eax;
|
||||
mov eax, ecx;
|
||||
call interpretPopShort_;
|
||||
mov edx, eax;
|
||||
@@ -343,8 +343,8 @@ static void __declspec(naked) funcSetShaderFloat() {
|
||||
jz paramWasFloat;
|
||||
cmp di, VAR_TYPE_INT;
|
||||
jnz fail;
|
||||
fild [esp+8];
|
||||
fstp [esp+8];
|
||||
fild [esp + 8];
|
||||
fstp [esp + 8];
|
||||
paramWasFloat:
|
||||
cmp dx, VAR_TYPE_STR2;
|
||||
jz next;
|
||||
@@ -356,7 +356,7 @@ next:
|
||||
mov eax, ecx;
|
||||
mov ebx, ebp;
|
||||
call interpretGetString_;
|
||||
mov [esp+4], eax;
|
||||
mov [esp + 4], eax;
|
||||
call SetShaderFloat;
|
||||
jmp end;
|
||||
fail:
|
||||
@@ -384,35 +384,37 @@ static void __declspec(naked) funcSetShaderVector() {
|
||||
argloopstart:
|
||||
mov eax, ebp;
|
||||
call interpretPopShort_;
|
||||
mov word ptr [esp+ecx*2+0x16], ax;
|
||||
mov word ptr [esp + ecx * 2 + 0x16], ax;
|
||||
mov eax, ebp;
|
||||
call interpretPopLong_;
|
||||
mov [esp+ecx*4-0x4], eax;
|
||||
loop argloopstart;
|
||||
mov [esp + ecx * 4 - 0x4], eax;
|
||||
dec ecx;
|
||||
jnz argloopstart;
|
||||
//Error check
|
||||
mov ecx, 4;
|
||||
checkloopstart:
|
||||
cmp word ptr [esp+ecx*2+0x1a], VAR_TYPE_FLOAT;
|
||||
cmp word ptr [esp + ecx * 2 + 0x1a], VAR_TYPE_FLOAT;
|
||||
jz paramWasFloat;
|
||||
cmp word ptr [esp+ecx*2+0x1a], VAR_TYPE_INT;
|
||||
cmp word ptr [esp + ecx * 2 + 0x1a], VAR_TYPE_INT;
|
||||
jnz fail;
|
||||
fild [esp+ecx*4+0x4];
|
||||
fstp [esp+ecx*4+0x4];
|
||||
fild [esp + ecx * 4 + 0x4];
|
||||
fstp [esp + ecx * 4 + 0x4];
|
||||
paramWasFloat:
|
||||
loop checkloopstart;
|
||||
cmp word ptr [esp+0x1a], VAR_TYPE_STR2;
|
||||
dec ecx;
|
||||
jnz checkloopstart;
|
||||
cmp word ptr [esp + 0x1a], VAR_TYPE_STR2;
|
||||
jz next;
|
||||
cmp word ptr [esp+0x1a], VAR_TYPE_STR;
|
||||
cmp word ptr [esp + 0x1a], VAR_TYPE_STR;
|
||||
jnz fail;
|
||||
next:
|
||||
cmp word ptr [esp+0x18], VAR_TYPE_INT;
|
||||
cmp word ptr [esp + 0x18], VAR_TYPE_INT;
|
||||
jnz fail;
|
||||
mov eax, ebp;
|
||||
mov ebx, [esp+4];
|
||||
mov ebx, [esp + 4];
|
||||
xor edx, edx;
|
||||
mov dx, word ptr [esp+0x1a];
|
||||
mov dx, word ptr [esp + 0x1a];
|
||||
call interpretGetString_;
|
||||
mov [esp+4], eax;
|
||||
mov [esp + 4], eax;
|
||||
call SetShaderVector;
|
||||
add esp, 0x12;
|
||||
jmp end;
|
||||
|
||||
+2
-1
@@ -474,7 +474,8 @@ static void __declspec(naked) game_init_databases_hook() {
|
||||
__asm {
|
||||
mov ecx, ds:[_critter_db_handle];
|
||||
mov edx, ds:[_paths];
|
||||
jecxz skip;
|
||||
test ecx, ecx;
|
||||
jz skip;
|
||||
mov [ecx + 0xC], edx; // critter_patches.next->_paths
|
||||
mov edx, ecx;
|
||||
skip:
|
||||
|
||||
Reference in New Issue
Block a user