mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
+243
-241
@@ -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 = {
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
resources = {
|
||||
num = 1,
|
||||
|
||||
meshPath = {
|
||||
"resource.xml"
|
||||
},
|
||||
name = {
|
||||
"Resource",
|
||||
},
|
||||
basePath = {
|
||||
PATH .. 'Models/Resources/'
|
||||
},
|
||||
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}
|
||||
}
|
||||
}
|
||||
}
|
||||
+276
-274
@@ -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/"
|
||||
}
|
||||
}
|
||||
|
||||
+7
-6
@@ -12,19 +12,20 @@ set(UNIT_BUTTONS unitButton.cpp buildButton.cpp)
|
||||
set(OPTIONS_BUTTONS optionsButton.cpp tabButton.cpp okButton.cpp defaultsButton.cpp)
|
||||
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 consoleCommand.cpp playButton.cpp ${OPTIONS_BUTTONS} ${IN_GAME_APP_STATE_BUTTONS} ${MAP_EDITOR_BUTTONS} ${UNIT_BUTTONS})
|
||||
set(LISTBOXES skyboxTextureListbox.cpp landTextureListbox.cpp unitListbox.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 gameObjectListbox.cpp)
|
||||
set(GUI tooltip.cpp concreteGuiManager.cpp ${BUTTONS} ${LISTBOXES})
|
||||
|
||||
set(STATES activeGameState.cpp inGameAppState.cpp guiAppState.cpp mapEditorAppState.cpp)
|
||||
set(UTIL util.cpp binds.h)
|
||||
set(CONTROLLERS unitFrameController.cpp cameraController.cpp)
|
||||
set(CORE gameManager.cpp defConfigs.cpp ${CONTROLLERS})
|
||||
set(CONTROLLERS gameObjectFrameController.cpp cameraController.cpp)
|
||||
set(CONSOLE console.cpp abstractCommand.cpp addUnitCommand.cpp addResourceCommand.cpp)
|
||||
set(CORE gameManager.cpp defConfigs.cpp ${CONSOLE} ${CONTROLLERS})
|
||||
set(PROJECTILES projectile.cpp)
|
||||
set(FX explosion.cpp)
|
||||
set(VEHICLES vehicle.cpp engineer.cpp)
|
||||
set(UNITS unitFactory.cpp unit.cpp structure.cpp ${VEHICLES})
|
||||
set(CONTENT player.cpp pathfinder.cpp map.cpp ${UNITS} ${PROJECTILES} ${FX})
|
||||
set(UNITS gameObjectFactory.cpp unit.cpp structure.cpp ${VEHICLES})
|
||||
set(CONTENT player.cpp pathfinder.cpp map.cpp gameObject.cpp gameObjectFrame.h resourceDeposit.cpp ${UNITS} ${PROJECTILES} ${FX})
|
||||
set(GAME_SRC ${STATES} ${GUI} ${CORE} ${CONTENT} ${UTIL})
|
||||
|
||||
set(SFML_DIR external/SFML)
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#include "abstractCommand.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <vector.h>
|
||||
|
||||
namespace battleship{
|
||||
using namespace std;
|
||||
|
||||
vector<string> AbstractCommand::explodeString(string commandStr){
|
||||
vector<int> spaceIds;
|
||||
vector<string> fullCommand;
|
||||
|
||||
for(int i = 0; i < commandStr.length(); i++)
|
||||
if(commandStr[i] == ' ')
|
||||
spaceIds.push_back(i);
|
||||
|
||||
fullCommand.push_back(commandStr.substr(0, spaceIds[0]));
|
||||
|
||||
for(int i = 0; i < spaceIds.size(); i++){
|
||||
bool lastSpace = (i == spaceIds.size() - 1);
|
||||
string argument = commandStr.substr(spaceIds[i] + 1, lastSpace ? string::npos : spaceIds[i + 1] - spaceIds[i] - 1);
|
||||
fullCommand.push_back(argument);
|
||||
}
|
||||
|
||||
return fullCommand;
|
||||
}
|
||||
|
||||
void AbstractCommand::handle(){
|
||||
if(cmdStr.find(" ") == -1)
|
||||
return;
|
||||
|
||||
arguments = explodeString(cmdStr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef ABSTRACT_COMMAND_H
|
||||
#define ABSTRACT_COMMAND_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace battleship{
|
||||
class AbstractCommand{
|
||||
protected:
|
||||
AbstractCommand(std::string str) : cmdStr(str){}
|
||||
virtual void execute(){}
|
||||
virtual void validate(){}
|
||||
virtual void handle();
|
||||
|
||||
std::string cmdStr;
|
||||
std::vector<std::string> arguments;
|
||||
private:
|
||||
std::vector<std::string> explodeString(std::string);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
+36
-23
@@ -20,7 +20,7 @@
|
||||
#include "structure.h"
|
||||
#include "util.h"
|
||||
#include "tooltip.h"
|
||||
#include "unitFrameController.h"
|
||||
#include "gameObjectFrameController.h"
|
||||
#include "cameraController.h"
|
||||
#include "concreteGuiManager.h"
|
||||
|
||||
@@ -43,7 +43,12 @@ namespace battleship{
|
||||
mainPlayer = Map::getSingleton()->getPlayer(playerId);
|
||||
|
||||
initDragbox();
|
||||
initDepthText();
|
||||
|
||||
refinedsText = initText(Vector2(0, 100));
|
||||
wealthText = initText(Vector2(0, 200));
|
||||
researchText = initText(Vector2(0, 300));
|
||||
textNode = initText(Vector2(0, 400));
|
||||
depth = 1;
|
||||
}
|
||||
|
||||
ActiveGameState::~ActiveGameState() {
|
||||
@@ -65,33 +70,41 @@ namespace battleship{
|
||||
root->getGuiNode()->attachChild(dragboxNode);
|
||||
}
|
||||
|
||||
void ActiveGameState::initDepthText(){
|
||||
Root *root = Root::getSingleton();
|
||||
Text *t = new Text(GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", L"depth: ");
|
||||
|
||||
Material *tm = new Material(root->getLibPath() + "text");
|
||||
Node* ActiveGameState::initText(Vector2 pos){
|
||||
Material *tm = new Material(Root::getSingleton()->getLibPath() + "text");
|
||||
tm->addBoolUniform("texturingEnabled", false);
|
||||
tm->addVec4Uniform("diffuseColor", Vector4(1, 1, 1, 1));
|
||||
|
||||
Text *t = new Text(GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", L"");
|
||||
t->setMaterial(tm);
|
||||
|
||||
textNode = new Node(Vector3(0, 100, 0));
|
||||
textNode->addText(t);
|
||||
Node *node = new Node(Vector3(pos.x, pos.y, 0));
|
||||
node->addText(t);
|
||||
|
||||
depth = 1;
|
||||
return node;
|
||||
}
|
||||
|
||||
void ActiveGameState::onAttached() {
|
||||
AbstractAppState::onAttached();
|
||||
Root::getSingleton()->getGuiNode()->attachChild(textNode);
|
||||
Root::getSingleton()->getGuiNode()->attachChild(refinedsText);
|
||||
Root::getSingleton()->getGuiNode()->attachChild(wealthText);
|
||||
Root::getSingleton()->getGuiNode()->attachChild(researchText);
|
||||
}
|
||||
|
||||
void ActiveGameState::onDettached() {
|
||||
AbstractAppState::onDettached();
|
||||
Root::getSingleton()->getGuiNode()->attachChild(textNode);
|
||||
Root::getSingleton()->getGuiNode()->dettachChild(textNode);
|
||||
Root::getSingleton()->getGuiNode()->dettachChild(refinedsText);
|
||||
Root::getSingleton()->getGuiNode()->dettachChild(wealthText);
|
||||
Root::getSingleton()->getGuiNode()->dettachChild(researchText);
|
||||
}
|
||||
|
||||
void ActiveGameState::update() {
|
||||
textNode->getText(0)->setText(L"Depth: " + to_wstring(depth));
|
||||
refinedsText->getText(0)->setText(L"Refineds: " + to_wstring(mainPlayer->getRefineds()));
|
||||
wealthText->getText(0)->setText(L"Wealth: " + to_wstring(mainPlayer->getWealth()));
|
||||
researchText->getText(0)->setText(L"Research: " + to_wstring(mainPlayer->getResearch()));
|
||||
|
||||
if (isSelectionBox)
|
||||
updateSelectionBox();
|
||||
@@ -105,7 +118,7 @@ namespace battleship{
|
||||
if(!camCtr->isLookingAround())
|
||||
camCtr->updateCameraPosition();
|
||||
|
||||
UnitFrameController *ufCtr = UnitFrameController::getSingleton();
|
||||
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
|
||||
|
||||
if(ufCtr->isPlacingFrames())
|
||||
ufCtr->update();
|
||||
@@ -113,8 +126,8 @@ namespace battleship{
|
||||
|
||||
void ActiveGameState::deselectUnits(){
|
||||
mainPlayer->deselectUnits();
|
||||
UnitFrameController *ufCtr = UnitFrameController::getSingleton();
|
||||
ufCtr->removeUnitFrames();
|
||||
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
|
||||
ufCtr->removeGameObjectFrames();
|
||||
ufCtr->setPlacingFrames(false);
|
||||
|
||||
ConcreteGuiManager::getSingleton()->removeAllGuiElements();
|
||||
@@ -275,11 +288,11 @@ namespace battleship{
|
||||
std::map<Node*, Unit*>::iterator it = unitData.find(node);
|
||||
|
||||
Unit *unit = nullptr;
|
||||
UnitFrameController *ufCtr = UnitFrameController::getSingleton();
|
||||
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
|
||||
|
||||
if(ufCtr->isPlacingFrames()){
|
||||
Model *model = ufCtr->getUnitFrame(0).model;
|
||||
unit = new Structure(mainPlayer, ufCtr->getUnitFrame(0).id, model->getPosition(), model->getOrientation());
|
||||
GameObjectFrame goFr = ufCtr->getGameObjectFrame(0);
|
||||
unit = new Structure(mainPlayer, goFr.getId(), goFr.getModel()->getPosition(), goFr.getModel()->getOrientation());
|
||||
mainPlayer->addUnit(unit);
|
||||
}
|
||||
|
||||
@@ -325,7 +338,7 @@ namespace battleship{
|
||||
void ActiveGameState::onAction(int bind, bool isPressed) {
|
||||
GameManager *gm = GameManager::getSingleton();
|
||||
InGameAppState *inGameState = (InGameAppState*) gm->getStateManager()->getAppStateByType((int)AppStateType::IN_GAME_STATE);
|
||||
UnitFrameController *ufCtr = UnitFrameController::getSingleton();
|
||||
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
|
||||
|
||||
switch((Bind)bind){
|
||||
case Bind::DRAG_BOX:
|
||||
@@ -346,7 +359,7 @@ namespace battleship{
|
||||
type = Order::TYPE::BUILD;
|
||||
ufCtr->setPlacingFrames(false);
|
||||
ufCtr->setRotatingFrames(false);
|
||||
ufCtr->removeUnitFrames();
|
||||
ufCtr->removeGameObjectFrames();
|
||||
}
|
||||
|
||||
issueOrder(type, shiftPressed);
|
||||
@@ -392,7 +405,7 @@ namespace battleship{
|
||||
{
|
||||
shiftPressed = isPressed;
|
||||
|
||||
UnitFrameController *ufCtr = UnitFrameController::getSingleton();
|
||||
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
|
||||
ufCtr->setPaintSelecting(shiftPressed);
|
||||
|
||||
if(isPressed){
|
||||
@@ -450,7 +463,7 @@ namespace battleship{
|
||||
|
||||
break;
|
||||
case Bind::DESELECT_STRUCTURE:
|
||||
ufCtr->removeUnitFrames();
|
||||
ufCtr->removeGameObjectFrames();
|
||||
ufCtr->setPlacingFrames(false);
|
||||
break;
|
||||
}
|
||||
@@ -458,7 +471,7 @@ namespace battleship{
|
||||
|
||||
void ActiveGameState::onAnalog(int bind, float strength) {
|
||||
CameraController *camCtr = CameraController::getSingleton();
|
||||
UnitFrameController *ufCtr = UnitFrameController::getSingleton();
|
||||
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
|
||||
|
||||
switch((Bind)bind){
|
||||
case Bind::LOOK_UP:
|
||||
@@ -475,7 +488,7 @@ namespace battleship{
|
||||
if(camCtr->isLookingAround())
|
||||
CameraController::getSingleton()->orientCamera(Vector3(0, 1, 0), strength);
|
||||
else if(ufCtr->isPlacingFrames() && ufCtr->isRotatingFrames())
|
||||
ufCtr->rotateUnitFrames(100 * strength);
|
||||
ufCtr->rotateGameObjectFrames(100 * strength);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ namespace battleship{
|
||||
inline std::vector<Unit*>& getUnitGroup(int i){return unitGroups[i];}
|
||||
private:
|
||||
void initDragbox();
|
||||
void initDepthText();
|
||||
vb01::Node* initText(vb01::Vector2);
|
||||
void deselectUnits();
|
||||
void renderUnits();
|
||||
void updateSelectionBox();
|
||||
@@ -43,7 +43,7 @@ namespace battleship{
|
||||
GuiAppState *guiState;
|
||||
Player *mainPlayer;
|
||||
vb01::Quad *dragbox = nullptr;
|
||||
vb01::Node *dragboxNode = nullptr, *textNode = nullptr;
|
||||
vb01::Node *dragboxNode = nullptr, *textNode = nullptr, *refinedsText = nullptr, *wealthText = nullptr, *researchText = nullptr;
|
||||
vb01::Vector2 clickPoint;
|
||||
std::vector<vb01::Vector2> unitScreenPosVec;
|
||||
std::vector<vb01::Node*> unitLightNodes;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#include "addResourceCommand.h"
|
||||
#include "map.h"
|
||||
#include "player.h"
|
||||
|
||||
namespace battleship{
|
||||
void AddResourceCommand::validate(){
|
||||
if(arguments.size() != 3)
|
||||
return;
|
||||
|
||||
playerId = atoi(arguments[0].c_str());
|
||||
|
||||
if(playerId != 0 && playerId != 1)
|
||||
return;
|
||||
|
||||
resourceId = atoi(arguments[1].c_str());
|
||||
|
||||
if(!(0 <= resourceId && resourceId <= 2))
|
||||
return;
|
||||
|
||||
resourceAmmount = atoi(arguments[2].c_str());
|
||||
}
|
||||
|
||||
void AddResourceCommand::addResource(){
|
||||
Player *player = Map::getSingleton()->getPlayer(playerId);
|
||||
|
||||
switch(resourceId){
|
||||
case 0:
|
||||
player->addRefineds(resourceAmmount);
|
||||
break;
|
||||
case 1:
|
||||
player->addWealth(resourceAmmount);
|
||||
break;
|
||||
case 2:
|
||||
player->addResearch(resourceAmmount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void AddResourceCommand::execute(){
|
||||
AbstractCommand::handle();
|
||||
validate();
|
||||
addResource();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef ADD_RESOURCE_COMMAND_H
|
||||
#define ADD_RESOURCE_COMMAND_H
|
||||
|
||||
#include "abstractCommand.h"
|
||||
|
||||
namespace battleship{
|
||||
class AddResourceCommand : public AbstractCommand{
|
||||
public:
|
||||
AddResourceCommand(std::string argsStr) : AbstractCommand(argsStr){}
|
||||
void execute();
|
||||
private:
|
||||
void validate();
|
||||
void addResource();
|
||||
|
||||
int playerId, resourceId, resourceAmmount;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
#include <solUtil.h>
|
||||
#include <stateManager.h>
|
||||
|
||||
#include "addUnitCommand.h"
|
||||
#include "console.h"
|
||||
#include "addUnitCommand.h"
|
||||
#include "inGameAppState.h"
|
||||
#include "player.h"
|
||||
#include "gameObjectFactory.h"
|
||||
|
||||
namespace battleship{
|
||||
using namespace gameBase;
|
||||
using namespace vb01;
|
||||
|
||||
void AddUnitCommand::validate(){
|
||||
if(!(arguments.size() == 2 || arguments.size() == 5 || arguments.size() == 9))
|
||||
return;
|
||||
|
||||
playerId = atoi(arguments[0].c_str());
|
||||
|
||||
if(playerId != 0 && playerId != 1)
|
||||
return;
|
||||
|
||||
unitId = atoi(arguments[1].c_str());
|
||||
|
||||
if(!(0 <= unitId && unitId <= (int)generateView()["units"]["num"]))
|
||||
return;
|
||||
|
||||
if(arguments.size() >= 5){
|
||||
float x = atoi(arguments[2].c_str());
|
||||
float y = atoi(arguments[3].c_str());
|
||||
float z = atoi(arguments[4].c_str());
|
||||
pos = Vector3(x, y, z);
|
||||
}
|
||||
else if(2 < arguments.size() && arguments.size() < 5)
|
||||
return;
|
||||
|
||||
if(arguments.size() == 9){
|
||||
float w = atoi(arguments[5].c_str());
|
||||
float x = atoi(arguments[6].c_str());
|
||||
float y = atoi(arguments[7].c_str());
|
||||
float z = atoi(arguments[8].c_str());
|
||||
rot = Quaternion(w, x, y, z);
|
||||
}
|
||||
else if(5 < arguments.size() && arguments.size() < 9)
|
||||
return;
|
||||
}
|
||||
|
||||
void AddUnitCommand::addUnit(){
|
||||
Player* player = Map::getSingleton()->getPlayer(playerId);
|
||||
player->addUnit(GameObjectFactory::createUnit(player, unitId, pos, rot));
|
||||
}
|
||||
|
||||
void AddUnitCommand::execute(){
|
||||
AbstractCommand::handle();
|
||||
validate();
|
||||
addUnit();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef ADD_UNIT_COMMAND_H
|
||||
#define ADD_UNIT_COMMAND_H
|
||||
|
||||
#include "abstractCommand.h"
|
||||
|
||||
#include <vector.h>
|
||||
#include <quaternion.h>
|
||||
|
||||
namespace battleship{
|
||||
class AddUnitCommand : public AbstractCommand{
|
||||
public:
|
||||
AddUnitCommand(std::string argsStr) : AbstractCommand(argsStr){}
|
||||
void validate();
|
||||
void execute();
|
||||
private:
|
||||
int playerId, unitId;
|
||||
bool posEnabled, rotEnabled;
|
||||
vb01::Vector3 pos = vb01::Vector3::VEC_ZERO;
|
||||
vb01::Quaternion rot = vb01::Quaternion::QUAT_W;
|
||||
|
||||
void addUnit();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
+4
-7
@@ -1,7 +1,7 @@
|
||||
#include "buildButton.h"
|
||||
#include "gameManager.h"
|
||||
#include "unit.h"
|
||||
#include "unitFrameController.h"
|
||||
#include "gameObject.h"
|
||||
#include "gameObjectFrameController.h"
|
||||
|
||||
#include <solUtil.h>
|
||||
|
||||
@@ -17,11 +17,8 @@ namespace battleship{
|
||||
}
|
||||
|
||||
void BuildButton::onClick(){
|
||||
sol::state_view SOL_LUA_STATE = generateView();
|
||||
string modelPath = (string)SOL_LUA_STATE["basePath"][structureId + 1] + (string)SOL_LUA_STATE["meshPath"][structureId + 1];
|
||||
|
||||
UnitFrameController *ufCtr = UnitFrameController::getSingleton();
|
||||
ufCtr->addUnitFrame(UnitFrameController::UnitFrame(modelPath, structureId, (int)UnitType::LAND));
|
||||
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
|
||||
ufCtr->addGameObjectFrame(GameObjectFrame(structureId, GameObject::Type::UNIT));
|
||||
ufCtr->setPlacingFrames(true);
|
||||
}
|
||||
}
|
||||
|
||||
+23
-12
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#include "console.h"
|
||||
#include "addUnitCommand.h"
|
||||
#include "addResourceCommand.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace battleship{
|
||||
void Console::execute(string cmdStr) {
|
||||
int space = cmdStr.find(" ");
|
||||
string cmdName, argsStr;
|
||||
|
||||
if(space != -1){
|
||||
cmdName = cmdStr.substr(0, space);
|
||||
argsStr = cmdStr.substr(space + 1, string::npos);
|
||||
}
|
||||
|
||||
if(cmdName == "add-unit")
|
||||
AddUnitCommand(argsStr).execute();
|
||||
else if(cmdName == "add-resource")
|
||||
AddResourceCommand(argsStr).execute();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef CONSOLE_COMMAND_H
|
||||
#define CONSOLE_COMMAND_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace battleship{
|
||||
class Console{
|
||||
public:
|
||||
static void execute(std::string);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,73 +0,0 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <cmath>
|
||||
#include <vector.h>
|
||||
|
||||
#include <solUtil.h>
|
||||
#include <stateManager.h>
|
||||
|
||||
#include "consoleCommand.h"
|
||||
#include "inGameAppState.h"
|
||||
#include "player.h"
|
||||
#include "unitFactory.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace vb01;
|
||||
using namespace vb01Gui;
|
||||
using namespace gameBase;
|
||||
|
||||
namespace battleship{
|
||||
void ConsoleCommand::execute(string commandStr) {
|
||||
vector<string> fullCommand;
|
||||
parse(commandStr, fullCommand);
|
||||
|
||||
if (fullCommand[0] == "add-unit") {
|
||||
validateAddUnitArguments(fullCommand);
|
||||
Vector3 pos = Vector3::VEC_ZERO;
|
||||
Quaternion rot = Quaternion::QUAT_W;
|
||||
|
||||
if(fullCommand.size() == 6)
|
||||
pos = Vector3(atof(fullCommand[3].c_str()), atof(fullCommand[4].c_str()), atof(fullCommand[5].c_str()));
|
||||
|
||||
executeAddUnit(atoi(fullCommand[1].c_str()), atoi(fullCommand[2].c_str()), pos, rot);
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleCommand::parse(string commandStr, vector<string> &fullCommand){
|
||||
vector<int> spaceIds;
|
||||
|
||||
for(int i = 0; i < commandStr.length(); i++)
|
||||
if(commandStr[i] == ' ')
|
||||
spaceIds.push_back(i);
|
||||
|
||||
fullCommand.push_back(commandStr.substr(0, spaceIds[0]));
|
||||
|
||||
for(int i = 0; i < spaceIds.size(); i++){
|
||||
bool lastSpace = (i == spaceIds.size() - 1);
|
||||
string argument = commandStr.substr(spaceIds[i] + 1, lastSpace ? string::npos : spaceIds[i + 1] - spaceIds[i] - 1);
|
||||
fullCommand.push_back(argument);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO implement rotation argument
|
||||
void ConsoleCommand::validateAddUnitArguments(vector<string> &fullCommand){
|
||||
//addUnit <playerId> <unitId> [<posX> <posY> <posZ> ]
|
||||
if(fullCommand.size() != 3 || fullCommand.size() != 6)
|
||||
return;
|
||||
|
||||
int playerId = atoi(fullCommand[1].c_str());
|
||||
|
||||
if(playerId != 0 && playerId != 1)
|
||||
return;
|
||||
|
||||
int unitId = atoi(fullCommand[2].c_str());
|
||||
|
||||
if(!(0 <= unitId && unitId <= (int)generateView()["numUnits"]))
|
||||
return;
|
||||
}
|
||||
|
||||
void ConsoleCommand::executeAddUnit(int playerId, int unitId, Vector3 pos, Quaternion rot) {
|
||||
Player* player = Map::getSingleton()->getPlayer(playerId);
|
||||
player->addUnit(UnitFactory::createUnit(player, unitId, pos, rot));
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
#ifndef CONSOLE_COMMAND_H
|
||||
#define CONSOLE_COMMAND_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <vector.h>
|
||||
#include <quaternion.h>
|
||||
|
||||
namespace battleship{
|
||||
class ConsoleCommand{
|
||||
public:
|
||||
static void execute(std::string);
|
||||
private:
|
||||
static void parse(std::string, std::vector<std::string>&);
|
||||
static void validateAddUnitArguments(std::vector<std::string>&);
|
||||
static void executeAddUnit(int, int, vb01::Vector3, vb01::Quaternion);
|
||||
static void validateDebugUnitsArguments();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -39,6 +39,7 @@ namespace battleship{
|
||||
"Scripts/unitData.lua",
|
||||
"Scripts/vehicleData.lua",
|
||||
"Scripts/structureData.lua",
|
||||
"Scripts/resourceData.lua",
|
||||
"Scripts/player.lua"
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
#include "gameObject.h"
|
||||
#include "gameManager.h"
|
||||
#include "defConfigs.h"
|
||||
|
||||
#include <solUtil.h>
|
||||
|
||||
#include <material.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace battleship{
|
||||
using namespace std;
|
||||
using namespace vb01;
|
||||
using namespace gameBase;
|
||||
using namespace configData;
|
||||
|
||||
void GameObject::update(){
|
||||
}
|
||||
|
||||
void GameObject::placeAt(Vector3 p) {
|
||||
model->setPosition(p);
|
||||
pos = p;
|
||||
}
|
||||
|
||||
void GameObject::orientAt(Quaternion rotQuat){
|
||||
model->setOrientation(rotQuat);
|
||||
rot = rotQuat;
|
||||
}
|
||||
|
||||
void GameObject::initProperties(){
|
||||
}
|
||||
|
||||
void GameObject::destroyModel(){
|
||||
Root::getSingleton()->getRootNode()->dettachChild(model);
|
||||
delete model;
|
||||
}
|
||||
|
||||
void GameObject::initModel(bool textured){
|
||||
sol::table SOL_LUA_STATE = generateView()[GameObject::getGameObjTableName()];
|
||||
string basePath = SOL_LUA_STATE["basePath"][id + 1];
|
||||
string meshPath = SOL_LUA_STATE["meshPath"][id + 1];
|
||||
|
||||
model = new Model(basePath + meshPath);
|
||||
Root *root = Root::getSingleton();
|
||||
string libPath = root->getLibPath();
|
||||
|
||||
Material *mat = new Material(libPath + "texture");
|
||||
|
||||
if(textured){
|
||||
string f[]{GameManager::getSingleton()->getPath() + configData::DEFAULT_TEXTURE};
|
||||
Texture *diffuseTexture = new Texture(f, 1, false);
|
||||
mat->addBoolUniform("texturingEnabled", true);
|
||||
mat->addBoolUniform("lightingEnabled", false);
|
||||
mat->addTexUniform("textures[0]", diffuseTexture, true);
|
||||
}
|
||||
else{
|
||||
mat->addBoolUniform("texturingEnabled", false);
|
||||
mat->addBoolUniform("lightingEnabled", false);
|
||||
mat->addVec4Uniform("diffuseColor", Vector4::VEC_ZERO);
|
||||
model->setWireframe(true);
|
||||
}
|
||||
|
||||
model->setMaterial(mat);
|
||||
root->getRootNode()->attachChild(model);
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
#ifndef GAME_OBJECT_H
|
||||
#define GAME_OBJECT_H
|
||||
|
||||
#include <vector.h>
|
||||
#include <quaternion.h>
|
||||
#include <model.h>
|
||||
|
||||
namespace battleship{
|
||||
class Player;
|
||||
|
||||
class GameObject{
|
||||
public:
|
||||
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;}
|
||||
inline bool isDebuggable(){return debugging;}
|
||||
inline vb01::Vector3 getPos() {return pos;}
|
||||
inline vb01::Quaternion getRot(){return rot;}
|
||||
inline float getWidth() {return width;}
|
||||
inline float getHeight() {return height;}
|
||||
inline float getLength() {return length;}
|
||||
inline vb01::Model* getModel() {return model;}
|
||||
inline Player* getPlayer(){return player;}
|
||||
inline void toggleDebugging(bool d){this->debugging=d;}
|
||||
inline vb01::Vector3 getDirVec() {return dirVec;}
|
||||
inline vb01::Vector3 getLeftVec() {return leftVec;}
|
||||
inline vb01::Vector3 getUpVec() {return upVec;}
|
||||
inline int getId() {return id;}
|
||||
inline Type getType(){return type;}
|
||||
private:
|
||||
protected:
|
||||
virtual void initProperties();
|
||||
virtual void destroyModel();
|
||||
virtual void initModel(bool = true);
|
||||
virtual void destroySound();
|
||||
virtual void initSound();
|
||||
|
||||
Type type;
|
||||
int id;
|
||||
Player *player;
|
||||
vb01::Model *model = nullptr;
|
||||
vb01::Vector3 pos = vb01::Vector3(0, 0, 0), upVec = vb01::Vector3(0, 1, 0), dirVec = vb01::Vector3(0, 0, 1), leftVec = vb01::Vector3(1, 0, 0), corners[8];
|
||||
vb01::Quaternion rot;
|
||||
bool selected = false, selectable, debugging = false;
|
||||
float width, height, length;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "gameObjectFactory.h"
|
||||
#include "player.h"
|
||||
#include "vehicle.h"
|
||||
#include "engineer.h"
|
||||
#include "projectile.h"
|
||||
#include "resourceDeposit.h"
|
||||
#include "defConfigs.h"
|
||||
|
||||
#include <solUtil.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace battleship{
|
||||
using namespace std;
|
||||
using namespace vb01;
|
||||
using namespace gameBase;
|
||||
|
||||
Unit* GameObjectFactory::createUnit(Player *player, int id, Vector3 pos, Quaternion rot){
|
||||
sol::state_view SOL_LUA_STATE = generateView();
|
||||
int unitClass = SOL_LUA_STATE["units"]["unitClass"][id + 1];
|
||||
|
||||
switch((UnitClass)unitClass){
|
||||
case UnitClass::ENGINEER:
|
||||
return new Engineer(player, id, pos, rot);
|
||||
default:
|
||||
return new Vehicle(player, id, pos, rot);
|
||||
}
|
||||
}
|
||||
|
||||
Projectile* GameObjectFactory::createProjectile(Unit *unti, int id, Vector3 pos, Quaternion rot){
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ResourceDeposit* GameObjectFactory::createResourceDeposit(int id, Vector3 pos, Quaternion rot){
|
||||
return new ResourceDeposit(id, pos, rot);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef GAME_OBJECT_FACTORY_H
|
||||
#define GAME_OBJECT_FACTORY_H
|
||||
|
||||
#include <vector.h>
|
||||
#include <quaternion.h>
|
||||
|
||||
namespace battleship{
|
||||
class Unit;
|
||||
class Projectile;
|
||||
class ResourceDeposit;
|
||||
class Player;
|
||||
|
||||
class GameObjectFactory{
|
||||
public:
|
||||
enum GameObjectType{UNIT, PROJECTILE, RESOURCE_DEPOSIT};
|
||||
static Unit* createUnit(Player*, int, vb01::Vector3, vb01::Quaternion);
|
||||
static Projectile* createProjectile(Unit*, int, vb01::Vector3, vb01::Quaternion);
|
||||
static ResourceDeposit* createResourceDeposit(int, vb01::Vector3, vb01::Quaternion);
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "gameObjectFrame.h"
|
||||
|
||||
namespace battleship{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef GAME_OBJECT_FRAME_H
|
||||
#define GAME_OBJECT_FRAME_H
|
||||
|
||||
#include "gameObject.h"
|
||||
|
||||
#include <vector.h>
|
||||
#include <quaternion.h>
|
||||
|
||||
namespace battleship{
|
||||
struct GameObjectFrame : public GameObject{
|
||||
enum Status{PLACEABLE, NOT_PLACEABLE, PLACED};
|
||||
|
||||
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(){}
|
||||
|
||||
Status status;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,143 @@
|
||||
#include <solUtil.h>
|
||||
|
||||
#include "gameObjectFrameController.h"
|
||||
#include "unit.h"
|
||||
#include "util.h"
|
||||
#include "map.h"
|
||||
|
||||
#include <material.h>
|
||||
#include <meshData.h>
|
||||
#include <mesh.h>
|
||||
#include <model.h>
|
||||
#include <root.h>
|
||||
#include <ray.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace battleship{
|
||||
using namespace std;
|
||||
using namespace vb01;
|
||||
using namespace gameBase;
|
||||
|
||||
static GameObjectFrameController *gameObjectFrameController = nullptr;
|
||||
|
||||
GameObjectFrameController* GameObjectFrameController::getSingleton(){
|
||||
if(!gameObjectFrameController)
|
||||
gameObjectFrameController = new GameObjectFrameController();
|
||||
|
||||
return gameObjectFrameController;
|
||||
}
|
||||
|
||||
void GameObjectFrameController::paintSelect(Vector3 rowEnd, float width, float length){
|
||||
Vector3 rowDir = rowEnd - paintSelectRowStart;
|
||||
float lenRow = rowDir.getLength();
|
||||
float hypothenuse = sqrt(width * width + length * length);
|
||||
int numStructsInRow = int(lenRow / hypothenuse);
|
||||
|
||||
while(gameObjectFrames.size() > numStructsInRow)
|
||||
removeGameObjectFrame(gameObjectFrames.size() - 1);
|
||||
|
||||
if(gameObjectFrames.size() < numStructsInRow){
|
||||
int structureId = gameObjectFrames[0].getId();
|
||||
Vector3 buildDir = rowDir;
|
||||
|
||||
if(gameObjectFrames.size() > 1)
|
||||
buildDir = gameObjectFrames[1].getModel()->getPosition() - gameObjectFrames[0].getModel()->getPosition();
|
||||
|
||||
Vector3 pos = paintSelectRowStart + buildDir.norm() * hypothenuse * gameObjectFrames.size();
|
||||
addGameObjectFrame(GameObjectFrame(structureId, GameObject::Type::UNIT, pos));
|
||||
}
|
||||
}
|
||||
|
||||
//TODO implement terrain evenness check
|
||||
void GameObjectFrameController::placeGameObjectFrame(int id, Vector3 newPos, float width, float length){
|
||||
GameObjectFrame &s = gameObjectFrames[id];
|
||||
Model *model = s.getModel();
|
||||
|
||||
if(!rotatingStructure)
|
||||
model->setPosition(newPos);
|
||||
|
||||
Map *map = Map::getSingleton();
|
||||
MeshData meshData = map->getNodeParent()->getChild(0)->getMesh(0)->getMeshBase();
|
||||
MeshData::Vertex *verts = meshData.vertices;
|
||||
int numVerts = 3 * meshData.numTris;
|
||||
|
||||
float maxUnevenness = generateView()["maxUnevenness"], unevenness = 0;
|
||||
|
||||
for(int i = 0; i < numVerts; i++){
|
||||
float diffX = fabs(model->getPosition().x - verts[i].pos.x);
|
||||
float diffY = fabs(model->getPosition().y - verts[i].pos.y);
|
||||
float diffZ = fabs(model->getPosition().z - verts[i].pos.z);
|
||||
|
||||
if(diffX < 0.5 * width && diffZ < 0.5 * length && diffY > unevenness){
|
||||
unevenness = diffY;
|
||||
|
||||
if(unevenness > maxUnevenness)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Vector4 color;
|
||||
|
||||
if(unevenness > maxUnevenness){
|
||||
color = Vector4(1, 0, 0, 1);
|
||||
s.status = GameObjectFrame::NOT_PLACEABLE;
|
||||
}
|
||||
else{
|
||||
color = Vector4(0, 1, 0, 1);
|
||||
s.status = GameObjectFrame::PLACEABLE;
|
||||
}
|
||||
|
||||
Material *mat = model->getMaterial();
|
||||
mat->setVec4Uniform("diffuseColor", color);
|
||||
}
|
||||
|
||||
void GameObjectFrameController::update(){
|
||||
Vector3 startPos = Root::getSingleton()->getCamera()->getPosition();
|
||||
vector<Ray::CollisionResult> results;
|
||||
Ray::retrieveCollisions(startPos, (screenToSpace(getCursorPos()) - startPos).norm(), Map::getSingleton()->getNodeParent()->getChild(0), results);
|
||||
Ray::sortResults(results);
|
||||
if(results.empty()) return;
|
||||
|
||||
Vector3 newPos, rowEnd;
|
||||
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"];
|
||||
|
||||
if(paintSelecting)
|
||||
paintSelect(results[0].pos, width, length);
|
||||
else if(!(paintSelecting || rotatingStructure))
|
||||
newPos = results[0].pos;
|
||||
|
||||
for(int i = 0; i < gameObjectFrames.size(); i++){
|
||||
if(paintSelecting){
|
||||
float hypothenuse = sqrt(width * width + length * length);
|
||||
Vector3 dir = (results[0].pos - paintSelectRowStart).norm();
|
||||
newPos = paintSelectRowStart + dir * hypothenuse * i;
|
||||
}
|
||||
|
||||
placeGameObjectFrame(i, newPos, width, length);
|
||||
}
|
||||
}
|
||||
|
||||
void GameObjectFrameController::removeGameObjectFrame(int i){
|
||||
Model *model = gameObjectFrames[i].getModel();
|
||||
model->getParent()->dettachChild(model);
|
||||
delete model;
|
||||
gameObjectFrames.erase(gameObjectFrames.begin() + i);
|
||||
}
|
||||
|
||||
void GameObjectFrameController::removeGameObjectFrames(){
|
||||
while(gameObjectFrames.size() > 0)
|
||||
removeGameObjectFrame(0);
|
||||
}
|
||||
|
||||
void GameObjectFrameController::rotateGameObjectFrames(float angle){
|
||||
for(GameObjectFrame &s : gameObjectFrames)
|
||||
if(s.status != GameObjectFrame::PLACED){
|
||||
Model *model = s.getModel();
|
||||
Quaternion rot = model->getOrientation();
|
||||
model->setOrientation(Quaternion(angle, Vector3::VEC_J) * rot);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
#ifndef GAME_OBJECT_FRAME_CONTROLLER_H
|
||||
#define GAME_OBJECT_FRAME_CONTROLLER_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <vector.h>
|
||||
#include <quaternion.h>
|
||||
|
||||
#include "gameObjectFrame.h"
|
||||
|
||||
namespace vb01{
|
||||
class Model;
|
||||
}
|
||||
|
||||
namespace battleship{
|
||||
class GameObjectFrameController{
|
||||
public:
|
||||
static GameObjectFrameController* getSingleton();
|
||||
void update();
|
||||
void removeGameObjectFrame(int);
|
||||
void removeGameObjectFrames();
|
||||
void rotateGameObjectFrames(float);
|
||||
inline int getNumGameObjectFrames(){return gameObjectFrames.size();}
|
||||
inline void addGameObjectFrame(GameObjectFrame u){gameObjectFrames.push_back(u);}
|
||||
inline GameObjectFrame& getGameObjectFrame(int i){return gameObjectFrames[i];}
|
||||
inline bool isPlacingFrames(){return placingStructures;}
|
||||
inline void setPlacingFrames(bool ps){placingStructures = ps;}
|
||||
inline bool isPaintSelecting(){return paintSelecting;}
|
||||
inline void setPaintSelecting(bool ps){paintSelecting = ps;}
|
||||
inline bool isRotatingFrames(){return rotatingStructure;}
|
||||
inline void setRotatingFrames(bool rs){rotatingStructure = rs;}
|
||||
inline void setPaintSelectRowStart(vb01::Vector3 st){paintSelectRowStart = st;}
|
||||
private:
|
||||
GameObjectFrameController(){}
|
||||
void paintSelect(vb01::Vector3, float, float);
|
||||
void placeGameObjectFrame(int, vb01::Vector3, float, float);
|
||||
|
||||
std::vector<GameObjectFrame> gameObjectFrames;
|
||||
vb01::Vector3 paintSelectRowStart, rowDir;
|
||||
bool placingStructures = false, paintSelecting = false, rotatingStructure = false;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
#include <solUtil.h>
|
||||
|
||||
#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<string> 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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef UNIT_LISTBOX_H
|
||||
#define UNIT_LISTBOX_H
|
||||
|
||||
#include <listbox.h>
|
||||
|
||||
namespace battleship{
|
||||
class GameObjectListbox : public vb01Gui::Listbox{
|
||||
public:
|
||||
GameObjectListbox(bool, vb01::Vector2, vb01::Vector2, std::vector<std::string>, int, std::string);
|
||||
void onClose();
|
||||
private:
|
||||
bool unitListbox;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
+6
-6
@@ -11,8 +11,8 @@
|
||||
|
||||
#include "defConfigs.h"
|
||||
#include "inGameAppState.h"
|
||||
#include "consoleCommand.h"
|
||||
#include "unitFrameController.h"
|
||||
#include "console.h"
|
||||
#include "gameObjectFrameController.h"
|
||||
#include "concreteGuiManager.h"
|
||||
#include "vessel.h"
|
||||
|
||||
@@ -36,13 +36,13 @@ namespace battleship{
|
||||
ConcreteGuiManager::getSingleton()->readLuaScreenScript("console.lua");
|
||||
}
|
||||
|
||||
InGameAppState::ConsoleButton::ConsoleButton::ConsoleCommandEntryButton::ConsoleCommandEntryButton(Textbox *t, Listbox *l, Vector2 pos, Vector2 size, string name) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {
|
||||
InGameAppState::ConsoleButton::ConsoleButton::ConsoleCommandEntryButton::ConsoleCommandEntryButton(Textbox *t, Listbox *l, Vector2 pos, Vector2 size, string name) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", 257, true) {
|
||||
textbox = t;
|
||||
listbox = l;
|
||||
}
|
||||
|
||||
void InGameAppState::ConsoleButton::ConsoleButton::ConsoleCommandEntryButton::onClick() {
|
||||
ConsoleCommand::execute(wstringToString(textbox->getText()));
|
||||
Console::execute(wstringToString(textbox->getText()));
|
||||
}
|
||||
|
||||
InGameAppState::InGameAppState(vector<string> difficultyLevels, vector<string> factions, string mapName) : AbstractAppState(
|
||||
@@ -124,14 +124,14 @@ namespace battleship{
|
||||
|
||||
for(Player *p : Map::getSingleton()->getPlayers())
|
||||
for(Unit *u : p->getUnits())
|
||||
u->reinitUnit();
|
||||
u->reinit();
|
||||
}
|
||||
}
|
||||
|
||||
void InGameAppState::onAction(int bind, bool isPressed) {
|
||||
switch((Bind)bind){
|
||||
case Bind::TOGGLE_MAIN_MENU:
|
||||
if(isPressed && !UnitFrameController::getSingleton()->isPlacingFrames())
|
||||
if(isPressed && !GameObjectFrameController::getSingleton()->isPlacingFrames())
|
||||
toggleMainMenu();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
|
||||
#include "map.h"
|
||||
#include "player.h"
|
||||
#include "unitFactory.h"
|
||||
#include "gameObject.h"
|
||||
#include "gameObjectFactory.h"
|
||||
#include "pathfinder.h"
|
||||
#include "gameManager.h"
|
||||
#include "defConfigs.h"
|
||||
@@ -133,6 +134,23 @@ namespace battleship{
|
||||
string playerInd = "players";
|
||||
|
||||
for(int i = 0; i < numPlayers; i++){
|
||||
if(i == 0){
|
||||
int numNpcObjs = SOL_LUA_STATE[mapTable][playerInd][i + 1]["numNpcGameObjs"];
|
||||
|
||||
for(int j = 0; j < numNpcObjs; j++){
|
||||
sol::table npcObjTable = SOL_LUA_STATE[mapTable][playerInd][i + 1]["npcGameObjs"][j + 1];
|
||||
int id = npcObjTable["id"];
|
||||
|
||||
sol::table posTable = npcObjTable["pos"];
|
||||
Vector3 pos = Vector3(posTable["x"], posTable["y"], posTable["z"]);
|
||||
|
||||
sol::table rotTable = npcObjTable["rot"];
|
||||
Quaternion rot = Quaternion(rotTable["w"], rotTable["x"], rotTable["y"], rotTable["z"]);
|
||||
|
||||
addNpcGameObject((GameObject*)GameObjectFactory::createResourceDeposit(id, pos, rot));
|
||||
}
|
||||
}
|
||||
|
||||
//int spawnPointId = SOL_LUA_STATE[mapTable]["spawnPointInd"][i + 1][spawnPointId];
|
||||
int numUnits = SOL_LUA_STATE[mapTable][playerInd][i + 1]["numUnits"];
|
||||
|
||||
@@ -149,7 +167,7 @@ namespace battleship{
|
||||
|
||||
int id = unitTable["id"];
|
||||
|
||||
players[i]->addUnit(UnitFactory::createUnit(players[i], id, pos, rot));
|
||||
players[i]->addUnit(GameObjectFactory::createUnit(players[i], id, pos, rot));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace vb01{
|
||||
|
||||
namespace battleship{
|
||||
class Player;
|
||||
class GameObject;
|
||||
struct Cell;
|
||||
|
||||
class Map {
|
||||
@@ -58,6 +59,8 @@ namespace battleship{
|
||||
inline vb01::Vector3 getSpawnPoint(int i){return spawnPoints[i];}
|
||||
inline void addSpawnPoint(vb01::Vector3 sp){spawnPoints.push_back(sp);}
|
||||
inline std::vector<Map::Cell>& getCells(){return cells;}
|
||||
inline void addNpcGameObject(GameObject *obj){npcGameObjects.push_back(obj);}
|
||||
inline std::vector<GameObject*> getNpcGameObjects(){return npcGameObjects;}
|
||||
private:
|
||||
std::string mapTable = "map";
|
||||
vb01::Node *terrainNode = nullptr, *cellNode = nullptr;
|
||||
@@ -67,6 +70,7 @@ namespace battleship{
|
||||
std::vector<vb01::Vector3> spawnPoints;
|
||||
std::vector<Player*> players;
|
||||
std::vector<Cell> cells;
|
||||
std::vector<GameObject*> npcGameObjects;
|
||||
|
||||
Map(){}
|
||||
void preprareScene();
|
||||
|
||||
+40
-8
@@ -2,7 +2,8 @@
|
||||
#include "gameManager.h"
|
||||
#include "defConfigs.h"
|
||||
#include "cameraController.h"
|
||||
#include "unitFrameController.h"
|
||||
#include "gameObjectFactory.h"
|
||||
#include "gameObjectFrameController.h"
|
||||
#include "player.h"
|
||||
#include "map.h"
|
||||
#include "mesh.h"
|
||||
@@ -56,6 +57,7 @@ namespace battleship{
|
||||
|
||||
AssetManager *assetManager = AssetManager::getSingleton();
|
||||
assetManager->load(basePath + "Models/Units/", true);
|
||||
assetManager->load(basePath + "Models/Resources/", true);
|
||||
assetManager->load(basePath + DEFAULT_TEXTURE);
|
||||
}
|
||||
|
||||
@@ -413,7 +415,27 @@ namespace battleship{
|
||||
mapScript += "},\nplayers = {\n";
|
||||
|
||||
for(int i = 0; i < map->getNumPlayers(); i++){
|
||||
mapScript += "{\nspawnPoint = 0,\n";
|
||||
mapScript += "{\n";
|
||||
|
||||
if(i > 0)
|
||||
mapScript += "spawnPoint = 0,\n";
|
||||
else{
|
||||
vector<GameObject*> npcGameObjs = map->getNpcGameObjects();
|
||||
mapScript += "numNpcGameObjs = " + to_string(npcGameObjs.size()) + ",\n";
|
||||
mapScript += "npcGameObjs = {\n";
|
||||
|
||||
for(GameObject *npcGameObj : npcGameObjs){
|
||||
Vector3 pos = npcGameObj->getPos();
|
||||
string posStr = "x = " + to_string(pos.x) + ", y = " + to_string(pos.y) + ", z = " + to_string(pos.z);
|
||||
|
||||
Quaternion rot = npcGameObj->getRot();
|
||||
string rotStr = "w = " + to_string(rot.w) + ", x = " + to_string(rot.x) + ", y = " + to_string(rot.y) + ", z = " + to_string(rot.z);
|
||||
|
||||
mapScript += "{id = " + to_string(npcGameObj->getId()) + ", pos = {" + posStr + "}, rot = {" + rotStr + "}},\n";
|
||||
}
|
||||
|
||||
mapScript += "},\n";
|
||||
}
|
||||
|
||||
int numUnits = map->getPlayer(i)->getNumberOfUnits();
|
||||
mapScript += "numUnits = " + to_string(numUnits) + ",\n";
|
||||
@@ -545,7 +567,7 @@ namespace battleship{
|
||||
if(!(camCtr->isLookingAround() || mapEditor->isPushing()))
|
||||
camCtr->updateCameraPosition();
|
||||
|
||||
UnitFrameController *ufCtr = UnitFrameController::getSingleton();
|
||||
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
|
||||
|
||||
if(ufCtr->isPlacingFrames())
|
||||
ufCtr->update();
|
||||
@@ -578,21 +600,31 @@ namespace battleship{
|
||||
void MapEditorAppState::onDettached(){}
|
||||
|
||||
void MapEditorAppState::onAction(int bind, bool isPressed){
|
||||
UnitFrameController *ufCtr = UnitFrameController::getSingleton();
|
||||
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
|
||||
|
||||
switch((Bind)bind){
|
||||
case Bind::LOOK_AROUND:
|
||||
if(ufCtr->isPlacingFrames()){
|
||||
Player *player = Map::getSingleton()->getPlayer(0);
|
||||
UnitFrameController::UnitFrame &frame = ufCtr->getUnitFrame(0);
|
||||
player->addUnit(new Unit(player, frame.id, frame.model->getPosition(), frame.model->getOrientation()));
|
||||
Map *map = Map::getSingleton();
|
||||
Player *player = map->getPlayer(0);
|
||||
GameObjectFrame &frame = ufCtr->getGameObjectFrame(0);
|
||||
Model *model = frame.getModel();
|
||||
Vector3 pos = model->getPosition();
|
||||
Quaternion rot = model->getOrientation();
|
||||
|
||||
if(frame.getType() == GameObject::Type::RESOURCE_DEPOSIT){
|
||||
ResourceDeposit *dep = GameObjectFactory::createResourceDeposit(frame.getId(), pos, rot);
|
||||
map->addNpcGameObject((GameObject*)dep);
|
||||
}
|
||||
else
|
||||
player->addUnit(GameObjectFactory::createUnit(player, frame.getId(), pos, rot));
|
||||
}
|
||||
else
|
||||
CameraController::getSingleton()->setLookingAround(isPressed);
|
||||
|
||||
break;
|
||||
case Bind::DESELECT_STRUCTURE:
|
||||
ufCtr->removeUnitFrames();
|
||||
ufCtr->removeGameObjectFrames();
|
||||
ufCtr->setPlacingFrames(false);
|
||||
break;
|
||||
case Bind::INCREASE_RADIUS:
|
||||
|
||||
@@ -31,8 +31,17 @@ namespace battleship{
|
||||
inline int getFaction(){return faction;}
|
||||
inline int getSide(){return side;}
|
||||
inline vb01::Vector3 getSpawnPoint(){return spawnPoint;}
|
||||
inline int getRefineds(){return refineds;}
|
||||
inline void setRefineds(int ref){this->refineds = ref;}
|
||||
inline void addRefineds(int ref){this->refineds += ref;}
|
||||
inline int getWealth(){return wealth;}
|
||||
inline void setWealth(int w){this->wealth = w;}
|
||||
inline void addWealth(int w){this->wealth += w;}
|
||||
inline int getResearch(){return research;}
|
||||
inline void setResearch(int r){this->research = r;}
|
||||
inline void addResearch(int r){this->research += r;}
|
||||
private:
|
||||
int credits, faction, difficulty,side,id;
|
||||
int refineds = 0, wealth = 0, research = 0, faction, difficulty,side,id;
|
||||
std::vector<Unit*> units, selectedUnits;
|
||||
vb01::Vector3 spawnPoint;
|
||||
};
|
||||
|
||||
+4
-4
@@ -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) {
|
||||
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";
|
||||
|
||||
+3
-4
@@ -1,4 +1,3 @@
|
||||
#pragma once
|
||||
#ifndef PROJECTILE_H
|
||||
#define PROJECTILE_H
|
||||
|
||||
@@ -8,6 +7,7 @@
|
||||
#include <quaternion.h>
|
||||
|
||||
#include "gameManager.h"
|
||||
#include "gameObject.h"
|
||||
#include "util.h"
|
||||
|
||||
namespace vb01{
|
||||
@@ -19,7 +19,7 @@ namespace vb01{
|
||||
namespace battleship {
|
||||
class Unit;
|
||||
|
||||
class Projectile {
|
||||
class Projectile : public GameObject{
|
||||
public:
|
||||
Projectile(Unit*, vb01::Node*, vb01::Vector3, vb01::Vector3, vb01::Vector3, vb01::Vector3, int, int, int);
|
||||
virtual ~Projectile();
|
||||
@@ -40,8 +40,7 @@ namespace battleship {
|
||||
bool exploded = false;
|
||||
float speed, rayLength, scale;
|
||||
int damage, id, weaponTypeId;
|
||||
vb01::Vector3 initPos, pos, dirVec, leftVec, upVec;
|
||||
vb01::Quaternion rot;
|
||||
vb01::Vector3 initPos;
|
||||
s64 lastUpdateTime = 0;
|
||||
Unit *unit = nullptr;
|
||||
sf::SoundBuffer *shotSfxBuffer, *explosionSfxBuffer;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "resourceDeposit.h"
|
||||
|
||||
namespace battleship{
|
||||
using namespace vb01;
|
||||
|
||||
ResourceDeposit::ResourceDeposit(int id, Vector3 pos, Quaternion rot) : GameObject(GameObject::Type::RESOURCE_DEPOSIT, id, nullptr, pos, rot){
|
||||
initModel();
|
||||
placeAt(pos);
|
||||
orientAt(rot);
|
||||
}
|
||||
|
||||
void ResourceDeposit::update(){
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef RESOURCE_DEPOSIT_H
|
||||
#define RESOURCE_DEPOSIT_H
|
||||
|
||||
#include "gameObject.h"
|
||||
|
||||
namespace battleship{
|
||||
class ResourceDeposit : public GameObject{
|
||||
public:
|
||||
ResourceDeposit(int, vb01::Vector3, vb01::Quaternion);
|
||||
void update();
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -22,24 +22,30 @@ using namespace gameBase;
|
||||
using namespace std;
|
||||
|
||||
namespace battleship{
|
||||
Unit::Unit(Player *player, int id, Vector3 pos, Quaternion 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;
|
||||
|
||||
initProperties();
|
||||
initModel();
|
||||
initSound();
|
||||
initUnitStats();
|
||||
placeUnit(pos);
|
||||
orientUnit(rot);
|
||||
init();
|
||||
|
||||
hpBackgroundNode = createBar(lenHpBar, Vector4(0, 0, 0, 1));
|
||||
hpForegroundNode = createBar(lenHpBar, Vector4(0, 1, 0, 1));
|
||||
}
|
||||
|
||||
//TODO complete implementation
|
||||
Unit::~Unit() {
|
||||
}
|
||||
|
||||
void Unit::init(){
|
||||
initProperties();
|
||||
initModel();
|
||||
initSound();
|
||||
placeAt(pos);
|
||||
orientAt(rot);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -60,31 +66,6 @@ namespace battleship{
|
||||
length = corners[3].z - corners[0].z;
|
||||
}
|
||||
|
||||
void Unit::destroyModel(){
|
||||
Root::getSingleton()->getRootNode()->dettachChild(model);
|
||||
delete model;
|
||||
}
|
||||
|
||||
void Unit::initModel(){
|
||||
sol::state_view SOL_LUA_STATE = generateView();
|
||||
string basePath = SOL_LUA_STATE["basePath"][id + 1];
|
||||
string meshPath = SOL_LUA_STATE["meshPath"][id + 1];
|
||||
|
||||
model = new Model(basePath + meshPath);
|
||||
Root *root = Root::getSingleton();
|
||||
string libPath = root->getLibPath();
|
||||
|
||||
Material *mat = new Material(libPath + "texture");
|
||||
string f[]{GameManager::getSingleton()->getPath() + configData::DEFAULT_TEXTURE};
|
||||
Texture *diffuseTexture = new Texture(f, 1, false);
|
||||
mat->addBoolUniform("texturingEnabled", true);
|
||||
mat->addBoolUniform("lightingEnabled", false);
|
||||
mat->addTexUniform("textures[0]", diffuseTexture, true);
|
||||
|
||||
model->setMaterial(mat);
|
||||
root->getRootNode()->attachChild(model);
|
||||
}
|
||||
|
||||
void Unit::destroySound(){
|
||||
selectionSfx->stop();
|
||||
delete selectionSfx;
|
||||
@@ -92,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";
|
||||
@@ -101,14 +82,14 @@ namespace battleship{
|
||||
selectionSfx = new sf::Sound(*selectionSfxBuffer);
|
||||
}
|
||||
|
||||
void Unit::reinitUnit(){
|
||||
void Unit::reinit(){
|
||||
destroySound();
|
||||
destroyModel();
|
||||
initModel();
|
||||
initSound();
|
||||
initProperties();
|
||||
placeUnit(pos);
|
||||
orientUnit(rot);
|
||||
placeAt(pos);
|
||||
orientAt(rot);
|
||||
}
|
||||
|
||||
Node* Unit::createBar(float initLen, Vector4 color){
|
||||
@@ -129,8 +110,6 @@ namespace battleship{
|
||||
}
|
||||
|
||||
void Unit::initUnitStats(){
|
||||
hpBackgroundNode = createBar(lenHpBar, Vector4(0, 0, 0, 1));
|
||||
hpForegroundNode = createBar(lenHpBar, Vector4(0, 1, 0, 1));
|
||||
}
|
||||
|
||||
void Unit::update() {
|
||||
@@ -213,16 +192,6 @@ namespace battleship{
|
||||
removeOrder(orders.size() - 1);
|
||||
}
|
||||
|
||||
void Unit::placeUnit(Vector3 p) {
|
||||
model->setPosition(p);
|
||||
pos = p;
|
||||
}
|
||||
|
||||
void Unit::orientUnit(Quaternion rotQuat){
|
||||
model->setOrientation(rotQuat);
|
||||
rot = rotQuat;
|
||||
}
|
||||
|
||||
std::vector<Projectile*> Unit::getProjectiles(){
|
||||
std::vector<Projectile*> projectiles;
|
||||
InGameAppState *inGameState = ((InGameAppState*)GameManager::getSingleton()->getStateManager()->getAppStateByType((int)AppStateType::IN_GAME_STATE));
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#pragma once
|
||||
#include "external/vb01/quaternion.h"
|
||||
#ifndef UNIT_H
|
||||
#define UNIT_H
|
||||
|
||||
@@ -11,6 +9,7 @@
|
||||
#include <SFML/Audio.hpp>
|
||||
|
||||
#include "gameManager.h"
|
||||
#include "gameObject.h"
|
||||
#include "projectile.h"
|
||||
|
||||
namespace vb01{
|
||||
@@ -47,7 +46,7 @@ namespace battleship{
|
||||
enum class UnitClass {VESSEL, ENGINEER, SAMPLE_BUILDING};
|
||||
enum class UnitType {UNDERWATER, SEA_LEVEL, HOVER, LAND, AIR, NONE = -1};
|
||||
|
||||
class Unit {
|
||||
class Unit : public GameObject{
|
||||
public:
|
||||
Unit(Player*, int, vb01::Vector3, vb01::Quaternion);
|
||||
~Unit();
|
||||
@@ -56,38 +55,23 @@ namespace battleship{
|
||||
virtual void halt();
|
||||
void toggleSelection(bool);
|
||||
void setOrder(Order);
|
||||
void placeUnit(vb01::Vector3);
|
||||
void orientUnit(vb01::Quaternion);
|
||||
void addProjectile(Projectile*);
|
||||
std::vector<Projectile*> getProjectiles();
|
||||
virtual void addOrder(Order);
|
||||
virtual void reinitUnit();
|
||||
virtual void reinit();
|
||||
inline vb01::Vector3 getCorner(int i){return corners[i];}
|
||||
inline bool isSelected(){return selected;}
|
||||
inline bool isSelectable(){return selectable;}
|
||||
inline bool isDebuggable(){return debugging;}
|
||||
inline bool isWorking(){return working;}
|
||||
inline vb01::Vector2 getScreenPos(){return screenPos;}
|
||||
inline vb01::Vector3 getPos() {return pos;}
|
||||
inline vb01::Vector3* getPosPtr() {return &pos;}
|
||||
inline vb01::Quaternion getRot(){return rot;}
|
||||
inline float getLineOfSight() {return lineOfSight;}
|
||||
inline float getWidth() {return width;}
|
||||
inline float getHeight() {return height;}
|
||||
inline float getLength() {return length;}
|
||||
inline vb01::Model* getNode() {return model;}
|
||||
inline Player* getPlayer(){return player;}
|
||||
inline UnitType getType() {return type;}
|
||||
inline UnitClass getUnitClass() {return unitClass;}
|
||||
inline void toggleDebugging(bool d){this->debugging=d;}
|
||||
inline void takeDamage(int damage) {health -= damage;}
|
||||
inline int getId() {return id;}
|
||||
inline int getPlayerId() {return playerId;}
|
||||
inline vb01::Vector3 getDirVec() {return dirVec;}
|
||||
inline vb01::Vector3 getLeftVec() {return leftVec;}
|
||||
inline vb01::Vector3 getUpVec() {return upVec;}
|
||||
private:
|
||||
void updateScreenCoordinates();
|
||||
void init();
|
||||
inline bool canDisplayOrderLine(){return vb01::getTime() - orderLineDispTime < orderVecDispLength;}
|
||||
|
||||
const int orderVecDispLength = 2000;
|
||||
@@ -95,24 +79,19 @@ namespace battleship{
|
||||
sf::Sound *selectionSfx = nullptr;
|
||||
vb01::Node *hpBackgroundNode = nullptr, *hpForegroundNode = nullptr;
|
||||
protected:
|
||||
Player *player;
|
||||
UnitClass unitClass;
|
||||
UnitType type;
|
||||
vb01::Vector2 screenPos;
|
||||
std::vector<Order> orders;
|
||||
vb01::Vector3 pos = vb01::Vector3(0, 0, 0), upVec = vb01::Vector3(0, 1, 0), dirVec = vb01::Vector3(0, 0, 1), leftVec = vb01::Vector3(1, 0, 0), corners[8];
|
||||
vb01::Quaternion rot = vb01::Quaternion::QUAT_W;
|
||||
vb01::Vector3 corners[8];
|
||||
int health, maxHealth, cost, id, playerId, lenHpBar = 200;
|
||||
s64 orderLineDispTime = 0;
|
||||
vb01::Model *model;
|
||||
bool selected = false, selectable, debugging = false, working = true;
|
||||
float lineOfSight, range, width, height, length;
|
||||
bool working = true;
|
||||
float lineOfSight, range;
|
||||
|
||||
void removeOrder(int);
|
||||
void displayUnitStats(vb01::Node*, vb01::Node*, int, int, vb01::Vector2 = vb01::Vector2::VEC_ZERO);
|
||||
virtual void initProperties();
|
||||
virtual void destroyModel();
|
||||
virtual void initModel();
|
||||
virtual void destroySound();
|
||||
virtual void initSound();
|
||||
virtual void initUnitStats();
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#include "unitFactory.h"
|
||||
#include "player.h"
|
||||
#include "vehicle.h"
|
||||
#include "engineer.h"
|
||||
#include "defConfigs.h"
|
||||
|
||||
#include <solUtil.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace battleship{
|
||||
using namespace std;
|
||||
using namespace vb01;
|
||||
using namespace gameBase;
|
||||
|
||||
Unit* UnitFactory::createUnit(Player *player, int id, Vector3 pos, Quaternion rot){
|
||||
sol::state_view SOL_LUA_STATE = generateView();
|
||||
int unitClass = SOL_LUA_STATE["unitClass"][id + 1];
|
||||
Unit *unit = nullptr;
|
||||
|
||||
switch((UnitClass)unitClass){
|
||||
case UnitClass::ENGINEER:
|
||||
unit = new Engineer(player, id, pos, rot);
|
||||
break;
|
||||
default:
|
||||
unit = new Vehicle(player, id, pos, rot);
|
||||
break;
|
||||
}
|
||||
|
||||
return unit;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef UNIT_FACTORY_H
|
||||
#define UNIT_FACTORY_H
|
||||
|
||||
#include <vector.h>
|
||||
#include <quaternion.h>
|
||||
|
||||
namespace battleship{
|
||||
class Unit;
|
||||
class Player;
|
||||
|
||||
class UnitFactory{
|
||||
public:
|
||||
static Unit* createUnit(Player*, int, vb01::Vector3, vb01::Quaternion);
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,158 +0,0 @@
|
||||
#include <solUtil.h>
|
||||
|
||||
#include "unitFrameController.h"
|
||||
#include "unit.h"
|
||||
#include "util.h"
|
||||
#include "map.h"
|
||||
|
||||
#include <material.h>
|
||||
#include <meshData.h>
|
||||
#include <mesh.h>
|
||||
#include <model.h>
|
||||
#include <root.h>
|
||||
#include <ray.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace battleship{
|
||||
using namespace std;
|
||||
using namespace vb01;
|
||||
using namespace gameBase;
|
||||
|
||||
static UnitFrameController *unitFrameController = nullptr;
|
||||
|
||||
UnitFrameController::UnitFrame::UnitFrame(string modelPath, int i, int t, Vector3 pos, Quaternion rot) : id(i), type(t) {
|
||||
Root *root = Root::getSingleton();
|
||||
Material *mat = new Material(root->getLibPath() + "texture");
|
||||
mat->addBoolUniform("texturingEnabled", false);
|
||||
mat->addBoolUniform("lightingEnabled", false);
|
||||
mat->addVec4Uniform("diffuseColor", Vector4::VEC_ZERO);
|
||||
|
||||
model = new Model(modelPath);
|
||||
model->setWireframe(true);
|
||||
model->setMaterial(mat);
|
||||
model->setPosition(pos);
|
||||
model->setOrientation(rot);
|
||||
root->getRootNode()->attachChild(model);
|
||||
}
|
||||
|
||||
UnitFrameController* UnitFrameController::getSingleton(){
|
||||
if(!unitFrameController)
|
||||
unitFrameController = new UnitFrameController();
|
||||
|
||||
return unitFrameController;
|
||||
}
|
||||
|
||||
void UnitFrameController::paintSelect(Vector3 rowEnd, float width, float length){
|
||||
Vector3 rowDir = rowEnd - paintSelectRowStart;
|
||||
float lenRow = rowDir.getLength();
|
||||
float hypothenuse = sqrt(width * width + length * length);
|
||||
int numStructsInRow = int(lenRow / hypothenuse);
|
||||
|
||||
while(unitFrames.size() > numStructsInRow)
|
||||
removeUnitFrame(unitFrames.size() - 1);
|
||||
|
||||
if(unitFrames.size() < numStructsInRow){
|
||||
int structureId = unitFrames[0].id;
|
||||
sol::state_view SOL_LUA_STATE = generateView();
|
||||
string modelPath = (string)SOL_LUA_STATE["basePath"][structureId + 1] + (string)SOL_LUA_STATE["meshPath"][structureId + 1];
|
||||
Vector3 buildDir = rowDir;
|
||||
|
||||
if(unitFrames.size() > 1)
|
||||
buildDir = unitFrames[1].model->getPosition() - unitFrames[0].model->getPosition();
|
||||
|
||||
Vector3 pos = paintSelectRowStart + buildDir.norm() * hypothenuse * unitFrames.size();
|
||||
addUnitFrame(UnitFrame(modelPath, structureId, (int)UnitType::LAND, pos));
|
||||
}
|
||||
}
|
||||
|
||||
//TODO implement terrain evenness check
|
||||
void UnitFrameController::placeUnitFrame(int id, Vector3 newPos, float width, float length){
|
||||
UnitFrame &s = unitFrames[id];
|
||||
|
||||
if(!rotatingStructure)
|
||||
s.model->setPosition(newPos);
|
||||
|
||||
Map *map = Map::getSingleton();
|
||||
MeshData meshData = map->getNodeParent()->getChild(0)->getMesh(0)->getMeshBase();
|
||||
MeshData::Vertex *verts = meshData.vertices;
|
||||
int numVerts = 3 * meshData.numTris;
|
||||
|
||||
float maxUnevenness = generateView()["maxUnevenness"], unevenness = 0;
|
||||
|
||||
for(int i = 0; i < numVerts; i++){
|
||||
float diffX = fabs(s.model->getPosition().x - verts[i].pos.x);
|
||||
float diffY = fabs(s.model->getPosition().y - verts[i].pos.y);
|
||||
float diffZ = fabs(s.model->getPosition().z - verts[i].pos.z);
|
||||
|
||||
if(diffX < 0.5 * width && diffZ < 0.5 * length && diffY > unevenness){
|
||||
unevenness = diffY;
|
||||
|
||||
if(unevenness > maxUnevenness)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Vector4 color;
|
||||
|
||||
if(unevenness > maxUnevenness){
|
||||
color = Vector4(1, 0, 0, 1);
|
||||
s.status = UnitFrame::NOT_PLACEABLE;
|
||||
}
|
||||
else{
|
||||
color = Vector4(0, 1, 0, 1);
|
||||
s.status = UnitFrame::PLACEABLE;
|
||||
}
|
||||
|
||||
Material *mat = s.model->getMaterial();
|
||||
mat->setVec4Uniform("diffuseColor", color);
|
||||
}
|
||||
|
||||
void UnitFrameController::update(){
|
||||
Vector3 startPos = Root::getSingleton()->getCamera()->getPosition();
|
||||
vector<Ray::CollisionResult> results;
|
||||
Ray::retrieveCollisions(startPos, (screenToSpace(getCursorPos()) - startPos).norm(), Map::getSingleton()->getNodeParent()->getChild(0), results);
|
||||
Ray::sortResults(results);
|
||||
if(results.empty()) return;
|
||||
|
||||
Vector3 newPos, rowEnd;
|
||||
sol::state_view SOL_LUA_STATE = generateView();
|
||||
sol::table unitTable = SOL_LUA_STATE["unitCornerPoints"][unitFrames[0].id + 1];
|
||||
float width = (float)unitTable[1]["x"] - (float)unitTable[2]["x"];
|
||||
float length = (float)unitTable[4]["z"] - (float)unitTable[1]["z"];
|
||||
|
||||
if(paintSelecting)
|
||||
paintSelect(results[0].pos, width, length);
|
||||
else if(!(paintSelecting || rotatingStructure))
|
||||
newPos = results[0].pos;
|
||||
|
||||
for(int i = 0; i < unitFrames.size(); i++){
|
||||
if(paintSelecting){
|
||||
float hypothenuse = sqrt(width * width + length * length);
|
||||
Vector3 dir = (results[0].pos - paintSelectRowStart).norm();
|
||||
newPos = paintSelectRowStart + dir * hypothenuse * i;
|
||||
}
|
||||
|
||||
placeUnitFrame(i, newPos, width, length);
|
||||
}
|
||||
}
|
||||
|
||||
void UnitFrameController::removeUnitFrame(int i){
|
||||
unitFrames[i].model->getParent()->dettachChild(unitFrames[i].model);
|
||||
delete unitFrames[i].model;
|
||||
unitFrames.erase(unitFrames.begin() + i);
|
||||
}
|
||||
|
||||
void UnitFrameController::removeUnitFrames(){
|
||||
while(unitFrames.size() > 0)
|
||||
removeUnitFrame(0);
|
||||
}
|
||||
|
||||
void UnitFrameController::rotateUnitFrames(float angle){
|
||||
for(UnitFrame &s : unitFrames)
|
||||
if(s.status != UnitFrame::PLACED){
|
||||
Quaternion rot = s.model->getOrientation();
|
||||
s.model->setOrientation(Quaternion(angle, Vector3::VEC_J) * rot);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
#ifndef UNIT_FRAME_CONTROLLER_H
|
||||
#define UNIT_FRAME_CONTROLLER_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <vector.h>
|
||||
#include <quaternion.h>
|
||||
|
||||
namespace vb01{
|
||||
class Model;
|
||||
}
|
||||
|
||||
namespace battleship{
|
||||
class UnitFrameController{
|
||||
public:
|
||||
struct UnitFrame{
|
||||
enum Status{PLACEABLE, NOT_PLACEABLE, PLACED};
|
||||
|
||||
UnitFrame(std::string, int, int, vb01::Vector3 = vb01::Vector3::VEC_ZERO, vb01::Quaternion = vb01::Quaternion::QUAT_W);
|
||||
~UnitFrame(){}
|
||||
void update();
|
||||
|
||||
vb01::Model *model;
|
||||
int id, type;
|
||||
Status status;
|
||||
};
|
||||
|
||||
static UnitFrameController* getSingleton();
|
||||
void update();
|
||||
void removeUnitFrame(int);
|
||||
void removeUnitFrames();
|
||||
void rotateUnitFrames(float);
|
||||
inline int getNumUnitFrames(){return unitFrames.size();}
|
||||
inline void addUnitFrame(UnitFrame u){unitFrames.push_back(u);}
|
||||
inline UnitFrame& getUnitFrame(int i){return unitFrames[i];}
|
||||
inline bool isPlacingFrames(){return placingStructures;}
|
||||
inline void setPlacingFrames(bool ps){placingStructures = ps;}
|
||||
inline bool isPaintSelecting(){return paintSelecting;}
|
||||
inline void setPaintSelecting(bool ps){paintSelecting = ps;}
|
||||
inline bool isRotatingFrames(){return rotatingStructure;}
|
||||
inline void setRotatingFrames(bool rs){rotatingStructure = rs;}
|
||||
inline void setPaintSelectRowStart(vb01::Vector3 st){paintSelectRowStart = st;}
|
||||
private:
|
||||
UnitFrameController(){}
|
||||
void paintSelect(vb01::Vector3, float, float);
|
||||
void placeUnitFrame(int, vb01::Vector3, float, float);
|
||||
|
||||
std::vector<UnitFrame> unitFrames;
|
||||
vb01::Vector3 paintSelectRowStart, rowDir;
|
||||
bool placingStructures = false, paintSelecting = false, rotatingStructure = false;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,26 +0,0 @@
|
||||
#include <solUtil.h>
|
||||
|
||||
#include "unitListbox.h"
|
||||
#include "unit.h"
|
||||
#include "unitFrameController.h"
|
||||
|
||||
namespace battleship{
|
||||
using namespace std;
|
||||
using namespace vb01;
|
||||
using namespace vb01Gui;
|
||||
using namespace gameBase;
|
||||
|
||||
UnitListbox::UnitListbox(Vector2 pos, Vector2 size, vector<string> lines, int maxDisplay, string fontPath) : Listbox(pos, size, lines, maxDisplay, fontPath){
|
||||
}
|
||||
|
||||
void UnitListbox::onClose(){
|
||||
UnitFrameController *ufCtr = UnitFrameController::getSingleton();
|
||||
|
||||
int id = selectedOption;
|
||||
sol::state_view SOL_LUA_STATE = generateView();
|
||||
string modelPath = (string)SOL_LUA_STATE["basePath"][id + 1] + (string)SOL_LUA_STATE["meshPath"][id + 1];
|
||||
ufCtr->addUnitFrame(UnitFrameController::UnitFrame(modelPath, id, (int)UnitType::LAND));
|
||||
|
||||
ufCtr->setPlacingFrames(true);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef UNIT_LISTBOX_H
|
||||
#define UNIT_LISTBOX_H
|
||||
|
||||
#include <listbox.h>
|
||||
|
||||
namespace battleship{
|
||||
class UnitListbox : public vb01Gui::Listbox{
|
||||
public:
|
||||
UnitListbox(vb01::Vector2, vb01::Vector2, std::vector<std::string>, int, std::string);
|
||||
void onClose();
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
+3
-3
@@ -60,7 +60,7 @@ namespace battleship{
|
||||
break;
|
||||
}
|
||||
|
||||
placeUnit(pos + dir * speed);
|
||||
placeAt(pos + dir * speed);
|
||||
}
|
||||
|
||||
void Vehicle::initProperties(){
|
||||
@@ -122,12 +122,12 @@ namespace battleship{
|
||||
Ray::sortResults(res);
|
||||
|
||||
if(!res.empty()){
|
||||
placeUnit(res[0].pos);
|
||||
placeAt(res[0].pos);
|
||||
|
||||
float angle = upVec.getAngleBetween(res[0].norm);
|
||||
Vector3 axis = upVec.cross(res[0].norm).norm();
|
||||
Quaternion rotQuat = Quaternion(angle, axis);
|
||||
orientUnit(rotQuat * rot);
|
||||
orientAt(rotQuat * rot);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user