raze/source/games/blood/src/seq.h
Christoph Oelckers a6db974a62 - refactored Blood's tile property arrays to texture IDs.
The data structure here can be optimized later when the other games get to the same point, but this allows to rid Blood of all references to wallpicnunm, floorpicnum and ceilingpicnum except one place in the precacher.
2022-12-11 19:44:00 +01:00

123 lines
3.1 KiB
C++

//-------------------------------------------------------------------------
/*
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 "misc.h"
BEGIN_BLD_NS
struct SEQFRAME
{
unsigned int tile : 12;
unsigned int transparent : 1;
unsigned int transparent2 : 1;
unsigned int blockable : 1;
unsigned int hittable : 1;
unsigned int scalex : 8;
unsigned int scaley : 8;
signed int shade : 8;
unsigned int palette : 5;
unsigned int trigger : 1;
unsigned int smoke : 1;
unsigned int aiming : 1;
unsigned int pushable : 1;
unsigned int playsound : 1;
unsigned int invisible : 1;// invisible
unsigned int flipx : 1;
unsigned int flipy : 1;
unsigned int tile2 : 4;
unsigned soundRange : 4; // (by NoOne) random sound range relative to global SEQ sound
unsigned surfaceSound : 1; // (by NoOne) trigger surface sound when moving / touching
unsigned reserved : 2;
};
struct Seq {
char signature[4];
int16_t version;
int16_t nFrames;
int16_t ticksPerFrame;
int16_t soundId;
int flags;
SEQFRAME frames[1];
void Precache(int palette);
bool isLooping()
{
return (flags & 1) != 0;
}
bool isRemovable()
{
return (flags & 2) != 0;
}
};
class DBloodActor;
struct SEQINST
{
Seq* pSequence;
EventObject target;
int type;
int nSeqID;
int callback;
int16_t timeCounter;
uint8_t frameIndex;
void Update();
};
inline int seqGetTile(SEQFRAME* pFrame)
{
return pFrame->tile + (pFrame->tile2 << 12);
}
inline FTextureID seqGetTexture(SEQFRAME* pFrame)
{
return tileGetTextureID(pFrame->tile + (pFrame->tile2 << 12));
}
int seqRegisterClient(void(*pClient)(int, int));
void seqPrecacheId(int id, int palette);
SEQINST* GetInstance(int a1, EventObject& a2);
SEQINST* GetInstance(DBloodActor* actor);
void UnlockInstance(SEQINST* pInst);
void seqSpawn(int a1, int ty, walltype* a2, int a4 = -1);
void seqSpawn(int a1, int ty, sectortype* a2, int a4 = -1);
void seqSpawn(int a1, DBloodActor* actor, int a4 = -1);
void seqKill(int a1, walltype* a2);
void seqKill(int a1, sectortype* a2);
void seqKill(DBloodActor* actor);
void seqKillAll(void);
int seqGetStatus(int a1, walltype* a2);
int seqGetStatus(int a1, sectortype* a2);
int seqGetStatus(DBloodActor*);
int seqGetID(int a1, walltype* a2);
int seqGetID(int a1, sectortype* a2);
int seqGetID(DBloodActor*);
void seqProcess(int a1);
Seq* getSequence(int res_id);
END_BLD_NS