Devilution
Diablo devolved - magic behind the 1996 computer game
Source
doom.cpp
Go to the documentation of this file.
1
6
#include "
all.h
"
7
8
DEVILUTION_BEGIN_NAMESPACE
9
10
int
doom_quest_time
;
11
int
doom_stars_drawn
;
12
BYTE *
pDoomCel
;
13
BOOL
doomflag
;
14
int
DoomQuestState
;
15
16
/*
17
void doom_reset_state()
18
{
19
if (DoomQuestState <= 0) {
20
DoomQuestState = 0;
21
}
22
}
23
24
void doom_play_movie()
25
{
26
if (DoomQuestState < 36001) {
27
DoomQuestState++;
28
if (DoomQuestState == 36001) {
29
PlayInGameMovie("gendata\\doom.smk");
30
DoomQuestState++;
31
}
32
}
33
}
34
*/
35
36
int
doom_get_frame_from_time
()
37
{
38
if
(
DoomQuestState
== 36001) {
39
return
31;
40
}
41
42
return
DoomQuestState
/ 1200;
43
}
44
45
void
doom_alloc_cel
()
46
{
47
pDoomCel
=
DiabloAllocPtr
(0x38000);
48
}
49
50
void
doom_cleanup
()
51
{
52
MemFreeDbg
(
pDoomCel
);
53
}
54
55
void
doom_load_graphics
()
56
{
57
if
(
doom_quest_time
== 31) {
58
strcpy(
tempstr
,
"Items\\Map\\MapZDoom.CEL"
);
59
}
else
if
(
doom_quest_time
< 10) {
60
sprintf(
tempstr
,
"Items\\Map\\MapZ000%i.CEL"
,
doom_quest_time
);
61
}
else
{
62
sprintf(
tempstr
,
"Items\\Map\\MapZ00%i.CEL"
,
doom_quest_time
);
63
}
64
LoadFileWithMem
(
tempstr
,
pDoomCel
);
65
}
66
67
void
doom_init
()
68
{
69
doomflag
= TRUE;
70
doom_alloc_cel
();
71
doom_quest_time
=
doom_get_frame_from_time
() == 31 ? 31 : 0;
72
doom_load_graphics
();
73
}
74
75
void
doom_close
()
76
{
77
if
(
doomflag
) {
78
doomflag
= FALSE;
79
doom_cleanup
();
80
}
81
}
82
83
void
doom_draw
()
84
{
85
if
(!
doomflag
) {
86
return
;
87
}
88
89
if
(
doom_quest_time
!= 31) {
90
doom_stars_drawn
++;
91
if
(
doom_stars_drawn
>= 5) {
92
doom_stars_drawn
= 0;
93
doom_quest_time
++;
94
if
(
doom_quest_time
>
doom_get_frame_from_time
()) {
95
doom_quest_time
= 0;
96
}
97
doom_load_graphics
();
98
}
99
}
100
101
CelDraw
(
SCREEN_X
,
PANEL_Y
- 1,
pDoomCel
, 1,
SCREEN_WIDTH
);
102
}
103
104
DEVILUTION_END_NAMESPACE
doom_load_graphics
void doom_load_graphics()
Definition:
doom.cpp:55
doom_alloc_cel
void doom_alloc_cel()
Definition:
doom.cpp:45
pDoomCel
BYTE * pDoomCel
Definition:
doom.cpp:12
PANEL_Y
#define PANEL_Y
Definition:
defs.h:137
doomflag
BOOL doomflag
Definition:
doom.cpp:13
doom_get_frame_from_time
int doom_get_frame_from_time()
Definition:
doom.cpp:36
MemFreeDbg
#define MemFreeDbg(p)
Definition:
defs.h:157
doom_stars_drawn
int doom_stars_drawn
Definition:
doom.cpp:11
doom_init
void doom_init()
Definition:
doom.cpp:67
all.h
doom_draw
void doom_draw()
Definition:
doom.cpp:83
LoadFileWithMem
DWORD LoadFileWithMem(const char *pszName, void *p)
Load a file in to the given buffer.
Definition:
engine.cpp:830
SCREEN_WIDTH
#define SCREEN_WIDTH
Definition:
defs.h:105
DEVILUTION_END_NAMESPACE
#define DEVILUTION_END_NAMESPACE
Definition:
types.h:10
CelDraw
void CelDraw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth)
Blit CEL sprite to the back buffer at the given coordinates.
Definition:
engine.cpp:47
doom_cleanup
void doom_cleanup()
Definition:
doom.cpp:50
tempstr
char tempstr[256]
Definition:
control.cpp:41
DiabloAllocPtr
BYTE * DiabloAllocPtr(DWORD dwBytes)
Multithreaded safe malloc.
Definition:
engine.cpp:765
doom_close
void doom_close()
Definition:
doom.cpp:75
DoomQuestState
int DoomQuestState
Definition:
doom.cpp:14
DEVILUTION_BEGIN_NAMESPACE
Definition:
sha.cpp:10
SCREEN_X
#define SCREEN_X
Definition:
defs.h:125
doom_quest_time
DEVILUTION_BEGIN_NAMESPACE int doom_quest_time
Definition:
doom.cpp:10
Generated by
1.8.17