Skip to content

Commit

Permalink
{value}, Lua: field & full user data assignment
Browse files Browse the repository at this point in the history
- initialiser lists reformatted { 1, 2, 3 } -> {1, 2, 3}
- ozEngine
  * Lua
    + field = field assignment
    + full user data assignment
  • Loading branch information
ducakar committed Dec 5, 2015
1 parent 2a7945d commit ec65d8d
Show file tree
Hide file tree
Showing 50 changed files with 470 additions and 371 deletions.
8 changes: 4 additions & 4 deletions src/builder/BSP.cc
Expand Up @@ -242,10 +242,10 @@ void BSP::load()
model.title = entityConfig["title"].get("");

static const EnumMap<EntityClass::Type> entityMap = {
{ EntityClass::STATIC, "STATIC" },
{ EntityClass::MOVER, "MOVER" },
{ EntityClass::DOOR, "DOOR" },
{ EntityClass::PORTAL, "PORTAL" }
{EntityClass::STATIC, "STATIC"},
{EntityClass::MOVER, "MOVER" },
{EntityClass::DOOR, "DOOR" },
{EntityClass::PORTAL, "PORTAL"}
};

model.type = entityMap[entityConfig["type"].get("")];
Expand Down
8 changes: 4 additions & 4 deletions src/builder/Compiler.cc
Expand Up @@ -454,7 +454,7 @@ void Compiler::end()
case POLYGON: {
OZ_ASSERT(vertNum >= 3);

int last[2] = { 0, 1 };
int last[2] = {0, 1};
int top = vertNum - 1;
int bottom = 2;

Expand Down Expand Up @@ -657,21 +657,21 @@ void Compiler::positionKey(const Point& pos, float time)
{
OZ_ASSERT(environment == CHANNEL);

channel.positionKeys.add(Animation::PositionKey{ pos, time });
channel.positionKeys.add(Animation::PositionKey{pos, time});
}

void Compiler::rotationKey(const Quat& rot, float time)
{
OZ_ASSERT(environment == CHANNEL);

channel.rotationKeys.add(Animation::RotationKey{ rot, time });
channel.rotationKeys.add(Animation::RotationKey{rot, time});
}

void Compiler::scalingKey(const Vec3& scale, float time)
{
OZ_ASSERT(environment == CHANNEL);

channel.scalingKeys.add(Animation::ScalingKey{ scale, time });
channel.scalingKeys.add(Animation::ScalingKey{scale, time});
}

void Compiler::writeModel(Stream* os, bool globalTextures)
Expand Down
8 changes: 4 additions & 4 deletions src/builder/Terra.cc
Expand Up @@ -38,8 +38,8 @@ void Terra::load()
}

EnumMap<int> liquidMap = {
{ Medium::WATER_BIT | Medium::SEA_BIT, "WATER" },
{ Medium::LAVA_BIT | Medium::SEA_BIT, "LAVA" }
{Medium::WATER_BIT | Medium::SEA_BIT, "WATER"},
{Medium::LAVA_BIT | Medium::SEA_BIT, "LAVA" }
};

detailTex = config["detailTexture"].get("");
Expand Down Expand Up @@ -103,8 +103,8 @@ void Terra::load()
};

static const EnumMap<TerraBuilder::Module> controlMap = {
{ TerraBuilder::COMBINER, "combiner" },
{ TerraBuilder::PLAINS, "plains" },
{TerraBuilder::COMBINER, "combiner"},
{TerraBuilder::PLAINS, "plains" },
};

