From 2801b574356c7b674efb5cd76bb25e008680f0ed Mon Sep 17 00:00:00 2001 From: albertzeyer Date: Wed, 22 Jul 2009 22:27:21 +0000 Subject: [PATCH] more fixes to menu git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@111 4df4b0f3-56ce-47cb-b001-ed939b7d65a6 --- src/include/menu.h | 2 +- src/menu.cpp | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/include/menu.h b/src/include/menu.h index 313bb6b1f..55774d352 100644 --- a/src/include/menu.h +++ b/src/include/menu.h @@ -22,4 +22,4 @@ void keensleft(stCloneKeenPlus *pCKP); void showmapatpos(int level, int xoff, int yoff, int wm, stCloneKeenPlus *pCKP); short loadResourcesforStartMenu(stCloneKeenPlus *pCKP, CGame *Game); int getDifficulty(stCloneKeenPlus *pCKP); -void showPage(char *text, stCloneKeenPlus *pCKP, int textsize); +void showPage(const std::string& text, stCloneKeenPlus *pCKP, int textsize); diff --git a/src/menu.cpp b/src/menu.cpp index be2dfaa47..7a0d2d9b9 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -935,7 +935,7 @@ short GraphicsDlg(stCloneKeenPlus *pCKP) // This function shows the Story of Commander Keen! -void showPage(char *text, stCloneKeenPlus *pCKP, int textsize) +void showPage(const std::string& text, stCloneKeenPlus *pCKP, int textsize) { unsigned int i, j, k; int exit=0; @@ -970,16 +970,16 @@ void showPage(char *text, stCloneKeenPlus *pCKP, int textsize) memset(buffer,0,200*40*sizeof(char)); // Prepare the buffer - char sbuf[256]; + std::string sbuf; unsigned int totnumline=0; for(i=0;i<200;i++) { for(j=0;j dlgW-2)) + if((sbuf.size() + j) > dlgW-2) { if(text[textpos] == ' ') { @@ -994,14 +994,14 @@ void showPage(char *text, stCloneKeenPlus *pCKP, int textsize) break; } + buffer[i][j] = text[textpos]; + if(text[textpos]==31 ) // I don't know, what they do, //but original version seems to ignore them! { - text[textpos]=' '; + buffer[i][j]=' '; } - - buffer[i][j]=text[textpos]; textpos++; if(textpos >= textsize) break; @@ -1016,9 +1016,7 @@ void showPage(char *text, stCloneKeenPlus *pCKP, int textsize) } buffer[i][j] = ' '; // Last character is empty! - char coverline[39]; - memset(coverline,2,38*sizeof(char)); // for the upper and lower edges - coverline[38]=0; + std::string coverline(37, (char)2); do { @@ -1035,7 +1033,7 @@ void showPage(char *text, stCloneKeenPlus *pCKP, int textsize) { if(buffer[i+(scroll>>3)][0]=='~') // Special Background Colour { - std::string temp(38, ' '); + std::string temp(37, ' '); g_pGraphics->sb_color_font_draw(temp, (dlgX+1)<<3, (((dlgY+i+1)<<3) -(scroll%8)),COLOUR_DARKRED,COLOUR_GREY); g_pGraphics->sb_color_font_draw(buffer[i+(scroll>>3)]+1, (dlgX+1)<<3, (((dlgY+i+1)<<3) -(scroll%8)),COLOUR_DARKRED,COLOUR_GREY); }