mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
good news - i fixed nasty freeze with throwing items through window. make your tests again.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@324 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -100,6 +100,8 @@ FLOAT CalculateForceFromRange( INT16 sRange, FLOAT dDegrees );
|
|||||||
|
|
||||||
UINT16 RandomGridFromRadius( INT16 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRadius );
|
UINT16 RandomGridFromRadius( INT16 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRadius );
|
||||||
|
|
||||||
|
// Lesh: needed to fix item throwing through window
|
||||||
|
extern INT16 DirIncrementer[8];
|
||||||
|
|
||||||
void HandleArmedObjectImpact( REAL_OBJECT *pObject );
|
void HandleArmedObjectImpact( REAL_OBJECT *pObject );
|
||||||
void ObjectHitWindow( INT16 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce );
|
void ObjectHitWindow( INT16 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce );
|
||||||
@@ -1881,6 +1883,18 @@ DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1750"));
|
|||||||
|
|
||||||
|
|
||||||
// OK, look if we can go through a windows here...
|
// OK, look if we can go through a windows here...
|
||||||
|
if ( ubLevel == 0 )
|
||||||
|
{
|
||||||
|
sInterGridNo = SoldierToLocationWindowTest( pSoldier, sGridNo );
|
||||||
|
|
||||||
|
// Lesh: fixing nasty freeze when throwing item through window
|
||||||
|
// sometimes SoldierToLocationWindowTest returns same value as pSoldier->sGridNo
|
||||||
|
// this leads to fault in FindBestAngleForTrajectory function and it subroutines loops
|
||||||
|
// supplied by invalid data
|
||||||
|
if ( pSoldier->sGridNo == sInterGridNo )
|
||||||
|
{
|
||||||
|
// bad news - i can't throw item at myself
|
||||||
|
// so use dir incrementer
|
||||||
UINT8 ubDir = atan8( CenterX(pSoldier->sGridNo), CenterY(pSoldier->sGridNo), CenterX(sGridNo), CenterY(sGridNo) );
|
UINT8 ubDir = atan8( CenterX(pSoldier->sGridNo), CenterY(pSoldier->sGridNo), CenterX(sGridNo), CenterY(sGridNo) );
|
||||||
sInterGridNo += DirIncrementer[ubDir];
|
sInterGridNo += DirIncrementer[ubDir];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user