diff --git a/Assets/Scripts/Gui/main.lua b/Assets/Scripts/Gui/main.lua index 3436c20..4494797 100644 --- a/Assets/Scripts/Gui/main.lua +++ b/Assets/Scripts/Gui/main.lua @@ -30,10 +30,12 @@ ListboxType = { CONTROLS = 0, RESOLUTION = 1, MAPS = 2, - UNITS = 3, - SKYBOX_TEXTURES = 4, - LAND_TEXTURES = 5, - CPU_DIFFICULTIES = 6, - FACTIONS = 7, - CONSOLE = 8 + VEHICLES = 3, + STRUCTURES = 4, + RESOURCE_DEPOSITS = 5, + SKYBOX_TEXTURES = 6, + LAND_TEXTURES = 7, + CPU_DIFFICULTIES = 8, + FACTIONS = 9, + CONSOLE = 10 } diff --git a/Assets/Scripts/Gui/mapEditor.lua b/Assets/Scripts/Gui/mapEditor.lua index 07161aa..a462588 100644 --- a/Assets/Scripts/Gui/mapEditor.lua +++ b/Assets/Scripts/Gui/mapEditor.lua @@ -1,4 +1,4 @@ -numGui = 5 +numGui = 6 Size = {x = 140, y = 20} startX = 100 @@ -14,29 +14,34 @@ gui = { pos = {x = startX + Size.x + 10, y = 400}, size = Size, guiType = GuiType.LISTBOX, - listboxType = ListboxType.UNITS, - vehicles = true, + listboxType = ListboxType.VEHICLES, numMaxDisplay = 5 }, { pos = {x = startX + 2 * (Size.x + 10), y = 400}, size = Size, guiType = GuiType.LISTBOX, - listboxType = ListboxType.UNITS, - vehicles = false, + listboxType = ListboxType.STRUCTURES, numMaxDisplay = 5 }, { pos = {x = startX + 3 * (Size.x + 10), y = 400}, size = Size, guiType = GuiType.LISTBOX, - listboxType = ListboxType.SKYBOX_TEXTURES, + listboxType = ListboxType.RESOURCE_DEPOSITS, numMaxDisplay = 5 }, { pos = {x = startX + 4 * (Size.x + 10), y = 400}, size = Size, guiType = GuiType.LISTBOX, + listboxType = ListboxType.SKYBOX_TEXTURES, + numMaxDisplay = 5 + }, + { + pos = {x = startX + 5 * (Size.x + 10), y = 400}, + size = Size, + guiType = GuiType.LISTBOX, listboxType = ListboxType.LAND_TEXTURES, numMaxDisplay = 5 } diff --git a/Assets/Scripts/projectileData.lua b/Assets/Scripts/projectileData.lua index 26acd8e..0301ded 100644 --- a/Assets/Scripts/projectileData.lua +++ b/Assets/Scripts/projectileData.lua @@ -1,242 +1,244 @@ -numberOfTypesOfWeapons = 2 -g = 2.2 -speed = { - { - {10,10,10,10,10,10,10,10,10,10,10} - }, - { - {10,10,10,10,10,10,10,10,10,10,10} - }, - { - {10, 10, 10, 10} - }, - { - {10, 10, 10, 10} - }, - { - {5,5} - }, - { - {7,7,7,7,7} - }, - {}, - {}, - {.05}, - { - {.1, .1}, - {.1, .1} - } -} -length = { - { - {1,1,1,1,1,1,1,1,1,1,1,1,1} - }, - { - {1,1,1,1,1,1,1,1,1,1,1,1,1} - }, - { - {1,1,1,1} - }, - { - {1,1,1,1} - }, - { - {1,1} - }, - { - {1,1,1,1,1} - }, - {}, - {}, - { - {.5} - }, - { - {1,1}, - {1,1} - }, - {} -} -scale = { - { - {1, 1, 1, .5, .5, .5, .5, .5, .5, .5, .5, .5, .5} - }, - { - {1, 1, 1, .23, .23, .23, .23, .23, .23, .23, .23, .23, .23} - }, - { - {.45, .45, .45, .45} - }, - { - {.5, .5, .5, .5} - }, - { - {.95, .95} - }, - { - {.6, .6, .6, .6, .6} - } -} -pos = { - { - { - {x = 0, y = 0, z = 1.05}, - {x = 0, y = 0, z = 1.05}, - {x = 0, y = 0, z = 1.05}, - {x = 0, y = 0, z = 1.5}, - {x = 0, y = 0, z = 2.5}, - {x = 0, y = 0, z = 2.5}, - {x = 0, y = 0, z = 2.5}, - {x = 0, y = 0, z = 2.5}, - {x = 0, y = 0, z = 2.5}, - {x = 0, y = 0, z = 2.5}, - {x = 0, y = 0, z = 2.5}, - {x = 0, y = 0, z = 2.5}, - {x = 0, y = 0, z = 2.5} - } - }, - { - { - {x = 0, y = 0, z = 0.79254}, - {x = 0, y = 0, z = 0.79254}, - {x = 0, y = 0, z = 0.79254}, - {x = 0, y = 0, z = 0.17723}, - {x = 0, y = 0, z = 0.17723}, - {x = 0, y = 0, z = 0.17723}, - {x = 0, y = 0, z = 0.17723}, - {x = 0, y = 0, z = 0.17723}, - {x = 0, y = 0, z = 0.17723}, - {x = 0, y = 0, z = 0.17723}, - {x = 0, y = 0, z = 0.17723}, - {x = 0, y = 0, z = 0.17723}, - {x = 0, y = 0, z = 0.17723} - } - }, - { - { - {x = 0, y = 0, z = -0.36178}, - {x = 0, y = 0, z = -0.36178}, - {x = 0, y = 0, z = -0.36178}, - {x = 0, y = 0, z = -0.36178} - }, - {x = 0, y = -3, z = 0} - }, - { - { - {x = 0, y = 0, z = -0.30074}, - {x = 0, y = 0, z = -0.30074}, - {x = 0, y = 0, z = -0.30074}, - {x = 0, y = 0, z = -0.30074} - }, - {x = 0, y = -2, z = 0} - }, - { - { - {x = 0, y = 0, z = -0.62118}, - {x = 0, y = 0, z = -0.62118} - }, - { - {x = 0.24482, y = 1.14985, z = 1.32775}, - {x = 0.24482, y = 1.14985, z = 1.62698}, - {x = 0.24482, y = 1.14985, z = 1.88017}, - {x = -0.24482, y = 1.14985, z = 1.32775}, - {x = -0.24482, y = 1.14985, z = 1.62698}, - {x = -0.24482, y = 1.14985, z = 1.88017} - } - }, - { - { - {x = 0, y = 0, z = -0.59117}, - {x = 0, y = 0, z = -0.59117}, - {x = 0, y = 0, z = -0.59117}, - {x = 0, y = 0, z = -0.59117}, - {x = 0, y = 0, z = -0.59117} - }, - {{x = 0.17192, y = 0.57858, z = 0.64471}, {x = -0.17192, y = 0.57858, z = 0.64471}} - }, - {}, - {}, - { - {x = 0, y =-.3, z =-1.5} - }, - { - { - {x = -.25, y =0, z =0}, - {x = .25, y =0, z =0} - }, - { - {x = -.25, y =0, z =0}, - {x = .25, y =0, z =0} - } - }, - {} -} -damage = { - { - {50, 50, 50, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10} - }, - { - {50, 50, 50, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10} - }, - { - {50,50,50,50}, - {50} - }, - { - {50,50,50,50}, - {50} - }, - { - {10,10}, - {} - }, - { - {10,10,10,10,10}, - {} - }, - {}, - {}, - { - {} - }, - { - {50,50}, - {50,50} - }, - {} -} -projectileName = { - {"shell"}, - {"shell"}, - {"shell"}, - {"shell"}, - {"shell","guidedMissile"}, - {"shell","guidedMissile"}, - {""}, - {""}, - {"torpedo"}, - {"missile","missile"}, -} -meshPath = { - {PATH .. "Models/Shell/shell.x"}, - {PATH .. "Models/Shell/shell.x"}, - {PATH .. "Models/Shell/shell.x", PATH .. "Models/Depth charge/depthCharge.x"}, - {PATH .. "Models/Shell/shell.x", PATH .. "Models/Depth charge/depthCharge.x"}, - {PATH .. "Models/Shell/shell.x", PATH .. "Models/Guided missile/guidedMissile.x"}, - {PATH .. "Models/Shell/shell.x", PATH .. "Models/Guided missile/guidedMissile.x"}, - {}, - {}, - {PATH .. "Models/Torpedo/torpedo.x"}, - {PATH .. "Models/Jets/aam.x", PATH .. "Models/Jets/awm.x"} -} -diffuseMapTextPath = { - {}, - {}, - {}, - {}, - {}, - {}, - {}, - {}, - {} +projectiles = { + numberOfTypesOfWeapons = 2, + g = 2.2, + speed = { + { + {10,10,10,10,10,10,10,10,10,10,10} + }, + { + {10,10,10,10,10,10,10,10,10,10,10} + }, + { + {10, 10, 10, 10} + }, + { + {10, 10, 10, 10} + }, + { + {5,5} + }, + { + {7,7,7,7,7} + }, + {}, + {}, + {.05}, + { + {.1, .1}, + {.1, .1} + } + }, + length = { + { + {1,1,1,1,1,1,1,1,1,1,1,1,1} + }, + { + {1,1,1,1,1,1,1,1,1,1,1,1,1} + }, + { + {1,1,1,1} + }, + { + {1,1,1,1} + }, + { + {1,1} + }, + { + {1,1,1,1,1} + }, + {}, + {}, + { + {.5} + }, + { + {1,1}, + {1,1} + }, + {} + }, + scale = { + { + {1, 1, 1, .5, .5, .5, .5, .5, .5, .5, .5, .5, .5} + }, + { + {1, 1, 1, .23, .23, .23, .23, .23, .23, .23, .23, .23, .23} + }, + { + {.45, .45, .45, .45} + }, + { + {.5, .5, .5, .5} + }, + { + {.95, .95} + }, + { + {.6, .6, .6, .6, .6} + } + }, + pos = { + { + { + {x = 0, y = 0, z = 1.05}, + {x = 0, y = 0, z = 1.05}, + {x = 0, y = 0, z = 1.05}, + {x = 0, y = 0, z = 1.5}, + {x = 0, y = 0, z = 2.5}, + {x = 0, y = 0, z = 2.5}, + {x = 0, y = 0, z = 2.5}, + {x = 0, y = 0, z = 2.5}, + {x = 0, y = 0, z = 2.5}, + {x = 0, y = 0, z = 2.5}, + {x = 0, y = 0, z = 2.5}, + {x = 0, y = 0, z = 2.5}, + {x = 0, y = 0, z = 2.5} + } + }, + { + { + {x = 0, y = 0, z = 0.79254}, + {x = 0, y = 0, z = 0.79254}, + {x = 0, y = 0, z = 0.79254}, + {x = 0, y = 0, z = 0.17723}, + {x = 0, y = 0, z = 0.17723}, + {x = 0, y = 0, z = 0.17723}, + {x = 0, y = 0, z = 0.17723}, + {x = 0, y = 0, z = 0.17723}, + {x = 0, y = 0, z = 0.17723}, + {x = 0, y = 0, z = 0.17723}, + {x = 0, y = 0, z = 0.17723}, + {x = 0, y = 0, z = 0.17723}, + {x = 0, y = 0, z = 0.17723} + } + }, + { + { + {x = 0, y = 0, z = -0.36178}, + {x = 0, y = 0, z = -0.36178}, + {x = 0, y = 0, z = -0.36178}, + {x = 0, y = 0, z = -0.36178} + }, + {x = 0, y = -3, z = 0} + }, + { + { + {x = 0, y = 0, z = -0.30074}, + {x = 0, y = 0, z = -0.30074}, + {x = 0, y = 0, z = -0.30074}, + {x = 0, y = 0, z = -0.30074} + }, + {x = 0, y = -2, z = 0} + }, + { + { + {x = 0, y = 0, z = -0.62118}, + {x = 0, y = 0, z = -0.62118} + }, + { + {x = 0.24482, y = 1.14985, z = 1.32775}, + {x = 0.24482, y = 1.14985, z = 1.62698}, + {x = 0.24482, y = 1.14985, z = 1.88017}, + {x = -0.24482, y = 1.14985, z = 1.32775}, + {x = -0.24482, y = 1.14985, z = 1.62698}, + {x = -0.24482, y = 1.14985, z = 1.88017} + } + }, + { + { + {x = 0, y = 0, z = -0.59117}, + {x = 0, y = 0, z = -0.59117}, + {x = 0, y = 0, z = -0.59117}, + {x = 0, y = 0, z = -0.59117}, + {x = 0, y = 0, z = -0.59117} + }, + {{x = 0.17192, y = 0.57858, z = 0.64471}, {x = -0.17192, y = 0.57858, z = 0.64471}} + }, + {}, + {}, + { + {x = 0, y =-.3, z =-1.5} + }, + { + { + {x = -.25, y =0, z =0}, + {x = .25, y =0, z =0} + }, + { + {x = -.25, y =0, z =0}, + {x = .25, y =0, z =0} + } + }, + {} + }, + damage = { + { + {50, 50, 50, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10} + }, + { + {50, 50, 50, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10} + }, + { + {50,50,50,50}, + {50} + }, + { + {50,50,50,50}, + {50} + }, + { + {10,10}, + {} + }, + { + {10,10,10,10,10}, + {} + }, + {}, + {}, + { + {} + }, + { + {50,50}, + {50,50} + }, + {} + }, + projectileName = { + {"shell"}, + {"shell"}, + {"shell"}, + {"shell"}, + {"shell","guidedMissile"}, + {"shell","guidedMissile"}, + {""}, + {""}, + {"torpedo"}, + {"missile","missile"}, + }, + meshPath = { + {PATH .. "Models/Shell/shell.x"}, + {PATH .. "Models/Shell/shell.x"}, + {PATH .. "Models/Shell/shell.x", PATH .. "Models/Depth charge/depthCharge.x"}, + {PATH .. "Models/Shell/shell.x", PATH .. "Models/Depth charge/depthCharge.x"}, + {PATH .. "Models/Shell/shell.x", PATH .. "Models/Guided missile/guidedMissile.x"}, + {PATH .. "Models/Shell/shell.x", PATH .. "Models/Guided missile/guidedMissile.x"}, + {}, + {}, + {PATH .. "Models/Torpedo/torpedo.x"}, + {PATH .. "Models/Jets/aam.x", PATH .. "Models/Jets/awm.x"} + }, + diffuseMapTextPath = { + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {} + } } diff --git a/Assets/Scripts/resourceData.lua b/Assets/Scripts/resourceData.lua new file mode 100644 index 0000000..d32b225 --- /dev/null +++ b/Assets/Scripts/resourceData.lua @@ -0,0 +1,13 @@ +resources = { + num = 1, + + meshPath = { + "resource.xml" + }, + name = { + "Resource", + }, + basePath = { + PATH .. 'Models/Resources/' + } +} diff --git a/Assets/Scripts/unitData.lua b/Assets/Scripts/unitData.lua index eff811b..dd8e518 100644 --- a/Assets/Scripts/unitData.lua +++ b/Assets/Scripts/unitData.lua @@ -1,278 +1,280 @@ -numUnits = 4 +UnitClass = {VESSEL = 0, ENGINEER = 1, SAMPLE_STRUCTURE = 2} +UnitType = {UNDERWATER = 0, SEA_LEVEL = 1, HOVER = 2, LAND = 3, AIR = 4} -UnitClass = {VESSEL = 0, ENGINEER = 1, SAMPLE_STRUCTURE = 2}; - -UnitType = {UNDERWATER = 0, SEA_LEVEL = 1, HOVER = 2, LAND = 3, AIR = 4}; - -unitClass = { - UnitClass.VESSEL, UnitClass.VESSEL, - UnitClass.ENGINEER, UnitClass.SAMPLE_STRUCTURE -}; - -unitType = { - UnitType.HOVER, UnitType.SEA_LEVEL, - UnitType.LAND, UnitType.HOVER -} - -isVehicle = { - true, true, true, false -}; - -health = {500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500} -cost = {500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500} -range = {15, 15, 14, 14, 13, 13, 12, 12, 15, 25} - -unitCornerPoints = { - { - {x = .9, y = -1, z = -6}, - {x = -.9, y = -1, z = -6}, - {x = -.9, y = -1, z = 5.8}, - {x = .9, y = -1, z = 5.8}, - {x = .9, y = 3.5, z = -6}, - {x = -.9, y = 3.5, z = -6}, - {x = -.9, y = 3.5, z = 5.8}, - {x = .9, y = 3.5, z = 5.8} - }, - { - {x = .5, y = -.5, z = -7.05}, - {x = -.5, y = -.5, z = -7.05}, - {x = -.5, y = -.5, z = 6.4}, - {x = .5, y = -.5, z = 6.4}, - {x = .5, y = 3, z = -7.05}, - {x = -.5, y = 3, z = -7.05}, - {x = -.5, y = 3, z = 6.4}, - {x = .5, y = 3, z = 6.4} - }, - { - {x = .5, y = -.5, z = -3.4}, - {x = -.5, y = -.5, z = -3.4}, - {x = -.5, y = -.5, z = 3.4}, - {x = .5, y = -.4, z = 3.4}, - {x = .5, y = 2.1, z = -3.4}, - {x = -.5, y = 2, z = -3.4}, - {x = -.5, y = 2, z = 3.4}, - {x = .5, y = 2, z = 3.4} - }, - { - {x = 1, y = -.25, z = -1}, - {x = -1, y = -.25, z = -1}, - {x = -1, y = -.25, z = 1}, - {x = 1, y = -.25, z = 1}, - {x = 1, y = .8, z = -1}, - {x = -1, y = .8, z = -1}, - {x = -1, y = .8, z = 1}, - {x = 1, y = .8, z = 1} - }, - { - {x = .7, y = -.3, z = -4}, - {x = -.7, y = -.3, z = -4}, - {x = -.7, y = -.3, z = 3.4}, - {x = .7, y = -.3, z = 3.4}, - {x = .7, y = 2.9, z = -4}, - {x = -.7, y = 2.9, z = -4}, - {x = -.7, y = 2.9, z = 3.4}, - {x = .7, y = 2.9, z = 3.4} - }, - { - {x = .5, y = -.5, z = -6.1}, - {x = -.5, y = -.5, z = -6.1}, - {x = -.5, y = -.5, z = 5.2}, - {x = .5, y = -.5, z = 5.2}, - {x = .5, y = 2.2, z = -6.1}, - {x = -.5, y = 2.2, z = -6.1}, - {x = -.5, y = 2.2, z = 5.2}, - {x = .5, y = 2.2, z = 5.2} - }, - { - {x = 2, y = -.5, z = -10}, - {x = -2, y = -.5, z = -10}, - {x = -2, y = -.5, z = 9}, - {x = 2, y = -.5, z = 9}, - {x = 2, y = 5.5, z = -10}, - {x = -2, y = 5.5, z = -10}, - {x = -2, y = 5.5, z = 9}, - {x = 2, y = 5.5, z = 9} - }, - { - {x = 2, y = -1, z = -10}, - {x = -2, y = -1, z = -10}, - {x = -2, y = -1, z = 9}, - {x = 2, y = -1, z = 9}, - {x = 2, y = 4.5, z = -10}, - {x = -2, y = 4.5, z = -10}, - {x = -2, y = 4.5, z = 9}, - {x = 2, y = 4.5, z = 9} - }, - { - {x = .25, y = -.5, z = -2}, - {x = -.25, y = -.5, z = -2}, - {x = -.25, y = -.5, z = 3}, - {x = .25, y = -.5, z = 3}, - {x = .25, y = .7, z = -2}, - {x = -.25, y = .7, z = -2}, - {x = -.25, y = .7, z = 3}, - {x = .25, y = .7, z = 3} - }, - { - {x = .6, y =-.1, z =-1.3}, - {x = -.6, y =-.1, z =-1.3}, - {x = -.6, y =-.1, z =.8}, - {x = .6, y =-.1, z =.8}, - {x = .6, y =.3, z =-1.3}, - {x = -.6, y =.3, z =-1.3}, - {x = -.6, y =.3, z =.8}, - {x = .6, y =.3, z =.8} - }, - { - {x = .5, y =-.1, z =-1.3}, - {x = -.5, y =-.1, z =-1.3}, - {x = -.5, y =-.1, z =.7}, - {x = .5, y =-.1, z =.7}, - {x = .5, y =.15, z =-1.3}, - {x = -.5, y =.15, z =-1.3}, - {x = -.5, y =.15, z =.7}, - {x = .5, y =.15, z =.7} - } -}; -unitCuboidDimensions = { - { - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1} - }, - { - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1} - }, - { - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1} - }, - { - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1} - }, - { - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1} - }, - { - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1} - }, - { - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1} - }, - { - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1}, - {x = 1, y = 1, z = 1} - }, - { - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1} - }, - { - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1} - }, - { - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1}, - {x = .1, y = .1, z = .1} - } -}; - -unitAxisLength = {8, 8, 6, 6, 5, 5, 8, 8, 7, 2, 2} -lineOfSight = {5, 8, 4, 4, 3, 3, 6, 6, 3, 3, 8} -name = { - "Battleship", "Battleship", - "Battleship", "Sample", - "Cruiser", "Cruiser", - "Aircraft carrier", "Aircraft carrier", - "Submarine", - "Jet", "Jet" -} -meshPath = { - "battleship00.xml", "battleship00.xml", - "battleship00.xml", "sample.xml", - "cruiser00.xml", "cruiser01.xml", - "aircraftCarrier00.xml", "aircraftCarrier01.xml", - "submarine.xml", - "jet00.xml", "jet01.xml" -} modelPrefix = "Models/" vehiclePrefix = modelPrefix .. "Units/Vehicles/" structurePrefix = modelPrefix .. "Units/Structures/" -basePath = { - PATH .. vehiclePrefix .. "Battleships/", PATH .. vehiclePrefix .. "Battleships/", - PATH .. vehiclePrefix .. "Battleships/", PATH .. structurePrefix .. "Sample/", - PATH .. vehiclePrefix .. "Cruisers/", PATH .. vehiclePrefix .. "Cruisers/", - PATH .. vehiclePrefix .. "Aircraft carriers/", PATH .. vehiclePrefix .. "Aircraft carriers/", - PATH .. vehiclePrefix .. "Submarines/", - PATH .. vehiclePrefix .. "Jets/", PATH .. vehiclePrefix .. "Jets/" -}; + +units = { + num = 4, + + unitClass = { + UnitClass.VESSEL, UnitClass.VESSEL, + UnitClass.ENGINEER, UnitClass.SAMPLE_STRUCTURE + }, + + unitType = { + UnitType.HOVER, UnitType.SEA_LEVEL, + UnitType.LAND, UnitType.HOVER + }, + + isVehicle = { + true, true, true, false + }, + + health = {500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500}, + cost = {500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500}, + range = {15, 15, 14, 14, 13, 13, 12, 12, 15, 25}, + + unitCornerPoints = { + { + {x = .9, y = -1, z = -6}, + {x = -.9, y = -1, z = -6}, + {x = -.9, y = -1, z = 5.8}, + {x = .9, y = -1, z = 5.8}, + {x = .9, y = 3.5, z = -6}, + {x = -.9, y = 3.5, z = -6}, + {x = -.9, y = 3.5, z = 5.8}, + {x = .9, y = 3.5, z = 5.8} + }, + { + {x = .5, y = -.5, z = -7.05}, + {x = -.5, y = -.5, z = -7.05}, + {x = -.5, y = -.5, z = 6.4}, + {x = .5, y = -.5, z = 6.4}, + {x = .5, y = 3, z = -7.05}, + {x = -.5, y = 3, z = -7.05}, + {x = -.5, y = 3, z = 6.4}, + {x = .5, y = 3, z = 6.4} + }, + { + {x = .5, y = -.5, z = -3.4}, + {x = -.5, y = -.5, z = -3.4}, + {x = -.5, y = -.5, z = 3.4}, + {x = .5, y = -.4, z = 3.4}, + {x = .5, y = 2.1, z = -3.4}, + {x = -.5, y = 2, z = -3.4}, + {x = -.5, y = 2, z = 3.4}, + {x = .5, y = 2, z = 3.4} + }, + { + {x = 1, y = -.25, z = -1}, + {x = -1, y = -.25, z = -1}, + {x = -1, y = -.25, z = 1}, + {x = 1, y = -.25, z = 1}, + {x = 1, y = .8, z = -1}, + {x = -1, y = .8, z = -1}, + {x = -1, y = .8, z = 1}, + {x = 1, y = .8, z = 1} + }, + { + {x = .7, y = -.3, z = -4}, + {x = -.7, y = -.3, z = -4}, + {x = -.7, y = -.3, z = 3.4}, + {x = .7, y = -.3, z = 3.4}, + {x = .7, y = 2.9, z = -4}, + {x = -.7, y = 2.9, z = -4}, + {x = -.7, y = 2.9, z = 3.4}, + {x = .7, y = 2.9, z = 3.4} + }, + { + {x = .5, y = -.5, z = -6.1}, + {x = -.5, y = -.5, z = -6.1}, + {x = -.5, y = -.5, z = 5.2}, + {x = .5, y = -.5, z = 5.2}, + {x = .5, y = 2.2, z = -6.1}, + {x = -.5, y = 2.2, z = -6.1}, + {x = -.5, y = 2.2, z = 5.2}, + {x = .5, y = 2.2, z = 5.2} + }, + { + {x = 2, y = -.5, z = -10}, + {x = -2, y = -.5, z = -10}, + {x = -2, y = -.5, z = 9}, + {x = 2, y = -.5, z = 9}, + {x = 2, y = 5.5, z = -10}, + {x = -2, y = 5.5, z = -10}, + {x = -2, y = 5.5, z = 9}, + {x = 2, y = 5.5, z = 9} + }, + { + {x = 2, y = -1, z = -10}, + {x = -2, y = -1, z = -10}, + {x = -2, y = -1, z = 9}, + {x = 2, y = -1, z = 9}, + {x = 2, y = 4.5, z = -10}, + {x = -2, y = 4.5, z = -10}, + {x = -2, y = 4.5, z = 9}, + {x = 2, y = 4.5, z = 9} + }, + { + {x = .25, y = -.5, z = -2}, + {x = -.25, y = -.5, z = -2}, + {x = -.25, y = -.5, z = 3}, + {x = .25, y = -.5, z = 3}, + {x = .25, y = .7, z = -2}, + {x = -.25, y = .7, z = -2}, + {x = -.25, y = .7, z = 3}, + {x = .25, y = .7, z = 3} + }, + { + {x = .6, y =-.1, z =-1.3}, + {x = -.6, y =-.1, z =-1.3}, + {x = -.6, y =-.1, z =.8}, + {x = .6, y =-.1, z =.8}, + {x = .6, y =.3, z =-1.3}, + {x = -.6, y =.3, z =-1.3}, + {x = -.6, y =.3, z =.8}, + {x = .6, y =.3, z =.8} + }, + { + {x = .5, y =-.1, z =-1.3}, + {x = -.5, y =-.1, z =-1.3}, + {x = -.5, y =-.1, z =.7}, + {x = .5, y =-.1, z =.7}, + {x = .5, y =.15, z =-1.3}, + {x = -.5, y =.15, z =-1.3}, + {x = -.5, y =.15, z =.7}, + {x = .5, y =.15, z =.7} + } + }, + unitCuboidDimensions = { + { + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1} + }, + { + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1} + }, + { + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1} + }, + { + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1} + }, + { + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1} + }, + { + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1} + }, + { + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1} + }, + { + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1}, + {x = 1, y = 1, z = 1} + }, + { + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1} + }, + { + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1} + }, + { + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1}, + {x = .1, y = .1, z = .1} + } + }, + + unitAxisLength = {8, 8, 6, 6, 5, 5, 8, 8, 7, 2, 2}, + lineOfSight = {5, 8, 4, 4, 3, 3, 6, 6, 3, 3, 8}, + name = { + "Battleship", "Battleship", + "Battleship", "Sample", + "Cruiser", "Cruiser", + "Aircraft carrier", "Aircraft carrier", + "Submarine", + "Jet", "Jet" + }, + meshPath = { + "battleship00.xml", "battleship00.xml", + "battleship00.xml", "sample.xml", + "cruiser00.xml", "cruiser01.xml", + "aircraftCarrier00.xml", "aircraftCarrier01.xml", + "submarine.xml", + "jet00.xml", "jet01.xml" + }, + basePath = { + PATH .. vehiclePrefix .. "Battleships/", PATH .. vehiclePrefix .. "Battleships/", + PATH .. vehiclePrefix .. "Battleships/", PATH .. structurePrefix .. "Sample/", + PATH .. vehiclePrefix .. "Cruisers/", PATH .. vehiclePrefix .. "Cruisers/", + PATH .. vehiclePrefix .. "Aircraft carriers/", PATH .. vehiclePrefix .. "Aircraft carriers/", + PATH .. vehiclePrefix .. "Submarines/", + PATH .. vehiclePrefix .. "Jets/", PATH .. vehiclePrefix .. "Jets/" + } +} diff --git a/CMakeLists.txt b/CMakeLists.txt index a2f6e14..8c565ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ set(OPTIONS_BUTTONS optionsButton.cpp tabButton.cpp okButton.cpp defaultsButton. set(IN_GAME_APP_STATE_BUTTONS mainMenuButton.cpp) set(MAP_EDITOR_BUTTONS mapEditorButton.cpp newMapButton.cpp loadMapButton.cpp exportButton.cpp) set(BUTTONS singlePlayerButton.cpp exitButton.cpp backButton.cpp playButton.cpp ${OPTIONS_BUTTONS} ${IN_GAME_APP_STATE_BUTTONS} ${MAP_EDITOR_BUTTONS} ${UNIT_BUTTONS}) -set(LISTBOXES skyboxTextureListbox.cpp landTextureListbox.cpp unitListbox.cpp) +set(LISTBOXES skyboxTextureListbox.cpp landTextureListbox.cpp gameObjectListbox.cpp) set(GUI tooltip.cpp concreteGuiManager.cpp ${BUTTONS} ${LISTBOXES}) set(STATES activeGameState.cpp inGameAppState.cpp guiAppState.cpp mapEditorAppState.cpp) diff --git a/addUnitCommand.cpp b/addUnitCommand.cpp index 4095f51..f225ba8 100644 --- a/addUnitCommand.cpp +++ b/addUnitCommand.cpp @@ -23,7 +23,7 @@ namespace battleship{ unitId = atoi(arguments[1].c_str()); - if(!(0 <= unitId && unitId <= (int)generateView()["numUnits"])) + if(!(0 <= unitId && unitId <= (int)generateView()["units"]["num"])) return; if(arguments.size() >= 5){ diff --git a/buildButton.cpp b/buildButton.cpp index 6be65e7..e36c9ec 100644 --- a/buildButton.cpp +++ b/buildButton.cpp @@ -1,6 +1,6 @@ #include "buildButton.h" #include "gameManager.h" -#include "unit.h" +#include "gameObject.h" #include "gameObjectFrameController.h" #include @@ -18,7 +18,7 @@ namespace battleship{ void BuildButton::onClick(){ GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton(); - ufCtr->addGameObjectFrame(GameObjectFrame(structureId, GameObjectFrame::UNIT)); + ufCtr->addGameObjectFrame(GameObjectFrame(structureId, GameObject::Type::UNIT)); ufCtr->setPlacingFrames(true); } } diff --git a/concreteGuiManager.cpp b/concreteGuiManager.cpp index bec5f96..bddb542 100644 --- a/concreteGuiManager.cpp +++ b/concreteGuiManager.cpp @@ -15,7 +15,7 @@ #include "exportButton.h" #include "skyboxTextureListbox.h" #include "landTextureListbox.h" -#include "unitListbox.h" +#include "gameObjectListbox.h" #include "playButton.h" #include "inGameAppState.h" #include "mainMenuButton.h" @@ -166,6 +166,9 @@ namespace battleship{ return button; } + Listbox* ConcreteGuiManager::parseGameObjectListbox(){ + } + Listbox* ConcreteGuiManager::parseListbox(int guiId){ sol::state_view SOL_LUA_STATE = generateView(); sol::table guiTable = SOL_LUA_STATE["gui"][guiId + 1]; @@ -220,23 +223,31 @@ namespace battleship{ listbox = new Listbox(pos, size, lines, maxDisplay, fontPath, closable); break; - case UNITS:{ - string path = GameManager::getSingleton()->getPath(); - bool vehicles = guiTable["vehicles"]; - int numUnits = SOL_LUA_STATE["numUnits"]; + case VEHICLES: + case STRUCTURES: + case RESOURCE_DEPOSITS:{ + bool resources = (listboxType == RESOURCE_DEPOSITS); + sol::table gameObjTable = SOL_LUA_STATE[resources ? "resources" : "units"]; + int numGameObjs = gameObjTable["num"]; + + for(int i = 0; i < numGameObjs; i++){ + bool canAdd = true; - for(int i = 0; i < numUnits; i++){ - bool v = SOL_LUA_STATE["isVehicle"][i + 1]; + if(!resources){ + bool vehicles = (listboxType == VEHICLES); + bool v = gameObjTable["isVehicle"][i + 1]; + canAdd = (v == vehicles); + } - if(v == vehicles) - lines.push_back(SOL_LUA_STATE["name"][i + 1]); + if(canAdd) + lines.push_back(gameObjTable["name"][i + 1]); } - + numLines = lines.size(); closable = true; maxDisplay = (numLines > numMaxDisplay ? numMaxDisplay : numLines); - - listbox = new UnitListbox(pos, size, lines, maxDisplay, fontPath); + + listbox = new GameObjectListbox(!resources, pos, size, lines, maxDisplay, fontPath); break; } case SKYBOX_TEXTURES: diff --git a/concreteGuiManager.h b/concreteGuiManager.h index 606413f..b0339ee 100644 --- a/concreteGuiManager.h +++ b/concreteGuiManager.h @@ -38,7 +38,9 @@ namespace battleship{ CONTROLS, RESOLUTION, MAPS, - UNITS, + VEHICLES, + STRUCTURES, + RESOURCE_DEPOSITS, SKYBOX_TEXTURES, LAND_TEXTURES, CPU_DIFFICULTIES, @@ -60,6 +62,7 @@ namespace battleship{ private: ConcreteGuiManager(){} vb01Gui::Button* parseButton(int); + vb01Gui::Listbox* parseGameObjectListbox(); vb01Gui::Listbox* parseListbox(int); vb01Gui::Checkbox* parseCheckbox(int); vb01Gui::Slider* parseSlider(int); diff --git a/defConfigs.h b/defConfigs.h index c16ebdf..12fb1bd 100755 --- a/defConfigs.h +++ b/defConfigs.h @@ -39,6 +39,7 @@ namespace battleship{ "Scripts/unitData.lua", "Scripts/vehicleData.lua", "Scripts/structureData.lua", + "Scripts/resourceData.lua", "Scripts/player.lua" }; diff --git a/gameObject.cpp b/gameObject.cpp index 5506bd1..b31676f 100644 --- a/gameObject.cpp +++ b/gameObject.cpp @@ -36,7 +36,7 @@ namespace battleship{ } void GameObject::initModel(bool textured){ - sol::state_view SOL_LUA_STATE = generateView(); + sol::table SOL_LUA_STATE = generateView()[GameObject::getGameObjTableName()]; string basePath = SOL_LUA_STATE["basePath"][id + 1]; string meshPath = SOL_LUA_STATE["meshPath"][id + 1]; @@ -67,4 +67,15 @@ namespace battleship{ void GameObject::destroySound(){} void GameObject::initSound(){} + + string GameObject::getGameObjTableName(){ + switch(type){ + case GameObject::Type::UNIT: + return "units"; + case GameObject::Type::PROJECTILE: + return "projectiles"; + case GameObject::Type::RESOURCE_DEPOSIT: + return "resources"; + } + } } diff --git a/gameObject.h b/gameObject.h index cc3c21c..598921d 100644 --- a/gameObject.h +++ b/gameObject.h @@ -10,12 +10,15 @@ namespace battleship{ class GameObject{ public: - GameObject(int i, Player *pl, vb01::Vector3 vec, vb01::Quaternion quat) : id(i), player(pl), pos(vec), rot(quat){} + enum class Type{UNIT, PROJECTILE, RESOURCE_DEPOSIT}; + + GameObject(Type t, int i, Player *pl, vb01::Vector3 vec, vb01::Quaternion quat) : type(t), id(i), player(pl), pos(vec), rot(quat){} ~GameObject(){} virtual void update(); virtual void toggleSelection(bool sel){selected = sel;} void placeAt(vb01::Vector3); void orientAt(vb01::Quaternion); + std::string getGameObjTableName(); inline vb01::Vector3 getCorner(int i){return corners[i];} inline bool isSelected(){return selected;} inline bool isSelectable(){return selectable;} @@ -40,6 +43,7 @@ namespace battleship{ virtual void destroySound(); virtual void initSound(); + Type type; int id; Player *player; vb01::Model *model = nullptr; diff --git a/gameObjectFactory.cpp b/gameObjectFactory.cpp index 36e3f6f..74c2fb5 100644 --- a/gameObjectFactory.cpp +++ b/gameObjectFactory.cpp @@ -17,7 +17,7 @@ namespace battleship{ Unit* GameObjectFactory::createUnit(Player *player, int id, Vector3 pos, Quaternion rot){ sol::state_view SOL_LUA_STATE = generateView(); - int unitClass = SOL_LUA_STATE["unitClass"][id + 1]; + int unitClass = SOL_LUA_STATE["units"]["unitClass"][id + 1]; switch((UnitClass)unitClass){ case UnitClass::ENGINEER: diff --git a/gameObjectFrame.h b/gameObjectFrame.h index ba0f866..5140920 100644 --- a/gameObjectFrame.h +++ b/gameObjectFrame.h @@ -9,14 +9,12 @@ namespace battleship{ struct GameObjectFrame : public GameObject{ enum Status{PLACEABLE, NOT_PLACEABLE, PLACED}; - enum Type {UNIT, RESOURCE_DEPOSIT}; - GameObjectFrame(int i, Type t, vb01::Vector3 pos = vb01::Vector3::VEC_ZERO, vb01::Quaternion rot = vb01::Quaternion::QUAT_W) : GameObject(i, nullptr, pos, rot), type(t) { + GameObjectFrame(int i, GameObject::Type t, vb01::Vector3 pos = vb01::Vector3::VEC_ZERO, vb01::Quaternion rot = vb01::Quaternion::QUAT_W) : GameObject(t, i, nullptr, pos, rot) { initModel(false); } ~GameObjectFrame(){} - Type type; Status status; }; } diff --git a/gameObjectFrameController.cpp b/gameObjectFrameController.cpp index 8100cf0..90de7f0 100644 --- a/gameObjectFrameController.cpp +++ b/gameObjectFrameController.cpp @@ -45,7 +45,7 @@ namespace battleship{ buildDir = gameObjectFrames[1].getModel()->getPosition() - gameObjectFrames[0].getModel()->getPosition(); Vector3 pos = paintSelectRowStart + buildDir.norm() * hypothenuse * gameObjectFrames.size(); - addGameObjectFrame(GameObjectFrame(structureId, GameObjectFrame::UNIT, pos)); + addGameObjectFrame(GameObjectFrame(structureId, GameObject::Type::UNIT, pos)); } } @@ -100,8 +100,7 @@ namespace battleship{ if(results.empty()) return; Vector3 newPos, rowEnd; - sol::state_view SOL_LUA_STATE = generateView(); - sol::table unitTable = SOL_LUA_STATE["unitCornerPoints"][gameObjectFrames[0].getId() + 1]; + sol::table unitTable = generateView()[gameObjectFrames[0].getGameObjTableName()]["unitCornerPoints"][gameObjectFrames[0].getId() + 1]; float width = (float)unitTable[1]["x"] - (float)unitTable[2]["x"]; float length = (float)unitTable[4]["z"] - (float)unitTable[1]["z"]; diff --git a/gameObjectListbox.cpp b/gameObjectListbox.cpp new file mode 100644 index 0000000..7c9fca8 --- /dev/null +++ b/gameObjectListbox.cpp @@ -0,0 +1,21 @@ +#include + +#include "gameObject.h" +#include "gameObjectListbox.h" +#include "gameObjectFrameController.h" + +namespace battleship{ + using namespace std; + using namespace vb01; + using namespace vb01Gui; + using namespace gameBase; + + GameObjectListbox::GameObjectListbox(bool ul, Vector2 pos, Vector2 size, vector lines, int maxDisplay, string fontPath) : Listbox(pos, size, lines, maxDisplay, fontPath), unitListbox(ul) {} + + void GameObjectListbox::onClose(){ + GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton(); + GameObject::Type type = (unitListbox ? GameObject::Type::UNIT : GameObject::Type::RESOURCE_DEPOSIT); + ufCtr->addGameObjectFrame(GameObjectFrame(selectedOption, type)); + ufCtr->setPlacingFrames(true); + } +} diff --git a/gameObjectListbox.h b/gameObjectListbox.h new file mode 100644 index 0000000..0d7967f --- /dev/null +++ b/gameObjectListbox.h @@ -0,0 +1,16 @@ +#ifndef UNIT_LISTBOX_H +#define UNIT_LISTBOX_H + +#include + +namespace battleship{ + class GameObjectListbox : public vb01Gui::Listbox{ + public: + GameObjectListbox(bool, vb01::Vector2, vb01::Vector2, std::vector, int, std::string); + void onClose(); + private: + bool unitListbox; + }; +} + +#endif diff --git a/projectile.cpp b/projectile.cpp index 04d4e23..47b3ccf 100755 --- a/projectile.cpp +++ b/projectile.cpp @@ -23,7 +23,7 @@ namespace battleship{ using namespace configData; using namespace gameBase; - Projectile::Projectile(Unit *unit, Node *node, Vector3 pos, Vector3 dir, Vector3 left, Vector3 up, int id, int weaponTypeId, int weaponId) : GameObject(id, unit->getPlayer(), pos, Quaternion::QUAT_W){ + Projectile::Projectile(Unit *unit, Node *node, Vector3 pos, Vector3 dir, Vector3 left, Vector3 up, int id, int weaponTypeId, int weaponId) : GameObject(GameObject::Type::PROJECTILE, id, unit->getPlayer(), pos, Quaternion::QUAT_W){ this->unit = unit; this->id = id; this->weaponTypeId = weaponTypeId; @@ -43,7 +43,7 @@ namespace battleship{ } void Projectile::initProperties(int weaponId){ - sol::state_view SOL_LUA_STATE = generateView(); + sol::table SOL_LUA_STATE = generateView()[GameObject::getGameObjTableName()]; rayLength = SOL_LUA_STATE["rayLength"][id + 1][weaponTypeId + 1][weaponId + 1]; damage = SOL_LUA_STATE["damage"][id + 1][weaponTypeId + 1][weaponId + 1]; speed = SOL_LUA_STATE["speed"][id + 1][weaponTypeId + 1][weaponId + 1]; @@ -51,7 +51,7 @@ namespace battleship{ void Projectile::initModel(Node *node){ if(!node){ - sol::state_view SOL_LUA_STATE = generateView(); + sol::table SOL_LUA_STATE = generateView()[GameObject::getGameObjTableName()]; string meshPath = SOL_LUA_STATE["meshPath"][id + 1][weaponTypeId + 1]; this->node = new Model(meshPath); @@ -72,7 +72,7 @@ namespace battleship{ void Projectile::initSound(){ GameManager *gm = GameManager::getSingleton(); - sol::state_view SOL_LUA_STATE = generateView(); + sol::table SOL_LUA_STATE = generateView()[GameObject::getGameObjTableName()]; string unitName = SOL_LUA_STATE["name"][id + 1]; string projectileName = SOL_LUA_STATE["projectileName"][id + 1][weaponTypeId + 1]; string p1 = gm->getPath() + "Sounds/" + unitName + "s/" + projectileName + ".ogg"; diff --git a/unit.cpp b/unit.cpp index 0d9b959..18368ec 100755 --- a/unit.cpp +++ b/unit.cpp @@ -22,7 +22,7 @@ using namespace gameBase; using namespace std; namespace battleship{ - Unit::Unit(Player *player, int id, Vector3 pos, Quaternion rot) : GameObject(id, player, pos, rot){ + Unit::Unit(Player *player, int id, Vector3 pos, Quaternion rot) : GameObject(GameObject::Type::UNIT, id, player, pos, rot){ this->id = id; this->player = player; @@ -45,7 +45,7 @@ namespace battleship{ } void Unit::initProperties(){ - sol::state_view SOL_LUA_STATE = generateView(); + sol::table SOL_LUA_STATE = generateView()[GameObject::getGameObjTableName()]; health = SOL_LUA_STATE["health"][id + 1]; maxHealth = health; @@ -73,7 +73,7 @@ namespace battleship{ } void Unit::initSound(){ - sol::state_view SOL_LUA_STATE = generateView(); + sol::table SOL_LUA_STATE = generateView()[GameObject::getGameObjTableName()]; string name = SOL_LUA_STATE["name"][id + 1]; selectionSfxBuffer = new sf::SoundBuffer(); string p = GameManager::getSingleton()->getPath() + "Sounds/" + name + "s/selection.ogg"; diff --git a/unitListbox.cpp b/unitListbox.cpp deleted file mode 100644 index cc3abcc..0000000 --- a/unitListbox.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -#include "unitListbox.h" -#include "unit.h" -#include "gameObjectFrameController.h" - -namespace battleship{ - using namespace std; - using namespace vb01; - using namespace vb01Gui; - using namespace gameBase; - - UnitListbox::UnitListbox(Vector2 pos, Vector2 size, vector lines, int maxDisplay, string fontPath) : Listbox(pos, size, lines, maxDisplay, fontPath){ - } - - void UnitListbox::onClose(){ - GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton(); - ufCtr->addGameObjectFrame(GameObjectFrame(selectedOption, GameObjectFrame::UNIT)); - ufCtr->setPlacingFrames(true); - } -} diff --git a/unitListbox.h b/unitListbox.h deleted file mode 100644 index ab66a7f..0000000 --- a/unitListbox.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef UNIT_LISTBOX_H -#define UNIT_LISTBOX_H - -#include - -namespace battleship{ - class UnitListbox : public vb01Gui::Listbox{ - public: - UnitListbox(vb01::Vector2, vb01::Vector2, std::vector, int, std::string); - void onClose(); - private: - }; -} - -#endif