Moved ddraw into exe, temp added libsmacker to test out movie event code. Movies work if converted to SMK.

This commit is contained in:
Justin Marshall
2020-06-02 23:31:13 -07:00
parent 22f3ea37de
commit 41bb81ff93
137 changed files with 165660 additions and 629 deletions
+111
View File
@@ -0,0 +1,111 @@
// VQAMOVIE.CPP
//
#include "FUNCTION.H"
#include "VQAMOVIE.H"
#include <SDL.h>
byte* raw_image_buffer = nullptr;
/*
==================
_VQAHandle::_VQAHandle
==================
*/
_VQAHandle::_VQAHandle() {
}
/*
==================
_VQAHandle::~_VQAHandle
==================
*/
_VQAHandle::~_VQAHandle() {
}
/*
==================
_VQAHandle::VQA_Alloc
==================
*/
_VQAHandle* VQA_Alloc(void) {
return new _VQAHandle();
}
char smk_info_all(const smk object, unsigned long* frame, unsigned long* frame_count, double* usf);
char smk_info_video(const smk object, unsigned long* w, unsigned long* h, unsigned char* y_scale_mode);
long VQA_Open(_VQAHandle *videoHandle, char const* filename) {
int ret;
char fullpath[512];
sprintf(fullpath, "movies/%s", filename);
videoHandle->smacker_video = smk_open_file(fullpath, 0);
if (videoHandle->smacker_video == NULL)
return -1;
unsigned char yscalemode;
unsigned long frame;
double usf;
smk_info_video(videoHandle->smacker_video, &videoHandle->width, &videoHandle->height, &yscalemode);
smk_info_all(videoHandle->smacker_video, &frame, &videoHandle->frame_count, &usf);
smk_enable_video(videoHandle->smacker_video, 1);
videoHandle->video_graphics_buffer = &VisiblePage;//new GraphicBufferClass();
//videoHandle->video_graphics_buffer->Init(videoHandle->width, videoHandle->height, NULL, 0, (GBC_Enum)(GBC_VISIBLE | GBC_VIDEOMEM));
return (0);
}
void VQA_Free(_VQAHandle* vqaHandle) {
delete vqaHandle;
}
void VQA_Close(_VQAHandle* vqaHandle) {
}
long VQA_Play(_VQAHandle* vqaHandle) {
int currentFrame = 0;
smk_first(vqaHandle->smacker_video);
while (currentFrame < vqaHandle->frame_count) {
SDL_Event event;
// Check for any new SDL events.
while (SDL_PollEvent(&event)) {
if (event.type == SDL_KEYDOWN) {
//delete raw_image_buffer;
raw_image_buffer = nullptr;
return 0;
}
}
smk_render_frame(vqaHandle->smacker_video, currentFrame);
//// Grab the frame from the movie.
//VQA_ImageForTime(vqaHandle, Sys_Milliseconds() - vqaHandle->startTime);
//
////memcpy(raw_image_buffer, vqaHandle->image, vqaHandle->CIN_WIDTH * vqaHandle->CIN_HEIGHT * 4 * 2);
//for (int i = 0; i < vqaHandle->CIN_WIDTH * vqaHandle->CIN_HEIGHT; i++) {
// raw_image_buffer[(i * 4) + 0] = vqaHandle->image[(i * 3) + 0];
// raw_image_buffer[(i * 4) + 1] = vqaHandle->image[(i * 3) + 1];
// raw_image_buffer[(i * 4) + 2] = vqaHandle->image[(i * 3) + 2];
//}
raw_image_buffer = smk_get_palette(vqaHandle->smacker_video);
vqaHandle->video_graphics_buffer->Lock();
Buffer_To_Page(0, 0, vqaHandle->width, vqaHandle->height, smk_get_video(vqaHandle->smacker_video), *vqaHandle->video_graphics_buffer);
vqaHandle->video_graphics_buffer->Unlock();
currentFrame++;
Sleep(30);
}
//delete raw_image_buffer;
raw_image_buffer = nullptr;
return (0);
}