mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-03-10 19:22:03 +00:00
- screenjob. fixes from Raze
This commit is contained in:
parent
1bb750c061
commit
7ed8d3b3e2
7 changed files with 29 additions and 32 deletions
|
@ -123,12 +123,9 @@ public:
|
||||||
frametime = currentclock;
|
frametime = currentclock;
|
||||||
|
|
||||||
int delay = 20;
|
int delay = 20;
|
||||||
if (frameTicks)
|
|
||||||
{
|
|
||||||
if (curframe == 1) delay = frameTicks[0];
|
if (curframe == 1) delay = frameTicks[0];
|
||||||
else if (curframe < numframes - 2) delay = frameTicks[1];
|
else if (curframe < numframes - 2) delay = frameTicks[1];
|
||||||
else delay = frameTicks[2];
|
else delay = frameTicks[2];
|
||||||
}
|
|
||||||
nextframetime += delay;
|
nextframetime += delay;
|
||||||
|
|
||||||
bool nostopsound = (flags & NOSOUNDCUTOFF);
|
bool nostopsound = (flags & NOSOUNDCUTOFF);
|
||||||
|
@ -532,7 +529,7 @@ public:
|
||||||
SmkPlayer* pId = (SmkPlayer*)userdata;
|
SmkPlayer* pId = (SmkPlayer*)userdata;
|
||||||
memcpy(buff, &pId->adata.samples[pId->adata.nRead], len);
|
memcpy(buff, &pId->adata.samples[pId->adata.nRead], len);
|
||||||
pId->adata.nRead += len / 2;
|
pId->adata.nRead += len / 2;
|
||||||
if (pId->adata.nRead >= countof(pId->adata.samples)) pId->adata.nRead = 0;
|
if (pId->adata.nRead >= (int)countof(pId->adata.samples)) pId->adata.nRead = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,7 +538,7 @@ public:
|
||||||
for (unsigned i = 0; i < count; i++)
|
for (unsigned i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
adata.samples[adata.nWrite] = (audioBuffer[i] - 128) << 8;
|
adata.samples[adata.nWrite] = (audioBuffer[i] - 128) << 8;
|
||||||
if (++adata.nWrite >= countof(adata.samples)) adata.nWrite = 0;
|
if (++adata.nWrite >= (int)countof(adata.samples)) adata.nWrite = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,7 +548,7 @@ public:
|
||||||
for (unsigned i = 0; i < count/2; i++)
|
for (unsigned i = 0; i < count/2; i++)
|
||||||
{
|
{
|
||||||
adata.samples[adata.nWrite] = *ptr++;
|
adata.samples[adata.nWrite] = *ptr++;
|
||||||
if (++adata.nWrite >= countof(adata.samples)) adata.nWrite = 0;
|
if (++adata.nWrite >= (int)countof(adata.samples)) adata.nWrite = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,7 +562,7 @@ public:
|
||||||
}
|
}
|
||||||
flags = flags_;
|
flags = flags_;
|
||||||
Smacker_GetFrameSize(hSMK, nWidth, nHeight);
|
Smacker_GetFrameSize(hSMK, nWidth, nHeight);
|
||||||
pFrame.Resize(nWidth * nHeight + std::max(nWidth, nHeight));
|
pFrame.Resize(nWidth * nHeight + max(nWidth, nHeight));
|
||||||
float frameRate = Smacker_GetFrameRate(hSMK);
|
float frameRate = Smacker_GetFrameRate(hSMK);
|
||||||
nFrameNs = uint64_t(1'000'000'000 / frameRate);
|
nFrameNs = uint64_t(1'000'000'000 / frameRate);
|
||||||
nFrames = Smacker_GetNumFrames(hSMK);
|
nFrames = Smacker_GetNumFrames(hSMK);
|
||||||
|
@ -789,7 +786,7 @@ DEFINE_ACTION_FUNCTION(_MoviePlayer, Create)
|
||||||
auto movie = OpenMovie(filename, *sndinf, frametime == -1? nullptr : frametimes, flags, error);
|
auto movie = OpenMovie(filename, *sndinf, frametime == -1? nullptr : frametimes, flags, error);
|
||||||
if (!movie)
|
if (!movie)
|
||||||
{
|
{
|
||||||
Printf(TEXTCOLOR_YELLOW, "%s", error.GetChars());
|
Printf(TEXTCOLOR_YELLOW "%s", error.GetChars());
|
||||||
}
|
}
|
||||||
ACTION_RETURN_POINTER(movie);
|
ACTION_RETURN_POINTER(movie);
|
||||||
}
|
}
|
||||||
|
@ -808,7 +805,6 @@ DEFINE_ACTION_FUNCTION(_MoviePlayer, Frame)
|
||||||
PARAM_SELF_STRUCT_PROLOGUE(MoviePlayer);
|
PARAM_SELF_STRUCT_PROLOGUE(MoviePlayer);
|
||||||
PARAM_FLOAT(clock);
|
PARAM_FLOAT(clock);
|
||||||
ACTION_RETURN_INT(self->Frame(int64_t(clock)));
|
ACTION_RETURN_INT(self->Frame(int64_t(clock)));
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(_MoviePlayer, Destroy)
|
DEFINE_ACTION_FUNCTION(_MoviePlayer, Destroy)
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
#include "v_draw.h"
|
#include "v_draw.h"
|
||||||
#include "s_music.h"
|
#include "s_music.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
#include "templates.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ static bool StreamCallbackFunc(SoundStream* stream, void* buff, int len, void* u
|
||||||
InterplayDecoder* pId = (InterplayDecoder*)userdata;
|
InterplayDecoder* pId = (InterplayDecoder*)userdata;
|
||||||
memcpy(buff, &pId->audio.samples[pId->audio.nRead], len);
|
memcpy(buff, &pId->audio.samples[pId->audio.nRead], len);
|
||||||
pId->audio.nRead += len / 2;
|
pId->audio.nRead += len / 2;
|
||||||
if (pId->audio.nRead >= countof(pId->audio.samples)) pId->audio.nRead = 0;
|
if (pId->audio.nRead >= (int)countof(pId->audio.samples)) pId->audio.nRead = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
|
||||||
}
|
}
|
||||||
|
|
||||||
audio.samples[audio.nWrite++] = predictor[ch];
|
audio.samples[audio.nWrite++] = predictor[ch];
|
||||||
if (audio.nWrite >= countof(audio.samples)) audio.nWrite = 0;
|
if (audio.nWrite >= (int)countof(audio.samples)) audio.nWrite = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ch = 0;
|
int ch = 0;
|
||||||
|
@ -374,7 +374,7 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
|
||||||
predictor[ch] = clamp(predictor[ch], -32768, 32768);
|
predictor[ch] = clamp(predictor[ch], -32768, 32768);
|
||||||
|
|
||||||
audio.samples[audio.nWrite++] = predictor[ch];
|
audio.samples[audio.nWrite++] = predictor[ch];
|
||||||
if (audio.nWrite >= countof(audio.samples)) audio.nWrite = 0;
|
if (audio.nWrite >= (int)countof(audio.samples)) audio.nWrite = 0;
|
||||||
|
|
||||||
// toggle channel
|
// toggle channel
|
||||||
ch ^= audio.nChannels - 1;
|
ch ^= audio.nChannels - 1;
|
||||||
|
@ -442,7 +442,7 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (opcodeSize != decodeMap.nSize) {
|
if (opcodeSize != (int)decodeMap.nSize) {
|
||||||
delete[] decodeMap.pData;
|
delete[] decodeMap.pData;
|
||||||
decodeMap.pData = new uint8_t[opcodeSize];
|
decodeMap.pData = new uint8_t[opcodeSize];
|
||||||
decodeMap.nSize = opcodeSize;
|
decodeMap.nSize = opcodeSize;
|
||||||
|
@ -948,7 +948,7 @@ void InterplayDecoder::DecodeBlock13(int32_t offset)
|
||||||
{
|
{
|
||||||
// 4-color block encoding: each 4x4 block is a different color
|
// 4-color block encoding: each 4x4 block is a different color
|
||||||
uint8_t* pBuffer = GetCurrentFrame() + (intptr_t)offset;
|
uint8_t* pBuffer = GetCurrentFrame() + (intptr_t)offset;
|
||||||
uint8_t P[2];
|
uint8_t P[2] = {};
|
||||||
|
|
||||||
for (int y = 0; y < 8; y++)
|
for (int y = 0; y < 8; y++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -88,12 +88,14 @@ void Job_Init()
|
||||||
VMFunction* LookupFunction(const char* qname, bool validate)
|
VMFunction* LookupFunction(const char* qname, bool validate)
|
||||||
{
|
{
|
||||||
size_t p = strcspn(qname, ".");
|
size_t p = strcspn(qname, ".");
|
||||||
if (p == 0) I_Error("Call to undefined function %s", qname);
|
if (p == 0)
|
||||||
|
I_Error("Call to undefined function %s", qname);
|
||||||
FString clsname(qname, p);
|
FString clsname(qname, p);
|
||||||
FString funcname = qname + p + 1;
|
FString funcname = qname + p + 1;
|
||||||
|
|
||||||
auto func = PClass::FindFunction(clsname, funcname);
|
auto func = PClass::FindFunction(clsname, funcname);
|
||||||
if (func == nullptr) I_Error("Call to undefined function %s", qname);
|
if (func == nullptr)
|
||||||
|
I_Error("Call to undefined function %s", qname);
|
||||||
if (validate)
|
if (validate)
|
||||||
{
|
{
|
||||||
// these conditions must be met by all functions for this interface.
|
// these conditions must be met by all functions for this interface.
|
||||||
|
@ -141,7 +143,6 @@ DObject* CreateRunner(bool clearbefore)
|
||||||
|
|
||||||
void AddGenericVideo(DObject* runner, const FString& fn, int soundid, int fps)
|
void AddGenericVideo(DObject* runner, const FString& fn, int soundid, int fps)
|
||||||
{
|
{
|
||||||
auto obj = runnerclass->CreateNew();
|
|
||||||
auto func = LookupFunction("ScreenJobRunner.AddGenericVideo", false);
|
auto func = LookupFunction("ScreenJobRunner.AddGenericVideo", false);
|
||||||
VMValue val[] = { runner, &fn, soundid, fps };
|
VMValue val[] = { runner, &fn, soundid, fps };
|
||||||
VMCall(func, val, 4, nullptr, 0);
|
VMCall(func, val, 4, nullptr, 0);
|
||||||
|
@ -155,7 +156,7 @@ void AddGenericVideo(DObject* runner, const FString& fn, int soundid, int fps)
|
||||||
|
|
||||||
int CutsceneDef::GetSound()
|
int CutsceneDef::GetSound()
|
||||||
{
|
{
|
||||||
int id;
|
int id = -1;
|
||||||
if (soundName.IsNotEmpty()) id = soundEngine->FindSound(soundName);
|
if (soundName.IsNotEmpty()) id = soundEngine->FindSound(soundName);
|
||||||
if (id <= 0) id = soundEngine->FindSoundByResID(soundID);
|
if (id <= 0) id = soundEngine->FindSoundByResID(soundID);
|
||||||
return id;
|
return id;
|
||||||
|
@ -332,7 +333,7 @@ bool StartCutscene(const char* s, int flags, const CompletionFunc& completion)
|
||||||
{
|
{
|
||||||
CutsceneDef def;
|
CutsceneDef def;
|
||||||
def.function = s;
|
def.function = s;
|
||||||
return StartCutscene(def, 0, completion);
|
return StartCutscene(def, flags, completion);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
|
@ -15,6 +15,7 @@ enum gamestate_t : int
|
||||||
GS_TITLELEVEL, // [RH] A combination of GS_LEVEL and GS_DEMOSCREEN
|
GS_TITLELEVEL, // [RH] A combination of GS_LEVEL and GS_DEMOSCREEN
|
||||||
GS_INTRO,
|
GS_INTRO,
|
||||||
GS_CUTSCENE,
|
GS_CUTSCENE,
|
||||||
|
|
||||||
GS_MENUSCREEN = GS_DEMOSCREEN,
|
GS_MENUSCREEN = GS_DEMOSCREEN,
|
||||||
|
|
||||||
GS_FORCEWIPE = -1,
|
GS_FORCEWIPE = -1,
|
||||||
|
|
|
@ -34,7 +34,6 @@ struct SystemCallbacks
|
||||||
void (*FontCharCreated)(FGameTexture* base, FGameTexture* untranslated);
|
void (*FontCharCreated)(FGameTexture* base, FGameTexture* untranslated);
|
||||||
void (*ToggleFullConsole)();
|
void (*ToggleFullConsole)();
|
||||||
void (*StartCutscene)(bool blockui);
|
void (*StartCutscene)(bool blockui);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SystemCallbacks sysCallbacks;
|
extern SystemCallbacks sysCallbacks;
|
||||||
|
|
|
@ -243,9 +243,9 @@ const char *kSMK4iD = "SMK4";
|
||||||
* Context used for code reconstructing
|
* Context used for code reconstructing
|
||||||
*/
|
*/
|
||||||
typedef struct HuffContext {
|
typedef struct HuffContext {
|
||||||
int length;
|
int length = 0;
|
||||||
int maxlength;
|
int maxlength = 0;
|
||||||
int current;
|
int current = 0;
|
||||||
|
|
||||||
std::vector<uint32_t> bits;
|
std::vector<uint32_t> bits;
|
||||||
std::vector<int> lengths;
|
std::vector<int> lengths;
|
||||||
|
|
Loading…
Reference in a new issue