Added CreditsAtBottom option to display sfall built-in credits at the bottom of credits.txt contents.

Unified log message format in main.cpp and bugs.cpp.
This commit is contained in:
NovaRain
2016-07-18 16:54:13 +08:00
parent 354b938d60
commit 53895a4af2
4 changed files with 56 additions and 51 deletions
+4 -1
View File
@@ -395,7 +395,7 @@ UseScrollingQuestsList=1
ExtraSaveSlots=0
;Set to 1 to speed up the hp/ac counter animations
;Set to 2 to update the hp/ac counter instantly
;Set to 2 to update the hp/ac counters instantly
SpeedInterfaceCounterAnims=0
;These lines allow you to control the karma frm's displayed on the character screen
@@ -567,6 +567,9 @@ InstantWeaponEquip=0
;You need to use the message_str_game script function to get messages from the files
;ExtraGameMsgFileList=
;Set to 1 to display sfall built-in credits at the bottom of credits.txt contents
CreditsAtBottom=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Debugging]
;Extra sfall configuration settings that can be used by modders
+12 -12
View File
@@ -790,14 +790,14 @@ void BugsInit()
dlog("Applying fix for Pip-Boy rest exploit.", DL_INIT);
MakeCall(0x4971C7, &pipboy_hack, false);
MakeCall(0x499530, &PipAlarm_hack, false);
dlogr(" Done.", DL_INIT);
dlogr(" Done", DL_INIT);
// Fix for "Too Many Items" bug
//if (GetPrivateProfileIntA("Misc", "TooManyItemsBugFix", 1, ini)) {
dlog("Applying preventive patch for \"Too Many Items\" bug.", DL_INIT);
HookCall(0x4A596A, &scr_write_ScriptNode_hook);
HookCall(0x4A59C1, &scr_write_ScriptNode_hook);
dlogr(" Done.", DL_INIT);
dlogr(" Done", DL_INIT);
//}
// Fix for cells getting consumed even when the car is already fully charged
@@ -807,18 +807,18 @@ void BugsInit()
if (GetPrivateProfileIntA("Misc", "CarChargingFix", 1, ini)) {
dlog("Applying car charging fix.", DL_INIT);
MakeCall(0x49C36D, &protinst_default_use_item_hack, true);
dlogr(" Done.", DL_INIT);
dlogr(" Done", DL_INIT);
}
// Fix for gaining stats from more than two doses of a specific chem after save-load
dlog("Applying fix for save-load unlimited drug use exploit.", DL_INIT);
MakeCall(0x47A243, &item_d_load_hack, false);
dlogr(" Done.", DL_INIT);
dlogr(" Done", DL_INIT);
// Fix crash when leaving the map while waiting for someone to die of a super stimpak overdose
dlog("Applying fix for \"leaving the map while waiting for a super stimpak overdose death\" crash.", DL_INIT);
HookCall(0x4A27E7, &queue_clear_type_mem_free_hook); // hooks mem_free_()
dlogr(" Done.", DL_INIT);
dlogr(" Done", DL_INIT);
// Evil bug! If party member has the same armor type in inventory as currently equipped, then
// on level up he loses Armor Class equal to the one received from this armor.
@@ -827,30 +827,30 @@ void BugsInit()
dlog("Applying fix for armor reducing NPC original stats when removed.", DL_INIT);
HookCall(0x495F3B, &partyMemberCopyLevelInfo_stat_level_hook);
HookCall(0x45419B, &correctFidForRemovedItem_adjust_ac_hook);
dlogr(" Done.", DL_INIT);
dlogr(" Done", DL_INIT);
//}
// Fix of invalid stats when party member gains a level while being on drugs
dlog("Applying fix for addicted party member level up bug.", DL_INIT);
HookCall(0x495D5C, &partyMemberCopyLevelInfo_hook);
dlogr(" Done.", DL_INIT);
dlogr(" Done", DL_INIT);
// Allow 9 options (lines of text) to be displayed correctly in a dialog window
if (GetPrivateProfileIntA("Misc", "DialogOptions9Lines", 1, ini)) {
dlog("Applying 9 dialog options patch.", DL_INIT);
MakeCall(0x44701C, &gdProcessUpdate_hack, true);
dlogr(" Done.", DL_INIT);
dlogr(" Done", DL_INIT);
}
// Fix for "Unlimited Ammo" bug
dlog("Applying fix for Unlimited Ammo bug.", DL_INIT);
HookCall(0x472957, &invenWieldFunc_item_get_type_hook); // hooks item_get_type_()
dlogr(" Done.", DL_INIT);
dlogr(" Done", DL_INIT);
// Fix for negative values in Skilldex window ("S")
dlog("Applying fix for negative values in Skilldex window.", DL_INIT);
SafeWrite8(0x4AC377, 0x7F); // jg
dlogr(" Done.", DL_INIT);
dlogr(" Done", DL_INIT);
// Fix for not counting in the weight of equipped items on NPC when stealing or bartering
//if (GetPrivateProfileIntA("Misc", "NPCWeightFix", 1, ini)) {
@@ -860,7 +860,7 @@ void BugsInit()
HookCall(0x474CB8, &barter_attempt_transaction_hook);
HookCall(0x4742AD, &move_inventory_hook);
HookCall(0x4771B5, &item_add_mult_hook);
dlogr(" Done.", DL_INIT);
dlogr(" Done", DL_INIT);
//}
// Corrects "Weight of items" text element width to be 64 (and not 80), which matches container element width
@@ -904,7 +904,7 @@ void BugsInit()
// proper checks for NPC's addiction instead of always using global vars
MakeCall(0x47A644, &item_d_check_addict_hack, true);
MakeCall(0x479FC5, &item_d_take_drug_hack, true);
dlogr(" Done.", DL_INIT);
dlogr(" Done", DL_INIT);
//}
//if (GetPrivateProfileInt("Misc", "ShivPatch", 1, ini)) {
+30 -27
View File
@@ -22,10 +22,10 @@
#include "FalloutEngine.h"
#include "version.h"
static DWORD InCredits=0;
static DWORD CreditsLine=0;
static DWORD InCredits = 0;
static DWORD CreditsLine = 0;
static const char* ExtraLines[]={
static const char* ExtraLines[] = {
"#SFALL " VERSION_STRING,
"",
"sfall is free software, licensed under the GPL",
@@ -71,35 +71,35 @@ static const char* ExtraLines[]={
"#FALLOUT 2",
""
};
static DWORD ExtraLineCount=sizeof(ExtraLines)/4;
static DWORD ExtraLineCount = sizeof(ExtraLines)/4;
static const char* creditsFile="credits.txt";
static const char* creditsFile = "credits.txt";
static void _stdcall ShowCreditsHook() {
InCredits=1;
CreditsLine=0;
InCredits = 1;
CreditsLine = 0;
__asm {
mov eax, creditsFile;
mov eax, creditsFile;
call credits_;
}
InCredits=0;
InCredits = 0;
}
static DWORD _stdcall CreditsNextLine(char* buf, DWORD* font, DWORD* colour) {
if(!InCredits||CreditsLine>=ExtraLineCount) return 0;
const char* line=ExtraLines[CreditsLine++];
if(strlen(line)) {
if(line[0]=='#') {
if (!InCredits || CreditsLine >= ExtraLineCount) return 0;
const char* line = ExtraLines[CreditsLine++];
if (strlen(line)) {
if (line[0] == '#') {
line++;
*font=*(DWORD*)_name_font;
*colour=*(BYTE*)0x6A7F01;
} else if(line[0]=='@') {
*font = *(DWORD*)_name_font;
*colour = *(BYTE*)0x6A7F01;
} else if (line[0] == '@') {
line++;
*font=*(DWORD*)_title_font;
*colour=*(DWORD*)_title_color;
*font = *(DWORD*)_title_font;
*colour = *(DWORD*)_title_color;
} else {
*font=*(DWORD*)_name_font;
*colour=*(DWORD*)_name_color;
*font = *(DWORD*)_name_font;
*colour = *(DWORD*)_name_color;
}
}
strcpy_s(buf, 256, line);
@@ -116,7 +116,7 @@ static void __declspec(naked) CreditsNextLineHook_Top() {
call CreditsNextLine;
test eax, eax;
popad;
jz fail;
jz fail;
xor eax, eax;
inc eax;
retn;
@@ -130,9 +130,9 @@ static void __declspec(naked) CreditsNextLineHook_Bottom() {
__asm {
pushad;
call credits_get_next_line_; // call default function
test eax, eax;
test eax, eax;
popad;
jnz morelines; // if not the end yet, skip custom code
jnz morelines; // if not the end yet, skip custom code
pushad;
push ebx;
push edx;
@@ -140,12 +140,12 @@ static void __declspec(naked) CreditsNextLineHook_Bottom() {
call CreditsNextLine; // otherwise call out function
test eax, eax; // if any extra lines left, return 1 (from function), 0 otherwise
popad;
jnz morelines;
jnz morelines;
theend:
mov eax, 0x0;
mov eax, 0x0;
retn;
morelines:
mov eax, 0x1;
mov eax, 0x1;
retn;
}
}
@@ -153,5 +153,8 @@ morelines:
void CreditsInit() {
HookCall(0x480C49, &ShowCreditsHook);
HookCall(0x43F881, &ShowCreditsHook);
HookCall(0x42CB49, &CreditsNextLineHook_Top);
if (GetPrivateProfileIntA("Misc", "CreditsAtBottom", 0, ini))
HookCall(0x42CB49, &CreditsNextLineHook_Bottom);
else
HookCall(0x42CB49, &CreditsNextLineHook_Top);
}
+10 -11
View File
@@ -1205,7 +1205,7 @@ static void DllMain2() {
int number_patch_loop=GetPrivateProfileInt("Misc", "NumberPatchLoop", -1, ini);
if(number_patch_loop>-1) {
dlog("Applying load multiple patches patch. ", DL_INIT);
dlog("Applying load multiple patches patch.", DL_INIT);
// Disable check
SafeWrite8(0x0444363, 0xE9);
SafeWrite32(0x0444364, 0xFFFFFFB9);
@@ -1217,7 +1217,7 @@ static void DllMain2() {
}
if(GetPrivateProfileInt("Misc", "DisplayKarmaChanges", 0, ini)) {
dlog("Applying display karma changes patch. ", DL_INIT);
dlog("Applying display karma changes patch.", DL_INIT);
GetPrivateProfileString("sfall", "KarmaGain", "You gained %d karma.", KarmaGainMsg, 128, translationIni);
GetPrivateProfileString("sfall", "KarmaLoss", "You lost %d karma.", KarmaLossMsg, 128, translationIni);
HookCall(0x455A6D, SetGlobalVarWrapper);
@@ -1225,7 +1225,7 @@ static void DllMain2() {
}
//if(GetPrivateProfileInt("Misc", "ImportedProcedureFix", 0, ini)) {
dlog("Applying imported procedure patch. ", DL_INIT);
dlog("Applying imported procedure patch.", DL_INIT);
SafeWrite16(0x46B35B, 0x1c60);
SafeWrite32(0x46B35D, 0x90909090);
SafeWrite8(0x46DBF1, 0xeb);
@@ -1235,34 +1235,33 @@ static void DllMain2() {
//}
if(GetPrivateProfileInt("Misc", "AlwaysReloadMsgs", 0, ini)) {
dlog("Applying always reload messages patch. ", DL_INIT);
dlog("Applying always reload messages patch.", DL_INIT);
SafeWrite8(0x4A6B8A, 0xff);
SafeWrite32(0x4A6B8B, 0x02eb0074);
dlogr(" Done", DL_INIT);
}
if(GetPrivateProfileInt("Misc", "PlayIdleAnimOnReload", 0, ini)) {
dlog("Applying idle anim on reload patch. ", DL_INIT);
dlog("Applying idle anim on reload patch.", DL_INIT);
HookCall(0x460B8C, ReloadHook);
dlogr(" Done", DL_INIT);
}
if (GetPrivateProfileInt("Misc", "CorpseLineOfFireFix", 0, ini)) {
dlog("Applying corpse line of fire patch. ", DL_INIT);
dlog("Applying corpse line of fire patch.", DL_INIT);
MakeCall(0x48B994, CorpseHitFix2, true);
MakeCall(0x48BA04, CorpseHitFix2b, true);
dlogr(" Done", DL_INIT);
}
if(GetPrivateProfileIntA("Misc", "EnableHeroAppearanceMod", 0, ini)) {
dlog("Setting up Appearance Char Screen buttons. ", DL_INIT);
dlog("Setting up Appearance Char Screen buttons.", DL_INIT);
EnableHeroAppearanceMod();
dlogr(" Done", DL_INIT);
}
if(GetPrivateProfileIntA("Misc", "SkipOpeningMovies", 0, ini)) {
dlog("Blocking opening movies. ", DL_INIT);
dlog("Blocking opening movies.", DL_INIT);
BlockCall(0x4809CB);
BlockCall(0x4809D4);
BlockCall(0x4809E0);
@@ -1271,12 +1270,12 @@ static void DllMain2() {
RetryCombatMinAP=GetPrivateProfileIntA("Misc", "NPCsTryToSpendExtraAP", 0, ini);
if(RetryCombatMinAP) {
dlog("Applying retry combat patch. ", DL_INIT);
dlog("Applying retry combat patch.", DL_INIT);
HookCall(0x422B94, &RetryCombatHook);
dlogr(" Done", DL_INIT);
}
dlog("Checking for changed skilldex images. ", DL_INIT);
dlog("Checking for changed skilldex images.", DL_INIT);
tmp=GetPrivateProfileIntA("Misc", "Lockpick", 293, ini);
if(tmp!=293) SafeWrite32(0x00518D54, tmp);
tmp=GetPrivateProfileIntA("Misc", "Steal", 293, ini);