Lunatic: show on-screen errors even in passive menu; fix '(display)rand*' for large values.

Also, some minor style cleanup in game.c. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4815 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-12-14 14:31:34 +00:00
parent ca7a5acce7
commit 52b58dde26
3 changed files with 20 additions and 14 deletions

View file

@ -787,6 +787,9 @@ nextdemo_nomenu:
if (foundemo == 0) if (foundemo == 0)
{ {
G_DrawBackground(); G_DrawBackground();
#ifdef LUNATIC
El_DisplayErrors();
#endif
} }
else else
{ {

View file

@ -3963,18 +3963,20 @@ static int32_t G_DoThirdPerson(const DukePlayer_t *pp, vec3_t *vect, int16_t *vs
void G_DrawBackground(void) void G_DrawBackground(void)
{ {
const int32_t dapicnum = BIGHOLE; const int32_t dapicnum = BIGHOLE;
int32_t x,y,x1,y1,x2,y2,rx; int32_t x,y,x1,x2;
flushperms(); flushperms();
// XXX: if dapicnum is not available, this might leave the menu background
// not drawn, leading to "HOM".
if (tilesiz[dapicnum].x == 0 || tilesiz[dapicnum].y == 0) if (tilesiz[dapicnum].x == 0 || tilesiz[dapicnum].y == 0)
{ {
pus = pub = NUMPAGES; pus = pub = NUMPAGES;
return; return;
} }
y1 = 0; int32_t y1=0, y2=ydim;
y2 = ydim;
if ((g_player[myconnectindex].ps->gm&MODE_GAME) || ud.recstat == 2) if ((g_player[myconnectindex].ps->gm&MODE_GAME) || ud.recstat == 2)
{ {
if (GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR) if (GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR)
@ -3998,15 +4000,16 @@ void G_DrawBackground(void)
#if !defined LUNATIC #if !defined LUNATIC
if (Gv_GetVarByLabel("MENU_TILE", !fstilep, -1, -1)) if (Gv_GetVarByLabel("MENU_TILE", !fstilep, -1, -1))
#else #else
if (!fstilep) if (!fstilep)
#endif #endif
{ {
if ((unsigned)bgtile < MAXTILES) if ((unsigned)bgtile < MAXTILES)
for (y=y1; y<y2; y+=tilesiz[bgtile].y) for (y=y1; y<y2; y+=tilesiz[bgtile].y)
for (x=0; x<xdim; x+=tilesiz[bgtile].x) for (x=0; x<xdim; x+=tilesiz[bgtile].x)
rotatesprite_fs(x<<16,y<<16,65536L,0,bgtile,16,0,8+16+64); rotatesprite_fs(x<<16,y<<16,65536L,0,bgtile,16,0,8+16+64);
} }
else rotatesprite_fs(160<<16,100<<16,65536L,0,bgtile,16,0,2+8+64+(ud.bgstretch?1024:0)); else rotatesprite_fs(160<<16,100<<16,65536L,0,bgtile,16,0,2+8+64+(ud.bgstretch?1024:0));
return; return;
} }
@ -4020,7 +4023,7 @@ void G_DrawBackground(void)
rotatesprite(x<<16,y<<16,65536L,0,dapicnum,8,0,8+16+64,0,y1,xdim-1,windowy1-1); rotatesprite(x<<16,y<<16,65536L,0,dapicnum,8,0,8+16+64,0,y1,xdim-1,windowy1-1);
// sides // sides
rx = windowx2-windowx2%tilesiz[dapicnum].x; const int32_t rx = windowx2-windowx2%tilesiz[dapicnum].x;
for (y=windowy1-windowy1%tilesiz[dapicnum].y; y<windowy2; y+=tilesiz[dapicnum].y) for (y=windowy1-windowy1%tilesiz[dapicnum].y; y<windowy2; y+=tilesiz[dapicnum].y)
for (x=0; x<windowx1 || x+rx<xdim; x+=tilesiz[dapicnum].x) for (x=0; x<windowx1 || x+rx<xdim; x+=tilesiz[dapicnum].x)
{ {

View file

@ -460,11 +460,11 @@ end
--- Legacy operators --- --- Legacy operators ---
function _rand(x) function _rand(x)
return rshift(ffiC.krand()*(x+1), 16) return tobit((ffiC.krand()*(x+1))/65536)
end end
function _displayrand(x) function _displayrand(x)
return rshift(math.random(0, 32767)*(x+1), 15) return tobit((math.random(0, 32767)*(x+1))/32768)
end end
do do