⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p_inter.c

📁 The source code of Doom legacy for windows
💻 C
📖 第 1 页 / 共 5 页
字号:
        if(player->mo->z <= player->mo->floorz)        {            player->flyheight = 10; // thrust the player in the air a bit        }        return(true);    }    if (power == pw_infrared)    {        // Already have it        if(player->powers[power] > BLINKTHRESHOLD)            return(false);        player->powers[power] = INFRATICS;        return true;    }    if (power == pw_ironfeet)    {        player->powers[power] = IRONTICS;        return true;    }    if (power == pw_strength)    {        P_GiveBody (player, 100);        player->powers[power] = 1;        return true;    }    if (player->powers[power])        return false;   // already got it    player->powers[power] = 1;    return true;}// Boris stuff : dehacked patches hackint max_armor=200;int green_armor_class=1;int blue_armor_class=2;int maxsoul=200;int soul_health=100;int mega_health=200;// eof Boris//---------------------------------------------------------------------------//// FUNC P_GiveArtifact//// Returns true if artifact accepted.////---------------------------------------------------------------------------boolean P_GiveArtifact(player_t *player, artitype_t arti, mobj_t *mo){    int i;        i = 0;    while(player->inventory[i].type != arti && i < player->inventorySlotNum)    {        i++;    }    if(i == player->inventorySlotNum)    {        player->inventory[i].count = 1;        player->inventory[i].type = arti;        player->inventorySlotNum++;    }    else    {        if(player->inventory[i].count >= MAXARTECONT)        { // Player already has 16 of this item            return(false);        }        player->inventory[i].count++;    }    if( player->inventory[player->inv_ptr].count == 0 )        player->inv_ptr = i;    if(mo && (mo->flags&MF_COUNTITEM))    {        player->itemcount++;    }    return(true);}//---------------------------------------------------------------------------//// PROC P_SetDormantArtifact//// Removes the MF_SPECIAL flag, and initiates the artifact pickup// animation.////---------------------------------------------------------------------------void P_SetDormantArtifact(mobj_t *arti){        arti->flags &= ~MF_SPECIAL;        if(cv_deathmatch.value && (arti->type != MT_ARTIINVULNERABILITY)                && (arti->type != MT_ARTIINVISIBILITY))        {                P_SetMobjState(arti, S_DORMANTARTI1);        }        else        { // Don't respawn                P_SetMobjState(arti, S_DEADARTI1);        }        S_StartSound(arti, sfx_artiup);}//---------------------------------------------------------------------------//// PROC A_RestoreArtifact////---------------------------------------------------------------------------void A_RestoreArtifact(mobj_t *arti){        arti->flags |= MF_SPECIAL;        P_SetMobjState(arti, arti->info->spawnstate);        S_StartSound(arti, sfx_itmbk);}//----------------------------------------------------------------------------//// PROC P_HideSpecialThing////----------------------------------------------------------------------------void P_HideSpecialThing(mobj_t *thing){        thing->flags &= ~MF_SPECIAL;        thing->flags2 |= MF2_DONTDRAW;        P_SetMobjState(thing, S_HIDESPECIAL1);}//---------------------------------------------------------------------------//// PROC A_RestoreSpecialThing1//// Make a special thing visible again.////---------------------------------------------------------------------------void A_RestoreSpecialThing1(mobj_t *thing){        if(thing->type == MT_WMACE)        { // Do random mace placement                P_RepositionMace(thing);        }        thing->flags2 &= ~MF2_DONTDRAW;        S_StartSound(thing, sfx_itmbk);}//---------------------------------------------------------------------------//// PROC A_RestoreSpecialThing2////---------------------------------------------------------------------------void A_RestoreSpecialThing2(mobj_t *thing){        thing->flags |= MF_SPECIAL;        P_SetMobjState(thing, thing->info->spawnstate);}//----------------------------------------------------------------------------//// PROC A_HideThing////----------------------------------------------------------------------------void A_HideThing(mobj_t *actor){        //P_UnsetThingPosition(actor);        actor->flags2 |= MF2_DONTDRAW;}//----------------------------------------------------------------------------//// PROC A_UnHideThing////----------------------------------------------------------------------------void A_UnHideThing(mobj_t *actor){        //P_SetThingPosition(actor);        actor->flags2 &= ~MF2_DONTDRAW;}//// P_TouchSpecialThing//void P_TouchSpecialThing ( mobj_t*       special,                           mobj_t*       toucher ){                      player_t*   player;    int         i;    fixed_t     delta;    int         sound;    delta = special->z - toucher->z;    //SoM: 3/27/2000: For some reason, the old code allowed the player to    //grab items that were out of reach...    if (delta > toucher->height        || delta < -special->height)    {        // out of reach        return;    }    // Dead thing touching.    // Can happen with a sliding player corpse.    if (toucher->health <= 0 || toucher->flags&MF_CORPSE)        return;    sound = sfx_itemup;    player = toucher->player;#ifdef PARANOIA    if( !player )        I_Error("P_TouchSpecialThing: without player\n");#endif    // Identify by sprite.    switch (special->sprite)    {      case SPR_SHLD: // Item_Shield1        // armor      case SPR_ARM1:        if (!P_GiveArmor (player, green_armor_class))            return;        player->message = GOTARMOR;        break;      case SPR_SHD2: // Item_Shield2      case SPR_ARM2:        if (!P_GiveArmor (player, blue_armor_class))            return;        player->message = GOTMEGA;        break;        // bonus items      case SPR_BON1:        player->health++;               // can go over 100%        if (player->health > 2*MAXHEALTH)            player->health = 2*MAXHEALTH;        player->mo->health = player->health;        if(cv_showmessages.value==1)            player->message = GOTHTHBONUS;        break;      case SPR_BON2:        player->armorpoints++;          // can go over 100%        if (player->armorpoints > max_armor)            player->armorpoints = max_armor;        if (!player->armortype)            player->armortype = 1;        if(cv_showmessages.value==1)           player->message = GOTARMBONUS;        break;      case SPR_SOUL:        player->health += soul_health;        if (player->health > maxsoul)            player->health = maxsoul;        player->mo->health = player->health;        player->message = GOTSUPER;        sound = sfx_getpow;        break;      case SPR_MEGA:        if (gamemode != commercial)            return;        player->health = mega_health;        player->mo->health = player->health;        P_GiveArmor (player,2);        player->message = GOTMSPHERE;        sound = sfx_getpow;        break;        // cards        // leave cards for everyone      case SPR_BKYY: // Key_Blue      case SPR_BKEY:        if( P_GiveCard (player, it_bluecard) )        {            player->message = GOTBLUECARD;            if( gamemode == heretic ) sound = sfx_keyup;        }        if (!multiplayer)            break;        return;      case SPR_CKYY: // Key_Yellow      case SPR_YKEY:        if( P_GiveCard (player, it_yellowcard) )        {            player->message = GOTYELWCARD;            if( gamemode == heretic ) sound = sfx_keyup;        }        if (!multiplayer)            break;        return;      case SPR_AKYY: // Key_Green      case SPR_RKEY:        if (P_GiveCard (player, it_redcard))        {            player->message = GOTREDCARD;            if( gamemode == heretic ) sound = sfx_keyup;        }        if (!multiplayer)            break;        return;      case SPR_BSKU:        if (P_GiveCard (player, it_blueskull))        {            player->message = GOTBLUESKUL;            if( gamemode == heretic ) sound = sfx_keyup;        }        if (!multiplayer)            break;        return;      case SPR_YSKU:        if (P_GiveCard (player, it_yellowskull))        {            player->message = GOTYELWSKUL;            if( gamemode == heretic ) sound = sfx_keyup;        }        if (!multiplayer)            break;        return;      case SPR_RSKU:        if (P_GiveCard (player, it_redskull))        {            player->message = GOTREDSKULL;            if( gamemode == heretic ) sound = sfx_keyup;        }        if (!multiplayer)            break;        return;        // medikits, heals      case SPR_PTN1: // Item_HealingPotion      case SPR_STIM:        if (!P_GiveBody (player, 10))            return;        if(cv_showmessages.value==1)            player->message = GOTSTIM;        break;      case SPR_MEDI:        if (!P_GiveBody (player, 25))            return;        if(cv_showmessages.value==1)        {            if (player->health < 25)                player->message = GOTMEDINEED;            else                player->message = GOTMEDIKIT;        }        break;        // heretic Artifacts :      case SPR_PTN2: // Arti_HealingPotion          if(P_GiveArtifact(player, arti_health, special))          {              if( cv_showmessages.value==1 )                  P_SetMessage(player, TXT_ARTIHEALTH, false);                            P_SetDormantArtifact(special);          }          return;      case SPR_SOAR: // Arti_Fly          if(P_GiveArtifact(player, arti_fly, special))          {              P_SetMessage(player, TXT_ARTIFLY, false);              P_SetDormantArtifact(special);          }          return;      case SPR_INVU: // Arti_Invulnerability          if(P_GiveArtifact(player, arti_invulnerability, special))          {              P_SetMessage(player, TXT_ARTIINVULNERABILITY, false);              P_SetDormantArtifact(special);          }          return;      case SPR_PWBK: // Arti_TomeOfPower          if(P_GiveArtifact(player, arti_tomeofpower, special))          {              P_SetMessage(player, TXT_ARTITOMEOFPOWER, false);              P_SetDormantArtifact(special);          }          return;      case SPR_INVS: // Arti_Invisibility          if(P_GiveArtifact(player, arti_invisibility, special))          {              P_SetMessage(player, TXT_ARTIINVISIBILITY, false);              P_SetDormantArtifact(special);          }          return;      case SPR_EGGC: // Arti_Egg          if(P_GiveArtifact(player, arti_egg, special))          {              P_SetMessage(player, TXT_ARTIEGG, false);              P_SetDormantArtifact(special);          }          return;      case SPR_SPHL: // Arti_SuperHealth          if(P_GiveArtifact(player, arti_superhealth, special))          {              P_SetMessage(player, TXT_ARTISUPERHEALTH, false);              P_SetDormantArtifact(special);          }          return;      case SPR_TRCH: // Arti_Torch          if(P_GiveArtifact(player, arti_torch, special))          {              P_SetMessage(player, TXT_ARTITORCH, false);              P_SetDormantArtifact(special);          }          return;      case SPR_FBMB: // Arti_FireBomb          if(P_GiveArtifact(player, arti_firebomb, special))          {              P_SetMessage(player, TXT_ARTIFIREBOMB, false);              P_SetDormantArtifact(special);          }          return;      case SPR_ATLP: // Arti_Teleport          if(P_GiveArtifact(player, arti_teleport, special))          {              P_SetMessage(player, TXT_ARTITELEPORT, false);              P_SetDormantArtifact(special);          }          return;        // power ups      case SPR_PINV:        if (!P_GivePower (player, pw_invulnerability))            return;        player->message = GOTINVUL;        sound = sfx_getpow;        break;      case SPR_PSTR:        if (!P_GivePower (player, pw_strength))            return;        player->message = GOTBERSERK;        if (player->readyweapon != wp_fist)            player->pendingweapon = wp_fist;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -