From: drumsetmonkey Date: Fri, 13 Nov 2015 13:28:43 +0000 (-0500) Subject: Added object class, and added quest listing X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=a32339dc700759ab44a360953c9c24d009b11ecc;p=clyne%2Fgamedev.git Added object class, and added quest listing --- a32339dc700759ab44a360953c9c24d009b11ecc diff --cc main.cpp index aa77fc2,16643dd..61aa3ae --- a/main.cpp +++ 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; diff --cc src/gameplay.cpp index bfc2bdb,4e67bb8..fcc501c --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@@ -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 edfa786,9c25e03..8954047 --- a/src/ui.cpp +++ b/src/ui.cpp @@@ -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); @@@ -210,15 -414,32 +415,33 @@@ 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 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); @@@ -227,18 -448,9 +450,19 @@@ ((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;