-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathblast.c
120 lines (97 loc) · 2.43 KB
/
blast.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include "genesis.h"
#include "blast.h"
//#include "math_tables.h"
char str[10];
void vblank() {
//VDP_setHorizontalScroll(BG_B,hscroll*4);
//VDP_setVerticalScroll(BG_B,vScroll*4);
VDP_setHorizontalScroll(BG_A,hs);
VDP_setVerticalScroll(BG_A,vs);
//VDP_updateSprites(1,FALSE);
BLAST_updateSprites();
//check_collision();
}
void _hblank() {
//check_collision();
#ifdef FOOBAR
if(GET_VDPSTATUS(VDP_SPRCOLLISION_FLAG)) {
//int i;
//VDP_drawText(" COL ", 22, 20);
//VDP_drawText(" COL ", 22, 20);
//const u16 vcnt = GET_VCOUNTER;
#ifdef ROWCHECK
coll_row_mask |= 1U << (GET_VCOUNTER >> 3);
#endif
//coll_vcnt = GET_VCOUNTER;
//coll_row[ vcnt/8 ] = 1;
spr_coll = 1;
//const u16 hcnt = GET_HCOUNTER;
//uintToStr(coll_row_mask, str, 3);
//VDP_drawText(str, 40, 16);
//uintToStr(hcnt, str, 3);
//VDP_drawText(str, 24, 25);
}
#endif
}
void blast_init() {
VDP_init();
SYS_disableInts();
//VDP_resetSprites();
//VDP_setScreenWidth256();
VDP_setScreenWidth320();
//VDP_setHIntCounter(2);
//VDP_setHInterrupt(1);
//VDP_setPlanSize(64,64);
VDP_setScrollingMode(HSCROLL_PLANE, VSCROLL_PLANE);
VDP_setTextPalette(1);
//VDP_clearPlan(VDP_BG_A, 0);
VDP_clearPlane(BG_A, 0);
VDP_clearPlane(BG_B, 0);
//VDP_clearPlan(VDP_BG_B, 0);
SYS_setVIntCallback(vblank);
//SYS_setHIntCallback(hblank);
//memset(coll_row, 0, sizeof(coll_row));
spr_coll = 0;
//coll_row_mask = 0;
SYS_enableInts();
//wait_vsync();
VDP_waitVSync();
VDP_waitVSync();
VDP_waitVSync();
VDP_waitVSync();
VDP_waitVSync();
}
void wait_vsync()
{
vu16 *pw;
pw = (u16 *) GFX_CTRL_PORT;
while (*pw & VDP_VBLANK_FLAG);
while (!(*pw & VDP_VBLANK_FLAG));
}
void BLAST_debugText(const char* inbuf, u16 x, u16 y) {
//
#ifdef DEBUG_TEXT
SYS_disableInts();
VDP_drawText(inbuf, x, y);
SYS_enableInts();
#endif
}
void showFPS(VDPPlane plan, u16 float_display)
{
char str[16];
SYS_disableInts();
if (float_display)
{
fix32ToStr(getFPS_f(), str, 1);
VDP_clearText(2, 1, 5);
}
else
{
uintToStr(getFPS(), str, 1);
VDP_clearText(2, 1, 2);
}
// display FPS
VDP_drawTextBG(plan," ",1,1);
VDP_drawTextBG(plan,str,1,1);
SYS_enableInts();
}