Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Night play?
02-15-2014, 10:16 PM,
#11
RE: Night play?
I use fullbright all the time... its not cheating. What is cheating? Doing something that was not intended by the game. Victor explicitly allowed players to use the fullbright command (before it was only usable for editing maps or something). Also it benefits people who have laptops set with low display brightness like me (so without fullbright I won't see anything even on a bright map).

[Image: name_zps459dc421.gif]
[Image: cooltext1206791925_zps58ab60b5.gif]

"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off." - Bjarne Stroustrup
Reply
02-16-2014, 01:58 AM,
#12
RE: Night play?
yeah, but maps like slender were made to be dark and scary LOL. fullbright ruins that scariness

DSO
Windows 8 fanboy =D
"Not dead, can't quit"
Reply
02-16-2014, 09:00 AM,
#13
RE: Night play?
I know that cheaters are going to hack /fullbright anyway, so there's really no point trying to restrict it. It would also be pointless to make dark maps, as /fullbright can be hacked without noticing. /fullbright hacks are even harder to detect than wallhacks, which humans can detect by spectating.

Best regards,
Victor
//victorz.ca
Code:
Your antithesis compares favorably with any high magnitude of pwnage. (-you > |p|, you < -|p|)
My antithesis compares favorably with _that of_ any high magnitude of pwnage. (|-me| > |-p|, |me| > |p|)
Reply
02-16-2014, 08:01 PM,
#14
RE: Night play?
is it smart to make a game that allows "hacks"? I understand the whole, "go with the flow" thing, but wouldn't it be better to just block those hacks in the first place? Or would this be too time consuming?

DSO
Windows 8 fanboy =D
"Not dead, can't quit"
Reply
02-16-2014, 08:24 PM,
#15
RE: Night play?
There is no easily done way to block them.
Reply
02-16-2014, 08:46 PM,
#16
RE: Night play?
ACR is completely open source and modular from both the client and server end, because of that it can be easily hacked by modifying the source code (I could easily enable wallhacks and various other things without having to use buffer overruns or other attacks). Therefore hacking is detected by looking at what the guy is doing (a very bad concept and hard to pin down someone for cheating). Ruler501 mentioned using a md5 checksum to verify a client from the server, which is a good idea and prevents most of the source code modifying hacks.

[Image: name_zps459dc421.gif]
[Image: cooltext1206791925_zps58ab60b5.gif]

"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off." - Bjarne Stroustrup
Reply
02-16-2014, 09:05 PM,
#17
RE: Night play?
there is no easy way to check the md5 sum from the server that isn't easily faked.
Reply
02-17-2014, 12:49 PM,
#18
RE: Night play?
@DeltaStrikeOp, it is impossible to "block" hacks without making a thin client (have the server render the screen and stream it to the client). Then you'd get optical (pixel) aimbots.

@dm.mossberg590a1, you can fake the md5 checksum easily. How easily? Patch one function and you're done.

Best regards,
Victor
//victorz.ca
Code:
Your antithesis compares favorably with any high magnitude of pwnage. (-you > |p|, you < -|p|)
My antithesis compares favorably with _that of_ any high magnitude of pwnage. (|-me| > |-p|, |me| > |p|)
Reply
02-18-2014, 08:04 AM, (This post was last modified: 02-18-2014, 10:14 AM by rXn.)
#19
RE: Night play?
Haven't been online something for some weeks, so dont be angry if I get some things wrong...Tongue I have once created some kind of night vision, but it looked too...easy.
But I have just done this:
[Image: 0lWcVEv.jpg]

However, I just noticed the shadows look quite unrealistic. Sad And I fear the setvar(...) call takes quite a long time and steals 4-5 fps, but at ~50 fps...who cares?

For now. heres my rendergl.cpp:
Code:
void gl_drawframe(int w, int h, float changelod, float curfps){

    dodynlights();

    drawminimap(w, h);

    recomputecamera();

    aspect = float(w)/h;
    fovy = 2*atan2(tan(float(dynfov())/2*RAD), aspect)/RAD;

    float hf = hdr.waterlevel-0.3f;
    const bool underwater = camera1->o.z<hf/*, flashed = focus->flashmillis > 0 && lastmillis <= focus->flashmillis*/;

    glFogi(GL_FOG_START, (fog+64)/8);
    glFogi(GL_FOG_END, fog);
    float fogc[4] = { (fogcolour>>16)/256.0f, ((fogcolour>>8)&255)/256.0f, (fogcolour&255)/256.0f, 1.0f },
          wfogc[4] = { hdr.watercolour[0]/255.0f, hdr.watercolour[1]/255.0f, hdr.watercolour[2]/255.0f, 1.0f },
          nfogc[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
    glFogfv(GL_FOG_COLOR, fogc);
    glClearColor(fogc[0], fogc[1], fogc[2], 1.0f);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    if(underwater){
        fovy += sinf(lastmillis/1000.0f)*2.0f;
        aspect += sinf(lastmillis/1000.0f+PI)*0.1f;
        glFogfv(GL_FOG_COLOR, wfogc);
        glFogi(GL_FOG_START, 0);
        glFogi(GL_FOG_END, (fog+96)/8);
    }
    if(getvar("night") == 1) {
        fullbrightlight();
        glFogfv(GL_FOG_COLOR, nfogc);
        glFogi(GL_FOG_START, 0);
        glFogi(GL_FOG_END, 30);
    } else {
        calclight();
    }
    farplane = fog*5/2;
    setperspective(fovy, 0.15f);
    glMatrixMode(GL_MODELVIEW);

    transplayer();
    readmatrices();

    if(!underwater && waterreflect)
    {
        extern int wx1;
        if(wx1>=0)
        {
            if(reflectscissor) calcwaterscissor();
            drawreflection(hf, w, h, changelod, false);
            if(waterrefract) drawreflection(hf, w, h, changelod, true);
        }
    }

    if(stencilshadow && hasstencil && stencilbits >= 8) glClearStencil((hasSTS || hasST2) && !hasSTW ? 128 : 0);
    glClear((outsidemap(camera1) ? GL_COLOR_BUFFER_BIT : 0) | GL_DEPTH_BUFFER_BIT | (stencilshadow && hasstencil && stencilbits >= 8 ? GL_STENCIL_BUFFER_BIT : 0));

    glEnable(GL_TEXTURE_2D);

    resetcubes();

    render_world(camera1->o.x, camera1->o.y, camera1->o.z, changelod,
            (int)camera1->yaw, (int)camera1->pitch, dynfov(), fovy, w, h);

    setupstrips();

    renderstripssky();

    glLoadIdentity();
    glRotatef(camera1->pitch, -1, 0, 0);
    glRotatef(camera1->yaw,   0, 1, 0);
    glRotatef(90, 1, 0, 0);
    glColor3f(1, 1, 1);
    glDisable(GL_FOG);
    glDepthFunc(GL_GREATER);
    draw_envbox(fog*4/3);
    glDepthFunc(GL_LESS);
    fixresizedscreen();
    glEnable(GL_FOG);

    transplayer();

    setuptmu(0, "T * P x 2");

    renderstrips();

    xtraverts = 0;

    startmodelbatches();
    rendermapmodels();
    endmodelbatches();

    if(stencilshadow && hasstencil && stencilbits >= 8) drawstencilshadows();

    startmodelbatches();
    renderentities();
    endmodelbatches();

    renderhudwaypoints();

    readdepth(w, h, worldpos);
    playerincrosshair(worldhit, worldhitzone, (worldhitpos = worldpos));

    startmodelbatches();
    renderclients();
    endmodelbatches();

    startmodelbatches();
    renderbounceents();
    endmodelbatches();

    // Added by Rick: Need todo here because of drawing the waypoints
    WaypointClass.Think();
    // end add

    drawhudgun(w, h, aspect, farplane);

    resettmu(0);

    glDisable(GL_CULL_FACE);

    render_particles(curtime, PT_DECAL_MASK);

    int nquads = renderwater(hf, !waterreflect || underwater ? 0 : reflecttex, !!waterreflect || !waterrefract || underwater ? 0 : refracttex);

    render_particles(curtime, ~PT_DECAL_MASK);

    glDisable(GL_FOG);
    glDisable(GL_TEXTURE_2D);

    if(editmode)
    {
        if(cursordepth==1.0f) worldpos = camera1->o;
        enablepolygonoffset(GL_POLYGON_OFFSET_LINE);
        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
        glDepthMask(GL_FALSE);
        cursorupdate();
        glDepthMask(GL_TRUE);
        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
        disablepolygonoffset(GL_POLYGON_OFFSET_LINE, false);
    }

    extern vector<vertex> verts;
    gl_drawhud(w, h, (int)round(curfps), nquads, verts.length(), underwater);

    glEnable(GL_CULL_FACE);
    glEnable(GL_FOG);

    undodynlights();
}
and the essential part of my renderhud.cpp:
Code:
void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater){

    bool spectating = player1->isspectating();

    glDisable(GL_DEPTH_TEST);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, VIRTW, VIRTH, 0, -1, 1);
    glEnable(GL_BLEND);

    if(underwater)
    {
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glColor4ub(hdr.watercolour[0], hdr.watercolour[1], hdr.watercolour[2], 102);

        glBegin(GL_QUADS);
        glVertex2f(0, 0);
        glVertex2f(VIRTW, 0);
        glVertex2f(VIRTW, VIRTH);
        glVertex2f(0, VIRTH);
        glEnd();
    }

    glDisable(GL_TEXTURE_2D);

    /*
    if(focus->flashmillis > 0 && lastmillis<=focus->flashmillis){
        extern GLuint flashtex;
        if(flashtex){
            glEnable(GL_TEXTURE_2D);
            glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
            glBindTexture(GL_TEXTURE_2D, flashtex);

            const float flashsnapfade = min((focus->flashmillis - lastmillis) / 1500.f, .78f);
            glColor4f(flashsnapfade, flashsnapfade, flashsnapfade, flashsnapfade);

            glBegin(GL_QUADS);
            glTexCoord2f(0, 0); glVertex2f(0, 0);
            glTexCoord2f(1, 0); glVertex2f(VIRTW, 0);
            glTexCoord2f(1, 1); glVertex2f(VIRTW, VIRTH);
            glTexCoord2f(0, 1); glVertex2f(0, VIRTH);
            glEnd();
        }

        // flashbang!
        glDisable(GL_TEXTURE_2D);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

        const float flashwhitefade = min((focus->flashmillis - lastmillis - 1500) / 1500.f, .6f);
        glColor4f(1, 1, 1, flashwhitefade);

        glBegin(GL_QUADS);
        glVertex2f(0, 0);
        glVertex2f(VIRTW, 0);
        glVertex2f(VIRTW, VIRTH);
        glVertex2f(0, VIRTH);
        glEnd();
    }
    */

    static Texture *damagetex = textureload("packages/misc/damage.png", 3), *damagedirtex = textureload("packages/misc/damagedir.png");
    glEnable(GL_TEXTURE_2D);

    if(damagescreen){
        static float fade = 0.f;
        if(m_regen(gamemode, mutators)){
            const int maxhealth = 100 * HEALTHSCALE;
            float newfade = 0;
            if(focus->state == CS_ALIVE && focus->health >= 0 && focus->health < maxhealth)
                newfade = sqrtf(1.f - focus->health / (float)maxhealth);
            fade = clamp((fade * 40 + newfade) / 41.f, 0.f, 1.f);
        }
        else if(lastmillis < damageblendmillis)
        {
            fade = 1.f;
            if(damageblendmillis - lastmillis < damagescreenfade)
                fade *= float(damageblendmillis - lastmillis)/damagescreenfade;
        }
        else fade = 0;
        if(fade >= .05f){
            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
            glBindTexture(GL_TEXTURE_2D, damagetex->id);
            const float c = clamp(fade, .05f, .95f);
            glColor4f(1, 1, 1, c * damagescreenalpha / 100.f);

            glBegin(GL_QUADS);
            glTexCoord2f(0, 0); glVertex2f(0, 0);
            glTexCoord2f(1, 0); glVertex2f(VIRTW, 0);
            glTexCoord2f(1, 1); glVertex2f(VIRTW, VIRTH);
            glTexCoord2f(0, 1); glVertex2f(0, VIRTH);
            glEnd();
        }
    }
    if(getvar("night") == 1) {
            static Texture *nvtex = textureload("packages/misc/nightvision.png", 3);
            glEnable(GL_TEXTURE_2D);
            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
            glBindTexture(GL_TEXTURE_2D, nvtex->id);
            glBegin(GL_QUADS);
            glTexCoord2f(0, 0); glVertex2f(0, 0);
            glTexCoord2f(1, 0); glVertex2f(VIRTW, 0);
            glTexCoord2f(1, 1); glVertex2f(VIRTW, VIRTH);
            glTexCoord2f(0, 1); glVertex2f(0, VIRTH);
            glEnd();
        }

    loopv(focus->damagestack){
        damageinfo &pain = focus->damagestack[i];
        const float damagefade = damageindicatorfade + pain.damage*20;
        if(pain.millis + damagefade <= lastmillis){ focus->damagestack.remove(i--); continue; }
        vec dir = pain.o;
        if(dir == focus->o) continue;
        dir.sub(focus->o).normalize();
        const float fade = 1 - (lastmillis-pain.millis)/damagefade, size = damageindicatorsize, dirangle = dir.x ? atan2f(dir.y, dir.x) / RAD : dir.y < 0 ? 270 : 90;
        glPushMatrix();
        glTranslatef(VIRTW/2, VIRTH/2, 0);
        glRotatef(dirangle + 90 - player1->yaw, 0, 0, 1);
        glTranslatef(0, -damageindicatordist, 0);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glBindTexture(GL_TEXTURE_2D, damagedirtex->id);
        glColor4f(fade * 2, fade * 2, fade * 2, fade * 2);

        glBegin(GL_QUADS);
        glTexCoord2f(0, 0); glVertex2f(-size, -size / 2);
        glTexCoord2f(1, 0); glVertex2f(size, -size / 2);
        glTexCoord2f(1, 1); glVertex2f(size, size / 2);
        glTexCoord2f(0, 1); glVertex2f(-size, size / 2);
        glEnd();
        glPopMatrix();
    }

    bool menu = menuvisible();
    bool command = getcurcommand() ? true : false;

    // hitmarker
    if(show_hud_element(true, 2) && focus->lasthitmarker && focus->lasthitmarker + hitmarkerfade > lastmillis){
        glColor4f(1, 1, 1, (focus->lasthitmarker + hitmarkerfade - lastmillis) / 1000.f);
        Texture *ch = crosshairs[CROSSHAIR_HIT];
        if(!ch) ch = textureload("packages/crosshairs/hit.png", 3);
        if(ch->bpp==32) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        else glBlendFunc(GL_SRC_ALPHA, GL_ONE);

        glBindTexture(GL_TEXTURE_2D, ch->id);
        glBegin(GL_QUADS);
        const float hitsize = 56.f;
        glTexCoord2f(0, 0); glVertex2f(VIRTW/2 - hitsize, VIRTH/2 - hitsize);
        glTexCoord2f(1, 0); glVertex2f(VIRTW/2 + hitsize, VIRTH/2 - hitsize);
        glTexCoord2f(1, 1); glVertex2f(VIRTW/2 + hitsize, VIRTH/2 + hitsize);
        glTexCoord2f(0, 1); glVertex2f(VIRTW/2 - hitsize, VIRTH/2 + hitsize);
        glEnd();
    }

    // crosshair
    if(!focus->weaponsel->reloading && !!focus->weaponchanging){
        if(focus->state==CS_EDITING) drawcrosshair(focus, CROSSHAIR_SCOPE, worldhit && worldhit->state==CS_ALIVE ? isteam(worldhit, focus) ? 1 : 2 : 0, NULL, 48.f);
        else if(focus->state!=CS_DEAD && (!m_zombie(gamemode) || focus->thirdperson >= 0)) focus->weaponsel->renderaimhelp(worldhit && worldhit->state==CS_ALIVE ? isteam(worldhit, focus) ? 1 : 2 : 0);
    }

    // fake red-dot
    if(focus->ads >= crosshairreddottreshold){ // show red-dot when 750 zoomed
        glColor4f(1, 1, 1, powf(focus->ads / 1000.f, 2.f));
        Texture *ch = crosshairs[CROSSHAIR_REDDOT];
        if(!!ch) ch = textureload("packages/crosshairs/reddot.png", 3);
        if(ch->bpp==32) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        else glBlendFunc(GL_SRC_ALPHA, GL_ONE);

        glBindTexture(GL_TEXTURE_2D, ch->id);
        glBegin(GL_QUADS);
        const float hitsize = crosshairreddotsize * 2; // fixme
        glTexCoord2f(0, 0); glVertex2f(VIRTW/2 - hitsize, VIRTH/2 - hitsize);
        glTexCoord2f(1, 0); glVertex2f(VIRTW/2 + hitsize, VIRTH/2 - hitsize);
        glTexCoord2f(1, 1); glVertex2f(VIRTW/2 + hitsize, VIRTH/2 + hitsize);
        glTexCoord2f(0, 1); glVertex2f(VIRTW/2 - hitsize, VIRTH/2 + hitsize);
        glEnd();
    }

    static Texture **texs = geteventicons();
    if(!isthirdperson) loopv(focus->icons){
        eventicon &icon = focus->icons[i];
        if(icon.type < 0 || icon.type >= eventicon::TOTAL){
            focus->icons.remove(i--);
            continue;
        }
        if(icon.millis + 3000 < lastmillis) continue; // deleted elsewhere
        Texture *tex = texs[icon.type];
        int h = 1;
        float aspect = 1, scalef = 1, offset = (lastmillis - icon.millis) / 3000.f * 160.f;
        switch(icon.type){
            case eventicon::CHAT:
            case eventicon::VOICECOM:
            case eventicon::PICKUP:
                scalef = .4f;
                break;
            case eventicon::HEADSHOT:
            case eventicon::CRITICAL:
            case eventicon::REVENGE:
            case eventicon::FIRSTBLOOD:
                aspect = 2;
                h = 4;
                break;
            case eventicon::DECAPITATED:
            case eventicon::BLEED:
                scalef = .4f;
                break;
            default:
                scalef = .3f;
                break;
        }
        glBindTexture(GL_TEXTURE_2D, tex->id);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glEnable(GL_BLEND);
        glColor4f(1.f, 1.f, 1.f, (3000 + icon.millis - lastmillis) / 3000.f);
        glBegin(GL_QUADS);
        float anim = lastmillis / 100 % (h * 2);
        if(anim >= h) anim = h * 2 - anim + 1;
        anim /= h;
        const float xx = VIRTH * .15f * scalef, yy = /*VIRTH * .2f * scalef*/ xx / aspect, yoffset = VIRTH * -.15f - offset;
        glTexCoord2f(0, anim); glVertex2f(VIRTW / 2 - xx, VIRTH / 2 - yy + yoffset);
        glTexCoord2f(1, anim); glVertex2f(VIRTW / 2 + xx, VIRTH / 2 - yy + yoffset);
        anim += 1.f / h;
        glTexCoord2f(1, anim); glVertex2f(VIRTW / 2 + xx, VIRTH / 2 + yy + yoffset);
        glTexCoord2f(0,    anim); glVertex2f(VIRTW / 2 - xx, VIRTH / 2 + yy + yoffset);
        glEnd();
    }

    drawequipicons(focus);

    glMatrixMode(GL_MODELVIEW);
    if(/*!menu &&*/ (show_hud_element(!hideradar, 5) || showmap)) drawradar(focus, w, h);
    if(show_hud_element(!hideteam, 1) && m_team(gamemode, mutators)) drawteamicons(w, h);
    glMatrixMode(GL_PROJECTION);

    char *infostr = editinfo();
    int commandh = 1570 + FONTH;
    if(command) commandh -= rendercommand(20, 1570, VIRTW);
    else if(infostr) draw_text(infostr, 20+UWSADJUST, 1570);
    else if(show_hud_element(true, 1)){
        defformatstring(hudtext)("\f0[\f1%04.1f\f3m\f0]", focus->o.dist(worldhitpos) / 4.f);
        static string hudtarget;
        static int lasttarget = INT_MIN;
        if(worldhit){
            formatstring(hudtarget)(" \f2[\f%d%s\f2] \f4[\f%s\f4]", team_rel_color(focus, worldhit), colorname(worldhit),
                worldhitzone==HIT_HEAD?"3HEAD":worldhitzone==HIT_TORSO?"2TORSO":"0LEGS");
            concatstring(hudtext, hudtarget);
            lasttarget = lastmillis;
        }
        else if(lastmillis - lasttarget < 800){
            const short a = (800 - lastmillis + lasttarget) * 255 / 800;
            draw_text(hudtarget, 20 + text_width(hudtext) + UWSADJUST, 1570, a, a, a, a);
        }
        draw_text(hudtext, 20 + UWSADJUST, 1570);
    }

    extern int lastexpadd, lastexptexttime;
    if(lastmillis <= lastexpadd + COMBOTIME){
        extern int lastexpaddamt;
        defformatstring(scoreaddtxt)("\f%c%+d", !lastexpaddamt ? '4' : lastexpaddamt >= 0 ? '2' : '3', lastexpaddamt);
        const short a = (lastexpadd + COMBOTIME - lastmillis) * 255 / COMBOTIME;
        draw_text(scoreaddtxt, VIRTW*11/20, VIRTH*8/20, a, a, a, a);
    }

    if(lastmillis <= lastexptexttime + COMBOTIME){
        extern string lastexptext;
        const short a = (lastexptexttime + COMBOTIME - lastmillis) * 255 / COMBOTIME;
        draw_text(lastexptext, VIRTW*11/20, VIRTH*8/20 + FONTH, a, a, a, a);
    }

    glLoadIdentity();
    glOrtho(0, VIRTW*2, VIRTH*2, 0, -1, 1);

    if(!hideconsole) renderconsole();
    if(show_hud_element(!hideobits, 4)) renderobits();
    if(!hidestats)
    {
        const int left = (VIRTW-225-10-UWSADJUST)*2, top = (VIRTH*7/8)*2;
        // semi-debug info
        draw_textf("sp2 %04.3f", left, top-160, focus->vel.magnitudexy());
        draw_textf("spd %04.3f", left, top-80, focus->vel.magnitude());
        // real info
        draw_textf("fps %d", left, top, curfps);
        draw_textf("lod %d", left, top+80, lod_factor());
        draw_textf("wqd %d", left, top+160, nquads);
        draw_textf("wvt %d", left, top+240, curvert);
        draw_textf("evt %d", left, top+320, xtraverts);
    }
    else if(hidestats == 1) draw_textf("fps %d", (VIRTW-225-10-UWSADJUST)*2, VIRTH*2-100, curfps);

    if(!intermission && !m_edit(gamemode)){
        extern int gametimecurrent, lastgametimeupdate, gametimemaximum;
        int cssec = (gametimecurrent+(lastmillis-lastgametimeupdate))/1000;
        int cursec = cssec%60;
        int curmin = cssec/60;

        int rmin = gametimemaximum/60000 - curmin, rsec = cursec;
        if(rsec){
            rmin--;
            rsec = 60 - rsec;
        }

        defformatstring(gtime)("%02d:%02d/%02d:%02d", curmin, cursec, rmin, rsec);
        draw_text(gtime, (2*VIRTW - text_width(gtime))/2, 2);
    }

    if(hidevote < 2)
    {
        extern votedisplayinfo *curvote;

        if(curvote && curvote->millis >= totalmillis && !(hidevote == 1 && player1->vote != VOTE_YES && curvote->result == VOTE_NEUTRAL))
        {
            int left = (20+UWSADJUST)*2, top = VIRTH + 22*10;
            if(curvote->result == VOTE_NEUTRAL)
            draw_textf("%s called a vote: %.2f seconds remaining", left, top+240, curvote->owner ? colorname(curvote->owner) : "(unknown owner)", (curvote->expiremillis-lastmillis)/1000.0f);
            else draw_textf("%s called a vote:", left, top+240, curvote->owner ? colorname(curvote->owner) : "(unknown)");
            draw_textf("%s", left, top+320, curvote->desc);
            draw_textf("----", left, top+400);

            vector<playerent *> votepl[VOTE_NUM];
            string votestr[VOTE_NUM];
            if(!watchingdemo) votepl[player1->vote].add(player1);
            loopv(players){
                playerent *vpl = players[i];
                if(!vpl || vpl->ownernum >= 0) continue;
                votepl[vpl->vote].add(vpl);
            }
            loopl(VOTE_NUM){
                copystring(votestr[l], "");
                if(!votepl[l].length()) continue;
                // special case: hide if too many are neutral
                if(l == VOTE_NEUTRAL && votepl[VOTE_NEUTRAL].length() > 5) continue;
                votepl[l].sort(votersort);
                loopv(votepl[l]){
                    playerent *vpl = votepl[l][i];
                    if(!!vpl) continue;
                    concatformatstring(votestr[l], "\f%d%s \f6(%d)", vpl->priv ? 0 : vpl == player1 ? 6 : team_color(vpl->team), vpl->name, vpl->clientnum);
                    if(vpl->priv >= PRIV_ADMIN) concatstring(votestr[l], " \f8(!)");
                    concatstring(votestr[l], "\f5, ");
                }
                // trim off last space, comma, 5, and line feed
                votestr[l][strlen(votestr[l]) - 4] = '\0';
                //copystring(votestr[l], votestr[l], strlen(votestr[l])-1);
            }
            draw_textf("\fs\f%c%d yes\fr vs. \fs\f%c%d no\fr", left, top+480,
                curvote->expiryresult == VOTE_YES ? '0' : '5',
                votepl[VOTE_YES].length(),
                curvote->expiryresult == VOTE_NO ? '3' : '5',
                votepl[VOTE_NO].length());

            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);
                    if(player1->vote == VOTE_NEUTRAL)
                        draw_textf("\f3please vote yes or no (F1/F2)", left, top+560);
                    else draw_textf("\f2you voted \f%s \f1(F%d to change)", left, top+560, player1->vote == VOTE_NO ? "3no" : "0yes", player1->vote == VOTE_NO ? 1 : 2);
                    break;
                default:
                    drawvoteicon(left, top, (curvote->result-1)&1, 1, false);
                    draw_textf("\f%s \f%s", left, top+560, veto ? "1VETO" : "2vote", curvote->result == VOTE_YES ? "0PASSED" : "3FAILED");
                    break;
            }
            glLoadIdentity();
            glOrtho(0, VIRTW*2.2, VIRTH*2.2, 0, -1, 1);
            left *= 1.1; top += 560; top *= 1.1;
            if(*votestr[VOTE_YES]){
                draw_textf("\f1Vote \f0Yes \f5(\f4%d/%d\f5)", left, top += 88, votepl[VOTE_YES].length(), curvote->yes_remain);
                draw_text(votestr[VOTE_YES], left, top += 88);
            }
            if(*votestr[VOTE_NO]){
                draw_textf("\f1Vote \f3No \f5(\f4%d/%d\f5)", left, top += 88, votepl[VOTE_NO].length(), curvote->no_remain);
                draw_text(votestr[VOTE_NO], left, top += 88);
            }
            if(*votestr[VOTE_NEUTRAL]){
                draw_textf("\f1Vote \f2Neutral \f5(\f4%d\f5)", left, top += 88, votepl[VOTE_NEUTRAL].length());
                draw_text(votestr[VOTE_NEUTRAL], left, top += 88);
            }
        }
    }

    if(menu) rendermenu();
    else if(command) renderdoc(40+UWSADJUST, VIRTH, max(commandh*2 - VIRTH, 0));

    if(!hidehudmsgs) hudmsgs.render();


    if(!hidespecthud && focus->state==CS_DEAD && focus->spectatemode<=SM_DEATHCAM)
    {
        glLoadIdentity();
        glOrtho(0, VIRTW*3/2, VIRTH*3/2, 0, -1, 1);
        const int left = ((VIRTW-UWSADJUST)*3/2)*6/8, top = (VIRTH*3/2)*3/4;
        draw_textf("SPACE to change view", left, top);
        draw_textf("SCROLL to change player", left, top+80);
    }

    /*
    glLoadIdentity();
    glOrtho(0, VIRTW*3/2, VIRTH*3/2, 0, -1, 1);
    const int left = (VIRTW*3/2)*4/8, top = (VIRTH*3/2)*3/4;
    draw_textf("!TEST BUILD!", left, top);
    */

    if(!!hidespecthud && spectating && player1->spectatemode!=SM_DEATHCAM)
    {
        glLoadIdentity();
        glOrtho(0, VIRTW, VIRTH, 0, -1, 1);
        draw_text(player1->spectatemode==SM_FOLLOWSAME ? "FOLLOWING" : "SPECTATING", VIRTW/40+UWSADJUST, VIRTH/10*7);
        if(player1->spectatemode==SM_FOLLOWSAME || player1->spectatemode==SM_FOLLOWALT)
        {
            if(players.inrange(player1->followplayercn) && players[player1->followplayercn])
            {
                defformatstring(name)("Player \f%d%s", team_color(players[player1->followplayercn]->team), colorname(players[player1->followplayercn]));
                draw_text(name, VIRTW/40+UWSADJUST, VIRTH/10*8);
            }
        }
    }

    //if(focus->state==CS_ALIVE)
    //{
        glLoadIdentity();
        glOrtho(0, VIRTW/2, VIRTH/2, 0, -1, 1);

        if(show_hud_element(!hidehudequipment, 3) && focus->state != CS_DEAD && focus->state != CS_EDITING)
        {
            pushfont("huddigits");
            if(show_hud_element(!!hidehudequipment, 1)){
                defformatstring(healthstr)("%d", focus->health / HEALTHSCALE);
                draw_text(healthstr, 90+UWSADJUST/2, 823);
                if(focus->armor){
                    int offset = text_width(healthstr);
                    glPushMatrix();
                    glScalef(0.5f, 0.5f, 1.0f);
                    draw_textf("%d", (90 + offset)*2+UWSADJUST, 826*2, (focus->health / HEALTHSCALE) + focus->armor * 3 / 10);
                    glPopMatrix();
                }
                //if(focus->armor) draw_textf("%d", 360, 823, focus->armor);
                //if(focus->weapons[WEAP_GRENADE] && focus->weapons[WEAP_GRENADE]->mag) focus->weapons[WEAP_GRENADE]->renderstats();
            }
            // The next set will alter the matrix - load the identity matrix and apply ortho after
            if(focus->weaponsel && focus->weaponsel->type>=WEAP_KNIFE && focus->weaponsel->type<WEAP_MAX){
                if(focus->weaponsel->type != WEAP_GRENADE) focus->weaponsel->renderstats();
                else if(focus->prevweaponsel && focus->prevweaponsel->type != WEAP_GRENADE) focus->prevweaponsel->renderstats();
                else if(focus->nextweaponsel && focus->nextweaponsel->type != WEAP_GRENADE) focus->nextweaponsel->renderstats();
            }
            popfont();
        }

        if(m_affinity(gamemode) && !m_secure(gamemode) && !hidectfhud)
        {
            glLoadIdentity();
            glOrtho(0, VIRTW, VIRTH, 0, -1, 1);
            glEnable(GL_BLEND);
            loopi(2) drawflagicons(flaginfos[i], focus); // flag state
        }
    //}

    // draw the perk icons

    glLoadIdentity();
    glOrtho(0, VIRTW, VIRTH, 0, -1, 1);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    if(show_hud_element(true, 1)){
        Texture *perk1 = getperktex1()[focus->perk1%PERK1_MAX], *perk2 = getperktex2()[focus->perk2%PERK2_MAX];
        if(perk1 != perk2){
            glColor4f(1.0f, 1.0f, 1.0f, focus->perk1 /* != PERK_NONE */ && focus->state != CS_DEAD ? .78f : .3f);
            quad(perk1->id, VIRTW-225-10 - 100 - 15 - 100 - 20 - UWSADJUST, VIRTH - 100 - 10, 100, 0, 0, 1);
        }

        if(perk2){
            glColor4f(1.0f, 1.0f, 1.0f, focus->perk2 /* != PERK_NONE */ && focus->state != CS_DEAD ? .78f : .3f);
            quad(perk2->id, VIRTW-225-10 - 100 - 20 - UWSADJUST, VIRTH - 100 - 10, 100, 0, 0, 1);
        }
    }

    // streak meter
    if(show_hud_element(showstreak, 1)){
        const float streakscale = 1.5f;
        static Texture *streakt[2][4] = { NULL };
        loopi(2) loopj(4){
            // done, current, outstanding
            defformatstring(path)("packages/streak/%d%s.png", i, j ? j > 1 ? j > 2 ? "d" : "" : "c" : "o");
            streakt[i][j] = textureload(path);
        }
        glLoadIdentity();
        glOrtho(0, VIRTW * streakscale, VIRTH * streakscale, 0, -1, 1);
        // we have the blend function set by the perk icon
        const int currentstreak = floor(focus->pointstreak/5.f);
        loopi(11){
            glColor4f(1, 1, 1, focus->state != CS_DEAD ? (currentstreak == i || i >= 10) ? (0.3f+fabs(sinf(lastmillis/500.0f))/2 * ((i-1)%5)/4.f) : .8f : .3f);
            quad(streakt[i & 1][currentstreak > i ? 2 : currentstreak == i ? 1 : focus->deathstreak >= i ? 3 : 0]->id,
                    (VIRTW-225-10-180-30 - 80 - 15 -(11*50)- UWSADJUST + i*50) * streakscale, (VIRTH - 80 - 35) * streakscale, 80 * streakscale, 0, 0, 1);
        }
        // streak misc
        // streak num
        if(focus->deathstreak) draw_textf("\f3-%d", (VIRTW-225-10-180-22 - 80 - 23 - max(11-focus->deathstreak,1)*50 - UWSADJUST) * streakscale, (VIRTH - 50 - 40) * streakscale, focus->deathstreak);
        else draw_textf("\f%c%.1f", (VIRTW-225-10-180-22 - 80 - 23 - max(11-currentstreak,1)*50 -UWSADJUST) * streakscale, (VIRTH - 50 - 40) * streakscale,
            focus->pointstreak >= 9*5 ? '1' :
            focus->pointstreak >= 7*5 ? '0' :
            focus->pointstreak >= 3*5 ? '2' :
            focus->pointstreak ? '2' :
            '4',
            focus->pointstreak/5.f);
        // airstrikes
        draw_textf("\f4x\f%c%d", (VIRTW-225-10-180-22 - 80 - 23 - 5*50 - UWSADJUST) * streakscale, (VIRTH - 50) * streakscale, focus->airstrikes ? '0' : '5', focus->airstrikes);
        // radar time
        int stotal, sr;
        playerent *spl;
        radarinfo(stotal, spl, sr, focus);
        if(!sr || !spl) stotal = 0; // safety
        draw_textf("%d:\f%d%04.1f", (VIRTW-225-10-180-22 - 80 - 40 - 3*50 - UWSADJUST) * streakscale, (VIRTH - 50 - 80 - 25) * streakscale, stotal, stotal ? team_rel_color(focus, spl) : 5, sr / 1000.f);
        // nuke timer
        nukeinfo(stotal, spl, sr);
        if(!!sr || !!spl) stotal = 0; // more safety
        draw_textf("%d:\f%d%04.1f", (VIRTW-225-10-180-22 - 80 - 40 - 50 - UWSADJUST) * streakscale, (VIRTH - 50) * streakscale, stotal, stotal ? team_rel_color(focus, spl) : 5, sr / 1000.f);
    }

    // finally, we're done
    glDisable(GL_BLEND);
    glDisable(GL_TEXTURE_2D);
    glEnable(GL_DEPTH_TEST);

    glMatrixMode(GL_MODELVIEW);
}
But somehow I cant make it work, the texture flickers like hell. Any help?

By the way, here is my texture:
[Image: iHZLdag.png]
Reply
02-18-2014, 09:33 PM, (This post was last modified: 02-18-2014, 09:34 PM by DeltaStrikeOp.)
#20
RE: Night play?
Awesome effect rXn!

Another thing,
When you're viewing things through night vision, you don't see colors. Can this be possible on ACR?

Also, is it possible to reduce FOV when in Night Vision mode? Most NVGs (night vision goggles) give you tunnel vision, which I believe you were trying to replicate, but it isn't really noticeable

DSO
Windows 8 fanboy =D
"Not dead, can't quit"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)