Update to ZDoom r1921:

- added 'defaultterrain' option to terrain parser for mods that want to have
  a different default terrain than a generic solid surface.
- added format char processing to A_Print(Bold) and all printable messages
  that can be defined in DECORATE.
- Fixed: The railgun code ignored MF3_ALWAYSPUFF.
- added desaturated translations.
- added optional state parameters to A_ReFire and A_GunFlash and A_CountdownArg.
- added ACS CheckActorClass function
- fixed: When a blasted actor collided with another one this other actor's
  DONTBLAST flag was not checked.
- added a global DamageFactor actor property. All damage this actor takes is multiplied
  by this factor in addition to damage type specific damage factors.
- added better earthquake functions for ACS and DECORATE.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@549 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
Christoph Oelckers 2009-10-16 16:17:24 +00:00
parent 8bc4df43d0
commit daf0e06890
22 changed files with 306 additions and 82 deletions

View file

@ -1,3 +1,23 @@
October 16, 2009 (Changes by Graf Zahl)
- added 'defaultterrain' option to terrain parser for mods that want to have
a different default terrain than a generic solid surface.
- added format char processing to A_Print(Bold) and all printable messages
that can be defined in DECORATE.
- Fixed: The railgun code ignored MF3_ALWAYSPUFF.
- added desaturated translations.
- added optional state parameters to A_ReFire and A_GunFlash and A_CountdownArg.
October 15, 2009 (Changes by Graf Zahl)
- added ACS CheckActorClass function
- fixed: When a blasted actor collided with another one this other actor's
DONTBLAST flag was not checked.
- added a global DamageFactor actor property. All damage this actor takes is multiplied
by this factor in addition to damage type specific damage factors.
- added better earthquake functions for ACS and DECORATE.
October 10, 2009 (Changes by Graf Zahl)
- Added MF6_NOTRIGGER flag that disables all line actions for an actor.
October 9, 2009 (Changes by Graf Zahl) October 9, 2009 (Changes by Graf Zahl)
- Added Gez's seeker missile submission. - Added Gez's seeker missile submission.
- Added Gez's thing activation submission. - Added Gez's thing activation submission.

View file

@ -851,6 +851,7 @@ public:
SWORD PainChance; SWORD PainChance;
int PainThreshold; int PainThreshold;
FNameNoInit DamageType; FNameNoInit DamageType;
fixed_t DamageFactor;
FState *SpawnState; FState *SpawnState;
FState *SeeState; FState *SeeState;

View file

@ -1824,8 +1824,8 @@ CCMD (echo)
int last = argv.argc()-1; int last = argv.argc()-1;
for (int i = 1; i <= last; ++i) for (int i = 1; i <= last; ++i)
{ {
strbin (argv[i]); FString formatted = strbin1 (argv[i]);
Printf ("%s%s", argv[i], i!=last ? " " : "\n"); Printf ("%s%s", formatted.GetChars(), i!=last ? " " : "\n");
} }
} }

View file

@ -252,7 +252,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LoadShotgun2)
DEFINE_ACTION_FUNCTION(AActor, A_CloseShotgun2) DEFINE_ACTION_FUNCTION(AActor, A_CloseShotgun2)
{ {
S_Sound (self, CHAN_WEAPON, "weapons/sshotc", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "weapons/sshotc", 1, ATTN_NORM);
CALL_ACTION(A_ReFire, self); A_ReFire (self);
} }

View file