for (int i = 0; i < Arrays::length(MODULE_NAMES); ++i) {
Expand Down
2 changes: 1 addition & 1 deletion src/client/Caelum.cc
Expand Up @@ -27,7 +27,7 @@ namespace oz
namespace client
{

const char* const Caelum::SKYBOX_FACES[] = { "+x", "-x", "+y", "-y", "+z", "-z" };
const char* const Caelum::SKYBOX_FACES[] = {"+x", "-x", "+y", "-y", "+z", "-z"};
const Vec4 Caelum::GLOBAL_AMBIENT_COLOUR = Vec4(0.12f, 0.12f, 0.15f, 1.00f);

const float Caelum::DAY_BIAS = 0.40f;
Expand Down
2 changes: 1 addition & 1 deletion src/client/Context.cc
Expand Up @@ -218,7 +218,7 @@ Context::ContSource* Context::addContSource(int sound, int key)
alSourcei(srcId, AL_BUFFER, sounds[sound].handle);

++sounds[sound].nUsers;
return &contSources.add(key, ContSource{ srcId, sound, true }).value;
return &contSources.add(key, ContSource{srcId, sound, true}).value;
}

void Context::removeContSource(ContSource* contSource, int key)
Expand Down
40 changes: 20 additions & 20 deletions src/client/MD2.cc
Expand Up @@ -27,26 +27,26 @@ namespace client
const MD2::AnimInfo MD2::ANIM_LIST[] =
{
// first, last, frequency (FPS), nextAnim
{ 0, 39, 9.0f, ANIM_STAND }, // STAND
{ 40, 45, 10.0f, ANIM_RUN }, // RUN
{ 46, 53, 16.0f, ANIM_ATTACK }, // ATTACK
{ 54, 57, 7.0f, ANIM_STAND }, // PAIN_A
{ 58, 61, 7.0f, ANIM_STAND }, // PAIN_B
{ 62, 65, 7.0f, ANIM_STAND }, // PAIN_C
{ 67, 67, 9.0f, ANIM_NONE }, // JUMP
{ 72, 83, 7.0f, ANIM_STAND }, // FLIP
{ 84, 94, 7.0f, ANIM_STAND }, // SALUTE
{ 95, 111, 10.0f, ANIM_STAND }, // WAVE
{ 112, 122, 7.0f, ANIM_STAND }, // FALLBACK
{ 123, 134, 6.0f, ANIM_STAND }, // POINT
{ 135, 153, 10.0f, ANIM_CROUCH_STAND }, // CROUCH_STAND
{ 154, 159, 7.0f, ANIM_CROUCH_WALK }, // CROUCH_WALK
{ 160, 168, 18.0f, ANIM_CROUCH_ATTACK }, // CROUCH_ATTACK
{ 169, 172, 7.0f, ANIM_CROUCH_STAND }, // CROUCH_PAIN
{ 173, 177, 5.0f, ANIM_NONE }, // CROUCH_DEATH
{ 178, 183, 7.0f, ANIM_NONE }, // DEATH_FALLBACK
{ 184, 189, 7.0f, ANIM_NONE }, // DEATH_FALLFORWARD
{ 190, 197, 7.0f, ANIM_NONE } // DEATH_FALLBACKSLOW
{ 0, 39, 9.0f, ANIM_STAND }, // STAND
{ 40, 45, 10.0f, ANIM_RUN }, // RUN
{ 46, 53, 16.0f, ANIM_ATTACK }, // ATTACK
{ 54, 57, 7.0f, ANIM_STAND }, // PAIN_A
{ 58, 61, 7.0f, ANIM_STAND }, // PAIN_B
{ 62, 65, 7.0f, ANIM_STAND }, // PAIN_C
{ 67, 67, 9.0f, ANIM_NONE }, // JUMP
{ 72, 83, 7.0f, ANIM_STAND }, // FLIP
{ 84, 94, 7.0f, ANIM_STAND }, // SALUTE
{ 95, 111, 10.0f, ANIM_STAND }, // WAVE
{112, 122, 7.0f, ANIM_STAND }, // FALLBACK
{123, 134, 6.0f, ANIM_STAND }, // POINT
{135, 153, 10.0f, ANIM_CROUCH_STAND }, // CROUCH_STAND
{154, 159, 7.0f, ANIM_CROUCH_WALK }, // CROUCH_WALK
{160, 168, 18.0f, ANIM_CROUCH_ATTACK}, // CROUCH_ATTACK
{169, 172, 7.0f, ANIM_CROUCH_STAND }, // CROUCH_PAIN
{173, 177, 5.0f, ANIM_NONE }, // CROUCH_DEATH
{178, 183, 7.0f, ANIM_NONE }, // DEATH_FALLBACK
{184, 189, 7.0f, ANIM_NONE }, // DEATH_FALLFORWARD
{190, 197, 7.0f, ANIM_NONE } // DEATH_FALLBACKSLOW
};

const float MD2::AnimState::MIN_SHOT_INTERVAL_SYNC = 0.2f;
Expand Down
12 changes: 6 additions & 6 deletions src/client/Model.cc
Expand Up @@ -89,7 +89,7 @@ void Model::addSceneLights()
transf = node->transf ^ transf;
}

sceneLights.add(LightEntry{ &light, transf, 0.0f });
sceneLights.add(LightEntry{&light, transf, 0.0f});
}
}

Expand Down Expand Up @@ -365,7 +365,7 @@ void Model::schedule(int mesh, QueueType queue)
addSceneLights();
}

list.add(Instance{ this, tf.model, tf.colour, mesh, 0, 0, 0.0f });
list.add(Instance{this, tf.model, tf.colour, mesh, 0, 0, 0.0f});
}

