New attack busy system

Added missing #includes

Added LUA scripting and console

Changed the way tracers are visualized, so they work more like real tracers instead of a light fountain

Fixed signedness of many grid variables used in GetMouseMapPos calls

Fixed enemy weapon choosing:  Sometimes a mortar is chosen but later rejected, but the grenade class was not reset.  Caused assertion failure

Added checks so enemies don't try to chuck RPG grenades with their hands

Now possible to shoot a someone in the head if he's in water

Fixed InitSightArrays to also clear soldier interrupt duel points.  This was causing an assertion failure elsewhere in the code because the interrupt list still had soldiers on it sometimes when this function was called.

Soldiers are much less willing to forfeit their turn over an attempt to use more APs than they have

Removed early setting of muzzle flash.  This would allow enemies to get an interrupt before you even fired.

Fixed item dropping by AI.  If AI tried to drop something while standing it would cause deadlock

Change to greatly speed up closing the sector inventory window in an unloaded sector

Added conditional compile flag to always give robot weapon ready advantage, even for 360 degree sighting


Check builddefines.h for the conditional flags.  Of greatest interest might be LUA_CONSOLE.  This will cause the game to bring up a command console when run.  However this console is severely lacking in many areas.  If anybody knows of an open-source terminal/console that could be used instead, it would be appreciated.  The existing console does bad things when you try to close it, and since it counts as a separate app, it pauses the game while it has focus.

