- started adding a GLSL state structure

Update to ZDoom r1183:

- Added and fixed Boss death submission for random spawner.
- Added functions to FActorInfo that can set the damage factors and
  pain chances to reduce the chance of new errors when working with
  these features.
- Fixed: The handling of the deprecated FIRERESIST flag didn't work.
  There were 3 problems:
  * Actor defaults have no class information so HandleDeprecatedFlags
    needs to be passed a pointer to the ActorInfo.
  * The DamageFactors list is only created when needed so the code needs to
    check if it already exists.
  * damage factors are stored as fixed_t but this set a float.
- Fixed: Timidity::Renderer::reset_voices() must completely zero the
  voices. Because this wasn't done, note_on() could try to access
  the sample for a voice that had never been played yet and access
  random memory. There may be other places where it's a problem, but
  this is where I noticed it, by chance.
- Added a traditional Strife color set for the automap.


git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@164 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
Christoph Oelckers 2008-08-23 21:48:24 +00:00
parent 6e41b5eec9
commit 66a753dcfd
16 changed files with 368 additions and 127 deletions

View file

@ -4174,6 +4174,18 @@
> >
</File> </File>
</Filter> </Filter>
<Filter
Name="glsl"
>
<File
RelativePath=".\src\gl\glsl_state.cpp"
>
</File>
<File
RelativePath=".\src\gl\glsl_state.h"
>
</File>
</Filter>
</Filter> </Filter>
</Files> </Files>
<Globals> <Globals>

View file