@ -33,14 +33,14 @@ DEarthquake::DEarthquake()
//========================================================================== //==========================================================================
DEarthquake::DEarthquake (AActor *center, int intensity, int duration, DEarthquake::DEarthquake (AActor *center, int intensity, int duration,
int damrad, int tremrad) int damrad, int tremrad, FSoundID quakesound)
: DThinker(STAT_EARTHQUAKE) : DThinker(STAT_EARTHQUAKE)
{ {
m_QuakeSFX = "world/quake"; m_QuakeSFX = quakesound;
m_Spot = center; m_Spot = center;
// Radii are specified in tile units (64 pixels) // Radii are specified in tile units (64 pixels)
m_DamageRadius = damrad << (FRACBITS+6); m_DamageRadius = damrad << (FRACBITS);
m_TremorRadius = tremrad << (FRACBITS+6); m_TremorRadius = tremrad << (FRACBITS);
m_Intensity = intensity; m_Intensity = intensity;
m_Countdown = duration; m_Countdown = duration;
} }
@ -56,7 +56,15 @@ void DEarthquake::Serialize (FArchive &arc)
Super::Serialize (arc); Super::Serialize (arc);
arc << m_Spot << m_Intensity << m_Countdown arc << m_Spot << m_Intensity << m_Countdown
<< m_TremorRadius << m_DamageRadius; << m_TremorRadius << m_DamageRadius;
m_QuakeSFX = "world/quake";
if (SaveVersion >= 1912)
{
arc << m_QuakeSFX;
}
else
{
m_QuakeSFX = "world/quake";
}
} }
//========================================================================== //==========================================================================
@ -158,7 +166,7 @@ int DEarthquake::StaticGetQuakeIntensity (AActor *victim)
// //
//========================================================================== //==========================================================================
bool P_StartQuake (AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad) bool P_StartQuake (AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad, FSoundID quakesfx)
{ {
AActor *center; AActor *center;
bool res = false; bool res = false;
@ -169,7 +177,7 @@ bool P_StartQuake (AActor *activator, int tid, int intensity, int duration, int
{ {
if (activator != NULL) if (activator != NULL)
{ {
new DEarthquake(activator, intensity, duration, damrad, tremrad); new DEarthquake(activator, intensity, duration, damrad, tremrad, quakesfx);
return true; return true;
} }
} }
@ -179,7 +187,7 @@ bool P_StartQuake (AActor *activator, int tid, int intensity, int duration, int
while ( (center = iterator.Next ()) ) while ( (center = iterator.Next ()) )
{ {
res = true; res = true;
new DEarthquake (center, intensity, duration, damrad, tremrad); new DEarthquake (center, intensity, duration, damrad, tremrad, quakesfx);
} }
} }

View file

@ -128,7 +128,7 @@ class DEarthquake : public DThinker
DECLARE_CLASS (DEarthquake, DThinker) DECLARE_CLASS (DEarthquake, DThinker)
HAS_OBJECT_POINTERS HAS_OBJECT_POINTERS
public: public:
DEarthquake (AActor *center, int intensity, int duration, int damrad, int tremrad); DEarthquake (AActor *center, int intensity, int duration, int damrad, int tremrad, FSoundID quakesfx);
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void Tick (); void Tick ();

View file

@ -2429,6 +2429,7 @@ enum
APROP_NameTag = 21, APROP_NameTag = 21,
APROP_Score = 22, APROP_Score = 22,
APROP_Notrigger = 23, APROP_Notrigger = 23,
APROP_DamageFactor = 24,
}; };
// These are needed for ACS's APROP_RenderStyle // These are needed for ACS's APROP_RenderStyle
@ -2593,6 +2594,10 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
actor->Tag = FBehavior::StaticLookupString(value); actor->Tag = FBehavior::StaticLookupString(value);
break; break;
case APROP_DamageFactor:
actor->DamageFactor = value;
break;
default: default:
// do nothing. // do nothing.
break; break;
@ -2625,6 +2630,7 @@ int DLevelScript::GetActorProperty (int tid, int property)
case APROP_Health: return actor->health; case APROP_Health: return actor->health;
case APROP_Speed: return actor->Speed; case APROP_Speed: return actor->Speed;
case APROP_Damage: return actor->Damage; // Should this call GetMissileDamage() instead? case APROP_Damage: return actor->Damage; // Should this call GetMissileDamage() instead?
case APROP_DamageFactor:return actor->DamageFactor;
case APROP_Alpha: return actor->alpha; case APROP_Alpha: return actor->alpha;
case APROP_RenderStyle: for (int style = STYLE_None; style < STYLE_Count; ++style) case APROP_RenderStyle: for (int style = STYLE_None; style < STYLE_Count; ++style)
{ // Check for a legacy render style that matches. { // Check for a legacy render style that matches.
@ -2685,6 +2691,7 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value)
case APROP_Health: case APROP_Health:
case APROP_Speed: case APROP_Speed:
case APROP_Damage: case APROP_Damage:
case APROP_DamageFactor:
case APROP_Alpha: case APROP_Alpha:
case APROP_RenderStyle: case APROP_RenderStyle:
case APROP_Gravity: case APROP_Gravity:
@ -2899,6 +2906,8 @@ enum EACSFunctions
ACSF_SetActorVelocity, ACSF_SetActorVelocity,
ACSF_SetUserVariable, ACSF_SetUserVariable,
ACSF_GetUserVariable, ACSF_GetUserVariable,
ACSF_Radius_Quake2,
ACSF_CheckActorClass,
}; };
int DLevelScript::SideFromID(int id, int side) int DLevelScript::SideFromID(int id, int side)
@ -3133,7 +3142,17 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
} }
else return 0; else return 0;
} }
case ACSF_Radius_Quake2:
P_StartQuake(activator, args[0], args[1], args[2], args[3], args[4], FBehavior::StaticLookupString(args[5]));
break;
case ACSF_CheckActorClass:
{
AActor *a = args[0] == 0 ? (AActor *)activator : SingleActorFromTID(args[0], NULL);
return a->GetClass()->TypeName == FName(FBehavior::StaticLookupString(args[1]));
}
default: default:
break; break;

