Skip to content

Commit

Permalink
Fix lighting defect and VS8 compiler warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
athile committed Jun 23, 2010
1 parent 3c04479 commit 3ed03fe
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 18 deletions.
3 changes: 2 additions & 1 deletion esm/loadcell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ namespace ESM {
loading process, but are rather loaded later on demand when we are
setting up a specific cell.
*/
struct CellRef
class CellRef
{
public:
int refnum; // Reference number
std::string refID; // ID of object being referenced

Expand Down
2 changes: 1 addition & 1 deletion esm/loadlevlist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct LeveledListBase
// items. Also, some times we don't want to merge lists, just
// overwrite. Figure out a way to give the user this option.

for(int i=0; i<list.size(); i++)
for(size_t i=0; i<list.size(); i++)
{
LevelItem &li = list[i];
li.id = esm.getHNString(recName);
Expand Down
2 changes: 1 addition & 1 deletion esm/loadscpt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct Script
// The tmp buffer is a null-byte separated string list, we
// just have to pick out one string at a time.
char* str = tmp;
for(int i=0; i< varNames.size(); i++)
for(size_t i=0; i< varNames.size(); i++)
{
varNames[i] = std::string(str);
str += varNames[i].size()+1;
Expand Down
3 changes: 2 additions & 1 deletion esm_store/cell_store.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ namespace ESMS
};

/// A storage struct for one single cell reference.
struct CellStore
class CellStore
{
public:
CellStore() : cell (0) {}

const ESM::Cell *cell;
Expand Down
15 changes: 8 additions & 7 deletions game/mwrender/cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ void insertObj(CellRender& cellRender, const ESMS::LiveCellRef<ESM::Light>& live
cellRender.insertBegin (liveRef.ref);

cellRender.insertMesh ("meshes\\" + model);

int color = liveRef.base->data.color;

cellRender.insertLight(color & 255,
(color >> 8) & 255,
(color >> 16) & 255,
liveRef.base->data.radius);

// Extract the color and convert to floating point
const int color = liveRef.base->data.color;
const float r = ((color >> 0) & 0xFF) / 255.0f;
const float g = ((color >> 8) & 0xFF) / 255.0f;
const float b = ((color >> 16) & 0xFF) / 255.0f;
const float radius = float(liveRef.base->data.radius);
cellRender.insertLight(r, g, b, radius);

cellRender.insertEnd();
}
Expand Down
2 changes: 1 addition & 1 deletion game/mwrender/interior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void InteriorCellRender::setAmbientMode()

case 1:

scene.getMgr()->setAmbientLight(0.7*ambientColor + 0.3*ColourValue(1,1,1));
scene.getMgr()->setAmbientLight(0.7f*ambientColor + 0.3f*ColourValue(1,1,1));
break;

case 2:
Expand Down
15 changes: 10 additions & 5 deletions input/func_binder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class FuncBinder
*/
void bind(int index, Action action, const std::string &name="")
{
assert(index >= 0 && index < bindings.size());
assert(index >= 0 && index < (int)bindings.size());

FuncBinding &fb = bindings[index];
fb.action = action;
fb.name = name;
Expand All @@ -65,7 +66,8 @@ class FuncBinder
*/
void unbind(int index)
{
assert(index >= 0 && index < bindings.size());
assert(index >= 0 && index < (int)bindings.size());

bindings[index] = FuncBinding();
}

Expand All @@ -75,22 +77,25 @@ class FuncBinder
*/
void call(int index, const void *p=NULL) const
{
assert(index >= 0 && index < bindings.size());
assert(index >= 0 && index < (int)bindings.size());

const FuncBinding &fb = bindings[index];
if(fb.action) fb.action(index, p);
}

/// Check if a given index is bound to anything
bool isBound(int index) const
{
assert(index >= 0 && index < bindings.size());
assert(index >= 0 && index < (int)bindings.size());

return !bindings[index].action.empty();
}

/// Return the name associated with an action (empty if not bound)
const std::string &getName(int index) const
{
assert(index >= 0 && index < bindings.size());
assert(index >= 0 && index < (int)bindings.size());

return bindings[index].name;
}
};
Expand Down
2 changes: 1 addition & 1 deletion input/listener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace Input
assert(camera);

// Mouse sensitivity. Should be a config option later.
const float MS = 0.2;
const float MS = 0.2f;

float x = arg.state.X.rel * MS;
float y = arg.state.Y.rel * MS;
Expand Down

0 comments on commit 3ed03fe

Please sign in to comment.