- thinning out some crap.

This commit is contained in:
Christoph Oelckers 2020-08-13 18:19:44 +02:00
parent d7f8d1a5bf
commit dc653bbdc0
14 changed files with 13 additions and 110 deletions

View file

@ -51,27 +51,7 @@ short DebugBorderShade = 0;
#define X_TO_FIXED(val) (x_aspect_mul*(val)) #define X_TO_FIXED(val) (x_aspect_mul*(val))
#define Y_TO_FIXED(val) (y_aspect_mul*(val)) #define Y_TO_FIXED(val) (y_aspect_mul*(val))
SWBOOL RedrawScreen = FALSE;
int f_xdim, f_ydim, x_pix_size, y_pix_size, x_aspect_mul, y_aspect_mul;
int CrosshairX, CrosshairY;
extern SWBOOL BorderAdjust; extern SWBOOL BorderAdjust;
SWBOOL GlobSpriteBoxUpdateEveryFrame = FALSE;
void
SetupAspectRatio(void)
{
f_xdim = FIXED(xdim, 0);
f_ydim = FIXED(ydim, 0);
x_pix_size = (f_320 / xdim);
y_pix_size = (f_200 / ydim);
x_aspect_mul = (f_xdim / 320);
y_aspect_mul = (f_ydim / 200);
}
void void
SetFragBar(PLAYERp pp) SetFragBar(PLAYERp pp)
@ -140,11 +120,18 @@ BORDER_INFO BorderInfoValues[] =
static void BorderSetView(PLAYERp, int *Xdim, int *Ydim, int *ScreenSize) static void BorderSetView(PLAYERp, int *Xdim, int *Ydim, int *ScreenSize)
{ {
int x, x2, y, y2; int x, x2, y, y2;
BORDER_INFO *b; const BORDER_INFO *b = &BorderInfoValues[gs.BorderNum];
int f_xdim, f_ydim, x_pix_size, y_pix_size, x_aspect_mul, y_aspect_mul;
BorderInfo = BorderInfoValues[gs.BorderNum]; f_xdim = FIXED(xdim, 0);
f_ydim = FIXED(ydim, 0);
x_pix_size = (f_320 / xdim);
y_pix_size = (f_200 / ydim);
x_aspect_mul = (f_xdim / 320);
y_aspect_mul = (f_ydim / 200);
b = &BorderInfo;
// figure out the viewing window x and y dimensions // figure out the viewing window x and y dimensions
*Xdim = MSW(f_xdim - X_TO_FIXED(b->Xdim)); *Xdim = MSW(f_xdim - X_TO_FIXED(b->Xdim));
@ -206,24 +193,4 @@ void SetBorder(PLAYERp pp, int value)
SetFragBar(pp); SetFragBar(pp);
} }
void
SetRedrawScreen(PLAYERp pp)
{
if (pp != Player + myconnectindex)
return;
if (!BorderAdjust)
return;
if (gs.BorderNum < BORDER_NONE)
gs.BorderNum = BORDER_NONE;
// Redraw the BORDER_TILE only if getting smaller
BorderInfo = BorderInfoValues[gs.BorderNum];
// test at redrawing the whole screen
RedrawScreen = TRUE;
}
END_SW_NS END_SW_NS

View file

@ -194,7 +194,6 @@ void GameInterface::MenuClosed()
if (!LoadGameOutsideMoveLoop) if (!LoadGameOutsideMoveLoop)
{ {
ResumeGame(); ResumeGame();
SetRedrawScreen(&Player[myconnectindex]);
} }
} }

View file

@ -424,7 +424,6 @@ DemoPlayBack(void)
// THIS STUFF DEPENDS ON MYCONNECTINDEX BEING SET RIGHT // THIS STUFF DEPENDS ON MYCONNECTINDEX BEING SET RIGHT
pp = Player + myconnectindex; pp = Player + myconnectindex;
SetRedrawScreen(pp);
if (!DemoInitOnce) if (!DemoInitOnce)
buf_ndx = 0; buf_ndx = 0;

View file