@ -91,6 +91,15 @@ static BYTE DoomPaletteVals[11*3] =
0x80,0x80,0x80, 0x6c,0x6c,0x6c 0x80,0x80,0x80, 0x6c,0x6c,0x6c
}; };
static AMColor StrifeColors[11];
static BYTE StrifePaletteVals[11*3] =
{
0x00,0x00,0x00, 239, 239, 0, 0x10,0x10,0x10,
199, 195, 195, 119, 115, 115, 55, 59, 91,
119, 115, 115, 0xfc,0x00,0x00, 0x4c,0x4c,0x4c,
0x80,0x80,0x80, 0x6c,0x6c,0x6c
};
#define MAPBITS 12 #define MAPBITS 12
#define MapDiv SafeDivScale12 #define MapDiv SafeDivScale12
#define MapMul MulScale12 #define MapMul MulScale12
@ -122,7 +131,7 @@ CVAR (Bool, am_showmonsters, true, CVAR_ARCHIVE);
CVAR (Bool, am_showitems, false, CVAR_ARCHIVE); CVAR (Bool, am_showitems, false, CVAR_ARCHIVE);
CVAR (Bool, am_showtime, true, CVAR_ARCHIVE); CVAR (Bool, am_showtime, true, CVAR_ARCHIVE);
CVAR (Bool, am_showtotaltime, false, CVAR_ARCHIVE); CVAR (Bool, am_showtotaltime, false, CVAR_ARCHIVE);
CVAR (Bool, am_usecustomcolors, true, CVAR_ARCHIVE); CVAR (Int, am_colorset, 0, CVAR_ARCHIVE);
CVAR (Color, am_backcolor, 0x6c5440, CVAR_ARCHIVE); CVAR (Color, am_backcolor, 0x6c5440, CVAR_ARCHIVE);
CVAR (Color, am_yourcolor, 0xfce8d8, CVAR_ARCHIVE); CVAR (Color, am_yourcolor, 0xfce8d8, CVAR_ARCHIVE);
CVAR (Color, am_wallcolor, 0x2c1808, CVAR_ARCHIVE); CVAR (Color, am_wallcolor, 0x2c1808, CVAR_ARCHIVE);
@ -648,6 +657,7 @@ static void AM_initColors (bool overlayed)
for (i = j = 0; i < 11; i++, j += 3) for (i = j = 0; i < 11; i++, j += 3)
{ {
DoomColors[i].FromRGB(DoomPaletteVals[j], DoomPaletteVals[j+1], DoomPaletteVals[j+2]); DoomColors[i].FromRGB(DoomPaletteVals[j], DoomPaletteVals[j+1], DoomPaletteVals[j+2]);
StrifeColors[i].FromRGB(StrifePaletteVals[j], StrifePaletteVals[j+1], StrifePaletteVals[j+2]);
} }
} }
@ -667,62 +677,88 @@ static void AM_initColors (bool overlayed)
InterTeleportColor.FromCVar (am_ovtelecolor); InterTeleportColor.FromCVar (am_ovtelecolor);
IntraTeleportColor = InterTeleportColor; IntraTeleportColor = InterTeleportColor;
} }
else if (am_usecustomcolors) else switch(am_colorset)
{ {
/* Use the custom colors in the am_* cvars */ default:
Background.FromCVar (am_backcolor); {
YourColor.FromCVar (am_yourcolor); /* Use the custom colors in the am_* cvars */
SecretWallColor.FromCVar (am_secretwallcolor); Background.FromCVar (am_backcolor);
WallColor.FromCVar (am_wallcolor); YourColor.FromCVar (am_yourcolor);
TSWallColor.FromCVar (am_tswallcolor); SecretWallColor.FromCVar (am_secretwallcolor);
FDWallColor.FromCVar (am_fdwallcolor); WallColor.FromCVar (am_wallcolor);
CDWallColor.FromCVar (am_cdwallcolor); TSWallColor.FromCVar (am_tswallcolor);
ThingColor_Item.FromCVar (am_thingcolor_item); FDWallColor.FromCVar (am_fdwallcolor);
ThingColor_Friend.FromCVar (am_thingcolor_friend); CDWallColor.FromCVar (am_cdwallcolor);
ThingColor_Monster.FromCVar (am_thingcolor_monster); ThingColor_Item.FromCVar (am_thingcolor_item);
ThingColor.FromCVar (am_thingcolor); ThingColor_Friend.FromCVar (am_thingcolor_friend);
GridColor.FromCVar (am_gridcolor); ThingColor_Monster.FromCVar (am_thingcolor_monster);
XHairColor.FromCVar (am_xhaircolor); ThingColor.FromCVar (am_thingcolor);
NotSeenColor.FromCVar (am_notseencolor); GridColor.FromCVar (am_gridcolor);
LockedColor.FromCVar (am_lockedcolor); XHairColor.FromCVar (am_xhaircolor);
InterTeleportColor.FromCVar (am_interlevelcolor); NotSeenColor.FromCVar (am_notseencolor);
IntraTeleportColor.FromCVar (am_intralevelcolor); LockedColor.FromCVar (am_lockedcolor);
SecretSectorColor.FromCVar (am_secretsectorcolor); InterTeleportColor.FromCVar (am_interlevelcolor);
IntraTeleportColor.FromCVar (am_intralevelcolor);
SecretSectorColor.FromCVar (am_secretsectorcolor);
DWORD ba = am_backcolor; DWORD ba = am_backcolor;
int r = RPART(ba) - 16; int r = RPART(ba) - 16;
int g = GPART(ba) - 16; int g = GPART(ba) - 16;
int b = BPART(ba) - 16; int b = BPART(ba) - 16;
if (r < 0) if (r < 0)
r += 32; r += 32;
if (g < 0) if (g < 0)
g += 32; g += 32;
if (b < 0) if (b < 0)
b += 32; b += 32;
AlmostBackground.FromRGB(r, g, b); AlmostBackground.FromRGB(r, g, b);
} break;
else }
{ // Use colors corresponding to the original Doom's
Background = DoomColors[0]; case 1: // Doom
YourColor = DoomColors[1]; // Use colors corresponding to the original Doom's
AlmostBackground = DoomColors[2]; Background = DoomColors[0];
SecretSectorColor = YourColor = DoomColors[1];
SecretWallColor = AlmostBackground = DoomColors[2];
WallColor = DoomColors[3]; SecretSectorColor =
TSWallColor = DoomColors[4]; SecretWallColor =
FDWallColor = DoomColors[5]; WallColor = DoomColors[3];
LockedColor = TSWallColor = DoomColors[4];
CDWallColor = DoomColors[6]; FDWallColor = DoomColors[5];
ThingColor_Item = LockedColor =
ThingColor_Friend = CDWallColor = DoomColors[6];
ThingColor_Monster = ThingColor_Item =
ThingColor = DoomColors[7]; ThingColor_Friend =
GridColor = DoomColors[8]; ThingColor_Monster =
XHairColor = DoomColors[9]; ThingColor = DoomColors[7];
NotSeenColor = DoomColors[10]; GridColor = DoomColors[8];
XHairColor = DoomColors[9];
NotSeenColor = DoomColors[10];
break;
case 2: // Strife
// Use colors corresponding to the original Strife's
Background = StrifeColors[0];
YourColor = StrifeColors[1];
AlmostBackground = DoomColors[2];
SecretSectorColor =
SecretWallColor =
WallColor = StrifeColors[3];
TSWallColor = StrifeColors[4];
FDWallColor = StrifeColors[5];
LockedColor =
CDWallColor = StrifeColors[6];
ThingColor_Item =
ThingColor_Friend =
ThingColor_Monster =
ThingColor = StrifeColors[7];
GridColor = StrifeColors[8];
XHairColor = StrifeColors[9];
NotSeenColor = StrifeColors[10];
break;
} }
lastpal = palette; lastpal = palette;
@ -1348,7 +1384,7 @@ void AM_drawWalls (bool allmap)
lines[i].special == Teleport_ZombieChanger || lines[i].special == Teleport_ZombieChanger ||
lines[i].special == Teleport_Line) && lines[i].special == Teleport_Line) &&
(lines[i].activation & SPAC_PlayerActivate) && (lines[i].activation & SPAC_PlayerActivate) &&
am_usecustomcolors) am_colorset == 0)
{ // intra-level teleporters { // intra-level teleporters
AM_drawMline(&l, IntraTeleportColor); AM_drawMline(&l, IntraTeleportColor);
} }
@ -1356,7 +1392,7 @@ void AM_drawWalls (bool allmap)
lines[i].special == Teleport_EndGame || lines[i].special == Teleport_EndGame ||
lines[i].special == Exit_Normal || lines[i].special == Exit_Normal ||
lines[i].special == Exit_Secret) && lines[i].special == Exit_Secret) &&
am_usecustomcolors) am_colorset == 0)
{ // inter-level/game-ending teleporters { // inter-level/game-ending teleporters
AM_drawMline(&l, InterTeleportColor); AM_drawMline(&l, InterTeleportColor);
} }
@ -1372,7 +1408,7 @@ void AM_drawWalls (bool allmap)
lines[i].special == ACS_LockedExecuteDoor || lines[i].special == ACS_LockedExecuteDoor ||
(lines[i].special == Generic_Door && lines[i].args[4]!=0)) (lines[i].special == Generic_Door && lines[i].args[4]!=0))
{ {
if (am_usecustomcolors) if (am_colorset == 0)
{ {
int P_GetMapColorForLock(int lock); int P_GetMapColorForLock(int lock);
int lock; int lock;

View file

@ -1,3 +1,8 @@
/*
** a_randomspawner.cpp
** A thing that randomly spawns one item in a list of many, before disappearing.
*/
#include "actor.h" #include "actor.h"
#include "info.h" #include "info.h"
#include "m_random.h" #include "m_random.h"
@ -10,12 +15,7 @@
#include "a_action.h" #include "a_action.h"
#include "thingdef/thingdef.h" #include "thingdef/thingdef.h"
/* #define MAX_RANDOMSPAWNERS_RECURSION 32 // Should be largely more than enough, honestly.
- in the decorate definition define multiple drop items
- use the function GetDropItems to get the first drop item, then iterate over them and count how many dropitems are defined.
- with M_Random( ) % NUMBEROFDROPITEMS you get a random drop item number (let's call it n)
- use GetDropItems again to get the first drop item, then iterate to the n-th drop item
*/
static FRandom pr_randomspawn("RandomSpawn"); static FRandom pr_randomspawn("RandomSpawn");
class ARandomSpawner : public AActor class ARandomSpawner : public AActor
@ -32,10 +32,8 @@ class ARandomSpawner : public AActor
Super::PostBeginPlay(); Super::PostBeginPlay();
drop = di = GetDropItems(RUNTIME_TYPE(this)); drop = di = GetDropItems(RUNTIME_TYPE(this));
// Always make sure it actually exists.
if (di != NULL) if (di != NULL)
{ {
// First, we get the size of the array...
while (di != NULL) while (di != NULL)
{ {
if (di->Name != NAME_None) if (di->Name != NAME_None)
@ -59,7 +57,9 @@ class ARandomSpawner : public AActor
} }
} }
// So now we can spawn the dropped item. // So now we can spawn the dropped item.
if (pr_randomspawn() <= di->probability) // prob 255 = always spawn, prob 0 = never spawn. if (special1 >= MAX_RANDOMSPAWNERS_RECURSION) // Prevents infinite recursions
Spawn("Unknown", x, y, z, NO_REPLACE); // Show that there's a problem.
else if (pr_randomspawn() <= di->probability) // prob 255 = always spawn, prob 0 = never spawn.
{ {
newmobj = Spawn(di->Name, x, y, z, ALLOW_REPLACE); newmobj = Spawn(di->Name, x, y, z, ALLOW_REPLACE);
// copy everything relevant // copy everything relevant
@ -77,11 +77,32 @@ class ARandomSpawner : public AActor
newmobj->momx = momx; newmobj->momx = momx;
newmobj->momy = momy; newmobj->momy = momy;
newmobj->momz = momz; newmobj->momz = momz;
newmobj->master = master; // For things such as DamageMaster/DamageChildren, transfer mastery.
newmobj->target = target;
newmobj->tracer = tracer;
newmobj->CopyFriendliness(this, false); newmobj->CopyFriendliness(this, false);
// Special1 is used to count how many recursions we're in.
if (newmobj->IsKindOf(PClass::FindClass("RandomSpawner")))
newmobj->special1 = ++special1;
} }
} }
Destroy(); if ((newmobj != NULL) && ((newmobj->flags4 & MF4_BOSSDEATH) || (newmobj->flags2 & MF2_BOSS)))
this->target = newmobj; // If the spawned actor has either of those flags, it's a boss.
else Destroy(); // "else" because a boss-replacing spawner must wait until it can call A_BossDeath.
} }
void Tick() // This function is needed for handling boss replacers
{
Super::Tick();
if (target == NULL || target->health <= 0)
{
health = 0;
CALL_ACTION(A_BossDeath, this);
Destroy();
}
}
}; };
IMPLEMENT_CLASS (ARandomSpawner) IMPLEMENT_CLASS (ARandomSpawner)

