📄 p_enemy.c
字号:
{ if (!actor->target) return; A_FaceTarget (actor); A_PainShootSkull (actor, actor->angle);}void A_PainDie (mobj_t* actor){ A_Fall (actor); A_PainShootSkull (actor, actor->angle+ANG90); A_PainShootSkull (actor, actor->angle+ANG180); A_PainShootSkull (actor, actor->angle+ANG270);}void A_Scream (mobj_t* actor){ int sound; switch (actor->info->deathsound) { case 0: return; case sfx_podth1: case sfx_podth2: case sfx_podth3: sound = sfx_podth1 + P_Random ()%3; break; case sfx_bgdth1: case sfx_bgdth2: sound = sfx_bgdth1 + P_Random ()%2; break; default: sound = actor->info->deathsound; break; } // Check for bosses. if (actor->type==MT_SPIDER || actor->type == MT_CYBORG) { // full volume S_StartSound (NULL, sound); } else#ifdef HW3SOUND S_StartScreamSound(actor, sound);#else S_StartSound (actor, sound);#endif}void A_XScream (mobj_t* actor){#ifdef HW3SOUND S_StartScreamSound(actor, sfx_slop);#else S_StartSound (actor, sfx_slop);#endif}void A_Pain (mobj_t* actor){ if (actor->info->painsound)#ifdef HW3SOUND S_StartScreamSound(actor, actor->info->painsound);#else S_StartSound (actor, actor->info->painsound);#endif}//// A dying thing falls to the ground (monster deaths)//void A_Fall (mobj_t *actor){ // actor is on ground, it can be walked over if (!cv_solidcorpse.value) actor->flags &= ~MF_SOLID; if( demoversion >= 131 ) { actor->flags |= MF_CORPSE|MF_DROPOFF; actor->height >>= 2; actor->radius -= (actor->radius>>4); //for solid corpses actor->health = actor->info->spawnhealth>>1; } // So change this if corpse objects // are meant to be obstacles.}//// A_Explode//void A_Explode (mobj_t* actor){ int damage = 128; switch(actor->type) { case MT_FIREBOMB: // Time Bombs actor->z += 32*FRACUNIT; actor->flags &= ~MF_SHADOW; break; case MT_MNTRFX2: // Minotaur floor fire damage = 24; break; case MT_SOR2FX1: // D'Sparil missile damage = 80+(P_Random()&31); break; default: break; } P_RadiusAttack ( actor, actor->target, damage ); P_HitFloor(actor);}static state_t *P_FinalState(statenum_t state){ while(states[state].tics!=-1) state=states[state].nextstate; return &states[state];}//// A_BossDeath// Possibly trigger special effects// if on first boss level//void A_BossDeath (mobj_t* mo){ thinker_t* th; mobj_t* mo2; line_t junk; int i; if ( gamemode == commercial) { if (gamemap != 7) return; if ((mo->type != MT_FATSO) && (mo->type != MT_BABY)) return; } else { switch(gameepisode) { case 1: if (gamemap != 8) return; if (mo->type != MT_BRUISER) return; break; case 2: if (gamemap != 8) return; if (mo->type != MT_CYBORG) return; break; case 3: if (gamemap != 8) return; if (mo->type != MT_SPIDER) return; break; case 4: switch(gamemap) { case 6: if (mo->type != MT_CYBORG) return; break; case 8: if (mo->type != MT_SPIDER) return; break; default: return; break; } break; default: if (gamemap != 8) return; break; } } // make sure there is a player alive for victory for (i=0 ; i<MAXPLAYERS ; i++) if (playeringame[i] && players[i].health > 0) break; if (i==MAXPLAYERS) return; // no one left alive, so do not end game // scan the remaining thinkers to see // if all bosses are dead for (th = thinkercap.next ; th != &thinkercap ; th=th->next) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; mo2 = (mobj_t *)th; if (mo2 != mo && mo2->type == mo->type /*&& mo2->health > 0*/ // the old one (doom original 1.9) && mo2->state!=P_FinalState(mo->info->deathstate)) { // other boss not dead return; } } // victory! if ( gamemode == commercial) { if (gamemap == 7) { if (mo->type == MT_FATSO) { junk.tag = 666; EV_DoFloor(&junk,lowerFloorToLowest); return; } if (mo->type == MT_BABY) { junk.tag = 667; EV_DoFloor(&junk,raiseToTexture); return; } } } else { switch(gameepisode) { case 1: junk.tag = 666; EV_DoFloor (&junk, lowerFloorToLowest); return; break; case 4: switch(gamemap) { case 6: junk.tag = 666; EV_DoDoor (&junk, blazeOpen,4*VDOORSPEED); return; break; case 8: junk.tag = 666; EV_DoFloor (&junk, lowerFloorToLowest); return; break; } } } if( cv_allowexitlevel.value ) G_ExitLevel ();}void A_Hoof (mobj_t* mo){ S_StartSound (mo, sfx_hoof); A_Chase (mo);}void A_Metal (mobj_t* mo){ S_StartSound (mo, sfx_metal); A_Chase (mo);}void A_BabyMetal (mobj_t* mo){ S_StartSound (mo, sfx_bspwlk); A_Chase (mo);}voidA_OpenShotgun2( player_t* player, pspdef_t* psp ){#ifdef HW3SOUND S_StartAttackSound(player->mo, sfx_dbopn);#else S_StartSound (player->mo, sfx_dbopn);#endif}voidA_LoadShotgun2( player_t* player, pspdef_t* psp ){#ifdef HW3SOUND S_StartAttackSound(player->mo, sfx_dbload);#else S_StartSound (player->mo, sfx_dbload);#endif}voidA_ReFire( player_t* player, pspdef_t* psp );voidA_CloseShotgun2( player_t* player, pspdef_t* psp ){#ifdef HW3SOUND S_StartAttackSound(player->mo, sfx_dbcls);#else S_StartSound (player->mo, sfx_dbcls);#endif A_ReFire(player,psp);}mobj_t* braintargets[32];int numbraintargets;int braintargeton;void A_BrainAwake (mobj_t* mo){ thinker_t* thinker; mobj_t* m; // find all the target spots numbraintargets = 0; braintargeton = 0; thinker = thinkercap.next; for (thinker = thinkercap.next ; thinker != &thinkercap ; thinker = thinker->next) { if (thinker->function.acp1 != (actionf_p1)P_MobjThinker) continue; // not a mobj m = (mobj_t *)thinker; if (m->type == MT_BOSSTARGET ) { braintargets[numbraintargets] = m; numbraintargets++; } } S_StartSound (NULL,sfx_bossit);}void A_BrainPain (mobj_t* mo){ S_StartSound (NULL,sfx_bospn);}void A_BrainScream (mobj_t* mo){ int x; int y; int z; mobj_t* th; for (x=mo->x - 196*FRACUNIT ; x< mo->x + 320*FRACUNIT ; x+= FRACUNIT*8) { y = mo->y - 320*FRACUNIT; z = 128 + P_Random()*2*FRACUNIT; th = P_SpawnMobj (x,y,z, MT_ROCKET); th->momz = P_Random()*512; P_SetMobjState (th, S_BRAINEXPLODE1); th->tics -= P_Random()&7; if (th->tics < 1) th->tics = 1; } S_StartSound (NULL,sfx_bosdth);}void A_BrainExplode (mobj_t* mo){ int x; int y; int z; mobj_t* th; x = (P_SignedRandom()<<11)+mo->x; y = mo->y; z = 128 + P_Random()*2*FRACUNIT; th = P_SpawnMobj (x,y,z, MT_ROCKET); th->momz = P_Random()*512; P_SetMobjState (th, S_BRAINEXPLODE1); th->tics -= P_Random()&7; if (th->tics < 1) th->tics = 1;}void A_BrainDie (mobj_t* mo){ if(cv_allowexitlevel.value) G_ExitLevel ();}void A_BrainSpit (mobj_t* mo){ mobj_t* targ; mobj_t* newmobj; static int easy = 0; easy ^= 1; if (gameskill <= sk_easy && (!easy)) return; // shoot a cube at current target targ = braintargets[braintargeton]; braintargeton = (braintargeton+1)%numbraintargets; // spawn brain missile newmobj = P_SpawnMissile (mo, targ, MT_SPAWNSHOT); if(newmobj) { newmobj->target = targ; newmobj->reactiontime = ((targ->y - mo->y)/newmobj->momy) / newmobj->state->tics; } S_StartSound(NULL, sfx_bospit);}void A_SpawnFly (mobj_t* mo);// travelling cube soundvoid A_SpawnSound (mobj_t* mo){ S_StartSound (mo,sfx_boscub); A_SpawnFly(mo);}void A_SpawnFly (mobj_t* mo){ mobj_t* newmobj; mobj_t* fog; mobj_t* targ; int r; mobjtype_t type; if (--mo->reactiontime) return; // still flying targ = mo->target; // First spawn teleport fog. fog = P_SpawnMobj (targ->x, targ->y, targ->z, MT_SPAWNFIRE); S_StartSound (fog, sfx_telept); // Randomly select monster to spawn. r = P_Random (); // Probability distribution (kind of :), // decreasing likelihood. if ( r<50 ) type = MT_TROOP; else if (r<90) type = MT_SERGEANT; else if (r<120) type = MT_SHADOWS; else if (r<130) type = MT_PAIN; else if (r<160) type = MT_HEAD; else if (r<162) type = MT_VILE; else if (r<172) type = MT_UNDEAD; else if (r<192) type = MT_BABY; else if (r<222) type = MT_FATSO; else if (r<246) type = MT_KNIGHT; else type = MT_BRUISER; newmobj = P_SpawnMobj (targ->x, targ->y, targ->z, type); if (P_LookForPlayers (newmobj, true) ) P_SetMobjState (newmobj, newmobj->info->seestate); // telefrag anything in this spot P_TeleportMove (newmobj, newmobj->x, newmobj->y); // remove self (i.e., cube). P_RemoveMobj (mo);}void A_PlayerScream (mobj_t* mo){ // Default death sound. int sound = sfx_pldeth; if ( (gamemode == commercial) && (mo->health < -50)) { // IF THE PLAYER DIES // LESS THAN -50% WITHOUT GIBBING sound = sfx_pdiehi; }#ifdef HW3SOUND S_StartScreamSound(mo, sound);#else S_StartSound (mo, sound);#endif}#include "p_henemy.c"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -