mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 12:01:47 +00:00
Added modifying sound captions to Lua infolib.
Also, replaced ridiculously ambiguous "impossible error" with more descriptive alternative.
This commit is contained in:
parent
3cce495675
commit
37fc95ca08
1 changed files with 16 additions and 3 deletions
|
|
@ -31,6 +31,7 @@ enum sfxinfo_read {
|
||||||
sfxinfor_singular,
|
sfxinfor_singular,
|
||||||
sfxinfor_priority,
|
sfxinfor_priority,
|
||||||
sfxinfor_flags, // "pitch"
|
sfxinfor_flags, // "pitch"
|
||||||
|
sfxinfor_caption,
|
||||||
sfxinfor_skinsound
|
sfxinfor_skinsound
|
||||||
};
|
};
|
||||||
const char *const sfxinfo_ropt[] = {
|
const char *const sfxinfo_ropt[] = {
|
||||||
|
|
@ -38,18 +39,21 @@ const char *const sfxinfo_ropt[] = {
|
||||||
"singular",
|
"singular",
|
||||||
"priority",
|
"priority",
|
||||||
"flags",
|
"flags",
|
||||||
|
"caption",
|
||||||
"skinsound",
|
"skinsound",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
enum sfxinfo_write {
|
enum sfxinfo_write {
|
||||||
sfxinfow_singular = 0,
|
sfxinfow_singular = 0,
|
||||||
sfxinfow_priority,
|
sfxinfow_priority,
|
||||||
sfxinfow_flags // "pitch"
|
sfxinfow_flags, // "pitch"
|
||||||
|
sfxinfow_caption
|
||||||
};
|
};
|
||||||
const char *const sfxinfo_wopt[] = {
|
const char *const sfxinfo_wopt[] = {
|
||||||
"singular",
|
"singular",
|
||||||
"priority",
|
"priority",
|
||||||
"flags",
|
"flags",
|
||||||
|
"caption",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -814,6 +818,9 @@ static int lib_setSfxInfo(lua_State *L)
|
||||||
case sfxinfow_flags:
|
case sfxinfow_flags:
|
||||||
info->pitch = (INT32)luaL_checkinteger(L, 3);
|
info->pitch = (INT32)luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
|
case sfxinfow_caption:
|
||||||
|
strlcpy(info->caption, luaL_checkstring(L, 3), sizeof(info->caption));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -851,11 +858,14 @@ static int sfxinfo_get(lua_State *L)
|
||||||
case sfxinfor_flags:
|
case sfxinfor_flags:
|
||||||
lua_pushinteger(L, sfx->pitch);
|
lua_pushinteger(L, sfx->pitch);
|
||||||
return 1;
|
return 1;
|
||||||
|
case sfxinfor_caption:
|
||||||
|
lua_pushstring(L, sfx->caption);
|
||||||
|
return 1;
|
||||||
case sfxinfor_skinsound:
|
case sfxinfor_skinsound:
|
||||||
lua_pushinteger(L, sfx->skinsound);
|
lua_pushinteger(L, sfx->skinsound);
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
return luaL_error(L, "impossible error");
|
return luaL_error(L, "Field does not exist in sfxinfo_t");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -886,8 +896,11 @@ static int sfxinfo_set(lua_State *L)
|
||||||
case sfxinfow_flags:
|
case sfxinfow_flags:
|
||||||
sfx->pitch = luaL_checkinteger(L, 1);
|
sfx->pitch = luaL_checkinteger(L, 1);
|
||||||
break;
|
break;
|
||||||
|
case sfxinfow_caption:
|
||||||
|
strlcpy(sfx->caption, luaL_checkstring(L, 1), sizeof(sfx->caption));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return luaL_error(L, "impossible error");
|
return luaL_error(L, "Field does not exist in sfxinfo_t");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue