- migrated all of SW's text display to the backend and removed the various redundant printing functions.

This commit is contained in:
Christoph Oelckers 2020-08-15 20:29:13 +02:00
parent f0150569a4
commit 910ca69484
19 changed files with 206 additions and 1043 deletions

View file

@ -133,7 +133,6 @@ enum ENativeFontValues
{
NIT_BigFont,
NIT_SmallFont,
NIT_TinyFont,
NIT_ActiveColor = -1,
NIT_InactiveColor = -2,

View file

@ -23,7 +23,6 @@ set( PCH_SOURCES
src/interpsh.cpp
src/interpso.cpp
src/inv.cpp
src/jplayer.cpp
src/jsector.cpp
src/jweapon.cpp
src/lava.cpp

View file

@ -480,7 +480,7 @@ class DSWMultiSummaryScreen : public DScreenJob
int y = STAT_START_Y;
// Hm.... how to translate this without messing up the formatting?
DisplayMiniBarSmString(x, y, 0, " NAME 1 2 3 4 5 6 7 8 KILLS");
MNU_DrawSmallString(x, y, " NAME 1 2 3 4 5 6 7 8 KILLS", 0, 0);
int rows = OrigCommPlayers;
int cols = OrigCommPlayers;
@ -493,10 +493,10 @@ class DSWMultiSummaryScreen : public DScreenJob
auto pp = Player + i;
ds.Format("%d", i + 1);
DisplayMiniBarSmString(x, y, 0, ds);
MNU_DrawSmallString(x, y, ds, 0, 0);
ds.Format(" %-13s", pp->PlayerName);
DisplayMiniBarSmString(x, y, User[pp->PlayerSprite]->spal, ds);
MNU_DrawSmallString(x, y, ds, 0, User[pp->PlayerSprite]->spal);
x = STAT_TABLE_X;
for (int j = 0; j < cols; j++)
@ -527,7 +527,7 @@ class DSWMultiSummaryScreen : public DScreenJob
}
ds.Format("%d", pp->KilledPlayer[j]);
DisplayMiniBarSmString(x, y, pal, ds);
MNU_DrawSmallString(x, y, ds, 0, pal);
x += STAT_TABLE_XOFF;
}
@ -541,13 +541,13 @@ class DSWMultiSummaryScreen : public DScreenJob
y += STAT_OFF_Y;
ds.Format(" %s", GStrings("DEATHS"));
DisplayMiniBarSmString(x, y, 0, ds);
MNU_DrawSmallString(x, y, ds, 0, 0);
x = STAT_TABLE_X;
for (int j = 0; j < cols; j++)
{
ds.Format("%d", death_total[j]);
DisplayMiniBarSmString(x, y, 0, ds);
MNU_DrawSmallString(x, y, ds, 0, 0);
x += STAT_TABLE_XOFF;
}
@ -563,7 +563,7 @@ class DSWMultiSummaryScreen : public DScreenJob
auto pp = Player + i;
ds.Format("%d", kills[i]); //pp->Kills);
DisplayMiniBarSmString(x, y, 0, ds);
MNU_DrawSmallString(x, y, ds, 0, 0);
y += STAT_OFF_Y;
}

View file

@ -122,21 +122,12 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double xpos, doub
switch (fontnum)
{
case NIT_BigFont:
MNU_MeasureStringLarge(text, &w, &h);
if (flags & LMF_Centered) xpos -= w/2;
MNU_DrawStringLarge(short(xpos), short(ypos), text, state == NIT_InactiveState? 20 : 0);
MNU_DrawStringLarge(short(xpos), short(ypos), text, state == NIT_InactiveState? 20 : 0, (flags & LMF_Centered)? 0 : -1);
break;
case NIT_SmallFont:
MNU_MeasureString(text, &w, &h);
if (flags & LMF_Centered) xpos -= w/2;
MNU_DrawString(short(xpos), short(ypos), text, state == NIT_InactiveState? 20 : 0, 16);
break;
case NIT_TinyFont:
MNU_MeasureSmallString(text, &w, &h);
if (flags & LMF_Centered) xpos -= w/2;
MNU_DrawSmallString(short(xpos), short(ypos), text, state == NIT_InactiveState? 20 : 0, 16);
default:
MNU_DrawString(short(xpos), short(ypos), text, state == NIT_InactiveState? 20 : 0, 16, (flags & LMF_Centered) ? 0 : -1);
break;
}
if (state == NIT_SelectedState)
@ -157,9 +148,8 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double xpos, doub
x -= ((tilesiz[pic_yinyang].x) / 2) - 3;
y += 8;
}
rotatesprite(x << 16, y << 16,
scale, 0, pic_yinyang, 2, 0, MenuDrawFlags, 0, 0, xdim - 1, ydim - 1);
DrawTexture(twod, tileGetTexture(pic_yinyang, true), x, y, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_CenterOffset, true, DTA_Color, 0xfff0f0f0, DTA_ScaleX, scale / 65536., DTA_ScaleY, scale / 65536., TAG_DONE);
}
}
@ -258,28 +248,7 @@ void GameInterface::DrawMenuCaption(const DVector2& origin, const char* text)
// Draw the backdrop bar
rotatesprite(10 << 16, (5-3) << 16, 65536, 0, 2427,
2, 0, MenuDrawFlags|RS_TOPLEFT, 0, 0, xdim - 1, ydim - 1);
MNU_MeasureStringLarge(text, &w, &h);
MNU_DrawStringLarge(TEXT_XCENTER(w), 5, text, 1);
}
void GameInterface::DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool bg)
{
if (text)
{
short width, height = 0;
MNU_MeasureString("T", &width, &height);
auto lines = FString(text).Split("\n");
int y = 100 - (height * lines.Size() / 2);
for (auto& l : lines)
{
short lheight = 0;
MNU_MeasureString(l, &width, &lheight);
int x = 160 - width / 2;
MNU_DrawString(x, y, l, 0, 0);
y += height;
}
}
MNU_DrawStringLarge(160, 5, text, 1, 0);
}

View file