@ -70,7 +70,6 @@ extern SWBOOL HelpInputMode;
extern short HelpPage; extern short HelpPage;
extern short HelpPagePic[]; extern short HelpPagePic[];
extern ParentalStruct aVoxelArray[MAXTILES]; extern ParentalStruct aVoxelArray[MAXTILES];
extern SWBOOL RedrawScreen;
SWBOOL RedrawCompass=FALSE; SWBOOL RedrawCompass=FALSE;
extern int Follow_posx,Follow_posy; extern int Follow_posx,Follow_posy;
@ -1079,7 +1078,6 @@ ResizeView(PLAYERp pp)
inputState.ClearKeyStatus(sc_Escape); inputState.ClearKeyStatus(sc_Escape);
dimensionmode = 3; dimensionmode = 3;
ScrollMode2D = FALSE; ScrollMode2D = FALSE;
SetRedrawScreen(pp);
} }
#endif #endif
} }
@ -1923,16 +1921,12 @@ drawscreen(PLAYERp pp)
} }
#endif #endif
if (videoGetRenderMode() >= REND_POLYMOST)
RedrawScreen = TRUE;
DrawScreen = TRUE; DrawScreen = TRUE;
PreDraw(); PreDraw();
// part of new border refresh method // part of new border refresh method
if (RedrawScreen && !ScreenSavePic) if (!ScreenSavePic)
{ {
RedrawCompass = TRUE; RedrawCompass = TRUE;
RedrawScreen = FALSE;
// get rid of all PERM sprites! // get rid of all PERM sprites!
renderFlushPerms(); renderFlushPerms();
// get rid of all PANF_KILL_AFTER_SHOW sprites! // get rid of all PANF_KILL_AFTER_SHOW sprites!

View file

@ -668,7 +668,6 @@ bool InitGame()
} }
GraphicsMode = TRUE; GraphicsMode = TRUE;
SetupAspectRatio();
InitFX(); // JBF: do it down here so we get a hold of the window handle InitFX(); // JBF: do it down here so we get a hold of the window handle
return true; return true;
@ -2148,7 +2147,6 @@ void InitRunLevel(void)
// contains what is needed from calls below // contains what is needed from calls below
if (snd_ambience) if (snd_ambience)
StartAmbientSound(); StartAmbientSound();
SetRedrawScreen(Player + myconnectindex);
// crappy little hack to prevent play clock from being overwritten // crappy little hack to prevent play clock from being overwritten
// for load games // for load games
SavePlayClock = PlayClock; SavePlayClock = PlayClock;
@ -2210,8 +2208,6 @@ void InitRunLevel(void)
// IMPORTANT - MUST be right before game loop AFTER waitforeverybody // IMPORTANT - MUST be right before game loop AFTER waitforeverybody
InitTimingVars(); InitTimingVars();
SetRedrawScreen(Player + myconnectindex);
if (snd_ambience) if (snd_ambience)
StartAmbientSound(); StartAmbientSound();
} }
@ -2745,7 +2741,6 @@ getinput(SW_PACKET *loc, SWBOOL tied)
dimensionmode = 3; dimensionmode = 3;
SetFragBar(pp); SetFragBar(pp);
ScrollMode2D = FALSE; ScrollMode2D = FALSE;
SetRedrawScreen(pp);
} }
} }
@ -3594,8 +3589,8 @@ void GameInterface::set_hud_layout(int requested_size)
{ {
gs.BorderNum = 9 - requested_size; gs.BorderNum = 9 - requested_size;
SetBorder(Player + myconnectindex, gs.BorderNum); SetBorder(Player + myconnectindex, gs.BorderNum);
SetRedrawScreen(Player + myconnectindex);
} }
::GameInterface* CreateInterface() ::GameInterface* CreateInterface()
{ {
return new GameInterface; return new GameInterface;
@ -3615,7 +3610,7 @@ void GameInterface::FreeGameData()
void GameInterface::UpdateScreenSize() void GameInterface::UpdateScreenSize()
{ {
SetupAspectRatio(); // Fixme. The underlying code here is too broken and must be refactored first.
} }

View file

@ -2270,7 +2270,6 @@ extern SWBOOL ReloadPrompt;
extern int x_min_bound, y_min_bound, x_max_bound, y_max_bound; extern int x_min_bound, y_min_bound, x_max_bound, y_max_bound;
//extern unsigned char synctics, lastsynctics; //extern unsigned char synctics, lastsynctics;
extern BORDER_INFO BorderInfo;
extern short snum; extern short snum;
extern int lockspeed,totalsynctics; extern int lockspeed,totalsynctics;
@ -2390,10 +2389,6 @@ void DrawMenuLevelScreen(void); // game.c
void DebugWriteString(char *string); // game.c void DebugWriteString(char *string); // game.c
void ManualPlayerInsert(PLAYERp pp); // game.c void ManualPlayerInsert(PLAYERp pp); // game.c
void SetRedrawScreen(PLAYERp pp); // border.c
void SetupAspectRatio(void); // border.c
void SetCrosshair(void); // border.c
void initsynccrc(void); // sync.c void initsynccrc(void); // sync.c
void demosync_record(void); // sync.c void demosync_record(void); // sync.c
void demosync_test(int cnt); // sync.c void demosync_test(int cnt); // sync.c

View file

@ -51,7 +51,6 @@ short InventoryBarYpos[] = {172, 172, 130, 130, 130, 130, 130, 130, 130, 130, 13
void PlayerUpdateInventory(PLAYERp pp, short InventoryNum); void PlayerUpdateInventory(PLAYERp pp, short InventoryNum);
void SpawnInventoryBar(PLAYERp pp); void SpawnInventoryBar(PLAYERp pp);
void InventoryBarUpdatePosition(PLAYERp pp); void InventoryBarUpdatePosition(PLAYERp pp);
void InvBorderRefresh(PLAYERp pp);
void InventoryUse(PLAYERp pp); void InventoryUse(PLAYERp pp);
void InventoryStop(PLAYERp pp, short InventoryNum); void InventoryStop(PLAYERp pp, short InventoryNum);
void KillInventoryBar(PLAYERp pp); void KillInventoryBar(PLAYERp pp);
@ -628,7 +627,6 @@ void InventoryKeys(PLAYERp pp)
PlayerUpdateInventory(pp, pp->InventoryNum - 1); PlayerUpdateInventory(pp, pp->InventoryNum - 1);
PutStringInfo(pp, InventoryData[pp->InventoryNum].Name); PutStringInfo(pp, InventoryData[pp->InventoryNum].Name);
InventoryBarUpdatePosition(pp); InventoryBarUpdatePosition(pp);
InvBorderRefresh(pp);
} }
} }
else else
@ -646,7 +644,6 @@ void InventoryKeys(PLAYERp pp)
PlayerUpdateInventory(pp, pp->InventoryNum + 1); PlayerUpdateInventory(pp, pp->InventoryNum + 1);
PutStringInfo(pp, InventoryData[pp->InventoryNum].Name); PutStringInfo(pp, InventoryData[pp->InventoryNum].Name);
InventoryBarUpdatePosition(pp); InventoryBarUpdatePosition(pp);
InvBorderRefresh(pp);
} }
} }
else else
@ -721,20 +718,6 @@ void InventoryKeys(PLAYERp pp)
} }
} }
void InvBorderRefresh(PLAYERp pp)
{
// int x,y;
if (pp != Player + myconnectindex)
return;
// x = InventoryBarXpos[gs.BorderNum];
// y = InventoryBarYpos[gs.BorderNum];
SetRedrawScreen(pp);
//BorderRefreshClip(pp, x-5, y-5, x + (MAX_INVENTORY * INVENTORY_ICON_WIDTH), y + 24);
}
void InventoryTimer(PLAYERp pp) void InventoryTimer(PLAYERp pp)
{ {
// called every time through loop // called every time through loop
@ -754,9 +737,6 @@ void InventoryTimer(PLAYERp pp)
KillInventoryBar(pp); KillInventoryBar(pp);
// don't update bar anymore // don't update bar anymore
pp->InventoryBarTics = 0; pp->InventoryBarTics = 0;
InvBorderRefresh(pp);
//BorderRefresh(pp);
} }
} }