View file

@ -901,30 +901,27 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
int cx, cy, cw, ch, cr, cb; int cx, cy, cw, ch, cr, cb;
// These still need to be caclulated for the clear call. // These still need to be caclulated for the clear call.
if(bg == NULL) if(!block.fullScreenOffsets)
{ {
if(!block.fullScreenOffsets) // Calc real screen coordinates for bar
x = cmd.x + ST_X + xOffset;
y = cmd.y + ST_Y + yOffset;
w = fg->GetScaledWidth();
h = fg->GetScaledHeight();
if (Scaled)
{ {
// Calc real screen coordinates for bar screen->VirtualToRealCoordsInt(x, y, w, h, 320, 200, true);
x = cmd.x + ST_X + xOffset;
y = cmd.y + ST_Y + yOffset;
w = fg->GetScaledWidth();
h = fg->GetScaledHeight();
if (Scaled)
{
screen->VirtualToRealCoordsInt(x, y, w, h, 320, 200, true);
}
}
else
{
x = cmd.x + xOffset;
y = cmd.y + yOffset;
w = fg->GetScaledWidth();
h = fg->GetScaledHeight();
if(vid_fps && x < 0 && y >= 0)
y += 10;
} }
} }
else
{
x = cmd.x + xOffset;
y = cmd.y + yOffset;
w = fg->GetScaledWidth();
h = fg->GetScaledHeight();
if(vid_fps && x < 0 && y >= 0)
y += 10;
}
if(cmd.special3 != 0) if(cmd.special3 != 0)
{ {
@ -1548,7 +1545,7 @@ void DSBarInfo::DrawInventoryBar(int type, int num, int x, int y, int xOffset, i
DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*spacing, y, xOffset, yOffset, alpha, fullScreenOffsets); DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*spacing, y, xOffset, yOffset, alpha, fullScreenOffsets);
} }
if(type != GAME_Strife) //Strife draws the cursor before the icons if(type != GAME_Strife) //Strife draws the cursor before the icons
DrawGraphic(TexMan(item->Icon), x+i*spacing, y, xOffset, yOffset, alpha, false, item->Amount <= 0); DrawGraphic(TexMan(item->Icon), x+i*spacing, y, xOffset, yOffset, alpha, fullScreenOffsets, false, item->Amount <= 0);
if(item == CPlayer->mo->InvSel) if(item == CPlayer->mo->InvSel)
{ {
if(type == GAME_Heretic) if(type == GAME_Heretic)

View file

@ -1147,16 +1147,18 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
this->ParseSBarInfoBlock(sc, cmd.subBlock); this->ParseSBarInfoBlock(sc, cmd.subBlock);
break; break;
case SBARINFO_ISSELECTED: case SBARINFO_ISSELECTED:
//Using StringConst instead of Identifieres is deperecated!
if(sc.CheckToken(TK_Identifier)) if(sc.CheckToken(TK_Identifier))
{ {
if(sc.Compare("not")) if(sc.Compare("not"))
{ {
cmd.flags |= SBARINFOEVENT_NOT; cmd.flags |= SBARINFOEVENT_NOT;
if(!sc.CheckToken(TK_StringConst))
sc.MustGetToken(TK_Identifier);
} }
else
sc.ScriptError("Expected 'not' got '%s' instead.", sc.String);
} }
sc.MustGetToken(TK_StringConst); else
sc.MustGetToken(TK_StringConst);
for(int i = 0;i < 2;i++) for(int i = 0;i < 2;i++)
{ {
cmd.setString(sc, sc.String, i); cmd.setString(sc, sc.String, i);
@ -1166,7 +1168,10 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.ScriptError("'%s' is not a type of weapon.", sc.String); sc.ScriptError("'%s' is not a type of weapon.", sc.String);
} }
if(sc.CheckToken(',')) if(sc.CheckToken(','))
sc.MustGetToken(TK_StringConst); {
if(!sc.CheckToken(TK_StringConst))
sc.MustGetToken(TK_Identifier);
}
else else
break; break;
} }

