mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- 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:
parent
19b23f2cf3
commit
cc2b0b0dcf
14 changed files with 109 additions and 18 deletions
|
@ -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
|
October 24, 2009
|
||||||
- Removed the Actor uservar array and replaced it with user-defined variables.
|
- Removed the Actor uservar array and replaced it with user-defined variables.
|
||||||
A_SetUserVar/SetUserVariable/GetUserVariable now take a variable name
|
A_SetUserVar/SetUserVariable/GetUserVariable now take a variable name
|
||||||
|
|
|
@ -547,7 +547,7 @@ public:
|
||||||
|
|
||||||
void Serialize (FArchive &arc);
|
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
|
inline AActor *GetDefault () const
|
||||||
{
|
{
|
||||||
|
|
|
@ -414,9 +414,6 @@ void P_CheckPlayerSprites();
|
||||||
|
|
||||||
|
|
||||||
#define CROUCHSPEED (FRACUNIT/12)
|
#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
|
// [GRB] Custom player classes
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -84,6 +84,16 @@
|
||||||
#include "g_hub.h"
|
#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_gravity)
|
||||||
EXTERN_CVAR (Float, sv_aircontrol)
|
EXTERN_CVAR (Float, sv_aircontrol)
|
||||||
EXTERN_CVAR (Int, disableautosave)
|
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
|
// force players to be initialized upon first level load
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
players[i].playerstate = PST_ENTER; // [BC]
|
players[i].playerstate = PST_ENTER; // [BC]
|
||||||
|
|
||||||
|
STAT_NEW(mapname);
|
||||||
}
|
}
|
||||||
|
|
||||||
usergame = !bTitleLevel; // will be set false if a demo
|
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);
|
FBehavior::StaticStartTypedScripts (SCRIPT_Unloading, NULL, false, 0, true);
|
||||||
unloading = false;
|
unloading = false;
|
||||||
|
|
||||||
|
STAT_END(nextlevel);
|
||||||
|
|
||||||
if (thiscluster && (thiscluster->flags & CLUSTER_HUB))
|
if (thiscluster && (thiscluster->flags & CLUSTER_HUB))
|
||||||
{
|
{
|
||||||
if ((level.flags & LEVEL_NOINTERMISSION) || (nextcluster == thiscluster))
|
if ((level.flags & LEVEL_NOINTERMISSION) || (nextcluster == thiscluster))
|
||||||
|
@ -1389,6 +1403,8 @@ void G_AirControlChanged ()
|
||||||
void G_SerializeLevel (FArchive &arc, bool hubLoad)
|
void G_SerializeLevel (FArchive &arc, bool hubLoad)
|
||||||
{
|
{
|
||||||
int i = level.totaltime;
|
int i = level.totaltime;
|
||||||
|
|
||||||
|
screen->StartSerialize(arc);
|
||||||
|
|
||||||
arc << level.flags
|
arc << level.flags
|
||||||
<< level.flags2
|
<< level.flags2
|
||||||
|
@ -1507,6 +1523,8 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
screen->EndSerialize(arc);
|
||||||
|
STAT_SAVE(arc, hubLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -59,6 +59,7 @@ struct FState
|
||||||
long Misc2; // Was changed to BYTE, reverted to long for MBF compat
|
long Misc2; // Was changed to BYTE, reverted to long for MBF compat
|
||||||
BYTE Frame;
|
BYTE Frame;
|
||||||
BYTE DefineFlags; // Unused byte so let's use it during state creation.
|
BYTE DefineFlags; // Unused byte so let's use it during state creation.
|
||||||
|
short Light;
|
||||||
FState *NextState;
|
FState *NextState;
|
||||||
actionf_p ActionFunc;
|
actionf_p ActionFunc;
|
||||||
int ParameterIndex;
|
int ParameterIndex;
|
||||||
|
@ -211,5 +212,6 @@ extern FDoomEdMap DoomEdMap;
|
||||||
|
|
||||||
int GetSpriteIndex(const char * spritename);
|
int GetSpriteIndex(const char * spritename);
|
||||||
TArray<FName> &MakeStateNameList(const char * fname);
|
TArray<FName> &MakeStateNameList(const char * fname);
|
||||||
|
void AddStateLight(FState *state, const char *lname);
|
||||||
|
|
||||||
#endif // __INFO_H__
|
#endif // __INFO_H__
|
||||||
|
|
|
@ -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,"ENTER to change, BACKSPACE to clear", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} },
|
||||||
{ redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} },
|
{ redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} },
|
||||||
|
|
|
@ -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)
|
if (ffloor->top.plane->a || ffloor->top.plane->b || ffloor->bottom.plane->a || ffloor->bottom.plane->b)
|
||||||
{
|
{
|
||||||
ffloor->alpha = FRACUNIT;
|
ffloor->alpha = FRACUNIT;
|
||||||
|
ffloor->flags &= ~FF_ADDITIVETRANS;
|
||||||
}
|
}
|
||||||
|
|
||||||
sec->e->XFloor.ffloors.Push(ffloor);
|
sec->e->XFloor.ffloors.Push(ffloor);
|
||||||
|
|
|
@ -85,7 +85,6 @@ EXTERN_CVAR (Int, cl_rockettrails)
|
||||||
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||||
|
|
||||||
static bool SpawningMapThing;
|
|
||||||
static FRandom pr_explodemissile ("ExplodeMissile");
|
static FRandom pr_explodemissile ("ExplodeMissile");
|
||||||
FRandom pr_bounce ("Bounce");
|
FRandom pr_bounce ("Bounce");
|
||||||
static FRandom pr_reflect ("Reflect");
|
static FRandom pr_reflect ("Reflect");
|
||||||
|
@ -560,6 +559,7 @@ bool AActor::SetState (FState *newstate)
|
||||||
newstate = newstate->GetNextState();
|
newstate = newstate->GetNextState();
|
||||||
} while (tics == 0);
|
} while (tics == 0);
|
||||||
|
|
||||||
|
screen->StateChanged(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,6 +619,7 @@ bool AActor::SetStateNF (FState *newstate)
|
||||||
newstate = newstate->GetNextState();
|
newstate = newstate->GetNextState();
|
||||||
} while (tics == 0);
|
} while (tics == 0);
|
||||||
|
|
||||||
|
screen->StateChanged(this);
|
||||||
return true;
|
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)
|
if (type == NULL)
|
||||||
{
|
{
|
||||||
|
@ -3623,6 +3624,7 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t
|
||||||
{
|
{
|
||||||
level.total_items++;
|
level.total_items++;
|
||||||
}
|
}
|
||||||
|
screen->StateChanged(actor);
|
||||||
return actor;
|
return actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4339,9 +4341,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
||||||
else
|
else
|
||||||
z = ONFLOORZ;
|
z = ONFLOORZ;
|
||||||
|
|
||||||
SpawningMapThing = true;
|
mobj = AActor::StaticSpawn (i, x, y, z, NO_REPLACE, true);
|
||||||
mobj = Spawn (i, x, y, z, NO_REPLACE);
|
|
||||||
SpawningMapThing = false;
|
|
||||||
|
|
||||||
if (z == ONFLOORZ)
|
if (z == ONFLOORZ)
|
||||||
mobj->z += mthing->z;
|
mobj->z += mthing->z;
|
||||||
|
|
|
@ -2156,13 +2156,11 @@ void P_PlayerThink (player_t *player)
|
||||||
player->mo->pitch -= look;
|
player->mo->pitch -= look;
|
||||||
if (look > 0)
|
if (look > 0)
|
||||||
{ // look up
|
{ // look up
|
||||||
if (player->mo->pitch < -ANGLE_1*MAX_UP_ANGLE)
|
player->mo->pitch = MAX(player->mo->pitch, screen->GetMaxViewPitch(false));
|
||||||
player->mo->pitch = -ANGLE_1*MAX_UP_ANGLE;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // look down
|
{ // look down
|
||||||
if (player->mo->pitch > ANGLE_1*MAX_DN_ANGLE)
|
player->mo->pitch = MIN(player->mo->pitch, screen->GetMaxViewPitch(true));
|
||||||
player->mo->pitch = ANGLE_1*MAX_DN_ANGLE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,7 @@ public:
|
||||||
void Unload ();
|
void Unload ();
|
||||||
bool CheckModified ();
|
bool CheckModified ();
|
||||||
void RenderView (AActor *viewpoint, int fov);
|
void RenderView (AActor *viewpoint, int fov);
|
||||||
|
void NeedUpdate() { bNeedsUpdate=true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DSimpleCanvas *Canvas;
|
DSimpleCanvas *Canvas;
|
||||||
|
|
|
@ -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)
|
// Avoid overflowing viewpitch (can happen when a netgame is stalled)
|
||||||
if (viewpitch + delta <= viewpitch)
|
if (viewpitch + delta <= viewpitch)
|
||||||
{
|
{
|
||||||
viewpitch = +ANGLE_1*MAX_DN_ANGLE;
|
viewpitch = screen->GetMaxViewPitch(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
viewpitch = MIN(viewpitch + delta, +ANGLE_1*MAX_DN_ANGLE);
|
viewpitch = MIN(viewpitch + delta, screen->GetMaxViewPitch(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (delta < 0)
|
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)
|
// Avoid overflowing viewpitch (can happen when a netgame is stalled)
|
||||||
if (viewpitch + delta >= viewpitch)
|
if (viewpitch + delta >= viewpitch)
|
||||||
{
|
{
|
||||||
viewpitch = -ANGLE_1*MAX_UP_ANGLE;
|
viewpitch = screen->GetMaxViewPitch(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
viewpitch = MAX(viewpitch + delta, -ANGLE_1*MAX_UP_ANGLE);
|
viewpitch = MAX(viewpitch + delta, screen->GetMaxViewPitch(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "colormatcher.h"
|
#include "colormatcher.h"
|
||||||
#include "thingdef_exp.h"
|
#include "thingdef_exp.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//***
|
//***
|
||||||
|
@ -258,6 +259,20 @@ do_stop:
|
||||||
sc.MustGetStringName(")");
|
sc.MustGetStringName(")");
|
||||||
continue;
|
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
|
// Make the action name lowercase to satisfy the gperf hashers
|
||||||
strlwr (sc.String);
|
strlwr (sc.String);
|
||||||
|
|
|
@ -1269,7 +1269,48 @@ void DFrameBuffer::DrawRemainingPlayerSprites()
|
||||||
R_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()
|
FNativePalette::~FNativePalette()
|
||||||
{
|
{
|
||||||
|
|
|
@ -351,6 +351,15 @@ public:
|
||||||
// draws player sprites with hardware acceleration (only useful for software rendering)
|
// draws player sprites with hardware acceleration (only useful for software rendering)
|
||||||
virtual void DrawRemainingPlayerSprites();
|
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.
|
bool Accel2D; // If true, 2D drawing can be accelerated.
|
||||||
|
|
||||||
// Begin 2D drawing operations. This is like Update, but it doesn't end
|
// Begin 2D drawing operations. This is like Update, but it doesn't end
|
||||||
|
|
Loading…
Reference in a new issue