void Model::scheduleFrame(int mesh, int frame, QueueType queue)
Expand All @@ -376,7 +376,7 @@ void Model::scheduleFrame(int mesh, int frame, QueueType queue)
addSceneLights();
}

list.add(Instance{ this, tf.model, tf.colour, mesh, frame, 0, 0.0f });
list.add(Instance{this, tf.model, tf.colour, mesh, frame, 0, 0.0f});
}

void Model::scheduleAnimated(int mesh, int firstFrame, int secondFrame, float interpolation,
Expand All @@ -388,7 +388,7 @@ void Model::scheduleAnimated(int mesh, int firstFrame, int secondFrame, float in
addSceneLights();
}

list.add(Instance{ this, tf.model, tf.colour, mesh, firstFrame, secondFrame, interpolation });
list.add(Instance{this, tf.model, tf.colour, mesh, firstFrame, secondFrame, interpolation});
}

const File* Model::preload()
Expand Down Expand Up @@ -648,7 +648,7 @@ void Model::load()
}
}

loadedModels.include(Ref{ this });
loadedModels.include(Ref{this});

delete preloadData;
preloadData = nullptr;
Expand Down Expand Up @@ -705,7 +705,7 @@ void Model::unload()
ibo = 0;
vbo = 0;

loadedModels.exclude(Ref{ this });
loadedModels.exclude(Ref{this});

OZ_GL_CHECK_ERROR();
}
Expand Down
10 changes: 5 additions & 5 deletions src/client/Render.cc
Expand Up @@ -417,7 +417,7 @@ void Render::drawOrbis()
glBindFramebuffer(GL_FRAMEBUFFER, mainFrame);

#ifndef OZ_GL_ES
uint dbos[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };
uint dbos[] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1};
glDrawBuffers(2, dbos);
#endif
}
Expand Down Expand Up @@ -769,13 +769,13 @@ void Render::init()
shape.init();

EnumMap<GLenum> scaleFilterMap = {
{ GL_LINEAR, "LINEAR" },
{ GL_NEAREST, "NEAREST" }
{GL_LINEAR, "LINEAR" },
{GL_NEAREST, "NEAREST"}
};

EnumMap<Model::Collation> collationMap = {
{ Model::DEPTH_MAJOR, "DEPTH_MAJOR" },
{ Model::MODEL_MAJOR, "MODEL_MAJOR" }
{Model::DEPTH_MAJOR, "DEPTH_MAJOR"},
{Model::MODEL_MAJOR, "MODEL_MAJOR"}
};

Model::setCollation(collationMap[config.include("render.collation", "MODEL_MAJOR").get("")]);
Expand Down
10 changes: 5 additions & 5 deletions src/client/Shader.cc
Expand Up @@ -109,8 +109,8 @@ void Shader::compileShader(uint shaderId, const String& defines, const File& fil
{
Stream is = file.read();

const char* strings[] = { defines.begin(), is.begin() };
int lengths[] = { defines.length(), is.available() };
const char* strings[] = {defines.begin(), is.begin()};
int lengths[] = {defines.length(), is.available()};
int result;
int logLength;

Expand Down Expand Up @@ -316,7 +316,7 @@ void Shader::init()
OZ_GL_CHECK_ERROR();

// Bind white texture to id 0 to emulate fixed functionality that has white texture on id 0.
ubyte whitePixel[] = { 0xff, 0xff, 0xff };
ubyte whitePixel[] = {0xff, 0xff, 0xff};

glGenTextures(1, &defaultTexture);
glBindTexture(GL_TEXTURE_2D, defaultTexture);
Expand All @@ -325,7 +325,7 @@ void Shader::init()
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, whitePixel);

// Default masks: specular 0.0, emission 0.0, environment 0.0.
ubyte masksPixel[] = { 0x00, 0x00, 0x00 };
ubyte masksPixel[] = {0x00, 0x00, 0x00};

glGenTextures(1, &defaultMasks);
glBindTexture(GL_TEXTURE_2D, defaultMasks);
Expand All @@ -334,7 +334,7 @@ void Shader::init()
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, masksPixel);

// Default normal for bumpmap: [0, 0, 1].
ubyte normalsPixel[] = { 0x80, 0x80, 0xff, 0x80 };
ubyte normalsPixel[] = {0x80, 0x80, 0xff, 0x80};

glGenTextures(1, &defaultNormals);
glBindTexture(GL_TEXTURE_2D, defaultNormals);
Expand Down

0 comments on commit ec65d8d

Please sign in to comment.