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

113 lines
2.6 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];
short version;
short nFrames;
short ticksPerFrame;
short soundId;
int flags;
SEQFRAME frames[1];
void Precache(HitList&);
bool isLooping()
{
return (flags & 1) != 0;
}
bool isRemovable()
{
return (flags & 2) != 0;
}
2019-09-19 22:42:45 +00:00
};
struct ACTIVE
{
unsigned char type;
unsigned short xindex;
2019-09-19 22:42:45 +00:00
};
struct SEQINST
{
Seq* pSequence;
int index, type;
int nSeqID;
int callback;
short timeCounter;
unsigned char 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, HitList& hits);
SEQINST* GetInstance(int a1, int a2);
void UnlockInstance(SEQINST* pInst);
2019-09-19 22:42:45 +00:00
void seqSpawn(int a1, int a2, int a3, int a4 = -1);
void seqKill(int a1, int a2);
void seqKillAll(void);
int seqGetStatus(int a1, int a2);
int seqGetID(int a1, int a2);
void seqProcess(int a1);
Seq* getSequence(int res_id);
END_BLD_NS