More code style fixes and some wrappers.

This commit is contained in:
phobos2077
2016-11-11 01:27:38 +07:00
parent ec34df50ac
commit 84a60128a2
19 changed files with 769 additions and 474 deletions
+1
View File
@@ -137,6 +137,7 @@ enum Gender
// Some global variables referenced by engine
enum GlobalVar : __int32
{
GVAR_PLAYER_REPUTATION = 0,
GVAR_ENEMY_ARROYO = 7,
GVAR_PLAYER_GOT_CAR = 18,
GVAR_NUKA_COLA_ADDICT = 21,
+3 -1
View File
@@ -30,6 +30,8 @@
// TODO: make consistent naming for all FO structs
struct TGameObj;
struct TProgram;
struct TScript;
/* 26 */
#pragma pack(push, 1)
@@ -102,7 +104,7 @@ struct TScript {
__int32 spatial_radius;
char gap_10[4];
__int32 script_index;
__int32 program_ptr;
TProgram *program_ptr;
__int32 self_obj_id;
char gap_20[8];
__int32 scr_return;
+12
View File
@@ -288,6 +288,18 @@ DWORD* __stdcall runProgram(TProgram* progPtr) {
_WRAP_WATCOM_CALL1(runProgram_, progPtr)
}
TScript* __stdcall scr_find_first_at(int elevation) {
_WRAP_WATCOM_CALL1(scr_find_first_at_, elevation)
}
TScript* __stdcall scr_find_next_at() {
_WRAP_WATCOM_CALL0(scr_find_next_at_)
}
TGameObj* __stdcall scr_find_obj_from_program(TProgram* program) {
_WRAP_WATCOM_CALL1(scr_find_obj_from_program_, program)
}
// Saves pointer to script object into scriptPtr using scriptID.
// Returns 0 on success, -1 on failure.
int __stdcall scr_ptr(int scriptId, TScript** scriptPtr) {
+6
View File
@@ -169,6 +169,12 @@ int proto_ptr(int pid, sProtoBase* *ptrPtr);
DWORD* __stdcall runProgram(TProgram* progPtr);
TScript* __stdcall scr_find_first_at(int elevation);
TScript* __stdcall scr_find_next_at();
TGameObj* __stdcall scr_find_obj_from_program(TProgram* program);
// Saves pointer to script object into scriptPtr using scriptID.
// Returns 0 on success, -1 on failure.
int __stdcall scr_ptr(int scriptId, TScript** scriptPtr);
+103 -25
View File
@@ -58,8 +58,12 @@ static DWORD ForcingGraphicsRefresh=0;
static DWORD DebugEditorKey = 0;
void _stdcall ForceGraphicsRefresh(DWORD d) { ForcingGraphicsRefresh=(d==0)?0:1; }
void GetMouse(int* x, int* y) { *x=mouseX; *y=mouseY; mouseX=0; mouseY=0; }
void _stdcall ForceGraphicsRefresh(DWORD d) {
ForcingGraphicsRefresh = (d == 0) ? 0 : 1;
}
void GetMouse(int* x, int* y) {
*x = mouseX; *y = mouseY; mouseX = 0; mouseY = 0;
}
static BYTE LMouse = 0;
static BYTE RMouse = 0;
@@ -118,6 +122,7 @@ private:
ULONG Refs;
bool formatLock;
DIDATAFORMAT oldFormat;
public:
/*** Constructor and misc functions ***/
FakeDirectInputDevice(IDirectInputDevice* device,DWORD type) {
@@ -127,24 +132,51 @@ public:
formatLock = false;
oldFormat.dwDataSize=0;
}
/*** IUnknown methods ***/
HRESULT _stdcall QueryInterface (REFIID riid, LPVOID * ppvObj) { return RealDevice->QueryInterface(riid,ppvObj); }
ULONG _stdcall AddRef(void) { return ++Refs; }
HRESULT _stdcall QueryInterface(REFIID riid, LPVOID * ppvObj) {
return RealDevice->QueryInterface(riid, ppvObj);
}
ULONG _stdcall AddRef(void) {
return ++Refs;
}
ULONG _stdcall Release(void) {
if (--Refs == 0) {
RealDevice->Release();
delete this;
return 0;
} else { return Refs; }
} else {
return Refs;
}
}
/*** IDirectInputDevice8A methods ***/
HRESULT _stdcall GetCapabilities(LPDIDEVCAPS a) { return RealDevice->GetCapabilities(a); }
HRESULT _stdcall EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKA a,LPVOID b,DWORD c) { return RealDevice->EnumObjects(a,b,c); }
HRESULT _stdcall GetProperty(REFGUID a,DIPROPHEADER* b) { return RealDevice->GetProperty(a,b); }
HRESULT _stdcall SetProperty(REFGUID a,const DIPROPHEADER* b) { return RealDevice->SetProperty(a,b); }
HRESULT _stdcall Acquire(void) { return RealDevice->Acquire(); }
HRESULT _stdcall Unacquire(void) { return RealDevice->Unacquire(); }
HRESULT _stdcall GetCapabilities(LPDIDEVCAPS a) {
return RealDevice->GetCapabilities(a);
}
HRESULT _stdcall EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKA a, LPVOID b, DWORD c) {
return RealDevice->EnumObjects(a, b, c);
}
HRESULT _stdcall GetProperty(REFGUID a, DIPROPHEADER* b) {
return RealDevice->GetProperty(a, b);
}
HRESULT _stdcall SetProperty(REFGUID a, const DIPROPHEADER* b) {
return RealDevice->SetProperty(a, b);
}
HRESULT _stdcall Acquire(void) {
return RealDevice->Acquire();
}
HRESULT _stdcall Unacquire(void) {
return RealDevice->Unacquire();
}
//Only called for the mouse
HRESULT _stdcall GetDeviceState(DWORD a, LPVOID b) {
if (ForcingGraphicsRefresh) RefreshGraphics();
@@ -203,6 +235,7 @@ public:
memcpy(b, &MouseState, sizeof(DIMOUSESTATE));
return 0;
}
//Only called for the keyboard
HRESULT _stdcall GetDeviceData(DWORD a, DIDEVICEOBJECTDATA* b, DWORD* c, DWORD d) {
if (DeviceType != kDeviceType_KEYBOARD) {
@@ -230,40 +263,73 @@ public:
*c = 1;
return DI_OK;
}
HRESULT _stdcall SetDataFormat(const DIDATAFORMAT* a) {
if (formatLock&&oldFormat.dwSize) return RealDevice->SetDataFormat(&oldFormat);
memcpy(&oldFormat, a, sizeof(DIDATAFORMAT));
return RealDevice->SetDataFormat(a);
}
HRESULT _stdcall SetEventNotification(HANDLE a) { return RealDevice->SetEventNotification(a); }
HRESULT _stdcall SetEventNotification(HANDLE a) {
return RealDevice->SetEventNotification(a);
}
HRESULT _stdcall SetCooperativeLevel(HWND a, DWORD b) {
if (DeviceType == kDeviceType_KEYBOARD&&BackgroundKeyboard) b = DISCL_BACKGROUND | DISCL_NONEXCLUSIVE;
if (DeviceType == kDeviceType_MOUSE&&BackgroundMouse) b = DISCL_BACKGROUND | DISCL_NONEXCLUSIVE;
return RealDevice->SetCooperativeLevel(a, b);
}
HRESULT _stdcall GetObjectInfo(LPDIDEVICEOBJECTINSTANCEA a,DWORD b,DWORD c) { return RealDevice->GetObjectInfo(a,b,c); }
HRESULT _stdcall GetDeviceInfo(LPDIDEVICEINSTANCEA a) { return RealDevice->GetDeviceInfo(a); }
HRESULT _stdcall RunControlPanel(HWND a,DWORD b) { return RealDevice->RunControlPanel(a,b); }
HRESULT _stdcall Initialize(HINSTANCE a,DWORD b,REFGUID c) { return RealDevice->Initialize(a,b,c); }
void LockDataFormat(bool lock) {formatLock = lock; }
HRESULT _stdcall GetObjectInfo(LPDIDEVICEOBJECTINSTANCEA a, DWORD b, DWORD c) {
return RealDevice->GetObjectInfo(a, b, c);
}
HRESULT _stdcall GetDeviceInfo(LPDIDEVICEINSTANCEA a) {
return RealDevice->GetDeviceInfo(a);
}
HRESULT _stdcall RunControlPanel(HWND a, DWORD b) {
return RealDevice->RunControlPanel(a, b);
}
HRESULT _stdcall Initialize(HINSTANCE a, DWORD b, REFGUID c) {
return RealDevice->Initialize(a, b, c);
}
void LockDataFormat(bool lock) {
formatLock = lock;
}
};
class FakeDirectInput : public IDirectInputA {
private:
IDirectInputA* RealInput;
ULONG Refs;
public:
/*** Constructor ***/
FakeDirectInput(IDirectInput* Real) { RealInput=Real; Refs=1; }
FakeDirectInput(IDirectInput* Real) {
RealInput = Real; Refs = 1;
}
/*** IUnknown methods ***/
HRESULT _stdcall QueryInterface (REFIID riid, LPVOID* ppvObj) { return RealInput->QueryInterface(riid,ppvObj); }
ULONG _stdcall AddRef(void) { return ++Refs; }
HRESULT _stdcall QueryInterface(REFIID riid, LPVOID* ppvObj) {
return RealInput->QueryInterface(riid, ppvObj);
}
ULONG _stdcall AddRef(void) {
return ++Refs;
}
ULONG _stdcall Release(void) {
if (--Refs == 0) {
RealInput->Release();
delete this;
return 0;
} else { return Refs; }
} else {
return Refs;
}
}
/*** IDirectInput8A methods ***/
HRESULT _stdcall CreateDevice(REFGUID r, IDirectInputDeviceA** device, IUnknown* unused) {
GUID GUID_SysMouse = { 0x6F1D2B60, 0xD5A0, 0x11CF, { 0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00} };
@@ -291,10 +357,22 @@ public:
return DI_OK;
}
}
HRESULT _stdcall EnumDevices(DWORD a,LPDIENUMDEVICESCALLBACKA b,void* c,DWORD d) { return RealInput->EnumDevices(a,b,c,d); }
HRESULT _stdcall GetDeviceStatus(REFGUID r) { return RealInput->GetDeviceStatus(r); }
HRESULT _stdcall RunControlPanel(HWND a,DWORD b) { return RealInput->RunControlPanel(a,b); }
HRESULT _stdcall Initialize(HINSTANCE a,DWORD b) { return RealInput->Initialize(a,b); }
HRESULT _stdcall EnumDevices(DWORD a, LPDIENUMDEVICESCALLBACKA b, void* c, DWORD d) {
return RealInput->EnumDevices(a, b, c, d);
}
HRESULT _stdcall GetDeviceStatus(REFGUID r) {
return RealInput->GetDeviceStatus(r);
}
HRESULT _stdcall RunControlPanel(HWND a, DWORD b) {
return RealInput->RunControlPanel(a, b);
}
HRESULT _stdcall Initialize(HINSTANCE a, DWORD b) {
return RealInput->Initialize(a, b);
}
};
HRESULT _stdcall FakeDirectInputCreate(HINSTANCE a, DWORD b, IDirectInputA** c, IUnknown* d) {
+12 -4
View File
@@ -55,10 +55,18 @@ void dlog_f(const char *fmt, int type, ...) {
void LoggingInit() {
Log.open("sfall-log.txt", ios_base::out | ios_base::trunc);
if (GetPrivateProfileIntA("Debugging", "Init", 0, ".\\ddraw.ini")) DebugTypes |= DL_INIT;
if (GetPrivateProfileIntA("Debugging", "Hook", 0, ".\\ddraw.ini")) DebugTypes |= DL_HOOK;
if (GetPrivateProfileIntA("Debugging", "Script", 0, ".\\ddraw.ini")) DebugTypes |= DL_SCRIPT;
if (GetPrivateProfileIntA("Debugging", "Criticals", 0, ".\\ddraw.ini")) DebugTypes |= DL_CRITICALS;
if (GetPrivateProfileIntA("Debugging", "Init", 0, ".\\ddraw.ini")) {
DebugTypes |= DL_INIT;
}
if (GetPrivateProfileIntA("Debugging", "Hook", 0, ".\\ddraw.ini")) {
DebugTypes |= DL_HOOK;
}
if (GetPrivateProfileIntA("Debugging", "Script", 0, ".\\ddraw.ini")) {
DebugTypes |= DL_SCRIPT;
}
if (GetPrivateProfileIntA("Debugging", "Criticals", 0, ".\\ddraw.ini")) {
DebugTypes |= DL_CRITICALS;
}
}
#endif
+16
View File
@@ -66,6 +66,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_copy() {
__asm {
pushad;
@@ -116,6 +117,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_find() {
__asm {
pushad;
@@ -150,6 +152,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_write_byte() {
__asm {
pushad;
@@ -176,6 +179,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_write_short() {
__asm {
pushad;
@@ -202,6 +206,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_write_int() {
__asm {
pushad;
@@ -231,6 +236,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_write_string() {
__asm {
pushad;
@@ -265,6 +271,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_write_bstring() {
__asm {
pushad;
@@ -299,6 +306,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_read_byte() {
__asm {
pushad;
@@ -326,6 +334,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_read_short() {
__asm {
pushad;
@@ -353,6 +362,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_read_int() {
__asm {
pushad;
@@ -380,6 +390,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_read_float() {
__asm {
pushad;
@@ -407,6 +418,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_delete() {
__asm {
pushad;
@@ -424,6 +436,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_size() {
__asm {
pushad;
@@ -451,6 +464,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_pos() {
__asm {
pushad;
@@ -478,6 +492,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_seek() {
__asm {
pushad;
@@ -504,6 +519,7 @@ end:
retn;
}
}
static void __declspec(naked) fs_resize() {
__asm {
pushad;
+12
View File
@@ -46,6 +46,7 @@ end:
retn;
}
}
static void __declspec(naked) funcLoadShader() {
__asm {
push ebx;
@@ -84,6 +85,7 @@ result:
retn;
}
}
static void __declspec(naked) funcFreeShader() {
__asm {
push ebx;
@@ -105,6 +107,7 @@ end:
retn;
}
}
static void __declspec(naked) funcActivateShader() {
__asm {
push ebx;
@@ -126,6 +129,7 @@ end:
retn;
}
}
static void __declspec(naked) funcDeactivateShader() {
__asm {
push ebx;
@@ -147,6 +151,7 @@ end:
retn;
}
}
static void __declspec(naked) funcGetShaderTexture() {
__asm {
//Store registers
@@ -198,6 +203,7 @@ end:
retn;
}
}
static void __declspec(naked) funcSetShaderInt() {
__asm {
push ebx;
@@ -254,6 +260,7 @@ end:
retn;
}
}
static void __declspec(naked) funcSetShaderTexture() {
__asm {
push ebx;
@@ -310,6 +317,7 @@ end:
retn;
}
}
static void __declspec(naked) funcSetShaderFloat() {
__asm {
push ebx;
@@ -371,6 +379,7 @@ end:
retn;
}
}
static void __declspec(naked) funcSetShaderVector() {
__asm {
push ebx;
@@ -426,6 +435,7 @@ end:
retn;
}
}
static void __declspec(naked) funcGetShaderVersion() {
__asm {
push ebx;
@@ -447,6 +457,7 @@ static void __declspec(naked) funcGetShaderVersion() {
retn;
}
}
static void __declspec(naked) funcSetShaderMode() {
__asm {
push ebx;
@@ -481,6 +492,7 @@ end:
retn;
}
}
static void __declspec(naked) funcForceGraphicsRefresh() {
__asm {
push ebx;
+7
View File
@@ -42,6 +42,7 @@ static void __declspec(naked) InputFuncsAvailable() {
retn;
}
}
static void __declspec(naked) KeyPressed() {
__asm {
push ebx;
@@ -74,6 +75,7 @@ end:
retn;
}
}
static void __declspec(naked) funcTapKey() {
__asm {
push ebx;
@@ -286,6 +288,7 @@ static void __declspec(naked) GetViewportX() {
retn;
}
}
static void __declspec(naked) GetViewportY() {
__asm {
push ebx;
@@ -303,6 +306,7 @@ static void __declspec(naked) GetViewportY() {
retn;
}
}
static void __declspec(naked) SetViewportX() {
__asm {
push ebx;
@@ -323,6 +327,7 @@ end:
retn;
}
}
static void __declspec(naked) SetViewportY() {
__asm {
push ebx;
@@ -369,6 +374,7 @@ end:
retn;
}
}
static void __declspec(naked) HideIfaceTag() {
__asm {
pushad;
@@ -394,6 +400,7 @@ end:
retn;
}
}
static void __declspec(naked) IsIfaceTagActive() {
__asm {
pushad;
+10
View File
@@ -50,6 +50,7 @@ result:
retn;
}
}
static void __declspec(naked) ReadShort() {
__asm {
push ebx;
@@ -78,6 +79,7 @@ result:
retn;
}
}
static void __declspec(naked) ReadInt() {
__asm {
push ebx;
@@ -106,6 +108,7 @@ result:
retn;
}
}
static void __declspec(naked) ReadString() {
__asm {
push ebx;
@@ -134,6 +137,7 @@ result:
retn;
}
}
static void __declspec(naked) WriteByte() {
__asm {
pushad
@@ -162,6 +166,7 @@ end:
retn;
}
}
static void __declspec(naked) WriteShort() {
__asm {
pushad;
@@ -190,6 +195,7 @@ end:
retn;
}
}
static void __declspec(naked) WriteInt() {
__asm {
pushad
@@ -217,6 +223,7 @@ end:
retn;
}
}
static void _stdcall WriteStringInternal(const char* str, char* addr) {
bool hitnull = false;
while (*str) {
@@ -228,6 +235,7 @@ static void _stdcall WriteStringInternal(const char* str, char* addr) {
}
*addr = 0;
}
static void __declspec(naked) WriteString() {
__asm {
pushad;
@@ -263,6 +271,7 @@ end:
retn;
}
}
static void _stdcall CallOffsetInternal(DWORD func, DWORD script) {
func = (func >> 2) - 0x1d2;
bool ret = func >= 5;
@@ -309,6 +318,7 @@ legal:
}
}
}
static void __declspec(naked) CallOffset() {
__asm {
pushad;
+48
View File
@@ -43,6 +43,7 @@ static DWORD MovieNamesPtr=(DWORD)MoviePaths;
static void _stdcall strcpy_p(char* to, const char* from) {
strcpy_s(to, 64, from);
}
static void __declspec(naked) SetDMModel() {
__asm {
push ebx;
@@ -73,6 +74,7 @@ end:
retn;
}
}
static void __declspec(naked) SetDFModel() {
__asm {
push ebx;
@@ -103,6 +105,7 @@ end:
retn;
}
}
static void __declspec(naked) SetMoviePath() {
__asm {
push ebx;
@@ -151,6 +154,7 @@ end:
retn;
}
}
static void __declspec(naked) GetYear() {
__asm {
push ebx;
@@ -182,6 +186,7 @@ end:
retn;
}
}
static void __declspec(naked) GameLoaded() {
__asm {
push ebx;
@@ -234,6 +239,7 @@ fail:
retn;
}
}
static void __declspec(naked) SetPipBoyAvailable() {
__asm {
push ebx;
@@ -293,6 +299,7 @@ end:
retn;
}
}
static void __declspec(naked) ModKillCounter() {
__asm {
push ebx;
@@ -371,6 +378,7 @@ end:
retn;
}
}
static void __declspec(naked) SetWeaponKnockback() {
__asm {
pushad;
@@ -378,6 +386,7 @@ static void __declspec(naked) SetWeaponKnockback() {
jmp SetKnockback;
}
}
static void __declspec(naked) SetTargetKnockback() {
__asm {
pushad;
@@ -385,6 +394,7 @@ static void __declspec(naked) SetTargetKnockback() {
jmp SetKnockback;
}
}
static void __declspec(naked) SetAttackerKnockback() {
__asm {
pushad;
@@ -392,6 +402,7 @@ static void __declspec(naked) SetAttackerKnockback() {
jmp SetKnockback;
}
}
static void __declspec(naked) RemoveKnockback() {
__asm {
mov ecx, eax;
@@ -411,6 +422,7 @@ end:
retn;
}
}
static void __declspec(naked) RemoveWeaponKnockback() {
__asm {
pushad;
@@ -418,6 +430,7 @@ static void __declspec(naked) RemoveWeaponKnockback() {
jmp RemoveKnockback;
}
}
static void __declspec(naked) RemoveTargetKnockback() {
__asm {
pushad;
@@ -425,6 +438,7 @@ static void __declspec(naked) RemoveTargetKnockback() {
jmp RemoveKnockback;
}
}
static void __declspec(naked) RemoveAttackerKnockback() {
__asm {
pushad;
@@ -432,6 +446,7 @@ static void __declspec(naked) RemoveAttackerKnockback() {
jmp RemoveKnockback;
}
}
static void __declspec(naked) GetKillCounter2() {
__asm {
push ebx;
@@ -462,6 +477,7 @@ end:
retn;
}
}
static void __declspec(naked) ModKillCounter2() {
__asm {
push ebx;
@@ -514,6 +530,7 @@ static void __declspec(naked) GetActiveHand() {
retn;
}
}
static void __declspec(naked) ToggleActiveHand() {
__asm {
push ebx;
@@ -544,6 +561,7 @@ static void __declspec(naked) EaxAvailable() {
retn;
}
}
static char* NPCToInc;
static void _stdcall IncNPCLevel4(char* npc) {
if (_stricmp(npc, NPCToInc)) {
@@ -567,6 +585,7 @@ static void _stdcall IncNPCLevel4(char* npc) {
}
}
}
static void __declspec(naked) IncNPCLevel3() {
__asm {
pushad;
@@ -577,6 +596,7 @@ static void __declspec(naked) IncNPCLevel3() {
retn;
}
}
static void _stdcall IncNPCLevel2(char* npc) {
NPCToInc = npc;
SafeWrite8(0x00495BEB, 0xe9); //Replace the debug output with a jmp
@@ -597,6 +617,7 @@ static void _stdcall IncNPCLevel2(char* npc) {
SafeWrite32(0x00495D24, 0x00000129);
}
}
static void __declspec(naked) IncNPCLevel() {
__asm {
push ebx;
@@ -626,6 +647,7 @@ end:
retn;
}
}
static int _stdcall get_npc_level2(DWORD numMembers, DWORD maxMembers, DWORD* members, DWORD* pids, DWORD* words, const char* name) {
for (DWORD i = 0; i < numMembers; i++) {
const char* name2;
@@ -654,6 +676,7 @@ static int _stdcall get_npc_level2(DWORD numMembers, DWORD maxMembers, DWORD* me
}
return 0;
}
static void __declspec(naked) get_npc_level() {
__asm {
push ebx;
@@ -728,6 +751,7 @@ static DWORD _stdcall GetIniSetting2(const char* c, DWORD string) {
return GetPrivateProfileIntA(section, key, -1, file);
}
}
static void __declspec(naked) GetIniSetting() {
__asm {
push ebx;
@@ -767,6 +791,7 @@ result:
retn;
}
}
static void __declspec(naked) GetIniString() {
__asm {
push ebx;
@@ -814,6 +839,7 @@ result:
static DWORD _stdcall GetTickCount2() {
return GetTickCount();
}
static void __declspec(naked) funcGetTickCount() {
__asm {
pushad;
@@ -829,6 +855,7 @@ static void __declspec(naked) funcGetTickCount() {
retn;
}
}
static void __declspec(naked) SetCarTown() {
__asm {
push ebx;
@@ -1012,6 +1039,7 @@ end:
retn;
}
}
static void __declspec(naked) funcResetCriticalTable() {
__asm {
pushad;
@@ -1041,6 +1069,7 @@ end:
retn;
}
}
static void __declspec(naked) SetApAcBonus() {
__asm {
push ecx;
@@ -1059,6 +1088,7 @@ end:
retn;
}
}
static void __declspec(naked) GetApAcBonus() {
__asm {
push ecx;
@@ -1074,6 +1104,7 @@ static void __declspec(naked) GetApAcBonus() {
retn;
}
}
static void __declspec(naked) SetApAcEBonus() {
__asm {
push ecx;
@@ -1092,6 +1123,7 @@ end:
retn;
}
}
static void __declspec(naked) GetApAcEBonus() {
__asm {
push ecx;
@@ -1197,6 +1229,7 @@ end:
retn;
}
}
static void __declspec(naked) set_proto_data() {
__asm {
pushad;
@@ -1263,6 +1296,7 @@ end:
retn;
}
}
static void __declspec(naked) funcSetHeroStyle() {//for setting the hero style/appearance takes an 1 int
__asm {
push ebx;
@@ -1289,6 +1323,7 @@ end:
retn;
}
}
static void __declspec(naked) funcSetHeroRace() {// for setting the hero race takes an 1 int
__asm {
push ebx;
@@ -1329,6 +1364,7 @@ static void __declspec(naked) get_light_level() {
retn;
}
}
static void __declspec(naked) refresh_pc_art() {
__asm {
push ebx;
@@ -1341,6 +1377,7 @@ static void __declspec(naked) refresh_pc_art() {
retn;
}
}
static void __declspec(naked) get_attack_type() {
__asm {
push edx;
@@ -1356,6 +1393,7 @@ static void __declspec(naked) get_attack_type() {
retn;
}
}
static void __declspec(naked) play_sfall_sound() {
__asm {
pushad
@@ -1396,6 +1434,7 @@ end:
retn;
}
}
static void __declspec(naked) stop_sfall_sound() {
__asm {
pushad;
@@ -1461,6 +1500,7 @@ static void __declspec(naked) modified_ini() {
retn;
}
}
static void __declspec(naked) force_aimed_shots() {
__asm {
push ecx;
@@ -1480,6 +1520,7 @@ end:
retn;
}
}
static void __declspec(naked) disable_aimed_shots() {
__asm {
push ecx;
@@ -1499,6 +1540,7 @@ end:
retn;
}
}
static void __declspec(naked) mark_movie_played() {
__asm {
push ecx;
@@ -1521,6 +1563,7 @@ end:
retn;
}
}
static void __declspec(naked) get_last_attacker() {
__asm {
pushad;
@@ -1547,6 +1590,7 @@ end:
retn;
}
}
static void __declspec(naked) get_last_target() {
__asm {
pushad;
@@ -1573,6 +1617,7 @@ end:
retn;
}
}
static void __declspec(naked) block_combat() {
__asm {
pushad;
@@ -1590,6 +1635,7 @@ end:
retn;
}
}
static void __declspec(naked) tile_under_cursor() {
__asm {
push edx;
@@ -1617,6 +1663,7 @@ static void __declspec(naked) tile_under_cursor() {
retn;
}
}
static void __declspec(naked) gdialog_get_barter_mod() {
__asm {
push edx;
@@ -1632,6 +1679,7 @@ static void __declspec(naked) gdialog_get_barter_mod() {
retn;
}
}
static void __declspec(naked) set_inven_ap_cost() {
__asm {
push ecx;
+3
View File
@@ -224,6 +224,7 @@ end:
retn;
}
}
static void __declspec(naked) get_weapon_ammo_pid() {
__asm {
pushad;
@@ -251,6 +252,7 @@ end:
retn;
}
}
static void __declspec(naked) set_weapon_ammo_pid() {
__asm {
pushad;
@@ -277,6 +279,7 @@ end:
retn;
}
}
static void __declspec(naked) get_weapon_ammo_count() {
__asm {
pushad;
+17
View File
@@ -36,6 +36,7 @@ static void __declspec(naked) GetPerkOwed() {
retn;
}
}
static void __declspec(naked) SetPerkOwed() {
__asm {
pushad;
@@ -55,6 +56,7 @@ end:
retn;
}
}
static void __declspec(naked) set_perk_freq() {
__asm {
pushad;
@@ -72,6 +74,7 @@ end:
retn;
}
}
static void __declspec(naked) GetPerkAvailable() {
__asm {
pushad;
@@ -101,6 +104,7 @@ end:
retn;
}
}
static void __declspec(naked) funcSetPerkName() {
__asm {
pushad;
@@ -136,6 +140,7 @@ end:
retn;
}
}
static void __declspec(naked) funcSetPerkDesc() {
__asm {
pushad;
@@ -171,6 +176,7 @@ end:
retn;
}
}
static void __declspec(naked) funcSetPerkValue() {
__asm {
pushad;
@@ -271,6 +277,7 @@ fail:
retn;
}
}
static void __declspec(naked) fSetFakePerk() {
__asm {
pushad;
@@ -339,6 +346,7 @@ fail:
retn;
}
}
static void __declspec(naked) fSetFakeTrait() {
__asm {
push ebx;
@@ -415,6 +423,7 @@ fail:
retn;
}
}
static void __declspec(naked) fSetPerkboxTitle() {
__asm {
push ebx;
@@ -444,6 +453,7 @@ end:
retn;
}
}
static void __declspec(naked) fIgnoreDefaultPerks() {
__asm {
push ebx;
@@ -456,6 +466,7 @@ static void __declspec(naked) fIgnoreDefaultPerks() {
retn;
}
}
static void __declspec(naked) fRestoreDefaultPerks() {
__asm {
push ebx;
@@ -468,6 +479,7 @@ static void __declspec(naked) fRestoreDefaultPerks() {
retn;
}
}
static void __declspec(naked) fClearSelectablePerks() {
__asm {
push ebx;
@@ -480,6 +492,7 @@ static void __declspec(naked) fClearSelectablePerks() {
retn;
}
}
static void __declspec(naked) fHasFakePerk() {
__asm {
push ebx;
@@ -515,6 +528,7 @@ end:
retn;
}
}
static void __declspec(naked) fHasFakeTrait() {
__asm {
push ebx;
@@ -550,6 +564,7 @@ end:
retn;
}
}
static void __declspec(naked) fAddPerkMode() {
__asm {
push ebx;
@@ -571,6 +586,7 @@ end:
retn;
}
}
static void __declspec(naked) remove_trait() {
__asm {
pushad;
@@ -634,6 +650,7 @@ static void __declspec(naked) fApplyHeaveHoFix() {
retn;
}
}
static void __declspec(naked) SetSwiftLearnerMod() {
__asm {
push ebx;
+41 -40
View File
@@ -53,6 +53,7 @@ end:
retn;
}
}
static void __declspec(naked) set_array() {
__asm {
pushad;
@@ -112,6 +113,7 @@ end:
retn;
}
}
/*
used in place of [] operator when compiling in sslc
so it works as get_array if first argument is int and as substr(x, y, 1) if first argument is string
@@ -199,6 +201,7 @@ notstring:
retn;
}
}
static void __declspec(naked) free_array() {
__asm {
pushad;
@@ -216,6 +219,7 @@ end:
retn;
}
}
static void __declspec(naked) len_array() {
__asm {
pushad;
@@ -242,6 +246,7 @@ end:
retn;
}
}
static void __declspec(naked) resize_array() {
__asm {
pushad;
@@ -272,6 +277,7 @@ end:
retn;
}
}
static void __declspec(naked) temp_array() {
__asm {
pushad;
@@ -307,6 +313,7 @@ end:
retn;
}
}
static void __declspec(naked) fix_array() {
__asm {
pushad;
@@ -324,6 +331,7 @@ end:
retn;
}
}
static void __declspec(naked) scan_array() {
__asm {
pushad;
@@ -470,43 +478,36 @@ static void __declspec(naked) op_stack_array() {
// object LISTS
struct sList {
DWORD* obj;
TGameObj** obj;
DWORD len;
DWORD pos;
sList(const std::vector<DWORD>* vec) {
sList(const std::vector<TGameObj*>* vec) {
len = vec->size();
obj=new DWORD[len];
for(DWORD i=0;i<len;i++) obj[i]=(*vec)[i];
obj = new TGameObj*[len];
for (size_t i = 0; i < len; i++) {
obj[i] = (*vec)[i];
}
pos = 0;
}
};
static void FillListVector(DWORD type, std::vector<DWORD>& vec) {
static void FillListVector(DWORD type, std::vector<TGameObj*>& vec) {
// TODO: fix style, use wrappers
if (type == 6) {
DWORD scriptPtr, self_obj, programPtr;
TScript* scriptPtr;
TGameObj* self_obj;
TProgram* programPtr;
for (int elev = 0; elev <= 2; elev++) {
__asm {
mov eax, elev;
call FuncOffs::scr_find_first_at_;
mov scriptPtr, eax;
}
while (scriptPtr != 0) {
self_obj = *(DWORD*)(scriptPtr + 0x34);
if (self_obj == 0) {
programPtr = *(DWORD*)(scriptPtr + 0x18);
__asm {
mov eax, programPtr;
call FuncOffs::scr_find_obj_from_program_;
mov self_obj, eax;
}
scriptPtr = Wrapper::scr_find_first_at(elev);
while (scriptPtr != nullptr) {
self_obj = scriptPtr->self_obj;
if (self_obj == nullptr) {
programPtr = scriptPtr->program_ptr;
self_obj = Wrapper::scr_find_obj_from_program(programPtr);
}
vec.push_back(self_obj);
__asm {
call FuncOffs::scr_find_next_at_;
mov scriptPtr, eax;
}
scriptPtr = Wrapper::scr_find_next_at();
}
}
} else if (type == 4) {
@@ -522,34 +523,28 @@ static void FillListVector(DWORD type, std::vector<DWORD>& vec) {
} else {
for (int elv = 0; elv < 3; elv++) {
for (int tile = 0; tile < 40000; tile++) {
DWORD obj;
__asm {
mov edx, tile;
mov eax, elv;
call FuncOffs::obj_find_first_at_tile_;
mov obj, eax;
}
TGameObj* obj = Wrapper::obj_find_first_at_tile(elv, tile);
while (obj) {
DWORD otype = ((DWORD*)obj)[25];
otype = (otype&0xff000000) >> 24;
if(type==9 || (type==0&&otype==1) || (type==1&&otype==0) || (type>=2&&type<=5&&type==otype)) vec.push_back(obj);
__asm {
call FuncOffs::obj_find_next_at_tile_;
mov obj, eax;
DWORD otype = (obj->pid & 0xff000000) >> 24;
if (type == 9 || (type == 0 && otype == 1) || (type == 1 && otype == 0) || (type >= 2 && type <= 5 && type == otype)) {
vec.push_back(obj);
}
obj = Wrapper::obj_find_next_at_tile();
}
}
}
}
}
static void* _stdcall list_begin2(DWORD type) {
std::vector<DWORD> vec = std::vector<DWORD>();
std::vector<TGameObj*> vec = std::vector<TGameObj*>();
FillListVector(type, vec);
sList* list = new sList(&vec);
return list;
}
static DWORD _stdcall list_as_array2(DWORD type) {
std::vector<DWORD> vec = std::vector<DWORD>();
std::vector<TGameObj*> vec = std::vector<TGameObj*>();
FillListVector(type, vec);
DWORD id = TempArray(vec.size(), 4);
for (DWORD i = 0; i < vec.size(); i++) {
@@ -557,14 +552,17 @@ static DWORD _stdcall list_as_array2(DWORD type) {
}
return id;
}
static DWORD _stdcall list_next2(sList* list) {
static TGameObj* _stdcall list_next2(sList* list) {
if (list->pos == list->len) return 0;
else return list->obj[list->pos++];
}
static void _stdcall list_end2(sList* list) {
delete[] list->obj;
delete list;
}
static void __declspec(naked) list_begin() {
__asm {
pushad;
@@ -592,6 +590,7 @@ end:
retn;
}
}
static void __declspec(naked) list_as_array() {
__asm {
pushad;
@@ -619,6 +618,7 @@ end:
retn;
}
}
static void __declspec(naked) list_next() {
__asm {
pushad;
@@ -646,6 +646,7 @@ end:
retn;
}
}
static void __declspec(naked) list_end() {
__asm {
pushad;
+12
View File
@@ -67,6 +67,7 @@ end:
retn;
}
}
static void __declspec(naked) funcAbs() {
__asm {
pushad;
@@ -106,6 +107,7 @@ end:
retn;
}
}
static void __declspec(naked) funcSin() {
__asm {
pushad;
@@ -145,6 +147,7 @@ end:
retn;
}
}
static void __declspec(naked) funcCos() {
__asm {
pushad;
@@ -184,6 +187,7 @@ end:
retn;
}
}
static void __declspec(naked) funcTan() {
__asm {
pushad;
@@ -224,6 +228,7 @@ end:
retn;
}
}
static void __declspec(naked) funcATan() {
__asm {
pushad;
@@ -312,6 +317,7 @@ static int _stdcall StringSplit(const char* str, const char* split) {
}
return id;
}
static void __declspec(naked) string_split() {
__asm {
pushad;
@@ -363,13 +369,16 @@ end:
retn;
}
}
static int _stdcall str_to_int_internal(const char* str) {
return (int)strtol(str, (char**)NULL, 0); // auto-determine radix
}
static DWORD _stdcall str_to_flt_internal(const char* str) {
float f=(float)atof(str);
return *(DWORD*)&f;
}
static void __declspec(naked) str_to_int() {
__asm {
pushad;
@@ -403,6 +412,7 @@ end:
retn;
}
}
static void __declspec(naked) str_to_flt() {
__asm {
pushad;
@@ -436,6 +446,7 @@ end:
retn;
}
}
char* _stdcall mysubstr(char* str, int pos, int length) {
char* newstr;
int srclen;
@@ -458,6 +469,7 @@ char* _stdcall mysubstr(char* str, int pos, int length) {
static DWORD _stdcall mystrlen(char* str) {
return strlen(str);
}
static char* sprintfbuf = NULL;
static char* _stdcall mysprintf(char* format, DWORD value, DWORD valueType) {
valueType = valueType & 0xFFFF; // use lower 2 bytes
+33
View File
@@ -69,6 +69,7 @@ end:
retn;
}
}
static void __declspec(naked) SetPCExtraStat() {
__asm {
//Store registers
@@ -111,6 +112,7 @@ end:
retn;
}
}
static void __declspec(naked) GetPCBaseStat() {
__asm {
//Store registers
@@ -149,6 +151,7 @@ end:
retn;
}
}
static void __declspec(naked) GetPCExtraStat() {
__asm {
//Store registers
@@ -187,6 +190,7 @@ end:
retn;
}
}
static void __declspec(naked) SetCritterBaseStat() {
__asm {
//Store registers
@@ -246,6 +250,7 @@ end:
retn;
}
}
static void __declspec(naked) SetCritterExtraStat() {
__asm {
//Store registers
@@ -305,6 +310,7 @@ end:
retn;
}
}
static void __declspec(naked) GetCritterBaseStat() {
__asm {
//Store registers
@@ -362,6 +368,7 @@ end:
retn;
}
}
static void __declspec(naked) GetCritterExtraStat() {
__asm {
//Store registers
@@ -419,6 +426,7 @@ end:
retn;
}
}
static void __declspec(naked) set_critter_skill_points() {
__asm {
pushad;
@@ -468,6 +476,7 @@ end:
retn;
}
}
static void __declspec(naked) get_critter_skill_points() {
__asm {
pushad;
@@ -516,6 +525,7 @@ end:
retn;
}
}
static void __declspec(naked) set_available_skill_points() {
__asm {
pushad;
@@ -533,6 +543,7 @@ end:
retn;
}
}
static void __declspec(naked) get_available_skill_points() {
__asm {
pushad;
@@ -546,6 +557,7 @@ static void __declspec(naked) get_available_skill_points() {
retn;
}
}
static void __declspec(naked) mod_skill_points_per_level() {
__asm {
pushad;
@@ -568,6 +580,7 @@ end:
retn;
}
}
static void __declspec(naked) GetCritterAP() {
__asm {
//Store registers
@@ -674,6 +687,7 @@ end:
retn;
}
}
static void __declspec(naked) fSetHitChanceMax() {
__asm {
push ebx;
@@ -702,6 +716,7 @@ end:
retn;
}
}
static void __declspec(naked) SetCritterHitChance() {
__asm {
push ebx;
@@ -743,6 +758,7 @@ end:
retn;
}
}
static void __declspec(naked) SetBaseHitChance() {
__asm {
push ebx;
@@ -777,6 +793,7 @@ end:
retn;
}
}
static void __declspec(naked) SetCritterPickpocket() {
__asm {
push ebx;
@@ -818,6 +835,7 @@ end:
retn;
}
}
static void __declspec(naked) SetBasePickpocket() {
__asm {
push ebx;
@@ -852,6 +870,7 @@ end:
retn;
}
}
static void __declspec(naked) SetCritterSkillMod() {
__asm {
push ebx;
@@ -885,6 +904,7 @@ end:
retn;
}
}
static void __declspec(naked) SetBaseSkillMod() {
__asm {
push ebx;
@@ -912,6 +932,7 @@ end:
retn;
}
}
static void __declspec(naked) fSetSkillMax() {
__asm {
push ebx;
@@ -939,6 +960,7 @@ end:
retn;
}
}
static void __declspec(naked) SetStatMax() {
__asm {
push ebx;
@@ -976,6 +998,7 @@ end:
retn;
}
}
static void __declspec(naked) SetStatMin() {
__asm {
push ebx;
@@ -1013,6 +1036,7 @@ end:
retn;
}
}
static void __declspec(naked) fSetPCStatMax() {
__asm {
push ebx;
@@ -1047,6 +1071,7 @@ end:
retn;
}
}
static void __declspec(naked) fSetPCStatMin() {
__asm {
push ebx;
@@ -1081,6 +1106,7 @@ end:
retn;
}
}
static void __declspec(naked) fSetNPCStatMax() {
__asm {
push ebx;
@@ -1115,6 +1141,7 @@ end:
retn;
}
}
static void __declspec(naked) fSetNPCStatMin() {
__asm {
push ebx;
@@ -1149,6 +1176,7 @@ end:
retn;
}
}
static float xpmod;
static DWORD xptmp;
static void __declspec(naked) SetXpMod3() {
@@ -1167,11 +1195,13 @@ static void __declspec(naked) SetXpMod3() {
retn;
}
}
static void _stdcall SetXpMod2(DWORD percent) {
SafeWrite8(0x004AFAB8, 0xe9);
SafeWrite32(0x004AFAB9, (DWORD)&SetXpMod3 - 0x004AFABD);
xpmod=(float)percent/100.0f;
}
static void __declspec(naked) SetXpMod() {
__asm {
push ebx;
@@ -1196,6 +1226,7 @@ end:
retn;
}
}
static int PerkLevelMod;
static void __declspec(naked) SetPerkLevelMod3() {
__asm {
@@ -1210,11 +1241,13 @@ end:
retn;
}
}
static void _stdcall SetPerkLevelMod2(int mod) {
if (mod < -25 || mod>25) return;
PerkLevelMod = mod;
SafeWrite32(0x00496880, (DWORD)&SetPerkLevelMod3 - 0x00496884);
}
static void __declspec(naked) SetPerkLevelMod() {
__asm {
push ebx;
+8
View File
@@ -31,6 +31,7 @@ static void _stdcall ForceEncounter4() {
SafeWrite32(0x004C071D, 0xFFFC2413);
SafeWrite8(0x4C0706, 0x75);
}
static void __declspec(naked) ForceEncounter3() {
__asm {
push eax;
@@ -48,6 +49,7 @@ static void __declspec(naked) ForceEncounter3() {
retn;
}
}
static void _stdcall ForceEncounter2(DWORD mapID, DWORD flags) {
EncounteredHorrigan = *(DWORD*)0x00672E04;
SafeWrite32(0x004C070E, mapID);
@@ -56,6 +58,7 @@ static void _stdcall ForceEncounter2(DWORD mapID, DWORD flags) {
SafeWrite32(0x004C071D, ((DWORD)&ForceEncounter3) - 0x004C0721);
if (flags & 1) SafeWrite8(0x4C0706, 0xeb);
}
static void __declspec(naked) ForceEncounter() {
__asm {
push ebx;
@@ -78,6 +81,7 @@ end:
retn;
}
}
static void __declspec(naked) ForceEncounterWithFlags() {
__asm {
pushad
@@ -127,6 +131,7 @@ static void __declspec(naked) funcInWorldMap() {
retn;
}
}
static void __declspec(naked) GetGameMode() {
__asm {
pushad;
@@ -142,6 +147,7 @@ static void __declspec(naked) GetGameMode() {
retn;
}
}
static void __declspec(naked) GetWorldMapXPos() {
__asm {
push ebx;
@@ -159,6 +165,7 @@ static void __declspec(naked) GetWorldMapXPos() {
retn;
}
}
static void __declspec(naked) GetWorldMapYPos() {
__asm {
push ebx;
@@ -176,6 +183,7 @@ static void __declspec(naked) GetWorldMapYPos() {
retn;
}
}
static void __declspec(naked) SetWorldMapPos() {
__asm {
push ebx;
+33 -12
View File
@@ -158,6 +158,7 @@ end:
retn;
}
}
static void TimerReset() {
VarPtr::fallout_game_time = 0;
// used as additional years indicator
@@ -167,13 +168,17 @@ static void TimerReset() {
static double TickFrac = 0;
static double MapMulti = 1;
static double MapMulti2 = 1;
void _stdcall SetMapMulti(float d) { MapMulti2=d; }
void _stdcall SetMapMulti(float d) {
MapMulti2 = d;
}
static __declspec(naked) void PathfinderFix3() {
__asm {
xor eax, eax;
retn;
}
}
static DWORD _stdcall PathfinderFix2(DWORD perkLevel, DWORD ticks) {
double d = MapMulti*MapMulti2;
if (perkLevel == 1) d *= 0.75;
@@ -183,6 +188,7 @@ static DWORD _stdcall PathfinderFix2(DWORD perkLevel, DWORD ticks) {
TickFrac = modf(d, &d);
return (DWORD)d;
}
static __declspec(naked) void PathfinderFix() {
__asm {
push eax;
@@ -250,6 +256,7 @@ tck:
jmp FuncOffs::get_input_;
}
}
static void __declspec(naked) WorldMapEncPatch1() {
__asm {
inc dword ptr ds:[VARPTR_wmLastRndTime]
@@ -257,18 +264,21 @@ static void __declspec(naked) WorldMapEncPatch1() {
retn;
}
}
static void __declspec(naked) WorldMapEncPatch2() {
__asm {
mov dword ptr ds:[VARPTR_wmLastRndTime], 0;
retn;
}
}
static void __declspec(naked) WorldMapEncPatch3() {
__asm {
mov eax,ds:[VARPTR_wmLastRndTime];
retn;
}
}
static void __declspec(naked) Combat_p_procFix() {
__asm {
push eax;
@@ -316,6 +326,7 @@ end_cppf:
retn;
}
}
static double wm_nexttick;
static double wm_wait;
static bool wm_usingperf;
@@ -341,6 +352,7 @@ static void WorldMapSpeedPatch3() {
else wm_nexttick += wm_wait;
}
}
static void __declspec(naked) WorldMapSpeedPatch2() {
__asm {
pushad;
@@ -350,6 +362,7 @@ static void __declspec(naked) WorldMapSpeedPatch2() {
retn;
}
}
static void __declspec(naked) WorldMapSpeedPatch() {
__asm {
pushad;
@@ -365,6 +378,7 @@ ls:
retn;
}
}
//Only used if the world map speed patch is disabled, so that world map scripts are still run
static void WorldMapHook() {
__asm {
@@ -493,12 +507,7 @@ skip:
static char KarmaGainMsg[128];
static char KarmaLossMsg[128];
static void _stdcall SetKarma(int value) {
int old;
__asm {
xor eax, eax;
call FuncOffs::game_get_global_var_;
mov old, eax;
}
int old = VarPtr::game_global_vars[GVAR_PLAYER_REPUTATION];
old = value - old;
char buf[64];
if (old == 0) return;
@@ -509,6 +518,7 @@ static void _stdcall SetKarma(int value) {
}
Wrapper::display_print(buf);
}
static void __declspec(naked) SetGlobalVarWrapper() {
__asm {
test eax, eax;
@@ -521,6 +531,7 @@ end:
jmp FuncOffs::game_set_global_var_;
}
}
static void __declspec(naked) ReloadHook() {
__asm {
push eax;
@@ -543,6 +554,7 @@ static void __declspec(naked) ReloadHook() {
jmp FuncOffs::gsound_play_sfx_file_;
}
}
static const DWORD CorpseHitFix2_continue_loop1 = 0x48B99B;
static void __declspec(naked) CorpseHitFix2() {
__asm {
@@ -642,7 +654,7 @@ static DWORD* KarmaFrms;
static int* KarmaPoints;
static DWORD _stdcall DrawCardHook2() {
int reputation = VarPtr::game_global_vars[0];
int reputation = VarPtr::game_global_vars[GVAR_PLAYER_REPUTATION];
for (DWORD i = 0; i < KarmaFrmCount - 1; i++) {
if (reputation < KarmaPoints[i]) return KarmaFrms[i];
}
@@ -891,7 +903,9 @@ static void DllMain2() {
//}
GraphicsMode = GetPrivateProfileIntA("Graphics", "Mode", 0, ini);
if(GraphicsMode!=4&&GraphicsMode!=5) GraphicsMode=0;
if (GraphicsMode != 4 && GraphicsMode != 5) {
GraphicsMode = 0;
}
if (GraphicsMode == 4 || GraphicsMode == 5) {
dlog("Applying dx9 graphics patch.", DL_INIT);
#ifdef WIN2K
@@ -1110,7 +1124,9 @@ static void DllMain2() {
dlog("Applying extra kill types patch.", DL_INIT);
KillCounterInit(true);
dlogr(" Done", DL_INIT);
} else KillCounterInit(false);
} else {
KillCounterInit(false);
}
//if(GetPrivateProfileIntA("Misc", "ScriptExtender", 0, ini)) {
dlog("Applying script extender patch.", DL_INIT);
@@ -1166,7 +1182,9 @@ static void DllMain2() {
}
int limit = GetPrivateProfileIntA("Misc", "TimeLimit", 13, ini);
if(limit==-2) limit=14;
if (limit == -2) {
limit = 14;
}
if (limit == -3) {
dlog("Applying time limit patch (-3).", DL_INIT);
limit = -1;
@@ -1181,6 +1199,7 @@ static void DllMain2() {
SafeWrite32(0x004C3CB6, ((DWORD)&GetDateWrapper) - 0x004C3CBa);
dlogr(" Done", DL_INIT);
}
if (limit <= 14 && limit >= -1 && limit != 13) {
dlog("Applying time limit patch.", DL_INIT);
if (limit == -1) {
@@ -1749,7 +1768,9 @@ bool _stdcall DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) {
"Using default ddraw.ini instead", "Warning", MB_TASKMODAL);
strcpy_s(ini, ".\\ddraw.ini");
}
} else strcpy_s(ini, ".\\ddraw.ini");
} else {
strcpy_s(ini, ".\\ddraw.ini");
}
GetPrivateProfileStringA("Main", "TranslationsINI", "./Translations.ini", translationIni, 65, ini);