rewritten flag modes, added non-team ktf mode

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2521 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
ac_stef
2008-09-11 16:28:56 +00:00
parent 9e9712a7e2
commit 675e248a05
10 changed files with 308 additions and 225 deletions
+29 -29
View File
@@ -538,43 +538,43 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
if(flag<0 || flag>1) return;
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:
{
if(action==SV_FLAGSCORE) f.stolentime = getint(p);
flagstolen(flag, action, actor);
break;
}
case CTFF_DROPPED:
{
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;
}
switch(f.state)
{
case CTFF_STOLEN:
flagstolen(flag, getint(p));
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, x, y, z);
break;
}
case CTFF_INBASE:
flaginbase(flag, action, actor);
flaginbase(flag);
break;
case CTFF_IDLE:
flaginbase(flag, action, actor);
f.flagent->spawned = false;
f.ack = true;
flagidle(flag);
break;
}
}
break;
}
case SV_FLAGS:
case SV_FLAGMSG:
{
int fcn = getint(p), flags = getint(p);
int flag = getint(p);
int message = getint(p);
int actor = getint(p);
int flagtime = message == FM_KTFSCORE ? getint(p) : -1;
flagmsg(flag, message, actor, flagtime);
break;
}
case SV_FLAGCNT:
{
int fcn = getint(p);
int flags = getint(p);
playerent *p = (fcn == getclientnum() ? player1 : getclient(fcn));
if(p) p->flagscore = flags;
break;