mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed the start procedure not being called correctly
* If the required standard script procedure is missing, the procedure above the start proc is called instead of the start (from Crafty) Added a id reversion mechanism to remove_weapon_knockback.
This commit is contained in:
+1
-1
@@ -79,7 +79,7 @@ GraphicsHeight=0
|
||||
GPUBlt=0
|
||||
|
||||
;Set to 1 to allow using 32 bit graphics for talking heads
|
||||
;Requires graphics mode 4 or 5, and GPUBlt set to 1
|
||||
;Requires DX9 graphics mode and v2.0 pixel shader support (see GPUBlt option)
|
||||
Use32BitHeadGraphics=0
|
||||
|
||||
;Set to 1 to automatically search for alternative avi video files when Fallout tries to play the game movies
|
||||
|
||||
@@ -76,7 +76,7 @@ void SkillSetTags(long* tags, long num) {
|
||||
fo::func::skill_set_tags(tags, num);
|
||||
}
|
||||
|
||||
int _fastcall GetItemType(GameObject* item) {
|
||||
int __fastcall GetItemType(GameObject* item) {
|
||||
return fo::func::item_get_type(item);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ void SkillGetTags(long* result, long num);
|
||||
// wrapper for skill_set_tags with bounds checking
|
||||
void SkillSetTags(long* tags, long num);
|
||||
|
||||
int _fastcall GetItemType(GameObject* item);
|
||||
int __fastcall GetItemType(GameObject* item);
|
||||
|
||||
_declspec(noinline) GameObject* GetItemPtrSlot(GameObject* critter, InvenType slot);
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
// because the compiler builds the better/optimized code when calling the engine functions
|
||||
WRAP_WATCOM_FFUNC4(long, _word_wrap, const char*, text, int, maxWidth, DWORD*, buf, BYTE*, count)
|
||||
WRAP_WATCOM_FFUNC7(long, createWindow, const char*, winName, long, x, long, y, long, width, long, height, long, bgColorIndex, long, flags)
|
||||
WRAP_WATCOM_FFUNC3(long, frame_ptr, FrmFrameData*, frm, long, rotation, long, frame)
|
||||
WRAP_WATCOM_FFUNC7(void, make_straight_path_func, fo::GameObject*, objFrom, DWORD, tileFrom, DWORD, tileTo, void*, rotationPtr, DWORD*, result, long, flags, void*, func)
|
||||
WRAP_WATCOM_FFUNC3(long, object_under_mouse, long, crSwitch, long, inclDude, long, elevation)
|
||||
|
||||
@@ -80,6 +81,7 @@ WRAP_WATCOM_FUNC0(void, mouse_show)
|
||||
WRAP_WATCOM_FUNC0(void, mouse_hide)
|
||||
// calculates path and returns it's length
|
||||
WRAP_WATCOM_FUNC6(long, make_path_func, GameObject*, objectFrom, long, tileFrom, long, tileTo, char*, pathDataBuffer, long, arg5, void*, blockingFunc)
|
||||
WRAP_WATCOM_FUNC0(long, new_obj_id)
|
||||
// calculates bounding box (rectangle) for a given object
|
||||
WRAP_WATCOM_FUNC2(void, obj_bound, GameObject*, object, BoundRect*, boundRect)
|
||||
WRAP_WATCOM_FUNC2(long, obj_erase_object, GameObject*, object, BoundRect*, boundRect)
|
||||
|
||||
@@ -2045,6 +2045,28 @@ skip:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) exec_script_proc_hack() {
|
||||
__asm {
|
||||
mov eax, [esi + 0x58];
|
||||
test eax, eax;
|
||||
ja end;
|
||||
inc eax; // start proc
|
||||
end:
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) exec_script_proc_hack1() {
|
||||
__asm {
|
||||
mov esi, [edi + 0x58];
|
||||
test esi, esi;
|
||||
ja end;
|
||||
inc esi; // start proc
|
||||
end:
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
void BugFixes::init()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
@@ -2590,6 +2612,10 @@ void BugFixes::init()
|
||||
HookCall(0x48D666, obj_load_dude_hook1);
|
||||
BlockCall(0x48D675);
|
||||
BlockCall(0x48D69D);
|
||||
|
||||
// Fix for the start procedure not being called correctly if the required standard script procedure is missing
|
||||
MakeCall(0x4A4926, exec_script_proc_hack);
|
||||
MakeCall(0x4A4979, exec_script_proc_hack1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -275,8 +275,10 @@ void _stdcall KnockbackSetMod(fo::GameObject* object, DWORD type, float val, DWO
|
||||
|
||||
void _stdcall KnockbackRemoveMod(fo::GameObject* object, DWORD on) {
|
||||
std::vector<KnockbackModifier>* mods;
|
||||
int id = object->id;
|
||||
switch (on) {
|
||||
case 0:
|
||||
object->id = fo::func::new_obj_id(); // revert to engine range id
|
||||
mods = &mWeapons;
|
||||
break;
|
||||
case 1:
|
||||
@@ -289,7 +291,7 @@ void _stdcall KnockbackRemoveMod(fo::GameObject* object, DWORD on) {
|
||||
return;
|
||||
}
|
||||
for (DWORD i = 0; i < mods->size(); i++) {
|
||||
if ((*mods)[i].id == object->id) {
|
||||
if ((*mods)[i].id == id) {
|
||||
mods->erase(mods->begin() + i);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ static void __declspec(naked) PlayFrameHook2() {
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD _cdecl PreparePlayMovie(const DWORD id) {
|
||||
static DWORD __cdecl PreparePlayMovie(const DWORD id) {
|
||||
//Get file path in unicode
|
||||
wchar_t path[MAX_PATH];
|
||||
char* master_patches = fo::var::patches;
|
||||
@@ -543,7 +543,7 @@ static sDSSound* PlayingSound(wchar_t* path, bool loop) {
|
||||
}
|
||||
|
||||
static const wchar_t *SoundExtensions[] = { L"mp3", L"wma", L"wav" };
|
||||
static bool _cdecl SoundFileLoad(DWORD called, const char* path) {
|
||||
static bool __cdecl SoundFileLoad(DWORD called, const char* path) {
|
||||
if (!path || strlen(path) < 4) return false;
|
||||
wchar_t buf[256];
|
||||
mbstowcs_s(0, buf, path, 256);
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace sfall
|
||||
{
|
||||
|
||||
enum UniqueID {
|
||||
Start = 0x10000000,
|
||||
Start = 0x0FFFFFFF, // start at 0x10000000
|
||||
End = 0x7FFFFFFF
|
||||
};
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
namespace sfall
|
||||
{
|
||||
|
||||
static long* _fastcall GetProto(fo::GameObject*);
|
||||
static long* __fastcall GetProto(fo::GameObject*);
|
||||
|
||||
struct ProtoMem {
|
||||
long* proto;
|
||||
@@ -285,7 +285,7 @@ static long ApplyAllStatsToProto(const protoMem_iterator &iter, long* &proto_out
|
||||
}
|
||||
|
||||
// Returns the prototype NPC located in memory
|
||||
static long* _fastcall GetProto(fo::GameObject* critter) {
|
||||
static long* __fastcall GetProto(fo::GameObject* critter) {
|
||||
if (protoMem.empty() || critter == fo::var::obj_dude) return nullptr;
|
||||
if (lastGetProtoID.id == critter->id) return lastGetProtoID.proto;
|
||||
|
||||
@@ -358,7 +358,7 @@ static void AddStatToProto(long stat, fo::GameObject* critter, long amount, long
|
||||
SetStatValue(vec.back().s_proto, offset, amount); // set value to individuals prototype
|
||||
}
|
||||
|
||||
static void _fastcall SetStatToProto(long stat, fo::GameObject* critter, long amount, long* protoBase, long offset, bool isSaved) {
|
||||
static void __fastcall SetStatToProto(long stat, fo::GameObject* critter, long amount, long* protoBase, long offset, bool isSaved) {
|
||||
if (critter != fo::var::obj_dude) {
|
||||
if (isNotPartyMemberPid == critter->protoId || !IsPartyMember(critter)) {
|
||||
isNotPartyMemberPid = critter->protoId;
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
#include "Modules\Sound.h"
|
||||
#include "Modules\SpeedPatch.h"
|
||||
#include "Modules\Stats.h"
|
||||
#include "Modules\TalkingHeads.h"
|
||||
#include "Modules\ExtraSaveSlots.h"
|
||||
#include "Modules\Tiles.h"
|
||||
#include "Modules\Worldmap.h"
|
||||
@@ -178,6 +179,7 @@ static void InitModules() {
|
||||
manager.add<BarBoxes>();
|
||||
manager.add<HeroAppearance>();
|
||||
manager.add<MiscPatches>();
|
||||
manager.add<TalkingHeads>();
|
||||
manager.add<DebugEditor>();
|
||||
|
||||
manager.initAll();
|
||||
|
||||
Reference in New Issue
Block a user