mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-18 16:31:50 +00:00
105 lines
2.5 KiB
C++
105 lines
2.5 KiB
C++
/*
|
|
** Handling drawing a player sprite
|
|
** Copyright (c) 2016 Magnus Norddahl
|
|
**
|
|
** This software is provided 'as-is', without any express or implied
|
|
** warranty. In no event will the authors be held liable for any damages
|
|
** arising from the use of this software.
|
|
**
|
|
** Permission is granted to anyone to use this software for any purpose,
|
|
** including commercial applications, and to alter it and redistribute it
|
|
** freely, subject to the following restrictions:
|
|
**
|
|
** 1. The origin of this software must not be misrepresented; you must not
|
|
** claim that you wrote the original software. If you use this software
|
|
** in a product, an acknowledgment in the product documentation would be
|
|
** appreciated but is not required.
|
|
** 2. Altered source versions must be plainly marked as such, and must not be
|
|
** misrepresented as being the original software.
|
|
** 3. This notice may not be removed or altered from any source distribution.
|
|
**
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "r_defs.h"
|
|
|
|
class DPSprite;
|
|
struct FDynamicColormap;
|
|
|
|
class PolyColormapLight
|
|
{
|
|
public:
|
|
int ColormapNum = 0;
|
|
FSWColormap *BaseColormap = nullptr;
|
|
|
|
void SetColormap(double visibility, int shade, FDynamicColormap *basecolormap, bool fullbright, bool invertColormap, bool fadeToBlack);
|
|
};
|
|
|
|
class PolyNoAccelPlayerSprite
|
|
{
|
|
public:
|
|
short x1 = 0;
|
|
short x2 = 0;
|
|
|
|
double texturemid = 0.0;
|
|
|
|
fixed_t xscale = 0;
|
|
float yscale = 0.0f;
|
|
|
|
FTexture *pic = nullptr;
|
|
|
|
fixed_t xiscale = 0;
|
|
fixed_t startfrac = 0;
|
|
|
|
float Alpha = 0.0f;
|
|
FRenderStyle RenderStyle;
|
|
uint32_t Translation = 0;
|
|
uint32_t FillColor = 0;
|
|
|
|
PolyColormapLight Light;
|
|
|
|
short renderflags = 0;
|
|
|
|
void Render();
|
|
};
|
|
|
|
class PolyHWAccelPlayerSprite
|
|
{
|
|
public:
|
|
FTexture *pic = nullptr;
|
|
double texturemid = 0.0;
|
|
float yscale = 0.0f;
|
|
fixed_t xscale = 0;
|
|
|
|
float Alpha = 0.0f;
|
|
FRenderStyle RenderStyle;
|
|
uint32_t Translation = 0;
|
|
uint32_t FillColor = 0;
|
|
|
|
FDynamicColormap *basecolormap = nullptr;
|
|
int x1 = 0;
|
|
|
|
bool flip = false;
|
|
FSpecialColormap *special = nullptr;
|
|
PalEntry overlay = 0;
|
|
FColormapStyle colormapstyle;
|
|
bool usecolormapstyle = false;
|
|
};
|
|
|
|
class RenderPolyPlayerSprites
|
|
{
|
|
public:
|
|
void Render();
|
|
void RenderRemainingSprites();
|
|
|
|
private:
|
|
void RenderSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double wx, double wy, double ticfrac, int spriteshade, FDynamicColormap *basecolormap, bool foggy);
|
|
static fixed_t LightLevelToShade(int lightlevel, bool foggy);
|
|
|
|
enum { BASEXCENTER = 160 };
|
|
enum { BASEYCENTER = 100 };
|
|
|
|
TArray<PolyHWAccelPlayerSprite> AcceleratedSprites;
|
|
sector_t tempsec;
|
|
};
|