mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
Optimize all menutext calls.
git-svn-id: https://svn.eduke32.com/eduke32@6208 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
7f6b26d362
commit
334007d6c3
9 changed files with 36 additions and 51 deletions
|
@ -6483,7 +6483,7 @@ int app_main(int argc, char const * const * argv)
|
|||
//G_FadePalette(0,0,0,0);
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
|
||||
rotatesprite_fs(160<<16,100<<16,65536L,0,LOADSCREEN,0,0,2+8+64+BGSTRETCH);
|
||||
menutext(160,105,0,0,"LOADING SAVED GAME...");
|
||||
menutext_center(105,"Loading saved game...");
|
||||
nextpage();
|
||||
|
||||
if (G_LoadPlayer(ud.warp_on-2))
|
||||
|
|
|
@ -78,8 +78,7 @@ G_EXTERN char pus,pub;
|
|||
G_EXTERN char ready2send;
|
||||
#define MAXPLAYERNAME 32
|
||||
G_EXTERN char szPlayerName[MAXPLAYERNAME];
|
||||
// XXX: menutextbuf overflow possible?
|
||||
G_EXTERN char tempbuf[MAXSECTORS<<1],packbuf[PACKBUF_SIZE],menutextbuf[128],buf[1024];
|
||||
G_EXTERN char tempbuf[MAXSECTORS<<1],packbuf[PACKBUF_SIZE],buf[1024];
|
||||
#define TYPEBUFSIZE 141
|
||||
G_EXTERN char typebuf[TYPEBUFSIZE];
|
||||
|
||||
|
|
|
@ -74,8 +74,8 @@ static int32_t mgametext_xbetween = -(1<<16);
|
|||
#define mgametext(x,y,t) G_ScreenText(STARTALPHANUM, x, y, 65536, 0, 0, t, 0, 0, 2|8|16|ROTATESPRITE_FULL16, 0, 5<<16, 8<<16, mgametext_xbetween, 0, 0, 0, 0, xdim-1, ydim-1)
|
||||
#define mgametextcenter(x,y,t) G_ScreenText(STARTALPHANUM, (MENU_MARGIN_CENTER<<16) + (x), y, 65536, 0, 0, t, 0, 0, 2|8|16|ROTATESPRITE_FULL16, 0, 5<<16, 8<<16, mgametext_xbetween, 1<<16, TEXT_XCENTER, 0, 0, xdim-1, ydim-1)
|
||||
#define mminitext(x,y,t,p) minitext_(x, y, t, 0, p, 2|8|16|ROTATESPRITE_FULL16)
|
||||
#define mmenutext(x,y,t) G_ScreenText(BIGALPHANUM, x, (y) - (12<<16), 65536L, 0, 0, (const char *)OSD_StripColors(menutextbuf,t), 0, 0, 2|8|16|ROTATESPRITE_FULL16, 0, 5<<16, 16<<16, 0, 0, TEXT_BIGALPHANUM|TEXT_UPPERCASE|TEXT_LITERALESCAPE, 0, 0, xdim-1, ydim-1)
|
||||
#define mmenutextcenter(x,y,t) G_ScreenText(BIGALPHANUM, (MENU_MARGIN_CENTER<<16) + (x), (y) - (12<<16), 65536L, 0, 0, (const char *)OSD_StripColors(menutextbuf,t), 0, 0, 2|8|16|ROTATESPRITE_FULL16, 0, 5<<16, 16<<16, 0, 0, TEXT_BIGALPHANUM|TEXT_UPPERCASE|TEXT_LITERALESCAPE|TEXT_XCENTER, 0, 0, xdim-1, ydim-1)
|
||||
#define mmenutext menutext
|
||||
#define mmenutextcenter(x,y,t) menutext_((MENU_MARGIN_CENTER<<16) + (x), (y), 0, (t), 10|16, TEXT_XCENTER)
|
||||
|
||||
#ifndef EDUKE32_STANDALONE
|
||||
static void shadowminitext(int32_t x, int32_t y, const char *t, int32_t p)
|
||||
|
@ -98,28 +98,6 @@ static void creditsminitext(int32_t x, int32_t y, const char *t, int32_t p)
|
|||
G_ScreenTextShadow(1, 1, MINIFONT, x, y, 65536, 0, 0, t, 0, p, 2|8|16|ROTATESPRITE_FULL16, 0, 4<<16, 8<<16, 1<<16, 0, f, 0, 0, xdim-1, ydim-1);
|
||||
}
|
||||
|
||||
int32_t menutext_(int32_t x, int32_t y, int32_t s, int32_t p, char const *t, int32_t bits)
|
||||
{
|
||||
vec2_t dim;
|
||||
int32_t f = TEXT_BIGALPHANUM|TEXT_UPPERCASE|TEXT_LITERALESCAPE;
|
||||
|
||||
if (!(bits & ROTATESPRITE_FULL16))
|
||||
{
|
||||
x<<=16;
|
||||
y<<=16;
|
||||
}
|
||||
|
||||
if (x == (160<<16))
|
||||
f |= TEXT_XCENTER;
|
||||
|
||||
dim = G_ScreenText(BIGALPHANUM, x, y - (12<<16), 65536L, 0, 0, t, s, p, bits|ROTATESPRITE_FULL16, 0, 5<<16, 16<<16, 0, 0, f, 0, 0, xdim-1, ydim-1);
|
||||
|
||||
if (!(bits & ROTATESPRITE_FULL16))
|
||||
x >>= 16;
|
||||
|
||||
return dim.x;
|
||||
}
|
||||
|
||||
#pragma pack(push,1)
|
||||
static savehead_t savehead;
|
||||
#pragma pack(pop)
|
||||
|
|
|
@ -446,7 +446,6 @@ extern Menu_t *m_currentMenu;
|
|||
extern int32_t g_lastSaveSlot;
|
||||
extern int32_t g_quitDeadline;
|
||||
extern int32_t voting;
|
||||
int32_t menutext_(int32_t x,int32_t y,int32_t s,int32_t p,char const *t,int32_t bits);
|
||||
int Menu_Change(int32_t cm);
|
||||
void Menu_AnimateChange(int32_t cm, MenuAnimationType_t animtype);
|
||||
int32_t Menu_IsTextInput(Menu_t *cm);
|
||||
|
|
|
@ -347,14 +347,14 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent)
|
|||
|
||||
if (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0)
|
||||
{
|
||||
menutext(160,90,0,0,"Loading User Map");
|
||||
menutext_center(90,"Loading User Map");
|
||||
gametextpal(160,90+10,boardfilename,14,2);
|
||||
}
|
||||
else
|
||||
{
|
||||
menutext(160,90,0,0,"Loading");
|
||||
menutext_center(90,"Loading");
|
||||
if (g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name != NULL)
|
||||
menutext(160,90+16+8,0,0,g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name);
|
||||
menutext_center(90+16+8,g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name);
|
||||
}
|
||||
|
||||
#ifndef EDUKE32_TOUCH_DEVICES
|
||||
|
@ -403,7 +403,7 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent)
|
|||
return;
|
||||
}
|
||||
|
||||
menutext(160,105,0,0,"Loading...");
|
||||
menutext_center(105,"Loading...");
|
||||
if (statustext) gametext(160,180,statustext,0,2+8+16);
|
||||
VM_OnEventWithReturn(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, percent);
|
||||
nextpage();
|
||||
|
|
|
@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
#include "duke3d.h"
|
||||
#include "premap.h"
|
||||
#include "menus.h" // menutext
|
||||
#include "prlights.h"
|
||||
#include "savegame.h"
|
||||
#ifdef LUNATIC
|
||||
|
@ -272,7 +271,7 @@ int32_t G_LoadPlayer(int32_t spot)
|
|||
pus = NUMPAGES;
|
||||
G_UpdateScreenArea();
|
||||
G_DrawBackground();
|
||||
menutext(160,100, 0,0, "LOADING...");
|
||||
menutext_center(100, "Loading...");
|
||||
nextpage();
|
||||
}
|
||||
|
||||
|
|
|
@ -1075,18 +1075,21 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
|
||||
if (ud.show_level_text && hud_showmapname && g_levelTextTime > 1)
|
||||
{
|
||||
int32_t bits = 10+16;
|
||||
int32_t o = 10|16;
|
||||
|
||||
if (g_levelTextTime < 3)
|
||||
bits |= 1+32;
|
||||
o |= 1|32;
|
||||
else if (g_levelTextTime < 5)
|
||||
bits |= 1;
|
||||
o |= 1;
|
||||
|
||||
if (g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name != NULL)
|
||||
{
|
||||
if (currentboardfilename[0] != 0 && ud.volume_number == 0 && ud.level_number == 7)
|
||||
menutext_(160, 90+16+8, -g_levelTextTime+22/*quotepulseshade*/, 0, currentboardfilename, bits);
|
||||
else menutext_(160, 90+16+8, -g_levelTextTime+22/*quotepulseshade*/, 0, g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name, bits);
|
||||
char const * const fn = currentboardfilename[0] != 0 &&
|
||||
ud.volume_number == 0 && ud.level_number == 7
|
||||
? currentboardfilename
|
||||
: g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name;
|
||||
|
||||
menutext_(160<<16, (90+16+8)<<16, -g_levelTextTime+22/*quotepulseshade*/, fn, o, TEXT_XCENTER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1164,7 +1167,7 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
#endif
|
||||
|
||||
if (ud.pause_on==1 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
|
||||
menutext(160, 100, 0, 0, "Game Paused");
|
||||
menutext_center(100, "Game Paused");
|
||||
|
||||
if (ud.coords)
|
||||
G_PrintCoords(screenpeek);
|
||||
|
@ -1851,11 +1854,11 @@ static void G_BonusCutscenes(void)
|
|||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
|
||||
// G_FadePalette(0,0,0,252);
|
||||
clearallviews(0L);
|
||||
menutext(160, 60, 0, 0, "Thanks to all our");
|
||||
menutext(160, 60+16, 0, 0, "fans for giving");
|
||||
menutext(160, 60+16+16, 0, 0, "us big heads.");
|
||||
menutext(160, 70+16+16+16, 0, 0, "Look for a Duke Nukem 3D");
|
||||
menutext(160, 70+16+16+16+16, 0, 0, "sequel soon.");
|
||||
menutext_center(60, "Thanks to all our");
|
||||
menutext_center(60+16, "fans for giving");
|
||||
menutext_center(60+16+16, "us big heads.");
|
||||
menutext_center(70+16+16+16, "Look for a Duke Nukem 3D");
|
||||
menutext_center(70+16+16+16+16, "sequel soon.");
|
||||
nextpage();
|
||||
|
||||
fadepal(0, 0, 0, 252, 0, -12);
|
||||
|
@ -2178,8 +2181,8 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BONUSSCREEN+gfx_offset, 0, 0, 2+8+64+128+BGSTRETCH);
|
||||
|
||||
if (lastmapname)
|
||||
menutext(160, 20-6, 0, 0, lastmapname);
|
||||
menutext(160, 36-6, 0, 0, "Completed");
|
||||
menutext_center(20-6, lastmapname);
|
||||
menutext_center(36-6, "Completed");
|
||||
|
||||
gametext(160, 192, "Press any key or button to continue", quotepulseshade, 2+8+16);
|
||||
|
||||
|
@ -2261,8 +2264,8 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
}
|
||||
|
||||
if (lastmapname)
|
||||
menutext(160, 20-6, 0, 0, lastmapname);
|
||||
menutext(160, 36-6, 0, 0, "Completed");
|
||||
menutext_center(20-6, lastmapname);
|
||||
menutext_center(36-6, "Completed");
|
||||
|
||||
gametext(160, 192, "Press any key or button to continue", quotepulseshade, 2+8+16);
|
||||
|
||||
|
|
|
@ -1007,6 +1007,11 @@ int32_t minitext_(int32_t x, int32_t y, const char *t, int32_t s, int32_t p, int
|
|||
return x;
|
||||
}
|
||||
|
||||
void menutext_(int32_t x, int32_t y, int32_t s, char const *t, int32_t o, int32_t f)
|
||||
{
|
||||
G_ScreenText(BIGALPHANUM, x, y - (12<<16), 65536L, 0, 0, t, s, 0, o|ROTATESPRITE_FULL16, 0, 5<<16, 16<<16, 0, 0, f|TEXT_BIGALPHANUM|TEXT_UPPERCASE|TEXT_LITERALESCAPE, 0, 0, xdim-1, ydim-1);
|
||||
}
|
||||
|
||||
void G_AddUserQuote(const char *daquote)
|
||||
{
|
||||
int32_t i;
|
||||
|
|
|
@ -59,11 +59,13 @@ enum ScreenTextFlags_t {
|
|||
};
|
||||
|
||||
extern int32_t minitext_(int32_t x, int32_t y, const char *t, int32_t s, int32_t p, int32_t sb);
|
||||
extern void menutext_(int32_t x, int32_t y, int32_t s, char const *t, int32_t o, int32_t f);
|
||||
extern int32_t textsc(int32_t sc);
|
||||
|
||||
#define minitextshade(x, y, t, s, p, sb) minitext_(x,y,t,s,p,sb)
|
||||
#define minitext(x, y, t, p, sb) minitext_(x,y,t,0,p,sb)
|
||||
#define menutext(x,y,s,p,t) menutext_(x,y,s,p,OSD_StripColors(menutextbuf,t),10+16)
|
||||
#define menutext(x, y, t) menutext_((x), (y), 0, (t), 10|16, 0)
|
||||
#define menutext_center(y, t) menutext_(160<<16, (y)<<16, 0, (t), 10|16, TEXT_XCENTER)
|
||||
#define gametext(x,y,t,s,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
|
||||
#define gametextscaled(x,y,t,s,dabits) G_PrintGameText(1,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
|
||||
#define gametextpal(x,y,t,s,p) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536, 0)
|
||||
|
|
Loading…
Reference in a new issue