@ -1357,31 +1357,6 @@ FString GameInterface::GetCoordString()
return out;
}
SWBOOL DebugSecret = FALSE;
void SecretInfo(PLAYERp pp)
{
if (!hud_stats) return;
#define Y_STEP 7
#define AVERAGEFRAMES 16
int x = windowxy1.x+2;
int y = windowxy1.y+2+8;
extern short LevelSecrets,TotalKillable;
if (CommEnabled || numplayers > 1)
return;
x = x / (xdim/320.0);
y = y / (ydim/200.0);
if (hud_stats)
{
sprintf(ds, "Kills %d/%d", Player->Kills, TotalKillable);
DisplayMiniBarSmString(x, y, PAL_XLAT_BROWN, ds);
sprintf(ds, "Secrets %d/%d", Player->SecretsFound, LevelSecrets);
DisplayMiniBarSmString(x, y+10, PAL_XLAT_BROWN, ds);
}
}
void PrintSpriteInfo(PLAYERp pp)
{
@ -2139,17 +2114,13 @@ drawscreen(PLAYERp pp)
DrawCrosshair(pp);
operatefta(); // Draw all the user quotes in the quote array
operateconfta(); // Draw messages in the console
DoPlayerDiveMeter(pp); // Do the underwater breathing bar
// Boss Health Meter, if Boss present
BossHealthMeter();
if (!M_Active())
SecretInfo(pp);
//if (!M_Active())
videoNextPage();
@ -2167,14 +2138,7 @@ drawscreen(PLAYERp pp)
if (paused && !M_Active())
{
short w,h;
#define MSG_GAME_PAUSED "Game Paused"
MNU_MeasureString(MSG_GAME_PAUSED, &w, &h);
PutStringTimer(pp, TEXT_TEST_COL(w), 100, MSG_GAME_PAUSED, 999);
}
else
{
pClearTextLine(pp, 100);
MNU_DrawString(160, 100, "Game Paused", 0, 0, 0);
}
if (!CommEnabled && TEST(pp->Flags, PF_DEAD))

View file

@ -348,18 +348,6 @@ bool LoadLevel(const char *filename)
return true;
}
void DisplayDemoText(void)
{
short w,h;
short i;
for (i = 0; i < 3; i++)
{
MNU_MeasureString(DemoText[i], &w, &h);
PutStringTimer(Player, TEXT_TEST_COL(w), DemoTextYstart+(i*12), DemoText[i], 999);
}
}
void MultiSharewareCheck(void)
{
if (!SW_SHAREWARE) return;
@ -467,6 +455,7 @@ bool InitGame()
}
TileFiles.LoadArtSet("tiles%03d.art");
InitFonts();
Connect();
SortBreakInfo();
@ -759,11 +748,6 @@ InitLevel(void)
SongLevelNum = Level;
if (DemoMode)
{
DisplayDemoText();
}
// reset NewGame
NewGame = FALSE;
}
@ -994,12 +978,10 @@ void MenuLevel(void)
if (CommEnabled)
{
sprintf(ds,"Lo Wang is waiting for other players...");
MNU_MeasureString(ds, &w, &h);
MNU_DrawString(TEXT_TEST_COL(w), 170, ds, 1, 16);
MNU_DrawString(160, 170, ds, 1, 16, 0);
sprintf(ds,"They are afraid!");
MNU_MeasureString(ds, &w, &h);
MNU_DrawString(TEXT_TEST_COL(w), 180, ds, 1, 16);
MNU_DrawString(160, 180, ds, 1, 16, 0);
}
videoNextPage();
@ -1701,7 +1683,7 @@ FunctionKeys(PLAYERp pp)
short pnum;
sprintf(ds,"SENT: %s",**CombatMacros[fn_key-1]);
adduserquote(ds);
Printf(PRINT_NOTIFY | PRINT_TEAMCHAT, "%s\n", ds);
TRAVERSE_CONNECT(pnum)
{
@ -2250,12 +2232,12 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
if (ScrollMode2D)
{
minigametext(txt_x,txt_y-7,"Follow Mode",2+8);
MNU_DrawSmallString(txt_x, txt_y - 7, "Follow Mode", 0, 0);
}
sprintf(ds,"%s",currentLevel->DisplayName());
minigametext(txt_x,txt_y,ds,2+8);
MNU_DrawSmallString(txt_x,txt_y,ds,0, 0);
//////////////////////////////////

View file

@ -830,34 +830,8 @@ SWBOOL DLL_ExecFunc(int procHandle, char *fName);
// JPlayer
//
///////////////////////////////////////////////////////////////////////////////////////////
#define MESSAGE_LINE 142 // Used to be 164
#define MAXUSERQUOTES 6
#define MAXCONQUOTES 13
extern int quotebot, quotebotgoal;
extern short user_quote_time[MAXUSERQUOTES];
extern char user_quote[MAXUSERQUOTES][256];
extern int conbot, conbotgoal;
extern char con_quote[MAXCONQUOTES][256];
int minitext(int x,int y,char *t,char p,char sb);
int minitextshade(int x,int y,char *t,char s,char p,char sb);
void operatefta(void);
void adduserquote(const char *daquote);
void operateconfta(void);
void addconquote(const char *daquote);
///////////////////////////////////////////////////////////////////////////////////////////
//
// Console
//
///////////////////////////////////////////////////////////////////////////////////////////
void CON_StoreArg(const char *userarg);
SWBOOL CON_CheckParm(const char *userarg);
void CON_CommandHistory(signed char dir);
SWBOOL CON_AddCommand(const char *command, void (*function)(void));
void CON_ProcessUserCommand(void);
///////////////////////////////////////////////////////////////////////////////////////////
//
@ -2263,23 +2237,6 @@ extern USER puser[MAX_SW_PLAYERS_REG];
#define TEXT_TEST_COL(width) TEXT_XCENTER(width)
#define TEXT_TEST_TIME 2
void PutStringTimer(PLAYERp pp, short x, short y, const char *string, short seconds);
///////////////////////////
//
// OLDER network additions
//
///////////////////////////
/*
int initmultiplayers(int, int, int);
void uninitmultiplayers(void);
void sendlogon(void);
void sendlogoff(void);
*/
///////////////////////////
//
// RECENT network additions
@ -2356,7 +2313,6 @@ void post_analyzesprites(void); // draw.c
int COVERsetgamemode(int mode, int xdim, int ydim, int bpp); // draw.c
void ScreenCaptureKeys(void); // draw.c
int minigametext(int x,int y,const char *t,short dabits); // jplayer.c
void computergetinput(int snum,SW_PACKET *syn); // jplayer.c
void DrawOverlapRoom(int tx,int ty,int tz,fix16_t tq16ang,fix16_t tq16horiz,short tsectnum); // rooms.c
@ -2421,6 +2377,7 @@ extern short LastSaveNum;
void LoadSaveMsg(const char *msg);
void UpdateStatusBar(ClockTicks arg);
void InitFonts();
extern int PlayClock;
extern short LevelSecrets;
@ -2447,7 +2404,6 @@ struct GameInterface : ::GameInterface
void StartGame(FNewGameStartup& gs) override;
FSavegameInfo GetSaveSig() override;
void DrawMenuCaption(const DVector2& origin, const char* text) override;
void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool bg) override;
bool CleanupForLoad() override;
bool LoadGame(FSaveGameNode* sv) override;
bool SaveGame(FSaveGameNode* sv) override;

