From fb28ede66049396d531c1d910646882a037569c4 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Wed, 22 Jan 2020 16:58:57 +0100 Subject: [PATCH] Rename R_IsPointInSubsector to R_PointInSubsectorOrNull/Nil The old name made it really easy to accidentally read R_IsPointInSubsector as R_PointInSubsector, and anyway it didn't even make sense... --- src/lua_baselib.c | 6 +++--- src/m_cheat.c | 8 ++++---- src/p_mobj.c | 2 +- src/p_user.c | 4 ++-- src/r_main.c | 4 ++-- src/r_main.h | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 7a16f3c69..66bd30e32 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2193,11 +2193,11 @@ static int lib_rPointInSubsector(lua_State *L) return 1; } -static int lib_rIsPointInSubsector(lua_State *L) +static int lib_rPointInSubsectorOrNil(lua_State *L) { fixed_t x = luaL_checkfixed(L, 1); fixed_t y = luaL_checkfixed(L, 2); - subsector_t *sub = R_IsPointInSubsector(x, y); + subsector_t *sub = R_PointInSubsectorOrNull(x, y); //HUDSAFE INLEVEL if (sub) @@ -3141,7 +3141,7 @@ static luaL_Reg lib[] = { {"R_PointToDist",lib_rPointToDist}, {"R_PointToDist2",lib_rPointToDist2}, {"R_PointInSubsector",lib_rPointInSubsector}, - {"R_IsPointInSubsector",lib_rIsPointInSubsector}, + {"R_PointInSubsectorOrNil",lib_rPointInSubsectorOrNil}, // r_things (sprite) {"R_Char2Frame",lib_rChar2Frame}, diff --git a/src/m_cheat.c b/src/m_cheat.c index c284acf3e..980d9fc21 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -452,7 +452,7 @@ void Command_RTeleport_f(void) else inty = 0; - ss = R_IsPointInSubsector(p->mo->x + intx*FRACUNIT, p->mo->y + inty*FRACUNIT); + ss = R_PointInSubsectorOrNull(p->mo->x + intx*FRACUNIT, p->mo->y + inty*FRACUNIT); if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height) { CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n")); @@ -530,7 +530,7 @@ void Command_Teleport_f(void) inty = mt->y<z<sector->ceilingheight - ss->sector->floorheight < p->mo->height) { CONS_Alert(CONS_NOTICE, M_GetText("Spawnpoint not in a valid location.\n")); @@ -597,7 +597,7 @@ void Command_Teleport_f(void) return; } - ss = R_IsPointInSubsector(mo2->x, mo2->y); + ss = R_PointInSubsectorOrNull(mo2->x, mo2->y); if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height) { CONS_Alert(CONS_NOTICE, M_GetText("Starpost not in a valid location.\n")); @@ -653,7 +653,7 @@ void Command_Teleport_f(void) } } - ss = R_IsPointInSubsector(intx, inty); + ss = R_PointInSubsectorOrNull(intx, inty); if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height) { CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n")); diff --git a/src/p_mobj.c b/src/p_mobj.c index a8599ceb5..c4ba9c14f 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11114,7 +11114,7 @@ void P_SpawnPrecipitation(void) x = basex + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); y = basey + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); - precipsector = R_IsPointInSubsector(x, y); + precipsector = R_PointInSubsectorOrNull(x, y); // No sector? Stop wasting time, // move on to the next entry in the blockmap diff --git a/src/p_user.c b/src/p_user.c index a1df8a58b..74349e185 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3160,7 +3160,7 @@ static void P_DoClimbing(player_t *player) platx = P_ReturnThrustX(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale)); platy = P_ReturnThrustY(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale)); - glidesector = R_IsPointInSubsector(player->mo->x + platx, player->mo->y + platy); + glidesector = R_PointInSubsectorOrNull(player->mo->x + platx, player->mo->y + platy); { boolean floorclimb = false; @@ -10235,7 +10235,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } // move camera down to move under lower ceilings - newsubsec = R_IsPointInSubsector(((mo->x>>FRACBITS) + (thiscam->x>>FRACBITS))<<(FRACBITS-1), ((mo->y>>FRACBITS) + (thiscam->y>>FRACBITS))<<(FRACBITS-1)); + newsubsec = R_PointInSubsectorOrNull(((mo->x>>FRACBITS) + (thiscam->x>>FRACBITS))<<(FRACBITS-1), ((mo->y>>FRACBITS) + (thiscam->y>>FRACBITS))<<(FRACBITS-1)); if (!newsubsec) newsubsec = thiscam->subsector; diff --git a/src/r_main.c b/src/r_main.c index a93cd6f49..f4daac834 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -701,9 +701,9 @@ subsector_t *R_PointInSubsector(fixed_t x, fixed_t y) } // -// R_IsPointInSubsector, same as above but returns 0 if not in subsector +// R_PointInSubsectorOrNull, same as above but returns 0 if not in subsector // -subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y) +subsector_t *R_PointInSubsectorOrNull(fixed_t x, fixed_t y) { node_t *node; INT32 side, i; diff --git a/src/r_main.h b/src/r_main.h index 3e575fbd7..d72e94973 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -64,7 +64,7 @@ fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1); fixed_t R_ScaleFromGlobalAngle(angle_t visangle); subsector_t *R_PointInSubsector(fixed_t x, fixed_t y); -subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y); +subsector_t *R_PointInSubsectorOrNull(fixed_t x, fixed_t y); boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixed_t bottomh, fixed_t toph);