]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Added object class, and added quest listing
authordrumsetmonkey <abelleisle@roadrunner.com>
Fri, 13 Nov 2015 13:28:43 +0000 (08:28 -0500)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Fri, 13 Nov 2015 13:28:43 +0000 (08:28 -0500)
1  2 
main.cpp
src/entities.cpp
src/gameplay.cpp
src/ui.cpp
src/world.cpp

diff --cc main.cpp
index aa77fc2e8ecb39e602d8e116f08a1e52511864a7,16643ddd0ebff7ef995d6aaf1542cbf9cc2137b4..61aa3aee0a9c40d8a44525306a65258458b53be2
+++ b/main.cpp
@@@ -541,15 -541,17 +541,17 @@@ void mainLoop(void)
         *      Update debug variables if necessary
        */
        
 -      if(ui::debug){
 -              if(++debugDiv==20){
 -                      debugDiv=0;
 -                      fps=1000/deltaTime;
 -              }else if(!(debugDiv%10)){
 -                      debugY = player->loc.y;
 -              }
 -      }
 -      
 +      if(++debugDiv==20){
 +              debugDiv=0;
 +              
 +              fps=1000/deltaTime;
 +              
 +      }else if(!(debugDiv%10)){
 +              debugY = player->loc.y;
 +      }       
++
        render();       // Call the render loop
+       
  }
  
  extern bool fadeEnable;
Simple merge
index bfc2bdb843b3bfb09ec04b735577367cb05ec244,4e67bb84663aceebce36bec88a3040d6856c6914..fcc501c6a06ac4081b76fa41f17813f2f7ee8788
@@@ -5,10 -5,17 +5,16 @@@
  
  extern World  *currentWorld;
  extern Player *player;
 -
  extern void mainLoop(void);
  
+ void waitForDialog(void){
+       do{
+               mainLoop();
+       }while(ui::dialogBoxExists);
+ }
  int compTestQuest(NPC *speaker){
-       ui::dialogBox(speaker->name,"Ooo, that's a nice quest you got there. Lemme finish that for you ;).");
+       ui::dialogBox(speaker->name,NULL,"Ooo, that's a nice quest you got there. Lemme finish that for you ;).");
        player->qh.finish("Test",player);
        return 0;
  }
diff --cc src/ui.cpp
index edfa7865dfb38be40f0efe34969768beaa72d068,9c25e030f70913482524c47263bfb87ad86caeb2..895404778e19fc57a96491486feecd169a94c13b
@@@ -108,9 -208,9 +208,10 @@@ namespace ui 
                case 'y':
                case 'p':
                case 'j':y-=fontSize/4;break;
 +              case 'Q':y-=fontSize/5;break;
                default:break;
                }
+               
                glBegin(GL_QUADS);
                        glColor3ub(255,255,255);
                        glTexCoord2f(0,1);glVertex2f(x,y);
                        glColor3ub(0,0,0);
                        x=player->loc.x-SCREEN_WIDTH/2+HLINE*8;
                        y=(offset.y+SCREEN_HEIGHT/2)-HLINE*8;
+                       
                        glRectf(x,y,x+SCREEN_WIDTH-HLINE*16,y-SCREEN_HEIGHT/4);
-                       char *rtext;
+                       
                        rtext=typeOut(dialogBoxText);
+                       
                        setFontSize(16);
                        putString(x+HLINE,y-fontSize-HLINE,rtext);
+                       
+                       for(i=0;i<dialogOptCount;i++){
+                               if(mouse.x > dialogOptLoc[i][0] &&
+                                                  mouse.x < dialogOptLoc[i][2] &&
+                                                  mouse.y > dialogOptLoc[i][1] &&
+                                                  mouse.y < dialogOptLoc[i][1] + 16 ){ // fontSize
+                                         setFontColor(255,255,0);
+                               }else setFontColor(255,255,255);
+                               dialogOptLoc[i][0]=x+HLINE;
+                               dialogOptLoc[i][1]=y-SCREEN_HEIGHT/4+(fontSize+HLINE)*(i+1);
+                               dialogOptLoc[i][2]=
+                       
+                               putString(x+HLINE,y-SCREEN_HEIGHT/4+(fontSize+HLINE)*(i+1),dialogOptText[i]);
+                       }
+                       setFontColor(255,255,255);
                }
+               
                setFontSize(14);
                putText(((SCREEN_WIDTH/2)+offset.x)-125,(offset.y+SCREEN_HEIGHT/2)-fontSize,"Health: %u/%u",player->health>0?(unsigned)player->health:0,
 +                                                              
                                                                                                                                                                                        (unsigned)player->maxHealth);
                if(player->alive){
                        glColor3ub(255,0,0);
                                        ((SCREEN_WIDTH/2+offset.x)-125)+((player->health/player->maxHealth)*100),
                                        (offset.y+SCREEN_HEIGHT/2)-32+12);
                }
 +
 +              /*
 +               * Lists all of the quests the player has
 +              */
 +              putText(((SCREEN_WIDTH/2)+offset.x)-125,(offset.y+SCREEN_HEIGHT/2)-fontSize*4, "Current Quests:",NULL);
 +
 +              for(auto &c : player->qh.current){
 +                      putText(((SCREEN_WIDTH/2)+offset.x)-125,(offset.y+SCREEN_HEIGHT/2)-fontSize*5, "%s",c->title);
 +              }
 +
        }
        void handleEvents(void){
+               unsigned char i;
                static bool left=false,right=false;
                static vec2 premouse={0,0};
                SDL_Event e;
diff --cc src/world.cpp
Simple merge