- made max. view pitch a property of the renderer so that it's overridable without

changing game code.
- made SpawningMapThing an argument of AActor::StaticSpawn instead of a global
  variable.
- added a stub to the DECORATE parser for defining dynamic lights directly
  in DECORATE. This is needed so that ZDoom remains compatible with any DECORATE 
  which uses this GZDoom feature in the future.


SVN r1935 (trunk)
This commit is contained in:
Christoph Oelckers 2009-10-25 15:26:19 +00:00
parent 19b23f2cf3
commit cc2b0b0dcf
14 changed files with 109 additions and 18 deletions

View file

@ -1,3 +1,12 @@
October 24, 2009 (Changes by Graf Zahl)
- made max. view pitch a property of the renderer so that it's overridable without
changing game code.
- made SpawningMapThing an argument of AActor::StaticSpawn instead of a global
variable.
- added a stub to the DECORATE parser for defining dynamic lights directly
in DECORATE. This is needed so that ZDoom remains compatible with any DECORATE
which uses this GZDoom feature in the future.
October 24, 2009
- Removed the Actor uservar array and replaced it with user-defined variables.
A_SetUserVar/SetUserVariable/GetUserVariable now take a variable name

View file

@ -547,7 +547,7 @@ public:
void Serialize (FArchive &arc);
static AActor *StaticSpawn (const PClass *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement);
static AActor *StaticSpawn (const PClass *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement, bool SpawningMapThing = false);
inline AActor *GetDefault () const
{

View file

@ -414,9 +414,6 @@ void P_CheckPlayerSprites();
#define CROUCHSPEED (FRACUNIT/12)
#define MAX_DN_ANGLE 56 // Max looking down angle
#define MAX_UP_ANGLE 32 // Max looking up angle
// [GRB] Custom player classes
enum

View file

@ -84,6 +84,16 @@
#include "g_hub.h"
#ifndef STAT
#define STAT_NEW(map)
#define STAT_END(newl)
#define STAT_SAVE(arc, hub)
#else
void STAT_NEW(const char *lev);
void STAT_END(const char *newl);
void STAT_SAVE(FArchive &arc, bool hubload);
#endif
EXTERN_CVAR (Float, sv_gravity)
EXTERN_CVAR (Float, sv_aircontrol)
EXTERN_CVAR (Int, disableautosave)
@ -495,6 +505,8 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
// force players to be initialized upon first level load
for (i = 0; i < MAXPLAYERS; i++)
players[i].playerstate = PST_ENTER; // [BC]
STAT_NEW(mapname);
}
usergame = !bTitleLevel; // will be set false if a demo
@ -596,6 +608,8 @@ void G_ChangeLevel(const char *levelname, int position, bool keepFacing, int nex
FBehavior::StaticStartTypedScripts (SCRIPT_Unloading, NULL, false, 0, true);
unloading = false;
STAT_END(nextlevel);
if (thiscluster && (thiscluster->flags & CLUSTER_HUB))
{
if ((level.flags & LEVEL_NOINTERMISSION) || (nextcluster == thiscluster))
@ -1390,6 +1404,8 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad)
{
int i = level.totaltime;
screen->StartSerialize(arc);
arc << level.flags
<< level.flags2
<< level.fadeto
@ -1507,6 +1523,8 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad)
}
}
}
screen->EndSerialize(arc);
STAT_SAVE(arc, hubLoad);
}
//==========================================================================

View file

@ -59,6 +59,7 @@ struct FState
long Misc2; // Was changed to BYTE, reverted to long for MBF compat
BYTE Frame;
BYTE DefineFlags; // Unused byte so let's use it during state creation.
short Light;
FState *NextState;
actionf_p ActionFunc;
int ParameterIndex;
@ -211,5 +212,6 @@ extern FDoomEdMap DoomEdMap;
int GetSpriteIndex(const char * spritename);
TArray<FName> &MakeStateNameList(const char * fname);
void AddStateLight(FState *state, const char *lname);
#endif // __INFO_H__

View file

@ -346,7 +346,7 @@ menu_t JoystickConfigMenu =
*
*=======================================*/
static menuitem_t ControlsItems[] =
menuitem_t ControlsItems[] =
{
{ redtext,"ENTER to change, BACKSPACE to clear", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} },
{ redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} },

View file

@ -130,6 +130,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
if (ffloor->top.plane->a || ffloor->top.plane->b || ffloor->bottom.plane->a || ffloor->bottom.plane->b)
{
ffloor->alpha = FRACUNIT;
ffloor->flags &= ~FF_ADDITIVETRANS;
}
sec->e->XFloor.ffloors.Push(ffloor);

View file