View file

@ -213,8 +213,6 @@ void adduserquote(const char *daquote)
{ {
int i; int i;
SetRedrawScreen(Player+myconnectindex);
for (i=MAXUSERQUOTES-1; i>0; i--) for (i=MAXUSERQUOTES-1; i>0; i--)
{ {
strcpy(user_quote[i],user_quote[i-1]); strcpy(user_quote[i],user_quote[i-1]);

View file

@ -467,7 +467,6 @@ SendMulitNameChange(char *new_name)
strcpy(pp->PlayerName, new_name); strcpy(pp->PlayerName, new_name);
playername = new_name; playername = new_name;
SetRedrawScreen(pp);
//TRAVERSE_CONNECT(pnum) //TRAVERSE_CONNECT(pnum)
{ {
@ -1505,7 +1504,6 @@ getpackets(void)
MONO_PRINT(ds); MONO_PRINT(ds);
strcpy(pp->PlayerName, p->PlayerName); strcpy(pp->PlayerName, p->PlayerName);
SetRedrawScreen(Player+myconnectindex);
break; break;
} }

View file

@ -106,8 +106,6 @@ char UziRecoilYadj = 0;
extern SWBOOL QuitFlag; extern SWBOOL QuitFlag;
extern short screenpeek; extern short screenpeek;
BORDER_INFO BorderInfo;
ANIMATOR NullAnimator; ANIMATOR NullAnimator;
pANIMATOR pNullAnimator; pANIMATOR pNullAnimator;
int InitStar(PLAYERp); int InitStar(PLAYERp);

View file

@ -5215,8 +5215,6 @@ DoPlayerStopDiveNoWarp(PLAYERp pp)
if (Prediction) if (Prediction)
return; return;
if (!NoMeters) SetRedrawScreen(pp);
StopPlayerSound(pp); StopPlayerSound(pp);
// stop diving no warp // stop diving no warp
@ -5245,8 +5243,6 @@ DoPlayerStopDive(PLAYERp pp)
if (Prediction) if (Prediction)
return; return;
if (!NoMeters) SetRedrawScreen(pp);
StopPlayerSound(pp); StopPlayerSound(pp);
// stop diving with warp // stop diving with warp
@ -5289,7 +5285,6 @@ DoPlayerDiveMeter(PLAYERp pp)
if (metertics <= 0 && !TEST(pp->Flags, PF_DIVING|PF_DIVING_IN_LAVA)) if (metertics <= 0 && !TEST(pp->Flags, PF_DIVING|PF_DIVING_IN_LAVA))
{ {
SetRedrawScreen(pp);
return; return;
} }
@ -7775,10 +7770,8 @@ void UpdateScrollingMessages(void)
if (user_quote_time[i] <= 0) if (user_quote_time[i] <= 0)
{ {
SetRedrawScreen(Player + myconnectindex);
user_quote_time[i] = 0; user_quote_time[i] = 0;
} }
//if (!user_quote_time[i]) pub = NUMPAGES;
} }
} }

