no message

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@789 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2007-01-08 22:12:31 +00:00
parent 222db40606
commit cf533fc234
9 changed files with 50 additions and 49 deletions
+2 -3
View File
@@ -24,13 +24,12 @@ extern void spawnstate(playerent *d);
void CACBot::Spawn()
{
// Init all bot variabeles
m_pMyEnt->primary = m_pMyEnt->nextprimary = 2 + rnd(4);
m_pMyEnt->nextprimary = GUN_SUBGUN;//m_pMyEnt->nextprimary = 2 + rnd(4);
m_pMyEnt->targetyaw = m_pMyEnt->targetpitch = 0.0f;
equip(this->m_pMyEnt);
equip(m_pMyEnt);
m_pMyEnt->armour = 0;
m_pMyEnt->pBot = this;
SelectGun(m_pMyEnt->primary);
spawnplayer(m_pMyEnt);
m_eCurrentBotState = STATE_NORMAL;
+1 -1
View File
@@ -71,7 +71,7 @@ void changeteam(int team) // force team and respawn
c2sinit = false;
if(m_ctf) tryflagdrop();
s_strncpy(player1->team, team_string(team), MAXTEAMLEN+1);
playerdeath(player1);
deathstate(player1);
};
void newteam(char *name)
+9 -5
View File
@@ -35,7 +35,7 @@ char *getclientmap() { return clientmap; };
extern bool c2sinit;
extern int dblend;
void setskin(playerent *pl, uint skin)
void setskin(playerent *pl, uint skin)
{
if(!pl) return;
if(pl == player1) c2sinit=false;
@@ -43,7 +43,9 @@ void setskin(playerent *pl, uint skin)
pl->skin = skin % (maxskin[team_int(pl->team)]+1);
};
void playerdeath(playerent *pl)
extern void throw_nade(playerent *d, vec &vel, bounceent *p);
void deathstate(playerent *pl)
{
pl->lastaction = lastmillis;
pl->lifesequence++;
@@ -52,6 +54,9 @@ void playerdeath(playerent *pl)
pl->oldpitch = pl->pitch;
pl->pitch = 0;
pl->roll = 60;
pl->strafe = 0;
dblend = 0;
if(pl == player1 && pl->inhandnade) throw_nade(pl, vec(0,0,0), pl->inhandnade);
};
void spawnstate(playerent *d) // reset player state not persistent accross spawns
@@ -66,7 +71,6 @@ void spawnstate(playerent *d) // reset player state not persistent
};
equip(d);
if(m_osok) d->health = 1;
dblend = 0;
};
playerent *newplayerent() // create a new blank player
@@ -485,8 +489,8 @@ void selfdamage(int damage, int actor, playerent *act, bool gib, playerent *pl)
setscope(false);
addmsg(gib ? SV_GIBDIED : SV_DIED, "ri", actor);
};
playerdeath(pl);
spawnstate(pl);
deathstate(pl);
//spawnstate(pl); TESTME
playsound(S_DIE1+rnd(2), pl!=player1 ? &pl->o : NULL);
if(gib) addgib(pl);
if(pl!=player1 || act->type==ENT_BOT) act->frags++;
+2 -8
View File
@@ -144,13 +144,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
case SV_MAPCHANGE:
getstring(text, p);
changemapserv(text, getint(p));
if(joining && m_arena)
{
/* TESTME
player1->state = CS_DEAD;
showscores(true);*/
playerdeath(player1);
};
if(joining && m_arena) deathstate(player1);
mapchanged = true;
break;
@@ -266,7 +260,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
if(m_ctf)
{
flaginfo &flag = flaginfos[team_opposite(team_int(d->team))];
if(flag.state == CTFF_STOLEN && flag.actor == d) playerdeath(player1); // punish for ctf TK
if(flag.state == CTFF_STOLEN && flag.actor == d) deathstate(player1); // punish for ctf TK
};
}
else
+3
View File
@@ -165,6 +165,9 @@ VARP(maxroll, 0, 0, 20);
// moveres indicated the physics precision (which is lower for monsters and multiplayer prediction)
// local is false for multiplayer prediction
//TESTME
VAR(test12, 0, 0, 1);
void moveplayer(physent *pl, int moveres, bool local, int curtime)
{
const bool water = hdr.waterlevel>pl->o.z-0.5f;
+1 -1
View File
@@ -98,7 +98,7 @@ extern void updateworld(int curtime, int lastmillis);
extern void startmap(char *name);
extern void changemap(char *name);
extern void initclient();
extern void playerdeath(playerent *pl);
extern void deathstate(playerent *pl);
extern void spawnplayer(playerent *d);
extern void selfdamage(int damage, int actor, playerent *act, bool gib = false, playerent *pl = player1);
extern playerent *newplayerent();
+2 -3
View File
@@ -375,9 +375,8 @@ char *disc_reasons[] = { "normal", "end of packet", "client num", "kicked by mas
void disconnect_client(int n, int reason = -1)
{
if(!clients.inrange(n) || clients[n]->type!=ST_TCPIP) return;
if(m_ctf)
loopi(2) if(ctfflags[i].state==CTFF_STOLEN && ctfflags[i].actor_cn==n)
flagaction(i, SV_FLAGDROP, -1); // TESTME
if(m_ctf) loopi(2) if(ctfflags[i].state==CTFF_STOLEN && ctfflags[i].actor_cn==n)
flagaction(i, SV_FLAGDROP, -1);
client &c = *clients[n];
clientscore *sc = findscore(c, true);
if(sc) *sc = c.score;
+30 -28
View File
@@ -346,36 +346,41 @@ void moveprojectiles(float time)
};
};
void throw_nade(playerent *d, vec &to, bounceent *p)
void throw_nade(playerent *d, vec &vel, bounceent *p)
{
if(!p || !d) return;
playsound(S_GRENADETHROW);
p->bouncestate = NADE_THROWED;
p->o = d->o;
p->vel.z = sinf(RAD*d->pitch);
float speed = cosf(RAD*d->pitch);
p->vel.x = sinf(RAD*d->yaw)*speed;
p->vel.y = -cosf(RAD*d->yaw)*speed;
p->vel.mul(1.7f);
vec throwdir = p->vel;
vec throwdir(p->vel = vel);
throwdir.mul(2*d->radius);
p->o = d->o;
p->o.add(throwdir);
p->bouncestate = NADE_THROWED;
d->thrownademillis = lastmillis;
d->inhandnade = NULL;
if(d==player1)
{
vec &from = d->o;
player1->lastaction = lastmillis;
addmsg(SV_SHOT, "ri8", d->gunselect, (int)(from.x*DMF), (int)(from.y*DMF), (int)(from.z*DMF), (int)(to.x*DMF), (int)(to.y*DMF), (int)(to.z*DMF), lastmillis-p->millis);
addmsg(SV_SHOT, "ri8", d->gunselect, (int)(d->o.x*DMF), (int)(d->o.y*DMF), (int)(d->o.z*DMF), (int)(vel.x*DMF), (int)(vel.y*DMF), (int)(vel.z*DMF), lastmillis-p->millis);
};
};
void throw_nade(playerent *d, bounceent *p)
{
if(!d || !p) return;
float speed = cosf(RAD*d->pitch);
vec vel;
vel.z = sinf(RAD*d->pitch);
vel.x = sinf(RAD*d->yaw)*speed;
vel.y = -cosf(RAD*d->yaw)*speed;
vel.mul(1.7f);
throw_nade(d, vel, p);
};
bounceent *new_nade(playerent *d, int millis = 0)
{
bounceent *p = newbounceent();
@@ -393,13 +398,7 @@ bounceent *new_nade(playerent *d, int millis = 0)
void explode_nade(bounceent *i)
{
if(!i) return;
if(i->bouncestate != NADE_THROWED)
{
vec o = i->owner->o;
o.add(0.1f);
throw_nade(i->owner, o, i);
};
if(i->bouncestate != NADE_THROWED) throw_nade(i->owner, vec(0,0,0), i);
playsound(S_FEXPLODE, &i->o);
newprojectile(i->o, i->o, 1, i->owner==player1, i->owner, GUN_GRENADE);
};
@@ -421,9 +420,11 @@ void shootv(int gun, vec &from, vec &to, playerent *d, bool local, int nademilli
case GUN_PISTOL:
case GUN_SUBGUN:
case GUN_ASSAULT:
{
addshotline(d, from, to);
particle_splash(0, 5, 250, to);
break;
};
case GUN_GRENADE:
{
@@ -431,15 +432,17 @@ void shootv(int gun, vec &from, vec &to, playerent *d, bool local, int nademilli
{
bounceent *p = new_nade(d, nademillis);
throw_nade(d, to, p);
}
};
break;
};
break;
case GUN_SNIPER:
{
addshotline(d, from, to);
particle_splash(0, 50, 200, to);
particle_trail(1, 500, from, to);
break;
};
};
};
@@ -542,6 +545,7 @@ bool hasammo(playerent *d) // bot mod
if (d->type==ENT_BOT) playsound(S_NOAMMO, &d->o);
else playsoundc(S_NOAMMO);
d->gunwait = 250;
d->lastaction = lastmillis;
d->lastattackgun = -1;
return false;
} else return true;
@@ -584,10 +588,8 @@ void shoot(playerent *d, vec &targ)
d->lastaction = lastmillis;
d->lastattackgun = d->gunselect;
}
else if(!d->attacking && d->inhandnade && attacktime>grenadepulltime) // throw
{
throw_nade(d, targ, d->inhandnade);
}
else if(!d->attacking && d->inhandnade && attacktime>grenadepulltime) throw_nade(d, d->inhandnade);
return;
}
else
Binary file not shown.