Skip to content

Commit

Permalink
Merge pull request daid#46 from daid/master
Browse files Browse the repository at this point in the history
Update 14/01
  • Loading branch information
tdelc committed Jan 14, 2017
2 parents 4547184 + 780b9c0 commit 2cd8e5f
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 26 deletions.
17 changes: 11 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ if(NOT DEFINED SERIOUS_PROTON_DIR)
message(FATAL_ERROR "SERIOUS_PROTON_DIR was not set. Unable to continue")
endif(NOT DEFINED SERIOUS_PROTON_DIR)

if(DEFINED ENABLE_CRASH_LOGGER)
if(WIN32)
if(NOT DEFINED DRMINGW_ROOT)
message(FATAL_ERROR "DRMINGW_ROOT was not set. Unable to continue")
endif(NOT DEFINED DRMINGW_ROOT)
endif(WIN32)
endif(DEFINED ENABLE_CRASH_LOGGER)

string(TIMESTAMP CPACK_PACKAGE_VERSION_MAJOR "%Y")
string(TIMESTAMP CPACK_PACKAGE_VERSION_MINOR "%m")
string(TIMESTAMP CPACK_PACKAGE_VERSION_PATCH "%d")
Expand All @@ -18,12 +26,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
# install resources, scripts, and packs to app bundle instead of system dir.
if(APPLE)
set(CMAKE_INSTALL_PREFIX "./")
endif()

# set INSTALL_PREFIX for linux so that the built binary is able to find resources
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D INSTALL_PREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\"")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D INSTALL_PREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\"")
elseif(UNIX)
# Set RESOURCE_BASE_DIR on Unix so the built binary is able to find resources
add_definitions(-DRESOURCE_BASE_DIR="${CMAKE_INSTALL_PREFIX}/share/emptyepsilon/")
endif()

## ensure c++11 is used
Expand Down
7 changes: 4 additions & 3 deletions scripts/scenario_02_beacon.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- Name: Beacon of light series
-- Description: The beacon of light scenario, build from the series at EmptyEpsilon.org.
--- Near the far outpost of Orion-5, Kraylor attacks are increasing. A diplomat went missing, and your mission will start with recovering him.
--- Near the far outpost of Orion-5, Kraylor attacks are increasing. A diplomat went missing, and your mission will start with recovering him. (Must use Epsilon as ship)
-- Type: Mission

-- Init is run when the scenario is started. Create your initial world
Expand Down Expand Up @@ -253,8 +253,9 @@ function missionStopTransport(delta)
transport_target:setImpulseMaxSpeed(70):setJumpDrive(true)
mission_state = missionTransportWaitForRecovery
mission_timer = 40

transport_recovery_team = CpuShip():setTemplate("Flavia"):setFaction("Human Navy"):setPosition(-22000, 30000)

local x, y = transport_target:getPosition()
transport_recovery_team = CpuShip():setTemplate("Flavia"):setFaction("Human Navy"):setPosition(x - random(8000, 10000), y + random(8000, 10000))
transport_recovery_team:setCallSign("RTRV"):setScanned(true)
transport_recovery_team:orderFlyTowardsBlind(transport_target:getPosition()):setCommsScript("")
end
Expand Down
18 changes: 9 additions & 9 deletions scripts/scenario_08_atlantis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,15 @@ We are reading a huge gravity surge from your direction. Get the hell out of the

--The explosion damages all systems, but makes sure the impulse, warp and jumpdrive are none-functional. This prevents the player from escaping the grasp of the wormhole.
--We made sure we are around 2U of the wormhole before this function is called.
player:setSystemHealth("reactor", getSystemHealth("reactor") - random(0.0, 0.5))
player:setSystemHealth("beamweapons", getSystemHealth("beamweapons") - random(0.0, 0.5))
player:setSystemHealth("maneuver", getSystemHealth("maneuver") - random(0.0, 0.5))
player:setSystemHealth("missilesystem", getSystemHealth("missilesystem") - random(0.0, 0.5))
player:setSystemHealth("impulse", getSystemHealth("impulse") - random(1.3, 1.5))
player:setSystemHealth("warp", getSystemHealth("warp") - random(1.3, 1.5))
player:setSystemHealth("jumpdrive", getSystemHealth("jumpdrive") - random(1.3, 1.5))
player:setSystemHealth("frontshield", getSystemHealth("frontshield") - random(0.0, 0.5))
player:setSystemHealth("rearshield", getSystemHealth("rearshield") - random(0.0, 0.5))
player:setSystemHealth("reactor", player:getSystemHealth("reactor") - random(0.0, 0.5))
player:setSystemHealth("beamweapons", player:getSystemHealth("beamweapons") - random(0.0, 0.5))
player:setSystemHealth("maneuver", player:getSystemHealth("maneuver") - random(0.0, 0.5))
player:setSystemHealth("missilesystem", player:getSystemHealth("missilesystem") - random(0.0, 0.5))
player:setSystemHealth("impulse", player:getSystemHealth("impulse") - random(1.3, 1.5))
player:setSystemHealth("warp", player:getSystemHealth("warp") - random(1.3, 1.5))
player:setSystemHealth("jumpdrive", player:getSystemHealth("jumpdrive") - random(1.3, 1.5))
player:setSystemHealth("frontshield", player:getSystemHealth("frontshield") - random(0.0, 0.5))
player:setSystemHealth("rearshield", player:getSystemHealth("rearshield") - random(0.0, 0.5))

mission_state = phase2WaitTillWormholeWarpedPlayer
end
Expand Down
1 change: 1 addition & 0 deletions src/gameGlobalInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum EPlayerWarpJumpDrive
PWJ_WarpDrive,
PWJ_JumpDrive,
PWJ_WarpAndJumpDrive,
PWJ_None,
PWJ_MAX,
};
enum EScanningComplexity
Expand Down
7 changes: 0 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@
#include <libgen.h>
#endif

#ifdef __linux__
#ifndef INSTALL_PREFIX
#define INSTALL_PREFIX "/usr/local"
#endif
#define RESOURCE_BASE_DIR INSTALL_PREFIX "/share/emptyepsilon/"
#endif

sf::Vector3f camera_position;
float camera_yaw;
float camera_pitch;
Expand Down
2 changes: 1 addition & 1 deletion src/menus/serverCreationScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ServerCreationScreen::ServerCreationScreen()
(new GuiLabel(row, "WARP_JUMP_LABEL", "Warp/Jump: ", 30))->setAlignment(ACenterRight)->setSize(250, GuiElement::GuiSizeMax);
(new GuiSelector(row, "WARP_JUMP_SELECT", [](int index, string value) {
gameGlobalInfo->player_warp_jump_drive_setting = EPlayerWarpJumpDrive(index);
}))->setOptions({"Ship default", "Warp drive", "Jump drive", "Both"})->setSelectionIndex((int)gameGlobalInfo->player_warp_jump_drive_setting)->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax);
}))->setOptions({"Ship default", "Warp drive", "Jump drive", "Both", "Neither"})->setSelectionIndex((int)gameGlobalInfo->player_warp_jump_drive_setting)->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax);

// Radar range limit row.
row = new GuiAutoLayout(left_panel, "", GuiAutoLayout::LayoutHorizontalLeftToRight);
Expand Down
1 change: 1 addition & 0 deletions src/screens/crew6/scienceScreen.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "playerInfo.h"
#include "gameGlobalInfo.h"
#include "scienceScreen.h"
#include "scienceDatabase.h"
#include "spaceObjects/nebula.h"

#include "screenComponents/radarView.h"
Expand Down
1 change: 1 addition & 0 deletions src/screens/extra/databaseScreen.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "databaseScreen.h"
#include "scienceDatabase.h"

#include "screenComponents/databaseView.h"

