no message
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@761 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -23,16 +23,15 @@ extern void spawnstate(playerent *d);
|
||||
|
||||
void CACBot::Spawn()
|
||||
{
|
||||
// Init all bot variabeles
|
||||
spawnplayer(m_pMyEnt);
|
||||
|
||||
// Init all bot variabeles
|
||||
m_pMyEnt->primary = m_pMyEnt->nextprimary = 2 + rnd(4);
|
||||
m_pMyEnt->targetyaw = m_pMyEnt->targetpitch = 0.0f;
|
||||
equip(this->m_pMyEnt);
|
||||
m_pMyEnt->armour = 0;
|
||||
m_pMyEnt->pBot = this;
|
||||
|
||||
|
||||
SelectGun(m_pMyEnt->primary);
|
||||
spawnplayer(m_pMyEnt);
|
||||
|
||||
m_eCurrentBotState = STATE_NORMAL;
|
||||
m_iShootDelay = m_iChangeWeaponDelay = 0;
|
||||
|
||||
@@ -56,7 +56,7 @@ void spawnstate(playerent *d) // reset player state not persistent
|
||||
setscope(false);
|
||||
};
|
||||
equip(d);
|
||||
if(m_osok) d->health = 1;
|
||||
if(m_osok) d->health = 1;
|
||||
dblend = 0;
|
||||
};
|
||||
|
||||
@@ -674,9 +674,14 @@ void setmaster(char *claim, char *password)
|
||||
|
||||
void mastercommand(int cmd, int a) // one of MCMD_*
|
||||
{
|
||||
addmsg(SV_MASTERCMD, "rii", cmd, a);
|
||||
if(player1->ismaster) addmsg(SV_MASTERCMD, "rii", cmd, a);
|
||||
else conoutf("\f3you have to be master to perform this action");
|
||||
};
|
||||
|
||||
void kick(int player) { mastercommand(MCMD_KICK, player); };
|
||||
void ban(int player) { mastercommand(MCMD_BAN, player); };
|
||||
void removebans() { mastercommand(MCMD_REMBANS, 0); };
|
||||
|
||||
struct mline { string cmd; };
|
||||
static vector<mline> mlines;
|
||||
|
||||
@@ -691,12 +696,14 @@ void showmastermenu(int m) // 0=kick, 1=ban
|
||||
loopv(players) if(players[i])
|
||||
{
|
||||
string &s = mlines.add().cmd;
|
||||
s_sprintf(s)("mastercommand %d %d", m, i);
|
||||
s_sprintf(s)("%s %d", m == MCMD_KICK ? "kick" : "ban", i);
|
||||
menumanual(menu, item++, players[i]->name, s);
|
||||
};
|
||||
menuset(menu);
|
||||
};
|
||||
|
||||
COMMAND(setmaster, ARG_2STR);
|
||||
COMMAND(mastercommand, ARG_2INT);
|
||||
COMMAND(kick, ARG_1INT);
|
||||
COMMAND(ban, ARG_1INT);
|
||||
COMMAND(removebans, ARG_NONE);
|
||||
COMMAND(showmastermenu, ARG_1INT);
|
||||
|
||||
@@ -427,6 +427,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
|
||||
f.flag->y = (ushort) (getint(p)/DMF);
|
||||
f.flag->z = (ushort) (getint(p)/DMF);
|
||||
f.flag->z -= 4;
|
||||
|
||||
float floor = (float)S(f.flag->x, f.flag->y)->floor;
|
||||
if(f.flag->z > hdr.waterlevel) // above water
|
||||
{
|
||||
@@ -505,3 +506,22 @@ void localservertoclient(int chan, uchar *buf, int len) // processes any updat
|
||||
};
|
||||
};
|
||||
|
||||
void test1(int x, int y)
|
||||
{
|
||||
conoutf("mipsize %i", mipsize);
|
||||
conoutf("world : %i %i %i", sizeof(world), sizeof(world[0]), sizeof(&world) / sizeof(world[0]));
|
||||
|
||||
sqr *q = S_SECURE(x, y);
|
||||
if(q)
|
||||
conoutf("%i\n", q->floor);
|
||||
else conoutf("invalid!");
|
||||
};
|
||||
|
||||
COMMAND(test1, ARG_2INT);
|
||||
|
||||
void test2()
|
||||
{
|
||||
conoutf("%f %f %f", player1->o.x, player1->o.y, (float) S((ushort)(player1->o.x), (ushort)(player1->o.y))->floor);
|
||||
};
|
||||
|
||||
COMMAND(test2, ARG_NONE);
|
||||
+15
-1
@@ -269,9 +269,23 @@ void equip(playerent *d)
|
||||
else if(m_lss) d->primary = GUN_KNIFE;
|
||||
else d->primary = d->nextprimary;
|
||||
|
||||
loopi(NUMGUNS) d->ammo[i] = d->mag[i] = 0;
|
||||
|
||||
d->mag[GUN_KNIFE] = d->ammo[GUN_KNIFE] = 1;
|
||||
d->mag[GUN_GRENADE] = d->ammo[GUN_GRENADE] = 0;
|
||||
|
||||
if(!m_nopistol)
|
||||
{
|
||||
d->ammo[GUN_PISTOL] = itemstats[GUN_PISTOL].max-magsize(GUN_PISTOL);
|
||||
d->mag[GUN_PISTOL] = magsize(GUN_PISTOL);
|
||||
}
|
||||
if(!m_noprimary)
|
||||
{
|
||||
d->ammo[d->primary] = itemstats[d->primary].start-magsize(d->primary);
|
||||
d->mag[d->primary] = magsize(d->primary);
|
||||
}
|
||||
|
||||
/*
|
||||
if(m_pistol) // pistol only mode
|
||||
{
|
||||
d->ammo[GUN_PISTOL] = itemstats[GUN_PISTOL].max-magsize(GUN_PISTOL);
|
||||
@@ -287,7 +301,7 @@ void equip(playerent *d)
|
||||
d->mag[GUN_PISTOL] = magsize(GUN_PISTOL);
|
||||
d->ammo[d->primary] = itemstats[d->primary].start-magsize(d->primary);
|
||||
d->mag[d->primary] = magsize(d->primary);
|
||||
};
|
||||
};*/
|
||||
|
||||
if (d->hasarmour)
|
||||
{
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ struct playerent : dynent
|
||||
};
|
||||
};
|
||||
|
||||
struct CBot;
|
||||
class CBot;
|
||||
|
||||
struct botent : playerent
|
||||
{
|
||||
|
||||
@@ -215,9 +215,12 @@ bool menukey(int code, bool isdown)
|
||||
int n = curmenu->items.length();
|
||||
if(menusel<0) menusel = n>0 ? n-1 : 0;
|
||||
else if(menusel>=n) menusel = 0;
|
||||
curmenu->menusel = menusel;
|
||||
char *haction = curmenu->items[menusel].hoveraction;
|
||||
if(menusel != oldmenusel && haction) execute(haction);
|
||||
if(curmenu->items.inrange(menusel))
|
||||
{
|
||||
curmenu->menusel = menusel;
|
||||
char *haction = curmenu->items[menusel].hoveraction;
|
||||
if(menusel != oldmenusel && haction) execute(haction);
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -376,14 +376,14 @@ void readscfg(char *cfg)
|
||||
|
||||
l = buf;
|
||||
bool lastline = false;
|
||||
while((p = strstr(l, "\n")) != NULL || (l && (lastline=true))) // remove empty/invalid lines
|
||||
while((p = strstr(l, "\n")) != NULL || (l[0] && (lastline=true))) // remove empty/invalid lines
|
||||
{
|
||||
size_t len = lastline ? strlen(l) : p-l;
|
||||
string line;
|
||||
s_strncpy(line, l, len+1);
|
||||
char *d = line;
|
||||
int n = 0;
|
||||
while((p = strstr(d, ":")) != NULL && (d = p+1)) n++;
|
||||
while((p = strstr(d, ":")) != NULL) { d = p+1; n++; };
|
||||
if(n!=3) memset(l, ' ', len+1);
|
||||
if(lastline) { l[len+1] = 0; break; };
|
||||
l += len+1;
|
||||
|
||||
@@ -49,6 +49,7 @@ struct header // map file format header
|
||||
#define SWS(w,x,y,s) (&(w)[(y)*(s)+(x)])
|
||||
#define SW(w,x,y) SWS(w,x,y,ssize)
|
||||
#define S(x,y) SW(world,x,y) // convenient lookup of a lowest mip cube
|
||||
#define S_SECURE(x, y) ((y)*ssize+(x) < sizeof(world) / sizeof(world[0]) ? S(x,y) : NULL) // same as above, but validates coords
|
||||
#define SMALLEST_FACTOR 6 // determines number of mips there can be
|
||||
#define DEFAULT_FACTOR 8
|
||||
#define LARGEST_FACTOR 11 // 10 is already insane
|
||||
|
||||
Reference in New Issue
Block a user