intelmap.c: Add new "seqtext" display for displaying the subtitles
from videos. Will do until we get proper video support. intelmap.c: Temporarily disable the Flic box, since it just loops on noVideo.rpl until we have real video intelmap.c: Hack displayImmediateMessage again to popup new IntelScreen seqtext display rpl_reader: Convert to PHYSFS calls seqdisp.c: Move "novideo.rpl" squashing to sequence_stub.c seqdisp.c: Fix seq_AddTextForVideo() prototype scriptfuncs.c: Avoid race when winlose video callback needs to be called during displayImmediateMessage git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@425 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
ef21733bf0
commit
c0a561cfb1
|
@ -5,6 +5,7 @@
|
|||
#include "adpcm.h"
|
||||
#include "frame.h"
|
||||
#include "rpl_reader.h"
|
||||
#include <physfs.h>
|
||||
|
||||
unsigned int rpl_decode_sound_none(RPL* rpl, short* buffer, unsigned int buffer_size);
|
||||
unsigned int rpl_decode_sound_unknown(RPL* rpl, short* buffer, unsigned int buffer_size);
|
||||
|
@ -31,58 +32,104 @@ void resize_data_buffer(unsigned int size) {
|
|||
|
||||
//*************************************************************************************
|
||||
|
||||
static char *readline(PHYSFS_file *f, char *linebuf, size_t len) {
|
||||
char c;
|
||||
size_t i = 0;
|
||||
|
||||
for (i = 0; i < len-1; i++) {
|
||||
if (PHYSFS_read(f, &c, 1, 1) != 1) {
|
||||
DBERROR(("Error reading from sequence file: %s\n",
|
||||
PHYSFS_getLastError()));
|
||||
break;
|
||||
}
|
||||
if (c == '\n' || !isprint(c))
|
||||
break;
|
||||
linebuf[i] = c;
|
||||
}
|
||||
|
||||
linebuf[i] = '\0';
|
||||
}
|
||||
|
||||
static int readint(PHYSFS_file *f, char *linebuf, size_t len) {
|
||||
int num;
|
||||
readline(f, linebuf, len);
|
||||
if (sscanf(linebuf, "%u", &num) < 1)
|
||||
num = 0;
|
||||
return num;
|
||||
}
|
||||
|
||||
static float readfloat(PHYSFS_file *f, char *linebuf, size_t len) {
|
||||
float num;
|
||||
readline(f, linebuf, len);
|
||||
if (sscanf(linebuf, "%f", &num) < 1)
|
||||
num = 0.0;
|
||||
return num;
|
||||
}
|
||||
|
||||
RPL*
|
||||
rpl_open(char* filename) {
|
||||
FILE* f = fopen(filename, "rb"); //Hmm...open from .wz or not?
|
||||
RPL* rpl; //it is only looking for novideo.rpl for right now.
|
||||
char buffer[512]; //The only issue I see, if we use a memory buffer,
|
||||
int tmp; //and the video is too large, some system may
|
||||
//run out of memory. So we may have to redo this
|
||||
if (f == NULL) { //routine when we change vid formats. -Q
|
||||
PHYSFS_file* f;
|
||||
RPL* rpl;
|
||||
char buf[80];
|
||||
int tmp;
|
||||
int ret;
|
||||
size_t len = sizeof(buf);
|
||||
|
||||
/* FIXME: we should just clean up our data */
|
||||
for (tmp = 0; tmp < strlen(filename); tmp++) {
|
||||
if (filename[tmp] == '\\')
|
||||
filename[tmp] = '/';
|
||||
}
|
||||
|
||||
f = PHYSFS_openRead(filename);
|
||||
if (f == NULL) {
|
||||
DBPRINTF(("Error reading %s: %s\n",
|
||||
filename, PHYSFS_getLastError()));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* going to do lots of small reads, so use a buffer */
|
||||
PHYSFS_setBuffer(f, 1024);
|
||||
|
||||
rpl = (RPL*)malloc(sizeof(RPL));
|
||||
rpl->chunks = NULL;
|
||||
|
||||
rpl->f = f;
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
fgets(buffer, 511, rpl->f);
|
||||
fgets(buffer, 511, rpl->f);
|
||||
fgets(buffer, 511, rpl->f);
|
||||
if (strcmp(readline(f, buf, len), "ARMovie") != 0)
|
||||
DBPRINTF(("%s missing RPL magic number\n", filename));
|
||||
readline(f, buf, len); /* discard filename */
|
||||
readline(f, buf, len); /* discard copyright */
|
||||
if (strcmp(readline(f, buf, len), "ESCAPE 2.0") != 0)
|
||||
/* This field is really "author", but.. */
|
||||
DBPRINTF(("%s not in \"ESCAPE 2.0\" format?\n", filename));
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &tmp);
|
||||
|
||||
tmp = readint(f, buf, len);
|
||||
switch (tmp) {
|
||||
case 130:
|
||||
rpl->video_decoder = dec130_decode;
|
||||
break;
|
||||
default:
|
||||
rpl->video_decoder = rpl_decode_video_unknown;
|
||||
printf("Unknown sound format %i\n", tmp);
|
||||
printf("Unknown video format %i\n", tmp);
|
||||
break;
|
||||
}
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->width);
|
||||
rpl->width = readint(f, buf, len);
|
||||
//printf("width : %i\n", rpl->width);
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->height);
|
||||
|
||||
rpl->height = readint(f, buf, len);
|
||||
//printf("height : %i\n", rpl->height);
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->bpp);
|
||||
rpl->bpp = readint(f, buf, len);
|
||||
//printf("bpp : %i\n", rpl->bpp);
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%f", &rpl->fps);
|
||||
rpl->fps = readfloat(f, buf, len);
|
||||
//printf("fps : %f\n\n", rpl->fps);
|
||||
rpl->current_video_frame = 0;
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &tmp);
|
||||
tmp = readint(f, buf, len);
|
||||
switch (tmp) {
|
||||
case 0:
|
||||
rpl->sound_decoder = rpl_decode_sound_none;
|
||||
|
@ -99,50 +146,38 @@ rpl_open(char* filename) {
|
|||
break;
|
||||
}
|
||||
rpl->current_sound_frame = 0;
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->samples);
|
||||
|
||||
rpl->samples = readint(f, buf, len);
|
||||
//printf("samples : %i\n", rpl->samples);
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->channels);
|
||||
rpl->channels = readint(f, buf, len);
|
||||
//printf("channels : %i\n", rpl->channels);
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->bps);
|
||||
rpl->bps = readint(f, buf, len);
|
||||
//printf("bits per sample : %i\n\n", rpl->bps);
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->fpc);
|
||||
rpl->fpc = readint(f, buf, len);
|
||||
//printf("frames per chunk : %i\n", rpl->fpc);
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->nb_chunks);
|
||||
rpl->nb_chunks++;
|
||||
rpl->nb_chunks = readint(f, buf, len) + 1;
|
||||
//printf("chunks : %i\n", rpl->nb_chunks);
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->ocs);
|
||||
rpl->ocs = readint(f, buf, len);
|
||||
//printf("odd chunk size : %i\n", rpl->ocs);
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->ecs);
|
||||
rpl->ecs = readint(f, buf, len);
|
||||
//printf("even chunk size : %i\n", rpl->ecs);
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->otcc);
|
||||
rpl->otcc = readint(f, buf, len);
|
||||
//printf("offset to chunk cat : %i\n\n", rpl->otcc);
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->ots);
|
||||
rpl->ots = readint(f, buf, len);
|
||||
//printf("offset to sprite : %i\n", rpl->ots);
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->sprite_size);
|
||||
rpl->sprite_size = readint(f, buf, len);
|
||||
//printf("size of sprite : %i\n\n", rpl->sprite_size);
|
||||
|
||||
fgets(buffer, 511, rpl->f);
|
||||
sscanf(buffer, "%i", &rpl->otkf);
|
||||
rpl->otkf = readint(f, buf, len);
|
||||
//printf("offset to key frames : %i\n", rpl->otkf);
|
||||
|
||||
{
|
||||
|
@ -150,11 +185,11 @@ rpl_open(char* filename) {
|
|||
unsigned int max_video_size = 0;
|
||||
|
||||
rpl->chunks = malloc(sizeof(RPL_chunk_info_t)*rpl->nb_chunks);
|
||||
fseek(rpl->f, rpl->otcc, SEEK_SET);
|
||||
PHYSFS_seek(f, rpl->otcc);
|
||||
|
||||
for (i = 0; i < rpl->nb_chunks; ++i) {
|
||||
fgets(buffer, 511, rpl->f);
|
||||
if (sscanf(buffer, "%i,%i;%i", &rpl->chunks[i].offset, &rpl->chunks[i].video_size, &rpl->chunks[i].audio_size) != 3) {
|
||||
readline(f, buf, len);
|
||||
if (sscanf(buf, "%i,%i;%i", &rpl->chunks[i].offset, &rpl->chunks[i].video_size, &rpl->chunks[i].audio_size) != 3) {
|
||||
printf("Error in chunk catalog\n");
|
||||
goto error;
|
||||
}
|
||||
|
@ -196,8 +231,8 @@ unsigned int rpl_decode_sound_unknown(RPL* rpl, short* buffer, unsigned int buff
|
|||
tmp = audio_buffer;
|
||||
|
||||
for (i = 0; i < rpl->nb_chunks; ++i) {
|
||||
fseek(rpl->f, rpl->chunks[i].offset+rpl->chunks[i].video_size, SEEK_SET);
|
||||
fread(tmp, rpl->chunks[i].audio_size, 1, rpl->f);
|
||||
PHYSFS_seek(rpl->f, rpl->chunks[i].offset+rpl->chunks[i].video_size);
|
||||
PHYSFS_read(rpl->f, tmp, rpl->chunks[i].audio_size, 1);
|
||||
tmp += rpl->chunks[i].audio_size;
|
||||
}
|
||||
|
||||
|
@ -224,8 +259,8 @@ unsigned int rpl_decode_sound_raw(RPL* rpl, short* buffer, unsigned int buffer_s
|
|||
if (size + (audio_frame_size >> 1) > buffer_size) {
|
||||
break;
|
||||
}
|
||||
fseek(rpl->f, rpl->chunks[cf].offset+rpl->chunks[cf].video_size, SEEK_SET);
|
||||
fread(tmp, audio_frame_size, 1, rpl->f);
|
||||
PHYSFS_seek(rpl->f, rpl->chunks[cf].offset+rpl->chunks[cf].video_size);
|
||||
PHYSFS_read(rpl->f, tmp, audio_frame_size, 1);
|
||||
tmp += audio_frame_size >> 1;
|
||||
size += audio_frame_size >> 1;
|
||||
rpl->current_sound_frame++;
|
||||
|
@ -255,8 +290,8 @@ unsigned int rpl_decode_sound_adpcm(RPL* rpl, short* buffer, unsigned int buffer
|
|||
free(tmp_buffer);
|
||||
tmp_buffer = malloc(tmp_buffer_size);
|
||||
}
|
||||
fseek(rpl->f, rpl->chunks[cf].offset+rpl->chunks[cf].video_size, SEEK_SET);
|
||||
fread(tmp_buffer, audio_frame_size, 1, rpl->f);
|
||||
PHYSFS_seek(rpl->f, rpl->chunks[cf].offset+rpl->chunks[cf].video_size);
|
||||
PHYSFS_read(rpl->f, tmp_buffer, audio_frame_size, 1);
|
||||
adpcm_decode(tmp_buffer, audio_frame_size, &tmp);
|
||||
size += audio_frame_size << 1;
|
||||
rpl->current_sound_frame++;
|
||||
|
@ -282,16 +317,16 @@ unsigned int rpl_decode_video_unknown(RPL* rpl, char* in, unsigned int in_size,
|
|||
|
||||
int rpl_decode_next_image(RPL* rpl, char* buffer)
|
||||
{
|
||||
unsigned int data_size = rpl->chunks[rpl->current_video_frame].video_size;
|
||||
unsigned int data_size;
|
||||
|
||||
if (rpl->current_video_frame >= rpl->nb_chunks) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// unsigned int data_size = rpl->chunks[rpl->current_video_frame].video_size; //can't have this here in .c rules that is. ;)
|
||||
data_size = rpl->chunks[rpl->current_video_frame].video_size;
|
||||
|
||||
fseek(rpl->f, rpl->chunks[rpl->current_video_frame].offset, SEEK_SET);
|
||||
fread(data_buffer, data_size, 1, rpl->f);
|
||||
PHYSFS_seek(rpl->f, rpl->chunks[rpl->current_video_frame].offset);
|
||||
PHYSFS_read(rpl->f, data_buffer, data_size, 1);
|
||||
|
||||
rpl->video_decoder(rpl, data_buffer, data_size, buffer);
|
||||
|
||||
|
@ -301,7 +336,7 @@ int rpl_decode_next_image(RPL* rpl, char* buffer)
|
|||
void
|
||||
rpl_close(RPL* rpl) {
|
||||
if (rpl != NULL) {
|
||||
fclose(rpl->f);
|
||||
PHYSFS_close(rpl->f);
|
||||
free(rpl->chunks);
|
||||
free(rpl);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define __RPL_READER_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <physfs.h>
|
||||
|
||||
typedef struct RPL_chunk_info_t {
|
||||
int offset;
|
||||
|
@ -10,7 +11,7 @@ typedef struct RPL_chunk_info_t {
|
|||
} RPL_chunk_info_t;
|
||||
|
||||
typedef struct RPL {
|
||||
FILE* f;
|
||||
PHYSFS_file* f;
|
||||
|
||||
// Video attributes
|
||||
int width;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "rpl_reader.h"
|
||||
#include "sequence.h"
|
||||
|
||||
|
||||
#define DUMMY_VIDEO
|
||||
|
||||
RPL* current_sequence = NULL;
|
||||
unsigned int current_frame = 0;
|
||||
|
@ -64,7 +64,10 @@ void seq_start_sound(RPL* s) {
|
|||
// 3DFX_FULLSCREEN 640 * 480 BGR 565 mod
|
||||
BOOL seq_SetSequenceForBuffer(char* filename, VIDEO_MODE mode, LPDIRECTSOUND lpDS, int startTime, DDPIXELFORMAT *DDPixelFormat, PERF_MODE perfMode)
|
||||
{
|
||||
printf("seq_SetSequenceForBuffer %s\n", filename);
|
||||
#ifdef DUMMY_VIDEO
|
||||
printf("seq_SetSequenceForBuffer %s -> noVideo.rpl\n", filename);
|
||||
filename = "noVideo.rpl";
|
||||
#endif
|
||||
if (current_sequence != NULL) {
|
||||
rpl_close(current_sequence);
|
||||
}
|
||||
|
@ -83,7 +86,10 @@ BOOL seq_SetSequenceForBuffer(char* filename, VIDEO_MODE mode, LPDIRECTSOUND lpD
|
|||
*/
|
||||
BOOL seq_SetSequence(char* filename, LPDIRECTDRAWSURFACE4 lpDDSF, LPDIRECTSOUND lpDS, int startTime, char* lpBF, PERF_MODE perfMode)
|
||||
{
|
||||
printf("seq_SetSequence %s\n", filename);
|
||||
#ifdef DUMMY_VIDEO
|
||||
printf("seq_SetSequence %s -> noVideo.rpl\n", filename);
|
||||
filename = "noVideo.rpl";
|
||||
#endif
|
||||
if (current_sequence != NULL) {
|
||||
rpl_close(current_sequence);
|
||||
}
|
||||
|
@ -141,12 +147,17 @@ int seq_RenderOneFrame(LPDIRECTDRAWSURFACE4 lpDDSF, int skip, SDWORD subMin, SDW
|
|||
{
|
||||
return VIDEO_FRAME_ERROR;
|
||||
}
|
||||
#ifdef DUMMY_VIDEO
|
||||
if (++current_frame >= 1000)
|
||||
return VIDEO_FINISHED;
|
||||
#else
|
||||
else if (++current_frame >= current_sequence->nb_chunks)
|
||||
{
|
||||
// seq_AddTextForVideo("<<hit ESC to continue>>", 0, 0, 399, 299);
|
||||
// return VIDEO_FINISHED; //For now, user must hit ESC to continue during mission briefings!
|
||||
// temporary "fix".
|
||||
}
|
||||
#endif
|
||||
return current_frame;
|
||||
}
|
||||
|
||||
|
|
227
src/intelmap.c
227
src/intelmap.c
|
@ -9,10 +9,12 @@
|
|||
#include "widget.h"
|
||||
/* Includes direct access to render library */
|
||||
#include "piedef.h"
|
||||
#include "piestate.h"
|
||||
#include "rendmode.h"
|
||||
|
||||
//#include "geo.h"
|
||||
#include "display3d.h"
|
||||
#include "resource.h"
|
||||
#include "map.h"
|
||||
#include "intdisplay.h"
|
||||
#include "objects.h"
|
||||
|
@ -71,10 +73,13 @@ extern CURSORSNAP InterfaceSnap;
|
|||
#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
|
||||
#define IDINTMAP_SEQTEXT 6011 //Sequence subtitle text
|
||||
|
||||
#define IDINTMAP_MSGSTART 6100 //The first button on the intelligence form
|
||||
#define IDINTMAP_MSGEND 6139 //The last button on the intelligence form (40 MAX)
|
||||
|
||||
#define IDINTMAP_SEQTEXTSTART 6200 //Sequence subtitle text tabs
|
||||
|
||||
//Proximity Messages no longer displayed in Intel Screen
|
||||
//#define IDINTMAP_PROXSTART 6200 //The first proximity button
|
||||
//#define IDINTMAP_PROXEND 6299 //The last proximity button
|
||||
|
@ -170,7 +175,17 @@ extern CURSORSNAP InterfaceSnap;
|
|||
#define TEXT_XINDENT 5
|
||||
#define TEXT_YINDENT 5
|
||||
|
||||
/*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
|
||||
|
||||
/*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
|
||||
|
||||
|
||||
//position for text on full screen video
|
||||
|
@ -242,6 +257,14 @@ static void intDisplayTEXTView(struct _widget *psWidget, UDWORD xOffset, UDWORD
|
|||
UDWORD *pColours);
|
||||
static void addVideoText(SEQ_DISPLAY *psSeqDisplay, UDWORD sequence);
|
||||
|
||||
static void intDisplaySeqTextView(struct _widget *psWidget,
|
||||
UDWORD xOffset, UDWORD yOffset,
|
||||
UDWORD *pColours);
|
||||
static BOOL intDisplaySeqTextViewPage(VIEW_REPLAY *psViewReplay,
|
||||
UDWORD x0, UDWORD y0,
|
||||
UDWORD width, UDWORD height,
|
||||
BOOL render,
|
||||
size_t *major, size_t *minor);
|
||||
|
||||
|
||||
|
||||
|
@ -562,7 +585,7 @@ BOOL intAddMessageView(MESSAGE * psMessage)
|
|||
W_FORMINIT sFormInit;
|
||||
W_BUTINIT sButInit;
|
||||
W_LABINIT sLabInit;
|
||||
BOOL Animate = FALSE;
|
||||
BOOL Animate = TRUE;
|
||||
RESEARCH *psResearch;
|
||||
|
||||
ASSERT((psMessage->type == MSG_RESEARCH,
|
||||
|
@ -653,6 +676,82 @@ BOOL intAddMessageView(MESSAGE * psMessage)
|
|||
}
|
||||
|
||||
|
||||
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,
|
||||
FALSE, &cur_seq, &cur_seqpage));
|
||||
|
||||
|
||||
sFormInit.pFormDisplay = intDisplayObjectForm;
|
||||
sFormInit.pUserData = (void*)&StandardTab;
|
||||
sFormInit.pTabDisplay = intDisplayTab;
|
||||
|
||||
if (!widgAddForm(psWScreen, &sFormInit))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
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))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*Add the Title box*/
|
||||
/*memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit.formID = IDINTMAP_MSGVIEW;
|
||||
|
@ -714,6 +813,7 @@ BOOL intAddMessageView(MESSAGE * psMessage)
|
|||
}
|
||||
|
||||
|
||||
#ifndef NO_VIDEO
|
||||
/*Add the Flic box */
|
||||
memset(&sFormInit, 0, sizeof(W_FORMINIT));
|
||||
sFormInit.formID = IDINTMAP_MSGVIEW;
|
||||
|
@ -729,6 +829,7 @@ BOOL intAddMessageView(MESSAGE * psMessage)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*Add the text box*/
|
||||
|
@ -776,6 +877,91 @@ void intProcessIntelMap(UDWORD id)
|
|||
}
|
||||
|
||||
|
||||
static BOOL intDisplaySeqTextViewPage(VIEW_REPLAY *psViewReplay,
|
||||
UDWORD x0, UDWORD y0,
|
||||
UDWORD width, UDWORD height,
|
||||
BOOL render,
|
||||
size_t *cur_seq, size_t *cur_seqpage)
|
||||
{
|
||||
UDWORD x1, y1, i, linePitch, cur_y;
|
||||
UDWORD ty;
|
||||
UDWORD sequence;
|
||||
|
||||
if (!psViewReplay)
|
||||
{
|
||||
return TRUE; /* nothing to do */
|
||||
}
|
||||
|
||||
x1 = x0 + width;
|
||||
y1 = y0 + height;
|
||||
ty = y0;
|
||||
|
||||
iV_SetFont(WFont);
|
||||
/* Get the travel to the next line */
|
||||
linePitch = iV_GetTextLineSize();
|
||||
/* Fix for spacing.... */
|
||||
linePitch += 6;
|
||||
ty += 3;
|
||||
|
||||
iV_SetTextColour(iV_PaletteNearestColour(255, 255, 255));
|
||||
|
||||
cur_y = 0;
|
||||
|
||||
/* 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)
|
||||
{
|
||||
iV_DrawText(psSeqDisplay->ppTextMsg[i],
|
||||
x0 + TEXT_XINDENT,
|
||||
(ty + TEXT_YINDENT*3) + cur_y);
|
||||
}
|
||||
cur_y += linePitch;
|
||||
if (cur_y > height)
|
||||
{
|
||||
/* run out of room - need to make new tab */
|
||||
*cur_seq = sequence;
|
||||
*cur_seqpage = i;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
}
|
||||
|
||||
return TRUE; /* done */
|
||||
}
|
||||
|
||||
static void intDisplaySeqTextView(struct _widget *psWidget,
|
||||
UDWORD xOffset, UDWORD yOffset,
|
||||
UDWORD *pColours)
|
||||
{
|
||||
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;
|
||||
|
||||
RenderWindowFrame(&FrameNormal, x0, y0, Form->width, Form->height);
|
||||
|
||||
/* work out where we're up to in the text */
|
||||
cur_seq = cur_seqpage = 0;
|
||||
for (page = 0; page < Form->majorT; page++)
|
||||
{
|
||||
intDisplaySeqTextViewPage(psViewReplay, x0, y0,
|
||||
Form->width, Form->height,
|
||||
FALSE, &cur_seq, &cur_seqpage);
|
||||
}
|
||||
|
||||
intDisplaySeqTextViewPage(psViewReplay, x0, y0,
|
||||
Form->width, Form->height,
|
||||
TRUE, &cur_seq, &cur_seqpage);
|
||||
}
|
||||
|
||||
|
||||
// Add all the Video Sequences for a message ... works on PC & PSX
|
||||
void StartMessageSequences(MESSAGE *psMessage, BOOL Start)
|
||||
|
@ -950,6 +1136,11 @@ void _intIntelButtonPressed(BOOL proxMsg, UDWORD id)
|
|||
if (((VIEWDATA *)psMessage->pViewData)->type == VIEW_RPL)
|
||||
{
|
||||
|
||||
if (psMessage->pViewData)
|
||||
{
|
||||
intAddMessageView(psMessage);
|
||||
}
|
||||
|
||||
StartMessageSequences(psMessage,TRUE);
|
||||
|
||||
}
|
||||
|
@ -1491,7 +1682,7 @@ void addVideoText(SEQ_DISPLAY *psSeqDisplay, UDWORD sequence)
|
|||
y = VIDEO_TEXT_TOP_Y;
|
||||
|
||||
|
||||
seq_AddTextForVideo((UBYTE*)psSeqDisplay->ppTextMsg[0], x, y, TEXT_START_FRAME, TEXT_END_FRAME, FALSE, sequence); //startframe endFrame
|
||||
seq_AddTextForVideo(psSeqDisplay->ppTextMsg[0], x, y, TEXT_START_FRAME, TEXT_END_FRAME, FALSE, sequence); //startframe endFrame
|
||||
|
||||
//add each message, the rest at the bottom
|
||||
x = VIDEO_TEXT_BOTTOM_X;
|
||||
|
@ -1499,7 +1690,7 @@ void addVideoText(SEQ_DISPLAY *psSeqDisplay, UDWORD sequence)
|
|||
i = 1;
|
||||
while (i < psSeqDisplay->numText)
|
||||
{
|
||||
seq_AddTextForVideo((UBYTE*)psSeqDisplay->ppTextMsg[i], x, y, TEXT_START_FRAME, TEXT_END_FRAME, FALSE, sequence); //startframe endFrame
|
||||
seq_AddTextForVideo(psSeqDisplay->ppTextMsg[i], x, y, TEXT_START_FRAME, TEXT_END_FRAME, FALSE, sequence); //startframe endFrame
|
||||
//initialise after the first setting
|
||||
x = y = 0;
|
||||
i++;
|
||||
|
@ -2000,33 +2191,21 @@ void resetIntelligencePauseState(void)
|
|||
void _displayImmediateMessage(MESSAGE *psMessage)
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
This has to be changed to support a script calling a message in the intellegence screen
|
||||
|
||||
*/
|
||||
|
||||
DBPRINTF(("\n\n\n\n\n\nDisplayImmedMessage\n\n\n\n\n"));
|
||||
|
||||
// Need to unload the research strings because the movies need the memory.
|
||||
|
||||
|
||||
#ifdef NO_VIDEO
|
||||
/* This sucks, but is better than nothing.. */
|
||||
if (((VIEWDATA*)psMessage->pViewData)->type == VIEW_RPL) {
|
||||
VIEW_REPLAY *psViewReplay;
|
||||
SEQ_DISPLAY *psSeqDisplay;
|
||||
UDWORD Sequence, i;
|
||||
|
||||
psViewReplay = (VIEW_REPLAY*)((VIEWDATA*)psMessage->pViewData)->pData;
|
||||
for (Sequence = 0; Sequence < psViewReplay->numSeq; Sequence++) {
|
||||
psSeqDisplay = &psViewReplay->pSeqList[Sequence];
|
||||
for (i = 0; i < psSeqDisplay->numText; i++) {
|
||||
addConsoleMessage(psSeqDisplay->ppTextMsg[i], DEFAULT_JUSTIFY);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
psCurrentMsg = psMessage;
|
||||
/* so we lied about definately not starting the intelligence screen */
|
||||
addIntelScreen();
|
||||
/* reset mouse cursor, since addIntelScreen() doesn't do that */
|
||||
pie_SetMouse(IntImages,IMAGE_CURSOR_DEFAULT);
|
||||
frameSetCursorFromRes(IDC_DEFAULT);
|
||||
/* addIntelScreen() (via addIntelMap()) actually starts
|
||||
* playing psCurrentMsg automatically */
|
||||
return;
|
||||
#endif
|
||||
|
||||
StartMessageSequences(psMessage,TRUE);
|
||||
|
|
|
@ -3049,14 +3049,14 @@ BOOL scrGameOverMessage(void)
|
|||
|
||||
if (psMessage)
|
||||
{
|
||||
//we need to set this here so the VIDEO_QUIT callback is not called
|
||||
setScriptWinLoseVideo((UBYTE)(gameOver ? PLAY_WIN : PLAY_LOSE));
|
||||
|
||||
//set the data
|
||||
psMessage->pViewData = (MSG_VIEWDATA *)psViewData;
|
||||
displayImmediateMessage(psMessage);
|
||||
stopReticuleButtonFlash(IDRET_INTEL_MAP);
|
||||
|
||||
//we need to set this here so the VIDEO_QUIT callback is not called
|
||||
setScriptWinLoseVideo((UBYTE)(gameOver ? PLAY_WIN : PLAY_LOSE));
|
||||
|
||||
// Can't do this cos won't process windows stuff
|
||||
// Wait for the video to finish.
|
||||
/*while (loop_GetVideoStatus())
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
*/
|
||||
/***************************************************************************/
|
||||
#define INCLUDE_AUDIO
|
||||
#define DUMMY_VIDEO
|
||||
#define RPL_WIDTH 640
|
||||
#define RPL_HEIGHT 480
|
||||
#define RPL_DEPTH 2 //bytes, 16bit
|
||||
|
@ -212,12 +211,6 @@ BOOL seq_RenderVideoToBuffer( iSurface *pSurface, char *sequenceName, int time,
|
|||
if ((bSeqPlaying = seq_SetSequenceForBuffer(aVideoName, videoMode, NULL, videoFrameTime, pDDPixelFormat, perfMode)) == FALSE)
|
||||
#endif
|
||||
{
|
||||
#ifdef DUMMY_VIDEO
|
||||
if ((bSeqPlaying = seq_SetSequenceForBuffer("noVideo.rpl", videoMode, NULL, time, pDDPixelFormat, perfMode)) == TRUE)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
ASSERT((FALSE,"seq_RenderVideoToBuffer: unable to initialise sequence %s",aVideoName));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -366,7 +359,6 @@ BOOL seq_SetupVideoBuffers(void)
|
|||
|
||||
void seq_SetVideoPath(void)
|
||||
{
|
||||
char aCDDrive[256] = "";
|
||||
#ifdef WIN32
|
||||
WIN32_FIND_DATA findData;
|
||||
HANDLE fileHandle;
|
||||
|
@ -506,15 +498,8 @@ BOOL seq_StartFullScreenVideo(char* videoName, char* audioName)
|
|||
if (!seq_SetSequence(aVideoName,screenGetSurface(), NULL, videoFrameTime + VIDEO_PLAYBACK_DELAY, pVideoBuffer, perfMode))
|
||||
#endif
|
||||
{
|
||||
#ifdef DUMMY_VIDEO
|
||||
if (seq_SetSequence("noVideo.rpl",screenGetSurface(), NULL, videoFrameTime + VIDEO_PLAYBACK_DELAY, pVideoBuffer, perfMode))
|
||||
{
|
||||
strcpy(aAudioName,"noVideo.wav");
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
seq_StopFullScreenVideo();
|
||||
// ASSERT((FALSE,"seq_StartFullScreenVideo: unable to initialise sequence %s",aVideoName));
|
||||
ASSERT((FALSE,"seq_StartFullScreenVideo: unable to initialise sequence %s",aVideoName));
|
||||
return FALSE;
|
||||
}
|
||||
if (perfMode != VIDEO_PERF_SKIP_FRAMES)//JPS fix for video problems with some sound cards 9 may 99
|
||||
|
@ -666,7 +651,6 @@ BOOL seq_UpdateFullScreenVideo(CLEAR_MODE *pbClear)
|
|||
//call sequence player to decode a frame
|
||||
lpDDSF = screenGetSurface();
|
||||
frame = seq_RenderOneFrame(lpDDSF, frameSkip, subMin, subMax);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -777,7 +761,7 @@ BOOL seq_GetVideoSize(SDWORD* pWidth, SDWORD* pHeight)
|
|||
#define MIN_JUSTIFICATION 40
|
||||
|
||||
// add a string at x,y or add string below last line if x and y are 0
|
||||
BOOL seq_AddTextForVideo(UBYTE* pText, SDWORD xOffset, SDWORD yOffset, SDWORD startFrame, SDWORD endFrame, SDWORD bJustify, UDWORD PSXSeqNumber)
|
||||
BOOL seq_AddTextForVideo(char* pText, SDWORD xOffset, SDWORD yOffset, SDWORD startFrame, SDWORD endFrame, SDWORD bJustify, UDWORD PSXSeqNumber)
|
||||
{
|
||||
SDWORD sourceLength, currentLength;
|
||||
char* currentText;
|
||||
|
|
|
@ -53,7 +53,7 @@ extern BOOL seq_SetupVideoBuffers(void);
|
|||
extern BOOL seq_ReleaseVideoBuffers(void);
|
||||
extern BOOL seq_GetVideoSize(SDWORD* pWidth, SDWORD* pHeight);
|
||||
//text
|
||||
extern BOOL seq_AddTextForVideo(UBYTE* pText, SDWORD xOffset, SDWORD yOffset, SDWORD startTime, SDWORD endTime, SDWORD bJustify, UDWORD PSXSeqNumber);
|
||||
extern BOOL seq_AddTextForVideo(char* pText, SDWORD xOffset, SDWORD yOffset, SDWORD startTime, SDWORD endTime, SDWORD bJustify, UDWORD PSXSeqNumber);
|
||||
extern BOOL seq_ClearTextForVideo(void);
|
||||
//clear the sequence list
|
||||
extern void seq_ClearSeqList(void);
|
||||
|
|
Loading…
Reference in New Issue