raze/source/games/blood/src/osdcmd.cpp

97 lines
2.4 KiB
C++
Raw Normal View History

2019-09-19 22:42:45 +00:00
//-------------------------------------------------------------------------
/*
Copyright (C) 2010-2019 EDuke32 developers and contributors
Copyright (C) 2019 Nuke.YKT
Copyright (C) 2020 Raze developers and contributors
2019-09-19 22:42:45 +00:00
This file was part of NBlood.
2019-09-19 22:42:45 +00:00
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!
2019-09-19 22:42:45 +00:00
#include "build.h"
2019-09-19 22:42:45 +00:00
#include "blood.h"
#include "mapinfo.h"
#include "gamestate.h"
2019-09-19 22:42:45 +00:00
BEGIN_BLD_NS
2019-09-19 22:42:45 +00:00
2022-08-30 20:17:08 +00:00
void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang, int horz)
{
2021-12-29 21:56:21 +00:00
PLAYER* pPlayer = &gPlayer[myconnectindex];
2022-09-10 12:05:36 +00:00
pPlayer->actor->opos.XY() = pPlayer->actor->spr.pos.XY() = { x , y };
2022-09-10 12:15:33 +00:00
pPlayer->ozView = pPlayer->zView = z;
2021-12-29 21:56:21 +00:00
2022-08-30 20:17:08 +00:00
if (ang != DAngle::fromDeg(INT_MIN))
2021-12-29 21:56:21 +00:00
{
pPlayer->angle.oang = pPlayer->angle.ang = ang;
2021-12-29 21:56:21 +00:00
}
if (horz != INT_MIN)
{
pPlayer->horizon.ohoriz = pPlayer->horizon.horiz = buildhoriz(horz);
2021-12-29 21:56:21 +00:00
}
}
void GameInterface::ToggleThirdPerson()
{
2021-12-29 21:56:21 +00:00
if (gamestate != GS_LEVEL) return;
if (gViewPos > VIEWPOS_0)
{
2021-12-29 21:56:21 +00:00
gViewPos = VIEWPOS_0;
}
2021-12-29 21:56:21 +00:00
else
{
2021-12-29 21:56:21 +00:00
gViewPos = VIEWPOS_1;
cameradist = 0;
cameraclock = INT_MIN;
}
}
void GameInterface::SwitchCoopView()
{
2021-12-29 21:56:21 +00:00
if (gamestate != GS_LEVEL) return;
if (gGameOptions.nGameType == 1)
{
gViewIndex = connectpoint2[gViewIndex];
if (gViewIndex == -1)
gViewIndex = connecthead;
}
else if (gGameOptions.nGameType == 3)
{
int oldViewIndex = gViewIndex;
do
{
gViewIndex = connectpoint2[gViewIndex];
if (gViewIndex == -1)
gViewIndex = connecthead;
if (oldViewIndex == gViewIndex || gPlayer[myconnectindex].teamId == gPlayer[gViewIndex].teamId)
2021-12-29 21:56:21 +00:00
break;
} while (oldViewIndex != gViewIndex);
}
}
void GameInterface::ToggleShowWeapon()
{
2021-12-29 21:56:21 +00:00
if (gamestate != GS_LEVEL) return;
cl_showweapon = (cl_showweapon + 1) & 3;
2019-09-19 22:42:45 +00:00
}
END_BLD_NS