View file

@ -190,15 +190,11 @@ void gl_GetLightColor(int lightlevel, int rellight, const FColormap * cm, float
} }
else if (gl_fixedcolormap>=CM_TORCH) else if (gl_fixedcolormap>=CM_TORCH)
{ {
if (gl_enhanced_lightamp) int flicker=gl_fixedcolormap-CM_TORCH;
{ r=(0.8f+(7-flicker)/70.0f);
int flicker=gl_fixedcolormap-CM_TORCH; if (r>1.0f) r=1.0f;
r=(0.8f+(7-flicker)/70.0f); b=g=r;
if (r>1.0f) r=1.0f; if (gl_enhanced_lightamp) b*=0.75f;
g=r;
b=r*0.75f;
}
else r=g=b=1.0f;
} }
else r=g=b=1.0f; else r=g=b=1.0f;
return; return;

View file

@ -56,6 +56,7 @@
#include "gl/gl_functions.h" #include "gl/gl_functions.h"
#include "gl/gl_shader.h" #include "gl/gl_shader.h"
#include "gl/gl_translate.h" #include "gl/gl_translate.h"
#include "gl/glsl_state.h"
CUSTOM_CVAR(Bool, gl_warp_shader, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL) CUSTOM_CVAR(Bool, gl_warp_shader, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
{ {
@ -1227,7 +1228,8 @@ const WorldTextureInfo * FGLTexture::Bind(int texunit, int cm, int clampmode, in
} }
else else
{ {
Shader->Bind(cm, usebright, tex->bWarped? static_cast<FWarpTexture*>(tex)->GetSpeed() : 0.f); glsl->SetBrightmap(usebright);
glsl->SetWarp(tex->bWarped, static_cast<FWarpTexture*>(tex)->GetSpeed());
if (cm != CM_SHADE) cm = CM_DEFAULT; if (cm != CM_SHADE) cm = CM_DEFAULT;
} }
} }
@ -1290,7 +1292,7 @@ const PatchTextureInfo * FGLTexture::BindPatch(int texunit, int cm, int translat
delete brightmap; delete brightmap;
tex->bm_info.Brightmap = NULL; tex->bm_info.Brightmap = NULL;
} }
else else
{ {
usebright = true; usebright = true;
} }
@ -1331,7 +1333,8 @@ const PatchTextureInfo * FGLTexture::BindPatch(int texunit, int cm, int translat
} }
else else
{ {
Shader->Bind(cm, usebright, tex->bWarped? static_cast<FWarpTexture*>(tex)->GetSpeed() : 0.f); glsl->SetBrightmap(usebright);
glsl->SetWarp(tex->bWarped, static_cast<FWarpTexture*>(tex)->GetSpeed());
if (cm != CM_SHADE) cm = CM_DEFAULT; if (cm != CM_SHADE) cm = CM_DEFAULT;
} }
} }

