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