-
Notifications
You must be signed in to change notification settings - Fork 0
/
control_flow.c
57 lines (47 loc) · 1.19 KB
/
control_flow.c
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
#include "control_flow.h"
#include "play_xor.h"
#include "replay.h"
#include <stdlib.h>
#include "splash.h"
#include "debug.h"
void control_flow(int level)
{
int flow = (level & FLOW_LOAD_REPLAY) ? FLOW_LOAD_REPLAY : FLOW_START;
while(1)
{
if (flow == FLOW_LOAD_REPLAY)
{
if ((level = replay_load()) == 999) {
debug("failed to load replay!\n");
return;
}
splash_level_entry(level);
flow = replay_xor(level | FLOW_START);
}
else
{
flow = play_xor(level | flow);
if (flow == FLOW_DO_QUIT)
return;
}
flow = replay_menu(flow);
if (flow == FLOW_DO_QUIT)
return;
}
}
#if DEBUG
void control_flow_print(int flow)
{
EBIT_MSG(flow, FLOW_LOAD_REPLAY)
EBIT_MSG(flow, FLOW_START)
EBIT_MSG(flow, FLOW_CONTINUE)
EBIT_MSG(flow, FLOW_CAN_PLAY)
EBIT_MSG(flow, FLOW_DO_REPLAY)
EBIT_MSG(flow, FLOW_DO_GAME)
EBIT_MSG(flow, FLOW_INTERUPT_BREAK)
EBIT_MSG(flow, FLOW_INTERUPT_MENU)
EBIT_MSG(flow, FLOW_DEATH)
EBIT_MSG(flow, FLOW_COMPLETE)
EBIT_MSG(flow, FLOW_DO_QUIT)
}
#endif