|
From: <cro...@li...> - 2003-03-24 06:01:32
|
Module Name: client
Committed By: mwedel
Date: Mon Mar 24 06:01:30 UTC 2003
Modified Files:
client: CHANGES configure configure.in
client/common: client.c
client/gtk: gx11.h image.c sdl.c
client/x11: x11.c
Log Message:
276 draw_info(" savewinpos - save window positions - ", NDI_BLACK);
277 draw_info(" split windows mode only", NDI_BLACK);
278 draw_info(" savedefaults save various defaults into", NDI_BLACK);
279 draw_info(" ~/.crossfire/defaults", NDI_BLACK);
280 draw_info(" show - determine what type of items", NDI_BLACK);
281 draw_info(" to show in inventory", NDI_BLACK);
317 void command_take (const char *command, char *cpnext)
318 {
319 /* If the player has specified optional data, or the player
320 * does not have a container open, just issue the command
321 * as normal
322 */
323 if (cpnext || cpl.container == NULL)
324 send_command(command, cpl.count, 0);
325 else {
326 if (cpl.container->inv == NULL)
327 draw_info("There is nothing in the container to move", NDI_BLACK);
328 else
329 cs_print_string(csocket.fd,"move %d %d %d", cpl.ob->tag,
330 cpl.container->inv->tag, cpl.count);
331 }
332 }
333
334
335 /* This is an extended command (ie, 'who, 'whatever, etc). In general,
336 * we just send the command to the server, but there are a few that
337 * we care about (bind, unbind)
338 *
339 * The command past to us can not be modified - if it is a keybinding,
340 * we get passed the string that is that binding - modifying it effectively
341 * changes the binding.
342 */
343
344 void extended_command(const char *ocommand) {
345 const char *cp = ocommand;
346 char *cpnext, command[MAX_BUF];
347
348 if ((cpnext = strchr(cp, ' '))!=NULL) {
349 int len = cpnext - ocommand;
350 if (len > (MAX_BUF -1 )) len = MAX_BUF-1;
351
352 strncpy(command, ocommand, len);
353 command[len] = '\0';
354 cp = command;
355 while (*cpnext == ' ')
356 cpnext++;
357 if (*cpnext == 0)
358 cpnext = NULL;
359 }
360
361 /* cp now contains the command (everything before first space),
362 * and cpnext contains everything after that first space. cpnext
363 * could be NULL.
364 */
365
366 /* I alphabetized the list of commands below to make it easier to
367 * find/see what the extended commands are and what they do.
368 */
369 if (!strcmp(cp,"autorepeat")) set_autorepeat(cpnext);
370 else if (!strcmp(cp, "bind")) bind_key(cpnext);
336 * we just send the command to the server, but there are a few that
337 * we care about (bind, unbind)
338 *
339 * The command past to us can not be modified - if it is a keybinding,
340 * we get passed the string that is that binding - modifying it effectively
341 * changes the binding.
342 */
343
344 void extended_command(const char *ocommand) {
345 const char *cp = ocommand;
346 char *cpnext, command[MAX_BUF];
347
348 if ((cpnext = strchr(cp, ' '))!=NULL) {
349 int len = cpnext - ocommand;
350 if (len > (MAX_BUF -1 )) len = MAX_BUF-1;
351
352 strncpy(command, ocommand, len);
353 command[len] = '\0';
354 cp = command;
355 while (*cpnext == ' ')
356 cpnext++;
357 if (*cpnext == 0)
358 cpnext = NULL;
359 }
360
361 /* cp now contains the command (everything before first space),
362 * and cpnext contains everything after that first space. cpnext
363 * could be NULL.
364 */
365
366 /* I alphabetized the list of commands below to make it easier to
367 * find/see what the extended commands are and what they do.
368 */
369 if (!strcmp(cp,"autorepeat")) set_autorepeat(cpnext);
370 else if (!strcmp(cp, "bind")) bind_key(cpnext);
371 else if (!strcmp(cp,"cwindow")) set_command_window(cpnext);
Jove (C) [image.c:3] "common/player.c" - /export/home/crossfire/client-CVS (23:25)
[hugin:/export/home/crossfire/client-CVS] (137) % l
CHANGES Makefile.in aclocal.m4 config.status* gmon.out macros/ x11/
COPYING NOTES autom4te-2.53.cache/ configure* gnome/ pixmaps/
CVS/ README autom4te.cache/ configure.in gtk/ sdl/
License README.rpm common/ crossfire-client.spec help/ sound-src/
Makefile TODO config.log cscope.out logfile utils/
[hugin:/export/home/crossfire/client-CVS] (138) % more README
Install Steps:
0) Prerequisites:
You will need the XPM library to compile the client.
If you want to run the gtk client, you will need to install the gtk
libraries.
If you want png support, you will need to install the png
library.
If you want sdl support ( recommended) you will need both gtk and png
as well as the main SDL library and the SDL_image library, both of
which can be found at http://www.libsdl.org if not already installed
on your system.
1) type './configure' to configure for your OS/system. Most options
normally understood by configure should be available.
The configure script will try to make all the right decisions. It will
search for the needed libraries and headers. You may need to give
hints on the locations of some files (png library, gtk library).
If configure finds gtk libraries, it will build the gcfclient in addition
to the cfclient. If you don't want this (only cfclient), use the
--disable-gtk (there is no way to disable the cfclient at this time -
if you are able to compile the gtk client, you also have all the tools for
for the cfclient).
If SDL libraries are found on your system, SDL support is automatically
compiled it (Note: only the gcfclient supports sdl). Use --disable-sdl
if you don't want this.
The system will use the new sound system if available (this is a seperate
sound daemon). If you want to use the builtin sound system, use
the --enable-old-sound. See sound notes further down.
To specify additional places to find header files, use the
--with-includes=value - this includes any -I or other options to provide
the compiler. Example:
./configure --with-includes="-I/usr/local/include -I/opt/xpm/include"
Similarly, there is a --with-ldflags option. Example:
./configure --with-ldflags="-L/usr/local/lib -R/usr/local/lib"
-R is used on many systems to specify run location for libraries so
you don't need to set LD_LIBRARY_PATH.
Generally, if you are setting --with-includes, your probably need to
set --with-ldflags, as if one is not in a standard place, the other
probably is not either.
The client works with the 0.5 version of the ALSA sound system.
If you are using a newer version and are having troubles compiling,
try running configure with the '--disable-alsa' option.
2) Type 'make depend; make' to compile the client. If you get link errors,
it may be because you have an older version of the gtk libraries. If
you get errors like 'can't find target client.c', your make program
isn't very good and use should get/use gnu make instead.
3) Type 'make install' to install the binaries.
4) The client can be run by typing 'cfclient' for the X11 version, gcfclient
for the gtk client, gcfclient -sdl for the SDL version.
------------------------------------------------------------------------------
Converting keybindings from old save files for use with the client:
1) You will need to get a copy of your character file.
2) Type "mkdir ~/.crossfire". This will automatically be done the first
time you run the client.
3) Type awk 'BEGIN {ORS=" "} /^key /
{for (i=2; i<=NF; i++) print $i;printf "\n"}'
infile > ~/.crossfire/keys
(Note that this should all be entered on one line, but is broken up
here to be more readable.)
'infile' is the name of the character file.
Note that the client use global keybindings, and not per character. This
means that the same keybindings will be for all characters you play with the
client.
The gtk client and x11 client both use the same keybindings file.
------------------------------------------------------------------------------
Sound support:
If you wnat sound support (only useful if you have a system that has good
sound hardware), you will also need to get some sounds for the program.
You will need the raw sound files - the .au files no longer work with the
client.
The sounds file determines what file is played for what sound. The default
location for the sound files is <prefix>/share/cfclient/sounds. <prefix>
is the -prefix= option given when running configure, default of /usr/local.
You can set this to another directory at the configure stage by using
--with-sound-dir=/some/directory. This file is only used for compiled in
defaults. If you have a ~/.crossfire/sounds file (some format), that file
will be used instead of the built in defaults.
Sound are now played by separate process invoked from crossfire client.
The process - called sound server - adjusts sounds' volume according to
relative position of player and sound source on map and mixes the sounds
together, so many sounds can be played simultaneously.
CONFIG FILE
The config file ~/.crossfire/sndconfig contains some configurable settings. If
there is no such file, one with default settings will be created.
The file contains following fields:
stereo: 1 means stereo sound, 0 - mono
bits: bitrate of generated sound - 8 or 16
16 means better quality, especially when more sounds
are to be played simultaneously, but takes more memory
signed: if we should sent signed data to the soundcard. 1 means yes.
frequency: speed of playing data. This should be 11025, or sound pitch
will change
buffers: how many buffers to allocate
buflen: how big the buffers should be. buffers*buflen shouldn't be
smaller than the longest sound to be played.
simultaneously: home many sound can be played at the same time. When this
setting is bigger, each sound volume will decrease.
HOW DOES IT WORK?
The sound server gets information about sounds to be played on standard input.
The information is a line:
<sound number> <sound type> <relative x> <relative y>
All those numbers are hex.
The file ~/.crossfire/sounds contains description of sound numbers and types.
For example:
3 0 5 0
Means that normal sound SOUND_FUMBLE spell should be played as it's source was
5 units to the right of player.
Sounds are mixed in special buffers, which are in fact one buffer, which should
be big enough for the biggest sound to be played.
The buffers, if contain anything, are sent one by one to the sound device.
Each buffer is cleaned after playing.
Sounds data is multiplied by some ratio (<1) evaluated from it's position and
volume and added to the buffers, starting from the next after the one being
played.
So bigger buffer means bigger delay, before th sound is actually played, but
the smaller buffer is, the bigger is possibility, we won't succeed filling the
next buffer, before last is played.
------------------------------------------------------------------------------
IMAGES
The client will get any images that it is missing from the server. This
can include the entire image set.
To decrease bandwidth used when actually playing the sounds, it is suggested
you download the image archive and install it. The default location
for the archive is <prefix>/share/cfclient/, where <prefix> is deteremined
by the -prefix= option given when running configure.
The mechanism the client uses to find a matching image file when the
server tells it an image name is thus:
1) Look in ~/.crossfire/gfx. If an image is found here, irrespective of the
set and checksum of the image on the server, it will be used. The only
way images are placed into the gfx directory is by the user actually
copying them to that directory. The gfx directory allows a user to override
images with versions he prefers.
2) Look in ~/.crossfire/crossfire-images then <prefix>/share/cfclient/crossfire-images.
If the checksum matches the image from the
respective directory is used. Note that if the checksums match, it really doesn't
matter what image location we use, as it is the same image.
4) Get the image from the server. If -cache is set, a copy of it is put into
~/.crossfire/crossfire-images.
------------------------------------------------------------------------------
Authors of the client:
Mark Wedel (mw...@so...) - general client source and Xlib client
David Sundqvist (az...@ne...) - GTK+ port
Raphael Quinet (Rap...@ee...) - Configure scripts and
graphics
Jacek Konieczny <ja...@ze...> - New Sound System support.
Eric Anderson did a lot of initial work on the client.
Scott MacFiggen (sm...@CS...) - SDL support
[hugin:/export/home/crossfire/client-CVS] (139) %
[hugin:/export/home/crossfire/client-CVS] (139) % ls
CHANGES Makefile.in aclocal.m4 config.status gmon.out macros x11
COPYING NOTES autom4te-2.53.cache configure gnome pixmaps
CVS README autom4te.cache configure.in gtk sdl
License README.rpm common crossfire-client.spec help sound-src
Makefile TODO config.log cscope.out logfile utils
[hugin:/export/home/crossfire/client-CVS] (140) % cvs update -dP
Warning: Remote host denied X11 forwarding.
? autom4te-2.53.cache
? autom4te.cache
? cscope.out
? gmon.out
? logfile
*/
dark0 = the_map.cells[mx][my].darkness;
if (y-1 < 0 || !the_map.cells[mx][my-1].have_darkness) dark1 = dark0;
else dark1 = the_map.cells[mx][my-1].darkness;
if (x+1 >= use_config[CONFIG_MAPWIDTH] || !the_map.cells[mx+1][my].have_darkness) dark2 =!
else dark2 = the_map.cells[mx+1][my].darkness;
if (y+1 >= use_config[CONFIG_MAPHEIGHT] || !the_map.cells[mx][my+1].have_darkness) dark3 !
else dark3 = the_map.cells[mx][my+1].darkness;
if (x-1 < 0 || !the_map.cells[mx-1][my].have_darkness) dark4 = dark0;
else dark4 = the_map.cells[mx-1][my].darkness;
/* If they are all the same, processing is easy */
if (dark0 == dark1 && dark0 == dark2 && dark0 == dark3 && dark0 == dark4) {
dst.x = x * map_image_size;
dst.y = y * map_image_size;
dst.w = map_image_size;
dst.h = map_image_size;
if (dark0 == 255) {
SDL_FillRect(mapsurface,&dst, SDL_MapRGB(mapsurface->format, 0, 0, 0));
} else if (the_map.cells[mx][my].darkness != 0) {
SDL_FillRect(lightmap,NULL, SDL_MapRGBA(lightmap->format, 0, 0, 0, the_map.cells[!
SDL_BlitSurface(lightmap, NULL, mapsurface, &dst);
}
return;
}
if (use_config[CONFIG_LIGHTING] == CFG_LT_PIXEL ) {
/* This almost works as well as the per pixel code below, but does have some various
* artifacts in the drawing. It uses the same logic as the per pixel code below,
* bit since SDL does the blit, the alpha handling ends up being different
Jove (C) [sdl.c:3] "sdl.c" - /export/home/crossfire/client-CVS/gtk (23:34)
[hugin:/export/home/crossfire/client-CVS/gtk] (145) %
[hugin:/export/home/crossfire/client-CVS/gtk] (145) % l
CVS/ config.o gcfclient.man gx11.h keys.c png.c sound.c
Makefile crossfire-client.desktop gtkproto.h gx11.o keys.o png.o sound.o
Makefile.in cscope.out gx11.c image.c map.c sdl.c
config.c gcfclient* gx11.c~ image.o map.o sdl.o
[hugin:/export/home/crossfire/client-CVS/gtk] (146) % l *.h
gtkproto.h gx11.h
[hugin:/export/home/crossfire/client-CVS/gtk] (147) % more gx11.h
/*
* static char *rcsid_gx11_h =
* "$Id: gx11.h,v 1.6 2002/05/22 04:58:26 mwedel Exp $";
*/
/*
Crossfire client, a client program for the crossfire program.
Copyright (C) 2001 Mark Wedel & Crossfire Development Team
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 the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author can be reached via e-mail to cro...@re...
*/
#ifndef GX11_H
#define GX11_H
#include "client-types.h"
#include "item.h"
extern int map_size, image_size, map_image_size, map_image_half_size;
extern uint8 map_did_scroll;
extern uint8 updatekeycodes, time_map_redraw,redraw_needed;
extern int updatelock;
/* Pixmap data. This is abstracted in the sense that the
/* Pixmap data. This is abstracted in the sense that the
* code here does not care what the data points to (hence the
* void). The module using this data should know whether it
* is these point to png data or image data of whatever form.
* The module is not required to use all these fileds -
* as png data includes transperancy, it will generally not
* use the mask fields and instead just put its data into the
* appropiate image fields.
*
* As images can now be of variable size (and potentially re-sized),
* the size information is stored here.
*/
#define DEFAULT_IMAGE_SIZE 32
#define MAXPIXMAPNUM 10000
typedef struct {
void *icon_mask, *icon_image;
uint16 icon_width, icon_height;
void *map_mask, *map_image;
uint16 map_width, map_height;
void *fog_mask, *fog_image;
} PixmapInfo;
extern PixmapInfo *pixmaps[MAXPIXMAPNUM];
/* Some global widgetws */
extern GtkWidget *gtkwin_root,*drawingarea,*run_label,*fire_label;
extern GtkWidget *gtkwin_info, *gtkwin_stats, *gtkwin_message;
extern GtkWidget *gtkwin_look, *gtkwin_inv, *gtkwin_config;
extern GtkWidget *entrytext, *counttext;
extern GdkPixmap *mapwindow,*dark;
extern GdkBitmap *dark1, *dark2, *dark3;
extern GdkGC *mapgc;
extern GtkWidget *ckentrytext, *ckeyentrytext, *cmodentrytext,*cnumentrytext, *cclist;
extern GtkTooltips *tooltips;
#define TYPE_LISTS 9
Jove (C) [gx11.h:3] "gx11.h" - /export/home/crossfire/client-CVS/gtk (23:39)
...skipping...
/* Pixmap data. This is abstracted in the sense that the
* code here does not care what the data points to (hence the
* void). The module using this data should know whether it
* is these point to png data or image data of whatever form.
* The module is not required to use all these fileds -
* as png data includes transperancy, it will generally not
* use the mask fields and instead just put its data into the
* appropiate image fields.
*
* As images can now be of variable size (and potentially re-sized),
* the size information is stored here.
*/
#define DEFAULT_IMAGE_SIZE 32
#define MAXPIXMAPNUM 10000
typedef struct {
void *icon_mask, *icon_image;
uint16 icon_width, icon_height;
void *map_mask, *map_image;
uint16 map_width, map_height;
void *fog_mask, *fog_image;
} PixmapInfo;
extern PixmapInfo *pixmaps[MAXPIXMAPNUM];
/* Some global widgetws */
extern GtkWidget *gtkwin_root,*drawingarea,*run_label,*fire_label;
extern GtkWidget *gtkwin_info, *gtkwin_stats, *gtkwin_message;
extern GtkWidget *gtkwin_look, *gtkwin_inv, *gtkwin_config;
extern GtkWidget *entrytext, *counttext;
extern GdkPixmap *mapwindow,*dark;
extern GdkBitmap *dark1, *dark2, *dark3;
extern GdkGC *mapgc;
extern GtkWidget *ckentrytext, *ckeyentrytext, *cmodentrytext,*cnumentrytext, *cclist;
extern GtkTooltips *tooltips;
#define TYPE_LISTS 9
/*
[hugin:/export/home/crossfire/client-CVS/gtk] (148) % man printf
<standard input>:45: a newline character is not allowed in an escape name
<standard input>:48: a newline character is not allowed in an escape name
<standard input>:57: cannot use newline as a starting delimiter
<standard input>:60: warning: numeric expression expected (got `N')
PRINTF(1) FSF PRINTF(1)
NAME
printf - format and print data
SYNOPSIS
printf FORMAT [ARGUMENT]...
printf OPTION
DESCRIPTION
Print ARGUMENT(s) according to FORMAT.
--help display this help and exit
--version
output version information and exit
FORMAT controls the output as in C printf. Interpreted sequences are:
double quote
NNN character with octal value NNN (0 to 3 digits)
b backslash
a
c.... alert (BEL)
k
s.TP produce no further output
p
a
form feed
e
new line
carriage return
horizontal tab
vertical tab
N character with hexadecimal value NNN (1 to 3 digits)
%% a single %
%b ARGUMENT as a string with `<B4> escapes interpreted
and all C format specifications ending with one of diouxXfeEgGcs, with ARGU<AD>
MENTs converted to proper type first. Variable widths are handled.
REPORTING BUGS
Report bugs to <bug...@gn...>.
SEE ALSO
The full documentation for printf is maintained as a Texinfo manual. If the
info and printf programs are properly installed at your site, the command
info printf
should give you access to the complete manual.
COPYRIGHT
Copyright <A9> 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
GNU sh-utils 2.0 July 2000 PRINTF(1)
PRINTF(3) Linux Programmer's Manual PRINTF(3)
NAME
printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf -
formatted output conversion
SYNOPSIS
#include <stdio.h>
int printf(const char *format, ...);
int fprintf(FILE *stream, const char *format, ...);
int sprintf(char *str, const char *format, ...);
int snprintf(char *str, size_t size, const char *format, ...);
#include <stdarg.h>
int vprintf(const char *format, va_list ap);
int vfprintf(FILE *stream, const char *format, va_list ap);
int vsprintf(char *str, const char *format, va_list ap);
int vsnprintf(char *str, size_t size, const char *format, va_list ap);
DESCRIPTION
The functions in the printf family produce output according to a format as
described below. The functions printf and vprintf write output to stdout, the
standard output stream; fprintf and vfprintf write output to the given output
stream; sprintf, snprintf, vsprintf and vsnprintf write to the character
string str.
The functions vprintf, vfprintf, vsprintf, vsnprintf are equivalent to the
functions printf, fprintf, sprintf, snprintf, respectively, except that they
are called with a va_list instead of a variable number of arguments. These
functions do not call the va_end macro. Consequently, the value of ap is unde<AD>
fined after the call. The application should call va_end(ap) itself after<AD>
wards.
These eight functions write the output under the control of a format string
that specifies how subsequent arguments (or arguments accessed via the vari<AD>
able-length argument facilities of stdarg(3)) are converted for output.
Return value
These functions return the number of characters printed (not including the
trailing '\0' used to end output to strings). The functions snprintf and
vsnprintf do not write more than size bytes (including the trailing '\0'). If
the output was truncated due to this limit then the return value is the number
of characters (not including the trailing '\0') which would have been written
to the final string if enough space had been available. Thus, a return value
of size or more means that the output was truncated. (See also below under
NOTES.)
Format of the format string
The format string is a character string, beginning and ending in its initial
shift state, if any. The format string is composed of zero or more direc<AD>
tives: ordinary characters (not %), which are copied unchanged to the output
stream; and conversion specifications, each of which results in fetching zero
or more subsequent arguments. Each conversion specification is introduced by
the character %, and ends with a conversion specifier. In between there may
be (in this order) zero or more flags, an optional minimum field width, an
optional precision and an optional length modifier.
The arguments must correspond properly (after type promotion) with the conver<AD>
sion specifier. By default, the arguments are used in the order given, where
each `*' and each conversion specifier asks for the next argument (and it is
an error if insufficiently many arguments are given). One can also specify
explicitly which argument is taken, at each place where an argument is
required, by writing `%m$' instead of `%' and `*m$' instead of `*', where the
decimal integer m denotes the position in the argument list of the desired
argument, indexed starting from 1. Thus,
printf("%*d", width, num);
and
printf("%2$*1$d", width, num);
are equivalent. The second style allows repeated references to the same argu<AD>
ment. The C99 standard does not include the style using `$', which comes from
the Single Unix Specification. If the style using `$' is used, it must be
used throughout for all conversions taking an argument and all width and pre<AD>
cision arguments, but it may be mixed with `%%' formats which do not consume
an argument. There may be no gaps in the numbers of arguments specified using
`$'; for example, if arguments 1 and 3 are specified, argument 2 must also be
specified somewhere in the format string.
For some numeric conversions a radix character (`decimal point') or thousands'
grouping character is used. The actual character used depends on the
LC_NUMERIC part of the locale. The POSIX locale uses `.' as radix character,
and does not have a grouping character. Thus,
printf("%'.2f", 1234567.89);
results in `1234567.89' in the POSIX locale, in `1234567,89' in the nl_NL
locale, and in `1.234.567,89' in the da_DK locale.
The flag characters
The character % is followed by zero or more of the following flags:
# The value should be converted to an ``alternate form''. For o conver<AD>
sions, the first character of the output string is made zero (by pre<AD>
fixing a 0 if it was not zero already). For x and X conversions, a
non-zero result has the string `0x' (or `0X' for X conversions)
prepended to it. For a, A, e, E, f, F, g, and G conversions, the
result will always contain a decimal point, even if no digits follow it
(normally, a decimal point appears in the results of those conversions
only if a digit follows). For g and G conversions, trailing zeros are
not removed from the result as they would otherwise be. For other con<AD>
versions, the result is undefined.
0 The value should be zero padded. For d, i, o, u, x, X, a, A, e, E, f,
F, g, and G conversions, the converted value is padded on the left with
zeros rather than blanks. If the 0 and - flags both appear, the 0 flag
is ignored. If a precision is given with a numeric conversion (d, i,
o, u, x, and X), the 0 flag is ignored. For other conversions, the
behavior is undefined.
- The converted value is to be left adjusted on the field boundary. (The
default is right justification.) Except for n conversions, the con<AD>
verted value is padded on the right with blanks, rather than on the
left with blanks or zeros. A - overrides a 0 if both are given.
' ' (a space) A blank should be left before a positive number (or empty
string) produced by a signed conversion.
+ A sign (+ or -) always be placed before a number produced by a signed
conversion. By default a sign is used only for negative numbers. A +
overrides a space if both are used.
The five flag characters above are defined in the C standard. The SUSv2 spec<AD>
ifies one further flag character.
' For decimal conversion (i, d, u, f, F, g, G) the output is to be
grouped with thousands' grouping characters if the locale information
indicates any. Note that many versions of gcc cannot parse this option
and will issue a warning. SUSv2 does not include %'F.
glibc 2.2 adds one further flag character.
I For decimal integer conversion (i, d, u) the output uses the locale's
alternative output digits, if any (for example, Arabic digits). How<AD>
ever, it does not include any locale definitions with such outdigits
defined.
The field width
An optional decimal digit string (with nonzero first digit) specifying a mini<AD>
mum field width. If the converted value has fewer characters than the field
width, it will be padded with spaces on the left (or right, if the left-
adjustment flag has been given). Instead of a decimal digit string one may
write `*' or `*m$' (for some decimal integer m) to specify that the field
width is given in the next argument, or in the m-th argument, respectively,
which must be of type int. A negative field width is taken as a `-' flag fol<AD>
lowed by a positive field width. In no case does a non-existent or small
field width cause truncation of a field; if the result of a conversion is
wider than the field width, the field is expanded to contain the conversion
result.
The precision
An optional precision, in the form of a period (`.') followed by an optional
decimal digit string. Instead of a decimal digit string one may write `*' or
`*m$' (for some decimal integer m) to specify that the precision is given in
the next argument, or in the m-th argument, respectively, which must be of
type int. If the precision is given as just `.', or the precision is nega<AD>
tive, the precision is taken to be zero. This gives the minimum number of
digits to appear for d, i, o, u, x, and X conversions, the number of digits to
appear after the radix character for a, A, e, E, f, and F conversions, the
maximum number of significant digits for g and G conversions, or the maximum
number of characters to be printed from a string for s and S conversions.
The length modifier
Here, `integer conversion' stands for d, i, o, u, x, or X conversion.
hh A following integer conversion corresponds to a signed char or unsigned
char argument, or a following n conversion corresponds to a pointer to
a signed char argument.
h A following integer conversion corresponds to a short int or unsigned
short int argument, or a following n conversion corresponds to a
pointer to a short int argument.
l (ell) A following integer conversion corresponds to a long int or
unsigned long int argument, or a following n conversion corresponds to
a pointer to a long int argument, or a following c conversion corre<AD>
sponds to a wint_t argument, or a following s conversion corresponds to
a pointer to wchar_t argument.
ll (ell-ell). A following integer conversion corresponds to a long long
int or unsigned long long int argument, or a following n conversion
corresponds to a pointer to a long long int argument.
L A following a, A, e, E, f, F, g, or G conversion corresponds to a long
double argument. (C99 allows %LF, but SUSv2 does not.)
q (`quad'. BSD 4.4 and Linux libc5 only. Don't use.) This is a synonym
for ll.
"$Id: CHANGES,v 1.97 2003/02/25 07:52:21 mwedel Exp $"
Top of CVS tree:
------------------------------------------------------------------------------
configure.in, configure: checks added for alsa9 sound - update for cfsndserv.c
should come shortly.
common/client.c: Fix setup problem - it was using FOGWAR setting when
determining if client wanted darkness - should have been using darkness
setting. This was resulting in darkness not being used if fog of war was
turned off.
x11/x11.c: Modify handling of mouse button press logic - rather than only
modifier being shift, do appropriate logic if the shift mask is set,
but does not have to be only modifier set.
--
The following bits changes how fog of war looks in SDL mode. Now, fog of
war spaces are drawn in greyscale, instead of half darkness. This makes
it clearer what the status of the space is (fog of war/darkness). This change
probably uses less cpu to draw, but uses more memory for the images (as it
now has to store a rendered greyscale image). If not using SDL, you'll still
have the old behaviour (dimmed spaces for fog of war), and no significant
amount of extra memory will be used.
--
gtk/gx11.h: Add fog_image pointer to PixmapInfo structure.
gtk/image.c: Add code to render greyscale image. Also add code to free
greyscale image.
gtk/sdl.c: Modify map draw code to use grey fog image if space is fog of
war space. Disable dimming of fog spaces - no longer necessary as
space now looks different.
MSW 2003-03-24
The following files had too many changes to show the context diffs here:
cvs rdiff -r1.36 -r1.37 client/configure
Start of context diffs
Index: client/CHANGES
diff -c client/CHANGES:1.97 client/CHANGES:1.98
*** client/CHANGES:1.97 Mon Feb 24 23:52:21 2003
--- client/CHANGES Sun Mar 23 22:01:25 2003
***************
*** 1,6 ****
! "$Id: CHANGES,v 1.97 2003/02/25 07:52:21 mwedel Exp $"
Top of CVS tree:
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Changes for 1.5.0:
--- 1,32 ----
! "$Id: CHANGES,v 1.98 2003/03/24 06:01:25 mwedel Exp $"
Top of CVS tree:
------------------------------------------------------------------------------
+
+ configure.in, configure: checks added for alsa9 sound - update for cfsndserv.c
+ should come shortly.
+ common/client.c: Fix setup problem - it was using FOGWAR setting when
+ determining if client wanted darkness - should have been using darkness
+ setting. This was resulting in darkness not being used if fog of war was
+ turned off.
+ x11/x11.c: Modify handling of mouse button press logic - rather than only
+ modifier being shift, do appropriate logic if the shift mask is set,
+ but does not have to be only modifier set.
+ --
+ The following bits changes how fog of war looks in SDL mode. Now, fog of
+ war spaces are drawn in greyscale, instead of half darkness. This makes
+ it clearer what the status of the space is (fog of war/darkness). This change
+ probably uses less cpu to draw, but uses more memory for the images (as it
+ now has to store a rendered greyscale image). If not using SDL, you'll still
+ have the old behaviour (dimmed spaces for fog of war), and no significant
+ amount of extra memory will be used.
+ --
+ gtk/gx11.h: Add fog_image pointer to PixmapInfo structure.
+ gtk/image.c: Add code to render greyscale image. Also add code to free
+ greyscale image.
+ gtk/sdl.c: Modify map draw code to use grey fog image if space is fog of
+ war space. Disable dimming of fog spaces - no longer necessary as
+ space now looks different.
+ MSW 2003-03-24
------------------------------------------------------------------------------
Changes for 1.5.0:
Index: client/configure.in
diff -c client/configure.in:1.35 client/configure.in:1.36
*** client/configure.in:1.35 Mon Feb 24 23:52:22 2003
--- client/configure.in Sun Mar 23 22:01:26 2003
***************
*** 162,195 ****
AC_CHECK_LIB(asound, main, alsa_sound=yes, , -lm)
fi
AC_CHECK_LIB(audio, alNewConfig, sgi_sound=yes, )
AC_CHECK_HEADER(sys/soundcard.h, oss_sound=yes, oss_sound=no)
AC_CHECK_HEADER(sys/audioio.h, sun_sound=yes, sun_sound=no)
! if eval "test x$alsa_sound = xyes"; then
! echo "Using ALSA sound system"
! CFLAGS="$CFLAGS -DALSA_SOUND"
SND_LIBS="-lasound -lm"
SUBDIRS="$SUBDIRS sound-src"
! else
! if eval "test x$sgi_sound = xyes"; then
echo "Using SGI sound system"
! CFLAGS="$CFLAGS -DSGI_SOUND"
! SND_LIBS="-laudio"
! SUBDIRS="$SUBDIRS sound-src"
! else
! if eval "test x$oss_sound = xyes"; then
! echo "Using OSS sound system"
! CFLAGS="$CFLAGS -DOSS_SOUND"
! SND_LIBS="-lm"
! SUBDIRS="$SUBDIRS sound-src"
else
! if eval "test x$sun_sound = xyes"; then
! echo "Using solaris sound system"
! CFLAGS="$CFLAGS -DSUN_SOUND"
! SND_LIBS="-lm"
! SUBDIRS="$SUBDIRS sound-src"
! else
! echo "No suitable sound system found."
fi
fi
fi
--- 162,203 ----
AC_CHECK_LIB(asound, main, alsa_sound=yes, , -lm)
fi
AC_CHECK_LIB(audio, alNewConfig, sgi_sound=yes, )
+ AC_CHECK_HEADER(alsa/asoundlib.h, alsa9_sound=yes, alsa_sound=no)
AC_CHECK_HEADER(sys/soundcard.h, oss_sound=yes, oss_sound=no)
AC_CHECK_HEADER(sys/audioio.h, sun_sound=yes, sun_sound=no)
! if eval "test x$alsa9_sound = xyes"; then
! echo "Using ALSA sound system (0.9.x)"
! CFLAGS="$CFLAGS -DALSA9_SOUND"
SND_LIBS="-lasound -lm"
SUBDIRS="$SUBDIRS sound-src"
! else
! if eval "test x$alsa_sound = xyes"; then
! echo "Using ALSA sound system"
! CFLAGS="$CFLAGS -DALSA_SOUND"
! SND_LIBS="-lasound -lm"
! SUBDIRS="$SUBDIRS sound-src"
! else
! if eval "test x$sgi_sound = xyes"; then
echo "Using SGI sound system"
! CFLAGS="$CFLAGS -DSGI_SOUND"
! SND_LIBS="-laudio"
! SUBDIRS="$SUBDIRS sound-src"
else
! if eval "test x$oss_sound = xyes"; then
! echo "Using OSS sound system"
! CFLAGS="$CFLAGS -DOSS_SOUND"
! SND_LIBS="-lm"
! SUBDIRS="$SUBDIRS sound-src"
! else
! if eval "test x$sun_sound = xyes"; then
! echo "Using solaris sound system"
! CFLAGS="$CFLAGS -DSUN_SOUND"
! SND_LIBS="-lm"
! SUBDIRS="$SUBDIRS sound-src"
! else
! echo "No suitable sound system found."
! fi
fi
fi
fi
Index: client/common/client.c
diff -c client/common/client.c:1.12 client/common/client.c:1.13
*** client/common/client.c:1.12 Sun Jan 12 20:54:50 2003
--- client/common/client.c Sun Mar 23 22:01:28 2003
***************
*** 1,6 ****
/*
* static char *rcsid_client_c =
! * "$Id: client.c,v 1.12 2003/01/13 04:54:50 mwedel Exp $";
*/
/*
Crossfire client, a client program for the crossfire program.
--- 1,6 ----
/*
* static char *rcsid_client_c =
! * "$Id: client.c,v 1.13 2003/03/24 06:01:28 mwedel Exp $";
*/
/*
Crossfire client, a client program for the crossfire program.
***************
*** 264,270 ****
cs_print_string(csocket.fd,
"setup map1acmd 1 sound %d sexp %d darkness %d newmapcmd 1 faceset %d facecache %d itemcmd 2",
sound>=0, want_skill_exp,
! want_config[CONFIG_FOGWAR], face_info.faceset,
want_config[CONFIG_CACHE]);
use_config[CONFIG_MAPHEIGHT]=want_config[CONFIG_MAPHEIGHT];
--- 264,270 ----
cs_print_string(csocket.fd,
"setup map1acmd 1 sound %d sexp %d darkness %d newmapcmd 1 faceset %d facecache %d itemcmd 2",
sound>=0, want_skill_exp,
! want_config[CONFIG_LIGHTING]?1:0, face_info.faceset,
want_config[CONFIG_CACHE]);
use_config[CONFIG_MAPHEIGHT]=want_config[CONFIG_MAPHEIGHT];
Index: client/gtk/gx11.h
diff -c client/gtk/gx11.h:1.6 client/gtk/gx11.h:1.7
*** client/gtk/gx11.h:1.6 Tue May 21 21:58:26 2002
--- client/gtk/gx11.h Sun Mar 23 22:01:29 2003
***************
*** 1,6 ****
/*
* static char *rcsid_gx11_h =
! * "$Id: gx11.h,v 1.6 2002/05/22 04:58:26 mwedel Exp $";
*/
/*
Crossfire client, a client program for the crossfire program.
--- 1,6 ----
/*
* static char *rcsid_gx11_h =
! * "$Id: gx11.h,v 1.7 2003/03/24 06:01:29 mwedel Exp $";
*/
/*
Crossfire client, a client program for the crossfire program.
***************
*** 55,60 ****
--- 55,61 ----
uint16 icon_width, icon_height;
void *map_mask, *map_image;
uint16 map_width, map_height;
+ void *fog_image;
} PixmapInfo;
extern PixmapInfo *pixmaps[MAXPIXMAPNUM];
Index: client/gtk/image.c
diff -c client/gtk/image.c:1.11 client/gtk/image.c:1.12
*** client/gtk/image.c:1.11 Fri May 31 00:26:03 2002
--- client/gtk/image.c Sun Mar 23 22:01:29 2003
***************
*** 1,6 ****
/*
* static char *rcsid_image_c =
! * "$Id: image.c,v 1.11 2002/05/31 07:26:03 mwedel Exp $";
*/
/*
Crossfire client, a client program for the crossfire program.
--- 1,6 ----
/*
* static char *rcsid_image_c =
! * "$Id: image.c,v 1.12 2003/03/24 06:01:29 mwedel Exp $";
*/
/*
Crossfire client, a client program for the crossfire program.
***************
*** 129,144 ****
--- 129,201 ----
if (use_config[CONFIG_SDL]) {
#if defined(HAVE_SDL)
+ int i;
+ SDL_Surface *fog;
+ uint32 g,*p;
+ uint8 *l;
+
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
pi->map_image = SDL_CreateRGBSurfaceFrom(data, pi->map_width,
pi->map_height, 32, pi->map_width * 4, 0xff,
0xff00, 0xff0000, 0xff000000);
+
+ fog = SDL_CreateRGBSurface(SDL_SRCALPHA | SDL_HWSURFACE,
+ pi->map_width, pi->map_height, 32, 0xff,
+ 0xff00, 0xff0000, 0xff000000);
+ SDL_LockSurface(fog);
+
+ for (i=0; i < pi->map_width * pi->map_height; i++) {
+ l = (uint8 *) (data + i*4);
+ #if 1
+ g = MAX(*l, *(l+1));
+ g = MAX(g, *(l+2));
+ #else
+ g = ( *l + *(l+1) + *(l+2)) / 3;
+ #endif
+ p = (uint32*) fog->pixels + i;
+ *(uint32*) p = g | (g << 8) | (g << 16) | (*(l + 3) << 24);
+ }
+
+ SDL_UnlockSurface(fog);
+ pi->fog_image = fog;
#else
/* Big endian */
pi->map_image = SDL_CreateRGBSurfaceFrom(data, pi->map_width,
pi->map_height, 32, pi->map_width * 4, 0xff000000,
0xff0000, 0xff00, 0xff);
+ fog = SDL_CreateRGBSurface(SDL_SRCALPHA | SDL_HWSURFACE,
+ pi->map_width, pi->map_height, 32, 0xff000000,
+ 0xff0000, 0xff00, 0xff);
+ SDL_LockSurface(fog);
+
+ /* I think this works out, but haven't tried it on a big
+ * endian machine - my recollection is that the png data
+ * would be in the same order, just the bytes for it to go
+ * on teh screen are reversed.
+ */
+ for (i=0; i < pi->map_width * pi->map_height; i++) {
+ l = (uint8 *) (data + i*4);
+ #if 1
+ g = MAX(*l, *(l+1));
+ g = MAX(g, *(l+2));
+ #else
+ g = ( *l + *(l+1) + *(l+2)) / 3;
+ #endif
+ p = (uint32*) fog->pixels + i;
+ *(uint32*) p = (g << 8) | (g << 16) | (g << 24) | *(l + 3);
+ }
+
+ for (i=0; i < pi->map_width * pi->map_height; i+= 4) {
+ p = (uint32) (fog->pixels + i);
+ g = ( ((p >> 24) & 0xff) + ((p >> 16) & 0xff) + ((p >> 8) & 0xff)) / 3;
+ p = (g << 24) | (g << 16) | (g << 8) | (p & 0xff);
+ l = (uint32*) fog->pixels + i;
+ *(uint32*) l = p;
+ }
+
+ SDL_UnlockSurface(fog);
+ pi->fog_image = fog;
#endif
#endif
***************
*** 160,165 ****
--- 217,224 ----
if (use_config[CONFIG_SDL]) {
SDL_FreeSurface(pi->map_image);
free(((SDL_Surface*)pi->map_image)->pixels);
+ SDL_FreeSurface(pi->fog_image);
+ free(((SDL_Surface*)pi->fog_image)->pixels);
}
else
#endif
Index: client/gtk/sdl.c
diff -c client/gtk/sdl.c:1.7 client/gtk/sdl.c:1.8
*** client/gtk/sdl.c:1.7 Wed Jul 3 14:10:54 2002
--- client/gtk/sdl.c Sun Mar 23 22:01:29 2003
***************
*** 1,6 ****
/*
* static char *rcsid_sdl_c =
! * "$Id: sdl.c,v 1.7 2002/07/03 21:10:54 mwedel Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_sdl_c =
! * "$Id: sdl.c,v 1.8 2003/03/24 06:01:29 mwedel Exp $";
*/
/*
***************
*** 591,599 ****
src.h = map_image_size;
dst.x = x * map_image_size;
dst.y = y * map_image_size;
! if (SDL_BlitSurface(pixmaps[the_map.cells[mx][my].tails[layer].face]->map_image,
! &src, mapsurface, &dst))
! do_SDL_error( "BlitSurface", __FILE__, __LINE__);
}
/* Draw the head now - logic is pretty much exactly the same
* as that for the tail, except we know that we this is at the lower right,
--- 591,605 ----
src.h = map_image_size;
dst.x = x * map_image_size;
dst.y = y * map_image_size;
! if (the_map.cells[mx][my].cleared) {
! if (SDL_BlitSurface(pixmaps[the_map.cells[mx][my].tails[layer].face]->fog_image,
! &src, mapsurface, &dst))
! do_SDL_error( "BlitSurface", __FILE__, __LINE__);
! } else {
! if (SDL_BlitSurface(pixmaps[the_map.cells[mx][my].tails[layer].face]->map_image,
! &src, mapsurface, &dst))
! do_SDL_error( "BlitSurface", __FILE__, __LINE__);
! }
}
/* Draw the head now - logic is pretty much exactly the same
* as that for the tail, except we know that we this is at the lower right,
***************
*** 608,622 ****
src.h = map_image_size;
dst.x = x * map_image_size;
dst.y = y * map_image_size;
! if (SDL_BlitSurface(pixmaps[the_map.cells[mx][my].heads[layer].face]->map_image,
! &src, mapsurface, &dst))
! do_SDL_error( "BlitSurface", __FILE__, __LINE__);
}
} /* else for processing the layers */
/* Do final logic for this map space */
the_map.cells[mx][my].need_update=0;
if (the_map.cells[mx][my].cleared == 1 && use_config[CONFIG_FOGWAR]) {
/* If this is a fogcell, copy over the fogmap */
dst.x = x * map_image_size;
--- 614,635 ----
src.h = map_image_size;
dst.x = x * map_image_size;
dst.y = y * map_image_size;
! if (the_map.cells[mx][my].cleared) {
! if (SDL_BlitSurface(pixmaps[the_map.cells[mx][my].heads[layer].face]->fog_image,
! &src, mapsurface, &dst))
! do_SDL_error( "BlitSurface", __FILE__, __LINE__);
! } else {
! if (SDL_BlitSurface(pixmaps[the_map.cells[mx][my].heads[layer].face]->map_image,
! &src, mapsurface, &dst))
! do_SDL_error( "BlitSurface", __FILE__, __LINE__);
! }
}
} /* else for processing the layers */
/* Do final logic for this map space */
the_map.cells[mx][my].need_update=0;
+ #if 0
if (the_map.cells[mx][my].cleared == 1 && use_config[CONFIG_FOGWAR]) {
/* If this is a fogcell, copy over the fogmap */
dst.x = x * map_image_size;
***************
*** 626,632 ****
/* Only worry about lighting if it is not a fog cell. If it is
* a fog cell, lighting information is probably bogus.
*/
! else if (use_config[CONFIG_LIGHTING] == CFG_LT_TILE) {
dst.x = x * map_image_size;
dst.y = y * map_image_size;
dst.w = map_image_size;
--- 639,647 ----
/* Only worry about lighting if it is not a fog cell. If it is
* a fog cell, lighting information is probably bogus.
*/
! else
! #endif
! if (use_config[CONFIG_LIGHTING] == CFG_LT_TILE) {
dst.x = x * map_image_size;
dst.y = y * map_image_size;
dst.w = map_image_size;
Index: client/x11/x11.c
diff -c client/x11/x11.c:1.13 client/x11/x11.c:1.14
*** client/x11/x11.c:1.13 Fri Feb 21 09:15:52 2003
--- client/x11/x11.c Sun Mar 23 22:01:29 2003
***************
*** 1,6 ****
/*
* static char *rcsid_x11_c =
! * "$Id: x11.c,v 1.13 2003/02/21 17:15:52 crowbert Exp $";
*/
/*
Crossfire client, a client program for the crossfire program.
--- 1,6 ----
/*
* static char *rcsid_x11_c =
! * "$Id: x11.c,v 1.14 2003/03/24 06:01:29 mwedel Exp $";
*/
/*
Crossfire client, a client program for the crossfire program.
***************
*** 2441,2453 ****
if (tmp) {
switch(button) {
case 1:
! if (xbutton->state == ShiftMask)
toggle_locked(tmp);
else
client_send_examine (tmp->tag);
break;
case 2:
! if (xbutton->state == ShiftMask)
send_mark_obj(tmp);
else
client_send_apply (tmp->tag);
--- 2441,2453 ----
if (tmp) {
switch(button) {
case 1:
! if (xbutton->state & ShiftMask)
toggle_locked(tmp);
else
client_send_examine (tmp->tag);
break;
case 2:
! if (xbutton->state & ShiftMask)
send_mark_obj(tmp);
else
client_send_apply (tmp->tag);
|