View file

@ -1009,6 +1009,8 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
if (damage <= 0) return; if (damage <= 0) return;
} }
} }
damage = FixedMul(damage, target->DamageFactor);
if (damage <= 0) return;
damage = target->TakeSpecialDamage (inflictor, source, damage, mod); damage = target->TakeSpecialDamage (inflictor, source, damage, mod);
} }

View file

@ -1736,7 +1736,7 @@ FUNC(LS_Light_Stop)
FUNC(LS_Radius_Quake) FUNC(LS_Radius_Quake)
// Radius_Quake (intensity, duration, damrad, tremrad, tid) // Radius_Quake (intensity, duration, damrad, tremrad, tid)
{ {
return P_StartQuake (it, arg4, arg0, arg1, arg2, arg3); return P_StartQuake (it, arg4, arg0, arg1, arg2*64, arg3*64, "world/quake");
} }
FUNC(LS_UsePuzzleItem) FUNC(LS_UsePuzzleItem)

View file

@ -886,8 +886,9 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
// Check for blasted thing running into another // Check for blasted thing running into another
if ((tm.thing->flags2 & MF2_BLASTED) && (thing->flags & MF_SHOOTABLE)) if ((tm.thing->flags2 & MF2_BLASTED) && (thing->flags & MF_SHOOTABLE))
{ {
if (!(thing->flags2 & MF2_BOSS) && (thing->flags3 & MF3_ISMONSTER)) if (!(thing->flags2 & MF2_BOSS) && (thing->flags3 & MF3_ISMONSTER) && !(thing->flags3 & MF3_DONTBLAST))
{ {
// ideally this should take the mass factor into account
thing->velx += tm.thing->velx; thing->velx += tm.thing->velx;
thing->vely += tm.thing->vely; thing->vely += tm.thing->vely;
if ((thing->velx + thing->vely) > 3*FRACUNIT) if ((thing->velx + thing->vely) > 3*FRACUNIT)
@ -3766,6 +3767,7 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
for (i = 0; i < RailHits.Size (); i++) for (i = 0; i < RailHits.Size (); i++)
{ {
fixed_t x, y, z; fixed_t x, y, z;
bool spawnpuff;
x = x1 + FixedMul (RailHits[i].Distance, vx); x = x1 + FixedMul (RailHits[i].Distance, vx);
y = y1 + FixedMul (RailHits[i].Distance, vy); y = y1 + FixedMul (RailHits[i].Distance, vy);
@ -3774,13 +3776,15 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
if ((RailHits[i].HitActor->flags & MF_NOBLOOD) || if ((RailHits[i].HitActor->flags & MF_NOBLOOD) ||
(RailHits[i].HitActor->flags2 & (MF2_DORMANT|MF2_INVULNERABLE))) (RailHits[i].HitActor->flags2 & (MF2_DORMANT|MF2_INVULNERABLE)))
{ {
if (puffclass != NULL) P_SpawnPuff (source, puffclass, x, y, z, source->angle - ANG90, 1, PF_HITTHING); spawnpuff = puffclass != NULL;
} }
else else
{ {
spawnpuff = (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF);
P_SpawnBlood (x, y, z, source->angle - ANG180, damage, RailHits[i].HitActor); P_SpawnBlood (x, y, z, source->angle - ANG180, damage, RailHits[i].HitActor);
P_TraceBleed (damage, x, y, z, RailHits[i].HitActor, source->angle, pitch); P_TraceBleed (damage, x, y, z, RailHits[i].HitActor, source->angle, pitch);
} }
if (spawnpuff) P_SpawnPuff (source, puffclass, x, y, z, source->angle - ANG90, 1, PF_HITTHING);
P_DamageMobj (RailHits[i].HitActor, thepuff? thepuff:source, source, damage, damagetype, DMG_INFLICTOR_IS_PUFF); P_DamageMobj (RailHits[i].HitActor, thepuff? thepuff:source, source, damage, damagetype, DMG_INFLICTOR_IS_PUFF);
} }
@ -3788,6 +3792,11 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
if (trace.HitType == TRACE_HitWall) if (trace.HitType == TRACE_HitWall)
{ {
SpawnShootDecal (source, trace); SpawnShootDecal (source, trace);
if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF)
{
P_SpawnPuff (source, puffclass, trace.X, trace.Y, trace.Z, source->angle - ANG90, 1, 0);
}
} }
if (trace.HitType == TRACE_HitFloor && if (trace.HitType == TRACE_HitFloor &&
trace.CrossedWater == NULL && trace.CrossedWater == NULL &&

View file

@ -310,6 +310,10 @@ void AActor::Serialize (FArchive &arc)
{ {
arc << PainThreshold; arc << PainThreshold;
} }
if (SaveVersion >= 1914)
{
arc << DamageFactor;
}
for(int i=0; i<10; i++) arc << uservar[i]; for(int i=0; i<10; i++) arc << uservar[i];

View file

@ -206,7 +206,7 @@ void P_BringUpWeapon (player_t *player)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void P_FireWeapon (player_t *player) void P_FireWeapon (player_t *player, FState *state)
{ {
AWeapon *weapon; AWeapon *weapon;
@ -225,7 +225,11 @@ void P_FireWeapon (player_t *player)
player->mo->PlayAttacking (); player->mo->PlayAttacking ();
weapon->bAltFire = false; weapon->bAltFire = false;
P_SetPsprite (player, ps_weapon, weapon->GetAtkState(!!player->refire)); if (state == NULL)
{
state = weapon->GetAtkState(!!player->refire);
}
P_SetPsprite (player, ps_weapon, state);
if (!(weapon->WeaponFlags & WIF_NOALERT)) if (!(weapon->WeaponFlags & WIF_NOALERT))
{ {
P_NoiseAlert (player->mo, player->mo, false); P_NoiseAlert (player->mo, player->mo, false);
@ -238,7 +242,7 @@ void P_FireWeapon (player_t *player)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void P_FireWeaponAlt (player_t *player) void P_FireWeaponAlt (player_t *player, FState *state)
{ {
AWeapon *weapon; AWeapon *weapon;
@ -258,8 +262,12 @@ void P_FireWeaponAlt (player_t *player)
player->mo->PlayAttacking (); player->mo->PlayAttacking ();
weapon->bAltFire = true; weapon->bAltFire = true;
if (state == NULL)
{
state = weapon->GetAltAtkState(!!player->refire);
}
P_SetPsprite (player, ps_weapon, weapon->GetAltAtkState(!!player->refire)); P_SetPsprite (player, ps_weapon, state);
if (!(weapon->WeaponFlags & WIF_NOALERT)) if (!(weapon->WeaponFlags & WIF_NOALERT))
{ {
P_NoiseAlert (player->mo, player->mo, false); P_NoiseAlert (player->mo, player->mo, false);
@ -456,7 +464,7 @@ void P_CheckWeaponFire (player_t *player)
if (!player->attackdown || !(weapon->WeaponFlags & WIF_NOAUTOFIRE)) if (!player->attackdown || !(weapon->WeaponFlags & WIF_NOAUTOFIRE))
{ {
player->attackdown = true; player->attackdown = true;
P_FireWeapon (player); P_FireWeapon (player, NULL);
return; return;
} }
} }
@ -465,7 +473,7 @@ void P_CheckWeaponFire (player_t *player)
if (!player->attackdown || !(weapon->WeaponFlags & WIF_NOAUTOFIRE)) if (!player->attackdown || !(weapon->WeaponFlags & WIF_NOAUTOFIRE))
{ {
player->attackdown = true; player->attackdown = true;
P_FireWeaponAlt (player); P_FireWeaponAlt (player, NULL);
return; return;
} }
} }
@ -507,7 +515,15 @@ void P_CheckWeaponSwitch (player_t *player)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
DEFINE_ACTION_FUNCTION(AInventory, A_ReFire) DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_ReFire)
{
ACTION_PARAM_START(1)
ACTION_PARAM_STATE(state, 0);
A_ReFire(self, state);
}
void A_ReFire(AActor *self, FState *state)
{ {
player_t *player = self->player; player_t *player = self->player;
@ -520,14 +536,14 @@ DEFINE_ACTION_FUNCTION(AInventory, A_ReFire)
&& player->PendingWeapon == WP_NOCHANGE && player->health) && player->PendingWeapon == WP_NOCHANGE && player->health)
{ {
player->refire++; player->refire++;
P_FireWeapon (player); P_FireWeapon (player, state);
} }
else if ((player->cmd.ucmd.buttons&BT_ALTATTACK) else if ((player->cmd.ucmd.buttons&BT_ALTATTACK)
&& player->ReadyWeapon->bAltFire && player->ReadyWeapon->bAltFire
&& player->PendingWeapon == WP_NOCHANGE && player->health) && player->PendingWeapon == WP_NOCHANGE && player->health)
{ {
player->refire++; player->refire++;
P_FireWeaponAlt (player); P_FireWeaponAlt (player, state);
} }
else else
{ {
@ -661,8 +677,11 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Raise)
// //
// A_GunFlash // A_GunFlash
// //
DEFINE_ACTION_FUNCTION(AInventory, A_GunFlash) DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_GunFlash)
{ {
ACTION_PARAM_START(1)
ACTION_PARAM_STATE(flash, 0);
player_t *player = self->player; player_t *player = self->player;
if (NULL == player) if (NULL == player)
@ -671,9 +690,11 @@ DEFINE_ACTION_FUNCTION(AInventory, A_GunFlash)
} }
player->mo->PlayAttacking2 (); player->mo->PlayAttacking2 ();
FState * flash=NULL; if (flash == NULL)
if (player->ReadyWeapon->bAltFire) flash = player->ReadyWeapon->FindState(NAME_AltFlash); {
if (flash == NULL) flash = player->ReadyWeapon->FindState(NAME_Flash); if (player->ReadyWeapon->bAltFire) flash = player->ReadyWeapon->FindState(NAME_AltFlash);
if (flash == NULL) flash = player->ReadyWeapon->FindState(NAME_Flash);
}
P_SetPsprite (player, ps_flash, flash); P_SetPsprite (player, ps_flash, flash);
} }

View file

@ -95,6 +95,6 @@ void DoReadyWeaponToFire(AActor * self, bool primary = true, bool secondary = tr
void DoReadyWeaponToSwitch(AActor * self); void DoReadyWeaponToSwitch(AActor * self);
DECLARE_ACTION(A_Raise) DECLARE_ACTION(A_Raise)
DECLARE_ACTION(A_ReFire) void A_ReFire(AActor *self, FState *state = NULL);
#endif // __P_PSPR_H__ #endif // __P_PSPR_H__

View file

@ -981,6 +981,6 @@ void P_DoDeferedScripts (void);
// //
// [RH] p_quake.c // [RH] p_quake.c
// //
bool P_StartQuake (AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad); bool P_StartQuake (AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad, FSoundID quakesfx);
#endif #endif

View file

@ -63,7 +63,8 @@ enum EOuterKeywords
OUT_IFHERETIC, OUT_IFHERETIC,
OUT_IFHEXEN, OUT_IFHEXEN,
OUT_IFSTRIFE, OUT_IFSTRIFE,
OUT_ENDIF OUT_ENDIF,
OUT_DEFAULTTERRAIN
}; };
enum ETerrainKeywords enum ETerrainKeywords
@ -125,6 +126,7 @@ static void GenericParse (FScanner &sc, FGenericParse *parser, const char **keyw
void *fields, const char *type, FName name); void *fields, const char *type, FName name);
static void ParseDamage (FScanner &sc, int keyword, void *fields); static void ParseDamage (FScanner &sc, int keyword, void *fields);
static void ParseFriction (FScanner &sc, int keyword, void *fields); static void ParseFriction (FScanner &sc, int keyword, void *fields);
static void ParseDefault (FScanner &sc);
// EXTERNAL DATA DECLARATIONS ---------------------------------------------- // EXTERNAL DATA DECLARATIONS ----------------------------------------------
@ -133,6 +135,7 @@ static void ParseFriction (FScanner &sc, int keyword, void *fields);
FTerrainTypeArray TerrainTypes; FTerrainTypeArray TerrainTypes;
TArray<FSplashDef> Splashes; TArray<FSplashDef> Splashes;
TArray<FTerrainDef> Terrains; TArray<FTerrainDef> Terrains;
WORD DefaultTerrainType;
// PRIVATE DATA DEFINITIONS ------------------------------------------------ // PRIVATE DATA DEFINITIONS ------------------------------------------------
@ -146,6 +149,7 @@ static const char *OuterKeywords[] =
"ifhexen", "ifhexen",
"ifstrife", "ifstrife",
"endif", "endif",
"defaultterrain",
NULL NULL
}; };
@ -222,27 +226,7 @@ static FGenericParse TerrainParser[] =
{ GEN_Bool, {theoffsetof(FTerrainDef, AllowProtection)} }, { GEN_Bool, {theoffsetof(FTerrainDef, AllowProtection)} },
}; };
/*
struct
{
char *name;
int type;
bool Heretic;
}
TerrainTypeDefs[] =
{
{ "FLTWAWA1", FLOOR_WATER, true },
{ "FLTFLWW1", FLOOR_WATER, true },
{ "FLTLAVA1", FLOOR_LAVA, true },
{ "FLATHUH1", FLOOR_LAVA, true },
{ "FLTSLUD1", FLOOR_SLUDGE, true },
{ "X_005", FLOOR_WATER, false },
{ "X_001", FLOOR_LAVA, false },
{ "X_009", FLOOR_SLUDGE, false },
{ "F_033", FLOOR_ICE, false },
{ "END", -1 }
};
*/
// CODE -------------------------------------------------------------------- // CODE --------------------------------------------------------------------
@ -258,9 +242,9 @@ void P_InitTerrainTypes ()
int lump; int lump;
int size; int size;
size = (TexMan.NumTextures()+1)*sizeof(BYTE); size = (TexMan.NumTextures()+1);
TerrainTypes.Resize(size); TerrainTypes.Resize(size);
memset (&TerrainTypes[0], 0, size); TerrainTypes.Clear();
MakeDefaultTerrain (); MakeDefaultTerrain ();
@ -343,6 +327,10 @@ static void ParseOuter (FScanner &sc)
ParseFloor (sc); ParseFloor (sc);
break; break;
case OUT_DEFAULTTERRAIN:
ParseDefault (sc);
break;
case OUT_IFDOOM: case OUT_IFDOOM:
if (!(gameinfo.gametype & GAME_DoomChex)) if (!(gameinfo.gametype & GAME_DoomChex))
{ {
@ -676,7 +664,27 @@ static void ParseFloor (FScanner &sc)
Printf ("Unknown terrain %s\n", sc.String); Printf ("Unknown terrain %s\n", sc.String);
terrain = 0; terrain = 0;
} }
TerrainTypes[picnum] = terrain; TerrainTypes.Set(picnum.GetIndex(), terrain);
}
//==========================================================================
//
// ParseFloor
//
//==========================================================================
static void ParseDefault (FScanner &sc)
{
int terrain;
sc.MustGetString ();
terrain = FindTerrain (sc.String);
if (terrain == -1)
{
Printf ("Unknown terrain %s\n", sc.String);
terrain = 0;
}
DefaultTerrainType = terrain;
} }
//========================================================================== //==========================================================================

