Reverted the calling convention of db functions to stdcall

* due to the glitched code generation in Tiles.cpp.

Reverted the name changes of some variables.
This commit is contained in:
NovaRain
2021-04-26 21:52:11 +08:00
parent 55000ca940
commit 5a375484c4
20 changed files with 92 additions and 91 deletions
+1 -1
View File
@@ -1069,7 +1069,7 @@ static void __fastcall sf_critter_wake_clear(TGameObj* critter) {
static void __declspec(naked) critter_wake_up_hook() {
__asm {
mov ecx, eax;
test ScriptExtender_OnMapLeave, 1;
test scriptExtOnMapLeave, 1;
jnz sf_critter_wake_clear;
jmp dude_standup_;
}
+2 -2
View File
@@ -64,7 +64,7 @@ struct KnockbackModifier {
double value;
};
long Combat_determineHitChance; // the value of hit chance w/o any cap
long determineHitChance; // the value of hit chance w/o any cap
static std::vector<long> noBursts; // critter id
@@ -276,7 +276,7 @@ static void __declspec(naked) compute_dmg_damage_hack() {
}
static int __fastcall HitChanceMod(int base, TGameObj* critter) {
Combat_determineHitChance = base;
determineHitChance = base;
for (size_t i = 0; i < hitChanceMods.size(); i++) {
if (critter->id == hitChanceMods[i].id) {
return min(base + hitChanceMods[i].mod, hitChanceMods[i].maximum);
+1 -1
View File
@@ -37,7 +37,7 @@ struct ChanceModifier {
}
};
extern long Combat_determineHitChance;
extern long determineHitChance;
void Combat_Init();
void Combat_OnGameLoad();
+1 -1
View File
@@ -58,7 +58,7 @@ struct sArray {
};
static void DEGameWinRedraw() {
if (Graphics_mode != 0) fo_process_bk();
if (GraphicsMode != 0) fo_process_bk();
}
static bool SetBlocking(SOCKET s, bool block) {
+10 -9
View File
@@ -211,25 +211,26 @@ WRAP_WATCOM_FUNC0(long, windowWidth)
WRAP_WATCOM_FUNC1(void, wmRefreshInterfaceOverlay, long, isRedraw)
/* Database functions */
// Note: keep these as stdcall to prevent unexpected glitches from VS2010 code generation (Tiles.cpp)
WRAP_WATCOM_FUNC1(bool, db_access, const char*, fileName) // Checks if given file exists in DB
WRAP_WATCOM_FUNC1(long, db_fclose, DbFile*, file)
WRAP_WATCOM_FUNC2(DbFile*, db_fopen, const char*, path, const char*, mode)
//WRAP_WATCOM_FUNC1(long, db_fgetc, DbFile*, file)
WRAP_WATCOM_FUNC3(char*, db_fgets, char*, buf, long, max_count, DbFile*, file)
WRAP_WATCOM_FFUNC4(long, db_fread, void*, buf, long, elsize, long, count, DbFile*, file)
WRAP_WATCOM_FFUNC3(long, db_fseek, DbFile*, file, long, pos, long, origin)
WRAP_WATCOM_FUNC4(long, db_fread, void*, buf, long, elsize, long, count, DbFile*, file)
WRAP_WATCOM_FUNC3(long, db_fseek, DbFile*, file, long, pos, long, origin)
WRAP_WATCOM_FUNC2(void, db_free_file_list, char***, fileList, DWORD, arg2) // Destroys filelist array created by db_get_file_list
WRAP_WATCOM_FUNC2(long, db_freadByte, DbFile*, file, BYTE*, _out)
WRAP_WATCOM_FUNC2(long, db_freadShort, DbFile*, file, WORD*, _out)
WRAP_WATCOM_FUNC2(long, db_freadInt, DbFile*, file, DWORD*, _out)
WRAP_WATCOM_FFUNC3(long, db_freadByteCount, DbFile*, file, BYTE*, dest, long, count)
WRAP_WATCOM_FFUNC3(long, db_freadShortCount, DbFile*, file, WORD*, dest, long, count)
WRAP_WATCOM_FFUNC3(long, db_freadIntCount, DbFile*, file, DWORD*, dest, long, count)
//WRAP_WATCOM_FFUNC3(long, db_freadLongCount, DbFile*, file, DWORD*, dest, long, count)
WRAP_WATCOM_FUNC3(long, db_freadByteCount, DbFile*, file, BYTE*, dest, long, count)
WRAP_WATCOM_FUNC3(long, db_freadShortCount, DbFile*, file, WORD*, dest, long, count)
WRAP_WATCOM_FUNC3(long, db_freadIntCount, DbFile*, file, DWORD*, dest, long, count)
//WRAP_WATCOM_FUNC3(long, db_freadLongCount, DbFile*, file, DWORD*, dest, long, count)
WRAP_WATCOM_FUNC2(long, db_fwriteByte, DbFile*, file, long, value)
WRAP_WATCOM_FUNC2(long, db_fwriteInt, DbFile*, file, long, value)
WRAP_WATCOM_FFUNC3(long, db_fwriteByteCount, DbFile*, file, const BYTE*, cptr, long, count)
//WRAP_WATCOM_FFUNC3(long, db_fwriteLongCount, DbFile*, file, DWORD*, dest, long, count)
WRAP_WATCOM_FUNC3(long, db_fwriteByteCount, DbFile*, file, const BYTE*, cptr, long, count)
//WRAP_WATCOM_FUNC3(long, db_fwriteLongCount, DbFile*, file, DWORD*, dest, long, count)
WRAP_WATCOM_FUNC2(long, db_dir_entry, const char*, fileName, DWORD*, sizeOut) // Check fallout file and get file size (result 0 - file exists)
// Searches files in DB by given path/filename mask and stores result in fileList
// fileList is a pointer to a variable, that will be assigned with an address of an array of char* strings
@@ -239,4 +240,4 @@ WRAP_WATCOM_FUNC1(void*, dbase_open, const char*, fileName)
WRAP_WATCOM_FUNC1(void, dbase_close, void*, dbPtr)
WRAP_WATCOM_FUNC2(DbFile*, xfopen, const char*, fileName, const char*, flags)
WRAP_WATCOM_FFUNC3(long, xfseek, DbFile*, file, long, fOffset, long, origin)
WRAP_WATCOM_FUNC3(long, xfseek, DbFile*, file, long, fOffset, long, origin)
+35 -35
View File
@@ -105,8 +105,8 @@ IDirectDrawSurface* primaryDDSurface = nullptr; // aka _GNW95_DDPrimarySurface
static DWORD ResWidth;
static DWORD ResHeight;
DWORD Graphics_GPUBlt;
DWORD Graphics_mode;
DWORD GPUBlt;
DWORD GraphicsMode;
bool Gfx_PlayAviMovie = false;
bool Gfx_AviMovieWidthFit = false;
@@ -254,7 +254,7 @@ void __stdcall SetShaderMode(DWORD d, DWORD mode) {
}
int __stdcall LoadShader(const char* file) {
if (!Graphics_mode || strstr(file, "..") || strstr(file, ":")) return -1;
if (!GraphicsMode || strstr(file, "..") || strstr(file, ":")) return -1;
char buf[MAX_PATH];
sprintf_s(buf, "%s\\shaders\\%s", (*ptr_master_db_handle)->path, file); // *ptr_patches
for (DWORD d = 0; d < shadersSize; d++) {
@@ -378,13 +378,13 @@ static void ResetDevice(bool createNew) {
GetDisplayMode(dispMode);
params.BackBufferCount = 1;
params.BackBufferFormat = dispMode.Format; // (Graphics_mode != 4) ? D3DFMT_UNKNOWN : D3DFMT_X8R8G8B8;
params.BackBufferFormat = dispMode.Format; // (GraphicsMode != 4) ? D3DFMT_UNKNOWN : D3DFMT_X8R8G8B8;
params.BackBufferWidth = gWidth;
params.BackBufferHeight = gHeight;
params.EnableAutoDepthStencil = false;
//params.MultiSampleQuality = 0;
//params.MultiSampleType = D3DMULTISAMPLE_NONE;
params.Windowed = (Graphics_mode != 4);
params.Windowed = (GraphicsMode != 4);
params.SwapEffect = D3DSWAPEFFECT_DISCARD;
params.hDeviceWindow = window;
params.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
@@ -408,9 +408,9 @@ static void ResetDevice(bool createNew) {
ShaderVersion = ((caps.PixelShaderVersion & 0x0000FF00) >> 8) * 10 + (caps.PixelShaderVersion & 0xFF);
// Use: 0 - only CPU, 1 - force GPU, 2 - Auto Mode (GPU or switch to CPU)
if (Graphics_GPUBlt == 2 && ShaderVersion < 20) Graphics_GPUBlt = 0;
if (GPUBlt == 2 && ShaderVersion < 20) GPUBlt = 0;
if (Graphics_GPUBlt) {
if (GPUBlt) {
A8_IsSupport = (d3d9Device->CreateTexture(ResWidth, ResHeight, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8, D3DPOOL_DEFAULT, &mainTex, 0) == D3D_OK);
textureFormat = (A8_IsSupport) ? D3DFMT_A8 : D3DFMT_L8; // D3DFMT_A8 - not supported on some older video cards
@@ -437,7 +437,7 @@ static void ResetDevice(bool createNew) {
if (!A8_IsSupport && d3d9Device->CreateTexture(ResWidth, ResHeight, 1, D3DUSAGE_DYNAMIC, textureFormat, D3DPOOL_DEFAULT, &mainTex, 0) != D3D_OK) {
d3d9Device->CreateTexture(ResWidth, ResHeight, 1, D3DUSAGE_DYNAMIC, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &mainTex, 0);
Graphics_GPUBlt = 0;
GPUBlt = 0;
textureFormat = D3DFMT_X8R8G8B8;
MessageBoxA(window, "GPU does not support the D3DFMT_L8 texture format.\nNow CPU is used to convert the palette.",
"Texture format error", MB_TASKMODAL | MB_ICONWARNING);
@@ -448,7 +448,7 @@ static void ResetDevice(bool createNew) {
sTex1->GetSurfaceLevel(0, &sSurf1);
sTex2->GetSurfaceLevel(0, &sSurf2);
if (Graphics_GPUBlt) {
if (GPUBlt) {
d3d9Device->CreateTexture(256, 1, 1, D3DUSAGE_DYNAMIC, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &gpuPalette, 0);
gpuBltEffect->SetTexture(gpuBltMainTex, mainTex);
gpuBltEffect->SetTexture(gpuBltPalette, gpuPalette);
@@ -581,7 +581,7 @@ static void Refresh() {
d3d9Device->SetTexture(0, mainTex);
UINT passes;
if (Graphics_GPUBlt) {
if (GPUBlt) {
// converts the palette in mainTex to RGB colors on the target surface (sSurf1/sTex1)
gpuBltEffect->Begin(&passes, 0);
gpuBltEffect->BeginPass(0);
@@ -718,7 +718,7 @@ void Gfx_ShowMovieFrame(IDirect3DTexture9* tex) {
d3d9Device->BeginScene();
if (!mainTexLock) {
if (shadersSize && Graphics_GPUBlt) {
if (shadersSize && GPUBlt) {
d3d9Device->SetTexture(0, sTex2);
} else {
d3d9Device->SetTexture(0, mainTex);
@@ -726,13 +726,13 @@ void Gfx_ShowMovieFrame(IDirect3DTexture9* tex) {
d3d9Device->SetStreamSource(0, vertexSfallRes, 0, sizeof(VertexFormat));
// for showing subtitles
if (Graphics_GPUBlt) {
if (GPUBlt) {
UINT passes;
gpuBltEffect->Begin(&passes, 0);
gpuBltEffect->BeginPass(0);
}
d3d9Device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
if (Graphics_GPUBlt) {
if (GPUBlt) {
gpuBltEffect->EndPass();
gpuBltEffect->End();
}
@@ -791,7 +791,7 @@ public:
Refs = 1;
isPrimary = primary;
lockTarget = nullptr;
if (primary && Graphics_GPUBlt) {
if (primary && GPUBlt) {
// use the mainTex texture as a buffer
} else {
lockTarget = new BYTE[ResWidth * ResHeight];
@@ -835,7 +835,7 @@ public:
DWORD width = mveDesc.lPitch; // the current size of the width of the mve movie
if (Graphics_GPUBlt) {
if (GPUBlt) {
fo_buf_to_buf(lockTarget, width, mveDesc.dwHeight, width, (BYTE*)dRect.pBits, dRect.Pitch);
//char* pBits = (char*)dRect.pBits;
//for (DWORD y = 0; y < mveDesc.dwHeight; y++) {
@@ -893,7 +893,7 @@ public:
if (DeviceLost && Restore() == DD_FALSE) return DDERR_SURFACELOST; // DDERR_SURFACELOST 0x887601C2
if (isPrimary) {
lockRect = a;
if (Graphics_GPUBlt) {
if (GPUBlt) {
D3DLOCKED_RECT buf;
if (SUCCEEDED(mainTex->LockRect(0, &buf, lockRect, 0))) {
mainTexLock = true;
@@ -921,7 +921,7 @@ public:
if (d3d9Device->TestCooperativeLevel() == D3DERR_DEVICENOTRESET) {
ResetDevice(false);
DeviceLost = false;
if (Graphics_GPUBlt) SetGPUPalette(); // restore palette
if (GPUBlt) SetGPUPalette(); // restore palette
dlogr("\nD3D9 Device restored.", DL_MAIN);
}
return DeviceLost;
@@ -971,7 +971,7 @@ public:
if (!isPrimary) return DD_OK;
//dlog("\nUnlock -> primary", DL_INIT);
if (Graphics_GPUBlt == 0) {
if (GPUBlt == 0) {
mainTexLock = true;
D3DLOCKED_RECT dRect;
@@ -1064,7 +1064,7 @@ public:
__movsd((DWORD*)&palette[b], (DWORD*)destPal, c);
if (Graphics_GPUBlt) {
if (GPUBlt) {
SetGPUPalette();
} else {
// X8B8G8R8 format
@@ -1074,7 +1074,7 @@ public:
palette[i].R = clr;
}
primaryDDSurface->SetPalette(0); // update texture
if (FakeDirectDrawSurface::IsPlayMovie) return DD_OK; // prevents flickering at the beginning of playback (w/o HRP & Graphics_GPUBlt=2)
if (FakeDirectDrawSurface::IsPlayMovie) return DD_OK; // prevents flickering at the beginning of playback (w/o HRP & GPUBlt=2)
}
if (!Gfx_PlayAviMovie) {
//dlog("\nSetEntries -> RefreshGraphics", DL_INIT);
@@ -1170,7 +1170,7 @@ public:
}
dlog("Creating D3D9 Device window...", DL_MAIN);
if (Graphics_mode >= 5) {
if (GraphicsMode >= 5) {
SetWindowLong(a, GWL_STYLE, windowStyle);
RECT r;
r.left = 0;
@@ -1221,7 +1221,7 @@ HRESULT __stdcall FakeDirectDrawCreate2(void*, IDirectDraw** b, void*) {
mveDesc.dwWidth = 640;
mveDesc.dwHeight = 480;
if (Graphics_mode == 6) {
if (GraphicsMode == 6) {
D3DDISPLAYMODE dispMode;
GetDisplayMode(dispMode);
gWidth = dispMode.Width;
@@ -1235,12 +1235,12 @@ HRESULT __stdcall FakeDirectDrawCreate2(void*, IDirectDraw** b, void*) {
}
}
Graphics_GPUBlt = GetConfigInt("Graphics", "Graphics_GPUBlt", 0); // 0 - auto, 1 - GPU, 2 - CPU
if (!Graphics_GPUBlt || Graphics_GPUBlt > 2)
Graphics_GPUBlt = 2; // Swap them around to keep compatibility with old ddraw.ini
else if (Graphics_GPUBlt == 2) Graphics_GPUBlt = 0; // Use CPU
GPUBlt = GetConfigInt("Graphics", "GPUBlt", 0); // 0 - auto, 1 - GPU, 2 - CPU
if (!GPUBlt || GPUBlt > 2)
GPUBlt = 2; // Swap them around to keep compatibility with old ddraw.ini
else if (GPUBlt == 2) GPUBlt = 0; // Use CPU
if (Graphics_mode == 5) {
if (GraphicsMode == 5) {
moveWindowKey[0] = GetConfigInt("Input", "WindowScrollKey", 0);
if (moveWindowKey[0] < 0) {
switch (moveWindowKey[0]) {
@@ -1438,14 +1438,14 @@ void Graphics_OnGameLoad() { // ResetShaders
}
void Graphics_Init() {
Graphics_mode = GetConfigInt("Graphics", "Mode", 0);
if (Graphics_mode == 6) {
GraphicsMode = GetConfigInt("Graphics", "Mode", 0);
if (GraphicsMode == 6) {
windowStyle = WS_OVERLAPPED;
} else if (Graphics_mode != 4 && Graphics_mode != 5) {
Graphics_mode = 0;
} else if (GraphicsMode != 4 && GraphicsMode != 5) {
GraphicsMode = 0;
}
if (Graphics_mode) {
if (GraphicsMode) {
dlog("Applying DX9 graphics patch.", DL_INIT);
#ifdef WIN2K
#define _DLL_NAME "d3dx9_42.dll"
@@ -1465,7 +1465,7 @@ void Graphics_Init() {
HookCall(0x44260C, game_init_hook);
// Patch HRP to show the mouse cursor over the window title
if (Graphics_mode == 5 && hrpVersionValid) SafeWrite8(HRPAddress(0x10027142), CODETYPE_JumpShort);
if (GraphicsMode == 5 && hrpVersionValid) SafeWrite8(HRPAddress(0x10027142), CODETYPE_JumpShort);
textureFilter = GetConfigInt("Graphics", "TextureFilter", 1);
dlogr(" Done", DL_INIT);
@@ -1493,8 +1493,8 @@ void Graphics_Init() {
}
void Graphics_Exit() {
if (Graphics_mode) {
if (Graphics_mode == 5) {
if (GraphicsMode) {
if (GraphicsMode == 5) {
int data = windowTop | (windowLeft << 16);
if (data >= 0 && data != windowData) SetConfigInt("Graphics", "WindowData", data);
}
+4 -4
View File
@@ -26,8 +26,8 @@ extern IDirect3D9* d3d9;
extern IDirect3DDevice9* d3d9Device;
extern IDirectDrawSurface* primaryDDSurface;
extern DWORD Graphics_mode;
extern DWORD Graphics_GPUBlt;
extern DWORD GraphicsMode;
extern DWORD GPUBlt;
extern bool Gfx_PlayAviMovie;
extern bool Gfx_AviMovieWidthFit;
@@ -75,7 +75,7 @@ void __stdcall SetShaderTexture(DWORD d, const char* param, DWORD value);
__forceinline void UpdateDDSurface(BYTE* surface, int width, int height, int widthFrom, RECT* rect) {
long x = rect->left;
long y = rect->top;
if (Graphics_mode == 0) {
if (GraphicsMode == 0) {
__asm {
xor eax, eax;
push y;
@@ -96,7 +96,7 @@ __forceinline void UpdateDDSurface(BYTE* surface, int width, int height, int wid
if (primaryDDSurface->Lock(&lockRect, &desc, 0, 0)) return; // lock error
if (Graphics_GPUBlt == 0) desc.lpSurface = (BYTE*)desc.lpSurface + (desc.lPitch * y) + x;
if (GPUBlt == 0) desc.lpSurface = (BYTE*)desc.lpSurface + (desc.lPitch * y) + x;
fo_buf_to_buf(surface, width, height, widthFrom, (BYTE*)desc.lpSurface, desc.lPitch);
primaryDDSurface->Unlock(desc.lpSurface);
+1 -1
View File
@@ -191,7 +191,7 @@ static void __declspec(naked) ToHitHook() {
}
argCount = 8;
args[7] = Combat_determineHitChance;
args[7] = determineHitChance;
RunHookScript(HOOK_TOHIT);
__asm {
+1 -1
View File
@@ -25,7 +25,7 @@
#include "Worldmap.h"
long Interface_ActiveInterfaceWID() {
return LoadGameHook_interfaceWID;
return gameInterfaceWID;
}
enum WinNameType {
+4 -4
View File
@@ -71,7 +71,7 @@ static bool disableHorrigan = false;
static bool pipBoyAvailableAtGameStart = false;
static bool gameLoaded = false;
long LoadGameHook_interfaceWID = -1;
long gameInterfaceWID = -1;
// True if game was started, false when on the main menu
bool IsGameLoaded() {
@@ -256,7 +256,7 @@ static bool __stdcall GameReset(DWORD isGameLoad) {
if (gameLoaded) { // prevent resetting when a new game has not been started (loading saved game from main menu)
// OnGameReset
BugFixes_OnGameLoad();
if (Graphics_mode > 3) Graphics_OnGameLoad();
if (GraphicsMode > 3) Graphics_OnGameLoad();
ForceGraphicsRefresh(0); // disable refresh
LoadOrder_OnGameLoad();
Interface_OnGameLoad();
@@ -675,7 +675,7 @@ static void __declspec(naked) AutomapHook_Start() {
call gmouse_set_cursor_;
test edx, edx;
jnz skip;
mov LoadGameHook_interfaceWID, ebp;
mov gameInterfaceWID, ebp;
_InLoop(1, AUTOMAP);
skip:
retn;
@@ -685,7 +685,7 @@ skip:
static void __declspec(naked) AutomapHook_End() {
__asm {
_InLoop(0, AUTOMAP);
mov LoadGameHook_interfaceWID, -1
mov gameInterfaceWID, -1
jmp win_delete_;
}
}
+1 -1
View File
@@ -18,7 +18,7 @@
#pragma once
extern long LoadGameHook_interfaceWID;
extern long gameInterfaceWID;
void LoadGameHook_Init();
+2 -2
View File
@@ -547,7 +547,7 @@ static __declspec(naked) void LostFocus() {
if (aviPlayState == AVISTATE_Playing) {
if (isActive)
movieInterface.pControl->Run();
else if (Graphics_mode == 4)
else if (GraphicsMode == 4)
BreakMovie();
else
movieInterface.pControl->Pause();
@@ -593,7 +593,7 @@ void Movies_Init() {
WIP: Task
Implement subtitle output from the need to play an mve file in the background.
*/
if (Graphics_mode != 0) {
if (GraphicsMode != 0) {
int allowDShowMovies = GetConfigInt("Graphics", "AllowDShowMovies", 0);
if (allowDShowMovies > 0) {
Gfx_AviMovieWidthFit = (allowDShowMovies >= 2);
+3 -3
View File
@@ -380,7 +380,7 @@ static char gTextBuffer[5120]; // used as global temp text buffer for script fun
// returns the size of the global text buffer
inline static const long GlblTextBufferSize() { return sizeof(gTextBuffer); }
bool ScriptExtender_OnMapLeave;
bool scriptExtOnMapLeave;
static std::vector<long> scriptsIndexList;
@@ -1445,9 +1445,9 @@ static void __declspec(naked) map_save_in_game_hook() {
__asm {
test cl, 1;
jz skip;
mov ScriptExtender_OnMapLeave, 1;
mov scriptExtOnMapLeave, 1;
call scr_exec_map_exit_scripts_;
mov ScriptExtender_OnMapLeave, 0;
mov scriptExtOnMapLeave, 0;
retn;
skip:
jmp partyMemberSaveProtos_;
+1 -1
View File
@@ -97,4 +97,4 @@ void __stdcall RemoveTimerEventScripts(TProgram* script);
extern DWORD availableGlobalScriptTypes;
extern bool alwaysFindScripts;
extern bool displayWinUpdateState;
extern bool ScriptExtender_OnMapLeave;
extern bool scriptExtOnMapLeave;
+1 -1
View File
@@ -24,7 +24,7 @@
// graphics_functions
static void __declspec(naked) op_graphics_funcs_available() {
__asm {
cmp Graphics_mode, 3;
cmp GraphicsMode, 3;
seta dl;
and edx, 0xFF;
_J_RET_VAL_TYPE(VAR_TYPE_INT);
+6 -6
View File
@@ -375,7 +375,7 @@ end:
static void __declspec(naked) op_set_unspent_ap_bonus() {
__asm {
_GET_ARG_INT(end);
mov Stats_standardApAcBonus, eax;
mov standardApAcBonus, eax;
end:
retn;
}
@@ -383,7 +383,7 @@ end:
static void __declspec(naked) op_get_unspent_ap_bonus() {
__asm {
mov edx, Stats_standardApAcBonus;
mov edx, standardApAcBonus;
_J_RET_VAL_TYPE(VAR_TYPE_INT);
}
}
@@ -391,7 +391,7 @@ static void __declspec(naked) op_get_unspent_ap_bonus() {
static void __declspec(naked) op_set_unspent_ap_perk_bonus() {
__asm {
_GET_ARG_INT(end);
mov Stats_extraApAcBonus, eax;
mov extraApAcBonus, eax;
end:
retn;
}
@@ -399,7 +399,7 @@ end:
static void __declspec(naked) op_get_unspent_ap_perk_bonus() {
__asm {
mov edx, Stats_extraApAcBonus;
mov edx, extraApAcBonus;
_J_RET_VAL_TYPE(VAR_TYPE_INT);
}
}
@@ -765,7 +765,7 @@ static void __declspec(naked) statPCAddExperienceCheckPMs_hack() {
mov ebp, [esp]; // return addr
mov xpTemp, eax; // experience
fild xpTemp;
fmul Stats_experienceMod;
fmul experienceMod;
fistp xpTemp;
mov eax, xpTemp;
sub esp, 0xC; // instead of 0x10
@@ -780,7 +780,7 @@ static void __stdcall op_set_xp_mod2() {
if (pctArg.isInt()) {
static bool xpModPatch = false;
long percent = pctArg.rawValue() & 0xFFFF;
Stats_experienceMod = percent / 100.0f;
experienceMod = percent / 100.0f;
if (xpModPatch) return;
xpModPatch = true;
+2 -2
View File
@@ -135,7 +135,7 @@ LRESULT CALLBACK SoundWndProc(HWND wnd, UINT msg, WPARAM w, LPARAM l) {
static void CreateSndWnd() {
dlog("Creating sfall sound callback window.", DL_INIT);
if (Graphics_mode == 0) CoInitialize(0);
if (GraphicsMode == 0) CoInitialize(0);
WNDCLASSEX wcx;
std::memset(&wcx, 0, sizeof(wcx));
@@ -1033,5 +1033,5 @@ void Sound_Init() {
}
void Sound_Exit() {
if (soundwindow && Graphics_mode == 0) CoUninitialize();
if (soundwindow && GraphicsMode == 0) CoUninitialize();
}
+11 -11
View File
@@ -32,9 +32,9 @@ static DWORD statMinimumsNPC[STAT_max_stat];
static DWORD xpTable[99];
float Stats_experienceMod = 1.0f; // set_xp_mod func
DWORD Stats_standardApAcBonus = 4;
DWORD Stats_extraApAcBonus = 4;
float experienceMod = 1.0f; // set_xp_mod func
DWORD standardApAcBonus = 4;
DWORD extraApAcBonus = 4;
static struct StatFormula {
long base;
@@ -131,12 +131,12 @@ static void __declspec(naked) CalcApToAcBonus() {
mov edx, PERK_hth_evade_perk;
mov eax, dword ptr ds:[FO_VAR_obj_dude];
call perk_level_;
imul eax, Stats_extraApAcBonus; // bonus = perkLvl * extraApBonus
imul eax, edi; // perkBonus = bonus * curAP
imul eax, extraApAcBonus; // bonus = perkLvl * extraApBonus
imul eax, edi; // perkBonus = bonus * curAP
standard:
imul edi, Stats_standardApAcBonus; // stdBonus = curAP * standardApBonus
add eax, edi; // bonus = perkBonus + stdBonus
shr eax, 2; // acBonus = bonus / 4
imul edi, standardApAcBonus; // stdBonus = curAP * standardApBonus
add eax, edi; // bonus = perkBonus + stdBonus
shr eax, 2; // acBonus = bonus / 4
end:
retn;
}
@@ -308,10 +308,10 @@ static void StatsReset() {
void Stats_OnGameLoad() {
StatsReset();
// Reset some settable game values back to the defaults
Stats_standardApAcBonus = 4;
Stats_extraApAcBonus = 4;
standardApAcBonus = 4;
extraApAcBonus = 4;
// XP mod set to 100%
Stats_experienceMod = 1.0f;
experienceMod = 1.0f;
// HP bonus
SafeWrite8(0x4AFBC1, 2);
// Skill points per level mod
+3 -3
View File
@@ -18,9 +18,9 @@
#pragma once
extern float Stats_experienceMod;
extern DWORD Stats_standardApAcBonus;
extern DWORD Stats_extraApAcBonus;
extern float experienceMod;
extern DWORD standardApAcBonus;
extern DWORD extraApAcBonus;
void Stats_Init();
void Stats_OnGameLoad();
+2 -2
View File
@@ -252,7 +252,7 @@ noScroll:
}
void TalkingHeadsSetup() {
if (!Graphics_GPUBlt) return;
if (!GPUBlt) return;
*(DWORD*)FO_VAR_lips_draw_head = 0; // fix for non-speaking heads
const DWORD transTalkAddr[] = {0x44AFB4, 0x44B00B};
@@ -266,7 +266,7 @@ void TalkingHeads_Init() {
// Disable centering the screen if NPC has talking head
HookCall(0x445224, gdialogInitFromScript_hook);
if (Graphics_mode && GetConfigInt("Graphics", "Use32BitHeadGraphics", 0)) {
if (GraphicsMode && GetConfigInt("Graphics", "Use32BitHeadGraphics", 0)) {
Use32BitTalkingHeads = true;
}
}