2019-09-19 22:42:45 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 Nuke.YKT
|
|
|
|
|
|
|
|
This file is part of NBlood.
|
|
|
|
|
|
|
|
NBlood is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "build.h"
|
|
|
|
#include "common_game.h"
|
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
BEGIN_BLD_NS
|
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
struct HITINFO {
|
2021-05-05 14:43:42 +00:00
|
|
|
DBloodActor* hitactor;
|
2021-11-23 16:00:00 +00:00
|
|
|
sectortype* hitSect;
|
|
|
|
walltype* hitWall;
|
2019-09-19 22:42:45 +00:00
|
|
|
int hitx;
|
|
|
|
int hity;
|
|
|
|
int hitz;
|
2021-05-05 14:43:42 +00:00
|
|
|
|
|
|
|
void clearObj()
|
|
|
|
{
|
2021-11-23 16:00:00 +00:00
|
|
|
hitSect = nullptr;
|
|
|
|
hitWall = nullptr;
|
2021-05-05 14:43:42 +00:00
|
|
|
hitactor = nullptr;
|
|
|
|
}
|
|
|
|
void set(hitdata_t* hit);
|
2019-09-19 22:42:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern HITINFO gHitInfo;
|
|
|
|
|
2019-09-07 13:53:42 +00:00
|
|
|
enum {
|
|
|
|
PARALLAXCLIP_CEILING = 1,
|
|
|
|
PARALLAXCLIP_FLOOR = 2,
|
|
|
|
};
|
|
|
|
|
2019-11-08 19:57:01 +00:00
|
|
|
|
2021-09-02 18:23:51 +00:00
|
|
|
struct Collision;
|
2019-09-19 22:42:45 +00:00
|
|
|
bool FindSector(int nX, int nY, int nZ, int *nSector);
|
2021-11-23 23:16:02 +00:00
|
|
|
inline bool FindSector(int nX, int nY, int nZ, sectortype** ppSector)
|
|
|
|
{
|
|
|
|
int n = sectnum(*ppSector);
|
|
|
|
bool res = FindSector(nX, nY, nZ, &n);
|
|
|
|
*ppSector = §or[n];
|
|
|
|
return res;
|
|
|
|
}
|
2019-09-19 22:42:45 +00:00
|
|
|
bool FindSector(int nX, int nY, int *nSector);
|
2021-11-23 23:16:02 +00:00
|
|
|
inline bool FindSector(int nX, int nY, sectortype** ppSector)
|
|
|
|
{
|
|
|
|
int n = sectnum(*ppSector);
|
|
|
|
bool res = FindSector(nX, nY, &n);
|
|
|
|
*ppSector = §or[n];
|
|
|
|
return res;
|
|
|
|
}
|
2021-09-04 18:01:28 +00:00
|
|
|
bool CheckProximity(DBloodActor *pSprite, int nX, int nY, int nZ, int nSector, int nDist);
|
2019-09-19 22:42:45 +00:00
|
|
|
bool CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, int nDist);
|
2021-11-23 22:04:21 +00:00
|
|
|
bool CheckProximityWall(walltype* pWall, int x, int y, int nDist);
|
2020-12-03 17:00:07 +00:00
|
|
|
int GetWallAngle(walltype* pWall);
|
2021-11-21 08:45:50 +00:00
|
|
|
void GetWallNormal(walltype* pWall, int *pX, int *pY);
|
2019-09-19 22:42:45 +00:00
|
|
|
bool IntersectRay(int wx, int wy, int wdx, int wdy, int x1, int y1, int z1, int x2, int y2, int z2, int *ix, int *iy, int *iz);
|
2021-09-04 18:09:56 +00:00
|
|
|
int HitScan(DBloodActor *pSprite, int z, int dx, int dy, int dz, unsigned int nMask, int a8);
|
2021-09-04 18:12:05 +00:00
|
|
|
int VectorScan(DBloodActor *pSprite, int nOffset, int nZOffset, int dx, int dy, int dz, int nRange, int ac);
|
2021-09-04 18:19:38 +00:00
|
|
|
void GetZRange(DBloodActor *pSprite, int *ceilZ, Collision *ceilHit, int *floorZ, Collision *floorHit, int nDist, unsigned int nMask, unsigned int nClipParallax = 0);
|
2021-11-23 23:21:08 +00:00
|
|
|
void GetZRangeAtXYZ(int x, int y, int z, sectortype* pSector, int *ceilZ, Collision *ceilHit, int *floorZ, Collision *floorHit, int nDist, unsigned int nMask, unsigned int nClipParallax = 0);
|
2019-09-19 22:42:45 +00:00
|
|
|
int GetDistToLine(int x1, int y1, int x2, int y2, int x3, int y3);
|
2021-11-23 23:16:02 +00:00
|
|
|
unsigned int ClipMove(vec3_t* pos, sectortype** pSector, int xv, int yv, int wd, int cd, int fd, unsigned int nMask, int tracecount = 3);
|
2021-11-23 16:10:04 +00:00
|
|
|
BitArray GetClosestSpriteSectors(int nSector, int x, int y, int nDist, TArray<walltype*>* pWalls, bool newSectCheckMethod = false);
|
2021-11-16 17:24:01 +00:00
|
|
|
int picWidth(int nPic, int repeat);
|
|
|
|
int picHeight(int nPic, int repeat);
|
2020-02-07 19:47:43 +00:00
|
|
|
|
2021-11-23 23:04:56 +00:00
|
|
|
inline bool CheckSector(const BitArray& bits, spritetype* spr)
|
|
|
|
{
|
|
|
|
return bits[spr->sectnum];
|
|
|
|
}
|
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
|
|
|
|
END_BLD_NS
|