mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 13:01:47 +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
|
||||
- Fixed: Turning off follow mode with automap rotating enabled did not
|
||||
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_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)
|
||||
//
|
||||
|
@ -493,7 +491,7 @@ static void AM_findMinMaxBoundaries ()
|
|||
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;
|
||||
|
||||
|
@ -513,15 +511,17 @@ static void AM_ClipRotatedExtents ()
|
|||
xs[1] = max_x; ys[1] = min_y;
|
||||
xs[2] = max_x; ys[2] = 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)
|
||||
{
|
||||
AM_rotatePoint (&xs[i], &ys[i]);
|
||||
}
|
||||
rmin_x = rmin_y = FIXED_MAX;
|
||||
rmax_x = rmax_y = FIXED_MIN;
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
xs[i] -= pivotx;
|
||||
ys[i] -= pivoty;
|
||||
AM_rotate (&xs[i], &ys[i], ANG90 - players[consoleplayer].camera->angle);
|
||||
xs[i] += pivotx;
|
||||
ys[i] += pivoty;
|
||||
|
||||
if (xs[i] < rmin_x) rmin_x = xs[i];
|
||||
if (xs[i] > rmax_x) rmax_x = xs[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 ()
|
||||
{
|
||||
if (am_rotate)
|
||||
if (0 != (m_paninc.x | m_paninc.y))
|
||||
{
|
||||
m_rotateoffsx -= Scale(m_paninc.x, SCREENWIDTH, 320);
|
||||
m_rotateoffsy -= Scale(m_paninc.y, SCREENHEIGHT, 200);
|
||||
AM_doFollowPlayer();
|
||||
followplayer = 0;
|
||||
f_oldloc.x = FIXED_MAX;
|
||||
}
|
||||
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))
|
||||
{
|
||||
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);
|
||||
AM_rotate(&incx, &incy, players[consoleplayer].camera->angle - ANG90);
|
||||
}
|
||||
|
||||
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.y != players[consoleplayer].camera->y))
|
||||
{
|
||||
m_x = ((players[consoleplayer].camera->x >> FRACTOMAPBITS) + m_rotateoffsx) - m_w/2;
|
||||
m_y = ((players[consoleplayer].camera->y >> FRACTOMAPBITS) + m_rotateoffsy) - m_h/2;
|
||||
m_x = (players[consoleplayer].camera->x >> FRACTOMAPBITS) - m_w/2;
|
||||
m_y = (players[consoleplayer].camera->y >> FRACTOMAPBITS) - m_h/2;
|
||||
m_x2 = m_x + m_w;
|
||||
m_y2 = m_y + m_h;
|
||||
|
||||
|
@ -1097,8 +1096,6 @@ static void AM_ToggleFollowPlayer()
|
|||
{
|
||||
followplayer = !followplayer;
|
||||
f_oldloc.x = FIXED_MAX;
|
||||
m_rotateoffsx = 0;
|
||||
m_rotateoffsy = 0;
|
||||
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)
|
||||
{
|
||||
*x -= players[consoleplayer].camera->x >> FRACTOMAPBITS;
|
||||
*y -= players[consoleplayer].camera->y >> FRACTOMAPBITS;
|
||||
fixed_t pivotx = m_x + m_w/2;
|
||||
fixed_t pivoty = m_y + m_h/2;
|
||||
*x -= pivotx;
|
||||
*y -= pivoty;
|
||||
AM_rotate (x, y, ANG90 - players[consoleplayer].camera->angle);
|
||||
*x += (players[consoleplayer].camera->x >> FRACTOMAPBITS) + m_rotateoffsx;
|
||||
*y += (players[consoleplayer].camera->y >> FRACTOMAPBITS) + m_rotateoffsy;
|
||||
*x += pivotx;
|
||||
*y += pivoty;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1546,26 +1545,37 @@ AM_drawLineCharacter
|
|||
|
||||
void AM_drawPlayers ()
|
||||
{
|
||||
mpoint_t pt;
|
||||
angle_t angle;
|
||||
int i;
|
||||
|
||||
if (!multiplayer)
|
||||
{
|
||||
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
|
||||
angle = ANG90;
|
||||
else
|
||||
angle = players[consoleplayer].camera->angle;
|
||||
mline_t *arrow;
|
||||
int numarrowlines;
|
||||
|
||||
if (am_cheat != 0)
|
||||
AM_drawLineCharacter
|
||||
(cheat_player_arrow, NUMCHEATPLYRLINES, 0,
|
||||
angle, YourColor, (players[consoleplayer].camera->x >> FRACTOMAPBITS) + m_rotateoffsx,
|
||||
(players[consoleplayer].camera->y >> FRACTOMAPBITS) + m_rotateoffsy);
|
||||
pt.x = players[consoleplayer].camera->x >> FRACTOMAPBITS;
|
||||
pt.y = players[consoleplayer].camera->y >> FRACTOMAPBITS;
|
||||
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
|
||||
{
|
||||
angle = ANG90;
|
||||
AM_rotatePoint (&pt.x, &pt.y);
|
||||
}
|
||||
else
|
||||
AM_drawLineCharacter
|
||||
(player_arrow, NUMPLYRLINES, 0, angle,
|
||||
YourColor, (players[consoleplayer].camera->x >> FRACTOMAPBITS) + m_rotateoffsx,
|
||||
(players[consoleplayer].camera->y >> FRACTOMAPBITS) + m_rotateoffsy);
|
||||
{
|
||||
angle = players[consoleplayer].camera->angle;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1573,7 +1583,6 @@ void AM_drawPlayers ()
|
|||
{
|
||||
player_t *p = &players[i];
|
||||
AMColor color;
|
||||
mpoint_t pt;
|
||||
|
||||
if (!playeringame[i] || p->mo == NULL)
|
||||
{
|
||||
|
|
|
@ -2311,6 +2311,10 @@ void G_FinishTravel ()
|
|||
inv->LinkToWorld ();
|
||||
inv->Travelled ();
|
||||
}
|
||||
if (level.FromSnapshot)
|
||||
{
|
||||
FBehavior::StaticStartTypedScripts (SCRIPT_Return, pawn, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2340,6 +2344,7 @@ void G_InitLevelLocals ()
|
|||
level.fadeto = info->fadeto;
|
||||
level.cdtrack = info->cdtrack;
|
||||
level.cdid = info->cdid;
|
||||
level.FromSnapshot = false;
|
||||
if (level.fadeto == 0)
|
||||
{
|
||||
R_SetDefaultColormap (info->fadetable);
|
||||
|
@ -2828,6 +2833,7 @@ void G_UnSnapshotLevel (bool hubLoad)
|
|||
arc.SetHubTravel ();
|
||||
G_SerializeLevel (arc, hubLoad);
|
||||
arc.Close ();
|
||||
level.FromSnapshot = true;
|
||||
|
||||
TThinkerIterator<APlayerPawn> it;
|
||||
APlayerPawn *pawn, *next;
|
||||
|
|
|
@ -249,6 +249,8 @@ struct level_locals_s
|
|||
SBYTE WallVertLight; // Light diffs for vert/horiz walls
|
||||
SBYTE WallHorizLight;
|
||||
|
||||
bool FromSnapshot; // The current map was restored from a snapshot
|
||||
|
||||
const char *f1;
|
||||
|
||||
float teamdamage;
|
||||
|
|
|
@ -110,7 +110,8 @@ enum
|
|||
SCRIPT_WhiteReturn = 8,
|
||||
SCRIPT_Lightning = 12,
|
||||
SCRIPT_Unloading = 13,
|
||||
SCRIPT_Disconnect = 14
|
||||
SCRIPT_Disconnect = 14,
|
||||
SCRIPT_Return = 15,
|
||||
};
|
||||
|
||||
// Script flags
|
||||
|
|
Loading…
Reference in a new issue