Expanded the functionality of Fallout1Behavior

* calling endgame_movie now plays Movie11 or Movie12 depending on
the player's gender before the credits.

Added new flags to force_encounter_with_flags function.
This commit is contained in:
NovaRain
2020-01-21 10:14:03 +08:00
parent dc4c4c2524
commit f57564c9ed
5 changed files with 56 additions and 25 deletions
+1
View File
@@ -210,6 +210,7 @@ DebugEditorKey=0
;Changes some of Fallout 2 engine functions to Fallout 1 behavior: ;Changes some of Fallout 2 engine functions to Fallout 1 behavior:
;- disables playing the final movie/credits after the endgame slideshow ;- disables playing the final movie/credits after the endgame slideshow
;- disables halving the weight for power armor items ;- disables halving the weight for power armor items
;- endgame_movie script function plays Movie11 or Movie12 depending on the player's gender before the credits
Fallout1Behavior=0 Fallout1Behavior=0
;Time limit in years. Must be between -3 and 13 ;Time limit in years. Must be between -3 and 13
+5 -3
View File
@@ -78,9 +78,11 @@
#define LIST_ALL (9) #define LIST_ALL (9)
//Valid flags for force_encounter_with_flags //Valid flags for force_encounter_with_flags
#define ENCOUNTER_FLAG_NO_CAR (1) #define ENCOUNTER_FLAG_NO_CAR (0x1)
#define ENCOUNTER_FLAG_LOCK (2) // block new forced encounter by the next function call until the current specified encounter occurs #define ENCOUNTER_FLAG_LOCK (0x2) // block new forced encounter by the next function call until the current specified encounter occurs
#define ENCOUNTER_FLAG_SPECIAL (4) // special blinking icon #define ENCOUNTER_FLAG_NO_ICON (0x4) // disable displaying the flashing icon
#define ENCOUNTER_FLAG_ICON_SP (0x8) // use special encounter icon
#define ENCOUNTER_FLAG_FADEOUT (0x10) // use fade out effect on the encounter (Note: you should restore the fade out screen when entering the encounter)
//The attack types returned by get_attack_type //The attack types returned by get_attack_type
#define ATKTYPE_LWEP1 (0) #define ATKTYPE_LWEP1 (0)
+18
View File
@@ -247,6 +247,23 @@ end:
} }
} }
static void __declspec(naked) endgame_movie_hook() {
__asm {
cmp [esp + 16], 0x45C563; // call from op_endgame_movie_
je playWalkMovie;
retn;
playWalkMovie:
call fo::funcoffs::stat_level_;
xor edx, edx;
add eax, 10;
mov ecx, eax;
mov eax, 1500;
call fo::funcoffs::pause_for_tocks_;
mov eax, ecx;
jmp fo::funcoffs::gmovie_play_;
}
}
void AdditionalWeaponAnimsPatch() { void AdditionalWeaponAnimsPatch() {
if (GetConfigInt("Misc", "AdditionalWeaponAnims", 0)) { if (GetConfigInt("Misc", "AdditionalWeaponAnims", 0)) {
dlog("Applying additional weapon animations patch.", DL_INIT); dlog("Applying additional weapon animations patch.", DL_INIT);
@@ -573,6 +590,7 @@ void F1EngineBehaviorPatch() {
dlog("Applying Fallout 1 engine behavior patch.", DL_INIT); dlog("Applying Fallout 1 engine behavior patch.", DL_INIT);
BlockCall(0x4A4343); // disable playing the final movie/credits after the endgame slideshow BlockCall(0x4A4343); // disable playing the final movie/credits after the endgame slideshow
SafeWrite8(0x477C71, 0xEB); // disable halving the weight for power armor items SafeWrite8(0x477C71, 0xEB); // disable halving the weight for power armor items
HookCall(0x43F872, endgame_movie_hook); // play Movie11 or Movie12 depending on the player's gender before the credits
dlogr(" Done", DL_INIT); dlogr(" Done", DL_INIT);
} }
} }
+15 -5
View File
@@ -35,6 +35,7 @@ static DWORD ForceEncounterMapID = -1;
static DWORD ForceEncounterFlags; static DWORD ForceEncounterFlags;
DWORD ForceEncounterRestore() { DWORD ForceEncounterRestore() {
if (ForceEncounterMapID == -1) return 0;
long long data = 0x672E043D83; // cmp ds:_Meet_Frank_Horrigan, 0 long long data = 0x672E043D83; // cmp ds:_Meet_Frank_Horrigan, 0
SafeWriteBytes(0x4C06D1, (BYTE*)&data, 5); SafeWriteBytes(0x4C06D1, (BYTE*)&data, 5);
ForceEncounterFlags = 0; ForceEncounterFlags = 0;
@@ -43,12 +44,21 @@ DWORD ForceEncounterRestore() {
return mapID; return mapID;
} }
// implements a blinking encounter icon static void ForceEncounterEffects() {
static void ForceEncounterIcon() { if (ForceEncounterFlags & 0x10) { // _FadeOut flag
long iconType = (ForceEncounterFlags & 4) ? 3 : 1; // icon type flag (special: 0-3, normal: 0-1) __asm mov eax, FO_VAR_black_palette;
__asm call fo::funcoffs::palette_fade_to_;
return;
};
// implements a flashing encounter icon
if (ForceEncounterFlags & 4) return; // _NoIcon flag
long iconType = (ForceEncounterFlags & 8) ? 3 : 1; // icon type flag (special: 0-3, normal: 0-1)
*(DWORD*)FO_VAR_wmEncounterIconShow = 1; *(DWORD*)FO_VAR_wmEncounterIconShow = 1;
*(DWORD*)FO_VAR_wmRndCursorFid = 0; *(DWORD*)FO_VAR_wmRndCursorFid = 0;
for (size_t n = 0; n < 7; ++n) {
for (size_t n = 8; n > 0; --n) {
long iconFidIndex = iconType - *(DWORD*)FO_VAR_wmRndCursorFid; long iconFidIndex = iconType - *(DWORD*)FO_VAR_wmRndCursorFid;
*(DWORD*)FO_VAR_wmRndCursorFid = iconFidIndex; *(DWORD*)FO_VAR_wmRndCursorFid = iconFidIndex;
__asm call fo::funcoffs::wmInterfaceRefresh_; __asm call fo::funcoffs::wmInterfaceRefresh_;
@@ -67,7 +77,7 @@ static void __declspec(naked) wmRndEncounterOccurred_hack() {
mov eax, ForceEncounterMapID; mov eax, ForceEncounterMapID;
call fo::funcoffs::wmMatchAreaContainingMapIdx_; call fo::funcoffs::wmMatchAreaContainingMapIdx_;
noCar: noCar:
call ForceEncounterIcon; call ForceEncounterEffects;
call ForceEncounterRestore; call ForceEncounterRestore;
push 0x4C0721; // return addr push 0x4C0721; // return addr
jmp fo::funcoffs::map_load_idx_; // eax - mapID jmp fo::funcoffs::map_load_idx_; // eax - mapID
+17 -17
View File
@@ -1,20 +1,20 @@
/* /*
* sfall * sfall
* Copyright (C) 2008-2017 The sfall team * Copyright (C) 2008-2017 The sfall team
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
@@ -48,6 +48,6 @@ public:
static const char* GetCurrentTerrainName(); static const char* GetCurrentTerrainName();
}; };
void _stdcall SetMapMulti(float d); void _stdcall SetMapMulti(float value);
} }