fixed sound distance, mapreload vote
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1488 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -428,7 +428,7 @@ void sendmap(char *mapname)
|
||||
if(*mapname)
|
||||
{
|
||||
save_world(mapname);
|
||||
changemap(mapname);
|
||||
changemap(mapname); // FIXME!!
|
||||
}
|
||||
else mapname = getclientmap();
|
||||
if(securemapcheck(mapname)) return;
|
||||
|
||||
@@ -127,8 +127,6 @@ COMMANDN(team, newteam, ARG_1STR);
|
||||
COMMANDN(name, newname, ARG_1STR);
|
||||
COMMANDN(skin, newskin, ARG_1INT);
|
||||
|
||||
//extern void thrownade(playerent *d, const vec &vel, bounceent *p);
|
||||
|
||||
void deathstate(playerent *pl)
|
||||
{
|
||||
pl->state = CS_DEAD;
|
||||
@@ -136,6 +134,7 @@ void deathstate(playerent *pl)
|
||||
pl->move = pl->strafe = 0;
|
||||
pl->pitch = pl->roll = 0;
|
||||
pl->attacking = false;
|
||||
pl->weaponsel->onownerdies();
|
||||
|
||||
if(pl == player1)
|
||||
{
|
||||
@@ -365,8 +364,6 @@ bool tryrespawn()
|
||||
return false;
|
||||
}
|
||||
|
||||
void showteamkill() { player1->lastteamkill = lastmillis; }
|
||||
|
||||
// damage arriving from the network, monsters, yourself, all ends up here.
|
||||
|
||||
void dodamage(int damage, playerent *pl, playerent *actor, bool gib, bool local)
|
||||
@@ -403,9 +400,8 @@ void dokill(playerent *pl, playerent *act, bool gib)
|
||||
outf("\f2%s suicided%s", pname, pl==player1 ? "!" : "");
|
||||
else if(isteam(pl->team, act->team))
|
||||
{
|
||||
if(pl==player1) outf("\f2you got %s by a teammate (%s)", death, aname);
|
||||
else outf("\f2%s %s %s teammate (%s)", aname, death, act==player1 ? "a" : "his", pname);
|
||||
if(act==player1) showteamkill();
|
||||
if(pl==player1) outf("\f2you got %s by teammate %s", death, aname);
|
||||
else outf("%s%s %s teammate %s", act==player1 ? "\f3" : "\f2", aname, death, pname);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -415,8 +411,6 @@ void dokill(playerent *pl, playerent *act, bool gib)
|
||||
|
||||
if(pl==player1)
|
||||
{
|
||||
// FIXME!!!
|
||||
//if(pl->inhandnade) thrownade(pl, vec(0,0,0), pl->inhandnade);
|
||||
if(m_ctf) tryflagdrop(pl!=act && isteam(act->team, pl->team));
|
||||
}
|
||||
if(gib)
|
||||
@@ -762,12 +756,11 @@ void setadmin(char *claim, char *password)
|
||||
COMMAND(setmaster, ARG_1INT);
|
||||
COMMAND(setadmin, ARG_2STR);
|
||||
|
||||
void changemap(char *name) // request map change, server may ignore. silent vote
|
||||
void changemap(char *name) // silently request map change, server may ignore
|
||||
{
|
||||
ENetPacket *packet = enet_packet_create(NULL, MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
|
||||
ucharbuf p(packet->data, packet->dataLength);
|
||||
putint(p, SV_CALLVOTE);
|
||||
putint(p, SA_MAP);
|
||||
putint(p, SV_NEXTMAP);
|
||||
sendstring(name, p);
|
||||
putint(p, nextmode);
|
||||
enet_packet_resize(packet, p.length());
|
||||
|
||||
@@ -123,7 +123,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
|
||||
{
|
||||
string mode;
|
||||
itoa(mode, gamemode);
|
||||
callvote(SA_MAP, getclientmap(), mode); // FIXME
|
||||
changemap(getclientmap());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -195,8 +195,9 @@ void selectnextprimary(int num)
|
||||
case GUN_SUBGUN:
|
||||
case GUN_SNIPER:
|
||||
case GUN_ASSAULT:
|
||||
player1->nextprimary = num;
|
||||
addmsg(SV_PRIMARYWEAP, "ri", player1->nextprimary);
|
||||
//player1->nextprimary = num;
|
||||
player1->setnextprimary(num);
|
||||
addmsg(SV_PRIMARYWEAP, "ri", player1->nextprimweap->type);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
+2
-2
@@ -328,7 +328,7 @@ struct playerent : dynent, playerstate
|
||||
int lifesequence; // sequence id for each respawn, used in damage test
|
||||
int frags, flagscore;
|
||||
int deaths() { return lifesequence + (state==CS_DEAD ? 1 : 0); }
|
||||
int lastaction, lastmove, lastpain, lastteamkill;
|
||||
int lastaction, lastmove, lastpain;
|
||||
int clientrole;
|
||||
bool attacking;
|
||||
string name, team;
|
||||
@@ -346,7 +346,7 @@ struct playerent : dynent, playerstate
|
||||
|
||||
poshist history; // Previous stored locations of this player
|
||||
|
||||
playerent() : clientnum(-1), plag(0), ping(0), lifesequence(0), frags(0), flagscore(0), lastpain(0), lastteamkill(0), clientrole(CR_DEFAULT),
|
||||
playerent() : clientnum(-1), plag(0), ping(0), lifesequence(0), frags(0), flagscore(0), lastpain(0), clientrole(CR_DEFAULT),
|
||||
skin(0), nextskin(0), spectating(SM_NONE), followplayercn(0),
|
||||
weaponsel(NULL), nextweaponsel(NULL), primweap(NULL), nextprimweap(NULL), lastattackweapon(NULL), inhandnade(NULL)
|
||||
{
|
||||
|
||||
@@ -108,7 +108,7 @@ char msgsizesl[] = // size inclusive message token, 0 for variable
|
||||
SV_SHOOT, 0, SV_EXPLODE, 0, SV_SUICIDE, 1, SV_AKIMBO, 2, SV_RELOAD, 3,
|
||||
SV_GIBDIED, 4, SV_DIED, 4, SV_GIBDAMAGE, 6, SV_DAMAGE, 6, SV_HITPUSH, 6, SV_SHOTFX, 9, SV_THROWNADE, 8,
|
||||
SV_TRYSPAWN, 1, SV_SPAWNSTATE, 20, SV_SPAWN, 3, SV_FORCEDEATH, 2, SV_RESUME, 0,
|
||||
SV_TIMEUP, 2, SV_EDITENT, 10, SV_MAPRELOAD, 2, SV_ITEMACC, 2,
|
||||
SV_TIMEUP, 2, SV_EDITENT, 10, SV_MAPRELOAD, 2, SV_NEXTMAP, 0, SV_ITEMACC, 2,
|
||||
SV_MAPCHANGE, 0, SV_ITEMSPAWN, 2, SV_ITEMPICKUP, 2,
|
||||
SV_PING, 2, SV_PONG, 2, SV_CLIENTPING, 2, SV_GAMEMODE, 2,
|
||||
SV_EDITMODE, 2, SV_EDITH, 7, SV_EDITT, 7, SV_EDITS, 6, SV_EDITD, 6, SV_EDITE, 6,
|
||||
|
||||
@@ -15,7 +15,7 @@ enum
|
||||
SV_SHOOT, SV_EXPLODE, SV_SUICIDE, SV_AKIMBO, SV_RELOAD,
|
||||
SV_GIBDIED, SV_DIED, SV_GIBDAMAGE, SV_DAMAGE, SV_HITPUSH, SV_SHOTFX, SV_THROWNADE,
|
||||
SV_TRYSPAWN, SV_SPAWNSTATE, SV_SPAWN, SV_FORCEDEATH, SV_RESUME,
|
||||
SV_TIMEUP, SV_EDITENT, SV_MAPRELOAD, SV_ITEMACC,
|
||||
SV_TIMEUP, SV_EDITENT, SV_MAPRELOAD, SV_NEXTMAP, SV_ITEMACC,
|
||||
SV_MAPCHANGE, SV_ITEMSPAWN, SV_ITEMPICKUP,
|
||||
SV_PING, SV_PONG, SV_CLIENTPING, SV_GAMEMODE,
|
||||
SV_EDITMODE, SV_EDITH, SV_EDITT, SV_EDITS, SV_EDITD, SV_EDITE,
|
||||
|
||||
@@ -330,11 +330,10 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
playerent *targetplayer = playerincrosshair();
|
||||
bool didteamkill = player1->lastteamkill && player1->lastteamkill + 5000 > lastmillis;
|
||||
bool menu = menuvisible();
|
||||
bool command = getcurcommand() ? true : false;
|
||||
|
||||
if(player1->state==CS_ALIVE && !player1->weaponsel->reloading && !didteamkill && !menu)
|
||||
if(player1->state==CS_ALIVE && !player1->weaponsel->reloading && !menu)
|
||||
{
|
||||
bool drawteamwarning = targetplayer ? (isteam(targetplayer->team, player1->team) && targetplayer->state!=CS_DEAD) : false;
|
||||
if(player1->weaponsel->type==GUN_SNIPER && scoped) drawscope();
|
||||
@@ -368,6 +367,7 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
|
||||
draw_textf("wvt %d", left, top+240, curvert);
|
||||
draw_textf("evt %d", left, top+320, xtraverts);
|
||||
}
|
||||
|
||||
if(!hidevote)
|
||||
{
|
||||
extern votedisplayinfo *curvote;
|
||||
@@ -398,6 +398,22 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
|
||||
|
||||
hudmsgs.render();
|
||||
|
||||
if(player1->state==CS_DEAD && player1->spectating==SM_NONE)
|
||||
{
|
||||
glLoadIdentity();
|
||||
glOrtho(0, VIRTW*3/2, VIRTH*3/2, 0, -1, 1);
|
||||
const int left = (VIRTW*3/2)*6/8, top = (VIRTH*3/2)*3/4;
|
||||
draw_textf("jump or switch weapons", left, top);
|
||||
draw_textf("to enter spectator mode", left, top+80);
|
||||
}
|
||||
|
||||
if(player1->state==CS_SPECTATE || (player1->state==CS_DEAD && player1->spectating!=SM_NONE))
|
||||
{
|
||||
glLoadIdentity();
|
||||
glOrtho(0, VIRTW, VIRTH, 0, -1, 1);
|
||||
draw_text("SPECTATING", VIRTW/40, VIRTH/10*7);
|
||||
}
|
||||
|
||||
if(player1->state==CS_ALIVE)
|
||||
{
|
||||
glLoadIdentity();
|
||||
|
||||
@@ -1774,7 +1774,6 @@ void process(ENetPacket *packet, int sender, int chan) // sender may be -1
|
||||
{
|
||||
int nextprimary = getint(p);
|
||||
cl->state.nextprimary = nextprimary;
|
||||
QUEUE_MSG;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1904,6 +1903,15 @@ void process(ENetPacket *packet, int sender, int chan) // sender may be -1
|
||||
break;
|
||||
}
|
||||
|
||||
case SV_NEXTMAP:
|
||||
{
|
||||
getstring(text, p);
|
||||
filtertext(text, text);
|
||||
int mode = getint(p);
|
||||
if(mapreload || numclients() == 1) resetmap(text, mode);
|
||||
break;
|
||||
}
|
||||
|
||||
case SV_SENDMAP:
|
||||
{
|
||||
getstring(text, p);
|
||||
@@ -2073,12 +2081,9 @@ void checkintermission()
|
||||
if(!interm && minremain<=0) interm = gamemillis+10000;
|
||||
}
|
||||
|
||||
/*void startintermission() { minremain = 0; checkintermission(); }*/
|
||||
|
||||
void resetserverifempty()
|
||||
{
|
||||
loopv(clients) if(clients[i]->type!=ST_EMPTY) return;
|
||||
//clients.setsize(0);
|
||||
resetmap("", 0, 10, false);
|
||||
mastermode = MM_OPEN;
|
||||
autoteam = true;
|
||||
|
||||
@@ -328,8 +328,9 @@ void updatechanvol(int chan, int svol, soundloc *sl)
|
||||
}
|
||||
else
|
||||
{
|
||||
vol -= (int)(dist*3/4*soundvol/255); // simple mono distance attenuation
|
||||
vol -= (int)(dist*3*soundvol/255); // simple mono distance attenuation
|
||||
if(vol<0) vol = 0;
|
||||
conoutf("vol %d", vol);
|
||||
}
|
||||
if(sl->pse) // control looping physent sound volume
|
||||
{
|
||||
|
||||
+20
-5
@@ -37,7 +37,15 @@ void weaponswitch(weapon *w)
|
||||
}
|
||||
|
||||
void selectweapon(weapon *w) { if(w && w->selectable()) weaponswitch(w); }
|
||||
void selectweaponi(int w) { if(w >= 0 && w < NUMGUNS) selectweapon(player1->weapons[w]); }
|
||||
|
||||
void selectweaponi(int w)
|
||||
{
|
||||
if(player1->state == CS_ALIVE)
|
||||
{
|
||||
if(w >= 0 && w < NUMGUNS) selectweapon(player1->weapons[w]);
|
||||
}
|
||||
else toggledeathcam();
|
||||
}
|
||||
|
||||
void shiftweapon(int s)
|
||||
{
|
||||
@@ -718,9 +726,6 @@ struct grenades : weapon
|
||||
}
|
||||
}
|
||||
|
||||
void selecting() { throwmillis = 0; }
|
||||
void onammopicked() { throwmillis = 0; }
|
||||
|
||||
int modelanim()
|
||||
{
|
||||
if(throwing()) return ANIM_GUN_THROW;
|
||||
@@ -768,7 +773,7 @@ struct grenades : weapon
|
||||
else playsound(S_GRENADETHROW, owner);
|
||||
}
|
||||
|
||||
void drawstats()
|
||||
void renderstats()
|
||||
{
|
||||
char gunstats[64];
|
||||
sprintf(gunstats, "%i", mag);
|
||||
@@ -776,6 +781,15 @@ struct grenades : weapon
|
||||
}
|
||||
|
||||
bool selectable() { return weapon::selectable() && !inhand() && mag; }
|
||||
void reset() { throwmillis = 0; }
|
||||
|
||||
void onselecting() { reset(); }
|
||||
//void onammopicked() { reset(); }
|
||||
void onownerdies()
|
||||
{
|
||||
reset();
|
||||
if(owner==player1 && owner->inhandnade) ((grenadeent *)owner->inhandnade)->explode();
|
||||
}
|
||||
};
|
||||
|
||||
struct gun : weapon
|
||||
@@ -1003,6 +1017,7 @@ struct knife : weapon
|
||||
|
||||
void drawstats() {}
|
||||
void attackfx(vec &from, vec &to, int millis) { attacksound(); }
|
||||
void renderstats() { };
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ struct weapon
|
||||
virtual void onselecting();
|
||||
virtual void ondeselecting() {}
|
||||
virtual void onammopicked() {}
|
||||
virtual void onownerdies() {}
|
||||
|
||||
void sendshoot(vec &from, vec &to);
|
||||
bool modelattacking();
|
||||
|
||||
Reference in New Issue
Block a user