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
+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