mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
add some sounds to the menus (not yet finished)
This commit is contained in:
parent
c2894dcfce
commit
72daa2fd2b
16 changed files with 119 additions and 26 deletions
|
@ -191,6 +191,12 @@ void S_AmbientOff (void);
|
|||
*/
|
||||
void S_AmbientOn (void);
|
||||
|
||||
/** Link sound engine builtins into the specified progs vm
|
||||
\param pr the vm to link the builtins into.
|
||||
*/
|
||||
struct progs_s;
|
||||
void S_Progs_Init (struct progs_s *pr);
|
||||
|
||||
//@}
|
||||
|
||||
#endif // _SOUND_H
|
||||
|
|
|
@ -51,6 +51,7 @@ void RUA_Obj_Init (struct progs_s *pr, int secure);
|
|||
void RUA_Plist_Init (struct progs_s *pr, int secure);
|
||||
|
||||
void RUA_Script_Init (progs_t *pr, int secure);
|
||||
|
||||
void RUA_String_Init (struct progs_s *pr, int secure);
|
||||
|
||||
void RUA_QFile_Init (struct progs_s *pr, int secure);
|
||||
|
|
|
@ -3,5 +3,7 @@ AUTOMAKE_OPTIONS= foreign
|
|||
# everything depends on util
|
||||
# gamecode depends on gib (only for builtins, not the engine)
|
||||
# ruamoko depends on gamecode (engine only, not builtins)
|
||||
SUBDIRS=util audio console gib gamecode image models net qw ruamoko \
|
||||
# audio depends on gamecode
|
||||
# console depends on ruamoko and audio
|
||||
SUBDIRS=util gib gamecode ruamoko audio console image models net qw \
|
||||
video
|
||||
|
|
|
@ -9,7 +9,7 @@ EXTRA_LTLIBRARIES= libQFsound.la libQFcd.la
|
|||
|
||||
libQFsound_la_LDFLAGS= -version-info 1:0:0 -rpath $(libdir)
|
||||
libQFsound_la_LIBADD= @SND_PLUGIN_STATIC_LIBS@ @SND_REND_STATIC_LIBS@ $(top_builddir)/libs/util/libQFutil.la
|
||||
libQFsound_la_SOURCES= snd.c
|
||||
libQFsound_la_SOURCES= snd.c snd_progs.c
|
||||
libQFsound_la_DEPENDENCIES= @SND_PLUGIN_STATIC_LIBS@ @SND_REND_STATIC_LIBS@
|
||||
|
||||
libQFcd_la_LDFLAGS= -version-info 1:0:0 -rpath $(libdir)
|
||||
|
|
62
libs/audio/snd_progs.c
Normal file
62
libs/audio/snd_progs.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
snd_progs.c
|
||||
|
||||
CSQC sound builtins
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static __attribute__ ((used)) const char rcsid[] =
|
||||
"$Id: rua_qfs.c 11332 2006-12-20 12:08:57Z taniwha $";
|
||||
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/progs.h"
|
||||
#include "QF/sound.h"
|
||||
|
||||
static void
|
||||
bi_S_LocalSound (progs_t *pr)
|
||||
{
|
||||
const char *sound = P_GSTRING (pr, 0);
|
||||
|
||||
S_LocalSound (sound);
|
||||
}
|
||||
|
||||
static builtin_t builtins[] = {
|
||||
{"S_LocalSound", bi_S_LocalSound, -1},
|
||||
{0}
|
||||
};
|
||||
|
||||
VISIBLE void
|
||||
S_Progs_Init (progs_t *pr)
|
||||
{
|
||||
PR_RegisterBuiltins (pr, builtins);
|
||||
}
|
|
@ -22,7 +22,7 @@ libQFconsole_la_LIBADD= $(plugin_libadd) $(top_builddir)/libs/util/libQFutil.la
|
|||
libQFconsole_la_SOURCES= $(common_sources)
|
||||
|
||||
console_client_la_LDFLAGS= $(plugin_ldflags)
|
||||
console_client_la_LIBADD= $(plugin_libadd)
|
||||
console_client_la_LIBADD= $(plugin_libadd) $(top_builddir)/libs/audio/libQFsound.la
|
||||
console_client_la_SOURCES= $(client_sources)
|
||||
|
||||
console_server_la_LDFLAGS= $(plugin_ldflags)
|
||||
|
|
|
@ -48,6 +48,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/quakefs.h"
|
||||
#include "QF/render.h"
|
||||
#include "QF/ruamoko.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/view.h"
|
||||
|
||||
|
@ -461,6 +462,7 @@ Menu_Init (void)
|
|||
GIB_Progs_Init (&menu_pr_state);
|
||||
PR_Cmds_Init (&menu_pr_state);
|
||||
R_Progs_Init (&menu_pr_state);
|
||||
S_Progs_Init (&menu_pr_state);
|
||||
|
||||
confirm_quit = Cvar_Get ("confirm_quit", "1", CVAR_ARCHIVE, NULL,
|
||||
"confirm quit command");
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "system.h"
|
||||
#include "string.h"
|
||||
#include "key.h"
|
||||
#include "sound.h"
|
||||
|
||||
#include "Array.h"
|
||||
#include "gui/Text.h"
|
||||
|
@ -75,12 +76,14 @@
|
|||
{
|
||||
if (++current >= [views count])
|
||||
current = base;
|
||||
S_LocalSound ("misc/menu1.wav");
|
||||
}
|
||||
|
||||
-(void) prev
|
||||
{
|
||||
if (--current < base)
|
||||
current = [views count] - 1;
|
||||
S_LocalSound ("misc/menu1.wav");
|
||||
}
|
||||
|
||||
- (void) draw
|
||||
|
@ -195,6 +198,7 @@
|
|||
{
|
||||
[toggle toggle];
|
||||
[self update];
|
||||
S_LocalSound ("misc/menu3.wav");
|
||||
}
|
||||
|
||||
- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down
|
||||
|
@ -243,11 +247,13 @@
|
|||
-(void)next
|
||||
{
|
||||
[color next];
|
||||
S_LocalSound ("misc/menu2.wav");
|
||||
}
|
||||
|
||||
-(void)prev
|
||||
{
|
||||
[color prev];
|
||||
S_LocalSound ("misc/menu2.wav");
|
||||
}
|
||||
|
||||
-(void)draw
|
||||
|
@ -358,12 +364,14 @@
|
|||
{
|
||||
[range inc];
|
||||
[self update];
|
||||
S_LocalSound ("misc/menu3.wav");
|
||||
}
|
||||
|
||||
-(void)dec
|
||||
{
|
||||
[range dec];
|
||||
[self update];
|
||||
S_LocalSound ("misc/menu3.wav");
|
||||
}
|
||||
|
||||
- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down
|
||||
|
@ -408,6 +416,7 @@
|
|||
-(void) next
|
||||
{
|
||||
[crosshair next];
|
||||
S_LocalSound ("misc/menu2.wav");
|
||||
}
|
||||
|
||||
-(void) draw
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "math.h"
|
||||
#include "physics.h"
|
||||
#include "qw_message.h"
|
||||
#include "sound.h"
|
||||
#include "sv_sound.h"
|
||||
|
||||
#include "tempent.h"
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ pkgincludedir= $(includedir)/QF/ruamoko
|
|||
nobase_pkginclude_HEADERS= \
|
||||
crudefile.h debug.h entities.h infokey.h math.h message.h nq_message.h \
|
||||
physics.h qfile.h qfs.h qw_message.h qw_physics.h qw_sys.h server.h \
|
||||
sound.h script.h string.h system.h \
|
||||
sound.h script.h string.h sv_sound.h system.h \
|
||||
\
|
||||
draw.h key.h \
|
||||
\
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
#ifndef __ruamoko_sound_h
|
||||
#define __ruamoko_sound_h
|
||||
|
||||
#define CHAN_AUTO 0
|
||||
#define CHAN_WEAPON 1
|
||||
#define CHAN_VOICE 2
|
||||
#define CHAN_ITEM 3
|
||||
#define CHAN_BODY 4
|
||||
#define CHAN_NO_PHS_ADD 8
|
||||
|
||||
#define ATTN_NONE 0
|
||||
#define ATTN_NORM 1
|
||||
#define ATTN_IDLE 2
|
||||
#define ATTN_STATIC 3
|
||||
|
||||
@extern void (entity e, float chan, string samp, float vol, float atten) sound;
|
||||
@extern void (vector pos, string samp, float vol, float atten) ambientsound;
|
||||
@extern void (string sound) S_LocalSound;
|
||||
|
||||
#endif//__ruamoko_sound_h
|
||||
|
|
19
ruamoko/include/sv_sound.h
Normal file
19
ruamoko/include/sv_sound.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
#ifndef __ruamoko_sound_h
|
||||
#define __ruamoko_sound_h
|
||||
|
||||
#define CHAN_AUTO 0
|
||||
#define CHAN_WEAPON 1
|
||||
#define CHAN_VOICE 2
|
||||
#define CHAN_ITEM 3
|
||||
#define CHAN_BODY 4
|
||||
#define CHAN_NO_PHS_ADD 8
|
||||
|
||||
#define ATTN_NONE 0
|
||||
#define ATTN_NORM 1
|
||||
#define ATTN_IDLE 2
|
||||
#define ATTN_STATIC 3
|
||||
|
||||
@extern void (entity e, float chan, string samp, float vol, float atten) sound;
|
||||
@extern void (vector pos, string samp, float vol, float atten) ambientsound;
|
||||
|
||||
#endif//__ruamoko_sound_h
|
|
@ -27,7 +27,8 @@ EXTRA_LIBRARIES= $(ruamoko_libs)
|
|||
$(QFCC) $(QCFLAGS) $(QCPPFLAGS) -c -o $@ $<
|
||||
|
||||
libr_a_SOURCES=\
|
||||
cbuf.r cmd.r cvar.r file.r hash.r plist.r qfile.r qfs.r script.r string.r \
|
||||
cbuf.r cmd.r cvar.r file.r hash.r plist.r qfile.r qfs.r script.r sound.r \
|
||||
string.r \
|
||||
AutoreleasePool.r Array.r Entity.r List.r ListNode.r Object.r \
|
||||
PropertyList.r Protocol.r Stack.r
|
||||
libr_a_AR=$(PAK) -cf
|
||||
|
@ -35,12 +36,12 @@ libr_a_AR=$(PAK) -cf
|
|||
libqw_a_SOURCES=\
|
||||
crudefile.r debug.r entities.r infokey.r math.r message.r \
|
||||
physics.r qw_message.r qw_physics.r qw_sys.r \
|
||||
server.r sound.r system.r
|
||||
server.r sv_sound.r system.r
|
||||
libqw_a_AR=$(PAK) -cf
|
||||
|
||||
libnq_a_SOURCES=\
|
||||
crudefile.r debug.r entities.r infokey.r math.r message.r \
|
||||
nq_message.r physics.r server.r sound.r system.r
|
||||
nq_message.r physics.r server.r sv_sound.r system.r
|
||||
libnq_a_AR=$(PAK) -cf
|
||||
|
||||
libcsqc_a_SOURCES= \
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "sound.h"
|
||||
|
||||
void (entity e, float chan, string samp, float vol, float atten) sound = #8;
|
||||
void (vector pos, string samp, float vol, float atten) ambientsound = #74;
|
||||
void (string sound) S_LocalSound = #0;
|
||||
|
|
4
ruamoko/lib/sv_sound.r
Normal file
4
ruamoko/lib/sv_sound.r
Normal file
|
@ -0,0 +1,4 @@
|
|||
#include "sound.h"
|
||||
|
||||
void (entity e, float chan, string samp, float vol, float atten) sound = #8;
|
||||
void (vector pos, string samp, float vol, float atten) ambientsound = #74;
|
|
@ -594,8 +594,9 @@ opt_initializer
|
|||
var_initializer
|
||||
: '=' expr // don't bother folding twice
|
||||
{
|
||||
if (current_scope->type == sc_local
|
||||
|| current_scope->type == sc_params) {
|
||||
if (current_scope->type == sc_params) {
|
||||
notice (0, "whee");
|
||||
} else if (current_scope->type == sc_local) {
|
||||
expr_t *expr = assign_expr (new_def_expr ($<def>0), $2);
|
||||
expr = fold_constants (expr);
|
||||
append_expr (local_expr, expr);
|
||||
|
|
Loading…
Reference in a new issue