1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-17 19:39:43 +00:00

games/barony: Fix build on armv7

The type real_t is float on ARM but double on other platforms.  Pepper
in a bunch of extra casts to make clang happy.

The alternative of making real_t a double on ARM does not work.

PR:		267442
Approved by:	maintainer timeout, >2 weeks
MFH:		2022Q4
This commit is contained in:
Robert Clausecker 2022-11-14 20:00:55 +00:00 committed by Nuno Teixeira
parent 1d44c147bf
commit 835b479670
18 changed files with 401 additions and 1 deletions

View File

@ -1,7 +1,7 @@
PORTNAME= barony
DISTVERSIONPREFIX= v
DISTVERSION= 3.3.7
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= games
MAINTAINER= devnexen@gmail.com

View File

@ -0,0 +1,28 @@
--- src/actarrow.cpp.orig 2022-10-30 18:44:49 UTC
+++ src/actarrow.cpp
@@ -257,14 +257,14 @@ void actArrow(Entity* my)
{
ARROW_VELZ += my->arrowFallSpeed;
my->z += ARROW_VELZ;
- my->pitch = std::min(my->pitch + pitchChange, PI / 8);
+ my->pitch = std::min(my->pitch + pitchChange, (real_t)PI / 8);
}
}
else
{
ARROW_VELZ += my->arrowFallSpeed;
my->z += ARROW_VELZ;
- my->pitch = std::min(my->pitch + pitchChange, PI / 8);
+ my->pitch = std::min(my->pitch + pitchChange, (real_t)PI / 8);
}
}
@@ -511,7 +511,7 @@ void actArrow(Entity* my)
real_t damageMultiplier = hit.entity->getDamageTableMultiplier(*hitstats, DAMAGE_TABLE_RANGED);
if ( huntingDamage || silverDamage )
{
- damageMultiplier = std::max(0.75, damageMultiplier);
+ damageMultiplier = std::max((real_t)0.75, damageMultiplier);
}
if ( hitWeaklyOnTarget )

View File

@ -0,0 +1,16 @@
--- src/actdoor.cpp.orig 2022-10-30 17:46:30 UTC
+++ src/actdoor.cpp
@@ -174,11 +174,11 @@ void actDoor(Entity* my)
// closing door
if ( my->yaw > my->doorStartAng )
{
- my->yaw = std::max(my->doorStartAng, my->yaw - 0.15);
+ my->yaw = std::max(my->doorStartAng, my->yaw - (real_t)0.15);
}
else if ( my->yaw < my->doorStartAng )
{
- my->yaw = std::min(my->doorStartAng, my->yaw + 0.15);
+ my->yaw = std::min(my->doorStartAng, my->yaw + (real_t)0.15);
}
}
else

View File

@ -0,0 +1,11 @@
--- src/actgate.cpp.orig 2022-10-30 18:41:27 UTC
+++ src/actgate.cpp
@@ -138,7 +138,7 @@ void Entity::actGate()
//Opening gate.
if ( this->z > gateStartHeight - 12 )
{
- this->z = std::max(gateStartHeight - 12, this->z - 0.25);
+ this->z = std::max(gateStartHeight - 12, this->z - (real_t)0.25);
// rattle the gate
gateRattle = (gateRattle == 0);

View File

@ -0,0 +1,22 @@
--- src/acthudweapon.cpp.orig 2022-10-30 17:42:45 UTC
+++ src/acthudweapon.cpp
@@ -2381,9 +2381,9 @@ void actHudWeapon(Entity* my)
}
else if ( HUDWEAPON_CHOP == 10 ) // special punch
{
- HUDWEAPON_MOVEX = std::max(static_cast<real_t>(0.0), HUDWEAPON_MOVEX - .15); // forward/back
- HUDWEAPON_MOVEY = std::min(static_cast<real_t>(1.0), HUDWEAPON_MOVEY + .25); // left/right
- HUDWEAPON_MOVEZ = std::max(static_cast<real_t>(-2.0), HUDWEAPON_MOVEZ - .05); // up/down
+ HUDWEAPON_MOVEX = std::max(static_cast<real_t>(0.0), static_cast<real_t>(HUDWEAPON_MOVEX - .15)); // forward/back
+ HUDWEAPON_MOVEY = std::min(static_cast<real_t>(1.0), static_cast<real_t>(HUDWEAPON_MOVEY + .25)); // left/right
+ HUDWEAPON_MOVEZ = std::max(static_cast<real_t>(-2.0), static_cast<real_t>(HUDWEAPON_MOVEZ - .05)); // up/down
HUDWEAPON_YAW -= .15;
if ( HUDWEAPON_YAW < 2 * PI / 5 )
@@ -4120,4 +4120,4 @@ void actHudArrowModel(Entity* my)
my->scalex = hudweapon->scalex;
my->scaley = hudweapon->scaley;
my->scalez = hudweapon->scalez;
-}
\ No newline at end of file
+}

