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
|
|
|
|
|
2020-09-08 17:18:11 +00:00
|
|
|
#include "misc.h"
|
2019-09-22 06:39:22 +00:00
|
|
|
BEGIN_BLD_NS
|
|
|
|
|
2020-07-25 20:47:46 +00:00
|
|
|
|
2020-11-21 17:12:51 +00:00
|
|
|
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 {
|
2020-11-21 17:12:51 +00:00
|
|
|
char signature[4];
|
2021-11-16 17:15:56 +00:00
|
|
|
int16_t version;
|
|
|
|
int16_t nFrames;
|
|
|
|
int16_t ticksPerFrame;
|
|
|
|
int16_t soundId;
|
2020-11-21 17:12:51 +00:00
|
|
|
int flags;
|
|
|
|
SEQFRAME frames[1];
|
2021-04-11 10:42:59 +00:00
|
|
|
void Precache(int palette);
|
2020-11-21 17:12:51 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
{
|
2020-11-21 17:12:51 +00:00
|
|
|
Seq* pSequence;
|
2021-11-23 19:38:41 +00:00
|
|
|
EventObject target;
|
|
|
|
int type;
|
2020-11-21 17:12:51 +00:00
|
|
|
|
|
|
|
int nSeqID;
|
|
|
|
int callback;
|
2021-11-19 19:50:02 +00:00
|
|
|
int16_t timeCounter;
|
2021-04-17 08:14:03 +00:00
|
|
|
uint8_t frameIndex;
|
2020-11-21 17:12:51 +00:00
|
|
|
void Update();
|
2019-09-19 22:42:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
inline int seqGetTile(SEQFRAME* pFrame)
|
|
|
|
{
|
2020-11-21 17:12:51 +00:00
|
|
|
return pFrame->tile + (pFrame->tile2 << 12);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int seqRegisterClient(void(*pClient)(int, int));
|
2021-04-11 10:42:59 +00:00
|
|
|
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);
|
2020-11-21 17:12:51 +00:00
|
|
|
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);
|
2020-12-02 21:33:14 +00:00
|
|
|
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);
|
2020-12-02 23:00:03 +00:00
|
|
|
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);
|
2020-12-05 15:23:01 +00:00
|
|
|
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*);
|
2019-09-22 06:39:22 +00:00
|
|
|
void seqProcess(int a1);
|
|
|
|
|
2020-07-25 20:47:46 +00:00
|
|
|
Seq* getSequence(int res_id);
|
|
|
|
|
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
END_BLD_NS
|