Changed how disc pausing and playing works with search, skip, and step operations.
This commit is contained in:
parent
9b1505c5f1
commit
27c897e8e1
1 changed files with 32 additions and 7 deletions
|
@ -517,6 +517,8 @@ int apiDiscPauseAtFrame(lua_State *L) {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
double d = 0;
|
double d = 0;
|
||||||
|
|
||||||
|
//***TODO*** WTF is this? Isn't this just DiskSearch?
|
||||||
|
|
||||||
if (!_discStopped) {
|
if (!_discStopped) {
|
||||||
if (n == 1) {
|
if (n == 1) {
|
||||||
if (lua_isnumber(L, 1)) {
|
if (lua_isnumber(L, 1)) {
|
||||||
|
@ -561,6 +563,7 @@ int apiDiscSearch(lua_State *L) {
|
||||||
if (lua_isnumber(L, 1)) {
|
if (lua_isnumber(L, 1)) {
|
||||||
d = lua_tonumber(L, 1); frame = (int)d;
|
d = lua_tonumber(L, 1); frame = (int)d;
|
||||||
videoSeek(_videoHandle, frame);
|
videoSeek(_videoHandle, frame);
|
||||||
|
videoPause(_videoHandle);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -606,6 +609,7 @@ int apiDiscSkipBackward(lua_State *L) {
|
||||||
if (lua_isnumber(L, 1)) {
|
if (lua_isnumber(L, 1)) {
|
||||||
d = lua_tonumber(L, 1); frame = videoGetFrame(_videoHandle) - (int)d;
|
d = lua_tonumber(L, 1); frame = videoGetFrame(_videoHandle) - (int)d;
|
||||||
videoSeek(_videoHandle, frame);
|
videoSeek(_videoHandle, frame);
|
||||||
|
videoPlay(_videoHandle);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -643,6 +647,7 @@ int apiDiscSkipForward(lua_State *L) {
|
||||||
if (lua_isnumber(L, 1)) {
|
if (lua_isnumber(L, 1)) {
|
||||||
d = lua_tonumber(L, 1); frame = videoGetFrame(_videoHandle) + (int)d;
|
d = lua_tonumber(L, 1); frame = videoGetFrame(_videoHandle) + (int)d;
|
||||||
videoSeek(_videoHandle, frame);
|
videoSeek(_videoHandle, frame);
|
||||||
|
videoPlay(_videoHandle);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -662,9 +667,30 @@ int apiDiscSkipForward(lua_State *L) {
|
||||||
|
|
||||||
|
|
||||||
int apiDiscSkipToFrame(lua_State *L) {
|
int apiDiscSkipToFrame(lua_State *L) {
|
||||||
// Not really sure what this is, so just seek to a new frame.
|
int n = lua_gettop(L);
|
||||||
luaTrace(L, "discSkipToFrame", "Forwarding to discSearch.");
|
int frame = 0;
|
||||||
return apiDiscSearch(L);
|
bool result = false;
|
||||||
|
double d = 0;
|
||||||
|
|
||||||
|
if (!_discStopped) {
|
||||||
|
if (n == 1) {
|
||||||
|
if (lua_isnumber(L, 1)) {
|
||||||
|
d = lua_tonumber(L, 1); frame = (int)d;
|
||||||
|
videoSeek(_videoHandle, frame);
|
||||||
|
videoPlay(_videoHandle);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
luaTrace(L, "discSkipToFrame", "Failed! Disc is stopped.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
luaTrace(L, "discSkipToFrame", "%d", frame);
|
||||||
|
} else {
|
||||||
|
luaTrace(L, "discSkipToFrame", "Failed!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -676,6 +702,7 @@ int apiDiscStepBackward(lua_State *L) {
|
||||||
if (!_discStopped) {
|
if (!_discStopped) {
|
||||||
frame = videoGetFrame(_videoHandle) - 1;
|
frame = videoGetFrame(_videoHandle) - 1;
|
||||||
videoSeek(_videoHandle, frame);
|
videoSeek(_videoHandle, frame);
|
||||||
|
videoPause(_videoHandle);
|
||||||
luaTrace(L, "discStepBackward", "%d", frame);
|
luaTrace(L, "discStepBackward", "%d", frame);
|
||||||
} else {
|
} else {
|
||||||
luaTrace(L, "discStepBackward", "Failed! Disc is stopped.");
|
luaTrace(L, "discStepBackward", "Failed! Disc is stopped.");
|
||||||
|
@ -692,6 +719,7 @@ int apiDiscStepForward(lua_State *L) {
|
||||||
if (!_discStopped) {
|
if (!_discStopped) {
|
||||||
frame = videoGetFrame(_videoHandle) + 1;
|
frame = videoGetFrame(_videoHandle) + 1;
|
||||||
videoSeek(_videoHandle, frame);
|
videoSeek(_videoHandle, frame);
|
||||||
|
videoPause(_videoHandle);
|
||||||
luaTrace(L, "discStepForward", "%d", frame);
|
luaTrace(L, "discStepForward", "%d", frame);
|
||||||
} else {
|
} else {
|
||||||
luaTrace(L, "discStepForward", "Failed! Disc is stopped.");
|
luaTrace(L, "discStepForward", "Failed! Disc is stopped.");
|
||||||
|
@ -889,7 +917,6 @@ int apiFontToSprite(lua_State *L) {
|
||||||
luaDie(L, "fontToSprite", "Font surface is null!");
|
luaDie(L, "fontToSprite", "Font surface is null!");
|
||||||
} else {
|
} else {
|
||||||
SDL_SetColorKey(sprite->surface, true, 0);
|
SDL_SetColorKey(sprite->surface, true, 0);
|
||||||
//SDL_SetSurfaceAlphaMod(sprite->surface, 255);
|
|
||||||
sprite->id = _nextSpriteId;
|
sprite->id = _nextSpriteId;
|
||||||
result = _nextSpriteId++;
|
result = _nextSpriteId++;
|
||||||
HASH_ADD_INT(_spriteList, id, sprite);
|
HASH_ADD_INT(_spriteList, id, sprite);
|
||||||
|
@ -2049,9 +2076,8 @@ void singe(SDL_Window *window, SDL_Renderer *renderer) {
|
||||||
// Let us know when sounds end
|
// Let us know when sounds end
|
||||||
Mix_ChannelFinished(channelFinished);
|
Mix_ChannelFinished(channelFinished);
|
||||||
|
|
||||||
// Start video paused
|
// Start video
|
||||||
videoPlay(_videoHandle);
|
videoPlay(_videoHandle);
|
||||||
videoPause(_videoHandle);
|
|
||||||
_discStopped = false;
|
_discStopped = false;
|
||||||
|
|
||||||
// Start script
|
// Start script
|
||||||
|
@ -2216,7 +2242,6 @@ void singe(SDL_Window *window, SDL_Renderer *renderer) {
|
||||||
if (_refreshDisplay) {
|
if (_refreshDisplay) {
|
||||||
//***TODO*** Handle overlay and blank disk frames
|
//***TODO*** Handle overlay and blank disk frames
|
||||||
SDL_RenderCopy(_renderer, _videoTexture, NULL, NULL);
|
SDL_RenderCopy(_renderer, _videoTexture, NULL, NULL);
|
||||||
//makeZeroTransparent(_overlay);
|
|
||||||
overlayTexture = SDL_CreateTextureFromSurface(_renderer, _overlay);
|
overlayTexture = SDL_CreateTextureFromSurface(_renderer, _overlay);
|
||||||
if (!overlayTexture) utilDie("%s", SDL_GetError());
|
if (!overlayTexture) utilDie("%s", SDL_GetError());
|
||||||
if (!_confStretchVideo) {
|
if (!_confStretchVideo) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue