2007-01-15 12:09:25 -08:00
|
|
|
/*
|
|
|
|
This file is part of Warzone 2100.
|
|
|
|
Copyright (C) 1999-2004 Eidos Interactive
|
2009-02-10 10:01:48 -08:00
|
|
|
Copyright (C) 2005-2009 Warzone Resurrection Project
|
2007-01-15 12:09:25 -08:00
|
|
|
|
|
|
|
Warzone 2100 is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Warzone 2100 is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Warzone 2100; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2007-06-28 10:47:08 -07:00
|
|
|
/*
|
|
|
|
* IntelMap.c (Intelligence Map)
|
|
|
|
*
|
|
|
|
* Functions for the display of the Intelligence Map
|
|
|
|
*
|
|
|
|
*/
|
2006-11-06 06:40:07 -08:00
|
|
|
#include <string.h>
|
|
|
|
|
2006-05-27 09:37:17 -07:00
|
|
|
#include "lib/framework/frame.h"
|
2006-09-23 10:24:55 -07:00
|
|
|
#include "lib/framework/strres.h"
|
2006-05-27 09:37:17 -07:00
|
|
|
#include "lib/widget/widget.h"
|
2008-03-23 12:08:49 -07:00
|
|
|
#include "lib/widget/button.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
/* Includes direct access to render library */
|
2006-05-27 09:37:17 -07:00
|
|
|
#include "lib/ivis_common/piedef.h"
|
|
|
|
#include "lib/ivis_common/piestate.h"
|
|
|
|
#include "lib/ivis_common/rendmode.h"
|
2007-11-23 13:51:48 -08:00
|
|
|
#include "lib/ivis_common/piepalette.h"
|
2009-03-03 13:55:33 -08:00
|
|
|
#include "lib/ivis_opengl/screen.h"
|
|
|
|
#include "lib/ivis_common/piemode.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
#include "display3d.h"
|
2008-03-30 06:23:11 -07:00
|
|
|
#include "lib/framework/cursors.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
#include "map.h"
|
|
|
|
#include "intdisplay.h"
|
|
|
|
#include "objects.h"
|
|
|
|
#include "display.h"
|
|
|
|
#include "design.h"
|
|
|
|
#include "message.h"
|
|
|
|
#include "hci.h"
|
|
|
|
#include "intelmap.h"
|
|
|
|
#include "mapdisplay.h"
|
2006-05-27 09:37:17 -07:00
|
|
|
#include "lib/sound/audio.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
#include "console.h"
|
|
|
|
#include "research.h"
|
2006-05-27 09:37:17 -07:00
|
|
|
#include "lib/gamelib/gtime.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
#include "loop.h"
|
2006-05-27 09:37:17 -07:00
|
|
|
#include "lib/script/script.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
#include "scripttabs.h"
|
2008-04-09 13:48:50 -07:00
|
|
|
#include "warzoneconfig.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
#include "seqdisp.h"
|
2007-11-12 11:08:55 -08:00
|
|
|
#include "mission.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
#include "multiplay.h"
|
2006-05-27 09:37:17 -07:00
|
|
|
#include "lib/sound/cdaudio.h"
|
2008-10-08 11:24:19 -07:00
|
|
|
#include "lib/sequence/sequence.h"
|
2008-09-20 08:54:41 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
#include "scriptextern.h"
|
|
|
|
|
2008-10-08 11:24:19 -07:00
|
|
|
//#define NO_VIDEO
|
2006-04-20 11:49:51 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
/* Intelligence Map screen IDs */
|
|
|
|
#define IDINTMAP_MSGFORM 6001 //The intelligence map tabbed form
|
|
|
|
#define IDINTMAP_CLOSE 6004 //The close button icon for the 3D view
|
|
|
|
#define IDINTMAP_PAUSELABEL 6005 //The paused message
|
|
|
|
#define IDINITMAP_TITLEVIEW 6006 //The Title view part of MSGVIEW
|
|
|
|
#define IDINITMAP_PIEVIEW 6007 //The PIE view part of MSGVIEW
|
|
|
|
#define IDINTMAP_FLICVIEW 6008 //The Flic View part of MSGVIEW
|
|
|
|
#define IDINTMAP_TEXTVIEW 6009 //The Text area of MSGVIEW
|
|
|
|
#define IDINTMAP_TITLELABEL 6010 //The title text
|
2006-05-08 08:10:45 -07:00
|
|
|
#define IDINTMAP_SEQTEXT 6011 //Sequence subtitle text
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
#define IDINTMAP_MSGSTART 6100 //The first button on the intelligence form
|
|
|
|
#define IDINTMAP_MSGEND 6139 //The last button on the intelligence form (40 MAX)
|
|
|
|
|
2006-05-08 08:10:45 -07:00
|
|
|
#define IDINTMAP_SEQTEXTSTART 6200 //Sequence subtitle text tabs
|
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
/* Intelligence Map screen positions */
|
|
|
|
#define INTMAP_X OBJ_BACKX
|
|
|
|
#define INTMAP_Y OBJ_BACKY
|
|
|
|
#define INTMAP_WIDTH OBJ_BACKWIDTH
|
|
|
|
#define INTMAP_HEIGHT OBJ_BACKHEIGHT
|
|
|
|
|
|
|
|
#define INTMAP_LABELX RET_X
|
|
|
|
#define INTMAP_LABELY 10
|
|
|
|
#define INTMAP_LABELWIDTH 60
|
|
|
|
#define INTMAP_LABELHEIGHT 20
|
|
|
|
|
|
|
|
/*tabbed message form screen positions */
|
|
|
|
#define INTMAP_MSGX OBJ_TABX
|
|
|
|
#define INTMAP_MSGY OBJ_TABY
|
|
|
|
#define INTMAP_MSGWIDTH OBJ_WIDTH
|
|
|
|
#define INTMAP_MSGHEIGHT OBJ_HEIGHT
|
|
|
|
|
|
|
|
//define the 3D View sizes and positions that are required - relative to INTMAP_FORM
|
|
|
|
#define INTMAP_RESEARCHX (100 + D_W)
|
|
|
|
#define INTMAP_RESEARCHY (30 + D_H)
|
|
|
|
|
|
|
|
#define INTMAP_RESEARCHWIDTH 440
|
|
|
|
#define INTMAP_RESEARCHHEIGHT 288
|
|
|
|
|
|
|
|
/*dimensions for Title view section relative to IDINTMAP_MSGVIEW*/
|
|
|
|
/*dimensions for PIE view section relative to IDINTMAP_MSGVIEW*/
|
|
|
|
|
|
|
|
#define INTMAP_TITLEX 0
|
2006-05-27 09:37:17 -07:00
|
|
|
#define INTMAP_TITLEY 0
|
2007-06-28 10:47:08 -07:00
|
|
|
#define INTMAP_TITLEWIDTH INTMAP_RESEARCHWIDTH
|
|
|
|
#define INTMAP_TITLEHEIGHT 18
|
|
|
|
#define INTMAP_PIEX 3
|
2006-05-27 09:37:17 -07:00
|
|
|
#define INTMAP_PIEY 24
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/*dimensions for FLIC view section relative to IDINTMAP_MSGVIEW*/
|
|
|
|
#define INTMAP_FLICX 245
|
2006-05-27 09:37:17 -07:00
|
|
|
#define INTMAP_FLICY 24
|
2007-06-28 10:47:08 -07:00
|
|
|
#define INTMAP_FLICWIDTH 192
|
|
|
|
#define INTMAP_FLICHEIGHT 170
|
|
|
|
/*dimensions for TEXT view section relative to IDINTMAP_MSGVIEW*/
|
|
|
|
|
|
|
|
#define INTMAP_TEXTX 0
|
2006-05-27 09:37:17 -07:00
|
|
|
#define INTMAP_TEXTY 200
|
2007-06-28 10:47:08 -07:00
|
|
|
#define INTMAP_TEXTWIDTH INTMAP_RESEARCHWIDTH
|
|
|
|
#define INTMAP_TEXTHEIGHT 88
|
|
|
|
#define TEXT_XINDENT 5
|
|
|
|
#define TEXT_YINDENT 5
|
|
|
|
|
2006-05-08 08:10:45 -07:00
|
|
|
/*dimensions for SEQTEXT view relative to IDINTMAP_MSGVIEW*/
|
|
|
|
#define INTMAP_SEQTEXTX 0
|
|
|
|
#define INTMAP_SEQTEXTY 0
|
|
|
|
#define INTMAP_SEQTEXTWIDTH INTMAP_RESEARCHWIDTH
|
|
|
|
#define INTMAP_SEQTEXTHEIGHT INTMAP_RESEARCHHEIGHT
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2006-05-08 08:10:45 -07:00
|
|
|
/*dimensions for SEQTEXT tab view relative to IDINTMAP_SEQTEXT*/
|
|
|
|
#define INTMAP_SEQTEXTTABX 0
|
|
|
|
#define INTMAP_SEQTEXTTABY 0
|
|
|
|
#define INTMAP_SEQTEXTTABWIDTH INTMAP_SEQTEXTWIDTH
|
|
|
|
#define INTMAP_SEQTEXTTABHEIGHT INTMAP_SEQTEXTHEIGHT
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
//position for text on full screen video
|
|
|
|
#define VIDEO_TEXT_TOP_X 20
|
|
|
|
#define VIDEO_TEXT_TOP_Y 20
|
|
|
|
#define VIDEO_TEXT_BOTTOM_X 20
|
|
|
|
#define VIDEO_TEXT_BOTTOM_Y 444
|
|
|
|
|
|
|
|
#define TEXT_START_FRAME 0
|
|
|
|
#define TEXT_END_FRAME 9999
|
|
|
|
|
|
|
|
/* the widget screen */
|
|
|
|
extern W_SCREEN *psWScreen;
|
|
|
|
|
|
|
|
static UDWORD messageID;
|
2008-03-24 09:51:17 -07:00
|
|
|
static BOOL immediateMessage = false;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
//flags whether to open the Intel Screen with a message
|
|
|
|
static BOOL playCurrent;
|
|
|
|
|
|
|
|
/* functions declarations ****************/
|
|
|
|
static BOOL intAddMessageForm(BOOL playCurrent);
|
|
|
|
/*Displays the buttons used on the intelligence map */
|
2006-12-02 06:38:09 -08:00
|
|
|
static void intDisplayMessageButton(WIDGET *psWidget, UDWORD xOffset,
|
2007-12-09 08:09:23 -08:00
|
|
|
UDWORD yOffset, PIELIGHT *pColours);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2006-05-27 09:37:17 -07:00
|
|
|
/*deal with the actual button press - proxMsg is set to true if a proximity
|
2007-06-28 10:47:08 -07:00
|
|
|
button has been pressed*/
|
|
|
|
static void intIntelButtonPressed(BOOL proxMsg, UDWORD id);
|
|
|
|
|
2007-12-09 08:09:23 -08:00
|
|
|
static void intDisplayPIEView(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours);
|
2006-07-20 14:04:01 -07:00
|
|
|
#ifndef NO_VIDEO
|
2007-12-09 08:09:23 -08:00
|
|
|
static void intDisplayFLICView(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours);
|
2006-07-20 14:04:01 -07:00
|
|
|
#endif
|
2007-12-09 08:09:23 -08:00
|
|
|
static void intDisplayTEXTView(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours);
|
2007-06-28 10:47:08 -07:00
|
|
|
static void addVideoText(SEQ_DISPLAY *psSeqDisplay, UDWORD sequence);
|
|
|
|
|
2006-12-02 06:38:09 -08:00
|
|
|
static void intDisplaySeqTextView(WIDGET *psWidget,
|
2006-05-08 08:10:45 -07:00
|
|
|
UDWORD xOffset, UDWORD yOffset,
|
2007-12-09 08:09:23 -08:00
|
|
|
PIELIGHT *pColours);
|
2006-05-08 08:10:45 -07:00
|
|
|
static BOOL intDisplaySeqTextViewPage(VIEW_REPLAY *psViewReplay,
|
|
|
|
UDWORD x0, UDWORD y0,
|
|
|
|
UDWORD width, UDWORD height,
|
|
|
|
BOOL render,
|
|
|
|
size_t *major, size_t *minor);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
/*********************** VARIABLES ****************************/
|
|
|
|
// The current message being displayed
|
|
|
|
MESSAGE *psCurrentMsg = NULL;
|
|
|
|
|
|
|
|
// The display stats for the current messages' text
|
|
|
|
TEXT_DISPLAY currentTextDisplay;
|
|
|
|
|
|
|
|
#define PAUSE_DISPLAY_CONDITION (!bMultiPlayer)
|
|
|
|
#define PAUSEMESSAGE_YOFFSET (0)
|
|
|
|
|
|
|
|
|
|
|
|
/* Add the Intelligence Map widgets to the widget screen */
|
2006-11-26 03:58:01 -08:00
|
|
|
BOOL intAddIntelMap(void)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
W_FORMINIT sFormInit;
|
|
|
|
W_LABINIT sLabInit;
|
2008-03-24 09:51:17 -07:00
|
|
|
BOOL Animate = true;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
//check playCurrent with psCurrentMsg
|
|
|
|
if (psCurrentMsg == NULL)
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
playCurrent = false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
playCurrent = true;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Is the form already up?
|
2006-05-27 09:37:17 -07:00
|
|
|
if(widgGetFromID(psWScreen,IDINTMAP_FORM) != NULL)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
intRemoveIntelMapNoAnim();
|
2008-03-24 09:51:17 -07:00
|
|
|
Animate = false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
audio_StopAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
cdAudio_Pause();
|
|
|
|
|
|
|
|
//add message to indicate game is paused - single player mode
|
|
|
|
if(PAUSE_DISPLAY_CONDITION)
|
|
|
|
{
|
2006-05-27 09:37:17 -07:00
|
|
|
if(widgGetFromID(psWScreen,IDINTMAP_PAUSELABEL) == NULL)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
memset(&sLabInit,0,sizeof(W_LABINIT));
|
|
|
|
sLabInit.id = IDINTMAP_PAUSELABEL;
|
|
|
|
sLabInit.formID = 0;
|
|
|
|
sLabInit.style = WLAB_PLAIN;
|
|
|
|
sLabInit.x = INTMAP_LABELX;
|
|
|
|
sLabInit.y = INTMAP_LABELY+PAUSEMESSAGE_YOFFSET;
|
|
|
|
sLabInit.width = INTMAP_LABELWIDTH;
|
|
|
|
sLabInit.height = INTMAP_LABELHEIGHT;
|
2007-04-01 13:15:46 -07:00
|
|
|
sLabInit.pText = _("PAUSED");
|
2007-10-01 12:45:49 -07:00
|
|
|
sLabInit.FontID = font_regular;
|
2007-06-28 10:47:08 -07:00
|
|
|
if (!widgAddLabel(psWScreen, &sLabInit))
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//set pause states before putting the interface up
|
|
|
|
setIntelligencePauseState();
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
|
|
|
|
2006-05-27 09:37:17 -07:00
|
|
|
// Add the main Intelligence Map form
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
sFormInit.formID = 0;
|
|
|
|
sFormInit.id = IDINTMAP_FORM;
|
|
|
|
sFormInit.style = WFORM_PLAIN;
|
|
|
|
sFormInit.x = (SWORD)INTMAP_X;
|
|
|
|
sFormInit.y = (SWORD)INTMAP_Y;
|
|
|
|
sFormInit.width = INTMAP_WIDTH;
|
|
|
|
sFormInit.height = INTMAP_HEIGHT;
|
2007-08-03 10:39:04 -07:00
|
|
|
|
|
|
|
// If the window was closed then do open animation.
|
2006-05-27 09:37:17 -07:00
|
|
|
if(Animate)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
sFormInit.pDisplay = intOpenPlainForm;
|
2008-03-24 09:51:17 -07:00
|
|
|
sFormInit.disableChildren = true;
|
2006-05-27 09:37:17 -07:00
|
|
|
}
|
|
|
|
else
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2007-08-03 10:39:04 -07:00
|
|
|
// otherwise just recreate it.
|
2007-06-28 10:47:08 -07:00
|
|
|
sFormInit.pDisplay = intDisplayPlainForm;
|
|
|
|
}
|
|
|
|
|
|
|
|
//sFormInit.pDisplay = intDisplayPlainForm;
|
|
|
|
if (!widgAddForm(psWScreen, &sFormInit))
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!intAddMessageForm(playCurrent))
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
2008-03-24 09:51:17 -07:00
|
|
|
return true;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Add the Message sub form */
|
|
|
|
static BOOL intAddMessageForm(BOOL playCurrent)
|
|
|
|
{
|
|
|
|
W_FORMINIT sFormInit;
|
|
|
|
W_FORMINIT sBFormInit;
|
|
|
|
UDWORD numButtons, i;
|
|
|
|
MESSAGE *psMessage;
|
|
|
|
RESEARCH *psResearch;
|
|
|
|
SDWORD BufferID;
|
|
|
|
|
|
|
|
/* Add the Message form */
|
|
|
|
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
|
|
|
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;
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
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 */
|
2006-05-27 09:37:17 -07:00
|
|
|
for(psMessage = apsMessages[selectedPlayer]; psMessage; psMessage =
|
2007-06-28 10:47:08 -07:00
|
|
|
psMessage->psNext)
|
|
|
|
{
|
|
|
|
//ignore proximity messages here
|
2007-08-03 10:39:04 -07:00
|
|
|
if (psMessage->type != MSG_PROXIMITY)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
numButtons++;
|
|
|
|
}
|
|
|
|
|
2007-08-03 10:39:04 -07:00
|
|
|
// stop adding the buttons once max has been reached
|
2007-06-28 10:47:08 -07:00
|
|
|
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);
|
|
|
|
|
2008-01-22 12:11:10 -08:00
|
|
|
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;
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
//set minor tabs to 1
|
|
|
|
for (i=0; i< sFormInit.numMajor; i++)
|
|
|
|
{
|
|
|
|
sFormInit.aNumMinors[i] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!widgAddForm(psWScreen, &sFormInit))
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Add the message buttons */
|
|
|
|
memset(&sBFormInit, 0, sizeof(W_FORMINIT));
|
|
|
|
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;
|
2006-05-27 09:37:17 -07:00
|
|
|
for(psMessage = apsMessages[selectedPlayer]; psMessage; psMessage =
|
2007-06-28 10:47:08 -07:00
|
|
|
psMessage->psNext)
|
|
|
|
{
|
|
|
|
/*if (psMessage->type == MSG_TUTORIAL)
|
|
|
|
{
|
|
|
|
//tutorial cases should never happen
|
2008-03-24 09:51:17 -07:00
|
|
|
ASSERT( false, "Tutorial message in Intelligence screen!" );
|
2007-06-28 10:47:08 -07:00
|
|
|
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
|
|
|
|
{
|
2007-04-01 13:15:46 -07:00
|
|
|
sBFormInit.pTip = _("Research Update");
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MSG_CAMPAIGN:
|
2007-04-01 13:15:46 -07:00
|
|
|
sBFormInit.pTip = _("Project Goals");
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
case MSG_MISSION:
|
2007-04-01 13:15:46 -07:00
|
|
|
sBFormInit.pTip = _("Current Objective");
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
BufferID = GetObjectBuffer();
|
2006-08-23 05:58:48 -07:00
|
|
|
ASSERT( BufferID >= 0,"Unable to acquire object buffer." );
|
2007-06-28 10:47:08 -07:00
|
|
|
RENDERBUTTON_INUSE(&ObjectBuffers[BufferID]);
|
|
|
|
ObjectBuffers[BufferID].Data = (void*)psMessage;
|
2007-11-09 13:01:23 -08:00
|
|
|
sBFormInit.pUserData = &ObjectBuffers[BufferID];
|
2007-06-28 10:47:08 -07:00
|
|
|
sBFormInit.pDisplay = intDisplayMessageButton;
|
|
|
|
|
|
|
|
if (!widgAddForm(psWScreen, &sBFormInit))
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 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;
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-08-03 10:39:04 -07:00
|
|
|
// stop adding the buttons when at max
|
2007-06-28 10:47:08 -07:00
|
|
|
if (sBFormInit.id > IDINTMAP_MSGEND)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-08-23 05:58:48 -07:00
|
|
|
ASSERT( sBFormInit.id < (IDINTMAP_MSGEND+1),"Too many message buttons" );
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
//intIntelButtonPressed(true, messageID);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
intIntelButtonPressed(false, messageID);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
2008-03-24 09:51:17 -07:00
|
|
|
return true;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*Add the 3D world view for the particular message (only research nmessages now) */
|
|
|
|
BOOL intAddMessageView(MESSAGE * psMessage)
|
|
|
|
{
|
|
|
|
W_FORMINIT sFormInit;
|
|
|
|
W_BUTINIT sButInit;
|
|
|
|
W_LABINIT sLabInit;
|
2008-03-24 09:51:17 -07:00
|
|
|
BOOL Animate = true;
|
2007-06-28 10:47:08 -07:00
|
|
|
RESEARCH *psResearch;
|
|
|
|
|
|
|
|
// Is the form already up?
|
2006-05-27 09:37:17 -07:00
|
|
|
if(widgGetFromID(psWScreen,IDINTMAP_MSGVIEW) != NULL)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
intRemoveMessageView(false);
|
|
|
|
Animate = false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Add the base form */
|
|
|
|
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
|
|
|
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.
|
2006-05-27 09:37:17 -07:00
|
|
|
if(Animate)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
sFormInit.pDisplay = intOpenPlainForm;
|
2008-03-24 09:51:17 -07:00
|
|
|
sFormInit.disableChildren = true;
|
2006-05-27 09:37:17 -07:00
|
|
|
}
|
|
|
|
else
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
// otherwise just display it.
|
|
|
|
sFormInit.pDisplay = intDisplayPlainForm;
|
|
|
|
}
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
if (!widgAddForm(psWScreen, &sFormInit))
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Add the close box */
|
|
|
|
memset(&sButInit, 0, sizeof(W_BUTINIT));
|
|
|
|
sButInit.formID = IDINTMAP_MSGVIEW;
|
|
|
|
sButInit.id = IDINTMAP_CLOSE;
|
|
|
|
sButInit.style = WBUT_PLAIN;
|
|
|
|
sButInit.x = (SWORD)(sFormInit.width - OPT_GAP - CLOSE_SIZE);
|
|
|
|
sButInit.y = OPT_GAP;
|
|
|
|
sButInit.width = CLOSE_SIZE;
|
|
|
|
sButInit.height = CLOSE_SIZE;
|
2007-04-01 13:15:46 -07:00
|
|
|
sButInit.pTip = _("Close");
|
2007-06-28 10:47:08 -07:00
|
|
|
sButInit.pDisplay = intDisplayImageHilight;
|
2007-11-09 13:01:23 -08:00
|
|
|
sButInit.UserData = PACKDWORD_TRI(0,IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
|
2007-06-28 10:47:08 -07:00
|
|
|
if (!widgAddButton(psWScreen, &sButInit))
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
2006-05-08 08:10:45 -07:00
|
|
|
if (psMessage->type != MSG_RESEARCH &&
|
|
|
|
((VIEWDATA*)psMessage->pViewData)->type == VIEW_RPL)
|
|
|
|
{
|
|
|
|
W_FORMINIT sTabForm;
|
|
|
|
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 */
|
|
|
|
memset(&sFormInit, 0, sizeof(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,
|
2008-03-24 09:51:17 -07:00
|
|
|
false, &cur_seq, &cur_seqpage));
|
2006-05-08 08:10:45 -07:00
|
|
|
|
2007-11-09 13:01:23 -08:00
|
|
|
sFormInit.pUserData = &StandardTab;
|
2006-05-08 08:10:45 -07:00
|
|
|
sFormInit.pTabDisplay = intDisplayTab;
|
|
|
|
|
|
|
|
if (!widgAddForm(psWScreen, &sFormInit))
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2006-05-08 08:10:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
memset(&sTabForm, 0, sizeof(W_FORMINIT));
|
|
|
|
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))
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2006-05-08 08:10:45 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-24 09:51:17 -07:00
|
|
|
return true;
|
2006-05-08 08:10:45 -07:00
|
|
|
}
|
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
/*add the Label for the title box*/
|
|
|
|
memset(&sLabInit,0,sizeof(W_LABINIT));
|
|
|
|
sLabInit.id = IDINTMAP_TITLELABEL;
|
|
|
|
sLabInit.formID = IDINTMAP_MSGVIEW;
|
|
|
|
sLabInit.style = WLAB_PLAIN;
|
|
|
|
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
|
|
|
|
|
2006-08-23 05:58:48 -07:00
|
|
|
ASSERT( psMessage->type != MSG_PROXIMITY,
|
|
|
|
"intAddMessageView:Invalid message type for research" );
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
psResearch = getResearchForMsg((VIEWDATA *)psMessage->pViewData);
|
|
|
|
|
2006-08-23 05:58:48 -07:00
|
|
|
ASSERT( psResearch!=NULL,"Research not found" );
|
2007-06-28 10:47:08 -07:00
|
|
|
//sLabInit.pText=psResearch->pName;
|
|
|
|
sLabInit.pText = getStatName(psResearch);
|
|
|
|
|
2007-10-01 12:45:49 -07:00
|
|
|
sLabInit.FontID = font_regular;
|
2007-06-28 10:47:08 -07:00
|
|
|
if (!widgAddLabel(psWScreen, &sLabInit))
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*Add the PIE box*/
|
|
|
|
|
|
|
|
memset(&sFormInit, 0, sizeof(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;
|
2007-11-09 13:01:23 -08:00
|
|
|
sFormInit.pUserData = psMessage;
|
2007-06-28 10:47:08 -07:00
|
|
|
if (!widgAddForm(psWScreen, &sFormInit))
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
2006-05-08 08:10:45 -07:00
|
|
|
#ifndef NO_VIDEO
|
2007-06-28 10:47:08 -07:00
|
|
|
/*Add the Flic box */
|
|
|
|
memset(&sFormInit, 0, sizeof(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;
|
2007-11-09 13:01:23 -08:00
|
|
|
sFormInit.pUserData = psMessage;
|
2007-06-28 10:47:08 -07:00
|
|
|
if (!widgAddForm(psWScreen, &sFormInit))
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2006-05-08 08:10:45 -07:00
|
|
|
#endif
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/*Add the text box*/
|
|
|
|
memset(&sFormInit, 0, sizeof(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;
|
2007-11-09 13:01:23 -08:00
|
|
|
sFormInit.pUserData = psMessage;
|
2007-06-28 10:47:08 -07:00
|
|
|
if (!widgAddForm(psWScreen, &sFormInit))
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
2008-03-24 09:51:17 -07:00
|
|
|
return true;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Process return codes from the Intelligence Map */
|
|
|
|
void intProcessIntelMap(UDWORD id)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (id >= IDINTMAP_MSGSTART && id <= IDINTMAP_MSGEND)
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
intIntelButtonPressed(false, id);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else if (id == IDINTMAP_CLOSE)
|
|
|
|
{
|
|
|
|
//if close button pressed on 3D View then close the view only
|
|
|
|
psCurrentMsg = NULL;
|
2008-03-24 09:51:17 -07:00
|
|
|
intRemoveMessageView(true);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-07 11:19:15 -08:00
|
|
|
/**
|
|
|
|
* Draws the text for the intelligence display window.
|
|
|
|
*/
|
2006-05-08 08:10:45 -07:00
|
|
|
static BOOL intDisplaySeqTextViewPage(VIEW_REPLAY *psViewReplay,
|
|
|
|
UDWORD x0, UDWORD y0,
|
|
|
|
UDWORD width, UDWORD height,
|
|
|
|
BOOL render,
|
|
|
|
size_t *cur_seq, size_t *cur_seqpage)
|
|
|
|
{
|
2008-02-07 11:19:15 -08:00
|
|
|
UDWORD i, cur_y;
|
2006-05-08 08:10:45 -07:00
|
|
|
UDWORD sequence;
|
|
|
|
|
|
|
|
if (!psViewReplay)
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
return true; /* nothing to do */
|
2006-05-08 08:10:45 -07:00
|
|
|
}
|
|
|
|
|
2007-10-01 12:45:49 -07:00
|
|
|
iV_SetFont(font_regular);
|
2006-05-08 08:10:45 -07:00
|
|
|
|
2007-12-09 08:09:23 -08:00
|
|
|
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
|
2006-05-08 08:10:45 -07:00
|
|
|
|
2008-02-07 11:19:15 -08:00
|
|
|
cur_y = y0 + iV_GetTextLineSize()/2 + 2*TEXT_YINDENT;
|
2006-05-08 08:10:45 -07:00
|
|
|
|
|
|
|
/* add each message */
|
|
|
|
for (sequence = *cur_seq, i = *cur_seqpage; sequence < psViewReplay->numSeq; sequence++)
|
|
|
|
{
|
|
|
|
SEQ_DISPLAY *psSeqDisplay = &psViewReplay->pSeqList[sequence];
|
|
|
|
for (; i < psSeqDisplay->numText; i++)
|
|
|
|
{
|
|
|
|
if (render)
|
|
|
|
{
|
2008-02-07 11:19:15 -08:00
|
|
|
cur_y = iV_DrawFormattedText(psSeqDisplay->ppTextMsg[i],
|
2006-05-08 08:10:45 -07:00
|
|
|
x0 + TEXT_XINDENT,
|
2008-03-24 09:51:17 -07:00
|
|
|
cur_y, width, false);
|
2008-02-07 11:19:15 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cur_y += iV_GetTextLineSize();
|
2006-05-08 08:10:45 -07:00
|
|
|
}
|
2008-02-22 12:34:03 -08:00
|
|
|
if (cur_y > y0 + height)
|
2006-05-08 08:10:45 -07:00
|
|
|
{
|
|
|
|
/* run out of room - need to make new tab */
|
|
|
|
*cur_seq = sequence;
|
|
|
|
*cur_seqpage = i;
|
2008-03-24 09:51:17 -07:00
|
|
|
return false;
|
2006-05-08 08:10:45 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
|
2008-03-24 09:51:17 -07:00
|
|
|
return true; /* done */
|
2006-05-08 08:10:45 -07:00
|
|
|
}
|
|
|
|
|
2008-02-07 11:19:15 -08:00
|
|
|
/**
|
|
|
|
* Draw the text window for the intelligence display
|
|
|
|
*/
|
2006-12-02 06:38:09 -08:00
|
|
|
static void intDisplaySeqTextView(WIDGET *psWidget,
|
2006-05-08 08:10:45 -07:00
|
|
|
UDWORD xOffset, UDWORD yOffset,
|
2008-04-20 10:17:50 -07:00
|
|
|
WZ_DECL_UNUSED PIELIGHT *pColours)
|
2006-05-08 08:10:45 -07:00
|
|
|
{
|
|
|
|
W_TABFORM *Form = (W_TABFORM*)psWidget;
|
|
|
|
VIEW_REPLAY *psViewReplay = (VIEW_REPLAY*)Form->pUserData;
|
|
|
|
size_t cur_seq, cur_seqpage;
|
|
|
|
UDWORD x0, y0, page;
|
|
|
|
|
|
|
|
x0 = xOffset + Form->x;
|
|
|
|
y0 = yOffset + Form->y;
|
|
|
|
|
2008-01-21 08:57:00 -08:00
|
|
|
RenderWindowFrame(FRAME_NORMAL, x0, y0, Form->width, Form->height);
|
2006-05-08 08:10:45 -07:00
|
|
|
|
|
|
|
/* work out where we're up to in the text */
|
|
|
|
cur_seq = cur_seqpage = 0;
|
2007-04-07 06:23:14 -07:00
|
|
|
if(Form->style & WFORM_TABBED)
|
2006-05-08 08:10:45 -07:00
|
|
|
{
|
2007-04-07 06:23:14 -07:00
|
|
|
// Gerard 2007-04-07: dead code?
|
2007-08-16 02:49:44 -07:00
|
|
|
ASSERT(!"the form is tabbed", "intDisplaySeqTextView: the form is tabbed");
|
2007-04-07 06:23:14 -07:00
|
|
|
for (page = 0; page < Form->majorT; page++)
|
|
|
|
{
|
|
|
|
intDisplaySeqTextViewPage(psViewReplay, x0, y0,
|
|
|
|
Form->width, Form->height,
|
2008-03-24 09:51:17 -07:00
|
|
|
false, &cur_seq, &cur_seqpage);
|
2007-04-07 06:23:14 -07:00
|
|
|
}
|
2006-05-08 08:10:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
intDisplaySeqTextViewPage(psViewReplay, x0, y0,
|
2008-02-07 11:19:15 -08:00
|
|
|
Form->width-40, Form->height,
|
2008-03-24 09:51:17 -07:00
|
|
|
true, &cur_seq, &cur_seqpage);
|
2006-05-08 08:10:45 -07:00
|
|
|
}
|
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2006-11-26 03:20:44 -08:00
|
|
|
// Add all the Video Sequences for a message
|
2006-11-26 03:58:01 -08:00
|
|
|
static void StartMessageSequences(MESSAGE *psMessage, BOOL Start)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
BOOL bLoop = false;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2007-08-03 10:39:04 -07:00
|
|
|
debug(LOG_GUI, "StartMessageSequences: start message sequence");
|
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
//should never have a proximity message here
|
|
|
|
if (psMessage->type == MSG_PROXIMITY)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-04-03 06:20:41 -07:00
|
|
|
ASSERT( psMessage->pViewData != NULL,
|
2006-08-23 05:58:48 -07:00
|
|
|
"StartMessageSequences: invalid ViewData pointer" );
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
if (((VIEWDATA *)psMessage->pViewData)->type == VIEW_RPL)
|
|
|
|
{
|
|
|
|
VIEW_REPLAY *psViewReplay;
|
|
|
|
UDWORD Sequence;
|
|
|
|
|
|
|
|
// Surely we don't need to set up psCurrentMsg when we pass the message into this routine ... tim
|
|
|
|
psViewReplay = (VIEW_REPLAY *)((VIEWDATA *)psMessage->pViewData)->pData;
|
|
|
|
|
|
|
|
seq_ClearSeqList();
|
|
|
|
|
|
|
|
//add any sequences to the list to be played when the first one is finished
|
|
|
|
for (Sequence = 0; Sequence < psViewReplay->numSeq; Sequence++)
|
|
|
|
|
|
|
|
{
|
|
|
|
if (psViewReplay->pSeqList[Sequence].flag == 1)
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
bLoop = true;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
bLoop = false;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-26 03:20:44 -08:00
|
|
|
seq_AddSeqToList(psViewReplay->pSeqList[Sequence].sequenceName, psViewReplay->pSeqList[Sequence].pAudio, NULL, bLoop);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2007-08-03 10:39:04 -07:00
|
|
|
debug(LOG_GUI, "StartMessageSequences: sequence=%d", Sequence);
|
2007-06-28 10:47:08 -07:00
|
|
|
addVideoText(&psViewReplay->pSeqList[Sequence],Sequence);
|
|
|
|
}
|
|
|
|
//play first full screen video
|
2008-03-24 09:51:17 -07:00
|
|
|
if (Start==true)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
seq_StartNextFullScreenVideo();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (((VIEWDATA *)psMessage->pViewData)->type == VIEW_RES)
|
|
|
|
{
|
|
|
|
VIEW_RESEARCH *psViewReplay;
|
|
|
|
//UDWORD Sequence;
|
|
|
|
|
|
|
|
psViewReplay = (VIEW_RESEARCH *)((VIEWDATA *)psCurrentMsg->pViewData)->pData;
|
|
|
|
|
|
|
|
seq_ClearSeqList();
|
2008-03-24 09:51:17 -07:00
|
|
|
seq_AddSeqToList(psViewReplay->sequenceName, psViewReplay->pAudio, NULL, false);
|
2007-06-28 10:47:08 -07:00
|
|
|
//play first full screen video
|
2008-03-24 09:51:17 -07:00
|
|
|
if (Start==true)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
seq_StartNextFullScreenVideo();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-05-27 09:37:17 -07:00
|
|
|
/*
|
|
|
|
deal with the actual button press - proxMsg is set to true if a proximity
|
2007-06-28 10:47:08 -07:00
|
|
|
button has been pressed
|
|
|
|
*/
|
2006-11-26 03:58:01 -08:00
|
|
|
void intIntelButtonPressed(BOOL proxMsg, UDWORD id)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
MESSAGE *psMessage;
|
|
|
|
UDWORD currID;//, i;
|
|
|
|
RESEARCH *psResearch;
|
|
|
|
|
2008-03-24 09:51:17 -07:00
|
|
|
ASSERT( proxMsg != true,
|
2006-08-23 05:58:48 -07:00
|
|
|
"intIntelButtonPressed: Shouldn't be able to get a proximity message!" );
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2007-04-04 04:17:48 -07:00
|
|
|
if(id == 0)
|
|
|
|
{
|
|
|
|
intRemoveIntelMap();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
/* message button has been pressed - clear the old button and messageView*/
|
|
|
|
if (messageID != 0)
|
|
|
|
{
|
|
|
|
widgSetButtonState(psWScreen, messageID, 0);
|
2008-03-24 09:51:17 -07:00
|
|
|
intRemoveMessageView(false);
|
2007-06-28 10:47:08 -07:00
|
|
|
psCurrentMsg = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Lock the new button */
|
|
|
|
// This means we can't click on the same movie button twice.
|
|
|
|
widgSetButtonState(psWScreen, id, WBUT_CLICKLOCK);
|
|
|
|
messageID = id;
|
|
|
|
|
|
|
|
//Find the message for the new button */
|
|
|
|
currID = IDINTMAP_MSGSTART;
|
2006-05-27 09:37:17 -07:00
|
|
|
for(psMessage = apsMessages[selectedPlayer]; psMessage; psMessage =
|
2007-06-28 10:47:08 -07:00
|
|
|
psMessage->psNext)
|
|
|
|
{
|
|
|
|
if (psMessage->type != MSG_PROXIMITY)
|
|
|
|
{
|
|
|
|
if (currID == id)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
currID++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//deal with the message if one
|
|
|
|
if (psMessage)
|
|
|
|
{
|
|
|
|
//set the current message
|
|
|
|
psCurrentMsg = psMessage;
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
//set the read flag
|
2008-03-24 09:51:17 -07:00
|
|
|
psCurrentMsg->read = true;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2007-08-16 02:49:44 -07:00
|
|
|
debug(LOG_GUI, "intIntelButtonPressed: Dealing with a new message type=%d",
|
2007-08-03 10:39:04 -07:00
|
|
|
psMessage->type);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
//should never have a proximity message
|
|
|
|
if (psMessage->type == MSG_PROXIMITY)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// If its a video sequence then play it anyway
|
|
|
|
if (((VIEWDATA *)psMessage->pViewData)->type == VIEW_RPL)
|
|
|
|
{
|
|
|
|
|
2006-05-08 08:10:45 -07:00
|
|
|
if (psMessage->pViewData)
|
|
|
|
{
|
|
|
|
intAddMessageView(psMessage);
|
|
|
|
}
|
|
|
|
|
2008-03-24 09:51:17 -07:00
|
|
|
StartMessageSequences(psMessage,true);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
else if (((VIEWDATA *)psMessage->pViewData)->type == VIEW_RES)
|
|
|
|
{
|
|
|
|
psResearch = getResearchForMsg((VIEWDATA *)psMessage->pViewData);
|
|
|
|
if (psResearch != NULL)
|
|
|
|
{
|
2007-12-31 07:16:59 -08:00
|
|
|
static const float maxVolume = 1.f;
|
|
|
|
|
2007-06-28 10:47:08 -07:00
|
|
|
switch(psResearch->iconID)
|
|
|
|
{
|
|
|
|
case IMAGE_RES_DROIDTECH:
|
2007-12-31 07:16:59 -08:00
|
|
|
audio_PlayStream("sequenceaudio/res_droid.ogg", maxVolume, NULL, NULL);
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
case IMAGE_RES_WEAPONTECH:
|
2007-12-31 07:16:59 -08:00
|
|
|
audio_PlayStream("sequenceaudio/res_weapons.ogg", maxVolume, NULL, NULL);
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
case IMAGE_RES_COMPUTERTECH:
|
2007-12-31 07:16:59 -08:00
|
|
|
audio_PlayStream("sequenceaudio/res_com.ogg", maxVolume, NULL, NULL);
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
case IMAGE_RES_POWERTECH:
|
2007-12-31 07:16:59 -08:00
|
|
|
audio_PlayStream("sequenceaudio/res_pow.ogg", maxVolume, NULL, NULL);
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
case IMAGE_RES_SYSTEMTECH:
|
2007-12-31 07:16:59 -08:00
|
|
|
audio_PlayStream("sequenceaudio/res_systech.ogg", maxVolume, NULL, NULL);
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
case IMAGE_RES_STRUCTURETECH:
|
2007-12-31 07:16:59 -08:00
|
|
|
audio_PlayStream("sequenceaudio/res_strutech.ogg", maxVolume, NULL, NULL);
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
case IMAGE_RES_CYBORGTECH:
|
2007-12-31 07:16:59 -08:00
|
|
|
audio_PlayStream("sequenceaudio/res_droid.ogg", maxVolume, NULL, NULL);
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
case IMAGE_RES_DEFENCE:
|
2007-12-31 07:16:59 -08:00
|
|
|
audio_PlayStream("sequenceaudio/res_strutech.ogg", maxVolume, NULL, NULL);
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//and finally for the dumb?
|
|
|
|
if (psMessage->pViewData)
|
|
|
|
{
|
|
|
|
intAddMessageView(psMessage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-26 03:58:01 -08:00
|
|
|
static void intCleanUpIntelMap(void)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
MESSAGE *psMessage, *psNext;
|
|
|
|
|
|
|
|
//remove any research messages that have been read
|
2006-05-27 09:37:17 -07:00
|
|
|
for (psMessage = apsMessages[selectedPlayer]; psMessage != NULL; psMessage =
|
2007-06-28 10:47:08 -07:00
|
|
|
psNext)
|
|
|
|
{
|
|
|
|
psNext = psMessage->psNext;
|
2007-02-10 08:39:39 -08:00
|
|
|
if (psMessage->type == MSG_RESEARCH && psMessage->read)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
removeMessage(psMessage, selectedPlayer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resetIntelligencePauseState();
|
2008-03-24 09:51:17 -07:00
|
|
|
immediateMessage = false;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
cdAudio_Resume();
|
|
|
|
|
2006-09-06 09:58:20 -07:00
|
|
|
if (interpProcessorActive())
|
|
|
|
{
|
|
|
|
debug(LOG_SCRIPT, "intCleanUpIntelMap: interpreter running, storing CALL_VIDEO_QUIT");
|
2006-11-01 05:56:23 -08:00
|
|
|
if(!msgStackPush(CALL_VIDEO_QUIT,-1,-1,"\0",-1,-1,NULL))
|
2006-09-06 09:58:20 -07:00
|
|
|
{
|
|
|
|
debug(LOG_ERROR, "intCleanUpIntelMap() - msgStackPush - stack failed");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
debug(LOG_SCRIPT, "intCleanUpIntelMap: not running");
|
|
|
|
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_VIDEO_QUIT);
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Remove the Intelligence Map widgets from the screen */
|
|
|
|
void intRemoveIntelMap(void)
|
|
|
|
{
|
|
|
|
WIDGET *Widg;
|
|
|
|
W_TABFORM *Form;
|
|
|
|
|
|
|
|
//remove 3dView if still there
|
|
|
|
Widg = widgGetFromID(psWScreen,IDINTMAP_MSGVIEW);
|
2006-05-27 09:37:17 -07:00
|
|
|
if(Widg)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
intRemoveMessageView(false);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Start the window close animation.
|
|
|
|
Form = (W_TABFORM*)widgGetFromID(psWScreen,IDINTMAP_FORM);
|
2007-04-04 04:17:48 -07:00
|
|
|
if(Form)
|
|
|
|
{
|
|
|
|
Form->display = intClosePlainForm;
|
2008-03-24 09:51:17 -07:00
|
|
|
Form->disableChildren = true;
|
2007-11-09 12:07:12 -08:00
|
|
|
Form->pUserData = NULL; // Used to signal when the close anim has finished.
|
2007-04-04 04:17:48 -07:00
|
|
|
}
|
2008-03-24 09:51:17 -07:00
|
|
|
ClosingIntelMap = true;
|
2007-06-28 10:47:08 -07:00
|
|
|
//remove the text label
|
|
|
|
widgDelete(psWScreen, IDINTMAP_PAUSELABEL);
|
|
|
|
|
|
|
|
intCleanUpIntelMap();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Remove the Intelligence Map widgets from the screen */
|
|
|
|
void intRemoveIntelMapNoAnim(void)
|
|
|
|
{
|
|
|
|
WIDGET *Widg;
|
|
|
|
|
|
|
|
//remove 3dView if still there
|
|
|
|
Widg = widgGetFromID(psWScreen,IDINTMAP_MSGVIEW);
|
2006-05-27 09:37:17 -07:00
|
|
|
if(Widg)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
intRemoveMessageView(false);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
//remove main Intelligence screen
|
|
|
|
widgDelete(psWScreen, IDINTMAP_FORM);
|
|
|
|
//remove the text label
|
|
|
|
widgDelete(psWScreen, IDINTMAP_PAUSELABEL);
|
|
|
|
|
|
|
|
intCleanUpIntelMap();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Remove the Message View from the Intelligence screen */
|
|
|
|
void intRemoveMessageView(BOOL animated)
|
|
|
|
{
|
|
|
|
W_TABFORM *Form;
|
|
|
|
VIEW_RESEARCH *psViewResearch;
|
|
|
|
|
|
|
|
//remove 3dView if still there
|
|
|
|
Form = (W_TABFORM*)widgGetFromID(psWScreen,IDINTMAP_MSGVIEW);
|
2006-05-27 09:37:17 -07:00
|
|
|
if(Form)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
|
|
|
|
//stop the video
|
|
|
|
psViewResearch = (VIEW_RESEARCH *)Form->pUserData;
|
2008-10-08 11:24:19 -07:00
|
|
|
seq_RenderVideoToBuffer(psViewResearch->sequenceName, SEQUENCE_KILL);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
if (animated)
|
|
|
|
{
|
|
|
|
|
|
|
|
widgDelete(psWScreen, IDINTMAP_CLOSE);
|
|
|
|
|
|
|
|
|
|
|
|
// Start the window close animation.
|
|
|
|
Form->display = intClosePlainForm;
|
2008-03-24 09:51:17 -07:00
|
|
|
Form->disableChildren = true;
|
2007-11-09 12:07:12 -08:00
|
|
|
Form->pUserData = NULL; // Used to signal when the close anim has finished.
|
2008-03-24 09:51:17 -07:00
|
|
|
ClosingMessageView = true;
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//remove without the animating close window
|
|
|
|
widgDelete(psWScreen, IDINTMAP_MSGVIEW);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*Displays the buttons used on the intelligence map */
|
2006-12-02 06:38:09 -08:00
|
|
|
void intDisplayMessageButton(WIDGET *psWidget, UDWORD xOffset,
|
2008-04-20 10:17:50 -07:00
|
|
|
UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
W_CLICKFORM *psButton = (W_CLICKFORM*)psWidget;
|
|
|
|
RENDERED_BUTTON *psBuffer = (RENDERED_BUTTON*)psButton->pUserData;
|
|
|
|
MESSAGE *psMsg;
|
2008-03-24 09:51:17 -07:00
|
|
|
BOOL Hilight = false;
|
2007-06-28 10:47:08 -07:00
|
|
|
UDWORD Down = 0, IMDType = 0, compID;
|
|
|
|
SDWORD image = -1;
|
|
|
|
RESEARCH *pResearch = NULL;
|
|
|
|
BASE_STATS *psResGraphic = NULL;
|
2008-03-24 09:51:17 -07:00
|
|
|
BOOL MovieButton = false;
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
OpenButtonRender((UWORD)(xOffset+psButton->x), (UWORD)(yOffset+psButton->y),
|
|
|
|
psButton->width, psButton->height);
|
|
|
|
|
|
|
|
Down = psButton->state & (WBUTS_DOWN | WBUTS_CLICKLOCK);
|
|
|
|
Hilight = psButton->state & WBUTS_HILITE;
|
|
|
|
|
|
|
|
// Get the object associated with this widget.
|
|
|
|
psMsg = (MESSAGE *)psBuffer->Data;
|
2006-08-25 13:38:27 -07:00
|
|
|
ASSERT( psMsg != NULL, "psBuffer->Data empty. Why?" );
|
2007-06-28 10:47:08 -07:00
|
|
|
//shouldn't have any proximity messages here...
|
|
|
|
if (psMsg->type == MSG_PROXIMITY)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
//set the graphic for the button
|
|
|
|
switch (psMsg->type)
|
|
|
|
{
|
|
|
|
case MSG_RESEARCH:
|
|
|
|
pResearch = getResearchForMsg((VIEWDATA *)psMsg->pViewData);
|
|
|
|
//IMDType = IMDTYPE_RESEARCH;
|
2006-07-08 08:39:50 -07:00
|
|
|
//set the IMDType depending on what stat is associated with the research
|
2007-10-27 11:13:50 -07:00
|
|
|
if (pResearch && pResearch->psStat)
|
2006-07-08 08:39:50 -07:00
|
|
|
{
|
|
|
|
//we have a Stat associated with this research topic
|
|
|
|
if (StatIsStructure(pResearch->psStat))
|
|
|
|
{
|
|
|
|
//this defines how the button is drawn
|
2007-06-28 10:47:08 -07:00
|
|
|
IMDType = IMDTYPE_STRUCTURESTAT;
|
2006-07-08 08:39:50 -07:00
|
|
|
psResGraphic = pResearch->psStat;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
compID = StatIsComponent(pResearch->psStat);
|
2007-06-28 10:47:08 -07:00
|
|
|
if (compID != COMP_UNKNOWN)
|
|
|
|
{
|
2006-07-08 08:39:50 -07:00
|
|
|
//this defines how the button is drawn
|
|
|
|
IMDType = IMDTYPE_COMPONENT;
|
|
|
|
psResGraphic = pResearch->psStat;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
ASSERT( false, "intDisplayMessageButton: invalid stat" );
|
2006-07-08 08:39:50 -07:00
|
|
|
IMDType = IMDTYPE_RESEARCH;
|
|
|
|
psResGraphic = (BASE_STATS *)pResearch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//no Stat for this research topic so use the research topic to define what is drawn
|
|
|
|
psResGraphic = (BASE_STATS *)pResearch;
|
|
|
|
IMDType = IMDTYPE_RESEARCH;
|
|
|
|
}
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
case MSG_CAMPAIGN:
|
|
|
|
image = IMAGE_INTEL_CAMPAIGN;
|
2008-03-24 09:51:17 -07:00
|
|
|
MovieButton = true;
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
case MSG_MISSION:
|
|
|
|
image = IMAGE_INTEL_MISSION;
|
2008-03-24 09:51:17 -07:00
|
|
|
MovieButton = true;
|
2007-06-28 10:47:08 -07:00
|
|
|
break;
|
|
|
|
default:
|
2006-07-08 08:39:50 -07:00
|
|
|
debug( LOG_ERROR, "Unknown message type: %i", psMsg->type );
|
2007-06-28 10:47:08 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//if research message
|
|
|
|
if (pResearch)
|
|
|
|
{
|
|
|
|
if (pResearch->iconID != NO_RESEARCH_ICON)
|
|
|
|
{
|
|
|
|
image = pResearch->iconID;
|
|
|
|
}
|
|
|
|
|
|
|
|
//do we have the same icon for the top right hand corner?
|
|
|
|
if (image > 0)
|
|
|
|
{
|
2007-08-03 10:39:04 -07:00
|
|
|
RenderToButton(IntImages, (UWORD)image, psResGraphic, selectedPlayer, psBuffer,Down, IMDType, TOPBUTTON);
|
2006-05-27 09:37:17 -07:00
|
|
|
}
|
|
|
|
else
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
RenderToButton(NULL,0,pResearch,selectedPlayer,psBuffer,Down,IMDType,TOPBUTTON); //ajl, changed from 0 to selectedPlayer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
//draw buttons for mission and general messages
|
|
|
|
{
|
|
|
|
if (image > 0)
|
|
|
|
{
|
|
|
|
|
|
|
|
if(MovieButton) {
|
|
|
|
// draw the button with the relevant image, don't add Down to the image ID if it's
|
|
|
|
// a movie button.
|
|
|
|
RenderImageToButton(IntImages,(UWORD)(image),psBuffer,Down,TOPBUTTON);
|
|
|
|
} else {
|
|
|
|
//draw the button with the relevant image
|
|
|
|
RenderImageToButton(IntImages,(UWORD)(image+Down),psBuffer,Down,TOPBUTTON);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CloseButtonRender();
|
|
|
|
|
|
|
|
if (Hilight)
|
|
|
|
{
|
|
|
|
|
2007-06-18 07:25:06 -07:00
|
|
|
iV_DrawImage(IntImages,IMAGE_BUT_HILITE,xOffset+psButton->x,
|
2007-06-28 10:47:08 -07:00
|
|
|
yOffset+psButton->y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* displays the PIE view for the current message */
|
2008-04-20 10:17:50 -07:00
|
|
|
void intDisplayPIEView(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
W_TABFORM *Form = (W_TABFORM*)psWidget;
|
|
|
|
MESSAGE *psMessage = (MESSAGE *)Form->pUserData;
|
|
|
|
UDWORD x0,y0,x1,y1;
|
|
|
|
VIEW_RESEARCH *psViewResearch;
|
|
|
|
SWORD image = -1;
|
|
|
|
RESEARCH *psResearch;
|
|
|
|
|
|
|
|
|
|
|
|
//shouldn't have any proximity messages here...
|
|
|
|
if (psMessage->type == MSG_PROXIMITY)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-02-10 08:39:39 -08:00
|
|
|
if (psMessage && psMessage->pViewData)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
x0 = xOffset+Form->x;
|
|
|
|
y0 = yOffset+Form->y;
|
|
|
|
x1 = x0 + Form->width;
|
|
|
|
y1 = y0 + Form->height;
|
|
|
|
|
|
|
|
//moved from after close render
|
2008-01-21 08:57:00 -08:00
|
|
|
RenderWindowFrame(FRAME_NORMAL, x0 - 1, y0 - 1, x1 - x0 + 2, y1 - y0 + 2);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
OpenButtonRender((UWORD)(xOffset+Form->x), (UWORD)(yOffset+Form->y),
|
|
|
|
Form->width, Form->height);
|
|
|
|
//OpenButtonRender(Form->x, Form->y,Form->width, Form->height);
|
|
|
|
|
|
|
|
if (((VIEWDATA *)psMessage->pViewData)->type != VIEW_RES)
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
ASSERT( false, "intDisplayPIEView: Invalid message type" );
|
2007-06-28 10:47:08 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//render an object
|
|
|
|
psViewResearch = (VIEW_RESEARCH *)((VIEWDATA *)psCurrentMsg->pViewData)->pData;
|
|
|
|
|
|
|
|
psResearch = getResearchForMsg((VIEWDATA *)psCurrentMsg->pViewData);
|
2007-01-08 05:40:12 -08:00
|
|
|
renderResearchToBuffer(psResearch, x0+(x1-x0)/2, y0+(y1-y0)/2);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
CloseButtonRender();
|
|
|
|
|
|
|
|
//draw image icon in top left of window
|
|
|
|
image = (SWORD)getResearchForMsg((VIEWDATA *)psMessage->pViewData)->iconID;
|
|
|
|
if (image > 0)
|
|
|
|
{
|
2007-06-18 07:25:06 -07:00
|
|
|
iV_DrawImage(IntImages,image,x0,y0);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-07-20 14:04:01 -07:00
|
|
|
#ifndef NO_VIDEO
|
2007-06-28 10:47:08 -07:00
|
|
|
/* displays the FLIC view for the current message */
|
2008-10-14 15:02:35 -07:00
|
|
|
void intDisplayFLICView(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
|
|
|
|
W_TABFORM *Form = (W_TABFORM*)psWidget;
|
|
|
|
MESSAGE *psMessage = (MESSAGE *)Form->pUserData;
|
|
|
|
UDWORD x0,y0,x1,y1;
|
|
|
|
VIEW_RESEARCH *psViewResearch;
|
|
|
|
|
|
|
|
//shouldn't have any proximity messages here...
|
|
|
|
if (psMessage->type == MSG_PROXIMITY)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-02-10 08:39:39 -08:00
|
|
|
if (psMessage && psMessage->pViewData)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
OpenButtonRender((UWORD)(xOffset+Form->x), (UWORD)(yOffset+Form->y),
|
|
|
|
Form->width, Form->height);
|
|
|
|
|
|
|
|
x0 = xOffset+Form->x;
|
|
|
|
y0 = yOffset+Form->y;
|
|
|
|
x1 = x0 + Form->width;
|
|
|
|
y1 = y0 + Form->height;
|
|
|
|
|
|
|
|
if (((VIEWDATA *)psMessage->pViewData)->type != VIEW_RES)
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
ASSERT( false, "intDisplayFLICView: Invalid message type" );
|
2007-06-28 10:47:08 -07:00
|
|
|
return;
|
|
|
|
}
|
2008-10-08 11:24:19 -07:00
|
|
|
|
|
|
|
RenderWindowFrame(FRAME_NORMAL, x0, y0, x1 - x0, y1 - y0);
|
2008-09-20 08:54:41 -07:00
|
|
|
psViewResearch = (VIEW_RESEARCH *)((VIEWDATA *)psCurrentMsg->pViewData)->pData;
|
2008-10-08 11:24:19 -07:00
|
|
|
// set the dimensions to window size & position
|
|
|
|
seq_SetDisplaySize(192, 168, x0, y0);
|
|
|
|
//render a frame of the current movie *must* force above resolution!
|
|
|
|
seq_RenderVideoToBuffer(psViewResearch->sequenceName, SEQUENCE_HOLD);
|
2007-06-28 10:47:08 -07:00
|
|
|
CloseButtonRender();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2006-07-20 14:04:01 -07:00
|
|
|
#endif
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-02-07 11:19:15 -08:00
|
|
|
/**
|
|
|
|
* Displays the TEXT view for the current message.
|
|
|
|
* If this function breaks, please merge it with intDisplaySeqTextViewPage
|
|
|
|
* which presumably does almost the same.
|
|
|
|
*/
|
2008-04-20 10:17:50 -07:00
|
|
|
void intDisplayTEXTView(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
W_TABFORM *Form = (W_TABFORM*)psWidget;
|
|
|
|
MESSAGE *psMessage = (MESSAGE *)Form->pUserData;
|
|
|
|
UDWORD x0, y0, x1, y1, i, linePitch;
|
|
|
|
UDWORD ty;
|
|
|
|
|
|
|
|
x0 = xOffset+Form->x;
|
|
|
|
y0 = yOffset+Form->y;
|
|
|
|
x1 = x0 + Form->width;
|
|
|
|
y1 = y0 + Form->height;
|
|
|
|
ty = y0;
|
|
|
|
|
2008-01-21 08:57:00 -08:00
|
|
|
RenderWindowFrame(FRAME_NORMAL, x0, y0, x1 - x0, y1 - y0);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
if (psMessage)
|
|
|
|
{
|
2007-10-01 12:45:49 -07:00
|
|
|
iV_SetFont(font_regular);
|
2007-06-28 10:47:08 -07:00
|
|
|
/* Get the travel to the next line */
|
|
|
|
linePitch = iV_GetTextLineSize();
|
|
|
|
/* Fix for spacing.... */
|
2009-06-12 14:57:51 -07:00
|
|
|
linePitch+=3;
|
2007-06-28 10:47:08 -07:00
|
|
|
ty+=3;
|
|
|
|
/* Fix for spacing.... */
|
|
|
|
|
|
|
|
|
2007-12-09 08:09:23 -08:00
|
|
|
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
|
2007-06-28 10:47:08 -07:00
|
|
|
//add each message
|
|
|
|
for (i = 0; i < ((VIEWDATA *)psMessage->pViewData)->numText; i++)
|
|
|
|
{
|
|
|
|
//check haven't run out of room first!
|
|
|
|
if (i * linePitch > Form->height)
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
ASSERT( false, "intDisplayTEXTView: Run out of room!" );
|
2007-06-28 10:47:08 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
//need to check the string will fit!
|
2006-05-27 09:37:17 -07:00
|
|
|
iV_DrawText(((VIEWDATA *)psMessage->pViewData)->ppTextMsg[i], x0 + TEXT_XINDENT,
|
2007-06-28 10:47:08 -07:00
|
|
|
(ty + TEXT_YINDENT*3) + (i * linePitch));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-05-27 09:37:17 -07:00
|
|
|
//adds text to full screen video
|
2007-06-28 10:47:08 -07:00
|
|
|
void addVideoText(SEQ_DISPLAY *psSeqDisplay, UDWORD sequence)
|
|
|
|
{
|
|
|
|
UDWORD i, x, y;
|
|
|
|
|
|
|
|
if (psSeqDisplay->numText > 0)
|
|
|
|
{
|
2006-08-22 07:28:49 -07:00
|
|
|
debug( LOG_NEVER, "avt seq=%d [%s]\n", sequence, psSeqDisplay->ppTextMsg[0] );
|
2007-06-28 10:47:08 -07:00
|
|
|
//add each message, first at the top
|
2008-10-11 20:05:40 -07:00
|
|
|
// FIXME We should perhaps get font size, and use that to calculate offset(s) ?
|
2006-05-27 09:37:17 -07:00
|
|
|
x = VIDEO_TEXT_TOP_X;
|
2007-06-28 10:47:08 -07:00
|
|
|
y = VIDEO_TEXT_TOP_Y;
|
|
|
|
|
|
|
|
|
2008-10-15 10:48:35 -07:00
|
|
|
seq_AddTextForVideo(psSeqDisplay->ppTextMsg[0], x, y, TEXT_START_FRAME, TEXT_END_FRAME, SEQ_TEXT_POSITION); //startframe endFrame
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
//add each message, the rest at the bottom
|
|
|
|
x = VIDEO_TEXT_BOTTOM_X;
|
2008-10-11 20:05:40 -07:00
|
|
|
// calculate the real bottom... NOTE, game assumes all videos to be 640x480
|
2008-10-15 10:48:43 -07:00
|
|
|
y = (double)pie_GetVideoBufferHeight() / 480. * (double)VIDEO_TEXT_BOTTOM_Y;
|
2007-06-28 10:47:08 -07:00
|
|
|
i = 1;
|
|
|
|
while (i < psSeqDisplay->numText)
|
|
|
|
{
|
2008-10-15 10:48:35 -07:00
|
|
|
seq_AddTextForVideo(psSeqDisplay->ppTextMsg[i], x, y, TEXT_START_FRAME, TEXT_END_FRAME, SEQ_TEXT_POSITION); //startframe endFrame
|
2007-06-28 10:47:08 -07:00
|
|
|
//initialise after the first setting
|
|
|
|
x = y = 0;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*sets psCurrentMsg for the Intelligence screen*/
|
|
|
|
void setCurrentMsg(void)
|
|
|
|
{
|
|
|
|
MESSAGE *psMsg, *psLastMsg;
|
|
|
|
|
|
|
|
psLastMsg = NULL;
|
2006-05-27 09:37:17 -07:00
|
|
|
for (psMsg = apsMessages[selectedPlayer]; psMsg != NULL; psMsg =
|
2007-06-28 10:47:08 -07:00
|
|
|
psMsg->psNext)
|
|
|
|
{
|
|
|
|
if (psMsg->type != MSG_PROXIMITY)
|
|
|
|
{
|
|
|
|
psLastMsg = psMsg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
psCurrentMsg = psLastMsg;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*sets which states need to be paused when the intelligence screen is up*/
|
|
|
|
void setIntelligencePauseState(void)
|
|
|
|
{
|
|
|
|
if (!bMultiPlayer)
|
|
|
|
{
|
2007-11-12 11:08:55 -08:00
|
|
|
//need to clear mission widgets from being shown on intel screen
|
|
|
|
clearMissionWidgets();
|
2007-06-28 10:47:08 -07:00
|
|
|
gameTimeStop();
|
2008-03-24 09:51:17 -07:00
|
|
|
setGameUpdatePause(true);
|
2006-05-27 09:37:17 -07:00
|
|
|
if(!bInTutorial)
|
2007-06-28 10:47:08 -07:00
|
|
|
{ // Don't pause the scripts or the console if the tutorial is running.
|
2008-03-24 09:51:17 -07:00
|
|
|
setScriptPause(true);
|
|
|
|
setConsolePause(true);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2008-03-24 09:51:17 -07:00
|
|
|
setScrollPause(true);
|
2009-03-08 05:40:42 -07:00
|
|
|
screen_RestartBackDrop();
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*resets the pause states */
|
|
|
|
void resetIntelligencePauseState(void)
|
|
|
|
{
|
|
|
|
if (!bMultiPlayer)
|
2007-12-27 15:03:09 -08:00
|
|
|
{
|
2007-11-12 11:08:55 -08:00
|
|
|
//put any widgets back on for the missions
|
|
|
|
resetMissionWidgets();
|
2008-03-24 09:51:17 -07:00
|
|
|
setGameUpdatePause(false);
|
2007-11-12 11:08:55 -08:00
|
|
|
if(!bInTutorial)
|
|
|
|
{
|
2008-03-24 09:51:17 -07:00
|
|
|
setScriptPause(false);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
2008-03-24 09:51:17 -07:00
|
|
|
setScrollPause(false);
|
|
|
|
setConsolePause(false);
|
2007-06-28 10:47:08 -07:00
|
|
|
gameTimeStart();
|
2009-03-08 05:40:42 -07:00
|
|
|
screen_StopBackDrop();
|
|
|
|
pie_ScreenFlip(CLEAR_BLACK);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-08 14:47:49 -08:00
|
|
|
/** Play an intelligence message.
|
|
|
|
* This function is used from scripts to give updates to the mission.
|
|
|
|
*/
|
2006-11-26 03:58:01 -08:00
|
|
|
void displayImmediateMessage(MESSAGE *psMessage)
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
2006-04-20 11:49:51 -07:00
|
|
|
/*
|
|
|
|
This has to be changed to support a script calling a message in the intellegence screen
|
|
|
|
*/
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2006-05-08 08:10:45 -07:00
|
|
|
psCurrentMsg = psMessage;
|
2008-03-24 09:51:17 -07:00
|
|
|
StartMessageSequences(psMessage,true);
|
2008-11-08 14:47:49 -08:00
|
|
|
// remind the player that the message can be seen again from
|
|
|
|
// the intelligence screen
|
|
|
|
addConsoleMessage(_("New Intelligence Report"), CENTRE_JUSTIFY, SYSTEM_MESSAGE);
|
2007-06-28 10:47:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// return whether a message is immediate
|
|
|
|
BOOL messageIsImmediate(void)
|
|
|
|
{
|
|
|
|
return immediateMessage;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*sets the flag*/
|
|
|
|
void setMessageImmediate(BOOL state)
|
|
|
|
{
|
|
|
|
immediateMessage = state;
|
|
|
|
}
|