- cleaned up the remnants of the old statusbar code.

This commit is contained in:
Christoph Oelckers 2020-08-14 00:56:34 +02:00
parent 67c340b573
commit a5d9886aa9
12 changed files with 49 additions and 219 deletions

View file

@ -51,50 +51,6 @@ short DebugBorderShade = 0;
#define X_TO_FIXED(val) (x_aspect_mul*(val))
#define Y_TO_FIXED(val) (y_aspect_mul*(val))
extern SWBOOL BorderAdjust;
void
SetFragBar(PLAYERp pp)
{
short i, num_frag_bars;
int y;
extern int16_t OrigCommPlayers;
if (numplayers <= 1)
return;
if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
return;
// if player sprite has not been initialized we have no business
// sticking a frag bar up. Prevents processing from MenuLevel etc.
if (!pp->SpriteP)
return;
//num_frag_bars = ((numplayers-1)/4)+1;
num_frag_bars = ((OrigCommPlayers-1)/4)+1;
for (i = windowxy1.x; i <= windowxy2.x; i++)
{
y = (tilesiz[FRAG_BAR].y * num_frag_bars) - (2 * (num_frag_bars-1));
y = y * (ydim/200.0);
}
for (i = 0, y = 0; i < num_frag_bars; i++)
{
pSpawnFullScreenSprite(pp, FRAG_BAR, PRI_MID, 0, y);
y += tilesiz[FRAG_BAR].y - 2;
}
// write each persons kill info to everybody
// for (i = 0; i < numplayers; i++)
TRAVERSE_CONNECT(i)
{
PlayerUpdateKills(Player + i, 0);
}
}
BORDER_INFO BorderInfoValues[] =
{
// x,y,screensize
@ -155,35 +111,16 @@ static void BorderSetView(PLAYERp, int *Xdim, int *Ydim, int *ScreenSize)
// Redraw the whole screen
//
void SetBorder(PLAYERp pp, int value)
void SetBorder(PLAYERp pp)
{
int Xdim, Ydim, ScreenSize;
if (pp != Player + myconnectindex)
return;
if (!BorderAdjust)
return;
if (value >= 0) // just refresh
gs.BorderNum = value;
if (gs.BorderNum < BORDER_NONE)
{
gs.BorderNum = BORDER_NONE;
//return;
}
if (gs.BorderNum > (int)SIZ(BorderInfoValues) - 1)
{
gs.BorderNum = SIZ(BorderInfoValues) - 1;
return;
}
if (xdim == 0) return; // game not set up yet.
BorderSetView(pp, &Xdim, &Ydim, &ScreenSize);
SetFragBar(pp);
}
END_SW_NS

View file

@ -1924,10 +1924,7 @@ drawscreen(PLAYERp pp)
// part of new border refresh method
if (!ScreenSavePic)
{
renderFlushPerms();
// get rid of all PANF_KILL_AFTER_SHOW sprites!
pFlushPerms(pp);
SetBorder(pp,gs.BorderNum);
SetBorder(pp);
}
PreUpdatePanel();

View file

@ -181,7 +181,6 @@ SWBOOL FirstTimeIntoGame;
SWBOOL PedanticMode;
SWBOOL BorderAdjust = FALSE;
SWBOOL LocationInfo = 0;
void drawoverheadmap(int cposx, int cposy, int czoom, short cang);
int DispFrameRate = FALSE;
@ -1229,12 +1228,6 @@ void CreditsLevel(void)
#define CREDITS1_PIC 5111
#define CREDITS2_PIC 5118
// put up a blank screen while loading
// get rid of all PERM sprites!
renderFlushPerms();
save = gs.BorderNum;
gs.BorderNum = save;
twod->ClearScreen();
videoNextPage();
inputState.ClearAllInput();
@ -1393,9 +1386,6 @@ void MenuLevel(void)
waitforeverybody();
// don't allow BorderAdjusting in these menus
BorderAdjust = FALSE;
inputState.ClearAllInput();
if (SW_SHAREWARE)
@ -1469,9 +1459,7 @@ void MenuLevel(void)
videoNextPage();
}
BorderAdjust = TRUE;
//LoadGameOutsideMoveLoop = FALSE;
inputState.ClearAllInput();
inputState.ClearAllInput();
M_ClearMenus();
InMenuLevel = FALSE;
twod->ClearScreen();
@ -2421,8 +2409,7 @@ int32_t GameInterface::app_main()
InitCheats();
buttonMap.SetButtons(actions, NUM_ACTIONS);
automapping = 1;
BorderAdjust = true;
gs = gs_defaults;
hud_size.Callback();
@ -2513,8 +2500,6 @@ void BotPlayerInsert(PLAYERp pp)
numplayers++;
}
// SetFragBar(pp);
}
void
@ -2738,7 +2723,6 @@ getinput(SW_PACKET *loc, SWBOOL tied)
{
MirrorDelay = 1;
dimensionmode = 3;
SetFragBar(pp);
ScrollMode2D = FALSE;
}
}
@ -3587,7 +3571,7 @@ void Saveable_Init_Dynamic()
void GameInterface::set_hud_layout(int requested_size)
{
gs.BorderNum = 9 - requested_size;
SetBorder(Player + myconnectindex, gs.BorderNum);
SetBorder(Player + myconnectindex);
}
::GameInterface* CreateInterface()

