Skip to content

Commit

Permalink
Merge branch 'release' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
rt committed Mar 20, 2013
2 parents 4737378 + dc51bc4 commit ee5c049
Show file tree
Hide file tree
Showing 17 changed files with 230 additions and 192 deletions.
5 changes: 0 additions & 5 deletions buildbot/slave/validation/tests-cleanup.sh
Expand Up @@ -6,11 +6,6 @@ set -e

TESTDIR=${TMP_BASE}/tests

#FIXME/HACK reset directory permissions
if [ -d ${TESTDIR}/usr/local/share/games/spring ]; then
chmod 755 ${TESTDIR}/usr/local/share/games/spring
fi

#cleanup
rm -rf ${TESTDIR}

5 changes: 1 addition & 4 deletions buildbot/slave/validation/tests-prepare.sh
Expand Up @@ -20,9 +20,6 @@ fi
cd ${BUILDDIR}
DESTDIR=${TESTDIR} ninja install-spring-headless install-pr-downloader demotool unitsyncTest lua2php

# HACK/FIXME force spring to detect install dir as read-only
chmod 555 ${TESTDIR}/usr/local/share/games/spring

cd ${SOURCEDIR}

function makescript {
Expand Down Expand Up @@ -66,7 +63,7 @@ cp -v ${SOURCEDIR}/test/validation/LuaUI/Config/ZK_data.lua ${CONTENT_DIR}/LuaUI
cp -v ${SOURCEDIR}/cont/springrc-template-headless.txt ${TESTDIR}/.springrc

#set data directory to test directory
echo "SpringData = ${TESTDIR}/usr/local/share/games/spring" >> ${TESTDIR}/.springrc
echo "SpringData = ${CONTENT_DIR}:${TESTDIR}/usr/local/share/games/spring" >> ${TESTDIR}/.springrc

makescript "$GAME1" "$MAP" AAI 0.9
makescript "$GAME1" "$MAP" E323AI 3.25.0
Expand Down
7 changes: 5 additions & 2 deletions doc/changelog.txt
Expand Up @@ -31,15 +31,18 @@ Bugfixes:
- fix #3545 (AddUnitImpulse() causes unit to move in random direction)
- fix #3544 (units briefly invisible when transferred to another team)
- fix #3490 (ships cannot be transported by aircraft)
- fix #3596 (in debug-mode the firing-cone visualisation of weapons points up)
- fix 'fix #3506 (wrong calculation of goffset for assimp model pieces)'
- fix pseudo-static units (nanotowers, etc) no longer being transportable
- fix #3569 (texturing for OBJ and ASS projectile models)
- fix OBJ models being parsed by assimp
- fix SEGV on exit
- Fix flashing team colors
- fix flashing team colors
- fix some trees drawn after being destroyed

Lua:
- add Spring.UnitWeapon{Fire,HoldFire}(number unitID, number weaponID) --> nil
- add callouts Spring.Weapon{TryTarget,TestTarget,TestRange,HaveFreeLineOfFire}(number attackerID, number attackeeID, number weaponID, number targetPosX, number targetPosY, number targetPosZ) --> boolean
- add callouts Spring.GetUnitWeapon{TryTarget,TestTarget,TestRange,HaveFreeLineOfFire}(number attackerID, number weaponID, number attackeeID | [number targetPosX, number targetPosY, number targetPosZ]) --> boolean
- add Spring.SetProjectileTarget(number projectileID, [number objectID, string objectType] | [number x, number y, number z]) --> boolean
- add Spring.GetProjectileTarget(number projectileID) --> number targetID, string targetType
- add Spring.SpawnProjectile(number weaponDefID, table projectileParams) --> number projectileID | nil
Expand Down
12 changes: 6 additions & 6 deletions rts/Game/GameVersion.cpp
Expand Up @@ -76,20 +76,20 @@ std::string GetAdditional()
#define GV_ADD_SPACE " "
#endif

#if defined USE_GML
GV_ADD_SPACE "GML"
#if defined USE_GML_SIM
GV_ADD_SPACE "ASIM"
#undef GV_ADD_SPACE
#define GV_ADD_SPACE " "
#endif

#if defined USE_GML_DEBUG
GV_ADD_SPACE "GDB"
#if defined USE_GML
GV_ADD_SPACE "GML"
#undef GV_ADD_SPACE
#define GV_ADD_SPACE " "
#endif

#if defined USE_GML_SIM
GV_ADD_SPACE "ASIM"
#if defined USE_GML_DEBUG
GV_ADD_SPACE "GDB"
#undef GV_ADD_SPACE
#define GV_ADD_SPACE " "
#endif
Expand Down
173 changes: 92 additions & 81 deletions rts/Lua/LuaSyncedRead.cpp
Expand Up @@ -221,6 +221,9 @@ bool LuaSyncedRead::PushEntries(lua_State* L)
REGISTER_LUA_CFUNC(GetUnitWeaponState);
REGISTER_LUA_CFUNC(GetUnitWeaponVectors);
REGISTER_LUA_CFUNC(GetUnitWeaponTryTarget);
REGISTER_LUA_CFUNC(GetUnitWeaponTestTarget);
REGISTER_LUA_CFUNC(GetUnitWeaponTestRange);
REGISTER_LUA_CFUNC(GetUnitWeaponHaveFreeLineOfFire);
REGISTER_LUA_CFUNC(GetUnitTravel);
REGISTER_LUA_CFUNC(GetUnitFuel);
REGISTER_LUA_CFUNC(GetUnitEstimatedPath);
Expand Down Expand Up @@ -303,11 +306,6 @@ bool LuaSyncedRead::PushEntries(lua_State* L)
REGISTER_LUA_CFUNC(GetUnitScriptPiece);
REGISTER_LUA_CFUNC(GetUnitScriptNames);

REGISTER_LUA_CFUNC(WeaponTryTarget);
REGISTER_LUA_CFUNC(WeaponTestTarget);
REGISTER_LUA_CFUNC(WeaponTestRange);
REGISTER_LUA_CFUNC(WeaponHaveFreeLineOfFire);

REGISTER_LUA_CFUNC(GetCOBUnitVar);
REGISTER_LUA_CFUNC(GetCOBTeamVar);
REGISTER_LUA_CFUNC(GetCOBAllyTeamVar);
Expand Down Expand Up @@ -3257,7 +3255,7 @@ int LuaSyncedRead::GetUnitWeaponTryTarget(lua_State* L)
return 0;
}

