mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- Added the ACS script type "return". These are executed by players who return
to a map they've previously been to. This is analagous to enter scripts, but whereas enter scripts execute only the first time a player enters a map, return scripts execute all but the first time. - Improved map scrolling when rotation is on and follow mode is off. SVN r742 (trunk)
This commit is contained in:
parent
99c4c9461e
commit
2e5257d347
5 changed files with 75 additions and 50 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
February 12, 2008
|
||||||
|
- Added the ACS script type "return". These are executed by players who return
|
||||||
|
to a map they've previously been to. This is analagous to enter scripts, but
|
||||||
|
whereas enter scripts execute only the first time a player enters a map,
|
||||||
|
return scripts execute all but the first time.
|
||||||
|
- Improved map scrolling when rotation is on and follow mode is off.
|
||||||
|
|
||||||
February 11, 2008
|
February 11, 2008
|
||||||
- Fixed: Turning off follow mode with automap rotating enabled did not
|
- Fixed: Turning off follow mode with automap rotating enabled did not
|
||||||
function in an easy-to-understand manner.
|
function in an easy-to-understand manner.
|
||||||
|
|
107
src/am_map.cpp
107
src/am_map.cpp
|
@ -307,8 +307,6 @@ static fixed_t ftom_zoommul; // how far the window zooms in each tic (fb coords)
|
||||||
static fixed_t m_x, m_y; // LL x,y where the window is on the map (map coords)
|
static fixed_t m_x, m_y; // LL x,y where the window is on the map (map coords)
|
||||||
static fixed_t m_x2, m_y2; // UR x,y where the window is on the map (map coords)
|
static fixed_t m_x2, m_y2; // UR x,y where the window is on the map (map coords)
|
||||||
|
|
||||||
static fixed_t m_rotateoffsx, m_rotateoffsy; // Offset for rotated map.
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// width/height of window on map (map coords)
|
// width/height of window on map (map coords)
|
||||||
//
|
//
|
||||||
|
@ -493,7 +491,7 @@ static void AM_findMinMaxBoundaries ()
|
||||||
max_scale_mtof = MapDiv (SCREENHEIGHT << MAPBITS, 2*PLAYERRADIUS);
|
max_scale_mtof = MapDiv (SCREENHEIGHT << MAPBITS, 2*PLAYERRADIUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AM_ClipRotatedExtents ()
|
static void AM_ClipRotatedExtents (fixed_t pivotx, fixed_t pivoty)
|
||||||
{
|
{
|
||||||
fixed_t rmin_x, rmin_y, rmax_x, rmax_y;
|
fixed_t rmin_x, rmin_y, rmax_x, rmax_y;
|
||||||
|
|
||||||
|
@ -513,15 +511,17 @@ static void AM_ClipRotatedExtents ()
|
||||||
xs[1] = max_x; ys[1] = min_y;
|
xs[1] = max_x; ys[1] = min_y;
|
||||||
xs[2] = max_x; ys[2] = max_y;
|
xs[2] = max_x; ys[2] = max_y;
|
||||||
xs[3] = min_x; ys[3] = max_y;
|
xs[3] = min_x; ys[3] = max_y;
|
||||||
|
rmin_x = rmin_y = FIXED_MAX;
|
||||||
|
rmax_x = rmax_y = FIXED_MIN;
|
||||||
|
|
||||||
for (i = 0; i < 4; ++i)
|
for (i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
AM_rotatePoint (&xs[i], &ys[i]);
|
xs[i] -= pivotx;
|
||||||
}
|
ys[i] -= pivoty;
|
||||||
rmin_x = rmin_y = FIXED_MAX;
|
AM_rotate (&xs[i], &ys[i], ANG90 - players[consoleplayer].camera->angle);
|
||||||
rmax_x = rmax_y = FIXED_MIN;
|
xs[i] += pivotx;
|
||||||
for (i = 0; i < 4; ++i)
|
ys[i] += pivoty;
|
||||||
{
|
|
||||||
if (xs[i] < rmin_x) rmin_x = xs[i];
|
if (xs[i] < rmin_x) rmin_x = xs[i];
|
||||||
if (xs[i] > rmax_x) rmax_x = xs[i];
|
if (xs[i] > rmax_x) rmax_x = xs[i];
|
||||||
if (ys[i] < rmin_y) rmin_y = ys[i];
|
if (ys[i] < rmin_y) rmin_y = ys[i];
|
||||||
|
@ -568,28 +568,27 @@ static void AM_ScrollParchment (fixed_t dmapx, fixed_t dmapy)
|
||||||
//
|
//
|
||||||
void AM_changeWindowLoc ()
|
void AM_changeWindowLoc ()
|
||||||
{
|
{
|
||||||
if (am_rotate)
|
if (0 != (m_paninc.x | m_paninc.y))
|
||||||
{
|
{
|
||||||
m_rotateoffsx -= Scale(m_paninc.x, SCREENWIDTH, 320);
|
followplayer = 0;
|
||||||
m_rotateoffsy -= Scale(m_paninc.y, SCREENHEIGHT, 200);
|
f_oldloc.x = FIXED_MAX;
|
||||||
AM_doFollowPlayer();
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
int oldmx = m_x, oldmy = m_y;
|
||||||
|
fixed_t incx = m_paninc.x, incy = m_paninc.y;
|
||||||
|
|
||||||
|
incx = Scale(m_paninc.x, SCREENWIDTH, 320);
|
||||||
|
incy = Scale(m_paninc.y, SCREENHEIGHT, 200);
|
||||||
|
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
|
||||||
{
|
{
|
||||||
if (0 != (m_paninc.x | m_paninc.y))
|
AM_rotate(&incx, &incy, players[consoleplayer].camera->angle - ANG90);
|
||||||
{
|
|
||||||
followplayer = 0;
|
|
||||||
f_oldloc.x = FIXED_MAX;
|
|
||||||
}
|
|
||||||
|
|
||||||
int oldmx = m_x, oldmy = m_y;
|
|
||||||
|
|
||||||
m_x += Scale (m_paninc.x, SCREENWIDTH, 320);
|
|
||||||
m_y += Scale (m_paninc.y, SCREENHEIGHT, 200);
|
|
||||||
|
|
||||||
AM_ClipRotatedExtents ();
|
|
||||||
AM_ScrollParchment (m_x-oldmx, oldmy-m_y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_x += incx;
|
||||||
|
m_y += incy;
|
||||||
|
|
||||||
|
AM_ClipRotatedExtents (oldmx + m_w/2, oldmy + m_h/2);
|
||||||
|
AM_ScrollParchment (m_x - oldmx, oldmy - m_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1074,8 +1073,8 @@ void AM_doFollowPlayer ()
|
||||||
(f_oldloc.x != players[consoleplayer].camera->x ||
|
(f_oldloc.x != players[consoleplayer].camera->x ||
|
||||||
f_oldloc.y != players[consoleplayer].camera->y))
|
f_oldloc.y != players[consoleplayer].camera->y))
|
||||||
{
|
{
|
||||||
m_x = ((players[consoleplayer].camera->x >> FRACTOMAPBITS) + m_rotateoffsx) - m_w/2;
|
m_x = (players[consoleplayer].camera->x >> FRACTOMAPBITS) - m_w/2;
|
||||||
m_y = ((players[consoleplayer].camera->y >> FRACTOMAPBITS) + m_rotateoffsy) - m_h/2;
|
m_y = (players[consoleplayer].camera->y >> FRACTOMAPBITS) - m_h/2;
|
||||||
m_x2 = m_x + m_w;
|
m_x2 = m_x + m_w;
|
||||||
m_y2 = m_y + m_h;
|
m_y2 = m_y + m_h;
|
||||||
|
|
||||||
|
@ -1097,8 +1096,6 @@ static void AM_ToggleFollowPlayer()
|
||||||
{
|
{
|
||||||
followplayer = !followplayer;
|
followplayer = !followplayer;
|
||||||
f_oldloc.x = FIXED_MAX;
|
f_oldloc.x = FIXED_MAX;
|
||||||
m_rotateoffsx = 0;
|
|
||||||
m_rotateoffsy = 0;
|
|
||||||
Printf ("%s\n", GStrings(followplayer ? "AMSTR_FOLLOWON" : "AMSTR_FOLLOWOFF"));
|
Printf ("%s\n", GStrings(followplayer ? "AMSTR_FOLLOWON" : "AMSTR_FOLLOWOFF"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1491,11 +1488,13 @@ void AM_rotate (fixed_t *x, fixed_t *y, angle_t a)
|
||||||
|
|
||||||
void AM_rotatePoint (fixed_t *x, fixed_t *y)
|
void AM_rotatePoint (fixed_t *x, fixed_t *y)
|
||||||
{
|
{
|
||||||
*x -= players[consoleplayer].camera->x >> FRACTOMAPBITS;
|
fixed_t pivotx = m_x + m_w/2;
|
||||||
*y -= players[consoleplayer].camera->y >> FRACTOMAPBITS;
|
fixed_t pivoty = m_y + m_h/2;
|
||||||
|
*x -= pivotx;
|
||||||
|
*y -= pivoty;
|
||||||
AM_rotate (x, y, ANG90 - players[consoleplayer].camera->angle);
|
AM_rotate (x, y, ANG90 - players[consoleplayer].camera->angle);
|
||||||
*x += (players[consoleplayer].camera->x >> FRACTOMAPBITS) + m_rotateoffsx;
|
*x += pivotx;
|
||||||
*y += (players[consoleplayer].camera->y >> FRACTOMAPBITS) + m_rotateoffsy;
|
*y += pivoty;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1546,26 +1545,37 @@ AM_drawLineCharacter
|
||||||
|
|
||||||
void AM_drawPlayers ()
|
void AM_drawPlayers ()
|
||||||
{
|
{
|
||||||
|
mpoint_t pt;
|
||||||
angle_t angle;
|
angle_t angle;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!multiplayer)
|
if (!multiplayer)
|
||||||
{
|
{
|
||||||
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
|
mline_t *arrow;
|
||||||
angle = ANG90;
|
int numarrowlines;
|
||||||
else
|
|
||||||
angle = players[consoleplayer].camera->angle;
|
|
||||||
|
|
||||||
if (am_cheat != 0)
|
pt.x = players[consoleplayer].camera->x >> FRACTOMAPBITS;
|
||||||
AM_drawLineCharacter
|
pt.y = players[consoleplayer].camera->y >> FRACTOMAPBITS;
|
||||||
(cheat_player_arrow, NUMCHEATPLYRLINES, 0,
|
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
|
||||||
angle, YourColor, (players[consoleplayer].camera->x >> FRACTOMAPBITS) + m_rotateoffsx,
|
{
|
||||||
(players[consoleplayer].camera->y >> FRACTOMAPBITS) + m_rotateoffsy);
|
angle = ANG90;
|
||||||
|
AM_rotatePoint (&pt.x, &pt.y);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
AM_drawLineCharacter
|
{
|
||||||
(player_arrow, NUMPLYRLINES, 0, angle,
|
angle = players[consoleplayer].camera->angle;
|
||||||
YourColor, (players[consoleplayer].camera->x >> FRACTOMAPBITS) + m_rotateoffsx,
|
}
|
||||||
(players[consoleplayer].camera->y >> FRACTOMAPBITS) + m_rotateoffsy);
|
if (am_cheat != 0)
|
||||||
|
{
|
||||||
|
arrow = cheat_player_arrow;
|
||||||
|
numarrowlines = NUMCHEATPLYRLINES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
arrow = player_arrow;
|
||||||
|
numarrowlines = NUMPLYRLINES;
|
||||||
|
}
|
||||||
|
AM_drawLineCharacter(arrow, numarrowlines, 0, angle, YourColor, pt.x, pt.y);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1573,7 +1583,6 @@ void AM_drawPlayers ()
|
||||||
{
|
{
|
||||||
player_t *p = &players[i];
|
player_t *p = &players[i];
|
||||||
AMColor color;
|
AMColor color;
|
||||||
mpoint_t pt;
|
|
||||||
|
|
||||||
if (!playeringame[i] || p->mo == NULL)
|
if (!playeringame[i] || p->mo == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2311,6 +2311,10 @@ void G_FinishTravel ()
|
||||||
inv->LinkToWorld ();
|
inv->LinkToWorld ();
|
||||||
inv->Travelled ();
|
inv->Travelled ();
|
||||||
}
|
}
|
||||||
|
if (level.FromSnapshot)
|
||||||
|
{
|
||||||
|
FBehavior::StaticStartTypedScripts (SCRIPT_Return, pawn, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2340,6 +2344,7 @@ void G_InitLevelLocals ()
|
||||||
level.fadeto = info->fadeto;
|
level.fadeto = info->fadeto;
|
||||||
level.cdtrack = info->cdtrack;
|
level.cdtrack = info->cdtrack;
|
||||||
level.cdid = info->cdid;
|
level.cdid = info->cdid;
|
||||||
|
level.FromSnapshot = false;
|
||||||
if (level.fadeto == 0)
|
if (level.fadeto == 0)
|
||||||
{
|
{
|
||||||
R_SetDefaultColormap (info->fadetable);
|
R_SetDefaultColormap (info->fadetable);
|
||||||
|
@ -2828,6 +2833,7 @@ void G_UnSnapshotLevel (bool hubLoad)
|
||||||
arc.SetHubTravel ();
|
arc.SetHubTravel ();
|
||||||
G_SerializeLevel (arc, hubLoad);
|
G_SerializeLevel (arc, hubLoad);
|
||||||
arc.Close ();
|
arc.Close ();
|
||||||
|
level.FromSnapshot = true;
|
||||||
|
|
||||||
TThinkerIterator<APlayerPawn> it;
|
TThinkerIterator<APlayerPawn> it;
|
||||||
APlayerPawn *pawn, *next;
|
APlayerPawn *pawn, *next;
|
||||||
|
|
|
@ -249,6 +249,8 @@ struct level_locals_s
|
||||||
SBYTE WallVertLight; // Light diffs for vert/horiz walls
|
SBYTE WallVertLight; // Light diffs for vert/horiz walls
|
||||||
SBYTE WallHorizLight;
|
SBYTE WallHorizLight;
|
||||||
|
|
||||||
|
bool FromSnapshot; // The current map was restored from a snapshot
|
||||||
|
|
||||||
const char *f1;
|
const char *f1;
|
||||||
|
|
||||||
float teamdamage;
|
float teamdamage;
|
||||||
|
|
|
@ -110,7 +110,8 @@ enum
|
||||||
SCRIPT_WhiteReturn = 8,
|
SCRIPT_WhiteReturn = 8,
|
||||||
SCRIPT_Lightning = 12,
|
SCRIPT_Lightning = 12,
|
||||||
SCRIPT_Unloading = 13,
|
SCRIPT_Unloading = 13,
|
||||||
SCRIPT_Disconnect = 14
|
SCRIPT_Disconnect = 14,
|
||||||
|
SCRIPT_Return = 15,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Script flags
|
// Script flags
|
||||||
|
|
Loading…
Reference in a new issue