27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
short gun, speed, health, freq, lag, rate, pain, loyalty, mscale,
bscale;
short painsound, diesound;
OFConstantString *name, *mdlname;
}
monstertypes[NUMMONSTERTYPES] = {
{GUN_FIREBALL, 15, 100, 3, 0, 100, 800, 1, 10, 10, S_PAINO, S_DIE1,
@"an ogre", @"monster/ogro"},
{GUN_CG, 18, 70, 2, 70, 10, 400, 2, 8, 9, S_PAINR, S_DEATHR, @"a rhino",
@"monster/rhino"},
{GUN_SG, 14, 120, 1, 100, 300, 400, 4, 14, 14, S_PAINE, S_DEATHE,
@"ratamahatta", @"monster/rat"},
{GUN_RIFLE, 15, 200, 1, 80, 300, 300, 4, 18, 18, S_PAINS, S_DEATHS,
@"a slith", @"monster/slith"},
{GUN_RL, 13, 500, 1, 0, 100, 200, 6, 24, 24, S_PAINB, S_DEATHB, @"bauul",
@"monster/bauul"},
{GUN_BITE, 22, 50, 3, 0, 100, 400, 1, 12, 15, S_PAINP, S_PIGGR2,
@"a hellpig", @"monster/hellpig"},
{GUN_ICEBALL, 12, 250, 1, 0, 10, 400, 6, 18, 18, S_PAINH, S_DEATHH,
@"a knight", @"monster/knight"},
{GUN_SLIMEBALL, 15, 100, 1, 0, 200, 400, 2, 13, 10, S_PAIND, S_DEATHD,
@"a goblin", @"monster/goblin"},
};
dynent *
basicmonster(int type, int yaw, int state, int trigger, int move)
{
if (type >= NUMMONSTERTYPES) {
conoutf(@"warning: unknown monster in spawn: %d", type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
short gun, speed, health, freq, lag, rate, pain, loyalty, mscale,
bscale;
short painsound, diesound;
OFConstantString *name, *mdlname;
}
monstertypes[NUMMONSTERTYPES] = {
{ GUN_FIREBALL, 15, 100, 3, 0, 100, 800, 1, 10, 10, S_PAINO, S_DIE1,
@"an ogre", @"monster/ogro" },
{ GUN_CG, 18, 70, 2, 70, 10, 400, 2, 8, 9, S_PAINR, S_DEATHR,
@"a rhino", @"monster/rhino" },
{ GUN_SG, 14, 120, 1, 100, 300, 400, 4, 14, 14, S_PAINE, S_DEATHE,
@"ratamahatta", @"monster/rat" },
{ GUN_RIFLE, 15, 200, 1, 80, 300, 300, 4, 18, 18, S_PAINS, S_DEATHS,
@"a slith", @"monster/slith" },
{ GUN_RL, 13, 500, 1, 0, 100, 200, 6, 24, 24, S_PAINB, S_DEATHB,
@"bauul", @"monster/bauul" },
{ GUN_BITE, 22, 50, 3, 0, 100, 400, 1, 12, 15, S_PAINP, S_PIGGR2,
@"a hellpig", @"monster/hellpig" },
{ GUN_ICEBALL, 12, 250, 1, 0, 10, 400, 6, 18, 18, S_PAINH, S_DEATHH,
@"a knight", @"monster/knight" },
{ GUN_SLIMEBALL, 15, 100, 1, 0, 200, 400, 2, 13, 10, S_PAIND, S_DEATHD,
@"a goblin", @"monster/goblin" },
};
dynent *
basicmonster(int type, int yaw, int state, int trigger, int move)
{
if (type >= NUMMONSTERTYPES) {
conoutf(@"warning: unknown monster in spawn: %d", type);
|
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
|
m->attacktarget = target;
transition(m, M_AIMING, 0,
monstertypes[m->mtype].lag, 10);
} else // track player some more
{
transition(m, M_HOME, 1,
monstertypes[m->mtype].rate, 0);
};
};
};
break;
};
moveplayer(m, 1, false); // use physics to move monster
}
void
monsterpain(dynent *m, int damage, dynent *d)
{
if (d->monsterstate) // a monster hit us
{
if (m != d) // guard for RL guys shooting themselves :)
{
m->anger++; // don't attack straight away, first get
// angry
int anger =
m->mtype == d->mtype ? m->anger / 2 : m->anger;
if (anger >= monstertypes[m->mtype].loyalty)
m->enemy = d; // monster infight if very angry
};
} else // player hit us
{
m->anger = 0;
m->enemy = d;
};
transition(m, M_PAIN, 0, monstertypes[m->mtype].pain,
200); // in this state monster won't attack
if ((m->health -= damage) <= 0) {
m->state = CS_DEAD;
m->lastaction = lastmillis;
numkilled++;
player1->frags = numkilled;
playsound(monstertypes[m->mtype].diesound, &m->o);
int remain = monstertotal - numkilled;
if (remain > 0 && remain <= 5)
conoutf(@"only %d monster(s) remaining", remain);
} else {
playsound(monstertypes[m->mtype].painsound, &m->o);
}
}
void
endsp(bool allkilled)
{
conoutf(allkilled ? @"you have cleared the map!"
: @"you reached the exit!");
|
<
<
<
>
>
>
<
>
>
|
<
|
<
>
|
|
|
>
>
|
|
<
<
>
>
|
<
|
<
|
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
|
m->attacktarget = target;
transition(m, M_AIMING, 0,
monstertypes[m->mtype].lag, 10);
} else // track player some more
{
transition(m, M_HOME, 1,
monstertypes[m->mtype].rate, 0);
}
}
}
break;
}
moveplayer(m, 1, false); // use physics to move monster
}
void
monsterpain(dynent *m, int damage, dynent *d)
{
// a monster hit us
if (d->monsterstate) {
// guard for RL guys shooting themselves :)
if (m != d) {
// don't attack straight away, first get angry
m->anger++;
int anger =
m->mtype == d->mtype ? m->anger / 2 : m->anger;
if (anger >= monstertypes[m->mtype].loyalty)
// monster infight if very angry
m->enemy = d;
}
} else {
// player hit us
m->anger = 0;
m->enemy = d;
}
// in this state monster won't attack
transition(m, M_PAIN, 0, monstertypes[m->mtype].pain, 200);
if ((m->health -= damage) <= 0) {
m->state = CS_DEAD;
m->lastaction = lastmillis;
numkilled++;
player1->frags = numkilled;
playsound(monstertypes[m->mtype].diesound, &m->o);
int remain = monstertotal - numkilled;
if (remain > 0 && remain <= 5)
conoutf(@"only %d monster(s) remaining", remain);
} else
playsound(monstertypes[m->mtype].painsound, &m->o);
}
void
endsp(bool allkilled)
{
conoutf(allkilled ? @"you have cleared the map!"
: @"you reached the exit!");
|