mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Merged from revision: 7586
Multiplayer Bugfix: - Improved (fixed) interrupt endless clock when enemy interrupts (CO-OP game) (tested by Woquit) - Override turn (ALT + E): Now it is possible again for the server to give the turn back to itself - Updated MP Version Number to 3.1 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7587 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+104
-49
@@ -1946,68 +1946,124 @@ void send_interrupt (SOLDIERTYPE *pSoldier)
|
||||
client->RPC("sendINTERRUPT",(const char*)&INT, (int)sizeof(INT_STRUCT)*8, HIGH_PRIORITY, RELIABLE, 0, UNASSIGNED_SYSTEM_ADDRESS, true, 0, UNASSIGNED_NETWORK_ID,0);
|
||||
}
|
||||
|
||||
// WANNE - MP: Here we have to add AddTopMessage() on the clients
|
||||
void recieveINTERRUPT (RPCParameters *rpcParameters)
|
||||
{
|
||||
INT_STRUCT* INT = (INT_STRUCT*)rpcParameters->input;
|
||||
SOLDIERTYPE* pOpponent = MercPtrs[ INT->Interrupted];
|
||||
|
||||
if(INT->bTeam==netbTeam)//for us
|
||||
if (cGameType == MP_TYPE_COOP)
|
||||
{
|
||||
INT->bTeam=0;
|
||||
INT->ubID=INT->ubID - ubID_prefix;
|
||||
INT_STRUCT* INT = (INT_STRUCT*)rpcParameters->input;
|
||||
SOLDIERTYPE* pOpponent = MercPtrs[ INT->Interrupted];
|
||||
|
||||
for(int i=0; i <= INT->gubOutOfTurnPersons; i++)//this loop translates soldier id's from what they are in someone else's game to what they are locally
|
||||
if( INT->bTeam == netbTeam || is_server)//its for us or we are server and its for AI which we control
|
||||
{
|
||||
if((INT->gubOutOfTurnOrder[i] >= ubID_prefix) && (INT->gubOutOfTurnOrder[i] < (ubID_prefix+6)))
|
||||
if(INT->bTeam == netbTeam)
|
||||
{
|
||||
INT->gubOutOfTurnOrder[i]=INT->gubOutOfTurnOrder[i]-ubID_prefix;
|
||||
//for me
|
||||
INT->bTeam=0;
|
||||
INT->ubID=INT->ubID - ubID_prefix;
|
||||
AddTopMessage( PLAYER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
//for ai
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"starting ai" );
|
||||
AddTopMessage( COMPUTER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] );
|
||||
}
|
||||
}
|
||||
memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT8) * MAXMERCS);
|
||||
gubOutOfTurnPersons = INT->gubOutOfTurnPersons;
|
||||
|
||||
for(int i=0; i <= INT->gubOutOfTurnPersons; i++)//this loop translates soldier id's from what they are in someone else's game to what they are locally
|
||||
{
|
||||
if((INT->gubOutOfTurnOrder[i] >= ubID_prefix) && (INT->gubOutOfTurnOrder[i] < (ubID_prefix+6)))
|
||||
{
|
||||
INT->gubOutOfTurnOrder[i]=INT->gubOutOfTurnOrder[i]-ubID_prefix;
|
||||
}
|
||||
}
|
||||
memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT8) * MAXMERCS);
|
||||
gubOutOfTurnPersons = INT->gubOutOfTurnPersons;
|
||||
|
||||
AddTopMessage( PLAYER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt of %s awarded to %s.", TeamNameStrings[pOpponent->bTeam], TeamNameStrings[INT->bTeam] );
|
||||
if(INT->bTeam==netbTeam)//for us
|
||||
AddTopMessage( PLAYER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] );
|
||||
|
||||
}
|
||||
|
||||
// WANNE - MP: This seems to cause the HANG on AI interrupt where we have to press ALT + E on the server!
|
||||
if( INT->bTeam != 0)//not for our team - hayden
|
||||
{
|
||||
|
||||
//stop moving merc who was interrupted and init UI bar
|
||||
SOLDIERTYPE* pMerc = MercPtrs[ INT->ubID ];
|
||||
pMerc->HaultSoldierFromSighting(TRUE);
|
||||
FreezeInterfaceForEnemyTurn();
|
||||
InitEnemyUIBar( 0, 0 );
|
||||
fInterfacePanelDirty = DIRTYLEVEL2;
|
||||
gTacticalStatus.fInterruptOccurred = TRUE;
|
||||
|
||||
//this needed to add details of who's interrupt it is - hayden
|
||||
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt with %s awarded to %s.", TeamNameStrings[pOpponent->bTeam], TeamNameStrings[INT->bTeam] );//was MPClientMessage[17], can be reconnected if text updated and translated
|
||||
}
|
||||
else
|
||||
{
|
||||
//it for us ! :)
|
||||
if(INT->gubOutOfTurnPersons==0)//indicates finished interrupt maybe can just call end interrupt
|
||||
{
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"old int finish" );
|
||||
}
|
||||
else //start our interrupt turn
|
||||
{
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt of %s awarded to you.", TeamNameStrings[pOpponent->bTeam] );//was MPClientMessage[37], can be reconnected if text updated and translated
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Recieved interrupt between %s and %s.", TeamNameStrings[pOpponent->bTeam], TeamNameStrings[INT->bTeam] );
|
||||
|
||||
//start interrupt turn //real interrupt code
|
||||
SOLDIERTYPE* pSoldier = MercPtrs[ INT->ubID ];
|
||||
ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->pathing.bLevel,2,1);
|
||||
StartInterrupt();
|
||||
}
|
||||
// It is our team
|
||||
else if(INT->bTeam == 0)
|
||||
{
|
||||
//it for us ! :)
|
||||
if(INT->gubOutOfTurnPersons==0)//indicates finished interrupt maybe can just call end interrupt
|
||||
{
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"old int finish" );
|
||||
}
|
||||
else //start our interrupt turn
|
||||
{
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt of %s awarded to you.", TeamNameStrings[pOpponent->bTeam] );//was MPClientMessage[37], can be reconnected if text updated and translated
|
||||
|
||||
SOLDIERTYPE* pSoldier = MercPtrs[ INT->ubID ];
|
||||
ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->pathing.bLevel,2,1);
|
||||
StartInterrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
INT_STRUCT* INT = (INT_STRUCT*)rpcParameters->input;
|
||||
SOLDIERTYPE* pOpponent = MercPtrs[ INT->Interrupted];
|
||||
|
||||
if(INT->bTeam==netbTeam)//for us
|
||||
{
|
||||
INT->bTeam=0;
|
||||
INT->ubID=INT->ubID - ubID_prefix;
|
||||
|
||||
for(int i=0; i <= INT->gubOutOfTurnPersons; i++)//this loop translates soldier id's from what they are in someone else's game to what they are locally
|
||||
{
|
||||
if((INT->gubOutOfTurnOrder[i] >= ubID_prefix) && (INT->gubOutOfTurnOrder[i] < (ubID_prefix+6)))
|
||||
{
|
||||
INT->gubOutOfTurnOrder[i]=INT->gubOutOfTurnOrder[i]-ubID_prefix;
|
||||
}
|
||||
}
|
||||
memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT8) * MAXMERCS);
|
||||
gubOutOfTurnPersons = INT->gubOutOfTurnPersons;
|
||||
|
||||
AddTopMessage( PLAYER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt of %s awarded to %s.", TeamNameStrings[pOpponent->bTeam], TeamNameStrings[INT->bTeam] );
|
||||
}
|
||||
|
||||
// WANNE - MP: This seems to cause the HANG on AI interrupt where we have to press ALT + E on the server!
|
||||
if( INT->bTeam != 0)//not for our team - hayden
|
||||
{
|
||||
//stop moving merc who was interrupted and init UI bar
|
||||
SOLDIERTYPE* pMerc = MercPtrs[ INT->ubID ];
|
||||
pMerc->HaultSoldierFromSighting(TRUE);
|
||||
FreezeInterfaceForEnemyTurn();
|
||||
InitEnemyUIBar( 0, 0 );
|
||||
fInterfacePanelDirty = DIRTYLEVEL2;
|
||||
gTacticalStatus.fInterruptOccurred = TRUE;
|
||||
|
||||
//this needed to add details of who's interrupt it is - hayden
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt with %s awarded to %s.", TeamNameStrings[pOpponent->bTeam], TeamNameStrings[INT->bTeam] );//was MPClientMessage[17], can be reconnected if text updated and translated
|
||||
}
|
||||
else
|
||||
{
|
||||
//it for us ! :)
|
||||
if(INT->gubOutOfTurnPersons==0)//indicates finished interrupt maybe can just call end interrupt
|
||||
{
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"old int finish" );
|
||||
}
|
||||
else //start our interrupt turn
|
||||
{
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt of %s awarded to you.", TeamNameStrings[pOpponent->bTeam] );//was MPClientMessage[37], can be reconnected if text updated and translated
|
||||
|
||||
SOLDIERTYPE* pSoldier = MercPtrs[ INT->ubID ];
|
||||
ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->pathing.bLevel,2,1);
|
||||
StartInterrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void intAI (SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"intAI with %s", TeamNameStrings[pSoldier->bTeam] );//was MPClientMessage[17], can be reconnected if text updated and translated
|
||||
@@ -4283,11 +4339,11 @@ void overide_turn (void)
|
||||
CHAR16 Cmsg[255];
|
||||
|
||||
if (cMaxClients == 2)
|
||||
swprintf(Cmsg, MPClientMessage[30], client_names[1],"<?>","<?>");
|
||||
swprintf(Cmsg, MPClientMessage[30], client_names[0], client_names[1],"<?>","<?>");
|
||||
else if (cMaxClients == 3)
|
||||
swprintf(Cmsg, MPClientMessage[30], client_names[1],client_names[2],"<?>");
|
||||
swprintf(Cmsg, MPClientMessage[30], client_names[0], client_names[1],client_names[2],"<?>");
|
||||
else
|
||||
swprintf(Cmsg, MPClientMessage[30], client_names[1],client_names[2],client_names[3]);
|
||||
swprintf(Cmsg, MPClientMessage[30], client_names[0], client_names[1],client_names[2],client_names[3]);
|
||||
|
||||
SGPRect CenterRect = { 100 + xResOffset, 100 + yResOffset, SCREEN_WIDTH - 100 - xResOffset, 300 + yResOffset };
|
||||
|
||||
@@ -4304,8 +4360,7 @@ void turn_callback (UINT8 ubResult)
|
||||
// Pressed '1'
|
||||
if(ubResult ==1)
|
||||
{
|
||||
// WANNE: Nothing should happen. Do not give the turn to the server!
|
||||
//EndTurn( 0 );
|
||||
EndTurn( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user