From 11e3296f5c40a0ee2e931d8dec97d74d8d0d8413 Mon Sep 17 00:00:00 2001 From: driAn Date: Thu, 27 Apr 2006 17:54:22 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@280 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- .../models/weapons/grenade/animations.cfg | 2 +- source/src/clientextras.cpp | 2 +- source/src/clients2c.cpp | 3 ++- source/src/entities.cpp | 3 ++- source/src/rendermd3.cpp | 27 +++++++++++++------ source/src/weapon.cpp | 24 ++++++++++------- 6 files changed, 39 insertions(+), 22 deletions(-) diff --git a/packages/models/weapons/grenade/animations.cfg b/packages/models/weapons/grenade/animations.cfg index 97f68977..bbde90a3 100644 --- a/packages/models/weapons/grenade/animations.cfg +++ b/packages/models/weapons/grenade/animations.cfg @@ -11,5 +11,5 @@ md3animation 0 1 0 25 // idle md3animation 8 13 0 25 // grenade pull +md3animation 0 1 0 25 // reload md3animation 21 13 0 25 // grenade throw -md3animation 0 1 0 25 // reload \ No newline at end of file diff --git a/source/src/clientextras.cpp b/source/src/clientextras.cpp index df615312..1199efc2 100644 --- a/source/src/clientextras.cpp +++ b/source/src/clientextras.cpp @@ -52,7 +52,7 @@ void renderplayer(dynent *d) if(!d) return; int team = rb_team_int(d->team); - sprintf_sd(mdl)("playermodels/%s/%i", team==TEAM_CLA ? "terrorist" : "counterterrorist", min(0, max(d->skin, (rb_team_int(d->team)==TEAM_CLA ? 3 : 5)))); + sprintf_sd(mdl)("playermodels/%s/0%i", team==TEAM_CLA ? "terrorist" : "counterterrorist", min(0, max(d->skin, (rb_team_int(d->team)==TEAM_CLA ? 3 : 5)))); renderclient(d, isteam(player1->team, d->team), mdl, false, 1.6f); if(d->gunselect>=0 && d->gunselectname, text); sgetstr(); - strcpy_s(d->team, text); + strcpy_s(d->team, text); + getint(p); d->lifesequence = getint(p); break; }; diff --git a/source/src/entities.cpp b/source/src/entities.cpp index aa721685..cc5d664e 100644 --- a/source/src/entities.cpp +++ b/source/src/entities.cpp @@ -287,7 +287,8 @@ void radd(dynent *d) d->mag[GUN_KNIFE] = 1; d->mag[GUN_PISTOL] = 8; - d->ammo[GUN_PISTOL] = 24; + d->ammo[GUN_PISTOL] = 24; + d->mag[GUN_GRENADE] = d->ammo[GUN_GRENADE] = 0; if (m_pistol || d->primary==GUN_PISTOL) // || pistol only mode! { diff --git a/source/src/rendermd3.cpp b/source/src/rendermd3.cpp index afedb154..79d250dc 100644 --- a/source/src/rendermd3.cpp +++ b/source/src/rendermd3.cpp @@ -433,9 +433,12 @@ struct weaponmove bool akimbo = player1->akimbo && player1->gunselect==GUN_PISTOL; bool throwingnade = player1->gunselect==GUN_GRENADE && player1->thrownademillis; int timediff = throwingnade ? (lastmillis-player1->thrownademillis) : lastmillis-basetime; + int animtime = attackdelay(player1->gunselect); + int rtime = reloadtime(player1->gunselect); kick = k_rot = 0.0f; pos = player1->o; anim = MDL_GUN_IDLE; + bool attacking = player1->lastaction && player1->lastattackgun==player1->gunselect /*&& lastmillis-player1->lastactionlastmillis) // akimbo gun queued for reloading { @@ -444,28 +447,36 @@ struct weaponmove else if(player1->reloading) { anim = MDL_GUN_RELOAD; - int rtime = reloadtime(player1->gunselect); float percent_done = (float)(timediff)*100.0f/rtime; if(percent_done >= 100) percent_done = 100; k_rot = -(sin((float)(percent_done*2/100.0f*90.0f)*PI/180.0f)*90); } + else if(throwingnade && timediff>animtime-rtime/2 && timediffgunselect==player1->lastattackgun) { - int animtime = /*throwingnade ? 5000 : */attackdelay(player1->gunselect); - int percent_done = timediff*100/animtime; - if(percent_done > 100) percent_done = 100.0; + percent_done = timediff*100.0f/(float)animtime; + if(percent_done > 100.0f) percent_done = 100.0f; // f(x) = -sin(x-1.5)^3 - kick = -sin(pow((1.5f/100*percent_done)-1.5f,3)); + kick = -sin(pow((1.5f/100.0f*percent_done)-1.5f,3)); }; - if(kick>0.01f) - { - if(throwingnade) { anim = MDL_GUN_ATTACK2; return; } + if(attacking && timediff=0) gun %= G_NUM; else gun = G_NUM-(gun % G_NUM); @@ -48,10 +48,10 @@ void shiftweapon(int i) default: gun=G_PRIMARY; break; }; gun += i; - changeweapon(gun); + weapon(gun); } -COMMAND(changeweapon, ARG_1INT); +COMMAND(weapon, ARG_1INT); COMMAND(shiftweapon, ARG_1INT); void reload() @@ -314,7 +314,6 @@ void throw_nade(dynent *d, vec &to, physent *p) if(d==player1) { - d->thrownademillis = lastmillis; int percent_done = (lastmillis-p->millis)*100/2000; if(percent_done < 0 || percent_done > 100) percent_done = 100; 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), percent_done); @@ -505,7 +504,8 @@ void spreadandrecoil(vec & from, vec & to, dynent * d) if(d->pitch<80.0f) d->pitch += guns[d->gunselect].recoil*0.05f; }; -VAR(grenadepulltime, 0, 100, 10000); +//VAR(grenadepulltime, 0, 100, 10000); +const int grenadepulltime = 650; bool akimboside = false; int akimbolastaction[2] = {0,0}; @@ -517,9 +517,13 @@ void shoot(dynent *d, vec &targ) if(!d->attacking && d->gunselect==GUN_GRENADE && curnade) // throw { - if(attacktime>grenadepulltime) throw_nade(d, targ, curnade); + if(attacktime>grenadepulltime) + { + d->thrownademillis = lastmillis; + throw_nade(d, targ, curnade); + } return; - } + }; if(attacktimegunwait) return; d->gunwait = 0; @@ -539,9 +543,9 @@ void shoot(dynent *d, vec &targ) d->attacking = true; //make akimbo auto akimbolastaction[akimboside?1:0] = lastmillis; akimboside = !akimboside; - } - d->lastaction = lastmillis; + } + d->lastaction = lastmillis; d->lastattackgun = d->gunselect; if(!d->mag[d->gunselect]) { playsoundc(S_NOAMMO); d->gunwait = 250; d->lastattackgun = -1; return; };