| 1 | /* ************************************************************************* * |
| 2 | SDL-Ball - DX-Ball/Breakout remake with openGL and SDL for Linux |
| 3 | Copyright (C) 2008 Jimmy Christensen ( dusted at dusted dot dk ) |
| 4 | |
| 5 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation, either version 3 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | * ************************************************************************* */ |
| 18 | |
| 19 | |
| 20 | class highScoreClasscxx . . $ highScoreClass# { |
| 21 | private: |
| 22 | stringcxx . . $ std/string# namecxx . . $ highScoreClass#name.; |
| 23 | textureManagercxx . . $ textureManager# texMgrcxx . . $ highScoreClass#texMgr.; |
| 24 | textureClasscxx . . $ textureClass# texcxx . . $ highScoreClass#tex.; |
| 25 | public: |
| 26 | |
| 27 | highScoreClasscxx . . $ highScoreClass#highScoreClass(49f6e7a06ebc5aa8).() |
| 28 | { |
| 29 | namecxx . . $ highScoreClass#name.=cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74).""; |
| 30 | texMgrcxx . . $ highScoreClass#texMgr..loadcxx . . $ textureManager#load(48e1aaff0e117402).(useThemecxx . . $ useTheme(24764cae04130674).("/gfx/highscore/entername.png"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,settingcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..gfxThemecxx . . $ settings#gfxTheme.), texcxx . . $ highScoreClass#tex.); |
| 31 | } |
| 32 | |
| 33 | void drawcxx . . $ highScoreClass#draw(49f6e7a06ebc5aa8).() |
| 34 | { |
| 35 | |
| 36 | glLoadIdentity(); |
| 37 | glTranslatef(0,0,-3.0); |
| 38 | glColor4f(1,1,1,1); |
| 39 | |
| 40 | glBindTexture(GL_TEXTURE_2Dcxx . . $ `<external>/11565930711847777359/gl.h:611:9`!, texcxx . . $ highScoreClass#tex..propcxx . . $ textureClass#prop..texturecxx . . $ texProp#texture.); |
| 41 | glBegin( GL_QUADScxx . . $ `<external>/11565930711847777359/gl.h:163:9`! ); |
| 42 | glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 0.5f, 0.0f ); |
| 43 | glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 0.5f, 0.0f ); |
| 44 | glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,-0.5f, 0.0f ); |
| 45 | glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,-0.5f, 0.0f ); |
| 46 | glEnd( ); |
| 47 | |
| 48 | |
| 49 | glColor4f(1,1,1,1); |
| 50 | glTextcxx . . $ glText.->writecxx . . $ glTextClass#write(e3805d4e487d2eea).(namecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., FONT_MENUHIGHSCOREcxx . . $ `text.cpp:23:9`!, 1, 2.0, 0.0, 0.0); |
| 51 | |
| 52 | } |
| 53 | |
| 54 | void typecxx . . $ highScoreClass#type(1e231ef90fe6cba8).(SDL_Event e, menuClasscxx . . $ menuClass# &menu) |
| 55 | { |
| 56 | if(varcxx . . $ var..showHighScorescxx . . $ vars#showHighScores. == 1) |
| 57 | { |
| 58 | if(e.key.keysym.sym == SDLK_ESCAPEcxx . . $ SDLK_ESCAPE.) |
| 59 | { |
| 60 | varcxx . . $ var..showHighScorescxx . . $ vars#showHighScores. = 0; |
| 61 | initNewGamecxx . . $ initNewGame(49f6e7a06ebc5aa8).(); |
| 62 | menu.refreshHighScoreListcxx . . $ menuClass#refreshHighScoreList(49f6e7a06ebc5aa8).(); |
| 63 | varcxx . . $ var..menucxx . . $ vars#menu. = 7; |
| 64 | return; |
| 65 | } |
| 66 | |
| 67 | if(e.key.keysym.sym != SDLK_RETURNcxx . . $ SDLK_RETURN.) |
| 68 | { |
| 69 | if ( (e.key.keysym.unicode & 0xFF80) == 0 && e.key.keysym.unicode != 0) { |
| 70 | if(e.key.keysym.sym == SDLK_BACKSPACEcxx . . $ SDLK_BACKSPACE.) |
| 71 | { |
| 72 | if(namecxx . . $ highScoreClass#name..lengthcxx . . $ std/__cxx11/basic_string#length(6f8bd5c0ea8fb29a).() > 0) |
| 73 | namecxx . . $ highScoreClass#name..erasecxx . . $ std/__cxx11/basic_string#erase(710c914f019a9041).(namecxx . . $ highScoreClass#name..lengthcxx . . $ std/__cxx11/basic_string#length(6f8bd5c0ea8fb29a).()-1); |
| 74 | } else { |
| 75 | namecxx . . $ highScoreClass#name. +=cxx . . $ std/__cxx11/basic_string#`operator+=`(63cc1ae870623930). e.key.keysym.unicode; |
| 76 | } |
| 77 | } |
| 78 | } else { |
| 79 | varcxx . . $ var..showHighScorescxx . . $ vars#showHighScores. = 0; |
| 80 | ofstreamcxx . . $ std/ofstream# hsListcxx . . $ std/basic_ofstream#basic_ofstream(49f6e7a06ebc5aa8).; |
| 81 | hsList.opencxx . . $ std/basic_ofstream#open(b8cd37071ce335df).(privFilecxx . . $ privFile..highScoreFilecxx . . $ privFileStruct#highScoreFile..datacxx . . $ std/__cxx11/basic_string#data(258ee1c9e0a18a5c).(), ioscxx . . $ std/ios#::outcxx . . $ std/ios_base#out. |cxx . . $ std/`operator|`(2dd9eb40323da8bf). ioscxx . . $ std/ios#::appcxx . . $ std/ios_base#app.); |
| 82 | hsList <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[" <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). playercxx . . $ player..levelcxx . . $ player_struct#level.+1 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "]" <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). playercxx . . $ player..scorecxx . . $ player_struct#score. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "|" <<cxx . . $ std/`operator<<`(88df5bef833f7f83). namecxx . . $ highScoreClass#name. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 83 | hsList.closecxx . . $ std/basic_ofstream#close(49f6e7a06ebc5aa8).(); |
| 84 | initNewGamecxx . . $ initNewGame(49f6e7a06ebc5aa8).(); |
| 85 | menu.refreshHighScoreListcxx . . $ menuClass#refreshHighScoreList(49f6e7a06ebc5aa8).(); |
| 86 | resumeGamecxx . . $ resumeGame(49f6e7a06ebc5aa8).(); |
| 87 | varcxx . . $ var..titleScreenShowcxx . . $ vars#titleScreenShow.=1; |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | bool isHighScorecxx . . $ highScoreClass#isHighScore(c9857a73d68e59ba).() |
| 93 | { |
| 94 | int n; |
| 95 | int high=0; |
| 96 | struct scorecxx . . $ score# * slist = sortScorescxx . . $ sortScores(f4b8ef5fd01c7f07).(&n); |
| 97 | for(int i = 0; i < n; i++) |
| 98 | { |
| 99 | if(playercxx . . $ player..scorecxx . . $ player_struct#score. < slist[i].scorecxx . . $ score#score.) |
| 100 | { |
| 101 | high++; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | if(n>0) |
| 106 | delete[] slist; |
| 107 | |
| 108 | if(high < 20) |
| 109 | { |
| 110 | return(1); |
| 111 | } |
| 112 | return(0); |
| 113 | } |
| 114 | }; |