Changed the 1/0 for the "center" drawing parameter to be true/false.

This commit is contained in:
Scott Duensing 2023-12-01 20:21:32 -06:00
parent 5173a88dc8
commit 89b8bb427d
2 changed files with 92 additions and 92 deletions

View file

@ -12,9 +12,9 @@ New Features
sprite's center as the anchor instead of the upper right. This is highly
useful when dealing with rotated sprites.
- Sprite scaling and rotation! Optional separate X & Y scaling.
- Sprite anti-aliasing, scaling and rotation! Optional separate X & Y scaling.
- Optional sprite anti-aliasing.
- Video anti-aliasing, scaling and rotation! Optional separate X & Y scaling.
- Multiple audio track support for videos. New command line options to select
which default audio track you want (-o or --audio). For games with multiple

View file

@ -1949,33 +1949,34 @@ int32_t apiSpriteDraw(lua_State *L) {
if ((n >= 3) && (n <= 6)) {
if (lua_isnumber(L, 1)) {
if (lua_isnumber(L, 2)) {
if (lua_isnumber(L, 3)) {
d = lua_tonumber(L, 1); dest.x = (int32_t)d;
d = lua_tonumber(L, 2); dest.y = (int32_t)d;
// Centered?
if ((n == 3) || (n == 4)) {
if (n == 4) {
if (lua_isnumber(L, 4)) {
d = lua_tonumber(L, 3); center = (int32_t)d != 0;
if (lua_isboolean(L, 3) && lua_isnumber(L, 4)) {
d = lua_toboolean(L, 3); center = (int32_t)d != 0;
d = lua_tonumber(L, 4); id = (int32_t)d;
}
} else {
if (lua_isnumber(L, 3)) {
d = lua_tonumber(L, 3); id = (int32_t)d;
}
}
}
if ((n == 5) || (n == 6)) {
// Target is scaled
if (lua_isnumber(L, 4)) {
if (lua_isnumber(L, 5)) {
d = lua_tonumber(L, 3); dest.w = (int32_t)d - dest.x + 1;
d = lua_tonumber(L, 4); dest.h = (int32_t)d - dest.y + 1;
// Centered?
if (n == 6) {
if (lua_isnumber(L, 6)) {
d = lua_tonumber(L, 5); center = (int32_t)d != 0;
if (lua_isboolean(L, 5) && lua_isnumber(L, 6)) {
d = lua_toboolean(L, 5); center = (int32_t)d != 0;
d = lua_tonumber(L, 6); id = (int32_t)d;
}
} else {
if (lua_isnumber(L, 6)) {
d = lua_tonumber(L, 5); id = (int32_t)d;
}
}
@ -2004,7 +2005,6 @@ int32_t apiSpriteDraw(lua_State *L) {
}
}
}
}
if (id >= 0) {
luaTrace(L, "spriteDraw", "%d %d %d %d %d %d", id, dest.x, dest.y, dest.w, dest.h, center);
@ -2305,20 +2305,21 @@ int32_t apiVideoDraw(lua_State *L) {
if (lua_isnumber(L, 1)) {
if (lua_isnumber(L, 2)) {
if (lua_isnumber(L, 3)) {
if (lua_isnumber(L, 4)) {
d = lua_tonumber(L, 1); id = (int32_t)d;
d = lua_tonumber(L, 2); dest.x = (int32_t)d;
d = lua_tonumber(L, 3); dest.y = (int32_t)d;
if (n == 5) {
if (lua_isnumber(L, 5)) {
if (lua_isnumber(L, 4) && lua_isnumber(L, 5)) {
d = lua_tonumber(L, 4); dest.w = (int32_t)d - dest.x + 1;
d = lua_tonumber(L, 5); dest.h = (int32_t)d - dest.y + 1;
}
} else {
d = lua_tonumber(L, 4); center = (int32_t)d != 0;
if (lua_isboolean(L, 4)) {
d = lua_toboolean(L, 4); center = (int32_t)d != 0;
dest.w = 0;
dest.h = 0;
}
}
// Get our video structure
HASH_FIND_INT(_global.videoList, &id, video);
@ -2359,7 +2360,6 @@ int32_t apiVideoDraw(lua_State *L) {
}
}
}
}
if (result) {
luaTrace(L, "videoDraw", "%d %d %d %d %d %ld", id, dest.x, dest.y, dest.x + dest.w, dest.y + dest.h, frame);