git: 835b47967053 - main - games/barony: Fix build on armv7

From: Nuno Teixeira <eduardo_at_FreeBSD.org>
Date: Mon, 14 Nov 2022 20:04:07 UTC
The branch main has been updated by eduardo:

URL: https://cgit.FreeBSD.org/ports/commit/?id=835b479670531fb700f0f3aad9333f121e144852

commit 835b479670531fb700f0f3aad9333f121e144852
Author:     Robert Clausecker <fuz@fuz.su>
AuthorDate: 2022-11-14 20:00:55 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2022-11-14 20:03:54 +0000

    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
---
 games/barony/Makefile                              |  2 +-
 games/barony/files/patch-src_actarrow.cpp          | 28 ++++++++++
 games/barony/files/patch-src_actdoor.cpp           | 16 ++++++
 games/barony/files/patch-src_actgate.cpp           | 11 ++++
 games/barony/files/patch-src_acthudweapon.cpp      | 22 ++++++++
 games/barony/files/patch-src_actitem.cpp           | 20 ++++++++
 games/barony/files/patch-src_actmonster.cpp        | 60 ++++++++++++++++++++++
 games/barony/files/patch-src_actplayer.cpp         | 27 ++++++++++
 games/barony/files/patch-src_actthrown.cpp         | 11 ++++
 games/barony/files/patch-src_game.cpp              | 11 ++++
 .../patch-src_interface_updatecharactersheet.cpp   | 11 ++++
 games/barony/files/patch-src_item__tool.cpp        | 31 +++++++++++
 games/barony/files/patch-src_items.cpp             | 26 ++++++++++
 games/barony/files/patch-src_magic_actmagic.cpp    | 57 ++++++++++++++++++++
 games/barony/files/patch-src_magic_castSpell.cpp   | 18 +++++++
 games/barony/files/patch-src_monster__lichfire.cpp | 22 ++++++++
 .../barony/files/patch-src_monster__sentrybot.cpp  | 18 +++++++
 games/barony/files/patch-src_net.cpp               | 11 ++++
 18 files changed, 401 insertions(+), 1 deletion(-)

diff --git a/games/barony/Makefile b/games/barony/Makefile
index a256d031133d..76a79d0c2508 100644
--- a/games/barony/Makefile
+++ b/games/barony/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	barony
 DISTVERSIONPREFIX=	v
 DISTVERSION=	3.3.7
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	games
 
 MAINTAINER=	devnexen@gmail.com
diff --git a/games/barony/files/patch-src_actarrow.cpp b/games/barony/files/patch-src_actarrow.cpp
new file mode 100644
index 000000000000..362634edf788
--- /dev/null
+++ b/games/barony/files/patch-src_actarrow.cpp
@@ -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 )
diff --git a/games/barony/files/patch-src_actdoor.cpp b/games/barony/files/patch-src_actdoor.cpp
new file mode 100644
index 000000000000..e6fc5c38374c
--- /dev/null
+++ b/games/barony/files/patch-src_actdoor.cpp
@@ -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
diff --git a/games/barony/files/patch-src_actgate.cpp b/games/barony/files/patch-src_actgate.cpp
new file mode 100644
index 000000000000..b9ca0961766d
--- /dev/null
+++ b/games/barony/files/patch-src_actgate.cpp
@@ -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);
diff --git a/games/barony/files/patch-src_acthudweapon.cpp b/games/barony/files/patch-src_acthudweapon.cpp
new file mode 100644
index 000000000000..3b0f1c408bc3
--- /dev/null
+++ b/games/barony/files/patch-src_acthudweapon.cpp
@@ -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
++}
diff --git a/games/barony/files/patch-src_actitem.cpp b/games/barony/files/patch-src_actitem.cpp
new file mode 100644
index 000000000000..e0e37c7d2402
--- /dev/null
+++ b/games/barony/files/patch-src_actitem.cpp
@@ -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
+ 			{
diff --git a/games/barony/files/patch-src_actmonster.cpp b/games/barony/files/patch-src_actmonster.cpp
new file mode 100644
index 000000000000..7b02d1b09e2b
--- /dev/null
+++ b/games/barony/files/patch-src_actmonster.cpp
@@ -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
++}
diff --git a/games/barony/files/patch-src_actplayer.cpp b/games/barony/files/patch-src_actplayer.cpp
new file mode 100644
index 000000000000..497613d168b7
--- /dev/null
+++ b/games/barony/files/patch-src_actplayer.cpp
@@ -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
++}
diff --git a/games/barony/files/patch-src_actthrown.cpp b/games/barony/files/patch-src_actthrown.cpp
new file mode 100644
index 000000000000..217ea2f8d3df
--- /dev/null
+++ b/games/barony/files/patch-src_actthrown.cpp
@@ -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
+ 			{
diff --git a/games/barony/files/patch-src_game.cpp b/games/barony/files/patch-src_game.cpp
new file mode 100644
index 000000000000..e26e05d19d02
--- /dev/null
+++ b/games/barony/files/patch-src_game.cpp
@@ -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));
diff --git a/games/barony/files/patch-src_interface_updatecharactersheet.cpp b/games/barony/files/patch-src_interface_updatecharactersheet.cpp
new file mode 100644
index 000000000000..a62260e997e6
--- /dev/null
+++ b/games/barony/files/patch-src_interface_updatecharactersheet.cpp
@@ -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 )
diff --git a/games/barony/files/patch-src_item__tool.cpp b/games/barony/files/patch-src_item__tool.cpp
new file mode 100644
index 000000000000..d9d69e1dde1e
--- /dev/null
+++ b/games/barony/files/patch-src_item__tool.cpp
@@ -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
++}
diff --git a/games/barony/files/patch-src_items.cpp b/games/barony/files/patch-src_items.cpp
new file mode 100644
index 000000000000..cd6855f7e5a8
--- /dev/null
+++ b/games/barony/files/patch-src_items.cpp
@@ -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
++}
diff --git a/games/barony/files/patch-src_magic_actmagic.cpp b/games/barony/files/patch-src_magic_actmagic.cpp
new file mode 100644
index 000000000000..9d138cb30603
--- /dev/null
+++ b/games/barony/files/patch-src_magic_actmagic.cpp
@@ -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
++}
diff --git a/games/barony/files/patch-src_magic_castSpell.cpp b/games/barony/files/patch-src_magic_castSpell.cpp
new file mode 100644
index 000000000000..4f000fa15cdb
--- /dev/null
+++ b/games/barony/files/patch-src_magic_castSpell.cpp
@@ -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
++}
diff --git a/games/barony/files/patch-src_monster__lichfire.cpp b/games/barony/files/patch-src_monster__lichfire.cpp
new file mode 100644
index 000000000000..04cb84f29c25
--- /dev/null
+++ b/games/barony/files/patch-src_monster__lichfire.cpp
@@ -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
++}
diff --git a/games/barony/files/patch-src_monster__sentrybot.cpp b/games/barony/files/patch-src_monster__sentrybot.cpp
new file mode 100644
index 000000000000..7830c346cdbf
--- /dev/null
+++ b/games/barony/files/patch-src_monster__sentrybot.cpp
@@ -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
++}
diff --git a/games/barony/files/patch-src_net.cpp b/games/barony/files/patch-src_net.cpp
new file mode 100644
index 000000000000..e6e6d1f738a6
--- /dev/null
+++ b/games/barony/files/patch-src_net.cpp
@@ -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 )
+ 			{