Merged New Inventory Project into main branch

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2008-03-08 15:15:25 +00:00
parent e16d166277
commit 43ca24dda8
649 changed files with 93359 additions and 82507 deletions
+111 -110
View File
@@ -23,27 +23,27 @@
#include "Editor Undo.h"
#endif
INT16 gbSmoothStruct[] =
INT16 gbSmoothStruct[] =
{
3, 2, 12, 27, 12, 0,
5, 2, 15, 30, 39, 0,
5, 2, 15, 30, 39, 0,
7, 2, 17, 32, 41, 0,
11, 2, 14, 29, 14, 0,
11, 2, 14, 29, 14, 0,
8, 2, 13, 28, 38, 0,
15, 1, 19, 0, 43, 0,
26, 1, 20, 0, 44, 0,
12, 2, 18, 33, 42, 0,
23, 1, 21, 0, 45, 0,
18, 2, 16, 31, 40, 0,
21, 1, 22, 0, 46, 0,
14, 2, 11, 26, 11, 0,
19, 1, 23, 0, 47, 0,
16, 2, 24, 34, 48, 0,
10, 2, 25, 35, 49, 0,
-1
15, 1, 19, 0, 43, 0,
26, 1, 20, 0, 44, 0,
12, 2, 18, 33, 42, 0,
23, 1, 21, 0, 45, 0,
18, 2, 16, 31, 40, 0,
21, 1, 22, 0, 46, 0,
14, 2, 11, 26, 11, 0,
19, 1, 23, 0, 47, 0,
16, 2, 24, 34, 48, 0,
10, 2, 25, 35, 49, 0,
-1
};
// This is a list of smoothed out water/shoreline textures
// Coding is as such:
// 1st - the corresponding bitvalue for the surrounding water tiles
@@ -51,21 +51,21 @@ INT16 gbSmoothStruct[] =
// 3rd - the first variation
// 4th - the second variation
INT16 gbSmoothWaterStruct[] =
INT16 gbSmoothWaterStruct[] =
// FIRST ENTRY MAJIC NUMBER CALCULATED
// 2nd ENTRY # OF VARIATIONS
// 3rd, 4rth ENTRY TILE NUMBERS ( entry 1, entry 2 )
// 3rd, 4rth ENTRY TILE NUMBERS ( entry 1, entry 2 )
{
1020, 1, 11, 0,
1000, 1, 12, 0,
1020, 1, 11, 0,
1000, 1, 12, 0,
510, 2, 13, 43,
190, 1, 14, 0,
894, 1, 15, 0,
622, 1, 16, 0,
1014, 2, 17, 41,
944, 1, 18, 24,
872, 1, 19, 0,
992, 1, 20, 0,
622, 1, 16, 0,
1014, 2, 17, 41,
944, 1, 18, 24,
872, 1, 19, 0,
992, 1, 20, 0,
62, 1, 21, 0,
190, 2, 22, 14,
620, 1, 23, 0,
@@ -74,51 +74,51 @@ INT16 gbSmoothWaterStruct[] =
434, 1, 28, 0,
110, 1, 29,0,
1010, 1, 30,0,
876, 2, 31, 32,
876, 2, 31, 32,
878, 2, 32, 31,
1004, 2, 32, 31,
1004, 2, 32, 31,
1006, 2, 33, 34,
1008, 2, 34, 33,
1016, 2, 33, 34,
126, 2, 35, 36,
254, 2, 35, 26,
638, 2, 36, 26,
254, 2, 35, 26,
638, 2, 36, 26,
438, 2, 38, 27,
446, 2, 37, 38,
950, 2, 37, 27,
864, 1, 39, 0,
1040, 1, 40, 0,
1040, 1, 40, 0,
1014, 2, 41, 17,
432, 1, 42, 0,
510, 1, 43, 13,
54, 1, 44, 0,
108, 1, 45, 0,
108, 1, 45, 0,
-1
};
BOOLEAN HigherLevel( UINT32 gridno, UINT8 NewLevel );
BOOLEAN ContainsWater( UINT32 gridno );
BOOLEAN HigherLevel( INT32 gridno, UINT8 NewLevel );
BOOLEAN ContainsWater( INT32 gridno );
void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth )
{
int temp=0,type=0;
int temp=0;
int FullTile = FALSE;
UINT16 usOldIndex;
UINT16 usTempIndex;
UINT32 cnt;
BOOLEAN fFound;
UINT32 uiTempIndex;
UINT16 usTileIndex;
UINT16 usTileIndex;
UINT16 land=0;
UINT32 uiTopType;
UINT32 uiTopType;
BOOLEAN fSameTile;
INT16 *pSmoothStruct;
// Check to see if the orginal texture was water, is so, smooth square/hex with
// Check to see if the orginal texture was water, is so, smooth square/hex with
// SmoothWaterTerrain rather than the proceeding method
if( origType==REGWATERTEXTURE)
{
SmoothWaterTerrain( gridno, origType, piNewTile, TRUE);
SmoothWaterTerrain( gridno, origType, piNewTile, TRUE);
return;
}
pSmoothStruct = gbSmoothStruct;
@@ -142,7 +142,7 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm
if ( usOldIndex >= 1 && usOldIndex <= 10 )
{
*piNewTile = NO_TILE;
return;
return;
}
}
@@ -188,7 +188,7 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm
// Now, at this point the height (of "temp") will tell us
// which texture piece to use
// Loop through smooth struct
cnt = 0;
fFound = FALSE;
@@ -210,10 +210,10 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm
}
if ( pSmoothStruct[ cnt + 3 ] )
{
if ( pSmoothStruct[ cnt + 3 ] == usOldIndex )
{
if ( pSmoothStruct[ cnt + 3 ] == usOldIndex )
{
fSameTile = TRUE;
}
}
}
if ( fSameTile )
{
@@ -221,7 +221,7 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm
return;
}
uiTempIndex = rand() % pSmoothStruct[ cnt + 1 ];
land = pSmoothStruct[ cnt + 2 + uiTempIndex ];
land = pSmoothStruct[ cnt + 2 + uiTempIndex ];
fFound = TRUE;
} while( FALSE );
break;
@@ -236,14 +236,14 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm
*piNewTile = NO_TILE;
return;
}
// this is a "full" tile, so randomize between the
// this is a "full" tile, so randomize between the
// five available tiles
land = (rand( ) % 10 ) + 1;
FullTile = TRUE;
}
GetTileIndexFromTypeSubIndex( origType, land, &usTileIndex );
*piNewTile = usTileIndex;
}
}
void SmoothExitGridRadius( INT16 sMapIndex, UINT8 ubRadius )
{
@@ -277,14 +277,14 @@ void SmoothExitGridRadius( INT16 sMapIndex, UINT8 ubRadius )
void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth )
{
int temp=0,type=0;
int temp=0;
int FullTile = FALSE;
UINT16 usOldIndex;
UINT16 usTempIndex;
UINT32 cnt;
BOOLEAN fFound;
UINT32 uiTempIndex;
UINT16 usTileIndex;
UINT16 usTileIndex;
UINT16 usExitGridIndex=0;
BOOLEAN fSameTile;
@@ -311,7 +311,7 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth )
if ( usOldIndex >= 1 && usOldIndex <= 10 )
{
*piNewTile = NO_TILE;
return;
return;
}
}
@@ -357,7 +357,7 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth )
// Now, at this point the height (of "temp") will tell us
// which texture piece to use
// Loop through smooth struct
cnt = 0;
fFound = FALSE;
@@ -377,10 +377,10 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth )
}
if ( pSmoothStruct[ cnt + 3 ] )
{
if ( pSmoothStruct[ cnt + 3 ] == usOldIndex )
{
if ( pSmoothStruct[ cnt + 3 ] == usOldIndex )
{
fSameTile = TRUE;
}
}
}
if ( fSameTile )
{
@@ -388,7 +388,7 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth )
return;
}
uiTempIndex = rand() % pSmoothStruct[ cnt + 1 ];
usExitGridIndex = pSmoothStruct[ cnt + 2 + uiTempIndex ];
usExitGridIndex = pSmoothStruct[ cnt + 2 + uiTempIndex ];
fFound = TRUE;
} while( FALSE );
break;
@@ -403,34 +403,34 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth )
*piNewTile = NO_TILE;
return;
}
// this is a "full" tile, so randomize between the
// this is a "full" tile, so randomize between the
// five available tiles
usExitGridIndex = (rand( ) % 10 ) + 1;
FullTile = TRUE;
}
GetTileIndexFromTypeSubIndex( EXITTEXTURE, usExitGridIndex, &usTileIndex );
*piNewTile = usTileIndex;
}
}
void SmoothTerrainWorld( UINT32 uiCheckType )
{
int cnt;
UINT16 usIndex;
UINT16 NewTile;
// Smooth out entire world surrounding tiles
for ( cnt = 0; cnt < WORLD_MAX; cnt++ )
{
int cnt;
UINT16 usIndex;
UINT16 NewTile;
// Smooth out entire world surrounding tiles
for ( cnt = 0; cnt < WORLD_MAX; cnt++ )
{
if ( TypeExistsInLandLayer( cnt, uiCheckType, &usIndex ) )
{
SmoothTerrain( cnt, uiCheckType, &NewTile, TRUE );
if ( NewTile != NO_TILE )
{
// Change tile
SetLandIndex( cnt, NewTile, uiCheckType, FALSE );
}
if ( NewTile != NO_TILE )
{
// Change tile
SetLandIndex( cnt, NewTile, uiCheckType, FALSE );
}
}
}
}
}
@@ -440,7 +440,7 @@ void SmoothAllTerrainWorld( void )
UINT16 usIndex;
UINT16 NewTile;
UINT32 uiCheckType;
// Smooth out entire world surrounding tiles
// Smooth out entire world surrounding tiles
for ( cnt = 0; cnt < WORLD_MAX; cnt++ )
{
for ( uiCheckType = FIRSTTEXTURE; uiCheckType <= SEVENTHTEXTURE; uiCheckType++ )
@@ -451,8 +451,8 @@ void SmoothAllTerrainWorld( void )
if ( NewTile != NO_TILE )
{
// Change tile
SetLandIndex( cnt, NewTile, uiCheckType, FALSE );
// Change tile
SetLandIndex( cnt, NewTile, uiCheckType, FALSE );
}
}
}
@@ -461,39 +461,39 @@ void SmoothAllTerrainWorld( void )
void SmoothTerrainRadius( UINT32 iMapIndex, UINT32 uiCheckType, UINT8 ubRadius, BOOLEAN fForceSmooth )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT32 iNewIndex;
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT32 iNewIndex;
UINT16 NewTile;
UINT16 usIndex;
INT32 leftmost;
// Don't bother to smooth floors, they don't need them
if ( uiCheckType >= FIRSTFLOOR && uiCheckType <= LASTFLOOR )
if ( uiCheckType >= FIRSTFLOOR && uiCheckType <= LASTFLOOR )
return;
// Determine start end end indicies and num rows
sTop = ubRadius;
sBottom = -ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ )
{
leftmost = ( ( iMapIndex + ( WORLD_COLS * cnt1 ) )/ WORLD_COLS ) * WORLD_COLS;
for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ )
{
iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2;
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
{
if ( TypeExistsInLandLayer( iNewIndex, uiCheckType, &usIndex ) )
{
SmoothTerrain( iNewIndex, uiCheckType, &NewTile, fForceSmooth );
SmoothTerrain( iNewIndex, uiCheckType, &NewTile, fForceSmooth );
if ( NewTile != NO_TILE )
{
// Change tile
AddToUndoList( iNewIndex );
SetLandIndex( iNewIndex, NewTile, uiCheckType, FALSE );
{
// Change tile
AddToUndoList( iNewIndex );
SetLandIndex( iNewIndex, NewTile, uiCheckType, FALSE );
}
}
}
@@ -503,18 +503,18 @@ void SmoothTerrainRadius( UINT32 iMapIndex, UINT32 uiCheckType, UINT8 ubRadius,
void SmoothAllTerrainTypeRadius( UINT32 iMapIndex, UINT8 ubRadius, BOOLEAN fForceSmooth )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2, cnt3;
INT32 iNewIndex;
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2, cnt3;
INT32 iNewIndex;
UINT16 NewTile;
UINT16 usIndex;
INT32 leftmost;
// Determine start end end indicies and num rows
sTop = ubRadius;
sBottom = -ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
for( cnt3 = FIRSTTEXTURE; cnt3 <= SEVENTHTEXTURE; cnt3++ )
{
for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ )
@@ -523,16 +523,16 @@ void SmoothAllTerrainTypeRadius( UINT32 iMapIndex, UINT8 ubRadius, BOOLEAN fForc
for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ )
{
iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2;
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
{
if ( TypeExistsInLandLayer( iNewIndex, cnt3, &usIndex ) )
{
SmoothTerrain( iNewIndex, cnt3, &NewTile, fForceSmooth );
SmoothTerrain( iNewIndex, cnt3, &NewTile, fForceSmooth );
if ( NewTile != NO_TILE )
{
// Change tile
SetLandIndex( iNewIndex, NewTile, cnt3, FALSE );
// Change tile
SetLandIndex( iNewIndex, NewTile, cnt3, FALSE );
}
}
}
@@ -544,18 +544,18 @@ void SmoothAllTerrainTypeRadius( UINT32 iMapIndex, UINT8 ubRadius, BOOLEAN fForc
void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth )
{
// This procedure will calculate the approriate smooth texture for a water texture
// based on the surrounding water textures. This is done via masking bits within
// based on the surrounding water textures. This is done via masking bits within
// a temp variable, then searching for the right texture and inserting it
int temp=0,type=0;
int temp=0;
int FullTile = FALSE;
UINT16 usOldIndex;
UINT16 usTempIndex;
UINT32 cnt;
BOOLEAN fFound;
UINT32 uiTempIndex;
UINT16 usTileIndex;
UINT16 usTileIndex;
UINT16 land=0;
UINT32 uiTopType;
UINT32 uiTopType;
BOOLEAN fSameTile;
INT16 *pSmoothStruct;
@@ -578,7 +578,7 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF
if ( usOldIndex >= 1 && usOldIndex <= 10 )
{
*piNewTile = NO_TILE;
return;
return;
}
}
// Mask approriate bits in temp for the lookup in the SmoothWaterStruct list
@@ -673,8 +673,8 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF
cnt = 0;
fFound = FALSE;
GetLandHeadType( gridno, &uiTopType );
// Speed up of this while loop using double/quick search will result
// in an incorrect solution due to multiple instances of bitvalues in the list of
// Speed up of this while loop using double/quick search will result
// in an incorrect solution due to multiple instances of bitvalues in the list of
// smoothed water textures
while( pSmoothStruct[ cnt ] != -1 )
{
@@ -690,10 +690,10 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF
}
if ( pSmoothStruct[ cnt + 3 ] )
{
if ( pSmoothStruct[ cnt + 3 ] == usOldIndex )
{
if ( pSmoothStruct[ cnt + 3 ] == usOldIndex )
{
fSameTile = TRUE;
}
}
}
if ( fSameTile )
{
@@ -701,7 +701,7 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF
return;
}
uiTempIndex = rand() % pSmoothStruct[ cnt + 1 ];
land = pSmoothStruct[ cnt + 2 + uiTempIndex ];
land = pSmoothStruct[ cnt + 2 + uiTempIndex ];
fFound = TRUE;
} while( FALSE );
break;
@@ -711,7 +711,7 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF
if ( !fFound )
{
// Check for existance of same tile
if ( usOldIndex >= 1 && usOldIndex <= 10 )
if ( usOldIndex >= 1 && usOldIndex <= 10 )
{
*piNewTile = NO_TILE;
return;
@@ -721,13 +721,14 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF
}
GetTileIndexFromTypeSubIndex( origType, land, &usTileIndex );
*piNewTile = usTileIndex;
}
}
#endif