mirror of
https://github.com/UberGames/RPG-X2.git
synced 2024-11-22 20:41:05 +00:00
8af8e25a22
Changed version to "Beta 8.4.7 wc1", Beta 8.4.7 working copy 1.
36 lines
579 B
C
36 lines
579 B
C
// sound lib for lua
|
|
|
|
#include "g_lua.h"
|
|
|
|
#ifdef G_LUA
|
|
|
|
static int Sound_PlaySound(lua_State *L) {
|
|
char *sound;
|
|
int snd;
|
|
int chan;
|
|
lent_t *l;
|
|
|
|
l = Lua_GetEntity(L,1);
|
|
if(!l || !l->e) return 0;
|
|
|
|
sound = (char*)luaL_checkstring(L,2);
|
|
if(!sound[0]) return 0;
|
|
|
|
chan = luaL_checknumber(L,3);
|
|
|
|
snd = G_SoundIndex(sound);
|
|
G_AddEvent(l->e, EV_SCRIPT_SOUND, snd + (chan << 8));
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const luaL_Reg lib_sound[] = {
|
|
{"PlaySound", Sound_PlaySound},
|
|
{NULL, NULL}
|
|
};
|
|
|
|
int Luaopen_Sound(lua_State *L) {
|
|
luaL_register(L, "sound", lib_sound);
|
|
return 1;
|
|
}
|
|
#endif
|