// // A_Saw // void A_Saw (AActor *mo) { angle_t angle; int damage; player_t *player = mo->player; damage = 2 * (P_Random (player->mo)%10+1); angle = player->mo->angle; angle += P_RandomDiff(player->mo) << 18; // [SL] 2011-07-12 - Move players and sectors back to their positions when // this player hit the fire button clientside. Unlag::getInstance().reconcile(player->id); // use meleerange + 1 so the puff doesn't skip the flash P_LineAttack (player->mo, angle, MELEERANGE+1, P_AimLineAttack (player->mo, angle, MELEERANGE+1), damage); // [SL] 2011-07-12 - Restore players and sectors to their current position // according to the server. Unlag::getInstance().restore(player->id); if (!linetarget) { A_FireSound (player, "weapons/sawfull"); return; } A_FireSound (player, "weapons/sawhit"); // turn to face target angle = P_PointToAngle (player->mo->x, player->mo->y, linetarget->x, linetarget->y); if (angle - player->mo->angle > ANG180) { if (angle - player->mo->angle < (angle_t)(-ANG90/20)) player->mo->angle = angle + ANG90/21; else player->mo->angle -= ANG90/20; } else { if (angle - player->mo->angle > ANG90/20) player->mo->angle = angle - ANG90/21; else player->mo->angle += ANG90/20; } player->mo->flags |= MF_JUSTATTACKED; }
// // A_Punch // void A_Punch (AActor *mo) { angle_t angle; int damage; int slope; player_t *player = mo->player; damage = (P_Random (player->mo)%10+1)<<1; if (player->powers[pw_strength]) damage *= 10; angle = player->mo->angle; angle += P_RandomDiff(player->mo) << 18; // [SL] 2011-07-12 - Move players and sectors back to their positions when // this player hit the fire button clientside. Unlag::getInstance().reconcile(player->id); slope = P_AimLineAttack (player->mo, angle, MELEERANGE); P_LineAttack (player->mo, angle, MELEERANGE, slope, damage); // [SL] 2011-07-12 - Restore players and sectors to their current position // according to the server. Unlag::getInstance().restore(player->id); // turn to face target if (linetarget) { A_FireSound (player, "player/male/fist"); //S_Sound (player->mo, CHAN_VOICE, "*fist", 1, ATTN_NORM); player->mo->angle = P_PointToAngle (player->mo->x, player->mo->y, linetarget->x, linetarget->y); } }
// // A_Tracer // // (Accidentally?) randomized homing missile maintenance. // ioanch 20151230: fixed to be portal-aware // void A_Tracer(actionargs_t *actionargs) { angle_t exact; fixed_t dist; fixed_t slope; Mobj *actor = actionargs->actor; Mobj *dest; Mobj *th; // killough 1/18/98: this is why some missiles do not have smoke // and some do. Also, internal demos start at random gametics, // thus the bug in which revenants cause internal demos to go out // of sync. // // killough 3/6/98: fix revenant internal demo bug by subtracting // levelstarttic from gametic. // // killough 9/29/98: use new "basetic" so that demos stay in sync // during pauses and menu activations, while retaining old demo // sync. // // leveltime would have been better to use to start with in Doom, // but since old demos were recorded using gametic, we must stick // with it, and improvise around it (using leveltime causes desync // across levels). if((gametic-basetic) & 3) return; // spawn a puff of smoke behind the rocket P_SpawnPuff(actor->x, actor->y, actor->z, 0, 3, false); th = P_SpawnMobj(actor->x - actor->momx, actor->y - actor->momy, actor->z, E_SafeThingType(MT_SMOKE)); th->momz = FRACUNIT; th->tics -= P_Random(pr_tracer) & 3; if(th->tics < 1) th->tics = 1; // adjust direction dest = actor->tracer; if(!dest || dest->health <= 0) return; fixed_t dx = getThingX(actor, dest); fixed_t dy = getThingY(actor, dest); fixed_t dz = getThingZ(actor, dest); // change angle exact = P_PointToAngle(actor->x, actor->y, dx, dy); if(exact != actor->angle) { if(exact - actor->angle > 0x80000000) { actor->angle -= TRACEANGLE; if(exact - actor->angle < 0x80000000) actor->angle = exact; } else { actor->angle += TRACEANGLE; if(exact - actor->angle > 0x80000000) actor->angle = exact; } } exact = actor->angle>>ANGLETOFINESHIFT; actor->momx = FixedMul(actor->info->speed, finecosine[exact]); actor->momy = FixedMul(actor->info->speed, finesine[exact]); // change slope dist = P_AproxDistance(dx - actor->x, dy - actor->y); dist = dist / actor->info->speed; if(dist < 1) dist = 1; slope = (dz + 40*FRACUNIT - actor->z) / dist; if(slope < actor->momz) actor->momz -= FRACUNIT/8; else actor->momz += FRACUNIT/8; }