unworked logic for lamp

This commit is contained in:
maka70vv 2025-03-03 05:34:48 +06:00
parent 7fa4a74ef0
commit 5c0b7f9761
2 changed files with 16 additions and 24 deletions

View File

@ -131,19 +131,19 @@ void GameObjectManager::initialize() {
cubeForFirstRoomM.activeObjectScreenMeshMutable.RefreshVBO(); cubeForFirstRoomM.activeObjectScreenMeshMutable.RefreshVBO();
cubeForFirstRoomM.inventoryIconTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_M_icon.bmp32")); cubeForFirstRoomM.inventoryIconTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_M_icon.bmp32"));
ActiveObject ao2; ActiveObject lampe;
ao2.name = "lampe"; lampe.name = "lampe";
ao2.activeObjectMesh = ZL::LoadFromTextFile("./lighter.txt"); // Add ZL:: namespace lampe.activeObjectMesh = ZL::LoadFromTextFile("./lighter.txt"); // Add ZL:: namespace
ao2.activeObjectMesh.Scale(7); lampe.activeObjectMesh.Scale(7);
ao2.activeObjectMeshMutable.AssignFrom(ao2.activeObjectMesh); lampe.activeObjectMeshMutable.AssignFrom(lampe.activeObjectMesh);
ao2.activeObjectMeshMutable.RefreshVBO(); lampe.activeObjectMeshMutable.RefreshVBO();
ao2.objectPos = Vector3f{ 85, 30, 43 }; lampe.objectPos = Vector3f{ 85, 30, 43 };
ao2.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./temno.bmp")); lampe.activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./temno.bmp"));
ao2.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./aoscreen01.bmp")); lampe.activeObjectScreenTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("./aoscreen01.bmp"));
ao2.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5); lampe.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5);
ao2.activeObjectScreenMeshMutable.AssignFrom(ao2.activeObjectScreenMesh); lampe.activeObjectScreenMeshMutable.AssignFrom(lampe.activeObjectScreenMesh);
ao2.activeObjectScreenMeshMutable.RefreshVBO(); lampe.activeObjectScreenMeshMutable.RefreshVBO();
ao2.inventoryIconTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_T_icon.bmp32")); lampe.inventoryIconTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_T_icon.bmp32"));
@ -159,12 +159,7 @@ void GameObjectManager::initialize() {
carToy.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5); carToy.activeObjectScreenMesh = CreateRect2D({ 0.f, 0.f }, { 64.f, 64.f }, 0.5);
carToy.activeObjectScreenMeshMutable.AssignFrom(carToy.activeObjectScreenMesh); carToy.activeObjectScreenMeshMutable.AssignFrom(carToy.activeObjectScreenMesh);
carToy.activeObjectScreenMeshMutable.RefreshVBO(); carToy.activeObjectScreenMeshMutable.RefreshVBO();
carToy.inventoryIconTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/cubic_T_icon.bmp32")); carToy.inventoryIconTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp32("./textures/inventory_objects/battery.bmp32"));
Room room_1; Room room_1;
@ -190,7 +185,7 @@ void GameObjectManager::initialize() {
Room room_2; Room room_2;
room_2.roomTexture = std::make_shared<Texture>(CreateTextureDataFromBmp24("./seconroom.bmp")); room_2.roomTexture = std::make_shared<Texture>(CreateTextureDataFromBmp24("./seconroom.bmp"));
room_2.objects.push_back(ao2); room_2.objects.push_back(lampe);
room_2.objects.push_back(carToy); room_2.objects.push_back(carToy);
room_2.sound_name = "unholy-choir-1-279337--online-audio-convert.com.ogg"; room_2.sound_name = "unholy-choir-1-279337--online-audio-convert.com.ogg";
room_2.roomLogic = createRoom2Logic(); room_2.roomLogic = createRoom2Logic();
@ -322,10 +317,7 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
std::cout << highlightedObjects.size() << std::endl; std::cout << highlightedObjects.size() << std::endl;
for (auto* ao : highlightedObjects) { for (auto* ao : highlightedObjects) {
if (ao && ao->name == "lampe") { if (ao && ao->name == "lampe") {
std::cout << "Battery added to the lamp!" << std::endl; ao->activeObjectTexturePtr = std::make_shared<Texture>(CreateTextureDataFromBmp24("base_Base_color_1001.bmp"));
// Здесь можно реализовать включение лампы или другую логику
// Убираем батарейку из инвентаря
gInventoryMap.erase(item->name); gInventoryMap.erase(item->name);
objects_in_inventory--; objects_in_inventory--;
break; break;

BIN
base_Base_color_1001.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 KiB