2020-06-30 18:59:24 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2020 - Christoph Oelckers
|
|
|
|
|
|
|
|
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
|
|
|
|
|
|
|
|
Duke Nukem 3D is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
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
|
|
|
|
aint with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Original Source: 1996 - Todd Replogle
|
|
|
|
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|
|
|
Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "ns.h" // Must come before everything else!
|
|
|
|
|
2020-07-18 21:50:46 +00:00
|
|
|
#include "gamestate.h"
|
2020-06-30 18:59:24 +00:00
|
|
|
#include "duke3d.h"
|
2020-07-06 01:00:52 +00:00
|
|
|
#include "sbar.h"
|
2020-06-30 18:59:24 +00:00
|
|
|
#include "m_argv.h"
|
|
|
|
#include "mapinfo.h"
|
|
|
|
#include "texturemanager.h"
|
2020-08-28 07:06:49 +00:00
|
|
|
#include "glbackend/glbackend.h"
|
2020-06-30 18:59:24 +00:00
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-30 10:02:32 +00:00
|
|
|
void GameInterface::Ticker()
|
2020-06-30 18:59:24 +00:00
|
|
|
{
|
2020-07-06 01:00:52 +00:00
|
|
|
ud.camerasprite = -1;
|
|
|
|
|
|
|
|
if (earthquaketime > 0) earthquaketime--;
|
|
|
|
if (rtsplaying > 0) rtsplaying--;
|
|
|
|
|
|
|
|
if (show_shareware > 0)
|
|
|
|
{
|
|
|
|
show_shareware--;
|
|
|
|
}
|
|
|
|
|
|
|
|
everyothertime++;
|
|
|
|
updateinterpolations();
|
|
|
|
|
2020-07-21 20:46:26 +00:00
|
|
|
if (playrunning())
|
2020-07-06 01:00:52 +00:00
|
|
|
{
|
|
|
|
global_random = krand();
|
|
|
|
movedummyplayers();//ST 13
|
|
|
|
}
|
|
|
|
|
2020-08-30 10:02:32 +00:00
|
|
|
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
2020-07-06 01:00:52 +00:00
|
|
|
{
|
2020-07-21 20:46:26 +00:00
|
|
|
if (playrunning())
|
2020-07-06 01:00:52 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[i];
|
2020-07-06 19:57:38 +00:00
|
|
|
if (p->pals.a > 0)
|
|
|
|
p->pals.a--;
|
2020-07-06 01:00:52 +00:00
|
|
|
|
2020-07-17 19:09:07 +00:00
|
|
|
hud_input(i);
|
2020-07-06 01:00:52 +00:00
|
|
|
fi.processinput(i);
|
|
|
|
fi.checksectors(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-21 20:46:26 +00:00
|
|
|
if (playrunning())
|
2020-07-06 01:00:52 +00:00
|
|
|
{
|
|
|
|
if (levelTextTime > 0)
|
|
|
|
levelTextTime--;
|
2020-06-30 18:59:24 +00:00
|
|
|
|
|
|
|
fi.think();
|
2020-07-06 01:00:52 +00:00
|
|
|
}
|
2020-06-30 18:59:24 +00:00
|
|
|
|
2020-07-06 01:00:52 +00:00
|
|
|
if ((everyothertime & 1) == 0)
|
|
|
|
{
|
|
|
|
fi.animatewalls();
|
|
|
|
movecyclers();
|
|
|
|
}
|
2020-06-30 18:59:24 +00:00
|
|
|
|
2020-07-06 01:00:52 +00:00
|
|
|
if (isRR() && ud.recstat == 0 && ud.multimode < 2)
|
|
|
|
dotorch();
|
2020-06-30 18:59:24 +00:00
|
|
|
|
2020-07-18 09:56:49 +00:00
|
|
|
if (ps[myconnectindex].gm & (MODE_EOL | MODE_RESTART))
|
|
|
|
{
|
2020-07-18 22:53:13 +00:00
|
|
|
exitlevel();
|
2020-07-18 09:56:49 +00:00
|
|
|
}
|
2020-08-30 10:02:32 +00:00
|
|
|
nonsharedkeys();
|
2020-07-18 09:56:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-30 05:53:20 +00:00
|
|
|
void resetGameClock()
|
|
|
|
{
|
2020-08-30 06:04:33 +00:00
|
|
|
I_SetFrameTime();
|
2020-08-30 06:13:34 +00:00
|
|
|
gameclockstart = I_GetBuildTime();
|
2020-08-30 05:53:20 +00:00
|
|
|
gameclock = 0;
|
|
|
|
cloudclock = 0;
|
|
|
|
}
|
2020-07-18 21:50:46 +00:00
|
|
|
|
2020-08-30 10:02:32 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void GameInterface::Startup()
|
2020-07-18 09:56:49 +00:00
|
|
|
{
|
2020-08-30 05:53:20 +00:00
|
|
|
resetGameClock();
|
2020-08-30 10:02:32 +00:00
|
|
|
ps[myconnectindex].ftq = 0;
|
2020-08-23 15:47:05 +00:00
|
|
|
|
2020-08-30 10:02:32 +00:00
|
|
|
if (userConfig.CommandMap.IsNotEmpty())
|
|
|
|
{
|
|
|
|
auto maprecord = FindMapByName(userConfig.CommandMap);
|
|
|
|
userConfig.CommandMap = "";
|
|
|
|
if (maprecord)
|
2020-07-18 21:50:46 +00:00
|
|
|
{
|
2020-08-30 10:02:32 +00:00
|
|
|
ud.m_respawn_monsters = ud.m_player_skill == 4;
|
|
|
|
|
|
|
|
for (int i = 0; i != -1; i = connectpoint2[i])
|
2020-07-21 22:42:50 +00:00
|
|
|
{
|
2020-08-30 10:02:32 +00:00
|
|
|
resetweapons(i);
|
|
|
|
resetinventory(i);
|
2020-07-21 22:42:50 +00:00
|
|
|
}
|
2020-08-30 10:02:32 +00:00
|
|
|
startnewgame(maprecord, /*userConfig.skill*/2);
|
2020-07-21 22:42:50 +00:00
|
|
|
}
|
2020-08-30 10:02:32 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fi.ShowLogo([](bool) { startmainmenu(); });
|
|
|
|
}
|
2020-08-29 19:20:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-08-30 08:42:44 +00:00
|
|
|
void GameInterface::Render()
|
|
|
|
{
|
2020-08-30 10:02:32 +00:00
|
|
|
drawtime.Reset();
|
|
|
|
drawtime.Clock();
|
|
|
|
videoSetBrightness(thunder_brightness);
|
|
|
|
double const smoothRatio = playrunning() ? I_GetTimeFrac() * MaxSmoothRatio : MaxSmoothRatio;
|
|
|
|
displayrooms(screenpeek, smoothRatio);
|
|
|
|
drawoverlays(smoothRatio);
|
|
|
|
drawtime.Unclock();
|
2020-08-30 08:42:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-06-30 18:59:24 +00:00
|
|
|
END_DUKE_NS
|
|
|
|
|