View file

@ -1,299 +0,0 @@
//-------------------------------------------------------------------------
/*
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
*/
//-------------------------------------------------------------------------
// JPLAYER.C
// Copyright (c) 1996 by Jim Norwood
#include "ns.h"
#include "build.h"
#include "mytypes.h"
#include "names2.h"
#include "panel.h"
#include "game.h"
#include "tags.h"
#include "player.h"
#include "lists.h"
#include "quake.h"
#include "gamecontrol.h"
#include "menus.h"
#include "network.h"
#include "pal.h"
#include "bots.h"
BEGIN_SW_NS
SWBOOL WeaponOK(PLAYERp pp);
#define MAXANGVEL 80
// From build.h
#define CLIPMASK0 (((1L)<<16)+1L)
#define CLIPMASK1 (((256L)<<16)+64L)
// PLAYER QUOTES TO OTHER PLAYERS ////////////////////////////////////////////////////////////
#define STARTALPHANUM 4608 // New SW font for typing in stuff, It's in ASCII order.
#define ENDALPHANUM 4701
#define MINIFONT 2930 // Start of small font, it's blue for good palette swapping
#define NUMPAGES 1
#define NUMOFFIRSTTIMEACTIVE 100 // You can save up to 100 strings in the message history queue
char pus, pub; // Global text vars
char fta_quotes[NUMOFFIRSTTIMEACTIVE][64];
int gametext(int x,int y,char *t,char s,short dabits)
{
short ac,newx;
char centre, *oldt;
centre = (x == (320>>1));
newx = 0;
oldt = t;
if (centre)
{
while (*t)
{
if (*t == 32) {newx+=5; t++; continue; }
else ac = *t - '!' + STARTALPHANUM;
if (ac < STARTALPHANUM || ac > ENDALPHANUM) break;
if (*t >= '0' && *t <= '9')
newx += 8;
else newx += tilesiz[ac].x;
t++;
}
t = oldt;
x = (320>>1)-(newx>>1);
}
while (*t)
{
if (*t == 32) {x+=5; t++; continue; }
else ac = *t - '!' + STARTALPHANUM;
if (ac < STARTALPHANUM || ac > ENDALPHANUM)
break;
rotatesprite(x<<16,y<<16,65536L,0,ac,s,16,dabits,0,0,xdim-1,ydim-1);
if (*t >= '0' && *t <= '9')
x += 8;
else x += tilesiz[ac].x;
t++;
}
return x;
}
int minigametext(int x,int y,const char *t,short dabits)
{
short ac,newx;
char centre;
const char *oldt;
centre = (x == (320>>1));
newx = 0;
oldt = t;
if (centre)
{
while (*t)
{
if (*t == 32) {newx+=4; t++; continue; }
else ac = *t - '!' + 2930;
if (*t > asc_Space && *t < 127)
{
newx += tilesiz[ac].x;
}
else
x += 4;
t++;
}
t = oldt;
x = (320>>1)-(newx>>1);
}
while (*t)
{
if (*t == 32) {x+=4; t++; continue; }
else ac = *t - '!' + 2930;
if (*t > asc_Space && *t < 127)
{
rotatesprite(x<<16,y<<16,65536L,0,ac,-128,17,dabits,0,0,xdim-1,ydim-1);
x += tilesiz[ac].x;
}
else
x += 4;
t++;
}
return x;
}
int minitext(int x,int y,char *t,char p,char sb)
{
short ac;
while (*t)
{
*t = toupper(*t);
if (*t == 32) {x+=5; t++; continue; }
else ac = *t - '!' + MINIFONT;
rotatesprite(x<<16,y<<16,65536L,0,ac,0,p,sb,0,0,xdim-1,ydim-1);
x += 4; // tilesiz[ac].x+1;
t++;
}
return x;
}
int minitextshade(int x,int y,char *t,char s,char p,char sb)
{
short ac;
while (*t)
{
*t = toupper(*t);
if (*t == 32) {x+=5; t++; continue; }
else ac = *t - '!' + MINIFONT;
rotatesprite(x<<16,y<<16,65536L,0,ac,s,p,sb,0,0,xdim-1,ydim-1);
x += 4; // tilesiz[ac].x+1;
t++;
}
return x;
}
int quotebot, quotebotgoal;
short user_quote_time[MAXUSERQUOTES];
char user_quote[MAXUSERQUOTES][256];
void adduserquote(const char *daquote)
{
int i;
for (i=MAXUSERQUOTES-1; i>0; i--)
{
strcpy(user_quote[i],user_quote[i-1]);
user_quote_time[i] = user_quote_time[i-1];
}
strcpy(user_quote[0],daquote);
user_quote_time[0] = 180;
}
void operatefta(void)
{
int i, j, k;
j=MESSAGE_LINE; // Base line position on screen
quotebot = min(quotebot,j);
quotebotgoal = min(quotebotgoal,j);
quotebotgoal = j;
j = quotebot;
for (i=0; i<MAXUSERQUOTES; i++)
{
k = user_quote_time[i];
if (k <= 0)
break;
if (gs.BorderNum <= BORDER_BAR+1)
{
// dont fade out
if (k > 4)
minigametext(320>>1,j,user_quote[i],2+8);
else if (k > 2)
minigametext(320>>1,j,user_quote[i],2+8+1);
else
minigametext(320>>1,j,user_quote[i],2+8+1+32);
}
else
{
// dont fade out
minigametext(320>>1,j,user_quote[i],2+8);
}
j -= 6;
}
}
//////////// Console Message Queue ////////////////////////////////////
int conbot, conbotgoal;
char con_quote[MAXCONQUOTES][256];
void addconquote(const char *daquote)
{
int i;
for (i=MAXCONQUOTES-1; i>0; i--)
{
strcpy(con_quote[i],con_quote[i-1]);
}
strcpy(con_quote[0],daquote);
}
#define CON_ROT_FLAGS (RS_TOPLEFT|ROTATE_SPRITE_SCREEN_CLIP|ROTATE_SPRITE_NON_MASK)
void operateconfta(void)
{
int i, j;
if (!ConPanel) return; // If panel isn't up, don't draw anything
// Draw the background console pic
rotatesprite((0)<<16,(0)<<16,65536L,0,5119,0,0,CON_ROT_FLAGS,0,0,xdim-1,ydim-1);
j=99; // Base line position on screen
conbot = min(conbot,j);
conbotgoal = min(conbotgoal,j);
if (ConInputMode) j -= 6; // Bump all lines up one to make room for new line
conbotgoal = j; j = conbot;
for (i=0; i<MAXCONQUOTES; i++)
{
MNU_DrawSmallString(27, j, con_quote[i], 0, 17); // 17 = white
j -= 6;
}
}
END_SW_NS

