mirror of https://github.com/nmlgc/ReC98.git
Add some useful increment and decrement macros
Which we'd really like to have for the highscore entering screen.
This commit is contained in:
parent
d058666929
commit
37fc899c42
|
@ -1,10 +1,37 @@
|
|||
/* ReC98
|
||||
* -----
|
||||
* Some useful PC-98 hardware constants
|
||||
* Some useful random constants and macros
|
||||
*/
|
||||
|
||||
// VRAM planes
|
||||
// -----------
|
||||
// Macros
|
||||
// ------
|
||||
#define CLAMP_INC(val, max) \
|
||||
(val)++; \
|
||||
if((val) > (max)) { \
|
||||
(val) = (max); \
|
||||
}
|
||||
|
||||
#define CLAMP_DEC(val, min) \
|
||||
(val)--; \
|
||||
if((val) < (min)) { \
|
||||
(val) = (min); \
|
||||
}
|
||||
|
||||
#define RING_INC(val, ring_end) \
|
||||
(val)++; \
|
||||
if((val) > (ring_end)) { \
|
||||
(val) = 0; \
|
||||
}
|
||||
|
||||
#define RING_DEC(val, ring_end) \
|
||||
(val)--; \
|
||||
if((val) < 0) { \
|
||||
(val) = ring_end; \
|
||||
}
|
||||
// ------
|
||||
|
||||
// PC-98 VRAM planes
|
||||
// -----------------
|
||||
typedef enum {
|
||||
PL_B, PL_R, PL_G, PL_E, PL_COUNT
|
||||
} vram_plane_t;
|
||||
|
@ -26,4 +53,4 @@ extern char *VRAM_PLANE_E;
|
|||
}
|
||||
|
||||
#define VRAM_OFFSET(x, y) ((x) >> 3) + (y << 6) + (y << 4)
|
||||
// -----------
|
||||
// -----------------
|
|
@ -3,7 +3,7 @@
|
|||
* Include file for TH01
|
||||
*/
|
||||
|
||||
#include "pc98.h"
|
||||
#include "ReC98.h"
|
||||
|
||||
// Hardware
|
||||
void graph_accesspage_func(int page);
|
||||
|
|
26
th02/op_05.c
26
th02/op_05.c
|
@ -39,22 +39,22 @@ void copy_pic_back(int sel, int highlight)
|
|||
int x, y;
|
||||
if(!highlight) {
|
||||
switch(sel) {
|
||||
case 0: x = 16; y = 128; break;
|
||||
case 1: x = 224; y = 224; break;
|
||||
case 0: x = 16; y = 128; break;
|
||||
case 1: x = 224; y = 224; break;
|
||||
case 2: x = 432; y = 128; break;
|
||||
}
|
||||
graph_copy_region_from_1_to_0(x, y, 16, 144);
|
||||
graph_copy_region_from_1_to_0(x, y, 192, 10);
|
||||
} else {
|
||||
switch(sel) {
|
||||
case 0: x = 208; y = 136; break;
|
||||
case 1: x = 416; y = 232; break;
|
||||
case 0: x = 208; y = 136; break;
|
||||
case 1: x = 416; y = 232; break;
|
||||
case 2: x = 624; y = 136; break;
|
||||
}
|
||||
graph_copy_region_from_1_to_0(x, y, 16, 144);
|
||||
switch(sel) {
|
||||
case 0: x = 24; y = 272; break;
|
||||
case 1: x = 232; y = 368; break;
|
||||
case 0: x = 24; y = 272; break;
|
||||
case 1: x = 232; y = 368; break;
|
||||
case 2: x = 440; y = 272; break;
|
||||
}
|
||||
graph_copy_region_from_1_to_0(x, y, 192, 8);
|
||||
|
@ -81,8 +81,8 @@ void draw_shottype_desc(int sel, int color)
|
|||
{
|
||||
int x, y;
|
||||
switch(sel) {
|
||||
case 0: x = 16; y = 296; break;
|
||||
case 1: x = 224; y = 136; break;
|
||||
case 0: x = 16; y = 296; break;
|
||||
case 1: x = 224; y = 136; break;
|
||||
case 2: x = 432; y = 296; break;
|
||||
}
|
||||
grcg_setcolor(GC_RMW, color);
|
||||
|
@ -176,10 +176,7 @@ void pascal shottype_menu(void)
|
|||
frame_delay(1);
|
||||
darken_pic_at(pic_x[sel] + 8, pic_y[sel] + 8);
|
||||
|
||||
sel--;
|
||||
if(sel < 0) {
|
||||
sel = SHOTTYPE_COUNT - 1;
|
||||
}
|
||||
RING_DEC(sel, SHOTTYPE_COUNT - 1);
|
||||
DRAW_NEW_SEL();
|
||||
}
|
||||
if(input & INPUT_RIGHT) {
|
||||
|
@ -191,10 +188,7 @@ void pascal shottype_menu(void)
|
|||
frame_delay(1);
|
||||
darken_pic_at(pic_x[sel] + 8, pic_y[sel] + 8);
|
||||
|
||||
sel++;
|
||||
if(sel > SHOTTYPE_COUNT - 1) {
|
||||
sel = 0;
|
||||
}
|
||||
RING_INC(sel, SHOTTYPE_COUNT - 1);
|
||||
DRAW_NEW_SEL();
|
||||
}
|
||||
if(input & INPUT_SHOT || input & INPUT_OK) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Include file for TH02
|
||||
*/
|
||||
|
||||
#include "pc98.h"
|
||||
#include "ReC98.h"
|
||||
|
||||
// Formats
|
||||
#define PI_SLOTS 6
|
||||
|
|
Loading…
Reference in New Issue