View file

@ -2100,8 +2100,7 @@ extern SECTOR_OBJECT SectorObject[MAX_SECTOR_OBJECTS];
ANIMATOR NullAnimator;
void SetBorder(PLAYERp pp, int);
void SetFragBar(PLAYERp pp);
void SetBorder(PLAYERp pp);
int Distance(int x1, int y1, int x2, int y2);
short GetDeltaAngle(short, short);
fix16_t GetDeltaQ16Angle(fix16_t, fix16_t);

View file

@ -901,7 +901,6 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fix16_t tpq16ang, fix16
// renderDrawRoomsQ16(tx, ty, tz, tpq16ang, tpq16horiz, pp->cursectnum);
// Clean up anything that the camera view might have done
SetFragBar(pp);
tileDelete(MIRROR);
wall[mirror[cnt].mirrorwall].overpicnum = MIRRORLABEL + cnt;
}

View file

@ -54,7 +54,6 @@ void MoveSectorObjects(SECTOR_OBJECTp sop, short locktics);
inline int TEXT_INFO_LINE(int line) { return (TEXT_INFO_Y + ((line)*TEXT_INFO_YOFF)); }
void DisplayMiniBarSmString(PLAYERp pp, short xs, short ys, short pal, const char* buffer);
void DisplaySmString(PLAYERp pp, short xs, short ys, short pal, const char* buffer);
void DisplayMiniBarNumber(short xs, short ys, int number);
void PutStringInfo(PLAYERp pp, const char* string);
void PutStringInfoLine(PLAYERp pp, const char* string);

View file

