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.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2019-09-21 18:59:54 +00:00
|
|
|
|
|
|
|
#include "ns.h" // Must come before everything else!
|
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
#include "build.h"
|
|
|
|
#include "compat.h"
|
|
|
|
#include "common_game.h"
|
|
|
|
#include "blood.h"
|
|
|
|
#include "choke.h"
|
|
|
|
#include "globals.h"
|
|
|
|
#include "levels.h"
|
|
|
|
#include "player.h"
|
|
|
|
#include "qav.h"
|
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
BEGIN_BLD_NS
|
2019-09-19 22:42:45 +00:00
|
|
|
|
|
|
|
void CChoke::sub_83ff0(int a1, void(*a2)(PLAYER*))
|
|
|
|
{
|
|
|
|
at0 = NULL;
|
|
|
|
at1c = a2;
|
2020-07-25 21:35:39 +00:00
|
|
|
if (!at8 && a1 != -1)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-07-25 21:35:39 +00:00
|
|
|
at8 = getQAV(a1);
|
|
|
|
if (!at8)
|
2019-09-19 22:42:45 +00:00
|
|
|
ThrowError("Could not load QAV %d\n", a1);
|
|
|
|
at8->nSprite = -1;
|
|
|
|
at8->x = at14;
|
|
|
|
at8->y = at18;
|
|
|
|
at8->Preload();
|
|
|
|
sub_84218();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-14 19:18:14 +00:00
|
|
|
void CChoke::sub_84110(int x, int y)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-07-25 21:35:39 +00:00
|
|
|
if (!at8)
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
2020-08-25 23:33:40 +00:00
|
|
|
int v4 = gFrameClock;
|
2020-08-25 23:10:14 +00:00
|
|
|
gFrameClock = gameclock;
|
2019-09-19 22:42:45 +00:00
|
|
|
at8->x = x;
|
|
|
|
at8->y = y;
|
2020-08-25 23:10:14 +00:00
|
|
|
int vd = gameclock-at10;
|
|
|
|
at10 = gameclock;
|
2019-09-19 22:42:45 +00:00
|
|
|
atc -= vd;
|
|
|
|
if (atc <= 0 || atc > at8->at10)
|
|
|
|
atc = at8->at10;
|
|
|
|
int vdi = at8->at10-atc;
|
|
|
|
at8->Play(vdi-vd, vdi, -1, NULL);
|
2020-08-14 19:08:28 +00:00
|
|
|
// This originally overlaid the HUD but that simply doesn't work right with the HUD being a genuine overlay.
|
|
|
|
// It also never adjusted for a reduced 3D view
|
2020-08-14 19:18:14 +00:00
|
|
|
at8->Draw(vdi, 10, 0, 0, true);
|
2019-09-19 22:42:45 +00:00
|
|
|
gFrameClock = v4;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CChoke::sub_84218()
|
|
|
|
{
|
|
|
|
atc = at8->at10;
|
2020-08-25 23:10:14 +00:00
|
|
|
at10 = gameclock;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void sub_84230(PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
int t = gGameOptions.nDifficulty+2;
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->handTime < 64)
|
|
|
|
pPlayer->handTime = ClipHigh(pPlayer->handTime+t, 64);
|
|
|
|
if (pPlayer->handTime > (7-gGameOptions.nDifficulty)*5)
|
|
|
|
pPlayer->blindEffect = ClipHigh(pPlayer->blindEffect+t*4, 128);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
CChoke gChoke;
|
|
|
|
|
|
|
|
END_BLD_NS
|