no message

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@603 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2006-11-12 13:46:44 +00:00
parent 1dd14c43ba
commit 6340e0ebc4
4 changed files with 48 additions and 42 deletions
+16 -13
View File
@@ -180,7 +180,8 @@ struct vec
struct block { int x, y, xs, ys; };
enum { GUN_KNIFE = 0, GUN_PISTOL, GUN_SHOTGUN, GUN_SUBGUN, GUN_SNIPER, GUN_ASSAULT, GUN_GRENADE, NUMGUNS };
enum { G_PRIMARY=0, G_SECONDARY, G_MELEE, G_GRENADE, G_NUM };
enum { G_PRIMARY = 0, G_SECONDARY, G_MELEE, G_GRENADE, G_NUM };
#define reloadable_gun(g) (g!=GUN_KNIFE || g!=GUN_GRENADE)
enum { MCMD_KICK = 0, MCMD_BAN, MCMD_REMBANS };
@@ -524,29 +525,31 @@ extern bool demoplayback;
#define PIXELTAB (VIRTW/12)
/* Gamemodes
0 - tdm
1 - coop edit
2 - dm
3 - survivor
4 - team survior
5 - ctf
6 - pistols
7 - bot tdm
8 - bot dm
9 - last swiss standing
0 tdm
1 coop edit
2 dm
3 survivor
4 team survior
5 ctf
6 pistols
7 bot tdm
8 bot dm
9 last swiss standing
10 last sniper standing
*/
#define m_noitems (gamemode==3 || gamemode==4)
#define m_noitems (gamemode==3 || gamemode==4 || gamemode==10)
#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_arena (gamemode==3 || gamemode==4 || gamemode==9 || gamemode==10)
#define m_tarena (gamemode==4)
#define m_teammode (gamemode==0 || gamemode==4 || gamemode==5 || gamemode==7)
#define m_botmode (gamemode==7 || gamemode == 8)
#define m_ctf (gamemode==5)
#define m_pistol (gamemode==6)
#define m_lss (gamemode==9)
//#define m_sp (gamemode<0)
//#define m_dmsp (gamemode==-1)
//#define m_classicsp (gamemode==-2)
+1
View File
@@ -3,6 +3,7 @@
#include "cube.h"
// fixme: share with clientside gamemode
#define m_ctf_s (mode==5)
#define m_teammode_s (mode==0 || mode==4 || mode==5)
+3 -4
View File
@@ -77,11 +77,10 @@ void getstring(char *text, ucharbuf &p, int len)
const char *modenames[] =
{
"team deathmatch", "coopedit", "deathmatch", "survior",
"team survior", "ctf", "pistols frenzy", "bot team deathmatch", "bot deathmatch", "last swiss standing",
"team survior", "ctf", "pistols frenzy", "bot team deathmatch", "bot deathmatch", "last swiss standing", "last sniper standing"
};
//const char *modestr(int n) { return (n>=-2 && n<12) ? modenames[n+2] : "unknown"; };
const char *modestr(int n) { return (n>=0 && n<=9) ? modenames[n] : "unknown"; };
const char *modestr(int n) { return (n>=0 && n < sizeof(modenames)/sizeof(modenames[0])) ? modenames[n] : "unknown"; };
char msgsizesl[] = // size inclusive message token, 0 for variable or not-checked sizes
{
+28 -25
View File
@@ -9,17 +9,30 @@ const float SGSPREAD = 2;
vec sg[SGRAYS];
//change the particales
guninfo guns[NUMGUNS] =
/*guninfo guns[NUMGUNS] =
{
{ S_KNIFE, S_NULL, 0, 500, 50, 0, 0, 1, 1, 1, 0, 0, false, "knife" },
{ S_PISTOL, S_RPISTOL, 1400, 170, 20, 0, 0, 80, 10, 8, 6, 5, false, "pistol" }, // *SGRAYS
{ S_SHOTGUN, S_RSHOTGUN, 2400, 1000, 6, 0, 0, 1, 35, 7, 9, 9, false, "shotgun" }, //reload time is for 1 shell from 7 too powerful to 6
{ S_SUBGUN, S_RSUBGUN, 1650, 80, 17, 0, 0, 70, 15, 30, 1, 2, true, "subgun" },
{ S_SNIPER, S_RSNIPER, 1950, 1500, 72, 0, 0, 60, 50, 5, 4, 4, false, "sniper" },
{ S_ASSAULT, S_RASSAULT, 2000, 130, /*20*/25, 0, 0, 20, 40, 20, 0, 2, true, "assault" }, //recoil was 44
{ S_ASSAULT, S_RASSAULT, 2000, 130, 25, 0, 0, 20, 40, 20, 0, 2, true, "assault" }, //recoil was 44
{ S_NULL, S_NULL, 1000, 1200, 150, 20, 6, 1, 1, 1, 3, 1, "grenade" },
};*/
// fixme: tmp gun test
guninfo guns[NUMGUNS] =
{
{ S_KNIFE, S_NULL, 0, 500, 50, 0, 0, 1, 1, 1, 0, 0, false, "knife" },
{ S_PISTOL, S_RPISTOL, 1400, 170, 18, 0, 0, 80, 10, 8, 6, 5, false, "pistol" }, // *SGRAYS
{ S_SHOTGUN, S_RSHOTGUN, 2400, 1000, 5, 0, 0, 1, 35, 7, 9, 9, false, "shotgun" }, //reload time is for 1 shell from 7 too powerful to 6
{ S_SUBGUN, S_RSUBGUN, 1650, 80, 14, 0, 0, 70, 15, 30, 1, 2, true, "subgun" },
{ S_SNIPER, S_RSNIPER, 1950, 1500, 80, 0, 0, 60, 50, 5, 4, 4, false, "sniper" },
{ S_ASSAULT, S_RASSAULT, 2000, 130, 20, 0, 0, 20, 40, 20, 0, 2, true, "assault" }, //recoil was 44
{ S_NULL, S_NULL, 1000, 1200, 150, 20, 6, 1, 1, 1, 3, 1, "grenade" },
};
int nadetimer = 2000; // detonate after $ms
bool gun_changed = false;
@@ -106,45 +119,36 @@ void setscope(bool activate)
void altaction(int activate)
{
//if(player1->gunselect == GUN_SNIPER && player1->state!=CS_DEAD) togglescope();
if(player1->gunselect == GUN_SNIPER && player1->state!=CS_DEAD) setscope(activate!=0);
}
};
COMMAND(altaction, ARG_1INT);
void reload(playerent *d)
{
if(!d || d->state!=CS_ALIVE || d->reloading || d->weaponchanging) return;
if(!d || d->state!=CS_ALIVE || d->reloading || d->weaponchanging) return;
if(!reloadable_gun(d->gunselect)) return;
if(d->mag[d->gunselect] >= magsize(d->gunselect)) return;
if(d == player1) setscope(false);
bool akimbo = d->gunselect==GUN_PISTOL && d->akimbo!=0;
if(d->gunselect==GUN_KNIFE || d->gunselect==GUN_GRENADE) return;
if(akimbo && d->mag[d->gunselect]>=(guns[d->gunselect].magsize * 2)) return;
if(has_akimbo(d) && d->mag[d->gunselect]>=(guns[d->gunselect].magsize * 2)) return;
else if(d->mag[d->gunselect]>=guns[d->gunselect].magsize && d->akimbo==0) return;
if(d->ammo[d->gunselect]<=0) return;
d->reloading = true;
d->lastaction = lastmillis;
d->akimbolastaction[0] = d->akimbolastaction[1] = lastmillis;
d->gunwait = guns[d->gunselect].reloadtime;
int a = guns[d->gunselect].magsize - d->mag[d->gunselect];
if(d->gunselect==GUN_PISTOL && d->akimbo!=0)
a = guns[d->gunselect].magsize * 2 - d->mag[d->gunselect];
int numbullets = guns[d->gunselect].magsize - d->mag[d->gunselect];
if (a >= d->ammo[d->gunselect])
{
d->mag[d->gunselect] += d->ammo[d->gunselect];
d->ammo[d->gunselect] = 0;
}
else
{
d->mag[d->gunselect] += a;
d->ammo[d->gunselect] -= a;
}
if(has_akimbo(d)) numbullets = guns[d->gunselect].magsize * 2 - d->mag[d->gunselect];
if(numbullets > d->ammo[d->gunselect]) numbullets = d->ammo[d->gunselect];
d->mag[d->gunselect] += numbullets;
d->ammo[d->gunselect] -= numbullets;
if(akimbo) playsoundc(S_RAKIMBO);
if(has_akimbo(d)) playsoundc(S_RAKIMBO);
else if(d->type==ENT_BOT) playsound(guns[d->gunselect].reload, &d->o);
else playsoundc(guns[d->gunselect].reload);
};
@@ -158,7 +162,6 @@ int magsize(int gun) { return guns[gun].magsize; };
int kick_rot(int gun) { return guns[gun].mdl_kick_rot; };
int kick_back(int gun) { return guns[gun].mdl_kick_back; };
void createrays(vec &from, vec &to) // create random spread of rays for the shotgun
{
float f = to.dist(from)*SGSPREAD/1000;