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

119 lines
2.9 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 "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 xrepeat : 8;
unsigned int yrepeat : 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;
2019-09-19 22:42:45 +00:00
};
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;
}
2019-09-19 22:42:45 +00:00
};
2021-09-04 21:27:21 +00:00
class DBloodActor;
2019-09-19 22:42:45 +00:00
struct SEQINST
{
Seq* pSequence;
2021-11-23 19:38:41 +00:00
EventObject target;
int type;
int nSeqID;
int callback;
int16_t timeCounter;
uint8_t frameIndex;
void Update();
2019-09-19 22:42:45 +00:00
};
inline int seqGetTile(SEQFRAME* pFrame)
{
return pFrame->tile + (pFrame->tile2 << 12);
2019-09-19 22:42:45 +00:00
}
int seqRegisterClient(void(*pClient)(int, int));
void seqPrecacheId(int id, int palette);
2021-11-23 19:38:41 +00:00
SEQINST* GetInstance(int a1, EventObject& a2);
2020-12-03 19:30:30 +00:00
SEQINST* GetInstance(DBloodActor* actor);
void UnlockInstance(SEQINST* pInst);
2021-11-23 19:38:41 +00:00
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);
2021-11-23 19:38:41 +00:00
void seqKill(int a1, walltype* a2);
void seqKill(int a1, sectortype* a2);
void seqKill(DBloodActor* actor);
2019-09-19 22:42:45 +00:00
void seqKillAll(void);
2021-11-23 19:38:41 +00:00
int seqGetStatus(int a1, walltype* a2);
int seqGetStatus(int a1, sectortype* a2);
int seqGetStatus(DBloodActor*);
2021-11-23 19:38:41 +00:00
int seqGetID(int a1, walltype* a2);
int seqGetID(int a1, sectortype* a2);
2021-10-13 21:56:03 +00:00
int seqGetID(DBloodActor*);
void seqProcess(int a1);
Seq* getSequence(int res_id);
END_BLD_NS