mirror of
https://github.com/UberGames/RPG-X2.git
synced 2025-02-21 10:41:18 +00:00
lol don't know what I fixed/added anymore sorry
This commit is contained in:
parent
0eed14f78c
commit
2a1f7b4263
7 changed files with 47 additions and 1 deletions
|
@ -72,7 +72,8 @@ OBJ = \
|
|||
lua_vector.o \
|
||||
lua_mover.o \
|
||||
lua_qmath.o \
|
||||
lua_cinematic.o
|
||||
lua_cinematic.o \
|
||||
lua_sound.o
|
||||
|
||||
# game object for syscalls to the engine
|
||||
SOOBJ = \
|
||||
|
@ -170,6 +171,7 @@ lua_mover.o: lua_mover.c; $(DO_CC)
|
|||
lua_qmath.o: lua_qmath.c; $(DO_CC)
|
||||
lua_vector.o: lua_vector.c; $(DO_CC)
|
||||
lua_cinematic.o: lua_cinematic.c; $(DO_CC)
|
||||
lua_sound.o: lua_sound.c; $(DO_CC)
|
||||
|
||||
# game syscalls
|
||||
g_syscalls.o : g_syscalls.c; $(DO_CC)
|
||||
|
|
|
@ -272,6 +272,7 @@ qboolean G_LuaStartVM(lvm_t * vm)
|
|||
Luaopen_Vector(vm->L);
|
||||
Luaopen_Entity(vm->L);
|
||||
Luaopen_Cinematic(vm->L);
|
||||
Luaopen_Sound(vm->L);
|
||||
|
||||
res = luaL_loadbuffer(vm->L, vm->code, vm->code_size, vm->filename);
|
||||
if(res == LUA_ERRSYNTAX)
|
||||
|
|
|
@ -77,4 +77,7 @@ int Luaopen_Mover(lua_State *L);
|
|||
// lua_cinematic.c
|
||||
int Luaopen_Cinematic(lua_State *L);
|
||||
|
||||
// lua_sound.c
|
||||
int Luaopen_Sound(lua_State *L);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -449,6 +449,7 @@
|
|||
</ClCompile>
|
||||
<ClCompile Include="lua_mover.c" />
|
||||
<ClCompile Include="lua_qmath.c" />
|
||||
<ClCompile Include="lua_sound.c" />
|
||||
<ClCompile Include="lundump.c" />
|
||||
<ClCompile Include="lvm.c" />
|
||||
<ClCompile Include="lzio.c" />
|
||||
|
|
|
@ -264,6 +264,9 @@
|
|||
<ClCompile Include="lua_cinematic.c">
|
||||
<Filter>Source Files\lua</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lua_sound.c">
|
||||
<Filter>Source Files\lua</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ai_chat.h">
|
||||
|
|
36
game/lua_sound.c
Normal file
36
game/lua_sound.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
// 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
|
BIN
stefgame.suo
BIN
stefgame.suo
Binary file not shown.
Loading…
Reference in a new issue