@ -549,20 +549,6 @@ Connect(void)
{
if (CommEnabled)
{
#if 0
int x1, x2, y1, y2;
int screensize = xdim;
extern short BorderTest[];
// put up a tile
x1 = (xdim >> 1) - (screensize >> 1);
x2 = x1 + screensize - 1;
y1 = ((ydim) >> 1) - (((screensize * (ydim)) / xdim) >> 1);
y2 = y1 + ((screensize * (ydim)) / xdim) - 1;
rotatespritetile(BorderTest[gs.BorderTile], 0, x1, y1, x2, y2, 0);
nextpage();
#endif
screenpeek = myconnectindex;
}

View file

@ -83,7 +83,6 @@ typedef struct
PANEL_STATEp state[2];
} PANEL_SHRAP, *PANEL_SHRAPp;
PANEL_SPRITEp pSpawnFullScreenSprite(PLAYERp pp, short pic, short pri, int x, int y);
void PanelInvTestSuicide(PANEL_SPRITEp psp);
void InsertPanelSprite(PLAYERp pp, PANEL_SPRITEp psp);
@ -209,31 +208,6 @@ PANEL_SPRITEp pSpawnFullViewSprite(PLAYERp pp, short pic, short pri, int x, int
return nsp;
}
// Used to display panel info at correct aspect ratio and x,y location on the
// status panel. Sprites will kill themselves after writing to all pages.
PANEL_SPRITEp pSpawnFullScreenSprite(PLAYERp pp, short pic, short pri, int x, int y)
{
PANEL_SPRITEp nsp;
if ((nsp = pFindMatchingSprite(pp, x, y, pri)) == NULL)
{
nsp = pSpawnSprite(pp, NULL, pri, x, y);
}
nsp->numpages = numpages;
nsp->picndx = -1;
nsp->picnum = pic;
nsp->x1 = 0;
nsp->y1 = 0;
nsp->x2 = xdim - 1;
nsp->y2 = ydim - 1;
SET(nsp->flags, PANF_STATUS_AREA | PANF_SCREEN_CLIP | PANF_KILL_AFTER_SHOW);
return nsp;
}
void pSetSuicide(PANEL_SPRITEp psp)
{
//SET(psp->flags, PANF_SUICIDE);
@ -7042,13 +7016,6 @@ pDisplaySprites(PLAYERp pp)
continue;
}
// force kill before showing again
if (TEST(psp->flags, PANF_KILL_AFTER_SHOW) && psp->numpages == 0)
{
pKillSprite(psp);
continue;
}
// if the state is null get the picnum for other than picndx
if (psp->picndx == -1 || !psp->State)
picnum = psp->picnum;
@ -7200,8 +7167,6 @@ pDisplaySprites(PLAYERp pp)
}
else set.clear();
//PANF_STATUS_AREA | PANF_SCREEN_CLIP | PANF_KILL_AFTER_SHOW,
SET(flags, ROTATE_SPRITE_VIEW_CLIP);
if (TEST(psp->flags, PANF_TRANSLUCENT))
@ -7266,14 +7231,6 @@ pDisplaySprites(PLAYERp pp)
}
}
#if 1
if (TEST(psp->flags, PANF_KILL_AFTER_SHOW) && !TEST(psp->flags, PANF_NOT_ALL_PAGES) && !M_Active())
{
psp->numpages = 0;
SET(flags, ROTATE_SPRITE_ALL_PAGES);
}
#endif
// temporary hack to fix fist artifacts until a solution is found in the panel system itself
switch (picnum)
{
@ -7333,27 +7290,6 @@ pDisplaySprites(PLAYERp pp)
flags, x1, y1, x2, y2);
}
}
if (TEST(psp->flags, PANF_KILL_AFTER_SHOW))
{
psp->numpages--;
if (psp->numpages <= 0)
pKillSprite(psp);
}
}
}
void pFlushPerms(PLAYERp pp)
{
PANEL_SPRITEp psp=NULL, next=NULL;
TRAVERSE(&pp->PanelSpriteList, psp, next)
{
// force kill before showing again
if (TEST(psp->flags, PANF_KILL_AFTER_SHOW))
{
pKillSprite(psp);
}
}
}
@ -7508,26 +7444,6 @@ PreUpdatePanel(void)
DrawBeforeView = FALSE;
}
void rotatespritetile(short tilenum,
signed char shade, int cx1, int cy1,
int cx2, int cy2, char dapalnum)
{
int x, y, xsiz, ysiz, tx1, ty1, tx2, ty2;
xsiz = tilesiz[tilenum].x; tx1 = cx1/xsiz; tx2 = cx2/xsiz;
ysiz = tilesiz[tilenum].y; ty1 = cy1/ysiz; ty2 = cy2/ysiz;
for (x=tx1; x<=tx2; x++)
{
for (y=ty1; y<=ty2; y++)
{
rotatesprite((x*xsiz)<<16,(y*ysiz)<<16,65536L,0,tilenum,shade,dapalnum,
ROTATE_SPRITE_NON_MASK|ROTATE_SPRITE_CORNER|ROTATE_SPRITE_IGNORE_START_MOST,
cx1,cy1,cx2,cy2);
}
}
}
#define EnvironSuit_RATE 10
#define Fly_RATE 10
#define Cloak_RATE 10

View file

