2019-09-19 22:42:45 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 Nuke.YKT
|
2020-01-28 03:29:47 +00:00
|
|
|
Copyright (C) 2020 Raze developers and contributors
|
2019-09-19 22:42:45 +00:00
|
|
|
|
2020-01-28 03:29:47 +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.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
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 "mmulti.h"
|
|
|
|
#include "common_game.h"
|
|
|
|
#include "blood.h"
|
2019-06-27 04:33:22 +00:00
|
|
|
#include "globals.h"
|
2019-09-19 22:42:45 +00:00
|
|
|
#include "levels.h"
|
|
|
|
#include "messages.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "view.h"
|
2020-01-25 19:21:49 +00:00
|
|
|
#include "mapinfo.h"
|
2020-07-29 21:18:08 +00:00
|
|
|
#include "gamestate.h"
|
2019-09-19 22:42:45 +00:00
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
BEGIN_BLD_NS
|
2019-09-19 22:42:45 +00:00
|
|
|
|
2020-11-29 11:23:31 +00:00
|
|
|
void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz)
|
2020-07-11 13:05:49 +00:00
|
|
|
{
|
|
|
|
PLAYER *pPlayer = &gPlayer[myconnectindex];
|
2020-10-09 01:33:37 +00:00
|
|
|
VIEW* pView = &gPrevView[myconnectindex];
|
2020-07-11 13:05:49 +00:00
|
|
|
|
2020-11-29 11:23:31 +00:00
|
|
|
pPlayer->pSprite->x = pView->at50 = gView->pSprite->x = x;
|
|
|
|
pPlayer->pSprite->y = pView->at54 = gView->pSprite->y = y;
|
|
|
|
pPlayer->zView = pView->at38 = gView->zView = z;
|
2020-08-04 12:33:17 +00:00
|
|
|
|
2020-11-29 11:23:31 +00:00
|
|
|
if (ang != INT_MIN)
|
2020-08-04 12:33:17 +00:00
|
|
|
{
|
2020-11-29 11:23:31 +00:00
|
|
|
pPlayer->angle.oang = pPlayer->angle.ang = pView->at30 = gView->angle.ang = buildang(ang);
|
2020-08-04 12:33:17 +00:00
|
|
|
}
|
|
|
|
|
2020-11-29 11:23:31 +00:00
|
|
|
if (horz != INT_MIN)
|
2020-08-04 12:33:17 +00:00
|
|
|
{
|
2020-11-29 11:23:31 +00:00
|
|
|
pPlayer->horizon.ohoriz = pPlayer->horizon.horiz = pView->at24 = gView->horizon.horiz = buildhoriz(horz);
|
2020-08-04 12:33:17 +00:00
|
|
|
}
|
2020-07-11 13:05:49 +00:00
|
|
|
}
|
|
|
|
|
2020-11-29 11:23:31 +00:00
|
|
|
void GameInterface::ToggleThirdPerson()
|
2020-08-29 15:49:15 +00:00
|
|
|
{
|
2020-11-29 11:23:31 +00:00
|
|
|
if (gamestate != GS_LEVEL) return;
|
2020-08-29 15:49:15 +00:00
|
|
|
if (gViewPos > VIEWPOS_0)
|
|
|
|
gViewPos = VIEWPOS_0;
|
|
|
|
else
|
|
|
|
gViewPos = VIEWPOS_1;
|
|
|
|
}
|
|
|
|
|
2020-11-29 11:23:31 +00:00
|
|
|
void GameInterface::SwitchCoopView()
|
2020-08-29 15:49:15 +00:00
|
|
|
{
|
2020-11-29 11:23:31 +00:00
|
|
|
if (gamestate != GS_LEVEL) return;
|
2020-08-29 15:49:15 +00:00
|
|
|
if (gGameOptions.nGameType == 1)
|
|
|
|
{
|
|
|
|
gViewIndex = connectpoint2[gViewIndex];
|
|
|
|
if (gViewIndex == -1)
|
|
|
|
gViewIndex = connecthead;
|
|
|
|
gView = &gPlayer[gViewIndex];
|
|
|
|
}
|
|
|
|
else if (gGameOptions.nGameType == 3)
|
|
|
|
{
|
|
|
|
int oldViewIndex = gViewIndex;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
gViewIndex = connectpoint2[gViewIndex];
|
|
|
|
if (gViewIndex == -1)
|
|
|
|
gViewIndex = connecthead;
|
|
|
|
if (oldViewIndex == gViewIndex || gMe->teamId == gPlayer[gViewIndex].teamId)
|
|
|
|
break;
|
|
|
|
} while (oldViewIndex != gViewIndex);
|
|
|
|
gView = &gPlayer[gViewIndex];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-29 11:23:31 +00:00
|
|
|
void GameInterface::ToggleShowWeapon()
|
2020-08-29 15:49:15 +00:00
|
|
|
{
|
2020-11-29 11:23:31 +00:00
|
|
|
if (gamestate != GS_LEVEL) return;
|
2020-08-29 15:49:15 +00:00
|
|
|
cl_showweapon = (cl_showweapon + 1) & 3;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
END_BLD_NS
|