SRB2/src/m_easing.h

102 lines
2.6 KiB
C
Raw Normal View History

2021-04-19 18:52:07 +00:00
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
2022-03-03 19:24:46 +00:00
// Copyright (C) 2020-2022 by Jaime "Lactozilla" Passos.
2021-04-19 18:52:07 +00:00
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file m_easing.h
/// \brief Easing functions
#ifndef __M_EASING_H__
#define __M_EASING_H__
#include "doomtype.h"
#include "m_fixed.h"
typedef enum
{
EASE_LINEAR = 0,
EASE_INSINE,
EASE_OUTSINE,
EASE_INOUTSINE,
EASE_INQUAD,
EASE_OUTQUAD,
EASE_INOUTQUAD,
EASE_INCUBIC,
EASE_OUTCUBIC,
EASE_INOUTCUBIC,
EASE_INQUART,
EASE_OUTQUART,
EASE_INOUTQUART,
EASE_INQUINT,
EASE_OUTQUINT,
EASE_INOUTQUINT,
EASE_INEXPO,
EASE_OUTEXPO,
EASE_INOUTEXPO,
EASE_INBACK,
EASE_OUTBACK,
EASE_INOUTBACK,
EASE_MAX,
} easing_t;
typedef fixed_t (*easingfunc_t)(fixed_t, fixed_t, fixed_t);
extern easingfunc_t easing_funclist[EASE_MAX];
extern const char *easing_funcnames[EASE_MAX];
#define EASINGFUNCLIST(sep) \
2021-04-20 00:42:00 +00:00
EASINGFUNC(Linear) sep /* Easing_Linear */ \
2021-04-19 18:52:07 +00:00
\
2021-04-20 00:42:00 +00:00
EASINGFUNC(InSine) sep /* Easing_InSine */ \
EASINGFUNC(OutSine) sep /* Easing_OutSine */ \
EASINGFUNC(InOutSine) sep /* Easing_InOutSine */ \
2021-04-19 18:52:07 +00:00
\
2021-04-20 00:42:00 +00:00
EASINGFUNC(InQuad) sep /* Easing_InQuad */ \
EASINGFUNC(OutQuad) sep /* Easing_OutQuad */ \
EASINGFUNC(InOutQuad) sep /* Easing_InOutQuad */ \
2021-04-19 18:52:07 +00:00
\
2021-04-20 00:42:00 +00:00
EASINGFUNC(InCubic) sep /* Easing_InCubic */ \
EASINGFUNC(OutCubic) sep /* Easing_OutCubic */ \
EASINGFUNC(InOutCubic) sep /* Easing_InOutCubic */ \
2021-04-19 18:52:07 +00:00
\
2021-04-20 00:42:00 +00:00
EASINGFUNC(InQuart) sep /* Easing_InQuart */ \
EASINGFUNC(OutQuart) sep /* Easing_OutQuart */ \
EASINGFUNC(InOutQuart) sep /* Easing_InOutQuart */ \
2021-04-19 18:52:07 +00:00
\
2021-04-20 00:42:00 +00:00
EASINGFUNC(InQuint) sep /* Easing_InQuint */ \
EASINGFUNC(OutQuint) sep /* Easing_OutQuint */ \
EASINGFUNC(InOutQuint) sep /* Easing_InOutQuint */ \
2021-04-19 18:52:07 +00:00
\
2021-04-20 00:42:00 +00:00
EASINGFUNC(InExpo) sep /* Easing_InExpo */ \
EASINGFUNC(OutExpo) sep /* Easing_OutExpo */ \
EASINGFUNC(InOutExpo) sep /* Easing_InOutExpo */ \
2021-04-19 18:52:07 +00:00
\
2021-04-20 00:42:00 +00:00
EASINGFUNC(InBack) sep /* Easing_InBack */ \
EASINGFUNC(OutBack) sep /* Easing_OutBack */ \
EASINGFUNC(InOutBack) sep /* Easing_InOutBack */
2021-04-19 18:52:07 +00:00
2021-04-20 00:42:00 +00:00
#define EASINGFUNC(type) fixed_t Easing_ ## type (fixed_t t, fixed_t start, fixed_t end);
2021-04-19 18:52:07 +00:00
EASINGFUNCLIST()
#undef EASINGFUNC
2021-04-20 00:42:00 +00:00
#define EASINGFUNC(type) fixed_t Easing_ ## type (fixed_t t, fixed_t start, fixed_t end, fixed_t param);
2021-04-19 18:52:07 +00:00
2021-04-20 00:42:00 +00:00
EASINGFUNC(InBackParameterized) /* Easing_InBackParameterized */
EASINGFUNC(OutBackParameterized) /* Easing_OutBackParameterized */
EASINGFUNC(InOutBackParameterized) /* Easing_InOutBackParameterized */
#undef EASINGFUNC
2021-04-19 18:52:07 +00:00
#endif