const CWeapon* weapon = unit->weapons[weaponNum];
const CWeapon* weapon = unit->weapons[weaponNum];
const CUnit* enemy = NULL;

float3 pos;
Expand All @@ -3275,6 +3273,94 @@ int LuaSyncedRead::GetUnitWeaponTryTarget(lua_State* L)
}


int LuaSyncedRead::GetUnitWeaponTestTarget(lua_State* L)
{
CUnit* unit = ParseAllyUnit(L, __FUNCTION__, 1);
if (unit == NULL) {
return 0;
}
const int weaponNum = luaL_checkint(L, 2);
if ((weaponNum < 0) || ((size_t)weaponNum >= unit->weapons.size())) {
return 0;
}

const CWeapon* weapon = unit->weapons[weaponNum];
const CUnit* enemy = NULL;

float3 pos;

if (lua_gettop(L) >= 5) {
pos.x = luaL_optnumber(L, 3, 0.0f);
pos.y = luaL_optnumber(L, 4, 0.0f);
pos.z = luaL_optnumber(L, 5, 0.0f);
} else {
enemy = ParseUnit(L, __FUNCTION__, 3);
}

lua_pushboolean(L, weapon->TestTarget(pos, true, enemy));
return 1;
}


int LuaSyncedRead::GetUnitWeaponTestRange(lua_State* L)
{
CUnit* unit = ParseAllyUnit(L, __FUNCTION__, 1);
if (unit == NULL) {
return 0;
}
const int weaponNum = luaL_checkint(L, 2);
if ((weaponNum < 0) || ((size_t)weaponNum >= unit->weapons.size())) {
return 0;
}

const CWeapon* weapon = unit->weapons[weaponNum];
const CUnit* enemy = NULL;

float3 pos;

if (lua_gettop(L) >= 5) {
pos.x = luaL_optnumber(L, 3, 0.0f);
pos.y = luaL_optnumber(L, 4, 0.0f);
pos.z = luaL_optnumber(L, 5, 0.0f);
} else {
enemy = ParseUnit(L, __FUNCTION__, 3);
}

lua_pushboolean(L, weapon->TestRange(pos, true, enemy));
return 1;
}


