pickup and armour fixes

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@34 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
arghvark
2005-08-23 16:02:53 +00:00
parent 407befc0f3
commit 50ed00160b
10 changed files with 152 additions and 76 deletions
+8 -9
View File
@@ -40,12 +40,10 @@ hudgun 1
maxroll 0
lighterror 1
bind m show_acm
alias sp [ mode -2; map $arg1 ]
alias dmsp [ mode -1; map $arg1 ]
alias ffa [ mode 0; map $arg1 ]
alias insta [ mode 4; map $arg1 ]
//alias sp [ mode -2; map $arg1 ]
//alias dmsp [ mode -1; map $arg1 ]
//alias ffa [ mode 0; map $arg1 ]
//alias insta [ mode 4; map $arg1 ]
// below is a fun new way of editing, with all using the mousewheel
@@ -67,8 +65,9 @@ alias universaldelta [
bind MOUSE4 [ universaldelta 1 ]
bind MOUSE5 [ universaldelta -1 ]
bind 1 previous
bind 2 next
bind 1 primary
bind 2 secondary
bind 3 melee
bind R reload
bind MOUSE2 altattack
@@ -92,5 +91,5 @@ alias delta_game_1 [
// change
hudgun 1
bind p [ connect 67.163.146.134 ]
bind p [ connect 67.163.146.120 ]
showmenu maps
+15 -14
View File
@@ -1,15 +1,15 @@
// standard menu definitions
alias menu_music ac.ogg
alias mainmenu [
musicvol 128
music $menu_music
showmenu main
]
alias menu_music ac.ogg
alias mainmenu [
musicvol 128
music $menu_music
showmenu main
]
bind ESCAPE mainmenu // it all starts here
newmenu main
menuitem "Join Game" "servermenu"
@@ -46,8 +46,8 @@ genmapitems "ac_complex ac_mines ac_office"
newmenu team
menuitem "Special Forces"
menuitem "Freedom Fighters"
menuitem "CT"
menuitem "T"
newmenu gamemode
@@ -56,7 +56,8 @@ menuitem "Team Deathmatch" "mode 1; showmenu maps"
menuitem "Team Survivor" "mode 1; showmenu maps"
menuitem "Capture the Flag" "mode 2; showmenu maps"
menuitem "Deathmatch" "mode 0; showmenu maps"
menuitem "Deathmatch Arena (LMS)" "mode 0; showmenu maps"
menuitem "Deathmatch Arena" "mode 0; showmenu maps"
menuitem "Pistols" "mode 5; showmenu maps"
newmenu spawnmode
@@ -236,13 +237,13 @@ menuitem "Equipment" "showmenu equipment"
newmenu "primary"
menuitem "Mtp 57 Assault Rifle" "echo MK-77 Assault Rifle chosen"
menuitem "Mtp 57 Assault Rifle" "echo MTP-57 Assault Rifle chosen"
menuitem "A-ARD/10 Submachine Gun" "echo A-ARD/10 Submachine Gun chosen"
menuitem "Precision Tech AD-81 Sniper Rifle" "echo Precision Tech AD-81 Sniper Rifle chosen"
menuitem "Precision Tech AD-81 Sniper Rifle" "echo Precision Tech AD-81 Sniper Rifle chosen"
menuitem "V-19 Combat Shotgun" "echo V-19 Combat Shotgun chosen"
newmenu "secondary"
menuitem "Mk-77 Semi-Automatic Pistol" "echo MTP 57 Semi-Automatic Pistol Chosen"
menuitem "Mk-77 Semi-Automatic Pistol" "echo MK 77 Semi-Automatic Pistol Chosen"
newmenu "equipment"
menuitem "DR-17 HE-Grenade" "echo DR-17 HE-Grenade chosen"
Binary file not shown.
+11 -5
View File
@@ -44,14 +44,18 @@ void spawnstate(dynent *d) // reset player state not persistent acc
d->timeinair = 0;
d->health = 100;
d->armour = 0;
d->armourtype = A_BLUE;
d->quadmillis = 0;
//d->hasarmour = false;
//d->armourtype = A_BLUE;
//d->quadmillis = 0;
d->gunselect = GUN_PISTOL;
d->gunwait = 0;
d->attacking = false;
d->lastaction = 0;
radd(d);
//loopi(NUMGUNS) if(d->nextprimary!=i) d->ammo[i] = 0;
//d->mag[GUN_KNIFE] = 1;
//equp with default pistol
@@ -140,6 +144,7 @@ dynent *newdynent() // create a new blank player or monster
d->shots = 0;
d->reloading = false;
d->nextprimary = 1;
d->hasarmour = false;
spawnstate(d);
return d;
};
@@ -221,12 +226,13 @@ void arenarespawn()
void checkquad(int time)
{
if(player1->quadmillis && (player1->quadmillis -= time)<0)
/* if(player1->quadmillis && (player1->quadmillis -= time)<0)
{
player1->quadmillis = 0;
playsoundc(S_PUPOUT);
conoutf("quad damage is over");
};
*/
};
//generic function to check all kinds of crazy gamemode specific things
@@ -269,7 +275,7 @@ void checkgame(int time)
//reset zoom if dead
//etc
checkquad(time);
//checkquad(time);
if (player1->state==CS_DEAD)
{
@@ -437,7 +443,7 @@ void selfdamage(int damage, int actor, dynent *act)
if(player1->state!=CS_ALIVE || editmode || intermission) return;
damageblend(damage);
demoblend(damage);
int ad = damage*(player1->armourtype+1)*20/100; // let armour absorb when possible
int ad = damage*30/100;//int ad = damage*(player1->armourtype+1)*20/100; // let armour absorb when possible
if(ad>player1->armour) ad = player1->armour;
player1->armour -= ad;
damage -= ad;
+3 -4
View File
@@ -40,7 +40,6 @@ enum // static entity types
NOTUSED = 0, // entity slot not in use in map
LIGHT, // lightsource, attr1 = radius, attr2 = intensity
PLAYERSTART, // attr1 = angle
//I_SHOTGUN, I_SUBGUN, I_SNIPER, I_ASSULT, I_GRENADE, I_PISTOL,
I_CLIPS, I_AMMO,I_GRENADE,
I_HEALTH, I_ARMOUR, I_QUAD,
MAPMODEL, // attr1 = angle, attr2 = idx
@@ -109,7 +108,7 @@ struct dynent // players & monsters
int lifesequence; // sequence id for each respawn, used in damage test
int state; // one of CS_* below
int frags;
int health, armour, armourtype, quadmillis;
int health, armour; //armourtype, quadmillis;
int gunselect, gunwait;
int lastaction, lastattackgun, lastmove;
bool attacking;
@@ -126,14 +125,14 @@ struct dynent // players & monsters
string name, team;
int startheight;
int shots; //keeps track of shots from auto weapons
bool reloading;
bool reloading, hasarmour;
int primary; //primary gun
int nextprimary;
};
#define SAVEGAMEVERSION 6 // bump if dynent/netprotocol changes or any other savegame/demo data bumped from 5
enum { A_BLUE, A_GREEN, A_YELLOW }; // armour types... take 20/40/60 % off
//enum { A_BLUE, A_GREEN, A_YELLOW }; // armour types... take 20/40/60 % off
enum { M_NONE = 0, M_SEARCH, M_HOME, M_ATTACKING, M_PAIN, M_SLEEP, M_AIMING }; // monster states
#define MAXCLIENTS 256 // in a multiplayer game, can be arbitrarily changed
+14 -11
View File
@@ -111,11 +111,11 @@ void realpickup(int n, dynent *d)
case I_ARMOUR:
radditem(n, d->armour, 8);
d->armourtype = A_YELLOW;
//d->hasarmour = true;
break;
case I_QUAD:
radditem(n, d->quadmillis, 9);
//radditem(n, d->quadmillis, 9);
conoutf("a lesser man would use a single pistol");
break;
};
@@ -167,7 +167,7 @@ void pickup(int n, dynent *d)
break;
case I_QUAD:
additem(n, d->quadmillis, 60, 9);
//additem(n, d->quadmillis, 60, 9);
break;
case CARROT:
@@ -225,22 +225,25 @@ void radd(dynent *d)
}
else if (d->primary==GUN_GRENADE)
{
conoutf("you don't have to worry about blowing your hand off just yet...");
//conoutf("you don't have to worry about blowing your hand off just yet...");
}
if (d->armour)
if (d->hasarmour)
{
d->armour = 100;
if(gamemode==m_arena)
d->armour = 100;
}
};
void add(int num)
void item(int num)
{
if (num>0 && num<6) player1->nextprimary = num;
if (num==6) conoutf("sorry, no nades yet");
if (num==7) { player1->hasarmour=!player1->hasarmour; /*toggle armour*/ };
if (num>0 && num<8) player1->nextprimary = num;
};
COMMAND(add,ARG_1INT);
COMMAND(item,ARG_1INT);
+4 -1
View File
@@ -251,7 +251,10 @@ void moveplayer(dynent *pl, int moveres, bool local, int curtime)
if(pl->jumpnext)
{
pl->jumpnext = false;
pl->vel.z = 1.7f; // physics impulse upwards
if (pl->armour>0)
pl->vel.z = 1.9f;
else
pl->vel.z = 1.7f; // physics impulse upwards
if(water) { pl->vel.x /= 8; pl->vel.y /= 8; }; // dampen velocity change even harder, gives correct water feel
if(local) playsoundc(S_JUMP);
else if(pl->monsterstate) playsound(S_JUMP, &pl->o);
+2 -2
View File
@@ -369,8 +369,8 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
glPushMatrix();
glOrtho(0, VIRTW, VIRTH, 0, -1, 1);
glDisable(GL_BLEND);
drawicon(128, 128, 20, 1650);
if(player1->armour) drawicon((float)(player1->armourtype*64), 0, 620, 1650);
drawicon(64, 0, 20, 1650); //drawicon(128, 128, 20, 1650);
if(player1->armour) drawicon((float)(128), 0, 620, 1650); //if(player1->armour) drawicon((float)(player1->armourtype*64), 0, 620, 1650);
int g = player1->gunselect;
int r = 64;
if(g>2) { g -= 3; r = 128; };
+2 -2
View File
@@ -166,7 +166,7 @@ void incomingdemodata(uchar *buf, int len, bool extras)
gzputi(player1->gunwait);
gzputi(player1->health);
gzputi(player1->armour);
gzput(player1->armourtype);
//gzput(player1->armourtype);
loopi(NUMGUNS) gzput(player1->ammo[i]);
gzput(player1->state);
gzputi(bdamage);
@@ -271,7 +271,7 @@ void demoplaybackstep()
target->gunwait = gzgeti();
target->health = gzgeti();
target->armour = gzgeti();
target->armourtype = gzget();
//target->armourtype = gzget();
loopi(NUMGUNS) target->ammo[i] = gzget();
target->state = gzget();
target->lastmove = playbacktime;
+93 -28
View File
@@ -11,12 +11,18 @@ vec sg[SGRAYS];
//change the particales
guninfo guns[NUMGUNS] =
{
{ S_KNIFE, S_NULL, 0, 250, 50, 0, 0, 1, 1, 1, "knife" },
{ S_PISTOL, S_RPISTOL, 1400, 170, 20, 0, 0, 20, 10, 8, "pistol" }, // *SGRAYS
{ S_SHOTGUN, S_RSHOTGUN, 2400, 1100, 6, 0, 0, 1, 35, 7, "shotgun" }, //reload time is for 1 shell from 7 too powerful to 6
{ S_SUBGUN, S_RSUBGUN, 1650, 90, 14, 0, 0, 45, 15, 30, "subgun" },
{ S_SNIPER, S_RSNIPER, 1950, 1500, 72, 0, 0, 60, 50, 5, "sniper" },
{ S_ASSULT, S_RASSULT, 2000, 130, 33, 0, 0, 90, 40, 20, "assult" }, //recoil was 44
{ S_KNIFE, S_NULL, 0, 250, 50, 0, 0, 1, 1, 1, "knife" },
{ S_PISTOL, S_RPISTOL, 1400, 170, 20, 0, 0, 20, 10, 8, "pistol" }, // *SGRAYS
{ S_SHOTGUN, S_RSHOTGUN, 2400, 1100, 6, 0, 0, 1, 35, 7, "shotgun" }, //reload time is for 1 shell from 7 too powerful to 6
{ S_SUBGUN, S_RSUBGUN, 1650, 90, 14, 0, 0, 45, 15, 30, "subgun" },
{ S_SNIPER, S_RSNIPER, 1950, 1500, 72, 0, 0, 60, 50, 5, "sniper" },
{ S_ASSULT, S_RASSULT, 2000, 130, 33, 0, 0, 90, 40, 20, "assult" }, //recoil was 44
{ S_GRENADE, S_NULL, 0, 2000, 40, 30, 6, 1, 1, 1, "grenade" },
};
@@ -45,23 +51,40 @@ void wdw()
conoutf("%s selected", (int)guns[player1->gunselect].name);
};
void primary()
{
player1->gunselect=player1->primary;
};
void secondary()
{
player1->gunselect=GUN_PISTOL;
};
void melee()
{
player1->gunselect=GUN_KNIFE;
};
COMMAND(primary,ARG_NONE);
COMMAND(secondary,ARG_NONE);
void primary()
{
player1->gunselect=player1->primary;
};
void secondary()
{
player1->gunselect=GUN_PISTOL;
};
void melee()
{
player1->gunselect=GUN_KNIFE;
};
COMMAND(primary,ARG_NONE);
COMMAND(secondary,ARG_NONE);
COMMAND(melee,ARG_NONE);
COMMAND(wup,ARG_NONE);
COMMAND(wdw,ARG_NONE);
@@ -245,7 +268,8 @@ void moveprojectiles(float time)
{
projectile *p = &projs[i];
if(!p->inuse) continue;
int qdam = guns[p->gun].damage*(p->owner->quadmillis ? 4 : 1);
//int qdam = guns[p->gun].damage*(p->owner->quadmillis ? 4 : 1);
int qdam = guns[p->gun].damage;
vdist(dist, v, p->o, p->to);
float dtime = dist*1000/p->speed;
if(time>dtime) dtime = time;
@@ -320,7 +344,7 @@ void raydamage(dynent *o, vec &from, vec &to, dynent *d, int i)
{
if(o->state!=CS_ALIVE) return;
int qdam = guns[d->gunselect].damage;
if(d->quadmillis) qdam *= 4;
//if(d->quadmillis) qdam *= 4;
if(d->gunselect==GUN_SHOTGUN)
{
int damage = 0;
@@ -331,7 +355,48 @@ void raydamage(dynent *o, vec &from, vec &to, dynent *d, int i)
};
void spreadandrecoil(vec & from, vec & to, dynent * d)
{
//nothing specail for a knife
//nothing specail for a knife
if (d->gunselect==GUN_KNIFE) return;
//spread
vdist(dist, unitv, from, to);
float f = dist/1000;
int spd = guns[d->gunselect].spread;
//recoil
int rcl = guns[d->gunselect].recoil*-0.01f;
if (d->gunselect==GUN_ASSULT)
{
if (d->shots<=3)
spd = spd / 5;
rcl += (rnd(8)*-0.01f);
};
if ((d->gunselect==GUN_SNIPER) && (d->vel.x<.25f && d->vel.y<.25f))
{
spd = 1;
rcl = rcl / 3;
};
if (d->gunselect!=GUN_SHOTGUN) //no spread on shotgun
{
vec r = { RNDD, RNDD, RNDD };
vadd(to, r);
};
//increase pitch for recoil
vdiv(unitv, dist);
vec recoil = unitv;
vmul(recoil, rcl);
vadd(d->vel, recoil);
if(d->pitch<80.0f) d->pitch += guns[d->gunselect].recoil*0.05f;
/* old
//nothing specail for a knife
if (d->gunselect==GUN_KNIFE) return;
//spread
@@ -366,7 +431,7 @@ void spreadandrecoil(vec & from, vec & to, dynent * d)
vmul(recoil, rcl);
vadd(d->vel, recoil);
if(d->pitch<80.0f) d->pitch += guns[d->gunselect].recoil*0.05f;
*/
};
void shoot(dynent *d, vec &targ)
@@ -403,7 +468,7 @@ void shoot(dynent *d, vec &targ)
};
if(d->gunselect==GUN_SHOTGUN) createrays(from, to);
if(d->quadmillis && attacktime>200) playsoundc(S_ITEMPUP);
//if(d->quadmillis && attacktime>200) playsoundc(S_ITEMPUP);
shootv(d->gunselect, from, to, d, true);
addmsg(1, 8, 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));
d->gunwait = guns[d->gunselect].attackdelay;