- scriptified the particle fountains.

This commit is contained in:
Christoph Oelckers 2017-01-13 19:29:54 +01:00
parent 8e7e1ed757
commit 51cc7feb4c
8 changed files with 47 additions and 94 deletions

View File

@ -1160,7 +1160,6 @@ set (PCH_SOURCES
g_shared/a_action.cpp
g_shared/a_decals.cpp
g_shared/a_flashfader.cpp
g_shared/a_fountain.cpp
g_shared/a_lightning.cpp
g_shared/a_morph.cpp
g_shared/a_movingcamera.cpp

View File

@ -1014,12 +1014,13 @@ public:
double FloatSpeed;
int sprite; // used to find patch_t and flip value
BYTE frame; // sprite frame to draw
uint8_t frame; // sprite frame to draw
uint8_t effects; // [RH] see p_effect.h
uint8_t fountaincolor; // Split out of 'effect' to have easier access.
DVector2 Scale; // Scaling values; 1 is normal size
FRenderStyle RenderStyle; // Style to draw this actor with
ActorRenderFlags renderflags; // Different rendering flags
FTextureID picnum; // Draw this instead of sprite if valid
DWORD effects; // [RH] see p_effect.h
double Alpha; // Since P_CheckSight makes an alpha check this can't be a float. It has to be a double.
DWORD fillcolor; // Color to draw when STYLE_Shaded

View File

@ -1,70 +0,0 @@
/*
** a_fountain.cpp
** Actors that make particle fountains
**
**---------------------------------------------------------------------------
** Copyright 1998-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.
**
** 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 "actor.h"
#include "info.h"
#include "p_effect.h"
#include "doomdata.h"
class AParticleFountain : public AActor
{
DECLARE_CLASS (AParticleFountain, AActor)
public:
void PostBeginPlay ();
void Activate (AActor *activator);
void Deactivate (AActor *activator);
};
IMPLEMENT_CLASS(AParticleFountain, false, false)
void AParticleFountain::PostBeginPlay ()
{
Super::PostBeginPlay ();
if (!(SpawnFlags & MTF_DORMANT))
CallActivate (NULL);
}
void AParticleFountain::Activate (AActor *activator)
{
Super::Activate (activator);
effects &= ~FX_FOUNTAINMASK;
effects |= health << FX_FOUNTAINSHIFT;
}
void AParticleFountain::Deactivate (AActor *activator)
{
Super::Deactivate (activator);
effects &= ~FX_FOUNTAINMASK;
}

View File

@ -358,7 +358,7 @@ void P_RunEffects ()
while ( (actor = iterator.Next ()) )
{
if (actor->effects)
if (actor->effects || actor->fountaincolor)
{
// Only run the effect if the actor is potentially visible
int rnum = pnum + actor->Sector->Index();
@ -494,7 +494,7 @@ void P_RunEffect (AActor *actor, int effects)
P_DrawSplash2 (6, pos, moveangle + 180, 2, 2);
}
if (effects & FX_FOUNTAINMASK)
if (actor->fountaincolor)
{
// Particle fountain
@ -508,7 +508,7 @@ void P_RunEffect (AActor *actor, int effects)
&black, &grey3,
&grey4, &white
};
int color = (effects & FX_FOUNTAINMASK) >> 15;
int color = actor->fountaincolor*2;
MakeFountain (actor, *fountainColors[color], *fountainColors[color+1]);
}
if (effects & FX_RESPAWNINVUL)

View File

@ -38,16 +38,6 @@
#define FX_RESPAWNINVUL 0x00000020
#define FX_VISIBILITYPULSE 0x00000040
#define FX_FOUNTAINMASK 0x00070000
#define FX_FOUNTAINSHIFT 16
#define FX_REDFOUNTAIN 0x00010000
#define FX_GREENFOUNTAIN 0x00020000
#define FX_BLUEFOUNTAIN 0x00030000
#define FX_YELLOWFOUNTAIN 0x00040000
#define FX_PURPLEFOUNTAIN 0x00050000
#define FX_BLACKFOUNTAIN 0x00060000
#define FX_WHITEFOUNTAIN 0x00070000
struct subsector_t;
// [RH] Particle details

View File

@ -314,6 +314,7 @@ DEFINE_FIELD(AActor, MissileState)
DEFINE_FIELD(AActor, ConversationRoot)
DEFINE_FIELD(AActor, Conversation)
DEFINE_FIELD(AActor, DecalGenerator)
DEFINE_FIELD(AActor, fountaincolor)
DEFINE_FIELD(PClassActor, Obituary)
DEFINE_FIELD(PClassActor, HitObituary)
@ -366,6 +367,7 @@ void AActor::Serialize(FSerializer &arc)
A("lastlookpn", LastLookPlayerNumber)
("lastlookactor", LastLookActor)
A("effects", effects)
A("fountaincolor", fountaincolor)
A("alpha", Alpha)
A("fillcolor", fillcolor)
A("sector", Sector)

View File

@ -182,6 +182,7 @@ class Actor : Thinker native
native State MeleeState;
native State MissileState;
native voidptr /*DecalBase*/ DecalGenerator;
native uint8 fountaincolor;
native meta String Obituary; // Player was killed by this actor
native meta String HitObituary; // Player was killed by this actor in melee

View File

@ -1,5 +1,16 @@
class ParticleFountain : Actor native
class ParticleFountain : Actor
{
enum EColor
{
REDFOUNTAIN = 1,
GREENFOUNTAIN = 2,
BLUEFOUNTAIN = 3,
YELLOWFOUNTAIN = 4,
PURPLEFOUNTAIN = 5,
BLACKFOUNTAIN = 6,
WHITEFOUNTAIN = 7
}
default
{
Height 0;
@ -7,13 +18,32 @@ class ParticleFountain : Actor native
+NOGRAVITY
+INVISIBLE
}
override void PostBeginPlay ()
{
Super.PostBeginPlay ();
if (!(SpawnFlags & MTF_DORMANT))
Activate (null);
}
override void Activate (Actor activator)
{
Super.Activate (activator);
fountaincolor = health;
}
override void Deactivate (Actor activator)
{
Super.Deactivate (activator);
fountaincolor = 0;
}
}
class RedParticleFountain : ParticleFountain
{
default
{
Health 1;
Health REDFOUNTAIN;
}
}
@ -21,7 +51,7 @@ class GreenParticleFountain : ParticleFountain
{
default
{
Health 2;
Health GREENFOUNTAIN;
}
}
@ -29,7 +59,7 @@ class BlueParticleFountain : ParticleFountain
{
default
{
Health 3;
Health BLUEFOUNTAIN;
}
}
@ -37,7 +67,7 @@ class YellowParticleFountain : ParticleFountain
{
default
{
Health 4;
Health YELLOWFOUNTAIN;
}
}
@ -45,7 +75,7 @@ class PurpleParticleFountain : ParticleFountain
{
default
{
Health 5;
Health PURPLEFOUNTAIN;
}
}
@ -53,7 +83,7 @@ class BlackParticleFountain : ParticleFountain
{
default
{
Health 6;
Health BLACKFOUNTAIN;
}
}
@ -61,6 +91,6 @@ class WhiteParticleFountain : ParticleFountain
{
default
{
Health 7;
Health WHITEFOUNTAIN;
}
}