2020-08-02 17:00:32 +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.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
#include "ns.h" // Must come before everything else!
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "build.h"
|
|
|
|
#include "v_font.h"
|
|
|
|
|
2020-12-09 14:56:32 +00:00
|
|
|
#include "blood.h"
|
|
|
|
|
2020-08-02 17:00:32 +00:00
|
|
|
#include "zstring.h"
|
2020-10-04 16:31:48 +00:00
|
|
|
#include "razemenu.h"
|
2020-08-02 17:00:32 +00:00
|
|
|
#include "gstrings.h"
|
|
|
|
#include "v_2ddrawer.h"
|
|
|
|
#include "v_video.h"
|
2021-04-11 06:40:18 +00:00
|
|
|
#include "gamehud.h"
|
2020-08-02 17:00:32 +00:00
|
|
|
|
|
|
|
BEGIN_BLD_NS
|
|
|
|
|
|
|
|
|
|
|
|
static struct {
|
2021-11-16 17:15:56 +00:00
|
|
|
int16_t nTile;
|
2021-04-17 08:14:03 +00:00
|
|
|
uint8_t nStat;
|
|
|
|
uint8_t nPal;
|
2020-08-02 17:00:32 +00:00
|
|
|
int nScale;
|
2021-11-16 17:15:56 +00:00
|
|
|
int16_t nX, nY;
|
2020-08-02 17:00:32 +00:00
|
|
|
} burnTable[9] = {
|
|
|
|
{ 2101, 2, 0, 118784, 10, 220 },
|
|
|
|
{ 2101, 2, 0, 110592, 40, 220 },
|
|
|
|
{ 2101, 2, 0, 81920, 85, 220 },
|
|
|
|
{ 2101, 2, 0, 69632, 120, 220 },
|
|
|
|
{ 2101, 2, 0, 61440, 160, 220 },
|
|
|
|
{ 2101, 2, 0, 73728, 200, 220 },
|
|
|
|
{ 2101, 2, 0, 77824, 235, 220 },
|
|
|
|
{ 2101, 2, 0, 110592, 275, 220 },
|
|
|
|
{ 2101, 2, 0, 122880, 310, 220 }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-12-29 19:45:55 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-02 17:00:32 +00:00
|
|
|
static void drawElement(int x, int y, int tile, double scale = 1, int flipx = 0, int flipy = 0, int pin = 0, int basepal = 0, double alpha = 1)
|
|
|
|
{
|
2020-08-14 19:01:27 +00:00
|
|
|
int flags = RS_TOPLEFT;
|
|
|
|
if (flipx) flags |= RS_XFLIPHUD;
|
|
|
|
if (flipy) flags |= RS_YFLIPHUD;
|
|
|
|
if (pin == -1) flags |= RS_ALIGN_L;
|
|
|
|
else if (pin == 1) flags |= RS_ALIGN_R;
|
2021-12-29 19:45:55 +00:00
|
|
|
hud_drawsprite(x, y, int(scale * 65536), 0, tile, 0, basepal, flags, alpha);
|
2020-08-02 17:00:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-29 19:45:55 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-02 17:00:32 +00:00
|
|
|
static void viewBurnTime(int gScale)
|
|
|
|
{
|
|
|
|
if (!gScale) return;
|
|
|
|
|
|
|
|
for (int i = 0; i < 9; i++)
|
|
|
|
{
|
2022-08-05 16:47:35 +00:00
|
|
|
int nTile = burnTable[i].nTile + tileAnimateOfs(burnTable[i].nTile, i);
|
2020-08-02 17:00:32 +00:00
|
|
|
int nScale = burnTable[i].nScale;
|
|
|
|
if (gScale < 600)
|
|
|
|
{
|
2021-12-30 07:32:06 +00:00
|
|
|
nScale = Scale(nScale, gScale, 600);
|
2020-08-02 17:00:32 +00:00
|
|
|
}
|
2022-05-05 22:34:47 +00:00
|
|
|
hud_drawsprite(burnTable[i].nX, burnTable[i].nY, nScale, 0, nTile, 0, 0, RS_STRETCH, 1);
|
2020-08-02 17:00:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-29 19:45:55 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-08-02 17:00:32 +00:00
|
|
|
|
2021-12-29 19:45:55 +00:00
|
|
|
void hudDraw(PLAYER* gView, sectortype* pSector, double bobx, double boby, double zDelta, int basepal, double smoothratio)
|
2020-08-02 17:00:32 +00:00
|
|
|
{
|
2021-04-20 11:12:17 +00:00
|
|
|
double look_anghalf = gView->angle.look_anghalf(smoothratio);
|
2020-09-25 07:52:00 +00:00
|
|
|
|
2020-08-02 17:00:32 +00:00
|
|
|
if (gViewPos == 0)
|
|
|
|
{
|
2021-04-20 11:12:17 +00:00
|
|
|
double looking_arc = gView->angle.looking_arc(smoothratio);
|
2020-09-05 11:57:26 +00:00
|
|
|
|
2020-09-21 07:00:07 +00:00
|
|
|
double cX = 160 - look_anghalf;
|
|
|
|
double cY = 220 + looking_arc;
|
2020-08-10 12:08:36 +00:00
|
|
|
if (cl_weaponsway)
|
|
|
|
{
|
2021-04-15 03:35:42 +00:00
|
|
|
if (cl_hudinterpolation)
|
|
|
|
{
|
|
|
|
cX += (bobx / 256.);
|
|
|
|
cY += (boby / 256.) + (zDelta / 128.);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cX += (int(bobx) >> 8);
|
|
|
|
cY += (int(boby) >> 8) + (int(zDelta) >> 7);
|
|
|
|
}
|
2020-08-10 22:40:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cY += (-2048. / 128.);
|
2020-08-10 12:08:36 +00:00
|
|
|
}
|
2022-10-02 07:52:13 +00:00
|
|
|
int nShade = pSector? pSector->floorshade : 0;
|
2020-08-02 17:00:32 +00:00
|
|
|
int nPalette = 0;
|
2021-12-30 15:51:56 +00:00
|
|
|
if (gView->actor->sector()->hasX()) {
|
|
|
|
sectortype* pViewSect = gView->actor->sector();
|
2021-12-24 09:25:18 +00:00
|
|
|
XSECTOR* pXSector = &pViewSect->xs();
|
2020-08-02 17:00:32 +00:00
|
|
|
if (pXSector->color)
|
2021-12-24 09:25:18 +00:00
|
|
|
nPalette = pViewSect->floorpal;
|
2020-08-02 17:00:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NOONE_EXTENSIONS
|
2021-08-05 02:38:26 +00:00
|
|
|
if (gView->sceneQav < 0) WeaponDraw(gView, nShade, cX, cY, nPalette);
|
2021-12-23 13:14:28 +00:00
|
|
|
else if (gView->actor->xspr.health > 0) playerQavSceneDraw(gView, nShade, cX, cY, nPalette);
|
2020-08-02 17:00:32 +00:00
|
|
|
else {
|
2021-08-03 10:34:08 +00:00
|
|
|
gView->sceneQav = gView->weaponQav = kQAVNone;
|
2021-08-05 02:38:26 +00:00
|
|
|
gView->qavTimer = gView->weaponTimer = gView->curWeapon = 0;
|
2020-08-02 17:00:32 +00:00
|
|
|
}
|
|
|
|
#else
|
2021-08-05 02:38:26 +00:00
|
|
|
WeaponDraw(gView, nShade, cX, cY, nPalette);
|
2020-08-02 17:00:32 +00:00
|
|
|
#endif
|
|
|
|
}
|
2021-12-23 13:14:28 +00:00
|
|
|
if (gViewPos == 0 && gView->actor->xspr.burnTime > 60)
|
2020-08-02 17:00:32 +00:00
|
|
|
{
|
2021-12-23 13:14:28 +00:00
|
|
|
viewBurnTime(gView->actor->xspr.burnTime);
|
2020-08-02 17:00:32 +00:00
|
|
|
}
|
|
|
|
if (packItemActive(gView, 1))
|
|
|
|
{
|
|
|
|
drawElement(0, 0, 2344, 1, 0, 0, -1);
|
|
|
|
drawElement(320, 0, 2344, 1, 1, 0, 1);
|
|
|
|
drawElement(0, 200, 2344, 1, 0, 1, -1);
|
|
|
|
drawElement(320, 200, 2344, 1, 1, 1, 1);
|
|
|
|
if (gDetail >= 4)
|
|
|
|
{
|
|
|
|
drawElement(15, 3, 2346, 1, 0, 0, -1, 0, 0.2);
|
|
|
|
drawElement(212, 77, 2347, 1, 0, 0, 1, 0, 0.2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (powerupCheck(gView, kPwUpAsbestArmor) > 0)
|
|
|
|
{
|
|
|
|
drawElement(0, 237, 2358, 1, 0, 1, -1);
|
|
|
|
drawElement(320, 237, 2358, 1, 1, 1, 1);
|
|
|
|
}
|
2022-01-23 11:23:55 +00:00
|
|
|
|
|
|
|
int zn = ((gView->zWeapon - gView->zView - (12 << 8)) >> 7) + 220;
|
|
|
|
PLAYER* pPSprite = &gPlayer[gMe->actor->spr.type - kDudePlayer1];
|
|
|
|
if (gMe->actor->IsPlayerActor() && pPSprite->hand == 1)
|
|
|
|
{
|
|
|
|
gChoke.animateChoke(160, zn, (int)gInterpolate);
|
|
|
|
}
|
2020-08-02 17:00:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
END_BLD_NS
|