int LuaSyncedRead::GetUnitWeaponHaveFreeLineOfFire(lua_State* L)
{
CUnit* unit = ParseAllyUnit(L, __FUNCTION__, 1);
if (unit == NULL) {
return 0;
}
const int weaponNum = luaL_checkint(L, 2);
if ((weaponNum < 0) || ((size_t)weaponNum >= unit->weapons.size())) {
return 0;
}

const CWeapon* weapon = unit->weapons[weaponNum];
const CUnit* enemy = NULL;

float3 pos;

if (lua_gettop(L) >= 5) {
pos.x = luaL_optnumber(L, 3, 0.0f);
pos.y = luaL_optnumber(L, 4, 0.0f);
pos.z = luaL_optnumber(L, 5, 0.0f);
} else {
enemy = ParseUnit(L, __FUNCTION__, 3);
}

lua_pushboolean(L, weapon->HaveFreeLineOfFire(pos, true, enemy));
return 1;
}



int LuaSyncedRead::GetUnitTravel(lua_State* L)
{
CUnit* unit = ParseAllyUnit(L, __FUNCTION__, 1);
Expand Down Expand Up @@ -5242,81 +5328,6 @@ int LuaSyncedRead::GetUnitScriptNames(lua_State* L)
}


/******************************************************************************/
/******************************************************************************/

int LuaSyncedRead::WeaponTryTarget(lua_State* L)
{
const CUnit* attacker = ParseUnit(L, __FUNCTION__, 1);
const CUnit* attackee = ParseUnit(L, __FUNCTION__, 2);

if (attacker == NULL)
return 0;

const unsigned int weaponID = luaL_checkint(L, 3);
const float3 targetPos = float3(luaL_checkfloat(L, 4), luaL_checkfloat(L, 5), luaL_checkfloat(L, 6));

if (weaponID >= attacker->weapons.size())
return 0;

lua_pushboolean(L, attacker->weapons[weaponID]->TryTarget(targetPos, false, attackee));
return 1;
}

int LuaSyncedRead::WeaponTestTarget(lua_State* L)
{
const CUnit* attacker = ParseUnit(L, __FUNCTION__, 1);
const CUnit* attackee = ParseUnit(L, __FUNCTION__, 2);

if (attacker == NULL)
return 0;

const unsigned int weaponID = luaL_checkint(L, 3);
const float3 targetPos = float3(luaL_checkfloat(L, 4), luaL_checkfloat(L, 5), luaL_checkfloat(L, 6));

if (weaponID >= attacker->weapons.size())
return 0;

lua_pushboolean(L, attacker->weapons[weaponID]->TestTarget(targetPos, false, attackee));
return 1;
}

int LuaSyncedRead::WeaponTestRange(lua_State* L)
{
const CUnit* attacker = ParseUnit(L, __FUNCTION__, 1);
const CUnit* attackee = ParseUnit(L, __FUNCTION__, 2);

if (attacker == NULL)
return 0;

const unsigned int weaponID = luaL_checkint(L, 3);
const float3 targetPos = float3(luaL_checkfloat(L, 4), luaL_checkfloat(L, 5), luaL_checkfloat(L, 6));

if (weaponID >= attacker->weapons.size())
return 0;

lua_pushboolean(L, attacker->weapons[weaponID]->TestRange(targetPos, false, attackee));
return 1;
}

int LuaSyncedRead::WeaponHaveFreeLineOfFire(lua_State* L)
{
const CUnit* attacker = ParseUnit(L, __FUNCTION__, 1);
const CUnit* attackee = ParseUnit(L, __FUNCTION__, 2);

if (attacker == NULL)
return 0;

const unsigned int weaponID = luaL_checkint(L, 3);
const float3 targetPos = float3(luaL_checkfloat(L, 4), luaL_checkfloat(L, 5), luaL_checkfloat(L, 6));

if (weaponID >= attacker->weapons.size())
return 0;

lua_pushboolean(L, attacker->weapons[weaponID]->HaveFreeLineOfFire(targetPos, false, attackee));
return 1;
}

/******************************************************************************/
/******************************************************************************/