View File

@ -0,0 +1,20 @@
--- src/actitem.cpp.orig 2022-10-30 17:39:42 UTC
+++ src/actitem.cpp
@@ -397,7 +397,7 @@ void actItem(Entity* my)
ITEM_VELZ += 0.04;
my->z += ITEM_VELZ;
my->roll += 0.02;
- my->roll = std::min(my->roll, PI / 2);
+ my->roll = std::min(my->roll, (real_t)PI / 2);
}
else if ( my->sprite == items[TOOL_BOMB].index || my->sprite == items[TOOL_FREEZE_BOMB].index
|| my->sprite == items[TOOL_SLEEP_BOMB].index || my->sprite == items[TOOL_TELEPORT_BOMB].index
@@ -416,7 +416,7 @@ void actItem(Entity* my)
if ( my->roll > PI / 2 && my->roll < 3 * PI / 2 )
{
my->roll += 0.08;
- my->roll = std::min(my->roll, 3 * PI / 2);
+ my->roll = std::min(my->roll, 3 * (real_t)PI / 2);
}
else
{

View File

@ -0,0 +1,60 @@
--- src/actmonster.cpp.orig 2022-10-30 17:36:42 UTC
+++ src/actmonster.cpp
@@ -3457,7 +3457,7 @@ void actMonster(Entity* my)
real_t monsterVisionRange = sightranges[myStats->type];
if ( hitstats->type == DUMMYBOT )
{
- monsterVisionRange = std::min(monsterVisionRange, 96.0);
+ monsterVisionRange = std::min(monsterVisionRange, (real_t)96.0);
}
if ( targetdist > monsterVisionRange )
@@ -4059,7 +4059,7 @@ void actMonster(Entity* my)
real_t monsterVisionRange = sightranges[myStats->type];
if ( hitstats && hitstats->type == DUMMYBOT )
{
- monsterVisionRange = std::min(monsterVisionRange, 96.0);
+ monsterVisionRange = std::min(monsterVisionRange, (real_t)96.0);
}
if ( myStats->EFFECTS[EFF_FEAR] )
{
@@ -4846,7 +4846,7 @@ timeToGoAgain:
real_t monsterVisionRange = sightranges[myStats->type];
if ( hitstats->type == DUMMYBOT )
{
- monsterVisionRange = std::min(monsterVisionRange, 96.0);
+ monsterVisionRange = std::min(monsterVisionRange, (real_t)96.0);
}
if ( targetdist > monsterVisionRange )
@@ -10466,19 +10466,19 @@ void Entity::monsterHandleKnockbackVelocity(real_t mon
if ( maxVelX > 0 )
{
- this->vel_x = std::min(this->vel_x + (this->monsterKnockbackVelocity * maxVelX), mobile ? maxVelX : 0.0);
+ this->vel_x = std::min(this->vel_x + (this->monsterKnockbackVelocity * maxVelX), mobile ? maxVelX : (real_t)0.0);
}
else
{
- this->vel_x = std::max(this->vel_x + (this->monsterKnockbackVelocity * maxVelX), mobile ? maxVelX : 0.0);
+ this->vel_x = std::max(this->vel_x + (this->monsterKnockbackVelocity * maxVelX), mobile ? maxVelX : (real_t)0.0);
}
if ( maxVelY > 0 )
{
- this->vel_y = std::min(this->vel_y + (this->monsterKnockbackVelocity * maxVelY), mobile ? maxVelY : 0.0);
+ this->vel_y = std::min(this->vel_y + (this->monsterKnockbackVelocity * maxVelY), mobile ? maxVelY : (real_t)0.0);
}
else
{
- this->vel_y = std::max(this->vel_y + (this->monsterKnockbackVelocity * maxVelY), mobile ? maxVelY : 0.0);
+ this->vel_y = std::max(this->vel_y + (this->monsterKnockbackVelocity * maxVelY), mobile ? maxVelY : (real_t)0.0);
}
this->monsterKnockbackVelocity *= 1.1;
}
@@ -10764,4 +10764,4 @@ bool Entity::isFollowerFreeToPathToPlayer(Stat* myStat
}
}
return true;
-}
\ No newline at end of file
+}

