Skip to content

Commit

Permalink
Map Renderer|Client: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Aug 31, 2013
1 parent d8e9b2a commit aab58ee
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 49 deletions.
4 changes: 3 additions & 1 deletion doomsday/client/include/resource/sprites.h
Expand Up @@ -23,7 +23,9 @@
#ifndef DENG_RESOURCE_SPRITES_H
#define DENG_RESOURCE_SPRITES_H

#include "Materials"
#include <de/libdeng1.h>

class Material;

/**
* Sprites are patches with a special naming convention so they can be
Expand Down
65 changes: 35 additions & 30 deletions doomsday/client/src/render/r_things.cpp
Expand Up @@ -55,46 +55,45 @@

using namespace de;

float weaponOffsetScale = 0.3183f; // 1/Pi
int psp3d;
float pspLightLevelMultiplier = 1;
float pspOffset[2];
int levelFullBright;
int weaponOffsetScaleY = 1000;
float weaponFOVShift = 45;
byte weaponScaleMode = SCALEMODE_SMART_STRETCH;
float modelSpinSpeed = 1;

/*
* Console variables:
*/
int useSRVO = 2; ///< @c 1= models only, @c 2= sprites + models
int useSRVOAngle = 1;

int alwaysAlign;
int noSpriteZWrite = false;
float pspOffset[2];
float pspLightLevelMultiplier = 1;
// useSRVO: 1 = models only, 2 = sprites + models
int useSRVO = 2, useSRVOAngle = true;
int noSpriteZWrite = false;

int psp3d;
float modelSpinSpeed = 1;
int maxModelDistance = 1500;

int maxModelDistance = 1500;
int levelFullBright;
float weaponFOVShift = 45;
float weaponOffsetScale = 0.3183f; // 1/Pi
byte weaponScaleMode = SCALEMODE_SMART_STRETCH;

#ifdef __CLIENT__

void R_ProjectPlayerSprites()
{
int i;
float inter;
modeldef_t *mf, *nextmf;
ddpsprite_t *psp;
boolean isFullBright = (levelFullBright != 0);
boolean isModel;
ddplayer_t *ddpl = &viewPlayer->shared;
viewdata_t const *viewData = R_ViewData(viewPlayer - ddPlayers);

psp3d = false;

// Cameramen have no psprites.
ddplayer_t *ddpl = &viewPlayer->shared;
if((ddpl->flags & DDPF_CAMERA) || (ddpl->flags & DDPF_CHASECAM))
return;

// Determine if we should be drawing all the psprites full bright?
boolean isFullBright = (levelFullBright != 0);
if(!isFullBright)
{
for(i = 0, psp = ddpl->pSprites; i < DDMAXPSPRITES; ++i, psp++)
ddpsprite_t *psp = ddpl->pSprites;
for(int i = 0; i < DDMAXPSPRITES; ++i, psp++)
{
if(!psp->statePtr) continue;

Expand All @@ -104,17 +103,22 @@ void R_ProjectPlayerSprites()
}
}

for(i = 0, psp = ddpl->pSprites; i < DDMAXPSPRITES; ++i, psp++)
viewdata_t const *viewData = R_ViewData(viewPlayer - ddPlayers);

ddpsprite_t *psp = ddpl->pSprites;
for(int i = 0; i < DDMAXPSPRITES; ++i, psp++)
{
vispsprite_t* spr = &visPSprites[i];
vispsprite_t *spr = &visPSprites[i];

spr->type = VPSPR_SPRITE;
spr->psp = psp;

if(!psp->statePtr) continue;

// First, determine whether this is a model or a sprite.
isModel = false;
bool isModel = false;
modeldef_t *mf = 0, *nextmf = 0;
float inter = 0;
if(useModels)
{
// Is there a model for this frame?
Expand Down Expand Up @@ -186,11 +190,12 @@ void R_ProjectPlayerSprites()
}
}

typedef struct {
struct vismobjzparams_t
{
vissprite_t *vis;
mobj_t const *mo;
boolean floorAdjust;
} vismobjzparams_t;
bool floorAdjust;
};

/**
* Determine the correct Z coordinate for the mobj. The visible Z coordinate
Expand All @@ -201,8 +206,8 @@ typedef struct {
*/
int RIT_VisMobjZ(Sector *sector, void *parameters)
{
DENG_ASSERT(sector);
DENG_ASSERT(parameters);
DENG_ASSERT(sector != 0);
DENG_ASSERT(parameters != 0);
vismobjzparams_t *p = (vismobjzparams_t *) parameters;

if(p->floorAdjust && p->mo->origin[VZ] == sector->floor().height())
Expand Down
18 changes: 0 additions & 18 deletions doomsday/client/src/resource/sprites.cpp
Expand Up @@ -383,9 +383,6 @@ spritedef_t *R_SpriteDef(int sprite)
return 0; // Not found.
}

/**
* Lookup a sprite frame by unique @a frame index.
*/
spriteframe_t *SpriteDef_Frame(spritedef_t const &sprDef, int frame)
{
if(frame >= 0 && frame < sprDef.numFrames)
Expand All @@ -395,21 +392,6 @@ spriteframe_t *SpriteDef_Frame(spritedef_t const &sprDef, int frame)
return 0; // Invalid frame.
}

/**
* Select an appropriate material for a mobj's angle and relative position with
* that of the viewer (the 'eye').
*
* @param sprFrame spriteframe_t instance.
* @param mobjAngle Angle of the mobj in the map coordinate space.
* @param angleToEye Relative angle of the mobj from the view position.
* @param noRotation @c true= Ignore rotations and always use the "front".
*
* Return values:
* @param flipX @c true= chosen material should be flipped on the X axis.
* @param flipY @c true= chosen material should be flipped on the Y axis.
*
* @return The chosen material otherwise @c 0.
*/
Material *SpriteFrame_Material(spriteframe_t &sprFrame, angle_t mobjAngle,
angle_t angleToEye, bool noRotation, bool &flipX, bool &flipY)
{
Expand Down

0 comments on commit aab58ee

Please sign in to comment.