Expand Down
8 changes: 3 additions & 5 deletions rts/Lua/LuaSyncedRead.h
Expand Up @@ -128,6 +128,9 @@ class LuaSyncedRead {
static int GetUnitWeaponState(lua_State* L);
static int GetUnitWeaponVectors(lua_State* L);
static int GetUnitWeaponTryTarget(lua_State* L);
static int GetUnitWeaponTestTarget(lua_State* L);
static int GetUnitWeaponTestRange(lua_State* L);
static int GetUnitWeaponHaveFreeLineOfFire(lua_State* L);
static int GetUnitTravel(lua_State* L);
static int GetUnitFuel(lua_State* L);
static int GetUnitEstimatedPath(lua_State* L);
Expand Down Expand Up @@ -214,11 +217,6 @@ class LuaSyncedRead {
static int GetUnitScriptPiece(lua_State* L);
static int GetUnitScriptNames(lua_State* L);

static int WeaponTryTarget(lua_State* L);
static int WeaponTestTarget(lua_State* L);
static int WeaponTestRange(lua_State* L);
static int WeaponHaveFreeLineOfFire(lua_State* L);

static int TraceRay(lua_State* L); // not implemented
static int TraceRayUnits(lua_State* L); // not implemented
static int TraceRayFeatures(lua_State* L); // not implemented
Expand Down
2 changes: 1 addition & 1 deletion rts/Lua/LuaUnitDefs.cpp
Expand Up @@ -918,7 +918,7 @@ ADD_BOOL("canAttackWater", canAttackWater); // CUSTOM
ADD_FLOAT("nanoColorB", ud.nanoColor.z);

ADD_STRING("scriptName", ud.scriptName);
ADD_STRING("scriptPath", ud.scriptName); // backward compability
ADD_STRING("scriptPath", ud.scriptName); //FIXME // backward compability

return true;
}
Expand Down
12 changes: 12 additions & 0 deletions rts/Rendering/GL/VBO.cpp
Expand Up @@ -12,6 +12,7 @@

#include "Rendering/GlobalRendering.h"
#include "System/Config/ConfigHandler.h"
#include "System/Log/ILog.h"

CONFIG(bool, UseVBO).defaultValue(true).safemodeValue(false);
CONFIG(bool, UsePBO).defaultValue(true).safemodeValue(false);
Expand Down Expand Up @@ -134,8 +135,19 @@ void VBO::Resize(GLsizeiptr _size, GLenum usage, const void* data_)

size = _size;
if (VBOused) {
glClearErrors();

this->usage = usage;
glBufferData(curBoundTarget, size, data_, usage);

const GLenum err = glGetError();
if (err != GL_NO_ERROR) {
LOG_L(L_ERROR, "VBO/PBO: out of memory");
Unbind();
VBOused = false;
Bind(curBoundTarget);
Resize(_size, usage, data_);
}
} else {
delete[] data;
data = NULL; // to prevent a dead-pointer in case of an out-of-memory exception on the next line
Expand Down
17 changes: 10 additions & 7 deletions rts/Rendering/Models/3DModel.cpp
Expand Up @@ -76,6 +76,7 @@ S3DModelPiece::S3DModelPiece()
, colvol(NULL)
, type(MODELTYPE_OTHER)
, isEmpty(true)
, mIsIdentity(true)
, dispListID(0)
{
}
Expand All @@ -99,10 +100,11 @@ unsigned int S3DModelPiece::CreateDrawForList() const

void S3DModelPiece::DrawStatic() const
{
const bool transform = (offset.SqLength() != 0.0f);
const bool transform = (offset.SqLength() != 0.0f || !mIsIdentity);

if (transform) {
glPushMatrix();
if (!mIsIdentity) glMultMatrixf(scaleRotMatrix);
glTranslatef(offset.x, offset.y, offset.z);
}

Expand Down Expand Up @@ -219,17 +221,18 @@ LocalModelPiece::~LocalModelPiece() {

bool LocalModelPiece::UpdateMatrix()
{
bool r = true;
bool r = original->mIsIdentity;

{
pieceSpaceMat.LoadIdentity();
// Assimp's Matrix: M = T * R * S; (SRT vs. RT in spring)
// else it's identity
pieceSpaceMat = original->scaleRotMatrix;

// Translate & Rotate are faster than matrix-mul!
if (original->scale.SqLength() != 0.0f) { pieceSpaceMat.Scale(original->scale); r = false; }
if (pos.SqLength() != 0.0f) { pieceSpaceMat.Translate(pos); r = false; }
if ( rot.y != 0.0f) { pieceSpaceMat.RotateY(-rot.y); r = false; }
if ( rot.x != 0.0f) { pieceSpaceMat.RotateX(-rot.x); r = false; }
if ( rot.z != 0.0f) { pieceSpaceMat.RotateZ(-rot.z); r = false; }
if ( rot.y != 0.0f) { pieceSpaceMat.RotateY(-rot.y); r = false; } // yaw
if ( rot.x != 0.0f) { pieceSpaceMat.RotateX(-rot.x); r = false; } // pitch
if ( rot.z != 0.0f) { pieceSpaceMat.RotateZ(-rot.z); r = false; } // roll
}

return r;
Expand Down

0 comments on commit ee5c049

Please sign in to comment.