View File

@ -0,0 +1,27 @@
--- src/actplayer.cpp.orig 2022-10-30 17:34:26 UTC
+++ src/actplayer.cpp
@@ -791,7 +791,7 @@ void handlePlayerMovement(Entity* my, int playernum, b
}
else if ( stats[PLAYER_NUM]->EFFECTS[EFF_KNOCKBACK] )
{
- speedFactor = std::min(speedFactor, 5.0);
+ speedFactor = std::min(speedFactor, (real_t)5.0);
PLAYER_VELX += my->monsterKnockbackVelocity * cos(my->monsterKnockbackTangentDir) * refreshRateDelta;
PLAYER_VELY += my->monsterKnockbackVelocity * sin(my->monsterKnockbackTangentDir) * refreshRateDelta;
my->monsterKnockbackVelocity *= pow(0.95, refreshRateDelta);
@@ -6634,7 +6634,7 @@ void playerAnimateSpider(Entity* my)
if ( bodypart > 12 )
{
entity->pitch = -my->pitch;
- entity->pitch = std::max(-PI / 32, std::min(PI / 32, entity->pitch));
+ entity->pitch = std::max((real_t)-PI / 32, std::min((real_t)PI / 32, entity->pitch));
if ( bodypart % 2 == 0 )
{
entity->sprite = 826;
@@ -6913,4 +6913,4 @@ void playerAnimateSpider(Entity* my)
break;
}
}
-}
\ No newline at end of file
+}

View File

@ -0,0 +1,11 @@
--- src/actthrown.cpp.orig 2022-10-30 18:49:17 UTC
+++ src/actthrown.cpp
@@ -261,7 +261,7 @@ void actThrown(Entity* my)
else if ( type == TOOL_SENTRYBOT || type == TOOL_SPELLBOT )
{
my->roll += 0.07;
- my->roll = std::min(my->roll, 0.0);
+ my->roll = std::min(my->roll, (real_t)0.0);
}
else
{

View File

@ -0,0 +1,11 @@
--- src/game.cpp.orig 2022-10-30 17:32:23 UTC
+++ src/game.cpp
@@ -4011,7 +4011,7 @@ int main(int argc, char** argv)
}
real_t limit = PERModifier * 0.01;
- globalLightModifier = std::min(limit, globalLightModifier + 0.0005);
+ globalLightModifier = std::min(limit, globalLightModifier + (real_t)0.0005);
int telepathyLimit = std::min(64, 48 + players[clientnum]->entity->getPER());
globalLightTelepathyModifier = std::min(telepathyLimit / 255.0, globalLightTelepathyModifier + (0.2 / 255.0));

View File

@ -0,0 +1,11 @@
--- src/interface/updatecharactersheet.cpp.orig 2022-10-30 19:09:47 UTC
+++ src/interface/updatecharactersheet.cpp
@@ -848,7 +848,7 @@ void drawSkillsSheet()
skillDetails[1] += 20;
if ( stats[clientnum]->PROFICIENCIES[PRO_RANGED] < SKILL_LEVEL_LEGENDARY )
{
- skillDetails[1] = std::min(skillDetails[1], 90.0);
+ skillDetails[1] = std::min(skillDetails[1], (real_t)90.0);
}
}
if ( players[clientnum] && players[clientnum]->entity )

View File

@ -0,0 +1,31 @@
--- src/item_tool.cpp.orig 2022-10-30 18:55:30 UTC
+++ src/item_tool.cpp
@@ -923,7 +923,7 @@ void Item::applyBomb(Entity* parent, ItemType type, It
entity->flags[UPDATENEEDED] = true;
entity->x = thrown->x;
entity->y = thrown->y;
- entity->z = std::min(4.0, thrown->z);
+ entity->z = std::min((real_t)4.0, thrown->z);
int height = 1;
switch ( dir )
{
@@ -1046,10 +1046,10 @@ void Item::applyBomb(Entity* parent, ItemType type, It
entity->flags[UPDATENEEDED] = true;
entity->x = thrown->x;
entity->y = thrown->y;
- entity->z = std::min(4.0, thrown->z);
+ entity->z = std::min((real_t)4.0, thrown->z);
if ( placement == BOMB_CHEST )
{
- entity->z = std::max(2.0, entity->z);
+ entity->z = std::max((real_t)2.0, entity->z);
}
if ( hit.side == 0 )
@@ -1334,4 +1334,4 @@ bool itemIsThrowableTinkerTool(const Item* item)
return true;
}
return false;
-}
\ No newline at end of file
+}

View File

@ -0,0 +1,26 @@
--- src/items.cpp.orig 2022-10-30 17:29:46 UTC
+++ src/items.cpp
@@ -4634,14 +4634,14 @@ real_t rangedAttackGetSpeedModifier(const Stat* const
else if ( myStats->weapon->type == HEAVY_CROSSBOW )
{
bowModifier = 0.4;
- return std::max(0.1, bowModifier + arrowModifier);
+ return std::max((real_t)0.1, bowModifier + arrowModifier);
}
else
{
bowModifier = 1.00;
}
- return std::max(0.25, bowModifier + arrowModifier);
+ return std::max((real_t)0.25, bowModifier + arrowModifier);
}
bool rangedWeaponUseQuiverOnAttack(const Stat* const myStats)
@@ -4995,4 +4995,4 @@ void clientUnequipSlotAndUpdateServer(const EquipItemS
clientSendEquipUpdateToServer(slot, equipType, clientnum,
item->type, item->status, item->beatitude, item->count, item->appearance, item->identified);
-}
\ No newline at end of file
+}

View File

@ -0,0 +1,57 @@
--- src/magic/actmagic.cpp.orig 2022-10-30 19:00:46 UTC
+++ src/magic/actmagic.cpp
@@ -513,7 +513,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this
my->x = my->actmagicOrbitStationaryX + my->actmagicOrbitStationaryCurrentDist * cos(my->yaw);
my->y = my->actmagicOrbitStationaryY + my->actmagicOrbitStationaryCurrentDist * sin(my->yaw);
my->actmagicOrbitStationaryCurrentDist =
- std::min(my->actmagicOrbitStationaryCurrentDist + 0.5, static_cast<real_t>(my->actmagicOrbitDist));
+ std::min(my->actmagicOrbitStationaryCurrentDist + (real_t)0.5, static_cast<real_t>(my->actmagicOrbitDist));
}
hitFromAbove = my->magicOrbitingCollision();
my->z += my->vel_z * my->actmagicOrbitVerticalDirection;
@@ -522,9 +522,9 @@ void actMagicMissile(Entity* my) //TODO: Verify this
{
// we don't change direction, upwards we go!
// target speed is actmagicOrbitVerticalSpeed.
- my->vel_z = std::min(my->actmagicOrbitVerticalSpeed, my->vel_z / 0.95);
+ my->vel_z = std::min(my->actmagicOrbitVerticalSpeed, my->vel_z / (real_t)0.95);
my->roll += (PI / 8) / (turnRate / my->vel_z) * my->actmagicOrbitVerticalDirection;
- my->roll = std::max(my->roll, -PI / 4);
+ my->roll = std::max(my->roll, (real_t)-PI / 4);
}
else if ( my->z > my->actmagicOrbitStartZ )
{
@@ -535,7 +535,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this
}
else
{
- my->vel_z = std::min(my->actmagicOrbitVerticalSpeed, my->vel_z / 0.95);
+ my->vel_z = std::min(my->actmagicOrbitVerticalSpeed, my->vel_z / (real_t)0.95);
my->roll += (PI / 8) / (turnRate / my->vel_z) * my->actmagicOrbitVerticalDirection;
}
}
@@ -543,7 +543,7 @@ void actMagicMissile(Entity* my) //TODO: Verify this
{
if ( my->actmagicOrbitVerticalDirection == 1 )
{
- my->vel_z = std::min(my->actmagicOrbitVerticalSpeed, my->vel_z / 0.95);
+ my->vel_z = std::min(my->actmagicOrbitVerticalSpeed, my->vel_z / (real_t)0.95);
my->roll += (PI / 8) / (turnRate / my->vel_z) * my->actmagicOrbitVerticalDirection;
}
else
@@ -3733,7 +3733,7 @@ void actParticleTimer(Entity* my)
int durationToStun = 0;
if ( distance >= 2 )
{
- durationToStun = 25 + std::min((distance - 4) * 10, 50.0);
+ durationToStun = 25 + std::min((distance - 4) * 10, (real_t)50.0);
}
if ( target->behavior == &actMonster )
{
@@ -5616,4 +5616,4 @@ void magicDig(Entity* parent, Entity* projectile, int
boulderSokobanOnDestroy(false);
}
}
-}
\ No newline at end of file
+}

View File

@ -0,0 +1,18 @@
--- src/magic/castSpell.cpp.orig 2022-10-30 19:05:01 UTC
+++ src/magic/castSpell.cpp
@@ -1144,7 +1144,7 @@ Entity* castSpell(Uint32 caster_uid, spell_t* spell, b
else
{
real_t vel = sqrt(pow(caster->vel_y, 2) + pow(caster->vel_x, 2));
- caster->monsterKnockbackVelocity = std::min(2.25, std::max(1.0, vel));
+ caster->monsterKnockbackVelocity = std::min((real_t)2.25, std::max((real_t)1.0, vel));
caster->monsterKnockbackTangentDir = atan2(caster->vel_y, caster->vel_x);
if ( vel < 0.01 )
{
@@ -2492,4 +2492,4 @@ bool spellIsNaturallyLearnedByRaceOrClass(Entity& cast
}
return false;
-}
\ No newline at end of file
+}

View File

@ -0,0 +1,22 @@
--- src/monster_lichfire.cpp.orig 2022-10-30 18:36:41 UTC
+++ src/monster_lichfire.cpp
@@ -756,10 +756,10 @@ void lichFireAnimate(Entity* my, Stat* myStats, double
{
if ( target )
{
- real_t targetDist = std::min(entityDist(my, target), 32.0);
+ real_t targetDist = std::min(entityDist(my, target), (real_t)32.0);
for ( int i = 0; i < 8; ++i )
{
- my->castFallingMagicMissile(SPELL_FIREBALL, std::max(targetDist - 8 + rand() % 8, 4.0), dir + i * PI / 4, 0);
+ my->castFallingMagicMissile(SPELL_FIREBALL, std::max(targetDist - 8 + rand() % 8, (real_t)4.0), dir + i * PI / 4, 0);
}
}
else
@@ -1304,4 +1304,4 @@ void Entity::lichFireSummonMonster(Monster creature)
serverSpawnMiscParticlesAtLocation(spawn_x, spawn_y, 0, PARTICLE_EFFECT_SUMMON_MONSTER, 174);
}
}
-}
\ No newline at end of file
+}

View File

@ -0,0 +1,18 @@
--- src/monster_sentrybot.cpp.orig 2022-10-30 18:38:58 UTC
+++ src/monster_sentrybot.cpp
@@ -883,7 +883,7 @@ void sentryBotAnimate(Entity* my, Stat* myStats, doubl
entity->z += limbs[race][10][2];
if ( my->monsterAttack == MONSTER_POSE_RANGED_SHOOT1 )
{
- entity->fskill[0] = std::min(3.5, 2 + entity->fskill[0]);
+ entity->fskill[0] = std::min((real_t)3.5, 2 + entity->fskill[0]);
entity->focalx += entity->fskill[0];
}
else
@@ -2227,4 +2227,4 @@ void Entity::tinkerBotSetStats(Stat* myStats, int rank
myStats->MAXHP = myStats->HP;
myStats->OLDHP = myStats->HP;
return;
-}
\ No newline at end of file
+}

View File

@ -0,0 +1,11 @@
--- src/net.cpp.orig 2022-10-30 17:24:45 UTC
+++ src/net.cpp
@@ -4212,7 +4212,7 @@ void clientHandlePacket()
if ( players[clientnum] && players[clientnum]->entity && stats[clientnum] )
{
real_t vel = sqrt(pow(players[clientnum]->entity->vel_y, 2) + pow(players[clientnum]->entity->vel_x, 2));
- players[clientnum]->entity->monsterKnockbackVelocity = std::min(2.25, std::max(1.0, vel));
+ players[clientnum]->entity->monsterKnockbackVelocity = std::min((real_t)2.25, std::max((real_t)1.0, vel));
players[clientnum]->entity->monsterKnockbackTangentDir = atan2(players[clientnum]->entity->vel_y, players[clientnum]->entity->vel_x);
if ( vel < 0.01 )
{