103
src/gl/glsl_state.cpp Normal file
View file

@ -0,0 +1,103 @@
/*
** glsl_state.cpp
** GLSL state maintenance
**
**---------------------------------------------------------------------------
** Copyright 2008 Christoph Oelckers
** 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.
** 4. When not used as part of GZDoom or a GZDoom derivative, this code will be
** covered by the terms of the GNU Lesser General Public License as published
** by the Free Software Foundation; either version 2.1 of the License, or (at
** your option) any later version.
** 5. Full disclosure of the entire project's source code, except for third
** party libraries is mandatory. (NOTE: This clause is non-negotiable!)
**
** 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 "gl/glsl_state.h"
static GLSLRenderState _glsl;
GLSLRenderState *glsl = &_glsl;
void GLSLRenderState::SetFixedColormap(int cm)
{
}
void GLSLRenderState::SetLight(int light, int rellight, FColormap *cm, float alpha, bool additive)
{
}
void GLSLRenderState::SetLight(int light, int rellight, FColormap *cm, float alpha, bool additive, PalEntry ThingColor, bool weapon)
{
}
void GLSLRenderState::SetWarp(int mode, float speed)
{
}
void GLSLRenderState::SetBrightmap(bool on)
{
}
void GLSLRenderState::EnableBrightmap(bool on)
{
}
void GLSLRenderState::SetFloorGlow(PalEntry color, float height)
{
}
void GLSLRenderState::SetCeilingGlow(PalEntry color, float height)
{
}
void GLSLRenderState::ClearDynLights()
{
}
void GLSLRenderState::SetDynLight(int index, float x, float y, float z, float size, PalEntry color, int mode)
{
}
void GLSLRenderState::SetLightingMode(int mode)
{
}
void GLSLRenderState::Apply()
{
}
void GLSLRenderState::Enable(bool on)
{
}
void GLSLRenderState::Reset()
{
}

33
src/gl/glsl_state.h Normal file
View file

@ -0,0 +1,33 @@
#ifndef GLSL_STATE_H
#define GLSL_STATE_H
#include "doomtype.h"
struct FColormap;
class GLSLRenderState
{
public:
void SetFixedColormap(int cm);
void SetLight(int light, int rellight, FColormap *cm, float alpha, bool additive);
void SetLight(int light, int rellight, FColormap *cm, float alpha, bool additive, PalEntry ThingColor, bool weapon);
void SetWarp(int mode, float speed);
void EnableBrightmap(bool on);
void SetBrightmap(bool on);
void SetFloorGlow(PalEntry color, float height);
void SetCeilingGlow(PalEntry color, float height);
void ClearDynLights();
void SetDynLight(int index, float x, float y, float z, float size, PalEntry color, int mode);
void SetLightingMode(int mode);
void Apply();
void Enable(bool on);
void Reset();
};
extern GLSLRenderState *glsl;
#endif

View file

@ -293,6 +293,43 @@ FActorInfo *FActorInfo::GetReplacee ()
return rep; return rep;
} }
//==========================================================================
//
//
//==========================================================================
void FActorInfo::SetDamageFactor(FName type, fixed_t factor)
{
if (factor != FRACUNIT)
{
if (DamageFactors == NULL) DamageFactors=new DmgFactors;
DamageFactors->Insert(type, factor);
}
else
{
if (DamageFactors != NULL)
DamageFactors->Remove(type);
}
}
//==========================================================================
//
//
//==========================================================================
void FActorInfo::SetPainChance(FName type, int chance)
{
if (chance >= 0)
{
if (PainChances == NULL) PainChances=new PainChanceList;
PainChances->Insert(type, MIN(chance, 255));
}
else
{
if (PainChances != NULL)
PainChances->Remove(type);
}
}
//========================================================================== //==========================================================================
// //

View file

@ -201,6 +201,8 @@ struct FActorInfo
void BuildDefaults (); void BuildDefaults ();
void ApplyDefaults (BYTE *defaults); void ApplyDefaults (BYTE *defaults);
void RegisterIDs (); void RegisterIDs ();
void SetDamageFactor(FName type, fixed_t factor);
void SetPainChance(FName type, int chance);
FState *FindState (FName name) const; FState *FindState (FName name) const;
FState *FindState (int numnames, FName *names, bool exact=false) const; FState *FindState (int numnames, FName *names, bool exact=false) const;

View file

@ -113,6 +113,7 @@ EXTERN_CVAR (Bool, cl_run)
EXTERN_CVAR (Int, crosshair) EXTERN_CVAR (Int, crosshair)
EXTERN_CVAR (Bool, freelook) EXTERN_CVAR (Bool, freelook)
EXTERN_CVAR (Int, sv_smartaim) EXTERN_CVAR (Int, sv_smartaim)
EXTERN_CVAR (Int, am_colorset)
static void CalcIndent (menu_t *menu); static void CalcIndent (menu_t *menu);
@ -559,7 +560,6 @@ static void StartMapColorsMenu (void);
EXTERN_CVAR (Int, am_rotate) EXTERN_CVAR (Int, am_rotate)
EXTERN_CVAR (Int, am_overlay) EXTERN_CVAR (Int, am_overlay)
EXTERN_CVAR (Bool, am_usecustomcolors)
EXTERN_CVAR (Bool, am_showitems) EXTERN_CVAR (Bool, am_showitems)
EXTERN_CVAR (Bool, am_showmonsters) EXTERN_CVAR (Bool, am_showmonsters)
EXTERN_CVAR (Bool, am_showsecrets) EXTERN_CVAR (Bool, am_showsecrets)
@ -569,8 +569,9 @@ EXTERN_CVAR (Bool, am_showtotaltime)
EXTERN_CVAR (Bool, am_drawmapback) EXTERN_CVAR (Bool, am_drawmapback)
static value_t MapColorTypes[] = { static value_t MapColorTypes[] = {
{ 1, "Custom" }, { 0, "Custom" },
{ 0, "Traditional Doom" } { 1, "Traditional Doom" },
{ 2, "Traditional Strife" }
}; };
static value_t SecretTypes[] = { static value_t SecretTypes[] = {
@ -592,7 +593,7 @@ static value_t OverlayTypes[] = {
}; };
static menuitem_t AutomapItems[] = { static menuitem_t AutomapItems[] = {
{ discrete, "Map color set", {&am_usecustomcolors}, {2.0}, {0.0}, {0.0}, {MapColorTypes} }, { discrete, "Map color set", {&am_colorset}, {3.0}, {0.0}, {0.0}, {MapColorTypes} },
{ more, "Set custom colors", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t*)StartMapColorsMenu} }, { more, "Set custom colors", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t*)StartMapColorsMenu} },
{ redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} }, { redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} },
{ discrete, "Rotate automap", {&am_rotate}, {3.0}, {0.0}, {0.0}, {RotateTypes} }, { discrete, "Rotate automap", {&am_rotate}, {3.0}, {0.0}, {0.0}, {RotateTypes} },

View file

@ -2881,7 +2881,7 @@ static void P_GroupLines (bool buildmap)
Printf ("---Group Lines Times---\n"); Printf ("---Group Lines Times---\n");
for (i = 0; i < 7; ++i) for (i = 0; i < 7; ++i)
{ {
Printf (" time %d:%9.4f ms\n", i, times[i].Time() * 1e3); Printf (" time %d:%9.4f ms\n", i, times[i].TimeMS());
} }
} }
} }
@ -3635,7 +3635,7 @@ void P_SetupLevel (char *lumpname, int position)
"init polys", "init polys",
"precache" "precache"
}; };
Printf ("Time%3d:%9.4f ms (%s)\n", i, times[i].Time() * 1e3, timenames[i]); Printf ("Time%3d:%9.4f ms (%s)\n", i, times[i].TimeMS(), timenames[i]);
} }
} }
MapThingsConverted.Clear(); MapThingsConverted.Clear();

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 "1181" #define ZD_SVN_REVISION_STRING "1183"
#define ZD_SVN_REVISION_NUMBER 1181 #define ZD_SVN_REVISION_NUMBER 1183

View file

@ -413,7 +413,7 @@ static flagdef *FindFlag (const PClass *type, const char *part1, const char *par
// properties is not recommended // properties is not recommended
// //
//=========================================================================== //===========================================================================
static void HandleDeprecatedFlags(AActor *defaults, bool set, int index) static void HandleDeprecatedFlags(AActor *defaults, FActorInfo *info, bool set, int index)
{ {
switch (index) switch (index)
{ {
@ -436,8 +436,8 @@ static void HandleDeprecatedFlags(AActor *defaults, bool set, int index)
defaults->gravity = set? FRACUNIT/4 : FRACUNIT; defaults->gravity = set? FRACUNIT/4 : FRACUNIT;
break; break;
case DEPF_FIRERESIST: case DEPF_FIRERESIST:
if (set) defaults->GetClass()->ActorInfo->DamageFactors->Insert("Fire", 0.5); info->SetDamageFactor(NAME_Fire, set? FRACUNIT/2 : FRACUNIT);
else defaults->GetClass()->ActorInfo->DamageFactors->Remove("Fire"); break;
case DEPF_PICKUPFLASH: case DEPF_PICKUPFLASH:
if (set) if (set)
{ {
@ -468,22 +468,23 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag)
const char *dot = strchr (flagname, '.'); const char *dot = strchr (flagname, '.');
flagdef *fd; flagdef *fd;
const PClass *cls = self->GetClass();
if (dot != NULL) if (dot != NULL)
{ {
FString part1(flagname, dot-flagname); FString part1(flagname, dot-flagname);
fd = FindFlag (self->GetClass(), part1, dot+1); fd = FindFlag (cls, part1, dot+1);
} }
else else
{ {
fd = FindFlag (self->GetClass(), flagname, NULL); fd = FindFlag (cls, flagname, NULL);
} }
if (fd != NULL) if (fd != NULL)
{ {
if (fd->structoffset == -1) if (fd->structoffset == -1)
{ {
HandleDeprecatedFlags(self, expression, fd->flagbit); HandleDeprecatedFlags(self, cls->ActorInfo, expression, fd->flagbit);
} }
else else
{ {
@ -495,7 +496,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag)
} }
else else
{ {
Printf("Unknown flag '%s' in '%s'\n", flagname, self->GetClass()->TypeName.GetChars()); Printf("Unknown flag '%s' in '%s'\n", flagname, cls->TypeName.GetChars());
} }
} }
@ -520,7 +521,7 @@ void ParseActorFlag (FScanner &sc, Baggage &bag, int mod)
AActor *defaults = (AActor*)bag.Info->Class->Defaults; AActor *defaults = (AActor*)bag.Info->Class->Defaults;
if (fd->structoffset == -1) // this is a deprecated flag that has been changed into a real property if (fd->structoffset == -1) // this is a deprecated flag that has been changed into a real property
{ {
HandleDeprecatedFlags(defaults, mod=='+', fd->flagbit); HandleDeprecatedFlags(defaults, bag.Info, mod=='+', fd->flagbit);
} }
else else
{ {
@ -963,9 +964,7 @@ static void ActorPainChance (FScanner &sc, AActor *defaults, Baggage &bag)
else painType=sc.String; else painType=sc.String;
sc.MustGetToken(','); sc.MustGetToken(',');
sc.MustGetNumber(); sc.MustGetNumber();
bag.Info->SetPainChance(painType, sc.Number);
if (bag.Info->PainChances == NULL) bag.Info->PainChances=new PainChanceList;
(*bag.Info->PainChances)[painType] = (BYTE)sc.Number;
return; return;
} }
defaults->PainChance=sc.Number; defaults->PainChance=sc.Number;
@ -1636,7 +1635,6 @@ static void ActorDamageType (FScanner &sc, AActor *defaults, Baggage &bag)
static void ActorDamageFactor (FScanner &sc, AActor *defaults, Baggage &bag) static void ActorDamageFactor (FScanner &sc, AActor *defaults, Baggage &bag)
{ {
sc.MustGetString (); sc.MustGetString ();
if (bag.Info->DamageFactors == NULL) bag.Info->DamageFactors=new DmgFactors;
FName dmgType; FName dmgType;
if (sc.Compare("Normal")) dmgType = NAME_None; if (sc.Compare("Normal")) dmgType = NAME_None;
@ -1644,7 +1642,7 @@ static void ActorDamageFactor (FScanner &sc, AActor *defaults, Baggage &bag)
sc.MustGetToken(','); sc.MustGetToken(',');
sc.MustGetFloat(); sc.MustGetFloat();
(*bag.Info->DamageFactors)[dmgType]=(fixed_t)(sc.Float*FRACUNIT); bag.Info->SetDamageFactor(dmgType, FLOAT2FIXED(sc.Float));
} }
//========================================================================== //==========================================================================

View file

@ -36,10 +36,7 @@ namespace Timidity
void Renderer::reset_voices() void Renderer::reset_voices()
{ {
for (int i = 0; i < voices; i++) memset(voice, 0, sizeof(voice[0]) * voices);
{
voice[i].status = 0;
}
} }
/* Process the Reset All Controllers event */ /* Process the Reset All Controllers event */