Removed CreditsAtBottom from ddraw.ini

* sfall built-in credits will be shown at the beginning when from the
main menu and at the end during the ending.
This commit is contained in:
NovaRain
2023-02-26 23:29:17 +08:00
parent a6a2285ffe
commit 64dc30d922
3 changed files with 32 additions and 20 deletions
-3
View File
@@ -696,9 +696,6 @@ SkipLoadingGameSettings=0
;The formula for the duration in ticks is: 10 * (value - 3 * EN) ;The formula for the duration in ticks is: 10 * (value - 3 * EN)
KnockoutTime=35 KnockoutTime=35
;Set to 1 to display sfall built-in credits at the bottom of credits.txt contents instead of at the top
CreditsAtBottom=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; Critical modding options - the following options should be changed with caution ; Critical modding options - the following options should be changed with caution
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+2 -2
View File
@@ -983,7 +983,7 @@ sfall_funcX metarule functions
`int sfall_func2("get_stat_min", int stat, bool who)`\ `int sfall_func2("get_stat_min", int stat, bool who)`\
`int sfall_func2("get_stat_max", int stat, bool who)` `int sfall_func2("get_stat_max", int stat, bool who)`
- Returns the maximum or minimum set value of the specified stat (see `set_stat_min` and `set_stat_max` functions) - Returns the maximum or minimum set value of the specified stat (see `set_stat_min` and `set_stat_max` functions)
- `who`: 0 (false) or omitting the argument - returns the value of the player, 1 (true) - returns the value set for other critters - `who`: 0 (False) or omitting the argument - returns the value of the player, 1 (True) - returns the value set for other critters
---- ----
#### interface_art_draw #### interface_art_draw
@@ -1061,7 +1061,7 @@ sfall_funcX metarule functions
---- ----
#### obj_is_openable #### obj_is_openable
`bool sfall_func1("obj_is_openable", object obj)` `bool sfall_func1("obj_is_openable", object obj)`
- Returns True if the object is openable (i.e. has an opening/closing animation) - Returns True if the object is openable (i.e. has an opening/closing animation), False otherwise
**** ****
+30 -15
View File
@@ -27,7 +27,7 @@
namespace sfall namespace sfall
{ {
static DWORD InCredits = 0; static bool InCredits = false;
static DWORD CreditsLine = 0; static DWORD CreditsLine = 0;
static const char* ExtraLines[] = { static const char* ExtraLines[] = {
@@ -84,15 +84,6 @@ static const char* ExtraLines[] = {
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 __declspec(naked) ShowCreditsHook() {
InCredits = 1;
CreditsLine = 0;
//__asm mov eax, creditsFile;
__asm call fo::funcoffs::credits_;
InCredits = 0;
__asm retn;
}
static DWORD __fastcall CreditsNextLine(char* buf, DWORD* font, DWORD* colour) { static DWORD __fastcall CreditsNextLine(char* buf, DWORD* font, DWORD* colour) {
if (!InCredits || CreditsLine >= ExtraLineCount) return 0; if (!InCredits || CreditsLine >= ExtraLineCount) return 0;
const char* line = ExtraLines[CreditsLine++]; const char* line = ExtraLines[CreditsLine++];
@@ -159,13 +150,37 @@ morelines:
} }
} }
void Credits::init() { static void __stdcall SetCreditsPosition(DWORD addr) {
HookCalls(ShowCreditsHook, {0x480C49, 0x43F881}); void* func;
if (IniReader::GetConfigInt("Misc", "CreditsAtBottom", 0)) { if (addr == (0x43F881 + 5)) { // called from endgame_movie_
HookCall(0x42CB49, CreditsNextLineHook_Bottom); func = CreditsNextLineHook_Bottom;
} else { } else {
HookCall(0x42CB49, CreditsNextLineHook_Top); func = CreditsNextLineHook_Top;
}
HookCall(0x42CB49, func);
}
static void __declspec(naked) ShowCreditsHook() {
__asm {
push eax;
push edx;
push ebx;
push [esp + 12]; // return address
call SetCreditsPosition;
pop ebx;
pop edx;
pop eax;
mov InCredits, 1;
mov CreditsLine, 0;
//mov eax, creditsFile;
call fo::funcoffs::credits_;
mov InCredits, 0;
retn;
} }
} }
void Credits::init() {
HookCalls(ShowCreditsHook, {0x480C49, 0x43F881});
}
} }