2006-02-24 04:48:15 +00:00
|
|
|
/*
|
|
|
|
** infodefaults.cpp
|
|
|
|
** Parses default lists to create default copies of actors
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
2007-03-07 17:31:40 +00:00
|
|
|
** Copyright 1998-2007 Randy Heit
|
2006-02-24 04:48:15 +00:00
|
|
|
** 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.
|
|
|
|
**
|
|
|
|
** 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 <assert.h>
|
|
|
|
#include "actor.h"
|
|
|
|
#include "info.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "p_conversation.h"
|
|
|
|
#include "a_pickups.h"
|
|
|
|
#include "gi.h"
|
|
|
|
#include "a_artifacts.h"
|
|
|
|
#include "a_keys.h"
|
|
|
|
#include "i_system.h"
|
|
|
|
#include "r_data.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
#include "a_strifeglobal.h"
|
2007-05-28 14:46:49 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void FActorInfo::BuildDefaults ()
|
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
if (Class->Defaults == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
Class->Defaults = new BYTE[Class->Size];
|
2006-02-24 04:48:15 +00:00
|
|
|
if (Class == RUNTIME_CLASS(AActor))
|
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
memset (Class->Defaults, 0, Class->Size);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
PClass *parent;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-10 02:40:43 +00:00
|
|
|
parent = Class->ParentClass;
|
2006-02-24 04:48:15 +00:00
|
|
|
parent->ActorInfo->BuildDefaults ();
|
2006-06-17 20:29:41 +00:00
|
|
|
Class->Meta = parent->Meta;
|
2006-12-02 15:38:50 +00:00
|
|
|
Class->Symbols.SetParentTable (&parent->Symbols);
|
2006-05-10 02:40:43 +00:00
|
|
|
assert (Class->Size >= parent->Size);
|
|
|
|
memcpy (Class->Defaults, parent->Defaults, parent->Size);
|
|
|
|
if (Class->Size > parent->Size)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
memset (Class->Defaults + parent->Size, 0, Class->Size - parent->Size);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
2006-05-10 02:40:43 +00:00
|
|
|
ApplyDefaults (Class->Defaults);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-10 02:40:43 +00:00
|
|
|
static FState *DefaultStates (PClass *type)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
FState *states = type->ActorInfo->OwnedStates;
|
|
|
|
|
|
|
|
if (states == NULL)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
type = type->ParentClass;
|
2006-02-24 04:48:15 +00:00
|
|
|
states = type->ActorInfo->OwnedStates;
|
|
|
|
} while (states == NULL && type != RUNTIME_CLASS(AActor));
|
|
|
|
}
|
|
|
|
return states;
|
|
|
|
}
|
|
|
|
|
2006-05-10 02:40:43 +00:00
|
|
|
static PClass *sgClass;
|
2006-02-24 04:48:15 +00:00
|
|
|
static BYTE *sgDefaults;
|
|
|
|
|
2006-10-31 14:53:21 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
static void ApplyActorDefault (int defnum, const char *datastr, int dataint)
|
|
|
|
{
|
2008-06-15 02:25:09 +00:00
|
|
|
FSoundID datasound;
|
2006-02-24 04:48:15 +00:00
|
|
|
FState *datastate = NULL;
|
2006-05-10 02:40:43 +00:00
|
|
|
const PClass *datatype;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (defnum <= ADEF_LastString)
|
|
|
|
{
|
|
|
|
if (defnum <= ADEF_Inventory_PickupSound)
|
|
|
|
{
|
2008-06-15 02:25:09 +00:00
|
|
|
datasound = datastr;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
2006-12-21 04:34:43 +00:00
|
|
|
else if (defnum > ADEF_LastString && dataint >= 0 && dataint < PROP_CLEAR_STATE)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
datastate = DefaultStates (sgClass) + dataint;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Different casts for the same thing
|
|
|
|
AActor *const actor = (AActor *)sgDefaults;
|
|
|
|
APowerupGiver *const giver = (APowerupGiver *)sgDefaults;
|
|
|
|
AInventory *const item = (AInventory *)sgDefaults;
|
|
|
|
ABasicArmorBonus *const armorb = (ABasicArmorBonus *)sgDefaults;
|
|
|
|
ABasicArmorPickup *const armorp = (ABasicArmorPickup *)sgDefaults;
|
|
|
|
APuzzleItem *const puzzl = (APuzzleItem *)sgDefaults;
|
|
|
|
APowerup *const power = (APowerup *)sgDefaults;
|
|
|
|
AWeapon *const weapon = (AWeapon *)sgDefaults;
|
|
|
|
ASigil *const sigil = (ASigil *)sgDefaults;
|
|
|
|
AAmmo *const ammo = (AAmmo *)sgDefaults;
|
2006-07-13 10:17:56 +00:00
|
|
|
APlayerPawn *const player = (APlayerPawn *)sgDefaults;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
switch (defnum)
|
|
|
|
{
|
|
|
|
case ADEF_Weapon_ProjectileType:
|
|
|
|
case ADEF_PowerupGiver_Powerup:
|
2006-05-10 02:40:43 +00:00
|
|
|
datatype = PClass::FindClass (datastr);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (datatype == NULL)
|
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
I_FatalError ("Unknown class %s in %s's default list", datastr, sgClass->TypeName.GetChars());
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
datatype = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (defnum)
|
|
|
|
{
|
|
|
|
case ADEF_SeeSound: actor->SeeSound = datasound; break;
|
|
|
|
case ADEF_AttackSound: actor->AttackSound = datasound; break;
|
|
|
|
case ADEF_PainSound: actor->PainSound = datasound; break;
|
|
|
|
case ADEF_DeathSound: actor->DeathSound = datasound; break;
|
|
|
|
case ADEF_ActiveSound: actor->ActiveSound = datasound; break;
|
|
|
|
case ADEF_UseSound: actor->UseSound = datasound; break;
|
|
|
|
case ADEF_Tag:
|
|
|
|
{
|
|
|
|
char name[256];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
// Replace underscores with spaces
|
|
|
|
i = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
name[i] = datastr[i] == '_' ? ' ' : datastr[i];
|
|
|
|
} while (datastr[i++] != 0);
|
|
|
|
sgClass->Meta.SetMetaString (AMETA_StrifeName, name);
|
|
|
|
break;
|
|
|
|
}
|
2006-06-17 20:29:41 +00:00
|
|
|
|
|
|
|
case ADEF_Obituary:
|
|
|
|
sgClass->Meta.SetMetaString (AMETA_Obituary, datastr);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ADEF_HitObituary:
|
|
|
|
sgClass->Meta.SetMetaString (AMETA_HitObituary, datastr);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ADEF_Inventory_PickupMsg:
|
|
|
|
sgClass->Meta.SetMetaString (AIMETA_PickupMessage, datastr);
|
|
|
|
break;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
case ADEF_PowerupGiver_Powerup:
|
|
|
|
giver->PowerupType = datatype;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ADEF_Inventory_Icon:
|
|
|
|
item->Icon = TexMan.AddPatch (datastr);
|
|
|
|
if (item->Icon <= 0)
|
|
|
|
{
|
|
|
|
item->Icon = TexMan.AddPatch (datastr, ns_sprites);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-11-14 16:54:02 +00:00
|
|
|
case ADEF_XScale: actor->scaleX = dataint; break;
|
|
|
|
case ADEF_YScale: actor->scaleY = dataint; break;
|
2006-02-24 04:48:15 +00:00
|
|
|
case ADEF_SpawnHealth: actor->health = dataint; break;
|
|
|
|
case ADEF_ReactionTime: actor->reactiontime = dataint; break;
|
|
|
|
case ADEF_PainChance: actor->PainChance = dataint; break;
|
|
|
|
case ADEF_Speed: actor->Speed = dataint; break;
|
2006-05-14 14:30:13 +00:00
|
|
|
case ADEF_FloatSpeed: actor->FloatSpeed = dataint; break;
|
2006-02-24 04:48:15 +00:00
|
|
|
case ADEF_Radius: actor->radius = dataint; break;
|
|
|
|
case ADEF_Height: actor->height = dataint; break;
|
|
|
|
case ADEF_Mass: actor->Mass = dataint; break;
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
case ADEF_Damage: actor->Damage = dataint; break;
|
2006-10-31 14:53:21 +00:00
|
|
|
case ADEF_DamageType: actor->DamageType = (ENamedName)dataint; break;
|
2006-02-24 04:48:15 +00:00
|
|
|
case ADEF_Flags: actor->flags = dataint; break;
|
|
|
|
case ADEF_Flags2: actor->flags2 = dataint; break;
|
|
|
|
case ADEF_Flags3: actor->flags3 = dataint; break;
|
|
|
|
case ADEF_Flags4: actor->flags4 = dataint; break;
|
2006-04-16 13:29:50 +00:00
|
|
|
case ADEF_Flags5: actor->flags5 = dataint; break;
|
2006-02-24 04:48:15 +00:00
|
|
|
case ADEF_FlagsSet: actor->flags |= dataint; break;
|
|
|
|
case ADEF_Flags2Set: actor->flags2 |= dataint; break;
|
|
|
|
case ADEF_Flags3Set: actor->flags3 |= dataint; break;
|
|
|
|
case ADEF_Flags4Set: actor->flags4 |= dataint; break;
|
2006-04-16 13:29:50 +00:00
|
|
|
case ADEF_Flags5Set: actor->flags5 |= dataint; break;
|
2006-02-24 04:48:15 +00:00
|
|
|
case ADEF_FlagsClear: actor->flags &= ~dataint; break;
|
|
|
|
case ADEF_Flags2Clear: actor->flags2 &= ~dataint; break;
|
|
|
|
case ADEF_Flags3Clear: actor->flags3 &= ~dataint; break;
|
|
|
|
case ADEF_Flags4Clear: actor->flags4 &= ~dataint; break;
|
2006-04-16 13:29:50 +00:00
|
|
|
case ADEF_Flags5Clear: actor->flags5 &= ~dataint; break;
|
2006-02-24 04:48:15 +00:00
|
|
|
case ADEF_Alpha: actor->alpha = dataint; break;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
case ADEF_RenderStyle: actor->RenderStyle = ERenderStyle(dataint); break;
|
2006-02-24 04:48:15 +00:00
|
|
|
case ADEF_RenderFlags: actor->renderflags = dataint; break;
|
|
|
|
case ADEF_Translation: actor->Translation = dataint; break;
|
|
|
|
case ADEF_MinMissileChance: actor->MinMissileChance = dataint; break;
|
|
|
|
case ADEF_MeleeRange: actor->meleerange = dataint; break;
|
|
|
|
case ADEF_MaxDropOffHeight: actor->MaxDropOffHeight = dataint; break;
|
|
|
|
case ADEF_MaxStepHeight: actor->MaxStepHeight = dataint; break;
|
2006-04-11 16:27:41 +00:00
|
|
|
case ADEF_BounceFactor: actor->bouncefactor = dataint; break;
|
2008-06-10 09:16:01 +00:00
|
|
|
case ADEF_WallBounceFactor: actor->wallbouncefactor = dataint; break;
|
2006-04-18 22:15:05 +00:00
|
|
|
case ADEF_BounceCount: actor->bouncecount = dataint; break;
|
2006-06-03 12:30:11 +00:00
|
|
|
case ADEF_RDFactor: sgClass->Meta.SetMetaFixed (AMETA_RDFactor, dataint); break;
|
2006-10-15 20:27:16 +00:00
|
|
|
case ADEF_FXFlags: actor->effects = dataint; break;
|
2007-01-20 14:27:44 +00:00
|
|
|
case ADEF_Gravity: actor->gravity = dataint; break;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-10-31 14:53:21 +00:00
|
|
|
case ADEF_SpawnState: AddState("Spawn", datastate); break;
|
|
|
|
case ADEF_SeeState: AddState("See", datastate); break;
|
|
|
|
case ADEF_PainState: AddState("Pain", datastate); break;
|
|
|
|
case ADEF_MeleeState: AddState("Melee", datastate); break;
|
|
|
|
case ADEF_MissileState: AddState("Missile", datastate); break;
|
|
|
|
case ADEF_CrashState: AddState("Crash", datastate); break;
|
|
|
|
case ADEF_DeathState: AddState("Death", datastate); break;
|
|
|
|
case ADEF_XDeathState: AddState("XDeath", datastate); break;
|
|
|
|
case ADEF_BDeathState: AddState("Burn", datastate); break;
|
|
|
|
case ADEF_IDeathState: AddState("Ice", datastate); break;
|
|
|
|
case ADEF_EDeathState: AddState("Disintegrate", datastate);break;
|
|
|
|
case ADEF_RaiseState: AddState("Raise", datastate); break;
|
|
|
|
case ADEF_WoundState: AddState("Wound", datastate); break;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
case ADEF_StrifeType: if (!(gameinfo.flags & GI_SHAREWARE)) StrifeTypes[dataint] = sgClass; break;
|
|
|
|
case ADEF_StrifeTeaserType:
|
|
|
|
if ((gameinfo.flags & (GI_SHAREWARE|GI_TEASER2)) == (GI_SHAREWARE))
|
|
|
|
StrifeTypes[dataint] = sgClass;
|
|
|
|
break;
|
|
|
|
case ADEF_StrifeTeaserType2:
|
|
|
|
if ((gameinfo.flags & (GI_SHAREWARE|GI_TEASER2)) == (GI_SHAREWARE|GI_TEASER2))
|
|
|
|
StrifeTypes[dataint] = sgClass;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ADEF_Inventory_FlagsSet: item->ItemFlags |= dataint; break;
|
|
|
|
case ADEF_Inventory_FlagsClear: item->ItemFlags &= ~dataint; break;
|
2008-02-17 02:40:03 +00:00
|
|
|
case ADEF_Inventory_PickupFlash:if(dataint) { item->PickupFlash = fuglyname("PickupFlash"); } else { item->PickupFlash = NULL; } break;
|
2006-02-24 04:48:15 +00:00
|
|
|
case ADEF_Inventory_Amount: item->Amount = dataint; break;
|
|
|
|
case ADEF_Inventory_RespawnTics:item->RespawnTics = dataint; break;
|
|
|
|
case ADEF_Inventory_MaxAmount: item->MaxAmount = dataint; break;
|
|
|
|
case ADEF_Inventory_DefMaxAmount:
|
|
|
|
// In Heretic, the maximum number of artifacts of one kind you can carry is 16.
|
|
|
|
// In Hexen, it was upped to 25.
|
|
|
|
item->MaxAmount = gameinfo.gametype == GAME_Heretic ? 16 : 25;
|
|
|
|
break;
|
|
|
|
case ADEF_Inventory_PickupSound:item->PickupSound = datasound; break;
|
|
|
|
|
|
|
|
case ADEF_BasicArmorPickup_SavePercent: armorp->SavePercent = dataint; break;
|
|
|
|
case ADEF_BasicArmorPickup_SaveAmount: armorp->SaveAmount = dataint; break;
|
|
|
|
case ADEF_BasicArmorBonus_SavePercent: armorb->SavePercent = dataint; break;
|
|
|
|
case ADEF_BasicArmorBonus_SaveAmount: armorb->SaveAmount = dataint; break;
|
|
|
|
case ADEF_BasicArmorBonus_MaxSaveAmount: armorb->MaxSaveAmount = dataint; break;
|
|
|
|
case ADEF_HexenArmor_ArmorAmount: item->Amount = dataint; break;
|
|
|
|
|
|
|
|
case ADEF_PuzzleItem_Number: puzzl->PuzzleItemNumber = dataint; break;
|
|
|
|
|
|
|
|
case ADEF_PowerupGiver_EffectTics:giver->EffectTics = dataint; break;
|
|
|
|
|
|
|
|
case ADEF_Powerup_EffectTics: power->EffectTics = dataint; break;
|
|
|
|
case ADEF_Powerup_Color: power->BlendColor = dataint; break;
|
|
|
|
|
|
|
|
case ADEF_Ammo_BackpackAmount: ammo->BackpackAmount = dataint; break;
|
|
|
|
case ADEF_Ammo_BackpackMaxAmount:ammo->BackpackMaxAmount = dataint; break;
|
2006-06-03 12:30:11 +00:00
|
|
|
case ADEF_Ammo_DropAmount: sgClass->Meta.SetMetaInt (AIMETA_DropAmount, dataint); break;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
case ADEF_Weapon_Flags: weapon->WeaponFlags = dataint; break;
|
|
|
|
case ADEF_Weapon_FlagsSet: weapon->WeaponFlags |= dataint; break;
|
|
|
|
case ADEF_Weapon_UpSound: weapon->UpSound = datasound; break;
|
|
|
|
case ADEF_Weapon_ReadySound: weapon->ReadySound = datasound; break;
|
2006-06-17 20:29:41 +00:00
|
|
|
case ADEF_Weapon_SisterType: weapon->SisterWeaponType = fuglyname(datastr); break;
|
2006-02-24 04:48:15 +00:00
|
|
|
case ADEF_Weapon_ProjectileType:weapon->ProjectileType = datatype; break;
|
2006-06-17 20:29:41 +00:00
|
|
|
case ADEF_Weapon_AmmoType1: weapon->AmmoType1 = fuglyname(datastr); break;
|
|
|
|
case ADEF_Weapon_AmmoType2: weapon->AmmoType2 = fuglyname(datastr); break;
|
2006-02-24 04:48:15 +00:00
|
|
|
case ADEF_Weapon_AmmoGive1: weapon->AmmoGive1 = dataint; break;
|
|
|
|
case ADEF_Weapon_AmmoGive2: weapon->AmmoGive2 = dataint; break;
|
|
|
|
case ADEF_Weapon_AmmoUse1: weapon->AmmoUse1 = dataint; break;
|
|
|
|
case ADEF_Weapon_AmmoUse2: weapon->AmmoUse2 = dataint; break;
|
|
|
|
case ADEF_Weapon_Kickback: weapon->Kickback = dataint; break;
|
|
|
|
case ADEF_Weapon_YAdjust: weapon->YAdjust = (dataint<<8)>>8; break;
|
|
|
|
case ADEF_Weapon_SelectionOrder:weapon->SelectionOrder = dataint; break;
|
|
|
|
case ADEF_Weapon_MoveCombatDist:weapon->MoveCombatDist = dataint; break;
|
2006-10-31 14:53:21 +00:00
|
|
|
|
|
|
|
case ADEF_Weapon_UpState: AddState("Select", datastate); break;
|
|
|
|
case ADEF_Weapon_DownState: AddState("Deselect", datastate); break;
|
|
|
|
case ADEF_Weapon_ReadyState: AddState("Ready", datastate); break;
|
|
|
|
case ADEF_Weapon_AtkState: AddState("Fire", datastate); break;
|
|
|
|
case ADEF_Weapon_HoldAtkState: AddState("Hold", datastate); break;
|
|
|
|
case ADEF_Weapon_FlashState: AddState("Flash", datastate); break;
|
2006-02-24 04:48:15 +00:00
|
|
|
case ADEF_Sigil_NumPieces: sigil->NumPieces = dataint; break;
|
2006-07-13 10:17:56 +00:00
|
|
|
|
|
|
|
// [GRB] Player class properties
|
|
|
|
case ADEF_PlayerPawn_JumpZ: player->JumpZ = dataint; break;
|
2007-03-07 17:31:40 +00:00
|
|
|
case ADEF_PlayerPawn_AttackZOffset: player->AttackZOffset = dataint; break;
|
2006-07-13 10:17:56 +00:00
|
|
|
case ADEF_PlayerPawn_ViewHeight: player->ViewHeight = dataint; break;
|
|
|
|
case ADEF_PlayerPawn_ForwardMove1: player->ForwardMove1 = dataint; break;
|
|
|
|
case ADEF_PlayerPawn_ForwardMove2: player->ForwardMove2 = dataint; break;
|
|
|
|
case ADEF_PlayerPawn_SideMove1: player->SideMove1 = dataint; break;
|
|
|
|
case ADEF_PlayerPawn_SideMove2: player->SideMove2 = dataint; break;
|
|
|
|
case ADEF_PlayerPawn_ColorRange: sgClass->Meta.SetMetaInt (APMETA_ColorRange, dataint); break;
|
|
|
|
case ADEF_PlayerPawn_CrouchSprite: player->crouchsprite = GetSpriteIndex(datastr); break;
|
|
|
|
case ADEF_PlayerPawn_SpawnMask: player->SpawnMask = dataint; break;
|
2006-08-17 00:19:26 +00:00
|
|
|
case ADEF_PlayerPawn_MorphWeapon: player->MorphWeapon = FName(datastr); break;
|
2006-07-13 10:17:56 +00:00
|
|
|
|
|
|
|
case ADEF_PlayerPawn_DisplayName:
|
|
|
|
sgClass->Meta.SetMetaString (APMETA_DisplayName, datastr);
|
|
|
|
break;
|
|
|
|
case ADEF_PlayerPawn_SoundClass:
|
|
|
|
sgClass->Meta.SetMetaString (APMETA_SoundClass, datastr);
|
|
|
|
break;
|
2008-04-05 12:14:33 +00:00
|
|
|
case ADEF_PlayerPawn_Face:
|
|
|
|
sgClass->Meta.SetMetaString (APMETA_Face, datastr);
|
|
|
|
break;
|
2006-07-13 10:17:56 +00:00
|
|
|
case ADEF_PlayerPawn_ScoreIcon:
|
|
|
|
player->ScoreIcon = TexMan.AddPatch (datastr);
|
|
|
|
if (player->ScoreIcon <= 0)
|
|
|
|
{
|
|
|
|
player->ScoreIcon = TexMan.AddPatch (datastr, ns_sprites);
|
|
|
|
}
|
|
|
|
break;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef _MSC_VER
|
|
|
|
void ApplyActorDefault (int defnum, const char *datastr)
|
|
|
|
{
|
|
|
|
ApplyActorDefault (defnum, datastr, 0);
|
|
|
|
}
|
|
|
|
void ApplyActorDefault (int defnum, int dataint)
|
|
|
|
{
|
|
|
|
ApplyActorDefault (defnum, 0, dataint);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void FActorInfo::ApplyDefaults (BYTE *defaults)
|
|
|
|
{
|
|
|
|
sgClass = Class;
|
|
|
|
sgDefaults = defaults;
|
|
|
|
|
2006-12-16 12:50:36 +00:00
|
|
|
if (Class != RUNTIME_CLASS(AActor))
|
|
|
|
{
|
|
|
|
MakeStateDefines(Class->ParentClass->ActorInfo->StateList);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ClearStateLabels();
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
#if _MSC_VER
|
|
|
|
const BYTE *parser = DefaultList;
|
|
|
|
|
|
|
|
const char *datastr = NULL;
|
|
|
|
int dataint = 0;
|
|
|
|
int defnum;
|
|
|
|
int deftype;
|
|
|
|
|
|
|
|
while ((defnum = *(WORD *)parser) != ADEF_EOL)
|
|
|
|
{
|
|
|
|
deftype = defnum >> (16-2);
|
|
|
|
defnum &= 0x3FFF;
|
|
|
|
parser += 2;
|
|
|
|
if (defnum <= ADEF_LastString)
|
|
|
|
{
|
|
|
|
datastr = (const char *)parser;
|
|
|
|
parser = (const BYTE *)datastr + strlen (datastr) + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (deftype)
|
|
|
|
{
|
|
|
|
case 0: // byte
|
|
|
|
dataint = *parser;
|
|
|
|
parser++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: // byte * FRACUNIT;
|
|
|
|
dataint = *parser << FRACBITS;
|
|
|
|
parser++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: // word
|
|
|
|
dataint = *(WORD *)parser;
|
|
|
|
parser += 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: // long
|
|
|
|
dataint = *(DWORD *)parser;
|
|
|
|
parser += 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
defnum &= ~ADEFTYPE_MASK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApplyActorDefault (defnum, datastr, dataint);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
DefaultsConstructor ();
|
|
|
|
#endif
|
2006-10-31 14:53:21 +00:00
|
|
|
InstallStates(this, ((AActor *)defaults));
|
2006-02-24 04:48:15 +00:00
|
|
|
// Anything that is CountKill is also a monster, even if it doesn't specify it.
|
|
|
|
if (((AActor *)defaults)->flags & MF_COUNTKILL)
|
|
|
|
{
|
|
|
|
((AActor *)defaults)->flags3 |= MF3_ISMONSTER;
|
2007-04-22 21:01:35 +00:00
|
|
|
((AActor *)defaults)->flags4 |= MF4_CANUSEWALLS; // I won't bother changing all internal monster definitions so let's set this here.
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2006-05-13 12:41:15 +00:00
|
|
|
// Any default projectile in Raven's games produces blood splatter
|
|
|
|
if (gameinfo.gametype & GAME_Raven && ((AActor *)defaults)->flags & MF_MISSILE)
|
|
|
|
{
|
|
|
|
((AActor *)defaults)->flags5 |= MF5_BLOODSPLATTER;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|