View file

@ -318,30 +318,21 @@ SWBOOL MNU_ShareWareMessage()
if (SW_SHAREWARE)
{
extra_text = "Be sure to call 800-3DREALMS today";
MNU_MeasureString(extra_text, &w, &h);
MNU_DrawString(TEXT_XCENTER(w), 110, extra_text, 1, 16);
MNU_DrawString(160, 110, extra_text, 1, 16, 0);
extra_text = "and order the game.";
MNU_MeasureString(extra_text, &w, &h);
MNU_DrawString(TEXT_XCENTER(w), 120, extra_text, 1, 16);
MNU_DrawString(160, 120, extra_text, 1, 16, 0);
extra_text = "You are only playing the first ";
MNU_MeasureString(extra_text, &w, &h);
MNU_DrawString(TEXT_XCENTER(w), 130, extra_text, 1, 16);
MNU_DrawString(160, 130, extra_text, 1, 16, 0);
extra_text = "four levels, and are missing most";
MNU_MeasureString(extra_text, &w, &h);
MNU_DrawString(TEXT_XCENTER(w), 140, extra_text, 1, 16);
MNU_DrawString(160, 140, extra_text, 1, 16, 0);
extra_text = "of the game, weapons and monsters.";
MNU_MeasureString(extra_text, &w, &h);
MNU_DrawString(TEXT_XCENTER(w), 150, extra_text, 1, 16);
MNU_DrawString(160, 150, extra_text, 1, 16, 0);
extra_text = "See the ordering information.";
MNU_MeasureString(extra_text, &w, &h);
MNU_DrawString(TEXT_XCENTER(w), 160, extra_text, 1, 16);
MNU_DrawString(160, 160, extra_text, 1, 16, 0);
//SET(item->flags, mf_disabled);
}
return TRUE;
}
#if 0
#endif
END_SW_NS

View file

@ -32,12 +32,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
void MNU_MeasureString(const char* string, short* w, short* h);
void MNU_DrawString(short x, short y, const char* string, short shade, short pal, int align = -1);
void MNU_MeasureSmallString(const char* string, short* w, short* h);
void MNU_DrawSmallString(short x, short y, const char* string, short shade, short pal);
void MNU_MeasureStringLarge(const char* string, short* w, short* h);
void MNU_DrawStringLarge(short x, short y, const char* string, int shade = 0);
void MNU_DrawString(int x, int y, const char* string, int shade, int pal, int align = -1);
void MNU_DrawSmallString(int x, int y, const char* string, int shade, int pal, int align = -1, double alpha = 1);
void MNU_DrawStringLarge(int x, int y, const char* string, int shade = 0, int align = -1);
#define pic_none 0
#define pic_radiobuttn1 2816

View file

@ -51,16 +51,10 @@ void MoveSectorObjects(SECTOR_OBJECTp sop, short locktics);
#define TEXT_INFO_TIME (3)
#define TEXT_INFO_Y (40)
#define TEXT_INFO_YOFF (10)
inline int TEXT_INFO_LINE(int line) { return (TEXT_INFO_Y + ((line)*TEXT_INFO_YOFF)); }
inline constexpr int TEXT_INFO_LINE(int line) { return (TEXT_INFO_Y + ((line)*TEXT_INFO_YOFF)); }
void DisplayMiniBarSmString(short xs, short ys, short pal, const char* buffer);
void PutStringInfo(PLAYERp pp, const char* string);
void PutStringInfoLine(PLAYERp pp, const char* string);
void PutStringInfoLine2(PLAYERp pp, const char* string);
void pClearTextLine(PLAYERp pp, int y);
void pMenuClearTextLine(PLAYERp pp);
void StringTimer(PANEL_SPRITEp psp);
short DoSlidorMatch(PLAYERp pp, short match, SWBOOL);
SWBOOL TestSlidorMatchActive(short match);

View file

@ -522,23 +522,6 @@ CheckVersion(int GameVersion)
{
Printf("CheckVersion(): player %d has version %d, expecting %d\n",
pnum, Player[pnum].PlayerVersion, GameVersion);
adduserquote(VERSION_MSG);
adduserquote(VERSION_MSG);
adduserquote(VERSION_MSG);
adduserquote(VERSION_MSG);
adduserquote(VERSION_MSG);
adduserquote(VERSION_MSG);
if (!Player[pnum].PlayerVersion)
{
SW_SendMessage(pnum, VERSION_MSG);
SW_SendMessage(pnum, VERSION_MSG);
SW_SendMessage(pnum, VERSION_MSG);
SW_SendMessage(pnum, VERSION_MSG);
SW_SendMessage(pnum, VERSION_MSG);
SW_SendMessage(pnum, VERSION_MSG);
}
}
}
}
@ -651,7 +634,7 @@ SWBOOL MyCommPlayerQuit(void)
if (i != myconnectindex)
{
sprintf(ds,"%s has quit the game.",Player[i].PlayerName);
adduserquote(ds);
Printf(PRINT_NOTIFY | PRINT_TEAMCHAT, "%s\n", ds);
}
}
}
@ -1340,7 +1323,7 @@ getpackets(void)
memcpy(ds,&packbuf[3],packbufleng-3);
ds[packbufleng-3] = 0;
//sprintf(ds, "%s",&packbuf[3]);
adduserquote(ds);
Printf(PRINT_NOTIFY | PRINT_TEAMCHAT, "%s\n", ds);
break;
}

