diff --git a/bot/bot_teams.txt b/bot/bot_teams.txt new file mode 100644 index 00000000..16cf73a5 --- /dev/null +++ b/bot/bot_teams.txt @@ -0,0 +1,2 @@ +RVSF +CLA \ No newline at end of file diff --git a/source/src/bot/ac_bot.cpp b/source/src/bot/ac_bot.cpp index 6922fc6f..e2bb4901 100644 --- a/source/src/bot/ac_bot.cpp +++ b/source/src/bot/ac_bot.cpp @@ -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) diff --git a/source/src/bot/bot.cpp b/source/src/bot/bot.cpp index 7b17ad06..c218317f 100644 --- a/source/src/bot/bot.cpp +++ b/source/src/bot/bot.cpp @@ -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; diff --git a/source/src/clientextras.cpp b/source/src/clientextras.cpp index db7872a5..3649401d 100644 --- a/source/src/clientextras.cpp +++ b/source/src/clientextras.cpp @@ -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; diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 9b3c8455..4f38c990 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -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) { diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 09f4eee2..315b8802 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -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; }; diff --git a/source/src/cube.h b/source/src/cube.h index d8f0f6b2..95f292e5 100644 --- a/source/src/cube.h +++ b/source/src/cube.h @@ -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) diff --git a/source/src/entities.cpp b/source/src/entities.cpp index 90eb330c..d980f701 100644 --- a/source/src/entities.cpp +++ b/source/src/entities.cpp @@ -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=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); diff --git a/source/src/main.cpp b/source/src/main.cpp index 0e278d67..bcc7a9bb 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -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) diff --git a/source/src/menus.cpp b/source/src/menus.cpp index 9219f9fd..d6110875 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -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 { diff --git a/source/src/renderextras.cpp b/source/src/renderextras.cpp index 8e585a47..b1e44ba6 100644 --- a/source/src/renderextras.cpp +++ b/source/src/renderextras.cpp @@ -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; diff --git a/source/src/rendermd3.cpp b/source/src/rendermd3.cpp index 2a37efda..b8f308d4 100644 --- a/source/src/rendermd3.cpp +++ b/source/src/rendermd3.cpp @@ -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); }; diff --git a/source/src/server.cpp b/source/src/server.cpp index 3d4f8789..ae0d7de3 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -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(); diff --git a/source/src/serverutil.cpp b/source/src/serverutil.cpp index fbbc04e7..d77a10f4 100644 --- a/source/src/serverutil.cpp +++ b/source/src/serverutil.cpp @@ -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"; }; diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 704d7eed..93d95083 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -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;