raze/source/games/blood/src/db.h

111 lines
3 KiB
C
Raw Normal View History

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 "mapstructs.h"
BEGIN_BLD_NS
enum
{
kAttrMove = 0x0001, // is affected by movement physics
kAttrGravity = 0x0002, // is affected by gravity
kAttrFalling = 0x0004, // in z motion
kAttrAiming = 0x0008,
kAttrRespawn = 0x0010,
kAttrFree = 0x0020,
kAttrSmoke = 0x0100, // receives tsprite smoke/steam
};
2019-09-19 22:42:45 +00:00
#pragma pack(push, 1)
struct AISTATE;
struct MAPSIGNATURE {
char signature[4];
int16_t version;
2019-09-19 22:42:45 +00:00
};
struct MAPHEADER {
int32_t x; // x
int32_t y; // y
int32_t z; // z
int16_t ang; // ang
int16_t sect; // sect
int16_t pskybits; // pskybits
int32_t visibility; // visibility
int32_t mattid; // song id, Matt
uint8_t parallax; // parallaxtype
int32_t revision; // map revision
int16_t numsectors; // numsectors
int16_t numwalls; // numwalls
int16_t numsprites; // numsprites
2019-09-19 22:42:45 +00:00
};
struct MAPHEADER2 {
2020-11-21 22:40:08 +00:00
char name[64];
int numxsprites; // xsprite size
int numxwalls; // xwall size
int numxsectors; // xsector size
2021-11-16 17:36:34 +00:00
uint8_t pad[52];
2019-09-19 22:42:45 +00:00
};
#pragma pack(pop)
extern bool drawtile2048, encrypted;
2019-09-19 22:42:45 +00:00
extern MAPHEADER2 byte_19AE44;
extern int gVisibility;
extern int gMapRev, gMattId, gSkyCount;
2019-09-19 22:42:45 +00:00
extern const char *gItemText[];
extern const char *gAmmoText[];
extern const char *gWeaponText[];
template<typename T> void GetSpriteExtents(T const * const pSprite, int *top, int *bottom)
{
*top = *bottom = pSprite->z;
if ((pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR)
{
2020-05-24 10:31:38 +00:00
int height = tileHeight(pSprite->picnum);
int center = height / 2 + tileTopOffset(pSprite->picnum);
*top -= (pSprite->yrepeat << 2)*center;
*bottom += (pSprite->yrepeat << 2)*(height - center);
}
}
struct BloodSpawnSpriteDef : public SpawnSpriteDef
{
TArray<XSPRITE> xspr;
};
DBloodActor* InsertSprite(sectortype* pSector, int nStat);
2021-11-28 12:29:59 +00:00
int DeleteSprite(DBloodActor* actor);
2019-09-19 22:42:45 +00:00
unsigned int dbReadMapCRC(const char *pPath);
void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sectortype** pSector, unsigned int* pCRC, BloodSpawnSpriteDef& sprites);
END_BLD_NS