1 /* DooM2D: Midnight on the Firing Line
2 * coded by Ketmar // Invisible Vector <ketmar@ketmar.no-ip.org>
3 * Understanding is not required. Only obedience.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 public int PL_hit (Actor me, int damage, Actor owner, int hittype) {
25 if (!me.isPlayer) return false;
26 writeln("Player hit by ", damage, "; hittype=", hittype);
31 int PL_hit (player_t *p, int d, int o, int t) {
32 return PL_hit_lc(p, &p->o, d, o, t);
35 int PL_hit_lc (player_t *p, const obj_t *obj, int d, int o, int t) {
38 if (PL_isinactive(p)) return 0;
45 } else if (t != HIT_ROCKET && t != HIT_ELECTRO) {
47 if (o == -1) return 0;
53 if (t != HIT_WATER && t != HIT_ELECTRO) DOT_blood(obj->x, obj->y-15, hit_xv, hit_yv, d*2);
54 else if (t == HIT_WATER) FX_bubble(obj->x, obj->y-20, 0, 0, d/2);
56 if (p_immortal || p->invl) return 1;
64 void PL_damage (player_t *p) {
67 if ((!p->hit && p->life > 0) || PL_isinactive(p)) return;
69 i = p->hit*p->life/nonz(p->armor*3/4+p->life);
72 if ((p->armor -= p->hit-i) < 0) {
77 if ((p->life -= i) <= 0) {
78 if (pl_dies_cb != NULL) pl_dies_cb(p);
83 Z_sound(pdsnd[myrand(5)], 128);
90 if (p->amul > 1) IT_spawn(p->o.x, p->o.y, I_BPACK);
92 if (p->keys&0x10) IT_spawn(p->o.x, p->o.y, I_KEYR);
93 if (p->keys&0x20) IT_spawn(p->o.x, p->o.y, I_KEYG);
94 if (p->keys&0x40) IT_spawn(p->o.x, p->o.y, I_KEYB);
96 for (i = 1, p->wpns >>= 1; i < 11; ++i, p->wpns >>= 1) {
97 if (i != 2 && (p->wpns&1)) IT_spawn(p->o.x, p->o.y, wp_it[i]);
100 p->wpn = PWPN_PISTOL;
103 if (g_dm && g_plrcount > 1) {
104 if (p->id < 0 && p->hito < 0) {
105 if (p->id == p->hito) {
107 --pl[(-p->id)+1].frag;
110 ++pl[(-p->hito)+1].kills;
111 ++pl[(-p->hito)+1].frag;