Expand Down
4 changes: 4 additions & 0 deletions src/spaceObjects/playerSpaceship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,10 @@ void PlayerSpaceship::applyTemplateValues()
setWarpDrive(true);
setJumpDrive(true);
break;
case PWJ_None:
setWarpDrive(false);
setJumpDrive(false);
break;
}

// Set the ship's number of repair crews in Engineering from the ship's
Expand Down
5 changes: 5 additions & 0 deletions src/spaceObjects/spaceship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ REGISTER_SCRIPT_SUBCLASS_NO_CREATE(SpaceShip, ShipTemplateBasedObject)
REGISTER_SCRIPT_CLASS_FUNCTION(SpaceShip, setWeaponStorage);
REGISTER_SCRIPT_CLASS_FUNCTION(SpaceShip, setWeaponStorageMax);
REGISTER_SCRIPT_CLASS_FUNCTION(SpaceShip, getShieldsFrequency);
REGISTER_SCRIPT_CLASS_FUNCTION(SpaceShip, setShieldsFrequency);
REGISTER_SCRIPT_CLASS_FUNCTION(SpaceShip, getMaxEnergy);
REGISTER_SCRIPT_CLASS_FUNCTION(SpaceShip, setMaxEnergy);
REGISTER_SCRIPT_CLASS_FUNCTION(SpaceShip, getEnergy);
REGISTER_SCRIPT_CLASS_FUNCTION(SpaceShip, setEnergy);
REGISTER_SCRIPT_CLASS_FUNCTION(SpaceShip, getSystemHealth);
REGISTER_SCRIPT_CLASS_FUNCTION(SpaceShip, setSystemHealth);
REGISTER_SCRIPT_CLASS_FUNCTION(SpaceShip, getSystemHeat);
Expand Down
5 changes: 5 additions & 0 deletions src/spaceObjects/spaceship.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ class SpaceShip : public ShipTemplateBasedObject
int getWeaponStorageMax(EMissileWeapons weapon) { if (weapon == MW_None) return 0; return weapon_storage_max[weapon]; }
void setWeaponStorage(EMissileWeapons weapon, int amount) { if (weapon == MW_None) return; weapon_storage[weapon] = amount; }
void setWeaponStorageMax(EMissileWeapons weapon, int amount) { if (weapon == MW_None) return; weapon_storage_max[weapon] = amount; weapon_storage[weapon] = std::min(int(weapon_storage[weapon]), amount); }
float getMaxEnergy() { return max_energy_level; }
void setMaxEnergy(float amount) { if (amount > 0.0) { max_energy_level = amount;} }
float getEnergy() { return energy_level; }
void setEnergy(float amount) { if ( (amount > 0.0) && (amount <= max_energy_level)) { energy_level = amount; } }
float getSystemHealth(ESystem system) { if (system >= SYS_COUNT) return 0.0; if (system <= SYS_None) return 0.0; return systems[system].health; }
void setSystemHealth(ESystem system, float health) { if (system >= SYS_COUNT) return; if (system <= SYS_None) return; systems[system].health = std::min(1.0f, std::max(-1.0f, health)); }
float getSystemHeat(ESystem system) { if (system >= SYS_COUNT) return 0.0; if (system <= SYS_None) return 0.0; return systems[system].heat_level; }
Expand Down Expand Up @@ -350,6 +354,7 @@ class SpaceShip : public ShipTemplateBasedObject
float getBeamWeaponHeatPerFire(int index) { if (index < 0 || index >= max_beam_weapons) return 0.0; return beam_weapons[index].getHeatPerFire(); }

int getShieldsFrequency(void){ return shield_frequency; }
void setShieldsFrequency(float freq) { if ((freq > SpaceShip::max_frequency) || (freq < 0)) return; shield_frequency = freq;}

void setBeamWeapon(int index, float arc, float direction, float range, float cycle_time, float damage)
{
Expand Down

0 comments on commit 2cd8e5f

Please sign in to comment.