View file

@ -585,7 +585,6 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
MWRITE(&totalclock,sizeof(totalclock),1,fil); MWRITE(&totalclock,sizeof(totalclock),1,fil);
MWRITE(&NormalVisibility,sizeof(NormalVisibility),1,fil); MWRITE(&NormalVisibility,sizeof(NormalVisibility),1,fil);
MWRITE(&BorderInfo,sizeof(BorderInfo),1,fil);
MWRITE(&MoveSkip2,sizeof(MoveSkip2),1,fil); MWRITE(&MoveSkip2,sizeof(MoveSkip2),1,fil);
MWRITE(&MoveSkip4,sizeof(MoveSkip4),1,fil); MWRITE(&MoveSkip4,sizeof(MoveSkip4),1,fil);
MWRITE(&MoveSkip8,sizeof(MoveSkip8),1,fil); MWRITE(&MoveSkip8,sizeof(MoveSkip8),1,fil);
@ -972,7 +971,6 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
MREAD(&NormalVisibility,sizeof(NormalVisibility),1,fil); MREAD(&NormalVisibility,sizeof(NormalVisibility),1,fil);
MREAD(&BorderInfo,sizeof(BorderInfo),1,fil);
MREAD(&MoveSkip2,sizeof(MoveSkip2),1,fil); MREAD(&MoveSkip2,sizeof(MoveSkip2),1,fil);
MREAD(&MoveSkip4,sizeof(MoveSkip4),1,fil); MREAD(&MoveSkip4,sizeof(MoveSkip4),1,fil);
MREAD(&MoveSkip8,sizeof(MoveSkip8),1,fil); MREAD(&MoveSkip8,sizeof(MoveSkip8),1,fil);
@ -1137,9 +1135,6 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
} }
InitNetVars(); InitNetVars();
SetupAspectRatio();
SetRedrawScreen(Player + myconnectindex);
screenpeek = myconnectindex; screenpeek = myconnectindex;
PlayingLevel = Level; PlayingLevel = Level;

View file

@ -953,7 +953,6 @@ BossHealthMeter(void)
if (metertics <= 0) if (metertics <= 0)
{ {
SetRedrawScreen(pp);
continue; continue;
} }

View file

@ -95,8 +95,6 @@ PANEL_SPRITEp pClearTextLineID(PLAYERp pp, short id, int y, short pri)
if (psp->ID == id && psp->y == y && psp->priority == pri) if (psp->ID == id && psp->y == y && psp->priority == pri)
{ {
SetRedrawScreen(psp->PlayerP);
//SET(psp->flags, PANF_INVISIBLE);
pSetSuicide(psp); pSetSuicide(psp);
} }
} }
@ -117,9 +115,7 @@ PANEL_SPRITEp pMenuClearTextLineID(PLAYERp pp, short id, int y, short pri)
if (psp->ID == id && psp->y == y && psp->priority == pri) if (psp->ID == id && psp->y == y && psp->priority == pri)
{ {
SetRedrawScreen(psp->PlayerP);
pKillSprite(psp); pKillSprite(psp);
//pSetSuicide(psp);
} }
} }
@ -129,7 +125,6 @@ PANEL_SPRITEp pMenuClearTextLineID(PLAYERp pp, short id, int y, short pri)
void pClearTextLine(PLAYERp pp, int y) void pClearTextLine(PLAYERp pp, int y)
{ {
SetRedrawScreen(pp);
pClearTextLineID(pp, ID_TEXT, y, PRI_FRONT_MAX); pClearTextLineID(pp, ID_TEXT, y, PRI_FRONT_MAX);
} }
@ -137,8 +132,6 @@ void StringTimer(PANEL_SPRITEp psp)
{ {
if ((psp->kill_tics -= synctics) <= 0) if ((psp->kill_tics -= synctics) <= 0)
{ {
SetRedrawScreen(psp->PlayerP);
//pSetSuicide(psp); // did not work here
pKillSprite(psp); pKillSprite(psp);
return; return;
} }