📄 p_user.c
字号:
if(player->class == PCLASS_FIGHTER) { // The first type should be blue, and the third should be the // Fighter's original gold color if(playerNum == 0) { mo->flags |= 2<<MF_TRANSSHIFT; } else if(playerNum != 2) { mo->flags |= playerNum<<MF_TRANSSHIFT; } } else if(playerNum) { // Set color translation bits for player sprites mo->flags |= playerNum<<MF_TRANSSHIFT; } mo->angle = angle; mo->player = player; mo->reactiontime = 18; if(oldFlags2&MF2_FLY) { mo->flags2 |= MF2_FLY; mo->flags |= MF_NOGRAVITY; } player->morphTics = 0; player->health = mo->health = MAXHEALTH; player->mo = mo; player->class = PlayerClass[playerNum]; angle >>= ANGLETOFINESHIFT; fog = P_SpawnMobj(x+20*finecosine[angle], y+20*finesine[angle], z+TELEFOGHEIGHT, MT_TFOG); S_StartSound(fog, SFX_TELEPORT); P_PostMorphWeapon(player, weapon); return(true);}//----------------------------------------------------------------------------//// PROC P_PlayerThink////----------------------------------------------------------------------------void P_PlayerThink(player_t *player){ ticcmd_t *cmd; weapontype_t newweapon; int floorType; mobj_t *pmo; // No-clip cheat if(player->cheats&CF_NOCLIP) { player->mo->flags |= MF_NOCLIP; } else { player->mo->flags &= ~MF_NOCLIP; } cmd = &player->cmd; if(player->mo->flags&MF_JUSTATTACKED) { // Gauntlets attack auto forward motion cmd->angleturn = 0; cmd->forwardmove = 0xc800/512; cmd->sidemove = 0; player->mo->flags &= ~MF_JUSTATTACKED; }// messageTics is above the rest of the counters so that messages will // go away, even in death. player->messageTics--; // Can go negative if(!player->messageTics || player->messageTics == -1) { // Refresh the screen when a message goes away player->ultimateMessage = false; // clear out any chat messages. player->yellowMessage = false; if(player == &players[consoleplayer]) { BorderTopRefresh = true; } } player->worldTimer++; if(player->playerstate == PST_DEAD) { P_DeathThink(player); return; } if(player->jumpTics) { player->jumpTics--; } if(player->morphTics) { P_MorphPlayerThink(player); } // Handle movement if(player->mo->reactiontime) { // Player is frozen player->mo->reactiontime--; } else { P_MovePlayer(player); pmo = player->mo; if(player->powers[pw_speed] && !(leveltime&1) && P_AproxDistance(pmo->momx, pmo->momy) > 12*FRACUNIT) { mobj_t *speedMo; int playerNum; speedMo = P_SpawnMobj(pmo->x, pmo->y, pmo->z, MT_PLAYER_SPEED); if(speedMo) { speedMo->angle = pmo->angle; playerNum = P_GetPlayerNum(player); if(player->class == PCLASS_FIGHTER) { // The first type should be blue, and the // third should be the Fighter's original gold color if(playerNum == 0) { speedMo->flags |= 2<<MF_TRANSSHIFT; } else if(playerNum != 2) { speedMo->flags |= playerNum<<MF_TRANSSHIFT; } } else if(playerNum) { // Set color translation bits for player sprites speedMo->flags |= playerNum<<MF_TRANSSHIFT; } speedMo->target = pmo; speedMo->special1 = player->class; if(speedMo->special1 > 2) { speedMo->special1 = 0; } speedMo->sprite = pmo->sprite; speedMo->floorclip = pmo->floorclip; if(player == &players[consoleplayer]) { speedMo->flags2 |= MF2_DONTDRAW; } } } } P_CalcHeight(player); if(player->mo->subsector->sector->special) { P_PlayerInSpecialSector(player); } if((floorType = P_GetThingFloorType(player->mo)) != FLOOR_SOLID) { P_PlayerOnSpecialFlat(player, floorType); } switch(player->class) { case PCLASS_FIGHTER: if(player->mo->momz <= -35*FRACUNIT && player->mo->momz >= -40*FRACUNIT && !player->morphTics && !S_GetSoundPlayingInfo(player->mo, SFX_PLAYER_FIGHTER_FALLING_SCREAM)) { S_StartSound(player->mo, SFX_PLAYER_FIGHTER_FALLING_SCREAM); } break; case PCLASS_CLERIC: if(player->mo->momz <= -35*FRACUNIT && player->mo->momz >= -40*FRACUNIT && !player->morphTics && !S_GetSoundPlayingInfo(player->mo, SFX_PLAYER_CLERIC_FALLING_SCREAM)) { S_StartSound(player->mo, SFX_PLAYER_CLERIC_FALLING_SCREAM); } break; case PCLASS_MAGE: if(player->mo->momz <= -35*FRACUNIT && player->mo->momz >= -40*FRACUNIT && !player->morphTics && !S_GetSoundPlayingInfo(player->mo, SFX_PLAYER_MAGE_FALLING_SCREAM)) { S_StartSound(player->mo, SFX_PLAYER_MAGE_FALLING_SCREAM); } break; default: break; } if(cmd->arti) { // Use an artifact if((cmd->arti&AFLAG_JUMP) && onground && !player->jumpTics) { if(player->morphTics) { player->mo->momz = 6*FRACUNIT; } else { player->mo->momz = 9*FRACUNIT; } player->mo->flags2 &= ~MF2_ONMOBJ; player->jumpTics = 18; } else if(cmd->arti&AFLAG_SUICIDE) { P_DamageMobj(player->mo, NULL, NULL, 10000); } if(cmd->arti == NUMARTIFACTS) { // use one of each artifact (except puzzle artifacts) int i; for(i = 1; i < arti_firstpuzzitem; i++) { P_PlayerUseArtifact(player, i); } } else { P_PlayerUseArtifact(player, cmd->arti&AFLAG_MASK); } } // Check for weapon change if(cmd->buttons&BT_SPECIAL) { // A special event has no other buttons cmd->buttons = 0; } if(cmd->buttons&BT_CHANGE && !player->morphTics) { // The actual changing of the weapon is done when the weapon // psprite can do it (A_WeaponReady), so it doesn't happen in // the middle of an attack. newweapon = (cmd->buttons&BT_WEAPONMASK)>>BT_WEAPONSHIFT; if(player->weaponowned[newweapon] && newweapon != player->readyweapon) { player->pendingweapon = newweapon; } } // Check for use if(cmd->buttons&BT_USE) { if(!player->usedown) { P_UseLines(player); player->usedown = true; } } else { player->usedown = false; } // Morph counter if(player->morphTics) { if(!--player->morphTics) { // Attempt to undo the pig P_UndoPlayerMorph(player); } } // Cycle psprites P_MovePsprites(player); // Other Counters if(player->powers[pw_invulnerability]) { if(player->class == PCLASS_CLERIC) { if(!(leveltime&7) && player->mo->flags&MF_SHADOW && !(player->mo->flags2&MF2_DONTDRAW)) { player->mo->flags &= ~MF_SHADOW; if(!(player->mo->flags&MF_ALTSHADOW)) { player->mo->flags2 |= MF2_DONTDRAW|MF2_NONSHOOTABLE; } } if(!(leveltime&31)) { if(player->mo->flags2&MF2_DONTDRAW) { if(!(player->mo->flags&MF_SHADOW)) { player->mo->flags |= MF_SHADOW|MF_ALTSHADOW; } else { player->mo->flags2 &= ~(MF2_DONTDRAW|MF2_NONSHOOTABLE); } } else { player->mo->flags |= MF_SHADOW; player->mo->flags &= ~MF_ALTSHADOW; } } } if(!(--player->powers[pw_invulnerability])) { player->mo->flags2 &= ~(MF2_INVULNERABLE|MF2_REFLECTIVE); if(player->class == PCLASS_CLERIC) { player->mo->flags2 &= ~(MF2_DONTDRAW|MF2_NONSHOOTABLE); player->mo->flags &= ~(MF_SHADOW|MF_ALTSHADOW); } } } if(player->powers[pw_minotaur]) { player->powers[pw_minotaur]--; } if(player->powers[pw_infrared]) { player->powers[pw_infrared]--; } if(player->powers[pw_flight] && netgame) { if(!--player->powers[pw_flight]) { if(player->mo->z != player->mo->floorz) {#ifdef __WATCOMC__ if(!useexterndriver) { player->centering = true; }#else player->centering = true;#endif } player->mo->flags2 &= ~MF2_FLY; player->mo->flags &= ~MF_NOGRAVITY; BorderTopRefresh = true; //make sure the sprite's cleared out } } if(player->powers[pw_speed]) { player->powers[pw_speed]--; } if(player->damagecount) { player->damagecount--; } if(player->bonuscount) { player->bonuscount--; } if(player->poisoncount && !(leveltime&15)) { player->poisoncount -= 5; if(player->poisoncount < 0) { player->poisoncount = 0; } P_PoisonDamage(player, player->poisoner, 1, true); } // Colormaps// if(player->powers[pw_invulnerability])// {// if(player->powers[pw_invulnerability] > BLINKTHRESHOLD// || (player->powers[pw_invulnerability]&8))// {// player->fixedcolormap = INVERSECOLORMAP;// }// else// {// player->fixedcolormap = 0;// }// }// else if(player->powers[pw_infrared]) { if (player->powers[pw_infrared] <= BLINKTHRESHOLD) { if(player->powers[pw_infrared]&8) { player->fixedcolormap = 0; } else { player->fixedcolormap = 1; } } else if(!(leveltime&16) && player == &players[consoleplayer]) { if(newtorch) { if(player->fixedcolormap+newtorchdelta > 7 || player->fixedcolormap+newtorchdelta < 1 || newtorch == player->fixedcolormap) { newtorch = 0; } else { player->fixedcolormap += newtorchdelta; } } else { newtorch = (M_Random()&7)+1; newtorchdelta = (newtorch == player->fixedcolormap) ? 0 : ((newtorch > player->fixedcolormap) ? 1 : -1); } } } else { player->fixedcolormap = 0; }}//----------------------------------------------------------------------------//// PROC P_ArtiTele////----------------------------------------------------------------------------void P_ArtiTele(player_t *player){ int i; int selections; fixed_t destX; fixed_t destY; angle_t destAngle; if(deathmatch) { selections = deathmatch_p-deathmatchstarts; i = P_Random()%selections; destX = deathmatchstarts[i].x<<FRACBITS; destY = deathmatchstarts[i].y<<FRACBITS; destAngle = ANG45*(deathmatchstarts[i].angle/45); } else { destX = playerstarts[0][0].x<<FRACBITS; destY = playerstarts[0][0].y<<FRACBITS; destAngle = ANG45*(playerstarts[0][0].angle/45); } P_Teleport(player->mo, destX, destY, destAngle, true); if(player->morphTics) { // Teleporting away will undo any morph effects (pig) P_UndoPlayerMorph(player); } //S_StartSound(NULL, sfx_wpnup); // Full volume laugh}//----------------------------------------------------------------------------//// PROC P_ArtiTeleportOther////----------------------------------------------------------------------------void P_ArtiTeleportOther(player_t *player){ mobj_t *mo; mo=P_SpawnPlayerMissile(player->mo, MT_TELOTHER_FX1); if (mo) { mo->target = player->mo; }}void P_TeleportToPlayerStarts(mobj_t *victim){ int i,selections=0; fixed_t destX,destY; angle_t destAngle; for (i=0;i<MAXPLAYERS;i++) { if (!playeringame[i]) continue; selections++; } i = P_Random()%selections; destX = playerstarts[0][i].x<<FRACBITS; destY = playerstarts[0][i].y<<FRACBITS; destAngle = ANG45*(playerstarts[0][i].angle/45); P_Teleport(victim, destX, destY, destAngle, true); //S_StartSound(NULL, sfx_wpnup); // Full volume laugh}void P_TeleportToDeathmatchStarts(mobj_t *victim){ int i,selections; fixed_t destX,destY; angle_t destAngle; selections = deathmatch_p-deathmatchstarts; if (selections) { i = P_Random()%selections; destX = deathmatchstarts[i].x<<FRACBITS; destY = deathmatchstarts[i].y<<FRACBITS; destAngle = ANG45*(deathmatchstarts[i].angle/45); P_Teleport(victim, destX, destY, destAngle, true); //S_StartSound(NULL, sfx_wpnup); // Full volume laugh } else { P_TeleportToPlayerStarts(victim); }}//----------------------------------------------------------------------------//// PROC P_TeleportOther////----------------------------------------------------------------------------void P_TeleportOther(mobj_t *victim){ if (victim->player) { if (deathmatch) P_TeleportToDeathmatchStarts(victim); else P_TeleportToPlayerStarts(victim); } else { // If death action, run it upon teleport if (victim->flags&MF_COUNTKILL && victim->special) { P_RemoveMobjFromTIDList(victim); P_ExecuteLineSpecial(victim->special, victim->args, NULL, 0, victim); victim->special = 0; } // Send all monsters to deathmatch spots P_TeleportToDeathmatchStarts(victim); }}#define BLAST_RADIUS_DIST 255*FRACUNIT#define BLAST_SPEED 20*FRACUNIT#define BLAST_FULLSTRENGTH 255void ResetBlasted(mobj_t *mo){ mo->flags2 &= ~MF2_BLASTED; if (!(mo->flags&MF_ICECORPSE)) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -