- fixed mod center image previews in cases where userdata folder was non default

- removed commented out old code
This commit is contained in:
Mark Vejvoda 2013-10-03 05:44:50 +00:00
parent 312c2db483
commit 53a557d8d1
15 changed files with 80 additions and 430 deletions

View File

@ -145,11 +145,6 @@ void GameCamera::update(){
//free state
if(state==sFree ){
//#ifdef USE_STREFLOP
// if(streflop::fabs(static_cast<streflop::Simple>(rotate)) == 1){
//#else
// if(fabs(rotate) == 1){
//#endif
if(std::fabs(rotate) == 1){
rotateHV(speed*5*rotate, 0);
}
@ -215,27 +210,11 @@ Quad2i GameCamera::computeVisibleQuad() {
}
}
//const float nearDist= 20.f;
//const float farDist= 90.f;
//const float dist= 20.f;
// float nearDist = 20.f;
// float dist = pos.y > 20.f ? pos.y * 1.2f : 20.f;
// float farDist = 90.f * (pos.y > 20.f ? pos.y / 15.f : 1.f);
float nearDist = 15.f;
float dist = pos.y > nearDist ? pos.y * 1.2f : nearDist;
float farDist = 90.f * (pos.y > nearDist ? pos.y / 15.f : 1.f);
const float viewDegree = 180.f;
//#ifdef USE_STREFLOP
// Vec2f v(streflop::sinf(static_cast<streflop::Simple>(degToRad(viewDegree - hAng))), streflop::cosf(static_cast<streflop::Simple>(degToRad(viewDegree - hAng))));
// Vec2f v1(streflop::sinf(static_cast<streflop::Simple>(degToRad(viewDegree - hAng - fov))), streflop::cosf(static_cast<streflop::Simple>(degToRad(viewDegree - hAng - fov))));
// Vec2f v2(streflop::sinf(static_cast<streflop::Simple>(degToRad(viewDegree - hAng + fov))), streflop::cosf(static_cast<streflop::Simple>(degToRad(viewDegree - hAng + fov))));
//#else
// Vec2f v(sinf(degToRad(viewDegree - hAng)), cosf(degToRad(viewDegree - hAng)));
// Vec2f v1(sinf(degToRad(viewDegree - hAng - fov)), cosf(degToRad(viewDegree - hAng - fov)));
// Vec2f v2(sinf(degToRad(viewDegree - hAng + fov)), cosf(degToRad(viewDegree - hAng + fov)));
//#endif
Vec2f v(std::sin(degToRad(viewDegree - hAng)), std::cos(degToRad(viewDegree - hAng)));
Vec2f v1(std::sin(degToRad(viewDegree - hAng - fov)), std::cos(degToRad(viewDegree - hAng - fov)));
Vec2f v2(std::sin(degToRad(viewDegree - hAng + fov)), std::cos(degToRad(viewDegree - hAng + fov)));
@ -345,13 +324,6 @@ void GameCamera::rotateToVH(float v, float h) {
}
void GameCamera::zoom(float dist) {
//#ifdef USE_STREFLOP
// float flatDist = dist * streflop::cosf(static_cast<streflop::Simple>(degToRad(vAng)));
// Vec3f offset(flatDist * streflop::sinf(static_cast<streflop::Simple>(degToRad(hAng))), dist * streflop::sinf(static_cast<streflop::Simple>(degToRad(vAng))), flatDist * -streflop::cosf(static_cast<streflop::Simple>(degToRad(hAng))));
//#else
// float flatDist = dist * cosf(degToRad(vAng));
// Vec3f offset(flatDist * sinf(degToRad(hAng)), dist * sinf(degToRad(vAng)), flatDist * -cosf(degToRad(hAng)));
//#endif
float flatDist = dist * std::cos(degToRad(vAng));
Vec3f offset(flatDist * std::sin(degToRad(hAng)), dist * std::sin(degToRad(vAng)), flatDist * -std::cos(degToRad(hAng)));
@ -427,11 +399,6 @@ void GameCamera::clampAng() {
//move camera forwad but never change heightFactor
void GameCamera::moveForwardH(float d, float response) {
//#ifdef USE_STREFLOP
// Vec3f offset(streflop::sinf(static_cast<streflop::Simple>(degToRad(hAng))) * d, 0.f, -streflop::cosf(static_cast<streflop::Simple>(degToRad(hAng))) * d);
//#else
// Vec3f offset(sinf(degToRad(hAng)) * d, 0.f, -cosf(degToRad(hAng)) * d);
//#endif
Vec3f offset(std::sin(degToRad(hAng)) * d, 0.f, -std::cos(degToRad(hAng)) * d);
destPos += offset;
pos.x += offset.x * response;
@ -440,11 +407,6 @@ void GameCamera::moveForwardH(float d, float response) {
//move camera to a side but never change heightFactor
void GameCamera::moveSideH(float d, float response){
//#ifdef USE_STREFLOP
// Vec3f offset(streflop::sinf(static_cast<streflop::Simple>(degToRad(hAng+90))) * d, 0.f, -streflop::cosf(static_cast<streflop::Simple>(degToRad(hAng+90))) * d);
//#else
// Vec3f offset(sinf(degToRad(hAng+90)) * d, 0.f, -cosf(degToRad(hAng+90)) * d);
//#endif
Vec3f offset(std::sin(degToRad(hAng+90)) * d, 0.f, -std::cos(degToRad(hAng+90)) * d);
destPos += offset;
pos.x += (destPos.x - pos.x) * response;

View File

@ -25,25 +25,6 @@ using namespace Shared::Util;
namespace Glest{ namespace Game{
//
// This class wraps streflop for the Lua ScriptMAnager. We need to toggle the data type
// for streflop to use when calling into glest from LUA as streflop may corrupt some
// numeric values passed from Lua otherwise
//
class ScriptManager_STREFLOP_Wrapper {
public:
ScriptManager_STREFLOP_Wrapper() {
#ifdef USE_STREFLOP
//streflop_init<streflop::Simple>();
#endif
}
~ScriptManager_STREFLOP_Wrapper() {
#ifdef USE_STREFLOP
//streflop_init<streflop::Double>();
#endif
}
};
ScriptManagerMessage::ScriptManagerMessage() : text(""), header("") {
this->factionIndex=-1;
this->teamIndex=-1;
@ -471,8 +452,6 @@ void ScriptManager::init(World* world, GameCamera *gameCamera, const XmlNode *ro
SystemFlags::OutputDebug(SystemFlags::debugError,sErrBuf.c_str());
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,sErrBuf.c_str());
ScriptManager_STREFLOP_Wrapper streflopWrapper;
messageQueue.push_back(ScriptManagerMessage(sErrBuf.c_str(), "error"));
onMessageBoxOk(false);
}
@ -907,8 +886,6 @@ void ScriptManager::onCellTriggerEvent(Unit *movingUnit) {
// ========================== lua wrappers ===============================================
string ScriptManager::wrapString(const string &str, int wrapCount){
ScriptManager_STREFLOP_Wrapper streflopWrapper;
string returnString;
int letterCount= 0;
@ -928,14 +905,10 @@ string ScriptManager::wrapString(const string &str, int wrapCount){
}
void ScriptManager::networkShowMessageForFaction(const string &text, const string &header,int factionIndex) {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
messageQueue.push_back(ScriptManagerMessage(text, header, factionIndex));
onMessageBoxOk(false);
}
void ScriptManager::networkShowMessageForTeam(const string &text, const string &header,int teamIndex) {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
// Team indexes are 0 based internally (but 1 based in the lua script) so convert
teamIndex--;
messageQueue.push_back(ScriptManagerMessage(text, header, -1, teamIndex));
@ -945,8 +918,6 @@ void ScriptManager::networkShowMessageForTeam(const string &text, const string &
void ScriptManager::networkSetCameraPositionForFaction(int factionIndex, const Vec2i &pos) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(factionIndex == this->world->getThisFactionIndex()) {
gameCamera->centerXZ(pos.x, pos.y);
}
@ -955,16 +926,12 @@ void ScriptManager::networkSetCameraPositionForFaction(int factionIndex, const V
void ScriptManager::networkSetCameraPositionForTeam(int teamIndex, const Vec2i &pos) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(teamIndex == this->world->getThisTeamIndex()) {
gameCamera->centerXZ(pos.x, pos.y);
}
}
void ScriptManager::showMessage(const string &text, const string &header){
ScriptManager_STREFLOP_Wrapper streflopWrapper;
messageQueue.push_back(ScriptManagerMessage(text, header));
onMessageBoxOk(false);
}
@ -974,19 +941,14 @@ void ScriptManager::clearDisplayText(){
}
void ScriptManager::setDisplayText(const string &text){
ScriptManager_STREFLOP_Wrapper streflopWrapper;
displayText= wrapString(Lang::getInstance().getScenarioString(text), displayTextWrapCount);
}
void ScriptManager::addConsoleText(const string &text){
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->addConsoleText(text);
}
void ScriptManager::addConsoleLangText(const char *fmt, ...){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
va_list argList;
va_start(argList, fmt);
@ -1003,8 +965,6 @@ void ScriptManager::addConsoleLangText(const char *fmt, ...){
void ScriptManager::DisplayFormattedText(const char *fmt, ...) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
va_list argList;
va_start(argList, fmt);
@ -1019,9 +979,6 @@ void ScriptManager::DisplayFormattedText(const char *fmt, ...) {
void ScriptManager::DisplayFormattedLangText(const char *fmt, ...) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
va_list argList;
va_start(argList, fmt);
@ -1036,25 +993,21 @@ void ScriptManager::DisplayFormattedLangText(const char *fmt, ...) {
void ScriptManager::setCameraPosition(const Vec2i &pos){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
gameCamera->centerXZ(pos.x, pos.y);
}
void ScriptManager::createUnit(const string &unitName, int factionIndex, Vec2i pos){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] unit [%s] factionIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,unitName.c_str(),factionIndex);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->createUnit(unitName, factionIndex, pos);
}
void ScriptManager::createUnitNoSpacing(const string &unitName, int factionIndex, Vec2i pos){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] unit [%s] factionIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,unitName.c_str(),factionIndex);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->createUnit(unitName, factionIndex, pos, false);
}
void ScriptManager::destroyUnit(int unitId){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] unit [%d]\n",__FILE__,__FUNCTION__,__LINE__,unitId);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
Unit *unit = world->findUnitById(unitId);
if(unit != NULL) {
// Make sure they die
@ -1066,7 +1019,6 @@ void ScriptManager::destroyUnit(int unitId){
}
void ScriptManager::giveKills (int unitId, int amount){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] unit [%d]\n",__FILE__,__FUNCTION__,__LINE__,unitId);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
Unit *unit = world->findUnitById(unitId);
if(unit != NULL) {
for(int i = 1; i <= amount; i++) {
@ -1077,107 +1029,98 @@ void ScriptManager::giveKills (int unitId, int amount){
void ScriptManager::playStaticSound(const string &playSound) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] playSound [%s]\n",__FILE__,__FUNCTION__,__LINE__,playSound.c_str());
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->playStaticSound(playSound);
}
void ScriptManager::playStreamingSound(const string &playSound) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] playSound [%s]\n",__FILE__,__FUNCTION__,__LINE__,playSound.c_str());
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->playStreamingSound(playSound);
}
void ScriptManager::stopStreamingSound(const string &playSound) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] playSound [%s]\n",__FILE__,__FUNCTION__,__LINE__,playSound.c_str());
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->stopStreamingSound(playSound);
}
void ScriptManager::stopAllSound() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->stopAllSound();
}
void ScriptManager::playStaticVideo(const string &playVideo) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] playVideo [%s]\n",__FILE__,__FUNCTION__,__LINE__,playVideo.c_str());
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->playStaticVideo(playVideo);
}
void ScriptManager::playStreamingVideo(const string &playVideo) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] playVideo [%s]\n",__FILE__,__FUNCTION__,__LINE__,playVideo.c_str());
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->playStreamingVideo(playVideo);
}
void ScriptManager::stopStreamingVideo(const string &playVideo) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] playVideo [%s]\n",__FILE__,__FUNCTION__,__LINE__,playVideo.c_str());
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->stopStreamingVideo(playVideo);
}
void ScriptManager::stopAllVideo() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->stopAllVideo();
}
void ScriptManager::togglePauseGame(int pauseStatus) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] pauseStatus = %d\n",__FILE__,__FUNCTION__,__LINE__,pauseStatus);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->togglePauseGame((pauseStatus != 0),true);
}
void ScriptManager::morphToUnit(int unitId,const string &morphName, int ignoreRequirements) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] unit [%d] morphName [%s] forceUpgradesIfRequired = %d\n",__FILE__,__FUNCTION__,__LINE__,unitId,morphName.c_str(),ignoreRequirements);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->morphToUnit(unitId,morphName,(ignoreRequirements == 1));
}
void ScriptManager::moveToUnit(int unitId,int destUnitId) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] unit [%d] destUnitId [%d]\n",__FILE__,__FUNCTION__,__LINE__,unitId,destUnitId);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->moveToUnit(unitId,destUnitId);
}
void ScriptManager::giveResource(const string &resourceName, int factionIndex, int amount){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->giveResource(resourceName, factionIndex, amount);
}
void ScriptManager::givePositionCommand(int unitId, const string &commandName, const Vec2i &pos){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->givePositionCommand(unitId, commandName, pos);
}
void ScriptManager::giveAttackCommand(int unitId, int unitToAttackId) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->giveAttackCommand(unitId, unitToAttackId);
}
void ScriptManager::giveProductionCommand(int unitId, const string &producedName){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->giveProductionCommand(unitId, producedName);
}
void ScriptManager::giveUpgradeCommand(int unitId, const string &producedName){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->giveUpgradeCommand(unitId, producedName);
}
void ScriptManager::giveAttackStoppedCommand(int unitId, const string &itemName,int ignoreRequirements) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->giveAttackStoppedCommand(unitId, itemName, (ignoreRequirements == 1));
}
void ScriptManager::disableAi(int factionIndex){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(factionIndex<GameConstants::maxPlayers){
playerModifiers[factionIndex].disableAi();
disableConsume(factionIndex); // by this we stay somehow compatible with old behaviour
@ -1186,14 +1129,14 @@ void ScriptManager::disableAi(int factionIndex){
void ScriptManager::enableAi(int factionIndex){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(factionIndex<GameConstants::maxPlayers){
playerModifiers[factionIndex].enableAi();
}
}
bool ScriptManager::getAiEnabled(int factionIndex){
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(factionIndex<GameConstants::maxPlayers){
return playerModifiers[factionIndex].getAiEnabled();
}
@ -1202,7 +1145,7 @@ bool ScriptManager::getAiEnabled(int factionIndex){
void ScriptManager::disableConsume(int factionIndex){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(factionIndex<GameConstants::maxPlayers){
playerModifiers[factionIndex].disableConsume();
}
@ -1210,14 +1153,14 @@ void ScriptManager::disableConsume(int factionIndex){
void ScriptManager::enableConsume(int factionIndex){
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(factionIndex<GameConstants::maxPlayers){
playerModifiers[factionIndex].enableConsume();
}
}
bool ScriptManager::getConsumeEnabled(int factionIndex){
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(factionIndex < GameConstants::maxPlayers){
return playerModifiers[factionIndex].getConsumeEnabled();
}
@ -1450,7 +1393,7 @@ int ScriptManager::getTimerEventSecondsElapsed(int eventId) {
void ScriptManager::setPlayerAsWinner(int factionIndex) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(factionIndex<GameConstants::maxPlayers){
playerModifiers[factionIndex].setAsWinner();
}
@ -1458,12 +1401,12 @@ void ScriptManager::setPlayerAsWinner(int factionIndex) {
void ScriptManager::endGame() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
gameOver= true;
}
void ScriptManager::startPerformanceTimer() {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(world->getGame() == NULL) {
throw megaglest_runtime_error("world->getGame() == NULL");
}
@ -1472,7 +1415,7 @@ void ScriptManager::startPerformanceTimer() {
}
void ScriptManager::endPerformanceTimer() {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(world->getGame() == NULL) {
throw megaglest_runtime_error("world->getGame() == NULL");
}
@ -1481,7 +1424,7 @@ void ScriptManager::endPerformanceTimer() {
}
Vec2i ScriptManager::getPerformanceTimerResults() {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(world->getGame() == NULL) {
throw megaglest_runtime_error("world->getGame() == NULL");
}
@ -1490,14 +1433,14 @@ Vec2i ScriptManager::getPerformanceTimerResults() {
Vec2i ScriptManager::getStartLocation(int factionIndex) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->getStartLocation(factionIndex);
}
Vec2i ScriptManager::getUnitPosition(int unitId) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
Vec2i result = world->getUnitPosition(unitId);
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s] unitId = %d, pos [%s]\n",__FUNCTION__,unitId,result.getString().c_str());
@ -1507,215 +1450,215 @@ Vec2i ScriptManager::getUnitPosition(int unitId) {
void ScriptManager::setUnitPosition(int unitId, Vec2i pos) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->setUnitPosition(unitId,pos);
}
void ScriptManager::addCellMarker(Vec2i pos, int factionIndex, const string &note, const string &textureFile) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->addCellMarker(pos,factionIndex, note, textureFile);
}
void ScriptManager::removeCellMarker(Vec2i pos, int factionIndex) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->removeCellMarker(pos,factionIndex);
}
void ScriptManager::showMarker(Vec2i pos, int factionIndex, const string &note, const string &textureFile, int flashCount) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->showMarker(pos,factionIndex, note, textureFile, flashCount);
}
int ScriptManager::getIsUnitAlive(int unitId) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->getIsUnitAlive(unitId);
}
int ScriptManager::getUnitFaction(int unitId) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->getUnitFactionIndex(unitId);
}
const string ScriptManager::getUnitName(int unitId) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->getUnitName(unitId);
}
int ScriptManager::getResourceAmount(const string &resourceName, int factionIndex) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->getResourceAmount(resourceName, factionIndex);
}
const string &ScriptManager::getLastCreatedUnitName() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return lastCreatedUnitName;
}
int ScriptManager::getCellTriggeredEventId() {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return currentCellTriggeredEventId;
}
int ScriptManager::getTimerTriggeredEventId() {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return currentTimerTriggeredEventId;
}
int ScriptManager::getCellTriggeredEventAreaEntryUnitId() {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return currentCellTriggeredEventAreaEntryUnitId;
}
int ScriptManager::getCellTriggeredEventAreaExitUnitId() {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return currentCellTriggeredEventAreaExitUnitId;
}
int ScriptManager::getCellTriggeredEventUnitId() {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return currentCellTriggeredEventUnitId;
}
void ScriptManager::setRandomGenInit(int seed) {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
random.init(seed);
}
int ScriptManager::getRandomGen(int minVal, int maxVal) {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return random.randRange(minVal,maxVal);
}
int ScriptManager::getWorldFrameCount() {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->getFrameCount();
}
bool ScriptManager::getGameWon() const {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return gameWon;
}
bool ScriptManager::getIsGameOver() const {
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return gameOver;
}
int ScriptManager::getLastCreatedUnitId() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return lastCreatedUnitId;
}
const string &ScriptManager::getLastDeadUnitName() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return lastDeadUnitName;
}
int ScriptManager::getLastDeadUnitId() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return lastDeadUnitId;
}
int ScriptManager::getLastDeadUnitCauseOfDeath() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return lastDeadUnitCauseOfDeath;
}
const string &ScriptManager::getLastDeadUnitKillerName() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return lastDeadUnitKillerName;
}
int ScriptManager::getLastDeadUnitKillerId() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return lastDeadUnitKillerId;
}
const string &ScriptManager::getLastAttackedUnitName() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return lastAttackedUnitName;
}
int ScriptManager::getLastAttackedUnitId() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return lastAttackedUnitId;
}
const string &ScriptManager::getLastAttackingUnitName() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return lastAttackingUnitName;
}
int ScriptManager::getLastAttackingUnitId() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return lastAttackingUnitId;
}
int ScriptManager::getUnitCount(int factionIndex) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->getUnitCount(factionIndex);
}
int ScriptManager::getUnitCountOfType(int factionIndex, const string &typeName) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->getUnitCountOfType(factionIndex, typeName);
}
const string ScriptManager::getSystemMacroValue(const string &key) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->getSystemMacroValue(key);
}
const string ScriptManager::getPlayerName(int factionIndex) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->getPlayerName(factionIndex);
}
void ScriptManager::loadScenario(const string &name, bool keepFactions) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->setQueuedScenario(name,keepFactions);
}
vector<int> ScriptManager::getUnitsForFaction(int factionIndex,const string& commandTypeName, int field) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->getUnitsForFaction(factionIndex,commandTypeName, field);
}
int ScriptManager::getUnitCurrentField(int unitId) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->getUnitCurrentField(unitId);
}
int ScriptManager::isFreeCellsOrHasUnit(int field, int unitId, Vec2i pos) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
Unit* unit= world->findUnitById(unitId);
int result = world->getMap()->isFreeCellsOrHasUnit(pos,unit->getType()->getSize(),static_cast<Field>(field),unit,NULL,true);
@ -1727,7 +1670,7 @@ int ScriptManager::isFreeCellsOrHasUnit(int field, int unitId, Vec2i pos) {
int ScriptManager::isFreeCells(int unitSize, int field, Vec2i pos) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
int result = world->getMap()->isFreeCellsOrHasUnit(pos,unitSize,static_cast<Field>(field),NULL,NULL,true);
@ -1738,67 +1681,67 @@ int ScriptManager::isFreeCells(int unitSize, int field, Vec2i pos) {
int ScriptManager::getHumanFactionId() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return this->world->getThisFactionIndex();
}
void ScriptManager::highlightUnit(int unitId, float radius, float thickness, Vec4f color) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->highlightUnit(unitId, radius, thickness, color);
}
void ScriptManager::unhighlightUnit(int unitId) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->unhighlightUnit(unitId);
}
void ScriptManager::giveStopCommand(int unitId) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->giveStopCommand(unitId);
}
bool ScriptManager::selectUnit(int unitId) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->selectUnit(unitId);
}
void ScriptManager::unselectUnit(int unitId) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->unselectUnit(unitId);
}
void ScriptManager::addUnitToGroupSelection(int unitId,int groupIndex) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->addUnitToGroupSelection(unitId,groupIndex);
}
void ScriptManager::recallGroupSelection(int groupIndex) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->recallGroupSelection(groupIndex);
}
void ScriptManager::removeUnitFromGroupSelection(int unitId,int groupIndex) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->removeUnitFromGroupSelection(unitId,groupIndex);
}
void ScriptManager::setAttackWarningsEnabled(bool enabled) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
world->setAttackWarningsEnabled(enabled);
}
bool ScriptManager::getAttackWarningsEnabled() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
return world->getAttackWarningsEnabled();
}
@ -1953,7 +1896,7 @@ void ScriptManager::onDayNightTriggerEvent() {
int ScriptManager::getIsDayTime() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
const TimeFlow *tf= world->getTimeFlow();
if(tf == NULL) {
@ -1963,7 +1906,7 @@ int ScriptManager::getIsDayTime() {
}
int ScriptManager::getIsNightTime() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
const TimeFlow *tf= world->getTimeFlow();
if(tf == NULL) {
@ -1975,7 +1918,7 @@ float ScriptManager::getTimeOfDay() {
//printf("File: %s line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__);
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
const TimeFlow *tf= world->getTimeFlow();
if(tf == NULL) {

View File

@ -1151,11 +1151,6 @@ static Vec2i _unprojectMap(const Vec2i& pt,const GLdouble* model,const GLdouble*
u = stop-start,
w = start-plane;
const float d = norm.x*u.x + norm.y*u.y + norm.z*u.z;
//#ifdef USE_STREFLOP
// if(streflop::fabs(static_cast<streflop::Simple>(d)) < 0.00001)
//#else
// if(fabs(d) < 0.00001)
//#endif
if(std::fabs(d) < 0.00001)
throw pti_D_IS_ZERO;
@ -1168,35 +1163,15 @@ static Vec2i _unprojectMap(const Vec2i& pt,const GLdouble* model,const GLdouble*
Vec2i pos;
if(strcmp(label,"tl") == 0) {
//#ifdef USE_STREFLOP
// pos = Vec2i(streflop::floor(static_cast<streflop::Simple>(i.x)),streflop::floor(static_cast<streflop::Simple>(i.z)));
//#else
// pos = Vec2i(floor(i.x),floor(i.z));
//#endif
pos = Vec2i(std::floor(i.x),std::floor(i.z));
}
else if(strcmp(label,"tr") == 0) {
//#ifdef USE_STREFLOP
// pos = Vec2i(streflop::ceil(static_cast<streflop::Simple>(i.x)),streflop::floor(static_cast<streflop::Simple>(i.z)));
//#else
// pos = Vec2i(ceil(i.x),floor(i.z));
//#endif
pos = Vec2i(std::ceil(i.x),std::floor(i.z));
}
else if(strcmp(label,"bl") == 0) {
//#ifdef USE_STREFLOP
// pos = Vec2i(streflop::floor(static_cast<streflop::Simple>(i.x)),streflop::ceil(static_cast<streflop::Simple>(i.z)));
//#else
// pos = Vec2i(floor(i.x),ceil(i.z));
//#endif
pos = Vec2i(std::floor(i.x),std::ceil(i.z));
}
else if(strcmp(label,"br") == 0) {
//#ifdef USE_STREFLOP
// pos = Vec2i(streflop::ceil(static_cast<streflop::Simple>(i.x)),streflop::ceil(static_cast<streflop::Simple>(i.z)));
//#else
// pos = Vec2i(ceil(i.x),ceil(i.z));
//#endif
pos = Vec2i(std::ceil(i.x),std::ceil(i.z));
}
@ -1299,11 +1274,6 @@ bool Renderer::ExtractFrustum(VisibleQuadContainerCache &quadCacheItem) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\nCalc Frustum #%da: [%f][%f][%f][%f]\n",0,frustum[0][0],frustum[0][1],frustum[0][2],frustum[0][3]);
/* Normalize the result */
// #ifdef USE_STREFLOP
// t = streflop::sqrt( static_cast<streflop::Simple>(frustum[0][0] * frustum[0][0] + frustum[0][1] * frustum[0][1] + frustum[0][2] * frustum[0][2]) );
// #else
// t = sqrt( frustum[0][0] * frustum[0][0] + frustum[0][1] * frustum[0][1] + frustum[0][2] * frustum[0][2] );
// #endif
t = std::sqrt( frustum[0][0] * frustum[0][0] + frustum[0][1] * frustum[0][1] + frustum[0][2] * frustum[0][2] );
if(t != 0.0) {
frustum[0][0] /= t;
@ -1323,11 +1293,6 @@ bool Renderer::ExtractFrustum(VisibleQuadContainerCache &quadCacheItem) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\nCalc Frustum #%da: [%f][%f][%f][%f]\n",1,frustum[1][0],frustum[1][1],frustum[1][2],frustum[1][3]);
/* Normalize the result */
// #ifdef USE_STREFLOP
// t = streflop::sqrt( static_cast<streflop::Simple>(frustum[1][0] * frustum[1][0] + frustum[1][1] * frustum[1][1] + frustum[1][2] * frustum[1][2]) );
// #else
// t = sqrt( frustum[1][0] * frustum[1][0] + frustum[1][1] * frustum[1][1] + frustum[1][2] * frustum[1][2] );
// #endif
t = std::sqrt( frustum[1][0] * frustum[1][0] + frustum[1][1] * frustum[1][1] + frustum[1][2] * frustum[1][2] );
if(t != 0.0) {
frustum[1][0] /= t;
@ -1347,11 +1312,6 @@ bool Renderer::ExtractFrustum(VisibleQuadContainerCache &quadCacheItem) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\nCalc Frustum #%da: [%f][%f][%f][%f]\n",2,frustum[2][0],frustum[2][1],frustum[2][2],frustum[2][3]);
/* Normalize the result */
// #ifdef USE_STREFLOP
// t = streflop::sqrt( static_cast<streflop::Simple>(frustum[2][0] * frustum[2][0] + frustum[2][1] * frustum[2][1] + frustum[2][2] * frustum[2][2]) );
// #else
// t = sqrt( frustum[2][0] * frustum[2][0] + frustum[2][1] * frustum[2][1] + frustum[2][2] * frustum[2][2] );
// #endif
t = std::sqrt( frustum[2][0] * frustum[2][0] + frustum[2][1] * frustum[2][1] + frustum[2][2] * frustum[2][2] );
if(t != 0.0) {
@ -1372,11 +1332,6 @@ bool Renderer::ExtractFrustum(VisibleQuadContainerCache &quadCacheItem) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\nCalc Frustum #%da: [%f][%f][%f][%f]\n",3,frustum[3][0],frustum[3][1],frustum[3][2],frustum[3][3]);
/* Normalize the result */
// #ifdef USE_STREFLOP
// t = streflop::sqrt( static_cast<streflop::Simple>(frustum[3][0] * frustum[3][0] + frustum[3][1] * frustum[3][1] + frustum[3][2] * frustum[3][2]) );
// #else
// t = sqrt( frustum[3][0] * frustum[3][0] + frustum[3][1] * frustum[3][1] + frustum[3][2] * frustum[3][2] );
// #endif
t = std::sqrt( frustum[3][0] * frustum[3][0] + frustum[3][1] * frustum[3][1] + frustum[3][2] * frustum[3][2] );
if(t != 0.0) {
@ -1397,11 +1352,6 @@ bool Renderer::ExtractFrustum(VisibleQuadContainerCache &quadCacheItem) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\nCalc Frustum #%da: [%f][%f][%f][%f]\n",4,frustum[4][0],frustum[4][1],frustum[4][2],frustum[4][3]);
/* Normalize the result */
// #ifdef USE_STREFLOP
// t = streflop::sqrt( static_cast<streflop::Simple>(frustum[4][0] * frustum[4][0] + frustum[4][1] * frustum[4][1] + frustum[4][2] * frustum[4][2]) );
// #else
// t = sqrt( frustum[4][0] * frustum[4][0] + frustum[4][1] * frustum[4][1] + frustum[4][2] * frustum[4][2] );
// #endif
t = std::sqrt( frustum[4][0] * frustum[4][0] + frustum[4][1] * frustum[4][1] + frustum[4][2] * frustum[4][2] );
@ -1423,11 +1373,6 @@ bool Renderer::ExtractFrustum(VisibleQuadContainerCache &quadCacheItem) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\nCalc Frustum #%da: [%f][%f][%f][%f]\n",5,frustum[5][0],frustum[5][1],frustum[5][2],frustum[5][3]);
/* Normalize the result */
// #ifdef USE_STREFLOP
// t = streflop::sqrt( static_cast<streflop::Simple>(frustum[5][0] * frustum[5][0] + frustum[5][1] * frustum[5][1] + frustum[5][2] * frustum[5][2]) );
// #else
// t = sqrt( frustum[5][0] * frustum[5][0] + frustum[5][1] * frustum[5][1] + frustum[5][2] * frustum[5][2] );
// #endif
t = std::sqrt( frustum[5][0] * frustum[5][0] + frustum[5][1] * frustum[5][1] + frustum[5][2] * frustum[5][2] );
@ -2674,11 +2619,6 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i
else if(lineHeight > h) {
//printf("line %d, lineHeight [%f] h [%d] text [%s]\n",__LINE__,lineHeight,h,text.c_str());
//#ifdef USE_STREFLOP
// pos.y += (float)(streflop::ceil( static_cast<streflop::Simple>( ((float)lineHeight - (float)h)) ));
//#else
// pos.y += (ceil(lineHeight - h));
//#endif
pos.y += (std::ceil(lineHeight - h));
}
}
@ -5856,25 +5796,11 @@ void Renderer::renderMinimap(){
int x1;
int y1;
//#ifdef USE_STREFLOP
// x1 = mx + x + static_cast<int>(20*streflop::sin(static_cast<streflop::Simple>(ang-pi/5)));
// y1 = my + mh - (y-static_cast<int>(20*streflop::cos(static_cast<streflop::Simple>(ang-pi/5))));
//#else
// x1 = mx + x + static_cast<int>(20*sin(ang-pi/5));
// y1 = my + mh - (y-static_cast<int>(20*cos(ang-pi/5)));
//#endif
x1 = mx + x + static_cast<int>(20*std::sin(ang-pi/5));
y1 = my + mh - (y-static_cast<int>(20*std::cos(ang-pi/5)));
int x2;
int y2;
//#ifdef USE_STREFLOP
// x2 = mx + x + static_cast<int>(20*streflop::sin(static_cast<streflop::Simple>(ang+pi/5)));
// y2 = my + mh - (y-static_cast<int>(20*streflop::cos(static_cast<streflop::Simple>(ang+pi/5))));
//#else
// x2 = mx + x + static_cast<int>(20*sin(ang+pi/5));
// y2 = my + mh - (y-static_cast<int>(20*cos(ang+pi/5)));
//#endif
x2 = mx + x + static_cast<int>(20*std::sin(ang+pi/5));
y2 = my + mh - (y-static_cast<int>(20*std::cos(ang+pi/5)));
@ -7326,21 +7252,11 @@ float Renderer::computeMoonAngle(float time) {
Vec4f Renderer::computeSunPos(float time) {
float ang= computeSunAngle(time);
//#ifdef USE_STREFLOP
// return Vec4f(-streflop::cos(static_cast<streflop::Simple>(ang))*sunDist, streflop::sin(static_cast<streflop::Simple>(ang))*sunDist, 0.f, 0.f);
//#else
// return Vec4f(-cos(ang)*sunDist, sin(ang)*sunDist, 0.f, 0.f);
//#endif
return Vec4f(-std::cos(ang)*sunDist, std::sin(ang)*sunDist, 0.f, 0.f);
}
Vec4f Renderer::computeMoonPos(float time) {
float ang= computeMoonAngle(time);
//#ifdef USE_STREFLOP
// return Vec4f(-streflop::cos(static_cast<streflop::Simple>(ang))*moonDist, streflop::sin(static_cast<streflop::Simple>(ang))*moonDist, 0.f, 0.f);
//#else
// return Vec4f(-cos(ang)*moonDist, sin(ang)*moonDist, 0.f, 0.f);
//#endif
return Vec4f(-std::cos(ang)*moonDist, std::sin(ang)*moonDist, 0.f, 0.f);
}
@ -8399,23 +8315,12 @@ void Renderer::renderUnitTitles3D(Font3D *font, Vec3f color) {
if(unit->getCurrentUnitTitle() != "") {
//get the screen coordinates
Vec3f screenPos = unit->getScreenPos();
// #ifdef USE_STREFLOP
// renderText3D(unit->getCurrentUnitTitle(), font, color, streflop::fabs(static_cast<streflop::Simple>(screenPos.x)) + 5, streflop::fabs(static_cast<streflop::Simple>(screenPos.y)) + 5, false);
// #else
// renderText3D(unit->getCurrentUnitTitle(), font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
// #endif
renderText3D(unit->getCurrentUnitTitle(), font, color, std::fabs(screenPos.x) + 5, std::fabs(screenPos.y) + 5, false);
//unitRenderedList[unit->getId()] = true;
}
else {
string str = unit->getFullName(unit->showTranslatedTechTree()) + " - " + intToStr(unit->getId()) + " [" + unit->getPosNotThreadSafe().getString() + "]";
Vec3f screenPos = unit->getScreenPos();
// #ifdef USE_STREFLOP
// renderText3D(str, font, color, streflop::fabs(static_cast<streflop::Simple>(screenPos.x)) + 5, streflop::fabs(static_cast<streflop::Simple>(screenPos.y)) + 5, false);
// #else
// renderText3D(str, font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
// #endif
renderText3D(str, font, color, std::fabs(screenPos.x) + 5, std::fabs(screenPos.y) + 5, false);
}
}
@ -8463,11 +8368,6 @@ void Renderer::renderUnitTitles(Font2D *font, Vec3f color) {
if(unit->getCurrentUnitTitle() != "") {
//get the screen coordinates
Vec3f screenPos = unit->getScreenPos();
//#ifdef USE_STREFLOP
// renderText(unit->getCurrentUnitTitle(), font, color, streflop::fabs(static_cast<streflop::Simple>(screenPos.x)) + 5, streflop::fabs(static_cast<streflop::Simple>(screenPos.y)) + 5, false);
//#else
// renderText(unit->getCurrentUnitTitle(), font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
//#endif
renderText(unit->getCurrentUnitTitle(), font, color, std::fabs(screenPos.x) + 5, std::fabs(screenPos.y) + 5, false);
//unitRenderedList[unit->getId()] = true;
@ -8475,11 +8375,6 @@ void Renderer::renderUnitTitles(Font2D *font, Vec3f color) {
else {
string str = unit->getFullName(unit->showTranslatedTechTree()) + " - " + intToStr(unit->getId()) + " [" + unit->getPosNotThreadSafe().getString() + "]";
Vec3f screenPos = unit->getScreenPos();
//#ifdef USE_STREFLOP
// renderText(str, font, color, streflop::fabs(static_cast<streflop::Simple>(screenPos.x)) + 5, streflop::fabs(static_cast<streflop::Simple>(screenPos.y)) + 5, false);
//#else
// renderText(str, font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
//#endif
renderText(str, font, color, std::fabs(screenPos.x) + 5, std::fabs(screenPos.y) + 5, false);
}
}

View File

@ -3640,8 +3640,6 @@ int glestMain(int argc, char** argv) {
printf("\nSVN: [%s]",getSVNRevisionString().c_str());
#ifdef USE_STREFLOP
//# define STREFLOP_NO_DENORMALS
// streflop_init<streflop::Simple>();
#if defined(STREFLOP_SSE)
const char *instruction_set = "[SSE]";

View File

@ -1945,6 +1945,12 @@ string MenuStateMods::getPreviewImageFileForMod(const ModInfo *modInfo) {
endPathWithSlash(userData);
}
string tempPath = userData + "temp/";
if(isdir(tempPath.c_str()) == false) {
createDirectoryPaths(tempPath);
}
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("### tempPath [%s] isdir = %d\n",tempPath.c_str(),isdir(tempPath.c_str()));
if(isdir(tempPath.c_str()) == true) {
fileName = tempPath;
switch(modInfo->type) {

View File

@ -183,11 +183,6 @@ void SoundRenderer::playFx(StaticSound *staticSound, Vec3f soundPos, Vec3f camPo
if(d < audibleDist){
float vol= (1.f-d/audibleDist)*fxVolume;
//#ifdef USE_STREFLOP
// float correctedVol= streflop::log10(streflop::log10(static_cast<streflop::Simple>(vol*9+1))*9+1);
//#else
// float correctedVol= log10(log10(vol*9+1)*9+1);
//#endif
float correctedVol= std::log10(std::log10(vol*9+1)*9+1);
staticSound->setVolume(correctedVol);

View File

@ -1954,7 +1954,6 @@ bool PosCircularIterator::next(){
#else
while(floor(pos.dist(center)) >= (radius+1) || !map->isInside(pos) || !map->isInsideSurface(map->toSurfCoords(pos)) );
#endif
//while(!(pos.dist(center) <= radius && map->isInside(pos)));
return true;
}

View File

@ -33,20 +33,6 @@ namespace Shared{ namespace Graphics{
template<typename T>
inline T truncateDecimal(const T &value, int precision=6) {
/*
int iSigned = value >= 0 ? 1: -1;
#ifdef USE_STREFLOP
unsigned int uiTemp = (unsigned int)(value * streflop::pow((streflop::Simple)10, (streflop::Simple)precision)) * iSigned; //Note I'm using unsigned int so that I can increase the precision of the truncate
T result = (((T)uiTemp) / streflop::pow((streflop::Simple)10,(streflop::Simple)precision) * iSigned);
#else
unsigned int uiTemp = (value * pow((T)10, precision)) * iSigned; //Note I'm using unsigned int so that I can increase the precision of the truncate
T result = (((double)uiTemp) / pow((T)10,precision) * iSigned);
#endif
return result;
*/
T precNum = 0;
if(precision == 0) {
precNum = 1;
@ -269,14 +255,6 @@ public:
}
inline float length() const {
//#ifdef USE_STREFLOP
// if(requireAccuracy == true) {
// return static_cast<float>(streflop::sqrt(static_cast<streflop::Simple>(x*x + y*y)));
// }
// return static_cast<float>(std::sqrt(static_cast<float>(x*x + y*y)));
//#else
// return static_cast<float>(sqrt(static_cast<float>(x*x + y*y)));
//#endif
float len = static_cast<float>(std::sqrt(static_cast<float>(x*x + y*y)));
len = truncateDecimal<float>(len,6);
return len;
@ -289,14 +267,6 @@ public:
}
inline Vec2<T> rotate(float rad) {
// const float
//#ifdef USE_STREFLOP
// c = streflop::cosf(rad),
// s = streflop::sinf(rad);
//#else
// c = cosf(rad),
// s = sinf(rad);
//#endif
float c = std::cos(rad),
s = std::sin(rad);
@ -514,14 +484,6 @@ public:
}
inline float length() const {
//#ifdef USE_STREFLOP
// if(requireAccuracy == true) {
// return static_cast<float>(streflop::sqrt(static_cast<streflop::Simple>(x*x + y*y + z*z)));
// }
// return static_cast<float>(std::sqrt(x*x + y*y + z*z));
//#else
// return static_cast<float>(sqrt(x*x + y*y + z*z));
//#endif
float len = static_cast<float>(std::sqrt(x*x + y*y + z*z));
len = truncateDecimal<float>(len,6);
return len;

View File

@ -32,9 +32,6 @@ private:
private:
int lastNumber;
std::vector<std::string> lastCaller;
//#ifdef USE_STREFLOP
// streflop::RandomState randomState;
//#endif
int rand(std::string lastCaller);

View File

@ -1764,17 +1764,7 @@ void ProjectileParticleSystem::update(){
float relative= clamp(currentVector.length() / targetVector.length(), 0.0f, 1.0f);
relative = truncateDecimal<float>(relative,6);
//printf("Update particle targetVector [%s][%f] currentVector [%s][%f] relative = %f\n",targetVector.getString().c_str(),targetVector.length(),currentVector.getString().c_str(),currentVector.length(),relative);
//#ifdef USE_STREFLOP
// float absolute= clamp(streflop::fabs(static_cast<streflop::Simple>(currentVector.length())), 0.0f, 1.0f);
//#else
// float absolute= clamp(fabs(currentVector.length()), 0.0f, 1.0f);
//#endif
//printf("#a currentVector.length() = %f, targetVector.length() = %f, relative = %f, absolute = %f, trajectorySpeed = %f\n",currentVector.length(),targetVector.length(),relative,absolute,trajectorySpeed);
float absolute = relative;
setTween(relative,absolute);
// trajectory

View File

@ -1313,19 +1313,6 @@ void Pixmap2D::splat(const Pixmap2D *leftUp, const Pixmap2D *rightUp, const Pixm
float distRd= splatDist(Vec2i(i, j), Vec2i(w, h));
const float powFactor= 2.0f;
//#ifdef USE_STREFLOP
// distLu= streflop::pow(static_cast<streflop::Simple>(distLu), static_cast<streflop::Simple>(powFactor));
// distRu= streflop::pow(static_cast<streflop::Simple>(distRu), static_cast<streflop::Simple>(powFactor));
// distLd= streflop::pow(static_cast<streflop::Simple>(distLd), static_cast<streflop::Simple>(powFactor));
// distRd= streflop::pow(static_cast<streflop::Simple>(distRd), static_cast<streflop::Simple>(powFactor));
// avg= streflop::pow(static_cast<streflop::Simple>(avg), static_cast<streflop::Simple>(powFactor));
//#else
// distLu= pow(distLu, powFactor);
// distRu= pow(distRu, powFactor);
// distLd= pow(distLd, powFactor);
// distRd= pow(distRd, powFactor);
// avg= pow(avg, powFactor);
//#endif
distLu = std::pow(distLu, powFactor);
distRu = std::pow(distRu, powFactor);

View File

@ -66,42 +66,9 @@ void Quaternion::setAddIdentity(){
v= Vec3f(0.0f);
}
//void Quaternion::setAxisAngle(const AxisAngle &axisAngle){
//#ifdef USE_STREFLOP
// w= streflop::cosf(static_cast<streflop::Simple>(axisAngle.angle/2.0f));
// v.x= axisAngle.axis.x * streflop::sinf(static_cast<streflop::Simple>(axisAngle.angle/2.0f));
// v.y= axisAngle.axis.y * streflop::sinf(static_cast<streflop::Simple>(axisAngle.angle/2.0f));
// v.z= axisAngle.axis.z * streflop::sinf(static_cast<streflop::Simple>(axisAngle.angle/2.0f));
//#else
// w= cosf(axisAngle.angle/2.0f);
// v.x= axisAngle.axis.x * sinf(axisAngle.angle/2.0f);
// v.y= axisAngle.axis.y * sinf(axisAngle.angle/2.0f);
// v.z= axisAngle.axis.z * sinf(axisAngle.angle/2.0f);
//#endif
//}
void Quaternion::setEuler(const EulerAngles &eulerAngles){
Quaternion qx, qy, qz, qr;
//#ifdef USE_STREFLOP
// qx.w= streflop::cosf(static_cast<streflop::Simple>(eulerAngles.x/2.0f));
// qx.v= Vec3f(streflop::sinf(static_cast<streflop::Simple>(eulerAngles.x/2.0f)), 0.0f, 0.0f);
//
// qy.w= streflop::cosf(static_cast<streflop::Simple>(eulerAngles.y/2.0f));
// qy.v= Vec3f(0.0f, streflop::sinf(static_cast<streflop::Simple>(eulerAngles.y/2.0f)), 0.0f);
//
// qz.w= streflop::cosf(static_cast<streflop::Simple>(eulerAngles.z/2.0f));
// qz.v= Vec3f(0.0f, 0.0f, streflop::sinf(static_cast<streflop::Simple>(eulerAngles.z/2.0f)));
//#else
// qx.w= cosf(eulerAngles.x/2.0f);
// qx.v= Vec3f(sinf(eulerAngles.x/2.0f), 0.0f, 0.0f);
//
// qy.w= cosf(eulerAngles.y/2.0f);
// qy.v= Vec3f(0.0f, sinf(eulerAngles.y/2.0f), 0.0f);
//
// qz.w= cosf(eulerAngles.z/2.0f);
// qz.v= Vec3f(0.0f, 0.0f, sinf(eulerAngles.z/2.0f));
//#endif
qx.w= std::cos(eulerAngles.x/2.0f);
qx.v= Vec3f(std::sin(eulerAngles.x/2.0f), 0.0f, 0.0f);
@ -117,24 +84,10 @@ void Quaternion::setEuler(const EulerAngles &eulerAngles){
v= qr.v;
}
//float Quaternion::length(){
//#ifdef USE_STREFLOP
// return streflop::sqrt(static_cast<streflop::Simple>(w*w+v.x*v.x+v.y*v.y+v.z*v.z));
//#else
// return sqrt(w*w+v.x*v.x+v.y*v.y+v.z*v.z);
//#endif
//}
Quaternion Quaternion::conjugate(){
return Quaternion(w, -v);
}
//void Quaternion::normalize(){
// float il= 1.f/length();
// w*= il;
// v= v*il;
//}
Quaternion Quaternion::operator + (const Quaternion &q) const{
return Quaternion(w +q.w, v+q.v);
}
@ -212,15 +165,6 @@ Matrix4f Quaternion::toMatrix4() const{
return rm;
}
//AxisAngle Quaternion::toAxisAngle() const{
// float scale= 1.0f/(v.x*v.x + v.y*v.y + v.z*v.z);
//#ifdef USE_STREFLOP
// return AxisAngle(v*scale, 2*streflop::acosf(static_cast<streflop::Simple>(w)));
//#else
// return AxisAngle(v*scale, 2*acosf(w));
//#endif
//}
Vec3f Quaternion::getLocalXAxis() const{
return Vec3f(
1.0f - 2*v.y*v.y - 2*v.z*v.z,

View File

@ -481,11 +481,7 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_a
//const float lodBias = std::max(std::min( configHandler->Get("TextureLODBias", 0.0f) , 4.0f), -4.0f);
const float lodBias = max(min(0.0f,4.0f),-4.0f);
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("\n\n\n\n\n$$$$ In [%s::%s Line: %d] lodBias = %f\n\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,lodBias);
#ifdef USE_STREFLOP
if (streflop::fabs(static_cast<streflop::Simple>(lodBias)) > 0.01f) {
#else
if (fabs(lodBias) > 0.01f) {
#endif
if (std::fabs(lodBias) > 0.01f) {
glTexEnvf(GL_TEXTURE_FILTER_CONTROL,GL_TEXTURE_LOD_BIAS, lodBias );
}
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);

View File

@ -520,12 +520,7 @@ bool SoundPlayerDs8::findStrBuffer(Sound *sound, int *bufferIndex){
// =====================================================
long dsVolume(float floatVolume){
#ifdef USE_STREFLOP
float correctedVol= streflop::log10f(static_cast<streflop::Simple>(floatVolume*9.f+1.f));
#else
float correctedVol= log10f(floatVolume*9.f+1.f);
#endif
long vol= static_cast<long>(DSBVOLUME_MIN+correctedVol*(DSBVOLUME_MAX-DSBVOLUME_MIN));
return clamp(vol, DSBVOLUME_MIN, DSBVOLUME_MAX);
}

View File

@ -32,34 +32,15 @@ const int RandomGen::a= 1366;
const int RandomGen::b= 150889;
RandomGen::RandomGen(){
//#ifdef USE_STREFLOP
// lastNumber = streflop::RandomInit(0); // streflop
//#else
lastNumber= 0;
//#endif
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] lastNumber = %d\n",__FILE__,__FUNCTION__,__LINE__,lastNumber);
}
void RandomGen::init(int seed){
//#ifdef USE_STREFLOP
// lastNumber = streflop::RandomInit(seed); // streflop
//#else
lastNumber= seed % m;
//#endif
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] seed = %d, lastNumber = %d\n",__FILE__,__FUNCTION__,__LINE__,seed,lastNumber);
}
int RandomGen::rand(string lastCaller) {
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] lastNumber = %d\n",__FILE__,__FUNCTION__,__LINE__,lastNumber);
this->lastNumber = (a*lastNumber + b) % m;
//this->lastCaller.push_back(lastCaller);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] lastNumber = %d\n",__FILE__,__FUNCTION__,__LINE__,lastNumber);
return lastNumber;
}