Skip to content

Commit

Permalink
Fixed: Clientside plane glows
Browse files Browse the repository at this point in the history
The server was sending some bogus glow colors,
overriding the client's correct colors. Materials
define the glow color, so the server should not
interfere.
  • Loading branch information
skyjake committed Jul 28, 2011
1 parent 379c2ef commit f535c02
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
6 changes: 4 additions & 2 deletions doomsday/engine/portable/include/sv_pool.h
Expand Up @@ -152,6 +152,7 @@ typedef enum {
#define SDF_CEIL_COLOR_RED 0x00080000
#define SDF_CEIL_COLOR_GREEN 0x00100000
#define SDF_CEIL_COLOR_BLUE 0x00200000
/*
#define SDF_FLOOR_GLOW_RED 0x00400000
#define SDF_FLOOR_GLOW_GREEN 0x00800000
#define SDF_FLOOR_GLOW_BLUE 0x01000000
Expand All @@ -160,6 +161,7 @@ typedef enum {
#define SDF_CEIL_GLOW_BLUE 0x08000000
#define SDF_FLOOR_GLOW 0x10000000
#define SDF_CEIL_GLOW 0x20000000
*/

#define SIDF_TOP_MATERIAL 0x0001
#define SIDF_MID_MATERIAL 0x0002
Expand Down Expand Up @@ -269,8 +271,8 @@ typedef struct {
float height;
float target; // Target height.
float speed; // Move speed.
float glow; // Glow amount.
float glowRGB[3]; // Glow color.
//float glow; // Glow amount.
//float glowRGB[3]; // Glow color.
} dt_plane_t;

typedef struct {
Expand Down
8 changes: 5 additions & 3 deletions doomsday/engine/portable/src/cl_world.c
Expand Up @@ -623,7 +623,7 @@ void Cl_ReadSectorDelta2(int deltaType, boolean skip)
Surface_SetColorG(&sec->SP_ceilsurface, Msg_ReadByte() / 255.f);
if(df & SDF_CEIL_COLOR_BLUE)
Surface_SetColorB(&sec->SP_ceilsurface, Msg_ReadByte() / 255.f);

/*
if(df & SDF_FLOOR_GLOW_RED)
sec->planes[PLN_FLOOR]->glowRGB[0] = Msg_ReadByte() / 255.f;
if(df & SDF_FLOOR_GLOW_GREEN)
Expand All @@ -642,7 +642,7 @@ void Cl_ReadSectorDelta2(int deltaType, boolean skip)
sec->planes[PLN_FLOOR]->glow = (float) Msg_ReadShort() / DDMAXSHORT;
if(df & SDF_CEIL_GLOW)
sec->planes[PLN_CEILING]->glow = (float) Msg_ReadShort() / DDMAXSHORT;

*/
// The whole delta has been read. If we're about to skip, let's do so.
if(skip)
return;
Expand All @@ -651,7 +651,9 @@ void Cl_ReadSectorDelta2(int deltaType, boolean skip)
// the sector.
if(wasChanged)
{
//P_SectorPlanesChanged(GET_SECTOR_IDX(sec));
#ifdef _DEBUG
Con_Message("Cl_ReadSectorDelta2: WARNING: Plane height changed bypassing DMU!\n");
#endif
}

// Do we need to start any moving planes?
Expand Down
3 changes: 1 addition & 2 deletions doomsday/engine/portable/src/r_world.c
Expand Up @@ -1772,8 +1772,7 @@ boolean R_UpdatePlane(plane_t* pln, boolean forceUpdate)
}
else
{
pln->glowRGB[CR] = pln->glowRGB[CG] =
pln->glowRGB[CB] = 0;
pln->glowRGB[CR] = pln->glowRGB[CG] = pln->glowRGB[CB] = 0;
pln->glow = 0;
}

Expand Down
2 changes: 2 additions & 0 deletions doomsday/engine/portable/src/sv_frame.c
Expand Up @@ -559,6 +559,7 @@ VERBOSE( Con_Printf("Sv_WriteSectorDelta: (%i) Absolute ceiling height=%f\n",
if(df & SDF_CEIL_COLOR_BLUE)
Msg_WriteByte((byte) (255 * d->planes[PLN_CEILING].surface.rgba[2]));

/*
if(df & SDF_FLOOR_GLOW_RED)
Msg_WriteByte((byte) (255 * d->planes[PLN_FLOOR].glowRGB[0]));
if(df & SDF_FLOOR_GLOW_GREEN)
Expand All @@ -581,6 +582,7 @@ VERBOSE( Con_Printf("Sv_WriteSectorDelta: (%i) Absolute ceiling height=%f\n",
Msg_WriteShort(d->planes[PLN_CEILING].glow < 0 ? 0 :
d->planes[PLN_CEILING].glow > 1 ? DDMAXSHORT :
(short)(d->planes[PLN_CEILING].glow * DDMAXSHORT));
*/
}

/**
Expand Down
6 changes: 6 additions & 0 deletions doomsday/engine/portable/src/sv_pool.c
Expand Up @@ -504,9 +504,11 @@ void Sv_RegisterSector(dt_sector_t* reg, uint number)
reg->planes[i].height = sec->planes[i]->height;
reg->planes[i].target = sec->planes[i]->target;
reg->planes[i].speed = sec->planes[i]->speed;
/*
reg->planes[i].glow = sec->planes[i]->glow;
memcpy(reg->planes[i].glowRGB, sec->planes[i]->glowRGB,
sizeof(reg->planes[i].glowRGB));
*/

// Surface properties.
memcpy(reg->planes[i].surface.rgba, sec->planes[i]->surface.rgba,
Expand Down Expand Up @@ -754,6 +756,7 @@ boolean Sv_RegisterCompareSector(cregister_t* reg, uint number,
if(r->planes[PLN_CEILING].surface.rgba[2] != s->SP_ceilrgb[2])
df |= SDF_CEIL_COLOR_BLUE;

/*
if(r->planes[PLN_FLOOR].glowRGB[0] != s->SP_floorglowrgb[0])
df |= SDF_FLOOR_GLOW_RED;
if(r->planes[PLN_FLOOR].glowRGB[1] != s->SP_floorglowrgb[1])
Expand All @@ -772,6 +775,7 @@ boolean Sv_RegisterCompareSector(cregister_t* reg, uint number,
df |= SDF_FLOOR_GLOW;
if(r->planes[PLN_CEILING].glow != s->planes[PLN_CEILING]->glow)
df |= SDF_CEIL_GLOW;
*/

// The cases where an immediate change to a plane's height is needed:
// 1) Plane is not moving, but the heights are different. This means
Expand Down Expand Up @@ -1436,6 +1440,7 @@ void Sv_ApplyDeltaData(void* destDelta, const void* srcDelta)
d->planes[PLN_CEILING].surface.rgba[2] =
s->planes[PLN_CEILING].surface.rgba[2];

/*
if(sf & SDF_FLOOR_GLOW_RED)
d->planes[PLN_FLOOR].glowRGB[0] = s->planes[PLN_FLOOR].glowRGB[0];
if(sf & SDF_FLOOR_GLOW_GREEN)
Expand All @@ -1454,6 +1459,7 @@ void Sv_ApplyDeltaData(void* destDelta, const void* srcDelta)
d->planes[PLN_FLOOR].glow = s->planes[PLN_FLOOR].glow;
if(sf & SDF_CEIL_GLOW)
d->planes[PLN_CEILING].glow = s->planes[PLN_CEILING].glow;
*/
}
else if(src->type == DT_SIDE)
{
Expand Down

0 comments on commit f535c02

Please sign in to comment.