mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Merge branch 'line-angle' into 'next'
Add angle field to linedef_t See merge request STJr/SRB2!1602
This commit is contained in:
commit
55854410ac
6 changed files with 15 additions and 5 deletions
|
@ -88,6 +88,7 @@ enum line_e {
|
|||
line_v2,
|
||||
line_dx,
|
||||
line_dy,
|
||||
line_angle,
|
||||
line_flags,
|
||||
line_special,
|
||||
line_tag,
|
||||
|
@ -113,6 +114,7 @@ static const char *const line_opt[] = {
|
|||
"v2",
|
||||
"dx",
|
||||
"dy",
|
||||
"angle",
|
||||
"flags",
|
||||
"special",
|
||||
"tag",
|
||||
|
@ -823,6 +825,9 @@ static int line_get(lua_State *L)
|
|||
case line_dy:
|
||||
lua_pushfixed(L, line->dy);
|
||||
return 1;
|
||||
case line_angle:
|
||||
lua_pushangle(L, line->angle);
|
||||
return 1;
|
||||
case line_flags:
|
||||
lua_pushinteger(L, line->flags);
|
||||
return 1;
|
||||
|
|
|
@ -3101,7 +3101,7 @@ static void P_HitCameraSlideLine(line_t *ld, camera_t *thiscam)
|
|||
}
|
||||
|
||||
side = P_PointOnLineSide(thiscam->x, thiscam->y, ld);
|
||||
lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy);
|
||||
lineangle = ld->angle;
|
||||
|
||||
if (side == 1)
|
||||
lineangle += ANGLE_180;
|
||||
|
@ -3147,7 +3147,7 @@ static void P_HitSlideLine(line_t *ld)
|
|||
|
||||
side = P_PointOnLineSide(slidemo->x, slidemo->y, ld);
|
||||
|
||||
lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy);
|
||||
lineangle = ld->angle;
|
||||
|
||||
if (side == 1)
|
||||
lineangle += ANGLE_180;
|
||||
|
@ -3190,7 +3190,7 @@ static void P_HitBounceLine(line_t *ld)
|
|||
return;
|
||||
}
|
||||
|
||||
lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy);
|
||||
lineangle = ld->angle;
|
||||
|
||||
if (lineangle >= ANGLE_180)
|
||||
lineangle -= ANGLE_180;
|
||||
|
|
|
@ -785,7 +785,7 @@ static void Polyobj_pushThing(polyobj_t *po, line_t *line, mobj_t *mo)
|
|||
vertex_t closest;
|
||||
|
||||
// calculate angle of line and subtract 90 degrees to get normal
|
||||
lineangle = R_PointToAngle2(0, 0, line->dx, line->dy) - ANGLE_90;
|
||||
lineangle = line->angle - ANGLE_90;
|
||||
lineangle >>= ANGLETOFINESHIFT;
|
||||
momx = FixedMul(po->thrust, FINECOSINE(lineangle));
|
||||
momy = FixedMul(po->thrust, FINESINE(lineangle));
|
||||
|
@ -1060,6 +1060,8 @@ static void Polyobj_rotateLine(line_t *ld)
|
|||
ld->dx = v2->x - v1->x;
|
||||
ld->dy = v2->y - v1->y;
|
||||
|
||||
ld->angle = R_PointToAngle2(0, 0, ld->dx, ld->dy);
|
||||
|
||||
// determine slopetype
|
||||
ld->slopetype = !ld->dx ? ST_VERTICAL : !ld->dy ? ST_HORIZONTAL :
|
||||
((ld->dy > 0) == (ld->dx > 0)) ? ST_POSITIVE : ST_NEGATIVE;
|
||||
|
|
|
@ -1069,6 +1069,8 @@ static void P_InitializeLinedef(line_t *ld)
|
|||
ld->dx = v2->x - v1->x;
|
||||
ld->dy = v2->y - v1->y;
|
||||
|
||||
ld->angle = R_PointToAngle2(0, 0, ld->dx, ld->dy);
|
||||
|
||||
ld->bbox[BOXLEFT] = min(v1->x, v2->x);
|
||||
ld->bbox[BOXRIGHT] = max(v1->x, v2->x);
|
||||
ld->bbox[BOXBOTTOM] = min(v1->y, v2->y);
|
||||
|
|
|
@ -1241,7 +1241,7 @@ static boolean PolyFlag(line_t *line)
|
|||
|
||||
pfd.polyObjNum = Tag_FGet(&line->tags);
|
||||
pfd.speed = P_AproxDistance(line->dx, line->dy) >> FRACBITS;
|
||||
pfd.angle = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y) >> ANGLETOFINESHIFT;
|
||||
pfd.angle = line->angle >> ANGLETOFINESHIFT;
|
||||
pfd.momx = sides[line->sidenum[0]].textureoffset >> FRACBITS;
|
||||
|
||||
return EV_DoPolyObjFlag(&pfd);
|
||||
|
|
|
@ -387,6 +387,7 @@ typedef struct line_s
|
|||
vertex_t *v2;
|
||||
|
||||
fixed_t dx, dy; // Precalculated v2 - v1 for side checking.
|
||||
angle_t angle; // Precalculated angle between dx and dy
|
||||
|
||||
// Animation related.
|
||||
INT16 flags;
|
||||
|
|
Loading…
Reference in a new issue