View file

@ -39,25 +39,36 @@
struct PClass; struct PClass;
// This is just a wrapper class so that I don't have to expose FTextureID's implementation extern WORD DefaultTerrainType;
// to anything that doesn't really need it.
class FTerrainTypeArray class FTerrainTypeArray
{ {
public: public:
TArray<BYTE> Types; TArray<WORD> Types;
BYTE &operator [](FTextureID tex) WORD operator [](FTextureID tex) const
{ {
return Types[tex.GetIndex()]; WORD type = Types[tex.GetIndex()];
return type == 0xffff? DefaultTerrainType : type;
} }
BYTE &operator [](int texnum) WORD operator [](int texnum) const
{ {
return Types[texnum]; WORD type = Types[texnum];
return type == 0xffff? DefaultTerrainType : type;
} }
void Resize(unsigned newsize) void Resize(unsigned newsize)
{ {
Types.Resize(newsize); Types.Resize(newsize);
} }
void Clear()
{
memset (&Types[0], 0xff, Types.Size()*sizeof(WORD));
}
void Set(int index, int value)
{
Types[index] = value;
}
}; };
extern FTerrainTypeArray TerrainTypes; extern FTerrainTypeArray TerrainTypes;

View file

@ -396,9 +396,48 @@ void FRemapTable::AddColorRange(int start, int end, int _r1,int _g1, int _b1, in
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void FRemapTable::AddDesaturation(int start, int end, float r1,float g1, float b1, float r2, float g2, float b2)
{
r1 = clamp(r1, 0.0f, 2.0f);
g1 = clamp(g1, 0.0f, 2.0f);
b1 = clamp(b1, 0.0f, 2.0f);
r2 = clamp(r2, 0.0f, 2.0f);
g2 = clamp(g2, 0.0f, 2.0f);
b2 = clamp(b2, 0.0f, 2.0f);
r2 -= r1;
g2 -= g1;
b2 -= b1;
r1 *= 255;
g1 *= 255;
b1 *= 255;
for(int c=start; c < end; c++)
{
double intensity = (GPalette.BaseColors[c].r * 77 +
GPalette.BaseColors[c].g * 143 +
GPalette.BaseColors[c].b * 37) / 256.0;
PalEntry pe = PalEntry( MIN(255, int(r1 + intensity*r2)),
MIN(255, int(g1 + intensity*g2)),
MIN(255, int(b1 + intensity*b2)));
Remap[c] = ColorMatcher.Pick(pe);
Palette[c] = pe;
Palette[c].a = c==0? 0:255;
}
}
//----------------------------------------------------------------------------
//
//
//
//----------------------------------------------------------------------------
void FRemapTable::AddToTranslation(const char * range) void FRemapTable::AddToTranslation(const char * range)
{ {
int start,end; int start,end;
bool desaturated = false;
FScanner sc; FScanner sc;
sc.OpenMem("translation", range, int(strlen(range))); sc.OpenMem("translation", range, int(strlen(range)));
@ -412,7 +451,15 @@ void FRemapTable::AddToTranslation(const char * range)
sc.MustGetToken(TK_IntConst); sc.MustGetToken(TK_IntConst);
end = sc.Number; end = sc.Number;
sc.MustGetToken('='); sc.MustGetToken('=');
if (!sc.CheckToken('[')) if (start < 0 || start > 255 || end < 0 || end > 255)
{
sc.ScriptError("Palette index out of range");
return;
}
sc.MustGetAnyToken();
if (sc.TokenType != '[' && sc.TokenType != '%')
{ {
int pal1,pal2; int pal1,pal2;
@ -423,7 +470,7 @@ void FRemapTable::AddToTranslation(const char * range)
pal2 = sc.Number; pal2 = sc.Number;
AddIndexRange(start, end, pal1, pal2); AddIndexRange(start, end, pal1, pal2);
} }
else else if (sc.TokenType == '[')
{ {
// translation using RGB values // translation using RGB values
int r1,g1,b1,r2,g2,b2; int r1,g1,b1,r2,g2,b2;
@ -456,6 +503,46 @@ void FRemapTable::AddToTranslation(const char * range)
AddColorRange(start, end, r1, g1, b1, r2, g2, b2); AddColorRange(start, end, r1, g1, b1, r2, g2, b2);
} }
else if (sc.TokenType == '%')
{
// translation using RGB values
float r1,g1,b1,r2,g2,b2;
sc.MustGetToken('[');
sc.MustGetAnyToken();
if (sc.TokenType != TK_IntConst) sc.TokenMustBe(TK_FloatConst);
r1 = float(sc.Float);
sc.MustGetToken(',');
sc.MustGetAnyToken();
if (sc.TokenType != TK_IntConst) sc.TokenMustBe(TK_FloatConst);
g1 = float(sc.Float);
sc.MustGetToken(',');
sc.MustGetAnyToken();
if (sc.TokenType != TK_IntConst) sc.TokenMustBe(TK_FloatConst);
b1 = float(sc.Float);
sc.MustGetToken(']');
sc.MustGetToken(':');
sc.MustGetToken('[');
sc.MustGetAnyToken();
if (sc.TokenType != TK_IntConst) sc.TokenMustBe(TK_FloatConst);
r2 = float(sc.Float);
sc.MustGetToken(',');
sc.MustGetAnyToken();
if (sc.TokenType != TK_IntConst) sc.TokenMustBe(TK_FloatConst);
g2 = float(sc.Float);
sc.MustGetToken(',');
sc.MustGetAnyToken();
if (sc.TokenType != TK_IntConst) sc.TokenMustBe(TK_FloatConst);
b2 = float(sc.Float);
sc.MustGetToken(']');
AddDesaturation(start, end, r1, g1, b1, r2, g2, b2);
}
} }
catch (CRecoverableError &err) catch (CRecoverableError &err)
{ {

View file

@ -38,6 +38,7 @@ struct FRemapTable
void Serialize(FArchive &ar); void Serialize(FArchive &ar);
void AddIndexRange(int start, int end, int pal1, int pal2); void AddIndexRange(int start, int end, int pal1, int pal2);
void AddColorRange(int start, int end, int r1,int g1, int b1, int r2, int g2, int b2); void AddColorRange(int start, int end, int r1,int g1, int b1, int r2, int g2, int b2);
void AddDesaturation(int start, int end, float r1,float g1, float b1, float r2, float g2, float b2);
void AddToTranslation(const char * range); void AddToTranslation(const char * range);
int StoreTranslation(); int StoreTranslation();

View file

@ -3,5 +3,5 @@
// This file was automatically generated by the // This file was automatically generated by the
// updaterevision tool. Do not edit by hand. // updaterevision tool. Do not edit by hand.
#define ZD_SVN_REVISION_STRING "1909" #define ZD_SVN_REVISION_STRING "1921"
#define ZD_SVN_REVISION_NUMBER 1909 #define ZD_SVN_REVISION_NUMBER 1921

View file

@ -1699,7 +1699,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Print)
con_midtime = time; con_midtime = time;
} }
C_MidPrint(font != NULL ? font : SmallFont, text); FString formatted = strbin1(text);
C_MidPrint(font != NULL ? font : SmallFont, formatted.GetChars());
con_midtime = saved; con_midtime = saved;
} }
} }
@ -1729,7 +1730,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PrintBold)
con_midtime = time; con_midtime = time;
} }
C_MidPrintBold(font != NULL ? font : SmallFont, text); FString formatted = strbin1(text);
C_MidPrintBold(font != NULL ? font : SmallFont, formatted.GetChars());
con_midtime = saved; con_midtime = saved;
} }
@ -1987,8 +1989,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_KillSiblings)
//=========================================================================== //===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg)
{ {
ACTION_PARAM_START(1); ACTION_PARAM_START(2);
ACTION_PARAM_INT(cnt, 0); ACTION_PARAM_INT(cnt, 0);
ACTION_PARAM_STATE(state, 1);
if (cnt<0 || cnt>=5) return; if (cnt<0 || cnt>=5) return;
if (!self->args[cnt]--) if (!self->args[cnt]--)
@ -2003,7 +2006,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg)
} }
else else
{ {
self->SetState(self->FindState(NAME_Death)); // can't use "Death" as default parameter with current DECORATE parser.
if (state == NULL) state = self->FindState(NAME_Death);
self->SetState(state);
} }
} }
@ -2931,6 +2936,23 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Turn)
self->angle += angle; self->angle += angle;
} }
//===========================================================================
//
// A_Quake
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Quake)
{
ACTION_PARAM_START(5);
ACTION_PARAM_INT(intensity, 0);
ACTION_PARAM_INT(duration, 1);
ACTION_PARAM_INT(damrad, 2);
ACTION_PARAM_INT(tremrad, 3);
ACTION_PARAM_SOUND(sound, 4);
P_StartQuake(self, 0, intensity, duration, damrad, tremrad, sound);
}
//=========================================================================== //===========================================================================
// //
// A_LineEffect // A_LineEffect

