]> git.jsancho.org Git - lugaru.git/commitdiff
console commands works again.
authorCôme BERNIGAUD <come.bernigaud@gmail.com>
Wed, 18 May 2011 17:44:33 +0000 (19:44 +0200)
committerCôme BERNIGAUD <come.bernigaud@gmail.com>
Wed, 18 May 2011 17:44:33 +0000 (19:44 +0200)
Source/GameDraw.cpp
Source/GameTick.cpp

index 19b7f1794f385c9d9517f8f84ca86526e2fa8a98..c92755ba192407e41dec8a8ac8f55b935d935c93 100644 (file)
@@ -549,7 +549,7 @@ int Game::DrawGLScene(StereoSide side)
 
                glEnable(GL_TEXTURE_2D);
                glColor4f(.5,.5,.5,1);
-               if(!console){
+               if(!console) {
                        sprintf (string, " ",(int)(fps));
                        text.glPrint(10,30,string,0,.8,screenwidth,screenheight);
 
@@ -1322,7 +1322,7 @@ int Game::DrawGLScene(StereoSide side)
                        glDepthMask(1);
                }
 
-               if(flashamount>0&&damageeffects){
+               if(flashamount>0&&damageeffects) {
                        if(flashamount>1)flashamount=1;
                        if(flashdelay<=0)flashamount-=multiplier;
                        flashdelay--;
@@ -1358,7 +1358,7 @@ int Game::DrawGLScene(StereoSide side)
                        glDepthMask(1);
                }       
 
-               if(!console){
+               if(!console) {
                        displaytime[0]=0;
                        glEnable(GL_TEXTURE_2D);
                        glColor4f(1,1,1,1);
@@ -1370,11 +1370,11 @@ int Game::DrawGLScene(StereoSide side)
                                        text.glPrint(30+(float)(displayselected)*10,30+(screenheight-330),string,0,1,screenwidth,screenheight);
                                }
                        }
-                       for(i=0;i<15;i++){
+                       for(i=0;i<15;i++) {
                                if((i!=0||chatting)&&displaytime[i]<4)
-                                       for(j=0;j<displaychars[i];j++){
+                                       for(j=0;j<displaychars[i];j++) {
                                                glColor4f(1,1,1,4-displaytime[i]);
-                                               if(j<displaychars[i]){
+                                               if(j<displaychars[i]) {
                                                        sprintf (string, "%c",displaytext[i][j]);
                                                        text.glPrint(30+j*10,30+i*20+(screenheight-330),string,0,1,screenwidth,screenheight);
                                                }
index 7d9ec2cd0edc6c0944879e2e1a9d3bbbc8fcf37b..56e9a8ef9170afcfdf220294cd93b7c695977648 100644 (file)
@@ -169,7 +169,7 @@ static bool stripfx(const char *str, const char *pfx)
 }
 
 static const char *cmd_names[] = {
-#define DECLARE_COMMAND(cmd) #cmd " ",
+#define DECLARE_COMMAND(cmd) #cmd,
 #include "ConsoleCmds.h"
 #undef  DECLARE_COMMAND
 };
@@ -1108,8 +1108,8 @@ static void cmd_dispatch(Game *game, const char *cmd)
   for (i = 0; i < n_cmds; i++)
     if (stripfx(cmd, cmd_names[i]))
       {
-       cmd_handlers[i](game, cmd + strlen(cmd_names[i]));
-       break;
+               cmd_handlers[i](game, cmd + strlen(cmd_names[i])+1);
+               break;
       }
   emit_sound_np(i < n_cmds ? consolesuccesssound : consolefailsound);
 }
@@ -1399,22 +1399,22 @@ void Game::Setenvironment(int which)
        texdetail=temptexdetail;
 }
 
-void Game::Loadlevel(int which){
+void Game::Loadlevel(int which) {
        stealthloading=0;
        whichlevel=which;
 
-       if(which == -1){
+       if(which == -1) {
            tutoriallevel = -1;
            Loadlevel("tutorial");
-       }else if(which >= 0 && which <= 15){
+       } else if(which >= 0 && which <= 15) {
            char buf[32];
            snprintf(buf, 32, "map%d", which + 1); // challenges
            Loadlevel(buf);
-       }else
+       } else
            Loadlevel("mapsave");
 }
 
-void Game::Loadlevel(const char *name){
+void Game::Loadlevel(const char *name) {
        int templength;
        float lamefloat;
        static const char *pfx = ":Data:Maps:";
@@ -5970,9 +5970,9 @@ void Game::Tick(){
                if(chatting)
             keyboardfrozen=true;
 
-               if(Input::isKeyPressed(consolekey)&&debugmode){
+               if(Input::isKeyPressed(consolekey)&&debugmode) {
                        console=!console;
-                       if(console){
+                       if(console) {
                                OPENAL_SetFrequency(OPENAL_ALL, 0.001);
                        } else {
                                freeze=0;
@@ -5982,14 +5982,14 @@ void Game::Tick(){
 
                if(console)
             freeze=1;
-               if(console&&!Input::isKeyDown(SDLK_LMETA)){
+               if(console&&!Input::isKeyDown(SDLK_LMETA)) {
                        inputText(consoletext[0],&consoleselected,&consolechars[0]);
                        if(!waiting) {
                                archiveselected=0;
-                               if(consolechars[0]>0){
-                    consoletext[0][consolechars[0]]=' ';
+                               if(consolechars[0]>0) {
+                    consoletext[0][consolechars[0]]='\0';
                     cmd_dispatch(this, consoletext[0]);
-                                       for(int k=14;k>=1;k--){
+                                       for(int k=14;k>=1;k--) {
                                                for(int j=0;j<255;j++)
                                                        consoletext[k][j]=consoletext[k-1][j];
                                                consolechars[k]=consolechars[k-1];
@@ -6002,7 +6002,7 @@ void Game::Tick(){
                        }
 
                        consoleblinkdelay-=multiplier;
-                       if(consoleblinkdelay<=0){
+                       if(consoleblinkdelay<=0) {
                                consoleblinkdelay=.3;
                                consoleblink=1-consoleblink;
                        }