bot menu fixed
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@405 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -139,7 +139,7 @@ void CACBot::BotPain(int damage, dynent *d, bool gib)
|
||||
{
|
||||
if(m_pMyEnt->state!=CS_ALIVE || editmode || intermission) return;
|
||||
//fixmebot
|
||||
int ad = damage/**(m_pMyEnt->armourtype+1)*20/100*/; // let armour absorb when possible
|
||||
int ad = damage*30/100;
|
||||
if(ad>m_pMyEnt->armour) ad = m_pMyEnt->armour;
|
||||
m_pMyEnt->armour -= ad;
|
||||
damage -= ad;
|
||||
@@ -167,7 +167,7 @@ void CACBot::BotPain(int damage, dynent *d, bool gib)
|
||||
else if (d->monsterstate)
|
||||
conoutf("%s got killed by %s", m_pMyEnt->name, d->name);
|
||||
else
|
||||
{
|
||||
{
|
||||
int KillerIndex = -1;
|
||||
|
||||
if (d == m_pMyEnt)
|
||||
|
||||
@@ -50,7 +50,7 @@ void CBot::Spawn()
|
||||
m_pMyEnt->enemy = NULL;
|
||||
m_pMyEnt->maxspeed = 22.0f;
|
||||
m_pMyEnt->health = 100;
|
||||
m_pMyEnt->armour = 50;
|
||||
m_pMyEnt->armour = 0;
|
||||
m_pMyEnt->pitch = 0;
|
||||
m_pMyEnt->roll = 0;
|
||||
m_pMyEnt->state = CS_ALIVE;
|
||||
|
||||
@@ -89,18 +89,6 @@ void renderclients()
|
||||
if(player1->state==CS_DEAD) renderplayer(player1);
|
||||
};
|
||||
|
||||
void spawn_dummy()
|
||||
{
|
||||
dynent *d = newdynent();
|
||||
players.add(d);
|
||||
d->o = player1->o;
|
||||
strcpy(d->team, player1->team);
|
||||
d->gunselect = player1->gunselect;
|
||||
d->monsterstate = M_NONE;
|
||||
d->state = CS_ALIVE;
|
||||
strcpy(d->name, "dummy");
|
||||
}; COMMAND(spawn_dummy, ARG_NONE);
|
||||
|
||||
// creation of scoreboard pseudo-menu
|
||||
|
||||
bool scoreson = false;
|
||||
|
||||
@@ -143,7 +143,7 @@ void respawnself()
|
||||
|
||||
void respawn()
|
||||
{
|
||||
if(player1->state==CS_DEAD && lastmillis>player1->lastaction+(m_teammode ? 5000 : 2000))
|
||||
if(player1->state==CS_DEAD && lastmillis>player1->lastaction+(m_ctf ? 5000 : 2000))
|
||||
{
|
||||
player1->attacking = false;
|
||||
if(m_arena) { conoutf("waiting for new round to start..."); return; };
|
||||
@@ -448,7 +448,7 @@ void selfdamage(int damage, int actor, dynent *act, bool gib)
|
||||
if(player1->state!=CS_ALIVE || editmode || intermission) return;
|
||||
damageblend(damage);
|
||||
demoblend(damage);
|
||||
int ad = damage*30/100;//int ad = damage*(player1->armourtype+1)*20/100; // let armour absorb when possible
|
||||
int ad = damage*30/100; // let armour absorb when possible
|
||||
if(ad>player1->armour) ad = player1->armour;
|
||||
player1->armour -= ad;
|
||||
damage -= ad;
|
||||
@@ -604,7 +604,8 @@ void startmap(char *name) // called just after a map load
|
||||
netmapstart(); //should work
|
||||
//monsterclear();
|
||||
// Added by Rick
|
||||
if(m_botmode) { kickallbots(); BotManager.BeginMap(name); };
|
||||
kickallbots();
|
||||
if(m_botmode) BotManager.BeginMap(name);
|
||||
// else sleepwait = 0;
|
||||
// End add by Rick
|
||||
projreset();
|
||||
@@ -638,11 +639,6 @@ void suicide()
|
||||
|
||||
COMMAND(suicide, ARG_NONE);
|
||||
|
||||
void killdummies()
|
||||
{
|
||||
loopv(players) if(strcmp(players[i]->name, "dummy") == 0) { players[i]->lastaction = lastmillis; players[i]->health=1; };
|
||||
}; COMMAND(killdummies, ARG_NONE);
|
||||
|
||||
// EDIT: AH
|
||||
void flagaction(int flag, int action)
|
||||
{
|
||||
|
||||
@@ -321,7 +321,7 @@ void localservertoclient(uchar *buf, int len) // processes any updates from th
|
||||
{
|
||||
uint i = getint(p);
|
||||
setspawn(i, true);
|
||||
if(i>=ents.length()) break;
|
||||
if(i>=ents.length() || i<0) break;
|
||||
vec v = { ents[i].x, ents[i].y, ents[i].z };
|
||||
break;
|
||||
};
|
||||
|
||||
+3
-1
@@ -409,7 +409,9 @@ extern bool demoplayback;
|
||||
9 - last swiss standing
|
||||
*/
|
||||
|
||||
#define m_noitems (m_arena)
|
||||
#define m_noitems (gamemode==3 || gamemode==4)
|
||||
#define m_noitemsnade (gamemode==9)
|
||||
#define m_nogun (gamemode==9)
|
||||
#define m_noitemsrail (false)
|
||||
#define m_arena (gamemode==3 || gamemode==4 || gamemode==9)
|
||||
#define m_tarena (gamemode==4)
|
||||
|
||||
+15
-4
@@ -245,13 +245,24 @@ void putitems(uchar *&p) // puts items in network stream and also spa
|
||||
{
|
||||
loopv(ents) if((ents[i].type>=I_CLIPS && ents[i].type<=I_AKIMBO) || ents[i].type==CARROT)
|
||||
{
|
||||
if(m_noitemsnade && ents[i].type!=I_GRENADE) continue;
|
||||
else if(m_pistol && ents[i].type==I_AMMO) continue;
|
||||
putint(p, i);
|
||||
ents[i].spawned = true;
|
||||
};
|
||||
};
|
||||
|
||||
void resetspawns() { loopv(ents) ents[i].spawned = false; };
|
||||
void setspawn(int i, bool on) { if(i<ents.length()) ents[i].spawned = on; };
|
||||
void resetspawns()
|
||||
{
|
||||
loopv(ents) ents[i].spawned = false;
|
||||
if(m_noitemsnade)
|
||||
loopv(ents)
|
||||
{
|
||||
entity &e = ents[i];
|
||||
if(e.type == I_CLIPS || e.type == I_AMMO) e.type = I_GRENADE;
|
||||
}
|
||||
};
|
||||
void setspawn(int i, bool on) { if(i<ents.length() && i>=0) ents[i].spawned = on; };
|
||||
|
||||
void radd(dynent *d)
|
||||
{
|
||||
@@ -260,7 +271,7 @@ void radd(dynent *d)
|
||||
d->mag[GUN_KNIFE] = d->ammo[GUN_KNIFE] = 1;
|
||||
d->mag[GUN_GRENADE] = d->ammo[GUN_GRENADE] = 0;
|
||||
|
||||
if (m_pistol || d->primary==GUN_PISTOL) // pistol only mode
|
||||
if(m_pistol || d->primary==GUN_PISTOL) // pistol only mode
|
||||
{
|
||||
d->primary = GUN_PISTOL;
|
||||
d->ammo[GUN_PISTOL] = itemstats[GUN_PISTOL].max;
|
||||
@@ -270,7 +281,7 @@ void radd(dynent *d)
|
||||
d->mag[d->primary] = d->mag[GUN_PISTOL] = 0;
|
||||
d->primary = GUN_KNIFE;
|
||||
}
|
||||
else
|
||||
else if(!m_nogun)
|
||||
{
|
||||
d->ammo[GUN_PISTOL] = itemstats[GUN_PISTOL].start-magsize(GUN_PISTOL);
|
||||
d->mag[GUN_PISTOL] = magsize(GUN_PISTOL);
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
bool dedicated = false;
|
||||
int fs = SDL_FULLSCREEN, par = 0, uprate = 0, maxcl = 4;
|
||||
char *sdesc = "", *ip = "", *master = NULL, *passwd = "", *maprot = "";
|
||||
char *sdesc = "", *ip = "", *master = NULL, *passwd = "", *maprot = NULL;
|
||||
islittleendian = *((char *)&islittleendian);
|
||||
|
||||
#define log(s) puts("init: " s)
|
||||
|
||||
@@ -156,6 +156,7 @@ void menumanual(int m, int n, char *text)
|
||||
mitem &mitem = menus[m].items.add();
|
||||
mitem.text = text;
|
||||
mitem.action = "";
|
||||
mitem.hoveraction = NULL;
|
||||
}
|
||||
|
||||
void menuitem(char *text, char *action, char *hoveraction)
|
||||
@@ -164,8 +165,7 @@ void menuitem(char *text, char *action, char *hoveraction)
|
||||
mitem &mi = menu.items.add();
|
||||
mi.text = newstring(text);
|
||||
mi.action = action[0] ? newstring(action) : mi.text;
|
||||
if(hoveraction) mi.hoveraction = newstring(hoveraction);
|
||||
else mi.hoveraction = NULL;
|
||||
mi.hoveraction = hoveraction[0] ? newstring(hoveraction) : NULL;
|
||||
};
|
||||
|
||||
void menumdl(char *mdl, char *frame, char *range, char *rotspeed, char *scale)
|
||||
@@ -226,7 +226,8 @@ bool menukey(int code, bool isdown)
|
||||
if(menusel<0) menusel = n>0 ? n-1 : 0;
|
||||
else if(menusel>=n) menusel = 0;
|
||||
menus[vmenu].menusel = menusel;
|
||||
if(menusel != oldmenusel)execute(menus[vmenu].items[menusel].hoveraction, true);
|
||||
char *haction = menus[vmenu].items[menusel].hoveraction;
|
||||
if(menusel != oldmenusel && haction) execute(haction, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -622,29 +622,17 @@ VAR(gibnum, 0, 6, 1000);
|
||||
VAR(gibttl, 0, 0, 15000);
|
||||
VAR(gibspeed, 1, 7, 20);
|
||||
|
||||
int numlivingenemies()
|
||||
{
|
||||
int num = 0;
|
||||
loopv(players) if(!isteam(players[i]->team, player1->team)) num++;
|
||||
loopv(bots) if(!isteam(bots[i]->team, player1->team)) num++;
|
||||
return num;
|
||||
}
|
||||
|
||||
void addgib(dynent *d)
|
||||
{
|
||||
if(!d) return;
|
||||
playsound(S_GIB, &d->o);
|
||||
|
||||
bool massivegib = gamemode == 9 && numlivingenemies() == 1;
|
||||
|
||||
loopi((massivegib ? 1000 : gibnum))
|
||||
loopi(gibnum)
|
||||
{
|
||||
physent *p = new_physent();
|
||||
p->owner = d;
|
||||
p->millis = lastmillis;
|
||||
if(massivegib) p->timetolife = 15000;
|
||||
else if(gibttl>0) p->timetolife = gibttl;
|
||||
else p->timetolife = 5000+rnd(10)*100;
|
||||
p->timetolife = gibttl ? gibttl : 5000+rnd(10)*100;
|
||||
|
||||
p->state = GIB;
|
||||
|
||||
@@ -657,7 +645,7 @@ void addgib(dynent *d)
|
||||
p->o.z -= d->aboveeye;
|
||||
|
||||
float gibvelangle = rnd(360);
|
||||
float speed = massivegib ? 20 : gibspeed;
|
||||
float speed = gibspeed;
|
||||
p->vel.x = sin(gibvelangle)*speed*rnd(1000)/1000.0f;
|
||||
p->vel.y = cos(gibvelangle)*speed*rnd(1000)/1000.0f;
|
||||
p->vel.z = speed*rnd(1000)/1000.0f;
|
||||
|
||||
@@ -398,6 +398,8 @@ struct weaponmove
|
||||
vec pos;
|
||||
int anim;
|
||||
|
||||
weaponmove() : k_rot(0), kick(0), anim(0) { pos.x = pos.y = pos.z = 0.0f; };
|
||||
|
||||
calcmove(vec base, int basetime)
|
||||
{
|
||||
bool akimbo = player1->akimbo && player1->gunselect==GUN_PISTOL;
|
||||
@@ -498,8 +500,8 @@ void rendergun(md3model *weapon, int lastaction)
|
||||
vdist(dist, unitv, player1->o, worldpos);
|
||||
vdiv(unitv, dist);
|
||||
|
||||
weaponmove wm;
|
||||
wm.calcmove(unitv, lastaction);
|
||||
weaponmove wm;
|
||||
if(!intermission) wm.calcmove(unitv, lastaction);
|
||||
weapon->setanim(wm.anim);
|
||||
weapon->draw(wm.pos.x, wm.pos.z, wm.pos.y, player1->yaw + 90, player1->pitch+wm.k_rot, 1.0f, light);
|
||||
};
|
||||
|
||||
@@ -946,7 +946,7 @@ void initserver(bool dedicated, int uprate, char *sdesc, char *ip, char *master,
|
||||
if(!serverhost) fatal("could not create server host\n");
|
||||
loopi(MAXCLIENTS) serverhost->peers[i].data = (void *)-1;
|
||||
if(!maprot) maprot = newstring("config/maprot.cfg");
|
||||
readscfg(maprot); // EDIT: AH
|
||||
readscfg(path(maprot)); // EDIT: AH
|
||||
};
|
||||
|
||||
resetserverifempty();
|
||||
|
||||
@@ -29,7 +29,7 @@ void sendstring(char *t, uchar *&p)
|
||||
const char *modenames[] =
|
||||
{
|
||||
"team deathmatch", "coopedit", "deathmatch", "survior",
|
||||
"team survior", "ctf", "pistols only!", "bot team deathmatch", "bot deathmatch", "last swiss standing",
|
||||
"team survior", "ctf", "pistols only", "bot team deathmatch", "bot deathmatch", "last swiss standing",
|
||||
};
|
||||
|
||||
//const char *modestr(int n) { return (n>=-2 && n<12) ? modenames[n+2] : "unknown"; };
|
||||
|
||||
@@ -48,6 +48,7 @@ void weaponswitch(int gun)
|
||||
|
||||
void weapon(int gun)
|
||||
{
|
||||
if(m_nogun && gun!=G_MELEE && gun!=G_GRENADE) return;
|
||||
if(scoped) togglescope();
|
||||
if(NADE_IN_HAND || player1->reloading) return;
|
||||
|
||||
@@ -91,7 +92,7 @@ COMMAND(altattack, ARG_NONE);
|
||||
void reload(dynent *d)
|
||||
{
|
||||
if(!d || d->reloading) return;
|
||||
if(d == player1 && scoped) togglescope();
|
||||
if(d == player1 && scoped) { togglescope(); };
|
||||
bool akimbo = d->gunselect==GUN_PISTOL && d->akimbo!=0;
|
||||
|
||||
if(d->gunselect==GUN_KNIFE || d->gunselect==GUN_GRENADE) return;
|
||||
@@ -679,7 +680,6 @@ void shoot(dynent *d, vec &targ)
|
||||
if(has_akimbo(d)) d->gunwait = guns[d->gunselect].attackdelay / 2; //make akimbo pistols shoot twice as fast as normal pistol
|
||||
else d->gunwait = guns[d->gunselect].attackdelay;
|
||||
|
||||
//fixmebot
|
||||
shootv(d->gunselect, from, to, d, 0);
|
||||
addmsg(1, 9, SV_SHOT, 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), 0 );
|
||||
if(guns[d->gunselect].projspeed || d->gunselect==GUN_GRENADE) return;
|
||||
|
||||
Reference in New Issue
Block a user