Rednukem: Playback support added for Rides Again intro movie. Closes #266

# Conflicts:
#	GNUmakefile
#	platform/Windows/rednukem.vcxproj
#	platform/Windows/rednukem.vcxproj.filters
#	source/rr/src/game.cpp
This commit is contained in:
sirlemonhead 2020-03-10 18:38:16 +00:00 committed by Christoph Oelckers
parent 20cfbc1786
commit b89c6da6b8
5 changed files with 1513 additions and 0 deletions

View File

@ -0,0 +1,144 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2010-2020 EDuke32 developers and contributors
Copyright (C) 2020 sirlemonhead
This file is part of Rednukem.
Rednukem is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "filestream.h"
#include <stdlib.h>
namespace RedNukem {
bool FileStream::Open(const char *fileName)
{
file = kopen4loadfrommod(fileName, 0);
if (file == -1)
{
// log error
return false;
}
return true;
}
bool FileStream::Is_Open()
{
return file != -1;
}
void FileStream::Close()
{
kclose(file);
file = -1;
}
int32_t FileStream::ReadBytes(uint8_t *data, uint32_t nBytes)
{
uint32_t nCount = (uint32_t)kread(file, data, static_cast<int32_t>(nBytes));
if (nCount != nBytes) {
return 0;
}
return (int32_t)nCount;
}
uint64_t FileStream::ReadUint64LE()
{
uint64_t value;
kread(file, &value, 8);
return B_LITTLE64(value);
}
uint64_t FileStream::ReadUint64BE()
{
uint64_t value;
kread(file, &value, 8);
return B_BIG64(value);
}
uint32_t FileStream::ReadUint32LE()
{
uint32_t value;
kread(file, &value, 4);
return B_LITTLE32(value);
}
uint32_t FileStream::ReadUint32BE()
{
uint32_t value;
kread(file, &value, 4);
return B_BIG32(value);
}
uint16_t FileStream::ReadUint16LE()
{
uint16_t value;
kread(file, &value, 2);
return B_LITTLE16(value);
}
uint16_t FileStream::ReadUint16BE()
{
uint16_t value;
kread(file, &value, 2);
return B_BIG16(value);
}
uint8_t FileStream::ReadByte()
{
uint8_t value;
kread(file, &value, 1);
return value;
}
bool FileStream::Seek(int32_t offset, SeekDirection direction)
{
int32_t nStatus = -1;
if (kSeekStart == direction) {
nStatus = klseek(file, offset, SEEK_SET);
}
else if (kSeekCurrent == direction) {
nStatus = klseek(file, offset, SEEK_CUR);
}
// TODO - end seek
if (nStatus < 0)
{
// todo
return false;
}
return true;
}
bool FileStream::Skip(int32_t offset)
{
return Seek(offset, kSeekCurrent);
}
bool FileStream::Is_Eos()
{
// TODO:
return false;
}
int32_t FileStream::GetPosition()
{
return ktell(file);
}
} // close namespace RedNukem

View File

@ -0,0 +1,66 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2010-2020 EDuke32 developers and contributors
Copyright (C) 2020 sirlemonhead
This file is part of Rednukem.
Rednukem is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#ifndef _RedNukemFileStream_h_
#define _RedNukemFileStream_h_
#include "vfs.h"
#include "compat.h"
#include <stdint.h>
namespace RedNukem {
class FileStream
{
public:
bool Open(const char *fileName);
bool Is_Open();
void Close();
int32_t ReadBytes(uint8_t *data, uint32_t nBytes);
uint64_t ReadUint64LE();
uint64_t ReadUint64BE();
uint32_t ReadUint32LE();
uint32_t ReadUint32BE();
uint16_t ReadUint16LE();
uint16_t ReadUint16BE();
uint8_t ReadByte();
enum SeekDirection {
kSeekCurrent = 0,
kSeekStart = 1,
kSeekEnd = 2
};
bool Seek(int32_t offset, SeekDirection = kSeekStart);
bool Skip(int32_t offset);
int32_t GetPosition();
bool Is_Eos();
private:
buildvfs_kfd file;
};
} // close namespace RedNukem
#endif

