-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
75 lines (71 loc) · 1.29 KB
/
main.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <evo.h>
#include "resources.h"
#include "sprite_pool.c"
#include "gameloop.c"
#include "gameover.c"
#include "menu.c"
#include "dialogs.c"
#include "win_stage.c"
void intro()
{
unpack_pal256(PAL256_TITLE, 0);
draw_image_g256(0, 0, IMG256_TITLE);
text_x = 11;
text_y = 25;
put_slow_str("This is party version!");
text_y += 2;
text_x = 12;
put_slow_str("Press SPACE to start");
while (!keys[FIRE])
{
keyboard(keys);
swap_screen();
}
for (cnt = BRIGHT_MID; cnt > BRIGHT_MIN; cnt--)
{
pal_bright(cnt);
swap_screen();
}
}
void state_manager()
{
while (TRUE)
{
music_stop();
sprites_stop();
switch (state)
{
case STATE_PLAY:
start_game_loop();
break;
case STATE_MENU:
init_menu_loop();
break;
case STATE_GAMEOVER:
gameover();
break;
case STATE_WIN:
win_stage();
break;
default:
break;
}
}
}
void main(void)
{
// Порт 0x20AF - порт управления скоростью CPU. Значение 6 - это 14МГц и включенный кэш(0110)
__asm
ld bc, #0x20af
ld a, #6
out(c), a
__endasm;
set_screen_sync(1);
set_res(MODE320X240);
pal_bright(BRIGHT_MID);
intro();
scroll(0, 0);
init_pool();
state = STATE_MENU;
state_manager();
}