Remove ags_regionContains()

This commit is contained in:
kichikuou
2021-01-09 13:43:24 +09:00
parent e18bb6cb75
commit cd77cbfbf1
4 changed files with 16 additions and 21 deletions
+8 -8
View File
@@ -65,14 +65,14 @@ static int sel_main();
* マージン内はsprite内部とは判断しない
*/
static boolean sp_is_insprite2(sprite_t *sp, int x, int y, int margin) {
MyRectangle r;
cginfo_t *curcg = sp->curcg;
r.x = sp->cur.x + margin;
r.y = sp->cur.y + margin;
r.w = curcg->sf->width - 2 * margin;
r.h = curcg->sf->height - 2 * margin;
return ags_regionContains(&r, x, y);
MyPoint p = {x, y};
MyRectangle r = {
sp->cur.x + margin,
sp->cur.y + margin,
sp->curcg->sf->width - 2 * margin,
sp->curcg->sf->height - 2 * margin
};
return SDL_PointInRect(&p, &r);
}
// マウスが移動したときの callback
-5
View File
@@ -64,11 +64,6 @@ static void initPal(Palette256 *pal) {
nact->sys_pal_changed = TRUE;
}
boolean ags_regionContains(MyRectangle *r, int x, int y) {
MyPoint p = {x, y};
return SDL_PointInRect(&p, r);
}
boolean ags_check_param(int *x, int *y, int *w, int *h) {
if (*x >= nact->sys_world_size.width) {
WARNING("Illegal Param x = %d (max=%d)(@%03x:%05x)\n", *x, nact->sys_world_size.width, sl_getPage(), sl_getIndex());
-1
View File
@@ -148,7 +148,6 @@ extern void ags_setWindowTitle(const char *str);
extern void ags_getDIBInfo(DispInfo *info);
extern void ags_getWindowInfo(DispInfo *info);
extern void ags_getViewAreaInfo(DispInfo *info);
extern boolean ags_regionContains(MyRectangle *r, int x, int y);
extern boolean ags_check_param(int *x, int *y, int *w, int *h);
extern boolean ags_check_param_xy(int *x, int *y);
extern agsurface_t *ags_getDIB();
+8 -7
View File
@@ -89,13 +89,14 @@ void commandEM() {
int *var = getCaliVariable();
int x = getCaliValue();
int y = getCaliValue();
MyPoint p = {x, y};
MyRectangle r = tbl[num - 1].r;
if (nact->patch_emen == 0) {
r.w -= 1;
r.h -= 1;
}
*var = ags_regionContains(&r, x, y) ? 1 : 0;
*var = SDL_PointInRect(&p, &r) ? 1 : 0;
DEBUG_COMMAND("EM %d,%d,%d,%d:\n", num, *var, x, y);
}
@@ -105,18 +106,18 @@ void commandEN() {
int max = getCaliValue();
int x = getCaliValue();
int y = getCaliValue();
int i;
MyRectangle r;
MyPoint p = {x, y};
*var = 0;
for (i = min; i <= max; i++) {
r = tbl[i - 1].r;
for (int i = min; i <= max; i++) {
MyRectangle r = tbl[i - 1].r;
if (nact->patch_emen == 0) {
r.w -= 1;
r.h -= 1;
}
if (ags_regionContains(&r, x, y)) *var = i;
if (SDL_PointInRect(&p, &r))
*var = i;
}
DEBUG_COMMAND("EN %d,%d,%d,%d,%d:\n", *var, min, max, x, y);