gamemodes 'hunt the flag' & 'keep the flag' added

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2485 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
ac_stef
2008-09-06 02:57:11 +00:00
parent 4e531f19f0
commit 4ee2dbaddf
37 changed files with 400 additions and 192 deletions
+18 -12
View File
@@ -268,7 +268,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
getstring(text, p);
filtertext(d->team, text, false, MAXTEAMLEN);
setskin(d, getint(p));
if(m_ctf) loopi(2)
if(m_flags) loopi(2)
{
flaginfo &f = flaginfos[i];
if(!f.actor) f.actor = getclient(f.actor_cn);
@@ -539,37 +539,43 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
flaginfo &f = flaginfos[flag];
f.state = getint(p);
int action = getint(p);
int actor = f.state==CTFF_STOLEN || action==SV_FLAGRETURN ? getint(p) : -1;
switch(f.state)
{
case CTFF_STOLEN:
{
flagstolen(flag, action, getint(p));
if(action==SV_FLAGSCORE) f.stolentime = getint(p);
flagstolen(flag, action, actor);
break;
}
case CTFF_DROPPED:
{
short x = (ushort) (getint(p)/DMF);
short y = (ushort) (getint(p)/DMF);
short z = ((ushort) (getint(p)/DMF))-((short)player1->eyeheight); // correct z offset, assumes all players do have the same eyeheight
flagdropped(flag, action, x, y, z);
if(action != SV_FLAGRETURN)
{
short x = (ushort) (getint(p)/DMF);
short y = (ushort) (getint(p)/DMF);
short z = ((ushort) (getint(p)/DMF))-((short)player1->eyeheight); // correct z offset, assumes all players do have the same eyeheight
flagdropped(flag, action, x, y, z);
}
break;
}
case CTFF_INBASE:
{
int actor = -1;
if(action == SV_FLAGRETURN) actor = getint(p);
flaginbase(flag, action, actor);
break;
}
case CTFF_IDLE:
f.flagent->spawned = false;
f.ack = true;
break;
}
break;
}
case SV_FLAGS:
{
if(!d) return;
d->flagscore = getint(p);
int fcn = getint(p), flags = getint(p);
playerent *p = (fcn == getclientnum() ? player1 : getclient(fcn));
if(p) p->flagscore = flags;
break;
}