diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 3764a67d4..905f27326 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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 diff --git a/src/actor.h b/src/actor.h index 730b9006f..8dbfdf194 100644 --- a/src/actor.h +++ b/src/actor.h @@ -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 { diff --git a/src/d_player.h b/src/d_player.h index fa936b552..b23d0616d 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -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 diff --git a/src/g_level.cpp b/src/g_level.cpp index 948e89b63..a2bd300ed 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -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)) @@ -1389,6 +1403,8 @@ void G_AirControlChanged () void G_SerializeLevel (FArchive &arc, bool hubLoad) { int i = level.totaltime; + + screen->StartSerialize(arc); arc << level.flags << level.flags2 @@ -1507,6 +1523,8 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad) } } } + screen->EndSerialize(arc); + STAT_SAVE(arc, hubLoad); } //========================================================================== diff --git a/src/info.h b/src/info.h index 5e06bcc10..da248b9ce 100644 --- a/src/info.h +++ b/src/info.h @@ -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 &MakeStateNameList(const char * fname); +void AddStateLight(FState *state, const char *lname); #endif // __INFO_H__ diff --git a/src/m_options.cpp b/src/m_options.cpp index 8048b52ea..ac297a2f2 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -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} }, diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index d1509c649..b9b82a566 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -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); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index f03bdbd46..9b9824264 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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; diff --git a/src/p_user.cpp b/src/p_user.cpp index 7b6e34048..374442a18 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -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)); } } } diff --git a/src/r_data.h b/src/r_data.h index acd70284d..487860e58 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -93,6 +93,7 @@ public: void Unload (); bool CheckModified (); void RenderView (AActor *viewpoint, int fov); + void NeedUpdate() { bNeedsUpdate=true; } protected: DSimpleCanvas *Canvas; diff --git a/src/r_main.cpp b/src/r_main.cpp index e5caada3d..bcec61c73 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -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)); } } } diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp index d7252c419..c04193718 100644 --- a/src/thingdef/thingdef_states.cpp +++ b/src/thingdef/thingdef_states.cpp @@ -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); diff --git a/src/v_video.cpp b/src/v_video.cpp index acd481f68..ca8eb7fdc 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -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() { diff --git a/src/v_video.h b/src/v_video.h index a6f30a43a..3109901bb 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -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