102 Dalmatians: Puppies to the Rescue
Decompilation Source Reference |
GitLab repository
Toggle main menu visibility
Loading...
Searching...
No Matches
avi.c
Go to the documentation of this file.
1
/* Recovered game implementation; original addresses identify provenance. */
2
#include "
pcdogs/video/constants.h
"
3
#include "
pcdogs/game/globals.h
"
4
#include "
pcdogs/image/globals.h
"
5
#include "
pcdogs/platform/globals.h
"
6
#include "
pcdogs/runtime/functions.h
"
7
#include "
pcdogs/video/functions.h
"
8
#include "
pcdogs/video/globals.h
"
9
10
// Original pcdogs.exe: 0x40f5b0
11
// Opens the MCI AVI device, resets the movie alias counter, and parses the supplied window-handle text only when initialization succeeds.
12
BOOL
Video_InitializeAVIPlayer
(
char
const
*window_handle_text)
13
{
14
g_aviMovieCounter
= 0;
15
16
g_aviPlayerInitialized
= mciSendStringA(
"open avivideo"
, NULL, 0, NULL) == 0;
17
if
(!
g_aviPlayerInitialized
)
18
return
FALSE;
19
20
g_aviWindowHandle
= (HWND)(uintptr_t)
String_ParseAtoi
(window_handle_text);
21
22
return
g_aviPlayerInitialized
;
23
}
24
25
// Original pcdogs.exe: 0x40f5f0
26
// Closes the MCI AVI device, clears its initialized flag, and returns the MCI error code.
27
MCIERROR
Video_ShutdownAVIPlayer
(
void
)
28
{
29
MCIERROR result = mciSendStringA(
"close avivideo"
, NULL, 0, NULL);
30
g_aviPlayerInitialized
= 0;
31
32
return
result;
33
}
34
35
// Original pcdogs.exe: 0x40f610
36
// Creates a unique MCI alias and opens the requested AVI file when the player is initialized, returning whether the command succeeded.
37
BOOL
Video_OpenAVIFile
(
char
const
*movie_path)
38
{
39
if
(!
g_aviPlayerInitialized
)
40
return
0;
41
42
int32_t movie_alias_index =
g_aviMovieCounter
++;
43
String_FormatCRTString
(
g_aviMciAlias
,
"movie%d"
, movie_alias_index);
44
wsprintfA(
g_aviMciCommand
,
"open %s type avivideo alias %s"
, movie_path,
g_aviMciAlias
);
45
return
mciSendStringA(
g_aviMciCommand
, NULL, 0, NULL) == 0;
46
}
47
48
// Original pcdogs.exe: 0x40f670
49
// Closes the current AVI alias and returns the MCI error code.
50
MCIERROR
Video_CloseAVIFile
(
void
)
51
{
52
wsprintfA(
g_aviMciCommand
,
"close %s"
,
g_aviMciAlias
);
53
return
mciSendStringA(
g_aviMciCommand
, NULL, 0, NULL);
54
}
55
56
// Original pcdogs.exe: 0x40f6a0
57
// Starts fullscreen playback of the current AVI alias and returns whether the MCI command succeeded.
58
BOOL
Video_PlayAVIFullscreen
(
void
)
59
{
60
wsprintfA(
g_aviMciCommand
,
"play %s fullscreen"
,
g_aviMciAlias
);
61
return
mciSendStringA(
g_aviMciCommand
, NULL, 0, NULL) == 0;
62
}
63
64
// Original pcdogs.exe: 0x40f6d0
65
// Queries the current AVI mode and compares it case-insensitively with playing. The MCI query result is not checked before the returned text is inspected.
66
BOOL
Video_IsAVIPlaying
(
void
)
67
{
68
wsprintfA(
g_aviMciCommand
,
"status %s mode"
,
g_aviMciAlias
);
69
70
char
status_text[
VIDEO_MCI_STATUS_CAPACITY
];
71
mciSendStringA(
g_aviMciCommand
, status_text,
sizeof
(status_text), NULL);
72
73
return
__strcmpi
(status_text,
"playing"
) == 0;
74
}
Video_PlayAVIFullscreen
BOOL Video_PlayAVIFullscreen(void)
Definition
avi.c:58
Video_OpenAVIFile
BOOL Video_OpenAVIFile(char const *movie_path)
Definition
avi.c:37
Video_InitializeAVIPlayer
BOOL Video_InitializeAVIPlayer(char const *window_handle_text)
Definition
avi.c:12
Video_CloseAVIFile
MCIERROR Video_CloseAVIFile(void)
Definition
avi.c:50
Video_ShutdownAVIPlayer
MCIERROR Video_ShutdownAVIPlayer(void)
Definition
avi.c:27
Video_IsAVIPlaying
BOOL Video_IsAVIPlaying(void)
Definition
avi.c:66
globals.h
g_aviPlayerInitialized
#define g_aviPlayerInitialized
Definition
globals.h:29
globals.h
globals.h
g_aviWindowHandle
#define g_aviWindowHandle
Definition
globals.h:237
functions.h
String_ParseAtoi
int32_t String_ParseAtoi(char const *string)
Definition
strings.c:78
__strcmpi
int32_t __strcmpi(char const *s1, char const *s2)
Definition
strings.c:279
String_FormatCRTString
int32_t String_FormatCRTString(char *buffer, char const *format,...)
Definition
formatting.c:18
g_aviMciCommand
#define g_aviMciCommand
Definition
strings.h:409
g_aviMciAlias
#define g_aviMciAlias
Definition
strings.h:406
constants.h
VIDEO_MCI_STATUS_CAPACITY
#define VIDEO_MCI_STATUS_CAPACITY
Definition
constants.h:13
functions.h
globals.h
g_aviMovieCounter
#define g_aviMovieCounter
Definition
globals.h:50
src
video
avi.c
Generated by
1.17.0