View file

@ -7396,7 +7396,6 @@ static saveable_code saveable_panel_code[] =
SAVE_CODE(SwordBlur),
SAVE_CODE(SpecialUziRetractFunc),
SAVE_CODE(FistBlur),
SAVE_CODE(StringTimer),
};
static saveable_data saveable_panel_data[] =

View file

@ -6474,7 +6474,7 @@ DoPlayerDeathMessage(PLAYERp pp, PLAYERp killer)
TRAVERSE_CONNECT(pnum)
{
if (pnum == myconnectindex)
adduserquote(ds);
Printf(PRINT_NOTIFY|PRINT_TEAMCHAT, "%s\n", ds);
else
SW_SendMessage(pnum, ds);
}
@ -6489,7 +6489,6 @@ DoPlayerBeginDie(PLAYERp pp)
extern SWBOOL ReloadPrompt;
short bak;
int choosesnd = 0;
extern short GlobInfoStringTime;
USERp u = User[pp->PlayerSprite];
@ -6533,10 +6532,7 @@ DoPlayerBeginDie(PLAYERp pp)
else
#endif
{
bak = GlobInfoStringTime;
GlobInfoStringTime = 999;
PutStringInfo(pp, GStrings("TXTS_PRESSSPACE"));
GlobInfoStringTime = bak;
}
if (pp->sop_control)
@ -6873,8 +6869,6 @@ void DoPlayerDeathCheckKeys(PLAYERp pp)
InitBloodSpray(pp->PlayerSprite,TRUE,-1);
}
pClearTextLine(pp, TEXT_INFO_LINE(0));
PlayerSpawnPosition(pp);
NewStateGroup(pp->PlayerSprite, u->ActorActionSet->Stand);
@ -7754,47 +7748,6 @@ void PlayerGlobal(PLAYERp pp)
}
void UpdateScrollingMessages(void)
{
short i;
// Update the scrolling multiplayer messages
for (i=0; i<MAXUSERQUOTES; i++)
{
if (user_quote_time[i])
{
user_quote_time[i]--;
if (user_quote_time[i] <= 0)
{
user_quote_time[i] = 0;
}
}
}
if (gs.BorderNum > BORDER_BAR+1)
{
quotebot = quotebotgoal;
}
else
{
if ((klabs(quotebotgoal-quotebot) <= 16))
quotebot += ksgn(quotebotgoal-quotebot);
else
quotebot = quotebotgoal;
}
}
void UpdateConMessages(void)
{
if (!ConInputMode) return;
if ((klabs(conbotgoal-conbot) <= 12))
conbot += ksgn(conbotgoal-conbot);
else
conbot = conbotgoal;
}
void MultiPlayLimits(void)
{
short pnum;
@ -7842,6 +7795,7 @@ void MultiPlayLimits(void)
void PauseMultiPlay(void)
{
#if 0
static SWBOOL SavePrediction;
PLAYERp pp;
short pnum,p;
@ -7861,13 +7815,6 @@ void PauseMultiPlay(void)
if (paused)
{
short w,h;
auto m = GStrings("Game Paused");
MNU_MeasureString(m, &w, &h);
TRAVERSE_CONNECT(p)
PutStringTimer(Player + p, TEXT_TEST_COL(w), 100, m, 999);
SavePrediction = PredictionOn;
PredictionOn = FALSE;
}
@ -7875,7 +7822,6 @@ void PauseMultiPlay(void)
{
PredictionOn = SavePrediction;
TRAVERSE_CONNECT(p)
pClearTextLine(Player + p, 100);
}
}
}
@ -7884,6 +7830,7 @@ void PauseMultiPlay(void)
FLAG_KEY_RESET(pp, SK_PAUSE);
}
}
#endif
}
void
@ -7914,9 +7861,6 @@ domovethings(void)
if (MyCommPlayerQuit())
return;
UpdateScrollingMessages(); // Update the multiplayer type messages
UpdateConMessages(); // Update the console messages
#if SYNC_TEST
if (/* CTW REMOVED !gTenActivated ||*/ !(movefifoplc & 0x3f))
getsyncstat();

View file

@ -79,7 +79,6 @@ void Saveable_Init(void)
MODULE(zombie)
MODULE(sector)
MODULE(text)
}
int Saveable_FindCodeSym(void *ptr, savedcodesym *sym)

View file

