-0 36 15.000000 0 // dieone
-36 20 15.000000 0 // dietwo
-56 15 15.000000 1 // draw
+0 36 30.000000 0 // dieone
+36 20 25.000000 0 // dietwo
+56 15 30.000000 1 // draw
71 20 15.000000 1 // duck
-91 21 30.000000 1 // duckwalk
+91 20 32.000000 1 // duckwalk
112 16 15.000000 0 // duckjump
-128 15 5.000000 1 // duckidle
+128 15 10.000000 1 // duckidle
143 41 5.000000 1 // idle
184 160 25.000000 0 // jump
-344 15 15.000000 0 // painone
-359 17 15.000000 0 // paintwo
-376 3 15.000000 0 // shoot
+344 15 24.000000 0 // painone
+359 17 34.000000 0 // paintwo
+376 3 3.000000 0 // shoot
379 21 15.000000 1 // taunt
-400 21 35.000000 1 // run
-421 21 35.000000 1 // runbackwards
-442 21 35.000000 1 // strafeleft
-463 21 35.000000 1 // straferight
+400 20 29.000000 1 // run
+421 20 29.000000 1 // runbackwards
+442 20 29.000000 1 // strafeleft
+463 20 29.000000 1 // straferight
484 2 15.000000 0 // deadone
486 2 15.000000 0 // deadtwo
-488 21 35.000000 1 // forwardright
-509 21 35.000000 1 // forwardleft
-530 21 35.000000 1 // backright
-551 21 30.000000 1 // backleft
+488 20 29.000000 1 // forwardright
+509 20 29.000000 1 // forwardleft
+530 20 29.000000 1 // backright
+551 20 29.000000 1 // backleft
572 21 20.000000 0 // melee
-593 21 30.000000 1 // duckwalkbackwards
-91 21 30.000000 1 // duckwalkstrafeleft
-91 21 30.000000 1 // duckwalkstraferight
-91 21 30.000000 1 // duckwalkforwardright
-91 21 30.000000 1 // duckwalkforwardleft
-593 21 30.000000 1 // duckwalkbackright
-593 21 30.000000 1 // duckwalkbackleft
\ No newline at end of file
+593 20 32.000000 1 // duckwalkbackwards
+614 20 32.000000 1 // duckwalkstrafeleft
+635 20 32.000000 1 // duckwalkstraferight
+656 20 32.000000 1 // duckwalkforwardright
+677 20 32.000000 1 // duckwalkforwardleft
+698 20 32.000000 1 // duckwalkbackright
+719 20 32.000000 1 // duckwalkbackleft
-0 36 15.000000 0 // dieone
-36 20 15.000000 0 // dietwo
-56 15 15.000000 1 // draw
+0 36 30.000000 0 // dieone
+36 20 25.000000 0 // dietwo
+56 15 30.000000 1 // draw
71 20 15.000000 1 // duck
-91 21 30.000000 1 // duckwalk
+91 20 32.000000 1 // duckwalk
112 16 15.000000 0 // duckjump
-128 15 5.000000 1 // duckidle
+128 15 10.000000 1 // duckidle
143 41 5.000000 1 // idle
184 160 25.000000 0 // jump
-344 15 15.000000 0 // painone
-359 17 15.000000 0 // paintwo
-376 3 15.000000 0 // shoot
+344 15 24.000000 0 // painone
+359 17 34.000000 0 // paintwo
+376 3 3.000000 0 // shoot
379 21 15.000000 1 // taunt
-400 21 35.000000 1 // run
-421 21 35.000000 1 // runbackwards
-442 21 35.000000 1 // strafeleft
-463 21 35.000000 1 // straferight
+400 20 29.000000 1 // run
+421 20 29.000000 1 // runbackwards
+442 20 29.000000 1 // strafeleft
+463 20 29.000000 1 // straferight
484 2 15.000000 0 // deadone
486 2 15.000000 0 // deadtwo
-488 21 35.000000 1 // forwardright
-509 21 35.000000 1 // forwardleft
-530 21 35.000000 1 // backright
-551 21 30.000000 1 // backleft
+488 20 29.000000 1 // forwardright
+509 20 29.000000 1 // forwardleft
+530 20 29.000000 1 // backright
+551 20 29.000000 1 // backleft
572 21 20.000000 0 // melee
-593 21 30.000000 1 // duckwalkbackwards
-91 21 30.000000 1 // duckwalkstrafeleft
-91 21 30.000000 1 // duckwalkstraferight
-91 21 30.000000 1 // duckwalkforwardright
-91 21 30.000000 1 // duckwalkforwardleft
-593 21 30.000000 1 // duckwalkbackright
-593 21 30.000000 1 // duckwalkbackleft
\ No newline at end of file
+593 20 32.000000 1 // duckwalkbackwards
+614 20 32.000000 1 // duckwalkstrafeleft
+635 20 32.000000 1 // duckwalkstraferight
+656 20 32.000000 1 // duckwalkforwardright
+677 20 32.000000 1 // duckwalkforwardleft
+698 20 32.000000 1 // duckwalkbackright
+719 20 32.000000 1 // duckwalkbackleft
-0 36 15.000000 0 // dieone
-36 20 15.000000 0 // dietwo
-56 15 15.000000 1 // draw
+0 36 30.000000 0 // dieone
+36 20 25.000000 0 // dietwo
+56 15 30.000000 1 // draw
71 20 15.000000 1 // duck
-91 21 30.000000 1 // duckwalk
+91 20 32.000000 1 // duckwalk
112 16 15.000000 0 // duckjump
-128 15 5.000000 1 // duckidle
+128 15 10.000000 1 // duckidle
143 41 5.000000 1 // idle
184 160 25.000000 0 // jump
-344 15 15.000000 0 // painone
-359 17 15.000000 0 // paintwo
-376 3 15.000000 0 // shoot
+344 15 24.000000 0 // painone
+359 17 34.000000 0 // paintwo
+376 3 3.000000 0 // shoot
379 21 15.000000 1 // taunt
-400 21 35.000000 1 // run
-421 21 35.000000 1 // runbackwards
-442 21 35.000000 1 // strafeleft
-463 21 35.000000 1 // straferight
+400 20 29.000000 1 // run
+421 20 29.000000 1 // runbackwards
+442 20 29.000000 1 // strafeleft
+463 20 29.000000 1 // straferight
484 2 15.000000 0 // deadone
486 2 15.000000 0 // deadtwo
-488 21 35.000000 1 // forwardright
-509 21 35.000000 1 // forwardleft
-530 21 35.000000 1 // backright
-551 21 30.000000 1 // backleft
+488 20 29.000000 1 // forwardright
+509 20 29.000000 1 // forwardleft
+530 20 29.000000 1 // backright
+551 20 29.000000 1 // backleft
572 21 20.000000 0 // melee
-593 21 30.000000 1 // duckwalkbackwards
-91 21 30.000000 1 // duckwalkstrafeleft
-91 21 30.000000 1 // duckwalkstraferight
-91 21 30.000000 1 // duckwalkforwardright
-91 21 30.000000 1 // duckwalkforwardleft
-593 21 30.000000 1 // duckwalkbackright
-593 21 30.000000 1 // duckwalkbackleft
\ No newline at end of file
+593 20 32.000000 1 // duckwalkbackwards
+614 20 32.000000 1 // duckwalkstrafeleft
+635 20 32.000000 1 // duckwalkstraferight
+656 20 32.000000 1 // duckwalkforwardright
+677 20 32.000000 1 // duckwalkforwardleft
+698 20 32.000000 1 // duckwalkbackright
+719 20 32.000000 1 // duckwalkbackleft
-0 36 15.000000 0 // dieone
-36 20 15.000000 0 // dietwo
-56 15 15.000000 1 // draw
+0 36 30.000000 0 // dieone
+36 20 25.000000 0 // dietwo
+56 15 30.000000 1 // draw
71 20 15.000000 1 // duck
-91 21 30.000000 1 // duckwalk
+91 20 32.000000 1 // duckwalk
112 16 15.000000 0 // duckjump
-128 15 5.000000 1 // duckidle
+128 15 10.000000 1 // duckidle
143 41 5.000000 1 // idle
184 160 25.000000 0 // jump
-344 15 15.000000 0 // painone
-359 17 15.000000 0 // paintwo
-376 3 15.000000 0 // shoot
+344 15 24.000000 0 // painone
+359 17 34.000000 0 // paintwo
+376 3 3.000000 0 // shoot
379 21 15.000000 1 // taunt
-400 21 35.000000 1 // run
-421 21 35.000000 1 // runbackwards
-442 21 35.000000 1 // strafeleft
-463 21 35.000000 1 // straferight
+400 20 29.000000 1 // run
+421 20 29.000000 1 // runbackwards
+442 20 29.000000 1 // strafeleft
+463 20 29.000000 1 // straferight
484 2 15.000000 0 // deadone
486 2 15.000000 0 // deadtwo
-488 21 35.000000 1 // forwardright
-509 21 35.000000 1 // forwardleft
-530 21 35.000000 1 // backright
-551 21 30.000000 1 // backleft
+488 20 29.000000 1 // forwardright
+509 20 29.000000 1 // forwardleft
+530 20 29.000000 1 // backright
+551 20 29.000000 1 // backleft
572 21 20.000000 0 // melee
-593 21 30.000000 1 // duckwalkbackwards
-91 21 30.000000 1 // duckwalkstrafeleft
-91 21 30.000000 1 // duckwalkstraferight
-91 21 30.000000 1 // duckwalkforwardright
-91 21 30.000000 1 // duckwalkforwardleft
-593 21 30.000000 1 // duckwalkbackright
-593 21 30.000000 1 // duckwalkbackleft
\ No newline at end of file
+593 20 32.000000 1 // duckwalkbackwards
+614 20 32.000000 1 // duckwalkstrafeleft
+635 20 32.000000 1 // duckwalkstraferight
+656 20 32.000000 1 // duckwalkforwardright
+677 20 32.000000 1 // duckwalkforwardleft
+698 20 32.000000 1 // duckwalkbackright
+719 20 32.000000 1 // duckwalkbackleft
\r
void player_setupanimsformodel()\r
{\r
- local string animfilename;\r
- local float animfile;\r
// defaults for legacy .zym models without animinfo files\r
- self.anim_die1 = '0 1 0.5'; // 2 seconds\r
- self.anim_die2 = '1 1 0.5'; // 2 seconds\r
- self.anim_draw = '2 1 3'; // TODO: analyze models and set framerate\r
- self.anim_duck = '3 1 100'; // this anim seems bogus in most models, so make it play VERY briefly!\r
- self.anim_duckwalk = '4 1 1';\r
- self.anim_duckjump = '5 1 100'; // zym anims keep playing until changed, so this only has to start the anim, landing will end it\r
- self.anim_duckidle = '6 1 1';\r
- self.anim_idle = '7 1 1';\r
- self.anim_jump = '8 1 100'; // zym anims keep playing until changed, so this only has to start the anim, landing will end it\r
- self.anim_pain1 = '9 1 2'; // 0.5 seconds\r
- self.anim_pain2 = '10 1 2'; // 0.5 seconds\r
- self.anim_shoot = '11 1 5'; // TODO: analyze models and set framerate\r
- self.anim_taunt = '12 1 0.33'; // FIXME? there is no code using this anim\r
- self.anim_run = '13 1 1';\r
- self.anim_runbackwards = '14 1 1';\r
- self.anim_strafeleft = '15 1 1';\r
- self.anim_straferight = '16 1 1';\r
- self.anim_dead1 = '17 1 1';\r
- self.anim_dead2 = '18 1 1';\r
- self.anim_forwardright = '19 1 1';\r
- self.anim_forwardleft = '20 1 1';\r
- self.anim_backright = '21 1 1';\r
- self.anim_backleft = '22 1 1';\r
- animparseerror = FALSE;\r
- animfilename = strcat(self.playermodel, ".animinfo"); // only the normal player model may contain animation info\r
- animfile = fopen(animfilename, FILE_READ);\r
- if (animfile >= 0)\r
- {\r
- self.anim_die1 = animparseline(animfile);\r
- self.anim_die2 = animparseline(animfile);\r
- self.anim_draw = animparseline(animfile);\r
- self.anim_duck = animparseline(animfile);\r
- self.anim_duckwalk = animparseline(animfile);\r
- self.anim_duckjump = animparseline(animfile);\r
- self.anim_duckidle = animparseline(animfile);\r
- self.anim_idle = animparseline(animfile);\r
- self.anim_jump = animparseline(animfile);\r
- self.anim_pain1 = animparseline(animfile);\r
- self.anim_pain2 = animparseline(animfile);\r
- self.anim_shoot = animparseline(animfile);\r
- self.anim_taunt = animparseline(animfile);\r
- self.anim_run = animparseline(animfile);\r
- self.anim_runbackwards = animparseline(animfile);\r
- self.anim_strafeleft = animparseline(animfile);\r
- self.anim_straferight = animparseline(animfile);\r
- self.anim_forwardright = animparseline(animfile);\r
- self.anim_forwardleft = animparseline(animfile);\r
- self.anim_backright = animparseline(animfile);\r
- self.anim_backleft = animparseline(animfile);\r
- fclose(animfile);\r
-\r
- // derived anims\r
- self.anim_dead1 = '0 1 1' + '1 0 0' * (self.anim_die1_x + self.anim_die1_y - 1);\r
- self.anim_dead2 = '0 1 1' + '1 0 0' * (self.anim_die2_x + self.anim_die2_y - 1);\r
-\r
- if (animparseerror)\r
- print("Parse error in ", animfilename, ", some player animations are broken\n");\r
- }\r
- else\r
- dprint("File ", animfilename, " not found, assuming legacy .zym model animation timings\n");\r
-\r
+ self.anim_die1 = animfixfps(self, '0 1 0.5'); // 2 seconds\r
+ self.anim_die2 = animfixfps(self, '1 1 0.5'); // 2 seconds\r
+ self.anim_draw = animfixfps(self, '2 1 3');\r
+ // self.anim_duck = '3 1 100'; // This anim is broken, use slot 3 as a new free slot in the future ;)\r
+ self.anim_duckwalk = animfixfps(self, '4 1 1');\r
+ self.anim_duckjump = '5 1 100'; // NOTE: zym anims keep playing until changed, so this only has to start the anim, landing will end it\r
+ self.anim_duckidle = animfixfps(self, '6 1 1');\r
+ self.anim_idle = animfixfps(self, '7 1 1');\r
+ self.anim_jump = '8 1 100'; // NOTE: zym anims keep playing until changed, so this only has to start the anim, landing will end it\r
+ self.anim_pain1 = animfixfps(self, '9 1 2'); // 0.5 seconds\r
+ self.anim_pain2 = animfixfps(self, '10 1 2'); // 0.5 seconds\r
+ self.anim_shoot = animfixfps(self, '11 1 5'); // analyze models and set framerate\r
+ self.anim_taunt = animfixfps(self, '12 1 0.33');\r
+ self.anim_run = animfixfps(self, '13 1 1');\r
+ self.anim_runbackwards = animfixfps(self, '14 1 1');\r
+ self.anim_strafeleft = animfixfps(self, '15 1 1');\r
+ self.anim_straferight = animfixfps(self, '16 1 1');\r
+ //self.anim_dead1 = animfixfps(self, '17 1 1');\r
+ //self.anim_dead2 = animfixfps(self, '18 1 1');\r
+ self.anim_forwardright = animfixfps(self, '19 1 1');\r
+ self.anim_forwardleft = animfixfps(self, '20 1 1');\r
+ self.anim_backright = animfixfps(self, '21 1 1');\r
+ self.anim_backleft = animfixfps(self, '22 1 1');\r
+ self.anim_melee = animfixfps(self, '23 1 1');\r
+ self.anim_duckwalkbackwards = animfixfps(self, '24 1 1');\r
+ self.anim_duckwalkstrafeleft = animfixfps(self, '25 1 1');\r
+ self.anim_duckwalkstraferight = animfixfps(self, '26 1 1');\r
+ self.anim_duckwalkforwardright = animfixfps(self, '27 1 1');\r
+ self.anim_duckwalkforwardleft = animfixfps(self, '28 1 1');\r
+ self.anim_duckwalkbackright = animfixfps(self, '29 1 1');\r
+ self.anim_duckwalkbackleft = animfixfps(self, '30 1 1');\r
+ // TODO introspect models for finding right "fps" value (1/duration)\r
// reset animstate now\r
setanim(self, self.anim_idle, TRUE, FALSE, TRUE);\r
};\r
}\r
else if (self.crouch)\r
{\r
- if (self.movement_x * self.movement_x + self.movement_y * self.movement_y > 20)\r
+ if (self.movement_x > 0 && self.movement_y == 0)\r
setanim(self, self.anim_duckwalk, TRUE, FALSE, FALSE);\r
+ else if (self.movement_x < 0 && self.movement_y == 0)\r
+ setanim(self, self.anim_duckwalkbackwards, TRUE, FALSE, FALSE);\r
+ else if (self.movement_x == 0 && self.movement_y > 0)\r
+ setanim(self, self.anim_duckwalkstraferight, TRUE, FALSE, FALSE);\r
+ else if (self.movement_x == 0 && self.movement_y < 0)\r
+ setanim(self, self.anim_duckwalkstrafeleft, TRUE, FALSE, FALSE);\r
+ else if (self.movement_x > 0 && self.movement_y > 0)\r
+ setanim(self, self.anim_duckwalkforwardright, TRUE, FALSE, FALSE);\r
+ else if (self.movement_x > 0 && self.movement_y < 0)\r
+ setanim(self, self.anim_duckwalkforwardleft, TRUE, FALSE, FALSE);\r
+ else if (self.movement_x < 0 && self.movement_y > 0)\r
+ setanim(self, self.anim_duckwalkbackright, TRUE, FALSE, FALSE);\r
+ else if (self.movement_x < 0 && self.movement_y < 0)\r
+ setanim(self, self.anim_duckwalkbackleft, TRUE, FALSE, FALSE);\r
else\r
setanim(self, self.anim_duckidle, TRUE, FALSE, FALSE);\r
}\r
animfilename = strcat("models/weapons/h_", self.owner.weaponname, ".iqm.animinfo");\r
animfile = fopen(animfilename, FILE_READ);\r
// preset some defaults that work great for renamed zym files (which don't need an animinfo)\r
- self.anim_fire1 = '0 1 0.01';\r
- self.anim_fire2 = '1 1 0.01';\r
- self.anim_idle = '2 1 0.01';\r
- self.anim_reload = '3 1 0.01';\r
- if (animfile >= 0)\r
- {\r
- animparseerror = FALSE;\r
- self.anim_fire1 = animparseline(animfile);\r
- self.anim_fire2 = animparseline(animfile);\r
- self.anim_idle = animparseline(animfile);\r
- self.anim_reload = animparseline(animfile);\r
- fclose(animfile);\r
- if (animparseerror)\r
- print("Parse error in ", animfilename, ", some player animations are broken\n");\r
- }\r
+ self.anim_fire1 = animfixfps(self, '0 1 0.01');\r
+ self.anim_fire2 = animfixfps(self, '1 1 0.01');\r
+ self.anim_idle = animfixfps(self, '2 1 0.01');\r
+ self.anim_reload = animfixfps(self, '3 1 0.01');\r
\r
// if we have a "weapon" tag, let's attach the v_ model to it ("invisible hand" style model)\r
// if we don't, this is a "real" animated model\r
self.movedir = '0 0 0';\r
self.spawnorigin = '0 0 0';\r
self.oldorigin = '0 0 0';\r
- self.anim_fire1 = '0 1 0.01';\r
- self.anim_fire2 = '0 1 0.01';\r
- self.anim_idle = '0 1 0.01';\r
- self.anim_reload = '0 1 0.01';\r
+ self.anim_fire1 = animfixfps(self, '0 1 0.01');\r
+ self.anim_fire2 = animfixfps(self, '0 1 0.01');\r
+ self.anim_idle = animfixfps(self, '0 1 0.01');\r
+ self.anim_reload = animfixfps(self, '0 1 0.01');\r
}\r
\r
self.view_ofs = '0 0 0';\r
if (t)\r
if (!self.crouch) // shoot anim stands up, this looks bad\r
{\r
- local vector anim;\r
- anim = self.anim_shoot;\r
- anim_z = anim_y / (t + sys_frametime);\r
- setanim(self, anim, FALSE, TRUE, TRUE);\r
+ vector anim;\r
+ if(self.weapon == WEP_GRABBER && self.BUTTON_ATCK2)\r
+ {\r
+ // use melee attack animation for grabber alt fire\r
+ anim = self.anim_melee;\r
+ anim_z = anim_y / (t + sys_frametime);\r
+ setanim(self, anim, FALSE, TRUE, TRUE);\r
+ }\r
+ else\r
+ {\r
+ anim = self.anim_shoot;\r
+ anim_z = anim_y / (t + sys_frametime);\r
+ setanim(self, anim, FALSE, TRUE, TRUE);\r
+ }\r
}\r
};\r
\r
self.clip_load = 0;\r
self.old_clip_load = self.clip_load;\r
self.clip_load = self.(weapon_load[self.weapon]) = -1;\r
-}
\ No newline at end of file
+}\r
.vector anim_forwardleft; // player running forward and left\r
.vector anim_backright; // player running backward and right\r
.vector anim_backleft; // player running back and left\r
+.vector anim_melee; // player doing the melee action\r
+.vector anim_duck; // player doing the melee action\r
+.vector anim_duckwalkbackwards;\r
+.vector anim_duckwalkstrafeleft;\r
+.vector anim_duckwalkstraferight;\r
+.vector anim_duckwalkforwardright;\r
+.vector anim_duckwalkforwardleft;\r
+.vector anim_duckwalkbackright;\r
+.vector anim_duckwalkbackleft;\r
\r
// weapon animation vectors:\r
.vector anim_fire1;\r
//print(ftos(time), " -> ", ftos(e.frame), "\n");\r
};\r
\r
-float animparseerror;\r
-vector animparseline(float animfile)\r
-{\r
- local string line;\r
- local float c;\r
- local vector anim;\r
- if (animfile < 0)\r
- return '0 1 2';\r
- line = fgets(animfile);\r
- c = tokenize_console(line);\r
- if (c < 3)\r
+vector animfixfps(entity e, vector a)\r
+{\r
+ // multi-frame anim: keep as-is\r
+ if(a_y == 1)\r
{\r
- animparseerror = TRUE;\r
- return '0 1 2';\r
+ float dur;\r
+ dur = frameduration(e.modelindex, a_x);\r
+ if(dur > 0)\r
+ a_z = 1.0 / dur;\r
}\r
- anim_x = stof(argv(0));\r
- anim_y = stof(argv(1));\r
- anim_z = stof(argv(2));\r
- // don't allow completely bogus values\r
- if (anim_x < 0 || anim_y < 1 || anim_z < 0.001)\r
- anim = '0 1 2';\r
- return anim;\r
-};\r
+ return a;\r
+}\r
\r
/*\r
==================\r
\r
- 0.8: Weight paint new fox state models so that deforms cause less sharp edges when the spine bones rotate from one another\r
\r
-- 0.8 BUG URGENT: Fix new fox animations which aren't being exported properly\r
+- 0.8 BUG: Normal grabber shoot seems to play melee animation on player models\r