// //////////////////////////////////////////////////////////////////////////// // process clicks made by user. void intProcessMultiMenu(UDWORD id) { UBYTE i; //close if (id == MULTIMENU_CLOSE) { intCloseMultiMenu(); } //alliance button if(id >=MULTIMENU_ALLIANCE_BASE && id<MULTIMENU_ALLIANCE_BASE+MAX_PLAYERS) { i =(UBYTE)( id - MULTIMENU_ALLIANCE_BASE); switch(alliances[selectedPlayer][i]) { case ALLIANCE_BROKEN: requestAlliance((UBYTE)selectedPlayer,i,true,true); // request an alliance break; case ALLIANCE_INVITATION: formAlliance((UBYTE)selectedPlayer,i,true,true,true); // form an alliance break; case ALLIANCE_REQUESTED: breakAlliance((UBYTE)selectedPlayer,i,true,true); // break an alliance break; case ALLIANCE_FORMED: breakAlliance((UBYTE)selectedPlayer,i,true,true); // break an alliance break; default: break; } } //channel opens. if(id >=MULTIMENU_CHANNEL && id<MULTIMENU_CHANNEL+MAX_PLAYERS) { i = id - MULTIMENU_CHANNEL; openchannels[i] = !openchannels[i]; } //radar gifts if(id >= MULTIMENU_GIFT_RAD && id< MULTIMENU_GIFT_RAD +MAX_PLAYERS) { sendGift(RADAR_GIFT, id - MULTIMENU_GIFT_RAD); } // research gift if(id >= MULTIMENU_GIFT_RES && id<MULTIMENU_GIFT_RES +MAX_PLAYERS) { sendGift(RESEARCH_GIFT, id - MULTIMENU_GIFT_RES); } //droid gift if(id >= MULTIMENU_GIFT_DRO && id< MULTIMENU_GIFT_DRO +MAX_PLAYERS) { sendGift(DROID_GIFT, id - MULTIMENU_GIFT_DRO); } //power gift if(id >= MULTIMENU_GIFT_POW && id< MULTIMENU_GIFT_POW +MAX_PLAYERS) { sendGift(POWER_GIFT, id - MULTIMENU_GIFT_POW); } }
BOOL intAddMultiMenu(void) { W_FORMINIT sFormInit; W_BUTINIT sButInit; UDWORD i; //check for already open. if(widgGetFromID(psWScreen,MULTIMENU_FORM)) { intCloseMultiMenu(); return true; } if (intMode != INT_INTELMAP) { intResetScreen(false); } // add form memset(&sFormInit, 0, sizeof(W_FORMINIT)); sFormInit.formID = 0; sFormInit.id = MULTIMENU_FORM; sFormInit.style = WFORM_PLAIN; sFormInit.x =(SWORD)(MULTIMENU_FORM_X); sFormInit.y =(SWORD)(MULTIMENU_FORM_Y); sFormInit.width = MULTIMENU_FORM_W; sFormInit.height = (UWORD)(MULTIMENU_PLAYER_H*game.maxPlayers + MULTIMENU_PLAYER_H+7); //MULTIMENU_FORM_H; sFormInit.pDisplay = intOpenPlainForm; sFormInit.disableChildren = true; if (!widgAddForm(psWScreen, &sFormInit)) { return false; } // add any players for(i=0;i<MAX_PLAYERS;i++) { if(isHumanPlayer(i) || (game.type == SKIRMISH && i<game.maxPlayers && game.skDiff[i] ) ) { addMultiPlayer(i,NetPlay.players[i].position); } } // Add the close button. memset(&sButInit, 0, sizeof(W_BUTINIT)); sButInit.formID = MULTIMENU_FORM; sButInit.id = MULTIMENU_CLOSE; sButInit.style = WBUT_PLAIN; sButInit.x = MULTIMENU_FORM_W - CLOSE_WIDTH; sButInit.y = 0; sButInit.width = CLOSE_WIDTH; sButInit.height = CLOSE_HEIGHT; sButInit.pTip = _("Close"); sButInit.FontID = font_regular; sButInit.pDisplay = intDisplayImageHilight; sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE); if (!widgAddButton(psWScreen, &sButInit)) { return false; } intShowPowerBar(); // add power bar if (intMode != INT_INTELMAP) { intMode = INT_MULTIMENU; // change interface mode. } MultiMenuUp = true; return true; }
// //////////////////////////////////////////////////////////////////////////// // process clicks made by user. void intProcessMultiMenu(UDWORD id) { UBYTE i; //close if (id == MULTIMENU_CLOSE) { intCloseMultiMenu(); } //alliance button if(id >=MULTIMENU_ALLIANCE_BASE && id<MULTIMENU_ALLIANCE_BASE+MAX_PLAYERS) { i =(UBYTE)( id - MULTIMENU_ALLIANCE_BASE); switch(alliances[selectedPlayer][i]) { case ALLIANCE_BROKEN: requestAlliance((UBYTE)selectedPlayer,i,true,true); // request an alliance break; case ALLIANCE_INVITATION: formAlliance((UBYTE)selectedPlayer,i,true,true,true); // form an alliance break; case ALLIANCE_REQUESTED: breakAlliance((UBYTE)selectedPlayer,i,true,true); // break an alliance break; case ALLIANCE_FORMED: breakAlliance((UBYTE)selectedPlayer,i,true,true); // break an alliance break; default: break; } } //channel opens. if(id >=MULTIMENU_CHANNEL && id<MULTIMENU_CHANNEL+MAX_PLAYERS) { i = id - MULTIMENU_CHANNEL; openchannels[i] = !openchannels[i]; if(mouseDown(MOUSE_RMB) && NetPlay.isHost) // both buttons.... { char buf[250]; // Allow the host to kick the AI only in a MP game, or if they activated cheats in a skirmish game if ((NetPlay.bComms || Cheated) && (NetPlay.players[i].allocated || (NetPlay.players[i].allocated == false && NetPlay.players[i].ai != AI_OPEN))) { inputLoseFocus(); ssprintf(buf, _("The host has kicked %s from the game!"), getPlayerName((unsigned int) i)); sendTextMessage(buf, true); ssprintf(buf, _("kicked %s : %s from the game, and added them to the banned list!"), getPlayerName((unsigned int) i), NetPlay.players[i].IPtextAddress); NETlogEntry(buf, SYNC_FLAG, (unsigned int) i); kickPlayer((unsigned int) i, "you are unwanted by the host.", ERROR_KICKED); return; } } } //radar gifts if(id >= MULTIMENU_GIFT_RAD && id< MULTIMENU_GIFT_RAD +MAX_PLAYERS) { sendGift(RADAR_GIFT, id - MULTIMENU_GIFT_RAD); } // research gift if(id >= MULTIMENU_GIFT_RES && id<MULTIMENU_GIFT_RES +MAX_PLAYERS) { sendGift(RESEARCH_GIFT, id - MULTIMENU_GIFT_RES); } //droid gift if(id >= MULTIMENU_GIFT_DRO && id< MULTIMENU_GIFT_DRO +MAX_PLAYERS) { sendGift(DROID_GIFT, id - MULTIMENU_GIFT_DRO); } //power gift if(id >= MULTIMENU_GIFT_POW && id< MULTIMENU_GIFT_POW +MAX_PLAYERS) { sendGift(POWER_GIFT, id - MULTIMENU_GIFT_POW); } }