@ -38,6 +38,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "v_2ddrawer.h"
#include "statusbar.h"
#include "network.h"
#include "v_draw.h"
#include "menus.h"
BEGIN_SW_NS
@ -64,6 +67,7 @@ static const short icons[] = {
class DSWStatusBar : public DBaseStatusBar
{
DHUDFont miniFont;
enum
{
@ -137,6 +141,14 @@ class DSWStatusBar : public DBaseStatusBar
ID_SelectionBox = 2435,
};
public:
DSWStatusBar()
{
miniFont = { SmallFont2, 0, Off, 1, 1 };
}
private:
//---------------------------------------------------------------------------
//
//
@ -224,23 +236,7 @@ class DSWStatusBar : public DBaseStatusBar
void DisplayTinyString(double xs, double ys, const char* buffer, int pal)
{
double x;
const char* ptr;
const int FRAG_FIRST_ASCII = ('!');
const int FRAG_FIRST_TILE = 2930;
for (ptr = buffer, x = xs; *ptr; ptr++)
{
if (*ptr == ' ')
continue;
assert(*ptr >= '!' && *ptr <= '}');
auto tex = tileGetTexture(FRAG_FIRST_TILE + (*ptr - FRAG_FIRST_ASCII));
DrawGraphic(tex, x, ys, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1, 0xffffffff, TRANSLATION(Translation_Remap, pal));
x += 4;
}
SBar_DrawString(this, &miniFont, buffer, xs, ys, DI_ITEM_LEFT_TOP, TRANSLATION(Translation_Remap, pal), 1, -1, -1, 1, 1);
}
void DisplayFragString(PLAYERp pp, double xs, double ys, const char* buffer)
@ -846,6 +842,34 @@ public:
};
#if 0
SWBOOL DebugSecret = FALSE;
void SecretInfo(PLAYERp pp)
{
if (!hud_stats) return;
#define Y_STEP 7
#define AVERAGEFRAMES 16
int x = windowxy1.x + 2;
int y = windowxy1.y + 2 + 8;
extern short LevelSecrets, TotalKillable;
if (CommEnabled || numplayers > 1)
return;
x = x / (xdim / 320.0);
y = y / (ydim / 200.0);
if (hud_stats)
{
sprintf(ds, "Kills %d/%d", Player->Kills, TotalKillable);
MNU_DrawSmallString(x, y, PAL_XLAT_BROWN, ds);
sprintf(ds, "Secrets %d/%d", Player->SecretsFound, LevelSecrets);
MNU_DrawSmallString(x, y + 10, PAL_XLAT_BROWN, ds);
}
}
#endif
static void UpdateFrame(void)
{
@ -863,6 +887,15 @@ static void UpdateFrame(void)
twod->AddFlatFill(windowxy1.x - 3, windowxy2.y + 1, windowxy2.x + 1, windowxy2.y + 4, tex, 0, 1, 0xff2a2a2a);
}
static FString cookieQuote;
static int cookieTime;
void adduserquote(const char* daquote)
{
cookieQuote = daquote;
cookieTime = totalclock + 540;
}
void UpdateStatusBar(ClockTicks arg)
{
DSWStatusBar sbar;
@ -873,6 +906,11 @@ void UpdateStatusBar(ClockTicks arg)
}
sbar.UpdateStatusBar(arg);
if (totalclock < cookieTime)
{
const int MESSAGE_LINE = 142; // Used to be 164
MNU_DrawSmallString(160, MESSAGE_LINE, cookieQuote, 0, 0, 0, clamp((cookieTime - totalclock) / 60., 0., 1.));
}
}

View file

@ -6356,35 +6356,6 @@ KeyMain:
KillGetAmmo(SpriteNum);
break;
#if 0
case ICON_SPELL:
{
short w, h, select;
#define TEXT_SPELL_INFO_LINE 20
static int8_t* SpellName[] =
{
"Icon of Flight",
"EnvironSuit Skin",
"Strength",
"Cloak Device",
"Oxygen",
"Night Vision"
};
select = RANDOM_P2(4 << 8) >> 8; // Not allowed to get
// last two items.
MNU_MeasureString(SpellName[sp->lotag], &w, &h);
PutStringTimer(pp, TEXT_TEST_COL(w), TEXT_SPELL_INFO_LINE, SpellName[sp->lotag], TEXT_TEST_TIME);
if (pp == Player+myconnectindex)
PlaySound(DIGI_ITEM, sp, v3df_dontpan);
KillGet(SpriteNum);
break;
}
#endif
case ICON_HEAT_CARD:
if (pp->WpnRocketHeat != 5)
{

View file

@ -394,16 +394,13 @@ SyncStatMessage(void)
}
else
{
short w,h;
// production out of sync error
sprintf(ds,"GAME OUT OF SYNC!");
MNU_MeasureString(ds, &w, &h);
MNU_DrawString(TEXT_TEST_COL(w), 20, ds, 0, 19);
MNU_DrawString(160, 20, ds, 0, 19, 0);
sprintf(ds,"Restart the game.");
MNU_MeasureString(ds, &w, &h);
MNU_DrawString(TEXT_TEST_COL(w), 30, ds, 0, 19);
MNU_DrawString(160, 30, ds, 0, 19, 0);
}
}
}

View file

