mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Merged Multi Player Project into main branch
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2144 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "builddefines.h"
|
||||
|
||||
// WANNE 2 <changed some lines>
|
||||
|
||||
#ifdef PRECOMPILEDHEADERS
|
||||
#include "TileEngine All.h"
|
||||
#include "PreBattle Interface.h"
|
||||
@@ -43,6 +45,9 @@
|
||||
#include "WordWrap.h"
|
||||
#include "Game Clock.h"
|
||||
#endif
|
||||
#include "connect.h"
|
||||
#include "saveloadscreen.h"
|
||||
|
||||
|
||||
typedef struct MERCPLACEMENT
|
||||
{
|
||||
@@ -70,6 +75,7 @@ extern BOOLEAN GetOverheadMouseGridNo( INT16 *psGridNo );
|
||||
|
||||
extern UINT16 iOffsetHorizontal;
|
||||
extern UINT16 iOffsetVertical;
|
||||
int islocked;
|
||||
|
||||
UINT8 gubDefaultButton = CLEAR_BUTTON;
|
||||
BOOLEAN gfTacticalPlacementGUIActive = FALSE;
|
||||
@@ -119,6 +125,8 @@ void SelectNextUnplacedUnit();
|
||||
BOOLEAN gfNorthValid, gfEastValid, gfSouthValid, gfWestValid;
|
||||
BOOLEAN gfChangedEntrySide = FALSE;
|
||||
|
||||
|
||||
|
||||
void FindValidInsertionCode( UINT8 *pubStrategicInsertionCode )
|
||||
{
|
||||
if( gMapInformation.sNorthGridNo == -1 &&
|
||||
@@ -216,6 +224,7 @@ void CheckForValidMapEdge( UINT8 *pubStrategicInsertionCode )
|
||||
|
||||
void InitTacticalPlacementGUI()
|
||||
{
|
||||
islocked=0;//hayden
|
||||
VOBJECT_DESC VObjectDesc;
|
||||
INT32 i, xp, yp;
|
||||
UINT8 ubFaceIndex;
|
||||
@@ -414,7 +423,8 @@ void InitTacticalPlacementGUI()
|
||||
MSYS_DefineRegion( &gMercPlacement[ i ].region, (UINT16)xp, (UINT16)yp, (UINT16)(xp + 54), (UINT16)(yp + 62), MSYS_PRIORITY_HIGH, 0, MercMoveCallback, MercClickCallback );
|
||||
}
|
||||
|
||||
PlaceMercs();
|
||||
|
||||
if(!is_client)PlaceMercs();//hayden
|
||||
|
||||
if( gubDefaultButton == GROUP_BUTTON )
|
||||
{
|
||||
@@ -662,6 +672,39 @@ void EnsureDoneButtonStatus()
|
||||
}
|
||||
}
|
||||
|
||||
void lockui (bool unlock) //lock onluck ui for lan //hayden
|
||||
{
|
||||
if(unlock==0 && islocked==0 && is_client)
|
||||
{
|
||||
islocked=1;
|
||||
DisableButton( iTPButtons[ DONE_BUTTON ] );
|
||||
DisableButton( iTPButtons[ SPREAD_BUTTON ] );
|
||||
DisableButton( iTPButtons[ GROUP_BUTTON ] );
|
||||
DisableButton( iTPButtons[ CLEAR_BUTTON ] );
|
||||
|
||||
SGPRect CenterRect = { 100, 100, SCREEN_WIDTH - 100, 300 };
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, MPServerMessage[8], guiCurrentScreen, MSG_BOX_FLAG_OK | MSG_BOX_FLAG_USE_CENTERING_RECT, DialogRemoved, &CenterRect );
|
||||
|
||||
//send loaded
|
||||
send_loaded();
|
||||
}
|
||||
|
||||
if(unlock) //oh yeah ! :)
|
||||
{
|
||||
islocked=3;
|
||||
EnableButton( iTPButtons[ SPREAD_BUTTON ] );
|
||||
EnableButton( iTPButtons[ GROUP_BUTTON ] );
|
||||
EnableButton( iTPButtons[ CLEAR_BUTTON ] );
|
||||
|
||||
ButtonList[ iTPButtons[ GROUP_BUTTON ] ]->uiFlags &= ~BUTTON_CLICKED_ON;
|
||||
ButtonList[ iTPButtons[ GROUP_BUTTON ] ]->uiFlags |= BUTTON_DIRTY;
|
||||
gubDefaultButton = CLEAR_BUTTON;
|
||||
PlaceMercs();
|
||||
gMsgBox.bHandled = MSG_BOX_RETURN_OK; //close if still open
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void TacticalPlacementHandle()
|
||||
{
|
||||
InputAtom InputEvent;
|
||||
@@ -669,6 +712,9 @@ void TacticalPlacementHandle()
|
||||
EnsureDoneButtonStatus();
|
||||
|
||||
RenderTacticalPlacementGUI();
|
||||
|
||||
if (is_networked)
|
||||
lockui(0);//lockui before placement while clients loading //hayden
|
||||
|
||||
if( gfRightButtonState )
|
||||
{
|
||||
@@ -691,24 +737,42 @@ void TacticalPlacementHandle()
|
||||
case ENTER:
|
||||
if( ButtonList[ iTPButtons[ DONE_BUTTON ] ]->uiFlags & BUTTON_ENABLED )
|
||||
{
|
||||
KillTacticalPlacementGUI();
|
||||
if(!is_client)KillTacticalPlacementGUI();
|
||||
//if(is_client)send_donegui(0); only by mouse //hayden
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
ClearPlacementsCallback( ButtonList[ iTPButtons[ CLEAR_BUTTON ] ], MSYS_CALLBACK_REASON_LBUTTON_UP );
|
||||
break;
|
||||
if(islocked!=1)ClearPlacementsCallback( ButtonList[ iTPButtons[ CLEAR_BUTTON ] ], MSYS_CALLBACK_REASON_LBUTTON_UP );
|
||||
break;
|
||||
case 'g':
|
||||
GroupPlacementsCallback( ButtonList[ iTPButtons[ GROUP_BUTTON ] ], MSYS_CALLBACK_REASON_LBUTTON_UP );
|
||||
break;
|
||||
if(islocked!=1)GroupPlacementsCallback( ButtonList[ iTPButtons[ GROUP_BUTTON ] ], MSYS_CALLBACK_REASON_LBUTTON_UP );
|
||||
break;
|
||||
case 's':
|
||||
SpreadPlacementsCallback( ButtonList[ iTPButtons[ SPREAD_BUTTON ] ], MSYS_CALLBACK_REASON_LBUTTON_UP );
|
||||
break;
|
||||
if(islocked!=1)SpreadPlacementsCallback( ButtonList[ iTPButtons[ SPREAD_BUTTON ] ], MSYS_CALLBACK_REASON_LBUTTON_UP );
|
||||
break;
|
||||
case 'x':
|
||||
if( InputEvent.usKeyState & ALT_DOWN )
|
||||
{
|
||||
HandleShortCutExitState();
|
||||
}
|
||||
break;
|
||||
case 'l'://hayden
|
||||
if( InputEvent.usKeyState & ALT_DOWN )
|
||||
{
|
||||
if (is_networked)
|
||||
{
|
||||
KillTacticalPlacementGUI();
|
||||
DoQuickLoad();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '7':
|
||||
if (is_networked)
|
||||
{
|
||||
if(is_server)
|
||||
manual_overide();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -765,7 +829,12 @@ void TacticalPlacementHandle()
|
||||
}
|
||||
if( gfKillTacticalGUI == 1 )
|
||||
{
|
||||
KillTacticalPlacementGUI();
|
||||
if(is_client)
|
||||
{
|
||||
gfKillTacticalGUI = FALSE;
|
||||
send_donegui(0);
|
||||
}
|
||||
if(!is_client)KillTacticalPlacementGUI();
|
||||
}
|
||||
else if( gfKillTacticalGUI == 2 )
|
||||
{
|
||||
@@ -966,6 +1035,8 @@ void MercMoveCallback( MOUSE_REGION *reg, INT32 reason )
|
||||
|
||||
void MercClickCallback( MOUSE_REGION *reg, INT32 reason )
|
||||
{
|
||||
if(islocked != 1)//hayden
|
||||
{
|
||||
if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
|
||||
{
|
||||
INT8 i;
|
||||
@@ -984,6 +1055,7 @@ void MercClickCallback( MOUSE_REGION *reg, INT32 reason )
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1178,11 +1250,26 @@ void PutDownMercPiece( INT32 iPlacement )
|
||||
if( sGridNo != NOWHERE )
|
||||
{
|
||||
ConvertGridNoToCellXY( sGridNo, &sCellX, &sCellY );
|
||||
pSoldier->EVENT_SetSoldierPosition( (FLOAT)sCellX, (FLOAT)sCellY );
|
||||
|
||||
FLOAT scX = (FLOAT)sCellX;
|
||||
FLOAT scY = (FLOAT)sCellY;//hayden
|
||||
if (is_networked)
|
||||
{
|
||||
pSoldier->EVENT_SetSoldierPosition( scX, scY );
|
||||
}
|
||||
else
|
||||
{
|
||||
pSoldier->EVENT_SetSoldierPosition( (FLOAT)sCellX, (FLOAT)sCellY );
|
||||
}
|
||||
|
||||
|
||||
pSoldier->EVENT_SetSoldierDirection( ubDirection );
|
||||
pSoldier->ubInsertionDirection = pSoldier->ubDirection;
|
||||
gMercPlacement[ iPlacement ].fPlaced = TRUE;
|
||||
gMercPlacement[ iPlacement ].pSoldier->bInSector = TRUE;
|
||||
//hayden
|
||||
if(is_client)send_gui_pos(pSoldier, scX, scY);
|
||||
if(is_client)send_gui_dir(pSoldier, ubDirection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user