@ -78,7 +78,6 @@ struct PANEL_STATEstruct
#define PANF_TRANSLUCENT (BIT(8)) // turn invisible
#define PANF_INVISIBLE (BIT(9)) // turn invisible
#define PANF_DEATH_HIDE (BIT(10)) // hide done when dead
#define PANF_KILL_AFTER_SHOW (BIT(11)) // kill after showing numpages times
#define PANF_SCREEN_CLIP (BIT(12)) // maintain aspect to the screen
#define PANF_STATUS_AREA (BIT(13)) // maintain aspect to the screen
#define PANF_IGNORE_START_MOST (BIT(14)) // maintain aspect to the screen
@ -185,11 +184,9 @@ enum BorderTypes
#define SHOTGUN_AUTO 2078
PANEL_SPRITEp pSpawnSprite(PLAYERp pp, PANEL_STATEp state, uint8_t priority, int x, int y);
PANEL_SPRITEp pSpawnFullScreenSprite(PLAYERp pp, short pic, short pri, int x, int y);
PANEL_SPRITEp pSpawnFullViewSprite(PLAYERp pp,short pic,short pri,int x,int y);
void pSetSuicide(PANEL_SPRITEp psp);
SWBOOL pKillScreenSpiteIDs(PLAYERp pp, short id);
void pFlushPerms(PLAYERp pp);
void PreUpdatePanel(void);
void UpdatePanel(void);
void PlayerUpdateArmor(PLAYERp pp,short value);

View file

@ -7779,7 +7779,6 @@ void UpdateScrollingMessages(void)
}
else
{
// if ((klabs(quotebotgoal-quotebot) <= 16) && gs.BorderNum < BORDER_NONE+2)
if ((klabs(quotebotgoal-quotebot) <= 16))
quotebot += ksgn(quotebotgoal-quotebot);
else

View file

@ -256,7 +256,6 @@ class DSWStatusBar : public DBaseStatusBar
void DisplayFragNumbers()
{
// must draw this in HUD mode!
for (int pnum = 0; pnum < 4; pnum++)
{
char buffer[32];
@ -292,7 +291,6 @@ class DSWStatusBar : public DBaseStatusBar
void DisplayFragNames()
{
// must draw this in HUD mode!
for (int pnum = 0; pnum < 4; pnum++)
{
short xs, ys;
@ -317,6 +315,49 @@ class DSWStatusBar : public DBaseStatusBar
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void DisplayFragBar(PLAYERp pp)
{
// must draw this in HUD mode and align to the top center
short i, num_frag_bars;
int y;
extern int16_t OrigCommPlayers;
if (numplayers <= 1)
return;
if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
return;
// if player sprite has not been initialized we have no business
// sticking a frag bar up. Prevents processing from MenuLevel etc.
if (!pp->SpriteP)
return;
//num_frag_bars = ((numplayers-1)/4)+1;
num_frag_bars = ((OrigCommPlayers - 1) / 4) + 1;
for (i = windowxy1.x; i <= windowxy2.x; i++)
{
y = (tilesiz[FRAG_BAR].y * num_frag_bars) - (2 * (num_frag_bars - 1));
y = y * (ydim / 200.0);
}
for (i = 0, y = 0; i < num_frag_bars; i++)
{
DrawGraphic(tileGetTexture(FRAG_BAR), 0, y, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1);
y += tilesiz[FRAG_BAR].y - 2;
}
DisplayFragNames();
DisplayFragNumbers();
}
//---------------------------------------------------------------------------
//
//

View file

@ -233,30 +233,6 @@ DisplayMiniBarSmString(PLAYERp UNUSED(pp), short xs, short ys, short pal, const
}
}
void DisplaySmString(PLAYERp pp, short xs, short ys, short pal, const char *buffer)
{
short size=4,x;
const char *ptr;
PANEL_SPRITEp nsp;
// ID is base + (0-3)
//short id = ID_TEXT + MOD4(pp->pnum);
#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 <= '}');
nsp = pSpawnFullScreenSprite(pp, FRAG_FIRST_TILE + (*ptr - FRAG_FIRST_ASCII), PRI_FRONT_MAX, x, ys);
nsp->pal = pal;
//nsp->ID = id;
}
}
short GlobInfoStringTime = TEXT_INFO_TIME;
void PutStringInfo(PLAYERp pp, const char *string)
{