2015-05-19 21:54:34 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1997, 2005 - 3D Realms Entertainment
|
|
|
|
|
|
|
|
This file is part of Shadow Warrior version 1.2
|
|
|
|
|
|
|
|
Shadow Warrior 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
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
Original Source: 1997 - Frank Maddin and Jim Norwood
|
|
|
|
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2019-10-09 16:09:05 +00:00
|
|
|
#include "ns.h"
|
2015-05-19 21:54:34 +00:00
|
|
|
|
|
|
|
#include "names2.h"
|
|
|
|
#include "panel.h"
|
|
|
|
#include "lists.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "pal.h"
|
2020-08-05 22:18:45 +00:00
|
|
|
#include "misc.h"
|
2015-05-19 21:54:34 +00:00
|
|
|
#include "menus.h"
|
|
|
|
|
2019-03-21 02:24:19 +00:00
|
|
|
#include "network.h"
|
2020-08-15 18:29:13 +00:00
|
|
|
#include "v_font.h"
|
|
|
|
#include "v_draw.h"
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2019-10-09 16:09:05 +00:00
|
|
|
BEGIN_SW_NS
|
|
|
|
|
2020-08-15 18:29:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Sets up the game fonts.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2020-08-15 18:29:13 +00:00
|
|
|
void InitFonts()
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-15 18:29:13 +00:00
|
|
|
GlyphSet fontdata;
|
2015-05-19 21:54:34 +00:00
|
|
|
|
2021-05-30 08:56:31 +00:00
|
|
|
if (!V_GetFont("TileSmallFont"))
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-05-30 08:56:31 +00:00
|
|
|
// Small font
|
|
|
|
for (int i = 0; i < 95; i++)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-05-30 08:56:31 +00:00
|
|
|
auto tile = tileGetTexture(STARTALPHANUM + i);
|
|
|
|
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
|
|
|
|
{
|
|
|
|
fontdata.Insert('!' + i, tile);
|
|
|
|
tile->SetOffsetsNotForFont();
|
|
|
|
}
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
2021-05-30 08:56:31 +00:00
|
|
|
new ::FFont("TileSmallFont", nullptr, nullptr, 0, 0, 0, -1, 4, false, false, false, &fontdata);
|
|
|
|
fontdata.Clear();
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
|
|
|
|
2021-05-30 08:56:31 +00:00
|
|
|
SmallFont2 = V_GetFont("SmallFont2");
|
|
|
|
if (!SmallFont2)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-05-30 08:56:31 +00:00
|
|
|
|
|
|
|
// Tiny font
|
|
|
|
for (int i = 0; i < 95; i++)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2021-05-30 08:56:31 +00:00
|
|
|
auto tile = tileGetTexture(2930 + i);
|
|
|
|
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
|
|
|
|
{
|
|
|
|
fontdata.Insert('!' + i, tile);
|
|
|
|
tile->SetOffsetsNotForFont();
|
|
|
|
}
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
2021-05-30 08:56:31 +00:00
|
|
|
SmallFont2 = new ::FFont("SmallFont2", nullptr, nullptr, 0, 0, 0, -1, 4, false, false, false, &fontdata);
|
|
|
|
fontdata.Clear();
|
2015-05-19 21:54:34 +00:00
|
|
|
}
|
2020-08-15 13:29:47 +00:00
|
|
|
|
2021-05-30 08:56:31 +00:00
|
|
|
if (!V_GetFont("TileBigFont"))
|
2020-08-15 13:29:47 +00:00
|
|
|
{
|
2021-05-30 08:56:31 +00:00
|
|
|
|
|
|
|
const int FONT_LARGE_ALPHA = 3706;
|
|
|
|
const int FONT_LARGE_DIGIT = 3732;
|
|
|
|
|
|
|
|
// Big
|
|
|
|
for (int i = 0; i < 10; i++)
|
2020-08-15 13:29:47 +00:00
|
|
|
{
|
2021-05-30 08:56:31 +00:00
|
|
|
auto tile = tileGetTexture(FONT_LARGE_DIGIT + i);
|
|
|
|
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
|
|
|
|
{
|
|
|
|
fontdata.Insert('0' + i, tile);
|
|
|
|
tile->SetOffsetsNotForFont();
|
|
|
|
}
|
2020-08-15 13:29:47 +00:00
|
|
|
}
|
2021-05-30 08:56:31 +00:00
|
|
|
for (int i = 0; i < 26; i++)
|
2020-08-15 13:29:47 +00:00
|
|
|
{
|
2021-05-30 08:56:31 +00:00
|
|
|
auto tile = tileGetTexture(FONT_LARGE_ALPHA + i);
|
|
|
|
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
|
|
|
|
{
|
|
|
|
fontdata.Insert('A' + i, tile);
|
|
|
|
tile->SetOffsetsNotForFont();
|
|
|
|
}
|
2020-08-15 13:29:47 +00:00
|
|
|
}
|
2021-05-30 08:56:31 +00:00
|
|
|
|
|
|
|
auto BigFont = new ::FFont("TileBigFont", nullptr, nullptr, 0, 0, 0, -1, 10, false, false, false, &fontdata);
|
|
|
|
BigFont->SetKerning(1);
|
2020-08-15 13:29:47 +00:00
|
|
|
}
|
|
|
|
|
2021-05-30 08:56:31 +00:00
|
|
|
BigFont = V_GetFont("BIGFONT");
|
|
|
|
SmallFont = V_GetFont("SMALLFONT");
|
|
|
|
|
2020-08-15 13:29:47 +00:00
|
|
|
}
|
|
|
|
|
2020-08-15 18:29:13 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Notification messages. Native SW-style display should later be
|
|
|
|
// provided by the backend.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-08-15 13:29:47 +00:00
|
|
|
|
2015-05-19 21:58:29 +00:00
|
|
|
void PutStringInfo(PLAYERp pp, const char *string)
|
2015-05-19 21:54:34 +00:00
|
|
|
{
|
2020-08-23 20:46:53 +00:00
|
|
|
if (pp-Player == myconnectindex)
|
2020-08-15 18:29:13 +00:00
|
|
|
Printf(PRINT_MEDIUM|PRINT_NOTIFY, "%s\n", string); // Put it in the console too
|
2019-12-04 20:35:35 +00:00
|
|
|
}
|
|
|
|
|
2019-10-09 16:09:05 +00:00
|
|
|
END_SW_NS
|