2008-01-27 11:25:03 +00:00
|
|
|
/*
|
|
|
|
** thingdef.cpp
|
|
|
|
**
|
|
|
|
** Code pointers for Actor definitions
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
** Copyright 2002-2006 Christoph Oelckers
|
|
|
|
** Copyright 2004-2006 Randy Heit
|
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
** 4. When not used as part of ZDoom or a ZDoom derivative, this code will be
|
|
|
|
** covered by 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 SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gi.h"
|
|
|
|
#include "actor.h"
|
|
|
|
#include "info.h"
|
|
|
|
#include "sc_man.h"
|
|
|
|
#include "tarray.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
#include "templates.h"
|
|
|
|
#include "r_defs.h"
|
|
|
|
#include "r_draw.h"
|
|
|
|
#include "a_pickups.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "cmdlib.h"
|
|
|
|
#include "p_lnspec.h"
|
|
|
|
#include "p_enemy.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "decallib.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "autosegs.h"
|
|
|
|
#include "i_system.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "c_console.h"
|
|
|
|
#include "doomerrors.h"
|
|
|
|
#include "a_sharedglobal.h"
|
|
|
|
#include "a_doomglobal.h"
|
|
|
|
#include "thingdef/thingdef.h"
|
|
|
|
#include "v_video.h"
|
|
|
|
|
|
|
|
|
|
|
|
static FRandom pr_camissile ("CustomActorfire");
|
|
|
|
static FRandom pr_camelee ("CustomMelee");
|
|
|
|
static FRandom pr_cabullet ("CustomBullet");
|
|
|
|
static FRandom pr_cajump ("CustomJump");
|
|
|
|
static FRandom pr_cwbullet ("CustomWpBullet");
|
|
|
|
static FRandom pr_cwjump ("CustomWpJump");
|
|
|
|
static FRandom pr_cwpunch ("CustomWpPunch");
|
|
|
|
static FRandom pr_grenade ("ThrowGrenade");
|
|
|
|
static FRandom pr_crailgun ("CustomRailgun");
|
|
|
|
static FRandom pr_spawndebris ("SpawnDebris");
|
|
|
|
static FRandom pr_spawnitemex ("SpawnItemEx");
|
|
|
|
static FRandom pr_burst ("Burst");
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// ACustomInventory :: CallStateChain
|
|
|
|
//
|
|
|
|
// Executes the code pointers in a chain of states
|
|
|
|
// until there is no next state
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
bool ACustomInventory::CallStateChain (AActor *actor, FState * State)
|
|
|
|
{
|
|
|
|
StateCallData StateCall;
|
|
|
|
bool result = false;
|
|
|
|
int counter = 0;
|
|
|
|
|
|
|
|
StateCall.Item = this;
|
|
|
|
while (State != NULL)
|
|
|
|
{
|
|
|
|
// Assume success. The code pointer will set this to false if necessary
|
2008-08-12 23:22:08 +00:00
|
|
|
StateCall.State = State;
|
|
|
|
StateCall.Result = true;
|
2008-08-14 11:28:02 +00:00
|
|
|
if (State->CallAction(actor, &StateCall))
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
// collect all the results. Even one successful call signifies overall success.
|
|
|
|
result |= StateCall.Result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Since there are no delays it is a good idea to check for infinite loops here!
|
|
|
|
counter++;
|
|
|
|
if (counter >= 10000) break;
|
|
|
|
|
|
|
|
if (StateCall.State == State)
|
|
|
|
{
|
|
|
|
// Abort immediately if the state jumps to itself!
|
|
|
|
if (State == State->GetNextState())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If both variables are still the same there was no jump
|
|
|
|
// so we must advance to the next state.
|
|
|
|
State = State->GetNextState();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
State = StateCall.State;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Simple flag changers
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 08:00:28 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SetSolid)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
self->flags |= MF_SOLID;
|
|
|
|
}
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_UnsetSolid)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
self->flags &= ~MF_SOLID;
|
|
|
|
}
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SetFloat)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
self->flags |= MF_FLOAT;
|
|
|
|
}
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_UnsetFloat)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
self->flags &= ~(MF_FLOAT|MF_INFLOAT);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Customizable attack functions which use actor parameters.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
static void DoAttack (AActor *self, bool domelee, bool domissile,
|
|
|
|
int MeleeDamage, FSoundID MeleeSound, const PClass *MissileType,fixed_t MissileHeight)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
if (self->target == NULL) return;
|
|
|
|
|
|
|
|
A_FaceTarget (self);
|
|
|
|
if (domelee && MeleeDamage>0 && self->CheckMeleeRange ())
|
|
|
|
{
|
|
|
|
int damage = pr_camelee.HitDice(MeleeDamage);
|
2008-06-15 17:17:31 +00:00
|
|
|
if (MeleeSound) S_Sound (self, CHAN_WEAPON, MeleeSound, 1, ATTN_NORM);
|
2008-01-27 11:25:03 +00:00
|
|
|
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
|
|
|
|
P_TraceBleed (damage, self->target, self);
|
|
|
|
}
|
2008-08-12 23:22:08 +00:00
|
|
|
else if (domissile && MissileType != NULL)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 23:22:08 +00:00
|
|
|
// This seemingly senseless code is needed for proper aiming.
|
|
|
|
self->z+=MissileHeight-32*FRACUNIT;
|
|
|
|
AActor * missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, self, self->target, MissileType, false);
|
|
|
|
self->z-=MissileHeight-32*FRACUNIT;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
if (missile)
|
|
|
|
{
|
|
|
|
// automatic handling of seeker missiles
|
|
|
|
if (missile->flags2&MF2_SEEKERMISSILE)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 23:22:08 +00:00
|
|
|
missile->tracer=self->target;
|
|
|
|
}
|
|
|
|
// set the health value so that the missile works properly
|
|
|
|
if (missile->flags4&MF4_SPECTRAL)
|
|
|
|
{
|
|
|
|
missile->health=-2;
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
2008-08-12 23:22:08 +00:00
|
|
|
P_CheckMissileSpawn(missile);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MeleeAttack)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 23:22:08 +00:00
|
|
|
int MeleeDamage = self->GetClass()->Meta.GetMetaInt (ACMETA_MeleeDamage, 0);
|
|
|
|
FSoundID MeleeSound = self->GetClass()->Meta.GetMetaInt (ACMETA_MeleeSound, 0);
|
|
|
|
DoAttack(self, true, false, MeleeDamage, MeleeSound, NULL, 0);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_MissileAttack)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 23:22:08 +00:00
|
|
|
const PClass *MissileType=PClass::FindClass((ENamedName) self->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_None));
|
|
|
|
fixed_t MissileHeight= self->GetClass()->Meta.GetMetaFixed (ACMETA_MissileHeight, 32*FRACUNIT);
|
|
|
|
DoAttack(self, false, true, 0, 0, MissileType, MissileHeight);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_ComboAttack)
|
|
|
|
{
|
2008-08-12 23:22:08 +00:00
|
|
|
int MeleeDamage = self->GetClass()->Meta.GetMetaInt (ACMETA_MeleeDamage, 0);
|
|
|
|
FSoundID MeleeSound = self->GetClass()->Meta.GetMetaInt (ACMETA_MeleeSound, 0);
|
|
|
|
const PClass *MissileType=PClass::FindClass((ENamedName) self->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_None));
|
|
|
|
fixed_t MissileHeight= self->GetClass()->Meta.GetMetaFixed (ACMETA_MissileHeight, 32*FRACUNIT);
|
|
|
|
DoAttack(self, true, true, MeleeDamage, MeleeSound, MissileType, MissileHeight);
|
2008-08-12 08:00:28 +00:00
|
|
|
}
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BasicAttack)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(4);
|
|
|
|
ACTION_PARAM_INT(MeleeDamage, 0);
|
|
|
|
ACTION_PARAM_SOUND(MeleeSound, 1);
|
|
|
|
ACTION_PARAM_CLASS(MissileType, 2);
|
|
|
|
ACTION_PARAM_FIXED(MissileHeight, 3);
|
2008-08-12 23:22:08 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
DoAttack(self, true, true, MeleeDamage, MeleeSound, MissileType, MissileHeight);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Custom sound functions. These use misc1 and misc2 in the state structure
|
|
|
|
// This has been changed to use the parameter array instead of using the
|
|
|
|
// misc field directly so they can be used in weapon states
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlaySound)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_SOUND(soundid, 0);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
S_Sound (self, CHAN_BODY, soundid, 1, ATTN_NORM);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayWeaponSound)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_SOUND(soundid, 0);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, soundid, 1, ATTN_NORM);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_StopSound)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
S_StopSound(self, CHAN_VOICE);
|
|
|
|
}
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlaySoundEx)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(4);
|
|
|
|
ACTION_PARAM_SOUND(soundid, 0);
|
|
|
|
ACTION_PARAM_NAME(channel, 1);
|
|
|
|
ACTION_PARAM_BOOL(looping, 2);
|
|
|
|
ACTION_PARAM_INT(attenuation_raw, 3);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
int attenuation;
|
|
|
|
switch (attenuation_raw)
|
|
|
|
{
|
2008-03-21 21:15:56 +00:00
|
|
|
case -1: attenuation = ATTN_STATIC; break; // drop off rapidly
|
2008-01-27 11:25:03 +00:00
|
|
|
default:
|
2008-03-21 21:15:56 +00:00
|
|
|
case 0: attenuation = ATTN_NORM; break; // normal
|
|
|
|
case 1:
|
|
|
|
case 2: attenuation = ATTN_NONE; break; // full volume
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (channel < NAME_Auto || channel > NAME_SoundSlot7)
|
|
|
|
{
|
|
|
|
channel = NAME_Auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!looping)
|
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
S_Sound (self, int(channel) - NAME_Auto, soundid, 1, attenuation);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
if (!S_IsActorPlayingSomething (self, int(channel) - NAME_Auto, soundid))
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
S_Sound (self, (int(channel) - NAME_Auto) | CHAN_LOOP, soundid, 1, attenuation);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StopSoundEx)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_NAME(channel, 0);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (channel > NAME_Auto && channel <= NAME_SoundSlot7)
|
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
S_StopSound (self, int(channel) - NAME_Auto);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Generic seeker missile function
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SeekerMissile)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(2);
|
|
|
|
ACTION_PARAM_INT(ang1, 0);
|
|
|
|
ACTION_PARAM_INT(ang2, 1);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
P_SeekerMissile(self, clamp<int>(ang1, 0, 90) * ANGLE_1, clamp<int>(ang2, 0, 90) * ANGLE_1);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Hitscan attack with a customizable amount of bullets (specified in damage)
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-14 11:28:02 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_BulletAttack)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int bangle;
|
|
|
|
int slope;
|
|
|
|
|
|
|
|
if (!self->target) return;
|
|
|
|
|
|
|
|
A_FaceTarget (self);
|
|
|
|
bangle = self->angle;
|
|
|
|
|
|
|
|
slope = P_AimLineAttack (self, bangle, MISSILERANGE);
|
|
|
|
|
2008-06-15 17:17:31 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
|
2008-01-27 11:25:03 +00:00
|
|
|
for (i = self->GetMissileDamage (0, 1); i > 0; --i)
|
|
|
|
{
|
|
|
|
int angle = bangle + (pr_cabullet.Random2() << 20);
|
|
|
|
int damage = ((pr_cabullet()%5)+1)*3;
|
|
|
|
P_LineAttack(self, angle, MISSILERANGE, slope, damage,
|
|
|
|
NAME_None, NAME_BulletPuff);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Resolves a label parameter
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
FState *P_GetState(AActor *self, FState *CallingState, int offset)
|
|
|
|
{
|
2008-08-12 23:22:08 +00:00
|
|
|
if (offset == 0 || offset == INT_MIN)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
return NULL; // 0 means 'no state'
|
|
|
|
}
|
|
|
|
else if (offset>0)
|
|
|
|
{
|
Update to ZDoom r1146 (warning: massive changes ahead!)
- Removed DECORATE's ParseClass because it was only used to add data to fully
internal actor classes which no longer exist.
- Changed the state structure so that the Tics value doesn't need to be hacked
into misc1 with SF_BIGTIC anymore.
- Changed sprite processing so that sprite names are converted to indices
during parsing so that an additional postprocessing step is no longer needed.
- Fixed: Sprite names in DECORATE were case sensitive.
- Exported AActor's defaults to DECORATE and removed all code for the
internal property parser which is no longer needed.
- Converted the Heresiarch to DECORATE.
- Added an Active and Inactive state for monsters.
- Made the speed a parameter to A_RaiseMobj and A_SinkMobj and deleted
GetRaiseSpeed and GetSinkSpeed.
- Added some remaining DECORATE conversions for Hexen by Karate Chris.
- Changed Windows to use the performance counter instead of rdtsc.
- Changed Linux to use clock_gettime for profiling instead of rdtsc. This
avoids potential erroneous results on multicore and variable speed
processors.
- Converted the last of Hexen's inventory items to DECORATE so that I could
export AInventory.
- Removed AT_GAME_SET because it's no longer used anywhere.
- Converted the last remaining global classes to DECORATE.
- Fixed: Inventory.PickupFlash requires an class name as parameter not an
integer. Some Hexen definitions got it wrong.
- Converted Hexen's Pig to DECORATE.
- Replaced the ActorInfo definitions of all internal inventory classes with
DECORATE definitions.
- Added option to specify a powerup's duration in second by using a negative
number.
- Added Gez's Freedoom detection patch.
- SBARINFO update:
* Added: The ability to have drawkeybar auto detect spacing.
* Added: Offset parameter to drawkeybar to allow two key bars with
different keys.
* Added: Multi-row/column keybar parameters. Spacing can also be auto.
These defualt to left to right/top to bottom but can be switched.
* Added: Drawshadow flag to drawnumber. This will draw a solid color and
translucent number under the normal number.
* Added: hexenarmor to drawimage. This takes a parameter for a hexen
armor type and will fade the image like the hexen status bar.
* Added: centerbottom offset to draw(switchable)image.
* Added: translucent flag to drawinventorybar.
* Fixed: Accidentally removed flag from DrawTexture that allowed negative
coordinates to work with fullscreenoffsets. Hopefully this is the last
major bug in the fullscreenoffsets system.
- Ported vlinetallasm4 to AMD64 assembly. Even with the increased number of
registers AMD64 provides, this routine still needs to be written as self-
modifying code for maximum performance. The additional registers do allow
for further optimization over the x86 version by allowing all four pixels
to be in flight at the same time. The end result is that AMD64 ASM is about
2.18 times faster than AMD64 C and about 1.06 times faster than x86 ASM.
(For further comparison, AMD64 C and x86 C are practically the same for
this function.) Should I port any more assembly to AMD64, mvlineasm4 is the
most likely candidate, but it's not used enough at this point to bother.
Also, this may or may not work with Linux at the moment, since it doesn't
have the eh_handler metadata. Win64 is easier, since I just need to
structure the function prologue and epilogue properly and use some
assembler directives/macros to automatically generate the metadata. And
that brings up another point: You need YASM to assemble the AMD64 code,
because NASM doesn't support the Win64 metadata directives.
- Replaced the ActorInfo definitions of several internal classes with DECORATE definitions
- Converted teleport fog and destinations to DECORATE.
- AActor::PreExplode is gone now that the last item that was using it has been converted.
- Converted the Sigil and the remaining things in a_strifeitems.cpp to DECORATE.
- Exported Point pushers, CustomSprite and AmbientSound to DECORATE.
- Changed increased lightning damage for Centaurs into a damage factor.
- Changed PoisonCloud and Lightning special treatment in P_DamageMobj to use damage
types instead to keep dependencies on specific actor types out of the main engine code.
- Added Korax DECORATE conversion by Gez and a few others by Karate Chris.
- Removed FourthWeaponClass and based Hexen's fourth weapons on the generic weapon
pieces.
- Added DECORATE conversions for Hexen's Fighter weapons by Karate Chris.
- Added aWeaponGiver class to generalize the standing AssaultGun.
- converted a_Strifeweapons.cpp to DECORATE, except for the Sigil.
- Added an SSE version of DoBlending. This is strictly C intrinsics.
VC++ still throws around unneccessary register moves. GCC seems to be
pretty close to optimal, requiring only about 2 cycles/color. They're
both faster than my hand-written MMX routine, so I don't need to feel
bad about not hand-optimizing this for x64 builds.
- Removed an extra instruction from DoBlending_MMX, transposed two
instructions, and unrolled it once, shaving off about 80 cycles from the
time required to blend 256 palette entries. Why? Because I tried writing
a C version of the routine using compiler intrinsics and was appalled by
all the extra movq's VC++ added to the code. GCC was better, but still
generated extra instructions. I only wanted a C version because I can't
use inline assembly with VC++'s x64 compiler, and x64 assembly is a bit
of a pain. (It's a pain because Linux and Windows have different calling
conventions, and you need to maintain extra metadata for functions.) So,
the assembly version stays and the C version stays out.
- Converted the rest of a_strifestuff.cpp to DECORATE.
- Fixed: AStalker::CheckMeleeRange did not perform all checks of AActor::CheckMeleeRange.
I replaced this virtual override with a new flag MF5_NOVERTICALMELEERANGE so that
this feature can also be used by other actors.
- Converted Strife's Stalker to DECORATE.
- Converted ArtiTeleport to DECORATE.
- Removed the NoBlockingSet method from AActor because everything using it has been
converted to DECORATE using DropItem instead.
- Changed: Macil doesn't need the StrifeHumanoid's special death states so he might
as well inherit directly from AActor.
- Converted Strife's Coin, Oracle, Macil and StrifeHumanoid to DECORATE. Also moved
the burning hand states to StrifePlayer where they really belong.
- Added Gez's dropammofactor submission with some necessary changes. Also merged
redundant ammo multiplication code from P_DropItem and ADehackedPickup::TryPickup.
- Restricted native action function definitions to zdoom.pk3.
- Fixed. The Firedemon was missing a game filter.
- Added: disablegrin, disableouch, disablepain, and disablerampage flags to
drawmugshot.
- Fixed: LowerHealthCap did not work properly.
- Fixed: Various bugs I noticed in the fullscreenoffsets code.
- Removed all the pixel doubling r_detail modes, since the one platform they
were intended to assist (486) actually sees very little benefit from them.
- Rewrote CheckMMX in C and renamed it to CheckCPU.
- Fixed: CPUID function 0x80000005 is specified to return detailed L1 cache
only for AMD processors, so we must not use it on other architectures, or
we end up overwriting the L1 cache line size with 0 or some other number
we don't actually understand.
- The x87 precision control is now explicitly set for double precision, since
GCC defaults to extended precision instead, unlike Visual C++.
- Converted Strife's Programmer, Loremaster and Thingstoblowup to DECORATE.
- Fixed: Attacking a merchant in Strife didn't alert the enemies.
- Removed AT_GAME_SET(PowerInvulnerable) due to the problems it caused. The two
occurences in the code that depended on it were changed accordingly.
Invulnerability colormaps are now being set by the items exclusively.
- Changed many checks for the friendly Minotaur to a new flag MF5_SUMMONEDMONSTER
so that it can hopefully be generalized to be usable elsewhere later.
- Added Gez's submission for converting the Minotaur to DECORATE.
- Fixed a few minor DECORATE bugs.
- Changed coordinate storage for EntityBoss so that it works properly even
when the pod is not used to spawn it.
- Converted Strife's Spectres and Entity to DECORATE.
- Added: fullscreenoffsets flag for status bars. This changes the coordinate
system to be relative to the top left corner of the screen. This is useful
for full screen status bars.
- Changed: drawinventorybar will use the width of artibox or invcurs (strife)
to determine the spacing. Let me know if this breaks any released mods.
- Fixed: If a status bar height of 0 was specified in SBarInfo the wrong bar
would be shown.
- Fixed: If a static inventory bar was used the user still had to press invuse
in order to get rid of the "overlay".
- Fixed: forcescaled would not work if the height of the bar was 0.
- Added: keyslot to drawswitchableimage.
- Fixed: The transition effects for the log and keys popups were switched.
- Converted Strife's Crusader, Inquisitor and spectral missiles to
DECORATE.
- Converted Strife's Acolytes, Rebels, Sentinel, Reaver and Templar to
DECORATE.
- Added DECORATE conversions for Hexen's Cleric weapons by Karate Chris.
- Added a check to Zipdir that excludes files with a .orig extension. These
can be left behind by patch.exe and create problems.
- fixed: Unmorphing from chicken caused a crash when reading non-existent
meta-data strings.
- Converted the ScriptedMarines to DECORATE.
- Fixed: DLightTransfer and DWallLightTransfer were declared as actors.
- Converted the PhoenixRod and associated classes to DECORATE to make
the Heretic conversion complete.
- Converted the Minotaur's projectiles to DECORATE so that I can get
rid of the AT_SPEED_SET code.
- Converted Heretic's Blaster and SkullRod to DECORATE.
- Converted the mace and all related actors to DECORATE and generalized
the spawn function that only spawns one mace per level.
- Moved Mace respawning code into AInventory so that it works properly
for replacement actors.
- Added more DECORATE conversions by Karate Chris.
- Cleaned up the new bridge code and exported all related actors to
DECORATE so that the exported code pointers can be used.
- Separated Heretic's and Hexen's invulnerability items for stability
reasons.
- Fixed spurious warnings on 32-bit VC++ debug builds.
- Made the subsong (order) number a proper parameter to MusInfo::Play()
instead of requiring a separate SetPosition() call to do it.
- Added Gez's submission for custom bridge things.
- Fixed: ASpecialSpot must check the array's size before dividing by it.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@151 b0f79afe-0144-0410-b225-9a4edf0717df
2008-08-10 15:12:58 +00:00
|
|
|
if (CallingState == NULL) return NULL;
|
2008-01-27 11:25:03 +00:00
|
|
|
return CallingState + offset;
|
|
|
|
}
|
|
|
|
else if (self != NULL)
|
|
|
|
{
|
|
|
|
offset = -offset;
|
|
|
|
|
|
|
|
FName classname = JumpParameters[offset];
|
|
|
|
const PClass *cls;
|
|
|
|
cls = classname==NAME_None? RUNTIME_TYPE(self) : PClass::FindClass(classname);
|
|
|
|
if (cls==NULL || cls->ActorInfo==NULL) return NULL; // shouldn't happen
|
|
|
|
|
|
|
|
int numnames = (int)JumpParameters[offset+1];
|
|
|
|
FState *jumpto = cls->ActorInfo->FindState(numnames, &JumpParameters[offset+2]);
|
|
|
|
if (jumpto == NULL)
|
|
|
|
{
|
|
|
|
const char *dot="";
|
|
|
|
Printf("Jump target '");
|
|
|
|
if (classname != NAME_None) Printf("%s::", classname.GetChars());
|
|
|
|
for (int i=0;i<numnames;i++)
|
|
|
|
{
|
|
|
|
Printf("%s%s", dot, JumpParameters[offset+2+i].GetChars());
|
|
|
|
dot = ".";
|
|
|
|
}
|
|
|
|
Printf("' not found in %s\n", self->GetClass()->TypeName.GetChars());
|
|
|
|
}
|
|
|
|
return jumpto;
|
|
|
|
}
|
|
|
|
else return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Do the state jump
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-14 11:28:02 +00:00
|
|
|
static void DoJump(AActor * self, FState * CallingState, int offset, StateCallData *statecall)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (statecall != NULL)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
FState *jumpto = P_GetState(statecall->Item, CallingState, offset);
|
2008-01-27 11:25:03 +00:00
|
|
|
if (jumpto == NULL) return;
|
2008-08-14 11:28:02 +00:00
|
|
|
statecall->State = jumpto;
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
else if (self->player != NULL && CallingState == self->player->psprites[ps_weapon].state)
|
|
|
|
{
|
|
|
|
FState *jumpto = P_GetState(self->player->ReadyWeapon, CallingState, offset);
|
|
|
|
if (jumpto == NULL) return;
|
|
|
|
P_SetPsprite(self->player, ps_weapon, jumpto);
|
|
|
|
}
|
|
|
|
else if (self->player != NULL && CallingState == self->player->psprites[ps_flash].state)
|
|
|
|
{
|
|
|
|
FState *jumpto = P_GetState(self->player->ReadyWeapon, CallingState, offset);
|
|
|
|
if (jumpto == NULL) return;
|
|
|
|
P_SetPsprite(self->player, ps_flash, jumpto);
|
|
|
|
}
|
2008-08-14 11:28:02 +00:00
|
|
|
else if (CallingState == self->state)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
FState *jumpto = P_GetState(self, CallingState, offset);
|
|
|
|
if (jumpto == NULL) return;
|
|
|
|
self->SetState (jumpto);
|
|
|
|
}
|
2008-08-14 11:28:02 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// something went very wrong. This should never happen.
|
|
|
|
assert(false);
|
|
|
|
}
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
2008-08-14 11:28:02 +00:00
|
|
|
|
|
|
|
// This is just to avoid having to directly reference the internally defined
|
|
|
|
// CallingState and statecall parameters in the code below.
|
|
|
|
#define ACTION_JUMP(offset) DoJump(self, CallingState, offset, statecall)
|
|
|
|
|
2008-01-27 11:25:03 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// State jump function
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Jump)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(3);
|
2008-08-14 22:58:26 +00:00
|
|
|
ACTION_PARAM_CONST(count, 0);
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_INT(maxchance, 1);
|
|
|
|
ACTION_PARAM_VARARG(jumps, 2);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (count >= 2 && (maxchance >= 256 || pr_cajump() < maxchance))
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
if (count == 2)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_JUMP(*jumps);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-14 19:10:59 +00:00
|
|
|
ACTION_JUMP(jumps[(pr_cajump() % (count - 1))]);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// State jump function
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHealthLower)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(2);
|
|
|
|
ACTION_PARAM_INT(health, 0);
|
|
|
|
ACTION_PARAM_STATE(jump, 1);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (self->health < health) ACTION_JUMP(jump);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// State jump function
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfCloser)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(2);
|
|
|
|
ACTION_PARAM_FIXED(dist, 0);
|
|
|
|
ACTION_PARAM_STATE(jump, 1);
|
|
|
|
|
|
|
|
AActor *target;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (!self->player)
|
|
|
|
{
|
|
|
|
target=self->target;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Does the player aim at something that can be shot?
|
Update to ZDoom r905:
- Added Martin Howe's morph system update.
- Added support for defining composite textures in HIRESTEX. It is not fully tested
and right now can't do much more than the old TEXTUREx method.
- Added a few NULL pointer checks to the texture code.
- Made duplicate class names in DECORATE non-fatal. There is really no stability
concern here and the worst that can happen is that the wrong actor is spawned.
This was a constant hassle when testing with WADs that contain duplicate resources.
- Removed some GCC warnings.
- Fixed: MinGW doesn't have _get_pgmptr(), so it couldn't compile i_main.cpp.
- Fixed: MOD_WAVETABLE and MOD_SWSYNTH are not defined by w32api, so MinGW
failed compiling the new MIDI code.
- Fixed: LocalSndInfo and LocalSndSeq in S_Start() need to be const char
pointers, since "" is a constant.
- Fixed: parsecontext.h was missing a newline at the end of the file.
- Fixed: Timidity::Channel::mono, rpn, and nrpn were not initialized. In
particular, this meant that every channel was almost certainly in mono mode,
which can sound pretty bad if the song isn't meant to be played that way.
- Added bank numbers to the MIDI precaching for Timidity, since I guess I do
need to care about banks, if even the Duke MIDIs use various banks.
- Fixed: snd_midiprecache only exists in Win32 builds, so gameconfigfile.cpp
shouldn't unconditionally link against it.
- Fixed: pre_resample() was still disabled, and it left two samples at the end
of the new wave data uninitialized.
- Moved the xmap table from timidity/tables.cpp to playmidi.cpp. Now I can get
rid of timidity/tables.cpp, which conflicts in name with the main Doom
tables.cpp. (And interestingly, VC++ automatically renamed the object file,
so I wasn't aware of the problem with GCC.)
- Added a Gets function to the FileReader class which I planned to use
to enable Timidity to read its config and sound patches from Zips.
I put this on hold though after finding out that the sound quality
isn't even near that of Timidity++.
- GCC-Fixes (FString::GetChars() for Printf calls)
- Added a dummy Weapon.NOLMS flag so that Skulltag weapons using this flag
can be loaded
- Changed the MIDIStreamer to send the all notes off controller to each
channel when restarting the song, rather than emitting a single note off
event which only has 1 in 127 chance of being for a note that's playing
on that channel. Then I decided it would probably be a good idea to reset
all the controllers as well.
- Increasing the size of the internal Timidity stream buffer from 1/14 sec
(copied from the OPL player) improved its sound dramatically, so apparently
Timidity has issues with short stream buffers. It's now at 1/2 sec in
length. However, there seems to be something weird going on with
corazonazul_ff6boss.mid near the beginning where it stops and immediately
restarts a guitar on the exact same note.
- Added a new sound debugging cvar: snd_drawoutput, which can show various
oscilloscopes and spectrums.
- Eliminated some more global variables (onmobj, DoRipping, LastRipped,
MissileActor, bulletpitch and linetarget.)
- Internal TiMidity now plays music. Unfortunately, it doesn't sound right. :(
- Changed the progdir global variable into an FString.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@90 b0f79afe-0144-0410-b225-9a4edf0717df
2008-04-12 18:59:23 +00:00
|
|
|
P_BulletSlope(self, &target);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
// No target - no jump
|
|
|
|
if (target==NULL) return;
|
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (P_AproxDistance(self->x-target->x, self->y-target->y) < dist &&
|
2008-03-19 11:19:03 +00:00
|
|
|
( (self->z > target->z && self->z - (target->z + target->height) < dist) ||
|
|
|
|
(self->z <=target->z && target->z - (self->z + self->height) < dist)
|
|
|
|
)
|
|
|
|
)
|
2008-08-14 11:28:02 +00:00
|
|
|
{
|
|
|
|
ACTION_JUMP(jump);
|
|
|
|
}
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// State jump function
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
void DoJumpIfInventory(AActor * self, AActor * owner, DECLARE_PARAMINFO)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(3);
|
|
|
|
ACTION_PARAM_CLASS(Type, 0);
|
|
|
|
ACTION_PARAM_INT(ItemAmount, 1);
|
|
|
|
ACTION_PARAM_STATE(JumpOffset, 2);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (!Type || owner == NULL) return;
|
|
|
|
|
|
|
|
AInventory * Item=owner->FindInventory(Type);
|
|
|
|
|
|
|
|
if (Item)
|
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
if (ItemAmount>0 && Item->Amount>=ItemAmount) ACTION_JUMP(JumpOffset);
|
|
|
|
else if (Item->Amount>=Item->MaxAmount) ACTION_JUMP(JumpOffset);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInventory)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 23:22:08 +00:00
|
|
|
DoJumpIfInventory(self, self, PUSH_PARAMINFO);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetInventory)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 23:22:08 +00:00
|
|
|
DoJumpIfInventory(self, self->target, PUSH_PARAMINFO);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Parameterized version of A_Explode
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(4);
|
|
|
|
ACTION_PARAM_INT(damage, 0);
|
2008-08-22 07:36:50 +00:00
|
|
|
ACTION_PARAM_INT(distance, 1);
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_BOOL(hurtSource, 2);
|
|
|
|
ACTION_PARAM_BOOL(alert, 3);
|
2008-08-12 23:22:08 +00:00
|
|
|
|
|
|
|
if (damage < 0) // get parameters from metadata
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
damage = self->GetClass()->Meta.GetMetaInt (ACMETA_ExplosionDamage, 128);
|
|
|
|
distance = self->GetClass()->Meta.GetMetaInt (ACMETA_ExplosionRadius, damage);
|
|
|
|
hurtSource = !self->GetClass()->Meta.GetMetaInt (ACMETA_DontHurtShooter);
|
Update to ZDoom r1146 (warning: massive changes ahead!)
- Removed DECORATE's ParseClass because it was only used to add data to fully
internal actor classes which no longer exist.
- Changed the state structure so that the Tics value doesn't need to be hacked
into misc1 with SF_BIGTIC anymore.
- Changed sprite processing so that sprite names are converted to indices
during parsing so that an additional postprocessing step is no longer needed.
- Fixed: Sprite names in DECORATE were case sensitive.
- Exported AActor's defaults to DECORATE and removed all code for the
internal property parser which is no longer needed.
- Converted the Heresiarch to DECORATE.
- Added an Active and Inactive state for monsters.
- Made the speed a parameter to A_RaiseMobj and A_SinkMobj and deleted
GetRaiseSpeed and GetSinkSpeed.
- Added some remaining DECORATE conversions for Hexen by Karate Chris.
- Changed Windows to use the performance counter instead of rdtsc.
- Changed Linux to use clock_gettime for profiling instead of rdtsc. This
avoids potential erroneous results on multicore and variable speed
processors.
- Converted the last of Hexen's inventory items to DECORATE so that I could
export AInventory.
- Removed AT_GAME_SET because it's no longer used anywhere.
- Converted the last remaining global classes to DECORATE.
- Fixed: Inventory.PickupFlash requires an class name as parameter not an
integer. Some Hexen definitions got it wrong.
- Converted Hexen's Pig to DECORATE.
- Replaced the ActorInfo definitions of all internal inventory classes with
DECORATE definitions.
- Added option to specify a powerup's duration in second by using a negative
number.
- Added Gez's Freedoom detection patch.
- SBARINFO update:
* Added: The ability to have drawkeybar auto detect spacing.
* Added: Offset parameter to drawkeybar to allow two key bars with
different keys.
* Added: Multi-row/column keybar parameters. Spacing can also be auto.
These defualt to left to right/top to bottom but can be switched.
* Added: Drawshadow flag to drawnumber. This will draw a solid color and
translucent number under the normal number.
* Added: hexenarmor to drawimage. This takes a parameter for a hexen
armor type and will fade the image like the hexen status bar.
* Added: centerbottom offset to draw(switchable)image.
* Added: translucent flag to drawinventorybar.
* Fixed: Accidentally removed flag from DrawTexture that allowed negative
coordinates to work with fullscreenoffsets. Hopefully this is the last
major bug in the fullscreenoffsets system.
- Ported vlinetallasm4 to AMD64 assembly. Even with the increased number of
registers AMD64 provides, this routine still needs to be written as self-
modifying code for maximum performance. The additional registers do allow
for further optimization over the x86 version by allowing all four pixels
to be in flight at the same time. The end result is that AMD64 ASM is about
2.18 times faster than AMD64 C and about 1.06 times faster than x86 ASM.
(For further comparison, AMD64 C and x86 C are practically the same for
this function.) Should I port any more assembly to AMD64, mvlineasm4 is the
most likely candidate, but it's not used enough at this point to bother.
Also, this may or may not work with Linux at the moment, since it doesn't
have the eh_handler metadata. Win64 is easier, since I just need to
structure the function prologue and epilogue properly and use some
assembler directives/macros to automatically generate the metadata. And
that brings up another point: You need YASM to assemble the AMD64 code,
because NASM doesn't support the Win64 metadata directives.
- Replaced the ActorInfo definitions of several internal classes with DECORATE definitions
- Converted teleport fog and destinations to DECORATE.
- AActor::PreExplode is gone now that the last item that was using it has been converted.
- Converted the Sigil and the remaining things in a_strifeitems.cpp to DECORATE.
- Exported Point pushers, CustomSprite and AmbientSound to DECORATE.
- Changed increased lightning damage for Centaurs into a damage factor.
- Changed PoisonCloud and Lightning special treatment in P_DamageMobj to use damage
types instead to keep dependencies on specific actor types out of the main engine code.
- Added Korax DECORATE conversion by Gez and a few others by Karate Chris.
- Removed FourthWeaponClass and based Hexen's fourth weapons on the generic weapon
pieces.
- Added DECORATE conversions for Hexen's Fighter weapons by Karate Chris.
- Added aWeaponGiver class to generalize the standing AssaultGun.
- converted a_Strifeweapons.cpp to DECORATE, except for the Sigil.
- Added an SSE version of DoBlending. This is strictly C intrinsics.
VC++ still throws around unneccessary register moves. GCC seems to be
pretty close to optimal, requiring only about 2 cycles/color. They're
both faster than my hand-written MMX routine, so I don't need to feel
bad about not hand-optimizing this for x64 builds.
- Removed an extra instruction from DoBlending_MMX, transposed two
instructions, and unrolled it once, shaving off about 80 cycles from the
time required to blend 256 palette entries. Why? Because I tried writing
a C version of the routine using compiler intrinsics and was appalled by
all the extra movq's VC++ added to the code. GCC was better, but still
generated extra instructions. I only wanted a C version because I can't
use inline assembly with VC++'s x64 compiler, and x64 assembly is a bit
of a pain. (It's a pain because Linux and Windows have different calling
conventions, and you need to maintain extra metadata for functions.) So,
the assembly version stays and the C version stays out.
- Converted the rest of a_strifestuff.cpp to DECORATE.
- Fixed: AStalker::CheckMeleeRange did not perform all checks of AActor::CheckMeleeRange.
I replaced this virtual override with a new flag MF5_NOVERTICALMELEERANGE so that
this feature can also be used by other actors.
- Converted Strife's Stalker to DECORATE.
- Converted ArtiTeleport to DECORATE.
- Removed the NoBlockingSet method from AActor because everything using it has been
converted to DECORATE using DropItem instead.
- Changed: Macil doesn't need the StrifeHumanoid's special death states so he might
as well inherit directly from AActor.
- Converted Strife's Coin, Oracle, Macil and StrifeHumanoid to DECORATE. Also moved
the burning hand states to StrifePlayer where they really belong.
- Added Gez's dropammofactor submission with some necessary changes. Also merged
redundant ammo multiplication code from P_DropItem and ADehackedPickup::TryPickup.
- Restricted native action function definitions to zdoom.pk3.
- Fixed. The Firedemon was missing a game filter.
- Added: disablegrin, disableouch, disablepain, and disablerampage flags to
drawmugshot.
- Fixed: LowerHealthCap did not work properly.
- Fixed: Various bugs I noticed in the fullscreenoffsets code.
- Removed all the pixel doubling r_detail modes, since the one platform they
were intended to assist (486) actually sees very little benefit from them.
- Rewrote CheckMMX in C and renamed it to CheckCPU.
- Fixed: CPUID function 0x80000005 is specified to return detailed L1 cache
only for AMD processors, so we must not use it on other architectures, or
we end up overwriting the L1 cache line size with 0 or some other number
we don't actually understand.
- The x87 precision control is now explicitly set for double precision, since
GCC defaults to extended precision instead, unlike Visual C++.
- Converted Strife's Programmer, Loremaster and Thingstoblowup to DECORATE.
- Fixed: Attacking a merchant in Strife didn't alert the enemies.
- Removed AT_GAME_SET(PowerInvulnerable) due to the problems it caused. The two
occurences in the code that depended on it were changed accordingly.
Invulnerability colormaps are now being set by the items exclusively.
- Changed many checks for the friendly Minotaur to a new flag MF5_SUMMONEDMONSTER
so that it can hopefully be generalized to be usable elsewhere later.
- Added Gez's submission for converting the Minotaur to DECORATE.
- Fixed a few minor DECORATE bugs.
- Changed coordinate storage for EntityBoss so that it works properly even
when the pod is not used to spawn it.
- Converted Strife's Spectres and Entity to DECORATE.
- Added: fullscreenoffsets flag for status bars. This changes the coordinate
system to be relative to the top left corner of the screen. This is useful
for full screen status bars.
- Changed: drawinventorybar will use the width of artibox or invcurs (strife)
to determine the spacing. Let me know if this breaks any released mods.
- Fixed: If a status bar height of 0 was specified in SBarInfo the wrong bar
would be shown.
- Fixed: If a static inventory bar was used the user still had to press invuse
in order to get rid of the "overlay".
- Fixed: forcescaled would not work if the height of the bar was 0.
- Added: keyslot to drawswitchableimage.
- Fixed: The transition effects for the log and keys popups were switched.
- Converted Strife's Crusader, Inquisitor and spectral missiles to
DECORATE.
- Converted Strife's Acolytes, Rebels, Sentinel, Reaver and Templar to
DECORATE.
- Added DECORATE conversions for Hexen's Cleric weapons by Karate Chris.
- Added a check to Zipdir that excludes files with a .orig extension. These
can be left behind by patch.exe and create problems.
- fixed: Unmorphing from chicken caused a crash when reading non-existent
meta-data strings.
- Converted the ScriptedMarines to DECORATE.
- Fixed: DLightTransfer and DWallLightTransfer were declared as actors.
- Converted the PhoenixRod and associated classes to DECORATE to make
the Heretic conversion complete.
- Converted the Minotaur's projectiles to DECORATE so that I can get
rid of the AT_SPEED_SET code.
- Converted Heretic's Blaster and SkullRod to DECORATE.
- Converted the mace and all related actors to DECORATE and generalized
the spawn function that only spawns one mace per level.
- Moved Mace respawning code into AInventory so that it works properly
for replacement actors.
- Added more DECORATE conversions by Karate Chris.
- Cleaned up the new bridge code and exported all related actors to
DECORATE so that the exported code pointers can be used.
- Separated Heretic's and Hexen's invulnerability items for stability
reasons.
- Fixed spurious warnings on 32-bit VC++ debug builds.
- Made the subsong (order) number a proper parameter to MusInfo::Play()
instead of requiring a separate SetPosition() call to do it.
- Added Gez's submission for custom bridge things.
- Fixed: ASpecialSpot must check the array's size before dividing by it.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@151 b0f79afe-0144-0410-b225-9a4edf0717df
2008-08-10 15:12:58 +00:00
|
|
|
alert = false;
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
2008-08-12 23:22:08 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (distance <= 0) distance = damage;
|
|
|
|
}
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
P_RadiusAttack (self, self->target, damage, distance, self->DamageType, hurtSource);
|
|
|
|
if (self->z <= self->floorz + (distance<<FRACBITS))
|
|
|
|
{
|
|
|
|
P_HitFloor (self);
|
|
|
|
}
|
Update to ZDoom r1146 (warning: massive changes ahead!)
- Removed DECORATE's ParseClass because it was only used to add data to fully
internal actor classes which no longer exist.
- Changed the state structure so that the Tics value doesn't need to be hacked
into misc1 with SF_BIGTIC anymore.
- Changed sprite processing so that sprite names are converted to indices
during parsing so that an additional postprocessing step is no longer needed.
- Fixed: Sprite names in DECORATE were case sensitive.
- Exported AActor's defaults to DECORATE and removed all code for the
internal property parser which is no longer needed.
- Converted the Heresiarch to DECORATE.
- Added an Active and Inactive state for monsters.
- Made the speed a parameter to A_RaiseMobj and A_SinkMobj and deleted
GetRaiseSpeed and GetSinkSpeed.
- Added some remaining DECORATE conversions for Hexen by Karate Chris.
- Changed Windows to use the performance counter instead of rdtsc.
- Changed Linux to use clock_gettime for profiling instead of rdtsc. This
avoids potential erroneous results on multicore and variable speed
processors.
- Converted the last of Hexen's inventory items to DECORATE so that I could
export AInventory.
- Removed AT_GAME_SET because it's no longer used anywhere.
- Converted the last remaining global classes to DECORATE.
- Fixed: Inventory.PickupFlash requires an class name as parameter not an
integer. Some Hexen definitions got it wrong.
- Converted Hexen's Pig to DECORATE.
- Replaced the ActorInfo definitions of all internal inventory classes with
DECORATE definitions.
- Added option to specify a powerup's duration in second by using a negative
number.
- Added Gez's Freedoom detection patch.
- SBARINFO update:
* Added: The ability to have drawkeybar auto detect spacing.
* Added: Offset parameter to drawkeybar to allow two key bars with
different keys.
* Added: Multi-row/column keybar parameters. Spacing can also be auto.
These defualt to left to right/top to bottom but can be switched.
* Added: Drawshadow flag to drawnumber. This will draw a solid color and
translucent number under the normal number.
* Added: hexenarmor to drawimage. This takes a parameter for a hexen
armor type and will fade the image like the hexen status bar.
* Added: centerbottom offset to draw(switchable)image.
* Added: translucent flag to drawinventorybar.
* Fixed: Accidentally removed flag from DrawTexture that allowed negative
coordinates to work with fullscreenoffsets. Hopefully this is the last
major bug in the fullscreenoffsets system.
- Ported vlinetallasm4 to AMD64 assembly. Even with the increased number of
registers AMD64 provides, this routine still needs to be written as self-
modifying code for maximum performance. The additional registers do allow
for further optimization over the x86 version by allowing all four pixels
to be in flight at the same time. The end result is that AMD64 ASM is about
2.18 times faster than AMD64 C and about 1.06 times faster than x86 ASM.
(For further comparison, AMD64 C and x86 C are practically the same for
this function.) Should I port any more assembly to AMD64, mvlineasm4 is the
most likely candidate, but it's not used enough at this point to bother.
Also, this may or may not work with Linux at the moment, since it doesn't
have the eh_handler metadata. Win64 is easier, since I just need to
structure the function prologue and epilogue properly and use some
assembler directives/macros to automatically generate the metadata. And
that brings up another point: You need YASM to assemble the AMD64 code,
because NASM doesn't support the Win64 metadata directives.
- Replaced the ActorInfo definitions of several internal classes with DECORATE definitions
- Converted teleport fog and destinations to DECORATE.
- AActor::PreExplode is gone now that the last item that was using it has been converted.
- Converted the Sigil and the remaining things in a_strifeitems.cpp to DECORATE.
- Exported Point pushers, CustomSprite and AmbientSound to DECORATE.
- Changed increased lightning damage for Centaurs into a damage factor.
- Changed PoisonCloud and Lightning special treatment in P_DamageMobj to use damage
types instead to keep dependencies on specific actor types out of the main engine code.
- Added Korax DECORATE conversion by Gez and a few others by Karate Chris.
- Removed FourthWeaponClass and based Hexen's fourth weapons on the generic weapon
pieces.
- Added DECORATE conversions for Hexen's Fighter weapons by Karate Chris.
- Added aWeaponGiver class to generalize the standing AssaultGun.
- converted a_Strifeweapons.cpp to DECORATE, except for the Sigil.
- Added an SSE version of DoBlending. This is strictly C intrinsics.
VC++ still throws around unneccessary register moves. GCC seems to be
pretty close to optimal, requiring only about 2 cycles/color. They're
both faster than my hand-written MMX routine, so I don't need to feel
bad about not hand-optimizing this for x64 builds.
- Removed an extra instruction from DoBlending_MMX, transposed two
instructions, and unrolled it once, shaving off about 80 cycles from the
time required to blend 256 palette entries. Why? Because I tried writing
a C version of the routine using compiler intrinsics and was appalled by
all the extra movq's VC++ added to the code. GCC was better, but still
generated extra instructions. I only wanted a C version because I can't
use inline assembly with VC++'s x64 compiler, and x64 assembly is a bit
of a pain. (It's a pain because Linux and Windows have different calling
conventions, and you need to maintain extra metadata for functions.) So,
the assembly version stays and the C version stays out.
- Converted the rest of a_strifestuff.cpp to DECORATE.
- Fixed: AStalker::CheckMeleeRange did not perform all checks of AActor::CheckMeleeRange.
I replaced this virtual override with a new flag MF5_NOVERTICALMELEERANGE so that
this feature can also be used by other actors.
- Converted Strife's Stalker to DECORATE.
- Converted ArtiTeleport to DECORATE.
- Removed the NoBlockingSet method from AActor because everything using it has been
converted to DECORATE using DropItem instead.
- Changed: Macil doesn't need the StrifeHumanoid's special death states so he might
as well inherit directly from AActor.
- Converted Strife's Coin, Oracle, Macil and StrifeHumanoid to DECORATE. Also moved
the burning hand states to StrifePlayer where they really belong.
- Added Gez's dropammofactor submission with some necessary changes. Also merged
redundant ammo multiplication code from P_DropItem and ADehackedPickup::TryPickup.
- Restricted native action function definitions to zdoom.pk3.
- Fixed. The Firedemon was missing a game filter.
- Added: disablegrin, disableouch, disablepain, and disablerampage flags to
drawmugshot.
- Fixed: LowerHealthCap did not work properly.
- Fixed: Various bugs I noticed in the fullscreenoffsets code.
- Removed all the pixel doubling r_detail modes, since the one platform they
were intended to assist (486) actually sees very little benefit from them.
- Rewrote CheckMMX in C and renamed it to CheckCPU.
- Fixed: CPUID function 0x80000005 is specified to return detailed L1 cache
only for AMD processors, so we must not use it on other architectures, or
we end up overwriting the L1 cache line size with 0 or some other number
we don't actually understand.
- The x87 precision control is now explicitly set for double precision, since
GCC defaults to extended precision instead, unlike Visual C++.
- Converted Strife's Programmer, Loremaster and Thingstoblowup to DECORATE.
- Fixed: Attacking a merchant in Strife didn't alert the enemies.
- Removed AT_GAME_SET(PowerInvulnerable) due to the problems it caused. The two
occurences in the code that depended on it were changed accordingly.
Invulnerability colormaps are now being set by the items exclusively.
- Changed many checks for the friendly Minotaur to a new flag MF5_SUMMONEDMONSTER
so that it can hopefully be generalized to be usable elsewhere later.
- Added Gez's submission for converting the Minotaur to DECORATE.
- Fixed a few minor DECORATE bugs.
- Changed coordinate storage for EntityBoss so that it works properly even
when the pod is not used to spawn it.
- Converted Strife's Spectres and Entity to DECORATE.
- Added: fullscreenoffsets flag for status bars. This changes the coordinate
system to be relative to the top left corner of the screen. This is useful
for full screen status bars.
- Changed: drawinventorybar will use the width of artibox or invcurs (strife)
to determine the spacing. Let me know if this breaks any released mods.
- Fixed: If a status bar height of 0 was specified in SBarInfo the wrong bar
would be shown.
- Fixed: If a static inventory bar was used the user still had to press invuse
in order to get rid of the "overlay".
- Fixed: forcescaled would not work if the height of the bar was 0.
- Added: keyslot to drawswitchableimage.
- Fixed: The transition effects for the log and keys popups were switched.
- Converted Strife's Crusader, Inquisitor and spectral missiles to
DECORATE.
- Converted Strife's Acolytes, Rebels, Sentinel, Reaver and Templar to
DECORATE.
- Added DECORATE conversions for Hexen's Cleric weapons by Karate Chris.
- Added a check to Zipdir that excludes files with a .orig extension. These
can be left behind by patch.exe and create problems.
- fixed: Unmorphing from chicken caused a crash when reading non-existent
meta-data strings.
- Converted the ScriptedMarines to DECORATE.
- Fixed: DLightTransfer and DWallLightTransfer were declared as actors.
- Converted the PhoenixRod and associated classes to DECORATE to make
the Heretic conversion complete.
- Converted the Minotaur's projectiles to DECORATE so that I can get
rid of the AT_SPEED_SET code.
- Converted Heretic's Blaster and SkullRod to DECORATE.
- Converted the mace and all related actors to DECORATE and generalized
the spawn function that only spawns one mace per level.
- Moved Mace respawning code into AInventory so that it works properly
for replacement actors.
- Added more DECORATE conversions by Karate Chris.
- Cleaned up the new bridge code and exported all related actors to
DECORATE so that the exported code pointers can be used.
- Separated Heretic's and Hexen's invulnerability items for stability
reasons.
- Fixed spurious warnings on 32-bit VC++ debug builds.
- Made the subsong (order) number a proper parameter to MusInfo::Play()
instead of requiring a separate SetPosition() call to do it.
- Added Gez's submission for custom bridge things.
- Fixed: ASpecialSpot must check the array's size before dividing by it.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@151 b0f79afe-0144-0410-b225-9a4edf0717df
2008-08-10 15:12:58 +00:00
|
|
|
if (alert && self->target != NULL && self->target->player != NULL)
|
|
|
|
{
|
|
|
|
validcount++;
|
|
|
|
P_RecursiveSound (self->Sector, self->target, false, 0);
|
|
|
|
}
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A_RadiusThrust
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusThrust)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(3);
|
|
|
|
ACTION_PARAM_INT(force, 0);
|
|
|
|
ACTION_PARAM_FIXED(distance, 1);
|
|
|
|
ACTION_PARAM_BOOL(affectSource, 2);
|
2008-08-12 23:22:08 +00:00
|
|
|
|
|
|
|
if (force <= 0) force = 128;
|
|
|
|
if (distance <= 0) distance = force;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
P_RadiusAttack (self, self->target, force, distance, self->DamageType, affectSource, false);
|
|
|
|
if (self->z <= self->floorz + (distance<<FRACBITS))
|
|
|
|
{
|
|
|
|
P_HitFloor (self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Execute a line special / script
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CallSpecial)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(6);
|
|
|
|
ACTION_PARAM_INT(special, 0);
|
|
|
|
ACTION_PARAM_INT(arg1, 1);
|
|
|
|
ACTION_PARAM_INT(arg2, 2);
|
|
|
|
ACTION_PARAM_INT(arg3, 3);
|
|
|
|
ACTION_PARAM_INT(arg4, 4);
|
|
|
|
ACTION_PARAM_INT(arg5, 5);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
bool res = !!LineSpecials[special](NULL, self, false, arg1, arg2, arg3, arg4, arg5);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_SET_RESULT(res);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Checks whether this actor is a missile
|
|
|
|
// Unfortunately this was buggy in older versions of the code and many
|
|
|
|
// released DECORATE monsters rely on this bug so it can only be fixed
|
|
|
|
// with an optional flag
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
inline static bool isMissile(AActor * self, bool precise=true)
|
|
|
|
{
|
|
|
|
return self->flags&MF_MISSILE || (precise && self->GetDefault()->flags&MF_MISSILE);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// The ultimate code pointer: Fully customizable missiles!
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
enum CM_Flags
|
|
|
|
{
|
|
|
|
CMF_AIMMODE = 3,
|
|
|
|
CMF_TRACKOWNER = 4,
|
|
|
|
CMF_CHECKTARGETDEAD = 8,
|
|
|
|
};
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(6);
|
|
|
|
ACTION_PARAM_CLASS(ti, 0);
|
|
|
|
ACTION_PARAM_FIXED(SpawnHeight, 1);
|
|
|
|
ACTION_PARAM_INT(Spawnofs_XY, 2);
|
|
|
|
ACTION_PARAM_ANGLE(Angle, 3);
|
|
|
|
ACTION_PARAM_INT(flags, 4);
|
|
|
|
ACTION_PARAM_ANGLE(pitch, 5);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
int aimmode = flags & CMF_AIMMODE;
|
|
|
|
|
|
|
|
AActor * targ;
|
|
|
|
AActor * missile;
|
|
|
|
|
|
|
|
if (self->target != NULL || aimmode==2)
|
|
|
|
{
|
|
|
|
if (ti)
|
|
|
|
{
|
|
|
|
angle_t ang = (self->angle - ANGLE_90) >> ANGLETOFINESHIFT;
|
|
|
|
fixed_t x = Spawnofs_XY * finecosine[ang];
|
|
|
|
fixed_t y = Spawnofs_XY * finesine[ang];
|
|
|
|
fixed_t z = SpawnHeight - 32*FRACUNIT + (self->player? self->player->crouchoffset : 0);
|
|
|
|
|
|
|
|
switch (aimmode)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
default:
|
|
|
|
// same adjustment as above (in all 3 directions this time) - for better aiming!
|
|
|
|
self->x+=x;
|
|
|
|
self->y+=y;
|
|
|
|
self->z+=z;
|
2008-07-06 17:32:31 +00:00
|
|
|
missile = P_SpawnMissileXYZ(self->x, self->y, self->z + 32*FRACUNIT, self, self->target, ti, false);
|
2008-01-27 11:25:03 +00:00
|
|
|
self->x-=x;
|
|
|
|
self->y-=y;
|
|
|
|
self->z-=z;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2008-07-06 17:32:31 +00:00
|
|
|
missile = P_SpawnMissileXYZ(self->x+x, self->y+y, self->z+SpawnHeight, self, self->target, ti, false);
|
2008-01-27 11:25:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2008-03-20 21:19:20 +00:00
|
|
|
self->x+=x;
|
|
|
|
self->y+=y;
|
2008-07-06 17:32:31 +00:00
|
|
|
missile = P_SpawnMissileAngleZSpeed(self, self->z+SpawnHeight, ti, self->angle, 0, GetDefaultByType(ti)->Speed, self, false);
|
2008-03-20 21:19:20 +00:00
|
|
|
self->x-=x;
|
|
|
|
self->y-=y;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
// It is not necessary to use the correct angle here.
|
|
|
|
// The only important thing is that the horizontal momentum is correct.
|
|
|
|
// Therefore use 0 as the missile's angle and simplify the calculations accordingly.
|
|
|
|
// The actual momentum vector is set below.
|
|
|
|
if (missile)
|
|
|
|
{
|
|
|
|
fixed_t vx = finecosine[pitch>>ANGLETOFINESHIFT];
|
|
|
|
fixed_t vz = finesine[pitch>>ANGLETOFINESHIFT];
|
|
|
|
|
|
|
|
missile->momx = FixedMul (vx, missile->Speed);
|
|
|
|
missile->momy = 0;
|
|
|
|
missile->momz = FixedMul (vz, missile->Speed);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (missile)
|
|
|
|
{
|
|
|
|
// Use the actual momentum instead of the missile's Speed property
|
|
|
|
// so that this can handle missiles with a high vertical velocity
|
|
|
|
// component properly.
|
|
|
|
FVector3 velocity (missile->momx, missile->momy, 0);
|
|
|
|
|
|
|
|
fixed_t missilespeed = (fixed_t)velocity.Length();
|
|
|
|
|
|
|
|
missile->angle += Angle;
|
|
|
|
ang = missile->angle >> ANGLETOFINESHIFT;
|
|
|
|
missile->momx = FixedMul (missilespeed, finecosine[ang]);
|
|
|
|
missile->momy = FixedMul (missilespeed, finesine[ang]);
|
|
|
|
|
|
|
|
// handle projectile shooting projectiles - track the
|
|
|
|
// links back to a real owner
|
|
|
|
if (isMissile(self, !!(flags & CMF_TRACKOWNER)))
|
|
|
|
{
|
|
|
|
AActor * owner=self ;//->target;
|
|
|
|
while (isMissile(owner, !!(flags & CMF_TRACKOWNER)) && owner->target) owner=owner->target;
|
|
|
|
targ=owner;
|
|
|
|
missile->target=owner;
|
|
|
|
// automatic handling of seeker missiles
|
|
|
|
if (self->flags & missile->flags2 & MF2_SEEKERMISSILE)
|
|
|
|
{
|
|
|
|
missile->tracer=self->tracer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (missile->flags2&MF2_SEEKERMISSILE)
|
|
|
|
{
|
|
|
|
// automatic handling of seeker missiles
|
|
|
|
missile->tracer=self->target;
|
|
|
|
}
|
|
|
|
// set the health value so that the missile works properly
|
|
|
|
if (missile->flags4&MF4_SPECTRAL)
|
|
|
|
{
|
|
|
|
missile->health=-2;
|
|
|
|
}
|
2008-07-06 17:32:31 +00:00
|
|
|
P_CheckMissileSpawn(missile);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (flags & CMF_CHECKTARGETDEAD)
|
|
|
|
{
|
|
|
|
// Target is dead and the attack shall be aborted.
|
|
|
|
if (self->SeeState != NULL) self->SetState(self->SeeState);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// An even more customizable hitscan attack
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(7);
|
|
|
|
ACTION_PARAM_ANGLE(Spread_XY, 0);
|
|
|
|
ACTION_PARAM_ANGLE(Spread_Z, 1);
|
|
|
|
ACTION_PARAM_INT(NumBullets, 2);
|
|
|
|
ACTION_PARAM_INT(DamagePerBullet, 3);
|
|
|
|
ACTION_PARAM_CLASS(pufftype, 4);
|
|
|
|
ACTION_PARAM_FIXED(Range, 5);
|
|
|
|
ACTION_PARAM_BOOL(AimFacing, 6);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if(Range==0) Range=MISSILERANGE;
|
|
|
|
|
|
|
|
int i;
|
|
|
|
int bangle;
|
|
|
|
int bslope;
|
|
|
|
|
|
|
|
if (self->target || AimFacing)
|
|
|
|
{
|
|
|
|
if (!AimFacing) A_FaceTarget (self);
|
|
|
|
bangle = self->angle;
|
|
|
|
|
|
|
|
if (!pufftype) pufftype = PClass::FindClass(NAME_BulletPuff);
|
|
|
|
|
|
|
|
bslope = P_AimLineAttack (self, bangle, MISSILERANGE);
|
|
|
|
|
2008-06-15 17:17:31 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
|
2008-01-27 11:25:03 +00:00
|
|
|
for (i=0 ; i<NumBullets ; i++)
|
|
|
|
{
|
|
|
|
int angle = bangle + pr_cabullet.Random2() * (Spread_XY / 255);
|
|
|
|
int slope = bslope + pr_cabullet.Random2() * (Spread_Z / 255);
|
|
|
|
int damage = ((pr_cabullet()%3)+1) * DamagePerBullet;
|
|
|
|
P_LineAttack(self, angle, Range, slope, damage, GetDefaultByType(pufftype)->DamageType, pufftype);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A fully customizable melee attack
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMeleeAttack)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(5);
|
|
|
|
ACTION_PARAM_INT(damage, 0);
|
|
|
|
ACTION_PARAM_SOUND(MeleeSound, 1);
|
|
|
|
ACTION_PARAM_SOUND(MissSound, 2);
|
|
|
|
ACTION_PARAM_NAME(DamageType, 3);
|
|
|
|
ACTION_PARAM_BOOL(bleed, 4);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (DamageType==NAME_None) DamageType = NAME_Melee; // Melee is the default type
|
|
|
|
|
|
|
|
if (!self->target)
|
|
|
|
return;
|
|
|
|
|
|
|
|
A_FaceTarget (self);
|
|
|
|
if (self->CheckMeleeRange ())
|
|
|
|
{
|
2008-06-15 17:17:31 +00:00
|
|
|
if (MeleeSound) S_Sound (self, CHAN_WEAPON, MeleeSound, 1, ATTN_NORM);
|
2008-01-27 11:25:03 +00:00
|
|
|
P_DamageMobj (self->target, self, self, damage, DamageType);
|
|
|
|
if (bleed) P_TraceBleed (damage, self->target, self);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-06-15 17:17:31 +00:00
|
|
|
if (MissSound) S_Sound (self, CHAN_WEAPON, MissSound, 1, ATTN_NORM);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A fully customizable combo attack
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomComboAttack)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(6);
|
|
|
|
ACTION_PARAM_CLASS(ti, 0);
|
|
|
|
ACTION_PARAM_FIXED(SpawnHeight, 1);
|
|
|
|
ACTION_PARAM_INT(damage, 2);
|
|
|
|
ACTION_PARAM_SOUND(MeleeSound, 3);
|
|
|
|
ACTION_PARAM_NAME(DamageType, 4);
|
|
|
|
ACTION_PARAM_BOOL(bleed, 5);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (!self->target)
|
|
|
|
return;
|
|
|
|
|
|
|
|
A_FaceTarget (self);
|
|
|
|
if (self->CheckMeleeRange ())
|
|
|
|
{
|
|
|
|
if (DamageType==NAME_None) DamageType = NAME_Melee; // Melee is the default type
|
2008-06-15 17:17:31 +00:00
|
|
|
if (MeleeSound) S_Sound (self, CHAN_WEAPON, MeleeSound, 1, ATTN_NORM);
|
2008-01-27 11:25:03 +00:00
|
|
|
P_DamageMobj (self->target, self, self, damage, DamageType);
|
|
|
|
if (bleed) P_TraceBleed (damage, self->target, self);
|
|
|
|
}
|
2008-08-14 11:28:02 +00:00
|
|
|
else if (ti)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
// This seemingly senseless code is needed for proper aiming.
|
|
|
|
self->z+=SpawnHeight-32*FRACUNIT;
|
|
|
|
AActor * missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, self, self->target, ti, false);
|
|
|
|
self->z-=SpawnHeight-32*FRACUNIT;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (missile)
|
|
|
|
{
|
|
|
|
// automatic handling of seeker missiles
|
|
|
|
if (missile->flags2&MF2_SEEKERMISSILE)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
missile->tracer=self->target;
|
|
|
|
}
|
|
|
|
// set the health value so that the missile works properly
|
|
|
|
if (missile->flags4&MF4_SPECTRAL)
|
|
|
|
{
|
|
|
|
missile->health=-2;
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
2008-08-14 11:28:02 +00:00
|
|
|
P_CheckMissileSpawn(missile);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// State jump function
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfNoAmmo)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_STATE(jump, 0);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
|
|
|
if (!ACTION_CALL_FROM_WEAPON()) return;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (!self->player->ReadyWeapon->CheckAmmo(self->player->ReadyWeapon->bAltFire, false, true))
|
2008-08-14 11:28:02 +00:00
|
|
|
{
|
|
|
|
ACTION_JUMP(jump);
|
|
|
|
}
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// An even more customizable hitscan attack
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireBullets)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(7);
|
|
|
|
ACTION_PARAM_ANGLE(Spread_XY, 0);
|
|
|
|
ACTION_PARAM_ANGLE(Spread_Z, 1);
|
|
|
|
ACTION_PARAM_INT(NumberOfBullets, 2);
|
|
|
|
ACTION_PARAM_INT(DamagePerBullet, 3);
|
|
|
|
ACTION_PARAM_CLASS(PuffType, 4);
|
|
|
|
ACTION_PARAM_BOOL(UseAmmo, 5);
|
|
|
|
ACTION_PARAM_FIXED(Range, 6);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (!self->player) return;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
player_t * player=self->player;
|
|
|
|
AWeapon * weapon=player->ReadyWeapon;
|
|
|
|
|
|
|
|
int i;
|
|
|
|
int bangle;
|
|
|
|
int bslope;
|
|
|
|
|
|
|
|
if (UseAmmo && weapon)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo(weapon->bAltFire, true)) return; // out of ammo
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Range == 0) Range = PLAYERMISSILERANGE;
|
|
|
|
|
|
|
|
static_cast<APlayerPawn *>(self)->PlayAttacking2 ();
|
|
|
|
|
Update to ZDoom r905:
- Added Martin Howe's morph system update.
- Added support for defining composite textures in HIRESTEX. It is not fully tested
and right now can't do much more than the old TEXTUREx method.
- Added a few NULL pointer checks to the texture code.
- Made duplicate class names in DECORATE non-fatal. There is really no stability
concern here and the worst that can happen is that the wrong actor is spawned.
This was a constant hassle when testing with WADs that contain duplicate resources.
- Removed some GCC warnings.
- Fixed: MinGW doesn't have _get_pgmptr(), so it couldn't compile i_main.cpp.
- Fixed: MOD_WAVETABLE and MOD_SWSYNTH are not defined by w32api, so MinGW
failed compiling the new MIDI code.
- Fixed: LocalSndInfo and LocalSndSeq in S_Start() need to be const char
pointers, since "" is a constant.
- Fixed: parsecontext.h was missing a newline at the end of the file.
- Fixed: Timidity::Channel::mono, rpn, and nrpn were not initialized. In
particular, this meant that every channel was almost certainly in mono mode,
which can sound pretty bad if the song isn't meant to be played that way.
- Added bank numbers to the MIDI precaching for Timidity, since I guess I do
need to care about banks, if even the Duke MIDIs use various banks.
- Fixed: snd_midiprecache only exists in Win32 builds, so gameconfigfile.cpp
shouldn't unconditionally link against it.
- Fixed: pre_resample() was still disabled, and it left two samples at the end
of the new wave data uninitialized.
- Moved the xmap table from timidity/tables.cpp to playmidi.cpp. Now I can get
rid of timidity/tables.cpp, which conflicts in name with the main Doom
tables.cpp. (And interestingly, VC++ automatically renamed the object file,
so I wasn't aware of the problem with GCC.)
- Added a Gets function to the FileReader class which I planned to use
to enable Timidity to read its config and sound patches from Zips.
I put this on hold though after finding out that the sound quality
isn't even near that of Timidity++.
- GCC-Fixes (FString::GetChars() for Printf calls)
- Added a dummy Weapon.NOLMS flag so that Skulltag weapons using this flag
can be loaded
- Changed the MIDIStreamer to send the all notes off controller to each
channel when restarting the song, rather than emitting a single note off
event which only has 1 in 127 chance of being for a note that's playing
on that channel. Then I decided it would probably be a good idea to reset
all the controllers as well.
- Increasing the size of the internal Timidity stream buffer from 1/14 sec
(copied from the OPL player) improved its sound dramatically, so apparently
Timidity has issues with short stream buffers. It's now at 1/2 sec in
length. However, there seems to be something weird going on with
corazonazul_ff6boss.mid near the beginning where it stops and immediately
restarts a guitar on the exact same note.
- Added a new sound debugging cvar: snd_drawoutput, which can show various
oscilloscopes and spectrums.
- Eliminated some more global variables (onmobj, DoRipping, LastRipped,
MissileActor, bulletpitch and linetarget.)
- Internal TiMidity now plays music. Unfortunately, it doesn't sound right. :(
- Changed the progdir global variable into an FString.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@90 b0f79afe-0144-0410-b225-9a4edf0717df
2008-04-12 18:59:23 +00:00
|
|
|
bslope = P_BulletSlope(self);
|
2008-01-27 11:25:03 +00:00
|
|
|
bangle = self->angle;
|
|
|
|
|
|
|
|
if (!PuffType) PuffType = PClass::FindClass(NAME_BulletPuff);
|
|
|
|
|
2008-06-15 17:17:31 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, weapon->AttackSound, 1, ATTN_NORM);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if ((NumberOfBullets==1 && !player->refire) || NumberOfBullets==0)
|
|
|
|
{
|
|
|
|
int damage = ((pr_cwbullet()%3)+1)*DamagePerBullet;
|
|
|
|
P_LineAttack(self, bangle, Range, bslope, damage, GetDefaultByType(PuffType)->DamageType, PuffType);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (NumberOfBullets == -1) NumberOfBullets = 1;
|
|
|
|
for (i=0 ; i<NumberOfBullets ; i++)
|
|
|
|
{
|
|
|
|
int angle = bangle + pr_cwbullet.Random2() * (Spread_XY / 255);
|
|
|
|
int slope = bslope + pr_cwbullet.Random2() * (Spread_Z / 255);
|
|
|
|
int damage = ((pr_cwbullet()%3)+1) * DamagePerBullet;
|
|
|
|
P_LineAttack(self, angle, Range, slope, damage, GetDefaultByType(PuffType)->DamageType, PuffType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A_FireProjectile
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(6);
|
|
|
|
ACTION_PARAM_CLASS(ti, 0);
|
|
|
|
ACTION_PARAM_ANGLE(Angle, 1);
|
|
|
|
ACTION_PARAM_BOOL(UseAmmo, 2);
|
|
|
|
ACTION_PARAM_INT(SpawnOfs_XY, 3);
|
|
|
|
ACTION_PARAM_FIXED(SpawnHeight, 4);
|
|
|
|
ACTION_PARAM_BOOL(AimAtAngle, 5);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (!self->player) return;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
player_t *player=self->player;
|
|
|
|
AWeapon * weapon=player->ReadyWeapon;
|
Update to ZDoom r905:
- Added Martin Howe's morph system update.
- Added support for defining composite textures in HIRESTEX. It is not fully tested
and right now can't do much more than the old TEXTUREx method.
- Added a few NULL pointer checks to the texture code.
- Made duplicate class names in DECORATE non-fatal. There is really no stability
concern here and the worst that can happen is that the wrong actor is spawned.
This was a constant hassle when testing with WADs that contain duplicate resources.
- Removed some GCC warnings.
- Fixed: MinGW doesn't have _get_pgmptr(), so it couldn't compile i_main.cpp.
- Fixed: MOD_WAVETABLE and MOD_SWSYNTH are not defined by w32api, so MinGW
failed compiling the new MIDI code.
- Fixed: LocalSndInfo and LocalSndSeq in S_Start() need to be const char
pointers, since "" is a constant.
- Fixed: parsecontext.h was missing a newline at the end of the file.
- Fixed: Timidity::Channel::mono, rpn, and nrpn were not initialized. In
particular, this meant that every channel was almost certainly in mono mode,
which can sound pretty bad if the song isn't meant to be played that way.
- Added bank numbers to the MIDI precaching for Timidity, since I guess I do
need to care about banks, if even the Duke MIDIs use various banks.
- Fixed: snd_midiprecache only exists in Win32 builds, so gameconfigfile.cpp
shouldn't unconditionally link against it.
- Fixed: pre_resample() was still disabled, and it left two samples at the end
of the new wave data uninitialized.
- Moved the xmap table from timidity/tables.cpp to playmidi.cpp. Now I can get
rid of timidity/tables.cpp, which conflicts in name with the main Doom
tables.cpp. (And interestingly, VC++ automatically renamed the object file,
so I wasn't aware of the problem with GCC.)
- Added a Gets function to the FileReader class which I planned to use
to enable Timidity to read its config and sound patches from Zips.
I put this on hold though after finding out that the sound quality
isn't even near that of Timidity++.
- GCC-Fixes (FString::GetChars() for Printf calls)
- Added a dummy Weapon.NOLMS flag so that Skulltag weapons using this flag
can be loaded
- Changed the MIDIStreamer to send the all notes off controller to each
channel when restarting the song, rather than emitting a single note off
event which only has 1 in 127 chance of being for a note that's playing
on that channel. Then I decided it would probably be a good idea to reset
all the controllers as well.
- Increasing the size of the internal Timidity stream buffer from 1/14 sec
(copied from the OPL player) improved its sound dramatically, so apparently
Timidity has issues with short stream buffers. It's now at 1/2 sec in
length. However, there seems to be something weird going on with
corazonazul_ff6boss.mid near the beginning where it stops and immediately
restarts a guitar on the exact same note.
- Added a new sound debugging cvar: snd_drawoutput, which can show various
oscilloscopes and spectrums.
- Eliminated some more global variables (onmobj, DoRipping, LastRipped,
MissileActor, bulletpitch and linetarget.)
- Internal TiMidity now plays music. Unfortunately, it doesn't sound right. :(
- Changed the progdir global variable into an FString.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@90 b0f79afe-0144-0410-b225-9a4edf0717df
2008-04-12 18:59:23 +00:00
|
|
|
AActor *linetarget;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (UseAmmo && weapon)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo(weapon->bAltFire, true)) return; // out of ammo
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ti)
|
|
|
|
{
|
|
|
|
angle_t ang = (self->angle - ANGLE_90) >> ANGLETOFINESHIFT;
|
|
|
|
fixed_t x = SpawnOfs_XY * finecosine[ang];
|
|
|
|
fixed_t y = SpawnOfs_XY * finesine[ang];
|
|
|
|
fixed_t z = SpawnHeight;
|
|
|
|
fixed_t shootangle = self->angle;
|
|
|
|
|
|
|
|
if (AimAtAngle) shootangle+=Angle;
|
|
|
|
|
Update to ZDoom r905:
- Added Martin Howe's morph system update.
- Added support for defining composite textures in HIRESTEX. It is not fully tested
and right now can't do much more than the old TEXTUREx method.
- Added a few NULL pointer checks to the texture code.
- Made duplicate class names in DECORATE non-fatal. There is really no stability
concern here and the worst that can happen is that the wrong actor is spawned.
This was a constant hassle when testing with WADs that contain duplicate resources.
- Removed some GCC warnings.
- Fixed: MinGW doesn't have _get_pgmptr(), so it couldn't compile i_main.cpp.
- Fixed: MOD_WAVETABLE and MOD_SWSYNTH are not defined by w32api, so MinGW
failed compiling the new MIDI code.
- Fixed: LocalSndInfo and LocalSndSeq in S_Start() need to be const char
pointers, since "" is a constant.
- Fixed: parsecontext.h was missing a newline at the end of the file.
- Fixed: Timidity::Channel::mono, rpn, and nrpn were not initialized. In
particular, this meant that every channel was almost certainly in mono mode,
which can sound pretty bad if the song isn't meant to be played that way.
- Added bank numbers to the MIDI precaching for Timidity, since I guess I do
need to care about banks, if even the Duke MIDIs use various banks.
- Fixed: snd_midiprecache only exists in Win32 builds, so gameconfigfile.cpp
shouldn't unconditionally link against it.
- Fixed: pre_resample() was still disabled, and it left two samples at the end
of the new wave data uninitialized.
- Moved the xmap table from timidity/tables.cpp to playmidi.cpp. Now I can get
rid of timidity/tables.cpp, which conflicts in name with the main Doom
tables.cpp. (And interestingly, VC++ automatically renamed the object file,
so I wasn't aware of the problem with GCC.)
- Added a Gets function to the FileReader class which I planned to use
to enable Timidity to read its config and sound patches from Zips.
I put this on hold though after finding out that the sound quality
isn't even near that of Timidity++.
- GCC-Fixes (FString::GetChars() for Printf calls)
- Added a dummy Weapon.NOLMS flag so that Skulltag weapons using this flag
can be loaded
- Changed the MIDIStreamer to send the all notes off controller to each
channel when restarting the song, rather than emitting a single note off
event which only has 1 in 127 chance of being for a note that's playing
on that channel. Then I decided it would probably be a good idea to reset
all the controllers as well.
- Increasing the size of the internal Timidity stream buffer from 1/14 sec
(copied from the OPL player) improved its sound dramatically, so apparently
Timidity has issues with short stream buffers. It's now at 1/2 sec in
length. However, there seems to be something weird going on with
corazonazul_ff6boss.mid near the beginning where it stops and immediately
restarts a guitar on the exact same note.
- Added a new sound debugging cvar: snd_drawoutput, which can show various
oscilloscopes and spectrums.
- Eliminated some more global variables (onmobj, DoRipping, LastRipped,
MissileActor, bulletpitch and linetarget.)
- Internal TiMidity now plays music. Unfortunately, it doesn't sound right. :(
- Changed the progdir global variable into an FString.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@90 b0f79afe-0144-0410-b225-9a4edf0717df
2008-04-12 18:59:23 +00:00
|
|
|
AActor * misl=P_SpawnPlayerMissile (self, x, y, z, ti, shootangle, &linetarget);
|
2008-01-27 11:25:03 +00:00
|
|
|
// automatic handling of seeker missiles
|
|
|
|
if (misl)
|
|
|
|
{
|
|
|
|
if (linetarget && misl->flags2&MF2_SEEKERMISSILE) misl->tracer=linetarget;
|
|
|
|
if (!AimAtAngle)
|
|
|
|
{
|
|
|
|
// This original implementation is to aim straight ahead and then offset
|
|
|
|
// the angle from the resulting direction.
|
|
|
|
FVector3 velocity(misl->momx, misl->momy, 0);
|
|
|
|
fixed_t missilespeed = (fixed_t)velocity.Length();
|
|
|
|
misl->angle += Angle;
|
|
|
|
angle_t an = misl->angle >> ANGLETOFINESHIFT;
|
|
|
|
misl->momx = FixedMul (missilespeed, finecosine[an]);
|
|
|
|
misl->momy = FixedMul (missilespeed, finesine[an]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A_CustomPunch
|
|
|
|
//
|
|
|
|
// Berserk is not handled here. That can be done with A_CheckIfInventory
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(5);
|
|
|
|
ACTION_PARAM_INT(Damage, 0);
|
|
|
|
ACTION_PARAM_BOOL(norandom, 1);
|
|
|
|
ACTION_PARAM_BOOL(UseAmmo, 2);
|
|
|
|
ACTION_PARAM_CLASS(PuffType, 3);
|
|
|
|
ACTION_PARAM_FIXED(Range, 4);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (!self->player) return;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
player_t *player=self->player;
|
|
|
|
AWeapon * weapon=player->ReadyWeapon;
|
|
|
|
|
|
|
|
|
|
|
|
angle_t angle;
|
|
|
|
int pitch;
|
Update to ZDoom r905:
- Added Martin Howe's morph system update.
- Added support for defining composite textures in HIRESTEX. It is not fully tested
and right now can't do much more than the old TEXTUREx method.
- Added a few NULL pointer checks to the texture code.
- Made duplicate class names in DECORATE non-fatal. There is really no stability
concern here and the worst that can happen is that the wrong actor is spawned.
This was a constant hassle when testing with WADs that contain duplicate resources.
- Removed some GCC warnings.
- Fixed: MinGW doesn't have _get_pgmptr(), so it couldn't compile i_main.cpp.
- Fixed: MOD_WAVETABLE and MOD_SWSYNTH are not defined by w32api, so MinGW
failed compiling the new MIDI code.
- Fixed: LocalSndInfo and LocalSndSeq in S_Start() need to be const char
pointers, since "" is a constant.
- Fixed: parsecontext.h was missing a newline at the end of the file.
- Fixed: Timidity::Channel::mono, rpn, and nrpn were not initialized. In
particular, this meant that every channel was almost certainly in mono mode,
which can sound pretty bad if the song isn't meant to be played that way.
- Added bank numbers to the MIDI precaching for Timidity, since I guess I do
need to care about banks, if even the Duke MIDIs use various banks.
- Fixed: snd_midiprecache only exists in Win32 builds, so gameconfigfile.cpp
shouldn't unconditionally link against it.
- Fixed: pre_resample() was still disabled, and it left two samples at the end
of the new wave data uninitialized.
- Moved the xmap table from timidity/tables.cpp to playmidi.cpp. Now I can get
rid of timidity/tables.cpp, which conflicts in name with the main Doom
tables.cpp. (And interestingly, VC++ automatically renamed the object file,
so I wasn't aware of the problem with GCC.)
- Added a Gets function to the FileReader class which I planned to use
to enable Timidity to read its config and sound patches from Zips.
I put this on hold though after finding out that the sound quality
isn't even near that of Timidity++.
- GCC-Fixes (FString::GetChars() for Printf calls)
- Added a dummy Weapon.NOLMS flag so that Skulltag weapons using this flag
can be loaded
- Changed the MIDIStreamer to send the all notes off controller to each
channel when restarting the song, rather than emitting a single note off
event which only has 1 in 127 chance of being for a note that's playing
on that channel. Then I decided it would probably be a good idea to reset
all the controllers as well.
- Increasing the size of the internal Timidity stream buffer from 1/14 sec
(copied from the OPL player) improved its sound dramatically, so apparently
Timidity has issues with short stream buffers. It's now at 1/2 sec in
length. However, there seems to be something weird going on with
corazonazul_ff6boss.mid near the beginning where it stops and immediately
restarts a guitar on the exact same note.
- Added a new sound debugging cvar: snd_drawoutput, which can show various
oscilloscopes and spectrums.
- Eliminated some more global variables (onmobj, DoRipping, LastRipped,
MissileActor, bulletpitch and linetarget.)
- Internal TiMidity now plays music. Unfortunately, it doesn't sound right. :(
- Changed the progdir global variable into an FString.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@90 b0f79afe-0144-0410-b225-9a4edf0717df
2008-04-12 18:59:23 +00:00
|
|
|
AActor * linetarget;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (!norandom) Damage *= (pr_cwpunch()%8+1);
|
|
|
|
|
|
|
|
angle = self->angle + (pr_cwpunch.Random2() << 18);
|
|
|
|
if (Range == 0) Range = MELEERANGE;
|
Update to ZDoom r905:
- Added Martin Howe's morph system update.
- Added support for defining composite textures in HIRESTEX. It is not fully tested
and right now can't do much more than the old TEXTUREx method.
- Added a few NULL pointer checks to the texture code.
- Made duplicate class names in DECORATE non-fatal. There is really no stability
concern here and the worst that can happen is that the wrong actor is spawned.
This was a constant hassle when testing with WADs that contain duplicate resources.
- Removed some GCC warnings.
- Fixed: MinGW doesn't have _get_pgmptr(), so it couldn't compile i_main.cpp.
- Fixed: MOD_WAVETABLE and MOD_SWSYNTH are not defined by w32api, so MinGW
failed compiling the new MIDI code.
- Fixed: LocalSndInfo and LocalSndSeq in S_Start() need to be const char
pointers, since "" is a constant.
- Fixed: parsecontext.h was missing a newline at the end of the file.
- Fixed: Timidity::Channel::mono, rpn, and nrpn were not initialized. In
particular, this meant that every channel was almost certainly in mono mode,
which can sound pretty bad if the song isn't meant to be played that way.
- Added bank numbers to the MIDI precaching for Timidity, since I guess I do
need to care about banks, if even the Duke MIDIs use various banks.
- Fixed: snd_midiprecache only exists in Win32 builds, so gameconfigfile.cpp
shouldn't unconditionally link against it.
- Fixed: pre_resample() was still disabled, and it left two samples at the end
of the new wave data uninitialized.
- Moved the xmap table from timidity/tables.cpp to playmidi.cpp. Now I can get
rid of timidity/tables.cpp, which conflicts in name with the main Doom
tables.cpp. (And interestingly, VC++ automatically renamed the object file,
so I wasn't aware of the problem with GCC.)
- Added a Gets function to the FileReader class which I planned to use
to enable Timidity to read its config and sound patches from Zips.
I put this on hold though after finding out that the sound quality
isn't even near that of Timidity++.
- GCC-Fixes (FString::GetChars() for Printf calls)
- Added a dummy Weapon.NOLMS flag so that Skulltag weapons using this flag
can be loaded
- Changed the MIDIStreamer to send the all notes off controller to each
channel when restarting the song, rather than emitting a single note off
event which only has 1 in 127 chance of being for a note that's playing
on that channel. Then I decided it would probably be a good idea to reset
all the controllers as well.
- Increasing the size of the internal Timidity stream buffer from 1/14 sec
(copied from the OPL player) improved its sound dramatically, so apparently
Timidity has issues with short stream buffers. It's now at 1/2 sec in
length. However, there seems to be something weird going on with
corazonazul_ff6boss.mid near the beginning where it stops and immediately
restarts a guitar on the exact same note.
- Added a new sound debugging cvar: snd_drawoutput, which can show various
oscilloscopes and spectrums.
- Eliminated some more global variables (onmobj, DoRipping, LastRipped,
MissileActor, bulletpitch and linetarget.)
- Internal TiMidity now plays music. Unfortunately, it doesn't sound right. :(
- Changed the progdir global variable into an FString.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@90 b0f79afe-0144-0410-b225-9a4edf0717df
2008-04-12 18:59:23 +00:00
|
|
|
pitch = P_AimLineAttack (self, angle, Range, &linetarget);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
// only use ammo when actually hitting something!
|
|
|
|
if (UseAmmo && linetarget && weapon)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo(weapon->bAltFire, true)) return; // out of ammo
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!PuffType) PuffType = PClass::FindClass(NAME_BulletPuff);
|
|
|
|
|
- Fixed: The players were not added to FS's list of spawned things.
- Update to ZDoom r882
- Added the option to use $ as a prefix to a string table name everywhere in
MAPINFO where 'lookup' could be specified so that there is one consistent
way to do it.
- Externalized all default episode definitions. Added an 'optional' keyword
to handle M4 and 5 in Doom and Heretic.
- Added P_CheckMapData function and replaced all calls to P_OpenMapData that
only checked for a map's presence with it.
- Added Martin Howe's player statusbar face submission.
- Added an 'adddefaultmap' option for MAPINFO. This is the same as 'defaultmap'
but keeps all existing information in the default and just adds to it. This
is needed because Hexen and Strife set some information in their base
MAPINFO and using 'defaultmap' in a PWAD would override that.
- Fixed: Using MAPINFO's f1 option could cause memory leaks.
- Added option to load lumps by full name to several places:
* Finale texts loaded from a text lump
* Demos
* Local SNDINFOs
* Local SNDSEQs
* Image names in FONTDEFS
* intermission script names
- Changed the STCFN121 handling. The character is not an 'I' but a '|' so
instead of discarding it it should be inserted at position 124.
- Renamed indexfont.fon to indexfont so that I could remove a special case
from V_GetFont that was just added for this one font.
- Added a 'dumpspawnedthings' CVAR that enables a listing of all things in
the map and the actor type they spawned.
SBarInfo Update #16
- Added: fillzeros flag for drawnumber. When set the string will always have
a length of the specified size and zeros will fill in for the missing places.
If the number is negative the negative sign will take the place of the last
digit.
- Added: globalarray type to drawnumber which will display the value in a
global array with the index set to the player's number. Untested.
- Added: isselected command to SBarInfo.
- Fixed: Bi and Tri colored numbers didn't work.
- Fixed: Crash when using nullimage as the last image in drawswitchableimage.
- Applied Graf suggestion to include the y coord when calulating heights to fix
most of the gaps caused by round off errors. At least for now anyways and it
is only applied for drawimage.
- SBarInfo inventory bars have been converted to use screen->DrawTexture()
- Increased limit for demon/melee to 4.
- Fixed: P_CheckSwitchRange accessed invalid memory when testing a one-sided
line.
- Fixed: P_SpawnPuff assumed that all melee attacks have the same range
(MELEERANGE) and didn't set the puff to its melee state if the range
was different. Even worse, it checked a global variable for this so
the behavior was undefined when P_SpawnPuff was called from anywhere
else but P_LineAttack. To reduce the amount of parameters I combined
this information with the hitthing and temporary parameters into one
flags parameter. Also changed P_LineAttack so that it gets passed
an additional parameter that specifies whether the attack is a melee
attack or not and set this to true in all calls that are to be considered
melee attacks. I couldn't use the damage type because A_CustomPunch
and A_CustomMeleeAttack allow passing any damage type they want.
- Added a sprite option as an alternative of particles for FX_ROCKET
and FX_GRENADE.
- Fixed: The minimum parameter count for ACS_Execute and ACS_ExecuteAlways for
DECORATE was wrong (2 instead of 1.)
- Changed: Hexen set every cluster to be a hub if it hadn't been defined before
a level using this cluster. Now it will only do that if HexenHack is true,
i.e. when original Hexen format MAPINFOs are parsed. For ZDoom format
MAPINFOs it will now be the same as for the other games which means that
'hub' has to be declared explicitly.
- Added an Idle state that is entered in place of the spawn state if a monster
has to return to its inactive state if it can't find any more targets.
- Added MF5_NOINTERACTION flag which completely disables all physics related
code for any actor with this flag. Mostly useful for particle effects where
the actors just move a certain distance and then disappear.
- Removed the last remains of the antialias precalculation code from
am_map.cpp because it was no longer used.
- Fixed: Two-sided lines bordering a secret sector were not drawn in the
proper color
- Fixed: The automap didn't check ACS_LockedExecuteDoor for its lock color.
- Switched sounds local to the listener from head-relative 3D sounds to 2D
sounds so stereo sounds have full separation. I tried using set3DSpread,
but that still caused some blending of the channels.
- Changed FScanner so that opening a lump gives the complete wad+lump name
rather than a generic one, so identifying errors among files that all have
the same lump name no longer involves any degree of guesswork in
determining exactly which file the error occurred in.
- Added a check to S_ParseSndSeq() for SNDSEQ lumps with unterminated final
sequences.
- Fixed: Parts of s_sndseq.cpp that scan the Sequences array need NULL
pointer checks, in case an improper sequence was encountered during
parsing but not early enough to avoid creating a slot for it in the array.
- Added support for dumping from RAW/DRO/IMF files, so now anything that
can be played as OPL can also be dumped.
- Removed the opl_enable cvar, since OPL playback is now selectable as just
another MIDI device.
- Added support for DRO playback and dual-chip RAW playback.
- Removed MUS support from OPLMUSSong, since using the OPLMIDIDevice with
MUSSong2 works just as well. There are still lots of leftover bits in
the class that should probably be removed at some point, too.
- Added dual-chip dumping support for the RAW format.
- Added DosBox Raw OPL (.DRO) dumping support. For whatever reason,
in_adlib calculates the song length for this format wrong, even though
the exact length is stored right in the header. (But in_adlib seems buggy
in general; too bad it's the only Windows version of Adplug that seems to
exist.)
- Rewrote the OPL dumper to work with MIDI as well as MUS.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@86 b0f79afe-0144-0410-b225-9a4edf0717df
2008-04-05 13:28:48 +00:00
|
|
|
P_LineAttack (self, angle, Range, pitch, Damage, GetDefaultByType(PuffType)->DamageType, PuffType, true);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
// turn to face target
|
|
|
|
if (linetarget)
|
|
|
|
{
|
2008-06-15 17:17:31 +00:00
|
|
|
S_Sound (self, CHAN_WEAPON, weapon->AttackSound, 1, ATTN_NORM);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
self->angle = R_PointToAngle2 (self->x,
|
|
|
|
self->y,
|
|
|
|
linetarget->x,
|
|
|
|
linetarget->y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// customizable railgun attack function
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(8);
|
|
|
|
ACTION_PARAM_INT(Damage, 0);
|
|
|
|
ACTION_PARAM_INT(Spawnofs_XY, 1);
|
|
|
|
ACTION_PARAM_BOOL(UseAmmo, 2);
|
|
|
|
ACTION_PARAM_COLOR(Color1, 3);
|
|
|
|
ACTION_PARAM_COLOR(Color2, 4);
|
|
|
|
ACTION_PARAM_BOOL(Silent, 5);
|
|
|
|
ACTION_PARAM_FLOAT(MaxDiff, 6);
|
|
|
|
ACTION_PARAM_NAME(PuffTypeName, 7);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (!self->player) return;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
AWeapon * weapon=self->player->ReadyWeapon;
|
|
|
|
|
|
|
|
// only use ammo when actually hitting something!
|
|
|
|
if (UseAmmo)
|
|
|
|
{
|
|
|
|
if (!weapon->DepleteAmmo(weapon->bAltFire, true)) return; // out of ammo
|
|
|
|
}
|
|
|
|
|
|
|
|
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, Silent, PuffTypeName);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// also for monsters
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(8);
|
|
|
|
ACTION_PARAM_INT(Damage, 0);
|
|
|
|
ACTION_PARAM_INT(Spawnofs_XY, 1);
|
|
|
|
ACTION_PARAM_COLOR(Color1, 2);
|
|
|
|
ACTION_PARAM_COLOR(Color2, 3);
|
|
|
|
ACTION_PARAM_BOOL(Silent, 4);
|
|
|
|
ACTION_PARAM_BOOL(aim, 5);
|
|
|
|
ACTION_PARAM_FLOAT(MaxDiff, 6);
|
|
|
|
ACTION_PARAM_NAME(PuffTypeName, 7);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
if (aim && self->target == NULL)
|
2008-01-27 15:34:47 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-01-27 11:25:03 +00:00
|
|
|
// [RH] Andy Baker's stealth monsters
|
2008-08-12 08:00:28 +00:00
|
|
|
if (self->flags & MF_STEALTH)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 08:00:28 +00:00
|
|
|
self->visdir = 1;
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
self->flags &= ~MF_AMBUSH;
|
2008-01-27 15:34:47 +00:00
|
|
|
|
2008-01-27 11:25:03 +00:00
|
|
|
if (aim)
|
|
|
|
{
|
2008-08-12 08:00:28 +00:00
|
|
|
self->angle = R_PointToAngle2 (self->x,
|
|
|
|
self->y,
|
|
|
|
self->target->x,
|
|
|
|
self->target->y);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
// Let the aim trail behind the player
|
|
|
|
if (aim)
|
|
|
|
{
|
2008-08-12 08:00:28 +00:00
|
|
|
self->angle = R_PointToAngle2 (self->x,
|
|
|
|
self->y,
|
|
|
|
self->target->x - self->target->momx * 3,
|
|
|
|
self->target->y - self->target->momy * 3);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
if (self->target->flags & MF_SHADOW)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 08:00:28 +00:00
|
|
|
self->angle += pr_crailgun.Random2() << 21;
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, Silent, PuffTypeName);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// DoGiveInventory
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
static void DoGiveInventory(AActor * self, AActor * receiver, DECLARE_PARAMINFO)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(2);
|
|
|
|
ACTION_PARAM_CLASS(mi, 0);
|
|
|
|
ACTION_PARAM_INT(amount, 1);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
bool res=true;
|
|
|
|
if (receiver == NULL) return;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (amount==0) amount=1;
|
|
|
|
if (mi)
|
|
|
|
{
|
|
|
|
AInventory *item = static_cast<AInventory *>(Spawn (mi, 0, 0, 0, NO_REPLACE));
|
|
|
|
if (item->IsKindOf(RUNTIME_CLASS(AHealth)))
|
|
|
|
{
|
|
|
|
item->Amount *= amount;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
item->Amount = amount;
|
|
|
|
}
|
|
|
|
item->flags |= MF_DROPPED;
|
|
|
|
if (item->flags & MF_COUNTITEM)
|
|
|
|
{
|
|
|
|
item->flags&=~MF_COUNTITEM;
|
|
|
|
level.total_items--;
|
|
|
|
}
|
|
|
|
if (!item->TryPickup (receiver))
|
|
|
|
{
|
|
|
|
item->Destroy ();
|
|
|
|
res = false;
|
|
|
|
}
|
|
|
|
else res = true;
|
|
|
|
}
|
|
|
|
else res = false;
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_SET_RESULT(res);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveInventory)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 23:22:08 +00:00
|
|
|
DoGiveInventory(self, self, PUSH_PARAMINFO);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToTarget)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 23:22:08 +00:00
|
|
|
DoGiveInventory(self, self->target, PUSH_PARAMINFO);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_TakeInventory
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
void DoTakeInventory(AActor * self, AActor * receiver, DECLARE_PARAMINFO)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(2);
|
|
|
|
ACTION_PARAM_CLASS(item, 0);
|
|
|
|
ACTION_PARAM_INT(amount, 1);
|
|
|
|
|
|
|
|
if (receiver == NULL) return;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
bool res = false;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
AInventory * inv = receiver->FindInventory(item);
|
|
|
|
|
|
|
|
if (inv && !inv->IsKindOf(RUNTIME_CLASS(AHexenArmor)))
|
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
if (inv->Amount > 0)
|
|
|
|
{
|
|
|
|
res = true;
|
|
|
|
}
|
2008-01-27 11:25:03 +00:00
|
|
|
if (!amount || amount>=inv->Amount)
|
|
|
|
{
|
|
|
|
if (inv->ItemFlags&IF_KEEPDEPLETED) inv->Amount=0;
|
|
|
|
else inv->Destroy();
|
|
|
|
}
|
|
|
|
else inv->Amount-=amount;
|
|
|
|
}
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_SET_RESULT(res);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeInventory)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 23:22:08 +00:00
|
|
|
DoTakeInventory(self, self, PUSH_PARAMINFO);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromTarget)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 23:22:08 +00:00
|
|
|
DoTakeInventory(self, self->target, PUSH_PARAMINFO);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Common code for A_SpawnItem and A_SpawnItemEx
|
|
|
|
//
|
|
|
|
//===========================================================================
|
Update to ZDoom r1017:
- Fixed: MAPINFO's 'lookup' option should only work for actual strings but
not for lump and file names.
- Added a few 'activator == NULL' checks to some ACS functions.
- Added line and vertex lists to polyobjects so that I can do some
changes that won't work with only a seg list being maintained.
(SBarInfo update #23)
- Fixed: Drawing the amount of an inventory item in the player's inventory did
not work
- Added: PowerupTime to drawnumber and drawbar. You must specify a
powerupgiver. Although drawnumber goes in seconds the powerup has left
drawbar will use ticks for extra accuracy.
- I have increased cross-port compatibility with Skulltag. If an unknown
game mode is provided for sbarinfo's gamemode command it will ignore it and
continue.
- Added an option to consider intermission screens gameplay for purposes of
capturing the mouse.
- Changed: Telefragging should not thrust the victim if it isn't in precisely the
same position as the killer.
- fixed: A_SpawnItemEx must call P_TeleportMove before checking the spawned
object's position.
- Fixed: Ouch state was far to easy to achieve.
- Made all the basic texture classes local to their implementation.
They are not needed anywhere else.
- Changed the HackHack hack for corrupt 256 pixel high textures that
FMultiPatchTexture only calls a virtual function instead of doing any
type checks of the patch itself.
- Cleaned up the constant definitions in doomdata.h.
- Moved the TEXTUREx structures from doomdata.h to multipatchtexture.cpp
because they are used only in this one file.
- Removed some more typedefs from r_defs.h and doomdata.h
- Moved local polyobject data definitions from p_local.h to po_man.cpp.
- Renamed player_s to player_t globally to get rid of the duplicate names
for this class.
- Added coordinate range checking to DCanvas::ParseDrawTextureTags() to avoid
potential crashes in the situation that con_scaletext is 2 and somebody
uses a hud message as if a hud size was specified, but forgot to actually
set the hud size.
- Consolidated the mug shot code shared by DSBarInfo and DDoomStatusBar
into a single place.
- Fixed: Setting an invalid mug shot state crashed the game.
- Fixed my attempts to be clever with strings yesterday.
- If an actor's current target temporarily goes unshootable, its threshold
is now reset to 0, so it will more readily switch back to it.
- Fixed: Deactivating the game no longer allows reverb effects to continue
playing while the sound is paused.
- Fixed: S_StartNamedSound() looked for SECF_SILENT in MoreFlags instead of
Flags.
- Fixed: DSBarInfo::updateState() and DDoomStatusBar::UpdateState() sprung
leaks and didn't allocate enough space for the fullStateName string.
- Disabled DUMB's mono destination mixers. It's not like I'm ever going to
target an original SoundBlaster, so they're a waste of space to have around.
This trims resample.obj down to ~60k now.
- Fixed: PrtScn/SysRq key did not work on Linux.
- Added an alternate module replay engine that uses foo_dumb's replayer, a
heavily customized version of DUMB (Dynamic Universal Music Bibliotheque).
It has been slightly modified by me:
* Added support for Ogg Vorbis-compressed samples in XM files ala FMOD.
* Removed excessive mallocs from the replay core.
* Rerolled the loops in resample.c. Unrolling them made the object file
~250k large while providing little benefit. Even at ~100k, I think it's
still larger than it ought to be, but I'll live with it for now.
Other than that, it's essentially the same thing you'd hear in foobar2000,
minus some subsong detection features. Release builds of the library look
like they might even be slightly faster than FMOD, which is a plus.
- Fixed: Timidity::font_add() did not release the file reader it created.
- Fixed: The SF2 loader did not free the sample headers in its destructor.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@113 b0f79afe-0144-0410-b225-9a4edf0717df
2008-06-03 21:48:49 +00:00
|
|
|
enum SIX_Flags
|
|
|
|
{
|
|
|
|
SIXF_TRANSFERTRANSLATION=1,
|
|
|
|
SIXF_ABSOLUTEPOSITION=2,
|
|
|
|
SIXF_ABSOLUTEANGLE=4,
|
|
|
|
SIXF_ABSOLUTEMOMENTUM=8,
|
|
|
|
SIXF_SETMASTER=16,
|
|
|
|
SIXF_NOCHECKPOSITION=32,
|
|
|
|
SIXF_TELEFRAG=64,
|
|
|
|
// 128 is used by Skulltag!
|
|
|
|
SIXF_TRANSFERAMBUSHFLAG=256,
|
|
|
|
};
|
|
|
|
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
static bool InitSpawnedItem(AActor *self, AActor *mo, int flags)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
if (mo)
|
|
|
|
{
|
|
|
|
AActor * originator = self;
|
|
|
|
|
Update to ZDoom r1017:
- Fixed: MAPINFO's 'lookup' option should only work for actual strings but
not for lump and file names.
- Added a few 'activator == NULL' checks to some ACS functions.
- Added line and vertex lists to polyobjects so that I can do some
changes that won't work with only a seg list being maintained.
(SBarInfo update #23)
- Fixed: Drawing the amount of an inventory item in the player's inventory did
not work
- Added: PowerupTime to drawnumber and drawbar. You must specify a
powerupgiver. Although drawnumber goes in seconds the powerup has left
drawbar will use ticks for extra accuracy.
- I have increased cross-port compatibility with Skulltag. If an unknown
game mode is provided for sbarinfo's gamemode command it will ignore it and
continue.
- Added an option to consider intermission screens gameplay for purposes of
capturing the mouse.
- Changed: Telefragging should not thrust the victim if it isn't in precisely the
same position as the killer.
- fixed: A_SpawnItemEx must call P_TeleportMove before checking the spawned
object's position.
- Fixed: Ouch state was far to easy to achieve.
- Made all the basic texture classes local to their implementation.
They are not needed anywhere else.
- Changed the HackHack hack for corrupt 256 pixel high textures that
FMultiPatchTexture only calls a virtual function instead of doing any
type checks of the patch itself.
- Cleaned up the constant definitions in doomdata.h.
- Moved the TEXTUREx structures from doomdata.h to multipatchtexture.cpp
because they are used only in this one file.
- Removed some more typedefs from r_defs.h and doomdata.h
- Moved local polyobject data definitions from p_local.h to po_man.cpp.
- Renamed player_s to player_t globally to get rid of the duplicate names
for this class.
- Added coordinate range checking to DCanvas::ParseDrawTextureTags() to avoid
potential crashes in the situation that con_scaletext is 2 and somebody
uses a hud message as if a hud size was specified, but forgot to actually
set the hud size.
- Consolidated the mug shot code shared by DSBarInfo and DDoomStatusBar
into a single place.
- Fixed: Setting an invalid mug shot state crashed the game.
- Fixed my attempts to be clever with strings yesterday.
- If an actor's current target temporarily goes unshootable, its threshold
is now reset to 0, so it will more readily switch back to it.
- Fixed: Deactivating the game no longer allows reverb effects to continue
playing while the sound is paused.
- Fixed: S_StartNamedSound() looked for SECF_SILENT in MoreFlags instead of
Flags.
- Fixed: DSBarInfo::updateState() and DDoomStatusBar::UpdateState() sprung
leaks and didn't allocate enough space for the fullStateName string.
- Disabled DUMB's mono destination mixers. It's not like I'm ever going to
target an original SoundBlaster, so they're a waste of space to have around.
This trims resample.obj down to ~60k now.
- Fixed: PrtScn/SysRq key did not work on Linux.
- Added an alternate module replay engine that uses foo_dumb's replayer, a
heavily customized version of DUMB (Dynamic Universal Music Bibliotheque).
It has been slightly modified by me:
* Added support for Ogg Vorbis-compressed samples in XM files ala FMOD.
* Removed excessive mallocs from the replay core.
* Rerolled the loops in resample.c. Unrolling them made the object file
~250k large while providing little benefit. Even at ~100k, I think it's
still larger than it ought to be, but I'll live with it for now.
Other than that, it's essentially the same thing you'd hear in foobar2000,
minus some subsong detection features. Release builds of the library look
like they might even be slightly faster than FMOD, which is a plus.
- Fixed: Timidity::font_add() did not release the file reader it created.
- Fixed: The SF2 loader did not free the sample headers in its destructor.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@113 b0f79afe-0144-0410-b225-9a4edf0717df
2008-06-03 21:48:49 +00:00
|
|
|
if ((flags & SIXF_TRANSFERTRANSLATION) && !(mo->flags2 & MF2_DONTTRANSLATE))
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
mo->Translation = self->Translation;
|
|
|
|
}
|
|
|
|
|
|
|
|
mo->angle=self->angle;
|
|
|
|
while (originator && isMissile(originator)) originator = originator->target;
|
|
|
|
|
Update to ZDoom r1017:
- Fixed: MAPINFO's 'lookup' option should only work for actual strings but
not for lump and file names.
- Added a few 'activator == NULL' checks to some ACS functions.
- Added line and vertex lists to polyobjects so that I can do some
changes that won't work with only a seg list being maintained.
(SBarInfo update #23)
- Fixed: Drawing the amount of an inventory item in the player's inventory did
not work
- Added: PowerupTime to drawnumber and drawbar. You must specify a
powerupgiver. Although drawnumber goes in seconds the powerup has left
drawbar will use ticks for extra accuracy.
- I have increased cross-port compatibility with Skulltag. If an unknown
game mode is provided for sbarinfo's gamemode command it will ignore it and
continue.
- Added an option to consider intermission screens gameplay for purposes of
capturing the mouse.
- Changed: Telefragging should not thrust the victim if it isn't in precisely the
same position as the killer.
- fixed: A_SpawnItemEx must call P_TeleportMove before checking the spawned
object's position.
- Fixed: Ouch state was far to easy to achieve.
- Made all the basic texture classes local to their implementation.
They are not needed anywhere else.
- Changed the HackHack hack for corrupt 256 pixel high textures that
FMultiPatchTexture only calls a virtual function instead of doing any
type checks of the patch itself.
- Cleaned up the constant definitions in doomdata.h.
- Moved the TEXTUREx structures from doomdata.h to multipatchtexture.cpp
because they are used only in this one file.
- Removed some more typedefs from r_defs.h and doomdata.h
- Moved local polyobject data definitions from p_local.h to po_man.cpp.
- Renamed player_s to player_t globally to get rid of the duplicate names
for this class.
- Added coordinate range checking to DCanvas::ParseDrawTextureTags() to avoid
potential crashes in the situation that con_scaletext is 2 and somebody
uses a hud message as if a hud size was specified, but forgot to actually
set the hud size.
- Consolidated the mug shot code shared by DSBarInfo and DDoomStatusBar
into a single place.
- Fixed: Setting an invalid mug shot state crashed the game.
- Fixed my attempts to be clever with strings yesterday.
- If an actor's current target temporarily goes unshootable, its threshold
is now reset to 0, so it will more readily switch back to it.
- Fixed: Deactivating the game no longer allows reverb effects to continue
playing while the sound is paused.
- Fixed: S_StartNamedSound() looked for SECF_SILENT in MoreFlags instead of
Flags.
- Fixed: DSBarInfo::updateState() and DDoomStatusBar::UpdateState() sprung
leaks and didn't allocate enough space for the fullStateName string.
- Disabled DUMB's mono destination mixers. It's not like I'm ever going to
target an original SoundBlaster, so they're a waste of space to have around.
This trims resample.obj down to ~60k now.
- Fixed: PrtScn/SysRq key did not work on Linux.
- Added an alternate module replay engine that uses foo_dumb's replayer, a
heavily customized version of DUMB (Dynamic Universal Music Bibliotheque).
It has been slightly modified by me:
* Added support for Ogg Vorbis-compressed samples in XM files ala FMOD.
* Removed excessive mallocs from the replay core.
* Rerolled the loops in resample.c. Unrolling them made the object file
~250k large while providing little benefit. Even at ~100k, I think it's
still larger than it ought to be, but I'll live with it for now.
Other than that, it's essentially the same thing you'd hear in foobar2000,
minus some subsong detection features. Release builds of the library look
like they might even be slightly faster than FMOD, which is a plus.
- Fixed: Timidity::font_add() did not release the file reader it created.
- Fixed: The SF2 loader did not free the sample headers in its destructor.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@113 b0f79afe-0144-0410-b225-9a4edf0717df
2008-06-03 21:48:49 +00:00
|
|
|
if (flags & SIXF_TELEFRAG)
|
|
|
|
{
|
|
|
|
P_TeleportMove(mo, mo->x, mo->y, mo->z, true);
|
|
|
|
// This is needed to ensure consistent behavior.
|
|
|
|
// Otherwise it will only spawn if nothing gets telefragged
|
|
|
|
flags |= SIXF_NOCHECKPOSITION;
|
|
|
|
}
|
2008-01-27 11:25:03 +00:00
|
|
|
if (mo->flags3&MF3_ISMONSTER)
|
|
|
|
{
|
Update to ZDoom r1017:
- Fixed: MAPINFO's 'lookup' option should only work for actual strings but
not for lump and file names.
- Added a few 'activator == NULL' checks to some ACS functions.
- Added line and vertex lists to polyobjects so that I can do some
changes that won't work with only a seg list being maintained.
(SBarInfo update #23)
- Fixed: Drawing the amount of an inventory item in the player's inventory did
not work
- Added: PowerupTime to drawnumber and drawbar. You must specify a
powerupgiver. Although drawnumber goes in seconds the powerup has left
drawbar will use ticks for extra accuracy.
- I have increased cross-port compatibility with Skulltag. If an unknown
game mode is provided for sbarinfo's gamemode command it will ignore it and
continue.
- Added an option to consider intermission screens gameplay for purposes of
capturing the mouse.
- Changed: Telefragging should not thrust the victim if it isn't in precisely the
same position as the killer.
- fixed: A_SpawnItemEx must call P_TeleportMove before checking the spawned
object's position.
- Fixed: Ouch state was far to easy to achieve.
- Made all the basic texture classes local to their implementation.
They are not needed anywhere else.
- Changed the HackHack hack for corrupt 256 pixel high textures that
FMultiPatchTexture only calls a virtual function instead of doing any
type checks of the patch itself.
- Cleaned up the constant definitions in doomdata.h.
- Moved the TEXTUREx structures from doomdata.h to multipatchtexture.cpp
because they are used only in this one file.
- Removed some more typedefs from r_defs.h and doomdata.h
- Moved local polyobject data definitions from p_local.h to po_man.cpp.
- Renamed player_s to player_t globally to get rid of the duplicate names
for this class.
- Added coordinate range checking to DCanvas::ParseDrawTextureTags() to avoid
potential crashes in the situation that con_scaletext is 2 and somebody
uses a hud message as if a hud size was specified, but forgot to actually
set the hud size.
- Consolidated the mug shot code shared by DSBarInfo and DDoomStatusBar
into a single place.
- Fixed: Setting an invalid mug shot state crashed the game.
- Fixed my attempts to be clever with strings yesterday.
- If an actor's current target temporarily goes unshootable, its threshold
is now reset to 0, so it will more readily switch back to it.
- Fixed: Deactivating the game no longer allows reverb effects to continue
playing while the sound is paused.
- Fixed: S_StartNamedSound() looked for SECF_SILENT in MoreFlags instead of
Flags.
- Fixed: DSBarInfo::updateState() and DDoomStatusBar::UpdateState() sprung
leaks and didn't allocate enough space for the fullStateName string.
- Disabled DUMB's mono destination mixers. It's not like I'm ever going to
target an original SoundBlaster, so they're a waste of space to have around.
This trims resample.obj down to ~60k now.
- Fixed: PrtScn/SysRq key did not work on Linux.
- Added an alternate module replay engine that uses foo_dumb's replayer, a
heavily customized version of DUMB (Dynamic Universal Music Bibliotheque).
It has been slightly modified by me:
* Added support for Ogg Vorbis-compressed samples in XM files ala FMOD.
* Removed excessive mallocs from the replay core.
* Rerolled the loops in resample.c. Unrolling them made the object file
~250k large while providing little benefit. Even at ~100k, I think it's
still larger than it ought to be, but I'll live with it for now.
Other than that, it's essentially the same thing you'd hear in foobar2000,
minus some subsong detection features. Release builds of the library look
like they might even be slightly faster than FMOD, which is a plus.
- Fixed: Timidity::font_add() did not release the file reader it created.
- Fixed: The SF2 loader did not free the sample headers in its destructor.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@113 b0f79afe-0144-0410-b225-9a4edf0717df
2008-06-03 21:48:49 +00:00
|
|
|
if (!(flags&SIXF_NOCHECKPOSITION) && !P_TestMobjLocation(mo))
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
// The monster is blocked so don't spawn it at all!
|
|
|
|
if (mo->CountsAsKill()) level.total_monsters--;
|
|
|
|
mo->Destroy();
|
2008-08-14 11:28:02 +00:00
|
|
|
return false;
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
else if (originator)
|
|
|
|
{
|
|
|
|
if (originator->flags3&MF3_ISMONSTER)
|
|
|
|
{
|
|
|
|
// If this is a monster transfer all friendliness information
|
|
|
|
mo->CopyFriendliness(originator, true);
|
Update to ZDoom r1017:
- Fixed: MAPINFO's 'lookup' option should only work for actual strings but
not for lump and file names.
- Added a few 'activator == NULL' checks to some ACS functions.
- Added line and vertex lists to polyobjects so that I can do some
changes that won't work with only a seg list being maintained.
(SBarInfo update #23)
- Fixed: Drawing the amount of an inventory item in the player's inventory did
not work
- Added: PowerupTime to drawnumber and drawbar. You must specify a
powerupgiver. Although drawnumber goes in seconds the powerup has left
drawbar will use ticks for extra accuracy.
- I have increased cross-port compatibility with Skulltag. If an unknown
game mode is provided for sbarinfo's gamemode command it will ignore it and
continue.
- Added an option to consider intermission screens gameplay for purposes of
capturing the mouse.
- Changed: Telefragging should not thrust the victim if it isn't in precisely the
same position as the killer.
- fixed: A_SpawnItemEx must call P_TeleportMove before checking the spawned
object's position.
- Fixed: Ouch state was far to easy to achieve.
- Made all the basic texture classes local to their implementation.
They are not needed anywhere else.
- Changed the HackHack hack for corrupt 256 pixel high textures that
FMultiPatchTexture only calls a virtual function instead of doing any
type checks of the patch itself.
- Cleaned up the constant definitions in doomdata.h.
- Moved the TEXTUREx structures from doomdata.h to multipatchtexture.cpp
because they are used only in this one file.
- Removed some more typedefs from r_defs.h and doomdata.h
- Moved local polyobject data definitions from p_local.h to po_man.cpp.
- Renamed player_s to player_t globally to get rid of the duplicate names
for this class.
- Added coordinate range checking to DCanvas::ParseDrawTextureTags() to avoid
potential crashes in the situation that con_scaletext is 2 and somebody
uses a hud message as if a hud size was specified, but forgot to actually
set the hud size.
- Consolidated the mug shot code shared by DSBarInfo and DDoomStatusBar
into a single place.
- Fixed: Setting an invalid mug shot state crashed the game.
- Fixed my attempts to be clever with strings yesterday.
- If an actor's current target temporarily goes unshootable, its threshold
is now reset to 0, so it will more readily switch back to it.
- Fixed: Deactivating the game no longer allows reverb effects to continue
playing while the sound is paused.
- Fixed: S_StartNamedSound() looked for SECF_SILENT in MoreFlags instead of
Flags.
- Fixed: DSBarInfo::updateState() and DDoomStatusBar::UpdateState() sprung
leaks and didn't allocate enough space for the fullStateName string.
- Disabled DUMB's mono destination mixers. It's not like I'm ever going to
target an original SoundBlaster, so they're a waste of space to have around.
This trims resample.obj down to ~60k now.
- Fixed: PrtScn/SysRq key did not work on Linux.
- Added an alternate module replay engine that uses foo_dumb's replayer, a
heavily customized version of DUMB (Dynamic Universal Music Bibliotheque).
It has been slightly modified by me:
* Added support for Ogg Vorbis-compressed samples in XM files ala FMOD.
* Removed excessive mallocs from the replay core.
* Rerolled the loops in resample.c. Unrolling them made the object file
~250k large while providing little benefit. Even at ~100k, I think it's
still larger than it ought to be, but I'll live with it for now.
Other than that, it's essentially the same thing you'd hear in foobar2000,
minus some subsong detection features. Release builds of the library look
like they might even be slightly faster than FMOD, which is a plus.
- Fixed: Timidity::font_add() did not release the file reader it created.
- Fixed: The SF2 loader did not free the sample headers in its destructor.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@113 b0f79afe-0144-0410-b225-9a4edf0717df
2008-06-03 21:48:49 +00:00
|
|
|
if (flags&SIXF_SETMASTER) mo->master = originator; // don't let it attack you (optional)!
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
else if (originator->player)
|
|
|
|
{
|
|
|
|
// A player always spawns a monster friendly to him
|
|
|
|
mo->flags|=MF_FRIENDLY;
|
|
|
|
mo->FriendPlayer = originator->player-players+1;
|
|
|
|
|
|
|
|
AActor * attacker=originator->player->attacker;
|
|
|
|
if (attacker)
|
|
|
|
{
|
|
|
|
if (!(attacker->flags&MF_FRIENDLY) ||
|
|
|
|
(deathmatch && attacker->FriendPlayer!=0 && attacker->FriendPlayer!=mo->FriendPlayer))
|
|
|
|
{
|
|
|
|
// Target the monster which last attacked the player
|
2008-06-28 13:29:59 +00:00
|
|
|
mo->LastHeard = mo->target = attacker;
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// If this is a missile or something else set the target to the originator
|
|
|
|
mo->target=originator? originator : self;
|
|
|
|
}
|
|
|
|
}
|
2008-08-14 11:28:02 +00:00
|
|
|
return true;
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_SpawnItem
|
|
|
|
//
|
|
|
|
// Spawns an item in front of the caller like Heretic's time bomb
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(5);
|
|
|
|
ACTION_PARAM_CLASS(missile, 0);
|
|
|
|
ACTION_PARAM_FIXED(distance, 1);
|
|
|
|
ACTION_PARAM_FIXED(zheight, 2);
|
|
|
|
ACTION_PARAM_BOOL(useammo, 3);
|
|
|
|
ACTION_PARAM_BOOL(transfer_translation, 4);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (!missile)
|
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_SET_RESULT(false);
|
2008-01-27 11:25:03 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Don't spawn monsters if this actor has been massacred
|
|
|
|
if (self->DamageType == NAME_Massacre && GetDefaultByType(missile)->flags3&MF3_ISMONSTER) return;
|
|
|
|
|
|
|
|
if (distance==0)
|
|
|
|
{
|
|
|
|
// use the minimum distance that does not result in an overlap
|
|
|
|
distance=(self->radius+GetDefaultByType(missile)->radius)>>FRACBITS;
|
|
|
|
}
|
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (ACTION_CALL_FROM_WEAPON())
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
// Used from a weapon so use some ammo
|
|
|
|
AWeapon * weapon=self->player->ReadyWeapon;
|
|
|
|
|
|
|
|
if (!weapon) return;
|
|
|
|
if (useammo && !weapon->DepleteAmmo(weapon->bAltFire)) return;
|
|
|
|
}
|
|
|
|
|
|
|
|
AActor * mo = Spawn( missile,
|
|
|
|
self->x + FixedMul(distance, finecosine[self->angle>>ANGLETOFINESHIFT]),
|
|
|
|
self->y + FixedMul(distance, finesine[self->angle>>ANGLETOFINESHIFT]),
|
|
|
|
self->z - self->floorclip + zheight, ALLOW_REPLACE);
|
|
|
|
|
Update to ZDoom r1017:
- Fixed: MAPINFO's 'lookup' option should only work for actual strings but
not for lump and file names.
- Added a few 'activator == NULL' checks to some ACS functions.
- Added line and vertex lists to polyobjects so that I can do some
changes that won't work with only a seg list being maintained.
(SBarInfo update #23)
- Fixed: Drawing the amount of an inventory item in the player's inventory did
not work
- Added: PowerupTime to drawnumber and drawbar. You must specify a
powerupgiver. Although drawnumber goes in seconds the powerup has left
drawbar will use ticks for extra accuracy.
- I have increased cross-port compatibility with Skulltag. If an unknown
game mode is provided for sbarinfo's gamemode command it will ignore it and
continue.
- Added an option to consider intermission screens gameplay for purposes of
capturing the mouse.
- Changed: Telefragging should not thrust the victim if it isn't in precisely the
same position as the killer.
- fixed: A_SpawnItemEx must call P_TeleportMove before checking the spawned
object's position.
- Fixed: Ouch state was far to easy to achieve.
- Made all the basic texture classes local to their implementation.
They are not needed anywhere else.
- Changed the HackHack hack for corrupt 256 pixel high textures that
FMultiPatchTexture only calls a virtual function instead of doing any
type checks of the patch itself.
- Cleaned up the constant definitions in doomdata.h.
- Moved the TEXTUREx structures from doomdata.h to multipatchtexture.cpp
because they are used only in this one file.
- Removed some more typedefs from r_defs.h and doomdata.h
- Moved local polyobject data definitions from p_local.h to po_man.cpp.
- Renamed player_s to player_t globally to get rid of the duplicate names
for this class.
- Added coordinate range checking to DCanvas::ParseDrawTextureTags() to avoid
potential crashes in the situation that con_scaletext is 2 and somebody
uses a hud message as if a hud size was specified, but forgot to actually
set the hud size.
- Consolidated the mug shot code shared by DSBarInfo and DDoomStatusBar
into a single place.
- Fixed: Setting an invalid mug shot state crashed the game.
- Fixed my attempts to be clever with strings yesterday.
- If an actor's current target temporarily goes unshootable, its threshold
is now reset to 0, so it will more readily switch back to it.
- Fixed: Deactivating the game no longer allows reverb effects to continue
playing while the sound is paused.
- Fixed: S_StartNamedSound() looked for SECF_SILENT in MoreFlags instead of
Flags.
- Fixed: DSBarInfo::updateState() and DDoomStatusBar::UpdateState() sprung
leaks and didn't allocate enough space for the fullStateName string.
- Disabled DUMB's mono destination mixers. It's not like I'm ever going to
target an original SoundBlaster, so they're a waste of space to have around.
This trims resample.obj down to ~60k now.
- Fixed: PrtScn/SysRq key did not work on Linux.
- Added an alternate module replay engine that uses foo_dumb's replayer, a
heavily customized version of DUMB (Dynamic Universal Music Bibliotheque).
It has been slightly modified by me:
* Added support for Ogg Vorbis-compressed samples in XM files ala FMOD.
* Removed excessive mallocs from the replay core.
* Rerolled the loops in resample.c. Unrolling them made the object file
~250k large while providing little benefit. Even at ~100k, I think it's
still larger than it ought to be, but I'll live with it for now.
Other than that, it's essentially the same thing you'd hear in foobar2000,
minus some subsong detection features. Release builds of the library look
like they might even be slightly faster than FMOD, which is a plus.
- Fixed: Timidity::font_add() did not release the file reader it created.
- Fixed: The SF2 loader did not free the sample headers in its destructor.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@113 b0f79afe-0144-0410-b225-9a4edf0717df
2008-06-03 21:48:49 +00:00
|
|
|
int flags = (transfer_translation? SIXF_TRANSFERTRANSLATION:0) + (useammo? SIXF_SETMASTER:0);
|
2008-08-14 11:28:02 +00:00
|
|
|
bool res = InitSpawnedItem(self, mo, flags);
|
|
|
|
ACTION_SET_RESULT(res); // for an inventory item's use state
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_SpawnItemEx
|
|
|
|
//
|
|
|
|
// Enhanced spawning function
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(10);
|
|
|
|
ACTION_PARAM_CLASS(missile, 0);
|
|
|
|
ACTION_PARAM_FIXED(xofs, 1);
|
|
|
|
ACTION_PARAM_FIXED(yofs, 2);
|
|
|
|
ACTION_PARAM_FIXED(zofs, 3);
|
|
|
|
ACTION_PARAM_FIXED(xmom, 4);
|
|
|
|
ACTION_PARAM_FIXED(ymom, 5);
|
|
|
|
ACTION_PARAM_FIXED(zmom, 6);
|
|
|
|
ACTION_PARAM_ANGLE(Angle, 7);
|
|
|
|
ACTION_PARAM_INT(flags, 8);
|
|
|
|
ACTION_PARAM_INT(chance, 9);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (!missile)
|
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_SET_RESULT(false);
|
2008-01-27 11:25:03 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (chance > 0 && pr_spawnitemex()<chance) return;
|
|
|
|
|
|
|
|
// Don't spawn monsters if this actor has been massacred
|
|
|
|
if (self->DamageType == NAME_Massacre && GetDefaultByType(missile)->flags3&MF3_ISMONSTER) return;
|
|
|
|
|
|
|
|
fixed_t x,y;
|
|
|
|
|
|
|
|
if (!(flags & SIXF_ABSOLUTEANGLE))
|
|
|
|
{
|
|
|
|
Angle += self->angle;
|
|
|
|
}
|
|
|
|
|
|
|
|
angle_t ang = Angle >> ANGLETOFINESHIFT;
|
|
|
|
|
|
|
|
if (flags & SIXF_ABSOLUTEPOSITION)
|
|
|
|
{
|
|
|
|
x = self->x + xofs;
|
|
|
|
y = self->y + yofs;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// in relative mode negative y values mean 'left' and positive ones mean 'right'
|
|
|
|
// This is the inverse orientation of the absolute mode!
|
|
|
|
x = self->x + FixedMul(xofs, finecosine[ang]) + FixedMul(yofs, finesine[ang]);
|
|
|
|
y = self->y + FixedMul(xofs, finesine[ang]) - FixedMul(yofs, finecosine[ang]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(flags & SIXF_ABSOLUTEMOMENTUM))
|
|
|
|
{
|
|
|
|
// Same orientation issue here!
|
|
|
|
fixed_t newxmom = FixedMul(xmom, finecosine[ang]) + FixedMul(ymom, finesine[ang]);
|
|
|
|
ymom = FixedMul(xmom, finesine[ang]) - FixedMul(ymom, finecosine[ang]);
|
|
|
|
xmom = newxmom;
|
|
|
|
}
|
|
|
|
|
2008-06-14 15:37:17 +00:00
|
|
|
AActor * mo = Spawn( missile, x, y, self->z - self->floorclip + zofs, ALLOW_REPLACE);
|
2008-08-14 11:28:02 +00:00
|
|
|
bool res = InitSpawnedItem(self, mo, flags);
|
|
|
|
ACTION_SET_RESULT(res); // for an inventory item's use state
|
2008-01-27 11:25:03 +00:00
|
|
|
if (mo)
|
|
|
|
{
|
|
|
|
mo->momx=xmom;
|
|
|
|
mo->momy=ymom;
|
|
|
|
mo->momz=zmom;
|
|
|
|
mo->angle=Angle;
|
2008-03-30 08:34:44 +00:00
|
|
|
if (flags & SIXF_TRANSFERAMBUSHFLAG) mo->flags = (mo->flags&~MF_AMBUSH) | (self->flags & MF_AMBUSH);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_ThrowGrenade
|
|
|
|
//
|
|
|
|
// Throws a grenade (like Hexen's fighter flechette)
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ThrowGrenade)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(5);
|
|
|
|
ACTION_PARAM_CLASS(missile, 0);
|
|
|
|
ACTION_PARAM_FIXED(zheight, 1);
|
|
|
|
ACTION_PARAM_FIXED(xymom, 2);
|
|
|
|
ACTION_PARAM_FIXED(zmom, 3);
|
|
|
|
ACTION_PARAM_BOOL(useammo, 4);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (ACTION_CALL_FROM_WEAPON())
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
// Used from a weapon so use some ammo
|
|
|
|
AWeapon * weapon=self->player->ReadyWeapon;
|
|
|
|
|
|
|
|
if (!weapon) return;
|
|
|
|
if (useammo && !weapon->DepleteAmmo(weapon->bAltFire)) return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AActor * bo;
|
|
|
|
|
|
|
|
bo = Spawn(missile, self->x, self->y,
|
|
|
|
self->z - self->floorclip + zheight + 35*FRACUNIT + (self->player? self->player->crouchoffset : 0),
|
|
|
|
ALLOW_REPLACE);
|
|
|
|
if (bo)
|
|
|
|
{
|
|
|
|
int pitch = self->pitch;
|
|
|
|
|
|
|
|
P_PlaySpawnSound(bo, self);
|
|
|
|
if (xymom) bo->Speed=xymom;
|
|
|
|
bo->angle = self->angle+(((pr_grenade()&7)-4)<<24);
|
|
|
|
bo->momz = zmom + 2*finesine[pitch>>ANGLETOFINESHIFT];
|
|
|
|
bo->z += 2 * finesine[pitch>>ANGLETOFINESHIFT];
|
|
|
|
P_ThrustMobj(bo, bo->angle, bo->Speed);
|
|
|
|
bo->momx += self->momx>>1;
|
|
|
|
bo->momy += self->momy>>1;
|
|
|
|
bo->target= self;
|
|
|
|
if (bo->flags4&MF4_RANDOMIZE)
|
|
|
|
{
|
|
|
|
bo->tics -= pr_grenade()&3;
|
|
|
|
if (bo->tics<1) bo->tics=1;
|
|
|
|
}
|
|
|
|
P_CheckMissileSpawn (bo);
|
|
|
|
}
|
2008-08-14 11:28:02 +00:00
|
|
|
else ACTION_SET_RESULT(false);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_Recoil
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Recoil)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_FIXED(xymom, 0);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
angle_t angle = self->angle + ANG180;
|
2008-01-27 11:25:03 +00:00
|
|
|
angle >>= ANGLETOFINESHIFT;
|
2008-08-12 08:00:28 +00:00
|
|
|
self->momx += FixedMul (xymom, finecosine[angle]);
|
|
|
|
self->momy += FixedMul (xymom, finesine[angle]);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_SelectWeapon
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SelectWeapon)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_CLASS(cls, 0);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (self->player == NULL) return;
|
|
|
|
|
|
|
|
AWeapon * weaponitem = static_cast<AWeapon*>(self->FindInventory(cls));
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (weaponitem != NULL && weaponitem->IsKindOf(RUNTIME_CLASS(AWeapon)))
|
|
|
|
{
|
2008-08-12 08:00:28 +00:00
|
|
|
if (self->player->ReadyWeapon != weaponitem)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 08:00:28 +00:00
|
|
|
self->player->PendingWeapon = weaponitem;
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-14 11:28:02 +00:00
|
|
|
else ACTION_SET_RESULT(false);
|
|
|
|
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_Print
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
EXTERN_CVAR(Float, con_midtime)
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Print)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(3);
|
|
|
|
ACTION_PARAM_STRING(text, 0);
|
|
|
|
ACTION_PARAM_FLOAT(time, 1);
|
|
|
|
ACTION_PARAM_NAME(fontname, 2);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
if (self->CheckLocalView (consoleplayer) ||
|
|
|
|
(self->target!=NULL && self->target->CheckLocalView (consoleplayer)))
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
FFont * oldfont = screen->Font;
|
|
|
|
float saved = con_midtime;
|
|
|
|
|
|
|
|
|
|
|
|
if (fontname != NAME_None)
|
|
|
|
{
|
|
|
|
FFont * font = V_GetFont(fontname);
|
|
|
|
if (font != NULL) screen->SetFont(font);
|
|
|
|
}
|
|
|
|
if (time > 0)
|
|
|
|
{
|
|
|
|
con_midtime = time;
|
|
|
|
}
|
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
C_MidPrint(text);
|
2008-01-27 11:25:03 +00:00
|
|
|
screen->SetFont(oldfont);
|
|
|
|
con_midtime = saved;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_SetTranslucent
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTranslucent)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(2);
|
|
|
|
ACTION_PARAM_FIXED(alpha, 0);
|
|
|
|
ACTION_PARAM_INT(mode, 1);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
mode = mode == 0 ? STYLE_Translucent : mode == 2 ? STYLE_Fuzzy : STYLE_Add;
|
|
|
|
|
2008-01-27 15:34:47 +00:00
|
|
|
self->RenderStyle.Flags &= ~STYLEF_Alpha1;
|
|
|
|
self->alpha = clamp<fixed_t>(alpha, 0, FRACUNIT);
|
|
|
|
self->RenderStyle = ERenderStyle(mode);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_FadeIn
|
|
|
|
//
|
|
|
|
// Fades the actor in
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeIn)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_FIXED(reduce, 0);
|
|
|
|
|
2008-01-27 11:25:03 +00:00
|
|
|
if (reduce == 0) reduce = FRACUNIT/10;
|
|
|
|
|
2008-01-27 15:34:47 +00:00
|
|
|
self->RenderStyle.Flags &= ~STYLEF_Alpha1;
|
2008-01-27 11:25:03 +00:00
|
|
|
self->alpha += reduce;
|
|
|
|
//if (self->alpha<=0) self->Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_FadeOut
|
|
|
|
//
|
|
|
|
// fades the actor out and destroys it when done
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeOut)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_FIXED(reduce, 0);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (reduce == 0) reduce = FRACUNIT/10;
|
|
|
|
|
2008-01-27 15:34:47 +00:00
|
|
|
self->RenderStyle.Flags &= ~STYLEF_Alpha1;
|
2008-01-27 11:25:03 +00:00
|
|
|
self->alpha -= reduce;
|
|
|
|
if (self->alpha<=0) self->Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_SpawnDebris
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
AActor * mo;
|
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(4);
|
|
|
|
ACTION_PARAM_CLASS(debris, 0);
|
|
|
|
ACTION_PARAM_BOOL(transfer_translation, 1);
|
|
|
|
ACTION_PARAM_FIXED(mult_h, 2);
|
|
|
|
ACTION_PARAM_FIXED(mult_v, 3);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (debris == NULL) return;
|
|
|
|
|
|
|
|
// only positive values make sense here
|
|
|
|
if (mult_v<=0) mult_v=FRACUNIT;
|
|
|
|
if (mult_h<=0) mult_h=FRACUNIT;
|
|
|
|
|
|
|
|
for (i = 0; i < GetDefaultByType(debris)->health; i++)
|
|
|
|
{
|
|
|
|
mo = Spawn(debris, self->x+((pr_spawndebris()-128)<<12),
|
|
|
|
self->y+((pr_spawndebris()-128)<<12),
|
|
|
|
self->z+(pr_spawndebris()*self->height/256), ALLOW_REPLACE);
|
|
|
|
if (mo && transfer_translation)
|
|
|
|
{
|
|
|
|
mo->Translation = self->Translation;
|
|
|
|
}
|
|
|
|
if (mo && i < mo->GetClass()->ActorInfo->NumOwnedStates)
|
|
|
|
{
|
|
|
|
mo->SetState (mo->GetClass()->ActorInfo->OwnedStates + i);
|
|
|
|
mo->momz = FixedMul(mult_v, ((pr_spawndebris()&7)+5)*FRACUNIT);
|
|
|
|
mo->momx = FixedMul(mult_h, pr_spawndebris.Random2()<<(FRACBITS-6));
|
|
|
|
mo->momy = FixedMul(mult_h, pr_spawndebris.Random2()<<(FRACBITS-6));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_CheckSight
|
|
|
|
// jumps if no player can see this actor
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSight)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_STATE(jump, 0);
|
|
|
|
|
|
|
|
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
for (int i=0;i<MAXPLAYERS;i++)
|
|
|
|
{
|
|
|
|
if (playeringame[i] && P_CheckSight(players[i].camera,self,true)) return;
|
|
|
|
}
|
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_JUMP(jump);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Inventory drop
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropInventory)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_CLASS(drop, 0);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
AInventory * inv = self->FindInventory(drop);
|
2008-01-27 11:25:03 +00:00
|
|
|
if (inv)
|
|
|
|
{
|
|
|
|
self->DropInventory(inv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_SetBlend
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetBlend)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(4);
|
|
|
|
ACTION_PARAM_COLOR(color, 0);
|
|
|
|
ACTION_PARAM_FLOAT(alpha, 1);
|
|
|
|
ACTION_PARAM_INT(tics, 2);
|
|
|
|
ACTION_PARAM_COLOR(color2, 3);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (color == MAKEARGB(255,255,255,255)) color=0;
|
|
|
|
if (color2 == MAKEARGB(255,255,255,255)) color2=0;
|
|
|
|
if (!color2.a)
|
|
|
|
color2 = color;
|
|
|
|
|
|
|
|
new DFlashFader(color.r/255.0f, color.g/255.0f, color.b/255.0f, alpha,
|
|
|
|
color2.r/255.0f, color2.g/255.0f, color2.b/255.0f, 0,
|
|
|
|
(float)tics/TICRATE, self);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_JumpIf
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIf)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(2);
|
|
|
|
ACTION_PARAM_BOOL(expression, 0);
|
|
|
|
ACTION_PARAM_STATE(jump, 1);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
|
|
|
if (expression) ACTION_JUMP(jump);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_KillMaster
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 08:00:28 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_KillMaster)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
if (self->master != NULL)
|
|
|
|
{
|
|
|
|
P_DamageMobj(self->master, self, self, self->master->health, NAME_None, DMG_NO_ARMOR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_KillChildren
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 08:00:28 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_KillChildren)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
TThinkerIterator<AActor> it;
|
|
|
|
AActor * mo;
|
|
|
|
|
|
|
|
while ( (mo = it.Next()) )
|
|
|
|
{
|
|
|
|
if (mo->master == self)
|
|
|
|
{
|
|
|
|
P_DamageMobj(mo, self, self, mo->health, NAME_None, DMG_NO_ARMOR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_CountdownArg
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_INT(cnt, 0);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (cnt<0 || cnt>=5) return;
|
|
|
|
if (!self->args[cnt]--)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
if (self->flags&MF_MISSILE)
|
|
|
|
{
|
|
|
|
P_ExplodeMissile(self, NULL, NULL);
|
|
|
|
}
|
|
|
|
else if (self->flags&MF_SHOOTABLE)
|
|
|
|
{
|
|
|
|
P_DamageMobj (self, NULL, NULL, self->health, NAME_None);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
self->SetState(self->FindState(NAME_Death));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_Burst
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_CLASS(chunk, 0);
|
|
|
|
|
2008-01-27 11:25:03 +00:00
|
|
|
int i, numChunks;
|
|
|
|
AActor * mo;
|
2008-08-14 11:28:02 +00:00
|
|
|
|
2008-01-27 11:25:03 +00:00
|
|
|
if (chunk == NULL) return;
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
self->momx = self->momy = self->momz = 0;
|
|
|
|
self->height = self->GetDefault()->height;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
// [RH] In Hexen, this creates a random number of shards (range [24,56])
|
2008-08-12 08:00:28 +00:00
|
|
|
// with no relation to the size of the self shattering. I think it should
|
2008-01-27 11:25:03 +00:00
|
|
|
// base the number of shards on the size of the dead thing, so bigger
|
|
|
|
// things break up into more shards than smaller things.
|
2008-08-12 08:00:28 +00:00
|
|
|
// An self with radius 20 and height 64 creates ~40 chunks.
|
|
|
|
numChunks = MAX<int> (4, (self->radius>>FRACBITS)*(self->height>>FRACBITS)/32);
|
2008-01-27 11:25:03 +00:00
|
|
|
i = (pr_burst.Random2()) % (numChunks/4);
|
|
|
|
for (i = MAX (24, numChunks + i); i >= 0; i--)
|
|
|
|
{
|
|
|
|
mo = Spawn(chunk,
|
2008-08-12 08:00:28 +00:00
|
|
|
self->x + (((pr_burst()-128)*self->radius)>>7),
|
|
|
|
self->y + (((pr_burst()-128)*self->radius)>>7),
|
|
|
|
self->z + (pr_burst()*self->height/255), ALLOW_REPLACE);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (mo)
|
|
|
|
{
|
2008-08-12 08:00:28 +00:00
|
|
|
mo->momz = FixedDiv(mo->z-self->z, self->height)<<2;
|
2008-01-27 11:25:03 +00:00
|
|
|
mo->momx = pr_burst.Random2 () << (FRACBITS-7);
|
|
|
|
mo->momy = pr_burst.Random2 () << (FRACBITS-7);
|
2008-08-12 08:00:28 +00:00
|
|
|
mo->RenderStyle = self->RenderStyle;
|
|
|
|
mo->alpha = self->alpha;
|
|
|
|
mo->CopyFriendliness(self, true);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// [RH] Do some stuff to make this more useful outside Hexen
|
2008-08-12 08:00:28 +00:00
|
|
|
if (self->flags4 & MF4_BOSSDEATH)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 08:00:28 +00:00
|
|
|
CALL_ACTION(A_BossDeath, self);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
2008-08-12 08:00:28 +00:00
|
|
|
CALL_ACTION(A_NoBlocking, self);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
self->Destroy ();
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_CheckFloor
|
|
|
|
// [GRB] Jumps if actor is standing on floor
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFloor)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_STATE(jump, 0);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
|
|
|
if (self->z <= self->floorz)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_JUMP(jump);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_Stop
|
|
|
|
// resets all momentum of the actor to 0
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 08:00:28 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_Stop)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
self->momx = self->momy = self->momz = 0;
|
2008-07-06 17:32:31 +00:00
|
|
|
if (self->player && self->player->mo == self && !(self->player->cheats & CF_PREDICTING))
|
|
|
|
{
|
|
|
|
self->player->mo->PlayIdle ();
|
|
|
|
self->player->momx = self->player->momy = 0;
|
|
|
|
}
|
|
|
|
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_Respawn
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Respawn)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_BOOL(fog, 0);
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
fixed_t x = self->SpawnPoint[0];
|
|
|
|
fixed_t y = self->SpawnPoint[1];
|
2008-01-27 11:25:03 +00:00
|
|
|
sector_t *sec;
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
self->flags |= MF_SOLID;
|
2008-01-27 11:25:03 +00:00
|
|
|
sec = P_PointInSector (x, y);
|
2008-08-12 08:00:28 +00:00
|
|
|
self->SetOrigin (x, y, sec->floorplane.ZatPoint (x, y));
|
|
|
|
self->height = self->GetDefault()->height;
|
|
|
|
if (P_TestMobjLocation (self))
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 08:00:28 +00:00
|
|
|
AActor *defs = self->GetDefault();
|
|
|
|
self->health = defs->health;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
self->flags = (defs->flags & ~MF_FRIENDLY) | (self->flags & MF_FRIENDLY);
|
|
|
|
self->flags2 = defs->flags2;
|
|
|
|
self->flags3 = (defs->flags3 & ~(MF3_NOSIGHTCHECK | MF3_HUNTPLAYERS)) | (self->flags3 & (MF3_NOSIGHTCHECK | MF3_HUNTPLAYERS));
|
|
|
|
self->flags4 = (defs->flags4 & ~MF4_NOHATEPLAYERS) | (self->flags4 & MF4_NOHATEPLAYERS);
|
|
|
|
self->flags5 = defs->flags5;
|
|
|
|
self->SetState (self->SpawnState);
|
|
|
|
self->renderflags &= ~RF_INVISIBLE;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
if (fog)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-12 08:00:28 +00:00
|
|
|
Spawn<ATeleportFog> (x, y, self->z + TELEFOGHEIGHT, ALLOW_REPLACE);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
2008-08-12 08:00:28 +00:00
|
|
|
if (self->CountsAsKill()) level.total_monsters++;
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-08-12 08:00:28 +00:00
|
|
|
self->flags &= ~MF_SOLID;
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A_PlayerSkinCheck
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayerSkinCheck)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_STATE(jump, 0);
|
|
|
|
|
|
|
|
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
2008-08-12 08:00:28 +00:00
|
|
|
if (self->player != NULL &&
|
|
|
|
skins[self->player->userinfo.skin].othergame)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_JUMP(jump);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_SetGravity
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetGravity)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(1);
|
|
|
|
ACTION_PARAM_FIXED(val, 0);
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
self->gravity = clamp<fixed_t> (val, 0, FRACUNIT*10);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// [KS] *** Start of my modifications ***
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_ClearTarget
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_ClearTarget)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
|
|
|
self->target = NULL;
|
|
|
|
self->LastHeard = NULL;
|
|
|
|
self->lastenemy = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
2008-05-17 08:47:26 +00:00
|
|
|
// A_JumpIfTargetInLOS (state label, optional fixed fov, optional bool
|
|
|
|
// projectiletarget)
|
|
|
|
//
|
2008-01-27 11:25:03 +00:00
|
|
|
// Jumps if the actor can see its target, or if the player has a linetarget.
|
2008-05-17 08:47:26 +00:00
|
|
|
// ProjectileTarget affects how projectiles are treated. If set, it will use
|
|
|
|
// the target of the projectile for seekers, and ignore the target for
|
|
|
|
// normal projectiles. If not set, it will use the missile's owner instead
|
|
|
|
// (the default).
|
2008-01-27 11:25:03 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS)
|
2008-01-27 11:25:03 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(3);
|
|
|
|
ACTION_PARAM_STATE(jump, 0);
|
|
|
|
ACTION_PARAM_ANGLE(fov, 1);
|
|
|
|
ACTION_PARAM_BOOL(projtarg, 2);
|
2008-08-12 23:22:08 +00:00
|
|
|
|
2008-01-27 11:25:03 +00:00
|
|
|
angle_t an;
|
2008-05-17 08:47:26 +00:00
|
|
|
AActor *target;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (!self->player)
|
|
|
|
{
|
2008-05-17 08:47:26 +00:00
|
|
|
if (self->flags & MF_MISSILE && projtarg)
|
|
|
|
{
|
|
|
|
if (self->flags2 & MF2_SEEKERMISSILE)
|
|
|
|
target = self->tracer;
|
|
|
|
else
|
|
|
|
target = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
target = self->target;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!target) return; // [KS] Let's not call P_CheckSight unnecessarily in this case.
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (!P_CheckSight (self, target, 1))
|
2008-05-17 08:47:26 +00:00
|
|
|
return;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
|
|
|
if (fov && (fov < ANGLE_MAX))
|
|
|
|
{
|
|
|
|
an = R_PointToAngle2 (self->x,
|
|
|
|
self->y,
|
|
|
|
target->x,
|
|
|
|
target->y)
|
|
|
|
- self->angle;
|
|
|
|
|
|
|
|
if (an > (fov / 2) && an < (ANGLE_MAX - (fov / 2)))
|
|
|
|
{
|
|
|
|
return; // [KS] Outside of FOV - return
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Does the player aim at something that can be shot?
|
Update to ZDoom r905:
- Added Martin Howe's morph system update.
- Added support for defining composite textures in HIRESTEX. It is not fully tested
and right now can't do much more than the old TEXTUREx method.
- Added a few NULL pointer checks to the texture code.
- Made duplicate class names in DECORATE non-fatal. There is really no stability
concern here and the worst that can happen is that the wrong actor is spawned.
This was a constant hassle when testing with WADs that contain duplicate resources.
- Removed some GCC warnings.
- Fixed: MinGW doesn't have _get_pgmptr(), so it couldn't compile i_main.cpp.
- Fixed: MOD_WAVETABLE and MOD_SWSYNTH are not defined by w32api, so MinGW
failed compiling the new MIDI code.
- Fixed: LocalSndInfo and LocalSndSeq in S_Start() need to be const char
pointers, since "" is a constant.
- Fixed: parsecontext.h was missing a newline at the end of the file.
- Fixed: Timidity::Channel::mono, rpn, and nrpn were not initialized. In
particular, this meant that every channel was almost certainly in mono mode,
which can sound pretty bad if the song isn't meant to be played that way.
- Added bank numbers to the MIDI precaching for Timidity, since I guess I do
need to care about banks, if even the Duke MIDIs use various banks.
- Fixed: snd_midiprecache only exists in Win32 builds, so gameconfigfile.cpp
shouldn't unconditionally link against it.
- Fixed: pre_resample() was still disabled, and it left two samples at the end
of the new wave data uninitialized.
- Moved the xmap table from timidity/tables.cpp to playmidi.cpp. Now I can get
rid of timidity/tables.cpp, which conflicts in name with the main Doom
tables.cpp. (And interestingly, VC++ automatically renamed the object file,
so I wasn't aware of the problem with GCC.)
- Added a Gets function to the FileReader class which I planned to use
to enable Timidity to read its config and sound patches from Zips.
I put this on hold though after finding out that the sound quality
isn't even near that of Timidity++.
- GCC-Fixes (FString::GetChars() for Printf calls)
- Added a dummy Weapon.NOLMS flag so that Skulltag weapons using this flag
can be loaded
- Changed the MIDIStreamer to send the all notes off controller to each
channel when restarting the song, rather than emitting a single note off
event which only has 1 in 127 chance of being for a note that's playing
on that channel. Then I decided it would probably be a good idea to reset
all the controllers as well.
- Increasing the size of the internal Timidity stream buffer from 1/14 sec
(copied from the OPL player) improved its sound dramatically, so apparently
Timidity has issues with short stream buffers. It's now at 1/2 sec in
length. However, there seems to be something weird going on with
corazonazul_ff6boss.mid near the beginning where it stops and immediately
restarts a guitar on the exact same note.
- Added a new sound debugging cvar: snd_drawoutput, which can show various
oscilloscopes and spectrums.
- Eliminated some more global variables (onmobj, DoRipping, LastRipped,
MissileActor, bulletpitch and linetarget.)
- Internal TiMidity now plays music. Unfortunately, it doesn't sound right. :(
- Changed the progdir global variable into an FString.
git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@90 b0f79afe-0144-0410-b225-9a4edf0717df
2008-04-12 18:59:23 +00:00
|
|
|
P_BulletSlope(self, &target);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-17 08:47:26 +00:00
|
|
|
if (!target) return;
|
2008-01-27 11:25:03 +00:00
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_JUMP(jump);
|
2008-01-27 11:25:03 +00:00
|
|
|
}
|
|
|
|
|
2008-03-30 08:34:44 +00:00
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_DamageMaster (int amount)
|
|
|
|
// Damages the master of this child by the specified amount. Negative values heal.
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageMaster)
|
2008-03-30 08:34:44 +00:00
|
|
|
{
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(2);
|
|
|
|
ACTION_PARAM_INT(amount, 0);
|
|
|
|
ACTION_PARAM_NAME(DamageType, 1);
|
2008-03-30 08:34:44 +00:00
|
|
|
|
|
|
|
if (self->master != NULL)
|
|
|
|
{
|
|
|
|
if (amount > 0)
|
|
|
|
{
|
|
|
|
P_DamageMobj(self->master, self, self, amount, DamageType, DMG_NO_ARMOR);
|
|
|
|
}
|
|
|
|
else if (amount < 0)
|
|
|
|
{
|
|
|
|
amount = -amount;
|
|
|
|
P_GiveBody(self->master, amount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_DamageChildren (amount)
|
|
|
|
// Damages the children of this master by the specified amount. Negative values heal.
|
|
|
|
//
|
|
|
|
//===========================================================================
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageChildren)
|
2008-03-30 08:34:44 +00:00
|
|
|
{
|
|
|
|
TThinkerIterator<AActor> it;
|
|
|
|
AActor * mo;
|
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(2);
|
|
|
|
ACTION_PARAM_INT(amount, 0);
|
|
|
|
ACTION_PARAM_NAME(DamageType, 1);
|
2008-03-30 08:34:44 +00:00
|
|
|
|
|
|
|
while ( (mo = it.Next()) )
|
|
|
|
{
|
|
|
|
if (mo->master == self)
|
|
|
|
{
|
|
|
|
if (amount > 0)
|
|
|
|
{
|
|
|
|
P_DamageMobj(mo, self, self, amount, DamageType, DMG_NO_ARMOR);
|
|
|
|
}
|
|
|
|
else if (amount < 0)
|
|
|
|
{
|
|
|
|
amount = -amount;
|
|
|
|
P_GiveBody(mo, amount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-27 11:25:03 +00:00
|
|
|
// [KS] *** End of my modifications ***
|
2008-06-28 13:29:59 +00:00
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Modified code pointer from Skulltag
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-12 23:22:08 +00:00
|
|
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckForReload)
|
2008-06-28 13:29:59 +00:00
|
|
|
{
|
|
|
|
if ( self->player == NULL || self->player->ReadyWeapon == NULL )
|
|
|
|
return;
|
|
|
|
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_PARAM_START(2);
|
|
|
|
ACTION_PARAM_INT(count, 0);
|
|
|
|
ACTION_PARAM_STATE(jump, 1);
|
2008-08-22 07:36:50 +00:00
|
|
|
ACTION_PARAM_BOOL(dontincrement, 2)
|
|
|
|
|
|
|
|
if (count <= 0) return;
|
2008-08-14 11:28:02 +00:00
|
|
|
|
2008-06-28 13:29:59 +00:00
|
|
|
AWeapon *weapon = self->player->ReadyWeapon;
|
2008-08-22 07:36:50 +00:00
|
|
|
|
|
|
|
int ReloadCounter = weapon->ReloadCounter;
|
|
|
|
if(!dontincrement || ReloadCounter != 0)
|
|
|
|
ReloadCounter = (weapon->ReloadCounter+1) % count;
|
|
|
|
else // 0 % 1 = 1? So how do we check if the weapon was never fired? We should only do this when we're not incrementing the counter though.
|
|
|
|
ReloadCounter = 1;
|
|
|
|
|
2008-06-28 13:29:59 +00:00
|
|
|
// If we have not made our last shot...
|
2008-08-22 07:36:50 +00:00
|
|
|
if (ReloadCounter != 0)
|
2008-06-28 13:29:59 +00:00
|
|
|
{
|
|
|
|
// Go back to the refire frames, instead of continuing on to the reload frames.
|
2008-08-14 11:28:02 +00:00
|
|
|
ACTION_JUMP(jump);
|
2008-06-28 13:29:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// We need to reload. However, don't reload if we're out of ammo.
|
|
|
|
weapon->CheckAmmo( false, false );
|
|
|
|
}
|
2008-08-22 07:36:50 +00:00
|
|
|
|
|
|
|
if(!dontincrement)
|
|
|
|
weapon->ReloadCounter = ReloadCounter;
|
2008-06-28 13:29:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Resets the counter for the above function
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-12 08:00:28 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_ResetReloadCounter)
|
2008-06-28 13:29:59 +00:00
|
|
|
{
|
|
|
|
if ( self->player == NULL || self->player->ReadyWeapon == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
AWeapon *weapon = self->player->ReadyWeapon;
|
|
|
|
weapon->ReloadCounter = 0;
|
|
|
|
}
|