diff --git a/config.json b/config.json index 5a9724da..89fea016 100644 --- a/config.json +++ b/config.json @@ -14,9 +14,9 @@ "server": { "lobby_name": "Hope you're doing well!", "lobby_broadcast": true, - "max_players": 1, + "max_players": 4, "disable_dm": false, - "skip_intro": true + "skip_intro": false }, "client": { "default_name": "Conan O'Brien", @@ -25,6 +25,6 @@ "draw_bboxes": false, "fps_counter": true, "presentation": false, - "render": 75 + "render": 80 } } diff --git a/include/client/client.hpp b/include/client/client.hpp index 4c3ee6e1..7506f7b1 100644 --- a/include/client/client.hpp +++ b/include/client/client.hpp @@ -278,6 +278,7 @@ class Client { std::unique_ptr lava_vertical_model; std::unique_ptr lava_horizontal_model; std::unique_ptr lightning_model; + std::unique_ptr chest_model; GLFWwindow *window; diff --git a/include/shared/game/sharedmodel.hpp b/include/shared/game/sharedmodel.hpp index 3dafb911..fbd54214 100644 --- a/include/shared/game/sharedmodel.hpp +++ b/include/shared/game/sharedmodel.hpp @@ -44,5 +44,6 @@ enum class ModelType { SunGod, Mirror, LightCut, - TorchPost + TorchPost, + Chest }; \ No newline at end of file diff --git a/src/client/client.cpp b/src/client/client.cpp index 8fd44594..9a6b387a 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -238,6 +238,9 @@ bool Client::init() { auto lava_cross_model_path = env_models_dir / "lava" / "lava_cross.obj"; this->lava_cross_model = std::make_unique(lava_cross_model_path.string(), false); + auto chest_model_path = item_models_dir / "Chest1" / "Chest1 1.obj"; + this->chest_model = std::make_unique(chest_model_path.string(), false); + auto lava_row_model_path = env_models_dir / "lava" / "lava_row.obj"; this->lava_horizontal_model = std::make_unique(lava_row_model_path.string(), false); // thank you openai! @@ -838,7 +841,8 @@ void Client::geometryPass() { sharedObject->type == ObjectType::ArrowTrap || sharedObject->type == ObjectType::SpikeTrap || sharedObject->type == ObjectType::TeleporterTrap || - sharedObject->type == ObjectType::Projectile) + sharedObject->type == ObjectType::Projectile || + sharedObject->modelType == ModelType::Chest) && dist > this->config.client.render / 2) { continue; } @@ -853,7 +857,8 @@ void Client::geometryPass() { sharedObject->type == ObjectType::ArrowTrap || sharedObject->type == ObjectType::SpikeTrap || sharedObject->type == ObjectType::Projectile || - sharedObject->type == ObjectType::Torchlight) // dont render post from far away + sharedObject->type == ObjectType::Torchlight || // light post + sharedObject->modelType == ModelType::Chest) && dist > this->config.client.render) { continue; } @@ -1164,14 +1169,7 @@ void Client::geometryPass() { } case ObjectType::Potion: { if (!sharedObject->iteminfo->held && !sharedObject->iteminfo->used) { - Model* model = this->item_model.get(); - if (sharedObject->modelType == ModelType::HealthPotion) { - model = this->item_model.get(); - } else if (sharedObject->modelType == ModelType::NauseaPotion || sharedObject->modelType == ModelType::InvincibilityPotion) { - model = this->item_model.get(); - } else if (sharedObject->modelType == ModelType::InvisibilityPotion) { - model = this->item_model.get(); - } + Model* model = this->chest_model.get(); model->setDimensions(sharedObject->physics.dimensions); model->translateAbsolute(sharedObject->physics.getCenterPosition()); @@ -1183,20 +1181,9 @@ void Client::geometryPass() { } case ObjectType::Spell: { if (!sharedObject->iteminfo->held && !sharedObject->iteminfo->used) { - glm::vec3 color; - if (sharedObject->modelType == ModelType::FireSpell) { - color = glm::vec3(0.9f, 0.1f, 0.0f); - } - else if (sharedObject->modelType == ModelType::HealSpell) { - color = glm::vec3(1.0f, 1.0f, 0.0f); - } - else { - color = glm::vec3(0.8f, 0.7f, 0.6f); - } - - this->item_model->setDimensions(sharedObject->physics.dimensions); - this->item_model->translateAbsolute(sharedObject->physics.getCenterPosition()); - this->item_model->draw(this->deferred_geometry_shader.get(), + this->chest_model->setDimensions(sharedObject->physics.dimensions); + this->chest_model->translateAbsolute(sharedObject->physics.getCenterPosition()); + this->chest_model->draw(this->deferred_geometry_shader.get(), this->cam->getPos(), true); } @@ -1224,9 +1211,9 @@ void Client::geometryPass() { } case ObjectType::Weapon: { if (!sharedObject->iteminfo->held && !sharedObject->iteminfo->used) { - this->item_model->setDimensions(sharedObject->physics.dimensions); - this->item_model->translateAbsolute(sharedObject->physics.getCenterPosition()); - this->item_model->draw(this->deferred_geometry_shader.get(), + this->chest_model->setDimensions(sharedObject->physics.dimensions); + this->chest_model->translateAbsolute(sharedObject->physics.getCenterPosition()); + this->chest_model->draw(this->deferred_geometry_shader.get(), this->cam->getPos(), true); } @@ -1259,9 +1246,9 @@ void Client::geometryPass() { } case ObjectType::Mirror: { if (!sharedObject->iteminfo->held && !sharedObject->iteminfo->used) { - this->item_model->setDimensions(sharedObject->physics.dimensions); - this->item_model->translateAbsolute(sharedObject->physics.getCenterPosition()); - this->item_model->draw(this->deferred_geometry_shader.get(), + this->chest_model->setDimensions(sharedObject->physics.dimensions); + this->chest_model->translateAbsolute(sharedObject->physics.getCenterPosition()); + this->chest_model->draw(this->deferred_geometry_shader.get(), this->cam->getPos(), true); } diff --git a/src/server/game/item.cpp b/src/server/game/item.cpp index 985af95f..8b82618c 100644 --- a/src/server/game/item.cpp +++ b/src/server/game/item.cpp @@ -6,7 +6,7 @@ /* Constructors and Destructors */ Item::Item(ObjectType type, bool movable, glm::vec3 corner, ModelType model, glm::vec3 dimensions): - Object(type, Physics(movable, Collider::Box, corner, dimensions), ModelType::Cube), + Object(type, Physics(movable, Collider::Box, corner, dimensions), ModelType::Chest), iteminfo(SharedItemInfo{ .held = false, .used = false }) {} diff --git a/src/server/game/object.cpp b/src/server/game/object.cpp index d3f73eb0..723b6522 100644 --- a/src/server/game/object.cpp +++ b/src/server/game/object.cpp @@ -56,7 +56,8 @@ std::unordered_map Object::models ({ {ModelType::FloorSpikeHorizontal, FLOOR_SPIKE_DIMENSIONS}, {ModelType::FloorSpikeVertical, FLOOR_SPIKE_DIMENSIONS}, {ModelType::Lightning, glm::vec3(3.0f, 100.0f, 3.0f)}, - {ModelType::Orb, glm::vec3(0.887116, 0.941508, 0.950092)} + {ModelType::Orb, glm::vec3(0.887116, 0.941508, 0.950092)}, + {ModelType::Chest, glm::vec3(1.377020, 1.355794, 1.092905)} }); /* SharedGameState generation */