Why don't I have a custom title by now?!
Chainsaw just changes angle. It doesn't actually boost, I think.
So as you can see, it fiddles with the player's angle, but doesn't change anything to position or momentum.
( player_t* player,
pspdef_t* psp )
damage = 2*(P_Random ()%10+1);
angle = player->mo->angle;
angle += (P_Random()-P_Random())<<18;
// use meleerange + 1 se the puff doesn't skip the flash
slope = P_AimLineAttack (player->mo, angle, MELEERANGE+1);
P_LineAttack (player->mo, angle, MELEERANGE+1, slope, damage);
S_StartSound (player->mo, sfx_sawful);
S_StartSound (player->mo, sfx_sawhit);
// turn to face target
angle = R_PointToAngle2 (player->mo->x, player->mo->y,
if (angle - player->mo->angle > ANG180)
if (angle - player->mo->angle < -ANG90/20)
player->mo->angle = angle + ANG90/21;
player->mo->angle -= ANG90/20;
if (angle - player->mo->angle > ANG90/20)
player->mo->angle = angle - ANG90/21;
player->mo->angle += ANG90/20;
player->mo->flags |= MF_JUSTATTACKED;
However, notice that MF_JUSTATTACKED flag that is being set? It's a hack. This flag is used by monster AI and meaningless for a player. So, how is it used?
There you go. It sets your forwardmove. If you're already running, it won't change anything I think; however if you're standing still (or backpedaling) it changes your command into a move forward the monster.
void P_PlayerThink (player_t* player)
// fixme: do this in the cheat code
if (player->cheats & CF_NOCLIP)
player->mo->flags |= MF_NOCLIP;
player->mo->flags &= ~MF_NOCLIP;
// chain saw run forward
cmd = &player->cmd;
if (player->mo->flags & MF_JUSTATTACKED)
cmd->angleturn = 0;
cmd->forwardmove = 0xc800/512;
cmd->sidemove = 0;
player->mo->flags &= ~MF_JUSTATTACKED;
<snip lots more code>
Note that, independently of being stopped by collision into the monster, it'll also slow you down if you were straferunning since it sets your sidemove to 0.
Last edited by Gez on Nov 10 2013 at 00:42