2020-06-11 07:22:16 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2020-06-23 19:56:42 +00:00
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
2020-06-28 07:03:31 +00:00
|
|
|
Copyright (C) 2020 - Christoph Oelckers
|
2020-06-11 07:22:16 +00:00
|
|
|
|
2020-06-23 19:56:42 +00:00
|
|
|
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
|
2020-06-11 07:22:16 +00:00
|
|
|
|
2020-06-23 19:56:42 +00:00
|
|
|
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.
|
2020-06-11 07:22:16 +00:00
|
|
|
|
|
|
|
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
|
2020-06-23 19:56:42 +00:00
|
|
|
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)
|
2020-06-11 07:22:16 +00:00
|
|
|
*/
|
2020-06-23 19:56:42 +00:00
|
|
|
//-------------------------------------------------------------------------
|
2020-06-11 07:22:16 +00:00
|
|
|
|
2020-07-05 14:49:00 +00:00
|
|
|
// This file collects several functions from the original game.c
|
|
|
|
// that do not fit any particular category.
|
|
|
|
|
2020-06-11 07:22:16 +00:00
|
|
|
#include "ns.h" // Must come before everything else!
|
|
|
|
|
2020-09-06 10:44:58 +00:00
|
|
|
#include "automap.h"
|
2020-06-21 20:18:12 +00:00
|
|
|
#include "duke3d.h"
|
2020-06-11 07:22:16 +00:00
|
|
|
#include "m_argv.h"
|
2020-06-23 22:40:22 +00:00
|
|
|
#include "mapinfo.h"
|
|
|
|
#include "texturemanager.h"
|
2020-07-02 21:56:22 +00:00
|
|
|
#include "statusbar.h"
|
2020-07-03 22:32:09 +00:00
|
|
|
#include "st_start.h"
|
|
|
|
#include "i_interface.h"
|
2020-07-07 02:54:12 +00:00
|
|
|
#include "prediction.h"
|
2020-09-03 21:10:28 +00:00
|
|
|
#include "gamestate.h"
|
2020-10-23 15:50:27 +00:00
|
|
|
#include "dukeactor.h"
|
2020-11-26 15:03:40 +00:00
|
|
|
#include "interpolate.h"
|
2021-05-31 09:51:02 +00:00
|
|
|
#include "razefont.h"
|
2022-06-06 09:45:02 +00:00
|
|
|
#include "startscreen.h"
|
2020-06-11 07:22:16 +00:00
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
2020-08-19 20:16:57 +00:00
|
|
|
|
2020-07-03 19:44:57 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// debug output
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
GameStats GameInterface::getStats()
|
|
|
|
{
|
2022-02-07 10:04:19 +00:00
|
|
|
player_struct* p = &ps[myconnectindex];
|
2020-07-03 19:44:57 +00:00
|
|
|
return { p->actors_killed, p->max_actors_killed, p->secret_rooms, p->max_secret_rooms, p->player_par / REALGAMETICSPERSEC, p->frag };
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-03 22:32:09 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2020-07-24 18:21:51 +00:00
|
|
|
//
|
2020-07-03 22:32:09 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-28 23:04:04 +00:00
|
|
|
static void endthegame(bool)
|
2020-07-03 22:32:09 +00:00
|
|
|
{
|
2020-11-28 23:04:04 +00:00
|
|
|
endoomName = isRR() ? "redneck.bin" : !isShareware() ? "duke3d.bin" : "dukesw.bin";
|
|
|
|
ST_Endoom();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GameInterface::ExitFromMenu()
|
|
|
|
{
|
2021-04-27 22:51:28 +00:00
|
|
|
#if 0
|
|
|
|
// do we really need this scoreboard stuff here?
|
2020-11-28 23:04:04 +00:00
|
|
|
auto runbonus = [=](auto completion)
|
|
|
|
{
|
2020-07-03 22:32:09 +00:00
|
|
|
// MP scoreboard
|
2021-04-27 22:51:28 +00:00
|
|
|
if (playerswhenstarted > 1 && !ud.coop) ShowScoreboard(playerswhenstarted);
|
2020-07-19 09:57:00 +00:00
|
|
|
else completion(false);
|
2020-11-28 23:04:04 +00:00
|
|
|
};
|
2020-07-03 22:32:09 +00:00
|
|
|
|
2020-11-28 23:04:04 +00:00
|
|
|
auto runtwoscreens = [](auto completion)
|
|
|
|
{
|
2020-07-03 22:32:09 +00:00
|
|
|
// shareware and TEN screens
|
2020-10-12 06:07:51 +00:00
|
|
|
if (isShareware() && !isRR())
|
2021-04-26 22:01:25 +00:00
|
|
|
StartCutscene("DukeCutscenes.BuildSharewareExit", 0, completion);
|
2020-07-19 09:57:00 +00:00
|
|
|
else completion(false);
|
2020-11-28 23:04:04 +00:00
|
|
|
};
|
2020-07-03 22:32:09 +00:00
|
|
|
|
2020-11-28 23:04:04 +00:00
|
|
|
runbonus([=](bool aborted) { runtwoscreens(endthegame); });
|
2021-04-27 22:51:28 +00:00
|
|
|
#else
|
|
|
|
if (isShareware() && !isRR())
|
|
|
|
StartCutscene("DukeCutscenes.BuildSharewareExit", 0, endthegame);
|
|
|
|
else endthegame(false);
|
|
|
|
#endif
|
2020-07-18 19:28:57 +00:00
|
|
|
}
|
|
|
|
|
2020-06-30 20:53:15 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2020-08-23 20:46:53 +00:00
|
|
|
// This now redirects the messages to the console's notification display
|
2020-07-03 19:44:57 +00:00
|
|
|
// which has all the features to reasonably do this in Duke style.
|
2020-06-30 20:53:15 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-02-07 10:04:19 +00:00
|
|
|
void FTA(int q, player_struct* p)
|
2020-06-30 20:53:15 +00:00
|
|
|
{
|
2020-09-03 21:10:28 +00:00
|
|
|
if (q < 0 || gamestate != GS_LEVEL)
|
2020-07-02 18:58:56 +00:00
|
|
|
return;
|
|
|
|
|
2021-02-18 10:46:36 +00:00
|
|
|
if (p->ftq != q || (PlayClock - p->ftt > TICRATE && q != QUOTE_DEAD))
|
2020-07-02 18:58:56 +00:00
|
|
|
{
|
2020-07-30 19:09:11 +00:00
|
|
|
p->ftq = q;
|
2020-07-02 18:58:56 +00:00
|
|
|
auto qu = quoteMgr.GetQuote(q);
|
2020-07-07 21:01:34 +00:00
|
|
|
if (p == &ps[screenpeek] && qu[0] != '\0')
|
2020-07-02 18:58:56 +00:00
|
|
|
{
|
2020-07-26 08:31:12 +00:00
|
|
|
#if 0
|
2020-08-23 20:46:53 +00:00
|
|
|
if (q >= 70 && q <= 72)
|
2020-07-02 18:58:56 +00:00
|
|
|
{
|
|
|
|
// Todo: redirect this to a centered message (these are "need a key" messages)
|
|
|
|
}
|
|
|
|
else
|
2020-07-26 08:31:12 +00:00
|
|
|
#endif
|
2020-07-02 18:58:56 +00:00
|
|
|
{
|
2020-07-27 15:56:55 +00:00
|
|
|
Printf(PRINT_MEDIUM | PRINT_NOTIFY, "%s\n", qu);
|
2020-07-02 18:58:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-02-18 10:46:36 +00:00
|
|
|
p->ftt = PlayClock;
|
2020-06-30 20:53:15 +00:00
|
|
|
}
|
|
|
|
|
2020-07-02 18:17:29 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Draws the background
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2020-08-30 10:02:32 +00:00
|
|
|
void GameInterface::DrawBackground()
|
2020-07-02 18:17:29 +00:00
|
|
|
{
|
2020-07-21 20:46:26 +00:00
|
|
|
twod->ClearScreen();
|
2022-11-30 13:56:56 +00:00
|
|
|
auto tex = TexMan.FindGameTexture("MENUSCREEN");
|
|
|
|
if (!tex) return;
|
2020-07-21 20:46:26 +00:00
|
|
|
PalEntry color = 0xff808080;
|
|
|
|
if (!hud_bgstretch)
|
2020-08-14 19:01:27 +00:00
|
|
|
DrawTexture(twod, tex, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_Color, color, TAG_DONE);
|
2020-07-21 20:46:26 +00:00
|
|
|
else
|
|
|
|
DrawTexture(twod, tex, 0, 0, DTA_VirtualWidth, twod->GetWidth(), DTA_VirtualHeight, twod->GetHeight(), DTA_KeepRatio, true, DTA_Color, color, TAG_DONE);
|
2020-07-02 18:58:56 +00:00
|
|
|
}
|
|
|
|
|
2020-07-07 02:54:12 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// this is from ZDoom
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void V_AddBlend (float r, float g, float b, float a, float v_blend[4])
|
|
|
|
{
|
|
|
|
r = clamp(r/255.f, 0.f, 0.25f);
|
2020-07-24 18:21:51 +00:00
|
|
|
g = clamp(g/255.f, 0.f, 0.25f);
|
|
|
|
b = clamp(b/255.f, 0.f, 0.25f);
|
2020-07-07 02:54:12 +00:00
|
|
|
a = clamp(a/255.f, 0.f, 0.25f);
|
|
|
|
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-07-07 02:54:12 +00:00
|
|
|
float a2, a3;
|
|
|
|
|
|
|
|
if (a <= 0)
|
|
|
|
return;
|
|
|
|
a2 = v_blend[3] + (1-v_blend[3])*a; // new total alpha
|
|
|
|
a3 = v_blend[3]/a2; // fraction of color from old
|
|
|
|
|
|
|
|
v_blend[0] = v_blend[0]*a3 + r*(1-a3);
|
|
|
|
v_blend[1] = v_blend[1]*a3 + g*(1-a3);
|
|
|
|
v_blend[2] = v_blend[2]*a3 + b*(1-a3);
|
|
|
|
v_blend[3] = a2;
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-07-07 02:54:12 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void setgamepalette(int palid)
|
|
|
|
{
|
2020-07-20 21:21:27 +00:00
|
|
|
if (palid >= MAXBASEPALS || palid < 0) palid = 0;
|
2020-07-07 02:54:12 +00:00
|
|
|
auto& fstint = lookups.tables[MAXPALOOKUPS - 1];
|
|
|
|
if (palid == WATERPAL) fstint.tintColor = PalEntry(224, 192, 255);
|
|
|
|
else if (palid == SLIMEPAL) fstint.tintColor = PalEntry(208, 255, 192);
|
|
|
|
else fstint.tintColor = 0xffffff;
|
2020-07-20 21:21:27 +00:00
|
|
|
videoSetPalette(palid);
|
2020-07-07 02:54:12 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 11:09:04 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// draws the weapon sprite and other 2D content that's part of the scene.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-09-07 05:34:55 +00:00
|
|
|
void drawweapon(double interpfrac)
|
2022-01-08 11:09:04 +00:00
|
|
|
{
|
|
|
|
auto pp = &ps[screenpeek];
|
|
|
|
if (!isRR() && pp->newOwner != nullptr)
|
|
|
|
cameratext(pp->newOwner);
|
|
|
|
else
|
|
|
|
{
|
2022-09-07 05:34:55 +00:00
|
|
|
fi.displayweapon(screenpeek, interpfrac);
|
2022-01-08 11:09:04 +00:00
|
|
|
if (pp->over_shoulder_on == 0)
|
2022-09-07 05:34:55 +00:00
|
|
|
fi.displaymasks(screenpeek, pp->GetActor()->spr.pal == 1 || !pp->insector() ? 1 : pp->cursector->floorpal, interpfrac);
|
2022-01-08 11:09:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-07-07 02:54:12 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2021-04-01 18:47:05 +00:00
|
|
|
// draws everything not part of the 3D scene and its weapon sprite.
|
2020-07-07 02:54:12 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-09-07 05:49:17 +00:00
|
|
|
void drawoverlays(double interpfrac)
|
2020-07-07 02:54:12 +00:00
|
|
|
{
|
2022-02-07 10:04:19 +00:00
|
|
|
player_struct* pp;
|
2022-09-20 00:31:01 +00:00
|
|
|
DVector2 cposxy;
|
2022-08-27 08:24:16 +00:00
|
|
|
DAngle cang;
|
2020-07-07 02:54:12 +00:00
|
|
|
|
|
|
|
pp = &ps[screenpeek];
|
2022-04-03 22:16:54 +00:00
|
|
|
// set palette here, in case the 3D view is off.
|
|
|
|
setgamepalette(setpal(pp));
|
2020-07-07 02:54:12 +00:00
|
|
|
|
|
|
|
float blend[4] = {};
|
|
|
|
|
|
|
|
// this does pain tinting etc from the CON
|
|
|
|
V_AddBlend(pp->pals.r, pp->pals.g, pp->pals.b, pp->pals.a, blend);
|
|
|
|
// loogies courtesy of being snotted on
|
2020-11-22 16:38:07 +00:00
|
|
|
if (pp->loogcnt > 0 && !isRR())
|
2020-07-07 02:54:12 +00:00
|
|
|
{
|
2021-05-12 15:57:36 +00:00
|
|
|
V_AddBlend(0, 63, 0, float(pp->loogcnt >> 1), blend);
|
2020-07-07 02:54:12 +00:00
|
|
|
}
|
|
|
|
if (blend[3])
|
|
|
|
{
|
|
|
|
// result must be multiplied by 4 and normalised to 255. (4*255 = 1020)
|
2020-08-07 20:00:43 +00:00
|
|
|
auto comp = [&](int i, int maxv=255) { return clamp(int(blend[i] * 1020), 0, maxv); };
|
|
|
|
videoFadePalette(comp(0), comp(1), comp(2), comp(3, 192)); // Never fully saturate the alpha channel
|
2020-07-07 02:54:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
videoclearFade();
|
|
|
|
|
2021-12-02 00:05:07 +00:00
|
|
|
MarkSectorSeen(pp->cursector);
|
2020-07-07 02:54:12 +00:00
|
|
|
|
2020-11-02 22:53:55 +00:00
|
|
|
if (ud.cameraactor == nullptr)
|
2020-07-07 02:54:12 +00:00
|
|
|
{
|
2020-08-24 17:31:43 +00:00
|
|
|
if (automapMode != am_off)
|
2020-07-07 02:54:12 +00:00
|
|
|
{
|
2022-09-07 05:49:17 +00:00
|
|
|
DoInterpolations(interpfrac);
|
2020-07-07 02:54:12 +00:00
|
|
|
|
2020-11-02 23:20:51 +00:00
|
|
|
if (pp->newOwner == nullptr && playrunning())
|
2020-07-07 02:54:12 +00:00
|
|
|
{
|
2020-09-06 08:08:47 +00:00
|
|
|
if (screenpeek == myconnectindex && numplayers > 1)
|
2020-07-07 02:54:12 +00:00
|
|
|
{
|
2022-09-08 10:47:21 +00:00
|
|
|
cposxy = interpolatedvalue(omypos, mypos, interpfrac).XY();
|
2022-09-07 05:49:17 +00:00
|
|
|
cang = !SyncInput() ? myang : interpolatedvalue(omyang, myang, interpfrac);
|
2020-07-07 02:54:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-12-05 01:28:33 +00:00
|
|
|
cposxy = pp->GetActor()->interpolatedpos(interpfrac).XY();
|
|
|
|
cang = pp->Angles.getRenderAngles(interpfrac).Yaw;
|
2020-07-07 02:54:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-11-20 09:00:26 +00:00
|
|
|
cposxy = pp->GetActor()->opos.XY();
|
2022-11-25 11:30:40 +00:00
|
|
|
cang = pp->GetActor()->PrevAngles.Yaw;
|
2020-07-07 02:54:12 +00:00
|
|
|
}
|
2022-09-07 09:37:50 +00:00
|
|
|
DrawOverheadMap(cposxy, cang, interpfrac);
|
2020-11-26 15:03:40 +00:00
|
|
|
RestoreInterpolations();
|
2020-07-07 02:54:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-15 14:46:08 +00:00
|
|
|
DrawStatusBar();
|
2020-07-07 02:54:12 +00:00
|
|
|
|
2020-11-02 23:20:51 +00:00
|
|
|
if (ps[myconnectindex].newOwner == nullptr && ud.cameraactor == nullptr)
|
2020-07-07 02:54:12 +00:00
|
|
|
{
|
2022-12-02 07:16:04 +00:00
|
|
|
auto offsets = pp->Angles.getCrosshairOffsets(interpfrac);
|
|
|
|
DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, offsets.first.X, offsets.first.Y + (pp->over_shoulder_on ? 2.5 : 0), isRR() ? 0.5 : 1, offsets.second);
|
2020-07-07 02:54:12 +00:00
|
|
|
}
|
|
|
|
|
2020-07-21 20:46:26 +00:00
|
|
|
if (paused == 2)
|
2021-04-27 22:51:28 +00:00
|
|
|
{
|
|
|
|
double x = 160, y = 100;
|
|
|
|
double scale = isRR() ? 0.4 : 1.;
|
|
|
|
const char* text = GStrings("Game Paused");
|
2021-05-31 09:51:02 +00:00
|
|
|
auto myfont = PickBigFont(text);
|
|
|
|
x -= myfont->StringWidth(text) * 0.5 * scale;
|
|
|
|
DrawText(twod, myfont, CR_UNTRANSLATED, x, y - 12, text, DTA_FullscreenScale, FSMode_Fit320x200, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
|
2021-04-27 22:51:28 +00:00
|
|
|
}
|
2020-07-07 02:54:12 +00:00
|
|
|
}
|
|
|
|
|
2020-10-28 18:27:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-02 18:58:56 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-02 23:20:51 +00:00
|
|
|
void cameratext(DDukeActor *cam)
|
2020-07-03 21:16:12 +00:00
|
|
|
{
|
2022-12-13 20:14:38 +00:00
|
|
|
static FTextureID texids[4];
|
|
|
|
static const char* texs[] = { "CAMCORNER", "CAMCORNER2", "CAMLIGHT", "STATIC" };
|
|
|
|
|
|
|
|
if (!texids[0].isValid())
|
|
|
|
{
|
|
|
|
for (int i = 0; i < 4; i++) texids[i] = TexMan.CheckForTexture(texs[i], ETextureType::Any);
|
|
|
|
}
|
|
|
|
|
2020-07-03 21:16:12 +00:00
|
|
|
auto drawitem = [=](int tile, double x, double y, bool flipx, bool flipy)
|
|
|
|
{
|
2022-12-13 20:14:38 +00:00
|
|
|
DrawTexture(twod, texids[tile], false, x, y, DTA_ViewportX, viewport3d.Left(), DTA_ViewportY, viewport3d.Top(), DTA_ViewportWidth, viewport3d.Width(),
|
2022-08-04 21:47:01 +00:00
|
|
|
DTA_ViewportHeight, viewport3d.Height(), DTA_FlipX, flipx, DTA_FlipY, flipy, DTA_CenterOffsetRel, 2, DTA_FullscreenScale, FSMode_Fit320x200, TAG_DONE);
|
2020-07-03 21:16:12 +00:00
|
|
|
};
|
2020-11-02 23:20:51 +00:00
|
|
|
if (!cam->temp_data[0])
|
2020-07-03 21:16:12 +00:00
|
|
|
{
|
2022-12-13 20:14:38 +00:00
|
|
|
drawitem(0, 24, 33, false, false);
|
|
|
|
drawitem(1, 320 - 26, 33, false, false);
|
|
|
|
drawitem(1, 24, 163, true, true);
|
|
|
|
drawitem(1, 320 - 26, 163, false, true);
|
2020-07-03 21:16:12 +00:00
|
|
|
|
2021-02-18 10:46:36 +00:00
|
|
|
if (PlayClock & 16)
|
2022-12-13 20:14:38 +00:00
|
|
|
drawitem(2, 46, 32, false, false);
|
2020-07-03 21:16:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (int x = -64; x < 394; x += 64)
|
|
|
|
for (int y = 0; y < 200; y += 64)
|
2022-12-13 20:14:38 +00:00
|
|
|
drawitem(3, x, y, !!(PlayClock & 8), !!(PlayClock & 16));
|
2020-07-03 21:16:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-06 01:00:52 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-07-06 06:55:56 +00:00
|
|
|
int startrts(int lumpNum, int localPlayer)
|
2020-07-06 01:00:52 +00:00
|
|
|
{
|
|
|
|
if (SoundEnabled() &&
|
|
|
|
RTS_IsInitialized() && rtsplaying == 0 && (snd_speech & (localPlayer ? 1 : 4)))
|
|
|
|
{
|
|
|
|
auto sid = RTS_GetSoundID(lumpNum - 1);
|
2022-11-24 16:46:39 +00:00
|
|
|
if (sid.isvalid())
|
2020-07-06 01:00:52 +00:00
|
|
|
{
|
2022-11-24 16:46:39 +00:00
|
|
|
S_PlaySound(sid.index() - 1, CHAN_AUTO, CHANF_UI);
|
2020-07-06 01:00:52 +00:00
|
|
|
rtsplaying = 7;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2020-07-03 21:16:12 +00:00
|
|
|
|
2020-07-18 09:56:49 +00:00
|
|
|
::GameInterface* CreateInterface()
|
|
|
|
{
|
|
|
|
return new GameInterface;
|
|
|
|
}
|
|
|
|
|
2020-09-06 19:31:05 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-09-07 09:37:50 +00:00
|
|
|
bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, const DAngle cang, const DVector2& xydim, const double czoom, double const interpfrac)
|
2020-09-06 19:31:05 +00:00
|
|
|
{
|
2022-09-05 23:37:14 +00:00
|
|
|
// Pre-caculate incoming angle vector.
|
2022-09-20 00:07:15 +00:00
|
|
|
auto cangvect = cang.ToVector();
|
2020-09-06 19:31:05 +00:00
|
|
|
|
2022-09-20 00:31:01 +00:00
|
|
|
// Draw sprites
|
2022-09-05 23:52:58 +00:00
|
|
|
if (gFullMap)
|
2020-09-06 19:31:05 +00:00
|
|
|
{
|
2022-09-05 23:52:58 +00:00
|
|
|
for (unsigned ii = 0; ii < sector.Size(); ii++)
|
2020-09-06 19:31:05 +00:00
|
|
|
{
|
2022-09-05 23:52:58 +00:00
|
|
|
if (show2dsector[ii]) continue;
|
|
|
|
DukeSectIterator it(ii);
|
|
|
|
while (auto act = it.Next())
|
2020-09-06 19:31:05 +00:00
|
|
|
{
|
2022-10-07 21:33:37 +00:00
|
|
|
if (act == ps[screenpeek].actor || (act->spr.cstat & CSTAT_SPRITE_INVISIBLE) || act->spr.cstat == CSTAT_SPRITE_BLOCK_ALL || act->spr.scale.X == 0) continue;
|
2022-09-05 23:52:58 +00:00
|
|
|
|
|
|
|
if ((act->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) != 0)
|
|
|
|
{
|
|
|
|
PalEntry col = act->spr.cstat & CSTAT_SPRITE_BLOCK ? PalEntry(170, 0, 170) : PalEntry(0, 170, 170);
|
|
|
|
auto sprpos = act->spr.pos.XY() - cpos;
|
|
|
|
|
|
|
|
switch (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK)
|
|
|
|
{
|
|
|
|
case CSTAT_SPRITE_ALIGNMENT_FACING:
|
|
|
|
DrawAutomapAlignmentFacing(act->spr, sprpos, cangvect, czoom, xydim, col);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CSTAT_SPRITE_ALIGNMENT_WALL:
|
2022-12-20 21:25:48 +00:00
|
|
|
if ((act->flags2 & SFLAG2_SHOWWALLSPRITEONMAP)) DrawAutomapAlignmentWall(act->spr, sprpos, cangvect, czoom, xydim, col);
|
2022-09-05 23:52:58 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CSTAT_SPRITE_ALIGNMENT_FLOOR:
|
|
|
|
case CSTAT_SPRITE_ALIGNMENT_SLOPE:
|
|
|
|
DrawAutomapAlignmentFloor(act->spr, sprpos, cangvect, czoom, xydim, col);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-09-06 19:31:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-13 20:25:35 +00:00
|
|
|
auto basetex = TexMan.CheckForTexture("APLAYERTOP", ETextureType::Any);
|
|
|
|
if (!basetex.isValid()) return true;
|
2022-09-20 00:31:01 +00:00
|
|
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
2020-09-06 19:31:05 +00:00
|
|
|
{
|
|
|
|
if (p == screenpeek || ud.coop == 1)
|
|
|
|
{
|
|
|
|
auto& pp = ps[p];
|
2022-09-01 13:19:48 +00:00
|
|
|
auto act = pp.GetActor();
|
2022-12-13 20:25:35 +00:00
|
|
|
|
|
|
|
basetex = basetex + (act->vel.X > 1 && pp.on_ground ? (PlayClock >> 4) & 3 : 0);
|
2023-01-05 10:00:31 +00:00
|
|
|
double j = clamp(czoom * act->spr.scale.Y + abs(pp.truefz - act->getOffsetZ()) * REPEAT_SCALE, (1. / 3.), 2.);
|
2020-09-06 19:31:05 +00:00
|
|
|
|
2022-09-20 00:07:15 +00:00
|
|
|
auto const vec = OutAutomapVector(mxy - cpos, cangvect, czoom, xydim);
|
2023-03-18 08:48:18 +00:00
|
|
|
auto const daang = -(pp.Angles.getCameraAngles().Yaw - cang).Normalized360().Degrees();
|
2020-09-06 19:31:05 +00:00
|
|
|
|
2022-12-13 20:25:35 +00:00
|
|
|
DrawTexture(twod, basetex, false, vec.X, vec.Y, DTA_TranslationIndex, TRANSLATION(Translation_Remap + setpal(&pp), act->spr.pal), DTA_CenterOffset, true,
|
2022-09-20 00:31:01 +00:00
|
|
|
DTA_Rotate, daang, DTA_Color, shadeToLight(act->spr.shade), DTA_ScaleX, j, DTA_ScaleY, j, TAG_DONE);
|
2020-09-06 19:31:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-18 09:56:49 +00:00
|
|
|
|
2020-07-14 22:06:19 +00:00
|
|
|
|
2020-06-11 07:22:16 +00:00
|
|
|
END_DUKE_NS
|
2020-06-23 19:56:42 +00:00
|
|
|
|