- VC++ doesn't seem to like the TArray serializer so I added a workaround
to be able to save the 3dMidtex attachment info. - Fixed: The TArray serializer needs to be declared as a friend of TArray in order to be able to access its fields. - Since there are no backwards compatibility issues due to savegame version bumping I closed all gaps in the level flag set. - Bumped min. Savegame version and Netgame version for 3dMidtex related changes. - Changed Jump and Crouch DMFlags into 3-way switches: 0: map default, 1: off, 2: on. Since I needed new bits the rest of the DMFlag bit values had to be changed as a result. - fixed: PTR_SlideTraverse didn't check ML_BLOCKMONSTERS for sliding actors without MF3_NOBLOCKMONST. - Added MAPINFO commands 'checkswitchrange' and 'nocheckswitchrange' that can enable or disable switch range checking globally per map. - Changed ML_3DMIDTEX to force ML_CHECKSWITCHRANGE. - Added a ML_CHECKSWITCHRANGE flag which allows checking whether the player can actually reach the switch he wants to use. - Made DActiveButton::EWhere global so that I can use it outside thr DActiveButton class. March 17, 2008 (Changes by Graf Zahl) - Changed P_LineOpening to pass its result in a struct instead of global variables. - Added Eternity's 3DMIDTEX feature (no Eternity code used though.) It should be feature complete with the exception of the ML_BLOCKMONSTERS flag handling. That particular part of Eternity's implementation is sub-optimal because it hijacks an existing flag and doesn't seem to make much sense to me. Maybe I'll implement it as a separate flag later. SVN r810 (trunk)
This commit is contained in:
parent
3720f7fa7d
commit
7c87465d35
30 changed files with 2361 additions and 5243 deletions
|
|
@ -37,6 +37,7 @@
|
|||
#include "doomdef.h"
|
||||
#include "p_local.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "p_3dmidtex.h"
|
||||
#include "m_random.h"
|
||||
#include "g_game.h"
|
||||
#include "s_sound.h"
|
||||
|
|
@ -488,30 +489,88 @@ static int TryFindSwitch (SWORD texture)
|
|||
return -1;
|
||||
}
|
||||
|
||||
//
|
||||
// Checks whether a switch is reachable
|
||||
// This is optional because old maps can rely on being able to
|
||||
// use non-reachable switches.
|
||||
//
|
||||
bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
|
||||
{
|
||||
fixed_t checktop;
|
||||
fixed_t checkbot;
|
||||
side_t *side = &sides[line->sidenum[sideno]];
|
||||
sector_t *front = sides[line->sidenum[sideno]].sector;
|
||||
sector_t *back = sides[line->sidenum[1-sideno]].sector;
|
||||
FLineOpening open;
|
||||
|
||||
// 3DMIDTEX forces CHECKSWITCHRANGE because otherwise it might cause problems.
|
||||
if (!(line->flags & (ML_3DMIDTEX|ML_CHECKSWITCHRANGE))) return true;
|
||||
|
||||
// calculate the point where the user would touch the wall.
|
||||
divline_t dll, dlu;
|
||||
fixed_t inter, checkx, checky;
|
||||
|
||||
P_MakeDivline (line, &dll);
|
||||
|
||||
dlu.x = user->x;
|
||||
dlu.y = user->y;
|
||||
dlu.dx = finecosine[user->angle >> ANGLETOFINESHIFT];
|
||||
dlu.dy = finesine[user->angle >> ANGLETOFINESHIFT];
|
||||
inter = P_InterceptVector(&dll, &dlu);
|
||||
|
||||
checkx = dll.x + FixedMul(dll.dx, inter);
|
||||
checky = dll.y + FixedMul(dll.dy, inter);
|
||||
|
||||
// Now get the information from the line.
|
||||
P_LineOpening(open, NULL, line, checkx, checky, user->x, user->y);
|
||||
if (open.range <= 0) return true;
|
||||
|
||||
if ((TryFindSwitch (side->toptexture)) != -1)
|
||||
{
|
||||
return (user->z + user->height >= open.top);
|
||||
}
|
||||
else if ((TryFindSwitch (side->bottomtexture)) != -1)
|
||||
{
|
||||
return (user->z <= open.bottom);
|
||||
}
|
||||
else if ((line->flags & (ML_3DMIDTEX)) || (TryFindSwitch (side->midtexture)) != -1)
|
||||
{
|
||||
// 3DMIDTEX lines will force a mid texture check if no switch is found on this line
|
||||
// to keep compatibility with Eternity's implementation.
|
||||
if (!P_GetMidTexturePosition(line, sideno, &checktop, &checkbot)) return false;
|
||||
return user->z < checktop || user->z + user->height > checkbot;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no switch found. Check whether the player can touch either top or bottom texture
|
||||
return (user->z + user->height >= open.top) || (user->z <= open.bottom);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Function that changes wall texture.
|
||||
// Tell it if switch is ok to use again (1=yes, it's a button).
|
||||
//
|
||||
bool P_ChangeSwitchTexture (side_t *side, int useAgain, BYTE special, bool *quest)
|
||||
{
|
||||
DActiveButton::EWhere where;
|
||||
DActiveButton::EWhere Where;
|
||||
int *texture;
|
||||
int i, sound;
|
||||
|
||||
if ((i = TryFindSwitch (side->toptexture)) != -1)
|
||||
{
|
||||
texture = &side->toptexture;
|
||||
where = DActiveButton::BUTTON_Top;
|
||||
Where = DActiveButton::BUTTON_Top;
|
||||
}
|
||||
else if ((i = TryFindSwitch (side->bottomtexture)) != -1)
|
||||
{
|
||||
texture = &side->bottomtexture;
|
||||
where = DActiveButton::BUTTON_Bottom;
|
||||
Where = DActiveButton::BUTTON_Bottom;
|
||||
}
|
||||
else if ((i = TryFindSwitch (side->midtexture)) != -1)
|
||||
{
|
||||
texture = &side->midtexture;
|
||||
where = DActiveButton::BUTTON_Middle;
|
||||
Where = DActiveButton::BUTTON_Middle;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -549,7 +608,7 @@ bool P_ChangeSwitchTexture (side_t *side, int useAgain, BYTE special, bool *ques
|
|||
pt[1] = line->v1->y + (line->dy >> 1);
|
||||
*texture = SwitchList[i]->u.Textures[SwitchList[i]->NumFrames*2];
|
||||
if (useAgain || SwitchList[i]->NumFrames > 1)
|
||||
playsound = P_StartButton (side, where, i, pt[0], pt[1], !!useAgain);
|
||||
playsound = P_StartButton (side, Where, i, pt[0], pt[1], !!useAgain);
|
||||
else
|
||||
playsound = true;
|
||||
if (playsound) S_SoundID (pt, CHAN_VOICE|CHAN_LISTENERZ|CHAN_IMMOBILE, sound, 1, ATTN_STATIC);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue