diff options
Diffstat (limited to 'src/fpsgame/fps.cpp')
| -rw-r--r-- | src/fpsgame/fps.cpp | 271 |
1 files changed, 4 insertions, 267 deletions
diff --git a/src/fpsgame/fps.cpp b/src/fpsgame/fps.cpp index 6a72335..7b066ca 100644 --- a/src/fpsgame/fps.cpp +++ b/src/fpsgame/fps.cpp @@ -94,7 +94,6 @@ namespace game spawnplayer(player1); showscores(false); lasthit = 0; - if(cmode) cmode->respawned(player1); } } @@ -260,7 +259,6 @@ namespace game moveplayer(player1, 10, true); swayhudgun(curtime); entities::checkitems(player1); - if(cmode) cmode->checkitems(player1); } } if(player1->clientnum>=0) c2sinfo(); // do this last, to reduce the effective frame lag @@ -281,7 +279,7 @@ namespace game { fpsent *p = (fpsent *)d; vec loc = vec(e.o).addz(p->eyeheight); - float maxrange = !m_noitems ? 400.0f : (cmode ? 300.0f : 110.0f); + float maxrange = !m_noitems ? 400.0f : 110.0f; float minplayerdist = maxrange; loopv(players) { @@ -302,15 +300,13 @@ namespace game if(raycube(loc, dir, dist) < dist) dist *= 1.5f; minplayerdist = min(minplayerdist, dist); } - float rating = 1.0f - proximityscore(minplayerdist, 80.0f, maxrange); - return cmode ? harmonicmean(rating, cmode->ratespawn(p, e)) : rating; + return 1.0f - proximityscore(minplayerdist, 80.0f, maxrange); } void pickgamespawn(fpsent *d) { int ent = d == player1 && respawnent >= 0 ? respawnent : -1; - int tag = cmode ? cmode->getspawngroup(d) : 0; - findplayerspawn(d, ent, tag); + findplayerspawn(d, ent, 0); } void spawnplayer(fpsent *d) // place at random spawn @@ -332,14 +328,6 @@ namespace game if(player1->state==CS_DEAD) { player1->attacking = false; - int wait = cmode ? cmode->respawnwait(player1) : 0; - if(wait>0) - { - lastspawnattempt = lastmillis; - //conoutf(CON_GAMEINFO, "\f2you must wait %d second%s before respawn!", wait, wait!=1 ? "s" : ""); - return; - } - if(lastmillis < player1->lastpain + spawnwait) return; respawnself(); } } @@ -406,17 +394,13 @@ namespace game d->state = CS_DEAD; d->lastpain = lastmillis; if(!restore) d->deaths++; - //~{ - //~gibeffect(max(-d->health, 0), d->vel, d); - //~d->deaths++; - //~} + if(d==player1) { if(deathscore) showscores(true); disablezoom(); if(!restore) loopi(NUMGUNS) savedammo[i] = player1->ammo[i]; d->attacking = false; - //d->pitch = 0; d->roll = 0; playsound(S_DIE1+rnd(2)); } @@ -457,8 +441,6 @@ namespace game } else if((d->state!=CS_ALIVE && d->state != CS_LAGGED && d->state != CS_SPAWNING) || intermission) return; - if(cmode) cmode->died(d, actor); - fpsent *h = followingplayer(player1); int contype = d==h || actor==h ? CON_FRAG_SELF : CON_FRAG_OTHER; const char *dname = "", *aname = ""; @@ -511,7 +493,6 @@ namespace game { intermission = true; player1->attacking = false; - if(cmode) cmode->gameover(); conoutf(CON_GAMEINFO, "\f2intermission:"); conoutf(CON_GAMEINFO, "\f2game has ended!"); conoutf(CON_GAMEINFO, "\f2player frags: %d, deaths: %d", player1->frags, player1->deaths); @@ -576,7 +557,6 @@ namespace game removeweapons(d); removetrackedparticles(d); removetrackeddynlights(d); - if(cmode) cmode->removeplayer(d); players.removeobj(d); DELETEP(clients[cn]); cleardynentcache(); @@ -618,18 +598,10 @@ namespace game d->respawned = d->suicided = -2; } - setclientmode(); - intermission = false; maptime = maprealtime = 0; maplimit = -1; - if(cmode) - { - cmode->preload(); - cmode->setup(); - } - conoutf(CON_GAMEINFO, "\f2game mode is %s", server::modename(gamemode)); const char *info = m_valid(gamemode) ? gamemodes[gamemode - STARTGAMEMODE].info : NULL; @@ -872,43 +844,12 @@ namespace game pophudmatrix(); } - //~void drawspeedometer(fpsent *d, int w, int h) { - //~int speedforreal = (int) (sqrtf(d->vel.squaredlen()) + 1.0f); - //~speedforreal = (speedforreal == 1) ? 0 : speedforreal; - //~vec colour = vec(255, 255, 255); - //~float realw = 0; - //~float realh = 0; - //~if (speedometercolor) { - //~if (speedforreal==0) colour = vec(60, 60, 60); - //~else if (speedforreal>0 && speedforreal<=60) colour = vec(240, 30, 30); - //~else if (speedforreal>60 && speedforreal<=120) colour = vec(180, 90, 60); - //~else if (speedforreal>120 && speedforreal<=180) colour = vec(180, 180, 30); - //~else if (speedforreal>180 && speedforreal<=240) colour = vec(90, 180, 60); - //~else colour = vec(30, 240, 30); - //~} - - //~defformatstring(speedstring, "%d", speedforreal); - //~text_boundsf(speedstring, realw, realh); - //~vec2 offset = vec2(speedometerx, speedometery).mul(vec2(w, h).div(speedometerscale)); - //~offset.x -= realw/2.0f; - //~offset.y -= realh/2.0f; - - //~pushhudmatrix(); - //~hudmatrix.scale(speedometerscale, speedometerscale, 1); - //~flushhudmatrix(); - - //~draw_text(speedstring, int(offset.x), int(offset.y), colour.x, colour.y, colour.z, speedometeralpha); - - //~pophudmatrix(); - //~} - void hudquad(float x, float y, float w, float h, float r = 1, float g = 1, float b = 1, float tx = 0, float ty = 0, float tw = 1, float th = 1) { gle::defvertex(2); gle::deftexcoord0(); gle::colorf(r, g, b); gle::begin(GL_TRIANGLE_STRIP); - //~gle::begin(GL_QUADS); gle::attribf(x, y); gle::attribf(tx, ty); gle::attribf(x+w, y); gle::attribf(tx + tw, ty); gle::attribf(x, y+h); gle::attribf(tx, ty + th); @@ -1019,29 +960,6 @@ namespace game void drawhudicons(fpsent *d, int w, int h) { - //~defformatstring(health, "%d", d->state==CS_DEAD ? 0 : d->health); - //~bvec healthcolor = bvec::hexcolor(healthcolors && !m_insta ? (d->state==CS_DEAD ? 0x808080 : (d->health<=25 ? 0xFF0000 : (d->health<=50 ? 0xFF8000 : (d->health<=100 ? 0xFFFFFF : 0x40C0FF)))) : 0xFFFFFF); - //~draw_text(health, (HICON_X + HICON_SIZE + HICON_SPACE)/2, HICON_TEXTY/2, healthcolor.r, healthcolor.g, healthcolor.b); - //~if(d->state!=CS_DEAD) - //~{ - //~if(d->armour) draw_textf("%d", (HICON_X + HICON_STEP + HICON_SIZE + HICON_SPACE)/2, HICON_TEXTY/2, d->armour); - //~draw_textf("%d", (HICON_X + 2*HICON_STEP + HICON_SIZE + HICON_SPACE)/2, HICON_TEXTY/2, d->ammo[d->gunselect]); - //~} - - //~if(d->state != CS_DEAD && d->maxhealth > 100) - //~{ - //~float scale = 0.66f; - //~pushhudmatrix(); - //~hudmatrix.scale(scale, scale, 1); - //~flushhudmatrix(); - - //~float width, height; - //~text_boundsf(health, width, height); - //~draw_textf("/%d", (HICON_X + HICON_SIZE + HICON_SPACE + width*2)/scale, (HICON_TEXTY + height)/scale, d->maxhealth); - - //~pophudmatrix(); - //~} - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); @@ -1126,15 +1044,6 @@ namespace game float ammoratio = (float)p->ammo[gun] / itemstats[gun-GUN_SG].add; bvec color = bvec::hexcolor(p->ammo[gun] == 0 || ammoratio >= 1.0f ? 0xFFFFFF : (ammoratio >= 0.5f ? 0xFFC040 : 0xFF0000)); draw_text(label, textdrawpos.x, textdrawpos.y, color.r, color.g, color.b, alpha); - /// ALIGN STUFF AND ADD COMMAND FOR IT... - //~text_bounds(label, movew, moveh); - //~moved = movew + 6; - //~defformatstring(damagedealt, "| %d ", pwdamagedealt[gun]); - //~draw_text(damagedealt, textdrawpos.x+moved, textdrawpos.y, color.r, color.g, color.b, alpha); - //~text_bounds(damagedealt, movew, moveh); - //~moved += movew; - //~defformatstring(accuracy, "| %d %%", pwaccuracy[gun]); - //~draw_text(accuracy, textdrawpos.x+moved, textdrawpos.y, color.r, color.g, color.b, alpha); pophudmatrix(); } @@ -1216,175 +1125,8 @@ namespace game pophudmatrix(); } - //~void newhud(int w, int h) //new SauerEnhanced HUD - //~{ - //~if(player1->state==CS_DEAD || player1->state==CS_SPECTATOR) return; - //~glPushMatrix(); - //~glScalef(1/1.2f, 1/1.2f, 1); - //~pushhudmatrix(); - //~hudmatrix.scale(w/1800.0f, h/1650.0f, 1); - //~hudmatrix.scale(1.0f/1.2f, 1.0f/1.2f, 1); - //~flushhudmatrix(); - //~if(!m_insta) draw_textf("%d", 80, h*1.2f-128, player1->state==CS_DEAD ? 0 : player1->health); - //~defformatstring(ammo, "%d", player1->ammo[player1->gunselect]); - //~int wb, hb; - //~text_bounds(ammo, wb, hb); - //~draw_textf("%d", w*1.2f-wb-80, h*1.2f-128, player1->ammo[player1->gunselect]); - - //~hudmatrix.ortho(0, w, h, 0, -1, 1); - //~resethudmatrix(); - - //~hudshader->set(); - //~gle::colorf(1, 1, 1); - - //~gle::defvertex(2); - //~gle::deftexcoord0(); - - //~if(player1->quadmillis) - //~{ - //~gle::begin(GL_QUADS); - //~loopj(numdecals) - //~{ - //~float hsz = decals[j].size, hx = clamp(decals[j].x, hsz, w-hsz), hy = clamp(decals[j].y, hsz, h-hsz), side = decals[j].side; - //~gle::attribf(hx-hsz, hy-hsz); gle::attribf(side, 0); - //~gle::attribf(hx+hsz, hy-hsz); gle::attribf(1-side, 0); - //~gle::attribf(hx+hsz, hy+hsz); gle::attribf(1-side, 1); - //~gle::attribf(hx-hsz, hy+hsz); gle::attribf(side, 1); - //~} - //~gle::end(); - //~settexture("packages/hud/hud_quaddamage_left.png"); //QuadDamage left glow - //~gle::begin(GL_QUADS); - //~gle::attribf(0, h*1.2f-207); gle::attribf(0.0f, 0.0f); - //~gle::attribf(539, h*1.2f-207); gle::attribf(1.0f, 0.0f); - //~gle::attribf(539, h*1.2f); gle::attribf(1.0f, 1.0f); - //~gle::attribf(0, h*1.2f); gle::attribf(0.0f, 1.0f); - //~gle::end(); - - //~settexture("packages/hud/hud_quaddamage_right.png"); //QuadDamage right glow - //~gle::begin(GL_QUADS); - //~gle::attribf(w*1.2f-135, h*1.2f-207); gle::attribf(0.0f, 0.0f); - //~gle::attribf(w*1.2f, h*1.2f-207); gle::attribf(1.0f, 0.0f); - //~gle::attribf(w*1.2f, h*1.2f); gle::attribf(1.0f, 1.0f); - //~gle::attribf(w*1.2f-135, h*1.2f); gle::attribf(0.0f, 1.0f); - //~gle::end(); - //~} - - //~if(player1->maxhealth > 100) - //~{ - //~settexture("packages/hud/hud_megahealth.png"); //HealthBoost indicator - //~gle::begin(GL_QUADS); - //~gle::attribf(0, h*1.2f-207); gle::attribf(0.0f, 0.0f); - //~gle::attribf(539, h*1.2f-207); gle::attribf(1.0f, 0.0f); - //~gle::attribf(539, h*1.2f); gle::attribf(1.0f, 1.0f); - //~gle::attribf(0, h*1.2f); gle::attribf(0.0f, 1.0f); - //~gle::end(); - //~} - - //~gle::begin(GL_QUADS); - //~gle::attribf(w/2-speedow/2, h/2-speedoh/2); gle::attribf(0.0f, 1.0f); - //~gle::attribf(w/2, h/2-speedoh/2); gle::attribf(1.0f, 1.0f); - //~gle::attribf(w/2, h/2); gle::attribf(1.0f, 1.0f); - //~gle::attribf(w/2-speedow/2, h/2); gle::attribf(0.0f, 1.0f); - //~gle::end(); - - //~int health = (player1->health*100)/player1->maxhealth, - //~armour = (player1->armour*100)/200, - //~hh = (health*101)/100; - - //~float hs = (health*1.0f)/100; - - //~if(player1->health > 0 && !m_insta) - //~{ - //~settexture("packages/hud/hud_health.png"); //Health bar - //~hudquad(4000, 600, 97, 56); - //~gle::begin(GL_QUADS); - //~gle::attribf(47, h*1.2f-hh-56); gle::attribf(0.0f, 1.0f-hs); - //~gle::attribf(97, h*1.2f-hh-56); gle::attribf(1.0f, 1.0f-hs); - //~gle::attribf(97, h*1.2f-57); gle::attribf(1.0f, 1.0f); - //~gle::attribf(47, h*1.2f-57); gle::attribf(0.0f, 1.0f); - //~gle::end(); - //~} - - //~if(player1->armour > 0) - //~{ - //~settexture("packages/hud/hud_armour.png"); //Armour bar - //~gle::begin(GL_QUADS); - //~gle::attribf(130, h*1.2f-62);gle::attribf(0.0f, 0.0f); - //~gle::attribf(130+ah, h*1.2f-62);gle::attribf(as, 0.0f); - //~gle::attribf(130+ah, h*1.2f-44);gle::attribf(as, 1.0f); - //~gle::attribf(130, h*1.2f-44);gle::attribf(0.0f, 1.0f); - //~gle::end(); - //~} - - //~if(!m_insta) - //~{ - //~settexture("packages/hud/hud_left.png"); //left HUD - //~gle::begin(GL_QUADS); - //~gle::attribf(0, h*1.2f-207);gle::attribf(0.0f, 0.0f); - //~gle::attribf(539, h*1.2f-207);gle::attribf(1.0f, 0.0f); - //~gle::attribf(539, h*1.2f );gle::attribf(1.0f, 1.0f); - //~gle::attribf(0, h*1.2f );gle::attribf(0.0f, 1.0f); - //~gle::end(); - //~} - - //~settexture("packages/hud/hud_right.png"); //right HUD - //~gle::begin(GL_QUADS); - //~gle::attribf(w*1.2f-135, h*1.2f-207);gle::attribf(0.0f, 0.0f); - //~gle::attribf(w*1.2f, h*1.2f-207);gle::attribf(1.0f, 0.0f); - //~gle::attribf(w*1.2f, h*1.2f );gle::attribf(1.0f, 1.0f); - //~gle::attribf(w*1.2f-135, h*1.2f );gle::attribf(0.0f, 1.0f); - //~gle::end(); - - //~int maxammo = 0; - - //~switch(player1->gunselect) - //~{ - //~case GUN_FIST: - //~maxammo = 1; - //~break; - - //~case GUN_RL: - //~case GUN_RIFLE: - //~maxammo = m_insta ? 100 : 15; - //~break; - - //~case GUN_SG: - //~case GUN_GL: - //~maxammo = 30; - //~break; - - //~case GUN_CG: - //~maxammo = 60; - //~break; - - //~case GUN_PISTOL: - //~maxammo = 120; - //~break; - //~} - - //~int curammo = (player1->ammo[player1->gunselect]*100)/maxammo, - //~amh = (curammo*101)/100; - - //~float ams = (curammo*1.0f)/100; - - //~if(player1->ammo[player1->gunselect] > 0) - //~{ - //~settexture("packages/hud/hud_health.png"); //Ammo bar - //~gle::begin(GL_QUADS); - //~gle::attribf(w*1.2f-47, h*1.2f-amh-56);gle::attribf(0.0f, 1.0f-ams); - //~gle::attribf(w*1.2f-97, h*1.2f-amh-56);gle::attribf(1.0f, 1.0f-ams); - //~gle::attribf(w*1.2f-97, h*1.2f-57 );gle::attribf(1.0f, 1.0f); - //~gle::attribf(w*1.2f-47, h*1.2f-57 );gle::attribf(0.0f, 1.0f); - //~gle::end(); - //~} - //~glPopMatrix(); - //~pophudmatrix(); - //~} - void gameplayhud(int w, int h) { - //~newhud(w, h); - pushhudmatrix(); hudmatrix.scale(h/1800.0f, h/1800.0f, 1); flushhudmatrix(); @@ -1407,10 +1149,6 @@ namespace game } fpsent *d = hudplayer(); - if(d->state!=CS_EDITING) - { - if(cmode) cmode->drawhud(d, w, h); - } pophudmatrix(); @@ -1448,7 +1186,6 @@ namespace game int clipconsole(int w, int h) { - if(cmode) return cmode->clipconsole(w, h); return 0; } |
