📄 p_hpspr.c
字号:
// Emacs style mode select -*- C++ -*- //-----------------------------------------------------------------------------//// $Id: p_hpspr.c,v 1.2 2001/02/24 13:35:20 bpereira Exp $//// Copyright (C) 1993-1996 by Raven Software, Corp.// Portions Copyright (C) 1998-2000 by DooM Legacy Team.//// This program is free software; you can redistribute it and/or// modify it under the terms of the GNU General Public License// as published by the Free Software Foundation; either version 2// of the License, or (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.////// $Log: p_hpspr.c,v $// Revision 1.2 2001/02/24 13:35:20 bpereira// no message//////// DESCRIPTION:// this file is include by P_pspr.c// it contain all heretic player sprite specific////-----------------------------------------------------------------------------// P_pspr.c/*#include "doomdef.h"#include "g_game.h"#include "p_local.h"#include "r_main.h"#include "r_state.h"#include "s_sound.h"#include "m_random.h"*/// Macros#define LOWERSPEED FRACUNIT*6#define RAISESPEED FRACUNIT*6#define WEAPONBOTTOM 128*FRACUNIT#define WEAPONTOP 32*FRACUNIT#define MAGIC_JUNK 1234#define MAX_MACE_SPOTS 8mobjtype_t PuffType;static int MaceSpotCount;static struct{ fixed_t x; fixed_t y;} MaceSpots[MAX_MACE_SPOTS];fixed_t bulletslope;weaponinfo_t wpnlev1info[NUMWEAPONS] ={ { // Staff am_noammo, // ammo 0, S_STAFFUP, // upstate S_STAFFDOWN, // downstate S_STAFFREADY, // readystate S_STAFFATK1_1, // atkstate S_STAFFATK1_1, // holdatkstate S_NULL // flashstate }, { // Gold wand am_goldwand, // ammo USE_GWND_AMMO_1, S_GOLDWANDUP, // upstate S_GOLDWANDDOWN, // downstate S_GOLDWANDREADY, // readystate S_GOLDWANDATK1_1, // atkstate S_GOLDWANDATK1_1, // holdatkstate S_NULL // flashstate }, { // Crossbow am_crossbow, // ammo USE_CBOW_AMMO_1, S_CRBOWUP, // upstate S_CRBOWDOWN, // downstate S_CRBOW1, // readystate S_CRBOWATK1_1, // atkstate S_CRBOWATK1_1, // holdatkstate S_NULL // flashstate }, { // Blaster am_blaster, // ammo USE_BLSR_AMMO_1, S_BLASTERUP, // upstate S_BLASTERDOWN, // downstate S_BLASTERREADY, // readystate S_BLASTERATK1_1, // atkstate S_BLASTERATK1_3, // holdatkstate S_NULL // flashstate }, { // Skull rod am_skullrod, // ammo USE_SKRD_AMMO_1, S_HORNRODUP, // upstate S_HORNRODDOWN, // downstate S_HORNRODREADY, // readystae S_HORNRODATK1_1, // atkstate S_HORNRODATK1_1, // holdatkstate S_NULL // flashstate }, { // Phoenix rod am_phoenixrod, // ammo USE_PHRD_AMMO_1, S_PHOENIXUP, // upstate S_PHOENIXDOWN, // downstate S_PHOENIXREADY, // readystate S_PHOENIXATK1_1, // atkstate S_PHOENIXATK1_1, // holdatkstate S_NULL // flashstate }, { // Mace am_mace, // ammo USE_MACE_AMMO_1, S_MACEUP, // upstate S_MACEDOWN, // downstate S_MACEREADY, // readystate S_MACEATK1_1, // atkstate S_MACEATK1_2, // holdatkstate S_NULL // flashstate }, { // Gauntlets am_noammo, // ammo 0, S_GAUNTLETUP, // upstate S_GAUNTLETDOWN, // downstate S_GAUNTLETREADY, // readystate S_GAUNTLETATK1_1, // atkstate S_GAUNTLETATK1_3, // holdatkstate S_NULL // flashstate }, { // Beak am_noammo, // ammo 0, S_BEAKUP, // upstate S_BEAKDOWN, // downstate S_BEAKREADY, // readystate S_BEAKATK1_1, // atkstate S_BEAKATK1_1, // holdatkstate S_NULL // flashstate }};weaponinfo_t wpnlev2info[NUMWEAPONS] ={ { // Staff am_noammo, // ammo 0, S_STAFFUP2, // upstate S_STAFFDOWN2, // downstate S_STAFFREADY2_1, // readystate S_STAFFATK2_1, // atkstate S_STAFFATK2_1, // holdatkstate S_NULL // flashstate }, { // Gold wand am_goldwand, // ammo USE_GWND_AMMO_2, S_GOLDWANDUP, // upstate S_GOLDWANDDOWN, // downstate S_GOLDWANDREADY, // readystate S_GOLDWANDATK2_1, // atkstate S_GOLDWANDATK2_1, // holdatkstate S_NULL // flashstate }, { // Crossbow am_crossbow, // ammo USE_CBOW_AMMO_2, S_CRBOWUP, // upstate S_CRBOWDOWN, // downstate S_CRBOW1, // readystate S_CRBOWATK2_1, // atkstate S_CRBOWATK2_1, // holdatkstate S_NULL // flashstate }, { // Blaster am_blaster, // ammo USE_BLSR_AMMO_2, S_BLASTERUP, // upstate S_BLASTERDOWN, // downstate S_BLASTERREADY, // readystate S_BLASTERATK2_1, // atkstate S_BLASTERATK2_3, // holdatkstate S_NULL // flashstate }, { // Skull rod am_skullrod, // ammo USE_SKRD_AMMO_2, S_HORNRODUP, // upstate S_HORNRODDOWN, // downstate S_HORNRODREADY, // readystae S_HORNRODATK2_1, // atkstate S_HORNRODATK2_1, // holdatkstate S_NULL // flashstate }, { // Phoenix rod am_phoenixrod, // ammo USE_PHRD_AMMO_2, S_PHOENIXUP, // upstate S_PHOENIXDOWN, // downstate S_PHOENIXREADY, // readystate S_PHOENIXATK2_1, // atkstate S_PHOENIXATK2_2, // holdatkstate S_NULL // flashstate }, { // Mace am_mace, // ammo USE_MACE_AMMO_2, S_MACEUP, // upstate S_MACEDOWN, // downstate S_MACEREADY, // readystate S_MACEATK2_1, // atkstate S_MACEATK2_1, // holdatkstate S_NULL // flashstate }, { // Gauntlets am_noammo, // ammo 0, S_GAUNTLETUP2, // upstate S_GAUNTLETDOWN2, // downstate S_GAUNTLETREADY2_1, // readystate S_GAUNTLETATK2_1, // atkstate S_GAUNTLETATK2_3, // holdatkstate S_NULL // flashstate }, { // Beak am_noammo, // ammo 0, S_BEAKUP, // upstate S_BEAKDOWN, // downstate S_BEAKREADY, // readystate S_BEAKATK2_1, // atkstate S_BEAKATK2_1, // holdatkstate S_NULL // flashstate }};//---------------------------------------------------------------------------//// PROC P_OpenWeapons//// Called at level load before things are loaded.////---------------------------------------------------------------------------void P_OpenWeapons(void){ MaceSpotCount = 0;}//---------------------------------------------------------------------------//// PROC P_AddMaceSpot////---------------------------------------------------------------------------void P_AddMaceSpot(mapthing_t *mthing){ if(MaceSpotCount == MAX_MACE_SPOTS) { I_Error("Too many mace spots."); } MaceSpots[MaceSpotCount].x = mthing->x<<FRACBITS; MaceSpots[MaceSpotCount].y = mthing->y<<FRACBITS; MaceSpotCount++;}//---------------------------------------------------------------------------//// PROC P_RepositionMace//// Chooses the next spot to place the mace.////---------------------------------------------------------------------------void P_RepositionMace(mobj_t *mo){ int spot; subsector_t *ss; P_UnsetThingPosition(mo); spot = P_Random()%MaceSpotCount; mo->x = MaceSpots[spot].x; mo->y = MaceSpots[spot].y; ss = R_PointInSubsector(mo->x, mo->y); mo->z = mo->floorz = ss->sector->floorheight; mo->ceilingz = ss->sector->ceilingheight; P_SetThingPosition(mo);}//---------------------------------------------------------------------------//// PROC P_CloseWeapons//// Called at level load after things are loaded.////---------------------------------------------------------------------------void P_CloseWeapons(void){ int spot; if(!MaceSpotCount) { // No maces placed return; } if(!cv_deathmatch.value && P_Random() < 64) { // Sometimes doesn't show up if not in deathmatch return; } spot = P_Random()%MaceSpotCount; P_SpawnMobj(MaceSpots[spot].x, MaceSpots[spot].y, ONFLOORZ, MT_WMACE);}//---------------------------------------------------------------------------//// PROC P_ActivateBeak////---------------------------------------------------------------------------void P_ActivateBeak(player_t *player){ player->pendingweapon = wp_nochange; player->readyweapon = wp_beak; player->psprites[ps_weapon].sy = WEAPONTOP; P_SetPsprite(player, ps_weapon, S_BEAKREADY);}//---------------------------------------------------------------------------//// PROC P_PostChickenWeapon////---------------------------------------------------------------------------void P_PostChickenWeapon(player_t *player, weapontype_t weapon){ if(weapon == wp_beak) { // Should never happen weapon = wp_staff; } player->pendingweapon = wp_nochange; player->readyweapon = weapon; player->psprites[ps_weapon].sy = WEAPONBOTTOM; P_SetPsprite(player, ps_weapon, wpnlev1info[weapon].upstate);}//---------------------------------------------------------------------------//// PROC P_UpdateBeak////---------------------------------------------------------------------------void P_UpdateBeak(player_t *player, pspdef_t *psp){ psp->sy = WEAPONTOP+(player->chickenPeck<<(FRACBITS-1));}//---------------------------------------------------------------------------//// PROC A_BeakReady////---------------------------------------------------------------------------void A_BeakReady(player_t *player, pspdef_t *psp){ if(player->cmd.buttons&BT_ATTACK) { // Chicken beak attack player->attackdown = true; P_SetMobjState(player->mo, S_CHICPLAY_ATK1); if(player->powers[pw_weaponlevel2]) { P_SetPsprite(player, ps_weapon, S_BEAKATK2_1); } else { P_SetPsprite(player, ps_weapon, S_BEAKATK1_1); } P_NoiseAlert(player->mo, player->mo); } else { if(player->mo->state == &states[S_CHICPLAY_ATK1]) { // Take out of attack state P_SetMobjState(player->mo, S_CHICPLAY); } player->attackdown = false; }}//---------------------------------------------------------------------------//// PROC A_BeakRaise////---------------------------------------------------------------------------void A_BeakRaise(player_t *player, pspdef_t *psp){ psp->sy = WEAPONTOP; P_SetPsprite(player, ps_weapon, wpnlev1info[player->readyweapon].readystate);}//****************************************************************************//// WEAPON ATTACKS////****************************************************************************//----------------------------------------------------------------------------//// PROC A_BeakAttackPL1////----------------------------------------------------------------------------void A_BeakAttackPL1(player_t *player, pspdef_t *psp){ angle_t angle; int damage; int slope; damage = 1+(P_Random()&3); angle = player->mo->angle; slope = P_AimLineAttack(player->mo, angle, MELEERANGE);// PuffType = MT_BEAKPUFF; P_LineAttack(player->mo, angle, MELEERANGE, slope, damage); if(linetarget) { player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, linetarget->x, linetarget->y); } S_StartSound(player->mo, sfx_chicpk1+(P_Random()%3)); player->chickenPeck = 12; psp->tics -= P_Random()&7;}//----------------------------------------------------------------------------//// PROC A_BeakAttackPL2////----------------------------------------------------------------------------void A_BeakAttackPL2(player_t *player, pspdef_t *psp){ angle_t angle; int damage; int slope; damage = HITDICE(4); angle = player->mo->angle; slope = P_AimLineAttack(player->mo, angle, MELEERANGE); PuffType = MT_BEAKPUFF; P_LineAttack(player->mo, angle, MELEERANGE, slope, damage); if(linetarget) { player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, linetarget->x, linetarget->y); } S_StartSound(player->mo, sfx_chicpk1+(P_Random()%3)); player->chickenPeck = 12; psp->tics -= P_Random()&3;}//----------------------------------------------------------------------------//// PROC A_StaffAttackPL1////----------------------------------------------------------------------------void A_StaffAttackPL1(player_t *player, pspdef_t *psp){ angle_t angle; int damage; int slope; damage = 5+(P_Random()&15); angle = player->mo->angle; angle += P_SignedRandom()<<18; slope = P_AimLineAttack(player->mo, angle, MELEERANGE); PuffType = MT_STAFFPUFF; P_LineAttack(player->mo, angle, MELEERANGE, slope, damage);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -