diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index 9e095159..212ebd0f 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -557,6 +557,9 @@ typedef struct bullets_table bTable[11][50]; char client_names[4][30]; + +char team_names[][30];//hayden need client_names with AI + // OJW - 20081204 int client_ready[4]; int client_edges[5]; @@ -639,6 +642,22 @@ void ChatCallback (UINT8 ubResult); void HandleClientConnectionLost(); void disconnected_callback(UINT8 ubResult); +//hayden - i need this for message references +CHAR16 TeamNameStrings[][30] = +{ + L"You", // player's turn + L"AI", + L"Creature", + L"Militia", + L"Civilian", + L"Player_Plan",// planning turn + L"Client #1",//hayden + L"Client #2",//hayden + L"Client #3",//hayden + L"Client #4",//hayden + +}; + // OJW - 20081222 void send_gameover( void ); void StartScoreScreen(); // this screen will send us to the multiplayer score screen @@ -1734,6 +1753,9 @@ void start_battle ( void ) swprintf(full, MPClientMessage[57],i+1,name); memcpy( TeamTurnString[ (i+6) ] , full, sizeof( CHAR16) * 255 ); + + memcpy( TeamNameStrings[ (i+6) ] , name, sizeof( CHAR16) * 30 ); + //give me a copy too ;) - hayden } } @@ -1919,12 +1941,12 @@ void recieveINTERRUPT (RPCParameters *rpcParameters) INT_STRUCT* INT = (INT_STRUCT*)rpcParameters->input; SOLDIERTYPE* pOpponent = MercPtrs[ INT->Interrupted]; - if(INT->bTeam==netbTeam)//for us or AI //im not sure about this comment. i think this if check only if its for us... - hayden + if(INT->bTeam==netbTeam)//for us { INT->bTeam=0; INT->ubID=INT->ubID - ubID_prefix; - for(int i=0; i <= INT->gubOutOfTurnPersons; i++) + 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))) { @@ -1934,21 +1956,16 @@ void recieveINTERRUPT (RPCParameters *rpcParameters) memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT8) * MAXMERCS); gubOutOfTurnPersons = INT->gubOutOfTurnPersons; - // AI has interrupted - if (INT->bTeam == 1) - { - //AddTopMessage( COMPUTER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] ); - } - else - { - AddTopMessage( PLAYER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] ); - } + + 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 { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, MPClientMessage[17] ); + //stop moving merc who was interrupted and init UI bar SOLDIERTYPE* pMerc = MercPtrs[ INT->ubID ]; pMerc->HaultSoldierFromSighting(TRUE); @@ -1959,6 +1976,8 @@ void recieveINTERRUPT (RPCParameters *rpcParameters) AddTopMessage( COMPUTER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] ); //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 { @@ -1969,7 +1988,7 @@ void recieveINTERRUPT (RPCParameters *rpcParameters) } else //start our interrupt turn { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, MPClientMessage[37] ); + 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); @@ -1980,7 +1999,7 @@ void recieveINTERRUPT (RPCParameters *rpcParameters) void intAI (SOLDIERTYPE *pSoldier ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, MPClientMessage[17] ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"intAI with %s", TeamNameStrings[pSoldier->bTeam] );//was MPClientMessage[17], can be reconnected if text updated and translated AddTopMessage( COMPUTER_INTERRUPT_MESSAGE, TeamTurnString[ pSoldier->bTeam ] ); gTacticalStatus.fInterruptOccurred = TRUE; } @@ -2021,9 +2040,9 @@ void resume_turn(RPCParameters *rpcParameters) if(is_server) Sawarded=false; - if(INT->bTeam==netbTeam || (INT->bTeam==1 && is_server))//may need working + if(INT->bTeam==netbTeam || (INT->bTeam==1 && is_server))//may need working //its for us or we are the server and its for the AI { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, MPClientMessage[18] ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Resumed turn after interrupt of %s", TeamNameStrings[INT->bTeam] );//was MPClientMessage[18], can be reconnected if text updated and translated for(int i=0; i <= INT->gubOutOfTurnPersons; i++) { diff --git a/Multiplayer/connect.h b/Multiplayer/connect.h index 26cf4d3c..a756bcd4 100644 --- a/Multiplayer/connect.h +++ b/Multiplayer/connect.h @@ -130,6 +130,9 @@ void reapplySETTINGS(); BOOLEAN CheckConditionsForBattle( GROUP *pGroup ); // this comes from strategic movement.cpp extern char client_names[4][30]; + +extern CHAR16 TeamNameStrings[][30]; + // OJW - 20081204 // I need to keep track of all the clients readyness, spawn edge and team // want to change this all to use client_info, but dont want to make sweeping diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index 45970183..9cc8d7b4 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -323,7 +323,7 @@ void EndTurn( UINT8 ubNextTeam ) if(is_networked) { end_interrupt( FALSE );//this tells other client to go on from where he was - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"ending interrupt" ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Player ended interrupt." ); } EndInterrupt( FALSE ); } @@ -393,7 +393,7 @@ void EndAITurn( void ) if(is_networked) { end_interrupt( FALSE );//this tells other client to go on from where he was - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"ending interrupt" ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"AI ended interrupt." ); } EndInterrupt( FALSE ); } @@ -1154,18 +1154,23 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) nubFirstInterrupter = LATEST_INTERRUPT_GUY; npSoldier = MercPtrs[nubFirstInterrupter]; nbTeam = npSoldier->bTeam; + + //pSoldier is interrupted //but its not available //needs calculating + //npSoldier,nbTeam is interruptor + //hayden #ifdef BETAVERSION ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"unchecked interrupt call area:(resume interrupted interrupt)..."); #endif - if ((nbTeam > 0) && (nbTeam <6 ) && is_server) //is AI and are server + if ((nbTeam > 0) && (nbTeam <6 ) && is_server) // AI interrupt resume and im server { send_interrupt( npSoldier ); StartInterrupt(); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Continuing interrupt with %s and AI", TeamNameStrings[npSoldier->bTeam]);//tried to use pSoldier, but its not available. find another way to get correct team } - else if(is_server && gTacticalStatus.ubCurrentTeam == 1)// against ai + else if(is_server && gTacticalStatus.ubCurrentTeam == 1)// resume AI interrupted and im server { //hayden send_interrupt( npSoldier ); @@ -1175,13 +1180,15 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) else StartInterrupt(); - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"AI is interrupted"); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Continuing interrupt of AI by %s", TeamNameStrings[npSoldier->bTeam]); + } - else + else// pure client awarding interrupt resume //suspect it needs to be: else if(gTacticalStatus.ubCurrentTeam == 0)//its our turn (we are moving) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"interrupt for another team"); //may need more work. + + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Continuing interrupt with %s", TeamNameStrings[npSoldier->bTeam]);//this can be simplified if above comment is implemented //ClearIntList(); - //hayden + //hayden//may need more work. StartInterrupt(); send_interrupt( npSoldier ); // } @@ -2247,11 +2254,15 @@ void DoneAddingToIntList( SOLDIERTYPE * pSoldier, BOOLEAN fChange, UINT8 ubInter nubFirstInterrupter = LATEST_INTERRUPT_GUY; npSoldier = MercPtrs[nubFirstInterrupter]; nbTeam = npSoldier->bTeam; - + + //pSoldier is interrupted + //npSoldier is interruptor + //hayden + // INTERRUPT is calculated on the server if ((nbTeam > 0) && (nbTeam <6 ) && is_server) //is for AI and are server { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"interrupt for AI team"); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s is interrupt by AI", TeamNameStrings[pSoldier->bTeam]); // Only display the top message if we (the server) got interrupted if (pSoldier->bTeam == 0) @@ -2262,7 +2273,7 @@ void DoneAddingToIntList( SOLDIERTYPE * pSoldier, BOOLEAN fChange, UINT8 ubInter } // INTERRUPT is calculated on the server - else if(is_server && gTacticalStatus.ubCurrentTeam == 1)// against ai + else if(is_server && gTacticalStatus.ubCurrentTeam == 1)// against ai and are server { //hayden send_interrupt( npSoldier ); // @@ -2271,7 +2282,7 @@ void DoneAddingToIntList( SOLDIERTYPE * pSoldier, BOOLEAN fChange, UINT8 ubInter else StartInterrupt();// - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"AI is interrupted"); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"AI is interrupted by %s", TeamNameStrings[npSoldier->bTeam]); } // INTERRUPT is calculated on the pure client else if(gTacticalStatus.ubCurrentTeam == 0)//its our turn (we are moving) @@ -2289,7 +2300,9 @@ void DoneAddingToIntList( SOLDIERTYPE * pSoldier, BOOLEAN fChange, UINT8 ubInter InitEnemyUIBar( 0, 0 ); fInterfacePanelDirty = DIRTYLEVEL2; AddTopMessage( COMPUTER_INTERRUPT_MESSAGE, TeamTurnString[ nbTeam ] ); - gTacticalStatus.fInterruptOccurred = TRUE; + gTacticalStatus.fInterruptOccurred = TRUE; + + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"You have interrupted %s", TeamNameStrings[npSoldier->bTeam]); } else {