/** print out information about a general component * \param psStats the component to print the info for */ static void printComponentInfo(const COMPONENT_STATS* psStats) { psStats = psStats; CONPRINTF(ConsoleString,(ConsoleString,"%s ref %d\n" " bPwr %d bPnts %d wt %d bdy %d imd %p\n", getStatName(psStats), psStats->ref, psStats->buildPower, psStats->buildPoints, psStats->weight, psStats->body, psStats->pIMD)); }
/*Add the 3D world view for the particular message (only research nmessages now) */ BOOL intAddMessageView(MESSAGE * psMessage) { BOOL Animate = true; RESEARCH *psResearch; // Is the form already up? if(widgGetFromID(psWScreen,IDINTMAP_MSGVIEW) != NULL) { intRemoveMessageView(false); Animate = false; } if (MultiMenuUp) { intCloseMultiMenuNoAnim(); } /* Add the base form */ W_FORMINIT sFormInit; sFormInit.formID = 0; sFormInit.id = IDINTMAP_MSGVIEW; sFormInit.style = WFORM_PLAIN; //size and position depends on the type of message - ONLY RESEARCH now sFormInit.width = INTMAP_RESEARCHWIDTH; sFormInit.height = INTMAP_RESEARCHHEIGHT; sFormInit.x = (SWORD)INTMAP_RESEARCHX; sFormInit.y = (SWORD)INTMAP_RESEARCHY; // If the window was closed then do open animation. if(Animate) { sFormInit.pDisplay = intOpenPlainForm; sFormInit.disableChildren = true; } else { // otherwise just display it. sFormInit.pDisplay = intDisplayPlainForm; } if (!widgAddForm(psWScreen, &sFormInit)) { return false; } /* Add the close box */ W_BUTINIT sButInit; sButInit.formID = IDINTMAP_MSGVIEW; sButInit.id = IDINTMAP_CLOSE; sButInit.x = (SWORD)(sFormInit.width - OPT_GAP - CLOSE_SIZE); sButInit.y = OPT_GAP; sButInit.width = CLOSE_SIZE; sButInit.height = CLOSE_SIZE; sButInit.pTip = _("Close"); sButInit.pDisplay = intDisplayImageHilight; sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE); if (!widgAddButton(psWScreen, &sButInit)) { return false; } if (psMessage->type != MSG_RESEARCH && ((VIEWDATA*)psMessage->pViewData)->type == VIEW_RPL) { VIEW_REPLAY *psViewReplay; size_t i, cur_seq, cur_seqpage; psViewReplay = (VIEW_REPLAY *)((VIEWDATA *)psMessage->pViewData)->pData; /* Add a big tabbed text box for the subtitle text */ sFormInit = W_FORMINIT(); sFormInit.id = IDINTMAP_SEQTEXT; sFormInit.formID = IDINTMAP_MSGVIEW; sFormInit.style = WFORM_TABBED; sFormInit.x = INTMAP_SEQTEXTX; sFormInit.y = INTMAP_SEQTEXTY; sFormInit.width = INTMAP_SEQTEXTWIDTH; sFormInit.height = INTMAP_SEQTEXTHEIGHT; sFormInit.majorPos = WFORM_TABBOTTOM; sFormInit.minorPos = WFORM_TABNONE; sFormInit.majorSize = OBJ_TABWIDTH; sFormInit.majorOffset = OBJ_TABOFFSET; sFormInit.tabVertOffset = (OBJ_TABHEIGHT/2); sFormInit.tabMajorThickness = OBJ_TABHEIGHT; sFormInit.numMajor = 0; cur_seq = cur_seqpage = 0; do { sFormInit.aNumMinors[sFormInit.numMajor] = 1; sFormInit.numMajor++; } while (!intDisplaySeqTextViewPage(psViewReplay, 0, 0, sFormInit.width, sFormInit.height, false, &cur_seq, &cur_seqpage)); sFormInit.pUserData = &StandardTab; sFormInit.pTabDisplay = intDisplayTab; if (!widgAddForm(psWScreen, &sFormInit)) { return false; } W_FORMINIT sTabForm; sTabForm.formID = IDINTMAP_SEQTEXT; sTabForm.id = IDINTMAP_SEQTEXTSTART; sTabForm.majorID = 0; sTabForm.minorID = 0; sTabForm.style = WFORM_PLAIN; sTabForm.x = INTMAP_SEQTEXTTABX; sTabForm.y = INTMAP_SEQTEXTTABY; sTabForm.width = INTMAP_SEQTEXTTABWIDTH; sTabForm.height = INTMAP_SEQTEXTTABHEIGHT; sTabForm.pDisplay = intDisplaySeqTextView; sTabForm.pUserData = psViewReplay; for (i = 0; i < sFormInit.numMajor; i++) { sTabForm.id = IDINTMAP_SEQTEXTSTART + i; sTabForm.majorID = i; if (!widgAddForm(psWScreen, &sTabForm)) { return false; } } return true; } /*add the Label for the title box*/ W_LABINIT sLabInit; sLabInit.id = IDINTMAP_TITLELABEL; sLabInit.formID = IDINTMAP_MSGVIEW; sLabInit.x = INTMAP_TITLEX + TEXT_XINDENT; sLabInit.y = INTMAP_TITLEY + TEXT_YINDENT; sLabInit.width = INTMAP_TITLEWIDTH; sLabInit.height = INTMAP_TITLEHEIGHT; //print research name in title bar ASSERT( psMessage->type != MSG_PROXIMITY, "intAddMessageView:Invalid message type for research" ); psResearch = getResearchForMsg((VIEWDATA *)psMessage->pViewData); ASSERT( psResearch!=NULL,"Research not found" ); //sLabInit.pText=psResearch->pName; sLabInit.pText = getStatName(psResearch); sLabInit.FontID = font_regular; if (!widgAddLabel(psWScreen, &sLabInit)) { return false; } /*Add the PIE box*/ sFormInit = W_FORMINIT(); sFormInit.formID = IDINTMAP_MSGVIEW; sFormInit.id = IDINITMAP_PIEVIEW; sFormInit.style = WFORM_PLAIN; sFormInit.x = INTMAP_PIEX; sFormInit.y = INTMAP_PIEY; sFormInit.width = INTMAP_PIEWIDTH; sFormInit.height = INTMAP_PIEHEIGHT; sFormInit.pDisplay = intDisplayPIEView; sFormInit.pUserData = psMessage; if (!widgAddForm(psWScreen, &sFormInit)) { return false; } #ifndef NO_VIDEO /*Add the Flic box */ sFormInit = W_FORMINIT(); sFormInit.formID = IDINTMAP_MSGVIEW; sFormInit.id = IDINTMAP_FLICVIEW; sFormInit.style = WFORM_PLAIN; sFormInit.x = INTMAP_FLICX; sFormInit.y = INTMAP_FLICY; sFormInit.width = INTMAP_FLICWIDTH; sFormInit.height = INTMAP_FLICHEIGHT; sFormInit.pDisplay = intDisplayFLICView; sFormInit.pUserData = psMessage; if (!widgAddForm(psWScreen, &sFormInit)) { return false; } #endif /*Add the text box*/ sFormInit = W_FORMINIT(); sFormInit.formID = IDINTMAP_MSGVIEW; sFormInit.id = IDINTMAP_TEXTVIEW; sFormInit.style = WFORM_PLAIN; sFormInit.x = INTMAP_TEXTX; sFormInit.y = INTMAP_TEXTY; sFormInit.width = INTMAP_TEXTWIDTH; sFormInit.height = INTMAP_TEXTHEIGHT; sFormInit.pDisplay = intDisplayTEXTView; sFormInit.pUserData = psMessage; if (!widgAddForm(psWScreen, &sFormInit)) { return false; } return true; }
/* Add the Message sub form */ static BOOL intAddMessageForm(BOOL playCurrent) { UDWORD numButtons, i; MESSAGE *psMessage; RESEARCH *psResearch; SDWORD BufferID; /* Add the Message form */ W_FORMINIT sFormInit; sFormInit.formID = IDINTMAP_FORM; sFormInit.id = IDINTMAP_MSGFORM; sFormInit.style = WFORM_TABBED; sFormInit.width = INTMAP_MSGWIDTH; sFormInit.height = INTMAP_MSGHEIGHT; sFormInit.x = INTMAP_MSGX; sFormInit.y = INTMAP_MSGY; sFormInit.majorPos = WFORM_TABTOP; sFormInit.minorPos = WFORM_TABNONE; sFormInit.majorSize = OBJ_TABWIDTH; sFormInit.majorOffset = OBJ_TABOFFSET; sFormInit.tabVertOffset = (OBJ_TABHEIGHT/2); sFormInit.tabMajorThickness = OBJ_TABHEIGHT; numButtons = 0; /*work out the number of buttons */ for(psMessage = apsMessages[selectedPlayer]; psMessage; psMessage = psMessage->psNext) { //ignore proximity messages here if (psMessage->type != MSG_PROXIMITY) { numButtons++; } // stop adding the buttons once max has been reached if (numButtons > (IDINTMAP_MSGEND - IDINTMAP_MSGSTART)) { break; } } //set the number of tabs required sFormInit.numMajor = numForms((OBJ_BUTWIDTH + OBJ_GAP) * numButtons, (OBJ_WIDTH - OBJ_GAP)*2); sFormInit.pUserData = &StandardTab; sFormInit.pTabDisplay = intDisplayTab; if (sFormInit.numMajor > MAX_TAB_STD_SHOWN) { // we do NOT use smallTab icons here, so be safe and only display max # of // standard sized tab icons. sFormInit.numMajor = MAX_TAB_STD_SHOWN; } //set minor tabs to 1 for (i=0; i< sFormInit.numMajor; i++) { sFormInit.aNumMinors[i] = 1; } if (!widgAddForm(psWScreen, &sFormInit)) { return false; } /* Add the message buttons */ W_FORMINIT sBFormInit; sBFormInit.formID = IDINTMAP_MSGFORM; sBFormInit.id = IDINTMAP_MSGSTART; sBFormInit.majorID = 0; sBFormInit.minorID = 0; sBFormInit.style = WFORM_CLICKABLE; sBFormInit.x = OBJ_STARTX; sBFormInit.y = OBJ_STATSTARTY; sBFormInit.width = OBJ_BUTWIDTH; sBFormInit.height = OBJ_BUTHEIGHT; ClearObjectBuffers(); //add each button messageID = 0; for(psMessage = apsMessages[selectedPlayer]; psMessage; psMessage = psMessage->psNext) { /*if (psMessage->type == MSG_TUTORIAL) { //tutorial cases should never happen ASSERT( false, "Tutorial message in Intelligence screen!" ); continue; }*/ if (psMessage->type == MSG_PROXIMITY) { //ignore proximity messages here continue; } /* Set the tip and add the button */ switch (psMessage->type) { case MSG_RESEARCH: psResearch = getResearchForMsg((VIEWDATA *)psMessage->pViewData); if (psResearch) { sBFormInit.pTip = getStatName(psResearch);; } else { sBFormInit.pTip = _("Research Update"); } break; case MSG_CAMPAIGN: sBFormInit.pTip = _("Project Goals"); break; case MSG_MISSION: sBFormInit.pTip = _("Current Objective"); break; default: break; } BufferID = GetObjectBuffer(); ASSERT( BufferID >= 0,"Unable to acquire object buffer." ); RENDERBUTTON_INUSE(&ObjectBuffers[BufferID]); ObjectBuffers[BufferID].Data = (void*)psMessage; sBFormInit.pUserData = &ObjectBuffers[BufferID]; sBFormInit.pDisplay = intDisplayMessageButton; if (!widgAddForm(psWScreen, &sBFormInit)) { return false; } /* if the current message matches psSelected lock the button */ if (psMessage == psCurrentMsg) { messageID = sBFormInit.id; widgSetButtonState(psWScreen, messageID, WBUT_LOCK); widgSetTabs(psWScreen, IDINTMAP_MSGFORM, sBFormInit.majorID, 0); } /* Update the init struct for the next button */ sBFormInit.id += 1; // stop adding the buttons when at max if (sBFormInit.id > IDINTMAP_MSGEND) { break; } ASSERT( sBFormInit.id < (IDINTMAP_MSGEND+1),"Too many message buttons" ); sBFormInit.x += OBJ_BUTWIDTH + OBJ_GAP; if (sBFormInit.x + OBJ_BUTWIDTH + OBJ_GAP > INTMAP_MSGWIDTH) { sBFormInit.x = OBJ_STARTX; sBFormInit.y += OBJ_BUTHEIGHT + OBJ_GAP; } if (sBFormInit.y + OBJ_BUTHEIGHT + OBJ_GAP > INTMAP_MSGHEIGHT) { sBFormInit.y = OBJ_STATSTARTY; sBFormInit.majorID += 1; } } //check to play current message instantly if (playCurrent) { //is it a proximity message? if (psCurrentMsg->type == MSG_PROXIMITY) { //intIntelButtonPressed(true, messageID); } else { intIntelButtonPressed(false, messageID); } } return true; }