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

108 lines
2.8 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
2021-12-29 19:45:55 +00:00
};
2019-09-19 22:42:45 +00:00
#pragma pack(push, 1)
struct AISTATE;
struct MAPSIGNATURE {
2021-12-29 19:45:55 +00:00
char signature[4];
int16_t version;
2019-09-19 22:42:45 +00:00
};
2021-12-29 19:45:55 +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 {
2021-12-29 19:45:55 +00:00
char name[64];
int numxsprites; // xsprite size
int numxwalls; // xwall size
int numxsectors; // xsector size
uint8_t pad[52];
2019-09-19 22:42:45 +00:00
};
#pragma pack(pop)
extern int gVisibility;
2021-12-29 19:45:55 +00:00
extern const char* gItemText[];
extern const char* gAmmoText[];
extern const char* gWeaponText[];
extern int gSkyCount;
2019-09-19 22:42:45 +00:00
2021-12-29 19:45:55 +00:00
void GetSpriteExtents(spritetypebase const* const pSprite, int* top, int* bottom)
{
2022-02-02 17:59:37 +00:00
*top = *bottom = pSprite->__int_pos.Z;
2021-12-29 19:45:55 +00:00
if ((pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR)
{
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
{
2021-12-29 19:45:55 +00:00
TArray<XSPRITE> xspr;
};
DBloodActor* InsertSprite(sectortype* pSector, int nStat);
2021-11-28 12:29:59 +00:00
int DeleteSprite(DBloodActor* actor);
2021-12-29 19:45:55 +00:00
unsigned int dbReadMapCRC(const char* pPath);
void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int* pSector, unsigned int* pCRC, BloodSpawnSpriteDef& sprites);
END_BLD_NS