diff --git a/Assets/Scripts/Gui/playerSelection.lua b/Assets/Scripts/Gui/playerSelection.lua index 397ea42..4b3ae1b 100644 --- a/Assets/Scripts/Gui/playerSelection.lua +++ b/Assets/Scripts/Gui/playerSelection.lua @@ -1,10 +1,19 @@ playerListboxPos = {x = 110, y = 10, z = 0} Pos = {x = playerListboxPos.x, y = playerListboxPos.y, z = playerListboxPos.z} +FactionListboxSize = {x = 270, y = 20} Size = {x = 150, y = 20} gap = 10 gapFactor = 3 -factions = {'None', 'Asian Co-Prosperity Sphere', 'America inc.', 'European Republic'} +function generateFactions(humanPlayer) + factions = {'None', 'Asian Co-Prosperity Sphere', 'America inc.', 'European Republic'} + + if humanPlayer then table.remove(factions, 1) end + + return factions +end + +factions = generateFactions(lineId == MAIN_PLAYER_ID) difficulties = {"Easy", "Medium", "Hard"} colors = {'White', 'Black', 'Red'} teams = {'0', '1', '2', '3', '4'} @@ -12,7 +21,7 @@ teams = {'0', '1', '2', '3', '4'} gui = { { pos = {x = Pos.x, y = Pos.y + (gapFactor * Size.y + gap) * (lineId + 1), z = Pos.z}, - size = Size, + size = FactionListboxSize, guiType = GuiType.LISTBOX, name = 'factions', numMaxDisplay = 3, @@ -20,7 +29,7 @@ gui = { listboxType = ListboxType.FACTIONS }, { - pos = {x = Pos.x + Size.x + gap, y = Pos.y + (gapFactor * Size.y + gap) * (lineId + 1), z = Pos.z}, + pos = {x = Pos.x + FactionListboxSize.x + gap, y = Pos.y + (gapFactor * Size.y + gap) * (lineId + 1), z = Pos.z}, size = Size, guiType = GuiType.LISTBOX, name = 'difficulties', @@ -29,7 +38,7 @@ gui = { listboxType = ListboxType.CPU_DIFFICULTIES }, { - pos = {x = Pos.x + 2 * (Size.x + gap), y = Pos.y + (gapFactor * Size.y + gap) * (lineId + 1), z = Pos.z}, + pos = {x = Pos.x + FactionListboxSize.x + Size.x + 2 * gap, y = Pos.y + (gapFactor * Size.y + gap) * (lineId + 1), z = Pos.z}, size = Size, guiType = GuiType.LISTBOX, name = 'colors', @@ -38,7 +47,7 @@ gui = { listboxType = ListboxType.COLORS }, { - pos = {x = Pos.x + 3 * (Size.x + gap), y = Pos.y + (gapFactor * Size.y + gap) * (lineId + 1), z = Pos.z}, + pos = {x = Pos.x + FactionListboxSize.x + 2 * Size.x + 3 * gap, y = Pos.y + (gapFactor * Size.y + gap) * (lineId + 1), z = Pos.z}, size = Size, guiType = GuiType.LISTBOX, name = 'teams', diff --git a/Assets/Scripts/Gui/singlePlayerMenu.lua b/Assets/Scripts/Gui/singlePlayerMenu.lua index 5d13e8f..71fb002 100644 --- a/Assets/Scripts/Gui/singlePlayerMenu.lua +++ b/Assets/Scripts/Gui/singlePlayerMenu.lua @@ -6,6 +6,8 @@ music = { tracks = {'intro.ogg'} } +MAIN_PLAYER_ID = 0 + gui = { { pos = {x = 110, y = 310, z = 0}, diff --git a/playButton.cpp b/playButton.cpp index 785f5ef..903fc74 100644 --- a/playButton.cpp +++ b/playButton.cpp @@ -36,15 +36,21 @@ namespace battleship{ int selectedMap = mapListbox->getSelectedOption(); string mapName = wstringToString(mapListbox->getContents()[selectedMap]); int numPlayers = Map::getSingleton()->getNumMapSpawnPoints(mapName); + const int MAIN_PLAYER_ID = (int)generateView()["MAIN_PLAYER_ID"]; for(int i = 0; i < numPlayers; i++){ - int factionChoice = factionsListboxes[i]->getSelectedOption(); + int faction = factionsListboxes[i]->getSelectedOption(); + bool cpuPlayer; - if(factionChoice == 0) continue; + if(factionsListboxes[i]->getContents()[faction] == L"None") continue; - int faction = factionChoice - 1; + if(MAIN_PLAYER_ID == i) + cpuPlayer = false; + else{ + faction--; + cpuPlayer = true; + } - bool cpuPlayer = (i > 0); string diffStr = (cpuPlayer ? wstringToString(difficultiesListboxes[i]->getContents()[colorsListboxes[i]->getSelectedOption()]) : ""); int difficulty = -1;