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...
This commit is contained in:
Louis-Antoine 2020-01-22 16:58:57 +01:00
parent 0d460aed1d
commit fb28ede660
6 changed files with 13 additions and 13 deletions

View File

@ -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},

View File

@ -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<<FRACBITS;
offset = mt->z<<FRACBITS;
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("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"));

View File

@ -11114,7 +11114,7 @@ void P_SpawnPrecipitation(void)
x = basex + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3);
y = basey + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>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

View File

@ -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;

View File

@ -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;

View File

@ -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);