diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini
index fb09caa1..efad20c8 100644
--- a/artifacts/ddraw.ini
+++ b/artifacts/ddraw.ini
@@ -210,6 +210,7 @@ DebugEditorKey=0
;Changes some of Fallout 2 engine functions to Fallout 1 behavior:
;- disables playing the final movie/credits after the endgame slideshow
;- 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
;Time limit in years. Must be between -3 and 13
diff --git a/artifacts/scripting/headers/sfall.h b/artifacts/scripting/headers/sfall.h
index 584e27ed..2ecedd38 100644
--- a/artifacts/scripting/headers/sfall.h
+++ b/artifacts/scripting/headers/sfall.h
@@ -78,9 +78,11 @@
#define LIST_ALL (9)
//Valid flags for force_encounter_with_flags
-#define ENCOUNTER_FLAG_NO_CAR (1)
-#define ENCOUNTER_FLAG_LOCK (2) // 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_CAR (0x1)
+#define ENCOUNTER_FLAG_LOCK (0x2) // block new forced encounter by the next function call until the current specified encounter occurs
+#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
#define ATKTYPE_LWEP1 (0)
diff --git a/sfall/Modules/MiscPatches.cpp b/sfall/Modules/MiscPatches.cpp
index 97d0f981..e9da61d2 100644
--- a/sfall/Modules/MiscPatches.cpp
+++ b/sfall/Modules/MiscPatches.cpp
@@ -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() {
if (GetConfigInt("Misc", "AdditionalWeaponAnims", 0)) {
dlog("Applying additional weapon animations patch.", DL_INIT);
@@ -573,6 +590,7 @@ void F1EngineBehaviorPatch() {
dlog("Applying Fallout 1 engine behavior patch.", DL_INIT);
BlockCall(0x4A4343); // disable playing the final movie/credits after the endgame slideshow
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);
}
}
diff --git a/sfall/Modules/Scripting/Handlers/Worldmap.cpp b/sfall/Modules/Scripting/Handlers/Worldmap.cpp
index 5f30233f..67bf41db 100644
--- a/sfall/Modules/Scripting/Handlers/Worldmap.cpp
+++ b/sfall/Modules/Scripting/Handlers/Worldmap.cpp
@@ -35,6 +35,7 @@ static DWORD ForceEncounterMapID = -1;
static DWORD ForceEncounterFlags;
DWORD ForceEncounterRestore() {
+ if (ForceEncounterMapID == -1) return 0;
long long data = 0x672E043D83; // cmp ds:_Meet_Frank_Horrigan, 0
SafeWriteBytes(0x4C06D1, (BYTE*)&data, 5);
ForceEncounterFlags = 0;
@@ -43,12 +44,21 @@ DWORD ForceEncounterRestore() {
return mapID;
}
-// implements a blinking encounter icon
-static void ForceEncounterIcon() {
- long iconType = (ForceEncounterFlags & 4) ? 3 : 1; // icon type flag (special: 0-3, normal: 0-1)
+static void ForceEncounterEffects() {
+ if (ForceEncounterFlags & 0x10) { // _FadeOut flag
+ __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_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;
*(DWORD*)FO_VAR_wmRndCursorFid = iconFidIndex;
__asm call fo::funcoffs::wmInterfaceRefresh_;
@@ -67,7 +77,7 @@ static void __declspec(naked) wmRndEncounterOccurred_hack() {
mov eax, ForceEncounterMapID;
call fo::funcoffs::wmMatchAreaContainingMapIdx_;
noCar:
- call ForceEncounterIcon;
+ call ForceEncounterEffects;
call ForceEncounterRestore;
push 0x4C0721; // return addr
jmp fo::funcoffs::map_load_idx_; // eax - mapID
diff --git a/sfall/Modules/Worldmap.h b/sfall/Modules/Worldmap.h
index 4c060ba8..489d3de6 100644
--- a/sfall/Modules/Worldmap.h
+++ b/sfall/Modules/Worldmap.h
@@ -1,20 +1,20 @@
/*
-* sfall
-* Copyright (C) 2008-2017 The sfall team
-*
-* 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
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*/
+ * sfall
+ * Copyright (C) 2008-2017 The sfall team
+ *
+ * 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
#pragma once
@@ -48,6 +48,6 @@ public:
static const char* GetCurrentTerrainName();
};
-void _stdcall SetMapMulti(float d);
+void _stdcall SetMapMulti(float value);
}