@ -85,7 +85,6 @@ EXTERN_CVAR (Int, cl_rockettrails)
// PRIVATE DATA DEFINITIONS ------------------------------------------------
static bool SpawningMapThing;
static FRandom pr_explodemissile ("ExplodeMissile");
FRandom pr_bounce ("Bounce");
static FRandom pr_reflect ("Reflect");
@ -560,6 +559,7 @@ bool AActor::SetState (FState *newstate)
newstate = newstate->GetNextState();
} while (tics == 0);
screen->StateChanged(this);
return true;
}
@ -619,6 +619,7 @@ bool AActor::SetStateNF (FState *newstate)
newstate = newstate->GetNextState();
} while (tics == 0);
screen->StateChanged(this);
return true;
}
@ -3459,7 +3460,7 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash)
//
//==========================================================================
AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t iz, replace_t allowreplacement)
AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t iz, replace_t allowreplacement, bool SpawningMapThing)
{
if (type == NULL)
{
@ -3623,6 +3624,7 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t
{
level.total_items++;
}
screen->StateChanged(actor);
return actor;
}
@ -4339,9 +4341,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
else
z = ONFLOORZ;
SpawningMapThing = true;
mobj = Spawn (i, x, y, z, NO_REPLACE);
SpawningMapThing = false;
mobj = AActor::StaticSpawn (i, x, y, z, NO_REPLACE, true);
if (z == ONFLOORZ)
mobj->z += mthing->z;

View file

@ -2156,13 +2156,11 @@ void P_PlayerThink (player_t *player)
player->mo->pitch -= look;
if (look > 0)
{ // look up
if (player->mo->pitch < -ANGLE_1*MAX_UP_ANGLE)
player->mo->pitch = -ANGLE_1*MAX_UP_ANGLE;
player->mo->pitch = MAX(player->mo->pitch, screen->GetMaxViewPitch(false));
}
else
{ // look down
if (player->mo->pitch > ANGLE_1*MAX_DN_ANGLE)
player->mo->pitch = ANGLE_1*MAX_DN_ANGLE;
player->mo->pitch = MIN(player->mo->pitch, screen->GetMaxViewPitch(true));
}
}
}

View file

@ -93,6 +93,7 @@ public:
void Unload ();
bool CheckModified ();
void RenderView (AActor *viewpoint, int fov);
void NeedUpdate() { bNeedsUpdate=true; }
protected:
DSimpleCanvas *Canvas;

View file

@ -852,11 +852,11 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
// Avoid overflowing viewpitch (can happen when a netgame is stalled)
if (viewpitch + delta <= viewpitch)
{
viewpitch = +ANGLE_1*MAX_DN_ANGLE;
viewpitch = screen->GetMaxViewPitch(true);
}
else
{
viewpitch = MIN(viewpitch + delta, +ANGLE_1*MAX_DN_ANGLE);
viewpitch = MIN(viewpitch + delta, screen->GetMaxViewPitch(true));
}
}
else if (delta < 0)
@ -864,11 +864,11 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
// Avoid overflowing viewpitch (can happen when a netgame is stalled)
if (viewpitch + delta >= viewpitch)
{
viewpitch = -ANGLE_1*MAX_UP_ANGLE;
viewpitch = screen->GetMaxViewPitch(false);
}
else
{
viewpitch = MAX(viewpitch + delta, -ANGLE_1*MAX_UP_ANGLE);
viewpitch = MAX(viewpitch + delta, screen->GetMaxViewPitch(false));
}
}
}

View file

@ -55,6 +55,7 @@
#include "i_system.h"
#include "colormatcher.h"
#include "thingdef_exp.h"
#include "version.h"
//==========================================================================
//***
@ -258,6 +259,20 @@ do_stop:
sc.MustGetStringName(")");
continue;
}
if (sc.Compare("LIGHT"))
{
sc.MustGetStringName("(");
do
{
sc.MustGetString();
#ifdef DYNLIGHT
AddStateLight(&state, sc.String);
#endif
}
while (sc.CheckString(","));
sc.MustGetStringName(")");
continue;
}
// Make the action name lowercase to satisfy the gperf hashers
strlwr (sc.String);

View file

@ -1269,7 +1269,48 @@ void DFrameBuffer::DrawRemainingPlayerSprites()
R_DrawRemainingPlayerSprites();
}
//===========================================================================
//
// notify the renderer that an actor has changed state
//
//===========================================================================
void DFrameBuffer::StateChanged(AActor *actor)
{
}
//===========================================================================
//
// notify the renderer that serialization of the curent level is about to start/end
//
//===========================================================================
void DFrameBuffer::StartSerialize(FArchive &arc)
{
}
void DFrameBuffer::EndSerialize(FArchive &arc)
{
}
//===========================================================================
//
// Get max. view angle (renderer specific information so it goes here now)
//
//===========================================================================
#define MAX_DN_ANGLE 56 // Max looking down angle
#define MAX_UP_ANGLE 32 // Max looking up angle
int DFrameBuffer::GetMaxViewPitch(bool down)
{
return down? MAX_DN_ANGLE*ANGLE_1 : -MAX_UP_ANGLE*ANGLE_1;
}
//===========================================================================
//
//
//
//===========================================================================
FNativePalette::~FNativePalette()
{

View file

@ -351,6 +351,15 @@ public:
// draws player sprites with hardware acceleration (only useful for software rendering)
virtual void DrawRemainingPlayerSprites();
// notifies the renderer that an actor has changed state.
virtual void StateChanged(AActor *actor);
// notify the renderer that serialization of the curent level is about to start/end
virtual void StartSerialize(FArchive &arc);
virtual void EndSerialize(FArchive &arc);
virtual int GetMaxViewPitch(bool down);
bool Accel2D; // If true, 2D drawing can be accelerated.
// Begin 2D drawing operations. This is like Update, but it doesn't end