[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freesci-develop] r1591 - in freesci/branches/glutton/src: . engine gfx
From: |
freesci |
Subject: |
[freesci-develop] r1591 - in freesci/branches/glutton/src: . engine gfx include sfx sfx/pcm_device |
Date: |
Sun, 14 Jan 2007 23:22:07 +0100 |
Author: jameson
Date: 2007-01-14 23:21:58 +0100 (Sun, 14 Jan 2007)
New Revision: 1591
Modified:
freesci/branches/glutton/src/engine/game.c
freesci/branches/glutton/src/engine/kgraphics.c
freesci/branches/glutton/src/gfx/gfx_res_options.c
freesci/branches/glutton/src/gfx/resmgr.c
freesci/branches/glutton/src/include/sfx_engine.h
freesci/branches/glutton/src/include/versions.h
freesci/branches/glutton/src/include/vm.h
freesci/branches/glutton/src/main.c
freesci/branches/glutton/src/sfx/core.c
freesci/branches/glutton/src/sfx/pcm_device/alsa.c
Log:
* Added ``-q'' option to disable sound
-- Christoph
Modified: freesci/branches/glutton/src/engine/game.c
===================================================================
--- freesci/branches/glutton/src/engine/game.c 2006-12-13 16:28:16 UTC (rev
1590)
+++ freesci/branches/glutton/src/engine/game.c 2007-01-14 22:21:58 UTC (rev
1591)
@@ -269,14 +269,12 @@
/*------------------------------------------------------------*/
int
-game_init_sound(state_t *s)
+game_init_sound(state_t *s, int sound_flags)
{
- int flags = 0;
-
if (s->resmgr->sci_version >= SCI_VERSION_01)
- flags |= SFX_STATE_FLAG_MULTIPLAY;
+ sound_flags |= SFX_STATE_FLAG_MULTIPLAY;
- sfx_init(&s->sound, s->resmgr, flags);
+ sfx_init(&s->sound, s->resmgr, sound_flags);
return 0;
}
@@ -654,7 +652,7 @@
sfx_exit(&s->sound);
/* Reinit because some other code depends on having a valid state */
- game_init_sound(s);
+ game_init_sound(s, SFX_STATE_FLAG_NOSOUND);
sm_destroy(&s->seg_manager);
Modified: freesci/branches/glutton/src/engine/kgraphics.c
===================================================================
--- freesci/branches/glutton/src/engine/kgraphics.c 2006-12-13 16:28:16 UTC
(rev 1590)
+++ freesci/branches/glutton/src/engine/kgraphics.c 2007-01-14 22:21:58 UTC
(rev 1591)
@@ -21,7 +21,7 @@
Current Maintainer:
- Christoph Reichenbach (CR) address@hidden
+ Christoph Reichenbach (CR) address@hidden
***************************************************************************/
Modified: freesci/branches/glutton/src/gfx/gfx_res_options.c
===================================================================
--- freesci/branches/glutton/src/gfx/gfx_res_options.c 2006-12-13 16:28:16 UTC
(rev 1590)
+++ freesci/branches/glutton/src/gfx/gfx_res_options.c 2007-01-14 22:21:58 UTC
(rev 1591)
@@ -604,6 +604,7 @@
UPDATE_COL(b, 2);
#undef UPDATE_COL
}
+ break;
}
default:
Modified: freesci/branches/glutton/src/gfx/resmgr.c
===================================================================
--- freesci/branches/glutton/src/gfx/resmgr.c 2006-12-13 16:28:16 UTC (rev
1590)
+++ freesci/branches/glutton/src/gfx/resmgr.c 2007-01-14 22:21:58 UTC (rev
1591)
@@ -391,6 +391,33 @@
}
+static void
+set_pic_id(gfx_resource_t *res, int id)
+{
+ if (res->scaled_data.pic) {
+ gfxr_pic_t *pic = res->scaled_data.pic;
+ pic->control_map->ID = id;
+ pic->priority_map->ID = id;
+ pic->visual_map->ID = id;
+ }
+
+ if (res->unscaled_data.pic) {
+ gfxr_pic_t *pic = res->unscaled_data.pic;
+ pic->control_map->ID = id;
+ pic->priority_map->ID = id;
+ pic->visual_map->ID = id;
+ }
+}
+
+static int
+get_pic_id(gfx_resource_t *res)
+{
+ if (res->scaled_data.pic)
+ return res->scaled_data.pic->visual_map->ID;
+ else
+ return res->unscaled_data.pic->visual_map->ID;
+}
+
gfxr_pic_t *
gfxr_add_to_pic(gfx_resstate_t *state, int old_nr, int new_nr, int maps, int
flags,
int old_default_palette, int default_palette, int scaled)
@@ -435,9 +462,14 @@
res->mode = MODE_INVALID; /* Invalidate */
- pic = gfxr_pic_xlate_common(res, maps, scaled, 1, state->driver->mode,
- state->options->pic_xlate_filter, 1,
- state->options);
+ {
+ int old_ID = get_pic_id(res);
+ set_pic_id(res, GFXR_RES_ID(restype, new_nr)); /* To ensure
that our graphical translation optoins work properly */
+ pic = gfxr_pic_xlate_common(res, maps, scaled, 1,
state->driver->mode,
+ state->options->pic_xlate_filter, 1,
+ state->options);
+ set_pic_id(res, old_ID);
+ }
if (scaled || state->options->pic0_unscaled && maps & GFX_MASK_VISUAL)
gfxr_antialiase(pic->visual_map, state->driver->mode,
Modified: freesci/branches/glutton/src/include/sfx_engine.h
===================================================================
--- freesci/branches/glutton/src/include/sfx_engine.h 2006-12-13 16:28:16 UTC
(rev 1590)
+++ freesci/branches/glutton/src/include/sfx_engine.h 2007-01-14 22:21:58 UTC
(rev 1591)
@@ -39,6 +39,7 @@
#define SFX_STATE_FLAG_MULTIPLAY (1 << 0) /* More than one song playable
** simultaneously ? */
+#define SFX_STATE_FLAG_NOSOUND (1 << 1) /* Completely disable sound playing */
#define SFX_DEBUG_SONGS (1 << 0) /* Debug song changes */
Modified: freesci/branches/glutton/src/include/versions.h
===================================================================
--- freesci/branches/glutton/src/include/versions.h 2006-12-13 16:28:16 UTC
(rev 1590)
+++ freesci/branches/glutton/src/include/versions.h 2007-01-14 22:21:58 UTC
(rev 1591)
@@ -1,3 +1,4 @@
+
/***************************************************************************
versions.h Copyright (C) 1999,2000,01 Christoph Reichenbach
Modified: freesci/branches/glutton/src/include/vm.h
===================================================================
--- freesci/branches/glutton/src/include/vm.h 2006-12-13 16:28:16 UTC (rev
1590)
+++ freesci/branches/glutton/src/include/vm.h 2007-01-14 22:21:58 UTC (rev
1591)
@@ -684,9 +684,10 @@
*/
int
-game_init_sound(struct _state *s);
+game_init_sound(struct _state *s, int sound_flags);
/* Initializes the sound part of an SCI game
** Parameters: (state_t *) s: The state to initialize the sound in
+** (int) sound_flags: Flags to pass to the sound subsystem
** Returns : (int) 0 on success, 1 if an error occured
** This function may only be called if game_init() did not initialize
** the graphics data.
Modified: freesci/branches/glutton/src/main.c
===================================================================
--- freesci/branches/glutton/src/main.c 2006-12-13 16:28:16 UTC (rev 1590)
+++ freesci/branches/glutton/src/main.c 2007-01-14 22:21:58 UTC (rev 1591)
@@ -373,6 +373,7 @@
int script_debug_flag;
int scale_x, scale_y, color_depth;
int mouse;
+ int master_sound; /* on or off */
int show_rooms;
sci_version_t version;
int res_version;
@@ -402,6 +403,7 @@
{"run", no_argument, NULL, 0 },
{"debug", no_argument, NULL, 1 },
{"gamedir", required_argument, 0, 'd'},
+ {"no-sound", required_argument, 0, 'q'},
{"sci-version", required_argument, 0, 'V'},
{"graphics", required_argument, 0, 'g'},
{"midiout", required_argument, 0, 'O'},
@@ -434,13 +436,14 @@
cl_options->midi_device_name = NULL;
cl_options->sound_server_name = NULL;
cl_options->mouse = ON;
+ cl_options->master_sound = ON;
cl_options->res_version = SCI_VERSION_AUTODETECT;
cl_options->show_rooms = 0;
#ifdef HAVE_GETOPT_LONG
- while ((c = getopt_long(argc, argv, "lvhmsDr:d:V:g:x:y:c:M:O:S:P:f:",
options, &optindex)) > -1) {
+ while ((c = getopt_long(argc, argv, "qlvhmsDr:d:V:g:x:y:c:M:O:S:P:f:",
options, &optindex)) > -1) {
#else /* !HAVE_GETOPT_LONG */
- while ((c = getopt(argc, argv, "lvhmsDr:d:V:g:x:y:c:M:O:S:P:f:")) > -1)
{
+ while ((c = getopt(argc, argv, "qlvhmsDr:d:V:g:x:y:c:M:O:S:P:f:")) >
-1) {
#endif /* !HAVE_GETOPT_LONG */
switch (c) {
@@ -521,6 +524,10 @@
cl_options->mouse = OFF;
break;
+ case 'q':
+ cl_options->master_sound = OFF;
+ break;
+
case 0: /* getopt_long already did this for us */
break;
@@ -569,6 +576,7 @@
EXPLAIN_OPTION("--mididevice drv", "-Mdrv", "use
the 'drv' midi device (eg mt32 or adlib)")
EXPLAIN_OPTION("--pcmout drv\t", "-Pdrv", "use
the 'drv' pcmout driver")
EXPLAIN_OPTION("--sound-server srv", "-Ssrv",
"Specifies the asynchronous sound server to use")
+ EXPLAIN_OPTION("--no-sound\t", "-q", "disable
sound output")
EXPLAIN_OPTION("--list-savegames", "-l", "Lists
all savegame IDs")
EXPLAIN_OPTION("--show-rooms\t", "-s","Displays
room numbers on the game console")
"\n"
@@ -1284,7 +1292,7 @@
return 1;
}
- if (game_init_sound(gamestate)) {
+ if (game_init_sound(gamestate, (cl_options.master_sound == OFF)?
SFX_STATE_FLAG_NOSOUND : 0)) {
fprintf(stderr,"Game initialization failed: Error in sound
subsystem. Aborting...\n");
return 1;
}
Modified: freesci/branches/glutton/src/sfx/core.c
===================================================================
--- freesci/branches/glutton/src/sfx/core.c 2006-12-13 16:28:16 UTC (rev
1590)
+++ freesci/branches/glutton/src/sfx/core.c 2007-01-14 22:21:58 UTC (rev
1591)
@@ -422,12 +422,21 @@
{
song_lib_init(&self->songlib);
self->song = NULL;
+ self->flags = flags;
+ self->debug = 0; /* Disable all debugging by default */
+
+ if (flags & SFX_STATE_FLAG_NOSOUND) {
+ mixer = NULL;
+ pcm_device = NULL;
+ player = NULL;
+ sciprintf("[SFX] Sound disabled.\n");
+ return;
+ }
+
mixer = sfx_pcm_find_mixer(NULL);
pcm_device = sfx_pcm_find_device(NULL);
player = sfx_find_player(NULL);
- self->flags = flags;
- self->debug = 0; /* Disable all debugging by default */
#ifdef DEBUG_SONG_API
fprintf(stderr, "[sfx-core] Initialising: flags=%x\n", flags);
Modified: freesci/branches/glutton/src/sfx/pcm_device/alsa.c
===================================================================
--- freesci/branches/glutton/src/sfx/pcm_device/alsa.c 2006-12-13 16:28:16 UTC
(rev 1590)
+++ freesci/branches/glutton/src/sfx/pcm_device/alsa.c 2007-01-14 22:21:58 UTC
(rev 1591)
@@ -37,7 +37,7 @@
#include <alsa/asoundlib.h>
-static char *device = "hw:0,0"; /* FIXME */ /* Or "plughw:0,0" */
+static char *device = "hw:0,0"; /* FIXME: Try "default" first */ /* Or
"plughw:0,0" */
static snd_pcm_format_t format = SND_PCM_FORMAT_S16;
static unsigned int rate = 44100; /* FIXME */
static unsigned int channels = 2; /* FIXME */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freesci-develop] r1591 - in freesci/branches/glutton/src: . engine gfx include sfx sfx/pcm_device,
freesci <=