- a few changes and now seems to compile in VC++ 2010 (still need to checkin project files)
This commit is contained in:
parent
8ec58868dc
commit
a0cfe3fa08
|
@ -123,7 +123,11 @@ void GameCamera::update(){
|
|||
|
||||
//free state
|
||||
if(state==sFree){
|
||||
#ifdef USE_STREFLOP
|
||||
if(streflop::fabs(rotate) == 1){
|
||||
#else
|
||||
if(fabs(rotate) == 1){
|
||||
#endif
|
||||
rotateHV(speed*5*rotate, 0);
|
||||
}
|
||||
if(move.y>0){
|
||||
|
|
|
@ -4622,15 +4622,22 @@ void Renderer::renderUnitTitles(Font2D *font, Vec3f color) {
|
|||
if(unit != NULL && unit->getCurrentUnitTitle() != "") {
|
||||
//get the screen coordinates
|
||||
Vec3f screenPos = unit->getScreenPos();
|
||||
#ifdef USE_STREFLOP
|
||||
renderText(unit->getCurrentUnitTitle(), font, color, streflop::fabs(screenPos.x) + 5, streflop::fabs(screenPos.y) + 5, false);
|
||||
#else
|
||||
renderText(unit->getCurrentUnitTitle(), font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] screenPos.x = %f, screenPos.y = %f, screenPos.z = %f\n",__FILE__,__FUNCTION__,__LINE__,screenPos.x,screenPos.y,screenPos.z);
|
||||
#endif
|
||||
|
||||
unitRenderedList[unit->getId()] = true;
|
||||
}
|
||||
else {
|
||||
string str = unit->getFullName() + " - " + intToStr(unit->getId());
|
||||
Vec3f screenPos = unit->getScreenPos();
|
||||
#ifdef USE_STREFLOP
|
||||
renderText(str, font, color, streflop::fabs(screenPos.x) + 5, streflop::fabs(screenPos.y) + 5, false);
|
||||
#else
|
||||
renderText(str, font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
visibleFrameUnitList.clear();
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "font_gl.h"
|
||||
#include "FileReader.h"
|
||||
#include "cache_manager.h"
|
||||
#include <iterator>
|
||||
|
||||
// For gcc backtrace on crash!
|
||||
#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__FreeBSD__) && !defined(BSD)
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
#include <time.h>
|
||||
#include <curl/curl.h>
|
||||
#include "cache_manager.h"
|
||||
#include "leak_dumper.h"
|
||||
#include <iterator>
|
||||
#include "map_preview.h"
|
||||
|
||||
#include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
|
||||
|
|
|
@ -168,7 +168,12 @@ 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(vol*9+1)*9+1);
|
||||
#else
|
||||
float correctedVol= log10(log10(vol*9+1)*9+1);
|
||||
#endif
|
||||
|
||||
staticSound->setVolume(correctedVol);
|
||||
|
||||
if(soundPlayer != NULL) {
|
||||
|
|
|
@ -1120,8 +1120,13 @@ void Map::smoothSurface(Tileset *tileset) {
|
|||
float numUsedToSmooth = 0.f;
|
||||
for (int k = -1; k <= 1; ++k) {
|
||||
for (int l = -1; l <= 1; ++l) {
|
||||
#ifdef USE_STREFLOP
|
||||
if (cliffLevel<=0.1f || cliffLevel > streflop::fabs(oldHeights[(j) * surfaceW + (i)]
|
||||
- oldHeights[(j + k) * surfaceW + (i + l)])) {
|
||||
#else
|
||||
if (cliffLevel<=0.1f || cliffLevel > fabs(oldHeights[(j) * surfaceW + (i)]
|
||||
- oldHeights[(j + k) * surfaceW + (i + l)])) {
|
||||
#endif
|
||||
height += oldHeights[(j + k) * surfaceW + (i + l)];
|
||||
numUsedToSmooth++;
|
||||
}
|
||||
|
|
|
@ -1939,7 +1939,12 @@ bool UnitUpdater::unitOnRange(const Unit *unit, int range, Unit **rangedPtr,
|
|||
delete toDelete; // old one
|
||||
}
|
||||
else {
|
||||
#ifdef USE_STREFLOP
|
||||
currentDistance = streflop::floor(enemyFloatCenter.dist(attackWarnings[i]->attackPosition)); // no need for streflops here!
|
||||
#else
|
||||
currentDistance = floor(enemyFloatCenter.dist(attackWarnings[i]->attackPosition)); // no need for streflops here!
|
||||
#endif
|
||||
|
||||
if( nearest==NULL ){
|
||||
nearest=attackWarnings[i];
|
||||
nearestDistance=currentDistance;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#ifdef USE_STREFLOP
|
||||
|
||||
#include <cmath>
|
||||
#include "streflop_cond.h"
|
||||
|
||||
#else
|
||||
|
|
|
@ -102,7 +102,11 @@ int MapPreview::getStartLocationY(int index) const {
|
|||
static int get_dist(int delta_x, int delta_y) {
|
||||
float dx = (float)delta_x;
|
||||
float dy = (float)delta_y;
|
||||
#ifdef USE_STREFLOP
|
||||
return static_cast<int>(streflop::sqrtf(dx * dx + dy * dy)+0.5); // round correctly
|
||||
#else
|
||||
return static_cast<int>(sqrtf(dx * dx + dy * dy)+0.5); // round correctly
|
||||
#endif
|
||||
}
|
||||
|
||||
void MapPreview::glestChangeHeight(int x, int y, int height, int radius) {
|
||||
|
@ -265,7 +269,26 @@ void MapPreview::pirateChangeHeight(int x, int y, int height, int radius) {
|
|||
}
|
||||
|
||||
// Determine which gradients to use and take a weighted average
|
||||
#ifdef USE_STREFLOP
|
||||
if (streflop::fabs(normIf) > streflop::fabs(normJf)) {
|
||||
|
||||
usedGrad =
|
||||
gradient[normI[0]] [normJ[0]] * streflop::fabs(normJf) +
|
||||
gradient[normI[0]] [normJ[1]] * (1 - streflop::fabs(normJf));
|
||||
}
|
||||
else if (streflop::fabs(normIf) < streflop::fabs(normJf)) {
|
||||
usedGrad =
|
||||
gradient[normI[0]] [normJ[0]] * streflop::fabs(normIf) +
|
||||
gradient[normI[1]] [normJ[0]] * (1 - streflop::fabs(normIf));
|
||||
}
|
||||
else {
|
||||
usedGrad =
|
||||
gradient[normI[0]] [normJ[0]];
|
||||
}
|
||||
|
||||
#else
|
||||
if (fabs(normIf) > fabs(normJf)) {
|
||||
|
||||
usedGrad =
|
||||
gradient[normI[0]] [normJ[0]] * fabs(normJf) +
|
||||
gradient[normI[0]] [normJ[1]] * (1 - fabs(normJf));
|
||||
|
@ -279,7 +302,7 @@ void MapPreview::pirateChangeHeight(int x, int y, int height, int radius) {
|
|||
usedGrad =
|
||||
gradient[normI[0]] [normJ[0]];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
float newAlt = usedGrad * dist + goalAlt;
|
||||
|
||||
|
@ -812,9 +835,13 @@ void MapPreview::sinRandomize(int strenght) {
|
|||
float normH = static_cast<float>(i) / w;
|
||||
float normV = static_cast<float>(j) / h;
|
||||
|
||||
#ifdef USE_STREFLOP
|
||||
float sh = (streflop::sinf(normH * sinH1) + streflop::sin(normH * sinH2)) / 2.f;
|
||||
float sv = (streflop::sinf(normV * sinV1) + streflop::sin(normV * sinV2)) / 2.f;
|
||||
#else
|
||||
float sh = (sinf(normH * sinH1) + sin(normH * sinH2)) / 2.f;
|
||||
float sv = (sinf(normV * sinV1) + sin(normV * sinV2)) / 2.f;
|
||||
|
||||
#endif
|
||||
float newHeight = (ah + bh * sh + av + bv * sv) / 2.f;
|
||||
applyNewHeight(newHeight, i, j, strenght);
|
||||
}
|
||||
|
|
|
@ -386,7 +386,11 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_a
|
|||
// setup LOD bias factor
|
||||
//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);
|
||||
#ifdef USE_STREFLOP
|
||||
if (streflop::fabs(lodBias) > 0.01f) {
|
||||
#else
|
||||
if (fabs(lodBias) > 0.01f) {
|
||||
#endif
|
||||
glTexEnvf(GL_TEXTURE_FILTER_CONTROL,GL_TEXTURE_LOD_BIAS, lodBias );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue