fix false save failure message and clean up begindrawing/enddrawing pairs

git-svn-id: https://svn.eduke32.com/eduke32@1776 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-01-20 10:52:33 +00:00
parent c54304217c
commit 801845fa3b
2 changed files with 34 additions and 44 deletions

View file

@ -580,9 +580,8 @@ CANCEL:
if (keystatus[1]) if (keystatus[1])
{ {
keystatus[1] = 0; keystatus[1] = 0;
begindrawing(); //{{{
printext256(0,0,whitecol,0,"Are you sure you want to quit?",0); printext256(0,0,whitecol,0,"Are you sure you want to quit?",0);
enddrawing(); //}}}
showframe(1); showframe(1);
synctics = totalclock-lockclock; synctics = totalclock-lockclock;
@ -620,9 +619,8 @@ CANCEL:
{ {
i = CheckMapCorruption(4); i = CheckMapCorruption(4);
begindrawing(); //{{{
printext256(0,8,whitecol,0,i<4?"Save changes?":"Map is heavily corrupt. Save changes?",0); printext256(0,8,whitecol,0,i<4?"Save changes?":"Map is heavily corrupt. Save changes?",0);
showframe(1); //}}} showframe(1);
while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]|keystatus[0x2e]) == 0) while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]|keystatus[0x2e]) == 0)
{ {
@ -891,9 +889,6 @@ void editinput(void)
keystatus[0x43] = 0; keystatus[0x43] = 0;
} }
begindrawing(); //{{{
enddrawing(); //}}}
if (angvel != 0) //ang += angvel * constant if (angvel != 0) //ang += angvel * constant
{ {
//ENGINE calculates angvel for you //ENGINE calculates angvel for you
@ -1696,7 +1691,7 @@ void overheadeditor(void)
searchy = clamp(scale(searchy,ydim2d-STATUS2DSIZ2,ydimgame), 8, ydim2d-STATUS2DSIZ-8-1); searchy = clamp(scale(searchy,ydim2d-STATUS2DSIZ2,ydimgame), 8, ydim2d-STATUS2DSIZ-8-1);
oposz = pos.z; oposz = pos.z;
begindrawing(); //{{{ begindrawing(); //{{{
CLEARLINES2D(0, ydim, 0); CLEARLINES2D(0, ydim, 0);
@ -1712,7 +1707,8 @@ void overheadeditor(void)
// drawline16(0,ydim-1-20,xdim-1,ydim-1-20,1); // drawline16(0,ydim-1-20,xdim-1,ydim-1-20,1);
// drawline16(256,ydim-1-20,256,ydim-1,1); // drawline16(256,ydim-1-20,256,ydim-1,1);
ydim16 = ydim-STATUS2DSIZ2; ydim16 = ydim-STATUS2DSIZ2;
enddrawing(); //}}}
enddrawing(); //}}}
pag = 0; pag = 0;
cursectorhighlight = -1; cursectorhighlight = -1;
@ -2144,6 +2140,7 @@ void overheadeditor(void)
else else
drawline16base(halfxdim16+x2,midydim16+y2, 0,0, 0,0, editorcolors[5]); drawline16base(halfxdim16+x2,midydim16+y2, 0,0, 0,0, editorcolors[5]);
} }
enddrawing(); //}}} enddrawing(); //}}}
OSD_Draw(); OSD_Draw();
@ -5128,7 +5125,7 @@ const char *SaveBoard(const char *fn, uint32_t flags)
if ((flags&1)==0) if ((flags&1)==0)
ExtSaveMap(f); ExtSaveMap(f);
if (ret) if (!ret)
return f; return f;
else else
return NULL; return NULL;
@ -6064,16 +6061,14 @@ static int32_t menuselect(void)
if (!findfileshigh) if (!findfileshigh)
findfileshigh=findfiles; findfileshigh=findfiles;
begindrawing();
_printmessage16("Select map file with arrow keys and enter."); _printmessage16("Select map file with arrow keys and enter.");
enddrawing();
ydim16 = ydim-STATUS2DSIZ2; ydim16 = ydim-STATUS2DSIZ2;
listsize = (ydim16-32)/9; listsize = (ydim16-32)/9;
do do
{ {
begindrawing(); begindrawing(); //{{{
CLEARLINES2D(0, ydim16, 0); CLEARLINES2D(0, ydim16, 0);
@ -6138,7 +6133,8 @@ static int32_t menuselect(void)
} }
} }
} }
enddrawing();
enddrawing(); //}}}
showframe(1); showframe(1);
keystatus[0xcb] = 0; keystatus[0xcb] = 0;
@ -6934,12 +6930,10 @@ void _printmessage16(const char *fmt, ...)
clearministatbar16(); clearministatbar16();
begindrawing();
// ybase = (overridepm16y >= 0) ? ydim-overridepm16y : ydim-STATUS2DSIZ+128-8; // ybase = (overridepm16y >= 0) ? ydim-overridepm16y : ydim-STATUS2DSIZ+128-8;
ybase = ydim-STATUS2DSIZ+128-8; ybase = ydim-STATUS2DSIZ+128-8;
printext16(/*(overridepm16y >= 0) ? 200L-24 :*/ 8, ybase+8, whitecol, -1, snotbuf, 0); printext16(/*(overridepm16y >= 0) ? 200L-24 :*/ 8, ybase+8, whitecol, -1, snotbuf, 0);
enddrawing();
} }
void printmessage256(int32_t x, int32_t y, const char *name) void printmessage256(int32_t x, int32_t y, const char *name)

