forked from diasurgical/devilution
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoom.cpp
More file actions
95 lines (82 loc) · 1.63 KB
/
doom.cpp
File metadata and controls
95 lines (82 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "diablo.h"
int doom_quest_time;
int doom_stars_drawn;
BYTE *pDoomCel;
BOOL doomflag;
int DoomQuestState;
/*
void doom_reset_state()
{
if (DoomQuestState <= 0) {
DoomQuestState = 0;
}
}
void doom_play_movie()
{
if (DoomQuestState < 36001) {
DoomQuestState++;
if (DoomQuestState == 36001) {
PlayInGameMovie("gendata\\doom.smk");
DoomQuestState++;
}
}
}
*/
int doom_get_frame_from_time()
{
if (DoomQuestState == 36001) {
return 31;
}
return DoomQuestState / 1200;
}
void doom_alloc_cel()
{
pDoomCel = DiabloAllocPtr(229376);
}
void doom_cleanup()
{
MemFreeDbg(pDoomCel);
}
void doom_load_graphics()
{
if (doom_quest_time == 31) {
strcpy(tempstr, "Items\\Map\\MapZDoom.CEL");
} else if (doom_quest_time < 10) {
sprintf(tempstr, "Items\\Map\\MapZ000%i.CEL", doom_quest_time);
} else {
sprintf(tempstr, "Items\\Map\\MapZ00%i.CEL", doom_quest_time);
}
LoadFileWithMem(tempstr, pDoomCel);
}
void doom_init()
{
doomflag = TRUE;
doom_alloc_cel();
doom_quest_time = doom_get_frame_from_time() == 31 ? 31 : 0;
doom_load_graphics();
}
void doom_close()
{
if (doomflag) {
doomflag = FALSE;
doom_cleanup();
}
}
void doom_draw()
{
if (!doomflag) {
return;
}
if (doom_quest_time != 31) {
doom_stars_drawn++;
if (doom_stars_drawn >= 5) {
doom_stars_drawn = 0;
doom_quest_time++;
if (doom_quest_time > doom_get_frame_from_time()) {
doom_quest_time = 0;
}
doom_load_graphics();
}
}
CelDraw(SCREEN_X, PANEL_Y - 1, pDoomCel, 1, SCREEN_WIDTH);
}