diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index 4c7bc36c..dda83f8f 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -44,9 +44,9 @@ void drawvoteicon(float x, float y, int col, int row, bool noblend) if(!tex) tex = textureload("packages/misc/voteicons.png"); if(tex) { - if(!noblend) glDisable(GL_BLEND); + if(noblend) glDisable(GL_BLEND); drawicon(tex, x, y, 240, col, row, 1/2.0f); - if(!noblend) glEnable(GL_BLEND); + if(noblend) glEnable(GL_BLEND); } } @@ -341,25 +341,36 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat if(!hidevote) { extern votedisplayinfo *curvote; + + //fixme + curvote = new votedisplayinfo(); + curvote->owner = player1; + s_strcpy(curvote->desc, "lal"); + curvote->result = VOTE_YES; + curvote->millis = lastmillis+1; + if(curvote && curvote->millis >= lastmillis) { const int left = 20*2, top = VIRTH; - draw_textf("%s called a vote", left, top+240, curvote->owner ? colorname(curvote->owner) : ""); - draw_textf("> %s", left, top+320, curvote->desc); - glColor4f(1,1,1, (sinf(lastmillis)/100.0f+1.0f)/2.0f); + draw_textf("%s called a vote:", left, top+240, curvote->owner ? colorname(curvote->owner) : ""); + draw_textf("%s", left, top+320, curvote->desc); + draw_textf("----", left, top+400); + draw_textf("%d yes vs. %d no", left, top+480, curvote->stats[VOTE_YES], curvote->stats[VOTE_NO]); + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + glColor4f(1.0f, 1.0f, 1.0f, (sinf(lastmillis/100.0f)+1.0f) / 2.0f); switch(curvote->result) { case VOTE_NEUTRAL: drawvoteicon(left, top, 0, 0, true); - draw_textf("Press F1/F2 to vote yes or no", left, top+400); + draw_textf("\fpress F1/F2 to vote yes or no", left, top+560); break; default: drawvoteicon(left, top, (curvote->result-1)&1, 1, false); - draw_textf("vote %s", left, top+400, curvote->result == VOTE_YES ? "PASSED" : "FAILED"); + draw_textf("\f3vote %s", left, top+560, curvote->result == VOTE_YES ? "PASSED" : "FAILED"); break; } - draw_textf("%d yes vs. %d no", left, top+480, curvote->stats[VOTE_YES], curvote->stats[VOTE_NO]); + } } if(player1->state==CS_ALIVE) diff --git a/source/src/server.cpp b/source/src/server.cpp index 7501e843..fbdbd2eb 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -1315,14 +1315,22 @@ bool vote(int sender, int vote) // true if the vote was placed successfully bool callvote(voteinfo *v) // true if a regular vote was called { if(!v || !v->isvalid()) return false; - if(v->action->dedicated && !isdedicated) + if(!isdedicated) { - sendf(v->owner, 1, "ri2", SV_CALLVOTEERR, VOTEE_DED); - return false; + if(v->action->dedicated) // available on ded servers only + { + sendf(v->owner, 1, "ri2", SV_CALLVOTEERR, VOTEE_DED); + return false; + } + else if(clients[v->owner]->type == ST_LOCAL) // allow op commands locally + { + v->action->perform(); + return false; + } } else { - if((isdedicated && clients[v->owner]->role >= v->action->role) || clients[v->owner]->type == ST_LOCAL) // pass server op commands + if(clients[v->owner]->role >= v->action->role) // pass server op commands { v->action->perform(); return false;