mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed the playback of additional movies defined in the MovieXX options (#330)
Added the keyboard buffer cleanup function to metarule3.
This commit is contained in:
@@ -250,11 +250,11 @@
|
|||||||
if (get_flags(obj2) bwand FLAG_MULTIHEX) then distance--
|
if (get_flags(obj2) bwand FLAG_MULTIHEX) then distance--
|
||||||
|
|
||||||
|
|
||||||
/* sfall metalure3 function macros */
|
/* sfall metarule3 function macros */
|
||||||
#define SET_HORRIGAN_ENCOUNTER (200)
|
|
||||||
|
|
||||||
// sets the number of days (range 1...127) for the Frank Horrigan encounter, or disable the encounter if days is set to 0
|
// sets the number of days (range 1...127) for the Frank Horrigan encounter, or disable the encounter if days is set to 0
|
||||||
#define set_horrigan_days(day) metarule3(SET_HORRIGAN_ENCOUNTER, day, 0, 0)
|
#define set_horrigan_days(day) metarule3(200, day, 0, 0)
|
||||||
|
// clears the keyboard input buffer, use it in the HOOK_KEYPRESS hook to clear keyboard events before calling script functions that accept key input
|
||||||
|
#define clear_keyboard_buffer metarule3(201, 0, 0, 0)
|
||||||
|
|
||||||
|
|
||||||
/* sfall_funcX macros */
|
/* sfall_funcX macros */
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ static bool HorriganEncounterDisabled = false;
|
|||||||
|
|
||||||
enum MetaruleFunction : long {
|
enum MetaruleFunction : long {
|
||||||
SET_HORRIGAN_ENCOUNTER = 200, // sets the number of days for the Frank Horrigan encounter or disable encounter
|
SET_HORRIGAN_ENCOUNTER = 200, // sets the number of days for the Frank Horrigan encounter or disable encounter
|
||||||
|
CLEAR_KEYBOARD_BUFFER = 201, // clears the keyboard input buffer, should be used in the HOOK_KEYPRESS hook to clear keyboard events in some cases
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -51,6 +52,9 @@ static long __fastcall op_metarule3_ext(long metafunc, long* args) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CLEAR_KEYBOARD_BUFFER:
|
||||||
|
__asm call kb_clear_;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
DebugPrintf("\nOPCODE ERROR: metarule3(%d, ...) - metarule function number does not exist.\n > Script: %s, procedure %s.",
|
DebugPrintf("\nOPCODE ERROR: metarule3(%d, ...) - metarule function number does not exist.\n > Script: %s, procedure %s.",
|
||||||
metafunc, (*ptr_currentProgram)->fileName, FindCurrentProc(*ptr_currentProgram));
|
metafunc, (*ptr_currentProgram)->fileName, FindCurrentProc(*ptr_currentProgram));
|
||||||
|
|||||||
+27
-2
@@ -106,7 +106,9 @@ private:
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
if (d3d9Device->CreateTexture(lpAllocInfo->dwWidth, lpAllocInfo->dwHeight, 1, 0, lpAllocInfo->Format, D3DPOOL_DEFAULT, &mTex, nullptr) != D3D_OK) {
|
if (d3d9Device->CreateTexture(lpAllocInfo->dwWidth, lpAllocInfo->dwHeight, 1, 0, lpAllocInfo->Format, D3DPOOL_DEFAULT, &mTex, nullptr) != D3D_OK) {
|
||||||
dlog(" Failed to create movie texture!", DL_INIT);
|
dlogr(" Failed to create movie texture!", DL_INIT);
|
||||||
|
} else {
|
||||||
|
dlogr(" OK!", DL_INIT);
|
||||||
}
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@@ -470,6 +472,8 @@ skip:
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define DEFAULT_MOVIES 17 // max vanilla movies
|
||||||
|
|
||||||
char MoviePaths[MaxMovies * 65];
|
char MoviePaths[MaxMovies * 65];
|
||||||
static DWORD Artimer1DaysCheckTimer;
|
static DWORD Artimer1DaysCheckTimer;
|
||||||
|
|
||||||
@@ -485,6 +489,25 @@ less:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __declspec(naked) gmovie_play_hack_subpal() {
|
||||||
|
__asm {
|
||||||
|
xor eax, eax;
|
||||||
|
lea edx, [ebp * 4];
|
||||||
|
cmp ebp, DEFAULT_MOVIES;
|
||||||
|
cmovb eax, edx;
|
||||||
|
retn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __declspec(naked) op_play_gmovie_hack() {
|
||||||
|
__asm {
|
||||||
|
mov edx, 0xB; // default play mode flags
|
||||||
|
cmp ecx, DEFAULT_MOVIES;
|
||||||
|
cmovb edx, eax;
|
||||||
|
retn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SkipOpeningMoviesPatch() {
|
void SkipOpeningMoviesPatch() {
|
||||||
int skipOpening = GetConfigInt("Misc", "SkipOpeningMovies", 0);
|
int skipOpening = GetConfigInt("Misc", "SkipOpeningMovies", 0);
|
||||||
if (skipOpening) {
|
if (skipOpening) {
|
||||||
@@ -509,7 +532,7 @@ void MoviesInit() {
|
|||||||
MoviePaths[index + 64] = '\0';
|
MoviePaths[index + 64] = '\0';
|
||||||
|
|
||||||
_itoa_s(i + 1, &optName[5], 3, 10);
|
_itoa_s(i + 1, &optName[5], 3, 10);
|
||||||
if (i < 17) {
|
if (i < DEFAULT_MOVIES) {
|
||||||
GetConfigString("Misc", optName, ptr_movie_list[i], &MoviePaths[index], 65);
|
GetConfigString("Misc", optName, ptr_movie_list[i], &MoviePaths[index], 65);
|
||||||
} else {
|
} else {
|
||||||
GetConfigString("Misc", optName, "", &MoviePaths[index], 65);
|
GetConfigString("Misc", optName, "", &MoviePaths[index], 65);
|
||||||
@@ -518,6 +541,8 @@ void MoviesInit() {
|
|||||||
dlog(".", DL_INIT);
|
dlog(".", DL_INIT);
|
||||||
const DWORD movieListAddr[] = {0x44E6AE, 0x44E721, 0x44E75E, 0x44E78A}; // gmovie_play_
|
const DWORD movieListAddr[] = {0x44E6AE, 0x44E721, 0x44E75E, 0x44E78A}; // gmovie_play_
|
||||||
SafeWriteBatch<DWORD>((DWORD)MoviePtrs, movieListAddr);
|
SafeWriteBatch<DWORD>((DWORD)MoviePtrs, movieListAddr);
|
||||||
|
MakeCall(0x44E896, gmovie_play_hack_subpal, 2);
|
||||||
|
MakeCall(0x45A1C9, op_play_gmovie_hack);
|
||||||
dlog(".", DL_INIT);
|
dlog(".", DL_INIT);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -348,6 +348,7 @@ static const wchar_t *SoundExtensions[] = { L"wav", L"mp3", L"wma" };
|
|||||||
/*
|
/*
|
||||||
TODO: For sfx sounds in wav format, playback must be performed using the game functions (DirectSound)
|
TODO: For sfx sounds in wav format, playback must be performed using the game functions (DirectSound)
|
||||||
because there is a small delay (~50-100ms) when using DirectShow
|
because there is a small delay (~50-100ms) when using DirectShow
|
||||||
|
sfx - environment effects must set their volume relative to the location from the player (see gsound_compute_relative_volume_)
|
||||||
*/
|
*/
|
||||||
static bool __fastcall SoundFileLoad(PlayType playType, const char* path) {
|
static bool __fastcall SoundFileLoad(PlayType playType, const char* path) {
|
||||||
if (!path) return false;
|
if (!path) return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user