View File

@ -48,6 +48,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "c_dispatch.h"
#include "mapinfo.h"
#include "rendering/v_video.h"
#include "playmve.h"
// Uncomment to prevent anything except mirrors from drawing. It is sensible to
// also uncomment ENGINE_CLEAR_SCREEN in build/src/engine_priv.h.
@ -7185,6 +7186,9 @@ int GameInterface::app_main()
for (bssize_t i = MINIFONT + ('a'-'!'); minitext_lowercase && i < MINIFONT + ('z'-'!') + 1; ++i)
minitext_lowercase &= (int)tileCheck(i);
/*if (RRRA)
playmve("REDINT.MVE"); still needs work on the audio side*/
//if (g_networkMode != NET_DEDICATED_SERVER)
{
Menu_Init();

1195
source/rr/src/playmve.cpp Normal file

File diff suppressed because it is too large Load Diff

104
source/rr/src/playmve.h Normal file
View File

@ -0,0 +1,104 @@
/*
* InterplayDecoder
* Copyright (C) 2020 sirlemonhead
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* This code is based on interplayvideo.c, dpcm.c and ipmovie.c from the FFmpeg project which can be obtained
* from http://www.ffmpeg.org/. Below is the license from interplayvideo.c
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Interplay MVE Video Decoder
* Copyright (C) 2003 The FFmpeg project
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#ifndef playmve_h_
#define playmve_h_
#include "a.h"
#include "baselayer.h"
#include "build.h"
#include "cache1d.h"
#include "compat.h"
#include "fx_man.h"
#include "keyboard.h"
#include "pragmas.h"
bool playmve(const char* filename);
#define kMVETile (MAXTILES-1)
#define kMVEPal 5
#define CHUNK_PREAMBLE_SIZE 4
#define OPCODE_PREAMBLE_SIZE 4
#define CHUNK_INIT_AUDIO 0x0000
#define CHUNK_AUDIO_ONLY 0x0001
#define CHUNK_INIT_VIDEO 0x0002
#define CHUNK_VIDEO 0x0003
#define CHUNK_SHUTDOWN 0x0004
#define CHUNK_END 0x0005
/* these last types are used internally */
#define CHUNK_DONE 0xFFFC
#define CHUNK_NOMEM 0xFFFD
#define CHUNK_EOF 0xFFFE
#define CHUNK_BAD 0xFFFF
#define OPCODE_END_OF_STREAM 0x00
#define OPCODE_END_OF_CHUNK 0x01
#define OPCODE_CREATE_TIMER 0x02
#define OPCODE_INIT_AUDIO_BUFFERS 0x03
#define OPCODE_START_STOP_AUDIO 0x04
#define OPCODE_INIT_VIDEO_BUFFERS 0x05
#define OPCODE_UNKNOWN_06 0x06
#define OPCODE_SEND_BUFFER 0x07
#define OPCODE_AUDIO_FRAME 0x08
#define OPCODE_SILENCE_FRAME 0x09
#define OPCODE_INIT_VIDEO_MODE 0x0A
#define OPCODE_CREATE_GRADIENT 0x0B
#define OPCODE_SET_PALETTE 0x0C
#define OPCODE_SET_PALETTE_COMPRESSED 0x0D
#define OPCODE_UNKNOWN_0E 0x0E
#define OPCODE_SET_DECODING_MAP 0x0F
#define OPCODE_UNKNOWN_10 0x10
#define OPCODE_VIDEO_DATA 0x11
#define OPCODE_UNKNOWN_12 0x12
#define OPCODE_UNKNOWN_13 0x13
#define OPCODE_UNKNOWN_14 0x14
#define OPCODE_UNKNOWN_15 0x15
#define PALETTE_COUNT 256
#endif