View file

@ -3478,7 +3478,6 @@ static int32_t OnSelectTile(int32_t iTile)
bflushchars(); bflushchars();
begindrawing();
setpolymost2dview(); setpolymost2dview();
clearview(0); clearview(0);
@ -3522,7 +3521,6 @@ static int32_t OnSelectTile(int32_t iTile)
} }
} }
enddrawing();
showframe(1); showframe(1);
clearkeys(); clearkeys();
@ -3672,7 +3670,10 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i
} }
if (iSelected < 0 || iSelected >= MAXTILES) if (iSelected < 0 || iSelected >= MAXTILES)
{
enddrawing();
return 1; return 1;
}
idTile = localartlookup[ iSelected ]; idTile = localartlookup[ iSelected ];
@ -9462,7 +9463,9 @@ void ExtPreCheckKeys(void) // just before drawrooms
return; return;
} }
begindrawing();
begindrawing(); //{{{
// if (cursectornum >= 0) // if (cursectornum >= 0)
// fillsector(cursectornum, 31); // fillsector(cursectornum, 31);
@ -9608,7 +9611,7 @@ void ExtPreCheckKeys(void) // just before drawrooms
} }
} }
enddrawing(); enddrawing(); //}}}
} }
void ExtAnalyzeSprites(void) void ExtAnalyzeSprites(void)
@ -10209,7 +10212,6 @@ static void EditSectorData(int16_t sectnum)
showsectordata(sectnum, 0); showsectordata(sectnum, 0);
begindrawing();
while (keystatus[KEYSC_ESC] == 0) while (keystatus[KEYSC_ESC] == 0)
{ {
idle_waitevent(); idle_waitevent();
@ -10414,16 +10416,17 @@ static void EditSectorData(int16_t sectnum)
break; break;
} }
} }
printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[1],disptext,0); printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[1],disptext,0);
if (editval) if (editval)
{
editval = 0; editval = 0;
}
showframe(1); showframe(1);
} }
printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0);
// printmessage16(""); // printmessage16("");
enddrawing();
showframe(1); showframe(1);
keystatus[KEYSC_ESC] = 0; keystatus[KEYSC_ESC] = 0;
} }
@ -10440,7 +10443,7 @@ static void EditWallData(int16_t wallnum)
disptext[dispwidth] = 0; disptext[dispwidth] = 0;
showwalldata(wallnum, 0); showwalldata(wallnum, 0);
begindrawing();
while (keystatus[KEYSC_ESC] == 0) while (keystatus[KEYSC_ESC] == 0)
{ {
idle_waitevent(); idle_waitevent();
@ -10547,13 +10550,13 @@ static void EditWallData(int16_t wallnum)
//showwalldata(wallnum, 0); //showwalldata(wallnum, 0);
//// printmessage16(""); //// printmessage16("");
} }
//enddrawing();
showframe(1); showframe(1);
} }
//begindrawing();
printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0);
// printmessage16(""); // printmessage16("");
enddrawing();
showframe(1); showframe(1);
keystatus[KEYSC_ESC] = 0; keystatus[KEYSC_ESC] = 0;
} }
@ -10575,7 +10578,7 @@ static void EditSpriteData(int16_t spritenum)
while (keystatus[KEYSC_ESC] == 0) while (keystatus[KEYSC_ESC] == 0)
{ {
idle_waitevent(); idle_waitevent();
begindrawing();
if (handleevents()) if (handleevents())
{ {
if (quitevent) quitevent = 0; if (quitevent) quitevent = 0;
@ -10892,17 +10895,15 @@ static void EditSpriteData(int16_t spritenum)
printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[1],disptext,0); printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[1],disptext,0);
if (editval) if (editval)
{
editval = 0; editval = 0;
}
enddrawing();
showframe(1); showframe(1);
} }
begindrawing();
printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0);
// printmessage16(""); // printmessage16("");
enddrawing();
showframe(1); showframe(1);
keystatus[KEYSC_ESC] = 0; keystatus[KEYSC_ESC] = 0;
} }
@ -10987,7 +10988,6 @@ static void GenericSpriteSearch()
if (quitevent) quitevent = 0; if (quitevent) quitevent = 0;
} }
begindrawing();
printmessage16("Sprite search, press <Esc> to exit"); printmessage16("Sprite search, press <Esc> to exit");
if (PRESSED_KEYSC(DOWN)) if (PRESSED_KEYSC(DOWN))
@ -11029,13 +11029,11 @@ static void GenericSpriteSearch()
if (PRESSED_KEYSC(ENTER)) if (PRESSED_KEYSC(ENTER))
{ {
Bsprintf(edittext, "%s: ", labels[row][col]); Bsprintf(edittext, "%s: ", labels[row][col]);
enddrawing();
printmessage16("%s", edittext); printmessage16("%s", edittext);
i = getnumber16(edittext, gs_spritewhat[col][row] ? gs_sprite[col][row] : 0, i = getnumber16(edittext, gs_spritewhat[col][row] ? gs_sprite[col][row] : 0,
maxval[row][col], sign[row][col]); maxval[row][col], sign[row][col]);
if (col == 2 && row == 0) i = (i+2048)&2047; // angle if (col == 2 && row == 0) i = (i+2048)&2047; // angle
gs_sprite[col][row] = i; gs_sprite[col][row] = i;
begindrawing();
gs_spritewhat[col][row] = 1; gs_spritewhat[col][row] = 1;
if (col == 1 && row == 5) // picnum if (col == 1 && row == 5) // picnum
@ -11063,14 +11061,13 @@ static void GenericSpriteSearch()
printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[1],disptext,0); printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[1],disptext,0);
enddrawing();
showframe(1); showframe(1);
} }
// begindrawing();
printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0);
printmessage16("Search sprite"); printmessage16("Search sprite");
// enddrawing();
showframe(1); showframe(1);
keystatus[KEYSC_ESC] = 0; keystatus[KEYSC_ESC] = 0;
} }
@ -11139,7 +11136,6 @@ static void FuncMenu(void)
if (handleevents()) if (handleevents())
quitevent = 0; quitevent = 0;
begindrawing();
_printmessage16("Select an option, press <Esc> to exit"); _printmessage16("Select an option, press <Esc> to exit");
if (PRESSED_KEYSC(DOWN)) if (PRESSED_KEYSC(DOWN))
{ {
@ -11407,13 +11403,13 @@ static void FuncMenu(void)
break; break;
} }
printext16(xpos,ypos+row*MENU_Y_SPACING,editorcolors[11],editorcolors[1],disptext,0); printext16(xpos,ypos+row*MENU_Y_SPACING,editorcolors[11],editorcolors[1],disptext,0);
enddrawing();
showframe(1); showframe(1);
} }
begindrawing();
printext16(xpos,ypos+row*MENU_Y_SPACING,editorcolors[11],editorcolors[0],disptext,0); printext16(xpos,ypos+row*MENU_Y_SPACING,editorcolors[11],editorcolors[0],disptext,0);
enddrawing();
/*clearmidstatbar16();*/ /*clearmidstatbar16();*/
showframe(1); showframe(1);
keystatus[KEYSC_ESC] = 0; keystatus[KEYSC_ESC] = 0;
} }