Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build on ARM, considering real number being float in this case. #448

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ if( NOT WIN32 )
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -malign-double")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -malign-double")
endif()
if (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fsingle-precision-constant")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsingle-precision-constant")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fsingle-precision-constant")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fsingle-precision-constant")
endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -rdynamic -Wl,-rpath=$ORIGIN")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11 -rdynamic -Wl,-rpath=$ORIGIN")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wl,-rpath=$ORIGIN -Wno-write-strings")
Expand Down
16 changes: 8 additions & 8 deletions src/actplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3391,14 +3391,14 @@ void actPlayer(Entity* my)
DEX = std::min(DEX - 3, -2);
slowSpeedPenalty = 2.0;
}
real_t speedFactor = std::min((DEX * 0.1 + 15.5 - slowSpeedPenalty) * weightratio, 18.0);
real_t speedFactor = std::min(static_cast<real_t>((DEX * 0.1 + 15.5 - slowSpeedPenalty) * weightratio), 18.0);
if ( DEX <= 5 )
{
speedFactor = std::min((DEX + 10) * weightratio, 18.0);
speedFactor = std::min(static_cast<real_t>((DEX + 10) * weightratio), 18.0);
}
else if ( DEX <= 15 )
{
speedFactor = std::min((DEX * 0.2 + 14 - slowSpeedPenalty) * weightratio, 18.0);
speedFactor = std::min(static_cast<real_t>((DEX * 0.2 + 14 - slowSpeedPenalty) * weightratio), 18.0);
}
/*if ( ticks % 50 == 0 )
{
Expand Down Expand Up @@ -5183,11 +5183,11 @@ void actPlayer(Entity* my)
{
if ( insectoidLevitating[PLAYER_NUM] )
{
entity->fskill[0] += std::min(std::max(0.2, dist * PLAYERWALKSPEED), 2.f * PLAYERWALKSPEED); // move proportional to move speed
entity->fskill[0] += std::min(std::max(0.2, static_cast<real_t>(dist * PLAYERWALKSPEED)), static_cast<real_t>(2.0 * PLAYERWALKSPEED)); // move proportional to move speed
}
else
{
entity->fskill[0] += std::min(dist * PLAYERWALKSPEED, 2.f * PLAYERWALKSPEED); // move proportional to move speed
entity->fskill[0] += std::min(static_cast<real_t>(dist * PLAYERWALKSPEED), static_cast<real_t>(2.0 * PLAYERWALKSPEED)); // move proportional to move speed
}
}
else if ( PLAYER_ATTACK != 0 )
Expand All @@ -5213,11 +5213,11 @@ void actPlayer(Entity* my)
{
if ( insectoidLevitating[PLAYER_NUM] )
{
entity->fskill[0] -= std::min(std::max(0.15, dist * PLAYERWALKSPEED), 2.f * PLAYERWALKSPEED);
entity->fskill[0] -= std::min(std::max(0.15, static_cast<real_t>(dist * PLAYERWALKSPEED)), static_cast<real_t>(2.0 * PLAYERWALKSPEED)); // move proportional to move speed
}
else
{
entity->fskill[0] -= std::min(dist * PLAYERWALKSPEED, 2.f * PLAYERWALKSPEED);
entity->fskill[0] -= std::min(static_cast<real_t>(dist * PLAYERWALKSPEED), static_cast<real_t>(2.0 * PLAYERWALKSPEED)); // move proportional to move speed
}
}
else if ( PLAYER_ATTACK != 0 )
Expand Down Expand Up @@ -6619,4 +6619,4 @@ void playerAnimateSpider(Entity* my)
break;
}
}
}
}
5 changes: 3 additions & 2 deletions src/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ void closeNetworkInterfaces()
-------------------------------------------------------------------------------*/

view_t camera_vel;
view_t &camera = cameras[0];

void mainLogic(void)
{
Expand Down Expand Up @@ -4522,7 +4523,7 @@ int main(int argc, char** argv)
color = SDL_MapRGB(mainsurface->format, 0, 255, 0);
char tmpStr[32] = "";
strcpy(tmpStr, spriteProperties[i]); //reset
strcat(tmpStr, " Tiles to power in facing direction");
strcat(tmpStr, " Tiles to power in facing dir.");
printTextFormattedColor(font8x8_bmp, pad_x3, pad_y2, color, tmpStr);
}
}
Expand Down Expand Up @@ -7413,4 +7414,4 @@ void reselectEntityGroup()
int generateDungeon(char* levelset, Uint32 seed, std::tuple<int, int, int> mapParameters)
{
return 0; // dummy function
}
}
4 changes: 2 additions & 2 deletions src/monster_insectoid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,7 @@ void insectoidMoveBodyparts(Entity* my, Stat* myStats, double dist)
{
if ( moving )
{
entity->fskill[0] += std::min(dist * INSECTOIDWALKSPEED, 2.f * INSECTOIDWALKSPEED); // move proportional to move speed
entity->fskill[0] += std::min(static_cast<real_t>(dist * INSECTOIDWALKSPEED), static_cast<real_t>(2.0 * INSECTOIDWALKSPEED)); // move proportional to move speed
}
else if ( my->monsterAttack != 0 )
{
Expand All @@ -1504,7 +1504,7 @@ void insectoidMoveBodyparts(Entity* my, Stat* myStats, double dist)
{
if ( moving )
{
entity->fskill[0] -= std::min(dist * INSECTOIDWALKSPEED, 2.f * INSECTOIDWALKSPEED);
entity->fskill[0] -= std::min(static_cast<real_t>(dist * INSECTOIDWALKSPEED), static_cast<real_t>(2.0 * INSECTOIDWALKSPEED));
}
else if ( my->monsterAttack != 0 )
{
Expand Down
10 changes: 5 additions & 5 deletions src/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,9 @@ void sound_update()
}

FMOD_VECTOR position;
position.x = -camera.y;
position.y = -camera.z / 32;
position.z = -camera.x;
position.x = -cameras[0].y;
position.y = -cameras[0].z / 32;
position.z = -cameras[0].x;

/*double cosroll = cos(0);
double cosyaw = cos(camera.ang);
Expand All @@ -603,9 +603,9 @@ void sound_update()
double rz = cosroll*cospitch;*/

float vector[6];
vector[0] = 1 * sin(camera.ang);
vector[0] = 1 * sin(cameras[0].ang);
vector[1] = 0;
vector[2] = 1 * cos(camera.ang);
vector[2] = 1 * cos(cameras[0].ang);
/*forward.x = rx;
forward.y = ry;
forward.z = rz;*/
Expand Down