LUA scripting is very limited, basically just proof of concept.  There is one global variable, the Soldiers array.  An array index gives you the soldier in that slot in the currently loaded sector.  The soldier has a few things that can be accessed:  name (short name); fullname (long name); grid (current grid #, can be changed); walkto(grid) (function to walk to another grid); runto(grid) (function to run to another grid)


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@924 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Overhaul
2007-06-09 09:01:04 +00:00
parent 8ed1ff9d6e
commit 7a27e7105d
275 changed files with 25107 additions and 20463 deletions
+5
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#else
@@ -8,6 +10,9 @@
#include "environment.h"
#include "Sound Control.h"
#include "Game Events.h"
#include "Ambient Control.h"
#include "lighting.h"
#include "Random.h"
#endif
AMBIENTDATA_STRUCT gAmbData[ MAX_AMBIENT_SOUNDS ];
+1
View File
@@ -11,6 +11,7 @@
#include "Render Fun.h"
#include "Strategicmap.h"
#include "Sys Globals.h"
#include "worldman.h"
#endif
#define ROOF_LOCATION_CHANCE 8
+1
View File
@@ -20,6 +20,7 @@
#include "Sys Globals.h"
#include "quests.h"
#include "SaveLoadMap.h"
#include "Text.h"
#endif
BOOLEAN gfLoadingExitGrids = FALSE;
File diff suppressed because it is too large Load Diff
+7
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#else
@@ -33,6 +35,11 @@
#include "handle items.h"
#include "message.h"
#include "handle ui.h"
#include "NPC.h"
#include "Explosion Control.h"
#include "Text.h"
#include "GameSettings.h"
#include "environment.h"
#endif
#define MAX_INTTILE_STACK 10
+11 -6
View File
@@ -333,13 +333,18 @@ BOOLEAN GetMouseWorldCoordsInCenter( INT16 *psMouseX, INT16 *psMouseY )
return( TRUE );
}
#if 0
// 0verhaul
// I did that (or actually uncasted a bunch of stuff and re-typed others to correct them), so
// no worries
// (jonathanl) to save me having to cast all the previous code
BOOLEAN GetMouseMapPos( UINT16 *psMapPos )
{
return GetMouseMapPos( (INT16 *)psMapPos );
}
#endif
BOOLEAN GetMouseMapPos( INT16 *psMapPos )
BOOLEAN GetMouseMapPos( UINT16 *pusMapPos )
{
INT16 sWorldX, sWorldY;
static INT16 sSameCursorPos;
@@ -348,7 +353,7 @@ BOOLEAN GetMouseMapPos( INT16 *psMapPos )
// Check if this is the same frame as before, return already calculated value if so!
if ( uiOldFrameNumber == guiGameCycleCounter && !guiForceRefreshMousePositionCalculation )
{
( *psMapPos ) = sSameCursorPos;
( *pusMapPos ) = sSameCursorPos;
if ( sSameCursorPos == 0 )
{
@@ -363,14 +368,14 @@ BOOLEAN GetMouseMapPos( INT16 *psMapPos )
if ( GetMouseXY( &sWorldX, &sWorldY ) )
{
*psMapPos = MAPROWCOLTOPOS( sWorldY, sWorldX );
sSameCursorPos = (*psMapPos);
*pusMapPos = MAPROWCOLTOPOS( sWorldY, sWorldX );
sSameCursorPos = (*pusMapPos);
return( TRUE );
}
else
{
*psMapPos = 0;
sSameCursorPos = (*psMapPos);
*pusMapPos = 0;
sSameCursorPos = (*pusMapPos);
return( FALSE );
}
+1 -2
View File
@@ -50,8 +50,7 @@ INT32 OutOfBounds(INT16 sGridno, INT16 sProposedGridno);
BOOLEAN GetMouseCell( INT32 *piMouseMapPos );
BOOLEAN GetMouseXY( INT16 *psMouseX, INT16 *psMouseY );
BOOLEAN GetMouseWorldCoords( INT16 *psMouseX, INT16 *psMouseY );
BOOLEAN GetMouseMapPos( UINT16 *psMapPos ); // (jonathanl) to save me having to cast all the previous code
BOOLEAN GetMouseMapPos( INT16 *psMapPos );
BOOLEAN GetMouseMapPos( UINT16 *psMapPos );
BOOLEAN GetMouseWorldCoordsInCenter( INT16 *psMouseX, INT16 *psMouseY );
BOOLEAN GetMouseXYWithRemainder( INT16 *psMouseX, INT16 *psMouseY, INT16 *psCellX, INT16 *psCellY );
+6
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#else
@@ -21,6 +23,10 @@
#include "explosion control.h"
#include "Random.h"
#include "lighting.h"
#include "Game Clock.h"
#include "opplist.h"
#include "Campaign Types.h"
#include "Tactical Save.h"
#endif
#include "SaveLoadGame.h"
+2
View File
@@ -15,6 +15,8 @@
#include "Animation Control.h"
#include "Render Fun.h"
#include "strategicmap.h"
#include "environment.h"
#include "worldman.h"
#endif
//dynamic arrays that contain the valid gridno's for each edge
+5
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#else
@@ -27,6 +29,9 @@
#include "Game Clock.h"
#include "Map Screen Interface Map Inventory.h"
#include "environment.h"
#include "meanwhile.h"
#include "strategicmap.h"
#include "Animation Data.h"
#endif
extern INT32 iCurrentMapSectorZ;
+4
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#include "winfont.h"
@@ -16,6 +18,8 @@
#include "wcheck.h"
#include "video.h"
#include "vobject_blitters.h"
#include "WinFont.h"
#include "Font Control.h"
#endif
#ifdef JA2BETAVERSION
+1
View File
@@ -17,6 +17,7 @@
#include "Exit Grids.h"
#include "Message.h"
#include "GameSettings.h"
#include "Smell.h"
#endif
#define NUM_REVEALED_BYTES 3200
+2
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#else
+3
View File
@@ -10,6 +10,9 @@
#include "gamesettings.h"
#include "message.h"
#include "Isometric utils.h"
#include "Map Information.h"
#include "Game Clock.h"
#include "Overhead.h"
#endif
/*
+5
View File
@@ -1,3 +1,4 @@
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
@@ -21,6 +22,10 @@
#include "renderworld.h"
#include "explosion control.h"
#include "Random.h"
#include "Game Clock.h"
#include "opplist.h"
#include "Campaign Types.h"
#include "Tactical Save.h"
#endif
#include "SaveLoadGame.h"
+3
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
// WANNE 2 <changed some lines>
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
@@ -40,6 +42,7 @@
#include "assignments.h"
#include "text.h"
#include "WordWrap.h"
#include "Game Clock.h"
#endif
typedef struct MERCPLACEMENT
+144 -138
View File
@@ -1,31 +1,34 @@
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#include "TileEngine All.h"
#else
#include "worlddef.h"
#include <stdio.h>
#include <string.h>
#include "wcheck.h"
#include "stdlib.h"
#include "time.h"
#include "video.h"
#include "debug.h"
#include "smooth.h"
#include "worldman.h"
#include "lighting.h"
#include "renderworld.h"
#include "overhead.h"
#include "ai.h"
#include "Sound Control.h"
#include "animation control.h"
#include "isometric utils.h"
#include "Font Control.h"
#include "message.h"
#include "tile animation.h"
#include "tile cache.h"
#include "explosion control.h"
#include "weapons.h"
#include "Keys.h"
#include "bullets.h"
#include "worlddef.h"
#include <stdio.h>
#include <string.h>
#include "wcheck.h"
#include "stdlib.h"
#include "time.h"
#include "video.h"
#include "debug.h"
#include "smooth.h"
#include "worldman.h"
#include "lighting.h"
#include "renderworld.h"
#include "overhead.h"
#include "ai.h"
#include "Sound Control.h"
#include "animation control.h"
#include "isometric utils.h"
#include "Font Control.h"
#include "message.h"
#include "tile animation.h"
#include "tile cache.h"
#include "explosion control.h"
#include "weapons.h"
#include "Keys.h"
#include "bullets.h"
#include "LightEffects.h"
#include "rotting corpses.h"
#include "SmokeEffects.h"
#endif
@@ -61,7 +64,7 @@ ANITILE *CreateAnimationTile( ANITILE_PARAMS *pAniParams )
sX = pAniParams->sX;
sY = pAniParams->sY;
sZ = pAniParams->sZ;
pAniNode = pAniTileHead;
@@ -90,44 +93,44 @@ ANITILE *CreateAnimationTile( ANITILE_PARAMS *pAniParams )
// ALLOCATE NEW TILE
switch( ubLevel )
{
case ANI_STRUCT_LEVEL:
pNode = ForceStructToTail( sGridNo, usTileIndex );
break;
case ANI_STRUCT_LEVEL:
case ANI_SHADOW_LEVEL:
AddShadowToHead( sGridNo, usTileIndex );
pNode = gpWorldLevelData[ sGridNo ].pShadowHead;
break;
pNode = ForceStructToTail( sGridNo, usTileIndex );
break;
case ANI_OBJECT_LEVEL:
AddObjectToHead( sGridNo, usTileIndex );
pNode = gpWorldLevelData[ sGridNo ].pObjectHead;
break;
case ANI_SHADOW_LEVEL:
case ANI_ROOF_LEVEL:
AddRoofToHead( sGridNo, usTileIndex );
pNode = gpWorldLevelData[ sGridNo ].pRoofHead;
break;
AddShadowToHead( sGridNo, usTileIndex );
pNode = gpWorldLevelData[ sGridNo ].pShadowHead;
break;
case ANI_ONROOF_LEVEL:
AddOnRoofToHead( sGridNo, usTileIndex );
pNode = gpWorldLevelData[ sGridNo ].pOnRoofHead;
break;
case ANI_OBJECT_LEVEL:
case ANI_TOPMOST_LEVEL:
AddTopmostToHead( sGridNo, usTileIndex );
pNode = gpWorldLevelData[ sGridNo ].pTopmostHead;
break;
AddObjectToHead( sGridNo, usTileIndex );
pNode = gpWorldLevelData[ sGridNo ].pObjectHead;
break;
default:
case ANI_ROOF_LEVEL:
return( NULL );
AddRoofToHead( sGridNo, usTileIndex );
pNode = gpWorldLevelData[ sGridNo ].pRoofHead;
break;
case ANI_ONROOF_LEVEL:
AddOnRoofToHead( sGridNo, usTileIndex );
pNode = gpWorldLevelData[ sGridNo ].pOnRoofHead;
break;
case ANI_TOPMOST_LEVEL:
AddTopmostToHead( sGridNo, usTileIndex );
pNode = gpWorldLevelData[ sGridNo ].pTopmostHead;
break;
default:
return( NULL );
}
// SET NEW TILE VALUES
@@ -174,38 +177,38 @@ ANITILE *CreateAnimationTile( ANITILE_PARAMS *pAniParams )
}
switch( ubLevel )
{
case ANI_STRUCT_LEVEL:
ResetSpecificLayerOptimizing( TILES_DYNAMIC_STRUCTURES );
break;
case ANI_STRUCT_LEVEL:
case ANI_SHADOW_LEVEL:
ResetSpecificLayerOptimizing( TILES_DYNAMIC_SHADOWS );
break;
ResetSpecificLayerOptimizing( TILES_DYNAMIC_STRUCTURES );
break;
case ANI_OBJECT_LEVEL:
case ANI_SHADOW_LEVEL:
ResetSpecificLayerOptimizing( TILES_DYNAMIC_OBJECTS );
break;
ResetSpecificLayerOptimizing( TILES_DYNAMIC_SHADOWS );
break;
case ANI_ROOF_LEVEL:
case ANI_OBJECT_LEVEL:
ResetSpecificLayerOptimizing( TILES_DYNAMIC_ROOF );
break;
ResetSpecificLayerOptimizing( TILES_DYNAMIC_OBJECTS );
break;
case ANI_ONROOF_LEVEL:
case ANI_ROOF_LEVEL:
ResetSpecificLayerOptimizing( TILES_DYNAMIC_ONROOF );
break;
ResetSpecificLayerOptimizing( TILES_DYNAMIC_ROOF );
break;
case ANI_TOPMOST_LEVEL:
case ANI_ONROOF_LEVEL:
ResetSpecificLayerOptimizing( TILES_DYNAMIC_TOPMOST );
break;
ResetSpecificLayerOptimizing( TILES_DYNAMIC_ONROOF );
break;
case ANI_TOPMOST_LEVEL:
ResetSpecificLayerOptimizing( TILES_DYNAMIC_TOPMOST );
break;
}
@@ -237,7 +240,7 @@ ANITILE *CreateAnimationTile( ANITILE_PARAMS *pAniParams )
pNewAniNode->pLevelNode->uiFlags |= ( LEVELNODE_LASTDYNAMIC | LEVELNODE_UPDATESAVEBUFFERONCE );
pNewAniNode->pLevelNode->uiFlags &= (~LEVELNODE_DYNAMIC );
}
if ( ( uiFlags & ANITILE_OPTIMIZEFORSMOKEEFFECT ) )
{
pNewAniNode->pLevelNode->uiFlags |= LEVELNODE_NOWRITEZ;
@@ -349,35 +352,35 @@ void DeleteAniTile( ANITILE *pAniTile )
// Delete memory assosiated with item
switch( pAniNode->ubLevelID )
{
case ANI_STRUCT_LEVEL:
RemoveStructFromLevelNode( pAniNode->sGridNo, pAniNode->pLevelNode );
break;
case ANI_STRUCT_LEVEL:
case ANI_SHADOW_LEVEL:
RemoveShadowFromLevelNode( pAniNode->sGridNo, pAniNode->pLevelNode );
break;
RemoveStructFromLevelNode( pAniNode->sGridNo, pAniNode->pLevelNode );
break;
case ANI_OBJECT_LEVEL:
RemoveObject( pAniNode->sGridNo, pAniNode->usTileIndex );
break;
case ANI_SHADOW_LEVEL:
case ANI_ROOF_LEVEL:
RemoveRoof( pAniNode->sGridNo, pAniNode->usTileIndex );
break;
RemoveShadowFromLevelNode( pAniNode->sGridNo, pAniNode->pLevelNode );
break;
case ANI_ONROOF_LEVEL:
RemoveOnRoof( pAniNode->sGridNo, pAniNode->usTileIndex );
break;
case ANI_OBJECT_LEVEL:
case ANI_TOPMOST_LEVEL:
RemoveTopmostFromLevelNode( pAniNode->sGridNo, pAniNode->pLevelNode );
break;
RemoveObject( pAniNode->sGridNo, pAniNode->usTileIndex );
break;
case ANI_ROOF_LEVEL:
RemoveRoof( pAniNode->sGridNo, pAniNode->usTileIndex );
break;
case ANI_ONROOF_LEVEL:
RemoveOnRoof( pAniNode->sGridNo, pAniNode->usTileIndex );
break;
case ANI_TOPMOST_LEVEL:
RemoveTopmostFromLevelNode( pAniNode->sGridNo, pAniNode->pLevelNode );
break;
}
if ( pAniNode->uiFlags & ANITILE_LIGHT && pAniNode->lightSprite >= 0 )
@@ -404,9 +407,10 @@ void DeleteAniTile( ANITILE *pAniTile )
gTacticalStatus.uiFlags &= (~DISALLOW_SIGHT);
}
// Freeup attacker from explosion
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Reducing attacker busy count..., EXPLOSION effect gone off") );
ReduceAttackBusyCount( (UINT8)pAniNode->ubUserData2, FALSE );
// Freeup attacker from explosion
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Reducing attacker busy count..., EXPLOSION effect gone off") );
DebugAttackBusy( "@@@@@@@ EXPLOSION effect finished.\n");
ReduceAttackBusyCount( );
}
@@ -416,10 +420,10 @@ void DeleteAniTile( ANITILE *pAniTile )
// First delete the bullet!
RemoveBullet( pAniNode->uiUserData3 );
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - miss finished animation") );
FreeUpAttacker( (UINT8) pAniNode->ubAttackerMissed );
// 0verhaul: Removed because it's handled by RemoveBullet.
// DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - miss finished animation") );
// FreeUpAttacker( (UINT8) pAniNode->ubAttackerMissed );
}
}
else
{
@@ -431,7 +435,7 @@ void DeleteAniTile( ANITILE *pAniTile )
// OK, set our frame data back to zero....
pAniNode->pLevelNode->sCurrentFrame = 0;
// Set some flags to write to Z / update save buffer
// pAniNode->pLevelNode->uiFlags |=( LEVELNODE_LASTDYNAMIC | LEVELNODE_UPDATESAVEBUFFERONCE );
pAniNode->pLevelNode->uiFlags &= ~( LEVELNODE_DYNAMIC | LEVELNODE_USEZ | LEVELNODE_ANIMATION );
@@ -544,6 +548,8 @@ void UpdateAniTiles( )
case ANI_KEYFRAME_CHAIN_WATER_EXPLOSION:
IgniteExplosion( pNode->ubUserData2, pNode->pLevelNode->sRelativeX, pNode->pLevelNode->sRelativeY, 0, pNode->sGridNo, (UINT16)( pNode->uiUserData ), 0 );
DebugAttackBusy( "Reducing attack busy from water explosion delay.\n");
ReduceAttackBusyCount( );
break;
case ANI_KEYFRAME_DO_SOUND:
@@ -801,39 +807,39 @@ ANITILE *GetCachedAniTileOfType( INT16 sGridNo, UINT8 ubLevelID, UINT32 uiFlags
switch( ubLevelID )
{
case ANI_STRUCT_LEVEL:
pNode = gpWorldLevelData[ sGridNo ].pStructHead;
break;
case ANI_STRUCT_LEVEL:
case ANI_SHADOW_LEVEL:
pNode = gpWorldLevelData[ sGridNo ].pShadowHead;
break;
pNode = gpWorldLevelData[ sGridNo ].pStructHead;
break;
case ANI_OBJECT_LEVEL:
pNode = gpWorldLevelData[ sGridNo ].pObjectHead;
break;
case ANI_SHADOW_LEVEL:
case ANI_ROOF_LEVEL:
pNode = gpWorldLevelData[ sGridNo ].pRoofHead;
break;
pNode = gpWorldLevelData[ sGridNo ].pShadowHead;
break;
case ANI_ONROOF_LEVEL:
pNode = gpWorldLevelData[ sGridNo ].pOnRoofHead;
break;
case ANI_OBJECT_LEVEL:
case ANI_TOPMOST_LEVEL:
pNode = gpWorldLevelData[ sGridNo ].pTopmostHead;
break;
pNode = gpWorldLevelData[ sGridNo ].pObjectHead;
break;
default:
case ANI_ROOF_LEVEL:
return( NULL );
pNode = gpWorldLevelData[ sGridNo ].pRoofHead;
break;
case ANI_ONROOF_LEVEL:
pNode = gpWorldLevelData[ sGridNo ].pOnRoofHead;
break;
case ANI_TOPMOST_LEVEL:
pNode = gpWorldLevelData[ sGridNo ].pTopmostHead;
break;
default:
return( NULL );
}
while( pNode != NULL )
@@ -894,7 +900,7 @@ void PauseAllAniTilesOfType( UINT32 uiType, BOOLEAN fPause )
if ( pNode->uiFlags & uiType )
{
PauseAniTile( pNode, fPause );
PauseAniTile( pNode, fPause );
}
}
+2
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#else
+2
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#else
+2
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#else
+7
View File
@@ -1,10 +1,17 @@
// Lesh:
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#else
#include <stdio.h>
#include <string.h>
#include "explosion control.h"
#include "TopicIDs.h"
#include "TopicOps.h"
#include "Debug.h"
#include "FileMan.h"
#include "Debug Control.h"
#endif
#include "expat.h"
+1
View File
@@ -23,6 +23,7 @@
#include "opplist.h"
#include "Random.h"
#include "strategicmap.h"
#include "GameSettings.h"
#endif
//effects whether or not time of day effects the lighting. Underground
+3
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
/****************************************************************************************
* JA2 Lighting Module
*
@@ -52,6 +54,7 @@
#include "rotting corpses.h"
#include "Fileman.h"
#include "environment.h"
#include "PATHAI.H"
#endif
#define LVL1_L1_PER (50)
+8
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#else
@@ -31,6 +33,12 @@
#include "world items.h"
#include "environment.h"
#include "message.h"
#include "faces.h"
#include "Squads.h"
#include "Interactive Tiles.h"
#include "gameloop.h"
#include "sysutil.h"
#include "tile surface.h"
#endif
+400 -380
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -79,7 +79,7 @@ extern REAL_OBJECT ObjectSlots[ NUM_OBJECT_SLOTS ];
// OBJECT LIST STUFF
INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, real yPos, real zPos, real xForce, real yForce, real zForce, UINT8 ubOwner, UINT8 ubActionCode, UINT32 uiActionData );
INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, real yPos, real zPos, real xForce, real yForce, real zForce, UINT8 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, BOOLEAN fTestObject );
BOOLEAN RemoveObjectSlot( INT32 iObject );
void RemoveAllPhysicsObjects( );
+193 -190
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#else
@@ -45,6 +47,7 @@
#include "world items.h"
#include "GameSettings.h"
#include "interface control.h"
#include "Sound Control.h"
#endif
///////////////////////////
@@ -494,7 +497,7 @@ UINT32 gRenderFlags=0;
* any questions? joker
*/
SGPRect gClippingRect;// = { 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - INTERFACE_HEIGHT};
SGPRect gOldClipRect;
SGPRect gOldClipRect = { 0, 0, 1024, 768 }; // 0verhaul: This MUST mirror the gDirtyClipRect init, otherwise funkiness with video overlays will happen
INT16 gsRenderCenterX;
INT16 gsRenderCenterY;
INT16 gsRenderWorldOffsetX = 0; //lal was -1 : bugfix for merc screen position in tactical on high resolution
@@ -762,7 +765,7 @@ void RenderSetShadows(BOOLEAN fShadows)
else
{
gRenderFlags&=(~RENDER_FLAG_SHADOWS);
}
}
}
@@ -4056,222 +4059,222 @@ BOOLEAN ApplyScrolling( INT16 sTempRenderCenterX, INT16 sTempRenderCenterY, BOOL
//if ((fAllowScrollingHorizontal || fAllowScrollingVertical) && gfDialogControl)
//{
// Get angles
// TOP LEFT CORNER FIRST
dOpp = sTopLeftWorldY - gsTLY;
dAdj = sTopLeftWorldX - gsTLX;
// Get angles
// TOP LEFT CORNER FIRST
dOpp = sTopLeftWorldY - gsTLY;
dAdj = sTopLeftWorldX - gsTLX;
dAngle = (double)atan2( dAdj, dOpp );
at1 = dAngle * 180 / PI;
dAngle = (double)atan2( dAdj, dOpp );
at1 = dAngle * 180 / PI;
if ( dAngle < 0 )
if ( dAngle < 0 )
{
fOutLeft = TRUE;
}
else if ( dAngle > PI/2 )
{
fOutTop = TRUE;
}
// TOP RIGHT CORNER
dOpp = sTopRightWorldY - gsTRY;
dAdj = gsTRX - sTopRightWorldX;
dAngle = (double)atan2( dAdj, dOpp );
at2 = dAngle * 180 / PI;
if ( dAngle < 0 )
{
fOutRight = TRUE;
}
else if ( dAngle > PI/2 )
{
fOutTop = TRUE;
}
// BOTTOM LEFT CORNER
dOpp = gsBLY - sBottomLeftWorldY;
dAdj = sBottomLeftWorldX - gsBLX;
dAngle = (double)atan2( dAdj, dOpp );
at3 = dAngle * 180 / PI;
if ( dAngle < 0 )
{
fOutLeft = TRUE;
}
else if ( dAngle > PI/2 )
{
fOutBottom = TRUE;
}
// BOTTOM RIGHT CORNER
dOpp = gsBRY - sBottomRightWorldY;
dAdj = gsBRX - sBottomRightWorldX;
dAngle = (double)atan2( dAdj, dOpp );
at4 = dAngle * 180 / PI;
if ( dAngle < 0 )
{
fOutRight = TRUE;
}
else if ( dAngle > PI/2 )
{
fOutBottom = TRUE;
}
sprintf( gDebugStr, "Angles: %d %d %d %d", (int)at1, (int)at2, (int)at3, (int)at4 );
if ( !fOutRight && !fOutLeft && !fOutTop && !fOutBottom )
{
fScrollGood = TRUE;
}
// If in editor, anything goes
if ( gfEditMode && _KeyDown( SHIFT ) )
{
fScrollGood = TRUE;
}
// Reset some UI flags
gfUIShowExitEast = FALSE;
gfUIShowExitWest = FALSE;
gfUIShowExitNorth = FALSE;
gfUIShowExitSouth = FALSE;
if ( !fScrollGood )
{
// Force adjustment, if true
if ( fForceAdjust )
{
fOutLeft = TRUE;
}
else if ( dAngle > PI/2 )
{
fOutTop = TRUE;
}
// TOP RIGHT CORNER
dOpp = sTopRightWorldY - gsTRY;
dAdj = gsTRX - sTopRightWorldX;
dAngle = (double)atan2( dAdj, dOpp );
at2 = dAngle * 180 / PI;
if ( dAngle < 0 )
{
fOutRight = TRUE;
}
else if ( dAngle > PI/2 )
{
fOutTop = TRUE;
}
// BOTTOM LEFT CORNER
dOpp = gsBLY - sBottomLeftWorldY;
dAdj = sBottomLeftWorldX - gsBLX;
dAngle = (double)atan2( dAdj, dOpp );
at3 = dAngle * 180 / PI;
if ( dAngle < 0 )
{
fOutLeft = TRUE;
}
else if ( dAngle > PI/2 )
{
fOutBottom = TRUE;
}
// BOTTOM RIGHT CORNER
dOpp = gsBRY - sBottomRightWorldY;
dAdj = gsBRX - sBottomRightWorldX;
dAngle = (double)atan2( dAdj, dOpp );
at4 = dAngle * 180 / PI;
if ( dAngle < 0 )
{
fOutRight = TRUE;
}
else if ( dAngle > PI/2 )
{
fOutBottom = TRUE;
}
sprintf( gDebugStr, "Angles: %d %d %d %d", (int)at1, (int)at2, (int)at3, (int)at4 );
if ( !fOutRight && !fOutLeft && !fOutTop && !fOutBottom )
{
fScrollGood = TRUE;
}
// If in editor, anything goes
if ( gfEditMode && _KeyDown( SHIFT ) )
{
fScrollGood = TRUE;
}
// Reset some UI flags
gfUIShowExitEast = FALSE;
gfUIShowExitWest = FALSE;
gfUIShowExitNorth = FALSE;
gfUIShowExitSouth = FALSE;
if ( !fScrollGood )
{
// Force adjustment, if true
if ( fForceAdjust )
if ( fOutTop )
{
if ( fOutTop )
{
// WANNE: Test
// Adjust screen coordinates on the Y!
CorrectRenderCenter( sScreenCenterX, (INT16)(gsTLY + sY_S ), &sNewScreenX, &sNewScreenY );
FromScreenToCellCoordinates( sNewScreenX, sNewScreenY , &sTempPosX_W, &sTempPosY_W );
// Adjust screen coordinates on the Y!
CorrectRenderCenter( sScreenCenterX, (INT16)(gsTLY + sY_S ), &sNewScreenX, &sNewScreenY );
FromScreenToCellCoordinates( sNewScreenX, sNewScreenY , &sTempPosX_W, &sTempPosY_W );
sTempRenderCenterX = sTempPosX_W;
sTempRenderCenterY = sTempPosY_W;
fScrollGood = TRUE;
}
if ( fOutBottom )
{
// OK, Ajust this since we get rounding errors in our two different calculations.
CorrectRenderCenter( sScreenCenterX, (INT16)(gsBLY - sY_S - 50 ), &sNewScreenX, &sNewScreenY );
FromScreenToCellCoordinates( sNewScreenX, sNewScreenY , &sTempPosX_W, &sTempPosY_W );
sTempRenderCenterX = sTempPosX_W;
sTempRenderCenterY = sTempPosY_W;
fScrollGood = TRUE;
}
if ( fOutLeft )
{
CorrectRenderCenter( (INT16)( gsTLX + sX_S ) , sScreenCenterY , &sNewScreenX, &sNewScreenY );
FromScreenToCellCoordinates( sNewScreenX, sNewScreenY , &sTempPosX_W, &sTempPosY_W );
sTempRenderCenterX = sTempPosX_W;
sTempRenderCenterY = sTempPosY_W;
fScrollGood = TRUE;
}
if ( fOutRight )
{
CorrectRenderCenter( (INT16)( gsTRX - sX_S ) , sScreenCenterY , &sNewScreenX, &sNewScreenY );
FromScreenToCellCoordinates( sNewScreenX, sNewScreenY , &sTempPosX_W, &sTempPosY_W );
sTempRenderCenterX = sTempPosX_W;
sTempRenderCenterY = sTempPosY_W;
fScrollGood = TRUE;
}
sTempRenderCenterX = sTempPosX_W;
sTempRenderCenterY = sTempPosY_W;
fScrollGood = TRUE;
}
else
if ( fOutBottom )
{
if ( fOutRight )
{
// Check where our cursor is!
if ( gusMouseXPos >= SCREEN_WIDTH - 1 )
{
gfUIShowExitEast = TRUE;
}
}
if ( fOutLeft )
{
// Check where our cursor is!
if ( gusMouseXPos == 0 )
{
gfUIShowExitWest = TRUE;
}
}
if ( fOutTop )
{
// Check where our cursor is!
if ( gusMouseYPos == 0 )
{
gfUIShowExitNorth = TRUE;
}
}
if ( fOutBottom )
{
// Check where our cursor is!
if ( gusMouseYPos >= SCREEN_HEIGHT - 1 )
{
gfUIShowExitSouth = TRUE;
}
}
// OK, Ajust this since we get rounding errors in our two different calculations.
CorrectRenderCenter( sScreenCenterX, (INT16)(gsBLY - sY_S - 50 ), &sNewScreenX, &sNewScreenY );
FromScreenToCellCoordinates( sNewScreenX, sNewScreenY , &sTempPosX_W, &sTempPosY_W );
sTempRenderCenterX = sTempPosX_W;
sTempRenderCenterY = sTempPosY_W;
fScrollGood = TRUE;
}
if ( fOutLeft )
{
CorrectRenderCenter( (INT16)( gsTLX + sX_S ) , sScreenCenterY , &sNewScreenX, &sNewScreenY );
FromScreenToCellCoordinates( sNewScreenX, sNewScreenY , &sTempPosX_W, &sTempPosY_W );
sTempRenderCenterX = sTempPosX_W;
sTempRenderCenterY = sTempPosY_W;
fScrollGood = TRUE;
}
if ( fOutRight )
{
CorrectRenderCenter( (INT16)( gsTRX - sX_S ) , sScreenCenterY , &sNewScreenX, &sNewScreenY );
FromScreenToCellCoordinates( sNewScreenX, sNewScreenY , &sTempPosX_W, &sTempPosY_W );
sTempRenderCenterX = sTempPosX_W;
sTempRenderCenterY = sTempPosY_W;
fScrollGood = TRUE;
}
}
if ( fScrollGood )
else
{
if ( !fCheckOnly )
if ( fOutRight )
{
sprintf( gDebugStr, "Center: %d %d ", (int)gsRenderCenterX, (int)gsRenderCenterY );
// Check where our cursor is!
if ( gusMouseXPos >= SCREEN_WIDTH - 1 )
{
gfUIShowExitEast = TRUE;
}
}
//Makesure it's a multiple of 5
sMult = sTempRenderCenterX / CELL_X_SIZE;
if ( fOutLeft )
{
// Check where our cursor is!
if ( gusMouseXPos == 0 )
{
gfUIShowExitWest = TRUE;
}
}
gsRenderCenterX = ( sMult * CELL_X_SIZE ) + ( CELL_X_SIZE / 2 );
if ( fOutTop )
{
// Check where our cursor is!
if ( gusMouseYPos == 0 )
{
gfUIShowExitNorth = TRUE;
}
}
//Makesure it's a multiple of 5
if ( fOutBottom )
{
// Check where our cursor is!
if ( gusMouseYPos >= SCREEN_HEIGHT - 1 )
{
gfUIShowExitSouth = TRUE;
}
}
}
}
if ( fScrollGood )
{
if ( !fCheckOnly )
{
sprintf( gDebugStr, "Center: %d %d ", (int)gsRenderCenterX, (int)gsRenderCenterY );
//Makesure it's a multiple of 5
sMult = sTempRenderCenterX / CELL_X_SIZE;
gsRenderCenterX = ( sMult * CELL_X_SIZE ) + ( CELL_X_SIZE / 2 );
//Makesure it's a multiple of 5
sMult = sTempRenderCenterY / CELL_Y_SIZE;
gsRenderCenterY = ( sMult * CELL_Y_SIZE ) + ( CELL_Y_SIZE / 2 );
gsRenderCenterY = ( sMult * CELL_Y_SIZE ) + ( CELL_Y_SIZE / 2 );
//gsRenderCenterX = sTempRenderCenterX;
//gsRenderCenterY = sTempRenderCenterY;
//gsRenderCenterX = sTempRenderCenterX;
//gsRenderCenterY = sTempRenderCenterY;
gsTopLeftWorldX = sTopLeftWorldX - gsTLX;
gsTopLeftWorldX = sTopLeftWorldX - gsTLX;
gsTopRightWorldX = sTopRightWorldX - gsTLX;
gsBottomLeftWorldX = sBottomLeftWorldX - gsTLX;
gsBottomRightWorldX = sBottomRightWorldX - gsTLX;
gsTopLeftWorldY = sTopLeftWorldY - gsTLY;
gsTopRightWorldY = sTopRightWorldY - gsTLY;
gsBottomLeftWorldY = sBottomLeftWorldY - gsTLY;
gsBottomRightWorldY = sBottomRightWorldY - gsTLY;
gsTopLeftWorldY = sTopLeftWorldY - gsTLY;
gsTopRightWorldY = sTopRightWorldY - gsTLY;
gsBottomLeftWorldY = sBottomLeftWorldY - gsTLY;
gsBottomRightWorldY = sBottomRightWorldY - gsTLY;
SetPositionSndsVolumeAndPanning( );
}
return( TRUE );
SetPositionSndsVolumeAndPanning( );
}
return( FALSE );
return( TRUE );
}
return( FALSE );
//}
//return ( FALSE );
@@ -7543,4 +7546,4 @@ void RenderGridNoVisibleDebug( )
RenderGridNoVisibleDebugInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS );
}
#endif
#endif
+24 -19
View File
@@ -36,6 +36,10 @@
#include "sound control.h"
#include "Buildings.h"
#include "Random.h"
#include "Tile Animation.h"
#endif
#ifdef COUNT_PATHS
@@ -1650,7 +1654,8 @@ void DebugStructurePage1( void )
STRUCTURE * pStructure;
STRUCTURE * pBase;
//LEVELNODE * pLand;
INT16 sGridNo, sDesiredLevel;
UINT16 usGridNo;
INT16 sDesiredLevel;
INT8 bHeight, bDens0, bDens1, bDens2, bDens3;
INT8 bStructures;
@@ -1665,7 +1670,7 @@ void DebugStructurePage1( void )
SetFont( LARGEFONT1 );
gprintf( 0, 0, L"DEBUG STRUCTURES PAGE 1 OF 1" );
if (GetMouseMapPos( &sGridNo ) == FALSE)
if (GetMouseMapPos( &usGridNo ) == FALSE)
{
return;
//gprintf( 0, LINE_HEIGHT * 1, L"No structure selected" );
@@ -1680,14 +1685,14 @@ void DebugStructurePage1( void )
sDesiredLevel = STRUCTURE_ON_ROOF;
}
gprintf( 320, 0, L"Building %d", gubBuildingInfo[ sGridNo ] );
gprintf( 320, 0, L"Building %d", gubBuildingInfo[ usGridNo ] );
/*
pLand = gpWorldLevelData[sGridNo].pLandHead;
pLand = gpWorldLevelData[usGridNo].pLandHead;
gprintf( 320, 0, L"Fake light %d", pLand->ubFakeShadeLevel );
gprintf( 320, LINE_HEIGHT, L"Real light: ground %d roof %d", LightTrueLevel( sGridNo, 0 ), LightTrueLevel( sGridNo, 1 ) );
gprintf( 320, LINE_HEIGHT, L"Real light: ground %d roof %d", LightTrueLevel( usGridNo, 0 ), LightTrueLevel( usGridNo, 1 ) );
*/
pStructure = gpWorldLevelData[sGridNo].pStructureHead;
pStructure = gpWorldLevelData[usGridNo].pStructureHead;
while (pStructure != NULL)
{
if (pStructure->sCubeOffset == sDesiredLevel)
@@ -1762,7 +1767,7 @@ void DebugStructurePage1( void )
gprintf( 0, LINE_HEIGHT * 4, L"Structure ID %d", pStructure->usStructureID );
#endif
pStructure = gpWorldLevelData[sGridNo].pStructureHead;
pStructure = gpWorldLevelData[usGridNo].pStructureHead;
for ( bStructures = 0; pStructure != NULL; pStructure = pStructure->pNext)
{
bStructures++;
@@ -1797,18 +1802,18 @@ void DebugStructurePage1( void )
}
#endif
gprintf( 0, LINE_HEIGHT * 13, L"N %d NE %d E %d SE %d",
gubWorldMovementCosts[ sGridNo ][ NORTH ][ gsInterfaceLevel ],
gubWorldMovementCosts[ sGridNo ][ NORTHEAST ][ gsInterfaceLevel ],
gubWorldMovementCosts[ sGridNo ][ EAST ][ gsInterfaceLevel ],
gubWorldMovementCosts[ sGridNo ][ SOUTHEAST ][ gsInterfaceLevel ] );
gubWorldMovementCosts[ usGridNo ][ NORTH ][ gsInterfaceLevel ],
gubWorldMovementCosts[ usGridNo ][ NORTHEAST ][ gsInterfaceLevel ],
gubWorldMovementCosts[ usGridNo ][ EAST ][ gsInterfaceLevel ],
gubWorldMovementCosts[ usGridNo ][ SOUTHEAST ][ gsInterfaceLevel ] );
gprintf( 0, LINE_HEIGHT * 14, L"S %d SW %d W %d NW %d",
gubWorldMovementCosts[ sGridNo ][ SOUTH ][ gsInterfaceLevel ],
gubWorldMovementCosts[ sGridNo ][ SOUTHWEST ][ gsInterfaceLevel ],
gubWorldMovementCosts[ sGridNo ][ WEST ][ gsInterfaceLevel ],
gubWorldMovementCosts[ sGridNo ][ NORTHWEST ][ gsInterfaceLevel ] );
gubWorldMovementCosts[ usGridNo ][ SOUTH ][ gsInterfaceLevel ],
gubWorldMovementCosts[ usGridNo ][ SOUTHWEST ][ gsInterfaceLevel ],
gubWorldMovementCosts[ usGridNo ][ WEST ][ gsInterfaceLevel ],
gubWorldMovementCosts[ usGridNo ][ NORTHWEST ][ gsInterfaceLevel ] );
gprintf( 0, LINE_HEIGHT * 15, L"Ground smell %d strength %d",
SMELL_TYPE( gpWorldLevelData[ sGridNo ].ubSmellInfo ),
SMELL_STRENGTH( gpWorldLevelData[ sGridNo ].ubSmellInfo ) );
SMELL_TYPE( gpWorldLevelData[ usGridNo ].ubSmellInfo ),
SMELL_STRENGTH( gpWorldLevelData[ usGridNo ].ubSmellInfo ) );
#ifdef COUNT_PATHS
if (guiTotalPathChecks > 0)
@@ -1823,7 +1828,7 @@ void DebugStructurePage1( void )
}
#else
gprintf( 0, LINE_HEIGHT * 16,
L"Adj soldiers %d", gpWorldLevelData[sGridNo].ubAdjacentSoldierCnt );
L"Adj soldiers %d", gpWorldLevelData[usGridNo].ubAdjacentSoldierCnt );
#endif
}
@@ -2393,4 +2398,4 @@ UINT32 GetStructureOpenSound( STRUCTURE * pStructure, BOOLEAN fClose )
}
return( uiSoundID );
}
}
+3 -2
View File
@@ -15,6 +15,7 @@
#include "edit_sys.h"
#include "pathai.h"
#include "tile surface.h"
#include "Tactical Save.h"
#endif
//#include "editscreen.h"
@@ -1206,11 +1207,11 @@ BOOLEAN AnyLowerLand( UINT32 iMapIndex, UINT32 uiSrcType, UINT8 *pubLastLevel )
BOOLEAN GetWallOrientation( UINT16 usIndex, UINT16 *pusWallOrientation )
{
TILE_ELEMENT TileElem;
TILE_ELEMENT TileElem;
*pusWallOrientation = 0xffff;
CHECKF( usIndex != NO_TILE );
CHECKF( usIndex != NO_TILE );
CHECKF( usIndex < NUMBEROFTILES ); //lal bugfix
// Get tile element
+7
View File
@@ -1,3 +1,5 @@
#include "builddefines.h"
#ifdef PRECOMPILEDHEADERS
#include "TileEngine All.h"
#include "PreBattle Interface.h"
@@ -58,6 +60,11 @@
#include "pits.h"
#include "Game Clock.h"
#include "Buildings.h"
#include "strategicmap.h"
#include "overhead map.h"
#include "SmokeEffects.h"
#include "LightEffects.h"
#include "meanwhile.h"
#endif
#define SET_MOVEMENTCOST( a, b, c, d ) ( ( gubWorldMovementCosts[ a ][ b ][ c ] < d ) ? ( gubWorldMovementCosts[ a ][ b ][ c ] = d ) : 0 );
+1
View File
@@ -25,6 +25,7 @@
#include "SaveLoadMap.h"
#include "random.h"
#include "render fun.h"
#include "GameSettings.h"
#endif
extern BOOLEAN gfBasement;