View file

@ -592,11 +592,15 @@ static bool ParsePropertyParams(FScanner &sc, FPropertyInfo *prop, AActor *defau
// fall through // fall through
case 'S': case 'S':
case 'T':
sc.MustGetString(); sc.MustGetString();
conv.s = strings[strings.Reserve(1)] = sc.String; conv.s = strings[strings.Reserve(1)] = sc.String;
break; break;
case 'T':
sc.MustGetString();
conv.s = strings[strings.Reserve(1)] = strbin1(sc.String);
break;
case 'C': case 'C':
if (sc.CheckNumber ()) if (sc.CheckNumber ())
{ {

View file

@ -186,7 +186,7 @@ int MatchString (const char *in, const char **strings)
//========================================================================== //==========================================================================
// //
//========================================================================== //==========================================================================
DEFINE_INFO_PROPERTY(game, T, Actor) DEFINE_INFO_PROPERTY(game, S, Actor)
{ {
PROP_STRING_PARM(str, 0); PROP_STRING_PARM(str, 0);
if (!stricmp(str, "Doom")) if (!stricmp(str, "Doom"))
@ -924,18 +924,25 @@ DEFINE_PROPERTY(damagetype, S, Actor)
//========================================================================== //==========================================================================
// //
//========================================================================== //==========================================================================
DEFINE_PROPERTY(damagefactor, SF, Actor) DEFINE_PROPERTY(damagefactor, ZF, Actor)
{ {
PROP_STRING_PARM(str, 0); PROP_STRING_PARM(str, 0);
PROP_FIXED_PARM(id, 1); PROP_FIXED_PARM(id, 1);
if (info->DamageFactors == NULL) info->DamageFactors=new DmgFactors; if (str == NULL)
{
defaults->DamageFactor = id;
}
else
{
if (info->DamageFactors == NULL) info->DamageFactors=new DmgFactors;
FName dmgType; FName dmgType;
if (!stricmp(str, "Normal")) dmgType = NAME_None; if (!stricmp(str, "Normal")) dmgType = NAME_None;
else dmgType=str; else dmgType=str;
(*info->DamageFactors)[dmgType]=id; (*info->DamageFactors)[dmgType]=id;
}
} }
//========================================================================== //==========================================================================
@ -1295,7 +1302,7 @@ DEFINE_CLASS_PROPERTY(pickupflash, S, Inventory)
//========================================================================== //==========================================================================
// //
//========================================================================== //==========================================================================
DEFINE_CLASS_PROPERTY(pickupmessage, S, Inventory) DEFINE_CLASS_PROPERTY(pickupmessage, T, Inventory)
{ {
PROP_STRING_PARM(str, 0); PROP_STRING_PARM(str, 0);
info->Class->Meta.SetMetaString(AIMETA_PickupMessage, str); info->Class->Meta.SetMetaString(AIMETA_PickupMessage, str);
@ -1347,7 +1354,7 @@ DEFINE_CLASS_PROPERTY(givequest, I, Inventory)
//========================================================================== //==========================================================================
// //
//========================================================================== //==========================================================================
DEFINE_CLASS_PROPERTY(lowmessage, IS, Health) DEFINE_CLASS_PROPERTY(lowmessage, IT, Health)
{ {
PROP_INT_PARM(i, 0); PROP_INT_PARM(i, 0);
PROP_STRING_PARM(str, 1); PROP_STRING_PARM(str, 1);
@ -1376,7 +1383,7 @@ DEFINE_CLASS_PROPERTY(number, I, PuzzleItem)
//========================================================================== //==========================================================================
// //
//========================================================================== //==========================================================================
DEFINE_CLASS_PROPERTY(failmessage, S, PuzzleItem) DEFINE_CLASS_PROPERTY(failmessage, T, PuzzleItem)
{ {
PROP_STRING_PARM(str, 0); PROP_STRING_PARM(str, 0);
info->Class->Meta.SetMetaString(AIMETA_PuzzFailMessage, str); info->Class->Meta.SetMetaString(AIMETA_PuzzFailMessage, str);