@ -24,8 +24,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#include "ns.h"
#undef MAIN
#include "build.h"
#include "names2.h"
#include "panel.h"
@ -36,479 +34,161 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "menus.h"
#include "network.h"
#include "v_font.h"
#include "v_draw.h"
BEGIN_SW_NS
#define PANEL_FONT_G 3636
#define PANEL_FONT_Y 3646
#define PANEL_FONT_R 3656
#define PANEL_SM_FONT_G 3601
#define PANEL_SM_FONT_Y 3613
#define PANEL_SM_FONT_R 3625
PANEL_SPRITEp pClearTextLineID(PLAYERp pp, short id, int y, short pri)
{
PANEL_SPRITEp psp=NULL, next;
TRAVERSE(&pp->PanelSpriteList, psp, next)
{
// early out
if (psp->priority > pri)
return NULL;
if (psp->ID == id && psp->y == y && psp->priority == pri)
{
pSetSuicide(psp);
}
}
return NULL;
}
// only call this from menu code - it does a pKillSprite
PANEL_SPRITEp pMenuClearTextLineID(PLAYERp pp, short id, int y, short pri)
{
PANEL_SPRITEp psp=NULL, next;
TRAVERSE(&pp->PanelSpriteList, psp, next)
{
// early out
if (psp->priority > pri)
return NULL;
if (psp->ID == id && psp->y == y && psp->priority == pri)
{
pKillSprite(psp);
}
}
return NULL;
}
void pClearTextLine(PLAYERp pp, int y)
{
pClearTextLineID(pp, ID_TEXT, y, PRI_FRONT_MAX);
}
void StringTimer(PANEL_SPRITEp psp)
{
if ((psp->kill_tics -= synctics) <= 0)
{
pKillSprite(psp);
return;
}
}
void PutStringTimer(PLAYERp pp, short x, short y, const char *string, short seconds)
{
int ndx, offset;
char c;
PANEL_SPRITEp nsp;
long kill_tics;
short id, ac;
PANEL_SPRITE_FUNCp func;
offset = x;
if (seconds == 999)
{
pClearTextLineID(pp, ID_TEXT, y, PRI_FRONT_MAX);
func = NULL;
kill_tics = 0;
id = ID_TEXT;
}
else
{
pClearTextLineID(pp, ID_TEXT, y, PRI_FRONT_MAX);
func = StringTimer;
kill_tics = seconds * 120;
id = ID_TEXT;
}
// Temporarily disabled because this uses a feature of the panel system that needs to be removed before this can be refactored.
#if 0
for (ndx = 0; (c = string[ndx]) != 0; ndx++)
{
ac = c - '!' + STARTALPHANUM;
if ((ac < STARTALPHANUM || ac > ENDALPHANUM) && c != asc_Space)
break;
if (c > asc_Space && c < 127)
{
nsp = pSpawnFullViewSprite(pp, ac, PRI_FRONT_MAX, offset, y);
nsp->PanelSpriteFunc = func;
nsp->kill_tics = kill_tics;
nsp->ID = id;
offset += tilesiz[ac].x;
}
else if (c == asc_Space)
offset += 4; // Special case for space char
}
#endif
}
void KillString(PLAYERp pp, short y)
{
pClearTextLineID(pp, ID_TEXT, y, PRI_FRONT_MAX);
}
PANEL_SPRITEp pClearSpriteXY(PLAYERp pp, short x, short y)
{
PANEL_SPRITEp psp=NULL, next;
TRAVERSE(&pp->PanelSpriteList, psp, next)
{
if (psp->x == x && psp->y == y)
pSetSuicide(psp);
}
return NULL;
}
PANEL_SPRITEp pClearSpriteID(PLAYERp pp, short id)
{
PANEL_SPRITEp psp=NULL, next;
TRAVERSE(&pp->PanelSpriteList, psp, next)
{
if (psp->ID == id)
pSetSuicide(psp);
}
return NULL;
}
void
DisplayMiniBarSmString(short xs, short ys, short pal, const char *buffer)
{
short size=4,x;
const char *ptr;
short pic;
#define FRAG_FIRST_ASCII ('!') //exclamation point
#define FRAG_FIRST_TILE 2930 //exclamation point
for (ptr = buffer, x = xs; *ptr; ptr++, x += size)
{
if (*ptr == ' ')
continue;
ASSERT(*ptr >= '!' && *ptr <= '}');
pic = FRAG_FIRST_TILE + (*ptr - FRAG_FIRST_ASCII);
rotatesprite((int)x << 16, (int)ys << 16, (1 << 16), 0, pic, 0, pal,
ROTATE_SPRITE_SCREEN_CLIP | RS_TOPLEFT | RS_ALIGN_L,
0, 0, xdim - 1, ydim - 1);
}
}
////////////////////////////////////////////////
// Measure the pixel width of a graphic string
////////////////////////////////////////////////
static char lg_xlat_num[] = { 0,1,2,3,4,5,6,7,8,9 };
#define FONT_LARGE_ALPHA 3706
#define FONT_LARGE_DIGIT 3732
#define MenuDrawFlags (ROTATE_SPRITE_SCREEN_CLIP)
#define MZ 65536
#define MENU_SHADE_DEFAULT 0
#define MENU_SHADE_INACTIVE 20
void MNU_MeasureStringLarge(const char* string, short* w, short* h)
{
short ndx, width, height;
char c;
short pic;
width = 0;
height = *h;
for (ndx = 0; (c = string[ndx]) != 0; ndx++)
{
if (isalpha(c))
{
c = toupper(c);
pic = FONT_LARGE_ALPHA + (c - 'A');
}
else if (isdigit(c))
{
pic = FONT_LARGE_DIGIT + lg_xlat_num[(c - '0')];
}
else if (c == ' ')
{
width += 10; // Special case for space char
continue;
}
else
{
continue;
}
width += tilesiz[pic].x + 1;
if (height < tilesiz[pic].y)
height = tilesiz[pic].y;
}
*w = width;
*h = height;
}
////////////////////////////////////////////////
// Draw a string using a graphic font
////////////////////////////////////////////////
void MNU_DrawStringLarge(short x, short y, const char* string, int shade)
{
int ndx, offset;
char c;
short pic;
offset = x;
for (ndx = 0; (c = string[ndx]) != 0; ndx++)
{
if (isalpha(c))
{
c = toupper(c);
pic = FONT_LARGE_ALPHA + (c - 'A');
}
else if (isdigit(c))
{
pic = FONT_LARGE_DIGIT + lg_xlat_num[(c - '0')];
}
else if (c == ' ')
{
offset += 10;
continue;
}
else
{
continue;
}
rotatesprite(offset << 16, y << 16, MZ, 0, pic, shade, 0, MenuDrawFlags | RS_TOPLEFT, 0, 0, xdim - 1, ydim - 1);
offset += tilesiz[pic].x + 1;
}
}
////////////////////////////////////////////////
// Measure the pixel width of a graphic string
////////////////////////////////////////////////
void MNU_MeasureString(const char* string, short* w, short* h)
{
short ndx, width, height;
char c;
short ac;
if (string[0] == '^')
{
MNU_MeasureStringLarge(&string[1], w, h);
return;
}
width = 0;
height = *h;
for (ndx = 0; (c = string[ndx]) != 0; ndx++)
{
ac = c - '!' + STARTALPHANUM;
if ((ac < STARTALPHANUM || ac > ENDALPHANUM) && c != asc_Space)
break;
if (c > asc_Space && c < 127)
{
width += tilesiz[ac].x;
if (height < tilesiz[ac].y)
height = tilesiz[ac].y;
}
else if (c == asc_Space)
width += 4; // Special case for space char
}
*w = width;
*h = height;
}
////////////////////////////////////////////////
// Draw a string using a graphic font
//==========================================================================
//
// MenuTextShade and MenuDrawFlags
////////////////////////////////////////////////
void MNU_DrawString(short x, short y, const char* string, short shade, short pal, int align)
{
int ndx, offset;
char c;
short ac;
// Sets up the game fonts.
//
//==========================================================================
if (string[0] == '^')
void InitFonts()
{
MNU_DrawStringLarge(x, y, &string[1]);
return;
GlyphSet fontdata;
// Small font
for (int i = 0; i < 95; i++)
{
auto tile = tileGetTexture(STARTALPHANUM + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
fontdata.Insert('!' + i, tile);
tile->SetOffsetsNotForFont();
}
}
SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, 4, false, false, false, &fontdata);
fontdata.Clear();
// Tiny font
for (int i = 0; i < 95; i++)
{
auto tile = tileGetTexture(2930 + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
fontdata.Insert('!' + i, tile);
tile->SetOffsetsNotForFont();
}
}
SmallFont2 = new ::FFont("SmallFont2", nullptr, "defsmallfont2", 0, 0, 0, -1, 4, false, false, false, &fontdata);
fontdata.Clear();
const int FONT_LARGE_ALPHA = 3706;
const int FONT_LARGE_DIGIT = 3732;
// Big
for (int i = 0; i < 10; i++)
{
auto tile = tileGetTexture(FONT_LARGE_DIGIT + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
fontdata.Insert('0' + i, tile);
tile->SetOffsetsNotForFont();
}
}
for (int i = 0; i < 26; i++)
{
auto tile = tileGetTexture(FONT_LARGE_ALPHA + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
fontdata.Insert('A' + i, tile);
tile->SetOffsetsNotForFont();
}
}
BigFont = new ::FFont("BigFont", nullptr, "defbigfont", 0, 0, 0, -1, 10, false, false, false, &fontdata);
BigFont->SetKerning(1);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void MNU_DrawStringLarge(int x, int y, const char* string, int shade, int align)
{
if (align > -1)
{
short w, h;
MNU_MeasureString(string, &w, &h);
int w = BigFont->StringWidth(string);
if (align == 0) x -= w / 2;
else x -= w;
}
offset = x;
DrawText(twod, BigFont, CR_UNDEFINED, x, y, string, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_Color, shadeToLight(shade), TAG_DONE);
}
for (ndx = 0; (c = string[ndx]) != 0; ndx++)
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void MNU_DrawString(int x, int y, const char* string, int shade, int pal, int align)
{
ac = c - '!' + STARTALPHANUM;
if ((ac < STARTALPHANUM || ac > ENDALPHANUM) && c != asc_Space)
break;
if (c > asc_Space && c < 127)
if (align > -1)
{
rotatesprite(offset << 16, y << 16, MZ, 0, ac, shade, pal, MenuDrawFlags, 0, 0, xdim - 1, ydim - 1);
offset += tilesiz[ac].x;
int w = SmallFont->StringWidth(string);
if (align == 0) x -= w / 2;
else x -= w;
}
else if (c == asc_Space)
offset += 4; // Special case for space char
DrawText(twod, SmallFont, CR_UNDEFINED, x, y, string, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_Color, shadeToLight(shade), DTA_TranslationIndex, TRANSLATION(Translation_Remap, pal), TAG_DONE);
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
////////////////////////////////////////////////
// Measure the pixel width of a small font string
////////////////////////////////////////////////
void MNU_MeasureSmallString(const char* string, short* w, short* h)
void MNU_DrawSmallString(int x, int y, const char* string, int shade, int pal, int align, double alpha)
{
short ndx, width, height;
char c;
short ac;
width = 0;
height = *h;
for (ndx = 0; (c = string[ndx]) != 0; ndx++)
if (align > -1)
{
ac = (c - '!') + 2930;
if ((ac < 2930 || ac > 3023) && c != asc_Space)
break;
if (c > asc_Space && c < 127)
{
width += tilesiz[ac].x;
if (height < tilesiz[ac].y)
height = tilesiz[ac].y;
}
else if (c == asc_Space)
width += 4; // Special case for space char
}
*w = width;
*h = height;
}
////////////////////////////////////////////////
// Draw a string using a small graphic font
////////////////////////////////////////////////
void MNU_DrawSmallString(short x, short y, const char* string, short shade, short pal)
{
int ndx;
char c;
short ac, offset;
offset = x;
for (ndx = 0; (c = string[ndx]) != 0; ndx++)
{
ac = c - '!' + 2930;
if ((ac < 2930 || ac > 3023) && c != asc_Space)
break;
if (c > asc_Space && c < 127)
{
rotatesprite(offset << 16, y << 16, MZ, 0, ac, shade, pal, MenuDrawFlags, 0, 0, xdim - 1, ydim - 1);
offset += tilesiz[ac].x;
}
else if (c == asc_Space)
{
offset += 4; // Special case for space char
}
int w = SmallFont2->StringWidth(string);
if (align == 0) x -= w / 2;
else x -= w;
}
DrawText(twod, SmallFont2, CR_UNDEFINED, x, y, string, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_Color, shadeToLight(shade), DTA_TranslationIndex, TRANSLATION(Translation_Remap, pal), DTA_Alpha, alpha, TAG_DONE);
}
//---------------------------------------------------------------------------
//
// Notification messages. Native SW-style display should later be
// provided by the backend.
//
//---------------------------------------------------------------------------
short GlobInfoStringTime = TEXT_INFO_TIME;
void PutStringInfo(PLAYERp pp, const char *string)
{
if (pp-Player != myconnectindex)
return;
if (!hud_messages)
return;
if (pp-Player == myconnectindex && hud_messages)
Printf(PRINT_MEDIUM|PRINT_NOTIFY, "%s\n", string); // Put it in the console too
if (hud_messages == 1) PutStringInfoLine(pp, string);
}
#if 0 // kept as a reminder to reimplement a 'native' looking display option in the backend
void PutStringInfoLine(PLAYERp pp, const char *string)
{
short GlobInfoStringTime = TEXT_INFO_TIME;
short x,y;
short w,h;
if (pp-Player != myconnectindex)
return;
MNU_MeasureString(string, &w, &h);
x = TEXT_XCENTER(w);
x = 160;
y = TEXT_INFO_LINE(0);
// Move lower on this level because of boss meters
//if ((Level == 20 && numplayers > 1) || numplayers > 4)
// y += 20;
//if (numplayers > 1 && numplayers <= 4)
// y+= 10;
PutStringTimer(pp, x, y, string, GlobInfoStringTime);
// when printing info line clear the second line
//PutStringInfoLine2(pp, "");
}
void pMenuClearTextLine(PLAYERp pp)
{
pMenuClearTextLineID(pp, ID_TEXT, TEXT_INFO_LINE(0), PRI_FRONT_MAX);
pMenuClearTextLineID(pp, ID_TEXT, TEXT_INFO_LINE(1), PRI_FRONT_MAX);
}
#define TEXT_PLAYER_INFO_TIME (3)
#define TEXT_PLAYER_INFO_Y (200 - 40)
#include "saveable.h"
static saveable_code saveable_text_code[] =
{
SAVE_CODE(StringTimer),
};
saveable_module saveable_text =
{
// code
saveable_text_code,
SIZ(saveable_text_code),
// data
NULL,0
};
#endif
END_SW_NS