mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added Module classes for every sfall module; #9
Moved all patches out from main.cpp; Fixed all build errors.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
#include "Logging.h"
|
||||
|
||||
#include "ModuleManager.h"
|
||||
|
||||
ModuleManager ModuleManager::_instance;
|
||||
@@ -13,6 +15,7 @@ ModuleManager::~ModuleManager() {
|
||||
|
||||
void ModuleManager::initAll() {
|
||||
for (auto it = _modules.cbegin(); it != _modules.cend(); it++) {
|
||||
dlog_f("Initializing module %s...\r\n", DL_INIT, (*it)->name());
|
||||
(*it)->init();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ void _stdcall AIBlockCombat(DWORD i) {
|
||||
else CombatDisabled=0;
|
||||
}
|
||||
|
||||
void AIInit() {
|
||||
void AI::init() {
|
||||
//HookCall(0x42AE1D, ai_attack_hook);
|
||||
//HookCall(0x42AE5C, ai_attack_hook);
|
||||
HookCall(0x426A95, combat_attack_hook);
|
||||
|
||||
+8
-1
@@ -16,7 +16,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
void AIInit();
|
||||
#include "Module.h"
|
||||
|
||||
class AI : public Module {
|
||||
const char* name() { return "AI"; }
|
||||
void init();
|
||||
};
|
||||
|
||||
// TODO: use subscription instead
|
||||
void _stdcall AICombatStart();
|
||||
void _stdcall AICombatEnd();
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "..\FalloutEngine\Fallout2.h"
|
||||
#include "..\Logging.h"
|
||||
|
||||
#include "AmmoMod.h"
|
||||
|
||||
static const DWORD DamageFunctionReturn = 0x424A63;
|
||||
|
||||
// Damage Fix v5 by Glovz 2014.04.16.xx.xx
|
||||
@@ -737,7 +739,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
void AmmoModInit() {
|
||||
void AmmoMod::init() {
|
||||
int formula;
|
||||
if (formula = GetPrivateProfileIntA("Misc", "DamageFormula", 0, ini)) {
|
||||
switch (formula) {
|
||||
|
||||
@@ -18,4 +18,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
void AmmoModInit();
|
||||
#include "Module.h"
|
||||
|
||||
class AmmoMod : public Module {
|
||||
const char* name() { return "AmmoMod"; }
|
||||
void init();
|
||||
};
|
||||
|
||||
@@ -291,16 +291,9 @@ void ApplyAnimationsAtOncePatches(signed char aniMax) {
|
||||
for (i = 0; i < sizeof(sad_28) / 4; i++) {
|
||||
SafeWrite32(sad_28[i], 40 + (DWORD)sad);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AnimationsAtOnceExit() {
|
||||
if (!AniLimitFixActive) return;
|
||||
delete[] anim_set;
|
||||
delete[] sad;
|
||||
}
|
||||
|
||||
void AnimationsAtOnceInit() {
|
||||
void AnimationsAtOnce::init() {
|
||||
DWORD setting = GetPrivateProfileIntA("Misc", "AnimationsAtOnceLimit", 32, ini);
|
||||
if ((signed char)setting > 32) {
|
||||
dlog("Applying AnimationsAtOnceLimit patch.", DL_INIT);
|
||||
@@ -308,3 +301,9 @@ void AnimationsAtOnceInit() {
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
|
||||
void AnimationsAtOnce::exit() {
|
||||
if (!AniLimitFixActive) return;
|
||||
delete[] anim_set;
|
||||
delete[] sad;
|
||||
}
|
||||
|
||||
@@ -18,5 +18,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
void AnimationsAtOnceInit();
|
||||
void AnimationsAtOnceExit();
|
||||
#include "Module.h"
|
||||
|
||||
class AnimationsAtOnce : public Module {
|
||||
const char* name() { return "AnimationsAtOnceLimit"; }
|
||||
void init();
|
||||
void exit() override;
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ fail:
|
||||
}
|
||||
}
|
||||
|
||||
void BarBoxesInit() {
|
||||
void BarBoxes::init() {
|
||||
SafeWrite32(0x461266, (DWORD)boxes + 8);
|
||||
SafeWrite32(0x4612AC, (DWORD)boxes + 8);
|
||||
SafeWrite32(0x4612FE, (DWORD)boxes + 4);
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
void BarBoxesInit();
|
||||
|
||||
#include "Module.h"
|
||||
|
||||
class BarBoxes : public Module {
|
||||
const char* name() { return "BarBoxes"; }
|
||||
void init();
|
||||
};
|
||||
|
||||
int _stdcall GetBox(int i);
|
||||
void _stdcall AddBox(int i);
|
||||
void _stdcall RemoveBox(int i);
|
||||
void _stdcall RemoveBox(int i);
|
||||
|
||||
@@ -84,7 +84,7 @@ void LoadVanillaBooks() {
|
||||
BooksCount += 5;
|
||||
}
|
||||
|
||||
void BooksInit() {
|
||||
void Books::init() {
|
||||
char buf[MAX_PATH - 3];
|
||||
GetPrivateProfileString("Misc", "BooksFile", "", buf, MAX_PATH, ini);
|
||||
if (strlen(buf) > 0) {
|
||||
|
||||
@@ -18,4 +18,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
void BooksInit();
|
||||
#include "Module.h"
|
||||
|
||||
class Books : public Module {
|
||||
const char* name() { return "Books"; }
|
||||
void init();
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "..\main.h"
|
||||
|
||||
#include "Bugs.h"
|
||||
#include "BugFixes.h"
|
||||
#include "..\FalloutEngine\Fallout2.h"
|
||||
#include "ScriptExtender.h"
|
||||
|
||||
@@ -928,7 +928,7 @@ end:
|
||||
}
|
||||
|
||||
|
||||
void BugsInit()
|
||||
void BugFixes::init()
|
||||
{
|
||||
//if (GetPrivateProfileIntA("Misc", "SharpshooterFix", 1, ini)) {
|
||||
dlog("Applying sharpshooter patch.", DL_INIT);
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "Module.h"
|
||||
|
||||
class BugFixes : public Module {
|
||||
const char* name() { return "BugFixes"; }
|
||||
void init();
|
||||
};
|
||||
@@ -1,5 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
extern DWORD WeightOnBody;
|
||||
|
||||
void BugsInit();
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "..\Logging.h"
|
||||
|
||||
#include "BurstMods.h"
|
||||
|
||||
static DWORD compute_spray_center_mult;
|
||||
static DWORD compute_spray_center_div;
|
||||
static DWORD compute_spray_target_mult;
|
||||
@@ -68,7 +70,7 @@ divEnd2:
|
||||
}
|
||||
|
||||
|
||||
void ComputeSprayModInit() {
|
||||
void BurstMods::init() {
|
||||
if (GetPrivateProfileIntA("Misc", "ComputeSprayMod", 0, ini)) {
|
||||
dlog("Applying ComputeSpray changes.", DL_INIT);
|
||||
compute_spray_center_mult = GetPrivateProfileIntA("Misc", "ComputeSpray_CenterMult", 1, ini);
|
||||
|
||||
@@ -18,4 +18,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
void ComputeSprayModInit();
|
||||
#include "Module.h"
|
||||
|
||||
class BurstMods : public Module {
|
||||
const char* name() { return "BurstMods"; }
|
||||
void init();
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ static void __declspec(naked) ConsoleHook() {
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleInit() {
|
||||
void Console::init() {
|
||||
char path[MAX_PATH];
|
||||
GetPrivateProfileString("Misc", "ConsoleOutputPath", "", path, MAX_PATH, ini);
|
||||
if (strlen(path) > 0) {
|
||||
@@ -56,7 +56,7 @@ void ConsoleInit() {
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleExit() {
|
||||
void Console::exit() {
|
||||
if (consolefile.is_open()) {
|
||||
consolefile.close();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
void ConsoleExit();
|
||||
void ConsoleInit();
|
||||
//void DisplayAlertPopup(const char* msg, const char* line2);
|
||||
#include "Module.h"
|
||||
|
||||
class Console : public Module {
|
||||
const char* name() { return "Console"; }
|
||||
void init();
|
||||
void exit() override;
|
||||
};
|
||||
|
||||
//void DisplayAlertPopup(const char* msg, const char* line2);
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "..\FalloutEngine\Fallout2.h"
|
||||
#include "..\Version.h"
|
||||
|
||||
#include "Credits.h"
|
||||
|
||||
static DWORD InCredits = 0;
|
||||
static DWORD CreditsLine = 0;
|
||||
|
||||
@@ -149,7 +151,7 @@ morelines:
|
||||
}
|
||||
}
|
||||
|
||||
void CreditsInit() {
|
||||
void Credits::init() {
|
||||
HookCall(0x480C49, &ShowCreditsHook);
|
||||
HookCall(0x43F881, &ShowCreditsHook);
|
||||
if (GetPrivateProfileIntA("Misc", "CreditsAtBottom", 0, ini)) {
|
||||
|
||||
@@ -18,4 +18,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
void CreditsInit();
|
||||
#include "Module.h"
|
||||
|
||||
class Credits : public Module {
|
||||
const char* name() { return "Credits"; }
|
||||
void init();
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user