From 801845fa3b8b16567842b5edfe02f9f8f966969f Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 20 Jan 2011 10:52:33 +0000 Subject: [PATCH] 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 --- polymer/eduke32/build/src/build.c | 26 ++++++---------- polymer/eduke32/source/astub.c | 52 ++++++++++++++----------------- 2 files changed, 34 insertions(+), 44 deletions(-) diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 8c2dc487f..95e23d7e4 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -580,9 +580,8 @@ CANCEL: if (keystatus[1]) { keystatus[1] = 0; - begindrawing(); //{{{ + printext256(0,0,whitecol,0,"Are you sure you want to quit?",0); - enddrawing(); //}}} showframe(1); synctics = totalclock-lockclock; @@ -620,9 +619,8 @@ CANCEL: { i = CheckMapCorruption(4); - begindrawing(); //{{{ 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) { @@ -891,9 +889,6 @@ void editinput(void) keystatus[0x43] = 0; } - begindrawing(); //{{{ - enddrawing(); //}}} - if (angvel != 0) //ang += angvel * constant { //ENGINE calculates angvel for you @@ -1696,7 +1691,7 @@ void overheadeditor(void) searchy = clamp(scale(searchy,ydim2d-STATUS2DSIZ2,ydimgame), 8, ydim2d-STATUS2DSIZ-8-1); oposz = pos.z; - begindrawing(); //{{{ + begindrawing(); //{{{ CLEARLINES2D(0, ydim, 0); @@ -1712,7 +1707,8 @@ void overheadeditor(void) // drawline16(0,ydim-1-20,xdim-1,ydim-1-20,1); // drawline16(256,ydim-1-20,256,ydim-1,1); ydim16 = ydim-STATUS2DSIZ2; - enddrawing(); //}}} + + enddrawing(); //}}} pag = 0; cursectorhighlight = -1; @@ -2144,6 +2140,7 @@ void overheadeditor(void) else drawline16base(halfxdim16+x2,midydim16+y2, 0,0, 0,0, editorcolors[5]); } + enddrawing(); //}}} OSD_Draw(); @@ -5128,7 +5125,7 @@ const char *SaveBoard(const char *fn, uint32_t flags) if ((flags&1)==0) ExtSaveMap(f); - if (ret) + if (!ret) return f; else return NULL; @@ -6064,16 +6061,14 @@ static int32_t menuselect(void) if (!findfileshigh) findfileshigh=findfiles; - begindrawing(); _printmessage16("Select map file with arrow keys and enter."); - enddrawing(); ydim16 = ydim-STATUS2DSIZ2; listsize = (ydim16-32)/9; do { - begindrawing(); + begindrawing(); //{{{ CLEARLINES2D(0, ydim16, 0); @@ -6138,7 +6133,8 @@ static int32_t menuselect(void) } } } - enddrawing(); + + enddrawing(); //}}} showframe(1); keystatus[0xcb] = 0; @@ -6934,12 +6930,10 @@ void _printmessage16(const char *fmt, ...) clearministatbar16(); - begindrawing(); // ybase = (overridepm16y >= 0) ? ydim-overridepm16y : ydim-STATUS2DSIZ+128-8; ybase = ydim-STATUS2DSIZ+128-8; printext16(/*(overridepm16y >= 0) ? 200L-24 :*/ 8, ybase+8, whitecol, -1, snotbuf, 0); - enddrawing(); } void printmessage256(int32_t x, int32_t y, const char *name) diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index d2e624209..e4ba8fe97 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -3478,7 +3478,6 @@ static int32_t OnSelectTile(int32_t iTile) bflushchars(); - begindrawing(); setpolymost2dview(); clearview(0); @@ -3522,7 +3521,6 @@ static int32_t OnSelectTile(int32_t iTile) } } - enddrawing(); showframe(1); clearkeys(); @@ -3672,7 +3670,10 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i } if (iSelected < 0 || iSelected >= MAXTILES) + { + enddrawing(); return 1; + } idTile = localartlookup[ iSelected ]; @@ -9462,7 +9463,9 @@ void ExtPreCheckKeys(void) // just before drawrooms return; } - begindrawing(); + + + begindrawing(); //{{{ // if (cursectornum >= 0) // fillsector(cursectornum, 31); @@ -9608,7 +9611,7 @@ void ExtPreCheckKeys(void) // just before drawrooms } } - enddrawing(); + enddrawing(); //}}} } void ExtAnalyzeSprites(void) @@ -10209,7 +10212,6 @@ static void EditSectorData(int16_t sectnum) showsectordata(sectnum, 0); - begindrawing(); while (keystatus[KEYSC_ESC] == 0) { idle_waitevent(); @@ -10414,16 +10416,17 @@ static void EditSectorData(int16_t sectnum) break; } } + printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[1],disptext,0); if (editval) - { editval = 0; - } + showframe(1); } + printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); // printmessage16(""); - enddrawing(); + showframe(1); keystatus[KEYSC_ESC] = 0; } @@ -10440,7 +10443,7 @@ static void EditWallData(int16_t wallnum) disptext[dispwidth] = 0; showwalldata(wallnum, 0); - begindrawing(); + while (keystatus[KEYSC_ESC] == 0) { idle_waitevent(); @@ -10547,13 +10550,13 @@ static void EditWallData(int16_t wallnum) //showwalldata(wallnum, 0); //// printmessage16(""); } - //enddrawing(); + showframe(1); } - //begindrawing(); + printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); // printmessage16(""); - enddrawing(); + showframe(1); keystatus[KEYSC_ESC] = 0; } @@ -10575,7 +10578,7 @@ static void EditSpriteData(int16_t spritenum) while (keystatus[KEYSC_ESC] == 0) { idle_waitevent(); - begindrawing(); + if (handleevents()) { 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); if (editval) - { editval = 0; - } - enddrawing(); + showframe(1); } - begindrawing(); + printext16(xpos,ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); // printmessage16(""); - enddrawing(); showframe(1); + keystatus[KEYSC_ESC] = 0; } @@ -10987,7 +10988,6 @@ static void GenericSpriteSearch() if (quitevent) quitevent = 0; } - begindrawing(); printmessage16("Sprite search, press to exit"); if (PRESSED_KEYSC(DOWN)) @@ -11029,13 +11029,11 @@ static void GenericSpriteSearch() if (PRESSED_KEYSC(ENTER)) { Bsprintf(edittext, "%s: ", labels[row][col]); - enddrawing(); printmessage16("%s", edittext); i = getnumber16(edittext, gs_spritewhat[col][row] ? gs_sprite[col][row] : 0, maxval[row][col], sign[row][col]); if (col == 2 && row == 0) i = (i+2048)&2047; // angle gs_sprite[col][row] = i; - begindrawing(); gs_spritewhat[col][row] = 1; 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); - enddrawing(); showframe(1); } - // begindrawing(); + printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); printmessage16("Search sprite"); - // enddrawing(); showframe(1); + keystatus[KEYSC_ESC] = 0; } @@ -11139,7 +11136,6 @@ static void FuncMenu(void) if (handleevents()) quitevent = 0; - begindrawing(); _printmessage16("Select an option, press to exit"); if (PRESSED_KEYSC(DOWN)) { @@ -11407,13 +11403,13 @@ static void FuncMenu(void) break; } printext16(xpos,ypos+row*MENU_Y_SPACING,editorcolors[11],editorcolors[1],disptext,0); - enddrawing(); + showframe(1); } - begindrawing(); + printext16(xpos,ypos+row*MENU_Y_SPACING,editorcolors[11],editorcolors[0],disptext,0); - enddrawing(); /*clearmidstatbar16();*/ + showframe(1); keystatus[KEYSC_ESC] = 0; }